diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..bfa0b0731293805c0d1d5b9f8a7733ea35bc3ae0 --- /dev/null +++ b/README.md @@ -0,0 +1,123 @@ +--- +pretty_name: VersionQA-Software +license: other +license_name: mixed-open-source +license_link: https://huggingface.co/datasets/VersionRAG/VersionQA-Software/blob/main/LICENSES.md +language: + - en +task_categories: + - question-answering + - text-retrieval +size_categories: + - 1K//` | +| `evaluation/evaluation_set.csv` | 869 question–answer pairs with a category label | +| `chunks/chunks.parquet` | the corpus pre-chunked (512 tokens, 50 overlap) with `(document, version)` provenance | +| `LICENSES.md` | per-file source URL, retrieval date and governing licence | + +### Question categories + +| Category | n | Version-sensitive | +|---|---:|:---:| +| Content Retrieval | 150 | no | +| Content Retrieval Complex | 139 | no | +| Content Retrieval Version-Specific | 143 | **yes** | +| Version Listing & Inquiry | 145 | **yes** | +| Change Retrieval (Explicit) | 149 | **yes** | +| Change Retrieval (Implicit) | 143 | **yes** | +| **Total** | **869** | | + +*Explicit* change facts are stated somewhere in the corpus, typically in a changelog. *Implicit* +ones are not: they exist only as the difference between two consecutive versions and must be +materialised at index time. + +## Usage + +```python +from datasets import load_dataset + +qa = load_dataset("VersionRAG/VersionQA-Software", "evaluation", split="test") +chunks = load_dataset("VersionRAG/VersionQA-Software", "chunks", split="train") +``` + +The corpus itself is plain Markdown; clone the repo to index it yourself. + +## How the questions were built + +Questions are generated per category from the indexed corpus and validated against it during +generation: items in the structure-dependent categories are re-checked against the index, ambiguous +ones dropped and wrong golds corrected. Implicit-change items are additionally verified by hand, +including confirming that the gold answer appears in no indexed chunk. + +Gold answers are model-generated and corpus-validated rather than authored by domain experts. A +stratified audit of 120 released golds found three defective, an error rate of 2.5% [0.9–7.1]; all +three were localisation errors rather than fabricated facts. Accuracy differences narrower than +that margin should not be read as established. See `audit/` and Appendix E.4 of the paper. + +## Known issues + +- Some questions appear more than once; de-duplication is in progress. The evaluation set as + released is the one the paper's numbers were computed on. +- Version histories are projected onto a single total order, so parallel release lines are + flattened. Branching histories are out of scope. + +## Licence + +The corpus aggregates documentation under several open-source and open-content licences +(BSD-3-Clause, MIT, Apache-2.0, the PSF Licence, CC BY 3.0/4.0, the PostgreSQL Licence, and GPLv2 +for Wireshark). Per-file provenance and the governing licence are in `LICENSES.md`. The questions, +gold answers and chunking are released under CC BY 4.0. + +## Citation + +```bibtex +@inproceedings{stuhlmann2027versionrag, + title = {{VersionRAG}: Version-Aware Retrieval-Augmented Generation for Evolving Documents}, + author = {Stuhlmann, Linus and Mathitharan, Kajaluxan and Huwiler, Daniel and + Stockinger, Kurt and F{\"u}rst, Jonathan}, + booktitle = {Findings of the Association for Computational Linguistics: EACL 2027}, + year = {2027} +} +``` diff --git a/chunks/chunks.parquet b/chunks/chunks.parquet new file mode 100644 index 0000000000000000000000000000000000000000..860a79ab40c16fabb31783c182dbf8d924af326a --- /dev/null +++ b/chunks/chunks.parquet @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55bbd0bf6b7718188535b1b95c3cd59f50db9d5c38141e779442b9dc4daba0b8 +size 4230913 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.12.2.md b/corpus/changelog/docker_compose_releases/docker_compose_2.12.2.md new file mode 100644 index 0000000000000000000000000000000000000000..9b63277ab91a6c8ca11fdeb8af503b7b83ab523d --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.12.2.md @@ -0,0 +1,13 @@ +# Docker Compose release 2.12.2 + +Source: https://docs.docker.com/compose/releases/release-notes/#2122 + +## [2.12.2](#2122) + +*2022-10-21* + +### [Updates](#updates-3) + +* Updated Docker Engine API to restore compatibility with Golang 1.18 needed for Linux packaging. Pull Request [compose#9940](https://github.com/docker/compose/pull/9940) + +For the full change log or additional information, check the [Compose repository 2.12.2 release page](https://github.com/docker/compose/releases/tag/v2.12.2). diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.13.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.13.0.md new file mode 100644 index 0000000000000000000000000000000000000000..f0581f5a03aebc33041da77e72178d8c1ed3eb70 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.13.0.md @@ -0,0 +1,26 @@ +# Docker Compose release 2.13.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2130 + +## [2.13.0](#2130) + +*2022-11-23* + +### [Updates](#updates-2) + +* Dependencies upgrade: bump containerd to 1.6.10 +* Dependencies upgrade: bump docker-credential-helpers to v0.7.0 +* Update CI dependencies. Pull Request [compose#9982](https://github.com/docker/compose/pull/9982) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-77) + +* Added a `no-consistency` option to `convert` command. Fixed [compose#9963](https://github.com/docker/compose/issues/9963) +* Added a `build` option to `run` command. Fixed [compose#10003](https://github.com/docker/compose/issues/10003) +* Fixed mapping `restart_policy.condition` to engine supported values. Fixed [compose#8756](https://github.com/docker/compose/issues/8756), [docs#15936](https://github.com/docker/docs/pull/15936) +* Fixed missing support of `deploy.reservation.memory`. Fixed [compose#9902](https://github.com/docker/compose/issues/9902) +* Fixed a bug to prevent usage of `COMPOSE_PROFILES` when `--profile` arg is used. Fixed [compose#9895](https://github.com/docker/compose/issues/9895) +* Fixed a bug to prevent pulling a service's image when depending on a service which will build this image. Fixed [compose#9983](https://github.com/docker/compose/issues/9983) +* Fixed parsing issue when a container number label is not found. Fixed [compose#10004](https://github.com/docker/compose/issues/10004) +* Compose now uses the platform value defined by `DOCKER_DEFAULT_PLATFORM` when no `service.platform` defined. Fixed [compose#9889](https://github.com/docker/compose/issues/9889) +* Removed usage of the deprecated dependency `gotest.tools` v2. Pull Request [compose#9935](https://github.com/docker/compose/pull/9935) +* Excluded issues labeled with `kind/feature` from stale bot process. Fixed [compose#9988](https://github.com/docker/compose/pull/9988) diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.14.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.14.0.md new file mode 100644 index 0000000000000000000000000000000000000000..982fded8613737491e4ca6f9b518d91a217aeaf1 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.14.0.md @@ -0,0 +1,24 @@ +# Docker Compose release 2.14.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2140 + +## [2.14.0](#2140) + +*2022-12-02* + +### [Updates](#updates-1) + +* Dependencies upgrade: bump compose-go to [v1.8.0](https://github.com/compose-spec/compose-go/releases/tag/v1.8.0) +* Dependencies upgrade: bump Go to 1.19.3 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-76) + +* Added `oom_score_adj` field to service definition. Pull Request [compose#10019](https://github.com/docker/compose/issues/10019) +* Added mode field for tmpfs mount permissions. Pull Request [compose#10031](https://github.com/docker/compose/issues/10031) +* Compose now only stops services started by `up` when interrupted. Fixed [compose#10028](https://github.com/docker/compose/issues/10028) +* Compose now loads implicit profiles for targeted services. Fixed [compose#10025](https://github.com/docker/compose/issues/10025) +* Compose does not require `service.build.platforms` to be set if `service.platform` is set. Fixed [compose#10017](https://github.com/docker/compose/issues/10017) +* Plain output is used during buildx image builds if `--ansi=never` is set. Fixed [compose#10020](https://github.com/docker/compose/issues/10020) +* `COMPOSE_IGNORE_ORPHANS` environment variable now behaves more consistently. Fixed [compose#10035](https://github.com/docker/compose/issues/10035) +* Compose now uses the correct image name separator in `convert`. Fixed [compose#9904](https://github.com/docker/compose/issues/9904) +* Fixed `run` for services using `network_mode: service:NAME`. Fixed [compose#10036](https://github.com/docker/compose/issues/10036) diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.14.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.14.1.md new file mode 100644 index 0000000000000000000000000000000000000000..b7edf29046704e6b10612d544c3721603a16e51d --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.14.1.md @@ -0,0 +1,29 @@ +# Docker Compose release 2.14.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2141 + +## [2.14.1](#2141) + +*2022-12-15* + +### [Updates](#updates) + +* Dependencies upgrade: bump Go to 1.19.4 +* Dependencies upgrade: bump containerd to 1.6.12 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-75) + +* Added `--parallel` to limit concurrent engine calls. Pull Request [compose#10030](https://github.com/docker/compose/pull/10030) +* Distinguished stdout and stderr in `up` logs. Fixed [compose#8098](https://github.com/docker/compose/issues/8098) +* Aligned `compose ps` output with `docker ps`. Fixed [compose#6867](https://github.com/docker/compose/issues/6867) +* Added `--include-deps` to push command. Pull Request [compose#10044](https://github.com/docker/compose/pull/10044) +* Introduced `--timestamp` option on `compose up`. Fixed [compose#5730](https://github.com/docker/compose/issues/5730) +* Compose now applies uid/gid when creating a secret from the environment. Pull Request [compose#10084](https://github.com/docker/compose/pull/10084) +* Fixed deadlock when waiting for attached-dependencies. Fixed [compose#10021](https://github.com/docker/compose/pull/10021) +* Fixed race condition when collecting pulled images IDs. Fixed [compose#9897](https://github.com/docker/compose/pull/9897) +* Compose doesn't stop the `pull` command for images that can be built. Fixed [compose#8724](https://github.com/docker/compose/pull/8724) +* Fixed corner case when there's no container to attach to. Fixed [compose#8752](https://github.com/docker/compose/pull/8752) +* Compose containers' startup must run sequentially for engine to assign distinct ports within a configured range. Fixed + [compose#8530](https://github.com/docker/compose/pull/8530) +* Fixed parsing of `repository:tag`. Fixed [compose#9208](https://github.com/docker/compose/pull/9208) +* Load project from files when explicitly set by user. Fixed [compose#9554](https://github.com/docker/compose/pull/9554) diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.14.2.md b/corpus/changelog/docker_compose_releases/docker_compose_2.14.2.md new file mode 100644 index 0000000000000000000000000000000000000000..b3a3d52377aefc09c57048200eeae7cc55d4454b --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.14.2.md @@ -0,0 +1,22 @@ +# Docker Compose release 2.14.2 + +Source: https://docs.docker.com/compose/releases/release-notes/#2142 + +## [2.14.2](#2142) + +*2022-12-20* + +### [Update](#update-68) + +* Dependencies upgrade: bump containerd to 1.6.14 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-74) + +* Compose now uses DOCKER\_DEFAULT\_PLATFORM to determine the platform when creating a container. Fixed [compose#10041](https://github.com/docker/compose/pull/10041) +* Compose now detects when dependency failed to start. Fixed [compose#9732](https://github.com/docker/compose/pull/9732) +* Fixed WCOW volume mounts. Fixed [compose#9577](https://github.com/docker/compose/pull/9577) +* List only running containers when using `--all=false`. Fixed [compose#10085](https://github.com/docker/compose/pull/10085) +* Fixed a regression when running pull `--ignore-pull-failures`. Fixed [compose#10089](https://github.com/docker/compose/pull/10089) +* Fixed CPU quota issue. Fixed [compose#10073](https://github.com/docker/compose/pull/10073) +* Fixed race condition on compose logs. Fixed [compose#8880](https://github.com/docker/compose/pull/8880) +* Updated projectOptions to be public by renaming it to ProjectOptions. Fixed [compose#100102](https://github.com/docker/compose/pull/100102) diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.15.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.15.0.md new file mode 100644 index 0000000000000000000000000000000000000000..f28f10630744142c31682edd79ed1b23b827ff17 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.15.0.md @@ -0,0 +1,27 @@ +# Docker Compose release 2.15.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2150 + +## [2.15.0](#2150) + +*2023-01-05* + +### [Update](#update-67) + +* Dependencies upgrade: bump compose-go to v1.8.1 +* Dependencies upgrade: bump cli-docs-tool to 0.5.1 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-73) + +* Added support of the `privileged` attribute in the `service.build` section. Pull Request [compose#10112](https://github.com/docker/compose/pull/10112) +* Introduced `--ignore-buildable` to ignore buildable images on pull. Fixed [compose#8805](https://github.com/docker/compose/issues/8805) +* Introduced `--no-attach` to ignore some service outputs. Fixed [compose#8546](https://github.com/docker/compose/issues/8546) +* Fixed issue with `logs` when `driver:none` is set. Fixed [compose#9030](https://github.com/docker/compose/issues/9030) +* Compose now relies on dockerCLI.streams. Pull Request [compose#10082](https://github.com/docker/compose/pull/10082) +* Fixed issue with service hash that MUST exclude replicas. Fixed [compose#10077](https://github.com/docker/compose/issues/10077) +* Compose now checks service names based on project, not running containers. Fixed [compose#9951](https://github.com/docker/compose/issues/9951) +* Fixed security opts support (seccomp and unconfined). Fixed [compose#9505](https://github.com/docker/compose/issues/9505) +* Fixed empty file when using compose config in case of smaller source files. Fixed [compose#10121](https://github.com/docker/compose/issues/10121) +* Fixed issue with `--pull` not applied on `compose up`. Fixed [compose#10125](https://github.com/docker/compose/issues/10125) +* Compose should ignore not only auto-removed containers but also "removal in progress" for orphan containers. Pull Request [compose#10136](https://github.com/docker/compose/pull/10136) +* Compose limits build concurrency according to `--parallel`. Fixed [compose#9091](https://github.com/docker/compose/issues/9091) diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.15.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.15.1.md new file mode 100644 index 0000000000000000000000000000000000000000..45c871d31c657dfaa32545d2be4d3bbe571fb2c7 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.15.1.md @@ -0,0 +1,18 @@ +# Docker Compose release 2.15.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2151 + +## [2.15.1](#2151) + +*2023-01-09* + +### [Update](#update-66) + +* Dependencies upgrade to fix Golan CVE-2022-27664 and CVE-2022-32149 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-72) + +* Added support for UTS namespace. Fixed [compose#8408](https://github.com/docker/compose/issues/8408) +* Fixed filtering issue when no filter set. Fixed [roadmap#418](https://github.com/docker/roadmap/issues/418) +* Fixed concurrent map writes issue during build step. Pull Request [compose#10151](https://github.com/docker/compose/pull/10151) +* Fixed issue when stdin is not a terminal. Fixed [compose#9739](https://github.com/docker/compose/issues/9739) diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.16.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.16.0.md new file mode 100644 index 0000000000000000000000000000000000000000..6f2647057cc3278fc3a74e3b9c1587edc140f53c --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.16.0.md @@ -0,0 +1,45 @@ +# Docker Compose release 2.16.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2160 + +## [2.16.0](#2160) + +*2023-02-08* + +### [Update](#update-65) + +* Dependencies upgrade: bump docker to v23.0.0 +* Dependencies upgrade: bump docker-cli to v23.0.0 +* Dependencies upgrade: bump buildkit to v0.11.2 +* Dependencies upgrade: bump buildx to v0.10.2 +* Dependencies upgrade: bump containerd to 1.6.16 +* Dependencies upgrade: bump golang to 1.20 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-71) + +* Introduced `--remove-orphans` for the `compose create` command. Fixed [compose#9718](https://github.com/docker/compose/issues/9718) +* Shortened the TTY output when the terminal is too small. Fixed [compose#9962](https://github.com/docker/compose/issues/9962) +* Added `remove-orphans` functionality to run. Fixed [compose#9718](https://github.com/docker/compose/issues/9718#issuecomment-1209448445) +* Introduced the experimental `watch` command. Pull Request [compose#10163](https://github.com/docker/compose/pull/10163) +* Compose now allows TTY to be allocated with `-t`. Fixed [compose#10161](https://github.com/docker/compose/issues/10161) +* Introduced the experimental `dry-run` command. Pull Request [compose#10173](https://github.com/docker/compose/issues/10173) +* Updated the documentation to explain ways to configure parallelism. Pull Request [compose#10198](https://github.com/docker/compose/issues/10198) +* Aligned the `logs` command with docker CLI by aliasing `-n` for `--tail`. Fixed [compose#10199](https://github.com/docker/compose/issues/10199) +* Added support for `docker compose build --push`. Pull Request [compose#10148](https://github.com/docker/compose/issues/10148) +* Added `--scale` to the `compose create` command. Fixed [compose#10208](https://github.com/docker/compose/issues/10208) +* Renamed `convert` to `config` to align with the Compose V1 UX. Pull Request [compose#10214](https://github.com/docker/compose/issues/10214) +* Compose now passes the proxy config as build args. Fixed [compose#8797](https://github.com/docker/compose/issues/8797) +* Fixed parsing issue in `compose up` by ignoring containers not created by Compose. Fixed [compose#10162](https://github.com/docker/compose/issues/10162#issuecomment-1384989985) +* Fixed the goroutine leak in log formatter initialization. Fixed [compose#10157](https://github.com/docker/compose/issues/10157) +* Fixed an issue where compose logs don't exit when all running containers have been stopped. Pull Request [compose#10181](https://github.com/docker/compose/issues/10181) +* Fixed the documentation to reflect `docker compose ps` being aligned with `docker ps`. Pull Request [compose#10195](https://github.com/docker/compose/issues/10195) +* Fixed an issue where the remote Buildx driver was not found. Fixed [compose#9893](https://github.com/docker/compose/issues/9893) +* Improved logging when recreating a service container. Pull request [compose#10236](https://github.com/docker/compose/issues/10236) +* Fixed an issue so Compose now only waits for containers concerned by the wait condition. Fixed [compose#10200](https://github.com/docker/compose/issues/10200) +* Compose now prevents assignment to entry in nil map. Fixed [compose#10244](https://github.com/docker/compose/issues/10244) +* Added a dedicated GitHub Action workflow for Cucumber tests. Pull Request [compose#10165](https://github.com/docker/compose/issues/10165) +* Cleaned the TUI lines when switching in compact log mode. Fixed [compose#10201](https://github.com/docker/compose/issues/10201) +* Added Tilt watcher to detect code changes in watch mode. Pull Request [compose#10218](https://github.com/docker/compose/issues/10218) +* Compose now supports Dry Run mode for `kill` command. Fixed [compose#10210](https://github.com/docker/compose/issues/10210) +* Compose now supports Dry Run mode for `pause` command.Fixed [compose#10217](https://github.com/docker/compose/issues/10217) +* Compose now supports Dry Run mode for `cp` command.Fixed [compose#10235](https://github.com/docker/compose/issues/10235) diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.17.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.17.0.md new file mode 100644 index 0000000000000000000000000000000000000000..97b6d01f9c436d33b752d89e04af1a584e0d99ee --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.17.0.md @@ -0,0 +1,50 @@ +# Docker Compose release 2.17.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2170 + +## [2.17.0](#2170) + +*2023-03-23* + +### [Upgrade notes](#upgrade-notes) + +* Project name validation is more strictly enforced. Project names can only include letters, numbers, `_`, `-` and must be lowercase and start with a letter or number. +* Boolean fields in YAML must be either `true` or `false`. Deprecated YAML 1.1 values such as "on" or "no" are not supported. +* Duplicate YAML merge keys (`<<`) are rejected. + +### [Update](#update-64) + +* Dependencies upgrade: bump buildkit to v0.11.4 +* Dependencies upgrade: bump buildx to v0.10.4 +* Dependencies upgrade: bump containerd to 1.6.18 +* Dependencies upgrade: bump compose-go to v1.13.0 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-70) + +* Introduced `--wait-timeout` on `up` command. Fixed [compose#10269](https://github.com/docker/compose/issues/10269) +* Made `compose service --hash` output sort by service name. Pull Request [compose#10278](https://github.com/docker/compose/pull/10278) +* Compose now renders a compact TUI progress report to monitor layers download. Pull Request [compose#10281](https://github.com/docker/compose/pull/10281) +* Introduced `restart` for `depends_on`. Fixed [compose#10284](https://github.com/docker/compose/issues/10284) +* Added support of `NO_COLOR` env var. Fixed [compose#10340](https://github.com/docker/compose/issues/10340) +* Progress writer now uses `dockercli.Err` stream. Fixed [compose#10366](https://github.com/docker/compose/issues/10366) +* Added support for `additional_contexts` in the `build` service configuration. Fixed [compose#9461](https://github.com/docker/compose/issues/9461) [compose#9961](https://github.com/docker/compose/issues/9961) +* Added file delete/rename handling in `watch` mode. Pull Request [compose#10386](https://github.com/docker/compose/pull/10386) +* Introduced an `ignore` attribute in `watch` mode. Pull Request [compose#10385](https://github.com/docker/compose/pull/10385) +* Compose now uses progress writer to show copies status. Pull Request [compose#10387](https://github.com/docker/compose/pull/10387) +* Updated reference documentation for `-p`/`--project-name` flag. Fixed [docs#16915](https://github.com/docker/docs/pull/16915), [compose-spec#311](https://github.com/compose-spec/compose-spec/issues/311) +* Introduced a `replace` label to track the relationship between old and new containers of a service. Fixed [compose#9600](https://github.com/docker/compose/issues/9600) +* Fixed a bug that meant dependent services were not restarted after a service was restarted. Fixed [compose#10263](https://github.com/docker/compose/issues/10263) +* Compose now ignores services without a build section in `watch` mode. Fixed [compose#10270](https://github.com/docker/compose/issues/10270) +* Compose now applies config options for pseudo-subcommands. Fixed [compose#10286](https://github.com/docker/compose/issues/10286) +* Compose manages only containers with config\_hash labels (i.e, created by compose). Fixed [compose#10317](https://github.com/docker/compose/issues/10317) +* Compose triggers an error if the project name is empty after normalization. Fixed [compose#10313](https://github.com/docker/compose/issues/10313) +* Compose restarts only needed services by checking `depends_on` relations. Fixed [compose#10337](https://github.com/docker/compose/issues/10337) +* Fixed a display issue on small terminals. Fixed [compose#10322](https://github.com/docker/compose/issues/10322) +* Fixed an issue with building the built images IDs collection. Pull Request [compose#10372](https://github.com/docker/compose/issues/10372) +* Use configured name separator to define oneoff container name. Fixed [compose#10354](https://github.com/docker/compose/issues/10354) +* Fixed concurrent map read/write issue when recreating containers. Fixed [compose#10319](https://github.com/docker/compose/issues/10319) +* Compose now supports Dry Run mode for `stop` and `rm` commands. Pull Request [compose#10257](https://github.com/docker/compose/issues/10257) +* Compose now supports Dry Run mode for `pull` command. Pull Request [compose#10341](https://github.com/docker/compose/issues/10341) +* Compose now supports Dry Run mode for `push` command. Pull Request [compose#10355](https://github.com/docker/compose/issues/10355) +* Compose now supports Dry Run mode for `exec` command. Pull Request [compose#10252](https://github.com/docker/compose/issues/10252) +* Compose now supports Dry Run mode for `restart` command. Pull Request [compose#10339](https://github.com/docker/compose/issues/10339) diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.17.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.17.1.md new file mode 100644 index 0000000000000000000000000000000000000000..177c70d6f4d23f2615b64c789caa7c3aa6290fad --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.17.1.md @@ -0,0 +1,19 @@ +# Docker Compose release 2.17.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2171 + +## [2.17.1](#2171) + +*2023-03-24* + +### [Update](#update-63) + +* Dependencies upgrade: bump buildkit to v0.11.5 +* Dependencies upgrade: bump compose-go to v1.13.1 +* Dependencies upgrade: bump golang to 1.20.2 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-69) + +* Fixed panic on `alpha watch` command. Pull Request [compose#10393](https://github.com/docker/compose/pull/10393) +* Prevented conflicts for services named `extensions`. Fixed [compose-go#247](https://github.com/compose-spec/compose-go/issues/247) +* Compose now validates project names more consistently. Fixed [compose-go#363](https://github.com/compose-spec/compose-go/issues/363) diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.17.2.md b/corpus/changelog/docker_compose_releases/docker_compose_2.17.2.md new file mode 100644 index 0000000000000000000000000000000000000000..7bf32e3f9c52f43991b04ef3b45ddc450b46f151 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.17.2.md @@ -0,0 +1,15 @@ +# Docker Compose release 2.17.2 + +Source: https://docs.docker.com/compose/releases/release-notes/#2172 + +## [2.17.2](#2172) + +*2023-03-26* + +### [Update](#update-62) + +* Dependencies upgrade: bump compose-go to v1.13.2 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-68) + +* Fixed invalid project name error for directories with uppercase characters or `.` in the name. Fixed [compose#10405](https://github.com/docker/compose/issues/10405) diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.18.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.18.0.md new file mode 100644 index 0000000000000000000000000000000000000000..e15241ae0b607f97b5109b940cf235237e9b02e3 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.18.0.md @@ -0,0 +1,35 @@ +# Docker Compose release 2.18.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2180 + +## [2.18.0](#2180) + +*2023-05-16* + +### [Update](#update-61) + +* Dependencies upgrade: bump compose-go to v1.13.5 +* Dependencies upgrade: bump buildkit to v0.11.6 +* Dependencies upgrade: bump docker to v23.0.5 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-67) + +* Added dry run support using `--dry-run` +* Added the first (alpha) implementation of the `viz` sub-command +* Introduced `--no-path-resolution` to skip relative path to be resolved +* Introduced `COMPOSE_ANSI` to define the `--ansi` default value +* Introduced `COMPOSE_STATUS_STDOUT` to get status messages sent to stdout +* Fixed the BuildKit progressui integration +* Fixed a bug to stop blocking the events loop collecting logs +* Restored support for `--memory` +* Fixed a bug which meant containers didn't stop after termination +* Compose now lets users declare the build secret target +* Fixed a bug which caused a container to be recreated when the config has not changed +* Fixed a race condition when `--parallel` is used with a large number of dependent services +* Compose now checks the local image matches the required platform +* Fixed local image removal when `compose down` is ran with `--project-name` +* Compose now detects the active endpoint trying to remove the network and skips with a warning +* Removed unnecessary [] output +* Compose detects that a Windows terminal is not a `console.File` to avoid a panic +* `--parallel` now has precedence over `COMPOSE_PARALLEL_LIMIT` +* Compose now reports that the external network is not found when Swarm is disabled diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.18.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.18.1.md new file mode 100644 index 0000000000000000000000000000000000000000..01fc7b12639302ee60d09e1b60483ec8bcd1ec25 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.18.1.md @@ -0,0 +1,11 @@ +# Docker Compose release 2.18.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2181 + +## [2.18.1](#2181) + +*2023-05-17* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-66) + +* Fixed "Image not found" errors when building images diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.19.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.19.0.md new file mode 100644 index 0000000000000000000000000000000000000000..a729dbdbfd7daa1a3af5979fbb23e149327d4799 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.19.0.md @@ -0,0 +1,44 @@ +# Docker Compose release 2.19.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2190 + +## [2.19.0](#2190) + +*2023-06-21* + +### [Update](#update-60) + +* Dependencies upgrade: bump compose-go to v1.15.0 +* Dependencies upgrade: bump buildx to v0.11.0 +* Dependencies upgrade: bump docker to v24.0.2 +* Dependencies upgrade: bump golang to 1.20.5 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-65) + +* Introduced the ability to select a single service to be stopped by `compose down`. +* Added `--progress` as top-level flag to configure progress UI style. +* Introduced `run --cap-add` to run maintenance commands using service image. +* Fixed a bug during detection of swarm mode. +* Fixed a bug when setting the project name via `COMPOSE_PROJECT_NAME` environment variable. +* Adjusted the display of the volumes flag with the help of `down` command. +* Fixed a bug in the `up` command which should not silently ignore missing `depends_on` services. +* Aligned forward signal to container behaviour with the `docker run` one. +* Compose now detects network name conflict. +* Fixed a typo in the warning message about an existing volume. +* Compose now detects new services started after `compose -p x logs -f` command. +* Fixed a bug when `compose` was used as project name. +* Fixed a bug in the `watch` command when a directory does not exist. +* Removed default timeout of 10 seconds when restarting or stopping services. +* Fixed a bug in `watch` which applied the "rebuild" strategy by default. +* Fixed a race condition, waiting for containers when one exit. +* Added a warning telling users that uid,gid,mode are not implemented for `build.secrets`. +* Fixed a bug in `watch` which was watching the whole build context instead of only configured paths. +* Compose now sorts containers by creation date to scale down the older ones first. +* Fixed a bug in the docs generation task for Windows environments. +* Updated the docs to reflect Dry Run mode is feature complete. +* Improved the diagnostic message on network label mismatch. +* Fixed a bug which was rendering `Building` section when there was no build involved. +* Fixed a bug in code coverage metrics. +* Added OTEL initialization. +* Added a GitHub action to trigger Docker Desktop e2e tests with Compose edge versions. +* Added more ignore rules to dependabot. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.19.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.19.1.md new file mode 100644 index 0000000000000000000000000000000000000000..c0655261a4d69e4b00befb7240978fd0d6207dff --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.19.1.md @@ -0,0 +1,17 @@ +# Docker Compose release 2.19.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2191 + +## [2.19.1](#2191) + +*2023-06-29* + +### [Update](#update-59) + +* Dependencies upgrade: bump compose-go to v1.15.1 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-64) + +* Fixed sporadic "container not connected to network" errors on `compose up`. +* Fixed "please specify build context" errors on `compose build`. +* Compose now warns if using a bind mount in a service `watch` configuration. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.20.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.20.0.md new file mode 100644 index 0000000000000000000000000000000000000000..2ea4e10f7103163ac4885aa25bb2789afca8fd70 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.20.0.md @@ -0,0 +1,27 @@ +# Docker Compose release 2.20.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2200 + +## [2.20.0](#2200) + +*2023-07-11* + +### [Update](#update-58) + +* Dependencies upgrade: bump docker/cli-docs-tools to v0.6.0 +* Dependencies upgrade: bump docker to v24.0.4 +* Dependencies upgrade: bump buildx to v0.11.1 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-63) + +* Introduced the `wait` command. +* Added support of `--builder` and `BUILDX_BUILDER` to the `build` command. +* Added support for the `include` and `attach` attributes from the Compose Specification. +* Fixed a DryRun mode issue when initializing CLI client. +* Fixed a bug with random missing network when a service has more than one. +* Fixed the Secrets file permission value to comply with the Compose Specification. +* Fixed an issue about `no-deps` flag not being applied. +* Fixed some source code comments. +* Fixed a bug when `--index` is not set select. +* Fixed a process leak in the wait e2e test. +* Improved some test speeds. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.20.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.20.1.md new file mode 100644 index 0000000000000000000000000000000000000000..ee188a36e3dcf748701c008aba2ea94652e0bcef --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.20.1.md @@ -0,0 +1,14 @@ +# Docker Compose release 2.20.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2201 + +## [2.20.1](#2201) + +*2023-07-18* + +### [Update](#update-57) + +* Dependencies upgrade: bump golang to 1.20.6 +* Dependencies upgrade: bump buildx to v0.11.2 +* Dependencies upgrade: bump buildkit to v0.12 +* Dependencies upgrade: bump docker-cli to v24.0.5-dev diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.20.2.md b/corpus/changelog/docker_compose_releases/docker_compose_2.20.2.md new file mode 100644 index 0000000000000000000000000000000000000000..7bd14cd486d32996ad049d8e34036fff7ca7f637 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.20.2.md @@ -0,0 +1,14 @@ +# Docker Compose release 2.20.2 + +Source: https://docs.docker.com/compose/releases/release-notes/#2202 + +## [2.20.2](#2202) + +*2023-07-19* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-62) + +* Added support for the `depends_on.required` attribute. +* Fixed an issue where build tries to push unnamed service images. +* Fixed a bug which meant the target secret path on Windows was not checked. +* Fixed a bug resolving build context path for services using `extends.file`. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.20.3.md b/corpus/changelog/docker_compose_releases/docker_compose_2.20.3.md new file mode 100644 index 0000000000000000000000000000000000000000..5eee9188202f951897a0e298392e17e401c21fdf --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.20.3.md @@ -0,0 +1,21 @@ +# Docker Compose release 2.20.3 + +Source: https://docs.docker.com/compose/releases/release-notes/#2203 + +## [2.20.3](#2203) + +*2023-08-11* + +### [Update](#update-56) + +* Dependencies upgrade: bump golang to 1.21.0 +* Dependencies upgrade: bump compose-go to v1.18.1 +* Dependencies upgrade: bump buildkit to v0.12.1 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-61) + +* Improved speed and reliability of `watch` sync. +* Added builder's name on the first build line. +* Improved shell completion for `--project-directory` and `--profile`. +* Fixed build issue with proxy configuration not passing to legacy builder. +* Removed unnecessary warning when an option dependency exists successfully. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.21.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.21.0.md new file mode 100644 index 0000000000000000000000000000000000000000..9460bbbc04f53f586538e1f62c72a54abeb090cc --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.21.0.md @@ -0,0 +1,24 @@ +# Docker Compose release 2.21.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2210 + +## [2.21.0](#2210) + +*2023-08-30* +> Note +> +> The format of `docker compose ps` and `docker compose ps --format=json` changed to better align with `docker ps` output. See [compose#10918](https://github.com/docker/compose/pull/10918). + +### [Update](#update-55) + +* Dependencies upgrade: bump compose-go to v1.18.3 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-60) + +* Changed `docker compose ps` and `docker compose ps --format=json` output to align with Docker CLI. +* Added support for multi-document YAML files. +* Added support for loading remote Compose files from Git repos with `include` (experimental). +* Fixed incorrect proxy variables during build. +* Fixed truncated container logs on container exit. +* Fixed "no such service" errors when using `include` with `--profile`. +* Fixed `.env` overrides when using `include`. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.22.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.22.0.md new file mode 100644 index 0000000000000000000000000000000000000000..e3114318900837370998889b6127a6f1826b75da --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.22.0.md @@ -0,0 +1,29 @@ +# Docker Compose release 2.22.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2220 + +## [2.22.0](#2220) + +*2023-09-21* +> Note +> +> The `watch` command is now generally available (GA). You can directly use it from the root command `docker compose watch`. +> For more information, see +> [File watch](https://docs.docker.com/compose/how-tos/file-watch/). + +### [Update](#update-54) + +* Dependencies upgrade: bump golang to 1.21.1 +* Dependencies upgrade: bump compose-go to v1.19.0 +* Dependencies upgrade: bump buildkit to v0.12.2 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-59) + +* Added experimental support for the `publish` command. +* The command `watch` now builds and launches the project during startup. +* Added `policy` option to the `--pull` flag. +* Fixed various race and deadlock conditions for `up` command on exit. +* Fixed multi-platform issues on build. +* Enabled services that are explicitly requested even when their `profiles` aren't activated. +* Fixed a `config` issue when the declared `env_file` is missing. +* Passed BuildOptions to `up` and `run` commands. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.23.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.23.0.md new file mode 100644 index 0000000000000000000000000000000000000000..8d3a796f16fa977be291467b1840082daae4fc32 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.23.0.md @@ -0,0 +1,22 @@ +# Docker Compose release 2.23.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2230 + +## [2.23.0](#2230) + +*2023-10-18* + +### [Update](#update-53) + +* Dependencies upgrade: bump compose-go to v1.20.0 +* Dependencies upgrade: bump containerd to 1.7.7 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-58) + +* Added dry-run support for publish command +* Added `COMPOSE_ENV_FILES` env variable to pass a list of env files +* Added `sync+restart` action to `compose watch` +* Aligned `compose ps` output with Docker CLI by default and introduced `--no-trunc` to keep the previous behaviour +* Fixed hashes inconsistency between `up` and `configure` +* Enabled profiles when `down` ran with explicit service names +* Fixed an issue when the pull policy provided was invalid diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.23.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.23.1.md new file mode 100644 index 0000000000000000000000000000000000000000..90e61325d37805f30161bab4b545d3c382c4f2f3 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.23.1.md @@ -0,0 +1,26 @@ +# Docker Compose release 2.23.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2231 + +## [2.23.1](#2231) + +*2023-11-16* + +### [Update](#update-52) + +* Dependencies upgrade: bump compose-go to v1.20.1 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-57) + +* Aligned Compose with OCI artifact best practices. +* Introduced `--resolve-image-digests` so users can seal service images by digest when publishing a Compose application. +* Improved Compose Watch configuration logging. +* Compose now rejects a Compose file using `secrets|configs.driver` or `template_driver`. +* Compose now fails to start if a dependency is missing. +* Fixed SIGTERM support to stop/kill stack. +* Fixed a `--hash` regression. +* Fixed "Application failed to start after update" when an external network is on a watched service. +* Fixed `--pull` documentation. +* Fixed display by adding newline in cmd/compose/build.go. +* Compose is rendered quiet after filtering applied. +* Stripped project prefix from docker-compose up output. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.23.2.md b/corpus/changelog/docker_compose_releases/docker_compose_2.23.2.md new file mode 100644 index 0000000000000000000000000000000000000000..87684cd8a8dee46cc6188f5f63d55ea1e53f4721 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.23.2.md @@ -0,0 +1,21 @@ +# Docker Compose release 2.23.2 + +Source: https://docs.docker.com/compose/releases/release-notes/#2232 + +## [2.23.2](#2232) + +*2023-11-21* + +### [Update](#update-51) + +* Dependencies upgrade: bump buildkit 0.12.3 +* Dependencies upgrade: bump docker 24.0.7 +* Dependencies upgrade: bump cli 24.0.7 +* Dependencies upgrade: bump 1.20.2 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-56) + +* Compose now supports `builds.tags` with `push` command. +* Compose Watch now re-builds service images at startup. +* Now `--remove-orphans` doesn't manage disabled services as orphaned. +* Compose displays `Building` output log only if there is at least one service to build. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.23.3.md b/corpus/changelog/docker_compose_releases/docker_compose_2.23.3.md new file mode 100644 index 0000000000000000000000000000000000000000..3383f4b1fae089af6ab9b8389f59bda6793f6047 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.23.3.md @@ -0,0 +1,11 @@ +# Docker Compose release 2.23.3 + +Source: https://docs.docker.com/compose/releases/release-notes/#2233 + +## [2.23.3](#2233) + +*2023-11-22* + +### [Update](#update-50) + +* Dependencies upgrade: bump buildx to v0.12.0 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.24.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.24.0.md new file mode 100644 index 0000000000000000000000000000000000000000..dffeda295cd30efec14f0fd9713a6872dfef264f --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.24.0.md @@ -0,0 +1,32 @@ +# Docker Compose release 2.24.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2240 + +## [2.24.0](#2240) + +*2024-01-11* + +### [Update](#update-49) + +* Dependencies upgrade: bump cli to 25.0.0-beta.3 +* Dependencies upgrade: bump compose-go to 2.0.0-beta.3 +* Dependencies upgrade: bump golang to 1.21.6 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-55) + +* Introduced `docker compose attach` to attach local standard input, output, and error streams to a service's running container. +* Introduced `docker compose stats` to display a live stream of container(s) resource usage statistics. +* Introduced `docker compose ps --orphans` to include/exclude services not declared. +* Introduced `docker compose logs --index` to select a replica container. +* Introduced `docker compose build --with-dependencies` to also build dependencies. +* Added source policies for build. +* Included disabled services for shell completion. +* Restored `Project` in ps JSON output. +* Added OCI 1.0 fallback support for AWS ECR. +* Build now does not require environment to be resolved. +* Compose now sends out a cancel event on SIGINT/SIGTERM signal for `compose up`. +* Fixed log by exposing services ports when `--verbose`. +* Fixed inlined and environment-defined configs to be mounted under / until an explicit target is set. +* Fixed combination of `--pull always --no-build`. +* Fixed race condition in log printer. +* Fixed `docker compose up` teardown when command context is cancelled. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.24.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.24.1.md new file mode 100644 index 0000000000000000000000000000000000000000..c970eb80145f36a44ae7bcf3be1ebdf4a033dab2 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.24.1.md @@ -0,0 +1,21 @@ +# Docker Compose release 2.24.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2241 + +## [2.24.1](#2241) + +*2024-01-18* + +### [Update](#update-48) + +* Dependencies upgrade: bump cli to 25.0.0-rc3 +* Dependencies upgrade: bump docker to 25.0.0-rc3 +* Dependencies upgrade: bump compose-go to 2.0.0-rc.1 +* Dependencies upgrade: bump containerd to 1.7.12 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-54) + +* Reworked the display of container status during `up` +* Fixed the engine version required to use `healthcheck.start_interval` +* Removed `watch` subcommand from the `alpha` command +* Fixed a bug when handling received signals diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.24.2.md b/corpus/changelog/docker_compose_releases/docker_compose_2.24.2.md new file mode 100644 index 0000000000000000000000000000000000000000..20364dd02b0037e69217ffac96335a198449ce83 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.24.2.md @@ -0,0 +1,12 @@ +# Docker Compose release 2.24.2 + +Source: https://docs.docker.com/compose/releases/release-notes/#2242 + +## [2.24.2](#2242) + +*2024-01-22* + +### [Update](#update-47) + +* Dependencies upgrade: bump cli to 25.0.0 GA +* Dependencies upgrade: bump compose-go to 2.0.0-rc.2 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.24.3.md b/corpus/changelog/docker_compose_releases/docker_compose_2.24.3.md new file mode 100644 index 0000000000000000000000000000000000000000..dbca33b5eafb31ab0d844ca8434c2bcebed17c14 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.24.3.md @@ -0,0 +1,13 @@ +# Docker Compose release 2.24.3 + +Source: https://docs.docker.com/compose/releases/release-notes/#2243 + +## [2.24.3](#2243) + +*2024-01-24* + +This release fixes a build issue with Docker Desktop for Windows introduced in Compose v2.24.0. + +### [Update](#update-46) + +* Compose now uses a custom version of `fsutils` library. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.24.4.md b/corpus/changelog/docker_compose_releases/docker_compose_2.24.4.md new file mode 100644 index 0000000000000000000000000000000000000000..cf6a83dbd3c7525d6b2d6f4a08c4bab682c69522 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.24.4.md @@ -0,0 +1,18 @@ +# Docker Compose release 2.24.4 + +Source: https://docs.docker.com/compose/releases/release-notes/#2244 + +## [2.24.4](#2244) + +*2024-01-29* + +### [Update](#update-45) + +* Dependencies upgrade: bump cli to 25.0.1 +* Dependencies upgrade: bump docker to 25.0.1 +* Dependencies upgrade: bump compose-go to 2.0.0-rc.3 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-53) + +* Fixed issue when checking external network existence when swarm is enabled. +* Added support for `storage_opt` attribute. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.24.5.md b/corpus/changelog/docker_compose_releases/docker_compose_2.24.5.md new file mode 100644 index 0000000000000000000000000000000000000000..acb0598ab35ab0208c372d25907c1dadbe3b1f37 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.24.5.md @@ -0,0 +1,11 @@ +# Docker Compose release 2.24.5 + +Source: https://docs.docker.com/compose/releases/release-notes/#2245 + +## [2.24.5](#2245) + +*2024-01-30* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-52) + +* Fixed "failed to solve: changes out of order" errors when building images on Windows. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.24.6.md b/corpus/changelog/docker_compose_releases/docker_compose_2.24.6.md new file mode 100644 index 0000000000000000000000000000000000000000..d25c0e0f6b6228f69d9fa36581f3fdd36b17b8a7 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.24.6.md @@ -0,0 +1,18 @@ +# Docker Compose release 2.24.6 + +Source: https://docs.docker.com/compose/releases/release-notes/#2246 + +## [2.24.6](#2246) + +*2024-02-15* + +### [Update](#update-44) + +* Dependencies upgrade: bump cli to 25.0.3 +* Dependencies upgrade: bump compose-go to 2.0.0-rc.7 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-51) + +* Fixed issue of `.env` file loading when project file is set via `COMPOSE_FILE` variable +* Aligned `ps --status=exited` behaviour with the Docker CLI behaviour +* Fixed a deadlock when collecting large logs diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.24.7.md b/corpus/changelog/docker_compose_releases/docker_compose_2.24.7.md new file mode 100644 index 0000000000000000000000000000000000000000..ce5d315f799ed62e46c57f7b5470c7b6d3a50642 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.24.7.md @@ -0,0 +1,28 @@ +# Docker Compose release 2.24.7 + +Source: https://docs.docker.com/compose/releases/release-notes/#2247 + +## [2.24.7](#2247) + +*2024-03-06* + +### [Update](#update-43) + +* Dependencies upgrade: bump golang to 1.21.8 +* Dependencies upgrade: bump compose-go to 2.0.0-rc8 +* Dependencies upgrade: bump docker to v24.0.4 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-50) + +* Compose now ensures stable priority sort order for networks +* Fixed interpolation with curly braces (e.g. JSON) in default values +* Fixed validation for non-unique `container_name` values +* Fixed validation for `develop.watch` +* Fixed environment loading for `include` +* Fixed panic when merging labels/networks +* Added support for `--no-path-resolution` when using `include` +* Fixed missing project name errors +* Fixed `--no-interpolate` flag on `config` +* Added a workaround for file lock issues with Watch mode on Windows +* Fixed duplicate exit code status messages +* Compose now respects `COMPOSE_REMOVE_ORPHANS` on `up` diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.25.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.25.0.md new file mode 100644 index 0000000000000000000000000000000000000000..7c93d71a6704ff8430996ce0fd30d60d3f142a5d --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.25.0.md @@ -0,0 +1,17 @@ +# Docker Compose release 2.25.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2250 + +## [2.25.0](#2250) + +*2024-03-15* + +### [Update](#update-42) + +* Dependencies upgrade: bump compose-go v2.0.0 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-49) + +* Restored `config` behaviour until `--no-interpolate` is set +* Fixed service name shell completion +* Added `--watch` flag to `up` command diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.26.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.26.0.md new file mode 100644 index 0000000000000000000000000000000000000000..7100e0fbec45b26c55f0610bef08bbbc863e8ec1 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.26.0.md @@ -0,0 +1,22 @@ +# Docker Compose release 2.26.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2260 + +## [2.26.0](#2260) + +*2024-03-22* + +### [Update](#update-41) + +* Dependencies upgrade: bump compose-go v2.0.2 +* Dependencies upgrade: bump docker v26.0.0 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-48) + +* Reduced timeout of the Otel tracing command +* Fixed `config --format json` +* Fixed documentation on default build image name +* Introduced Synchronized file shares for bind mounts in Compose +* Added support for `annotations` +* Introduced `config --variables` to list Compose model variables +* Added a navigation menu within `docker compose up` diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.26.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.26.1.md new file mode 100644 index 0000000000000000000000000000000000000000..6402edc099dc5551adbe25b6a948a75ba5824931 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.26.1.md @@ -0,0 +1,18 @@ +# Docker Compose release 2.26.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2261 + +## [2.26.1](#2261) + +*2024-03-29* + +### [Update](#update-40) + +* Dependencies upgrade: opencontainers/image-spec v1.1.0 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-47) + +* Added image pull failure reason in output +* Fixed crash when running up with `--no-build` and `--watch` +* Fixed crash when no TTY available and menu enabled +* Improved legibility of menu actions diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.27.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.27.0.md new file mode 100644 index 0000000000000000000000000000000000000000..56c105bca33c5e0ae8ad34db16578d55bfea86ef --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.27.0.md @@ -0,0 +1,21 @@ +# Docker Compose release 2.27.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2270 + +## [2.27.0](#2270) + +*2024-04-24* + +### [Update](#update-39) + +* Dependencies upgrade: bump golang to 1.21.9 +* Dependencies upgrade: bump compose-go to v2.1.0 +* Dependencies upgrade: bump docker engine and cli to v26.1.0 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-46) + +* Introduced `--abort-on-container-failure` flag +* Introduced `--all-resources` to not exclude resources not used by services +* Introduced support for `build.entitlements` +* Fixed a bug so Docker Compose now ignores missing containers when `docker compose down/stop -p` is run +* Fixed support for `--flag=value` syntax in compatibility mode diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.27.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.27.1.md new file mode 100644 index 0000000000000000000000000000000000000000..4a084a12966b5546dd7e1a8c17124f07ee09ed67 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.27.1.md @@ -0,0 +1,21 @@ +# Docker Compose release 2.27.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2271 + +## [2.27.1](#2271) + +*2024-05-24* + +### [Update](#update-38) + +* Dependencies upgrade: bump compose-go to v2.1.1 +* Dependencies upgrade: bump docker engine and cli to v26.1.3 +* Dependencies upgrade: bump buildx to 0.14.1 +* Dependencies upgrade: bump containerd to 1.7.17 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-45) + +* Added a navigation menu in the CLI where you can open your Compose file in Docker Desktop +* Added documentation for `--menu` flag in `docker compose up` +* Fixed a bug with `--resolve-image-digests` used with `--no-interpolate` +* You can now use a local `.env` file to override `COMPOSE_*` environment variables diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.27.2.md b/corpus/changelog/docker_compose_releases/docker_compose_2.27.2.md new file mode 100644 index 0000000000000000000000000000000000000000..bc51ac50abafce56a2caaa751d90545eb5e3c7ab --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.27.2.md @@ -0,0 +1,21 @@ +# Docker Compose release 2.27.2 + +Source: https://docs.docker.com/compose/releases/release-notes/#2272 + +## [2.27.2](#2272) + +*2024-06-20* + +### [Update](#update-37) + +* Dependencies upgrade: bump golang to 1.21.11 +* Dependencies upgrade: bump docker engine and cli to v26.1.4 +* Dependencies upgrade: bump buildx to 0.15.0 +* Dependencies upgrade: bump buildkit to 0.14.0 +* Dependencies upgrade: bump containerd to 1.7.18 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-44) + +* Added an `--environment` flag to the `config` command +* Fixed a bug which caused the `watch` process to hang when used as flag with the `up` command +* Fixed usage of `COMPOSE_PROFILES` in `.env` file diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.27.3.md b/corpus/changelog/docker_compose_releases/docker_compose_2.27.3.md new file mode 100644 index 0000000000000000000000000000000000000000..5b80da71cec474aa8eb26a6730f500ee07b13069 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.27.3.md @@ -0,0 +1,12 @@ +# Docker Compose release 2.27.3 + +Source: https://docs.docker.com/compose/releases/release-notes/#2273 + +## [2.27.3](#2273) + +*2024-06-21* + +### [Update](#update-36) + +* Dependencies upgrade: bump buildx to 0.15.1 +* Dependencies upgrade: bump buildkit to 0.14.1 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.28.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.28.0.md new file mode 100644 index 0000000000000000000000000000000000000000..dce13c19dc205341da905b32f47bc67e0e1180ce --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.28.0.md @@ -0,0 +1,12 @@ +# Docker Compose release 2.28.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2280 + +## [2.28.0](#2280) + +*2024-06-21* + +### [Update](#update-35) + +* Dependencies upgrade: bump compose-go to v2.1.3 +* Dependencies upgrade: bump docker engine and cli to v27.0.1-rc.1 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.28.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.28.1.md new file mode 100644 index 0000000000000000000000000000000000000000..8b13d49e7dbcf8c486fcc424b086ba4bafdba0f6 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.28.1.md @@ -0,0 +1,11 @@ +# Docker Compose release 2.28.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2281 + +## [2.28.1](#2281) + +*2024-06-24* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-43) + +* Fixed progress display, broken in `v2.28.0`, when TTY mode available. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.29.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.29.0.md new file mode 100644 index 0000000000000000000000000000000000000000..f0e0d005f3fcf9e5f2f715243ad04b42804261aa --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.29.0.md @@ -0,0 +1,22 @@ +# Docker Compose release 2.29.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2290 + +## [2.29.0](#2290) + +*2024-07-17* + +### [Update](#update-34) + +* Dependencies upgrade: bump compose-go to v2.1.4 +* Dependencies upgrade: bump docker engine and cli to v27.0.3 +* Dependencies upgrade: bump buildx to 0.16.0 +* Dependencies upgrade: bump buildkit to 0.15.0 +* Dependencies upgrade: bump containerd to 1.7.19 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-42) + +* Added a JSON stream progress writer. +* Added a `--prune` flag to the `docker compose watch` command. +* Unnecessary resources are now excluded after services have been selected. +* Empty variables with no value are unset in containers. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.29.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.29.1.md new file mode 100644 index 0000000000000000000000000000000000000000..9b1595d3c404eb96b29a4a41e2a75740373be707 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.29.1.md @@ -0,0 +1,16 @@ +# Docker Compose release 2.29.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2291 + +## [2.29.1](#2291) + +*2024-07-23* + +### [Update](#update-33) + +* Dependencies upgrade: bump compose-go to v2.1.5. +* Dependencies upgrade: bump docker engine and cli to v27.1.0. + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-41) + +* Enhance JSON progress events with more fields. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.29.2.md b/corpus/changelog/docker_compose_releases/docker_compose_2.29.2.md new file mode 100644 index 0000000000000000000000000000000000000000..0ce7d00fd1a4bae76a6e22766210f9ce6d691391 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.29.2.md @@ -0,0 +1,24 @@ +# Docker Compose release 2.29.2 + +Source: https://docs.docker.com/compose/releases/release-notes/#2292 + +## [2.29.2](#2292) + +*2024-08-16* + +### [Update](#update-32) + +* Dependencies upgrade: bump compose-go to v2.1.6 +* Dependencies upgrade: bump docker engine and cli to v27.1.2 +* Dependencies upgrade: bump buildx to v0.16.2 +* Dependencies upgrade: bump buildkit to v0.15.2 +* Dependencies upgrade: bump golang to v1.21.12 +* Dependencies upgrade: bump sys to v0.22.0 +* Dependencies upgrade: bump flock to v0.12.1 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-40) + +* Fixed the docs on `docker compose kill` usage. +* Fixed redundant condition from `toAPIBuildOptions` in build.go. +* Fixed initial Watch `sync` after Compose restarts with introduction of `x-initialSync`. +* Fixed an issue which stopped the Compose process for a single container on `sync-restart` Watch action. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.29.3.md b/corpus/changelog/docker_compose_releases/docker_compose_2.29.3.md new file mode 100644 index 0000000000000000000000000000000000000000..675dbd8e003ebdb7056f2a7d491289e33b36cddc --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.29.3.md @@ -0,0 +1,19 @@ +# Docker Compose release 2.29.3 + +Source: https://docs.docker.com/compose/releases/release-notes/#2293 + +## [2.29.3](#2293) + +*2024-09-12* + +### [Update](#update-31) + +* Dependencies upgrade: bump compose-go to v2.2.0 +* Dependencies upgrade: bump docker engine and cli to v27.2.1 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-39) + +* Combination of bind mount and `rebuild` are now allowed with `watch`. +* Fixed a bug recreating containers when `--no-deps` is used with `up`. +* Fixed a bug not closing streams when reattaching containers. +* Restored recreation of anonymous volumes when using `-V` or `--renew-anon-volumes`. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.29.4.md b/corpus/changelog/docker_compose_releases/docker_compose_2.29.4.md new file mode 100644 index 0000000000000000000000000000000000000000..6d4001a9afec55bbfeb422c6775865e4defb312e --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.29.4.md @@ -0,0 +1,17 @@ +# Docker Compose release 2.29.4 + +Source: https://docs.docker.com/compose/releases/release-notes/#2294 + +## [2.29.4](#2294) + +*2024-09-16* + +### [Update](#update-30) + +* Dependencies upgrade: bump buildx to v0.17.1 +* Dependencies upgrade: bump docker engine and cli to v27.3.0-rc.1 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-38) + +* Fixed an issue with services not stopping when restarting diverged dependencies. +* Fixed potential `nil` pointer error on the OTEL client. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.29.5.md b/corpus/changelog/docker_compose_releases/docker_compose_2.29.5.md new file mode 100644 index 0000000000000000000000000000000000000000..22a4534dec72946f2ff29c1da9cfbc6a431a5c01 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.29.5.md @@ -0,0 +1,11 @@ +# Docker Compose release 2.29.5 + +Source: https://docs.docker.com/compose/releases/release-notes/#2295 + +## [2.29.5](#2295) + +*2024-09-17* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-37) + +* Fixed an issue with bind mounts on WSL2. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.29.6.md b/corpus/changelog/docker_compose_releases/docker_compose_2.29.6.md new file mode 100644 index 0000000000000000000000000000000000000000..ca01f3f46c467b97b96f00004ab133e38eac792c --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.29.6.md @@ -0,0 +1,15 @@ +# Docker Compose release 2.29.6 + +Source: https://docs.docker.com/compose/releases/release-notes/#2296 + +## [2.29.6](#2296) + +*2024-09-19* + +### [Update](#update-29) + +* Dependencies upgrade: bump docker engine and cli to v27.3.0-rc.2 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-36) + +* Fixed an issue with Windows Containers bind mounts. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.29.7.md b/corpus/changelog/docker_compose_releases/docker_compose_2.29.7.md new file mode 100644 index 0000000000000000000000000000000000000000..fa0cd2b2880acaf87d7fc5b9a1332da3c6d35996 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.29.7.md @@ -0,0 +1,11 @@ +# Docker Compose release 2.29.7 + +Source: https://docs.docker.com/compose/releases/release-notes/#2297 + +## [2.29.7](#2297) + +*2024-09-20* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-35) + +* Fixed a regression when using mount API for bind mounts. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.30.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.30.0.md new file mode 100644 index 0000000000000000000000000000000000000000..0eb99e6ee3601e53f910d4194e682a7715d7bc8a --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.30.0.md @@ -0,0 +1,20 @@ +# Docker Compose release 2.30.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2300 + +## [2.30.0](#2300) + +*2024-10-29* + +### [Update](#update-28) + +* Dependencies upgrade: bump compose-go to v2.4.1 +* Dependencies upgrade: bump docker engine and cli to v27.3.1 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-34) + +* Introduction of service hooks support. +* Addition of alpha `generate` command. +* Addition of `export` command. +* Added support for CDI device requests using `devices` in the Compose file. +* A lot a bug fixes. diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.30.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.30.1.md new file mode 100644 index 0000000000000000000000000000000000000000..4e739c6823c23242a48c736a04c0b72e1449a1e3 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.30.1.md @@ -0,0 +1,16 @@ +# Docker Compose release 2.30.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2301 + +## [2.30.1](#2301) + +*2024-10-30* + +### [Update](#update-27) + +* Dependencies upgrade: bump compose-go to v2.4.2 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-33) + +* Fixed a regression when using stdin as input for `-f` flag +* Fixed a regression when using the same YAML anchor multiple times in a Compose file diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.30.2.md b/corpus/changelog/docker_compose_releases/docker_compose_2.30.2.md new file mode 100644 index 0000000000000000000000000000000000000000..608fcc58703775f437fda4f55c9b0790ce515224 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.30.2.md @@ -0,0 +1,16 @@ +# Docker Compose release 2.30.2 + +Source: https://docs.docker.com/compose/releases/release-notes/#2302 + +## [2.30.2](#2302) + +*2024-11-05* + +### [Update](#update-26) + +* Dependencies upgrade: bump compose-go to v2.4.3 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-32) + +* Fixed an issue re-creating services when updating its profiles +* Fixed a regression when using the same YAML anchor multiple times in a Compose file diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.30.3.md b/corpus/changelog/docker_compose_releases/docker_compose_2.30.3.md new file mode 100644 index 0000000000000000000000000000000000000000..302b2291f9d85618f3a2426b1e9b73ab1b214ac9 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.30.3.md @@ -0,0 +1,16 @@ +# Docker Compose release 2.30.3 + +Source: https://docs.docker.com/compose/releases/release-notes/#2303 + +## [2.30.3](#2303) + +*2024-11-07* + +### [Update](#update-25) + +* Dependencies upgrade: bump compose-go to v2.4.4 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-31) + +* Fixed an issue re-starting services that should not when using `--watch` +* Improve the fix of using same YAML anchor multiple times in a Compose file diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.31.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.31.0.md new file mode 100644 index 0000000000000000000000000000000000000000..ab2300bdce67e65da1bd589ea1d80c2935c13f3f --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.31.0.md @@ -0,0 +1,21 @@ +# Docker Compose release 2.31.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2310 + +## [2.31.0](#2310) + +*2024-11-28* + +### [Update](#update-24) + +* Dependencies upgrade: bump compose-go to v2.4.5 +* Dependencies upgrade: bump docker engine and cli to v27.4.0-rc.2 +* Dependencies upgrade: bump buildx to v0.18.0 +* Dependencies upgrade: bump buildkit to v0.17.1 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-30) + +* Added the ability to use Docker Buildx Bake to build Docker Compose services +* Added `commit` command to create new images from running containers +* Fixed an issue where network changes were not detected +* Fixed an issue where containers stopped sequentially which slowed down the restart process diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.32.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.32.0.md new file mode 100644 index 0000000000000000000000000000000000000000..7d704c04fbf945ed3327dc85b1145cf468b266f8 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.32.0.md @@ -0,0 +1,28 @@ +# Docker Compose release 2.32.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2320 + +## [2.32.0](#2320) + +*2024-12-13* + +### [Update](#update-23) + +* Dependencies upgrade: bump docker + buildx to latest release +* Dependencies upgrade: bump otel dependencies to v1.28.0 and v0.53.0 +* Dependencies upgrade: bump golang.org/x/sys 0.28.0 +* Dependencies upgrade: bump golang.org/x/crypto to 0.31.0 +* Dependencies upgrade: bump google.golang.org/grpc to 1.68.1 +* Dependencies upgrade: bump golang.org/x/sync 0.10.0 +* Dependencies upgrade: bump xx to v1.6.1 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-29) + +* Improved support when building with + [Bake](https://docs.docker.com/build/bake/) +* Added `restart` and `sync+exec` watch actions +* Compose now recreates containers when the volume or network configuration changes +* Fixed support for `mac_address` +* Fixed `pull --quiet` to only hide progress, not global status +* Fixed an issue where only the `rebuild` watch action now requires a build declaration +* Compose now logs `watch` configuration error when enabled through the Compose menu diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.32.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.32.1.md new file mode 100644 index 0000000000000000000000000000000000000000..3b46e4ac1d390deb7ceb2f1789262f2dff5cbc07 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.32.1.md @@ -0,0 +1,11 @@ +# Docker Compose release 2.32.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2321 + +## [2.32.1](#2321) + +*2024-12-16* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-28) + +* Fixed a bug recreating containers when not needed diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.32.2.md b/corpus/changelog/docker_compose_releases/docker_compose_2.32.2.md new file mode 100644 index 0000000000000000000000000000000000000000..2399e4d29585d87e7bb73c6d81b1c2738c06d28e --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.32.2.md @@ -0,0 +1,18 @@ +# Docker Compose release 2.32.2 + +Source: https://docs.docker.com/compose/releases/release-notes/#2322 + +## [2.32.2](#2322) + +*2025-01-07* + +### [Update](#update-22) + +* Dependencies upgrade: bump compose-go to v2.4.7 +* Dependencies upgrade: bump golang to v1.22.10 + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-27) + +* Added `--pull` flag to the `docker compose run` command +* Fixed a bug which meant the `restart` action of `watch` mode didn't monitor bind mounts +* Fixed an issue recreating containers when using anonymous volumes diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.32.3.md b/corpus/changelog/docker_compose_releases/docker_compose_2.32.3.md new file mode 100644 index 0000000000000000000000000000000000000000..daa33c38abc15aa6909bb383a4dd6522a64e3fb7 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.32.3.md @@ -0,0 +1,16 @@ +# Docker Compose release 2.32.3 + +Source: https://docs.docker.com/compose/releases/release-notes/#2323 + +## [2.32.3](#2323) + +*2025-01-13* +> Note +> +> Binaries from the Compose GitHub repository may not display the version number properly. If you rely on `docker compose version` +> in your development or CI processes, upgrade to Compose version 2.32.4. + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-26) + +* Fixed an issue where Compose would override a service-level MAC address with the main network MAC address +* Fixed a log rendering issue during concurrent builds diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.32.4.md b/corpus/changelog/docker_compose_releases/docker_compose_2.32.4.md new file mode 100644 index 0000000000000000000000000000000000000000..dd5c5e20338cf6be7fa09bd6bd2d741d5a12c591 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.32.4.md @@ -0,0 +1,11 @@ +# Docker Compose release 2.32.4 + +Source: https://docs.docker.com/compose/releases/release-notes/#2324 + +## [2.32.4](#2324) + +*2025-01-16* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-25) + +* Fixed an issue where the Compose version did not display properly when using `docker compose version` diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.33.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.33.0.md new file mode 100644 index 0000000000000000000000000000000000000000..2cf0dd34d1f1896552946aab1f32c2b215254a94 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.33.0.md @@ -0,0 +1,43 @@ +# Docker Compose release 2.33.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2330 + +## [2.33.0](#2330) + +*2025-02-13* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-24) + +* Introduced a hint to promote the use of + [Bake](/build/bake/) +* Introduced support for the `additional_context` attribute referencing another service +* Added support for `BUILDKIT_PROGRESS` +* Compose now warns you when a published Compose application includes environment variables +* Added a `--with-env` flag to publish a Compose application with environment variables +* Updated `ls --quiet` help description +* Fixed multiple issues delegating build to Bake +* Updated help in `stats` command +* Fixed support for "builtin" seccomp profile +* Fixed support for `watch` with multiple services +* Removed exit code per error type used by legacy metrics system +* Fixed test coverage for `compatibility` +* Removed raw os.Args sent to OpenTelemetry +* Enabled copyloopvar linter +* Fixed provenance for binaries and generate SBOM +* Main branch for docs upstream validation is now used +* Added codeowners file +* Added Docker Engine v28.x to the test-matrix + +### [Update](#update-21) + +* Dependencies upgrade: Bump compose-go v2.4.8 +* Dependencies upgrade: Bump buildx v0.20.1 +* Dependencies upgrade: Bump docker to v27.5.1 +* Dependencies upgrade: Bump golangci-lint to v1.63.4 +* Dependencies upgrade: Bump golang.org/x/sys from 0.28.0 to 0.30.0 +* Dependencies upgrade: Bump github.com/moby/term v0.5.2 +* Dependencies upgrade: Bump github.com/otiai10/copy from 1.14.0 to 1.14.1 +* Dependencies upgrade: Bump github.com/jonboulle/clockwork from 0.4.0 to 0.5.0 +* Dependencies upgrade: Bump github.com/spf13/pflag from 1.0.5 to 1.0.6 +* Dependencies upgrade: Bump golang.org/x/sync from 0.10.0 to 0.11.0 +* Dependencies upgrade: Bump gotest.tools/v3 from 3.5.1 to 3.5.2 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.33.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.33.1.md new file mode 100644 index 0000000000000000000000000000000000000000..4ed20b77cba93611d280c40399d0ccdec015ee53 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.33.1.md @@ -0,0 +1,17 @@ +# Docker Compose release 2.33.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2331 + +## [2.33.1](#2331) + +*2025-02-21* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-23) + +* Added support for `gw_priority`, `enable_ipv4` (requires Docker v28.0) +* Fixed an issue with the navigation menu +* Improved error message when using non-file secret/config with read-only service + +### [Update](#update-20) + +* Dependencies upgrade: bump docker engine and cli to v28.0.0 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.34.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.34.0.md new file mode 100644 index 0000000000000000000000000000000000000000..065fcab23f2fc12d97a0aa26fbc0440b9182cd4b --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.34.0.md @@ -0,0 +1,22 @@ +# Docker Compose release 2.34.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2340 + +## [2.34.0](#2340) + +*2025-03-14* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-22) + +* Added support of refresh `pull_policy` values `daily`, `weekly` and `every_` +* Introduced `include` attribut to `watch` definition to match file patterns +* Introduced `--env-from-file` in flag for the `docker compose run` command +* Promoted `publish` as a regular command of Compose +* Fixed a bug by loading `env_file` after services have been selected + +### [Update](#update-19) + +* Dependencies upgrade: bump docker engine and cli to v28.0.1 +* Dependencies upgrade: bump buildkit to v0.17.1 +* Dependencies upgrade: Bump compose-go v2.4.9 +* Dependencies upgrade: Bump buildx v0.21.2 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.35.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.35.0.md new file mode 100644 index 0000000000000000000000000000000000000000..103d136dd8554e0c2cc2168656363499d92b2277 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.35.0.md @@ -0,0 +1,25 @@ +# Docker Compose release 2.35.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2350 + +## [2.35.0](#2350) + +*2025-04-10* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-21) + +* Added support for + [Docker Model Runner](https://docs.docker.com/ai/model-runner/) to easily integrate AI models into your Compose applications +* Added `build --print` command to help debug complex build configurations by showing the equivalent bake file +* Added `volume.type=image` to provide more flexible volume management for container images +* Added `--quiet` options to the `run` command for cleaner output when running containers +* Added `config --no-env-resolution` option to view raw configuration without environment variable substitution +* Fixed behavior of `depends_on` to prevent unnecessary container recreation when dependencies change +* Fixed support for secrets defined by environment variables when using `include` +* Fixed volume mount handling to ensure bind mounts work correctly in all scenarios + +### [Update](#update-18) + +* Dependencies upgrade: bump docker engine and cli to v28.1.0 +* Dependencies upgrade: bump buildx to v0.23.0 +* Dependencies upgrade: bump buildkit to v0.21.0 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.35.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.35.1.md new file mode 100644 index 0000000000000000000000000000000000000000..79ff0cc14c25b5e477bb390fe11522d1417410f8 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.35.1.md @@ -0,0 +1,17 @@ +# Docker Compose release 2.35.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2351 + +## [2.35.1](#2351) + +*2025-04-17* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-20) + +* Fixed an issue with bind mounts + +### [Update](#update-17) + +* Dependencies upgrade: bump compose-go to v2.6.0 +* Dependencies upgrade: bump docker engine and cli to v28.0.4 +* Dependencies upgrade: bump buildx to v0.22.0 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.36.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.36.0.md new file mode 100644 index 0000000000000000000000000000000000000000..f40716be16a32a24401b2cfbca708fb77a994922 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.36.0.md @@ -0,0 +1,22 @@ +# Docker Compose release 2.36.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2360 + +## [2.36.0](#2360) + +*2025-05-07* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-19) + +* Introduced `networks.interface_name` +* Added support for `COMPOSE_PROGRESS` env variable +* Added `service.provider` to external binaries +* Introduced build `--check` flag +* Fixed multiple panic issues when parsing Compose files + +### [Update](#update-16) + +* Dependencies upgrade: bump compose-go to v2.6.2 +* Dependencies upgrade: bump docker engine and cli to v28.1.0 +* Dependencies upgrade: bump containerd to 2.0.5 +* Dependencies upgrade: bump buildkit to v0.21.1 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.36.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.36.1.md new file mode 100644 index 0000000000000000000000000000000000000000..90c99a4fc0e4312ead6143772732a420b227278c --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.36.1.md @@ -0,0 +1,20 @@ +# Docker Compose release 2.36.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2361 + +## [2.36.1](#2361) + +*2025-05-19* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-18) + +* Introduced support of arrays for `provider` service `options` attribute +* Added `debug` messages in the extension protocol +* Fixed an issue when trying to publish a Compose application with a `provider` service +* Fixed build issues on Compose applications with `service.provider` +* Introduced `--lock-image-digests` to `config` command + +### [Update](#update-15) + +* Dependencies upgrade: bump compose-go to v2.6.3 +* Dependencies upgrade: bump containerd to 2.1.0 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.36.2.md b/corpus/changelog/docker_compose_releases/docker_compose_2.36.2.md new file mode 100644 index 0000000000000000000000000000000000000000..49c0c930e0cf6fbf28b4f18921ec91fd95ec1aa1 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.36.2.md @@ -0,0 +1,19 @@ +# Docker Compose release 2.36.2 + +Source: https://docs.docker.com/compose/releases/release-notes/#2362 + +## [2.36.2](#2362) + +*2025-05-23* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-17) + +* Compose Bridge features are now part of Compose +* Improved display of the `docker compose images` command +* Promoted `bake` as the default build tool for Compose +* Fixed issues around build flow +* Fixed the restart of dependent services after `watch` rebuild images + +### [Update](#update-14) + +* Dependencies upgrade: bump docker engine and cli to v28.2.2 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.37.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.37.0.md new file mode 100644 index 0000000000000000000000000000000000000000..20b364129e8ed0e064a4ca5c76488d8da6d06c23 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.37.0.md @@ -0,0 +1,19 @@ +# Docker Compose release 2.37.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2370 + +## [2.37.0](#2370) + +*2025-06-05* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-16) + +* Fixed an issue with random port allocation +* Fixed an issue recreating containers when not needed during inner loop +* Fixed a problem during `up --build` with `additional_context` + +### [Update](#update-13) + +* Dependencies upgrade: bump compose-go to v2.6.4 +* Dependencies upgrade: bump buildx to v0.24.0 +* Dependencies upgrade: bump buildkit to v0.22.0 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.37.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.37.1.md new file mode 100644 index 0000000000000000000000000000000000000000..036be94d2c30a645486e65cfd0977cb87e30f5dd --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.37.1.md @@ -0,0 +1,13 @@ +# Docker Compose release 2.37.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2371 + +## [2.37.1](#2371) + +*2025-06-12* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-15) + +* Fixed a permission issue with bake metadata files on Windows +* Fixed a panic error on provider service startup +* Reverted `compose images` JSON output to array format diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.37.2.md b/corpus/changelog/docker_compose_releases/docker_compose_2.37.2.md new file mode 100644 index 0000000000000000000000000000000000000000..349994822f252697eb93adc31fa1fee09577f61d --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.37.2.md @@ -0,0 +1,21 @@ +# Docker Compose release 2.37.2 + +Source: https://docs.docker.com/compose/releases/release-notes/#2372 + +## [2.37.2](#2372) + +*2025-06-20* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-14) + +* Introduce `use_api_socket` +* Fixed `compose images` JSON output format +* Fixed panic using `w` shortcut on project without watch support +* Fixed a permission issue with bake metadata files on Windows +* Fixed a panic error on provider service startup + +### [Update](#update-12) + +* Dependencies upgrade: bump compose-go to v2.6.5 +* Dependencies upgrade: bump buildx to v0.25.0 +* Dependencies upgrade: bump buildkit to v0.23.0 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.37.3.md b/corpus/changelog/docker_compose_releases/docker_compose_2.37.3.md new file mode 100644 index 0000000000000000000000000000000000000000..e2f8804ea7be38fa777b93e6cd2c20d023275d8d --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.37.3.md @@ -0,0 +1,17 @@ +# Docker Compose release 2.37.3 + +Source: https://docs.docker.com/compose/releases/release-notes/#2373 + +## [2.37.3](#2373) + +*2025-06-24* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-13) + +* Added support of `cache_to` for Bake +* Fixed issue with Bake integration +* Fixed multiple issues affecting `run` command + +### [Update](#update-11) + +* Dependencies upgrade: bump buildkit to v0.23.1 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.38.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.38.0.md new file mode 100644 index 0000000000000000000000000000000000000000..2d98fefe55245cf92bafb4b21f7a6ae6d46f86f7 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.38.0.md @@ -0,0 +1,20 @@ +# Docker Compose release 2.38.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2380 + +## [2.38.0](#2380) + +*2025-06-30* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-12) + +* Introduced support of `models` for LLM configuration +* Added `volumes` command +* Removed `publish` limitation on bind mounts +* Fixed an issue mounting the docker socket to container which doesn't need it +* Fixed an issue with bake hanging on output + +### [Update](#update-10) + +* Dependencies upgrade: bump compose-go to v2.7.0 +* Dependencies upgrade: bump docker engine and cli to v28.3.0 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.38.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.38.1.md new file mode 100644 index 0000000000000000000000000000000000000000..94b5298e91e3f75827b0095ce1c170dc258bc474 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.38.1.md @@ -0,0 +1,15 @@ +# Docker Compose release 2.38.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2381 + +## [2.38.1](#2381) + +*2025-06-30* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-11) + +* Added support of `model_variable` for service `models` configuration + +### [Update](#update-9) + +* Dependencies upgrade: bump compose-go to v2.7.1 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.38.2.md b/corpus/changelog/docker_compose_releases/docker_compose_2.38.2.md new file mode 100644 index 0000000000000000000000000000000000000000..ca86fc36ce20afd798e43df1974a9459086b9a40 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.38.2.md @@ -0,0 +1,20 @@ +# Docker Compose release 2.38.2 + +Source: https://docs.docker.com/compose/releases/release-notes/#2382 + +## [2.38.2](#2382) + +*2025-07-08* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-10) + +* Added `--networks` flag to `config` command to list networks +* Fixed an issue on `down` command with Docker Model Runner used as a provider service +* Fixed a display issue on Docker Model Runner progress +* Fixed an issue with services with profile missing secrets + +### [Update](#update-8) + +* Dependencies upgrade: bump docker engine and cli to v28.3.1 +* Dependencies upgrade: bump buildkit to v0.23.2 +* Dependencies upgrade: bump golang to v1.23.10 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.39.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.39.0.md new file mode 100644 index 0000000000000000000000000000000000000000..e986c2e0c30d745fc4f3982e01533e463a78ea0e --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.39.0.md @@ -0,0 +1,21 @@ +# Docker Compose release 2.39.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2390 + +## [2.39.0](#2390) + +*2025-07-24* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-9) + +* Added `--models` flag to `config` command to list models +* Added `--since` and `--until` flags to `events` +* Introduced `provenance` and `sbom` attributes to `build` section +* Fixed `bridge convert` issue on Windows +* Fixed multiple issues with `bake` builds + +### [Update](#update-7) + +* Dependencies upgrade: bump docker engine and cli to v28.3.2 +* Dependencies upgrade: bump buildx to v0.26.1 +* Dependencies upgrade: bump compose-go to v2.8.0 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.39.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.39.1.md new file mode 100644 index 0000000000000000000000000000000000000000..dabd0bc9b5119ff083647e93126bb34cf6209cc2 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.39.1.md @@ -0,0 +1,15 @@ +# Docker Compose release 2.39.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2391 + +## [2.39.1](#2391) + +*2025-07-24* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-8) + +* Added metrics to monitor `models` usage + +### [Update](#update-6) + +* Dependencies upgrade: bump compose-go to v2.8.1 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.39.2.md b/corpus/changelog/docker_compose_releases/docker_compose_2.39.2.md new file mode 100644 index 0000000000000000000000000000000000000000..ea6b85462a956563998f562ee9cac4dbc4eb47a6 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.39.2.md @@ -0,0 +1,19 @@ +# Docker Compose release 2.39.2 + +Source: https://docs.docker.com/compose/releases/release-notes/#2392 + +## [2.39.2](#2392) + +*2025-08-04* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-7) + +* Fixed multiple rendering issues with the build output +* Fixed issue when `pull` and `no_cache` attributes were not applied with `bake` +* Removed log display of explicitly un-attached services on `up` command + +### [Update](#update-5) + +* Dependencies upgrade: bump docker engine and cli to v28.3.3 +* Dependencies upgrade: bump golang to v1.23.12 +* Dependencies upgrade: bump containerd to 2.1.4 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.39.3.md b/corpus/changelog/docker_compose_releases/docker_compose_2.39.3.md new file mode 100644 index 0000000000000000000000000000000000000000..8fba2d854a2eecb5603310176243f7e436b5d765 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.39.3.md @@ -0,0 +1,21 @@ +# Docker Compose release 2.39.3 + +Source: https://docs.docker.com/compose/releases/release-notes/#2393 + +## [2.39.3](#2393) + +*2025-09-09* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-6) + +* Added completions for `--progress` flag +* Fixed minor issues when building with `bake` +* Fixed issue when publishing a Compose stack with bind mounts and `-y` flag + +### [Update](#update-4) + +* Dependencies upgrade: bump docker engine and cli to v28.4.0 +* Dependencies upgrade: bump compose-go to v2.8.2 +* Dependencies upgrade: bump buildx to v0.28.0 +* Dependencies upgrade: bump buildkit to v0.24.0 +* Dependencies upgrade: bump golang to v1.24.7 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.39.4.md b/corpus/changelog/docker_compose_releases/docker_compose_2.39.4.md new file mode 100644 index 0000000000000000000000000000000000000000..da9a1a69672e8d171a7944fb3e6be5fd3bbdf614 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.39.4.md @@ -0,0 +1,17 @@ +# Docker Compose release 2.39.4 + +Source: https://docs.docker.com/compose/releases/release-notes/#2394 + +## [2.39.4](#2394) + +*2025-09-19* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-5) + +* Added `initial_sync` attribute to the Compose Develop Specification definition, to sync files after starting a watch session +* Fixed a TLS issue when building with bake +* Disabled Tty on `run` when running as a piped command + +### [Update](#update-3) + +* Dependencies upgrade: bump compose-go to v2.9.0 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.40.0.md b/corpus/changelog/docker_compose_releases/docker_compose_2.40.0.md new file mode 100644 index 0000000000000000000000000000000000000000..13c69c3efc657a463ad39d24a12b1d2f4510fba9 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.40.0.md @@ -0,0 +1,17 @@ +# Docker Compose release 2.40.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#2400 + +## [2.40.0](#2400) + +*2025-10-03* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-4) + +* Added the option to publish Compose applications as a `compose.yaml` with images +* Fixed support for secrets based on environment variables when building with bake +* Fixed support for escaped '$' character when building with bake + +### [Update](#update-2) + +* Dependencies upgrade: bump docker engine and cli to v28.5.0 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.40.1.md b/corpus/changelog/docker_compose_releases/docker_compose_2.40.1.md new file mode 100644 index 0000000000000000000000000000000000000000..7038c878949a3cfd326fbb5b9c32cb90f8048186 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.40.1.md @@ -0,0 +1,20 @@ +# Docker Compose release 2.40.1 + +Source: https://docs.docker.com/compose/releases/release-notes/#2401 + +## [2.40.1](#2401) + +*2025-10-17* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-3) + +* Fixed a few issues when building with bake +* Added support of extends with profiles when using the `publish` command +* Added support of `CTRL+Z` to run Compose in background +* Fixed secret/config setup of `uid:gid` to match container's `USER` definition + +### [Update](#update-1) + +* Dependencies upgrade: bump docker engine and cli to v28.5.1 +* Dependencies upgrade: bump buildx to v0.29.1 +* Dependencies upgrade: bump golang to v1.24.9 diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.40.2.md b/corpus/changelog/docker_compose_releases/docker_compose_2.40.2.md new file mode 100644 index 0000000000000000000000000000000000000000..a57c969d128d84611641a7ea46d7f4f3ea294331 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.40.2.md @@ -0,0 +1,15 @@ +# Docker Compose release 2.40.2 + +Source: https://docs.docker.com/compose/releases/release-notes/#2402 + +## [2.40.2](#2402) + +*2025-10-22* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-2) + +* Added a check to fail builds if the minimal required Buildx version isn’t installed +* Removed unused code to rely solely on api.Service +* Improved image detection by checking digests/canonical references, not just tags +* Introduced `WithPrompt` which adds a pluggable UI for user interactions +* Reverted fix for secret/config setup of `uid:gid` to match container's `USER` definition diff --git a/corpus/changelog/docker_compose_releases/docker_compose_2.40.3.md b/corpus/changelog/docker_compose_releases/docker_compose_2.40.3.md new file mode 100644 index 0000000000000000000000000000000000000000..ea866e5cc4336e0fe335ad06fcd42b90bd27b065 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_2.40.3.md @@ -0,0 +1,14 @@ +# Docker Compose release 2.40.3 + +Source: https://docs.docker.com/compose/releases/release-notes/#2403 + +## [2.40.3](#2403) + +*2025-10-30* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-1) + +* Lifecycle hooks now apply to the `restart` command +* Improved override support when publishing OCI artifacts +* Fixed an issue to ensure an image exists only for targeted services with the `run` command +* Added a default Prompt implementation diff --git a/corpus/changelog/docker_compose_releases/docker_compose_5.0.0.md b/corpus/changelog/docker_compose_releases/docker_compose_5.0.0.md new file mode 100644 index 0000000000000000000000000000000000000000..9f76b81e994e10739ac0a11217be3d43841c8325 --- /dev/null +++ b/corpus/changelog/docker_compose_releases/docker_compose_5.0.0.md @@ -0,0 +1,45 @@ +# Docker Compose release 5.0.0 + +Source: https://docs.docker.com/compose/releases/release-notes/#500 + +## [5.0.0](#500) + +*2025-12-02* + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements) + +* Dropped support for internal buildkit builder. +* Introduced Compose SDK using functional parameters. +* Introduced abstractions to support SDK usage without requiring Docker CLI. +* Made progress Writer a configurable CLI component. +* Moved progress package to cmd as a CLI component. +* Added load project function to SDK. +* Introduced SDK docs. +* Documented support for OCI and Git remote resources. +* Added support for run hooks on restart. +* Fixed check for existing image to only select the target service in run c.ommand +* Introduced --insecure-registry, reserved for testing purpose. +* Added support for build.no\_cache\_filter. +* Added --wait option to start command. +* Fixed OCI compose override support. +* Fixed help output for "exec --no-tty" option. +* Fixed typo in error message. +* Disabled progress UI when build is ran with --print. +* Restores support for detach keys. +* Fixed images command to display image Created time. +* Fixed support for port range. +* Fixed support for includes in publish command. +* Ignore runtime flags in model configuration. + +### [Update](#update) + +* Dependencies upgrade: Bump compose go to v2.10.0 +* Dependencies upgrade: bump docker 28.5.2 +* Dependencies upgrade: bump containerd to 2.2.0 +* Dependencies upgrade: bump docker/cli to 28.5.2 +* Dependencies upgrade: bump buildx v0.30.0, buildkit v0.26.0, otel v1.38.0, otel/contrib v0.63.0 +* Dependencies upgrade: bump golang.org/x/sys 0.38.0 +* Dependencies upgrade: bump golang.org/x/sync to 0.18.0 +* Dependencies upgrade: bump github.com/hashicorp/go-version to 1.8.0 +* Dependencies upgrade: bump golang.org/x/crypto v0.45.0 +* Dockerfile: update golangci-lint to v2.6.2 diff --git a/corpus/changelog/docker_engine_releases/docker_engine_19.03.14.md b/corpus/changelog/docker_engine_releases/docker_engine_19.03.14.md new file mode 100644 index 0000000000000000000000000000000000000000..39adadb146b3da08a3c9033575b05edbc272e2b2 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_19.03.14.md @@ -0,0 +1,35 @@ +# Docker Engine 19.03.14 release notes + +Source: https://docs.docker.com/engine/release-notes/19.03/ + +## [19.03.14](#190314) + +2020-12-01 + +### [Security](#security-1) + +* [CVE-2020-15257](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15257): + Update bundled static binaries of containerd to v1.3.9 [moby/moby#41731](https://github.com/moby/moby/pull/41731). + Package managers should update the containerd.io package. + +### [Builder](#builder) + +* Beta versions of apparmor are now parsed correctly preventing build failures [moby/moby#41542](https://github.com/moby/moby/pull/41542) + +### [Networking](#networking) + +* Fix panic when swarmkit service keeps failing to start [moby/moby#41635](https://github.com/moby/moby/pull/41635) + +### [Runtime](#runtime) + +* Return correct errors instead of spurious -EINVAL [moby/moby#41293](https://github.com/moby/moby/pull/41293) + +### [Rootless](#rootless) + +* Lock state dir for preventing automatic clean-up by systemd-tmpfiles [moby/moby#41635](https://github.com/moby/moby/pull/41635) +* dockerd-rootless.sh: support new containerd shim socket path convention [moby/moby#41557](https://github.com/moby/moby/pull/41557) + +### [Logging](#logging) + +* gcplogs: Fix memory/connection leak [moby/moby#41522](https://github.com/moby/moby/pull/41522) +* awslogs: Support for AWS imdsv2 [moby/moby#41494](https://github.com/moby/moby/pull/41494) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_19.03.15.md b/corpus/changelog/docker_engine_releases/docker_engine_19.03.15.md new file mode 100644 index 0000000000000000000000000000000000000000..45586b36ec3caa6454c0d57b30e170a8bc4871da --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_19.03.15.md @@ -0,0 +1,17 @@ +# Docker Engine 19.03.15 release notes + +Source: https://docs.docker.com/engine/release-notes/19.03/ + +## [19.03.15](#190315) + +2021-02-01 + +### [Security](#security) + +* [CVE-2021-21285](https://github.com/moby/moby/security/advisories/GHSA-6fj5-m822-rqx8) Prevent an invalid image from crashing docker daemon +* [CVE-2021-21284](https://github.com/moby/moby/security/advisories/GHSA-7452-xqpj-6rpc) Lock down file permissions to prevent remapped root from accessing docker state +* Ensure AppArmor and SELinux profiles are applied when building with BuildKit + +### [Client](#client) + +* Check contexts before importing them to reduce risk of extracted files escaping context store diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.0.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.0.md new file mode 100644 index 0000000000000000000000000000000000000000..0c9df713052dc957dfde4b3e39a669a1479d523a --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.0.md @@ -0,0 +1,177 @@ +# Docker Engine 20.10.0 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.0](#20100) + +2020-12-08 + +### [Deprecation / Removal](#deprecation--removal) + +For an overview of all deprecated features, refer to the +[Deprecated Engine Features](/engine/deprecated/) page. + +* Warnings and deprecation notice when `docker pull`-ing from non-compliant registries not supporting pull-by-digest [docker/cli#2872](https://github.com/docker/cli/pull/2872) +* Sterner warnings and deprecation notice for unauthenticated tcp access [moby/moby#41285](https://github.com/moby/moby/pull/41285) +* Deprecate KernelMemory (`docker run --kernel-memory`) [moby/moby#41254](https://github.com/moby/moby/pull/41254) [docker/cli#2652](https://github.com/docker/cli/pull/2652) +* Deprecate `aufs` storage driver [docker/cli#1484](https://github.com/docker/cli/pull/1484) +* Deprecate host-discovery and overlay networks with external k/v stores [moby/moby#40614](https://github.com/moby/moby/pull/40614) [moby/moby#40510](https://github.com/moby/moby/pull/40510) +* Deprecate Dockerfile legacy 'ENV name value' syntax, use `ENV name=value` instead [docker/cli#2743](https://github.com/docker/cli/pull/2743) +* Remove deprecated "filter" parameter for API v1.41 and up [moby/moby#40491](https://github.com/moby/moby/pull/40491) +* Disable distribution manifest v2 schema 1 on push [moby/moby#41295](https://github.com/moby/moby/pull/41295) +* Remove hack MalformedHostHeaderOverride breaking old docker clients (<= 1.12) in which case, set `DOCKER_API_VERSION` [moby/moby#39076](https://github.com/moby/moby/pull/39076) +* Remove "docker engine" subcommands [docker/cli#2207](https://github.com/docker/cli/pull/2207) +* Remove experimental "deploy" from "dab" files [docker/cli#2216](https://github.com/docker/cli/pull/2216) +* Remove deprecated `docker search --automated` and `--stars` flags [docker/cli#2338](https://github.com/docker/cli/pull/2338) +* No longer allow reserved namespaces in engine labels [docker/cli#2326](https://github.com/docker/cli/pull/2326) + +### [API](#api) + +* Update API version to v1.41 +* Do not require "experimental" for metrics API [moby/moby#40427](https://github.com/moby/moby/pull/40427) +* `GET /events` now returns `prune` events after pruning resources have completed [moby/moby#41259](https://github.com/moby/moby/pull/41259) + + Prune events are returned for `container`, `network`, `volume`, `image`, and `builder`, and have a `reclaimed` attribute, indicating the amount of space reclaimed (in bytes) +* Add `one-shot` stats option to not prime the stats [moby/moby#40478](https://github.com/moby/moby/pull/40478) +* Adding OS version info to the system info's API (`/info`) [moby/moby#38349](https://github.com/moby/moby/pull/38349) +* Add DefaultAddressPools to docker info [moby/moby#40714](https://github.com/moby/moby/pull/40714) +* Add API support for PidsLimit on services [moby/moby#39882](https://github.com/moby/moby/pull/39882) + +### [Builder](#builder-5) + +* buildkit,dockerfile: Support for `RUN --mount` options without needing to specify experimental dockerfile `#syntax` directive. [moby/buildkit#1717](https://github.com/moby/buildkit/pull/1717) +* dockerfile: `ARG` command now supports defining multiple build args on the same line similarly to `ENV` [moby/buildkit#1692](https://github.com/moby/buildkit/pull/1692) +* dockerfile: `--chown` flag in `ADD` now allows parameter expansion [moby/buildkit#1473](https://github.com/moby/buildkit/pull/1473) +* buildkit: Fetching authorization tokens has been moved to client-side (if the client supports it). Passwords do not leak into the build daemon anymore and users can see from build output when credentials or tokens are accessed. [moby/buildkit#1660](https://github.com/moby/buildkit/pull/1660) +* buildkit: Connection errors while communicating with the registry for push and pull now trigger a retry [moby/buildkit#1791](https://github.com/moby/buildkit/pull/1791) +* buildkit: Git source now supports token authentication via build secrets [moby/moby#41234](https://github.com/moby/moby/pull/41234) [docker/cli#2656](https://github.com/docker/cli/pull/2656) [moby/buildkit#1533](https://github.com/moby/buildkit/pull/1533) +* buildkit: Building from git source now supports forwarding SSH socket for authentication [moby/buildkit#1782](https://github.com/moby/buildkit/pull/1782) +* buildkit: Avoid builds that generate excessive logs to cause a crash or slow down the build. Clipping is performed if needed. [moby/buildkit#1754](https://github.com/moby/buildkit/pull/1754) +* buildkit: Change default Seccomp profile to the one provided by Docker [moby/buildkit#1807](https://github.com/moby/buildkit/pull/1807) +* buildkit: Support for exposing SSH agent socket on Windows has been improved [moby/buildkit#1695](https://github.com/moby/buildkit/pull/1695) +* buildkit: Disable truncating by default when using --progress=plain [moby/buildkit#1435](https://github.com/moby/buildkit/pull/1435) +* buildkit: Allow better handling client sessions dropping while it is being shared by multiple builds [moby/buildkit#1551](https://github.com/moby/buildkit/pull/1551) +* buildkit: secrets: allow providing secrets with env [moby/moby#41234](https://github.com/moby/moby/pull/41234) [docker/cli#2656](https://github.com/docker/cli/pull/2656) [moby/buildkit#1534](https://github.com/moby/buildkit/pull/1534) + + Support `--secret id=foo,env=MY_ENV` as an alternative for storing a secret value to a file. + + `--secret id=GIT_AUTH_TOKEN` will load env if it exists and the file does not. +* buildkit: Support for mirrors fallbacks, insecure TLS and custom TLS config [moby/moby#40814](https://github.com/moby/moby/pull/40814) +* buildkit: remotecache: Only visit each item once when walking results [moby/moby#41234](https://github.com/moby/moby/pull/41234) [moby/buildkit#1577](https://github.com/moby/buildkit/pull/1577) + + Improves performance and CPU use on bigger graphs +* buildkit: Check remote when local image platform doesn't match [moby/moby#40629](https://github.com/moby/moby/pull/40629) +* buildkit: image export: Use correct media type when creating new layer blobs [moby/moby#41234](https://github.com/moby/moby/pull/41234) [moby/buildkit#1541](https://github.com/moby/buildkit/pull/1541) +* buildkit: progressui: fix logs time formatting [moby/moby#41234](https://github.com/moby/moby/pull/41234) [docker/cli#2656](https://github.com/docker/cli/pull/2656) [moby/buildkit#1549](https://github.com/moby/buildkit/pull/1549) +* buildkit: mitigate containerd issue on parallel push [moby/moby#41234](https://github.com/moby/moby/pull/41234) [moby/buildkit#1548](https://github.com/moby/buildkit/pull/1548) +* buildkit: inline cache: fix handling of duplicate blobs [moby/moby#41234](https://github.com/moby/moby/pull/41234) [moby/buildkit#1568](https://github.com/moby/buildkit/pull/1568) + + Fixes cache-from working unreliably + + Fixes Image built from cached layers is missing data +* Allow ssh:// for remote context URLs [moby/moby#40179](https://github.com/moby/moby/pull/40179) +* builder: remove legacy build's session handling (was experimental) [moby/moby#39983](https://github.com/moby/moby/pull/39983) + +### [Client](#client-7) + +* Add swarm jobs support to CLI [docker/cli#2262](https://github.com/docker/cli/pull/2262) +* Add `-a/--all-tags` to docker push [docker/cli#2220](https://github.com/docker/cli/pull/2220) +* Add support for Kubernetes username/password auth [docker/cli#2308](https://github.com/docker/cli/pull/2308) +* Add `--pull=missing|always|never` to `run` and `create` commands [docker/cli#1498](https://github.com/docker/cli/pull/1498) +* Add `--env-file` flag to `docker exec` for parsing environment variables from a file [docker/cli#2602](https://github.com/docker/cli/pull/2602) +* Add shorthand `-n` for `--tail` option [docker/cli#2646](https://github.com/docker/cli/pull/2646) +* Add log-driver and options to service inspect "pretty" format [docker/cli#1950](https://github.com/docker/cli/pull/1950) +* docker run: specify cgroup namespace mode with `--cgroupns` [docker/cli#2024](https://github.com/docker/cli/pull/2024) +* `docker manifest rm` command to remove manifest list draft from local storage [docker/cli#2449](https://github.com/docker/cli/pull/2449) +* Add "context" to "docker version" and "docker info" [docker/cli#2500](https://github.com/docker/cli/pull/2500) +* Propagate platform flag to container create API [docker/cli#2551](https://github.com/docker/cli/pull/2551) +* The `docker ps --format` flag now has a `.State` placeholder to print the container's state without additional details about uptime and health check [docker/cli#2000](https://github.com/docker/cli/pull/2000) +* Add support for docker-compose schema v3.9 [docker/cli#2073](https://github.com/docker/cli/pull/2073) +* Add support for docker push `--quiet` [docker/cli#2197](https://github.com/docker/cli/pull/2197) +* Hide flags that are not supported by BuildKit, if BuildKit is enabled [docker/cli#2123](https://github.com/docker/cli/pull/2123) +* Update flag description for `docker rm -v` to clarify the option only removes anonymous (unnamed) volumes [docker/cli#2289](https://github.com/docker/cli/pull/2289) +* Improve tasks printing for docker services [docker/cli#2341](https://github.com/docker/cli/pull/2341) +* docker info: list CLI plugins alphabetically [docker/cli#2236](https://github.com/docker/cli/pull/2236) +* Fix order of processing of `--label-add/--label-rm`, `--container-label-add/--container-label-rm`, and `--env-add/--env-rm` flags on `docker service update` to allow replacing existing values [docker/cli#2668](https://github.com/docker/cli/pull/2668) +* Fix `docker rm --force` returning a non-zero exit code if one or more containers did not exist [docker/cli#2678](https://github.com/docker/cli/pull/2678) +* Improve memory stats display by using `total_inactive_file` instead of `cache` [docker/cli#2415](https://github.com/docker/cli/pull/2415) +* Mitigate against YAML files that has excessive aliasing [docker/cli#2117](https://github.com/docker/cli/pull/2117) +* Allow using advanced syntax when setting a config or secret with only the source field [docker/cli#2243](https://github.com/docker/cli/pull/2243) +* Fix reading config files containing `username` and `password` auth even if `auth` is empty [docker/cli#2122](https://github.com/docker/cli/pull/2122) +* docker cp: prevent NPE when failing to stat destination [docker/cli#2221](https://github.com/docker/cli/pull/2221) +* config: preserve ownership and permissions on configfile [docker/cli#2228](https://github.com/docker/cli/pull/2228) + +### [Logging](#logging-2) + +* Support reading `docker logs` with all logging drivers (best effort) [moby/moby#40543](https://github.com/moby/moby/pull/40543) +* Add `splunk-index-acknowledgment` log option to work with Splunk HECs with index acknowledgment enabled [moby/moby#39987](https://github.com/moby/moby/pull/39987) +* Add partial metadata to journald logs [moby/moby#41407](https://github.com/moby/moby/pull/41407) +* Reduce allocations for logfile reader [moby/moby#40796](https://github.com/moby/moby/pull/40796) +* Fluentd: add fluentd-async, fluentd-request-ack, and deprecate fluentd-async-connect [moby/moby#39086](https://github.com/moby/moby/pull/39086) + +### [Runtime](#runtime-5) + +* Support cgroup2 [moby/moby#40174](https://github.com/moby/moby/pull/40174) [moby/moby#40657](https://github.com/moby/moby/pull/40657) [moby/moby#40662](https://github.com/moby/moby/pull/40662) +* cgroup2: use "systemd" cgroup driver by default when available [moby/moby#40846](https://github.com/moby/moby/pull/40846) +* new storage driver: fuse-overlayfs [moby/moby#40483](https://github.com/moby/moby/pull/40483) +* Update containerd binary to v1.4.3 [moby/moby#41732](https://github.com/moby/moby/pull/41732) +* `docker push` now defaults to `latest` tag instead of all tags [moby/moby#40302](https://github.com/moby/moby/pull/40302) +* Added ability to change the number of reconnect attempts during connection loss while pulling an image by adding max-download-attempts to the config file [moby/moby#39949](https://github.com/moby/moby/pull/39949) +* Add support for containerd v2 shim by using the now default `io.containerd.runc.v2` runtime [moby/moby#41182](https://github.com/moby/moby/pull/41182) +* cgroup v1: change the default runtime to io.containerd.runc.v2. Requires containerd v1.3.0 or later. v1.3.5 or later is recommended [moby/moby#41210](https://github.com/moby/moby/pull/41210) +* Start containers in their own cgroup namespaces [moby/moby#38377](https://github.com/moby/moby/pull/38377) +* Enable DNS Lookups for CIFS Volumes [moby/moby#39250](https://github.com/moby/moby/pull/39250) +* Use MemAvailable instead of MemFree to estimate actual available memory [moby/moby#39481](https://github.com/moby/moby/pull/39481) +* The `--device` flag in `docker run` will now be honored when the container is started in privileged mode [moby/moby#40291](https://github.com/moby/moby/pull/40291) +* Enforce reserved internal labels [moby/moby#40394](https://github.com/moby/moby/pull/40394) +* Raise minimum memory limit to 6M, to account for higher memory use by runtimes during container startup [moby/moby#41168](https://github.com/moby/moby/pull/41168) +* vendor runc v1.0.0-rc92 [moby/moby#41344](https://github.com/moby/moby/pull/41344) [moby/moby#41317](https://github.com/moby/moby/pull/41317) +* info: add warnings about missing blkio cgroup support [moby/moby#41083](https://github.com/moby/moby/pull/41083) +* Accept platform spec on container create [moby/moby#40725](https://github.com/moby/moby/pull/40725) +* Fix handling of looking up user- and group-names with spaces [moby/moby#41377](https://github.com/moby/moby/pull/41377) + +### [Networking](#networking-3) + +* Support host.docker.internal in dockerd on Linux [moby/moby#40007](https://github.com/moby/moby/pull/40007) +* Include IPv6 address of linked containers in /etc/hosts [moby/moby#39837](https://github.com/moby/moby/pull/39837) +* `--ip6tables` enables IPv6 iptables rules (only if experimental) [moby/moby#41622](https://github.com/moby/moby/pull/41622) +* Add alias for hostname if hostname != container name [moby/moby#39204](https://github.com/moby/moby/pull/39204) +* Better selection of DNS server (with systemd) [moby/moby#41022](https://github.com/moby/moby/pull/41022) +* Add docker interfaces to firewalld docker zone [moby/moby#41189](https://github.com/moby/moby/pull/41189) [moby/libnetwork#2548](https://github.com/moby/libnetwork/pull/2548) + + Fixes DNS issue on CentOS8 [docker/for-linux#957](https://github.com/docker/for-linux/issues/957) + + Fixes Port Forwarding on RHEL 8 with Firewalld running with FirewallBackend=nftables [moby/libnetwork#2496](https://github.com/moby/libnetwork/issues/2496) +* Fix an issue reporting 'failed to get network during CreateEndpoint' [moby/moby#41189](https://github.com/moby/moby/pull/41189) [moby/libnetwork#2554](https://github.com/moby/libnetwork/pull/2554) +* Log error instead of disabling IPv6 router advertisement failed [moby/moby#41189](https://github.com/moby/moby/pull/41189) [moby/libnetwork#2563](https://github.com/moby/libnetwork/pull/2563) +* No longer ignore `--default-address-pool` option in certain cases [moby/moby#40711](https://github.com/moby/moby/pull/40711) +* Produce an error with invalid address pool [moby/moby#40808](https://github.com/moby/moby/pull/40808) [moby/libnetwork#2538](https://github.com/moby/libnetwork/pull/2538) +* Fix `DOCKER-USER` chain not created when IPTableEnable=false [moby/moby#40808](https://github.com/moby/moby/pull/40808) [moby/libnetwork#2471](https://github.com/moby/libnetwork/pull/2471) +* Fix panic on startup in systemd environments [moby/moby#40808](https://github.com/moby/moby/pull/40808) [moby/libnetwork#2544](https://github.com/moby/libnetwork/pull/2544) +* Fix issue preventing containers to communicate over macvlan internal network [moby/moby#40596](https://github.com/moby/moby/pull/40596) [moby/libnetwork#2407](https://github.com/moby/libnetwork/pull/2407) +* Fix InhibitIPv4 nil panic [moby/moby#40596](https://github.com/moby/moby/pull/40596) +* Fix VFP leak in Windows overlay network deletion [moby/moby#40596](https://github.com/moby/moby/pull/40596) [moby/libnetwork#2524](https://github.com/moby/libnetwork/pull/2524) + +### [Packaging](#packaging-9) + +* docker.service: Add multi-user.target to After= in unit file [moby/moby#41297](https://github.com/moby/moby/pull/41297) +* docker.service: Allow socket activation [moby/moby#37470](https://github.com/moby/moby/pull/37470) +* seccomp: Remove dependency in dockerd on libseccomp [moby/moby#41395](https://github.com/moby/moby/pull/41395) + +### [Rootless](#rootless-4) + +* rootless: graduate from experimental [moby/moby#40759](https://github.com/moby/moby/pull/40759) +* Add dockerd-rootless-setuptool.sh [moby/moby#40950](https://github.com/moby/moby/pull/40950) +* Support `--exec-opt native.cgroupdriver=systemd` [moby/moby#40486](https://github.com/moby/moby/pull/40486) + +### [Security](#security-2) + +* Fix CVE-2019-14271 loading of nsswitch based config inside chroot under Glibc [moby/moby#39612](https://github.com/moby/moby/pull/39612) +* seccomp: Whitelist `clock_adjtime`. `CAP_SYS_TIME` is still required for time adjustment [moby/moby#40929](https://github.com/moby/moby/pull/40929) +* seccomp: Add openat2 and faccessat2 to default seccomp profile [moby/moby#41353](https://github.com/moby/moby/pull/41353) +* seccomp: allow 'rseq' syscall in default seccomp profile [moby/moby#41158](https://github.com/moby/moby/pull/41158) +* seccomp: allow syscall membarrier [moby/moby#40731](https://github.com/moby/moby/pull/40731) +* seccomp: whitelist io-uring related system calls [moby/moby#39415](https://github.com/moby/moby/pull/39415) +* Add default sysctls to allow ping sockets and privileged ports with no capabilities [moby/moby#41030](https://github.com/moby/moby/pull/41030) +* Fix seccomp profile for clone syscall [moby/moby#39308](https://github.com/moby/moby/pull/39308) + +### [Swarm](#swarm-4) + +* Add support for swarm jobs [moby/moby#40307](https://github.com/moby/moby/pull/40307) +* Add capabilities support to stack/service commands [docker/cli#2687](https://github.com/docker/cli/pull/2687) [docker/cli#2709](https://github.com/docker/cli/pull/2709) [moby/moby#39173](https://github.com/moby/moby/pull/39173) [moby/moby#41249](https://github.com/moby/moby/pull/41249) +* Add support for sending down service Running and Desired task counts [moby/moby#39231](https://github.com/moby/moby/pull/39231) +* service: support `--mount type=bind,bind-nonrecursive` [moby/moby#38788](https://github.com/moby/moby/pull/38788) +* Support ulimits on Swarm services. [moby/moby#41284](https://github.com/moby/moby/pull/41284) [docker/cli#2712](https://github.com/docker/cli/pull/2712) +* Fixed an issue where service logs could leak goroutines on the worker [moby/moby#40426](https://github.com/moby/moby/pull/40426) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.1.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.1.md new file mode 100644 index 0000000000000000000000000000000000000000..302184657696274022e7c0eb0edb98ce5418db5e --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.1.md @@ -0,0 +1,16 @@ +# Docker Engine 20.10.1 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.1](#20101) + +2020-12-14 + +### [Builder](#builder-4) + +* buildkit: updated to [v0.8.1](https://github.com/moby/buildkit/releases/tag/v0.8.1) with various bugfixes [moby/moby#41793](https://github.com/moby/moby/pull/41793) + +### [Packaging](#packaging-8) + +* Revert a change in the systemd unit that could prevent docker from starting due to a startup order conflict [docker/docker-ce-packaging#514](https://github.com/docker/docker-ce-packaging/pull/514) +* buildx updated to [v0.5.0](https://github.com/docker/buildx/releases/tag/v0.5.0) [docker/docker-ce-packaging#515](https://github.com/docker/docker-ce-packaging/pull/515) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.10.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.10.md new file mode 100644 index 0000000000000000000000000000000000000000..5a5b0e2efd7cb73b4b0c5caea20a83b29eb2bb98 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.10.md @@ -0,0 +1,35 @@ +# Docker Engine 20.10.10 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.10](#201010) + +2021-10-25 + +> Important +> +> Due to [net/http changes](https://github.com/golang/go/issues/40909) in [Go 1.16](https://golang.org/doc/go1.16#net/http), HTTP proxies configured through the `$HTTP_PROXY` environment variable are no longer used for TLS (`https://`) connections. Make sure you also set an `$HTTPS_PROXY` environment variable for handling requests to `https://` URLs. Refer to the +> [HTTP/HTTPS proxy section](https://docs.docker.com/engine/daemon/proxy/) to learn how to configure the Docker Daemon to use a proxy server. + +### [Builder](#builder) + +* Fix platform-matching logic to fix `docker build` using not finding images in + the local image cache on Arm machines when using BuildKit [moby/moby#42954](https://github.com/moby/moby/pull/42954) + +### [Runtime](#runtime) + +* Add support for `clone3` syscall in the default seccomp policy to support running + containers based on recent versions of Fedora and Ubuntu. [moby/moby/#42836](https://github.com/moby/moby/pull/42836). +* Windows: update hcsshim library to fix a bug in sparse file handling in container + layers, which was exposed by recent changes in Windows [moby/moby#42944](https://github.com/moby/moby/pull/42944). +* Fix some situations where `docker stop` could hang forever [moby/moby#42956](https://github.com/moby/moby/pull/42956). + +### [Swarm](#swarm) + +* Fix an issue where updating a service did not roll back on failure [moby/moby#42875](https://github.com/moby/moby/pull/42875). + +### [Packaging](#packaging-2) + +* Add packages for Ubuntu 21.10 "Impish Indri" and Fedora 35. +* Update `docker scan` to v0.9.0 +* Update Golang runtime to Go 1.16.9. diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.11.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.11.md new file mode 100644 index 0000000000000000000000000000000000000000..4583091f54b937f267a7c5d4a98da3231132e743 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.11.md @@ -0,0 +1,26 @@ +# Docker Engine 20.10.11 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.11](#201011) + +2021-11-17 + +> Important +> +> Due to [net/http changes](https://github.com/golang/go/issues/40909) in [Go 1.16](https://golang.org/doc/go1.16#net/http), HTTP proxies configured through the `$HTTP_PROXY` environment variable are no longer used for TLS (`https://`) connections. Make sure you also set an `$HTTPS_PROXY` environment variable for handling requests to `https://` URLs. Refer to +> [Configure the daemon to use a proxy](https://docs.docker.com/engine/daemon/proxy/) to learn how to configure the Docker Daemon to use a proxy server. + +### [Distribution](#distribution) + +* Handle ambiguous OCI manifest parsing to mitigate [CVE-2021-41190](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41190) / [GHSA-mc8v-mgrf-8f4m](https://github.com/opencontainers/distribution-spec/security/advisories/GHSA-mc8v-mgrf-8f4m). + See [GHSA-xmmx-7jpf-fx42](https://github.com/moby/moby/security/advisories/GHSA-xmmx-7jpf-fx42) for details. + +### [Windows](#windows) + +* Fix panic.log file having read-only attribute set [moby/moby#42987](https://github.com/moby/moby/pull/42987). + +### [Packaging](#packaging-1) + +* Update containerd to [v1.4.12](https://github.com/containerd/containerd/releases/tag/v1.4.12) to mitigate [CVE-2021-41190](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41190). +* Update Golang runtime to Go 1.16.10. diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.12.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.12.md new file mode 100644 index 0000000000000000000000000000000000000000..5adeea0867b835936102856be63d8432165b5929 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.12.md @@ -0,0 +1,54 @@ +# Docker Engine 20.10.12 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.12](#201012) + +2021-12-13 + +This release of Docker Engine contains changes in packaging only, and provides +updates to the `docker scan` and `docker buildx` commands. Versions of `docker scan` +before v0.11.0 are not able to detect the [Log4j 2 CVE-2021-44228](https://nvd.nist.gov/vuln/detail/CVE-2021-44228). +We are shipping an updated version of `docker scan` in this release to help you +scan your images for this vulnerability. + +> Note +> +> The `docker scan` command on Linux is currently only supported on x86 platforms. +> We do not yet provide a package for other hardware architectures on Linux. + +The `docker scan` feature is provided as a separate package and, depending on your +upgrade or installation method, 'docker scan' may not be updated automatically to +the latest version. Use the instructions below to update `docker scan` to the latest +version. You can also use these instructions to install, or upgrade the `docker scan` +package without upgrading the Docker Engine: + +On `.deb` based distributions, such as Ubuntu and Debian: + +``` +$ apt-get update && apt-get install docker-scan-plugin +``` + +On rpm-based distributions, such as CentOS or Fedora: + +``` +$ yum install docker-scan-plugin +``` + +After upgrading, verify you have the latest version of `docker scan` installed: + +``` +$ docker scan --accept-license --version +Version: v0.12.0 +Git commit: 1074dd0 +Provider: Snyk (1.790.0 (standalone)) +``` + +[Read our blog post on CVE-2021-44228](https://www.docker.com/blog/apache-log4j-2-cve-2021-44228/) +to learn how to use the `docker scan` command to check if images are vulnerable. + +### [Packaging](#packaging) + +* Update `docker scan` to [v0.12.0](https://github.com/docker/scan-cli-plugin/releases/tag/v0.12.0). +* Update `docker buildx` to [v0.7.1](https://github.com/docker/buildx/releases/tag/v0.7.1). +* Update Golang runtime to Go 1.16.12. diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.13.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.13.md new file mode 100644 index 0000000000000000000000000000000000000000..d10424d09c0bb6a1d5f251b12154ac5846020359 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.13.md @@ -0,0 +1,48 @@ +# Docker Engine 20.10.13 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.13](#201013) + +*2022-03-10* + +This release of Docker Engine contains some bug-fixes and packaging changes, +updates to the `docker scan` and `docker buildx` commands, an updated version of +the Go runtime, and new versions of the `containerd.io` runtime. +Together with this release, we now also provide `.deb` and `.rpm` packages of +Docker Compose V2, which can be installed using the (optional) `docker-compose-plugin` +package. + +### [New](#new-1) + +* Provide `.deb` and `.rpm` packages for Docker Compose V2. [Docker Compose v2.3.3](https://github.com/docker/compose/releases/tag/v2.3.3) + can now be installed on Linux using the `docker-compose-plugin` packages, which + provides the `docker compose` subcommand on the Docker CLI. The Docker Compose + plugin can also be installed and run standalone to be used as a drop-in replacement + for `docker-compose` (Docker Compose V1) [docker/docker-ce-packaging#638](https://github.com/docker/docker-ce-packaging/pull/638). + The `compose-cli-plugin` package can also be used on older version of the Docker + CLI with support for CLI plugins (Docker CLI 18.09 and up). +* Provide packages for the upcoming Ubuntu 22.04 "Jammy Jellyfish" LTS release [docker/docker-ce-packaging#645](https://github.com/docker/docker-ce-packaging/pull/645), [docker/containerd-packaging#271](https://github.com/docker/containerd-packaging/pull/271). + +### [Updates](#updates-11) + +* Updated the bundled version of buildx to [v0.8.0](https://github.com/docker/buildx/releases/tag/v0.8.0). +* Update `docker buildx` to [v0.8.0](https://github.com/docker/buildx/releases/tag/v0.8.0). +* Update `docker scan` (`docker-scan-plugin`) to [v0.17.0](https://github.com/docker/scan-cli-plugin/releases/tag/v0.17.0). +* Update containerd (`containerd.io` package) to [v1.5.10](https://github.com/containerd/containerd/releases/tag/v1.5.10). +* Update the bundled runc version to [v1.0.3](https://github.com/opencontainers/runc/releases/tag/v1.0.3). +* Update Golang runtime to Go 1.16.15. +* Updates the fluentd log driver to prevent a potential daemon crash, and prevent + containers from hanging when using the `fluentd-async-connect=true` and the + remote server is unreachable [moby/moby#43147](https://github.com/moby/moby/pull/43147). + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-10) + +* Fix a race condition when updating the container's state [moby/moby#43166](https://github.com/moby/moby/pull/43166). +* Update the etcd dependency to prevent the daemon from incorrectly holding file locks [moby/moby#43259](https://github.com/moby/moby/pull/43259) +* Fix detection of user-namespaces when configuring the default `net.ipv4.ping_group_range` sysctl [moby/moby#43084](https://github.com/moby/moby/pull/43084). +* Retry downloading image-manifests if a connection failure happens during image + pull [moby/moby#43333](https://github.com/moby/moby/pull/43333). +* Various fixes in command-line reference and API documentation. +* Prevent an OOM when using the "local" logging driver with containers that produce + a large amount of log messages [moby/moby#43165](https://github.com/moby/moby/pull/43165). diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.14.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.14.md new file mode 100644 index 0000000000000000000000000000000000000000..bc5ed6e52d095b1f5bb4307e5067b1e3377960ad --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.14.md @@ -0,0 +1,19 @@ +# Docker Engine 20.10.14 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.14](#201014) + +*2022-03-23* + +This release of Docker Engine updates the default inheritable capabilities for +containers to address [CVE-2022-24769](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24769), +a new version of the `containerd.io` runtime is also included to address the same +issue. + +### [Updates](#updates-10) + +* Update the default inheritable capabilities. +* Update the default inheritable capabilities for containers used during build. +* Update containerd (`containerd.io` package) to [v1.5.11](https://github.com/containerd/containerd/releases/tag/v1.5.11). +* Update `docker buildx` to [v0.8.1](https://github.com/docker/buildx/releases/tag/v0.8.1). diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.15.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.15.md new file mode 100644 index 0000000000000000000000000000000000000000..4ee4f3f9d61831be7ebd72479b2be8af6c2f33c0 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.15.md @@ -0,0 +1,30 @@ +# Docker Engine 20.10.15 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.15](#201015) + +*2022-05-05* + +This release of Docker Engine comes with updated versions of the `compose`, +`buildx`, `containerd`, and `runc` components, as well as some minor bug fixes. + +### [Updates](#updates-9) + +* Update Docker Compose to [v2.5.0](https://github.com/docker/compose/releases/tag/v2.5.0). +* Update Docker Buildx to [v0.8.2](https://github.com/docker/buildx/releases/tag/v0.8.2). +* Update Go runtime to [1.17.9](https://go.dev/doc/devel/release#go1.17.minor). +* Update containerd (`containerd.io` package) to [v1.6.4](https://github.com/containerd/containerd/releases/tag/v1.6.4). +* Update runc version to [v1.1.1](https://github.com/opencontainers/runc/releases/tag/v1.1.1). + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-9) + +* Use a RWMutex for stateCounter to prevent potential locking congestion [moby/moby#43426](https://github.com/moby/moby/pull/43426). +* Prevent an issue where the daemon was unable to find an available IP-range in + some conditions [moby/moby#43360](https://github.com/moby/moby/pull/43360) +* Add packages for CentOS 9 stream and Fedora 36. + +### [Known issues](#known-issues) + +* We've identified an issue with the [macOS CLI binaries](https://download.docker.com/mac/static/stable/) + in the 20.10.15 release. This issue has been resolved in the [20.10.16](#201016) release. diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.16.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.16.md new file mode 100644 index 0000000000000000000000000000000000000000..0740b30af4a53f71b7f4ff9fd8860a58d22b06f1 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.16.md @@ -0,0 +1,29 @@ +# Docker Engine 20.10.16 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.16](#201016) + +*2022-05-12* + +This release of Docker Engine fixes a regression in the Docker CLI builds for +macOS, fixes an issue with `docker stats` when using containerd 1.5 and up, +and updates the Go runtime to include a fix for [CVE-2022-29526](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29526). + +### [Updates](#updates-8) + +* Update golang.org/x/sys dependency which contains a fix for + [CVE-2022-29526](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29526). +* Updated the `golang.org/x/sys` build-time dependency which contains a fix for [CVE-2022-29526](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29526). +* Updated Go runtime to [1.17.10](https://go.dev/doc/devel/release#go1.17.minor), + which contains a fix for [CVE-2022-29526](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29526). + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-8) + +* Fixed a regression in binaries for macOS introduced in [20.10.15](#201015), which + resulted in a panic [docker/cli#43426](https://github.com/docker/cli/pull/3592). +* Fixed an issue where `docker stats` was showing empty stats when running with + containerd 1.5.0 or up [moby/moby#43567](https://github.com/moby/moby/pull/43567). +* Used "weak" dependencies for the `docker scan` CLI plugin, to prevent a + "conflicting requests" error when users performed an off-line installation from + downloaded RPM packages [docker/docker-ce-packaging#659](https://github.com/docker/docker-ce-packaging/pull/659). diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.17.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.17.md new file mode 100644 index 0000000000000000000000000000000000000000..ed886bca0e33ff146b98940525ae24c57a29af5c --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.17.md @@ -0,0 +1,29 @@ +# Docker Engine 20.10.17 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.17](#201017) + +*2022-06-06* + +This release of Docker Engine comes with updated versions of Docker Compose and the +`containerd`, and `runc` components, as well as some minor bug fixes. + +### [Updates](#updates-7) + +* Update Docker Compose to [v2.6.0](https://github.com/docker/compose/releases/tag/v2.6.0). +* Update containerd (`containerd.io` package) to [v1.6.6](https://github.com/containerd/containerd/releases/tag/v1.6.6), + which contains a fix for [CVE-2022-31030](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-31030) +* Update runc version to [v1.1.2](https://github.com/opencontainers/runc/releases/tag/v1.1.2), which contains a fix for + [CVE-2022-29162](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29162). +* Update Go runtime to [1.17.11](https://go.dev/doc/devel/release#go1.17.minor), + which contains fixes for [CVE-2022-30634](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-30634), + [CVE-2022-30629](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-30629), + [CVE-2022-30580](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-30580) and + [CVE-2022-29804](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29804) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-7) + +* Remove asterisk from docker commands in zsh completion script [docker/cli#3648](https://github.com/docker/cli/pull/3648). +* Fix Windows port conflict with published ports in host mode for overlay [moby/moby#43644](https://github.com/moby/moby/pull/43644). +* Ensure performance tuning is always applied to libnetwork sandboxes [moby/moby#43683](https://github.com/moby/moby/pull/43683). diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.18.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.18.md new file mode 100644 index 0000000000000000000000000000000000000000..27f51c725cb999a33daf26fddec1721b994fa1bf --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.18.md @@ -0,0 +1,39 @@ +# Docker Engine 20.10.18 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.18](#201018) + +*2022-09-09* + +This release of Docker Engine comes with a fix for a low-severity security issue, +some minor bug fixes, and updated versions of Docker Compose, Docker Buildx, +`containerd`, and `runc`. + +### [Updates](#updates-6) + +* Update Docker Buildx to [v0.9.1](https://github.com/docker/buildx/releases/tag/v0.9.1). +* Update Docker Compose to [v2.10.2](https://github.com/docker/compose/releases/tag/v2.10.2). +* Update containerd (`containerd.io` package) to [v1.6.8](https://github.com/containerd/containerd/releases/tag/v1.6.8). +* Update runc version to [v1.1.4](https://github.com/opencontainers/runc/releases/tag/v1.1.4). +* Update Go runtime to [1.18.6](https://go.dev/doc/devel/release#go1.18.minor), + which contains fixes for [CVE-2022-27664](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-27664) and + [CVE-2022-32190](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-32190). + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-6) + +* Add Bash completion for Docker Compose [docker/cli#3752](https://github.com/docker/cli/pull/3752). +* Fix an issue where file-capabilities were not preserved during build + [moby/moby#43876](https://github.com/moby/moby/pull/43876). +* Fix an issue that could result in a panic caused by a concurrent map read and + map write [moby/moby#44067](https://github.com/moby/moby/pull/44067). +* Fix a security vulnerability relating to supplementary group permissions, which + could allow a container process to bypass primary group restrictions within the + container [CVE-2022-36109](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36109), + [GHSA-rc4r-wh2q-q6c4](https://github.com/moby/moby/security/advisories/GHSA-rc4r-wh2q-q6c4). +* seccomp: add support for Landlock syscalls in default policy [moby/moby#43991](https://github.com/moby/moby/pull/43991). +* seccomp: update default policy to support new syscalls introduced in kernel 5.12 - 5.16 [moby/moby#43991](https://github.com/moby/moby/pull/43991). +* Fix an issue where cache lookup for image manifests would fail, resulting + in a redundant round-trip to the image registry [moby/moby#44109](https://github.com/moby/moby/pull/44109). +* Fix an issue where `exec` processes and healthchecks were not terminated + when they timed out [moby/moby#44018](https://github.com/moby/moby/pull/44018). diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.19.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.19.md new file mode 100644 index 0000000000000000000000000000000000000000..15e1b74ae79babf998e5beaf312b36697ab2e01b --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.19.md @@ -0,0 +1,26 @@ +# Docker Engine 20.10.19 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.19](#201019) + +*2022-10-14* + +This release of Docker Engine comes with some bug-fixes, and an updated version +of Docker Compose. + +### [Updates](#updates-5) + +* Update Docker Compose to [v2.11.2](https://github.com/docker/compose/releases/tag/v2.11.2). +* Update Go runtime to [1.18.7](https://go.dev/doc/devel/release#go1.18.minor), + which contains fixes for [CVE-2022-2879](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-2879), + [CVE-2022-2880](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-2880), + and [CVE-2022-41715](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41715). + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-5) + +* Fix an issue that could result in a panic during `docker builder prune` or + `docker system prune` [moby/moby#44122](https://github.com/moby/moby/pull/44122). +* Fix a bug where using `docker volume prune` would remove volumes that were + still in use if the daemon was running with "live restore" and was restarted + [moby/moby#44238](https://github.com/moby/moby/pull/44238). diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.2.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.2.md new file mode 100644 index 0000000000000000000000000000000000000000..3db23509bb35f0f7edb7b7443efc67d361584f7f --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.2.md @@ -0,0 +1,25 @@ +# Docker Engine 20.10.2 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.2](#20102) + +2021-01-04 + +### [Runtime](#runtime-4) + +* Fix a daemon start up hang when restoring containers with restart policies but that keep failing to start [moby/moby#41729](https://github.com/moby/moby/pull/41729) +* overlay2: fix an off-by-one error preventing to build or run containers when data-root is 24-bytes long [moby/moby#41830](https://github.com/moby/moby/pull/41830) +* systemd: send `sd_notify STOPPING=1` when shutting down [moby/moby#41832](https://github.com/moby/moby/pull/41832) + +### [Networking](#networking-2) + +* Fix IPv6 port forwarding [moby/moby#41805](https://github.com/moby/moby/pull/41805) [moby/libnetwork#2604](https://github.com/moby/libnetwork/pull/2604) + +### [Swarm](#swarm-3) + +* Fix filtering for `replicated-job` and `global-job` service modes [moby/moby#41806](https://github.com/moby/moby/pull/41806) + +### [Packaging](#packaging-7) + +* buildx updated to [v0.5.1](https://github.com/docker/buildx/releases/tag/v0.5.1) [docker/docker-ce-packaging#516](https://github.com/docker/docker-ce-packaging/pull/516) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.20.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.20.md new file mode 100644 index 0000000000000000000000000000000000000000..94a0805cbb2c5bf4fd398af956efb53288455e48 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.20.md @@ -0,0 +1,43 @@ +# Docker Engine 20.10.20 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.20](#201020) + +*2022-10-18* + +This release of Docker Engine contains partial mitigations for a Git vulnerability +([CVE-2022-39253](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-39253)), +and has updated handling of `image:tag@digest` image references. + +The Git vulnerability allows a maliciously crafted Git repository, when used as a +build context, to copy arbitrary filesystem paths into resulting containers/images; +this can occur in both the daemon, and in API clients, depending on the versions and +tools in use. + +The mitigations available in this release and in other consumers of the daemon API +are partial and only protect users who build a Git URL context (e.g. `git+protocol://`). +As the vulnerability could still be exploited by manually run Git commands that interact +with and check out submodules, users should immediately upgrade to a patched version of +Git to protect against this vulnerability. Further details are available from the GitHub +blog (["Git security vulnerabilities announced"](https://github.blog/2022-10-18-git-security-vulnerabilities-announced/)). + +### [Updates](#updates-4) + +* Update Docker Compose to [v2.12.0](https://github.com/docker/compose/releases/tag/v2.12.0). +* Updated handling of `image:tag@digest` references. When pulling an image using + the `image:tag@digest` ("pull by digest"), image resolution happens through + the content-addressable digest and the `image` and `tag` are not used. While + this is expected, this could lead to confusing behavior, and could potentially + be exploited through social engineering to run an image that is already present + in the local image store. Docker now checks if the digest matches the repository + name used to pull the image, and otherwise will produce an error. +* Updated handling of `image:tag@digest` references. Refer to the "Daemon" section + above for details. + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-4) + +* Added a mitigation for [CVE-2022-39253](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-39253), + when using the classic Builder with a Git URL as the build context. +* Added a mitigation to the classic Builder and updated BuildKit to [v0.8.3-31-gc0149372](https://github.com/moby/buildkit/commit/c014937225cba29cfb1d5161fd134316c0e9bdaa), + for [CVE-2022-39253](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-39253). diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.21.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.21.md new file mode 100644 index 0000000000000000000000000000000000000000..55dd3cafe8a9f0811a03312ecf4e5771beaed5a6 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.21.md @@ -0,0 +1,29 @@ +# Docker Engine 20.10.21 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.21](#201021) + +*2022-10-25* + +This release of Docker Engine contains updated versions of Docker Compose, +Docker Scan, containerd, added packages for Ubuntu 22.10, and some minor bug +fixes and enhancements. + +### [New](#new) + +* Provide packages for Ubuntu 22.10 (Kinetic Kudu). +* Add support for `allow-nondistributable-artifacts` towards Docker Hub [moby/moby#44313](https://github.com/moby/moby/pull/44313). + +### [Updates](#updates-3) + +* Update Docker Compose to [v2.12.2](https://github.com/docker/compose/releases/tag/v2.12.2). +* Update Docker Scan to [v0.21.0](https://github.com/docker/scan-cli-plugin/releases/tag/v0.21.0). +* Update containerd (`containerd.io` package) to [v1.6.9](https://github.com/containerd/containerd/releases/tag/v1.6.9). +* Update bundled BuildKit version to fix `output clipped, log limit 1MiB reached` errors [moby/moby#44339](https://github.com/moby/moby/pull/44339). + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-3) + +* Remove experimental gate for `--platform` in bash completion [docker/cli#3824](https://github.com/docker/cli/pull/3824). +* Fix an `Invalid standard handle identifier` panic when registering the Docker Engine as a service from a legacy CLI on Windows [moby/moby#44326](https://github.com/moby/moby/pull/44326). +* Fix running Git commands in Cygwin on Windows [moby/moby#44332](https://github.com/moby/moby/pull/44332). diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.22.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.22.md new file mode 100644 index 0000000000000000000000000000000000000000..9fa5f06f71cb56833b8dfaf0000a9979e1499567 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.22.md @@ -0,0 +1,31 @@ +# Docker Engine 20.10.22 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.22](#201022) + +*2022-12-16* + +This release of Docker Engine contains updated versions of Docker Compose, +Docker Scan, containerd, and some minor bug fixes and enhancements. + +### [Updates](#updates-2) + +* Update Docker Compose to [v2.14.1](https://github.com/docker/compose/releases/tag/v2.14.1). +* Update Docker Scan to [v0.23.0](https://github.com/docker/scan-cli-plugin/releases/tag/v0.23.0). +* Update containerd (`containerd.io` package) to [v1.6.13](https://github.com/containerd/containerd/releases/tag/v1.6.13), + to include a fix for [CVE-2022-23471](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23471). +* Update Go runtime to [1.18.9](https://go.dev/doc/devel/release#go1.18.minor), + to include fixes for + [CVE-2022-41716](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41716), + [CVE-2022-41717](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41717), and + [CVE-2022-41720](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41720). + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-2) + +* Improve error message when attempting to pull an unsupported image format or OCI artifact + [moby/moby#44413](https://github.com/moby/moby/pull/44413), + [moby/moby#44569](https://github.com/moby/moby/pull/44569). +* Fix an issue where the host's ephemeral port-range was ignored when selecting random ports for containers [moby/moby#44476](https://github.com/moby/moby/pull/44476). +* Fix `ssh: parse error in message type 27` errors during `docker build` on hosts using OpenSSH 8.9 or above [moby/moby#3862](https://github.com/moby/moby/pull/3862). +* seccomp: block socket calls to `AF_VSOCK` in default profile [moby/moby#44564](https://github.com/moby/moby/pull/44564). diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.23.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.23.md new file mode 100644 index 0000000000000000000000000000000000000000..a7caab57a82b358d82b049916d49b075d697d714 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.23.md @@ -0,0 +1,37 @@ +# Docker Engine 20.10.23 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.23](#201023) + +*2023-01-19* + +This release of Docker Engine contains updated versions of Docker Compose, +Docker Buildx, containerd, and some minor bug fixes and enhancements. + +### [Updates](#updates-1) + +* Update Docker Compose to [v2.15.1](https://github.com/docker/compose/releases/tag/v2.15.1). +* Update Docker Buildx to [v0.10.0](https://github.com/docker/buildx/releases/tag/v0.10.0). +* Update containerd (`containerd.io` package) to [v1.6.15](https://github.com/containerd/containerd/releases/tag/v1.6.15). +* Update the package versioning format for `docker-compose-cli` to allow distribution version updates [docker/docker-ce-packaging#822](https://github.com/docker/docker-ce-packaging/pull/822). +* Update Go runtime to [1.18.10](https://go.dev/doc/devel/release#go1.18.minor), + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-1) + +* Fix an issue where `docker build` would fail when using `--add-host=host.docker.internal:host-gateway` + with BuildKit enabled [moby/moby#44650](https://github.com/moby/moby/pull/44650). +* Revert seccomp: block socket calls to `AF_VSOCK` in default profile [moby/moby#44712](https://github.com/moby/moby/pull/44712). + + This change, while favorable from a security standpoint, caused a change + in behavior for some use-cases. As such, we are reverting it to ensure + stability and compatibility for the affected users. + + However, users of `AF_VSOCK` in containers should recognize that this + (special) address family is not currently namespaced in any version of + the Linux kernel, and may result in unexpected behavior, like containers + communicating directly with host hypervisors. + + Future releases, will filter `AF_VSOCK`. Users who need to allow containers + to communicate over the unnamespaced `AF_VSOCK` will need to turn off seccomp + confinement or set a custom seccomp profile. diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.24.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.24.md new file mode 100644 index 0000000000000000000000000000000000000000..a25992579a9f37e20474586a8c8533dab3451f56 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.24.md @@ -0,0 +1,31 @@ +# Docker Engine 20.10.24 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.24](#201024) + +*2023-04-04* + +### [Updates](#updates) + +* Update Go runtime to [1.19.7](https://go.dev/doc/devel/release#go1.19.minor). +* Update Docker Buildx to [v0.10.4](https://github.com/docker/buildx/releases/tag/v0.10.4). +* Update containerd to [v1.6.20](https://github.com/containerd/containerd/releases/tag/v1.6.20). +* Update runc to [v1.1.5](https://github.com/opencontainers/runc/releases/tag/v1.1.5). + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements) + +* Fixed a number of issues that can cause Swarm encrypted overlay networks + to fail to uphold their guarantees, addressing [CVE-2023-28841](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-28841), + [CVE-2023-28840](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-28840), and + [CVE-2023-28842](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-28842). + + A lack of kernel support for encrypted overlay networks now reports + as an error. + + Encrypted overlay networks are eagerly set up, rather than waiting for + multiple nodes to attach. + + Encrypted overlay networks are now usable on Red Hat Enterprise Linux 9 + through the use of the `xt_bpf` kernel module. + + Users of Swarm overlay networks should review [GHSA-vwm3-crmr-xfxw](https://github.com/moby/moby/security/advisories/GHSA-vwm3-crmr-xfxw) + to ensure that unintentional exposure has not occurred. +* Upgrade github.com/containerd/fifo to v1.1.0 to fix a potential panic [moby/moby#45216](https://github.com/moby/moby/pull/45242). +* Fix missing Bash completion for installed cli-plugins [docker/cli#4091](https://github.com/docker/cli/pull/4091). diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.3.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.3.md new file mode 100644 index 0000000000000000000000000000000000000000..08634e3f8df0066ec3bc31a8c3ff594beeeda96f --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.3.md @@ -0,0 +1,18 @@ +# Docker Engine 20.10.3 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.3](#20103) + +2021-02-01 + +### [Security](#security-1) + +* [CVE-2021-21285](https://github.com/moby/moby/security/advisories/GHSA-6fj5-m822-rqx8) Prevent an invalid image from crashing docker daemon +* [CVE-2021-21284](https://github.com/moby/moby/security/advisories/GHSA-7452-xqpj-6rpc) Lock down file permissions to prevent remapped root from accessing docker state +* Ensure AppArmor and SELinux profiles are applied when building with BuildKit + +### [Client](#client-6) + +* Check contexts before importing them to reduce risk of extracted files escaping context store +* Windows: prevent executing certain binaries from current directory [docker/cli#2950](https://github.com/docker/cli/pull/2950) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.4.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.4.md new file mode 100644 index 0000000000000000000000000000000000000000..41b5108ede6c52e3b05bc803bc4875638ff5bac6 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.4.md @@ -0,0 +1,60 @@ +# Docker Engine 20.10.4 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.4](#20104) + +2021-02-26 + +### [Builder](#builder-3) + +* Fix incorrect cache match for inline cache import with empty layers [moby/moby#42061](https://github.com/moby/moby/pull/42061) +* Update BuildKit to v0.8.2 [moby/moby#42061](https://github.com/moby/moby/pull/42061) + + resolver: avoid error caching on token fetch + + fileop: fix checksum to contain indexes of inputs preventing certain cache misses + + Fix reference count issues on typed errors with mount references (fixing `invalid mutable ref` errors) + + git: set token only for main remote access allowing cloning submodules with different credentials +* Ensure blobs get deleted in /var/lib/docker/buildkit/content/blobs/sha256 after pull. To clean up old state run `builder prune` [moby/moby#42065](https://github.com/moby/moby/pull/42065) +* Fix parallel pull synchronization regression [moby/moby#42049](https://github.com/moby/moby/pull/42049) +* Ensure libnetwork state files do not leak [moby/moby#41972](https://github.com/moby/moby/pull/41972) + +### [Client](#client-5) + +* Fix a panic on `docker login` if no config file is present [docker/cli#2959](https://github.com/docker/cli/pull/2959) +* Fix `WARNING: Error loading config file: .dockercfg: $HOME is not defined` [docker/cli#2958](https://github.com/docker/cli/pull/2958) + +### [Runtime](#runtime-3) + +* docker info: silence unhandleable warnings [moby/moby#41958](https://github.com/moby/moby/pull/41958) +* Avoid creating parent directories for XGlobalHeader [moby/moby#42017](https://github.com/moby/moby/pull/42017) +* Use 0755 permissions when creating missing directories [moby/moby#42017](https://github.com/moby/moby/pull/42017) +* Fallback to manifest list when no platform matches in image config [moby/moby#42045](https://github.com/moby/moby/pull/42045) [moby/moby#41873](https://github.com/moby/moby/pull/41873) +* Fix a daemon panic on setups with a custom default runtime configured [moby/moby#41974](https://github.com/moby/moby/pull/41974) +* Fix a panic when daemon configuration is empty [moby/moby#41976](https://github.com/moby/moby/pull/41976) +* Fix daemon panic when starting container with invalid device cgroup rule [moby/moby#42001](https://github.com/moby/moby/pull/42001) +* Fix userns-remap option when username & UID match [moby/moby#42013](https://github.com/moby/moby/pull/42013) +* static: update runc binary to v1.0.0-rc93 [moby/moby#42014](https://github.com/moby/moby/pull/42014) + +### [Logger](#logger) + +* Honor `labels-regex` config even if `labels` is not set [moby/moby#42046](https://github.com/moby/moby/pull/42046) +* Handle long log messages correctly preventing awslogs in non-blocking mode to split events bigger than 16kB [mobymoby#41975](https://github.com/moby/moby/pull/41975) + +### [Rootless](#rootless-3) + +* Prevent the service hanging when stopping by setting systemd KillMode to mixed [moby/moby#41956](https://github.com/moby/moby/pull/41956) +* dockerd-rootless.sh: add typo guard [moby/moby#42070](https://github.com/moby/moby/pull/42070) +* Update rootlesskit to v0.13.1 to fix handling of IPv6 addresses [moby/moby#42025](https://github.com/moby/moby/pull/42025) +* allow mknodding FIFO inside userns [moby/moby#41957](https://github.com/moby/moby/pull/41957) + +### [Security](#security) + +* profiles: seccomp: update to Linux 5.11 syscall list [moby/moby#41971](https://github.com/moby/moby/pull/41971) + +### [Swarm](#swarm-2) + +* Fix issue with heartbeat not persisting upon restart [moby/moby#42060](https://github.com/moby/moby/pull/42060) +* Fix potential stalled tasks [moby/moby#42060](https://github.com/moby/moby/pull/42060) +* Fix `--update-order` and `--rollback-order` flags when only `--update-order` or `--rollback-order` is provided [docker/cli#2963](https://github.com/docker/cli/pull/2963) +* Fix `docker service rollback` returning a non-zero exit code in some situations [docker/cli#2964](https://github.com/docker/cli/pull/2964) +* Fix inconsistent progress-bar direction on `docker service rollback` [docker/cli#2964](https://github.com/docker/cli/pull/2964) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.5.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.5.md new file mode 100644 index 0000000000000000000000000000000000000000..3d750bfeab2c1a6b1a0be0483d8720b8c649e8fe --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.5.md @@ -0,0 +1,11 @@ +# Docker Engine 20.10.5 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.5](#20105) + +2021-03-02 + +### [Client](#client-4) + +* Revert [docker/cli#2960](https://github.com/docker/cli/pull/2960) to fix hanging in `docker start --attach` and remove spurious `Unsupported signal: . Discarding` messages. [docker/cli#2987](https://github.com/docker/cli/pull/2987). diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.6.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.6.md new file mode 100644 index 0000000000000000000000000000000000000000..00412138d0933de73e976b1fec8f9fefd30b88ab --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.6.md @@ -0,0 +1,49 @@ +# Docker Engine 20.10.6 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.6](#20106) + +2021-04-12 + +### [Client](#client-3) + +* Apple Silicon (darwin/arm64) support for Docker CLI [docker/cli#3042](https://github.com/docker/cli/pull/3042) +* config: print deprecation warning when falling back to pre-v1.7.0 config file `~/.dockercfg`. Support for this file will be removed in a future release [docker/cli#3000](https://github.com/docker/cli/pull/3000) + +### [Builder](#builder-2) + +* Fix classic builder silently ignoring unsupported Dockerfile options and prompt to enable BuildKit instead [moby/moby#42197](https://github.com/moby/moby/pull/42197) + +### [Logging](#logging-1) + +* json-file: fix sporadic unexpected EOF errors [moby/moby#42174](https://github.com/moby/moby/pull/42174) + +### [Networking](#networking-1) + +* Fix a regression in docker 20.10, causing IPv6 addresses no longer to be bound by default when mapping ports [moby/moby#42205](https://github.com/moby/moby/pull/42205) +* Fix implicit IPv6 port-mappings not included in API response. Before docker 20.10, published ports were accessible through both IPv4 and IPv6 by default, but the API only included information about the IPv4 (0.0.0.0) mapping [moby/moby#42205](https://github.com/moby/moby/pull/42205) +* Fix a regression in docker 20.10, causing the docker-proxy to not be terminated in all cases [moby/moby#42205](https://github.com/moby/moby/pull/42205) +* Fix iptables forwarding rules not being cleaned up upon container removal [moby/moby#42205](https://github.com/moby/moby/pull/42205) + +### [Packaging](#packaging-6) + +* Update containerd to [v1.4.4](https://github.com/containerd/containerd/releases/tag/v1.4.4) for static binaries. The containerd.io package on apt/yum repos already had this update out of band. Includes a fix for [CVE-2021-21334](https://github.com/containerd/containerd/security/advisories/GHSA-6g2q-w5j3-fwh4). [moby/moby#42124](https://github.com/moby/moby/pull/42124) +* Packages for Debian/Raspbian 11 Bullseye, Ubuntu 21.04 Hirsute Hippo and Fedora 34 [docker/docker-ce-packaging#521](https://github.com/docker/docker-ce-packaging/pull/521) [docker/docker-ce-packaging#522](https://github.com/docker/docker-ce-packaging/pull/522) [docker/docker-ce-packaging#533](https://github.com/docker/docker-ce-packaging/pull/533) +* Provide the [Docker Scan CLI](https://github.com/docker/scan-cli-plugin) plugin on Linux amd64 via a `docker-scan-plugin` package as a recommended dependency for the `docker-ce-cli` package [docker/docker-ce-packaging#537](https://github.com/docker/docker-ce-packaging/pull/537) +* Include VPNKit binary for arm64 [moby/moby#42141](https://github.com/moby/moby/pull/42141) + +### [Plugins](#plugins) + +* Fix docker plugin create making plugins that were incompatible with older versions of Docker [moby/moby#42256](https://github.com/moby/moby/pull/42256) + +### [Rootless](#rootless-2) + +* Update RootlessKit to [v0.14.1](https://github.com/rootless-containers/rootlesskit/releases/tag/v0.14.1) (see also [v0.14.0](https://github.com/rootless-containers/rootlesskit/releases/tag/v0.14.0) [v0.13.2](https://github.com/rootless-containers/rootlesskit/releases/tag/v0.13.2)) [moby/moby#42186](https://github.com/moby/moby/pull/42186) [moby/moby#42232](https://github.com/moby/moby/pull/42232) +* dockerd-rootless-setuptool.sh: create CLI context "rootless" [moby/moby#42109](https://github.com/moby/moby/pull/42109) +* dockerd-rootless.sh: prohibit running as root [moby/moby#42072](https://github.com/moby/moby/pull/42072) +* Fix "operation not permitted" when bind mounting existing mounts [moby/moby#42233](https://github.com/moby/moby/pull/42233) +* overlay2: fix "createDirWithOverlayOpaque(...) ... input/output error" [moby/moby#42235](https://github.com/moby/moby/pull/42235) +* overlay2: support "userxattr" option (kernel 5.11) [moby/moby#42168](https://github.com/moby/moby/pull/42168) +* btrfs: allow unprivileged user to delete subvolumes (kernel >= 4.18) [moby/moby#42253](https://github.com/moby/moby/pull/42253) +* cgroup2: Move cgroup v2 out of experimental [moby/moby#42263](https://github.com/moby/moby/pull/42263) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.7.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.7.md new file mode 100644 index 0000000000000000000000000000000000000000..397e327d3eeedab035271a282e7b6626014ec1b2 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.7.md @@ -0,0 +1,60 @@ +# Docker Engine 20.10.7 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.7](#20107) + +2021-06-02 + +### [Client](#client-2) + +* Suppress warnings for deprecated cgroups [docker/cli#3099](https://github.com/docker/cli/pull/3099). +* Prevent sending `SIGURG` signals to container on Linux and macOS. The Go runtime + (starting with Go 1.14) uses `SIGURG` signals internally as an interrupt to + support preemptable syscalls. In situations where the Docker CLI was attached + to a container, these interrupts were forwarded to the container. This fix + changes the Docker CLI to ignore `SIGURG` signals [docker/cli#3107](https://github.com/docker/cli/pull/3107), + [moby/moby#42421](https://github.com/moby/moby/pull/42421). + +### [Builder](#builder-1) + +* Update BuildKit to version v0.8.3-3-g244e8cde [moby/moby#42448](https://github.com/moby/moby/pull/42448): + + Transform relative mountpoints for exec mounts in the executor to work around + a breaking change in runc v1.0.0-rc94 and up. [moby/buildkit#2137](https://github.com/moby/buildkit/pull/2137). + + Add retry on image push 5xx errors. [moby/buildkit#2043](https://github.com/moby/buildkit/pull/2043). + + Fix build-cache not being invalidated when renaming a file that is copied using + a `COPY` command with a wildcard. Note that this change invalidates + existing build caches for copy commands that use a wildcard. [moby/buildkit#2018](https://github.com/moby/buildkit/pull/2018). + + Fix build-cache not being invalidated when using mounts [moby/buildkit#2076](https://github.com/moby/buildkit/pull/2076). +* Fix build failures when `FROM` image is not cached when using legacy schema 1 images [moby/moby#42382](https://github.com/moby/moby/pull/42382). + +### [Logging](#logging) + +* Update the hcsshim SDK to make daemon logs on Windows less verbose [moby/moby#42292](https://github.com/moby/moby/pull/42292). + +### [Rootless](#rootless-1) + +* Fix capabilities not being honored when an image was built on a daemon with + user-namespaces enabled [moby/moby#42352](https://github.com/moby/moby/pull/42352). + +### [Networking](#networking) + +* Update libnetwork to fix publishing ports on environments with kernel boot + parameter `ipv6.disable=1`, and to fix a deadlock causing internal DNS lookups + to fail [moby/moby#42413](https://github.com/moby/moby/pull/42413). + +### [Contrib](#contrib) + +* Update rootlesskit to v0.14.2 to fix a timeout when starting the userland proxy + with the `slirp4netns` port driver [moby/moby#42294](https://github.com/moby/moby/pull/42294). +* Fix "Device or resource busy" errors when running docker-in-docker on a rootless + daemon [moby/moby#42342](https://github.com/moby/moby/pull/42342). + +### [Packaging](#packaging-5) + +* Update containerd to v1.4.6, runc v1.0.0-rc95 to address [CVE-2021-30465](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-30465) + [moby/moby#42398](https://github.com/moby/moby/pull/42398), [moby/moby#42395](https://github.com/moby/moby/pull/42395), + [docker/containerd-packaging#234](https://github.com/docker/containerd-packaging/pull/234) +* Update containerd to v1.4.5, runc v1.0.0-rc94 [moby/moby#42372](https://github.com/moby/moby/pull/42372), + [moby/moby#42388](https://github.com/moby/moby/pull/42388), [docker/containerd-packaging#232](https://github.com/docker/containerd-packaging/pull/232). +* Update Docker Scan plugin packages (`docker-scan-plugin`) to v0.8 [docker/docker-ce-packaging#545](https://github.com/docker/docker-ce-packaging/pull/545). diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.8.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.8.md new file mode 100644 index 0000000000000000000000000000000000000000..1d4212d04ed607bce5400a5f5206d35a8e8d112c --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.8.md @@ -0,0 +1,64 @@ +# Docker Engine 20.10.8 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.8](#20108) + +2021-08-03 + +> Important +> +> Due to [net/http changes](https://github.com/golang/go/issues/40909) in [Go 1.16](https://golang.org/doc/go1.16#net/http), HTTP proxies configured through the `$HTTP_PROXY` environment variable are no longer used for TLS (`https://`) connections. Make sure you also set an `$HTTPS_PROXY` environment variable for handling requests to `https://` URLs. Refer to the +> [HTTP/HTTPS proxy section](https://docs.docker.com/engine/daemon/proxy/) to learn how to configure the Docker Daemon to use a proxy server. + +### [Deprecation](#deprecation) + +* Deprecate support for encrypted TLS private keys. Legacy PEM encryption as + specified in RFC 1423 is insecure by design. Because it does not authenticate + the ciphertext, it is vulnerable to padding oracle attacks that can let an + attacker recover the plaintext. Support for encrypted TLS private keys is now + marked as deprecated, and will be removed in an upcoming release. [docker/cli#3219](https://github.com/docker/cli/pull/3219) +* Deprecate Kubernetes stack support. Following the deprecation of [Compose on Kubernetes](https://github.com/docker/compose-on-kubernetes), + support for Kubernetes in the `stack` and `context` commands in the Docker CLI + is now marked as deprecated, and will be removed in an upcoming release [docker/cli#3174](https://github.com/docker/cli/pull/3174). + +### [Client](#client-1) + +* Fix `Invalid standard handle identifier` errors on Windows [docker/cli#3132](https://github.com/docker/cli/pull/3132). + +### [Rootless](#rootless) + +* Avoid `can't open lock file /run/xtables.lock: Permission denied` error on + SELinux hosts [moby/moby#42462](https://github.com/moby/moby/pull/42462). +* Disable overlay2 when running with SELinux to prevent permission denied errors [moby/moby#42462](https://github.com/moby/moby/pull/42462). +* Fix `x509: certificate signed by unknown authority` error on openSUSE Tumbleweed [moby/moby#42462](https://github.com/moby/moby/pull/42462). + +### [Runtime](#runtime-2) + +* Print a warning when using the `--platform` option to pull a single-arch image + that does not match the specified architecture [moby/moby#42633](https://github.com/moby/moby/pull/42633). +* Fix incorrect `Your kernel does not support swap memory limit` warning when + running with cgroups v2 [moby/moby#42479](https://github.com/moby/moby/pull/42479). +* Windows: Fix a situation where containers were not stopped if `HcsShutdownComputeSystem` + returned an `ERROR_PROC_NOT_FOUND` error [moby/moby#42613](https://github.com/moby/moby/pull/42613) + +### [Swarm](#swarm-1) + +* Fix a possibility where overlapping IP addresses could exist as a result of the + node failing to clean up its old loadbalancer IPs [moby/moby#42538](https://github.com/moby/moby/pull/42538) +* Fix a deadlock in log broker ("dispatcher is stopped") [moby/moby#42537](https://github.com/moby/moby/pull/42537) + +### [Packaging](#packaging-4) + +> **Known issue** +> +> The `ctr` binary shipping with the static packages of this release is not +> statically linked, and will not run in Docker images using alpine as a base +> image. Users can install the `libc6-compat` package, or download a previous +> version of the `ctr` binary as a workaround. Refer to the containerd ticket +> related to this issue for more details: [containerd/containerd#5824](https://github.com/containerd/containerd/issues/5824). + +* Remove packaging for Ubuntu 16.04 "Xenial" and Fedora 32, as they reached EOL [docker/docker-ce-packaging#560](https://github.com/docker/docker-ce-packaging/pull/560) +* Update Golang runtime to Go 1.16.6 +* Update the bundled buildx version to v0.6.1 for rpm and deb packages [docker/docker-ce-packaging#562](https://github.com/docker/docker-ce-packaging/pull/562) +* Update static binaries and containerd.io rpm and deb packages to containerd v1.4.9 and runc v1.0.1: [docker/containerd-packaging#241](https://github.com/docker/containerd-packaging/pull/241), [docker/containerd-packaging#245](https://github.com/docker/containerd-packaging/pull/245), [docker/containerd-packaging#247](https://github.com/docker/containerd-packaging/pull/247). diff --git a/corpus/changelog/docker_engine_releases/docker_engine_20.10.9.md b/corpus/changelog/docker_engine_releases/docker_engine_20.10.9.md new file mode 100644 index 0000000000000000000000000000000000000000..c425fd231dc02ff7080e2510a5a408d22bb5cf07 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_20.10.9.md @@ -0,0 +1,46 @@ +# Docker Engine 20.10.9 release notes + +Source: https://docs.docker.com/engine/release-notes/20.10/ + +## [20.10.9](#20109) + +2021-10-04 + +This release is a security release with security fixes in the CLI, runtime, as +well as updated versions of the containerd.io package. + +> Important +> +> Due to [net/http changes](https://github.com/golang/go/issues/40909) in [Go 1.16](https://golang.org/doc/go1.16#net/http), HTTP proxies configured through the `$HTTP_PROXY` environment variable are no longer used for TLS (`https://`) connections. Make sure you also set an `$HTTPS_PROXY` environment variable for handling requests to `https://` URLs. Refer to the +> [HTTP/HTTPS proxy section](https://docs.docker.com/engine/daemon/proxy/) to learn how to configure the Docker Daemon to use a proxy server. + +### [Client](#client) + +* [CVE-2021-41092](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41092) + Ensure default auth config has address field set, to prevent credentials being + sent to the default registry. + +### [Runtime](#runtime-1) + +* [CVE-2021-41089](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41089) + Create parent directories inside a chroot during `docker cp` to prevent a specially + crafted container from changing permissions of existing files in the host’s filesystem. +* [CVE-2021-41091](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41091) + Lock down file permissions to prevent unprivileged users from discovering and + executing programs in `/var/lib/docker`. + +### [Packaging](#packaging-3) + +> **Known issue** +> +> The `ctr` binary shipping with the static packages of this release is not +> statically linked, and will not run in Docker images using alpine as a base +> image. Users can install the `libc6-compat` package, or download a previous +> version of the `ctr` binary as a workaround. Refer to the containerd ticket +> related to this issue for more details: [containerd/containerd#5824](https://github.com/containerd/containerd/issues/5824). + +* Update Golang runtime to Go 1.16.8, which contains fixes for [CVE-2021-36221](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-36221) + and [CVE-2021-39293](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-39293) +* Update static binaries and containerd.io rpm and deb packages to containerd + v1.4.11 and runc v1.0.2 to address [CVE-2021-41103](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41103). +* Update the bundled buildx version to v0.6.3 for rpm and deb packages. diff --git a/corpus/changelog/docker_engine_releases/docker_engine_23.0.0.md b/corpus/changelog/docker_engine_releases/docker_engine_23.0.0.md new file mode 100644 index 0000000000000000000000000000000000000000..a902245bb4ad8870e842b709d40c837bf88c6632 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_23.0.0.md @@ -0,0 +1,303 @@ +# Docker Engine 23.0.0 release notes + +Source: https://docs.docker.com/engine/release-notes/23.0/ + +## [23.0.0](#2300) + +*2023-02-01* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 23.0.0 milestone](https://github.com/docker/cli/milestone/51?closed=1) +* [moby/moby, 23.0.0 milestone](https://github.com/moby/moby/milestone/91?closed=1) + +### [New](#new) + +* Set Buildx and BuildKit as the default builder on Linux. [moby/moby#43992](https://github.com/moby/moby/pull/43992) + + Alias `docker build` to `docker buildx build`. [docker/cli#3314](https://github.com/docker/cli/pull/3314) + + The legacy builder can still be used by explicitly setting `DOCKER_BUILDKIT=0`. + + There are differences in how BuildKit and the legacy builder handle multi-stage builds. For more information, see + [Multi-stage builds](https://docs.docker.com/build/building/multi-stage/#differences-between-legacy-builder-and-buildkit). +* Add support for pulling `zstd` compressed layers. [moby/moby#41759](https://github.com/moby/moby/pull/41759), [moby/moby#42862](https://github.com/moby/moby/pull/42862) +* Add support for alternate OCI runtimes on Linux, compatible with the containerd runtime v2 API. [moby/moby#43887](https://github.com/moby/moby/pull/43887), [moby/moby#43993](https://github.com/moby/moby/pull/43993) +* Add support for the containerd `runhcs` shim on Windows (off by default). [moby/moby#42089](https://github.com/moby/moby/pull/42089) +* Add `dockerd --validate` to check the daemon JSON config and exit. [moby/moby#42393](https://github.com/moby/moby/pull/42393) +* Add the ability to configure the daemon's HTTP proxy via flags or JSON config. [moby/moby#42835](https://github.com/moby/moby/pull/42835) +* Add support for RFC 3021 point-to-point networks (IPv4 /31s) and single hosts (IPv4 /32s). For networks with two or fewer addresses, IPAM won't reserve a network and broadcast address. [moby/moby#42626](https://github.com/moby/moby/pull/42626) +* Add support for setting `ipvlan_flag` and using the `l3s` `ipvlan_mode` in the `ipvlan` network driver. [moby/moby#42542](https://github.com/moby/moby/pull/42542) +* Add support for displaying the value of the `metacopy` option for the `overlay2` storage driver. [moby/moby#43557](https://github.com/moby/moby/pull/43557) +* Add support for describing Windows devices using the syntax `IDType://ID`. [moby/moby#43368](https://github.com/moby/moby/pull/43368) +* Add `RootlessKit`, `slirp4netns`, and `VPNKit` version reporting. [moby/moby#42330](https://github.com/moby/moby/pull/42330) +* Add experimental support for SwarmKit cluster volumes (CSI). [moby/moby#41982](https://github.com/moby/moby/pull/41982) + + CLI: Add cluster volume (CSI) options to `docker volume`. [docker/cli#3606](https://github.com/docker/cli/pull/3606) + + CLI: Add cluster volume (CSI) support to `docker stack`. [docker/cli#3662](https://github.com/docker/cli/pull/3662) +* Add support for SwarmKit jobs in `docker stack deploy`. [docker/cli#2907](https://github.com/docker/cli/pull/2907) +* Add the `docker stack config` command to output the merged and interpolated config files as utilized by `stack deploy`. [docker/cli#3544](https://github.com/docker/cli/pull/3544) +* Add a new `docker context show` command that prints the name of the current context. [docker/cli#3567](https://github.com/docker/cli/pull/3567) +* Add the `--format=json` shorthand variant of `--format="{{ json . }}"` to all commands supporting the `--format` flag. [docker/cli#2936](https://github.com/docker/cli/pull/2936) +* Add a `--quiet` option to `docker create` and `docker run` commands to suppress output when pulling an image. [docker/cli#3377](https://github.com/docker/cli/pull/3377) +* Add a `--force` option to `docker network rm` subcommand. Causes CLI to return a 0 exit code even if the network doesn't exist. Has no effect on the server-side procedure for removing a network. [docker/cli#3547](https://github.com/docker/cli/pull/3547) +* Add a `--signal` option to `docker stop` and `docker restart`. [docker/cli#3614](https://github.com/docker/cli/pull/3614) +* Add a `-v/--version` flag to `docker-proxy`. [moby/moby#44703](https://github.com/moby/moby/pull/44703) +* Plugins are now discovered in well-known user-level paths when the daemon is running in rootless mode. [moby/moby#44778](https://github.com/moby/moby/pull/44778) +* The daemon now handles common alternate JSON encodings in the JSON configuration file gracefully, and reports useful errors. [moby/moby#44777](https://github.com/moby/moby/pull/44777), [moby/moby#44832](https://github.com/moby/moby/pull/44832) + + UTF-8 with a byte order mark is accepted. + + UTF-16 with a byte order mark is accepted. + + Invalid UTF-8 is reported early and with a comprehensible error message. +* Allow use of `STOPSIGNAL` via `docker commit`. [moby/moby#43369](https://github.com/moby/moby/pull/43369) +* Add a new option to the `awslogs` log driver to allow skipping log stream creation in CloudWatch. [moby/moby#42132](https://github.com/moby/moby/pull/42132) +* Add a new option to the `awslogs` log driver to specify the log format that's sent to CloudWatch. [moby/moby#42838](https://github.com/moby/moby/pull/42838) +* Add a new option to the `fluentd` log driver to set the reconnection interval. [moby/moby#43100](https://github.com/moby/moby/pull/43100) +* Add new options-setters to the Go API client: `WithTLSClientConfigFromEnv()`, `WithHostFromEnv()`, and `WithVersionFromEnv()`. [moby/moby#42224](https://github.com/moby/moby/pull/42224) +* Add generation of shell command completion through a `docker completion` subcommand. [docker/cli#3429](https://github.com/docker/cli/pull/3429) +* API: Add a `Swarm` header to `GET /_ping` and `HEAD /_ping`, allowing single-request detection of Swarm support. [moby/moby#42064](https://github.com/moby/moby/pull/42064) +* API: Add a `signal` parameter to `POST /containers/{id}/stop` and `POST /containers/{id}/restart` to set the signal used. [moby/moby#43206](https://github.com/moby/moby/pull/43206) +* API: Add a `CreateMountPoint` parameter to `POST /containers/create`. [moby/moby#43484](https://github.com/moby/moby/pull/43484) +* API: Add a `shared-size` parameter to `GET /images/json` to enable shared-size computation of images. [moby/moby#42531](https://github.com/moby/moby/pull/42531) +* API: Add a `type` parameter to `GET /system/df`, to control what object types to are considered when computing disk usage. [moby/moby#42559](https://github.com/moby/moby/pull/42559) +* systemd: Use a systemd-managed containerd instead of a daemon-managed containerd. [moby/moby#42373](https://github.com/moby/moby/pull/42373) +* systemd: Start `docker.service` after `time-set.target`. [moby/moby#43107](https://github.com/moby/moby/pull/43107) + +### [Removed](#removed) + +* Remove support for reading configuration from `~/.dockercfg`. [docker/cli#2504](https://github.com/docker/cli/pull/2504) + + This location has been deprecated since 1.7.0. + + [Deprecation notice](https://docs.docker.com/engine/deprecated/#support-for-legacy-dockercfg-configuration-files) +* Remove the `-g` and `--graph` daemon options in favor of `--data-root`. [docker/cli#3739](https://github.com/docker/cli/pull/3739) + + These options have been hidden and deprecated since 17.05. + + [Deprecation notice](https://docs.docker.com/engine/deprecated/#-g-and---graph-flags-on-dockerd) +* Remove client-side sorting of results, in favor of the order in which the search API returns. [docker/cli#3470](https://github.com/docker/cli/pull/3470) +* Remove warnings related to deprecated storage drivers from the CLI. Warnings are now handled by the daemon instead. [docker/cli#3542](https://github.com/docker/cli/pull/3542) +* Remove `Experimental` client field from `docker version`. [docker/cli#3543](https://github.com/docker/cli/pull/3543) + + [Deprecation notice](https://docs.docker.com/engine/deprecated/#configuration-options-for-experimental-cli-features) +* Require explicit opt-in to use deprecated storage drivers, and don't automatically select them when upgrading. [moby/moby#43378](https://github.com/moby/moby/pull/43378) +* Remove deprecated support for `overlay` and `overlay2` storage drivers on backing filesystems without `d_type` support. [moby/moby#43472](https://github.com/moby/moby/pull/43472) + + [Deprecation notice](https://docs.docker.com/engine/deprecated/#backing-filesystem-without-d_type-support-for-overlayoverlay2) +* Remove the deprecated `overrideKernelCheck` option from the `overlay2` storage driver. [moby/moby#44279](https://github.com/moby/moby/pull/44279) + [Deprecation notice](https://docs.docker.com/engine/deprecated/#support-for-the-overlay2override_kernel_check-storage-option) +* Remove support for the deprecated `io.containerd.runtime.v1.linux` OCI runtime. [moby/moby#43695](https://github.com/moby/moby/pull/43695) +* Remove LCOW (Linux Containers on Windows). [moby/moby#42451](https://github.com/moby/moby/pull/42451), [moby/moby#42499](https://github.com/moby/moby/pull/42499), [moby/moby#42506](https://github.com/moby/moby/pull/42506), [moby/moby#42511](https://github.com/moby/moby/pull/42511), [moby/moby#42520](https://github.com/moby/moby/pull/42520), [moby/moby#42683](https://github.com/moby/moby/pull/42683), [moby/moby#42684](https://github.com/moby/moby/pull/42684), [moby/moby#42685](https://github.com/moby/moby/pull/42685), [moby/moby#43187](https://github.com/moby/moby/pull/43187) + + LCOW was introduced as a technical preview in 17.09 and deprecated in 20.10. + + [Deprecation notice](https://docs.docker.com/engine/deprecated/#linux-containers-on-windows-lcow-experimental) +* Remove daemon options related to legacy overlay networks used with standalone Swarm. + + Remove `--cluster-xx` options from `dockerd`. [moby/moby#40383](https://github.com/moby/moby/issues/40383) + + Remove `host-discovery` and overlay networks with external k/v stores. [moby/moby#42247](https://github.com/moby/moby/pull/42247) + + [Deprecation notice](https://docs.docker.com/engine/deprecated/#classic-swarm-and-overlay-networks-using-cluster-store) +* Remove a deprecated `arm` platform fallback. `--platform linux/arm/vY` will now return a error when `arm/vY` isn't available instead of pulling the wrong image. [moby/moby#44414](https://github.com/moby/moby/pull/44414) +* Remove the deprecated `SetCustomHTTPHeaders()`, `CustomHTTPHeaders()` options-setters from the Go client API. [moby/moby#42694](https://github.com/moby/moby/pull/42694) +* Remove the deprecated `WithDialer()` option-setter from the Go client API. [moby/moby#44022](https://github.com/moby/moby/pull/44022) + + Use `WithDialContext()` instead. +* Remove the daemon implementation of `opts.QuotedString`. The implementation has moved to the CLI. [moby/moby#43250](https://github.com/moby/moby/pull/43250) +* Remove separate daemon ID from trust-key in the daemon, and disable generating the trust-key. [moby/moby#43555](https://github.com/moby/moby/pull/43555) +* API: Remove the deprecated `KernelMemory` option from `POST /containers/create` on API version >= 1.42. [moby/moby#43214](https://github.com/moby/moby/pull/43214) + + [Deprecation notice](https://docs.docker.com/engine/deprecated/#kernel-memory-limit) + +### [Deprecated](#deprecated) + +* Require Windows Server RS5 / LTSC 2019 (build 17763) as the minimum to run the daemon. [moby/moby#43254](https://github.com/moby/moby/pull/43254) +* Deprecate `BuilderSize` on API version >= 1.42. [moby/moby#42608](https://github.com/moby/moby/pull/42608) +* Deprecate `BuildCache.Parent` in favor of the newly introduced `BuildCache.Parents` on API version >= 1.42. [moby/moby#43908](https://github.com/moby/moby/pull/43908) +* Deprecate `pkg/urlutil`, moving the implementation to `builder/remotecontext/urlutil`. [moby/moby#43477](https://github.com/moby/moby/pull/43477) + +### [Upgrades](#upgrades) + +* Upgrade Go to `1.19.5`. [docker/cli#3958](https://github.com/docker/cli/pull/3958), [moby/moby#44794](https://github.com/moby/moby/pull/44794) +* Upgrade `rootlesskit` to `v0.14.4`. [moby/moby#42708](https://github.com/moby/moby/pull/42708) +* Upgrade `buildkit` to `v0.10.6`. [moby/moby#43239](https://github.com/moby/moby/pull/43239) +* Upgrade `buildx` to `v0.10.2`. [docker/docker-ce-packaging#840](https://github.com/docker/docker-ce-packaging/pull/840) +* Upgrade `swarmkit` to `v2.0.0-20230119195359-904c221ac281`. [moby/moby#44858](https://github.com/moby/moby/pull/44858) +* Upgrade `containerd` to `v1.6.16`. [moby/moby#44766](https://github.com/moby/moby/pull/44766), [moby/moby#44769](https://github.com/moby/moby/pull/44769), [moby/moby#44881](https://github.com/moby/moby/pull/44881) +* Upgrade `runc` to `v1.1.4`. [moby/moby#44039](https://github.com/moby/moby/pull/44039) +* Upgrade `hcsshim` `v0.9.6`. [moby/moby#44658](https://github.com/moby/moby/pull/44658) +* The `btrfs` storage driver now depends on Linux kernel headers (>= 4.12) instead of headers from btrfs-progs. [moby/moby#44776](https://github.com/moby/moby/pull/44776) + +### [Security](#security) + +* Change permissions on container `hostconfig.json` files to `0600` (was `0644`). [moby/moby#41620](https://github.com/moby/moby/pull/41620) +* Fix `--seccomp-profile` not accepting `unconfined` and renamed the default seccomp profile to `builtin`. [moby/moby#42481](https://github.com/moby/moby/pull/42481) +* Always build with seccomp support, and remove the `seccomp` build tag. [moby/moby#42501](https://github.com/moby/moby/pull/42501) +* Add seccomp support on `riscv64`. [moby/moby#43553](https://github.com/moby/moby/pull/43553) +* Add support for setting flags passed to `seccomp(2)` in seccomp profiles. [moby/moby#42648](https://github.com/moby/moby/pull/42648) +* Refactor seccomp types to reuse runtime-spec, and add support for `ErrnoRet`. [moby/moby#42005](https://github.com/moby/moby/pull/42005) +* Add support for `DefaultErrnoRet` in `seccomp` profiles. [moby/moby#42604](https://github.com/moby/moby/pull/42604) +* Add an explicit `DefaultErrnoRet` field to the default seccomp profile, with no behavior change. [moby/moby#42649](https://github.com/moby/moby/pull/42649) +* Block `socket` with `AF_VSOCK` in the default seccomp profile. [moby/moby#44563](https://github.com/moby/moby/pull/44563) +* Re-enable `process_vm_readv` and `process_vm_writev` in the default seccomp profile. [moby/moby#42083](https://github.com/moby/moby/pull/42083) +* Add syscalls related to PKU to the default seccomp profile. [moby/moby#43812](https://github.com/moby/moby/pull/43812) +* Allow `clock_settime64` with `CAP_SYS_TIME`. [moby/moby#43775](https://github.com/moby/moby/pull/43775) +* Allow `bpf` with `CAP_BPF` and `perf_event_open` with `CAP_PERFMON`. [moby/moby#43988](https://github.com/moby/moby/pull/43988) +* Explicitly set the `clone3` syscall to return `ENOSYS` in the default seccomp profile, in order to ensure `glibc` will correctly fallback to using `clone`. [moby/moby#42681](https://github.com/moby/moby/pull/42681) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-6) + +* Promote `overlay2` to be the default storage driver (`btrfs` and `zfs` are now opt-in). [moby/moby#42661](https://github.com/moby/moby/pull/42661) +* Add a loading spinner to the `docker cp` command. [docker/cli#2708](https://github.com/docker/cli/pull/2708) +* Deprecate the `ElectAuthServer` function, and made it return the default registry without calling the `GET /info` API endpoint. [docker/cli#2819](https://github.com/docker/cli/pull/2819) +* Progress bars are no longer reversed when rolling back Swarm services. [docker/cli#2940](https://github.com/docker/cli/pull/2940) +* Use `net.JoinHostPort()` to fix formatting with IPv6 addresses. [docker/cli#2972](https://github.com/docker/cli/pull/2972) +* CLI error messages are now printed to `stderr`. [docker/cli#3044](https://github.com/docker/cli/pull/3044) +* Improve performance of `docker info` if a custom `--format` is used that only uses local information. With this change, the CLI only uses the daemon API if it detects that information from the daemon is needed. [docker/cli#3179](https://github.com/docker/cli/pull/3179) +* Remove the default value from the `--stop-signal` flag, as it may not reflect the actual default used by the daemon. [docker/cli#3245](https://github.com/docker/cli/pull/3245) +* Add Compose schema `3.10` to `docker stack`; allow omitting the `version` field (resulting in `latest`). [docker/cli#3257](https://github.com/docker/cli/pull/3257) +* Compose version `3` is now equivalent to `3.x` (latest) in `docker stack`. [docker/cli#3445](https://github.com/docker/cli/pull/3445) +* Fix `` hanging on Windows to exit after running a container in non-interactive mode. [docker/cli#3302](https://github.com/docker/cli/pull/3302) +* Add relative source paths to the `run` command in the `-v`/`--volume` and `-m`/`--mount` flags. [docker/cli#3469](https://github.com/docker/cli/pull/3469) +* `docker exec -t` now sets the console size for the executed process immediately when it's created. [docker/cli#3627](https://github.com/docker/cli/pull/3627) +* Update the pretty-print format of `docker info` to provide more details on installed plugins. [docker/cli#3645](https://github.com/docker/cli/pull/3645) +* Print warning messages for the `docker context list` and `docker context use` commands when the context is overridden by the environment. [docker/cli#3668](https://github.com/docker/cli/pull/3668) +* Add a custom `aliases` annotation that can be used to print all available aliases for a command. [docker/cli#3694](https://github.com/docker/cli/pull/3694) +* The CLI no longer creates or updates the CLI configuration file when running `docker context use` and selecting the current context. [docker/cli#3721](https://github.com/docker/cli/pull/3721) +* Non-existing contexts are now ignored when running `docker context rm --force`. [docker/cli#3791](https://github.com/docker/cli/pull/3791) +* Add the ability to override integers to `0` in Compose files. [docker/cli#3812](https://github.com/docker/cli/pull/3812) +* SIGINT (``) now passes through to running containers instead of causing the CLI to exit. [docker/cli#3849](https://github.com/docker/cli/pull/3849) +* Improve `docker port CONTAINER` UX by sorting ports before printing. [docker/cli#3892](https://github.com/docker/cli/pull/3892) +* API: `GET /containers/{id}/logs` and `POST /containers/{id}/attach` now report which raw-stream format is in use using the `Content-type` response header on API version >= 1.42. [moby/moby#39812](https://github.com/moby/moby/pull/39812) +* Set default sandbox size for Windows layers to 127GB, and ensure that the `--storage-opts` flag applies to all storage on Windows. [moby/moby#41636](https://github.com/moby/moby/pull/41636) +* Remove the plugin section from the containerd configuration file (`/var/run/docker/containerd/containerd.toml`). [moby/moby#41675](https://github.com/moby/moby/pull/41675) +* Reject `null` manifests during tar import. [moby/moby#41842](https://github.com/moby/moby/pull/41842) +* Add shim config for custom runtimes for plugins. [moby/moby#41854](https://github.com/moby/moby/pull/41854) +* Container health checks now resume when the daemon is restarted. [moby/moby#41935](https://github.com/moby/moby/pull/41935) +* Quota is no longer disabled on cleanup of the `btrfs` driver. [moby/moby#42273](https://github.com/moby/moby/pull/42273) +* Host devices that are accessible can now be mounted in `--privileged` rootless containers. [moby/moby#42638](https://github.com/moby/moby/pull/42638) +* Fix incorrect handling of `**/foo` recursive wildcard directory patterns in `.dockerignore`. [moby/moby#42676](https://github.com/moby/moby/pull/42676) +* Extend `docker import --platform` to allow marking an imported image as a foreign architecture. [moby/moby#43103](https://github.com/moby/moby/pull/43103) +* Validation of CPU real-time options is now performed when the daemon starts instead of performing validations for each individual container, allowing startup to fail early. [moby/moby#43131](https://github.com/moby/moby/pull/43131) +* Freeze the `namesgenerator` package against new additions. Users will have to be satisfied with the existing 25359 adjective-name combinations. [moby/moby#43210](https://github.com/moby/moby/pull/43210) +* API: `containers/{id}/attach/ws` only to streams according by `stdin`, `stdout` and `stderr` parameters on API version >= 1.42. [moby/moby#43322](https://github.com/moby/moby/pull/43322) +* Fix UDP traffic in containers not working after the container is restarted under sustained traffic. [moby/moby#43409](https://github.com/moby/moby/pull/43409) +* Add support for pulling images with custom amd64 micro-architecture feature levels as supported by the latest versions of Go, GCC, LLVM, and other compiler tools. [moby/moby#43434](https://github.com/moby/moby/pull/43434) +* Improve validation of invalid JSON requests in the API. [moby/moby#43463](https://github.com/moby/moby/pull/43463) +* Mitigate the impact of slow `exec` starts on health checks. Check timeout now only applies to the duration that the health check command is running. The time it takes to start the command no longer counts against the timeout. [moby/moby#43480](https://github.com/moby/moby/pull/43480) +* Console `tty` size is set immediately on creation. [moby/moby#43593](https://github.com/moby/moby/pull/43593), [moby/moby#43622](https://github.com/moby/moby/pull/43622) +* Fix `overlay2` mounts not being cleaned up after failed container starts, or daemon shutdown. [moby/moby#43659](https://github.com/moby/moby/pull/43659) +* Match manifest list resolution with `containerd`. [moby/moby#43675](https://github.com/moby/moby/pull/43675) +* Skip use of `firewalld` for networking when the daemon is running in rootless mode. [moby/moby#43813](https://github.com/moby/moby/pull/43813) +* Custom NAT networks are now re-created after daemon restart if missing on Windows. [moby/moby#43858](https://github.com/moby/moby/pull/43858) +* Fix terminating the container health-check process when it times out. [moby/moby#43994](https://github.com/moby/moby/pull/43994) +* Fix `live-restore` with restart policies and volume refs. [moby/moby#44237](https://github.com/moby/moby/pull/44237) +* API: Only anonymous volumes now pruned by default on API version >= v1.42. Pass the filter `all=true` to prune named volumes in addition to anonymous. [moby/moby#44259](https://github.com/moby/moby/pull/44259) +* API: Support concurrent calls on the `GET /system/df` endpoint. [moby/moby#42715](https://github.com/moby/moby/pull/42715) +* Improve the reliability of the daemon dumping the stack and exits with code 2 when sent a SIGQUIT. [moby/moby#44831](https://github.com/moby/moby/pull/44831) +* Improve the reliability of `docker logs -f` on Windows, and prevent newlines from being dropped in the `local` log driver. [moby/moby#43294](https://github.com/moby/moby/pull/43294) +* Fix a rare deadlock in the daemon caused by buffering of container logs. [moby/moby#44856](https://github.com/moby/moby/pull/44856) +* Improve error handling in misc filesystem operations so that the daemon can start on a overlayfs backing filesystem. [moby/moby#44834](https://github.com/moby/moby/pull/44834) +* Fix an issue where `--ipc=host` wasn't handled correctly when the daemon is running in rootless mode. [moby/moby#44863](https://github.com/moby/moby/pull/44863) +* Fix a long-standing set of issues where stale conntrack entries caused incorrect routing of UDP traffic for containers. [moby/moby#44752](https://github.com/moby/moby/pull/44752) +* Fix half-registered containers being listed in the API, as well as a nil pointer de-reference and panic caused by using a partially registered container in API calls. [moby/moby#44633](https://github.com/moby/moby/pull/44633) +* Fix a failure to create the `DOCKER-USER` ip6tables chain. [moby/moby#44845](https://github.com/moby/moby/pull/44845) +* Fix a failure to clean up iptables rules when the `ip6tables` command isn't available. [moby/moby#44727](https://github.com/moby/moby/pull/44727) +* Fix an issue where some iptables NAT rules weren't cleaned up after enabling the userland proxy. [moby/moby#44811](https://github.com/moby/moby/pull/44811) +* Fix a potentially leaked process in rare situations where cleaning up a failed attempt to start a container was mishandled. [moby/moby#44400](https://github.com/moby/moby/pull/44400) +* Fix the `CreatedAt` time of a volume reflecting initialization and not creation. [moby/moby#44725](https://github.com/moby/moby/pull/44725) +* Fix an issue where the CLI incorrectly reported an incompatible server instead of an unreachable server in some commands. [docker/cli#3901](https://github.com/docker/cli/pull/3901), [docker/cli#3904](https://github.com/docker/cli/pull/3904) +* Fix broken completion of volumes in Zsh. [docker/cli#2998](https://github.com/docker/cli/pull/2998) +* Improve output of `docker context` when an invalid context is present. [docker/cli#3847](https://github.com/docker/cli/pull/3847) +* Remove ANSI decoration of CLI help annotations when the output isn't a TTY, and added a newline for readability. [docker/cli#3973](https://github.com/docker/cli/pull/3973) +* Add `docker container remove` as an alias for `docker container rm`. [docker/cli#3986](https://github.com/docker/cli/pull/3986) + +### [Known issues](#known-issues) + +#### [apparmor\_parser ([tracking issue](https://github.com/moby/moby/issues/44900))](#apparmor_parser-tracking-issuehttpsgithubcommobymobyissues44900) + +Some Debian users have reported issues with containers failing to start after upgrading to the 23.0 branch. +The error message indicates that the issue is due to a missing `apparmor_parser` binary: + +``` +Error response from daemon: AppArmor enabled on system but the docker-default profile could not be loaded: running `apparmor_parser apparmor_parser --version` failed with output: +error: exec: "apparmor_parser": executable file not found in $PATH +Error: failed to start containers: somecontainer +``` + +The workaround to this issue is to install the `apparmor` package manually: + +``` +apt-get install apparmor +``` + +#### [BuildKit inline cache ([tracking issue](https://github.com/moby/moby/issues/44918))](#buildkit-inline-cache-tracking-issuehttpsgithubcommobymobyissues44918) + +Attempting to build an image with BuildKit's inline cache feature (e.g. `docker build --build-arg BUILDKIT_INLINE_CACHE=1 .`, `docker buildx build --cache-to type=inline .`) will result in the daemon unexpectedly exiting: + +``` +panic: runtime error: invalid memory address or nil pointer dereference +[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x147ff00] + +goroutine 693 [running]: +github.com/docker/docker/vendor/github.com/moby/buildkit/cache.computeBlobChain.func4.1({0x245cca8, 0x4001394960}) + /go/src/github.com/docker/docker/vendor/github.com/moby/buildkit/cache/blobs.go:206 +0xc90 +github.com/docker/docker/vendor/github.com/moby/buildkit/util/flightcontrol.(*call).run(0x40013c2240) + /go/src/github.com/docker/docker/vendor/github.com/moby/buildkit/util/flightcontrol/flightcontrol.go:121 +0x64 +sync.(*Once).doSlow(0x0?, 0x4001328240?) + /usr/local/go/src/sync/once.go:74 +0x100 +sync.(*Once).Do(0x4001328240?, 0x0?) + /usr/local/go/src/sync/once.go:65 +0x24 +created by github.com/docker/docker/vendor/github.com/moby/buildkit/util/flightcontrol.(*call).wait +``` + +The daemon will restart if configured to do so (e.g. via systemd) after such a crash. The only available mitigation in this release is to avoid performing builds with the inline cache feature enabled. + +#### [BuildKit with warm cache ([tracking issue](https://github.com/moby/moby/issues/44943))](#buildkit-with-warm-cache-tracking-issuehttpsgithubcommobymobyissues44943) + +If an image was built with BuildKit on a previous version of the daemon, and is built with a 23.0 daemon, previously cached layers will not be restored correctly. The image may appear to build correctly if no lines are changed in the Dockerfile; however, if partial cache invalidation occurs due to changing some lines in the Dockerfile, the still valid and previously cached layers will not be loaded correctly. + +This most often presents as files that should be present in the image not being present in a `RUN` stage, or any other stage that references files, after changing some lines in the Dockerfile: + +``` +[+] Building 0.4s (6/6) FINISHED + => [internal] load build definition from Dockerfile + => => transferring dockerfile: 102B + => [internal] load .dockerignore + => => transferring context: 2B + => [internal] load metadata for docker.io/library/node:18-alpine + => [base 1/2] FROM docker.io/library/node:18-alpine@sha256:bc329c7332cffc30c2d4801e38df03cbfa8dcbae2a7a52a449db104794f168a3 + => CACHED [base 2/2] WORKDIR /app + => ERROR [stage-1 1/1] RUN uname -a +------ + > [stage-1 1/1] RUN uname -a: +#0 0.138 runc run failed: unable to start container process: exec: "/bin/sh": stat /bin/sh: no such file or directory +------ +Dockerfile:5 +-------------------- + 3 | + 4 | FROM base + 5 | >>> RUN uname -a + 6 | +-------------------- +ERROR: failed to solve: process "/bin/sh -c uname -a" did not complete successfully: exit code: 1 +``` + +To mitigate this, the previous build cache must be discarded. `docker builder prune -a` will completely empty the build cache, and allow the affected builds to proceed again by removing the mishandled cache layers. + +#### [ipvlan networks ([tracking issue](https://github.com/moby/moby/issues/44925))](#ipvlan-networks-tracking-issuehttpsgithubcommobymobyissues44925) + +When upgrading to the 23.0 branch, the existence of any +[ipvlan](https://docs.docker.com/engine/network/drivers/ipvlan/) networks will prevent the daemon from starting: + +``` +panic: interface conversion: interface {} is nil, not string + +goroutine 1 [running]: +github.com/docker/docker/libnetwork/drivers/ipvlan.(*configuration).UnmarshalJSON(0x40011533b0, {0x400069c2d0, 0xef, 0xef}) + /go/src/github.com/docker/docker/libnetwork/drivers/ipvlan/ipvlan_store.go:196 +0x414 +encoding/json.(*decodeState).object(0x4001153440, {0x5597157640?, 0x40011533b0?, 0x559524115c?}) + /usr/local/go/src/encoding/json/decode.go:613 +0x650 +encoding/json.(*decodeState).value(0x4001153440, {0x5597157640?, 0x40011533b0?, 0x559524005c?}) + /usr/local/go/src/encoding/json/decode.go:374 +0x40 +encoding/json.(*decodeState).unmarshal(0x4001153440, {0x5597157640?, 0x40011533b0?}) + /usr/local/go/src/encoding/json/decode.go:181 +0x204 +encoding/json.Unmarshal({0x400069c2d0, 0xef, 0xef}, {0x5597157640, 0x40011533b0}) + /usr/local/go/src/encoding/json/decode.go:108 +0xf4 +github.com/docker/docker/libnetwork/drivers/ipvlan.(*configuration).SetValue(0x4000d18050?, {0x400069c2d0?, 0x23?, 0x23?}) + /go/src/github.com/docker/docker/libnetwork/drivers/ipvlan/ipvlan_store.go:230 +0x38 +``` + +To mitigate this, affected users can downgrade and remove the network, then upgrade again. +Alternatively, the entire network store can be removed, and networks can be recreated after the upgrade. The network store is located at `/var/lib/docker/network/files/local-kv.db`. If the daemon is using an alternate `--data-root`, substitute `/var/lib/docker` for the alternate path. + +#### [Kata Containers ([tracking issue](https://github.com/kata-containers/kata-containers/issues/6154))](#kata-containers-tracking-issuehttpsgithubcomkata-containerskata-containersissues6154) + +The 23.0 branch brings support for alternate containerd shims, such as `io.containerd.runsc.v1` (gVisor) and `io.containerd.kata.v2` (Kata Containers). + +When using the Kata Containers runtime, exiting an `exec` session stops the running container, and hangs the connected CLI if a TTY was opened. There is no mitigation at this time beyond avoiding execing into containers running on the Kata runtime. + +The root cause of this issue is a long-standing bug in Moby. This will be resolved in a future release. Be advised that support for alternate OCI runtimes is a new feature and that similar issues may be discovered as more users start exercising this functionality. diff --git a/corpus/changelog/docker_engine_releases/docker_engine_23.0.1.md b/corpus/changelog/docker_engine_releases/docker_engine_23.0.1.md new file mode 100644 index 0000000000000000000000000000000000000000..44f705493c7b9f451f87a7fc8c4cefe252cda8fc --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_23.0.1.md @@ -0,0 +1,30 @@ +# Docker Engine 23.0.1 release notes + +Source: https://docs.docker.com/engine/release-notes/23.0/ + +## [23.0.1](#2301) + +*2023-02-09* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 23.0.1 milestone](https://github.com/docker/cli/milestone/73?closed=1) +* [moby/moby, 23.0.1 milestone](https://github.com/moby/moby/milestone/113?closed=1) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-5) + +* Fix containers not starting if the kernel has AppArmor enabled, but `apparmor_parser` is not available. [moby/moby#44942](https://github.com/moby/moby/pull/44942) +* Fix BuildKit-enabled builds with inline caching causing the daemon to crash. [moby/moby#44944](https://github.com/moby/moby/pull/44944) +* Fix BuildKit improperly loading cached layers created by previous versions. [moby/moby#44959](https://github.com/moby/moby/pull/44959) +* Fix an issue where `ipvlan` networks created prior to upgrading would prevent the daemon from starting. [moby/moby#44937](https://github.com/moby/moby/pull/44937) +* Fix the `overlay2` storage driver failing early in `metacopy` testing when initialized on an unsupported backing filesystem. [moby/moby#44922](https://github.com/moby/moby/pull/44922) +* Fix `exec` exit events being misinterpreted as container exits under some runtimes, such as Kata Containers. [moby/moby#44892](https://github.com/moby/moby/pull/44892) +* Improve the error message returned by the CLI when receiving a truncated JSON response caused by the API hanging up mid-request. [docker/cli#4004](https://github.com/docker/cli/pull/4004) +* Fix an incorrect CLI exit code when attempting to execute a directory with a `runc` compiled using Go 1.20. [docker/cli#4004](https://github.com/docker/cli/pull/4004) +* Fix mishandling the size argument to `--device-write-bps` as a path. [docker/cli#4004](https://github.com/docker/cli/pull/4004) + +### [Packaging](#packaging-1) + +* Add `/etc/docker` to RPM and DEB packaging. [docker/docker-ce-packaging#842](https://github.com/docker/docker-ce-packaging/pull/842) + + Not all use cases will benefit; if you depend on this, you should explicitly `mkdir -p /etc/docker`. +* Upgrade Compose to `v2.16.0`. [docker/docker-ce-packaging#844](https://github.com/docker/docker-ce-packaging/pull/844) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_23.0.2.md b/corpus/changelog/docker_engine_releases/docker_engine_23.0.2.md new file mode 100644 index 0000000000000000000000000000000000000000..a099c50de265813168b08baa25bdd82f3564db57 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_23.0.2.md @@ -0,0 +1,39 @@ +# Docker Engine 23.0.2 release notes + +Source: https://docs.docker.com/engine/release-notes/23.0/ + +## [23.0.2](#2302) + +*2023-03-28* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 23.0.2 milestone](https://github.com/docker/cli/milestone/75?closed=1) +* [moby/moby, 23.0.2 milestone](https://github.com/moby/moby/milestone/114?closed=1) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-4) + +* Fully resolve missing checks for `apparmor_parser` when an AppArmor enabled kernel is detected. [containerd/containerd#8087](https://github.com/containerd/containerd/pull/8087), [moby/moby#45043](https://github.com/moby/moby/pull/45043) +* Ensure that credentials are redacted from Git URLs when generating BuildKit buildinfo. Fixes [CVE-2023-26054](https://github.com/moby/buildkit/security/advisories/GHSA-gc89-7gcr-jxqc). [moby/moby#45110](https://github.com/moby/moby/pull/45110) +* Fix anonymous volumes created by a `VOLUME` line in a Dockerfile being excluded from volume prune. [moby/moby#45159](https://github.com/moby/moby/pull/45159) +* Fix a failure to properly propagate errors during removal of volumes on a Swarm node. [moby/moby#45155](https://github.com/moby/moby/pull/45155) +* Temporarily work around a bug in BuildKit `COPY --link` by disabling mergeop/diffop optimization. [moby/moby#45112](https://github.com/moby/moby/pull/45112) +* Properly clean up child tasks when a parent Swarm job is removed. [moby/swarmkit#3112](https://github.com/moby/swarmkit/pull/3112), [moby/moby#45107](https://github.com/moby/moby/pull/45107) +* Fix Swarm service creation logic so that both a GenericResource and a non-default network can be used together. [moby/swarmkit#3082](https://github.com/moby/swarmkit/pull/3082), [moby/moby#45107](https://github.com/moby/moby/pull/45107) +* Fix Swarm CSI support requiring the CSI plugin to offer staging endpoints in order to publish a volume. [moby/swarmkit#3116](https://github.com/moby/swarmkit/pull/3116), [moby/moby#45107](https://github.com/moby/moby/pull/45107) +* Fix a panic caused by log buffering in some configurations. [containerd/fifo#47](https://github.com/containerd/fifo/pull/47), [moby/moby#45051](https://github.com/moby/moby/pull/45051) +* Log errors in the REST to Swarm gRPC API translation layer at the debug level to reduce redundancy and noise. [moby/moby#45016](https://github.com/moby/moby/pull/45016) +* Fix a DNS resolution issue affecting containers created with `--dns-opt` or `--dns-search` when `systemd-resolved` is used outside the container. [moby/moby#45000](https://github.com/moby/moby/pull/45000) +* Fix a panic when logging errors in handling DNS queries originating from inside a container. [moby/moby#44980](https://github.com/moby/moby/pull/44980) +* Improve the speed of `docker ps` by allowing users to opt out of size calculations with `--size=false`. [docker/cli#4107](https://github.com/docker/cli/pull/4107) +* Extend support for Bash completion to all plugins. [docker/cli#4092](https://github.com/docker/cli/pull/4092) +* Fix `docker stack deploy` failing on Windows when special environment variables set by `cmd.exe` are present. [docker/cli#4083](https://github.com/docker/cli/pull/4083) +* Add forward compatibility for future API versions by considering empty image tags to be the same as ``. [docker/cli#4065](https://github.com/docker/cli/pull/4065) +* Atomically write context files to greatly reduce the probability of corruption, and improve the error message for a corrupt context. [docker/cli#4063](https://github.com/docker/cli/pull/4063) + +### [Packaging](#packaging) + +* Upgrade Go to `1.19.7`. [docker/docker-ce-packaging#857](https://github.com/docker/docker-ce-packaging/pull/857), [docker/cli#4086](https://github.com/docker/cli/pull/4086), [moby/moby#45137](https://github.com/moby/moby/pull/45137) +* Upgrade `containerd` to `v1.6.19`. [moby/moby#45084](https://github.com/moby/moby/pull/45084), [moby/moby#45099](https://github.com/moby/moby/pull/45099) +* Upgrade Buildx to `v0.10.4`. [docker/docker-ce-packaging#855](https://github.com/docker/docker-ce-packaging/pull/855) +* Upgrade Compose to `v2.17.2`. [docker/docker-ce-packaging#867](https://github.com/docker/docker-ce-packaging/pull/867) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_23.0.3.md b/corpus/changelog/docker_engine_releases/docker_engine_23.0.3.md new file mode 100644 index 0000000000000000000000000000000000000000..f7ed3cc07b35a2e68e68c24138174f1699e482e0 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_23.0.3.md @@ -0,0 +1,32 @@ +# Docker Engine 23.0.3 release notes + +Source: https://docs.docker.com/engine/release-notes/23.0/ + +## [23.0.3](#2303) + +*2023-04-04* +> Note +> +> Due to an issue with CentOS 9 Stream's package repositories, packages for +> CentOS 9 are currently unavailable. Packages for CentOS 9 may be added later, +> or as part of the next (23.0.4) patch release. + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-3) + +* Fixed a number of issues that can cause Swarm encrypted overlay networks + to fail to uphold their guarantees, addressing [CVE-2023-28841](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-28841), + [CVE-2023-28840](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-28840), and + [CVE-2023-28842](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-28842). + + A lack of kernel support for encrypted overlay networks now reports + as an error. + + Encrypted overlay networks are eagerly set up, rather than waiting for + multiple nodes to attach. + + Encrypted overlay networks are now usable on Red Hat Enterprise Linux 9 + through the use of the `xt_bpf` kernel module. + + Users of Swarm overlay networks should review [GHSA-vwm3-crmr-xfxw](https://github.com/moby/moby/security/advisories/GHSA-vwm3-crmr-xfxw) + to ensure that unintentional exposure has not occurred. + +### [Packaging Updates](#packaging-updates-3) + +* Upgrade `containerd` to [v1.6.20](https://github.com/containerd/containerd/releases/tag/v1.6.20). +* Upgrade `runc` to [v1.1.5](https://github.com/opencontainers/runc/releases/tag/v1.1.5). diff --git a/corpus/changelog/docker_engine_releases/docker_engine_23.0.4.md b/corpus/changelog/docker_engine_releases/docker_engine_23.0.4.md new file mode 100644 index 0000000000000000000000000000000000000000..90d40efa8193bf6211b82ce5439edd2c37f91ab2 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_23.0.4.md @@ -0,0 +1,29 @@ +# Docker Engine 23.0.4 release notes + +Source: https://docs.docker.com/engine/release-notes/23.0/ + +## [23.0.4](#2304) + +*2023-04-17* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 23.0.4 milestone](https://github.com/docker/cli/milestone/77?closed=1) +* [moby/moby, 23.0.4 milestone](https://github.com/moby/moby/milestone/117?closed=1) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-2) + +* Fix a performance regression in Docker CLI 23.0.0 [docker/cli#4141](https://github.com/docker/cli/pull/4141). +* Fix progress indicator on `docker cp` not functioning as intended [docker/cli#4157](https://github.com/docker/cli/pull/4157). +* Fix shell completion for `docker compose --file` [docker/cli#4177](https://github.com/docker/cli/pull/4177). +* Fix an error caused by incorrect handling of "default-address-pools" in `daemon.json` [moby/moby#45246](https://github.com/moby/moby/pull/45246). + +### [Packaging Updates](#packaging-updates-2) + +* Fix missing packages for CentOS 9 Stream. +* Upgrade Go to `1.19.8`. [docker/docker-ce-packaging#878](https://github.com/docker/docker-ce-packaging/pull/878), + [docker/cli#4164](https://github.com/docker/cli/pull/4164), [moby/moby#45277](https://github.com/moby/moby/pull/45277), + which contains fixes for [CVE-2023-24537](https://github.com/advisories/GHSA-fp86-2355-v99r), + [CVE-2023-24538](https://github.com/advisories/GHSA-v4m2-x4rp-hv22), + [CVE-2023-24534](https://github.com/advisories/GHSA-8v5j-pwr7-w5f8), + and [CVE-2023-24536](https://github.com/advisories/GHSA-9f7g-gqwh-jpf5) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_23.0.5.md b/corpus/changelog/docker_engine_releases/docker_engine_23.0.5.md new file mode 100644 index 0000000000000000000000000000000000000000..3c84838e0d403a665b7b6032938928f29e94508f --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_23.0.5.md @@ -0,0 +1,25 @@ +# Docker Engine 23.0.5 release notes + +Source: https://docs.docker.com/engine/release-notes/23.0/ + +## [23.0.5](#2305) + +*2023-04-26* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 23.0.5 milestone](https://github.com/docker/cli/milestone/79?closed=1) +* [moby/moby, 23.0.5 milestone](https://github.com/moby/moby/milestone/118?closed=1) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-1) + +* Add the `--all` / `-a` option when pruning volumes. [docker/cli#4229](https://github.com/docker/cli/pull/4229) +* Add `--format=json` for `docker info`. [docker/cli#4320](https://github.com/docker/cli/pull/4230) +* Fix log loss with the AWSLogs log driver. [moby/moby#45350](https://github.com/moby/moby/pull/45350) +* Fix a regression introduced in v23.0.4 where dockerd would refuse to start if the fixed-cidr config parameter is provided but not bip. [moby/moby#45403](https://github.com/moby/moby/pull/45403) +* Fix a panic in libnetwork during daemon start [moby/moby#45376](https://github.com/moby/moby/pull/45376) +* Fix "tag" event not being sent when an image is built with `buildx`. [moby/moby#45410](https://github.com/moby/moby/pull/45410) + +### [Packaging Updates](#packaging-updates-1) + +* Upgrade Compose to `2.17.3`. [docker/docker-ce-packaging#883](https://github.com/docker/docker-ce-packaging/pull/883) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_23.0.6.md b/corpus/changelog/docker_engine_releases/docker_engine_23.0.6.md new file mode 100644 index 0000000000000000000000000000000000000000..19334c50ed3e364533929bca797551ca56827c67 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_23.0.6.md @@ -0,0 +1,23 @@ +# Docker Engine 23.0.6 release notes + +Source: https://docs.docker.com/engine/release-notes/23.0/ + +## [23.0.6](#2306) + +*2023-05-08* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 23.0.6 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A23.0.6) +* [moby/moby, 23.0.6 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A23.0.6) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements) + +* Fix vfs storage driver not working on NFS. [moby/moby#45465](https://github.com/moby/moby/pull/45465) + +### [Packaging Updates](#packaging-updates) + +* Upgrade Go to `1.19.9`. [docker/docker-ce-packaging#889](https://github.com/docker/docker-ce-packaging/pull/889), + [docker/cli#4254](https://github.com/docker/cli/pull/4254), [moby/moby#45455](https://github.com/moby/moby/pull/45455) +* Upgrade `containerd` to [v1.6.21](https://github.com/containerd/containerd/releases/tag/v1.6.21) +* Upgrade `runc` to [v1.1.7](https://github.com/opencontainers/runc/releases/tag/v1.1.7) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_24.0.0.md b/corpus/changelog/docker_engine_releases/docker_engine_24.0.0.md new file mode 100644 index 0000000000000000000000000000000000000000..926646480c17135756036e3e218ff8374a9d2aa3 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_24.0.0.md @@ -0,0 +1,57 @@ +# Docker Engine 24.0.0 release notes + +Source: https://docs.docker.com/engine/release-notes/24.0/ + +## [24.0.0](#2400) + +*2023-05-16* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 24.0.0 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A24.0.0) +* [moby/moby, 24.0.0 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A24.0.0) + +### [New](#new) + +* Introduce experimental support for containerd as the content store (replacing the existing storage drivers). [moby/moby#43735](https://github.com/moby/moby/pull/43735), [other moby/moby pull requests](https://github.com/moby/moby/pulls?q=is%3Apr+is%3Amerged+milestone%3A24.0.0+-label%3Aprocess%2Fcherry-picked+label%3Acontainerd-integration+) +* The `--host` CLI flag now supports a path component in a `ssh://` host address, allowing use of an alternate socket path without configuration on the remote host. [docker/cli#4073](https://github.com/docker/cli/pull/4073) +* The `docker info` CLI command now reports a version and platform field. [docker/cli#4180](https://github.com/docker/cli/pull/4180) +* Introduce the daemon flag `--default-network-opt` to configure options for newly created networks. [moby/moby#43197](https://github.com/moby/moby/pull/43197) +* Restrict access to `AF_VSOCK` in the `socket(2)` family of syscalls in the default seccomp profile. [moby/moby#44562](https://github.com/moby/moby/pull/44562) +* Introduce support for setting OCI runtime annotations on containers. [docker/cli#4156](https://github.com/docker/cli/pull/4156), [moby/moby#45025](https://github.com/moby/moby/pull/45025) +* Alternative runtimes can now be configured in `daemon.json`, enabling runtime names to be aliased and options to be passed. [moby/moby#45032](https://github.com/moby/moby/pull/45032) +* The `docker-init` binary will now be discovered in FHS-compliant libexec directories, in addition to the `PATH`. [moby/moby#45198](https://github.com/moby/moby/pull/45198) +* API: Surface the daemon-level `--no-new-privileges` in `GET /info`. [moby/moby#45320](https://github.com/moby/moby/pull/45320) + +### [Removed](#removed-1) + +* `docker info` no longer reports `IndexServiceAddress`. [docker/cli#4204](https://github.com/docker/cli/pull/4204) +* libnetwork: Remove fallback code for obsolete kernel versions. [moby/moby#44684](https://github.com/moby/moby/pull/44684), [moby/moby#44802](https://github.com/moby/moby/pull/44802) +* libnetwork: Remove unused code related to classic Swarm. [moby/moby#44965](https://github.com/moby/moby/pull/44965) +* libnetwork: Remove usage of the `xt_u32` kernel module from encrypted Swarm overlay networks. [moby/moby#45281](https://github.com/moby/moby/pull/45281) +* Remove support for BuildKit's deprecated `buildinfo` in favor of standard provenance attestations. [moby/moby#45097](https://github.com/moby/moby/pull/45097) +* Remove the deprecated AUFS and legacy `overlay` storage drivers. [moby/moby#45342](https://github.com/moby/moby/pull/45342), [moby/moby#45359](https://github.com/moby/moby/pull/45359) +* Remove the deprecated `overlay2.override_kernel_check` storage driver option. [moby/moby#45368](https://github.com/moby/moby/pull/45368) +* Remove workarounds for obsolete versions of `apparmor_parser` from the AppArmor profiles. [moby/moby#45500](https://github.com/moby/moby/pull/45500) +* API: `GET /images/json` no longer represents empty RepoTags and RepoDigests as`:`/`@`. Empty arrays are returned instead on API >= 1.43. [moby/moby#45068](https://github.com/moby/moby/pull/45068) + +### [Deprecated](#deprecated) + +* Deprecate the `--oom-score-adjust` daemon option. [moby/moby#45315](https://github.com/moby/moby/pull/45315) +* API: Deprecate the `VirtualSize` field in `GET /images/json` and `GET /images/{id}/json`. [moby/moby#45346](https://github.com/moby/moby/pull/45346) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-8) + +* The `docker stack` command no longer validates the `build` section of Compose files. [docker/cli#4214](https://github.com/docker/cli/pull/4214) +* Fix lingering healthcheck processes after the timeout is reached. [moby/moby#43739](https://github.com/moby/moby/pull/43739) +* Reduce the overhead of container startup when using the `overlay2` storage driver. [moby/moby#44285](https://github.com/moby/moby/pull/44285) +* API: Handle multiple `before=` and `since=` filters in `GET /images`. [moby/moby#44503](https://github.com/moby/moby/pull/44503) +* Fix numerous bugs in the embedded DNS resolver implementation used by user-defined networks. [moby/moby#44664](https://github.com/moby/moby/pull/44664) +* Add `execDuration` field to the map of event attributes. [moby/moby#45494](https://github.com/moby/moby/pull/45494) +* Swarm-level networks can now be created with the Windows `internal`, `l2bridge`, and `nat` drivers. [moby/swarmkit#3121](https://github.com/moby/swarmkit/pull/3121), [moby/moby#45291](https://github.com/moby/moby/pull/45291) + +### [Packaging updates](#packaging-updates-8) + +* Update Go to `1.20.4`. [docker/cli#4253](https://github.com/docker/cli/pull/4253), [moby/moby#45456](https://github.com/moby/moby/pull/45456), [docker/docker-ce-packaging#888](https://github.com/docker/docker-ce-packaging/pull/888) +* Update `containerd` to [`v1.7.1`](https://github.com/containerd/containerd/releases/tag/v1.7.1). [moby/moby#45537](https://github.com/moby/moby/pull/45537) +* Update `buildkit` to [`v0.11.6`](https://github.com/moby/buildkit/releases/v0.11.6). [moby/moby#45367](https://github.com/moby/moby/pull/45367) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_24.0.1.md b/corpus/changelog/docker_engine_releases/docker_engine_24.0.1.md new file mode 100644 index 0000000000000000000000000000000000000000..50c98acd0c50d000b5142776de5b140e6158782d --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_24.0.1.md @@ -0,0 +1,29 @@ +# Docker Engine 24.0.1 release notes + +Source: https://docs.docker.com/engine/release-notes/24.0/ + +## [24.0.1](#2401) + +*2023-05-19* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 24.0.1 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A24.0.1) +* [moby/moby, 24.0.1 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A24.0.1) + +### [Removed](#removed) + +* Remove CLI completions for storage drivers removed in the 24.0 major release. [docker/cli#4302](https://github.com/docker/cli/pull/4302) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-7) + +* Fix an issue where DNS query NXDOMAIN replies from external servers were forwarded to the client as SERVFAIL. [moby/moby#45573](https://github.com/moby/moby/pull/45573) +* Fix an issue where `docker pull --platform` would report `No such image` regarding another tag pointing to the same image. [moby/moby#45562](https://github.com/moby/moby/pull/45562) +* Fix an issue where insecure registry configuration would be forgotten during config reload. [moby/moby#45571](https://github.com/moby/moby/pull/45571) +* containerd image store: Fix an issue where images which have no layers would not be listed in `docker images -a` [moby/moby#45588](https://github.com/moby/moby/pull/45588) +* API: Fix an issue where `GET /images/{id}/json` would return `null` instead of empty `RepoTags` and `RepoDigests`. [moby/moby#45564](https://github.com/moby/moby/pull/45564) +* API: Fix an issue where `POST /commit` did not accept an empty request body. [moby/moby#45568](https://github.com/moby/moby/pull/45568) + +### [Packaging updates](#packaging-updates-7) + +* Upgrade Compose to `v2.18.1`. [docker/docker-ce-packaging#896](https://github.com/docker/docker-ce-packaging/pull/896) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_24.0.2.md b/corpus/changelog/docker_engine_releases/docker_engine_24.0.2.md new file mode 100644 index 0000000000000000000000000000000000000000..d8692bc38844ec701014bc8955a20cda27bb8b8c --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_24.0.2.md @@ -0,0 +1,26 @@ +# Docker Engine 24.0.2 release notes + +Source: https://docs.docker.com/engine/release-notes/24.0/ + +## [24.0.2](#2402) + +*2023-05-26* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 24.0.2 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A24.0.2) +* [moby/moby, 24.0.2 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A24.0.2) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-6) + +* Fix a panic during build when referencing locally tagged images. [moby/buildkit#3899](https://github.com/moby/buildkit/pull/3899), [moby/moby#45582](https://github.com/moby/moby/pull/45582) +* Fix builds potentially failing with `exit code: 4294967295` when performing many concurrent build stages. [moby/moby#45620](https://github.com/moby/moby/pull/45620) +* Fix DNS resolution on Windows ignoring `etc/hosts` (`%WINDIR%\System32\Drivers\etc\hosts`), including resolution of `localhost`. [moby/moby#45562](https://github.com/moby/moby/pull/45562) +* Apply a workaround for a containerd bug that causes concurrent `docker exec` commands to take significantly longer than expected. [moby/moby#45625](https://github.com/moby/moby/pull/45625) +* containerd image store: Fix an issue where the image `Created` field would contain an incorrect value. [moby/moby#45623](https://github.com/moby/moby/pull/45623) +* containerd image store: Adjust the output of image pull progress so that the output has the same format regardless of whether the containerd image store is enabled. [moby/moby#45602](https://github.com/moby/moby/pull/45602) +* containerd image store: Switching between the default and containerd image store now requires a daemon restart. [moby/moby#45616](https://github.com/moby/moby/pull/45616) + +### [Packaging updates](#packaging-updates-6) + +* Upgrade Buildx to `v0.10.5`. [docker/docker-ce-packaging#900](https://github.com/docker/docker-ce-packaging/pull/900) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_24.0.3.md b/corpus/changelog/docker_engine_releases/docker_engine_24.0.3.md new file mode 100644 index 0000000000000000000000000000000000000000..3cf598fba5f733cf3694a2bc19c584513667d107 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_24.0.3.md @@ -0,0 +1,47 @@ +# Docker Engine 24.0.3 release notes + +Source: https://docs.docker.com/engine/release-notes/24.0/ + +## [24.0.3](#2403) + +*2023-07-06* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 24.0.3 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A24.0.3) +* [moby/moby, 24.0.3 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A24.0.3) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-5) + +* containerd image store: Fix an issue where multi-platform images that did not include a manifest for the default platform could not be interacted with. [moby/moby#45849](https://github.com/moby/moby/pull/45849) +* containerd image store: Fix specious attempts to cache `FROM scratch` in container builds. [moby/moby#45822](https://github.com/moby/moby/pull/45822) +* containerd image store: Fix `docker cp` with snapshotters that cannot mount the same content multiple times. [moby/moby#45780](https://github.com/moby/moby/pull/45780), [moby/moby#45786](https://github.com/moby/moby/pull/45786) +* containerd image store: Fix builds with `type=image` not being correctly unpacked/stored. [moby/moby#45692](https://github.com/moby/moby/pull/45692) +* containerd image store: Fix incorrectly attempting to unpack pseudo-images (including attestations) in `docker load`. [moby/moby#45688](https://github.com/moby/moby/pull/45688) +* containerd image store: Correctly set the user agent, and include additional information like the snapshotter when interacting with registries. [moby/moby#45671](https://github.com/moby/moby/pull/45671), [moby/moby#45684](https://github.com/moby/moby/pull/45684) +* containerd image store: Fix a failure to unpack already-pulled content after switching between snapshotters. [moby/moby#45678](https://github.com/moby/moby/pull/45678) +* containerd image store: Fix images that have been re-tagged or with all tags removed being pruned while still in use. [moby/moby#45857](https://github.com/moby/moby/pull/45857) +* Fix a Swarm CSI issue where the Topology field was not propagated into NodeCSIInfo. [moby/moby#45810](https://github.com/moby/moby/pull/45810) +* Fix failures to add new Swarm managers caused by a very large raft log. [moby/moby#45703](https://github.com/moby/moby/pull/45703), [moby/swarmkit#3122](https://github.com/moby/swarmkit/pull/3122), [moby/swarmkit#3128](https://github.com/moby/swarmkit/pull/3128) +* `name_to_handle_at(2)` is now always allowed in the default seccomp profile. [moby/moby#45833](https://github.com/moby/moby/pull/45833) +* Fix an issue that prevented encrypted Swarm overlay networks from working on ports other than the default (4789). [moby/moby#45637](https://github.com/moby/moby/pull/45637) +* Fix a failure to restore mount reference-counts during live-restore. [moby/moby#45824](https://github.com/moby/moby/pull/45824) +* Fix various networking-related failures during live-restore. [moby/moby#45658](https://github.com/moby/moby/pull/45658), [moby/moby#45659](https://github.com/moby/moby/pull/45659) +* Fix running containers restoring with a zero (successful) exit status when the daemon is unexpectedly terminated. [moby/moby#45801](https://github.com/moby/moby/pull/45801) +* Fix a potential panic while executing healthcheck probes. [moby/moby#45798](https://github.com/moby/moby/pull/45798) +* Fix a panic caused by a race condition in container exec start. [moby/moby#45794](https://github.com/moby/moby/pull/45794) +* Fix an exception caused by attaching a terminal to an exec with a non-existent command. [moby/moby#45643](https://github.com/moby/moby/pull/45643) +* Fix `host-gateway` with BuildKit by passing the IP as a label (also requires [docker/buildx#1894](https://github.com/docker/buildx/pull/1894)). [moby/moby#45790](https://github.com/moby/moby/pull/45790) +* Fix an issue where `POST /containers/{id}/stop` would forcefully terminate the container when the request was canceled, instead of waiting until the specified timeout for a 'graceful' stop. [moby/moby#45774](https://github.com/moby/moby/pull/45774) +* Fix an issue where `docker cp -a` from the root (`/`) directory would fail. [moby/moby#45748](https://github.com/moby/moby/pull/45748) +* Improve compatibility with non-runc container runtimes by more correctly setting resource constraint parameters in the OCI config. [moby/moby#45746](https://github.com/moby/moby/pull/45746) +* Fix an issue caused by overlapping subuid/subgid ranges in certain configurations (e.g. LDAP) in rootless mode. [moby/moby#45747](https://github.com/moby/moby/pull/45747), [rootless-containers/rootlesskit#369](https://github.com/rootless-containers/rootlesskit/pull/369) +* Greatly reduce CPU and memory usage while populating the Debug section of `GET /info`. [moby/moby#45856](https://github.com/moby/moby/pull/45856) +* Fix an issue where debug information was not correctly printed during `docker info` when only the client is in debug mode. [docker/cli#4393](https://github.com/docker/cli/pull/4393) +* Fix issues related to hung connections when connecting to hosts over a SSH connection. [docker/cli#4395](https://github.com/docker/cli/pull/4395) + +### [Packaging updates](#packaging-updates-5) + +* Upgrade Go to `go1.20.5`. [moby/moby#45745](https://github.com/moby/moby/pull/45745), [docker/cli#4351](https://github.com/docker/cli/pull/4351), [docker/docker-ce-packaging#904](https://github.com/docker/docker-ce-packaging/pull/904) +* Upgrade Compose to `v2.19.1`. [docker/docker-ce-packaging#916](https://github.com/docker/docker-ce-packaging/pull/916) +* Upgrade buildx to `v0.11.1`. [docker/docker-ce-packaging#918](https://github.com/docker/docker-ce-packaging/pull/918) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_24.0.4.md b/corpus/changelog/docker_engine_releases/docker_engine_24.0.4.md new file mode 100644 index 0000000000000000000000000000000000000000..229400821755be3d929282e873fe370447d783a7 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_24.0.4.md @@ -0,0 +1,16 @@ +# Docker Engine 24.0.4 release notes + +Source: https://docs.docker.com/engine/release-notes/24.0/ + +## [24.0.4](#2404) + +*2023-07-07* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 24.0.4 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A24.0.4) +* [moby/moby, 24.0.4 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A24.0.4) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-4) + +* Fix a regression introduced during 24.0.3 that causes a panic during live-restore of containers with bind mounts. [moby/moby#45903](https://github.com/moby/moby/pull/45903) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_24.0.5.md b/corpus/changelog/docker_engine_releases/docker_engine_24.0.5.md new file mode 100644 index 0000000000000000000000000000000000000000..042b0d8f977b7165dd56ad828173249f69cdfc3c --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_24.0.5.md @@ -0,0 +1,32 @@ +# Docker Engine 24.0.5 release notes + +Source: https://docs.docker.com/engine/release-notes/24.0/ + +## [24.0.5](#2405) + +*2023-07-24* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 24.0.5 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A24.0.5) +* [moby/moby, 24.0.5 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A24.0.5) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-3) + +* The Go client now avoids using UNIX socket paths in the HTTP `Host:` header, in order to be compatible with changes introduced in `go1.20.6`. [moby/moby#45962](https://github.com/moby/moby/pull/45962), [moby/moby#45990](https://github.com/moby/moby/pull/45990) +* containerd storage backend: Fix `Variant` not being included in `docker image inspect` and `GET /images/{name}/json`. [moby/moby#46025](https://github.com/moby/moby/pull/46025) +* containerd storage backend: Prevent potential garbage collection of content during image export. [moby/moby#46021](https://github.com/moby/moby/pull/46021) +* containerd storage backend: Prevent duplicate digest entries in `RepoDigests`. [moby/moby#46014](https://github.com/moby/moby/pull/46014) +* containerd storage backend: Fix operations taking place against the incorrect tag when working with an image referenced by tag and digest. [moby/moby#46013](https://github.com/moby/moby/pull/46013) +* containerd storage backend: Fix a panic caused by `EXPOSE` when building containers with the legacy builder. [moby/moby#45921](https://github.com/moby/moby/pull/45921) +* Fix a regression causing unintuitive errors to be returned when attempting to create an `overlay` network on a non-Swarm node. [moby/moby#45974](https://github.com/moby/moby/pull/45974) +* Properly report errors parsing volume specifications from the command line. [docker/cli#4423](https://github.com/docker/cli/pull/4423) +* Fix a panic caused when `auths: null` is found in the CLI config file. [docker/cli#4450](https://github.com/docker/cli/pull/4450) + +### [Packaging updates](#packaging-updates-4) + +* Use init scripts as provided by in moby/moby `contrib/init`. [docker/docker-ce-packaging#914](https://github.com/docker/docker-ce-packaging/pull/914), [docker/docker-ce-packaging#926](https://github.com/docker/docker-ce-packaging/pull/926) +* Drop Upstart from `contrib/init`. [moby/moby#46044](https://github.com/moby/moby/pull/46044) +* Upgrade Go to `go1.20.6`. [docker/cli#4428](https://github.com/docker/cli/pull/4428), [moby/moby#45970](https://github.com/moby/moby/pull/45970), [docker/docker-ce-packaging#921](https://github.com/docker/docker-ce-packaging/pull/921) +* Upgrade Compose to `v2.20.2`. [docker/docker-ce-packaging#924](https://github.com/docker/docker-ce-packaging/pull/924) +* Upgrade buildx to `v0.11.2`. [docker/docker-ce-packaging#922](https://github.com/docker/docker-ce-packaging/pull/922) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_24.0.6.md b/corpus/changelog/docker_engine_releases/docker_engine_24.0.6.md new file mode 100644 index 0000000000000000000000000000000000000000..0312c2b2587c0b1a99e00dc0f19354fdcc27899f --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_24.0.6.md @@ -0,0 +1,38 @@ +# Docker Engine 24.0.6 release notes + +Source: https://docs.docker.com/engine/release-notes/24.0/ + +## [24.0.6](#2406) + +*2023-09-05* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 24.0.6 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A24.0.6) +* [moby/moby, 24.0.6 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A24.0.6) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-2) + +* containerd storage backend: Fix `docker ps` failing when a container image is no longer present in the content store. [moby/moby#46095](https://github.com/moby/moby/pull/46095) +* containerd storage backend: Fix `docker ps -s -a` and `docker container prune` failing when a container image config is no longer present in the content store. [moby/moby#46097](https://github.com/moby/moby/pull/46097) +* containerd storage backend: Fix `docker inspect` failing when a container image config is no longer (or was never) present in the content store. [moby/moby#46244](https://github.com/moby/moby/pull/46244) +* containerd storage backend: Fix diff and export with the `overlayfs` snapshotter by using reference-counted rootfs mounts. [moby/moby#46266](https://github.com/moby/moby/pull/46266) +* containerd storage backend: Fix a misleading error message when the image platforms available locally do not match the desired platform. [moby/moby#46300](https://github.com/moby/moby/pull/46300) +* containerd storage backend: Fix the `FROM scratch` Dockerfile instruction with the classic builder. [moby/moby#46302](https://github.com/moby/moby/pull/46302) +* containerd storage backend: Fix `mismatched image rootfs and manifest layers` errors with the classic builder. [moby/moby#46310](https://github.com/moby/moby/pull/46310) +* Warn when pulling Docker Image Format v1, and Docker Image manifest version 2, schema 1 images from all registries. [moby/moby#46290](https://github.com/moby/moby/pull/46290) +* Fix live-restore of volumes with custom volume options. [moby/moby#46366](https://github.com/moby/moby/pull/46366) +* Fix incorrectly dropping capabilities bits when running a container as a non-root user (note: this change was already effectively present due to a regression). [moby/moby#46221](https://github.com/moby/moby/pull/46221) +* Fix network isolation iptables rules preventing IPv6 Neighbor Solicitation packets from being exchanged between containers. [moby/moby#46214](https://github.com/moby/moby/pull/46214) +* Fix `dockerd.exe --register-service` not working when the binary is in the current directory on Windows. [moby/moby#46215](https://github.com/moby/moby/pull/46215) +* Add a hint suggesting the use of a PAT to `docker login` against Docker Hub. [docker/cli#4500](https://github.com/docker/cli/pull/4500) +* Improve shell startup time for users of Bash completion for the CLI. [docker/cli#4517](https://github.com/docker/cli/pull/4517) +* Improve the speed of some commands by skipping `GET /_ping` when possible. [docker/cli#4508](https://github.com/docker/cli/pull/4508) +* Fix credential scopes when using a PAT to `docker manifest inspect` an image on Docker Hub. [docker/cli#4512](https://github.com/docker/cli/pull/4512) +* Fix `docker events` not supporting `--format=json`. [docker/cli#4544](https://github.com/docker/cli/pull/4544) + +### [Packaging updates](#packaging-updates-3) + +* Upgrade Go to `go1.20.7`. [moby/moby#46140](https://github.com/moby/moby/pull/46140), [docker/cli#4476](https://github.com/docker/cli/pull/4476), [docker/docker-ce-packaging#932](https://github.com/docker/docker-ce-packaging/pull/932) +* Upgrade containerd to `v1.7.3` (static binaries only). [moby/moby#46103](https://github.com/moby/moby/pull/46103) +* Upgrade Compose to `v2.21.0`. [docker/docker-ce-packaging#936](https://github.com/docker/docker-ce-packaging/pull/936) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_24.0.7.md b/corpus/changelog/docker_engine_releases/docker_engine_24.0.7.md new file mode 100644 index 0000000000000000000000000000000000000000..813d908e9b40b9441a1c94615ae8b30b80510bad --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_24.0.7.md @@ -0,0 +1,45 @@ +# Docker Engine 24.0.7 release notes + +Source: https://docs.docker.com/engine/release-notes/24.0/ + +## [24.0.7](#2407) + +*2023-10-27* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 24.0.7 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A24.0.7) +* [moby/moby, 24.0.7 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A24.0.7) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-1) + +* Write overlay2 layer metadata atomically. [moby/moby#46703](https://github.com/moby/moby/pull/46703) +* Fix "Rootful-in-Rootless" Docker-in-Docker on systemd version 250 and later. [moby/moby#46626](https://github.com/moby/moby/pull/46626) +* Fix `dockerd-rootless-setuptools.sh` when username contains a backslash. [moby/moby#46407](https://github.com/moby/moby/pull/46407) +* Fix a bug that would prevent network sandboxes to be fully deleted when stopping containers with no network attachments and when `dockerd --bridge=none` is used. [moby/moby#46702](https://github.com/moby/moby/pull/46702) +* Fix a bug where cancelling an API request could interrupt container restart. [moby/moby#46697](https://github.com/moby/moby/pull/46697) +* Fix an issue where containers would fail to start when providing `--ip-range` with a range larger than the subnet. [docker/for-mac#6870](https://github.com/docker/for-mac/issues/6870) +* Fix data corruption with zstd output. [moby/moby#46709](https://github.com/moby/moby/pull/46709) +* Fix the conditions under which the container's MAC address is applied. [moby/moby#46478](https://github.com/moby/moby/pull/46478) +* Improve the performance of the stats collector. [moby/moby#46448](https://github.com/moby/moby/pull/46448) +* Fix an issue with source policy rules ending up in the wrong order. [moby/moby#46441](https://github.com/moby/moby/pull/46441) + +### [Packaging updates](#packaging-updates-2) + +* Add support for Fedora 39 and Ubuntu 23.10. [docker/docker-ce-packaging#940](https://github.com/docker/docker-ce-packaging/pull/940), [docker/docker-ce-packaging#955](https://github.com/docker/docker-ce-packaging/pull/955) +* Fix `docker.socket` not getting disabled when uninstalling the `docker-ce` RPM package. [docker/docker-ce-packaging#852](https://github.com/docker/docker-ce-packaging/pull/852) +* Upgrade Go to `go1.20.10`. [docker/docker-ce-packaging#951](https://github.com/docker/docker-ce-packaging/pull/951) +* Upgrade containerd to `v1.7.6` (static binaries only). [moby/moby#46103](https://github.com/moby/moby/pull/46103) +* Upgrade the `containerd.io` package to [`v1.6.24`](https://github.com/containerd/containerd/releases/tag/v1.6.24). + +### [Security](#security-1) + +* Deny containers access to `/sys/devices/virtual/powercap` by default. This change hardens against + [CVE-2020-8694](https://scout.docker.com/v/CVE-2020-8694), + [CVE-2020-8695](https://scout.docker.com/v/CVE-2020-8695), and + [CVE-2020-12912](https://scout.docker.com/v/CVE-2020-12912), + and an attack known as [the PLATYPUS attack](https://platypusattack.com/). + + For more details, see + [advisory](https://github.com/moby/moby/security/advisories/GHSA-jq35-85cj-fj4p), + [commit](https://github.com/moby/moby/commit/c9ccbfad11a60e703e91b6cca4f48927828c7e35). diff --git a/corpus/changelog/docker_engine_releases/docker_engine_24.0.8.md b/corpus/changelog/docker_engine_releases/docker_engine_24.0.8.md new file mode 100644 index 0000000000000000000000000000000000000000..275502e2fad58a646f2d3d02d432cd474839a4a1 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_24.0.8.md @@ -0,0 +1,22 @@ +# Docker Engine 24.0.8 release notes + +Source: https://docs.docker.com/engine/release-notes/24.0/ + +## [24.0.8](#2408) + +*2024-01-25* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 24.0.8 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A24.0.8) +* [moby/moby, 24.0.8 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A24.0.8) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements) + +* Live restore: Containers with auto remove (`docker run --rm`) are no longer forcibly removed on engine restart. [moby/moby#46857](https://github.com/moby/moby/pull/46869) + +### [Packaging updates](#packaging-updates-1) + +* Upgrade Go to `go1.20.13`. [moby/moby#47054](https://github.com/moby/moby/pull/47054), [docker/cli#4826](https://github.com/docker/cli/pull/4826), [docker/docker-ce-packaging#975](https://github.com/docker/docker-ce-packaging/pull/975) +* Upgrade containerd (static binaries only) to [v1.7.12](https://github.com/containerd/containerd/releases/tag/v1.7.12) [moby/moby#47096](https://github.com/moby/moby/pull/47096) +* Upgrade runc to v1.1.11. [moby/moby#47010](https://github.com/moby/moby/pull/47010) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_24.0.9.md b/corpus/changelog/docker_engine_releases/docker_engine_24.0.9.md new file mode 100644 index 0000000000000000000000000000000000000000..ee492059c6bd217c8a3b09b2ead743ba2d5f8cb5 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_24.0.9.md @@ -0,0 +1,12 @@ +# Docker Engine 24.0.9 release notes + +Source: https://docs.docker.com/engine/release-notes/24.0/ + +## [24.0.9](#2409) + +*2024-01-31* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 24.0.9 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A24.0.9) +* [moby/moby, 24.0.9 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A24.0.9) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_25.0.0.md b/corpus/changelog/docker_engine_releases/docker_engine_25.0.0.md new file mode 100644 index 0000000000000000000000000000000000000000..4ab1851e9fe632527f44c902f755fc939bba8c23 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_25.0.0.md @@ -0,0 +1,180 @@ +# Docker Engine 25.0.0 release notes + +Source: https://docs.docker.com/engine/release-notes/25.0/ + +## [25.0.0](#2500) + +*2024-01-19* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 25.0.0 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A25.0.0) +* [moby/moby, 25.0.0 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A25.0.0) + +> Note +> +> In earlier versions of Docker Engine, recursive mounts (submounts) would +> always be mounted as writable, even when specifying a read-only mount. This +> behavior has changed in v25.0.0, for hosts running on kernel version 5.12 or +> later. Now, read-only bind mounts are **recursively read-only** by default. +> +> To get the same behavior as earlier releases, you can specify the +> `bind-recursive` option for the `--mount` flag. +> +> ``` +> $ docker run --mount type=bind,src=SRC,dst=DST,readonly,bind-recursive=writable IMAGE +> ``` +> +> This option isn't supported with the `-v` or `--volume` flag. +> For more information, see +> [Recursive mounts](https://docs.docker.com/engine/storage/bind-mounts/#recursive-mounts). + +### [New](#new) + +* The daemon now uses systemd's default `LimitNOFILE`. In earlier versions of + Docker Engine, this limit was set to `infinity`. This would cause issues with + recent versions of systemd, where the hard limit was increased, causing + programs that adjusted their behaviors based on ulimits to consume a high + amount of memory. [moby/moby#45534](https://github.com/moby/moby/pull/45534) + + The new setting makes containers behave the same way as programs running on + the host, but may cause programs that make incorrect assumptions based on the + soft limit to misbehave. To get the previous behavior, you can set + `LimitNOFILE=1048576`. + + This change currently only affects build containers created with `docker build` when using BuildKit with the `docker` driver. Starting with Docker + Engine v29.0 (containerd v2.1.5), this limit applies to all containers, not + only build containers. + + If you're experiencing issues with the higher ulimit in systemd v240 or later, + consider adding a system `drop-in` or `override` file to configure the ulimit + settings for your setup. The [Flatcar Container Linux documentation](https://www.flatcar.org/docs/latest/setup/systemd/drop-in-units/) + has a great article covering this topic in detail. +* Add OpenTelemetry tracing. [moby/moby#45652](https://github.com/moby/moby/pull/45652), [moby/moby#45579](https://github.com/moby/moby/pull/45579) +* Add support for CDI devices under Linux. [moby/moby#45134](https://github.com/moby/moby/pull/45134), [docker/cli#4510](https://github.com/docker/cli/pull/4510), [moby/moby#46004](https://github.com/moby/moby/pull/46004) +* Add an additional interval to be used by healthchecks during the container start period. [moby/moby#40894](https://github.com/moby/moby/pull/40894), [docker/cli#4405](https://github.com/docker/cli/pull/4405), [moby/moby#45965](https://github.com/moby/moby/pull/45965) +* Add a `--log-format` flag to `dockerd` to control the logging format: text (default) or JSON. [moby/moby#45737](https://github.com/moby/moby/pull/45737) +* Add support for recursive read-only mounts. [moby/moby#45278](https://github.com/moby/moby/pull/45278), [moby/moby#46037](https://github.com/moby/moby/pull/46037) +* Add support for filtering images based on timestamp with `docker image ls --filter=until=`. [moby/moby#46577](https://github.com/moby/moby/pull/46577) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-4) + +* API: Fix error message for invalid policies at `ValidateRestartPolicy`. [moby/moby#46352](https://github.com/moby/moby/pull/46352) +* API: Update `/info` endpoint to use singleflight. [moby/moby#45847](https://github.com/moby/moby/pull/45847) +* Add an error message for when specifying a Dockerfile filename with `-f`, and also using `stdin`. [docker/cli#4346](https://github.com/docker/cli/pull/4346) +* Add support for `mac-address` and `link-local-ip` fields in `--network` long format. [docker/cli#4419](https://github.com/docker/cli/pull/4419) +* Add support for specifying multiple `--network` flags with `docker container create` and `docker run`. [moby/moby#45906](https://github.com/moby/moby/pull/45906) +* Automatically enable IPv6 on a network when an IPv6 subnet is specified. [moby/moby#46455](https://github.com/moby/moby/pull/46455) +* Add support for overlay networks over IPv6 transport. [moby/moby#46790](https://github.com/moby/moby/pull/46790) +* Configuration reloading is now more robust: if there's an error during the configuration reload process, no configuration changes are applied. [moby/moby#43980](https://github.com/moby/moby/pull/43980) +* Live restore: Containers with auto remove (`docker run --rm`) are no longer forcibly removed on engine restart. [moby/moby#46857](https://github.com/moby/moby/pull/46857) +* Live restore: containers that are live-restored will now be given another health-check start period when the daemon restarts. [moby/moby#47051](https://github.com/moby/moby/pull/47051) +* Container health status is flushed to disk less frequently, reducing wear on flash storage. [moby/moby#47044](https://github.com/moby/moby/pull/47044) +* Ensure network names are unique. [moby/moby#46251](https://github.com/moby/moby/pull/46251) +* Ensure that overlay2 layer metadata is correct. [moby/moby#46471](https://github.com/moby/moby/pull/46471) +* Fix `Downloading` progress message on image pull. [moby/moby#46515](https://github.com/moby/moby/pull/46515) +* Fix `NetworkConnect` and `ContainerCreate` with improved data validation, and return all validation errors at once. [moby/moby#46183](https://github.com/moby/moby/pull/46183) +* Fix `com.docker.network.host_ipv4` option when IPv6 and ip6tables are enabled. [moby/moby#46446](https://github.com/moby/moby/pull/46446) +* Fix daemon's `cleanupContainer` if containerd is stopped. [moby/moby#46213](https://github.com/moby/moby/pull/46213) +* Fix returning incorrect HTTP status codes for libnetwork errors. [moby/moby#46146](https://github.com/moby/moby/pull/46146) +* Fix various issues with images/json API filters and image list. [moby/moby#46034](https://github.com/moby/moby/pull/46034) +* CIFS volumes now resolves FQDN correctly. [moby/moby#46863](https://github.com/moby/moby/pull/46863) +* Improve validation of the `userland-proxy-path` daemon configuration option. Validation now happens during daemon startup, instead of producing an error when starting a container with port-mapping. [moby/moby#47000](https://github.com/moby/moby/pull/47000) +* Set the MAC address of container's interface when network mode is a short network ID. [moby/moby#46406](https://github.com/moby/moby/pull/46406) +* Sort unconsumed build arguments before display in build output. [moby/moby#45917](https://github.com/moby/moby/pull/45917) +* The `docker image save` tarball output is now OCI compliant. [moby/moby#44598](https://github.com/moby/moby/pull/44598) +* The daemon no longer appends `ACCEPT` rules to the end of the `INPUT` iptables chain for encrypted overlay networks. Depending on firewall configuration, a rule may be needed to permit incoming encrypted overlay network traffic. [moby/moby#45280](https://github.com/moby/moby/pull/45280) +* Unpacking layers with extended attributes onto an incompatible filesystem will now fail instead of silently discarding extended attributes. [moby/moby#45464](https://github.com/moby/moby/pull/45464) +* Update daemon MTU option to BridgeConfig and display warning on Windows. [moby/moby#45887](https://github.com/moby/moby/pull/45887) +* Validate IPAM config when creating a network. Automatically fix networks created prior to this release where `--ip-range` is larger than `--subnet`. [moby/moby#45759](https://github.com/moby/moby/pull/45759) +* Containers connected only to internal networks will now have no default route set, making the `connect` syscall fail-fast. [moby/moby#46603](https://github.com/moby/moby/pull/46603) +* containerd image store: Add image events for `push`, `pull`, and `save`. [moby/moby#46405](https://github.com/moby/moby/pull/46405) +* containerd image store: Add support for pulling legacy schema1 images. [moby/moby#46513](https://github.com/moby/moby/pull/46513) +* containerd image store: Add support for pushing all tags. [moby/moby#46485](https://github.com/moby/moby/pull/46485) +* containerd image store: Add support for registry token. [moby/moby#46475](https://github.com/moby/moby/pull/46475) +* containerd image store: Add support for showing the number of containers that use an image. [moby/moby#46511](https://github.com/moby/moby/pull/46511) +* containerd image store: Fix a bug related to the `ONBUILD`, `MAINTAINER`, and `HEALTHCHECK` Dockerfile instructions. [moby/moby#46313](https://github.com/moby/moby/pull/46313) +* containerd image store: Fix `Pulling from` progress message. [moby/moby#46494](https://github.com/moby/moby/pull/46494) +* containerd image store: Add support for referencing images via the truncated ID with `sha256:` prefix. [moby/moby#46435](https://github.com/moby/moby/pull/46435) +* containerd image store: Fix `docker images` showing intermediate layers by default. [moby/moby#46423](https://github.com/moby/moby/pull/46423) +* containerd image store: Fix checking if the specified platform exists when getting an image. [moby/moby#46495](https://github.com/moby/moby/pull/46495) +* containerd image store: Fix errors when multiple `ADD` or `COPY` instructions were used with the classic builder. [moby/moby#46383](https://github.com/moby/moby/pull/46383) +* containerd image store: Fix stack overflow errors when importing an image. [moby/moby#46418](https://github.com/moby/moby/pull/46418) +* containerd image store: Improve `docker pull` progress output. [moby/moby#46412](https://github.com/moby/moby/pull/46412) +* containerd image store: Print the tag, digest, and size after pushing an image. [moby/moby#46384](https://github.com/moby/moby/pull/46384) +* containerd image store: Remove panic from `UpdateConfig`. [moby/moby#46433](https://github.com/moby/moby/pull/46433) +* containerd image store: Return an error when an image tag resembles a digest. [moby/moby#46492](https://github.com/moby/moby/pull/46492) +* containerd image store: `docker image ls` now shows the correct image creation time and date. [moby/moby#46719](https://github.com/moby/moby/pull/46719) +* containerd image store: Fix an issue handling user namespace settings. [moby/moby#46375](https://github.com/moby/moby/pull/46375) +* containerd image store: Add support for pulling all tags (`docker pull -a`). [moby/moby#46618](https://github.com/moby/moby/pull/46618) +* containerd image store: Use the domain name in the image reference as the default registry authentication domain. [moby/moby#46779](https://github.com/moby/moby/pull/46779) + +### [Packaging updates](#packaging-updates-4) + +* Upgrade API to v1.44. [moby/moby#45468](https://github.com/moby/moby/pull/45468) +* Upgrade Compose to `2.24.1`. [docker/docker-ce-packaging#980](https://github.com/docker/docker-ce-packaging/pull/980) +* Upgrade containerd to v1.7.12 (static binaries only). [moby/moby#47070](https://github.com/moby/moby/pull/47070) +* Upgrade Go runtime to [1.21.6](https://go.dev/doc/devel/release#go1.21.minor). [moby/moby#47053](https://github.com/moby/moby/pull/47053) +* Upgrade runc to v1.1.11. [moby/moby#47007](https://github.com/moby/moby/pull/47007) +* Upgrade BuildKit to v0.12.4. [moby/moby#46882](https://github.com/moby/moby/pull/46882) +* Upgrade Buildx to v0.12.1. [docker/docker-ce-packaging#979](https://github.com/docker/docker-ce-packaging/pull/979) + +### [Removed](#removed) + +* API: Remove VirtualSize field for the `GET /images/json` and `GET /images/{id}/json` endpoints. [moby/moby#45469](https://github.com/moby/moby/pull/45469) +* Remove deprecated `devicemapper` storage driver. [moby/moby#43637](https://github.com/moby/moby/pull/43637) +* Remove deprecated orchestrator options. [docker/cli#4366](https://github.com/docker/cli/pull/4366) +* Remove support for Debian Upstart init system. [moby/moby#45548](https://github.com/moby/moby/pull/45548), [moby/moby#45551](https://github.com/moby/moby/pull/45551) +* Remove the `--oom-score-adjust` daemon option. [moby/moby#45484](https://github.com/moby/moby/pull/45484) +* Remove warning for deprecated `~/.dockercfg` file. [docker/cli#4281](https://github.com/docker/cli/pull/4281) +* Remove `logentries` logging driver. [moby/moby#46925](https://github.com/moby/moby/pull/46925) + +### [Deprecated](#deprecated) + +* Deprecate API versions older than 1.24. [Deprecation notice](https://docs.docker.com/engine/deprecated/#deprecate-legacy-api-versions) +* Deprecate `IsAutomated` field and `is-automated` filter for `docker search`. [Deprecation notice](https://docs.docker.com/engine/deprecated/#isautomated-field-and-is-automated-filter-on-docker-search) +* API: Deprecate `Container` and `ContainerConfig` properties for `/images/{id}/json` (`docker image inspect`). [moby/moby#46939](https://github.com/moby/moby/pull/46939) + +### [Known limitations](#known-limitations) + +#### [Extended attributes for tar files](#extended-attributes-for-tar-files) + +In this release, the code that handles `tar` archives was changed to be more +strict and to produce an error when failing to write extended attributes +(`xattr`). The `tar` implementation for macOS generates additional extended +attributes by default when creating tar files. These attribute prefixes aren't +valid Linux `xattr` namespace prefixes, which causes an error when Docker +attempts to process these files. For example, if you try to use a tar file with +an `ADD` Dockerfile instruction, you might see an error message similar to the +following: + +``` +failed to solve: lsetxattr /sftp_key.ppk: operation not supported +``` + +Error messages related to extended attribute validation were improved to +include more context in [v25.0.1](#2501), but the limitation in Docker being +unable to process the files remains. Tar files created with the macOS `tar` +using default arguments will produce an error when the tar file is used with +Docker. + +As a workaround, if you need to use tar files with Docker generated on macOS, +you can either: + +* Use the `--no-xattr` flag for the macOS `tar` command to strip **all** the + extended attributes. If you want to preserve extended attributes, this isn't + a recommended option. +* Install and use `gnu-tar` to create the tarballs on macOS instead of the + default `tar` implementation. To install `gnu-tar` using Homebrew: + + ``` + $ brew install gnu-tar + ``` + + After installing, add the `gnu-tar` binary to your `PATH`, for example by + updating your `.zshrc` file: + + ``` + $ echo 'PATH="/opt/homebrew/opt/gnu-tar/libexec/gnubin:$PATH"' >> ~/.zshrc + $ source ~/.zshrc + ``` diff --git a/corpus/changelog/docker_engine_releases/docker_engine_25.0.1.md b/corpus/changelog/docker_engine_releases/docker_engine_25.0.1.md new file mode 100644 index 0000000000000000000000000000000000000000..7e95856c1432a6f2a1b5d53794cede06c8c7b074 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_25.0.1.md @@ -0,0 +1,29 @@ +# Docker Engine 25.0.1 release notes + +Source: https://docs.docker.com/engine/release-notes/25.0/ + +## [25.0.1](#2501) + +*2024-01-23* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 25.0.1 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A25.0.1) +* [moby/moby, 25.0.1 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A25.0.1) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-3) + +* API: Fix incorrect HTTP status code for containers with an invalid network configuration created before upgrading to Docker Engine v25.0. [moby/moby#47159](https://github.com/moby/moby/pull/47159) +* Ensure that a MAC address based on a container's IP address is re-generated when the container is stopped and restarted, in case the generated IP/MAC addresses have been reused. [moby/moby#47171](https://github.com/moby/moby/pull/47171) +* Fix `host-gateway-ip` not working during build when not set through configuration. [moby/moby#47192](https://github.com/moby/moby/pull/47192) +* Fix a bug that prevented a container from being renamed twice. [moby/moby#47196](https://github.com/moby/moby/pull/47196) +* Fix an issue causing containers to have their short ID added to their network alias when inspecting them. [moby/moby#47182](https://github.com/moby/moby/pull/47182) +* Fix an issue in detecting whether a remote build context is a Git repository. [moby/moby#47136](https://github.com/moby/moby/pull/47136) +* Fix an issue with layers order in OCI manifests. [moby/moby#47150](https://github.com/moby/moby/issues/47150) +* Fix volume mount error when passing an `addr` or `ip` mount option. [moby/moby#47185](https://github.com/moby/moby/pull/47185) +* Improve error message related to extended attributes that can't be set due to improperly namespaced attribute names. [moby/moby#47178](https://github.com/moby/moby/pull/47178) +* Swarm: Fixed `start_interval` not being passed to the container config. [moby/moby#47163](https://github.com/moby/moby/pull/47163) + +### [Packaging updates](#packaging-updates-3) + +* Upgrade Compose to `2.24.2`. [docker/docker-ce-packaging#981](https://github.com/docker/docker-ce-packaging/pull/981) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_25.0.2.md b/corpus/changelog/docker_engine_releases/docker_engine_25.0.2.md new file mode 100644 index 0000000000000000000000000000000000000000..d2d0621377b4ca65bda22735b83c8001a0f0732a --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_25.0.2.md @@ -0,0 +1,51 @@ +# Docker Engine 25.0.2 release notes + +Source: https://docs.docker.com/engine/release-notes/25.0/ + +## [25.0.2](#2502) + +*2024-01-31* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 25.0.2 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A25.0.2) +* [moby/moby, 25.0.2 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A25.0.2) + +### [Security](#security-1) + +This release contains security fixes for the following CVEs +affecting Docker Engine and its components. + +| CVE | Component | Fix version | Severity | +| --- | --- | --- | --- | +| [CVE-2024-21626](https://scout.docker.com/v/CVE-2024-21626) | runc | 1.1.12 | High, CVSS 8.6 | +| [CVE-2024-23651](https://scout.docker.com/v/CVE-2024-23651) | BuildKit | 1.12.5 | High, CVSS 8.7 | +| [CVE-2024-23652](https://scout.docker.com/v/CVE-2024-23652) | BuildKit | 1.12.5 | High, CVSS 8.7 | +| [CVE-2024-23653](https://scout.docker.com/v/CVE-2024-23653) | BuildKit | 1.12.5 | High, CVSS 7.7 | +| [CVE-2024-23650](https://scout.docker.com/v/CVE-2024-23650) | BuildKit | 1.12.5 | Medium, CVSS 5.5 | +| [CVE-2024-24557](https://scout.docker.com/v/CVE-2024-24557) | Docker Engine | 25.0.2 | Medium, CVSS 6.9 | + +The potential impacts of the above vulnerabilities include: + +* Unauthorized access to the host filesystem +* Compromising the integrity of the build cache +* In the case of CVE-2024-21626, a scenario that could lead to full container escape + +For more information about the security issues addressed in this release, +refer to the [blog post](https://www.docker.com/blog/docker-security-advisory-multiple-vulnerabilities-in-runc-buildkit-and-moby/). +For details about each vulnerability, see the relevant security advisory: + +* [CVE-2024-21626](https://github.com/opencontainers/runc/security/advisories/GHSA-xr7r-f8xq-vfvv) +* [CVE-2024-23651](https://github.com/moby/buildkit/security/advisories/GHSA-m3r6-h7wv-7xxv) +* [CVE-2024-23652](https://github.com/moby/buildkit/security/advisories/GHSA-4v98-7qmw-rqr8) +* [CVE-2024-23653](https://github.com/moby/buildkit/security/advisories/GHSA-wr6v-9f75-vh2g) +* [CVE-2024-23650](https://github.com/moby/buildkit/security/advisories/GHSA-9p26-698r-w4hx) +* [CVE-2024-24557](https://github.com/moby/moby/security/advisories/GHSA-xw73-rw38-6vjc) + +### [Packaging updates](#packaging-updates-2) + +* Upgrade containerd to [v1.6.28](https://github.com/containerd/containerd/releases/tag/v1.6.28). +* Upgrade containerd to v1.7.13 (static binaries only). [moby/moby#47280](https://github.com/moby/moby/pull/47280) +* Upgrade runc to v1.1.12. [moby/moby#47269](https://github.com/moby/moby/pull/47269) +* Upgrade Compose to v2.24.5. [docker/docker-ce-packaging#985](https://github.com/docker/docker-ce-packaging/pull/985) +* Upgrade BuildKit to v0.12.5. [moby/moby#47273](https://github.com/moby/moby/pull/47273) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_25.0.3.md b/corpus/changelog/docker_engine_releases/docker_engine_25.0.3.md new file mode 100644 index 0000000000000000000000000000000000000000..d49f33633cb1feef467a7be39a457b09ac6e8220 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_25.0.3.md @@ -0,0 +1,38 @@ +# Docker Engine 25.0.3 release notes + +Source: https://docs.docker.com/engine/release-notes/25.0/ + +## [25.0.3](#2503) + +*2024-02-06* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 25.0.3 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A25.0.3) +* [moby/moby, 25.0.3 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A25.0.3) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-2) + +* containerd image store: Fix a bug where `docker image history` would fail if a manifest wasn't found in the content store. [moby/moby#47348](https://github.com/moby/moby/pull/47348) +* Ensure that a generated MAC address is not restored when a container is restarted, but a configured MAC address is preserved. [moby/moby#47304](https://github.com/moby/moby/pull/47304) + + > Note + > + > + Containers created with Docker Engine version 25.0.0 may have duplicate MAC addresses. + > They must be re-created. + > + Containers with user-defined MAC addresses created with Docker Engine versions 25.0.0 or 25.0.1 + > receive new MAC addresses when started using Docker Engine version 25.0.2. + > They must also be re-created. +* Fix `docker save @` producing an OCI archive with index without manifests. [moby/moby#47294](https://github.com/moby/moby/pull/47294) +* Fix a bug preventing bridge networks from being created with an MTU higher than 1500 on RHEL and CentOS 7. [moby/moby#47308](https://github.com/moby/moby/issues/47308), [moby/moby#47311](https://github.com/moby/moby/pull/47311) +* Fix a bug where containers are unable to communicate over an `internal` network. [moby/moby#47303](https://github.com/moby/moby/pull/47303) +* Fix a bug where the value of the `ipv6` daemon option was ignored. [moby/moby#47310](https://github.com/moby/moby/pull/47310) +* Fix a bug where trying to install a pulling using a digest revision would cause a panic. [moby/moby#47323](https://github.com/moby/moby/pull/47323) +* Fix a potential race condition in the managed containerd supervisor. [moby/moby#47313](https://github.com/moby/moby/pull/47313) +* Fix an issue with the `journald` log driver preventing container logs from being followed correctly with systemd version 255. [moby/moby#47243](https://github.com/moby/moby/pull/47243) +* seccomp: Update the builtin seccomp profile to include syscalls added in kernel v5.17 - v6.7 to align the profile with the profile used by containerd. [moby/moby#47341](https://github.com/moby/moby/pull/47341) +* Windows: Fix cache not being used when building images based on Windows versions older than the host's version. [moby/moby#47307](https://github.com/moby/moby/pull/47307), [moby/moby#47337](https://github.com/moby/moby/pull/47337) + +### [Packaging updates](#packaging-updates-1) + +* Removed support for Ubuntu Lunar (23.04). [docker/ce-packaging#986](https://github.com/docker/docker-ce-packaging/pull/986) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_25.0.4.md b/corpus/changelog/docker_engine_releases/docker_engine_25.0.4.md new file mode 100644 index 0000000000000000000000000000000000000000..91377a317be441efc60d16135a6da99e6012fc1c --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_25.0.4.md @@ -0,0 +1,33 @@ +# Docker Engine 25.0.4 release notes + +Source: https://docs.docker.com/engine/release-notes/25.0/ + +## [25.0.4](#2504) + +*2024-03-07* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 25.0.4 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A25.0.4) +* [moby/moby, 25.0.4 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A25.0.4) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-1) + +* Restore DNS names for containers in the default "nat" network on Windows. [moby/moby#47490](https://github.com/moby/moby/pull/47490) +* Fix `docker start` failing when used with `--checkpoint` [moby/moby#47466](https://github.com/moby/moby/pull/47466) +* Don't enforce new validation rules for existing swarm networks [moby/moby#47482](https://github.com/moby/moby/pull/47482) +* Restore IP connectivity between the host and containers on an internal bridge network. [moby/moby#47481](https://github.com/moby/moby/pull/47481) +* Fix a regression introduced in v25.0 that prevented the classic builder from adding tar archive with `xattrs` created on a non-Linux OS [moby/moby#47483](https://github.com/moby/moby/pull/47483) +* containerd image store: Fix image pull not emitting `Pulling fs layer status` [moby/moby#47484](https://github.com/moby/moby/pull/47484) +* API: To preserve backwards compatibility, make read-only mounts non-recursive by default when using older clients (API versions < v1.44). [moby/moby#47393](https://github.com/moby/moby/pull/47393) +* API: `GET /images/{id}/json` omits the `Created` field (previously it was `0001-01-01T00:00:00Z`) if the `Created` field was missing from the image config. [moby/moby#47451](https://github.com/moby/moby/pull/47451) +* API: Populate a missing `Created` field in `GET /images/{id}/json` with `0001-01-01T00:00:00Z` for API versions <= 1.43. [moby/moby#47387](https://github.com/moby/moby/pull/47387) +* API: Fix a regression that caused API socket connection failures to report an API version negotiation failure instead. [moby/moby#47470](https://github.com/moby/moby/pull/47470) +* API: Preserve supplied endpoint configuration in a container-create API request, when a container-wide MAC address is specified, but `NetworkMode` name or id is not the same as the name or id used in `NetworkSettings.Networks`. [moby/moby#47510](https://github.com/moby/moby/pull/47510) + +### [Packaging updates](#packaging-updates) + +* Upgrade Go runtime to 1.21.8. [moby/moby#47503](https://github.com/moby/moby/pull/47503) +* Upgrade RootlessKit to v2.0.2. [moby/moby#47508](https://github.com/moby/moby/pull/47508) +* Upgrade Compose to v2.24.7. [docker/docker-ce-packaging#998](https://github.com/moby/moby/pull/998) +* Upgrade Buildx to v0.13.0. [docker/docker-ce-packaging#997](https://github.com/moby/moby/pull/997) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_25.0.5.md b/corpus/changelog/docker_engine_releases/docker_engine_25.0.5.md new file mode 100644 index 0000000000000000000000000000000000000000..7781a0385ed6c8ef2e92955c73bda8031fb0d7f5 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_25.0.5.md @@ -0,0 +1,23 @@ +# Docker Engine 25.0.5 release notes + +Source: https://docs.docker.com/engine/release-notes/25.0/ + +## [25.0.5](#2505) + +*2024-03-19* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 25.0.5 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A25.0.5) +* [moby/moby, 25.0.5 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A25.0.5) + +### [Security](#security) + +This release contains a security fix for [CVE-2024-29018](https://github.com/moby/moby/security/advisories/GHSA-mq39-4gv4-mvpx), a potential data exfiltration from 'internal' networks via authoritative DNS servers. + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements) + +* [CVE-2024-29018](https://github.com/moby/moby/security/advisories/GHSA-mq39-4gv4-mvpx): Do not forward requests to external DNS servers for a container that is only connected to an 'internal' network. Previously, requests were forwarded if the host's DNS server was running on a loopback address, like systemd's 127.0.0.53. [moby/moby#47589](https://github.com/moby/moby/pull/47589) +* plugin: fix mounting /etc/hosts when running in UserNS. [moby/moby#47588](https://github.com/moby/moby/pull/47588) +* rootless: fix `open /etc/docker/plugins: permission denied`. [moby/moby#47587](https://github.com/moby/moby/pull/47587) +* Fix multiple parallel `docker build` runs leaking disk space. [moby/moby#47527](https://github.com/moby/moby/pull/47527) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_26.0.0.md b/corpus/changelog/docker_engine_releases/docker_engine_26.0.0.md new file mode 100644 index 0000000000000000000000000000000000000000..ea918e910fcb1f8aa525d15cb7087fe6229f3731 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_26.0.0.md @@ -0,0 +1,98 @@ +# Docker Engine 26.0.0 release notes + +Source: https://docs.docker.com/engine/release-notes/26.0/ + +## [26.0.0](#2600) + +*2024-03-20* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 26.0.0 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A26.0.0) +* [moby/moby, 26.0.0 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A26.0.0) +* Deprecated and removed features, see [Deprecated Features](https://github.com/docker/cli/blob/v26.0.0/docs/deprecated.md). +* Changes to the Engine API, see [API version history](https://github.com/moby/moby/blob/v26.0.0/docs/api/version-history.md). + +### [Security](#security-1) + +This release contains a security fix for [CVE-2024-29018](https://github.com/moby/moby/security/advisories/GHSA-mq39-4gv4-mvpx), a potential data exfiltration from 'internal' networks via authoritative DNS servers. + +### [New](#new) + +* Add `Subpath` field to the `VolumeOptions` making it possible to mount a subpath of a volume. [moby/moby#45687](https://github.com/moby/moby/pull/45687) +* Add `volume-subpath` support to the mount flag (`--mount type=volume,...,volume-subpath=`). [docker/cli#4331](https://github.com/docker/cli/pull/4331) +* Accept `=` separators and `[ipv6]` in compose files for `docker stack deploy`. [docker/cli#4860](https://github.com/docker/cli/pull/4860) +* rootless: Add support for enabling host loopback by setting the `DOCKERD_ROOTLESS_ROOTLESSKIT_DISABLE_HOST_LOOPBACK` environment variable to `false` (defaults to `true`). This lets containers connect to the host by using IP address `10.0.2.2`. [moby/moby#47352](https://github.com/moby/moby/pull/47352) +* containerd image store: `docker image ls` no longer creates duplicates entries for multi-platform images. [moby/moby#45967](https://github.com/moby/moby/pull/45967) +* containerd image store: Send Prometheus metrics. [moby/moby#47555](https://github.com/moby/moby/pull/47555) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-2) + +* [CVE-2024-29018](https://github.com/moby/moby/security/advisories/GHSA-mq39-4gv4-mvpx): Do not forward requests to external DNS servers for a container that is only connected to an 'internal' network. Previously, requests were forwarded if the host's DNS server was running on a loopback address, like systemd's 127.0.0.53. [moby/moby#47589](https://github.com/moby/moby/pull/47589) +* Ensure that a generated MAC address is not restored when a container is restarted, but a configured MAC address is preserved. [moby/moby#47233](https://github.com/moby/moby/pull/47233) + + > Warning + > + > Containers created using Docker Engine 25.0.0 may have duplicate MAC addresses, they must be re-created. + > Containers created using version 25.0.0 or 25.0.1 with user-defined MAC addresses will get generated MAC addresses when they are started using 25.0.2. They must also be re-created. +* Always attempt to enable IPv6 on a container's loopback interface, and only include IPv6 in `/etc/hosts` if successful. [moby/moby#47062](https://github.com/moby/moby/pull/47062) + + > Note + > + > By default, IPv6 will remain enabled on a container's loopback interface when the container is not connected to an IPv6-enabled network. + > For example, containers that are only connected to an IPv4-only network now have the `::1` address on their loopback interface. + > + > To disable IPv6 in a container, + > use option `--sysctl net.ipv6.conf.all.disable_ipv6=1` in the `create` or `run` command, + > or the equivalent `sysctls` option in the service configuration section of a Compose file. + > + > If IPv6 is not available in a container because it has been explicitly disabled for the container, + > or the host's networking stack does not have IPv6 enabled (or for any other reason) + > the container's `/etc/hosts` file will not include IPv6 entries. +* Fix `ADD` Dockerfile instruction failing with `lsetxattr : operation not supported` when unpacking archive with xattrs onto a filesystem that doesn't support them. [moby/moby#47175](https://github.com/moby/moby/pull/47175) +* Fix `docker container start` failing when used with `--checkpoint`. [moby/moby#47456](https://github.com/moby/moby/pull/47456) +* Restore IP connectivity between the host and containers on an internal bridge network. [moby/moby#47356](https://github.com/moby/moby/pull/47356) +* Do not enforce new validation rules for existing swarm networks. [moby/moby#47361](https://github.com/moby/moby/pull/47361) +* Restore DNS names for containers in the default "nat" network on Windows. [moby/moby#47375](https://github.com/moby/moby/pull/47375) +* Print hint when invoking `docker image ls` with ambiguous argument. [docker/cli#4849](https://github.com/docker/cli/pull/4849) +* Cleanup `@docker_cli_[UUID]` files on OpenBSD. [docker/cli#4862](https://github.com/docker/cli/pull/4862) +* Add explicit [deprecation notice](https://github.com/docker/cli/blob/v26.0.0/docs/deprecated.md#unauthenticated-tcp-connections) message when using remote TCP connections without TLS. [docker/cli#4928](https://github.com/docker/cli/pull/4928), [moby/moby#47556](https://github.com/moby/moby/pull/47556) +* Use IPv6 nameservers from the host's `resolv.conf` as upstream resolvers for Docker Engine's internal DNS, rather than listing them in the container's `resolv.conf`. [moby/moby#47512](https://github.com/moby/moby/pull/47512) +* containerd image store: Isolate images with different containerd namespaces when `--userns-remap` option is used. [moby/moby#46786](https://github.com/moby/moby/pull/46786) +* containerd image store: Fix image pull not emitting `Pulling fs layer` status. [moby/moby#47432](https://github.com/moby/moby/pull/47432) + +### [API](#api) + +* To preserve backwards compatibility, read-only mounts are not recursive by default when using older clients (API version < v1.44). [moby/moby#47391](https://github.com/moby/moby/pull/47391) +* `GET /images/{id}/json` omits the `Created` field (previously it was `0001-01-01T00:00:00Z`) if the `Created` field is missing from the image config. [moby/moby#47451](https://github.com/moby/moby/pull/47451) +* Populate a missing `Created` field in `GET /images/{id}/json` with `0001-01-01T00:00:00Z` for API version <= 1.43. [moby/moby#47387](https://github.com/moby/moby/pull/47387) +* The `is_automated` field in the `POST /images/search` endpoint results is always `false` now. Consequently, searching for `is-automated=true` will yield no results, while `is-automated=false` will be a no-op. [moby/moby#47465](https://github.com/moby/moby/pull/47465) +* Remove `Container` and `ContainerConfig` fields from the `GET /images/{name}/json` response. [moby/moby#47430](https://github.com/moby/moby/pull/47430) + +### [Packaging updates](#packaging-updates-1) + +* Update BuildKit to [v0.13.1](https://github.com/moby/buildkit/releases/tag/v0.13.1). [moby/moby#47582](https://github.com/moby/moby/pull/47582) +* Update Buildx to [v0.13.1](https://github.com/docker/buildx/releases/tag/v0.13.1). [docker/docker-ce-packaging#1000](https://github.com/docker/docker-ce-packaging/pull/1000) +* Update Compose to [v2.25.0](https://github.com/docker/compose/releases/tag/v2.25.0). [docker/docker-ce-packaging#1002](https://github.com/docker/docker-ce-packaging/pull/1002) +* Update Go runtime to [1.21.8](https://go.dev/doc/devel/release#go1.21.8). [moby/moby#47502](https://github.com/moby/moby/pull/47502) +* Update RootlessKit to [v2.0.2](https://github.com/rootless-containers/rootlesskit/releases/tag/v2.0.2). [moby/moby#47508](https://github.com/moby/moby/pull/47504) +* Update containerd to v1.7.13 (static binaries only) [moby/moby#47278](https://github.com/moby/moby/pull/47278) +* Update runc binary to v1.1.12 [moby/moby#47268](https://github.com/moby/moby/pull/47268) +* Update OTel to v0.46.1 / v1.21.0 [moby/moby#47245](https://github.com/moby/moby/pull/47245) + +### [Removed](#removed) + +* Remove `Container` and `ContainerConfig` fields from the `GET /images/{name}/json` response. [moby/moby#47430](https://github.com/moby/moby/pull/47430) +* Deprecate the ability to accept remote TCP connections without TLS. [Deprecation notice](https://github.com/docker/cli/tree/v26.0.0/deprecation.md#unauthenticated-tcp-connections) [docker/cli#4928](https://github.com/docker/cli/pull/4928) [moby/moby#47556](https://github.com/moby/moby/pull/47556). +* Remove deprecated API versions (API < v1.24) [moby/moby#47155](https://github.com/moby/moby/pull/47155) +* Disable pulling of deprecated image formats by default. These image formats are deprecated, and support will be removed in a future version. [moby/moby#47459](https://github.com/moby/moby/pull/47459) +* image: remove deprecated IDFromDigest [moby/moby#47198](https://github.com/moby/moby/pull/47198) +* Remove the deprecated `github.com/docker/docker/pkg/loopback` package. [moby/moby#47128](https://github.com/moby/moby/pull/47128) +* pkg/system: remove deprecated `ErrNotSupportedOperatingSystem`, `IsOSSupported` [moby/moby#47129](https://github.com/moby/moby/pull/47129) +* pkg/homedir: remove deprecated Key() and GetShortcutString() [moby/moby#47130](https://github.com/moby/moby/pull/47130) +* pkg/containerfs: remove deprecated ResolveScopedPath [moby/moby#47131](https://github.com/moby/moby/pull/47131) +* The daemon flag `--oom-score-adjust` was deprecated in v24.0 and is now removed. [moby/moby#46113](https://github.com/moby/moby/pull/46113) +* Remove deprecated aliases from the api/types package. These types were deprecated in v25.0.0, which provided temporary aliases. [moby/moby#47148](https://github.com/moby/moby/pull/47148) + These aliases are now removed: `types.Info`, `types.Commit`, `types.PluginsInfo`, `types.NetworkAddressPool`, `types.Runtime`, `types.SecurityOpt`, `types.KeyValue`, `types.DecodeSecurityOptions`, `types.CheckpointCreateOptions`, `types.CheckpointListOptions`, `types.CheckpointDeleteOptions`, `types.Checkpoint`, `types.ImageDeleteResponseItem`, `types.ImageSummary`, `types.ImageMetadata`, `types.ServiceUpdateResponse`, `types.ServiceCreateResponse`, `types.ResizeOptions`, `types.ContainerAttachOptions`, `types.ContainerCommitOptions`, `types.ContainerRemoveOptions`, `types.ContainerStartOptions`, `types.ContainerListOptions`, `types.ContainerLogsOptions` +* cli/command/container: remove deprecated `NewStartOptions()` [docker/cli#4811](https://github.com/docker/cli/pull/4811) +* cli/command: remove deprecated `DockerCliOption`, `InitializeOpt` [docker/cli#4810](https://github.com/docker/cli/pull/4810) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_26.0.1.md b/corpus/changelog/docker_engine_releases/docker_engine_26.0.1.md new file mode 100644 index 0000000000000000000000000000000000000000..9a4a6b93e2b5e08fa838f204e77fca7f85f1268f --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_26.0.1.md @@ -0,0 +1,28 @@ +# Docker Engine 26.0.1 release notes + +Source: https://docs.docker.com/engine/release-notes/26.0/ + +## [26.0.1](#2601) + +*2024-04-11* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 26.0.1 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A26.0.1) +* [moby/moby, 26.0.1 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A26.0.1) +* Deprecated and removed features, see [Deprecated Features](https://github.com/docker/cli/blob/v26.0.1/docs/deprecated.md). +* Changes to the Engine API, see [API version history](https://github.com/moby/moby/blob/v26.0.1/docs/api/version-history.md). + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-1) + +* Fix a regression that meant network interface specific `--sysctl` options prevented container startup. [moby/moby#47646](https://github.com/moby/moby/pull/47646) +* Remove erroneous `platform` from image `config` OCI descriptor in `docker save` output. [moby/moby#47694](https://github.com/moby/moby/pull/47694) +* containerd image store: OCI archives produced by `docker save` will now have a non-empty `mediaType` field in `index.json` [moby/moby#47701](https://github.com/moby/moby/pull/47701) +* Fix a regression that prevented the internal resolver from forwarding requests from IPvlan L3 networks to external resolvers. [moby/moby#47705](https://github.com/moby/moby/pull/47705) +* Prevent the use of external resolvers in IPvlan and Macvlan networks created with no parent interface specified. [moby/moby#47705](https://github.com/moby/moby/pull/47705) + +### [Packaging updates](#packaging-updates) + +* Update Go runtime to 1.21.9 [moby/moby#47671](https://github.com/moby/moby/pull/47671), [docker/cli#4987](https://github.com/docker/cli/pull/4987) +* Update Compose to [v1.26.1](https://github.com/docker/compose/releases/tag/v2.26.1) , [docker/docker-ce-packaging#1009](https://github.com/docker/docker-ce-packaging/pull/1009) +* Update containerd to [v1.7.15](https://github.com/containerd/containerd/releases/tag/v1.7.15) (static binaries only) [moby/moby#47692](https://github.com/moby/moby/pull/47692) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_26.0.2.md b/corpus/changelog/docker_engine_releases/docker_engine_26.0.2.md new file mode 100644 index 0000000000000000000000000000000000000000..5feb22c16402fa65875d51ddc9c317ccd645b560 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_26.0.2.md @@ -0,0 +1,22 @@ +# Docker Engine 26.0.2 release notes + +Source: https://docs.docker.com/engine/release-notes/26.0/ + +## [26.0.2](#2602) + +*2024-04-18* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 26.0.2 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A26.0.2) +* [moby/moby, 26.0.2 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A26.0.2) +* Deprecated and removed features, see [Deprecated Features](https://github.com/docker/cli/blob/v26.0.2/docs/deprecated.md). +* Changes to the Engine API, see [API version history](https://github.com/moby/moby/blob/v26.0.2/docs/api/version-history.md). + +### [Security](#security) + +This release contains a security fix for [CVE-2024-32473](https://github.com/moby/moby/security/advisories/GHSA-x84c-p2g9-rqv9), an unexpected configuration of IPv6 on IPv4-only interfaces. + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements) + +* [CVE-2024-32473](https://github.com/moby/moby/security/advisories/GHSA-x84c-p2g9-rqv9): Ensure IPv6 is disabled on interfaces only allocated an IPv4 address by the engine. [moby#GHSA-x84c-p2g9-rqv9](https://github.com/moby/moby/security/advisories/GHSA-x84c-p2g9-rqv9) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_26.1.0.md b/corpus/changelog/docker_engine_releases/docker_engine_26.1.0.md new file mode 100644 index 0000000000000000000000000000000000000000..56881dedbe03c3d1deeba6811227bc1ae90948b9 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_26.1.0.md @@ -0,0 +1,43 @@ +# Docker Engine 26.1.0 release notes + +Source: https://docs.docker.com/engine/release-notes/26.1/ + +## [26.1.0](#2610) + +*2024-04-22* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 26.1.0 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A26.1.0) +* [moby/moby, 26.1.0 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A26.1.0) +* Deprecated and removed features, see [Deprecated Features](https://github.com/docker/cli/blob/v26.1.0/docs/deprecated.md). +* Changes to the Engine API, see [API version history](https://github.com/moby/moby/blob/v26.1.0/docs/api/version-history.md). + +### [New](#new) + +* Added configurable OpenTelemetry utilities and basic instrumentation to commands. + For more information, see [OpenTelemetry for the Docker CLI](https://docs.docker.com/config/otel). [docker/cli#4889](https://github.com/docker/cli/pull/4889) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-4) + +* Native Windows containers are configured with an internal DNS server for container name resolution, and external DNS servers for other lookups. + Not all resolvers, including `nslookup`, fall back to the external resolvers when they get a `SERVFAIL` answer from the internal server. + So, the internal DNS server can now be configured to forward requests to the external resolvers, by setting a `feature` option in the `daemon.json` file: + + ``` + { + "features": { + "windows-dns-proxy": true + } + } + ``` + + [moby/moby#47584](https://github.com/moby/moby/pull/47584) + + > Note + > + > + This will be the new default behavior in Docker Engine 27.0. + > + The `windows-dns-proxy` feature flag will be removed in a future release. +* Swarm: Fix `Subpath` not being passed to the container config. [moby/moby#47711](https://github.com/moby/moby/pull/47711) +* Classic builder: Fix cache miss on `WORKDIR /` build step (directory with a trailing slash). [moby/moby#47723](https://github.com/moby/moby/pull/47723) +* containerd image store: Fix `docker images` failing when any image in the store has unexpected target. [moby/moby#47738](https://github.com/moby/moby/pull/47738) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_26.1.1.md b/corpus/changelog/docker_engine_releases/docker_engine_26.1.1.md new file mode 100644 index 0000000000000000000000000000000000000000..94c6737fbad3bb60343449499a1715275460ca5d --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_26.1.1.md @@ -0,0 +1,29 @@ +# Docker Engine 26.1.1 release notes + +Source: https://docs.docker.com/engine/release-notes/26.1/ + +## [26.1.1](#2611) + +*2024-04-30* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 26.1.1 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A26.1.1) +* [moby/moby, 26.1.1 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A26.1.1) +* Deprecated and removed features, see [Deprecated Features](https://github.com/docker/cli/blob/v26.1.1/docs/deprecated.md). +* Changes to the Engine API, see [API version history](https://github.com/moby/moby/blob/v26.1.1/docs/api/version-history.md). + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-3) + +* Fix `docker run -d` printing an `context canceled` spurious error when OpenTelemetry is configured. [docker/cli#5044](https://github.com/docker/cli/pull/5044) +* Experimental environment variable `DOCKER_BRIDGE_PRESERVE_KERNEL_LL=1` will prevent the daemon from removing the kernel-assigned link local address on a Linux bridge. [moby/moby#47775](https://github.com/moby/moby/pull/47775) +* Resolve an issue preventing container creation on hosts with a read-only `/proc/sys/net` filesystem. If IPv6 cannot be disabled on an interface due to this, either disable IPv6 by default on the host or ensure `/proc/sys/net` is read-write. To bypass the error, set the environment variable `DOCKER_ALLOW_IPV6_ON_IPV4_INTERFACE=1` before starting the Docker daemon. [moby/moby#47769](https://github.com/moby/moby/pull/47769) + +> Note +> +> The `DOCKER_ALLOW_IPV6_ON_IPV4_INTERFACE` is added as a temporary fix and will be phased out in a future major release, when the IPv6 enablement process has been improved. + +### [Packaging updates](#packaging-updates-3) + +* Update BuildKit to [v0.13.2](https://github.com/moby/buildkit/releases/tag/v0.13.2). [moby/moby#47762](https://github.com/moby/moby/pull/47762) +* Update Compose to [v2.27.0](https://github.com/docker/compose/releases/tag/v2.27.0). [docker/docker-ce-packages#1017](https://github.com/docker/docker-ce-packaging/pull/1017) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_26.1.2.md b/corpus/changelog/docker_engine_releases/docker_engine_26.1.2.md new file mode 100644 index 0000000000000000000000000000000000000000..8648f774798746a247b0d68fcd1b126794e218b1 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_26.1.2.md @@ -0,0 +1,22 @@ +# Docker Engine 26.1.2 release notes + +Source: https://docs.docker.com/engine/release-notes/26.1/ + +## [26.1.2](#2612) + +*2024-05-08* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 26.1.2 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A26.1.2) +* [moby/moby, 26.1.2 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A26.1.2) +* Deprecated and removed features, see [Deprecated Features](https://github.com/docker/cli/blob/v26.1.2/docs/deprecated.md). +* Changes to the Engine API, see [API version history](https://github.com/moby/moby/blob/v26.1.2/docs/api/version-history.md). + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-2) + +* Fix an issue where the CLI process would sometimes hang when a container failed to start. [docker/cli#5062](https://github.com/docker/cli/pull/5062) + +### [Packaging updates](#packaging-updates-2) + +* Update Go runtime to 1.21.10. [moby/moby#47806](https://github.com/moby/moby/pull/47806) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_26.1.3.md b/corpus/changelog/docker_engine_releases/docker_engine_26.1.3.md new file mode 100644 index 0000000000000000000000000000000000000000..198b25839562c7767fa962dbeeb4c55d886daafb --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_26.1.3.md @@ -0,0 +1,23 @@ +# Docker Engine 26.1.3 release notes + +Source: https://docs.docker.com/engine/release-notes/26.1/ + +## [26.1.3](#2613) + +*2024-05-16* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 26.1.3 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A26.1.3) +* [moby/moby, 26.1.3 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A26.1.3) +* Deprecated and removed features, see [Deprecated Features](https://github.com/docker/cli/blob/v26.1.3/docs/deprecated.md). +* Changes to the Engine API, see [API version history](https://github.com/moby/moby/blob/v26.1.3/docs/api/version-history.md). + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-1) + +* Fix a regression that prevented the use of DNS servers within a `--internal` network. [moby/moby#47832](https://github.com/moby/moby/pull/47832) +* When the internal DNS server's own address is supplied as an external server address, ignore it to avoid unproductive recursion. [moby/moby#47833](https://github.com/moby/moby/pull/47833) + +### [Packaging updates](#packaging-updates-1) + +* Allow runc to kill containers when confined to the runc profile in AppArmor version 4.0.0 and later. [moby/moby#47829](https://github.com/moby/moby/pull/47829) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_26.1.4.md b/corpus/changelog/docker_engine_releases/docker_engine_26.1.4.md new file mode 100644 index 0000000000000000000000000000000000000000..7664a57bd206c0d67d0d14ffc2a7b02f06f56732 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_26.1.4.md @@ -0,0 +1,36 @@ +# Docker Engine 26.1.4 release notes + +Source: https://docs.docker.com/engine/release-notes/26.1/ + +## [26.1.4](#2614) + +*2024-06-05* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 26.1.4 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A26.1.4) +* [moby/moby, 26.1.4 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A26.1.4) +* Deprecated and removed features, see [Deprecated Features](https://github.com/docker/cli/blob/v26.1.4/docs/deprecated.md). +* Changes to the Engine API, see [API version history](https://github.com/moby/moby/blob/v26.1.4/docs/api/version-history.md). + +### [Security](#security) + +This release updates the Go runtime to 1.21.11 which contains security fixes for: + +* [CVE-2024-24789](https://github.com/golang/go/issues/66869) +* [CVE-2024-24790](https://github.com/golang/go/issues/67680) +* A symlink time of check to time of use race condition during directory removal reported by [Addison Crump](https://github.com/addisoncrump). + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements) + +* Fixed an issue where promoting a node immediately after another node was demoted could cause the promotion to fail. [moby/moby#47870](https://github.com/moby/moby/pull/47870) +* Prevent the daemon log from being spammed with `superfluous response.WriteHeader call ...` messages. [moby/moby#47843](https://github.com/moby/moby/pull/47843) +* Don't show empty hints when plugins return an empty hook message. [docker/cli#5083](https://github.com/docker/cli/pull/5083) +* Fix a compatibility issue with Visual Studio Container Tools. [docker/cli#5095](https://github.com/docker/cli/pull/5095) + +### [Packaging updates](#packaging-updates) + +* Update containerd (static binaries only) to [v1.7.17](https://github.com/containerd/containerd/releases/tag/v1.7.17). [moby/moby#47841](https://github.com/moby/moby/pull/47841) +* [CVE-2024-24789](https://github.com/golang/go/issues/66869), [CVE-2024-24790](https://github.com/golang/go/issues/67680): Update Go runtime to 1.21.11. [moby/moby#47904](https://github.com/moby/moby/pull/47904) +* Update Compose to [v2.27.1](https://github.com/docker/compose/releases/tag/v2.27.1). [docker/docker-ce-packages#1022](https://github.com/docker/docker-ce-packaging/pull/1022) +* Update Buildx to [v0.14.1](https://github.com/docker/buildx/releases/tag/v0.14.1). [docker/docker-ce-packages#1021](https://github.com/docker/docker-ce-packaging/pull/1021) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_27.md b/corpus/changelog/docker_engine_releases/docker_engine_27.md new file mode 100644 index 0000000000000000000000000000000000000000..e094af2842319f5c4e6d341047ddb5cca52a3ad8 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_27.md @@ -0,0 +1,1514 @@ +# Docker Engine 27 release notes + +Source: https://docs.docker.com/engine/release-notes/27/ + +Back + +Ask AI + +Start typing to search or try +Ask AI. + +[Contact support](https://hub.docker.com/support/contact) + +[Manuals](https://docs.docker.com/manuals/) + +* [Get started](/get-started/) +* [Guides](/guides/) +* [Reference](/reference/) + +* Open source +* [Docker Engine](https://docs.docker.com/engine/) + + + [Install](https://docs.docker.com/engine/install/) + + - [Ubuntu](https://docs.docker.com/engine/install/ubuntu/ "Ubuntu") + - [Debian](https://docs.docker.com/engine/install/debian/ "Debian") + - [RHEL](https://docs.docker.com/engine/install/rhel/ "RHEL") + - [Fedora](https://docs.docker.com/engine/install/fedora/ "Fedora") + - [Raspberry Pi OS (32-bit / armhf)](https://docs.docker.com/engine/install/raspberry-pi-os/ "Raspberry Pi OS (32-bit / armhf)") + - [CentOS](https://docs.docker.com/engine/install/centos/ "CentOS") + - [SLES (s390x)](https://docs.docker.com/engine/install/sles/ "SLES (s390x)") + - [Binaries](https://docs.docker.com/engine/install/binaries/ "Binaries") + - [Post-installation steps](https://docs.docker.com/engine/install/linux-postinstall/ "Post-installation steps") + + [Storage](https://docs.docker.com/engine/storage/) + + - [Volumes](https://docs.docker.com/engine/storage/volumes/ "Volumes") + - [Bind mounts](https://docs.docker.com/engine/storage/bind-mounts/ "Bind mounts") + - [tmpfs mounts](https://docs.docker.com/engine/storage/tmpfs/ "tmpfs mounts") + - [Storage drivers](https://docs.docker.com/engine/storage/drivers/) + + * [Select a storage driver](https://docs.docker.com/engine/storage/drivers/select-storage-driver/ "Select a storage driver") + * [BTRFS storage driver](https://docs.docker.com/engine/storage/drivers/btrfs-driver/ "BTRFS storage driver") + * [Device Mapper storage driver (deprecated)](https://docs.docker.com/engine/storage/drivers/device-mapper-driver/ "Device Mapper storage driver (deprecated)") + * [OverlayFS storage driver](https://docs.docker.com/engine/storage/drivers/overlayfs-driver/ "OverlayFS storage driver") + * [VFS storage driver](https://docs.docker.com/engine/storage/drivers/vfs-driver/ "VFS storage driver") + * [windowsfilter storage driver](https://docs.docker.com/engine/storage/drivers/windowsfilter-driver/ "windowsfilter storage driver") + * [ZFS storage driver](https://docs.docker.com/engine/storage/drivers/zfs-driver/ "ZFS storage driver") + - [containerd image store](https://docs.docker.com/engine/storage/containerd/ "containerd image store") + + [Networking](https://docs.docker.com/engine/network/) + + - [Docker with iptables](https://docs.docker.com/engine/network/firewall-iptables/ "Docker with iptables") + - [Docker with nftables](https://docs.docker.com/engine/network/firewall-nftables/ "Docker with nftables") + - [Packet filtering and firewalls](https://docs.docker.com/engine/network/packet-filtering-firewalls/ "Packet filtering and firewalls") + - [Port publishing and mapping](https://docs.docker.com/engine/network/port-publishing/ "Port publishing and mapping") + - [Network drivers](https://docs.docker.com/engine/network/drivers/) + + * [Bridge network driver](https://docs.docker.com/engine/network/drivers/bridge/ "Bridge network driver") + * [Host network driver](https://docs.docker.com/engine/network/drivers/host/ "Host network driver") + * [IPvlan network driver](https://docs.docker.com/engine/network/drivers/ipvlan/ "IPvlan network driver") + * [Macvlan network driver](https://docs.docker.com/engine/network/drivers/macvlan/ "Macvlan network driver") + * [None network driver](https://docs.docker.com/engine/network/drivers/none/ "None network driver") + * [Overlay network driver](https://docs.docker.com/engine/network/drivers/overlay/ "Overlay network driver") + - [CA certificates](https://docs.docker.com/engine/network/ca-certs/ "CA certificates") + - [Legacy container links](https://docs.docker.com/engine/network/links/ "Legacy container links") + + Containers + + - [Start containers automatically](https://docs.docker.com/engine/containers/start-containers-automatically/ "Start containers automatically") + - [Run multiple processes in a container](https://docs.docker.com/engine/containers/multi-service_container/ "Run multiple processes in a container") + - [Resource constraints](https://docs.docker.com/engine/containers/resource_constraints/ "Resource constraints") + - [Runtime metrics](https://docs.docker.com/engine/containers/runmetrics/ "Runtime metrics") + - [Running containers](https://docs.docker.com/engine/containers/run/ "Running containers") + + CLI + + - [Completion](https://docs.docker.com/engine/cli/completion/ "Completion") + - [Proxy configuration](https://docs.docker.com/engine/cli/proxy/ "Proxy configuration") + - [Filter commands](https://docs.docker.com/engine/cli/filter/ "Filter commands") + - [Format command and log output](https://docs.docker.com/engine/cli/formatting/ "Format command and log output") + - [OpenTelemetry for the Docker CLI](https://docs.docker.com/engine/cli/otel/ "OpenTelemetry for the Docker CLI") + + [Daemon](https://docs.docker.com/engine/daemon/) + + - [Start the daemon](https://docs.docker.com/engine/daemon/start/ "Start the daemon") + - [Use IPv6 networking](https://docs.docker.com/engine/daemon/ipv6/ "Use IPv6 networking") + - [Daemon proxy configuration](https://docs.docker.com/engine/daemon/proxy/ "Daemon proxy configuration") + - [Live restore](https://docs.docker.com/engine/daemon/live-restore/ "Live restore") + - [Alternative container runtimes](https://docs.docker.com/engine/daemon/alternative-runtimes/ "Alternative container runtimes") + - [Collect Docker metrics with Prometheus](https://docs.docker.com/engine/daemon/prometheus/ "Collect Docker metrics with Prometheus") + - [Configure remote access for Docker daemon](https://docs.docker.com/engine/daemon/remote-access/ "Configure remote access for Docker daemon") + - [Read the daemon logs](https://docs.docker.com/engine/daemon/logs/ "Read the daemon logs") + - [Troubleshooting the Docker daemon](https://docs.docker.com/engine/daemon/troubleshoot/ "Troubleshooting the Docker daemon") + + Manage resources + + - [Docker contexts](https://docs.docker.com/engine/manage-resources/contexts/ "Docker contexts") + - [Docker object labels](https://docs.docker.com/engine/manage-resources/labels/ "Docker object labels") + - [Prune unused Docker objects](https://docs.docker.com/engine/manage-resources/pruning/ "Prune unused Docker objects") + + [Logs and metrics](https://docs.docker.com/engine/logging/) + + - [Configure logging drivers](https://docs.docker.com/engine/logging/configure/ "Configure logging drivers") + - [Customize log driver output](https://docs.docker.com/engine/logging/log_tags/ "Customize log driver output") + - Logging drivers + + * [Amazon CloudWatch Logs logging driver](https://docs.docker.com/engine/logging/drivers/awslogs/ "Amazon CloudWatch Logs logging driver") + * [ETW logging driver](https://docs.docker.com/engine/logging/drivers/etwlogs/ "ETW logging driver") + * [Fluentd logging driver](https://docs.docker.com/engine/logging/drivers/fluentd/ "Fluentd logging driver") + * [Google Cloud Logging driver](https://docs.docker.com/engine/logging/drivers/gcplogs/ "Google Cloud Logging driver") + * [Graylog Extended Format logging driver](https://docs.docker.com/engine/logging/drivers/gelf/ "Graylog Extended Format logging driver") + * [Journald logging driver](https://docs.docker.com/engine/logging/drivers/journald/ "Journald logging driver") + * [JSON File logging driver](https://docs.docker.com/engine/logging/drivers/json-file/ "JSON File logging driver") + * [Local file logging driver](https://docs.docker.com/engine/logging/drivers/local/ "Local file logging driver") + * [Splunk logging driver](https://docs.docker.com/engine/logging/drivers/splunk/ "Splunk logging driver") + * [Syslog logging driver](https://docs.docker.com/engine/logging/drivers/syslog/ "Syslog logging driver") + - [Use a logging driver plugin](https://docs.docker.com/engine/logging/plugins/ "Use a logging driver plugin") + - [Use docker logs with remote logging drivers](https://docs.docker.com/engine/logging/dual-logging/ "Use docker logs with remote logging drivers") + + [Security](https://docs.docker.com/engine/security/) + + - [Rootless mode](https://docs.docker.com/engine/security/rootless/) + + * [Tips](https://docs.docker.com/engine/security/rootless/tips/ "Tips") + * [Troubleshooting](https://docs.docker.com/engine/security/rootless/troubleshoot/ "Troubleshooting") + - [Antivirus software and Docker](https://docs.docker.com/engine/security/antivirus/ "Antivirus software and Docker") + - [AppArmor security profiles for Docker](https://docs.docker.com/engine/security/apparmor/ "AppArmor security profiles for Docker") + - [Content trust in Docker](https://docs.docker.com/engine/security/trust/) + + * [Automation with content trust](https://docs.docker.com/engine/security/trust/trust_automation/ "Automation with content trust") + * [Delegations for content trust](https://docs.docker.com/engine/security/trust/trust_delegation/ "Delegations for content trust") + * [Deploy Notary Server with Compose](https://docs.docker.com/engine/security/trust/deploying_notary/ "Deploy Notary Server with Compose") + * [Manage keys for content trust](https://docs.docker.com/engine/security/trust/trust_key_mng/ "Manage keys for content trust") + * [Play in a content trust sandbox](https://docs.docker.com/engine/security/trust/trust_sandbox/ "Play in a content trust sandbox") + - [Docker security non-events](https://docs.docker.com/engine/security/non-events/ "Docker security non-events") + - [Isolate containers with a user namespace](https://docs.docker.com/engine/security/userns-remap/ "Isolate containers with a user namespace") + - [Protect the Docker daemon socket](https://docs.docker.com/engine/security/protect-access/ "Protect the Docker daemon socket") + - [Seccomp security profiles for Docker](https://docs.docker.com/engine/security/seccomp/ "Seccomp security profiles for Docker") + - [Verify repository client with certificates](https://docs.docker.com/engine/security/certificates/ "Verify repository client with certificates") + + [Swarm mode](https://docs.docker.com/engine/swarm/) + + - [Administer and maintain a swarm of Docker Engines](https://docs.docker.com/engine/swarm/admin_guide/ "Administer and maintain a swarm of Docker Engines") + - [Deploy a stack to a swarm](https://docs.docker.com/engine/swarm/stack-deploy/ "Deploy a stack to a swarm") + - [Deploy services to a swarm](https://docs.docker.com/engine/swarm/services/ "Deploy services to a swarm") + - [Getting started with Swarm mode](https://docs.docker.com/engine/swarm/swarm-tutorial/) + + * [Create a swarm](https://docs.docker.com/engine/swarm/swarm-tutorial/create-swarm/ "Create a swarm") + * [Add nodes to the swarm](https://docs.docker.com/engine/swarm/swarm-tutorial/add-nodes/ "Add nodes to the swarm") + * [Deploy a service to the swarm](https://docs.docker.com/engine/swarm/swarm-tutorial/deploy-service/ "Deploy a service to the swarm") + * [Inspect a service on the swarm](https://docs.docker.com/engine/swarm/swarm-tutorial/inspect-service/ "Inspect a service on the swarm") + * [Scale the service in the swarm](https://docs.docker.com/engine/swarm/swarm-tutorial/scale-service/ "Scale the service in the swarm") + * [Delete the service running on the swarm](https://docs.docker.com/engine/swarm/swarm-tutorial/delete-service/ "Delete the service running on the swarm") + * [Apply rolling updates to a service](https://docs.docker.com/engine/swarm/swarm-tutorial/rolling-update/ "Apply rolling updates to a service") + * [Drain a node on the swarm](https://docs.docker.com/engine/swarm/swarm-tutorial/drain-node/ "Drain a node on the swarm") + - How swarm works + + * [How nodes work](https://docs.docker.com/engine/swarm/how-swarm-mode-works/nodes/ "How nodes work") + * [How services work](https://docs.docker.com/engine/swarm/how-swarm-mode-works/services/ "How services work") + * [Manage swarm security with public key infrastructure (PKI)](https://docs.docker.com/engine/swarm/how-swarm-mode-works/pki/ "Manage swarm security with public key infrastructure (PKI)") + * [Swarm task states](https://docs.docker.com/engine/swarm/how-swarm-mode-works/swarm-task-states/ "Swarm task states") + - [Join nodes to a swarm](https://docs.docker.com/engine/swarm/join-nodes/ "Join nodes to a swarm") + - [Lock your swarm to protect its encryption key](https://docs.docker.com/engine/swarm/swarm_manager_locking/ "Lock your swarm to protect its encryption key") + - [Manage nodes in a swarm](https://docs.docker.com/engine/swarm/manage-nodes/ "Manage nodes in a swarm") + - [Manage sensitive data with Docker secrets](https://docs.docker.com/engine/swarm/secrets/ "Manage sensitive data with Docker secrets") + - [Manage swarm service networks](https://docs.docker.com/engine/swarm/networking/ "Manage swarm service networks") + - [Raft consensus in swarm mode](https://docs.docker.com/engine/swarm/raft/ "Raft consensus in swarm mode") + - [Run Docker Engine in swarm mode](https://docs.docker.com/engine/swarm/swarm-mode/ "Run Docker Engine in swarm mode") + - [Store configuration data using Docker Configs](https://docs.docker.com/engine/swarm/configs/ "Store configuration data using Docker Configs") + - [Swarm mode key concepts](https://docs.docker.com/engine/swarm/key-concepts/ "Swarm mode key concepts") + - [Use Swarm mode routing mesh](https://docs.docker.com/engine/swarm/ingress/ "Use Swarm mode routing mesh") + + [Deprecated features](https://docs.docker.com/engine/deprecated/ "Deprecated features") + + [Docker Engine plugins](https://docs.docker.com/engine/extend/) + + - [Access authorization plugin](https://docs.docker.com/engine/extend/plugins_authorization/ "Access authorization plugin") + - [Docker log driver plugins](https://docs.docker.com/engine/extend/plugins_logging/ "Docker log driver plugins") + - [Docker network driver plugins](https://docs.docker.com/engine/extend/plugins_network/ "Docker network driver plugins") + - [Docker Plugin API](https://docs.docker.com/engine/extend/plugin_api/ "Docker Plugin API") + - [Docker volume plugins](https://docs.docker.com/engine/extend/plugins_volume/ "Docker volume plugins") + - [Plugin Config Version 1 of Plugin V2](https://docs.docker.com/engine/extend/config/ "Plugin Config Version 1 of Plugin V2") + - [Use Docker Engine plugins](https://docs.docker.com/engine/extend/legacy_plugins/ "Use Docker Engine plugins") + + Release notes + + - [Engine v29](https://docs.docker.com/engine/release-notes/29/ "Engine v29") + - [Engine v28](https://docs.docker.com/engine/release-notes/28/ "Engine v28") + - [Engine v27](https://docs.docker.com/engine/release-notes/27/ "Engine v27") + - [Engine v26.1](https://docs.docker.com/engine/release-notes/26.1/ "Engine v26.1") + - [Engine v26.0](https://docs.docker.com/engine/release-notes/26.0/ "Engine v26.0") + - [Engine v25.0](https://docs.docker.com/engine/release-notes/25.0/ "Engine v25.0") + - [Engine v24.0](https://docs.docker.com/engine/release-notes/24.0/ "Engine v24.0") + - [Engine v23.0](https://docs.docker.com/engine/release-notes/23.0/ "Engine v23.0") + - [Engine v20.10](https://docs.docker.com/engine/release-notes/20.10/ "Engine v20.10") + - [Engine v19.03](https://docs.docker.com/engine/release-notes/19.03/ "Engine v19.03") + - [Engine v18.09](https://docs.docker.com/engine/release-notes/18.09/ "Engine v18.09") + - [Engine v18.06](https://docs.docker.com/engine/release-notes/18.06/ "Engine v18.06") + - [Engine v18.05](https://docs.docker.com/engine/release-notes/18.05/ "Engine v18.05") + - [Engine v18.04](https://docs.docker.com/engine/release-notes/18.04/ "Engine v18.04") + - [Engine v18.03](https://docs.docker.com/engine/release-notes/18.03/ "Engine v18.03") + - [Engine v18.02](https://docs.docker.com/engine/release-notes/18.02/ "Engine v18.02") + - [Engine v18.01](https://docs.docker.com/engine/release-notes/18.01/ "Engine v18.01") + - [Engine v17.12](https://docs.docker.com/engine/release-notes/17.12/ "Engine v17.12") + - [Engine v17.11](https://docs.docker.com/engine/release-notes/17.11/ "Engine v17.11") + - [Engine v17.10](https://docs.docker.com/engine/release-notes/17.10/ "Engine v17.10") + - [Engine v17.09](https://docs.docker.com/engine/release-notes/17.09/ "Engine v17.09") + - [Engine v17.07](https://docs.docker.com/engine/release-notes/17.07/ "Engine v17.07") + - [Engine v17.06](https://docs.docker.com/engine/release-notes/17.06/ "Engine v17.06") + - [Engine v17.05](https://docs.docker.com/engine/release-notes/17.05/ "Engine v17.05") + - [Engine v17.04](https://docs.docker.com/engine/release-notes/17.04/ "Engine v17.04") + - [Engine v17.03](https://docs.docker.com/engine/release-notes/17.03/ "Engine v17.03") + - [Prior releases](https://docs.docker.com/engine/release-notes/prior-releases/ "Prior releases") +* [Docker Build](https://docs.docker.com/build/) + + + Core concepts + + - [Docker Build Overview](https://docs.docker.com/build/concepts/overview/ "Docker Build Overview") + - [Dockerfile overview](https://docs.docker.com/build/concepts/dockerfile/ "Dockerfile overview") + - [Build context](https://docs.docker.com/build/concepts/context/ "Build context") + + Building + + - [Multi-stage](https://docs.docker.com/build/building/multi-stage/ "Multi-stage") + - [Variables](https://docs.docker.com/build/building/variables/ "Variables") + - [Secrets](https://docs.docker.com/build/building/secrets/ "Secrets") + - [Multi-platform](https://docs.docker.com/build/building/multi-platform/ "Multi-platform") + - [Export binaries](https://docs.docker.com/build/building/export/ "Export binaries") + - [Container Device Interface (CDI)](https://docs.docker.com/build/building/cdi/ "Container Device Interface (CDI)") + - [Best practices](https://docs.docker.com/build/building/best-practices/ "Best practices") + - [Base images](https://docs.docker.com/build/building/base-images/ "Base images") + + [Build checks + New](https://docs.docker.com/build/checks/ "Build checks") + + [Builders](https://docs.docker.com/build/builders/) + + - [Build drivers](https://docs.docker.com/build/builders/drivers/) + + * [Docker container driver](https://docs.docker.com/build/builders/drivers/docker-container/ "Docker container driver") + * [Docker driver](https://docs.docker.com/build/builders/drivers/docker/ "Docker driver") + * [Kubernetes driver](https://docs.docker.com/build/builders/drivers/kubernetes/ "Kubernetes driver") + * [Remote driver](https://docs.docker.com/build/builders/drivers/remote/ "Remote driver") + - [Manage builders](https://docs.docker.com/build/builders/manage/ "Manage builders") + + [Bake](https://docs.docker.com/build/bake/) + + - [Introduction](https://docs.docker.com/build/bake/introduction/ "Introduction") + - [Targets](https://docs.docker.com/build/bake/targets/ "Targets") + - [Inheritance](https://docs.docker.com/build/bake/inheritance/ "Inheritance") + - [Variables](https://docs.docker.com/build/bake/variables/ "Variables") + - [Expressions](https://docs.docker.com/build/bake/expressions/ "Expressions") + - [Functions](https://docs.docker.com/build/bake/funcs/ "Functions") + - [Matrix targets](https://docs.docker.com/build/bake/matrices/ "Matrix targets") + - [Contexts](https://docs.docker.com/build/bake/contexts/ "Contexts") + - [Bake file reference](https://docs.docker.com/build/bake/reference/ "Bake file reference") + - [Bake standard library functions](https://docs.docker.com/build/bake/stdlib/ "Bake standard library functions") + - [Building with Bake from a Compose file](https://docs.docker.com/build/bake/compose-file/ "Building with Bake from a Compose file") + - [Overriding configurations](https://docs.docker.com/build/bake/overrides/ "Overriding configurations") + - [Remote Bake file definition](https://docs.docker.com/build/bake/remote-definition/ "Remote Bake file definition") + + [Cache](https://docs.docker.com/build/cache/) + + - [Build cache invalidation](https://docs.docker.com/build/cache/invalidation/ "Build cache invalidation") + - [Build garbage collection](https://docs.docker.com/build/cache/garbage-collection/ "Build garbage collection") + - [Cache storage backends](https://docs.docker.com/build/cache/backends/) + + * [Amazon S3 cache](https://docs.docker.com/build/cache/backends/s3/ "Amazon S3 cache") + * [Azure Blob Storage cache](https://docs.docker.com/build/cache/backends/azblob/ "Azure Blob Storage cache") + * [GitHub Actions cache](https://docs.docker.com/build/cache/backends/gha/ "GitHub Actions cache") + * [Inline cache](https://docs.docker.com/build/cache/backends/inline/ "Inline cache") + * [Local cache](https://docs.docker.com/build/cache/backends/local/ "Local cache") + * [Registry cache](https://docs.docker.com/build/cache/backends/registry/ "Registry cache") + - [Optimize cache usage in builds](https://docs.docker.com/build/cache/optimize/ "Optimize cache usage in builds") + + [CI](https://docs.docker.com/build/ci/) + + - [GitHub Actions](https://docs.docker.com/build/ci/github-actions/) + + * [Annotations](https://docs.docker.com/build/ci/github-actions/annotations/ "Annotations") + * [Attestations](https://docs.docker.com/build/ci/github-actions/attestations/ "Attestations") + * [Build checks](https://docs.docker.com/build/ci/github-actions/checks/ "Build checks") + * [Build secrets](https://docs.docker.com/build/ci/github-actions/secrets/ "Build secrets") + * [Build summary](https://docs.docker.com/build/ci/github-actions/build-summary/ "Build summary") + * [BuildKit configuration](https://docs.docker.com/build/ci/github-actions/configure-builder/ "BuildKit configuration") + * [Cache management](https://docs.docker.com/build/ci/github-actions/cache/ "Cache management") + * [Copy image between registries](https://docs.docker.com/build/ci/github-actions/copy-image-registries/ "Copy image between registries") + * [Export to Docker](https://docs.docker.com/build/ci/github-actions/export-docker/ "Export to Docker") + * [Local registry](https://docs.docker.com/build/ci/github-actions/local-registry/ "Local registry") + * [Multi-platform image](https://docs.docker.com/build/ci/github-actions/multi-platform/ "Multi-platform image") + * [Named contexts](https://docs.docker.com/build/ci/github-actions/named-contexts/ "Named contexts") + * [Push to multiple registries](https://docs.docker.com/build/ci/github-actions/push-multi-registries/ "Push to multiple registries") + * [Reproducible builds](https://docs.docker.com/build/ci/github-actions/reproducible-builds/ "Reproducible builds") + * [Share image between jobs](https://docs.docker.com/build/ci/github-actions/share-image-jobs/ "Share image between jobs") + * [Tags and labels](https://docs.docker.com/build/ci/github-actions/manage-tags-labels/ "Tags and labels") + * [Test before push](https://docs.docker.com/build/ci/github-actions/test-before-push/ "Test before push") + * [Update Docker Hub description](https://docs.docker.com/build/ci/github-actions/update-dockerhub-desc/ "Update Docker Hub description") + + Metadata + + - [Annotations](https://docs.docker.com/build/metadata/annotations/ "Annotations") + - [Build attestations](https://docs.docker.com/build/metadata/attestations/) + + * [Image attestation storage](https://docs.docker.com/build/metadata/attestations/attestation-storage/ "Image attestation storage") + * [Provenance attestations](https://docs.docker.com/build/metadata/attestations/slsa-provenance/ "Provenance attestations") + * [SBOM attestations](https://docs.docker.com/build/metadata/attestations/sbom/ "SBOM attestations") + * [SLSA definitions](https://docs.docker.com/build/metadata/attestations/slsa-definitions/ "SLSA definitions") + + [Exporters](https://docs.docker.com/build/exporters/) + + - [Image and registry exporters](https://docs.docker.com/build/exporters/image-registry/ "Image and registry exporters") + - [Local and tar exporters](https://docs.docker.com/build/exporters/local-tar/ "Local and tar exporters") + - [OCI and Docker exporters](https://docs.docker.com/build/exporters/oci-docker/ "OCI and Docker exporters") + + [BuildKit](https://docs.docker.com/build/buildkit/) + + - [buildkitd.toml](https://docs.docker.com/build/buildkit/toml-configuration/ "buildkitd.toml") + - [Configure BuildKit](https://docs.docker.com/build/buildkit/configure/ "Configure BuildKit") + - [Custom Dockerfile syntax](https://docs.docker.com/build/buildkit/frontend/ "Custom Dockerfile syntax") + - [Dockerfile release notes](https://docs.docker.com/build/buildkit/dockerfile-release-notes/ "Dockerfile release notes") + + Debugging + + - [OpenTelemetry support](https://docs.docker.com/build/debug/opentelemetry/ "OpenTelemetry support") + + [Build release notes](https://docs.docker.com/build/release-notes/ "Build release notes") +* [Docker Compose](https://docs.docker.com/compose/) + + + Introduction to Compose + + - [How Compose works](https://docs.docker.com/compose/intro/compose-application-model/ "How Compose works") + - [Why use Compose?](https://docs.docker.com/compose/intro/features-uses/ "Why use Compose?") + - [History and development](https://docs.docker.com/compose/intro/history/ "History and development") + + [Install](https://docs.docker.com/compose/install/) + + - [Plugin](https://docs.docker.com/compose/install/linux/ "Plugin") + - [Standalone (Legacy)](https://docs.docker.com/compose/install/standalone/ "Standalone (Legacy)") + - [Uninstall](https://docs.docker.com/compose/install/uninstall/ "Uninstall") + + [Quickstart](https://docs.docker.com/compose/gettingstarted/ "Quickstart") + + How-tos + + - [Specify a project name](https://docs.docker.com/compose/how-tos/project-name/ "Specify a project name") + - [Use lifecycle hooks](https://docs.docker.com/compose/how-tos/lifecycle/ "Use lifecycle hooks") + - [Use service profiles](https://docs.docker.com/compose/how-tos/profiles/ "Use service profiles") + - [Control startup order](https://docs.docker.com/compose/how-tos/startup-order/ "Control startup order") + - [Use environment variables](https://docs.docker.com/compose/how-tos/environment-variables/) + + * [Set environment variables](https://docs.docker.com/compose/how-tos/environment-variables/set-environment-variables/ "Set environment variables") + * [Environment variables precedence](https://docs.docker.com/compose/how-tos/environment-variables/envvars-precedence/ "Environment variables precedence") + * [Pre-defined environment variables](https://docs.docker.com/compose/how-tos/environment-variables/envvars/ "Pre-defined environment variables") + * [Interpolation](https://docs.docker.com/compose/how-tos/environment-variables/variable-interpolation/ "Interpolation") + * [Best practices](https://docs.docker.com/compose/how-tos/environment-variables/best-practices/ "Best practices") + - [Build dependent images](https://docs.docker.com/compose/how-tos/dependent-images/ "Build dependent images") + - [Use Compose Watch](https://docs.docker.com/compose/how-tos/file-watch/ "Use Compose Watch") + - [Secrets in Compose](https://docs.docker.com/compose/how-tos/use-secrets/ "Secrets in Compose") + - [Networking](https://docs.docker.com/compose/how-tos/networking/ "Networking") + - [Use multiple Compose files](https://docs.docker.com/compose/how-tos/multiple-compose-files/) + + * [Merge](https://docs.docker.com/compose/how-tos/multiple-compose-files/merge/ "Merge") + * [Extend](https://docs.docker.com/compose/how-tos/multiple-compose-files/extends/ "Extend") + * [Include](https://docs.docker.com/compose/how-tos/multiple-compose-files/include/ "Include") + - [Enable GPU support](https://docs.docker.com/compose/how-tos/gpu-support/ "Enable GPU support") + - [Use Compose in production](https://docs.docker.com/compose/how-tos/production/ "Use Compose in production") + - [OCI artifact applications + New](https://docs.docker.com/compose/how-tos/oci-artifact/ "OCI artifact applications") + - [Use provider services + New](https://docs.docker.com/compose/how-tos/provider-services/ "Use provider services") + + [Compose Bridge](https://docs.docker.com/compose/bridge/) + + - [Usage](https://docs.docker.com/compose/bridge/usage/ "Usage") + - [Customize](https://docs.docker.com/compose/bridge/customize/ "Customize") + - [Use Model Runner](https://docs.docker.com/compose/bridge/use-model-runner/ "Use Model Runner") + + Support and feedback + + - [FAQs](https://docs.docker.com/compose/support-and-feedback/faq/ "FAQs") + - [Give feedback](https://docs.docker.com/compose/support-and-feedback/feedback/ "Give feedback") + - [Sample apps](https://docs.docker.com/compose/support-and-feedback/samples-for-compose/ "Sample apps") + + Releases + + - [Release notes](https://docs.docker.com/compose/releases/release-notes/ "Release notes") + - [Migrate to Compose v2](https://docs.docker.com/compose/releases/migrate/ "Migrate to Compose v2") +* [Testcontainers](https://docs.docker.com/testcontainers/ "Testcontainers") +* [cagent](https://docs.docker.com/ai/cagent/) + + + [cagent examples](https://docs.docker.com/ai/cagent/examples/ "cagent examples") + +* AI +* [MCP Catalog and Toolkit + Beta](https://docs.docker.com/ai/mcp-catalog-and-toolkit/) + + + [Get started](https://docs.docker.com/ai/mcp-catalog-and-toolkit/get-started/ "Get started") + + [MCP Catalog](https://docs.docker.com/ai/mcp-catalog-and-toolkit/catalog/ "MCP Catalog") + + [MCP Toolkit](https://docs.docker.com/ai/mcp-catalog-and-toolkit/toolkit/ "MCP Toolkit") + + [Dynamic MCP + New](https://docs.docker.com/ai/mcp-catalog-and-toolkit/dynamic-mcp/ "Dynamic MCP") + + [MCP Gateway](https://docs.docker.com/ai/mcp-catalog-and-toolkit/mcp-gateway/ "MCP Gateway") + + [Hub MCP server](https://docs.docker.com/ai/mcp-catalog-and-toolkit/hub-mcp/ "Hub MCP server") + + [Security FAQs](https://docs.docker.com/ai/mcp-catalog-and-toolkit/faqs/ "Security FAQs") + + [E2B sandboxes](https://docs.docker.com/ai/mcp-catalog-and-toolkit/e2b-sandboxes/ "E2B sandboxes") +* [Docker Sandboxes + Experimental](https://docs.docker.com/ai/sandboxes/) + + + [Get started](https://docs.docker.com/ai/sandboxes/get-started/ "Get started") + + [Configure Claude Code](https://docs.docker.com/ai/sandboxes/claude-code/ "Configure Claude Code") + + [Advanced](https://docs.docker.com/ai/sandboxes/advanced-config/ "Advanced") + + [Troubleshooting](https://docs.docker.com/ai/sandboxes/troubleshooting/ "Troubleshooting") +* [Model Runner](https://docs.docker.com/ai/model-runner/) + + + [Get started with DMR](https://docs.docker.com/ai/model-runner/get-started/ "Get started with DMR") + + [DMR REST API](https://docs.docker.com/ai/model-runner/api-reference/ "DMR REST API") + + [DMR examples](https://docs.docker.com/ai/model-runner/examples/ "DMR examples") +* [Ask Gordon + Beta](https://docs.docker.com/ai/gordon/) + + + [Model Context Protocol (MCP)](https://docs.docker.com/ai/gordon/mcp/) + + - [Built-in tools in Gordon](https://docs.docker.com/ai/gordon/mcp/built-in-tools/ "Built-in tools in Gordon") + - [Configure MCP servers with YAML](https://docs.docker.com/ai/gordon/mcp/yaml/ "Configure MCP servers with YAML") +* AI and Docker Compose + + + [Use AI models in Compose + New](https://docs.docker.com/ai/compose/models-and-compose/ "Use AI models in Compose") + +* Products +* [Docker Desktop](https://docs.docker.com/desktop/) + + + Setup + + - Install + + * [Mac](https://docs.docker.com/desktop/setup/install/mac-install/ "Mac") + * [Mac permission requirements](https://docs.docker.com/desktop/setup/install/mac-permission-requirements/ "Mac permission requirements") + * [Windows](https://docs.docker.com/desktop/setup/install/windows-install/ "Windows") + * [Windows permission requirements](https://docs.docker.com/desktop/setup/install/windows-permission-requirements/ "Windows permission requirements") + * [Linux](https://docs.docker.com/desktop/setup/install/linux/) + + + [Ubuntu](https://docs.docker.com/desktop/setup/install/linux/ubuntu/ "Ubuntu") + + [Debian](https://docs.docker.com/desktop/setup/install/linux/debian/ "Debian") + + [Fedora](https://docs.docker.com/desktop/setup/install/linux/fedora/ "Fedora") + + [Arch](https://docs.docker.com/desktop/setup/install/linux/archlinux/ "Arch") + + [RHEL](https://docs.docker.com/desktop/setup/install/linux/rhel/ "RHEL") + - [VM or VDI environments](https://docs.docker.com/desktop/setup/vm-vdi/ "VM or VDI environments") + - [Sign in](https://docs.docker.com/desktop/setup/sign-in/ "Sign in") + - [Allowlist](https://docs.docker.com/desktop/setup/allow-list/ "Allowlist") + + [Explore Docker Desktop](https://docs.docker.com/desktop/use-desktop/) + + - [Containers](https://docs.docker.com/desktop/use-desktop/container/ "Containers") + - [Images](https://docs.docker.com/desktop/use-desktop/images/ "Images") + - [Volumes](https://docs.docker.com/desktop/use-desktop/volumes/ "Volumes") + - [Builds](https://docs.docker.com/desktop/use-desktop/builds/ "Builds") + - [Kubernetes](https://docs.docker.com/desktop/use-desktop/kubernetes/ "Kubernetes") + - [Resource Saver mode](https://docs.docker.com/desktop/use-desktop/resource-saver/ "Resource Saver mode") + - [Pause Docker Desktop](https://docs.docker.com/desktop/use-desktop/pause/ "Pause Docker Desktop") + + Features and capabilities + + - [Networking](https://docs.docker.com/desktop/features/networking/) + + * [How-tos](https://docs.docker.com/desktop/features/networking/networking-how-tos/ "How-tos") + - [GPU support](https://docs.docker.com/desktop/features/gpu/ "GPU support") + - [USB/IP support](https://docs.docker.com/desktop/features/usbip/ "USB/IP support") + - [Synchronized file shares](https://docs.docker.com/desktop/features/synchronized-file-sharing/ "Synchronized file shares") + - [containerd image store](https://docs.docker.com/desktop/features/containerd/ "containerd image store") + - [Wasm workloads + Beta](https://docs.docker.com/desktop/features/wasm/ "Wasm workloads") + - [Docker Desktop CLI](https://docs.docker.com/desktop/features/desktop-cli/ "Docker Desktop CLI") + - [Virtual Machine Manager](https://docs.docker.com/desktop/features/vmm/ "Virtual Machine Manager") + - [WSL](https://docs.docker.com/desktop/features/wsl/) + + * [Best practices](https://docs.docker.com/desktop/features/wsl/best-practices/ "Best practices") + * [Custom kernels on WSL](https://docs.docker.com/desktop/features/wsl/custom-kernels/ "Custom kernels on WSL") + * [Use WSL](https://docs.docker.com/desktop/features/wsl/use-wsl/ "Use WSL") + + Settings and maintenance + + - [Change settings](https://docs.docker.com/desktop/settings-and-maintenance/settings/ "Change settings") + - [Backup and restore data](https://docs.docker.com/desktop/settings-and-maintenance/backup-and-restore/ "Backup and restore data") + + Troubleshoot and support + + - [Troubleshoot and diagnose](https://docs.docker.com/desktop/troubleshoot-and-support/troubleshoot/) + + * [Common topics](https://docs.docker.com/desktop/troubleshoot-and-support/troubleshoot/topics/ "Common topics") + * [Known issues](https://docs.docker.com/desktop/troubleshoot-and-support/troubleshoot/known-issues/ "Known issues") + * [MacOS app damaged dialog](https://docs.docker.com/desktop/troubleshoot-and-support/troubleshoot/mac-damaged-dialog/ "MacOS app damaged dialog") + - FAQs + + * [General](https://docs.docker.com/desktop/troubleshoot-and-support/faqs/general/ "General") + * [Mac](https://docs.docker.com/desktop/troubleshoot-and-support/faqs/macfaqs/ "Mac") + * [Windows](https://docs.docker.com/desktop/troubleshoot-and-support/faqs/windowsfaqs/ "Windows") + * [Linux](https://docs.docker.com/desktop/troubleshoot-and-support/faqs/linuxfaqs/ "Linux") + * [Releases](https://docs.docker.com/desktop/troubleshoot-and-support/faqs/releases/ "Releases") + - [Give feedback](https://docs.docker.com/desktop/troubleshoot-and-support/feedback/ "Give feedback") + + [Uninstall](https://docs.docker.com/desktop/uninstall/ "Uninstall") + + [Release notes](https://docs.docker.com/desktop/release-notes/ "Release notes") +* [Docker Hardened Images + New](https://docs.docker.com/dhi/) + + + [Quickstart](https://docs.docker.com/dhi/get-started/ "Quickstart") + + [About](https://docs.docker.com/dhi/about/) + + - [Hardened images](https://docs.docker.com/dhi/about/what/ "Hardened images") + - [Image types](https://docs.docker.com/dhi/about/available/ "Image types") + - [Image testing](https://docs.docker.com/dhi/about/test/ "Image testing") + - [Responsibility overview](https://docs.docker.com/dhi/about/responsibility/ "Responsibility overview") + - [Feedback](https://docs.docker.com/dhi/about/feedback/ "Feedback") + + [Features](https://docs.docker.com/dhi/features/) + + - [Continuous patching](https://docs.docker.com/dhi/features/patching/ "Continuous patching") + - [Enterprise support](https://docs.docker.com/dhi/features/support/ "Enterprise support") + - [Flexibility](https://docs.docker.com/dhi/features/flexible/ "Flexibility") + - [Hardened, secure images](https://docs.docker.com/dhi/features/secure/ "Hardened, secure images") + - [Helm charts](https://docs.docker.com/dhi/features/helm/ "Helm charts") + - [Seamless integration](https://docs.docker.com/dhi/features/integration/ "Seamless integration") + + [How-tos](https://docs.docker.com/dhi/how-to/) + + - [Explore images](https://docs.docker.com/dhi/how-to/explore/ "Explore images") + - [Mirror an image](https://docs.docker.com/dhi/how-to/mirror/ "Mirror an image") + - [Customize an image](https://docs.docker.com/dhi/how-to/customize/ "Customize an image") + - [Use an image](https://docs.docker.com/dhi/how-to/use/ "Use an image") + - [Use an image in Kubernetes](https://docs.docker.com/dhi/how-to/k8s/ "Use an image in Kubernetes") + - [Use a Helm chart + Early Access](https://docs.docker.com/dhi/how-to/helm/ "Use a Helm chart") + - [Manage images](https://docs.docker.com/dhi/how-to/manage/ "Manage images") + - [Migrate an app](https://docs.docker.com/dhi/how-to/migrate/ "Migrate an app") + - [Compare images](https://docs.docker.com/dhi/how-to/compare/ "Compare images") + - [Verify an image](https://docs.docker.com/dhi/how-to/verify/ "Verify an image") + - [Scan an image](https://docs.docker.com/dhi/how-to/scan/ "Scan an image") + - [Enforce image usage](https://docs.docker.com/dhi/how-to/policies/ "Enforce image usage") + - [Debug a container](https://docs.docker.com/dhi/how-to/debug/ "Debug a container") + + [Core concepts](https://docs.docker.com/dhi/core-concepts/) + + - [Attestations](https://docs.docker.com/dhi/core-concepts/attestations/ "Attestations") + - [CIS Benchmark](https://docs.docker.com/dhi/core-concepts/cis/ "CIS Benchmark") + - [Code signing](https://docs.docker.com/dhi/core-concepts/signatures/ "Code signing") + - [CVEs](https://docs.docker.com/dhi/core-concepts/cves/ "CVEs") + - [Distroless images](https://docs.docker.com/dhi/core-concepts/distroless/ "Distroless images") + - [FIPS](https://docs.docker.com/dhi/core-concepts/fips/ "FIPS") + - [glibc and musl](https://docs.docker.com/dhi/core-concepts/glibc-musl/ "glibc and musl") + - [Hardening](https://docs.docker.com/dhi/core-concepts/hardening/ "Hardening") + - [Image digests](https://docs.docker.com/dhi/core-concepts/digests/ "Image digests") + - [Image provenance](https://docs.docker.com/dhi/core-concepts/provenance/ "Image provenance") + - [Immutability](https://docs.docker.com/dhi/core-concepts/immutability/ "Immutability") + - [SBOMs](https://docs.docker.com/dhi/core-concepts/sbom/ "SBOMs") + - [SLSA](https://docs.docker.com/dhi/core-concepts/slsa/ "SLSA") + - [Software Supply Chain Security](https://docs.docker.com/dhi/core-concepts/sscs/ "Software Supply Chain Security") + - [SSDLC](https://docs.docker.com/dhi/core-concepts/ssdlc/ "SSDLC") + - [STIG](https://docs.docker.com/dhi/core-concepts/stig/ "STIG") + - [VEX](https://docs.docker.com/dhi/core-concepts/vex/ "VEX") + + [Troubleshoot](https://docs.docker.com/dhi/troubleshoot/ "Troubleshoot") +* [Docker Offload + Early Access](https://docs.docker.com/offload/) + + + [Quickstart](https://docs.docker.com/offload/quickstart/ "Quickstart") + + [About](https://docs.docker.com/offload/about/ "About") + + [Configure](https://docs.docker.com/offload/configuration/ "Configure") + + [Usage & billing](https://docs.docker.com/offload/usage/ "Usage & billing") + + [Optimize usage](https://docs.docker.com/offload/optimize/ "Optimize usage") + + [Troubleshoot](https://docs.docker.com/offload/troubleshoot/ "Troubleshoot") + + [Give feedback](https://docs.docker.com/offload/feedback/ "Give feedback") +* [Docker Build Cloud](https://docs.docker.com/build-cloud/) + + + [Setup](https://docs.docker.com/build-cloud/setup/ "Setup") + + [Usage](https://docs.docker.com/build-cloud/usage/ "Usage") + + [Continuous integration](https://docs.docker.com/build-cloud/ci/ "Continuous integration") + + [Optimization](https://docs.docker.com/build-cloud/optimization/ "Optimization") + + [Builder settings](https://docs.docker.com/build-cloud/builder-settings/ "Builder settings") + + [Release notes](https://docs.docker.com/build-cloud/release-notes/ "Release notes") +* [Docker Hub](https://docs.docker.com/docker-hub/) + + + [Quickstart](https://docs.docker.com/docker-hub/quickstart/ "Quickstart") + + [Library](https://docs.docker.com/docker-hub/image-library/) + + - [Search](https://docs.docker.com/docker-hub/image-library/search/ "Search") + - [Trusted content](https://docs.docker.com/docker-hub/image-library/trusted-content/ "Trusted content") + - [Catalogs](https://docs.docker.com/docker-hub/image-library/catalogs/ "Catalogs") + - [Mirror](https://docs.docker.com/docker-hub/image-library/mirror/ "Mirror") + + [Repositories](https://docs.docker.com/docker-hub/repos/) + + - [Create](https://docs.docker.com/docker-hub/repos/create/ "Create") + - Manage + + * [Repository information](https://docs.docker.com/docker-hub/repos/manage/information/ "Repository information") + * [Access](https://docs.docker.com/docker-hub/repos/manage/access/ "Access") + * [Images](https://docs.docker.com/docker-hub/repos/manage/hub-images/) + + + [Tags](https://docs.docker.com/docker-hub/repos/manage/hub-images/tags/ "Tags") + + [Immutable tags](https://docs.docker.com/docker-hub/repos/manage/hub-images/immutable-tags/ "Immutable tags") + + [Image Management](https://docs.docker.com/docker-hub/repos/manage/hub-images/manage/ "Image Management") + + [Software artifacts](https://docs.docker.com/docker-hub/repos/manage/hub-images/oci-artifacts/ "Software artifacts") + + [Push images](https://docs.docker.com/docker-hub/repos/manage/hub-images/push/ "Push images") + + [Move images](https://docs.docker.com/docker-hub/repos/manage/hub-images/move/ "Move images") + + [Bulk migrate Docker images](https://docs.docker.com/docker-hub/repos/manage/hub-images/bulk-migrate/ "Bulk migrate Docker images") + * [Image security insights](https://docs.docker.com/docker-hub/repos/manage/vulnerability-scanning/ "Image security insights") + * [Webhooks](https://docs.docker.com/docker-hub/repos/manage/webhooks/ "Webhooks") + * [Automated builds](https://docs.docker.com/docker-hub/repos/manage/builds/) + + + [Set up](https://docs.docker.com/docker-hub/repos/manage/builds/setup/ "Set up") + + [Link accounts](https://docs.docker.com/docker-hub/repos/manage/builds/link-source/ "Link accounts") + + [Automated repository tests](https://docs.docker.com/docker-hub/repos/manage/builds/automated-testing/ "Automated repository tests") + + [Advanced options](https://docs.docker.com/docker-hub/repos/manage/builds/advanced/ "Advanced options") + + [Manage autobuilds](https://docs.docker.com/docker-hub/repos/manage/builds/manage-builds/ "Manage autobuilds") + + [Troubleshoot](https://docs.docker.com/docker-hub/repos/manage/builds/troubleshoot/ "Troubleshoot") + * [Trusted content](https://docs.docker.com/docker-hub/repos/manage/trusted-content/) + + + [Docker Official Images](https://docs.docker.com/docker-hub/repos/manage/trusted-content/official-images/ "Docker Official Images") + + [Docker Verified Publisher Program](https://docs.docker.com/docker-hub/repos/manage/trusted-content/dvp-program/ "Docker Verified Publisher Program") + + [Docker-Sponsored Open Source Program](https://docs.docker.com/docker-hub/repos/manage/trusted-content/dsos-program/ "Docker-Sponsored Open Source Program") + + [Insights and analytics](https://docs.docker.com/docker-hub/repos/manage/trusted-content/insights-analytics/ "Insights and analytics") + * [Export repositories](https://docs.docker.com/docker-hub/repos/manage/export/ "Export repositories") + - [Archive](https://docs.docker.com/docker-hub/repos/archive/ "Archive") + - [Delete](https://docs.docker.com/docker-hub/repos/delete/ "Delete") + - [Personal settings](https://docs.docker.com/docker-hub/repos/settings/ "Personal settings") + + [Usage and limits](https://docs.docker.com/docker-hub/usage/) + + - [Pulls](https://docs.docker.com/docker-hub/usage/pulls/ "Pulls") + - [Optimize usage](https://docs.docker.com/docker-hub/usage/manage/ "Optimize usage") + + [Service accounts](https://docs.docker.com/docker-hub/service-accounts/ "Service accounts") + + [Troubleshoot](https://docs.docker.com/docker-hub/troubleshoot/ "Troubleshoot") + + [Release notes](https://docs.docker.com/docker-hub/release-notes/ "Release notes") +* [Docker Scout](https://docs.docker.com/scout/) + + + [Install](https://docs.docker.com/scout/install/ "Install") + + [Quickstart](https://docs.docker.com/scout/quickstart/ "Quickstart") + + Explore + + - [Dashboard](https://docs.docker.com/scout/explore/dashboard/ "Dashboard") + - [Docker Scout image analysis](https://docs.docker.com/scout/explore/analysis/ "Docker Scout image analysis") + - [Docker Scout metrics exporter](https://docs.docker.com/scout/explore/metrics-exporter/ "Docker Scout metrics exporter") + - [Image details view](https://docs.docker.com/scout/explore/image-details-view/ "Image details view") + - [Manage vulnerability exceptions](https://docs.docker.com/scout/explore/exceptions/ "Manage vulnerability exceptions") + + How-tos + + - [Create an exception using the GUI](https://docs.docker.com/scout/how-tos/create-exceptions-gui/ "Create an exception using the GUI") + - [Create an exception using the VEX](https://docs.docker.com/scout/how-tos/create-exceptions-vex/ "Create an exception using the VEX") + - [Docker Scout environment variables](https://docs.docker.com/scout/how-tos/configure-cli/ "Docker Scout environment variables") + - [Docker Scout SBOMs](https://docs.docker.com/scout/how-tos/view-create-sboms/ "Docker Scout SBOMs") + - [Use Scout with different artifact types](https://docs.docker.com/scout/how-tos/artifact-types/ "Use Scout with different artifact types") + + Deep dive + + - [Advisory database sources and matching service](https://docs.docker.com/scout/deep-dive/advisory-db-sources/ "Advisory database sources and matching service") + - [Data collection and storage in Docker Scout](https://docs.docker.com/scout/deep-dive/data-handling/ "Data collection and storage in Docker Scout") + + [Policy Evaluation](https://docs.docker.com/scout/policy/) + + - [Configure policies](https://docs.docker.com/scout/policy/configure/ "Configure policies") + - [Docker Scout health scores](https://docs.docker.com/scout/policy/scores/ "Docker Scout health scores") + - [Evaluate policy compliance in CI](https://docs.docker.com/scout/policy/ci/ "Evaluate policy compliance in CI") + - [Remediation with Docker Scout](https://docs.docker.com/scout/policy/remediation/ "Remediation with Docker Scout") + - [View Docker Scout policy status](https://docs.docker.com/scout/policy/view/ "View Docker Scout policy status") + + [Integrations](https://docs.docker.com/scout/integrations/) + + - Code quality + + * [SonarQube](https://docs.docker.com/scout/integrations/code-quality/sonarqube/ "SonarQube") + - Container registries + + * [Amazon ECR](https://docs.docker.com/scout/integrations/registry/ecr/ "Amazon ECR") + * [Artifactory Container Registry](https://docs.docker.com/scout/integrations/registry/artifactory/ "Artifactory Container Registry") + * [Azure Container Registry](https://docs.docker.com/scout/integrations/registry/acr/ "Azure Container Registry") + - [Continuous Integration](https://docs.docker.com/scout/integrations/ci/) + + * [Azure DevOps Pipelines](https://docs.docker.com/scout/integrations/ci/azure/ "Azure DevOps Pipelines") + * [Circle CI](https://docs.docker.com/scout/integrations/ci/circle-ci/ "Circle CI") + * [GitHub Actions](https://docs.docker.com/scout/integrations/ci/gha/ "GitHub Actions") + * [GitLab CI/CD](https://docs.docker.com/scout/integrations/ci/gitlab/ "GitLab CI/CD") + * [Jenkins](https://docs.docker.com/scout/integrations/ci/jenkins/ "Jenkins") + - [Integrating Docker Scout with environments](https://docs.docker.com/scout/integrations/environment/) + + * [Generic (CLI)](https://docs.docker.com/scout/integrations/environment/cli/ "Generic (CLI)") + * [Sysdig](https://docs.docker.com/scout/integrations/environment/sysdig/ "Sysdig") + - Source code management + + * [GitHub](https://docs.docker.com/scout/integrations/source-code-management/github/ "GitHub") + - Team collaboration + + * [Slack](https://docs.docker.com/scout/integrations/team-collaboration/slack/ "Slack") + + Release notes + + - [CLI release notes](https://docs.docker.com/scout/release-notes/cli/ "CLI release notes") + - [Platform release notes](https://docs.docker.com/scout/release-notes/platform/ "Platform release notes") +* [Docker Extensions](https://docs.docker.com/extensions/) + + + [Marketplace extensions](https://docs.docker.com/extensions/marketplace/ "Marketplace extensions") + + [Non-marketplace extensions](https://docs.docker.com/extensions/non-marketplace/ "Non-marketplace extensions") + + [Configure a private marketplace](https://docs.docker.com/extensions/private-marketplace/ "Configure a private marketplace") + + [Settings and feedback](https://docs.docker.com/extensions/settings-feedback/ "Settings and feedback") + + [Extensions SDK](https://docs.docker.com/extensions/extensions-sdk/) + + - [The build and publish process](https://docs.docker.com/extensions/extensions-sdk/process/ "The build and publish process") + - [Quickstart](https://docs.docker.com/extensions/extensions-sdk/quickstart/ "Quickstart") + - Part one: Build + + * [Create a simple extension](https://docs.docker.com/extensions/extensions-sdk/build/minimal-frontend-extension/ "Create a simple extension") + * [Create an advanced frontend extension](https://docs.docker.com/extensions/extensions-sdk/build/frontend-extension-tutorial/ "Create an advanced frontend extension") + * [Add a backend to your extension](https://docs.docker.com/extensions/extensions-sdk/build/backend-extension-tutorial/ "Add a backend to your extension") + - [Part two: Publish](https://docs.docker.com/extensions/extensions-sdk/extensions/) + + * [Add labels](https://docs.docker.com/extensions/extensions-sdk/extensions/labels/ "Add labels") + * [Validate](https://docs.docker.com/extensions/extensions-sdk/extensions/validate/ "Validate") + * [Package and release your extension](https://docs.docker.com/extensions/extensions-sdk/extensions/DISTRIBUTION/ "Package and release your extension") + * [Share your extension](https://docs.docker.com/extensions/extensions-sdk/extensions/share/ "Share your extension") + * [Publish in the Marketplace](https://docs.docker.com/extensions/extensions-sdk/extensions/publish/ "Publish in the Marketplace") + * [Build multi-arch extensions](https://docs.docker.com/extensions/extensions-sdk/extensions/multi-arch/ "Build multi-arch extensions") + - [Architecture](https://docs.docker.com/extensions/extensions-sdk/architecture/) + + * [Metadata](https://docs.docker.com/extensions/extensions-sdk/architecture/metadata/ "Metadata") + * [Security](https://docs.docker.com/extensions/extensions-sdk/architecture/security/ "Security") + - [Design and UI styling](https://docs.docker.com/extensions/extensions-sdk/design/) + + * [Guidelines](https://docs.docker.com/extensions/extensions-sdk/design/design-guidelines/ "Guidelines") + * [Docker design principles](https://docs.docker.com/extensions/extensions-sdk/design/design-principles/ "Docker design principles") + * [MUI best practices](https://docs.docker.com/extensions/extensions-sdk/design/mui-best-practices/ "MUI best practices") + - Developer Guides + + * [Authentication](https://docs.docker.com/extensions/extensions-sdk/guides/oauth2-flow/ "Authentication") + * [Interacting with Kubernetes](https://docs.docker.com/extensions/extensions-sdk/guides/kubernetes/ "Interacting with Kubernetes") + * [Invoke host binaries](https://docs.docker.com/extensions/extensions-sdk/guides/invoke-host-binaries/ "Invoke host binaries") + * [Use the Docker socket](https://docs.docker.com/extensions/extensions-sdk/guides/use-docker-socket-from-backend/ "Use the Docker socket") + - Developer SDK tools + + * [Test and debug](https://docs.docker.com/extensions/extensions-sdk/dev/test-debug/ "Test and debug") + * [Continuous Integration (CI)](https://docs.docker.com/extensions/extensions-sdk/dev/continuous-integration/ "Continuous Integration (CI)") + * [CLI reference](https://docs.docker.com/extensions/extensions-sdk/dev/usage/ "CLI reference") + * Extension APIs + + + [Dashboard](https://docs.docker.com/extensions/extensions-sdk/dev/api/dashboard/ "Dashboard") + + [Docker](https://docs.docker.com/extensions/extensions-sdk/dev/api/docker/ "Docker") + + [Extension Backend](https://docs.docker.com/extensions/extensions-sdk/dev/api/backend/ "Extension Backend") + + [Extension UI API](https://docs.docker.com/extensions/extensions-sdk/dev/api/overview/ "Extension UI API") + + [Navigation](https://docs.docker.com/extensions/extensions-sdk/dev/api/dashboard-routes-navigation/ "Navigation") +* [Testcontainers Cloud](https://testcontainers.com/cloud/docs/ "Testcontainers Cloud") +* [Deprecated products and features](https://docs.docker.com/retired/ "Deprecated products and features") +* [Release lifecycle](https://docs.docker.com/release-lifecycle/ "Release lifecycle") + +* Platform +* [Support](https://docs.docker.com/support/) +* [Billing](https://docs.docker.com/billing/) + + + [Add or update a payment method](https://docs.docker.com/billing/payment-method/ "Add or update a payment method") + + [Manage your billing information](https://docs.docker.com/billing/details/ "Manage your billing information") + + [3D Secure authentication](https://docs.docker.com/billing/3d-secure/ "3D Secure authentication") + + [Invoices and billing history](https://docs.docker.com/billing/history/ "Invoices and billing history") + + [Change your billing cycle](https://docs.docker.com/billing/cycle/ "Change your billing cycle") + + [Submit a tax exemption certificate](https://docs.docker.com/billing/tax-certificate/ "Submit a tax exemption certificate") + + [FAQs](https://docs.docker.com/billing/faqs/ "FAQs") +* [Docker accounts](https://docs.docker.com/accounts/) + + + [Accounts](https://docs.docker.com/accounts/general-faqs/ "Accounts") + + [Create an account](https://docs.docker.com/accounts/create-account/ "Create an account") + + [Manage an account](https://docs.docker.com/accounts/manage-account/ "Manage an account") + + [Deactivate an account](https://docs.docker.com/accounts/deactivate-user-account/ "Deactivate an account") +* [Security](https://docs.docker.com/security/) + + + [Personal access tokens](https://docs.docker.com/security/access-tokens/ "Personal access tokens") + + [Two-factor authentication](https://docs.docker.com/security/2fa/) + + - [Recover your Docker account](https://docs.docker.com/security/2fa/recover-hub-account/ "Recover your Docker account") + + FAQs + + - [General](https://docs.docker.com/security/faqs/general/ "General") + - [Container](https://docs.docker.com/security/faqs/containers/ "Container") + - [Network and VM](https://docs.docker.com/security/faqs/networking-and-vms/ "Network and VM") + + [Security announcements](https://docs.docker.com/security/security-announcements/ "Security announcements") +* [Subscription](https://docs.docker.com/subscription/) + + + [Subscriptions and features](https://docs.docker.com/subscription/details/ "Subscriptions and features") + + [Set up your subscription](https://docs.docker.com/subscription/setup/ "Set up your subscription") + + [Scale your subscription](https://docs.docker.com/subscription/scale/ "Scale your subscription") + + [Manage seats](https://docs.docker.com/subscription/manage-seats/ "Manage seats") + + [Change your subscription](https://docs.docker.com/subscription/change/ "Change your subscription") + + [Docker Desktop license agreement](https://docs.docker.com/subscription/desktop-license/ "Docker Desktop license agreement") + + [FAQs](https://docs.docker.com/subscription/faq/ "FAQs") +* [Release notes](https://docs.docker.com/platform-release-notes/ "Release notes") + +* Enterprise +* [Administration](https://docs.docker.com/admin/) + + + [Organization administration](https://docs.docker.com/admin/organization/) + + - [Create your organization](https://docs.docker.com/admin/organization/orgs/ "Create your organization") + - [Onboard your organization](https://docs.docker.com/admin/organization/onboard/ "Onboard your organization") + - [Manage organization members](https://docs.docker.com/admin/organization/members/ "Manage organization members") + - [Convert an account into an organization](https://docs.docker.com/admin/organization/convert-account/ "Convert an account into an organization") + - [Create and manage a team](https://docs.docker.com/admin/organization/manage-a-team/ "Create and manage a team") + - [Deactivate an organization](https://docs.docker.com/admin/organization/deactivate-account/ "Deactivate an organization") + - [Manage Docker products](https://docs.docker.com/admin/organization/manage-products/ "Manage Docker products") + - [Activity logs](https://docs.docker.com/admin/organization/activity-logs/ "Activity logs") + - [Organization information](https://docs.docker.com/admin/organization/general-settings/ "Organization information") + - [Insights](https://docs.docker.com/admin/organization/insights/ "Insights") + + [Company administration overview](https://docs.docker.com/admin/company/) + + - [Create a company](https://docs.docker.com/admin/company/new-company/ "Create a company") + - [Manage company members](https://docs.docker.com/admin/company/users/ "Manage company members") + - [Manage company organizations](https://docs.docker.com/admin/company/organizations/ "Manage company organizations") + - [Manage company owners](https://docs.docker.com/admin/company/owners/ "Manage company owners") + + FAQ + + - [Organization](https://docs.docker.com/admin/faqs/organization-faqs/ "Organization") + - [Company](https://docs.docker.com/admin/faqs/company-faqs/ "Company") +* [Deploy Docker Desktop](https://docs.docker.com/enterprise/enterprise-deployment/) + + + [MSI installer](https://docs.docker.com/enterprise/enterprise-deployment/msi-install-and-configure/ "MSI installer") + + [PKG installer](https://docs.docker.com/enterprise/enterprise-deployment/pkg-install-and-configure/ "PKG installer") + + [MS Store](https://docs.docker.com/enterprise/enterprise-deployment/ms-store/ "MS Store") + + [Deploy with Intune](https://docs.docker.com/enterprise/enterprise-deployment/use-intune/ "Deploy with Intune") + + [Deploy with Jamf Pro](https://docs.docker.com/enterprise/enterprise-deployment/use-jamf-pro/ "Deploy with Jamf Pro") + + [Microsoft Dev Box](https://docs.docker.com/enterprise/enterprise-deployment/dev-box/ "Microsoft Dev Box") + + [FAQs](https://docs.docker.com/enterprise/enterprise-deployment/faq/ "FAQs") +* [Security](https://docs.docker.com/enterprise/security/) + + + [Single sign-on](https://docs.docker.com/enterprise/security/single-sign-on/) + + - [Configure](https://docs.docker.com/enterprise/security/single-sign-on/configure/ "Configure") + - [Connect](https://docs.docker.com/enterprise/security/single-sign-on/connect/ "Connect") + - FAQs + + * [General](https://docs.docker.com/enterprise/security/single-sign-on/faqs/general/ "General") + * [Domains](https://docs.docker.com/enterprise/security/single-sign-on/faqs/domain-faqs/ "Domains") + * [Enforcement](https://docs.docker.com/enterprise/security/single-sign-on/faqs/enforcement-faqs/ "Enforcement") + * [Identity providers](https://docs.docker.com/enterprise/security/single-sign-on/faqs/idp-faqs/ "Identity providers") + * [User management](https://docs.docker.com/enterprise/security/single-sign-on/faqs/users-faqs/ "User management") + - [Manage](https://docs.docker.com/enterprise/security/single-sign-on/manage/ "Manage") + + [Provision](https://docs.docker.com/enterprise/security/provisioning/) + + - [Just-in-Time](https://docs.docker.com/enterprise/security/provisioning/just-in-time/ "Just-in-Time") + - [SCIM](https://docs.docker.com/enterprise/security/provisioning/scim/ "SCIM") + - [Group mapping](https://docs.docker.com/enterprise/security/provisioning/group-mapping/ "Group mapping") + + [Enforce sign-in](https://docs.docker.com/enterprise/security/enforce-sign-in/) + + - [Configure](https://docs.docker.com/enterprise/security/enforce-sign-in/methods/ "Configure") + + [Roles and permissions](https://docs.docker.com/enterprise/security/roles-and-permissions/) + + - [Core roles](https://docs.docker.com/enterprise/security/roles-and-permissions/core-roles/ "Core roles") + - [Custom roles](https://docs.docker.com/enterprise/security/roles-and-permissions/custom-roles/ "Custom roles") + + [Manage domains](https://docs.docker.com/enterprise/security/domain-management/ "Manage domains") + + [Hardened Docker Desktop](https://docs.docker.com/enterprise/security/hardened-desktop/) + + - [Enhanced Container Isolation](https://docs.docker.com/enterprise/security/hardened-desktop/enhanced-container-isolation/) + + * [Enable ECI](https://docs.docker.com/enterprise/security/hardened-desktop/enhanced-container-isolation/enable-eci/ "Enable ECI") + * [Configure advanced settings](https://docs.docker.com/enterprise/security/hardened-desktop/enhanced-container-isolation/config/ "Configure advanced settings") + * [Limitations](https://docs.docker.com/enterprise/security/hardened-desktop/enhanced-container-isolation/limitations/ "Limitations") + * [FAQs](https://docs.docker.com/enterprise/security/hardened-desktop/enhanced-container-isolation/faq/ "FAQs") + - [Settings Management](https://docs.docker.com/enterprise/security/hardened-desktop/settings-management/) + + * [Use a JSON file](https://docs.docker.com/enterprise/security/hardened-desktop/settings-management/configure-json-file/ "Use a JSON file") + * [Use the Admin Console](https://docs.docker.com/enterprise/security/hardened-desktop/settings-management/configure-admin-console/ "Use the Admin Console") + * [Desktop settings reporting](https://docs.docker.com/enterprise/security/hardened-desktop/settings-management/compliance-reporting/ "Desktop settings reporting") + * [Settings reference](https://docs.docker.com/enterprise/security/hardened-desktop/settings-management/settings-reference/ "Settings reference") + - [Registry Access Management](https://docs.docker.com/enterprise/security/hardened-desktop/registry-access-management/ "Registry Access Management") + - [Image Access Management](https://docs.docker.com/enterprise/security/hardened-desktop/image-access-management/ "Image Access Management") + - [Air-gapped containers](https://docs.docker.com/enterprise/security/hardened-desktop/air-gapped-containers/ "Air-gapped containers") + + [Organization access tokens](https://docs.docker.com/enterprise/security/access-tokens/ "Organization access tokens") +* Troubleshoot + + + [Troubleshoot provisioning](https://docs.docker.com/enterprise/troubleshoot/troubleshoot-provisioning/ "Troubleshoot provisioning") + + [Troubleshoot SSO](https://docs.docker.com/enterprise/troubleshoot/troubleshoot-sso/ "Troubleshoot SSO") + +[Home](https://docs.docker.com/) +/ +[Manuals](https://docs.docker.com/manuals/) +/ +[Docker Engine](https://docs.docker.com/engine/) +/ +Release notes +/ +Engine v27 + +# Docker Engine version 27 release notes + +Page options + +Copy page as Markdown for LLMs + + + + +View page as plain text + + + + +Ask questions with Docs AI + + +Claude + +Open in Claude + +Table of contents + +* [27.5](#275) + +* [27.4](#274) + +* [27.3](#273) + +* [27.2](#272) + +* [27.1](#271) + +* [27.0](#270) + +--- + +This page describes the latest changes, additions, known issues, and fixes for Docker Engine version 27. + +For more information about: + +* Deprecated and removed features, see [Deprecated Engine Features](https://docs.docker.com/engine/deprecated/). +* Changes to the Engine API, see + [Engine API version history](/reference/api/engine/version-history/). + +## [27.5](#275) + +Release notes for Docker Engine version 27.5 releases. + +### [27.5.1](#2751) + +*2025-01-22* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 27.5.1 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A27.5.1) +* [moby/moby, 27.5.1 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A27.5.1) + +#### [Bug fixes and enhancements](#bug-fixes-and-enhancements) + +* Fix an issue that could persistently prevent daemon startup after failure to initialize the default bridge. [moby/moby#49307](https://github.com/moby/moby/pull/49307) +* Add a `DOCKER_IGNORE_BR_NETFILTER_ERROR` environment variable. Setting it to `1` allows running on hosts that cannot load `br_netfilter`. Some things won't work, including disabling inter-container communication in a bridge network. With the userland proxy disabled, it won't be possible to access one container's published ports from another container on the same network. [moby/moby#49306](https://github.com/moby/moby/pull/49306) + +#### [Packaging updates](#packaging-updates) + +* Update Go runtime to 1.22.11 (fix CVE-2024-45341, CVE-2024-45336). [moby/moby#49312](https://github.com/moby/moby/pull/49312), [docker/docker-ce-packaging#1147](https://github.com/docker/docker-ce-packaging/pull/1147), [docker/cli#5762](https://github.com/docker/cli/pull/5762) +* Update RootlessKit to v2.3.2 to support `passt` >= 2024\_10\_30.ee7d0b6. [moby/moby#49304](https://github.com/moby/moby/pull/49304) +* Update Buildx to [v0.20.0](https://github.com/docker/buildx/releases/tag/v0.20.0). [docker/docker-ce-packaging#1149](https://github.com/docker/docker-ce-packaging/pull/1149) + +### [27.5.0](#2750) + +*2025-01-13* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 27.5.0 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A27.5.0) +* [moby/moby, 27.5.0 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A27.5.0) + +#### [Bugfixes and enhancements](#bugfixes-and-enhancements) + +* containerd image store: Fix passing a build context via tarball to the `/build` endpoint. [moby/moby#49194](https://github.com/moby/moby/pull/49194) +* Builder garbage collection policies without a `keepStorage` value now inherit the `defaultKeepStorage` limit as intended. [moby/moby#49137](https://github.com/moby/moby/pull/49137) +* Preserve network labels during daemon startup. [moby/moby#49200](https://github.com/moby/moby/pull/49200) +* Fix a potential race condition error when deleting a container. [moby/moby#49239](https://github.com/moby/moby/pull/49239) + +#### [Go SDK](#go-sdk) + +* `pkg/sysinfo`: deprecate `NumCPU`. This utility has the same behavior as `runtime.NumCPU`. [moby/moby#49247](https://github.com/moby/moby/pull/49247) +* `pkg/fileutils`: deprecate `GetTotalUsedFds`: this function is only used internally and will be removed in the next release. [moby/moby#49209](https://github.com/moby/moby/pull/49209) +* `pkg/ioutils`: deprecate `BytesPipe`, `NewBytesPipe`, `ErrClosed`, `WriteCounter`, `NewWriteCounter`, `NewReaderErrWrapper`, `NopFlusher`, `NopWriter`, `NopWriteCloser`. They were only used internally and will be removed in the next release. [moby/moby#49246](https://github.com/moby/moby/pull/49246), [moby/moby#49255](https://github.com/moby/moby/pull/49255) +* `pkg/reexec`: This package is deprecated and moved to a separate module. Use `github.com/moby/sys/reexec` instead. [moby/moby#49135](https://github.com/moby/moby/pull/49135) + +#### [Packaging updates](#packaging-updates-1) + +* Update containerd to [v1.7.25](https://github.com/containerd/containerd/releases/tag/v1.7.25) [moby/moby#49253](https://github.com/moby/moby/pull/49253) +* Update `runc` to [v1.2.4](https://github.com/opencontainers/runc/releases/tag/v1.2.4) [moby/moby#49243](https://github.com/moby/moby/pull/49243) +* Update BuildKit to [v0.18.2](https://github.com/moby/buildkit/releases/tag/v0.18.2) [moby/moby#48949](https://github.com/moby/moby/pull/48949) +* Update Compose to [v2.32.2](https://github.com/docker/compose/releases/tag/v2.32.2) [docker/docker-ce-packaging#1140](https://github.com/docker/docker-ce-packaging/pull/1140) + +## [27.4](#274) + +Release notes for Docker Engine version 27.4 releases. + +### [27.4.1](#2741) + +*2024-12-18* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 27.4.1 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A27.4.1) +* [moby/moby, 27.4.1 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A27.4.1) + +#### [Bug fixes and enhancements](#bug-fixes-and-enhancements-1) + +* Fix excessive memory allocations when OTel is not configured. [moby/moby#49079](https://github.com/moby/moby/pull/49079) +* The `docker info` command and the corresponding `GET /info` API endpoint no longer include warnings when `bridge-nf-call-iptables` or `bridge-nf-call-ip6tables` are disabled at the daemon is started. The `br_netfilter` kernel module is now attempted to be loaded when needed, which made those warnings inaccurate. [moby/moby#49090](https://github.com/moby/moby/pull/49090) +* Attempt to load kernel modules, including `ip6_tables` and `br_netfilter` when required, using a method that is likely to succeed inside a Docker-in-Docker container. [moby/moby#49043](https://github.com/moby/moby/pull/49043) +* Fix a bug that could result in an iptables `DOCKER FILTER` chain not being cleaned up on failure. [moby/moby#49110](https://github.com/moby/moby/pull/49110) + +#### [Packaging updates](#packaging-updates-2) + +* Update Compose to [v2.32.1](https://github.com/docker/compose/releases/tag/v2.32.1). [docker/docker-ce-packaging#1130](https://github.com/docker/docker-ce-packaging/pull/1130) +* Update Buildx to [v0.19.3](https://github.com/docker/buildx/releases/tag/v0.19.3). [docker/docker-ce-packaging#1132](https://github.com/docker/docker-ce-packaging/pull/1132) +* Update runc (static binaries only) to [v1.2.3](https://github.com/opencontainers/runc/releases/tag/v1.2.3) [moby/moby#49085](https://github.com/moby/moby/pull/49085) + +### [27.4.0](#2740) + +*2024-12-09* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 27.4.0 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A27.4.0) +* [moby/moby, 27.4.0 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A27.4.0) + +#### [API](#api) + +* `GET /images/json` with the `manifests` option enabled now preserves the original order in which manifests appeared in the manifest-index. [moby/moby#48712](https://github.com/moby/moby/pull/48712) + +#### [Bug fixes and enhancements](#bug-fixes-and-enhancements-2) + +* When reading logs with the `jsonfile` or `local` log drivers, any errors while trying to read or parse underlying log files will cause the rest of the file to be skipped and move to the next log file (if one exists) rather than returning an error to the client and closing the stream. The errors are viewable in the Docker Daemon logs and exported to traces when tracing is configured. [moby/moby#48842](https://github.com/moby/moby/pull/48842) +* When reading log files, compressed log files are now only decompressed when needed rather than decompressing all files before starting the log stream. [moby/moby#48842](https://github.com/moby/moby/pull/48842) +* Fix an issue that meant published ports from one container on a bridge network were not accessible from another container on the same network with `userland-proxy` disabled, if the kernel's `br_netfilter` module was not loaded and enabled. The daemon will now attempt to load the module and enable `bridge-nf-call-iptables` or `bridge-nf-call-ip6tables` when creating a network with the userland proxy disabled. [moby/moby#48685](https://github.com/moby/moby/pull/48685) +* Fix loading of `bridge` and `br_netfilter` kernel modules. [moby/moby#48966](https://github.com/moby/moby/pull/48966) +* containerd image store: Fix Docker daemon failing to fully start with a "context deadline exceeded error" with containerd snapshotter and many builds/images. [moby/moby#48954](https://github.com/moby/moby/pull/48954) +* containerd image store: Fix partially pulled images not being garbage-collected. [moby#48910](https://github.com/moby/moby/pull/48910), [moby/moby#48957](https://github.com/moby/moby/pull/48957) +* containerd image store: Fix `docker image inspect` outputting duplicate references in `RepoDigests`. [moby/moby#48785](https://github.com/moby/moby/pull/48785) +* containerd image store: Fix not being able to connect to some insecure registries in cases where the HTTPS request failed due to a non-TLS related error. [moby/moby#48758](https://github.com/moby/moby/pull/48758) +* containerd image store: Remove a confusing warning log when tagging a non-dangling image. [moby/moby#49010](https://github.com/moby/moby/pull/49010) +* containerd image store: Do not underline names in `docker image ls --tree`. [docker/cli#5519](https://github.com/docker/cli/pull/5519) +* containerd image store: Change name of `USED` column in `docker image ls --tree` to `IN USE`. [docker/cli#5518](https://github.com/docker/cli/pull/5518) +* `dockerd-rootless-setuptool.sh install --force` now ignores RootlessKit errors [moby/moby#48695](https://github.com/moby/moby/pull/48695) +* Disable IPv6 Duplicate Address Detection (DAD) for addresses assigned to the bridges belonging to bridge networks. [moby/moby#48684](https://github.com/moby/moby/pull/48684) +* Remove BuildKit init timeout. [moby/moby#48963](https://github.com/moby/moby/pull/48963) +* Ignore "dataset does not exist" error when removing dataset on ZFS. [moby/moby#48968](https://github.com/moby/moby/pull/48968) +* Client: Prevent idle connections leaking FDs. [moby/moby#48764](https://github.com/moby/moby/pull/48764) +* Fix anonymous volumes being created through the `--mount` option not being marked as anonymous. [moby/moby#48755](https://github.com/moby/moby/pull/48755) +* After a daemon restart with live-restore, ensure an iptables jump to the `DOCKER-USER` chain is placed before other rules. [moby/moby#48714](https://github.com/moby/moby/pull/48714) +* Fix a possible memory leak caused by OTel meters. [moby/moby#48693](https://github.com/moby/moby/pull/48693) +* Create distinct build history db for each image store. [moby/moby#48688](https://github.com/moby/moby/pull/48688) +* Fix an issue that caused excessive memory usage when DNS resolution was made in a tight loop. [moby/moby#48840](https://github.com/moby/moby/pull/48840) +* Fix a bug preventing image pulls from being cancelled during `docker run`. [docker/cli#5654](https://github.com/docker/cli/pull/5654) +* The `docker login` and `docker logout` command no longer update the configuration file if the credentials didn't change. [docker/cli#5569](https://github.com/docker/cli/pull/5569) +* Optimize `docker stats` to reduce flickering issues. [docker/cli#5588](https://github.com/docker/cli/pull/5588), [docker/cli#5635](https://github.com/docker/cli/pull/5635) +* Fix inaccessible plugins paths preventing plugins from being detected. [docker/cli#5652](https://github.com/docker/cli/pull/5652) +* Add support for `events --filter` in cobra generated shell completions. [docker/cli#5614](https://github.com/docker/cli/pull/5614) +* Fix bash completion for `events --filter daemon=`. [docker/cli#5563](https://github.com/docker/cli/pull/5563) +* Improve shell completion of containers for `docker rm`. [docker/cli#5540](https://github.com/docker/cli/pull/5540) +* Add shell completion for `--platform` flags. [docker/cli#5540](https://github.com/docker/cli/pull/5540) +* rootless: Make `/etc/cdi` and `/var/run/cdi` accessible by the Container Device Interface (CDI) integration. [moby/moby#49027](https://github.com/moby/moby/pull/49027) + +#### [Removed](#removed) + +* Deprecate `Daemon.Exists()` and `Daemon.IsPaused()`. These functions are no longer used and will be removed in the next release. [moby/moby#48719](https://github.com/moby/moby/pull/48719) +* Deprecate `container.ErrNameReserved` and `container.ErrNameNotReserved`. [moby/moby#48697](https://github.com/moby/moby/pull/48697) +* Deprecate `pkg/platform` - this package is only used internally, and will be removed in the next release. [moby/moby#48863](https://github.com/moby/moby/pull/48863) +* Deprecate `RepositoryInfo.Class`. This field is no longer used, and will be removed in the next release. [moby/moby#49013](https://github.com/moby/moby/pull/49013) +* Go SDK: Fix deprecation of `cli/command.ConfigureAuth()`, which was deprecated since v27.2.1. [docker/cli#5552](https://github.com/docker/cli/pull/5552) +* Go SDK: Deprecate `cli.Errors` type in favour of Go's `errors.Join` [docker/cli#5548](https://github.com/docker/cli/pull/5548) + +#### [Packaging updates](#packaging-updates-3) + +* Update Go runtime to 1.22.10. [moby/moby#49026](https://github.com/moby/moby/pull/49026), [docker/cli#5669](https://github.com/docker/cli/pull/5669), [docker/docker-ce-packaging#1120](https://github.com/docker/docker-ce-packaging/pull/1120). +* Update Compose to [v2.31.0](https://github.com/docker/compose/releases/tag/v2.31.0). [docker/docker-ce-packaging#1100](https://github.com/docker/docker-ce-packaging/pull/1117) +* Update BuildKit to [v0.17.3](https://github.com/moby/buildkit/releases/tag/v0.17.3). [moby/moby#49024](https://github.com/moby/moby/pull/49024) +* Update Buildx to [v0.19.1](https://github.com/docker/buildx/releases/tag/v0.19.1). [docker/docker-ce-packaging#1115](https://github.com/docker/docker-ce-packaging/pull/1115) +* Update containerd to [v1.7.24](https://github.com/containerd/containerd/releases/tag/v1.7.24). [moby/moby#48934](https://github.com/moby/moby/pull/48934) +* Update containerd (static binaries only) to [v1.7.24](https://github.com/containerd/containerd/releases/tag/v1.7.24). [moby/moby#48919](https://github.com/moby/moby/pull/48919) +* Update runc to [v1.2.2](https://github.com/opencontainers/runc/releases/tag/v1.2.2). [moby/moby#48919](https://github.com/moby/moby/pull/48919) + +## [27.3](#273) + +Release notes for Docker Engine version 27.3 releases. + +### [27.3.1](#2731) + +*2024-09-20* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 27.3.1 milestone](https://github.com/docker/cli/issues?q=sort%3Aupdated-desc+is%3Aclosed+milestone%3A27.3.1) +* [moby/moby, 27.3.1 milestone](https://github.com/moby/moby/issues?q=sort%3Aupdated-desc+is%3Aclosed+milestone%3A27.3.1) + +#### [Bug fixes and enhancements](#bug-fixes-and-enhancements-3) + +* CLI: Fix issue with command execution metrics not being exported correctly. [docker/cli#5457](https://github.com/docker/cli/pull/5457) + +#### [Packaging updates](#packaging-updates-4) + +* Update Compose to [v2.29.7](https://github.com/docker/compose/releases/tag/v2.29.7) + +### [27.3.0](#2730) + +*2024-09-19* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 27.3.0 milestone](https://github.com/docker/cli/issues?q=sort%3Aupdated-desc+is%3Aclosed+milestone%3A27.3.0) +* [moby/moby, 27.3.0 milestone](https://github.com/moby/moby/issues?q=sort%3Aupdated-desc+is%3Aclosed+milestone%3A27.3.0) + +#### [Bug fixes and enhancements](#bug-fixes-and-enhancements-4) + +* containerd image store: Fix `docker image prune -a` untagging images used by containers started from images referenced by a digested reference. [moby/moby#48488](https://github.com/moby/moby/pull/48488) +* Add a `--feature` flag to the daemon options. [moby/moby#48487](https://github.com/moby/moby/pull/48487) +* Updated the handling of the `--gpus=0` flag to be consistent with the NVIDIA Container Runtime. [moby/moby#48483](https://github.com/moby/moby/pull/48483) +* Support WSL2 mirrored-mode networking's use of interface `loopback0` for packets from the Windows host. [moby/moby#48514](https://github.com/moby/moby/pull/48514) +* Fix an issue that prevented communication between containers on an IPv4 bridge network when running with `--iptables=false`, `--ip6tables=true` (the default), a firewall with a DROP rule for forwarded packets on hosts where the `br_netfilter` kernel module was not normally loaded. [moby/moby#48511](https://github.com/moby/moby/pull/48511) +* CLI: Fix issue where `docker volume update` command would cause the CLI to panic if no argument/volume was passed. [docker/cli#5426](https://github.com/docker/cli/pull/5426) +* CLI: Properly report metrics when run in WSL environment on Windows. [docker/cli#5432](https://github.com/docker/cli/pull/5432) + +#### [Packaging updates](#packaging-updates-5) + +* Update containerd (static binaries only) to [v1.7.22](https://github.com/containerd/containerd/releases/tag/v1.7.22) + [moby/moby#48468](https://github.com/moby/moby/pull/48468) +* Updated Buildkit to [v0.16.0](https://github.com/moby/buildkit/releases/tag/v0.16.0) +* Update Compose to [v2.29.6](https://github.com/docker/compose/releases/tag/v2.29.6) +* Update Buildx to [v0.17.1](https://github.com/docker/buildx/releases/tag/v0.17.1) + +## [27.2](#272) + +Release notes for Docker Engine version 27.2 releases. + +### [27.2.1](#2721) + +*2024-09-09* + +#### [Bug fixes and enhancements](#bug-fixes-and-enhancements-5) + +* containerd image store: Fix non-container images being hidden in the `docker image ls` output. [moby/moby#48402](https://github.com/moby/moby/pull/48402) +* containerd image store: Improve `docker pull` error message when the image platform doesn't match. [moby/moby#48415](https://github.com/moby/moby/pull/48415) +* CLI: Fix issue causing `docker login` to not remove repository names from passed in registry addresses, resulting in credentials being stored under the wrong key. [docker/cli#5385](https://github.com/docker/cli/pull/5385) +* CLI: Fix issue that will sometimes cause the browser-login flow to fail if the CLI process is suspended and then resumed while waiting for the user to authenticate. [docker/cli#5376](https://github.com/docker/cli/pull/5376) +* CLI: `docker login` now returns an error instead of hanging if called non-interactively with `--password` or `--password-stdin` but without `--user`. [docker/cli#5402](https://github.com/docker/cli/pull/5402) + +#### [Packaging updates](#packaging-updates-6) + +* Update runc to v1.1.14, which contains a fix for [CVE-2024-45310](https://github.com/opencontainers/runc/security/advisories/GHSA-jfvp-7x6p-h2pv). [moby/moby#48426](https://github.com/moby/moby/pull/48426) +* Update Go runtime to 1.22.7. [moby/moby#48433](https://github.com/moby/moby/pull/48433), [docker/cli#5411](https://github.com/docker/cli/pull/5411), [docker/docker-ce-packaging#1068](https://github.com/docker/docker-ce-packaging/pull/1068) + +### [27.2.0](#2720) + +*2024-08-27* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 27.2.0 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A27.2.0) +* [moby/moby, 27.2.0 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A27.2.0) +* Deprecated and removed features, see [Deprecated Features](https://github.com/docker/cli/blob/v27.2.0/docs/deprecated.md). +* Changes to the Engine API, see [API version history](https://github.com/moby/moby/blob/v27.2.0/docs/api/version-history.md). + +#### [New](#new) + +The new features in this release are: + +* [Device code login](#device-code-login) +* [Multi-platform support for `docker image ls`](#multi-platform-support-for-docker-image-ls) + +##### [Device code login](#device-code-login) + +This release adds support for using device code login when authenticating to +Docker Hub. + +You can still use the old method of logging in with a username and password or +access token, but device code login is more secure and doesn't require you to +enter your password in the CLI. + +![device-code-login](https://i.imgur.com/GRGjSjV.gif) + +Device code login + +![device-code-login](https://i.imgur.com/GRGjSjV.gif) + +To use the old method, use `docker login -u `. + +##### [Multi-platform support for `docker image ls`](#multi-platform-support-for-docker-image-ls) + +**Experimental** + +This is experimental and may change at any time without any backward compatibility. + +With the containerd image store enabled, the `docker image ls` command (or +`docker images` shorthand) now supports a `--tree` flag that now shows +if an image is a multi-platform image. + +#### [API](#api-1) + +* `GET /images/json` response now includes `Manifests` field, which contains information about the sub-manifests included in the image index. This includes things like platform-specific manifests and build attestations. + + The new field will only be populated if the request also sets the `manifests` query parameter to `true`. + + **Experimental** + + This is experimental and may change at any time without any backward compatibility. + +#### [Bug fixes and enhancements](#bug-fixes-and-enhancements-6) + +* CLI: Fix issue with remote contexts over SSH where the CLI would allocate a pseudo-TTY when connecting to the remote host, which causes issues in rare situations. [docker/cli#5351](https://github.com/docker/cli/pull/5351) +* Fix an issue that prevented network creation with a `--ip-range` ending on a 64-bit boundary. [moby/moby#48326](https://github.com/moby/moby/pull/48326) +* CLI: IPv6 addresses shown by `docker ps` in port bindings are now bracketed. [docker/cli#5365](https://github.com/docker/cli/pull/5365) +* containerd image store: Fix early error exit from `docker load` in cases where unpacking the image would fail. [moby/moby#48376](https://github.com/moby/moby/pull/48376) +* containerd image store: Fix the previous image not being persisted as dangling after `docker pull`. [moby/moby#48380](https://github.com/moby/moby/pull/48380) + +#### [Packaging updates](#packaging-updates-7) + +* Update BuildKit to [v0.15.2](https://github.com/moby/buildkit/releases/tag/v0.15.2). [moby/moby#48341](https://github.com/moby/moby/pull/48341) +* Update Compose to [v2.29.2](https://github.com/docker/compose/releases/tag/v2.29.2). [docker/docker-ce-packaging#1050](https://github.com/docker/docker-ce-packaging/pull/1050) +* Update containerd to [v1.7.21](https://github.com/containerd/containerd/releases/tag/v1.7.21). [moby/moby#48383](https://github.com/moby/moby/pull/48383), [docker/containerd-packaging#389](https://github.com/docker/containerd-packaging/pull/389) + +### [Known Issues](#known-issues) + +* There is a known issue when authenticating against a registry in the Docker CLI (`docker login [registry address]`) where, if the provided registry address includes a repository/image name (such as `docker login index.docker.io/docker/welcome-to-docker`), the repository part (`docker/welcome-to-docker`) is not normalized and results in credentials being stored incorrectly, which causes subsequent pulls from the registry (`docker pull index.docker.io/docker/welcome-to-docker`) to not be authenticated. To prevent this, don't include any extraneous suffix in the registry address when running `docker login`. + > Note + > + > Using `docker login` with an address that includes URL path segments is not a documented use case and is considered unsupported. The recommended usage is to specify only a registry hostname, and optionally a port, as the address for `docker login`. + +## [27.1](#271) + +Release notes for Docker Engine version 27.1 releases. + +### [27.1.2](#2712) + +*2024-08-13* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 27.1.2 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A27.1.2) +* [moby/moby, 27.1.2 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A27.1.2) +* Deprecated and removed features, see [Deprecated Features](https://github.com/docker/cli/blob/v27.1.2/docs/deprecated.md). +* Changes to the Engine API, see [API version history](https://github.com/moby/moby/blob/v27.1.2/docs/api/version-history.md). + +#### [Bug fixes and enhancements](#bug-fixes-and-enhancements-7) + +* Fix a regression that could result in a `ResourceExhausted desc = grpc: received message larger than max` error when building from a large Dockerfile. [moby/moby#48245](https://github.com/moby/moby/pull/48245) +* CLI: Fix `docker attach` printing a spurious `context cancelled` error message. [docker/cli#5296](https://github.com/docker/cli/pull/5296) +* CLI: Fix `docker attach` exiting on `SIGINT` instead of forwarding the signal to the container and waiting for it to exit. [docker/cli#5302](https://github.com/docker/cli/pull/5302) +* CLI: Fix `--device-read-bps` and `--device-write-bps` options not taking effect. [docker/cli#5339](https://github.com/docker/cli/pull/5339) +* CLI: Fix a panic happening in some cases while running a plugin. [docker/cli#5337](https://github.com/docker/cli/pull/5337) + +#### [Packaging updates](#packaging-updates-8) + +* Update BuildKit to [v0.15.1](https://github.com/moby/buildkit/releases/tag/v0.15.1). [moby/moby#48246](https://github.com/moby/moby/pull/48246) +* Update Buildx to [v0.16.2](https://github.com/docker/buildx/releases/tag/v0.16.2). [docker/docker-ce-packaging#1043](https://github.com/docker/docker-ce-packaging/pull/1043) +* Update Go runtime to 1.21.13. [moby/moby#48301](https://github.com/moby/moby/pull/48301), [docker/cli#5325](https://github.com/docker/cli/pull/5325), [docker/docker-ce-packaging#1046](https://github.com/docker/docker-ce-packaging/pull/1046) +* Remove unused `docker-proxy.exe` binary from Windows packages. [docker/docker-ce-packaging#1045](https://github.com/docker/docker-ce-packaging/pull/1045) + +### [27.1.1](#2711) + +*2024-07-23* + +#### [Security](#security) + +This release contains a fix for [CVE-2024-41110](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-41110) / [GHSA-v23v-6jw2-98fq](https://github.com/moby/moby/security/advisories/GHSA-v23v-6jw2-98fq) +that impacted setups using [authorization plugins (AuthZ)](https://docs.docker.com/engine/extend/plugins_authorization/) +for access control. No other changes are included in this release, and this +release is otherwise identical for users not using AuthZ plugins. + +#### [Packaging updates](#packaging-updates-9) + +* Update Compose to [v2.29.1](https://github.com/docker/compose/releases/tag/v2.29.1). [moby/docker-ce-packaging#1041](https://github.com/docker/docker-ce-packaging/pull/1041) + +### [27.1.0](#2710) + +*2024-07-22* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 27.1.0 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A27.1.0) +* [moby/moby, 27.1.0 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A27.1.0) +* Deprecated and removed features, see [Deprecated Features](https://github.com/docker/cli/blob/v27.1.0/docs/deprecated.md). +* Changes to the Engine API, see [API version history](https://github.com/moby/moby/blob/v27.1.0/docs/api/version-history.md). + +#### [Bug fixes and enhancements](#bug-fixes-and-enhancements-8) + +* rootless: add `Requires=dbus.socket` to prevent errors when starting the daemon on a cgroup v2 host with systemd [moby/moby#48141](https://github.com/moby/moby/pull/48141) +* containerd integration: `image tag` event is now properly emitted when building images with BuildKit [moby/moby#48182](https://github.com/moby/moby/pull/48182) +* CLI: enable shell completion for `docker image rm`, `docker image history`, and `docker image inspect` [moby/moby#5261](https://github.com/moby/moby/pull/5261) +* CLI: add and improve shell completions for various flags [moby/moby#5261](https://github.com/moby/moby/pull/5261) +* CLI: add OOMScoreAdj to `docker service create` and `docker stack` [docker/cli#5274](https://github.com/docker/cli/pull/5274) +* CLI: add support for `DOCKER_CUSTOM_HEADERS` environment variable (experimental) [docker/cli#5271](https://github.com/docker/cli/pull/5271) +* CLI: containerd-integration: Fix `docker push` defaulting the `--platform` flag to a value of `DOCKER_DEFAULT_PLATFORM` environment variable on unsupported API versions [docker/cli#5248](https://github.com/docker/cli/pull/5248) +* CLI: fix: context cancellation on `login` prompt [docker/cli#5260](https://github.com/docker/cli/pull/5260) +* CLI: fix: wait for the container to exit before closing the stream when sending a termination request to the CLI while attached to a container [docker/cli#5250](https://github.com/docker/cli/pull/5250) + +#### [Deprecated](#deprecated) + +* The `pkg/rootless/specconv` package is deprecated, and will be removed in the next release [moby/moby#48185](https://github.com/moby/moby/pull/48185) +* The `pkg/containerfs` package is deprecated, and will be removed in the next release [moby/moby#48185](https://github.com/moby/moby/pull/48185) +* The `pkg/directory` package is deprecated, and will be removed in the next release [moby/moby#48185](https://github.com/moby/moby/pull/48185) +* `api/types/system`: remove deprecated `Info.ExecutionDriver` [moby/moby#48184](https://github.com/moby/moby/pull/48184) + +#### [Packaging updates](#packaging-updates-10) + +* Update Buildx to [v0.16.1](https://github.com/docker/buildx/releases/tag/v0.16.1). [moby/docker-ce-packaging#1039](https://github.com/docker/docker-ce-packaging/pull/1039) +* Update Compose to [v2.29.0](https://github.com/docker/compose/releases/tag/v2.29.0). [moby/docker-ce-packaging#1038](https://github.com/docker/docker-ce-packaging/pull/1038) +* Update Containerd (static binaries only) to [v1.7.20](https://github.com/containerd/containerd/releases/tag/v1.7.20). [moby/moby#48191](https://github.com/moby/moby/pull/48191) +* Update BuildKit to [v0.15.0](https://github.com/moby/buildkit/releases/tag/v0.15.0). [moby/moby#48175](https://github.com/moby/moby/pull/48175) +* Update Go runtime to 1.21.12, which contains security fixes for [CVE-2024-24791](https://github.com/advisories/GHSA-hw49-2p59-3mhj) [moby/moby#48120](https://github.com/moby/moby/pull/48120) + +## [27.0](#270) + +Release notes for Docker Engine 27.0. + +### [27.0.3](#2703) + +*2024-07-01* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 27.0.3 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A27.0.3) +* [moby/moby, 27.0.3 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A27.0.3) +* Deprecated and removed features, see [Deprecated Features](https://github.com/docker/cli/blob/v27.0.3/docs/deprecated.md). +* Changes to the Engine API, see [API version history](https://github.com/moby/moby/blob/v27.0.3/docs/api/version-history.md). + +#### [Bug fixes and enhancements](#bug-fixes-and-enhancements-9) + +* Fix a regression that incorrectly reported a port mapping from a host IPv6 address to an IPv4-only container as an error. [moby/moby#48090](https://github.com/moby/moby/pull/48090) +* Fix a regression that caused duplicate subnet allocations when creating networks. [moby/moby#48089](https://github.com/moby/moby/pull/48089) +* Fix a regression resulting in `fail to register layer: failed to Lchown` errors when trying to pull an image with rootless enabled on a system that supports native overlay with user-namespaces. [moby/moby#48086](https://github.com/moby/moby/pull/48086) + +### [27.0.2](#2702) + +*2024-06-27* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 27.0.2 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A27.0.2) +* [moby/moby, 27.0.2 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A27.0.2) +* Deprecated and removed features, see [Deprecated Features](https://github.com/docker/cli/blob/v27.0.2/docs/deprecated.md). +* Changes to the Engine API, see [API version history](https://github.com/moby/moby/blob/v27.0.2/docs/api/version-history.md). + +#### [Bug fixes and enhancements](#bug-fixes-and-enhancements-10) + +* Fix a regression that caused port numbers to be ignored when parsing a Docker registry URL. [docker/cli#5197](https://github.com/docker/cli/pull/5197), [docker/cli#5198](https://github.com/docker/cli/pull/5198) + +#### [Removed](#removed-1) + +* api/types: deprecate `ContainerJSONBase.Node` field and `ContainerNode` type. These definitions were used by the standalone ("classic") Swarm API, but never implemented in the Docker Engine itself. [moby/moby#48055](https://github.com/moby/moby/pull/48055) + +### [27.0.1](#2701) + +*2024-06-24* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 27.0.0 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A27.0.0) +* [moby/moby, 27.0.0 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A27.0.0) +* Deprecated and removed features, see [Deprecated Features](https://github.com/docker/cli/blob/v27.0.1/docs/deprecated.md). +* Changes to the Engine API, see [API version history](https://github.com/moby/moby/blob/v27.0.1/docs/api/version-history.md). + +#### [New](#new-1) + +* containerd image store: Add `--platform` flag to `docker image push` and improve the default behavior when not all platforms of the multi-platform image are available locally. [docker/cli#4984](https://github.com/docker/cli/pull/4984), [moby/moby#47679](https://github.com/moby/moby/pull/47679) +* Add support to `docker stack deploy` for `driver_opts` in a service's networks. [docker/cli#5125](https://github.com/docker/cli/pull/5125) +* Consider additional `/usr/local/libexec` and `/usr/libexec` paths when looking up the userland proxy binaries by a name with a `docker-` prefix. [moby/moby#47804](https://github.com/moby/moby/pull/47804) + +#### [Bug fixes and enhancements](#bug-fixes-and-enhancements-11) + +* `*client.Client` instances are now always safe for concurrent use by multiple goroutines. Previously, this could lead to data races when the `WithAPIVersionNegotiation()` option is used. [moby/moby#47961](https://github.com/moby/moby/pull/47961) +* Fix a bug causing the Docker CLI to leak Unix sockets in `$TMPDIR` in some cases. [docker/cli#5146](https://github.com/docker/cli/pull/5146) +* Don't ignore a custom seccomp profile when used in conjunction with `--privileged`. [moby/moby#47500](https://github.com/moby/moby/pull/47500) +* rootless: overlay2: support native overlay diff when using rootless-mode with Linux kernel version 5.11 and later. [moby/moby#47605](https://github.com/moby/moby/pull/47605) +* Fix the `StartInterval` default value of healthcheck to reflect the documented value of 5s. [moby/moby#47799](https://github.com/moby/moby/pull/47799) +* Fix `docker save` and `docker load` not ending on the daemon side when the operation was cancelled by the user, for example with `Ctrl+C`. [moby/moby#47629](https://github.com/moby/moby/pull/47629) +* The `StartedAt` property of containers is now recorded before container startup, guaranteeing that the `StartedAt` is always before `FinishedAt`. [moby/moby#47003](https://github.com/moby/moby/pull/47003) +* The internal DNS resolver used by Windows containers on Windows now forwards requests to external DNS servers by default. This enables `nslookup` to resolve external hostnames. This behaviour can be disabled via `daemon.json`, using `"features": { "windows-dns-proxy": false }`. The configuration option will be removed in a future release. [moby/moby#47826](https://github.com/moby/moby/pull/47826) +* Print a warning when the CLI does not have permissions to read the configuration file. [docker/cli#5077](https://github.com/docker/cli/pull/5077) +* Fix a goroutine and file-descriptor leak on container attach. [moby/moby#45052](https://github.com/moby/moby/pull/45052) +* Clear the networking state of all stopped or dead containers during daemon start-up. [moby/moby#47984](https://github.com/moby/moby/pull/47984) +* Write volume options JSON atomically to avoid "invalid JSON" errors after system crash. [moby/moby#48034](https://github.com/moby/moby/pull/48034) +* Allow multiple macvlan networks with the same parent. [moby/moby#47318](https://github.com/moby/moby/pull/47318) +* Allow BuildKit to be used on Windows daemons that advertise it. [docker/cli#5178](https://github.com/docker/cli/pull/5178) + +#### [Networking](#networking) + +* Allow sysctls to be set per-interface during container creation and network connection. [moby/moby#47686](https://github.com/moby/moby/pull/47686) + + In a future release, this will be the only way to set per-interface sysctl options. + For example, on the command line in a `docker run` command,`--network mynet --sysctl net.ipv4.conf.eth0.log_martians=1` will be rejected. + Instead, you must use `--network name=mynet,driver-opt=com.docker.network.endpoint.sysctls=net.ipv4.conf.IFNAME.log_martians=1`. + +##### [IPv6](#ipv6) + +* `ip6tables` is no longer experimental. You may remove the `experimental` configuration option and continue to use IPv6, if it is not required by any other features. +* `ip6tables` is now enabled for Linux bridge networks by default. [moby/moby#47747](https://github.com/moby/moby/pull/47747) + + This makes IPv4 and IPv6 behaviors consistent with each other, and reduces the risk that IPv6-enabled containers are inadvertently exposed to the network. + + There is no impact if you are running Docker Engine with `ip6tables` enabled (new default). + + If you are using an IPv6-enabled bridge network without `ip6tables`, this is likely a breaking change. Only published container ports (`-p` or `--publish`) are accessible from outside the Docker bridge network, and outgoing connections masquerade as the host. + + To restore the behavior of earlier releases, no `ip6tables` at all, set `"ip6tables": false` in `daemon.json`, or use the CLI option `--ip6tables=false`. Alternatively, leave `ip6tables` enabled, publish ports, and enable direct routing. + + With `ip6tables` enabled, if `ip6tables` is not functional on your host, Docker Engine will start but it will not be possible to create an IPv6-enabled network. + +##### [IPv6 network configuration improvements](#ipv6-network-configuration-improvements) + +* A Unique Local Address (ULA) base prefix is automatically added to `default-address-pools` if this parameter wasn't manually configured, or if it contains no IPv6 prefixes. [moby/moby#47853](https://github.com/moby/moby/pull/47853) + + Prior to this release, to create an IPv6-enabled network it was necessary to use the `--subnet` option to specify an IPv6 subnet, or add IPv6 ranges to `default-address-pools` in `daemon.json`. + + Starting in this release, when a bridge network is created with `--ipv6` and no IPv6 subnet is defined by those options, an IPv6 Unique Local Address (ULA) base prefix is used. + + The ULA prefix is derived from the Engine host ID such that it's unique across hosts and over time. +* IPv6 address pools of any size can now be added to `default-address-pools`. [moby/moby#47768](https://github.com/moby/moby/pull/47768) +* IPv6 can now be enabled by default on all custom bridge networks using `"default-network-opts": { "bridge": {"com.docker.network.enable_ipv6": "true"}}` in `daemon.json`, or `dockerd --default-network-opt=bridge=com.docker.network.enable_ipv6=true`on the command line. [moby/moby#47867](https://github.com/moby/moby/pull/47867) +* Direct routing for IPv6 networks, with `ip6tables` enabled. [moby/moby#47871](https://github.com/moby/moby/pull/47871) + + Added bridge driver option `com.docker.network.bridge.gateway_mode_ipv6=`. + + The default behavior, `nat`, is unchanged from previous releases running with `ip6tables` enabled. NAT and masquerading rules are set up for each published container port. + + When set to `routed`, no NAT or masquerading rules are configured for published ports. This enables direct IPv6 access to the container, if the host's network can route packets for the container's address to the host. Published ports will be opened in the container's firewall. + + When a port mapping only applies to `routed` mode, only addresses `0.0.0.0` or `::` are allowed and a host port must not be given. + + Note that published container ports, in `nat` or `routed` mode, are accessible from any remote address if routing is set up in the network, unless the Docker host's firewall has additional restrictions. For example: `docker network create --ipv6 -o com.docker.network.bridge.gateway_mode_ipv6=routed mynet`. + + The option `com.docker.network.bridge.gateway_mode_ipv4=` is also available, with the same behavior but for IPv4. +* If firewalld is running on the host, Docker creates policy `docker-forwarding` to allow forwarding from any zone to the `docker` zone. This makes it possible to configure a bridge network with a routable IPv6 address, and no NAT or masquerading. [moby/moby#47745](https://github.com/moby/moby/pull/47745) +* When a port is published with no host port specified, or a host port range is given, the same port will be allocated for IPv4 and IPv6. [moby/moby#47871](https://github.com/moby/moby/pull/47871) + + For example `-p 80` will result in the same ephemeral port being allocated for `0.0.0.0` and `::`, and `-p 8080-8083:80` will pick the same port from the range for both address families. + + Similarly, ports published to specific addresses will be allocated the same port. For example, `-p 127.0.0.1::80 -p '[::1]::80'`. + + If no port is available on all required addresses, container creation will fail. +* Environment variable `DOCKER_ALLOW_IPV6_ON_IPV4_INTERFACE`, introduced in release 26.1.1, no longer has any effect. [moby/moby#47963](https://github.com/moby/moby/pull/47963) + + If IPv6 could not be disabled on an interface because of a read-only `/proc/sys/net`, the environment variable allowed the container to start anyway. + + In this release, if IPv4 cannot be disabled for an interface, IPv6 can be explicitly enabled for the network simply by using `--ipv6` when creating it. Other workarounds are to configure the OS to disable IPv6 by default on new interfaces, mount `/proc/sys/net` read-write, or use a kernel with no IPv6 support. +* For IPv6-enabled bridge networks, do not attempt to replace the bridge's kernel-assigned link local address with `fe80::1`. [moby/moby#47787](https://github.com/moby/moby/pull/47787) + +#### [Removed](#removed-2) + +* Deprecate experimental GraphDriver plugins. [moby/moby#48050](https://github.com/moby/moby/pull/48050), [docker/cli#5172](https://github.com/docker/cli/pull/5172) +* pkg/archive: deprecate `NewTempArchive` and `TempArchive`. These types were only used in tests and will be removed in the next release. [moby/moby#48002](https://github.com/moby/moby/pull/48002) +* pkg/archive: deprecate `CanonicalTarNameForPath` [moby/moby#48001](https://github.com/moby/moby/pull/48001) +* Deprecate pkg/dmesg. This package was no longer used, and will be removed in the next release. [moby/moby#47999](https://github.com/moby/moby/pull/47999) +* Deprecate `pkg/stringid.ValidateID` and `pkg/stringid.IsShortID` [moby/moby#47995](https://github.com/moby/moby/pull/47995) +* runconfig: deprecate `SetDefaultNetModeIfBlank` and move `ContainerConfigWrapper` to `api/types/container` [moby/moby#48007](https://github.com/moby/moby/pull/48007) +* runconfig: deprecate `DefaultDaemonNetworkMode` and move to `daemon/network` [moby/moby#48008](https://github.com/moby/moby/pull/48008) +* runconfig: deprecate `opts.ConvertKVStringsToMap`. This utility is no longer used, and will be removed in the next release. [moby/moby#48016](https://github.com/moby/moby/pull/48016) +* runconfig: deprecate `IsPreDefinedNetwork`. [moby/moby#48011](https://github.com/moby/moby/pull/48011) + +#### [API](#api-2) + +* containerd image store: `POST /images/{name}/push` now supports a `platform` parameter (JSON encoded OCI Platform type) that allows selecting a specific platform-manifest from the multi-platform image. This is experimental and may change in future API versions. [moby/moby#47679](https://github.com/moby/moby/pull/47679) +* `POST /services/create` and `POST /services/{id}/update` now support `OomScoreAdj`. [moby/moby#47950](https://github.com/moby/moby/pull/47950) +* `ContainerList` api returns container annotations. [moby/moby#47866](https://github.com/moby/moby/pull/47866) +* `POST /containers/create` and `POST /services/create` now take `Options` as part of `HostConfig.Mounts.TmpfsOptions` allowing to set options for tmpfs mounts. [moby/moby#46809](https://github.com/moby/moby/pull/46809) +* The `Healthcheck.StartInterval` property is now correctly ignored when updating a Swarm service using API versions less than v1.44. [moby/moby#47991](https://github.com/moby/moby/pull/47991) +* `GET /events` now supports image `create` event that is emitted when a new image is built regardless if it was tagged or not. [moby/moby#47929](https://github.com/moby/moby/pull/47929) +* `GET /info` now includes a `Containerd` field containing information about the location of the containerd API socket and containerd namespaces used by the daemon to run containers and plugins. [moby/moby#47239](https://github.com/moby/moby/pull/47239) +* Deprecate non-standard (config) fields in image inspect output. The `Config` field returned by this endpoint (used for `docker image inspect`) returned additional fields that are not part of the image's configuration and not part of the [Docker Image Spec](https://github.com/moby/docker-image-spec/blob/v1.3.1/specs-go/v1/image.go#L19-L32) and the [OCI Image Spec](https://github.com/opencontainers/image-spec/blob/v1.1.0/specs-go/v1/config.go#L24-L62). These fields are never set (and always return the default value for the type), but are not omitted in the response when left empty. As these fields were not intended to be part of the image configuration response, they are deprecated, and will be removed in the future API versions. +* Deprecate the daemon flag `--api-cors-header` and the corresponding `daemon.json` configuration option. These will be removed in the next major release. [moby/moby#45313](https://github.com/moby/moby/pull/45313) + +The following deprecated fields are currently included in the API response, but are not part of the underlying image's `Config`: [moby/moby#47941](https://github.com/moby/moby/pull/47941) + +* `Hostname` +* `Domainname` +* `AttachStdin` +* `AttachStdout` +* `AttachStderr` +* `Tty` +* `OpenStdin` +* `StdinOnce` +* `Image` +* `NetworkDisabled` (already omitted unless set) +* `MacAddress` (already omitted unless set) +* `StopTimeout` (already omitted unless set) + +#### [Go SDK changes](#go-sdk-changes) + +* Client API callback for the following functions now require a context parameter. [moby/moby#47536](https://github.com/moby/moby/pull/47536) + + `client.RequestPrivilegeFunc` + + `client.ImageSearchOptions.AcceptPermissionsFunc` + + `image.ImportOptions.PrivilegeFunc` +* Remove deprecated aliases for Image types. [moby/moby#47900](https://github.com/moby/moby/pull/47900) + + `ImageImportOptions` + + `ImageCreateOptions` + + `ImagePullOptions` + + `ImagePushOptions` + + `ImageListOptions` + + `ImageRemoveOptions` +* Introduce `Ulimit` type alias for `github.com/docker/go-units.Ulimit`. + The `Ulimit` type as used in the API is defined in a Go module that will transition to a new location in future. + A type alias is added to reduce the friction that comes with moving the type to a new location. + The alias makes sure that existing code continues to work, but its definition may change in future. + Users are recommended to use this alias instead of the `units.Ulimit` directly. [moby/moby#48023](https://github.com/moby/moby/pull/48023) + +Move and rename types, changing their import paths and exported names. +[moby/moby#47936](https://github.com/moby/moby/pull/47936), +[moby/moby#47873](https://github.com/moby/moby/pull/47873), +[moby/moby#47887](https://github.com/moby/moby/pull/47887), +[moby/moby#47882](https://github.com/moby/moby/pull/47882), +[moby/moby#47921](https://github.com/moby/moby/pull/47921), +[moby/moby#48040](https://github.com/moby/moby/pull/48040) + +* Move the following types to `api/types/container`: + + `BlkioStatEntry` + + `BlkioStats` + + `CPUStats` + + `CPUUsage` + + `ContainerExecInspect` + + `ContainerPathStat` + + `ContainerStats` + + `ContainersPruneReport` + + `CopyToContainerOptions` + + `ExecConfig` + + `ExecStartCheck` + + `MemoryStats` + + `NetworkStats` + + `PidsStats` + + `StatsJSON` + + `Stats` + + `StorageStats` + + `ThrottlingData` +* Move the following types to `api/types/image`: + + `ImagesPruneReport` + + `ImageImportSource` + + `ImageLoadResponse` +* Move the `ExecStartOptions` type to `api/types/backend`. +* Move the `VolumesPruneReport` type to `api/types/volume`. +* Move the `EventsOptions` type to `api/types/events`. +* Move the `ImageSearchOptions` type to `api/types/registry`. +* Drop `Network` prefix and move the following types to `api/types/network`: + + `NetworkCreateResponse` + + `NetworkConnect` + + `NetworkDisconnect` + + `NetworkInspectOptions` + + `EndpointResource` + + `NetworkListOptions` + + `NetworkCreateOptions` + + `NetworkCreateRequest` + + `NetworksPruneReport` +* Move `NetworkResource` to `api/types/network`. + +#### [Packaging updates](#packaging-updates-11) + +* Update Buildx to [v0.15.1](https://github.com/docker/buildx/releases/tag/v0.15.1). [docker/docker-ce-packaging#1029](https://github.com/docker/docker-ce-packaging/pull/1029) +* Update BuildKit to [v0.14.1](https://github.com/moby/buildkit/releases/tag/v0.14.1). [moby/moby#48028](https://github.com/moby/moby/pull/48028) +* Update runc to [v1.1.13](https://github.com/opencontainers/runc/releases/tag/v1.1.13) [moby/moby#47976](https://github.com/moby/moby/pull/47976) +* Update Compose to [v2.28.1](https://github.com/docker/compose/releases/tag/v2.28.1). [moby/docker-ce-packaging#1032](https://github.com/docker/docker-ce-packaging/pull/1032) + +### [27.0.0](#2700) + +There's no 27.0.0 release due to a mistake during the pre-release of 27.0.0-rc.1 on GitHub which resulted in the v27.0.0 tag being created. +Unfortunately the tag was already picked up by the [Go Module Mirror](https://sum.golang.org) so it's not possible to cleanly change the v27.0.0. +To workaround this, the 27.0.1 will be the first release of the 27.0. + +[Edit this page](https://github.com/docker/docs/edit/main/content/manuals/engine/release-notes/27.md) + +[Request changes](https://github.com/docker/docs/issues/new?template=doc_issue.yml&location=https%3a%2f%2fdocs.docker.com%2fengine%2frelease-notes%2f27%2f&labels=status%2Ftriage) + +Table of contents + +* [27.5](#275) + +* [27.4](#274) + +* [27.3](#273) + +* [27.2](#272) + +* [27.1](#271) + +* [27.0](#270) + +[Release notes](https://docs.docker.com/tags/release-notes/) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_28.0.0.md b/corpus/changelog/docker_engine_releases/docker_engine_28.0.0.md new file mode 100644 index 0000000000000000000000000000000000000000..b0d9c51efd052c42f1a53029d7d0bcaa731e8ddd --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_28.0.0.md @@ -0,0 +1,253 @@ +# Docker Engine 28.0.0 release notes + +Source: https://docs.docker.com/engine/release-notes/28/ + +## [28.0.0](#2800) + +*2025-02-19* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 28.0.0 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A28.0.0) +* [moby/moby, 28.0.0 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A28.0.0) +* Deprecated and removed features, see [Deprecated Features](https://github.com/docker/cli/blob/v28.0.0/docs/deprecated.md). +* Changes to the Engine API, see [API version history](https://github.com/moby/moby/blob/v28.0.0/docs/api/version-history.md). + +### [New](#new-4) + +* Add ability to mount an image inside a container via `--mount type=image`. [moby/moby#48798](https://github.com/moby/moby/pull/48798) + + You can also specify `--mount type=image,image-subpath=[subpath],...` option to mount a specific path from the image. [docker/cli#5755](https://github.com/docker/cli/pull/5755) +* `docker images --tree` now shows metadata badges [docker/cli#5744](https://github.com/docker/cli/pull/5744) +* `docker load`, `docker save`, and `docker history` now support a `--platform` flag allowing you to choose a specific platform for single-platform operations on multi-platform images. [docker/cli#5331](https://github.com/docker/cli/pull/5331) +* Add `OOMScoreAdj` to `docker service create` and `docker stack`. [docker/cli#5145](https://github.com/docker/cli/pull/5145) +* `docker buildx prune` now supports `reserved-space`, `max-used-space`, `min-free-space` and `keep-bytes` filters. [moby/moby#48720](https://github.com/moby/moby/pull/48720) +* Windows: Add support for running containerd as a child process of the daemon, instead of using a system-installed containerd. [moby/moby#47955](https://github.com/moby/moby/pull/47955) + +### [Networking](#networking-9) + +* The `docker-proxy` binary has been updated, older versions will not work with the updated `dockerd`. [moby/moby#48132](https://github.com/moby/moby/pull/48132) + + Close a window in which the userland proxy (`docker-proxy`) could accept TCP connections, that would then fail after `iptables` NAT rules were set up. + + The executable `rootlesskit-docker-proxy` is no longer used, it has been removed from the build and distribution. +* DNS nameservers read from the host's `/etc/resolv.conf` are now always accessed from the host's network namespace. [moby/moby#48290](https://github.com/moby/moby/pull/48290) + + When the host's `/etc/resolv.conf` contains no nameservers and there are no `--dns` overrides, Google's DNS servers are no longer used, apart from by the default bridge network and in build containers. +* Container interfaces in bridge and macvlan networks now use randomly generated MAC addresses. [moby/moby#48808](https://github.com/moby/moby/pull/48808) + + Gratuitous ARP / Neighbour Advertisement messages will be sent when the interfaces are started so that, when IP addresses are reused, they're associated with the newly generated MAC address. + + IPv6 addresses in the default bridge network are now IPAM-assigned, rather than being derived from the MAC address. +* The deprecated OCI `prestart` hook is now only used by build containers. For other containers, network interfaces are added to the network namespace after task creation is complete, before the container task is started. [moby/moby#47406](https://github.com/moby/moby/pull/47406) +* Add a new `gw-priority` option to `docker run`, `docker container create`, and `docker network connect`. This option will be used by the Engine to determine which network provides the default gateway for a container. On `docker run`, this option is only available through the extended `--network` syntax. [docker/cli#5664](https://github.com/docker/cli/pull/5664) +* Add a new netlabel `com.docker.network.endpoint.ifname` to customize the interface name used when connecting a container to a network. It's supported by all built-in network drivers on Linux. [moby/moby#49155](https://github.com/moby/moby/pull/49155) + + When a container is created with multiple networks specified, there's no guarantee on the order networks will be connected to the container. So, if a custom interface name uses the same prefix as the auto-generated names, for example `eth`, the container might fail to start. + + The recommended practice is to use a different prefix, for example `en0`, or a numerical suffix high enough to never collide, for example `eth100`. + + This label can be specified on `docker network connect` via the `--driver-opt` flag, for example `docker network connect --driver-opt=com.docker.network.endpoint.ifname=foobar …`. + + Or via the long-form `--network` flag on `docker run`, for example `docker run --network=name=bridge,driver-opt=com.docker.network.endpoint.ifname=foobar …` +* If a custom network driver reports capability `GwAllocChecker` then, before a network is created, it will get a `GwAllocCheckerRequest` with the network's options. The custom driver may then reply that no gateway IP address should be allocated. [moby/moby#49372](https://github.com/moby/moby/pull/49372) + +#### [Port publishing in bridge networks](#port-publishing-in-bridge-networks) + +* `dockerd` now requires `ipset` support in the Linux kernel. [moby/moby#48596](https://github.com/moby/moby/pull/48596) + + The `iptables` and `ip6tables` rules used to implement port publishing and network isolation have been extensively modified. This enables some of the following functional changes, and is a first step in refactoring to enable native `nftables` support in a future release. [moby/moby#48815](https://github.com/moby/moby/issues/48815) + + If it becomes necessary to downgrade to an earlier version of the daemon, some manual cleanup of the new rules will be necessary. The simplest and surest approach is to reboot the host, or use `iptables -F` and `ip6tables -F` to flush all existing `iptables` rules from the `filter` table before starting the older version of the daemon. When that is not possible, run the following commands as root: + - `iptables -D FORWARD -m set --match-set docker-ext-bridges-v4 dst -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT; ip6tables -D FORWARD -m set --match-set docker-ext-bridges-v6 dst -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT` + - `iptables -D FORWARD -m set --match-set docker-ext-bridges-v4 dst -j DOCKER; ip6tables -D FORWARD -m set --match-set docker-ext-bridges-v6 dst -j DOCKER` + - If you were previously running with the iptables filter-FORWARD policy set to `ACCEPT` and need to restore access to unpublished ports, also delete per-bridge-network rules from the `DOCKER` chains. For example, `iptables -D DOCKER ! -i docker0 -o docker0 -j DROP`. +* Fix a security issue that was allowing remote hosts to connect directly to a container on its published ports. [moby/moby#49325](https://github.com/moby/moby/pull/49325) +* Fix a security issue that was allowing neighbor hosts to connect to ports mapped on a loopback address. [moby/moby#49325](https://github.com/moby/moby/pull/49325) +* Fix an issue that prevented port publishing to link-local addresses. [moby/moby#48570](https://github.com/moby/moby/pull/48570) +* UDP ports published by a container are now reliably accessible by containers on other networks, via the host's public IP address. [moby/moby#48571](https://github.com/moby/moby/pull/48571) +* Docker will now only set the `ip6tables` policy for the `FORWARD` chain in the `filter` table to `DROP` if it enables IP forwarding on the host itself (sysctls `net.ipv6.conf.all.forwarding` and `net.ipv6.conf.default.forwarding`). This is now aligned with existing IPv4 behaviour. [moby/moby#48594](https://github.com/moby/moby/pull/48594) + + If IPv6 forwarding is enabled on your host, but you were depending on Docker to set the ip6tables filter-FORWARD policy to `DROP`, you may need to update your host's configuration to make sure it is secure. +* Direct routed access to container ports that are not exposed using `p`/`-publish` is now blocked in the `DOCKER` iptables chain. [moby/moby#48724](https://github.com/moby/moby/pull/48724) + + If the default iptables filter-FORWARD policy was previously left at `ACCEPT` on your host, and direct routed access to a container's unpublished ports from a remote host is still required, options are: + - Publish the ports you need. + - Use the new `gateway_mode_ipv[46]=nat-unprotected`, described below. + + Container ports published to host addresses will continue to be accessible via those host addresses, using NAT or the userland proxy. + + Unpublished container ports continue to be directly accessible from the Docker host via the container's IP address. +* Networks created with `gateway_mode_ipv[46]=routed` are now accessible from other bridge networks running on the same Docker host, as well as from outside the host. [moby/moby#48596](https://github.com/moby/moby/pull/48596) +* Bridge driver options `com.docker.network.bridge.gateway_mode_ipv4` and `com.docker.network.bridge.gateway_mode_ipv6` now accept mode `nat-unprotected`. [moby/moby#48597](https://github.com/moby/moby/pull/48597) + + `nat-unprotected` is similar to the default `nat` mode, but no per port/protocol rules are set up. This means any port on a container can be accessed by direct-routing from a remote host. +* Bridge driver options `com.docker.network.bridge.gateway_mode_ipv4` and `com.docker.network.bridge.gateway_mode_ipv6` now accept mode `isolated`, when the network is also `internal`. [moby/moby#49262](https://github.com/moby/moby/pull/49262) + + An address is normally assigned to the bridge device in an `internal` network. So, processes on the Docker host can access the network, and containers in the network can access host services listening on that bridge address (including services listening on "any" host address, `0.0.0.0` or `::`). + + An `internal` bridge network created with gateway mode `isolated` does not have an address on the Docker host. +* When a port mapping includes a host IP address or port number that cannot be used because NAT from the host is disabled using `--gateway_mode_ipv[46]`, container creation will no longer fail. The unused fields may be needed if the gateway endpoint changes when networks are connected or disconnected. A message about the unused fields will be logged. [moby/moby#48575](https://github.com/moby/moby/pull/48575) +* Do not create iptables nat-POSTROUTING masquerade rules for a container's own published ports, when the userland proxy is enabled. [moby/moby#48854](https://github.com/moby/moby/pull/48854) + +#### [IPv6](#ipv6) + +* Add `docker network create` option `--ipv4`. To disable IPv4 address assignment for a network, use `docker network create --ipv4=false [...]`. [docker/cli#5599](https://github.com/docker/cli/pull/5599) +* Daemon option `--ipv6` (`"ipv6": true` in `daemon.json`) can now be used without `fixed-cidr-v6`. [moby/moby#48319](https://github.com/moby/moby/pull/48319) +* IPAM now handles subnets bigger than "/64". [moby/moby#49223](https://github.com/moby/moby/pull/49223) +* Duplicate address detection (DAD) is now disabled for addresses assigned to the bridges belonging to bridge networks. [moby/moby#48609](https://github.com/moby/moby/pull/48609) +* Modifications to `host-gateway`, for compatibility with IPv6-only networks. [moby/moby#48807](https://github.com/moby/moby/pull/48807) + + When special value `host-gateway` is used in an `--add-host` option in place of an address, it's replaced by an address on the Docker host to make it possible to refer to the host by name. The address used belongs to the default bridge (normally `docker0`). Until now it's always been an IPv4 address, because all containers on bridge networks had IPv4 addresses. + + Now, if IPv6 is enabled on the default bridge network, `/etc/hosts` entries will be created for IPv4 and IPv6 addresses. So, a container that's only connected to IPv6-only networks can access the host by name. + + The `--host-gateway-ip` option overrides the address used to replace `host-gateway`. Two of these options are now allowed on the command line, for one IPv4 gateway and one IPv6. + + In the `daemon.json` file, to provide two addresses, use `"host-gateway-ips"`. For example, `"host-gateway-ips": ["192.0.2.1", "2001:db8::1111"]`. + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-14) + +* Add IPv6 loopback address as an insecure registry by default. [moby/moby#48540](https://github.com/moby/moby/pull/48540) +* Add support for Cobra-generated completion scripts for `dockerd`. [moby/moby#49339](https://github.com/moby/moby/pull/49339) +* Fix DNS queries failing when containers are launched via `systemd` auto-start on boot [moby/moby#48812](https://github.com/moby/moby/pull/48812) +* Fix Docker Swarm mode ignoring `volume.subpath` [docker/cli#5833](https://github.com/docker/cli/pull/5833) +* Fix `docker export` continuing the export after the operation is canceled. [moby/moby#49265](https://github.com/moby/moby/pull/49265) +* Fix `docker export` not releasing the container's writable layer after a failure. [moby/moby#48517](https://github.com/moby/moby/pull/48517) +* Fix `docker images --tree` unnecessary truncating long image names when multiple names are available [docker/cli#5757](https://github.com/docker/cli/pull/5757) +* Fix a bug where a container with a name matching another container's ID is not restored on daemon startup. [moby/moby#48669](https://github.com/moby/moby/pull/48669) +* Fix an issue preventing some IPv6 addresses shown by `docker ps` to be properly bracketed [docker/cli#5468](https://github.com/docker/cli/pull/5468) +* Fix bug preventing image pulls from being cancelled during `docker run`. [docker/cli#5645](https://github.com/docker/cli/pull/5645) +* Fix error-handling when running the daemon as a Windows service to prevent unclean exits. [moby/moby#48518](https://github.com/moby/moby/pull/48518) +* Fix issue causing output of `docker run` to be inconsistent when using `--attach stdout` or `--attach stderr` versus `stdin`. `docker run --attach stdin` now exits if the container exits. [docker/cli#5662](https://github.com/docker/cli/pull/5662) +* Fix rootless Docker setup with `subid` backed by NSS modules. [moby/moby#49036](https://github.com/moby/moby/pull/49036) +* Generated completion scripts from the CLI now show descriptions next to each command/flag suggestion. [docker/cli#5756](https://github.com/docker/cli/pull/5756) +* IPv6 addresses shown by `docker ps` in port bindings are now bracketed [docker/cli#5363](https://github.com/docker/cli/pull/5363) +* Implement the ports validation method for Compose [docker/cli#5524](https://github.com/docker/cli/pull/5524) +* Improve error-output for invalid flags on the command line. [docker/cli#5233](https://github.com/docker/cli/pull/5233) +* Improve errors when failing to start a container using anther container's network namespace. [moby/moby#49367](https://github.com/moby/moby/pull/49367) +* Improve handling of invalid API errors that could result in an empty error message being shown. [moby/moby#49373](https://github.com/moby/moby/pull/49373) +* Improve output and consistency for unknown (sub)commands and invalid arguments [docker/cli#5234](https://github.com/docker/cli/pull/5234) +* Improve validation of `exec-opts` in daemon configuration. [moby/moby#48979](https://github.com/moby/moby/pull/48979) +* Update the handling of the `--gpus=0` flag to be consistent with the NVIDIA Container Runtime. [moby/moby#48482](https://github.com/moby/moby/pull/48482) +* `client.ContainerCreate` now normalizes `CapAdd` and `CapDrop` fields in `HostConfig` to their canonical form. [moby/moby#48551](https://github.com/moby/moby/pull/48551) +* `docker image save` now produces stable timestamps. [moby/moby#48611](https://github.com/moby/moby/pull/48611) +* `docker inspect` now lets you inspect Swarm configs [docker/cli#5573](https://github.com/docker/cli/pull/5573) +* containerd image store: Add support for `Extracting` layer status in `docker pull`. [moby/moby#49064](https://github.com/moby/moby/pull/49064) +* containerd image store: Fix `commit`, `import`, and `build` not preserving a replaced image as a dangling image. [moby/moby#48316](https://github.com/moby/moby/pull/48316) +* containerd image store: Make `docker load --platform` return an error when the requested platform isn't loaded. [moby/moby#48718](https://github.com/moby/moby/pull/48718) +* Fix validation of `--link` option. [docker/cli#5739](https://github.com/docker/cli/pull/5739) +* Add validation of network-diagnostic-port daemon configuration option. [moby/moby#49305](https://github.com/moby/moby/pull/49305) +* Unless explicitly configured, an IP address is no longer reserved for a gateway in cases where it is not required. Namely, “internal” bridge networks with option `com.docker.network.bridge.inhibit_ipv4`, `ipvlan` or `macvlan` networks with no parent interface, and L3 IPvlan modes. [moby/moby#49261](https://github.com/moby/moby/pull/49261) +* If a custom network driver reports capability `GwAllocChecker` then, before a network is created, it will get a `GwAllocCheckerRequest` with the network's options. The custom driver may then reply that no gateway IP address should be allocated. [moby/moby#49372](https://github.com/moby/moby/pull/49372) +* Fixed an issue that meant a container could not be attached to an L3 IPvlan at the same time as other network types. [moby/moby#49130](https://github.com/moby/moby/pull/49130) +* Remove the correct `/etc/hosts` entries when disconnecting a container from a network. [moby/moby#48857](https://github.com/moby/moby/pull/48857) +* Fix duplicate network disconnect events. [moby/moby#48800](https://github.com/moby/moby/pull/48800) +* Resolve issues related to changing `fixed-cidr` for `docker0`, and inferring configuration from a user-managed default bridge (`--bridge`). [moby/moby#48319](https://github.com/moby/moby/pull/48319) +* Remove feature flag `windows-dns-proxy`, introduced in release 26.1.0 to control forwarding to external DNS resolvers from Windows containers, to make `nslookup` work. It was enabled by default in release 27.0.0. [moby/moby#48738](https://github.com/moby/moby/pull/48738) +* Remove an `iptables` mangle rule for checksumming SCTP. The rule can be re-enabled by setting `DOCKER_IPTABLES_SCTP_CHECKSUM=1` in the daemon's environment. This override will be removed in a future release. [moby/moby#48149](https://github.com/moby/moby/pull/48149) +* Faster connection to bridge networks, in most cases. [moby/moby#49302](https://github.com/moby/moby/pull/49302) + +### [Packaging updates](#packaging-updates-14) + +* Update Go runtime to [1.23.6](https://go.dev/doc/devel/release#go1.23.6). [docker/cli#5795](https://github.com/docker/cli/pull/5795), [moby/moby#49393](https://github.com/moby/moby/pull/49393), [docker/docker-ce-packaging#1161](https://github.com/docker/docker-ce-packaging/pull/1161) +* Update `runc` to [v1.2.5](https://github.com/opencontainers/runc/releases/tag/v1.2.5) (static binaries only). [moby/moby#49464](https://github.com/moby/moby/pull/49464) +* Update containerd to [v1.7.25](https://github.com/containerd/containerd/releases/tag/v1.7.25). [moby/moby#49252](https://github.com/moby/moby/pull/49252) +* Update BuildKit to [v0.20.0](https://github.com/moby/buildkit/releases/tag/v0.20.0). [moby/moby#49495](https://github.com/moby/moby/pull/49495) +* Update Buildx to [v0.21.0](https://github.com/docker/buildx/releases/tag/v0.21.0). [docker/docker-ce-packaging#1166](https://github.com/docker/docker-ce-packaging/pull/1166) +* Update Compose to [v2.32.4](https://github.com/docker/compose/releases/tag/v2.32.3). [docker/docker-ce-packaging#1143](https://github.com/docker/docker-ce-packaging/pull/1143) +* The canonical source for the `dockerd(8)` man page has been moved back to the `moby/moby` repository itself. [moby/moby#48298](https://github.com/moby/moby/pull/48298) + +### [Go SDK](#go-sdk-5) + +* Improve validation of empty object IDs. The client now returns an "Invalid Parameter" error when trying to use an empty ID or name. This changes the error returned by some "Inspect" functions from a "Not found" error to an "Invalid Parameter". [moby/moby#49381](https://github.com/moby/moby/pull/49381) +* `Client.ImageBuild()` now omits default values from the API request's query string. [moby/moby#48651](https://github.com/moby/moby/pull/48651) +* `api/types/container`: Merge `Stats` and `StatsResponse` [moby/moby#49287](https://github.com/moby/moby/pull/49287) +* `client.WithVersion`: Strip v-prefix when setting API version [moby/moby#49352](https://github.com/moby/moby/pull/49352) +* `client`: Add `WithTraceOptions` allowing to specify custom OTe1 trace options. [moby/moby#49415](https://github.com/moby/moby/pull/49415) +* `client`: Add `HijackDialer` interface. [moby/moby#49388](https://github.com/moby/moby/pull/49388) +* `client`: Add `SwarmManagementAPIClient` interface to describe all API client methods related to Swarm-specific objects. [moby/moby#49388](https://github.com/moby/moby/pull/49388) +* `client`: Add `WithTraceOptions` allowing to specify custom OTel trace options. [moby/moby#49415](https://github.com/moby/moby/pull/49415) +* `client`: `ImageHistory`, `ImageLoad` and `ImageSave` now use variadic functional options [moby/moby#49466](https://github.com/moby/moby/pull/49466) +* `pkg/containerfs`: Move to internal [moby/moby#48097](https://github.com/moby/moby/pull/48097) +* `pkg/reexec`: Can now be used on platforms other than Linux, Windows, macOS and FreeBSD [moby/moby#49118](https://github.com/moby/moby/pull/49118) +* `api/types/container`: introduce `CommitResponse` type. This is currently an alias for `IDResponse`, but may become a distinct type in a future release. [moby/moby#49444](https://github.com/moby/moby/pull/49444) +* `api/types/container`: introduce `ExecCreateResponse` type. This is currently an alias for `IDResponse`, but may become a distinct type in a future release. [moby/moby#49444](https://github.com/moby/moby/pull/49444) + +### [API](#api-6) + +* Update API version to [v1.48](https://docs.docker.com/engine/api/v1.48/) [moby/moby#48476](https://github.com/moby/moby/pull/48476) +* `GET /images/{name}/json` response now returns the `Manifests` field containing information about the sub-manifests contained in the image index. This includes things like platform-specific manifests and build attestations. [moby/moby#48264](https://github.com/moby/moby/pull/48264) +* `POST /containers/create` now supports `Mount` of type `image` for mounting an image inside a container. [moby/moby#48798](https://github.com/moby/moby/pull/48798) +* `GET /images/{name}/history` now supports a `platform` parameter (JSON encoded OCI Platform type) that lets you specify a platform to show the history of. [moby/moby#48295](https://github.com/moby/moby/pull/48295) +* `POST /images/{name}/load` and `GET /images/{name}/get` now supports a `platform` parameter (JSON encoded OCI Platform type) that lets you specify a platform to load/save. Not passing this parameter results in loading/saving the full multi-platform image. [moby/moby#48295](https://github.com/moby/moby/pull/48295) +* Improve errors for invalid width/height on container resize and exec resize [moby/moby#48679](https://github.com/moby/moby/pull/48679) +* The `POST /containers/create` endpoint now includes a warning in the response when setting the container-wide `VolumeDriver` option in combination with volumes defined through `Mounts` because the `VolumeDriver` option has no effect on those volumes. This warning was previously generated by the CLI. [moby/moby#48789](https://github.com/moby/moby/pull/48789) +* containerd image store: `GET /images/json` and `GET /images/{name}/json` responses now includes `Descriptor` field, which contains an OCI descriptor of the image target. The new field is only populated if the daemon provides a multi-platform image store. [moby/moby#48894](https://github.com/moby/moby/pull/48894) +* containerd image store: `GET /containers/{name}/json` now returns an `ImageManifestDescriptor` field containing the OCI descriptor of the platform-specific image manifest of the image that was used to create the container. [moby/moby#48855](https://github.com/moby/moby/pull/48855) +* Add debug endpoints (`GET /debug/vars`, `GET /debug/pprof/`, `GET /debug/pprof/cmdline`, `GET /debug/pprof/profile`, `GET /debug/pprof/symbol`, `GET /debug/pprof/trace`, `GET /debug/pprof/{name}`) are now also accessible through the versioned-API paths (`/v/`). [moby/moby#49051](https://github.com/moby/moby/pull/49051) +* Fix API returning a `500` status code instead of `400` for validation errors. [moby/moby#49217](https://github.com/moby/moby/pull/49217) +* Fix status codes for archive endpoints `HEAD /containers/{name:.*}/archive`, `GET /containers/{name:.*}/archive`, `PUT /containers/{name:.*}/archive` returning a `500` status instead of a `400` status. [moby/moby#49219](https://github.com/moby/moby/pull/49219) +* `POST /containers/create` now accepts a `writable-cgroups=true` option in `HostConfig.SecurityOpt` to mount the container's cgroups writable. This provides a more granular approach than `HostConfig.Privileged`. [moby/moby#48828](https://github.com/moby/moby/pull/48828) +* `POST /build/prune` renames `keep-bytes` to `reserved-space` and now supports additional prune parameters `max-used-space` and `min-free-space`. [moby/moby#48720](https://github.com/moby/moby/pull/48720) +* `POST /networks/create` now has an `EnableIPv4` field. Setting it to `false` disables IPv4 IPAM for the network. [moby/moby#48271](https://github.com/moby/moby/pull/48271) + + `GET /networks/{id}` now returns an `EnableIPv4` field showing whether the network has IPv4 IPAM enabled. [moby/moby#48271](https://github.com/moby/moby/pull/48271) + + User-defined bridge networks require either IPv4 or IPv6 address assignment to be enabled. IPv4 cannot be disabled for the default bridge network (`docker0`). [moby/moby#48323](https://github.com/moby/moby/pull/48323) + + `macvlan` and `ipvlan` networks can be created with address assignment disabled for IPv4, IPv6, or both address families. [moby/moby#48299](https://github.com/moby/moby/pull/48299) + + IPv4 cannot be disabled for Windows or Swarm networks. [moby/moby#48278](https://github.com/moby/moby/pull/48278) +* Add a way to specify which network should provide the default gateway for a container. [moby/moby#48936](https://github.com/moby/moby/pull/48936) + + `POST /networks/{id}/connect` and `POST /containers/create` now accept a `GwPriority` field in `EndpointsConfig`. This value is used to determine which network endpoint provides the default gateway for the container. The endpoint with the highest priority is selected. If multiple endpoints have the same priority, endpoints are sorted lexicographically by their network name, and the one that sorts first is picked. [moby/moby#48746](https://github.com/moby/moby/pull/48746) + + `GET /containers/json` now returns a `GwPriority` field in `NetworkSettings` for each network endpoint. The `GwPriority` field is used by the CLI’s new `gw-priority` option for `docker run` and `docker network connect`. [moby/moby#48746](https://github.com/moby/moby/pull/48746) +* Settings for `eth0` in `--sysctl` options are no longer automatically migrated to the network endpoint. [moby/moby#48746](https://github.com/moby/moby/pull/48746) + + For example, in the Docker CLI, `docker run --network mynet --sysctl net.ipv4.conf.eth0.log_martians=1 ...` is rejected. Instead, you must use `docker run --network name=mynet,driver-opt=com.docker.network.endpoint.sysctls=net.ipv4.conf.IFNAME.log_martians=1 ...` +* `GET /containers/json` now returns an `ImageManifestDescriptor` field matching the same field in `/containers/{name}/json`. This field is only populated if the daemon provides a multi-platform image store. [moby/moby#49407](https://github.com/moby/moby/pull/49407) + +### [Removed](#removed) + +* The Fluent logger option `fluentd-async-connect` has been deprecated in v20.10 and is now removed. [moby/moby#46114](https://github.com/moby/moby/pull/46114) +* The `--time` option on `docker stop` and `docker restart` is deprecated and renamed to `--timeout`. [docker/cli#5485](https://github.com/docker/cli/pull/5485) +* Go-SDK: `pkg/ioutils`: Remove `NewReaderErrWrapper` as it was never used. [moby/moby#49258](https://github.com/moby/moby/pull/49258) +* Go-SDK: `pkg/ioutils`: Remove deprecated `BytesPipe`, `NewBytesPipe`, `ErrClosed`, `WriteCounter`, `NewWriteCounter`, `NewReaderErrWrapper`, `NopFlusher`. [moby/moby#49245](https://github.com/moby/moby/pull/49245) +* Go-SDK: `pkg/ioutils`: Remove deprecated `NopWriter` and `NopWriteCloser`. [moby/moby#49256](https://github.com/moby/moby/pull/49256) +* Go-SDK: `pkg/sysinfo`: Remove deprecated NumCPU. [moby/moby#49242](https://github.com/moby/moby/pull/49242) +* Go-SDK: Remove `pkg/broadcaster`, as it was only used internally [moby/moby#49172](https://github.com/moby/moby/pull/49172) +* Go-SDK: Remove deprecated `cli.Errors` type [docker/cli#5549](https://github.com/docker/cli/pull/5549) +* Remove `pkg/ioutils.ReadCloserWrapper`, as it was only used in tests. [moby/moby#49237](https://github.com/moby/moby/pull/49237) +* Remove deprecated `api-cors-header` config parameter and the `dockerd` `--api-cors-header` option [moby/moby#48209](https://github.com/moby/moby/pull/48209) +* Remove deprecated `APIEndpoint.Version` field, `APIVersion` type, and `APIVersion1` and `APIVersion2` consts. [moby/moby#49004](https://github.com/moby/moby/pull/49004) +* Remove deprecated `api-cors-header` config parameter and the Docker daemon's `--api-cors-header` option. [docker/cli#5437](https://github.com/docker/cli/pull/5437) +* Remove deprecated `pkg/directory` package [moby/moby#48779](https://github.com/moby/moby/pull/48779) +* Remove deprecated `pkg/dmsg.Dmesg()` [moby/moby#48109](https://github.com/moby/moby/pull/48109) +* Remove deprecated image/spec package, which was moved to a separate module (`github.com/moby/docker-image-spec`) [moby/moby#48460](https://github.com/moby/moby/pull/48460) +* Remove migration code and errors for the deprecated `logentries` logging driver. [moby/moby#48891](https://github.com/moby/moby/pull/48891) +* Remove support for deprecated external graph-driver plugins. [moby/moby#48072](https://github.com/moby/moby/pull/48072) +* `api/types`: Remove deprecated `container.ContainerNode` and `ContainerJSONBase.Node` field. [moby/moby#48107](https://github.com/moby/moby/pull/48107) +* `api/types`: Remove deprecated aliases: `ImagesPruneReport`, `VolumesPruneReport`, `NetworkCreateRequest`, `NetworkCreate`, `NetworkListOptions`, `NetworkCreateResponse`, `NetworkInspectOptions`, `NetworkConnect`, `NetworkDisconnect`, `EndpointResource`, `NetworkResource`, `NetworksPruneReport`, `ExecConfig`, `ExecStartCheck`, `ContainerExecInspect`, `ContainersPruneReport`, `ContainerPathStat`, `CopyToContainerOptions`, `ContainerStats`, `ImageSearchOptions`, `ImageImportSource`, `ImageLoadResponse`, `ContainerNode`. [moby/moby#48107](https://github.com/moby/moby/pull/48107) +* `libnetwork/iptables`: Remove deprecated `IPV`, `Iptables`, `IP6Tables` and `Passthrough()`. [moby/moby#49121](https://github.com/moby/moby/pull/49121) +* `pkg/archive`: Remove deprecated `CanonicalTarNameForPath`, `NewTempArchive`, `TempArchive` [moby/moby#48708](https://github.com/moby/moby/pull/48708) +* `pkg/fileutils`: Remove deprecated `GetTotalUsedFds` [moby/moby#49210](https://github.com/moby/moby/pull/49210) +* `pkg/ioutils`: Remove `OnEOFReader`, which was only used internally [moby/moby#49170](https://github.com/moby/moby/pull/49170) +* `pkg/longpath`: Remove deprecated `Prefix` constant. [moby/moby#48779](https://github.com/moby/moby/pull/48779) +* `pkg/stringid`: Remove deprecated `IsShortID` and `ValidateID` functions [moby/moby#48705](https://github.com/moby/moby/pull/48705) +* `runconfig/opts`: Remove deprecated `ConvertKVStringsToMap` [moby/moby#48102](https://github.com/moby/moby/pull/48102) +* `runconfig`: Remove deprecated `ContainerConfigWrapper`, `SetDefaultNetModeIfBlank`, `DefaultDaemonNetworkMode`, `IsPreDefinedNetwork` [moby/moby#48102](https://github.com/moby/moby/pull/48102) +* `container`: Remove deprecated `ErrNameReserved`, `ErrNameNotReserved`. [moby/moby#48728](https://github.com/moby/moby/pull/48728) +* Remove `Daemon.ContainerInspectCurrent()` method and change `Daemon.ContainerInspect()` signature to accept a `backend.ContainerInspectOptions` struct [moby/moby#48672](https://github.com/moby/moby/pull/48672) +* Remove deprecated `Daemon.Exists()` and `Daemon.IsPaused()` methods. [moby/moby#48723](https://github.com/moby/moby/pull/48723) + +### [Deprecations](#deprecations-8) + +* API: The `BridgeNfIptables` and `BridgeNfIp6tables` fields in the `GET /info` response are now always be `false` and will be omitted in API v1.49. The netfilter module is now loaded on-demand, and no longer during daemon startup, making these fields obsolete. [moby/moby#49114](https://github.com/moby/moby/pull/49114) +* API: The `error` and `progress` fields in streaming responses for endpoints that return a JSON progress response, such as `POST /images/create`, `POST /images/{name}/push`, and `POST /build` are deprecated. [moby/moby#49447](https://github.com/moby/moby/pull/49447) + + Users should use the information in the `errorDetail` and `progressDetail` fields instead. + + These fields were marked deprecated in API v1.4 (docker v0.6.0) and API v1.8 (docker v0.7.1) respectively, but still returned. + + These fields will be left empty or will be omitted in a future API version. +* Deprecate `Daemon.Register()`. This function is unused and will be removed in the next release. [moby/moby#48702](https://github.com/moby/moby/pull/48702) +* Deprecate `client.ImageInspectWithRaw` function in favor of the new `client.ImageInspect`. [moby/moby#48264](https://github.com/moby/moby/pull/48264) +* Deprecate `daemon/config.Config.ValidatePlatformConfig()`. This method was used as helper for `config.Validate`, which should be used instead. [moby/moby#48985](https://github.com/moby/moby/pull/48985) +* Deprecate `pkg/reexec`. This package is deprecated and moved to a separate module. Use `github.com/moby/sys/reexec` instead. [moby/moby#49129](https://github.com/moby/moby/pull/49129) +* Deprecate configuration for pushing non-distributable artifacts [docker/cli#5724](https://github.com/docker/cli/pull/5724) +* Deprecate the `--allow-nondistributable-artifacts` daemon flag and corresponding `allow-nondistributable-artifacts` field in `daemon.json`. Setting either option will no longer take an effect, but a deprecation warning log is added. [moby/moby#49065](https://github.com/moby/moby/pull/49065) +* Deprecate the `RegistryConfig.AllowNondistributableArtifactsCIDRs` and `RegistryConfig.AllowNondistributableArtifactsHostnames` fields in the `GET /info` API response. For API version v1.48 and older, the fields are still included in the response, but always `null`. In API version v1.49 and later, the field will be omitted entirely. [moby/moby#49065](https://github.com/moby/moby/pull/49065) +* Go-SDK: Deprecate `registry.ServiceOptions.AllowNondistributableArtifacts` field. [moby/moby#49065](https://github.com/moby/moby/pull/49065) +* Go-SDK: The `BridgeNfIptables`, `BridgeNfIp6tables` fields in `api/types/system.Info` and `BridgeNFCallIPTablesDisabled`, `BridgeNFCallIP6TablesDisabled` fields in `pkg/sysinfo.SysInfo` are deprecated and will be removed in the next release. [moby/moby#49114](https://github.com/moby/moby/pull/49114) +* Go-SDK: `client`: Deprecate `CommonAPIClient` interface in favor of the `APIClient` interface. The `CommonAPIClient` will be changed to an alias for `APIClient` in the next release, and removed in the release after. [moby/moby#49388](https://github.com/moby/moby/pull/49388) +* Go-SDK: `client`: Deprecate `ErrorConnectionFailed` helper. This function was only used internally, and will be removed in the next release. [moby/moby#49389](https://github.com/moby/moby/pull/49389) +* Go-SDK: `pkg/ioutils`: Deprecate `NewAtomicFileWriter`, `AtomicWriteFile`, `AtomicWriteSet`, `NewAtomicWriteSet` in favor of `pkg/atomicwriter` equivalents. [moby/moby#49171](https://github.com/moby/moby/pull/49171) +* Go-SDK: `pkg/sysinfo`: Deprecate `NumCPU`. This utility has the same behavior as `runtime.NumCPU`. [moby/moby#49241](https://github.com/moby/moby/pull/49241) +* Go-SDK: `pkg/system`: Deprecate `MkdirAll`. This function provided custom handling for Windows GUID volume paths. Handling for such paths is now supported by Go standard library in go1.22 and newer, and this function is now an alias for `os.MkdirAll`, which should be used instead. This alias will be removed in the next release. [moby/moby#49162](https://github.com/moby/moby/pull/49162) +* Go-SDK: Deprecate `pkg/parsers.ParseKeyValueOpt`. [moby/moby#49177](https://github.com/moby/moby/pull/49177) +* Go-SDK: Deprecate `pkg/parsers.ParseUintListMaximum`, `pkg/parsers.ParseUintList`. These utilities were only used internally and will be removed in the next release. [moby/moby#49222](https://github.com/moby/moby/pull/49222) +* Go-SDK: Deprecate `api/type.IDResponse` in favor of `container.CommitResponse` and `container.ExecCreateResponse`, which are currently an alias, but may become distinct types in a future release. This type will be removed in the next release. [moby/moby#49446](https://github.com/moby/moby/pull/49446) +* Go-SDK: Deprecate `api/types/container.ContainerUpdateOKBody` in favor of `UpdateResponse`. This type will be removed in the next release. [moby/moby#49442](https://github.com/moby/moby/pull/49442) +* Go-SDK: Deprecate `api/types/container.ContainerTopOKBody` in favor of `TopResponse`. This type will be removed in the next release. [moby/moby#49442](https://github.com/moby/moby/pull/49442) +* Go-SDK: `pkg/jsonmessage`: Fix deprecation of `ProgressMessage`, `ErrorMessage`, which were deprecated in Docker v0.6.0 and v0.7.1 respectively. [moby/moby#49447](https://github.com/moby/moby/pull/49447) +* Move `GraphDriverData` from `api/types` to `api/types/storage`. The old type is deprecated and will be removed in the next release. [moby/moby#48108](https://github.com/moby/moby/pull/48108) +* Move `RequestPrivilegeFunc` from `api/types` to `api/types/registry`. The old type is deprecated and will be removed in the next release. [moby/moby#48119](https://github.com/moby/moby/pull/48119) +* Move from `api/types` to `api/types/container` - `NetworkSettings`, `NetworkSettingsBase`, `DefaultNetworkSettings`, `SummaryNetworkSettings`, `Health`, `HealthcheckResult`, `NoHealthcheck`, `Starting`, `Healthy`, and `Unhealthy` constants, `MountPoint`, `Port`, `ContainerState`, `Container`, `ContainerJSONBase`, `ContainerJSON`, `ContainerNode`. The old types are deprecated and will be removed in the next release. [moby/moby#48108](https://github.com/moby/moby/pull/48108) +* Move from `api/types` to `api/types/image` - `ImageInspect`, `RootFS`. The old types are deprecated and will be removed in the next release. [moby/moby#48108](https://github.com/moby/moby/pull/48108) +* `ContainerdCommit.Expected`, `RuncCommit.Expected`, and `InitCommit.Expected` fields in the `GET /info` endpoint are deprecated and will be omitted in API v1.49. [moby/moby#48478](https://github.com/moby/moby/pull/48478) +* `api/types/registry`: Deprecate `ServiceConfig.AllowNondistributableArtifactsCIDRs` and `ServiceConfig.AllowNondistributableArtifactsHostnames` fields. These fields will be removed in the next release. [moby/moby#49065](https://github.com/moby/moby/pull/49065) +* `api/types/system/Commit.Expected` field is deprecated and should no longer be used. [moby/moby#48478](https://github.com/moby/moby/pull/48478) +* `daemon/graphdriver`: Deprecate `GetDriver()` [moby/moby#48079](https://github.com/moby/moby/pull/48079) +* `libnetwork/iptables`: Deprecate `Passthrough`. This function was only used internally, and will be removed in the next release. [moby/moby#49115](https://github.com/moby/moby/pull/49115) +* `pkg/directory.Size()` function is deprecated, and will be removed in the next release. [moby/moby#48057](https://github.com/moby/moby/pull/48057) +* `registry`: Deprecate `APIEndpoint.TrimHostName`; hostname is now trimmed unconditionally for remote names. This field will be removed in the next release. [moby/moby#49005](https://github.com/moby/moby/pull/49005) +* `allow-nondistributable-artifacts` field in `daemon.json`. Setting either option will no longer take effect, but a deprecation warning log is added to raise awareness about the deprecation. This warning is planned to become an error in the next release. [moby/moby#49065](https://github.com/moby/moby/pull/49065) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_28.0.1.md b/corpus/changelog/docker_engine_releases/docker_engine_28.0.1.md new file mode 100644 index 0000000000000000000000000000000000000000..dc8c4a99544c57ba6b1c824c3ba284cd62094982 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_28.0.1.md @@ -0,0 +1,46 @@ +# Docker Engine 28.0.1 release notes + +Source: https://docs.docker.com/engine/release-notes/28/ + +## [28.0.1](#2801) + +*2025-02-26* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 28.0.1 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A28.0.1) +* [moby/moby, 28.0.1 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A28.0.1) + +### [Networking](#networking-8) + +* Remove dependency on kernel modules `ip_set`, `ip_set_hash_net` and `netfilter_xt_set`. + + The dependency was introduced in release 28.0.0 but proved too disruptive. The iptables rules using these modules have been replaced. [moby/moby#49530](https://github.com/moby/moby/pull/49530) +* Allow daemon startup on a host with IPv6 disabled without requiring `--ip6tables=false`. [moby/moby#49525](https://github.com/moby/moby/pull/49525) +* Fix a bug that was causing containers with `--restart=always` and a published port already in use to restart in a tight loop. [moby/moby#49507](https://github.com/moby/moby/pull/49507) +* Fix an issue with Swarm ingress, caused by incorrect ordering of iptables rules. [moby/moby#49538](https://github.com/moby/moby/pull/49538) +* Fix creation of a swarm-scoped network from a `--config-only` network. [moby/moby#49521](https://github.com/moby/moby/pull/49521) +* Fix `docker network inspect` reporting an IPv6 gateway with CIDR suffix for a newly created network with no specific IPAM config, until a daemon restart. [moby/moby#49520](https://github.com/moby/moby/pull/49520) +* Improve the error reported when kernel modules `ip_set`, `ip_set_hash_net` and `netilter_xt_set` are not available. [moby/moby#49524](https://github.com/moby/moby/pull/49524) +* Move most of Docker's iptables rules out of the filter-FORWARD chain, so that other applications are free to append rules that must follow Docker's rules. [moby/moby#49518](https://github.com/moby/moby/pull/49518) +* Update `--help` output and man page lo state which options only apply to the default bridge network. [moby/moby#49522](https://github.com/moby/moby/pull/49522) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-13) + +* Fix `docker context create` always returning an error when using the `"skip-tls-verify"` option. [docker/cli#5850](https://github.com/docker/cli/pull/5850) +* Fix shell completion suggesting IDs instead of names for services and nodes. [docker/cli#5848](https://github.com/docker/cli/pull/5848) +* Fix unintentionally printing exit status to standard error output when `docker exec/run` returns a non-zero status. [docker/cli#5854](https://github.com/docker/cli/pull/5854) +* Fix regression `protocol "tcp" is not supported by the RootlessKit port driver "slirp4netns"`. [moby/moby#49514](https://github.com/moby/moby/pull/49514) +* containerd image store: Fix `docker inspect` not being able to show multi-platform images with missing layers for all platforms. [moby/moby#49533](https://github.com/moby/moby/pull/49533) +* containerd image store: Fix `docker images --tree` reporting wrong content size. [moby/moby#49535](https://github.com/moby/moby/pull/49535) +* Fix compilation on i386 [moby/moby#49526](https://github.com/moby/moby/pull/49526) + +### [Packaging updates](#packaging-updates-13) + +* Update `github.com/go-jose/go-jose/v4` to v4.0.5 to address [GHSA-c6gw-w398-hv78](https://github.com/go-jose/go-jose/security/advisories/GHSA-c6gw-w398-hv78) / [CVE-2025-27144](https://www.cve.org/CVERecord?id=CVE-2025-27144). [docker/cli#5867](https://github.com/docker/cli/pull/5867) +* Update Buildx to [v0.21.1](https://github.com/docker/buildx/releases/tag/v0.21.1). [docker/docker-ce-packaging#1167](https://github.com/docker/docker-ce-packaging/pull/1167) +* Update Compose to [v2.33.1](https://github.com/docker/compose/releases/tag/v2.33.1). [docker/docker-ce-packaging#1168](https://github.com/docker/docker-ce-packaging/pull/1168) + +### [API](#api-5) + +* containerd image store: Fix `GET /images/json?manifests=1` not filling `Manifests` for index-only images [moby/moby#49533](https://github.com/moby/moby/pull/49533) +* containerd image store: Fix `GET /images/json and /images//json` `Size.Content` field including the size of content that's not available locally [moby/moby#49535](https://github.com/moby/moby/pull/49535) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_28.0.2.md b/corpus/changelog/docker_engine_releases/docker_engine_28.0.2.md new file mode 100644 index 0000000000000000000000000000000000000000..d4aee300ff4d30daa73d14a8f341e8a0a4550700 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_28.0.2.md @@ -0,0 +1,64 @@ +# Docker Engine 28.0.2 release notes + +Source: https://docs.docker.com/engine/release-notes/28/ + +## [28.0.2](#2802) + +*2025-03-19* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 28.0.2 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A28.0.2) +* [moby/moby, 28.0.2 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A28.0.2) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-12) + +* Fix CLI-specific attributes (`docker.cli.*`) being unintentionally passed to downstream OTel services. [docker/cli#5842](https://github.com/docker/cli/pull/5842) +* Fix an issue where user-specified `OTEL_RESOURCE_ATTRIBUTES` were being overridden by CLI's internal telemetry attributes. The CLI now properly merges user-specified attributes with internal ones, allowing both to coexist. [docker/cli#5842](https://github.com/docker/cli/pull/5842) +* Fix the daemon failing to start on Windows when a container created before v28.0.0 was present. [moby/moby#49626](https://github.com/moby/moby/pull/49626) +* Fix possible error on `docker buildx prune` with `--min-free-space`. [moby/moby#49623](https://github.com/moby/moby/pull/49623) +* Fix spurious `io: read/write on closed pipe` error in the daemon log when closing a container. [moby/moby#49590](https://github.com/moby/moby/pull/49590) +* Fix the Docker daemon failing too early if the containerd socket isn't immediately available. [moby/moby#49603](https://github.com/moby/moby/pull/49603) +* Mask Linux thermal interrupt info in a container's `/proc` and `/sys` by default. [moby/moby#49560](https://github.com/moby/moby/pull/49560) +* Update `contrib/check-config.sh` to check for more kernel modules related to iptables. [moby/moby#49622](https://github.com/moby/moby/pull/49622) +* containerd image store: Fix integer overflow in User ID handling passed via `--user`. [moby/moby#49652](https://github.com/moby/moby/pull/49652) +* containerd image store: Fix spurious `reference for unknown type: application/vnd.in-toto+json` warning being logged to the daemon's log. [moby/moby#49652](https://github.com/moby/moby/pull/49652) +* containerd image store: Improve performance of `docker ps` when running a large number of containers. [moby/moby#49365](https://github.com/moby/moby/pull/49365) + +### [Packaging updates](#packaging-updates-12) + +* Update BuildKit to [v0.20.1](https://github.com/moby/buildkit/releases/tag/v0.20.1). [moby/moby#49587](https://github.com/moby/moby/pull/49587) +* Update Buildx to [v0.22.0](https://github.com/docker/buildx/releases/tag/v0.22.0). [docker/docker-ce-packaging#1175](https://github.com/docker/docker-ce-packaging/pull/1175) +* Update Compose to [v2.34.0](https://github.com/docker/compose/releases/tag/v2.34.0). [docker/docker-ce-packaging#1172](https://github.com/docker/docker-ce-packaging/pull/1172) +* Update Go runtime to [1.23.7](https://go.dev/doc/devel/release#go1.23.7). [docker/cli#5890](https://github.com/docker/cli/pull/5890), [docker/docker-ce-packaging#1171](https://github.com/docker/docker-ce-packaging/pull/1171), [moby/moby#49580](https://github.com/moby/moby/pull/49580) +* Update RootlessKit to [v2.3.4](https://github.com/rootless-containers/rootlesskit/releases/tag/v2.3.4). [moby/moby#49614](https://github.com/moby/moby/pull/49614) +* Update containerd (static binaries only) to [v1.7.27](https://www.github.com/containerd/containerd/releases/tag/v1.7.27). [moby/moby#49656](https://github.com/moby/moby/pull/49656) + +### [Networking](#networking-7) + +* Add the environment variable `DOCKER_INSECURE_NO_IPTABLES_RAW=1` to allow Docker to run on systems where the Linux kernel can't provide `CONFIG_IP_NF_RAW` support. When enabled, Docker will not create rules in the iptables `raw` table. Warning: This is not recommended for production environments as it reduces security by allowing other hosts on the local network to route to ports published to host addresses, even when they are published to `127.0.0.1.` This option bypasses some of the security hardening introduced in Docker Engine 28.0.0. [moby/moby#49621](https://github.com/moby/moby/pull/49621) +* Allow container startup when an endpoint is attached to a macvlan network driver where the parent interface is down. [moby/moby#49630](https://github.com/moby/moby/pull/49630) +* Do not skip DNAT for packets originating in a `gateway_mode=routed` network. [moby/moby#49577](https://github.com/moby/moby/pull/49577) +* Fix a bug causing `docker ps` to inconsistently report dual-stack port mappings. [moby/moby#49657](https://github.com/moby/moby/pull/49657) +* Fix a bug that could cause `docker-proxy` to stop forwarding UDP datagrams to containers. [moby/moby#49649](https://github.com/moby/moby/pull/49649) +* Fix a bug that was causing `docker-proxy` to close UDP connections to containers eagerly and resulting in the source address to change needlessly. [moby/moby#49649](https://github.com/moby/moby/pull/49649) + +### [Go SDK](#go-sdk-4) + +* Move various types and consts from `cli-plugins/manager` to a separate package. [docker/cli#5902](https://github.com/docker/cli/pull/5902) +* Update minimum required Go version to go1.23. [moby/moby#49541](https://github.com/moby/moby/pull/49541) +* `cli/command`: Move `PrettyPrint` utility to `cli/command/formatter`. [docker/cli#5916](https://github.com/docker/cli/pull/5916) +* runconfig/errors: split `ErrConflictHostNetwork` into `ErrConflictConnectToHostNetwork` and `ErrConflictDisconnectFromHostNetwork`. [moby/moby#49605](https://github.com/moby/moby/pull/49605) + +### [Deprecations](#deprecations-7) + +* Go-SDK: Deprecate `cli-plugins/manager.ResourceAttributesEnvvar` constant. It was used internally, but holds the `OTEL_RESOURCE_ATTRIBUTES` name, which is part of the OpenTelemetry specification. Users of this constant should define their own. It will be removed in the next release. [docker/cli#5881](https://github.com/docker/cli/pull/5881) +* Go-SDK: Deprecate `opts.PortOpt`, `opts.ConfigOpt` and `opts.SecretOpt`. These types were moved to the `opts/swarmopts` package. [docker/cli#5907](https://github.com/docker/cli/pull/5907) +* Go-SDK: Remove `service/logs` package. [docker/cli#5910](https://github.com/docker/cli/pull/5910) +* Go-SDK: `cli/command/image`: Deprecate `PushTrustedReference` and move to `cli/trust`. [docker/cli#5894](https://github.com/docker/cli/pull/5894) +* Go-SDK: `cli/command/image`: Deprecate and internalize `TrustedPush`. [docker/cli#5894](https://github.com/docker/cli/pull/5894) +* Go-SDK: `cli/command`: deprecate `Cli.NotaryClient`: use [`trust.GetNotaryRepository`](https://pkg.go.dev/github.com/docker/cli@v28.0.1+incompatible/cli/trust#GetNotaryRepository) instead. This method is no longer used and will be removed in the next release. [docker/cli#5885](https://github.com/docker/cli/pull/5885) +* Go-SDK: `cli/command`: deprecate `Cli.RegistryClient`. This method was only used internally and will be removed in the next release. Use [`client.NewRegistryClient`](https://pkg.go.dev/github.com/docker/cli@v28.0.1+incompatible/cli/registry/client#NewRegistryClient) instead. [docker/cli#5889](https://github.com/docker/cli/pull/5889), [docker/cli#5889](https://github.com/docker/cli/pull/5889) +* Go-SDK: `registry`: Deprecate `RepositoryInfo.Official` field. [moby/moby#49567](https://github.com/moby/moby/pull/49567) +* Go-SDK: `registry`: deprecate `HostCertsDir`: this function was only used internally and will be removed in the next release. [moby/moby#49612](https://github.com/moby/moby/pull/49612) +* Go-SDK: `registry`: deprecate `SetCertsDir`: the cert-directory is now automatically selected when running with RootlessKit, and should no longer be set manually. [moby/moby#49612](https://github.com/moby/moby/pull/49612) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_28.0.3.md b/corpus/changelog/docker_engine_releases/docker_engine_28.0.3.md new file mode 100644 index 0000000000000000000000000000000000000000..38f824263868d7588e142af5a8252c5188796a73 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_28.0.3.md @@ -0,0 +1,22 @@ +# Docker Engine 28.0.3 release notes + +Source: https://docs.docker.com/engine/release-notes/28/ + +## [28.0.3](#2803) + +*2025-03-25* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 28.0.3 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A28.0.3) +* [moby/moby, 28.0.3 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A28.0.3) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-11) + +* Fix `docker run` truncating the `STDOUT`/`STDERR` prematurely when the container exits before the data is consumed. [docker/cli#5957](https://github.com/docker/cli/pull/5957) + +### [Packaging updates](#packaging-updates-11) + +* Update BuildKit to [v0.20.2](https://github.com/moby/buildkit/releases/tag/v0.20.2). [moby/moby#49698](https://github.com/moby/moby/pull/49698) +* Update `runc` to [v1.2.6](https://github.com/opencontainers/runc/releases/tag/v1.2.6). [moby/moby#49682](https://github.com/moby/moby/pull/49682) +* Update containerd to [v1.7.26](https://github.com/containerd/containerd/releases/tag/v1.7.26). [docker/containerd-packaging#409](https://github.com/docker/containerd-packaging/pull/409) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_28.0.4.md b/corpus/changelog/docker_engine_releases/docker_engine_28.0.4.md new file mode 100644 index 0000000000000000000000000000000000000000..e24635e36c1322a829bc863999f2102a7a023d59 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_28.0.4.md @@ -0,0 +1,16 @@ +# Docker Engine 28.0.4 release notes + +Source: https://docs.docker.com/engine/release-notes/28/ + +## [28.0.4](#2804) + +*2025-03-25* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 28.0.4 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A28.0.4) +* [moby/moby, 28.0.4 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A28.0.4) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-10) + +* Fix a regression causing `docker pull/push` to fail when interacting with a private repository. [docker/cli#5964](https://github.com/docker/cli/pull/5964) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_28.1.0.md b/corpus/changelog/docker_engine_releases/docker_engine_28.1.0.md new file mode 100644 index 0000000000000000000000000000000000000000..4e683f1ebcacf833eea246a9bf0fd5edcf2a6c73 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_28.1.0.md @@ -0,0 +1,75 @@ +# Docker Engine 28.1.0 release notes + +Source: https://docs.docker.com/engine/release-notes/28/ + +## [28.1.0](#2810) + +*2025-04-17* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 28.1.0 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A28.1.0) +* [moby/moby, 28.1.0 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A28.1.0) + +### [New](#new-3) + +* Add `docker bake` sub-command as alias for `docker buildx bake`. [docker/cli#5947](https://github.com/docker/cli/pull/5947) +* Experimental: add a new `--use-api-socket` flag on `docker run` and `docker create` to enable access to Docker socket from inside a container and to share credentials from the host with the container. [docker/cli#5858](https://github.com/docker/cli/pull/5858) +* `docker image inspect` now supports a `--platform` flag to inspect a specific platform of a multi-platform image. [docker/cli#5934](https://github.com/docker/cli/pull/5934) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-9) + +* Add CLI shell-completion for context names. [docker/cli#6016](https://github.com/docker/cli/pull/6016) +* Fix `docker images --tree` not including non-container images content size in the total image content size. [docker/cli#6000](https://github.com/docker/cli/pull/6000) +* Fix `docker load` not preserving replaced images. [moby/moby#49650](https://github.com/moby/moby/pull/49650) +* Fix `docker login` hints when logging in to a custom registry. [docker/cli#6015](https://github.com/docker/cli/pull/6015) +* Fix `docker stats` not working properly on machines with high CPU core count. [moby/moby#49734](https://github.com/moby/moby/pull/49734) +* Fix a regression causing `docker pull/push` to fail when interacting with a private repository. [docker/cli#5964](https://github.com/docker/cli/pull/5964) +* Fix an issue preventing rootless Docker setup on a host with no `ip_tables` kernel module. [moby/moby#49727](https://github.com/moby/moby/pull/49727) +* Fix an issue that could lead to unwanted iptables rules being restored and never deleted following a firewalld reload. [moby/moby#49728](https://github.com/moby/moby/pull/49728) +* Improve CLI completion of `docker service scale`. [docker/cli#5968](https://github.com/docker/cli/pull/5968) +* `docker images --tree` now hides both untagged and dangling images by default. [docker/cli#5924](https://github.com/docker/cli/pull/5924) +* `docker system info` will provide an exit code if a connection cannot be established to the Docker daemon. [docker/cli#5918](https://github.com/docker/cli/pull/5918) +* containerd image store: Fix `image tag` event not being emitted when building with BuildKit. [moby/moby#49678](https://github.com/moby/moby/pull/49678) +* containerd image store: Improve `docker push/pull` handling of remote registry errors. [moby/moby#49770](https://github.com/moby/moby/pull/49770) +* containerd image store: Show pull progress for non-layer image blobs. [moby/moby#49746](https://github.com/moby/moby/pull/49746) + +### [Packaging updates](#packaging-updates-10) + +* Add Debian "Trixie" packages. [docker/docker-ce-packaging#1181](https://github.com/docker/docker-ce-packaging/pull/1181) +* Add Fedora 42 packages. [docker/containerd-packaging#418](https://github.com/docker/containerd-packaging/pull/418), [docker/docker-ce-packaging#1169](https://github.com/docker/docker-ce-packaging/pull/1169) +* Add Ubuntu 25.04 "Plucky Puffin" packages. [docker/containerd-packaging#419](https://github.com/docker/containerd-packaging/pull/419), [docker/docker-ce-packaging#1177](https://github.com/docker/docker-ce-packaging/pull/1177) +* Update BuildKit to [v0.21.0](https://github.com/moby/buildkit/releases/tag/v0.21.0). [moby/moby#49809](https://github.com/moby/moby/pull/49809) +* Update Compose to [v2.35.0](https://github.com/docker/compose/releases/tag/v2.35.0). [docker/docker-ce-packaging#1183](https://github.com/docker/docker-ce-packaging/pull/1183) +* Update Go runtime to [1.23.8](https://go.dev/doc/devel/release#go1.23.8). [docker/cli#5986](https://github.com/docker/cli/pull/5986), [docker/docker-ce-packaging#1180](https://github.com/docker/docker-ce-packaging/pull/1180), [moby/moby#49737](https://github.com/moby/moby/pull/49737) + +### [Networking](#networking-6) + +* Fix a bug causing host port-mappings on Swarm containers to be duplicated on `docker ps` and `docker inspect`. [moby/moby#49724](https://github.com/moby/moby/pull/49724) +* Fix an issue that caused container network attachment to fail with error "Bridge port not forwarding". [moby/moby#49705](https://github.com/moby/moby/pull/49705) +* Fix an issue with removal of a `--link` from a container in the default bridge network. [moby/moby#49778](https://github.com/moby/moby/pull/49778) +* Improve how network-endpoint relationships are tracked to reduce the chance of the "has active endpoints" error to be wrongfully returned. [moby/moby#49736](https://github.com/moby/moby/pull/49736) +* Improve the "has active endpoints" error message by including the name of endpoints still connected to the network being deleted. [moby/moby#49773](https://github.com/moby/moby/pull/49773) + +### [API](#api-4) + +* Update API version to [v1.49](https://docs.docker.com/engine/api/v1.49/). [moby/moby#49718](https://github.com/moby/moby/pull/49718) +* `GET /image/{name}/json` now supports a `platform` parameter allowing to specify which platform variant of a multi-platform image to inspect. [moby/moby#49586](https://github.com/moby/moby/pull/49586) +* `GET /info` now returns a `FirewallBackend` containing information about the daemon's firewalling configuration. [moby/moby#49761](https://github.com/moby/moby/pull/49761) + +### [Go SDK](#go-sdk-3) + +* Update minimum required Go version to go1.23. [docker/cli#5868](https://github.com/docker/cli/pull/5868) +* cli/command/context: remove temporary `ContextType` field from JSON output. [docker/cli#5981](https://github.com/docker/cli/pull/5981) +* client: Keep image references in canonical format where possible. [moby/moby#49609](https://github.com/moby/moby/pull/49609) + +### [Deprecations](#deprecations-6) + +* API: Deprecated `AllowNondistributableArtifactsCIDRs` and `AllowNondistributableArtifactsHostnames` fields in the `RegistryConfig` struct in the `GET /info` response are omitted in API v1.49. [moby/moby#49749](https://github.com/moby/moby/pull/49749) +* API: Deprecated: The `ContainerdCommit.Expected`, `RuncCommit.Expected`, and `InitCommit.Expected` fields in the `GET /info` endpoint were deprecated in API v1.48, and are now omitted in API v1.49. [moby/moby#48556](https://github.com/moby/moby/pull/48556) +* Go-SDK: cli/command/image: Deprecate `RunPull`: this function was only used internally and will be removed in the next release. [docker/cli#5975](https://github.com/docker/cli/pull/5975) +* Go-SDK: cli/config/configfile: deprecate `ConfigFile.Experimental` field. Experimental CLI features are always enabled since version v20.10 and this field is no longer used. Use `ConfigFile.Features` instead for optional features. This field will be removed in a future release. [docker/cli#5977](https://github.com/docker/cli/pull/5977) +* Go-SDK: deprecate `pkg/archive`, which was migrated to `github.com/moby/go-archive`. [moby/moby#49743](https://github.com/moby/moby/pull/49743) +* Go-SDK: deprecate `pkg/atomicwriter`, which was migrated to `github.com/moby/sys/atomicwriter`. [moby/moby#49748](https://github.com/moby/moby/pull/49748) +* Go-SDK: opts: remove deprecated `PortOpt`, `ConfigOpt`, `SecretOpt` aliases. [docker/cli#5953](https://github.com/docker/cli/pull/5953) +* Go-SDK: registry: deprecate `APIEndpoint.Official` field. [moby/moby#49706](https://github.com/moby/moby/pull/49706) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_28.1.1.md b/corpus/changelog/docker_engine_releases/docker_engine_28.1.1.md new file mode 100644 index 0000000000000000000000000000000000000000..71623a6a808578e5a42d35e7f7bee004c8f09a04 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_28.1.1.md @@ -0,0 +1,26 @@ +# Docker Engine 28.1.1 release notes + +Source: https://docs.docker.com/engine/release-notes/28/ + +## [28.1.1](#2811) + +*2025-04-18* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 28.1.1 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A28.1.1) +* [moby/moby, 28.1.1 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A28.1.1) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-8) + +* Fix `dockerd-rootless-setuptool.sh` incorrectly reporting missing `iptables`. [moby/moby#49833](https://github.com/moby/moby/pull/49833) +* containerd image store: Fix a potential daemon crash when using `docker load` with archives containing zero-size tar headers. [moby/moby#49837](https://github.com/moby/moby/pull/49837) + +### [Packaging updates](#packaging-updates-9) + +* Update Buildx to [v0.23.0](https://github.com/docker/buildx/releases/tag/v0.23.0). [docker/docker-ce-packaging#1185](https://github.com/docker/docker-ce-packaging/pull/1185) +* Update Compose to [v2.35.1](https://github.com/docker/compose/releases/tag/v2.35.1). [docker/docker-ce-packaging#1188](https://github.com/docker/docker-ce-packaging/pull/1188) + +### [Networking](#networking-5) + +* Add a warning to a container's `/etc/resolv.conf` when no upstream DNS servers were found. [moby/moby#49827](https://github.com/moby/moby/pull/49827) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_28.2.0.md b/corpus/changelog/docker_engine_releases/docker_engine_28.2.0.md new file mode 100644 index 0000000000000000000000000000000000000000..71fe0f1ccd7bfea38426e351dce3ffb715820537 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_28.2.0.md @@ -0,0 +1,94 @@ +# Docker Engine 28.2.0 release notes + +Source: https://docs.docker.com/engine/release-notes/28/ + +## [28.2.0](#2820) + +*2025-05-28* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 28.2.0 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A28.2.0) +* [moby/moby, 28.2.0 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A28.2.0) + +> Note +> +> RHEL packages are currently not available and will be released later. + +### [New](#new-2) + +* Add `{{.Platform}}` as formatting option for `docker ps` to show the platform of the image the container is running. [docker/cli#6042](https://github.com/docker/cli/pull/6042) +* Add support for relative parent paths (`../`) on bind mount sources when using `docker run/create` with `-v/--volume` or `--mount type=bind` options. [docker/cli#4966](https://github.com/docker/cli/pull/4966) +* CDI is now enabled by default. [moby/moby#49963](https://github.com/moby/moby/pull/49963) +* Show discovered CDI devices in `docker info`. [docker/cli#6078](https://github.com/docker/cli/pull/6078) +* `docker image rm`: add `--platform` option to remove a variant from multi-platform images. [docker/cli#6109](https://github.com/docker/cli/pull/6109) +* containerd image store: Initial BuildKit support for building Windows container images on Windows (requires an opt-in with `DOCKER_BUILDKIT=1`). [moby/moby#49740](https://github.com/moby/moby/pull/49740) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-7) + +* Add a new log option for fluentd log driver (`fluentd-write-timeout`), which enables specifying write timeouts for fluentd connections. [moby/moby#49911](https://github.com/moby/moby/pull/49911) +* Add support for `DOCKER_AUTH_CONFIG` for the experimental `--use-api-socket` option. [docker/cli#6019](https://github.com/docker/cli/pull/6019) +* Fix `docker exec` waiting for 10 seconds if a non-existing user or group was specified. [moby/moby#49868](https://github.com/moby/moby/pull/49868) +* Fix `docker swarm init` ignoring `cacert` option of `--external-ca`. [docker/cli#5995](https://github.com/docker/cli/pull/5995) +* Fix an issue where the CLI would not correctly save the configuration file (`~/.docker/config.json`) if it was a relative symbolic link. [docker/cli#5282](https://github.com/docker/cli/pull/5282) +* Fix containers with `--restart always` policy using CDI devices failing to start on daemon restart. [moby/moby#49990](https://github.com/moby/moby/pull/49990) +* Fix shell-completion to only complete some flags once, even though they can be set multiple times. [docker/cli#6030](https://github.com/docker/cli/pull/6030) +* Fix the `plugin does not implement PluginAddr interface` error for Swarm CSI drivers. [moby/moby#49961](https://github.com/moby/moby/pull/49961) +* Improve `docker login` error messages for invalid options. [docker/cli#6036](https://github.com/docker/cli/pull/6036) +* Make sure the terminal state is restored if the CLI is forcefully terminated. [docker/cli#6058](https://github.com/docker/cli/pull/6058) +* Update the default seccomp profile to match the libseccomp v2.6.0. The new syscalls are: `listmount`, `statmount`, `lsm_get_self_attr`, `lsm_list_modules`, `lsm_set_self_attr`, `mseal`, `uretprobe`, `riscv_hwprobe`, `getxattrat`, `listxattrat`, `removexattrat`, and `setxattrat`. This prevents containers from receiving EPERM errors when using them. [moby/moby#50077](https://github.com/moby/moby/pull/50077) +* `docker inspect`: add shell completion, improve flag-description for `--type` and improve validation. [docker/cli#6052](https://github.com/docker/cli/pull/6052) +* containerd image store: Enable BuildKit garbage collector by default. [moby/moby#49899](https://github.com/moby/moby/pull/49899) +* containerd image store: Fix `docker build` not persisting overridden images as dangling. [moby/moby#49702](https://github.com/moby/moby/pull/49702) +* containerd image store: Fix `docker system df` reporting a negative reclaimable space amount. [moby/moby#49707](https://github.com/moby/moby/pull/49707) +* containerd image store: Fix duplicate `PUT` requests when pushing a multi-platform image. [moby/moby#49949](https://github.com/moby/moby/pull/49949) + +### [Packaging updates](#packaging-updates-8) + +* Drop Ubuntu 20.04 "Focal" packages as it reached end of life. [docker/docker-ce-packaging#1200](https://github.com/docker/docker-ce-packaging/pull/1200) +* Fix install location for RPM-based `docker-ce` man-pages. [docker/docker-ce-packaging#1203](https://github.com/docker/docker-ce-packaging/pull/1203) +* Update BuildKit to [v0.22.0](https://github.com/moby/buildkit/releases/tag/v0.22.0). [moby/moby#50046](https://github.com/moby/moby/pull/50046) +* Update Buildx to [v0.24.0](https://github.com/docker/buildx/releases/tag/v0.24.0). [docker/docker-ce-packaging#1205](https://github.com/docker/docker-ce-packaging/pull/1205) +* Update Compose to [v2.36.2](https://github.com/docker/compose/releases/tag/v2.36.2). [docker/docker-ce-packaging#1208](https://github.com/docker/docker-ce-packaging/pull/1208) +* Update Go runtime to [1.24.3](https://go.dev/doc/devel/release#go1.24.3). [docker/docker-ce-packaging#1192](https://github.com/docker/docker-ce-packaging/pull/1192), [docker/cli#6060](https://github.com/docker/cli/pull/6060), [moby/moby#49174](https://github.com/moby/moby/pull/49174) + +### [Networking](#networking-4) + +* Add bridge network option `"com.docker.network.bridge.trusted_host_interfaces"`, accepting a colon-separated list of interface names. These interfaces have direct access to published ports on container IP addresses. [moby/moby#49832](https://github.com/moby/moby/pull/49832) +* Add daemon option `"allow-direct-routing"` to disable filtering of packets from outside the host addressed directly to containers. [moby/moby#49832](https://github.com/moby/moby/pull/49832) +* Do not display network options `com.docker.network.enable_ipv4` or `com.docker.network.enable_ipv6` in inspect output if they have been overridden by `EnableIPv4` or `EnableIPv6` in the network create request. [moby/moby#49866](https://github.com/moby/moby/pull/49866) +* Fix an issue that could cause network deletion to fail after a daemon restart, with error "has active endpoints" listing empty endpoint names. [moby/moby#49901](https://github.com/moby/moby/pull/49901) +* Fix an issue where `docker network inspect --verbose` could sometimes crash the daemon. [moby/moby#49937](https://github.com/moby/moby/pull/49937) +* Fix an issue where the load-balancer IP address for an overlay network would not be released in certain cases if the Swarm was lacking an ingress network. [moby/moby#49948](https://github.com/moby/moby/pull/49948) +* Improve the reliability of NetworkDB in busy clusters and lossy networks. [moby/moby#49932](https://github.com/moby/moby/pull/49932) +* Improvements to the reliability and convergence speed of NetworkDB. [moby/moby#49939](https://github.com/moby/moby/pull/49939) + +### [API](#api-3) + +* `DELETE /images/{name}` now supports a `platforms` query parameter. It accepts an array of JSON-encoded OCI Platform objects, allowing for selecting a specific platforms to delete content for. [moby/moby#49982](https://github.com/moby/moby/pull/49982) +* `GET /info` now includes a `DiscoveredDevices` field. This is an array of `DeviceInfo` objects, each providing details about a device discovered by a device driver. [moby/moby#49980](https://github.com/moby/moby/pull/49980) + +### [Go SDK](#go-sdk-2) + +* `api/types/container`: add `ContainerState` and constants for container state. [moby/moby#49965](https://github.com/moby/moby/pull/49965) +* `api/types/container`: change `Summary.State` to a `ContainerState`. [moby/moby#49991](https://github.com/moby/moby/pull/49991) +* `api/types/container`: define `HealthStatus` type for health-status constants. [moby/moby#49876](https://github.com/moby/moby/pull/49876) +* `api/types`: deprecate `BuildResult`, `ImageBuildOptions`, `ImageBuildOutput`, `ImageBuildResponse`, `BuilderVersion`, `BuilderV1`, and `BuilderBuildKi` which were moved to `api/types/build`. [moby/moby#50025](https://github.com/moby/moby/pull/50025) + +### [Deprecations](#deprecations-5) + +* API: Deprecated: `GET /images/{name}/json` no longer returns the following fields: `Config`, `Hostname`, `Domainname`, `AttachStdin`, `AttachStdout`, `AttachStderr`, `Tty`, `OpenStdin`, `StdinOnce`, `Image`, `NetworkDisabled` (already omitted unless set), `MacAddress` (already omitted unless set), `StopTimeout` (already omitted unless set). These additional fields were included in the response due to an implementation detail but not part of the image's Configuration, were marked deprecated in API v1.46, and are now omitted. [moby/moby#48457](https://github.com/moby/moby/pull/48457) +* Go-SDK: Deprecate builder/remotecontext.Rel(). This function was needed on older versions of Go, but can now be replaced by `filepath.Rel()`. [moby/moby#49843](https://github.com/moby/moby/pull/49843) +* Go-SDK: api/types: deprecate `BuildCachePruneOptions` in favor of `api/types/builder.CachePruneOptions`. [moby/moby#50015](https://github.com/moby/moby/pull/50015) +* Go-SDK: api/types: deprecate `BuildCachePruneReport` in favor of `api/types/builder.CachePruneReport`. [moby/moby#50015](https://github.com/moby/moby/pull/50015) +* Go-SDK: api/types: deprecate `NodeListOptions`, `NodeRemoveOptions`, `ServiceCreateOptions`, `ServiceUpdateOptions`, `RegistryAuthFromSpec`, `RegistryAuthFromPreviousSpec`, `ServiceListOptions`, `ServiceInspectOptions`, and `SwarmUnlockKeyResponse` which were moved to `api/types/swarm`. [moby/moby#50027](https://github.com/moby/moby/pull/50027) +* Go-SDK: api/types: deprecate `SecretCreateResponse`, `SecretListOptions`, `ConfigCreateResponse`, `ConfigListOptions` which were moved to api/types/swarm. [moby/moby#50024](https://github.com/moby/moby/pull/50024) +* Go-SDK: client: deprecate `IsErrNotFound`. [moby/moby#50012](https://github.com/moby/moby/pull/50012) +* Go-SDK: container: deprecate `IsValidHealthString` in favor of `api/types/container.ValidateHealthStatus`. [moby/moby#49893](https://github.com/moby/moby/pull/49893) +* Go-SDK: container: deprecate `StateStatus`, `WaitCondition`, and the related `WaitConditionNotRunning`, `WaitConditionNextExit`, and `WaitConditionRemoved` consts in favor of their equivalents in `api/types/container`. [moby/moby#49874](https://github.com/moby/moby/pull/49874) +* Go-SDK: opts: deprecate `ListOpts.GetAll` in favor of `ListOpts.GetSlice`. [docker/cli#6032](https://github.com/docker/cli/pull/6032) +* Remove deprecated `IsAutomated` formatting placeholder from `docker search`. [docker/cli#6091](https://github.com/docker/cli/pull/6091) +* Remove fallback for pulling images from non-OCI-compliant `docker.pkg.github.com` registry. [moby/moby#50094](https://github.com/moby/moby/pull/50094) +* Remove support for pulling legacy v2, schema 1 images and remove `DOCKER_ENABLE_DEPRECATED_PULL_SCHEMA_1_IMAGE` environment-variable. [moby/moby#50036](https://github.com/moby/moby/pull/50036), [moby/moby#42300](https://github.com/moby/moby/pull/42300) +* The `BridgeNfIptables` and `BridgeNfIp6tables` fields in the `GET /info` response were deprecated in API v1.48, and are now omitted in API v1.50. [moby/moby#49904](https://github.com/moby/moby/pull/49904) +* errdefs: Deprecate `errdefs.FromStatusCode`. Use containerd's `errhttp.ToNative` instead. [moby/moby#50030](https://github.com/moby/moby/pull/50030) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_28.2.1.md b/corpus/changelog/docker_engine_releases/docker_engine_28.2.1.md new file mode 100644 index 0000000000000000000000000000000000000000..20485b3039f879f5f65772467623877790b809e0 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_28.2.1.md @@ -0,0 +1,11 @@ +# Docker Engine 28.2.1 release notes + +Source: https://docs.docker.com/engine/release-notes/28/ + +## [28.2.1](#2821) + +*2025-05-29* + +### [Packaging updates](#packaging-updates-7) + +* Fix packaging regression in [v28.2.0](https://github.com/moby/moby/releases/tag/v28.2.0) which broke creating the `docker` group/user on fresh installations. [docker-ce-packaging#1209](https://github.com/docker/docker-ce-packaging/issues/1209) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_28.2.2.md b/corpus/changelog/docker_engine_releases/docker_engine_28.2.2.md new file mode 100644 index 0000000000000000000000000000000000000000..1af71e4366074868130c0c82e855c61f70c84221 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_28.2.2.md @@ -0,0 +1,20 @@ +# Docker Engine 28.2.2 release notes + +Source: https://docs.docker.com/engine/release-notes/28/ + +## [28.2.2](#2822) + +*2025-05-30* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 28.2.2 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A28.2.2) +* [moby/moby, 28.2.2 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A28.2.2) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-6) + +* containerd image store: Fix a regression causing `docker build --push` to fail. This reverts [the fix](https://github.com/moby/moby/pull/49702) for `docker build` not persisting overridden images as dangling. [moby/moby#50105](https://github.com/moby/moby/pull/50105) + +### [Networking](#networking-3) + +* When creating the iptables `DOCKER-USER` chain, do not add an explicit `RETURN` rule, allowing users to append as well as insert their own rules. Existing rules are not removed on upgrade, but it won't be replaced after a reboot. [moby/moby#50098](https://github.com/moby/moby/pull/50098) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_28.3.0.md b/corpus/changelog/docker_engine_releases/docker_engine_28.3.0.md new file mode 100644 index 0000000000000000000000000000000000000000..40d2bb03cb15b118b1d11c73ed2b98368605a529 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_28.3.0.md @@ -0,0 +1,64 @@ +# Docker Engine 28.3.0 release notes + +Source: https://docs.docker.com/engine/release-notes/28/ + +## [28.3.0](#2830) + +*2025-06-24* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 28.3.0 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A28.3.0) +* [moby/moby, 28.3.0 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A28.3.0) + +### [New](#new-1) + +* Add support for AMD GPUs in `docker run --gpus`. [moby/moby#49952](https://github.com/moby/moby/pull/49952) +* Use `DOCKER_AUTH_CONFIG` as a credential store. [docker/cli#6008](https://github.com/docker/cli/pull/6008) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-5) + +* Ensure that the state of the container in the daemon database (used by [/containers/json](https://docs.docker.com/reference/api/engine/version/v1.49/#tag/Container/operation/ContainerList) API) is up to date when the container is stopped using the [/containers/{id}/stop](https://docs.docker.com/reference/api/engine/version/v1.49/#tag/Container/operation/ContainerStop) API (before response of API). [moby/moby#50136](https://github.com/moby/moby/pull/50136) +* Fix `docker image inspect inspect` omitting empty fields. [moby/moby#50135](https://github.com/moby/moby/pull/50135) +* Fix `docker images --tree` not marking images as in-use when the containerd image store is disabled. [docker/cli#6140](https://github.com/docker/cli/pull/6140) +* Fix `docker pull/push` hang in non-interactive when authentication is required caused by prompting for login credentials. [docker/cli#6141](https://github.com/docker/cli/pull/6141) +* Fix a potential resource leak when a node leaves a Swarm. [moby/moby#50115](https://github.com/moby/moby/pull/50115) +* Fix a regression where a login prompt on `docker pull` would show Docker Hub-specific hints when logging in on other registries. [docker/cli#6135](https://github.com/docker/cli/pull/6135) +* Fix an issue where all new tasks in the Swarm could get stuck in the PENDING state forever after scaling up a service with placement preferences. [moby/moby#50211](https://github.com/moby/moby/pull/50211) +* Remove an undocumented, hidden, top-level `docker remove` command that was accidentally introduced in Docker 23.0. [docker/cli#6144](https://github.com/docker/cli/pull/6144) +* Validate registry-mirrors configuration as part of `dockerd --validate` and improve error messages for invalid mirrors. [moby/moby#50240](https://github.com/moby/moby/pull/50240) +* `dockerd-rootless-setuptool.sh`: Fix the script from silently returning with no error message when subuid/subgid system requirements are not satisfied. [moby/moby#50059](https://github.com/moby/moby/pull/50059) +* containerd image store: Fix `docker push` not creating a tag on the remote repository. [moby/moby#50199](https://github.com/moby/moby/pull/50199) +* containerd image store: Improve handling of errors returned by the token server during `docker pull/push`. [moby/moby#50176](https://github.com/moby/moby/pull/50176) + +### [Packaging updates](#packaging-updates-6) + +* Allow customizing containerd service name for OpenRC. [moby/moby#50156](https://github.com/moby/moby/pull/50156) +* Update BuildKit to [v0.23.1](https://github.com/moby/buildkit/releases/tag/v0.23.1). [moby/moby#50243](https://github.com/moby/moby/pull/50243) +* Update Buildx to [v0.25.0](https://github.com/docker/buildx/releases/tag/v0.25.0). [docker/docker-ce-packaging#1217](https://github.com/docker/docker-ce-packaging/pull/1217) +* Update Compose to [v2.37.2](https://github.com/docker/compose/releases/tag/v2.37.2). [docker/docker-ce-packaging#1219](https://github.com/docker/docker-ce-packaging/pull/1219) +* Update Docker Model CLI plugin to [v0.1.30](https://github.com/docker/model-cli/releases/tag/v0.1.30). [docker/docker-ce-packaging#1218](https://github.com/docker/docker-ce-packaging/pull/1218) +* Update Go runtime to [1.24.4](https://go.dev/doc/devel/release#go1.24.4). [docker/docker-ce-packaging#1213](https://github.com/docker/docker-ce-packaging/pull/1213), [moby/moby#50153](https://github.com/moby/moby/pull/50153), [docker/cli#6124](https://github.com/docker/cli/pull/6124) + +### [Networking](#networking-2) + +* Revert Swarm related changes added in 28.2.x builds, due to a regression reported in . [moby/moby#50169](https://github.com/moby/moby/pull/50169) + + Revert: Fix an issue where `docker network inspect --verbose` could sometimes crash the daemon ([https://github.com/moby/moby/pull/49937)](https://github.com/moby/moby/pull/49937%29). + + Revert: Fix an issue where the load-balancer IP address for an overlay network would not be released in certain cases if the Swarm was lacking an ingress network ([https://github.com/moby/moby/pull/49948)](https://github.com/moby/moby/pull/49948%29). + + Revert: Improve the reliability of NetworkDB in busy clusters and lossy networks ([https://github.com/moby/moby/pull/49932)](https://github.com/moby/moby/pull/49932%29). + + Revert: Improvements to the reliability and convergence speed of NetworkDB ([https://github.com/moby/moby/pull/49939)](https://github.com/moby/moby/pull/49939%29). +* Fix an issue that could cause container startup to fail, or lead to failed UDP port mappings, when some container ports are mapped to `0.0.0.0` and others are mapped to specific host addresses. [moby/moby#50054](https://github.com/moby/moby/pull/50054) +* The `network inspect` response for an overlay network now reports that `EnableIPv4` is true. [moby/moby#50147](https://github.com/moby/moby/pull/50147) +* Windows: Improve daemon startup time in cases where the host has networks of type `"Mirrored"`. [moby/moby#50155](https://github.com/moby/moby/pull/50155) +* Windows: Make sure `docker system prune` and `docker network prune` only remove networks created by Docker. [moby/moby#50154](https://github.com/moby/moby/pull/50154) + +### [API](#api-2) + +* Update API version to 1.51. [moby/moby#50145](https://github.com/moby/moby/pull/50145) +* `GET /images/json` now sets the value of the `Containers` field for all images to the count of containers using the image. [moby/moby#50146](https://github.com/moby/moby/pull/50146) + +### [Deprecations](#deprecations-4) + +* Empty/nil image config fields in the `GET /images/{name}/json` response are now deprecated and will be removed in v29.0. [docker/cli#6129](https://github.com/docker/cli/pull/6129) +* api/types/container: deprecate `ExecOptions.Detach`. This field is not used, and will be removed in a future release. [moby/moby#50219](https://github.com/moby/moby/pull/50219) +* pkg/idtools: deprecate `IdentityMapping` and `Identity.Chown`. [moby/moby#50210](https://github.com/moby/moby/pull/50210) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_28.3.1.md b/corpus/changelog/docker_engine_releases/docker_engine_28.3.1.md new file mode 100644 index 0000000000000000000000000000000000000000..8a52e35b633fafcc9a843515d0580f9e8c111f08 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_28.3.1.md @@ -0,0 +1,18 @@ +# Docker Engine 28.3.1 release notes + +Source: https://docs.docker.com/engine/release-notes/28/ + +## [28.3.1](#2831) + +*2025-07-02* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 28.3.1 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A28.3.1) +* [moby/moby, 28.3.1 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A28.3.1) + +### [Packaging updates](#packaging-updates-5) + +* Update BuildKit to [v0.23.2](https://github.com/moby/buildkit/releases/tag/v0.23.2). [moby/moby#50309](https://github.com/moby/moby/pull/50309) +* Update Compose to [v2.38.1](https://github.com/docker/compose/releases/tag/v2.38.1). [docker/docker-ce-packaging#1221](https://github.com/docker/docker-ce-packaging/pull/1221) +* Update Model to v0.1.32 which adds the support for the new top-level `models:` key in Docker Compose. [docker/docker-ce-packaging#1222](https://github.com/docker/docker-ce-packaging/pull/1222) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_28.3.2.md b/corpus/changelog/docker_engine_releases/docker_engine_28.3.2.md new file mode 100644 index 0000000000000000000000000000000000000000..686cf4d3d28c78b0bffa123c854ea9981bb7210c --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_28.3.2.md @@ -0,0 +1,25 @@ +# Docker Engine 28.3.2 release notes + +Source: https://docs.docker.com/engine/release-notes/28/ + +## [28.3.2](#2832) + +*2025-07-09* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 28.3.2 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A28.3.2) +* [moby/moby, 28.3.2 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A28.3.2) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-4) + +* Fix `--use-api-socket` not working correctly when targeting a remote daemon. [docker/cli#6157](https://github.com/docker/cli/pull/6157) +* Fix stray "otel error" logs being printed if debug logging is enabled. [docker/cli#6160](https://github.com/docker/cli/pull/6160) +* Quote SSH arguments when connecting to a remote daemon over an SSH connection to avoid unexpected expansion. [docker/cli#6147](https://github.com/docker/cli/pull/6147) +* Warn when `DOCKER_AUTH_CONFIG` is set during `docker login` and `docker logout`. [docker/cli#6163](https://github.com/docker/cli/pull/6163) + +### [Packaging updates](#packaging-updates-4) + +* Update Compose to [v2.38.2](https://github.com/docker/compose/releases/tag/v2.38.2). [docker/docker-ce-packaging#1225](https://github.com/docker/docker-ce-packaging/pull/1225) +* Update Docker Model CLI plugin to [v0.1.33](https://github.com/docker/model-cli/releases/tag/v0.1.33). [docker/docker-ce-packaging#1227](https://github.com/docker/docker-ce-packaging/pull/1227) +* Update Go runtime to 1.24.5. [moby/moby#50354](https://github.com/moby/moby/pull/50354) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_28.3.3.md b/corpus/changelog/docker_engine_releases/docker_engine_28.3.3.md new file mode 100644 index 0000000000000000000000000000000000000000..b17e4e8b26a4fa394798c3090928b3d2acc17c48 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_28.3.3.md @@ -0,0 +1,22 @@ +# Docker Engine 28.3.3 release notes + +Source: https://docs.docker.com/engine/release-notes/28/ + +## [28.3.3](#2833) + +*2025-07-29* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 28.3.3 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A28.3.3) +* [moby/moby, 28.3.3 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A28.3.3) + +### [Security](#security) + +This release fixes an issue where, after a firewalld reload, published container ports could be accessed directly from the local network, even when they were intended to be accessible only via a loopback address. [CVE-2025-54388](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-54388) / [GHSA-x4rx-4gw3-53p4](https://github.com/moby/moby/security/advisories/GHSA-x4rx-4gw3-53p4) / [moby/moby#50506](https://github.com/moby/moby/pull/50506). + +### [Packaging updates](#packaging-updates-3) + +* Update Buildx to [v0.26.1](https://github.com/docker/buildx/releases/tag/v0.26.1). [docker/docker-ce-packaging#1230](https://github.com/docker/docker-ce-packaging/pull/1230) +* Update Compose to [v2.39.1](https://github.com/docker/compose/releases/tag/v2.39.1). [docker/docker-ce-packaging#1234](https://github.com/docker/docker-ce-packaging/pull/1234) +* Update Docker Model CLI plugin to [v0.1.36](https://github.com/docker/model-cli/releases/tag/v0.1.36). [docker/docker-ce-packaging#1233](https://github.com/docker/docker-ce-packaging/pull/1233) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_28.4.0.md b/corpus/changelog/docker_engine_releases/docker_engine_28.4.0.md new file mode 100644 index 0000000000000000000000000000000000000000..870a0b53371d65dc28277e564583eb76b6d9199e --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_28.4.0.md @@ -0,0 +1,117 @@ +# Docker Engine 28.4.0 release notes + +Source: https://docs.docker.com/engine/release-notes/28/ + +## [28.4.0](#2840) + +*2025-09-03* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 28.4.0 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A28.4.0) +* [moby/moby, 28.4.0 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A28.4.0) + +### [New](#new) + +* Allow Docker CLI to set the `GODEBUG` environment variable when the key-value pair (`"GODEBUG":"..."`) exists inside the docker context metadata. [docker/cli#6399](https://github.com/docker/cli/pull/6399) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-3) + +* Add shell completion for `docker pull` and `docker image pull`. [docker/cli#6420](https://github.com/docker/cli/pull/6420) +* Fix a regression in v28.3.3 that could cause a panic on `docker push` if the client did not send an `X-Registry-Auth` header. [moby/moby#50738](https://github.com/moby/moby/pull/50738) +* Windows: Potentially fix an issue with "access denied" error when pulling images. [moby/moby#50871](https://github.com/moby/moby/pull/50871) +* containerd image store: Fix `docker history` failing with `snapshot X does not exist` when calling on a non-native image that was built locally. [moby/moby#50875](https://github.com/moby/moby/pull/50875) +* containerd image store: Fix `docker image prune` to emit correct `untag` and `delete` events and list only the deleted images root digests instead of every blob. [moby/moby#50837](https://github.com/moby/moby/pull/50837) +* Remove interactive login prompt from `docker push` and `docker pull` after a failure caused by missing authentication. [docker/cli#6256](https://github.com/docker/cli/pull/6256) + +### [Packaging updates](#packaging-updates-2) + +* Update BuildKit to [v0.24.0](https://github.com/moby/buildkit/releases/tag/v0.24.0). [moby#50888](https://github.com/moby/moby/pull/50888) +* Update Go runtime to [1.24.7](https://go.dev/doc/devel/release#go1.24.6). [moby/moby#50889](https://github.com/moby/moby/pull/50889), [docker/cli#6422](https://github.com/docker/cli/pull/6422) +* Update `runc` to [v1.3.0](https://github.com/opencontainers/runc/releases/tag/v1.3.0). [moby/moby#50699](https://github.com/moby/moby/pull/50699) +* Update containerd (static binaries only) to [v1.7.28](https://github.com/containerd/containerd/releases/tag/v1.7.28). [moby/moby#50700](https://github.com/moby/moby/pull/50700) + +### [Networking](#networking-1) + +* Fix an issue that could cause slow container restart on live-restore. [moby/moby#50829](https://github.com/moby/moby/pull/50829) + +### [API](#api-1) + +* Update deprecation message for `AuthConfig.Email` field. [moby/moby#50797](https://github.com/moby/moby/pull/50797) + +### [Go SDK](#go-sdk-1) + +* Deprecate profiles package which got migrated to [github.com/moby/profiles](https://github.com/moby/profiles). [moby/moby#50513](https://github.com/moby/moby/pull/50513) + +### [Deprecations](#deprecations-3) + +* Deprecate special handling for quoted values for the `--tlscacert`, `--tlscert`, and `--tlskey` command-line flags. [docker/cli#6291](https://github.com/docker/cli/pull/6291) +* Mark legacy links environment variables (`DOCKER_KEEP_DEPRECATED_LEGACY_LINKS_ENV_VARS`) as deprecated in v28.4 and set for removal in v30.0. [docker/cli#6309](https://github.com/docker/cli/pull/6309) +* Go-SDK: Deprecate field `NetworkSettingsBase.Bridge`, struct `NetworkSettingsBase`, all the fields of `DefaultNetworkSettings`, and struct `DefaultNetworkSettings`. [moby/moby#50839](https://github.com/moby/moby/pull/50839) +* Go-SDK: api/types: `build.CacheDiskUsage`, `container.DiskUsage`, `images.DiskUsage` and `volumes.DiskUsage` are now deprecated and will be removed in the next major release. [moby/moby#50768](https://github.com/moby/moby/pull/50768) +* Go-SDK: cli-plugins/manager: deprecate `ReexecEnvvar`. [docker/cli#6411](https://github.com/docker/cli/pull/6411) +* Go-SDK: cli-plugins/manager: deprecate annotation aliases (`CommandAnnotationPlugin`, `CommandAnnotationPluginVendor`, `CommandAnnotationPluginVersion`, `CommandAnnotationPluginInvalid`, `CommandAnnotationPluginCommandPath`) in favor of their equivalent in `cli-plugins/manager/metadata`. [docker/cli#6298](https://github.com/docker/cli/pull/6298) +* Go-SDK: cli-plugins/manager: deprecate metadata aliases (`NamePrefix`, `MetadataSubcommandName`, `HookSubcommandName`, `Metadata`, `ReexecEnvvar`) in favor of their equivalent in `cli-plugins/manager/metadata`. [docker/cli#6269](https://github.com/docker/cli/pull/6269) +* Go-SDK: cli-plugins/manager: remove `Candidate` interface, which was only for internal use. [docker/cli#6269](https://github.com/docker/cli/pull/6269) +* Go-SDK: cli-plugins/manager: remove `NewPluginError` function, which was only for internal use. [docker/cli#6269](https://github.com/docker/cli/pull/6269) +* Go-SDK: cli-plugins/manager: remove deprecated `ResourceAttributesEnvvar` const. [docker/cli#6269](https://github.com/docker/cli/pull/6269) +* Go-SDK: cli/command/builder: deprecate `NewBuilderCommand` and `NewBakeStubCommand`. These functions will be removed in the next release. [docker/cli#6312](https://github.com/docker/cli/pull/6312) +* Go-SDK: cli/command/builder: deprecate `NewPruneCommand`. [docker/cli#6343](https://github.com/docker/cli/pull/6343) +* Go-SDK: cli/command/checkpoint: deprecate `NewCheckpointCommand`. This function will be removed in the next release. [docker/cli#6312](https://github.com/docker/cli/pull/6312) +* Go-SDK: cli/command/checkpoint: deprecate `NewFormat`, `FormatWrite`. [docker/cli#6341](https://github.com/docker/cli/pull/6341) +* Go-SDK: cli/command/completion: deprecate `NoComplete`. [docker/cli#6405](https://github.com/docker/cli/pull/6405) +* Go-SDK: cli/command/completion: remove deprecated `ValidArgsFn`. [docker/cli#6259](https://github.com/docker/cli/pull/6259) +* Go-SDK: cli/command/config: deprecate `NewConfigCommand`. This function will be removed in the next release. [docker/cli#6312](https://github.com/docker/cli/pull/6312) +* Go-SDK: cli/command/config: deprecate `NewFormat`, `FormatWrite`, `InspectFormatWrite`. [docker/cli#6341](https://github.com/docker/cli/pull/6341) +* Go-SDK: cli/command/config: deprecate `RunConfigCreate`, `CreateOptions`, `RunConfigInspect`, `InspectOptions`, `RunConfigList`, `ListOptions`, `RunConfigRemove`, and `RemoveOptions`. [docker/cli#6369](https://github.com/docker/cli/pull/6369) +* Go-SDK: cli/command/container: deprecate `NewBuildCommand`, `NewPullCommand`, `NewPushCommand`, `NewImagesCommand`, `NewImageCommand`, `NewHistoryCommand`, `NewImportCommand`, `NewLoadCommand`, `NewRemoveCommand`, `NewSaveCommand`, `NewTagCommand`, `NewPruneCommand`. These functions will be removed in the next release. [docker/cli#6312](https://github.com/docker/cli/pull/6312) +* Go-SDK: cli/command/container: deprecate `NewDiffFormat`, `DiffFormatWrite`. These functions were only used internally and will be removed in the next release. [docker/cli#6341](https://github.com/docker/cli/pull/6341) +* Go-SDK: cli/command/container: deprecate `NewRunCommand`, `NewExecCommand`, `NewPsCommand`, `NewContainerCommand`, `NewAttachCommand`, `NewCommitCommand`, `NewCopyCommand`, `NewCreateCommand`, `NewDiffCommand`, `NewExportCommand`, `NewKillCommand`, `NewLogsCommand`, `NewPauseCommand`, `NewPortCommand`, `NewRenameCommand`, `NewRestartCommand`, `NewRmCommand`, `NewStartCommand`, `NewStatsCommand`, `NewStopCommand`, `NewTopCommand`, `NewUnpauseCommand`, `NewUpdateCommand`, `NewWaitCommand`, `NewPruneCommand`. These functions will be removed in the next release. [docker/cli#6312](https://github.com/docker/cli/pull/6312) +* Go-SDK: cli/command/context: deprecate `NewContextCommand`. This function will be removed in the next release. [docker/cli#6312](https://github.com/docker/cli/pull/6312) +* Go-SDK: cli/command/context: deprecate `RunCreate` and `CreateOptions`. [docker/cli#6403](https://github.com/docker/cli/pull/6403) +* Go-SDK: cli/command/context: deprecate `RunExport` and `ExportOptions`. [docker/cli#6403](https://github.com/docker/cli/pull/6403) +* Go-SDK: cli/command/context: deprecate `RunImport`. [docker/cli#6403](https://github.com/docker/cli/pull/6403) +* Go-SDK: cli/command/context: deprecate `RunRemove` and `RemoveOptions`. [docker/cli#6403](https://github.com/docker/cli/pull/6403) +* Go-SDK: cli/command/context: deprecate `RunUpdate` and `UpdateOptions`. [docker/cli#6403](https://github.com/docker/cli/pull/6403) +* Go-SDK: cli/command/context: deprecate `RunUse`. [docker/cli#6403](https://github.com/docker/cli/pull/6403) +* Go-SDK: cli/command/image: deprecate `AuthResolver` utility. [docker/cli#6357](https://github.com/docker/cli/pull/6357) +* Go-SDK: cli/command/image: deprecate `NewHistoryFormat`, `HistoryWrite`. [docker/cli#6341](https://github.com/docker/cli/pull/6341), [docker/cli#6341](https://github.com/docker/cli/pull/6341) +* Go-SDK: cli/command/manifest: deprecate `NewManifestCommand`. This functions will be removed in the next release. [docker/cli#6312](https://github.com/docker/cli/pull/6312) +* Go-SDK: cli/command/network: deprecate `NewFormat`, `FormatWrite`. [docker/cli#6341](https://github.com/docker/cli/pull/6341) +* Go-SDK: cli/command/network: deprecate `NewNetworkCommand`. These functions will be removed in the next release. [docker/cli#6312](https://github.com/docker/cli/pull/6312) +* Go-SDK: cli/command/node: deprecate `NewFormat`, `FormatWrite`, `InspectFormatWrite`. [docker/cli#6341](https://github.com/docker/cli/pull/6341) +* Go-SDK: cli/command/node: deprecate `NewNodeCommand`. This functions will be removed in the next release. [docker/cli#6312](https://github.com/docker/cli/pull/6312) +* Go-SDK: cli/command/plugin: deprecate `NewFormat`, `FormatWrite`. [docker/cli#6341](https://github.com/docker/cli/pull/6341) +* Go-SDK: cli/command/plugin: deprecate `NewPluginCommand`. This function will be removed in the next release. [docker/cli#6312](https://github.com/docker/cli/pull/6312) +* Go-SDK: cli/command/registry: deprecate `NewLoginCommand`, `NewLogoutCommand`, `NewSearchCommand`. These functions will be removed in the next release. [docker/cli#6312](https://github.com/docker/cli/pull/6312) +* Go-SDK: cli/command/registry: deprecate `NewSearchFormat`, `SearchWrite`. [docker/cli#6341](https://github.com/docker/cli/pull/6341) +* Go-SDK: cli/command/registry: deprecate `OauthLoginEscapeHatchEnvVar` const. [docker/cli#6413](https://github.com/docker/cli/pull/6413) +* Go-SDK: cli/command/secret: deprecate `NewFormat`, `FormatWrite`, `InspectFormatWrite`. [docker/cli#6341](https://github.com/docker/cli/pull/6341) +* Go-SDK: cli/command/secret: deprecate `NewSecretCommand`. This functions will be removed in the next release. [docker/cli#6312](https://github.com/docker/cli/pull/6312) +* Go-SDK: cli/command/service: deprecate `NewFormat`, `InspectFormatWrite`. [docker/cli#6341](https://github.com/docker/cli/pull/6341) +* Go-SDK: cli/command/service: deprecate `NewServiceCommand`. This function will be removed in the next release. [docker/cli#6312](https://github.com/docker/cli/pull/6312) +* Go-SDK: cli/command/stack: deprecate `NewStackCommand`. This function will be removed in the next release. [docker/cli#6312](https://github.com/docker/cli/pull/6312) +* Go-SDK: cli/command/stack: deprecate `RunList`, `RunServices`. [docker/cli#6391](https://github.com/docker/cli/pull/6391) +* Go-SDK: cli/command/swarm: deprecate `NewSwarmCommand`. This function will be removed in the next release. [docker/cli#6312](https://github.com/docker/cli/pull/6312) +* Go-SDK: cli/command/system: deprecate `NewVersionCommand`, `NewInfoCommand`, `NewSystemCommand`, `NewEventsCommand`, `NewInspectCommand`. These functions will be removed in the next release. [docker/cli#6312](https://github.com/docker/cli/pull/6312) +* Go-SDK: cli/command/task: deprecate `NewTaskFormat`, `FormatWrite`. [docker/cli#6341](https://github.com/docker/cli/pull/6341) +* Go-SDK: cli/command/trust: deprecate `NewTrustCommand`. This function will be removed in the next release. [docker/cli#6312](https://github.com/docker/cli/pull/6312) +* Go-SDK: cli/command/trust: deprecate `SignedTagInfo`, `SignerInfo`, `NewTrustTagFormat`, `NewSignerInfoFormat`, `TagWrite`, `SignerInfoWrite`. [docker/cli#6341](https://github.com/docker/cli/pull/6341) +* Go-SDK: cli/command/volume: deprecate `NewVolumeCommand`, `NewPruneCommand`. These functions will be removed in the next release. [docker/cli#6312](https://github.com/docker/cli/pull/6312) +* Go-SDK: cli/command: remove `AddTrustSigningFlags`, `AddTrustVerificationFlags`, and `AddPlatformFlag` utilities, which were only used internally. [docker/cli#6311](https://github.com/docker/cli/pull/6311) +* Go-SDK: cli/command: remove deprecated `ConfigureAuth` utility. [docker/cli#6257](https://github.com/docker/cli/pull/6257) +* Go-SDK: cli/command: remove deprecated `CopyToFile` utility. [docker/cli#6257](https://github.com/docker/cli/pull/6257) +* Go-SDK: cli/config/types: update deprecation message for `AuthConfig.Email` field. [docker/cli#6392](https://github.com/docker/cli/pull/6392) +* Go-SDK: cli: deprecate `VisitAll`, `DisableFlagsInUseLine` utilities. These utilities were only used internally and will be removed in the next release. [docker/cli#6276](https://github.com/docker/cli/pull/6276) +* Go-SDK: cli: remove `HasCompletionArg` utility. This utility was only used internally. [docker/cli#6276](https://github.com/docker/cli/pull/6276) +* Go-SDK: deprecate `cli/command.RegistryAuthenticationPrivilegedFunc`. [docker/cli#6256](https://github.com/docker/cli/pull/6256) +* Go-SDK: deprecate cli/command/stack/formatter. [docker/cli#6391](https://github.com/docker/cli/pull/6391) +* Go-SDK: deprecate cli/command/stack/loader. [docker/cli#6391](https://github.com/docker/cli/pull/6391) +* Go-SDK: deprecate cli/command/stack/options. [docker/cli#6391](https://github.com/docker/cli/pull/6391) +* Go-SDK: deprecate cli/command/stack/swarm. [docker/cli#6391](https://github.com/docker/cli/pull/6391) +* Go-SDK: opts: deprecate `NewNamedListOptsRef`, `NewNamedMapOpts`, `NamedListOpts`, `NamedMapOpts`, and `NamedOption`. These types and functions are no longer used and will be removed in the next release. [docker/cli#6292](https://github.com/docker/cli/pull/6292) +* Go-SDK: opts: deprecate `ParseEnvFile` in favor of `kvfile.Parse`. [docker/cli#6381](https://github.com/docker/cli/pull/6381) +* Go-SDK: opts: deprecate `QuotedString`. This utility is no longer used, and will be removed in the next release. [docker/cli#6275](https://github.com/docker/cli/pull/6275) +* Go-SDK: opts: deprecate `ValidateHost` utility. This function is no longer used, and will be removed in the next release. [docker/cli#6280](https://github.com/docker/cli/pull/6280) +* Go-SDK: pkg/jsonmessage: deprecate the `JSONMessage.From`, `JSONMessage.Time`, and `JSONMessage.TimeNano` fields, as they are no longer returned by the API for progress messages. Use the `events.Message` type instead to unmarshal the `/events` response. [moby/moby#50762](https://github.com/moby/moby/pull/50762) +* Go-SDK: the cli/registry/client package is deprecated and will be removed in the next release. [docker/cli#6313](https://github.com/docker/cli/pull/6313) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_28.5.0.md b/corpus/changelog/docker_engine_releases/docker_engine_28.5.0.md new file mode 100644 index 0000000000000000000000000000000000000000..e7ddb5ef92e1a4165d128727e96d1e9133d0e62b --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_28.5.0.md @@ -0,0 +1,65 @@ +# Docker Engine 28.5.0 release notes + +Source: https://docs.docker.com/engine/release-notes/28/ + +## [28.5.0](#2850) + +*2025-10-02* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 28.5.0 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A28.5.0) +* [moby/moby, 28.5.0 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A28.5.0) + +> Warning +> +> **Raspberry Pi OS 32-bit (armhf) Deprecation** +> +> Docker Engine v28 will be the last major version to support Raspberry Pi OS 32-bit (armhf). +> Starting with Docker Engine v29, new major versions will **no longer provide packages** for Raspberry Pi OS 32-bit (armhf). +> +> #### [Migration options](#migration-options) +> +> * **64-bit ARM:** Install the Debian `arm64` packages (fully supported). +> * **32-bit ARM (v7):** Install the Debian `armhf` packages (targets ARMv7 CPUs). +> +> **Note:** Older devices based on the ARMv6 architecture are no longer supported by official packages, including: +> +> * Raspberry Pi 1 (Model A/B/A+/B+) +> * Raspberry Pi Zero and Zero W + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-2) + +* Don't print warnings in `docker info` for broken symlinks in CLI-plugin directories. [docker/cli#6476](https://github.com/docker/cli/pull/6476) +* Fix a panic during `stats` on empty event `Actor.ID`. [docker/cli#6471](https://github.com/docker/cli/pull/6471) + +### [Packaging updates](#packaging-updates-1) + +* Remove support for legacy CBC cipher suites. [docker/cli#6474](https://github.com/docker/cli/pull/6474) +* Update Buildkit to [v0.25.0](https://github.com/moby/buildkit/releases/tag/v0.25.0). [moby/moby#51075](https://github.com/moby/moby/pull/51075) +* Update Dockerfile syntax to [v1.19.0](https://github.com/moby/buildkit/releases/tag/dockerfile%2F1.19.0). [moby/moby#51075](https://github.com/moby/moby/pull/51075) + +### [Networking](#networking) + +* Eliminated harmless warning about deletion of `endpoint_count` from the data store. [moby/moby#51064](https://github.com/moby/moby/pull/51064) +* Fix a bug causing IPAM plugins to not be loaded on Windows. [moby/moby#51035](https://github.com/moby/moby/pull/51035) + +### [API](#api) + +* Deprecate support for kernel memory TCP accounting (`KernelMemoryTCP`). [moby/moby#51067](https://github.com/moby/moby/pull/51067) +* Fix `GET containers/{name}/checkpoints` returning `null` instead of empty JSON array when there are no checkpoints. [moby/moby#51052](https://github.com/moby/moby/pull/51052) + +### [Go SDK](#go-sdk) + +* cli-plugins/plugin: Run: allow customizing the CLI. [docker/cli#6481](https://github.com/docker/cli/pull/6481) +* cli/command: add `WithUserAgent` option. [docker/cli#6477](https://github.com/docker/cli/pull/6477) + +### [Deprecations](#deprecations-2) + +* Go-SDK: cli/command: deprecate `DockerCli.Apply`. This method is no longer used and will be removed in the next release if there are no remaining uses. [docker/cli#6497](https://github.com/docker/cli/pull/6497) +* Go-SDK: cli/command: deprecate `DockerCli.ContentTrustEnabled`. This method is no longer used and will be removed in the next release. [docker/cli#6495](https://github.com/docker/cli/pull/6495) +* Go-SDK: cli/command: deprecate `DockerCli.DefaultVersion`. This method is no longer used and will be removed in the next release. [docker/cli#6491](https://github.com/docker/cli/pull/6491) +* Go-SDK: cli/command: deprecate `ResolveDefaultContext` utility. [docker/cli#6529](https://github.com/docker/cli/pull/6529) +* Go-SDK: cli/command: deprecate `WithContentTrustFromEnv`, `WithContentTrust` options. These options were used internally, and will be removed in the next release.. [docker/cli#6489](https://github.com/docker/cli/pull/6489) +* Go-SDK: cli/manifest/store: deprecate `IsNotFound()`. [docker/cli#6514](https://github.com/docker/cli/pull/6514) +* Go-SDK: templates: deprecate NewParse() function. [docker/cli#6469](https://github.com/docker/cli/pull/6469) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_28.5.1.md b/corpus/changelog/docker_engine_releases/docker_engine_28.5.1.md new file mode 100644 index 0000000000000000000000000000000000000000..b5943637d5376445fdc36d52d17662c0ee747171 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_28.5.1.md @@ -0,0 +1,22 @@ +# Docker Engine 28.5.1 release notes + +Source: https://docs.docker.com/engine/release-notes/28/ + +## [28.5.1](#2851) + +*2025-10-08* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 28.5.1 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A28.5.1) +* [moby/moby, 28.5.1 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A28.5.1) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-1) + +* Update BuildKit to v0.25.1. [moby/moby#51137](https://github.com/moby/moby/pull/51137) +* Update Go runtime to [1.24.8](https://go.dev/doc/devel/release#go1.24.8). [moby/moby#51133](https://github.com/moby/moby/pull/51133), [docker/cli#6541](https://github.com/docker/cli/pull/6541) + +### [Deprecations](#deprecations-1) + +* api/types/image: InspectResponse: deprecate `Parent` and `DockerVersion` fields. [moby/moby#51105](https://github.com/moby/moby/pull/51105) +* api/types/plugin: deprecate `Config.DockerVersion` field. [moby/moby#51110](https://github.com/moby/moby/pull/51110) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_28.5.2.md b/corpus/changelog/docker_engine_releases/docker_engine_28.5.2.md new file mode 100644 index 0000000000000000000000000000000000000000..8bb02302002a76c8f82b3700756c4e58a73136cc --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_28.5.2.md @@ -0,0 +1,39 @@ +# Docker Engine 28.5.2 release notes + +Source: https://docs.docker.com/engine/release-notes/28/ + +## [28.5.2](#2852) + +*2025-11-05* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 28.5.2 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A28.5.2) +* [moby/moby, 28.5.2 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A28.5.2) + +> Caution +> +> This release contains fixes for three high-severity security vulnerabilities in runc: +> +> * [CVE-2025-31133](https://github.com/opencontainers/runc/security/advisories/GHSA-9493-h29p-rfm2) +> * [CVE-2025-52565](https://github.com/opencontainers/runc/security/advisories/GHSA-qw9x-cqr3-wc7r) +> * [CVE-2025-52881](https://github.com/opencontainers/runc/security/advisories/GHSA-cgrx-mc8f-2prm) +> +> All three vulnerabilities ultimately allow (through different methods) for full container breakouts by bypassing runc's restrictions for writing to arbitrary `/proc` files. + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements) + +* dockerd-rootless.sh: if slirp4netns is not installed, try using pasta (passt). [moby/moby#51162](https://github.com/moby/moby/pull/51162) + +### [Packaging updates](#packaging-updates) + +* Update BuildKit to [v0.25.2](https://github.com/moby/buildkit/releases/tag/v0.25.2). [moby/moby#51398](https://github.com/moby/moby/pull/51398) +* Update Go runtime to [1.24.9](https://go.dev/doc/devel/release#go1.24.9). [moby/moby#51387](https://github.com/moby/moby/pull/51387), [docker/cli#6613](https://github.com/docker/cli/pull/6613) +* Update runc to [v1.3.3](https://github.com/opencontainers/runc/releases/tag/v1.3.3). [moby/moby#51394](https://github.com/moby/moby/pull/51394) + +### [Deprecations](#deprecations) + +* Go-SDK: cli/command/image/build: deprecate `DefaultDockerfileName`, `DetectArchiveReader`, `WriteTempDockerfile`, `ResolveAndValidateContextPath`. These utilities were only used internally and will be removed in the next release. [docker/cli#6610](https://github.com/docker/cli/pull/6610) +* Go-SDK: cli/command/image/build: deprecate IsArchive utility. [docker/cli#6560](https://github.com/docker/cli/pull/6560) +* Go-SDK: opts: deprecate `ValidateMACAddress`. [docker/cli#6560](https://github.com/docker/cli/pull/6560) +* Go-SDK: opts: deprecate ListOpts.Delete(). [docker/cli#6560](https://github.com/docker/cli/pull/6560) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_29.0.0.md b/corpus/changelog/docker_engine_releases/docker_engine_29.0.0.md new file mode 100644 index 0000000000000000000000000000000000000000..07af8ea040e4e925f87477e20d2578f1ee830349 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_29.0.0.md @@ -0,0 +1,368 @@ +# Docker Engine 29.0.0 release notes + +Source: https://docs.docker.com/engine/release-notes/29/ + +## [29.0.0](#2900) + +*2025-11-10* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 29.0.0 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A29.0.0) +* [moby/moby, 29.0.0 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A29.0.0) + +> Caution +> +> This release includes several breaking changes and deprecations. Review the release notes carefully before upgrading. + +* Experimental support for nftables can now be enabled by setting Docker daemon's `firewall-backend` option to `nftables`. For more information, see [Docker Engine docs](https://docs.docker.com/engine/network/firewall-nftables/). +* containerd image store is now the default for **fresh installs**. This doesn't apply to daemons configured with `userns-remap` (see [moby#47377](https://github.com/moby/moby/issues/47377)). + +### [Breaking Changes](#breaking-changes) + +* The Go module `github.com/docker/docker` is deprecated in favor of `github.com/moby/moby/client` and `github.com/moby/moby/api`. The `github.com/moby/moby` module is considered an **internal implementation detail** - the only supported public modules are `client` and `api`. + Starting with v29, releases are tagged with the `docker-` prefix (e.g., `docker-v29.0.0`). **This only affects Go module users and package maintainers.** +* The daemon now requires API version `v1.44` or later (Docker v25.0+). +* Debian armhf (32-bit) packages now target ARMv7 CPUs and will not work on ARMv6 devices. +* Official Raspbian (32-bit) packages are no longer provided. Use Debian arm64 packages for 64-bit devices, or Debian armhf packages for 32-bit ARMv7 devices. +* **cgroup v1 is deprecated.** Support continues until at least May 2029, but migrate to cgroup v2 as soon as possible. See [moby#51111](https://github.com/moby/moby/issues/51111). +* Docker Content Trust was removed from the Docker CLI. Can be built as a separate plugin: + +--- + +### [New](#new) + +* `docker image load` and `docker image save` now supports multiple platform selection via `--platform` flag (e.g., `docker image load --platform linux/amd64,linux/arm64 -i image.tar`). [docker/cli#6126](https://github.com/docker/cli/pull/6126) +* `docker image ls` now uses the new view (like `--tree` but collapsed) by default. [docker/cli#6566](https://github.com/docker/cli/pull/6566) +* `docker run --runtime <...>` is now supported on Windows. [moby/moby#50546](https://github.com/moby/moby/pull/50546) +* `GET /containers/json` now includes a `Health` field describing container healthcheck status. [moby/moby#50281](https://github.com/moby/moby/pull/50281) +* Add `device` entitlement to builder configuration. [moby/moby#50386](https://github.com/moby/moby/pull/50386) +* Add support for `memory-swap` and `memory-swappiness` flags to `docker service create` and `docker service update` commands. [docker/cli#6619](https://github.com/docker/cli/pull/6619) +* Allow Docker CLI to set the `GODEBUG` environment variable when the key-value pair (`"GODEBUG":"..."`) exists inside the Docker context metadata. [docker/cli#6371](https://github.com/docker/cli/pull/6371) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-4) + +* `docker image ls --tree` now sorts images alphabetically by name instead of by creation date. [docker/cli#6595](https://github.com/docker/cli/pull/6595) +* `docker image ls` no longer shows untagged images by default if no `--all` flag is provided. [docker/cli#6574](https://github.com/docker/cli/pull/6574) +* `docker save`: Fixed inconsistent tar member timestamps when exporting images with the overlay2 storage driver. [moby/moby#51365](https://github.com/moby/moby/pull/51365) +* Add a new log option for fluentd log driver (`fluentd-read-timeout`), which enables specifying read timeouts for reading acks from fluentd connections. [moby/moby#50249](https://github.com/moby/moby/pull/50249) +* Add image name completion for `docker images`. [docker/cli#6452](https://github.com/docker/cli/pull/6452) +* Add shell completion for `docker inspect` if a `--type` is set. [docker/cli#6444](https://github.com/docker/cli/pull/6444) +* Add shell completion for `docker plugin` subcommands. [docker/cli#6445](https://github.com/docker/cli/pull/6445) +* api/types/container: make ContainerState, HealthStatus concrete types. [moby/moby#51439](https://github.com/moby/moby/pull/51439) +* containerd image store is temporarily not available when userns remapping is enabled as a workaround for [moby#47377](https://github.com/moby/moby/issues/47377). [moby/moby#51042](https://github.com/moby/moby/pull/51042) +* contrib: remove contrib/httpserver, which was only used for integration tests. [moby/moby#50654](https://github.com/moby/moby/pull/50654) +* daemon: improve validation of the `--dns` option and corresponding `"dns"` field in `daemon.json`. [moby/moby#50600](https://github.com/moby/moby/pull/50600) +* dockerd-rootless.sh: if slirp4netns is not installed, try using pasta (passt). [moby/moby#51149](https://github.com/moby/moby/pull/51149) +* Fix `--mount type=image` failure when mounting the same image multiple times to a different destinations. [moby/moby#50268](https://github.com/moby/moby/pull/50268) +* Fix `docker stats ` not exiting gracefully. [docker/cli#6582](https://github.com/docker/cli/pull/6582) +* Fix a bug preventing the API server from shutting down quickly when there's an open connection to the `/events` endpoint. [moby/moby#51448](https://github.com/moby/moby/pull/51448) +* Fix a bug where collecting container stats in "one-shot" mode would not include the container's ID and Name. [moby/moby#51302](https://github.com/moby/moby/pull/51302) +* Fix an issue where all new tasks in the Swarm could get stuck in the PENDING state forever after scaling up a service with placement preferences. [moby/moby#50202](https://github.com/moby/moby/pull/50202) +* Fix issue where custom meta-headers were not passed through when using the containerd image store. [moby/moby#51024](https://github.com/moby/moby/pull/51024) +* Fix requests not being logged when running the daemon with `--log-level=trace`. [moby/moby#50986](https://github.com/moby/moby/pull/50986) +* Fix Swarm services becoming unreachable from published ports after a firewalld reload. [moby/moby#50443](https://github.com/moby/moby/pull/50443) +* Improve errors when failing to connect to the API to provide more context to the user. [moby/moby#50285](https://github.com/moby/moby/pull/50285) +* Improve shell completion for `docker secret` and `docker config` subcommands. [docker/cli#6446](https://github.com/docker/cli/pull/6446) +* Prefer explicit device driver name over GPU capabilities when selecting the device driver with `docker run --gpus`. [moby/moby#50717](https://github.com/moby/moby/pull/50717) +* Update runc to [v1.3.3](https://github.com/opencontainers/runc/releases/tag/v1.3.3). [moby/moby#51393](https://github.com/moby/moby/pull/51393) +* Update SwarmKit internal TLS configuration to exclude known insecure cipher suites. [moby/moby#51139](https://github.com/moby/moby/pull/51139) +* Windows: Fix BuildKit creating containers which isolation mode is inconsistent with the daemon's config. [moby/moby#50942](https://github.com/moby/moby/pull/50942) + +### [Packaging updates](#packaging-updates-2) + +* client: remove legacy CBC cipher suites from client config. [moby/moby#50126](https://github.com/moby/moby/pull/50126) +* contrib: remove `editorconfig` as it was unmaintained. [moby/moby#50607](https://github.com/moby/moby/pull/50607) +* contrib: remove Dockerfile syntax highlighting files for `nano` and TextMate (`tmbundle`) as they were unmaintained and outdated. [moby/moby#50606](https://github.com/moby/moby/pull/50606) +* contrib: remove mkimage-xxx scripts as they were unmaintained and not tested. [moby/moby#50297](https://github.com/moby/moby/pull/50297) +* If Docker is downgraded to a version that does not have this support the network will become unusable, it must be deleted and re-created. [moby/moby#50114](https://github.com/moby/moby/pull/50114) +* The Windows overlay network driver now supports option `--dns`. [moby/moby#51229](https://github.com/moby/moby/pull/51229) +* Update BuildKit to [v0.25.2](https://github.com/moby/buildkit/releases/tag/v0.25.2). [moby/moby#51397](https://github.com/moby/moby/pull/51397) +* Update containerd to [v2.1.5](https://github.com/containerd/containerd/releases/tag/v2.1.5). [moby/moby#51409](https://github.com/moby/moby/pull/51409) + + containerd v2.1.5 now uses systemd's default `LimitNOFILE` for containers, + changing the open file descriptor limit (`ulimit -n`) from `1048576` to + `1024`. This extends a change introduced in Docker Engine v25.0 for build + containers to all containers. + + This prevents programs that adjust behavior based on ulimits from consuming + excessive memory when the limit is set to `infinity`. Containers now behave + the same way as programs running on the host. + + If your workload needs a higher limit, use `--ulimit` with `docker run`, or + set defaults in `/etc/docker/daemon.json`: + + ``` + { + "default-ulimits": { + "nofile": { + "Name": "nofile", + "Soft": 1048576, + "Hard": 1048576 + } + } + } + ``` + + For more information, see [moby#51485](https://github.com/moby/moby/issues/51485). +* Update Go runtime to [1.25.4](https://go.dev/doc/devel/release#go1.25.4). [moby/moby#51418](https://github.com/moby/moby/pull/51418), [docker/cli#6632](https://github.com/docker/cli/pull/6632) +* Users can request a specific prefix size for networks allocated from the default pools by using the unspecified address, for example `--subnet 0.0.0.0/24 --subnet ::/96`. [moby/moby#50114](https://github.com/moby/moby/pull/50114) + +### [Networking](#networking-7) + +* Add daemon option `--bridge-accept-fwmark`. Packets with this firewall mark will accepted by bridge networks, overriding Docker's iptables or nftables "drop" rules. [moby/moby#50476](https://github.com/moby/moby/pull/50476) +* api/types/system: deprecated top level `DiskUsage` fields for type specific fields. [moby/moby#51235](https://github.com/moby/moby/pull/51235) +* Ensure bridge devices are removed when bridge network creation fails. [moby/moby#51147](https://github.com/moby/moby/pull/51147) +* Ensure that Windows NAT networks are recreated with their original labels when the Engine restarts. [moby/moby#50447](https://github.com/moby/moby/pull/50447) +* Environment variables set on a container using legacy links are deprecated and aren't added automatically anymore. [moby/moby#50719](https://github.com/moby/moby/pull/50719) + + The daemon can be started with `DOCKER_KEEP_DEPRECATED_LEGACY_LINKS_ENV_VARS=1` to get them back + + Users are encouraged to stop relying on these as they're deprecated, and the escape hatch will be removed in a later version +* Fix a bug in NetworkDB which would sometimes cause entries to get stuck deleted on some of the nodes, leading to connectivity issues between containers on overlay networks. [moby/moby#50342](https://github.com/moby/moby/pull/50342) +* Fix a bug that could cause the Engine and another host process to bind the same UDP port. [moby/moby#50669](https://github.com/moby/moby/pull/50669) +* Fix a deadlock that could happen if a firewalld reload was processed while the bridge networking driver was starting up, or creating or deleting a network, or creating port-mappings. [moby/moby#50620](https://github.com/moby/moby/pull/50620) +* Fix an issue preventing container startup or selection of its network gateway when IPv6 is only disabled on a specific interface. [moby/moby#48971](https://github.com/moby/moby/pull/48971) +* For Linux, `docker info` now reports the firewall backend if available. [docker/cli#6191](https://github.com/docker/cli/pull/6191) +* Greatly improve the reliability of overlay networking and the Swarm routing mesh. [moby/moby#50393](https://github.com/moby/moby/pull/50393) +* Improve the convergence rate of NetworkDB, part of the management plane for overlay networking, after bursts of updates. [moby/moby#50193](https://github.com/moby/moby/pull/50193) +* Improve the reliability of the overlay network driver. [moby/moby#50260](https://github.com/moby/moby/pull/50260) +* Improved error handling for connection of a container to a network. [moby/moby#50945](https://github.com/moby/moby/pull/50945) +* macvlan and IPvlan-l2 networks: no default gateway will be configured unless a `--gateway` is explicitly included in IPAM configuration. This addresses an issue which could cause container startup to fail in networks with IPv6 auto-configuration enabled. [moby/moby#50929](https://github.com/moby/moby/pull/50929) +* nftables: Docker will not enable IP forwarding on the host. If forwarding is needed by a bridge network, but not enabled, daemon startup or network creation will fail with an error. You must either enable forwarding and ensure firewall rules are in place to prevent unwanted forwarding between non-Docker interfaces. Or, use daemon option `--ip-forward=false` to disable the check, but some bridge network functionality including port forwarding may not work. See [Engine Docs](https://docs.docker.com/engine/network/firewall-nftables) for more information about migration from iptables to nftables. [moby/moby#50646](https://github.com/moby/moby/pull/50646) +* On daemon startup, restart containers that share their network stacks before containers that need those stacks. [moby/moby#50327](https://github.com/moby/moby/pull/50327) +* Published ports are now always accessible in networks with gateway mode "routed". Previously, rules to open those ports were only added when the routed mode network was selected as the container's default gateway. [moby/moby#50140](https://github.com/moby/moby/pull/50140) +* Since 28.0.0, an `iptables` mangle rule for checksumming SCTP was only added if environment variable `DOCKER_IPTABLES_SCTP_CHECKSUM=1` was set. The rule has now been removed, the environment variable now has no effect. [moby/moby#50539](https://github.com/moby/moby/pull/50539) +* The iptables rules for bridge networks have been updated, including removal of the `DOCKER-ISOLATION-STAGE-1` and `DOCKER-ISOLATION-STAGE-2` chains. With these changes:. [moby/moby#49981](https://github.com/moby/moby/pull/49981) + + Containers can now access ports published to host addresses by containers in other networks when the userland-proxy is not running + + Containers can now access ports on container addresses in other networks that have gateway mode "nat-unprotected" +* When dynamically linked, the Docker daemon now depends on libnftables. [moby/moby#51033](https://github.com/moby/moby/pull/51033) +* Windows: `network inspect`: the HNS network name is now reported in option `com.docker.network.windowsshim.networkname` rather than the Docker network name, which was only reported after a daemon restart. [moby/moby#50961](https://github.com/moby/moby/pull/50961) +* Windows: when restoring networks on daemon restart, preserve their association with non-default IPAM drivers. [moby/moby#50649](https://github.com/moby/moby/pull/50649) + +### [API](#api) + +* `events` API now reports content-type as `application/x-ndjson` for newline-delimited JSON event stream. [moby/moby#50953](https://github.com/moby/moby/pull/50953) +* `GET /images/{name}/get` and `POST /images/load` now accept multiple `platform` query parameters, allowing export and load of images for multiple platforms. [moby/moby#50166](https://github.com/moby/moby/pull/50166) +* `GET /images/{name}/json` now omits the following fields if their value is empty: `Parent`, `Comment`, `DockerVersion`, `Author`. [moby/moby#51072](https://github.com/moby/moby/pull/51072) +* `GET /images/{name}/json`: omit empty `Config` fields when not set. [moby/moby#50915](https://github.com/moby/moby/pull/50915) +* `POST /images/{name:}/push`: remove compatibility with API v1.4 auth-config in body. [moby/moby#50371](https://github.com/moby/moby/pull/50371) +* Add support for memory swappiness in Swarm services. [moby/moby#51114](https://github.com/moby/moby/pull/51114) + + `GET /services` now returns `SwapBytes` and `MemorySwappiness` fields as part of the `Resource` requirements + + `GET /services/{id}` now returns `SwapBytes` and `MemorySwappiness` fields as part of the `Resource` requirements + + `POST /services/create` now accepts `SwapBytes` and `MemorySwappiness` fields as part of the `Resource` requirements + + `POST /services/{id}/update` now accepts `SwapBytes` and `MemorySwappiness` fields as part of the `Resource` requirements + + `GET /tasks` now returns `SwapBytes` and `MemorySwappiness` fields as part of the `Resource` requirements + + `GET /tasks/{id}` now returns `SwapBytes` and `MemorySwappiness` fields as part of the `Resource` requirements +* api/types/build: move `CachePruneOptions` type to `client.BuildCachePruneOptions`. [moby/moby#50772](https://github.com/moby/moby/pull/50772) +* api/types/checkpoint: move checkpoint options to client module. [moby/moby#50905](https://github.com/moby/moby/pull/50905) +* api/types/container: `OnBuild` will now be omitted if its value is empty or zero. [moby/moby#51154](https://github.com/moby/moby/pull/51154) +* api/types/container: make the container config `MacAddress` obsolete for v1.52 and onwards. Use network endpoint settings instead. [moby/moby#51189](https://github.com/moby/moby/pull/51189) +* api/types/container: move `ResizeOptions` type to `ContainerResizeOptions` in the client. [moby/moby#50773](https://github.com/moby/moby/pull/50773) +* api/types/events: move `ListOptions` type to the client `EventsListOptions`. [moby/moby#50774](https://github.com/moby/moby/pull/50774) +* api/types/image: move image options out to the client. [moby/moby#50776](https://github.com/moby/moby/pull/50776) +* api/types/network: move `CreateOptions`, `ConnectOptions` and `DisconnectOptions` to the client module. [moby/moby#50817](https://github.com/moby/moby/pull/50817) +* api/types/network: move the `ListOptions` and `InspectOptions` types to the client. [moby/moby#50786](https://github.com/moby/moby/pull/50786) +* api/types/plugin: change `ListResponse` to a non-pointer slice. [moby/moby#51440](https://github.com/moby/moby/pull/51440) +* api/types/plugin: remove deprecated `Config.DockerVersion`. [moby/moby#51458](https://github.com/moby/moby/pull/51458) +* api/types/registry: move `SearchOptions` to `ImageSearchOptions` in the client. [moby/moby#50787](https://github.com/moby/moby/pull/50787) +* api/types/registry: moved `ServiceConfig` legacy field marshaling support into daemon backend. [moby/moby#50826](https://github.com/moby/moby/pull/50826) +* api/types/registry: moved encode/decode auth config functions into reference utility package. [moby/moby#50785](https://github.com/moby/moby/pull/50785) +* api/types/storage: add `Storage` type and integrate in container inspect. [moby/moby#50857](https://github.com/moby/moby/pull/50857) +* api/types/swarm: deprecated and dropped support for `PortConfigProtocol`; use `network.IPProtocol` instead. [moby/moby#51094](https://github.com/moby/moby/pull/51094) +* api/types/swarm: move option types to the client module. [moby/moby#50794](https://github.com/moby/moby/pull/50794) +* api/types/swarm: move the `SecretListOptions` type to the client module. [moby/moby#50816](https://github.com/moby/moby/pull/50816) +* api/types/system: move `DiskUsageOptions` to the client. [moby/moby#50788](https://github.com/moby/moby/pull/50788) +* api/types/system: move `SecurityOpt` and `DecodeSecurityOptions` to client module. [moby/moby#50825](https://github.com/moby/moby/pull/50825) +* api/types/volume: change ListResponse.Volumes to a non-pointer slice. [moby/moby#51454](https://github.com/moby/moby/pull/51454) +* api/types/volume: move the `ListOptions` type to the client module. [moby/moby#50789](https://github.com/moby/moby/pull/50789) +* api/types/volume: moved `UpdateOptions` into client module. [moby/moby#51205](https://github.com/moby/moby/pull/51205) +* api/types: daemon: move the disk usage structs to the backend server. [moby/moby#50764](https://github.com/moby/moby/pull/50764) +* api: make `GraphDriver` field in `image.InspectResponse` optional. This field will continue to be emitted when using the legacy graph drivers and will be omitted when using the containerd image backend. [moby/moby#50893](https://github.com/moby/moby/pull/50893) +* api: redefine container network port types. [moby/moby#50710](https://github.com/moby/moby/pull/50710) +* client: PluginListResult: change Items field to a non-pointer slice. [moby/moby#51440](https://github.com/moby/moby/pull/51440) +* Inspecting networks with API v1.52 and newer provides statistics about IPAM allocations for the subnets assigned to the network. [moby/moby#50917](https://github.com/moby/moby/pull/50917) +* MAC address fields are represented as byte slices compatible with the standard library net.HardwareAddr type instead of strings. [moby/moby#51355](https://github.com/moby/moby/pull/51355) +* Swagger definitions for `NetworkSummary` and `NetworkInspect` have been added to the Swagger spec describing the Engine API. [moby/moby#50855](https://github.com/moby/moby/pull/50855) +* Update API version to 1.52. [moby/moby#50418](https://github.com/moby/moby/pull/50418) + +### [Go SDK](#go-sdk) + +* `api/pkg/progress` and `api/pkg/streamformatter` have been removed. [moby/moby#51153](https://github.com/moby/moby/pull/51153) +* `api/types/registry`: `EncodeAuthConfig`: use empty string for zero value. [moby/moby#50426](https://github.com/moby/moby/pull/50426) +* `api/types/versions` has moved to the client and daemon. [moby/moby#51284](https://github.com/moby/moby/pull/51284) +* `client.ConfigCreate`, `client.ConfigList`, `client.ConfigInspectWithRaw`, `client.ConfigUpdate`, and `client.ConfigRemove` methods now accept option structs instead of positional arguments, and return dedicated result structs. [moby/moby#51078](https://github.com/moby/moby/pull/51078) +* `client.ImageBuild`, `client.BuildCancel`, `client.ImageList`, `client.ImageRemove`, `client.ImageTag`, and `client.ImageSearch` methods now accept option structs instead of positional arguments, and return dedicated result structs. [moby/moby#51227](https://github.com/moby/moby/pull/51227) +* `client`: `ContainerExec...` methods were renamed to `Exec...`. [moby/moby#51262](https://github.com/moby/moby/pull/51262) +* `client`: Wrap return values of `ImageInspect`, `ImageHistory`, `ImageLoad` and `ImageSave` in a struct. [moby/moby#51236](https://github.com/moby/moby/pull/51236) +* `ImagePull` now returns an object with `JSONMessages` method returning iterator over the message objects. [moby/moby#50935](https://github.com/moby/moby/pull/50935) +* `ImagePush` now returns an object with `JSONMessages` method returning iterator over the message objects. [moby/moby#51148](https://github.com/moby/moby/pull/51148) +* api/types/container: move `StatsResponseReader` to `client` package. [moby/moby#50521](https://github.com/moby/moby/pull/50521) +* api/types/container: move container options to client. [moby/moby#50897](https://github.com/moby/moby/pull/50897) +* api/types/container: rename `Port` to `PortSummary`. [moby/moby#50711](https://github.com/moby/moby/pull/50711) +* api/types/container: StatsResponse: add `OSType` field. [moby/moby#51305](https://github.com/moby/moby/pull/51305) +* api/types: move `ErrorResponse` to `common/ErrorResponse`. [moby/moby#50632](https://github.com/moby/moby/pull/50632) +* api: remove unused `DefaultVersion`, `MinSupportedAPIVersion` consts. [moby/moby#50587](https://github.com/moby/moby/pull/50587) +* cli/command: add `WithUserAgent` option. [docker/cli#4574](https://github.com/docker/cli/pull/4574) +* client: `ContainerCommitOptions`: remove `Pause` field in favor of `NoPause`. [moby/moby#51019](https://github.com/moby/moby/pull/51019) +* client: add `DefaultAPIVersion` const, which defines the default (and maximum) API version supported by the client. [moby/moby#50433](https://github.com/moby/moby/pull/50433) +* client: add `ExecAPIClient` interface for exec methods provided by the client. [moby/moby#50997](https://github.com/moby/moby/pull/50997) +* client: Client.PluginList: add options-struct. [moby/moby#51207](https://github.com/moby/moby/pull/51207) +* client: ContainersPrune: rewrite to use option structs and result. [moby/moby#51200](https://github.com/moby/moby/pull/51200) +* client: ImagesPrune: rewrite to use option structs and result. [moby/moby#51200](https://github.com/moby/moby/pull/51200) +* client: NetworksPrune: rewrite to use option structs and result. [moby/moby#51200](https://github.com/moby/moby/pull/51200) +* client: remove `client.ContainerStatsResult.OSType` field. [moby/moby#51305](https://github.com/moby/moby/pull/51305) +* client: VolumesPrune: rewrite to use option structs and result. [moby/moby#51200](https://github.com/moby/moby/pull/51200) +* daemon/config: add `DefaultAPIVersion` const, which defines the default (and maximum) API version supported by the daemon. [moby/moby#50436](https://github.com/moby/moby/pull/50436) +* Fix data race in `ContainerExecStart`, `ContainerList`, and `Events`. [moby/moby#50448](https://github.com/moby/moby/pull/50448) +* IP addresses and subnets are now of type `netip.Addr` and `netip.Prefix`, respectively. [moby/moby#50956](https://github.com/moby/moby/pull/50956) +* Remove structs `NetworkSettingsBase` and `DefaultNetworkSettings`. Fields in `NetworkSettingsBase` that were not deprecated are now directly in `NetworkSettings`. [moby/moby#50846](https://github.com/moby/moby/pull/50846) +* the client now uses its own `client.Filters` type for filtering API requests, with a more ergonomic interface. Users of the `github.com/docker/docker/api/types/filters` package will need to refactor when they upgrade to the v29 client. [moby/moby#51115](https://github.com/moby/moby/pull/51115) +* Types `"github.com/moby/moby/api/types/network".Summary` and `"github.com/moby/moby/api/types/network".Inspect` are no longer aliases, and most of their fields have been moved into an embedded struct. Engine API clients may require some source-level changes when migrating to the new github.com/moby/moby/api module. [moby/moby#50878](https://github.com/moby/moby/pull/50878) +* Update minimum Go version to 1.24. [docker/cli#6624](https://github.com/docker/cli/pull/6624) + +### [Deprecations](#deprecations) + +* `client/pkg/jsonmessage`: remove deprecated `ProgressMessage`, `ErrorMessage`, `DisplayJSONMessagesToStream` and `Stream` interface. [moby/moby#49264](https://github.com/moby/moby/pull/49264) +* `GET /events` no longer includes the deprecated `status`, `id`, and `from` fields. These fields were removed in API v1.22, but still included in the response. These fields are now omitted when using API v1.52 or later. [moby/moby#50832](https://github.com/moby/moby/pull/50832) +* api/types/network: CreateRequest: remove deprecated CheckDuplicate field. [moby/moby#50998](https://github.com/moby/moby/pull/50998) +* api/types/plugin: deprecate `Config.DockerVersion` field. [moby/moby#51109](https://github.com/moby/moby/pull/51109) +* api/types/registry: remove deprecated AuthConfig.Email field. [moby/moby#51059](https://github.com/moby/moby/pull/51059) +* api/types/strslice: deprecate StrSlice in favor of using a regular `[]string`. [moby/moby#50292](https://github.com/moby/moby/pull/50292) +* api/types/sytem: remove deprecated `DiskUsage.BuilderSize`. [moby/moby#51180](https://github.com/moby/moby/pull/51180) +* api/types: move plugin types to api/types/plugin. [moby/moby#48114](https://github.com/moby/moby/pull/48114) +* API: Deprecation: the Engine was automatically backfilling empty `PortBindings` lists with a PortBinding with an empty HostIP and HostPort when starting a container. This behavior is deprecated for API 1.52, and will be dropped in API 1.53. [moby/moby#50874](https://github.com/moby/moby/pull/50874) +* build: remove DCT support for classic builder. [docker/cli#6195](https://github.com/docker/cli/pull/6195) +* cli/command: Remove deprecated `ResolveDefaultContext`. [docker/cli#6555](https://github.com/docker/cli/pull/6555) +* client: ImageBuildResponse: remove OSType field. [moby/moby#50995](https://github.com/moby/moby/pull/50995) +* client: Remove `ImageCreate` method - use`ImagePull` or `ImageImport` instead. [moby/moby#51366](https://github.com/moby/moby/pull/51366) +* client: remove deprecated `ImageListOptions.ContainerCount`. [moby/moby#51006](https://github.com/moby/moby/pull/51006) +* client: remove support for negotiating API version < v1.44 (docker 25.0). [moby/moby#51119](https://github.com/moby/moby/pull/51119) +* client: remove unused `Client.HTTPClient()` method. [moby/moby#51011](https://github.com/moby/moby/pull/51011) +* daemon/graphdriver: remove deprecated `GetDriver()`. [moby/moby#50377](https://github.com/moby/moby/pull/50377) +* daemon: raise minimum API version to v1.44. [moby/moby#51186](https://github.com/moby/moby/pull/51186) +* Deprecate the `--pause` flag on `docker commit` in favor of `--no-pause`. [docker/cli#6460](https://github.com/docker/cli/pull/6460) +* Deprecate cgroup v1. [moby/moby#51360](https://github.com/moby/moby/pull/51360), [docker/cli#6598](https://github.com/docker/cli/pull/6598) +* Go SDK: `cli-plugins/manager`: deprecate metadata aliases in favor of their equivalent in `cli-plugins/manager/metadata`. [docker/cli#6237](https://github.com/docker/cli/pull/6237) +* Go SDK: `cli-plugins/manager`: remove `Candidate` interface, which was only for internal use. [docker/cli#6237](https://github.com/docker/cli/pull/6237) +* Go SDK: `cli-plugins/manager`: remove `NewPluginError` function, which was only for internal use. [docker/cli#6237](https://github.com/docker/cli/pull/6237) +* Go SDK: `cli-plugins/manager`: remove deprecated `ResourceAttributesEnvvar` const. [docker/cli#6237](https://github.com/docker/cli/pull/6237) +* Go SDK: `cli/command`: remove the `ErrPromptTerminated`, `DisableInputEcho`, `PromptForInput`, and `PromptForConfirmation` utilities. These utilities were for internal use and are no longer used. [docker/cli#6243](https://github.com/docker/cli/pull/6243) +* Go SDK: `cli/registry/client`: remove deprecated `RepoNameForReference`. [docker/cli#6206](https://github.com/docker/cli/pull/6206) +* Go SDK: api/types/build: remove deprecated BuildCache.Parent field. [moby/moby#51185](https://github.com/moby/moby/pull/51185) +* Go SDK: api/types/container: remove deprecated `ContainerTopOKBody` alias. [moby/moby#50400](https://github.com/moby/moby/pull/50400) +* Go SDK: api/types/container: remove deprecated `ContainerUpdateOKBody` alias. [moby/moby#50400](https://github.com/moby/moby/pull/50400) +* Go SDK: api/types/container: remove deprecated `Stats` type. [moby/moby#50492](https://github.com/moby/moby/pull/50492) +* Go SDK: api/types/filters: remove deprecated `ToParamWithVersion`. [moby/moby#50561](https://github.com/moby/moby/pull/50561) +* Go SDK: api/types/image: `InspectResponse`: remove deprecated `VirtualSize`, `Container`, `ContainerConfig`, `Parent`, and `DockerVersion` fields. [moby/moby#51103](https://github.com/moby/moby/pull/51103) +* Go SDK: api/types/image: remove deprecated Summary.VirtualSize field. [moby/moby#51190](https://github.com/moby/moby/pull/51190) +* Go SDK: api/types/registry: remove deprecated `ServiceConfig.AllowNondistributableArtifactsCIDRs` and `ServiceConfig.AllowNondistributableArtifactsHostnames` fields. [moby/moby#50375](https://github.com/moby/moby/pull/50375) +* Go SDK: api/types/swarm: remove deprecated ServiceSpec.Networks field. [moby/moby#51184](https://github.com/moby/moby/pull/51184) +* GO SDK: api/types/system: remove deprecated `Commit.Expected` field. [moby/moby#51127](https://github.com/moby/moby/pull/51127) +* Go SDK: api/types: remove deprecated aliases. [moby/moby#50452](https://github.com/moby/moby/pull/50452) +* Go SDK: api: deprecate `NoBaseImageSpecifier` const. This const is no longer used and will be removed in the next release. [moby/moby#50437](https://github.com/moby/moby/pull/50437) +* Go SDK: api: remove `NoBaseImageSpecifier`. [moby/moby#50574](https://github.com/moby/moby/pull/50574) +* Go SDK: cli/command/builder: remove `CachePrune()`, which was no longer used. [docker/cli#6236](https://github.com/docker/cli/pull/6236) +* Go SDK: cli/command/builder: remove `NewBuilderCommand` and `NewBakeStubCommand`. [docker/cli#6335](https://github.com/docker/cli/pull/6335) +* Go SDK: cli/command/checkpoint: remove `NewCheckpointCommand`. [docker/cli#6335](https://github.com/docker/cli/pull/6335) +* Go SDK: cli/command/checkpoint: remove deprecated `NewFormat`, `FormatWrite`. [docker/cli#6339](https://github.com/docker/cli/pull/6339) +* Go SDK: cli/command/completion: remove deprecated `NoComplete`. [docker/cli#6408](https://github.com/docker/cli/pull/6408) +* Go SDK: cli/command/config: remove `NewConfigCommand`. [docker/cli#6335](https://github.com/docker/cli/pull/6335) +* Go SDK: cli/command/config: remove deprecated `NewFormat`, `FormatWrite`, `InspectFormatWrite`. [docker/cli#6339](https://github.com/docker/cli/pull/6339) +* Go SDK: cli/command/config: remove deprecated `RunConfigCreate`, `CreateOptions`, `RunConfigInspect`, `InspectOptions`, `RunConfigList`, `ListOptions`, `RunConfigRemove`, and `RemoveOptions`. [docker/cli#6370](https://github.com/docker/cli/pull/6370) +* Go SDK: cli/command/container: deprecate `NewDiffFormat`, `DiffFormatWrite`. These functions were only used internally and will be removed in the next release. [docker/cli#6187](https://github.com/docker/cli/pull/6187) +* Go SDK: cli/command/container: remove `NewBuildCommand`, `NewPullCommand`, `NewPushCommand`, `NewImagesCommand`, `NewImageCommand`, `NewHistoryCommand`, `NewImportCommand`, `NewLoadCommand`, `NewRemoveCommand`, `NewSaveCommand`, `NewTagCommand`, `NewPruneCommand`. [docker/cli#6335](https://github.com/docker/cli/pull/6335) +* Go SDK: cli/command/container: remove `NewRunCommand`, `NewExecCommand`, `NewPsCommand`, `NewContainerCommand`, `NewAttachCommand`, `NewCommitCommand`, `NewCopyCommand`, `NewCreateCommand`, `NewDiffCommand`, `NewExportCommand`, `NewKillCommand`, `NewLogsCommand`, `NewPauseCommand`, `NewPortCommand`, `NewRenameCommand`, `NewRestartCommand`, `NewRmCommand`, `NewStartCommand`, `NewStatsCommand`, `NewStopCommand`, `NewTopCommand`, `NewUnpauseCommand`, `NewUpdateCommand`, `NewWaitCommand`, `NewPruneCommand`. [docker/cli#6335](https://github.com/docker/cli/pull/6335) +* Go SDK: cli/command/container: remove `RunPrune()`, which was no longer used. [docker/cli#6236](https://github.com/docker/cli/pull/6236) +* Go SDK: cli/command/container: remove deprecated `NewDiffFormat`, `DiffFormatWrite`. [docker/cli#6339](https://github.com/docker/cli/pull/6339) +* Go SDK: cli/command/context: remove `NewContextCommand`. [docker/cli#6335](https://github.com/docker/cli/pull/6335) +* Go SDK: cli/command/context: remove deprecated `RunCreate` and `CreateOptions`. [docker/cli#6407](https://github.com/docker/cli/pull/6407) +* Go SDK: cli/command/context: remove deprecated `RunExport` and `ExportOptions`. [docker/cli#6407](https://github.com/docker/cli/pull/6407) +* Go SDK: cli/command/context: remove deprecated `RunImport`. [docker/cli#6407](https://github.com/docker/cli/pull/6407) +* Go SDK: cli/command/context: remove deprecated `RunRemove` and `RemoveOptions`. [docker/cli#6407](https://github.com/docker/cli/pull/6407) +* Go SDK: cli/command/context: remove deprecated `RunUpdate` and `UpdateOptions`. [docker/cli#6407](https://github.com/docker/cli/pull/6407) +* Go SDK: cli/command/context: remove deprecated `RunUse`. [docker/cli#6407](https://github.com/docker/cli/pull/6407) +* Go SDK: cli/command/formatter/swarm: remove deprecated `GetStacks` function. [docker/cli#6406](https://github.com/docker/cli/pull/6406) +* Go SDK: cli/command/image/build: deprecate `DefaultDockerfileName`, `DetectArchiveReader`, `WriteTempDockerfile`, `ResolveAndValidateContextPath`. These utilities were only used internally and will be removed in the next release. [docker/cli#6561](https://github.com/docker/cli/pull/6561) +* Go SDK: cli/command/image: remove `RunPrune()`, which was no longer used. [docker/cli#6236](https://github.com/docker/cli/pull/6236) +* Go SDK: cli/command/image: remove deprecated `AuthResolver` utility. [docker/cli#6373](https://github.com/docker/cli/pull/6373) +* Go SDK: cli/command/image: remove deprecated `NewHistoryFormat`, `HistoryWrite`. [docker/cli#6339](https://github.com/docker/cli/pull/6339), [docker/cli#6339](https://github.com/docker/cli/pull/6339) +* Go SDK: cli/command/manifest: remove `NewManifestCommand`. [docker/cli#6335](https://github.com/docker/cli/pull/6335) +* Go SDK: cli/command/network: remove `NewNetworkCommand`. [docker/cli#6335](https://github.com/docker/cli/pull/6335) +* Go SDK: cli/command/network: remove `RunPrune()`, which was no longer used. [docker/cli#6236](https://github.com/docker/cli/pull/6236) +* Go SDK: cli/command/network: remove deprecated `NewFormat`, `FormatWrite`. [docker/cli#6339](https://github.com/docker/cli/pull/6339) +* Go SDK: cli/command/node: remove `NewNodeCommand`. [docker/cli#6335](https://github.com/docker/cli/pull/6335) +* Go SDK: cli/command/node: remove deprecated `NewFormat`, `FormatWrite`, `InspectFormatWrite`. [docker/cli#6339](https://github.com/docker/cli/pull/6339) +* Go SDK: cli/command/plugin: remove `NewPluginCommand`. [docker/cli#6335](https://github.com/docker/cli/pull/6335) +* Go SDK: cli/command/plugin: remove deprecated `NewFormat`, `FormatWrite`. [docker/cli#6339](https://github.com/docker/cli/pull/6339) +* Go SDK: cli/command/registry: remove `NewLoginCommand`, `NewLogoutCommand`, `NewSearchCommand`. [docker/cli#6335](https://github.com/docker/cli/pull/6335) +* Go SDK: cli/command/registry: remove deprecated `NewSearchFormat`, `SearchWrite`. [docker/cli#6339](https://github.com/docker/cli/pull/6339) +* Go SDK: cli/command/registry: remove deprecated `OauthLoginEscapeHatchEnvVar` const. [docker/cli#6463](https://github.com/docker/cli/pull/6463) +* Go SDK: cli/command/secret: remove `NewSecretCommand`. [docker/cli#6335](https://github.com/docker/cli/pull/6335) +* Go SDK: cli/command/secret: remove deprecated `NewFormat`, `FormatWrite`, `InspectFormatWrite`. [docker/cli#6339](https://github.com/docker/cli/pull/6339) +* Go SDK: cli/command/service: remove `NewServiceCommand`. [docker/cli#6335](https://github.com/docker/cli/pull/6335) +* Go SDK: cli/command/service: remove deprecated `NewFormat`, `InspectFormatWrite`. [docker/cli#6339](https://github.com/docker/cli/pull/6339) +* Go SDK: cli/command/stack/swarm: remove deprecated RunPS and options.PS. [docker/cli#6398](https://github.com/docker/cli/pull/6398) +* Go SDK: cli/command/stack: remove `NewStackCommand`. [docker/cli#6335](https://github.com/docker/cli/pull/6335) +* Go SDK: cli/command/stack: remove deprecated RunList and options.List. [docker/cli#6398](https://github.com/docker/cli/pull/6398) +* Go SDK: cli/command/stack: remove deprecated RunServices and swarm.GetServices. [docker/cli#6398](https://github.com/docker/cli/pull/6398) +* Go SDK: cli/command/swarm: remove `NewSwarmCommand`. [docker/cli#6335](https://github.com/docker/cli/pull/6335) +* Go SDK: cli/command/system: remove `NewVersionCommand`, `NewInfoCommand`, `NewSystemCommand`, `NewEventsCommand`, `NewInspectCommand`. [docker/cli#6335](https://github.com/docker/cli/pull/6335) +* Go SDK: cli/command/task: remove deprecated `NewTaskFormat`, `FormatWrite`. [docker/cli#6339](https://github.com/docker/cli/pull/6339) +* Go SDK: cli/command/trust: remove `NewTrustCommand`. [docker/cli#6335](https://github.com/docker/cli/pull/6335) +* Go SDK: cli/command/trust: remove deprecated `NewPruneCommand`. [docker/cli#6344](https://github.com/docker/cli/pull/6344) +* Go SDK: cli/command/trust: remove deprecated `SignedTagInfo`, `SignerInfo`, `NewTrustTagFormat`, `NewSignerInfoFormat`, `TagWrite`, `SignerInfoWrite`. [docker/cli#6339](https://github.com/docker/cli/pull/6339) +* Go SDK: cli/command/volume: remove `NewVolumeCommand`, `NewPruneCommand`. [docker/cli#6335](https://github.com/docker/cli/pull/6335) +* Go SDK: cli/command/volume: remove `RunPrune()`, which was no longer used. [docker/cli#6236](https://github.com/docker/cli/pull/6236) +* Go SDK: cli/command: remove `AddTrustSigningFlags`, `AddTrustVerificationFlags`, and `AddPlatformFlag` utilities, which were only used internally. [docker/cli#6244](https://github.com/docker/cli/pull/6244) +* Go SDK: cli/command: remove deprecated `DockerCli.Apply`. [docker/cli#6503](https://github.com/docker/cli/pull/6503) +* Go SDK: cli/command: remove deprecated `DockerCli.ContentTrustEnabled`. [docker/cli#6502](https://github.com/docker/cli/pull/6502) +* Go SDK: cli/command: remove deprecated `DockerCli.DefaultVersion`. [docker/cli#6502](https://github.com/docker/cli/pull/6502) +* Go SDK: cli/command: remove deprecated `RegistryAuthenticationPrivilegedFunc`. [docker/cli#6349](https://github.com/docker/cli/pull/6349) +* Go SDK: cli/command: remove deprecated `WithContentTrustFromEnv`, `WithContentTrust` options. [docker/cli#6502](https://github.com/docker/cli/pull/6502) +* Go SDK: cli/config/configfile: remove deprecated `ConfigFile.Experimental` field. [docker/cli#6464](https://github.com/docker/cli/pull/6464) +* Go SDK: cli/config/types: remove deprecated `AuthConfig.Email` field. [docker/cli#6515](https://github.com/docker/cli/pull/6515) +* Go SDK: cli/manifest/store: remove deprecated `IsNotFound`. [docker/cli#6523](https://github.com/docker/cli/pull/6523) +* Go SDK: cli: remove deprecated `VisitAll`, `DisableFlagsInUseLine` utilities. [docker/cli#6296](https://github.com/docker/cli/pull/6296) +* Go SDK: client: remove `APIClient.ImageInspectWithRaw` from the `APIClient` interface. [moby/moby#50485](https://github.com/moby/moby/pull/50485) +* Go SDK: client: remove `ImageAPIClient.ImageInspectWithRaw` from the `ImageAPIClient` interface. [moby/moby#50485](https://github.com/moby/moby/pull/50485) +* Go SDK: client: remove `ImageAPIClientDeprecated.ImageInspectWithRaw` from the `ImageAPIClientDeprecated`. [moby/moby#50485](https://github.com/moby/moby/pull/50485) +* Go SDK: client: remove deprecated `ErrorConnectionFailed` and `IsErrNotFound` functions. [moby/moby#50485](https://github.com/moby/moby/pull/50485) +* Go SDK: client: remove deprecated `NewClient` and `NewEnvClient` functions. [moby/moby#50485](https://github.com/moby/moby/pull/50485) +* Go SDK: client: remove the `CommonAPIClient` interface. [moby/moby#50485](https://github.com/moby/moby/pull/50485) +* Go SDK: client: remove the `ImageAPIClientDeprecated` interface. [moby/moby#50485](https://github.com/moby/moby/pull/50485) +* Go SDK: client: remove the deprecated `Client.ImageInspectWithRaw` method. [moby/moby#50485](https://github.com/moby/moby/pull/50485) +* Go SDK: container: remove deprecated `IsValidHealthString`. [moby/moby#50378](https://github.com/moby/moby/pull/50378) +* Go SDK: container: remove deprecated `IsValidStateString`. [moby/moby#50378](https://github.com/moby/moby/pull/50378) +* Go SDK: container: remove deprecated `StateStatus`, `WaitCondition`, and the related `WaitConditionNotRunning`, `WaitConditionNextExit`, and `WaitConditionRemoved` consts. [moby/moby#50378](https://github.com/moby/moby/pull/50378) +* Go SDK: deprecate `pkg/stdcopy`, which was moved to `api/stdcopy`. [moby/moby#50462](https://github.com/moby/moby/pull/50462) +* Go SDK: Deprecate field `NetworkSettingsBase.Bridge`, struct `NetworkSettingsBase`, all the fields of `DefaultNetworkSettings`, and struct `DefaultNetworkSettings`. [moby/moby#50848](https://github.com/moby/moby/pull/50848) +* Go SDK: deprecate pkg/stringid in favour of `github.com/moby/moby/client/pkg/stringid`. [moby/moby#50504](https://github.com/moby/moby/pull/50504) +* Go SDK: deprecate profiles package which got migrated to `github.com/moby/profiles`. [moby/moby#50481](https://github.com/moby/moby/pull/50481) +* Go SDK: oci: deprecate SetCapabilities, and some minor cleanups/fixes. [moby/moby#50461](https://github.com/moby/moby/pull/50461) +* Go SDK: opts: remove deprecated `ListOpts.GetAll`. It's no longer used and replaced by `ListOpts.GetSlice`. [docker/cli#6293](https://github.com/docker/cli/pull/6293) +* Go SDK: opts: remove deprecated `NewNamedListOptsRef`, `NewNamedMapOpts`, `NamedListOpts`, `NamedMapOpts`, and `NamedOption`. These types and functions are no longer used and will be removed in the next release. [docker/cli#6293](https://github.com/docker/cli/pull/6293) +* Go SDK: opts: remove deprecated `ParseEnvFile` in favour of `kvfile.Parse`. [docker/cli#6382](https://github.com/docker/cli/pull/6382) +* Go SDK: opts: remove deprecated `QuotedString`. [docker/cli#6293](https://github.com/docker/cli/pull/6293) +* Go SDK: opts: remove deprecated `ValidateHost`. [docker/cli#6293](https://github.com/docker/cli/pull/6293) +* Go SDK: pkg/system was removed, and is now an internal package. [moby/moby#50559](https://github.com/moby/moby/pull/50559) +* Go SDK: pkg/system: deprecate `EscapeArgs()` and `IsAbs`. These functions were only used internally and will be removed in the next release. [moby/moby#50399](https://github.com/moby/moby/pull/50399) +* Go SDK: registry: remove deprecated `APIEndpoint.TrimHostName`, `APIEndpoint.Official`, and `APIEndpoint.AllowNondistributableArtifacts` fields. [moby/moby#50376](https://github.com/moby/moby/pull/50376) +* Go SDK: registry: remove deprecated `HostCertsDir()` and `SetCertsDir()` functions. [moby/moby#50373](https://github.com/moby/moby/pull/50373) +* Go SDK: registry: remove deprecated `RepositoryInfo.Official` and `RepositoryInfo.Class` field. [moby/moby#50498](https://github.com/moby/moby/pull/50498) +* Go SDK: registry: remove deprecated `Service.ResolveRepository()`. [moby/moby#50374](https://github.com/moby/moby/pull/50374) +* Go SDK: Remove `buildkit.ClientOpts`. [moby/moby#50318](https://github.com/moby/moby/pull/50318) +* Go SDK: remove `pkg/fileutils`. [moby/moby#50558](https://github.com/moby/moby/pull/50558) +* Go SDK: Remove deprecated `IsNotFound`, `CommandAnnotationPlugin`, `CommandAnnotationPluginVendor`, `CommandAnnotationPluginVersion`, `CommandAnnotationPluginInvalid`, `CommandAnnotationPluginCommandPath`, `NamePrefix`, `MetadataSubcommandName`, `HookSubcommandName`, `Metadata`, and `ReexecEnvvar` from `cli-plugins/manager` in favor of their `cli-plugins/manager/metadata` equivalents. [docker/cli#6414](https://github.com/docker/cli/pull/6414) +* Go SDK: remove deprecated `types/plugins/logdriver` and `types/swarm/runtime` packages; plugin-runtime spec is now exposed as `types/swarm.RuntimeSpec` and `types/swarm.RuntimePrivilege`. [moby/moby#50554](https://github.com/moby/moby/pull/50554) +* Go SDK: remove deprecated `cli/command/formatter` package. [docker/cli#6406](https://github.com/docker/cli/pull/6406) +* Go SDK: remove deprecated `cli/registry/client` package. [docker/cli#6462](https://github.com/docker/cli/pull/6462) +* Go SDK: remove deprecated `pkg/idtools` package. [moby/moby#50456](https://github.com/moby/moby/pull/50456) +* Go SDK: templates: remove deprecated `NewParse` function. [docker/cli#6453](https://github.com/docker/cli/pull/6453) +* Hide the `--kernel-memory` option on `docker run` and `docker create`, and produce a warning when used as it's no longer supported by the daemon and kernel. [docker/cli#6455](https://github.com/docker/cli/pull/6455) +* Remove `VirtualSize` field from `docker image ls` output when using JSON format. [docker/cli#6524](https://github.com/docker/cli/pull/6524) +* Remove `VirtualSize` formatting options and output. [docker/cli#6524](https://github.com/docker/cli/pull/6524) +* Remove API version compatibility for API version v1.44 and earlier (Docker v24.0 and older). [docker/cli#6551](https://github.com/docker/cli/pull/6551) +* Remove deprecated `bind-nonrecursive` option for `--mount`. [docker/cli#6241](https://github.com/docker/cli/pull/6241) +* Remove deprecated packages (`pkg/archive`, `pkg/chrootarchive`, `pkg/atomicwriter`, `pkg/reexec`, `pkg/platform`, `pkg/parsers`), `pkg/system.MkdirAll`. For replacements, see `github.com/moby/go-archive`, `github.com/moby/sys` and the standard library. [moby/moby#50208](https://github.com/moby/moby/pull/50208) +* Remove special handling for quoted values for the `--tlscacert`, `--tlscert`, and `--tlskey` command-line flags. [docker/cli#6306](https://github.com/docker/cli/pull/6306) +* Remove support for AutoRemove (`--rm`) on API < 1.30. [docker/cli#6525](https://github.com/docker/cli/pull/6525) +* Remove support for loading legacy (pre-Docker 1.10) images. [moby/moby#50324](https://github.com/moby/moby/pull/50324) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_29.0.1.md b/corpus/changelog/docker_engine_releases/docker_engine_29.0.1.md new file mode 100644 index 0000000000000000000000000000000000000000..e83fae935284f10cf218dab31164049f3fc3b0a1 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_29.0.1.md @@ -0,0 +1,26 @@ +# Docker Engine 29.0.1 release notes + +Source: https://docs.docker.com/engine/release-notes/29/ + +## [29.0.1](#2901) + +*2025-11-14* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 29.0.1 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A29.0.1) +* [moby/moby, 29.0.1 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A29.0.1) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-3) + +* `docker image ls` no longer truncates the name width when output is redirect (e.g. for `grep`). [docker/cli#6656](https://github.com/docker/cli/pull/6656) +* `docker image ls` now considers the `NO_COLOR` environment variable for choosing the colored output. [docker/cli#6654](https://github.com/docker/cli/pull/6654) +* containerd image store: Fix a bug causing `docker build` to ignore the explicitly set `unpack` image exporter option. [moby/moby#51514](https://github.com/moby/moby/pull/51514) +* Fix a bug causing `docker image ls --all` to not show untagged/dangling images. [docker/cli#6657](https://github.com/docker/cli/pull/6657) +* Fix build on i386. [moby/moby#51528](https://github.com/moby/moby/pull/51528) +* Fix explicit graphdriver configuration (`"storage-driver"`) being treated as containerd snapshotter when prior graphdriver state exists. [moby/moby#51516](https://github.com/moby/moby/pull/51516) +* Fix output format of the `ApiVersion` and `MinApiVersion` fields in `docker version --format=json` to align with previous versions. [docker/cli#6648](https://github.com/docker/cli/pull/6648) + +### [Networking](#networking-6) + +* Fix a bug preventing DNS resolution of containers attached to non swarm-scoped networks once the node has joined a Swarm cluster. [moby/moby#51515](https://github.com/moby/moby/pull/51515) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_29.0.2.md b/corpus/changelog/docker_engine_releases/docker_engine_29.0.2.md new file mode 100644 index 0000000000000000000000000000000000000000..90f955e13c393e67ba2e3f3d4ce7280f4231e425 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_29.0.2.md @@ -0,0 +1,17 @@ +# Docker Engine 29.0.2 release notes + +Source: https://docs.docker.com/engine/release-notes/29/ + +## [29.0.2](#2902) + +*2025-11-17* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 29.0.2 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A29.0.2) +* [moby/moby, 29.0.2 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A29.0.2) + +### [Networking](#networking-5) + +* Fix an issue that could lead to an "endpoint not found" error when creating a container with multiple network connections, when one of the networks is non-internal but does not have its own external IP connectivity. [moby/moby#51538](https://github.com/moby/moby/pull/51538) +* Fix an issue that prevented rootless Docker from starting on a host with IPv6 disabled. [moby/moby#51543](https://github.com/moby/moby/pull/51543) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_29.0.3.md b/corpus/changelog/docker_engine_releases/docker_engine_29.0.3.md new file mode 100644 index 0000000000000000000000000000000000000000..23650ab69e0873de0ceef96f56200469d61f365e --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_29.0.3.md @@ -0,0 +1,21 @@ +# Docker Engine 29.0.3 release notes + +Source: https://docs.docker.com/engine/release-notes/29/ + +## [29.0.3](#2903) + +*2025-11-24* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 29.0.3 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A29.0.3) +* [moby/moby, 29.0.3 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A29.0.3) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-2) + +* `docker version --format json`: restore top-level `BuildTime` field to use RFC3339Nano format. [docker/cli#6668](https://github.com/docker/cli/pull/6668) +* Fix `docker image ls` ignoring a custom `imageFormat` from `docker.json`. [docker/cli#6667](https://github.com/docker/cli/pull/6667) + +### [Networking](#networking-4) + +* Fix an issue that caused daemon crash when using a remote network driver plugin. [moby/moby#51558](https://github.com/moby/moby/pull/51558) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_29.0.4.md b/corpus/changelog/docker_engine_releases/docker_engine_29.0.4.md new file mode 100644 index 0000000000000000000000000000000000000000..c6cc45e5883cbf210567b3680031d4e1c75e4668 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_29.0.4.md @@ -0,0 +1,20 @@ +# Docker Engine 29.0.4 release notes + +Source: https://docs.docker.com/engine/release-notes/29/ + +## [29.0.4](#2904) + +*2025-11-24* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 29.0.4 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A29.0.4) +* [moby/moby, 29.0.4 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A29.0.4) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements-1) + +* `docker image ls` no longer truncates the image names. [docker/cli#6675](https://github.com/docker/cli/pull/6675) + +### [Networking](#networking-3) + +* Allow creation of a container with a specific IP address when its networks were not configured with a specific subnet. [moby/moby#51583](https://github.com/moby/moby/pull/51583) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_29.1.0.md b/corpus/changelog/docker_engine_releases/docker_engine_29.1.0.md new file mode 100644 index 0000000000000000000000000000000000000000..6f1a1c899a7bee8adcd9cfef006f076d12b6ab27 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_29.1.0.md @@ -0,0 +1,24 @@ +# Docker Engine 29.1.0 release notes + +Source: https://docs.docker.com/engine/release-notes/29/ + +## [29.1.0](#2910) + +*2025-11-27* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 29.1.0 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A29.1.0) +* [moby/moby, 29.1.0 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A29.1.0) + +### [Packaging updates](#packaging-updates-1) + +* Update BuildKit to [v0.26.1](https://github.com/moby/buildkit/releases/tag/v0.26.1). [moby/moby#51551](https://github.com/moby/moby/pull/51551) +* Update containerd binary to v2.2.0 (static binaries). [moby/moby#51271](https://github.com/moby/moby/pull/51271) + +### [Networking](#networking-2) + +* Do not overwrite user-modified `/etc/resolv.conf` across container restarts. [moby/moby#51507](https://github.com/moby/moby/pull/51507) +* fix `--publish-all` / `-P` for Windows containers. [moby/moby#51586](https://github.com/moby/moby/pull/51586) +* Fix an issue that prevented container restart or network reconnection when gateway configuration failed during container stop or network disconnect. [moby/moby#51592](https://github.com/moby/moby/pull/51592) +* Windows containers: don't display an IPv6-mapped IPv4 address in port mappings. For example, `[::ffff:0.0.0.0]:8080->80/tcp` instead of `0.0.0.0:8080->80/tcp`. [moby/moby#51587](https://github.com/moby/moby/pull/51587) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_29.1.1.md b/corpus/changelog/docker_engine_releases/docker_engine_29.1.1.md new file mode 100644 index 0000000000000000000000000000000000000000..d915904722993b34b860479abc1e12784cea3136 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_29.1.1.md @@ -0,0 +1,16 @@ +# Docker Engine 29.1.1 release notes + +Source: https://docs.docker.com/engine/release-notes/29/ + +## [29.1.1](#2911) + +*2025-11-28* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 29.1.1 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A29.1.1) +* [moby/moby, 29.1.1 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A29.1.1) + +### [Networking](#networking-1) + +* Revert a PR breaking external DNS resolution on all custom bridge networks. [moby/moby#51615](https://github.com/moby/moby/pull/51615) diff --git a/corpus/changelog/docker_engine_releases/docker_engine_29.1.2.md b/corpus/changelog/docker_engine_releases/docker_engine_29.1.2.md new file mode 100644 index 0000000000000000000000000000000000000000..a19d5ef0b5149505098b342d38ad6862c96fe151 --- /dev/null +++ b/corpus/changelog/docker_engine_releases/docker_engine_29.1.2.md @@ -0,0 +1,33 @@ +# Docker Engine 29.1.2 release notes + +Source: https://docs.docker.com/engine/release-notes/29/ + +## [29.1.2](#2912) + +*2025-12-02* + +For a full list of pull requests and changes in this release, refer to the relevant GitHub milestones: + +* [docker/cli, 29.1.2 milestone](https://github.com/docker/cli/issues?q=is%3Aclosed+milestone%3A29.1.2) +* [moby/moby, 29.1.2 milestone](https://github.com/moby/moby/issues?q=is%3Aclosed+milestone%3A29.1.2) + +### [Security](#security) + +* Update Go runtime to [1.25.5](https://go.dev/doc/devel/release#go1.25.5). [moby/moby#51648](https://github.com/moby/moby/pull/51648), [docker/cli#6688](https://github.com/docker/cli/pull/6688) + + Fixes a potential DoS via excessive resource usage when formatting hostname validation errors [**CVE-2025-61729**](https://nvd.nist.gov/vuln/detail/CVE-2025-61729) + + Fixes incorrect enforcement of excluded subdomain constraints for wildcard SANs, which could allow improperly trusted certificates [**CVE-2025-61727**](https://nvd.nist.gov/vuln/detail/CVE-2025-22874) + +### [Bug fixes and enhancements](#bug-fixes-and-enhancements) + +* containerd image store: Fix `docker image inspect` failing to return available image data in case where not all distributable blobs are available locally. [moby/moby#51629](https://github.com/moby/moby/pull/51629) +* dockerd-rootless-setuptool.sh: fix `nsenter: no namespace specified`. [moby/moby#51622](https://github.com/moby/moby/pull/51622) +* Fix `docker system df` showing `N/A` for shared size and unique size when using graph-drivers as storage. [moby/moby#51631](https://github.com/moby/moby/pull/51631) + +### [Packaging updates](#packaging-updates) + +* Update runc (in static binaries) to [v1.3.4](https://github.com/opencontainers/runc/releases/tag/v1.3.4). [moby/moby#51633](https://github.com/moby/moby/pull/51633) + +### [Networking](#networking) + +* Fix a bug preventing port mappings in rootless mode when slirp4netns is used. [moby/moby#51616](https://github.com/moby/moby/pull/51616) +* Prevent a crash when making an API request with `HostConfig.PublishAllPorts` set (`-P`), and no port bindings. [moby/moby#51621](https://github.com/moby/moby/pull/51621) diff --git a/corpus/changelog/java_jdk_releases/java_jdk_17.md b/corpus/changelog/java_jdk_releases/java_jdk_17.md new file mode 100644 index 0000000000000000000000000000000000000000..b486552458fd6b57c698c6b53d4ce72ef028ae51 --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_17.md @@ -0,0 +1,23 @@ +# JDK 17 Documentation + +Source: https://www.oracle.com/java/technologies/javase/17-relnotes.html +Version: 17 + +The Java Platform, Standard Edition 17 Development Kit (JDK 17) is a feature release of the Java SE platform. It contains new features and enhancements in many functional areas. + +You can use the links on this page to open the *Release Notes* describing important changes, enhancements, removed APIs and features, deprecated APIs and features, and other information about JDK 17 and Java SE 17. + +Links to other sources of information about JDK 17 are also provided. The **JDK 17 Guides and Reference Documentation** link below displays a page containing links to the user guides, troubleshooting information, and specific information of interest to users moving from previous versions of the JDK. Links to the *JDK 17 API Specification* and the *Java Language and Virtual Machine Specifications* are provided below in the **JDK 17 Specifications** group. + +**Note:** The Release Notes files are located only on our website. + +* [JDK 17 Release Notes](/java/technologies/javase/17-relnote-issues.html) +* [JDK 17 Read Me](/java/technologies/javase/jdk17-readme-downloads.html) +* [JDK 17 Guides and Reference Documentation](https://docs.oracle.com/en/java/javase/17) +* JDK 17 Specifications: + + [JDK 17 API Specification](https://docs.oracle.com/en/java/javase/17/docs/api/index.html) + + [Java Language and Virtual Machine Specifications](https://docs.oracle.com/javase/specs/index.html) +* [Oracle JDK 17 Certified System Configurations](/java/technologies/javase/products-doc-jdk17certconfig.html) +* [JDK 17 Supported Locales](/java/technologies/javase/jdk17-suported-locales.html) +* [Submitting a Bug Report and Available Support Options](https://bugreport.java.com/bugreport/index.jsp) +* [Copyright and License Terms for Documentation](https://docs.oracle.com/pls/topic/lookup?ctx=en/legal&id=cpyr) diff --git a/corpus/changelog/java_jdk_releases/java_jdk_17010.md b/corpus/changelog/java_jdk_releases/java_jdk_17010.md new file mode 100644 index 0000000000000000000000000000000000000000..8c38bd4a2c2eb287cff9a8f5e739c391b19aca6b --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_17010.md @@ -0,0 +1,20 @@ +# Java_JDK 17.0.10 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/17-0-10-relnotes.html +Version: 17.0.10 + +#### Java SE 17.0.10 - Bundled Patch Release (BPR) - Bug Fixes and Updates + +The following sections summarize changes made in all Java SE 17.0.10 BPR releases. The BPR releases are listed below in date order, most current BPR first. Note that bug fixes in previous BPRs are also included in the current BPR. + +#### Changes in Java SE 17.0.10.0.1 + +#### Bug Fixes + +January 16, 2024 + +Fixes from the [prior BPR](https://www.oracle.com/java/technologies/javase/17-0-9-relnotes.html#R17_0_9-BPR) are included in this version. + + + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_17011.md b/corpus/changelog/java_jdk_releases/java_jdk_17011.md new file mode 100644 index 0000000000000000000000000000000000000000..f759bfd8009edbd06761c6fdb6c8b87c07c92613 --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_17011.md @@ -0,0 +1,31 @@ +# Java_JDK 17.0.11 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/17-0-11-relnotes.html +Version: 17.0.11 + +#### Java SE 17.0.11 - Bundled Patch Release (BPR) - Bug Fixes and Updates + +The following sections summarize changes made in all Java SE 17.0.11 BPR releases. The BPR releases are listed below in date order, most current BPR first. Note that bug fixes in previous BPRs are also included in the current BPR. + +#### Changes in Java SE 17.0.11.0.2 + +#### Bug Fixes + +June 21, 2024 + +| BugId | Category | Subcategory | Description | +| --- | --- | --- | --- | +| [JDK-8331885](https://bugs.openjdk.org/browse/JDK-8331885) | hotspot | compiler | C2: meet between unloaded and speculative types is not symmetric | + +#### Changes in Java SE 17.0.11.0.1 + +#### Bug Fixes + +May 24, 2024 + +| BugId | Category | Subcategory | Description | +| --- | --- | --- | --- | +| [JDK-8322726](https://bugs.openjdk.org/browse/JDK-8322726) | hotspot | compiler | C2: Unloaded signature class kills argument value | +| [JDK-8321151](https://bugs.openjdk.org/browse/JDK-8321151) | client-libs | javas.swing | JDK-8294427 breaks Windows L&F on all older Windows versions | + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_17012.md b/corpus/changelog/java_jdk_releases/java_jdk_17012.md new file mode 100644 index 0000000000000000000000000000000000000000..3ab60d6378dd2e9dff900fbcad35adb657346917 --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_17012.md @@ -0,0 +1,28 @@ +# Java_JDK 17.0.12 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/17-0-12-relnotes.html +Version: 17.0.12 + +#### Java SE 17.0.12 - Bundled Patch Release (BPR) - Bug Fixes and Updates + +The following sections summarize changes made in all Java SE 17.0.12 BPR releases. The BPR releases are listed below in date order, most current BPR first. Note that bug fixes in previous BPRs are also included in the current BPR. + +#### Changes in Java SE 17.0.12.0.2 + +#### Bug Fixes + +Release date: August 16, 2024 + +| BugId | Category | Subcategory | Summary | +| --- | --- | --- | --- | +| JDK-8336107 (not public) | install | | JDK rpm upgrade from 11.0.23 to 11.0.25 leaves "orphan" alternatives entry | + +#### Changes in Java SE 17.0.12.0.1 + +#### Bug Fixes + +July 16, 2024 + +Fixes from the [prior BPR](https://www.oracle.com/java/technologies/javase/17-0-11-relnotes.html#R17_0_11-BPR) are included in this version. + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_17013.md b/corpus/changelog/java_jdk_releases/java_jdk_17013.md new file mode 100644 index 0000000000000000000000000000000000000000..38470e8edcb4544e5f809d154033188ebee45e80 --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_17013.md @@ -0,0 +1,32 @@ +# Java_JDK 17.0.13 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/17-0-13-relnotes.html +Version: 17.0.13 + +#### Java SE 17.0.13 - Bundled Patch Release (BPR) - Bug Fixes and Updates + +The following sections summarize changes made in all Java SE 17.0.13 BPR releases. The BPR releases are listed below in date order, most current BPR first. Note that bug fixes in previous BPRs are also included in the current BPR. + +#### Changes in Java SE 17.0.13.0.1 + +#### Bug Fixes + +Release date: November 15, 2024 + +hotspot/runtime + +**[➜](#JDK-8308341) The `JNI_GetCreatedJavaVMs` Method Will Now Only Return a Fully Initialized VM** ([JDK-8308341](https://bugs.openjdk.org/browse/JDK-8308341)) + +In prior releases, `JNI_GetCreatedJavaVMs`: + +```None +jint JNI_GetCreatedJavaVMs(JavaVM **vmBuf, jsize bufLen, jsize *nVMs); +``` + +could return a `JavaVM`, via the `vmBuf` array, that was still in the process of being initialized and may not be ready for use. This has now changed so that it will only return fully initialized VMs. It is important that the programmer checks that the returned number of VMs, in `nVMs`, is greater than zero, before trying to use any `vmBuf` entries. + +| BugId | Category | Subcategory | Summary | +| --- | --- | --- | --- | +| [JDK-8308766](https://bugs.openjdk.org/browse/JDK-8308766) | hotspot | gc | TLAB initialization may cause div by zero | + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_17014.md b/corpus/changelog/java_jdk_releases/java_jdk_17014.md new file mode 100644 index 0000000000000000000000000000000000000000..b0b51323a707df7a08b542595b38855f95b0a304 --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_17014.md @@ -0,0 +1,18 @@ +# Java_JDK 17.0.14 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/17-0-14-relnotes.html +Version: 17.0.14 + +#### Java SE 17.0.14 - Bundled Patch Release (BPR) - Bug Fixes and Updates + +The following sections summarize changes made in all Java SE 17.0.14 BPR releases. The BPR releases are listed below in date order, most current BPR first. Note that bug fixes in previous BPRs are also included in the current BPR. + +#### Changes in Java SE 17.0.14.0.1 + +#### Bug Fixes + +Release date: January 21, 2025 + +Fixes from the [prior BPR](https://www-sites.oracle.com/java/technologies/javase/17-0-13-relnotes.html#R17_0_13-BPR) are included in this version. + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_17015.md b/corpus/changelog/java_jdk_releases/java_jdk_17015.md new file mode 100644 index 0000000000000000000000000000000000000000..4ec79cb0cd913bcb7df7839bb2ec1a05069a0da0 --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_17015.md @@ -0,0 +1,30 @@ +# Java_JDK 17.0.15 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/17-0-15-relnotes.html +Version: 17.0.15 + +#### Java SE 17.0.15 - Bundled Patch Release (BPR) - Bug Fixes and Updates + +The following sections summarize changes made in all Java SE 17.0.15 BPR releases. The BPR releases are listed below in date order, most current BPR first. Note that bug fixes in previous BPRs are also included in the current BPR. + +#### Changes in Java SE 17.0.15.0.2 + +#### Bug Fixes + +Release date: June 27, 2025 + +| BugId | Category | Subcategory | Summary | +| --- | --- | --- | --- | +| [JDK-8357105](https://bugs.openjdk.org/browse/JDK-8357105) | hotspot | compiler | C2: compilation fails with "assert(false) failed: empty program detected during loop optimization" | + +#### Changes in Java SE 17.0.15.0.1 + +#### Bug Fixes + +Release date: May 16, 2025 + +| BugId | Category | Subcategory | Summary | +| --- | --- | --- | --- | +| JDK-8353830 (not public) | hotspot | compiler | [17u] Add a compilation bailout in identical\_backtoback\_ifs | + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_17016.md b/corpus/changelog/java_jdk_releases/java_jdk_17016.md new file mode 100644 index 0000000000000000000000000000000000000000..10a8de72fdd38e6621baa0cc46799f0279743177 --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_17016.md @@ -0,0 +1,252 @@ +# Java_JDK 17.0.16 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/17-0-16-relnotes.html +Version: 17.0.16 + +#### Java SE 17.0.16 - Bundled Patch Release (BPR) - Bug Fixes and Updates + +The following sections summarize changes made in all Java SE 17.0.16 BPR releases. The BPR releases are listed below in date order, most current BPR first. Note that bug fixes in previous BPRs are also included in the current BPR. + +#### Changes in Java SE 17.0.16.0.3 + +#### Bug Fixes + +Release date: September 26, 2025 + +| BugId | Category | Subcategory | Summary | +| --- | --- | --- | --- | +| [JDK-8367543](https://bugs.openjdk.org/browse/JDK-8367543) | core-libs | | Jspawnhelper missing a free call after JDK-8367533 | + +#### Changes in Java SE 17.0.16.0.2 + +#### Bug Fixes + +Release date: August 14, 2025 + +| BugId | Category | Subcategory | Summary | +| --- | --- | --- | --- | +| [JDK-8364258](https://bugs.openjdk.org/browse/JDK-8364258) | hotspot | jfr | ThreadGroup constant pool serialization is not normalized | + +#### Changes in Java SE 17.0.16.0.1 + +#### Bug Fixes + +Release date: July 15, 2025 + +Fixes from the [prior BPR](https://www-sites.oracle.com/java/technologies/javase/17-0-15-relnotes.html#R17_0_15-BPR) are included in this version. + +--- + + + +## Java™ SE Development Kit 17, Update 17.0.16 (JDK 17.0.16) + +July 15, 2025 + +The full version string for this update release is 17.0.16+12 (where "+" means "build"). +The version number is 17.0.16. This JDK conforms to version 17.1 of the Java SE Specification ([JSR 392 MR 1](https://jcp.org/aboutJava/communityprocess/mrel/jsr392/index.html) 2024-07-02). + +#### IANA TZ Data 2025b + +JDK 17.0.16 contains IANA time zone data [2025b](https://lists.iana.org/hyperkitty/list/tz-announce@iana.org/thread/6JVHNHLB6I2WAYTQ75L6KEPEQHFXAJK3/) which contains the following changes: + +* New zone for Aysén Region in Chile which moves from -04/-03 to -03. + +For more information, refer to [Timezone Data Versions in the JRE Software](https://www.oracle.com/java/technologies/tzdata-versions.html). + +#### Security Baselines + +The security baselines for the Java Runtime at the time of the release of JDK 17.0.16 are specified in the following table: + +| **Java Family Version** | **Security Baseline (Full Version String)** | +| --- | --- | +| 17 | 17.0.16+12 | +| 11 | 11.0.28+12 | +| 8 | 1.8.0\_461-b11 | + +#### Keeping the JDK up to Date + +Oracle recommends that the JDK is updated with each Critical Patch Update. +In order to determine if a release is the latest, the [Security Baseline](https://javadl-esd-secure.oracle.com/update/baseline.version) page can +be used to determine which is the latest version for each release family. + +Critical patch updates, which contain security vulnerability fixes, are announced one year in advance on +Critical Patch Updates, Security Alerts and Bulletins. +It is not recommended that this JDK (version 17.0.16) be used after the next critical patch update scheduled +for October 21, 2025. + +Java Management Service, available to all users, can help you find vulnerable Java versions in your systems. [Java SE Subscribers](https://www.oracle.com/java/java-se-subscription.html) and customers running in Oracle Cloud can use Java Management Service to update Java Runtimes and to do further security reviews like identifying potentially vulnerable third party libraries used by your Java programs. Existing Java Management Service user [click here](https://cloud.oracle.com/jms/overview) to log in to your dashboard. [The Java Management Service Documentation](https://docs.oracle.com/en-us/iaas/jms/index.html) provides a list of features available to everyone and those available only to customers. [Learn more about using Java Management Service](https://www.oracle.com/java/jms/) to monitor and secure your Java Installations. + +#### Removed Features and Options + +security-libs/java.security + +**[➜](#JDK-8303770) Removed Baltimore CyberTrust Root Certificate After Expiry Date** ([JDK-8303770](https://bugs.openjdk.org/browse/JDK-8303770)) + +The following expired root certificate has been removed from the `cacerts` keystore: + +```None ++ alias name "baltimorecybertrustca [jdk]" + + Distinguished Name: CN=Baltimore CyberTrust Root, OU=CyberTrust, O=Baltimore, C=IE +``` + +security-libs/java.security + +**[➜](#JDK-8350498) Removed Two Camerfirma Root Certificates** ([JDK-8350498](https://bugs.openjdk.org/browse/JDK-8350498)) + +The following root certificates, which are terminated and no longer in use, have been removed from the `cacerts` keystore: + +```None ++ alias name "camerfirmachamberscommerceca [jdk]" + + Distinguished Name: CN=Chambers of Commerce Root, OU=http://www.chambersign.org, O=AC Camerfirma SA CIF A82743287, C=EU + ++ alias name "camerfirmachambersignca [jdk]" + Distinguished Name: CN=Global Chambersign Root - 2008, O=AC Camerfirma S.A., SERIALNUMBER=A82743287, L=Madrid (see current address at www.camerfirma.com/address), C=EU +``` + +#### Other Notes + +security-libs/java.security + +**[➜](#JDK-8359170) Added 4 New Root Certificates from Sectigo Limited** ([JDK-8359170](https://bugs.openjdk.org/browse/JDK-8359170)) + +The following root certificates have been added to the cacerts truststore: + +```None ++ Sectigo Limited + + + sectigocodesignroote46 + DN: CN=Sectigo Public Code Signing Root E46, O=Sectigo Limited, C=GB + ++ Sectigo Limited + + sectigocodesignrootr46 + DN: CN=Sectigo Public Code Signing Root R46, O=Sectigo Limited, C=GB + ++ Sectigo Limited + + sectigotlsroote46 + DN: CN=Sectigo Public Server Authentication Root E46, O=Sectigo Limited, C=GB + ++ Sectigo Limited + + sectigotlsrootr46 + DN: CN=Sectigo Public Server Authentication Root R46, O=Sectigo Limited, C=GB +``` + +install/install + +**[➜](#JDK-8351906) Sign oracle.com JDK RPM Packages with OL9 Signing Key** (JDK-8351906 (not public)) + +The oracle.com JDK RPM packages meant to be downloaded directly to the target system, now are signed with the OL9 signing key instead of the OL8 signing key. The RPM packages hosted on YUM repositories remain signed with the appropriate key for the target repository. + +core-libs/javax.naming + +**[➜](#JDK-8290367) Update Default Value of com.sun.jndi.ldap.object.trustSerialData System Property** ([JDK-8290367](https://bugs.openjdk.org/browse/JDK-8290367)) + +In this release, the JDK implementation of the LDAP provider no longer supports deserialization of Java objects by default: + +* The default value of the `com.sun.jndi.ldap.object.trustSerialData` system property has been updated to `false`. + +The transparent deserialization of Java objects from an LDAP context will now require an explicit opt-in. Applications that rely on reconstruction of Java objects or RMI stubs from the LDAP attributes would need to set the `com.sun.jndi.ldap.object.trustSerialData` system property to `true`. + +security-libs/jdk.security + +**[➜](#JDK-8309841) Jarsigner Should Print a Warning If an Entry Is Removed** ([JDK-8309841](https://bugs.openjdk.org/browse/JDK-8309841)) + +If an entry is removed from a signed JAR file, there is no mechanism to detect that it has been removed using the `JarFile` API, since the `getJarEntry` method returns `null` as if the entry had never existed. With this change, the `jarsigner -verify` command analyzes the signature files and if some sections do not have matching file entries, it prints out the following warning: "This JAR contains signed entries for files that do not exist". Users can further find out the names of these entries by adding the `-verbose` option to the command. + +#### Bug Fixes + +This release also contains fixes for security vulnerabilities described in the [Oracle Critical Patch Update](https://www.oracle.com/security-alerts/cpujul2025.html#AppendixJAVA). + +➜ Issues fixed in 17.0.16: + +| # | JBS | Component | Summary | +| --- | --- | --- | --- | +| 1 | [JDK-8348597](https://bugs.openjdk.org/browse/JDK-8348597) | client-libs/2d | Update HarfBuzz to 10.4.0 | +| 2 | [JDK-8348596](https://bugs.openjdk.org/browse/JDK-8348596) | client-libs/2d | Update FreeType to 2.13.3 | +| 3 | [JDK-8348600](https://bugs.openjdk.org/browse/JDK-8348600) | client-libs/java.awt | Update PipeWire to 1.3.81 | +| 4 | [JDK-8348598](https://bugs.openjdk.org/browse/JDK-8348598) | client-libs/java.awt | Update Libpng to 1.6.47 | +| 5 | [JDK-8280468](https://bugs.openjdk.org/browse/JDK-8280468) | client-libs/java.awt | Crashes in getConfigColormap, getConfigVisualId, XVisualIDFromVisual on Linux | +| 6 | [JDK-8286447](https://bugs.openjdk.org/browse/JDK-8286447) | client-libs/java.awt | [Linux] AWT should start in Headless mode if headful AWT library not installed | +| 7 | [JDK-8280991](https://bugs.openjdk.org/browse/JDK-8280991) | client-libs/java.awt | [XWayland] No displayChanged event after setDisplayMode call | +| 8 | [JDK-8286204](https://bugs.openjdk.org/browse/JDK-8286204) | client-libs/javax.accessibility | [Accessibility,macOS,VoiceOver] VoiceOver reads the spinner value 10 as 1 when user iterates to 10 for the first time on macOS | +| 9 | [JDK-8345728](https://bugs.openjdk.org/browse/JDK-8345728) | client-libs/javax.accessibility | [Accessibility,macOS,Screen Magnifier]: JCheckbox unchecked state does not magnify but works for checked state | +| 10 | [JDK-8348936](https://bugs.openjdk.org/browse/JDK-8348936) | client-libs/javax.accessibility | [Accessibility,macOS,VoiceOver] VoiceOver doesn't announce untick on toggling the checkbox with "space" key on macOS | +| 11 | [JDK-8266435](https://bugs.openjdk.org/browse/JDK-8266435) | client-libs/javax.imageio | WBMPImageReader.read() should not truncate the input stream | +| 12 | [JDK-6928542](https://bugs.openjdk.org/browse/JDK-6928542) | client-libs/javax.swing | Chinese characters in RTF are not decoded | +| 13 | [JDK-8224267](https://bugs.openjdk.org/browse/JDK-8224267) | client-libs/javax.swing | JOptionPane message string with 5000+ newlines produces StackOverflowError | +| 14 | [JDK-8318915](https://bugs.openjdk.org/browse/JDK-8318915) | core-libs/java.math | Enhance checks in BigDecimal.toPlainString() | +| 15 | [JDK-8344589](https://bugs.openjdk.org/browse/JDK-8344589) | core-libs/java.util:i18n | Update IANA Language Subtag Registry to Version 2024-11-19 | +| 16 | [JDK-8356096](https://bugs.openjdk.org/browse/JDK-8356096) | core-libs/java.util:i18n | ISO 4217 Amendment 179 Update | +| 17 | [JDK-8299858](https://bugs.openjdk.org/browse/JDK-8299858) | core-svc/java.lang.management | [Metrics] Swap memory limit reported incorrectly when too large | +| 18 | [JDK-8297173](https://bugs.openjdk.org/browse/JDK-8297173) | core-svc/java.lang.management | usageTicks and totalTicks should be volatile to ensure that different threads get the latest ticks | +| 19 | [JDK-8345296](https://bugs.openjdk.org/browse/JDK-8345296) | hotspot/compiler | AArch64: VM crashes with SIGILL when prctl is disallowed | +| 20 | [JDK-8357105](https://bugs.openjdk.org/browse/JDK-8357105) | hotspot/compiler | C2: compilation fails with "assert(false) failed: empty program detected during loop optimization" | +| 21 | [JDK-8339148](https://bugs.openjdk.org/browse/JDK-8339148) | hotspot/runtime | Make os::Linux::active\_processor\_count() public | +| 22 | [JDK-8300645](https://bugs.openjdk.org/browse/JDK-8300645) | hotspot/runtime | Handle julong values in logging of GET\_CONTAINER\_INFO macros | +| 23 | [JDK-8300658](https://bugs.openjdk.org/browse/JDK-8300658) | hotspot/runtime | memory\_and\_swap\_limit() reporting wrong values on systems with swapaccount=0 | +| 24 | [JDK-8311546](https://bugs.openjdk.org/browse/JDK-8311546) | security-libs/java.security | Certificate name constraints improperly validated with leading period | + +--- + + + + + + + + +Resources for + +* [Careers](/careers/) +* [Developers](/developer/) +* [Investors](https://investor.oracle.com/home/default.aspx) +* [Partners](/partner/) +* [Researchers](/research/) +* [Students and Educators](https://academy.oracle.com/en/oa-web-overview.html) + +Why Oracle + +* [Analyst Reports](/corporate/analyst-reports/) +* [Best cloud-based + ERP](/erp/what-is-erp/best-erp/) +* [Cloud Economics](/cloud/economics/) +* [Social Impact](/social-impact/) +* [Security Practices](/corporate/security-practices/) + +Learn + +* [What is a sovereign cloud?](/cloud/sovereign-cloud/what-is-sovereign-cloud/) +* [What is zero trust security?](/security/what-is-zero-trust/) +* [How AI is transforming finance](/erp/financials/ai-finance/) +* [What is a vector database?](/database/vector-database/) +* [What is multicloud?](/cloud/multicloud/what-is-multicloud/) +* [What are AI agents?](/artificial-intelligence/ai-agents/) + +News and Events + +* [News](/news/) +* [Oracle AI World](/ai-world/) +* [Oracle Health Summit](/health/health-summit/) +* [JavaOne](/javaone/) +* [Search all events](https://search.oracle.com/events?q=&lang=english) + +Contact Us + +* [US Sales: +1.800.633.0738](tel:18006330738) +* [How can we help?](/corporate/contact/) +* [Subscribe to emails](https://go.oracle.com/subscribe/?l_code=en&src1=OW:O:FO) +* [Integrity Helpline](https://secure.ethicspoint.com/domain/media/en/gui/31053/index.html) +* [Accessibility](/corporate/accessibility/) + +--- + +* [Country/Region](/universal-menu/#u10countrymenu) + +* [© 2026 Oracle](/legal/copyright/) +* [Privacy](/legal/privacy/)/[Do Not Sell My + Info](/legal/privacy/privacy-choices/) +* [Ad + Choices](/legal/privacy/privacy-policy/#adchoices) +* [Careers](/corporate/careers/) diff --git a/corpus/changelog/java_jdk_releases/java_jdk_17017.md b/corpus/changelog/java_jdk_releases/java_jdk_17017.md new file mode 100644 index 0000000000000000000000000000000000000000..c5b1e1be6140433bf106857c4e12b9027cfca0be --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_17017.md @@ -0,0 +1,16 @@ +# Java_JDK 17.0.17 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/17-0-17-relnotes.html +Version: 17.0.17 + +#### Java SE 17.0.17 - Bundled Patch Release (BPR) - Bug Fixes and Updates + +The following sections summarize changes made in all Java SE 17.0.17 BPR releases. The BPR releases are listed below in date order, most current BPR first. Note that bug fixes in previous BPRs are also included in the current BPR. + +#### Changes in Java SE 17.0.17.0.1 + +#### Bug Fixes + +Release date: October 21, 2025 + +Fixes from the [prior BPR](https://www-sites.oracle.com/java/technologies/javase/17-0-16-relnotes.html#R17_0_16-BPR) are included in this version. diff --git a/corpus/changelog/java_jdk_releases/java_jdk_17018.md b/corpus/changelog/java_jdk_releases/java_jdk_17018.md new file mode 100644 index 0000000000000000000000000000000000000000..4004969da30ec1797ca2aed8726a5543fe162227 --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_17018.md @@ -0,0 +1,168 @@ +# Java_JDK 17.0.18 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/17-0-18-relnotes.html +Version: 17.0.18 + +## Java™ SE Development Kit 17, Update 17.0.18 (JDK 17.0.18) + +January 20, 2026 + +The full version string for this update release is 17.0.18+8 (where "+" means "build"). +The version number is 17.0.18. This JDK conforms to version 17.1 of the Java SE Specification ([JSR 392 MR 1](https://jcp.org/aboutJava/communityprocess/mrel/jsr392/index.html) 2024-07-02). + +#### IANA TZ Data 2025b + +For more information, refer to [Timezone Data Versions in the JRE Software](https://www.oracle.com/java/technologies/tzdata-versions.html). + +#### Security Baselines + +The security baselines for the Java Runtime at the time of the release of JDK 17.0.18 are specified in the following table: + +| **Java Family Version** | **Security Baseline (Full Version String)** | +| --- | --- | +| 17 | 17.0.18+8 | +| 11 | 11.0.30+7 | +| 8 | 1.8.0\_481-b10 | + +#### Keeping the JDK up to Date + +Oracle recommends that the JDK is updated with each Critical Patch Update. +In order to determine if a release is the latest, the [Security Baseline](https://javadl-esd-secure.oracle.com/update/baseline.version) page can +be used to determine which is the latest version for each release family. + +Critical patch updates, which contain security vulnerability fixes, are announced one year in advance on +Critical Patch Updates, Security Alerts and Bulletins. +It is not recommended that this JDK (version 17.0.18) be used after the next critical patch update scheduled +for April 21, 2026. + +Java Management Service, available to all users, can help you find vulnerable Java versions in your systems. [Java SE Subscribers](https://www.oracle.com/java/java-se-subscription.html) and customers running in Oracle Cloud can use Java Management Service to update Java Runtimes and to do further security reviews like identifying potentially vulnerable third party libraries used by your Java programs. Existing Java Management Service user [click here](https://cloud.oracle.com/jms/overview) to log in to your dashboard. [The Java Management Service Documentation](https://docs.oracle.com/en-us/iaas/jms/index.html) provides a list of features available to everyone and those available only to customers. [Learn more about using Java Management Service](https://www.oracle.com/java/jms/) to monitor and secure your Java Installations. + +#### New Features + +core-libs/java.rmi + +**[➜](#JDK-8341496) Endpoint Identification Enabled By Default for RMI Connections Over TLS** (JDK-8341496 (not public)) + +RMI will use TLS connections if the `javax.rmi.ssl.SslRMIClientSocketFactory` class is used. These connections now have TLS endpoint identification enabled by default. This may cause some previously-working TLS connections to fail. If this occurs, ensure that the certificate presented by the server has a Subject Alternative Name that matches the server's hostname. Alternatively, endpoint identification for RMI TLS connections can be disabled on the client side by setting the `jdk.rmi.ssl.client.enableEndpointIdentification` system property to `false`. + +#### Other Notes + +security-libs/javax.net.ssl + +**[➜](#JDK-8340321) Disabled SHA-1 in TLS 1.2 and DTLS 1.2 Handshake Signatures** ([JDK-8340321](https://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-8340321)) + +The SHA-1 algorithm has been disabled by default in TLS 1.2 and DTLS 1.2 handshake signatures, by adding `"rsa_pkcs1_sha1 usage HandshakeSignature, ecdsa_sha1 usage HandshakeSignature, dsa_sha1 usage HandshakeSignature"` to the `jdk.tls.disabledAlgorithms` security property in the `java.security` config file. RFC 9155 deprecates the use of SHA-1 in TLS 1.2 and DTLS 1.2 digital signatures. Users can, at their own risk, re-enable the SHA-1 algorithm in TLS 1.2 and DTLS 1.2 handshake signatures by removing `"rsa_pkcs1_sha1 usage HandshakeSignature, ecdsa_sha1 usage HandshakeSignature, dsa_sha1 usage HandshakeSignature"` from the `jdk.tls.disabledAlgorithms` security property. + +install/install + +**[➜](#JDK-8310932) Windows Installers to Return to Full Version Directory and Use of Junction** (JDK-8310932 (not public)) + +For the JDK11+ LTS families, the JDK will install into a version-specific installation directory by default. The installation directory of 11+ will have a - before the version-specific string to keep consistency with the past 11+ conventions per family. A junction, also known as a symlink for Windows, will also be created in a "latest" directory. It will point to the latest version of that family. Here is a breakdown example of installation and junction locations 11+ families: + +| Version | Installation Directory | Junction Location | +| --- | --- | --- | +| jdk25.0.2 | `C:\Program Files\Java\jdk-25.0.2` | `C:\Program Files\Java\latest\jdk-25` | +| jdk17.0.18 | `C:\Program Files\Java\jdk-17.0.18` | `C:\Program Files\Java\latest\jdk-17` | +| jdk11.0.30 | `C:\Program Files\Java\jdk-11.0.30` | `C:\Program Files\Java\latest\jdk-11` || + +Each junction will always point to the latest JDK of the matching LTS family. The junction for each family will be removed when the last JDK of the matching LTS family is uninstalled. + +install/install + +**[➜](#JDK-8359443) Make jcmd Command Available in the Headless JDK RPM** (JDK-8359443 (not public)) + +`jcmd` command will be available in the headless JDK RPM instead of the headful JDK RPM. + +It will be added to the `java` alternatives group instead of the `javac` alternatives group. + +security-libs/javax.net.ssl + +**[➜](#JDK-8245545) Disabled TLS\_RSA Cipher Suites** ([JDK-8245545](https://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-8245545)) + +The TLS\_RSA cipher suites have been disabled by default, by adding "TLS\_RSA\_*" to the `jdk.tls.disabledAlgorithms` security property in the `java.security` configuration file. The TLS\_RSA cipher suites do not preserve forward-secrecy and are not commonly used. Some TLS\_RSA cipher suites are already disabled because they use DES, 3DES, RC4, or NULL, which are disabled. This action disables all remaining TLS\_RSA cipher suites. Any attempts to use cipher suites starting with "TLS\_RSA\_" will fail with an `SSLHandshakeException`. Users can, at their own risk, re-enable these cipher suites by removing "TLS\_RSA\_*" from the `jdk.tls.disabledAlgorithms` security property. The following previously enabled cipher suites are now disabled: + +```None +TLS_RSA_WITH_AES_256_GCM_SHA384 + +TLS_RSA_WITH_AES_128_GCM_SHA256 +TLS_RSA_WITH_AES_256_CBC_SHA256 +TLS_RSA_WITH_AES_128_CBC_SHA256 +TLS_RSA_WITH_AES_256_CBC_SHA +TLS_RSA_WITH_AES_128_CBC_SHA +``` + +core-libs/java.util:i18n + +**[➜](#JDK-8345213) Changes to the Default Time Zone Detection on Debian-based Linux** ([JDK-8345213](https://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-8345213)) + +On Debian-based Linux distributions such as Ubuntu, the `/etc/timezone` file was previously used to determine the JDK's default time zone (`TimeZone.getDefault()`). According to [Debian's Wiki](https://wiki.debian.org/TimeZoneChanges#Check_Configured_Timezone), `/etc/localtime` is now the primary source for the system's default time zone, making `/etc/timezone` redundant. As a result, the JDK's default time zone detection logic has been updated to use `/etc/localtime` instead of `/etc/timezone`. If `/etc/localtime` and `/etc/timezone` are inconsistent for any reason, the JDK's default time zone is now determined solely based on `/etc/localtime` file. + +security-libs/java.security + +**[➜](#JDK-8368032) Filter Rules for URIs in the Authority Info Access Extension for Certificates** (JDK-8368032 (not public)) + +A new system and security property, `com.sun.security.allowedAIALocations`, has been introduced. This property allows users the ability to define one or more filtering rules to be applied to URIs obtained from the authority info access extension on X.509 certificates. These filter rules are applied specifically to the CA issuers access method. Any CA issuers URIs in X.509 certificates are only followed when the `com.sun.security.enableAIAcaIssuers` system property is enabled and the filter allows the URI. + +In order to set the rules, the user must set either the `com.sun.security.allowedAIALocations` security property or the system property by the same name. If the system property has a value, it will override the security property. By default the property is blank, which enacts a deny-all ruleset. + +For either property, the value consists of a set of space-separated rules that take the form of a URI, with the following constraints: + +* The URI must be absolute and hierarchical. +* The URI must only use one of the following schemes: http, https, ldap, or ftp (case-insensitive). +* A hostname or address must be specified and must match (case-insensitive). No name resolution is performed on hostnames to match URIs with IP addresses. +* The port number must match. Where a port number is omitted, the well-known port will be used in the comparison. +* For hierarchical schemes (http[s], ftp): + + A rule's normalized path portion of the URI is matched in a case-sensitive manner. If the final component does not end in a slash (/), it is considered to be a file path and must match the CA issuer URI path component. If the rule's path component ends in a slash, then it must match or be a prefix of the CA issuer URI path component. (for example, a filter path of `/ab/cd/` will match a CA issuer path of `/ab/cd/`, `/ab/cd/ef` and `/ab/cd/ef/ghi`.). + + Query strings and fragments will be ignored when matching CA issuer URIs. +* For ldap URIs: + + The base DN must be an exact match (case-insensitive). + + Any query string in the rule, if specified, will be ignored. + +For the properties, a single value of "any" (case-insensitive) will create an allow-all rule. + +#### Bug Fixes + +This release also contains fixes for security vulnerabilities described in the [Oracle Critical Patch Update](https://www.oracle.com/security-alerts/cpujan2026.html#AppendixJAVA). + +➜ Issues fixed in 17.0.18: + +| # | JBS | Component | Summary | +| --- | --- | --- | --- | +| 1 | [JDK-8292214](https://bugs.java/bugdatabase/JDK-8292214) | client-libs/2d | Memory leak in getAllConfigs of awt\_GraphicsEnv.c:386 | +| 2 | [JDK-8334509](https://bugs.java/bugdatabase/JDK-8334509) | client-libs/2d | Cancelling PageDialog does not return the same PageFormat object | +| 3 | [JDK-8361748](https://bugs.java/bugdatabase/JDK-8361748) | client-libs/2d | Enforce limits on the size of an XBM image | +| 4 | [JDK-8286159](https://bugs.java/bugdatabase/JDK-8286159) | client-libs/java.awt | Memory leak in getAllConfigs of awt\_GraphicsEnv.c:585 | +| 5 | [JDK-8324491](https://bugs.java/bugdatabase/JDK-8324491) | client-libs/java.awt | Keyboard layout didn't keep its state if it was changed when dialog was active | +| 6 | [JDK-8354646](https://bugs.java/bugdatabase/JDK-8354646) | client-libs/java.awt | java.awt.TextField allows to identify the spaces in a password when double clicked at the starting and end of the text | +| 7 | [JDK-8281523](https://bugs.java/bugdatabase/JDK-8281523) | client-libs/javax.accessibility | Accessibility: Conversion from string literal loses const qualifier | +| 8 | [JDK-8140527](https://bugs.java/bugdatabase/JDK-8140527) | client-libs/javax.swing | JInternalFrame has incorrect title button width | +| 9 | [JDK-8236907](https://bugs.java/bugdatabase/JDK-8236907) | client-libs/javax.swing | JTable added to nested panels does not paint last visible row | +| 10 | [JDK-8139228](https://bugs.java/bugdatabase/JDK-8139228) | client-libs/javax.swing | JFileChooser renders file names as HTML document | +| 11 | [JDK-8358532](https://bugs.java/bugdatabase/JDK-8358532) | client-libs/javax.swing | JFileChooser in GTK L&F still displays HTML filename | +| 12 | [JDK-8210807](https://bugs.java/bugdatabase/JDK-8210807) | client-libs/javax.swing | Printing a JTable with a JScrollPane prints table without rows populated | +| 13 | [JDK-8257810](https://bugs.java/bugdatabase/JDK-8257810) | client-libs/javax.swing | Only First page are printed in JTable.scrollRectToVisible | +| 14 | [JDK-8322135](https://bugs.java/bugdatabase/JDK-8322135) | client-libs/javax.swing | Printing JTable in Windows L&F throws InternalError: HTHEME is null | +| 15 | [JDK-8349188](https://bugs.java/bugdatabase/JDK-8349188) | client-libs/javax.swing | LineBorder does not scale correctly | +| 16 | [JDK-8358813](https://bugs.java/bugdatabase/JDK-8358813) | client-libs/javax.swing | JPasswordField identifies spaces in password via delete shortcuts | +| 17 | [JDK-8370465](https://bugs.java/bugdatabase/JDK-8370465) | client-libs/javax.swing | Right to Left Orientation Issues with MenuItem Component | +| 18 | [JDK-8307990](https://bugs.java/bugdatabase/JDK-8307990) | core-libs/java.lang | jspawnhelper must close its writing side of a pipe before reading from it | +| 19 | [JDK-8311645](https://bugs.java/bugdatabase/JDK-8311645) | core-libs/java.lang | Memory leak in jspawnhelper spawnChild after JDK-8307990 | +| 20 | [JDK-8280124](https://bugs.java/bugdatabase/JDK-8280124) | core-libs/java.lang | Reduce branches decoding latin-1 chars from UTF-8 encoded bytes | +| 21 | [JDK-8282047](https://bugs.java/bugdatabase/JDK-8282047) | core-libs/java.lang | Enhance StringDecode/Encode microbenchmarks | +| 22 | [JDK-8365086](https://bugs.java/bugdatabase/JDK-8365086) | core-libs/java.net | CookieStore.getURIs() and get(URI) should return an immutable List | +| 23 | [JDK-8369184](https://bugs.java/bugdatabase/JDK-8369184) | core-libs/java.util:i18n | SimpleTimeZone equals() Returns True for Unequal Instances with Different hashCode Values | +| 24 | [JDK-8328085](https://bugs.java/bugdatabase/JDK-8328085) | hotspot/compiler | C2: Use after free in PhaseChaitin::Register\_Allocate() | +| 25 | [JDK-8364993](https://bugs.java/bugdatabase/JDK-8364993) | hotspot/jfr | JFR: Disable jdk.ModuleExport in default.jfc | +| 26 | [JDK-8364556](https://bugs.java/bugdatabase/JDK-8364556) | hotspot/jfr | JFR: Disable SymbolTableStatistics and StringTableStatistics in default.jfc | +| 27 | [JDK-8369992](https://bugs.java/bugdatabase/JDK-8369992) | hotspot/jfr | JFR: Disable Placeholder-, LoaderConstraints- and ProtectionDomainCacheTableStatistics in default.jfc | +| 28 | [JDK-8328997](https://bugs.java/bugdatabase/JDK-8328997) | hotspot/runtime | Remove unnecessary template parameter lists in GrowableArray | +| 29 | [JDK-8317132](https://bugs.java/bugdatabase/JDK-8317132) | hotspot/runtime | Prepare HotSpot for permissive- | +| 30 | [JDK-8361447](https://bugs.java/bugdatabase/JDK-8361447) | hotspot/runtime | [REDO] Checked version of JNI ReleaseArrayElements needs to filter out known wrapped arrays | +| 31 | [JDK-8364235](https://bugs.java/bugdatabase/JDK-8364235) | hotspot/runtime | Fix for JDK-8361447 breaks the alignment requirements for GuardedMemory | +| 32 | [JDK-8364660](https://bugs.java/bugdatabase/JDK-8364660) | hotspot/runtime | ClassVerifier::ends\_in\_athrow() should be removed | +| 33 | [JDK-8306579](https://bugs.java/bugdatabase/JDK-8306579) | infrastructure/other | Consider building with /Zc:throwingNew | +| 34 | [JDK-8317332](https://bugs.java/bugdatabase/JDK-8317332) | security-libs/java.security | Prepare security for permissive- | +| 35 | [JDK-8325680](https://bugs.java/bugdatabase/JDK-8325680) | security-libs/org.ietf.jgss | Uninitialised memory in deleteGSSCB of GSSLibStub.c:179 | +| 36 | [JDK-8365790](https://bugs.java/bugdatabase/JDK-8365790) | tools/jpackage | Shutdown hook for application image does not work on Windows | + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_1702.md b/corpus/changelog/java_jdk_releases/java_jdk_1702.md new file mode 100644 index 0000000000000000000000000000000000000000..5c9df0a9e07db087283e9d2f866ce86814dcb8d7 --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_1702.md @@ -0,0 +1,300 @@ +# Java_JDK 17.0.2 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/17-0-2-relnotes.html +Version: 17.0.2 + +## Java™ SE Development Kit 17.0.2 (JDK 17.0.2) + +January 18, 2022 + +The full version string for this update release is 17.0.2+8 (where "+" means "build"). The version number is 17.0.2. + +#### IANA TZ Data 2021b, 2021c, 2021d, 2021e + +JDK 17.0.2 contains IANA time zone data [2021b](https://mm.icann.org/pipermail/tz-announce/2021-September/000066.html), [2021c](https://mm.icann.org/pipermail/tz-announce/2021-October/000067.html), [2021d](https://mm.icann.org/pipermail/tz-announce/2021-October/000068.html), [2021e](https://mm.icann.org/pipermail/tz-announce/2021-October/000069.html). + +* Jordan now starts DST on February's last Thursday. +* Samoa no longer observes DST. +* Merge more location-based Zones whose timestamps agree since 1970. +* Move some backward-compatibility links to 'backward'. +* Rename Pacific/Enderbury to Pacific/Kanton. +* Correct many pre-1993 transitions in Malawi, Portugal, etc. +* zic now creates each output file or link atomically. +* zic -L no longer omits the POSIX TZ string in its output. +* zic fixes for truncation and leap second table expiration. +* zic now follows POSIX for TZ strings using all-year DST. +* Fix some localtime crashes and bugs in obscure cases. +* zdump -v now outputs more-useful boundary cases. +* tzfile.5 better matches a draft successor to RFC 8536. +* A new file SECURITY. +* Revert most 2021b changes to 'backward'. +* Fix 'zic -b fat' bug in pre-1970 32-bit data. +* Fix two Link line typos. +* Distribute SECURITY file. + +This release is intended as a bugfix release, to fix compatibility problems and typos reported since 2021b was released. + +* Fiji suspends DST for the 2021/2022 season. +* 'zic -r' marks unspecified timestamps with "-00". +* Palestine will fall back 10-29 (not 10-30) at 01:00. + +For more information, refer to [Timezone Data Versions in the JRE Software](https://www.oracle.com/java/technologies/tzdata-versions.html). + +#### Security Baselines + +The security baselines for the Java Runtime Environment (JRE) at the time of the release of JDK 17.0.2 are specified in the following table: + +| **JRE Family Version** | **JRE Security Baseline (Full Version String)** | +| --- | --- | +| 17 | 17.0.2+8 | +| 11 | 11.0.14+8 | +| 8 | 8u321-b07 | +| 7 | 7u331-b06 | + +#### Keeping the JDK up to Date + +Oracle recommends that the JDK is updated with each Critical Patch Update. +In order to determine if a release is the latest, the [Security Baseline](https://javadl-esd-secure.oracle.com/update/baseline.version) page can +be used to determine which is the latest version for each release family. + +Critical patch updates, which contain security vulnerability fixes, are announced one year in advance on +Critical Patch Updates, Security Alerts and Bulletins. +It is not recommended that this JDK (version 17.0.2) be used after the next critical patch update scheduled +for April 19, 2022. + +#### Removed Features and Options + +security-libs/java.security + +**[➜](#JDK-8274215) Removed Google's GlobalSign Root Certificate** + +The following root certificate from Google has been removed from the `cacerts` keystore: + +```None ++ alias name "globalsignr2ca [jdk]" + + Distinguished Name: CN=GlobalSign, O=GlobalSign, OU=GlobalSign Root CA - R2 +``` + +See [JDK-8274215](https://bugs.openjdk.java.net/browse/JDK-8274215) + +#### Other Notes + +install/install + +**[➜](#JDK-8274002) Extended Delay Before JDK Executable Installer Starts From Network Drive** + +On Windows 11 and Windows Server 2022, there can be some slowness with the extraction of temporary installation files when launched from a mapped network drive. The installer will still work, but there can be a temporary delay. + +JDK-8274002 (not public) + +core-libs/java.io + +**[➜](#JDK-8275145) file.encoding System Property Has an Incorrect Value on Windows** + +The initialization of the `file.encoding` system property on non macOS platforms has been reverted to align with the behavior on or before JDK 11. This has been an issue especially on Windows where the system and user's locales are not the same. + +See [JDK-8275145](https://bugs.openjdk.java.net/browse/JDK-8275145) + +core-libs/java.nio + +**[➜](#JDK-8251329) Zip File System Provider Throws ZipException When Entry Name Element Contains "." or ".."** + +The ZIP file system provider has been changed to reject existing ZIP files that contain entries with "." or ".." in name elements. ZIP files with these entries cannot be used as a file system. Invoking the `java.nio.file.FileSystems.newFileSystem(...)` methods throw `ZipException` if the ZIP file contains these entries. + +See [JDK-8251329](https://bugs.openjdk.java.net/browse/JDK-8251329) + +core-libs/java.time + +**[➜](#JDK-8274407) Update Timezone Data to 2021c** + +IANA Time Zone Database, on which JDK's Date/Time libraries are based, has made a tweak to some time zone rules since [2021c](https://mm.icann.org/pipermail/tz-announce/2021-October/000067.html). Note that since this update, some of the time zone rules prior to the year 1970 have been modified according to the changes which were introduced with 2021b. For more detail, refer to the announcement of [2021b](https://mm.icann.org/pipermail/tz-announce/2021-September/000066.html) + +See [JDK-8274407](https://bugs.openjdk.java.net/browse/JDK-8274407) + +hotspot/gc + +**[➜](#JDK-8277212) ZGC: Fixed long Process Non-Strong References times** + +A bug has been fixed that could cause long "Concurrent Process Non-Strong References" times with ZGC. The bug blocked the GC from making significant progress, and caused both latency and throughput issues for the Java application. + +The long times could be seen in the GC logs when running with `-Xlog:gc*`: + +```None +[17606.140s][info][gc,phases ] GC(719) Concurrent Process Non-Strong References 25781.928ms +``` + +See [JDK-8277212](https://bugs.openjdk.java.net/browse/JDK-8277212) + +#### Bug Fixes + +This release also contains fixes for security vulnerabilities described in the [Oracle Critical Patch Update](https://www.oracle.com/security-alerts/cpuOct2022.html#AppendixJAVA). + +➜ Issues fixed in 17.0.2: + +| # | JBS | Component | Subcomponent | Sumary | +| --- | --- | --- | --- | --- | +| 1 | [JDK-8269637](https://bugs.openjdk.java.net/browse/JDK-8269637) | client-libs | | javax/swing/JFileChooser/FileSystemView/SystemIconTest.java fails on windows | +| 2 | [JDK-8262031](https://bugs.openjdk.java.net/browse/JDK-8262031) | client-libs | | Create implementation for NSAccessibilityNavigableStaticText protocol | +| 3 | [JDK-8267387](https://bugs.openjdk.java.net/browse/JDK-8267387) | client-libs | | Create implementation for NSAccessibilityOutline protocol | +| 4 | [JDK-8275872](https://bugs.openjdk.java.net/browse/JDK-8275872) | client-libs | 2d | Sync J2DBench run and analyze Makefile targets with build.xml | +| 5 | [JDK-8271718](https://bugs.openjdk.java.net/browse/JDK-8271718) | client-libs | 2d | Crash when during color transformation the color profile is replaced | +| 6 | [JDK-8273135](https://bugs.openjdk.java.net/browse/JDK-8273135) | client-libs | 2d | java/awt/color/ICC\_ColorSpace/MTTransformReplacedProfile.java crashes in liblcms.dylib with NULLSeek+0x7 | +| 7 | [JDK-8273887](https://bugs.openjdk.java.net/browse/JDK-8273887) | client-libs | 2d | [macos] java/awt/color/ICC\_ColorSpace/MTTransformReplacedProfile.java timed out | +| 8 | [JDK-8276905](https://bugs.openjdk.java.net/browse/JDK-8276905) | client-libs | 2d | Use appropriate macosx\_version\_minimum value while compiling metal shaders | +| 9 | [JDK-8273808](https://bugs.openjdk.java.net/browse/JDK-8273808) | client-libs | java.awt | Cleanup AddFontsToX11FontPath | +| 10 | [JDK-8275131](https://bugs.openjdk.java.net/browse/JDK-8275131) | client-libs | java.awt | Exceptions after a touchpad gesture on macOS | +| 11 | [JDK-8274326](https://bugs.openjdk.java.net/browse/JDK-8274326) | client-libs | javax.accessibility | [macos] Ensure initialisation of sun/lwawt/macosx/CAccessibility in JavaComponentAccessibility.m | +| 12 | [JDK-8274056](https://bugs.openjdk.java.net/browse/JDK-8274056) | client-libs | javax.accessibility | JavaAccessibilityUtilities leaks JNI objects | +| 13 | [JDK-8274381](https://bugs.openjdk.java.net/browse/JDK-8274381) | client-libs | javax.accessibility | missing CAccessibility definitions in JNI code | +| 14 | [JDK-8267385](https://bugs.openjdk.java.net/browse/JDK-8267385) | client-libs | javax.accessibility | Create NSAccessibilityElement implementation for JavaComponentAccessibility | +| 15 | [JDK-8267388](https://bugs.openjdk.java.net/browse/JDK-8267388) | client-libs | javax.accessibility | Create implementation for NSAccessibilityTable protocol | +| 16 | [JDK-8274383](https://bugs.openjdk.java.net/browse/JDK-8274383) | client-libs | javax.accessibility | JNI call of getAccessibleSelection on a wrong thread | +| 17 | [JDK-8277195](https://bugs.openjdk.java.net/browse/JDK-8277195) | client-libs | javax.accessibility | missing CAccessibility definition in [CommonComponentAccessibility accessibilityHitTest] | +| 18 | [JDK-8271071](https://bugs.openjdk.java.net/browse/JDK-8271071) | client-libs | javax.accessibility | accessibility of a table on macOS lacks cell navigation | +| 19 | [JDK-8275809](https://bugs.openjdk.java.net/browse/JDK-8275809) | client-libs | javax.accessibility | crash in [CommonComponentAccessibility getCAccessible:withEnv:] | +| 20 | [JDK-8273678](https://bugs.openjdk.java.net/browse/JDK-8273678) | client-libs | javax.accessibility | TableAccessibility and TableRowAccessibility miss autorelease | +| 21 | [JDK-8275071](https://bugs.openjdk.java.net/browse/JDK-8275071) | client-libs | javax.accessibility | [macos] A11y cursor gets stuck when combobox is closed | +| 22 | [JDK-8275819](https://bugs.openjdk.java.net/browse/JDK-8275819) | client-libs | javax.accessibility | [TableRowAccessibility accessibilityChildren] method is ineffective | +| 23 | [JDK-8270893](https://bugs.openjdk.java.net/browse/JDK-8270893) | client-libs | javax.imageio | IndexOutOfBoundsException while reading large TIFF file | +| 24 | [JDK-8269951](https://bugs.openjdk.java.net/browse/JDK-8269951) | client-libs | javax.swing | [macos] Focus not painted in JButton when setBorderPainted(false) is invoked | +| 25 | [JDK-8266510](https://bugs.openjdk.java.net/browse/JDK-8266510) | client-libs | javax.swing | Nimbus JTree default tree cell renderer does not use selected text color | +| 26 | [JDK-8271895](https://bugs.openjdk.java.net/browse/JDK-8271895) | client-libs | javax.swing | UnProblemList javax/swing/JComponent/7154030/bug7154030.java in JDK18 | +| 27 | [JDK-8268284](https://bugs.openjdk.java.net/browse/JDK-8268284) | client-libs | javax.swing | javax/swing/JComponent/7154030/bug7154030.java fails with "Exception: Failed to hide opaque button" | +| 28 | [JDK-8264287](https://bugs.openjdk.java.net/browse/JDK-8264287) | client-libs | javax.swing | Create implementation for NSAccessibilityComboBox protocol peer | +| 29 | [JDK-8264303](https://bugs.openjdk.java.net/browse/JDK-8264303) | client-libs | javax.swing | Create implementation for NSAccessibilityTabGroup protocol peer | +| 30 | [JDK-8264292](https://bugs.openjdk.java.net/browse/JDK-8264292) | client-libs | javax.swing | Create implementation for NSAccessibilityList protocol peer | +| 31 | [JDK-8264286](https://bugs.openjdk.java.net/browse/JDK-8264286) | client-libs | javax.swing | Create implementation for NSAccessibilityColumn protocol peer | +| 32 | [JDK-8264291](https://bugs.openjdk.java.net/browse/JDK-8264291) | client-libs | javax.swing | Create implementation for NSAccessibilityCell protocol peer | +| 33 | [JDK-8264298](https://bugs.openjdk.java.net/browse/JDK-8264298) | client-libs | javax.swing | Create implementation for NSAccessibilityRow protocol peer | +| 34 | [JDK-8271315](https://bugs.openjdk.java.net/browse/JDK-8271315) | client-libs | javax.swing | Redo: Nimbus JTree renderer properties persist across L&F changes | +| 35 | [JDK-8264293](https://bugs.openjdk.java.net/browse/JDK-8264293) | client-libs | javax.swing | Create implementation for NSAccessibilityMenu protocol peer | +| 36 | [JDK-8264295](https://bugs.openjdk.java.net/browse/JDK-8264295) | client-libs | javax.swing | Create implementation for NSAccessibilityMenuItem protocol peer | +| 37 | [JDK-8264294](https://bugs.openjdk.java.net/browse/JDK-8264294) | client-libs | javax.swing | Create implementation for NSAccessibilityMenuBar protocol peer | +| 38 | [JDK-8264296](https://bugs.openjdk.java.net/browse/JDK-8264296) | client-libs | javax.swing | Create implementation for NSAccessibilityPopUpButton protocol peer | +| 39 | [JDK-8264297](https://bugs.openjdk.java.net/browse/JDK-8264297) | client-libs | javax.swing | Create implementation for NSAccessibilityProgressIndicator protocol peer | +| 40 | [JDK-8269850](https://bugs.openjdk.java.net/browse/JDK-8269850) | core-libs | | Most JDK releases report macOS version 12 as 10.16 instead of 12.0 | +| 41 | [JDK-8276572](https://bugs.openjdk.java.net/browse/JDK-8276572) | core-libs | | Fake libsyslookup.so library causes tooling issues | +| 42 | [JDK-8273450](https://bugs.openjdk.java.net/browse/JDK-8273450) | core-libs | | Fix the copyright header of SVML files | +| 43 | [JDK-8275145](https://bugs.openjdk.java.net/browse/JDK-8275145) | core-libs | java.io | file.encoding system property has an incorrect value on Windows | +| 44 | [JDK-8277093](https://bugs.openjdk.java.net/browse/JDK-8277093) | core-libs | java.io:serialization | Vector should throw ClassNotFoundException for a missing class of an element | +| 45 | [JDK-8275703](https://bugs.openjdk.java.net/browse/JDK-8275703) | core-libs | java.lang | System.loadLibrary fails on Big Sur for libraries hidden from filesystem | +| 46 | [JDK-8274848](https://bugs.openjdk.java.net/browse/JDK-8274848) | core-libs | java.lang.invoke | LambdaMetaFactory::metafactory on REF\_invokeSpecial impl method has incorrect behavior | +| 47 | [JDK-8270290](https://bugs.openjdk.java.net/browse/JDK-8270290) | core-libs | java.net | NTLM authentication fails if HEAD request is used | +| 48 | [JDK-8274779](https://bugs.openjdk.java.net/browse/JDK-8274779) | core-libs | java.net | HttpURLConnection: HttpClient and HttpsClient incorrectly check request method when set to POST | +| 49 | [JDK-8267256](https://bugs.openjdk.java.net/browse/JDK-8267256) | core-libs | java.net | Extend minimal retry for loopback connections on Windows to PlainSocketImpl | +| 50 | [JDK-8268294](https://bugs.openjdk.java.net/browse/JDK-8268294) | core-libs | java.net | Reusing HttpClient in a WebSocket.Listener hangs. | +| 51 | [JDK-8269481](https://bugs.openjdk.java.net/browse/JDK-8269481) | core-libs | java.net | SctpMultiChannel never releases own file descriptor | +| 52 | [JDK-8251329](https://bugs.openjdk.java.net/browse/JDK-8251329) | core-libs | java.nio | (zipfs) Files.walkFileTree walks infinitely if zip has dir named "." inside | +| 53 | [JDK-8273935](https://bugs.openjdk.java.net/browse/JDK-8273935) | core-libs | java.nio | (zipfs) Files.getFileAttributeView() throws UOE instead of returning null when view not supported | +| 54 | [JDK-8269280](https://bugs.openjdk.java.net/browse/JDK-8269280) | core-libs | java.nio | (bf) Replace StringBuffer in \*Buffer.toString() | +| 55 | [JDK-8190753](https://bugs.openjdk.java.net/browse/JDK-8190753) | core-libs | java.nio | (zipfs): Accessing a large entry (> 2^31 bytes) leads to a negative initial size for ByteArrayOutputStream | +| 56 | [JDK-8271308](https://bugs.openjdk.java.net/browse/JDK-8271308) | core-libs | java.nio | (fc) FileChannel.transferTo() transfers no more than Integer.MAX\_VALUE bytes in one call | +| 57 | [JDK-8233020](https://bugs.openjdk.java.net/browse/JDK-8233020) | core-libs | java.nio | (fs) UnixFileSystemProvider should use StaticProperty.userDir(). | +| 58 | [JDK-8272095](https://bugs.openjdk.java.net/browse/JDK-8272095) | core-libs | java.nio | ProblemList java/nio/channels/FileChannel/Transfer2GPlus.java on linux-aarch64 | +| 59 | [JDK-8140241](https://bugs.openjdk.java.net/browse/JDK-8140241) | core-libs | java.nio | (fc) Data transfer from FileChannel to itself causes hang in case of overlap | +| 60 | [JDK-8274468](https://bugs.openjdk.java.net/browse/JDK-8274468) | core-libs | java.time | TimeZoneTest.java fails with tzdata2021b | +| 61 | [JDK-8274467](https://bugs.openjdk.java.net/browse/JDK-8274467) | core-libs | java.time | TestZoneInfo310.java fails with tzdata2021b | +| 62 | [JDK-8276536](https://bugs.openjdk.java.net/browse/JDK-8276536) | core-libs | java.time | Update TimeZoneNames files to follow the changes made by JDK-8275766 | +| 63 | [JDK-8272473](https://bugs.openjdk.java.net/browse/JDK-8272473) | core-libs | java.time | Parsing epoch seconds at a DST transition with a non-UTC parser is wrong | +| 64 | [JDK-8274349](https://bugs.openjdk.java.net/browse/JDK-8274349) | core-libs | java.util.concurrent | ForkJoinPool.commonPool() does not work with 1 CPU | +| 65 | [JDK-8214761](https://bugs.openjdk.java.net/browse/JDK-8214761) | core-libs | java.util.stream | Bug in parallel Kahan summation implementation | +| 66 | [JDK-8273790](https://bugs.openjdk.java.net/browse/JDK-8273790) | core-libs | java.util:i18n | Potential cyclic dependencies between Gregorian and CalendarSystem | +| 67 | [JDK-8273924](https://bugs.openjdk.java.net/browse/JDK-8273924) | core-libs | java.util:i18n | ArrayIndexOutOfBoundsException thrown in java.util.JapaneseImperialCalendar.add() | +| 68 | [JDK-8273575](https://bugs.openjdk.java.net/browse/JDK-8273575) | core-svc | java.lang.instrument | memory leak in appendBootClassPath(), paths must be deallocated | +| 69 | [JDK-8268361](https://bugs.openjdk.java.net/browse/JDK-8268361) | core-svc | java.lang.management | Fix the infinite loop in next\_line | +| 70 | [JDK-8272318](https://bugs.openjdk.java.net/browse/JDK-8272318) | core-svc | tools | Improve performance of HeapDumpAllTest | +| 71 | [JDK-8272970](https://bugs.openjdk.java.net/browse/JDK-8272970) | hotspot | | Parallelize runtime/InvocationTests/ | +| 72 | [JDK-8273278](https://bugs.openjdk.java.net/browse/JDK-8273278) | hotspot | | Support XSLT on GraalVM Native Image--deterministic bytecode generation in XSLT | +| 73 | [JDK-8270886](https://bugs.openjdk.java.net/browse/JDK-8270886) | hotspot | compiler | Crash in PhaseIdealLoop::verify\_strip\_mined\_scheduling | +| 74 | [JDK-8271600](https://bugs.openjdk.java.net/browse/JDK-8271600) | hotspot | compiler | C2: CheckCastPP which should closely follow Allocate is sunk of a loop | +| 75 | [JDK-8223923](https://bugs.openjdk.java.net/browse/JDK-8223923) | hotspot | compiler | C2: Missing interference with mismatched unsafe accesses | +| 76 | [JDK-8272570](https://bugs.openjdk.java.net/browse/JDK-8272570) | hotspot | compiler | C2: crash in PhaseCFG::global\_code\_motion | +| 77 | [JDK-8271341](https://bugs.openjdk.java.net/browse/JDK-8271341) | hotspot | compiler | Opcode() != Op\_If && Opcode() != Op\_RangeCheck) || outcnt() == 2 assert failure with Test7179138\_1.java | +| 78 | [JDK-8271340](https://bugs.openjdk.java.net/browse/JDK-8271340) | hotspot | compiler | Crash PhaseIdealLoop::clone\_outer\_loop | +| 79 | [JDK-8271459](https://bugs.openjdk.java.net/browse/JDK-8271459) | hotspot | compiler | C2: Missing NegativeArraySizeException when creating StringBuilder with negative capacity | +| 80 | [JDK-8273165](https://bugs.openjdk.java.net/browse/JDK-8273165) | hotspot | compiler | GraphKit::combine\_exception\_states fails with "matching stack sizes" assert | +| 81 | [JDK-8272562](https://bugs.openjdk.java.net/browse/JDK-8272562) | hotspot | compiler | C2: assert(false) failed: Bad graph detected in build\_loop\_late | +| 82 | [JDK-8274145](https://bugs.openjdk.java.net/browse/JDK-8274145) | hotspot | compiler | C2: condition incorrectly made redundant with dominating main loop exit condition | +| 83 | [JDK-8274074](https://bugs.openjdk.java.net/browse/JDK-8274074) | hotspot | compiler | SIGFPE with C2 compiled code with -XX:+StressGCM | +| 84 | [JDK-8274401](https://bugs.openjdk.java.net/browse/JDK-8274401) | hotspot | compiler | C2: GraphKit::load\_array\_element bypasses Access API | +| 85 | [JDK-8274406](https://bugs.openjdk.java.net/browse/JDK-8274406) | hotspot | compiler | RunThese30M.java failed "assert(!LCA\_orig->dominates(pred\_block) || early->dominates(pred\_block)) failed: early is high enough" | +| 86 | [JDK-8276066](https://bugs.openjdk.java.net/browse/JDK-8276066) | hotspot | compiler | Reset LoopPercentProfileLimit for x86 due to suboptimal performance | +| 87 | [JDK-8270901](https://bugs.openjdk.java.net/browse/JDK-8270901) | hotspot | compiler | Typo PHASE\_CPP in CompilerPhaseType | +| 88 | [JDK-8273021](https://bugs.openjdk.java.net/browse/JDK-8273021) | hotspot | compiler | C2: Improve Add and Xor ideal optimizations | +| 89 | [JDK-8275104](https://bugs.openjdk.java.net/browse/JDK-8275104) | hotspot | compiler | IR framework does not handle client VM builds correctly | +| 90 | [JDK-8276105](https://bugs.openjdk.java.net/browse/JDK-8276105) | hotspot | compiler | C2: Conv(D|F)2(I|L)Nodes::Ideal should handle rounding correctly | +| 91 | [JDK-8276846](https://bugs.openjdk.java.net/browse/JDK-8276846) | hotspot | compiler | JDK-8273416 is incomplete for UseSSE=1 | +| 92 | [JDK-8276112](https://bugs.openjdk.java.net/browse/JDK-8276112) | hotspot | compiler | Inconsistent scalar replacement debug info at safepoints | +| 93 | [JDK-8276025](https://bugs.openjdk.java.net/browse/JDK-8276025) | hotspot | compiler | Hotspot's libsvml.so may conflict with user dependency | +| 94 | [JDK-8270533](https://bugs.openjdk.java.net/browse/JDK-8270533) | hotspot | compiler | AArch64: size\_fits\_all\_mem\_uses should return false if its output is a CAS | +| 95 | [JDK-8273416](https://bugs.openjdk.java.net/browse/JDK-8273416) | hotspot | compiler | C2: assert(false) failed: bad AD file after JDK-8252372 with UseSSE={0,1} | +| 96 | [JDK-8273359](https://bugs.openjdk.java.net/browse/JDK-8273359) | hotspot | compiler | CI: ciInstanceKlass::get\_canonical\_holder() doesn't respect instance size | +| 97 | [JDK-8244675](https://bugs.openjdk.java.net/browse/JDK-8244675) | hotspot | compiler | assert(IncrementalInline || (\_late\_inlines.length() == 0 && !has\_mh\_late\_inlines())) | +| 98 | [JDK-8272703](https://bugs.openjdk.java.net/browse/JDK-8272703) | hotspot | compiler | StressSeed should be set via FLAG\_SET\_ERGO | +| 99 | [JDK-8271954](https://bugs.openjdk.java.net/browse/JDK-8271954) | hotspot | compiler | C2: assert(false) failed: Bad graph detected in build\_loop\_late | +| 100 | [JDK-8272413](https://bugs.openjdk.java.net/browse/JDK-8272413) | hotspot | compiler | Incorrect num of element count calculation for vector cast | +| 101 | [JDK-8272574](https://bugs.openjdk.java.net/browse/JDK-8272574) | hotspot | compiler | C2: assert(false) failed: Bad graph detected in build\_loop\_late | +| 102 | [JDK-8276157](https://bugs.openjdk.java.net/browse/JDK-8276157) | hotspot | compiler | C2: Compiler stack overflow during escape analysis on Linux x86\_32 | +| 103 | [JDK-8268882](https://bugs.openjdk.java.net/browse/JDK-8268882) | hotspot | compiler | C2: assert(n->outcnt() != 0 || C->top() == n || n->is\_Proj()) failed: No dead instructions after post-alloc | +| 104 | [JDK-8271567](https://bugs.openjdk.java.net/browse/JDK-8271567) | hotspot | compiler | AArch64: AES Galois CounterMode (GCM) interleaved implementation using vector instructions | +| 105 | [JDK-8271215](https://bugs.openjdk.java.net/browse/JDK-8271215) | hotspot | gc | Fix data races in G1PeriodicGCTask | +| 106 | [JDK-8274501](https://bugs.openjdk.java.net/browse/JDK-8274501) | hotspot | gc | c2i entry barriers read int as long on AArch64 | +| 107 | [JDK-8271862](https://bugs.openjdk.java.net/browse/JDK-8271862) | hotspot | gc | C2 intrinsic for Reference.refersTo() is often not used | +| 108 | [JDK-8271121](https://bugs.openjdk.java.net/browse/JDK-8271121) | hotspot | gc | ZGC: stack overflow (segv) when -Xlog:gc+start=debug | +| 109 | [JDK-8272170](https://bugs.openjdk.java.net/browse/JDK-8272170) | hotspot | gc | Missing memory barrier when checking active state for regions | +| 110 | [JDK-8277212](https://bugs.openjdk.java.net/browse/JDK-8277212) | hotspot | gc | GC accidentally cleans valid megamorphic vtable inline caches | +| 111 | [JDK-8275426](https://bugs.openjdk.java.net/browse/JDK-8275426) | hotspot | gc | PretouchTask num\_chunks calculation can overflow | +| 112 | [JDK-8274435](https://bugs.openjdk.java.net/browse/JDK-8274435) | hotspot | jfr | EXCEPTION\_ACCESS\_VIOLATION in BFSClosure::closure\_impl | +| 113 | [JDK-8272850](https://bugs.openjdk.java.net/browse/JDK-8272850) | hotspot | runtime | Drop zapping values in the Zap\* option descriptions | +| 114 | [JDK-8273606](https://bugs.openjdk.java.net/browse/JDK-8273606) | hotspot | runtime | Zero: SPARC64 build fails with si\_band type mismatch | +| 115 | [JDK-8273373](https://bugs.openjdk.java.net/browse/JDK-8273373) | hotspot | runtime | Zero: Cannot invoke JVM in primordial threads on Zero | +| 116 | [JDK-8273505](https://bugs.openjdk.java.net/browse/JDK-8273505) | hotspot | runtime | runtime/cds/appcds/loaderConstraints/DynamicLoaderConstraintsTest.java#default-cl crashed with SIGSEGV in MetaspaceShared::link\_shared\_classes | +| 117 | [JDK-8273176](https://bugs.openjdk.java.net/browse/JDK-8273176) | hotspot | runtime | handle latest VS2019 in abstract\_vm\_version | +| 118 | [JDK-8273695](https://bugs.openjdk.java.net/browse/JDK-8273695) | hotspot | runtime | Safepoint deadlock on VMOperation\_lock | +| 119 | [JDK-8273489](https://bugs.openjdk.java.net/browse/JDK-8273489) | hotspot | runtime | Zero: Handle UseHeavyMonitors on all monitorenter paths | +| 120 | [JDK-8273229](https://bugs.openjdk.java.net/browse/JDK-8273229) | hotspot | runtime | Update OS detection code to recognize Windows Server 2022 | +| 121 | [JDK-8274840](https://bugs.openjdk.java.net/browse/JDK-8274840) | hotspot | runtime | Update OS detection code to recognize Windows 11 | +| 122 | [JDK-8273342](https://bugs.openjdk.java.net/browse/JDK-8273342) | hotspot | runtime | Null pointer dereference in classFileParser.cpp:2817 | +| 123 | [JDK-8272345](https://bugs.openjdk.java.net/browse/JDK-8272345) | hotspot | runtime | macos doesn't check `os::set\_boot\_path()` result | +| 124 | [JDK-8272114](https://bugs.openjdk.java.net/browse/JDK-8272114) | hotspot | runtime | Unused \_last\_state in osThread\_windows | +| 125 | [JDK-8274293](https://bugs.openjdk.java.net/browse/JDK-8274293) | hotspot | runtime | Build failure on macOS with Xcode 13.0 as vfork is deprecated | +| 126 | [JDK-8274338](https://bugs.openjdk.java.net/browse/JDK-8274338) | hotspot | runtime | com/sun/jdi/RedefineCrossEvent.java failed "assert(m != \_\_null) failed: NULL mirror" | +| 127 | [JDK-8238649](https://bugs.openjdk.java.net/browse/JDK-8238649) | hotspot | runtime | Call new Win32 API SetThreadDescription in os::set\_native\_thread\_name | +| 128 | [JDK-8261579](https://bugs.openjdk.java.net/browse/JDK-8261579) | hotspot | runtime | AArch64: Support for weaker memory ordering in Atomic | +| 129 | [JDK-8268927](https://bugs.openjdk.java.net/browse/JDK-8268927) | hotspot | runtime | Windows: link error: unresolved external symbol "int \_\_cdecl convert\_to\_unicode(char const \*,wchar\_t \* \*)" | +| 130 | [JDK-8273486](https://bugs.openjdk.java.net/browse/JDK-8273486) | hotspot | runtime | Zero: Handle DiagnoseSyncOnValueBasedClasses VM option | +| 131 | [JDK-8273483](https://bugs.openjdk.java.net/browse/JDK-8273483) | hotspot | runtime | Zero: Clear pending JNI exception check in native method handler | +| 132 | [JDK-8273440](https://bugs.openjdk.java.net/browse/JDK-8273440) | hotspot | runtime | Zero: Disable runtime/Unsafe/InternalErrorTest.java | +| 133 | [JDK-8273333](https://bugs.openjdk.java.net/browse/JDK-8273333) | hotspot | runtime | Zero should warn about unimplemented -XX:+LogTouchedMethods | +| 134 | [JDK-8268893](https://bugs.openjdk.java.net/browse/JDK-8268893) | hotspot | runtime | jcmd to trim the glibc heap | +| 135 | [JDK-8273902](https://bugs.openjdk.java.net/browse/JDK-8273902) | hotspot | runtime | Memory leak in OopStorage due to bug in OopHandle::release() | +| 136 | [JDK-8269687](https://bugs.openjdk.java.net/browse/JDK-8269687) | hotspot | runtime | pauth\_aarch64.hpp include name is incorrect | +| 137 | [JDK-8275604](https://bugs.openjdk.java.net/browse/JDK-8275604) | hotspot | runtime | Zero: Reformat opclabels\_data | +| 138 | [JDK-8277029](https://bugs.openjdk.java.net/browse/JDK-8277029) | hotspot | svc | JMM GetDiagnosticXXXInfo APIs should verify output array sizes | +| 139 | [JDK-8270320](https://bugs.openjdk.java.net/browse/JDK-8270320) | hotspot | test | JDK-8270110 committed invalid copyright headers | +| 140 | [JDK-8270946](https://bugs.openjdk.java.net/browse/JDK-8270946) | security-libs | java.security | X509CertImpl.getFingerprint should not return the empty String | +| 141 | [JDK-8273826](https://bugs.openjdk.java.net/browse/JDK-8273826) | security-libs | java.security | Correct Manifest file name and NPE checks | +| 142 | [JDK-8274215](https://bugs.openjdk.java.net/browse/JDK-8274215) | security-libs | java.security | Remove globalsignr2ca root from 17.0.2 | +| 143 | [JDK-8274736](https://bugs.openjdk.java.net/browse/JDK-8274736) | security-libs | java.security | Concurrent read/close of SSLSockets causes SSLSessions to be invalidated unnecessarily | +| 144 | [JDK-8277224](https://bugs.openjdk.java.net/browse/JDK-8277224) | security-libs | java.security | sun.security.pkcs.PKCS9Attributes.toString() throws NPE | +| 145 | [JDK-8270317](https://bugs.openjdk.java.net/browse/JDK-8270317) | security-libs | javax.net.ssl | Large Allocation in CipherSuite | +| 146 | [JDK-8275811](https://bugs.openjdk.java.net/browse/JDK-8275811) | security-libs | javax.net.ssl | Incorrect instance to dispose | +| 147 | [JDK-8273026](https://bugs.openjdk.java.net/browse/JDK-8273026) | security-libs | javax.security | Slow LoginContext.login() on multi threading application | +| 148 | [JDK-8274205](https://bugs.openjdk.java.net/browse/JDK-8274205) | security-libs | org.ietf.jgss:krb5 | Handle KDC\_ERR\_SVC\_UNAVAILABLE error code from KDC | +| 149 | [JDK-8273894](https://bugs.openjdk.java.net/browse/JDK-8273894) | security-libs | org.ietf.jgss:krb5 | ConcurrentModificationException raised every time ReferralsCache drops referral | +| 150 | [JDK-8273234](https://bugs.openjdk.java.net/browse/JDK-8273234) | tools | javac | extended 'for' with expression of type tvar causes the compiler to crash | +| 151 | [JDK-8262095](https://bugs.openjdk.java.net/browse/JDK-8262095) | tools | javac | NPE in Flow$FlowAnalyzer.visitApply: Cannot invoke getThrownTypes because tree.meth.type is null | +| 152 | [JDK-8268885](https://bugs.openjdk.java.net/browse/JDK-8268885) | tools | javac | duplicate checkcast when destination type is not first type of intersection type | +| 153 | [JDK-8269113](https://bugs.openjdk.java.net/browse/JDK-8269113) | tools | javac | Javac throws when compiling switch (null) | +| 154 | [JDK-8275302](https://bugs.openjdk.java.net/browse/JDK-8275302) | tools | javac | unexpected compiler error: cast, intersection types and sealed | +| 155 | [JDK-8274347](https://bugs.openjdk.java.net/browse/JDK-8274347) | tools | javac | Passing a \*nested\* switch expression as a parameter causes an NPE during compile | +| 156 | [JDK-8268894](https://bugs.openjdk.java.net/browse/JDK-8268894) | tools | javac | forged ASTs can provoke an AIOOBE at com.sun.tools.javac.jvm.ClassWriter::writePosition | +| 157 | [JDK-8273408](https://bugs.openjdk.java.net/browse/JDK-8273408) | tools | javac | java.lang.AssertionError: typeSig ERROR on generated class property of record | +| 158 | [JDK-8271254](https://bugs.openjdk.java.net/browse/JDK-8271254) | tools | javac | javac generates unreachable code when using empty semicolon statement | +| 159 | [JDK-8274942](https://bugs.openjdk.java.net/browse/JDK-8274942) | tools | javac | AssertionError at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155) | +| 160 | [JDK-8272639](https://bugs.openjdk.java.net/browse/JDK-8272639) | tools | jpackage | jpackaged applications using microphone on mac | +| 161 | [JDK-8274087](https://bugs.openjdk.java.net/browse/JDK-8274087) | tools | jpackage | Windows DLL path not set correctly. | +| 162 | [JDK-8273593](https://bugs.openjdk.java.net/browse/JDK-8273593) | tools | jpackage | [REDO] Warn user when using mac-sign option with unsigned app-image. | +| 163 | [JDK-8272328](https://bugs.openjdk.java.net/browse/JDK-8272328) | tools | jpackage | java.library.path is not set properly by Windows jpackage app launcher | +| 164 | [JDK-8268457](https://bugs.openjdk.java.net/browse/JDK-8268457) | xml | | XML Transformer outputs Unicode supplementary character incorrectly to HTML | diff --git a/corpus/changelog/java_jdk_releases/java_jdk_1704.md b/corpus/changelog/java_jdk_releases/java_jdk_1704.md new file mode 100644 index 0000000000000000000000000000000000000000..fe91ddeaaaf8a911a26e0eb52a7d6de4dc952057 --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_1704.md @@ -0,0 +1,12 @@ +# Java_JDK 17.0.4 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/17-0-4-relnotes.html +Version: 17.0.4 + +#### Java SE 17.0.4.1 - Bundled Patch Release (BPR) - Bug Fixes and Updates + +The following sections summarize changes made in all Java SE 17.0.4.1 BPR releases. The BPR releases are listed below in date order, most current BPR first. Note that bug fixes in previous BPRs are also included in the current BPR. + +#### Changes in Java SE 17.0.4.1.1 + +Fixes from the prior BPR are included in this version. diff --git a/corpus/changelog/java_jdk_releases/java_jdk_1705.md b/corpus/changelog/java_jdk_releases/java_jdk_1705.md new file mode 100644 index 0000000000000000000000000000000000000000..eb95d859dd55bcbe52f88e67e7f1998668ca67de --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_1705.md @@ -0,0 +1,19 @@ +# Java_JDK 17.0.5 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/17-0-5-relnotes.html +Version: 17.0.5 + +#### Java SE 17.0.5 - Bundled Patch Release (BPR) - Bug Fixes and Updates + +The following sections summarize changes made in all Java SE 17.0.5 BPR releases. The BPR releases are listed below in date order, most current BPR first. Note that bug fixes in previous BPRs are also included in the current BPR. + +#### Changes in Java SE 17.0.5.0.1 + +#### Bug Fixes + +| BugId | Category | Subcategory | Description | +| --- | --- | --- | --- | +| JDK-8291973 | install | install | Java RPMs Are Built with Older RPM and Thus Do Not Contain Some Necessary Hash | +| [JDK-8294357](https://bugs.openjdk.java.net/browse/JDK-8294357) | core-libs | java.time | (tz) Update Timezone Data to 2022d | + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_1706.md b/corpus/changelog/java_jdk_releases/java_jdk_1706.md new file mode 100644 index 0000000000000000000000000000000000000000..1d4f35789dde6e43d603fd46abc2d4693293d4ad --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_1706.md @@ -0,0 +1,19 @@ +# Java_JDK 17.0.6 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/17-0-6-relnotes.html +Version: 17.0.6 + +#### Java SE 17.0.6 - Bundled Patch Release (BPR) - Bug Fixes and Updates + +The following sections summarize changes made in all Java SE 17.0.6 BPR releases. The BPR releases are listed below in date order, most current BPR first. Note that bug fixes in previous BPRs are also included in the current BPR. + +#### Changes in Java SE 17.0.6.0.1 + +#### Bug Fixes + +| BugId | Category | Subcategory | Description | +| --- | --- | --- | --- | +| [JDK-8280890](https://bugs.openjdk.java.net/browse/JDK-8280890) | security-libs | java.security | Cannot use '-Djava.system.class.loader' with class loader in signed JAR | +| [JDK-8297804](https://bugs.openjdk.java.net/browse/JDK-8297804) | core-libs | java.time | (tz) Update Timezone Data to 2022g | + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_1707.md b/corpus/changelog/java_jdk_releases/java_jdk_1707.md new file mode 100644 index 0000000000000000000000000000000000000000..9ca0c5c8f60940e473c28b709c2326b3096964c3 --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_1707.md @@ -0,0 +1,18 @@ +# Java_JDK 17.0.7 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/17-0-7-relnotes.html +Version: 17.0.7 + +#### Java SE 17.0.7 - Bundled Patch Release (BPR) - Bug Fixes and Updates + +The following sections summarize changes made in all Java SE 17.0.7 BPR releases. The BPR releases are listed below in date order, most current BPR first. Note that bug fixes in previous BPRs are also included in the current BPR. + +#### Changes in Java SE 17.0.7.0.1 + +#### Bug Fixes + +| BugId | Category | Subcategory | Description | +| --- | --- | --- | --- | +| [JDK-8308884](https://bugs.openjdk.java.net/browse/JDK-8308884) | hotspot | compiler | [17u/11u] Backout JDK-8297951 | + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_1708.md b/corpus/changelog/java_jdk_releases/java_jdk_1708.md new file mode 100644 index 0000000000000000000000000000000000000000..bc109a2225a423e1e109c07bf6d40dffd9b5db61 --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_1708.md @@ -0,0 +1,19 @@ +# Java_JDK 17.0.8 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/17-0-8-relnotes.html +Version: 17.0.8 + +#### Java SE 17.0.8 - Bundled Patch Release (BPR) - Bug Fixes and Updates + +The following sections summarize changes made in all Java SE 17.0.8 BPR releases. The BPR releases are listed below in date order, most current BPR first. Note that bug fixes in previous BPRs are also included in the current BPR. + +#### Changes in Java SE 17.0.8.0.2 + +#### Bug Fixes + +| BugId | Category | Subcategory | Description | +| --- | --- | --- | --- | +| [JDK-8313765](https://bugs.openjdk.java.net/browse/JDK-8313765) | core-libs | java.util.jar | Invalid CEN header (invalid zip64 extra data field size) | +| [JDK-8232933](https://bugs.openjdk.java.net/browse/JDK-8232933) | tools | javac | Javac inferred type does not conform to equality constraint | + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_1709.md b/corpus/changelog/java_jdk_releases/java_jdk_1709.md new file mode 100644 index 0000000000000000000000000000000000000000..200dfcb1b675e96d94b4f5f358ed3fc3c9825384 --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_1709.md @@ -0,0 +1,48 @@ +# Java_JDK 17.0.9 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/17-0-9-relnotes.html +Version: 17.0.9 + +#### Java SE 17.0.9 - Bundled Patch Release (BPR) - Bug Fixes and Updates + +The following sections summarize changes made in all Java SE 17.0.9 BPR releases. The BPR releases are listed below in date order, most current BPR first. Note that bug fixes in previous BPRs are also included in the current BPR. + +#### Changes in Java SE 17.0.9.0.3 + +#### Bug Fixes + +December 8, 2023 + +| BugId | Category | Subcategory | Description | +| --- | --- | --- | --- | +| [JDK-8054022](https://bugs.openjdk.java.net/browse/JDK-8054022) | core-libs | java.net | HttpURLConnection timeouts with Expect: 100-Continue and no chunking | +| [JDK-8313742](https://bugs.openjdk.java.net/browse/JDK-8313742) | security-libs | javax.crypto | ZipFile.getManifestName fails during jar verification for Spring Boot | + +#### Changes in Java SE 17.0.9.0.2 + +November 13, 2023 + +security-libs/java.security + +**[➜](#JDK-8312489) Increase Default Value of the System Property `jdk.jar.maxSignatureFileSize`** ([JDK-8312489](https://bugs.openjdk.org/browse/JDK-8312489)) + +The system property, `jdk.jar.maxSignatureFileSize`, allows applications to control the maximum size of signature files in a signed JAR. Its default value has been increased from 8000000 bytes (8 MB) to 16000000 bytes (16 MB). + +#### Bug Fixes + +| BugId | Category | Subcategory | Description | +| --- | --- | --- | --- | +| [JDK-8312489](https://bugs.openjdk.java.net/browse/JDK-8312489) | security-libs | java.security | Increase jdk.jar.maxSignatureFileSize default which is too low for JARs such as WhiteSource/Mend unified agent jar | + +#### Changes in Java SE 17.0.9.0.1+2 + +#### Bug Fixes + +October 17, 2023 + +| BugId | Category | Subcategory | Description | +| --- | --- | --- | --- | +| JDK-8309489 (not public) | install | install | 17.0.7/11.0.19 and later fail to run jar file via UNC path when using .exe files under javapath | +| JDK-8317121 (not public) | hotspot | compiler | vector\_masked\_load instruction is moved too early after JDK-8286941 | + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_2101.md b/corpus/changelog/java_jdk_releases/java_jdk_2101.md new file mode 100644 index 0000000000000000000000000000000000000000..b6338f9fd1c2200bf4ee11ad3a74993eb83d1f0b --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_2101.md @@ -0,0 +1,116 @@ +# Java_JDK 21.0.1 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/21-0-1-relnotes.html +Version: 21.0.1 + +#### Java™ SE Development Kit 21.0.1 (JDK 21.0.1) + +October 17, 2023 + +The full version string for this update release is 21.0.1+12 (where "+" means "build"). The version number is 21.0.1. + +#### IANA TZ Data 2023c + +For more information, refer to [Timezone Data Versions in the JRE Software](https://www-sites.oracle.com/java/technologies/tzdata-versions.html). + +#### Security Baselines + +The security baselines for the Java Runtime Environment (JRE) at the time of the release of JDK 21.0.1 are specified in the following table: + +| **JRE Family Version** | **JRE Security Baseline (Full Version String)** | +| --- | --- | +| 21 | 21.0.1+12 | +| 17 | 17.0.9+11 | +| 11 | 11.0.21+9 | +| 8 | 8u391-b13 | + +#### Keeping the JDK up to Date + +Oracle recommends that the JDK is updated with each Critical Patch Update. +In order to determine if a release is the latest, the [Security Baseline](https://javadl-esd-secure.oracle.com/update/baseline.version) page can +be used to determine which is the latest version for each release family. + +Critical patch updates, which contain security vulnerability fixes, are announced one year in advance on +Critical Patch Updates, Security Alerts and Bulletins. +It is not recommended that this JDK (version 21.0.1) be used after the next critical patch update scheduled +for January 16, 2024. + +#### Known Issues + +security-libs/java.security + +**[➜](#JDK-8313793) RSA Signature Verification Fails on Signed Data that Does Not Encode Parameters Correctly** ([JDK-8313793](https://bugs.openjdk.org/browse/JDK-8313793)) + +The fix for [JDK-8302017](https://bugs.openjdk.org/browse/JDK-8302017 ) updated the RSA signature verification algorithm for compliance with RFC 8017. However, this modification introduced a regression: signatures not strictly conforming to RFC 8017 may fail verification. This issue will be addressed in a forthcoming update. For further information, refer to [JDK-8320597](https://bugs.openjdk.org/browse/JDK-8320597). + +#### Other Notes + +security-libs/java.security + +**[➜](#JDK-8314960) Added Certigna Root CA Certificate** ([JDK-8314960](https://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-8314960)) + +The following root certificate has been added to the cacerts truststore: + +```None ++ Certigna (Dhimyotis) + + + certignarootca + DN: CN=Certigna Root CA, OU=0002 48146308100036, O=Dhimyotis, C=FR +``` + +security-libs/java.security + +**[➜](#JDK-8312489) Increase Default Value of the System Property `jdk.jar.maxSignatureFileSize`** ([JDK-8312489](https://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-8312489)) + +The system property, `jdk.jar.maxSignatureFileSize`, allows applications to control the maximum size of signature files in a signed JAR. Its default value has been increased from 8000000 bytes (8 MB) to 16000000 bytes (16 MB). + +#### Bug Fixes + +This release also contains fixes for security vulnerabilities described in the [Oracle Critical Patch Update](https://www.oracle.com/security-alerts/cpuOct2023.html#AppendixJAVA). + +➜ Issues fixed in 21.0.1: + +| # | JBS | Component/Subcomponent | Summary | +| --- | --- | --- | --- | +| 1 | [JDK-8312555](https://bugs.openjdk.org/browse/JDK-8312555) | client-libs/2d | Ideographic characters aren't stretched by AffineTransform.scale(2, 1) | +| 2 | [JDK-8311160](https://bugs.openjdk.org/browse/JDK-8311160) | client-libs/javax.accessibility | [macOS, Accessibility] VoiceOver: No announcements on JRadioButtonMenuItem and JCheckBoxMenuItem | +| 3 | [JDK-8312535](https://bugs.openjdk.org/browse/JDK-8312535) | client-libs/javax.sound | MidiSystem.getSoundbank() throws unexpected SecurityException | +| 4 | [JDK-8308609](https://bugs.openjdk.org/browse/JDK-8308609) | core-libs/java.lang | java/lang/ScopedValue/StressStackOverflow.java fails with "-XX:-VMContinuations" | +| 5 | [JDK-8309591](https://bugs.openjdk.org/browse/JDK-8309591) | core-libs/java.net | Socket.setOption(TCP\_QUICKACK) uses wrong level | +| 6 | [JDK-8313765](https://bugs.openjdk.org/browse/JDK-8313765) | core-libs/java.util.jar | Invalid CEN header (invalid zip64 extra data field size) | +| 7 | [JDK-8312976](https://bugs.openjdk.org/browse/JDK-8312976) | core-libs/java.util.regex | MatchResult produces StringIndexOutOfBoundsException for groups outside match | +| 8 | [JDK-8313657](https://bugs.openjdk.org/browse/JDK-8313657) | core-libs/javax.naming | com.sun.jndi.ldap.Connection.cleanup does not close connections on SocketTimeoutErrors | +| 9 | [JDK-8314063](https://bugs.openjdk.org/browse/JDK-8314063) | core-libs/javax.naming | The socket is not closed in Connection::createSocket when the handshake failed for LDAP connection | +| 10 | [JDK-8313248](https://bugs.openjdk.org/browse/JDK-8313248) | hotspot/compiler | C2: setScopedValueCache intrinsic exposes nullptr pre-values to store barriers | +| 11 | [JDK-8313262](https://bugs.openjdk.org/browse/JDK-8313262) | hotspot/compiler | C2: Sinking node may cause required cast to be dropped | +| 12 | [JDK-8313402](https://bugs.openjdk.org/browse/JDK-8313402) | hotspot/compiler | C1: Incorrect LoadIndexed value numbering | +| 13 | [JDK-8304954](https://bugs.openjdk.org/browse/JDK-8304954) | hotspot/compiler | SegmentedCodeCache fails when using large pages | +| 14 | [JDK-8314024](https://bugs.openjdk.org/browse/JDK-8314024) | hotspot/compiler | SIGSEGV in PhaseIdealLoop::build\_loop\_late\_post\_work due to bad immediate dominator info | +| 15 | [JDK-8299658](https://bugs.openjdk.org/browse/JDK-8299658) | hotspot/compiler | C1 compilation crashes in LinearScan::resolve\_exception\_edge | +| 16 | [JDK-8312909](https://bugs.openjdk.org/browse/JDK-8312909) | hotspot/compiler | C1 should not inline through interface calls with non-subtype receiver | +| 17 | [JDK-8313626](https://bugs.openjdk.org/browse/JDK-8313626) | hotspot/compiler | C2 crash due to unexpected exception control flow | +| 18 | [JDK-8311249](https://bugs.openjdk.org/browse/JDK-8311249) | hotspot/gc | Remove unused MemAllocator::obj\_memory\_range | +| 19 | [JDK-8293114](https://bugs.openjdk.org/browse/JDK-8293114) | hotspot/gc | JVM should trim the native heap | +| 20 | [JDK-8307766](https://bugs.openjdk.org/browse/JDK-8307766) | hotspot/runtime | Linux: Provide the option to override the timer slack | +| 21 | [JDK-8312182](https://bugs.openjdk.org/browse/JDK-8312182) | hotspot/runtime | THPs cause huge RSS due to thread start timing issue | +| 22 | [JDK-8312394](https://bugs.openjdk.org/browse/JDK-8312394) | hotspot/runtime | [linux] SIGSEGV if kernel was built without hugepage support | +| 23 | [JDK-8314020](https://bugs.openjdk.org/browse/JDK-8314020) | hotspot/runtime | Print instruction blocks in byte units | +| 24 | [JDK-8312620](https://bugs.openjdk.org/browse/JDK-8312620) | hotspot/runtime | WSL Linux build crashes after JDK-8310233 | +| 25 | [JDK-8312585](https://bugs.openjdk.org/browse/JDK-8312585) | hotspot/runtime | Rename DisableTHPStackMitigation flag to THPStackMitigation | +| 26 | [JDK-8312401](https://bugs.openjdk.org/browse/JDK-8312401) | hotspot/runtime | SymbolTable::do\_add\_if\_needed hangs when called in InstanceKlass::add\_initialization\_error path with requesting length exceeds max\_symbol\_length | +| 27 | [JDK-8314850](https://bugs.openjdk.org/browse/JDK-8314850) | hotspot/runtime | SharedRuntime::handle\_wrong\_method() gets called too often when resolving Continuation.enter | +| 28 | [JDK-8314679](https://bugs.openjdk.org/browse/JDK-8314679) | hotspot/svc-agent | SA fails to properly attach to JVM after having just detached from a different JVM | +| 29 | [JDK-8313312](https://bugs.openjdk.org/browse/JDK-8313312) | other-libs | Add missing classpath exception copyright header | +| 30 | [JDK-8308474](https://bugs.openjdk.org/browse/JDK-8308474) | security-libs/java.security | DSA does not reset SecureRandom when initSign is called again | +| 31 | [JDK-8302017](https://bugs.openjdk.org/browse/JDK-8302017) | security-libs/java.security | Allocate BadPaddingException only if it will be thrown | +| 32 | [JDK-8311592](https://bugs.openjdk.org/browse/JDK-8311592) | security-libs/javax.crypto | ECKeySizeParameterSpec causes too many exceptions on third party providers | +| 33 | [JDK-8309214](https://bugs.openjdk.org/browse/JDK-8309214) | security-libs/javax.crypto:pkcs11 | sun/security/pkcs11/KeyStore/CertChainRemoval.java fails after 8301154 | +| 34 | [JDK-8314216](https://bugs.openjdk.org/browse/JDK-8314216) | tools/javac | Case enumConstant, pattern compilation fails | +| 35 | [JDK-8314423](https://bugs.openjdk.org/browse/JDK-8314423) | tools/javac | Multiple patterns without unnamed variables | +| 36 | [JDK-8312619](https://bugs.openjdk.org/browse/JDK-8312619) | tools/javac | Strange error message when switching over long | +| 37 | [JDK-8315534](https://bugs.openjdk.org/browse/JDK-8315534) | tools/javac | Incorrect warnings about implicit annotation processing | +| 38 | [JDK-8313323](https://bugs.openjdk.org/browse/JDK-8313323) | tools/javac | javac -g on a java file which uses unnamed variable leads to ClassFormatError when launching that class | +| 39 | [JDK-8240567](https://bugs.openjdk.org/browse/JDK-8240567) | tools/jlink | MethodTooLargeException thrown while creating a jlink image | +| 40 | [JDK-8308042](https://bugs.openjdk.org/browse/JDK-8308042) | tools/jpackage | [macOS] Developer ID Application Certificate not picked up by jpackage if it contains UNICODE characters | + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_21010.md b/corpus/changelog/java_jdk_releases/java_jdk_21010.md new file mode 100644 index 0000000000000000000000000000000000000000..c8824be34a868303ffc4438e285b3f998afad196 --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_21010.md @@ -0,0 +1,166 @@ +# Java_JDK 21.0.10 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/21-0-10-relnotes.html +Version: 21.0.10 + +#### Java™ SE Development Kit 21.0.10 (JDK 21.0.10) + +January 20, 2026 + +The full version string for this update release is 21.0.10+8 (where "+" means "build"). +The version number is 21.0.10. This JDK conforms to version 21 of the Java SE Specification ([JSR 396](https://jcp.org/en/jsr/detail?id=396) 2023-09-19). + +#### IANA TZ Data 2025b + +For more information, refer to [Timezone Data Versions in the JRE Software](https://www.oracle.com/java/technologies/tzdata-versions.html). + +#### Security Baselines + +The security baselines for the Java Runtime Environment (JRE) at the time of the release of JDK 21.0.10 are specified in the following table: + +| **Java Family Version** | **Security Baseline (Full Version String)** | +| --- | --- | +| 21 | 21.0.10+8 | +| 17 | 17.0.18+8 | +| 11 | 11.0.30+7 | +| 8 | 1.8.0\_481-b10 | + +#### Keeping the JDK up to Date + +Oracle recommends that the JDK is updated with each Critical Patch Update. +In order to determine if a release is the latest, the [Security Baseline](https://javadl-esd-secure.oracle.com/update/baseline.version) page can +be used to determine which is the latest version for each release family. + +Critical patch updates, which contain security vulnerability fixes, are announced one year in advance on +Critical Patch Updates, Security Alerts and Bulletins. +It is not recommended that this JDK (version 21.0.10) be used after the next critical patch update scheduled +for April 21, 2026. + +Java Management Service, available to all users, can help you find vulnerable Java versions in your systems. [Java SE Subscribers](https://www.oracle.com/java/java-se-subscription.html) and customers running in Oracle Cloud can use Java Management Service to update Java Runtimes and to do further security reviews like identifying potentially vulnerable third party libraries used by your Java programs. Existing Java Management Service user [click here](https://cloud.oracle.com/jms/overview) to log in to your dashboard. [The Java Management Service Documentation](https://docs.oracle.com/en-us/iaas/jms/index.html) provides a list of features available to everyone and those available only to customers. [Learn more about using Java Management Service](https://www.oracle.com/java/jms/) to monitor and secure your Java Installations. + +#### Availability of Oracle JDK 21 under NFTC + +Oracle JDK 21 LTS, released in September 2023, has been permissively licensed under the [free Java license](https://www.oracle.com/downloads/licenses/no-fee-license.html) and will continue to be so until one year after the subsequent LTS release. Oracle designated Oracle JDK 25, released in September of 2025, as a Long Term Support (LTS) release. Therefore, update releases of Oracle JDK 21 after September of 2026 will switch to the [Java SE OTN](https://www.oracle.com/downloads/licenses/javase-license1.html) license, the same license under which we offer updates to Java 8, 11, and 17. Users wishing to receive updates of the Oracle JDK under the [free Java license](https://www.oracle.com/downloads/licenses/no-fee-license.html) should migrate to Oracle JDK 25. + +#### New Features + +core-libs/java.rmi + +**[➜](#JDK-8341496) Endpoint Identification Enabled By Default for RMI Connections Over TLS** (JDK-8341496 (not public)) + +RMI will use TLS connections if the `javax.rmi.ssl.SslRMIClientSocketFactory` class is used. These connections now have TLS endpoint identification enabled by default. This may cause some previously-working TLS connections to fail. If this occurs, ensure that the certificate presented by the server has a Subject Alternative Name that matches the server's hostname. Alternatively, endpoint identification for RMI TLS connections can be disabled on the client side by setting the `jdk.rmi.ssl.client.enableEndpointIdentification` system property to `false`. + +#### Other Notes + +security-libs/javax.net.ssl + +**[➜](#JDK-8340321) Disabled SHA-1 in TLS 1.2 and DTLS 1.2 Handshake Signatures** ([JDK-8340321](https://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-8340321)) + +The SHA-1 algorithm has been disabled by default in TLS 1.2 and DTLS 1.2 handshake signatures, by adding `"rsa_pkcs1_sha1 usage HandshakeSignature, ecdsa_sha1 usage HandshakeSignature, dsa_sha1 usage HandshakeSignature"` to the `jdk.tls.disabledAlgorithms` security property in the `java.security` config file. RFC 9155 deprecates the use of SHA-1 in TLS 1.2 and DTLS 1.2 digital signatures. Users can, at their own risk, re-enable the SHA-1 algorithm in TLS 1.2 and DTLS 1.2 handshake signatures by removing `"rsa_pkcs1_sha1 usage HandshakeSignature, ecdsa_sha1 usage HandshakeSignature, dsa_sha1 usage HandshakeSignature"` from the `jdk.tls.disabledAlgorithms` security property. + +install/install + +**[➜](#JDK-8310932) Windows Installers to Return to Full Version Directory and Use of Junction** (JDK-8310932 (not public)) + +For the JDK11+ LTS families, the JDK will install into a version-specific installation directory by default. The installation directory of 11+ will have a - before the version-specific string to keep consistency with the past 11+ conventions per family. A junction, also known as a symlink for Windows, will also be created in a "latest" directory. It will point to the latest version of that family. Here is a breakdown example of installation and junction locations 11+ families: + +| Version | Installation Directory | Junction Location | +| --- | --- | --- | +| jdk25.0.2 | `C:\Program Files\Java\jdk-25.0.2` | `C:\Program Files\Java\latest\jdk-25` | +| jdk17.0.18 | `C:\Program Files\Java\jdk-17.0.18` | `C:\Program Files\Java\latest\jdk-17` | +| jdk11.0.30 | `C:\Program Files\Java\jdk-11.0.30` | `C:\Program Files\Java\latest\jdk-11` || + +Each junction will always point to the latest JDK of the matching LTS family. The junction for each family will be removed when the last JDK of the matching LTS family is uninstalled. + +install/install + +**[➜](#JDK-8359443) Make jcmd Command Available in the Headless JDK RPM** (JDK-8359443 (not public)) + +`jcmd` command will be available in the headless JDK RPM instead of the headful JDK RPM. + +It will be added to the `java` alternatives group instead of the `javac` alternatives group. + +security-libs/javax.net.ssl + +**[➜](#JDK-8245545) Disabled TLS\_RSA Cipher Suites** ([JDK-8245545](https://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-8245545)) + +The TLS\_RSA cipher suites have been disabled by default, by adding "TLS\_RSA\_*" to the `jdk.tls.disabledAlgorithms` security property in the `java.security` configuration file. The TLS\_RSA cipher suites do not preserve forward-secrecy and are not commonly used. Some TLS\_RSA cipher suites are already disabled because they use DES, 3DES, RC4, or NULL, which are disabled. This action disables all remaining TLS\_RSA cipher suites. Any attempts to use cipher suites starting with "TLS\_RSA\_" will fail with an `SSLHandshakeException`. Users can, at their own risk, re-enable these cipher suites by removing "TLS\_RSA\_*" from the `jdk.tls.disabledAlgorithms` security property. The following previously enabled cipher suites are now disabled: + +```None +TLS_RSA_WITH_AES_256_GCM_SHA384 + +TLS_RSA_WITH_AES_128_GCM_SHA256 +TLS_RSA_WITH_AES_256_CBC_SHA256 +TLS_RSA_WITH_AES_128_CBC_SHA256 +TLS_RSA_WITH_AES_256_CBC_SHA +TLS_RSA_WITH_AES_128_CBC_SHA +``` + +core-libs/java.util:i18n + +**[➜](#JDK-8345213) Changes to the Default Time Zone Detection on Debian-based Linux** ([JDK-8345213](https://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-8345213)) + +On Debian-based Linux distributions such as Ubuntu, the `/etc/timezone` file was previously used to determine the JDK's default time zone (`TimeZone.getDefault()`). According to [Debian's Wiki](https://wiki.debian.org/TimeZoneChanges#Check_Configured_Timezone), `/etc/localtime` is now the primary source for the system's default time zone, making `/etc/timezone` redundant. As a result, the JDK's default time zone detection logic has been updated to use `/etc/localtime` instead of `/etc/timezone`. If `/etc/localtime` and `/etc/timezone` are inconsistent for any reason, the JDK's default time zone is now determined solely based on `/etc/localtime` file. + +security-libs/java.security + +**[➜](#JDK-8368032) Filter Rules for URIs in the Authority Info Access Extension for Certificates** (JDK-8368032 (not public)) + +A new system and security property, `com.sun.security.allowedAIALocations`, has been introduced. This property allows users the ability to define one or more filtering rules to be applied to URIs obtained from the authority info access extension on X.509 certificates. These filter rules are applied specifically to the CA issuers access method. Any CA issuers URIs in X.509 certificates are only followed when the `com.sun.security.enableAIAcaIssuers` system property is enabled and the filter allows the URI. + +In order to set the rules, the user must set either the `com.sun.security.allowedAIALocations` security property or the system property by the same name. If the system property has a value, it will override the security property. By default the property is blank, which enacts a deny-all ruleset. + +For either property, the value consists of a set of space-separated rules that take the form of a URI, with the following constraints: + +* The URI must be absolute and hierarchical. +* The URI must only use one of the following schemes: http, https, ldap, or ftp (case-insensitive). +* A hostname or address must be specified and must match (case-insensitive). No name resolution is performed on hostnames to match URIs with IP addresses. +* The port number must match. Where a port number is omitted, the well-known port will be used in the comparison. +* For hierarchical schemes (http[s], ftp): + + A rule's normalized path portion of the URI is matched in a case-sensitive manner. If the final component does not end in a slash (/), it is considered to be a file path and must match the CA issuer URI path component. If the rule's path component ends in a slash, then it must match or be a prefix of the CA issuer URI path component. (for example, a filter path of `/ab/cd/` will match a CA issuer path of `/ab/cd/`, `/ab/cd/ef` and `/ab/cd/ef/ghi`.). + + Query strings and fragments will be ignored when matching CA issuer URIs. +* For ldap URIs: + + The base DN must be an exact match (case-insensitive). + + Any query string in the rule, if specified, will be ignored. + +For the properties, a single value of "any" (case-insensitive) will create an allow-all rule. + +#### Bug Fixes + +This release also contains fixes for security vulnerabilities described in the [Oracle Critical Patch Update](https://www.oracle.com/security-alerts/cpujan2026.html#AppendixJAVA). + +➜ Issues fixed in 21.0.10: + +| # | JBS | Component/Subcomponent | Summary | +| --- | --- | --- | --- | +| 1 | [JDK-8334509](https://bugs.java/bugdatabase/JDK-8334509) | client-libs/2d | Cancelling PageDialog does not return the same PageFormat object | +| 2 | [JDK-8361748](https://bugs.java/bugdatabase/JDK-8361748) | client-libs/2d | Enforce limits on the size of an XBM image | +| 3 | [JDK-8324491](https://bugs.java/bugdatabase/JDK-8324491) | client-libs/java.awt | Keyboard layout didn't keep its state if it was changed when dialog was active | +| 4 | [JDK-8354646](https://bugs.java/bugdatabase/JDK-8354646) | client-libs/java.awt | java.awt.TextField allows to identify the spaces in a password when double clicked at the starting and end of the text | +| 5 | [JDK-8350813](https://bugs.java/bugdatabase/JDK-8350813) | client-libs/javax.sound | Rendering of bulky sound bank from MIDI sequence can cause OutOfMemoryError | +| 6 | [JDK-8140527](https://bugs.java/bugdatabase/JDK-8140527) | client-libs/javax.swing | JInternalFrame has incorrect title button width | +| 7 | [JDK-8139228](https://bugs.java/bugdatabase/JDK-8139228) | client-libs/javax.swing | JFileChooser renders file names as HTML document | +| 8 | [JDK-8358532](https://bugs.java/bugdatabase/JDK-8358532) | client-libs/javax.swing | JFileChooser in GTK L&F still displays HTML filename | +| 9 | [JDK-8210807](https://bugs.java/bugdatabase/JDK-8210807) | client-libs/javax.swing | Printing a JTable with a JScrollPane prints table without rows populated | +| 10 | [JDK-8322135](https://bugs.java/bugdatabase/JDK-8322135) | client-libs/javax.swing | Printing JTable in Windows L&F throws InternalError: HTHEME is null | +| 11 | [JDK-8349188](https://bugs.java/bugdatabase/JDK-8349188) | client-libs/javax.swing | LineBorder does not scale correctly | +| 12 | [JDK-8358813](https://bugs.java/bugdatabase/JDK-8358813) | client-libs/javax.swing | JPasswordField identifies spaces in password via delete shortcuts | +| 13 | [JDK-8370465](https://bugs.java/bugdatabase/JDK-8370465) | client-libs/javax.swing | Right to Left Orientation Issues with MenuItem Component | +| 14 | [JDK-8365086](https://bugs.java/bugdatabase/JDK-8365086) | core-libs/java.net | CookieStore.getURIs() and get(URI) should return an immutable List | +| 15 | [JDK-8369184](https://bugs.java/bugdatabase/JDK-8369184) | core-libs/java.util:i18n | SimpleTimeZone equals() Returns True for Unequal Instances with Different hashCode Values | +| 16 | [JDK-8328085](https://bugs.java/bugdatabase/JDK-8328085) | hotspot/compiler | C2: Use after free in PhaseChaitin::Register\_Allocate() | +| 17 | [JDK-8364993](https://bugs.java/bugdatabase/JDK-8364993) | hotspot/jfr | JFR: Disable jdk.ModuleExport in default.jfc | +| 18 | [JDK-8364556](https://bugs.java/bugdatabase/JDK-8364556) | hotspot/jfr | JFR: Disable SymbolTableStatistics and StringTableStatistics in default.jfc | +| 19 | [JDK-8328997](https://bugs.java/bugdatabase/JDK-8328997) | hotspot/runtime | Remove unnecessary template parameter lists in GrowableArray | +| 20 | [JDK-8317132](https://bugs.java/bugdatabase/JDK-8317132) | hotspot/runtime | Prepare HotSpot for permissive- | +| 21 | [JDK-8361447](https://bugs.java/bugdatabase/JDK-8361447) | hotspot/runtime | [REDO] Checked version of JNI ReleaseArrayElements needs to filter out known wrapped arrays | +| 22 | [JDK-8364235](https://bugs.java/bugdatabase/JDK-8364235) | hotspot/runtime | Fix for JDK-8361447 breaks the alignment requirements for GuardedMemory | +| 23 | [JDK-8302744](https://bugs.java/bugdatabase/JDK-8302744) | hotspot/runtime | Refactor Hotspot container detection code | +| 24 | [JDK-8364660](https://bugs.java/bugdatabase/JDK-8364660) | hotspot/runtime | ClassVerifier::ends\_in\_athrow() should be removed | +| 25 | [JDK-8306579](https://bugs.java/bugdatabase/JDK-8306579) | infrastructure/other | Consider building with /Zc:throwingNew | +| 26 | [JDK-8342958](https://bugs.java/bugdatabase/JDK-8342958) | performance/libraries | Use jvmArgs consistently in microbenchmarks | +| 27 | [JDK-8317332](https://bugs.java/bugdatabase/JDK-8317332) | security-libs/java.security | Prepare security for permissive- | +| 28 | [JDK-8325680](https://bugs.java/bugdatabase/JDK-8325680) | security-libs/org.ietf.jgss | Uninitialised memory in deleteGSSCB of GSSLibStub.c:179 | +| 29 | [JDK-8365790](https://bugs.java/bugdatabase/JDK-8365790) | tools/jpackage | Shutdown hook for application image does not work on Windows | + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_2102.md b/corpus/changelog/java_jdk_releases/java_jdk_2102.md new file mode 100644 index 0000000000000000000000000000000000000000..eb12e3b471e990aa7d15c4f46d841aca9b36356e --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_2102.md @@ -0,0 +1,275 @@ +# Java_JDK 21.0.2 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/21-0-2-relnotes.html +Version: 21.0.2 + +#### Java™ SE Development Kit 21.0.2 (JDK 21.0.2) + +January 16, 2024 + +The full version string for this update release is 21.0.2+13 (where "+" means "build"). The version number is 21.0.2. + +#### IANA TZ Data 2023c + +For more information, refer to [Timezone Data Versions in the Java Runtime](https://www.oracle.com/java/technologies/tzdata-versions.html). + +#### Security Baselines + +The security baselines for the Java Runtime at the time of the release of JDK 21.0.2 are specified in the following table: + +| **Java Family Version** | **Security Baseline (Full Version String)** | +| --- | --- | +| 21 | 21.0.2+13 | +| 17 | 17.0.10+11 | +| 11 | 11.0.22+9 | +| 8 | 8u401-b10 | + +#### Keeping the JDK up to Date + +Oracle recommends that the JDK is updated with each Critical Patch Update. +In order to determine if a release is the latest, the [Security Baseline](https://javadl-esd-secure.oracle.com/update/baseline.version) page can +be used to determine which is the latest version for each release family. + +Critical patch updates, which contain security vulnerability fixes, are announced one year in advance on +Critical Patch Updates, Security Alerts and Bulletins. +It is not recommended that this JDK (version 21.0.2) be used after the next critical patch update scheduled +for April 16, 2024. + +[Java SE Subscription products](https://www.oracle.com/java/java-se-subscription.html) customers managing JRE updates/installs for large number of desktops should consider +using [Java Management Service](https://docs.oracle.com/en-us/iaas/jms/index.html) (JMS). + +#### New Features + +core-libs/java.net + +**[➜](#JDK-8308593) TCP\_KEEPxxxx Extended Socket Options Are Now Supported on the Windows Platform** ([JDK-8308593](https://bugs.openjdk.org/browse/JDK-8308593)) + +The `java.net.ExtendedSocketOptions` `TCP_KEEPIDLE` and `TCP_KEEPINTERVAL` are supported on Windows platforms starting from Windows 10 version 1709 and onwards. `TCP_KEEPCOUNT` is supported starting from Windows 10 version 1703 and onwards. + +core-libs/java.nio + +**[➜](#JDK-8316304) `BasicFileAttributes.creationTime` Returns Birth Time on Linux** ([JDK-8316304](https://bugs.openjdk.org/browse/JDK-8316304)) + +On Linux (kernel version 4.11 or newer, glibc version 2.28 or newer), `BasicFileAttributes.creationTime` now returns the creation or birth time of the file through the `stx_btime` element of `struct statx`. In previous JDK releases, the last modified time was returned. If the birth time is supported by the platform but not by the file system, then the epoch `1970-01-01T00:00:00Z` is returned. + +#### Known Issues + +hotspot/compiler + +**[➜](#JDK-8314468) Potential Performance Regression Due to Limited Range Check Elimination** (JDK-8314468 (not public)) + +When the C1 compiler is the only compiler available to the VM, it applies loop predication to remove array access range checks from loop bodies. Due to a defect, this optimization was disabled, potentially leading to a performance regression. + +This only affects the client VM or VM's running with the non-default command line flags `-XX:+NeverActAsServerClassMachine` or `-XX:TieredStopAtLevel=[1,2,3]`. + +#### Issues Fixed + +hotspot/compiler + +**[➜](#JDK-8315082) ZGC: Reintroduced Support for Non-Default ObjectAlignmentInBytes** ([JDK-8315082](https://bugs.openjdk.org/browse/JDK-8315082)) + +The JDK 21 issue that could potentially lead to JVM crashes or incorrect execution when running the JVM with `-XX:+UseZGC` and non-default value of `-XX:ObjectAlignmentInBytes` has been resolved, and it is possible again to use this combination of JVM options. + +#### Other Notes + +security-libs/java.security + +**[➜](#JDK-8318759) Added Four Root Certificates from DigiCert, Inc.** ([JDK-8318759](https://bugs.openjdk.org/browse/JDK-8318759)) + +The following root certificates have been added to the cacerts truststore: + +```None ++ DigiCert, Inc. + + + digicertcseccrootg5 + DN: CN=CN=DigiCert CS ECC P384 Root G5, O="DigiCert, Inc.", C=US + ++ DigiCert, Inc. + + digicertcsrsarootg5 + DN: CN=DigiCert CS RSA4096 Root G5, O="DigiCert, Inc.", C=US + ++ DigiCert, Inc. + + digicerttlseccrootg5 + DN: DigiCert TLS ECC P384 Root G5, O="DigiCert, Inc.", C=US + ++ DigiCert, Inc. + + digicerttlsrsarootg5 + DN: DigiCert TLS RSA4096 Root G5, O="DigiCert, Inc.", C=US +``` + +security-libs/java.security + +**[➜](#JDK-8319187) Added Three Root Certificates from eMudhra Technologies Limited** ([JDK-8319187](https://bugs.openjdk.org/browse/JDK-8319187)) + +The following root certificates have been added to the cacerts truststore: + +```None ++ eMudhra Technologies Limited + + + emsignrootcag1 + DN: CN=emSign Root CA - G1, O=eMudhra Technologies Limited, OU=emSign PKI, C=IN + ++ eMudhra Technologies Limited + + emsigneccrootcag3 + DN: CN=emSign ECC Root CA - G3, O=eMudhra Technologies Limited, OU=emSign PKI, C=IN + ++ eMudhra Technologies Limited + + emsignrootcag2 + DN: CN=emSign Root CA - G2, O=eMudhra Technologies Limited, OU=emSign PKI, C=IN +``` + +security-libs/java.security + +**[➜](#JDK-8317373) Added Telia Root CA v2 Certificate** ([JDK-8317373](https://bugs.openjdk.org/browse/JDK-8317373)) + +The following root certificate has been added to the cacerts truststore: + +```None ++ Telia Root CA v2 + + + teliarootcav2 + DN: CN=Telia Root CA v2, O=Telia Finland Oyj, C=FI +``` + +security-libs/java.security + +**[➜](#JDK-8317374) Added ISRG Root X2 CA Certificate from Let's Encrypt** ([JDK-8317374](https://bugs.openjdk.org/browse/JDK-8317374)) + +The following root certificate has been added to the cacerts truststore: + +```None ++ Let's Encrypt + + + letsencryptisrgx2 + DN: CN=ISRG Root X2, O=Internet Security Research Group, C=US +``` + +hotspot/runtime + +**[➜](#JDK-8317772) NMT: Make Peak Values Available in Release Builds** ([JDK-8317772](https://bugs.openjdk.java.net/browse/JDK-8317772)) + +NMT reports will now show peak values for all categories. Peak values contain the highest value for committed memory in a given NMT category over the lifetime of the JVM process. + +If the committed memory for an NMT category is currently at peak, NMT prints "at peak"; otherwise, it prints the peak value. + +For example: + +```None +- Compiler (reserved=230KB, committed=230KB) + (malloc=34KB #64) (peak=49KB #71) + (arena=196KB #4) (peak=6126KB #16) + +``` + +This shows Compiler arena memory peaked at a bit more than 6MB, whereas it now hovers around 200 KB. + +hotspot/runtime + +**[➜](#JDK-8313782) Add User Facing Warning If THPs Are Enabled but Cannot Be Used** ([JDK-8313782](https://bugs.openjdk.java.net/browse/JDK-8313782)) + +On Linux, if the JVM is started with `+UseTransparentHugePages` but the system does not support Transparent Huge Pages, a warning will now be printed to stdout: + +`UseTransparentHugePages disabled; transparent huge pages are not supported by the operating system.` + +hotspot/runtime + +**[➜](#JDK-8316735) Hotspot `hs_err` Files Now Print the Lock Stack** ([JDK-8316735](https://bugs.openjdk.org/browse/JDK-8316735)) + +A section containing the thread local lock stack has been added to `hs_err` report files. It only gets printed when the new lightweight locking mode is enabled (`-XX:LockingMode=2`). + +An example is given here with details about the locked objects omitted: + +```None +Lock stack of current Java thread (top to bottom): + +LockStack[1]: nsk.share.jdi.EventHandler +... +LockStack[0]: java.util.Collections$SynchronizedRandomAccessList +... +``` + +It lists objects which are lightweight locked, through `synchronized` methods or statements, by the Java thread which is being analyzed. The object which has been locked most recently is printed first. Objects which are not lightweight locked are not displayed in this section. + +#### Bug Fixes + +This release also contains fixes for security vulnerabilities described in the [Oracle Critical Patch Update](https://www.oracle.com/security-alerts/cpuJan2024.html#AppendixJAVA). + +➜ Issues fixed in 21.0.2: + +| # | JBS | Component/Subcomponent | Summary | +| --- | --- | --- | --- | +| 1 | [JDK-8294158](https://bugs.openjdk.org/browse/JDK-8294158) | client-libs | HTML formatting for PassFailJFrame instructions | +| 2 | [JDK-8312612](https://bugs.openjdk.org/browse/JDK-8312612) | client-libs | Handle WideCharToMultiByte return values | +| 3 | [JDK-8316741](https://bugs.openjdk.org/browse/JDK-8316741) | client-libs/2d | BasicStroke.createStrokedShape miter-limits failing on small shapes | +| 4 | [JDK-8312191](https://bugs.openjdk.org/browse/JDK-8312191) | client-libs/2d | ColorConvertOp.filter for the default destination is too slow | +| 5 | [JDK-8318951](https://bugs.openjdk.org/browse/JDK-8318951) | client-libs/2d | Additional negative value check in JPEG decoding | +| 6 | [JDK-8313643](https://bugs.openjdk.org/browse/JDK-8313643) | client-libs/2d | Update HarfBuzz to 8.2.2 | +| 7 | [JDK-8313164](https://bugs.openjdk.org/browse/JDK-8313164) | client-libs/java.awt | src/java.desktop/windows/native/libawt/windows/awt\_Robot.cpp GetRGBPixels adjust releasing of resources | +| 8 | [JDK-8316030](https://bugs.openjdk.org/browse/JDK-8316030) | client-libs/java.awt | Update Libpng to 1.6.40 | +| 9 | [JDK-8301846](https://bugs.openjdk.org/browse/JDK-8301846) | client-libs/javax.sound | Invalid TargetDataLine after screen lock when using JFileChooser or COM library | +| 10 | [JDK-8294535](https://bugs.openjdk.org/browse/JDK-8294535) | client-libs/javax.swing | Add screen capture functionality to PassFailJFrame | +| 11 | [JDK-8294427](https://bugs.openjdk.org/browse/JDK-8294427) | client-libs/javax.swing | Check boxes and radio buttons have rendering issues on Windows in High DPI env | +| 12 | [JDK-8319922](https://bugs.openjdk.org/browse/JDK-8319922) | core-libs | libCreationTimeHelper.so fails to link in JDK 21 | +| 13 | [JDK-8309545](https://bugs.openjdk.org/browse/JDK-8309545) | core-libs/java.lang | Thread.interrupted from virtual thread needlessly resets interrupt status | +| 14 | [JDK-8308452](https://bugs.openjdk.org/browse/JDK-8308452) | core-libs/java.lang | Extend internal Architecture enum with byte order and address size | +| 15 | [JDK-8316879](https://bugs.openjdk.org/browse/JDK-8316879) | core-libs/java.lang | RegionMatches1Tests fails if CompactStrings are disabled after JDK-8302163 | +| 16 | [JDK-8318415](https://bugs.openjdk.org/browse/JDK-8318415) | core-libs/java.lang | Adjust describing comment of os\_getChildren after 8315026 | +| 17 | [JDK-8267509](https://bugs.openjdk.org/browse/JDK-8267509) | core-libs/java.lang.invoke | Improve IllegalAccessException message to include the cause of the exception | +| 18 | [JDK-8319436](https://bugs.openjdk.org/browse/JDK-8319436) | core-libs/java.lang:reflect | Proxy.newProxyInstance throws NPE if loader is null and interface not visible from class loader | +| 19 | [JDK-8317736](https://bugs.openjdk.org/browse/JDK-8317736) | core-libs/java.net | Stream::handleReset locks twice | +| 20 | [JDK-8316337](https://bugs.openjdk.org/browse/JDK-8316337) | core-libs/java.nio | (bf) Concurrency issue in DirectByteBuffer.Deallocator | +| 21 | [JDK-8312166](https://bugs.openjdk.org/browse/JDK-8312166) | core-libs/java.nio | (dc) DatagramChannel's socket adaptor does not release carrier thread when blocking in receive | +| 22 | [JDK-8316304](https://bugs.openjdk.org/browse/JDK-8316304) | core-libs/java.nio | (fs) Add support for BasicFileAttributes.creationTime() for Linux | +| 23 | [JDK-8317603](https://bugs.openjdk.org/browse/JDK-8317603) | core-libs/java.nio | Improve exception messages thrown by sun.nio.ch.Net native methods (win) | +| 24 | [JDK-8267502](https://bugs.openjdk.org/browse/JDK-8267502) | core-libs/java.util.concurrent | JDK-8246677 caused 16x performance regression in SynchronousQueue | +| 25 | [JDK-8314263](https://bugs.openjdk.org/browse/JDK-8314263) | core-libs/java.util.logging | Signed jars triggering Logger finder recursion and StackOverflowError | +| 26 | [JDK-8318957](https://bugs.openjdk.org/browse/JDK-8318957) | core-svc/debugger | Enhance agentlib:jdwp help output by info about allow option | +| 27 | [JDK-8301489](https://bugs.openjdk.org/browse/JDK-8301489) | hotspot/compiler | C1: ShortLoopOptimizer might lift instructions before their inputs | +| 28 | [JDK-8316178](https://bugs.openjdk.org/browse/JDK-8316178) | hotspot/compiler | Better diagnostic header for CodeBlobs | +| 29 | [JDK-8315088](https://bugs.openjdk.org/browse/JDK-8315088) | hotspot/compiler | C2: assert(wq.size() - before == EMPTY\_LOOP\_SIZE) failed: expect the EMPTY\_LOOP\_SIZE nodes of this body if empty | +| 30 | [JDK-8315377](https://bugs.openjdk.org/browse/JDK-8315377) | hotspot/compiler | C2: assert(u->find\_out\_with(Op\_AddP) == nullptr) failed: more than 2 chained AddP nodes? | +| 31 | [JDK-8316514](https://bugs.openjdk.org/browse/JDK-8316514) | hotspot/compiler | Better diagnostic header for VtableStub | +| 32 | [JDK-8295555](https://bugs.openjdk.org/browse/JDK-8295555) | hotspot/compiler | Primitive wrapper caches could be `@Stable` | +| 33 | [JDK-8315545](https://bugs.openjdk.org/browse/JDK-8315545) | hotspot/compiler | C1: x86 cmove can use short branches | +| 34 | [JDK-8316179](https://bugs.openjdk.org/browse/JDK-8316179) | hotspot/compiler | Use consistent naming for lightweight locking in MacroAssembler | +| 35 | [JDK-8303737](https://bugs.openjdk.org/browse/JDK-8303737) | hotspot/compiler | C2: Load can bypass subtype check that enforces it's from the right object type | +| 36 | [JDK-8316130](https://bugs.openjdk.org/browse/JDK-8316130) | hotspot/compiler | Incorrect control in LibraryCallKit::inline\_native\_notify\_jvmti\_funcs | +| 37 | [JDK-8312440](https://bugs.openjdk.org/browse/JDK-8312440) | hotspot/compiler | assert(cast != nullptr) failed: must have added a cast to pin the node | +| 38 | [JDK-8316181](https://bugs.openjdk.org/browse/JDK-8316181) | hotspot/compiler | Move the fast locking implementation out of the .ad files | +| 39 | [JDK-8313756](https://bugs.openjdk.org/browse/JDK-8313756) | hotspot/compiler | [BACKOUT] 8308682: Enhance AES performance | +| 40 | [JDK-8313760](https://bugs.openjdk.org/browse/JDK-8313760) | hotspot/compiler | [REDO] Enhance AES performance | +| 41 | [JDK-8320209](https://bugs.openjdk.org/browse/JDK-8320209) | hotspot/compiler | VectorMaskGen clobbers rflags on x86\_64 | +| 42 | [JDK-8317507](https://bugs.openjdk.org/browse/JDK-8317507) | hotspot/compiler | C2 compilation fails with "Exceeded \_node\_regs array" | +| 43 | [JDK-8308103](https://bugs.openjdk.org/browse/JDK-8308103) | hotspot/compiler | Massive (up to ~30x) increase in C2 compilation time since JDK 17 | +| 44 | [JDK-8316679](https://bugs.openjdk.org/browse/JDK-8316679) | hotspot/compiler | C2 SuperWord: wrong result, load should not be moved before store if not comparable | +| 45 | [JDK-8315920](https://bugs.openjdk.org/browse/JDK-8315920) | hotspot/compiler | C2: "control input must dominate current control" assert failure | +| 46 | [JDK-8318889](https://bugs.openjdk.org/browse/JDK-8318889) | hotspot/compiler | C2: add bailout after assert Bad graph detected in build\_loop\_late | +| 47 | [JDK-8316414](https://bugs.openjdk.org/browse/JDK-8316414) | hotspot/compiler | C2: large byte array clone triggers "failed: malformed control flow" assertion failure on linux-x86 | +| 48 | [JDK-8314191](https://bugs.openjdk.org/browse/JDK-8314191) | hotspot/compiler | C2 compilation fails with "bad AD file" | +| 49 | [JDK-8316719](https://bugs.openjdk.org/browse/JDK-8316719) | hotspot/compiler | C2 compilation still fails with "bad AD file" | +| 50 | [JDK-8316906](https://bugs.openjdk.org/browse/JDK-8316906) | hotspot/gc | Clarify TLABWasteTargetPercent flag | +| 51 | [JDK-8315869](https://bugs.openjdk.org/browse/JDK-8315869) | hotspot/runtime | UseHeavyMonitors not used | +| 52 | [JDK-8319828](https://bugs.openjdk.org/browse/JDK-8319828) | hotspot/runtime | runtime/NMT/VirtualAllocCommitMerge.java may fail if mixing interpreted and compiled native invocations | +| 53 | [JDK-8316967](https://bugs.openjdk.org/browse/JDK-8316967) | hotspot/runtime | Correct the scope of vmtimer in UnregisteredClasses::load\_class | +| 54 | [JDK-8316581](https://bugs.openjdk.org/browse/JDK-8316581) | hotspot/runtime | Improve performance of Symbol::print\_value\_on() | +| 55 | [JDK-8318895](https://bugs.openjdk.org/browse/JDK-8318895) | hotspot/runtime | Deoptimization results in incorrect lightweight locking stack | +| 56 | [JDK-8316436](https://bugs.openjdk.org/browse/JDK-8316436) | hotspot/runtime | ContinuationWrapper uses unhandled nullptr oop | +| 57 | [JDK-8310596](https://bugs.openjdk.org/browse/JDK-8310596) | hotspot/runtime | Utilize existing method frame::interpreter\_frame\_monitor\_size\_in\_bytes() | +| 58 | [JDK-8306561](https://bugs.openjdk.org/browse/JDK-8306561) | hotspot/runtime | Possible out of bounds access in print\_pointer\_information | +| 59 | [JDK-8313782](https://bugs.openjdk.org/browse/JDK-8313782) | hotspot/runtime | Add user-facing warning if THPs are enabled but cannot be used | +| 60 | [JDK-8316735](https://bugs.openjdk.org/browse/JDK-8316735) | hotspot/runtime | Print LockStack in hs\_err files | +| 61 | [JDK-8316468](https://bugs.openjdk.org/browse/JDK-8316468) | hotspot/runtime | os::write incorrectly handles partial write | +| 62 | [JDK-8320597](https://bugs.openjdk.org/browse/JDK-8320597) | security-libs/java.security | RSA signature verification fails on signed data that does not encode params correctly | +| 63 | [JDK-8314045](https://bugs.openjdk.org/browse/JDK-8314045) | security-libs/javax.crypto | ArithmeticException in GaloisCounterMode | +| 64 | [JDK-8313742](https://bugs.openjdk.org/browse/JDK-8313742) | security-libs/javax.crypto | ZipFile.getManifestName fails during jar verification for Spring Boot | +| 65 | [JDK-8315452](https://bugs.openjdk.org/browse/JDK-8315452) | tools/javac | Erroneous AST missing modifiers for partial input | +| 66 | [JDK-8318144](https://bugs.openjdk.org/browse/JDK-8318144) | tools/javac | Match on enum constants with body compiles but fails with MatchException | +| 67 | [JDK-8225377](https://bugs.openjdk.org/browse/JDK-8225377) | tools/javac | type annotations are not visible to javac plugins across compilation boundaries | +| 68 | [JDK-8320001](https://bugs.openjdk.org/browse/JDK-8320001) | tools/javac | javac crashes while adding type annotations to the return type of a constructor | +| 69 | [JDK-8322883](https://bugs.openjdk.org/browse/JDK-8322883) | tools/javac | [BACKOUT] 8225377: type annotations are not visible to javac plugins across compilation boundaries | +| 70 | [JDK-8315942](https://bugs.openjdk.org/browse/JDK-8315942) | tools/jlink | Sort platform enums and definitions after JDK-8304913 follow-ups | +| 71 | [JDK-8315383](https://bugs.openjdk.org/browse/JDK-8315383) | tools/jlink | jlink SystemModulesPlugin incorrectly parses the options | +| 72 | [JDK-8301247](https://bugs.openjdk.org/browse/JDK-8301247) | tools/jpackage | JPackage app-image exe launches multiple exe's in JDK 17+ | +| 73 | [JDK-8313792](https://bugs.openjdk.org/browse/JDK-8313792) | tools/jshell | Verify 4th party information in src/jdk.internal.le/share/legal/jline.md | + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_2103.md b/corpus/changelog/java_jdk_releases/java_jdk_2103.md new file mode 100644 index 0000000000000000000000000000000000000000..c065aa9be61d48aca2be44793661890070bb61fd --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_2103.md @@ -0,0 +1,142 @@ +# Known Issues + +Source: https://www.oracle.com/java/technologies/javase/21-0-3-relnotes.html +Version: 21.0.3 + +#### Java™ SE Development Kit 21.0.3 (JDK 21.0.3) + +Release date: April 16, 2024 + +The full version string for this update release is 21.0.3+7 (where "+" means "build"). The version number is 21.0.3. + +#### IANA TZ Data 2024a + +JDK 21.0.3 contains IANA time zone data [2024a](https://mm.icann.org/pipermail/tz-announce/2024-February/000081.html) which contains the following changes: + +* Ittoqqortoormiit, Greenland changes time zones on 2024-03-31. +* Vostok, Antarctica changed time zones on 2023-12-18. +* Casey, Antarctica changed time zones five times since 2020. +* Code and data fixes for Palestine timestamps starting in 2072. +* A new data file zonenow.tab for timestamps starting now. +* Kazakhstan unifies on UTC+5 beginning 2024-03-01. +* Palestine springs forward a week later after Ramadan. +* zic no longer pretends to support indefinite-past DST. +* localtime no longer mishandles Ciudad Juárez in 2422. + +For more information, refer to [Timezone Data Versions in the JRE Software](https://www.oracle.com/java/technologies/tzdata-versions.html). + +#### Security Baselines + +The security baselines for the Java Runtime at the time of the release of JDK 21.0.3 are specified in the following table: + +| **Java Family Version** | **Security Baseline (Full Version String)** | +| --- | --- | +| 21 | 21.0.3+7 | +| 17 | 17.0.11+7 | +| 11 | 11.0.23+7 | +| 8 | 8u411-b09 | + +#### Keeping the JDK up to Date + +Oracle recommends that the JDK is updated with each Critical Patch Update. In order to determine if a release is the latest, the [Security Baseline](https://javadl-esd-secure.oracle.com/update/baseline.version) page can be used to determine which is the latest version for each release family. + +Critical patch updates, which contain security vulnerability fixes, are announced one year in advance on Critical Patch Updates, Security Alerts and Bulletins. It is not recommended that this JDK (version 21.0.3) be used after the next critical patch update scheduled for July 16, 2024. + +Java Management Service, available to all users, can help you find vulnerable Java versions in your systems. [Java SE Subscribers](https://www.oracle.com/java/java-se-subscription.html) and customers running in Oracle Cloud can use Java Management Service to update Java Runtimes and to do further security reviews like identifying potentially vulnerable third party libraries used by your Java programs. Existing Java Management Service user [click here](https://cloud.oracle.com/jms/overview) to log in to your dashboard. [The Java Management Service Documentation](https://docs.oracle.com/en-us/iaas/jms/index.html) provides a list of features available to everyone and those available only to customers. [Learn more about using Java Management Service](https://www.oracle.com/java/jms/) to monitor and secure your Java Installations. + +#### New Features + +security-libs/javax.crypto + +**[➜](#JDK-8319124) Update XML Security for Java to 3.0.3** ([JDK-8319124](https://bugs.openjdk.org/browse/JDK-8319124)) + +The XML Signature implementation has been updated to Santuario 3.0.3. Support for four new SHA-3 based RSA-MGF1 signature methods have been added: `SHA3_224_RSA_MGF1`, `SHA3_256_RSA_MGF1`, `SHA3_384_RSA_MGF1`, and `SHA3_512_RSA_MGF1`. While these new algorithm URIs are not defined in `javax.xml.crypto.dsig.SignatureMethod` in the JDK update releases, they may be represented as string literals in order to be functionally equivalent. SHA-3 hash algorithm support was delivered to JDK 9 via [JEP 287](https://openjdk.org/jeps/287). Releases earlier than that may use third party security providers. + +tools/jpackage + +**[➜](#JDK-8295111) `jpackage` Apps May Fail to Build on Debian Linux Distros Due to Missing Shared Libraries** ([JDK-8295111](https://bugs.openjdk.org/browse/JDK-8295111)) + +There is an issue on Debian Linux distros where `jpackage` could not always build an accurate list of required packages from shared libraries with symbolic links in their paths, causing installations to fail due to missing shared libraries. + +#### Other Notes + +client-libs/java.awt + +**[➜](#JDK-8322750) AWT SystemTray API Is Not Supported on Most Linux Desktops** ([JDK-8322750](https://bugs.openjdk.org/browse/JDK-8322750)) + +The `java.awt.SystemTray` API is used for notifications in a desktop taskbar and may include an icon representing an application. On Linux, the Gnome desktop's own icon support in the taskbar has not worked properly for several years due to a platform bug. This, in turn, has affected the JDK's API, which relies upon that. + +Therefore, in accordance with the existing Java SE specification, `java.awt.SystemTray.isSupported()` will return false where ever the JDK determines the platform bug is likely to be present. + +The impact of this is likely to be limited since applications always must check for that support anyway. Additionally, some distros have not supported the SystemTray for several years unless the end-user chooses to install non-bundled desktop extensions. + +security-libs/java.security + +**[➜](#JDK-8321408) Added Certainly R1 and E1 Root Certificates** ([JDK-8321408](https://bugs.openjdk.org/browse/JDK-8321408)) + +The following root certificates have been added to the cacerts truststore: + +```None ++ Certainly + + + certainlyrootr1 + DN: CN=Certainly Root R1, O=Certainly, C=US + ++ Certainly + + certainlyroote1 + DN: CN=Certainly Root E1, O=Certainly, C=US +``` + +tools/javac + +**[➜](#JDK-8317300) Align `javac` with the Java Language Specification by Rejecting `final` in Record Patterns** ([JDK-8317300](https://bugs.openjdk.org/browse/JDK-8317300)) + +JDK 21 introduced pattern matching in the Java language. However, `javac` allowed `final` in front of a record pattern, such as (`case final R(...) ->`), something which is not allowed by the Java Language Specification. + +Programs that could be compiled erroneously in JDK21 with `final` will now fail to compile. This change fixes the issue in the compiler. Impacted users will need to remove the `final` keyword. + +#### Updates to Third Party Libraries + +| Library | New Version | Module | JBS | +| --- | --- | --- | --- | +| FreeType | 2.13.2 | java.desktop | [JDK-8316028](https://bugs.openjdk.org/browse/JDK-8316028) | +| Xalan Java | 2.7.3 | java.xml | [JDK-8305814](https://bugs.openjdk.org/browse/JDK-8305814) | +| XML Security for Java | 3.0.3 | java.xml.crypto | [JDK-8319124](https://bugs.openjdk.org/browse/JDK-8319124) | + +#### Bug Fixes + +This release also contains fixes for security vulnerabilities described in the [Oracle Critical Patch Update](https://www.oracle.com/security-alerts/cpuApr2024.html#AppendixJAVA). + +➜ Issues fixed in 21.0.3: + +| # | JBS | Component/Subcomponent | Summary | +| --- | --- | --- | --- | +| 1 | [JDK-8319103](https://bugs.openjdk.org/browse/JDK-8319103) | client-libs/javax.swing | Popups that request focus are not shown on Linux with Wayland | +| 2 | [JDK-8318590](https://bugs.openjdk.org/browse/JDK-8318590) | client-libs/javax.swing | JButton ignores margin when painting HTML text | +| 3 | [JDK-8299058](https://bugs.openjdk.org/browse/JDK-8299058) | core-libs/java.net | AssertionError in sun.net.httpserver.ServerImpl when connection is idle | +| 4 | [JDK-8323659](https://bugs.openjdk.org/browse/JDK-8323659) | core-libs/java.util.concurrent | LinkedTransferQueue add and put methods call overridable offer | +| 5 | [JDK-8321480](https://bugs.openjdk.org/browse/JDK-8321480) | core-libs/java.util:i18n | ISO 4217 Amendment 176 Update | +| 6 | [JDK-8314612](https://bugs.openjdk.org/browse/JDK-8314612) | hotspot/compiler | TestUnorderedReduction.java fails with -XX:MaxVectorSize=32 and -XX:+AlignVector | +| 7 | [JDK-8321542](https://bugs.openjdk.org/browse/JDK-8321542) | hotspot/compiler | C2: Missing ChaCha20 stub for x86\_32 leads to crashes | +| 8 | [JDK-8313720](https://bugs.openjdk.org/browse/JDK-8313720) | hotspot/compiler | C2 SuperWord: wrong result with -XX:+UseVectorCmov -XX:+UseCMoveUnconditionally | +| 9 | [JDK-8321974](https://bugs.openjdk.org/browse/JDK-8321974) | hotspot/compiler | Crash in ciKlass::is\_subtype\_of because TypeAryPtr::\_klass is not initialized | +| 10 | [JDK-8316661](https://bugs.openjdk.org/browse/JDK-8316661) | hotspot/compiler | CompilerThread leaks CodeBlob memory when dynamically stopping compiler thread in non-product | +| 11 | [JDK-8321215](https://bugs.openjdk.org/browse/JDK-8321215) | hotspot/compiler | Incorrect x86 instruction encoding for VSIB addressing mode | +| 12 | [JDK-8316594](https://bugs.openjdk.org/browse/JDK-8316594) | hotspot/compiler | C2 SuperWord: wrong result with hand unrolled loops | +| 13 | [JDK-8319879](https://bugs.openjdk.org/browse/JDK-8319879) | hotspot/compiler | Stress mode to randomize incremental inlining decision | +| 14 | [JDK-8309203](https://bugs.openjdk.org/browse/JDK-8309203) | hotspot/compiler | C2: remove copy-by-value of GrowableArray for InterfaceSet | +| 15 | [JDK-8310844](https://bugs.openjdk.org/browse/JDK-8310844) | hotspot/compiler | [AArch64] C1 compilation fails because monitor offset in OSR buffer is too large for immediate | +| 16 | [JDK-8319372](https://bugs.openjdk.org/browse/JDK-8319372) | hotspot/compiler | C2 compilation fails with "Bad immediate dominator info" | +| 17 | [JDK-8321599](https://bugs.openjdk.org/browse/JDK-8321599) | hotspot/compiler | Data loss in AVX3 Base64 decoding | +| 18 | [JDK-8322321](https://bugs.openjdk.org/browse/JDK-8322321) | hotspot/runtime | Add man page doc for -XX:+VerifySharedSpaces | +| 19 | [JDK-8323243](https://bugs.openjdk.org/browse/JDK-8323243) | hotspot/runtime | JNI invocation of an abstract instance method corrupts the stack | +| 20 | [JDK-8320208](https://bugs.openjdk.org/browse/JDK-8320208) | security-libs/java.security | Update Public Suffix List to b5bf572 | +| 21 | [JDK-8318971](https://bugs.openjdk.org/browse/JDK-8318971) | tools/jar | Better Error Handling for Jar Tool When Processing Non-existent Files | +| 22 | [JDK-8305971](https://bugs.openjdk.org/browse/JDK-8305971) | tools/javac | NPE in JavacProcessingEnvironment for missing enum constructor body | +| 23 | [JDK-8322040](https://bugs.openjdk.org/browse/JDK-8322040) | tools/javac | Missing array bounds check in ClassReader.parameter | +| 24 | [JDK-8320145](https://bugs.openjdk.org/browse/JDK-8320145) | tools/javac | Compiler should accept final variable in Record Pattern | +| 25 | [JDK-8321582](https://bugs.openjdk.org/browse/JDK-8321582) | tools/javac | yield .class not parsed correctly. | +| 26 | [JDK-8321164](https://bugs.openjdk.org/browse/JDK-8321164) | tools/javac | javac with annotation processor throws AssertionError: Filling jrt:/... during JarFileObject[/...] | +| 27 | [JDK-8322159](https://bugs.openjdk.org/browse/JDK-8322159) | tools/javac | ThisEscapeAnalyzer crashes for erroneous code | + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_2104.md b/corpus/changelog/java_jdk_releases/java_jdk_2104.md new file mode 100644 index 0000000000000000000000000000000000000000..52d105df03de90b6c35cfc71a6fa8ace9049696d --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_2104.md @@ -0,0 +1,31 @@ +# Java_JDK 21.0.4 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/21-0-4-relnotes.html +Version: 21.0.4 + +#### Java SE 21.0.4 Bundled Patch Release (BPR) - Bug Fixes and Updates + +The following sections summarize changes made in all Java SE 21.0.4 BPR. Bug fixes and any other changes are listed below in date order, most current BPR first. Note that bug fixes in the previous BPR are also included in the current BPR. + +#### Changes in Java SE 21.0.4.0.2 + +#### Bug Fixes + +Release date: August 16, 2024 + +| BugId | Category | Subcategory | Summary | +| --- | --- | --- | --- | +| JDK-8336107 (not public) | install | | JDK rpm upgrade from 11.0.23 to 11.0.25 leaves "orphan" alternatives entry | + +#### Changes in Java SE 21.0.4.0.1 + +#### Bug Fixes + +Release date: July 16, 2024 + +| BugId | Category | Subcategory | Summary | +| --- | --- | --- | --- | +| [JDK-8322726](https://bugs.openjdk.org/browse/JDK-8322726) | hotspot | compiler | C2: Unloaded signature class kills argument value | +| [JDK-8331885](https://bugs.openjdk.org/browse/JDK-8331885) | hotspot | compiler | C2: meet between unloaded and speculative types is not symmetric | + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_2105.md b/corpus/changelog/java_jdk_releases/java_jdk_2105.md new file mode 100644 index 0000000000000000000000000000000000000000..d9e904ace75e4fb8e367f397b1b0eeb0bd3dc7c0 --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_2105.md @@ -0,0 +1,87 @@ +# Notable Issues Resolved + +Source: https://www.oracle.com/java/technologies/javase/21-0-5-relnotes.html +Version: 21.0.5 + +#### Java™ SE Development Kit 21.0.5 (JDK 21.0.5) + +Release date: October 15, 2024 + +The full version string for this update release is 21.0.5+9 (where "+" means "build"). The version number is 21.0.5. + +#### IANA TZ Data 2024a + +For more information, refer to [Timezone Data Versions in the JRE Software](https://www.oracle.com/java/technologies/tzdata-versions.html). + +#### Security Baselines + +The security baselines for the Java Runtime at the time of the release of JDK 21.0.5 are specified in the following table: + +| **Java Family Version** | **Security Baseline (Full Version String)** | +| --- | --- | +| 21 | 21.0.5+9 | +| 17 | 17.0.13+10 | +| 11 | 11.0.25+9 | +| 8 | 1.8.0\_431-b10 | + +#### Keeping the JDK up to Date + +Oracle recommends that the JDK is updated with each Critical Patch Update. +In order to determine if a release is the latest, the [Security Baseline](https://javadl-esd-secure.oracle.com/update/baseline.version) page can +be used to determine which is the latest version for each release family. + +Critical patch updates, which contain security vulnerability fixes, are announced one year in advance on +Critical Patch Updates, Security Alerts and Bulletins. +It is not recommended that this JDK (version 21.0.5) be used after the next critical patch update scheduled +for January 21, 2025. + +Java Management Service, available to all users, can help you find vulnerable Java versions in your systems. [Java SE Subscribers](https://www.oracle.com/java/java-se-subscription.html) and customers running in Oracle Cloud can use Java Management Service to update Java Runtimes and to do further security reviews like identifying potentially vulnerable third party libraries used by your Java programs. Existing Java Management Service user [click here](https://cloud.oracle.com/jms/overview) to log in to your dashboard. [The Java Management Service Documentation](https://docs.oracle.com/en-us/iaas/jms/index.html) provides a list of features available to everyone and those available only to customers. [Learn more about using Java Management Service](https://www.oracle.com/java/jms/) to monitor and secure your Java Installations. + +#### New Features + +security-libs/java.security + +**[➜](#JDK-8051959) Thread and Timestamp Options for java.security.debug System Property** ([JDK-8051959](https://bugs.openjdk.org/browse/JDK-8051959)) + +The `java.security.debug` system property now accepts arguments which add thread ID, thread name, caller information, and timestamp information to debug statements for all components or a specific component. + +`+timestamp` can be appended to debug options to print a timestamp for that debug option. `+thread` can be appended to debug options to print thread and caller information for that debug option. + +Examples: `-Djava.security.debug=all+timestamp+thread` adds timestamp and thread information to every debug statement generated. + +`-Djava.security.debug=properties+timestamp` adds timestamp information to every debug statement generated for the `properties` component. + +You can also specify `-Djava.security.debug=help` which will display a complete list of supported components and arguments. + +See [Printing Thread and Timestamp Information](https://docs.oracle.com/en/java/javase/21/security/troubleshooting-security.html#GUID-EDB76EF1-D4B2-4D32-83C1-554129526FB4) for more information. + +install/install + +**[➜](#JDK-8336107) JDK RPM Upgrade Leaves Orphan Alternatives Entry** (JDK-8336107 (not public)) + +Fixed the issue with entries in the "java" and "javac" groups not being properly managed during an RPM upgrade. + +Upgrading from an older Java RPM installed into a shared directory (`/usr/lib/jvm/jdk-${FEATURE}-oracle-${ARCH}`) to a Java RPM installing into a version-specific directory (`/usr/lib/jvm/jdk-${VERSION}-oracle-${ARCH}`), results in the older Java entries in the "java" and "javac" groups not being deleted. + +The issue does not manifest until the new Java is uninstalled. When it is uninstalled and Java from the lower release is installed, running Java commands like `java` or `keytool` without the full path specified will result in the "command not found" error. For example, install 21.0.3; upgrade it to 21.0.4; uninstall 21.0.4; install any Java update of 17 or 11 or 8 release; run "java" from the command line. The command will fail with the "command not found" error. + +Manually delete orphan Java entries in the "java" and "javac" groups to workaround the issue. + +#### Other Notes + +core-libs/java.net + +**[➜](#JDK-8328286) New Default Limits in the JDK HTTP Implementations** (JDK-8328286 (not public)) + +New Default limits have been added to HTTP in the JDK. + +The JDK built-in implementation of the legacy URL protocol handler for HTTP, `HttpURLConnection`, and the new HttpClient, in the module `java.net.http`, now have a default limit on the maximum response headers size they will accept from a remote party. The limit is set by default at 384kB (393216 bytes) and is computed as the cumulative size of all header names and header values plus an overhead of 32 bytes per header name value pair. + +The default value of the limit can be changed by specifying a positive value with the `jdk.http.maxHeaderSize` system property on the command line, or in the `$JAVA_HOME/conf/net.properties` file. A negative or zero value is interpreted as no limit. If the limit is exceeded, the request will fail with a protocol exception. + +The JDK built-in implementation of the `com.sun.net.httpserver.HttpServer` (`jdk.httpserver`) implements a similar limit for the maximum request header size the server is prepared to accept. The HttpServer limit can be changed by specifying a positive value with the `sun.net.httpserver.maxReqHeaderSize` system property on the command line. A negative or zero value is interpreted as no limit. The limit is set by default at 384kB (393216 bytes) and the size is computed in the same way as explained above. If the limit is exceeded, the connection is closed. + +In addition, the JDK built-in implementation of the new `java.net.http.HttpClient` enforces two additional limits: + +1. The system property `jdk.httpclient.maxNonFinalResponses` can be specified with a positive value on the `java` command line, or in the `$JAVA_HOME/conf/net.properties` file, to control how many interim responses the client will accept before receiving a final response. An interim response is considered informational and is a response whose status is in the range [100, 199]. These responses are typically either handled internally or simply discarded by the implementation. The default limit is now set at a maximum of 8 interim responses before receiving the final response. A negative or zero value is interpreted as no limit. If the limit is exceeded, the request will fail with a protocol exception. +2. The system property `jdk.httpclient.maxLiteralWithIndexing`can be specified with a positive value on the `java` command line, or in the `$JAVA_HOME/conf/net.properties` file, to control how many additions a server may request a client to make to the HPack dynamic table when decoding a set of headers. The default maximum value is now set to 512. A negative or zero value is interpreted as no limit. If the limit is exceeded, the request will fail with a protocol exception. diff --git a/corpus/changelog/java_jdk_releases/java_jdk_2106.md b/corpus/changelog/java_jdk_releases/java_jdk_2106.md new file mode 100644 index 0000000000000000000000000000000000000000..9e59b3b1aaf970376c8056e88e60cebffaece0af --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_2106.md @@ -0,0 +1,89 @@ +# Java_JDK 21.0.6 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/21-0-6-relnotes.html +Version: 21.0.6 + +#### Java™ SE Development Kit 21.0.6 (JDK 21.0.6) + +January 21, 2025 + +The full version string for this update release is 21.0.6+8 (where "+" means "build"). The version number is 21.0.6. This JDK conforms to version 21 of the Java SE Specification ([JSR 396](https://jcp.org/en/jsr/detail?id=396) 2023-09-19). + +#### IANA TZ Data 2024b + +JDK 21.0.6 contains IANA time zone data [2024b](https://lists.iana.org/hyperkitty/list/tz-announce@iana.org/thread/IZ7AO6WRE3W3TWBL5IR6PMQUL433BQIE/) which contains the following changes: + +* Improve historical data for Mexico, Mongolia, and Portugal. +* System V names are now obsolescent. +* The main data form now uses %z. +* The code now conforms to RFC 8536 for early timestamps. +* Support POSIX.1-2024, which removes asctime\_r and ctime\_r. + +For more information, refer to [Timezone Data Versions in the JRE Software](https://www.oracle.com/java/technologies/tzdata-versions.html). + +#### Security Baselines + +The security baselines for the Java Runtime Environment (JRE) at the time of the release of JDK 21.0.6 are specified in the following table: + +| **Java Family Version** | **Security Baseline (Full Version String)** | +| --- | --- | +| 21 | 21.0.6+8 | +| 17 | 17.0.14+8 | +| 11 | 11.0.26+7 | +| 8 | 1.8.0\_441-b07 | + +#### Keeping the JDK up to Date + +Oracle recommends that the JDK is updated with each Critical Patch Update. In order to determine if a release is the latest, the [Security Baseline](https://javadl-esd-secure.oracle.com/update/baseline.version) page can be used to determine which is the latest version for each release family. + +Critical patch updates, which contain security vulnerability fixes, are announced one year in advance on Critical Patch Updates, Security Alerts and Bulletins. It is not recommended that this JDK (version 21.0.6) be used after the next critical patch update scheduled for April 15, 2025. + +Java Management Service, available to all users, can help you find vulnerable Java versions in your systems. [Java SE Subscribers](https://www.oracle.com/java/java-se-subscription.html) and customers running in Oracle Cloud can use Java Management Service to update Java Runtimes and to do further security reviews like identifying potentially vulnerable third party libraries used by your Java programs. Existing Java Management Service user [click here](https://cloud.oracle.com/jms/overview) to log in to your dashboard. [The Java Management Service Documentation](https://docs.oracle.com/en-us/iaas/jms/index.html) provides a list of features available to everyone and those available only to customers. [Learn more about using Java Management Service](https://www.oracle.com/java/jms/) to monitor and secure your Java Installations. + +#### Other Notes + +core-libs/java.lang + +**[➜](#JDK-8335428) `ProcessBuilder` on Windows Quotes Argument Strings Containing Any Space Character** (JDK-8335428 (not public)) + +On Windows, the `ProcessBuilder` has expanded the quoting of argument strings when starting a process to ensure they are recognized by the application as a single command argument. The set of space characters has been expanded from *space* (0x20) to include all space characters as defined by `java.lang.Character.isSpaceChar`, which includes all Unicode space separator characters, such as EN-SPACE (0x2002), and line separator and paragraph separator characters. + +core-libs/java.time + +**[➜](#JDK-8339637) Support for Time Zone Database 2024b** ([JDK-8339637](https://bugs.openjdk.org/browse/JDK-8339637)) + +IANA Time Zone Database has been upgraded to 2024b. This version mainly includes changes to improve historical data for Mexico, Mongolia, and Portugal. It also changes one timestamp abbreviation, for the time zone 'MET'. Also Asia/Choibalsan is now an alias for Asia/Ulaanbaatar. + +The new tzdata changes also impact some legacy time zone IDs. As per 2024b changes "EST" links to "America/Panama", "HST" links to "Pacific/Honolulu" and "MST" links to "America/Phoenix". To maintain compatibility with the Java SE specification, the `java.time.ZoneId.SHORT_IDS` Map has not changed. Further details are available at [JDK-8342331](https://bugs.openjdk.org/browse/JDK-8342331) + +#### Bug Fixes + +This release also contains fixes for security vulnerabilities described in the [Oracle Critical Patch Update](https://www.oracle.com/security-alerts/cpujan2025.html#AppendixJAVA). + +➜ Issues fixed in 21.0.6: + +| # | JBS | Component/Subcomponent | Summary | +| --- | --- | --- | --- | +| 1 | [JDK-8329667](https://bugs.openjdk.org/browse/JDK-8329667) | client-libs/javax.accessibility | [macos] Issue with JTree related fix for JDK-8317771 | +| 2 | [JDK-8340812](https://bugs.openjdk.org/browse/JDK-8340812) | core-libs/java.lang.invoke | LambdaForm customization via MethodHandle::updateForm is not thread safe | +| 3 | [JDK-8320575](https://bugs.openjdk.org/browse/JDK-8320575) | core-libs/java.lang:reflect | generic type information lost on mandated parameters of record's compact constructors | +| 4 | [JDK-8334719](https://bugs.openjdk.org/browse/JDK-8334719) | core-libs/java.nio | (se) Deferred close of SelectableChannel may result in a Selector doing the final close before concurrent I/O on channel has completed | +| 5 | [JDK-8328366](https://bugs.openjdk.org/browse/JDK-8328366) | core-libs/java.util.concurrent | Thread.setContextClassloader from thread in FJP commonPool task no longer works after JDK-8327501 | +| 6 | [JDK-8319876](https://bugs.openjdk.org/browse/JDK-8319876) | core-svc/java.lang.management | Reduce memory consumption of VM\_ThreadDump::doit | +| 7 | [JDK-8321509](https://bugs.openjdk.org/browse/JDK-8321509) | hotspot/compiler | False positive in get\_trampoline fast path causes crash | +| 8 | [JDK-8340214](https://bugs.openjdk.org/browse/JDK-8340214) | hotspot/compiler | C2 compilation asserts with "no node with a side effect" in PhaseIdealLoop::try\_sink\_out\_of\_loop | +| 9 | [JDK-8337066](https://bugs.openjdk.org/browse/JDK-8337066) | hotspot/compiler | Repeated call of StringBuffer.reverse with double byte string returns wrong result | +| 10 | [JDK-8335709](https://bugs.openjdk.org/browse/JDK-8335709) | hotspot/compiler | C2: assert(!loop->is\_member(get\_loop(useblock))) failed: must be outside loop | +| 11 | [JDK-8339648](https://bugs.openjdk.org/browse/JDK-8339648) | hotspot/gc | ZGC: Division by zero in rule\_major\_allocation\_rate | +| 12 | [JDK-8338389](https://bugs.openjdk.org/browse/JDK-8338389) | hotspot/jfr | [JFR] Long strings should be added to the string pool | +| 13 | [JDK-8325469](https://bugs.openjdk.org/browse/JDK-8325469) | hotspot/runtime | Freeze/Thaw code can crash in the presence of OSR frames | +| 14 | [JDK-8335409](https://bugs.openjdk.org/browse/JDK-8335409) | hotspot/runtime | Can't allocate and retain memory from resource area in frame::oops\_interpreted\_do oop closure after 8329665 | +| 15 | [JDK-8319973](https://bugs.openjdk.org/browse/JDK-8319973) | hotspot/runtime | AArch64: Save and restore FPCR in the call stub | +| 16 | [JDK-8319818](https://bugs.openjdk.org/browse/JDK-8319818) | hotspot/runtime | Address GCC 13.2.0 warnings (stringop-overflow and dangling-pointer) | +| 17 | [JDK-8340387](https://bugs.openjdk.org/browse/JDK-8340387) | hotspot/runtime | Update OS detection code to recognize Windows Server 2025 | +| 18 | [JDK-8337410](https://bugs.openjdk.org/browse/JDK-8337410) | hotspot/test | The makefiles should set problemlist and adjust timeout basing on the given VM flags | +| 19 | [JDK-8328723](https://bugs.openjdk.org/browse/JDK-8328723) | security-libs/java.security | IP Address error when client enables HTTPS endpoint check on server socket | +| 20 | [JDK-8331864](https://bugs.openjdk.org/browse/JDK-8331864) | security-libs/java.security | Update Public Suffix List to 1cbd6e7 | +| 21 | [JDK-8322809](https://bugs.openjdk.org/browse/JDK-8322809) | tools/jlink | SystemModulesMap::classNames and moduleNames arrays do not match the order | + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_2107.md b/corpus/changelog/java_jdk_releases/java_jdk_2107.md new file mode 100644 index 0000000000000000000000000000000000000000..be55fac89a3b615076bf9338220e1056e6de7323 --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_2107.md @@ -0,0 +1,20 @@ +# Java_JDK 21.0.7 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/21-0-7-relnotes.html +Version: 21.0.7 + +#### Java SE 21.0.7 Bundled Patch Release (BPR) - Bug Fixes and Updates + +The following sections summarize changes made in all Java SE 21.0.7 BPR. Bug fixes and any other changes are listed below in date order, most current BPR first. Note that bug fixes in the previous BPR are also included in the current BPR. + +#### Changes in Java SE 21.0.7.0.1 + +#### Bug Fixes + +Release date: June 27, 2025 + +| BugId | Category | Subcategory | Summary | +| --- | --- | --- | --- | +| [JDK-8332506](https://bugs.openjdk.org/browse/JDK-8332506) | hotspot | runtine | SIGFPE In ObjectSynchronizer::is\_async\_deflation\_needed() | + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_2108.md b/corpus/changelog/java_jdk_releases/java_jdk_2108.md new file mode 100644 index 0000000000000000000000000000000000000000..bfa66323c77c2350217268acb77703f8613a8fd4 --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_2108.md @@ -0,0 +1,30 @@ +# Java_JDK 21.0.8 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/21-0-8-relnotes.html +Version: 21.0.8 + +#### Java SE 21.0.8 Bundled Patch Release (BPR) - Bug Fixes and Updates + +The following sections summarize changes made in all Java SE 21.0.8 BPR. Bug fixes and any other changes are listed below in date order, most current BPR first. Note that bug fixes in the previous BPR are also included in the current BPR. + +#### Changes in Java SE 21.0.8.0.2 + +#### Bug Fixes + +Release date: July 25, 2025 + +| BugId | Category | Subcategory | Summary | +| --- | --- | --- | --- | +| [JDK-8358764](https://bugs.openjdk.org/browse/JDK-8358764) | core-libs | java.nio | (sc) SocketChannel.close when thread blocked in read causes connection to be reset (win) | + +#### Changes in Java SE 21.0.8.0.1 + +#### Bug Fixes + +Release date: July 15, 2025 + +| BugId | Category | Subcategory | Summary | +| --- | --- | --- | --- | +| JDK-8355072 (not public) | install | install | [OL9] java on systemd environments: /etc/rc.d/init.d/jexec' lacks a native systemd unit file | + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_2109.md b/corpus/changelog/java_jdk_releases/java_jdk_2109.md new file mode 100644 index 0000000000000000000000000000000000000000..14a729c29cbcd40c0dcd6ad00e7420a86bd3568f --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_2109.md @@ -0,0 +1,207 @@ +# Java_JDK 21.0.9 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/21-0-9-relnotes.html +Version: 21.0.9 + +#### Java™ SE Development Kit 21.0.9 (JDK 21.0.9) + +October 21, 2025 + +The full version string for this update release is 21.0.9+7 (where "+" means "build"). +The version number is 21.0.9. This JDK conforms to version 21 of the Java SE Specification ([JSR 396](https://jcp.org/en/jsr/detail?id=396) 2023-09-19). + +#### IANA TZ Data 2025b + +For more information, refer to [Timezone Data Versions in the JRE Software](https://www.oracle.com/java/technologies/tzdata-versions.html). + +#### Security Baselines + +The security baselines for the Java Runtime Environment (JRE) at the time of the release of JDK 21.0.9 are specified in the following table: + +| **Java Family Version** | **Security Baseline (Full Version String)** | +| --- | --- | +| 21 | 21.0.9+7 | +| 17 | 17.0.17+8 | +| 11 | 11.0.29+8 | +| 8 | 1.8.0\_471-b09 | + +#### Keeping the JDK up to Date + +Oracle recommends that the JDK is updated with each Critical Patch Update. +In order to determine if a release is the latest, the [Security Baseline](https://javadl-esd-secure.oracle.com/update/baseline.version) page can +be used to determine which is the latest version for each release family. + +Critical patch updates, which contain security vulnerability fixes, are announced one year in advance on +Critical Patch Updates, Security Alerts and Bulletins. +It is not recommended that this JDK (version 21.0.9) be used after the next critical patch update scheduled +for January 20, 2026. + +Java Management Service, available to all users, can help you find vulnerable Java versions in your systems. [Java SE Subscribers](https://www.oracle.com/java/java-se-subscription.html) and customers running in Oracle Cloud can use Java Management Service to update Java Runtimes and to do further security reviews like identifying potentially vulnerable third party libraries used by your Java programs. Existing Java Management Service user [click here](https://cloud.oracle.com/jms/overview) to log in to your dashboard. [The Java Management Service Documentation](https://docs.oracle.com/en-us/iaas/jms/index.html) provides a list of features available to everyone and those available only to customers. [Learn more about using Java Management Service](https://www.oracle.com/java/jms/) to monitor and secure your Java Installations. + +#### Availability of Oracle JDK 21 under NFTC + +Oracle JDK 21 LTS, released in September 2023, has been permissively licensed under the [free Java license](https://www.oracle.com/downloads/licenses/no-fee-license.html) and will continue to be so until one year after the subsequent LTS release. Oracle designated Oracle JDK 25, released in September of 2025, as a Long Term Support (LTS) release. Therefore, update releases of Oracle JDK 21 after September of 2026 will switch to the [Java SE OTN](https://www.oracle.com/downloads/licenses/javase-license1.html) license, the same license under which we offer updates to Java 8, 11, and 17. Users wishing to receive updates of the Oracle JDK under the [free Java license](https://www.oracle.com/downloads/licenses/no-fee-license.html) should migrate to Oracle JDK 25. + +#### New Features + +security-libs/javax.net.ssl + +**[➜](#JDK-8349583) Mechanism to Disable Signature Schemes Based on Their TLS Scope** ([JDK-8349583](https://bugs.openjdk.org/browse/JDK-8349583)) + +TLS protocol specific usage constraints are now supported by the `jdk.tls.disabledAlgorithms` property in the `java.security` configuration file, as follows: + +```None +UsageConstraint: + + usage UsageType { UsageType } + +UsageType: + HandshakeSignature | CertificateSignature +``` + +`HandshakeSignature` restricts the use of an algorithm in TLS handshake signatures. `CertificateSignature` restricts the use of an algorithm in certificate signatures. An algorithm with this constraint cannot include other usage types defined in the `jdk.certpath.disabledAlgorithms` property. The usage type follows the keyword and more than one usage type can be specified with a whitespace delimiter. + +security-libs/javax.net.ssl + +**[➜](#JDK-8341964) Mechanism to Disable TLS Cipher Suites by Pattern Matching** ([JDK-8341964](https://bugs.openjdk.org/browse/JDK-8341964)) + +TLS cipher suites can be disabled with the `jdk.tls.disabledAlgorithms` security property in the `java.security` configuration file using one or more `*` wildcard characters. For example, "TLS\_RSA\_\*" disables all cipher suites that start with "TLS\_RSA\_". Only cipher suites starting with "TLS\_" are allowed to have wildcard characters. + +security-libs/javax.xml.crypto + +**[➜](#JDK-8344137) Update XML Security for Java to 3.0.5** ([JDK-8344137](https://bugs.openjdk.org/browse/JDK-8344137)) + +The XML Signature implementation has been updated to Santuario 3.0.5. Support for four new SHA-3 based ECDSA `SignatureMethod` algorithms have been added: `SignatureMethod.ECDSA_SHA3_224`, `SignatureMethod.ECDSA_SHA3_256`, `SignatureMethod.ECDSA_SHA3_384`, and `SignatureMethod.ECDSA_SHA3_512`. + +#### Known Issues + +core-libs/java.net + +**[➜](#JDK-8368741) Datagram Packet Loss on macOS 26 and macOS 15.6 and Above** ([JDK-8368741](https://bugs.openjdk.org/browse/JDK-8368741)) + +When IPv6 is enabled, the JDK uses dual stack IPv4/IPv6 sockets by default. Binding, connecting, or sending datagrams uses IPv4-mapped IPv6 addresses in this case. + +On some hosts running macOS version 15.6.x and above, and macOS 26, it has been observed that when a datagram socket bound to a IPv4 mapped IPv6 address sends a packet, either using the `java.net.DatagramSocket` or `java.nio.channels.DatagramChannel` APIs, then the first packet is lost and never gets delivered. A second invocation of `send` on the same socket, even to the same destination address, correctly delivers the packet and it is received by the recipient. + +A bug has been filed with Apple (feedback issue id FB20302424) seeking their assistance. The issue is currently unresolved. + +Until the issue is resolved, there are a couple of workarounds that applications can consider: + +* If using IPv4 is acceptable, then the `java` command can be launched with `-Djava.net.preferIPv4Stack=true` to use IPv4 sockets by default. +* If using `-Djava.net.preferIPv4Stack=true` is not acceptable, a more local workaround can be applied by changing the application code to create a `java.nio.channels.DatagramChannel` with `java.net.StandardProtocolFamily.INET` as the protocol family and then bind the channel to a IPv4 address. + +#### Removed Features and Options + +security-libs/java.security + +**[➜](#JDK-8361212) Removed Four AffirmTrust Root Certificates** ([JDK-8361212](https://bugs.openjdk.org/browse/JDK-8361212)) + +The following root certificates, which are deactivated and no longer in use, have been removed from the `cacerts` keystore: + +```None ++ alias name "affirmtrustcommercialca [jdk]" + + Distinguished Name: CN=AffirmTrust Commercial, O=AffirmTrust, C=US + ++ alias name "affirmtrustnetworkingca [jdk]" + Distinguished Name: CN=AffirmTrust Networking, O=AffirmTrust, C=US + ++ alias name "affirmtrustpremiumca [jdk]" + Distinguished Name: CN=AffirmTrust Premium, O=AffirmTrust, C=US + ++ alias name "affirmtrustpremiumeccca [jdk]" + Distinguished Name: CN=AffirmTrust Premium ECC, O=AffirmTrust, C=US +``` + +#### Other Notes + +install/install + +**[➜](#JDK-8355072) Use systemd Instead of init for jexec** (JDK-8355072 (not public)) + +Linux RPM JDK installers now use `systemd` instead of `init` to manage the automatic jar file execution (`jexec`) service. + +hotspot/runtime + +**[➜](#JDK-8313083) Print 'rss' and 'cache' As Part of the Container Information** ([JDK-8313083](https://bugs.openjdk.org/browse/JDK-8313083)) + +The HotSpot runtime code has been updated to additionally print a container's 'rss' and 'cache'. The additional output can be found in the JVM's response to a "jcmd [PID] VM.info" request and in the `hs_err` file generated in case of JVM abrupt termination. + +This will help monitoring and troubleshooting OutOfMemory situations as OOM killer can terminate a process if its `rss` + `cache` usage reaches the max memory limit of the container. + +security-libs/java.security + +**[➜](#JDK-8313367) SunMSCAPI Provider Opens the Windows Local Computer Key Store in Read-Only Mode in Non-Elevated Processes** ([JDK-8313367](https://bugs.openjdk.org/browse/JDK-8313367)) + +The Local Computer key store is accessed using the `CERT_STORE_MAXIMUM_ALLOWED_FLAG`. Since this store is typically managed by administrators for security reasons, processes are only given read-only access to specific private keys. By opening the store in read-only mode, non-elevated processes can now securely use these keys without requiring elevated permissions. + +tools/launcher + +**[➜](#JDK-8337506) Disable "best-fit" Mapping on Windows Command Line** ([JDK-8337506](https://bugs.openjdk.org/browse/JDK-8337506)) + +Command line arguments to the Java launcher are no longer converted with [Windows' "best-fit" mapping](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-ucoderef/d1980631-6401-428e-a49d-d71394be7da8) when the arguments include unmappable characters for the ANSI code page. This mapping has been intervening in the Java launcher's argument parsing. Unmappable characters are now replaced with the default replacement character, such as '?' in some cases. For rare cases, where applications need those unmappable characters on the command line, select UTF-8 in Windows Regional Settings. + +xml/jaxp + +**[➜](#JDK-8356294) FEATURE\_SECURE\_PROCESSING for XPath** (JDK-8356294 (not public)) + +The JDK XPath implementation now supports [External Access Properties](https://docs.oracle.com/en/java/javase/24/docs/api/java.xml/javax/xml/XMLConstants.html#EAP). It also enables restriction through these properties when secure processing is set to true explicitly. To secure an XPath processor against risky evaluation of external DTD references, enable secure processing as demonstrated in the following code: + +`XPathFactory xf = XPathFactory.newInstance(); +xf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);` + +This process will cause the XPath processor created via the factory to throw `XPathExpressionException` if used to evaluate a raw XML document that contains external references such as an external DTD. + +Mitigation includes using the [External Access Properties](https://docs.oracle.com/en/java/javase/24/docs/api/java.xml/javax/xml/XMLConstants.html#EAP) to override that enabled by FSP. For example, the following setting will allow the process to continue when there is a reference to a file-based external DTD in the XML document: + +`xf.setProperty(ACCESS_EXTERNAL_DTD, "file");` + +It is recommended that applications use the XPath processor to evaluate DOM rather than raw XML documents. + +security-libs/javax.net.ssl + +**[➜](#JDK-8350582) Improved Logging Behavior for javax.net.debug=ssl JSSE Debug Property** ([JDK-8350582](https://bugs.openjdk.org/browse/JDK-8350582)) + +The logging behavior of the TLS `javax.net.debug` system property has been improved in this release. The `javax.net.debug` property is used to generate TLS debug logs from the default JSSE provider. Previously, using the `ssl` option via `-Djavax.net.debug=ssl` produced very limited output, which reduced its usefulness for troubleshooting. + +With this update, setting `-Djavax.net.debug=ssl` now enables comprehensive SSL debug logging, except for the `data`, `packet`, and `plaintext` sub-options. Applications using this option will now see significantly more detailed debug information in logs. + +#### Bug Fixes + +This release also contains fixes for security vulnerabilities described in the [Oracle Critical Patch Update](https://www.oracle.com/security-alerts/cpujul2025.html#AppendixJAVA). + +➜ Issues fixed in 21.0.8: + +| # | JBS | Component/Subcomponent | Summary | +| --- | --- | --- | --- | +| 1 | [JDK-8355528](https://bugs.openjdk.org/browse/JDK-8355528) | client-libs/2d | Update HarfBuzz to 11.2.0 | +| 2 | [JDK-8358452](https://bugs.openjdk.org/browse/JDK-8358452) | client-libs/java.awt | JNI exception pending in Java\_sun\_awt\_screencast\_ScreencastHelper\_remoteDesktopKeyImpl of screencast\_pipewire.c:1214 (ID: 51119) | +| 3 | [JDK-8360647](https://bugs.openjdk.org/browse/JDK-8360647) | client-libs/java.awt | [XWayland] [OL10] NumPad keys are not triggered | +| 4 | [JDK-8351907](https://bugs.openjdk.org/browse/JDK-8351907) | client-libs/java.awt | [XWayland] [OL10] Robot.mousePress() is delivered to wrong place | +| 5 | [JDK-8185429](https://bugs.openjdk.org/browse/JDK-8185429) | client-libs/java.awt | [macos] After a modal dialog is closed, no window becomes active | +| 6 | [JDK-8341311](https://bugs.openjdk.org/browse/JDK-8341311) | client-libs/javax.accessibility | [Accessibility,macOS,VoiceOver] VoiceOver announces incorrect number of items in submenu of JPopupMenu | +| 7 | [JDK-8365375](https://bugs.openjdk.org/browse/JDK-8365375) | client-libs/javax.swing | Method SU3.setAcceleratorSelectionForeground assigns to acceleratorForeground | +| 8 | [JDK-8348760](https://bugs.openjdk.org/browse/JDK-8348760) | client-libs/javax.swing | RadioButton is not shown if JRadioButtonMenuItem is rendered with ImageIcon in WindowsLookAndFeel | +| 9 | [JDK-8322512](https://bugs.openjdk.org/browse/JDK-8322512) | core-libs/java.lang | StringBuffer.repeat does not work correctly after toString() was called | +| 10 | [JDK-8319174](https://bugs.openjdk.org/browse/JDK-8319174) | core-libs/java.math | Enhance robustness of some j.m.BigInteger constructors | +| 11 | [JDK-8358764](https://bugs.openjdk.org/browse/JDK-8358764) | core-libs/java.nio | (sc) SocketChannel.close when thread blocked in read causes connection to be reset (win) | +| 12 | [JDK-8314611](https://bugs.openjdk.org/browse/JDK-8314611) | core-libs/java.util:i18n | Provide more explicative error message parsing Currencies | +| 13 | [JDK-8343804](https://bugs.openjdk.org/browse/JDK-8343804) | core-libs/java.util:i18n | Show the default time zone with -XshowSettings option | +| 14 | [JDK-8353713](https://bugs.openjdk.org/browse/JDK-8353713) | core-libs/java.util:i18n | Improve Currency.getInstance exception handling | +| 15 | [JDK-8368308](https://bugs.openjdk.org/browse/JDK-8368308) | core-libs/java.util:i18n | ISO 4217 Amendment 180 Update - Bulgaria Adopts the Euro in 2026 | +| 16 | [JDK-8226919](https://bugs.openjdk.org/browse/JDK-8226919) | core-svc/tools | attach in linux hangs due to permission denied accessing /proc/pid/root | +| 17 | [JDK-8347564](https://bugs.openjdk.org/browse/JDK-8347564) | hotspot/gc | ZGC: Crash in DependencyContext::clean\_unloading\_dependents | +| 18 | [JDK-8364258](https://bugs.openjdk.org/browse/JDK-8364258) | hotspot/jfr | ThreadGroup constant pool serialization is not normalized | +| 19 | [JDK-8332506](https://bugs.openjdk.org/browse/JDK-8332506) | hotspot/runtime | SIGFPE In ObjectSynchronizer::is\_async\_deflation\_needed() | +| 20 | [JDK-8350201](https://bugs.openjdk.org/browse/JDK-8350201) | hotspot/runtime | Out of bounds access on Linux aarch64 in os::print\_register\_info | +| 21 | [JDK-8348402](https://bugs.openjdk.org/browse/JDK-8348402) | hotspot/runtime | PerfDataManager stalls shutdown for 1ms | +| 22 | [JDK-8347129](https://bugs.openjdk.org/browse/JDK-8347129) | hotspot/runtime | cpuset cgroups controller is required for no good reason | +| 23 | [JDK-8338154](https://bugs.openjdk.org/browse/JDK-8338154) | hotspot/test | Fix -Wzero-as-null-pointer-constant warnings in gtest framework | +| 24 | [JDK-8315042](https://bugs.openjdk.org/browse/JDK-8315042) | security-libs/java.security | NPE in PKCS7.parseOldSignedData | +| 25 | [JDK-8350830](https://bugs.openjdk.org/browse/JDK-8350830) | security-libs/java.security | Values converted incorrectly when reading TLS session tickets | +| 26 | [JDK-8350582](https://bugs.openjdk.org/browse/JDK-8350582) | security-libs/javax.net.ssl | Correct the parsing of the ssl value in javax.net.debug | +| 27 | [JDK-8355779](https://bugs.openjdk.org/browse/JDK-8355779) | security-libs/javax.net.ssl | When no "signature\_algorithms\_cert" extension is present we do not apply certificate scope constraints to algorithms in "signature\_algorithms" extension | +| 28 | [JDK-8350807](https://bugs.openjdk.org/browse/JDK-8350807) | security-libs/javax.net.ssl | Certificates using MD5 algorithm that are disabled by default are incorrectly allowed in TLSv1.3 when re-enabled | +| 29 | [JDK-8332106](https://bugs.openjdk.org/browse/JDK-8332106) | tools/javac | VerifyError when using switch pattern in this(...) or super(...) | + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_2501.md b/corpus/changelog/java_jdk_releases/java_jdk_2501.md new file mode 100644 index 0000000000000000000000000000000000000000..834e5faa8c660530ab839f19877715472f315765 --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_2501.md @@ -0,0 +1,121 @@ +# Java_JDK 25.0.1 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/25-0-1-relnotes.html +Version: 25.0.1 + +#### Java™ SE Development Kit 25.0.1 (JDK 25.0.1) + +Release date: October 21, 2025 + +The full version string for this update release is 25.0.1+8 (where "+" means "build"). +The version number is 25.0.1. This JDK conforms to version 25 of the Java SE Specification ([JSR 400](https://jcp.org/en/jsr/detail?id=400) 2025-09-16). + +#### IANA TZ Data 2025b + +For more information, refer to [Timezone Data Versions in the JRE Software](https://www.oracle.com/java/technologies/tzdata-versions.html). + +#### Security Baselines + +The security baselines for the Java Runtime at the time of the release of JDK 25.0.1 are specified in the following table: + +| **Java Family Version** | **Security Baseline (Full Version String)** | +| --- | --- | +| 25 | 25.0.1+8 | +| 21 | 21.0.9+7 | +| 17 | 17.0.17+8 | +| 11 | 11.0.29+8 | +| 8 | 1.8.0\_471-b09 | + +#### Keeping the JDK up to Date + +Oracle recommends that the JDK is updated with each Critical Patch Update. +In order to determine if a release is the latest, the [Security Baseline](https://javadl-esd-secure.oracle.com/update/baseline.version) page can +be used to determine which is the latest version for each release family. + +Critical patch updates, which contain security vulnerability fixes, are announced one year in advance on +Critical Patch Updates, Security Alerts and Bulletins. +It is not recommended that this JDK (version 25.0.1) be used after the next critical patch update scheduled +for January 20, 2026. + +Java Management Service, available to all users, can help you find vulnerable Java versions in your systems. [Java SE Subscribers](https://www.oracle.com/java/java-se-subscription.html) and customers running in Oracle Cloud can use Java Management Service to update Java Runtimes and to do further security reviews like identifying potentially vulnerable third party libraries used by your Java programs. Existing Java Management Service user [click here](https://cloud.oracle.com/jms/overview) to log in to your dashboard. [The Java Management Service Documentation](https://docs.oracle.com/en-us/iaas/jms/index.html) provides a list of features available to everyone and those available only to customers. [Learn more about using Java Management Service](https://www.oracle.com/java/jms/) to monitor and secure your Java Installations. + +#### Known Issues + +core-libs/java.net + +**[➜](#JDK-8368741) Datagram Packet Loss on macOS 26 and macOS 15.6 and Above** ([JDK-8368741](https://bugs.openjdk.org/browse/JDK-8368741)) + +When IPv6 is enabled, the JDK uses dual stack IPv4/IPv6 sockets by default. Binding, connecting, or sending datagrams uses IPv4-mapped IPv6 addresses in this case. + +On some hosts running macOS version 15.6.x and above, and macOS 26, it has been observed that when a datagram socket bound to a IPv4 mapped IPv6 address sends a packet, either using the `java.net.DatagramSocket` or `java.nio.channels.DatagramChannel` APIs, then the first packet is lost and never gets delivered. A second invocation of `send` on the same socket, even to the same destination address, correctly delivers the packet and it is received by the recipient. + +A bug has been filed with Apple (feedback issue id FB20302424) seeking their assistance. The issue is currently unresolved. + +Until the issue is resolved, there are a couple of workarounds that applications can consider: + +* If using IPv4 is acceptable, then the `java` command can be launched with `-Djava.net.preferIPv4Stack=true` to use IPv4 sockets by default. +* If using `-Djava.net.preferIPv4Stack=true` is not acceptable, a more local workaround can be applied by changing the application code to create a `java.nio.channels.DatagramChannel` with `java.net.StandardProtocolFamily.INET` as the protocol family and then bind the channel to a IPv4 address. + +#### Removed Features and Options + +security-libs/java.security + +**[➜](#JDK-8361212) Removed Four AffirmTrust Root Certificates** ([JDK-8361212](https://bugs.openjdk.org/browse/JDK-8361212)) + +The following root certificates, which are deactivated and no longer in use, have been removed from the `cacerts` keystore: + +```None ++ alias name "affirmtrustcommercialca [jdk]" + + Distinguished Name: CN=AffirmTrust Commercial, O=AffirmTrust, C=US + ++ alias name "affirmtrustnetworkingca [jdk]" + Distinguished Name: CN=AffirmTrust Networking, O=AffirmTrust, C=US + ++ alias name "affirmtrustpremiumca [jdk]" + Distinguished Name: CN=AffirmTrust Premium, O=AffirmTrust, C=US + ++ alias name "affirmtrustpremiumeccca [jdk]" + Distinguished Name: CN=AffirmTrust Premium ECC, O=AffirmTrust, C=US +``` + +#### Other Notes + +xml/jaxp + +**[➜](#JDK-8356294) FEATURE\_SECURE\_PROCESSING for XPath** (JDK-8356294 (not public)) + +The JDK XPath implementation now supports [External Access Properties](https://docs.oracle.com/en/java/javase/24/docs/api/java.xml/javax/xml/XMLConstants.html#EAP). It also enables restriction through these properties when secure processing is set to true explicitly. To secure an XPath processor against risky evaluation of external DTD references, enable secure processing as demonstrated in the following code: + +`XPathFactory xf = XPathFactory.newInstance(); +xf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);` + +This process will cause the XPath processor created via the factory to throw `XPathExpressionException` if used to evaluate a raw XML document that contains external references such as an external DTD. + +Mitigation includes using the [External Access Properties](https://docs.oracle.com/en/java/javase/24/docs/api/java.xml/javax/xml/XMLConstants.html#EAP) to override that enabled by FSP. For example, the following setting will allow the process to continue when there is a reference to a file-based external DTD in the XML document: + +`xf.setProperty(ACCESS_EXTERNAL_DTD, "file");` + +It is recommended that applications use the XPath processor to evaluate DOM rather than raw XML documents. + +core-libs/java.io:serialization + +**[➜](#JDK-8367031) Resolved Regression in java.time Class Objects** ([JDK-8367031](https://bugs.openjdk.org/browse/JDK-8367031)) + +The regression in the serialization of `java.time` class objects, including `LocalDate`, has been corrected by backing out the change from [JDK-8334742](https://bugs.openjdk.org/browse/JDK-8334742). + +#### Bug Fixes + +This release also contains fixes for security vulnerabilities described in the [Oracle Critical Patch Update](https://www.oracle.com/security-alerts/cpuoct2025.html#AppendixJAVA). + +➜ Issues fixed in 25.0.1: + +| # | JBS | Component/Subcomponent | Summary | +| --- | --- | --- | --- | +| 1 | [JDK-8358452](https://bugs.openjdk.org/browse/JDK-8358452) | client-libs/java.awt | JNI exception pending in Java\_sun\_awt\_screencast\_ScreencastHelper\_remoteDesktopKeyImpl of screencast\_pipewire.c:1214 (ID: 51119) | +| 2 | [JDK-8360647](https://bugs.openjdk.org/browse/JDK-8360647) | client-libs/java.awt | [XWayland] [OL10] NumPad keys are not triggered | +| 3 | [JDK-8367031](https://bugs.openjdk.org/browse/JDK-8367031) | core-libs/java.io:serialization | [backout] Change java.time month/day field types to 'byte' | +| 4 | [JDK-8368308](https://bugs.openjdk.org/browse/JDK-8368308) | core-libs/java.util:i18n | ISO 4217 Amendment 180 Update - Bulgaria Adopts the Euro in 2026 | +| 5 | [JDK-8366223](https://bugs.openjdk.org/browse/JDK-8366223) | hotspot/gc | ZGC: ZPageAllocator::cleanup\_failed\_commit\_multi\_partition is broken | + +--- diff --git a/corpus/changelog/java_jdk_releases/java_jdk_2502.md b/corpus/changelog/java_jdk_releases/java_jdk_2502.md new file mode 100644 index 0000000000000000000000000000000000000000..280f026407ae529ec74b5b6047bd358732c934cb --- /dev/null +++ b/corpus/changelog/java_jdk_releases/java_jdk_2502.md @@ -0,0 +1,167 @@ +# Java_JDK 25.0.2 Release Notes + +Source: https://www.oracle.com/java/technologies/javase/25-0-2-relnotes.html +Version: 25.0.2 + +#### Java™ SE Development Kit 25.0.2 (JDK 25.0.2) + +Release date: January 20, 2026 + +The full version string for this update release is 25.0.2+10 (where "+" means "build"). +The version number is 25.0.2. This JDK conforms to version 25 of the Java SE Specification ([JSR 400](https://jcp.org/en/jsr/detail?id=400) 2025-09-16). + +#### IANA TZ Data 2025b + +For more information, refer to [Timezone Data Versions in the JRE Software](https://www.oracle.com/java/technologies/tzdata-versions.html). + +#### Security Baselines + +The security baselines for the Java Runtime at the time of the release of JDK 25.0.2 are specified in the following table: + +| **Java Family Version** | **Security Baseline (Full Version String)** | +| --- | --- | +| 25 | 25.0.2+10 | +| 21 | 21.0.10+8 | +| 17 | 17.0.18+8 | +| 11 | 11.0.30+7 | +| 8 | 1.8.0\_481-b10 | + +#### Keeping the JDK up to Date + +Oracle recommends that the JDK is updated with each Critical Patch Update. +In order to determine if a release is the latest, the [Security Baseline](https://javadl-esd-secure.oracle.com/update/baseline.version) page can +be used to determine which is the latest version for each release family. + +Critical patch updates, which contain security vulnerability fixes, are announced one year in advance on +Critical Patch Updates, Security Alerts and Bulletins. +It is not recommended that this JDK (version 25.0.2) be used after the next critical patch update scheduled +for April 21, 2026. + +Java Management Service, available to all users, can help you find vulnerable Java versions in your systems. [Java SE Subscribers](https://www.oracle.com/java/java-se-subscription.html) and customers running in Oracle Cloud can use Java Management Service to update Java Runtimes and to do further security reviews like identifying potentially vulnerable third party libraries used by your Java programs. Existing Java Management Service user [click here](https://cloud.oracle.com/jms/overview) to log in to your dashboard. [The Java Management Service Documentation](https://docs.oracle.com/en-us/iaas/jms/index.html) provides a list of features available to everyone and those available only to customers. [Learn more about using Java Management Service](https://www.oracle.com/java/jms/) to monitor and secure your Java Installations. + +#### New Features + +core-libs/java.rmi + +**[➜](#JDK-8341496) Endpoint Identification Enabled By Default for RMI Connections Over TLS** (JDK-8341496 (not public)) + +RMI will use TLS connections if the `javax.rmi.ssl.SslRMIClientSocketFactory` class is used. These connections now have TLS endpoint identification enabled by default. This may cause some previously-working TLS connections to fail. If this occurs, ensure that the certificate presented by the server has a Subject Alternative Name that matches the server's hostname. Alternatively, endpoint identification for RMI TLS connections can be disabled on the client side by setting the `jdk.rmi.ssl.client.enableEndpointIdentification` system property to `false`. + +#### Notable Issues Fixed + +hotspot/gc + +**[➜](#JDK-8366434) -XX:+UseTransparentHugePages Again Enables Transparent Huge Pages for G1** ([JDK-8366434](https://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-8366434)) + +G1, the default garbage collector, can again properly utilize Transparent Huge Pages (THP) on systems with the THP mode configured as `madvise`. + +The issue preventing the option `-XX:+UseTransparentHugePages` from enabling THP has been resolved. + +#### Other Notes + +install/install + +**[➜](#JDK-8310932) Windows Installers to Return to Full Version Directory and Use of Junction** (JDK-8310932 (not public)) + +For the JDK11+ LTS families, the JDK will install into a version-specific installation directory by default. The installation directory of 11+ will have a - before the version-specific string to keep consistency with the past 11+ conventions per family. A junction, also known as a symlink for Windows, will also be created in a "latest" directory. It will point to the latest version of that family. Here is a breakdown example of installation and junction locations 11+ families: + +| Version | Installation Directory | Junction Location | +| --- | --- | --- | +| jdk25.0.2 | `C:\Program Files\Java\jdk-25.0.2` | `C:\Program Files\Java\latest\jdk-25` | +| jdk17.0.18 | `C:\Program Files\Java\jdk-17.0.18` | `C:\Program Files\Java\latest\jdk-17` | +| jdk11.0.30 | `C:\Program Files\Java\jdk-11.0.30` | `C:\Program Files\Java\latest\jdk-11` || + +Each junction will always point to the latest JDK of the matching LTS family. The junction for each family will be removed when the last JDK of the matching LTS family is uninstalled. + +install/install + +**[➜](#JDK-8359443) Make jcmd Command Available in the Headless JDK RPM** (JDK-8359443 (not public)) + +`jcmd` command will be available in the headless JDK RPM instead of the headful JDK RPM. + +It will be added to the `java` alternatives group instead of the `javac` alternatives group. + +security-libs/java.security + +**[➜](#JDK-8368032) Filter Rules for URIs in the Authority Info Access Extension for Certificates** (JDK-8368032 (not public)) + +A new system and security property, `com.sun.security.allowedAIALocations`, has been introduced. This property allows users the ability to define one or more filtering rules to be applied to URIs obtained from the authority info access extension on X.509 certificates. These filter rules are applied specifically to the CA issuers access method. Any CA issuers URIs in X.509 certificates are only followed when the `com.sun.security.enableAIAcaIssuers` system property is enabled and the filter allows the URI. + +In order to set the rules, the user must set either the `com.sun.security.allowedAIALocations` security property or the system property by the same name. If the system property has a value, it will override the security property. By default the property is blank, which enacts a deny-all ruleset. + +For either property, the value consists of a set of space-separated rules that take the form of a URI, with the following constraints: + +* The URI must be absolute and hierarchical. +* The URI must only use one of the following schemes: http, https, ldap, or ftp (case-insensitive). +* A hostname or address must be specified and must match (case-insensitive). No name resolution is performed on hostnames to match URIs with IP addresses. +* The port number must match. Where a port number is omitted, the well-known port will be used in the comparison. +* For hierarchical schemes (http[s], ftp): + + A rule's normalized path portion of the URI is matched in a case-sensitive manner. If the final component does not end in a slash (/), it is considered to be a file path and must match the CA issuer URI path component. If the rule's path component ends in a slash, then it must match or be a prefix of the CA issuer URI path component. (for example, a filter path of `/ab/cd/` will match a CA issuer path of `/ab/cd/`, `/ab/cd/ef` and `/ab/cd/ef/ghi`.). + + Query strings and fragments will be ignored when matching CA issuer URIs. +* For ldap URIs: + + The base DN must be an exact match (case-insensitive). + + Any query string in the rule, if specified, will be ignored. + +For the properties, a single value of "any" (case-insensitive) will create an allow-all rule. + +#### Bug Fixes + +This release also contains fixes for security vulnerabilities described in the [Oracle Critical Patch Update](https://www.oracle.com/security-alerts/cpujan2026.html#AppendixJAVA). + +➜ Issues fixed in 25.0.2: + +| # | JBS | Component/Subcomponent | Summary | +| --- | --- | --- | --- | +| 1 | [JDK-8366208](https://bugs.java/bugdatabase/JDK-8366208) | client-libs/2d | Unexpected exception in sun.java2d.cmm.lcms.LCMSImageLayout | +| 2 | [JDK-8367384](https://bugs.java/bugdatabase/JDK-8367384) | client-libs/2d | The ICC\_Profile class may throw exceptions during serialization | +| 3 | [JDK-8361748](https://bugs.java/bugdatabase/JDK-8361748) | client-libs/2d | Enforce limits on the size of an XBM image | +| 4 | [JDK-8354646](https://bugs.java/bugdatabase/JDK-8354646) | client-libs/java.awt | java.awt.TextField allows to identify the spaces in a password when double clicked at the starting and end of the text | +| 5 | [JDK-8358532](https://bugs.java/bugdatabase/JDK-8358532) | client-libs/javax.swing | JFileChooser in GTK L&F still displays HTML filename | +| 6 | [JDK-8349188](https://bugs.java/bugdatabase/JDK-8349188) | client-libs/javax.swing | LineBorder does not scale correctly | +| 7 | [JDK-8358813](https://bugs.java/bugdatabase/JDK-8358813) | client-libs/javax.swing | JPasswordField identifies spaces in password via delete shortcuts | +| 8 | [JDK-8370465](https://bugs.java/bugdatabase/JDK-8370465) | client-libs/javax.swing | Right to Left Orientation Issues with MenuItem Component | +| 9 | [JDK-8365086](https://bugs.java/bugdatabase/JDK-8365086) | core-libs/java.net | CookieStore.getURIs() and get(URI) should return an immutable List | +| 10 | [JDK-8357959](https://bugs.java/bugdatabase/JDK-8357959) | core-libs/java.nio | (bf) ByteBuffer.allocateDirect initialization can result in large TTSP spikes | +| 11 | [JDK-8369656](https://bugs.java/bugdatabase/JDK-8369656) | core-libs/java.util.concurrent | Calling CompletableFuture.join() could execute task in common pool | +| 12 | [JDK-8369184](https://bugs.java/bugdatabase/JDK-8369184) | core-libs/java.util:i18n | SimpleTimeZone equals() Returns True for Unequal Instances with Different hashCode Values | +| 13 | [JDK-8364296](https://bugs.java/bugdatabase/JDK-8364296) | hotspot/compiler | Set IntelJccErratumMitigation flag ergonomically | +| 14 | [JDK-8365265](https://bugs.java/bugdatabase/JDK-8365265) | hotspot/compiler | x86 short forward jump exceeds 8-bit offset in methodHandles\_x86.cpp when using Intel APX | +| 15 | [JDK-8360867](https://bugs.java/bugdatabase/JDK-8360867) | hotspot/compiler | CTW: Disable inline cache verification | +| 16 | [JDK-8357396](https://bugs.java/bugdatabase/JDK-8357396) | hotspot/compiler | Refactor nmethod::make\_not\_entrant to use Enum instead of "const char\*" | +| 17 | [JDK-8361180](https://bugs.java/bugdatabase/JDK-8361180) | hotspot/compiler | Disable CompiledDirectCall verification with -VerifyInlineCaches | +| 18 | [JDK-8365468](https://bugs.java/bugdatabase/JDK-8365468) | hotspot/compiler | EagerJVMCI should only apply to the CompilerBroker JVMCI runtime | +| 19 | [JDK-8367333](https://bugs.java/bugdatabase/JDK-8367333) | hotspot/compiler | C2: Vector math operation intrinsification failure | +| 20 | [JDK-8362530](https://bugs.java/bugdatabase/JDK-8362530) | hotspot/compiler | VM crash with -XX:+PrintTieredEvents when collecting AOT profiling | +| 21 | [JDK-8367780](https://bugs.java/bugdatabase/JDK-8367780) | hotspot/compiler | Enable UseAPX on Intel CPUs only when both APX\_F and APX\_NCI\_NDD\_NF cpuid features are present | +| 22 | [JDK-8361211](https://bugs.java/bugdatabase/JDK-8361211) | hotspot/compiler | C2: Final graph reshaping generates unencodeable klass constants | +| 23 | [JDK-8368071](https://bugs.java/bugdatabase/JDK-8368071) | hotspot/compiler | Compilation throughput regressed 2X-8X after JDK-8355003 | +| 24 | [JDK-8370318](https://bugs.java/bugdatabase/JDK-8370318) | hotspot/compiler | AES-GCM vector intrinsic may read out of bounds (x86\_64, AVX-512) | +| 25 | [JDK-8361892](https://bugs.java/bugdatabase/JDK-8361892) | hotspot/compiler | AArch64: Incorrect matching rule leading to improper oop instruction encoding | +| 26 | [JDK-8358751](https://bugs.java/bugdatabase/JDK-8358751) | hotspot/compiler | C2: Recursive inlining check for compiled lambda forms is broken | +| 27 | [JDK-8359104](https://bugs.java/bugdatabase/JDK-8359104) | hotspot/gc | gc/TestAlwaysPreTouchBehavior.java# fails on Linux | +| 28 | [JDK-8350621](https://bugs.java/bugdatabase/JDK-8350621) | hotspot/gc | Code cache stops scheduling GC | +| 29 | [JDK-8367948](https://bugs.java/bugdatabase/JDK-8367948) | hotspot/jfr | JFR: MethodTrace threshold setting has no effect | +| 30 | [JDK-8364257](https://bugs.java/bugdatabase/JDK-8364257) | hotspot/jfr | JFR: User-defined events and settings with a one-letter name cannot be configured | +| 31 | [JDK-8364993](https://bugs.java/bugdatabase/JDK-8364993) | hotspot/jfr | JFR: Disable jdk.ModuleExport in default.jfc | +| 32 | [JDK-8364556](https://bugs.java/bugdatabase/JDK-8364556) | hotspot/jfr | JFR: Disable SymbolTableStatistics and StringTableStatistics in default.jfc | +| 33 | [JDK-8364190](https://bugs.java/bugdatabase/JDK-8364190) | hotspot/jfr | JFR: RemoteRecordingStream withers don't work | +| 34 | [JDK-8368670](https://bugs.java/bugdatabase/JDK-8368670) | hotspot/jfr | Deadlock in JFR on event register + class load | +| 35 | [JDK-8365165](https://bugs.java/bugdatabase/JDK-8365165) | hotspot/runtime | Zap C-heap memory at delete/free | +| 36 | [JDK-8359423](https://bugs.java/bugdatabase/JDK-8359423) | hotspot/runtime | Improve error message in case of missing jsa shared archive | +| 37 | [JDK-8365823](https://bugs.java/bugdatabase/JDK-8365823) | hotspot/runtime | Revert storing abstract and interface Klasses to non-class metaspace | +| 38 | [JDK-8356324](https://bugs.java/bugdatabase/JDK-8356324) | hotspot/runtime | JVM crash (SIGSEGV at ClassListParser::resolve\_indy\_impl) during -Xshare:dump starting from 21.0.5 | +| 39 | [JDK-8343218](https://bugs.java/bugdatabase/JDK-8343218) | hotspot/runtime | Add option to disable allocating interface and abstract classes in non-class metaspace | +| 40 | [JDK-8363928](https://bugs.java/bugdatabase/JDK-8363928) | hotspot/runtime | Specifying AOTCacheOutput with a blank path causes the JVM to crash | +| 41 | [JDK-8364198](https://bugs.java/bugdatabase/JDK-8364198) | hotspot/runtime | NMT should have a better corruption message | +| 42 | [JDK-8364199](https://bugs.java/bugdatabase/JDK-8364199) | hotspot/runtime | Enhance list of environment variables printed in hserr/hsinfo file | +| 43 | [JDK-8364235](https://bugs.java/bugdatabase/JDK-8364235) | hotspot/runtime | Fix for JDK-8361447 breaks the alignment requirements for GuardedMemory | +| 44 | [JDK-8369506](https://bugs.java/bugdatabase/JDK-8369506) | hotspot/runtime | Bytecode rewriting causes Java heap corruption on AArch64 | +| 45 | [JDK-8369190](https://bugs.java/bugdatabase/JDK-8369190) | hotspot/runtime | JavaFrameAnchor on AArch64 has unnecessary barriers and wrong store order in MacroAssembler | +| 46 | [JDK-8364660](https://bugs.java/bugdatabase/JDK-8364660) | hotspot/runtime | ClassVerifier::ends\_in\_athrow() should be removed | +| 47 | [JDK-8367689](https://bugs.java/bugdatabase/JDK-8367689) | hotspot/svc-agent | Revert removal of several compilation-related vmStructs fields | +| 48 | [JDK-8358723](https://bugs.java/bugdatabase/JDK-8358723) | tools/jpackage | jpackage signing issues: the main launcher doesn't have entitlements | +| 49 | [JDK-8371094](https://bugs.java/bugdatabase/JDK-8371094) | tools/jpackage | --mac-signing-key-user-name no longer works | +| 50 | [JDK-8365790](https://bugs.java/bugdatabase/JDK-8365790) | tools/jpackage | Shutdown hook for application image does not work on Windows | +| 51 | [JDK-8372753](https://bugs.java/bugdatabase/JDK-8372753) | tools/jpackage | jpackage ignores --file-associations option with predefined app image | + +--- diff --git a/corpus/changelog/mysql_releases/mysql_8011.md b/corpus/changelog/mysql_releases/mysql_8011.md new file mode 100644 index 0000000000000000000000000000000000000000..6966e8b6b3a81e7d40c04d04048a4c9795ee2abc --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8011.md @@ -0,0 +1,2075 @@ +# MySQL 8.0.11 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-11.html +Version: 8.0.11 + +## Changes in MySQL 8.0.11 (2018-04-19, General Availability) + +For general information about upgrades, downgrades, platform support, etc., please visit [https://dev.mysql.com/doc/relnotes/mysql/8.0/en/](/doc/relnotes/mysql/8.0/en/). + +Note + +Downgrade from MySQL 8.0 to MySQL +5.7 (or from a MySQL 8.0 release to +a previous MySQL 8.0 release) is not supported. +The only supported alternative is to restore a backup taken +*before* upgrading. + +* [Character Set Support](news-8-0-11.html#mysqld-8-0-11-charset "Character Set Support") +* [Compilation Notes](news-8-0-11.html#mysqld-8-0-11-compiling "Compilation Notes") +* [Configuration Notes](news-8-0-11.html#mysqld-8-0-11-configuration "Configuration Notes") +* [Deprecation and Removal Notes](news-8-0-11.html#mysqld-8-0-11-deprecation-removal "Deprecation and Removal Notes") +* [Error Handling](news-8-0-11.html#mysqld-8-0-11-errors "Error Handling") +* [INFORMATION\_SCHEMA Notes](news-8-0-11.html#mysqld-8-0-11-information-schema "INFORMATION_SCHEMA Notes") +* [Installation Notes](news-8-0-11.html#mysqld-8-0-11-installation "Installation Notes") +* [Logging Notes](news-8-0-11.html#mysqld-8-0-11-logging "Logging Notes") +* [Packaging Notes](news-8-0-11.html#mysqld-8-0-11-packaging "Packaging Notes") +* [Performance Schema Notes](news-8-0-11.html#mysqld-8-0-11-performance-schema "Performance Schema Notes") +* [Security Notes](news-8-0-11.html#mysqld-8-0-11-security "Security Notes") +* [Spatial Data Support](news-8-0-11.html#mysqld-8-0-11-spatial-support "Spatial Data Support") +* [sys Schema Notes](news-8-0-11.html#mysqld-8-0-11-sys-schema "sys Schema Notes") +* [Test Suite Notes](news-8-0-11.html#mysqld-8-0-11-test-suite "Test Suite Notes") +* [X Plugin Notes](news-8-0-11.html#mysqld-8-0-11-xplugin "X Plugin Notes") +* [Functionality Added or Changed](news-8-0-11.html#mysqld-8-0-11-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-11.html#mysqld-8-0-11-bug "Bugs Fixed") + +### Character Set Support + +* The `utf8mb3` character set will be replaced by + `utf8mb4` in a future MySQL version. The + `utf8` character set is currently an alias for + `utf8mb3`, but will at that point become a + reference to `utf8mb4`. To avoid ambiguity + about the meaning of `utf8`, consider + specifying `utf8mb4` explicitly for character + set references instead of `utf8`. + (WL #10778) + +### Compilation Notes + +* MySQL source code has been converted to Google style rules using + **clang-format**. + (Bug #27414321) +* Sun RPC is being removed from `glibc`. + **CMake** now detects and uses + `libtirpc` if `glibc` does not + contain Sun RPC. (You might find it necessary to install + `libtirpc` and **rpcgen** to + take advantage of this **CMake** feature.) + (Bug #27368272, Bug #89168) +* The minimum version of the Boost library for server builds is + now 1.66.0. + (Bug #27137349, Bug #88540) +* When building from source, the provided **CMake** + script assumed that JUnit and Ant were installed and available + at set paths. If this was not the case, building the GCS Java + wrapper resulted in build errors. To address this a new + **CMake** option + [`WITH_ANT=path_name`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_ant) has been added + to the build script, and which works in a similar way to the + existing [`WITH_BOOST`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_boost) + `CMake` option. Set + [`WITH_ANT`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_ant) to the path of a + directory where the Ant tarball, or an already unpacked archive, + is saved. When [`WITH_ANT`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_ant) is not + set, or is set with the special value `system`, + the build assumes a binary **ant** exists in + `$PATH`. + + Similarly, the `CMake` option + [`ENABLE_DOWNLOADS`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_enable_downloads) already exists to + download required libraries during a build, such as the Google + Test distribution. Now, when + [`ENABLE_DOWNLOADS`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_enable_downloads) is set, and JUnit + or Ant are not found they are downloaded as part of the build + process. + (Bug #26678793) + +### Configuration Notes + +* A new **CMake** option, + [`BUNDLE_RUNTIME_LIBRARIES`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_bundle_runtime_libraries), enables + bundling of runtime libraries with server MSI and Zip packages + for Windows. + (Bug #27584796, Bug #89771) +* systemd service files now increase + `LimitNOFILE` to 10000, to accommodate higher + default settings in MySQL 8.0. + (Bug #27530282) +* The new [`WITH_SYSTEM_LIBS`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_system_libs) + **CMake** option, when enabled, selects the + `system` value for any of the following options + that are not set explicitly: + [`WITH_EDITLINE`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_editline), + [`WITH_ICU`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_icu), + [`WITH_LIBEVENT`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_libevent), + [`WITH_LZ4`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_lz4), + [`WITH_PROTOBUF`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_protobuf), + [`WITH_SSL`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_ssl), + [`WITH_ZLIB`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_zlib). + (Bug #27356668, Bug #89136) +* The version of the compiled-in `zlib` library + is now available at runtime as the value of the + [`version_compile_zlib`](/doc/refman/8.0/en/server-system-variables.html#sysvar_version_compile_zlib) system + variable. Thanks to Daniël van Eeden for the patch. + (Bug #27235065, Bug #88825) + +### Deprecation and Removal Notes + +* **Incompatible Change:** + These deprecated compatibility SQL modes have been removed: + `DB2`, `MAXDB`, + `MSSQL`, `MYSQL323`, + `MYSQL40`, `ORACLE`, + `POSTGRESQL`, + `NO_FIELD_OPTIONS`, + `NO_KEY_OPTIONS`, + `NO_TABLE_OPTIONS`. They can no longer be + assigned to the `sql_mode` system variable or + used as permitted values for the **mysqldump** + [`--compatible`](/doc/refman/8.0/en/mysqldump.html#option_mysqldump_compatible) option. + + Removal of `MAXDB` means that the + [`TIMESTAMP`](/doc/refman/8.0/en/datetime.html) data type for + [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) or + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) is treated as + [`TIMESTAMP`](/doc/refman/8.0/en/datetime.html), and is no longer + treated as [`DATETIME`](/doc/refman/8.0/en/datetime.html). + + For MySQL 5.7 applications that use SQL modes removed in MySQL + 8.0, statements may fail when replicated from a MySQL 5.7 master + to a MySQL 8.0 slave, or may have different effects on master + and slave. To avoid such problems, applications that use modes + removed in MySQL 8.0 should be revised to avoid them. + (WL #8383, WL #9465) +* The following features related to account management have been + removed: + + + Using [`GRANT`](/doc/refman/8.0/en/grant.html) to create users. + Instead, use [`CREATE USER`](/doc/refman/8.0/en/create-user.html). + Following this practice makes the + [`NO_AUTO_CREATE_USER`](/doc/refman/5.7/en/sql-mode.html#sqlmode_no_auto_create_user) SQL + mode immaterial for [`GRANT`](/doc/refman/8.0/en/grant.html) + statements, so it too is removed. + + Using [`GRANT`](/doc/refman/8.0/en/grant.html) to modify account + properties other than privilege assignments. This includes + authentication, SSL, and resource-limit properties. Instead, + establish such properties at account-creation time with + [`CREATE USER`](/doc/refman/8.0/en/create-user.html) or modify them + afterward with [`ALTER USER`](/doc/refman/8.0/en/alter-user.html). + + `IDENTIFIED BY PASSWORD + 'hash_string'` syntax + for [`CREATE USER`](/doc/refman/8.0/en/create-user.html) and + [`GRANT`](/doc/refman/8.0/en/grant.html). Instead, use + `IDENTIFIED WITH + auth_plugin AS + 'hash_string'` for + [`CREATE USER`](/doc/refman/8.0/en/create-user.html) and + [`ALTER USER`](/doc/refman/8.0/en/alter-user.html), where the + `'hash_string'` + value is in a format compatible with the named plugin. + + Additionally, because `IDENTIFIED BY + PASSWORD` syntax has been removed, the + [`log_builtin_as_identified_by_password`](/doc/refman/5.7/en/replication-options-binary-log.html#sysvar_log_builtin_as_identified_by_password) + system variable is superfluous and has been removed. + + The [`PASSWORD()`](/doc/refman/5.7/en/encryption-functions.html#function_password) function. + Additionally, [`PASSWORD()`](/doc/refman/5.7/en/encryption-functions.html#function_password) + removal means that + [`SET PASSWORD + ... = + PASSWORD('auth_string')`](/doc/refman/8.0/en/set-password.html) + syntax is no longer available. + + The [`old_passwords`](/doc/refman/5.7/en/server-system-variables.html#sysvar_old_passwords) system + variable. + + For MySQL 5.7 applications that use features removed in MySQL + 8.0, statements may fail when replicated from a MySQL 5.7 master + to a MySQL 8.0 slave, or may have different effects on master + and slave. To avoid such problems, applications that use + features removed in MySQL 8.0 should be revised to avoid them + and use alternatives when possible. + (Bug #27455708, WL #10774) + +### Error Handling + +* **perror** is more flexible in understanding its + arguments. For example, for the + [`ER_WRONG_VALUE_FOR_VAR`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_wrong_value_for_var) error, + **perror** understands any of these arguments: + `1231`, `001231`, + `MY-1231`, or `MY-001231`, or + [`ER_WRONG_VALUE_FOR_VAR`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_wrong_value_for_var). If an + error number is in the range where MySQL and operating system + errors overlap, **perror** displays both error + messages. + (Bug #27462408) + +### INFORMATION\_SCHEMA Notes + +* The new [`INFORMATION_SCHEMA.KEYWORDS`](/doc/refman/8.0/en/information-schema-keywords-table.html) + table lists the words considered keywords by MySQL and, for each + one, indicates whether it is reserved. This table provides + applications a runtime source of MySQL keyword information. See + [The INFORMATION\_SCHEMA KEYWORDS Table](/doc/refman/8.0/en/information-schema-keywords-table.html). + + In addition, if you build MySQL from source, the build process + generates a `keyword_list.h` header file + containing a array of keywords and their reserved status. This + file can be found in the `sql` directory + under the build directory. This file may be useful for + applications that require a static source for the keyword list. + (WL #8989) + +### Installation Notes + +* RPM and Debian packages now add the current MySQL series to the + `share` directory name (for example + `share/mysql-8.0`). + (Bug #27638192, Bug #26990531) + +### Logging Notes + +* Messages written to the error log now indicate the subsystem in + which the event occurred. Possible subsystem values are + `InnoDB` (the `InnoDB` storage + engine), `Repl` (the replication subsystem), + `Server` (otherwise). + (WL #11150) + +### Packaging Notes + +* Installing or upgrading using Debian packages now presents a + dialog with an option for setting the default authentication + plugin to `mysql_native_password`. This may be + useful for backward compatibility at some installation sites. + (Bug #27454287, Bug #27667294) +* The **compile\_innodb** script is no longer used + and has been removed from MySQL distributions. Thanks to Alexey + Kopytov for the suggestion. + (Bug #27448099, Bug #89437) + +### Performance Schema Notes + +* A new Performance Schema table + [`log_status`](/doc/refman/8.0/en/performance-schema-log-status-table.html) provides information + that enables an online backup tool to copy the required log + files without locking those resources for the duration of the + copy process. When the [`log_status`](/doc/refman/8.0/en/performance-schema-log-status-table.html) + table is queried, the server blocks logging and related + administrative changes for just long enough to populate the + table, then releases the resources. The + [`log_status`](/doc/refman/8.0/en/performance-schema-log-status-table.html) table informs the online + backup which point it should copy up to in the master's binary + log and `gtid_executed` record, and the relay + log for each replication channel. It also provides relevant + information for individual storage engines, such as the last log + sequence number (LSN) and the LSN of the last checkpoint taken + for the InnoDB storage engine. + + The `BACKUP_ADMIN` privilege is required for + access to the [`log_status`](/doc/refman/8.0/en/performance-schema-log-status-table.html) table. + (Bug #27599831, WL #9452) +* Performance Schema objects now have a default character set of + `utf8mb4`. + (Bug #27407745) + +### Security Notes + +* MySQL 8.0 builds now use OpenSSL rather than yaSSL as the + default SSL library. MySQL no longer supports building using + yaSSL, and source distributions no longer include yaSSL. + + The [`WITH_SSL`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_ssl) + **CMake** option no longer permits + `bundled` (use yaSSL) as a valid value, and the + default option value has changed from `bundled` + to `system` (use the version of OpenSSL + installed on the host system). + + In place of yaSSL, wolfSSL may be used as a functionally + equivalent alternative that has a GPLv2-compatible license. In + addition, wolfSSL (like OpenSSL) supports the TLSv1.2 protocol, + which yaSSL does not. + + For instructions about building MySQL from source using wolfSSL, + see the `extra/README-wolfssl.txt` file in a + MySQL source distribution. The + [`WITH_SSL`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_ssl) **CMake** + option now permits `wolfssl` as a valid value. + To use [`-DWITH_SSL=wolfssl`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_ssl), you + must follow the instructions in + `README-wolfssl.txt`. + (Bug #26671671, WL #8998) +* MySQL now supports FIPS mode, if compiled using OpenSSL 1.0.2, + and an OpenSSL library and FIPS Object Module are available at + runtime. FIPS mode imposes conditions on cryptographic + operations such as restrictions on acceptable encryption + algorithms or requirements for longer key lengths. The + [`ssl_fips_mode`](/doc/refman/8.0/en/server-system-variables.html#sysvar_ssl_fips_mode) system variable + enables control of FIPS mode on the server side. The + [`--ssl-fips-mode`](/doc/refman/8.0/en/connection-options.html#option_general_ssl-fips-mode) client option + enables control of FIPS mode on the client side for these + programs: **mysql**, + **mysqladmin**, **mysqlbinlog**, + **mysqlcheck**, **mysqldump**, + **mysqlimport**, **mysqlpump**, + **mysqlshow**, **mysqlslap**, + **mysqltest**, **mysqlxtest**, + **mysql\_secure\_installation**, and + **mysql\_upgrade**. See + [FIPS Support](/doc/refman/8.0/en/fips-mode.html). + (WL #8102) + +### Spatial Data Support + +* **Incompatible Change:** + These geometry collection changes have been implemented: + + + The standard `GeomCollection` name for the + geometry collection data type is supported as a synonym for + the `GeometryCollection` data type name. + + The [`GeomCollection()`](/doc/refman/8.0/en/gis-mysql-specific-functions.html#function_geomcollection) function + is supported as a synonym for the + [`GeometryCollection()`](/doc/refman/8.0/en/gis-mysql-specific-functions.html#function_geometrycollection) + function. + + `GeomCollection` and + [`GeomCollection()`](/doc/refman/8.0/en/gis-mysql-specific-functions.html#function_geomcollection) are the + preferred data type and function names. + + Incompatibility: As a consequence of the change in preferred + data type name, some + [`INFORMATION_SCHEMA`](/doc/refman/8.0/en/information-schema.html) tables, + statements such as [`SHOW CREATE + TABLE`](/doc/refman/8.0/en/show-create-table.html), and the + [`ST_GeometryType()`](/doc/refman/8.0/en/gis-general-property-functions.html#function_st-geometrytype) function that + display data type information now display + `GEOMCOLLECTION` rather than + `GEOMETRYCOLLECTION`. Applications that look + for `GEOMETRYCOLLECTION` should be adjusted to + account for this change. + + For more information, see + [GeometryCollection Class](/doc/refman/8.0/en/gis-class-geometrycollection.html), and + [MySQL-Specific Functions That Create Geometry Values](/doc/refman/8.0/en/gis-mysql-specific-functions.html). + (WL #2388) + +### sys Schema Notes + +* `sys` Schema objects now have a default + character set of `utf8mb4`. + (Bug #27675959) + +### Test Suite Notes + +* Reduction of compiler and platform differences in GIS handling + of floating-point results enables simplification of related test + cases that no longer need rounding to avoid spurious test + failures. Thanks to Daniel Black for the patch. + (Bug #26540102, Bug #87223, Bug #27462294) + +### X Plugin Notes + +* When using MySQL as a document store, the use of + `SPATIAL` indexes on geometry-valued columns + using the X DevAPI is now fully supported. Previously, a spatial + index could be created, but the spatial reference system + identifier (SRID) was not included in the indexed column, so the + index was not used by the optimizer. The `SRID` + attribute is now added to the indexed column. + (Bug #27568243) +* Socket files used with X Plugin tests are now limited to + 22-character file names. + (Bug #27460677, Bug #89464) +* The fix for Bug #26328274 resulted in an assertion in debug + builds when an empty host name was used for X Plugin + connections. The issue is now fixed. + (Bug #27266584, Bug #88925) +* X Plugin did not populate the password cache when a user account + with no password set was used with the `PLAIN` + authentication method. This caused later authentication attempts + to fail. The password cache is now correctly populated with an + entry if the user account's password is empty. + (Bug #27257722) +* X Plugin now supports the [`RESTART`](/doc/refman/8.0/en/restart.html) + SQL statement, which was added in MySQL 8.0.4 to enable a MySQL + server instance to be restarted from within a client session. + (Bug #27245319) +* MySQL Shell connections using X Protocol can use either TCP or + Unix sockets as of version 8.0.4. This fix allows the use of + encryption protocols with UNIX socket connections, so user + accounts that require encrypted connections are able to connect. + (Bug #27192091) +* The fix for Bug #26647488, which corrected the handling of the + `DATETIME` data type, now also correctly + decodes messages received from older versions of the plugin that + do not have the new field available to identify the data type. + (Bug #27169735) +* X Plugin connection attempts using the X Protocol did not return + an error when the default database specified in the connection + options was invalid, and the connection was allowed with a null + default database. Connection attempts using the classic MySQL + protocol did return an error and disallowed the connection. X + Protocol connection attempts now also disallow the connection if + an invalid schema is specified. + (Bug #26965020) +* X Plugin is now loaded by default, meaning there is no longer + any need to install the plugin. + (WL #11040) + +### Functionality Added or Changed + +* **InnoDB:** + The **ibd2sdi** serialized dictionary information + (SDI) extraction utility for `InnoDB` + tablespaces now supports a `--pretty` option + that controls JSON pretty print formatting of SDI data. Pretty + print formatting is enabled by default. Disabling pretty print + formatting using `--skip-pretty` reduces the + size of extracted SDI data. + (Bug #27546514) +* **InnoDB:** + To improve startup performance on systems with large buffer + pools, buffer pool initialization is now multithreaded. + (Bug #22963374, Bug #80784) +* **InnoDB:** + The following redo logging optimizations were implemented: + + + User threads can now write concurrently to the log buffer + without synchronizing writes, and add dirty pages to the + flush list in a relaxed order. + + Dedicated log writer threads are now responsible for writing + redo log records from the log buffer to the system buffers + and flushing the system buffers to the redo log files. + + System variables were added for configuring the use of spin + delay by user threads waiting for flushed redo: + + - [`innodb_log_wait_for_flush_spin_hwm`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_log_wait_for_flush_spin_hwm): + Defines the maximum average log flush time beyond which + user threads no longer spin while waiting for flushed + redo. + - [`innodb_log_spin_cpu_abs_lwm`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_log_spin_cpu_abs_lwm): + Defines the minimum amount of CPU usage below which user + threads no longer spin while waiting for flushed redo. + - [`innodb_log_spin_cpu_pct_hwm`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_log_spin_cpu_pct_hwm): + Defines the maximum amount of CPU usage above which user + threads no longer spin while waiting for flushed redo. + + The [`innodb_log_buffer_size`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_log_buffer_size) + configuration option is now dynamic, which permits resizing + of the log buffer while the server is running. + + For more information, see + [Optimizing InnoDB Redo Logging](/doc/refman/8.0/en/optimizing-innodb-logging.html). + (WL #10310) +* **macOS:** + The macOS installer now asks the user for the + `root` password to use rather than generating a + random one. + (Bug #22608157, Bug #80144) +* **macOS:** + The MySQL preference pane included with the macOS installer now + includes a setting that specifies which + `my.cnf` file the server should read when + started by **launchd**. + (Bug #19775549, Bug #74214) +* **Solaris:** + On Solaris, MySQL can now be built with Developer Studio 12.6. + (Bug #27055190, Bug #88316, Bug #28165246, Bug #91214) +* Logging during data directory initialization (for example, using + **mysqld --initialize**) has changed: + + + The startup message indicates that the server is running in + initialization mode. + + A message is written indicating when initialization has + completed. + + The message about the CA certificate being self-signed is + suppressed. + + (Bug #27557952, Bug #89693) +* The `-log` suffix is no longer appended to the + server version string if logging is enabled. This affects, for + example, the value of the + [`version`](/doc/refman/8.0/en/server-system-variables.html#sysvar_version) system variable. + (Bug #27532097, Bug #89626) +* Server shutdown lines written to the error log now include the + server version. + (Bug #27522788, Bug #87910) +* [`SHOW CREATE TABLE`](/doc/refman/8.0/en/show-create-table.html) normally does + not show the `ROW_FORMAT` table option if the + row format is the default format. This can cause problems during + table import and export operations for transportable + tablespaces. MySQL now supports a + [`show_create_table_verbosity`](/doc/refman/8.0/en/server-system-variables.html#sysvar_show_create_table_verbosity) + system variable that, when enabled, causes + [`SHOW CREATE TABLE`](/doc/refman/8.0/en/show-create-table.html) to display + `ROW_FORMAT` regardless of whether it is the + default format. + (Bug #27516741) +* Performance Schema memory instrumentation overhead was reduced. + (Bug #27500610) +* During data directory initialization, the server created objects + using [`sql_mode=''`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_mode). Now the + server uses the default + [`sql_mode`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_mode) value (which, among + other settings, includes strict mode). + (Bug #27476029, Bug #89495) +* The collations defined in + `mysql-test/std_data/Index.xml` are for test + purposes only and should not be used otherwise. Comments were + added to the file to make this clear because some users were + using them in non-test environments. + (Bug #27421838) +* [`RESET PERSIST`](/doc/refman/8.0/en/reset-persist.html) no longer performs + an implicit commit. + (Bug #27374791) +* For a persisted variable, the `SET_TIME` column + of the Performance Schema + [`variables_info`](/doc/refman/8.0/en/performance-schema-variables-info-table.html) table now reflects + the time at which the variable was persisted, not server startup + time. + (Bug #25677422) +* Previously, [`SHOW CREATE TABLE`](/doc/refman/8.0/en/show-create-table.html) did + not show the collation for a column if the collation was the + same as the table default, even if the collation was explicitly + specified at table-creation time. Now, [`SHOW + CREATE TABLE`](/doc/refman/8.0/en/show-create-table.html) always shows the column collation if the + collation was explicitly specified, even if the collation is the + same as the table default. + (Bug #11754608, Bug #46239) + +### Bugs Fixed + +* **Important Change:** + When `NO_ZERO_DATE` SQL mode is + enabled, [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) rejects + attempts to add [`DATE`](/doc/refman/8.0/en/datetime.html) or + [`DATETIME`](/doc/refman/8.0/en/datetime.html) columns that are + declared `NOT NULL` to a nonempty table if no + `DEFAULT` is specified for that column. Since a + generated column has no default value, this restriction also + prevented addition of a generated `DATE NOT + NULL` or `DATETIME NOT NULL` column to + a nonempty table. Since the expression used to generate the + column can be used in place of the missing default for + determining the column value, this restriction is now lifted for + generated columns. + (Bug #27252354) +* **Important Change:** + For [`ANALYZE TABLE + ... UPDATE HISTOGRAM`](/doc/refman/8.0/en/analyze-table.html) statements, the `WITH + N BUCKETS` clause is now + optional. If not specified, the default value for + *`BUCKETS`* is 100. + (Bug #89909, Bug #27637968) +* **InnoDB:** + The server was stopped before a fatal error message was written + to the error log. + (Bug #27626478) +* **InnoDB:** + When determining if a wait lock could be granted, locks held by + victim transactions that were being rolled back were ignored. + (Bug #27607235) +* **InnoDB:** + An error occurred in + `Sdi_Decompressor::decompress()` when compiling + a debug build using GCC 7.2.0. + (Bug #27565889) +* **InnoDB:** + An assertion was raised when registering buffer pool chunks + during parallel creation of multiple buffer pools. A mutex is + now used to protect registration of buffer pool chunks in the + buffer pool chunk map. + (Bug #27565865) +* **InnoDB:** + Enabling the standard monitor caused an error. + (Bug #27534041) +* **InnoDB:** + An internal field used to mark a column as hidden was changed + from a boolean field to an enum field to support additional + levels of column visibility. + (Bug #27499518, Bug #89553) +* **InnoDB:** + An invalid zlib-related Valgrind failure reported that a + conditional jump or move depends on uninitialized value. + (Bug #27482740, Bug #89509) +* **InnoDB:** + An incorrect `GROUP BY` result was returned + when using the `TempTable` storage engine and a + `NO PAD` collation. + (Bug #27454796) +* **InnoDB:** + An incorrect compression length value in a page compression + function caused hole punching to be skipped the first time pages + are compressed. + (Bug #27399897) +* **InnoDB:** + Starting the server with an incorrect + [`--log-bin`](/doc/refman/8.0/en/replication-options-binary-log.html#option_mysqld_log-bin) option value raised an + assertion, and subsequent attempts to start the server with a + correct [`--log-bin`](/doc/refman/8.0/en/replication-options-binary-log.html#option_mysqld_log-bin) value or + without the [`--log-bin`](/doc/refman/8.0/en/replication-options-binary-log.html#option_mysqld_log-bin) option + continued to produce assertion failures. + (Bug #27393317) +* **InnoDB:** + A large object (LOB) reference was not updated when a LOB was + inserted during an [`UPDATE`](/doc/refman/8.0/en/update.html) + operation. + (Bug #27368662) +* **InnoDB:** + After restarting the server, a [`TRUNCATE + TABLE`](/doc/refman/8.0/en/truncate-table.html) operation raised an assertion due to table flags + that were inconsistent with remote data directory information + stored in memory. + (Bug #27367639) +* **InnoDB:** + Attempting to create a temporary table in a file-per-table + tablespace using + [`CREATE TEMPORARY + TABLE ... TABLESPACE`](/doc/refman/8.0/en/create-table.html) syntax failed to report an error. + Temporary tablespaces are only permitted in the temporary + tablespace. + (Bug #27361662) +* **InnoDB:** + A latch taken on the first page of a large object (LOB) was not + released before another thread attempted to allocate the page, + causing a deadlock. + (Bug #27360492) +* **InnoDB:** + Converting an implicit lock to an explicit lock was optimized by + the introduction of a member variable that tracks the smallest + active transaction ID. + + Thanks to Zhai Weixiang for the patch. + (Bug #27353468, Bug #89127) +* **InnoDB:** + The `mysql.innodb_ddl_log` and + `mysql.innodb_dynamic_metadata` tables, which + are used internally by the `InnoDB` storage + engine, are now protected. DDL and DML operations on these + tables are no longer permitted, and the tables no longer appear + in `INFORMATION_SCHEMA` query results. + (Bug #27353455, Bug #89129) +* **InnoDB:** + Upgrading a MySQL 5.7 instance with an + [`innodb_page_size`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_page_size) setting of 4K + caused **mysql\_upgrade** to fail with a + “Specified key was too long; max key length is 768 + bytes” error when creating or modifying system tables. + The error was suppressed to permit the + **mysql\_upgrade** client to run on an instance + with an [`innodb_page_size`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_page_size) + setting of 4K. + (Bug #27338431) +* **InnoDB:** + The recovery process could not properly determine space\_id + values, causing the server to exit. + (Bug #27331936) +* **InnoDB:** + An [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) operation that + modified the nullability of an indexed column raised an + assertion. `InnoDB` incorrectly assumed that a + new primary key must be added instead of created from an + existing unique key. + (Bug #27330454, Bug #89087) + + References: This issue is a regression of: Bug #24397406. +* **InnoDB:** + After an [`ALTER + TABLE ... IMPORT TABLESPACE`](/doc/refman/8.0/en/alter-table.html) operation, metadata could + not be retrieved correctly from the + [`INFORMATION_SCHEMA.INNODB_COLUMNS`](/doc/refman/8.0/en/information-schema-innodb-columns-table.html) + table. + (Bug #27322099) +* **InnoDB:** + An [`INSERT`](/doc/refman/8.0/en/insert.html) operation involving a + large object (LOB) value raised an assertion. After splitting a + LOB fragment, there was insufficient space for a directory + entry. + (Bug #27320977) +* **InnoDB:** + On a server using the utf8mb4 character set, an + [`INSERT`](/doc/refman/8.0/en/insert.html) or + [`UPDATE`](/doc/refman/8.0/en/update.html) during an + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) operation that + changed the row format of a table that included a virtual column + caused an index corruption. + (Bug #27319084) +* **InnoDB:** + The data retrieved from + [`INFORMATION_SCHEMA.INNODB_COLUMNS`](/doc/refman/8.0/en/information-schema-innodb-columns-table.html) + was incorrect for tables containing a virtual column. + (Bug #27316037) +* **InnoDB:** + The server failed to start after recovery due to an invalid + keyring file. The keyring file created from backup was empty. + (Bug #27307740) +* **InnoDB:** + A deadlock between background threads, one attempting to evict a + full-text search table from the cache, and the other attempting + to synchronize a table, caused InnoDB Cluster nodes to fail. + (Bug #27304661) +* **InnoDB:** + A typo was corrected in an `InnoDB` recovery + message. Thanks to Daniël van Eeden for the patch. + (Bug #27287979, Bug #27010613, Bug #88185) +* **InnoDB:** + A message stating that encryption algorithm support is missing + was reported during `InnoDB` recovery. + (Bug #27286020) +* **InnoDB:** + A missing or mismatched keyring file caused an assertion failure + at startup. + (Bug #27278324) +* **InnoDB:** + An error was returned indicating that encryption support was + missing when checking the space ID of an encrypted tablespace + file. + (Bug #27278100) +* **InnoDB:** + A debug message that prints a “too many open files” + warning is now only printed if the number of open files reaches + a limit of 300. + (Bug #27277844) +* **InnoDB:** + Failure to skip predicate locks when releasing gaps locks raised + debug assertions, as did failure to remove the supremum record + bit prior releasing gaps locks on the supremum. + (Bug #27272806, Bug #27294066) +* **InnoDB:** + A tablespace ID discovery failure occurred when starting the + server on a cloned data directory. + (Bug #27265874) +* **InnoDB:** + An unprotected global variable + (`fil_n_file_opened`) caused an assertion when + shutting down the server. + (Bug #27265473) +* **InnoDB:** + An assertion that is no longer valid was raised when checking + for pending I/O on the file in use. + (Bug #27263206) +* **InnoDB:** + An empty general tablespace caused a failure when upgrading to + MySQL 8.0. The empty data file was expected to have a specific + number of pages. + (Bug #27261822) +* **InnoDB:** + A startup failure occurred because a directory specified by the + [`--innodb-directories`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_directories) option + contained a keyring data file. The + [`--innodb-directories`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_directories) option + should only recognize `InnoDB` tablespace + files. + (Bug #27253116) +* **InnoDB:** + A function that calculates the increase in minimum bounding + rectangle (MBR) size incorrectly returned 0, resulting in R-tree + corruption. + (Bug #27237472) +* **InnoDB:** + A [`REPLACE`](/doc/refman/8.0/en/replace.html) operation on a + temporary table raised an assertion. + (Bug #27225649, Bug #27229072) +* **InnoDB:** + An online [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) operation + on a table accompanied by concurrent DML on the same table + raised an assertion. An end-of-log check was not performed prior + to accessing the DML log to determine the length of a virtual + column. + (Bug #27158030) +* **InnoDB:** + When the addition of a virtual index failed, the virtual index + that was freed was not removed from the lists of virtual column + indexes. + (Bug #27141613) +* **InnoDB:** + Adding a virtual column and index in the same statement caused + an error. + (Bug #27122803) +* **InnoDB:** + An undo tablespace truncate operation raised an assertion. The + check that determines if undo tablespace segments are inactive + was invalid. + (Bug #27114068) +* **InnoDB:** + When the TempTable storage engine was unable to allocate memory + using temporary files and mmap, an invalid error was reported + indicating that the defined on-disk storage engine would be used + instead. + (Bug #26990375) +* **InnoDB:** + Latch order was incorrectly defined in debug instrumentation + causing a latch order violation during an + [`INSERT`](/doc/refman/8.0/en/insert.html) operation. + (Bug #26983412) +* **InnoDB:** + A tablespace import operation on a server with a default row + format of `REDUNDANT` raised an assertion + failure. + (Bug #26960215) +* **InnoDB:** + A stored field based on a generated column permitted the base + column to have a NULL value. + (Bug #26958695) +* **InnoDB:** + Evaluation of a subquery in a resolving function raised an + assertion. + (Bug #26909960) +* **InnoDB:** + Locks related to data dictionary operations caused degradation + in [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) performance. + (Bug #26848711, Bug #87827) +* **InnoDB:** + A [`LOCK INSTANCE FOR BACKUP`](/doc/refman/8.0/en/lock-instance-for-backup.html) + operation was able to acquire a backup lock without waiting for + a concurrent DDL operation to finish. + (Bug #26831155, Bug #87812) +* **InnoDB:** + An incorrectly specified + [`innodb_data_file_path`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_data_file_path) or + [`innodb_temp_data_file_path`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_temp_data_file_path) + value returned a syntax error that did not specify the name of + the system variable that caused the initialization failure. + (Bug #26805833) +* **InnoDB:** + An handler that was opened for a [`TRUNCATE + TABLE`](/doc/refman/8.0/en/truncate-table.html) operation caused the operation to assert. The + server now closes open handlers before dropping the table. + + The patch for this bug also improves + [`TRUNCATE TABLE`](/doc/refman/8.0/en/truncate-table.html) error messages + related to foreign key constraints, and makes it possible to + truncate a corrupted table. + (Bug #26710839) +* **InnoDB:** + An online DDL operation that rebuilds the table raised an + assertion when the last insert log record to be applied was + split across two pages. + (Bug #26696448, Bug #87532) +* **InnoDB:** + An assertion was raised when attempting to generate a virtual + column value dependent on an off-page large object value that + was not yet stored. + (Bug #26625652) +* **InnoDB:** + An R-tree search counted delete-marked records, causing it to + find more records than present in the clustered index. As + result, the valid R-tree index was marked as corrupted. + (Bug #26381207) +* **InnoDB:** + A [`RENAME TABLE`](/doc/refman/8.0/en/rename-table.html) operation that + renamed the schema failed to rename full-text search common + auxiliary tables that were left behind when the full-text search + index was removed previously, resulting in a assertion failure + when attempting to drop the old schema. + (Bug #26334149) +* **InnoDB:** + An assertion was raised when a thread attempted to read a record + containing BLOB data while another thread was writing the same + data to external pages. + (Bug #26300119) + + References: This issue is a regression of: Bug #23481444. +* **InnoDB:** + Column prefixes for externally stored columns exceeded the + amount of available memory in the online log. + (Bug #25928471) +* **InnoDB:** + A problematic lock that was introduced to protect writing of + dynamic metadata changes to the redo log during a checkpoint was + removed. A mutex is now used instead. The checkpoint LSN was + also adjusted to protect dynamic metadata changes. + (Bug #25834374) +* **InnoDB:** + `InnoDB` failed to account for a virtual column + when using the column offset to search an index for an + auto-increment column. + (Bug #25076416) +* **InnoDB:** + An invalid debug condition caused a buffer pool chunk allocation + failure, which resulted in an assertion failure when a purge + thread attempted to access an unallocated chunk. + (Bug #23593654) + + References: This issue is a regression of: Bug #21348684. +* **InnoDB:** + Threads were prevented from entering the + `InnoDB` storage engine due to ticket + acquisition deadlocks. + (Bug #23476050) +* **Partitioning:** + An error returned by the storage engine while executing + [`ALTER TABLE + EXCHANGE PARTITION`](/doc/refman/8.0/en/alter-table.html) was not handled correctly by the + server. + (Bug #27320682) +* **Replication:** + Empty XA transactions that have been rolled back should not be + recorded in the binary log or added to the set of transactions + in the [`gtid_executed`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_executed) system + variable. However, if rolled-back empty XA transactions were + executed after an empty XA transaction ending with an + `XA COMMIT ... ONE PHASE` statement, they were + being incorrectly added to the binary log as an `XA + ROLLBACK` statement, and also to the gtid\_executed + system variable. The issue is now fixed. + (Bug #27435974) +* **Replication:** + When the system variable + [`gtid_next`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_next) was set to AUTOMATIC, + empty XA transactions that were rolled back and not recorded in + the binary log, were being incorrectly added to the set of + transactions in the + [`gtid_executed`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_executed) system variable, + causing an inconsistency. The rolled-back empty XA transactions + are no longer recorded in + [`gtid_executed`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_executed). + (Bug #27407670) +* **Replication:** + The value of `LAST_CONFLICT_FREE_TRANSACTION` + in the + [`replication_group_member_stats`](/doc/refman/8.0/en/performance-schema-replication-group-member-stats-table.html) + Performance Schema table was not correctly synchronized across + group members. + (Bug #27317431) +* **Replication:** + When a member is joining a group there is a chance of the + request to join being rejected. If the rejection resulted in a + retry, for example because the seed member being contacted was + not in the group, then there was a possibility of the retry + cycle continuing infinitely. + (Bug #27294009) +* **Replication:** + The default binary log expiration period of 30 days is now set + as the default for the + [`binlog_expire_logs_seconds`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_expire_logs_seconds) + system variable, instead of the deprecated + [`expire_logs_days`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_expire_logs_days) system + variable. + [`binlog_expire_logs_seconds`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_expire_logs_seconds) now + defaults to a value of 2592000 (30\*24\*60\*60 seconds), and + [`expire_logs_days`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_expire_logs_days) now defaults + to zero. + + In MySQL 8.0.3 and 8.0.4, the effects of + [`binlog_expire_logs_seconds`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_expire_logs_seconds) and + [`expire_logs_days`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_expire_logs_days) were + cumulative. From MySQL 8.0.11, this is no longer the case, and + the new behavior is as follows: + + + If you specify a non-zero value for both variables, only the + value of + [`binlog_expire_logs_seconds`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_expire_logs_seconds) + is used to determine the binary log expiration period, and + the value of + [`expire_logs_days`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_expire_logs_days) is + ignored. + + If you specify a non-zero value for only one variable, that + value is used to determine the binary log expiration period, + and the default for the other is not applied. + + If you specify a value for neither of the variables, the + default of 30 days from + [`binlog_expire_logs_seconds`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_expire_logs_seconds) + is used as the binary log expiration period. + + An error message is issued if you attempt to set one of the + variables dynamically when the other is already set, and a + warning message is issued if you specify a non-zero value for + both variables at startup. A deprecation warning is also issued + if you set a value for + [`expire_logs_days`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_expire_logs_days). + + To disable automatic purging of the binary log, specify a value + of 0 explicitly for + [`binlog_expire_logs_seconds`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_expire_logs_seconds), and + do not specify a value for + [`expire_logs_days`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_expire_logs_days). For + compatibility with earlier releases, automatic purging is also + disabled if you specify a value of 0 explicitly for + [`expire_logs_days`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_expire_logs_days) and do not + specify a value for + [`binlog_expire_logs_seconds`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_expire_logs_seconds). In + that case, the default for + [`binlog_expire_logs_seconds`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_expire_logs_seconds) is + not applied. You no longer need to set both variables to zero to + disable automatic purging. + (Bug #27252658) +* **Replication:** + The DDL statements [`CREATE + DATABASE`](/doc/refman/8.0/en/create-database.html), [`ALTER + DATABASE`](/doc/refman/8.0/en/alter-database.html), and [`DROP + DATABASE`](/doc/refman/8.0/en/drop-database.html) are no longer allowed to execute in parallel + with other statements on a multithreaded slave. These statements + require an exclusive metadata lock on the schema, causing a + theoretical possibility of a deadlock when + [`slave_preserve_commit_order=1`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_preserve_commit_order) + is set on the replication slave. + (Bug #27165446) +* **Replication:** + On a replication slave with binary logging disabled, an empty + DDL statement (for example, due to a replication filter) raised + an assertion. With binary logging enabled, + [`BEGIN`](/doc/refman/8.0/en/commit.html) and + [`COMMIT`](/doc/refman/8.0/en/commit.html) statements would be + written to the binary log to produce a transaction, but these + statements were not available with binary logging disabled, + causing the assertion. MySQL Server now checks for the situation + where the DDL transaction is empty and is not marked as started, + and handles it without raising the assertion. + (Bug #27164661) +* **Replication:** + A new system variable + [`rpl_read_size`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_rpl_read_size) is available to + set the minimum amount of data in bytes that is read from the + binary log files and relay log files. The default read size is + 8KB. If heavy disk I/O activity for these files is impeding + performance for the database, increasing the read size might + reduce file reads and I/O stalls if the files are not being + cached by the operating system. + + Note that a buffer the size of this value is allocated for each + thread that reads from the binary log and relay log files, + including dump threads on masters and coordinator threads on + slaves. Setting a large value might therefore have an impact on + memory consumption for servers. + + Thanks to the Facebook team for the patch. + (Bug #27147095) +* **Replication:** + On a server with GTIDs enabled, if [`RESET + MASTER`](/doc/refman/8.0/en/reset-master.html) was used when a transaction had been flushed + but not yet committed, the server GTIDs were left in an + incorrect state. At this point, the GTID for the transaction had + been added to the set of owned GTIDs, but not yet to the set of + executed GTIDs. The GTID was removed from the binary log when + the content of the uncommitted transaction was cleared by the + [`RESET MASTER`](/doc/refman/8.0/en/reset-master.html) statement, but the + GTID could not be reused because it was already owned, so the + sequence of GTIDs had a gap. + + With this fix, [`RESET MASTER`](/doc/refman/8.0/en/reset-master.html) + acquires a global read lock to ensure that no transactions are + in commit stage during its operation, and no new transactions + enter into commit stage during its operation. If there are any + ongoing commits, [`RESET MASTER`](/doc/refman/8.0/en/reset-master.html) + waits until they are complete. The global read lock is released + when the reset is finished, and then storage engines are + notified of the successful reset. If [`FLUSH + TABLES WITH READ LOCK`](/doc/refman/8.0/en/flush.html#flush-tables-with-read-lock) has already been executed for + the thread, [`RESET MASTER`](/doc/refman/8.0/en/reset-master.html) does not + retry the lock. + (Bug #27041759) +* **Replication:** + Attempts to set a GTID for an unsafe or empty XA transaction + using a `SET @@SESSION.GTID_NEXT` statement + were not being handled correctly. On a server with + [`gtid_mode`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_mode) set to + `OFF` or `OFF_PERMISSIVE`, and + [`enforce_gtid_consistency`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_enforce_gtid_consistency) set to + `OFF`, setting a GTID for an unsafe XA + transaction (creating or dropping a temporary table) caused an + inconsistency in the server's GTID violation counter and raised + an assertion. Testing also showed that setting a GTID for an + empty XA transaction caused an incorrect sequence of events to + be written to the binary log. Both these situations are now + handled correctly. + (Bug #27041402, Bug #88272) +* **Replication:** + The error message issued for a server stop while rotating the + binary log did not state the correct cause for the issue. The + error message has been enhanced to include the actual error + causing the server stop as part of the message. A new error + [`ER_OOM_SAVE_GTIDS`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_oom_save_gtids) has also been + added for the situation where an out-of-memory error occurred + while saving the set of GTIDs from the last binary log into the + `mysql.gtid_executed` table. + (Bug #27040070, Bug #88262) +* **Replication:** + The statements + [`CREATE USER IF + EXISTS`](/doc/refman/8.0/en/create-user.html) (or `IF NOT EXISTS`) and + [`ALTER USER IF + EXISTS`](/doc/refman/8.0/en/alter-user.html) (or `IF NOT EXISTS`) were + written to the binary log even when the query resulted in an + error. MySQL Server now checks for errors that cause these + queries to fail (for example, an invalid plugin was specified), + and does not log the statement in that situation. Note that if + these statements succeed but have no effect on the master + because the condition is not met, the statements are written to + the binary log, as the condition might be met on a replication + slave (see Bug #25813089, Bug #85733). + (Bug #26680035) + + References: See also: Bug #25813089, Bug #85733. +* **Replication:** + Following the introduction of support for atomic DDL in MySQL + 8.0, a replication slave that supports atomic DDL can diverge + from a replication master at an earlier MySQL version that does + not support atomic DDL. If the DDL statement can only be partly + applied, the slave using MySQL 8.0 rolls back the whole DDL + statement, but the master using an earlier version might commit + the valid parts of the DDL statement. An error message is now + logged in the event of an unsuccessful commit for an atomic DDL + statement on the master and the slave, and you should check that + the states of the master and the slave have not diverged before + proceeding. + (Bug #26133488) +* **Replication:** + When GTIDs are enabled on a replication master and slave, and + the slave connects to the master with the + `MASTER_AUTO_POSITION=1` option set, the master + must send the slave all the transactions that the slave has not + already received, committed, or both. If any of the transactions + that should be sent by the master have been already purged from + the master's binary log, the master sends the error + `ER_MASTER_HAS_PURGED_REQUIRED_GTIDS` (1789) to + the slave, and replication does not start. + + The message provided for the error + `ER_MASTER_HAS_PURGED_REQUIRED_GTIDS` has been + changed to provide advice on the correct action in this + situation, which is for the slave to replicate the missing + transactions from another source, or for the slave to be + replaced by a new slave created from a more recent backup. The + message advises that the master's binary log expiration period + can be revised to avoid the situation in future. In addition, + the master now identifies the GTIDs of the purged transactions + and supplies them in its error log in the warning message + [`ER_FOUND_MISSING_GTIDS`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_found_missing_gtids) (11809), + so that you do not need to calculate the missing GTIDs manually. + (Bug #26004541, Bug #29769293) +* **Replication:** + For updates to virtual generated columns containing the BLOB + data type, both the old and the new BLOB values are required by + some storage engines for replication. This fix extends the same + behavior to JSON and GEOMETRY data types, which are based on the + BLOB data type and so produce the same issue when the old value + is not stored. + (Bug #25873029) +* **Replication:** + A behavior change in MySQL 8.0.0 moved the identification of + generated columns from before to after the calculation of the + write set for binary logging. This caused an issue with NDB + cluster replication, because that storage engine omits the + generated columns from the log event if they are unnecessary, + leading to `NULL` values being set for them by + the applier thread on the replication slave. The identification + of generated columns has now been moved back to before the write + set calculation, so that the issue does not occur. + (Bug #25827408) +* **Replication:** + On a multithreaded replication slave (with + [`slave_parallel_workers`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_parallel_workers) greater + than 0), the slave's lag behind the master was not being + reported by the `Seconds_Behind_Master` field + for [`SHOW SLAVE STATUS`](/doc/refman/8.0/en/show-slave-status.html). The value + is now reported correctly. Thanks to Robert Golebiowski for the + patch. + (Bug #25407335, Bug #84415) +* **Replication:** + A plus sign (`+`) can be used with a GTID set + in the statement `SET @@GLOBAL.GTID_PURGED` to + indicate that the specified GTID set does not intersect with + [`gtid_executed`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_executed). The plus sign + was also being permitted for GTID sets specified for the + functions [`GTID_SUBSET()`](/doc/refman/8.0/en/gtid-functions.html#function_gtid-subset) and + [`GTID_SUBTRACT()`](/doc/refman/8.0/en/gtid-functions.html#function_gtid-subtract), where it was not + meaningful. The plus sign can no longer be specified with these + functions. Also, error messages relating to the `SET + @@GLOBAL.GTID_PURGED` operation have been improved. + (Bug #24675979) +* **Replication:** + When invoked with the options + [`--read-from-remote-server`](/doc/refman/8.0/en/mysqlbinlog.html#option_mysqlbinlog_read-from-remote-server) + and [`--hexdump`](/doc/refman/8.0/en/mysqlbinlog.html#option_mysqlbinlog_hexdump), + **mysqlbinlog** was not able to produce a hex + dump of the binary log contents following an SQL statement that + generated an autoincrement value, referenced a user-defined + variable, or invoked `RAND()`. The event types + for these events are followed by an informational row query log + event, and **mysqlbinlog** caches the original + event for printing when the subsequent row query log event is + received. The pointer to the memory containing the original + event was invalidated when the subsequent event was received, so + the original data could not be accessed to produce the hex dump. + The issue has now been fixed. + (Bug #24674276) +* **Replication:** + A number of changes were made to the binary log decoding + procedure to improve handling of invalid or corrupted binary log + entries. + (Bug #24365972) +* **Replication:** + Following the introduction of binary logging for XA transactions + [WL#6860](https://dev.mysql.com/worklog/task/?id=6860), + an assertion could be raised in debug builds during replication + from a master with the feature to a slave without the feature, + if `MASTER_AUTO_POSITION=1` was set on the + slave. The assertion has been removed, so that debug builds now + have the same behavior as non-debug builds, and can attempt + replication of unsupported event types whether or not + `MASTER_AUTO_POSITION=1` is set. + (Bug #20677683) +* **Replication:** + When using + [`group_replication_ip_whitelist`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_ip_whitelist), + it was possible to configure a group so that it functioned even + though all members could not establish the internal group + communication connection to each other, resulting in + inconsistent behavior. Now, incoming connections are accepted if + the IP is in the white list or if the IP belongs to a current + member of the XCom configuration. This ensures members are + always able to create the internal network required for group + communication. + (Bug #87834, Bug #26846549, Bug #27406775) +* **Group Replication:** + When MySQL was started with + [`--plugin-load='group_replication.so'`](/doc/refman/8.0/en/server-options.html#option_mysqld_plugin-load) + but Group Replication was not started, starting an asynchronous + slave channel resulted in an unresponsive server. + (Bug #27584141) +* **Group Replication:** + Group Replication failed to start if certain required variables + were persisted, or if persisted variables were not set in proper + timestamp order. + (Bug #27545544, Bug #27522405) +* **Group Replication:** + Group Replication files have been moved from the + `rapid` directory to the + `plugin` directory. + (Bug #27413789) +* **Group Replication:** + Conflict detection uses schema and table names as part of the + Primary Key Equivalent (PKE) in order to detect and disallow + conflicting transactions. The value of + [`lower_case_table_names`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names) changes + how schema and table names are stored and externalized; + depending on the value, this could persist a table named + `T1` as `t1`. Such a + difference in a group could cause inconsistencies. Now, members + must all have the same value for + [`lower_case_table_names`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names). + (Bug #27401817) +* **Group Replication:** + Using an IP address or hostname in any Group Replication related + configuration on macOS was failing. + (Bug #27376511, Bug #89123, Bug #27604471) +* **Group Replication:** + Changing the Group Replication required settings incorrectly on + online secondary members could result in an unexpected halt. + (Bug #27317478, Bug #27157202) +* **Group Replication:** + After issuing [`START + GROUP_REPLICATION`](/doc/refman/8.0/en/start-group-replication.html) the + [`gtid_mode`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_mode) system variable is + locked to prevent any modification to its value until the group + is online. Any attempt to modify + [`gtid_mode`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_mode) during this time is + blocked. As part of the process of starting Group Replication + the server needs to set + [`super_read_only=off`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only), which has + dependencies on locks acquired by + [`SET GTID_MODE`](/doc/refman/8.0/en/set.html). + This could result in Group Replication hanging and there was no + possibility to connect to the server to resolve the situation. + To prevent this situation, when it is not possible to acquire + the locks needed by [`SET + GTID_MODE`](/doc/refman/8.0/en/set.html) the operation aborts. + (Bug #27312241) +* **Group Replication:** + In the unlikely event of the group failing to start, for example + because no seed member could be contacted, there is a one minute + period where the group retries the start process. Attempting to + modify a Group Replication plugin option during this period + could result in an unexpected halt. Now, attempting to modify a + Group Replication plugin option during plugin start or stop + results in error. + (Bug #27275312) +* **Group Replication:** + Attempting to uninstall the Group Replication plugin on a server + configured to start the plugin automatically at boot could + result in a deadlock. Now, the uninstall process checks to + ensure that the plugin is not in the process of starting and + fails gracefully if it is. + (Bug #27179336) +* **Group Replication:** + Group Replication uses transaction write set extraction for + conflict detection on group members. A performance regression + was found in this process during detailed performance analysis, + which is handled by optimizing memory allocation has been for + write set extraction and memory copy operations. In addition, + foreign key write sets are now collected only when the current + table actually has foreign keys. + (Bug #27016053) +* **Group Replication:** + In a multi-primary group, when a member was also configured with + a asynchronous replication channel, there was a possibility that + the asynchronous channel could start before Group Replication + started. This could result in the asynchronous channel + processing transactions before the member became an online + member of the group, causing issues when members tried to join + the group. The fix ensures that asynchronous channels on group + members do not start until the member has become online. + (Bug #26648393) +* **Linux:** + Builds on Alpine Linux now take advantage of AIO support. + (Bug #27327874) +* **macOS:** + On macOS, **mysql\_config --libs** did not list + any SSL libraries. + (Bug #27232576) +* **Microsoft Windows:** + On Windows, the [`RESTART`](/doc/refman/8.0/en/restart.html) statement + is implemented by having **mysqld** fork, with + one process acting as a monitor to the other, which acts as the + server. This makes determining the server process to attach to + for debugging more difficult. To alleviate this, starting the + server with [`--gdb`](/doc/refman/8.0/en/server-options.html#option_mysqld_gdb) now suppresses + forking. A side effect is that for a server started with this + option, [`RESTART`](/doc/refman/8.0/en/restart.html) simply exits and + does not restart. + (Bug #27273229) +* **JSON:** + The [`JSON_QUOTE()`](/doc/refman/8.0/en/json-creation-functions.html#function_json-quote) function could + in some situations write the quoted string to the same buffer + that holds the input string, which could lead to wrong results. + Now a check is made to be sure that it does not attempt write + into the same buffer that it is reading from. + (Bug #27312444) +* **JSON:** + [`JSON_SEARCH()`](/doc/refman/8.0/en/json-search-functions.html#function_json-search) no longer performs + any modification of cached `Json_path` objects, + now making any needed updates to a `String` + object that represents the path instead. This saves on the + number of round trips required between the path's + `Json_path` and `String` + representations, which speeds up execution. In addition, the + *`one_or_all`* and + *`escape_char`* arguments to + `JSON_SEARCH()` were unnecessarily cached; + these arguments are no longer cached, which should also improve + this function's execution time. + (Bug #87383, Bug #26614455) + + References: See also: Bug #21450084, Bug #77785, Bug #21472872. +* A check was implemented based on data dictionary version + information to prevent starting the MySQL 8.0 server with a data + directory created by a later MySQL release. The check was + necessary to prevent an in-place downgrade, which is currently + not supported. + (Bug #27708249) +* Protected data dictionary tables are no longer accessible by + statements placed in a server initialization file. + (Bug #27674311, Bug #90010) +* Data dictionary and `INFORMATION_SCHEMA` + version numbers were synchronized with the new MySQL server + version number. + (Bug #27674285) +* The server did not handle correctly certain + `LIKE` queries using a + [`BLOB`](/doc/refman/8.0/en/blob.html) column with a prefix index. + (Bug #27660560) +* For builds configured using + [`-DWITH_PROTOBUF=SYSTEM`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_protobuf), building + failed on systems with Protobuf 3.5 installed. + (Bug #27638713, Bug #89915) +* The microseconds part of timestamps stored with persisted + variables in `mysqld-auto.cnf` was always + 000000. + (Bug #27629719) +* Debian packages now handle dependencies for MeCab plugin + dictionary files. Fedora packages now handle dependencies for + both MeCab packages, not just the utf-8 package. + (Bug #27612730, Bug #27613539) +* The change in MySQL 8.0.11 for platforms that use systemd to run + **mysqld** as a normal process + (`Type=notify`) and communicate using a socket + file did not work on SLES before SLES 12.2. + (Bug #27604999) +* The `NON_UNIQUE` column in the + [`INFORMATION_SCHEMA.STATISTICS`](/doc/refman/8.0/en/information-schema-statistics-table.html) table + had type [`BIGINT`](/doc/refman/8.0/en/integer-types.html) prior to MySQL + 8.0, but became [`VARCHAR`](/doc/refman/8.0/en/char.html) in MySQL + 8.0 with the introduction of the data dictionary. The + `NON_UNIQUE` column now has an integer type + again ([`INT`](/doc/refman/8.0/en/integer-types.html) because the column + need not be as large as `BIGINT`). + (Bug #27593348, Bug #89793) +* With some inputs, [`ST_Crosses()`](/doc/refman/8.0/en/spatial-relation-functions-object-shapes.html#function_st-crosses) + could cause a server exit. + (Bug #27576700) +* Some error messages were being written to the error log with an + error ID of 0 rather than a legitimate error ID. + (Bug #27575608) +* **mysql\_upgrade** did not set + `MYSQL_SERVER_PUBLIC_KEY` correctly, leading to + failure to read the key file. + (Bug #27568278) +* If [`autocommit`](/doc/refman/8.0/en/server-system-variables.html#sysvar_autocommit) was disabled, + **mysql\_upgrade** produced an error when + upgrading from MySQL 5.7 to 8.0. + (Bug #27549249) +* For debug builds, displaying very long stage names from the + `PROCESSLIST_STATE` column of the Performance + Schema [`threads`](/doc/refman/8.0/en/performance-schema-threads-table.html) table could raise an + assertion. + (Bug #27545688) +* [`gtid_purged`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_purged) handling had a + memory leak. + (Bug #27537968, Bug #89645) +* Using [`SET + PERSIST`](/doc/refman/8.0/en/set-variable.html) to persist + [`optimizer_trace_offset`](/doc/refman/8.0/en/server-system-variables.html#sysvar_optimizer_trace_offset) resulted + in an incorrect variable value after server restart. + (Bug #27536421) +* The `validate_password` component could leak + memory. + (Bug #27521770, Bug #89597) +* A typo in `sql/handler.h` was corrected. + Thanks to Su Tristan for the patch. + (Bug #27516280, Bug #89594) +* The Performance Schema + [`variables_info`](/doc/refman/8.0/en/performance-schema-variables-info-table.html) table displayed + incorrect `VARIABLE_SOURCE` and + `VARIABLE_PATH` values for variables set within + option files specified by `!include` or + `!includedir` directives. + (Bug #27514223) + + References: This issue is a regression of: Bug #25563891. +* After upgrading from MySQL 5.7 to MySQL 8.0, the first attempt + to start the server on a MySQL 5.7 data directory with + [`--default-time-zone`](/doc/refman/8.0/en/server-options.html#option_mysqld_default-time-zone) set to a + specific time value such as `"+00:00"` caused + the server to exit. + (Bug #27512609, Bug #89584) +* Lookups of character set internal numbers was not thread safe + and could cause memory leaks. + (Bug #27507950) +* Using the [`-DWITH_LIBEVENT=system`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_libevent) + and [`-DWITH_ICU=system`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_icu) + **CMake** options together caused configuration + to fail. + (Bug #27505535, Bug #89398) +* Some messages were being written to the server error log using + client error IDs. + (Bug #27503787, Bug #89562) +* When run in key migration mode, the server could report an error + for successful operations. + (Bug #27493997) +* Upgrades from MariaDB to MySQL Community Edition failed on + Fedora 27. + (Bug #27484835) +* [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) could hang in a + Waiting for tablespace metadata lock + state. + (Bug #27472087, Bug #89487) +* Selecting from the Performance Schema + [`status_by_thread`](/doc/refman/8.0/en/performance-schema-status-variable-tables.html) or + [`variables_by_thread`](/doc/refman/8.0/en/performance-schema-system-variable-tables.html) table was not + thread safe and could yield incorrect results. + (Bug #27471510) +* `INSERT ... ON DUPLICATE KEY UPDATE` could be + handled improperly if a source table produced no rows. + (Bug #27460607) +* [`SET + PERSIST_ONLY`](/doc/refman/8.0/en/set-variable.html) ignored + [`--skip-grant-tables`](/doc/refman/8.0/en/server-options.html#option_mysqld_skip-grant-tables) and continued + to perform checking against the dynamic privileges needed to set + system variables. + (Bug #27455943) +* For RPM packages and Docker RPM packages, the included + `my.cnf` file now includes information + indicating how to revert to the previous default authentication + plugin (changing `caching_sha2_password` to + `mysql_native_plugin`), for compatibility with + older clients. + (Bug #27454015, Bug #27675380) +* In string comparisons using `>`, only one + operand was handled as `utf32`. + (Bug #27452148) +* A server exit during `InnoDB` initialization + caused AddressSanitizer (ASan) to report a memory leak. The + patch also implements proper handling of the data dictionary + properties table in cases where the table contains data that + cannot be parsed. + (Bug #27447981, Bug #89433) +* With [`-DWITH_SSL=system`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_ssl), if + **CMake** could not find the system OpenSSL + libraries and header files, it produced confusing messages. Now + it exits immediately with an error. + (Bug #27447874) +* Configuring with the + [`-DWITH_INNODB_EXTRA_DEBUG=ON`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_innodb_extra_debug) + **CMake** option resulted in a linker error. + (Bug #27444255, Bug #89412) +* Configuring with + [`-DWITH_ZLIB=system`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_zlib) resulted in a + linker error. + (Bug #27435371, Bug #89373) +* Metadata from result sets for `UNION ALL` + queries could say `NEWDATE` rather than + `DATE`. + (Bug #27422376) +* In builds with Undefined Behavior Sanitizer enabled, negation of + -922337203685477580 could cause a server exit. + (Bug #27419181) +* With protocol compression enabled, a spurious assertion could be + raised. + (Bug #27418207, Bug #89324) + + References: This issue is a regression of: Bug #17922198. +* Performance related to fetching tablespace objects from the data + dictionary to populate the data dictionary cache was improved. + (Bug #27402243) +* If the server was started with + [`--skip-grant-tables`](/doc/refman/8.0/en/server-options.html#option_mysqld_skip-grant-tables), clients that + authenticate with the `caching_sha2_password` + plugin were unable to connect. + (Bug #27400095, Bug #89267) +* Linux RPM and Debian packages now include dependency information + for the Perl JSON module required to run the MySQL test suite. + Linux RPM packages now include dependency information for the + Perl Digest module required to run the MySQL test suite. + (Bug #27392800, Bug #89250, Bug #27392808, Bug #89244) +* A new system variable, + [`default_collation_for_utf8mb4`](/doc/refman/8.0/en/server-system-variables.html#sysvar_default_collation_for_utf8mb4), + is provided for internal use by replication. The system variable + is set to the default collation for the + `utf8mb4` character set. The value of the + variable is replicated from a master to a slave so that the + slave can correctly process data originating from a master with + a different default collation for `utf8mb4`.The + variable is primarily intended to support replication from a + MySQL 5.7 or older master server to a MySQL 8.0 slave server, or + group replication with a MySQL 5.7 primary node and one or more + MySQL 8.0 secondaries. The default collation for + `utf8mb4` in MySQL 5.7 is + `utf8mb4_general_ci`, but it is + `utf8mb4_0900_ai_ci` in MySQL 8.0. The variable + is not present in releases earlier than MySQL 8.0, so if the + slave does not receive a value for the variable, it assumes the + master is from an earlier release, and sets the value to the + previous default collation + `utf8mb4_general_ci`. + + The default `utf8mb4` collation is used in the + following statements: + + + [`SHOW COLLATION`](/doc/refman/8.0/en/show-collation.html) and + [`SHOW CHARACTER SET`](/doc/refman/8.0/en/show-character-set.html). + + [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) and + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) having a + `CHARACTER SET utf8mb4` clause without a + `COLLATION` clause, either for the table + character set or for a column character set. + + [`CREATE DATABASE`](/doc/refman/8.0/en/create-database.html) and + [`ALTER DATABASE`](/doc/refman/8.0/en/alter-database.html) having a + `CHARACTER SET utf8mb4` clause without a + `COLLATION` clause. + + Any statement containing a string literal of the form + `_utf8mb4'some + text'` without a + `COLLATE` clause. + + (Bug #27389878, Bug #27081073) +* [`DESCRIBE`](/doc/refman/8.0/en/explain.html) with + a column name option ignored the column name. + (Bug #27387773, Bug #89224) +* When run in key migration mode, the server ignored invalid + options. + (Bug #27387331) +* [`SHOW GRANTS`](/doc/refman/8.0/en/show-grants.html) for an anonymous user + could cause a server exit. + (Bug #27375069) +* Path name normalization could fail for very long path names. + (Bug #27368298) +* During configuration, **CMake** assumed that + **rpcgen** was available rather than checking for + it. + (Bug #27368078) +* The client authentication process could use memory after it had + been freed. + (Bug #27366143) +* [`-DWITH_ZLIB=system`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_zlib) could cause + other **CMake** feature tests to fail. + (Bug #27356658, Bug #89135) +* On some systems, using **mysqld --initialize** to + initialize the data directory was very slow. + (Bug #27349579, Bug #89122) +* Builds using RPM source packages now use a secure connection if + Boost must be downloaded. + (Bug #27343289, Bug #89104) +* An internal `check_datetime_range` function + that converted an ULONGLONG time value raised an assertion on + Windows. + (Bug #27340709) +* Too much locking was being done for the + `caching_sha2_password` authentication plugin + (one lock/unlock per connection). This is now improved to one + lock/unlock per plugin install/uninstall. + (Bug #27335346) +* A [`CREATE TABLE ... + LIKE`](/doc/refman/8.0/en/create-table.html) operation that implicitly assigned + `'innodb_system'` as the tablespace name for + table partitions raised an assertion. + (Bug #27331588) +* [`SET + PERSIST_ONLY`](/doc/refman/8.0/en/set-variable.html) could store large-valued variables + incorrectly. + (Bug #27322254) +* The `audit_log` plugin could write statements + to the binary log even with binary logging disabled. + (Bug #27315321) +* Certain queries using GREATEST() or LEAST() produced + heap-use-after-free errors. + (Bug #27312703) +* An `external_language` column was added to the + `mysql.routines` data dictionary table to + support stored routines in different languages. The data stored + in this column can be accessed through the + `EXTERNAL_LANGUAGES` column of the + [`INFORMATION_SCHEMA.ROUTINES`](/doc/refman/8.0/en/information-schema-routines-table.html) table. + (Bug #27309116, Bug #89038) +* It is now prohibited to start the server with a + [`lower_case_table_names`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names) setting + that is different from the setting used when the server was + initialized. The restriction is necessary because collations + used by data dictionary table fields are determined by the + setting defined when the server is initialized, and restarting + the server with a different setting would introduce + inconsistencies with respect to how identifiers are ordered and + compared. + (Bug #27309094, Bug #89035) +* For accounts that authenticated using the + `auth_sock` authentication plugin, the server + was unable to accept connections from clients from older MySQL + versions. + (Bug #27306178) +* An `audit_log` plugin memory leak was + corrected. + (Bug #27302151) +* The [`INFORMATION_SCHEMA.FILES`](/doc/refman/8.0/en/information-schema-files-table.html) table + now obtains from storage engines the information needed for the + following columns: `LOGFILE_GROUP_NAME`, + `LOGFILE_GROUP_NUMBER`, + `ROW_FORMAT`, `VERSION`. + (Bug #27292586) +* Dropping a loadable function did not always remove its entry + from the Performance Schema + [`user_defined_functions`](/doc/refman/8.0/en/performance-schema-user-defined-functions-table.html) table. + (Bug #27270498) +* To reduce its size and storage footprint, serialized dictionary + information (SDI) is now generated in a compact JSON format. + (Bug #27265584) +* Concurrent execution of + [`RESET PERSIST`](/doc/refman/8.0/en/reset.html) + and [`SET + PERSIST`](/doc/refman/8.0/en/set-variable.html) from multiple sessions could cause a server + exit. + (Bug #27264789) +* Tablespace statistics could be cached even if the + statistics-collection process encountered an error. + (Bug #27259963) +* [`SET + PERSIST`](/doc/refman/8.0/en/set-variable.html) could fail to find the proper directory into + which to write the `mysqld-auto.cnf` file. + (Bug #27253828) +* [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) could not create + generated `NOT NULL` geometry columns if the + table contained data. + (Bug #27252609) +* The Performance Schema + [`variables_info`](/doc/refman/8.0/en/performance-schema-variables-info-table.html) table displayed + incorrect `VARIABLE_SOURCE` values for + variables that were set in `my.cnf` and also + persisted to `mysqld-auto.cnf`. + (Bug #27252077) +* Improper handling of plugin loading and unloading could cause a + server exit. + (Bug #27247280, Bug #27297704) +* The [`RESTART`](/doc/refman/8.0/en/restart.html) statement did not + work for Ubuntu packages. + (Bug #27245918) +* LDAP authentication plugins were not built on FreeBSD. + (Bug #27238252) +* The server did not handle queries correctly when a cached value + was evaluated as `NULL` by a windowing + function, or when its argument was part of a `GROUP + BY` with a `ROLLUP` operation which + could be evaluated as `NULL`. + (Bug #27233287) +* Windowing functions such as + [`LAST_VALUE()`](/doc/refman/8.0/en/window-function-descriptions.html#function_last-value) did not work + correctly with tables containing `NOT NULL` + columns in all cases. + (Bug #27230463) +* Role cache invalidation could be performed incorrectly. + (Bug #27225806) +* Incorrect handling of persisted variables at server startup + could result in a server exit. + (Bug #27224682) +* For upgrades from MySQL 5.7 to 8.0, the + `sql_mode` value for object definitions could + contain `NOT_USED`. + (Bug #27219709) +* [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table) failed if no default + database was selected. + (Bug #27217897) +* Adding a unique index to an `InnoDB` table on + which multiple locks were held could raise an assertion. + (Bug #27216817) +* [`CREATE VIEW`](/doc/refman/8.0/en/create-view.html) statements that used + [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table) in the view + definition failed if no database was selected. + (Bug #27189940) +* The Doxygen documentation for + `CLIENT_SSL_VERIFY_SERVER_CERT` was corrected. + Thanks to Bradley Grainger for the patch. + (Bug #27189363, Bug #88686) +* Queries on Performance Schema replication tables could return + incorrect results, particularly when the execution plan used an + index. + (Bug #27184567) +* For some statements, the [`FILE`](/doc/refman/8.0/en/privileges-provided.html#priv_file) + privilege was not properly checked. + (Bug #27160888) +* To better enable setting persisted variables at startup in the + same order they were persisted with + [`SET + PERSIST`](/doc/refman/8.0/en/set-variable.html), settings in + `mysqld-auto.cnf` are first sorted based on + timestamp (which is now stored in the file). + (Bug #27157520) +* Setting the + [`dragnet.log_error_filter_rules`](/doc/refman/8.0/en/server-system-variables.html#sysvar_dragnet.log_error_filter_rules) + system variable to a very long value could cause a server exit. + (Bug #27120953) +* For platforms that use systemd (see + [Managing MySQL Server with systemd](/doc/refman/8.0/en/using-systemd.html)), systemd was not always able to + infer the state of a double-forked **mysqld** + process. Consequently, systemd would attempt to restart + **mysqld** even when that process terminated with + status 1. systemd is now configured to run + **mysqld** as a normal process + (`Type=notify` rather than + `Type=forking`). If the name of a socket file + is specified in the environment variable + `NOTIFY_SOCKET`, **mysqld** + attempts to open a connection for communicating with systemd and + writes its state changes there. + (Bug #27109556, Bug #88463, Bug #26538598, Bug #87210) +* [`ST_IsValid()`](/doc/refman/8.0/en/spatial-convenience-functions.html#function_st-isvalid) returned incorrect + results for some geographic polygons on non-WGS 84 ellipsoids. + (Bug #27074700) +* A multiple-insert statement on a table containing a + `FULLTEXT` key and a + `FTS_DOC_ID` column caused a server error. + (Bug #27041445, Bug #88267) + + References: This issue is a regression of: Bug #22679185. +* In strict SQL mode, assignment of invalid values to + `AUTO_INCREMENT` columns could be handled + incorrectly, resulting in an assertion being raised. + (Bug #27041393, Bug #88273) +* Thread stack exhaustion could raise an assertion rather than + returning an error. + (Bug #27041350, Bug #88277) +* [`SET + PERSIST_ONLY`](/doc/refman/8.0/en/set-variable.html) did not properly consider whether the + runtime validation function for persisted variables should be + invoked. + (Bug #27016247) +* The `audit_log` plugin could mishandle aborts + of event executions, causing a server exit. + (Bug #27008133) +* Some boundary cases for negation of large signed integers were + corrected. + (Bug #27004880, Bug #27008075) +* An [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) operation + attempted to set the `AUTO_INCREMENT` value for + table in a discarded tablespace. + (Bug #26935001) +* `MyISAM` index corruption could occur for + bulk-insert and table-repair operations that involve the + repair-by-sorting algorithm and many (more than 450 million) + rows. + (Bug #26929724, Bug #88003, Bug #28483283) +* The Performance Schema could produce + `DIGEST_TEXT` values with a trailing space. + This no longer occurs. + (Bug #26908015) +* Dropping an index from a system table could cause a server exit. + (Bug #26881798) +* A prepared statement using + [`CREATE + TABLE ... SELECT`](/doc/refman/8.0/en/create-table-select.html) led to unexpected behavior when it + referred in a `GROUP BY` to a view having the + same name. + (Bug #26881703) +* With auto-commit disabled and an XA transaction in PREPARED + state, attempts to execute + [`XA COMMIT`](/doc/refman/8.0/en/xa.html) or + [`XA ROLLBACK`](/doc/refman/8.0/en/xa.html) + failed. + (Bug #26848877, Bug #87836) +* Some diagnostic messages produced by LDAP authentication plugins + misleadingly suggested an error when no error had occurred. + (Bug #26844713) +* Initialization code for **mysql\_upgrade** and + **mysqlpump** was reorganized to avoid assertion + failures. + (Bug #26802211) +* Full-text searches could raise an assertion due to improper + handling of errors that occurred while attempting to acquire + metadata locks. + (Bug #26799898) +* A keyring file created by the `keyring_file` + plugin on a 32-bit server was inaccessible by the + `keyring_file` on a 64-bit server, and vice + versa. + (Bug #26793060) +* Metadata locks for column statistics were not displayed properly + in the Performance Schema + [`metadata_locks`](/doc/refman/8.0/en/performance-schema-metadata-locks-table.html) and + `events_waits_xxx` + tables. + (Bug #26772858, Bug #87708) +* The `my_snprintf` plugin service was removed + and reimplemented using C++11 `snprintf`. + (Bug #26696147, Bug #87547) +* After an in-place upgrade from MySQL 5.7 to MySQL 8.0 on a + server with a large number of tables, server startup failed to + complete due to excessive memory consumption during data + dictionary creation. + (Bug #26486160) +* An error occurring in a statement that modifies user privileges + could result in deadlock for other transactions attempting to + access the user privilege cache. + (Bug #26475282) +* The thread pool plugin logged too much information for failed + connections. + (Bug #26368725, Bug #86863) +* Enabling multiple components concurrently could result in a + server exit. + (Bug #26171471, Bug #86514) +* A malformed `mysqld-auto.cnf` file could + cause a server exit. + (Bug #26085774) +* Creating a table in a reserved tablespace did not return an + error. + (Bug #26073851, Bug #86309) +* For debug builds, using [`KILL`](/doc/refman/8.0/en/kill.html) to + terminate a stored routine could raise an assertion. Thanks to + Laurynas Biveinis for the patch. + (Bug #26040870, Bug #86260) +* If the [`init_connect`](/doc/refman/8.0/en/server-system-variables.html#sysvar_init_connect) system + variable was set, its contents could not be executed by clients + with expired passwords, who therefore were prevented from + connecting. Now, if a client has an expired password, + [`init_connect`](/doc/refman/8.0/en/server-system-variables.html#sysvar_init_connect) execution is + skipped, which enables the client to connect and change + password. + (Bug #25968185) +* Dates using the *`YYYYMMDD`* format were + not recognized correctly in a query meeting all three of the + following conditions: + + The query performed a left join. + + A [`DATE`](/doc/refman/8.0/en/datetime.html) column in the inner table + of the join was part of a multi-column primary key. + + Every column in the inner table's primary key was compared with + another value; this could be either a literal or a column value. + (Bug #25949639) +* An in-place [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) operation + on a table with foreign keys resulted in a table definition + mismatch. The new table definition passed to storage engine + methods during the [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) + execution contained invalid foreign key names. + (Bug #25915132, Bug #85997) +* It was possible to assign nonexistent roles to an account as its + default roles. + (Bug #25755666, Bug #85561) +* Using the C API, when trying to execute an + `INSERT` prepared statement with + `CURSOR_TYPE_READ_ONLY` set, the client hung. + (Bug #25701141, Bug #85105) +* [`RENAME USER`](/doc/refman/8.0/en/rename-user.html) failed even though + the user or role to be renamed was not present in any role + graph. + (Bug #25658586) +* MySQL client programs could exit unexpectedly if malformed + client/server protocol packets were received. + (Bug #25471090) +* Memory statistics collected by the Performance Schema could be + incorrect due to race conditions. + (Bug #25212799) +* Incorrect handling by the `CONNECTION_CONTROL` + plugin of an internal hash led to spurious messages in the error + log and eventual server exit. + (Bug #25052009) +* [`CURRENT_ROLE()`](/doc/refman/8.0/en/information-functions.html#function_current-role) and + [`ROLES_GRAPHML()`](/doc/refman/8.0/en/information-functions.html#function_roles-graphml) now return a + string with the `utf8` character set. + Previously, they incorrectly returned a binary string. + (Bug #24843257) +* Killing [`INSTALL COMPONENT`](/doc/refman/8.0/en/install-component.html) or + [`UNINSTALL COMPONENT`](/doc/refman/8.0/en/uninstall-component.html) could result + in multiple rows for a single component in the + `mysql.component` system table. + (Bug #24660436) +* Performing [`SHOW PROCESSLIST`](/doc/refman/8.0/en/show-processlist.html) while + running a high load concurrently using the X Plugin could lead + to an unplanned server exit. + (Bug #24621170) + + References: See also: Bug #23057045. +* The regular expression implementation in MySQL uses a + `String` object—intended to be + initialized as empty—to hold the current subject, and used + the literal `""` for this value. This could + interfere with other functions that do likewise. This is fixed + by constructing the `String` with a + `nullptr` instead. + (Bug #23276471) +* **mysqlpump** could leak memory or exit when + errors occurred. + (Bug #23102944) +* LDML 2.8 collation definitions could cause unexpected server + behavior. + (Bug #22819030) +* Log-opening operations accessed log-name system variables + without holding a lock on them. Multiple threads accessing such + a variable could lead to a race condition and unexpected server + behavior. + (Bug #22591899) +* When the range optimizer computed the prefix for a string of + sufficient length, it was possible for it to truncate the string + in the middle of a character, which could lead to assertion and + other failures in debug builds. Now steps are taken in such + cases to make sure that the string is truncated at a character + boundary. + (Bug #22475473, Bug #13712655) +* Queries having subqueries or expressions in the `GROUP + BY` clause could in some situations return random + results, due to reading of uninitialized data. + (Bug #20035304) + + References: See also: Bug #21922202. +* Queries having subqueries or expressions in a `GROUP + BY` clause sometimes returned random results due to + reading of uninitialized data. + (Bug #20035304) + + References: See also: Bug #21922202. +* The `audit_log` plugin did not log placeholder + values for prepared statements. + (Bug #16617026) +* `ALTER TABLE ... RENAME` operations could lose + foreign keys defined on the table if executed using the + `COPY` algorithm. + (Bug #11756183, Bug #48070) +* Integer columns in [`UNION`](/doc/refman/8.0/en/union.html) + statements could be cast to + [`BIGINT`](/doc/refman/8.0/en/integer-types.html) even if a smaller integer + type was more appropriate. + (Bug #11747567, Bug #33004) +* Added + [`ER_REGEXP_INVALID_CAPTURE_GROUP_NAME`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_regexp_invalid_capture_group_name) + (Error 13110). + (Bug #89796, Bug #27597980) +* Window function row-buffer handling has been refactored to + reduce the number of handler reads by 25%. + (Bug #89512, Bug #27484133) +* For some frames, the functions + [`VARIANCE()`](/doc/refman/8.0/en/aggregate-functions.html#function_variance), + [`VAR_POP()`](/doc/refman/8.0/en/aggregate-functions.html#function_var-pop), and + [`VAR_SAMP()`](/doc/refman/8.0/en/aggregate-functions.html#function_var-samp) produced wrong results + when evaluated with the + [`windowing_use_high_precision`](/doc/refman/8.0/en/server-system-variables.html#sysvar_windowing_use_high_precision) + system variable set to `false`. + (Bug #89390, Bug #27438725) +* Generated columns with a prefix index were not considered when + the optimizer attempted to substitute an expression with an + equivalent generated column. This prevented use of prefix + indexes to speed up queries with predicates employing a + generated column expression. + (Bug #89291, Bug #27403367) +* [`FIRST_VALUE()`](/doc/refman/8.0/en/window-function-descriptions.html#function_first-value) did not always + return `NULL` for an empty frame. + (Bug #89116, Bug #27348276) +* Regular expression functions accepting optional arguments did + not return `NULL` as expected when one or more + of these arguments was passed as an explicit + `NULL`. + (Bug #88872, Bug #27252630) +* Row-based replication used the wrong set of indexes on the + slave. + (Bug #88847, Bug #27244826) +* When executed with no default database having been chosen, + [`EXPLAIN + EXTENDED`](/doc/refman/8.0/en/explain.html) raised Error 1046 No database + selected instead of the SQL syntax error expected + due to the fact that the `EXTENDED` keyword has + been removed. + (Bug #88591, Bug #27153116) +* The CMake option `OPTIMIZER_TRACE=0` had no + effect on builds and so is no longer used. + (Bug #88520, Bug #27130109) +* A [`SELECT`](/doc/refman/8.0/en/select.html) statement using + `GROUP BY` with no constant or aggregate column + failed a check for functional dependencies, correctly, on the + first attempt but succeeded, wrongly, on the next. + (Bug #88474, Bug #27427677) + + References: See also: Bug #21807579. +* A [`CREATE + TABLE ... SELECT`](/doc/refman/8.0/en/create-table-select.html) statement with a + `UNION` in the + [`SELECT`](/doc/refman/8.0/en/select.html) failed in strict mode for + a [`DATE`](/doc/refman/8.0/en/datetime.html) column declared as + `NOT NULL`. + (Bug #87711, Bug #27068222) +* Prepared statements using nested sub-selects were not always + handled correctly. + (Bug #87484, Bug #26657904) +* The cost estimates for a query containing window functions did + not take into account the cost of `PARTITION + BY` or `ORDER BY`, nor did they + include the cost of using the frame buffer. + (Bug #87373, Bug #26612356) + + References: See also: Bug #26502118. +* When processing a query with a subquery, the subquery is no + longer optimized if outer query is known to produce an empty + result; in such cases, [`EXPLAIN`](/doc/refman/8.0/en/explain.html) + now shows `Not optimized, outer query is + empty`. + + This change is made because, when the table used by the outer + query is found empty at optimization, this sets the join column + to `NULL` even when defined as not nullable, + which leads to a conflict when optimizing the subquery. + + An exception is made if the outer query has aggregates without + any `GROUP BY`; this means that it has a + non-empty result, and that any subquery in the + [`SELECT`](/doc/refman/8.0/en/select.html) list must be evaluated and + optimized, which reopens the nullability issue, which is now + handled correctly for such cases. + (Bug #83115, Bug #24713879) + + References: See also: Bug #83216, Bug #24760317. +* When selecting from all columns making up a unique key + containing nullable columns, with all columns in the + `WHERE` condition set to non-null values, MySQL + did not take into account their uniqueness, with the result that + `only_full_group_by` missed detecting a + functionally dependent column. + (Bug #79291, Bug #22279903) +* When using a partial index, the optimizer performed a more + expensive table lookup instead of using the index, even when the + partial index covered the entire set of data needed. + (Bug #74359, Bug #19806106) diff --git a/corpus/changelog/mysql_releases/mysql_8012.md b/corpus/changelog/mysql_releases/mysql_8012.md new file mode 100644 index 0000000000000000000000000000000000000000..5a61b9fb70c52206880baa03b745ca35583c3736 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8012.md @@ -0,0 +1,1374 @@ +# MySQL 8.0.12 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-12.html +Version: 8.0.12 + +## Changes in MySQL 8.0.12 (2018-07-27, General Availability) + +For general information about upgrades, downgrades, platform support, etc., please visit [https://dev.mysql.com/doc/relnotes/mysql/8.0/en/](/doc/relnotes/mysql/8.0/en/). + +* [Audit Log Notes](news-8-0-12.html#mysqld-8-0-12-audit-log "Audit Log Notes") +* [Compilation Notes](news-8-0-12.html#mysqld-8-0-12-compiling "Compilation Notes") +* [Configuration Notes](news-8-0-12.html#mysqld-8-0-12-configuration "Configuration Notes") +* [Data Dictionary Notes](news-8-0-12.html#mysqld-8-0-12-data-dictionary "Data Dictionary Notes") +* [Deprecation and Removal Notes](news-8-0-12.html#mysqld-8-0-12-deprecation-removal "Deprecation and Removal Notes") +* [Firewall Notes](news-8-0-12.html#mysqld-8-0-12-firewall "Firewall Notes") +* [SQL Function and Operator Notes](news-8-0-12.html#mysqld-8-0-12-functions-operators "SQL Function and Operator Notes") +* [Logging Notes](news-8-0-12.html#mysqld-8-0-12-logging "Logging Notes") +* [Optimizer Notes](news-8-0-12.html#mysqld-8-0-12-optimizer "Optimizer Notes") +* [Packaging Notes](news-8-0-12.html#mysqld-8-0-12-packaging "Packaging Notes") +* [Plugin Notes](news-8-0-12.html#mysqld-8-0-12-plugins "Plugin Notes") +* [Security Notes](news-8-0-12.html#mysqld-8-0-12-security "Security Notes") +* [Spatial Data Support](news-8-0-12.html#mysqld-8-0-12-spatial-support "Spatial Data Support") +* [SQL Syntax Notes](news-8-0-12.html#mysqld-8-0-12-sql-syntax "SQL Syntax Notes") +* [X Plugin Notes](news-8-0-12.html#mysqld-8-0-12-xplugin "X Plugin Notes") +* [Functionality Added or Changed](news-8-0-12.html#mysqld-8-0-12-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-12.html#mysqld-8-0-12-bug "Bugs Fixed") + +### Audit Log Notes + +* For new MySQL installations, the `USER` and + `HOST` columns in the + `audit_log_user` table used by MySQL Enterprise Audit now + have definitions that better correspond to the definitions of + the `User` and `Host` columns + in the `mysql.user` system table. + + For upgrades to an installation for which MySQL Enterprise Audit is already + installed, it is recommended that you alter the table + definitions as follows: + + ```None + ALTER TABLE mysql.audit_log_user + DROP FOREIGN KEY audit_log_user_ibfk_1; + ALTER TABLE mysql.audit_log_filter + CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_as_ci; + ALTER TABLE mysql.audit_log_user + CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_as_ci; + ALTER TABLE mysql.audit_log_user + MODIFY COLUMN USER VARCHAR(32); + ALTER TABLE mysql.audit_log_user + ADD FOREIGN KEY (FILTERNAME) REFERENCES mysql.audit_log_filter(NAME); + ``` + + (Bug #23706056) + +### Compilation Notes + +* **Microsoft Windows:** + For OpenSSL 1.1, the library names have changed for Windows. The + **CMake** configuration code now accounts for + this. Also, it is now possible on Windows to use + `-DWITHOUT_SERVER=1` to build 32-bit client + binaries. + (Bug #28170711, Bug #91223) +* The minimum version of the Boost library for server builds is + now 1.67.0. + (Bug #27866110) + +### Configuration Notes + +* The maximum value was increased from 256 to 1024 for these + Performance Schema system variables: + + ```None + performance_schema_max_cond_classes + performance_schema_max_file_classes + performance_schema_max_mutex_classes + performance_schema_max_rwlock_classes + performance_schema_max_socket_classes + performance_schema_max_stage_classes + performance_schema_max_thread_classes + ``` + + The default value was increased from 250 to 300 for this + Performance Schema system variable: + + ```None + performance_schema_max_mutex_classes + ``` + + (Bug #27647918) +* For `RelWithDebInfo` builds on Linux, + [`REPRODUCIBLE_BUILD`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_reproducible_build) now defaults to + `ON`. + (Bug #27483447) +* The default value for the + [`slave_pending_jobs_size_max`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_pending_jobs_size_max) + system variable has increased from 16M to 128M. On a + multi-threaded slave ( with + [`slave_parallel_workers > 0`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_parallel_workers)), + this value sets the maximum amount of memory that is made + available to slave worker queues holding events that have not + yet been applied. The potentially larger memory usage should be + taken into account when calculating the resources required to + deploy a multi-threaded slave. Masters and single-threaded + slaves are not affected by this setting. + + The new default is double the recently increased default value + specified by the + [`max_allowed_packet`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_allowed_packet) system + variable (now 64M). The value of + [`slave_pending_jobs_size_max`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_pending_jobs_size_max) is + a soft limit, so events larger than its value (consisting of one + or more packets) can be queued and processed. However, a large + transaction is held until all the slave workers have empty + queues, and then processed. All subsequent transactions are held + until the large transaction has been completed. The delay to + clear the queues of all the slave workers and the wait to queue + subsequent transactions can cause lag on the replication slave + and decreased concurrency of the slave workers. The value of + [`slave_pending_jobs_size_max`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_pending_jobs_size_max) + should therefore be set high enough to accommodate most expected + event sizes. + (WL #11348) + +### Data Dictionary Notes + +* The following data dictionary enhancements were introduced: + + + An internal method was added to protect against global read + locks. The method is called before storing, updating, or + dropping data dictionary objects. + + Assertion code was added to the data dictionary API to + protect against global read locks when storing, updating, or + dropping data dictionary objects. + + Protection is now implicitly acquired against backup locks + and global read locks when an exclusive metadata lock is + acquired by a storage engine. + + A cost model cache validity check is now performed before + releasing a cost model entry. + + A data dictionary API function was added for committing and + rolling back transactions, and for releasing transactional + meta data locks. + + (Bug #27937059) + +### Deprecation and Removal Notes + +* Explicit `ASC` or `DESC` + qualifiers for `GROUP BY` clauses are now + deprecated and will be removed in a future MySQL version. + (WL #11459) + +### Firewall Notes + +* The MySQL Enterprise Firewall `firewall_whitelist` table now + contains a primary key column named `ID`. + (Bug #27164826) + +### SQL Function and Operator Notes + +* The [`BIT_AND()`](/doc/refman/8.0/en/aggregate-functions.html#function_bit-and), + [`BIT_OR()`](/doc/refman/8.0/en/aggregate-functions.html#function_bit-or), and + [`BIT_XOR()`](/doc/refman/8.0/en/aggregate-functions.html#function_bit-xor) aggregate functions now + can be used as window functions, if an `OVER` + clause is present. See [Aggregate Function Descriptions](/doc/refman/8.0/en/aggregate-functions.html). + (WL #11573) + +### Logging Notes + +* Previously, successful assignments to the + [`dragnet.log_error_filter_rules`](/doc/refman/8.0/en/server-system-variables.html#sysvar_dragnet.log_error_filter_rules) + system variable resulted in a Note and a nonzero warning count. + To avoid generating a diagnostic for a successful operation, + this Note is no longer generated. Instead, the + [`dragnet.Status`](/doc/refman/8.0/en/server-status-variables.html#statvar_dragnet.Status) status variable + can be consulted to determine the result of the most recent + assignment to + [`dragnet.log_error_filter_rules`](/doc/refman/8.0/en/server-system-variables.html#sysvar_dragnet.log_error_filter_rules). + (Bug #27910708, Bug #90571) +* Previously, log components listed in the + [`log_error_services`](/doc/refman/8.0/en/server-system-variables.html#sysvar_log_error_services) system + variable had to be separated by semicolons. Components now can + be separated by commas. A given setting cannot use both + semicolon and comma separators. + (Bug #27788925, Bug #90268) + +### Optimizer Notes + +* The `filesort` algorithm (used by the optimizer + to satisfy an `ORDER BY` clause when no index + can be used) is now more memory efficient. The primary change is + that the optimizer allocates memory buffers incrementally as + needed, up to the size indicated by the + [`sort_buffer_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sort_buffer_size) system + variable, rather than allocating a fixed amount of + [`sort_buffer_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sort_buffer_size) bytes up + front. This enables users to set + [`sort_buffer_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sort_buffer_size) to larger + values to speed up larger sorts, without concern for excessive + memory use for small sorts. (This benefit may not occur for + multiple concurrent sorts on Windows, which has a weak + multithreaded `malloc`.) + + In addition, `filesort` is less pessimistic + with respect to worst-case scenarios. Previously, + `filesort` produced an error without starting + if merge operations or sort-key generation might fail. Now, + because the worst case is unlikely to occur in practice, + `filesort` produces an error only for actual + rather than prospective failures. + (WL #11590) +* Previously, extended [`EXPLAIN`](/doc/refman/8.0/en/explain.html) + output was produced only for + [`SELECT`](/doc/refman/8.0/en/select.html) statements. Extended + output is now produced for + [`INSERT`](/doc/refman/8.0/en/insert.html), + [`REPLACE`](/doc/refman/8.0/en/replace.html), + [`UPDATE`](/doc/refman/8.0/en/update.html), and + [`DELETE`](/doc/refman/8.0/en/delete.html) statements as well. (To + display extended output, use [`SHOW + WARNINGS`](/doc/refman/8.0/en/show-warnings.html) following + [`EXPLAIN`](/doc/refman/8.0/en/explain.html). See + [Extended EXPLAIN Output Format](/doc/refman/8.0/en/explain-extended.html).) + (WL #6033) + +### Packaging Notes + +* For Linux, the generic binary distribution compression algorithm + changed from Gzip to XZ; and the file extension changed from + .tar.gz to .tar.xz. + (Bug #28450941, Bug #91889) +* Docker disables NUMA-related operations by default, so the + **mysqld** included in Docker images now has NUMA + support disabled so that the error log does not fill with NUMA + warnings. + (Bug #28081363) +* RPM `.spec` files were updated to reflect the + removal of yaSSL and that OpenSSL is the default SSL library for + all builds. + (Bug #28025427) +* For generic Linux `.tar.gz` distributions, + the **mysqlxtest** client has been moved from the + server package to the test package. + (Bug #27744137) +* An RPM package for installing ARM 64-bit (aarch64) binaries of + MySQL Server on Oracle Linux 7 is now available in the MySQL Yum + Repository and for direct download. + + **Known Limitation for this ARM + release**: You must enable the Oracle Linux 7 Software + Collections Repository (ol7\_software\_collections) to install + this package, and must also adjust the libstdc++7 path. See + Yum's [Platform Specific Notes](/doc/refman/8.0/en/linux-installation-yum-repo.html#yum-install-platform-specifics) for + additional details. + +### Plugin Notes + +* Previously, the `Rewriter` query rewrite plugin + permitted rewriting only for + [`SELECT`](/doc/refman/8.0/en/select.html) statements. Rewritable + statements now include [`INSERT`](/doc/refman/8.0/en/insert.html), + [`REPLACE`](/doc/refman/8.0/en/replace.html), + [`UPDATE`](/doc/refman/8.0/en/update.html), and + [`DELETE`](/doc/refman/8.0/en/delete.html) as well. See + [The Rewriter Query Rewrite Plugin](/doc/refman/8.0/en/rewriter-query-rewrite-plugin.html). + (WL #8776) + +### Security Notes + +* The linked OpenSSL library for MySQL Server has been updated to + version 1.0.2o. Issues fixed in the new OpenSSL version are + described at + . + (Bug #28025379) + +### Spatial Data Support + +* **Incompatible Change:** + The new spatial functions + [`ST_Longitude()`](/doc/refman/8.0/en/gis-point-property-functions.html#function_st-longitude) and + [`ST_Latitude()`](/doc/refman/8.0/en/gis-point-property-functions.html#function_st-latitude) return the + longitude or latitude, respectively, of their + `Point` argument. If called with a second + argument, these functions use the argument to set the longitude + or latitude, respectively, of their `Point` + argument. + + In addition, the [`ST_X()`](/doc/refman/8.0/en/gis-point-property-functions.html#function_st-x) and + [`ST_Y()`](/doc/refman/8.0/en/gis-point-property-functions.html#function_st-y) functions now interpret + their `Point` argument according to its spatial + reference system definition (SRS): + + + [`ST_X()`](/doc/refman/8.0/en/gis-point-property-functions.html#function_st-x) returns the coordinate + value of the axis that appears first in the SRS definition, + and [`ST_Y()`](/doc/refman/8.0/en/gis-point-property-functions.html#function_st-y) returns the + coordinate value of the axis that appears second in the SRS + definition. + + If [`ST_X()`](/doc/refman/8.0/en/gis-point-property-functions.html#function_st-x) and + [`ST_Y()`](/doc/refman/8.0/en/gis-point-property-functions.html#function_st-y) are used to set the + longitude or latitude of a `Point` argument + that has a geographic SRS, the longitude or latitude value + must be in the proper range for the SRS, or an error occurs. + + Note + + If spatial data contains geometry values that now are + interpreted differently by + [`ST_X()`](/doc/refman/8.0/en/gis-point-property-functions.html#function_st-x) and + [`ST_Y()`](/doc/refman/8.0/en/gis-point-property-functions.html#function_st-y), existing queries using + these functions will return different results, compared to + previous MySQL versions. + + (Bug #27125600, Bug #88503, WL #11453) +* The EPSG data set containing spatial reference system data for + spatial calculations has been upgraded from version 9.2 to 9.3. + (Bug #27977721) +* Spatial functions that accept geometry arguments and previously + returned an + [`ER_LONGITUDE_OUT_OF_RANGE`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_longitude_out_of_range) or + [`ER_LATITUDE_OUT_OF_RANGE`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_latitude_out_of_range) error + for longitude or latitude values out of range now return + [`ER_GEOMETRY_PARAM_LONGITUDE_OUT_OF_RANGE`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_geometry_param_longitude_out_of_range) + or + [`ER_GEOMETRY_PARAM_LATITUDE_OUT_OF_RANGE`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_geometry_param_latitude_out_of_range) + instead. This does not apply to spatial functions that parse or + modify geometries: + `ST_xxxFromText()`, + `ST_xxxFromWKT()`, + `ST_xxxFromWKB()`, + `ST_GeomFromGeoJSON()`, + `ST_X()`, `ST_Y()`, + `ST_Longitude()`, and + `ST_Latitude()`. + (Bug #27892138) +* Previously, the parser recognized `USING RTREE` + in index specifications, but this could not be specified for any + storage engine. Now `USING RTREE` is permitted + for spatial index specifications. + (Bug #27836608) +* Indexes on geometry columns now must be spatial indexes. + Consequently, the `SPATIAL` keyword is optional + but implicit for creating an index on a spatial column. A + spatial index on a geometry column is not permitted for a + primary key or unique index. Also, `ASC` and + `DESC` are not permitted for spatial indexes. + (Bug #21087676, WL #11808) + +### SQL Syntax Notes + +* **Important Change:** + MySQL now allows a query having a `WITH ROLLUP` + modifier to use `DISTINCT`. See + [SELECT Statement](/doc/refman/8.0/en/select.html), for more information. + (Bug #87450, Bug #26640100, Bug #20671578, Bug #76229) +* **Important Change:** + MySQL now allows the use of `ORDER BY` with + grouping functions in [`SELECT`](/doc/refman/8.0/en/select.html). + statements. + (Bug #86312, Bug #27063525) +* **Important Change:** + MySQL now allows `ORDER BY` to be used in a + query having a `WITH ROLLUP` modifier. For more + information, see [SELECT Statement](/doc/refman/8.0/en/select.html). + (Bug #86311, Bug #26073513) + +### X Plugin Notes + +* Authentication errors returned from a MySQL 8.0.11 server to an + X Plugin client were marked as fatal, which caused the client to + stop attempting its automatic sequence of authentication + attempts using different methods. X Plugin now ignores fatal + authentication errors, and subsequent expected errors such as + write timeout errors, while the sequence of authentication + attempts is in progress. If none of the authentication methods + tried are successful, X Plugin now selects and returns the most + relevant error message received from the server, which is not + necessarily the last error message received. + (Bug #28135006) +* During the X Plugin automated authentication sequence, + connection attempts are made using different authentication + methods in a pre-set sequence. X Plugin checks before starting + the sequence whether the connection uses SSL or not, and does + not attempt connection with the `PLAIN` + authentication method if the connection is not encrypted. For + additional verification, a check and error were added so that + the `PLAIN` authentication method is disallowed + if attempted when the connection is not encrypted. + (Bug #27691189) +* In the event of an authentication failure, X Plugin always + returned the error code `ER_ACCESS_DENIED`, + with a custom X Protocol error message for the error situation. + The error codes that are received from the MySQL server for + authentication failures are now passed on to the client instead, + with the standard MySQL error messages that go with them. + (Bug #27675699) +* During the X Plugin automated authentication sequence, where + connection attempts are made using different authentication + methods in a pre-set sequence, the error returned after every + failed connection attempt was marked with the severity + `FATAL`. Now, the errors are marked as + `ERROR` while there are still other + authentication methods to be attempted, and only the final error + that results in disconnection is marked as + `FATAL`. + (Bug #27636947) +* The X Plugin code was being compiled twice with different + preprocessor definitions. + (Bug #27267054) +* A number of improvements were made to the handling of + authentication issues by X Plugin: + + + The X Plugin automated authentication sequence, where + connection attempts are made using different authentication + methods in a pre-set sequence, is now halted if an error + response indicates that the connection has been broken or + reads or writes are timing out. + + The automated authentication sequence is also now halted in + the event of any fatal error. + + The last significant error is now reported for an abandoned + authentication sequence, not just the last error that + occurred. + + A more specific error code and message are now reported if + authentication with the + `caching_sha2_password` authentication + plugin is attempted over an unsecure connection. + + (Bug #27257774) +* In some circumstances, a MySQL server with X Plugin loaded could + experience an unexpected halt during a shutdown process + initiated by a failed start or by the `RESTART` + command. The issue has now been fixed. + (Bug #25474793, Bug #27259783) + +### Functionality Added or Changed + +* **Important Change; Group Replication:** + [`group_replication_exit_state_action`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_exit_state_action) + determines how Group Replication behaves when a server instance + leaves the group involuntarily, such as when it is expelled from + the group due to an unstable network connection. When + `group_replication_exit_state_action` is + `ABORT_SERVER` (the default), the instance + shuts itself down; when its value is + `READ_ONLY`, the instance switches itself to + super read-only mode instead, and goes into the Group + Replication `ERROR` state. + (WL #11568) +* **InnoDB:** + `InnoDB` now supports + `ALGORITHM=INSTANT` for the following + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) operations: + + + Adding a column. This feature is referred to as + “Instant `ADD COLUMN`”. + + Adding or dropping a virtual column. + + Adding or dropping a column default value. + + Modifying the definition of an + [`ENUM`](/doc/refman/8.0/en/enum.html) or + [`SET`](/doc/refman/8.0/en/set.html) column. + + Changing the index type. + + Renaming a table. + + Operations that support `ALGORITHM=INSTANT` + only modify metadata in the data dictionary. No exclusive + metadata locks are taken on the table during preparation and + execution phases of the operation, and table data is unaffected, + making the operations instantaneous. If not specified + explicitly, `ALGORITHM=INSTANT` is used by + default by operations that support it. If + `ALGORITHM=INSTANT` is specified but not + supported, the operation fails immediately with an error. + + For more information about operations that support + `ALGORITHM=INSTANT`, see + [Online DDL Operations](/doc/refman/8.0/en/innodb-online-ddl-operations.html). + + Thanks to the Tencent Games DBA team for the contribution. + (Bug #28100103, Bug #91074, WL #11250) +* **InnoDB:** + Undo logging is now supported for small updates to large object + (LOB) data, which improves performance of LOB updates that are + 100 bytes in size or less. Previously, LOB updates were a + minimum of one LOB page in size, which is less than optimal for + updates that might only modify a few bytes. This enhancement + builds upon support added in MySQL 8.0.4 for partial update of + LOB data. + (WL #11328) +* **Replication:** + You can now use a shell pipe to supply an archive of compressed + binary log files to **mysqlbinlog** as streamed + input. Previously, the files had to be extracted separately + before passing them to **mysqlbinlog**. Thanks to + the Facebook team for this contribution. + + In this example, `binlog-files_1.gz` contains + multiple binary log files for processing. The pipeline extracts + the contents of `binlog-files_1.gz`, pipes the + binary log files to **mysqlbinlog** as standard + input, and pipes the output of **mysqlbinlog** + into the `mysql` client for execution: + + ```None + gzip -cd binlog-files_1.gz | ./mysqlbinlog - | ./mysql -uroot -p + ``` + + (Bug #27445278, Bug #89423) + + References: See also: Bug #27836543. +* **Replication:** + The [`SYSTEM_VARIABLES_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_system-variables-admin) and + [`PERSIST_RO_VARIABLES_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_persist-ro-variables-admin) + privileges have been added to the + `mysql.session` reserved account. + (Bug #89873, Bug #27621869) +* **Replication:** + Information about XCom's memory usage has been added to the + Performance Schema tables. The + [`setup_instruments`](/doc/refman/8.0/en/performance-schema-setup-instruments-table.html) table now has an + entry corresponding to the XCom cache, and the + [`memory_summary_global_by_event_name`](/doc/refman/8.0/en/performance-schema-memory-summary-tables.html) + table contains the memory usage statistics of the XCom cache. + (WL #9855) +* **Microsoft Windows:** + On Windows, the forking used to implement + [`RESTART`](/doc/refman/8.0/en/restart.html) was suppressible using + the [`--gdb`](/doc/refman/8.0/en/server-options.html#option_mysqld_gdb) option. However, this + was a side effect, performed in addition to the other option + actions done to set up a debugging environment. In non-debug + settings, the new [`--no-monitor`](/doc/refman/8.0/en/server-options.html#option_mysqld_no-monitor) + option may be used for the sole purpose of suppressing forking + the monitor process. For a server started with either + `--gdb` or `--no-monitor`, + executing [`RESTART`](/doc/refman/8.0/en/restart.html) causes the + server to simply exit without restarting. + (Bug #27801043) +* Checking for foreign key relationships by + [`DROP TABLE`](/doc/refman/8.0/en/drop-table.html) and + [`DROP DATABASE`](/doc/refman/8.0/en/drop-database.html) was improved. The + check now takes place before any tables are deleted, so that in + the event of a problem the statement fails before making any + changes. Parent and child tables now can be dropped in arbitrary + order, as long as they are dropped by the same `DROP + TABLE` statement. In addition, error reporting was + improved for attempts to drop a parent table without dropping a + child table. + (Bug #27821060, Bug #17564464, Bug #70531, Bug #22359539, Bug #79610) +* When support for roles was added, the `ADMIN` + keyword became a reserved keyword. `ADMIN` is + now once again a nonreserved keyword. + (Bug #27814204) +* When a client shuts down the server, the server now writes a + message to the error log indicating which user performed this + action. + (Bug #26246628, Bug #86635) +* Previously, for the + [`--ssl-mode=VERIFY_IDENTITY`](/doc/refman/8.0/en/connection-options.html#option_general_ssl-mode) + option, the client checked whether the host name that it used + for connecting matched the Common Name value in the certificate + but not the Subject Alternative Name value. Now, if the client + uses OpenSSL 1.0.2 or higher, the client checks whether the host + name matches either the Subject Alternative Name value or the + Common Name value in the server certificate. Thanks to Daniël + van Eeden for a patch on which this change was based. + (Bug #16211011, Bug #68052, Bug #27511233, Bug #89578) + +### Bugs Fixed + +* **Important Change; JSON:** + The [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table) function now + automatically decodes base-64 values and prints them using the + character set given by the column specification. + (Bug #90157, Bug #27729112) + + References: See also: Bug #89847, Bug #27613276. +* **InnoDB:** + New columns added to + `INFORMATION_SCHEMA.INNODB_TABLES` and + `INFORMATION_SCHEMA.INNODB_COLUMNS` tables in + 8.0.12 did not appear after upgrading to 8.0.12. + (Bug #28065244) +* **InnoDB:** + Large object (LOB) version numbers stored in LOB index entries + were left uninitialized at 0 instead of initialized at 1. + (Bug #28046298) +* **InnoDB:** + Adding a column to a table with a generated column raised an + invalid assertion. + (Bug #28040201) +* **InnoDB:** + An attempt to access freed memory during a checkpoint operation + caused the server to exit. + (Bug #28039477) +* **InnoDB:** + An assertion failure occurred when starting the server with + experimental system variables that were unintentionally exposed + in normal MySQL builds. + (Bug #27899424, Bug #90526, Bug #27898396, Bug #90523, Bug #27898344, Bug #90522) +* **InnoDB:** + An invalid system variable setting raised an assertion. + (Bug #27898284) +* **InnoDB:** + Attempting to move a table from a discarded file-per-table + tablespace to a shared tablespace raised an assertion. The + operation now produces an error instead. + (Bug #27861972) +* **InnoDB:** + Potential failures related to page allocation for large objects + (LOBs) were not sufficiently handled. + (Bug #27852003) +* **InnoDB:** + The ngram full-text search parser permitted comma and period + characters to be tokenized as words, which caused an + inconsistency between boolean and natural language mode search + results. Comma and period characters are no longer tokenized. + (Bug #27847697) +* **InnoDB:** + Checksum mismatches and other issues were caused by concurrent + modification of a tablespace header page, and attempting to + place a lock on a partially initialized page. + (Bug #27823064) +* **InnoDB:** + An I/O error returned by an `fsync()` operation + is now treated as a hard error. + (Bug #27805553, Bug #90296) +* **InnoDB:** + In a single thread, two minitransactions latched the first page + of a large object value (LOB) while another thread attempted to + allocate the page, causing a deadlock. + (Bug #27777959) +* **InnoDB:** + After upgrading to MySQL 8.0.12, table columns including the + FTS\_DOC\_ID column were missing from the + `INFORMATION_SCHEMA.INNODB_COLUMNS` table. + (Bug #27774145) +* **InnoDB:** + An invalid assertion was raised when the optimizer chose a + prefix index defined on a virtual column. + (Bug #27755892) + + References: This issue is a regression of: Bug #19806106. +* **InnoDB:** + An in-memory table object for a table being truncated could be + opened under improper metadata locking protection. + + A new method of preserving the `AUTOINC` + counter value during a + [`TRUNCATE + PARTITION`](/doc/refman/8.0/en/alter-table.html) operation was implemented. + (Bug #27754995) +* **InnoDB:** + An assertion was raised during a mini-transaction commit that + included dirty pages but no redo log records. The + mini-transaction did not wait for space in the recently-closed + buffer and subsequently marked the page with an invalid current + LSN value. After the invalid LSN value was added to the flush + list, a delayed mini-transaction added dirty pages with an + earlier LSN value, breaking the flush list order. + + The + [`innodb_log_checkpoint_fuzzy_now`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_log_checkpoint_fuzzy_now) + debug option was added. Enabling this option forces + `InnoDB` to write a fuzzy checkpoint. Also, new + internal redo log module counters were added for tracking LSN + values. The `log_lsn_buf_dirty_pages_added` + counter tracks the LSN value up to which dirty pages have been + added, and the `log_lsn_buf_pool_oldest_lwm` + counter tracks the low watermark LSN for the oldest modified + block in the buffer pool. + (Bug #27664539) +* **InnoDB:** + The Contention-Aware Transaction Scheduling algorithm (CATS) + tracks the number of transactions waiting for another + transaction. In the case of a deadlock, the method by which the + number of waiting transactions is approximated produced inflated + values. + (Bug #27646322) +* **InnoDB:** + Attempting to acquire an `InnoDB` ticket while + holding a victim transaction lock caused a lock order violation. + (Bug #27626681) + + References: This issue is a regression of: Bug #23476050. +* **InnoDB:** + An attempt to read a zero-length BLOB value raised an assertion + failure during recovery. The BLOB value was not yet completely + inserted. + (Bug #27617389) +* **InnoDB:** + A race condition occurred when acquiring a table lock for a + table that was already in memory. + (Bug #27586419, Bug #27577704) + + References: This issue is a regression of: Bug #26848711. +* **InnoDB:** + After restarting the server, attempting to create an encrypted + table returned a generic error from the storage engine. + (Bug #27577339) +* **InnoDB:** + The use of Contention-Aware Transaction Scheduling (CATS) with a + spatial index caused a transaction to wait indefinitely. + (Bug #27572937) +* **InnoDB:** + Incorrect parsing of a tablespace name that included multibyte + characters caused a [`DROP DATABASE`](/doc/refman/8.0/en/drop-database.html) + operation to fail. + (Bug #27566937) +* **InnoDB:** + A check performed to identify temporary tables caused an error + when the data dictionary attempted to open a partitioned table. + (Bug #27565997) +* **InnoDB:** + A schema mismatch error reported during an import tablespace + operation failed to print mismatched table flags in a readable + format. + (Bug #27542720) +* **InnoDB:** + A DDL operation failed to wait for a `FULLTEXT` + index optimization operation to finish. + (Bug #27326796) + + References: This issue is a regression of: Bug #24938374. +* **InnoDB:** + An unnecessary check for read-only transactions was removed from + the `trx_set_rw_mode()` function. Thanks to + Sandeep Sethia for the patch. + (Bug #27211287, Bug #88739) +* **InnoDB:** + A DDL operation that added a foreign key constraint raised an + assertion when it accessed a stale memory object that belonged + to the parent table. + (Bug #27208858) +* **InnoDB:** + A failing assertion occurred after initiating a + **memcached** get operation. + (Bug #26876594) +* **InnoDB:** + A corrupt index ID encountered during a foreign key check raised + an assertion. + (Bug #26654685) +* **InnoDB:** + A [`DROP TABLE`](/doc/refman/8.0/en/drop-table.html) operation on a table + residing in a general tablespace raised an assertion when + checking index status in the post-DDL phase of the operation. + (Bug #26523254) +* **InnoDB:** + An internal deadlock during a DDL operation resulted in a long + semaphore wait followed by a server exit. + (Bug #26225783) +* **InnoDB:** + A DDL operation encountered a serious error due to an invalid + lock upgrade. + (Bug #26225783) +* **InnoDB:** + On a Windows 64-bit system, invalid buffer pool configuration + values caused the server to exit on startup. + (Bug #26100239, Bug #86370) +* **InnoDB:** + A debug code block related to mutex type definitions was + removed. It no longer differed from the non-debug version of the + code block. + (Bug #24952279, Bug #83529) +* **InnoDB:** + A server failure during recovery occurred due to a log parsing + buffer overflow. Space is now allocated to the log parsing + buffer dynamically and incremented as necessary until it reaches + the size specified by + [`innodb_log_buffer_size`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_log_buffer_size). + (Bug #24734190) +* **InnoDB:** + Table locking was optimized for concurrent updates on the same + table by avoiding costly iterations over the table locks queue. + + Thanks to Zhai Weixiang for the contribution. + (Bug #18955152, Bug #72948) +* **Packaging:** + On Windows, the **mysqld.exe --help** command + displayed unnecessary and unexpected details in the system + output, which this fix eliminates. + (Bug #27894020) +* **Partitioning:** + Rollback of + [`ALTER + TABLE ... TRUNCATE PARTITION`](/doc/refman/8.0/en/alter-table-partition-operations.html) statements was not + handled correctly. + (Bug #27603025) + + References: See also: Bug #87562, Bug #26710839. +* **Partitioning:** + For a partitioned table, partition update time could be + incorrect after rebuilding the table or restarting the server. + (Bug #27073100) +* **Replication:** + If the option + [`--skip-log-bin`](/doc/refman/8.0/en/replication-options-binary-log.html#option_mysqld_log-bin) + was specified at server startup to disable binary logging, no + warning message was issued if both + [`expire_logs_days`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_expire_logs_days) and + [`binlog_expire_logs_seconds`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_expire_logs_seconds) were + set to a nonzero value. The + [`--skip-log-bin`](/doc/refman/8.0/en/replication-options-binary-log.html#option_mysqld_log-bin) + option meant there were no binary log files to expire, so the + outcome of these binary log expiration period settings (which is + that the [`expire_logs_days`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_expire_logs_days) value + is ignored) had no practical effect. However, the warning + message is now issued, so that the situation can be corrected + before binary logging is enabled for the server. + (Bug #27699608) +* **Replication:** + The log messages generated when a member fails to join the group + have been improved, for example when + [`group_replication_group_name`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_group_name) on + the member joining the group does not match the seed's + [`group_replication_group_name`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_group_name) + this is now described in the log message. + (Bug #27628695) +* **Replication:** + If a MySQL server is started in crash recovery mode with an + [`innodb_force_recovery`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_force_recovery) setting + of 4 or greater, which places `InnoDB` into + read-only mode, the semisynchronous replication master plugin + should not be initialized. Due to a change in plugin + initialization order in MySQL 8.0, the server assumed that if + the plugin was registered, it had also been initialized, and + incorrectly attempted to deinitialize it. The handling of this + plugin in crash recovery mode has now been corrected so that the + deinitialization function is not executed when the plugin has + not been initialized. + (Bug #27481872) +* **Replication:** + The use of replication filters or binary log filters can cause + issues when they are applied to tables that are updated with XA + transactions. Filtering of tables could cause an XA transaction + to be empty on a replication slave, and empty XA transactions + are not supported. Also, with the settings + [`master_info_repository=TABLE`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_master_info_repository) + and + [`relay_log_info_repository=TABLE`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_relay_log_info_repository) + on a replication slave, which became the defaults in MySQL 8.0, + the internal state of the data engine transaction is changed + following a filtered XA transaction, and can become inconsistent + with the replication transaction context state. + + Due to these issues, the use of replication filters or binary + log filters in combination with XA transactions is not + supported. This fix adds the new error + [`ER_XA_REPLICATION_FILTERS`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_xa_replication_filters), which + is logged whenever an XA transaction is impacted by a + replication filter, whether or not the transaction was empty as + a result. If the transaction is not empty, the replication slave + is able to continue running, but you should take steps to + discontinue the use of replication filters with XA transactions + in order to avoid potential issues. If the transaction is empty, + the replication slave stops. In that event, the replication + slave might be in an undetermined state in which the consistency + of the replication process might be compromised. In particular, + the `gtid_executed` set on a slave of the slave + might be inconsistent with that on the master. To resolve this + situation, isolate the master and stop all replication, then + check GTID consistency across the replication topology. Undo the + XA transaction that generated the error message, then restart + replication. + (Bug #27442477) +* **Replication:** + When **mysqlbinlog** was used to read a binary + log event larger than 128KB, the read failed because 128KB was + returned as the size, instead of the actual size. The issue has + now been fixed. Thanks to the Facebook team for the patch. + (Bug #27417084, Bug #89326) +* **Replication:** + When a transaction larger than the binary log transaction cache + size ([`binlog_cache_size`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_cache_size)) was + flushed to a temporary file during processing, and the flush + failed due to a lack of space in the temporary directory, the + flush error was not handled correctly. No message was written to + the error log, and the binary log cache was not cleared after + the transaction was rolled back. Now, in this situation, the + server takes an appropriate action based on the + [`binlog_error_action`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_error_action) setting + (shut down the server or halt logging), and writes a message to + the error log. When the transaction is rolled back, the server + checks for flush errors and clears the binary log cache if any + occurred. + (Bug #27399620, Bug #89272) +* **Replication:** + When GTIDs are in use for replication, replicated transactions + that are filtered out on the slave are persisted. If binary + logging is enabled on the slave, the filtered-out transaction is + written to the binary log as a `Gtid_log_event` + followed by an empty transaction containing only + [`BEGIN`](/doc/refman/8.0/en/begin-end.html) and + [`COMMIT`](/doc/refman/8.0/en/commit.html) statements. If binary + logging is disabled, the GTID of the filtered-out transaction is + written to the `mysql.gtid_executed` table. + This process ensures that there are no gaps in the set of + executed GTIDs, and that the filtered-out transactions are not + retrieved again if the slave reconnects to the master. + Previously, this process was not done for + [`CREATE DATABASE`](/doc/refman/8.0/en/create-database.html), + [`ALTER DATABASE`](/doc/refman/8.0/en/alter-database.html), and + [`DROP DATABASE`](/doc/refman/8.0/en/drop-database.html) statements, but it + is now carried out for those statements as well as for others. + (Bug #27308751, Bug #88891) +* **Replication:** + On a multithreaded slave, when a [`STOP + SLAVE`](/doc/refman/8.0/en/stop-slave.html) statement is executed on the slave, followed by + a [`START SLAVE`](/doc/refman/8.0/en/start-slave.html) statement, the + error log can report a different position in the binary log for + the slave SQL thread when exiting, compared to the position + reported for the slave SQL thread at the subsequent + initialization. + + For a multithreaded slave, the position reported for the SQL + thread on exit is a low water mark, up to which the replication + stream is consistent and has no gaps. Transactions appearing + before the position are guaranteed to have committed, but + transactions after the position may have committed or not. + However, this low water mark was being reported before the + process to stop the worker threads was actually carried out, and + the low water mark was subsequently updated by a checkpoint + routine during that process. The timing of the log message has + now been changed so that the final low water mark is reported as + the position for the SQL thread on exit. + (Bug #27300658) +* **Replication:** + An online upgrade of a replication group that was running a + version of MySQL earlier than 5.7.23 was not possible. When a + member running a version earlier than either MySQL 5.7.22 or + MySQL 8.0.11 tried to join a group with members running MySQL + 5.7.21 or earlier, it failed to join the group because MySQL + 5.7.21 does not send the value of it + [`lower_case_table_names`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names) system + variable. This mean that the later version compared the + [`lower_case_table_names`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names) variable + with an invalid value and exited the group. The work around is + to take the group offline, upgrade to version 5.7.23 or 8.0.12 + and later. Subsequent upgrades of the group can then be carried + out without taking the group offline. See + [Upgrading Group Replication](/doc/refman/8.0/en/group-replication-upgrade.html). + (Bug #90794, Bug #27991334) +* **Replication:** + It was possible to change the value of + [`gtid_purged`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_purged) while running the + Group Replication plugin, even though this variable should never + be modified in such cases. + (Bug #90146, Bug #27724561) +* **Replication:** + The `PIT_TRANSACTIONS_NEGATIVE_CERTIFIED`, the + `PIT_TRANSACTIONS_ROWS_VALIDATING` and the + `PIT_TRANSACTIONS_LOCAL_ROLLBACK` member + messages were not being correctly decoded. + (Bug #90077, Bug #27692831) +* **Replication:** + In certain situations, such as during distributed recovery + procedure, the certification info garbage collection was purging + more data than it should, resulting in conflicts not being + detected. The garbage collection procedure has been improved to + take this case in consideration. + (Bug #89938, Bug #27652526) +* **Replication:** + The + `ER_GRP_RPL_SQL_SERVICE_FAILED_TO_RUN_SQL_QUERY` + error was being logged incorrectly. + (Bug #89788, Bug #27590534) +* **Replication:** + Using + [`group_replication_force_members`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_force_members) + to unblock a group, for example after losing majority, sometimes + failed with error 1231. + (Bug #86957, Bug #26394418) +* **Group Replication:** + When the `group_replication_applier` channel's + applier thread encountered an error, the + `master_log_name` and + `end_log_pos` values shown in the resulting + error message were incorrect, since the events in a transaction + are replicated before they are written to the binary log of the + member where the transaction originated, with the result that + the final values are unknown at the time they are applied on the + replica by the applier thread. To avoid confusion, any such + error messages encountered by a + `group_replication_applier` channel no longer + contain the binary log name or position. + (Bug #89146, Bug #27368735) +* **macOS:** + On macOS, the server autostarted at system boot time even when + set not to in the MySQL preference pane. + (Bug #27969174, Bug #90672) +* **Microsoft Windows:** + For debug builds on Windows, [`CREATE SPATIAL + REFERENCE SYSTEM`](/doc/refman/8.0/en/create-spatial-reference-system.html) with an empty definition string could + raise assertions. + (Bug #27672683) +* In the client library, signals were incorrectly unblocked for + `ppoll()`. Thanks to Facebook for the patch. + (Bug #28075623, Bug #90999, Bug #28096808, Bug #91067) +* Certain [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) statements + could disable table encryption. + (Bug #28045585) + + References: This issue is a regression of: Bug #27389878. +* Under some conditions, `MyISAM` code + compilation failed due to a missing include file. + (Bug #28039150, Bug #90898) +* The [`REGEXP_REPLACE()`](/doc/refman/8.0/en/regexp.html#function_regexp-replace) function + truncated its result when used in an + [`UPDATE`](/doc/refman/8.0/en/update.html) statement. + (Bug #28027093, Bug #90870) +* [`REGEXP_REPLACE()`](/doc/refman/8.0/en/regexp.html#function_regexp-replace) results from one + result set row could carry forward to the next row, resulting in + accumulation of previous results in the current row. + (Bug #27992118, Bug #90803) +* A heap overflow vulnerability in the MySQL client library was + fixed. + (Bug #27980823) +* Users who had the [`SUPER`](/doc/refman/8.0/en/privileges-provided.html#priv_super) privilege + were not permitted to modify the + [`keyring_operations`](/doc/refman/8.0/en/keyring-system-variables.html#sysvar_keyring_operations) system + variable. + (Bug #27976270) +* Full-text search auxiliary tables created in MySQL 5.7 and MySQL + 8.0.11 with timestamps of 0 caused a data dictionary upgrade + failure when upgrading from MySQL 8.0.11 to MySQL 8.0.12. + (Bug #27960500) +* A “source and destination overlap in memcpy” + Valgrind error was returned when upgrading from MySQL 5.7. + (Bug #27945658, Bug #90691) +* Linux binaries were unable to dump core after executing a + `setuid()` call. + (Bug #27929894, Bug #90642, Bug #23337428, Bug #21723) +* [`RESET PERSIST`](/doc/refman/8.0/en/reset.html) + did not flush variable values from memory. + (Bug #27924206) +* For debug builds, using `CREATE TABLE ... + SELECT` to create a table with a long numeric string + and indexing the column could lead to an assertion being raised. + (Bug #27909771) +* For debug builds, [`RESET PERSIST`](/doc/refman/8.0/en/reset-persist.html) + for an unknown variable could cause an assertion to be raised. + (Bug #27903874, Bug #90546) + + References: This issue is a regression of: Bug #27374791. +* Updates to column metadata of a view referencing a partitioned + table could cause a server exit. + (Bug #27903842) +* For debug builds, an assertion could be raised for + [`UNION`](/doc/refman/8.0/en/union.html) queries when computing the + combined data type of a `GEOMETRY` column and + `SELECT * FROM (SELECT NULL)`. + (Bug #27903792, Bug #90550) +* For debug builds, starting the server with + [`thread_stack=0`](/doc/refman/8.0/en/server-system-variables.html#sysvar_thread_stack) and executing + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) could raise an + assertion. + (Bug #27899274, Bug #90525) +* [`SHOW TABLE STATUS`](/doc/refman/8.0/en/show-table-status.html) could cause a + server exit. + (Bug #27897815) +* For generated columns that used the + [`INTERVAL()`](/doc/refman/8.0/en/comparison-operators.html#function_interval) function, incorrect + behavior could occur. + (Bug #27881102) +* For Fedora 28, MySQL Community RPM packages would not install if + Connector ODBC native packages were installed. + (Bug #27850721) +* It was possible to drop the Performance Schema. + (Bug #27830283) +* A runtime error could occur for calls to + `mysql_sys_var_longlong()` or + `String::copy()`. + (Bug #27822413, Bug #27808412) +* An assertion was raised by error logging code that used an + inappropriate error number. + (Bug #27792903) + + References: This issue is a regression of: Bug #27462408. +* The `CONVERT TO CHARACTER SET + charset_name` clause for + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) produced a syntax + error if *`charset_name`* was + `DEFAULT`. + (Bug #27760787, Bug #90222) + + References: This issue is a regression of: Bug #27389878. +* An unencrypted connection could result from a client connection + attempt specifying that an encrypted connection was required, if + the server was not configured to support SSL. + (Bug #27759871) +* `INSERT INTO ... SELECT` did not perform as + many checks as `INSERT INTO ... VALUES()` with + respect to requiring valid geometry values for geometry columns. + (Bug #27756083) +* [`REGEXP_INSTR()`](/doc/refman/8.0/en/regexp.html#function_regexp-instr) did not return an + error message when used with invalid match mode flags. + (Bug #27751277) +* Some data dictionary table definitions were modified to align + more closely with their initial design. Additionally, the data + dictionary version number was incremented, and code that refers + to data dictionary table indexes now uses symbolic index names + instead of numeric values. + (Bug #27745526, Bug #90196) +* Executing a prepared statement to insert rows with large number + of parameters was very slow. + (Bug #27699248) +* **ibd2sdi** could exit due to performing a + divide-by-zero operation. + (Bug #27692051, Bug #90071) +* The `mysql-boost-8.0.4.tar.gz` source + distribution omitted `NDB` sources. + (Bug #27690232) +* [`SHOW GRANTS`](/doc/refman/8.0/en/show-grants.html) could cause a server + exit if executed for an unprivileged user who inherited + privileges from an anonymous user. + (Bug #27678129) +* The parser incorrectly permitted the index name for + [`CREATE INDEX`](/doc/refman/8.0/en/create-index.html) to be empty. + (Bug #27676427) +* Failures of server restarts initiated by systemd or + **mysqld\_safe** were not written to the error + log. + (Bug #27675050, Bug #90012) +* For debug builds, if a transaction was in read-only mode, trying + to create or drop a histogram could raise an assertion. + (Bug #27672693) +* If the server was started with + [`--skip-grant-tables`](/doc/refman/8.0/en/server-options.html#option_mysqld_skip-grant-tables), + [`SET ROLE + DEFAULT`](/doc/refman/8.0/en/set-role.html) caused a server exit. + (Bug #27672154) +* Casting of [`VARBINARY`](/doc/refman/8.0/en/binary-varbinary.html) values to + [`TIME`](/doc/refman/8.0/en/time.html) values was not performed + correctly. + (Bug #27665997) +* Error checking was not performed after creation of a condition + for a `const` reference. + (Bug #27665085) +* The dictionary information object managed by the MeCab model was + used after the MeCab model was released. + (Bug #27660368) +* Attempting to abort events of the + `MYSQL_AUDIT_AUTHENTICATION_CLASS` class caused + a server exit. These events are now not abortable. + (Bug #27645636) +* These resource-group statements are now disallowed in stored + functions because they cause an implicit commit, which is not + permitted in a stored function: [`CREATE + RESOURCE GROUP`](/doc/refman/8.0/en/create-resource-group.html), [`ALTER RESOURCE + GROUP`](/doc/refman/8.0/en/alter-resource-group.html), [`DROP RESOURCE + GROUP`](/doc/refman/8.0/en/drop-resource-group.html). + (Bug #27638623, Bug #89914) +* Audit log filter rules did not permit class names to be + specified as an array of strings. That is now possible. Example: + + ```None + { + "filter": { + "class": [ + { "name": [ "connection", "general", "table_access" ] } + ] + } + } + ``` + + (Bug #27628325) +* On Windows, if the Visual C++ Redistributable for Visual Studio + had been removed, MySQL uninstallation using the MSI installer + failed. + (Bug #27621546) +* **mysql\_secure\_installation** now loads the + `validate_password` component rather than the + deprecated `validate_password` plugin. + (Bug #27619667) +* [`REGEXP_LIKE()`](/doc/refman/8.0/en/regexp.html#function_regexp-like) using an expression + containing a question mark (`?`) was not + handled correctly when included in a prepared statement. + (Bug #27595368) +* [`REGEXP_SUBSTR()`](/doc/refman/8.0/en/regexp.html#function_regexp-substr) did not always + handle `NULL` patterns correctly. + (Bug #27572258) +* Some [`SHOW CREATE TABLE`](/doc/refman/8.0/en/show-create-table.html) statements + could raise an assertion. + (Bug #27569314) +* Spurious stages could be seen in the Performance Schema + [`events_stages_current`](/doc/refman/8.0/en/performance-schema-events-stages-current-table.html) table. + (Bug #27566220) +* Triggers for a table could execute in an order different from + that specified by their + `PRECEDES`/`FOLLOWS` clauses. + (Bug #27544152) +* Attempts to set some persisted variables at startup (such as + [`keyring_operations`](/doc/refman/8.0/en/keyring-system-variables.html#sysvar_keyring_operations) and + [`mandatory_roles`](/doc/refman/8.0/en/server-system-variables.html#sysvar_mandatory_roles)) produced a + privilege violation error and the server did not start or did + not set the variable. + (Bug #27523095) +* Under some conditions, an unused-variable warning occurred in + the MeCab full-text search code. Thanks to Laurynas Biveinis for + the patch. + (Bug #27519952, Bug #89598) +* Within stored procedures, it was not possible to write a + condition handler to catch foreign key failures if the table + involved used the `FEDERATED` storage engine. + (Bug #27509959) +* It was possible to drop a primary key that served as the parent + key in a foreign key relationship. In addition, for table + creation, the SQL layer now checks whether there is a parent key + for the foreign key and reports an error if it is missing. + (Bug #27506922, Bug #89570, Bug #11754696, Bug #46337) +* With the + [`NO_ENGINE_SUBSTITUTION`](/doc/refman/8.0/en/sql-mode.html#sqlmode_no_engine_substitution) SQL + mode disabled, an error (rather than substitution) occurred for + [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) and + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) if the desired engine + was disabled using the + [`disabled_storage_engines`](/doc/refman/8.0/en/server-system-variables.html#sysvar_disabled_storage_engines) system + variable. + (Bug #27502530) +* Key rotation using the `keyring_encrypted_file` + keyring plugin could cause a server exit. + (Bug #27497018) +* If MySQL Enterprise Firewall was configured with a large number of rules, server + shutdown could take a long time. + (Bug #27492122) +* [`SET PERSIST_ONLY + var_name = DEFAULT`](/doc/refman/8.0/en/set-variable.html) + persisted the current global value, not the default value. + (Bug #27489026) +* If MySQL is configured with the + [`LINK_RANDOMIZE`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_link_randomize) + **CMake** option enabled, the + `--gc-sections` compiler option is now disabled; + the combination causes segmentation faults. + (Bug #27484106) +* During server installation, the + `mysql.infoschema`, + `mysql.session`, and + `mysql.sys` reserved accounts were associated + with the `mysql_native_password` authentication + plugin even when the default plugin was + `caching_sha2_password`. + (Bug #27454299) +* Some window functions used the wrong precision for their + aggregated data types. + (Bug #27452179) +* For a hexadecimal value *`H`*, + [`SELECT`](/doc/refman/8.0/en/select.html) with `WHERE (-1) - + H` raised an assertion. + (Bug #27452082) + + References: See also: Bug #27041382. This issue is a regression of: Bug #21982792. +* A memory leak in the `pfs-t` unit test was + fixed. Thanks to Yura Sorokin for the patch. + (Bug #27440735, Bug #89384) +* Multiple invocations of [`CHAR()`](/doc/refman/8.0/en/string-functions.html#function_char) + within a stored program could yield different results once an + invalid code point was passed as the argument. + (Bug #27410088) +* With [`automatic_sp_privileges`](/doc/refman/8.0/en/server-system-variables.html#sysvar_automatic_sp_privileges) + enabled, the [`EXECUTE`](/doc/refman/8.0/en/privileges-provided.html#priv_execute) and + [`ALTER ROUTINE`](/doc/refman/8.0/en/privileges-provided.html#priv_alter-routine) privileges were not + correctly granted to routine creators. + (Bug #27407480) +* Some queries that used ordering could access an uninitialized + column during optimization and cause a server exit. + (Bug #27389294) +* For debug builds, an assertion was raised (rather than an error) + for [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) for an + `ARCHIVE` table with a `GEOMETRY NOT + NULL` column containing empty strings. + (Bug #27330634, Bug #89088) +* Accounts that authenticated with the + `auth_sock` authentication plugin could not + connect using older clients. + (Bug #27306178) +* If system tables could not be read or initialized, the server + wrote an incomplete error message. Thanks to Daniël van Eeden + for a patch related to the fix. + (Bug #27302337, Bug #89001) +* [`RENAME USER`](/doc/refman/8.0/en/rename-user.html) failed when used to + rename a role that was not granted to any account or role. + (Bug #27284699) +* The `keyring_okv` plugin did not always fail + over to the standby OKV server when the primary server was + unavailable. + (Bug #27244099) +* The Performance Schema could attempt to access invalid + `SOURCE` column values. + (Bug #27231036) +* Mishandling of internal privilege structures could cause a + server exit. + (Bug #27230925) +* For debug builds, use of a too-small type for calculating the + determinant in GIS computations could cause an assertion to be + raised. + (Bug #27135504) +* For attempts to increase the length of a + `VARCHAR` column of an + `InnoDB` table using [`ALTER + TABLE`](/doc/refman/8.0/en/alter-table.html) with the `INPLACE` algorithm, + the attempt failed if the column was indexed. + + If an index size exceeded the `InnoDB` limit of + 767 bytes for `COMPACT` or + `REDUNDANT` row format, + [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) and + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) did not report an + error (in strict SQL mode) or a warning (in nonstrict mode). + (Bug #26848813) +* In MySQL 5.7.19, the `mysql.gtid_executed` + table was excluded from dumps. This table is no longer excluded + but its data is not dumped. + (Bug #26643180, Bug #87455) + + References: This issue is a regression of: Bug #82848, Bug #24590891. +* The + [`slave_rows_search_algorithms`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_rows_search_algorithms) + system variable controls how rows are searched for matches when + preparing batches of rows for row-based logging and replication. + Specifying `INDEX_SCAN` as one of the search + algorithms performs an index scan if an index is present. In the + situation where a different primary key is used on the master + and the slave, and a unique key is present on the slave, a bug + in the code meant that the index scan was not being performed as + it should be, and a slower table scan was being performed + instead. The issue has now been corrected so that an index scan + is used. + (Bug #26450129, Bug #23311892, Bug #81500, Bug #81501) +* Certain cases of subquery materialization could cause a server + exit. These queries now produce an error suggesting that + materialization be disabled. + (Bug #26402045) +* Spatial operations on geographic + `GeometryCollection` values could return + [`ER_GIS_INVALID_DATA`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_gis_invalid_data) for valid + geometries. + (Bug #26174808) +* For `MyISAM` tables, particular sequences of + [`INSERT`](/doc/refman/8.0/en/insert.html) and + [`DELETE`](/doc/refman/8.0/en/delete.html) statements could cause + table corruption. + (Bug #25541037) +* The [`SHOW CREATE USER`](/doc/refman/8.0/en/show-create-user.html) statement + requires the [`SELECT`](/doc/refman/8.0/en/privileges-provided.html#priv_select) privilege for + the `mysql` database, except to see information + for the current user. In addition, for the current user, the + statement requires the [`SELECT`](/doc/refman/8.0/en/privileges-provided.html#priv_select) + privilege for the `mysql.user` system table for + display of the password hash in the `IDENTIFIED + AS` clause; otherwise, the hash displays as + ``. + (Bug #24911117) +* [`CREATE FUNCTION`](/doc/refman/8.0/en/create-function.html) produced an error + if there was no default database and the function body called + another function. + (Bug #24357244, Bug #82350) +* For debug builds, a [`SELECT`](/doc/refman/8.0/en/select.html) + statement executed within a stored program could raise an + assertion if derived table resolution failed. + (Bug #23221336) +* If **mysqldump** or **mysqlpump** + were used to dump binary data without the + [`--hex-blob`](/doc/refman/8.0/en/mysqldump.html#option_mysqldump_hex-blob) option, reloading + the dump file could produce spurious warnings (values were + inserted correctly regardless of the warnings). Such values are + now written preceded by the `_binary` + introducer to silence the warnings. + (Bug #22601255, Bug #80150) +* String comparisons involving wildcards could reference + uninitialized memory. + (Bug #12635103) +* [`REGEXP_REPLACE()`](/doc/refman/8.0/en/regexp.html#function_regexp-replace) raised a + `Valgrind` warning when invoked with an invalid + capture group. + (Bug #87842, Bug #27612255) diff --git a/corpus/changelog/mysql_releases/mysql_8013.md b/corpus/changelog/mysql_releases/mysql_8013.md new file mode 100644 index 0000000000000000000000000000000000000000..049a21ddc57134db79c04e107ee71b1e27fa53b7 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8013.md @@ -0,0 +1,2027 @@ +# MySQL 8.0.13 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-13.html +Version: 8.0.13 + +## Changes in MySQL 8.0.13 (2018-10-22, General Availability) + +For general information about upgrades, downgrades, platform support, etc., please visit [https://dev.mysql.com/doc/relnotes/mysql/8.0/en/](/doc/relnotes/mysql/8.0/en/). + +* [Account Management Notes](news-8-0-13.html#mysqld-8-0-13-account-management "Account Management Notes") +* [Compilation Notes](news-8-0-13.html#mysqld-8-0-13-compiling "Compilation Notes") +* [Configuration Notes](news-8-0-13.html#mysqld-8-0-13-configuration "Configuration Notes") +* [Data Type Notes](news-8-0-13.html#mysqld-8-0-13-data-types "Data Type Notes") +* [Deprecation and Removal Notes](news-8-0-13.html#mysqld-8-0-13-deprecation-removal "Deprecation and Removal Notes") +* [Error Handling](news-8-0-13.html#mysqld-8-0-13-errors "Error Handling") +* [INFORMATION\_SCHEMA Notes](news-8-0-13.html#mysqld-8-0-13-information-schema "INFORMATION_SCHEMA Notes") +* [Logging Notes](news-8-0-13.html#mysqld-8-0-13-logging "Logging Notes") +* [Optimizer Notes](news-8-0-13.html#mysqld-8-0-13-optimizer "Optimizer Notes") +* [Packaging Notes](news-8-0-13.html#mysqld-8-0-13-packaging "Packaging Notes") +* [Performance Schema Notes](news-8-0-13.html#mysqld-8-0-13-performance-schema "Performance Schema Notes") +* [Pluggable Authentication](news-8-0-13.html#mysqld-8-0-13-pluggable-auth "Pluggable Authentication") +* [Plugin Notes](news-8-0-13.html#mysqld-8-0-13-plugins "Plugin Notes") +* [Security Notes](news-8-0-13.html#mysqld-8-0-13-security "Security Notes") +* [Spatial Data Support](news-8-0-13.html#mysqld-8-0-13-spatial-support "Spatial Data Support") +* [SQL Syntax Notes](news-8-0-13.html#mysqld-8-0-13-sql-syntax "SQL Syntax Notes") +* [XA Transaction Notes](news-8-0-13.html#mysqld-8-0-13-xa "XA Transaction Notes") +* [X Plugin Notes](news-8-0-13.html#mysqld-8-0-13-xplugin "X Plugin Notes") +* [Functionality Added or Changed](news-8-0-13.html#mysqld-8-0-13-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-13.html#mysqld-8-0-13-bug "Bugs Fixed") + +### Account Management Notes + +* It is now possible to require that attempts to change an account + password be verified by specifying the current password to be + replaced. This enables DBAs to prevent users from changing a + password without proving that they know the current password. It + is possible to establish password-verification policy globally + using the + [`password_require_current`](/doc/refman/8.0/en/server-system-variables.html#sysvar_password_require_current) system + variable, as well as on a per-account basis using the + `PASSWORD REQUIRE` option of the + [`CREATE USER`](/doc/refman/8.0/en/create-user.html) and + [`ALTER USER`](/doc/refman/8.0/en/alter-user.html) statements. Together + with existing password-management capabilities, the new + capability of requiring verification provides DBAs more complete + control over password management. For more information, see + [Password Management](/doc/refman/8.0/en/password-management.html). + + Important + + The implementation of password-verification capability + involves a change to the structure of the + `mysql.user` system table. If you upgrade to + this MySQL release from an earlier version, you must run + **mysql\_upgrade** (and restart the server) to + incorporate this system database change. Until this is done, + *password changes are not possible.* + + (WL #11544) + +### Compilation Notes + +* **Solaris:** + MySQL now can be compiled on Solaris using + **gcc**. + (Bug #27802681) + +### Configuration Notes + +* The new [`WITH_LTO`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_lto) + **CMake** option controls whether to enable + link-time optimization. Currently, this is supported only by GCC + 7 and 8. + (Bug #28184537, Bug #28211382) +* The new [`WITH_RAPIDJSON`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_rapidjson) + **CMake** option controls whether to compile with + the bundled or system RapidJSON library. + (Bug #28024992, Bug #90867) +* The [`CMAKE_BUILD_TYPE`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_cmake_build_type) + **CMake** option now supports a + `Release` build type, which is like the + `RelWithDebInfo` build type but omits debugging + information to reduce the build size. + (Bug #27874068, Bug #32287863) +* The new [`sql_require_primary_key`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_require_primary_key) + system variable makes it possible to have statements that create + new tables or alter the structure of existing tables enforce the + requirement that tables have a primary key. Enabling this + variable helps avoid performance problems in row-based + replication that can occur when tables have no primary key. + Suppose that a table has no primary key and an update or delete + modifies multiple rows. On the master server, this operation can + be performed using a single table scan but, when replicated + using row-based replication, results in a table scan for each + row to be modified on the slave. With a primary key, these table + scans do not occur. + (Bug #17468242, Bug #69845, Bug #17005592, Bug #69223, WL #11807) +* To enable the server to listen on a set of addresses, the + [`bind_address`](/doc/refman/8.0/en/server-system-variables.html#sysvar_bind_address) system variable + now permits a list of comma-separated IP addresses or host + names, not just a single address or name. For details, see + [Server System Variables](/doc/refman/8.0/en/server-system-variables.html). + (WL #11652) + +### Data Type Notes + +* MySQL now supports use of expressions as default values in data + type specifications. This includes the use of expressions as + default values for the [`BLOB`](/doc/refman/8.0/en/blob.html), + [`TEXT`](/doc/refman/8.0/en/blob.html), + `GEOMETRY`, and + [`JSON`](/doc/refman/8.0/en/json.html) data types, which previously + could not be assigned default values at all. For details, see + [Data Type Default Values](/doc/refman/8.0/en/data-type-defaults.html). + (WL #9418) + +### Deprecation and Removal Notes + +* **Important Change:** + Setting user variables in statements other than + [`SET`](/doc/refman/8.0/en/set-variable.html) is + now deprecated due to issues that included those listed here: + + + The order of evaluation for expressions involving user + variables was undefined. + + The default result type of a variable is based on its type + at the beginning of the statement, which could have + unintended effects when a variable holding a value of one + type at the beginning of a statement was assigned a new + value of a different type in the same statement. + + `HAVING`, `GROUP BY`, and + `ORDER BY` clauses, when referring to a + variable that was assigned a value in the select expression + list, did not work as expected because the expression was + evaluated on the client and so it was possible for stale + column values from a previous row to be used. + + Syntax such as `SELECT @var, @var:=@var+1` is + still accepted in MySQL 8.0 for backward compatibility, but is + subject to removal in a future MySQL version. + (WL #12131) +* **InnoDB; Partitioning:** + Support for placing table partitions in shared tablespaces was + removed. Shared tablespaces include the system tablespace and + general tablespaces. For information about identifying + partitions in shared tablespaces and moving them to + file-per-table tablespaces, see + [Preparing Your Installation for Upgrade](/doc/refman/8.0/en/upgrade-prerequisites.html). + (WL #11571, WL #9286) +* **InnoDB:** + Support for `TABLESPACE = + innodb_file_per_table` and `TABLESPACE = + innodb_temporary` clauses with + [`CREATE TEMPORARY + TABLE`](/doc/refman/8.0/en/create-table.html) is deprecated and will be removed in a future + MySQL version. + (WL #12179) +* The `utf8mb3` character set is deprecated and + will be removed in a future MySQL version. Please use + `utf8mb4` instead. + (WL #11109) +* Nested comments have never been supported (although they might + be permitted under some conditions), but now are considered + deprecated and will be removed in a future MySQL version. + (WL #12099) +* The deprecated `metadata_locks_cache_size` and + `metadata_locks_hash_instances` system + variables were removed. + (WL #12212) +* The `PAD_CHAR_TO_FULL_LENGTH` SQL mode has been + deprecated and will be removed in a future MySQL version. + (WL #12129) + +### Error Handling + +* The MySQL client library now returns better error messages for + OpenSSL errors. Thanks to Facebook for the patch. + (Bug #27855668, Bug #90418) +* Previously, the + [`ER_NO_REFERENCED_ROW_2`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_no_referenced_row_2) and + [`ER_ROW_IS_REFERENCED_2`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_row_is_referenced_2) error + messages for foreign key operations were displayed and revealed + information about parent tables, even when the user had no + parent table access privileges. Error handling for this + situation has been revised: + + + If the user does have table-level privileges for all parent + tables, + [`ER_NO_REFERENCED_ROW_2`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_no_referenced_row_2) and + [`ER_ROW_IS_REFERENCED_2`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_row_is_referenced_2) are + displayed, the same as before. + + If the user does not have table-level privileges for all + parent tables, more generic error messages are displayed + instead + ([`ER_NO_REFERENCED_ROW`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_no_referenced_row) and + [`ER_ROW_IS_REFERENCED`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_row_is_referenced)). + + An exception is that, for stored programs defined to execute + with `DEFINER` privileges, the user against + which privileges are assessed is the user in the program + `DEFINER` clause, not the invoking user. If + that user has table-level parent table privileges, parent table + information is still displayed. In this case, it is the + responsibility of the stored program creator to hide the + information by including appropriate condition handlers. + (Bug #19477611, WL #8910) + +### INFORMATION\_SCHEMA Notes + +* These new [`INFORMATION_SCHEMA`](/doc/refman/8.0/en/information-schema.html) tables + are available as views on data dictionary tables: + + + [`VIEW_ROUTINE_USAGE`](/doc/refman/8.0/en/information-schema-view-routine-usage-table.html) provides + information about stored functions used in view definitions. + + [`VIEW_TABLE_USAGE`](/doc/refman/8.0/en/information-schema-view-table-usage-table.html) provides + information about tables and views used in view definitions. + + For more information, see + [The INFORMATION\_SCHEMA VIEW\_ROUTINE\_USAGE Table](/doc/refman/8.0/en/information-schema-view-routine-usage-table.html), + and [The INFORMATION\_SCHEMA VIEW\_TABLE\_USAGE Table](/doc/refman/8.0/en/information-schema-view-table-usage-table.html). + (WL #11864) + +### Logging Notes + +* **Incompatible Change:** + The system variables have been removed that previously + configured error logging to the system log (the Event Log on + Windows, and `syslog` on Unix and Unix-like + systems). Where appropriate, the removed system variables were + replaced with new system variables managed by the + `log_sink_syseventlog` error log component. The + following table shows the old and new variable names. + + | Old System Variable | New System Variable | + | --- | --- | + | `log_syslog_facility` | [`syseventlog.facility`](/doc/refman/8.0/en/server-system-variables.html#sysvar_syseventlog.facility) | + | `log_syslog_include_pid` | [`syseventlog.include_pid`](/doc/refman/8.0/en/server-system-variables.html#sysvar_syseventlog.include_pid) | + | `log_syslog_tag` | [`syseventlog.tag`](/doc/refman/8.0/en/server-system-variables.html#sysvar_syseventlog.tag) | + | `log_syslog` | None | + + Important + + Installations that used the old system variable names must + update their configuration to use the new variable names. For + more information, see [Error Logging to the System Log](/doc/refman/8.0/en/error-log-syslog.html). + + (WL #11828) + + References: See also: Bug #27534089. +* A new system variable, + [`log_error_suppression_list`](/doc/refman/8.0/en/server-system-variables.html#sysvar_log_error_suppression_list), + specifies which diagnostics should not be written to the error + log when they occur with a severity of + `WARNING` or `INFORMATION`. + For example, if a particular type of warning occurs frequently + but is not of interest (and thus may be considered undesirable + “noise” in the error log), it now can be + suppressed. + (WL #11393) +* The code to handle rewriting of account-management statements + was refactored to make it easier to maintain and extend. This + work resulted in a few minor user-visible effects in the audit, + general, and slow query logs: + + + Plaintext passwords are replaced by + `` rather than + `''`. + + Default clauses are not written unless specified by the + user. + + (WL #12007) +* Previously, messages written to the error log by several + internal server methods were logged using the + [`ER_LOG_PRINTF_MSG`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_log_printf_msg) error code. + Each of these messages now is logged using a unique error code. + +### Optimizer Notes + +* The optimizer now supports a Skip Scan access method that + enables range access to be used in previously inapplicable + situations to improve query performance. For more information, + see [Skip Scan Range Access Method](/doc/refman/8.0/en/range-optimization.html#range-access-skip-scan). Thanks to Facebook + for the patch on which this access method is based. + (Bug #26976512, Bug #88103, WL #11322) +* MySQL now supports creation of functional index key parts that + index expression values rather than column values. Functional + key parts enable indexing of values that cannot be indexed + otherwise, such as [`JSON`](/doc/refman/8.0/en/json.html) values. + For details, see [CREATE INDEX Statement](/doc/refman/8.0/en/create-index.html). + (WL #1075) +* Performance of `SELECT COUNT(*) FROM + tbl_name` queries for + `InnoDB` tables was improved for + single-threaded workloads and when no extra clauses such as + `WHERE` or `GROUP BY` are + used. + (WL #10398) + +### Packaging Notes + +* The `libevent` library bundled with MySQL was + upgraded to version 2.1.8. + (Bug #28207237, Bug #29041505, Bug #29055011) +* Binary packages that include `curl` rather than + linking to the system `curl` library now use + `curl` 7.60.0 rather than 7.45.0. + (Bug #28043702) +* Debian packaging was updated to reflect the removal of yaSSL and + that OpenSSL is the default SSL library for all builds. + (Bug #28025599) +* Test plugins have been moved from server packages to test + packages. + (Bug #27860172) +* MySQL Router is now included in the MySQL server source and + monolithic binary packages. + +### Performance Schema Notes + +* A new Performance Schema stage, `waiting for handler + commit`, is available to detect threads going through + transaction commit. Thanks to Facebook for the patch. + (Bug #27855592, Bug #90417) + + References: See also: Bug #28950397. + +### Pluggable Authentication + +* **Microsoft Windows:** + On Windows, MySQL Enterprise Edition distributions now bundle + the Cyrus SASL library files `libsasl.dll` + and `saslSCRAM.dll` so that the LDAP + authentication plugins can use the + `SCRAM-SHA-1` authentication method. + (WL #11927) + +### Plugin Notes + +* Previously, MySQL plugins could be written in C or C++. MySQL + header files used by plugins now contain C++ code, which means + that plugins must be written in C++, not C. + (Bug #87725, Bug #26781567) + +### Security Notes + +* MySQL Enterprise Edition now provides data masking and + de-identification capabilities, implemented as a plugin library + containing a plugin and a set of loadable functions. Data + masking hides sensitive information by replacing real values + with substitutes. MySQL Enterprise Data Masking and + De-Identification functions enable masking existing data using + several methods such as obfuscation (removing identifying + characteristics), generation of formatted random data, and data + replacement or substitution. For example: + + ```None + mysql> SET @ssn = gen_rnd_ssn(); + mysql> SET @masked_ssn1 = mask_ssn(@ssn); + mysql> SET @masked_ssn2 = mask_outer(mask_inner (@ssn,4,5,'A'), 3,0,'B'); + mysql> SELECT @ssn, @masked_ssn1, @masked_ssn2; + +-------------+--------------+--------------+ + | @ssn | @masked_ssn1 | @masked_ssn2 | + +-------------+--------------+--------------+ + | 980-31-2838 | XXX-XX-2838 | BBB-AA-2838 | + +-------------+--------------+--------------+ + ``` + + For more information, see [MySQL Enterprise Data Masking and De-Identification](/doc/refman/8.0/en/data-masking.html). + (WL #7722) + +### Spatial Data Support + +* **Incompatible Change:** + Previously, [`ST_Area()`](/doc/refman/8.0/en/gis-polygon-property-functions.html#function_st-area) supported + only geometry arguments having a Cartesian spatial reference + system (SRS) and produced an error when invoked with geometry + arguments that specified a geographic SRS. + [`ST_Area()`](/doc/refman/8.0/en/gis-polygon-property-functions.html#function_st-area) now supports geometry + arguments having a geographic SRS and returns the geodetic area + in square meters. + + Note + + If spatial data contains geometry values that now are + interpreted differently by + [`ST_Area()`](/doc/refman/8.0/en/gis-polygon-property-functions.html#function_st-area), existing queries + using this function will return different results, compared to + previous MySQL versions. + + (WL #10726) +* The parser for spatial reference system (SRS) definitions in + [`CREATE SPATIAL REFERENCE SYSTEM`](/doc/refman/8.0/en/create-spatial-reference-system.html) + statements now is stricter about rejecting invalid constructs. + + The OGC 01-009 WKT grammar does not make `AXIS` + clauses mandatory in `GEOGCS` spatial reference + system definitions. However, if there are no + `AXIS` clauses, MySQL cannot determine whether + a definition has axes in latitude-longitude order or + longitude-latitude order. MySQL now enforces the nonstandard + requirement that each `GEOGCS` definition must + include two `AXIS` clauses. One must be + `NORTH` or `SOUTH`, and the + other `EAST` or `WEST`. The + `AXIS` clause order determines whether the + definition has axes in latitude-longitude order or + longitude-latitude order. + (Bug #28186073, Bug #28147723) +* Previously, [`ST_Validate()`](/doc/refman/8.0/en/spatial-convenience-functions.html#function_st-validate) + supported only geometry arguments having a Cartesian spatial + reference system (SRS) and produced an error when invoked with + geometry arguments that specified a geographic SRS. + [`ST_Validate()`](/doc/refman/8.0/en/spatial-convenience-functions.html#function_st-validate) now supports + geometry arguments having a geographic SRS. + + Note + + If spatial data contains geometry values that now are + interpreted differently by + [`ST_Validate()`](/doc/refman/8.0/en/spatial-convenience-functions.html#function_st-validate), existing queries + using this function will return different results, compared to + previous MySQL versions. + + (WL #11087) +* MySQL now implements the + [`ST_Transform()`](/doc/refman/8.0/en/spatial-operator-functions.html#function_st-transform) spatial function + for use in converting geometry values from one spatial reference + system (SRS) to another. Currently, it supports conversion + between geographic SRSs. For details, see + [Spatial Operator Functions](/doc/refman/8.0/en/spatial-operator-functions.html). + (WL #8684) + +### SQL Syntax Notes + +* **Incompatible Change:** + The deprecated `ASC` or `DESC` + qualifiers for `GROUP BY` clauses have been + removed. Queries that previously relied on `GROUP + BY` sorting may produce results that differ from + previous MySQL versions. To produce a given sort order, provide + an `ORDER BY` clause. + + Queries and stored program definitions from MySQL 8.0.12 or + lower that use `ASC` or `DESC` + qualifiers for `GROUP BY` clauses should be + amended. Otherwise, upgrading to MySQL 8.0.13 or higher may + fail, as may replicating to MySQL 8.0.13 or higher slave + servers. + (WL #8693) + +### XA Transaction Notes + +* Previously, metadata locks for XA transactions in + `PREPARED` state could be dropped when the + client performing the transaction disconnected or the server + restarted. This could lead to behavior such as one session being + able to drop tables used by an XA transaction in progress for + another session. Metadata locks for XA transactions in + `PREPARED` state now are maintained across + client disconnects and server restarts, until an + [`XA COMMIT`](/doc/refman/8.0/en/xa.html) or + [`XA ROLLBACK`](/doc/refman/8.0/en/xa.html) is + executed. + (Bug #22710164, Bug #79940, WL #9335) + +### X Plugin Notes + +* **Important Change:** + X Protocol now provides a connection pooling option, which can + reduce overhead for applications that open many connections to + MySQL server such as small web pages or a REST API endpoint. Use + the new `mysqlx.getClient(connection, options)` + operation, which returns a `Client` object. By + using a `Client` object, executing an open + session operation retrieves an existing and currently unused + network connection from the pool, resets it, and uses it. + Closing a session marks the underlying connection as unused and + returns it to the `Client` object's connection + pool. The connection pool is configured using a options data + dictionary, which means that a deployed application can switch + from using connection pooling or not by simply changing the + connection string. + (WL #11824) +* A mutex lock has been added to prevent conflict between multiple + X Plugin client sessions when a large number of sessions are + being opened and closed. + (Bug #28637947) +* When an X Plugin client attempted to connect to a MySQL server + specifying a database that did not exist on the server, the + error message indicated that access was denied rather than that + the database was not known. The correct error message is now + returned. + (Bug #28110957) +* Incorrect copying of an integer value by X Plugin caused an + error relating to misaligned memory access. The issue is now + fixed. + (Bug #28070946, Bug #90983) +* Now that X Plugin is loaded and enabled by default, the default + verbosity setting for the error log meant that no message was + visible to indicate that X Plugin was available on the MySQL + server. A message is now issued during system startup to confirm + that X Plugin has been loaded. + (Bug #27287340) +* X Protocol now provides the ability to broadcast information to + interested clients without the requirement to request the + information. In addition, changes related to Group Replication + are also broadcast. This work also adds the + [`Mysqlx_notified_by_group_replication`](/doc/refman/8.0/en/x-plugin-status-variables.html#statvar_Mysqlx_notified_by_group_replication) + and [`Mysqlx_notice_global_sent`](/doc/refman/8.0/en/x-plugin-status-variables.html#statvar_Mysqlx_notice_global_sent) + status variables. + (WL #10655) + +### Functionality Added or Changed + +* **Important Change; NDB Cluster; NDB Client Programs:** + Removed the deprecated `--ndb` option for + **perror**. Use **ndb\_perror** to + obtain error message information from `NDB` + error codes instead. + (Bug #81705, Bug #23523957) + + References: See also: Bug #81704, Bug #23523926. +* **InnoDB:** + The [`innodb_fsync_threshold`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_fsync_threshold) + system variable permits defining a threshold, in bytes, for + flushing data to disk from the operating system cache. By + default, when `InnoDB` creates a new data file, + such as a new log file or tablespace file, the file is fully + written to the operating system cache before it is flushed to + disk, which can cause a large amount of disk write activity to + occur at once. + + Specifying a threshold to force smaller, periodic flushes may be + beneficial in cases where multiple MySQL instances use the same + storage devices. For example, creating a new MySQL instance and + its associated data files could cause large surges of disk write + activity, impeding the performance of other MySQL instances that + use the same storage devices. Configuring a threshold helps + avoid such surges in write activity. + (Bug #27724600) +* **InnoDB:** + User-created temporary tables and internal temporary tables + created by the optimizer are now stored in session temporary + tablespaces that are allocated to a session from a pool of + temporary tablespaces. When a session disconnects, its temporary + tablespaces are truncated and released back to the pool. In + previous releases, temporary tables were created in the global + temporary tablespace (`ibtmp1`), which did + not return disk space to the operating system after temporary + tables were dropped. + + The [`innodb_temp_tablespaces_dir`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_temp_tablespaces_dir) + variable defines the location where session temporary + tablespaces are created. The default location is the + `#innodb_temp` directory in the data + directory. + + The [`INNODB_SESSION_TEMP_TABLESPACES`](/doc/refman/8.0/en/information-schema-innodb-session-temp-tablespaces-table.html) + table provides metadata about session temporary tablespaces. + + The global temporary tablespace (`ibtmp1`) + now stores rollback segments for changes made to user-created + temporary tables. + (WL #11613) +* **InnoDB:** + The `InnoDB` data-at-rest encryption feature + now supports general tablespaces. Previously, only + file-per-table tablespaces could be encrypted. To support + encryption of general tablespaces, [`CREATE + TABLESPACE`](/doc/refman/8.0/en/create-tablespace.html) and [`ALTER + TABLESPACE`](/doc/refman/8.0/en/alter-tablespace.html) syntax was extended to include an + `ENCRYPTION` clause. + + The + [`INFORMATION_SCHEMA.INNODB_TABLESPACES`](/doc/refman/8.0/en/information-schema-innodb-tablespaces-table.html) + table now includes an `ENCRYPTION` column that + indicates whether or not a tablespace is encrypted. + + The `stage/innodb/alter tablespace + (encryption)` Performance Schema stage instrument was + added to permit monitoring of general tablespace encryption + operations. + (WL #9286) +* **Replication:** + The + [`group_replication_member_expel_timeout`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_member_expel_timeout) + option has been added to define the time period that the group + should wait for a non-responding member before evicting the + member from the group. This enables you to configure the + eviction process when the connection to members is unreliable. + (WL #11570) +* **Group Replication:** + You can now inspect and configure the maximum number of + consensus instances at any time for a group. This maximum is + referred to as the event horizon for a group, and is the maximum + number of consensus instances that the system can execute in + parallel. This enables you to fine tune the performance of your + Group Replication deployment. + + To inspect a group's event horizon value at runtime, issue this + statement: + + ```None + SELECT group_replication_get_write_concurrency() + ``` + + To set the maximum number of write consensus instances, issue + the statement shown here: + + ```None + SELECT group_replication_set_write_concurrency(instances); + ``` + + *`instances`* is the maximum number of + instances used for consensus. + + See [Using Group Replication Group Write Consensus](/doc/refman/8.0/en/group-replication-group-write-consensus.html) + for more information. + (Bug #27260096, WL #11512) +* **Group Replication:** + You can now make changes to the configuration of a group while + it is running, without having to stop all members to make + changes. This functionality relies on loadable functions which + are installed with this version of the plugin, and all members + of a group must have these functions installed. To use the + functions, connect to an online member and issue + [`SELECT + function_name;`](/doc/refman/8.0/en/select.html) + + Use the + [`group_replication_set_as_primary()`](/doc/refman/8.0/en/group-replication-functions-for-new-primary.html#function_group-replication-set-as-primary) + function to trigger the election of a specific member as the new + primary in a single-primary group, overriding the usual election + process. See [Changing the Primary](/doc/refman/8.0/en/group-replication-change-primary.html) + for more information. + + In addition, you can configure the mode which a group is using + while it is online, changing between single-primary mode and + multi-primary mode. To change the mode of an online group, + choose one of these options: + + + Use + [`group_replication_switch_to_single_primary_mode()`](/doc/refman/8.0/en/group-replication-functions-for-mode.html#function_group-replication-switch-to-single-primary-mode) + to change a group running in multi-primary mode to + single-primary mode. + + Use + [`group_replication_switch_to_multi_primary_mode()`](/doc/refman/8.0/en/group-replication-functions-for-mode.html#function_group-replication-switch-to-multi-primary-mode) + to change a group running in single-primary mode to + multi-primary mode. + + See [Changing the Group Mode](/doc/refman/8.0/en/group-replication-changing-group-mode.html) for + more information. + (WL #10378) +* **Solaris:** + On Solaris, MySQL can now be built with Developer Studio 12.6. + (Bug #27055190, Bug #88316, Bug #28165246, Bug #91214) +* Data truncation testing was rewritten to avoid undefined + behavior. + (Bug #28255956, Bug #91445) +* Out-of-range checking for float values was improved. + (Bug #28225635) +* The upgrade check that the server runs during the startup + process now verifies that partitioned `InnoDB` + tables do not use shared tablespaces. + (Bug #28204431) +* Previously, file I/O performed in the I/O cache in the + `mysys` library was not instrumented, affecting + in particular file I/O statistics reported by the Performance + Schema about the binary log index file. Now, this I/O is + instrumented and Performance Schema statistics are accurate. + Thanks to Yura Sorokin for the contribution. + (Bug #27788907, Bug #90264) +* Performance for locating user account entries in the in-memory + privilege structures has been improved. Thanks to Eric Herman + for the contribution. + (Bug #27772506, Bug #90244) +* If **mysqld --initialize** fails to complete but + creates an unusable data directory, it now displays a message + that the data directory is unusable and can safely be removed. + (Bug #27675647) +* Instrumentation is now provided in the Performance Schema for + transaction retries by individual applier threads on a + single-threaded or multithreaded slave. Previously, the + Performance Schema table + [`replication_applier_status_by_worker`](/doc/refman/8.0/en/performance-schema-replication-applier-status-by-worker-table.html) + displayed information about errors that stopped the applier + thread, but not about transient errors that occurred before a + transaction was eventually applied. With this information, you + can identify transient errors that are causing replication lag + on replication slaves or Group Replication group members. + + Eight new columns have been added to the Performance Schema + [`replication_applier_status_by_worker`](/doc/refman/8.0/en/performance-schema-replication-applier-status-by-worker-table.html) + table: + + + `LAST_APPLIED_TRANSACTION_RETRIES_COUNT` - + The number of times the last applied transaction was retried + by the worker after the first attempt. If the transaction + was applied at the first attempt, this number is zero. + + `LAST_APPLIED_TRANSACTION_LAST_TRANSIENT_ERROR_NUMBER` + - The error number of the last transient error that caused + the transaction to be retried. + + `LAST_APPLIED_TRANSACTION_LAST_TRANSIENT_ERROR_MESSAGE` + - The message text for the last transient error that caused + the transaction to be retried. + + `LAST_APPLIED_TRANSACTION_LAST_TRANSIENT_ERROR_TIMESTAMP` + - The timestamp in `'YYYY-MM-DD + hh:mm:ss[.fraction]'` + format for the last transient error that caused the + transaction to be retried. + + `APPLYING_TRANSACTION_RETRIES_COUNT` - The + number of times the transaction that is currently being + applied was retried until this moment. If the transaction + was applied at the first attempt, this number is zero. + + `APPLYING_TRANSACTION_LAST_TRANSIENT_ERROR_NUMBER` + - The error number of the last transient error that caused + the current transaction to be retried. + + `APPLYING_TRANSACTION_LAST_TRANSIENT_ERROR_MESSAGE` + - The message text for the last transient error that caused + the current transaction to be retried. + + `APPLYING_TRANSACTION_LAST_TRANSIENT_ERROR_TIMESTAMP` + - The timestamp in `'YYYY-MM-DD + hh:mm:ss[.fraction]'` + format for the last transient error that caused the current + transaction to be retried. + + The existing column + `APPLYING_TRANSACTION_START_APPLY_TIMESTAMP` is + no longer reset each time a transaction is retried. It now + retains the timestamp from the worker's first attempt to apply + the transaction. + (WL #9131) +* Previously, [`CREATE + TEMPORARY TABLE`](/doc/refman/8.0/en/create-table.html) and + [`DROP TEMPORARY + TABLE`](/doc/refman/8.0/en/create-table.html) statements were not supported inside + transactions, procedures, functions, or triggers when using + GTIDs (that is, when the + [`enforce_gtid_consistency`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_enforce_gtid_consistency) system + variable is set to `ON`). It was possible to + use these statements with GTIDs enabled, but only outside of any + transaction, and only with `autocommit=1`. + + From MySQL 8.0.13, this restriction has been removed when + [`binlog_format`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_format) is set to + `ROW` or `MIXED`. With + row-based logging in use, + [`CREATE TEMPORARY + TABLE`](/doc/refman/8.0/en/create-table.html) and + [`DROP TEMPORARY + TABLE`](/doc/refman/8.0/en/create-table.html) statements can now be used inside transactions, + procedures, functions, or triggers when GTIDs are enabled. When + [`binlog_format`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_format) is set to + `STATEMENT`, the restriction remains. Because + of this difference in behavior, some additional restrictions now + apply to changing the + [`binlog_format`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_format) setting at + runtime: + + + If a session has open temporary tables, the replication + format cannot be changed for the session (`SET + @@SESSION.binlog_format`). + + If any replication channel has open temporary tables, the + replication format cannot be changed globally (`SET + @@GLOBAL.binlog_format` or `SET + @@PERSIST.binlog_format`). + + If any replication channel applier thread is currently + running, the replication format cannot be changed globally + (`SET @@GLOBAL.binlog_format` or + `SET @@PERSIST.binlog_format`). + + Trying to switch the replication format in any of these cases + (or attempting to set the current replication format) results in + an error. You can, however, use `PERSIST_ONLY` + (`SET @@PERSIST_ONLY.binlog_format`) to change + the replication format at any time, because this action does not + modify the runtime global system variable value, and takes + effect only after a server restart. + + When [`binlog_format`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_format) is set to + `ROW` or `MIXED`, + [`CREATE TEMPORARY + TABLE`](/doc/refman/8.0/en/create-table.html) and + [`DROP TEMPORARY + TABLE`](/doc/refman/8.0/en/create-table.html) statements are not written to the binary log and + are therefore not replicated to slaves. When they are used in + transactions, if the removal of these statements from the + transaction results in an empty transaction, the transaction is + not written to the binary log. If a transaction involving these + statements is rolled back, a warning message is issued stating + that the creation or dropping of the temporary tables could not + be rolled back. + (WL #8872) +* The MySQL Server code for binary logging has been refactored to + create new internal interfaces for accessing events in a binary + log and relay log. The new interfaces separate the write and + read processes for binary logging into input and output streams, + and decouple the process of capturing and retrieving binary log + events from the process of writing them to files. A logical + binary log file is used to wrapper the storage layer operations. + + The new internal interfaces make it possible for MySQL Server to + use alternative storage methods for binary log events besides a + standard binary log or relay log file, including a binary log + cache or memory buffer. For example, Group Replication uses the + new interfaces to serialize events directly to memory buffers + and transaction messages in order to co-ordinate transactions in + the group. **mysqlbinlog** also now uses them to + read binary log events from standard input. + + The following existing error messages are now marked as obsolete + due to the new internal interfaces: + + + ER\_BINLOG\_CANT\_OPEN\_LOG + + ER\_BINLOG\_CANT\_CREATE\_CACHE\_FOR\_LOG + + ER\_BINLOG\_ERROR\_GETTING\_NEXT\_LOG\_FROM\_INDEX + + ER\_RPL\_RECOVERY\_ERROR\_FREEING\_IO\_CACHE + + ER\_GRP\_RPL\_REINIT\_OF\_INTERNAL\_CACHE\_FOR\_READ\_FAILED + + ER\_GRP\_RPL\_APPENDING\_DATA\_TO\_INTERNAL\_CACHE\_FAILED + + ER\_GRP\_RPL\_REINIT\_OF\_INTERNAL\_CACHE\_FOR\_WRITE\_FAILED + + ER\_GRP\_RPL\_FAILED\_TO\_CREATE\_COMMIT\_CACHE + + ER\_GRP\_RPL\_REINIT\_OF\_COMMIT\_CACHE\_FOR\_WRITE\_FAILED + + (WL #10956) +* The `TempTable` storage engine now supports + storage of binary large object (BLOB) type columns. This + enhancement improves performance for queries that use temporary + tables containing BLOB data. Previously, temporary tables that + contained BLOB data were stored in the on-disk storage engine + defined by + [`internal_tmp_disk_storage_engine`](/doc/refman/8.0/en/server-system-variables.html#sysvar_internal_tmp_disk_storage_engine). + (WL #11452) +* The MySQL Server code for deserialization of binary log events + has been refactored to improve the identification and resilient + handling of corrupted and invalid event data during replication, + and also during processing with **mysqlbinlog**, + whether or not binary log checksums are used on the server. + (WL #11567) +* Previously, executing [`RENAME + TABLE`](/doc/refman/8.0/en/rename-table.html) required that there be no tables locked with + [`LOCK TABLES`](/doc/refman/8.0/en/lock-tables.html). Now it is possible + to rename tables that are locked with a `WRITE` + lock or that are the product of renaming + `WRITE`-locked tables from earlier steps in a + multiple-table rename operation. + (WL #9826) + +### Bugs Fixed + +* **InnoDB; Partitioning:** + Removed old `InnoDB` handler and partitioning + code that referenced `.frm` files, and thus + no longer had any purpose. + (Bug #27995316) +* **InnoDB:** + An assertion was raised during a [`DROP + TABLE`](/doc/refman/8.0/en/drop-table.html) operation. A thread that was accessing the table + through the memcached API released metadata locks before + releasing the table. + (Bug #28531148) +* **InnoDB:** + The `being_modified` bit in a LOB reference was + set but the bit modification was not logged, causing an + assertion failure. + (Bug #28443837) +* **InnoDB:** + Window functions returned incorrect results when the optimizer + used the `InnoDB` storage engine for internal + temporary tables. + (Bug #28430650) +* **InnoDB:** + Adjusting the server time to an earlier time caused periodic + redo flushes to be missed. + (Bug #28430358, Bug #90670) +* **InnoDB:** + An [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) operation that + added a primary key produced a segmentation fault. + (Bug #28395278) + + References: This issue is a regression of: Bug #27753193. +* **InnoDB:** + A conditional check was removed by removing the + `ReadView::complete()` function and splitting + its work among other functions. This change helps optimize + performance on ARM 64-bit. + (Bug #28385211, Bug #91759) +* **InnoDB:** + Leftover `thread_mutex` code was removed from + `InnoDB` source code files. + (Bug #28363673, Bug #91678) +* **InnoDB:** + Type changes were implemented to eliminate warnings that + occurred when compiling `InnoDB` with Microsoft + Visual Studio 2017. + (Bug #28338720) +* **InnoDB:** + An invalid assertion was raised when a B-tree flag used to mark + shared index locks was used to mark a shared-exclusive index + lock. + (Bug #28317172) +* **InnoDB:** + The sharp checkpoint mechanism no longer forces preflushing of + dirty pages when requesting a checkpoint for the currently + available LSN. + + The log checkpointer thread now takes the concurrency margin + (the per thread margin for free space in the log) into account + when determining if the next checkpoint write is required and + whether to wake up page cleaners to force a sync-flush of dirty + pages. Page cleaner threads take the concurrency margin into + account when determining whether to flush dirty pages and how + many pages to flush. + (Bug #28297462) +* **InnoDB:** + A misplaced debug crash point caused a transaction timeout + resulting in test failures. + (Bug #28295814) +* **InnoDB:** + `InnoDB` error message format was modified to + remove duplicate text. + (Bug #28289789) +* **InnoDB:** + Unnecessary cycles of freeing and allocating memory caused JSON + performance degradation on Windows. + (Bug #28278737) +* **InnoDB:** + `InnoDB` incorrectly permitted dropping an + index used in a foreign key constraint using an in-place + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) statement. This + operation is now blocked at the SQL layer. + (Bug #28268875) +* **InnoDB:** + To avoid checking hardware support each time a + hardware-optimized checksum is computed, asserts were converted + to debug-only asserts. + (Bug #28267334, Bug #91485) +* **InnoDB:** + A patch that combined Contention-Aware Transaction Scheduling + (CATS) with functionality that releases read locks caused gap + locks to be removed without granting locks to waiting + transactions, resulting in transaction timeouts. + (Bug #28261530) + + References: This issue is a regression of: Bug #28261530. +* **InnoDB:** + The `log_checkpointer` thread failed to write + new checkpoints in a timely manner when the amount of redo was + small. + (Bug #28220222) +* **InnoDB:** + The server exited during an in-place upgrade from MySQL 5.7 to + MySQL 8.0 due to an attempted eviction of a foreign-key-related + table from the cache. At the end of the upgrade process, tables + with `FULLTEXT` indexes were marked as ready + for eviction without checking for foreign key relationships. + (Bug #28212734, Bug #91325) +* **InnoDB:** + The format of the following Performance Schema and + `INFORMATION_SCHEMA` table columns was + modified: + + + [`data_locks.ENGINE_LOCK_ID`](/doc/refman/8.0/en/performance-schema-data-locks-table.html) + + [`data_lock_waits.REQUESTING_ENGINE_LOCK_ID`](/doc/refman/8.0/en/performance-schema-data-lock-waits-table.html) + + [`data_lock_waits.BLOCKING_ENGINE_LOCK_ID`](/doc/refman/8.0/en/performance-schema-data-lock-waits-table.html) + + [`INNODB_TRX.TRX_REQUESTED_LOCK_ID`](/doc/refman/8.0/en/information-schema-innodb-trx-table.html) + + The previous format was `trx_id:table_id` for + table locks and + `trx_id:space_id:page_no:heap_no` for record + locks. The new format is + `trx_immutable_id:table_id:lock_immutable_id` + for table locks and + `trx_immutable_id:space_id:page_no:heap_no:lock_immutable_id` + for record locks. + + `lock_immutable_id` and + `trx_immutable_id` are 64-bit values that do + not change during the lifetime of a lock or transaction, + respectively, and are unique among other instance object IDs. + (Bug #28176910) +* **InnoDB:** + The list of permitted lock mode descriptors used by the + `LOCK_MODE` column of the Performance Schema + [`data_locks`](/doc/refman/8.0/en/performance-schema-data-locks-table.html) table was expanded to + include `REC_NOT_GAP`, + `INSERT_INTENTION`, + `PREDICATE`, and `PRDT_PAGE`. + `REC_NOT_GAP` indicates a record-only lock. + `INSERT_INTENTION` indicates an insert + intention lock. `PREDICATE` and + `PRDT_PAGE` descriptors indicate a spatial + index lock. + (Bug #28176805) +* **InnoDB:** + Table names were not compared in lowercase on macOS with a + setting of + [`lower_case_table_names=2`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names), which + caused instability after restarting the server. + (Bug #28170699, Bug #91204) +* **InnoDB:** + Macros used to define constant values in + `InnoDB` source code were changed to constant + expressions. + (Bug #28152926) +* **InnoDB:** + A flag that prevents transactions from being rolled back during + commit is now set earlier to prevent scenarios in which a high + priority transaction could abort a transaction that is in the + process of being committed. + (Bug #28140462) +* **InnoDB:** + A query that scanned the primary key of a table did not return + the expected result. + (Bug #28104394, Bug #91032) +* **InnoDB:** + Unnecessary header file inclusions were removed from + `InnoDB` source code files. + (Bug #28086759) +* **InnoDB:** + An apparent hang due to the log writer running out of free space + in the redo log caused the server to exit. + (Bug #28072385, Bug #90993) +* **InnoDB:** + A query interruption during a lock wait caused an error. + (Bug #28068293) +* **InnoDB:** + After upgrading from MySQL 5.7 to MySQL 8.0, invalid warnings + indicated that undo tablespace IDs were not in the undo + tablespace range. The warnings occurred if the MySQL 5.7 + installation was configured to use separate undo tablespaces. + (Bug #28060337) +* **InnoDB:** + Error messaging was improved for startup failures on an + incomplete cloned data directory. + (Bug #28032131) +* **InnoDB:** + A segmentation fault occurred during an `XA + COMMIT` operation. + (Bug #27995891) +* **InnoDB:** + Unused code was removed from the TempTable storage engine source + code. + (Bug #27978968) +* **InnoDB:** + An index record was not found when updating a secondary index + defined on a generated column. + (Bug #27968952) +* **InnoDB:** + A spurious negation operator in an IF condition caused the + Contention-Aware Transaction Scheduling (CATS) algorithm to be + used for table locks. + (Bug #27944920) + + References: This issue is a regression of: Bug #27572937. +* **InnoDB:** + The update log applied as part of an online + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) operation did not + take into account the computed value of the generated column in + the old row while updating the secondary index. + (Bug #27921932) +* **InnoDB:** + Buffer pool memory allocation was not fully accounted for in + Performance Schema + `memory/innodb/buf_buf_pool` statistics. + (Bug #27917595, Bug #90561) +* **InnoDB:** + An unsupported DDL operation involving a foreign key constraint + raised an assertion. + (Bug #27912873) +* **InnoDB:** + A lock-related debug assertion failure was raised when more than + one lock matched a search condition, which could lead to + releasing the wrong lock. + (Bug #27898384) +* **InnoDB:** + A function that removes aborted indexes during the prepare phase + of an online [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) + operation did not record its changes. + (Bug #27879325) +* **InnoDB:** + A general tablespace created in MySQL 5.7 with no assigned table + caused a failure when upgrading to MySQL 8.0. + (Bug #27877485) +* **InnoDB:** + Concurrent undo tablespace truncation and master key rotation + operations raised an assertion. + (Bug #27872369) +* **InnoDB:** + A boolean marker identifying whether a transaction holds a mutex + was not placed in the correct location. + (Bug #27870035) +* **InnoDB:** + An attempted foreign key check on a discarded table caused a + segmentation fault. + (Bug #27804668) +* **InnoDB:** + B-tree bulk load operations could leave a page in a partially + initialized state. + (Bug #27802098) +* **InnoDB:** + Starting the server inside a Docker container on a NUMA enabled + operating system raised an “mbind: Operation not + permitted” error. + (Bug #27792853) +* **InnoDB:** + A partitioned table `TABLE_ID` value stored in + a storage-engine-private data field in the data dictionary was + not adjusted properly after an + [`ALTER TABLE ... + PARTITION`](/doc/refman/8.0/en/alter-table.html) operation. + (Bug #27784462) +* **InnoDB:** + The server halted with a “log writer overwriting data + after checkpoint - waited too long” error. + (Bug #27779266) +* **InnoDB:** + With + [`innodb_flush_log_at_trx_commit=2`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_flush_log_at_trx_commit), + the `log_flusher` thread could wait for an + event with a timeout period equal to the + [`innodb_flush_log_at_timeout`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_flush_log_at_timeout) + setting, causing an initialization delay. + (Bug #27762596) +* **InnoDB:** + An assertion was raised during an [`OPTIMIZE + TABLE`](/doc/refman/8.0/en/optimize-table.html) operation. + (Bug #27753193) +* **InnoDB:** + Transaction rollback due to a deadlock caused an assertion + failure in debug builds. Initiation of an attachable transaction + for accessing the data dictionary was not expected during + transaction rollback. + (Bug #27729974) +* **InnoDB:** + With + [`innodb_flush_log_at_trx_commit=0`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_flush_log_at_trx_commit) + and binary logging enabled, redo logs were not flushed as + expected during the commit phase of DDL operations. + (Bug #27691035) +* **InnoDB:** + With `REDUNDANT` or + `COMPRESSED` row format and `READ + COMMITTED` isolation level, only the LOB value prefix + and possibly the external part of an old LOB value were + returned, which could cause a JSON document to be viewed as + corrupted. If there was no LOB value prefix, an old LOB value + with new values for other fields could be returned, causing data + inconsistency. + (Bug #27624990) +* **InnoDB:** + A debug option that permits pausing periodic checkpoints became + obsolete after periodic checkpoint ownership was moved from the + master thread to a log checkpointer thread. The debug option was + replaced by another method of pausing periodic checkpoints. + (Bug #27588328) +* **InnoDB:** + A transaction on a table with a spatial index defined on a + column with a spatial reference identifier (SRID) was able to + insert into an area selected for update by another transaction. + (Bug #27577612) +* **InnoDB:** + A foreign key constraint name was duplicated during a rename + table operation, causing a failure during later query execution. + (Bug #27545888) +* **InnoDB:** + A serialized dictionary information (SDI) deletion failure + raised an assertion. + (Bug #27493634) +* **InnoDB:** + A server exit occurred after freeing large object (LOB) index + entries during a LOB purge or rollback. + (Bug #27419474) +* **InnoDB:** + In a function called before the execution of a statement in a + stored procedure, a read and write operation on + `trx->lock.start_stmt` was not protected by + a mutex. + (Bug #27325898) +* **InnoDB:** + The [`INFORMATION_SCHEMA.FILES`](/doc/refman/8.0/en/information-schema-files-table.html) and + [`INFORMATION_SCHEMA.INNODB_TABLESPACES`](/doc/refman/8.0/en/information-schema-innodb-tablespaces-table.html) + tables did not show the actual undo tablespaces that were + present in the MySQL instance. Only the two default undo + tablespaces were shown. + (Bug #26820406) +* **InnoDB:** + An error occurred during a DDL operation due to a mismatch in a + `REDUNDANT` row format calculation that + determines the length of the online log. + (Bug #26375771) +* **InnoDB:** + Enabling + [`innodb_undo_log_truncate`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_undo_log_truncate) + negatively affected transaction processing performance. Instead + of performing two checkpoints during an undo tablespace truncate + operation, pages that belong to the tablespace file are now + flushed from disk. + (Bug #26322656) +* **InnoDB:** + A helper class was introduced to improve performance associated + with reading from secondary keys when there are multiple + versions of the same row. + + Thanks to Domas Mituzas for the contribution. + (Bug #25540277, Bug #84958) +* **InnoDB:** + The location of the Innodb Merge Temp File that reported by the + `wait/io/file/innodb/innodb_temp_file` + Performance Schema instrument was incorrect. + (Bug #21339079, Bug #77519) +* **Partitioning:** + When a + [`CREATE + TABLE ... PARTITION BY ...`](/doc/refman/8.0/en/create-table.html#create-table-partitioning) statement failed due to an + invalid partition definition, the server did not remove any + partition files which might have been created prior to + encountering the invalid `PARTITION` clause. + (Bug #27798708) + + References: See also: Bug #88043, Bug #26945644. +* **Partitioning:** + It was possible to perform + [`FLUSH TABLES FOR + EXPORT`](/doc/refman/8.0/en/flush.html) on a partitioned table created with + [`innodb_file_per_table=1`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_file_per_table) after + discarding its tablespace. Attempting to do so now raises + [`ER_TABLESPACE_DISCARDED`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_tablespace_discarded). + (Bug #90545, Bug #27903881) + + References: See also: Bug #80669, Bug #22899690. +* **Partitioning:** + An extraneous row lock was imposed by an update to a partitioned + [`InnoDB`](/doc/refman/8.0/en/innodb-storage-engine.html) table. + (Bug #87253, Bug #26553164) +* **Replication:** + When a replication slave is restarted by a + [`START SLAVE`](/doc/refman/8.0/en/start-slave.html) statement, the + columns in the Performance Schema table + [`replication_applier_status_by_worker`](/doc/refman/8.0/en/performance-schema-replication-applier-status-by-worker-table.html) + beginning `APPLYING_TRANSACTION` are now reset + on a slave that is operating in single-threaded mode. These + columns were always reset on a multi-threaded slave, because the + existing worker threads were terminated by the statement and the + information could not be retained. The behavior has now been + standardized across the slave configurations by resetting the + columns for a single-threaded slave as well. + (Bug #28248026) +* **Replication:** + If a multi-threaded replication slave was stopped, changed to a + single-threaded slave (by setting + [`slave_parallel_workers > 0`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_parallel_workers)), + and restarted, the Performance Schema table + [`replication_applier_status_by_worker`](/doc/refman/8.0/en/performance-schema-replication-applier-status-by-worker-table.html) + showed irrelevant timestamps because the old monitoring + information had not been cleared. + (Bug #28191382) +* **Replication:** + When the + [`binlog_group_commit_sync_delay`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_group_commit_sync_delay) + system variable is set to a wait time to delay synchronization + of transactions to disk, and the + [`binlog_group_commit_sync_no_delay_count`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_group_commit_sync_no_delay_count) + system variable is also set to a number of transactions, the + MySQL server exits the wait procedure if the specified number of + transactions is reached before the specified wait time is + reached. The server manages this process by checking on the + transaction count after a delta of one tenth of the time + specified by + [`binlog_group_commit_sync_delay`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_group_commit_sync_delay) + has elapsed, then subtracting that interval from the remaining + wait time. + + If rounding during calculation of the delta meant that the wait + time was not a multiple of the delta, the final subtraction of + the delta from the remaining wait time would cause the value to + be negative, and therefore to wrap to the maximum wait time, + making the commit hang. The data type for the remaining wait + time has now been changed so that the value does not wrap in + this situation, and the commit can proceed when the original + wait time has elapsed. Thanks to Yan Huang for the contribution. + (Bug #28091735, Bug #91055) +* **Replication:** + In debug builds, an assertion failed because more than 255 + collations are now available in MySQL. + (Bug #28015761) +* **Replication:** + An assertion was raised in debug builds because the MySQL server + recorded a GTID consistency violation, but did not remove the + record after the relevant statement failed to execute + successfully. The handling of this situation has now been + improved to ensure that the server checks at the end of a + transaction whether a GTID consistency violation was produced by + a failed statement, and if this is the case, restores the + previous GTID consistency state. + (Bug #27903831, Bug #90551) +* **Replication:** + With GTIDs in use for replication, transactions including + statements that caused a parsing error + ([`ER_PARSE_ERROR`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_parse_error)) could not be + skipped manually by the recommended method of injecting an empty + or replacement transaction with the same GTID. This action + should result in the slave identifying the GTID as already used, + and therefore skipping the unwanted transaction that shared its + GTID. However, in the case of a parsing error, because the + statement was parsed before the GTID was checked to see if it + needed to be skipped, the replication applier thread stopped due + to the parsing error, even though the intention was for the + transaction to be skipped anyway. + + With this fix, the replication applier thread now ignores + parsing errors if the transaction concerned needs to be skipped + because the GTID was already used. Note that this behavior + change does not apply in the case of workloads consisting of + binary log output produced by **mysqlbinlog**. In + that situation, there would be a risk that a transaction with a + parsing error that immediately follows a skipped transaction + would also be silently skipped, when it ought to raise an error. + (Bug #27638268) +* **Replication:** + When a [`RESET SLAVE`](/doc/refman/8.0/en/reset-slave.html) statement was + issued on a replication slave with GTIDs in use, the existing + relay log files were purged, but the replacement new relay log + file was generated before the set of received GTIDs for the + channel had been cleared. The former GTID set was therefore + written to the new relay log file as the + `PREVIOUS_GTIDS` event, causing a fatal error + in replication stating that the slave had more GTIDs than the + master, even though the `gtid_executed` set for + both servers was empty. Now, when [`RESET + SLAVE`](/doc/refman/8.0/en/reset-slave.html) is issued, the set of received GTIDs is cleared + before the new relay log file is generated, so that this + situation does not occur. + (Bug #27636289) +* **Replication:** + The master's receiver thread for semisynchronous replication + held a mutex while reading acknowledgements from slaves, but the + same mutex was required to add or remove a semisynchronous + slave, causing those operations to be delayed by the + acknowledgement activity. The issue has now been fixed by not + acquiring the mutex to read the acknowledgements from slaves. + (Bug #27610678, Bug #89370) +* **Replication:** + In code for replication slave reporting, a rare error situation + raised an assertion in debug builds, but in release builds, + returned leaving a mutex locked. The mutex is now unlocked + before returning in this situation. Thanks to Zsolt Parragi for + the patch. + (Bug #27448019, Bug #89421) +* **Replication:** + Automatic retrying of transactions on a replication slave, as + specified by the + `slave_transaction_retries` + system variable, was taking place even if the transaction had a + non-temporary error that would repeat on retrying or that + indicated wider issues. Now, transactions are only automatically + retried if there is either no error, or an error that is only + temporary. + (Bug #27373559, Bug #89143) +* **Replication:** + When [`FLUSH`](/doc/refman/8.0/en/flush.html) statements for + specific log types (such as `FLUSH SLOW LOGS`) + resulted in an error, the statements were still written to the + binary log. This stopped replication because the error had + occurred on the master, but did not occur on the slave. MySQL + Server now checks on the outcome of these + [`FLUSH`](/doc/refman/8.0/en/flush.html) statements, and if an error + occurred, the statement is not written to the binary log. + (Bug #24786290, Bug #83232) +* **Replication:** + The `PASSWORD()` function, which produces a + hash of the password, was deprecated in MySQL 5.7 and removed in + MySQL 8.0. When a [`SET PASSWORD`](/doc/refman/8.0/en/set-password.html) + statement that used this function was replicated from a MySQL + 5.6 master to a MySQL 5.7 slave, or from a MySQL 5.7 master with + the + [`log_builtin_as_identified_by_password`](/doc/refman/5.7/en/replication-options-binary-log.html#sysvar_log_builtin_as_identified_by_password) + system variable set to ON to a MySQL 5.7 slave, the password + hash was itself also hashed before being stored on the slave. + The issue has now been fixed and the replicated password hash is + stored as originally passed to the slave. + (Bug #24687073) +* **Replication:** + If an `ORDER BY` clause was used in retrieving + records from certain Performance Schema tables relating to + replication, an empty set was returned. The issue has now been + fixed. + (Bug #22958077, Bug #80777) +* **Replication:** + When replication channels are used on a slave for multi-source + replication, a [`START SLAVE`](/doc/refman/8.0/en/start-slave.html) + statement that does not specify an individual channel (so + without the `FOR CHANNEL` clause) should start + the I/O thread and the SQL thread for all of the channels on the + replication slave. However, if a [`RESET + SLAVE`](/doc/refman/8.0/en/reset-slave.html) statement was used on such a slave, a subsequent + [`START SLAVE`](/doc/refman/8.0/en/start-slave.html) statement did not + start the non-default channels. Now, replication channels that + are deinitialized as a result of a [`RESET + SLAVE`](/doc/refman/8.0/en/reset-slave.html) statement, rather than as a result of an error + in the initialization process, are identified and are restarted + by a [`START SLAVE`](/doc/refman/8.0/en/start-slave.html) statement that + applies to all channels. + (Bug #22809607) +* **Replication:** + Issuing [`RESET SLAVE`](/doc/refman/8.0/en/reset-slave.html) on a + replication slave does not change any replication connection + parameters such as master host, master port, master user, or + master password, which are retained in memory. However, these + connection parameters are reset if you issue + [`RESET SLAVE + ALL`](/doc/refman/8.0/en/reset-slave.html). Previously, if the slave + **mysqld** was restarted immediately after + issuing [`RESET SLAVE`](/doc/refman/8.0/en/reset-slave.html) (including a + server crash as well as a deliberate restart), the connection + parameters were reset as if + [`RESET SLAVE + ALL`](/doc/refman/8.0/en/reset-slave.html) had been used. + + Now, when + [`master_info_repository=TABLE`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_master_info_repository) is + set on the server (which is the default from MySQL 8.0), + replication connection parameters are preserved in the + crash-safe `InnoDB` table + `mysql.slave_master_info` as part of the + [`RESET SLAVE`](/doc/refman/8.0/en/reset-slave.html) operation. They are + also retained in memory. In the event of a server crash or + deliberate restart after issuing [`RESET + SLAVE`](/doc/refman/8.0/en/reset-slave.html) but before issuing [`START + SLAVE`](/doc/refman/8.0/en/start-slave.html), the replication connection parameters are + retrieved from the table and reused for the new connection. + + If [`master_info_repository=FILE`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_master_info_repository) + is set on the server (which is the default in MySQL 5.7), + replication connection parameters are only retained in memory, + so the behavior remains the same as previously. If the slave + **mysqld** is restarted due to a server crash or + a deliberate restart immediately after issuing + [`RESET SLAVE`](/doc/refman/8.0/en/reset-slave.html), the connection + parameters are lost. In that case, you must issue a + [`CHANGE MASTER TO`](/doc/refman/8.0/en/change-master-to.html) statement after + the server start to respecify the connection parameters before + issuing [`START SLAVE`](/doc/refman/8.0/en/start-slave.html). + + If you want to reset the connection parameters intentionally, + you need to use + [`RESET SLAVE + ALL`](/doc/refman/8.0/en/reset-slave.html), which clears the connection parameters. In that + case, you must issue a [`CHANGE MASTER + TO`](/doc/refman/8.0/en/change-master-to.html) statement after the server start to specify the new + connection parameters. + (Bug #20280946) +* **Replication:** + When a group member resumes after being suspended for some time + and is not able to process all pending messages, it enters the + `ERROR` state. However, the remaining members + see it as `UNREACHABLE`, and wait until the + member's suspicion expires to evict it from the group. The + behavior has now been modified and a member stopping due to some + error tries to connect to a known peer to request its removal + from the group, before installing the leave view. + (Bug #91433, Bug #28252687) +* **Replication:** + Compilation warnings related to unused functions in + `xdr_utils` have been reduced. Thanks to Zsolt + Parragi for the patch. + (Bug #91071, Bug #28099963) +* **Replication:** + If the + [`group_replication_recovery_retry_count`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_recovery_retry_count) + variable was modified while the member was already making a + reconnection attempt, the connection attempt could enter an + infinite loop. + (Bug #91057, Bug #28092714) +* **Replication:** + The + [`group_replication_exit_state_action`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_exit_state_action) + variable enables you to specify what action is taken if a member + involuntarily leaves the group, but when starting a server with + [`group_replication_start_on_boot`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_start_on_boot) + enabled the + [`group_replication_exit_state_action`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_exit_state_action) + variable was being ignored during the following scenarios: + + + valid number of group members was exceeded + + incompatible configuration of the member system variables + (various) + + the joining member had more transactions than the group + + the joining member's version was not compatible with the + group + + (Bug #90494, Bug #27881311) +* **Replication:** + Issuing [`START GROUP_REPLICATION`](/doc/refman/8.0/en/start-group-replication.html) + and then forcibly stopping the `mysqld` + process, for example using **control-C**, could + result in an unexpected halt of the server. + (Bug #90457, Bug #27873419) +* **Group Replication:** + Entries in the relay log info log for the + `group_replication_applier` and + `group_replication_recovery` channels were not + cleared by [`RESET SLAVE`](/doc/refman/8.0/en/reset-slave.html) or + `RESET SLAVE ALL`. + (Bug #27411175) +* **Group Replication:** + When Group Replication was started on server with an invalid + [`group_replication_group_name`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_group_name), + the server stopped unexpectedly. + (Bug #91347, Bug #28219136) +* **Group Replication:** + When + [`group_replication_group_seeds`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_group_seeds) + contained a DNS based entry which resolved to its own local + address, Group Replication was unable to start. + (Bug #90483, Bug #27882096, Bug #28074929) +* **Microsoft Windows:** + An error now is written to the server log when the presence of + the [`NO_AUTO_CREATE_USER`](/doc/refman/5.7/en/sql-mode.html#sqlmode_no_auto_create_user) value + for the `sql_mode` option in the options file + prevents a MySQL 8.0 server from starting. + (Bug #28061945, Bug #90967) +* **Microsoft Windows:** + On Windows, uninstallation of the MySQL Server MSI package + through MySQL Installer produced a spurious popup window. + (Bug #27463864) +* **Microsoft Windows:** + On Windows, `DBUG_ABORT` did not print the + custom stack trace and other information. + (Bug #21383530) +* **Microsoft Windows:** + Starting MySQL as a Windows service with the + service-installation command that specified a service name + following the [`--install`](/doc/refman/8.0/en/server-options.html#option_mysqld_install) option + ignored the directives in the named service group of the + `my.ini` or `my.cnf` + options files and used default options instead. Only the default + service names (`mysqld`, + `mysql_cluster`, `server`, + `mysqld-8.0`) could load different parameters + from an options file. + (Bug #90383, Bug #27852209) +* **JSON:** + The server did not reject creation of a table with a generated + column in which the generated column used + [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table), even though + subqueries, parameters, variables, stored functions, and + loadable functions are not permitted in expressions for + generated columns. The server now checks more aggressively to + make sure any of the disallowed constructs (including + `JSON_TABLE()`) are rejected for use in such + expressions. + (Bug #28518485) +* **JSON:** + [`SELECT`](/doc/refman/8.0/en/select.html) `... + FROM` [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table) + sometimes failed with a permissions error for a user other than + MySQL `root`. This issue could also occur when + such a query was used as the basis for a view, and a + `SELECT` from the view failed. + (Bug #28255453, Bug #27923406) + + References: See also: Bug #27189940. +* **JSON:** + The [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table) function + subjected integer values greater than or equal to + 231 to wraparound. For example, the + query `SELECT id FROM + JSON_TABLE('[{"id":"2147483648"}]', '$[*]' COLUMNS (id BIGINT + UNSIGNED PATH '$.id')) AS json` returned + `-2147483648`. + (Bug #27856835) +* **JSON:** + In some contexts, the [`NULLIF()`](/doc/refman/8.0/en/flow-control-functions.html#function_nullif) + function returned its first argument as a boolean value rather + than its actual type. This was noticed when the result of this + function was used as an argument to + [`JSON_ARRAYAGG()`](/doc/refman/8.0/en/aggregate-functions.html#function_json-arrayagg) or + [`JSON_OBJECTAGG()`](/doc/refman/8.0/en/aggregate-functions.html#function_json-objectagg), but could have + occurred in other cases in which `NULLIF()` was + used in a similar fashion. + (Bug #90833, Bug #28007237) +* **JSON:** + When a [`JSON`](/doc/refman/8.0/en/json.html) document which + contained binary data was converted to base-64 encoded text for + display, newline characters in the encoded string were not + properly escaped, so that the text representation could not be + parsed as `JSON`, and was thus truncated, + corrupted, or both. Now MySQL makes sure that any newline + characters in the encoded string are escaped. + (Bug #90503, Bug #27891359) +* `filesort` operations could cause a server + exit. + (Bug #28791531, Bug #92777) +* Debian packaging now supports Ubuntu 18.10 (Cosmic Cuttlefish). + (Bug #28765706) +* On the Fedora 29 platform, OpenSSL 1.0.x is used to build + packages because OpenSSL 1.1.1 support is not ready. If you + build MySQL from source, it is recommended that you build using + the `compat-openssl10-devel` package. + (Bug #28737143) +* On the Fedora 29 platform, upgrading from MariaDB to MySQL + 8.0.13 failed due to missing obsoletes. + (Bug #28727698) +* MySQL binary distributions for SLES 12 now are built using GCC + 7. The lowest supported GCC version on this platform is now 5.3 + (previously 4.8.5). + (Bug #28542723) +* Trying to add a functional index on a subquery should not be + possible, and caused the server to hit an assertion when trying + to resolve the indexed expression. Now in such cases, the + expression is disallowed, and the servers returns an appropriate + error message. + (Bug #28526493) +* Added a range check when performing calculations with exponents. + (Bug #28505423) +* `CMAKE -DWITHOUT_SERVER=1` resulted in build + errors. + (Bug #28501563, Bug #92011) +* When a prefix index was specified with a length of 8 bytes, the + `Sub_part` column in the output of + [`SHOW + INDEXES`](/doc/refman/8.0/en/show-index.html) was `NULL`. + (Bug #28499603) +* Compilation failed for GCC 8 with MySQL configured to use some + system libraries. + (Bug #28471072, Bug #91914) +* For debug builds, if the server bootstrapping phase failed, + missing cleanup code caused an assertion to be raised. + (Bug #28435378, Bug #91847) +* Numeric ranges in MySQL builds could differ between the ARM and + Intel x64 platforms. + (Bug #28401869) +* For **mysqldump --tables** output, file names now + always include a `.txt` or + `.sql` suffix, even for file names that + already contain a dot. Thanks to Facebook for the contribution. + (Bug #28380961, Bug #91745) +* Concurrent [`INSERT`](/doc/refman/8.0/en/insert.html) and + [`SELECT`](/doc/refman/8.0/en/select.html) statements on a + [`MERGE`](/doc/refman/8.0/en/merge-storage-engine.html) table could result in a + server exit. + (Bug #28379285) +* On SLES 15, upgrading from MariaDB packages to MySQL packages + failed due to incorrect `obsoletes` + information. + (Bug #28292138) +* The data dictionary auto releaser now allocates maps for data + dictionary object types dynamically. Also, maps were added for + column statistics and resource groups used in size calculations + and object removal, and an auto releaser was added for + [`ANALYZE TABLE`](/doc/refman/8.0/en/analyze-table.html) operations. + (Bug #28245522, Bug #91420) +* It was possible for a [`UNION`](/doc/refman/8.0/en/union.html) query + that mixed different character sets to fail with a spurious + error. + (Bug #28237675) + + References: This issue is a regression of: Bug #83895, Bug #25123839. +* [`CHECK TABLE ... FOR + UPGRADE`](/doc/refman/8.0/en/check-table.html) on temporary tables could raise an assertion. + (Bug #28220374) + + References: This issue is a regression of: Bug #24741307. +* A divide-by-zero error could occur in the range optimizer. + (Bug #28214186) +* Due to a GCC 8 bug, recursion in foreign key checks could + exhaust stack space. + (Bug #28200774, Bug #28421040, Bug #91823) +* When [`sql_mode`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_mode) was set to the + empty string, queries of the form + [`SELECT CONCAT( + FORMAT(LPAD(char,2,''), 1) )`](/doc/refman/8.0/en/select.html) were not handled + properly; the same was also true for similarly-formed queries + using [`RPAD()`](/doc/refman/8.0/en/string-functions.html#function_rpad) in place of + [`LPAD()`](/doc/refman/8.0/en/string-functions.html#function_lpad). + (Bug #28197977) +* Non-privileged users could change their own account password + history and reuse properties. + (Bug #28191838) +* The OpenSSL 1.1 `OPENSSL_malloc_init()` call + did not work well on Windows. To address this, alternative + allocation wrappers are used instead of the defaults from + OpenSSL. Consequently, OpenSSL memory instrumentation is turned + off. + (Bug #28179051) +* Allocation of certain object types during data dictionary + lookups resulted in a stack buffer overflow. + (Bug #28176453) +* An internal server operation that attempted to perform a commit + while fetching table statistics from the + `INFORMATION_SCHEMA` could raise an assertion. + (Bug #28165060) +* Certain stored procedures could cause a server exit. + (Bug #28156802) +* Output for [`CREATE USER`](/doc/refman/8.0/en/create-user.html) statements + could differ in the general query log and audit log. + (Bug #28147710) +* For [`UPDATE`](/doc/refman/8.0/en/update.html) and + [`DELETE`](/doc/refman/8.0/en/delete.html) statements that produce an + error due to [`sql_safe_updates`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_safe_updates) + being enabled, the error message was insufficiently informative. + The message now includes the first diagnostic that was produced, + to provide information about the reason for failure. For + example, the message may indicate that the + [`range_optimizer_max_mem_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_range_optimizer_max_mem_size) + value was exceeded or type conversion occurred, either of which + can preclude use of an index. + + Additionally: (1) Using [`EXPLAIN`](/doc/refman/8.0/en/explain.html) + for such statements does not produce an error, enabling users to + see from `EXPLAIN` plus + [`SHOW WARNINGS`](/doc/refman/8.0/en/show-warnings.html) output why an index + is not used. (2) For multiple-table deletes and updates, an + error is produced with safe updates enabled only if any target + table uses a table scan. + (Bug #28145710, Bug #91080) +* MySQL Server and test RPM packages were missing + `perl-Data-Dumper` as a dependency. + (Bug #28144933, Bug #72926) +* Server startup could fail if a service needed by a component was + not yet initialized. + (Bug #28142250) +* [`SHOW CREATE TABLE`](/doc/refman/8.0/en/show-create-table.html) could omit + foreign key `RESTRICT` options. This in turn + could cause foreign key `RESTRICT` options to + be lost from tables dumped with **mysqldump** and + restored from the dump file. + (Bug #28122781, Bug #91110) +* The **mysql** client was slow to import large + multiple-line statements in batch mode. Memory allocation is now + more efficient for this situation. Thanks to Sinisa Milivojevic + for the patch. + (Bug #28116512, Bug #85155) +* The [`SUM()`](/doc/refman/8.0/en/aggregate-functions.html#function_sum) and + [`AVG()`](/doc/refman/8.0/en/aggregate-functions.html#function_avg) functions did not handle + correctly a string argument used with a window function. + (Bug #28105241) +* Excessive nesting of geometry collections caused the server to + exhaust stack space. The server now raises an error if there is + a danger of stack overrun. + (Bug #28100563) +* For the **mysql** client, the `-b` + short option was associated with two long options, + [`--no-beep`](/doc/refman/8.0/en/mysql-command-options.html#option_mysql_no-beep) and + [`--binary-as-hex`](/doc/refman/8.0/en/mysql-command-options.html#option_mysql_binary-as-hex). The + `-b` option now is associated only with + `--no-beep`. + (Bug #28093271) +* For a table with an auto-increment primary key, concurrent + `ALTER TABLE ... ADD ... VIRTUAL` and + `INSERT` statements could lead to duplicate-key + errors. + (Bug #28089240) +* Handling of floating-point values by + [`SUM()`](/doc/refman/8.0/en/aggregate-functions.html#function_sum) was improved. + (Bug #28080199) +* Some expressions using + [`ST_Simplify()`](/doc/refman/8.0/en/spatial-convenience-functions.html#function_st-simplify) could cause a + server exit. + (Bug #28079969) +* In builds with Undefined Behavior Sanitizer enabled, testing + returned a “member call on null pointer of type 'struct + Event\_db\_repository'” error. + (Bug #28066155) +* The [`WITH_GMOCK`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_gmock) + **CMake** option did not handle Windows path + names properly. + (Bug #28061409, Bug #90964) +* `INFORMATION_SCHEMA` queries that attempted to + cache table statistics could raise a debugging assertion. + (Bug #28035207) +* If roles were assigned to accounts, certain + [`sql_mode`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_mode) settings could cause + the server to be unable to start. + (Bug #28030423) +* Group lookups for LDAP authentication plugins could fail if the + user had insufficient privileges. Now, group search operations + bind again using `root` credentials if those + are available. + (Bug #28016008) +* `ANALYZE TABLE ... UPDATE HISTOGRAM` statements + produced by **mysqldump** contained a syntax + error. + (Bug #28014376, Bug #90846) +* Generated columns having indexes and that used a string function + were not always populated correctly. + (Bug #27973409) +* Fixed-length sort keys, such as those used by priority queues, + that fit exactly were assumed to have failed. + (Bug #27970481, Bug #92448, Bug #28654343) +* For an empty result, [`REPLACE()`](/doc/refman/8.0/en/string-functions.html#function_replace) + sometimes returned a null string rather than an empty string. + (Bug #27960921) +* Dropping a table that was created with a user-defined collation + no longer available could cause a server exit. + (Bug #27952999) +* Joining the `INFORMATION_SCHEMA` + [`REFERENTIAL_CONSTRAINTS`](/doc/refman/8.0/en/information-schema-referential-constraints-table.html) and + [`TABLE_CONSTRAINTS`](/doc/refman/8.0/en/information-schema-table-constraints-table.html) tables on the + `CONSTRAINT_NAME` failed because the column + collations differed. + (Bug #27945704, Bug #90690) +* Some operations on `DECIMAL` values could cause + a server exit. + (Bug #27942277) +* Very long table keys were handled incorrectly on replication + slaves. + (Bug #27930505) +* **mysqld** did not determine its installation + directory correctly if that directory was the last one listed in + `$PATH`. + (Bug #27922896) +* During server startup/shutdown, PID files could be mishandled. + (Bug #27919254) +* When the server was started with + [`--skip-grant-tables`](/doc/refman/8.0/en/server-options.html#option_mysqld_skip-grant-tables), some + account-management statements were not disabled. + (Bug #27906226) +* On rare occasions, setting a savepoint could raise an assertion. + (Bug #27898591) +* Runtime errors could occur for calls to + `copy_integer()`. + `myfunc_int()`, + `mysql_sys_var_int()`, or + `thd_killed()`; for calls to + `MyISAM` sorting functions; or for values + outside the range of representable values of type + `unsigned long long`. + (Bug #27894901, Bug #90515, Bug #27871951, Bug #27918095, Bug #90609, Bug #27937522, Bug #90661, Bug #27978325, Bug #27962900) +* **mysql\_install\_plugin** failed to report + plugin-specific errors if the server was unable to store plugin + metadata in the data dictionary. + (Bug #27893406) +* [`ssl_fips_mode`](/doc/refman/8.0/en/server-system-variables.html#sysvar_ssl_fips_mode) cannot be set to + `ON` unless the OpenSSL requirements are + satisfied, but a failed attempt still resulted in the value + being displayed as `ON`. + (Bug #27891890) +* The symbol for the + [`mysql_result_metadata()`](/doc/c-api/8.0/en/mysql-result-metadata.html) C API + function was not exported by the client library on Windows. + (Bug #27868095) +* For `InnoDB` tables, self-referencing foreign + keys could be created, causing server misbehavior. + (Bug #27864515) +* A [`UNION`](/doc/refman/8.0/en/union.html) query mixing different + character sets produced invalid output when performed in a + prepared statement or a stored procedure. + (Bug #27849293) +* Debian packages were missing a dependency for + `libcurl-dev`. + (Bug #27844465) +* `--help` output for client programs did not + include the current + [`--ssl-fips-mode`](/doc/refman/8.0/en/connection-options.html#option_general_ssl-fips-mode) value. + (Bug #27838966) +* A runtime error could occur for calls to + `Derived_key_comp()`. + (Bug #27830679) +* For `MEMORY` tables, memory overflow errors + could occur. + (Bug #27799513) +* When converting from a `BLOB` (or + `TEXT`) type to a smaller + `BLOB` (or `TEXT`) type, no + warning or error was reported informing about the truncation or + data loss. Now an appropriate error is issued in strict SQL mode + and a warning in nonstrict SQL mode. + (Bug #27788685, Bug #90266) +* For debug builds, + `my_strnxfrm_unicode_full_bin()` could raise an + assertion. + (Bug #27752619) +* In builds with Undefined Behavior Sanitizer enabled, signed + integer overflow could occur in GIS calculations. + (Bug #27751479, Bug #27744399, Bug #27811282) +* It was possible in some cases for the internal function + `regexp::EvalExprToCharset()` to bind a + reference to a misaligned address. + (Bug #27743722) +* The severity of messages produced by the server about being + unable to read key files has been escalated from INFORMATION to + WARNING. + (Bug #27737195) +* No temporary table field was created for an expression using + window functions combined with a rollup, causing queries + containing these to fail. + (Bug #27735167) +* The expression [`FIND_IN_SET(`](/doc/refman/8.0/en/string-functions.html#function_find-in-set)[`JSON_UNQUOTE(`](/doc/refman/8.0/en/json-modification-functions.html#function_json-unquote)[`JSON_SET('{}','$','') ), + 1)`](/doc/refman/8.0/en/json-modification-functions.html#function_json-set) was not evaluated properly. + (Bug #27731699) +* Failure to create a temporary table during a + `MyISAM` query could cause a server exit. + Thanks to Facebook for the patch. + (Bug #27724519, Bug #90145) +* [`parser_max_mem_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_parser_max_mem_size) was + ineffective when parsing stored program definitions. + (Bug #27714748) +* A `BETWEEN` clause comparing negative values + could lead to erroneous results. + (Bug #27691347) +* Some typos in server error messages were fixed. Thanks to Thomas + Tsiakalakis for the contribution. + (Bug #27688294, Bug #90048) +* These scripts are no longer included in RPM packages (they are + unnecessary because they are compiled into the + **mysqld** binary): + `fill_help_tables.sql`, + `mysql_sys_schema.sql`, + `mysql_system_tables.sql`, + `mysql_system_tables_data.sql`, + `mysql_system_users.sql`. + (Bug #27672991) +* `Unique::io_cache` was not cleaned up properly + when restarting an index merge operation, leading to an + assertion in debug builds. + (Bug #27599292) +* Using a binary or hexadecimal literal value in a + `ENUM` column resulted in a string type with + bytes not permitted by the data dictionary character set. + (Bug #27592803) +* It was possible for [`CONVERT()`](/doc/refman/8.0/en/cast-functions.html#function_convert) to + fail under the following conditions: + + The size of the result of the conversion was greater than + [`max_allowed_packet`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_allowed_packet) + + [`sql_mode`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_mode) was '' (that is, + empty). + + The character set of the result differed from + [`character_set_connection`](/doc/refman/8.0/en/server-system-variables.html#sysvar_character_set_connection) + (Bug #27592714) +* Use of [`ENUM`](/doc/refman/8.0/en/enum.html) or + [`SET`](/doc/refman/8.0/en/set.html) fields with + [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table) could result in + unexpected behavior. + (Bug #27571251) +* Host name resolution errors could cause the + `audit_log` plugin to fail. + (Bug #27567003) +* Unsuccessful connection attempts were not being written to the + error log when + [`log_error_verbosity=3`](/doc/refman/8.0/en/server-system-variables.html#sysvar_log_error_verbosity). + (Bug #27539838) +* Persisted system variables with a value of + `NULL` were written to + `mysqld-auto.cnf` incorrectly. + (Bug #27512616) +* An earlier code cleanup caused `FEDERATED` + storage engine failures. + (Bug #27493633, Bug #89537) + + References: This issue is a regression of: Bug #25943754. +* Setting [`max_execution_time`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_execution_time) + sometimes had no effect when used with full-text search. + (Bug #27155294) +* An attempted read of an uncommitted transaction raised an + assertion. + (Bug #26876608) +* `ALTER TABLE ... REORGANIZE PARTITION ...` + could result in incorrect behavior if any partition other than + the last was missing the `VALUES LESS THAN` + part of the syntax. + (Bug #26791931) +* In some cases when + [`ER_DATA_TOO_LONG`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_data_too_long) was the + appropriate error, + [`ER_TRUNCATED_WRONG_VALUE_FOR_FIELD`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_truncated_wrong_value_for_field) + was reported instead. + (Bug #26475237, Bug #87100) +* A `last_checked_for_upgrade` column that stores + the current server version number was added to the + `mysql.tables` data dictionary table to track + successful `CHECK TABLE ... FOR UPGRADE` + operations. This data was previously stored in + `.frm` files to avoid rechecking tables + unnecessarily. + (Bug #24741307, Bug #83169) +* The `MYSQLparse()` function generated from the + `sql_yacc.yy` file had exceeded a size limit + that caused the Microsoft Visual C++ compiler to abandon + optimization. The `/d2OptimizeHugeFunctions` + compiler switch was enabled to restore optimization (available + in Visual Studio 2017 and higher). + (Bug #24600301) +* A range check for the product of a signed and unsigned integer + could be performed incorrectly. + (Bug #17081376, Bug #69715) +* Specifying the maximum possible value for a + [`YEAR`](/doc/refman/8.0/en/year.html) column failed when expressed + as a real constant such as `2155.0E00` or + `2.15E3`. + (Bug #91226, Bug #28172538) +* Prevented potential member access within a null pointer of type + `SELECT_LEX`. + (Bug #90689, Bug #27945614) +* The base used for calculation of line numbers reported in + warnings generated by [`SELECT`](/doc/refman/8.0/en/select.html) + statements has been changed from the number of input rows read + to the actual row numbers seen by the user. For statements using + `GROUP BY`, this number is now based on the + number of aggregate groupings. + (Bug #90667, Bug #27938507) +* Estimates contained by histograms for the number of distinct + values in each bucket, which can be employed to estimate the + number of distinct values in a table, can now be used by the + Optimizer's `histograms::Histogram` interface. + (Bug #90465, Bug #27872281) +* Selecting from the + [`INFORMATION_SCHEMA.KEYWORDS`](/doc/refman/8.0/en/information-schema-keywords-table.html) table + failed when no default database had been selected. + (Bug #90160, Bug #27729859) +* [`ANALYZE TABLE + UPDATE HISTOGRAM`](/doc/refman/8.0/en/analyze-table.html) failed to return an error condition + to the client when + [`lock_wait_timeout`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lock_wait_timeout) was exceeded + during statement processing. + (Bug #89738, Bug #27574375) +* It was possible to create a table `t` having a + generated column `g` and then to execute + [`ALTER TABLE t ALTER + COLUMN g SET DEFAULT ...`](/doc/refman/8.0/en/alter-table.html); attempting to set the + default for a generated column in this fashion now fails with + Error 1221 Incorrect usage of DEFAULT and generated + column. This is the same behavior as for a similar + [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) statement. + (Bug #88619, Bug #27164393) diff --git a/corpus/changelog/mysql_releases/mysql_8014.md b/corpus/changelog/mysql_releases/mysql_8014.md new file mode 100644 index 0000000000000000000000000000000000000000..6c3f8206baf3df44901e13ba00cf41f8e98e7569 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8014.md @@ -0,0 +1,1960 @@ +# MySQL 8.0.14 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-14.html +Version: 8.0.14 + +## Changes in MySQL 8.0.14 (2019-01-21, General Availability) + +For general information about upgrades, downgrades, platform support, etc., please visit [https://dev.mysql.com/doc/relnotes/mysql/8.0/en/](/doc/relnotes/mysql/8.0/en/). + +* [Account Management Notes](news-8-0-14.html#mysqld-8-0-14-account-management "Account Management Notes") +* [Audit Log Notes](news-8-0-14.html#mysqld-8-0-14-audit-log "Audit Log Notes") +* [Compilation Notes](news-8-0-14.html#mysqld-8-0-14-compiling "Compilation Notes") +* [Component Notes](news-8-0-14.html#mysqld-8-0-14-components "Component Notes") +* [Configuration Notes](news-8-0-14.html#mysqld-8-0-14-configuration "Configuration Notes") +* [Deprecation and Removal Notes](news-8-0-14.html#mysqld-8-0-14-deprecation-removal "Deprecation and Removal Notes") +* [SQL Function and Operator Notes](news-8-0-14.html#mysqld-8-0-14-functions-operators "SQL Function and Operator Notes") +* [Logging Notes](news-8-0-14.html#mysqld-8-0-14-logging "Logging Notes") +* [Optimizer Notes](news-8-0-14.html#mysqld-8-0-14-optimizer "Optimizer Notes") +* [Packaging Notes](news-8-0-14.html#mysqld-8-0-14-packaging "Packaging Notes") +* [Performance Schema Notes](news-8-0-14.html#mysqld-8-0-14-performance-schema "Performance Schema Notes") +* [Pluggable Authentication](news-8-0-14.html#mysqld-8-0-14-pluggable-auth "Pluggable Authentication") +* [Security Notes](news-8-0-14.html#mysqld-8-0-14-security "Security Notes") +* [Spatial Data Support](news-8-0-14.html#mysqld-8-0-14-spatial-support "Spatial Data Support") +* [SQL Syntax Notes](news-8-0-14.html#mysqld-8-0-14-sql-syntax "SQL Syntax Notes") +* [Thread Pool Notes](news-8-0-14.html#mysqld-8-0-14-thread-pool "Thread Pool Notes") +* [X Plugin Notes](news-8-0-14.html#mysqld-8-0-14-xplugin "X Plugin Notes") +* [Functionality Added or Changed](news-8-0-14.html#mysqld-8-0-14-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-14.html#mysqld-8-0-14-bug "Bugs Fixed") + +### Account Management Notes + +* Previously, each MySQL user account was permitted to have a + single password. MySQL now permits an account to have dual + passwords, designated as primary and secondary passwords. This + capability enables phased password changes to be performed + seamlessly in complex multiple-server systems, without downtime. + To support dual-password capability, the + [`ALTER USER`](/doc/refman/8.0/en/alter-user.html) and + [`SET PASSWORD`](/doc/refman/8.0/en/set-password.html) statements now have + a `RETAIN CURRENT PASSWORD` clause that saves + the current password as the secondary password when you assign + an account a new primary password. [`ALTER + USER`](/doc/refman/8.0/en/alter-user.html) also has a `DISCARD OLD + PASSWORD` clause to discard a secondary password that + is no longer needed. See [Password Management](/doc/refman/8.0/en/password-management.html). + + Important + + The implementation of dual-password capability involves a + change to the structure of the `mysql.user` + system table. If you upgrade to this MySQL release from an + earlier version, you must run **mysql\_upgrade** + (and restart the server) to incorporate this system database + change. Until this is done, *password changes are not + possible.* + + (WL #11540) + +### Audit Log Notes + +* The audit API now enables applications to add their own message + events to the audit log using the new + `audit_api_message_emit` component, which + includes an + [`audit_api_message_emit_udf()`](/doc/refman/8.0/en/audit-api-message-emit.html#function_audit-api-message-emit-udf) + loadable function. See [The Audit Message Component](/doc/refman/8.0/en/audit-api-message-emit.html). + (WL #11542) + +### Compilation Notes + +* The minimum version of the Boost library for server builds is + now 1.68.0. + (Bug #28478497) + +### Component Notes + +* A new `host_application_signal` component + service is available to enable components to deliver signals to + the host application. For example, the service enables + replication components to send a shutdown signal to the server. + (WL #12003) + +### Configuration Notes + +* Previously, the + [`COMPILATION_COMMENT`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_compilation_comment) + **CMake** option was used by the server (for + example, to set the + [`version_comment`](/doc/refman/8.0/en/server-system-variables.html#sysvar_version_comment) system + variable) and by other programs. However, when the value + contained the word “server”, it was inappropriate + for use by other programs. The server now uses the new + [`COMPILATION_COMMENT_SERVER`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_compilation_comment_server) option. + Other programs continue to use + [`COMPILATION_COMMENT`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_compilation_comment). + (Bug #28888510) +* The content of the `.gitignore` file has been + cleaned up. Much of this file was inherited from its + `.bzrignore` predecessor and was not + relevant. One implication of this cleanup is that in-source + builds are disallowed. + (Bug #28341794, Bug #91626) +* MySQL Server now permits a TCP/IP port to be configured + specifically for administrative connections. This provides an + alternative to the single administrative connection that is + permitted on the network interfaces used for ordinary + connections even when + [`max_connections`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_connections) connections are + already established. The administrative network interface has + these characteristics: + + + The interface is enabled only if the + [`admin_address`](/doc/refman/8.0/en/server-system-variables.html#sysvar_admin_address) system + variable is set at startup to indicate the IP address for + it. If [`admin_address`](/doc/refman/8.0/en/server-system-variables.html#sysvar_admin_address) is not + set, the server maintains no administrative interface. + + The [`admin_port`](/doc/refman/8.0/en/server-system-variables.html#sysvar_admin_port) system + variable specifies the interface TCP/IP port number (default + 33062). + + There is no limit on the number of administrative + connections, but connections are permitted only for users + who have the + [`SERVICE_CONNECTION_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_service-connection-admin) + privilege. + + The + [`create_admin_listener_thread`](/doc/refman/8.0/en/server-system-variables.html#sysvar_create_admin_listener_thread) + system variable enables DBAs to choose at startup whether + the administrative interface has its own separate thread. + The default is `OFF`; that is, the manager + thread for ordinary connections on the main interface also + handles connections for the administrative interface. + + Thanks to Facebook for suggesting the idea (and for contributing + code, although it was not used). + (Bug #27847672, Bug #90395, WL #12138) + +### Deprecation and Removal Notes + +* The deprecated **resolveip** and + **resolve\_stack\_dump** utilities have been + removed and are no longer included in MySQL distributions. + **nslookup**, **host**, or + **dig** can be used instead of + **resolveip**. Stack traces from official MySQL + builds are always symbolized, so there is no need to use + **resolve\_stack\_dump**. + (WL #12619, WL #12620) + +### SQL Function and Operator Notes + +* The [`JSON_ARRAYAGG()`](/doc/refman/8.0/en/aggregate-functions.html#function_json-arrayagg) and + [`JSON_OBJECTAGG()`](/doc/refman/8.0/en/aggregate-functions.html#function_json-objectagg) aggregate + functions now can be used as window functions, if an + `OVER` clause is present. See + [Aggregate Function Descriptions](/doc/refman/8.0/en/aggregate-functions.html). + (WL #11574) + +### Logging Notes + +* A new system variable, + [`log_slow_extra`](/doc/refman/8.0/en/server-system-variables.html#sysvar_log_slow_extra), if enabled, + causes the server to write additional fields to slow query log + lines that provide information about slow statements. In + addition, + [`SET`](/doc/refman/8.0/en/set-variable.html) + lines written to the log to indicate statement timestamps now + use the time from the beginning of statement execution, rather + than the time at the end of execution. See + [The Slow Query Log](/doc/refman/8.0/en/slow-query-log.html). Thanks to Facebook for the + contribution on which this feature is based. + (Bug #27535580, Bug #89637, WL #12393) +* Binary log files and relay log files can now be encrypted, + helping to protect these files and the potentially sensitive + data contained in them from being misused by outside attackers, + and also from unauthorized viewing by users of the operating + system where they are stored. + + You enable encryption on a MySQL server by setting the new + [`binlog_encryption`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_encryption) system + variable to `ON`. `OFF` is the + default. The system variable sets encryption on for binary log + files and relay log files. When you first start the server with + encryption enabled, a new binary log encryption key is generated + before the binary log and relay logs are initialized. This key + is used to encrypt a file password for each binary log file (if + the server has binary logging enabled) and relay log file (if + the server has replication channels), and further keys generated + from the file passwords are used to encrypt the data in the + files. + + If you activate encryption while the server is running, a new + binary log encryption key is generated at that time, and the + binary log files and relay log files are rotated so that the new + and subsequent files are encrypted. If you deactivate encryption + by changing the + [`binlog_encryption`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_encryption) system + variable to `OFF`, the binary log file and + relay log files are rotated immediately and all subsequent + logging is unencrypted. Previously encrypted files are not + automatically decrypted, but the server is still able to read + them. (The [`SHOW BINARY LOGS`](/doc/refman/8.0/en/show-binary-logs.html) + statement now shows whether each binary log file is encrypted or + unencrypted.) `SUPER` privileges or the new + `BINLOG_ENCRYPTION_ADMIN` privilege are + required to activate or deactivate encryption while the server + is running. + + The encryption algorithm used for the files, the AES (Advanced + Encryption Standard) cipher algorithm, is built in to MySQL + Server and cannot be configured. The binary log encryption keys + used to encrypt the file passwords for the log files are 256-bit + keys that are generated specifically for each MySQL server + instance using MySQL Server's built-in keyring service. The + binary log encryption key that is currently in use on the server + is called the binary log master key. + + The new + [`binlog_rotate_encryption_master_key_at_startup`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_rotate_encryption_master_key_at_startup) + system variable controls whether the binary log master key is + automatically rotated when the server is restarted. If this + system variable is set to `ON`, a new binary + log encryption key is generated and used as the new binary log + master key whenever the server is restarted. If it is set to + `OFF`, which is the default, the existing + binary log master key is used again after the restart. + + Note that when encryption is active for a MySQL server instance, + only the data at rest that is written to the binary log files + and relay log files is encrypted. The data in motion in the + replication event stream, which is sent to MySQL clients + including **mysqlbinlog**, is always in + unencrypted format, so it must be protected in transit by the + use of connection encryption. The data in use that is held in + the binary log transaction and statement caches during a + transaction, and any data that exceeds the space available in + those caches and is therefore stored in a temporary file on + disk, is also in unencrypted format. The temporary files and + caches are deleted when the thread that handles the transaction + ends. + (WL #10957) +* Server logging behavior has changed with respect to error log + messages generated prior to processing startup options that + specify logging configuration. Previously, the server generated + messages with the default timestamp, format, and verbosity + level; buffered them; and then flushed them after the error log + configuration became known. Because these early messages used + the default logging configuration, they could differ from what + is specified by the startup options. + + Now, the server buffers log events rather than formatted log + messages. This enables it to retroactively apply configuration + settings to those events after the settings are known, with the + result that flushed messages use the configured settings, not + the defaults. For more information, see + [Error Log Output Format](/doc/refman/8.0/en/error-log-format.html). + (WL #11875) + +### Optimizer Notes + +* Previously, derived tables and common table expressions could + not contain outer references. Outer references are now + permitted. + (WL #461) + +### Packaging Notes + +* Ubuntu 18.10 and Fedora 29 install OpenSSL 1.1.1 by default, but + OpenSSL 1.1.1 is not fully supported by MySQL. To install MySQL, + the OpenSSL 1.0.2 compatibility package must be installed. + (Bug #28981868) + +### Performance Schema Notes + +* The Performance Schema statement event tables + ([`events_statements_current`](/doc/refman/8.0/en/performance-schema-events-statements-current-table.html), + [`events_statements_history`](/doc/refman/8.0/en/performance-schema-events-statements-history-table.html), and + [`events_statements_history_long`](/doc/refman/8.0/en/performance-schema-events-statements-history-long-table.html)) now + have a `STATEMENT_ID` column that indicates the + query ID maintained by the server at the SQL level. Column + values are unique for the server instance because they are + generated using a global counter that is incremented atomically. + (WL #12165) + +### Pluggable Authentication + +* If the LDAP port number is configured as 636 or 3269, the plugin + now uses LDAPS (LDAP over SSL) instead of LDAP. The port number + is settable using the + [`authentication_ldap_sasl_server_port`](/doc/refman/8.0/en/pluggable-authentication-system-variables.html#sysvar_authentication_ldap_sasl_server_port) + or + [`authentication_ldap_simple_server_port`](/doc/refman/8.0/en/pluggable-authentication-system-variables.html#sysvar_authentication_ldap_simple_server_port) + system variable. (LDAPS differs from + `startTLS`.) + (Bug #28743563) +* Previously, for LDAP authentication with proxying, LDAP + authentication plugins used the first group name returned by the + LDAP server as the MySQL proxied user account name. The + authentication string for a MySQL account now can specify a list + of groups to match, in preference order, and can optionally map + the matching group name to a specified MySQL proxied user name. + See [LDAP Pluggable Authentication](/doc/refman/8.0/en/ldap-pluggable-authentication.html). + (WL #12005) + +### Security Notes + +* The OpenSSL libraries bundled with MySQL on some platforms + (Windows, macOS, and Generic Linux) have been upgraded to + version 1.0.2q. On all other platforms, MySQL uses the system + installed OpenSSL. Issues fixed in the new OpenSSL version are + described at + . + (Bug #28988091) +* To affect subsequent server restarts, the + [`SET + PERSIST`](/doc/refman/8.0/en/set-variable.html) and + [`SET + PERSIST_ONLY`](/doc/refman/8.0/en/set-variable.html) statements enable system variables to be + persisted to the `mysqld-auto.cnf` option + file in the data directory. However, some system variables + cannot be persisted (for example, because they involve sensitive + data). Consequently, they cannot be set at runtime from within a + session conducted by a remote administrator, and thus require + the administrator to log into the server host and directly + modify a `my.cnf` option file. + + MySQL now permits users to perform runtime administration of + many previously nonpersistible system variables, so that they + can be persisted under certain restrictive conditions. To enable + this capability, designate an SSL certificate X.509 Subject + value that signifies the ability to persist these restricted + system variables, and set the new + [`persist_only_admin_x509_subject`](/doc/refman/8.0/en/server-system-variables.html#sysvar_persist_only_admin_x509_subject) + system variable to that Subject value. Users who connect to the + server using an encrypted connection and supply an SSL + certificate with the designated Subject value then can use + [`SET + PERSIST_ONLY`](/doc/refman/8.0/en/set-variable.html) to persist persist-restricted system + variables. For more information, see + [Nonpersistible and Persist-Restricted System Variables](/doc/refman/8.0/en/nonpersistible-system-variables.html). + (WL #12086) +* For most system variables, setting the session value requires no + special privileges and can be done by any user to affect the + current session. For some system variables, setting the session + value can have effects outside the current session and thus is a + restricted operation that can be done only by users who have a + special privilege. Previously, either + [`SYSTEM_VARIABLES_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_system-variables-admin) or + [`SUPER`](/doc/refman/8.0/en/privileges-provided.html#priv_super) qualified as such a + privilege, but both privileges also permit operations other than + setting session variables. The new + [`SESSION_VARIABLES_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_session-variables-admin) privilege + makes it possible to grant users *only* the + ability to set restricted session variables without also + enabling other operations. + + Any operation permitted by + [`SESSION_VARIABLES_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_session-variables-admin) is also + permitted by + [`SYSTEM_VARIABLES_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_system-variables-admin) or + [`SUPER`](/doc/refman/8.0/en/privileges-provided.html#priv_super), so any user who already + has one of the latter privileges effectively has + [`SESSION_VARIABLES_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_session-variables-admin) by + implication and need not be granted + [`SESSION_VARIABLES_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_session-variables-admin) + explicitly. However, if a user has been granted + [`SYSTEM_VARIABLES_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_system-variables-admin) or + [`SUPER`](/doc/refman/8.0/en/privileges-provided.html#priv_super) only for the purpose of + enabling that user to modify restricted session system + variables, an administrator can reduce the user's privilege + footprint by revoking + [`SYSTEM_VARIABLES_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_system-variables-admin) and + [`SUPER`](/doc/refman/8.0/en/privileges-provided.html#priv_super), and granting + [`SESSION_VARIABLES_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_session-variables-admin) instead. + For instructions, see + [System Variable Privileges](/doc/refman/8.0/en/system-variable-privileges.html). + + These previously restricted session variables required + [`SYSTEM_VARIABLES_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_system-variables-admin) or + [`SUPER`](/doc/refman/8.0/en/privileges-provided.html#priv_super) but now can also be set + with [`SESSION_VARIABLES_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_session-variables-admin): + + ```None + binlog_format + binlog_row_image + binlog_row_value_options + binlog_rows_query_log_events + debug + debug_sync + default_collation_for_utf8mb4 + explicit_defaults_for_timestamp + gtid_next + histogram_generation_max_mem_size + original_commit_timestamp + sql_log_bin + sql_log_off + sql_require_primary_key + ``` + + These previously unrestricted session variables now are + restricted and setting them requires at least + [`SESSION_VARIABLES_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_session-variables-admin) (they can + also be set by users who have + [`SYSTEM_VARIABLES_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_system-variables-admin) or + [`SUPER`](/doc/refman/8.0/en/privileges-provided.html#priv_super)): + + ```None + auto_increment_increment + auto_increment_offset + binlog_direct_non_transactional_updates + bulk_insert_buffer_size + character_set_filesystem + character_set_database + collation_database + pseudo_slave_mode + pseudo_thread_id + rbr_exec_mode + transaction_write_set_extraction + ``` + + (WL #12217) + +### Spatial Data Support + +* The [`ST_Distance()`](/doc/refman/8.0/en/spatial-relation-functions-object-shapes.html#function_st-distance) function now + takes an optional third argument enabling the unit for the + return value to be specified. Permitted units are those listed + in the new `INFORMATION_SCHEMA` + [`ST_UNITS_OF_MEASURE`](/doc/refman/8.0/en/information-schema-st-units-of-measure-table.html) table. See + [Spatial Relation Functions That Use Object Shapes](/doc/refman/8.0/en/spatial-relation-functions-object-shapes.html), and + [The INFORMATION\_SCHEMA ST\_UNITS\_OF\_MEASURE Table](/doc/refman/8.0/en/information-schema-st-units-of-measure-table.html). + (WL #11000) + +### SQL Syntax Notes + +* A derived table now may be preceded by the + `LATERAL` keyword to specify that it is + permitted to refer to (depend on) columns of preceding tables in + the same `FROM` clause. A derived table + specified with `LATERAL` can occur only in a + `FROM` clause, either in a list of tables + separated with commas or in a join specification + (`JOIN`, `INNER JOIN`, + `CROSS JOIN`, `LEFT [OUTER] + JOIN`, or `RIGHT [OUTER] JOIN`). + Lateral derived tables make possible certain SQL operations that + cannot be done with nonlateral derived tables or that require + less-efficient workarounds. See + [Lateral Derived Tables](/doc/refman/8.0/en/lateral-derived-tables.html). + + Note + + `LATERAL` now is a reserved word and cannot + be used as an identifier without identifier quoting. + + (WL #8652) + +### Thread Pool Notes + +* The `INFORMATION_SCHEMA` tables that accompany + the thread pool plugin have been migrated to be available as + Performance Schema tables. The + `INFORMATION_SCHEMA` tables now are deprecated + and will be removed in a future MySQL version. Applications + should transition away from the old tables to the new tables. + For example, if an application uses this query: + + ```None + SELECT * FROM INFORMATION_SCHEMA.TP_THREAD_STATE; + ``` + + The application should use this query instead: + + ```None + SELECT * FROM performance_schema.tp_thread_state; + ``` + + For more information, see + [Performance Schema Thread Pool Tables](/doc/refman/8.0/en/performance-schema-thread-pool-tables.html). + (WL #11547) + +### X Plugin Notes + +* X Plugin now includes the 5-digit SQLSTATE error code in its + error handling class. Previously, the SQLSTATE error code was + returned to clients for SQL errors, but only the MySQL-specific + error number was exposed. + (Bug #28735058) +* When querying collections of documents, if boolean values were + used as arguments for a placeholder in an SQL query, unexpected + results were returned. A new translation specialization has now + been added for boolean values so that they are handled correctly + in this situation. + (Bug #28227037) +* X Protocol now always converts retrieved data to the + `utf8mb4` character set (using the + `utf8mb4_general_ci` collation) before + returning it. + (Bug #28180155) +* X Protocol now supports SQL prepare functionality. + (WL #9270) + +### Functionality Added or Changed + +* **InnoDB:** + Disabling the `innodb_buffer_pool_in_core_file` + variable reduces the size of core files by excluding + `InnoDB` buffer pool pages. To use this + variable, the [`core_file`](/doc/refman/8.0/en/server-system-variables.html#sysvar_core_file) + variable must be enabled and the operating system must support + the `MADV_DONTDUMP` non-POSIX extension to + `madvise()`, which is supported in Linux 3.4 + and later. For more information, see + [Excluding Buffer Pool Pages from Core Files](/doc/refman/8.0/en/innodb-buffer-pool-in-core-file.html). + + Thanks to Facebook for the contribution. + (Bug #27724476, Bug #90144) +* **InnoDB:** + By default, undo logs reside in two undo tablespaces that are + created when the MySQL instance is initialized. + + Additional undo tablespaces can be created in a chosen location + at runtime using + [`CREATE UNDO + TABLESPACE`](/doc/refman/8.0/en/create-tablespace.html) syntax. + + ```None + CREATE UNDO TABLESPACE tablespace_name ADD DATAFILE 'file_name.ibu'; + ``` + + Undo tablespaces created using + [`CREATE UNDO + TABLESPACE`](/doc/refman/8.0/en/create-tablespace.html) syntax can be dropped at runtime using + [`DROP UNDO + TABLESPACE`](/doc/refman/8.0/en/drop-tablespace.html) syntax. + + ```None + DROP UNDO TABLESPACE tablespace_name; + ``` + + [`ALTER UNDO + TABLESPACE`](/doc/refman/8.0/en/alter-tablespace.html) syntax can be used to mark an undo + tablespace as active or inactive. + + ```None + ALTER UNDO TABLESPACE tablespace_name SET {ACTIVE|INACTIVE}; + ``` + + A `STATE` column that shows the state of a + tablespace was added to the + [`INFORMATION_SCHEMA.INNODB_TABLESPACES`](/doc/refman/8.0/en/information-schema-innodb-tablespaces-table.html) + table. An undo tablespace must be in an `empty` + state before it can be dropped. + + The previously deprecated + [`innodb_undo_tablespaces`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_undo_tablespaces) + variable is no longer configurable and will be removed in a + future MySQL version. + + For more information, see + [Undo Tablespaces](/doc/refman/8.0/en/innodb-undo-tablespaces.html). + (WL #9508) +* **InnoDB:** + `InnoDB` now supports parallel clustered index + reads, which can improve [`CHECK + TABLE`](/doc/refman/8.0/en/check-table.html) performance. This feature does not apply to + secondary index scans. The + [`innodb_parallel_read_threads`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_parallel_read_threads) + session variable must be set to a value greater than 1 for + parallel clustered index reads to occur. The default value is 4. + The actual number of threads used to perform a parallel + clustered index read is determined by the + [`innodb_parallel_read_threads`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_parallel_read_threads) + setting or the number of index subtrees to scan, whichever is + smaller. + (WL #11720) +* **InnoDB:** + The `ADD DATAFILE` clause of the + [`CREATE TABLESPACE`](/doc/refman/8.0/en/create-tablespace.html) statement is + now optional, which permits users without the + [`FILE`](/doc/refman/8.0/en/privileges-provided.html#priv_file) privilege to create + tablespaces. A [`CREATE TABLESPACE`](/doc/refman/8.0/en/create-tablespace.html) + statement executed without an `ADD DATAFILE` + clause implicitly creates a tablespace data file with a unique + file name. + (WL #12236) +* **InnoDB:** + When the server is started with + [`--innodb-dedicated-server`](/doc/refman/8.0/en/innodb-parameters.html#option_mysqld_innodb-dedicated-server), the + size and number of log files are now determined by the buffer + pool which has been set by this option. Previously, log file + size was set according to the amount of memory detected on the + server, and the number of log files was not set automatically. + See [Enabling Automatic InnoDB Configuration for a Dedicated MySQL Server](/doc/refman/8.0/en/innodb-dedicated-server.html). + (WL #12300) +* **Replication:** + Two new session variables have been added for internal use by + replication. + [`original_server_version`](/doc/refman/8.0/en/replication-options-source.html#sysvar_original_server_version) and + [`immediate_server_version`](/doc/refman/8.0/en/replication-options-source.html#sysvar_immediate_server_version) + support cross-version replication by transmitting the MySQL + server release numbers associated with a transaction through the + replication topology. + [`original_server_version`](/doc/refman/8.0/en/replication-options-source.html#sysvar_original_server_version) holds + the MySQL Server release number of the server where a + transaction was originally committed (for example, + `80014` for a MySQL 8.0.14 server instance). + [`immediate_server_version`](/doc/refman/8.0/en/replication-options-source.html#sysvar_immediate_server_version) holds + the MySQL Server release number of the server that is the + immediate master in a replication topology. If either of those + servers, or another intervening server in the replication + topology, is at an older release that does not support these + session system variables, their values are set to 0. + + With this information the slave can correctly process data + originating from a master at an older release, by recognizing + where syntax changes or semantic changes have occurred between + the releases involved and handling these appropriately. The + information can also be used in a Group Replication environment + where one or more members of the replication group is at a newer + release than the others. The value of the variable can be viewed + in the binary log for each transaction (as part of the + `Gtid_log_event`, or + `Anonymous_gtid_log_event` if GTIDs are not in + use on the server), and could be helpful in debugging + cross-version replication issues. + (WL #11879) +* **Replication:** + When running a group in single-primary mode, in the event of a + new primary being elected while there were transactions held in + the backlog to be applied, there was a chance that a read + operation against the new primary could return a stale value. + Now, you can use the + [`group_replication_consistency`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_consistency) + variable to control how a group behaves in this situation. When + [`group_replication_consistency`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_consistency) + is set to `EVENTUAL`, a new primary responds to + read requests even when there is a backlog which has not yet + been applied, which matches the previous behavior and comes with + the risk that a client could read old values while any backlog + is being applied. Writes to the new primary fail during this + period because it is has + [`super_read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only) mode enabled. + When + [`group_replication_consistency`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_consistency) + is set to `BEFORE_ON_PRIMARY_FAILOVER`, any new + read or write queries against a newly elected primary that is + applying backlog from the old primary are held until the backlog + is applied. This ensures that clients always read the newest + value which they have written, but also means that clients might + have to wait until the backlog has been applied before they can + read from the new primary. + (WL #11123) + + References: See also: Bug #26004894. +* **Group Replication:** + The Group Communication System (GCS) and group communication + engine (XCom, a Paxos variant) for Group Replication now provide + full support for IPv6, so replication group members can use IPv6 + addresses as an alternative to IPv4 addresses for internal group + communications. The localhost address for IPv6, and the private + subnetwork addresses for IPv6 (unique-local addresses and + link-local unicast addresses), are added to the automatic + whitelist for Group Replication for use if no manual whitelist + is specified. + + If all members of a replication group are at a MySQL server + version that supports the use of IPv6 addresses for Group + Replication, the group can contain a mix of members using IPv6 + addresses and members using IPv4 addresses. Joining members must + provide whitelisted IP addresses or host names that match the + protocols offered by the seed members for connection, but the + joining member's main identifying address or host name + ([`group_replication_local_address`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_local_address)) + can use either protocol. If a member uses a host name that + resolves to both an IPv4 and an IPv6 address, the IPv4 address + is always used for Group Replication connections. + + If any or all existing members of a replication group use an + older MySQL Server version without support for the use of IPv6 + addresses for Group Replication, joining members must present an + IPv4 address for group communications in the + [`group_replication_local_address`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_local_address) + option. When every group member has been upgraded, the group can + be migrated to IPv6 addresses. + (Bug #26088469, Bug #27757729, Bug #90217, WL #11926) +* **Group Replication:** + MySQL Group Replication can now communicate using a dedicated + input channel as an alternative to using a TCP socket. The new + input channel uses shared memory for communication between the + Group Replication logic and the local instance of the underlying + group communication engine (XCom, a Paxos variant). + + Previously, communication with the local XCom instance always + took place using a TCP socket, namely the network address that + is specified by the + [`group_replication_local_address`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_local_address) + system variable for each group member. This incurred overheads + that were unnecessary for local communication, such as memory + copying through the network protocol stack and data + serialization. A TCP socket + ([`group_replication_local_address`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_local_address)) + is still required for each group member to communicate with + remote XCom instances. The Group Communication System (GCS) + component of Group Replication now selects the most appropriate + communication method for each Group Replication task, either the + input channel or TCP. For example, the process of joining a + group requires communication with a remote XCom instance, so TCP + must be used. However, the process of removing a member from a + group only requires communication with the local XCom instance, + so the input channel is used. The input channel is selected + wherever possible to minimize the overheads associated with + communication using networking mechanisms. + (WL #9850) +* **Microsoft Windows:** + The access control granted to clients on the named pipe created + by the MySQL server now is set to the minimum necessary for + successful communication on Windows. Newer MySQL client software + can open named pipe connections without any additional + configuration. If older client software cannot be upgraded + immediately, the new + [`named_pipe_full_access_group`](/doc/refman/8.0/en/server-system-variables.html#sysvar_named_pipe_full_access_group) + server system variable can be used to give a Windows group the + necessary permissions to open a named pipe connection. + Membership in the full-access group should be restricted and + temporary. + (WL #12445) +* The minimal server RPM is mostly used for Docker images. For + better Docker compatibility, the `log-error` + line has been removed from the `rpm-docker` + configuration file. This way, logging goes to + `stdout`/`stderr`, enabling + use of Docker's own interface. + (Bug #28692675) +* Error messages relating to creating and dropping foreign keys + were improved to be more specific and informative. + (Bug #28526309, Bug #92087) +* The error message for `ALTER TABLE` statements + that attempted character set conversion but failed was improved + to indicate which column produced the error. + (Bug #27546306, Bug #88738) +* Previously, for command options that take a numeric value, the + value could be given with a suffix of `K`, + `M`, or `G` to indicate a + multiplier of 1024, 10242 or + 10243. Now a suffix can also be + `T`, `P`, and + `E` to indicate a multiplier of + 10244, + 10245 or + 10246. Thanks to Daniel Black for the + patch. + (Bug #27306931, Bug #89017) +* Resource group locking was revised to improve scalability and + performance. + (Bug #27148580) +* The startup option + [`--binlog-row-event-max-size`](/doc/refman/8.0/en/replication-options-binary-log.html#option_mysqld_binlog-row-event-max-size) now + has a corresponding system variable + [`binlog_row_event_max_size`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_row_event_max_size). The + startup option and system variable set a soft limit on the + maximum size of a row-based binary log event, with a default + setting of 8192 bytes. Where possible, rows stored in the binary + log are grouped into events with a size not exceeding the value + of this setting. If an event cannot be split, the maximum size + can be exceeded. + + The [`binlog_row_event_max_size`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_row_event_max_size) + global system variable is read-only and can be set only at + server startup. Its value can therefore only be modified by + using the `PERSIST_ONLY` keyword or the + `@@persist_only` qualifier with the + [`SET`](/doc/refman/8.0/en/set.html) statement. The addition of a + system variable means that this setting can be viewed using the + Performance Schema tables or a [`SHOW + VARIABLES`](/doc/refman/8.0/en/show-variables.html) or [`SELECT`](/doc/refman/8.0/en/select.html) + statement. + (Bug #19985377, Bug #74728, WL #12385) +* [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) now can be used to + change a column character set in place (without a table + rebuild), when these conditions apply: + + + The column data type is [`CHAR`](/doc/refman/8.0/en/char.html), + [`VARCHAR`](/doc/refman/8.0/en/char.html), a + [`TEXT`](/doc/refman/8.0/en/blob.html) type, or + [`ENUM`](/doc/refman/8.0/en/enum.html). + + The character set change is from `utf8mb3` + to `utf8mb4`, or any character set to + `binary`. + + There is no index on the column. + + (WL #11605) +* The new [`-DFORCE_INSOURCE_BUILD`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_force_insource_build) + **CMake** option defines whether to force an + in-source build. Out-of-source builds are recommended, as they + permit multiple builds from the same source, and cleanup can be + performed quickly by removing the build directory. To force an + in-source build, invoke **CMake** with + [`-DFORCE_INSOURCE_BUILD=ON`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_force_insource_build). + +### Bugs Fixed + +* **Important Change:** + Importing a dump from a MySQL 5.7 server to a server running + MySQL 8.0 often failed with + [`ER_WRONG_VALUE_FOR_VAR`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_wrong_value_for_var) when an + SQL mode not supported by the 8.0 server was used. This could + happen frequently due to the fact that + `NO_AUTO_CREATE_USER` is + enabled by default in MySQL 5.7 but not supported in MySQL 8.0. + + The behavior of the server in such circumstances now depends on + the setting of the + [`pseudo_slave_mode`](/doc/refman/8.0/en/server-system-variables.html#sysvar_pseudo_slave_mode) system + variable. If this is false, the server rejects the mode setting + with [`ER_UNSUPPORTED_SQL_MODE`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_unsupported_sql_mode). If + `pseudo_slave_mode` is true, the server ignores + the unsupported mode and gives a warning. Note that + **mysqlbinlog** sets + `pseudo_slave_mode` to true prior to executing + any SQL. + (Bug #90337, Bug #27828236) +* **InnoDB:** + Global and backup metadata locks were not released after the + background purge thread truncated undo logs. + (Bug #29215254, Bug #93901) +* **InnoDB:** + MySQL would not start on Solaris X86. The static thread-local + 'tables' variable in the TempTable storage engine was not + properly initialized. + (Bug #28987365) +* **InnoDB:** + Latching logic used during deadlock detection was simplified. + (Bug #28904966) +* **InnoDB:** + An invalid record offset for an old version of a clustered index + record raised a debug assertion. + (Bug #28825617) + + References: This issue is a regression of: Bug #25540277. +* **InnoDB:** + The minimum DML delay imposed when the length of the history + list exceeds + [`innodb_max_purge_lag`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_max_purge_lag) was + decreased from 5000 microseconds to 5 microseconds. + (Bug #28813453) +* **InnoDB:** + An incorrect lock order caused a deadlock when one thread + attempted to drop a table while another created an encrypted + tablespace. + (Bug #28774259) +* **InnoDB:** + [`ALTER TABLESPACE`](/doc/refman/8.0/en/alter-tablespace.html) failed to ignore + unsupported tablespace attributes. + (Bug #28656611) +* **InnoDB:** + Implicit to explicit lock conversion logic was simplified and + optimized. + (Bug #28637472) +* **InnoDB:** + A fragment page allocation failure raised an assertion. + (Bug #28615893) +* **InnoDB:** + Incorrectly placed debug points caused flushed LOB pages to be + considered corrupt. + (Bug #28607368) +* **InnoDB:** + The `TempTable` storage engine incorrectly + created temporary files in the system temporary directory + instead of the directory defined by the + [`tmpdir`](/doc/refman/8.0/en/server-system-variables.html#sysvar_tmpdir) variable. + (Bug #28598943) +* **InnoDB:** + Attempting to drop a table with a name similar to that of a + full-text search auxiliary table caused an assertion failure. + (Bug #28577083) +* **InnoDB:** + A function called by an [`UPDATE`](/doc/refman/8.0/en/update.html) + query did not account for virtual columns. + (Bug #28560650) +* **InnoDB:** + An incorrect key was defined for the buffer pool zip hash mutex. + (Bug #28556539) +* **InnoDB:** + Deadlock handling for background transactions that involve the + `mysql.innodb_table_stats` and + `mysql.innodb_index_stats` tables was modified. + The tables were incorrectly included in an assertion that is + triggered when internal tables are included in a deadlock cycle. + (Bug #28523042, Bug #92069) +* **InnoDB:** + Setting [`innodb_spin_wait_delay`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_spin_wait_delay) + to a high value caused an assertion failure when attempting to + shut down the server. To prevent this failure from occurring, + the [`innodb_spin_wait_delay`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_spin_wait_delay) + maximum value was reduced to 1000. + (Bug #28489407, Bug #91973) +* **InnoDB:** + An `ON DELETE CASCADE` operation on table with + a foreign key constraint and an indexed virtual column caused + the server to exit. + (Bug #28470805) +* **InnoDB:** + An incorrectly written DML log involving a virtual column value + raised an assertion. + (Bug #28448853) +* **InnoDB:** + A [`RENAME TABLE`](/doc/refman/8.0/en/rename-table.html) operation failed + when run on a table created outside of the MySQL data directory + using the `DATA DIRECTORY` clause. + (Bug #28341514) +* **InnoDB:** + `ALTER TABLE ... EXCHANGE PARTITION` permitted + partitions with different virtual column definitions to be + exchanged, which resulted in an assertion when + `InnoDB` later attempted to read from a + nonexistent virtual column. + (Bug #28235668) +* **InnoDB:** + A counter was added for redo log write and flush requests that + occur during transaction commit. The counter is used by the log + writer thread to compute the average time between consecutive + requests. When the average time is greater than 100 + microseconds, log writer threads do not use spin delay and + instead wait on request events with a 10 microsecond timeout + limit. + + A log writer thread implementation issue that could cause a hang + was also fixed. + (Bug #28062382, Bug #28444247, Bug #28616442, Bug #90890) +* **InnoDB:** + An assertion was raised when attempting to add rollback segments + to newly added undo tablespace that was not fully initialized. + (Bug #27914054) +* **InnoDB:** + Foreign key constraints were ignored after a + [`RENAME TABLE`](/doc/refman/8.0/en/rename-table.html) operation. + (Bug #27453180, Bug #89441) +* **InnoDB:** + Using the `O_DIRECT_NO_FSYNC` + [`innodb_flush_method`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_flush_method) setting + could cause the system to hang due to file system metadata + becoming unsynchronized. To prevent this issue from occurring in + `O_DIRECT_NO_FSYNC` mode, + `InnoDB` now calls `fsync()` + after creating a new file, after increasing file size, and after + closing a file. The `fsync()` system call is + still skipped after each write operation. + (Bug #27309336) +* **InnoDB:** + Specifying the [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) or + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) + `ENCRYPTION` option with an empty string failed + to raise an error and was interpreted as a default setting, + which is `ENCRYPTION='N'`. Specifying an empty + string is now treated as invalid and raises an error. + (Bug #27177845) +* **InnoDB:** + Partitioned table name delimiters (the `#P#` or + `#SP#` part of a partitioned table name) were + not converted to lowercase when moving tablespace data files + from a MySQL instance on Windows to a MySQL instance on Linux + where the + [`lower_case_table_names`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names) variable + was enabled. Failure to fully convert names to lowercase caused + errors such as “'InnoDB error' from storage engine” + when attempting to alter, rename, or optimize the tables. + (Bug #26925260) +* **InnoDB:** + An assertion was raised when attempting to write to a tablespace + file greater than 4GB in size on a 64-bit Windows system. The + failure was due to a narrowing cast. + (Bug #26636815, Bug #87423) +* **InnoDB:** + After attempting to create a table with a foreign key constraint + that referenced a partitioned table, which is an unsupported + operation, [`SHOW + ENGINE INNODB STATUS`](/doc/refman/8.0/en/show-engine.html) output incorrectly reported a + foreign key error indicating that the referenced table name + could not be resolved. This error no longer appears, and the + error message returned to the client now states that foreign + keys are not yet supported in conjunction with partitioning. + (Bug #25319071, Bug #84331) +* **InnoDB:** + Misleading error messages were reported for unsupported foreign + key operations, including creating a foreign key that referenced + a partitioned table, and referencing a table that uses a storage + engine that does not support foreign keys. The error messages + are now more informative. + (Bug #11747571, Bug #33027) +* **Partitioning:** + Trying to perform an instant add column on a discarded + tablespace led to an assert. An error is now returned in such + cases. + (Bug #28517843) +* **Partitioning:** + Repeated [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) statements + on partitioned tables containing + [`BLOB`](/doc/refman/8.0/en/blob.html) or + [`TEXT`](/doc/refman/8.0/en/blob.html) columns were not always + handled correctly. + (Bug #28491099) +* **Partitioning:** + [`ALTER + TABLE ... EXCHANGE PARTITION`](/doc/refman/8.0/en/partitioning-management-exchange.html) did not work when the + partitioned table had one or more partition definitions using + the `DATA DIRECTORY` option. This fix supports + partitioned tables using the [`InnoDB`](/doc/refman/8.0/en/innodb-storage-engine.html) + storage engine only. + (Bug #19730200) +* **Replication:** + Depending on the value of + [`group_replication_exit_state_action`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_exit_state_action), + the behavior of members exiting a group was not consistent. To + harmonize the behavior of members exiting the group regardless + of the error scenario, now when a member with + [`group_replication_exit_state_action=READ_ONLY`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_exit_state_action) + exits the group unintentionally, the + [`super_read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only) mode that the + member had when started is restored. This makes the behavior + consistent with that of a member with + [`group_replication_exit_state_action=ABORT_SERVER`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_exit_state_action). + (Bug #28971639, Bug #28526591) +* **Replication:** + The metadata written to the binary log for + [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) statements includes + character set information for the character columns in the + table. Previously, when the **mysqlbinlog** + option `--print-table-metadata` was specified, a + default character set was printed for the table. This default + character set was the character set that appeared most + frequently in the table columns, and might not match the default + character set that had been specified for the table. + **mysqlbinlog** now prints the character set for + each column individually. The columns are also printed on + separate lines. + (Bug #28774144) +* **Replication:** + Character set information was not written to the binary log as + part of the table metadata for + [`ENUM`](/doc/refman/8.0/en/enum.html) and + [`SET`](/doc/refman/8.0/en/set.html) columns. This information is + now added when + [`binlog_row_metadata=FULL`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_row_metadata) is + set, which produces extended metadata. (For character columns, + character set information is also added with + [`binlog_row_metadata=MINIMAL`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_row_metadata).) + (Bug #28706307) +* **Replication:** + A patch to correct the handling of quotes for identifiers in + `ROLLBACK TO SAVEPOINT` statements in the + binary log was not correctly applied to subsequent MySQL + versions. + (Bug #28569645) +* **Replication:** + Following a patch in MySQL 5.7.23, [`LOAD + DATA`](/doc/refman/8.0/en/load-data.html) statements stopped statement-based replication + from a MySQL 5.7.22 master to a replication slave at a later + release. The problem has now been fixed. + (Bug #28541204, Bug #92132) +* **Replication:** + In some circumstances, the [`CHANGE MASTER + TO`](/doc/refman/8.0/en/change-master-to.html) statement could not be used on a replication slave + if the master info log had been changed from a table + ([`master_info_repository=TABLE`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_master_info_repository)) + into a file + ([`master_info_repository=FILE`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_master_info_repository)). + (Bug #28529558) +* **Replication:** + **mysqlbinlog** incorrectly added statements to + set the [`sql_require_primary_key`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_require_primary_key) + system variable (which was introduced in MySQL 8.0.13) to + `ON` for events involving DML SQL statements. + The check carried out when the system variable is set to + `ON` is only relevant for DDL SQL statements + that create new tables or alter the structure of existing + tables. + (Bug #28524803) +* **Replication:** + When the system variables + [`binlog_transaction_dependency_tracking`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_transaction_dependency_tracking) + and + [`binlog_transaction_dependency_history_size`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_transaction_dependency_history_size) + were set or read, the types of lock that were required could + result in a deadlock scenario, because the same locks were also + required for working with the active binary logs. A new lock + type is now used instead for access to the transaction + dependency tracking system variables, so that this deadlock + cannot occur. + (Bug #28511326, Bug #91941, Bug #28537209, Bug #92108) +* **Replication:** + An assertion was raised in debug builds if an implicit commit + was attempted when the GTID value for the next transaction had + not yet been determined + ([`gtid_next=NOT_YET_DETERMINED`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_next)). + The [`gtid_next`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_next) system variable + has this value immediately after the internal-use statement + [`BINLOG`](/doc/refman/8.0/en/binlog.html) has been issued by + **mysqlbinlog** to execute a format description + event. If a statement with an implicit commit was attempted next + (such as a [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) + statement), the [`gtid_next`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_next) + setting did not transition to `AUTOMATIC` + state, and was left in an unacceptable state. If autocommit was + on, the error + [`ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_cant_set_gtid_next_to_anonymous_when_gtid_mode_is_on) + was also logged when the statement was attempted. + + To fix this issue, the use of the + [`BINLOG`](/doc/refman/8.0/en/binlog.html) statement is now prevented + during transactions if it would change the state of + [`gtid_next`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_next). The error + [`ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_variable_not_settable_in_transaction) + is returned if this is attempted. Also, when GTIDs are in use + and the value of [`gtid_next`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_next) is + `NOT_YET_DETERMINED`, the next statement must + either explicitly set [`gtid_next`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_next) + to a valid value or leave the GTID state unaffected. Otherwise + the error + [`ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_cant_set_gtid_next_to_anonymous_when_gtid_mode_is_on) + is returned. + (Bug #28490793, Bug #91980) +* **Replication:** + The `PURGE BINARY LOGS TO + 'log_name'` statement failed + for binary log files that had been moved to another location + using **mysqlbinlogmove**. Such files are still + listed in the binary log index file, but they are listed using + an absolute path, rather than a path relative to the directory + where the binary log files are normally stored. MySQL Server can + now locate and purge moved binary log files successfully. + (Bug #28284624) +* **Replication:** + When [`binlog_format`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_format) is set to + `MIXED`, if a function contained DML statements + that applied to a temporary table, and also a + [`DROP TEMPORARY + TABLE`](/doc/refman/8.0/en/drop-table.html) statement, the function call was not written to + the binary log, which caused replication errors. The function + call is now written to the binary log in mixed replication mode + if the function contains DML statements that operate on a + temporary table. + (Bug #28258992) +* **Replication:** + If [`autocommit`](/doc/refman/8.0/en/server-system-variables.html#sysvar_autocommit) was set to 0 for + a replication slave or Group Replication group member where + GTIDs were in use and + [`super_read_only=ON`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only) was set, + server shutdown was prevented by a transaction that did not + complete. The transaction was attempting to save GTIDs to the + `mysql.gtid_executed` table, but the update + failed because + [`super_read_only=ON`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only) was set. + (With [`autocommit`](/doc/refman/8.0/en/server-system-variables.html#sysvar_autocommit) set to 1, the + transaction would complete in this situation, and the + `mysql.gtid_executed` table would instead be + updated at server startup.) Now, the check for the + [`super_read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only) setting is + skipped for this task, so the transaction is able to save the + GTIDs to the `mysql.gtid_executed` table and + complete regardless of the combination of + [`super_read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only) and + [`autocommit`](/doc/refman/8.0/en/server-system-variables.html#sysvar_autocommit) settings. + (Bug #28183718) +* **Replication:** + An assertion was raised in debug builds if an + [`XA ROLLBACK`](/doc/refman/8.0/en/xa.html) + statement was issued for an unknown transaction identifier when + the [`gtid_next`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_next) value had been + set manually. The server now does not attempt to update the GTID + state if an [`XA + ROLLBACK`](/doc/refman/8.0/en/xa.html) statement fails with an error. + (Bug #27928837, Bug #90640) +* **Replication:** + An assertion was raised in debug builds if a `SELECT... + FOR UPDATE` statement was issued immediately after a + transaction was committed or rolled back, and the transaction + had been assigned a GTID manually using the gtid\_next session + system variable. After + [`gtid_next`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_next) has been used to set + a GTID for a transaction, and the transaction has been committed + or rolled back, another explicit `SET + GTID_NEXT` statement must be issued before any other + statement, otherwise the + [`gtid_next`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_next) value is left + undefined. The `SELECT... FOR UPDATE` statement + caused a GTID consistency violation in this situation because it + acquired write locks, although it did not make any changes. + `SELECT... FOR UPDATE` statements that acquire + write locks now return an error in this situation. + (Bug #27903848, Bug #90547) +* **Replication:** + Under heavy loads, a race condition in binary log group commit + could cause the server to stop unexpectedly. The tracking of + transaction commits has been changed to prevent this situation. + (Bug #27556117) +* **Replication:** + The value returned by a [`SHOW SLAVE + STATUS`](/doc/refman/8.0/en/show-slave-status.html) statement for the total combined size of all + existing relay log files (`Relay_Log_Space`) + could become much larger than the actual disk space used by the + relay log files. The I/O thread did not lock the variable while + it updated the value, so the SQL thread could automatically + delete a relay log file and write a reduced value before the I/O + thread finished updating the value. The I/O thread then wrote + its original size calculation, ignoring the SQL thread's update + and so adding back the space for the deleted file. The + `Relay_Log_Space` value is now locked during + updates to prevent concurrent updates and ensure an accurate + calculation. + (Bug #26997096, Bug #87832) +* **Replication:** + If the relay log index file was temporarily locked for viewing + by a backup process for a replication slave, and MySQL Server + also attempted to access the file at that time for rename or + delete operations, the backup completed with warnings, but MySQL + Server experienced an unexpected halt. MySQL Server now retries + the file access operation a number of times in case this or a + similar scenario is the explanation and the file becomes + available again before long. + (Bug #25839610) +* **Replication:** + With [`sync_binlog=1`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_sync_binlog) set, if the + binary log was rotated during a commit before the binary log end + position was updated, replication stopped on the slave because + the server attempted to use the old binary log end position with + the new binary log file. The server now compares the binary log + file name with the active binary log file when updating the + binary log end position, so that the issue does not occur. + (Bug #22252394, Bug #25524203, Bug #84752) +* **Replication:** + When adding a new member to a group, if the certification + information was too big to transmit, an event was generated that + caused failures in all group members. To avoid this situation, + now if the certification information is too large an error is + generated which makes the joining member leave the group. + (Bug #93130, Bug #91870, Bug #28900691, Bug #28443958) +* **Replication:** + When you used + [`group_replication_switch_to_single_primary_mode()`](/doc/refman/8.0/en/group-replication-functions-for-mode.html#function_group-replication-switch-to-single-primary-mode), + if a member which also had an asynchronous channel encountered + an error, the asynchronous replication channel was not stopped + correctly, and the server could stop unexpectedly. + (Bug #91747, Bug #28382590) +* **Replication:** + It was possible to use the group coordinator based functions + which configure a group, such as + [`group_replication_switch_to_single_primary_mode`](/doc/refman/8.0/en/group-replication-functions-for-mode.html#function_group-replication-switch-to-single-primary-mode), + while members were in the `UNREACHABLE` or + `RECOVERING` state, and this caused the + operation to wait until all members became + `ONLINE`. This could result in the group + coordinator operation never completing successfully. Now, if you + invoke any of these functions on a group in this state, an error + is returned. Ensure all members are `ONLINE` + before attempting to configure the group using the functions. + (Bug #91537, Bug #28284355) +* **Replication:** + When a member joined a group that had a constant peak load, the + member might not be able to move from the + `RECOVERING` to the `ONLINE` + state. The cause was that: + + + the member was waiting in a loop for the complete queue of + transactions that arrived during recovery to be applied, + while new transactions were still arriving. + + even when the complete queue had been applied, the member + was also checking that the applier was paused, which is + unlikely to happen in a continuous peak workload. + + Now, when the recovery completion policy is waiting for + transactions to be applied, the member first waits until one of + the following conditions is fulfilled: + + + the transactions to apply fit within the flow control + configuration. In other words, the transactions to be + applied can be applied during the next flow control + iteration; + + no transactions are being queued or applied, in the case of + an empty recovery queue. + + Then, the member waits for the currently queued transactions in + the `group_replication_applier` channel to be + applied, before the member state changes to + `ONLINE`. + (Bug #89582, Bug #27511404) +* **Group Replication:** + The maximum timeout setting for the waiting period before + expelling a suspect Group Replication group member has been + reduced to 3600 seconds (one hour). Previously, the + [`group_replication_member_expel_timeout`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_member_expel_timeout) + system variable could be set to a value of up to 31536000 + seconds. The new upper limit provides a more reasonable maximum + for the removal of inactive members from the group. The default + setting for the timeout is zero, meaning that inactive members + are liable for expulsion immediately after the 5-second + detection period ends. Specifying a timeout value is useful to + avoid unnecessary expulsions on slower networks, or in the case + of expected transient network failures or machine slowdowns. + (Bug #28656750) +* **Group Replication:** + On systems where the Group Communication System (GCS) used the + `systemd-resolved` service for network name + resolution, if the host name could not be resolved, GCS kept + trying indefinitely. Now, if a retry message is returned from + any name resolution service, GCS makes a limited number of + retries, then concludes that the host name is unresolvable. + (Bug #28177861) +* **Group Replication:** + When a group was being reconfigured online, for example using + [`group_replication_switch_to_multi_primary_mode`](/doc/refman/8.0/en/group-replication-functions-for-mode.html#function_group-replication-switch-to-multi-primary-mode) + or + [`group_replication_set_as_primary`](/doc/refman/8.0/en/group-replication-functions-for-new-primary.html#function_group-replication-set-as-primary), + there was a chance that stopping a member could result in an + unexpected stop. Now, when you issue [`STOP + GROUP_REPLICATION`](/doc/refman/8.0/en/stop-group-replication.html), if the member is part of an online + group that is being reconfigured, the group coordinator is + informed that Group Replication is stopping. The member waits + for the online configuration process to complete any ongoing + actions, but any subsequent actions are cancelled. + (Bug #92829, Bug #28807260) +* **Group Replication:** + When stopping group replication, any channels with pending + transactions could cause a deadlock. + (Bug #92376, Bug #28636768, Bug #28365855) +* **Group Replication:** + When + [`group_replication_exit_state_action`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_exit_state_action) + is set to `ABORT_SERVER`, the Group Replication + plugin now uses the new component service added by + [WL#12003](https://dev.mysql.com/worklog/task/?id=12003) + to shut down MySQL. + (Bug #91793, Bug #28401703) +* **Microsoft Windows:** + MySQL Installer could fail after failure to remove an existing + MySQL service. This is now treated as nonfatal so that + installation operations can continue, but might require a system + restart to permit service cleanup. + (Bug #29016677, Bug #93048) +* **Microsoft Windows:** + When multiple instances of **mysqld** were + started with the [`--no-monitor`](/doc/refman/8.0/en/server-options.html#option_mysqld_no-monitor) + option on the same host for same user, the + `SHUTDOWN` command shut down the wrong server + process. This fix creates a unique shutdown event name for use + with [`--no-monitor`](/doc/refman/8.0/en/server-options.html#option_mysqld_no-monitor) by appending + the process ID of the process. + (Bug #28723675) +* **X DevAPI:** + When using the X Protocol, a stored procedure called with a user + variable as an `OUT` parameter did not set the + variable's value. + (Bug #91907, Bug #28458752) +* **JSON:** + Iteration over JSON objects resulted in unnecessary allocation + of strings. + (Bug #28975640) +* **JSON:** + Conversion of [`JSON`](/doc/refman/8.0/en/json.html) values to text + caused linear growth of the destination string, resulting in an + unnecessarily high number of reallocations. Now this process + uses exponential growth instead, to reduce the number of + allocations required. + (Bug #28949700) + + References: See also: Bug #103790, Bug #32919524. +* **JSON:** + `YEAR` values were stored as opaque data in + JSON; when JSON documents containing `YEAR` + values were converted to text, the YEAR values were shown as + base64-encoded strings. To resolve this issue, + `YEAR` values are now stored as unsigned + integers, which are shown as numbers when converted to text. An + additional benefit of this fix is that less storage space is now + required for `YEAR` values within JSON + documents. + (Bug #28947107) +* **JSON:** + Hit an assert when attempting to execute + [`UPDATE`](/doc/refman/8.0/en/update.html) or + [`DELETE`](/doc/refman/8.0/en/delete.html) on an + [`ARCHIVE`](/doc/refman/8.0/en/archive-storage-engine.html) table containing a + [`JSON`](/doc/refman/8.0/en/json.html) column. + (Bug #28923281) +* **JSON:** + When trying to select from a [`JSON`](/doc/refman/8.0/en/json.html) + column of a [`FEDERATED`](/doc/refman/8.0/en/federated-storage-engine.html) table, the + server returned + [`ER_INVALID_JSON_PATH_CHARSET`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_invalid_json_path_charset) + Cannot create a JSON value from a string with + CHARACTER SET 'binary'. + + In addition, neither [`DELETE`](/doc/refman/8.0/en/delete.html) or + [`UPDATE`](/doc/refman/8.0/en/update.html) had any effect on a + `FEDERATED` table containing a + `JSON` column. + (Bug #28877215) +* **JSON:** + A query of the form [`SELECT`](/doc/refman/8.0/en/select.html) + `jt.* FROM t1,` + [`JSON_TABLE(t1.c, + '$[*]' COLUMNS (num INT PATH '$[0]')) AS jt`](/doc/refman/8.0/en/json-table-functions.html#function_json-table) failed due + a permissions error even though the user executing the query had + the [`SELECT`](/doc/refman/8.0/en/privileges-provided.html#priv_select) privilege on column + `c`. + (Bug #23254268) +* The code contributed by Facebook for the feature implemented by + Bug#27855592 was updated. + (Bug #28950397) + + References: See also: Bug #27855592. +* On SuSE Linux, spurious `EBUSY` return values + from `pthread_mutex_destroy()` were not + handled. + (Bug #28948462) +* **mysqld\_safe** and + **mysqld\_multi** were incorrectly included in + client-only packages. + (Bug #28942508) +* Mishandling of host cache locking could cause a server exit. + (Bug #28936159) +* MySQL Enterprise Firewall did not work well if the `audit_log` + plugin was installed. + (Bug #28930885, Bug #93184) +* Corrections were made to enable successful builds under Visual + Studio on Windows. + (Bug #28892711, Bug #93077) +* The server permitted creation of databases with the same name as + redo log files, which could result in unexpected server + behavior. Such names are no longer permitted as database names. + (Bug #28867993) +* **mysqld\_multi** could fail to pass the correct + [`datadir`](/doc/refman/8.0/en/server-system-variables.html#sysvar_datadir) value to + **mysqld**. + (Bug #28866662, Bug #90801) +* A debug assertion that checks parameter schema names during MDL + key creation for routines, events, and triggers to ensure that + names are lowercase failed when encountering a schema name that + included multi-byte character. + (Bug #28864244) +* The format specifiers for some error messages were improved to + avoid displaying incorrect numeric values. + (Bug #28860795) +* For debug builds on Windows, unused memory leak checks were + enabled and could slow down the shutdown process. These checks + are now enabled only for specialized builds. + (Bug #28857626) +* **mysql\_upgrade** could fail to upgrade certain + system tables if the + [`sql_require_primary_key`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_require_primary_key) system + variable was enabled. + (Bug #28855207, Bug #92988) +* Builds configured with + [`-DWITH_LIBWRAP=ON`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_libwrap) did not compile. + (Bug #28853650, Bug #92983) +* For `InnoDB` tables, the values of stored or + indexed virtual generated columns that depended on the + [`DEFAULT()`](/doc/refman/8.0/en/miscellaneous-functions.html#function_default) function were not + correctly updated by [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html), + if the default for a column referenced in this function was + changed by making column nullable. + (Bug #28848265) +* Corrections were made to enable successful builds under Visual + Studio on Windows with the `/permissive` flag + turned on. + (Bug #28842878, Bug #92943) +* Builds configured with + [`-DCMAKE_BUILD_TYPE=Release`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_cmake_build_type) did not + compile. + (Bug #28841366, Bug #92945) +* [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) now can use the + `INPLACE` algorithm when these conditions + apply: + + + For `InnoDB` tables, statements that modify + generated stored columns but do not change their type, + expression, or nullability. + + For non-`InnoDB` tables, statements that + modify generated stored or virtual columns but do not change + their type, expression, or nullability. + + An example of such a change is a change to the column comment. + (Bug #28836543) +* Plugin system variables that had been persisted were not applied + when the plugin was reinstalled. + (Bug #28823972) +* [`EXPLAIN + ... FOR CONNECTION`](/doc/refman/8.0/en/explain-for-connection.html) could modify another connection's + SQL mode. + (Bug #28786981) +* Removal of Sun RPC and XDR from `glibc` into a + separate `libtirpc` library caused problems + with `libasan` on some platforms. + (Bug #28785835, Bug #92762, Bug #28897799, Bug #93116) +* It was possible to hit an assert when comparing two + [`ENUM`](/doc/refman/8.0/en/enum.html) values while processing a + query of the form [`SELECT + a FROM table WHERE b = + value`](/doc/refman/8.0/en/select.html) and there was an + index on column `b`. + (Bug #28769996) +* Concurrent read and write access to the + [`offline_mode`](/doc/refman/8.0/en/server-system-variables.html#sysvar_offline_mode) system variable + could result in deadlock. + (Bug #28761869) +* Triggers were loaded into memory in an incorrect order when + upgrading from MySQL 5.7 to MySQL 8.0, causing an assertion + failure. + (Bug #28760011, Bug #92609) +* Joins involving the Performance Schema + [`data_locks`](/doc/refman/8.0/en/performance-schema-data-locks-table.html) table could produce + incorrect results. + (Bug #28733170) +* Some multiply-nested subqueries involving the use of scalar + subqueries were not handled correctly. + (Bug #28723670) +* On Ubuntu, the installed + `/etc/mysql/mysql.conf.d/default-auth-override.cnf` + file was mistakenly created with executable mode. Thanks to + Evgeniy Patlan for the correction contribution. + (Bug #28714840, Bug #92587) +* A memory leak was caused by + [`GET_LOCK()`](/doc/refman/8.0/en/locking-functions.html#function_get-lock) calls with a zero + timeout that failed due to concurrent connections holding the + same user-level lock. + (Bug #28714367) +* Heap corruption and a server exit could occur when a server + hosting a large number of tables was started and stopped + repeatedly. + (Bug #28705511, Bug #92572) +* MySQL Router was missing from MySQL Server MSI packages. + (Bug #28685556) +* The example stored function + `GTID_SUBTRACT_UUID` has been corrected in + the code to match the documented version. + (Bug #28670170) +* `CAP_SYS_NICE` capability is no longer enabled + for **mysqld** by MySQL package installers for + Linux. (This was done to facilitate use of resource groups + thread priorities.) For Linux deployments that require access to + thread priorities, consult the MySQL Reference Manual + instructions for enabling `CAP_SYS_NICE` + capability at [Resource Group Restrictions](/doc/refman/8.0/en/resource-groups.html#resource-group-restrictions). + (Bug #28670160) +* The internal implementation of the + [`<=>`](/doc/refman/8.0/en/comparison-operators.html#operator_equal-to) + operator was simplified. + (Bug #28660232) +* After a [`STOP GROUP_REPLICATION`](/doc/refman/8.0/en/stop-group-replication.html) + statement was issued to remove a server instance from a group, + multiple instances of the error message "[GCS] Error + pushing message into group communication engine" + were logged on the server instance. The error is now ignored + when a server is in the process of leaving a group or is no + longer a member of a group. + (Bug #28658228, Bug #92454) +* If the `CHARACTER SET` attribute of some column + was implicit in [`JSON_TABLE(... COLUMNS + ...)`](/doc/refman/8.0/en/json-table-functions.html#function_json-table), the resulting column used the global + [`character_set_results`](/doc/refman/8.0/en/server-system-variables.html#sysvar_character_set_results) as the + default character set. The column now uses the session + [`character_set_connection`](/doc/refman/8.0/en/server-system-variables.html#sysvar_character_set_connection) and + [`collation_connection`](/doc/refman/8.0/en/server-system-variables.html#sysvar_collation_connection) values. + (Bug #28643862) +* Adding a functional index on an expression that produced a row + value raised an assertion; now it results in an error instead. + (Bug #28643252) +* In debug builds, creating a trigger after setting + [`sql-mode`](/doc/refman/8.0/en/server-options.html#option_mysqld_sql-mode) to + `TIME_TRUNCATE_FRACTIONAL` caused an assertion + failure. The SQL mode was not present in the + `sql_mode` column of the + `mysql.triggers` data dictionary table. + (Bug #28642918) +* When using + [`--log-timestamps=SYSTEM`](/doc/refman/8.0/en/server-system-variables.html#sysvar_log_timestamps), ISO 8601 + timestamps in log messages did not take account of daylight + saving time. + (Bug #28632725, Bug #32893161) +* The arguments for error + [`ER_IB_MSG_720`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_ib_msg_720) were computed + incorrectly. + (Bug #28629175) +* The server could exit at startup if the option for specifying a + socket file was not specified correctly. + (Bug #28609181) +* It was possible to create an inconsistent foreign key by adding + a parent table with a different storage engine from the child + table, then changing the parent table to the same storage engine + as the child table. + (Bug #28608460, Bug #92317) +* When a server is joining a replication group, it attempts to + connect to the first seed member listed in its + [`group_replication_group_seeds`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_group_seeds) + system variable. If the connection is refused, the joining + member tries to connect to each of the other seed members in the + list in order. Previously, If the joining member connected to a + seed member but did not get added to the replication group as a + result, the joining member did not make any further connection + attempts. This situation could occur if the seed member failed + after the connection was made, or if the seed member did not + have the joining member's address in its whitelist and closed + the connection, or if the seed member rejected the joining + member's request to join the group. Now, if the joining member + connects to a seed member but does not manage to join the group, + the joining member continues to try the remaining seed members + in the list in order. + (Bug #28602835) +* Given certain patterns of allocations, copies with rebinds of + the allocator, and deallocations, it was possible for + `temptable::Allocator` to reuse a freed memory + block. This led to failures in the test suite on Windows + platforms. + (Bug #28595557) +* Setting [`time_zone`](/doc/refman/8.0/en/server-system-variables.html#sysvar_time_zone) to a negative + offset and [`timestamp`](/doc/refman/8.0/en/server-system-variables.html#sysvar_timestamp) to a low + value triggered an assertion when altering routines and views. + (Bug #28590623, Bug #92273) +* Persisting the [`pid_file`](/doc/refman/8.0/en/server-system-variables.html#sysvar_pid_file) system + variable to `DEFAULT` could result in a value + of `NULL` for subsequent server startups. + (Bug #28589736) +* Incorrect privilege checking could produce an error for + `SELECT ... FOR UPDATE` statements that + executed successfully in MySQL 5.7. + (Bug #28581664, Bug #92254) +* Attempting to rename the parent column of a foreign key with + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) could fail. + (Bug #28581468) +* Privileges for [`RESET PERSIST`](/doc/refman/8.0/en/reset-persist.html) were + not checked correctly. + (Bug #28564239) +* An overflow occurred when calculating + [`AVG(`](/doc/refman/8.0/en/aggregate-functions.html#function_avg)[`YEAR(datetime_column))`](/doc/refman/8.0/en/date-and-time-functions.html#function_year). + (Bug #28562930) +* After a server restart, path names of persisted system variables + in the Performance Schema `variables_info` + table could be calculated incorrectly. + (Bug #28561584) +* A partitioned table name check raised an invalid assertion. + (Bug #28556942) +* The `handler::create()` function could be + called with an error in the condition list, which could prevent + an error in the `handler::create()` function + from being reported properly. + (Bug #28556264) +* For [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html), + `ALGORITHM=INSTANT` was incorrectly rejected on + tables created in a MySQL version prior to 8.0.12. + (Bug #28554157, Bug #92194) +* mysqlpump did not free all allocated resources when it + encountered an error, resulting in memory leaks. + (Bug #28538971, Bug #92131) +* The `COLLATE` attribute was rejected for data + types in the `COLUMNS` clause of the + [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table) function. + (Bug #28538315) +* For debug builds, the server could exit when attempting to roll + back [`CREATE USER`](/doc/refman/8.0/en/create-user.html) statements. + (Bug #28536312) +* Plugin variables with signed values were displayed incorrectly. + (Bug #28534414, Bug #92107) +* Mishandling of deprecated system variables could cause output + from queries on the Performance Schema + [`variables_by_thread`](/doc/refman/8.0/en/performance-schema-system-variable-tables.html) table to be + incorrect. + (Bug #28515475, Bug #92049) +* Data races discovered by Thread Sanitizer in + `Event_queue::lock_data` and the + `SAFE_MUTEX` implementation were fixed. + (Bug #28510721, Bug #92041, Bug #28510691, Bug #92040) +* No [`ER_NEED_REPREPARE`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_need_reprepare) diagnostic + was pushed to the diagnostics area when a reprepare failed for + prepared statements. + (Bug #28509306, Bug #92029) +* When a subquery contained a `UNION`, the count + of the number of subquery columns was calculated incorrectly. + (Bug #28499924) +* When evaluating an expression using `WITH + ROLLUP`, we now write the result of the expression into + a temporary table only when it has a temporary table column. + (Bug #28493849, Bug #28523014) +* For debug builds, incorrect foreign key error checking for + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) on a + `TEMPORARY` table could result in a server + exit. + (Bug #28493257, Bug #91990) +* For some system variables, + [`SET + PERSIST`](/doc/refman/8.0/en/set-variable.html) persisted the default value rather than the + specified value. + (Bug #28466045) +* [`SET RESOURCE GROUP`](/doc/refman/8.0/en/set-resource-group.html) could not be + executed as a prepared statement. + (Bug #28448258, Bug #91876) +* Restored a call to `Item_field::fix_fields()` + that was inadvertently removed during work done to implement + window functions. + (Bug #28431783) +* Data races reported by Thread Sanitizer during X Plugin startup + and shutdown were corrected. + (Bug #28407294) +* Creating a table with a partition description containing illegal + utf8 characters raised an assertion. + (Bug #28387488, Bug #91763) +* **mysqldump** output could include SQL mode + values that have been removed. + (Bug #28373001, Bug #91714) +* A potential lock order cycle was corrected. + (Bug #28366531) +* On a GTID-enabled server, concurrent statements on the + [`INFORMATION_SCHEMA.COLUMNS`](/doc/refman/8.0/en/information-schema-columns-table.html) table + could deadlock. + (Bug #28293047, Bug #91548) +* [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) statements for + tables with the `utf32` table character set and + literal strings in the table definition raised an assertion. + (Bug #28275881) +* Internal functions were added to support updating the server + version number upon the successful completion of a server + upgrade. + (Bug #28211486, Bug #91323) +* Comparing log file names as strings using the + `memcmp()` function resulted in uninitialized + memory read errors. The comparison now uses the + `strncmp()` function. Thanks to Zsolt Parragi + and Laurynas Biveinis for their contributions. + (Bug #28178776, Bug #90238) +* The server mishandled stored program and resource group names + that differed only in accents. + (Bug #28122841) +* The optimizer skipped the second column in a composite index + when executing an inner join with a `LIKE` + clause against the second column. + (Bug #28086754) +* `CREATE TABLE ... SELECT` could create date + columns with “zero” date default values when it + should have created them without a default value. + (Bug #28022129) +* The transformation of `IN` subquery predicates + into semijoins was not handled correctly for a very large number + of tables. + (Bug #28004674) +* The bitmap used for reading fields from the storage engine was + not enabled correctly when performing the filesort which is + added to the last of any temporary tables created for window + functions. In the case where there was no need for a temporary + table, the server added a filesort to the output from the select + table, but the removed reference (the `WHERE` + condition) was not added. Now in such cases, the reference is + added to the select table when the first window function needs + sorting and no temporary table was created before processing + this window function. + (Bug #27975193) +* After seeing a row in the range frame, if another row was later + determined to be appearing before this range frame, the server + continued to check for new rows. This led to the next frame + calculation being done incorrectly. + (Bug #27973860) +* Server mishandling of `SIGHUP` signals could + result in a server exit. + (Bug #27966483, Bug #90742) +* `DELETE WHERE + a=constant` from a table + with column `a` and partitioned by the value of + a generated column `b` led to an assertion in + debug builds. + (Bug #27954073) +* `INFORMATION_SCHEMA` queries could cause a + server exit when updating dynamic table statistics. + (Bug #27898108) +* A metadata locking deadlock could occur when opening a foreign + key parent table. + (Bug #27859086) +* Improper memory handling by account management statements could + result in server misbehavior. + (Bug #27820277) +* In certain cases, window functions did not handle `ORDER + BY` and `PARTITION BY` correctly. + (Bug #27816506) +* The MySQL query optimizer identifies each predicate to be pushed + down to a table as a table condition; as part of this process it + checks to see whether a given predicate among the table + conditions is already known to be true in virtue of the selected + access path for the table, in which case the predicate can + safely be eliminated. + + For example, when executing + [`SELECT * FROM t1 WHERE + pk=1`](/doc/refman/8.0/en/select.html), where `pk` is the primary key + of table `t1`, the `ref` + access method is selected. Since we know that this already + returns only rows for which `pk=1`, further + evaluation of this condition as a filter (`Using + where`) should be eliminated. + + When optimizing a query which includes a `GROUP + BY` or `ORDER BY`, a late optimizer + check is performed to discover whether sorting can be skiped by + using a sorted index instead. Since this is done after another + index may have been chosen for accessing the table to be sorted, + some predicates thought to be redundant (due to the previous + access path selected) could be removed prematurely. To + compensate for this, the following actions were performed: + + + Reconstruction of a table condition containing predicates + previously eliminated due to the access method already being + selected. + + Performing a check to see whether any sorted index existed + such that sorting could be avoided, possibly modifying the + access plan. + + Issues arose because the following actions also intended to + remedy early predicate removal were not performed correctly: + + + Whether the access plan was modified or not, any extra + predicates added back in the reconstructed table condition + mentioned previously became a permanent part of the table + condition. + + When the access plan was changed to use another sorted + index, no analysis was performed for the new index in order + to remove predicates made obsolete by the new index. + + A further problem existed for storage engines implementing + condition pushdown, such as + [`NDBCLUSTER`](/doc/refman/8.0/en/mysql-cluster.html): The conditions pushed + down were generated from the table condition prior to analysis, + such that, if the access path was later changed, the pushed + condition did not contain the predicates already removed, making + condition pushdown less efficient. + + The root cause of this issue was that + `part_of_refkey()` analysis was performed on + table predicates before the access method for the table had been + completely decided. This is fixed by removing such early + analysis. + (Bug #27808758, Bug #27814026) +* A windowing function that included an `ORDER BY + column` clause failed with + Unknown field in window order by even + when the column was found in the table being queried. + (Bug #27808099) +* Executing a prepared statement to do a multiple-row insert with + large number of placeholders consumed excessive memory and could + execute slowly. + (Bug #27703912) +* On Windows, if the Visual C++ Redistributable for Visual Studio + had been removed, MySQL uninstallation using the MSI installer + failed. + (Bug #27621546) +* The parser accepted invalid + [`SET`](/doc/refman/8.0/en/set-variable.html) + statement syntax in trigger definitions that could result in a + server exit. + (Bug #27595603) +* The server failed to start if the + `keyring_encrypted_file` plugin keyring file + was invalid. + (Bug #27588064) +* Keyring migration failed with source and destination keyring + plugins of `keyring_okv` and + `keyring_encrypted_file`, respectively. + (Bug #27493970) +* It was possible in debug builds for a windowing function using a + signed integer to mishandle a frame that included + `FOLLOWING`. + (Bug #27452365) +* When executing a prepared statement with a procedure call with + the `CURSOR_TYPE_READ_ONLY` flag set, the + client library hung if the procedure performed a + [`SELECT`](/doc/refman/8.0/en/select.html) that returned an empty + result set. + (Bug #27443252, Bug #89214) +* Names of referenced columns of foreign keys were always shown in + lowercase in [`SHOW CREATE TABLE`](/doc/refman/8.0/en/show-create-table.html) + output and the + [`INFORMATION_SCHEMA.KEY_COLUMN_USAGE`](/doc/refman/8.0/en/information-schema-key-column-usage-table.html) + table. + (Bug #27353767, Bug #88718) +* Loading and unloading the `audit_log` plugin + while performing other concurrent activity could cause the + server to become unresponsive. + (Bug #27325622) +* The data dictionary properties interface + (`dd::Properties`) and implementation was + revised to provide a new method of defining valid keys for + property objects. + (Bug #27309072, Bug #89031, Bug #27309082, Bug #89032) +* Installing and uninstalling the + `validate_password` component concurrently with + [`SET PASSWORD`](/doc/refman/8.0/en/set-password.html) could cause + component failure. + (Bug #27020979) +* Some typos in server source code were fixed. Thanks to Hyunwoo + Park for the contribution. + (Bug #26189673, Bug #86565) +* After column privileges were granted to a table, a + `HANDLER READ` call asserted during privilege + checking. + (Bug #25987758) +* A check that ensures compatibility of referencing and referenced + column types in a foreign key definition was moved from the + storage engine layer to the SQL layer. In addition, a better + error message is produced when columns are not compatible, and + when a foreign key constraint references a table that does not + exist. + (Bug #25722927, Bug #28371394, Bug #91712, Bug #21308781, Bug #77467, Bug #11746132, Bug #23693) +* The parser performed some out-of-memory checks incorrectly. + (Bug #25633994) +* A race condition between user-management statements and other + statements that tried to access grant tables directly could + result in deadlock and transaction rollback. + (Bug #24481240) +* When the server was started with the + [`skip_name_resolve`](/doc/refman/8.0/en/server-system-variables.html#sysvar_skip_name_resolve) system + variable enabled, spurious warnings could be written to the + error log about ignoring accounts with a host name part of + `localhost`. (The accounts in fact were used + and not ignored.) + (Bug #23329861, Bug #81441) +* DML statements using `IGNORE` were not always + handled correctly on tables having generated columns. + (Bug #22990029) +* MySQL now removes trivial `WHERE` conditions + arising from constant literal expressions during preparation, + rather than at a later stage in optimization. This should result + in improved plans for queries with outer joins containing + trivial conditions, such as this one: + + ```None + SELECT * FROM t1 LEFT JOIN t2 ON condition_1 WHERE condition_2 OR 0 = 1 + ``` + + After removing the redundant `OR 0 = 1` + condition the optimizer can rewrite the query as an inner join, + as shown here: + + ```None + SELECT * FROM t1 LEFT JOIN t2 WHERE condition_1 AND condition_2 + ``` + + For more information, see [What Is New in MySQL 8.0](/doc/refman/8.0/en/mysql-nutshell.html), and + [Outer Join Optimization](/doc/refman/8.0/en/outer-join-optimization.html). + (Bug #16893426, Bug #28237111, Bug #28239008, Bug #28341790, WL #9571) + + References: See also: Bug #28197977, Bug #28240054. +* Updates for [`BLOB`](/doc/refman/8.0/en/blob.html) columns in + [`FEDERATED`](/doc/refman/8.0/en/federated-storage-engine.html) tables did not work. + (Bug #11748067, Bug #34997) +* Each of the functions REGEXP\_REPLACE(), REGEXP\_SUBSTR(), + REGEXP\_LIKE(), and REGEXP\_INSTR() returned a DOUBLE instead of a + value of the function's specified return type. + (Bug #90039, Bug #27682225) +* A query employing a dynamic range and an index merge could use + more memory than expected. + (Bug #89953, Bug #27659490) +* Selecting from a table having a + [`CHAR`](/doc/refman/8.0/en/char.html) column with a + `NO_PAD` collation yielded inconsistent + results. + (Bug #89753, Bug #27578340) diff --git a/corpus/changelog/mysql_releases/mysql_8015.md b/corpus/changelog/mysql_releases/mysql_8015.md new file mode 100644 index 0000000000000000000000000000000000000000..e55a73341b7d44b6692d8e7610bf5a595cf8c188 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8015.md @@ -0,0 +1,24 @@ +# MySQL 8.0.15 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-15.html +Version: 8.0.15 + +## Changes in MySQL 8.0.15 (2019-02-01, General Availability) + +For general information about upgrades, downgrades, platform support, etc., please visit [https://dev.mysql.com/doc/relnotes/mysql/8.0/en/](/doc/relnotes/mysql/8.0/en/). + +### Bugs Fixed + +* **InnoDB:** + After a checkpoint operation persisted modifications to data + dictionary metadata, there was potential for new metadata + changes to be lost under certain circumstances. + (Bug #29120297) +* **Group Replication:** + Group Replication was unable to function in MySQL 8.0.14 if IPv6 + support was disabled at the operating system level, even if the + replication group did not use any IPv6 addresses. + (Bug #29249542, Bug #94004) +* If MySQL was running on the host system and within Docker, it + was not possible to update or remove MySQL on the host system. + (Bug #28244773, Bug #91405) diff --git a/corpus/changelog/mysql_releases/mysql_8016.md b/corpus/changelog/mysql_releases/mysql_8016.md new file mode 100644 index 0000000000000000000000000000000000000000..359680121626978908423a6c0865e7211ca18f60 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8016.md @@ -0,0 +1,2194 @@ +# MySQL 8.0.16 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-16.html +Version: 8.0.16 + +## Changes in MySQL 8.0.16 (2019-04-25, General Availability) + +For general information about upgrades, downgrades, platform support, etc., please visit [https://dev.mysql.com/doc/relnotes/mysql/8.0/en/](/doc/relnotes/mysql/8.0/en/). + +* [Account Management Notes](news-8-0-16.html#mysqld-8-0-16-account-management "Account Management Notes") +* [C API Notes](news-8-0-16.html#mysqld-8-0-16-capi "C API Notes") +* [Character Set Support](news-8-0-16.html#mysqld-8-0-16-charset "Character Set Support") +* [Compilation Notes](news-8-0-16.html#mysqld-8-0-16-compiling "Compilation Notes") +* [Configuration Notes](news-8-0-16.html#mysqld-8-0-16-configuration "Configuration Notes") +* [Deprecation and Removal Notes](news-8-0-16.html#mysqld-8-0-16-deprecation-removal "Deprecation and Removal Notes") +* [Installation Notes](news-8-0-16.html#mysqld-8-0-16-installation "Installation Notes") +* [Packaging Notes](news-8-0-16.html#mysqld-8-0-16-packaging "Packaging Notes") +* [Parser Notes](news-8-0-16.html#mysqld-8-0-16-parser "Parser Notes") +* [Performance Schema Notes](news-8-0-16.html#mysqld-8-0-16-performance-schema "Performance Schema Notes") +* [Plugin Notes](news-8-0-16.html#mysqld-8-0-16-plugins "Plugin Notes") +* [Security Notes](news-8-0-16.html#mysqld-8-0-16-security "Security Notes") +* [Spatial Data Support](news-8-0-16.html#mysqld-8-0-16-spatial-support "Spatial Data Support") +* [SQL Syntax Notes](news-8-0-16.html#mysqld-8-0-16-sql-syntax "SQL Syntax Notes") +* [sys Schema Notes](news-8-0-16.html#mysqld-8-0-16-sys-schema "sys Schema Notes") +* [Test Suite Notes](news-8-0-16.html#mysqld-8-0-16-test-suite "Test Suite Notes") +* [X Plugin Notes](news-8-0-16.html#mysqld-8-0-16-xplugin "X Plugin Notes") +* [Functionality Added or Changed](news-8-0-16.html#mysqld-8-0-16-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-16.html#mysqld-8-0-16-bug "Bugs Fixed") + +### Account Management Notes + +* Previously, users who had the [`DROP + ROLE`](/doc/refman/8.0/en/privileges-provided.html#priv_drop-role) privilege could use the [`DROP + ROLE`](/doc/refman/8.0/en/drop-role.html) statement to drop locked or unlocked accounts. + Now, users who have the [`DROP ROLE`](/doc/refman/8.0/en/privileges-provided.html#priv_drop-role) + privilege can use [`DROP ROLE`](/doc/refman/8.0/en/drop-role.html) only + to drop accounts that are locked (unlocked accounts are + presumably user accounts used to log in to the server and not + just as roles). Users who have the [`CREATE + USER`](/doc/refman/8.0/en/privileges-provided.html#priv_create-user) privilege can use [`DROP + ROLE`](/doc/refman/8.0/en/drop-role.html) to drop accounts that are locked or unlocked. + (Bug #28953158, Bug #93263) +* Several changes have been made to MySQL account-management + capabilities: + + + MySQL now incorporates the concept of user account + categories, with system and regular users distinguished + according to whether they have the new + [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) privilege: + + - System users are users who possess the + [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) privilege. A + system user can perform operations on both system and + regular accounts. + - Regular users are ordinary users who do not possess the + [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) privilege. A + regular user can perform operations on regular accounts, + but not system accounts. + + If a user has the appropriate privileges to perform a given + operation on regular accounts, + [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) enables the user + to also perform the operation on system accounts. + [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) does not imply + any other privilege, so the ability to perform a given + account operation remains predicated on possession of any + other required privileges. For example, if a user can grant + the [`SELECT`](/doc/refman/8.0/en/privileges-provided.html#priv_select) and + [`UPDATE`](/doc/refman/8.0/en/privileges-provided.html#priv_update) privileges to regular + accounts, then with + [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) the user can also + grant [`SELECT`](/doc/refman/8.0/en/privileges-provided.html#priv_select) and + [`UPDATE`](/doc/refman/8.0/en/privileges-provided.html#priv_update) to system accounts. + + The distinction between system and regular accounts enables + better control over certain account administration issues by + protecting accounts that have the + [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) privilege from + accounts that do not have the privilege. For example, the + [`CREATE USER`](/doc/refman/8.0/en/privileges-provided.html#priv_create-user) privilege enables + not only creation of new accounts, but modification and + removal of existing accounts. Without the system user + concept, a user who has the [`CREATE + USER`](/doc/refman/8.0/en/privileges-provided.html#priv_create-user) privilege can modify or drop any existing + account, including the `root` account. The + concept of system user enables restricting modifications to + the `root` account (itself a system + account) so they can be made only by system users. Regular + users with the [`CREATE USER`](/doc/refman/8.0/en/privileges-provided.html#priv_create-user) + privilege can still modify or drop existing accounts, but + only regular accounts. + + Other operational implications of the + [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) privilege: + + - A session that has the + [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) privilege can + be killed only by users who have the + [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) privilege, in + addition to any other required privileges. + - An account that has the + [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) privilege can + be specified as the `DEFINER` for a + stored object only by users who have the + [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) privilege, in + addition to any other required privileges. + - A role that has the + [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) privilege + cannot be listed in the value of the + [`mandatory_roles`](/doc/refman/8.0/en/server-system-variables.html#sysvar_mandatory_roles) system + variable. + + For more information, see + [Account Categories](/doc/refman/8.0/en/account-categories.html). + + Previously, it was not possible to grant privileges that + apply globally except for certain schemas. This is now + possible if the new + [`partial_revokes`](/doc/refman/8.0/en/server-system-variables.html#sysvar_partial_revokes) system + variable is enabled. For example, the following statements + enable an account to select from or insert into any table + except those in the `mysql` system schema: + + ```None + SET PERSIST partial_revokes = ON; + GRANT SELECT, INSERT ON *.* TO u1; + REVOKE SELECT, INSERT ON mysql.* FROM u1; + ``` + + The server records partial revokes by adding a + `Restrictions` attribute to the + `User_attributes` column of the + `mysql.user` system table. + [`SHOW GRANTS`](/doc/refman/8.0/en/show-grants.html) includes + [`REVOKE`](/doc/refman/8.0/en/revoke.html) statements in its + output to indicate partial revokes. + + Note + + Enabling [`partial_revokes`](/doc/refman/8.0/en/server-system-variables.html#sysvar_partial_revokes) + causes MySQL to treat unescaped `_` and + `%` SQL wildcard characters in schema + names as literal characters, just as if they had been + escaped as `\_` and + `\%`. Because this changes the + interpretation of privilege assignments, it may be + advisable to avoid unescaped wildcard characters in schema + privilege assignments for MySQL installations where + [`partial_revokes`](/doc/refman/8.0/en/server-system-variables.html#sysvar_partial_revokes) may be + enabled. + + For more information, see [Privilege Restriction Using Partial Revokes](/doc/refman/8.0/en/partial-revokes.html). + + The [`GRANT`](/doc/refman/8.0/en/grant.html) statement has a new + `AS user [WITH + ROLE]` clause that specifies additional information + about the privilege context to use for statement execution. + This syntax is visible at the SQL level, although its + primary purpose is to enable uniform replication across all + nodes of grantor privilege restrictions imposed by partial + revokes, by causing those restrictions to appear in the + binary log. + + For more information, see [GRANT Statement](/doc/refman/8.0/en/grant.html). + + (WL #12098, WL #12364, WL #12820) + +### C API Notes + +* The MySQL C API now supports asynchronous functions for + nonblocking communication with the MySQL server: + + + [`mysql_real_connect_nonblocking()`](/doc/c-api/8.0/en/mysql-real-connect-nonblocking.html) + + [`mysql_real_query_nonblocking()`](/doc/c-api/8.0/en/mysql-real-query-nonblocking.html) + + [`mysql_store_result_nonblocking()`](/doc/c-api/8.0/en/mysql-store-result-nonblocking.html) + + [`mysql_next_result_nonblocking()`](/doc/c-api/8.0/en/mysql-next-result-nonblocking.html) + + [`mysql_fetch_row_nonblocking()`](/doc/c-api/8.0/en/mysql-fetch-row-nonblocking.html) + + [`mysql_free_result_nonblocking()`](/doc/c-api/8.0/en/mysql-free-result-nonblocking.html) + + Each function is the asynchronous counterpart to a synchronous + function that has the same name without a + `_nonblocking` suffix. The synchronous + functions block if reads from or writes to the server connection + must wait. The asynchronous functions enable an application to + check whether work on the server connection is ready to proceed. + If not, the application can perform other work before checking + again later. See [C API Asynchronous Interface](/doc/c-api/8.0/en/c-api-asynchronous-interface.html). + (WL #11381) + +### Character Set Support + +* MySQL now supports a new Chinese collation, + `utf8mb4_zh_0900_as_cs`, for the + `utf8mb4` Unicode character set. + `utf8mb4_zh_0900_as_cs` is the first Chinese + language-specific collation available for Unicode in MySQL. This + collation is accent sensitive and case sensitive. Its + characteristics are similar to + `utf8mb4_0900_as_cs` except that + language-specific rules take precedence where applicable. For + more information, see [Unicode Character Sets](/doc/refman/8.0/en/charset-unicode-sets.html). + (WL #11825) + +### Compilation Notes + +* **CMake** now causes the build process to link + with the **llvm** **lld** linker + for Clang if it is available and not explicitly disabled. To + disable use of this linker, specify the + [`-DUSE_LD_LLD=OFF`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_use_ld_lld) option. + (Bug #29264211) +* Builds on EL6 and EL7 now try to use the compiler in + `devtoolset-8` rather than + `devtoolset-7`. + (Bug #29198846) +* The minimum version of the Boost library for server builds is + now 1.69.0. + (Bug #29114233) +* The configuration-time check for Visual Studio 2017 was not + specific enough. The check for MySQL compilation now requires at + least Visual Studio update 15.8, which is version number 1915. + (Bug #28970895) +* MySQL now can be compiled using C++14. The following minimum + version requirements apply for compiler support: + + + GCC 5.3 (Linux) + + Clang 4.0 (FreeBSD) + + XCode 9 (macOS) + + Developer Studio 12.6 (Solaris) + + Visual Studio 2017 (Windows) + + (WL #12424) + +### Configuration Notes + +* MySQL configuration now requires a minimum + **CMake** version of 3.4.3. This requires the use + of **cmake3** rather than + **cmake** on some Red Hat and Oracle Linux + platforms. + (Bug #29246216) +* The [`WITH_LZMA`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_lzma) + **CMake** option was removed. + (Bug #29153932, Bug #93755) +* The `EXCLUDE_FROM_ALL` option is now used in + `CMake` configuration as appropriate so that + libraries are built only if they are actually used by any + executable. + (Bug #29052599) +* The new [`WITH_JEMALLOC`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_jemalloc) + **CMake** option indicates whether to link with + `-ljemalloc`. If enabled, built-in + `malloc()`, `calloc()`, + `realloc()`, and `free()` + routines are disabled. The default is `OFF`. + (Bug #29027974) +* The new [`WITH_LSAN`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_lsan) + **CMake** option indicates whether to run + LeakSanitizer, without AddressSanitizer. The default is + `OFF`. + (Bug #28936574) +* The new [`WITH_ROUTER`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_router) + **CMake** option indicates whether to build MySQL + Router. The default is `ON`. + (Bug #28759234) +* MySQL Server now supports a + [`--validate-config`](/doc/refman/8.0/en/server-options.html#option_mysqld_validate-config) option that + enables the startup configuration to be checked for problems + without running the server in normal operational mode. For more + information, see + [Server Configuration Validation](/doc/refman/8.0/en/server-configuration-validation.html). + (WL #12360) + +### Deprecation and Removal Notes + +* The `TempTable` storage engine now always uses + `InnoDB` to manage internal temporary tables on + disk, and the choice of storage engine employed for this task is + no longer user-configurable. The + [`internal_tmp_disk_storage_engine`](/doc/refman/8.0/en/server-system-variables.html#sysvar_internal_tmp_disk_storage_engine) + system variable has been removed. + (Bug #91377, Bug #28234637, WL #11974) + + References: See also: Bug #28081038, Bug #82556, Bug #27408352. + +### Installation Notes + +* Previously, after installation of a new version of MySQL, the + MySQL server automatically upgraded the data dictionary tables + at the next startup, after which the DBA was expected to invoke + **mysql\_upgrade** manually to upgrade the system + tables in the `mysql` schema, as well as + objects in other schemas such as the `sys` + schema and user schemas. + + The server now performs the tasks previously handled by + **mysql\_upgrade**. After installation of a new + MySQL version, the server now automatically performs all + necessary upgrade tasks at the next startup and is not dependent + on the DBA invoking **mysql\_upgrade**. In + addition, the server updates the contents of the help tables + (something **mysql\_upgrade** did not do). A new + [`--upgrade`](/doc/refman/8.0/en/server-options.html#option_mysqld_upgrade) server option provides + control over how the server performs automatic data dictionary + and server upgrade operations. For more information, see + [Upgrading MySQL](/doc/refman/8.0/en/upgrading.html). + + This change to the upgrade procedure results in some + deprecations: + + + **mysql\_upgrade** is deprecated because it is + no longer necessary. + + The [`--no-dd-upgrade`](/doc/refman/8.0/en/server-options.html#option_mysqld_no-dd-upgrade) server + option is deprecated because the + [`--upgrade`](/doc/refman/8.0/en/server-options.html#option_mysqld_upgrade) option supersedes + it. + + **mysql\_upgrade** and the + [`--no-dd-upgrade`](/doc/refman/8.0/en/server-options.html#option_mysqld_no-dd-upgrade) option will be + removed in a future MySQL version. + (Bug #28146052, Bug #28162609, Bug #91205, Bug #29185739, Bug #27740692, Bug #28547424, Bug #91961, WL #12413, WL #12918) + +### Packaging Notes + +* The Docker image for MySQL Cluster 8.0 is now + [available + for download](https://hub.docker.com/r/mysql/mysql-cluster/tags). + (Bug #30010921, Bug #96084) +* Binary packages that include `curl` rather than + linking to the system `curl` library now use + `curl` 7.64.0. + (Bug #29357198) +* The Henry Spencer regex library + (`extra/regex`) is no longer used by MySQL + 8.0 and is no longer present in source distributions. + (Bug #29192306) +* RPM packages now have dependencies on + `libtirpc` and `rpcgen` + because newer versions of `glibc` do not + include Sun RPC. + (Bug #28995257) +* The `support-files/magic` file was removed + from the MySQL source tree. Most MySQL file formats are covered + by operating system file type capabilities. + (Bug #18335080, Bug #71898) +* MySQL now provides “Minimal Install” Linux generic + binary download packages for MySQL Server and the Test Suite. + Minimal install packages exclude debug binaries and are stripped + of debug symbols, making them significantly smaller than the + regular Linux generic binary packages. Downloads are available + at https://dev.mysql.com/downloads/. +* The Docker image for MySQL Enterprise Edition is now available for download from + [My Oracle + Support](https://support.oracle.com/). + +### Parser Notes + +* The parser no longer accepts the undocumented and nonstandard + `= alias_name` + syntax for specifying table aliases. + (Bug #29205289) +* The parser is now permits several additional nonreserved + keywords to be used as labels within stored programs that + previously were restricted from such use: + `ACCOUNT`, `ALWAYS`, + `BACKUP`, `CLOSE`, + `FORMAT`, `GROUP_REPLICATION`, + `HOST`, `INVISIBLE`, + `OPEN`, `OPTIONS`, + `OWNER`, `PARSER`, + `PORT`, `REMOVE`, + `RESTORE`, `ROLE`, + `SECONDARY`, + `SECONDARY_ENGINE`, + `SECONDARY_LOAD`, + `SECONDARY_UNLOAD`, + `SECURITY`, `SERVER`, + `SOCKET`, `SONAME`, + `UPGRADE`, `VISIBLE`, + `WRAPPER`. + (Bug #29033659) +* The parser accepted ODBC escape syntax for outer joins + (`{ OJ outer_join + }`), but also accepted identifiers other than + `OJ`. The parser now accepts only + `OJ`. + + Note + + `OJ` now is a nonreserved keyword. + + (Bug #22320942) + +### Performance Schema Notes + +* The new Performance Schema + [`keyring_keys`](/doc/refman/8.0/en/performance-schema-keyring-keys-table.html) table exposes metadata + for keys in the MySQL Keyring. Key metadata includes key IDs, + key owners, and backend key IDs. The + [`keyring_keys`](/doc/refman/8.0/en/performance-schema-keyring-keys-table.html) table does not expose + any sensitive keyring data such as key contents. See + [The keyring\_keys table](/doc/refman/8.0/en/performance-schema-keyring-keys-table.html). + (WL #11543) + +### Plugin Notes + +* MySQL now includes a `ddl_rewriter` plugin that + modifies [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) statements + received by the server before it parses and executes them. The + plugin removes `ENCRYPTION`, `DATA + DIRECTORY`, and `INDEX DIRECTORY` + clauses, which may be helpful when restoring tables from SQL + dump files created from databases that are encrypted or that + have their tables stored outside the data directory. For + example, the plugin may enable restoring such dump files into an + unencrypted instance or in an environment where the paths + outside the data directory are not accessible. When installed, + `ddl_rewriter` exposes the Performance Schema + `memory/rewriter/ddl_rewriter` instrument for + tracking plugin memory use. For more information, see + [The ddl\_rewriter Plugin](/doc/refman/8.0/en/ddl-rewriter.html). + (WL #12668) + +### Security Notes + +* Previously, if the grant tables were corrupted, the MySQL server + wrote a message to the error log but continued as if the + [`--skip-grant-tables`](/doc/refman/8.0/en/server-options.html#option_mysqld_skip-grant-tables) option had + been specified. This resulted in the server operating in an + unexpected state unless + [`--skip-grant-tables`](/doc/refman/8.0/en/server-options.html#option_mysqld_skip-grant-tables) had in fact + been specified. Now, the server stops after writing a message to + the error log unless started with + [`--skip-grant-tables`](/doc/refman/8.0/en/server-options.html#option_mysqld_skip-grant-tables). (Starting + the server with that option enables you to connect to perform + diagnostic operations.) + (Bug #29394501, Bug #94394, WL #12971) +* The OpenSSL libraries bundled with MySQL on some platforms + (Windows, macOS, and Generic Linux) have been upgraded to + version 1.0.2r. On all other platforms, MySQL uses the system + installed OpenSSL. Issues fixed in the new OpenSSL version are + described at + . + (Bug #28988091) +* Granting roles to anonymous users is no longer supported because + such roles caused problematic behavior. + (Bug #28910120) +* OpenSSL 1.1.1 supports the TLS v1.3 protocol for encrypted + connections, and MySQL now supports TLS v1.3 as well, if both + the server and client are compiled using OpenSSL 1.1.1 or + higher: + + + Some TLSv1.3 ciphersuites are enabled by default. The + [`tls_ciphersuites`](/doc/refman/8.0/en/server-system-variables.html#sysvar_tls_ciphersuites) system + variable enables explicitly specifying which TLSv1.3 + ciphersuites the server permits. + + The [`--tls-ciphersuites`](/doc/refman/8.0/en/connection-options.html#option_general_tls-ciphersuites) + client option specifies which TLSv1.3 ciphersuites a client + permits. This option applies to these programs: + **mysql**, **mysqladmin**, + **mysqlbinlog**, + **mysqlcheck**, **mysqldump**, + **mysqlimport**, + **mysqlpump**, **mysqlshow**, + **mysqlslap**, **mysqltest**, + **mysql\_secure\_installation**, and + **mysql\_upgrade**. + + The [`mysql_options()`](/doc/c-api/8.0/en/mysql-options.html) C API + function has a new + `MYSQL_OPT_TLS_CIPHERSUITES` option that + specifies from within the client library which TLSv1.3 + ciphersuites a client program permits. + + For more information, see + [Encrypted Connection TLS Protocols and Ciphers](/doc/refman/8.0/en/encrypted-connection-protocols-ciphers.html). + + Note + + Group Replication does not support TLSv1.3. + + (WL #12361) +* The TLS context the server uses for new connections now is + reconfigurable at runtime. This capability may be useful, for + example, to avoid restarting a MySQL server that has been + running so long that its SSL certificate has expired. Dynamic + SSL reconfigurability is based on these changes: + + + The system variables that define the TLS context are dynamic + and can be changed at runtime: + [`ssl_ca`](/doc/refman/8.0/en/server-system-variables.html#sysvar_ssl_ca), + [`ssl_capath`](/doc/refman/8.0/en/server-system-variables.html#sysvar_ssl_capath), + [`ssl_cert`](/doc/refman/8.0/en/server-system-variables.html#sysvar_ssl_cert), + [`ssl_cipher`](/doc/refman/8.0/en/server-system-variables.html#sysvar_ssl_cipher), + [`ssl_crl`](/doc/refman/8.0/en/server-system-variables.html#sysvar_ssl_crl), + [`ssl_crlpath`](/doc/refman/8.0/en/server-system-variables.html#sysvar_ssl_crlpath), + [`ssl_key`](/doc/refman/8.0/en/server-system-variables.html#sysvar_ssl_key), + [`tls_ciphersuites`](/doc/refman/8.0/en/server-system-variables.html#sysvar_tls_ciphersuites). + [`tls_version`](/doc/refman/8.0/en/server-system-variables.html#sysvar_tls_version). + + The [`ALTER INSTANCE`](/doc/refman/8.0/en/alter-instance.html) statement + supports a `RELOAD TLS` action that + reconfigures the TLS context from the current values of the + system variables that define the context. + + These status variables reflect the TLS context the server + uses for new connections: + [`Current_tls_ca`](/doc/refman/8.0/en/server-status-variables.html#statvar_Current_tls_ca), + [`Current_tls_capath`](/doc/refman/8.0/en/server-status-variables.html#statvar_Current_tls_capath), + [`Current_tls_cert`](/doc/refman/8.0/en/server-status-variables.html#statvar_Current_tls_cert), + [`Current_tls_cipher`](/doc/refman/8.0/en/server-status-variables.html#statvar_Current_tls_cipher), + [`Current_tls_ciphersuites`](/doc/refman/8.0/en/server-status-variables.html#statvar_Current_tls_ciphersuites), + [`Current_tls_crl`](/doc/refman/8.0/en/server-status-variables.html#statvar_Current_tls_crl), + [`Current_tls_crlpath`](/doc/refman/8.0/en/server-status-variables.html#statvar_Current_tls_crlpath), + [`Current_tls_key`](/doc/refman/8.0/en/server-status-variables.html#statvar_Current_tls_key), + [`Current_tls_version`](/doc/refman/8.0/en/server-status-variables.html#statvar_Current_tls_version). + + [`ALTER INSTANCE RELOAD TLS`](/doc/refman/8.0/en/alter-instance.html#alter-instance-reload-tls) + updates those status variables from the corresponding system + variable values when it reconfigures the TLS context. + + For more information, see + [Server-Side Runtime Configuration and Monitoring for Encrypted Connections](/doc/refman/8.0/en/using-encrypted-connections.html#using-encrypted-connections-server-side-runtime-configuration). + + Thanks to Facebook for submitting code for a similar feature + (although the code was not used). + (WL #11541) + + References: See also: Bug #27980097. +* In MySQL 8.0, the default authentication plugin was changed from + `mysql_native_password` to + `caching_sha2_password`. Because + `caching_sha2_password` provides a superset of + the capabilities of the `sha256_password` + authentication plugin, `sha256_password` is now + deprecated and will be removed in a future MySQL version. MySQL + accounts that authenticate using + `sha256_password` should be migrated to use + `caching_sha2_password` instead. + (WL #12694) + +### Spatial Data Support + +* The [`ST_Length()`](/doc/refman/8.0/en/gis-linestring-property-functions.html#function_st-length) function now + takes an optional second argument enabling the unit for the + return value to be specified. Permitted units are those listed + in the new `INFORMATION_SCHEMA` + [`ST_UNITS_OF_MEASURE`](/doc/refman/8.0/en/information-schema-st-units-of-measure-table.html) table. See + [LineString and MultiLineString Property Functions](/doc/refman/8.0/en/gis-linestring-property-functions.html), and + [The INFORMATION\_SCHEMA ST\_UNITS\_OF\_MEASURE Table](/doc/refman/8.0/en/information-schema-st-units-of-measure-table.html). + (WL #12657) + +### SQL Syntax Notes + +* **Incompatible Change:** + In MySQL 5.7, specifying a `FOREIGN KEY` + definition for an `InnoDB` table without a + `CONSTRAINT symbol` + clause, or specifying the `CONSTRAINT` keyword + without a `symbol`, causes + `InnoDB` to use a generated constraint name. + That behavior changed in MySQL 8.0, with + `InnoDB` using the `FOREIGN KEY + index_name` value instead of + a generated name. Because constraint names must be unique per + schema (database), the change caused errors due to foreign key + index names that were not unique per schema. To avoid such + errors, the new constraint naming behavior has been reverted, + and `InnoDB` once again uses a generated + constraint name. + + For consistency with `InnoDB`, the + `NDB` storage engine now uses a generated + constraint name if the `CONSTRAINT + symbol` clause is not + specified, or the `CONSTRAINT` keyword is + specified without a `symbol`. In + `NDB` releases based on MySQL 5.7 and earlier + MySQL 8.0 releases, `NDB` used the + `FOREIGN KEY + index_name` value. + + The changes described above may introduce incompatibilities for + applications that depend on the previous foreign key constraint + naming behavior. + (Bug #29173134) +* Previously, MySQL permitted a limited form of + `CHECK` constraint syntax, but parsed and + ignored it. MySQL now implements the core features of table and + column `CHECK` constraints, for all storage + engines. Constraints are defined using + [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) and + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) statements. The new + [`INFORMATION_SCHEMA.CHECK_CONSTRAINTS`](/doc/refman/8.0/en/information-schema-check-constraints-table.html) + table provides information about `CHECK` + constraints defined on tables. For more information, see + [CHECK Constraints](/doc/refman/8.0/en/create-table-check-constraints.html). + (Bug #11744849, Bug #3464, Bug #3465, Bug #11746042, Bug #22759, WL #929) + +### sys Schema Notes + +* MySQL now includes built-in SQL functions that format or + retrieve Performance Schema data, and that may be used as + equivalents for existing `sys` schema stored + functions: + + + [`FORMAT_BYTES()`](/doc/refman/8.0/en/performance-schema-functions.html#function_format-bytes): Converts a + byte count to a value with units. Similar to + [`sys.format_bytes()`](/doc/refman/8.0/en/sys-format-bytes.html). + + [`FORMAT_PICO_TIME()`](/doc/refman/8.0/en/performance-schema-functions.html#function_format-pico-time): Converts + a time in picoseconds to a value with units. Similar to + [`sys.format_time()`](/doc/refman/8.0/en/sys-format-time.html). + + [`PS_THREAD_ID()`](/doc/refman/8.0/en/performance-schema-functions.html#function_ps-thread-id): Returns the + Performance Schema thread ID for a given thread. Similar to + [`sys.ps_thread_id()`](/doc/refman/8.0/en/sys-ps-thread-id.html) invoked + with a non-`NULL` argument. + + [`PS_CURRENT_THREAD_ID()`](/doc/refman/8.0/en/performance-schema-functions.html#function_ps-current-thread-id): + Returns the Performance Schema thread ID for the current + thread. Shortcut for + [`sys.ps_thread_id()`](/doc/refman/8.0/en/sys-ps-thread-id.html) invoked + with a `NULL` argument. + + The built-in functions can be invoked in any schema and require + no qualifier, unlike the `sys` functions, which + require either a `sys.` schema qualifier or + that `sys` be the current schema. + + The built-in functions supersede the corresponding + `sys` functions, which now are deprecated and + will be removed in a future MySQL version. Applications that use + the `sys` functions should be adjusted to use + the built-in functions instead, keeping in mind some minor + differences between the `sys` functions and the + built-in functions. See + [Performance Schema Functions](/doc/refman/8.0/en/performance-schema-functions.html). + (WL #7803) + +### Test Suite Notes + +* **mysql-test-run.pl** now supports the + `MTR_UNIQUE_IDS_DIR` environment variable, + which may be set to specify a unique-IDs directory to be used as + the common location for all **chroot** + environments by multiple simultaneous + **mysql-test-run.pl** instances. This enables + those instances to avoid conflicts when reserving port numbers. + Thanks to Facebook for the contribution. + (Bug #29221085, Bug #93950) +* The **my\_safe\_process** program was renamed to + **mysqltest\_safe\_process** and now is installed + with other binaries such as **mysqltest** rather + than with test suite files. + (Bug #29198969) +* These changes to the `all_persisted_variables` + test were implemented: + + + It limits the number of hardcoded values in the test output + by putting them into local variables. New patches that are + then rebased on top that add new system variables do not + need to change as many lines of the original test case, + making it easier on the rebase process. + + It removes entries for bugs that were fixed and modifies the + queries to include the system variables that were not tested + due to open bugs. + + Thanks to the Facebook team for the contribution. + (Bug #29013375, Bug #93478) + +### X Plugin Notes + +* X Plugin previously returned a `StmtExecuteOk` + message to the client after query cleanup had ended and the + session had been deactivated. The message is now returned as + soon as the result is known and before query cleanup, which + gives a noticeable improvement in performance. + (Bug #28997370) +* X Plugin logged the system message "X Plugin ready + for connections" when user connections were not + available because preparation of I/O interfaces had failed. + (Bug #28906360) +* Some items in the X Plugin code were not instrumented for the + Performance Schema by default. + (Bug #28898155) +* X Protocol now supports the + `COM_RESET_CONNECTION` utility command to reset + the session state without re-authenticating or closing the + connection. + (Bug #28732455) +* X Plugin produced compilation warnings when the MySQL Server + source code was built using the Clang 8 compiler. + (Bug #28732158) + +### Functionality Added or Changed + +* **InnoDB:** + When the amount of memory occupied by the TempTable storage + engine exceeds the limit defined by the + [`temptable_max_ram`](/doc/refman/8.0/en/server-system-variables.html#sysvar_temptable_max_ram) variable, the + TempTable storage engine allocates space for internal in-memory + temporary tables as memory-mapped temporary files. This behavior + is now controlled by the + [`temptable_use_mmap`](/doc/refman/8.0/en/server-system-variables.html#sysvar_temptable_use_mmap) variable, + which can be disabled to have the TempTable storage engine use + `InnoDB` on-disk internal temporary tables + instead. For more information, see + [Internal Temporary Table Use in MySQL](/doc/refman/8.0/en/internal-temporary-tables.html). + (Bug #28944457) +* **InnoDB:** + `undo` and `purge` subsystem + counters were added for monitoring background activities + associated with undo log truncation. For counter names and + descriptions, query the + [`INFORMATION_SCHEMA.INNODB_METRICS`](/doc/refman/8.0/en/information-schema-innodb-metrics-table.html) + table. + + ```None + SELECT NAME, SUBSYSTEM, COMMENT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME LIKE '%truncate%'; + ``` + + For information about enabling counters and querying counter + data, see + [InnoDB INFORMATION\_SCHEMA Metrics Table](/doc/refman/8.0/en/innodb-information-schema-metrics-table.html). + (Bug #28813526, WL #12600) +* **InnoDB:** + The new + [`innodb_spin_wait_pause_multiplier`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_spin_wait_pause_multiplier) + variable provides greater control over the duration of spin-lock + polling delays that occur when a thread waits to acquire a mutex + or rw-lock. Delays can now be tuned more finely to account for + differences in PAUSE instruction duration on different processor + architectures. For more information, see + [Configuring Spin Lock Polling](/doc/refman/8.0/en/innodb-performance-spin_lock_polling.html). + (WL #12616) +* **InnoDB:** + An internal service interface was added to support tracking of + modified pages. + (WL #11082) +* **InnoDB:** + The `InnoDB` data-at-rest encryption feature + now supports encryption of the `mysql` system + tablespace. The `mysql` system tablespace + contains the `mysql` system database and the + MySQL data dictionary tables. + (WL #12063) +* **Group Replication:** + The group communication engine (XCom) includes a cache for + messages (and their metadata) that are exchanged between the + group members as a part of the consensus protocol. Among other + functions, the message cache is used for recovery by members + that return to the group after a period where they were unable + to communicate with the other group members. + + Previously, the size limit for the message cache was fixed at + 1GB of memory, and the maximum number of messages in the cache + was also fixed. Now that the + [`group_replication_member_expel_timeout`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_member_expel_timeout) + system variable (introduced in MySQL 8.0.13) can be set to allow + up to an hour for members to return to the group rather than + being expelled, having a fixed 1GB limit on the size of the + cache could cause such nodes to be unable to recover the + messages they missed on re-establishing communication. + + For this reason, beginning with this release, the XCom message + cache has no fixed limit on the number of messages it can + contain, and is bounded only by the limit set for the amount of + memory it can use. The cache size limit can be set using the new + [`group_replication_message_cache_size`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_message_cache_size) + system variable, which has a default and minimum setting of 1GB, + as used in previous MySQL Server versions. If the cache size + limit is reached, XCom removes the oldest entries that have been + decided and delivered. The cache size limit can be increased or + reduced dynamically at runtime. If you reduce the cache size + limit, XCom removes the oldest entries that have been decided + and delivered until the current size is below the limit. The + Group Replication Group Communication System (GCS) issues a + warning when a message likely to be needed for recovery by a + currently unreachable member is removed from the message cache. + (Bug #26482507, WL #11615) +* **Group Replication:** + Large messages sent between Group Replication group members can + now be split into multiple messages when they exceed a + user-defined threshold size. Sending an abnormally large message + can result in some group members being reported as failed and + expelled from the group. This is because the single thread used + by the group communication engine (XCom) is occupied processing + the message for too long, so some of the group members might + report the receiver as failed. + + A new system variable + [`group_replication_communication_max_message_size`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_communication_max_message_size) + specifies the maximum message size for Group Replication + communications. Messages greater than this size are + automatically split into fragments that are sent separately and + reassembled by the recipients. Message delivery for a fragmented + message is considered complete when all the fragments of the + message have been received and reassembled by all the group + members. Fragmentation is applied by default, and can be + switched off by specifying a zero value for the system variable. + + Because older MySQL Server releases do not support message + fragmentation, in order to ensure backward compatibility, Group + Replication now has the concept of a communication protocol for + the group. The communication protocol version is set to + accommodate the oldest MySQL Server version that you want the + group to support. A MySQL server at version X can only join and + reach `ONLINE` status in a replication group if + the group's communication protocol version is less than or equal + to X. + + You can inspect the communication protocol in use by a group by + using the new + [`group_replication_get_communication_protocol()`](/doc/refman/8.0/en/group-replication-functions-for-communication-protocol.html#function_group-replication-get-communication-protocol) + function, which returns the oldest MySQL Server version that the + group supports. When a new member joins a replication group, it + checks the communication protocol version that is announced by + the existing members of the group. If the joining member + supports that version, it joins the group and uses the + communication protocol that the group has announced, even if the + member supports additional communication capabilities. If the + joining member does not support the communication protocol + version, it is expelled from the group. + + If you need to change the communication protocol version of a + group so that members at earlier releases can join, use the new + [`group_replication_set_communication_protocol()`](/doc/refman/8.0/en/group-replication-functions-for-communication-protocol.html#function_group-replication-set-communication-protocol) + function to specify the MySQL Server version of the oldest + member that you want to allow. This makes the group fall back to + a compatible communication protocol version if possible. If you + upgrade all the members of a replication group to a new MySQL + Server release, the group's communication protocol version is + not automatically upgraded to match. If you no longer need to + support members from earlier releases, use the + [`group_replication_set_communication_protocol()`](/doc/refman/8.0/en/group-replication-functions-for-communication-protocol.html#function_group-replication-set-communication-protocol) + function to set the communication protocol version to the new + MySQL Server version to which you have upgraded the members. + (Bug #26438884, Bug #23240361, Bug #28474580, Bug #91830, Bug #28642504, Bug #26941977, Bug #29240931, WL #11610) +* **Group Replication:** + A new system variable + [`group_replication_autorejoin_tries`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_autorejoin_tries) + lets you specify the number of tries that a member makes to + automatically rejoin the group if it is expelled, or if it is + unable to contact a majority of the group before the + [`group_replication_unreachable_majority_timeout`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_unreachable_majority_timeout) + setting is reached. `0`, the default, means + that the member does not try to rejoin, and proceeds to the + action specified by the + [`group_replication_exit_state_action`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_exit_state_action) + system variable. + + Activate auto-rejoin if you can tolerate the possibility of + stale reads and want to minimize the need for manual + intervention, especially where transient network issues fairly + often result in the expulsion of members. If you specify a + number of tries, when the member's expulsion or unreachable + majority timeout is reached, it makes an attempt to rejoin + (using the current plugin option values), then continues to make + further auto-rejoin attempts up to the specified number of + tries. After an unsuccessful auto-rejoin attempt, the member + waits 5 minutes before the next try. During the auto-rejoin + procedure, the member remains in super read only mode and + displays an `ERROR` state on its view of the + replication group. The member can be stopped manually at any + time by using a [`STOP + GROUP_REPLICATION`](/doc/refman/8.0/en/stop-group-replication.html) statement or shutting down the + server. If the specified number of tries is exhausted without + the member rejoining or being stopped, the member proceeds to + the action specified by + [`group_replication_exit_state_action`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_exit_state_action). + (Bug #25673350, Bug #84784, Bug #28732174, WL #11284) +* **Group Replication:** + The default for + [`group_replication_exit_state_action`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_exit_state_action) + has been changed from `ABORT_SERVER` to + `READ_ONLY`. + (WL #12659) +* Some `InnoDB` memory allocation functions that + previously were evaluated at runtime now are evaluated at + compile time, resulting in performance improvements. + (Bug #29370811, Bug #94380) +* The semijoin optimizations for `IN` subqueries + have been extended to work with `EXISTS` + subqueries as well; these can now be handled with the same + semijoin strategies as `IN` subqueries, + including first-match, materialization, duplicate weedout and + loose index scan. + + In addition, the optimizer decorrelates trivially-correlated + equality predicates in the `WHERE` condition + attached to the subquery, so that they can be treated similarly + to expressions in `IN` subqueries. The + decorrelation is now also performed for `IN` + subqueries as well as `EXISTS` subqueries. + + All hints and optimizer switches applicable to + `IN` subqueries which are transformed into + semijoin operations are also applicable to transformed + `EXISTS` subqueries. All limitations on such + optimization of `IN` subqueries also apply to + transformed `EXISTS` subqueries, so that, for + example, aggregate `EXISTS` subqueries cannot + be transformed. + + For more information, see [Optimizing IN and EXISTS Subquery Predicates with Semijoin Transformations](/doc/refman/8.0/en/semijoins.html). + (Bug #28805105, Bug #28857990, WL #4389) +* For consistency with the SQL standard and other RDBMS, table + aliases are now supported in single-table as well as multi-table + [`DELETE`](/doc/refman/8.0/en/delete.html) statements. + (Bug #27455809) +* `WHERE` conditions making comparisons between + constants and column values in which the constant value is out + of range or of the wrong type with respect to the column type + are now handled during optimization rather than during + execution. For example, given a table `t` with + a column `c` whose type is + [`TINYINT + UNSIGNED`](/doc/refman/8.0/en/integer-types.html), the condition in the query + [`SELECT * FROM t WHERE c + < 256`](/doc/refman/8.0/en/select.html) can be folded to `SELECT * FROM t + WHERE TRUE` because 256 is out of range for a column of + this type. Comparisons with `NULL` columns can + also be optimized; if the column `c` is + nullable, the same query can be optimized as `SELECT * + FROM t WHERE c IS NOT NULL`. + + The comparisons that can be treated in this manner are + `>`, `>=`, + `<`, `<=`, + `=`, + `<>`/`!=`, and + `<=>`. (`BETWEEN` and + `IN` are not currently supported.) Types for + which comparisons can be folded based on range and type include + integer, floating-point, and fixed-point numeric types. + [`BIT`](/doc/refman/8.0/en/bit-type.html) is not supported by this + optimization, nor are columns of date and time types. + + For more information, see + [Constant-Folding Optimization](/doc/refman/8.0/en/constant-folding-optimization.html). + (Bug #90100, Bug #25484743, Bug #29048682, Bug #27703371, WL #11935) + + References: See also: Bug #28172538, Bug #29699347. +* Added an experimental tree format for + [`EXPLAIN`](/doc/refman/8.0/en/explain.html) output, which prints the + generated iterator tree, and is intended to help users + understand how execution was actually set up. `EXPLAIN + FORMAT=TREE` is currently unsupported in production and + both its syntax and output are subject to change in subsequent + versions of MySQL. + (WL #12074) +* When binary log and relay log encryption is in use on a MySQL + server ([`binlog_encryption=ON`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_encryption)), + you can now rotate the binary log master key at any time while + the server is running by issuing [`ALTER + INSTANCE ROTATE BINLOG MASTER KEY`](/doc/refman/8.0/en/alter-instance.html#alter-instance-rotate-binlog-master-key). You can do this on + a regular basis to comply with your organization's security + policy, and also if you suspect that the current or any of the + previous binary log master keys might have been compromised. + + When you rotate the binary log master key, the new master key is + used to encrypt the file passwords for the new binary log and + relay log files, and subsequent files until the key is changed + again. The file passwords for existing encrypted binary log + files and relay log files on the server are also re-encrypted in + turn using the new binary log master key, starting with the most + recent files. Any unencrypted files are skipped. Finally, all + binary log encryption keys that no longer apply to any retained + binary log files or relay log files are cleaned up from the + keyring. + (WL #12080) +* Table encryption can now be managed globally by defining and + enforcing encryption defaults. The + [`default_table_encryption`](/doc/refman/8.0/en/server-system-variables.html#sysvar_default_table_encryption) + variable defines an encryption default for newly created schemas + and general tablespaces. The encryption default for a schema can + also be defined using the `DEFAULT ENCRYPTION` + clause when creating a schema. By default, a table inherits the + encryption of the schema or general tablespace it is created in. + + Encryption defaults are enforced by enabling the + [`table_encryption_privilege_check`](/doc/refman/8.0/en/server-system-variables.html#sysvar_table_encryption_privilege_check) + variable. The privilege check occurs when creating or altering a + schema or general tablespace with an encryption setting that + differs from the + [`default_table_encryption`](/doc/refman/8.0/en/server-system-variables.html#sysvar_default_table_encryption) + setting, or when creating or altering a table with an encryption + setting that differs from the default schema encryption. + + The [`TABLE_ENCRYPTION_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_table-encryption-admin) + privilege permits overriding default encryption settings when + [`table_encryption_privilege_check`](/doc/refman/8.0/en/server-system-variables.html#sysvar_table_encryption_privilege_check) + is enabled. + + For more information, see + [Defining an Encryption Default for Schemas and General Tablespaces](/doc/refman/8.0/en/innodb-data-encryption.html#innodb-schema-tablespace-encryption-default). + (WL #12261) +* When insertions, deletions, or updates are made to partitioned + tables, the binary log now records information about the + partition and (if any) the subpartition in which the row event + took place. A new row event is created for a modification that + takes place in a different partition or subpartition, even if + the table involved is the same. So if a transaction involves + three partitions or subpartitions, three row events are + generated. For an update event, the partition information is + recorded for both the “before” image and the + “after” image. The partition information is + displayed if you specify the `-v` or + `--verbose` option when viewing the binary log + using **mysqlbinlog**. Partition information is + only recorded when row-based logging is in use + ([`binlog_format=ROW`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_format)). + (WL #12168) + +### Bugs Fixed + +* **NDB Cluster:** + [`EXPLAIN`](/doc/refman/8.0/en/explain.html) of a query executed with + table access type [`eq_ref`](/doc/refman/8.0/en/explain-output.html#jointype_eq_ref) + could also show a condition being pushed down, even when + condition pushdown was not supported for the query. Now the + access type is checked before [`NDB`](/doc/refman/8.0/en/mysql-cluster.html) + checks the condition for a possible pushdown optimization. + + This fix does not affect handling of tables which are part of a + pushed join, for which `NDB` continues to + support pushed conditions as before. + (Bug #27429615) + + References: See also: Bug #27397802, Bug #27808758, Bug #90301. +* **InnoDB:** + Undo tablespaces remained unencrypted after enabling undo + tablespace encryption at startup. + (Bug #29477795) +* **InnoDB:** + Problematic macros introduced with undo tablespace DDL support + in MySQL 8.0.14 were revised. + (Bug #29324132, Bug #94243) +* **InnoDB:** + Static thread local variables defined at the wrong scope were + not released at thread exit. + (Bug #29305186) +* **InnoDB:** + The [`performance_schema.data_locks`](/doc/refman/8.0/en/performance-schema-data-locks-table.html) + `LOCK_DATA` column only showed the secondary + index values of the locked record for a lock placed on a unique + secondary index, which was not sufficient to ensure the + uniqueness of identified records. The clustered index column + values of the locked record are now appended. + (Bug #29296645) +* **InnoDB:** + An incorrect count of transactions using a rollback segment for + recovery of an XA transaction prevented an undo tablespace + truncation operation from proceeding and left the purge thread + busy checking for the undo tablespace to become empty. + (Bug #29273194) + + References: This issue is a regression of: Bug #29273194. +* **InnoDB:** + Invalid assertions were raised at startup after a failure to + retrieve the space ID of a compressed file-per-table tablespace. + The invalid assertion code was removed. + (Bug #29221385, Bug #93760) +* **InnoDB:** + Optimized `InnoDB` internal temporary tables + did not support in-place `UPDATE` operations, + which caused the number of delete-marked records to increase + continuously. The large number of delete-marked records could + cause longer than expected query execution times. + (Bug #29207450) +* **InnoDB:** + The `std::sort` function in the + Contention-Aware Transaction Scheduling (CATS) algorithm was + replaced by the `std::stable_sort` function to + preserve the original FIFO order for transactions of equal + weight. + (Bug #29058967) +* **InnoDB:** + Write-ahead did not work as expected due to an incorrectly + initialized variable. + + Thanks to Yuhui Wang for the contribution. + (Bug #29028838, Bug #93442) +* **InnoDB:** + The base column information for a generated column was not + stored. + (Bug #29021730) +* **InnoDB:** + An implicit lock check on secondary indexes needlessly compared + columns using collation rules. + (Bug #29010725) +* **InnoDB:** + Assertion code related to the + [`innodb_flush_method`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_flush_method) + `O_DIRECT_NO_FSYNC` setting was no longer valid + due to a recent modification to that setting. Assertion code was + revised. + (Bug #29007731) + + References: See also: Bug #27309336. +* **InnoDB:** + When starting the server with undo log encryption enabled, the + master key for newly created undo tablespaces was generated + without a server UUID. Undo tablespaces should use the + DefaultMasterKey if the server UUID is not yet generated. + (Bug #29006275) +* **InnoDB:** + Data dictionary code did not check for a returned data + dictionary object, which could potentially cause the server to + exit due to a null pointer access. + (Bug #28977444, Bug #93362) +* **InnoDB:** + An undo tablespace file was left behind by a failed + [`CREATE UNDO + TABLESPACE`](/doc/refman/8.0/en/create-tablespace.html) operation. + (Bug #28966457) +* **InnoDB:** + A [`CREATE UNDO + TABLESPACE`](/doc/refman/8.0/en/create-tablespace.html) statement failed on Windows due to an + invalid character in the file name. The failure resulted in a + hang condition due to a missing + `OS_FILE_ON_ERROR_NO_EXIT` attribute in the + call that creates the undo tablespace file. + (Bug #28955676) +* **InnoDB:** + Modifying the value of the + [`innodb_undo_log_encrypt`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_undo_log_encrypt) + variable was not a blocking operation, which could lead to the + modification being reverted by a background thread after the + operation appeared to have been completed successfully. + (Bug #28952870) +* **InnoDB:** + An invalid debug assertion was removed from the + `temptable::Handler::primary_key_is_clustered` + function. + (Bug #28949332) +* **InnoDB:** + An + [`ALTER + TABLE ... EXCHANGE PARTITION`](/doc/refman/8.0/en/partitioning-management-exchange.html) operation did not + properly update column `table_id` values in the + data dictionary. + (Bug #28927005) +* **InnoDB:** + Memory leaks discovered in the **innochecksum** + utility were removed. + (Bug #28917614, Bug #93164) +* **InnoDB:** + A DDL operation that followed a failed attempt to create an + index on a virtual column resulted in an assertion failure. + (Bug #28825718) +* **InnoDB:** + A performance regression was observed for partial update + operations on compressed BLOBs less than or equal to 128KB in + size. + (Bug #28784301) +* **InnoDB:** + Running aggregated queries raised `Valgrind` + warnings. + (Bug #28711717) +* **InnoDB:** + A [`CHECK TABLE`](/doc/refman/8.0/en/check-table.html) operation raised an + assertion failure. A pointer to a local call stack variable was + not set back to null before a function exit. + (Bug #28525110) +* **InnoDB:** + DDL log functions were modified to handle + `ER_TOO_MANY_CONCURRENT_TRXS` errors. + (Bug #28523127, Bug #92071) +* **InnoDB:** + The purge thread failed to free LOB data pages. + (Bug #28510599) +* **InnoDB:** + Some DDL log table transactions were not rolled back prior to + DDL log recovery. + (Bug #28494969) +* **InnoDB:** + A function invoked during [`SHOW CREATE + TRIGGER`](/doc/refman/8.0/en/show-create-trigger.html) processing that retrieves the table name did + not perform the expected lowercase conversion. + (Bug #28351038) +* **InnoDB:** + The + [`INFORMATION_SCHEMA.INNODB_FOREIGN`](/doc/refman/8.0/en/information-schema-innodb-foreign-table.html) + `TYPE` column reported incorrect values. + (Bug #28315651, Bug #91577) +* **InnoDB:** + A Linux AIO handler function failed to check if completed I/O + events succeeded. Thanks to Wei Zhao for the contribution. + (Bug #27850600, Bug #90402) +* **InnoDB:** + An assertion failure was raised in a check that determines if a + transaction holds an implicit lock on a secondary index. A + transaction that does not change the columns of a secondary + index that includes virtual columns could be incorrectly + determined to hold an implicit lock. + (Bug #27491839) +* **InnoDB:** + A function called by a [`CREATE + TABLE`](/doc/refman/8.0/en/create-table.html) thread attempted to access a table object after + it was freed by a background thread. + + Thanks to Yan Huang for the patch. + (Bug #27373959, Bug #89126) +* **InnoDB:** + Two sessions concurrently executing an `INSERT ... ON + DUPLICATE KEY UPDATE` operation generated a deadlock. + During partial rollback of a tuple, another session could update + it. The fix for this bug reverts fixes for Bug #11758237, Bug + #17604730, and Bug #20040791. + (Bug #25966845) +* **InnoDB:** + When the method used to access a joined table was + `const`, [`InnoDB`](/doc/refman/8.0/en/innodb-storage-engine.html) + attempted to unlock the matching row multiple times. + (Bug #20939184) +* **InnoDB:** + The `INDEX_LENGTH` value in + [`INFORMATION_SCHEMA.TABLES`](/doc/refman/8.0/en/information-schema-tables-table.html) was not + updated when adding an index. + (Bug #19811005) +* **Partitioning:** + Some partitioning DDL statements were improperly rejected due to + name validation checks which used the wrong table identifier. + (Bug #29317007) +* **Partitioning:** + While rolling back + [`ALTER + TABLE ... COALESCE PARTITION`](/doc/refman/8.0/en/alter-table-partition-operations.html), the server sometimes + attempted to lock and close partitions which had been dropped as + a result of this statement. + (Bug #28517446) +* **Partitioning:** + An `AUTO_INCREMENT` key added to a partitioned + table by an [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) statement + using `ALGORITHM=INPLACE` restarted on each + partition. + (Bug #92241, Bug #28573894) +* **Replication:** + If the `WAIT_FOR_EXECUTED_GTID_SET()` function + was used with a timeout value including a fractional part (for + example, `1.5`), an error in the casting logic + meant that the timeout was rounded down to the nearest whole + second, and to zero for values less than 1 second (for example, + `0.1`). The casting logic has now been + corrected so that the timeout value is applied as originally + specified with no rounding. + + Our thanks to Dirkjan Bussink for the contribution. + (Bug #29324564, Bug #94247) +* **Replication:** + The consistency level `AFTER` for the system + variable + [`group_replication_consistency`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_consistency) + did not include the consistency guarantees provided by + `BEFORE_ON_PRIMARY_FAILOVER`. These consistency + guarantees, which were already implicitly present with the + `BEFORE` and + `BEFORE_AND_AFTER` consistency levels, are now + provided with `AFTER`. + (Bug #29315752, Bug #94213) +* **Replication:** + On Debian-based platforms (such as Ubuntu), if the hostname + resolved to 127.0.1.1 - which is the default on these platforms + - it was not possible to create a cluster using the default + settings. Now, in such situations a proper validation of the + instance is performed before creating a cluster and adding + instances to it. + (Bug #29246110) +* **Replication:** + In a blocked group, if you set an invalid value for + [`group_replication_force_members`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_force_members) + and then issued [`STOP + GROUP_REPLICATION`](/doc/refman/8.0/en/stop-group-replication.html), the server could stop unexpectedly. + (Bug #29119961) +* **Replication:** + MySQL Server's behavior when the + `mysql.gtid_executed` table cannot be accessed + has been refactored to provide appropriate error responses and + actions. The MySQL server now ensures that writes are permitted + to the `mysql.gtid_executed` table when the + server is in read only or super read only mode, so that the + binary log file can still be rotated in these modes. If the + `mysql.gtid_executed` table cannot be accessed + for writes, and the binary log file is rotated for any reason + other than reaching the maximum file size + ([`max_binlog_size`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_max_binlog_size)), the current + binary log file continues to be used. An error message is + returned to the client that requested the rotation, and a + warning is logged on the server. If the + `mysql.gtid_executed` table cannot be accessed + for writes and [`max_binlog_size`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_max_binlog_size) + is reached, the server responds according to its + [`binlog_error_action`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_error_action) setting. If + `IGNORE_ERROR` is set, an error is logged on + the server and binary logging is halted, or if + `ABORT_SERVER` is set, the server shuts down. + (Bug #29111514) +* **Replication:** + When issuing [`STOP + GROUP_REPLICATION`](/doc/refman/8.0/en/stop-group-replication.html) while the member was trying to + assess whether or not it had lost majority, the server could + stop unexpectedly. + (Bug #29053128) +* **Replication:** + When a [`RESET MASTER + TO`](/doc/refman/8.0/en/reset.html) statement is used to specify the starting index + number for binary log files, the maximum number that you can + specify has been reduced from the maximum integer value to + 2000000000. If the maximum integer value was specified, the + server was not able to start up because no further binary log + files could be created. The server also previously experienced a + segmentation fault in that situation. + (Bug #28980788, Bug #28995220) +* **Replication:** + On a replication slave with GTIDs in use and binary logging + disabled, an assertion was raised in debug mode when a DDL + statement was filtered out by a table filter. + (Bug #28965972) +* **Replication:** + Two issues with the deserialization of statement based + replication events in the binary log were corrected. + (Bug #28889181, Bug #29028491) +* **Replication:** + If an applier thread was stopped while it was in the process of + opening a table, no error was set, which could result in a + segmentation fault or assertion depending on the build type. + Error handling is now correctly activated in this situation. + (Bug #28864557) +* **Replication:** + With GTIDs in use on the server, the master info log on a + replication slave was being synchronized every time the master + skipped a transaction using the auto-skip function. The process + ends with a dummy heartbeat which is sent to the slave and + caused a forced flush to the log, and this could have a large + cumulative impact on the write load on the slave. The same issue + could occur in a circular replication topology with events that + originated from the same server and were therefore ignored, + which were also handled by the slave with a forced flush to the + log. The slave handling code has now been changed to remove the + forced flush for heartbeat events and for ignored events + received through circular replication, so that the master info + log is only synchronized when appropriate (for example, when a + `CHANGE MASTER` statement is issued, or the + binary log is rotated). + (Bug #28815555, Bug #85158) +* **Replication:** + When an [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) statement is + used with a `DEFAULT` clause to specify an + expression default value for a new column, and the expression + default value refers to a nondeterministic function, the + statement is unsafe for statement-based replication. Previously, + such statements were also evaluated in terms of GTID + consistency, which was not the appropriate check as the + statements do not impact GTID consistency. Now, these statements + are evaluated only for binary logging and are handled depending + on the binary logging format in use. When + [`binlog_format`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_format) is set to + `STATEMENT`, the statement is logged but a + warning message is written to the error log. When + [`binlog_format`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_format) is set to + `MIXED` or `ROW`, the + statement is not executed and an error message is written to the + error log. + (Bug #28799939) +* **Replication:** + In a replication group configured in single-primary mode + ([`group_replication_single_primary_mode=ON`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_single_primary_mode), + which is the default), if severe network delays affected the + group, it was possible for the primary and the secondaries to + reach different decisions on a transaction, which could lead to + divergence in the `gtid_executed` sets on the + members. The issue has now been fixed. + (Bug #28768550, Bug #28966455, Bug #92690) +* **Replication:** + When you use the + [`group_replication_force_members`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_force_members) + system variable to force a new configuration for a group, the + group communication engine (XCom) now checks that you have not + included any group members that are currently unreachable. If + any are found, the reconfiguration is disallowed and an error is + returned. + (Bug #28678845) +* **Replication:** + [`GRANT`](/doc/refman/8.0/en/grant.html) statements that were + written to the binary log were logged incorrectly in some cases, + which could result in a [`GRANT`](/doc/refman/8.0/en/grant.html) + statement that executed successfully on the master causing an + error on the replication slave. + (Bug #28643405, Bug #29155451, Bug #93750) +* **Replication:** + If a storage engine has the capability to log in + `STATEMENT` format but not in + `ROW` format, when + [`binlog_format`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_format) is set to + `STATEMENT`, an unsafe SQL statement should be + logged and a warning message should be written to the error log. + However, such statements were instead not executed and an error + message was written to the error log, which is the correct + behavior when [`binlog_format`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_format) is + set to `MIXED` or `ROW`. The + issue has now been corrected so that unsafe statements are + logged with a warning as expected when + [`binlog_format`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_format) is set to + `STATEMENT`. + (Bug #28429993, Bug #73936) +* **Replication:** + It is possible for a replication group member to go offline + briefly, then attempt to rejoin the replication group again + before the group has detected its failure and been reconfigured + to remove the member. Previously, in this situation, the + rejoining member could participate in XCom's consensus protocol + if it received and processed messages intended for its pre-crash + incarnation. This could cause XCom to deliver different values + for the same consensus round, because the rejoining member could + make a different decision before and after failure. To prevent + this situation, a rejoining member now ignores messages intended + for its pre-crash incarnation. + (Bug #27383487) +* **Replication:** + On overloaded servers there was a possibility that when a member + joined the group, the `VIEW_CHANGE_LOG_EVENT` + event which marks that point was not logged in the correct + place. This could lead to errors in the data transfer to the + newly joining server and data divergence. Now, the + `VIEW_CHANGE_LOG_EVENT` event is logged in the + correct place in the binary log. In addition, warnings are + logged about the delay in logging the event. + (Bug #93347, Bug #28971594) +* **Replication:** + When a member joined a group on server start, if the join + process failed, for example because the server was incompatible + with the group, there was a possibility that the offline member + could still see another member as being online. Now, in such a + situation the information shown in the + [`performance_schema.replication_group_members`](/doc/refman/8.0/en/performance-schema-replication-group-members-table.html) + table is restricted to the local member when it is + `OFFLINE`. + (Bug #92110, Bug #28533993) +* **Replication:** + In the event of the recovery channel failing, unprocessed relay + logs were being erased. + (Bug #90671, Bug #27940732) +* **Group Replication:** + [`START GROUP REPLICATION`](/doc/refman/8.0/en/start-group-replication.html) did not + function properly when the port specified for the member's local + address was busy. + (Bug #29347285) +* **Group Replication:** + When a host name was specified in the IP address whitelist for + Group Replication + ([`group_replication_ip_whitelist`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_ip_whitelist)),IPv6 + addresses were used for name resolution and whitelist comparison + when an IPv4 address was also available. An IPv4 address should + always be preferred for Group Replication connections. Now, if + the host name resolves to an IPv4 address, any IPv6 addresses + are not considered for comparison to the whitelist. + (Bug #28841543) +* **Group Replication:** + Previously, relay logs could not be rotated manually for the + Group Replication `group_replication_applier` + channel using the [`FLUSH RELAY + LOGS`](/doc/refman/8.0/en/flush.html#flush-relay-logs) statement. Due to this restriction, when + encryption was enabled for binary log files and relay log files + ([`binlog_encryption=ON`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_encryption)), as + available beginning with MySQL 8.0.14, the relay log file in use + on that channel could not be rotated immediately if encryption + was disabled again. The restriction had a similar impact on + binary log master key rotation, as available from MySQL 8.0.16. + The restriction has now been removed, and the + [`FLUSH RELAY LOGS`](/doc/refman/8.0/en/flush.html#flush-relay-logs) statement and + corresponding internal requests now operate on the + `group_replication_applier` channel as for any + other channel, with the exception that if the request is + received while a transaction is being applied, the request is + performed after the transaction ends. The requester must wait + while the transaction is completed and the rotation takes place. + This behavior prevents transactions from being split, which is + not permitted for Group Replication. + (Bug #28684376) +* **Group Replication:** + A replication group member could trigger a local view after + being expelled from the group due to a loss of majority. This + resulted in a message incorrectly stating that the member had + resumed regular operation after the expulsion. Group Replication + now checks before delivering a local view that the member has + not been expelled. + (Bug #27349236) +* **Group Replication:** + If an invalid value was specified for + [`group_replication_communication_debug_options`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_communication_debug_options), + the Group Communication System set its corresponding internal + variable to `GCS_DEBUG_NONE`, and the server + returned the invalid value for a [`SHOW + VARIABLES`](/doc/refman/8.0/en/show-variables.html) query. The value of this system variable is + now checked during server initialization, and if an invalid + value was specified, an error message is logged and Group + Replication does not start automatically. + (Bug #26729404) +* **macOS:** + `CMake` 3.12.4 or higher (which forces + `UseModernBuildSystem = NO`) is now required on + macOS if building with Xcode rather than Makefiles. + (Bug #28893131) +* **Microsoft Windows:** + Validity testing for the + [`named_pipe_full_access_group`](/doc/refman/8.0/en/server-system-variables.html#sysvar_named_pipe_full_access_group) + system variable did not account for `NULL` + values. + (Bug #29256690) +* **Microsoft Windows:** + When multiple instances of **mysqld** were + started with the [`--no-monitor`](/doc/refman/8.0/en/server-options.html#option_mysqld_no-monitor) + option on the same host for same user, the + `SHUTDOWN` command shut down the wrong server + process. This fix creates a unique shutdown event name for use + with [`--no-monitor`](/doc/refman/8.0/en/server-options.html#option_mysqld_no-monitor) by appending + the process ID of the process. + (Bug #28723675) +* **JSON:** + The JSON path parser now propagates errors in the same way as + most other components of the MySQL server, returning true on + error and false on success. + (Bug #28851426) +* **JSON:** + Removed an unneeded type lookup in + `Json_wrapper::get_datetime()`. + (Bug #28851324) +* The `authentication_ldap_simple` plugin could + enforce authentication incorrectly. + (Bug #29637712) +* RPM package obsoletes were updated to enable successful upgrades + from MariaDB to MySQL on EL8. + (Bug #29413354) +* It was possible for the result of an outer join to contain a + non-`NULL` row where a `NULL` + extended row was expected. + (Bug #29402481) + + References: This issue is a regression of: Bug #27808758. +* `SET PASSWORD FOR ...` could not be executed as + a prepared statement. + (Bug #29387041, Bug #94416) +* Builds under Visual Studio could fail while building MySQL + Router libraries. + (Bug #29382197) + + References: This issue is a regression of: Bug #29361890. +* Imported foreign keys did not work if defined before the + referenced table. + (Bug #29379078, Bug #94400) + + References: This issue is a regression of: Bug #28493257. +* When an error was raised while evaluating the + `ESCAPE` clause of a `LIKE` + expression at resolve time, the error status was not propagated + to the caller. + (Bug #29368521) +* Tablespace files for the + `innodb_table_stats_backup` and + `innodb_index_stats_backup` metadata backup + tables were not removed after an in-place upgrade from MySQL 5.7 + to MySQL 8.0. + (Bug #29365552) +* While flattening a subquery, if a predicate which was always + false was present, the MySQL Optimizer did not perform any kind + of transformation, resulting in a subquery that was not + prepared, and which asserted later when it was executed. To + resolve this issue, when such a predicate is present in a + subquery, the subquery's query expression is now unlinked from + the query block. + (Bug #29356132) +* Upgrade from MySQL 8.0.11, 8.0.12, or 8.0.13 to MySQL 8.0.14 or + 8.0.15 failed if an event, routine, or trigger was defined with + the [`ALLOW_INVALID_DATES`](/doc/refman/8.0/en/sql-mode.html#sqlmode_allow_invalid_dates) SQL + mode. The SQL mode identifier in the data dictionary was changed + in MySQL 8.0.14, causing a migration failure. + (Bug #29350955) +* RPM builds ignored the [`WITH_SSL`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_ssl) + configuration setting. + (Bug #29347534) +* Length metadata for the + [`TO_SECONDS()`](/doc/refman/8.0/en/date-and-time-functions.html#function_to-seconds) function was not + always calculated correctly. + (Bug #29321387) +* Conditions using windowing functions removed due to being always + true or false were not always handled correctly. + (Bug #29320484) +* [`SET ROLE`](/doc/refman/8.0/en/set-role.html) statements could leak + memory. + (Bug #29304583) +* Upgrading from MySQL 5.7 to MySQL 8.0 on Windows failed with + “Error 197 from SE while migrating tablespaces”. + The error was due to an access share violation that occurred + when attempting to open a tablespace file. + (Bug #29292860) + + References: This issue is a regression of: Bug #28642608. +* The [`COMPILATION_COMMENT_SERVER`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_compilation_comment_server) + value could be incorrect in RPM packages. + (Bug #29284651) +* `CREATE TABLE IF NOT EXISTS` failed even if the + table already exists if the new table definition had no primary + key and the + [`sql_require_primary_key`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_require_primary_key) system + variable was enabled. + (Bug #29283055, Bug #94134) +* A delete from a partitioned table from which all partitions had + been pruned away was not always handled correctly. + (Bug #29280186) +* The **CMake** check for the GNU + `gold` linker could fail with Clang. + (Bug #29278244) +* The data dictionary version was incremented for the MySQL 8.0.16 + release. + (Bug #29278241) +* An argument of the wrong type to a function used with + `DISTINCT` was not always handled correctly. + (Bug #29277571) +* Length metadata for the [`QUOTE()`](/doc/refman/8.0/en/string-functions.html#function_quote) + function was not always calculated correctly. + (Bug #29276074) +* When evaluating [`GREATEST()`](/doc/refman/8.0/en/comparison-operators.html#function_greatest) or + [`LEAST()`](/doc/refman/8.0/en/comparison-operators.html#function_least), MySQL checked for + correct signedness of the return value before checking it for + `NULL`. + (Bug #29275835) +* When strict SQL mode was not in effect, the values of some + string functions returning `NULL` to indicate a + result greater than + [`max_allowed_packet`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_allowed_packet) were handled + inconsistently behaviour, which could result in incorrectly + sorted output and possibly other misbehaviors. + (Bug #29272683) + + References: See also: Bug #97301, Bug #29133127. +* Logic that checks if upgrade is supported to a particular server + version was inverted to check for server versions from which + upgrade is not supported. + (Bug #29270297) +* Event creation could store an incorrect repetition interval. + (Bug #29269819, Bug #94085) +* A WHERE condition containing a view reference or an item created + by a transformation was not always handled correctly. + (Bug #29268867, Bug #29268698, Bug #28723669, Bug #29244238) +* **mysql\_ssl\_rsa\_setup** failed to compile using + GCC 9. + (Bug #29245251) +* If **CMake** finds a `libtirpc` + library that is too old to work with MySQL, it tries to use Sun + RPC from `glibc` instead. + (Bug #29240701) +* The server could fail to write slow queries to the slow query + log due to incorrect calculation of query execution time. + (Bug #29232684, Bug #93963) +* MySQL regular expression functions using positions employed + internal indexes based on 16-bit chunks, rather than on + codepoint positions. + (Bug #29231490) +* On Windows, the MySQL MSI installer could fail to correctly + detect whether the Visual Studio 2015 Redistributable was + installed. + (Bug #29227209) +* SDI `JSON` files did not include the + `m_hidden` field of + `Index_impl` objects. This made it hard to use + the SDI `JSON` to recreate the + `CREATE` statement for the table because + `InnoDB` adds a number of hidden indexes. The + SDI `JSON` now includes the + `m_hidden` field. This changes SDI format, so + the SDI version number was increased to the current server + version number. + (Bug #29210646, Bug #93914) +* The position hint for the last row in a range frame was updated + to be one row past the actual last row in the frame. + (Bug #29201831) +* In a column definition, multiple constraint definitions were not + accepted when the first was a `CHECK` + constraint. + (Bug #29191994) +* Error log information buffered during startup could be buffered + too long if the server was performing an upgrade. + (Bug #29189532) +* For nullable columns, if we find an expression that is always + true except when the column is `NULL`, the + expression is folded to + `column IS NOT + NULL`. When such an expression was nested, this caused + `NULL` rows to be selected in error. To prevent + this from happening, such an expressions when nested is now + instead folded to `IF(column + IS NULL, NULL, TRUE)`. + (Bug #29179604) +* [`PERIOD_ADD()`](/doc/refman/8.0/en/date-and-time-functions.html#function_period-add) did not handle + values greater than 32 bits in length for the + *`period`* argument correctly on Windows + platforms. + (Bug #29175262) +* When [`sql_auto_is_null`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_auto_is_null) is + enabled, a `WHERE` clause of the form + `WHERE auto_increment_col IS + NULL` is rewritten as `WHERE + auto_increment_col =` + [`LAST_INSERT_ID()`](/doc/refman/8.0/en/information-functions.html#function_last-insert-id). This + transformation was only performed once per auto-incremented + value, which made it difficult to know in advance whether the + transformation would be performed. Now the transformation is + performed unconditionally whenever + `sql_auto_is_null` is enabled. + + In addition, the value returned by + `LAST_INSERT_ID()` is now treated as unsigned, + fixing a failure to match an auto-incremented value outside the + range of a signed [`BIGINT`](/doc/refman/8.0/en/integer-types.html). + (Bug #29171668) +* On Debian and Ubuntu, installation operations in noninteractive + mode ignored the `root` password, resulting in + the `auth_socket` authentication plugin being + installed by default. + (Bug #29165407) +* The `harness_plugin_eventlog` declaration + caused compilation errors in some build environments. + (Bug #29160214) +* The logic for truncating or extending a decimal constant to the + desired number of fractional digits during constant folding was + lacking. Extra trailing zeros in the fraction could trigger an + attempt to widen the faction, since the decision to widen was + based on the number of non-zero fractional digits, rather than + on total number of fractional digits, leading to an assert (in + debug builds) in the internal function + `widen_fraction()`. This issue is fixed by + identifying where it is possible merely to truncate excess + trailing zeroes. In this case, it is not necessary to adjust the + comparison operator, and the constant can be replaced by one + having fewer trailing zeroes instead. + (Bug #29155439) +* On Windows, the internal function + `get_mysql_time_from_str_no_warn()` did not + always perform proper error checking. + (Bug #29155126) + + References: See also: Bug #29175262. +* Under certain conditions, [`RENAME + TABLE`](/doc/refman/8.0/en/rename-table.html) statements that renamed the same table multiple + times could raise an assertion or cause a server exit. + (Bug #29140407) +* For debug builds, starting the server with + [`--event-scheduler=DISABLED`](/doc/refman/8.0/en/server-system-variables.html#sysvar_event_scheduler) could + result in an assertion being raised for certain events. + (Bug #29140298, Bug #93719) +* In debug builds, When strict SQL mode was not in effect, the + [`CONCAT()`](/doc/refman/8.0/en/string-functions.html#function_concat) and + [`CONCAT_WS()`](/doc/refman/8.0/en/string-functions.html#function_concat-ws) functions raised an + assertion if the result was longer than + [`max_allowed_packet`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_allowed_packet). + (Bug #29133127) +* An out-of-range fractional part could produce incorrect + timestamps in `SET SESSION timestamp` + statements. + (Bug #29120569, Bug #93600) +* The `mysql_service_component_sys_variable` + service could access component system variables but not server + or plugin system variables. + (Bug #29113463) +* `ALTER TABLE ... CONVERT TO CHARACTER SET` + could produce a memory-access error. + (Bug #29058369, Bug #93603) +* The `mysql.tablespaces.name` column limit was + 259 bytes, which was less than required for permitted identifier + lengths. The column limit was raised to 268 bytes. + (Bug #29053560, Bug #93587) +* For debug builds, for spatial computations that raised an + assertion, partition-handling code ignored the error, resulting + in a server exit. + (Bug #29047811) +* A zero length LOB that was stored externally caused an assertion + failure. + (Bug #29047795) +* Handling of the `COMPILE_DEFINITIONS` and + `COMPILE_FLAGS` **CMake** options + was adjusted to avoid cross-compiling failures. + (Bug #29041100) +* The server could try to read the first diagnostics area message + even when the [`max_error_count`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_error_count) + system variable was set to zero, resulting in a memory-access + error. + (Bug #29031684) +* When comparing [`DATE`](/doc/refman/8.0/en/datetime.html) values with + constant strings, MySQL first tries to convert the string to a + `DATE` and then to perform the comparison. When + the conversion failed, MySQL executed the comparison treating + the `DATE` as a string, which could lead to + unpredictable behavior. Now in such cases, if the conversion of + the string to a `DATE` fails, the comparison + fails with [`ER_WRONG_VALUE`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_wrong_value). + (Bug #29025656) + + References: See also: Bug #95466, Bug #29812087. +* With the [`--users`](/doc/refman/8.0/en/mysqlpump.html#option_mysqlpump_users) option, + **mysqlpump** wrote `CREATE + USER` and `GRANT` statements to the + output, but too late to apply to the other objects created by + the dump. Consequently, restoring the dump file created the user + accounts too late to apply to other objects created by the file. + **mysqlpump** now writes user accounts to the + dump file before other objects. + (Bug #29023216) +* For syntax errors at the position of the + [`WITH`](/doc/refman/8.0/en/with.html) keyword, the parser error + message identified the problem at the incorrect location. + (Bug #29022263) +* MySQL builds using recent versions of the International + Components for Unicode (ICU) now return + [`ER_REGEXP_ILLEGAL_ARGUMENT`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_regexp_illegal_argument) + rather than the generic error + [`ER_REGEXP_ERROR`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_regexp_error) for malformed + regular expressions. + (Bug #29016798) +* On Windows, the LDAP library could not be found if the file + system was case sensitive. + (Bug #29016220) +* Values selected from the `TABLE_COMMENT` column + of the [`INFORMATION_SCHEMA.TABLES`](/doc/refman/8.0/en/information-schema-tables-table.html) + table could be truncated. + (Bug #29014272, Bug #93451) +* Data layer memory leaks related to unfreed schemas were + discovered in ASAN and Valgrind builds. + (Bug #29008688) +* A `GROUP BY` query with + `ROLLUP` incorrectly raised + [`ER_WRONG_FIELD_WITH_GROUP`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_wrong_field_with_group) when + used with an `ORDER BY` clause that contained + an expression. + + The same issue also led to incorrect ordering of the result from + a `GROUP BY` query with ROLLUP when ordering on + a function. + (Bug #29006668, Bug #29054096) +* The parser accepted multiple `COLLATE` clauses + in generated column definitions. It now accepts a single + `COLLATE` clause. + (Bug #28997518) +* `INSERT ... ON DUPLICATE KEY UPDATE` could + perform incorrect updates. + (Bug #28995498, Bug #93410) + + References: This issue is a regression of: Bug #26188578. +* A damaged `mysql.user` table could cause a + server exit. + (Bug #28986737) +* Reading rows from the Performance Schema + [`data_locks`](/doc/refman/8.0/en/performance-schema-data-locks-table.html) or + [`data_lock_waits`](/doc/refman/8.0/en/performance-schema-data-lock-waits-table.html) table could return + an unbounded number of rows during a scan, resulting in a server + exit due to excessive memory allocation. This situation now + produces an error. + (Bug #28977428, Bug #87748) +* Calculating the cost of materialization for a + `LATERAL` join on an empty table led to an + assertion. Now in such cases, the query cost is reported as + zero. + (Bug #28976533) +* For debug builds, an invalid `utf8` character + in the comment string for a column type in + `CREATE` or `ALTER` DDL + statements raised an assertion. + (Bug #28972424, Bug #93321) +* The **CMake** check for `tirpc` + headers now falls back to using `pkgconfig`, to + enable finding the headers on more Linux platforms. This + requires that **pkgconfig** be installed. + (Bug #28970313, Bug #93341, Bug #28997093) +* **mysqld** could undergo an unplanned shutdown + when a component in the `WHERE` clause of a + subquery was non-deterministic, in this particular case due to + referencing a user variable that was also set in the same + statement. This issue is fixed by ignoring predicates having + non-deterministic components. + + In addition, since non-deterministic subqueries as a general + rule should be evaluated per outer row, these should not be + targets for materialization strategy. This is prevented by not + decorrelating the non-deterministic predicates. When possible, + the same strategy selection for non-semijoin and + non-deterministic subqueries is also now enforced. + (Bug #28970261) +* [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) statements to change + a table storage engine could hang when user-level locks and + explicit table locks had been acquired earlier. + (Bug #28966941) +* [`COUNT()`](/doc/refman/8.0/en/aggregate-functions.html#function_count) with `LIMIT ... + OFFSET` returned a different result from that obtained + with other aggregate functions used with this clause. + (Bug #28961843) +* Extracting the value of the `MYSQL_HOME` + environment variable could change the value of the variable + stored following `MYSQL_HOME` in the + environment. + (Bug #28960613) +* `Item_subselect::walk_body()` now walks + `FROM` clauses. + (Bug #28955358) +* An issue was uncovered in query plan for a query with the + following two `IN` subqueries: + + + A subquery with a derived table containing an outer + reference to the topmost query + + A subquery with a derived table, which was not + outer-correlated, was semijoined, and was not lateral. + + For the second subquery: calculation of the map of dependencies + neglected to exclude irrelevant lateral tables, and wrongly + included dependencies of the derived table in the first + subquery. + (Bug #28954838) +* An error generated while evaluating a constant expression in + certain `GROUP BY` queries was not checked for + in a timely fashion. + (Bug #28949452) +* When comparing a [`DATE`](/doc/refman/8.0/en/datetime.html) or + [`DATETIME`](/doc/refman/8.0/en/datetime.html) value with a string + MySQL first tries to convert the string to the same type + (`DATE` or + [`DATETIME`](/doc/refman/8.0/en/datetime.html)) and then to compare the + two as values of that type. If this conversion fails, MySQL + raises an Incorrect date value warning + and then falls back to comparing the values as strings, which is + the expected behavior. In some cases, even though the converted + string did not reflect a valid `DATE` or + `DATETIME` value, no warning was issued so and + it was compared with the `DATE` or + `DATETIME` value as a value of that type. Now + in such cases, the converted string is always checked for + validity as a `DATE` or + `DATETIME` before being compared, unless the + `ALLOW_INVALID_DATES` server + SQL mode has been set explicitly. + (Bug #28940878) +* Long client host names could cause unexpected server behavior. + (Bug #28936359) +* Substitution of a large number of parameters in a single + prepared statement could lead to excessive and unnecessary + reallocation of memory. This is fixed by having + `String::replace()` use exponential buffer + growth as `String::append()` does. + (Bug #28929977) +* The data dictionary cache could become out of sync with data + dictionary contents due to failure to check the result of a + transaction-related operation. + (Bug #28923782, Bug #93196) +* Determination of the number of online CPUs available to the + **mysqld** process is now more accurate. Thanks + to Daniel Black for the contribution. + (Bug #28907677, Bug #93144) +* The [`INFORMATION_SCHEMA.TABLES`](/doc/refman/8.0/en/information-schema-tables-table.html) + `TABLE_COMMENT` column reported the wrong error + message due to an invalid view. + (Bug #28901919) +* After upgrading, the + [`INFORMATION_SCHEMA.TABLES`](/doc/refman/8.0/en/information-schema-tables-table.html) view + reported “View '*`view_name`*' + references invalid table(s) or column(s) or function(s) or + definer/invoker of view lack rights to use them” for + several [`sys`](/doc/refman/8.0/en/sys-schema.html) schema views. The + upgrade process did not update the referencing view state. + (Bug #28901821) +* Creating histograms for large tables (millions of rows) having + many distinct column values took an excessive amount of time. + + The fix make this process marginally slower for data sets with + few distinct values and consumes slightly more memory than + previously, but for large data sets with many distinct values it + is significantly faster. + (Bug #28888936) +* Upgrade from MySQL 5.7 to MySQL 8.0 failed for instances with a + an `InnoDB` 4K page size due a key length error + that should be suppressed during upgrade. + (Bug #28884503) +* An incorrectly configured keyring plugin could cause a server + exit. + (Bug #28876033) +* Two issues were found in cases involving use of the + [`COUNT()`](/doc/refman/8.0/en/aggregate-functions.html#function_count) function: + + + When the argument passed to `COUNT()` was a + nullable expression, it was possible for the function to + return an incorrect result. + + A query using `COUNT()` together with an + [`EXISTS`](/doc/refman/8.0/en/exists-and-not-exists-subqueries.html) + subquery returned an incorrect result. + + (Bug #28857990, Bug #29240516) +* Commands for invoking **ccache** during MySQL + builds were generated incorrectly. + (Bug #28841612, Bug #92927) +* Previously, for [`INSERT`](/doc/refman/8.0/en/insert.html) statements + that listed insert column names multiple times, only the first + duplicated name was reported. Now, all duplicated names are + reported. + (Bug #28836669) +* When using `ROLLUP`, the `GROUP + BY` may yield `NULL` in some rows. + Expressions referencing any of these rows could lose the + `NULL`, producing an incorrect result. + (Bug #28836345) +* After a failed attempt to open a table, attempts to discover the + table from the storage engine did not check for an error return, + which could cause the server to hang if an error occurred. + (Bug #28828450) +* The server could exit when trying to drop a user who had been + granted a particular role. + (Bug #28817441) +* MySQL Router compilation failed if MySQL was configured with + [`-DWITH_MYSQLX=0`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_mysqlx). + (Bug #28811356) +* A function called during data dictionary upgrade temporarily + modified the `avoid_temporal_upgrade` parameter + so that a check for old temporal types is always performed. + Because multiple threads could call the function concurrently, a + check was added to ensure that the parameter value could be + safely modified during data dictionary upgrade. + (Bug #28805429) +* An `EXISTS` subquery is converted to a semijoin + operation. The optimizer chooses a materialization lookup + strategy for this semijoin, but because the subquery is not + correlated with the outer query block, there were no keys to use + for the lookup, which caused the parent query to fail. To solve + this issue, we use two equal constant items as keys, to ensure + that the materialized query gets the constant as a key (and so + that the materialized table consists of at most one row). + (Bug #28805105) +* The [`Last_query_cost`](/doc/refman/8.0/en/server-status-variables.html#statvar_Last_query_cost) status + variable now shows the cost of queries which contain multiple + blocks such as subqueries or unions. (Previously, this variable + was set only for simple queries consisting of a single query + block.) + (Bug #28786951) +* The message displayed by **mysqld** when a fatal + signal occurred has been simplified and made more informative. + It also does not display the calculation of memory usage, which + had become out of date and inaccurate. + (Bug #28773322, Bug #92731) +* The [`skip_name_resolve`](/doc/refman/8.0/en/server-system-variables.html#sysvar_skip_name_resolve) system + variable could be persisted using + [`SET + PERSIST_ONLY`](/doc/refman/8.0/en/set-variable.html) to enable it, but not to disable it. + (Bug #28749668) +* Removed obsolete and unnecessary condition pushdown handling in + iterators except where required by single table update and + delete queries. + (Bug #28745859) +* `IS NOT NULL` predicates are added as part of + early filtering of `NULL` for ref access + performed by the Optimizer. For queries having a star-join + topology, redundant duplicates of these predicates were added, + which made evaluation of affected `WHERE` + conditions less efficient. + (Bug #28727717) +* **CMake** could generate an incorrect order of + system includes when MySQL was configured to use the bundled + version of a system library. + (Bug #28727631, Bug #92615) +* Some numeric operations involving double to long long + conversions could return different results on Windows and Linux. + (Bug #28706832) +* An attempt to access a null pointer could occur during prepared + statement execution. + (Bug #28692136) +* [`FROM_UNIXTIME()`](/doc/refman/8.0/en/date-and-time-functions.html#function_from-unixtime) returned an + out-of-range value if passed an argument that, when rounded up, + exceeded the epoch value. Now it returns `NULL` + as for other out-of-range values. + (Bug #28671811, Bug #92501) +* A replicated DDL operation could result in a 'duplicate entry on + primary key' error during recovery on servers started with the + [`slave_parallel_workers`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_parallel_workers) system + variable. + (Bug #28670843) +* Empty host names in accounts could cause the server to + misbehave. + (Bug #28653104) +* The MySQL 5.7 to MySQL 8.0 upgrade process did not check for the + existence of tablespace files, which could result in an + inconsistent data dictionary. + (Bug #28642608) +* Type casting of [`ENUM`](/doc/refman/8.0/en/enum.html) behaved + differently in subqueries than not in subqueries. + (Bug #28547906, Bug #92173) +* Statements that caused truncation of floating-point values could + be executed as prepared statements even when the server SQL mode + included `STRICT_TRANS_TABLES`. + In addition, if the binary logging mode was + `MIXED`, such statements were propagated to the + slave, where they caused errors. + (Bug #28546855) +* Reducing the value of + [`thread_cache_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_thread_cache_size) at runtime + did not reduce the size of the thread cache. + (Bug #28508923, Bug #92024) +* Some error messages still referred to the + `PASSWORD()` function, which has been removed. + (Bug #28498714) +* The [`Aborted_connects`](/doc/refman/8.0/en/server-status-variables.html#statvar_Aborted_connects) status + variable was not incremented for unsuccessful connection + attempts, if connections were managed by the + `thread_pool` plugin. + (Bug #28490126) +* **mysqladmin shutdown** did not wait for + **mysqld** to shut down. + (Bug #28466137, Bug #91803) + + References: This issue is a regression of: Bug #25364806. +* Specifying [`CURRENT_USER`](/doc/refman/8.0/en/information-functions.html#function_current-user) as the + user in [`GRANT`](/doc/refman/8.0/en/grant.html) statements could + fail. + (Bug #28454014) +* Repeated invocations of stored procedures which executed queries + undergoing short-circuit evaluation were not always handled + correctly. + (Bug #28379655) +* Keyring migration should require only read access to the source + keyring, but failed unless the user had write access. + (Bug #28339014) +* If a user performing a keyring migration did not have write + access to the keyring file, the migration failed but reported + success in its final error log message. + (Bug #28330922) +* During `FLUSH STATUS` execution, the + Performance Schema unnecessarily aggregated session status to + global status, causing double counts for some status variables. + (Bug #28291258, Bug #91541) +* **mysql\_secure\_installation** no longer attempts + to read a password from the `.mysql_secret` + file. This was created by **mysql\_install\_db**, a + program that has been removed. + (Bug #28235716, Bug #91270) +* Some status variable values could temporarily increase before + returning to their original value. + (Bug #27839644, Bug #90351) +* Client programs did not exit if + [`--ssl-fips-mode`](/doc/refman/8.0/en/connection-options.html#option_general_ssl-fips-mode) was given but + FIPS mode could not be set to the specified option value. + (Bug #27809371) +* Executing [`ALTER INSTANCE ROTATE INNODB + MASTER KEY`](/doc/refman/8.0/en/alter-instance.html#alter-instance-rotate-innodb-master-key) and migrating keys from the + `keyring_file` plugin to the + `keyring_encrypted_file` plugin could make + encrypted tables unusable. + (Bug #27760952) +* When upgrading from MySQL Community to Commercial, the + `root` password prompt was shown even when the + data directory existed. + (Bug #27741998) +* In the client/server protocol, malformed packets for prepared + statements could go undetected and cause an assertion to be + raised. + (Bug #27627731) +* Changes were made in session connect and disconnect handling for + threads in order to speed up query throughput when using the X + Plugin. Previously, a session (`Srv_session`) + was attached to and detached from the current thread with every + command; now, this thread switch takes place only when + disconnecting the current session, or when the current thread + and the thread being attached to belong to different plugins. + (Bug #27463277) +* The `PERSIST` and + `PERSIST_ONLY` keywords were reserved by + mistake. They are now nonreserved keywords. + (Bug #25220656) +* Installing and uninstalling a plugin concurrently with client + connection activity could cause a server exit. + (Bug #22980441) +* The [`LOAD_FILE()`](/doc/refman/8.0/en/string-functions.html#function_load-file) function could + fail for files for which `stat()` should be + considered only advisory, such as files under + `/proc`. + (Bug #18394503, Bug #72027) +* A query using an `ORDER BY` clause failed + silently when the table being queried had an implicit full-text + index and the sort buffer was of insufficient size to contain + the sorted keys. + (Bug #93241, Bug #28940361) +* A loadable function returning a string value now sets an + explicit return type. Depending on the arguments passed to the + function, this is one of [`VARCHAR`](/doc/refman/8.0/en/char.html), + [`MEDIUMBLOB`](/doc/refman/8.0/en/blob.html), or + [`LONGBLOB`](/doc/refman/8.0/en/blob.html). + (Bug #92890, Bug #28828169) +* Made a comparison in the internal method + `Item_result::item_cmp_type()` more efficient. + Our thanks to Daniel Black for the contribution. + (Bug #92784, Bug #28796107) +* A windowing function employed in an arithmetic expression + produced an incorrect result when the query containing it used + `DISTINCT`. + (Bug #92503, Bug #28672483) +* Some queries involving complex joins leaked file handles. + (Bug #90902, Bug #28039829) +* Fedora packaging now supports Fedora 30. +* Ubuntu 14.04 and SLES 11 are EOL, and no longer supported. diff --git a/corpus/changelog/mysql_releases/mysql_8017.md b/corpus/changelog/mysql_releases/mysql_8017.md new file mode 100644 index 0000000000000000000000000000000000000000..c28b7df9058d8c0866db3234121abdf760c943d0 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8017.md @@ -0,0 +1,2241 @@ +# MySQL 8.0.17 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-17.html +Version: 8.0.17 + +## Changes in MySQL 8.0.17 (2019-07-22, General Availability) + +For general information about upgrades, downgrades, platform support, etc., please visit [https://dev.mysql.com/doc/relnotes/mysql/8.0/en/](/doc/relnotes/mysql/8.0/en/). + +* [Audit Log Notes](news-8-0-17.html#mysqld-8-0-17-audit-log "Audit Log Notes") +* [C API Notes](news-8-0-17.html#mysqld-8-0-17-capi "C API Notes") +* [Character Set Support](news-8-0-17.html#mysqld-8-0-17-charset "Character Set Support") +* [Component Notes](news-8-0-17.html#mysqld-8-0-17-components "Component Notes") +* [Configuration Notes](news-8-0-17.html#mysqld-8-0-17-configuration "Configuration Notes") +* [Debugging Notes](news-8-0-17.html#mysqld-8-0-17-debugging "Debugging Notes") +* [Deprecation and Removal Notes](news-8-0-17.html#mysqld-8-0-17-deprecation-removal "Deprecation and Removal Notes") +* [Installation Notes](news-8-0-17.html#mysqld-8-0-17-installation "Installation Notes") +* [Keyring Notes](news-8-0-17.html#mysqld-8-0-17-keyring "Keyring Notes") +* [Packaging Notes](news-8-0-17.html#mysqld-8-0-17-packaging "Packaging Notes") +* [Performance Schema Notes](news-8-0-17.html#mysqld-8-0-17-performance-schema "Performance Schema Notes") +* [Plugin Notes](news-8-0-17.html#mysqld-8-0-17-plugins "Plugin Notes") +* [Security Notes](news-8-0-17.html#mysqld-8-0-17-security "Security Notes") +* [X Plugin Notes](news-8-0-17.html#mysqld-8-0-17-xplugin "X Plugin Notes") +* [Functionality Added or Changed](news-8-0-17.html#mysqld-8-0-17-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-17.html#mysqld-8-0-17-bug "Bugs Fixed") + +### Audit Log Notes + +* Encryption and decryption operations for encrypted MySQL Enterprise Audit log + files use a password stored in the MySQL keyring. Previously, + only a single password was stored. Generating a new password + made the old password inaccessible, rendering MySQL Enterprise Audit unable + to read log files encrypted with the old password. MySQL Enterprise Audit now + implements password history in the keyring, which includes + password archiving and expiration capabilities. The audit log + plugin includes in each encrypted log file name the ID of the + password required to read the file. To enable expiration and + removal of old archived passwords in the keyring, the new + [`audit_log_password_history_keep_days`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_password_history_keep_days) + system variable is available. See + [Configuring Audit Logging Characteristics](/doc/refman/8.0/en/audit-log-logging-configuration.html). + (WL #11246) + +### C API Notes + +* These C API changes were made: + + + `HOSTNAME_LENGTH` was changed from 60 to + 255 and moved from `include/mysql_com.h` + to `include/my_hostname.h`. + + `USER_HOST_BUFF_SIZE` was moved from + `include/mysql_com.h` to + `sql/auth/auth_common.h`. + + (Bug #29590300) + +### Character Set Support + +* The `utf8mb4` character set has a new binary + collation, `utf8mb4_0900_bin`, which differs + from the existing `utf8mb4_bin` binary + collation as follows: + + + For collating weights, `utf8mb4_bin` uses + code points, possibly with leading zero bytes added, whereas + `utf8mb4_0900_bin` uses the + `utf8mb4` encoding bytes. The sort order is + the same for both collations, but sorting for + `utf8mb4_0900_bin` is much faster. + + The pad attribute for `utf8mb4_bin` is + `PAD SPACE`, whereas for + `utf8mb4_0900_bin` it is `NO + PAD`. Consequently, operations involving + `utf8mb4_0900_bin` do not add trailing + spaces, and comparisons involving strings with trailing + spaces may differ for the two collations. + + For more information, see + [Unicode Character Sets](/doc/refman/8.0/en/charset-unicode-sets.html). + (WL #10354) + +### Component Notes + +* A new `mysql_current_thread_reader` component + service is available to enable components to obtain a handle to + the current thread. For example, the service enables components + to access properties of the current session by passing its + thread handle to other services. For information about this + service, see the Component Subsystem section of the MySQL Server + Doxygen documentation, available at + [https://dev.mysql.com/doc/index-other.html](/doc/index-other.html). + (WL #12727) + +### Configuration Notes + +* The source files in the `mysys_ssl` directory + have been moved to the `mysys` directory and + the `mysys_ssl` library is no longer built. + (Bug #29488066) +* MySQL configuration now requires a minimum + **CMake** version of 3.5.1. + (Bug #29337090) +* The maximum permitted length of host names throughout MySQL has + been raised to 255 ASCII characters, up from the previous limit + of 60 characters. This applies to, for example, host + name-related columns in the data dictionary, + `mysql` system schema, Performance Schema, + `INFORMATION_SCHEMA`, and + `sys` schema; the + `MASTER_HOST` value for the + [`CHANGE MASTER TO`](/doc/refman/8.0/en/change-master-to.html) statement; the + `Host` column in [`SHOW + PROCESSLIST`](/doc/refman/8.0/en/show-processlist.html) statement output; host names in account + names (such as used in account-management statements and in + `DEFINER` attributes); and host name-related + command options and system variables. + + Caveats: + + + The increase in permitted host name length can affect tables + with indexes on host name columns. For example, tables in + the `mysql` system schema that index host + names now have an explicit `ROW_FORMAT` + attribute of `DYNAMIC` to accommodate + longer index values. + + Some file name-valued configuration settings might be + constructed based on the server host name. The permitted + values are constrained by the underlying operating system, + which may not permit file names long enough to include + 255-character host names. This affects the + [`general_log_file`](/doc/refman/8.0/en/server-system-variables.html#sysvar_general_log_file), + [`log_error`](/doc/refman/8.0/en/server-system-variables.html#sysvar_log_error), + [`pid_file`](/doc/refman/8.0/en/server-system-variables.html#sysvar_pid_file), + [`relay_log`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_relay_log), and + [`slow_query_log_file`](/doc/refman/8.0/en/server-system-variables.html#sysvar_slow_query_log_file) system + variables and corresponding options. If host name-based + values are too long for the OS, explicit shorter values must + be provided. + + Although the server now supports 255-character host names, + connections to the server established using the + [`--ssl-mode=VERIFY_IDENTITY`](/doc/refman/8.0/en/connection-options.html#option_general_ssl-mode) + option are constrained by maximum host name length supported + by OpenSSL. Host name matches pertain to two fields of SSL + certificates, which have maximum lengths as follows: Common + Name: maximum length 64; Subject Alternative Name: maximum + length as per RFC#1034. + + Applications that expect host names to be a maximum of 60 + characters should be adjusted to account for this change. + (Bug #13548245, Bug #63814, Bug #27925782, Bug #90601, Bug #27955121, Bug #29584642, Bug #29602081, Bug #94907, WL #12571) + +### Debugging Notes + +* The MySQL server is a multithreaded application that uses + numerous internal locking primitives such as mutexes. To enable + detection of lock-acquisition deadlocks and enforcement that + runtime execution is free of them, MySQL now supports LOCK\_ORDER + tooling. This enables a lock-order dependency graph to be + defined as part of server design, and server runtime checking to + ensure that lock acquisition is acyclic and that execution paths + comply with the graph. LOCK\_ORDER support includes: + + + A `lock_order_dependencies.txt` file that + defines the server lock-order dependency graph. + + A [`WITH_LOCK_ORDER`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_lock_order) + **CMake** option that configures whether + MySQL is built with LOCK\_ORDER tooling. + + A set of system variables that configure LOCK\_ORDER tool + operation during server execution. + + A `--lock-order` option for + **mysql-test-run.pl** that controls whether + to enable the LOCK\_ORDER tool during test case execution. + + To use the LOCK\_ORDER tool, you must build MySQL from source + with tooling enabled. See [The LOCK\_ORDER Tool](/doc/refman/8.0/en/lock-order-tool.html). It + is intended for debugging the server, not for production use. + +### Deprecation and Removal Notes + +* **X DevAPI:** + For `Collection` objects, the following methods + have been deprecated and are scheduled to be removed in a future + release: + + + `Collection.find().where()` + + `Collection.modify().where()` + + `Collection.remove().where()` + + Any `Collection` code relying on the + `.where()` method should be updated and the + expression in the `.where()` method should be + provided directly in the appropriate `.find()`, + `.remove()`, and `.modify()` + method. + (WL #12902) +* A `mysql_upgrade_info` file created by the + **mysql\_upgrade** program during a previous + upgrade could only be modified the operating system user that + executed the **mysql\_upgrade** program, causing + an upgrade error. A warning is now issued instead of an error, + which permits the upgrade operation to proceed. The + `mysql_upgrade_info` file is deprecated and + will be removed in a future MySQL version. + (Bug #29702060, Bug #95165) +* `FLOAT(M,D)` + and + `DOUBLE(M,D)` + syntax to specify the number of digits for columns of type + [`FLOAT`](/doc/refman/8.0/en/floating-point-types.html) and + [`DOUBLE`](/doc/refman/8.0/en/floating-point-types.html) (and any synonyms) is a + nonstandard MySQL extension. This syntax is deprecated and + support for it will be removed in a future MySQL version. + (Bug #25328973, Bug #84363, WL #12575) +* For string data types, the `BINARY` attribute + is a nonstandard MySQL extension that is shorthand for + specifying the binary (`_bin`) collation of the + column character set (or of the table default character set if + no column character set is specified). In MySQL 8.0, this + nonstandard use of `BINARY` is ambiguous + because the `utf8mb4` character set has + multiple `_bin` collations, so the + `BINARY` attribute is deprecated and support + for it will be removed in a future MySQL version. Applications + should be adjusted to use an explicit `_bin` + collation instead. + + The use of `BINARY` to specify a data type or + character set remains unchanged. + (WL #13068) +* The nonstandard C-style + [`&&`](/doc/refman/8.0/en/logical-operators.html#operator_and), + [`||`](/doc/refman/8.0/en/logical-operators.html#operator_or), and + [`!`](/doc/refman/8.0/en/logical-operators.html#operator_not) operators that + are synonyms for the standard SQL + [`AND`](/doc/refman/8.0/en/logical-operators.html#operator_and), + [`OR`](/doc/refman/8.0/en/logical-operators.html#operator_or), and + [`NOT`](/doc/refman/8.0/en/logical-operators.html#operator_not) operators, respectively, are + deprecated and support for them will be removed in a future + MySQL version. Applications that use the nonstandard operators + should be adjusted to use the standard operators. + + Note + + Use of [`||`](/doc/refman/8.0/en/logical-operators.html#operator_or) is + deprecated unless the + [`PIPES_AS_CONCAT`](/doc/refman/8.0/en/sql-mode.html#sqlmode_pipes_as_concat) SQL mode is + enabled. In that case, `||` signifies the + SQL-standard string concatenation operator). + + (WL #13070) +* The `ZEROFILL` attribute is deprecated for + numeric data types, as is the display width attribute for + integer data types. Support for `ZEROFILL` and + display widths for integer data types will be removed in a + future MySQL version. Consider using an alternative means of + producing the effect of these attributes. For example, + applications could use the [`LPAD()`](/doc/refman/8.0/en/string-functions.html#function_lpad) + function to zero-pad numbers up to the desired width, or they + could store the formatted numbers in + [`CHAR`](/doc/refman/8.0/en/char.html) columns. + (WL #13127) +* The `UNSIGNED` attribute is deprecated for + columns of type [`FLOAT`](/doc/refman/8.0/en/floating-point-types.html), + [`DOUBLE`](/doc/refman/8.0/en/floating-point-types.html), and + [`DECIMAL`](/doc/refman/8.0/en/fixed-point-types.html) (and any synonyms) and + support for it will be removed in a future MySQL version. + Consider using a simple `CHECK` constraint + instead for such columns. + (WL #12391) +* `AUTO_INCREMENT` support is deprecated for + columns of type [`FLOAT`](/doc/refman/8.0/en/floating-point-types.html) and + [`DOUBLE`](/doc/refman/8.0/en/floating-point-types.html) (and any synonyms) and + will be removed in a future MySQL version. Consider removing the + `AUTO_INCREMENT` attribute from such columns, + or convert them to an integer type. + (WL #12595) +* The `SQL_CALC_FOUND_ROWS` query modifier and + accompanying [`FOUND_ROWS()`](/doc/refman/8.0/en/information-functions.html#function_found-rows) + function are now deprecated and will be removed in a future + MySQL version. As a replacement, considering executing your + query with `LIMIT`, and then a second query + with [`COUNT(*)`](/doc/refman/8.0/en/aggregate-functions.html#function_count) and without + `LIMIT` to determine whether there are + additional rows. For example, instead of these queries: + + ```None + SELECT SQL_CALC_FOUND_ROWS * FROM tbl_name WHERE id > 100 LIMIT 10; + SELECT FOUND_ROWS(); + ``` + + Use these queries instead: + + ```None + SELECT * FROM tbl_name WHERE id > 100 LIMIT 10; + SELECT COUNT(*) WHERE id > 100; + ``` + + [`COUNT(*)`](/doc/refman/8.0/en/aggregate-functions.html#function_count) is subject to certain + optimizations. `SQL_CALC_FOUND_ROWS` causes + some optimizations to be disabled. + (WL #12615) + +### Installation Notes + +* An automatic upgrade at server startup can take some time to + complete. For better status notification in systemd + environments, the server now sends messages to the system + notification socket when upgrades start and end. (Status can be + monitored with **server mysqld status**.) + (Bug #29493201) + +### Keyring Notes + +* The `keyring_aws` plugin has been updated to + use the latest AWS Encryption SDK and so that it works with + OpenSSL 1.1. + + The [`keyring_aws_region`](/doc/refman/8.0/en/keyring-system-variables.html#sysvar_keyring_aws_region) variable + supports the additional AWS regions supported by the new SDK. + Refer to the variable description for a list of supported AWS + regions. + (WL #12886) + +### Packaging Notes + +* To reduce the download size and disk footprint of + `mysql-community-server` Linux packages, debug + binaries and plugins have been moved to separate packages for + these platforms: + + + EL8, Fedora: The `mysql-community-server` + package with debug binaries and associated plugins is now + split into a `mysql-community-server` + package without debug binaries or plugins and a + `mysql-community-server-debug` package with + debug binaries and plugins. + + Debian: The `mysql-community-server` + package with debug binaries and associated plugins is now + split into a `mysql-community-server` + package without debug binaries or plugins, a + `mysql-community-server-debug` package with + debug binaries, and a + `mysql-community-test-debug` package with + debug plugins. + + In all cases, the debug packages are dependent on the + corresponding `mysql-community-server` package. + (Bug #29769061, Bug #28647754, Bug #92415, Bug #29702765, Bug #95169, Bug #29681301) + +### Performance Schema Notes + +* Performance Schema version checking at compile time was improved + to prevent incompatibilities with the server version. + (Bug #29550156) +* Previously, the Performance Schema instrumentation for RWLOCK + named priority read/write locks as `rwlock` + (thus failing to distinguish plain from priority locks) and did + not collect information about the kind of unlock operation + performed. Priority read/write locks now are named + `prlock`, so that events for them begin with + `wait/synch/prlock`. Also, information about + unlock operations is provided. + (Bug #29270712) + +### Plugin Notes + +* Not all plugins can operate properly if loaded + “early” in the server startup sequence using the + [`--early-plugin-load`](/doc/refman/8.0/en/server-options.html#option_mysqld_early-plugin-load) option (that + is, before `InnoDB` is initialized). However, + `InnoDB` requires keyring backend plugins to + operate on encrypted tables. To enable plugins to indicate to + the server whether they can be loaded early, a new + `PLUGIN_OPT_ALLOW_EARLY` flag is available for + use in the plugin descriptor. See + [Server Plugin Library and Plugin Descriptors](/doc/extending-mysql/8.0/en/server-plugin-descriptors.html). Keyring plugins + included in MySQL distributions now have the + `PLUGIN_OPT_ALLOW_EARLY` flag enabled because + `InnoDB` requires them, but the flag is not + limited to keyring plugins. It can be set for other plugins that + are able to initialize successfully early in the server startup + sequence. + + This flag has no effect on whether a plugin can be loaded at + server startup with the + [`--plugin-load`](/doc/refman/8.0/en/server-options.html#option_mysqld_plugin-load) or + [`--plugin-load-add`](/doc/refman/8.0/en/server-options.html#option_mysqld_plugin-load-add) option, or at + runtime with the [`INSTALL PLUGIN`](/doc/refman/8.0/en/install-plugin.html) + statement. + + All plugins compiled using MySQL distributions prior to 8.0.17 + do not have this flag set. When loading these into pre-8.0.17 + servers this does not matter, but attempts to use + [`--early-plugin-load`](/doc/refman/8.0/en/server-options.html#option_mysqld_early-plugin-load) to load + plugin binaries compiled using pre-8.0.17 MySQL distributions + into a 8.0.17 or higher server will fail. The plugins must be + recompiled against MySQL 8.0.17 or higher. + (Bug #29040456, Bug #93550, WL #12935) + +### Security Notes + +* For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 1.0.2s. Issues fixed in the new OpenSSL version are described at + and + . + (Bug #29881152) + +### X Plugin Notes + +* The `createIndex()` method did not support the + `DOUBLE(M,D)` syntax for specifying + double-precision values due to a regression in MySQL 8.0.16. + (Bug #29748841) +* X Protocol's handling of messages with arguments encoded as + octets was corrected to support non-scalar data such as an array + of strings. + (Bug #29721046) +* When host name identity verification was active for SSL + connections (`--ssl-mode=VERIFY_IDENTITY`), X + Protocol did not check for matches to Subject Alternative Names + (SANs) in the server Certificate Authority (CA) certificate. + This could lead to connection requests being rejected + unnecessarily because they used a valid host name that was + specified as an SAN rather than as the certificate's Common Name + value. + (Bug #29691694) +* When prepared statements were used with X Plugin, using + `IN` or `NOT IN` in a modify + or find operation produced invalid JSON, resulting in an error. + (Bug #29259501) +* On Windows, X Plugin logged some messages that were unnecessary + or insufficiently informative. The messages have been removed or + improved as appropriate. + (Bug #27839153) +* X Plugin's list of SQL functions was out of date, and has been + updated to add new functions and remove functions that are no + longer available. + (Bug #26574971) + +### Functionality Added or Changed + +* **InnoDB; JSON:** + [`InnoDB`](/doc/refman/8.0/en/innodb-storage-engine.html) now supports multi-valued + indexes on [`JSON`](/doc/refman/8.0/en/json.html) arrays. A + multi-valued index is an index in which multiple index records + can point to the same data record. This can be useful for + indexing [`JSON`](/doc/refman/8.0/en/json.html) documents such as + `{"user":"Bob","zipcode":[94477,94536]}` in + which, if we wish to search all zip codes, it is necessary to + have two index records for each zip code in the document. We can + create such an index on the `zipcode` array + using a [`CREATE INDEX`](/doc/refman/8.0/en/create-index.html) statement + such as this one: + + ```None + CREATE INDEX zips ON t1( (CAST(data->'$.zipcode' AS UNSIGNED ARRAY)) ) + ``` + + Effectively, this is a functional index using the + [`CAST()`](/doc/refman/8.0/en/cast-functions.html#function_cast) function, which has been + extended with the `ARRAY` keyword to enable + casting of JSON arrays to SQL data type arrays. The expression + must be a valid JSON expression, and must point to an array in + the JSON document in order to be effective. All type specifiers + supported by `CAST()` can be used except for + `BINARY` and `JSON`. Such + usage of the `CAST()` function is supported + only by `InnoDB`, and only for creating + multi-valued indexes on `JSON` arrays. + + As part of this work, MySQL adds a new function + [`JSON_OVERLAPS()`](/doc/refman/8.0/en/json-search-functions.html#function_json-overlaps) as well as a new + [`MEMBER OF()`](/doc/refman/8.0/en/json-search-functions.html#operator_member-of) operator for working + with [`JSON`](/doc/refman/8.0/en/json.html) documents, as described + here: + + + `JSON_OVERLAPS()` compares two + [`JSON`](/doc/refman/8.0/en/json.html) documents. If they + contain any key-value pairs or array elements in common, the + function returns TRUE (1); otherwise it returns FALSE (0). + If both values are scalars, the function performs a simple + test for equality. If one argument is a JSON array and the + other is a scalar, the scalar is treated as an array + element. Thus, `JSON_OVERLAPS()` acts as a + complement to + [`JSON_CONTAINS()`](/doc/refman/8.0/en/json-search-functions.html#function_json-contains), which + indicates whether all key-value pairs or array elements are + present in both [`JSON`](/doc/refman/8.0/en/json.html) + documents. + + `MEMBER OF()` tests whether the first + operand (a scalar or JSON document) is a member of the JSON + array passed as the second operand, returning TRUE (1) if it + is, and FALSE (0) if it is not. No type conversion of the + operand is performed. + + The MySQL optimizer uses multi-valued indexes automatically for + any suitable query—that is, a query using in its + `WHERE` clause any of + `JSON_CONTAINS()`, + `JSON_OVERLAPS()`, or `MEMBER + OF()` on an array within a JSON column. You can see + whether such an index is actually used by checking the output of + [`EXPLAIN`](/doc/refman/8.0/en/explain.html) for the given query. + + [Multi-Valued Indexes](/doc/refman/8.0/en/create-index.html#create-index-multi-valued), provides more + detailed information about multi-valued indexes, including + examples. For more information about + `JSON_OVERLAPS()` and `MEMBER + OF()`, with examples of use, see + [Functions That Search JSON Values](/doc/refman/8.0/en/json-search-functions.html). + + Note + + `ARRAY` and `MEMBER` now are + reserved words and cannot be used as identifiers without + identifier quoting. + + (WL #8955, WL #8763) +* **Group Replication:** + It is now possible to use a remote cloning operation for state + transfer to a joining member during distributed recovery. The + remote cloning operation lets you add new members to the group + without transferring the group's data to the server manually + beforehand. To use this functionality, you must install the + Clone plugin on the donor and joining member, grant the + [`BACKUP_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_backup-admin) permission to the + replication user for distributed recovery, and set the new + [`group_replication_clone_threshold`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_clone_threshold) + system variable to an appropriate level. Required Clone plugin + settings are now made and the remote cloning operation is now + handled automatically. When cloning is complete and the joining + member has restarted, any transactions that the group applied + while the remote cloning operation was in progress are + transferred to the joining member by replication from a donor's + binary log to complete distributed recovery. + (WL #12827) +* **Microsoft Windows:** + A new warning message now reminds DBAs that connections made + using the MySQL named pipe on Windows has limited the + permissions a connector can request on the named pipe. + + Previously, the + [`named_pipe_full_access_group`](/doc/refman/8.0/en/server-system-variables.html#sysvar_named_pipe_full_access_group) + system variable was set to a value that maps to the built-in + Windows `Everyone` group (SID S-1-1-0) by + default. However, this group is not ideal and should be replaced + with a group that restricts its membership for connectors that + are unable to request fewer permissions on the MySQL named pipe. + + The new warning is written to the error log at startup if the + string value assigned to + [`named_pipe_full_access_group`](/doc/refman/8.0/en/server-system-variables.html#sysvar_named_pipe_full_access_group) is + `'*everyone*'` (or the Windows System Language + equivalent) and named pipes are enabled. In addition, the + warning is written to the error log and raised to the client if + the system variable is reset to the `Everyone` + group at runtime. + (WL #12670) +* **JSON:** + MySQL now supports JSON schema validation using two functions + [`JSON_SCHEMA_VALID()`](/doc/refman/8.0/en/json-validation-functions.html#function_json-schema-valid) and + [`JSON_SCHEMA_VALIDATION_REPORT()`](/doc/refman/8.0/en/json-validation-functions.html#function_json-schema-validation-report), + both of which validate a JSON document against a JSON schema + conforming to Draft 4 of the JSON Schema specification. + `JSON_SCHEMA_VALID()` returns true if the + document validates against the schema and false if it does not. + `JSON_SCHEMA_VALIDATION_REPORT()` returns a + JSON document containing detailed information about the results + of the validation. + + For both of these functions, the following statements apply: + + + `required` attributes are supported. + + Regular expressions are supported (invalid expressions are + silently ignored). + + External resources in schemas and the + `$ref` keyword are not supported. + + For more information, including examples, see + [JSON Schema Validation Functions](/doc/refman/8.0/en/json-validation-functions.html). + (WL #11999, WL #13005) +* The [`time_zone`](/doc/refman/8.0/en/server-system-variables.html#sysvar_time_zone) session variable + is now hintable using the + [`SET_VAR`](/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-set-var) optimizer hint. + (Bug #29776464) +* The minor version of the `libmysqlclient.so` + C client library has been increased to 1 (21.0 to 21.1), to + signal that new symbols have been added. This was done to + correct an oversight in the MySQL 8.0.16 release. To address + compatibility concerns, the version of all symbols is unchanged. + This means the filename of the library is + `libmysqlclient.so.21.1.17`, whereas all + symbols inside the library are tagged as 21\_0 (unchanged from + the 8.0.16 release). + (Bug #29584073, Bug #29642146) +* Thanks to Josh Braden, Daniël van Eeden, Simon Mudd, and Zhou + Mengkang, who contributed corrections to comments and messages + in the MySQL source code. + (Bug #29403708, Bug #94464, Bug #29428435, Bug #94527, Bug #29262200, Bug #94049, Bug #29468128, Bug #94625) +* The **mysql** client program now sends + `os_user` and `os_sudouser` + connection attributes, when available, to indicate the name of + the operating system user running the program and the value of + the `SUDO_USER` environment variable, + respectively. For general information about connection + attributes, see + [Performance Schema Connection Attribute Tables](/doc/refman/8.0/en/performance-schema-connection-attribute-tables.html). + Thanks to Daniël van Eeden for the contribution on which this + feature was based. + (Bug #29210935, Bug #93916, WL #12955) +* The optimizer now transforms a `WHERE` + condition having `NOT IN + (subquery)`, `NOT + EXISTS (subquery)`, + `IN (subquery) IS NOT + TRUE`, or `EXISTS + (subquery) IS NOT TRUE` + internally into an antijoin, thus removing the subquery. This is + similar to the existing `IS NULL` (`Not + exists`) outer join optimization; see + [EXPLAIN Extra Information](/doc/refman/8.0/en/explain-output.html#explain-extra-information), for further + information. + + In addition, the semijoin materialization can now be used for a + `WHERE` condition having `IN + (subquery) IS TRUE`, or + `EXISTS (subquery) IS + TRUE`, or when the `IN` condition + belongs to a left join such as `SELECT * FROM t1 LEFT + JOIN t2 ON t2.x IN (SELECT * FROM t3)`. See + [Optimizing IN and EXISTS Subquery Predicates with Semijoin Transformations](/doc/refman/8.0/en/semijoins.html). + + Also as a result of this work, MySQL is now able to simplify a + condition of the form `(x IS TRUE) IS FALSE` as + `x IS NOT TRUE`, which can be tested more + quickly and optimized more easily than the condition as + originally written. + (Bug #29027883, WL #4245) +* Password hash values displayed in the `IDENTIFIED + WITH` clause of output from [`SHOW + CREATE USER`](/doc/refman/8.0/en/show-create-user.html) may contain unprintable characters that + have adverse effects on terminal displays and in other + environments. Enabling the new + [`print_identified_with_as_hex`](/doc/refman/8.0/en/server-system-variables.html#sysvar_print_identified_with_as_hex) + system variable causes [`SHOW CREATE + USER`](/doc/refman/8.0/en/show-create-user.html) to display such hash values as hexadecimal + strings rather than as regular string literals. Hash values that + do not contain unprintable characters still display as regular + string literals, even with this variable enabled. For + compatibility with this change, [`CREATE + USER`](/doc/refman/8.0/en/create-user.html) and [`ALTER USER`](/doc/refman/8.0/en/alter-user.html) now + accept hash values specified either as regular string literals + or as hexadecimal strings. + (Bug #28053446, Bug #90947, WL #12803) +* In MySQL 8.0, the + [`lower_case_table_names`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names) variable + can only be configured when the MySQL server is initialized. + Because a MySQL server installation on Debian and Ubuntu + performed using APT initializes the MySQL server for you, there + was no opportunity to enable + [`lower_case_table_names`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names). To work + around this issue, you can now use the + `debconf-set-selection` utility to enable + [`lower_case_table_names`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names) (set + [`lower_case_table_names=1`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names)) prior + to installing MySQL using APT. + + To enable + [`lower_case_table_names`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names) prior to + installing MySQL using APT, execute the following command: + + ```None + shell> sudo debconf-set-selections <<< "mysql-server mysql-server/lowercase-table-names select Enabled + ``` + + (Bug #27948395, Bug #90695) +* The server now checks the SSL server certificate better at + startup and writes a warning to the error log if it finds a + problem. + (Bug #25945005) +* The umask for files created using + [`SELECT ... INTO + OUTFILE`](/doc/refman/8.0/en/select-into.html) or + [`SELECT ... INTO + DUMPFILE`](/doc/refman/8.0/en/select-into.html) was changed from 0666 to 0640. The + [`LOAD_FILE()`](/doc/refman/8.0/en/string-functions.html#function_load-file) function no longer + requires files to be world-readable, just readable by the + server. + (Bug #24513720) +* The **mysqldump** option + `--set-gtid-purged` controls whether or not a + `SET @@GLOBAL.gtid_purged` statement is added + to the **mysqldump** output. The statement + updates the value of + [`gtid_purged`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_purged) on a server where + the dump file is reloaded, to add the GTID set from the source + server's [`gtid_executed`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_executed) system + variable. A new choice + `--set-gtid-purged=COMMENTED` is now available. + When this value is set, if GTIDs are enabled on the server you + are backing up, `SET @@GLOBAL.gtid_purged` is + added to the output (unless + [`gtid_executed`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_executed) is empty), but it + is commented out. This means that the value of + [`gtid_executed`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_executed) is available in + the output, but no action is taken automatically when the dump + file is reloaded. With `COMMENTED`, you can + control the use of the + [`gtid_executed`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_executed) set manually or + through automation. For example, you might prefer to do this if + you are migrating data to another server that already has + different active databases. Thanks to Facebook for this + contribution. + (Bug #94332, Bug #29357665, WL #12959) +* MySQL now supports explicit casts to + [`DOUBLE`](/doc/refman/8.0/en/floating-point-types.html), + [`FLOAT`](/doc/refman/8.0/en/floating-point-types.html), and + [`REAL`](/doc/refman/8.0/en/floating-point-types.html) using either of the + functions [`CAST()`](/doc/refman/8.0/en/cast-functions.html#function_cast) or + [`CONVERT()`](/doc/refman/8.0/en/cast-functions.html#function_convert). For more information, + see [Cast Functions and Operators](/doc/refman/8.0/en/cast-functions.html). + (Bug #30524, Bug #11747058, WL #529) +* `InnoDB` now supports redo log archiving. + Backup utilities that copy redo log records may sometimes fail + to keep pace with redo log generation while a backup operation + is in progress, resulting in lost redo log records due to those + records being overwritten. The redo log archiving feature + addresses this issue by sequentially writing redo log records to + an archive file. Backup utilities can copy redo log records from + the archive file as necessary, thereby avoiding the potential + loss of data. + + For more information, see + [Redo Log Archiving](/doc/refman/8.0/en/innodb-redo-log.html#innodb-redo-log-archiving). + (WL #12009, WL #12329, WL #12348) +* To provide additional indexing options for + `JSON` data, `InnoDB` now + supports multi-valued indexes. A multi-valued index is a + secondary index defined on a column that contains an array of + values. + (WL #8763) +* MySQL now provides a clone plugin that permits cloning + `InnoDB` data locally or from a remote MySQL + server instance. A local cloning operation stores cloned data on + the same server or node where the MySQL instance runs. A remote + cloning operation transfers cloned data over the network from a + donor MySQL server instance to the recipient server or node + where the cloning operation was initiated. + + The clone plugin supports replication. In addition to cloning + data, a cloning operation extracts and transfers replication + coordinates from the donor and applies them on the recipient, + which enables using the clone plugin for provisioning Group + Replication members and replication slaves. Using the clone + plugin for provisioning is considerably faster and more + efficient than replicating a large number of transactions. Group + Replication members can also be configured to use the clone + plugin as an alternative method of recovery, so that members + automatically choose the most efficient way to retrieve group + data from seed members. + + For more information, see [The Clone Plugin](/doc/refman/8.0/en/clone-plugin.html), and + [Cloning for Distributed Recovery](/doc/refman/8.0/en/group-replication-cloning.html). + (WL #9209, WL #9210, WL #9211, WL #9212, WL #11636, WL #9682) +* Compatibility policies for member versions in groups now + consider member's MySQL release version. Previously, only the + minor version was considered. Using the release version means + Group Replication can better maintain replication safety for + mixed version groups during group reconfigurations and upgrade + procedures. + + The compatibility policies are applied when a member joins the + group, either for the first time or following its upgrade, when + a donor is selected for state transfer, and when a primary + member election takes place. Members running MySQL 8.0.16 or + earlier take into account only the major version in these + situations. For primary member election, so that all members + come to the same decision, members running MySQL 8.0.17 or later + adjust their policies to match members running lower releases if + any are in the group. + + In a multi-primary mode group where members running multiple + MySQL Server versions are online, for example during a rolling + online upgrade procedure, Group Replication now automatically + manages the read-write and read-only status of members running + releases. If a member leaves the group, the members running the + version that is now the lowest are automatically set to + read-write mode. When you change a mixed version group that was + running in single-primary mode to run in multi-primary mode, + using the + [`group_replication_switch_to_multi_primary_mode()`](/doc/refman/8.0/en/group-replication-functions-for-mode.html#function_group-replication-switch-to-multi-primary-mode) + function, members are set automatically to read-write or + read-only mode depending on their MySQL server versions. + + These improved compatibility policies influence the behavior of + group members during an online upgrade procedure from one patch + version to another, in the same ways as the behavior during + upgrades from one major version to another was influenced + previously. For a multi-primary mode group, the number of + members in read-write mode is reduced during the upgrade + procedure; their read-write status is now handled automaticaly + when the upgrade is otherwise complete. For a single-primary + mode group, if you want the primary to remain as the primary, it + must be upgraded last. + (WL #12826) +* Data that is held in the binary log transaction and statement + caches during a transaction is in unencrypted format in the + memory buffer that stores the cache. The data is written to a + temporary file on disk if it exceeds the space available in the + memory buffer. From MySQL 8.0.17, when binary log encryption is + active on the server + ([`binlog_encryption=ON`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_encryption)), the + temporary files used for the binary log cache are now encrypted + using AES-CTR (AES Counter mode) for stream encryption. Because + the temporary files are volatile and tied to a single process, + they are encrypted using single-tier encryption, using a + randomly generated file password and initialization vector that + exist only in memory and are never stored on disk or in the + keyring. After each transaction is committed, the binary log + cache is reset: the memory buffer is cleared, any temporary file + used to hold the binary log cache is truncated, and a new file + password and initialization vector are randomly generated for + use with the next transaction. This reset also takes place when + the server is restarted after a normal shutdown or an unexpected + halt. + (WL #12079) +* An incomplete SQL predicate has the form `WHERE + value`, in which + *`value`* is a column name or constant + expression and no comparison operator is used. MySQL now + rewrites any predicate of this type internally as `WHERE + value <> 0` during the + contextualization phase, so that the query resolver, query + optimizer, and query executor need work only with complete + predicates. The principal visible effect of this change is that, + for Boolean values, [`EXPLAIN`](/doc/refman/8.0/en/explain.html) + output now shows `true` and + `false`, rather than `1` and + `0`. + (WL #12358) +* `InnoDB` parallel read thread performance for + large data sets was improved through better utilization of read + threads, through a reduction in read thread I/O for prefetch + activity that occurs during parallel scans, and through support + for parallel scanning of partitions. + + The parallel read thread feature is controlled by the + [`innodb_parallel_read_threads`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_parallel_read_threads) + variable. The maximum setting is now 256, which is the total + number of threads for all client connections. If the thread + limit is reached, connections fall back to using a single + thread. + (WL #12978) +* **mysqlbinlog** now supports the + [`--compress`](/doc/refman/8.0/en/mysqlbinlog.html#option_mysqlbinlog_compress) (or + `-C`) option to enable compression in the + client/server protocol. + (WL #2726) + +### Bugs Fixed + +* **NDB Cluster:** + Compile times for NDB Cluster using the included + **compile\_cluster** build script + have been improved by removing options for software components + not strictly necessary for running MySQL Cluster. + (Bug #29355872) +* **NDB Cluster:** + Attempting to change an [`NDB`](/doc/refman/8.0/en/mysql-cluster.html) table's + column properties (such as `COLUMN_FORMAT`) + using + [`ALTER + TABLE ALGORITHM=INPLACE`](/doc/refman/8.0/en/alter-table.html#alter-table-performance) was rejected, which is correct + behavior, but which raised a misleading error message. + (Bug #28929906, Bug #27645777) +* **InnoDB:** + A failure occurred when attempting to kill a process that was + executing a row count. + (Bug #29939617) +* **InnoDB:** + Due to a regression introduced in MySQL 8.0.14, in-place upgrade + on a case sensitive file system from MySQL 5.7 or a MySQL 8.0 + release prior to MySQL 8.0.14 to MySQL 8.0.16 failed for + instances with partitioned tables and + [`lower_case_table_names=1`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names). The + failure was caused by a case mismatch issue related to + partitioned table file names. The fix that introduced the + regression was reverted, which permits upgrades to MySQL 8.0.17 + from MySQL 5.7 or MySQL 8.0 releases prior to MySQL 8.0.14 to + function as normal. However, the regression is still present in + the MySQL 8.0.14, 8.0.15, and 8.0.16 releases. + + In-place upgrade on a case sensitive file system from MySQL + 8.0.14, 8.0.15, or 8.0.16 to MySQL 8.0.17 fails with the + following error when starting the server after upgrading + binaries or packages to MySQL 8.0.17 if partitioned tables are + present and + [`lower_case_table_names=1`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names): + + ```None + Upgrading from server version version_number with + partitioned tables and lower_case_table_names == 1 on a case sensitive file + system may cause issues, and is therefore prohibited. To upgrade anyway, + restart the new server version with the command line option 'upgrade=FORCE'. + When upgrade is completed, please execute 'RENAME TABLE part_table_name + TO new_table_name; RENAME TABLE new_table_name + TO part_table_name;' for each of the partitioned tables. + Please see the documentation for further information. + ``` + + If you encounter this error when upgrading to MySQL 8.0.17, + perform the following workaround: + + 1. Restart the server with + [`--upgrade=FORCE`](/doc/refman/8.0/en/server-options.html#option_mysqld_upgrade) to force the + upgrade operation to proceed. + 2. Identify partitioned table file names with lowercase + partition name delimiters `(#p#` or + `#sp#`): + + ```None + SELECT FILE_NAME FROM INFORMATION_SCHEMA.FILES + WHERE FILE_NAME LIKE '%#p#%' OR FILE_NAME LIKE '%#sp#%'; + ``` + 3. For each file identified, rename the associated table using + a temporary name, then rename the table back to its original + name. + + ```None + mysql> RENAME TABLE table_name TO temporary_table_name; + mysql> RENAME TABLE temporary_table_name TO table_name; + ``` + 4. Verify that there are no partitioned table file names with + lowercase partition name delimiters (an empty result set + should be returned). + + ```None + mysql> SELECT FILE_NAME FROM INFORMATION_SCHEMA.FILES + -> WHERE FILE_NAME LIKE '%#p#%' OR FILE_NAME LIKE '%#sp#%'; + Empty set (0.00 sec) + ``` + 5. Run [`ANALYZE TABLE`](/doc/refman/8.0/en/analyze-table.html) on each + renamed table to update the optimizer statistics in the + `mysql.innodb_index_stats` and + `mysql.innodb_table_stats` tables. + + Because of the regression still present in the MySQL 8.0.14, + 8.0.15, and 8.0.16 releases, importing partitioned tables from + MySQL 8.0.14, 8.0.15, or 8.0.16 to MySQL 8.0.17 is not supported + on case sensitive file systems where + [`lower_case_table_names=1`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names). + Attempting to do so results in a “Tablespace is missing + for table” error. + (Bug #29823032, Bug #29917793, Bug #95834) + + References: This issue is a regression of: Bug #26925260. +* **InnoDB:** + `lock_sys` mutex contention caused by lock-wait + functions (`lock_wait_suspend_thread()` and + `lock_wait_table_release_slot()`) was reduced. + (Bug #29814339) +* **InnoDB:** + The `fseg_n_reserved_pages_low()` function, + which determines the number of pages reserved by a segment, did + not validate results read from the segment inode. + (Bug #29761998) +* **InnoDB:** + Creation of the transaction rollback list + (`hit_list`) was decoupled from lock + acquisition calls (`lock_rec_lock` calls) to + permit the use of different latching schemes. + (Bug #29753800) +* **InnoDB:** + Disabling Performance Schema consumers caused an + [`ALTER + TABLESPACE ... ENCRYPTION`](/doc/refman/8.0/en/alter-tablespace.html) operation to assert. + (Bug #29646974, Bug #95005) +* **InnoDB:** + Error messages were revised to remove references to + `.frm` files, which are not used in MySQL + 8.0. + (Bug #29639655) +* **InnoDB:** + It was possible for a background thread to check the encryption + status of an undo tablespace before the undo tablespace was + fully initialized and the encryption flag set. + (Bug #29600309) +* **InnoDB:** + A table name parsing function call returned false when parsing + serialized dictionary information (SDI) tables names, which are + not formatted to include a database name. The buffer that holds + the database name remained uninitialized, causing Valgrind + errors. + (Bug #29550527) +* **InnoDB:** + The space reserved in the mini-transaction (mtr) log buffer for + dynamic metadata logging was insufficient. + (Bug #29524260) +* **InnoDB:** + Inaccuracies in the Contention-Aware Transaction Scheduling + (CATS) implementation raised a signed integer overflow error in + an UBSan build of MySQL. + (Bug #29508517, Bug #91959) +* **InnoDB:** + Insufficient memory barriers in the rw-lock implementation + caused deadlocks on ARM. + + Thanks to Yibo Cai from Arm Technology for the contribution. + (Bug #29508001, Bug #94699) +* **InnoDB:** + The + [`INFORMATION_SCHEMA.INNODB_TABLESPACES`](/doc/refman/8.0/en/information-schema-innodb-tablespaces-table.html) + `ENCRYPTION` column was not updated after + enabling undo tablespace encryption. + (Bug #29492911, Bug #94665) +* **InnoDB:** + A relocated table could not be accessed due to incorrect parsing + of a schema or table name that included a forward slash + character (/), which the server incorrectly interpreted as a + directory separator. + (Bug #29492113) +* **InnoDB:** + Various fixes and revisions were applied to the + `InnoDB` memcached source code. + (Bug #29485891) +* **InnoDB:** + To enable global access, the value of + [`innodb_directories`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_directories) variable is + now stored internally as a global variable instead of a static + variable. + (Bug #29471990) +* **InnoDB:** + In debug builds, the `thd_innodb_tmpdir()` + function did not accept a NULL argument. + (Bug #29471846) +* **InnoDB:** + A subtraction operation in the file space allocation code + incorrectly stored the result as an unsigned variable, which + raised an assertion failure. + (Bug #29466680) +* **InnoDB:** + After moving or deleting default undo tablespaces and restarting + the server with a new + [`innodb_undo_directory`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_undo_directory) value, + MySQL recreated the undo tablespaces in the new location but + failed to update the undo directory path in the data dictionary. + (Bug #29461900) +* **InnoDB:** + A previously freed LOB page was accessed while rolling back a + transaction during recovery. + (Bug #29440408) +* **InnoDB:** + A request was issued during recovery to read pages into the + buffer pool when there were no pages to be read. A check was + added to avoid the unnecessary read request. + (Bug #29440208) +* **InnoDB:** + A regression introduced in MySQL 8.0.14 caused a “Invalid + (old?) table or database name” error when creating a + partitioned table on a MySQL instance with + [`lower_case_table_names=1`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names). The + change that caused the regression has been reverted. + (Bug #29426720, Bug #94519) + + References: This issue is a regression of: Bug #26925260. +* **InnoDB:** + A `FULLTEXT` index table created in MySQL 5.6 + in a database with a hyphen in its name caused a startup failure + after upgrading from MySQL 5.7 to MySQL 8.0. Tablespace file + paths for `FULLTEXT` auxiliary tables were not + found in the data dictionary, and the hyphen in the database + name was not handled correctly in subsequently generated file + paths. + (Bug #29411899, Bug #94431) +* **InnoDB:** + There was potential for data loss to occur if the redo log was + not logically empty and comprised a single block, and the server + exited during recovery after an insert buffer merge generated + new redo records but before the new records could be flushed to + disk. + (Bug #29411832, Bug #94448) +* **InnoDB:** + `InnoDB` returned an unknown generic error when + attempting to create a tablespace for which the path and file + name exceeded the `MAX_PATH` limit on Windows. + `InnoDB` now returns a more meaningful error. + (Bug #29341634) +* **InnoDB:** + An undo tablespace file was not found after being moved to a + different directory. + (Bug #29328158) +* **InnoDB:** + The server failed to start with an + [`innodb_buffer_pool_size=default`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_buffer_pool_size) + setting. The default value was not checked for compatibility + with dependent system variable settings. + (Bug #29267814, Bug #94065) +* **InnoDB:** + The [`CREATE + TABLESPACE ... ADD DATAFILE`](/doc/refman/8.0/en/create-tablespace.html) clause no longer permits + circular directory references. For example, the circular + directory reference (`/../`) in the following + statement is not permitted: + + ```None + CREATE TABLESPACE ts1 ADD DATAFILE ts1.ibd 'any_directory/../ts1.ibd'; + ``` + + An exception to this restriction exists on Linux, where a + circular directory reference is permitted if the preceding + directory is a symbolic link. For example, the data file path in + the example above is permitted if + *`any_directory`* is a symbolic link. (It + is still permitted for data file paths to begin with + '`../`'.) + + To avoid upgrade issues, remove any circular directory + references from tablespace data file paths before upgrading to + MySQL 8.0.17 or higher. To inspect tablespace paths, query the + [`INFORMATION_SCHEMA.INNODB_DATAFILES`](/doc/refman/8.0/en/information-schema-innodb-datafiles-table.html) + table. + (Bug #29157265) +* **InnoDB:** + Manually changing the system time while the MySQL server was + running caused page cleaner thread delays. + (Bug #29138644, Bug #93708) +* **InnoDB:** + [`UPDATE`](/doc/refman/8.0/en/update.html) statements did not always + disable semi-consistent reads properly when encountering errors, + which could lead to assertion errors in debug mode. + (Bug #29047894) +* **InnoDB:** + When purging a deleted row, the logic that governs lock + inheritance did not correctly determine the type of lock that + should be inherited to satisfy constraint checks by active + transactions. + (Bug #29004362) +* **InnoDB:** + An unnecessary read lock was taken on implicitly opened data + dictionary tables when executing a prepared statement in + [`LOCK TABLES`](/doc/refman/8.0/en/lock-tables.html) mode. + (Bug #28875646) +* **InnoDB:** + During log application, after an [`OPTIMIZE + TABLE`](/doc/refman/8.0/en/optimize-table.html) operation, `InnoDB` did not + populate virtual columns before checking for virtual column + index updates. + (Bug #28834208) +* **InnoDB:** + An operation that copied data from the clustered index was + performed incorrectly, causing spatial indexes to use spatial + rows with stale pointers to the clustered index. + (Bug #28758961) +* **InnoDB:** + An [`INSERT`](/doc/refman/8.0/en/insert.html) operation involving a + generated virtual `BLOB` column resulted a + secondary index being updated with an incorrect value. + (Bug #28652826) +* **InnoDB:** + Configuring + [`innodb_data_file_path`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_data_file_path) and + [`innodb_temp_data_file_path`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_temp_data_file_path) + using [`SET + PERSIST_ONLY = default`](/doc/refman/8.0/en/set-variable.html) incorrectly set the variable + values to NULL. + (Bug #28590014) +* **InnoDB:** + A [`CREATE TABLE ... + REPLACE SELECT`](/doc/refman/8.0/en/create-table.html) operation raised a + `lock_rec_get_rec_not_gap(lock)` assertion + failure. The operation set a flag on the transaction object + indicating that a [`REPLACE`](/doc/refman/8.0/en/replace.html) + operation was requested, but did not clear the flag before + updating dependent views, causing a subsequent + [`INSERT`](/doc/refman/8.0/en/insert.html) operation to be + interpreted as a [`REPLACE`](/doc/refman/8.0/en/replace.html) + operation, leading to the wrong row locks being taken. + (Bug #28523025, Bug #92068) +* **InnoDB:** + With [`super_read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only) enabled, + an attempted [`RENAME TABLE`](/doc/refman/8.0/en/rename-table.html) + operation on a temporary table raised an assertion instead of + returning an error. + (Bug #28490368, Bug #91975) +* **InnoDB:** + Valgrind errors were reported due to uninitialized bytes read + during a virtual index prefix search. + (Bug #28184025) +* **InnoDB:** + `InnoDB` initialization failed when attempting + to create an system tablespace greater than 2GB in size. + (Bug #27538464) +* **InnoDB:** + A full-text cache lock taken when data is synchronized was not + released if the full-text cache size exceeded the full-text + cache size limit. + (Bug #25289359) +* **InnoDB:** + The [`INNODB_METRICS`](/doc/refman/8.0/en/information-schema-innodb-metrics-table.html) + `metadata_table_reference_count` counter + reported a negative value. + (Bug #20584149, Bug #75966) +* **InnoDB:** + Client sessions using different + [`auto_increment_increment`](/doc/refman/8.0/en/replication-options-source.html#sysvar_auto_increment_increment) values + while performing concurrent insert operations could cause a + duplicate key error. + (Bug #15851528, Bug #67526) + + References: Reverted patches: Bug #14049391, Bug #65225. +* **Partitioning:** + For partitioned tables, an [`ALTER + TABLE`](/doc/refman/8.0/en/alter-table.html) statement could cause incorrect query results + under these conditions: + + + The statement swapped columns by renaming them, either + directly with `RENAME COLUMN` or by + replacement with `DROP COLUMN`/`ADD + COLUMN`. + + A swapped column was used in a partitioning expression. + + The alteration was performed as an in-place operation that + did not redistribute rows between partitions. + + Such column renames are now prohibited unless the same + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) statement satisfies + one of these conditions: + + + The statement makes the table nonpartitioned. + + The statement redefines the table partitioning or + partitioning expression (which causes a table rebuild that + redistributes rows). This enables supporting existing + scenarios in which partitioning expressions are updated to + follow column renaming. + + Partitioning is specified using `PARTITION BY + KEY()` with an empty column list. This partitions + using the primary key, which tracks column renaming. + + (Bug #29541665, Bug #94792) +* **Partitioning:** + [`ALTER + TABLE ... EXCHANGE PARTITION`](/doc/refman/8.0/en/alter-table-partition-operations.html) failed with the error + Non matching attribute 'ROW\_FORMAT' between partition + and table when the partitioned table had partitions + using different row formats, even when the partition to be + exchanged used the same row format as the non-partitioned table. + (Bug #28687608) +* **Replication:** + When events generated by one MySQL server instance were written + to the binary log of another instance, the second server + implicitly assumed that the first server supported the same + number of binary log event types as itself. Where this was not + the case, the event header was handled incorrectly. The issue + has now been fixed. Thanks to Facebook for the contribution. + (Bug #29417234, Bug #94500) +* **Replication:** + If a [`LOCK INSTANCE FOR BACKUP`](/doc/refman/8.0/en/lock-instance-for-backup.html) + statement was used to acquire an instance-level backup lock, + then a [`STOP SLAVE`](/doc/refman/8.0/en/stop-slave.html) statement was + issued, a deadlock could be created with the SQL thread waiting + on the backup lock and the [`STOP + SLAVE`](/doc/refman/8.0/en/stop-slave.html) statement waiting on the SQL thread to complete + its current action. To prevent this situation, the + [`STOP SLAVE`](/doc/refman/8.0/en/stop-slave.html) process now tries to + acquire the backup lock before proceeding, and returns an error + if the lock cannot be acquired. + (Bug #29386503, Bug #93649) +* **Replication:** + From MySQL 8.0.13, if any replication channel has open temporary + tables, the binary logging format cannot be changed using + `SET @@global.binlog_format` or `SET + @@persist.binlog_format`. Previously, if this operation + was attempted after the new restriction was implemented, the + wrong error message was returned to the client (referencing a + running replication channel applier as the issue, rather than an + open temporary table). The appropriate error message is now + returned. + (Bug #29370024, Bug #94340) +* **Replication:** + Binary log checksums were handled incorrectly when + de-serializing a format description event. + (Bug #29355110) +* **Replication:** + With row-based replication in use, when the replication applier + thread unpacked a row change event, index values for any + functional indexes were calculated for both the + “before” image and the “after” image. + In the case of the “before” image, the values were + not necessary. This calculation has therefore been removed for + the before image in order to optimize row unpacking. + (Bug #29304076) +* **Replication:** + When a `MEMORY` table is implicitly deleted on + a master following a server restart, the master writes a + [`DELETE`](/doc/refman/8.0/en/delete.html) statement to the binary + log so that slaves also empty the table. This generated event + now includes a comment in the binary log so that the reason for + the [`DELETE`](/doc/refman/8.0/en/delete.html) statement is easy to + identify. Thanks to Daniël van Eeden for the contribution. + (Bug #29157796, Bug #93771) +* **Replication:** + If an invalid starting offset was provided in a + [`SHOW BINLOG + EVENTS FROM`](/doc/refman/8.0/en/show-binlog-events.html) statement, the invalid offset was returned + in place of the correct starting position for the first returned + event. + (Bug #29039732, Bug #93544) +* **Replication:** + Replication could stop with a “record not found” + error when the value `INDEX_SCAN,HASH_SCAN` + (the default in MySQL 8.0) was set for the + [`slave_rows_search_algorithms`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_rows_search_algorithms) + system variable, and an update event contained two updates to + the same row in a table that did not have a unique key, meaning + that the hash scan was used. In this situation, the second + update was missed by the hash scan due to the row change. Now, + after updating a row, the hash scan operation searches for the + updated row in the hash map, and applies any further update. + + When the value `TABLE_SCAN,HASH_SCAN` is set + for the + [`slave_rows_search_algorithms`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_rows_search_algorithms) + system variable, so that the search cannot use an index, the + “record not found” error can occur in the above + situation whether or not the table has a unique key. Also, with + this setting, when a hash scan is used on a table that has a + unique key, in the case of an update event containing two row + updates that are order-dependent, the updates might be applied + out of order, causing replication to stop with a duplicate key + error. To avoid these issues, the documentation has been updated + to state that the value `TABLE_SCAN,HASH_SCAN` + should not be used. + (Bug #28846386) +* **Replication:** + When binary logging is enabled on a replication slave, the + combination of the + [`--replicate-same-server-id`](/doc/refman/8.0/en/replication-options-replica.html#option_mysqld_replicate-same-server-id) and + [`--log-slave-updates`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_log_slave_updates) options on + the slave can cause infinite loops in replication if the server + is part of a circular replication topology. (In MySQL 8.0, + binary logging is enabled by default, and slave update logging + is the default when binary logging is enabled.) However, the use + of global transaction identifiers (GTIDs) prevents this + situation by skipping the execution of transactions that have + already been applied. The restriction on this combination of + options has therefore now been removed when + [`gtid_mode=ON`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_mode) is set. With any + other GTID mode, the server still does not start with this + combination of options. As a safeguard against creating the + problem situation after the server has started, you now cannot + change the GTID mode to anything other than + `ON` on a running server that has this + combination of options set. Thanks to Facebook for the + contribution. + (Bug #28782370, Bug #92754) +* **Replication:** + In query log events in the binary log, the thread ID used for + the execution of [`DROP TABLE`](/doc/refman/8.0/en/drop-table.html) and + [`DELETE`](/doc/refman/8.0/en/delete.html) statements was identified + incorrectly or not at all. On a multi-threaded replication + slave, where temporary tables were involved (which require the + correct thread ID as they are session specific), this omission + resulted in errors when using **mysqlbinlog** to + replay the binary log for point-in-time recovery. The thread ID + is now set correctly. + (Bug #28642318, Bug #92398) +* **Replication:** + When a trigger invoked an `INSERT` or + `UPDATE` statement that set a column to its + default value, and the `DEFAULT` expression of + that column was non-deterministic, the expected warning was not + raised when the trigger fired under statement-based replication. + In addition, if the binary logging format was + `MIXED`, the non-deterministic statements were + logged in the format used for `STATEMENT` + rather than that used for `ROW`. + + The statement that causes the trigger to fire checks at + resolution time whether any of the triggered statements are + non-deterministic. At this time, the triggered statements have + been parsed, but not resolved, so the only check that can be + performed is whether the triggered statements directly reference + any non-deterministic operators. When the non-deterministic + operator is used by a `DEFAULT` expression, the + non-determinism is not visible until the triggered statement has + been resolved, which happens when the trigger fires. + + This is fixed by adding an extra check when determining the + logging format, where a statement is flagged as unsafe if any of + its substatements can write to a table that has a column with a + non-deterministic `DEFAULT` expression. Since + it is not yet known at this point whether the + `DEFAULT` expression will be used by the + substatement, this check flags the statement as unsafe even if + the substatement provides an explicit value for the column with + a non-deterministic `DEFAULT` expression. + (Bug #28297486) +* **Replication:** + When a slave server logs master status and connection + information to a table + ([`master_info_repository=TABLE`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_master_info_repository)), + which is the default in MySQL 8.0, the + `mysql.slave_master_info` table was not being + updated on shutdown if the server was in super read only mode + ([`super_read_only=ON`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only)). No error + was written to the error log at this time, but replication + failed after server startup because the master log file and + master log position information was out of date. The thread that + updates the master info log at shutdown is now excluded from + read-only checks like other replication threads are, so it can + update the table even if the server is in super read only mode. + Error handling for a slave that is shutting down has also been + improved so that any failure to write to the slave status logs + results in an error in the error log. + (Bug #27675107, Bug #89987) +* **Replication:** + If a replication slave tried to connect to the master using an + incorrect user name, host, or port, the original error message + specifying the reason for the connection failure was overwritten + with a generic message. The issue has now been corrected in the + output from the [`SHOW SLAVE STATUS`](/doc/refman/8.0/en/show-slave-status.html) + statement and in the Performance Schema table + [`replication_connection_status`](/doc/refman/8.0/en/performance-schema-replication-connection-status-table.html). + (Bug #26580064) +* **Group Replication:** + When message fragmentation is in use for large Group Replication + messages (which is available, and the default, from MySQL + 8.0.16), if a fragmented message sent by the group member with + the highest node identifier in XCom was partially delivered, and + one or more members then left the group prior to the delivery of + the remaining message fragments, reassembly of the message + caused Group Replication to stop working. The loss of members + meant that the node identifier of the original sender was no + longer valid in the new view of the group. To correct this + issue, reassembly of fragmented messages now uses the delivery + information from the last fragment that was delivered, which + reflects the new situation after the view change, rather than + from the first fragment that was delivered, which reflects the + old situation before the view change. + (Bug #29716639) +* **Group Replication:** + The error message that is issued for a discrepancy between the + number of group members and the auto-increment interval + incorrectly referred to the + [`group_replication_auto_increment_increment`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_auto_increment_increment) + system variable, instead of the + [`auto_increment_increment`](/doc/refman/8.0/en/replication-options-source.html#sysvar_auto_increment_increment) system + variable. The value of + [`auto_increment_increment`](/doc/refman/8.0/en/replication-options-source.html#sysvar_auto_increment_increment) is + changed to the value specified by + [`group_replication_auto_increment_increment`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_auto_increment_increment) + when Group Replication starts, but only if + [`auto_increment_increment`](/doc/refman/8.0/en/replication-options-source.html#sysvar_auto_increment_increment) and + [`auto_increment_offset`](/doc/refman/8.0/en/replication-options-source.html#sysvar_auto_increment_offset) have + their default values, and from MySQL 8.0, only in multi-primary + mode. The value of + [`auto_increment_increment`](/doc/refman/8.0/en/replication-options-source.html#sysvar_auto_increment_increment) was + always the value that was checked for the error message, and it + has now been corrected to give the accurate system variable + name. + (Bug #29542425) +* **Group Replication:** + Group Replication cannot be started following a MySQL Server + upgrade that uses the `MINIMAL` option + ([`--upgrade=MINIMAL`](/doc/refman/8.0/en/server-options.html#option_mysqld_upgrade)), which does + not upgrade system tables on which this feature depends. + Previously, in this situation, the server waited indefinitely + for Group Replication to start. This is now handled correctly by + unblocking the waiting thread and issuing the expected error + [`ER_GRP_RPL_START_GRP_RPL_FAILED`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_grp_rpl_start_grp_rpl_failed). + (Bug #29423358, Bug #94515) +* **Group Replication:** + A change in the processing of suspicions by a member that is + leaving the group meant that recovery failed because due to a + circular dependency between the recovery failure and the view + change notification. Now, if an error makes recovery impossible, + the Group Communication System handles this as follows: + + 1. The member leaves the group + 2. the view change is applied + 3. The recovery thread is terminated. + + (Bug #29417365, Bug #29628909) +* **Group Replication:** + In Group Replication, joining members could wrongly identify + themselves as incompatible with an existing replication group + even if there were members at the same version already in the + group, because they checked against all other members, including + the member at the highest version. Joining members also included + their own version in the compatibility check. Now, joining + members only compare themselves with the existing group member + at the lowest version, and do not count their own version. + (Bug #29390946, Bug #94429) +* **Group Replication:** + Functions for configuring an online group sometimes did not + return an error when an issue arose during execution. These + functions also now check whether the Group Replication plugin is + stopping before they start to initialize. + (Bug #28978767, Bug #93372) +* **Group Replication:** + The XCom group communication engine did not handle out of memory + errors in an appropriate way. If memory could not be allocated + to make a copy of the payload for a message, an error was logged + but the message was still sent, with a null payload. The Group + Communication System (GCS) on the receiving member discarded the + message as empty, and the XCom instance on the receiving member + accepted this action and did not retry, resulting in the message + effectively being skipped. This caused the GTID set on the + receiving member to diverge from the group, leading to + replication errors. XCom now terminates gracefully if it + experiences an out of memory error, so that this situation + cannot occur. + (Bug #28702320) +* **macOS:** + For macOS installations performed using DMG packages, + **launchd** operation was problematic: + + + Previously, `SHUTDOWN` caused a restart if + MySQL was configured to start at boot time via the + preference pane. This also affected the **mysqladmin + shutdown** command. Server shutdown initiated in + these ways now works correctly. + + Previously, `RESTART` did not work. It now + works correctly. + + Previously, unexpected server exits did not cause automatic + restart if the server was not configured to start at boot + time. Exits with a nonzero exit status now cause a restart + regardless of boot-time startup configuration. + + (Bug #29789857) +* **JSON:** + [`MAX()`](/doc/refman/8.0/en/aggregate-functions.html#function_max) and + [`MIN()`](/doc/refman/8.0/en/aggregate-functions.html#function_min) used on expressions + returning [`JSON`](/doc/refman/8.0/en/json.html) data sometimes + compared these values as strings rather than + `JSON` values, which caused unexpected results; + this was particularly evident when the `JSON` + values were numbers. + + This was due to the fact that `GROUP BY` when + using temporary tables with indexes did not compare + `JSON` values correctly. + (Bug #28947381) +* **JSON:** + [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table) returned the error + Unknown database '' when executed from a + stored function. + + The root cause of this issue was that, when merging tables from + a select that used `JSON_TABLE()`, MySQL + checked only for derived tables. This caused the result table + returned by `JSON_TABLE()` to be noted as a + regular table, so that when attempting to execute the query, the + server failed to open it. Now MySQL checks whether the table to + be added is not an internal table, that is, not a derived table, + a `JSON_TABLE()` result table, or a reference + to a recursive common table expression. + (Bug #92976, Bug #28851656) +* The `WITH ADMIN` option for + [`GRANT`](/doc/refman/8.0/en/grant.html) statements sometimes was + not handled properly. + (Bug #29900772) +* Some foreign key error messages could differ depending on + whether the user had the [`GRANT + OPTION`](/doc/refman/8.0/en/privileges-provided.html#priv_grant-option) privilege. + (Bug #29868844) +* During upgrade operations, upgrades of the help tables failed if + autocommit was disabled. + (Bug #29865428, Bug #95620) +* Fetching dynamically allocated dictionary objects into a vector + during upgrade while operating with a small + [`table_open_cache`](/doc/refman/8.0/en/server-system-variables.html#sysvar_table_open_cache) size caused + data dictionary tables to be reopened, triggering a garbage + collection mechanism that incorrectly freed collected objects. + Subsequent attempts to access the freed objects caused a + segmentation fault. + (Bug #29823053) +* For upgrades from MySQL 5.7 to 8.0, the upgrade process did not + close the `innodb_*_stats_backup57.ibd` files + in the `mysql` system schema before removing + them, resulting in errors for subsequent file system operations. + (Bug #29791350) +* **mysqld --initialize** would fail if the file + system was mounted at the data directory mount point and a + `lost+found` file or directory was present. The + `lost+found` file or directory is now ignored + during data directory initialization. + (Bug #29780434) +* MySQL upgrades did not assign the + [`AUDIT_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_audit-admin) privilege to accounts + that had the [`SUPER`](/doc/refman/8.0/en/privileges-provided.html#priv_super) privilege. + (Bug #29770732) +* The [`REGEXP_REPLACE()`](/doc/refman/8.0/en/regexp.html#function_regexp-replace) function did + not handle empty strings correctly in all cases. + (Bug #29763554) +* An overly strict assertion could be raised during sorting of + stored program local objects. + (Bug #29759547, Bug #95062) +* The + [`group_replication_get_communication_protocol()`](/doc/refman/8.0/en/group-replication-functions-for-communication-protocol.html#function_group-replication-get-communication-protocol) + function, which is used to query the group's communication + protocol version, failed if any group members were in RECOVERING + state, which was an unnecessary restriction. The function can + now be used provided that the member where it runs is in ONLINE + state, and is in contact with a majority of the group. + (Bug #29754967, Bug #95306) +* For some arguments to [`REPEAT()`](/doc/refman/8.0/en/string-functions.html#function_repeat), + maximum length calculations were not always handled correctly. + (Bug #29739778) +* [`UPDATE`](/doc/refman/8.0/en/update.html) statements for tables with + `CHECK` constraints could fail to enforce the + constraints. + (Bug #29706621, Bug #95189) +* For installation from RPM or Debian packages, if the + `mysql_upgrade_info` file in the data + directory is found to exist but is owned by + `root`, it is now changed to the same owner as + the data directory. The correct SELinux file context is also + set. + (Bug #29704041) +* Installing from RPM packages could result in an error log with + incorrect permissions. + (Bug #29702462) +* A replication group member that was unable to contact a majority + of the group before the + [`group_replication_unreachable_majority_timeout`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_unreachable_majority_timeout) + setting was reached, and then exhausted the number of + auto-rejoin attempts specified by the + [`group_replication_autorejoin_tries`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_autorejoin_tries) + system variable without successfully rejoining, was sometimes + unable to carry out the action specified by the + [`group_replication_exit_state_action`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_exit_state_action) + system variable. The member tries to carry out the action using + the current session, which sometimes failed. The member now + ensures that the session is initialized before using it to + connect to the server to carry out the exit state action. + (Bug #29698754, Bug #95151) +* When performing a upgrade, server-side SQL statements that + update data dictionary tables used a non-default collation, + causing an upgrade failure. + (Bug #29697670, Bug #95144) +* Starting the server with + [`--skip-grant-tables`](/doc/refman/8.0/en/server-options.html#option_mysqld_skip-grant-tables) and invoking + [`ROLES_GRAPHML()`](/doc/refman/8.0/en/information-functions.html#function_roles-graphml) could lead to a + server exit. + (Bug #29681975) +* [`SELECT + DISTINCT`](/doc/refman/8.0/en/select.html) when using fixed-length keys did not + deduplicate records properly in all cases. + (Bug #29628699) +* Client programs that used asynchronous C API functions could + access freed memory after occurrence of a fatal error such as + connection failure or receipt of a too-large packet. + (Bug #29596244) +* The + [`ST_AsWKB()`](/doc/refman/8.0/en/gis-format-conversion-functions.html#function_st-asbinary) + function could fail to perform proper error checking. + (Bug #29594287) +* For failed data directory initialization, the server could + produce a message indicating that the directory could be + removed, even if the server itself did not create it. The + message now indicates that only files in the directory created + by the server can be removed. + (Bug #29594082, Bug #94880) +* In MySQL 8.0, the `keyring_encypted_file` + plugin could not read a file created by a MySQL 5.7 + `keyring_encypted_file` plugin. + (Bug #29588345) +* In builds with Undefined Behavior Sanitizer enabled, runtime + errors occurred in `my_strtoll10_mb2()` and + `val_decimal()`. + (Bug #29585648, Bug #29594951) +* Some diagnostics produced by the server while checking grant + table structure at startup were written as errors rather than + warnings. + (Bug #29558993) +* The **comp\_err** utility could read uninitialized + data. + (Bug #29550442) +* Enabling audit log encryption could cause a server exit. + (Bug #29549327) +* RPM package obsoletes were updated to enable successful upgrades + from MariaDB to MySQL on EL8. + (Bug #29549127, Bug #29623146, Bug #29623201, Bug #29659212) +* In a join of the form `LEFT JOIN t ON + column WHERE t.x=0 IS NOT + TRUE`, MySQL evaluated `IS NOT TRUE` + as `FALSE` for a `NULL` + argument in a null-complemented row, and rejected it. This + caused an invalid conversion of the left join to an inner join, + so that there were missing rows in the result. The same issue + affected joins of the same form but having `IS NOT + FALSE` in the `WHERE` condition. + (Bug #29540230) +* If the [`read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_read_only) system + variable was enabled, its value improperly was applied against + updates to the character set and collation data dictionary + tables. + (Bug #29533590, Bug #94769) +* The functions [`STATEMENT_DIGEST()`](/doc/refman/8.0/en/encryption-functions.html#function_statement-digest) + and [`STATEMENT_DIGEST_TEXT()`](/doc/refman/8.0/en/encryption-functions.html#function_statement-digest-text) used + [`character_set_client`](/doc/refman/8.0/en/server-system-variables.html#sysvar_character_set_client) while + parsing the function's argument instead of the character set of + the argument. + (Bug #29526571) +* The server now tracks data dictionary upgrades to ensure that + `INFORMATION_SCHEMA` views are recreated when + data dictionary tables are changed. + (Bug #29513265) +* Execution of [`STATEMENT_DIGEST()`](/doc/refman/8.0/en/encryption-functions.html#function_statement-digest) + or [`STATEMENT_DIGEST_TEXT()`](/doc/refman/8.0/en/encryption-functions.html#function_statement-digest-text) could + have unintended side effects on data in the + [`performance_schema.events_statements_summary_by_digest`](/doc/refman/8.0/en/performance-schema-statement-summary-tables.html) + table. + (Bug #29512067) +* The implementation for [`CREATE + TABLE`](/doc/refman/8.0/en/create-table.html) did not provide the table a clearly defined + starting cursor when no seeks or writes were performed. + (Bug #29511318) +* When a table is `const` optimized, any + predicate terms in the join's `ON` condition + should also be evaluated on the tables marked as + `const` to make sure that the row qualifies for + the `ON` condition. + + The optimizer failed to mark a table as `const` + when it was handled as having an impossible + `ON` condition, in which case the resulting row + from this table is a `NULL` extended row. + + This fix sets the `const_table` flag for the + table and marks the row as a `NULL` row. It + also changes `EXPLAIN` output for a table + optimized as having an impossible ON condition, where the + resulting `NULL` values from this row are now + propagated into the rows column values, as with other + `const` rows. + (Bug #29493830) +* A query containing an `IN` subquery could + return superfluous rows when + [`optimizer_switch`](/doc/refman/8.0/en/server-system-variables.html#sysvar_optimizer_switch) did not + include [`firstmatch=on`](/doc/refman/8.0/en/switchable-optimizations.html#optflag_firstmatch). + (Bug #29493026) +* RPM package detection of whether the operating system is EL6 or + EL7 failed on some systems. + (Bug #29492896) +* SQL layer validation of keys stored in storage-engine-private + data fields in the data dictionary was disabled to permit + storage engines to add new keys as required. Storage engines are + now responsible for key validation. + (Bug #29491593, Bug #94667) +* Checks for `NULL` returned an incorrect result + for some expressions comparing rows. + (Bug #29491083) +* When optimizing a table join which included `ORDER + BY` and `LIMIT`, the optimizer + modified the select limit on the first table by taking the + fanout of the entire join into consideration. The fanout was + calculated using the `filter_effect` for each + table, which can be set to `COND_FILTER_STALE` + (-1) to indicate an unknown value. This value was not actually + checked for by the optimizer, which could result in a negative + fanout, leading to an unexpected rows value of 0 in the + [`EXPLAIN`](/doc/refman/8.0/en/explain.html) output for the query. + + Now `COND_FILTER_STALE` + (`filter_effect` unknown) is specifically + checked for, and, if it is found, the fanout is also assumed to + be unknown, and the number of rows to be selected from the first + table is thus not modified by the fanout for the entire join. + (Bug #29487181, Bug #29531472) +* An implicit assumption was made for the + [`LEAST()`](/doc/refman/8.0/en/comparison-operators.html#function_least) and + [`GREATEST()`](/doc/refman/8.0/en/comparison-operators.html#function_greatest) functions that + arguments to either of these were all signed or all unsigned + values. + (Bug #29467577) +* Some arguments for the [`BIT_OR()`](/doc/refman/8.0/en/aggregate-functions.html#function_bit-or) + function were not always handled correctly. + (Bug #29459549) +* For debug builds, mishandling of the + `user_attributes` column of the + `mysql.user` system table could cause a server + exit. + (Bug #29451897) +* MySQL Cluster-specific Debian debug packages had an incorrect + path to the debug symbols. + (Bug #29446947) +* Compilation failure occurred when building with Protobuf 3.7.0. + (Bug #29436791, Bug #94543) +* On Debian and Ubuntu, MySQL packages did not enable + `mysql.service` after upgrades from native + MySQL packages. + (Bug #29435592) +* The server did not properly close shared-memory connections when + an error occurred, which could result in unexpected server + behavior. + (Bug #29435426) +* The internal `JOIN_CACHE::join_record()` method + attempted to leave all tables on which it operated in the same + state with regard to the `has_row` and + `null_row` flags by saving the state upon entry + and restoring the appropriate flags when on completion. + + The issue addressed here arose after these flags had been + restored, due to the fact that + `restore_last_record()` was also called to + restore any records that had been processed, which could lead to + setting back a `null_row` flag that had just + been restored based on the saved state. This is fixed by calling + `restore_last_record()` before the saved states + are restored, rather than after, as well as making sure that + `reset_null_row()` is also called if the saved + state indicates that the `null_row` flag was + not set at the beginning. + (Bug #29435133) +* Some [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) statements using + `ADD COLUMN` did not perform as expected. + (Bug #29428288) + + References: This issue is a regression of: Bug #28333657. +* An incorrect error message was reported during upgrade from + MySQL 5.7 to MySQL 8.0 when a non-natively partitioned table was + encountered. The error message referenced the + `-DWITH_PARTITION_STORAGE_ENGINE` + **CMake** build option, which is not supported in + MySQL 8.0. + (Bug #29426632, Bug #94518) +* At startup, the server did not properly check the length of user + and host names in persisted variables. + (Bug #29420141) +* The parser could leak memory for certain multiple-statement + queries. + (Bug #29419820) +* Installing MySQL on EL8 from RPM packages caused a conflict with + the installed MeCab library. + (Bug #29413115) +* On FreeBSD, stack traces dumped for fatal signals did not work + correctly. + (Bug #29408039) +* With the [`derived_merge`](/doc/refman/8.0/en/switchable-optimizations.html#optflag_derived-merge) switch + disabled in the value of the `optimizer_switch` + system variable, information retrieved for base tables from + [`INFORMATION_SCHEMA.TABLES`](/doc/refman/8.0/en/information-schema-tables-table.html) displayed + inappropriate information in the + `TABLE_COMMENT` column. + (Bug #29406053, Bug #94468) +* In certain cases, use of `ORDER BY` in a + subselect did not produce the expected result. + (Bug #29402943) +* `ROLLUP` queries with wildcards (and probably + also certain other wildcard queries) could cause assertion + errors. + (Bug #29396628) +* A condition inside an `IF` function having a + constant evaluating to `TRUE` was not always + handled correctly. + (Bug #29394833) +* A code change in MySQL 8.0.13 related to full-text search caused + a segmentation fault. + (Bug #29393105) +* **mysqlpump** did not check whether the argument + to [`--result-file`](/doc/refman/8.0/en/mysqlpump.html#option_mysqlpump_result-file) was opened + correctly and exited unexpectedly if an error occurred. + (Bug #29389828) +* In queries without joins, batch mode was not enabled until after + initialization was complete, so that `OFFSET` + rows were read outside of batch mode. This negated any + performance benefit to be had from batch mode. + (Bug #29373972) +* When renaming a functional index, the server did not check for a + possible duplicate index name. + (Bug #29360763) +* The system variable service did not check the input buffer size + for some operations. + (Bug #29343505) +* For `mysql` system schema dumps, + **mysqlpump** dumped certain tables by row rather + than as account-management statements. + (Bug #29343073) +* Creation of a functional index on a `UNION` + subquery led to an assertion in debug builds. + (Bug #29342245) +* Non-numeric arguments to [`AVG()`](/doc/refman/8.0/en/aggregate-functions.html#function_avg) + were not always handled correctly. + (Bug #29321764) +* Result sets with a very large number of columns could cause + client programs to use all available memory. Now the client + library allocates no more than + [`max_allowed_packet`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_allowed_packet) bytes for + result set metadata, returning an out-of-memory error if this + limit is exceeded. If this error occurs, it is fatal and the + client should disconnect. + (Bug #29316814) +* A call to [`mysql_shutdown()`](/doc/c-api/8.0/en/mysql-shutdown.html) could + cause the client to exit when the server and client were from + different MySQL series, due to return packet payload + misinterpretation. + (Bug #29315393) +* Client programs could fail while reading result set metadata if + communicating with the server using the pre-MySQL 4.1 protocol. + (Bug #29304864) +* [`HANDLER`](/doc/refman/8.0/en/handler.html) statements did not always + work correctly with tables having generated columns. + (Bug #29300049) +* Session-tracking information in the client/server protocol could + be mishandled. + (Bug #29297652) +* Client programs that used the `libmysqlclient` + C client library could exit upon receipt of an + `OK` packet containing malformed + session-tracking information. + (Bug #29297620, Bug #29630735) +* With the + [`PAD_CHAR_TO_FULL_LENGTH`](/doc/refman/8.0/en/sql-mode.html#sqlmode_pad_char_to_full_length) SQL + mode enabled, password changes failed, with no warning or error + reported. + (Bug #29287785) +* Initialization code of loadable functions for the + `keyring_aws` plugin did not properly check + whether the plugin had been initialized. + (Bug #29278153) +* Scalar subqueries were not always identified and handled + correctly when compared with aggregate or window functions. + (Bug #29276063) +* Ubuntu packages did not disable binary logging for + initialization scripts. + (Bug #29263771) +* The internal collation map could become corrupted by use of + invalid collation names. + (Bug #29258979) +* Single-table [`UPDATE`](/doc/refman/8.0/en/update.html) and + [`DELETE`](/doc/refman/8.0/en/delete.html) statements that used + indexed expressions could cause the server to exit when executed + as prepared statements. + (Bug #29257254) +* The `audit_log` plugin did not log + [`UNINSTALL + PLUGIN audit_log`](/doc/refman/8.0/en/uninstall-plugin.html) statements. + (Bug #29248047) +* MySQL now uses `open(O_TMPFILE)` whenever + applicable when creating a temporary file that is immediately + unlinked. This is more efficient than previously and avoids the + small possibility of a race condition. Thanks to Daniel Black + for the contribution. + (Bug #29215177, Bug #93937) +* `audit_log` filtering operations could leak + memory. + (Bug #29201747) +* The [`GRANT OPTION`](/doc/refman/8.0/en/privileges-provided.html#priv_grant-option) privilege could + be mishandled in some cases. + (Bug #29179334) +* Previously, [`LIKE`](/doc/refman/8.0/en/string-comparison-functions.html#operator_like) comparisons could + be incorrect if either of the `_` or + `%` SQL wildcard characters was used as the + `ESCAPE` character. These characters can now be + used. + (Bug #29175461, Bug #93811) +* The `component_sys_variable` service could fail + to read certain system variables, causing a server exit. + (Bug #29162657) +* Multiple-table [`UPDATE`](/doc/refman/8.0/en/update.html) statements + could search for incorrect generated-column values when + determining which row to update. + (Bug #29154379) +* If the server was started with Performance Schema parameters + that caused an out-of-memory condition, startup failed. + (Bug #29140212, Bug #93726) +* For consistency and compliance with standard SQL, the + [`ISNULL()`](/doc/refman/8.0/en/comparison-operators.html#function_isnull) function is now printed + as [`IS NULL`](/doc/refman/8.0/en/comparison-operators.html#operator_is-null) in warnings generated by + [`EXPLAIN`](/doc/refman/8.0/en/explain.html) statements. + (Bug #29119455) +* Some supplemental Unicode characters could incorrectly be + flagged with a warning message as invalid. + (Bug #29110613, Bug #93626) +* For upgrades from MySQL 5.7 to 8.0, the `root` + user was not given all dynamic privileges. + (Bug #29043233) +* When using subpartitioning, table serialized dictionary + information (SDI) was not stored in any tablespace file. + (Bug #29020745, Bug #93499) +* Privileges for dropping some Performance Schema tables were + checked incorrectly. + (Bug #29010031) +* **mysqldump** failed to wrap `SET NAMES + utf8mb4` and `SET character_set_client = + utf8mb4` statements within version-specific comments, + which could cause compatibility problems. + (Bug #29007506, Bug #93450) +* For a unique index created on one or more columns defined as + `NULL`, the optimizer failed to handle joins + using that index as [`eq_ref`](/doc/refman/8.0/en/explain-output.html#jointype_eq_ref). + + As part of this fix, late `NULL` filtering is + now also performed to avoid treating comparisons with + `NULL` as potential equality matches. + (Bug #28965762, Bug #29337233) +* For debug builds, an assertion could be raised by string + comparisons for which the expected and actual collation + differed. + (Bug #28960901) +* The server did not handle correctly a subquery which, prior to + conversion to a semijoin, contained a merged derived table or + common table expression which in turn had a + `WHERE` clause with an outer reference against + an indexed column. + (Bug #28955216) +* A query that employed a derived table which included an + `ORDER BY` was not always handled correctly. + (Bug #28942965) +* When clients were terminated for inactivity exceeding the + [`wait_timeout`](/doc/refman/8.0/en/server-system-variables.html#sysvar_wait_timeout) value, the message + written to the error log was unclear. Now + [`ER_NET_WAIT_ERROR`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_net_wait_error) is written, + which is more specific about the cause of the problem. Thanks to + Mattias Jonsson for the contribution. + (Bug #28940167, Bug #93240) +* Concurrent execution of [`FLUSH + PRIVILEGES`](/doc/refman/8.0/en/flush.html#flush-privileges) along with [`CREATE + USER`](/doc/refman/8.0/en/create-user.html) or [`ALTER USER`](/doc/refman/8.0/en/alter-user.html) + could cause the server to stall. + (Bug #28937018, Bug #93085) +* [`CASE`](/doc/refman/8.0/en/case.html) statement comparisons that + relied on index prefix values could produce incorrect results. + (Bug #28934315, Bug #93215) +* When adjusting the query cost after sort elimination to + compensate for sorts that had not been considered in the + original cost estimate, and the estimates could sometimes be too + low, or even negative. + + The sort cost is added to the total cost in + `Optimize_table_order::consider_plan()`, and + subtracted from the total cost in + `JOIN::optimize()` if it is found that sorting + is not needed. + + If `consider_plan()` finds that sorting is not + needed, it does not add the sort cost to the total cost, but + still records a sort cost in + `JOIN::sort_cost()`, and this is set to the + sort cost of the candidate plan considered previously. Later, + `JOIN::optimize()` saw that the + `JOIN` object had an associated sort cost, and + subtracted that cost from the total cost, since it also sees + that no sort is needed. Since the sort cost came from a + candidate plan that was not the same as the chosen plan, the + estimate was incorrect. + + The fix is to make `consider_plan()` set + `JOIN::sort_cost` to 0 if no sort cost is added + to the total cost, so that the mistaken adjustment of the cost + in `JOIN::optimize()` is not performed. + (Bug #28884359) +* Some GIS code failed to compile under Visual Studio 2017 15.5.6. + (Bug #28861188) + + References: This issue is a regression of: Bug #28842878. +* Stored generated column values and indexes on virtual generated + columns were not correctly updated after columns on which these + generated columns depended were swapped using + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) with `RENAME + COLUMN` or `CHANGE COLUMN`. + + Renaming of base columns for generated columns, generated + defaults, and functional indexes is now prohibited unless the + same [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) statement + satisfies one of these conditions: + + + The statement removes the generated column, generated + default, or functional index. + + The statement updates the dependent expression in question. + This enables supporting existing scenarios in which + generation expressions are updated to follow base column + renaming. + + Restrictions on dropping columns on which generated columns, + generated defaults, or functional indexes depend were relaxed in + a similar way. + (Bug #28772251, Bug #92727) +* Base columns were not excluded from index-only access by a + generated column. + (Bug #28652733) + + References: See also: Bug #29664369. This issue is a regression of: Bug #23169112. +* [`SET + PERSIST_ONLY`](/doc/refman/8.0/en/set-variable.html) did not properly handle the + [`version_tokens_session`](/doc/refman/8.0/en/version-tokens-reference.html#sysvar_version_tokens_session) system + variable. + (Bug #28542569) +* For debug builds, improper error checking for + [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) statements could + cause an assertion to be raised. + (Bug #28490361, Bug #91976) +* MySQL 5.7 supported foreign keys on `InnoDB` + tables with a parent key for which part of the referenced + columns were hidden, but MySQL 8.0 did not. MySQL 8.0 now + supports this capability. + (Bug #28480149, Bug #91952) +* [`INSERT ... ON DUPLICATE + KEY UPDATE`](/doc/refman/8.0/en/insert.html) did not consider privileges granted by + active roles. + (Bug #28395115) +* For unloaded components, component options specified at startup + with a `--loose-` prefix were not processed if + the component was later loaded at runtime. + (Bug #28341329) +* Long passwords solicited interactively by client programs could + fail to be null-terminated. + (Bug #28121400) +* When building MySQL, **CMake** + begins the process of downloading `Boost` by + creating a zero-length tarball in the destination directory, + which is removed when the download is complete. If the download + was interrupted or timed out, the presence of this file + prevented **CMake** from attempting + to perform the download the time it was run. Now the zero-length + tarball, if present, is removed before the download is started. + (Bug #28089173) +* A thread pool group could be blocked when a thread process tick + time exceeded the maximum permitted value. The tick time now + uses a larger data type to permit larger values. + (Bug #28072609) +* Privileges were not checked correctly for + [`ALTER USER ... + IDENTIFIED WITH ... BY`](/doc/refman/8.0/en/alter-user.html). + (Bug #27923149, Bug #29882299) +* MySQL does not support OpenSSL session tickets, but did not set + the `SSL_OP_NO_TICKET` flag to inform OpenSSL + of that. The flag is now set. + (Bug #27655493) +* The `audit_null` plugin did not properly check + for a null event record. + (Bug #27638290) +* [`UpdateXML()`](/doc/refman/8.0/en/xml-functions.html#function_updatexml) did not always free + memory properly in certain cases. + (Bug #27312862) +* Empty values in the `name` column of the + `mysql.plugin` system table caused the server + to exit during startup. + (Bug #27302459) +* The server did not properly check privileges for + [`CACHE INDEX`](/doc/refman/8.0/en/cache-index.html) statements. + (Bug #26173827) +* With the `thread_pool` plugin enabled, the + Performance Schema [`status_by_thread`](/doc/refman/8.0/en/performance-schema-status-variable-tables.html) + table contained no data. + (Bug #25933891) +* The [`GRANT OPTION`](/doc/refman/8.0/en/privileges-provided.html#priv_grant-option) privilege was + treated as related to database operations. + (Bug #25203933, Bug #34159579) +* [`REPAIR TABLE`](/doc/refman/8.0/en/repair-table.html) for + `ARCHIVE` tables could result in a server exit. + (Bug #23304911) +* If an [`INSTALL PLUGIN`](/doc/refman/8.0/en/install-plugin.html) statement + contained invalid UTF-8 characters in the shared library name, + it caused the server to hang (or to raise an assertion in debug + builds). + (Bug #14653594, Bug #23080148, Bug #27167197) +* Logging to the `mysql.slow_log` system table + could fail when values were to large for table columns. Now + logging proceeds on a best-effort basis, writing what + information can be provided. Otherwise, the row is discarded and + a message is written to the error log. + (Bug #11748692, Bug #37132) +* A query using `WHERE + date_column LIKE + 'year_value'` failed with + error 1525 Incorrect DATE value on + Windows platforms. + (Bug #95780, Bug #29904751) + + References: This issue is a regression of: Bug #29368521. +* A fix for a previous issue caused + [`YEAR`](/doc/refman/8.0/en/year.html) values to be treated as + unsigned, but this did not allow for possible negative values + arising during calculations involving subtraction, which could + lead to data truncation errors. + (Bug #95045, Bug #29668676) + + References: This issue is a regression of: Bug #92209, Bug #28562930. +* When working with derived tables with an aggregation which had + zero input rows, the results of the aggregate functions were not + properly copied into the temporary table. This caused incorrect + results in cases where the derived table was evaluated multiple + times, such as when performing a lateral join. + (Bug #94721, Bug #29514504) +* A window without a frame specification inheriting from a window + with an `ORDER BY` yielded an incorrect result. + (Bug #94251, Bug #29328529) +* The results returned by the functions + [`REGEXP_REPLACE()`](/doc/refman/8.0/en/regexp.html#function_regexp-replace) and + [`REGEXP_SUBSTR()`](/doc/refman/8.0/en/regexp.html#function_regexp-substr) used + `UTF-16` rather than the character set and + collation of the expression searched for matches. + (Bug #94203, Bug #29308212) +* A `UNION ALL` query with + `SUM(constant)` was + processed very slowly compared to the same query using + `SUM(column)` + instead. + (Bug #93922, Bug #29227464) +* [`JSON_OBJECTAGG()`](/doc/refman/8.0/en/aggregate-functions.html#function_json-objectagg) is + non-deterministic in the presence of duplicate keys unless the + window has ordering on the key, which is expected behavior, but + a key-value pair that was no longer in the window frame still + appeared in the result. + (Bug #93822, Bug #29175262) +* `LIMIT` was applied before + `HAVING` in queries with subselects. + (Bug #93214, Bug #28934388) + + References: This issue is a regression of: Bug #25466100. +* A query involving `GROUP BY` on a + [`TIMESTAMP`](/doc/refman/8.0/en/datetime.html) column resulted in a + duplicate entry for key + ([`ER_DUP_ENTRY`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_dup_entry)) error. This + problem arose when `TIMESTAMP` values were + inserted into a table using a given setting for the time zone + and these values were later fetched after the time zone setting + had been changed, such that at least some of the inserted + `TIMESTAMP` values occurred during the hour + that the time changed from standard to daylight time (DST) in + the new time zone, during which time the same + `TIMESTAMP` value can exist twice. Now, when + the server would otherwise return the error DUPLICATE + ENTRY FOR KEY + '*`group_key`*', if the + grouping involves a `TIMESTAMP` column, it + instead raises the error Grouping on temporal is + non-deterministic for time zones having DST. Please consider + switching to UTC for this query. + + In addition, it is suggested to set + [`explicit_defaults_for_timestamp`](/doc/refman/8.0/en/server-system-variables.html#sysvar_explicit_defaults_for_timestamp) + to `ON` as well as one or more of + `MODE_NO_ZERO_IN_DATE`, + `MODE_NO_ZERO_DATE`, or + `MODE_INVALID_DATES` as part of the server SQL + mode to help avoid this issue. + (Bug #90398, Bug #27970159) diff --git a/corpus/changelog/mysql_releases/mysql_8018.md b/corpus/changelog/mysql_releases/mysql_8018.md new file mode 100644 index 0000000000000000000000000000000000000000..c82630e95a2553bb6dfa43c3ea1a00bf1b430457 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8018.md @@ -0,0 +1,1707 @@ +# MySQL 8.0.18 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-18.html +Version: 8.0.18 + +## Changes in MySQL 8.0.18 (2019-10-14, General Availability) + +For general information about upgrades, downgrades, platform support, etc., please visit [https://dev.mysql.com/doc/relnotes/mysql/8.0/en/](/doc/relnotes/mysql/8.0/en/). + +* [Account Management Notes](news-8-0-18.html#mysqld-8-0-18-account-management "Account Management Notes") +* [Compilation Notes](news-8-0-18.html#mysqld-8-0-18-compiling "Compilation Notes") +* [Configuration Notes](news-8-0-18.html#mysqld-8-0-18-configuration "Configuration Notes") +* [Connection Management Notes](news-8-0-18.html#mysqld-8-0-18-connection-management "Connection Management Notes") +* [Deprecation and Removal Notes](news-8-0-18.html#mysqld-8-0-18-deprecation-removal "Deprecation and Removal Notes") +* [Keyring Notes](news-8-0-18.html#mysqld-8-0-18-keyring "Keyring Notes") +* [Logging Notes](news-8-0-18.html#mysqld-8-0-18-logging "Logging Notes") +* [Optimizer Notes](news-8-0-18.html#mysqld-8-0-18-optimizer "Optimizer Notes") +* [Packaging Notes](news-8-0-18.html#mysqld-8-0-18-packaging "Packaging Notes") +* [Pluggable Authentication](news-8-0-18.html#mysqld-8-0-18-pluggable-auth "Pluggable Authentication") +* [Security Notes](news-8-0-18.html#mysqld-8-0-18-security "Security Notes") +* [Spatial Data Support](news-8-0-18.html#mysqld-8-0-18-spatial-support "Spatial Data Support") +* [sys Schema Notes](news-8-0-18.html#mysqld-8-0-18-sys-schema "sys Schema Notes") +* [Test Suite Notes](news-8-0-18.html#mysqld-8-0-18-test-suite "Test Suite Notes") +* [X Plugin Notes](news-8-0-18.html#mysqld-8-0-18-xplugin "X Plugin Notes") +* [Functionality Added or Changed](news-8-0-18.html#mysqld-8-0-18-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-18.html#mysqld-8-0-18-bug "Bugs Fixed") + +### Account Management Notes + +* The [`CREATE USER`](/doc/refman/8.0/en/create-user.html), + [`ALTER USER`](/doc/refman/8.0/en/alter-user.html), and + [`SET PASSWORD`](/doc/refman/8.0/en/set-password.html) statements now have + the capability of generating random passwords for user accounts, + as an alternative to requiring explicit administrator-specified + literal passwords. See [Password Management](/doc/refman/8.0/en/password-management.html). + (WL #11772) + +### Compilation Notes + +* **Incompatible Change:** + The `my_ulonglong` type is no longer used in + MySQL source code. Any third-party code that used this type + should use the `uint64_t` C type instead. Also, + it is possible that `printf()` format strings + will need adjustment if used to print + `my_ulonglong` variables. + (Bug #29453827) +* For building MySQL 8.0, the minimum required version of Protobuf + is now 3.0 rather than 2.5. + (Bug #30141272) +* The minimum version of the Boost library for server builds is + now 1.70.0. + (Bug #29639344) +* A `DBUG_TRACE` macro is available to assist in + writing debug code. It is a convenience that replaces pairs of + enter/leave macros. For example, instead of writing this: + + ```None + void foo() { + DBUG_ENTER("foo"); + bar(); + DBUG_VOID_RETURN; + } + ``` + + Write this instead: + + ```None + void foo() { + DBUG_TRACE; + bar(); + } + ``` + + (Bug #29589102) + +### Configuration Notes + +* `CMake` now enables use of + **fastcov** if it is available. + **fastcov** is faster than + **lcov** or **gcov**. This + requires GCC and **gcov** versions of 9 or + higher. + (Bug #30011512) +* The [`DISABLE_SHARED`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_disable_shared) + **CMake** option was unused and has been removed. + (Bug #29971049, Bug #96027) +* The **CMake** code to find Protobuf executables + now works on platforms that split these into multiple packages. + (Bug #29953773) +* The new [`ADD_GDB_INDEX`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_add_gdb_index) + **CMake** option determines whether to enable + generation of a `.gdb_index` section in + binaries, which makes loading them in a debugger faster. The + option is disabled by default. It has no effect if a linker + other than **lld** or GNU **gold** + is used. + (Bug #29925009, Bug #95857) +* For the [`INSTALL_LAYOUT`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_install_layout) + **CMake** option, the `SLES` and + `WIN` option values were not used and have been + removed. + (Bug #29871520, Bug #95654) +* The [`max_prepared_stmt_count`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_prepared_stmt_count) + system variable maximum value has been increased from 1 million + (1,048,576) to 4 million (4,194,304). The default value remains + unchanged at 16,382. + (WL #13342) +* MySQL 8.0 no longer supports building using + wolfSSL. All MySQL builds now use OpenSSL. + (WL #13290) +* The RE2 library is no longer used by MySQL. The library is no + longer bundled with source distributions and the + [`WITH_RE2`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_re2) **CMake** + option is obsolete. + +### Connection Management Notes + +* MySQL now provides more control over the use of compression to + minimize the number of bytes sent over connections to the + server. Previously, a given connection was either uncompressed + or used the `zlib` compression algorithm. Now, + it is also possible to use the `zstd` algorithm + (zstd 1.3), and to select a compression level for + `zstd` connections. The permitted compression + algorithms can be configured on the server side, as well as on + the connection-origination side for connections by client + programs and by servers participating in master/slave + replication or Group Replication. For more information, see + [Connection Compression Control](/doc/refman/8.0/en/connection-compression-control.html). + + Connection compression using the `zstd` + algorithm requires that the server be built with + `zstd` library support. The new + [`WITH_ZSTD`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_zstd) **CMake** + option indicates whether to use the bundled or system + `zstd` library. + + Legacy compression-control parameters, such as the + [`--compress`](/doc/refman/8.0/en/connection-options.html#option_general_compress) client option, are + deprecated and will be removed in a future MySQL version. + + Thanks to Facebook for the contribution on which some of this + work was based. + (WL #12039, WL #12475) + +### Deprecation and Removal Notes + +* Use of the `MYSQL_PWD` environment variable to + specify a MySQL password is considered insecure because its + value may be visible to other system users. + `MYSQL_PWD` is now deprecated and will be + removed in a future MySQL version. + (WL #13449) +* The `relay_log_info_file` system variable and + `--master-info-file` option are now deprecated + and will be removed in a future MySQL version. These were used + to specify the name of the relay log info log and master info + log when + [`relay_log_info_repository=FILE`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_relay_log_info_repository) + and [`master_info_repository=FILE`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_master_info_repository) + were set, but those settings have been deprecated. The use of + files for the relay log info log and master info log has been + superseded by crash-safe slave tables, which are the default in + MySQL 8.0. + (WL #11031) +* The `slave_rows_search_algorithms` system + variable is now deprecated and will be removed in a future MySQL + version. This variable was used to control how rows were + searched for matches when preparing batches of rows for + row-based logging and replication. The default setting + `INDEX_SCAN,HASH_SCAN` has been found to be + optimal for performance and works correctly in all scenarios. + (WL #12892) +* The `log_bin_use_v1_row_events` system variable + is now deprecated and will be removed in a future MySQL version. + When set to `ON`, the variable made + **mysqld** write the binary log using Version 1 + binary log row events, instead of Version 2 binary log row + events which are the default from MySQL 5.6. (The default is + `OFF`.) The use of Version 1 binary log row + events enabled row-based replication with slaves running MySQL + Server 5.5 and earlier, which could not use Version 2 binary log + row events. + (WL #12926) +* The `WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS()` + function is now deprecated, and the + `WAIT_FOR_EXECUTED_GTID_SET()` function should + be used instead. Both functions wait until all of the specified + transactions have been applied, or until the optional timeout + has elapsed. However, + `WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS()` applied + to a specific replication channel, and stopped only after the + transactions had been applied on that channel, for which the + applier had to be running. In contrast, + `WAIT_FOR_EXECUTED_GTID_SET()` stops after the + specified transactions have been applied on the server, + regardless of how they were applied (on any replication channel + or from any user client), and whether or not any replication + channels are running. + `WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS()` could + hang indefinitely if an expected transaction arrived on a + different replication channel or from a user client, for example + in a failover or manual recovery situation, and no timeout was + set. + (WL #13178) + +### Keyring Notes + +* MySQL Enterprise Edition now includes a `keyring_hashicorp` plugin + that uses HashiCorp Vault as a back end for keyring storage. For + more information, see [The MySQL Keyring](/doc/refman/8.0/en/keyring.html). + (WL #12522) + +### Logging Notes + +* Log buffering during server startup was adjusted for less delay + in the appearance of output in the error log. + (Bug #30019632) + +### Optimizer Notes + +* Queries involving first match split jump operations were handled + wrongly in the iterator executor. They are now rewritten to + weedout. + (Bug #30220791) +* Hash joins have been implemented as a way of executing inner + equi-joins in MySQL. For example, a query such as this one can + be executed as a hash join beginning with this release: + + ```None + SELECT * + FROM t1 + JOIN t2 + ON t1.c1 = t2.c1; + ``` + + Multi-table joins using equi-joins can also take advantage of + this optimization. + + A hash join requires no index for execution. In most cases, a + hash join is more efficient than the block-nested loop algorithm + previously used for equi-joins without indexes. + + By default, beginning with this release, a hash join is used + whenever a join includes at least one equi-join condition, and + no indexes can be applied to the join condition. (A hash join + can still be used where there are indexes applying to + single-table predicates only.) This preference can be overridden + by setting the [`hash_join`](/doc/refman/8.0/en/switchable-optimizations.html#optflag_hash-join) + optimizer switch to `off`, or by using the + [`NO_HASH_JOIN`](/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-table-level) optimizer hint. + In addition, you can control the amount of memory used by a hash + join by setting + [`join_buffer_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_join_buffer_size). A join whose + memory requirement exceeds this amount is executed on disk; an + on-disk hash join uses a number of disk files and may not be + executable if this number exceeds + [`open_files_limit`](/doc/refman/8.0/en/server-system-variables.html#sysvar_open_files_limit). + + A hash join cannot be employed if the join conditions for any + pair of joined tables do not include at least one equi-join + condition among all join conditions used. A hash join + *is* used for a Cartesian product—that + is, a join that specifies no join conditions at all. + + You can see whether hash joins have been used to optimize a + query in the output of + [`EXPLAIN + FORMAT=TREE`](/doc/refman/8.0/en/explain.html) or [`EXPLAIN + ANALYZE`](/doc/refman/8.0/en/explain.html#explain-analyze). + + In addition, inner joins using hash joins can now also take + advantage of Batched Key Access (BKA). Outer joins still + allocate the entire join buffer. + + For more information, see [Hash Join Optimization](/doc/refman/8.0/en/hash-joins.html). + (WL #2241, WL #13002) +* Added [`EXPLAIN ANALYZE`](/doc/refman/8.0/en/explain.html#explain-analyze), which + provides iterator-based timing, cost, and other information + about queries in `TREE` format. This statement + produces output similar to that of + [`EXPLAIN`](/doc/refman/8.0/en/explain.html), but with additional + information about how optimizer estimates match actual + execution. + (WL #4168) +* MySQL now performs injection of casts into queries to avoid + certain data type mismatches; that is, the optimizer now adds + casting operations in the item tree inside expressions and + conditions in which the data type of the argument and the + expected data type do not match. This makes the query as + executed equivalent to one which is compliant with the SQL + standard while maintaining backwards compatibility with previous + releases of MySQL. + + Such implicit casts are now performed between temporal types and + numeric types by casting both arguments as + [`DOUBLE`](/doc/refman/8.0/en/floating-point-types.html) whenever they are compared + using any of the standard numeric comparison operators. They are + also now performed for such comparisons between + [`DATE`](/doc/refman/8.0/en/datetime.html) or + [`TIME`](/doc/refman/8.0/en/time.html) values and + [`DATETIME`](/doc/refman/8.0/en/datetime.html) values, in which case + the arguments are cast as `DATETIME`. + + For example, a query such as `SELECT * FROM t1 JOIN t2 + ON t1.int_col = + t2.date_col` is rewritten + and executed as `SELECT * FROM t1 JOIN t2 ON + CAST(t1.int_col AS DOUBLE) = + CAST(t2.date_col AS + DOUBLE)`, and `SELECT * FROM t1 JOIN t2 ON + t1.time_col = + t2.date_col` is transformed + to `SELECT * FROM t1 JOIN t2 ON + CAST(t1.time_col AS DATETIME) = + CAST(t2.date_col AS + DATETIME)` prior to execution. + + It is possible to see when casts are injected into a given query + by viewing the output of [`EXPLAIN + ANALYZE`](/doc/refman/8.0/en/explain.html#explain-analyze), `EXPLAIN FORMAT=JSON`, or + `EXPLAIN FORMAT=TREE`. + `EXPLAIN` can also be used, but in this case it + is also necessary to issue [`SHOW + WARNINGS`](/doc/refman/8.0/en/show-warnings.html) afterwards. + + This change is not expected to cause any difference in query + results or performance. + (WL #12108) + +### Packaging Notes + +* The `component_test_page_track_component.so` + test plugin has been moved to `-test` packages. + (Bug #30199634) +* Binary packages that include `curl` rather than + linking to the system `curl` library have been + upgraded to use `curl` 7.65.3. + (Bug #30015512) + +### Pluggable Authentication + +* To assist in debugging failed connections for accounts that use + an LDAP authentication plugin, the + [`authentication_ldap_simple_log_status`](/doc/refman/8.0/en/pluggable-authentication-system-variables.html#sysvar_authentication_ldap_simple_log_status) + and + [`authentication_ldap_sasl_log_status`](/doc/refman/8.0/en/pluggable-authentication-system-variables.html#sysvar_authentication_ldap_sasl_log_status) + system variables now accept a maximum value of 6 (formerly 5). + Setting either variable to 6 causes debugging messages from the + LDAP library to be written to the error log for the + corresponding plugin. + (Bug #29771393) + +### Security Notes + +* For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 1.1.1c. Issues fixed in the new OpenSSL version are described at + and + . + (Bug #29868818) + +### Spatial Data Support + +* Previously, for geometry arguments in a geographic SRS, + [`ST_Distance()`](/doc/refman/8.0/en/spatial-relation-functions-object-shapes.html#function_st-distance) supported only + argument types of `Point` and + `Point`, or `Point` and + `MultiPoint`. + [`ST_Distance()`](/doc/refman/8.0/en/spatial-relation-functions-object-shapes.html#function_st-distance) now supports + distance calculations for geographic SRS arguments of all + geometry types. For more information, see + [Spatial Relation Functions That Use Object Shapes](/doc/refman/8.0/en/spatial-relation-functions-object-shapes.html). + (WL #12216) + +### sys Schema Notes + +* The [`sys.schema_unused_indexes`](/doc/refman/8.0/en/sys-schema-unused-indexes.html) view + now filters out unique indexes. Thanks to Gillian Gunson for the + contribution. + (Bug #24798995, Bug #83257) +* The [`sys.ps_is_consumer_enabled()`](/doc/refman/8.0/en/sys-ps-is-consumer-enabled.html) + function now produces an error rather than returning + `NULL` if the argument is an unknown + non-`NULL` consumer name. + (Bug #24760317) +* Previously, `sys` schema sources were + maintained in a separate Git repository. `sys` + schema sources now are included with and maintained within MySQL + source distributions (under + `scripts/sys_schema`). As a consequence of + this change, to simplify maintenance of `sys` + schema scripts going forward, the acceptable format of + statements in the file named by the + [`init_file`](/doc/refman/8.0/en/server-system-variables.html#sysvar_init_file) system variable has + been expanded. For details, see the description of that variable + in [Server System Variables](/doc/refman/8.0/en/server-system-variables.html). + + The [`sys.version`](/doc/refman/8.0/en/sys-version.html) view is deprecated + and will be removed in a future MySQL version. Affected + applications should be adjusted to use an alternative instead. + For example, use the [`VERSION()`](/doc/refman/8.0/en/information-functions.html#function_version) + function to retrieve the MySQL server version. + (WL #12673) + +### Test Suite Notes + +* MySQL tests were updated to use the latest version of + googletest. + (Bug #30079649) + +### X Plugin Notes + +* X Protocol did not correctly display large numbers of warning + messages that were issued for the same query. + (Bug #30055869) +* When the `NO_BACKSLASH_ESCAPES` SQL mode was + enabled, X Plugin incorrectly reported collections as tables. + (Bug #28208285) + +### Functionality Added or Changed + +* **Replication; Group Replication:** + By default, MySQL replication (including Group Replication) does + not carry out privilege checks when transactions that were + already accepted by another server are applied on a replication + slave or group member. From MySQL 8.0.18, you can create a user + account with the appropriate privileges to apply the + transactions that are normally replicated on a channel, and + specify this as the `PRIVILEGE_CHECKS_USER` + account for the replication applier. MySQL then checks each + transaction against the user account's privileges to verify that + you have authorized the operation for that channel. The account + can also be safely used by an administrator to apply or reapply + transactions from **mysqlbinlog** output, for + example to recover from a replication error on the channel. The + use of a `PRIVILEGE_CHECKS_USER` account helps + secure a replication channel against the unauthorized or + accidental use of privileged or unwanted operations. + + You grant the [`REPLICATION_APPLIER`](/doc/refman/8.0/en/privileges-provided.html#priv_replication-applier) + privilege to enable a user account to appear as the + `PRIVILEGE_CHECKS_USER` for a replication + applier thread, and to execute the internal-use + [`BINLOG`](/doc/refman/8.0/en/binlog.html) statements used by + **mysqlbinlog**. After setting up the user + account, use the [`GRANT`](/doc/refman/8.0/en/grant.html) statement + to grant additional privileges to enable the user account to + make the database changes that you expect the applier thread to + carry out, such as updating specific tables held on the server. + These same privileges enable an administrator to use the account + if they need to execute any of those transactions manually on + the replication channel. If an unexpected operation is attempted + for which you did not grant the appropriate privileges, the + operation is disallowed and the replication applier thread stops + with an error. + (WL #12966) +* **Group Replication:** + For group communication connections, Group Replication now + supports the TLSv1.3 protocol, which was supported by MySQL + Server from 8.0.16. To use the TLSv1.3 protocol, MySQL Server + must be compiled using OpenSSL 1.1.1 or higher. For information + on configuring encrypted connections for Group Replication, see + [Securing Group Communication Connections with Secure Socket Layer (SSL)](/doc/refman/8.0/en/group-replication-secure-socket-layer-support-ssl.html). + (WL #12990) +* **Group Replication:** + A new option `OFFLINE_MODE` is available for + the + [`group_replication_exit_state_action`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_exit_state_action) + system variable, which specifies how Group Replication behaves + when a server instance leaves the group unintentionally, for + example after encountering an applier error, or in the case of a + loss of majority, or when another member of the group expels it + due to a suspicion timing out. + + When `OFFLINE_MODE` is specified as the exit + action, Group Replication switches MySQL to offline mode by + setting the system variable + [`offline_mode`](/doc/refman/8.0/en/server-system-variables.html#sysvar_offline_mode) to + `ON`. When the member is in offline mode, + connected client users are disconnected on their next request + and connections are no longer accepted, with the exception of + client users that have the + [`CONNECTION_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_connection-admin) or + [`SUPER`](/doc/refman/8.0/en/privileges-provided.html#priv_super) privilege. Group + Replication also sets the system variable + [`super_read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only) to + `ON`, so clients cannot make any updates, even + if they have connected with the + [`SUPER`](/doc/refman/8.0/en/privileges-provided.html#priv_super) privilege. + + The `OFFLINE_MODE` exit action prevents updates + like the default `READ_ONLY` exit action does, + but also prevents stale reads (with the exception of reads by + client users with the stated privileges), and enables proxy + tools such as MySQL Router to recognize that the server is + unavailable and redirect client connections. It also leaves the + instance running so that an administrator can attempt to resolve + the issue without shutting down MySQL, unlike the existing + alternative `ABORT_SERVER` exit action, which + shuts down the instance. + (WL #12895) +* **Group Replication:** + An internal message service has been added to Group Replication. + MySQL modules can use the service to transmit generic messages + with an identifying tag to all group members, using Group + Replication's existing group communication connections. + (WL #12896) +* When the server is run with + [`--initialize`](/doc/refman/8.0/en/server-options.html#option_mysqld_initialize), there is no reason + to load non-early plugins. The server now logs a warning and + ignores any [`--plugin-load`](/doc/refman/8.0/en/server-options.html#option_mysqld_plugin-load) or + [`--plugin-load-add`](/doc/refman/8.0/en/server-options.html#option_mysqld_plugin-load-add) options given + with [`--initialize`](/doc/refman/8.0/en/server-options.html#option_mysqld_initialize). + (Bug #29622406) +* The number of diagnostic messages relating to + `INFORMATION_SCHEMA` upgrade during server + startup has been reduced. + (Bug #29440725, Bug #94559) +* Prior to MySQL 8.0, [`REVOKE`](/doc/refman/8.0/en/revoke.html) + produced an error for attempts to revoke an unknown privilege. + In MySQL 8.0, an account can possess a privilege that is + currently unknown to the server if it is a dynamic account that + was granted while the component or plugin that registers the + privilege was installed. If that component or plugin is + subsequently uninstalled, the privilege becomes unregistered, + although accounts that possess the privilege still possess it. + Revoking such a privilege cannot be distinguished from revoking + a privilege that actually is invalid, so + [`REVOKE`](/doc/refman/8.0/en/revoke.html) no longer produces an + error for attempts to revoke an unknown privilege. However, to + indicate that the privilege is currently unknown, + [`REVOKE`](/doc/refman/8.0/en/revoke.html) now produces a warning. + (Bug #29395197) +* The new [`innodb_idle_flush_pct`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_idle_flush_pct) + variable permits placing a limit on page flushing during idle + periods, which can help extend the life of solid state storage + devices. See [Limiting Buffer Flushing During Idle Periods](/doc/refman/8.0/en/innodb-buffer-pool-flushing.html#innodb-limit-flushing-rate). + + Thanks to Facebook for the contribution. + (Bug #27147088, Bug #88566, WL #13115) +* **mysqld** invoked with the + [`--help`](/doc/refman/8.0/en/server-options.html#option_mysqld_help) option no longer aborts if + the [`secure_file_priv`](/doc/refman/8.0/en/server-system-variables.html#sysvar_secure_file_priv) argument + does not exist. + (Bug #26336130) +* The Protobuf libraries are now dynamically linked. Their default + locations are `/usr/lib64/mysql/private/` for + RPMs, `/usr/lib/mysql/private/` for DEBs, and + `/lib/private/` for TAR builds. A new + `INSTALL_PRIV_LIBDIR` CMake + variable controls the location. + (WL #13126) + +### Bugs Fixed + +* **NDB Cluster:** + A query handled using a pushed condition produced incorrect + results when it included an `ORDER BY` clause. + (Bug #29595346) + + References: This issue is a regression of: Bug #28672214. +* **NDB Cluster:** + The `NDB` transporter layer limits the size of + messages to 32768 bytes; send buffers place additional (and + stricter) limitations on message size. Whenever a message is + appended to a send buffer, page checks are performed to ensure + that the message fits in the available space; if not, a new page + is used. The current issue arose on account of the fact that no + check was performed to make sure that this message could fit in + the empty page; when the size of the message exceeded the empty + page, this resulted in a buffer overwrite and in the overwriting + of the next page in memory. For data nodes the largest message + supported by the send buffer (`thr_send_page`) + is 32756 bytes; for API and management nodes, this maximum is + 32752 bytes. (Signals sent within an individual data node are + not subject to these limitations since no send or transporter + buffers are used in this case). Now, when a new page is used, + the size of the message is checked against that which is + available in a new page. + + As part of the work done to fix the problem just described, + three new [`DUMP`](/doc/ndb-internals/en/dump-commands.html) commands are + added to facilitate related testing and debugging: + [`DUMP 103003`](/doc/ndb-internals/en/dump-command-103003.html) + (`CmvmiRelayDumpStateOrd`) sends a + `DUMP` command using another node; + [`DUMP 103004`](/doc/ndb-internals/en/dump-command-103004.html) + (`CmvmiDummySignal`) and + [`DUMP 103005`](/doc/ndb-internals/en/dump-command-103005.html) + (`CmvmiSendDummySignal`) can be used to send + long messages. + (Bug #29024275) +* **NDB Cluster:** + [`EXPLAIN + FORMAT=TREE`](/doc/refman/8.0/en/explain.html) did not provide proper explanations of + conditions and joins pushed down to the + [`NDBCLUSTER`](/doc/refman/8.0/en/mysql-cluster.html) storage engine. Issues + included the following: + + + Pushed conditions were not shown. + + The root of a pushed join was not shown. + + The child of a pushed join did not include any reference to + its parent operation. +* **InnoDB:** + An internal function + (`btr_push_update_extern_fields()`) used to + fetch newly added externally stored fields and update them + during a pessimistic update or when going back to a previous + version of a record was no longer required. Newly added + externally stored fields are updated by a different function. + Also, the method used to determine the number of externally + stored fields was corrected. + (Bug #30342846) +* **InnoDB:** + An [`DROP UNDO + TABLESPACE`](/doc/refman/8.0/en/drop-tablespace.html) operation on an undo tablespace with a + missing data file caused a segmentation fault. + (Bug #30155290) +* **InnoDB:** + An error in the internal + `trx_rseg_add_rollback_segments` function was + corrected. + (Bug #30114226, Bug #96372) +* **InnoDB:** + Problematic assertion code in the Contention-Aware Transaction + Scheduling (CATS) code was revised. + (Bug #30086559) +* **InnoDB:** + Arguments passed to a derived class in calls from the + `ib::fatal` and + `ib::fatal_or_error` constructors could be + ignored, resulting in invalid error messages. Additionally, in + the case of a fatal error, the + `ib::fatal_or_error` destructor could cause a + server exit before printing a message. + (Bug #30071930) +* **InnoDB:** + It was possible for a corrupted table to be removed from the + table cache before the reference count for the table reached + zero. + (Bug #30065947, Bug #96224) +* **InnoDB:** + A code path for the internal + `row_update_inplace_for_intrinsic()` function + did not include a required mini-transaction (mtr) commit, + causing a debug assertion failure. + (Bug #30065518) +* **InnoDB:** + The internal `fsp_srv_undo_tablespace_fixup()` + function did not take an `undo::ddl_mutex` lock + when called during startup, which could lead to an assertion + failure under certain circumstances. + (Bug #30029433, Bug #30461911, Bug #97356) +* **InnoDB:** + Inspection of `rename_tablespace_name()` + function showed that if + `old_shard->get_space_by_id(space_id)` did + not find the tablespace ID, it would return without calling + `old_shard->mutex_release()`. + (Bug #30027771) +* **InnoDB:** + A tablespace with “FTS” in its name was incorrectly + determined to be the tablespace of a full-text index table and + not registered with the data dictionary during upgrade, causing + the upgrade operation to fail. + (Bug #29992589) +* **InnoDB:** + The `ibuf_merge_or_delete_for_page()` function, + responsible for merging and deleting pages in the change buffer, + is no longer called for undo tablespaces and temporary + tablespaces. The change buffer does not contain entries for + those tablespace types. + (Bug #29960394, Bug #95989) +* **InnoDB:** + Some combinations of buffer pool size variables + ([`--innodb-buffer-pool-instances`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_buffer_pool_instances), + [`--innodb-buffer-pool-size`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_buffer_pool_size), and + [`--innodb-buffer-pool-chunk-size`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_buffer_pool_chunk_size)) + lead to a chunk size that is 0, 1, or a value that is not a + multiple of the page size, and so on, causing errors during + buffer pool creation and sizing. + (Bug #29951982) +* **InnoDB:** + A server exit while an undo tablespace was being truncated + caused the following error when a clone operation was rolled + forward after restarting the server: [ERROR] + [MY-011825] [InnoDB] [FATAL] Clone File Roll Forward: Invalid + File State: 0. + (Bug #29949917) +* **InnoDB:** + An [`ALTER TABLE ... + DISCARD TABLESPACE`](/doc/refman/8.0/en/alter-table.html) operation caused a hang condition. + (Bug #29942556, Bug #30324703) +* **InnoDB:** + Cloning operations failed with the following error after an + archive thread failure: ERROR 3862 (HY000): Clone + Donor Error: 1317 : Query execution was interrupted. + (Bug #29930839) +* **InnoDB:** + A clone related regression caused a minor drop in performance + for index and non-index update operations. + (Bug #29925409) +* **InnoDB:** + `InnoDB` now ignores hidden directories and + files during the tablespace discovery scan that occurs at + startup. Hidden directories and files include those beginning + with "." and hidden and system directories and files on Windows + that are identified by attributes. + (Bug #29900671, Bug #95071, Bug #30068072) +* **InnoDB:** + To improve deadlock detection, the task of detecting a deadlock + cycle among data locks was moved from the transaction thread to + a dedicated background thread. + (Bug #29882690) +* **InnoDB:** + Updating the `mysql.gtid_executed` table during + **mysqld** initialization caused the following + warning to be printed to the error log: [Warning] + [MY-010015] [Repl] Gtid table is not ready to be used. Table + 'mysql.gtid\_executed' cannot be opened. The update + and associated warning no longer occur. + (Bug #29871809) +* **InnoDB:** + The `LATEST DETECTED DEADLOCK` section in + `InnoDB` Standard Monitor output (also printed + by [`SHOW ENGINE + INNODB STATUS`](/doc/refman/8.0/en/show-engine.html)) was extended to include additional + information about transactions that participate in a deadlock + cycle. + (Bug #29871641) +* **InnoDB:** + An incorrect argument was used to compare serialized dictionary + information (SDI) input and output values when checking the size + of the buffer used to store SDI. + (Bug #29871525, Bug #95606) +* **InnoDB:** + An undo tablespace file was overwritten during a cloning + operation when undo tablespaces files with the same name were + copied from different directories on the donor to the same + directory on the recipient. A cloning operation now reports an + error if duplicate undo tablespace names are encountered. When + data is cloned to the recipient, undo tablespace files are + cloned to the directory defined by the + [`innodb_undo_directory`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_undo_directory) variable. + Because the files are cloned to the same directory, duplicate + undo tablespace file names are not permitted. + (Bug #29837617) +* **InnoDB:** + A cloning operation generated a large number of redo log files + when cloning from a MySQL server instance with a small redo log + file size and a large number of transactions. The large number + of redo log files sometimes caused startup to hang or assert. + Otherwise, startup was permitted proceed without cleaning up the + excessive number of redo log files. + (Bug #29837490) +* **InnoDB:** + During recovery, missing table errors that occur when applying + redo logs to encrypted tables could be ignored, permitting + startup to proceed. Startup should be halted in this case. + (Bug #29820184, Bug #95183) +* **InnoDB:** + The wrong redo log file size was printed to the server error log + at startup. + (Bug #29818711) +* **InnoDB:** + A restriction that prevented reuse of lock objects + (`lock_t` structs) in the lock queue when + waiting record lock requests were present was removed. + (Bug #29814308) +* **InnoDB:** + When converting a long partitioned table name to a file name, + the buffer that holds the file name did not have enough space, + causing an assertion failure. + (Bug #29813582) +* **InnoDB:** + Some transaction lock structure fields + (`trx->lock`) were not properly mutex + protected. + (Bug #29809137) +* **InnoDB:** + An empty undo segment update during recovery raised an + assertion. + (Bug #29802703) +* **InnoDB:** + A cloning operation failed when attempting to drop data on the + recipient if the recipient data included a table with a + full-text index. + (Bug #29796507) +* **InnoDB:** + After a file-per-table tablespace was discarded, an error was + reported when the old table was renamed and a new table was + created with the same name. The error was due to stale file path + information. + (Bug #29793800) +* **InnoDB:** + A test case that attempts to open a file in read-only mode while + the server is in a disk-full state caused a debug assertion + failure. The assertion was removed to permit the server to retry + opening the file, and to report an error if unsuccessful after a + number of attempts. + (Bug #29692250, Bug #95128) +* **InnoDB:** + Foreign-key-related tables constructed during a + [`RENAME TABLE`](/doc/refman/8.0/en/rename-table.html) operation contained + the old table name. + (Bug #29686796) +* **InnoDB:** + The server passed a NULL value for a column with a non-zero data + length. + (Bug #29654465) +* **InnoDB:** + Importing a partitioned table from a MySQL 8.0.13 instance (or + earlier) to a MySQL 8.0.14, 8.0.15, or 8.0.16 instance failed + with a “tablespace is missing” error for source and + target instances defined with + [`lower_case_table_names=1`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names). The + tablespace file and the metadata file used by the import + operation could not be found due to a file name case mismatch. + (Bug #29627690, Bug #94850) + + References: This issue is a regression of: Bug #26925260. +* **InnoDB:** + The read set (`TABLE::read_set`) was not set + properly for handler method calls in + `QUICK_SKIP_SCAN_SELECT::get_next()`, causing + an assertion failure. + (Bug #29602393) +* **InnoDB:** + An exclusive backup lock is now used to block tablespace + truncate operations during master key rotation. Previously, + metadata locks on undo tablespace names were used to synchronize + the operations. This patch also addresses a deadlock that could + occur between master key rotation and drop undo tablespace + operations. + (Bug #29549938, Bug #30461225, Bug #97352) +* **InnoDB:** + An unnecessary next key lock was taken when performing a + [`SELECT...FOR + [SHARE|UPDATE]`](/doc/refman/8.0/en/innodb-locking-reads.html) query with a `WHERE` + condition that specifies a range, causing one too many rows to + be locked. The most common occurrences of this issue have been + addressed so that only rows and gaps that intersect the searched + range are locked. + (Bug #29508068) +* **InnoDB:** + Adding a virtual column in the first position together with a + normal column raised an assertion failure. + (Bug #29501324) +* **InnoDB:** + The shutdown process did not wait for `InnoDB` + background threads to exit, which could cause shutdown to stall, + waiting for background threads to remove transactions from the + MySQL transaction list. A check now occurs to ensure that + `InnoDB` background threads have exited + properly. Also, an intermediate shutdown state was added to + improve shutdown timing for the `InnoDB` master + thread. + (Bug #29417503) +* **InnoDB:** + A memory leak occurred during TempTable storage engine operation + due a failure to deallocate that last block of allocated memory, + which TempTable holds in thread-local storage until thread exit. + (Bug #29300927) +* **InnoDB:** + Throughput stalled under a heavy workload with a small + [`innodb_io_capacity_max`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_io_capacity_max) setting, + a single page cleaner thread, and multiple buffer pool + instances. + (Bug #29029294) +* **InnoDB:** + A long running + [`ALTER TABLE ... ADD + INDEX`](/doc/refman/8.0/en/alter-table.html) operation with concurrent inserts caused + semaphore waits. Thanks to Satya Bodapati for the patch. + (Bug #29008298) +* **InnoDB:** + The + [`INFORMATION_SCHEMA.INNODB_COLUMNS`](/doc/refman/8.0/en/information-schema-innodb-columns-table.html) + table did not display partitioned table columns after upgrading + from MySQL 5.7 to MySQL 8.0. For partitioned tables created on + the MySQL 8.0 release, + [`INFORMATION_SCHEMA.INNODB_COLUMNS`](/doc/refman/8.0/en/information-schema-innodb-columns-table.html) + only displayed columns for the first table partition. + (Bug #28869903, Bug #93033) +* **InnoDB:** + The internal `rtr_page_split_and_insert()` + function is called recursively. An inner call to the function + released an object still being used by an outer call to the same + function, causing an assertion failure. + (Bug #28569379) +* **InnoDB:** + Under specific circumstances, setting the + [`innodb_limit_optimistic_insert_debug`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_limit_optimistic_insert_debug) + variable to 2 raised a debug assertion when it should have + reported an error. + (Bug #28552330, Bug #92187) +* **InnoDB:** + A deadlock was possible when a transaction tries to upgrade a + record lock to a next key lock. + (Bug #23755664, Bug #82127) +* **InnoDB:** + The + [`INFORMATION_SCHEMA.INNODB_METRICS`](/doc/refman/8.0/en/information-schema-innodb-metrics-table.html) + `lock_deadlocks` counter did not count all + deadlocks. Thanks to Laurynas Biveinis for the contribution. + (Bug #21278148, Bug #77399) +* **InnoDB:** + An error reported during a read operation did not identify the + name of the file that was read. + (Bug #21120885, Bug #76020) +* **Replication:** + If the + [`group_replication_set_communication_protocol()`](/doc/refman/8.0/en/group-replication-functions-for-communication-protocol.html#function_group-replication-set-communication-protocol) + function was used to set a communication protocol version that + some group members did not support, the protocol change + procedure was not stopped correctly. The issue has now been + fixed. + (Bug #30209596) +* **Replication:** + The session value of the + [`default_table_encryption`](/doc/refman/8.0/en/server-system-variables.html#sysvar_default_table_encryption) system + variable is replicated, so that replication slaves preserve the + correct encryption setting for databases and tablespaces. For a + replication channel where the + [`table_encryption_privilege_check`](/doc/refman/8.0/en/server-system-variables.html#sysvar_table_encryption_privilege_check) + system variable is set to `ON`, the + [`TABLE_ENCRYPTION_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_table-encryption-admin) privilege + is required to apply events where the session value of + [`default_table_encryption`](/doc/refman/8.0/en/server-system-variables.html#sysvar_default_table_encryption) is + changed. If this privilege had not been granted on the + replication slave, replication stopped with an error in some + situations where the required encryption setting for the event + was actually the same as the slave's own default encryption + setting, so the action ought to have worked. It was also + possible for a statement with a different encryption setting + from the slave to succeed when it ought not to have worked. The + behaviors have now been corrected so that a replication slave + without the + [`TABLE_ENCRYPTION_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_table-encryption-admin) privilege + is permitted to apply events that match its own default + encryption setting, and is not requested to set the encryption + setting unnecessarily, but is still subject to appropriate + privilege checks if the event requires a different encryption + setting. + (Bug #29818605) +* **Replication:** + The timeout in seconds specified by the + [`group_replication_unreachable_majority_timeout`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_unreachable_majority_timeout) + system variable was only checked every two seconds. The timeout + is now checked every second so that odd-numbered values are + respected. + (Bug #29762005) +* **Replication:** + A deadlock involving three threads could occur if a + [`START SLAVE`](/doc/refman/8.0/en/start-slave.html) statement was issued + to start the SQL thread on a slave while the SQL thread was + still in the process of being stopped, and a request for the + slave status was made at the same time. The issue has now been + fixed by releasing a lock earlier while the SQL thread is being + stopped. + (Bug #29697588, Bug #95115) +* **Replication:** + A locking issue in the + `WAIT_FOR_EXECUTED_GTID_SET()` function could + cause the server to hang in certain circumstances. The issue has + now been corrected. + (Bug #29550513) +* **Replication:** + A deadlock could occur if the value of the + [`binlog_encryption`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_encryption) system + variable was changed while a [`START + SLAVE`](/doc/refman/8.0/en/start-slave.html) statement was being executed. + (Bug #29515210) +* **Replication:** + The heartbeat interval for a replication slave, which is + controlled by the `MASTER_HEARTBEAT_PERIOD` + option of the [`CHANGE MASTER TO`](/doc/refman/8.0/en/change-master-to.html) + statement, can be specified with a resolution in milliseconds. + Previously, the master's binary log dump thread used a + granularity of seconds to calculate whether a heartbeat signal + should be sent to the slave, causing excessive heartbeat + activity in the case of multiple skipped events. To remove this + issue, all heartbeat-related calculations by the master and + slave are now carried out using a granularity of nanoseconds for + precision. Thanks to Facebook for the contribution. + (Bug #29363787, Bug #94356) +* **Replication:** + Creation of a table with functional index creates a hidden + generated column on the table, but this column did not always + appear in the same position in the table, which meant that later + adding a column (or columns) to the table might leave the hidden + column in a different position as compared to an otherwise + identical table already having the additional column or columns + in a single CREATE TABLE statement. For example, this difference + could be evident between two tables `t1` and + `t2`, with `t1` created and + then altered by the two statements `CREATE TABLE t (a + INT, INDEX ((a+1)))` and `ALTER TABLE t ADD + COLUMN b INT`, and `t2` created using + `CREATE TABLE t2 (a INT, b INT, INDEX + ((a+1)))`, even though `SHOW CREATE TABLE + t1` and `SHOW CREATE TABLE t2` + produced identical results (other than for the names of the + tables). + + The issue just described could become problematic due to the + fact that the internal definitions for the tables as described + by `Table_map_log_events` in the binary log + would differ. This meant that, if such a table was created using + `CREATE TABLE` followed by `ALTER + TABLE` on the master, and then a slave was deployed + using **mysqldump**, the slave's version of the + table would be created using a single **CREATE + TABLE** statement, and subsequent replication of row + events would then fail with an error due to mismatching types. + + This issue is fixed by forcing all hidden generated columns + always to be located at the end of the list of columns, with + multiple generated columns sorted by column name. If a new + functional index part is added to the table, the new hidden + column is inserted according to this rule. In addition, if the + user creates a new column that is not a generated column, the + column is always added before the first hidden column. + + Note + + The structure of tables affected by this change is not changed + automatically during upgrade; this must done explicitly by + executing `ALTER TABLE`. + + (Bug #29317684) +* **Replication:** + If a [`RESET MASTER`](/doc/refman/8.0/en/reset-master.html) statement was + stopped during its execution, the binary log was not available + for writes afterwards. + (Bug #29125121) +* **Replication:** + On a multi-threaded slave with GTIDs in use and + `MASTER_AUTO_POSITION` set to + `ON`, following an unexpected halt the slave + would attempt relay log recovery, which failed if relay logs had + been lost, preventing replication from starting. However, this + step was unnecessary as GTID auto-positioning can be used to + restore any missing transactions. In a recovery situation, the + slave now checks first whether + `MASTER_AUTO_POSITION` is set to + `ON`, and if it is, omits the step of + calculating the transactions that should be skipped or not + skipped, so that the old relay logs are not needed and recovery + can proceed without them. + (Bug #28830834, Bug #92882) +* **Group Replication:** + If the TCP connections used by Group Replication time out due to + a lengthy network error, the group communication engine (XCom) + cannot re-establish its local connection, requiring a restart of + Group Replication on the instance (see Bug #25656508). + Previously, attempting to stop Group Replication in this + situation caused XCom to hang, preventing the restart. This + issue has now been fixed so that XCom terminates correctly and + Group Replication can be restarted to re-establish the local + connection. + (Bug #30132500) + + References: See also: Bug #22158368. +* **Group Replication:** + When the [`ANSI_QUOTES`](/doc/refman/8.0/en/sql-mode.html#sqlmode_ansi_quotes) SQL mode + was enabled, Group Replication returned an error when checking + for the presence of MySQL Server's clone plugin to perform + remote cloning operations for distributed recovery. The issue + has now been fixed. + (Bug #30099796) +* **Group Replication:** + [`default_table_encryption`](/doc/refman/8.0/en/server-system-variables.html#sysvar_default_table_encryption) could + be changed while Group Replication was running by issuing + [`SET + PERSIST`](/doc/refman/8.0/en/set-variable.html), even though this variable should never be + settable insuch cases. + (Bug #30031228, Bug #96158) +* **Group Replication:** + If + [`group_replication_local_address`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_local_address) + was changed for a member which then rejoined the group, copies + of the old local address were retained in some locations by the + Group Communication System (GCS). To fix this, we now fetch the + local address when needed, and no longer obtain it from the + cache. + (Bug #29910699) +* **Group Replication:** + When a remote cloning operation was used to provide transactions + to a joining member and the joining member was stopped during + the operation, it did not shut down cleanly. + (Bug #29902389) +* **Group Replication:** + The input channel introduced in this release uses a shared + memory queue instead of a TCP socket for communication between + the Group Communication System (GCS) component of Group + Replication and the local group communication engine (XCom) + instance. This input channel could not be established on SELinux + installations, which meant members upgraded to MySQL 8.0.14 or + later were unable to rejoin the group. When Group Replication + was started, the XCom instance temporarily opened a port from + the ephemeral port range to allow GCS to establish a connection + for the input channel, but on SELinux the + **mysqld** process did not have permission to + connect to this port. A workaround was to amend the SELinux + policy to allow MySQL to connect to any port, but this reduced + security. This issue is now fixed; XCom and GCS no longer use an + ephemeral port to establish a connection for the input channel, + but instead use the Group Replication communication port set by + [`group_replication_local_address`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_local_address). + This action must be permitted by SELinux (see + [Frequently Asked Questions](/doc/refman/8.0/en/group-replication-frequently-asked-questions.html)). + (Bug #29742219, Bug #30087757) +* **Group Replication:** + Server certificates whose Common Name value used a wildcard were + incorrectly rejected. + (Bug #29683275, Bug #95068) +* **Group Replication:** + It was possible for the Group Communication System (GCS) to + deliver messages from a member after [`STOP + GROUP_REPLICATION`](/doc/refman/8.0/en/stop-group-replication.html) had been issued and the member's + status was `OFFLINE`, resulting in an error. + GCS now verifies that the member belongs to a group before + delivering any such messages. + (Bug #29620900) +* **Group Replication:** + Some threads that executed transient or minor tasks, such as the + delayed plugin initialization thread, were not visible in the + Performance Schema [`threads`](/doc/refman/8.0/en/performance-schema-threads-table.html) table. + (Bug #28930537, Bug #93212) +* **Group Replication:** + The implementation for the process of a member leaving the group + due to an error has been standardized across components. This + ensures that the member carries out exactly the same actions and + issues the same error messages consistently, regardless of the + original reason for leaving the group. + (Bug #28866495, Bug #93027) +* For [`XA COMMIT`](/doc/refman/8.0/en/xa.html) + statements, invocation order of the plugins involved in + statement execution was nondeterministic, which could lead to + replication problems. Thanks to Dennis Gao for contributing a + fix. + (Bug #31082237, Bug #99051) +* The `keyring_aws` plugin was not included in + Commercial Docker RPM packages. + (Bug #30199423) +* When generating C source from SQL scripts, Some utf8-encoded + characters were split across lines. Thanks to Przemysław + Skibiński for the patch. + (Bug #30152555, Bug #96449) +* The `ARRAY` reserved word was listed as + unreserved in the `INFORMATION_SCHEMA.KEYWORDS` + table. + (Bug #30134275, Bug #96416) +* Some statements containing `||` produced a + parse error even with the + [`PIPES_AS_CONCAT`](/doc/refman/8.0/en/sql-mode.html#sqlmode_pipes_as_concat) SQL mode + enabled. + (Bug #30131161, Bug #96405) + + References: This issue is a regression of: Bug #29305022. +* [`LOAD DATA`](/doc/refman/8.0/en/load-data.html) statements incorrectly + ignored the + [`NO_AUTO_VALUE_ON_ZERO`](/doc/refman/8.0/en/sql-mode.html#sqlmode_no_auto_value_on_zero) SQL mode + if a `SET` clause was present. + (Bug #30126375) +* Automatic upgrades failed with a server exit if the + `thread_pool` plugin was enabled. + (Bug #30121742) +* When determining whether to recalculate a materialized derived + table for each execution, the uncacheability of the parent query + block was used instead of the rematerialize flag on the table + (currently only true for + [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table)). This could cause + unneeded rematerializations, especially when making queries + against non-merged views, leading to reduced performance. + (Bug #30110851) +* With an `IGNORE` clause, + [`LOAD DATA`](/doc/refman/8.0/en/load-data.html) should skip rows that + produced a `CHECK` constraint violation and + continue with the following rows, but it stopped with an error. + (Bug #30084966, Bug #96296) +* With [`sql_require_primary_key`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_require_primary_key) + enabled, clone plugin initialization failed because it created + two dynamic Performance Schema tables, which do not support + indexes or primary keys. The effect of + [`sql_require_primary_key`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_require_primary_key) is now + limited to storage engines that can participate in replication + (currently all storage engines except the Performance Schema) + (Bug #30083300, Bug #96281) +* Protobuf compilation failed on macOS. + (Bug #30079536, Bug #96263) +* For automatic upgrades, the `audit_log` plugin + was not reloaded, causing auditing to start in legacy mode. + (Bug #30068110) +* In order to remove duplicate rows, the weedout optimization + needs a unique identifier for each row, which is provided by the + storage engine by calling + `handler::position()`, but this function was + not always called at the correct time, or was sometimes called + when not needed. Issues regarding how and when to place such + calls were the source of many bugs in optimizations. This fix + moves the responsibility of calling + `handler::position()` to the iterators, whose + default implementations usually handle this task adequately on + their own. + (Bug #30060691) + + References: See also: Bug #29693294, Bug #30049217, Bug #30153695. +* The server could exit due to mishandling a + `COM_PROCESS_INFO` command. + (Bug #30032302) +* Warnings are normally generated when deprecated system variables + are assigned a value, but this did not occur when persisted + system variables were processed during server startup. + (Bug #30030648) +* With [`bind_address`](/doc/refman/8.0/en/server-system-variables.html#sysvar_bind_address) set to a + value containing multiple addresses, setting + [`host_cache_size=0`](/doc/refman/8.0/en/server-system-variables.html#sysvar_host_cache_size) caused a + server exit at client connect time. + (Bug #30018958) +* On Windows, Protobuf compilation failed for the Ninja build + type. + (Bug #30018894) +* [`SHOW PROCESSLIST`](/doc/refman/8.0/en/show-processlist.html) output could + include statements that had completed and were no longer in + process. + (Bug #29999818) +* A **mysqldump** error-message buffer was too + small, potentially leading to message truncation. + (Bug #29999782, Bug #96074) +* Last used auto-increment values instead of “next to be + used” auto-increment values were cached while importing + tables from MySQL 5.7 to MySQL 8.0 during an in-place upgrade, + which resulted in any tables read from the table cache after + upgrade having incorrect auto-increment values. + (Bug #29996434) +* When executing a prepared statement that used constant folding, + it was possible to register a location for rollback which was + not allocated on the `MEMROOT`, but rather on + the stack, and so was no longer in scope. + (Bug #29990693) + + References: See also: Bug #29939331. +* A warning about `ZEROFILL` being deprecated was + produced for `CREATE TABLE ... AS` and + `CREATE TABLE ... LIKE` statements that created + tables that contained a `YEAR` column. This + could be confusing because the `ZEROFILL` + attribute may only have been added implicitly to the + `YEAR` column. To avoid confusion, the warning + is no longer raised for such statements. + (Bug #29961060) +* A query using bitwise operators, such as in `WHERE + text_col < + (int_col & + int_col) AND + int_col = -1`, failed to + return any rows as expected. + (Bug #29957969) +* Malformed resource group names in optimizer hints could lead to + unexpected server behavior. + (Bug #29955732) +* [`EXPLAIN`](/doc/refman/8.0/en/explain.html), when using + `FORMAT=TREE`, did not show the same costs as + with `FORMAT=JSON`. In particular, when using + `FORMAT=TREE`, the cost calculated took into + account `eval_cost` for joins, but not for base + tables. + (Bug #29953579) +* For Solaris, `mysqld.cc` contained a + prototype for `memcntl()` that is no longer + needed. The prototype has been removed. + (Bug #29953495, Bug #95971) +* For Solaris, [`-DWITH_SSL=system`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_ssl) did + not work when compiling with GCC. + (Bug #29953460, Bug #95970) +* MySQL builds configured with `-DWITHOUT_SERVER=1` + failed. + (Bug #29948728, Bug #95740) +* The internal method `Field_tiny::pack()` did + not always perform bounds checking as expected. + (Bug #29948029) + + References: See also: Bug #31591391. +* Improper handling of plugin unloading could cause a server exit. + (Bug #29941948) +* The internal `MEM_ROOT` class did not handle + all out-of-memory errors correctly. + (Bug #29940846) +* [`JSON_SCHEMA_VALIDATION_REPORT()`](/doc/refman/8.0/en/json-validation-functions.html#function_json-schema-validation-report) + did not distinguish between a JSON document that did not + validate according to a JSON schema and a JSON document which + was too deeply nested, which resulted in wrong behavior in some + cases. + (Bug #29940833) +* Use of the + [`<=>`](/doc/refman/8.0/en/comparison-operators.html#operator_equal-to) + operator could yield incorrect results for comparisons involving + very large constants. + (Bug #29939331, Bug #95908) +* For the `keyring_aws` plugin, some valid region + values for the + [`keyring_aws_region`](/doc/refman/8.0/en/keyring-system-variables.html#sysvar_keyring_aws_region) system + variable were rejected. + (Bug #29933758) +* For debug builds, an assertion could be raised during + [`UNION`](/doc/refman/8.0/en/union.html) queries when computing the + combined data type of a `GEOMETRY` column and + `SELECT * FROM (SELECT NULL)`. + (Bug #29916900, Bug #95827) +* For columns defined with the `binary` character + set, [`SHOW CREATE TABLE`](/doc/refman/8.0/en/show-create-table.html) could + generate [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) statements + that produced a syntax error when executed. + (Bug #29909573, Bug #95801) +* Data dictionary APIs were added for fetching table names in a + schema that use a specific storage engine, and for fetching + table names in a schema that are created and hidden by the + storage engine. The former is required by NDB, and the latter is + required for [`DROP DATABASE`](/doc/refman/8.0/en/drop-database.html) + operations. + (Bug #29906844, Bug #95792) +* **mysqldump** leaked memory when run with the + [`--order-by-primary`](/doc/refman/8.0/en/mysqldump.html#option_mysqldump_order-by-primary) option. + (Bug #29906736) +* For queries involving functional indexes, + [`EXPLAIN + FORMAT=TREE`](/doc/refman/8.0/en/explain.html) printed the hidden column name instead of + the indexed expression. + (Bug #29904996) +* For debug builds, + [`CREATE + TABLE ... IGNORE SELECT ...`](/doc/refman/8.0/en/create-table-select.html) statements did not + properly clean up the table state when the last row to be + inserted was skipped due to a failed `CHECK` + constraint. This could cause the next statement using the table + to raise an assertion. + (Bug #29903865) +* MySQL did not handle execution of a recursive common table + expression (CTE) correctly when the termination condition of the + recursive query for this CTE had an `IN` + predicate using another recursive CTE. + (Bug #29899614) +* Deserialization of serialized dictionary information (SDI) + failed for a table with partitions residing in different + tablespace files. + (Bug #29898965) +* For authentication using an LDAP authentication plugin, if the + user DN portion was empty and group mapping was configured, + authentication assigned an incorrect user DN and skipped the + user search. + (Bug #29897624) +* Constraints defined without a name could in some cases cause a + server exit. + (Bug #29892876) +* An in-place upgrade from MySQL 5.7 to MySQL 8.0 failed due a + missing NDB tablespace. + (Bug #29889869, Bug #30113440) +* **mysqlpump** produced an error when run against + a server older than MySQL 5.7. + (Bug #29889253) +* When Boost was downloaded, **CMake** + configuration logic for determining the size of the downloaded + file was incorrect, and could remove that file after a + successful download operation. + (Bug #29881279) +* A possible integer overflow due to unsigned integer type casting + could lead to later buffer overflow due to arbitrary size memory + allocation. + (Bug #29878914) +* When the client character set was other than + `latin1`, the server converted the string + representation of a [`DECIMAL`](/doc/refman/8.0/en/fixed-point-types.html) value + from `latin1` to the client character set. This + conversion was not necessary, since all supported client + character sets encode numbers in the same way as + `latin1`, and so is no longer performed. + (Bug #29875672) +* The `vio_description()` debugging function was + called in nondebug builds. + (Bug #29871361) +* The fix for a previous issue in MySQL 8.0.3 changed a test for + whether an expression over constant + [`DATE`](/doc/refman/8.0/en/datetime.html) values could be cached from + allowing any expressions except global variables to a blanket + denial of all functions, regardless of whether they were over + constants or not, which significantly impacted performance of + related queries in which the optimizer needed to perform + conversion of a string to a `DATE` value. This + test has been reverted to its original form. + (Bug #29871018) + + References: This issue is a regression of: Bug #85471, Bug #28576018. +* The `INFORMATION_SCHEMA` can fetch dynamic + table statistics from storage engines, but this did not work for + partitioned tables. + (Bug #29870919, Bug #95641) +* Retrying a failed access-control statement could permit another + thread to acquire a lock on the access-control cache during a + window when metadata locks where released and reacquired, + resulting in a deadlock. The locks are now not released during + the retry operation. + (Bug #29870899, Bug #95612) +* An assertion could be raised if a user without the proper + privilege attempted to enable the + [`offline_mode`](/doc/refman/8.0/en/server-system-variables.html#sysvar_offline_mode) system variable. + (Bug #29849046) +* Fedora packaging configuration put debug information for + **mysql\_config\_editor** in the wrong package. + (Bug #29841342) +* Attempted use of a freed object during MeCab plugin + initialization caused a segmentation fault. + (Bug #29832534) +* The function used to generate entropy for random passwords could + sometimes not provide much entropy. + (Bug #29808492) +* With [`super_read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only) enabled, + the server could process [`DROP + TABLESPACE`](/doc/refman/8.0/en/drop-tablespace.html) improperly. + (Bug #29802833) +* The server did not handle a query with a left join containing a + materialized semijoin correctly. + (Bug #29800741) +* For MySQL installed using RPM packages, an initialization script + that tested server connectivity misbehaved if the client account + authenticated using an LDAP authentication plugin. + (Bug #29786782) +* Improper locking during storage engine initialization could + cause a server exit. + (Bug #29782379) +* On a GTID-enabled server, concurrent execution of + [`DROP USER`](/doc/refman/8.0/en/drop-user.html) and a prepared + statement that accessed a view could deadlock. + (Bug #29772622) +* When performing `EXPLAIN FORMAT=JSON` on a + query of the form `SELECT WHERE NOT EXISTS (SELECT FROM + (derived_table) WHERE + false_condition)` involving + an antijoin transformation, the subquery was eliminated but its + own subqueries were moved up instead of being eliminated along + with it. + (Bug #29759277) + + References: See also: Bug #30017509. +* An interrupted tablespace encryption operation caused a + discrepancy between data dictionary and storage engine metadata, + resulting in an assertion failure on a subsequent attempt to + access the tablespace. + (Bug #29756808) +* Simultaneous execution of the event scheduler and + [`DROP EVENT`](/doc/refman/8.0/en/drop-event.html) could result in lock + acquisition hanging until lock wait timeout. + (Bug #29742901, Bug #95223) +* `CHECK` constraints were not enforced when a + column took its default value from an expression. + (Bug #29706689, Bug #95192) +* When performing two sorts on the same table with no temporary + table, both sorts tried to use the same buffer, resulting in a + read out of bounds. This could occur when the same query used + both `DISTINCT` and `ORDER + BY`. + (Bug #29699759) +* When performing a weedout involving a sorted table, sorting was + not done by row IDs. + (Bug #29693294) +* VS2019 produced compilation errors with debug compilation + selected due to use of the `/ZI` flag. Now + `/Z7` is used instead. + (Bug #29691691, Bug #95125) +* In source distributions, these changes were made in relation to + the DBUG package, to clean up old and unmaintained code in the + `dbug` directory: + + + Moved `dbug.cc` to the + `mysys` directory, removed the + `dbug` library. + + Removed unused functions in `dbug.cc`. + + Removed the `DBUG_LEAVE` macro; no longer + needed. + + Wrapped the body of the `DBUG_LOG` macro in + `if _db_enabled_()`, to avoid formatting of + strings that likely will not be printed anyway. + + Removed the `dbug` directory. + + (Bug #29680868, Bug #95082) +* While allocating the reference item array, the count for any + window functions was not taken into consideration. As a result, + when expressions having window functions were split, the extra + space needed to store the new item references was not properly + allocated. + (Bug #29672621) +* Setting the collation of a user variable did not work correctly + in all cases. + (Bug #29665165) +* Processing of `WHERE` clauses in + [`SHOW`](/doc/refman/8.0/en/show.html) statements was not performed + consistently. + (Bug #29664758) +* If clauses to drop and add constraints were specified within the + same [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) statement, they + were executed in incorrect order. + (Bug #29652464) +* [`EXPLAIN`](/doc/refman/8.0/en/explain.html) now shows when a result + is being sorted by row ID. + (Bug #29634196) +* Unnecessary materialization is no longer performed in either of + the following cases: + + + When performing a sort at the end of a join, such as for + grouping, and the sorting does not make use of row IDs. + + When materializing a derived table which is not to be read + from more than once. + + (Bug #29634179) +* [`CAST(arg AS + FLOAT)`](/doc/refman/8.0/en/cast-functions.html#function_cast) did not returned the expected out-of-range + error when *`arg`* was too small to be + represented as a [`FLOAT`](/doc/refman/8.0/en/floating-point-types.html) value. + (Bug #29621333) +* Internal conversion of [`FLOAT`](/doc/refman/8.0/en/floating-point-types.html) + values sometimes occurred at the wrong time, which could lead to + excess precision in results. Consider the table created and + populated as shown here: + + ```None + CREATE TABLE t(f FLOAT); + INSERT INTO t VALUES (2.3); + ``` + + Prior to the fix, the query `SELECT f, IF(f > 0, f, + 0) FROM t` against this table returned `(2.3, + 2.299999952316284)` instead of `(2.3, + 2.3)` as expected. + (Bug #29621062) +* `log0meb.cc` failed to compile with some + build options. + (Bug #29616525) +* The client library could dereference a null pointer while + fetching result set metadata from the server. + (Bug #29597896, Bug #30689251) +* A runtime error could occur for interval value checks when + summing date and interval values. + (Bug #29587536) +* In builds with Undefined Behavior Sanitizer enabled, + multiplication with -9223372036854775808 could produce warnings + and incorrect results. + (Bug #29581610) +* During startup, the server attempted to write operations to the + binary log that should not have been logged. + (Bug #29557747, Bug #94835) +* A statement of the form `CREATE VIEW v1 AS SELECT * FROM + table WHERE + (constant IN (SELECT + constant) IS UNKNOWN)` led + to an assertion. + (Bug #29525304) + + References: This issue is a regression of: Bug #25466100. +* On EL6, if a FIPS-enabled OpenSSL library was not available, + attempting to enable FIPS mode could cause a server malfunction. + (Bug #29519794) +* [`SET + PERSIST_ONLY`](/doc/refman/8.0/en/set-variable.html) can be used to persist some system + variables that [`SET + PERSIST`](/doc/refman/8.0/en/set-variable.html) cannot (due to the way variable settings + occur). If such a variable is found in + `mysqld-auto.cnf` at startup, the server now + issues a warning and ignores the setting. + (Bug #29511118) +* The server did not properly aggregate a partial revoke and a + schema-level privilege in some cases. + (Bug #29484519) +* For debug builds, [`ENUM`](/doc/refman/8.0/en/enum.html) or + [`SET`](/doc/refman/8.0/en/set.html) columns defined with a + `DEFAULT` clause raised an assertion. + (Bug #29480711) +* MySQL Installer did not install OpenSSL DLL dependencies if the + Development component was not selected. + (Bug #29423421, Bug #94168, Bug #30199579, Bug #96573) +* In [`READ UNCOMMITTED`](/doc/refman/8.0/en/innodb-transaction-isolation-levels.html#isolevel_read-uncommitted) isolation + level, a segmentation fault occurred under heavy load from + **memcached** clients. An externally stored + `BLOB` column that was being updated by one + transaction was read by another transaction as having a NULL + value and a non-zero data length. + (Bug #29396364, Bug #93961) +* On systems with working IPv6 address resolution, IPv6 socket + creation failure at connect time resulted in a memory leak. + (Bug #29374606, Bug #94384) +* In replication scenarios, if multiple clients concurrently + executed [`XA COMMIT`](/doc/refman/8.0/en/xa.html) + or [`XA ROLLBACK`](/doc/refman/8.0/en/xa.html) + statements that used the same XID value, replication + inconsistency could occur. + (Bug #29293279, Bug #94130) +* Arguments for the [`TIMESTAMPADD()`](/doc/refman/8.0/en/date-and-time-functions.html#function_timestampadd) + function could be reversed for prepared statements. + (Bug #29268394) +* The `DEFAULT ROLE` option for + [`CREATE USER`](/doc/refman/8.0/en/create-user.html) statements was not + written to the binary log. + (Bug #28948915, Bug #93252) +* Starting the server from the command line with invalid memcached + plugin variable settings caused the server to exit. + (Bug #28575863) +* The `SET` clause for [`LOAD + DATA`](/doc/refman/8.0/en/load-data.html) did not work to set `GEOMETRY NOT + NULL` columns. + (Bug #28460369, Bug #91893) +* On Windows 8 and higher, the `keyring_aws` + plugin was not able to communicate with Amazon KMS servers. + (Bug #28377961) +* `INFORMATION_SCHEMA` tables and + [`SHOW COLUMNS`](/doc/refman/8.0/en/show-columns.html) could produce + incorrect view column types when a query on the view had + multiple query blocks combined with the + [`UNION`](/doc/refman/8.0/en/union.html) operator. + (Bug #28278220, Bug #91486) +* On Debian, long `InnoDB` recovery times at + startup could cause systemd service startup failure. The default + systemd service timeout is now disabled (consistent with RHEL) + to prevent this from happening. + (Bug #28246585, Bug #91423) +* With the `thread_pool` plugin enabled, the + [`sys.processlist`](/doc/refman/8.0/en/sys-processlist.html) and + [`sys.session`](/doc/refman/8.0/en/sys-session.html) views displayed a + thread name rather than the actual user name. + (Bug #25906021, Bug #85976) +* The `delete_latency` column in the + [`sys.schema_index_statistics`](/doc/refman/8.0/en/sys-schema-index-statistics.html) view + incorrectly referred to the `SUM_TIMER_INSERT` + column of the Performance Schema + [`table_io_waits_summary_by_index_usage`](/doc/refman/8.0/en/performance-schema-table-wait-summary-tables.html#performance-schema-table-io-waits-summary-by-index-usage-table) + table rather than the `SUM_TIMER_DELETE` + column. + (Bug #25521928) +* In output from the + [`sys.diagnostics()`](/doc/refman/8.0/en/sys-diagnostics.html) procedure, the + `latency` column for the + `user_summary_by_file_io_type` view was + incorrectly displayed in raw picoseconds rather than as a + formatted value. + (Bug #25287996) +* MySQL Enterprise Encryption functions could apply Diffie-Hellman (DH) methods to + non-DH keys, resulting in unpredictable results or server exit. + (Bug #22839007) +* Password masking was incomplete for [`SHOW + PROCESSLIST`](/doc/refman/8.0/en/show-processlist.html) and some + `INFORMATION_SCHEMA` and Performance Schema + tables. + (Bug #20712046) +* With strict SQL mode enabled, the + [`STR_TO_DATE()`](/doc/refman/8.0/en/date-and-time-functions.html#function_str-to-date) function did not + properly handle values with time parts only. Thanks to Daniel + Black for the contribution. + (Bug #18090591, Bug #71386) +* A query using [`GREATEST()`](/doc/refman/8.0/en/comparison-operators.html#function_greatest) in the + `WHERE` clause could, in certain cases, fail to + return a row where one was expected or raise a spurious error. + (Bug #96012, Bug #29963278) +* Explicitly setting + [`sort_buffer_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sort_buffer_size) to its maximum + value or close to it caused some queries to fail with an out of + memory error. + (Bug #95969, Bug #29952775) + + References: See also: Bug #22594514. +* Late `NULL` filtering, to avoid index lookups + if the lookup key contains at least one `NULL`, + was not performed for backwards index scans, although it was for + forward index scans. + (Bug #95967, Bug #29954680) +* Using a function such as [`IFNULL()`](/doc/refman/8.0/en/flow-control-functions.html#function_ifnull) + or [`ABS()`](/doc/refman/8.0/en/mathematical-functions.html#function_abs) in a functional index + led to the error Value is out of range for functional + index... when an `UNSIGNED` column + used as an argument to such a function contained a value + exceeding that of the corresponding signed integer type. + (Bug #95881, Bug #29934661) +* The resolution procedure for the + [`IFNULL()`](/doc/refman/8.0/en/flow-control-functions.html#function_ifnull) function differed from + that for all other functions derived from + [`CASE`](/doc/refman/8.0/en/flow-control-functions.html#operator_case) operations, including + [`COALESCE()`](/doc/refman/8.0/en/comparison-operators.html#function_coalesce), which caused + incorrect length information to be generated for certain numeric + expressions. + (Bug #94614, Bug #29463760) +* Queries using `UNION ALL ... LIMIT 1` evaluated + an excessive number of rows as shown by + [`Handler_read_key`](/doc/refman/8.0/en/server-status-variables.html#statvar_Handler_read_key) and + [`Handler_read_next`](/doc/refman/8.0/en/server-status-variables.html#statvar_Handler_read_next). + (Bug #79340, Bug #22292995) + + References: See also: Bug #79040, Bug #22158368, Bug #92994, Bug #28866942. +* The + [`-DWITH_EXAMPLE_STORAGE_ENGINE=1`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_storage_engine_options) + **CMake** option was ignored but should not have + been. If `-DWITH_EXAMPLE_STORAGE_ENGINE=0` is + given, the [`EXAMPLE`](/doc/refman/8.0/en/example-storage-engine.html) storage engine + is built as a plugin. + (Bug #70859, Bug #17772560, Bug #30133062) + + References: See also: Bug #18324650. diff --git a/corpus/changelog/mysql_releases/mysql_8019.md b/corpus/changelog/mysql_releases/mysql_8019.md new file mode 100644 index 0000000000000000000000000000000000000000..3b53e0ed79f7f2c619781d375007da396ed6285e --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8019.md @@ -0,0 +1,2104 @@ +# MySQL 8.0.19 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-19.html +Version: 8.0.19 + +## Changes in MySQL 8.0.19 (2020-01-13, General Availability) + +For general information about upgrades, downgrades, platform support, etc., please visit [https://dev.mysql.com/doc/relnotes/mysql/8.0/en/](/doc/relnotes/mysql/8.0/en/). + +Important + +There is an issue for MySQL 8.0.19 installed using MySQL Installer that +prevents the server from starting if MySQL Enterprise Firewall is selected during +the server configuration steps. If the server startup +operation fails, click Cancel to end +the configuration process and return to the dashboard. You +must uninstall the server. + +The workaround is to run MySQL Installer *without* +MySQL Enterprise Firewall selected. Then install MySQL Enterprise Firewall afterward using the +instructions for manual installation (see +[Installing or Uninstalling MySQL Enterprise Firewall](/doc/refman/8.0/en/firewall-installation.html)). This problem is +corrected in MySQL 8.0.20. + +* [Account Management Notes](news-8-0-19.html#mysqld-8-0-19-account-management "Account Management Notes") +* [Audit Log Notes](news-8-0-19.html#mysqld-8-0-19-audit-log "Audit Log Notes") +* [Compilation Notes](news-8-0-19.html#mysqld-8-0-19-compiling "Compilation Notes") +* [Configuration Notes](news-8-0-19.html#mysqld-8-0-19-configuration "Configuration Notes") +* [Deprecation and Removal Notes](news-8-0-19.html#mysqld-8-0-19-deprecation-removal "Deprecation and Removal Notes") +* [Error Handling](news-8-0-19.html#mysqld-8-0-19-errors "Error Handling") +* [SQL Function and Operator Notes](news-8-0-19.html#mysqld-8-0-19-functions-operators "SQL Function and Operator Notes") +* [INFORMATION\_SCHEMA Notes](news-8-0-19.html#mysqld-8-0-19-information-schema "INFORMATION_SCHEMA Notes") +* [Keyring Notes](news-8-0-19.html#mysqld-8-0-19-keyring "Keyring Notes") +* [Logging Notes](news-8-0-19.html#mysqld-8-0-19-logging "Logging Notes") +* [Packaging Notes](news-8-0-19.html#mysqld-8-0-19-packaging "Packaging Notes") +* [SQL Syntax Notes](news-8-0-19.html#mysqld-8-0-19-sql-syntax "SQL Syntax Notes") +* [sys Schema Notes](news-8-0-19.html#mysqld-8-0-19-sys-schema "sys Schema Notes") +* [Thread Pool Notes](news-8-0-19.html#mysqld-8-0-19-thread-pool "Thread Pool Notes") +* [X Plugin Notes](news-8-0-19.html#mysqld-8-0-19-xplugin "X Plugin Notes") +* [Functionality Added or Changed](news-8-0-19.html#mysqld-8-0-19-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-19.html#mysqld-8-0-19-bug "Bugs Fixed") + +### Account Management Notes + +* MySQL now enables administrators to configure user accounts such + that too many consecutive login failures due to incorrect + passwords cause temporary account locking. The required number + of failures and the lock time are configurable per account, + using the `FAILED_LOGIN_ATTEMPTS` and + `PASSWORD_LOCK_TIME` options of the + [`CREATE USER`](/doc/refman/8.0/en/create-user.html) and + [`ALTER USER`](/doc/refman/8.0/en/alter-user.html) statements. See + [Password Management](/doc/refman/8.0/en/password-management.html). + (Bug #27733694, Bug #90169, WL #13515) + +### Audit Log Notes + +* [`ANALYZE TABLE`](/doc/refman/8.0/en/analyze-table.html) statements now + produce `read` audit events. + (Bug #29625461) +* Audit log connect events now include any connection attributes + passed by the client. Connection attribute logging is supported + for new-style XML log file format and JSON format, but not + old-style XML format. See + [Audit Log File Formats](/doc/refman/8.0/en/audit-log-file-formats.html). + (WL #11378) + +### Compilation Notes + +* **Microsoft Windows:** + On Windows, the minimum version of **CMake** for + builds from the command line is now 3.15. + (Bug #30332632, Bug #96954) +* [`-DMYSQL_MAINTAINER_MODE`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_mysql_maintainer_mode) now + includes `-Wshadow=local` for GCC and + `-Wshadow-uncaptured-local` for Clang. + (Bug #30099556) + +### Configuration Notes + +* New [`FPROFILE_GENERATE`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_fprofile_generate) and + [`FPROFILE_USE`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_fprofile_use) + **CMake** options are available for experimenting + with profile guided optimization (PGO) with GCC. See the + `cmake/fprofile.cmake` in a MySQL source + distribution for information about using them. These options + have been tested with GCC 8 and 9, and with Clang. + + Enabling [`FPROFILE_USE`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_fprofile_use) also enables + [`WITH_LTO`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_lto) (link time optimization). + (Bug #30089834, Bug #96314, Bug #30133324, Bug #96410, Bug #30164113, Bug #96486) +* [`Innodb_system_rows_read`](/doc/refman/8.0/en/server-status-variables.html#statvar_Innodb_system_rows_read), + [`Innodb_system_rows_inserted`](/doc/refman/8.0/en/server-status-variables.html#statvar_Innodb_system_rows_inserted), + [`Innodb_system_rows_deleted`](/doc/refman/8.0/en/server-status-variables.html#statvar_Innodb_system_rows_deleted) + status variables were added for counting row operations on + `InnoDB` tables that belong to system-created + schemas. The new status variables are similar to the existing + [`Innodb_rows_read`](/doc/refman/8.0/en/server-status-variables.html#statvar_Innodb_rows_read), + [`Innodb_rows_inserted`](/doc/refman/8.0/en/server-status-variables.html#statvar_Innodb_rows_inserted), + [`Innodb_rows_deleted`](/doc/refman/8.0/en/server-status-variables.html#statvar_Innodb_rows_deleted) status + variables, which count operations on `InnoDB` + tables that belong to both user-created and system-created + schemas. + + The new status variables are useful in replication environments + where [`relay_log_info_repository`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_relay_log_info_repository) + and [`master_info_repository`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_master_info_repository) + variables are set to `TABLE`, resulting in + higher row operation counts on slaves due to operations + performed on the `slave_master_info`, + `slave_replay_log_info`, and + `slave_worker_info` tables, which belong to the + system-created `mysql` schema. For a valid + comparison of master and slave row operation counts, operations + on tables in system-created schemas can now be excluded using + the count data provided by the new status variables. + + Thanks to Facebook for the contribution. + (Bug #27724674, Bug #90148) + +### Deprecation and Removal Notes + +* The `thread_pool` plugin used display widths in + definitions for integer columns of Performance Schema tables. + This resulted in warnings written to the error log because + integer column display widths are now deprecated. + (Bug #30597673) +* Display width specification for integer data types was + deprecated in MySQL 8.0.17, and now statements that include data + type definitions in their output no longer show the display + width for integer types, with these exceptions: + + + The type is `TINYINT(1)`. MySQL Connectors + make the assumption that `TINYINT(1)` + columns originated as `BOOLEAN` columns; + this exception enables them to continue to make that + assumption. + + The type includes the `ZEROFILL` attribute. + + This change applies to tables, views, and stored routines, and + affects the output from `SHOW CREATE` and + `DESCRIBE` statements, and from + `INFORMATION_SCHEMA` tables. + + For `DESCRIBE` statements and + `INFORMATION_SCHEMA` queries, output is + unaffected for objects created in previous MySQL 8.0 versions + because information already stored in the data dictionary + remains unchanged. This exception does not apply for upgrades + from MySQL 5.7 to 8.0, for which all data dictionary information + is re-created such that data type definitions do not include + display width. + (Bug #30556657, Bug #97680, WL #13528) +* Setting the [`hash_join`](/doc/refman/8.0/en/switchable-optimizations.html#optflag_hash-join) + optimizer switch (see + [`optimizer_switch`](/doc/refman/8.0/en/server-system-variables.html#sysvar_optimizer_switch) system + variable) no longer has any effect. The same applies with + respect to the [`HASH_JOIN`](/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-table-level) and + `NO_HASH_JOIN` optimizer hints. Both the + optimizer switch and the optimizer hint are now deprecated, and + subject to removal in a future release of MySQL. + + This also fixes an issue whereby + [`SELECT DISTINCT ... WITH + ROLLUP`](/doc/refman/8.0/en/select.html) did not always return all distinct rows. + (Bug #27549694, Bug #30471809) +* In MySQL 5.7.14, the `mysqlx` namespace + parameter was introduced for X Protocol's + `StmtExecute` request, replacing the + `xplugin` parameter, which was therefore + deprecated. X Plugin continued to support the deprecated + `xplugin` namespace for backward compatibility. + In MySQL 8.0.19, the `xplugin` namespace has + now been removed. If the `xplugin` namespace is + used from this release on, an error message is returned as for + an unknown namespace. X Plugin's + `Mysqlx_stmt_execute_xplugin` status variable, + which counted the number of `StmtExecute` + requests received for the `xplugin` namespace, + is no longer used from MySQL 8.0.19. + (WL #13057) +* Support for the `YEAR(2)` data type was removed + in MySQL 5.7.5, leaving only `YEAR` and + `YEAR(4)` as valid specifications for + year-valued data. Because `YEAR` and + `YEAR(4)` are semantically identical, + specifying a display width is unnecessary, so + `YEAR(4)` is now deprecated and support for it + will be removed in a future MySQL version. Statements that + include data type definitions in their output no longer show the + display width for `YEAR`. This change applies + to tables, views, and stored routines, and affects the output + from `SHOW CREATE` and + `DESCRIBE` statements, and from + `INFORMATION_SCHEMA` tables. + + For `DESCRIBE` statements and + `INFORMATION_SCHEMA` queries, output is + unaffected for objects created in previous MySQL 8.0 versions + because information already stored in the data dictionary + remains unchanged. This exception does not apply for upgrades + from MySQL 5.7 to 8.0, for which all data dictionary information + is re-created such that data type definitions do not include + display width. + + The (undocumented) `UNSIGNED` attribute for + `YEAR` is also now deprecated and support for + it will be removed in a future MySQL version. + (WL #13537) + +### Error Handling + +* Error messages regarding crash recovery for XA were revised to + indicate XA context to distinguish them from non-XA crash + recovery messages. + (Bug #30578290, Bug #97743) +* Previously, the server returned this error message for attempts + to use [`LOAD DATA + LOCAL`](/doc/refman/8.0/en/load-data.html) with `LOCAL` capability + disabled: The used command is not allowed with this + MySQL version. This was misleading because the error + condition is not related to the MySQL version. The server now + returns an error code of + [`ER_CLIENT_LOCAL_FILES_DISABLED`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_client_local_files_disabled) + and this message: Loading local data is disabled; + this must be enabled on both the client and server + side. + (Bug #30375698, Bug #29377985, Bug #94396) + +### SQL Function and Operator Notes + +* Previously, loadable functions took no account of the character + set or collation of string arguments or return values. In + effect, string arguments and return values were treated as + binary strings, with the implication that only string arguments + containing single-byte characters could be handled reliably. + + Loadable function behavior is still the same by default, but the + interface for writing loadable functions has been extended to + enable them to determine the character set and collation of + string arguments, and to return strings that have a particular + character set and collation. These capabilities are optional for + loadable function writers, who may take advantage of them as + desired. See + [Loadable Function Character Set Handling](/doc/extending-mysql/8.0/en/adding-loadable-function.html#loadable-function-charset-handling) + + Of the loadable functions distributed with MySQL, those + associated with the following features and extensions have been + modified to take advantage of the new capabilities: MySQL Enterprise Audit, + MySQL Enterprise Firewall, MySQL Enterprise Data Masking and De-Identification, MySQL Keyring (the general-purpose keyring + functions only), and Group Replication. The modification applies + only where it make sense. For example, a function that returns + encrypted data is *intended* to return a + binary string, not a character string. + + Character-set capabilities for loadable functions are + implemented using the `mysql_udf_metadata` + component service. For information about this service, see the + MySQL Server Doxygen documentation, available at + https://dev.mysql.com/doc/index-other.html (search for + `s_mysql_mysql_udf_metadata` and + `udf_metadata_imp`). Source code for the MySQL + Keyring functions is available in Community source distributions + and may be examined as examples for third-party loadable + function writers who wish to modify their own functions to be + character set-aware. + (WL #12370) + +### INFORMATION\_SCHEMA Notes + +* The `INFORMATION_SCHEMA` contains several new + tables that expose role information: + + + `ADMINISTRABLE_ROLE_AUTHORIZATIONS`: Roles + the current user can grant; see + [The INFORMATION\_SCHEMA ADMINISTRABLE\_ROLE\_AUTHORIZATIONS Table](/doc/refman/8.0/en/information-schema-administrable-role-authorizations-table.html). + + `APPLICABLE_ROLES`: Roles applicable for + the current user; see + [The INFORMATION\_SCHEMA APPLICABLE\_ROLES Table](/doc/refman/8.0/en/information-schema-applicable-roles-table.html). + + `ENABLED_ROLES`: Roles enabled within the + current session; see + [The INFORMATION\_SCHEMA ENABLED\_ROLES Table](/doc/refman/8.0/en/information-schema-enabled-roles-table.html). + + `ROLE_COLUMN_GRANTS`: Column privileges for + roles for the current user; see + [The INFORMATION\_SCHEMA ROLE\_COLUMN\_GRANTS Table](/doc/refman/8.0/en/information-schema-role-column-grants-table.html). + + `ROLE_ROUTINE_GRANTS`: Routine privileges + for roles for the current user; see + [The INFORMATION\_SCHEMA ROLE\_ROUTINE\_GRANTS Table](/doc/refman/8.0/en/information-schema-role-routine-grants-table.html). + + `ROLE_TABLE_GRANTS`: Table privileges for + roles for the current user; see + [The INFORMATION\_SCHEMA ROLE\_TABLE\_GRANTS Table](/doc/refman/8.0/en/information-schema-role-table-grants-table.html). + + (WL #10895) + +### Keyring Notes + +* A new `SECRET` key type is available that is + intended for general-purpose storage of sensitive data using the + MySQL keyring. The keyring encrypts and decrypts + `SECRET` data as a byte stream upon storage and + retrieval. The `SECRET` key type is supported + by all keyring plugins. See [Supported Keyring Key Types and Lengths](/doc/refman/8.0/en/keyring-key-types.html). + (WL #12859) + +### Logging Notes + +* The `SIGUSR1` signal now causes the server to + flush the error log, general query log, and slow query log. One + use for `SIGUSR1` is to implement log rotation + without having to connect to the server (which to flush logs + requires an account that has the + [`RELOAD`](/doc/refman/8.0/en/privileges-provided.html#priv_reload) privilege). The server + response to `SIGUSR1` is a subset of the + response to `SIGHUP`, enabling + `SIGUSR1` to be used as a more + “lightweight” signal that flushes certain logs + without the other `SIGHUP` effects such as + flushing the thread and host caches and writing a status report + to the error log. See [Unix Signal Handling in MySQL](/doc/refman/8.0/en/unix-signal-response.html). + (WL #13689) + +### Packaging Notes + +* Binary packages that include `curl` rather than + linking to the system `curl` library have been + upgraded to use `curl` 7.66.0. + (Bug #30356844) +* The `zstd` library bundled with MySQL has been + upgraded from version 1.3.3 to 1.4.3. MySQL uses the + `zstd` library to support connection + compression. + (Bug #30236685) +* For package types for which OpenSSL shared libraries are + included, they are now also included under + `lib/private` if the package has + private-to-MySQL libraries located there that need OpenSSL. + (Bug #29966296) + +### SQL Syntax Notes + +* **Important Change:** + MySQL now supports explicit table clauses and table value + constructors according to the SQL standard. These have now been + implemented, respectively, as the + [`TABLE`](/doc/refman/8.0/en/table.html) statement and the + [`VALUES`](/doc/refman/8.0/en/values.html) statement, each described + in brief here: + + + `TABLE + table_name` is + equivalent to `SELECT * FROM + table_name`, and can be + used anywhere that the equivalent + [`SELECT`](/doc/refman/8.0/en/select.html) statement would be + accepted; this includes joins, unions, + [`INSERT ... + SELECT`](/doc/refman/8.0/en/insert-select.html) statements, + [`REPLACE`](/doc/refman/8.0/en/replace.html) statements, + [`CREATE + TABLE ... SELECT`](/doc/refman/8.0/en/create-table-select.html) statements, and subqueries. + + You can use `ORDER BY` with + `TABLE`, which also supports + `LIMIT` with optional + `OFFSET`; these clauses function in the + same way in a `TABLE` statement as they do + with `SELECT`. The following two statements + produce the same result: + + ```None + TABLE t ORDER BY c LIMIT 10 OFFSET 3; + + SELECT * FROM t ORDER BY c LIMIT 10 OFFSET 3; + ``` + + [`VALUES`](/doc/refman/8.0/en/values.html) consists of the + `VALUES` keyword followed by a series of + row constructors (`ROW()`), separated by + commas. It can be used to supply row values in an + SQL-compliant fashion to an + [`INSERT`](/doc/refman/8.0/en/insert.html) statement or + [`REPLACE`](/doc/refman/8.0/en/replace.html) statement. For + example, the following two statements are equivalent: + + ```None + INSERT INTO t1 VALUES ROW(1,2,3), ROW(4,5,6), ROW(7,8,9); + + INSERT INTO t1 VALUES (1,2,3), (4,5,6), (7,8,9); + ``` + + You can also select from a + [`VALUES`](/doc/refman/8.0/en/values.html) table value + constructor just as you would a table, bearing in mind that + you must supply a table alias when doing so. Using column + aliases, you can also select individual columns, like this: + + ```None + mysql> SELECT a,c FROM (VALUES ROW(1,2,3), ROW(4,5,6)) AS t(a,b,c); + +---+---+ + | a | c | + +---+---+ + | 1 | 3 | + | 4 | 6 | + +---+---+ + ``` + + You can employ such [`SELECT`](/doc/refman/8.0/en/select.html) + statements in joins, unions, subqueries, and other + constructs in which you normally expect to be able to use + such statements. + + For more information and examples, see [TABLE Statement](/doc/refman/8.0/en/table.html), + and [VALUES Statement](/doc/refman/8.0/en/values.html), as well as + [INSERT ... SELECT Statement](/doc/refman/8.0/en/insert-select.html), + [CREATE TABLE ... SELECT Statement](/doc/refman/8.0/en/create-table-select.html), [JOIN Clause](/doc/refman/8.0/en/join.html), + [UNION Clause](/doc/refman/8.0/en/union.html), and [Subqueries](/doc/refman/8.0/en/subqueries.html). + (Bug #77639, WL #10358) +* Previously, it was not possible to use `LIMIT` + in the recursive [`SELECT`](/doc/refman/8.0/en/select.html) part of a + recursive common table expression (CTE). + `LIMIT` is now supported in such cases, along + with an optional `OFFSET` clause. An example of + such a recursive CTE is shown here: + + ```None + WITH RECURSIVE cte AS ( + SELECT CAST("x" AS CHAR(100)) AS a FROM DUAL + UNION ALL + SELECT CONCAT("x",cte.a) FROM cte + WHERE LENGTH(cte.a) < 10 + LIMIT 3 OFFSET 2 + ) + SELECT * FROM cte; + ``` + + This statement produces the following output in the + **mysql** client: + + ```None + +-------+ + | a | + +-------+ + | xxx | + | xxxx | + | xxxxx | + +-------+ + ``` + + Specifying `LIMIT` in this fashion can make + execution of the CTE more efficient than doing so in the + outermost `SELECT`, since only the requested + number of rows is generated. + + For more information, see + [Recursive Common Table Expressions](/doc/refman/8.0/en/with.html#common-table-expressions-recursive). + (Bug #92857, Bug #28816906, WL #12534) +* When `CHECK` constraints were implemented in + MySQL 8.0.16, `ALTER TABLE` supported + `DROP CHECK` and `ALTER CHECK` + syntax as MySQL extensions to standard SQL for modifying check + constraints, but did not support the more general (and SQL + standard) `DROP CONSTRAINT` and `ALTER + CONSTRAINT` syntax for modifying existing constraints + of any type. That syntax is now supported; the constraint type + is determined from the constraint name. + (WL #12787) +* MySQL now supports aliases in the `VALUES` and + `SET` clauses of + [`INSERT INTO + ... ON DUPLICATE KEY UPDATE`](/doc/refman/8.0/en/insert-on-duplicate.html) statement for the row to + be inserted and its columns. Consider a statement such as this + one: + + ```None + INSERT INTO t + VALUES (9,5), (7,7), (11,-1) + ON DUPLICATE KEY UPDATE a = a + VALUES(a) - VALUES(b); + ``` + + Using the alias `new` for the inserted row, you + can now rewrite the statement, referring back to the row alias + in the `ON DUPLICATE KEY UPDATE` clause, like + this: + + ```None + INSERT INTO t + VALUES (9,5), (7,7), (11,-1) AS new + ON DUPLICATE KEY UPDATE a = a + new.a - new.b; + ``` + + Using the same row alias, and, additionally, the column aliases + `m` and `n` for the columns of + the inserted row, you can omit the row alias and use only the + column aliases, as shown here: + + ```None + INSERT INTO t + VALUES (9,5), (7,7), (11,-1) AS new(m,n) + ON DUPLICATE KEY UPDATE a = a + m - n; + ``` + + The row alias must be distinct from the table name; column + aliases must be distinct from one another. + + See [INSERT ... ON DUPLICATE KEY UPDATE Statement](/doc/refman/8.0/en/insert-on-duplicate.html), for more information + and examples. + (WL #6312) + +### sys Schema Notes + +* `sys` schema objects have been reimplemented + not to invoke the deprecated + [`sys.format_bytes()`](/doc/refman/8.0/en/sys-format-bytes.html), + [`sys.format_time()`](/doc/refman/8.0/en/sys-format-time.html), and + [`sys.ps_thread_id()`](/doc/refman/8.0/en/sys-ps-thread-id.html) stored + functions. Instead, they invoke the equivalent built-in SQL + functions implemented in MySQL 8.0.16 that format or retrieve + Performance Schema data (see [Changes in MySQL 8.0.16 (2019-04-25, General Availability)](news-8-0-16.html "Changes in MySQL 8.0.16 (2019-04-25, General Availability)")). + + [`sys.format_bytes()`](/doc/refman/8.0/en/sys-format-bytes.html), + [`sys.format_time()`](/doc/refman/8.0/en/sys-format-time.html), and + [`sys.ps_thread_id()`](/doc/refman/8.0/en/sys-ps-thread-id.html) will be removed + in a future MySQL version, so applications that use them should + be adjusted to use the built-in functions instead, keeping in + mind some minor differences between the `sys` + functions and the built-in functions. See + [Performance Schema Functions](/doc/refman/8.0/en/performance-schema-functions.html). + (WL #13439) + +### Thread Pool Notes + +* By default, the thread pool plugin tries to ensure a maximum of + one thread executing in each group at any time. The default + algorithm takes stalled threads into account and may temporarily + permit more active threads. The plugin now implements a new + [`thread_pool_max_active_query_threads`](/doc/refman/8.0/en/server-system-variables.html#sysvar_thread_pool_max_active_query_threads) + system variable for controlling number of active threads per + group. If + [`thread_pool_max_active_query_threads`](/doc/refman/8.0/en/server-system-variables.html#sysvar_thread_pool_max_active_query_threads) + is 0, the default algorithm applies. If + [`thread_pool_max_active_query_threads`](/doc/refman/8.0/en/server-system-variables.html#sysvar_thread_pool_max_active_query_threads) + is greater than 0, it places a limit on the number of active + threads per group. See [Thread Pool Operation](/doc/refman/8.0/en/thread-pool-operation.html). + (WL #12915) + +### X Plugin Notes + +* X Plugin could not be compiled on Debian with GCC 9. The + `--no-as-needed` linker option was added to + provide a workaround for the issue. + (Bug #30445201) +* Using X Protocol to query the Information Schema table + `TRIGGERS` could result in errors being + returned or some rows not being returned. + (Bug #30318917) + +### Functionality Added or Changed + +* **Group Replication:** + Replication connections to a replication slave, and Group + Replication connections for distributed recovery, now have full + client side configuration options for the TLSv1.3 protocol. In + MySQL releases where TLSv1.3 support was available but these + configuration options were not available, if TLSv1.3 was used + for these connection types, the client in the connection (the + replication slave or the joining Group Replication member that + initiated distributed recovery) could not be configured. This + meant that the server in the connection (the replication master + or the Group Replication existing member that was the donor for + distributed recovery) had to permit the use of at least one + TLSv1.3 ciphersuite that is enabled by default. From MySQL + 8.0.19, you can use the configuration options to specify any + selection of ciphersuites for these connections, including only + non-default ciphersuites if you want. + + The new configuration options are as follows: + + + Group Replication system variables + [`group_replication_recovery_tls_version`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_recovery_tls_version) + and + [`group_replication_recovery_tls_ciphersuites`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_recovery_tls_ciphersuites). + [`group_replication_recovery_tls_version`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_recovery_tls_version) + specifies a list of permitted TLS protocols for connection + encryption for the client instance (the joining member) in + the distributed recovery connection. + [`group_replication_recovery_tls_ciphersuites`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_recovery_tls_ciphersuites) + specifies a list of permitted ciphersuites when TLSv1.3 is + used for that connection. + + A `MASTER_TLS_CIPHERSUITES` option on the + [`CHANGE MASTER TO`](/doc/refman/8.0/en/change-master-to.html) command, to + specify a list of TLSv1.3 ciphersuites permitted by the + replication slave for the connection to the replication + master. (The [`CHANGE MASTER TO`](/doc/refman/8.0/en/change-master-to.html) + command already had a `MASTER_TLS_VERSION` + option to specify the permitted TLS protocol versions for + the connection.) + + (Bug #29960735, WL #13392) +* **Group Replication:** + The Group Replication plugin interacts with MySQL Server using + internal sessions to perform SQL API operations. Previously, + these sessions counted towards the client connections limit + specified by the + [`max_connections`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_connections) server system + variable. If the server had reached this limit when Group + Replication was started or attempted to perform an operation, + the operation was unsuccessful and Group Replication or the + server itself might stop. From MySQL 8.0.19, Group Replication + interactions with MySQL Server use a new component service that + handles the internal sessions separately, which means that they + do not count towards the + [`max_connections`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_connections) limit and are + not refused if the server has reached this limit. + (Bug #29635001, WL #13378) +* **Microsoft Windows:** + Previously, the `system` + (`\!`) command for the **mysql** + command-line client worked only for Unix systems. It now works + on Windows as well. For example, `system cls` + or `\! cls` may be used to clear the screen. + (Bug #11765690, Bug #58680, WL #13391) +* **JSON:** + When using [`JSON_SCHEMA_VALID()`](/doc/refman/8.0/en/json-validation-functions.html#function_json-schema-valid) to + specify a `CHECK` constraint on a table + containing one or more JSON columns and experiencing a + validation failure, MySQL now provides detailed information + about the reasons for such failures. A new error + [`ER_JSON_SCHEMA_VALIDATION_ERROR_WITH_DETAILED_REPORT`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_json_schema_validation_error_with_detailed_report) + is implemented containing this information, which can be viewed + in the **mysql** client by issuing + [`SHOW WARNINGS`](/doc/refman/8.0/en/show-warnings.html) when an + [`INSERT`](/doc/refman/8.0/en/insert.html) statement is rejected by + the server. + + For more information and examples, see + [JSON\_SCHEMA\_VALID() and CHECK constraints](/doc/refman/8.0/en/json-validation-functions.html#json-validation-functions-constraints). For + more general information, see also + [CHECK Constraints](/doc/refman/8.0/en/create-table-check-constraints.html). + (WL #13195) +* Debian packages now contain more general systemd support that + better supports manual **mysqld** execution. + (Bug #29702050, Bug #95163) +* Duplicate key error information was extended to include the + table name of the key. Previously, duplicate key error + information included only the key value and key name. Thanks to + Facebook for the contribution. + (Bug #28686224, Bug #925308, WL #12589) +* When the **mysql** client operates in interactive + mode, the [`--binary-as-hex`](/doc/refman/8.0/en/mysql-command-options.html#option_mysql_binary-as-hex) option + now is enabled by default. In addition, output from the + `status` (or `\s`) command + includes this line when the option is enabled implicitly or + explicitly: + + ```None + Binary data as: Hexadecimal + ``` + + To disable hexadecimal notation, use + [`--skip-binary-as-hex`](/doc/refman/8.0/en/mysql-command-options.html#option_mysql_binary-as-hex) + (Bug #24432545, WL #13038) +* MySQL now supports datetime literals with time zone offsets, + such as `'2019-12-11 10:40:30-05:00'`, + `'2003-04-14 03:30:00+10:00'`, and + `'2020-01-01 15:35:45+05:30'`; these offsets + are respected but not stored when inserting such values into + [`TIMESTAMP`](/doc/refman/8.0/en/datetime.html) and + [`DATETIME`](/doc/refman/8.0/en/datetime.html) columns; that is, + offsets are not displayed when retrieving the values. + + The supported range for a timezone offset is + `-13:59` to `+14:00`, + inclusive. Time zone names such as `'CET'` or + `'America/Argentina/Buenos_Aires'`, including + the special value `'SYSTEM'`, are not supported + in datetime literals. In addition, in this context, a leading + zero is required for an hour value less than 10, and MySQL + rejects the offset `'-00:00'` as invalid. + + Datetime literals with time zone offsets can also be used as + parameter values in prepared statements. + + As part of this work, the allowed range of numeric values for + the [`time_zone`](/doc/refman/8.0/en/server-system-variables.html#sysvar_time_zone) system variable + has been changed, so that it is now also + `-13:59` to `+14:00`, + inclusive. + + For additional information and examples, see + [The DATE, DATETIME, and TIMESTAMP Types](/doc/refman/8.0/en/datetime.html), and + [MySQL Server Time Zone Support](/doc/refman/8.0/en/time-zone-support.html). + (Bug #83852, Bug #25108148, WL #10828) +* From MySQL 8.0.19, compression is supported for messages sent + over X Protocol connections. Connections can be compressed if + the server and the client agree on a compression algorithm to + use. By default, X Protocol announces support for the + `deflate`, `lz4`, and + `zstd` compression algorithms. You can disallow + any of these algorithms by setting the new + `mysqlx_compression_algorithms` system variable + to include only the ones you permit. X Protocol always allows + uncompressed connections if the client does not request + compression during capability negotiation. Note that + X Protocol's list of permitted compression algorithms operates + independently of the list of compression algorithms announced by + MySQL Server, and X Protocol does not fall back to using MySQL + Server's compression settings. You can monitor the effects of + message compression for X Protocol using new X Plugin status + variables. + (WL #9252, WL #13442) +* For multithreaded slaves (replication slaves on which + [`slave_parallel_workers`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_parallel_workers) is set + to a value greater than 0), setting + [`slave_preserve_commit_order=1`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_preserve_commit_order) + ensures that transactions are executed and committed on the + slave in the same order as they appear in the slave's relay log, + preserving the same transaction history on the slave as on the + master. Previously, this setting required binary logging and + slave update logging to be enabled on the slave, with the + associated execution costs and disk space requirements. Now, + [`slave_preserve_commit_order=1`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_preserve_commit_order) + can be set on a slave with no binary log and no slave update + logging. This enables you to preserve commit order on the slave, + and avoid gaps in the sequence of transactions, without the + overhead of binary logging. + + A limitation to preserving the commit order on the slave can + occur if statement-based replication is in use, and both + transactional and non-transactional storage engines participate + in a non-XA transaction that is rolled back on the master. + Normally, non-XA transactions that are rolled back on the master + are not replicated to the slave, but in this particular + situation, the transaction might be replicated to the slave. If + this does happen, a multithreaded slave without binary logging + does not handle the transaction rollback, so the commit order on + the slave diverges from the relay log order of the transactions + in that case. + (WL #7846) +* The MySQL 8.0.18 release introduced the ability to specify a + `PRIVILEGE_CHECKS_USER` account for a + replication channel (using a [`CHANGE MASTER + TO`](/doc/refman/8.0/en/change-master-to.html) statement), against which MySQL makes privilege + checks when replicated transactions are applied. The use of a + `PRIVILEGE_CHECKS_USER` account helps secure a + replication channel against the unauthorized or accidental use + of privileged or unwanted operations. The use of row-based + binary logging is strongly recommended when replication channels + are secured with privilege checks. + + In MySQL 8.0.19, a new setting + `REQUIRE_ROW_FORMAT` is added for replication + channels, which makes the channel accept only row-based + replication events. You can specify + `REQUIRE_ROW_FORMAT` using a + [`CHANGE MASTER TO`](/doc/refman/8.0/en/change-master-to.html) statement to + enforce row-based binary logging for a replication channel that + is secured with privilege checks, or to increase the security of + a channel that is not secured in this way. By allowing only + row-based replication events, + `REQUIRE_ROW_FORMAT` prevents the replication + applier from taking actions such as creating temporary tables + and executing `LOAD DATA INFILE` requests, + which protects the replication channel against some known attack + vectors. Row-based binary logging + ([`binlog_format=ROW`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_format)) must be + used on the replication master when + `REQUIRE_ROW_FORMAT` is set. + + Group Replication already requires row-based binary logging, so + from MySQL 8.0.19, Group Replication channels are automatically + created with `REQUIRE_ROW_FORMAT` set, and you + cannot change the option for those channels. The setting is also + applied to all Group Replication channels on upgrade. + + **mysqlbinlog** has a new + `--require-row-format` option, which enforces + row-based replication events for + **mysqlbinlog**'s output. The stream of events + produced with this option would be accepted by a replication + channel that is secured using the + `REQUIRE_ROW_FORMAT` option. + (WL #12968) +* MySQL uses delimiter strings when constructing tablespace names + and file names for table partitions. A + “`#p#`” delimiter string precedes + partition names, and an “`#sp#`” + delimiter string precedes subpartition names, as shown: + + ```None + schema_name.table_name#p#partition_name#sp#subpartition_name + table_name#p#partition_name#sp#subpartition_name.ibd + ``` + + Historically, delimiter strings have been uppercase + (`#P#` and `#SP#`) on + case-sensitive file systems such as Linux, and lowercase + (`#p#` and `#sp#`) on + case-insensitive file systems such as Windows. To avoid issues + when migrating data directories between case-sensitive and + case-insensitive file systems, delimiter strings are now + lowercase on all file systems. Uppercase delimiter strings are + no longer used. + + Additionally, partition tablespace names and file names + generated based on user-specified partition or subpartition + names, which can be specified in uppercase or lowercase, are now + generated (and stored internally) in lowercase regardless of the + [`lower_case_table_names`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names) setting + to ensure case-insensitivity. For example, if a table partition + is created with the name `PART_1`, the + tablespace name and file name are generated in lowercase: + + ```None + schema_name.table_name#p#part_1 + table_name#p#part_1.ibd + ``` + + During upgrade, MySQL now checks and modifies if necessary: + + + Partition file names on disk and in the data dictionary to + ensure lowercase delimiters and partition names. + + Partition metadata in the data dictionary for related issues + introduced by previous bug fixes. + + `InnoDB` statistics data for related issues + introduced by previous bug fixes. + + During tablespace import operations, partition tablespace file + names on disk are checked and modified if necessary to ensure + lowercase delimiters and partition names. + (WL #13352) + + References: See also: Bug #26925260, Bug #29823032, Bug #30012621, Bug #29426720, Bug #30024653. +* Support was added for efficient sampling of + `InnoDB` data for the purpose of generating + histogram statistics. The default sampling implementation used + by MySQL when storage engines do not provide their own requires + a full table scan, which is costly for large tables. The + `InnoDB` sampling implementation improves + sampling performance by avoiding full table scans. The + `sampled_pages_read` and + `sampled_pages_skipped` + [`INNODB_METRICS`](/doc/refman/8.0/en/information-schema-innodb-metrics-table.html) counters can be used + to monitor sampling of `InnoDB` data pages. See + [Histogram Statistics Analysis](/doc/refman/8.0/en/analyze-table.html#analyze-table-histogram-statistics-analysis). + (WL #8777) + +### Bugs Fixed + +* **Important Change:** + Character set resolution has been changed for the following + string functions: + + + [`REPLACE(str, + from_str, + to_str)`](/doc/refman/8.0/en/string-functions.html#function_replace) + + [`SUBSTRING_INDEX(str, + delim, + count)`](/doc/refman/8.0/en/string-functions.html#function_substring-index) + + [`TRIM([{BOTH | LEADING | TRAILING} + [remstr] FROM] + str)`](/doc/refman/8.0/en/string-functions.html#function_trim) + + Previously, character set information for all arguments to these + functions was aggregated, which could lead to results that were + not well formed. This also caused issues with + [`LPAD()`](/doc/refman/8.0/en/string-functions.html#function_lpad), which assumes that both + input and output are well formed. Now each of the three listed + functions always uses the character set employed by + *`str`*, and converts all other arguments + to this character set at execution time; if any such conversion + fails, the function returns an error. + (Bug #30114420) + + References: This issue is a regression of: Bug #28197977. +* **Important Change:** + Subquery materialization no longer requires strict matching of + inner and outer types. Different types can now be materialized + when one of the following conditions is true: + + + The inner type is numeric (since there is always a way to + cast the outer type to a number) + + The inner type is temporal (since there is always a way to + cast the outer type to a temporal) + + Both types are strings + + (Bug #13960580) +* **NDB Cluster:** + Password masking was incomplete for some NDB logging options. + (Bug #97335, Bug #30453137) +* **InnoDB:** + Initialization of certain internal data structures at startup + depend on internal variables derived from the + [`max_connections`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_connections) setting. + `InnoDB` failed to resize the internal data + structures when the + [`max_connections`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_connections) setting was + modified after startup using + [`SET PERSIST`](/doc/refman/8.0/en/set.html). + (Bug #30628872) +* **InnoDB:** + `os_file_get_parent_dir` warnings were + encountered when compiling MySQL with GCC 9.2.0. + (Bug #30499288, Bug #97466) +* **InnoDB:** + An attempt to access a large object (LOB) value using a null + reference raised an assertion failure. To prevent this issue + form occurring, a check was added to determine if LOB references + are null before they are accessed. + (Bug #30499064) +* **InnoDB:** + An assertion failure occurred after upgrading the data + directory. Prepared XA transaction were still present, which + prevented undo tablespaces from being upgraded. Undo tablespaces + containing prepared transaction changes must remain active until + all prepared XA transactions are committed or rolled back. + + Prepared XA transactions also prevented the completion of an + explicit undo tablespace truncation operation after a restart. + (Bug #30489497) +* **InnoDB:** + Attempting to upgrade a MySQL 5.7 instance on Linux with + uppercase table names (partitioned or otherwise) to MySQL 8.0 on + macOS raised an assertion failure. Partition file format changes + in MySQL 8.0 prevented migration of the data directory to a + different platform, and the + [`lower_case_table_names`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names) setting + was changed at upgrade time, which can cause an upgrade failure. + Instead of a failure occurring under these circumstances, an + error is now reported. + (Bug #30450968, Bug #30450979) +* **InnoDB:** + On macOS, a failure occurred when attempting to upgrade a MySQL + 5.7 instance with uppercase table names to MySQL 8.0. Uppercase + table names were not normalized to lowercase. The following + errors were reported: Table is not found in InnoDB + dictionary and Error in fixing SE data + errors. + (Bug #30450944) +* **InnoDB:** + On Windows, a failure occurred when attempting to upgrade a + MySQL 5.7 instance with uppercase partitioned table names to + MySQL 8.0. Opening the table returned a null pointer, which + caused a segmentation fault when closing the table. + (Bug #30450918) +* **InnoDB:** + On Windows, a **mysqld** exception was raised + when attempting to upgrade a MySQL 5.7 instance with uppercase + partitioned table names to MySQL 8.0. + (Bug #30447790) +* **InnoDB:** + On Windows, a failure occurred when attempting to upgrade a + MySQL 5.7 instance containing general tablespace defined with an + uppercase name to MySQL 8.0. The following errors were reported: + Error in fixing SE data and + Failed to Populate DD. + (Bug #30446798) +* **InnoDB:** + Introduction of local minitransactions (mtrs) in LOB-related + code resulted in an assertion failure during recovery. + (Bug #30417719) +* **InnoDB:** + A failure occurred when attempting to upgrade a MySQL 5.7 + instance on Windows with uppercase partitioned table names to + MySQL 8.0 on Linux. Partition file format changes in MySQL 8.0 + prevented migration of the data directory to a different + platform. Instead of a failure, an error is now reported. + (Bug #30411118) +* **InnoDB:** + Updating the same compressed LOB data repeatedly caused the + tablespace file to increase in size. + (Bug #30353812) +* **InnoDB:** + When the [`temptable_max_ram`](/doc/refman/8.0/en/server-system-variables.html#sysvar_temptable_max_ram) + limit was reached, the TempTable storage engine incorrectly + reported an out-of-memory error instead of falling back to + disk-based storage. + (Bug #30314972, Bug #96893) +* **InnoDB:** + After importing an encrypted table and restarting the server, + the following error was returned when attempting to access the + table: ERROR 3185 (HY000): Can't find master key from + keyring, please check in the server log if a keyring plugin is + loaded and initialized successfully. The tablespace + key was not written to disk after it was encrypted with the + destination master key. + (Bug #30313734) +* **InnoDB:** + The internal `InnoDB` + `dict_create_foreign_constraints()` function + that parsed SQL statements and performed foreign key related DDL + checks was removed. The function became redundant with + introduction of the data dictionary in MySQL 8.0 and the + subsequent relocation of foreign key related DDL checks to the + SQL layer. + + Removal of the + `dict_create_foreign_constraints()` function + also addressed the following foreign key issues: + + + Spaces around dots (“.”) in a fully qualified + referenced table name were not permitted by the + `InnoDB` parser. + + Adding a foreign key and removing partitioning in the same + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) statement was not + permitted. The `InnoDB` parser did not + detect that the new table version was no longer partitioned. + + A foreign key constraint could not reference a table inside + a schema named “AUX”. The function that parsed + referenced table names did not recognize that special names + such as AUX are encoded. + + Conditional comments in foreign key definitions were + ignored. + + Additionally, a check was added to the SQL layer to detect + attempts to create multiple foreign keys of the same name on a + table at an early stage in the execution of an + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) statement. + (Bug #30287895, Bug #22364336, Bug #28486106, Bug #28703793, Bug #16904122, Bug #92567, Bug #11754659, Bug #46293) +* **InnoDB:** + A comparison function found two records to be equal when + attempting to merge non-leaf pages of a spatial index. The + function was unable to handle this unexpected condition, which + resulted in a long semaphore wait and an eventual assertion + failure. + (Bug #30287668) +* **InnoDB:** + A locally acquired latch required for freeing a large object + (LOB) page could have caused a deadlock if a subsequent caller + attempted to acquire a latch for the same page before the page + was freed. Similarly, a latch taken on a compressed or + uncompressed LOB during a rollback related operation could have + caused a deadlock due to a latching order issue. + (Bug #30258536) + + References: This issue is a regression of: Bug #29846292. +* **InnoDB:** + A race condition between a purge thread that was purging a + compressed LOB page and an update thread that is using a + delete-marked record caused an assertion failure. + (Bug #30197056) +* **InnoDB:** + A tablespace import operation that failed due to the source and + destination tables being defined with different `DATA + DIRECTORY` clauses reported an insufficiently + descriptive schema mismatch error. Moreover, if a + `.cfg` file was not present, the same + operation would raise an assertion failure. A more informative + error message is now reported in both cases before the import + operation is terminated due to the data directory mismatch. + (Bug #30190199, Bug #30190227, Bug #20644698, Bug #76142) +* **InnoDB:** + A purge operation failed when attempting to purge a LOB value + larger than the buffer pool. + (Bug #30183982) +* **InnoDB:** + Update operations that moved externally stored LOB data to + inline storage failed to mark the old LOB data as purgeable. + (Bug #30178056, Bug #96466) +* **InnoDB:** + Index key part sort order information was not stored to the + `.cfg` metadata file used by + [`ALTER TABLE + ... IMPORT TABLESPACE`](/doc/refman/8.0/en/innodb-table-import.html) operations. The index key part + sort order was therefore assumed to be ascending, which is the + default. As a result, records could be sorted in an unintended + order if one table involved in the import operation is defined + with a `DESC` index key part sort order and the + other table is not. To address this issue, the + `.cfg` file format was updated to include index + key part sort order information. + (Bug #30128418) +* **InnoDB:** + Criteria used by the + `btr_cur_will_modify_tree()` function, which + detects whether a modifying record needs a modifying tree + structure, was insufficient. + (Bug #30113362) +* **InnoDB:** + Startup was slow on instances with a large number of tables due + the tablespace file scan that occurs at startup to retrieve + space IDs. A multithreaded scan was only initiated if the number + of tablespace files exceed 50,000, and three tablespace pages + were read to retrieve a space ID. To improve startup times, + additional threads are now allocated for the tablespace file + scan, and only the first tablespace page is read to retrieve a + space ID. If a space ID is not found on the first page of the + tablespace, three pages are read to determine the space ID, as + before. + (Bug #30108154, Bug #96340) +* **InnoDB:** + Startup failed on a case insensitive file system with an error + indicating that multiple files were found for the same + tablespace ID. A file path comparison did not recognize that + [`innodb_data_home_dir`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_data_home_dir) and + [`datadir`](/doc/refman/8.0/en/server-system-variables.html#sysvar_datadir) paths were the same due + to the paths having different lettercases. + (Bug #30040815) +* **InnoDB:** + A storage engine error occurred when accessing the + `mysql.innodb_index_stats` and + `mysql.innodb_table_stats` persistent optimizer + statistics tables after upgrading a MySQL 8.0.13 instance on + Linux with partitioned tables and a + [`lower_case_table_names=1`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names) + setting to MySQL 8.0.14 or MySQL 8.0.15. The persistent + optimizer statistics tables contained duplicate entries. + (Bug #30012621) + + References: This issue is a regression of: Bug #26925260. +* **InnoDB:** + [`CREATE TABLESPACE`](/doc/refman/8.0/en/create-tablespace.html) failed with an + error indicating that the tablespace already exists. The error + was due to the failure of a preceding + [`CREATE TABLESPACE`](/doc/refman/8.0/en/create-tablespace.html) operation where + the DDL failed but related changes were not rolled back due to + rollback being disabled prior to transaction commit. Rollback is + now disabled after the transaction commits successfully. + (Bug #29959193, Bug #95994) +* **InnoDB:** + Changed pages belonging to imported tablespaces were not being + tracked. + (Bug #29917343) +* **InnoDB:** + Renaming of full-text search auxiliary tables during upgrade + failed due to a tablespace name conflict when upgrading from + MySQL 5.7 to MySQL 8.0 on a case-insensitive file system. + (Bug #29906115) +* **InnoDB:** + Rollback of an [`INSERT`](/doc/refman/8.0/en/insert.html) operation + that inserted a LOB value larger than a buffer pool caused a + deadlock. + (Bug #29846292, Bug #95572) +* **InnoDB:** + A code regression was addressed by prohibiting unnecessary + implicit to explicit secondary index lock conversions for + session temporary tables. + (Bug #29718243) +* **InnoDB:** + A tablespace import operation raised an assertion when the + cursor was positioned on a corrupted page while purging + delete-marked records. Instead of asserting when encountering a + corrupted page, the import operation is now terminated and an + error is reported. + (Bug #29454828, Bug #94541) +* **InnoDB:** + Delete marked rows were able to acquire an external read lock + before a partial rollback was completed. The external read lock + prevented conversion of an implicit lock to an explicit lock + during the partial rollback, causing an assertion failure. + (Bug #29195848) +* **InnoDB:** + After a server exit that occurred while an undo tablespace + truncation operation was in progress, warning messages were + printed at startup stating that doublewrite pages could not be + restored for undo tablespace pages. The warning messages are no + longer printed for undo tablespaces that are being truncated. + (Bug #28590016) +* **InnoDB:** + In read-only mode + ([`innodb_read_only=ON`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_read_only)), + [`SHOW CREATE TABLE`](/doc/refman/8.0/en/show-create-table.html) output did not + include information about foreign key constraints. + (Bug #21966795, Bug #78754) +* **Partitioning:** + When upgrading a database with a subpartitioned table from MySQL + 8.0.16 or lower and then executing `ALTER TABLE ADD + COLUMN`, an assertion or error would occur. + (Bug #30360695, Bug #97054) +* **Partitioning:** + During upgrade of partitioned tables from MySQL 5.7 to 8.0, when + a prefix key was used by the partitioning function, the prefix + length was ignored, and the full column length was considered + instead. Consequently, the table might incorrectly be rejected + from being upgraded because its partition field length was found + to be too large. + (Bug #29941988, Bug #95921) +* **Partitioning:** + [`ALTER + TABLE ... EXCHANGE PARTITION`](/doc/refman/8.0/en/alter-table-partition-operations.html) could cause indexes to + become corrupted. This was due to the fact that the server + assumed that the order in which an index is created in a + partitioned table is the same as that of the table which is not + partitioned. This led to the wrong index data being exchanged. + (Bug #29706669) +* **Replication:** + An assertion was raised when privilege checks were carried out + for a replication channel if the slave had more columns in the + relevant table than the master. The check now references the + number of columns in the event, rather than in the table + definition. + (Bug #30343310) +* **Replication:** + Replication connection parameters that are held in the + `mysql.slave_relay_log_info` table are now + preserved in the event of a server crash or deliberate restart + after issuing [`RESET SLAVE`](/doc/refman/8.0/en/reset-slave.html) but + before issuing [`START SLAVE`](/doc/refman/8.0/en/start-slave.html). This + action applies to the `PRIVILEGE_CHECKS_USER` + account setting for replication privilege checks (introduced in + MySQL 8.0.18) and the `REQUIRE_ROW_FORMAT` + setting (introduced in MySQL 8.0.19). Note that if + [`relay_log_info_repository=FILE`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_relay_log_info_repository) + is set on the server (which is not the default and is + deprecated), replication connection parameters are not preserved + in this situation. + (Bug #30311908) +* **Replication:** + When a replication channel is secured by specifying a + `PRIVILEGE_CHECKS_USER` account, which should + not have ACL privileges, a `GRANT` statement + that is replicated to the channel causes the replication applier + to stop. In this situation, the behavior was correct but an + assertion was being raised. The assertion has now been removed. + (Bug #30273684) +* **Replication:** + For multithreaded replication slaves, setting + [`slave_preserve_commit_order=1`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_preserve_commit_order) + now preserves the order of statements with an `IF + EXISTS` clause when the object concerned does not + exist. Previously, these updates might have committed before + transactions that preceded them in the relay log, which might + have resulted in gaps in the sequence of transactions that have + been executed from the slave's relay log. + (Bug #30262096) +* **Replication:** + When privilege checks were carried out for a replication + channel, the permissions required for setting the session value + of the [`sql_require_primary_key`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_require_primary_key) + system variable were not being checked. The check is now carried + out. + (Bug #30254917) +* **Replication:** + A memory leak could occur when a failed replication group member + tried to rejoin a minority group and was disallowed from doing + so. + (Bug #30162547, Bug #96471) +* **Replication:** + When a group member rejoins a replication group, it begins the + distributed recovery process by checking the relay log for its + `group_replication_applier` channel for any + transactions that it already received from the group, and + applying these. The joining member then initiates state transfer + from an existing online member, which might begin with a remote + cloning operation. Previously, the + `group_replication_applier` channel was not + explicitly stopped when a remote cloning operation was started, + so it was possible that the applier might still be applying + existing transactions at that time, which might lead to errors. + The `group_replication_applier` channel is now + stopped before a remote cloning operation is requested, and + restarted when the distributed recovery process moves on to + state transfer from a donor's binary log. + (Bug #30152028, Bug #96447) +* **Replication:** + If [`STOP GROUP_REPLICATION`](/doc/refman/8.0/en/stop-group-replication.html) was + issued while the member's XCom port was blocked, the XCom thread + hung and the shutdown did not complete. XCom is now terminated + in this situation. + (Bug #30139794) +* **Replication:** + The slave status logs + `mysql.slave_relay_log_info` (the relay log + info log) and `mysql.slave_worker_info` (the + slave worker log) are now copied from the donor to the recipient + during a local or remote cloning operation. The slave status + logs hold information that can be used to resume replication + correctly after the cloning operation, including the relay log + position from which to restart replication, the + `PRIVILEGE_CHECKS_USER` account setting, and + the new `REQUIRE_ROW_FORMAT` setting. Note that + the relay logs themselves are not copied from the donor to the + recipient, only the information about them that is held in these + tables. Also note that if + [`relay_log_info_repository=FILE`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_relay_log_info_repository) + is set on the server (which is not the default and is + deprecated), the slave status logs are not cloned; they are only + cloned if `TABLE` is set. + + Before this patch, the following replication-related behaviors + occurred on a replication slave that had been provisioned by a + cloning operation: + + + The default replication channel would fail to start if it + was the only channel on the slave, because it was considered + to be not initialized due to the missing relay log + information. + + Any `PRIVILEGE_CHECKS_USER` account setting + that had been applied to replication channels on the donor + was absent and had to be respecified. + + Replication channels that used GTID auto-positioning (as + specified by the `MASTER_AUTO_POSITION` + option on the [`CHANGE MASTER + TO`](/doc/refman/8.0/en/change-master-to.html) statement) were able to resume replication + automatically. + + Replication channels that used binary log file position + based replication (as specified by the + `MASTER_LOG_FILE` and + `MASTER_LOG_POS` options on the + [`CHANGE MASTER TO`](/doc/refman/8.0/en/change-master-to.html) statement) + had to have the `MASTER_LOG_FILE` and + `MASTER_LOG_POS` options reapplied manually + before restarting replication in order to resume correctly. + If the channels were configured to start replication + automatically at server startup, without the options + reapplied they would attempt to start replication from the + beginning. They were therefore likely to attempt to + replicate data that had already been copied to the slave by + the cloning operation, causing replication to stop and + possibly corrupting the data on the slave. + + With this change, the following replication-related behaviors + now occur on a replication slave that has been provisioned by a + cloning operation: + + + The default replication channel can now always start after + the cloning operation if it is configured to do so. + + All channels now have the donor's + `PRIVILEGE_CHECKS_USER` account setting and + `REQUIRE_ROW_FORMAT` setting. + + Replication channels that use GTID auto-positioning (as + specified by the `MASTER_AUTO_POSITION` + option on the [`CHANGE MASTER + TO`](/doc/refman/8.0/en/change-master-to.html) statement) are still able to resume replication + automatically. For Group Replication channels, which use + GTID auto-positioning, an internal equivalent of the + [`RESET MASTER`](/doc/refman/8.0/en/reset-master.html) statement is now + used to ensure that replication resumes optimally. + + Replication channels that use binary log file position based + replication now have the correct + `MASTER_LOG_FILE` and + `MASTER_LOG_POS` options in place after + cloning. Because the relay logs themselves are not cloned, + these channels now attempt to carry out the relay log + recovery process, using the cloned relay log information, + before restarting replication. For a single-threaded slave + ([`slave_parallel_workers`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_parallel_workers) is + set to 0), relay log recovery should succeed in the absence + of any other issues, enabling the channel to resume + replication correctly. For a multithreaded slave + ([`slave_parallel_workers`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_parallel_workers) is + greater than 0), relay log recovery is likely to fail + because it cannot usually be completed automatically, but an + informative error message is issued, and the data will not + be corrupted. + + (Bug #29995256, Bug #30510766) +* **Replication:** + An internal deadlock could occur on a multi-threaded replication + slave when the + [`relay_log_space_limit`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_relay_log_space_limit) system + variable was set to limit the size of relay logs on the slave, + and the coordinator thread acquired locks related to this limit + and to the end position of the log. + (Bug #29842426) +* **Replication:** + If a replication slave was set up using a + [`CHANGE MASTER TO`](/doc/refman/8.0/en/change-master-to.html) statement that + did not specify the master log file name and master log + position, then shut down before [`START + SLAVE`](/doc/refman/8.0/en/start-slave.html) was issued, then restarted with the option + [`--relay-log-recovery`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_relay_log_recovery) set, + replication did not start. This happened because the receiver + thread had not been started before relay log recovery was + attempted, so no log rotation event was available in the relay + log to provide the master log file name and master log position. + In this situation, the slave now skips relay log recovery and + logs a warning, then proceeds to start replication. + (Bug #28996606, Bug #93397) +* **Group Replication:** + When a member is joining or rejoining a replication group, if + Group Replication detects an error in the distributed recovery + process (during which the joining member receives state transfer + from an existing online member), it automatically switches over + to a new donor, and retries the state transfer. The number of + times the joining member retries before giving up is set by the + [`group_replication_recovery_retry_count`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_recovery_retry_count) + system variable. The Performance Schema table + [`replication_applier_status_by_worker`](/doc/refman/8.0/en/performance-schema-replication-applier-status-by-worker-table.html) + displays the error that caused the last retry. Previously, this + error was only shown if the group member was configured with + parallel replication applier threads (as set by the + [`slave_parallel_workers`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_parallel_workers) system + variable). If the group member was configured with a single + applier thread, the error was cleared after each retry by an + internal [`RESET SLAVE`](/doc/refman/8.0/en/reset-slave.html) operation, + so it could not be viewed. This was also the case for the output + of the [`SHOW SLAVE STATUS`](/doc/refman/8.0/en/show-slave-status.html) command + whether there were single or multiple applier threads. The + [`RESET SLAVE`](/doc/refman/8.0/en/reset-slave.html) operation is now no + longer carried out after retrying distributed recovery, so the + error that caused the last retry can always be viewed. + (Bug #30517160, Bug #30517172, Bug #97540) +* **Group Replication:** + When a replication group member leaves a group, either because + [`STOP GROUP_REPLICATION`](/doc/refman/8.0/en/stop-group-replication.html) was issued + or due to an error, Group Replication now stops the binary log + dump thread so that the former group member cannot send unwanted + binary log data to the members that have remained in the group. + (Bug #30315614) +* **Group Replication:** + When Group Replication was started following either provisioning + with a cloning operation, execution of + [`RESET MASTER`](/doc/refman/8.0/en/reset-master.html), or removal of a + partial transaction from the relay log, `RESET SLAVE + ALL` was used internally to clear any unwanted state on + the server. However, in MySQL 8.0.18, this caused any + `PRIVILEGE_CHECKS_USER` account that was + specified for a Group Replication channel to be removed. + [`RESET SLAVE`](/doc/refman/8.0/en/reset-slave.html) is now used instead, + which does not remove the account. + (Bug #30262225) +* **Group Replication:** + When Group Replication is running in single-primary mode, and a + new primary server is elected, the messages logged at this time + now provide the newly elected primary server's + `gtid_executed` set, and the set of GTIDs + retrieved by the replication applier. + (Bug #30049310) +* **Group Replication:** + If a replication group member stops unexpectedly and is + immediately restarted (for example, because it was started with + `mysqld_safe`), it automatically attempts to + rejoin the group if + [`group_replication_start_on_boot=on`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_start_on_boot) + is set. Previously, if the restart and rejoin attempt took place + before the member's previous incarnation had been expelled from + the group, the member could not rejoin. Now in this scenario, + Group Replication automatically uses a Group Communication + System (GCS) feature to retry the rejoin attempt for the member + 10 times, with a 5-second interval between each retry. This + should cover most cases and allow enough time for the previous + incarnation to be expelled from the group, letting the member + rejoin. Note that if the + [`group_replication_member_expel_timeout`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_member_expel_timeout) + system variable is set to specify a longer waiting period before + the member is expelled, the automatic rejoin attempts might + still not succeed. + (Bug #29801773) +* **macOS:** + On macOS, configuring MySQL with + [`-DWITH_SSL=system`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_ssl) caused + **mysql\_config** output to incorrectly include + internal **CMake** names for the static SSL + libraries. + (Bug #30541879, Bug #97632) +* **macOS:** + Builds on macOS with Ninja could fail with an error trying to + create a symbolic link multiple times. + (Bug #30368985) +* **Microsoft Windows; JSON:** + On Windows platforms, memory used for a multi-valued index was + not released after the table containing it was dropped. + (Bug #30227756) +* **Microsoft Windows:** + On Windows, [`-DWITH_SSL=system`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_ssl) + failed to find the installed OpenSSL headers if Strawberry Perl + was installed. + (Bug #30359287) +* **Microsoft Windows:** + On Windows, the [`-DWITH_SSL=system`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_ssl) + option did not work if the path name leading to the system + OpenSSL libraries contained a space. This is now handled. Also, + [`-DWITH_SSL=yes`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_ssl) is treated like + [`-DWITH_SSL=system`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_ssl), as on other + platforms. + (Bug #30261942, Bug #96739) +* **Microsoft Windows:** + MSVC 2019 produced garbled source file names for compilation + errors. A workaround in the `CMake` + configuration was implemented to correct for this. + (Bug #30255096, Bug #96720) +* **JSON:** + Updating a value in a [`JSON`](/doc/refman/8.0/en/json.html) column + by replacing a character string element with a binary string + containing the same byte sequence as the + `utf8mb4` representation of the character + string had no effect. + + The root cause of this issue was a change in the behavior of + comparisons between JSON strings and JSON opaque values + introduced by the implementation of multi-valued indexes in + MySQL 8.0.17, previous to which, JSON strings and JSON opaque + values were never considered equal. After the change, they were + considered equal if their binary data matched. + + An analysis of this change showed that it was not needed; in + addition, the new behavior conflicted with the existing + documentation for comparisons of JSON values. This issue is + fixed by restoring the original behavior. + (Bug #30348554) +* **JSON:** + A view that used [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table) did + not preserve the character set in which JSON path arguments were + encoded. This meant that, if the view was evaluated with a + different character set in effect from the one in which it was + defined, it could produce wrong results. This is fixed by + ensuring that `JSON_TABLE()` preserves the + original character set in such cases. + (Bug #30310265) +* **JSON:** + Adding a functional index on a JSON column changed the collation + used for comparing strings, causing the result returned by the + same query selecting the column to differ from that obtained + without the index. + (Bug #29723353) +* **JSON:** + If the first argument to + [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table) was + `const` during the execution of a stored + procedure, but not during preparation, it was not re-evaluated + when a statement was subsequently executed again, causing an + empty result to be returned each time following the first + execution of the procedure. + (Bug #97097, Bug #30382156) +* **JSON:** + In some cases, such as when a query uses `FORCE + INDEX`, the cost of reading the table is + `DBL_MAX`; this was rounded up to + `2e308` when printed, which is too large for + the JSON parser, so that it was not possible to extract parts of + the optimizer trace using a query such as `SELECT + JSON_EXTRACT(trace, '$**.table_scan') FROM + INFORMATION_SCHEMA.OPTIMIZER_TRACE`. Now in such cases, + values greater than `1.5e308` are rounded down + and printed as `1e308` instead. + (Bug #96751, Bug #30226767) +* After upgrading from MySQL 5.7 to MySQL 8.0, a + [`CLONE INSTANCE`](/doc/refman/8.0/en/clone.html) + operation failed with the following error: ERROR 3862 + (HY000): Clone Donor Error: 1016 : Can't open file: + './undo001'. The upgrade process left behind + orphaned in-memory undo tablespaces. Thanks to Satya Bodapati + for the contribution. + (Bug #30602218, Bug #97784, Bug #30239255, Bug #96637) +* The MySQL optimizer's hash join algorithm uses the join buffer + to store intermediate results. If this buffer overflows, the + server uses a spill-to-disk algorithm, which writes one of the + hash join operands to a temporary file, to handle this + gracefully. If one of the operands was a table that was a member + of a pushed join operation, this strategy conflicted with the + pushed join requirement for all child result rows to use + nested-loop reads whenever one of their pushed join ancestors + was the current row in the join evaluation, which could in some + cases result in incorrect query results being returned. + (Bug #30573733) +* Access to the + [`INFORMATION_SCHEMA.VIEWS`](/doc/refman/8.0/en/information-schema-views-table.html) table was + not properly restricted to the correct user. + (Bug #30542333) +* When creating hash values used for lookups during a hash join, + the server did not respect the `PAD SPACE` + attribute, meaning that `'foo'` and + `'foo '` did not match when using a + `PAD SPACE` collation. This is fixed by padding + all strings up to the same length as the longest possible + string, where the longest possible string is deduced from the + data type length specifier *`N`* in + [`CHAR(N)`](/doc/refman/8.0/en/char.html) + or + [`VARCHAR(N)`](/doc/refman/8.0/en/char.html). + (Bug #30535541) +* When retrieving large result sets containing + [`DECIMAL`](/doc/refman/8.0/en/fixed-point-types.html) columns from a secondary + engine, conversion of the column values to strings for transport + over the text protocol acted as a bottleneck. The performance of + the functions responsible for such conversions has been improved + in some cases by as much as 50%, as reflected in internal + testing. + (Bug #30528427) +* When the [`FORMAT_PICO_TIME()`](/doc/refman/8.0/en/performance-schema-functions.html#function_format-pico-time) + function was invoked to process several rows, once a + `NULL` argument was found in a row, every + result after that was set to `NULL`. + (Bug #30525561) +* When a Performance Schema event was timed, the event duration + reported in + `events_xxx` tables + could be `NULL` instead of 0 for events where + the timer start and end values are equal. + (Bug #30525560) +* Adding a `LIMIT` clause to a parenthesized + query suppressed locking clauses within the parentheses. For + example, this query would not lock the table: + + ```None + (SELECT ... FOR UPDATE) LIMIT ...; + ``` + + Adding a `LIMIT` clause outside of a + parenthesized query is intended to override a + `LIMIT` clause within the parentheses. However, + the outer `LIMIT` suppressed `ORDER + BY` within the parentheses as well. For example, for + this query, the `ORDER BY` was suppressed: + + ```None + (SELECT ... ORDER BY ... LIMIT a) LIMIT b; + ``` + + Now inner locking and `ORDER BY` clauses are + not suppressed by an outer `LIMIT` clause. + (Bug #30521098, Bug #30521803) +* When optimizer extracts conditions on constant tables for early + evaluation, it does not include `WHERE` + conditions that are expensive to evaluate, including conditions + involving stored functions. When the extracted condition + evaluated to true because it involved only const tables, the + entire `WHERE` condition was incorrectly + removed. Now in such cases, a check for expensive conditions is + performed prior to any removal of the `WHERE` + condition. + (Bug #30520714) +* When a lateral materialized derived table used + `DISTINCT`, the derived table was not + rematerialized for each outer row as expected. + (Bug #30515233) +* [`EXPLAIN ANALYZE`](/doc/refman/8.0/en/explain.html#explain-analyze) did not work + correctly with a common table expression using `WITH + RECURSIVE`. + (Bug #30509580) +* The GNU **gold** loader could cause memory + exhaustion on some platforms. Now it is used by default only on + Intel 64-bit platforms. + (Bug #30504760, Bug #96698) +* Some Linux platforms experienced high overhead with + [`EXPLAIN ANALYZE`](/doc/refman/8.0/en/explain.html#explain-analyze) due to use of a + system call by `libstdc++` instead of + `clock_gettime()`. + (Bug #30483025) +* On Solaris 11.4, the LDAP authentication plugins could not be + built. + (Bug #30482553) +* Queries that used the [`MEMBER OF()`](/doc/refman/8.0/en/json-search-functions.html#operator_member-of) + operator were not always handled correctly. + (Bug #30477993) +* Boost compilation failed under Visual Studio due to a Boost + workaround for a VC++ 2013 bug that has since been fixed. The + workaround is now patched for Boost compilation with MySQL. + (Bug #30474056, Bug #97391) +* When retrieving large result sets containing many integers from + a secondary engine, conversion of the integers to strings for + sending over the text protocol could act as a bottleneck. To + avoid this problem, the performance of internal functions + performing such conversions has been improved. + (Bug #30472888) +* Docker packages were missing the LDAP authentication plugins. + (Bug #30465247) +* Corrected a typo in a + `mysys/my_handler_errors.h` error message. + Thanks to Nikolai Kostrigin for the contribution. + (Bug #30462329, Bug #97361) +* A GTID table update while + [`innodb_force_recovery`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_force_recovery) was + enabled caused a debug assertion failure. + (Bug #30449531, Bug #97312) +* MySQL failed to compile against Protobuf 3.10. + (Bug #30428543, Bug #97246) +* Buffered log lines during system startup could be lost. + (Bug #30422941, Bug #97225) +* If the `mysql.user` system table was renamed, + the server could exit. + (Bug #30418070) +* Revoking a role specified with no host name could cause a server + exit. + (Bug #30416389) +* When determining whether to pull out a semijoin table when other + tables inside the semijoin depended on this table, only those + semijoin tables which were base tables were considered; those in + nested joins were ignored. + (Bug #30406241) + + References: See also: Bug #12714094, Bug #11752543, Bug #43768. +* The AppArmor profile on Ubuntu platforms was not able to read + the OpenSSL configuration. + (Bug #30375723) +* Some Fedora 30 packages had missing obsoletes information that + could cause problems upgrading an existing MySQL installation. + (Bug #30348549, Bug #96969) +* Altering only the default encryption in an + [`ALTER + SCHEMA`](/doc/refman/8.0/en/alter-database.html) statement caused the schema default character + set and collation to be reset to the system defaults. + (Bug #30344462, Bug #96994) +* Columns declared with both `AUTO_INCREMENT` and + `DEFAULT` value expressions (a nonpermitted + combination) could raise an assertion or cause a server exit. + (Bug #30331053) +* [`SHOW GRANTS`](/doc/refman/8.0/en/show-grants.html) for an anonymous user + could result in a server exit under some conditions. + (Bug #30329114) +* [`GREATEST()`](/doc/refman/8.0/en/comparison-operators.html#function_greatest) and + [`LEAST()`](/doc/refman/8.0/en/comparison-operators.html#function_least) did not always handle + time values correctly. + (Bug #30326848) + + References: This issue is a regression of: Bug #25123839. +* The list of subpartitions in partition objects was not + serialized and therefore not included in serialized dictionary + information (SDI). To address this issue, support was added for + serialization and deserialization of subpartition dictionary + information. The patch for this bug also includes minor SDI code + refactoring and format changes. Due to the format changes, the + SDI version number was incremented. + (Bug #30326020, Bug #96943) +* Following execution of [`ANALYZE + TABLE`](/doc/refman/8.0/en/analyze-table.html), the optimizer trace for a given query differed + when another query was executed previously to it, but also after + the `ANALYZE TABLE`. + (Bug #30321546) +* [`innodb_buffer_pool_instances`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_buffer_pool_instances) + was not initialized correctly at server startup if it had been + set using [`SET + PERSIST`](/doc/refman/8.0/en/set-variable.html) or `PERSIST_ONLY`. + (Bug #30318828) +* A low [`max_allowed_packet`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_allowed_packet) value + caused the following error: ERROR 1153 (08S01) at + line 1: Got a packet bigger than 'max\_allowed\_packet' + bytes. The error message was revised to indicate the + minimum required + [`max_allowed_packet`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_allowed_packet) value for + cloning operations. + (Bug #30315486, Bug #96891) +* An assertion could be raised when server code tried to send to + clients an error code intended to be written to the error log. + These instances are fixed by sending a code intended to be sent + to clients. + (Bug #30312874) +* [`CREATE VIEW`](/doc/refman/8.0/en/create-view.html) did not always + succeed when the body of the view definition contained a join + and multiple subselects. + (Bug #30309982) + + References: This issue is a regression of: Bug #25466100. +* Dependency information for SLES 12 RPM packages was incorrect, + causing MySQL installation failure. + (Bug #30308305) +* When restoring `GEOMETRY` data from hash join + chunk files to a `GEOMETRY` column, the server + did not copy the data to the column, but instead stored a + pointer to the data, which resided in a temporary buffer, + meaning that the `GEOMETRY` column pointed to + random data as soon as this buffer was reused. Now, the server + always copies the data from this buffer into the + `GEOMETRY` column when executing a hash join. + (Bug #30306279) +* Some [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) operations using + the `COPY` algorithm did not handle columns + with expression default values properly. + (Bug #30302907, Bug #96864) +* The [`CONV()`](/doc/refman/8.0/en/mathematical-functions.html#function_conv) function did not + always handle returning the proper number of characters + correctly. + (Bug #30301543) +* Parser recursion checks were insufficient to prevent stack + overflow. + (Bug #30299881) +* The removal of a subquery because the condition in which it + occurred was always false was expected to be performed during + resolution, but when the subquery did not involve any tables, + the server executed it while resolving it. This resulted in the + failure of a subsequent check to confirm that the subquery was + only being resolved and not yet optimized. Now in such cases, + the server also checks to see whether the subquery was already + executed. + (Bug #30273827) +* For debug builds, attempts to add to an empty temporary table a + column with an expression default that was not valid raised an + assertion. + (Bug #30271792) +* Construction of the iterator tree may yield a non-hierarchical + structure; this can happen when, for example, + `b` and `c` from `a + LEFT JOIN b LEFT JOIN c` also make up the right side of + a semijoin. The iterator executor solves this by adding a + weedout on top of the entire query, which means that is also + necessary to iterators interacting with row IDs that they need + to store and restore them. This was not done in all such cases, + causing wrong results. Now the addition of a top-level weedout + is always communicated to the iterators as soon as it is known + that this is being done, before any affected iterators are + constructed. + (Bug #30267889) +* Foreign key-handling code duplication between the SQL layer and + the data dictionary was eliminated. A side effect is that some + error messages now are more informative and clear. + (Bug #30267236, Bug #96765) +* During startup, the server could handle incorrect option values + for persisted variables improperly, resulting in a server exit. + (Bug #30263773) +* In some queries involving materialized semijoins, when using the + iterator executor, conditions were evaluated outside the + materialization, causing inefficient query plans to be used and + sometimes also producing wrong results. + (Bug #30250091) +* [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) statements that + renamed a column used in `CHECK` constraints + could result in an incorrect error message. + (Bug #30239721) +* For [`SELECT`](/doc/refman/8.0/en/select.html) statements, an + `INTO var_name` + clause prior to a locking clause is legal but the parser + rejected it. + (Bug #30237291, Bug #96677) +* `FLUSH TABLES WITH READ LOCK` caused a deadlock + when a `LOCK INSTANCE FOR BACKUP` statement was + previously executed within the same session and there was a + concurrent `ALTER DATABASE` statement running + in another session against the same database specified + (implicitly or explicitly) for the `FLUSH TABLES WITH + READ LOCK` statement. + (Bug #30226264) +* Slow query logging could result in a server exit for connections + that did not use the classic client/server protocol. + (Bug #30221187) +* A statement that added a foreign key without an explicit name + failed when re-executed as a prepared statement or in a stored + program with an unwarranted duplicate foreign key name error. + (Bug #30214965, Bug #96611) + + References: This issue is a regression of: Bug #30171959. +* With multiple sessions executing concurrent `INSERT ... + ON DUPLICATE KEY UPDATE` statements into a table with + an `AUTO_INCREMENT` column but not specifying + the `AUTO_INCREMENT` value, inserts could fail + with a unique index violation. + (Bug #30194841, Bug #96578) +* Client programs could load authentication plugins from outside + the plugin library. + (Bug #30191834, Bug #30644258) +* When switching between table scans and index lookups, + `AlternativeIterator` did not reset the + handler, which could lead to assertion failures. + (Bug #30191394) +* Setting [`open_files_limit`](/doc/refman/8.0/en/server-system-variables.html#sysvar_open_files_limit) to a + large value, or setting it when the operating system rlimit had + a value that was large but not equal to + `RLIM_INF` could cause the server to run out of + memory. As part of this fix, the server now caps the effective + [`open_files_limit`](/doc/refman/8.0/en/server-system-variables.html#sysvar_open_files_limit) value to the + the maximum unsigned integer value. + (Bug #30183865, Bug #96525) +* References to fully qualified + `INFORMATION_SCHEMA` tables could fail + depending on the lettercase in which + `INFORMATION_SCHEMA` was specified. + (Bug #30158484) +* Slow queries with an execution time greater than 35 days could + cause corruption of the `mysql.slow_log` system + table requiring a [`REPAIR TABLE`](/doc/refman/8.0/en/repair-table.html) + operation. + (Bug #30113119, Bug #96373) +* MySQL did not support sending systemd notification messages to a + socket specified using the `NOTIFY_SOCKET` + environment variable, if the variable named an abstract + namespace socket. + (Bug #30102279) +* Using [`SET + PERSIST_ONLY`](/doc/refman/8.0/en/set-variable.html) to set a boolean system variable to a + numeric value resulted in the server being unable to restart. + (Bug #30094645, Bug #30298191, Bug #96848) +* A fix for a previous issue combined two + `TABLE_LIST` constructors in an unfortunate + way. One of these created a `TABLE_LIST` object + from a `TABLE` object representing a temporary + table. Previously, the table name was made the same as the + alias; this was changed to copying the name from the + `TABLE` object. Due to the fact that, for a + temporary table, the table name is a file path, it was possible + to exceed the limit for `MDL_key` names, + leading to a failed assertion. Fixed by reintroducing dedicated + constructors which behave in the manner that they did prior to + the fix. + (Bug #30083125) + + References: This issue is a regression of: Bug #27482976. +* For [`UNIX_TIMESTAMP()`](/doc/refman/8.0/en/date-and-time-functions.html#function_unix-timestamp) errors + occurring within stored functions, the number of fractional + seconds for subsequent function invocations could be incorrect. + (Bug #30034972, Bug #96166) +* When a common table expression contained a nondeterministic + expression (such one that used + [`RAND()`](/doc/refman/8.0/en/mathematical-functions.html#function_rand)) and the common table + expression was referenced more than once in the outer query, it + was merged in some cases. This caused the common table + expression to return a different result for each reference. Now + in such cases, the common table expression is not merged, but + rather is materialized instead. + (Bug #30026353) +* In debug build of MySQL started on Linux with a + [`lower_case_table_names=1`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names) + setting, discarding a tablespace for a partitioned table after + an in-place upgrade from MySQL 8.0.16 caused a serious error. + The partition tablespace name stored in the data dictionary was + invalid, and the metadata lock key prepared for the partition + tablespace in MySQL 8.0.17 did not match the key stored in the + `mysql.tablespaces` table. + (Bug #30024653) +* [`KILL QUERY`](/doc/refman/8.0/en/kill.html) could + kill the statement subsequent to the one intended. + (Bug #29969769) +* With [`lower_case_table_names=2`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names), + [`SHOW TABLES`](/doc/refman/8.0/en/show-tables.html) could fail to display + tables with uppercase names. + (Bug #29957361) +* The error message reported for attempts to upgrade tables with + invalid expressions for generated columns did not provide + sufficient information. The error message now includes the + generated column name and the expression used to create the + generated column. + (Bug #29941887, Bug #95918) +* Attempting to display an unresolvable view could result in a + server exit rather than an error. + (Bug #29939279) +* Incorrect checking of temporal literals for + [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) statements could + lead to a server exit. + (Bug #29906966, Bug #95794) +* Attempting to spawn a thread for a parallel read operation while + system resources were temporary unavailable raised system error. + (Bug #29874480) +* Writing unexpected values to the + `mysql.global_grants` system table could cause + a server exit. + (Bug #29873343) +* The `LAST_EXECUTED` value in the + [`INFORMATION_SCHEMA.EVENTS`](/doc/refman/8.0/en/information-schema-events-table.html) table was + incorrectly reported in UTC, not in the event time zone. + (Bug #29871530, Bug #95649) +* With + [`keyring_encrypted_file_password`](/doc/refman/8.0/en/keyring-system-variables.html#sysvar_keyring_encrypted_file_password) + set on the command line at server startup, the password value + could be visible to system utilities. + (Bug #29848634) +* Changing the + [`lower_case_table_names`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names) setting + when upgrading from MySQL 5.7 to MySQL 8.0 could cause a failure + due to a schema or table name lettercase mismatch. If + [`lower_case_table_names=1`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names), table + and schema names are now checked by the upgrade process to + ensure that all characters are lowercase. If table or schema + names are found to contain uppercase characters, the upgrade + process fails with an error. For related information, see + [Preparing Your Installation for Upgrade](/doc/refman/8.0/en/upgrade-prerequisites.html). + (Bug #29842749, Bug #95559) +* With a [`LOCK TABLES`](/doc/refman/8.0/en/lock-tables.html) statement in + effect, a metadata change for the locked table could cause + Performance Schema or `SHOW` queries for + session variables to hang in the + `opening_tables` state. + (Bug #29836204, Bug #92387) +* A [`SELECT`](/doc/refman/8.0/en/select.html) using a + `WHERE` condition of the form + `A AND + (B OR C + [OR ...])` resulting in an impossible range led to an + unplanned exit of the server. + (Bug #29770705) +* For JSON-format audit logging, the `id` field + now may contain values larger than 65535. Previously, with + heaving logging activity, more than 65536 queries per second + could be executed, exceeding the 16 bits permitted for + `id` values. + (Bug #29661920) +* An incomplete connection packet could cause clients not to + properly initialize the authentication plugin name. + (Bug #29630767) +* Out-of-memory errors from the parser could be ignored, resulting + in a server exit. + (Bug #29614521) +* On Linux, an assertion could be raised when the Performance + Schema file instrumentation was disabled and re-enabled. + (Bug #29607570) +* For a column defined as a `PRIMARY KEY` in a + [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) statement, a default + value given as an expression was ignored. + (Bug #29596969, Bug #94668) +* The [`TABLE_ENCRYPTION_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_table-encryption-admin) + privilege, added in MySQL 8.0.16, was incorrectly granted to the + system-defined `mysql.session` user during + upgrade. + (Bug #29596053, Bug #94888) +* For connections encrypted with OpenSSL, network I/O at the + socket level was not reported by the Performance Schema. Also, + network I/O performed while the server was in an + `IDLE` state was not reported by the + Performance Schema. + (Bug #29205129, Bug #30535558, Bug #97600) +* When a query used a subquery that was merged into the outer + query block (due to a semijoin transformation or merge of a + derived table), and the subquery itself contained a subquery + with an aggregate function with an aggregation query block that + differed from its base query block, the query could sometimes + fail to return any rows unless executed a second time or + preceded with [`FLUSH TABLES`](/doc/refman/8.0/en/flush.html#flush-tables). This + was because, when merging, the information regarded tables used + and the aggregation information for the aggregate function was + not updated properly. In the case which raised this bug report, + this meant that the comparison operation containing a scalar + subquery was regarded as const-for-execution and therefore the + range optimizer attempted to evaluate it, and the scalar + subquery contained a [`MIN()`](/doc/refman/8.0/en/aggregate-functions.html#function_min) + function referring to an outer reference which had not yet been + read. Thus, when the aggregator object was populated, it was + based on uninitialized data, leading to unpredictable results. + (Bug #28941154) +* Changing the [`mandatory_roles`](/doc/refman/8.0/en/server-system-variables.html#sysvar_mandatory_roles) + system variable could cause [`SHOW + GRANTS`](/doc/refman/8.0/en/show-grants.html) in concurrent sessions to produce incorrect + results. + (Bug #28699403) +* Failure of `keyring_aws` initialization caused + failure of SSL socket initialization. + (Bug #28591098) +* Under certain conditions, enabling the + [`read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_read_only) or + [`super_read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only) system variable + did not block concurrent DDL statements executed by users + without the [`SUPER`](/doc/refman/8.0/en/privileges-provided.html#priv_super) privilege. + (Bug #28438114, Bug #91852) +* The current `GROUP BY` plan is improved so that + every gap attribute is allowed to have a disjunction of equality + predicates. Predicates from different attributes must still be + conjunctive to each other in order to take advantage of this + enhancement. + + Our thanks to Facebook for this contribution. + (Bug #28056998, Bug #15947433, WL #13066) +* In some cases, [`BIGINT`](/doc/refman/8.0/en/integer-types.html) arguments + to the [`FLOOR()`](/doc/refman/8.0/en/mathematical-functions.html#function_floor) and + [`CEILING()`](/doc/refman/8.0/en/mathematical-functions.html#function_ceiling) functions were resolved + as the wrong type. + (Bug #27125612) +* **mysqlpump** exits rather than dumping databases + that contain an invalid view, by design, but it also failed if + an invalid view existed but was not in any of the databases to + be dumped. + (Bug #27096081) +* Foreign key information is now retrieved from the data + dictionary, not from `InnoDB`. + (Bug #25583288) +* Foreign key definitions used in [`CREATE + TABLE`](/doc/refman/8.0/en/create-table.html) and [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) + statements for `InnoDB` tables were ignored if + the statements were wrapped in conditional comments (such as + `/*!50101 ... */` or `/*! ... + */`). + (Bug #21919887, Bug #78631) +* The `--log-raw` option is now available at + runtime as the [`log_raw`](/doc/refman/8.0/en/server-system-variables.html#sysvar_log_raw) system + variable. The system variable is set at startup to the option + value, and may be set at runtime to change password masking + behavior. + (Bug #16636373, Bug #68936) +* [`EXPLAIN ANALYZE`](/doc/refman/8.0/en/explain.html#explain-analyze) did not execute + subqueries in the [`SELECT`](/doc/refman/8.0/en/select.html) list, + and thus did not take them into account in its calculations of + time or cost. + (Bug #97296, Bug #30444266) +* An inner scalar subquery containing an outer reference did not + return the same result using a nested set of + `SELECT` expressions on the right hand side as + when using a single `SELECT` that was + equivalent. + (Bug #97063, Bug #30381092) +* A materialized subquery could yield different results depending + on whether it used an index. + (Bug #96823, Bug #30289052) +* When a query terminated due to exceeding the time specified + using the [`MAX_EXECUTION_TIME`](/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-execution-time) + hint, the error produced differed depending on the stage of the + query. In particular, if the query terminated during a filesort, + the error raised was `ER_FILSORT_ABORT`, even + though in such cases the query should always exit with + [`ER_QUERY_TIMEOUT`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_query_timeout). This made it + unnecessarily difficult to trap such errors and to handle them + correctly. + + This fix removes the error codes + `ER_FILSORT_ABORT` and + `ER_FILESORT_TERMINATED`. + (Bug #96537, Bug #30186874) +* If a stored procedure had a parameter named + **member** or + **array**, and it had been defined + without quoting the parameter names, the database in which it + was defined could not be upgraded to 8.0.17 or 8.0.18. + (Bug #96288, Bug #30084237) + + References: See also: Bug #96350, Bug #30103640. +* When a function such as + [`COALESCE()`](/doc/refman/8.0/en/comparison-operators.html#function_coalesce) or + [`IFNULL()`](/doc/refman/8.0/en/flow-control-functions.html#function_ifnull) was passed a + [`BIGINT`](/doc/refman/8.0/en/integer-types.html) column value, casting a + negative return value from this function to + `UNSIGNED` unexpectedly yielded zero. + + Our thanks to Oleksandr Peresypkin for this contribution. + (Bug #95954, Bug #29952066) +* [`EXPLAIN`](/doc/refman/8.0/en/explain.html) output showed + `Select tables optimized away` for a query + using [`MAX()`](/doc/refman/8.0/en/aggregate-functions.html#function_max) on an indexed column, + but if `MAX()` on the same column was called in + a user function, it showed `Using index` + instead. + (Bug #94862, Bug #29596977) diff --git a/corpus/changelog/mysql_releases/mysql_8020.md b/corpus/changelog/mysql_releases/mysql_8020.md new file mode 100644 index 0000000000000000000000000000000000000000..71edd9c7c40a25cf7d37561ea81b4591c3301416 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8020.md @@ -0,0 +1,1701 @@ +# MySQL 8.0.20 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-20.html +Version: 8.0.20 + +## Changes in MySQL 8.0.20 (2020-04-27, General Availability) + +For general information about upgrades, downgrades, platform support, etc., please visit [https://dev.mysql.com/doc/relnotes/mysql/8.0/en/](/doc/relnotes/mysql/8.0/en/). + +* [Account Management Notes](news-8-0-20.html#mysqld-8-0-20-account-management "Account Management Notes") +* [Compilation Notes](news-8-0-20.html#mysqld-8-0-20-compiling "Compilation Notes") +* [Deprecation and Removal Notes](news-8-0-20.html#mysqld-8-0-20-deprecation-removal "Deprecation and Removal Notes") +* [JSON Notes](news-8-0-20.html#mysqld-8-0-20-json "JSON Notes") +* [Logging Notes](news-8-0-20.html#mysqld-8-0-20-logging "Logging Notes") +* [Optimizer Notes](news-8-0-20.html#mysqld-8-0-20-optimizer "Optimizer Notes") +* [Packaging Notes](news-8-0-20.html#mysqld-8-0-20-packaging "Packaging Notes") +* [Performance Schema Notes](news-8-0-20.html#mysqld-8-0-20-performance-schema "Performance Schema Notes") +* [Pluggable Authentication](news-8-0-20.html#mysqld-8-0-20-pluggable-auth "Pluggable Authentication") +* [SQL Syntax Notes](news-8-0-20.html#mysqld-8-0-20-sql-syntax "SQL Syntax Notes") +* [Test Suite Notes](news-8-0-20.html#mysqld-8-0-20-test-suite "Test Suite Notes") +* [X Plugin Notes](news-8-0-20.html#mysqld-8-0-20-xplugin "X Plugin Notes") +* [Functionality Added or Changed](news-8-0-20.html#mysqld-8-0-20-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-20.html#mysqld-8-0-20-bug "Bugs Fixed") + +### Account Management Notes + +* Previously, for a user to access definitions of routines the + user did not define, the user was required to have the global + [`SELECT`](/doc/refman/8.0/en/privileges-provided.html#priv_select) privilege, which is very + broad. The new [`SHOW_ROUTINE`](/doc/refman/8.0/en/privileges-provided.html#priv_show-routine) + privilege may be granted instead as a privilege with a more + restricted scope that permits access to routine definitions. + (That is, an administrator can rescind global + [`SELECT`](/doc/refman/8.0/en/privileges-provided.html#priv_select) from users that do not + otherwise require it and grant + [`SHOW_ROUTINE`](/doc/refman/8.0/en/privileges-provided.html#priv_show-routine) instead.) This + enables an account to back up stored routines without requiring + a broad privilege. + + [`SHOW_ROUTINE`](/doc/refman/8.0/en/privileges-provided.html#priv_show-routine) provides access to: + + + The contents of the + [`INFORMATION_SCHEMA.ROUTINES`](/doc/refman/8.0/en/information-schema-routines-table.html) + table. + + The [`SHOW CREATE FUNCTION`](/doc/refman/8.0/en/show-create-function.html) and + [`SHOW CREATE PROCEDURE`](/doc/refman/8.0/en/show-create-procedure.html) + statements. + + The [`SHOW FUNCTION CODE`](/doc/refman/8.0/en/show-function-code.html) and + [`SHOW PROCEDURE CODE`](/doc/refman/8.0/en/show-procedure-code.html) + statements. + + The [`SHOW FUNCTION STATUS`](/doc/refman/8.0/en/show-function-status.html) and + [`SHOW PROCEDURE STATUS`](/doc/refman/8.0/en/show-procedure-status.html) + statements. + + For upgrades from an older version of MySQL, any user who has + the global [`SELECT`](/doc/refman/8.0/en/privileges-provided.html#priv_select) privilege is + granted [`SHOW_ROUTINE`](/doc/refman/8.0/en/privileges-provided.html#priv_show-routine), if there is + not already some user who has + [`SHOW_ROUTINE`](/doc/refman/8.0/en/privileges-provided.html#priv_show-routine). + (WL #9049) + +### Compilation Notes + +* **Solaris:** + Clang and GCC now can be used for compiling MySQL on Solaris, + although both are experimental and cannot currently be used for + production code. + (Bug #30562248) +* On EL7 and EL8, **CMake** configuration was + adjusted to look for GCC 9 before GCC 8. Because + `libmysqlclient` ships with MySQL + distributions, client applications built against + `libmysqlclient` on those platforms are + affected and may need to be recompiled. + (Bug #30722756) +* On Windows, the **CMake** compiler-version check + for Visual Studio was updated to indicate that Visual Studio + 2019 is the currently supported version. (The version check can + be bypassed by running **CMake** with + [`-DFORCE_UNSUPPORTED_COMPILER=1`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_force_unsupported_compiler).) + (Bug #30688403) + +### Deprecation and Removal Notes + +* **JSON:** + Previously, it was possible to specify `ON + EMPTY` and `ON ERROR` clauses in + either order when invoking the + [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table) function. This runs + counter to the SQL standard, which stipulates that when + `ON EMPTY` is specified, it must always come + before any `ON ERROR` clause. For this reason, + specifying `ON ERROR` before `ON + EMPTY` is now deprecated, and trying to do so causes + the server to issue a warning. Support for the nonstandard + syntax will be removed in a future version of MySQL. + (WL #13512) +* The [`max_length_for_sort_data`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_length_for_sort_data) + system variable is now deprecated due to optimizer changes that + make it obsolete and of no effect. + (WL #13600) + + References: See also: Bug #30473261. +* The use of [`VALUES()`](/doc/refman/8.0/en/miscellaneous-functions.html#function_values) to access new + row values in + [`INSERT ... + ON DUPLICATE KEY UPDATE`](/doc/refman/8.0/en/insert-on-duplicate.html) statements is now deprecated, + and is subject to removal in a future MySQL release. Instead, + you should use aliases for the new row and its columns as + implemented in MySQL 8.0.19 and later. + + For example, the statement shown here uses + [`VALUES()`](/doc/refman/8.0/en/miscellaneous-functions.html#function_values) to access new row + values: + + ```None + INSERT INTO t1 (a,b,c) VALUES (1,2,3),(4,5,6) + ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b); + ``` + + Henceforth, you should instead use a statement similar to the + following, which uses an alias for the new row: + + ```None + INSERT INTO t1 (a,b,c) VALUES (1,2,3),(4,5,6) AS new + ON DUPLICATE KEY UPDATE c = new.a+new.b; + ``` + + Alternatively, you can employ aliases for both the new row and + each of its columns, as shown here: + + ```None + INSERT INTO t1 (a,b,c) VALUES (1,2,3),(4,5,6) AS new(m,n,p) + ON DUPLICATE KEY UPDATE c = m+n; + ``` + + For more information and examples, see + [INSERT ... ON DUPLICATE KEY UPDATE Statement](/doc/refman/8.0/en/insert-on-duplicate.html). + (WL #13325) + +### JSON Notes + +* The `rapidjson` library included with MySQL has + been upgraded to the GitHub snapshot of 16 January 2020. A fix + for a compiler error encountered when building from the snapshot + on Mac OS X has been added. + (Bug #30898701) + +### Logging Notes + +* Sending a `SIGHUP` signal to the server no + longer causes it to write a status report to the error log. + Other actions performed by the server in response to + `SIGHUP` continue to be done. See + [Unix Signal Handling in MySQL](/doc/refman/8.0/en/unix-signal-response.html). + + Similarly, **mysqladmin debug** no longer causes + the status report to be written. + (Bug #30578923) +* The `log_sink_json` JSON-format error log sink + now includes a `ts` (timestamp) in log + messages. The value is an integer indicating milliseconds since + the epoch (`'1970-01-01 00:00:00'` UTC). See + [Error Log Output Format](/doc/refman/8.0/en/error-log-format.html). + (WL #13786) + +### Optimizer Notes + +* Hash joins are now used any time a nested block loop would be + employed. This means that hash joins can be used for the + following types of queries: + + + Inner non-equi-joins + + Semijoins + + Antijoins + + Left outer joins + + Right outer joins + + This builds on work done for MySQL 8.0.18, and removes a + limitation in the implementation such that a hash join could be + used only with a query having at least one equi-join condition. + In addition, both inner and outer joins (including semijoins and + antijoins) can now employ batched key access (BKA), which + allocates join buffer memory incrementally so that individual + queries need not use up large amounts of resources that they do + not actually require for resolution. For more information, see + [Batched Key Access Joins](/doc/refman/8.0/en/bnl-bka-optimization.html#bka-optimization). + + This fix completes the task of replacing the executor used in + previous versions of MySQL with the iterator executor, including + replacement of the old index subquery engines that governed + queries of the form `WHERE + value IN (SELECT + column FROM + table WHERE + condition)` for those + `IN` queries which have not been converted into + semijoins, as well as queries materialized into the same form, + which depended on internals from the old executor. + + For more information and examples, see + [Hash Join Optimization](/doc/refman/8.0/en/hash-joins.html). + (Bug #30528604, Bug #30473261, Bug #30912972, WL #13377, WL #13476) +* This release implements several new index-level optimizer hints, + which function much like existing index hints that employ SQL + keywords such as `FORCE INDEX` and + `IGNORE INDEX`. These are intended to replace + the equivalent index hints, which will be deprecated in a future + MySQL release (and eventually removed). The new hints are listed + here, along with a brief description of each: + + + [`JOIN_INDEX`](/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-index-level): Forces MySQL + to use the specified index or indexes for any available + access method, such as `ref`, + `range`, + [`index_merge`](/doc/refman/8.0/en/switchable-optimizations.html#optflag_index-merge), and so on. + This is equivalent to the `FORCE INDEX FOR + JOIN` index hint. + + [`NO_JOIN_INDEX`](/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-index-level): Causes the + server to ignore the specified index or indexes for any + access method. The equivalent index hint is `IGNORE + INDEX FOR JOIN`. + + [`GROUP_INDEX`](/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-index-level): Makes the + server use the specified index or indexes for index scans + for `GROUP BY` operations. Equivalent to + `FORCE INDEX FOR GROUP BY`. + + [`NO_GROUP_INDEX`](/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-index-level): Forces + MySQL to ignore the specified index or indexes for index + scans for `GROUP BY` operations. The + equivalent index hint is `IGNORE INDEX FOR GROUP + BY`. + + [`ORDER_INDEX`](/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-index-level): Causes MySQL + to use the specified index or indexes for sorting rows. It + is equivalent to `FORCE INDEX FOR ORDER + BY`. + + [`NO_ORDER_INDEX`](/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-index-level): Keeps the + server from using the specified index or indexes for + performing row sorts. Equivalent to `IGNORE INDEX + FOR ORDER BY`. + + [`INDEX`](/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-index-level): Acts as the + combination of `JOIN_INDEX`, + `GROUP_INDEX`, and + `ORDER_INDEX`, forcing the server to use + the specified index or indexes for any and all scopes. + Equivalent to `FORCE INDEX`. + + [`NO_INDEX`](/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-index-level): Acts as the + combination of `NO_JOIN_INDEX`, + `NO_GROUP_INDEX`, and + `NO_ORDER_INDEX`; that is, it forces MySQL + to ignore the specified index or indexes for any and all + scopes. It is equivalent to the index hint `IGNORE + INDEX`. + + Consider the following query using index hints on a table having + the indicated columns and index: + + ```None + SELECT a,b FROM t1 USE INDEX FOR ORDER BY (i_ab) ORDER BY a; + ``` + + Using the index-level optimizer hints introduced in this + release, this query can be rewritten as shown here: + + ```None + SELECT /*+ ORDER_INDEX(t1 i_ab) */ a,b FROM t1 ORDER BY a; + ``` + + The new index-level optimizer hints can be used with + [`SELECT`](/doc/refman/8.0/en/select.html), + [`UPDATE`](/doc/refman/8.0/en/update.html), and + [`DELETE`](/doc/refman/8.0/en/delete.html) statements. (This is + unlike index hints using `FORCE INDEX` or + `IGNORE INDEX`, which can be used only with + `SELECT` and `UPDATE`.) Thus, + statements like the following are possible: + + ```None + UPDATE /*+ INDEX(t1 i_ab) */ t1 SET d = 1 + WHERE a = 1 AND b = 2 AND c = 3; + + DELETE /*+ INDEX(t1 i_a,i_c) */ FROM t1 + WHERE a = 1 AND b = 2 AND c = 3; + ``` + + Multiple hints can be specified within the same comment, like + this: + + ```None + DELETE /*+ INDEX(t1 i_a) JOIN_INDEX(t1 i_c) */ + FROM t1 WHERE a = 1 AND b = 2 AND c = 3; + ``` + + Index-level optimizer hints can be used concurrently with other + optimizer hints. When you do so, the index-level hints apply + first; the effects of any other optimizer hints are limited to + the set of indexes permitted by the index-level hints. + + Index-level hints can also be used when creating views, as shown + here: + + ```None + CREATE VIEW v1 AS + SELECT /*+ NO_INDEX(t1 i_a,i_b) */ a FROM t1 + WHERE b IN + (SELECT /*+ NO_INDEX(t1 i_ab,i_b) */ a FROM t1 WHERE a > 3) + ORDER BY a; + ``` + + If these index-level optimizer hints are used in the same + statement as index hints, the index hints are ignored. + + The new index-level optimizer hints are equivalent to + `FORCE INDEX` rather than `USE + INDEX`; in other words, using one or more of the + index-level optimizer hints means that a table scan is used only + if there is no way to use one of the named indexes to find rows + in the table. To cause MySQL to use the same index or set of + indexes as with a given instance of `USE + INDEX`, you can use `NO_INDEX`, + `NO_JOIN_INDEX`, + `NO_GROUP_INDEX`, + `NO_ORDER_INDEX`, or some combination of these. + + For more information and examples, see + [Index-Level Optimizer Hints](/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-index-level). + (WL #13538) + +### Packaging Notes + +* Binary packages that include `curl` rather than + linking to the system `curl` library have been + upgraded to use `curl` 7.69.0. + (Bug #30866333) +* For RPM packages, the **comp\_err** utility has + been moved to the `-test` subpackage and marked + as a test component. + (Bug #30716034) +* The bundled `libedit` library was upgraded to + version 3.1. + (Bug #28939380, Bug #20770875, Bug #22930525, Bug #22332089, Bug #27433491, Bug #27285445, WL #13534) +* The bundled LZ4 library was upgraded to version 1.9.2. This + fixes certain issues such as Bug #30369643 producing a + **mysqlpump** runtime error. + (WL #13690) + + References: See also: Bug #30369643. + +### Performance Schema Notes + +* The Performance Schema collected session-related statistics for + errors that can occur only globally and not per session. This is + no longer done, reducing memory overhead for error + instrumentation. Additionally, rows for global errors are no + longer included in error summaries reported per thread, account, + user, or host. + (Bug #30311574) + +### Pluggable Authentication + +* An LDAP server can be configured to delegate LDAP searches to + another LDAP server, a functionality known as LDAP referral. + However, enabling LDAP referral can cause searches to fail with + LDAP operation errors under certain conditions. To enable the + MySQL Enterprise Edition LDAP authentication plugins to avoid referral errors, the + new + [`authentication_ldap_simple_referral`](/doc/refman/8.0/en/pluggable-authentication-system-variables.html#sysvar_authentication_ldap_simple_referral) + and + [`authentication_ldap_sasl_referral`](/doc/refman/8.0/en/pluggable-authentication-system-variables.html#sysvar_authentication_ldap_sasl_referral) + system variables are available. These variables enable each + plugin to control whether the LDAP server should use referral + during MySQL authentication. See + [LDAP Search Referral](/doc/refman/8.0/en/ldap-pluggable-authentication.html#ldap-pluggable-authentication-ldap-referral). + (WL #12888) +* The MySQL Enterprise Edition SASL LDAP authentication plugin now supports + GSSAPI/Kerberos as an authentication method for MySQL clients + and servers on Linux. This is useful in Linux environments where + applications access LDAP using Microsoft Active Directory, which + has Kerberos enabled by default. See + [LDAP Authentication Methods](/doc/refman/8.0/en/ldap-pluggable-authentication.html#ldap-pluggable-authentication-auth-methods). + + This feature is available for all RPM and DEB packages for + Linux, but not for the TAR archive packages. + (WL #12888) + +### SQL Syntax Notes + +* Previously, the `INTO` clause for + [`SELECT`](/doc/refman/8.0/en/select.html) statements could appear at + either of two positions: + + + Before `FROM`: + + ```None + SELECT * INTO OUTFILE 'file_name' FROM table_name; + ``` + + Before a trailing locking clause: + + ```None + SELECT * FROM table_name INTO OUTFILE 'file_name' FOR UPDATE; + ``` + + `INTO` now can appear in a third position, at + the end of [`SELECT`](/doc/refman/8.0/en/select.html) statements: + + ```None + SELECT * FROM table_name FOR UPDATE INTO OUTFILE 'file_name'; + ``` + + Placing `INTO` at the end is the preferred + position. The position before a locking clause is now deprecated + and support for it will be removed in a future MySQL version. In + other words, `INTO` after + `FROM` but not at the end of the + [`SELECT`](/doc/refman/8.0/en/select.html) produces a warning. + + Additionally, some changes have been made for + [`UNION`](/doc/refman/8.0/en/union.html) with respect to + `INTO`. These + [`UNION`](/doc/refman/8.0/en/union.html) variants containing + `INTO` are syntactically correct and produce + the same result: + + ```None + ... UNION SELECT * FROM table_name INTO OUTFILE 'file_name'; + ... UNION (SELECT * FROM table_name) INTO OUTFILE 'file_name'; + ... UNION SELECT * INTO OUTFILE 'file_name' FROM table_name; + ... UNION (SELECT * INTO OUTFILE 'file_name' FROM table_name); + ``` + + However, the last two variants are confusing, as if they collect + information from the named table rather than the entire query + expression (the `UNION`). Those two + [`UNION`](/doc/refman/8.0/en/union.html) variants containing + `INTO` now are deprecated and support for them + will be removed in a future MySQL version. Thus: + + + In the trailing query block of a query expression, use of + `INTO` before `FROM` + produces a warning. + + In a parenthesized trailing block of a query expression, use + of `INTO` (regardless of its position + relative to `FROM`) produces a warning. + + The deprecations apply to all `INTO` forms: + `INTO OUTFILE`, `INTO + DUMPFILE`, and `INTO + var_list`. + (WL #13559) + +### Test Suite Notes + +* The + `perfschema.idx_compare_replication_applier_status` + test case was updated to store the old value of number of + transaction retries and compare it with the new value of number + of transaction retries. Thanks to Facebook for the contribution. + (Bug #30810627, Bug #98389) + +### X Plugin Notes + +* If the MySQL Server instance's client connections limit, as + specified by the + [`max_connections`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_connections) server system + variable, was reached while X Plugin was starting up, X Plugin + was unable to create a session to get the server configuration, + so failed to start. X Plugin now creates an administrative + session (using the `mysql_admin_session` + service) during startup, which is not subject to the client + connections limit. + (Bug #30894981) +* When an X Protocol session could not be initialized because + there were too many X Protocol connections already, the error + code 5011 Could not open session was + returned. The more relevant error code 1040 Too many + connections is now returned in this situation. + (Bug #30753637) +* An issue with validating JSON references caused an error when + creating a collection with a validation schema. + (Bug #30733330) +* During shutdown of a MySQL Server instance with X Protocol + connections to clients, a race condition in X Plugin could + cause invalid client connections to be accepted for processing. + Because invalid clients were ignored for client timeout + verification during shutdown, these clients blocked shutdown + until the timeout set by the + `mysqlx_wait_timeout` system variable was + reached, which defaults to 8 hours. To prevent this issue, + client timeout verification now includes clients that are in an + invalid state. + (Bug #30702685) +* When connecting to a MySQL 8.0 server, X Plugin set a different + collation for the session to that used by the + **mysql** client, which could cause issues with + queries that depended on the collation. X Plugin now uses the + `utf8mb4_0900_ai_ci` collation, which is the + default for the `utf8mb4` characterset. + (Bug #30516849) +* The worker threads for X Protocol connections were identified + as system threads on creation, and assigned to the + `SYS_default` resource group. This + identification meant they could not be assigned to user resource + groups for resource management purposes. They are now identified + as user threads and assigned to the + `USR_default` resource group. Note that + X Protocol does not currently support + `CREATE`, `ALTER`, + `DROP`, and [`SET RESOURCE + GROUP`](/doc/refman/8.0/en/set-resource-group.html) statements, but these statements can operate on + X Protocol connection threads using classic MySQL protocol + connections. + (Bug #30059288) +* X Plugin can now access the MySQL system variables as soon as + initialization starts, so the plugin install thread can set up + the required connectivity itself rather than starting a separate + thread. + (Bug #29127302) + +### Functionality Added or Changed + +* **Important Change:** + Previously, including any column of a blob type larger than + [`TINYBLOB`](/doc/refman/8.0/en/blob.html) or + [`BLOB`](/doc/refman/8.0/en/blob.html) as the payload in an + ordering operation caused the server to revert to sorting row + IDs only, rather than complete rows; this resulted in a second + pass to fetch the rows themselves from disk after the sort was + completed. Since [`JSON`](/doc/refman/8.0/en/json.html) and + [`GEOMETRY`](/doc/refman/8.0/en/spatial-type-overview.html) columns are implemented + internally as [`LONGBLOB`](/doc/refman/8.0/en/blob.html), this + caused the same behavior with these types of columns even though + they are almost always much shorter than the 4GB maximum for + `LONGBLOB` (or even the 16 MB maximum for + `MEDIUMBLOB`). The server now converts columns + of these types into packed addons in such cases, just as it does + `TINYBLOB` and `BLOB` columns, + which in testing showed a significant performance increase. + *The handling of + [`MEDIUMBLOB`](/doc/refman/8.0/en/blob.html) and + [`LONGBLOB`](/doc/refman/8.0/en/blob.html) columns in this regard + remains unchanged*. + + One effect of this enhancement is that it is now possible for + Out of memory errors to occur when trying + to sort rows containing very large (multi-megabtye) + `JSON` or `GEOMETRY` column + values if the sort buffers are of insufficient size; this can be + compensated for in the usual fashion by increasing the value of + the [`sort_buffer_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sort_buffer_size) system + variable. + (Bug #30400985, Bug #30804356) +* **InnoDB:** + The Contention-Aware Transaction Scheduling (CATS) algorithm, + which prioritizes transactions that are waiting for locks, was + improved. Transaction scheduling weight computation is now + performed a separate thread entirely, which improves computation + performance and accuracy. + + The First In First Out (FIFO) algorithm, which had also been + used for transaction scheduling, was removed. The FIFO algorithm + was rendered redundant by CATS algorithm enhancements. + Transaction scheduling previously performed by the FIFO + algorithm is now performed by the CATS algorithm. + + A `TRX_SCHEDULE_WEIGHT` column was added to the + [`INFORMATION_SCHEMA.INNODB_TRX`](/doc/refman/8.0/en/information-schema-innodb-trx-table.html) + table, which permits querying transaction scheduling weights + assigned by the CATS algorithm. + + The following `INNODB_METRICS` counters were + added for monitoring code-level transaction scheduling events: + + + `lock_rec_release_attempts` + + The number of attempts to release record locks. + + `lock_rec_grant_attempts` + + The number of attempts to grant record locks. + + `lock_schedule_refreshes` + + The number of times the wait-for graph was analyzed to + update transaction schedule weights. + + (WL #13486) +* **InnoDB:** + The storage area for the doublewrite buffer was moved from the + system tablespace to doublewrite files. Moving the doublewrite + buffer storage area out of the system tablespace reduces write + latency, increases throughput, and provides flexibility with + respect to placement of doublewrite buffer pages. The following + system variables were introduced for advanced doublewrite buffer + configuration: + + + [`innodb_doublewrite_dir`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_doublewrite_dir) + + Defines the doublewrite buffer file directory. + + [`innodb_doublewrite_files`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_doublewrite_files) + + Defines the number of doublewrite files. + + [`innodb_doublewrite_pages`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_doublewrite_pages) + + Defines the maximum number of doublewrite pages per thread + for a batch write. + + [`innodb_doublewrite_batch_size`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_doublewrite_batch_size) + + Defines the number of doublewrite pages to write in a batch. + + For more information, see + [Doublewrite Buffer](/doc/refman/8.0/en/innodb-doublewrite-buffer.html). + (WL #5655) +* [`EXPLAIN ANALYZE`](/doc/refman/8.0/en/explain.html#explain-analyze) can now be + stopped during execution using + [`KILL QUERY`](/doc/refman/8.0/en/kill.html) or + **CTRL-C**. + (Bug #30787515) +* [`EXPLAIN + FORMAT=TREE`](/doc/refman/8.0/en/explain.html) now displays `inversion` + information for windowing functions. + (Bug #30770631) +* [`EXPLAIN + FORMAT=TREE`](/doc/refman/8.0/en/explain.html) output has been improved to provide more + information about evaluated window functions, and to match that + supplied for regular aggregates. + (Bug #30573446, Bug #30582782) +* Configuring with the [`-DWITH_LTO=1`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_lto) + **CMake** option now works on macOS. + (Bug #30125902) +* You can now enable binary log transaction compression on a MySQL + server instance. When binary log transaction compression is + enabled, transaction payloads are compressed using the zstd + algorithm, and then written to the server's binary log file as a + single event (a `Transaction_payload_event`). + Compressed transaction payloads remain in a compressed state + while they are sent in the replication stream to replicas, other + Group Replication group members, or clients such as + **mysqlbinlog**. They are not decompressed by + receiver threads, and are written to the relay log still in + their compressed state. Binary log transaction compression + therefore saves storage space both on the originator of the + transaction and on the recipient (and for their backups), and + saves network bandwidth when the transactions are sent between + server instances. + + You can enable binary log transaction compression on a MySQL + server instance using the + [`binlog_transaction_compression`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_transaction_compression) + system variable, which defaults to `OFF`. You + can also use the + [`binlog_transaction_compression_level_zstd`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_transaction_compression_level_zstd) + system variable to set the level for the zstd algorithm that is + used for compression. This value determines the compression + effort, from 1 (the lowest effort) to 22 (the highest effort). + (WL #3549) +* A new option for the [`CHANGE MASTER + TO`](/doc/refman/8.0/en/change-master-to.html) statement, + `REQUIRE_TABLE_PRIMARY_KEY_CHECK`, enables a + replication slave to select its own policy for primary key + checks. When the option is set to `ON` for a + replication channel, the slave always uses the value + `ON` for the + [`sql_require_primary_key`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_require_primary_key) system + variable in replication operations, requiring a primary key. + When the option is set to `OFF`, the slave + always uses the value `OFF` for the + [`sql_require_primary_key`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_require_primary_key) system + variable in replication operations, so that a primary key is + never required, even if the master required one. When the + `REQUIRE_TABLE_PRIMARY_KEY_CHECK` option is set + to `STREAM`, which is the default, the slave + uses whatever value is replicated from the master for each + transaction. + + + For multisource replication, setting + `REQUIRE_TABLE_PRIMARY_KEY_CHECK` to + `ON` or `OFF` enables a + slave to normalize behavior across the replication channels + for different masters, and keep a consistent setting for the + [`sql_require_primary_key`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_require_primary_key) + system variable. Using `ON` safeguards + against the accidental loss of primary keys when multiple + masters update the same set of tables. Using + `OFF` allows masters that can manipulate + primary keys to work alongside masters that cannot. + + When `PRIVILEGE_CHECKS_USER` is set to + apply replication privilege checks to the channel, setting + `REQUIRE_TABLE_PRIMARY_KEY_CHECK` to + `ON` or `OFF` means that + the user account does not need session administration level + privileges to set restricted session variables, which are + required to change the value of + [`sql_require_primary_key`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_require_primary_key) to + match the master's setting for each transaction. + + (WL #13239) +* Since MySQL 8.0.19, compression has been supported for messages + sent over X Protocol connections. Connections can be compressed + if the server and the client agree on a compression algorithm to + use. By default, the server permits the Deflate, LZ4, and zstd + compression algorithms, or you can set the + `mysqlx_compression_algorithms` system variable + to include only the ones you permit. In MySQL 8.0.19, + X Protocol uses the library default compression level for each + algorithm, and the client cannot negotiate this. + + From MySQL 8.0.20, the client can request a specific compression + level during capability negotiations for an X Protocol + connection. X Protocol sets a maximum compression level for + each algorithm, which prevents the server from agreeing to high + compression levels that are requested by clients if that would + consume too much resource on the server. The maximum compression + levels are initially set to 5 for Deflate, 8 for LZ4, and 11 for + zstd. You can adjust these settings using the new + `mysqlx_deflate_max_client_compression_level`, + `mysqlx_lz4_max_client_compression_level`, and + `mysqlx_zstd_max_client_compression_level` + system variables. + + New default compression levels for X Protocol have also been + selected through performance testing as being a good trade-off + between compression time and network transit time. These + defaults are not necessarily the same as the library default for + each algorithm. They are applied if the client does not request + a compression level for the algorithm. The default compression + levels are initially set to 3 for Deflate, 2 for LZ4, and 3 for + zstd. You can adjust these settings using the new + `mysqlx_deflate_default_compression_level`, + `mysqlx_lz4_default_compression_level`, and + `mysqlx_zstd_default_compression_level` system + variables. + (WL #13034) + +### Bugs Fixed + +* **Incompatible Change:** + Some queries that used + [`ST_Contains()`](/doc/refman/8.0/en/spatial-relation-functions-object-shapes.html#function_st-contains) did not return any + results unless `> 0` was added. + + Note + + For upgrades from earlier versions of MySQL, you should + recreate spatial indexes in tables that have them. + + (Bug #30461595, Bug #97347) +* **Performance:** + Certain queries against tables with spatial indexes were not + performed as efficiently following an upgrade from MySQL 5.7 to + MySQL 8.0. + (Bug #94655, Bug #29488350) + + References: See also: Bug #89551, Bug #27499984. +* **NDB Cluster:** + `NDB` defines one `SPJ` worker + per node owning a primary partition of the root table. If this + table used read from any fragment replica, + [`DBTC`](/doc/ndb-internals/en/ndb-internals-kernel-blocks-dbtc.html) put all + `SPJ` workers in the same + [`DBSPJ`](/doc/ndb-internals/en/ndb-internals-kernel-blocks-dbspj.html) instance, which + effectively removed the use of some `SPJ` + workers. + (Bug #30639165) +* **NDB Cluster:** + Executing the `SHOW` command using an + **ndb\_mgm** client binary from NDB 8.0.16 or + earlier to access a management node running NDB 8.0.17 or later + produced the error message Unknown field: + is\_single\_user. + (Bug #30599413) + + References: See also: Bug #16275500. +* **InnoDB:** + A [`CREATE UNDO + TABLESPACE`](/doc/refman/8.0/en/create-tablespace.html) operation that specified an undo data file + name without specifying a path removed an existing undo data + file of the same name from the directory specified by + [`innodb_undo_directory`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_undo_directory) variable. + The file name conflict check was performed on the data directory + instead of the directory specified by the + [`innodb_undo_directory`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_undo_directory) variable. + (Bug #30908328, Bug #98628) +* **InnoDB:** + In debug builds, a regression introduced in MySQL 8.0.19 slowed + down mutex and rw-lock deadlock debug checks. + (Bug #30886393) + + References: This issue is a regression of: Bug #30628872. +* **InnoDB:** + Valgrind testing raised an error indicating that a conditional + jump or move depends on an uninitialized value. The error was a + false-positive due to invalid validation logic. + (Bug #30837136) +* **InnoDB:** + Missing barriers in + `rw_lock_debug_mutex_enter()` (in source file + `sync0debug.cc`) could cause a thread to wait + without ever being woken up. + (Bug #30819167) +* **InnoDB:** + To improve server initialization speed on Linux, + `posix_fallocate()` is now used to allocate + space for redo log files. + (Bug #30804431, Bug #98342) +* **InnoDB:** + A data dictionary table open function was implemented with + incorrect lock ordering. + (Bug #30782103, Bug #97825) +* **InnoDB:** + Changes to parallel read threads functionality introduced in + MySQL 8.0.17 caused a degradation in `SELECT + COUNT(*)` performance. Pages were read from disk + unnecessarily. + (Bug #30766089) +* **InnoDB:** + DDL logging was not performed for SQL operations executed by the + bootstrap thread using the + [`init_file`](/doc/refman/8.0/en/server-system-variables.html#sysvar_init_file) startup variable, + causing files to be left behind that should have been removed + during a post-DDL stage. + (Bug #30721214, Bug #98131) +* **InnoDB:** + Adding an index on a column cast as a JSON array on a table with + a specific number of records failed with an “Incorrect key + file for table” error. + (Bug #30709525, Bug #98098) +* **InnoDB:** + A Valgrind error reported that an uninitialized + `lock->writer_thread` value was used in a + conditional jump. + (Bug #30694177) +* **InnoDB:** + An internal buffer pool statistics counter + (`n_page_gets`) was partitioned by page number + to avoid contention when accessed by multiple threads. + (Bug #30604841, Bug #97822) +* **InnoDB:** + A tablespace import operation failed with a schema mismatch + error due to the `.cfg` file and the data + dictionary both containing default values for a column that was + added using `ALGORITHM=INSTANT`. An error + should only occur if default values differ. + (Bug #30561144) +* **InnoDB:** + A slow shutdown failed to flush some GTIDs, requiring recovery + of unflushed GTIDs from the undo log. + (Bug #30548229) +* **InnoDB:** + A broken alignment requirement in the code that allocates a + prefix in memory for Performance Schema memory allocations + caused a failure on MySQL builds optimized for macOS and + FreeBSD. + (Bug #30530857) +* **InnoDB:** + Adding a virtual column raised an assertion failure due to data + that was missing from the new data dictionary object created for + the table. + (Bug #30524263) +* **InnoDB:** + A required latch was not taken when checking the mode of an undo + tablespace. A required latch was also not taken when checking + whether an undo tablespace is empty. + (Bug #30509134) +* **InnoDB:** + Allocating an update undo log segment to an XA transaction for + persisting a GTID value before the transaction performed any + data modifications caused a failure. + (Bug #30456328) +* **InnoDB:** + A query executed on a partitioned table with a discarded + tablespace raised an assertion failure. + (Bug #30437407, Bug #97271) +* **InnoDB:** + The `row_upd_clust_rec_by_insert` function, + which marks a clustered index record as deleted and inserts an + updated version of the record into the clustered index, passed + an incorrect `n_ext` value (the total number of + external fields) to lower level functions, causing an assertion + failure. + (Bug #30437378) +* **InnoDB:** + During a cloning operation, writes to the data dictionary buffer + table at shutdown were too late, causing a failure. Newly + generated dirty pages were not being flushed. + (Bug #30427369, Bug #30405535, Bug #30405535) +* **InnoDB:** + An operation performed with the + `innodb_buffer_pool_evict` debug variable set + to `uncompressed` caused an assertion failure. + (Bug #30405531) +* **InnoDB:** + Read-write lock code (`rw_lock_t`) that + controls ordering of access to the boolean + `recursive` flag and the writer thread ID using + GCC builtins or `os_mutex` when the builtins + are not available, was revised to use C++ + `std::atomic` in some instances. Thanks to Yibo + Cai from ARM for the contribution. + (Bug #30401416, Bug #97150) +* **InnoDB:** + A failure occurred while upgrading from MySQL 5.7 to MySQL 8.0. + A server data dictionary object was missing information about + the `FTS_DOC_ID` column and + `FTS_DOC_ID_INDEX` that remain after dropping a + `FULLTEXT` index. + (Bug #30357954) +* **InnoDB:** + Unnecessary messages about parallel scans were printed to the + error log. + (Bug #30330448) +* **InnoDB:** + During upgrade from MySQL 5.7 to MySQL 8.0, clustered indexes + named `GEN_CLUST_INDEX` are renamed to + `PRIMARY`, which resulted in duplicate entries + for the clustered indexes being added to the + `mysql.innodb_index_stats` table. + (Bug #30330448) +* **InnoDB:** + Various internal functions computed write event slots in an + inconsistent manner. + (Bug #30228108, Bug #96519) +* **InnoDB:** + Under specific circumstances, it was possible that tablespace + encryption key information would not be applied during the redo + log apply phase of crash recovery. + (Bug #30209760) +* **InnoDB:** + A file operation failure caused the page tracking archiver to + fail, which in turn caused the main thread to hang, resulting in + an assertion failure. Also, incorrectly, the page tracking + archiver remained enabled in + [`innodb_read_only`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_read_only) mode. + (Bug #30202643) +* **InnoDB:** + An index corruption error was reported when attempting to import + a tablespace containing a table column that was added using + `ALGORITHM=INSTANT`. The error was due to + missing metadata associated with the instantly added column. + (Bug #30191523, Bug #96477) +* **InnoDB:** + A transaction attempting to fetch an LOB record encountered a + null LOB reference, causing an assertion failure. However, the + null LOB reference was valid in this particular scenario because + the LOB value was not yet fully written. + (Bug #30144303) +* **InnoDB:** + During a parallel read operation, the rollback of a table load + operation while [`autocommit`](/doc/refman/8.0/en/server-system-variables.html#sysvar_autocommit) was + disabled resulted in a server to exit due to assertion code that + did not account for the possibility of tree structure changes + during a parallel read. + (Bug #30060690) +* **InnoDB:** + The current size value maintained in a rollback segment memory + object was found to be invalid, causing an assertion failure in + function `trx_purge_free_segment()`. A + validation routine + (`trx_rseg_t::validateCurrSize()`) was added to + verify the current size value. + (Bug #29947027) +* **InnoDB:** + A prepared statement executed with invalid parameter values + raised an assertion failure. + (Bug #29880907) +* **InnoDB:** + An add column operation caused an assertion failure. The failure + was due to a dangling pointer. + (Bug #29866408) + + References: This issue is a regression of: Bug #28491099. +* **InnoDB:** + Updating certain `InnoDB` system variables that + take string values raised invalid read errors during Valgrind + testing. + (Bug #29717909, Bug #95215) +* **InnoDB:** + Redo log records for modifications to undo tablespaces increased + in size in MySQL 8.0 due to a change in undo tablespace ID + values, which required additional bytes. The change in redo log + record size caused a performance regression in workloads with + heavy write I/O. To address this issue, the redo log format was + modified to reduce redo log record size for modifications to + undo tablespaces. + (Bug #29536710) +* **InnoDB:** + Additional information about `InnoDB` file + writes, including progress data, is now printed to the error + log. + (Bug #29472295, Bug #94634) +* **InnoDB:** + An insert statement on a table with a spatial index raised a + record type mismatch assertion due to a tuple corruption. + (Bug #29465567) +* **InnoDB:** + A function that calculates undo log record size could calculate + an incorrect length value in the case of a corrupted undo log + record, resulting in a malloc failure. Assertion code was added + to detect incorrect calculations. + (Bug #29448406, Bug #82734) +* **Replication:** + While an SQL statement was in the process of being rewritten for + the binary log so that sensitive information did not appear in + plain text, if a [`SHOW PROCESSLIST`](/doc/refman/8.0/en/show-processlist.html) + statement was used to inspect the query, the query could become + corrupted when it was written to the binary log, causing + replication to stop. The process of rewriting the query is now + kept private, and the query thread is updated only when + rewriting is complete. + (Bug #30569003, Bug #97531, Bug #30654405) +* **Replication:** + When a [`GRANT`](/doc/refman/8.0/en/grant.html) or + [`REVOKE`](/doc/refman/8.0/en/revoke.html) statement is only + partially executed, an incident event is logged in the binary + log, which makes the replication slave's applier thread stop so + that the slave can be reconciled manually with the master. + Previously, if a failed [`GRANT`](/doc/refman/8.0/en/grant.html) or + [`REVOKE`](/doc/refman/8.0/en/revoke.html) statement was the first + statement executed in the session, no GTID was applied to the + incident event (because the cache manager did not yet exist for + the session), causing an error on the replication slave. Also, + no incident event was logged in the situation where a + [`GRANT`](/doc/refman/8.0/en/grant.html) statement created a user + but then failed because the privileges had been specified + incorrectly, again causing an error on the replication slave. + Both these issues have now been fixed. + (Bug #30566518, Bug #30324661) +* **Replication:** + Compression is now triggered for the + `mysql.gtid_executed` table when the + `thread/sql/compress_gtid_table` thread is + launched after the server start, and the effects are visible + when the compression process is complete. + (Bug #30541799) +* **Replication:** + In the event of an unplanned disconnection of a replication + slave from the master, the reference to the master's dump thread + might not be removed from the list of registered slaves, in + which case statements that accessed the list of slaves would + fail. The issue has now been fixed. + (Bug #29915479) +* **Replication:** + When a partitioned table was involved, the server did not + correctly handle the situation where a row event could not be + written to the binary log due to a lack of cache space. An + appropriate error is now returned in this situation. + (Bug #29848931) +* **Replication:** + With the settings + [`binlog_format=MIXED`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_format), + [`tx_isolation=READ-COMMITTED`](/doc/refman/5.7/en/server-system-variables.html#sysvar_tx_isolation), + and [`binlog_row_image=FULL`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_row_image), an + `INSERT ... SELECT` query involving a + transactional storage engine omitted any columns with a null + value from the row image written to the binary log. This + happened because when processing `INSERT ... + SELECT` statements, the columns were marked for inserts + before the binary logging format was selected. The issue has now + been fixed. + (Bug #29110804, Bug #93423) +* **Replication:** + Under certain conditions, replication of conditional comments + could fail. + (Bug #28388217) +* **Group Replication:** + The thread used by the Group Replication message service was not + correctly registered by the Performance Schema instrumentation, + so the thread actions were not visible in Performance Schema + tables. + (Bug #30824676) +* **Group Replication:** + Group Replication initiates and manages cloning operations for + distributed recovery, but group members that have been set up to + support cloning may also participate in cloning operations that + a user initiates manually. In releases before MySQL 8.0.20, you + could not initiate a cloning operation manually if the operation + involved a group member on which Group Replication was running. + From MySQL 8.0.20, you can do this, provided that the cloning + operation does not remove and replace the data on the recipient. + The statement to initiate the cloning operation must therefore + include the `DATA DIRECTORY` clause if Group + Replication is running. + (Bug #30798640) +* **Group Replication:** + For Group Replication channels, issuing the + [`CHANGE MASTER TO`](/doc/refman/8.0/en/change-master-to.html) statement with + the `PRIVILEGE_CHECKS_USER` option while Group + Replication was running caused the channel's relay log files to + be deleted. Transactions that had been received and queued in + the relay log, but not yet applied, could be lost in this + situation. The [`CHANGE MASTER TO`](/doc/refman/8.0/en/change-master-to.html) + statement can now only be issued when Group Replication is not + running. + (Bug #30655369) +* **Group Replication:** + The Group Replication failure detection mechanism raises a + suspicion if a server stops sending messages, and the member is + eventually expelled provided that a majority of the group + members are still communicating. However, the failure detection + mechanism did not take into account the situation where one or + more of the group members in the majority had actually already + been marked for expulsion, but had not yet been removed from the + group. Where the network was unstable and members frequently + lost and regained connection to each other in different + combinations, it was possible for a group to end up marking all + its members for expulsion, after which the group would cease to + exist and have to be set up again. + + The Group Replication Group Communication System (GCS) now + tracks the group members that have been marked for expulsion, + and treats them as if they were in the group of suspect members + when deciding if there is a majority. This ensures at least one + member remains in the group and the group can continue to exist. + When an expelled member has actually been removed from the + group, GCS removes its record of having marked the member for + expulsion, so that the member can rejoin the group if it is able + to. + (Bug #30640544) +* **Group Replication:** + Performance Schema tables could not be accessed on a MySQL + server with Group Replication that was running under high load + conditions. + (Bug #30112711, Bug #30675790) +* **Group Replication:** + Internal queries from Group Replication to the Performance + Schema for statistics on local group members failed if they + occurred simultaneously with changes to the group's membership. + Locking for the internal queries has been improved to fix the + issue. + (Bug #30049349, Bug #30791583, Bug #30963553) +* **Group Replication:** + During the Group Replication distributed recovery process, if a + joining member is unable to complete a remote cloning operation + with any donor from the group, it uses state transfer from a + donor's binary log to retrieve all of the required data. + However, if the last attempted remote cloning operation was + interrupted and left the joining member with incomplete or no + data, an attempt at state transfer immediately afterwards could + also fail. Before attempting state transfer following a failed + remote cloning operation, Group Replication now checks that the + remote cloning operation did not reach the stage of removing + local data from the joining member. If data was removed, the + joining member leaves the group and takes the action specified + by the + [`group_replication_exit_state_action`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_exit_state_action) + system variable. + (Bug #29669099, Bug #29944828) +* **Group Replication:** + An earlier change to reduce Performance Schema memory + instrumentation overhead had the unintended effect of causing + Group Replication performance degradation. + (Bug #28719976) + + References: This issue is a regression of: Bug #27500610. +* **Group Replication:** + Before taking certain actions, Group Replication checks what + transactions are running on the server. Previously, the service + used for this check did not count transactions that were in the + commit phase, which could result in the action timing out. Now, + transactions that are in the commit phase are included in the + set of currently ongoing transactions. + (Bug #28327838) +* **JSON:** + When [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table) was used as + part of an [`INSERT`](/doc/refman/8.0/en/insert.html) statement in + strict mode, conversion errors handled by any `ON + ERROR` clause could cause the `INSERT` + to be rejected. Since errors are handled by an `ON + ERROR` clause, the statement should not be rejected + unless `ERROR ON ERROR` is actually specified. + + This issue is fixed by ignoring warnings when converting values + to the target type if `NULL ON ERROR` or + `DEFAULT ... ON ERROR` has been specified or is + implied. + (Bug #30628330) +* **JSON:** + The output from [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table) was + not always correct when used in views. This fix corrects the + following issues: + + + Column names were not quoted, causing syntax errors when + quoting was needed for these. + + Some column types were misreported. + + Some column type attributes such as UNSIGNED were lost. + + Column character set and collation were lost. + + (Bug #30263373) +* **JSON:** + The functions [`JSON_SCHEMA_VALID()`](/doc/refman/8.0/en/json-validation-functions.html#function_json-schema-valid) + and + [`JSON_SCHEMA_VALIDATION_REPORT()`](/doc/refman/8.0/en/json-validation-functions.html#function_json-schema-validation-report) + formerly checked to ensure that their arguments were convertible + to [`JSON`](/doc/refman/8.0/en/json.html) each time a prepared + statement including these was executed, which was neither + efficient nor necessary. Now in such cases, the check is + performed only once, when the statement is prepared. + (Bug #97878, Bug #30622327) +* Privilege requirements were checked incorrectly for stored + objects with a `DEFINER` that has the + [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) privilege. + (Bug #31077699) +* A number of errors reported by Clang in the documentation + generated from the MySQL sources have been corrected. + (Bug #30956093) +* On FreeBSD, the krb5 package is a now a dependency. + (Bug #30887620) +* If a query contained multiple references to the same common + table expression (CTE) and a pseudo-comment crossed borders of + the CTE definition, the parser failed with confusing syntax + error messages. + (Bug #30871301) +* For installation using Debian packages, the + `/var/run/mysqld` directory was not created. + (Bug #30855015, Bug #98484) +* **mysqlslap** did not shut down its threads + properly when SQL statements returned an error. This could + result in attempts to free already freed memory. + (Bug #30850310) +* When X Plugin was attempting to add a document to a collection + as either an insertion or an update in the case of a duplicate + key, in the case where the document failed a unique key + constraint in a field other than the primary key, the error + returned by X Plugin did not state that this was the cause of + the issue. The appropriate error is now returned. + (Bug #30843865) +* An integer value generated by transformations in the resolver + was supplied to a test which expected a boolean. + (Bug #30837240) +* A query using an [`IN`](/doc/refman/8.0/en/comparison-operators.html#operator_in) expression that + accessed one or more columns holding large string values could + lead to a memory leak. + (Bug #30814171) +* Statements did not work properly when the target of a + [`DELETE`](/doc/refman/8.0/en/delete.html) was a common table + expression. + (Bug #30796015, Bug #98330) +* Starting the server with + [`create_admin_listener_thread`](/doc/refman/8.0/en/server-system-variables.html#sysvar_create_admin_listener_thread) + enabled and without + [`admin_address`](/doc/refman/8.0/en/server-system-variables.html#sysvar_admin_address) enabled caused an + abnormal exit during the server shutdown process. + (Bug #30785609) +* When a table had both a primary key and a secondary key on the + same column, but for different lengths, the range optimizer + chose the wrong key part in the secondary index for comparing + range values. + (Bug #30783011) +* In some cases, errors caused when `DISTINCT` + was used with an aggregate function whose argument was of an + incorrect type were not propagated correctly. + (Bug #30782687) +* For replication using compression, the slave could raise an + assertion if the master was restarted. + (Bug #30774692) +* For debug builds, the server could exit trying to print an + optimizer trace. + (Bug #30773218, Bug #98258) +* The + [`mysql_real_connect_nonblocking()`](/doc/c-api/8.0/en/mysql-real-connect-nonblocking.html) + C API function exhibited blocking behavior. + (Bug #30771233) +* With [`LOCK TABLES`](/doc/refman/8.0/en/lock-tables.html) active, while + processing `INFORMATION_SCHEMA` queries, the + server could attempt to lock internal temporary tables (which + need no locks), causing an assertion to be raised. + (Bug #30764651, Bug #98221) +* The **mysqldump** internal network timeout was + increased from 700 to 86400 seconds to accommodate connecting to + busy or unresponsive servers. + (Bug #30755992, Bug #98203) +* Configuring with + `-DWITH_SASL=path/to/custom/installation` + inadvertently caused `libsasl` to be linked + into the `daemon_memcached` plugin. + (Bug #30755301) +* After deleting the temporary table associated with a window + function's frame buffer, the temporary table parameter for the + frame buffer was not cleaned up, causing string buffers + associated with copy fields not to be freed properly. + (Bug #30752366) +* The `-libs-compat` RPM package is now built + with system `zlib` to avoid problems with + unrestricted export of symbols in + `libmysqlclient.so.18`. + (Bug #30722389, Bug #98130) +* The server exited histogram sampling prematurely, causing an + assertion failure. An unnecessary boolean variable that marked + the completion of a sampling operation was removed. + (Bug #30717778) +* When removing a `WHERE` condition because one + of the participating conditions was always false, a materialized + derived table was not cleaned up properly, resulting in a memory + leak. + (Bug #30712243) +* Multiple comparisons with the same + [`GEOMETRY`](/doc/refman/8.0/en/spatial-type-overview.html) value were not always + handled correctly. + (Bug #30697042) + + References: See also: Bug #30306306. +* [`MIN()`](/doc/refman/8.0/en/aggregate-functions.html#function_min) and + [`MAX()`](/doc/refman/8.0/en/aggregate-functions.html#function_max) could return an incorrect + value for some queries if a `WHERE` clause + containing an `IN ()` subquery was added. + (Bug #30691682, Bug #98047) +* Server startup failed if MySQL Enterprise Firewall was enabled at startup but the + whitelist and user tables were missing. + (Bug #30690181) +* For prepared statements, re-execution could cause a server exit + if a cleaned-up materialized temporary table was still being + referred to. + (Bug #30674598) +* The + [`ER_WARN_DEPRECATED_SQL_CALC_FOUND_ROWS`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_warn_deprecated_sql_calc_found_rows) + and + [`ER_WARN_DEPRECATED_FOUND_ROWS`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_warn_deprecated_found_rows) + error messages were incorrectly categorized in the range of + messages meant to be written to the error log. They are now + correctly categorized as messages meant to be sent to clients. + The old errors are now designated as + `OBSOLETE_ER_WARN_DEPRECATED_SQL_CALC_FOUND_ROWS` + and `OBSOLETE_ER_WARN_DEPRECATED_FOUND_ROWS` in + the range of error-log messages. + (Bug #30673043) +* Some joins within subqueries where an outer query used + `EXISTS` or `NOT EXISTS` were + not always handled correctly. + (Bug #30671329) +* Queries using `ORDER BY + constant` are permitted but + an `ORDER BY` clause of this sort should not + have any effect on the result; such queries were not always + handled correctly. + (Bug #30669493) +* A missing out-of-bounds check in + `wild_case_match()` caused a pointer to read + out of bounds. + (Bug #30668886) +* The `strconvert()` function was not safe for + conversions between `filename` and + `utf8_general_ci` strings. + (Bug #30668847) +* Some filesorts using keys of fixed length were not always + handled correctly. + (Bug #30665034) +* When performing a hash join on two string columns that were + potentially very large (in particular, + [`BLOB`](/doc/refman/8.0/en/blob.html) columns with `PAD + SPACE` collations), MySQL stored the entire sort key in + the row, which impacted performance by requiring large amounts + of memory. Now only a collation-aware hash is stored, with an + added equality comparison prevent a wrong answer, even in the + event of a 64-bit hash collision. + (Bug #30664831) +* When at least two tables were joined to at least two other + tables using a semijoin, and the join optimizer chose to use a + loose scan, it was possible to place both of the left tables + below the deduplicating nested loop iterator, leading to + excessive deduplication. We fix this by treating a loose scan + across multiple tables as a separate internal structure. + (Bug #30659810) +* In unions of a [`const`](/doc/refman/8.0/en/explain-output.html#jointype_const) table + and zero or more known-zero expressions, derived tables of + exactly one row could be read incorrectly as having zero rows. + (Bug #30655712, Bug #97967) +* A MySQL 8.0.19 patch set an invalid + `INFORMATION_SCHEMA` and data dictionary + version number. Assertion code was added to prevent future + version information errors. + (Bug #30645158, Bug #97948) + + References: This issue is a regression of: Bug #29871530. +* When setting up the iterator tree, the optimizer now filters + away and subsequently ignores conditions which are known to be + trivially true. + (Bug #30644591) +* Under some conditions, [`SHOW + COLUMNS`](/doc/refman/8.0/en/show-columns.html) on a temporary + [`MERGE`](/doc/refman/8.0/en/merge-storage-engine.html) table could raise an + assertion or cause a server exit. + (Bug #30640463) + + References: This issue is a regression of: Bug #28811287, Bug #92834. +* The Event Scheduler had a memory leak. + (Bug #30628268) +* Using the asynchronous C API functions could result in freeing + already freed memory. + (Bug #30596999, Bug #97805) +* On tables containing a `CHECK` constraint, + certain simple queries were inefficient due to excessive memory + allocation and Performance Schema calls. + (Bug #30594613) +* Under certain circumstances, a memcached command could result in + reading an uninitialized memory buffer, causing a failure. + (Bug #30592346) +* A race condition could occur between `InnoDB` + issuing requests for schema and table metadata while filling + [`INFORMATION_SCHEMA.INNODB_TABLES`](/doc/refman/8.0/en/information-schema-innodb-tables-table.html), + and the schema being dropped, leading to user queries on + `INNODB_TABLES` reporting an error. + (Bug #30591967) +* The client library could be induced into an infinite loop by a + malicious server. + (Bug #30581726) +* Using [`ALTER USER`](/doc/refman/8.0/en/alter-user.html) to reset an + account `MAX_USER_CONNECTIONS` value did not + take effect until all current account connections terminated, if + there were any. + (Bug #30578217, Bug #97735) +* When the optimizer sets up a weedout, it notifies all tables + that are part of the weedout that they should provide row IDs. + For confluent weedouts (weedouts returning at most one row), the + optimizer expects that the executor handles the weedout without + row IDs. In the iterator executor, confluent weedouts are + implemented using `LIMIT 1`; the normal weedout + iterator does not handle confluent weedouts, and thus always + expects row IDs. In the case of a confluent weedout on the right + side of an outer join, the confluent weedout was processed as a + normal weedout, causing the iterator executor to ask for row IDs + where the tables did not supply them. Now in such cases, the + `LIMIT 1` optimization is also applied. + (Bug #30566549, Bug #30282693) +* [`SET + PERSIST`](/doc/refman/8.0/en/set-variable.html) could fail due to attempting to persist + variables to the wrong directory. + (Bug #30561982) +* Within a stored program with an error handler defined for the + error condition of accessing a nonexistent table, the handler + was not invoked if the table was nonexistent because it was + named in a nonexistent database. + (Bug #30561920, Bug #97682) +* The duplicate weedout optimization strategy employed by MySQL + (see [Optimizing IN and EXISTS Subquery Predicates with Semijoin Transformations](/doc/refman/8.0/en/semijoins.html)) uses an internal table of row + IDs which it has already seen, with a unique index on the column + containing these IDs. When the key for the unique index became + too large, which could happen with very large row IDs, the + server reverted to deduplication by hash key instead, with a + separate index (not unique) over the hash field only, as with + other temporary tables. Because the latter index was not + properly initialized, affected queries were not executed + properly and could lead to a premature exit. + (Bug #30556257) +* For debug builds, under [`LOCK + TABLES`](/doc/refman/8.0/en/lock-tables.html), the server could mishandle materialized + temporary tables and raise an assertion. + (Bug #30476213, Bug #97404) +* The internal array of materialized query blocks + `SELECT_LEX_UNIT::m_query_blocks_to_materialize` + was not reset between executions, which meant that it pointed to + objects which were no longer valid when a prepared statement was + executed a second time, causing the second execution to fail. + (Bug #30438038) +* Altering column collations did not affect unique indexes until a + server restart. + (Bug #30386119, Bug #97103) +* When using roles, the [`EXECUTE`](/doc/refman/8.0/en/privileges-provided.html#priv_execute) + privilege for stored functions was treated as a privilege for + stored procedures. As a result, it was not possible to use + [`EXECUTE`](/doc/refman/8.0/en/privileges-provided.html#priv_execute) as a role privilege for + functions. + (Bug #30376231) +* A materialized subquery including a condition in which a column + value was used as input to a nondeterministic function produced + incorrect results. + (Bug #30368937) +* Several fixes were applied to the `InnoDB` + memcached plugin. The fixes addressed potential deadlock issues, + issues related to connection list latches, and removal of an + obsolete flush mutex. + (Bug #30354225) +* Strings that used the `utf8mb4_0900_bin` + collation could not be compared with `utf8mb4` + strings that used a different collation. Now the comparison is + done by using `utf8mb4_0900_bin` for both + strings. + (Bug #30350111) +* During optimization, MySQL removes conditions in which all + arguments are considered equal; for example, `1 <> + 1` is removed and replaced with + `false`. In doing so, conditions containing + non-deterministic arguments were also removed, which caused a + condition such as [`RAND() < + RAND()`](/doc/refman/8.0/en/mathematical-functions.html#function_rand) to be considered an impossible condition. Now, + the optimizer no longer removes conditions containing + nondeterministic arguments. + (Bug #30311271) +* Scheduling of events could be disturbed by removing events. + (Bug #30301356, Bug #96849) +* The Event Scheduler reported warnings for Valgrind builds. + (Bug #30301340) +* Shutting down the server while using the clone plugin raised a + Valgrind error. + (Bug #30248419) +* If the `mysqld-auto.cnf` file was malformed, + the server did not start (expected), but did not report any + error (unexpected). + (Bug #30169731, Bug #96501) +* [`UPDATE`](/doc/refman/8.0/en/update.html) statements could give an + inconsistent number of rows matched (found rows) in cases where + not all matched rows were updated, depending on the reason for + rows not being updated. For example, rows not updated due to + being updated through a view with a `WITH CHECK + OPTION` clause were not counted as matching rows, + whereas rows not updated due to a failing `CHECK + CONSTRAINT` were counted. For consistency, rows that + fail a `WITH CHECK OPTION` clause now are + counted as matching rows. + (Bug #30158954) +* When restarting the MySQL server on a cloned directory, + `InnoDB` reported an error indicating that it + could not find a tablespace file for a statistics table that was + dropped by the server previously. + (Bug #30093799) +* The server did not handle correctly a `UNION` + in which one of the queries contained a subquery that used + `ORDER BY`. + (Bug #29952565) +* For `INFORMATION_SCHEMA` queries, a race + condition could result in multiple attempts to insert a key when + updating the dynamic statistics tables, producing a + duplicate-key error. + (Bug #29948755, Bug #95929) +* [`SHOW CREATE VIEW`](/doc/refman/8.0/en/show-create-view.html) could fail with + an illegal mix of collations for views defined on a function + that returns a string. + (Bug #29904087) +* The Performance Schema could fail to remove thread + instrumentation when a thread was deleted. + (Bug #29859605) +* A query with a `WHERE` clause whose predicate + contained a numeric value in scientific notation was not handled + correctly. + + In addition, attempting to insert a particular integer specified + as a string caused a server exit when the string-to-integer + conversion was not successful. + (Bug #29723340, Bug #30441969) +* An internal interface was added for retrieving and parsing + errors that occur on the donor MySQL server instance + (`ER_CLONE_DONOR` errors) and for checking if + data on the recipient has been dropped. + (Bug #29682642) +* It was not possible to drop any columns from a table when the + `DEFAULT` value. + (Bug #29661106) +* For the `CONNECTION_CONTROL` plugin, the + Performance Schema instrumentation used keys that were not + discoverable to the Performance Schema unless the associated + code actually executed. + (Bug #29539976) +* For a nullable column `c`, the optimizer now + recognizes when the conditions `c < c`, + `c > c`, and `c <> c` + are always false and need not be evaluated for every row. Thanks + to Daniel Black for the contribution. (For nonnullable columns, + the optimizer already recognized always-false conditions.) + (Bug #29115386, Bug #93642) +* Reinitialization of character sets from + `Index.xml` could cause a use-after-free + error. + (Bug #28956360, Bug #93276) +* The `sys` schema + [`ps_setup_reset_to_default()`](/doc/refman/8.0/en/sys-ps-setup-reset-to-default.html) + procedure used MySQL 5.7 defaults, not MySQL 8.0 defaults. + (Bug #27636611) +* Some connection encryption ciphers did not work. + (Bug #27045306) +* Previously, **mysqlpump** read the + `[mysql_dump]` and `[client]` + groups from option files. **mysqlpump** now + additionally reads the `[mysqlpump]` group. The + `[mysql_dump]` group is still accepted but is + deprecated. + (Bug #24733245, Bug #83144) +* For a query of the form + [`SELECT DISTINCT ... + ORDER BY ...`](/doc/refman/8.0/en/select.html), when the `ORDER BY` was + pushed down onto the first table in the join, the result was not + always sorted in the correct order. + (Bug #98217, Bug #30760534) +* The `NULL` indicator was not properly written + for items used as variable-length keys, such that all such items + were assumed to be not `NULL`, which was + considered equal to the empty string when using certain + collations. One visible effect of this issue was that ordering + by an expression using a nullable string was sometimes not + performed correctly. An example of such a query, where column + `c1` contains both `NULL` and + empty string values, is shown here: + + ```None + SELECT c1, SUBSTR(c1, 1) AS c2 FROM t ORDER BY c2; + ``` + + (Bug #98035, Bug #30687020) +* A query returned inaccurate results when an expression in a + `GROUP BY` clause used a column name differing + in case from that used for the name of the column when the table + containing this column was created. An example of this would be + when the query used `GROUP BY id` although the + column name as shown in the original `CREATE + TABLE` statement was `ID`. + + This occurred because, the server performed case-sensitive + comparisons of column names in expressions with names of columns + in tables. This issue is fixed by ensuring that such comparisons + are performed in a case-insensitive fashion as expected. + (Bug #97628, Bug #98222, Bug #30541701, Bug #30761372) +* A multi-table [`UPDATE`](/doc/refman/8.0/en/update.html) statement + which updated a table joined to a derived table that joined two + other tables was not optimized properly as it had been in MySQL + 5.6, instead being treated as if + `STRAIGHT_JOIN` had been used with the subquery + creating the derived table. + (Bug #97418, Bug #30488700) +* [`EXPLAIN`](/doc/refman/8.0/en/explain.html) now uses `hash + join` instead of `block nested loop`, + since the latter no longer exists and is replaced by a hash join + in nearly all cases. + (Bug #97299, Bug #30444550) +* References to columns from tables of outer query blocks in the + `ON` condition of a join did not work, and + could be used only in a `WHERE`. The fix for + this problem means that a query such as this one now works + correctly: + + ```None + SELECT o.order_date FROM orders o + WHERE o.order_date IN ( SELECT c.contact_name FROM customers c + INNER JOIN order_details od + ON o.order_id = od.discount ); + ``` + + Previously this had to be rewritten as shown here: + + ```None + SELECT o.order_date FROM orders o + WHERE o.order_date IN ( SELECT c.contact_name FROM customers c + INNER JOIN order_details od + ON 1 + WHERE o.order_id = od.discount ); + ``` + + References to other tables of the same `FROM` + clause as the join, as in the query `SELECT * FROM t1 + CROSS JOIN (t2 LEFT JOIN t3 ON t1.c=3)`, are not outer + references and remain forbidden. In this case, a lateral join is + required, like this: `SELECT * FROM t1 JOIN LATERAL + (SELECT * FROM t2 LEFT JOIN t3 ON t1.c=3)`. + (Bug #96946, Bug #30350696) +* The execution plan for a query that filtered on the first column + of a composite hash index wrongly used this index, producing + erroneous results. + (Bug #94737, Bug #29527115) +* References to columns from tables of outer query blocks in an + `ON` condition of a `JOIN` did + not work, and could be used only in a `WHERE`. + The fix for this problem means that a query such as this one now + works correctly: + + ```None + SELECT o.order_date FROM orders o + WHERE o.order_date IN ( SELECT c.contact_name FROM customers c + INNER JOIN order_details od + ON o.order_id = od.discount ); + ``` + + Previously this had to be rewritten as shown here: + + ```None + SELECT o.order_date FROM orders o + WHERE o.order_date IN ( SELECT c.contact_name FROM customers c + INNER JOIN order_details od + ON 1 + WHERE o.order_id = od.discount ); + ``` + + References to other tables of the same `FROM` + clause as the `JOIN`, as in the query + `SELECT * FROM t1 CROSS JOIN (t2 LEFT JOIN t3 ON + t1.c=3)`, are not outer references and remain + forbidden. In this case, a lateral join is required, like this: + `SELECT * FROM t1 JOIN LATERAL (SELECT * FROM t2 LEFT + JOIN t3 ON t1.c=3)`. + (Bug #35242, Bug #96946, Bug #11748138, Bug #30350696) +* There could be a mismatch between the version of OpenSSL used to + build the server and the version used for other parts of MySQL + such as libraries or plugins. This could cause certain features + not to work, such as the LDAP authentication plugins. Now the + same version of OpenSSL is used for building everything. + (WL #13759) +* Previous work in MySQL 8.0 to optimize impossible expressions + such as `a=b AND FALSE` as + `FALSE` could make for less efficient execution + when such expressions appeared as outer join conditions, due to + the fact that the join was interpreted as a Cartesian product + followed by a filter. + (Bug #8202, Bug #89739, Bug #97552, Bug #11745046, Bug #27581277, Bug #30520749) + + References: See also: Bug #98206, Bug #30756135. diff --git a/corpus/changelog/mysql_releases/mysql_8021.md b/corpus/changelog/mysql_releases/mysql_8021.md new file mode 100644 index 0000000000000000000000000000000000000000..53e3c009e93827fa2ea312fb1dec21d3e67dfda5 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8021.md @@ -0,0 +1,1974 @@ +# MySQL 8.0.21 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-21.html +Version: 8.0.21 + +## Changes in MySQL 8.0.21 (2020-07-13, General Availability) + +For general information about upgrades, downgrades, platform support, etc., please visit [https://dev.mysql.com/doc/relnotes/mysql/8.0/en/](/doc/relnotes/mysql/8.0/en/). + +In the documentation for MySQL 8.0.21, we have started changing +the term “master” to “source”, the +term “slave” to “replica”, the term +“whitelist” to “allowlist”, and the +term “blacklist” to “blocklist”. There +are currently no changes to the product's syntax, so these +terms are still present in the documentation where the current +code requires their use. See the blog post +[MySQL +Terminology Updates](https://mysqlhighavailability.com/mysql-terminology-updates/) for more information. + +* [Account Management Notes](news-8-0-21.html#mysqld-8-0-21-account-management "Account Management Notes") +* [C API Notes](news-8-0-21.html#mysqld-8-0-21-capi "C API Notes") +* [Compilation Notes](news-8-0-21.html#mysqld-8-0-21-compiling "Compilation Notes") +* [Configuration Notes](news-8-0-21.html#mysqld-8-0-21-configuration "Configuration Notes") +* [Connection Management Notes](news-8-0-21.html#mysqld-8-0-21-connection-management "Connection Management Notes") +* [Deprecation and Removal Notes](news-8-0-21.html#mysqld-8-0-21-deprecation-removal "Deprecation and Removal Notes") +* [JSON Notes](news-8-0-21.html#mysqld-8-0-21-json "JSON Notes") +* [Optimizer Notes](news-8-0-21.html#mysqld-8-0-21-optimizer "Optimizer Notes") +* [Packaging Notes](news-8-0-21.html#mysqld-8-0-21-packaging "Packaging Notes") +* [Pluggable Authentication](news-8-0-21.html#mysqld-8-0-21-pluggable-auth "Pluggable Authentication") +* [Security Notes](news-8-0-21.html#mysqld-8-0-21-security "Security Notes") +* [Test Suite Notes](news-8-0-21.html#mysqld-8-0-21-test-suite "Test Suite Notes") +* [X Plugin Notes](news-8-0-21.html#mysqld-8-0-21-xplugin "X Plugin Notes") +* [Functionality Added or Changed](news-8-0-21.html#mysqld-8-0-21-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-21.html#mysqld-8-0-21-bug "Bugs Fixed") + +### Account Management Notes + +* You can now set per-user comments and attributes when creating + or updating MySQL user accounts. A user comment consists of + arbitrary text passed as the argument to a + `COMMENT` clause used with a + [`CREATE USER`](/doc/refman/8.0/en/create-user.html) or + [`ALTER USER`](/doc/refman/8.0/en/alter-user.html) statement. A user + attribute consists of data in the form of a JSON object passed + as the argument to an `ATTRIBUTE` clause used + with either of these two statements. The attribute can contain + any valid key-value pairs in JSON object notation. + + For example, the first of the following two statements creates a + user account `bill@localhost` with the comment + text `This is Bill's user account`. The second + statement adds a user attribute to this account, using the key + `email`, with the value + `bill@example.com`. + + ```None + CREATE USER 'bill'@'localhost' COMMENT 'This is Bill\'s user account'; + + ALTER USER 'mary'@'localhost' + ATTRIBUTE '{"email":"bill@example.com"}'; + ``` + + Only one of `COMMENT` or + `ATTRIBUTE` can be used in the same + `CREATE USER` or `ALTER USER` + statement. + + User comments and user attributes are stored together internally + as a JSON object, with the comment text as the value of an + element with the key `comment`. You can + information retrieve user comments and user attributes from the + `ATTRIBUTE` column of the + [`INFORMATION_SCHEMA.USER_ATTRIBUTES`](/doc/refman/8.0/en/information-schema-user-attributes-table.html) + table; since this data is in JSON format, you can work with it + using MySQL's JSON function and operators (see + [JSON Functions](/doc/refman/8.0/en/json-functions.html)). Changes to an existing user + attribute are merged with its current value, as you had used + [`JSON_MERGE_PATCH()`](/doc/refman/8.0/en/json-modification-functions.html#function_json-merge-patch); new key-value + pairs are appended to the attribute, and new values for existing + keys overwrite their previous values. + + To remove a given key-value pair from a user attribute, use + `ALTER USER user ATTRIBUTE + '{"key":null}'`. + + For more information and examples, see + [CREATE USER Statement](/doc/refman/8.0/en/create-user.html), [ALTER USER Statement](/doc/refman/8.0/en/alter-user.html), and + [The INFORMATION\_SCHEMA USER\_ATTRIBUTES Table](/doc/refman/8.0/en/information-schema-user-attributes-table.html). + (WL #13562) + + References: See also: Bug #31067575. + +### C API Notes + +* Per OpenSSL recommendation, `x509_check_host()` + and `X509_check_ip_asc()` calls in the C client + library were replaced, respectively, with + `X509_VERIFY_PARAM_set1_host()` and + `X509_VERIFY_PARAM_set1_ip_asc()` calls. + (Bug #29684791) +* The MySQL C API now supports compression for asynchronous + functions. This means that the + `MYSQL_OPT_COMPRESSION_ALGORITHMS` and + `MYSQL_OPT_ZSTD_COMPRESSION_LEVEL` options for + the [`mysql_options()`](/doc/c-api/8.0/en/mysql-options.html) function now + affect asynchronous operations, not just synchronous operations. + See [mysql\_options()](/doc/c-api/8.0/en/mysql-options.html). + + Our thanks to Facebook for the contribution. + (Bug #96802, Bug #30284871, WL #13510) + +### Compilation Notes + +* The minimum version of the Boost library for server builds is + now 1.72.0. + (Bug #30963985) + +### Configuration Notes + +* `tcmalloc` is no longer a permitted value for + the **mysqld\_safe** + [`--malloc-lib`](/doc/refman/8.0/en/mysqld-safe.html#option_mysqld_safe_malloc-lib) option. + (Bug #31372027) + +### Connection Management Notes + +* MySQL Server supports a “main” network interface + for ordinary client connections, and optionally an + administrative network interface for administrative client + connections. Previously, the main and administrative interfaces + used the same TLS configuration, such as the certificate and key + files for encrypted connections. It is now possible to configure + TLS material separately for the administrative interface: + + + There are new configuration parameters that apply + specifically to the administrative interface. + + The [`ALTER INSTANCE RELOAD TLS`](/doc/refman/8.0/en/alter-instance.html#alter-instance-reload-tls) + statement is extended with a `FOR CHANNEL` + clause that enables specifying the channel (interface) for + which to reload the TLS context. + + The new Performance Schema + [`tls_channel_status`](/doc/refman/8.0/en/performance-schema-tls-channel-status-table.html) table + exposes TLS context properties for the main and + administrative interfaces. + + For backward compatibility, the administrative interface + uses the same TLS context as the main interface unless some + nondefault TLS parameter value is configured for the + administrative interface. + + For more information, see + [Administrative Interface Support for Encrypted Connections](/doc/refman/8.0/en/administrative-connection-interface.html#administrative-interface-encrypted-connections), + [ALTER INSTANCE Statement](/doc/refman/8.0/en/alter-instance.html), and + [The tls\_channel\_status Table](/doc/refman/8.0/en/performance-schema-tls-channel-status-table.html). + (WL #13850) + +### Deprecation and Removal Notes + +* **Partitioning:** + Columns with index prefixes are not supported as part of a + table's partitioning key; previously such columns were + simply omitted by the server when referenced in creating, + altering, or upgrading a table that was partitioned by key, with + no indication that this omission had taken place, except when + the proposed partitioning function used only columns with + prefixes, in which case the statement failed with an error + message that did not identify the actual source of the problem. + This behavior is now deprecated, and subject to removal in a + future release in which using any such columns in the proposed + partitioning key will cause the [`CREATE + TABLE`](/doc/refman/8.0/en/create-table.html) or [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) + statement in which they occur to be rejected. + + When one or more columns using index prefixes are specified as + part of the partitioning key, a warning is now generated for + each such column. In addition, when a + [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) or + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) statement is rejected + because all columns specified in the proposed partitioning key + employ index prefixes, the error message returned now makes + clear the reason the statement did not succeed. This includes + cases in which the columns proposed the partitioning function + are defined implicitly as those in the table's primary key + by employing an empty `PARTITION BY KEY()` + clause. + + For more information and examples, see + [Column index prefixes not supported for key partitioning](/doc/refman/8.0/en/partitioning-limitations.html#partitioning-limitations-prefixes), and + [KEY Partitioning](/doc/refman/8.0/en/partitioning-key.html). + (Bug #29941932, Bug #29941959, Bug #31100205, WL #13588) + + References: See also: Bug #29942014. + +### JSON Notes + +* Added the [`JSON_VALUE()`](/doc/refman/8.0/en/json-search-functions.html#function_json-value) function, + which simplifies creating indexes on + [`JSON`](/doc/refman/8.0/en/json.html) columns. A call to + `JSON_VALUE(json_doc, + path RETURNING + type)` is equivalent to + calling [`CAST`](/doc/refman/8.0/en/cast-functions.html#function_cast)`(`[`JSON_UNQUOTE`](/doc/refman/8.0/en/json-modification-functions.html#function_json-unquote)`(`[`JSON_EXTRACT(json_doc, + path)`](/doc/refman/8.0/en/json-search-functions.html#function_json-extract) `) AS + type)`, where + *`json_doc`* is a JSON document, + *`path`* is a JSON path expression + pointing to a single value within the document, and + *`type`* is a data type compatible with + *`CAST()`*. `RETURNING + type` is optional; if no + return type is specified, `JSON_VALUE()` + returns [`VARCHAR(512)`](/doc/refman/8.0/en/char.html). + + `JSON_VALUE()` also supports `ON + EMPTY` and `ON ERROR` clauses similar + to those used with [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table). + + You can create indexes on a [`JSON`](/doc/refman/8.0/en/json.html) + column using `JSON_VALUE()` as shown here: + + ```None + CREATE TABLE inventory( + items JSON, + INDEX i1 ( (JSON_VALUE(items, '$.name' RETURNING CHAR(50))) ), + INDEX i2 ( (JSON_VALUE(items, '$.price' RETURNING DECIMAL(5,2))) ), + INDEX i3 ( (JSON_VALUE(items, '$.quantity' RETURNING UNSIGNED)) ) + ); + ``` + + Assuming the `items` column contains values + such as `'{"name": "hat", "price": "22.95", "quantity": + "17"}'`, you can issue queries, such as the following, + that are able to use these indexes: + + ```None + SELECT items->"$.price" FROM inventory + WHERE JSON_VALUE(items, '$.name' RETURNING CHAR(50)) = "hat"; + + SELECT * FROM inventory + WHERE JSON_VALUE(items, '$.price' RETURNING DECIMAL(5,2)) <= 100.01; + + SELECT items->"$.name" AS item, items->"$.price" AS amount + FROM inventory + WHERE JSON_VALUE(items, '$.quantity' RETURNING UNSIGNED) > 500; + ``` + + For more information and examples, see the description of the + [`JSON_VALUE()`](/doc/refman/8.0/en/json-search-functions.html#function_json-value) function. + (WL #12228) + +### Optimizer Notes + +* MySQL attempts to use an ordered index for any `ORDER + BY` or `GROUP BY` query that has a + `LIMIT` clause, overriding any other choices + made by the optimizer, whenever it determines that this would + result in faster execution. Because the algorithm for making + this determination makes certain assumptions about data + distribution and other conditions, it may not always be + completely correct, and it is possible in some cases that + choosing a different optimization for such queries can provide + better performance. To handle such occurrences, it is now + possible to disable this optimization by setting the + [`optimizer_switch`](/doc/refman/8.0/en/server-system-variables.html#sysvar_optimizer_switch) system + variable's + [`prefer_ordering_index`](/doc/refman/8.0/en/switchable-optimizations.html#optflag_prefer-ordering-index) flag to + `off`. + + For more information about this flag and examples of its use, + see [Switchable Optimizations](/doc/refman/8.0/en/switchable-optimizations.html), and + [LIMIT Query Optimization](/doc/refman/8.0/en/limit-optimization.html). + + Our thanks to Jeremy Cole for the contribution. + (Bug #97001, Bug #30348211, WL #13929) + + References: See also: Bug #31686878. +* A single-table [`UPDATE`](/doc/refman/8.0/en/update.html) or + [`DELETE`](/doc/refman/8.0/en/delete.html) statement that uses a + subquery having a `[NOT] IN` or `[NOT] + EXISTS` predicate can now in many cases make use of a + semijoin transformation or subquery materialization. This can be + done when the statement does not use `LIMIT` or + `ORDER BY`, and when semijoin or subquery + materialization is allowed by any optimizer hints used in the + subquery, or by the value of the + [`optimizer_switch`](/doc/refman/8.0/en/server-system-variables.html#sysvar_optimizer_switch) server system + variable. + + You can see when the semijoin optimization or subquery + materialization is used for an eligible single-table + `DELETE` or `UPDATE` due to + the presence of a `join_optimization` object in + the optimizer trace. You can also see that the conversion is + performed by checking the output of + [`EXPLAIN + FORMAT=TREE`](/doc/refman/8.0/en/explain.html); if the optimization is not performed, + this shows ``, while a multi-table statement reports a + full plan. + + As part of this work, semi-consistent reads are now supported by + multi-table `UPDATE` of + [`InnoDB`](/doc/refman/8.0/en/innodb-storage-engine.html) tables, when the transaction + isolation level is weaker than + [`REPEATABLE READ`](/doc/refman/8.0/en/innodb-transaction-isolation-levels.html#isolevel_repeatable-read). + (Bug #35794, Bug #96423, Bug #11748293, Bug #30139244, WL #6507) +* Added the [`optimizer_switch`](/doc/refman/8.0/en/server-system-variables.html#sysvar_optimizer_switch) flag + [`subquery_to_derived`](/doc/refman/8.0/en/switchable-optimizations.html#optflag_subquery-to-derived). When this + flag is set to `on`, the optimizer transforms + eligible scalar subqueries into left outer joins (and in some + cases, inner joins) on derived tables. This optimization can be + applied to a subquery which meets the following conditions: + + + It uses one or more aggregate functions but no + `GROUP BY`. + + It is part of a `SELECT`, + `WHERE`, `JOIN`, or + `HAVING` clause. + + It is not a correlated subquery. + + It does not make use of any nondeterminstic functions. + + `ANY` and `ALL` subqueries + which can be rewritten to use + [`MIN()`](/doc/refman/8.0/en/aggregate-functions.html#function_min) or + [`MAX()`](/doc/refman/8.0/en/aggregate-functions.html#function_max) are also not affected. + + With `subquery_to_derived=on`, the optimization + can also be applied to a table subquery which is the argument to + `IN`, `NOT IN`, + `EXISTS`, or `NOT EXISTS`, and + which does not contain a `GROUP BY` clause. + + The `subquery_to_derived` flag is set to + `off` by default, since it generally does not + improve performance, and its intended use for the most part is + for testing purposes. + + For more information, see + [Switchable Optimizations](/doc/refman/8.0/en/switchable-optimizations.html), for more information + and examples. See also + [Optimizing Derived Tables, View References, and Common Table Expressions with Merging or Materialization](/doc/refman/8.0/en/derived-table-optimization.html), and + [LIMIT Query Optimization](/doc/refman/8.0/en/limit-optimization.html). + (WL #13851) +* Building on work done in MySQL 8.0.18, the server now performs + injection of casts into queries to avoid mismatches when + comparing string data types with those of numeric or temporal + types; as when comparing numeric and temporal types, the + optimizer now adds casting operations in the item tree inside + expressions and conditions in which the data type of the + argument and the expected data type do not match. This makes + queries in which string types are compared with numeric or + temporal types equivalent to queries which are compliant with + the SQL standard, while maintaining backwards compatibility with + previous releases of MySQL. Such casts are now performed + whenever string values are compared to numeric or temporal + values using any of the standard numeric comparison operators + ([`=`](/doc/refman/8.0/en/assignment-operators.html#operator_assign-equal), + [`>=`](/doc/refman/8.0/en/comparison-operators.html#operator_greater-than-or-equal), + [`>`](/doc/refman/8.0/en/comparison-operators.html#operator_greater-than), + [`<`](/doc/refman/8.0/en/comparison-operators.html#operator_less-than), + [`<=`](/doc/refman/8.0/en/comparison-operators.html#operator_less-than-or-equal), + [`<>`](/doc/refman/8.0/en/comparison-operators.html#operator_not-equal)/[`!=`](/doc/refman/8.0/en/comparison-operators.html#operator_not-equal), + and + [`<=>`](/doc/refman/8.0/en/comparison-operators.html#operator_equal-to)). + + Such implicit casts are now performed between a string type + ([`CHAR`](/doc/refman/8.0/en/char.html), + [`VARCHAR`](/doc/refman/8.0/en/char.html), + [`BINARY`](/doc/refman/8.0/en/binary-varbinary.html), + [`VARBINARY`](/doc/refman/8.0/en/binary-varbinary.html), + [`BLOB`](/doc/refman/8.0/en/blob.html), + [`TEXT`](/doc/refman/8.0/en/blob.html), + [`ENUM`](/doc/refman/8.0/en/enum.html), or + [`SET`](/doc/refman/8.0/en/set.html)) and a numeric type + ([`SMALLINT`](/doc/refman/8.0/en/integer-types.html), + [`TINYINT`](/doc/refman/8.0/en/integer-types.html), + [`MEDIUMINT`](/doc/refman/8.0/en/integer-types.html), + [`INT`](/doc/refman/8.0/en/integer-types.html)/[`INTEGER`](/doc/refman/8.0/en/integer-types.html), + [`BIGINT`](/doc/refman/8.0/en/integer-types.html); + [`DECIMAL`](/doc/refman/8.0/en/fixed-point-types.html)/[`NUMERIC`](/doc/refman/8.0/en/fixed-point-types.html); + [`FLOAT`](/doc/refman/8.0/en/floating-point-types.html), + [`DOUBLE`](/doc/refman/8.0/en/floating-point-types.html), + [`REAL`](/doc/refman/8.0/en/floating-point-types.html); and + [`BIT`](/doc/refman/8.0/en/bit-type.html)) by casting the string value + to [`DOUBLE`](/doc/refman/8.0/en/floating-point-types.html); if the numeric value + is not already of type `DOUBLE`, + [`FLOAT`](/doc/refman/8.0/en/floating-point-types.html), or + [`REAL`](/doc/refman/8.0/en/floating-point-types.html), it is also cast to + [`DOUBLE`](/doc/refman/8.0/en/floating-point-types.html). A + [`YEAR`](/doc/refman/8.0/en/year.html) value is also cast to + `DOUBLE` when compared with a string value (as + is the string value). For such comparisons between string types + and [`TIMESTAMP`](/doc/refman/8.0/en/datetime.html) or + [`DATETIME`](/doc/refman/8.0/en/datetime.html) values, the arguments + are cast as `DATETIME`; when a string type is + compared with a [`DATE`](/doc/refman/8.0/en/datetime.html) value, the + string is cast to `DATE`. + + For example, a query such as `SELECT * FROM t1 JOIN t2 + ON t1.char_col = + t2.int_col` is rewritten and + executed as `SELECT * FROM t1 JOIN t2 ON + CAST(t1.char_col AS DOUBLE) = + CAST(t2.int_col AS DOUBLE)`, + and `SELECT * FROM t1 JOIN t2 ON + t1.varchar_col = + t2.timestamp_col` is + transformed to `SELECT * FROM t1 JOIN t2 ON + CAST(t1.varchar_col AS DATETIME) = + CAST(t2.timestamp_col AS + DATETIME)` prior to execution. + + You can see when casts are injected into a given query by + viewing the output of [`EXPLAIN + ANALYZE`](/doc/refman/8.0/en/explain.html#explain-analyze), `EXPLAIN FORMAT=JSON`, or + `EXPLAIN FORMAT=TREE`. `EXPLAIN + [FORMAT=TRADITIONAL]` can also be used, but in this + case it is necessary, following execution of the + `EXPLAIN` statement, to issue + [`SHOW WARNINGS`](/doc/refman/8.0/en/show-warnings.html) to view the + rewritten query. + + This change is not expected to cause any difference in query + results or performance. + (WL #13456) + +### Packaging Notes + +* For RPM and Debian packages, client-side plugins were moved from + the server package to the client package. Additionally, debug + versions of client-side plugins were moved to the test package. + (Bug #31123564, Bug #31336340) +* MSI packages for Windows no longer include the legacy server + data component. + (Bug #31060177) +* The bundled Protobuf library was upgraded from version 3.6.1 to + version 3.11. + (Bug #31000511, Bug #98852) +* The `libevent` library bundled with MySQL was + upgraded to version 2.1.11. In addition, for the + [`WITH_LIBEVENT`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_libevent) + **CMake** option, the following two changes were + made: + + 1. `yes` is no longer permitted as a synonym + for `system`. Use `system` + instead. + 2. If `system` is specified but no system + `libevent` is found, the bundled version is + no longer used in place of the missing system library, and + an error occurs instead. + + (Bug #30926742) +* The ICU (International Components for Unicode) library bundled + with MySQL has been upgraded to version 65.1. + +### Pluggable Authentication + +* The MySQL Enterprise Edition `authentication_ldap_sasl` plugin + that implements SASL LDAP authentication supports multiple + authentication methods, but depending on host system + configuration, they might not all be available. The new + [`Authentication_ldap_sasl_supported_methods`](/doc/refman/8.0/en/server-status-variables.html#statvar_Authentication_ldap_sasl_supported_methods) + status variable provides discoverability for the supported + methods. Its value is a string consisting of supported method + names separated by spaces. Example: `"SCRAM-SHA1 + GSSAPI"` + (WL #13876) + +### Security Notes + +* **Incompatible Change:** + Access to the + [`INFORMATION_SCHEMA.FILES`](/doc/refman/8.0/en/information-schema-files-table.html) table now + requires the [`PROCESS`](/doc/refman/8.0/en/privileges-provided.html#priv_process) privilege. + + This change affects users of the **mysqldump** + command, which accesses tablespace information in the + [`FILES`](/doc/refman/8.0/en/information-schema-files-table.html) table, and thus now requires + the [`PROCESS`](/doc/refman/8.0/en/privileges-provided.html#priv_process) privilege as well. + Users who do not need to dump tablespace information can work + around this requirement by invoking **mysqldump** + with the [`--no-tablespaces`](/doc/refman/8.0/en/mysqldump.html#option_mysqldump_no-tablespaces) + option. + (Bug #30350829) +* For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 1.1.1g. Issues fixed in the new OpenSSL version are described at + and + . + (Bug #31296697) +* Previously, `LOCAL` data loading capability for + the [`LOAD DATA`](/doc/refman/8.0/en/load-data.html) statement could be + controlled on the client side only by enabling it for all files + accessible to the client, or by disabling it altogether. The new + `MYSQL_OPT_LOAD_DATA_LOCAL_DIR` option for the + [`mysql_options()`](/doc/c-api/8.0/en/mysql-options.html) C API function + enables clients to restrict `LOCAL` data + loading to files located in a designated directory. See + [Security Considerations for LOAD DATA LOCAL](/doc/refman/8.0/en/load-data-local-security.html). + (WL #13168) + +### Test Suite Notes + +* **mysql-test-run.pl** no longer accepts unique + prefixes of command options. Complete option names must be + given. + (Bug #31390127) +* MySQL tests were updated to use googletest 1.10.0. + (Bug #31364750) +* The `innodb.innodb_mysql` test case was updated + to avoid nondeterminism of output row order. Thanks to Facebook + for the contribution. + (Bug #30810572, Bug #98377) +* **mysql-test-run.pl** now supports an + `--mtr-port-exclude` option for specifying the + range of ports to exclude when searching for available port + ranges to use. The `MTR_PORT_EXCLUDE` + environment variable may also be set to achieve the same effect. + Thanks to Facebook for the contribution. + (Bug #30809607) +* In addition to aborting on receipt of + **CTRL**+**C** (SIGINT), + **mysql-test-run.pl** now also displays a list of + test cases that failed up to that point. + (Bug #30407014) + +### X Plugin Notes + +* Where a dollar sign ($) was used to reference an entire + document, X Plugin handled the reference differently depending + on the context in which it was used. This has now been + standardized. + (Bug #31374713) +* With certain settings for the global SQL mode, X Plugin's + authentication process failed to accept a correct user password. + The authentication process now operates independently from the + global SQL mode's setting to ensure consistency. + (Bug #31086109) + +### Functionality Added or Changed + +* **Important Change; Group Replication:** + By default, a replication source server writes a checksum for + each event in the binary log, as specified by the system + variable [`binlog_checksum`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_checksum), which + defaults to the setting `CRC32`. Previously, + Group Replication did not support the presence of checksums in + the binary log, so + [`binlog_checksum`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_checksum) had to be set + to `NONE` when configuring a server instance + that would become a group member. This requirement is now + removed, and the default can be used. The setting for + [`binlog_checksum`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_checksum) does not have + to be the same for all members of a group. + + Note that Group Replication does not use checksums to verify + incoming events on the + `group_replication_applier` channel, because + events are written to that relay log from multiple sources and + before they are actually written to the originating server's + binary log, which is when a checksum is generated. Checksums are + used to verify the integrity of events on the + `group_replication_recovery` channel and on any + other replication channels on group members. + (WL #9038) +* **Performance:** + Improved the implementation of the + [`UNHEX()`](/doc/refman/8.0/en/string-functions.html#function_unhex) function by introducing a + lookup table for mapping a hexadecimal digit string to its + binary representation. This change speeds up execution of the + function by a factor of 8 or more in testing. + (Bug #31173103) +* **InnoDB:** + Redo logging can now be enabled and disabled using + [`ALTER INSTANCE + {ENABLE|DISABLE} INNODB REDO_LOG`](/doc/refman/8.0/en/alter-instance.html) syntax. This + functionality is intended for loading data into a new MySQL + instance. Disabling redo logging helps speed up data loading by + avoiding redo log writes. + + The new [`INNODB_REDO_LOG_ENABLE`](/doc/refman/8.0/en/privileges-provided.html#priv_innodb-redo-log-enable) + privilege permits enabling and disabling redo logging. + + The new + [`Innodb_redo_log_enabled`](/doc/refman/8.0/en/server-status-variables.html#statvar_Innodb_redo_log_enabled) status + variable permits monitoring redo logging status. + + See [Disabling Redo Logging](/doc/refman/8.0/en/innodb-redo-log.html#innodb-disable-redo-logging). + (WL #13795) +* **InnoDB:** + Truncating an undo tablespace on a busy system could affect + performance due to associated flushing operations that remove + old undo tablespace pages from the buffer pool and flush the + initial pages of the new undo tablespace to disk. To address + this issue, the flushing operations were removed. + + Old undo tablespace pages are now released passively as they + become least recently used, or are removed at the next full + checkpoint. The initial pages of the new undo tablespace are now + redo logged instead of flushed to disk during the truncate + operation, which also improves durability of the undo tablespace + truncate operation. + + To prevent potential issues caused by an excessive number of + undo tablespace truncate operations, truncate operations on the + same undo tablespace between checkpoints are now limited to 64. + If the limit is exceeded, an undo tablespace can still be made + inactive, but it is not truncated until after the next + checkpoint. + + [`INNODB_METRICS`](/doc/refman/8.0/en/information-schema-innodb-metrics-table.html) counters associated + with defunct undo truncate flushing operations were removed. + Removed counters include: + `undo_truncate_sweep_count`, + `undo_truncate_sweep_usec`, + `undo_truncate_flush_count`, and + `undo_truncate_flush_usec`. + + See [Undo Tablespaces](/doc/refman/8.0/en/innodb-undo-tablespaces.html). + (WL #11819) +* **InnoDB:** + At startup, `InnoDB` validates the paths of + known tablespace files against tablespace file paths stored in + the data dictionary in case tablespace files have been moved to + a different location. The new + [`innodb_validate_tablespace_paths`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_validate_tablespace_paths) + variable permits disabling tablespace path validation. This + feature is intended for environments where tablespaces files are + not moved. Disabling tablespace path validation improves startup + time on systems with a large number of tablespace files. + + For more information, see + [Disabling Tablespace Path Validation](/doc/refman/8.0/en/innodb-disabling-tablespace-path-validation.html). + (WL #14008) +* **InnoDB:** + Table and table partition data files created outside of the data + directory using the `DATA DIRECTORY` clause are + now restricted to directories known to + `InnoDB`. This change permits database + administrators to control where tablespace data files are + created and ensures that the data files can be found during + recovery. + + General and file-per-table tablespaces data files + (`.ibd` files) can no longer be created in + the undo tablespace directory + ([`innodb_undo_directory`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_undo_directory)) unless + that directly is known to `InnoDB`. + + Known directories are those defined by the + [`datadir`](/doc/refman/8.0/en/server-system-variables.html#sysvar_datadir), + [`innodb_data_home_dir`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_data_home_dir), and + [`innodb_directories`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_directories) variables. + + Truncating an `InnoDB` table that resides in a + file-per-table tablespace drops the existing tablespace and + creates a new one. As of MySQL 8.0.21, `InnoDB` + creates the new tablespace in the default location and writes a + warning to the error log if the tablespace was created with an + earlier version and the current tablespace directory is unknown. + To have [`TRUNCATE TABLE`](/doc/refman/8.0/en/truncate-table.html) create the + tablespace in its current location, add the directory to the + [`innodb_directories`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_directories) setting + before running [`TRUNCATE TABLE`](/doc/refman/8.0/en/truncate-table.html). + (WL #13065) +* **InnoDB:** + To improve concurrency for operations that require access to + lock queues for table and row resources, the lock system mutex + (`lock_sys->mutex`) was replaced by sharded + latches, and lock queues were grouped into table and page + *lock queue shards*, with each shard + protected by a dedicated mutex. Previously, the single lock + system mutex protected all lock queues, which was a point of + contention on high-concurrency systems. The new sharded + implementation permits more granular access to lock queues. + + The lock system mutex (`lock_sys->mutex`) + was replaced by the following sharded latches: + + + A global latch + (`lock_sys->latches.global_latch`) + consisting of 64 read-write lock objects + (`rw_lock_t`). Access to an individual lock + queue requires a shared global latch and a latch on the lock + queue shard. Operations that require access to all lock + queues take an exclusive global latch, which latches all + table and page lock queue shards. + + Table shard latches + (`lock_sys->latches.table_shards.mutexes`), + implemented as an array of 512 mutexes, with each mutex + dedicated to one of 512 table lock queue shards. + + Page shard latches + (`lock_sys->latches.page_shards.mutexes`), + implemented as an array of 512 mutexes, with each mutex + dedicated to one of 512 page lock queue shards. + + The Performance Schema + `wait/synch/mutex/innodb/lock_mutex` instrument + for monitoring the single lock system mutex was replaced by + instruments for monitoring the new global, table shard, and page + shard latches: + + + `wait/synch/sxlock/innodb/lock_sys_global_rw_lock` + + `wait/synch/mutex/innodb/lock_sys_table_mutex` + + `wait/synch/mutex/innodb/lock_sys_page_mutex` + + (WL #10314) +* **Group Replication:** + Group Replication group members can now advertise a list of IP + addresses that joining members can use to make connections to + them for state transfer during distributed recovery. Previously, + the existing member's standard SQL client connection was used + for this purpose as well as for client traffic. Advertising + distributed recovery endpoints instead gives you improved + control of distributed recovery traffic (comprising remote + cloning operations and state transfer from the binary log) in + your network infrastructure. The list of distributed recovery + endpoints for a member is specified using the new + [`group_replication_advertise_recovery_endpoints`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_advertise_recovery_endpoints) + system variable, and the same SSL requirements are applied that + would be in place if the SQL client connection was used for + distributed recovery. + (WL #13767) +* **Group Replication:** + You can now specify user credentials for distributed recovery on + the [`START GROUP_REPLICATION`](/doc/refman/8.0/en/start-group-replication.html) + statement using the `USER`, + `PASSWORD`, and `DEFAULT_AUTH` + options. These credentials are used for distributed recovery on + the `group_replication_recovery` channel. When + you specify user credentials on [`START + GROUP_REPLICATION`](/doc/refman/8.0/en/start-group-replication.html), the credentials are saved in memory + only, and are removed by a [`STOP + GROUP_REPLICATION`](/doc/refman/8.0/en/stop-group-replication.html) statement or server shutdown. These + credentials can replace user credentials set using a + [`CHANGE MASTER TO`](/doc/refman/8.0/en/change-master-to.html) statement, which + are stored in the replication metadata repositories, and can + therefore help to secure the Group Replication servers against + unauthorized access. + + The new method of providing user credentials is not compatible + with starting Group Replication automatically on server start. + If user credentials have previously been set using a + [`CHANGE MASTER TO`](/doc/refman/8.0/en/change-master-to.html) statement, + credentials that you specify on [`START + GROUP_REPLICATION`](/doc/refman/8.0/en/start-group-replication.html) take precedence over these. However, + the credentials from the replication metadata repositories are + used if [`START GROUP_REPLICATION`](/doc/refman/8.0/en/start-group-replication.html) + is specified without user credentials, which happens on + automatic starts if the + [`group_replication_start_on_boot`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_start_on_boot) + system variable is set to `ON` (including after + a remote cloning operation for distributed recovery). To gain + the security benefits of specifying user credentials on + [`START GROUP_REPLICATION`](/doc/refman/8.0/en/start-group-replication.html), ensure + that + [`group_replication_start_on_boot`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_start_on_boot) + is set to `OFF` (the default is + `ON`), and use a [`CHANGE + MASTER TO`](/doc/refman/8.0/en/change-master-to.html) statement to clear any user credentials + previously set for the + `group_replication_recovery` channel. + (WL #13768) +* **Group Replication:** + The minimum setting for the maximum size for the XCom message + cache in Group Replication, specified by the + [`group_replication_message_cache_size`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_message_cache_size) + system variable, has been reduced from approximately 1 GB to + 134217728 bytes, or approximately 128 MB. Note that this size + limit applies only to the data stored in the cache, and the + cache structures require an additional 50 MB of memory. The same + cache size limit should be set on all group members. The default + XCom message cache size of 1 GB, which was formerly also the + minimum setting, is unchanged. + + The smaller message cache size is provided to enable deployment + on a host that has a restricted amount of available memory and + good network connectivity. Having a very low + [`group_replication_message_cache_size`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_message_cache_size) + setting is not recommended if the host is on an unstable + network, because a smaller message cache makes it harder for + group members to reconnect after a transient loss of + connectivity. If some messages that were exchanged during a + member's temporary absence have been deleted from the other + members' XCom message caches because their maximum size limit + was reached, the member cannot reconnect using the message + cache. It must leave the group and rejoin in order to retrieve + the transactions through distributed recovery, which is a slower + process than using the message cache, although the member still + can rejoin in this way without operator intervention. + + Note that from MySQL 8.0.21, by default an expel timeout of 5 + seconds is added before a member is expelled from the group + (specified by the + [`group_replication_member_expel_timeout`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_member_expel_timeout) + system variable). With this default setting the XCom message + cache therefore now needs to store the messages exchanged by the + group in a 10-second period (the expel timeout plus the initial + 5-second detection period), rather than in a 5-second period as + previously (the initial 5-second detection period only). + (WL #13979) +* **Group Replication:** + [`group_replication_member_expel_timeout`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_member_expel_timeout) + specifies the period of time in seconds that a Group Replication + group member waits after creating a suspicion, before expelling + from the group the member suspected of having failed. The + initial 5-second detection period before a suspicion is created + does not count as part of this time. + + Previously, the waiting period specified by + [`group_replication_member_expel_timeout`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_member_expel_timeout) + defaulted to 0, meaning that a suspected member was liable for + expulsion immediately after the 5-second detection period ended. + Following user feedback, the waiting period now defaults to 5 + seconds, giving a member that loses touch with the group 10 + seconds in total to reconnect itself to the group. If the member + does reconnect in this time, it can recover missed messages from + the XCom message cache and return to `ONLINE` + state automatically, rather than being expelled from the group + and needing the auto-rejoin procedure or manual operator + intervention to rejoin. + + If you previously tuned the size of the XCom message cache with + reference to the expected volume of messages in the previous + default time before a member was expelled (the 5-second + detection period only), increase your + [`group_replication_message_cache_size`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_message_cache_size) + setting to account for the new expel timeout, which doubles the + default time to 10 seconds. With the new default expel timeout + you might start to see warning messages from GCS on active group + members, stating that a message that is likely to be needed for + recovery by a member that is currently unreachable has been + removed from the message cache. This message shows that a member + has had a need to use the message cache to reconnect, and that + the cache size might not be sufficient to support the current + waiting period before a member is expelled. + (WL #13773) +* **Group Replication:** + The Group Replication auto-rejoin feature is now activated by + default. The + [`group_replication_autorejoin_tries`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_autorejoin_tries) + system variable, which is available from MySQL 8.0.16, makes a + member that has been expelled or reached its unreachable + majority timeout try to rejoin the group automatically. This + system variable, which originally defaulted to 0 so auto-rejoin + was not activated, now defaults to 3, meaning that a member + makes three attempts to rejoin the group in the event of its + expulsion or unreachable majority timeout. Between each attempt + the member waits for 5 minutes. If the specified number of tries + is exhausted without the member rejoining or being stopped, the + member proceeds to the action specified by the + [`group_replication_exit_state_action`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_exit_state_action) + system variable. + + The auto-rejoin feature minimizes the need for manual + intervention to bring a member back into the group, especially + where transient network issues are fairly common. During and + between auto-rejoin attempts, a member remains in super read + only mode and does not accept writes. However, reads can still + be made on the member, with an increasing likelihood of stale + reads over time. If you want to intervene to take the member + offline, the member can be stopped manually at any time by using + a [`STOP GROUP_REPLICATION`](/doc/refman/8.0/en/stop-group-replication.html) + statement or shutting down the server. If you cannot tolerate + the possibility of stale reads for any period of time, set the + [`group_replication_autorejoin_tries`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_autorejoin_tries) + system variable to 0, in which case operator intervention is + required whenever a member is expelled from the group or reaches + its unreachable majority timeout. + (WL #13706) +* Previously, the + [`--disabled-storage-engines`](/doc/refman/8.0/en/server-system-variables.html#sysvar_disabled_storage_engines) option + did not ignore spaces around storage engines listed in the + option value. Spaces around engine names are now ignored. + (Bug #31373361, Bug #99632) +* The new `HANDLE_FATAL_SIGNALS` + **CMake** option enables configuring whether + Address Sanitizer and Undefined Behavior Sanitizer builds use + the sanitizer runtime library to handle fatal signals rather + than a MySQL-internal function. The option default is + `ON` for non-sanitizer builds, + `OFF` for sanitizer builds. If the option is + `OFF`, the default action is used for SIGBUS, + SIGILL and SIGSEGV, rather than the internal function. + (Bug #31068443) +* Using a column that is repeated twice or more in `GROUP + BY` (through an alias), combined with + `ROLLUP`, had behavior differing from MySQL + 5.7. Example: + + ```None + SELECT a, b AS a, COUNT(*) FROM t1 GROUP BY a, b WITH ROLLUP; + ``` + + Behavior of such queries has been changed to better match MySQL + 5.7. They should be avoided, however, because behavior may + change again in the future or such queries may become illegal. + (Bug #30921780, Bug #98663) +* **comp\_err** provides better error messages for + certain input file issues. Thanks to Facebook for the + contribution. + (Bug #30810629, Bug #98390) +* MySQL Server Docker containers now support server restart within + a client session (which happens, for example, when the + [RESTART](/doc/refman/8.0/en/restart.html) statement is executed by + a client or during the + [configuration + of an InnoDB Cluster instance](/doc/mysql-shell/8.0/en/deploying-production-innodb-cluster.html)). To enable this + important feature, containers should be started with the + **docker run** option `--restart` + set to the value `on-failure`. See + [Starting a MySQL Server Instance](/doc/refman/8.0/en/docker-mysql-getting-started.html#docker-starting-mysql-server) for details. + (Bug #30750730) +* [`EXPLAIN ANALYZE`](/doc/refman/8.0/en/explain.html#explain-analyze) now supports the + `FORMAT` option. Currently, + `TREE` is the only supported format. + (Bug #30315224) +* [`ALTER INSTANCE ROTATE INNODB MASTER + KEY`](/doc/refman/8.0/en/alter-instance.html#alter-instance-rotate-innodb-master-key) is no longer permitted when + [`read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_read_only) or + [`super_read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only) are enabled. + (Bug #30274240) +* On storage engines that support atomic DDL, the + [`CREATE + TABLE ... SELECT`](/doc/refman/8.0/en/create-table-select.html) statement is now logged as one + transaction in the binary log when row-based replication is in + use. Previously, it was logged as two transactions, one to + create the table, and the other to insert data. With this + change, + [`CREATE + TABLE ... SELECT`](/doc/refman/8.0/en/create-table-select.html) statements are now safe for row-based + replication and permitted for use with GTID-based replication. + For more information, see [Atomic Data Definition Statement Support](/doc/refman/8.0/en/atomic-ddl.html). + (Bug #11756034, Bug #47899, WL #13355) +* [`LOAD XML`](/doc/refman/8.0/en/load-xml.html) now supports + `CDATA` sections in the XML file to be + imported. + (Bug #98199, Bug #30753708) +* X Plugin's [`mysqlx_bind_address`](/doc/refman/8.0/en/x-plugin-options-system-variables.html#sysvar_mysqlx_bind_address) + system variable now accepts multiple IP addresses like MySQL + Server's [`bind_address`](/doc/refman/8.0/en/server-system-variables.html#sysvar_bind_address) system + variable does, enabling X Plugin to listen for TCP/IP + connections on multiple network sockets. + + An important difference in behavior is that for MySQL Server, + any error in the list of addresses prevents the server from + starting, but X Plugin (which is not a mandatory plugin) does + not do this. With X Plugin, if one of the listed addresses + cannot be parsed or if X Plugin cannot bind to it, the address + is skipped, an error message is logged, and X Plugin attempts + to bind to each of the remaining addresses. X Plugin's + [`Mysqlx_address`](/doc/refman/8.0/en/x-plugin-status-variables.html#statvar_Mysqlx_address) status variable + displays only those addresses from the list for which the bind + succeeded. If none of the listed addresses results in a + successful bind, X Plugin logs an error message stating that + X Protocol cannot be used. + (WL #12715) +* `ENGINE_ATTRIBUTE` and + `SECONDARY_ENGINE_ATTRIBUTE` options were added + to [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html), + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html), and + [`CREATE INDEX`](/doc/refman/8.0/en/create-index.html) syntax. The + `ENGINE_ATTRIBUTE` option was also added to + [`CREATE TABLESPACE`](/doc/refman/8.0/en/create-tablespace.html) and + [`ALTER TABLESPACE`](/doc/refman/8.0/en/alter-tablespace.html) syntax. The new + options, which permit defining storage engine attributes for + tables, columns, indexes, and tablespaces, are reserved for + future use. + + The following [`INFORMATION_SCHEMA`](/doc/refman/8.0/en/information-schema.html) + tables were added for querying storage engine attributes for + tables, columns, indexes, and tablespaces. Values are stored in + the data dictionary. The tables are reserved for future use. + + + [`INFORMATION_SCHEMA.TABLES_EXTENSIONS`](/doc/refman/8.0/en/information-schema-tables-extensions-table.html) + + [`INFORMATION_SCHEMA.COLUMNS_EXTENSIONS`](/doc/refman/8.0/en/information-schema-columns-extensions-table.html) + + [`INFORMATION_SCHEMA.TABLE_CONSTRAINTS_EXTENSIONS`](/doc/refman/8.0/en/information-schema-table-constraints-extensions-table.html) + + [`INFORMATION_SCHEMA.TABLESPACES_EXTENSIONS`](/doc/refman/8.0/en/information-schema-tablespaces-extensions-table.html) + + (WL #13341) +* The default logging level for MySQL Server omits informational + log messages, which previously included some significant + lifecycle events for Group Replication that were non-error + situations, such as a group membership change. Messages about + significant events for a replication group have now been + reclassified as system messages, so they always appear in the + server error log regardless of the server logging level. + Operators can therefore review a complete history of the + server's membership in a replication group. In addition, socket + bind errors on the group communication layer have been + reclassified from information to error messages. + (WL #13769) + +### Bugs Fixed + +* **InnoDB:** + A `GROUP BY` operation on a + `JSON` array column caused failures in an UBSan + build of MySQL due to incorrect type casting. + (Bug #31451475) +* **InnoDB:** + Several `InnoDB` error log messages were + defined without symbolic values. + (Bug #31401028) +* **InnoDB:** + The file segment for a single page write was not released after + a data file write failure associated with a doublewrite flush + and sync operation. + (Bug #31370227) +* **InnoDB:** + Code that was accessed when undo tablespace truncation used the + same space ID before and after a truncate operation was removed. + That scenario no longer occurs. The truncated undo tablespace is + replaced by a new undo tablespace datafile with a different + space ID. + (Bug #31354435) +* **InnoDB:** + The range of reserved space IDs for undo tablespaces was + increased from 512 per undo tablespace to 400000. + (Bug #31340834) +* **InnoDB:** + An error that occurred while inserting a log into the + `ddl_log` table was not returned making it + appear as though the operation was successful, and a transaction + was not registered while performing a tablespace encryption + operation. + (Bug #31236217) +* **InnoDB:** + The `lob::purge()` function did not free LOBs + correctly for an undo log record type + (`TRX_UNDO_UPD_DEL_REC`) that is generated when + an insert operation modifies a delete-marked record. + (Bug #31222046, Bug #99339) +* **InnoDB:** + A shutdown error occurred following an attempt to rebuild a + discarded partition. + (Bug #31215415) +* **InnoDB:** + The internal `get_real_path()` function, + responsible for retrieving directory or a file path, was + modified to strip trailing separators before determining if a + path is a file or directory. Additionally, if a path does not + exist or cannot be identified as a file or subdirectory, the + function now assumes the path is a file if the basename has a + three letter suffix. + (Bug #31215160) +* **InnoDB:** + Tablespace-related error messages were revised. + (Bug #31205520, Bug #31205441) +* **InnoDB:** + To avoid potential compilation issues, + `__attribute__((const))` and + `__attribute__((pure))` attributes were removed + from internal `InnoDB` functions. + (Bug #31153123) +* **InnoDB:** + The parallel read thread limit was not observed when spawning + read threads for histogram sampling, causing an assertion + failure. + (Bug #31151218) +* **InnoDB:** + The transaction read view was not checked when sampling records + for generation of histogram statistics. + (Bug #31151077) +* **InnoDB:** + An I/O completion routine was not able acquire an LRU list mutex + due to a latch held by another thread. + (Bug #31128739) +* **InnoDB:** + An attachable transaction thread requested an + `InnoDB` ticket that was already reserved by + the main thread, causing a deadlock. Additionally, the server + failed to respond to [`KILL`](/doc/refman/8.0/en/kill.html) + statements in this deadlock scenario. + (Bug #31090777) +* **InnoDB:** + The [`INNODB_METRICS`](/doc/refman/8.0/en/information-schema-innodb-metrics-table.html) table + `AVG_COUNT_RESET` value for a counter defined + as a module owner reported NULL. The + `METRIC_AVG_VALUE_RESET` field was incorrectly + marked as NULL. Thanks to Fungo Wang for the contribution. + (Bug #31084706, Bug #98990) +* **InnoDB:** + At startup, following an unexpected stoppage during an undo + tablespace truncate operation, some rollback segment header + pages were found to be corrupted. Encryption of rollback segment + header pages was initiated while the header pages were being + written, resulting in some header pages not being encrypted, as + expected. + (Bug #31045160) +* **InnoDB:** + Various aspects of the lock system (`lock_sys`) + code were refactored, and issues with + `lock_sys` + `lock_rec_block_validate()` and + `lock_test_prdt_pacge_lock()` functions were + fixed. The `lock_rec_block_validate()` function + called another function repeatedly, which could result in locks + not being validated under certain circumstances. The + implementation also had a potential quadratic time complexity. + The `lock_test_prdt_page_lock()` function did + not iterate over all locks as intended. + (Bug #31001732) +* **InnoDB:** + Use of memory-mapped files after exceeding the + [`temptable_max_ram`](/doc/refman/8.0/en/server-system-variables.html#sysvar_temptable_max_ram) threshold + caused a performance degradation. + (Bug #30952983, Bug #98739) +* **InnoDB:** + In debug mode, a [`DROP TABLE`](/doc/refman/8.0/en/drop-table.html) + operation on a table with an incorrectly defined + `COMPRESSION` clause caused a failure. + `InnoDB` did not return an error to the caller + for proper handling. + (Bug #30899683, Bug #98593) +* **InnoDB:** + Purge thread activity was excessive when the history list length + approached zero, wasting CPU resource and causing mutex + contention. + (Bug #30875956) +* **InnoDB:** + A regression introduced in MySQL 8.0.18 affected + [`INFORMATION_SCHEMA.INNODB_COLUMNS`](/doc/refman/8.0/en/information-schema-innodb-columns-table.html) + query performance. Schema and table data dictionary objects were + fetched repeatedly to retrieve partition column information. + (Bug #30837086, Bug #98449) + + References: This issue is a regression of: Bug #93033, Bug #28869903. +* **InnoDB:** + An [`ALTER TABLE ... + IMPORT TABLESPACE`](/doc/refman/8.0/en/alter-table.html) operation with a + `.cfg` file failed with an “Incorrect + key file for table” error. The + `row_import::m_flags` member was not + initialized. + (Bug #30830441) +* **InnoDB:** + A [`DROP TABLE`](/doc/refman/8.0/en/drop-table.html) operation performed + after discarding a partition did not remove the associated data + files, and [`DROP DATABASE`](/doc/refman/8.0/en/drop-database.html) failed + with an error indicating that the database directory could not + be removed. Upgrade from MySQL 5.7 to MySQL 8.0 also failed if a + partitioned table with a discarded partition was present. The + `DISCARD` attribute was applied to the table + object instead of the partition object in the data dictionary, + which made it appear that all partitions were discarded. + (Bug #30818917) +* **InnoDB:** + The server failed intermittently with an “ibuf cursor + restoration fails” error. + (Bug #30770380, Bug #91033) +* **InnoDB:** + An [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) operation that + copied data from one table to another returned an “Out of + range value for column” error. The counter that tracks + the number of `AUTO_INCREMENT` rows required + for a multi-row insert operation was not always set back to zero + after a bulk insert operation. + (Bug #30765952, Bug #98211) +* **InnoDB:** + The internal TempTable `records_in_range()` + handler function contained a `DBUG_ABORT()` + call that caused assertion failures in debug builds, and empty + result sets in regular builds for some queries. + (Bug #30716037) +* **InnoDB:** + The `btr_cur_pessimistic_update()` function + failed to handle a cursor position change caused by a + `lob::purge()` call. + (Bug #30712878) +* **InnoDB:** + A type conversion failure during a `DELETE + IGNORE` operation caused an assertion failure. A + `JSON` value was not converted to the expected + value. + (Bug #30664660) +* **InnoDB:** + A purge operation encountered a null LOB reference, causing an + assertion failure. + (Bug #30658887) +* **InnoDB:** + Chunk size was not calculated correctly when deallocating memory + from the `TempTable` storage engine, causing a + regression in `SELECT DISTINCT` query + performance. + (Bug #30562964) +* **InnoDB:** + A segmentation fault occurred in the TempTable storage engine + while using the thread pool plugin. TempTable thread-local + variables were not compatible with the use of different threads + for statements issued by a single client connection. Use of + thread local variables also lead to excessive memory consumption + due to the memory used by thread-local variables remaining + allocated for the life of the thread. To address these issues, + thread-local variables were replaced by a caching mechanism. + (Bug #30050452, Bug #31116036, Bug #99136) +* **InnoDB:** + A fatal “page still fixed or dirty” error occurred + during shutdown. + (Bug #29759555, Bug #95285) + + References: This issue is a regression of: Bug #29207450. +* **Partitioning:** + A query against a partitioned table, which used an + `ORDER BY`, returned unordered results under + the following conditions: + + + The table had a composite index with a prefix on one of the + columns. + + The query's `WHERE` clause contained an + equality condition on the prefixed column. + + The column with the prefix was the leftmost column in the + index. + + The column used in the `ORDER BY` was the + rightmost column in the index. + + The index was used for handling the `ORDER + BY`. + + Our thanks to Quanan Han for the suggestion. + (Bug #84070, Bug #25207522) +* **Replication:** + If a group's consistency level (set by the + [`group_replication_consistency`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_consistency) + system variable) was set to `BEFORE` or + `BEFORE_AND_AFTER`, it was possible for a + deadlock to occur in the event of a primary failover. The + primary failover is now registered differently to avoid this + situation. + (Bug #31175066, Bug #98643) +* **Replication:** + When a replication source server shuts down and restarts, its + [`MEMORY`](/doc/refman/8.0/en/memory-storage-engine.html) tables become empty. To + replicate this effect to replicas, the first time that the + source uses a given [`MEMORY`](/doc/refman/8.0/en/memory-storage-engine.html) table + after startup, it notifies replicas that the table must be + emptied by writing a [`DELETE`](/doc/refman/8.0/en/delete.html) + statement for that table to the binary log. Previously, the + generated [`DELETE`](/doc/refman/8.0/en/delete.html) statement was + written to the binary log statement cache for the current + session, which could result in it being logged together with + other statements under the same GTID, or logged without + `BEGIN` and `COMMIT` + statements. Also, in some situations, the generated + [`DELETE`](/doc/refman/8.0/en/delete.html) statement could consume + the GTID intended for the transaction that triggered it. The + generated [`DELETE`](/doc/refman/8.0/en/delete.html) statement is now + logged with accompanying `BEGIN` and + `COMMIT` statements, and the resulting + transaction is flushed to the binary log immediately after it is + written to the statement cache, so that it always receives its + own GTID and is kept separate from other transactions. + (Bug #30527929, Bug #25681518, Bug #77729) +* **Replication:** + Following a patch in MySQL 8.0.14, if a function call contained + operations on temporary tables, it could be written to the + binary log in statement format when + [`binlog_format = MIXED`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_format) was set. + This led to [`CREATE TEMPORARY + TABLE`](/doc/refman/8.0/en/create-temporary-table.html) statements being incorrectly written to the + binary log if they contained a function call. Following further + analysis, operations on temporary tables in stored functions and + triggers are now marked as unsafe for binary logging in + statement format, as they have a strong chance of causing issues + with replication. When [`binlog_format = + MIXED`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_format) is set, these operations are now logged in row + format. + (Bug #30395151, Bug #30320009) +* **Replication:** + A fix made in MySQL 8.0.14 and MySQL 5.7.25 for a deadlock + scenario involving the system variables + [`binlog_transaction_dependency_tracking`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_transaction_dependency_tracking) + and + [`binlog_transaction_dependency_history_size`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_transaction_dependency_history_size) + had the side effect of leaving the writeset history used for + transaction dependency tracking unprotected from concurrent + update. The writeset history and tracking mode are now locked + correctly whenever they are accessed. + (Bug #29719364, Bug #95181) + + References: See also: Bug #28511326, Bug #91941. +* **Replication:** + If a [`CHANGE MASTER TO`](/doc/refman/8.0/en/change-master-to.html) statement + was issued with `MASTER_USER` specified as + empty (`MASTER_USER=''`), the statement + succeeded and cleared any previously specified user name in the + replication metadata repositories. However, if information was + subsequently read from the repositories, for example during an + automatic restart of a Group Replication channel, a default user + name could be substituted for the channel. This issue has now + been fixed, so from MySQL 8.0.21, it is a valid approach to set + an empty `MASTER_USER` user name if you always + provide user credentials using the [`START + SLAVE`](/doc/refman/8.0/en/start-slave.html) statement or [`START + GROUP_REPLICATION`](/doc/refman/8.0/en/start-group-replication.html) statement that starts the + replication channel. This approach means that the replication + channel always needs operator intervention to restart, but the + user credentials are not recorded in the replication metadata + repositories. + + The documentation for the [`CHANGE MASTER + TO`](/doc/refman/8.0/en/change-master-to.html) statement has also been corrected to clarify that + it is possible to specify `MASTER_USER=''`, and + the resulting error occurs only if you attempt to start the + replication channel with the empty credentials. + (Bug #27357189) +* **Group Replication:** + A global value that is set for the + [`group_replication_consistency`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_consistency) + system variable, which controls all user connections, is applied + on Group Replication's internal connections to MySQL Server + modules using the SQL API, which are handled in a similar way to + user connections. This could sometimes lead to Group Replication + reporting the use of + [`group_replication_consistency`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_consistency) + as an error, for example when checking the clone plugin status + during distributed recovery. Such internal connections using the + SQL API now use consistency level `EVENTUAL`, + which matches the behavior before + [`group_replication_consistency`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_consistency) + was available, and does not cause an error message. + (Bug #31303354, Bug #99345) +* **Group Replication:** + On Windows, Group Replication's use of the Windows API function + SleepConditionVariableCS to wait for new write events caused + noticeably high CPU usage by this function after Group + Replication had been running for two days or more, which could + be corrected by restarting the MySQL server instance, but then + increased again over time as before. This was caused by the use + of two clock functions to calculate the timeout after which the + SleepConditionVariableCS function was called, which drifted + relative to each other over time, making the timeout + progressively shorter and the calls to the function more + frequent. The issue has been corrected on Windows by using the + current time from a single clock to calculate the timeout. + (Bug #31117930) +* **Group Replication:** + If Group Replication was stopped while distributed recovery was + in progress, memory issues could result from an attempt to + access the record of the member that was selected as the donor. + This record is now kept locally with the distributed recovery + state. + (Bug #31069563) +* **Group Replication:** + When distributed recovery for Group Replication involves a + remote cloning operation, the flag set on the server to indicate + this remains set until the server instance is restarted. + Previously, if Group Replication was stopped and restarted on + the server, that flag caused Group Replication to purge the + relay log files for the + `group_replication_applier` channel, as is + required on starting after a remote cloning operation to ensure + that there is no mismatch with the cloned data tables. If there + were any unapplied transactions in the purged relay log files, + the member could not subsequently be used to bootstrap a group, + although it could successfully join a group by retrieving the + transactions from another member. Group Replication now ignores + the flag on its second or subsequent starts, and only purges the + relay log files the first time it is started after a remote + cloning operation. + (Bug #31059680) +* **Group Replication:** + To avoid the possibility of data inconsistency, Group + Replication blocks a new incarnation of the same server (with + the same address but a new identifier) from joining the group + while its old incarnation is still listed as a member. + Previously, the Group Replication Group Communication System + (GCS) treated the connection to the old incarnation of a server + as active while it was attempting to send messages to the + server, and only recognized that the connection was inactive + when the socket returned an error, which might take a + significant amount of time. During that period, the new + incarnation of the server was unable to join the group because + the existing members did not connect to it, as they were still + waiting on the connection to the old incarnation. Now, GCS only + treats a connection to a server as active while messages can be + sent to it successfully. If the socket is no longer writeable, + the server connection is treated as inactive and is proactively + closed. The connection close triggers the group member to + attempt reconnection to that server address, upon which a + connection is established to the new incarnation of the server, + enabling the new incarnation to join the group. + (Bug #30770577) +* **Group Replication:** + Group Replication did not broadcast a notification when + switching from single-primary mode to multi-primary mode. The + change is now notified for use in routing. + (Bug #30738896) +* **Group Replication:** + Setting the + [`group_replication_force_members`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_force_members) + system variable to force a specified membership for a group + could fail if another member had already requested the expulsion + of the member that was driving the + [`group_replication_force_members`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_force_members) + operation. The operation to implement the configuration + specified by the + [`group_replication_force_members`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_force_members) + system variable forced any pending group reconfigurations to + take place first. If one of those successfully expelled the + member where the system variable had been set, because the expel + timeout that was set on the member had expired, the operation + timed out and failed to complete. To avoid this situation, Group + Replication now proceeds directly to implementing the new + configuration specified by the + [`group_replication_force_members`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_force_members) + system variable, and ignores any other pending group + reconfigurations. + (Bug #29820966) +* **Group Replication:** + Group Replication tracking of connections to other group members + only took into account the incoming connections, not the + outgoing connections. This meant if the outgoing connection from + member A to member B was broken, for example by a firewall + configuration issue, but the incoming connection from member B + to member A was intact, member A would display member B's status + as `ONLINE`, although member A's messages were + not reaching member B. Member B would display member A's status + as `UNREACHABLE`. Now, if a group member starts + to receive pings from another group member to which it has an + active connection (in this case, if member A received pings from + member B), this is treated as an indicator of an issue with the + connection. If sufficient pings are received, the connection is + shut down by the recipient of the pings (in this case, member + A), so that the status of the connection is consistent for both + members. + (Bug #25660161, Bug #84796) +* **JSON:** + When the expression and path passed to + [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table) yielded a JSON null, + the function raised an error instead of returning SQL + `NULL` as required. + (Bug #31345503) +* **JSON:** + In MySQL 5.7, and in MySQL 8.0 prior to 8.0.17, the server + attempted to convert JSON boolean values to their SQL + counterparts when testing them directly with `IS + TRUE`, as shown here: + + ```None + mysql> CREATE TABLE test (id INT, col JSON); + + mysql> INSERT INTO test VALUES (1, '{"val":true}'), (2, '{"val":false}'); + + mysql> SELECT id, col, col->"$.val" FROM test WHERE col->"$.val" IS TRUE; + +------+---------------+--------------+ + | id | col | col->"$.val" | + +------+---------------+--------------+ + | 1 | {"val": true} | true | + +------+---------------+--------------+ + ``` + + As the result of work done in MySQL 8.0.17 to ensure that all + predicates in SQL conditions are complete (that is, a condition + of the form `WHERE + value` is rewritten as + `WHERE value <> + 0`), and that a `NOT IN` or + `NOT EXISTS` condition in a + `WHERE` or `ON` clause is + converted to an antijoin, evaluation of a JSON value in an SQL + boolean context performs an implicit comparison against JSON + integer 0. This means that the query shown previously returns + the following result in MySQL 8.0.17 and later: + + ```None + mysql> SELECT id, col, col->"$.val" FROM test WHERE col->"$.val" IS TRUE; + +------+----------------+--------------+ + | id | col | col->"$.val" | + +------+----------------+--------------+ + | 1 | {"val": true} | true | + | 2 | {"val": false} | false | + +------+----------------+--------------+ + ``` + + In such cases, the server also now provides a warning: + Evaluating a JSON value in SQL boolean context does + an implicit comparison against JSON integer 0; if this is not + what you want, consider converting JSON to a SQL numeric type + with JSON\_VALUE RETURNING. Thus, the query can now + be rewritten using [`JSON_VALUE()`](/doc/refman/8.0/en/json-search-functions.html#function_json-value) + as shown here: + + ```None + mysql> SELECT id, col, col->"$.val" FROM test + -> WHERE JSON_VALUE(col, "$.val" RETURNING UNSIGNED) IS TRUE; + +------+---------------+--------------+ + | id | col | col->"$.val" | + +------+---------------+--------------+ + | 1 | {"val": true} | true | + +------+---------------+--------------+ + ``` + + (Bug #31168181) +* **JSON:** + A `GROUP BY` query against a table having a + multi-valued index was not always handled correctly by the + server. + (Bug #31152942) +* If [`log_error_services`](/doc/refman/8.0/en/server-system-variables.html#sysvar_log_error_services) was + persisted, in some cases it could take effect at the wrong time + during startup. + (Bug #31464539) +* [`SHOW CREATE USER`](/doc/refman/8.0/en/show-create-user.html) after certain + manual grant table modifications could cause a server exit. + (Bug #31462844) +* Some in-memory updates of partial revokes could produce + incorrect privileges. + (Bug #31430086) +* If [`log_error_verbosity`](/doc/refman/8.0/en/server-system-variables.html#sysvar_log_error_verbosity) was set + using [`SET + PERSIST`](/doc/refman/8.0/en/set-variable.html), it did not take effect early enough during + server startup to affect `InnoDB` + initialization. + (Bug #31410674) +* The parser incorrectly raised an assertion before rejecting + subqueries in generated column expressions. + (Bug #31396191) +* This release makes the following two micro-optimizations for + degenerate hash joins (that is, those with no join conditions): + + 1. For a degenerate hash antijoin or semijoin, add + `LIMIT 1` when building the hash table, + since having more rows than this cannot change the result. + 2. For a degenerate hash antijoin with a nonempty hash table, + avoid scanning the outer side. + + Together, these changes handle a performance regression whereby + a rewrite to a hash antijoin caused a `NOT + EXISTS` query which was not rewritten to be executed by + the optimizer and be replaced with “zero rows + found”. To handle the case in which a nested loop is used + instead, a non-correlated subquery inside `NOT + EXISTS` is no longer transformed to an antijoin. + + This fix also applies to subqueries using + `constant NOT IN + (non_correlated_subquery)`. + (Bug #31376809) +* Configuring with + [`-DWITH_EDITLINE=system`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_editline) resulted in + compilation failures for older library versions. + (Bug #31366715) +* The upgrade of the bundled `libedit` library in + the previous MySQL distribution caused a problem for builds + using that library such that + **CTRL**+**C** (SIGINT) in the + **mysql** client required a following Enter to + take effect in some circumstances. + (Bug #31360025) +* Columns declared with both `AUTO_INCREMENT` and + `DEFAULT` value expressions are a nonpermitted + combination, but [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) + failed to produce an error for `SET DEFAULT + (expr)` operations on + `AUTO_INCREMENT` columns. + (Bug #31331454) +* It was possible to set the + [`protocol_compression_algorithms`](/doc/refman/8.0/en/server-system-variables.html#sysvar_protocol_compression_algorithms) + system variable to the empty string. This is no longer + permitted. + (Bug #31326231) +* A lookup function used internally in the MySQL server returns + integer -1 when the argument is ambiguous; this resulted in + undefined behavior when this value was converted to an unsigned + value prior to use as an argument in subsequent calculations. + Now when the function returns -1, this is handled as an error + and the value is not used further. + (Bug #31326120) +* Negation of a signed value in certain cases led to undefined + behavior; to prevent this from occurring, the value to be + negated is now treated as unsigned. + (Bug #31325602) +* The [`WEIGHT_STRING()`](/doc/refman/8.0/en/string-functions.html#function_weight-string) function did + not always return the correct result for an integer argument. + (Bug #31321257) + + References: This issue is a regression of: Bug #30776132. +* Assigning [`CONCAT('')`](/doc/refman/8.0/en/string-functions.html#function_concat) or + [`CONCAT_WS('')`](/doc/refman/8.0/en/string-functions.html#function_concat-ws) to a variable set + the variable to `NULL`, not the empty string. + (Bug #31320716, Bug #99485, Bug #31413167, Bug #99722) +* Corrected problems where under some circumstances privilege + restrictions could be ignored. + (Bug #31306814, Bug #31315692) +* Certain [`SELECT`](/doc/refman/8.0/en/select.html) statement + privileges to lock rows were not checked properly and could + block other users incorrectly. + (Bug #31293065) +* When performing a filesort, an internal function could sometimes + return `NULL` on failure, even if the subselect + being sorted was not nullable. + (Bug #31281602) +* Statement rewriting for the binary log was inefficient on + Windows. + (Bug #31260698) + + References: This issue is a regression of: Bug #30654405. +* An inconsistency in representing anonymous users in memory could + cause issues while performing privilege-granting operations. + (Bug #31246179) +* If the administrative connection interface was enabled, a race + condition could lead to problems accepting Unix socket file + connections on the main connection interface. + (Bug #31241872) +* When a role was granted with `WITH ADMIN + OPTION`, the grantee was able to manage the role only + after activating it. + (Bug #31237368) +* Invalid rows in the `default_roles` or + `role_edges` system tables could cause server + misbehavior. + (Bug #31217385) +* Component deinitialization failure at runtime could lead to + repeated messages written to the error log at shutdown. + (Bug #31217037) +* The prohibition on granting roles to anonymous users was + incompletely enforced. + (Bug #31215017) +* A privilege-escalation issue was corrected. + (Bug #31210226) +* The `keyring_hashicorp` keyring plugin did not + perform sufficient validity checking on the values of its + configuration parameters. + (Bug #31205363) +* The `keyring_hashicorp` keyring plugin did not + permit binary log encryption to be enabled (by setting the + [`binlog_encryption`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_encryption) system + variable). + (Bug #31204841) +* The `keyring_hashicorp` keyring plugin did not + permit an encryption password to be set by the + `audit_log` plugin. + (Bug #31197670) +* Some queries using + [`REGEXP_SUBSTR()`](/doc/refman/8.0/en/regexp.html#function_regexp-substr) with an + `ORDER BY` clause were not handled correctly by + the server. + (Bug #31184858) +* Some instances where pointer arithmetic was applied to + `nullptr` were corrected. + (Bug #31172750) +* If the available file descriptors were exhausted, + [`mysql_real_connect()`](/doc/c-api/8.0/en/mysql-real-connect.html) caused the + client to exit. + (Bug #31151052) +* Using the **killall** command to initiate a + **mysqld** shutdown resulted in no message being + logged to indicate the start of shutdown. This has been + corrected. + (Bug #31121907) +* Calling + [`mysql_real_connect_nonblocking()`](/doc/c-api/8.0/en/mysql-real-connect-nonblocking.html) + with an invalid host could cause the client to exit upon calling + [`mysql_close()`](/doc/c-api/8.0/en/mysql-close.html). + (Bug #31104389, Bug #99112) +* For Debian packages, Python 2 dependencies that could cause + installation failures were removed. + (Bug #31099324) +* A potential memory leak in `lf_hash_insert()` + was fixed. + (Bug #31090258, Bug #99078) +* Within the LDAP SASL authentication plugins, multiple calls to + `sasl_client_done()` could cause undefined + behavior in some cases. + (Bug #31088206) +* With the thread pool plugin enabled, high concurrency conditions + could cause loss of client context resulting in a server exit. + (Bug #31085322) +* For result sets processed using + [`mysql_use_result()`](/doc/c-api/8.0/en/mysql-use-result.html), + [`mysql_fetch_row_nonblocking()`](/doc/c-api/8.0/en/mysql-fetch-row-nonblocking.html) + did not increment the number of rows, so that after all the rows + were fetched, [`mysql_num_rows()`](/doc/c-api/8.0/en/mysql-num-rows.html) + returned an incorrect number of rows. + (Bug #31082201, Bug #99073) +* Removed an unneeded optimization for `EXISTS()` + that was never actually evaluated. + (Bug #31069510) +* For a server started with the + [`--skip-grant-tables`](/doc/refman/8.0/en/server-options.html#option_mysqld_skip-grant-tables) option, + enabling the [`partial_revokes`](/doc/refman/8.0/en/server-system-variables.html#sysvar_partial_revokes) + system variable caused a server exit. + (Bug #31066069, Bug #31202963) +* Queries that used a recursive common table expression with an + outer reference could return incorrect results. + (Bug #31066001, Bug #99025) +* The parser could fail for multibyte character sets with a + minimum character length greater than 1 byte. + (Bug #31063981) +* In some cases, the [`LEAST()`](/doc/refman/8.0/en/comparison-operators.html#function_least) + function could return `NULL` for non-nullable + input. + (Bug #31054254) + + References: This issue is a regression of: Bug #25123839. +* [`mysql_real_connect_nonblocking()`](/doc/c-api/8.0/en/mysql-real-connect-nonblocking.html) + blocked if the `MYSQL_OPT_CONNECT_TIMEOUT` + option was set. + (Bug #31049390, Bug #98980) +* The last call to the + [`mysql_fetch_row_nonblocking()`](/doc/c-api/8.0/en/mysql-fetch-row-nonblocking.html) C + API function to return the null row was setting an error when it + should not have. + (Bug #31048553, Bug #98947) +* On Windows, the default connection type uses a named pipe. The + nonblocking C API, which is intended for TCP/SSL connections, + did not take that into account and caused the client to exit. It + now produces an error message indicating the problem. + (Bug #31047717) +* X Plugin connections that failed to authenticate due to + nonexistence of the user modified the global + [`audit_log_filter_id`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_filter_id) system + variable. + (Bug #31025461) +* [`LOAD DATA`](/doc/refman/8.0/en/load-data.html) did not ignore hidden + generated columns when parsing input file rows. + (Bug #31024266, Bug #98925) +* Pinbox exhaustion in the metadata locking subsystem could + produce a misleading error message. + (Bug #31019269, Bug #98911) +* [`CREATE + TABLE ... SELECT`](/doc/refman/8.0/en/create-table-select.html) failed if it included a functional + index. + (Bug #31017765, Bug #98896) +* For X Protocol connections, checking the global session mutex + was improved to eliminate a minor performance degradation as the + number of threads increased. + (Bug #31000043) +* In certain cases, executing a query containing multiple + subqueries could lead to an unplanned shutdown of the server. + (Bug #30975826) +* [`SHOW CREATE TRIGGER`](/doc/refman/8.0/en/show-create-trigger.html) failed if + [`FLUSH TABLES WITH READ LOCK`](/doc/refman/8.0/en/flush.html#flush-tables-with-read-lock) was + in effect. + (Bug #30964944) +* Excessive access checks were performed on certain of the data + dictionary tables that underlie + `INFORMATION_SCHEMA` views, resulting in slow + [`SHOW COLUMNS`](/doc/refman/8.0/en/show-columns.html) performance. These + checks were reduced to improve performance. + + In addition, several [`SHOW`](/doc/refman/8.0/en/show.html) + statements implemented as `INFORMATION_SCHEMA` + queries were found to benefit from enabling the + [`derived_merge`](/doc/refman/8.0/en/switchable-optimizations.html#optflag_derived-merge) flag for the + [`optimizer_switch`](/doc/refman/8.0/en/server-system-variables.html#sysvar_optimizer_switch) system + variable. Such queries now internally enable that flag + temporarily for better performance, regardless of the flag + session value. Affected queries are: + + ```None + SHOW SCHEMAS + SHOW TABLES + SHOW TABLE STATUS + SHOW COLUMNS + SHOW KEYS + SHOW EVENTS + SHOW TRIGGERS + SHOW PROCEDURE STATUS + SHOW FUNCTION STATUS + SHOW CHARACTER SET + SHOW COLLATION + ``` + + (Bug #30962261, Bug #98750, Bug #30921214) +* Two otherwise identical queries executed separately returned one + row when using a case-sensitive collation and two rows with a + case-insensitive collation. When the same two predicates were + combined in a single query using `AND`, two + rows were returned when only one row should have been. + (Bug #30961924) +* [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) on a + [`SET`](/doc/refman/8.0/en/set.html) column that had a display + width greater than 255 was not done in place, even if otherwise + possible. + (Bug #30943642, Bug #98523) +* The server checked whether a number in yottabytes was too large + to print by comparing the value as a double to + `ULLONG_MAX`, which cannot be represented as a + double. This caused the double value immediately above + `ULLONG_MAX` yottabytes to be printed as + `0Y`, the erroneous conversion being reported + by Clang 10. + (Bug #30927590) +* Resource group SQL statements such as + [`CREATE RESOURCE GROUP`](/doc/refman/8.0/en/create-resource-group.html) did not + work over connections that use X Protocol. + (Bug #30900411) +* [`SHOW GRANTS`](/doc/refman/8.0/en/show-grants.html) could display + function privileges as procedure privileges. + (Bug #30896461, Bug #98570) +* The `audit_log` plugin mishandled connection + events when multiple clients connected simultaneously. + (Bug #30893593) +* The `LOCK_ORDER` tool reported a syntax error + for empty dependency graphs. Empty graphs are now permitted. + + The `LOCK_ORDER` tool could exhibit unexpected + behavior due to mishandling thread list maintenance. + (Bug #30889192) +* Upgrades from MySQL 5.7 did not grant the + [`REPLICATION_APPLIER`](/doc/refman/8.0/en/privileges-provided.html#priv_replication-applier) privilege to + `root`. + (Bug #30783149) +* The [`gen_range()`](/doc/refman/8.0/en/data-masking-component-functions.html#function_gen-range) user-defined + function could mishandle its arguments, causing a server exit. + (Bug #30763294) +* During [`UPDATE`](/doc/refman/8.0/en/update.html) processing, + conversion of an internal in-memory table to + `InnoDB` could result in a key-length error. + (Bug #30674616) +* Attempts to grant dynamic privileges (which are always global) + at the procedure or function level did not produce an error. + (Bug #30628160) +* Table value constructors ignored the `LIMIT` + clause. The clause is now taken into account. For example: + `VALUES ROW(1), ROW(2), ROW(3) LIMIT 2` outputs + 1 and 2. + (Bug #30602659) +* It is possible to define a column named `*` + (single asterisk character), but `` SELECT `*` `` + was treated identically to `SELECT *`, making + it impossible to select only this column in a query; in other + words, the asterisk character was expanded to a list of all + table columns even when it was surrounded by backticks. + (Bug #30528450) +* The [`FROM_DAYS()`](/doc/refman/8.0/en/date-and-time-functions.html#function_from-days) function could + produce results that were out of range (with the year > + 9999). + (Bug #30455845, Bug #97340) +* For debug builds, altering the `mysql.func` + table to `MyISAM` (not a recommended operation + in any case) caused a server exit. Now this operation is + prohibited. + (Bug #30248138, Bug #96692) +* Queries on the `INFORMATION_SCHEMA` + [`KEY_COLUMN_USAGE`](/doc/refman/8.0/en/information-schema-key-column-usage-table.html) and + [`TABLE_CONSTRAINTS`](/doc/refman/8.0/en/information-schema-table-constraints-table.html) views could be + slow due to [`UNION`](/doc/refman/8.0/en/union.html) use in their + definitions. These were rewritten to move the + [`UNION`](/doc/refman/8.0/en/union.html) into a + `LATERAL` table to enable the optimizer to + better use indexes. + (Bug #30216864, Bug #30766181, Bug #98238) +* In certain cases, a `LIMIT` clause incorrectly + caused the optimizer to estimate that zero rows needed to be + read from a table. + (Bug #30204811) + + References: This issue is a regression of: Bug #29487181. +* An internal packet-length function returned values of the wrong + integer type. + (Bug #30139031) +* Calculations by **mysqldump** for the length of + [`INSERT`](/doc/refman/8.0/en/insert.html) statements did not take + into account the `_binary` character set + introducer used for [`VARBINARY`](/doc/refman/8.0/en/binary-varbinary.html) + strings. + (Bug #29998457, Bug #96053) +* The messages printed to the error log during upgrade of + partitioned tables defined with prefix keys did not provide + sufficient details. Detailed warnings that indicate the schema, + table, column, and prefix length are now printed. + (Bug #29942014) + + References: See also: Bug #31100205. +* [`mysql_store_result()`](/doc/c-api/8.0/en/mysql-store-result.html) could fail + to detect invalid data packets. + (Bug #29921423) +* An assertion was raised if creating a child table in a foreign + key relation caused an engine substitution. + (Bug #29899151, Bug #95743) +* **mysqltest** and + **mysql-test-run.pl** no longer support the + `--sleep` command-line option. + **mysqltest** no longer supports the + `real_sleep` command. + (Bug #29770237) +* The server permitted connections for hosts with names longer + than the maximum permitted length (255 characters). + (Bug #29704941) +* In a multiple-table [`UPDATE`](/doc/refman/8.0/en/update.html) that + updated the key of the first table, if a temporary table + strategy was used, duplicate entries could be written to the + temporary table, followed by occurrence of a `Can't find + record` error. + (Bug #28716103) +* The server sometimes mistakenly removed a subquery with a + `GROUP BY` when optimizing a query, even in + some cases when this subquery was used by an outer select. This + could occur when the subquery also used an aggregate function. + (Bug #28240054) +* Coercibility of the [`NAME_CONST()`](/doc/refman/8.0/en/miscellaneous-functions.html#function_name-const) + function was assessed incorrectly. + (Bug #26319675) +* When reading rows from a storage engine, errors other than + “no more records” could be ignored, leading to + problems later. + (Bug #20162055) +* When a multi-table update used a temporary table, this was not + shown in the output of + [`EXPLAIN + FORMAT=TREE`](/doc/refman/8.0/en/explain.html), even though such use could have an impact + on the performance of the [`UPDATE`](/doc/refman/8.0/en/update.html) + statement for which this was done. + (Bug #17978975) +* When performing a filesort for removing duplicates, such as when + executing `SELECT DISTINCT`, it may be + necessary to perform another sort afterwards to satisfy an + `ORDER BY`. In cases where such an + `ORDER BY` had been pushed down into the first + table of a join, as opposed to the join as a whole, this final + sort was not actually performed. + (Bug #99687, Bug #31397840) +* Refactoring work done in MySQL 8.0.20 caused single-row + buffering for `GROUP BY` of non-nullable + columns not to function correctly, not taking into account that + such a column could be the inner table for an outer join, and + thus would have a `NULL` flag that would need + to be copied. In a `GROUP BY` without a + temporary table, this would cause the `NULL` + flag to come from the next output row instead of the previous + one, and the data returned to be inconsistent. + (Bug #99398, Bug #31252625) + + References: This issue is a regression of: Bug #30460528. +* A logical error in the constant folding code for the case in + which a constant of type [`DECIMAL`](/doc/refman/8.0/en/fixed-point-types.html) + or [`FLOAT`](/doc/refman/8.0/en/floating-point-types.html) was the left-hand + operand and an integer column value was the right-hand operand + yielded an incorrect result. + (Bug #99145, Bug #31110614) +* A query whose predicate compared `0` with + `-0` where at least one of these was a + floating-point value returned incorrect results. + (Bug #99122, Bug #31102789) +* Reimplemented rollups without using slices. This fixes the + following known issues: + + + A repeating column in a `GROUP BY ... WITH + ROLLUP` yielded the wrong result; that is, a + `GROUP BY` of the form `GROUP BY a, + b, a WITH ROLLUP` erroneously produced + `NULL` for some of the column names in the + result. + + A `GROUP BY ... WITH ROLLUP` that did not + require a temporary table to print the result also produced + an erroneous `NULL` in place of at least + one of the expected column names in the output. + + (Bug #98768, Bug #99141, Bug #26227613, Bug #29134467, Bug #30967158, Bug #30969045, Bug #31110494) +* `SELECT DISTINCT(` [`HEX(`](/doc/refman/8.0/en/string-functions.html#function_hex)[`WEIGHT_STRING(varchar_column) ) + )`](/doc/refman/8.0/en/string-functions.html#function_weight-string) returned a truncated result. + (Bug #98592, Bug #30898753) +* Problems with error handling in queries with + [`MAX()`](/doc/refman/8.0/en/aggregate-functions.html#function_max), + [`MIN()`](/doc/refman/8.0/en/aggregate-functions.html#function_min), or both, combined with a + `GROUP BY` clause, meant that such a query + continued executing until it went through all possible + iterations even when an error should have caused it to terminate + immediately. + (Bug #98242, Bug #30769515) +* After refactoring the type propagation code for + [`LEAST()`](/doc/refman/8.0/en/comparison-operators.html#function_least), + [`GREATEST()`](/doc/refman/8.0/en/comparison-operators.html#function_greatest), and other functions, + as well as [`UNION`](/doc/refman/8.0/en/union.html), an adjustment + of the result type for data types like + [`ENUM`](/doc/refman/8.0/en/enum.html) also replaced the calculated + integer data type with a type that could not accommodate both + signed and unsigned values. + (Bug #95148, Bug #29698617) + + References: This issue is a regression of: Bug #83895, Bug #25123839. diff --git a/corpus/changelog/mysql_releases/mysql_8022.md b/corpus/changelog/mysql_releases/mysql_8022.md new file mode 100644 index 0000000000000000000000000000000000000000..431d51f18ce3fea76de8b011f98a0331b10e75e3 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8022.md @@ -0,0 +1,1607 @@ +# MySQL 8.0.22 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-22.html +Version: 8.0.22 + +## Changes in MySQL 8.0.22 (2020-10-19, General Availability) + +For general information about upgrades, downgrades, platform support, etc., please visit [https://dev.mysql.com/doc/relnotes/mysql/8.0/en/](/doc/relnotes/mysql/8.0/en/). + +* [Account Management Notes](news-8-0-22.html#mysqld-8-0-22-account-management "Account Management Notes") +* [Audit Log Notes](news-8-0-22.html#mysqld-8-0-22-audit-log "Audit Log Notes") +* [C API Notes](news-8-0-22.html#mysqld-8-0-22-capi "C API Notes") +* [Compilation Notes](news-8-0-22.html#mysqld-8-0-22-compiling "Compilation Notes") +* [Configuration Notes](news-8-0-22.html#mysqld-8-0-22-configuration "Configuration Notes") +* [Deprecation and Removal Notes](news-8-0-22.html#mysqld-8-0-22-deprecation-removal "Deprecation and Removal Notes") +* [Keyring Notes](news-8-0-22.html#mysqld-8-0-22-keyring "Keyring Notes") +* [Optimizer Notes](news-8-0-22.html#mysqld-8-0-22-optimizer "Optimizer Notes") +* [Packaging Notes](news-8-0-22.html#mysqld-8-0-22-packaging "Packaging Notes") +* [Performance Schema Notes](news-8-0-22.html#mysqld-8-0-22-performance-schema "Performance Schema Notes") +* [Pluggable Authentication](news-8-0-22.html#mysqld-8-0-22-pluggable-auth "Pluggable Authentication") +* [SQL Syntax Notes](news-8-0-22.html#mysqld-8-0-22-sql-syntax "SQL Syntax Notes") +* [X Plugin Notes](news-8-0-22.html#mysqld-8-0-22-xplugin "X Plugin Notes") +* [Functionality Added or Changed](news-8-0-22.html#mysqld-8-0-22-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-22.html#mysqld-8-0-22-bug "Bugs Fixed") + +### Account Management Notes + +* Lock handling for statements involving the grant tables was + improved. + (Bug #31291237, Bug #31576185, WL #14084) +* Modifying the `mysql.infoschema` and + `mysql.sys` reserved accounts now requires the + [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) privilege. + (Bug #31255458) +* For the [`CREATE USER`](/doc/refman/8.0/en/create-user.html), + [`DROP USER`](/doc/refman/8.0/en/drop-user.html), and + [`RENAME USER`](/doc/refman/8.0/en/rename-user.html) account-management + statements, the server now performs additional security checks + designed to prevent operations that (perhaps inadvertently) + cause stored objects to become orphaned or that cause adoption + of stored objects that are currently orphaned. Such operations + now fail with an error. If you have the + [`SET_USER_ID`](/doc/refman/8.0/en/privileges-provided.html#priv_set-user-id) privilege, it + overrides the checks and those operations produce a warning + rather than an error; this enables administrators to perform the + operations when they are deliberately intended. See + [Orphan Stored Objects](/doc/refman/8.0/en/stored-objects-security.html#stored-objects-security-orphan-objects). + (WL #14073) + +### Audit Log Notes + +* For JSON-format log files, MySQL Enterprise Audit supports log-reading + operations using the + [`audit_log_read()`](/doc/refman/8.0/en/audit-log-reference.html#function_audit-log-read) user-defined + function. Previously, specifying the position at which to begin + reading was possible only by passing to + [`audit_log_read()`](/doc/refman/8.0/en/audit-log-reference.html#function_audit-log-read) an argument + containing a bookmark indicating the exact timestamp and event + ID of a particular event. For greater flexibility, the argument + now can be a start specifier that names any timestamp, to read + starting from the first event that occurs on or after that + timestamp. See [Reading Audit Log Files](/doc/refman/8.0/en/audit-log-file-reading.html). + (WL #13936) + +### C API Notes + +* The MySQL client library now includes a + [`mysql_real_connect_dns_srv()`](/doc/c-api/8.0/en/mysql-real-connect-dns-srv.html) C + API function that is similar to + [`mysql_real_connect()`](/doc/c-api/8.0/en/mysql-real-connect.html) but uses a + DNS SRV record to determine the candidate hosts for establishing + a connection to a MySQL server, rather than explicit host, port, + and socket arguments. + + Applications that use the C API can call the new function + directly. In addition, the **mysql** client + program is modified to use DNS SRV capability; it now supports a + [`--dns-srv-name`](/doc/refman/8.0/en/mysql-command-options.html#option_mysql_dns-srv-name) option that takes + precedence over [`--host`](/doc/refman/8.0/en/mysql-command-options.html#option_mysql_host) and causes + the connection to be based on a DNS SRV record. See + [mysql\_real\_connect\_dns\_srv()](/doc/c-api/8.0/en/mysql-real-connect-dns-srv.html). + + Connection establishment in other contexts is unaffected, + including connections made by replicas, the + `FEDERATED` storage engine, and client programs + other than **mysql**. + (WL #13905) + +### Compilation Notes + +* On Windows, Visual Studio 2019 Update 4 is now the minimum + version for MySQL compilation. + (Bug #31655401) +* The minimum version of the Boost library for server builds is + now 1.73.0. + (Bug #31309800) + +### Configuration Notes + +* The new [`WITH_TCMALLOC`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_tcmalloc) + **CMake** option indicates whether to link with + `-ltcmalloc`. If enabled, built-in + `malloc()`, `calloc()`, + `realloc()`, and `free()` + routines are disabled. The default is `OFF`. + [`WITH_TCMALLOC`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_tcmalloc) and + [`WITH_JEMALLOC`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_jemalloc) are mutually + exclusive. + (Bug #31785166) +* The new [`COMPRESS_DEBUG_SECTIONS`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_compress_debug_sections) + **CMake** option indicates whether to compress + the debug sections of binary executables (Linux only). + Compressing executable debug sections saves space at the cost of + extra CPU time during the build process. The default is + `OFF`. If this option is not set explicitly but + the `COMPRESS_DEBUG_SECTIONS` environment + variable is set, the option takes its value from that variable. + (Bug #31498296) +* The [`WITH_DEFAULT_FEATURE_SET`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_default_feature_set) + **CMake** option was removed. + (Bug #31122507) +* On platforms that implement network namespace support (such as + Linux), MySQL now enables configuring the network namespace for + TCP/IP connections from client programs to the MySQL server or + X Plugin: + + + On the server side, the + [`bind_address`](/doc/refman/8.0/en/server-system-variables.html#sysvar_bind_address), + [`admin_address`](/doc/refman/8.0/en/server-system-variables.html#sysvar_admin_address), and + [`mysqlx_bind_address`](/doc/refman/8.0/en/x-plugin-options-system-variables.html#sysvar_mysqlx_bind_address) system + variables have extended syntax for specifying the network + namespace to use for a given IP address or host name on + which to listen for incoming connections. + + For client connections, the **mysql** client + and the **mysqlxtest** test suite client + support a [`--network-namespace`](/doc/refman/8.0/en/mysql-command-options.html#option_mysql_network-namespace) + option for specifying the network namespace. + + For replication connections from replica servers to source + servers, the [`CHANGE MASTER TO`](/doc/refman/8.0/en/change-master-to.html) + statement supports a `NETWORK_NAMESPACE` + option for specifying the network namespace. + + For replication monitoring purposes, the Performance Schema + `replication_connection_configuration` table, + the replica server connection metadata repository (see + [Replication Metadata Repositories](/doc/refman/8.0/en/replica-logs-status.html)), and the + [`SHOW + REPLICA | SLAVE STATUS`](/doc/refman/8.0/en/show-replica-status.html) statement have a new column + that displays the applicable network namespace for connections. + + For more information, including the host system prerequisites + that must be satisfied to use this feature, see + [Network Namespace Support](/doc/refman/8.0/en/network-namespace-support.html). + (WL #12720) + +### Deprecation and Removal Notes + +* From MySQL 8.0.22, the + `group_replication_ip_whitelist` system + variable is deprecated, and the system variable + `group_replication_ip_allowlist` has been added + to replace it. The system variable works in the same way as + before, only the terminology has changed. + + For both system variables, the default value is + `AUTOMATIC`. If either one of the system + variables has been set to a user-defined value and the other has + not, the changed value is used. If both of the system variables + have been set to a user-defined value, the value of + `group_replication_ip_allowlist` is used. + (WL #14175) +* From MySQL 8.0.22, the statements `START + SLAVE`, `STOP SLAVE`, `SHOW + SLAVE STATUS`, `SHOW SLAVE HOSTS` and + `RESET SLAVE` are deprecated. The following + aliases should be used instead: + + + Instead of `START SLAVE` use `START + REPLICA` + + Instead of `STOP SLAVE` use `STOP + REPLICA` + + Instead of `SHOW SLAVE STATUS` use + `SHOW REPLICA STATUS` + + Instead of `SHOW SLAVE HOSTS` use + `SHOW REPLICAS` + + Instead of `RESET SLAVE` use `RESET + REPLICA` + + The statements work in the same way as before, only the + terminology used for each statement and its output has changed. + + New status variables have been added as aliases for the related + status variables. Both the old and new versions of the + statements update both the old and new versions of these status + variables: + + + `Com_slave_start` is equivalent to + `Com_replica_start` + + `Com_slave_stop` is equivalent to + `Com_replica_stop` + + `Com_show_slave_status` is equivalent to + `Com_show_replica_status` + + `Com_show_slave_hosts` is equivalent to + `Com_show_replicas` + + (WL #14171) +* The InnoDB memcached plugin is deprecated and support for it + will be removed in a future MySQL version. + (WL #14131) +* The [`INFORMATION_SCHEMA.TABLESPACES`](/doc/refman/8.0/en/information-schema-tablespaces-table.html) + table is unused. It is now deprecated and will be removed in a + future MySQL version. Other + `INFORMATION_SCHEMA` tables may provide related + information, as described in + [The INFORMATION\_SCHEMA TABLESPACES Table](/doc/refman/8.0/en/information-schema-tablespaces-table.html). + (WL #14064) + +### Keyring Notes + +* MySQL Enterprise Edition now includes a `keyring_oci` plugin that + uses Oracle Cloud Infrastructure Vault as a back end for keyring storage. No key + information is permanently stored in MySQL server local storage. + All keys are stored in Oracle Cloud Infrastructure Vault, making this plugin well + suited for Oracle Cloud Infrastructure MySQL customers for management of their MySQL Enterprise Edition + keys. For more information, see [The MySQL Keyring](/doc/refman/8.0/en/keyring.html). + (WL #9770) + +### Optimizer Notes + +* **Important Change:** + A prepared statement is now prepared only once, when executing + [`PREPARE`](/doc/refman/8.0/en/prepare.html), rather than once each + time it is executed. In addition, a statement inside a stored + procedure is also now prepared only once, when the stored + procedure is first executed. This change enhances performance of + such statements, since it avoids the added cost of repeated + preparation and rollback of preparation structures, the latter + being the source of several bugs. + + As part of this work, the manner in which dynamic parameters + used in prepared statements are resolved is changed, with the + resulting changes in prepared statement use cases listed here: + + + A parameter used in a prepared statement has its data type + determined when the statement is prepared, and the type + persists for each subsequent execution of the statement, + unless the statement is reprepared (see + [PREPARE Statement](/doc/refman/8.0/en/prepare.html), for information about when this + may occur). + + For a prepared statement of the form `SELECT + expr1, + expr2, ... FROM + table ORDER BY ?`, + passing an integer value *`N`* for + the parameter no longer causes ordering of the results by + the + *`N`*th + expression in the select list; the results are no longer + ordered, as is expected with `ORDER BY + constant`. + + It was possible (although unsupported) to insert a floating + point value into a `LIMIT` or + `OFFSET` clause by means of a parameter + (and possibly a user variable). This is now explicitly + disallowed; such values must be integers. + + The window functions + [`NTILE(NULL)`](/doc/refman/8.0/en/window-function-descriptions.html#function_ntile), + [`NTH_VALUE(expr, + NULL)`](/doc/refman/8.0/en/window-function-descriptions.html#function_nth-value), + [`LEAD(expr, + nn)`](/doc/refman/8.0/en/window-function-descriptions.html#function_lead), and + [`LAG(expr, + nn)`](/doc/refman/8.0/en/window-function-descriptions.html#function_lag), where + *`nn`* is a negative number, are now + disallowed, to comply with the SQL standard. + + A user variable that is read by a prepared statement now has + its type determined when the statement is prepared; the type + persists for each subsequent execution of the statement. + + A user variable that is read by a statement within a stored + procedure now has its type determined the first time the + statement is executed; the type persists for all subsequent + invocations of the containing stored procedure. + + For parameters for which no contextual information is + available to determine the parameter type, the server + assumes the parameter is a character string with the default + character set, not a binary string. Parameters for which + this is incorrect may be placed within a + [`CAST()`](/doc/refman/8.0/en/cast-functions.html#function_cast) expression. + + See [PREPARE Statement](/doc/refman/8.0/en/prepare.html), for the rules governing how the + effectiue data types of parameters and user variables used + within prepared statements are determined. + + In addition, the rows (*`N`*) argument to + the window functions [`LAG()`](/doc/refman/8.0/en/window-function-descriptions.html#function_lag), + [`LEAD()`](/doc/refman/8.0/en/window-function-descriptions.html#function_lead), and + [`NTILE()`](/doc/refman/8.0/en/window-function-descriptions.html#function_ntile) must now be an integer in + the range `0` to + `263`, inclusive, in + any of the following forms: + + + an unsigned integer constant literal + + a positional parameter marker (`?`) + + a user-defined variable + + a local variable in a stored routine + + In addition, this argument is no longer permitted to be + `NULL`. See the descriptions of the functions + just referenced for more information. + (Bug #48612, Bug #99601, Bug #100150, Bug #105166, Bug #11756670, Bug #23599127, Bug #31119132, Bug #31365678, Bug #31393719, Bug #31592822, Bug #31810577, Bug #33448735, WL #9384) +* The `filesort` algorithm now supports sorting a + join on multiple tables, and not just a single table. + (Bug #31310238, Bug #31559978, Bug #31563876) +* When using a `RIGHT JOIN`, some internal + objects, were not converted to those suitable for use with a + `LEFT JOIN` as intended. These included some + lists of tables built at parse time, but which did not have + their order reversed. This required maintaining code to handle + instances in which a `LEFT JOIN` was originally + a `RIGHT JOIN` as special cases, and was the + source of several bugs. Now the server performs any necessary + reversals at parse time, so that after parsing, a `RIGHT + JOIN` is in fact, in all respects, a `LEFT + JOIN`. + (Bug #30887665, Bug #30964002, WL #6509) + + References: See also: Bug #12567331, Bug #21350125. +* Added support for periodic synchronization when writing to files + with [`SELECT INTO + DUMPFILE`](/doc/refman/8.0/en/select-into.html) and `SELECT INTO OUTFILE` + statements. This feature can be enabled by setting the + [`select_into_disk_sync`](/doc/refman/8.0/en/server-system-variables.html#sysvar_select_into_disk_sync) system + variable to `ON`; the size of the write buffer + cn be set using the server system variable + [`select_into_buffer_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_select_into_buffer_size); the + default buffer size is 131072 (217) + bytes. An optional delay following synchronization to disk can + also be set using the + [`select_into_disk_sync_delay`](/doc/refman/8.0/en/server-system-variables.html#sysvar_select_into_disk_sync_delay) + system variable; the default behaviour is not to allow any delay + (that is, a delay time of 0 milliseconds). + + For more information, see the descriptions of the system + variables referenced previously. + + Our thanks to Facebook for this contribution to MySQL 8.0. + (Bug #30284861, WL #13926) +* MySQL now implements derived condition pushdown for eligible + queries. What this means is that, for a query such as + `SELECT * FROM (SELECT i, j FROM t1) AS dt WHERE i > + constant`, it is now + possible in many cases to push the outer + `WHERE` condition down to the derived table, in + this case resulting in `SELECT * FROM (SELECT i, j FROM + t1 WHERE i > constant) AS + dt`. Previously, if the derived table was materialized + and not merged, MySQL materialized the entire table—in + this case `t1`—then qualified the rows + with the `WHERE` condition. + + When the derived table cannot be merged into the outer query + (for example, if the derived table uses aggregation), pushing + the outer `WHERE` condition down to the derived + table can reduce the number of rows that need to be processed, + which should improve the query's performance. + + An outer `WHERE` condition can be pushed down + directly to a materialized derived table when the derived table + uses no aggregate or window functions. In addition, when the + derived table has a `GROUP BY` and uses no + window functions, the outer `WHERE` condition + can be pushed down to the derived table as a + `HAVING` condition. If the derived table uses a + window function and the outer `WHERE` + references columns used in the window function's + `PARTITION` clause, the + `WHERE` condition can also be pushed down. + + This optimization cannot be employed for a derived table that + contains a [`UNION`](/doc/refman/8.0/en/union.html) or + `LIMIT` clause. + + To enable derived condition pushdown, the + [`optimizer_switch`](/doc/refman/8.0/en/server-system-variables.html#sysvar_optimizer_switch) system + variable's + [`derived_condition_pushdown`](/doc/refman/8.0/en/switchable-optimizations.html#optflag_derived-condition-pushdown) + flag (added in this release) must be set to + `on`. This is the default setting. If this + optimization is disabled by the optimizer switch setting, you + can enable it for a specific query using the + [`DERIVED_CONDITION_PUSHDOWN`](/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-table-level) + optimizer hint (also added in this release). Use the + [`NO_DERIVED_CONDITION_PUSHDOWN`](/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-table-level) + optimizer hint to disable the optimization for a given query. + + For further information and examples, see + [Derived Condition Pushdown Optimization](/doc/refman/8.0/en/derived-condition-pushdown-optimization.html). + (Bug #59870, Bug #88381, Bug #11766303, Bug #27590273, WL #8084) + +### Packaging Notes + +* For RPM and Debian packages, client-side plugins were moved to + their own client-plugins package. + (Bug #31584093) +* The `VERSION` file in MySQL source + distributions is now named `MYSQL_VERSION` + due to a naming conflict with Boost. + (Bug #31466846) +* For platforms on which MySQL is built with + `WITH_SYSTEMD=1`, packages no longer include + legacy System V files: the + **mysqld\_multi.server** and + **mysql.server** scripts, and the + `mysql.server.1`, + `mysqld_multi.1`, and + `mysqld_safe.1` man pages. + (Bug #31450888) + +### Performance Schema Notes + +* The [`SHOW PROCESSLIST`](/doc/refman/8.0/en/show-processlist.html) statement + provides process information by collecting thread data from all + active threads. However, because the implementation iterates + across active threads from within the thread manager while + holding a global mutex, it has negative performance + consequences, particularly on busy systems. + + An alternative [`SHOW PROCESSLIST`](/doc/refman/8.0/en/show-processlist.html) + implementation is now available based on the new Performance + Schema [`processlist`](/doc/refman/8.0/en/performance-schema-processlist-table.html) table. This + implementation queries active thread data from the Performance + Schema rather than the thread manager and does not require a + mutex: + + + To enable the alternative implementation, enable the + [`performance_schema_show_processlist`](/doc/refman/8.0/en/performance-schema-system-variables.html#sysvar_performance_schema_show_processlist) + system variable. + + The alternative implementation of [`SHOW + PROCESSLIST`](/doc/refman/8.0/en/show-processlist.html) also applies to the + **mysqladmin processlist** command. + + The alternative implementation does not apply to the + `INFORMATION_SCHEMA` + [`PROCESSLIST`](/doc/refman/8.0/en/information-schema-processlist-table.html) table or the + `COM_PROCESS_INFO` command of the MySQL + client/server protocol. + + To ensure that the default and alternative implementations + yield the same information, certain configuration + requirements must be met; see + [The processlist Table](/doc/refman/8.0/en/performance-schema-processlist-table.html). + + (WL #9090) +* An SQL interface to the most recent events written to the MySQL + server error log is now available by means of queries on the new + Performance Schema [`error_log`](/doc/refman/8.0/en/performance-schema-error-log-table.html) table. + This table has a fixed size, with old events automatically + discarded as necessary to make room for new ones. The table is + populated if error log configuration includes a log sink + component that supports this capability (currently the + traditional-format `log_sink_internal` and + JSON-format `log_sink_json` sinks). Several new + status variables provide information about + [`error_log`](/doc/refman/8.0/en/performance-schema-error-log-table.html) table operation. See + [The error\_log Table](/doc/refman/8.0/en/performance-schema-error-log-table.html). + (WL #13681) + +### Pluggable Authentication + +* These changes were made for the LDAP authentication plugins: + + + For the SASL LDAP authentication plugin, the + `SCRAM-SHA-1` authentication method is not + supported on On SLES 12 and 15 and EL6 systems. The default + method on those systems is now `GSSAPI`. + + If the LDAP host is not set, the LDAP connection pool will + not be initialized, which enables successful authentication + plugin installation in cases when previously it would fail. + (This might be the case when a site installs a plugin first, + then configures it later.) + + If an LDAP connection parameter is changed at runtime, the + LDAP connection pool is reinitialized for the first + subsequent authentication attempt. + + If the LDAP server is restarted, existing connections in the + connection pool become invalid. The LDAP authentication + plugin detects this case and reinitializes the connection + pool and (for the SASL LDAP plugin) the SASL challenge is + resent. + + (Bug #31664270, Bug #31219323) + +### SQL Syntax Notes + +* The parser now supports parenthesized query expressions using + this syntax: + + ```None + ( query_expression ) + [order_by_clause] + [limit_clause] + [into_clause] + ``` + + Other variations are possible; see + [Parenthesized Query Expressions](/doc/refman/8.0/en/parenthesized-query-expressions.html) + (Bug #30592703) +* It is now possible to cast values of other types to + [`YEAR`](/doc/refman/8.0/en/year.html), using either the + [`CAST()`](/doc/refman/8.0/en/cast-functions.html#function_cast) function or the + [`CONVERT()`](/doc/refman/8.0/en/cast-functions.html#function_convert) function. These + functions now support `YEAR` values of one or + two digits in the range 0-99, and four-digit values in the range + 1901-2155. Integer 0 is converted to Year 0; a string consisting + of one or more zeroes (following possible truncation) is + converted to the year 2000. Casting adds 2000 to values in the + range 1-69 inclusive, and 1900 to values in the range 70-99 + inclusive. + + Strings beginning with one, two, or four digits followed by at + least one non-digit character (and possibly other digit or + non-digit characters) are truncated prior to conversion to + `YEAR`; in such cases, the server emits a + truncation warning. Floating-point values are rounded prior to + conversion; `CAST(1944.5 AS YEAR)` returns 1945 + due to rounding, and `CAST("1944.5" AS YEAR)` + returns 1944 (with a warning) due to truncation. + + [`DATE`](/doc/refman/8.0/en/datetime.html), + [`DATETIME`](/doc/refman/8.0/en/datetime.html), and + [`TIMESTAMP`](/doc/refman/8.0/en/datetime.html) are cast to the + `YEAR` portion of the value. A + [`TIME`](/doc/refman/8.0/en/time.html) value is cast to the current + year. Not specifying the value to be cast as a + `TIME` value may yield a different result from + what is expected; `CAST("13:47" AS YEAR)` + returns 2013 due to truncation of the string value, and + `CAST(TIME "13:47" AS YEAR)` returns 2020 as of + the year of this release. + + Casting of [`GEOMETRY`](/doc/refman/8.0/en/spatial-type-overview.html) values to + `YEAR` is not supported. A cast of an + incompatible type or an out-of-range or illegal value returns + `NULL`. + + `YEAR` can also be used as the return type for + the [`JSON_VALUE()`](/doc/refman/8.0/en/json-search-functions.html#function_json-value) function. This + function supports four-digit years only, and otherwise follows + the same rules as apply to `CAST()` and + `CONVERT()` when performing casts to + `YEAR`. + + For more information, see the description of the + [`CONVERT()`](/doc/refman/8.0/en/cast-functions.html#function_convert) function. + (WL #14015) +* When selecting a [`TIMESTAMP`](/doc/refman/8.0/en/datetime.html) column + value, it is now possible to convert it from the system time + zone to a UTC [`DATETIME`](/doc/refman/8.0/en/datetime.html) when + retrieving it, using the `AT TIME ZONE` + operator which is implemented for the `CAST()` + function in this release. + + The syntax is `CAST(value AT + TIME ZONE specifier AS + DATETIME[(precision)])`, + where the *`value`* is a + `TIMESTAMP`, and the + *`specifier`* is one of + `[INTERVAL] '+00:00'` or + `'UTC'`. (`INTERVAL` is + optional with the first form of the specifier, and cannot be + used with `'UTC'`.) The + *`precision`* of the + `DATETIME` value returned by the cast can + optionally be specified up to 6 decimal places. + + Values that were inserted into the table using a timezone offset + are also supported. + + `AT TIME ZONE` cannot be used with + [`CONVERT()`](/doc/refman/8.0/en/cast-functions.html#function_convert), or in any other + context other than as part of a `CAST()` + function call. The `ARRAY` keyword and creation + of multi-valued indexes are also not supported when using + `AT TIME ZONE`. + + A brief example is shown here: + + ```None + mysql> SELECT @@system_time_zone; + +--------------------+ + | @@system_time_zone | + +--------------------+ + | EDT | + +--------------------+ + 1 row in set (0.00 sec) + + mysql> CREATE TABLE ex (ts TIMESTAMP); + Query OK, 0 rows affected (0.81 sec) + + mysql> INSERT INTO ex VALUES + > ROW(CURRENT_TIMESTAMP), + > ROW('2020-07-31 21:44:30-08:00'); + Query OK, 2 rows affected (0.09 sec) + Records: 2 Duplicates: 0 Warnings: 0 + + mysql> TABLE ex; + +---------------------+ + | ts | + +---------------------+ + | 2020-07-28 21:39:31 | + | 2020-08-01 01:44:30 | + +---------------------+ + 2 rows in set (0.00 sec) + + mysql> SELECT ts, CAST(ts AT TIME ZONE 'UTC' AS DATETIME) AS ut FROM ex; + +---------------------+---------------------+ + | ts | ut | + +---------------------+---------------------+ + | 2020-07-28 21:39:31 | 2020-07-29 01:39:31 | + | 2020-08-01 01:44:30 | 2020-08-01 05:44:30 | + +---------------------+---------------------+ + 2 rows in set (0.00 sec) + ``` + + For more information and examples, see the description of the + [`CAST()`](/doc/refman/8.0/en/cast-functions.html#function_cast) function in the + *MySQL Manual*. + (WL #12535) + +### X Plugin Notes + +* In specific conditions, terminating an X Protocol connection + could cause MySQL Server to stop unexpectedly. + (Bug #31671503) + +### Functionality Added or Changed + +* [`LOCK TABLES`](/doc/refman/8.0/en/lock-tables.html) privilege checking + for views was improved. + (Bug #31304432, WL #14092) +* You can use MySQL Server's new asynchronous connection failover + mechanism to automatically establish an asynchronous (source to + replica) replication connection to a new source after the + existing connection from a replica to its source fails. The + connection fails over if the replication I/O thread stops due to + the source stopping or due to a network failure. The + asynchronous connection failover mechanism can be used to keep a + replica synchronized with multiple MySQL servers or groups of + servers that share data. To activate asynchronous connection + failover for a replication channel set + `SOURCE_CONNECTION_AUTO_FAILOVER=1` on the + `CHANGE MASTER TO` statement for the channel, + and set up a source list for the channel using the + `asynchronous_connection_failover_add_source` + and + `asynchronous_connection_failover_delete_source` + functions. + (WL #12649) +* The new + [`innodb_extend_and_initialize`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_extend_and_initialize) + variable permits configuring how `InnoDB` + allocates space to file-per-table and general tablespaces on + Linux. By default, when an operation requires additional space + in a tablespace, `InnoDB` allocates pages to + the tablespace and physically writes NULLs to those pages. This + behavior affects performance if new pages are allocated + frequently. As of MySQL 8.0.22, you can disable + [`innodb_extend_and_initialize`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_extend_and_initialize) on + Linux systems to avoid physically writing NULLs to newly + allocated tablespace pages. When + [`innodb_extend_and_initialize`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_extend_and_initialize) is + disabled, space is allocated using + `posix_fallocate()` calls, which reserve space + without physically writing NULLs. + + A `posix_fallocate()` operation is not atomic, + which makes it possible for a failure to occur between + allocating space to a tablespace file and updating the file + metadata. Such a failure can leave newly allocated pages in an + uninitialized state, resulting in a failure when + `InnoDB` attempts to access those pages. To + prevent this scenario, `InnoDB` writes a redo + log record before allocating a new tablespace page. If a page + allocation operation is interrupted, the operation is replayed + from the redo log record during recovery. + (WL #13782) +* To permit concurrent DML and DDL operations on MySQL grant + tables, read operations that previously acquired row locks on + MySQL grant tables are now executed as non-locking reads. The + operations that are now performed as non-locking reads on MySQL + grant tables include: + + + [`SELECT`](/doc/refman/8.0/en/select.html) statements and other + read-only statements that read data from grant tables + through join lists and subqueries, including + [`SELECT + ... FOR SHARE`](/doc/refman/8.0/en/innodb-locking-reads.html) statements, using any transaction + isolation level. + + DML operations that read data from grant tables (through + join lists or subqueries) but do not modify them, using any + transaction isolation level. + + Statements that no longer acquire row locks when reading data + from grant tables report a warning if executed while using + statement-based replication. + + When using + -[`binlog_format=mixed`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_format), DML + operations that read data from grant tables are now written to + the binary log as row events to make the operations safe for + mixed-mode replication. + + [`SELECT ... + FOR SHARE`](/doc/refman/8.0/en/innodb-locking-reads.html) statements that read data from grant tables + now report a warning. With the `FOR SHARE` + clause, read locks are not supported on grant tables. + + DML operations that read data from grant tables and are executed + using the `SERIALIZABLE` + isolation level now report a warning. Read locks that would + normally be acquired when using the + `SERIALIZABLE` isolation level + are not supported on grant tables. + (WL #14087) +* The [`ALTER DATABASE`](/doc/refman/8.0/en/alter-database.html) statement now + supports a `READ ONLY` option that controls + whether to permit modification of a database and objects within + it. This option is useful for database migration because a + database for which `READ ONLY` is enabled can + be migrated to another MySQL instance without concern that the + database might be changed during the operation. See + [ALTER DATABASE Statement](/doc/refman/8.0/en/alter-database.html). + + A new `INFORMATION_SCHEMA` table named + [`SCHEMATA_EXTENSIONS`](/doc/refman/8.0/en/information-schema-schemata-extensions-table.html) displays + database options. Currently, it displays `READ + ONLY=1` for read-only databases. See + [The INFORMATION\_SCHEMA SCHEMATA\_EXTENSIONS Table](/doc/refman/8.0/en/information-schema-schemata-extensions-table.html). + (WL #13369) + +### Bugs Fixed + +* **InnoDB:** + Code related to transaction support for histogram sampling was + removed, including related assertion code that caused test + failures. Transaction support is not required for histogram + sampling. + (Bug #31787736) +* **InnoDB:** + Encryption information was not set for redo log archive log + writer thread write operations. + (Bug #31690196) +* **InnoDB:** + The `TTASEventMutex::exit` function was + optimized for ARM64. Thanks to Krunal Bauskar for the + contribution. + (Bug #31589019, Bug #100132) +* **InnoDB:** + `InnoDB` failed to compile with the + `DISABLE_PSI_RWLOCK` CMake option + enabled. + (Bug #31578289) +* **InnoDB:** + The transaction isolation level, which is set to + [`READ UNCOMMITTED`](/doc/refman/8.0/en/innodb-transaction-isolation-levels.html#isolevel_read-uncommitted) for + histogram sampling to avoid unnecessary lookups of old record + versions, was not reset after the sampling operation completed. + (Bug #31564407) +* **InnoDB:** + A query that updated the clustered index of an internal + temporary table returned an incorrect result. The modified pages + of the clustered index were not added to the flush list + resulting in lost changes when the modified pages were evicted + from the buffer pool. + (Bug #31560679) + + References: This issue is a regression of: Bug #29207450. +* **InnoDB:** + A build dependency on the Boost library defined for the + TempTable storage engine was removed. + (Bug #31505048) +* **InnoDB:** + A workaround was implemented to handle a Clang compiler issue in + 32-bit builds that causes the + `ATOMIC_LLONG_LOCK_FREE` value to be defined as + “sometimes lock-free” while + `__atomic_always_lock_free` returns true for + the same type on the same platform. + (Bug #31504609) +* **InnoDB:** + A `REDUNDANT` row format table created in an + earlier version of MySQL, where the row format was not defined + explicitly, permitted the addition of an index that exceeded the + `REDUNDANT` row format index column size limit. + (Bug #31479542, Bug #99791) +* **InnoDB:** + A DML operation on a column defined with a multi-valued index + caused a failure. + (Bug #31479282) +* **InnoDB:** + A failure occurred during master key rotation. An undo + tablespace in-memory object was freed prematurely. + (Bug #31467626) +* **InnoDB:** + Unused physical read ahead code was removed from the parallel + read interface. + (Bug #31429385) +* **InnoDB:** + A master key rotation operation failed to skip an undo + tablespace that was already truncated, which lead to an + assertion failure when shutting down the server. + (Bug #31400195) +* **InnoDB:** + After importing a tablespace for a page-compressed table, pages + were no longer compressed, and + [`INFORMATION_SCHEMA.INNODB_TABLESPACES`](/doc/refman/8.0/en/information-schema-innodb-tablespaces-table.html) + metadata incorrectly indicated that pages were compressed. The + table's compression information was unavailable during the + import operation. + (Bug #31396947) +* **InnoDB:** + A rollback and update operation after performing an instant DDL + operation raised an assertion. + (Bug #31391126) +* **InnoDB:** + The log system (`log_sys`) sharded read-write + lock caused a performance regression in CPU-bound workloads. + (Bug #31389135) +* **InnoDB:** + Compiling with the `UNIV_ENCRYPT_DEBUG` option + enabled caused compilation errors. + (Bug #31369540) +* **InnoDB:** + DDL operations on a partitioned table could cause a failure. + `TABLE_SHARE` and table instance objects were + opened for all partitions unnecessarily. + (Bug #31365127) +* **InnoDB:** + After changing a [`VARCHAR`](/doc/refman/8.0/en/char.html) column + collation from `utf8mb4` to + `utf8mb4_bin` in an in-place + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) operation and adding + an index on the same column, a case-sensitive query on the + [`VARCHAR`](/doc/refman/8.0/en/char.html) column returned an + incorrect result. The [`VARCHAR`](/doc/refman/8.0/en/char.html) + column collation was changed in the data dictionary but not in + the in-memory table object. Consequently, the index created on + the [`VARCHAR`](/doc/refman/8.0/en/char.html) column used stale + column information causing comparisons to use the previously + defined collation. + (Bug #31361838) +* **InnoDB:** + An [`ALTER TABLE ... + IMPORT TABLESPACE`](/doc/refman/8.0/en/alter-table.html) operation on a large encrypted and + compressed table failed with a Page decompress failed + after reading from disk error. The decryption + operation did not use the encryption block size used during + encryption. Also, the encryption process did not consider + compressed length, while the decryption process decrypts data by + compressed length only. + (Bug #31313533) +* **InnoDB:** + A failure occurred during a concurrent update operation. The + failure was due to an invalid previous record value. + (Bug #31205266, Bug #99286) +* **InnoDB:** + Upgrade from MySQL 5.7 to MySQL 8.0 failed on an instance with a + table created in a general tablespace and defined with a + `FULLTEXT` index. The correct data dictionary + space ID for table could not determined. + (Bug #31154128, Bug #99211) +* **InnoDB:** + The function used to process the + [`SHOW ENGINE INNODB + MUTEX`](/doc/refman/8.0/en/show-engine.html) statement was insufficiently isolated from other + threads adding new mutexes concurrently. + (Bug #31105262) +* **InnoDB:** + Failure to call a buffer pool page I/O completion routine + resulted in orphan buffer pool I/O write pages. + (Bug #31073853) +* **InnoDB:** + Numerous system temporary table pages at the tail of the buffer + pool flush list caused a performance degradation. The + `flush_list_mutex` was held while the flush + list scan traversed over system temporary table pages. The flush + list scan now excludes system temporary table pages. + (Bug #31060470, Bug #98974) +* **InnoDB:** + The buffer control block structure + (`buf_block_t`) was freed while reducing the + size of the buffer pool, causing an assertion failure. The fix + for this bug also backports important aspects of the fix for Bug + #20735882 / Bug #76343, and replaces the internal + `buf_block_is_uncompressed()` function with the + `buf_pointer_is_block_field_instance()` + function. The `buf_block_is_uncompressed()` + function returned false in too many cases, affecting OLTP query + throughput. + (Bug #31036301, Bug #31389823) +* **InnoDB:** + Parallel read threads failed to respond to an explicit + transaction interruption. + (Bug #31016076) +* **InnoDB:** + In session started with `START TRANSACTION WITH + CONSISTENT SNAPSHOT`, a range query returned a + truncated result. The end range flag was not reset at the + beginning of the index read resulting in an aborted read and + missing rows. + (Bug #30950714, Bug #98642) + + References: This issue is a regression of: Bug #23481444. +* **InnoDB:** + A full-text phrase search raised an assertion failure. Thanks to + TXSQL (Tencent MySQL) for the contribution. + (Bug #30933728, Bug #31228694) + + References: This issue is a regression of: Bug #22709692. +* **InnoDB:** + A failure occurred while attempting to initialize the system + tablespace on a raw disk partition. Additionally, a + `INPLACE` DDL operation on the raw-disk + partition tablespace failed with an error instead of switching + to the `COPY` algorithm. + (Bug #30867065, Bug #98091) +* **InnoDB:** + LOB purge code (`lob::purge()`) did not + properly handle latches taken during B-tree mini-transaction + (`btr_mtr`) commit and restore operations, + which could lead to conflicts between B-tree and LOB + mini-transactions. + (Bug #30620011) +* **InnoDB:** + A long running statistics calculation operation on a large table + blocked other operations requiring access to the table's + statistics, causing those operations to fail. A new statistics + calculation mutex was introduced, which permits concurrent + access table statistics. Thanks to Kamil Holubicki for the + contribution. + (Bug #30607708) +* **InnoDB:** + Two connections attempted to use the same transaction handler + object resulting in a stalled query. + (Bug #30594501) +* **InnoDB:** + Shutting down the server with + [`innodb_fast_shutdown`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_fast_shutdown) setting + greater than 0 raised an assertion failure. The assertion was + caused by the presence of recovered transactions that were not + yet rolled back. Assertion code was revised to ignore recovered + transactions during a fast shutdown. Messages are now written to + the error log when recovered transactions that are not rolled + back are left behind by a fast shutdown. Slow shutdown now waits + for recovered transactions to be rolled back. Various other + shutdown logic improvements were implemented. + (Bug #30226841) +* **InnoDB:** + Dedicated log writer threads, introduced in MySQL 8.0.11, caused + a CPU-bound performance regression on low-concurrency systems. + To address this issue, the new + [`innodb_log_writer_threads`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_log_writer_threads) + variable permits disabling dedicated log writer threads so that + redo log records are written from the log buffer to the system + buffers and flushed from the system buffers to the redo log + files by each user thread, which is the behavior prior to the + introduction of dedicated log writer threads. Other redo logging + optimizations were implemented, including the removal of an + unnecessary log closer thread that wasted CPU time, and + optimizations to remedy too-aggressive checkpoint activity and + excessive flush calls. The issues addressed by this fix also + manifested in a `LOAD DATA` + performance regression. + (Bug #30088404, Bug #30003849) +* **InnoDB:** + Restarting the server with an incorrect + [`lower_case_table_names`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names) setting + after a failure caused a hang condition. At startup, + `InnoDB` waited for a transaction to roll back, + but the rollback thread was not initiated due to a startup + validation failure caused by the incorrect + [`lower_case_table_names`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names) setting. + (Bug #29833945) +* **Packaging; Group Replication:** + MySQL Server Docker images did not expose the Group Replication + recommended port (33061). + (Bug #31627536) +* **Packaging:** + Added a `client-plugins` RPM that was separated + from the `client` package. It contains shared + plugins for MySQL client applications. + (Bug #35162346) +* **Replication:** + You can now set the value of the + [`gtid_purged`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_purged) system variable in + a stored procedure, which was not previously permitted. You + cannot set [`gtid_purged`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_purged) in a + stored function. + (Bug #31571427) +* **Replication:** + When a replication source server shuts down and restarts, its + [`MEMORY`](/doc/refman/8.0/en/memory-storage-engine.html) tables become empty. To + replicate this effect to replicas, the first time that the + source uses a given [`MEMORY`](/doc/refman/8.0/en/memory-storage-engine.html) table + after startup, it logs an event that notifies replicas that the + table must be emptied by writing a statement to the binary log + to that effect. Previously, this was a + [`DELETE`](/doc/refman/8.0/en/delete.html) statement, but it is now a + [`TRUNCATE TABLE`](/doc/refman/8.0/en/truncate-table.html) statement. A + replica server also writes this statement to its own binary log + when it shuts down and restarts. The statement is always logged + in statement format, even if the binary logging format is set to + `ROW`, and it is written even if + `read_only` or + `super_read_only` mode is set on the server. + (Bug #29848785, Bug #95496) +* **Replication:** + When the system variable + [`session_track_gtids`](/doc/refman/8.0/en/server-system-variables.html#sysvar_session_track_gtids) was set to + `OWN_GTID` on a multithreaded replica, the + replica’s performance would degrade over time and begin to lag + behind the master. The cause was the buildup of the GTIDs + recorded by the replica’s worker threads at each transaction + commit, which increased the time taken by the worker threads to + insert new ones. Session state tracking is now disabled for + worker threads on a multithreaded replica. Thanks to Facebook + for the contribution. + (Bug #29049207, Bug #92964) +* **Replication:** + When using row-based replication, the replica was allowed to use + an invisible index when searching for rows to synchronize. + (Bug #96148, Bug #30072179) +* **Group Replication:** + X Plugin could stop unexpectedly if a Group Replication + notification was issued after a new X Protocol connection was + made but before the session was created. The dispatcher thread + that handles Group Replication notifications now checks that the + session pointer is valid. + (Bug #31742798) +* **Group Replication:** + Group Replication handling of memory allocation issues when + adding transaction write sets has been improved. + (Bug #31586243) +* **Group Replication:** + While a remote cloning procedure was taking place on a joining + member during distributed recovery, Group Replication considered + the pre-cloning `gtid_executed` value on the + joining member when identifying the common set of transactions + that had been applied on all members. This meant that garbage + collection for applied transactions from the group's set of + certification information (shown as the + `count_transactions_rows_validating` field in + the Performance Schema table + [`replication_group_member_stats`](/doc/refman/8.0/en/performance-schema-replication-group-member-stats-table.html)) did + not take place during the remote cloning procedure. If the + remote cloning procedure took a long time, the certification + information could therefore get too large to transmit to the + joining member when it restarted after the remote cloning + procedure, in which case an error was raised and the member was + not able to join the group. + + To avoid this issue, Group Replication now considers only group + members with `ONLINE` status when identifying + the common set of transactions that have been applied on all + members. When a joining member enters `ONLINE` + state after distributed recovery, its certification information + is updated with the certification information from the donor at + the time when the member joined, and garbage collection takes + place for this on future rounds. + + As a workaround for this issue in earlier releases, after the + remote cloning operation completes, wait two minutes to allow a + round of garbage collection to take place to reduce the size of + the group's certification information. Then issue the following + statement on the joining member, so that it stops trying to + apply the previous set of certification information: + + ```None + RESET SLAVE FOR CHANNEL group_replication_recovery; + ``` + + (Bug #31446381, Bug #99778) +* **Group Replication:** + It was possible for a group member that left the group due to a + communication error to reconnect between auto-rejoin attempts + while the auto-rejoin procedure was still ongoing, which left + Group Replication unable to function on the member. Group + Replication error management and member status handling has now + been corrected to prevent this situation. + (Bug #31401797) +* **Microsoft Windows:** + On Windows, build targets could fail if the build was on a file + system root, such as `R:/`. + (Bug #31315467) +* **JSON:** + [`JSON_OBJECT()`](/doc/refman/8.0/en/json-creation-functions.html#function_json-object) did not always + perform proper checking for `NULL` values. + (Bug #31393934) +* The new [`WITH_SYSTEMD_DEBUG`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_systemd_debug) + **CMake** option, if enabled, produces additional + systemd debugging information, for platforms on which systemd is + used to run MySQL. The default is `OFF`. + (Bug #31788834) +* For RPM and Debian packages, client-side plugins were moved from + the server package to the client package in MySQL 8.0.21. This + could cause failures relating to LDAP authentication plugins + when upgrading from 5.7 packages to 8.0 packages. Packaging + adjustments were made to avoid this problem. + (Bug #31782612) + + References: This issue is a regression of: Bug #31123564, Bug #31336340. +* The timestamp written for the `ts` key by the + `log_sink_json` JSON-format error log sink did + not have the same value as other timestamps in the same log + message. + (Bug #31749103) +* Kerberos authentication for the SASL LDAP authentication plugin + incorrectly handled failure to acquire a ticket-granting ticket. + (Bug #31727195) +* For some third-party libraries, enabling link-time optimization + caused build failures. + (Bug #31701553, Bug #100410) +* Printing an excessively long diagnostic message could cause the + server to exit unexpectedly. + (Bug #31686926) +* A page-compressed table was cloned as an uncompressed table. The + associated tablespace object, which includes a compression flag, + was not initialized prior to the cloning operation. + (Bug #31677990, Bug #100243) +* Certain cases of successful LDAP authentication could cause the + server to hang. + (Bug #31661437) +* During transformation of a grouped query into a derived table, + when the `WHERE` clause and the + `HAVING` clause became part of the derived + table, the condition count was not updated for the derived + table. This resulted in reduced memory allocation while creating + keys for `ref` access. + (Bug #31661309) +* When a value was compared using `LIKE` with a + table column not defined as one of the MySQL string types, the + server sometimes did not raise the expected error. + (Bug #31659015) +* The `acquire_related()` service function + returned the default service in some cases when it should have + returned an error. + (Bug #31655906) +* In bootstrapping mode, certain multiple-statement transactions + could cause unexpected server behavior. + (Bug #31650096) +* A remote cloning operation checked for the availability of a + plugin on the recipient that was removed from the donor instance + previously. References to the uninstalled plugin had not been + released. Error reporting issues related to plugin mismatches + and availability were also addressed. + (Bug #31639732, Bug #100244) +* In debug builds, the server attempted to evaluate subqueries + while creating a view. + (Bug #31590301) + + References: This issue is a regression of: Bug #25466100. +* A condition using [`RAND()`](/doc/refman/8.0/en/mathematical-functions.html#function_rand) was not + pushed down even in cases where it was safe to do so, that is + when no windowing function or `GROUP BY` is in + use. + (Bug #31587575) +* While pushing conditions down to a derived table, a constant + condition such as `WHERE FALSE` or + `WHERE TRUE` was pushed down to the first table + in the derived table, which is not necessary as the condition + has nothing to do with the derived table. MySQL now avoids + pushing constant conditions down to derived tables in such + cases. + + In addition used tables are now updated for the condition that + needs to be pushed down to the derived table, following code + inspection revealing that this was not done after replacing the + columns in the condition with the derived table expressions. + (Bug #31587493) +* A query using `WHERE column + > (... IN (SELECT ...))` could sometimes trigger an + assertion in the range optimizer. + (Bug #31586906) + + References: This issue is a regression of: Bug #30473261. +* It was possible for [`ANALYZE TABLE`](/doc/refman/8.0/en/analyze-table.html) + to fail with Duplicate key error if a row + was inserted in the interval between the check for the existence + of the row and the execution of the insert, and the statistics + table was updated concurrently. [`ANALYZE + TABLE`](/doc/refman/8.0/en/analyze-table.html) now ignores the error in this situation. + (Bug #31582758) +* The range optimizer does not use the correct lock type after + cloning the handler needed to perform merged scans, and instead + used a read lock unconditionally. This resulted in various + different side effects for different scenarios. + + For example, a [`SELECT`](/doc/refman/8.0/en/select.html) with + `FOR UPDATE` requests a write lock, but after + cloning the handler for an index merge scan, the range optimizer + requested a read lock which resulted in a mismatch. Similarly, + for data dictionary tables, the lock type was set to + `LOCK_NONE` due to the special handling + required for such tables. + + To prevent this problem from occurring, we now ensure that the + original lock type of the handler is always used in the cloned + handler as well. + (Bug #31582383) +* In some cases, a query using an `ANY` subquery + gave an incorrect result when the + [`subquery_to_derived`](/doc/refman/8.0/en/switchable-optimizations.html#optflag_subquery-to-derived) optimizer + switch was enabled. + (Bug #31566339) +* When `FALSE AND + condition` was simplified as + `FALSE`, temporary table resources allocated + for the *`condition`* were not always + released afterwards. + (Bug #31565009) +* A value equal to `ULLONG_MAX` could be inserted + into a [`BIT(64)`](/doc/refman/8.0/en/bit-type.html) column, but not + retrieved. + (Bug #31564742, Bug #100053) +* While removing an unused window definition, a subquery that was + part of an `ORDER BY` was not removed. The + optimizer then tried to optimize the subquery without locking + the tables. Now, when removing an unused window definition, the + server cleans up any subqueries present as part of the + definition. + (Bug #31518806) + + References: This issue is a regression of: Bug #27062031. +* A coding problem introduced in MySQL 8.0.20 could cause client + applications to exit unexpectedly during shutdown. + (Bug #31515752) + + References: This issue is a regression of: Bug #27045306. +* Added a missing error code translation from ICU + U\_REGEX\_NUMBER\_TOO\_BIG to MySQL + [`ER_REGEX_NUMBER_TOO_BIG`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_regex_number_too_big). + (Bug #31514995) +* Merging during `filesort` operations could fail + to remove duplicates for queries that used + `DISTINCT`. + (Bug #31498664, Bug #99900) +* MySQL's internal `DYNAMIC_STRING` class + formerly allocated memory in a linear fashion, that is, by a + predetermined number of bytes. The class has been revised such + that it now allocates memory exponentially, which should make + operations such as repeated string appends more efficient. + (Bug #31491799) +* `LOCK_mutex` mishandling could result in a + memory leak. + (Bug #31491146) +* A newly added collation was not added and could cause an + unexpected exit on shutdown. + (Bug #31470422) +* On Windows, file name reuse by the + `GetTempFileName()` function could cause an + assertion to be raised. + (Bug #31468590) +* A `LATERAL` subquery was incorrectly converted + into an antijoin. + (Bug #31465717) +* `NATURAL JOIN` evaluation could inadvertently + match hidden virtual columns created by functional indexes. + (Bug #31463511, Bug #99807) +* Sort keys for string hash join keys using more than 1024 bytes + were not handled correctly by the server. + (Bug #31437753) +* The server attempted to delete from a view whose definition + included `HAVING` when the + `HAVING` clause was constant and evaluated as + true even though a view with `HAVING` as part + of its definition should not be updatable. + (Bug #31429865) +* Privilege requirements were checked incorrectly for the + [`INFORMATION_SCHEMA.USER_ATTRIBUTES`](/doc/refman/8.0/en/information-schema-user-attributes-table.html) + table. + (Bug #31427410) +* When the internal function + `replace_index_subquery()` failed, the server + still attempted to create iterators for the affected subquery. + Now the function raises a clear error instead. + (Bug #31427072) +* A query using `WHERE NOT EXISTS (SELECT + const FROM + table WHERE + column=FROM_UNIXTIME(value)` + was not handled correctly. + (Bug #31425664) +* In some cases, `key_hint` handling was + improperly applied to derived and internal temporary tables. + (Bug #31424455) +* Re-execution of prepared [`INSERT`](/doc/refman/8.0/en/insert.html) + statements could fail for inserts through a view. + (Bug #31417951) +* [`JSON`](/doc/refman/8.0/en/json.html) scalar evaluation could + enter an infinite loop. + (Bug #31406724) +* The `user_attributes` column in + `mysql.user` table rows could be affected + incorrectly by partial revokes. + (Bug #31405985) +* Improper window function initialization could cause a server + exit. + (Bug #31389573, Bug #31437834) +* Sensitive LDAP authentication plugin system variables now + display as asterisks when retrieved in SQL statements. + (Bug #31388444, Bug #31391864) +* **mysql-test-run.pl** tests under no-threads + connection handling failed with ASAN builds due to improper + resource group initialization. This has been fixed. Thanks to + Xiaoyu Wang, Tencent Technology for the contribution. + (Bug #31378900, Bug #99609) +* Using the `authentication_ldap_simple` + authentication plugin with SSL could cause a segmentation fault + during shutdown. + (Bug #31364927) +* Killing a query could raise spurious assertions in the hash join + iterator. + (Bug #31361354) +* In some cases, an outer reference that was not + `LATERAL` was not marked as read-only as + expected. + (Bug #31359965) +* A failure occurred when upgrading from MySQL 5.7 to MySQL 8.0 + due to invalid references to orphaned events (events for which a + database no longer exists). The server now fails with an + appropriate error messages when orphaned events are encountered + during upgrade. Error messages for orphaned stored routines were + also revised. + (Bug #31335554) +* Enabling the + [`create_admin_listener_thread`](/doc/refman/8.0/en/server-system-variables.html#sysvar_create_admin_listener_thread) + system variable could cause a server exit during startup. + (Bug #31335279) +* After [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) to add an + expression default to a column, the first insert inserted a + value as if the expression had been evaluated at alter time and + not insert time. + (Bug #31330789, Bug #99513) +* The LDAP authentication plugins did not properly compare the + user-supplied authentication method against the permitted + methods. + (Bug #31320532) +* Certain views could cause a following + [`USE`](/doc/refman/8.0/en/use.html) statement to result in an + unexpected server exit. + (Bug #31311312) +* When a filesort sorted a buffer and `LIMIT` was + active, it first sorted all rows and then discarded those that + did not fit within the limit, which required sorting many rows + that were certain to be discarded later. Now the optimizer sorts + only the rows actually needed. Internal testing shows that this + change can speed up the sort phase for a simple string sorting + benchmark (as measured by `EXPLAIN ANALYZE`) by + up to 15%. + (Bug #31303537) +* A dynamic range scan runs the range optimizer for each row + fetched from the first table in a join to determine whether a + range scan can be picked for the second table using the value + available from that row. If the row contains no usable indexes, + a table scan may be chosen instead. For the query giving rise to + this issue, a table scan is chosen once, followed by a range + scan on a non-covering index, and the dynamic range iterator has + two read sets which are used for both these cases. One of these, + used for the table scan, includes the base columns of generated + columns required for processing the query; the other read set + does not include the base columns in the read set used for range + scans. This is because, for covering indexes, the read set + should not include base columns to avoid adding unneeded columns + by hash join or batched key access. The issue arose because the + second read set was also used for a non-covering index, which + resulted in an assert. + + To prevent this from happening, when initializing a table read + set in the dynamic range iterator, we now make sure that it + includes the base columns when the range optimizer picks a + non-covering index. + (Bug #31280526) + + References: This issue is a regression of: Bug #30417361. +* It was possible to insert an out-of-range value for a + [`TIMESTAMP`](/doc/refman/8.0/en/datetime.html) if it included a + timezone offset. + (Bug #31239157) +* The `keyring_hashicorp` keyring plugin did not + limit the size of keys for key operations. + (Bug #31205715) +* Configuring with + [`-DWITH_ZSTD=system`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_zstd) failed for + older versions of the `zstd` library. + **CMake** now checks the `zstd` + version and requires at least 1.0.0 for compilation, 1.2.0 to + run compression checks. + (Bug #31174920, Bug #99241) +* In some cases, a [`SELECT`](/doc/refman/8.0/en/select.html) that + obtained status variable information from Performance Schema + tables and that included a sort by a column containing temporal + values was not handled correctly. + (Bug #31168097) +* In some cases, [`ROUND()`](/doc/refman/8.0/en/mathematical-functions.html#function_round) and + [`TRUNCATE()`](/doc/refman/8.0/en/mathematical-functions.html#function_truncate) did not return the + data type of their first arguments as expected. This fix insures + that return types from these functions follow these rules, where + the first argument is of the type shown: + + + For any integer type, the return type is + [`BIGINT`](/doc/refman/8.0/en/integer-types.html). + + For any floating-point type or any non-numeric type, the + return type is [`DOUBLE`](/doc/refman/8.0/en/floating-point-types.html). + + For [`DECIMAL`](/doc/refman/8.0/en/fixed-point-types.html), the return type + is also `DECIMAL`. + + The type attributes for the return value are also copied + from the first argument, except in the case of + `DECIMAL`, when the second argument is a + constant value. + + When the desired number of decimal places is less than the + scale of the argument, the scale and the precision of the + result are adjusted accordingly. In addition, for the + `ROUND()` function, the precision is + extended by one place to accomodate rounding that increases + the number of significant digits. If the second argument is + negative, the return type is adjusted such that its scale is + 0, with a corresponding precision. + + For more information, see the description of the + [`ROUND()`](/doc/refman/8.0/en/mathematical-functions.html#function_round) function. + (Bug #31128028) +* A `SELECT ... FOR SHARE` statement now only + requires the [`SELECT`](/doc/refman/8.0/en/privileges-provided.html#priv_select) privilege. + Previously, the [`SELECT`](/doc/refman/8.0/en/privileges-provided.html#priv_select) privilege + was required with at least one of the + [`DELETE`](/doc/refman/8.0/en/privileges-provided.html#priv_delete), [`LOCK + TABLES`](/doc/refman/8.0/en/privileges-provided.html#priv_lock-tables), or [`UPDATE`](/doc/refman/8.0/en/privileges-provided.html#priv_update) + privileges. + (Bug #31096384, Bug #99101) +* A semijoin strategy was chosen for the join of a correlated + subquery having a `LIMIT` clause and requiring + a row other than the first, which caused the + `LIMIT` clause to be ignored and invalid rows + to be returned. Now, when `LIMIT` used with + this type of join specifies a row other than the first row, or + more than one row, the semijoin strategy is no longer employed. + (Bug #31096309) +* After the fix for Bug #81009, privilege checks for truncating + Performance Schema tables were too restrictive when + [`read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_read_only) or + [`super_read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only) were enabled, + causing truncation to fail even for users with appropriate table + privileges. + (Bug #31080309, Bug #99072) + + References: This issue is a regression of: Bug #81009. +* `ORDER BY` did not work as expected for queries + with `ROLLUP` in which window functions were + also used. + (Bug #31073133) +* Some [`INSERT`](/doc/refman/8.0/en/insert.html) statements were not + handled correctly. + (Bug #31072198) +* Date interval calculations checked for overflow but not + underflow. Now they check for both. + (Bug #31054071) +* If an XA prepared transaction rollback XID was incorrectly + formatted, the transaction remained in recovered state for + [`XA COMMIT`](/doc/refman/8.0/en/xa.html) and + [`XA ROLLBACK`](/doc/refman/8.0/en/xa.html) + statements (or raised an assertion for debug builds) rather that + reporting an error. + (Bug #31030205) +* Database-level privileges inherited through a role were not + handled properly for database names that contained wildcard + characters. + (Bug #31013538, Bug #98876) +* When the [`--local`](/doc/refman/8.0/en/mysqlimport.html#option_mysqlimport_local) option was + given, **mysqlimport** mishandled the + `MYSQL_OPT_LOAD_DATA_LOCAL_DIR` option for + `mysql_options()` so that it had no effect. + (Bug #31001550) +* Certain prepared statements could cause an unexpected server + exit. + (Bug #30943963) +* [`OPTIMIZE TABLE`](/doc/refman/8.0/en/optimize-table.html) for + `MyISAM` tables could cause table size to + increase and query performance to decrease. + [`REPAIR TABLE`](/doc/refman/8.0/en/repair-table.html) for + `MyISAM` tables could cause the `Table + is already up to date` status produced by a previous + [`OPTIMIZE TABLE`](/doc/refman/8.0/en/optimize-table.html) to be lost. + (Bug #30869674, Bug #98511, Bug #29755517) +* **mysqlpump** object validation included objects + in excluded databases. + (Bug #30819012) +* Inserting a [`TIMESTAMP`](/doc/refman/8.0/en/datetime.html) value + having a timezone offset which also had a zero for the month, + day, or both, led to an assert. Such a value should be and is + now rejected, regardless of the + [`sql_mode`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_mode) setting. + (Bug #30786762) + + References: See also: Bug #31239157. +* Privileges granted using roles could be mishandled at the + column-privilege level. + (Bug #30660403, Bug #97971) +* Comparison of a [`TIME`](/doc/refman/8.0/en/time.html) value with + `NULL` in some cases raised an assertion. + (Bug #30324587) + + References: This issue is a regression of: Bug #25949639. +* LDAP authentication plugins enforced CA verification + incorrectly, which could result in use of an incorrect CA. + (Bug #30220357) +* `ORDER BY` queries were not executed correctly + when [`sort_buffer_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sort_buffer_size) and + [`max_sort_length`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_sort_length) were set to + values which caused the internal limit on the maximum number of + keys allowed per sort buffer to be set to 0. + (Bug #30175483) +* A large number of nested arguments in full-text search query + caused an error. + (Bug #29929684) +* A potential misreporting of memory use by the Performance Schema + has been corrected. + (Bug #29912403) +* When + [`explicit_defaults_for_timestamp`](/doc/refman/8.0/en/server-system-variables.html#sysvar_explicit_defaults_for_timestamp) + was disabled and a `NULL` was inserted into a + generated column declared as + [`TIMESTAMP`](/doc/refman/8.0/en/datetime.html) `NOT + NULL`, the server would attempt to convert the inserted + value to [`CURRENT_TIMESTAMP`](/doc/refman/8.0/en/date-and-time-functions.html#function_current-timestamp). Such + an insertion is now rejected with + [`ER_BAD_NULL_ERROR`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_bad_null_error). + (Bug #29449518) +* The [`SET_VAR`](/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-set-var) hint did not + accept a floating point value specified as a system variable + setting. + (Bug #29349748) +* Previously, when `NULL` was used as the format + argument to [`STR_TO_DATE()`](/doc/refman/8.0/en/date-and-time-functions.html#function_str-to-date), + irrelevant warnings were printed. Now, when + `NULL` is passed to it, the function returns + `NULL`. + (Bug #27265863) +* In some cases, incorrect use of [`IS + NULL`](/doc/refman/8.0/en/comparison-operators.html#operator_is-null) generated multiple warnings about invalid + arguments. + (Bug #27264652) +* Resolving an `ORDER BY` column that referred to + a [`SELECT`](/doc/refman/8.0/en/select.html) list column from a + derived table was not performed correctly when executing certain + prepared statements. + (Bug #26808862) +* When using [`EXPLAIN`](/doc/refman/8.0/en/explain.html) on a + multi-table [`UPDATE`](/doc/refman/8.0/en/update.html) statement in + which a generated column was referenced in a condition, the + output always showed the table containing this column as being + updated, whether the table was actually updated or not. + (Bug #22671310) +* An assertion could be raised when the SQL layer passed incorrect + information to `InnoDB` about the type of + operation to be performed on a temporary table. + (Bug #22503696) +* This construct works for base tables to insert a row using all + default values but failed for views: + + ```None + INSERT INTO name () VALUES (); + ``` + + (Bug #15988466, Bug #67863) +* In some cases, the server issued an error when an invisible + index was used in an index hint even when the + [`use_invisible_indexes`](/doc/refman/8.0/en/switchable-optimizations.html#optflag_use-invisible-indexes) + optimizer switch was not set to `OFF`. + (Bug #100024, Bug #31550839) +* Regular expression functions such as + [`REGEXP_LIKE()`](/doc/refman/8.0/en/regexp.html#function_regexp-like) yielded + inconsistent results with binary string arguments. These + functions now reject binary strings with an error. + (Bug #98950, Bug #98951, Bug #31031886, Bug #31031888) +* When range values specified in a predicate are not compatible + with the data type of the column with which the values are + compared, the range optimizer rounds off the range values and + assigns certain flags so that it does not exclude rows that + qualify for the range because of rounding. In the specific query + that triggered the reported issue, a column named + `id` of type [`INT`](/doc/refman/8.0/en/integer-types.html) + was tested using `id NOT IN (-0.1, 0.1)`, and + the values being tested are rounded to integers, with the + predicate thus being treated as `NOT IN (0,0)`. + The optimizer then treats this as the intervals `id < + 0` and `0 < id < 0`, but in this + case it also set a flag to a value that indicated that reads + should begin following rows containing 0 for the value to be + compared. Now in such cases, the flag is set in such a way that + the values which have been rounded are treated correctly. + (Bug #98826, Bug #30988735) + + References: This issue is a regression of: Bug #80244, Bug #22661012. +* For a view based on a join having an updatable part and one that + was not, the error message generated when attempting to update a + column of this view that was not updatable referenced the source + table or view instead of the view actually named in the + offending [`UPDATE`](/doc/refman/8.0/en/update.html) statement. + (Bug #80655, Bug #22891840) diff --git a/corpus/changelog/mysql_releases/mysql_8023.md b/corpus/changelog/mysql_releases/mysql_8023.md new file mode 100644 index 0000000000000000000000000000000000000000..1faa683b419e6b094d6cdb4d7e9e5bdca994a092 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8023.md @@ -0,0 +1,1448 @@ +# MySQL 8.0.23 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-23.html +Version: 8.0.23 + +## Changes in MySQL 8.0.23 (2021-01-18, General Availability) + +This release adds support for macOS 11 (Big Sur). + +* [Account Management Notes](news-8-0-23.html#mysqld-8-0-23-account-management "Account Management Notes") +* [C API Notes](news-8-0-23.html#mysqld-8-0-23-capi "C API Notes") +* [Compilation Notes](news-8-0-23.html#mysqld-8-0-23-compiling "Compilation Notes") +* [Connection Management Notes](news-8-0-23.html#mysqld-8-0-23-connection-management "Connection Management Notes") +* [Deprecation and Removal Notes](news-8-0-23.html#mysqld-8-0-23-deprecation-removal "Deprecation and Removal Notes") +* [Firewall Notes](news-8-0-23.html#mysqld-8-0-23-firewall "Firewall Notes") +* [Optimizer Notes](news-8-0-23.html#mysqld-8-0-23-optimizer "Optimizer Notes") +* [Performance Schema Notes](news-8-0-23.html#mysqld-8-0-23-performance-schema "Performance Schema Notes") +* [Pluggable Authentication](news-8-0-23.html#mysqld-8-0-23-pluggable-auth "Pluggable Authentication") +* [Security Notes](news-8-0-23.html#mysqld-8-0-23-security "Security Notes") +* [Spatial Data Support](news-8-0-23.html#mysqld-8-0-23-spatial-support "Spatial Data Support") +* [SQL Syntax Notes](news-8-0-23.html#mysqld-8-0-23-sql-syntax "SQL Syntax Notes") +* [X Plugin Notes](news-8-0-23.html#mysqld-8-0-23-xplugin "X Plugin Notes") +* [Functionality Added or Changed](news-8-0-23.html#mysqld-8-0-23-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-23.html#mysqld-8-0-23-bug "Bugs Fixed") + +### Account Management Notes + +* Granting the [`RELOAD`](/doc/refman/8.0/en/privileges-provided.html#priv_reload) privilege + enables a user to perform a wide variety of operations. In some + cases, it may be desirable for a user to be able to perform only + some of these operations. To enable DBAs to avoid granting + [`RELOAD`](/doc/refman/8.0/en/privileges-provided.html#priv_reload) and tailor user privileges + more closely to the operations permitted, these new privileges + of more limited scope are available: + + + [`FLUSH_OPTIMIZER_COSTS`](/doc/refman/8.0/en/privileges-provided.html#priv_flush-optimizer-costs): + Enables use of the [`FLUSH + OPTIMIZER_COSTS`](/doc/refman/8.0/en/flush.html#flush-optimizer-costs) statement. + + [`FLUSH_STATUS`](/doc/refman/8.0/en/privileges-provided.html#priv_flush-status): Enables use of + the [`FLUSH STATUS`](/doc/refman/8.0/en/flush.html#flush-status) statement. + + [`FLUSH_TABLES`](/doc/refman/8.0/en/privileges-provided.html#priv_flush-tables): Enables use of + the [`FLUSH TABLES`](/doc/refman/8.0/en/flush.html#flush-tables) statement. + + [`FLUSH_USER_RESOURCES`](/doc/refman/8.0/en/privileges-provided.html#priv_flush-user-resources): Enables + use of the [`FLUSH + USER_RESOURCES`](/doc/refman/8.0/en/flush.html#flush-user-resources) statement. + + The new privileges apply only at the global level. For more + information, see [Privileges Provided by MySQL](/doc/refman/8.0/en/privileges-provided.html), and + [FLUSH Statement](/doc/refman/8.0/en/flush.html). + + The [`mysql_refresh()`](/doc/c-api/8.0/en/mysql-refresh.html) C API + function performs operations similar to those of various + [`FLUSH`](/doc/refman/8.0/en/flush.html) statements, but is + unaffected by this change. It still requires the + [`RELOAD`](/doc/refman/8.0/en/privileges-provided.html#priv_reload) privilege regardless of + the operation for which it is invoked. + (WL #14303) + +### C API Notes + +* For some applications, it may be useful to define metadata on a + per-query basis. Examples include the URL of the page that + produced a query, or extra processing information to be passed + with a query for use by a plugin such as an audit plugin or + query rewrite plugin. MySQL now supports this capability without + the use of workarounds such as specially formatted comments + included in query strings: + + + On the client side, the + [`mysql_bind_param()`](/doc/c-api/8.0/en/mysql-bind-param.html) C API + function enables defining query attributes. These attributes + apply to the next SQL statement sent to the server for + execution. Additionally, the **mysql** and + **mysqltest** clients have a + `query_attributes` command that enables + defining query attributes. + + On the server side, a component service provides access to + query attributes. A component named + `query_attributes` uses this service to + implement a + [`mysql_query_attribute_string()`](/doc/refman/8.0/en/query-attributes.html#function_mysql-query-attribute-string) + loadable function that enables obtaining attribute values + within SQL statements. The + `query_attributes` component is optional + but must be installed for the function to be available. + + For more information, see [Query Attributes](/doc/refman/8.0/en/query-attributes.html). + + Thanks to Facebook for suggesting the idea (and for contributing + code, although it was not used). + (Bug #27855905, Bug #28686334, WL #12542) + +### Compilation Notes + +* Thanks to Tzachi Zidenberg, who contributed a patch for + compiling MySQL on aarch64 (ARM64). + (Bug #31815236, Bug #100664) + +### Connection Management Notes + +* Selection of the account that matches incoming TCP client + connections could be affected by account creation order. To make + the matching algorithm more deterministic, matching the host + name part of accounts now checks accounts specified using host + IP addresses, in a specific order, before attempting to match + accounts specified using host names. Host name matching remains + unchanged. See [Access Control, Stage 1: Connection Verification](/doc/refman/8.0/en/connection-access.html). + (WL #14074) + +### Deprecation and Removal Notes + +* From MySQL 8.0.23, the statement [`CHANGE + MASTER TO`](/doc/refman/8.0/en/change-master-to.html) is deprecated. The alias + [`CHANGE REPLICATION SOURCE TO`](/doc/refman/8.0/en/change-replication-source-to.html) + should be used instead. The parameters for the statement also + have aliases that replace the term `MASTER` + with the term `SOURCE`. For example, + `MASTER_HOST` and + `MASTER_PORT` can now be entered as + `SOURCE_HOST` and + `SOURCE_PORT`. The + [`START REPLICA | + SLAVE`](/doc/refman/8.0/en/start-replica.html) statement’s parameters + `MASTER_LOG_POS` and + `MASTER_LOG_FILE` now have aliases + `SOURCE_LOG_POS` and SOURCE\_LOG\_FILE. The + statements work in the same way as before, only the terminology + used for each statement has changed. A deprecation warning is + issued if the old versions are used. + + A new status variable, + `Com_change_replication_source`, has been added + as an alias for the `Com_change_master` status + variable. Both the old and new version of the statement update + both the old and new version of the status variable. + + The server rewrites all [`CHANGE MASTER + TO`](/doc/refman/8.0/en/change-master-to.html) statements as [`CHANGE + REPLICATION SOURCE TO`](/doc/refman/8.0/en/change-replication-source-to.html) statements in the query log. The + same is done for the statements `START SLAVE`, + `STOP SLAVE`, `SHOW SLAVE + STATUS`, `SHOW SLAVE HOSTS` and + `RESET SLAVE`. The event name for the + [`CHANGE MASTER TO`](/doc/refman/8.0/en/change-master-to.html) statement is set + to `statement/sql/change_replication_source` in + the statement history table. + (Bug #32145023, WL #14189) +* The [`gen_blacklist()`](/doc/refman/5.7/en/data-masking-functions.html#function_gen-blacklist) user-defined + function is deprecated. Use + [`gen_blocklist()`](/doc/refman/8.0/en/data-masking-component-functions.html#function_gen-blocklist) instead, which + performs the same term-replacement operation. + (WL #14176) +* The use of the system variables + `master_info_repository` and + `relay_log_info_repository` is now deprecated, + and a warning message is issued if you attempt to set them or + read their values. The system variables will be removed in a + future MySQL version. These system variables were used to + specify whether the replica’s connection metadata repository + and applier metadata repository were written to an + `InnoDB` table in the mysql system database, or + to a file in the data directory. The `FILE` + setting was already deprecated in a previous release, and tables + are the default for the replication metadata repositories in + MySQL 8.0. + (WL #13958) +* Flushing the host cache can be done using any of these methods: + + + Execute a [`TRUNCATE TABLE`](/doc/refman/8.0/en/truncate-table.html) + statement that truncates the Performance Schema + [`host_cache`](/doc/refman/8.0/en/performance-schema-host-cache-table.html) table. This requires + the [`DROP`](/doc/refman/8.0/en/privileges-provided.html#priv_drop) privilege for the + table. + + Execute a [`FLUSH HOSTS`](/doc/refman/8.0/en/flush.html#flush-hosts) + statement. This requires the + [`RELOAD`](/doc/refman/8.0/en/privileges-provided.html#priv_reload) privilege. + + Execute a **mysqladmin flush-hosts** command. + This requires the [`RELOAD`](/doc/refman/8.0/en/privileges-provided.html#priv_reload) + privilege. + + Although those methods are equivalent in effect, granting the + [`RELOAD`](/doc/refman/8.0/en/privileges-provided.html#priv_reload) privilege enables a number + of other operations in addition to host cache flushing, which is + undesirable from a security standpoint. Granting the + [`DROP`](/doc/refman/8.0/en/privileges-provided.html#priv_drop) privilege for the + [`host_cache`](/doc/refman/8.0/en/performance-schema-host-cache-table.html) table is preferable + because it has a more limited scope. Therefore, the + [`FLUSH HOSTS`](/doc/refman/8.0/en/flush.html#flush-hosts) statement is + deprecated and will be removed in a future MySQL version. + Instead, truncate the [`host_cache`](/doc/refman/8.0/en/performance-schema-host-cache-table.html) + table. + + **mysqladmin flush-hosts** previously executed a + [`FLUSH HOSTS`](/doc/refman/8.0/en/flush.html#flush-hosts) statement. Now it + attempts to truncate the `host_cache` table, + falling back to [`FLUSH HOSTS`](/doc/refman/8.0/en/flush.html#flush-hosts) only + if the truncate operation fails. + (WL #14329) + +### Firewall Notes + +* Administrators perform MySQL Enterprise Firewall management by registering profiles + that specify sets of rules for permitted statements + (allowlists). Previously, profiles could be associated only with + individual accounts, so that, to apply a given allowlist to + multiple account profiles, it was necessary to duplicate the + rule set for each profile. For easier administration and greater + flexibility, the firewall now provides group profile + capabilities: + + + Named group profiles can be created. A group profile can + include multiple accounts as members, and an account can be + a member of multiple group profiles. + + Each group profile has its own allowlist. The profile + allowlist applies to all member accounts, eliminating the + need to duplicate it across multiple account profiles. + + For more information, see [MySQL Enterprise Firewall](/doc/refman/8.0/en/firewall.html). + (WL #11740) + +### Optimizer Notes + +* Switched the hash table used for hash joins from an unordered + multimap to an unordered flat map implemented with a multimap + adapter. This change yields the following improvements: + + + A faster hash table + + Less memory usage due to less hash table overhead, less + space used for alignment and key/value lengths, and better + memory usage with many equal keys; this should also reduce + the frequency at which it is necessary to spill to disk + + Better memory control by approaching the allowed join buffer + size more closely rather than being effectively limited to + approximately 2/3 of + [`join_buffer_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_join_buffer_size), and by + making it possible to free old memory when the hash table + grows + + (Bug #99933, Bug #31516149, WL #13459) + +### Performance Schema Notes + +* Performance Schema macros that previously expanded to dynamic + calls now expand to static calls when possible to reduce + processing overhead. + (Bug #32028160) +* Performance overhead of timer code was reduced. This should be + of most benefit to workloads with high concurrency using the + Performance Schema. Thanks to Georgy Kirichenko for the + contribution. + (Bug #31960377, Bug #101018) + +### Pluggable Authentication + +* The MySQL Enterprise Edition SASL LDAP authentication plugin now supports + `SCRAM-SHA-256` as an authentication method for + MySQL clients and servers. `SCRAM-SHA-256` is + similar to `SCRAM-SHA-1` but is more secure. + Use of `SCRAM-SHA-256` requires an OpenLDAP + server built using Cyrus SASL 2.1.27 or higher. See + [LDAP Authentication Methods](/doc/refman/8.0/en/ldap-pluggable-authentication.html#ldap-pluggable-authentication-auth-methods). + (WL #14180) + +### Security Notes + +* For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 1.1.1i. Issues fixed in the new OpenSSL version are described at + and + . + (Bug #32260610) + +### Spatial Data Support + +* The new [`ST_HausdorffDistance()`](/doc/refman/8.0/en/spatial-relation-functions-object-shapes.html#function_st-hausdorffdistance) + and [`ST_FrechetDistance()`](/doc/refman/8.0/en/spatial-relation-functions-object-shapes.html#function_st-frechetdistance) + functions return the discrete Fréchet and Hausdorff distances + between two geometries, reflecting how similar the geometries + are. See + [Spatial Relation Functions That Use Object Shapes](/doc/refman/8.0/en/spatial-relation-functions-object-shapes.html). + (WL #14128, WL #14129) + +### SQL Syntax Notes + +* MySQL now supports invisible columns, which normally are hidden + to queries, but can be accessed if explicitly referenced. See + [Invisible Columns](/doc/refman/8.0/en/invisible-columns.html). + (WL #10905) + +### X Plugin Notes + +* For X Protocol connections using the `MYSQL41` + authentication method, if the nonce sent by the server was + shorter than 20 bytes, the connection logic did not handle it + correctly. + (Bug #32036194) +* If a query that was building up a resultset was killed, + X Plugin interpreted this as meaning the server session had + been killed, and dropped the connection. The status of a query + is now checked separately from the status of the server session. + (Bug #31954296) +* A deadlock could occur if an X Protocol session attempted to + display X Plugin status variables or settings at the same time + as another X Protocol session was being released and reset. The + situation is now handled appropriately. + (Bug #31931873) +* If an X Protocol client with a connection to a server remains + idle (not sending to the server) for longer than the relevant + X Plugin timeout setting (read, write, or wait timeout), + X Plugin closes the connection. In the case of a read timeout, + the plugin returns a warning notice with the error code + ER\_IO\_READ\_ERROR to the client + application. + + From MySQL 8.0.23, X Plugin now also sends a warning notice if + a connection is actively closed due to a server shutdown, or by + the connection being killed from another client session. In the + case of a server shutdown, the warning notice is sent to all + authenticated X Protocol clients with open connections, with + the ER\_SERVER\_SHUTDOWN error code. In the + case of a killed connection, the warning notice is sent to the + relevant client with the + ER\_SESSION\_WAS\_KILLED error code, unless + the connection was killed during SQL execution, in which case a + fatal error is returned with the + ER\_QUERY\_INTERRUPTED error code. + + Client applications can use the warning notices to display to + users, or to analyze the reason for disconnection and decide + whether to attempt reconnection to the same server, or to a + different server. + (WL #14166) +* For classic MySQL protocol, if an SQL query is using metadata locking + or the sleep function, the connection to the server is checked + periodically to verify that it is still alive. If not, the query + can be stopped so that it does not continue to consume + resources. Previously, X Protocol did not carry out these + checks, and assumed that the connection was still alive. The + check has now been added for X Protocol. + (WL #14167) + +### Functionality Added or Changed + +* **InnoDB:** + Performance was improved for the following operations: + + + Dropping a large tablespace on a MySQL instance with a large + buffer pool (>32GBs). + + Dropping a tablespace with a significant number of pages + referenced from the adaptive hash index. + + Truncating temporary tablespaces. + + The pages of dropped or truncated tablespaces and associated AHI + entries are now removed from the buffer pool passively as pages + are encountered during normal operations. Previously, dropping + or truncating tablespaces initiated a full list scan to remove + pages from the buffer pool immediately, which negatively + impacted performance. + (Bug #31008942, Bug #98869, WL #14100) +* **InnoDB:** + The new `AUTOEXTEND_SIZE` option defines the + amount by which `InnoDB` extends the size of a + tablespace when it becomes full, making it possible to extend + tablespace size in larger increments. Allocating space in larger + increments helps to avoid fragmentation and facilitates + ingestion of large amounts of data. The + `AUTOEXTEND_SIZE` option is supported with the + [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html), + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html), + [`CREATE TABLESPACE`](/doc/refman/8.0/en/create-tablespace.html), and + [`ALTER TABLESPACE`](/doc/refman/8.0/en/alter-tablespace.html) statements. For + more information, see + [Tablespace AUTOEXTEND\_SIZE Configuration](/doc/refman/8.0/en/innodb-tablespace-autoextend-size.html). + + An `AUTOEXTEND_SIZE` size column was added to + the + [`INFORMATION_SCHEMA.INNODB_TABLESPACES`](/doc/refman/8.0/en/information-schema-innodb-tablespaces-table.html) + table. + (WL #13895) +* **InnoDB:** + `InnoDB` now supports encryption of doublewrite + file pages belonging to encrypted tablespaces. The pages are + encrypted using the encryption key of the associated tablespace. + For more information, see + [InnoDB Data-at-Rest Encryption](/doc/refman/8.0/en/innodb-data-encryption.html). + (WL #13775) +* **InnoDB:** + `InnoDB` atomics code was revised to use C++ + `std::atomic`. + (WL #14235) +* **Group Replication:** + The MySQL Server asynchronous connection failover mechanism now + supports Group Replication topologies, by automatically + monitoring changes to group membership and distinguishing + between primary and secondary servers. When you add a group + member to the source list and define it as part of a managed + group, the asynchronous connection failover mechanism updates + the source list to keep it in line with membership changes, + adding and removing group members automatically as they join or + leave. The new + `asynchronous_connection_failover_add_managed()` + and + `asynchronous_connection_failover_delete_managed()` + functions are used to add and remove managed sources. + + The connection is failed over to another group member in the + following situations: + + + The currently connected source goes offline or leaves the + group. + + The currently connected source is no longer in the majority. + + The currently connected source does not have the highest + weighted priority in the group. + + For a managed group, a source’s weight is assigned depending + on whether it is a primary or a secondary server. So assuming + that you set up the managed group to give a higher weight to a + primary and a lower weight to a secondary, when the primary + changes, the higher weight is assigned to the new primary, so + the replica changes over the connection to it. This also applies + to single (non- managed) servers, so the connection for a single + server is also now failed over if another source server is + available that has a higher weighted priority. + (WL #14019) +* When invoked with the + [`--all-databases`](/doc/refman/8.0/en/mysqldump.html#option_mysqldump_all-databases) option, + **mysqldump** now dumps the + **mysql** database first, so that when the dump + file is reloaded, any accounts named in the + `DEFINER` clause of other objects will already + have been created. + (Bug #32141046) +* Some overhead for disabled Performance Schema and + `LOCK_ORDER` tool instrumentation was + identified and eliminated. + (Bug #32105698) +* For `BLOB` and `TEXT` columns + that have a default value expression, the + [`INFORMATION_SCHEMA.COLUMNS`](/doc/refman/8.0/en/information-schema-columns-table.html) table + and [`SHOW COLUMNS`](/doc/refman/8.0/en/show-columns.html) statement now + display the expression. + (Bug #31856459) +* For a multithreaded replica (where + [`slave_parallel_workers`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_parallel_workers) is + greater than 0), setting + [`slave_preserve_commit_order=1`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_preserve_commit_order) + ensures that transactions are executed and committed on the + replica in the same order as they appear in the replica's relay + log. Each executing worker thread waits until all previous + transactions are committed before committing. If a worker thread + fails to execute a transaction because a possible deadlock was + detected, or because the transaction's execution time exceeded a + relevant wait timeout, it automatically retries the number of + times specified by + [`slave_transaction_retries`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_transaction_retries) + before stopping with an error. Transactions with a non-temporary + error are not retried. + + The replication applier on a multithreaded replica has always + handled data access deadlocks that were identified by the + storage engines involved. However, some other types of lock were + not detected by the replication applier, such as locks involving + access control lists (ACLs) or metadata locking (for example, + `FLUSH TABLES WITH READ LOCK` statements). This + could lead to three-actor deadlocks with the commit order + locking, which could not be resolved by the replication applier, + and caused replication to hang indefinitely. From MySQL 8.0.23, + deadlock handling on multithreaded replicas that preserve the + commit order has been enhanced to mitigate these types of + deadlocks. The deadlocks are not specifically resolved by the + replication applier, but the applier is aware of them and + initiates automatic retries for the transaction, rather than + hanging. If the retries are exhausted, replication stops in a + controlled manner so that the deadlock can be resolved manually. + (Bug #107574, Bug #34291887, WL #13574) +* CRC calculations for binlog checksums are faster on ARM + platforms. Thanks to Krunal Bauskar for the contribution. + (Bug #99118, Bug #31101633, Bug #32163391) +* Replication channels can now be set to assign a GTID to + replicated transactions that do not already have one, using the + `ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS` option + of the `CHANGE REPLICATION SOURCE TO` + statement. This feature enables replication from a source that + does not use GTID-based replication, to a replica that does. For + a multi-source replica, you can have a mix of channels that use + `ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS`, and + channels that do not. The GTID can include the replica’s own + server UUID or a server UUID that you assign to identify + transactions from different sources. + + Note that a replica set up with + `ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS` on any + channel cannot be promoted to replace the replication source + server in the event that a failover is required, and a backup + taken from the replica cannot be used to restore the replication + source server. The same restriction applies to replacing or + restoring other replicas that use + `ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS` on any + channel. The GTID set (gtid\_executed) from a replica set up with + `ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS` is + nonstandard and should not be transferred to another server, or + compared with another server's `gtid_executed` + set. + (WL #12819) +* The new [`temptable_max_mmap`](/doc/refman/8.0/en/server-system-variables.html#sysvar_temptable_max_mmap) + variable defines the maximum amount of memory the TempTable + storage engine is permitted to allocate from memory-mapped + temporary files before it starts storing data to + `InnoDB` internal temporary tables on disk. A + setting of 0 disables allocation of memory from memory-mapped + temporary files. For more information, see + [Internal Temporary Table Use in MySQL](/doc/refman/8.0/en/internal-temporary-tables.html). + (WL #14125) + +### Bugs Fixed + +* **InnoDB:** + A [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) operation that + specified the `COMPRESSION` option was + permitted with a warning on a system that does not support hole + punching. The operation now fails with an error instead. + (Bug #32174200) +* **InnoDB:** + A MySQL DB system restart following an upgrade that was + initiated while a data load operation was in progress raised an + assertion failure. + (Bug #32173596) +* **InnoDB:** + An error message regarding the number of truncate operations on + the same undo tablespace between checkpoints incorrectly + indicated a limit of 64. The limit was raised from 64 to 50,000 + in MySQL 8.0.22. + (Bug #32151601, Bug #101601) +* **InnoDB:** + `rw_lock_t` and `buf_block_t` + source code structures were reduced in size. + (Bug #32084500) +* **InnoDB:** + An [`InnoDB`](/doc/refman/8.0/en/innodb-storage-engine.html) transaction became + inconsistent after creating a table using a storage engine other + than `InnoDB` from a query expression that + operated on `InnoDB` tables. + (Bug #32079103) +* **InnoDB:** + In some circumstances, such as when an existing gap lock + inherits a lock from a deleted record, the number of locks that + appear in the + [`INFORMATION_SCHEMA.INNODB_TRX`](/doc/refman/8.0/en/information-schema-innodb-trx-table.html) table + could diverge from the actual number of record locks. + + Thanks to Fungo Wang from Alibaba for the patch. + (Bug #32068538, Bug #101305) +* **InnoDB:** + An off-by-one error in `Fil_system` sharding + code was corrected, and the maximum number of shards + (`MAX_SHARDS`) was changed to 69. + (Bug #32052821, Bug #101260) +* **InnoDB:** + The TempTable storage engine memory allocator allocated extra + blocks of memory unnecessarily. + (Bug #32018553) +* **InnoDB:** + A `SELECT COUNT(*)` operation on a table + containing uncommitted data performed poorly due to unnecessary + I/O. + + Thanks to Brian Yue for the contribution. + (Bug #31997733, Bug #100966) +* **InnoDB:** + A race condition when shutting down the log writer raised an + assertion failure. + (Bug #31997362) +* **InnoDB:** + Page cleaner threads were not utilized optimally in sync-flush + mode, which could cause page flush operations to slow down or + stall in some cases. Sync-flush mode occurs when + `InnoDB` is close to running out of free space + in the redo log, causing the page cleaner coordinator to + initiate aggressive page flushing. + (Bug #31994031) +* **InnoDB:** + A high frequency of updates while undo log truncation was + enabled caused purge to lag. The lag was due to the + [`innodb_purge_rseg_truncate_frequency`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_purge_rseg_truncate_frequency) + setting being changed temporarily from 128 to 1 when an undo + tablespace was selected for truncation. The code that modified + the setting has been removed. + (Bug #31991688) +* **InnoDB:** + Automated truncation of undo tablespaces caused a performance + regression. To address this issue, undo tablespace files are now + initialized at 16MB and extended by a minimum of 16MB. To handle + aggressive growth, the file extension size is doubled if the + previous file extension happened less than 0.1 seconds earlier. + Doubling of the extension size can occur multiple times to a + maximum of 256MB. If the previous file extension occurred more + than 0.1 seconds earlier, the extension size is reduced by half, + which can also occur multiple times, to a minimum of 16MB. + Previously, the initial size of an undo tablespace depended on + the `InnoDB` page size, and undo tablespaces + were extended four extents at a time. + + If the `AUTOEXTEND_SIZE` option is defined for + an undo tablespace, the undo tablespace is extended by the + greater of the `AUTOEXTEND_SIZE` setting and + the extension size determined by the logic described above. + + When an undo tablespace is truncated, it is normally recreated + at 16MB in size, but if the current file extension size is + larger than 16MB, and the previous file extension happened + within the last second, the new undo tablespace is created at a + quarter of the size defined by the + [`innodb_max_undo_log_size`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_max_undo_log_size) + variable. + + Stale undo tablespace pages are no longer removed at the next + checkpoint. Instead, the pages are removed in the background by + the `InnoDB` master thread. + (Bug #31965404, Bug #32020900, Bug #101194) +* **InnoDB:** + A `posix_fallocate()` failure while + preallocating space for a temporary tablespace raised an error + and caused an initialization failure. A warning is now issued + instead, and `InnoDB` falls back to the + non-`posix_fallocate()` method for + preallocating space. + (Bug #31965379) +* **InnoDB:** + An invalid pointer caused a shutdown failure on a MySQL Server + compiled with the + [`DISABLE_PSI_MEMORY`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_disable_psi_memory) source + configuration option enabled. + (Bug #31963333) +* **InnoDB:** + A long SX lock held by an internal function that calculates new + statistics for a given index caused a failure. + (Bug #31889883) +* **InnoDB:** + The + [`INFORMATION_SCHEMA.INNODB_TABLESPACES`](/doc/refman/8.0/en/information-schema-innodb-tablespaces-table.html) + table reported a `FILE_SIZE` of 0 for some + tables and schemas. When the associated tablespace was not in + the memory cache, the tablespace name was used to determine the + tablespace file name, which was not always a reliable method. + The tablespace ID is now used instead. Using the tablespace name + remains as a fallback method. + (Bug #31841617) +* **InnoDB:** + After dropping a `FULLTEXT` index and renaming + the table to move it to a new schema, the + `FULLTEXT` auxiliary tables were not renamed + accordingly and remained in the old schema directory. + (Bug #31773368, Bug #100570) +* **InnoDB:** + After upgrading to MySQL 8.0, a failure occurred when attempting + to perform a DML operation on a table that was previously + defined with a full-text search index. + (Bug #31749490) +* **InnoDB:** + Importing a tablespace with a page-compressed table did not + report a schema mismatch error for source and destination tables + defined with a different `COMPRESSION` setting. + The `COMPRESSION` setting of the exported table + is now saved to the `.cfg` metadata file + during the + [`FLUSH + TABLES ... FOR EXPORT`](/doc/refman/8.0/en/flush.html#flush-tables-for-export-with-list) operation, and that information + is checked on import to ensure that both tables are defined with + the same `COMPRESSION` setting. + (Bug #31744694) +* **InnoDB:** + Dummy keys used to check if the MySQL Keyring plugin is + functioning were left behind in an inactive state, and the + number of inactive dummy keys increased over time. The actual + master key is now used instead, if present. If no master key is + available, a dummy master key is generated. + (Bug #31737924) +* **InnoDB:** + Querying the + [`INFORMATION_SCHEMA.FILES`](/doc/refman/8.0/en/information-schema-files-table.html) table + after moving the `InnoDB` system tablespace + outside of the data directory raised a warning indicating that + the `innodb_system` filename is unknown. + (Bug #31603047) +* **InnoDB:** + In a replication scenario involving a replica with binary + logging or [`log_slave_updates`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_log_slave_updates) + disabled, the server failed to start due to an excessive number + of gaps in the `mysql.gtid_executed` table. The + gaps occurred for workloads that included both + `InnoDB` and non-`InnoDB` + transactions. GTIDs for `InnoDB` transactions + are flushed to the `mysql.gtid_executed` table + by the GTID persister thread, which runs periodically, while + GTIDs for non-`InnoDB` transactions are written + to the to the `mysql.gtid_executed` table + directly by replica server threads. The GTID persister thread + fell behind as it cycled through merging entries and compressing + the `mysql.gtid_executed` table. As a result, + the size of the GTID flush list for `InnoDB` + transactions grew over time along with the number of gaps in the + `mysql.gtid_executed` table, eventually causing + a server failure and subsequent startup failures. To address + this issue, the GTID persister thread now writes GTIDs for both + `InnoDB` and non-`InnoDB` + transactions, and foreground commits are forced to wait if the + GTID persister thread falls behind. Also, the + [`gtid_executed_compression_period`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_executed_compression_period) + default setting was changed from 1000 to 0 to disabled explicit + compression of the `mysql.gtid_executed` table + by default. + + Thanks to Venkatesh Prasad for the contribution. + (Bug #31599938, Bug #100118) +* **InnoDB:** + Persisting GTID values for XA transactions affected XA + transaction performance. Two GTID values are generated for XA + transactions, one for the prepare stage and another for the + commit stage. The first GTID value is written to the undo log + and later overwritten by the second GTID value. Writing of the + second GTID value could only occur after flushing the first GTID + value to the `gtid_executed` table. Space is + now reserved in the undo log for both XA transaction GTID + values. + (Bug #31467953, Bug #99638) +* **InnoDB:** + `InnoDB` source files were updated to address + warnings produced when building Doxygen source code + documentation. + (Bug #31354760) +* **InnoDB:** + The full-text search synchronization thread attempted to read a + previously-freed word from the index cache. + (Bug #31310404) +* **InnoDB:** + A 20µs sleep in the `buf_wait_for_read()` + function introduced with parallel read functionality in MySQL + 8.0.17 took 1ms on Windows, causing an unexpected timeout when + running certain tests. Also, AIO threads were found to have + uneven amounts of waiting operating system IO requests. + (Bug #31095274) + + References: This issue is a regression of: Bug #31123564. +* **InnoDB:** + Cleanup in certain replicated XA transactions failed to reattach + transaction object (`trx_t`), which raised an + assertion failure. + (Bug #31006095) +* **InnoDB:** + The tablespace encryption type setting was not properly updated + due to a failure during the resumption of an + [`ALTER + TABLESPACE ENCRYPTION`](/doc/refman/8.0/en/alter-tablespace.html) operation following a server + failure. + (Bug #30883833, Bug #98537) +* **InnoDB:** + An interrupted tablespace encryption operation did not update + the `encrypt_type` table option information in + the data dictionary when the operation resumed processing after + the server was restarted. + (Bug #30883833, Bug #98537, Bug #30888919, Bug #98564) +* **InnoDB:** + Internal counter variables associated with thread sleep delay + and threads entering an leaving `InnoDB` were + revised to use C++ `std::atomic`. Built-in + atomic operations were removed. Thanks to Yibo Cai from ARM for + the contribution. + (Bug #30567060, Bug #97704) +* **InnoDB:** + A relaxed memory order was implemented for dictionary memory + variable fetch-add + (`dict_temp_file_num.fetch_add`) and store + (`dict_temp_file_num.store`) operations. + + Thanks to Yibo Cai for the contribution. + (Bug #30567054, Bug #97703) +* **InnoDB:** + A background thread that resumed a tablespace encryption + operation after the server started failed to take an metadata + lock on the tablespace, which permitted concurrent DDL + operations and led to a race condition with the startup thread. + The startup thread now waits until the tablespace metadata lock + is taken. + (Bug #28531637) +* **InnoDB:** + Calls to `numa_all_nodes_ptr` were replaced by + the `numa_get_mems_allowed()` function. Thanks + to Daniel Black for the contribution. + (Bug #24693086, Bug #83044) +* **Partitioning:** + [`ALTER + TABLE t1 EXCHANGE PARTITION ... WITH TABLE t2`](/doc/refman/8.0/en/alter-table-partition-operations.html) led to + an assert when `t1` was not a partitioned + table. + (Bug #100971, Bug #31941543) + + References: This issue is a regression of: Bug #29706669. +* **Replication:** + The `network_namespace` parameter for the + `asynchronous_connection_failover_add_source()` + and + `asynchronous_connection_failover_delete_source()` + function is no longer used. These functions add and remove + replication source servers from the source list for a + replication channel for the asynchronous connection failover + mechanism. The network namespace for a replication channel is + managed using the `CHANGE REPLICATION SOURCE` + statement, and has special requirements for Group Replication + source servers, so it should no longer be specified in the + functions. + (Bug #32078189) +* **Replication:** + When **mysqlbinlog**’s + `--print-table-metadata` option was used, + **mysqlbinlog** used a different method for + assessing numeric fields to the method used by the server when + writing to the binary log, resulting in incorrect metadata + output relating to these fields. **mysqlbinlog** + now uses the same method as the server. + (Bug #31956206) +* **Replication:** + When using network namespaces in a replication channel and the + initial connection from the replica to the master was + interrupted, subsequent connection attempts failed to use the + correct namespace information. + (Bug #31954087) +* **Replication:** + If a group member was expelled and made an auto-rejoin attempt + at a point when some tables on the instance were locked (for + example while a backup was running), the attempt failed and no + further attempts were made. This scenario is now handled + correctly. + (Bug #31460690) +* **Replication:** + As the number of replicas replicating from a semisynchronous + source server increased, locking contention could result in a + performance degradation. The locking mechanisms used by the + plugins have been changed to use shared locks where possible, + avoid unnecessary lock acquisitions, and limit callbacks. The + new behaviors can be implemented by enabling the following + system variables: + + + `replication_sender_observe_commit_only=1` + limits callbacks. + + `replication_optimize_for_static_plugin_config=1` + adds shared locks and avoids unnecessary lock acquisitions. + This system variable must be disabled if you want to + uninstall the plugin. + + Both system variables can be enabled before or after installing + the semisynchronous replication plugin, and can be enabled while + replication is running. Semisynchronous replication source + servers can also get performance benefits from enabling these + system variables, because they use the same locking mechanisms + as the replicas. + (Bug #30519928) +* **Replication:** + On a multi-threaded replica where the commit order is preserved, + worker threads must wait for all transactions that occur earlier + in the relay log to commit before committing their own + transactions. If a deadlock occurs because a thread waiting to + commit a transaction later in the commit order has locked rows + needed by a transaction earlier in the commit order, a deadlock + detection algorithm signals the waiting thread to roll back its + transaction. Previously, if transaction retries were not + available, the worker thread that rolled back its transaction + would exit immediately without signalling other worker threads + in the commit order, which could stall replication. A worker + thread in this situation now waits for its turn to call the + rollback function, which means it signals the other threads + correctly. + (Bug #26883680, Bug #87796) +* **Replication:** + GTIDs are only available on a server instance up to the number + of non-negative values for a signed 64-bit integer (2 to the + power of 63 minus 1). If you set the value of + [`gtid_purged`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_purged) to a number that + approaches this limit, subsequent commits can cause the server + to run out of GTIDs and take the action specified by + [`binlog_error_action`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_error_action). From MySQL + 8.0.23, a warning message is issued when the server instance is + approaching the limit. + (Bug #26035544) +* **Group Replication:** + When the system variable + [`transaction_write_set_extraction=XXHASH64`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_transaction_write_set_extraction) + is set, which is the default in MySQL 8.0 and a requirement for + Group Replication, the collection of writes for a transaction + previously had no upper size limit. Now, for standard source to + replica replication, the numeric limit on write sets specified + by + [`binlog_transaction_dependency_history_size`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_transaction_dependency_history_size) + is applied, after which the write set information is discarded + but the transaction continues to execute. Because the write set + information is then unavailable for the dependency calculation, + the transaction is marked as non-concurrent, and is processed + sequentially on the replica. For Group Replication, the process + of extracting the writes from a transaction is required for + conflict detection and certification on all group members, so + the write set information cannot be discarded if the transaction + is to complete. The byte limit set by + [`group_replication_transaction_size_limit`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_transaction_size_limit) + is applied instead of the numeric limit, and if the limit is + exceeded, the transaction fails to execute. + (Bug #32019842) +* **Group Replication:** + If the Group Replication applier channel + (`group_replication_applier`) was holding a + lock on a table, for example because of a backup in progress, + and the member was expelled from the group and tried to rejoin + automatically, the auto-rejoin attempt was unsuccessful and did + not retry. Now, Group Replication checks during startup and + rejoin attempts whether the + `group_replication_applier` channel is already + running. If that is the case at startup, an error message is + returned. If that is the case during an auto-rejoin attempt, + that attempt fails, but further attempts are made as specified + by the + [`group_replication_autorejoin_tries`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_autorejoin_tries) + system variable. + (Bug #31648211) +* **Microsoft Windows:** + On Windows, running the MySQL server as a service caused + shared-memory connections to fail. + (Bug #32009251) +* **JSON:** + [`JSON_ARRAYAGG()`](/doc/refman/8.0/en/aggregate-functions.html#function_json-arrayagg) did not always + perform proper error handling. + (Bug #31856260, Bug #32012559, Bug #32181438) +* **JSON:** + When updating a [`JSON`](/doc/refman/8.0/en/json.html) value using + [`JSON_SET()`](/doc/refman/8.0/en/json-modification-functions.html#function_json-set), + [`JSON_REPLACE()`](/doc/refman/8.0/en/json-modification-functions.html#function_json-replace), or + [`JSON_REMOVE()`](/doc/refman/8.0/en/json-modification-functions.html#function_json-remove), the target column + can sometimes be updated in-place. This happened only when the + target table of the update operation was a base table, but when + the target table was an updatable view, the update was always + performed by writing the full `JSON` value. + + Now in such cases, an in-place update (that is, a partial + update) is also performed when the target table is an updatable + view. + (Bug #25840784) +* **JSON:** + Work done in MySQL 8.0.22 to cause prepared statements to be + prepared only once introduced a regression in the handling of + dynamic parameters to JSON functions. All + [`JSON`](/doc/refman/8.0/en/json.html) arguments were classified as + data type `MYSQL_TYPE_JSON`, which overlooked + the fact that JSON functions take two kinds of JSON + parameters—JSON values and JSON documents—and this + distinction cannot be made with the data type only. For Bug + #31667405, this problem was solved for comparison operators and + the [`IN()`](/doc/refman/8.0/en/comparison-operators.html#operator_in) operator by making it + possible to tag a JSON argument as being a scalar value, while + letting arguments to other JSON functions be treated as JSON + documents. + + The present fix restores for a number of JSON functions their + treatment of certain arguments as JSON values, as listed here: + + The first argument to [`MEMBER OF()`](/doc/refman/8.0/en/json-search-functions.html#operator_member-of) + + The third, fifth, seventh, and subsequent odd-numbered arguments + to the functions [`JSON_INSERT()`](/doc/refman/8.0/en/json-modification-functions.html#function_json-insert), + [`JSON_REPLACE()`](/doc/refman/8.0/en/json-modification-functions.html#function_json-replace), + [`JSON_SET()`](/doc/refman/8.0/en/json-modification-functions.html#function_json-set), + [`JSON_ARRAY_APPEND()`](/doc/refman/8.0/en/json-modification-functions.html#function_json-array-append), and + [`JSON_ARRAY_INSERT()`](/doc/refman/8.0/en/json-modification-functions.html#function_json-array-insert). + (Bug #101284, Bug #32063203) + + References: See also: Bug #31667405. +* **JSON:** + When **mysqld** was run with + [`--debug`](/doc/refman/8.0/en/server-options.html#option_mysqld_debug), attempting to execute a + query that made use of a multi-valued index raised an error. + (Bug #99833, Bug #31474182) +* Use of the `thread_pool` plugin could result in + Address Sanitizer warnings. + (Bug #32213294) +* While pushing a condition down to a materialized derived table, + and a condition is partially pushed down, the optimizer may, in + some cases in which a query transformation has added new + conditions to the `WHERE` condition, call the + internal `fix_fields()` function for the + condition that remains in the outer query block. A successful + return from this function call was misinterpreted as an error, + leading to the silent failure of the original statement. + (Bug #32150145) +* Multiple calls to a stored procedure containing an + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) statement that + included an `ORDER BY` clause could cause a + server exit. + (Bug #32147402) +* Prepared statements involving stored programs could cause + heap-use-after-free memory problems. + (Bug #32131022, Bug #32045681, Bug #32051928) +* Queries on [`INFORMATION_SCHEMA`](/doc/refman/8.0/en/information-schema.html) + tables that involved materialized derived tables could fail. + (Bug #32127562, Bug #101504) +* A potential buffer overflow was fixed. Thanks to Sifang Zhao for + pointing out the issue, and for suggesting a fix (although it + was not used). + (Bug #32113015, Bug #101448) +* Conversion of `FLOAT` values to values of type + `INT` could generate Undefined Behavior + Sanitizer warnings. + (Bug #32099994, Bug #32100033) +* In multiple-row queries, the + [`LOAD_FILE()`](/doc/refman/8.0/en/string-functions.html#function_load-file) function evaluated to + the same value for every row. + (Bug #32096341, Bug #101401) +* Generic Linux **tar** file distributions had + too-restrictive file permissions after unpacking, requiring a + manual **chmod** to correct. + (Bug #32080900) +* For debug builds, prepared + [`SET`](/doc/refman/8.0/en/set-variable.html) + statements containing subqueries in stored procedures could + raise an assertion. + (Bug #32078387) + + References: See also: Bug #32100210. +* For prepared statements, illegal mix of + collations errors could occur for legal collation + mixes. + (Bug #32077842, Bug #101346, Bug #32145078, Bug #101575) +* The functions `REGEXP_LIKE()`, + `REGEXP_INSTR()`, and + `REGEXP_REPLACE()` raise errors for malformed + regular expression patterns, but could also return + `NULL` for such cases, causing subsequent debug + asserts. Now we ensure that these functions do not return + `NULL` except in certain specified cases. + + The function `REGEXP_SUBSTR()` can always + return `NULL`, so no such check is needed, and + for this function we make sure that one is not performed. + (Bug #32053093) +* Testing an aggregate function for `IS NULL` or + `IS NOT NULL` in a `HAVING` + condition using `WITH ROLLUP` led to wrong + results. + (Bug #32049313) +* When a new aggregate function was added to the current query + block because an inner query block had an aggregate function + requiring evaluation in the current one, the server did not add + rollup wrappers to it as needed. + (Bug #32034914) +* For debug builds, certain [`CREATE + TABLE`](/doc/refman/8.0/en/create-table.html) statements with `CHECK` + constraints could raise an assertion. + (Bug #32018406, Bug #101180) +* Incorrect BLOB field values were passed from + `InnoDB` during a secondary engine load + operation. + (Bug #32014483) +* The LOCK\_ORDER tool did not correctly represent + `InnoDB` share exclusive locks. + (Bug #31994052) +* The server did not handle properly an error raised when trying + to use an aggregation function with an invalid column type as + part of a hash join. + (Bug #31989333) +* The length of the `WORD` column of the + [`INFORMATION_SCHEMA.KEYWORDS`](/doc/refman/8.0/en/information-schema-keywords-table.html) table + could change depending on table contents. + (Bug #31982157) +* The Performance Schema `host_cache` table was + empty and did not expose the contents of the host cache if the + Performance Schema was disabled. The table now shows cache + contents regardless of whether the Performance Schema is + enabled. + (Bug #31978763) +* A [`HANDLER + READ`](/doc/refman/8.0/en/handler.html) statement sometimes hit an assert when a previous + statement did not restore the original value of + `THD::mark_used_columns` after use. + (Bug #31977414) +* Importing a compressed table could cause an unexpected server + exit if the table contained values that were very large when + uncompressed. + (Bug #31943021) +* Removed a memory leak that could occur when a subquery using a + hash join and `LIMIT` was executed repeatedly. + (Bug #31940549) +* A compilation failure on Ubuntu was corrected. + (Bug #31930934, Bug #100938) +* Memory used for storing partial-revokes information could grow + excessively for sessions that executed a large number of + statements. + (Bug #31919448) +* The server did not handle all cases of the + `WHERE_CONDITION` optimization correctly. + (Bug #31905199) +* [`FLUSH TABLES WITH READ LOCK`](/doc/refman/8.0/en/flush.html#flush-tables-with-read-lock) could + block other sessions from executing [`SHOW + TABLE STATUS`](/doc/refman/8.0/en/show-table-status.html). + (Bug #31894662) +* In some cases, [`MIN()`](/doc/refman/8.0/en/aggregate-functions.html#function_min) and + [`MAX()`](/doc/refman/8.0/en/aggregate-functions.html#function_max) incorrectly returned + `NULL` when used as window functions with + temporal or [`JSON`](/doc/refman/8.0/en/json.html) values as + arguments. + (Bug #31882291) +* [`GRANT ... GRANT OPTION + ... TO`](/doc/refman/8.0/en/grant.html) and + [`GRANT ... TO .. WITH + GRANT OPTION`](/doc/refman/8.0/en/grant.html) sometimes were not correctly written to + the server logs. + (Bug #31869146, Bug #100793) +* For debug builds, [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) + using a partition list of more than 256 entries raised an + assertion. + (Bug #31867653) +* It was possible for queries in the file named by the + [`init_file`](/doc/refman/8.0/en/server-system-variables.html#sysvar_init_file) system variable to + cause server startup failure. + (Bug #31835782) +* When performing a hash join, the optimizer could register a + false match between a negative integer value and a very large + unsigned integer value. + (Bug #31832001, Bug #31940639, Bug #100967) +* [`SHOW VARIABLES`](/doc/refman/8.0/en/show-variables.html) could report an + incorrect value for the + [`partial_revokes`](/doc/refman/8.0/en/server-system-variables.html#sysvar_partial_revokes) system + variable. + (Bug #31819558, Bug #100677) +* In the Performance Schema + [`user_defined_functions`](/doc/refman/8.0/en/performance-schema-user-defined-functions-table.html) table, the + value of the `UDF_LIBRARY` column is supposed + to be `NULL` for loadable functions registered + via the service API. The value was incorrectly set to the empty + string. + (Bug #31791754) +* The server automatic upgrade procedure failed to upgrade older + help tables that used the `latin1` character + set. + (Bug #31789964) +* Duplicate warnings could occur when executing an SQL statement + that read the grant tables in serializable or repeatable-read + transaction isolation level. + (Bug #31769242) +* In certain queries with `DISTINCT` aggregates + (which in general are solved by sorting before aggregation), the + server used a temporary table instead of streaming due to the + mistaken assumption that the logic for handling the temporary + table performed deduplication. Now the server checks for the + implied unique index instead, which is more robust and allows + for the removal of unnecessary logic. + (Bug #31762806) +* Certain combinations of + [`lower_case_table_names`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names) values + and schema names in Event Scheduler event definitions could + cause the server to stall. + (Bug #31733090) +* Calling one stored function from within another could produce a + conflict in field resolution, resulting in a server exit. + (Bug #31731334) +* Loadable functions defined without a + `udf_init()` method could cause an unexpected + server exit. + (Bug #31701219) +* Setting the [`secure_file_priv`](/doc/refman/8.0/en/server-system-variables.html#sysvar_secure_file_priv) + system variable to `NULL` should disable its + action, but instead caused the server to create a directory + named `NULL`. + (Bug #31700734, Bug #100384) +* **mysqlpump** could exit unexpectedly due to + improper simultaneous accesses to shared structures. + (Bug #31696241) +* Uninstalling a component and deregistering loadable functions + installed by the component was not properly synchronized with + whether the functions were currently in use. + (Bug #31646698) +* Cleanup following execution of a prepared statement that + performed a multi-table [`UPDATE`](/doc/refman/8.0/en/update.html) or + [`DELETE`](/doc/refman/8.0/en/delete.html) was not always done + correctly, which meant that, following the first execution of + such a prepared statement, the server reported a nonzero number + of rows updated, even though no rows were actually changed. + (Bug #31640267) + + References: See also: Bug #32100210. +* For the engines which support primary key extension, when the + total key length exceeded `MAX_KEY_LENGTH` or + the number of key parts exceeded + `MAX_REF_PARTS`, key parts of primary keys + which did not fit within these limits were not added to the + secondary key, but key parts of primary keys were + unconditionally marked as part of secondary keys. + + This led to a situation in which the secondary key was treated + as a covering index, which meant sometimes the wrong access + method was chosen. + + This is fixed by modifying the way in which key parts of primary + keys are added to secondary keys so that those which do not fit + within which do not fit within the limits mentioned previously + mentioned are cleared. + (Bug #31617858) +* When MySQL is configured with + [`-DWITH_ICU=system`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_icu), + **CMake** now checks that the ICU library version + is sufficiently recent. + (Bug #31600044) +* When invoked with the + [`--binary-as-hex`](/doc/refman/8.0/en/mysql-command-options.html#option_mysql_binary-as-hex) option, + **mysql** displayed `NULL` + values as empty binary strings (`0x`). + + Selecting an undefined variable returned the empty binary string + (`0x`) rather than `NULL`. + (Bug #31549724, Bug #31638968, Bug #100251) +* Enabling + `DISABLE_PSI_xxx` + Performance Schema-related **CMake** options + caused build failures. + (Bug #31549724) +* Some queries returned different results depending on the value + of + [`internal_tmp_mem_storage_engine`](/doc/refman/8.0/en/server-system-variables.html#sysvar_internal_tmp_mem_storage_engine). + + The root cause of this issue related to the fact that, when + buffering rows for window functions, if the size of the + in-memory temporary table holding these buffered rows exceeds + the limit specified, a new temporary table is created on disk; + the frame buffer partition offset is set at the beginning of a + new partition to the total number of rows that have been read so + far, and is updated specifically for use when the temporary + table is moved to disk (this being used to calculate the hints + required to process window functions). The problem arose because + the frame buffer partition offset was not updated for the + specific case when a new partition started while creating the + temporary table on disk, which caused the wrong rows to be read. + + This issue is fixed by making sure to update the frame buffer + partition offset correctly whenever a new partition starts while + a temporary table is moved to disk. + (Bug #31546816) +* While buffering rows for window functions, if the size of the + in-memory temporary table holding these buffered rows exceeds + the limit specified by + [`temptable_max_ram`](/doc/refman/8.0/en/server-system-variables.html#sysvar_temptable_max_ram), a new + temporary table is created on disk. After the creation of the + temporary table, hints used to process window functions need to + be reset, since the temporary table is now moved to disk, making + the existing hints unusable. When the creation of the temporary + table on disk occurred when the first row in the frame buffer + was being processed, the hints had not been initialized and + trying to reset these uninitialized hints resulted in an + unplanned server exit. + + This issue is fixed by adding a check to verify whether frame + buffer hints have been initialized, prior to resetting them. + (Bug #31544404) +* The Performance Schema could produce incorrect results for joins + on a `CHANNEL_NAME` column when the index for + `CHANNEL_NAME` was disabled with `USE + INDEX ()`. + (Bug #31544023, Bug #99989) +* When removing unused window definitions, a subquery that was + part of an `ORDER BY` was not removed. + (Bug #31518806) +* In certain cases, the server did not handle multiply-nested + subqueries correctly. + (Bug #31472704) +* The recognized syntax for a + [`VALUES`](/doc/refman/8.0/en/values.html) statement includes an + `ORDER BY` clause, but this clause was not + resolved, so the execution engine could encounter invalid data. + (Bug #31387510) +* The server attempted to access a non-existent temporary + directory at startup, causing a failure. Checks were added to + ensure that temporary directories exist, and that files are + successfully created in the + [`tmpdir`](/doc/refman/8.0/en/server-system-variables.html#sysvar_tmpdir) directory. + (Bug #31377118) +* While removing redundant sorting, a window's ordering was + removed due to the fact that rows were expected to come in order + because of the ordering of another window. When the other window + was subsequently removed because it was unused, this resulted in + unordered rows, which was not expected during evaluation. + + Now in such cases, removal of redundant sorts is not performed + until after any unused windows have been removed. In addition, + resolution of any rollups has been moved to the preparation + phase. + (Bug #31361393) +* Semisynchronous replication errors were incorrectly written to + the error log with a subsystem tag of `Server`. + They are now written with a tag of `Repl`, the + same as for other replication errors. + (Bug #31327337) +* A user could grant itself as a role to itself. + (Bug #31222230) +* The server did not always correctly handle cases in which + multiple `WHERE` conditions, one of which was + always FALSE, referred to the same subquery. + (Bug #31216115) +* With a [`lower_case_table_names=2`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names) + setting, `InnoDB` background threads sometimes + acquired table metadata locks using the wrong character case for + the schema name part of a lock key, resulting in unprotected + metadata and race conditions. The correct character case is now + applied. Changes were also implemented to prevent metadata locks + from being released before corresponding data dictionary + objects, and to improve assertion code that checks lock + protection when acquiring data dictionary objects. + (Bug #31165802) +* If a [`CR_UNKNOWN_ERROR`](/doc/mysql-errors/8.0/en/client-error-reference.html#error_cr_unknown_error) was to be + sent to a client, an exception occurred. + (Bug #31123643) +* Conversion of `DOUBLE` values to values of type + `BIT`, `ENUM`, or + `SET` could generate Undefined Behavior + Sanitizer warnings. + (Bug #31019130) +* Certain accounts could cause server startup failure if the + [`skip_name_resolve`](/doc/refman/8.0/en/server-system-variables.html#sysvar_skip_name_resolve) system + variable was enabled. + (Bug #31018510) +* Client programs could unexpectedly exit if communication packets + contained bad data. + (Bug #30890850) +* A buffer overflow in the client library was fixed. + (Bug #30885987) +* When creating a multi-valued or other functional index, a + performance drop was seen when executing a query against the + table on which the index was defined, even though the index + itself was not actually used. This occurred because the hidden + virtual column that backs such indexes was evaluated + unnecessarily for each row in the query. + (Bug #30838749) + + References: This issue is a regression of: Bug #28069731. +* **CMake** checks for `libcurl` + dependencies were improved. + (Bug #30268245) +* **mysql\_config\_editor** incorrectly treated + `#` in password values as a comment character. + (Bug #29861961, Bug #95597) +* In some cases, the optimizer attempted to compute the hash value + for an empty string. Now a fixed value is always used instead. + (Bug #22588319) +* The [`INSERT()`](/doc/refman/8.0/en/string-functions.html#function_insert) and + [`RPAD()`](/doc/refman/8.0/en/string-functions.html#function_rpad) functions did not + correctly set the character set of the result. + (Bug #22523946, Bug #79909, Bug #31887870, Bug #100841) +* Some corner cases for `val1 + BETWEEEN val2 AND + val3` were fixed, such as + that `-1 BETWEEN 9223372036854775808 AND 1` + returned true. + (Bug #22515857, Bug #79878) +* For the Performance Schema + [`memory_summary_global_by_event_name`](/doc/refman/8.0/en/performance-schema-memory-summary-tables.html) + table, the low watermark columns could have negative values, and + the high watermark columns had ever-increasing values even when + the server memory usage did not increase. + (Bug #22246001, Bug #79285) +* Several issues converting strings to numbers were fixed. + (Bug #19186271, Bug #73248) +* Certain group by queries that performed correctly did not return + the expected result when `WITH ROLLUP` was + added. This was due to the fact that decimal information was not + always correctly piped through rollup group items, causing + functions returning decimal values such as + [`TRUNCATE()`](/doc/refman/8.0/en/mathematical-functions.html#function_truncate) to receive data of the + wrong type. + (Bug #101684, Bug #32179240) +* When creating fields for materializing temporary tables (that + is, when needing to sort a join), the optimizer checks whether + the item needs to be copied or is only a constant. This was not + done correctly in one specific case; when performing an outer + join against a view or derived table containing a constant, the + item was not properly materialized into the table, which could + yield spurious occurrences of `NULL` in the + result. + (Bug #101622, Bug #32162862) + + References: See also: Bug #31790217. +* When [`REGEXP_REPLACE()`](/doc/refman/8.0/en/regexp.html#function_regexp-replace) was used in + an SQL statement, the internal function + `Regexp_engine::Replace()` did not reset the + error code value after handling a record, which could affect + processing of the next record, which lead to issues. + + Our thanks to Hope Lee for the contribution. + (Bug #101256, Bug #32050219) +* For a query having the following form, the column list sometimes + assumed an inconsistent state after temporary tables were + created, causing out-of-bounds indexing later: + + ```None + SELECT * FROM ( + SELECT PI() + FROM t1 AS table1, t1 AS table2 + ORDER BY PI(), table1.a + ) AS d1; + ``` + + (Bug #101012, Bug #31955761, Bug #31978439) + + References: This issue is a regression of: Bug #31790217. +* When aggregating data that was already sorted (known as + performing streaming aggregation, due to no temporary tables + being used), it was not possible to determine when a group ended + until processing the first row in the next group, by which time + the group expressions to be output were often already + overwritten. + + This is fixed by replacing the complex logic previously used + with the much simpler method of saving a representative row for + the group when encountering it the first time, so that its + columns can easily be retrieved for the output row when needed. + (Bug #100791, Bug #27272052, Bug #31073167, Bug #31790217, Bug #31868610) +* Subqueries making use of fulltext matching might not perform + properly when + [`subquery_to_derived`](/doc/refman/8.0/en/switchable-optimizations.html#optflag_subquery-to-derived) was + enabled, and could lead to an assert in debug builds. + (Bug #100749, Bug #31851600) +* When an [`ALTER TABLE + ... CONVERT TO CHARACTER SET`](/doc/refman/8.0/en/alter-table.html) statement is executed, + the character set of every [`CHAR`](/doc/refman/8.0/en/char.html), + [`VARCHAR`](/doc/refman/8.0/en/char.html), and + [`TEXT`](/doc/refman/8.0/en/blob.html) column in the table is + updated to the new `CHARACTER SET` value. This + change was also applied to the hidden `CHAR` + column used by an `ARRAY` column for a + multi-valued index; since the character set of the hidden column + must be one of `my_charset_utf8mb4_0900_bin` or + `binary`, this led to an assert in debug builds + of the server. + + This issue is resolved by no longer setting the character set of + the hidden column to that of the table when executing the + `ALTER TABLE` statement referenced previously; + this is similar to what is done for + [`BLOB`](/doc/refman/8.0/en/blob.html) columns in similar + circumstances. + (Bug #99403, Bug #31301101) +* In some cases, the server's internal string-conversion routines + had problems handling floating-point values which used length + specifiers and triggered use of scientific notation. + (Bug #92537, Bug #101570, Bug #28691605, Bug #32144265) + + References: See also: Bug #88256, Bug #27041543. diff --git a/corpus/changelog/mysql_releases/mysql_8024.md b/corpus/changelog/mysql_releases/mysql_8024.md new file mode 100644 index 0000000000000000000000000000000000000000..412236607e6ccdfea8e5231082bc2ddf6d86a8b0 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8024.md @@ -0,0 +1,1346 @@ +# MySQL 8.0.24 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-24.html +Version: 8.0.24 + +## Changes in MySQL 8.0.24 (2021-04-20, General Availability) + +* [Audit Log Notes](news-8-0-24.html#mysqld-8-0-24-audit-log "Audit Log Notes") +* [Compilation Notes](news-8-0-24.html#mysqld-8-0-24-compiling "Compilation Notes") +* [Connection Management Notes](news-8-0-24.html#mysqld-8-0-24-connection-management "Connection Management Notes") +* [Error Handling](news-8-0-24.html#mysqld-8-0-24-errors "Error Handling") +* [Keyring Notes](news-8-0-24.html#mysqld-8-0-24-keyring "Keyring Notes") +* [Optimizer Notes](news-8-0-24.html#mysqld-8-0-24-optimizer "Optimizer Notes") +* [Packaging Notes](news-8-0-24.html#mysqld-8-0-24-packaging "Packaging Notes") +* [Performance Schema Notes](news-8-0-24.html#mysqld-8-0-24-performance-schema "Performance Schema Notes") +* [Pluggable Authentication](news-8-0-24.html#mysqld-8-0-24-pluggable-auth "Pluggable Authentication") +* [Security Notes](news-8-0-24.html#mysqld-8-0-24-security "Security Notes") +* [Spatial Data Support](news-8-0-24.html#mysqld-8-0-24-spatial-support "Spatial Data Support") +* [Functionality Added or Changed](news-8-0-24.html#mysqld-8-0-24-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-24.html#mysqld-8-0-24-bug "Bugs Fixed") + +### Audit Log Notes + +* MySQL Enterprise Audit now supports audit log file pruning, for JSON-format + log files. See [Space Management of Audit Log Files](/doc/refman/8.0/en/audit-log-logging-configuration.html#audit-log-space-management). + (WL #14268) + +### Compilation Notes + +* GCC 10 is now a supported compiler for building MySQL on EL7 or + EL8. This compiler is available in the + `devtoolset-10` (EL7) or + `gcc-toolset-10` (EL8) package. It is also + recommended to use GCC 10 when building third-party applications + that are based on the `libmysqlclient` C API + library. + (Bug #32381003) + +### Connection Management Notes + +* Previously, if a client did not use the connection to the server + within the period specified by the + [`wait_timeout`](/doc/refman/8.0/en/server-system-variables.html#sysvar_wait_timeout) system variable + and the server closed the connection, the client received no + notification of the reason. Typically, the client would see + Lost connection to MySQL server during + query + ([`CR_SERVER_LOST`](/doc/mysql-errors/8.0/en/client-error-reference.html#error_cr_server_lost)) or + MySQL server has gone away + ([`CR_SERVER_GONE_ERROR`](/doc/mysql-errors/8.0/en/client-error-reference.html#error_cr_server_gone_error)). + + In such cases, the server now writes the reason to the + connection before closing it, and client receives a more + informative error message, The client was + disconnected by the server because of inactivity. See + wait\_timeout and interactive\_timeout for configuring this + behavior. + ([`ER_CLIENT_INTERACTION_TIMEOUT`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_client_interaction_timeout)). + + The previous behavior still applies for client connections to + older servers and connections to the server by older clients. + (WL #12999) + +### Error Handling + +* Client connection failure messages now include the port number. + For example: Can't connect to MySQL server on + '127.0.0.1:63333'.. Thanks to Daniël van Eeden for + the contribution. + (Bug #30787660, Bug #98311) + +### Keyring Notes + +* MySQL Keyring previously implemented keystore capabilities using + server plugins, but now is transitioning to use the MySQL + component infrastructure, beginning with these keyring + components: + + + `component_keyring_file` stores keyring + data in a file local to the server host. This component is + available in MySQL Community Edition and MySQL Enterprise Edition distributions. See + [Using the component\_keyring\_file File-Based Keyring Component](/doc/refman/8.0/en/keyring-file-component.html). + + `component_keyring_encrypted_file` stores + keyring data in an encrypted, password-protected file local + to the server host. This component is available in MySQL Enterprise Edition + distributions. See + [Using the component\_keyring\_encrypted\_file Encrypted File-Based Keyring Component](/doc/refman/8.0/en/keyring-encrypted-file-component.html). + + The new keyring components have similarities to the existing + `keyring_file` and + `keyring_encrypted_file` plugins, but are + configured differently, use distinct on-disk storage formats, + and have fewer restrictions on key type and key size. + + Keyring components are not loaded using the + [`--early-plugin-load`](/doc/refman/8.0/en/server-options.html#option_mysqld_early-plugin-load) server option + during startup or configured during startup or at runtime using + system variables: + + + During startup, the server determines which keyring + component to load using a manifest file, and the loaded + component consults its own configuration file when it + initializes. See + [Keyring Component Installation](/doc/refman/8.0/en/keyring-component-installation.html). + + At runtime, the new [`ALTER INSTANCE + RELOAD KEYRING`](/doc/refman/8.0/en/alter-instance.html#alter-instance-reload-keyring) statement enables reconfiguring an + installed keyring component after changes to its + configuration file. See [ALTER INSTANCE Statement](/doc/refman/8.0/en/alter-instance.html). + + If a keyring component is installed, the new Performance Schema + [`keyring_component_status`](/doc/refman/8.0/en/performance-schema-keyring-component-status-table.html) table + provides status information about it. See + [The keyring\_component\_status Table](/doc/refman/8.0/en/performance-schema-keyring-component-status-table.html). + + Key migration capabilities have been expanded. Previously, key + migration occurred only from one keyring plugin to another. The + new + [`--keyring-migration-to-component`](/doc/refman/8.0/en/keyring-options.html#option_mysqld_keyring-migration-to-component) + server option enables key migration from a keyring plugin to a + keyring component; this facilitates transitioning a MySQL + installation from keyring plugins to keyring components. The new + **mysql\_migrate\_keyring** utility enables key + migration from one keyring component to another. See + [Migrating Keys Between Keyring Keystores](/doc/refman/8.0/en/keyring-key-migration.html). There is no provision + for migrating keys from a keyring component to a keyring plugin. + + Existing keyring plugins remain available with no change to + user-visible characteristics, but their implementation was + revised to use the component infrastructure. This is facilitated + using the built-in plugin named + `daemon_keyring_proxy_plugin` that acts as a + bridge between the plugin and component service APIs. See + [The Keyring Proxy Bridge Plugin](/doc/refman/8.0/en/daemon-keyring-proxy-plugin.html). + (WL #13446) + +### Optimizer Notes + +* The MySQL query optimizer can now apply the derived table + optimization to correlated scalar subqueries, whenever the + [`subquery_to_derived`](/doc/refman/8.0/en/switchable-optimizations.html#optflag_subquery-to-derived) flag of + the [`optimizer_switch`](/doc/refman/8.0/en/server-system-variables.html#sysvar_optimizer_switch) variable + is enabled. This is done by applying an extra grouping and then + an outer join on the lifted predicate. For example, a query such + as `SELECT * FROM t1 WHERE (SELECT a FROM t2 WHERE + t2.a=t1.a) > 0` can be rewritten as `SELECT + t1.* FROM t1 LEFT OUTER JOIN (SELECT a, COUNT(*) AS ct FROM t2 + GROUP BY a) AS derived ON t1.a = derived.a WHERE derived.a > + 0`. + + If the subquery already has an explicit grouping, MySQL adds the + extra grouping to the end of the existing grouping list. + + MySQL performs a cardinality check to ensure that the subquery + does not return more than one row, and raises + [`ER_SUBQUERY_NO_1_ROW`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_subquery_no_1_row) if it does. + The check is performed as part of evaluating any + `WHERE` or `JOIN` clause in + the rewritten query, before evaluating the lifted predicate. + + For more information, see + [Correlated Subqueries](/doc/refman/8.0/en/correlated-subqueries.html), as well as + [Derived Tables](/doc/refman/8.0/en/derived-tables.html). + (WL #13520) + +### Packaging Notes + +* The bundled `libedit` library was upgraded to + version 20190324-3.1. + (Bug #32433089) +* Binary packages that include `curl` rather than + linking to the system `curl` library have been + upgraded to use `curl` 7.74.0. + +### Performance Schema Notes + +* **Incompatible Change:** + Instrumentation in the Performance Schema + [`setup_instruments`](/doc/refman/8.0/en/performance-schema-setup-instruments-table.html) table was revised + as follows: + + + There are new memory instruments to account for memory + allocated to data dictionary infrastructure and objects: + + ```None + memory/sql/dd::infrastructure + memory/sql/dd::objects + ``` + + Some instruments were renamed for improved uniformity of + instrument naming. Affected instrument names are grouped + using a key prefix in the same style as C++ namespaces. For + example, error-related instruments use a + `error::` prefix and partition-related + instruments use a `Partition::` prefix. The + following table displays the affected instruments. + + | Old Instrument Name | New Instrument Name | + | --- | --- | + | `debug_sync_control::debug_sync_action` | `THD::debug_sync_action` | + | `errmsgs` | `errmsgs::server` | + | `handler::errmsgs` | `errmsgs::handler` | + | `handlerton` | `handlerton::objects` | + | `log_error_loaded_services` | `log_error::loaded_services` | + | `log_error_stack` | `log_error::stack` | + | `LOG_name` | `LOG::file_name` | + | `MDL_context_backup_manager` | `MDL_context::backup_manager` | + | `Partition_admin` | `Partition::admin` | + | `Partition_share` | `Partition::share` | + | `partition_sort_buffer` | `Partition::sort_buffer` | + | `partition_syntax_buffer` | `Partition::syntax_buffer` | + | `Prepared_statement_map` | `Prepared_statement::infrastructure` | + | `prune_partitions::exec` | `Partition::prune_exec` | + | `Recovered_xa_transactions` | `XA::recovered_transactions` | + | `thd::main_mem_root` | `THD::main_mem_root` | + | `XID` | `XA::transaction_contexts` | + + In addition, the `servers` instrument is a + duplicate of `servers_cache` and has been + removed. + + Applications that use the old or removed instrument names + should be adjusted to account for this change. + + Several instruments were given a value in the + `DOCUMENTATION` column (it is no longer + `NULL`), improving runtime instrumentation + documentation availability. + + (WL #14079) + +### Pluggable Authentication + +* The new + [`caching_sha2_password_digest_rounds`](/doc/refman/8.0/en/server-system-variables.html#sysvar_caching_sha2_password_digest_rounds) + system variable enables configuring the number of hash rounds + used by the `caching_sha2_password` + authentication plugin for password storage. + (WL #14281) + +### Security Notes + +* For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 1.1.1k. Issues fixed in the new OpenSSL version are described at + and + . + (Bug #32680637) + +### Spatial Data Support + +* The new [`ST_LineInterpolatePoint()`](/doc/refman/8.0/en/spatial-operator-functions.html#function_st-lineinterpolatepoint) + and [`ST_LineInterpolatePoints()`](/doc/refman/8.0/en/spatial-operator-functions.html#function_st-lineinterpolatepoints) + functions return a single point or multiple points interpolated + between the start point and endpoint of a + `LineString` geometry. The new + [`ST_PointAtDistance()`](/doc/refman/8.0/en/spatial-operator-functions.html#function_st-pointatdistance) function + returns a single point a given distance along a + `LineString` geometry. See + [Spatial Operator Functions](/doc/refman/8.0/en/spatial-operator-functions.html). + + The new [`ST_Collect()`](/doc/refman/8.0/en/spatial-aggregate-functions.html#function_st-collect) aggregate + function takes multiple geometry arguments and produces from + them a single geometry collection value. See + [Spatial Aggregate Functions](/doc/refman/8.0/en/spatial-aggregate-functions.html) + + The [`CAST()`](/doc/refman/8.0/en/cast-functions.html#function_cast) and + [`CONVERT()`](/doc/refman/8.0/en/cast-functions.html#function_convert) functions have been + extended to support casting geometry values from one spatial + type to another. See [Cast Functions and Operators](/doc/refman/8.0/en/cast-functions.html). + (WL #13454, WL #14160, WL #14161, WL #14178, WL #14127) + +### Functionality Added or Changed + +* **InnoDB:** + The `AUTOEXTEND_SIZE` maximum setting was + increased from 64M to 4GB. The + `AUTOEXTEND_SIZE` option, introduced in MySQL + 8.0.23, defines the amount by which `InnoDB` + extends the size of a tablespace when it becomes full. The + option is supported with the [`CREATE + TABLE`](/doc/refman/8.0/en/create-table.html), [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html), + [`CREATE TABLESPACE`](/doc/refman/8.0/en/create-tablespace.html), and + [`ALTER TABLESPACE`](/doc/refman/8.0/en/alter-tablespace.html) statements. For + more information, see + [Tablespace AUTOEXTEND\_SIZE Configuration](/doc/refman/8.0/en/innodb-tablespace-autoextend-size.html). + (Bug #32438606) +* **Group Replication:** + It is now possible to use + [`START REPLICA + SQL_THREAD`](/doc/refman/8.0/en/start-replica.html) and + [`STOP REPLICA + SQL_THREAD`](/doc/refman/8.0/en/stop-replica.html) statements for the + `group_replication_applier` channel when Group + Replication is stopped. This enables an operator to apply any + remaining unapplied transactions on a server that left the + group, without having to rejoin the server to the group. + (Bug #32027612, Bug #32414767) +* **Group Replication:** + Group Replication’s allowlist of hosts from which an incoming + Group Communication System connection can be accepted, can now + be updated while Group Replication is still running. You can + therefore add new members to a group controlled by an allowlist + without needing to stop and restart Group Replication. The + allowlist is specified by the + `group_replication_ip_allowlist` system + variable on each group member. + (WL #14563) +* **Microsoft Windows:** + The `/RTC1` compiler flag was removed from the + debug compiler flags to reduce the time needed to run all tests + invoked by the `mysql-test-run.pl` script + when using MSVC on Windows. Initially, this compiler flag was + introduced with the **CMake** + program (by default for debug builds) and it generated code to + test for stack corruption around function calls and the use of + uninitialized variables at runtime. No loss of bug discovery is + expected with the removal of the `/RTC1` + compiler flag. Memory errors, such as stack corruption, are more + likely to be found by Address Sanitizer (ASAN) testing and the + use of uninitialized variables are detected by compiler + warnings. + (Bug #32525732) +* **Microsoft Windows:** + The + [`named_pipe_full_access_group`](/doc/refman/8.0/en/server-system-variables.html#sysvar_named_pipe_full_access_group) + system variable now defaults to an empty string + (`''`), making named pipe connections secure. + Previously, `'*everyone*'` was the default + value. A valid Windows local group name may be substituted. + (WL #12671) +* The new + [`clone_donor_timeout_after_network_failure`](/doc/refman/8.0/en/clone-plugin-options-variables.html#sysvar_clone_donor_timeout_after_network_failure) + Clone plugin variable defines the amount of time the donor + allows for the recipient to reconnect and restart a cloning + operation following a network failure. The timeout was + previously fixed at 5 minutes. The timeout can now be extended + up to 30 minutes to provide more time for network issues to be + resolved. + + Thanks to Daniël van Eeden for the contribution. + (Bug #32335434, Bug #102103) +* Client applications and test suite plugins now report + `utf8mb3` rather than `utf8` + when writing character set names. + (Bug #32164079, Bug #32164125) +* The [`--skip-slave-start`](/doc/refman/8.0/en/replication-options-replica.html#option_mysqld_skip-slave-start) command + line parameter is used to prevent the replication I/O thread and + replication SQL thread from starting when a replica server + restarts. However, using the parameter on the command line or in + a `my.cnf` option file might require login + access to the server host. The + `skip_slave_start` system variable is now + provided to give access to this feature using MySQL Server’s + privilege structure, so that database administrators do not need + any privileged access to the operating system. The new global + system variable is read-only and can be set using a `SET + PERSIST_ONLY` statement. As a system variable, its + value can also be queried from a MySQL client and used by MySQL + APIs. The [`--skip-slave-start`](/doc/refman/8.0/en/replication-options-replica.html#option_mysqld_skip-slave-start) + command line parameter can still be used as an alternative, and + it sets the new global system variable. + (WL #14450) + +### Bugs Fixed + +* **Important Note:** + When a `utf8mb3` collation was specified in a + `CREATE TABLE` statement, `SHOW CREATE + TABLE`, `DEFAULT CHARSET`, the values + of system variables containing character set names, and the + binary log all subsequently displayed the character set as + `utf8` which is becoming a synonym for + `utf8mb4`. Now in such cases, + `utf8mb3` is shown instead, and `CREATE + TABLE` raises the warning + '*`collation_name`*' is a + collation of the deprecated character set UTF8MB3. Please + consider using UTF8MB4 with an appropriate collation + instead. + (Bug #27225287, Bug #32085357, Bug #32122844) + + References: See also: Bug #30624990. +* **InnoDB:** + Stale pages encountered by the + `buf_page_create()` function were freed and + then read from disk again without being reinitialized. + (Bug #32622548) +* **InnoDB:** + C++ `enum` type values in buffer pool page and + buffer pool block data structures in the + `InnoDB` source code were changed from + `int` to `uint8_t` in MySQL + 8.0.23, causing the data to be printed as + `ascii` characters instead of integers in + different outputs including messages and + `INFORMATION_SCHEMA` tables. + + The function that populates the + `INNODB_BUFFER_PAGE_LRU` table did not print + the `IO_PIN` state for the + `IO_FIX` field. + (Bug #32575469) +* **InnoDB:** + The `btr_pcur_t::copy_stored_position` + function, which copies the position of one index tree persistent + cursor to another, performed unnecessary free and malloc calls. + (Bug #32574835) +* **InnoDB:** + A function that checks for locks on a table tried to acquire an + exclusive lock system (`lock_sys`) latch, + causing long semaphore waits. + (Bug #32545030) +* **InnoDB:** + Counting temporary tablespaces as open files caused the + [`innodb_open_files`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_open_files) limit to be + exceeded, preventing other files from being opened. Temporary + tablespaces are now ignored when counting open files. + (Bug #32541241) +* **InnoDB:** + The `buf_flush_ready_for_flush()` function + identified a stale page as ready to flush without first checking + if the page was dirty or I/O fixed, causing an assertion + failure. + (Bug #32530147) +* **InnoDB:** + Rollback of a transaction that modified generated columns raised + an assertion failure. The failure occurred when attempting to + free space occupied by externally stored columns. The update + vector containing the externally stored columns did not account + for the generated columns. + (Bug #32529561) +* **InnoDB:** + When starting the server with + [`innodb_validate_tablespace_paths`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_validate_tablespace_paths) + disabled, user-created undo tablespaces, which are temporarily + set to inactive during the initial stages of the startup + process, were not reactivated. + (Bug #32493885) +* **InnoDB:** + Disabling + [`innodb_extend_and_initialize`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_extend_and_initialize), + which causes `InnoDB` to use + `fallocate()` when allocating space to + tablespace files, caused a performance regression for + insert-oriented workloads. + (Bug #32437020) +* **InnoDB:** + An unnecessary full flush list scan was removed, improving the + speed with which session temporary tablespaces are created. + Previously, depending on the size of the buffer pool and the + number of dirty pages, creation of session temporary tablespaces + could take a long time, affecting write transaction performance. + (Bug #32423860) +* **InnoDB:** + A function that checks if a given page type is valid raised an + assertion when testing valid but undefined page type for an undo + tablespace. + (Bug #32366301) +* **InnoDB:** + Sharded read-write lock function instrumentation was improved. + (Bug #32333168) +* **InnoDB:** + On Windows, when creating a table with the + `COMPRESSION` option, `InnoDB` + failed to check the error status of a system call before + checking the punch hole support flag set by the same system + call, which resulted in reading an uninitialized flag. + (Bug #32322645) +* **InnoDB:** + Geometry columns created in MySQL 5.6 caused failure when + restarting the server after upgrading from MySQL 5.7 to MySQL + 8.0 due to a geometry type change introduced in MySQL 5.7. + (Bug #32299738) +* **InnoDB:** + During recovery, log records for multiple record group mini + transactions were parsed twice. The log record from the first + parsing operation is now saved to avoid the second pass, which + improves recovery performance. + + Thanks to Zhai Weixiang for the contribution. + (Bug #32293797, Bug #102010) +* **InnoDB:** + In debug builds, an end range condition check for a secondary + index raised an assertion failure, and Valgrind testing + uncovered an end range condition check for secondary index on a + virtual column that read an uninitialized value. + (Bug #32291506) +* **InnoDB:** + With the + [`innodb_log_writer_threads`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_log_writer_threads) + variable disabled, extensive log writing by one thread could + block log flushing opportunities for other threads. + (Bug #32255538) +* **InnoDB:** + In `SHOW ENGINE INNODB STATUS` deadlock + information, in cases where a single `rw-lock` + reader thread holds a shared latch, the reader thread id was not + printed. + (Bug #32252477) +* **InnoDB:** + Running concurrent [`SHOW CREATE + TABLE`](/doc/refman/8.0/en/show-create-table.html) and [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) + operations on the same table raised an assertion failure. The + [`SHOW CREATE TABLE`](/doc/refman/8.0/en/show-create-table.html) thread + referenced a tablespace object that had been made stale by the + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) operation. + (Bug #32235621) +* **InnoDB:** + The introduction of sharded `rw_lock_stats` + counters in MySQL 5.7 caused a regression in CPU cache + efficiency. To address this issue in MySQL 5.7, the sharding + method was changed. For optimal performance, the + `rw_lock_stats` counter is removed in MySQL + 8.0. + (Bug #32225367) +* **InnoDB:** + On Windows, stalls were caused by concurrent `SELECT + COUNT(*)` queries where the number of parallel read + threads exceeded the number of machine cores. + (Bug #32224707, Bug #101789) +* **InnoDB:** + An `IS_STALE` column, which indicates whether a + buffer pool page is stale, was added to the + [`INFORMATION_SCHEMA.INNODB_BUFFER_PAGE`](/doc/refman/8.0/en/information-schema-innodb-buffer-page-table.html) + table. + (Bug #32194434) +* **InnoDB:** + In debug builds, the `log_free_check()` + function in the redo log code, which ensures that there is + available space in the logs when holding latches on dirty pages, + now uses a list of mini-transactions opened by the current + thread to search for potential constraint violations. + (Bug #32189367) +* **InnoDB:** + During a slow shutdown on a system with a 64k + `InnoDB` page size and + [`innodb_max_undo_log_size`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_max_undo_log_size) + setting that was less than the initial undo tablespace size, the + two undo tablespaces were truncated in an endless loop. Undo + tablespace truncation is now restricted to undo tablespaces that + are larger than the initial undo tablespace size and the + [`innodb_max_undo_log_size`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_max_undo_log_size) + setting. + + The function that retrieves the next redo rollback segment for + an undo tablespace was modified to ensure that undo logs are + evenly split between two active undo tablespaces when an + inactive tablespace is found. + (Bug #32173457) +* **InnoDB:** + Starting the server in upgrade mode following an unexpected + stoppage while the `undo_001` undo tablespace + was being truncated caused failure. When upgrade processing was + completed and shutdown initiated, the function that determines + if undo truncation is required could not find the + `undo_001` undo tablespace. To address this + issue, undo tablespace truncation is no longer performed when + starting the server in upgrade mode. + (Bug #32127912) +* **InnoDB:** + A delete operation on a parent table that initiated a cascading + update on a child table with an indexed virtual column and + indexed foreign key constraint column caused a virtual column + corruption. + (Bug #32124113) +* **InnoDB:** + The open and close sequence for table share instances + (`m_share` objects) and dictionary table + instances was modified to prevent accessing old + `m_share` objects that could point to stale + dictionary indexes. + + Thanks to Yuxiang Jiang for the contribution. + (Bug #31899685) +* **InnoDB:** + An debug assertion failure occurred when issuing a + [`TRUNCATE TABLE`](/doc/refman/8.0/en/truncate-table.html) operation after a + successful server restart following a server initialization + failure. + (Bug #31763837) +* **InnoDB:** + A fast shutdown + ([`innodb_fast_shutdown=0`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_fast_shutdown)) raised + an assertion failure. The assertion code checks for transactions + in the transaction list (`mysql_trx_list`) + before halting purge operations. The check occurred before + shutting down the GTID persister background thread, which was + still inserting transactions into the transaction list. + (Bug #31693627) +* **InnoDB:** + Undo tablespace truncation error handling was improved, and a + Windows-specific `InnoDB` file deletion + procedure was made more POSIX-compatible. + (Bug #31684783) +* **InnoDB:** + An online [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) operation + failed with an Incorrect key file for + table error due to an unnecessary encryption status + check that was performed when reading online DDL row logs. + (Bug #31529221, Bug #99938) +* **InnoDB:** + Initializing the server with an with a 4K + `InnoDB` page size caused “key too + long” errors to be written to the error log. + (Bug #31496943, Bug #99892) +* **InnoDB:** + A table created with a reserved name caused a failure. + (Bug #31382599) +* **InnoDB:** + Creating an index on virtual columns raised an invalid debug + assertion failure. + (Bug #31279528, Bug #99421, Bug #27168185) +* **InnoDB:** + In debug mode, the + `buf_pool_validate_instance()` function + accessed the `buf_page_t::io_fix` field without + properly synchronizing with a thread that was modifying the same + field in the `buf_page_io_complete()` function, + causing an assertion failure. In addition to correcting that + issue, the `buf_page_get_io_fix_unlocked()` + function was replaced by several specific functions that test + the `buf_page_t::io_fix` field for particular + values. A series of other small, related code changes were also + implemented. + (Bug #31027553) +* **InnoDB:** + The TempTable memory allocator did not track RAM consumption + when allocating blocks of memory shared by different queries for + a given session, which could result in nonadherence to the + [`temptable_max_ram`](/doc/refman/8.0/en/server-system-variables.html#sysvar_temptable_max_ram) limit. + (Bug #29890126) +* **Partitioning:** + In some cases, invalid `PARTITION` clauses were + not handled correctly in [`ALTER + TABLE`](/doc/refman/8.0/en/alter-table.html) statements. + (Bug #32235085) +* **Replication:** + With row-based replication in use + (`binlog_format=ROW`), stored generated columns + that existed only on the replica were not being updated when the + other fields in the row were inserted or updated. These columns + are now evaluated when the row image is unpacked, and their + value is updated in the row image before it is applied. + (Bug #32292413, Bug #101978) +* **Replication:** + Binary log transaction compression could not continue if a row + event included a `BLOB` column containing + uncompressable data, and the compressed size of the row event + was higher than its uncompressed size. The function now handles + the additional post-compression bytes correctly. + (Bug #32174715, Bug #101611) +* **Replication:** + If all previous binary log files were purged at startup because + their retention period had expired, the new binary log file + contained an empty `Previous_gtids` event, + which could cause errors in replication. The order of + initialization has now been changed so that previous binary log + files are only purged after the previous GTID set has been + written to the new binary log file that is created at startup. + (Bug #32134875, Bug #101533) +* **Replication:** + When MySQL Server counted the number of GTIDs in a set, it was + possible for the return value to wrap, returning an incorrect + result. This could lead to an incorrect decision to use state + transfer from the binary log for Group Replication distributed + recovery, when a remote cloning operation would have been more + efficient. The logic has now been corrected. + (Bug #32086209) +* **Replication:** + An assertion was raised in debug builds relating to lost GTIDs + if binary log files were removed at startup because their + retention period had expired. + (Bug #32008512, Bug #101137) +* **Replication:** + The [`sql_slave_skip_counter`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_sql_slave_skip_counter) + system variable, which is used to make a replica skip a + specified number of transactions, ignored transaction payloads + that had been compressed using binary log transaction + compression (activated using the + [`binlog_transaction_compression`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_transaction_compression) + system variable). Only events in uncompressed transaction + payloads were counted towards the total skipped. + (Bug #31973055) +* **Replication:** + A deadlock could occur if the binary log file was rotated while + system variables were being updated and read by different + clients. + (Bug #31774422) +* **Replication:** + The output of a `SHOW PROCESSLIST` statement + for a replica’s SQL thread sometimes showed the last query as + currently being applied when the replica was actually caught up. + (Bug #30521198, Bug #97560) +* **Group Replication:** + A race condition could occur if a `STOP + GROUP_REPLICATION` statement was used to stop a group + member, while the Performance Schema statistics for Group + Replication were being queried by another client. Group + Replication now prevents `STOP + GROUP_REPLICATION` statements and Performance Schema + queries from running concurrently. + (Bug #32100147) +* **Microsoft Windows:** + Running MySQL Server (64-bit) on a Windows system with more than + 32 logical processors and setting the VCPU attribute of a + resource group to greater than 30 produced an incorrect CPU mask + value, which is used to set the thread affinity. Under these + conditions, the MSVC compiler reported warnings that the 32-bit + shift was converted implicitly to 64-bit in the + `thread_attrs_api_win.cc` file. The + conversion resulted in the wrong CPU mask calculation on systems + that have more than 32 logical processors. This fix ensures that + a 64-bit shift is used when calculating the CPU mask by + replacing argument `1` of the shift with + `1LL`. + (Bug #32079726) +* **JSON:** + The [`IF()`](/doc/refman/8.0/en/flow-control-functions.html#function_if) function sometimes hit + an assertion in debug builds when an error was raised from its + first argument; this also could occur under similar + circumstances with the additional condition that the function's + return type was [`JSON`](/doc/refman/8.0/en/json.html). + (Bug #32231393, Bug #32231620) +* **JSON:** + A number of JSON functions did not propagate errors correctly, + which could lead to assert failures in debug builds. + (Bug #32047630) +* **JSON:** + [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table) inside triggers was + sometimes handled incorrectly when re-used in different + sessions. Fixed by ensuring that `JSON_TABLE()` + and its temporary table are processed in the context of the + current session. + (Bug #31644193) +* **JSON:** + A multi-valued index defined on an expression that cast a column + into a typed array was not used for speeding up queries. This + was because the server, when substituting an expression with an + equivalent indexed generated column, did not attempt to replace + a reference to a column with a reference to an equivalent + generated column; for multi-valued indexes, it makes sense to + replace the column reference with a reference to a generated + column backing a multi-valued index on an expression that cast + that column into a typed array. + + This fix lifts the restriction that the server attempts to + substitute only function expressions and conditional expressions + with indexed generated columns, by allowing substitution of + column references when they appear in a context where they can + make use of a multi-valued index, that is, when they are used as + arguments to [`MEMBER OF()`](/doc/refman/8.0/en/json-search-functions.html#operator_member-of), + [`JSON_CONTAINS()`](/doc/refman/8.0/en/json-search-functions.html#function_json-contains), or + [`JSON_OVERLAPS()`](/doc/refman/8.0/en/json-search-functions.html#function_json-overlaps). The restriction + remains in force for cases in which the column reference is used + in a non-array context. + (Bug #30838807) +* **JSON:** + The [`JSON_SEARCH()`](/doc/refman/8.0/en/json-search-functions.html#function_json-search) function + interpreted all search string and path values as + `utf8mb4` strings, regardless of their actual + encoding, which could lead to wrong results. + (Bug #102443, Bug #32443143) +* **JSON:** + In some cases, when used in a left join, some MySQL JSON + functions caused the optimizer to transform it into an inner + join, even though the inner join was not equivalent to the + original left join. This was due to the fact that they return a + value which is not `NULL`, even though one of + their arguments is `NULL`, and the optimizer + expected them to return `NULL` on + `NULL` input. + + Functions affected by this issue included + `JSON_ARRAY()`, + `JSON_OBJECT()`, + `JSON_ARRAY_APPEND()`, + `JSON_ARRAY_INSERT()`, + `JSON_INSERT()`, + `JSON_REPLACE()`, and + `JSON_SET()`. See + [JSON Functions](/doc/refman/8.0/en/json-functions.html), for more information about + these functions. + (Bug #101861, Bug #32248705) +* Community packages for generic Linux were not built with the + necessary LDAP/SASL/Kerberos dependencies, and did not bundle + the associated required libraries. + (Bug #32619858) +* The functions [`BIT_AND()`](/doc/refman/8.0/en/aggregate-functions.html#function_bit-and), + [`BIT_OR()`](/doc/refman/8.0/en/aggregate-functions.html#function_bit-or), + [`BIT_XOR()`](/doc/refman/8.0/en/aggregate-functions.html#function_bit-xor), and + [`JSON_ARRAYAGG()`](/doc/refman/8.0/en/aggregate-functions.html#function_json-arrayagg) did not always + provide proper error handling. + (Bug #32594813) +* The server did not always provide proper error messages when + [`IN`](/doc/refman/8.0/en/comparison-operators.html#operator_in) was incorrectly used with + [`UNION`](/doc/refman/8.0/en/union.html). + (Bug #32593846) +* It was possible for casting from + [`DECIMAL`](/doc/refman/8.0/en/fixed-point-types.html) to a signed integer type + to hit an assertion when the result had more digits than the + metadata in `Item_typecast_signed` indicated it + would have. This happened because the decimal value is rounded + when converted to an integer, and + `Item_typecast_signed` did not take into + account that the rounding might increase the number of digits in + what was the integer part of the decimal value, such as when + rounding 9.9 up to 10. + + This is fixed by removing the logic that tried to compute a + minimal maximum length for the result of the cast, and instead + using the default set by the parent class + `Item_int_func`. That default is the maximum + width of a 64-bit integer, which should be safe regardless of + the input value. + (Bug #32591589) + + References: This issue is a regression of: Bug #32371039. +* The name `my_row_id` was not permitted for + invisible columns. This restriction has been lifted. + (Bug #32586231) +* On a system with many concurrent connections, execution of grant + statements could take excessively long waiting for metadata + locks, causing the server to become unresponsive. + (Bug #32483597) +* Windows binaries and libraries were not being properly signed. + (Bug #32458533) +* Privilege checks for `INFORMATION_SCHEMA` + tables could fail to take the + [`lower_case_table_names`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names) value + into account. + (Bug #32448364) +* `LIKE ... ESCAPE`, where + `ESCAPE` did not reference a constant value, + was not handled correctly within a prepared statement. + (Bug #32446728) +* MySQL has traditionally interpreted an empty value in the + `ESCAPE` clause (that is, `ESCAPE + ''`) for `LIKE` as “no escape + character”. Problems could arise when either of the first + two arguments to `LIKE` was a string using a + multibyte character set, because the empty value in such cases + was interpreted as meaning that the backslash + (`\`) should be used as the escape character, + breaking the expected behavior. + + This fix causes `LIKE` to interpret + `ESCAPE ''` as meaning that there is no escape + character regardless of character set, restoring the previous, + expected behavior. + + In addition, we now raise an error if the specified escape + character cannot be converted to the target character set. This + supersedes the original behavior in such cases, which was to + fall back silently to using the backslash as the escape + character. + (Bug #32446508) +* Windows packages were subject to an OpenSSL vulnerability. + (Bug #32431519) +* Loadable function arguments containing window functions or + subqueries could produce unexpected results. + (Bug #32424455) +* Improper handling of temporary tables used for cursors within + stored procedures could result in unexpected server behavior. + (Bug #32416811) +* Use of the symbol `TRUE` in the source resulted + in a build failure on some platforms. This was replaced by + `true`. + (Bug #32406197, Bug #102308) +* The privilege check used to determine whether users can see view + definitions in the + [`INFORMATION_SCHEMA.VIEWS`](/doc/refman/8.0/en/information-schema-views-table.html) table + worked incorrectly. + (Bug #32405811) +* For recursive common table expressions, an assertion could be + raised if it became necessary to convert an in-memory temporary + table to on-disk. + (Bug #32404597) +* A prepared statement employing a user-created function was not + handled correctly when the function took no arguments. + (Bug #32404542) +* A clone plugin installation failure could cause subsequent + installation attempts to fail. + (Bug #32402158, Bug #102240) +* Some internal functions used with temporal column types did not + provide proper handling for [`YEAR`](/doc/refman/8.0/en/year.html) + values. + (Bug #32395335) +* The internal constants `MAX_FLOAT_STR_LENGTH` = + 12 and `MAX_DOUBLE_STR_LENGTH` = 22 represent + the maximum lengths of strings representing + [`FLOAT`](/doc/refman/8.0/en/floating-point-types.html) and + [`DOUBLE`](/doc/refman/8.0/en/floating-point-types.html) values, respectively. The + heuristic employed by the conversion routine + `my_gcvt` for determining whether to use + scientific notation sometimes generated strings that were longer + than these. + + These long strings caused problems for some string conversion + routines, since their actual lengths could exceed the expected + maximums. We fix this by explicitly telling + `my_gcvt` the desired length whenever we fetch + a `FLOAT` or `DOUBLE` in a + string context. + (Bug #32385934) +* Within triggers, use of [`RAND()`](/doc/refman/8.0/en/mathematical-functions.html#function_rand) + with no arguments could lead to unexpected server behavior. + (Bug #32372805) +* When an `Item_cache` object was used in a + prepared statement or stored procedure, it might point to a + `Field` object that was used in a previous + execution. We solve this issue by replacing the cached field + member with an `Item_field`, which is + persistent for the lifetime of the procedure. + (Bug #32367019) +* A missing tablespace error was reported on the recipient MySQL + server instance after a remote cloning operation. The tablespace + was not cloned due to the + [`innodb_validate_tablespace_paths`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_validate_tablespace_paths) + variable being disabled on the donor instance, which resulted in + the associated tablespace object not being loaded. A check is + now performed before a cloning operation to ensure that all + tablespace objects are loaded. + (Bug #32354908, Bug #102137) +* Some query blocks containing large numbers of + `EXISTS` subqueries were not always handled + correctly. + (Bug #32343143) +* **mysqlpump** could exit unexpectedly if a + [`SHOW CREATE TABLE`](/doc/refman/8.0/en/show-create-table.html) statement + failed. + (Bug #32340208) +* A long running remote cloning operation failed due to a low + [`wait_timeout`](/doc/refman/8.0/en/server-system-variables.html#sysvar_wait_timeout) setting on the + donor MySQL Server instance. Donor threads use the MySQL Server + [`wait_timeout`](/doc/refman/8.0/en/server-system-variables.html#sysvar_wait_timeout) setting when + listening for Clone protocol commands. To avoid timeout failures + on donor instances with a low + [`wait_timeout`](/doc/refman/8.0/en/server-system-variables.html#sysvar_wait_timeout) setting, the Clone + idle timeout is now set to the default + [`wait_timeout`](/doc/refman/8.0/en/server-system-variables.html#sysvar_wait_timeout) setting, which is + 28800 seconds (8 hours). Clone network read and write timeout + values were also increased. + (Bug #32340112, Bug #102097) +* Replication threads running in the server were visible in the + Performance Schema [`threads`](/doc/refman/8.0/en/performance-schema-threads-table.html) table, + but failed to appear in the + [`variables_by_thread`](/doc/refman/8.0/en/performance-schema-system-variable-tables.html) or + [`status_by_thread`](/doc/refman/8.0/en/performance-schema-status-variable-tables.html) tables. Now they + appear in all three tables. Thanks to Facebook for the + contribution. + (Bug #32335496, Bug #102115) +* A query string was displayed before it had been rewritten. + (Bug #32335263, Bug #32628376) +* For builds compiled using the `libedit` + library, if the `mysql` client was invoked with + the `--default-character-set=utf8` + option, libedit rejected input of multibyte characters. + (Bug #32329078, Bug #32583436, Bug #102806) +* On Windows, large result sets could cause the + **mysql** client to exit unexpectedly. + (Bug #32316323, Bug #102051) +* Preparing a query expression for repeated execution could raise + an assertion if an error occurred during preparation. + (Bug #32291841) +* Functional index creation did not handle the column name as not + case-sensitive. + (Bug #32287186, Bug #101994) +* Temporary tables bound to triggers during statement execution + could cause an unexpected server exit. + (Bug #32267749, Bug #32288089, Bug #32299045) +* Improved `NULL` and error handling in + calculations involving decimal values. + (Bug #32258228, Bug #32497850) +* An assertion was raised if there was an open handler to a table + in a schema when the schema was altered to be read only. + (Bug #32248313) +* Selecting from the Performance Schema + [`replication_group_members`](/doc/refman/8.0/en/performance-schema-replication-group-members-table.html) table in + some cases raised Error 1267 Illegal mix of + collations .... This was due to a change in MySQL + 8.0.22 in the handling of comparisons between a column value and + a system variable. + (Bug #32244631) + + References: See also: Bug #32501472, Bug #32579184. +* MySQL produced invalid metadata for a number of temporal + functions returning integer values. These functions included + [`TO_DAYS()`](/doc/refman/8.0/en/date-and-time-functions.html#function_to-days), + [`PERIOD_DIFF()`](/doc/refman/8.0/en/date-and-time-functions.html#function_period-diff), + [`PERIOD_ADD()`](/doc/refman/8.0/en/date-and-time-functions.html#function_period-add), + [`TO_SECONDS()`](/doc/refman/8.0/en/date-and-time-functions.html#function_to-seconds), + [`DAYOFMONTH()`](/doc/refman/8.0/en/date-and-time-functions.html#function_dayofmonth), + [`DAYOFYEAR()`](/doc/refman/8.0/en/date-and-time-functions.html#function_dayofyear), + [`HOUR()`](/doc/refman/8.0/en/date-and-time-functions.html#function_hour), and + [`MINUTE()`](/doc/refman/8.0/en/date-and-time-functions.html#function_minute), among others. + (Bug #32239578) +* Table subqueries of a natural join which retrieved only + invisible columns were not handled correctly. + (Bug #32235285) +* For debug builds, using [`ALTER + TABLE`](/doc/refman/8.0/en/alter-table.html) to set a column to have a + `DEFAULT` value of `TRUE` + raised an assertion. + (Bug #32235058) +* When an error was raised while evaluating a condition that was + pushed down to the storage engine using index condition + pushdown, the storage engine sometimes ignored the error and + returned an error code indicating success, which could lead to + assertion failures later. + + Now in such cases, we make sure that the executor detects that + an error has been raised, and stop execution at that point. + (Bug #32234773) +* For debug builds with binary logging disabled, `ALTER + TABLE ... MODIFY COLUMN` with an invalid + `DEFAULT` value raised an assertion. + (Bug #32234194) +* Preparation of an aggregate function sometimes hit an assertion + in debug builds when the function took a constant scalar + subquery as argument and the scalar subquery raised an error. + (Bug #32231698) +* For debug builds, improper character set handling for + [`NULLIF()`](/doc/refman/8.0/en/flow-control-functions.html#function_nullif) evaluated in aggregate + context raised an assertion. + (Bug #32231557) +* A [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) statement with an + unsupported `KEY_BLOCK_SIZE` value raised an + assertion. + (Bug #32227101) +* Upgrading a MySQL instance with a very large number of tables + consumed an excessive amount of memory. Memory allocated to + analyze data dictionary entities for possible upgrade was not + released until all entities were processed. + (Bug #32226180, Bug #101818) +* [`ANALYZE TABLE`](/doc/refman/8.0/en/analyze-table.html) executed on a table + concurrently with a long-running query on the same table caused + subsequent queries on the table to wait for the long-running + query to finish. This wait induced by + [`ANALYZE TABLE`](/doc/refman/8.0/en/analyze-table.html) is now eliminated, + thus allowing the subsequent queries to execute with no wait. + (Bug #32224917) +* Statements using a [`LIKE`](/doc/refman/8.0/en/string-comparison-functions.html#operator_like) expression + with an `ESCAPE` clause were not always handled + correctly. + (Bug #32213959) +* On ARM platforms, an assertion could be raised in utilities used + during the build process. + (Bug #32209415) +* [`InnoDB`](/doc/refman/8.0/en/innodb-storage-engine.html) did not always handle some + legal names for table partitions correctly. + (Bug #32208630) +* With the + [`explicit_defaults_for_timestamp`](/doc/refman/8.0/en/server-system-variables.html#sysvar_explicit_defaults_for_timestamp) + variable disabled, Clone plugin installation failed with PFS + table creation error. The variable setting caused + `TIMESTAMP` columns in the Clone Performance + Schema tables to be created incorrectly as `NOT + NULL` columns. + (Bug #32199611) +* [`SHOW CREATE VIEW`](/doc/refman/8.0/en/show-create-view.html) produced invalid + syntax for views created with a `ROLLUP` + clause. This issue also affected **mysqldump**, + which uses [`SHOW CREATE VIEW`](/doc/refman/8.0/en/show-create-view.html). + (Bug #32197353, Bug #101740) +* A failed [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) or + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) with + `SECONDARY_ENGINE_ATTRIBUTE` could leak memory. + (Bug #32187507) +* Connection establishment failure could cause the server to count + the number of open connections incorrectly. + (Bug #32156518) +* Refactoring work done in MySQL 8.0.19 did not handle left joins + correctly on columns using functions such as + [`IFNULL()`](/doc/refman/8.0/en/flow-control-functions.html#function_ifnull). + (Bug #32141711) + + References: This issue is a regression of: Bug #30320525. +* The optimizer could choose to use a Skip Scan even for backward + index scans for which it is inapplicable, resulting in + unpredictable server behavior. + (Bug #32127290) +* [`SHOW CREATE USER`](/doc/refman/8.0/en/show-create-user.html) caused any + pending transaction to commit. + (Bug #32123671) +* Loadable function arguments containing window functions were + evaluated at prepare time despite the fact that window functions + are set up quite late in the prepare process. Now evaluation of + these is delayed until execution time, similarly to how this is + performed with respect to loadable function arguments containing + subqueries. + (Bug #32122078, Bug #32393265) +* Creating a table containing a column with a nonconstant default + expression caused subsequent [`ALTER + TABLE`](/doc/refman/8.0/en/alter-table.html) statements to fail. + (Bug #32121425, Bug #101486) +* Updating a `BLOB`-like column with a value from + a larger `BLOB`-like column could cause the + updated column to have the wrong size, even zero. + (Bug #32112403) +* Improper locking on an internal queue could cause + **mysqlpump** to exit unexpectedly. + (Bug #32067013) +* On MacOS, the preference pane now includes an option to load the + configured `my.cnf` file during + initialization. + (Bug #32057159) +* The server did not always prepare correctly a statement using + [`GROUP_CONCAT()`](/doc/refman/8.0/en/aggregate-functions.html#function_group-concat) on a + [`SELECT`](/doc/refman/8.0/en/select.html) with an `ORDER + BY` clause. + (Bug #32053547, Bug #31947466) +* The `sys` schema + [`create_synonym_db()`](/doc/refman/8.0/en/sys-create-synonym-db.html) procedure fail + to create `INFORMATION_SCHEMA` synonyms. + (Bug #32050275, Bug #101258) +* Errors occurring in window functions were not always correctly + propagated, which could lead to assertion failures in debug + builds. + (Bug #32028154) +* Calling [`XA COMMIT`](/doc/refman/8.0/en/xa.html) + on a transaction started by another thread could result in + Address Sanitizer warnings. + (Bug #32025408) +* When the **mysql** client was used in batch mode, + its parser could be confused by + [`USE`](/doc/refman/8.0/en/use.html) followed by + [`DROP DATABASE`](/doc/refman/8.0/en/drop-database.html) when the + `USE` database name was quoted. + (Bug #32015466, Bug #101124) +* A change in MySQL 8.0.17 caused **comp\_err** to + become much slower. Normal performance has been restored. + (Bug #32014733) + + References: This issue is a regression of: Bug #29781631, Bug #95377. +* Using [`CAST()`](/doc/refman/8.0/en/cast-functions.html#function_cast) on a + [`DATE`](/doc/refman/8.0/en/datetime.html) or + [`DATETIME`](/doc/refman/8.0/en/datetime.html) value in an + [`INSERT`](/doc/refman/8.0/en/insert.html) statement raised a warning + for `"0000-00-00"` and + `"2000-02-31"`, but not for + `"2000-01-00"` or + `"2000-00-01"`. Now a warning is shown in each + of these cases also. + (Bug #32013612) +* The maximum length of the + `MASTER_COMPRESSION_ALGORITHMS` value for the + `CHANGE MASTER TO` statement was checked + incorrectly. + (Bug #32008597) +* When casting a dynamic parameter to + [`YEAR`](/doc/refman/8.0/en/year.html) (such as in + [`PREPARE`](/doc/refman/8.0/en/prepare.html) `s FROM + "`[`SELECT`](/doc/refman/8.0/en/select.html)[`CAST(`](/doc/refman/8.0/en/cast-functions.html#function_cast)`? AS + YEAR)"`), type propagation was not preformed, causing + execution of the prepared statement in which the parameter was + used to fail. + (Bug #32002844) +* Definitions of some system tables for a MySQL 5.7 instance + upgraded to MySQL 8.0 differed from the definitions of the + system tables in a new MySQL 8.0 installation. + (Bug #31989290) +* Some `SHOW` statements using subqueries could + result in unexpected server behavior. + (Bug #31853180) +* A query using `GROUP BY + column HAVING + column_expression IS [NOT] + NULL` returned correct results, but when + *`WITH ROLLUP`* was added did not. + (Bug #31848191) +* The `SHOW ENGINE PERFORMANCE SCHEMA STATUS` + statement reported incorrect memory usage for the Performance + Schema. + (Bug #31795132, Bug #100624) +* When trying to generate an entity data model using Visual Studio + 2019, some tables could not be imported with the entity + framework wizard. This was due to a change in MySQL 8.0.21 made + to orthogonal data type aggregation, which handles columns from + [`UNION`](/doc/refman/8.0/en/union.html) and from functions or + operators such as [`CASE`](/doc/refman/8.0/en/flow-control-functions.html#operator_case) and + [`IF()`](/doc/refman/8.0/en/flow-control-functions.html#function_if). This makes it possible to + return a value of type [`ENUM`](/doc/refman/8.0/en/enum.html) or + [`SET`](/doc/refman/8.0/en/set.html), which did not need to be + handled previously in such cases. + (Bug #31750645) + + References: See also: Bug #29698617. +* While optimizing the `ORDER BY` clause of a + subquery there was a possibility of cleaning up a subquery tree + referenced in the outer [`SELECT`](/doc/refman/8.0/en/select.html), + which could lead to a premature exit. + (Bug #31721430) +* A malformed name in the `mysql.func` system + table could cause unexpected server behavior. + (Bug #31674599) +* [`LOAD DATA`](/doc/refman/8.0/en/load-data.html) performance degraded if + many long rows were loaded. + (Bug #31637142) +* Sessions could disable their own auditing. + (Bug #31630954) +* Compiler options for using profile guided optimization with GCC + were improved to include + `-fprofile-partial-training` and + `-fprofile-update=prefer-atomic` when + appropriate. Thanks to Dmitriy Philimonov for the suggestion. + (Bug #31450064, Bug #99781) +* Starting the server with the + [`performance_schema_max_thread_classes`](/doc/refman/8.0/en/performance-schema-system-variables.html#sysvar_performance_schema_max_thread_classes) + and + [`performance_schema_max_thread_instances`](/doc/refman/8.0/en/performance-schema-system-variables.html#sysvar_performance_schema_max_thread_instances) + system variables set to zero caused MySQL Enterprise Firewall to be unable to + create new rules. + (Bug #31335080, Bug #24947654, Bug #83519) +* A null pointer was incremented during recovery from the redo + log, causing a runtime error in an Undefined Behavior Sanitizer + (UBSAN) build. + (Bug #31173032, Bug #32428131, Bug #32483976) +* With the [`log_slow_extra`](/doc/refman/8.0/en/server-system-variables.html#sysvar_log_slow_extra) system + variable enabled to add the `Errno` field to + slow query log output, the error number was 0 even for failed + statements. + (Bug #30769965, Bug #98220) +* On debug builds, certain conversion operations using the + `utf32` character set could cause unexpected + server behavior. + (Bug #30746908) +* `SELECT ... FOR UPDATE` from a nonexistent + Performance Schema table produced + [`ER_TABLEACCESS_DENIED_ERROR`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_tableaccess_denied_error) + rather than [`ER_NO_SUCH_TABLE`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_no_such_table). + (Bug #30701047, Bug #98068) +* Mishandling of stored program local variables could lead to + unexpected server behavior. + (Bug #30366310) +* The Performance Schema + [`metadata_locks`](/doc/refman/8.0/en/performance-schema-metadata-locks-table.html) table could show + incorrect `DURATION` values, such as when a + metadata lock taken for a `TRANSACTION` + duration was later modified to `EXPLICIT` + duration by a [`RENAME TABLE`](/doc/refman/8.0/en/rename-table.html) + operation. + (Bug #30065213, Bug #96237) +* The `audit_log` plugin could fail to store its + encryption password if it generated one at startup. + (Bug #29559793) +* Uninstalling a plugin could affect subsequent execution of + prepared statements. + (Bug #29363867) +* Conversion of string-valued user-defined variables or function + results to double (for example, using + [`CAST()`](/doc/refman/8.0/en/cast-functions.html#function_cast)) did not emit a warning + when truncation occurred. + (Bug #27969934, Bug #21943299) +* When a view definition used [`LIKE`](/doc/refman/8.0/en/string-comparison-functions.html#operator_like) + with an `ESCAPE` clause, the contents of the + `ESCAPE` clause were ignored, leading to wrong + results. + (Bug #26086751) +* It was possible to insert illegal ASCII values (outside 7-bit + range) into character columns that used the + `ascii` character set. This is now prohibited. + (Bug #24847620) +* To enable use of spaces and other special characters within + configuration values, **mysql\_config\_editor** now + surrounds values it writes to the configuration file with double + quote characters, and also escapes double quote characters used + within values. + (Bug #19953349, Bug #74691) +* When the aggregate iterator finds no rows, it calls on each item + in its [`SELECT`](/doc/refman/8.0/en/select.html) list to inform them + of this (for example, so that + [`COUNT(*)`](/doc/refman/8.0/en/aggregate-functions.html#function_count) can set itself to zero, + or [`SUM(foo)`](/doc/refman/8.0/en/aggregate-functions.html#function_sum) can set itself to + `NULL`). After internal work done in MySQL + 8.0.22, it could also inadvertently call hidden items. In some + queries with doubly nested subqueries, one such hidden item + could become its own parent subquery (and scalar subqueries in + MySQL have special legacy handling of this call, for queries + which are not `ONLY_FULL_GROUP_BY`), causing + the entire subquery to return `NULL` when it + should not have done so. + + This is fixed by making the call only on visible items, as in + MySQL 8.0.21 and earlier. + (Bug #102101, Bug #32335256) +* When interpreting the old-style plan to access paths, cache + invalidators for `LATERAL` were delayed until + all outer joins were completed, since outer joins could produce + null-complemented rows that should also invalidate caches. + Problems arose when an outer join contained a + `LATERAL`, and that `LATERAL` + referred only to tables from within the same outer join; in such + cases the invalidator should be applied immediately and not + delayed, lest we miss emitted rows, and the cache be incorrectly + kept. In particular, this could happen when certain Information + Schema tables were on the right side of an outer join, as these + are now views defined using `LATERAL`. + + We fix this by delaying emission of the invalidator until we are + inside the same (outer) join nest as the materialization to be + invalidated, but no further. This also deals correctly with the + case where rows from a table should invalidate two or more + separate materializations, where some are within the join and + some are higher up. + (Bug #101460, Bug #32113029, Bug #32311147) + + References: This issue is a regression of: Bug #98238, Bug #30766181. +* An optimizer trace printed floating-point numbers with a maximum + six characters, which meant that the precision could be very low + for many values, given that sign, decimal point, and exponent + could use many of these characters. This was especially + problematic for large numbers, whose precision could thus be as + small as 1, and which could be rounded to values whose absolute + value exceeded `DBL_MAX` and so could be + rejected by JSON parsers. + + Now such numbers are always printed in an optimizer trace with a + precision of 6. + (Bug #101457, Bug #32113020) + + References: See also: Bug #94672, Bug #29493604. +* Filesort was used for a query having an `ORDER BY ... + DESC` clause, even when an index on the descending + column was available and used. This happened because an + `ORDER BY` sub-clause was not removed due to + matching a field in an equality predicate, even though it should + have, so that the optimizer did not match the query with the + descending index, leading to suboptimal performance. + (Bug #101220, Bug #32038406) +* The debug server hit an assert when + [`optimizer_search_depth`](/doc/refman/8.0/en/server-system-variables.html#sysvar_optimizer_search_depth) was less + than the number of `JOIN_TAB` structures used + for a join. + (Bug #100288, Bug #31655483) +* Following the [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) + operations `EXCHANGE PARTITION`, + `IMPORT TABLESPACE`, and `IMPORT + PARTITION TABLESPACE`, serialized digital information + reflecting the previous role of the tablespace was left behind. + Now in such cases, the old SDI is explicitly removed from both + tablespaces involved in the exchange or import of a tablespace. + (Bug #98501, Bug #30878065) +* Type resolution performed by the integer division operator + ([`DIV`](/doc/refman/8.0/en/arithmetic-functions.html#operator_div)) yielded a precision of one + less than expected in the result. + + Our thanks to Kaiwang Chen for the contribution. + (Bug #96459, Bug #30156563) diff --git a/corpus/changelog/mysql_releases/mysql_8025.md b/corpus/changelog/mysql_releases/mysql_8025.md new file mode 100644 index 0000000000000000000000000000000000000000..fb27324f95bc6712b1e0cb8d21e21dd261392332 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8025.md @@ -0,0 +1,30 @@ +# MySQL 8.0.25 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-25.html +Version: 8.0.25 + +## Changes in MySQL 8.0.25 (2021-05-11, General Availability) + +* [Packaging Notes](news-8-0-25.html#mysqld-8-0-25-packaging "Packaging Notes") +* [Bugs Fixed](news-8-0-25.html#mysqld-8-0-25-bug "Bugs Fixed") + +### Packaging Notes + +* Binary packages that include `curl` rather than + linking to the system `curl` library have been + upgraded to use `curl` 7.76.0. + +### Bugs Fixed + +* On Fedora 34, builds from source failed due to an undefined + reference to symbol `crc32_z@@ZLIB_1.2.9`. + (Bug #32702860) +* Docker containers for MySQL Enterprise Edition no longer need to + run with root privileges. + (Bug #32472242) +* For a prepared, implicitly grouped + [`SELECT`](/doc/refman/8.0/en/select.html) statement in which the + `WHERE` clause was determined always to be + false, the result of some aggregate functions could sometimes be + picked up from the previous execution of the statement. + (Bug #103192, Bug #32717969) diff --git a/corpus/changelog/mysql_releases/mysql_8026.md b/corpus/changelog/mysql_releases/mysql_8026.md new file mode 100644 index 0000000000000000000000000000000000000000..1ca13bb683224afe798b1308e6762a65f9de43e7 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8026.md @@ -0,0 +1,1929 @@ +# MySQL 8.0.26 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-26.html +Version: 8.0.26 + +## Changes in MySQL 8.0.26 (2021-07-20, General Availability) + +* [Audit Log Notes](news-8-0-26.html#mysqld-8-0-26-audit-log "Audit Log Notes") +* [Authentication Notes](news-8-0-26.html#mysqld-8-0-26-authentication "Authentication Notes") +* [Compilation Notes](news-8-0-26.html#mysqld-8-0-26-compiling "Compilation Notes") +* [Component Notes](news-8-0-26.html#mysqld-8-0-26-components "Component Notes") +* [Deprecation and Removal Notes](news-8-0-26.html#mysqld-8-0-26-deprecation-removal "Deprecation and Removal Notes") +* [Error Handling](news-8-0-26.html#mysqld-8-0-26-errors "Error Handling") +* [Event Scheduler Notes](news-8-0-26.html#mysqld-8-0-26-event-scheduler "Event Scheduler Notes") +* [Firewall Notes](news-8-0-26.html#mysqld-8-0-26-firewall "Firewall Notes") +* [Packaging Notes](news-8-0-26.html#mysqld-8-0-26-packaging "Packaging Notes") +* [Pluggable Authentication](news-8-0-26.html#mysqld-8-0-26-pluggable-auth "Pluggable Authentication") +* [Server Administration](news-8-0-26.html#mysqld-8-0-26-server-admin "Server Administration") +* [Spatial Data Support](news-8-0-26.html#mysqld-8-0-26-spatial-support "Spatial Data Support") +* [X Plugin Notes](news-8-0-26.html#mysqld-8-0-26-xplugin "X Plugin Notes") +* [Functionality Added or Changed](news-8-0-26.html#mysqld-8-0-26-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-26.html#mysqld-8-0-26-bug "Bugs Fixed") + +### Audit Log Notes + +* Previously, each event logged by MySQL Enterprise Audit included the SQL + statement literal text. To provide an alternative (because it is + possible that statements contain sensitive information), the + audit log filtering language now supports logging a statement's + digest rather than its literal text. For example, instead of + logging this statement: + + ```None + SELECT * FROM orders WHERE some_sensitive_column=1234567 + ``` + + The audit log plugin can log this digest: + + ```None + SELECT * FROM `orders` WHERE `some_sensitive_column` = ? + ``` + + This is similar to what is already logged for prepared + statements, for which parameter markers appear rather than + actual data values. + + To perform digest logging, use audit filter definitions that + replace the statement literal text by its corresponding digest, + as discussed in + [Replacement of Event Field Values](/doc/refman/8.0/en/audit-log-filter-definitions.html#audit-log-filtering-field-replacement). + + Because text replacement occurs at an early auditing stage + (during filtering), the choice of whether to log statement + literal text or digest values applies regardless of log format + written later (that is, whether the audit log plugin produces + XML or JSON output). + (Bug #31482609, WL #14267, WL #14724) +* For MySQL Enterprise Audit, the new + [`audit_log_format_unix_timestamp`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_format_unix_timestamp) + system variable enables inclusion of a `time` + field in each audit record. The field value is an integer that + represents the UNIX timestamp value indicating the date and time + when the audit event was generated. The `time` + field is supported only for JSON-format log files. + (WL #14600) +* For MySQL Enterprise Audit, the new + [`audit_log_max_size`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_max_size) system + variable enables audit log file pruning based on combined log + file size. To have an effect, + [`audit_log_max_size`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_max_size) requires + that [`audit_log_rotate_on_size`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_rotate_on_size) + be greater than 0. If that is true, the pruning algorithm uses + [`audit_log_max_size`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_max_size) in + conjunction with + [`audit_log_prune_seconds`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_prune_seconds), with + nonzero values of + [`audit_log_max_size`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_max_size) taking + precedence over nonzero values of + [`audit_log_prune_seconds`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_prune_seconds). For + details, see [Space Management of Audit Log Files](/doc/refman/8.0/en/audit-log-logging-configuration.html#audit-log-space-management). + (WL #14525) + +### Authentication Notes + +* Previously, as part of the “hello” packet sent by + the server to clients, the server sent the name of the + server-side authentication plugin rather than the client-side + plugin. The server now sends the client-side name, which is more + appropriate for the client's needs and may help to avoid extra + protocol round trips. + (WL #14308) + +### Compilation Notes + +* **macOS:** + It is now possible to build MySQL for macOS 11 on ARM (that is, + for Apple M1 systems). + (Bug #32386050, Bug #102259) +* Building on openSUSE 15 and SLES 15 now requires GCC 9, found in + packages `gcc-9` and + `gcc9-c++`. + + Building on SLES 12 now requires GCC 10, found in packages + `gcc-10` and `gcc10-c++`. + + It is also recommended to use the named GCC version when + building third-party applications that are based on the + `libmysqlclient` C API library. + (Bug #32886268, Bug #32886439) +* Building on Ubuntu 18.04 (bionic) now requires GCC 8, found in + packages `gcc-8` and `g++-8`. + It is also recommended to use GCC 8 when building third-party + applications that are based on the + `libmysqlclient` C API library. + (Bug #32877062) +* It is now possible to build MySQL on Solaris using GCC 10, which + becomes the default and recommended compiler. It is also + recommended to use GCC 10 when building third-party applications + that are based on the `libmysqlclient` C API + library. + (Bug #32552988) + +### Component Notes + +* A new component service enables server components to set system + variable values. For information about this service, see the + MySQL Server Doxygen documentation, available at + https://dev.mysql.com/doc/index-other.html (search for + `s_mysql_mysql_system_variable_update_string` + and `mysql_system_variable_update_string_imp`). + (WL #12002) + +### Deprecation and Removal Notes + +* The TLSv1 and TLSv1.1 connection protocols now are deprecated + and support for them is subject to removal in a future MySQL + version. (For background, refer to the IETF memo + [Deprecating + TLSv1.0 and TLSv1.1](https://tools.ietf.org/id/draft-ietf-tls-oldversions-deprecate-02.html).) It is recommended that connections + be made using the more-secure TLSv1.2 and TLSv1.3 protocols. + TLSv1.3 requires that both the MySQL server and the client + application be compiled with OpenSSL 1.1.1 or higher. + + On the server side, this deprecation has the following effects: + + + If the [`tls_version`](/doc/refman/8.0/en/server-system-variables.html#sysvar_tls_version) or + [`admin_tls_version`](/doc/refman/8.0/en/server-system-variables.html#sysvar_admin_tls_version) system + variable is assigned a value containing a deprecated TLS + protocol, the server produces a warning for each deprecated + protocol: + + - If the assignment occurs during server startup, the + warning appears in the error log. + - If the assignment occurs at runtime, the warning is + added to the result of executing the + [`ALTER INSTANCE RELOAD TLS`](/doc/refman/8.0/en/alter-instance.html#alter-instance-reload-tls) + statement. + + If a client successfully connects using a deprecated TLS + protocol, the server writes a warning to the error log. + + On the client side, the deprecation has no visible effect. + Clients do not issue a warning if configured to permit a + deprecated TLS protocol. This includes: + + + Client programs that support a + [`--tls-version`](/doc/refman/8.0/en/connection-options.html#option_general_tls-version) option for + specifying TLS protocols for connections to the MySQL + server. + + Statements that enable replicas to specify TLS protocols for + connections to the source server. + ([`CHANGE REPLICATION SOURCE TO`](/doc/refman/8.0/en/change-replication-source-to.html) + has a `SOURCE_TLS_VERSION` option and + [`CHANGE MASTER TO`](/doc/refman/8.0/en/change-master-to.html) has a + `MASTER_TLS_VERSION` option.) + + The + [`group_replication_recovery_tls_version`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_recovery_tls_version) + system variable that enables joining members to specify TLS + protocols for distributed recovery connections. + + (Bug #32565996, WL #14519) +* The system variable + `transaction_write_set_extraction` is now + deprecated, and a warning message is issued if you attempt to + set it or read its value; expect it be removed in a future MySQL + release. This system variable was used on a replication source + server that has multithreaded replicas, to specify the algorithm + used to hash the writes extracted for a transaction’s write + set. The `XXHASH64` algorithm, which is the + default in MySQL 8.0 and is required for Group Replication, is + selected when the system variable is not used. + (WL #13950) +* The [`temptable_use_mmap`](/doc/refman/8.0/en/server-system-variables.html#sysvar_temptable_use_mmap) variable + is now deprecated and subject to removal in a future MySQL + version. + (WL #14124) +* TLS support in MySQL has been moving toward a channel model + using named sets of TLS parameters that apply to different + securable ports or protocols. For example, to query the state of + a particular TLS channel, use the Performance Schema + [`tls_channel_status`](/doc/refman/8.0/en/performance-schema-tls-channel-status-table.html) table: + + ```None + mysql> SELECT VALUE FROM performance_schema.tls_channel_status + WHERE CHANNEL = 'mysql_main' AND PROPERTY = 'Enabled'; + +-------+ + | VALUE | + +-------+ + | Yes | + +-------+ + ``` + + This makes monolithic parameters that apply to TLS support as a + whole less applicable, so the following options and system + variables are now deprecated and subject to removal in a future + MySQL version: + + + The [`--ssl`](/doc/refman/8.0/en/server-options.html#option_mysqld_ssl) and + [`--admin-ssl`](/doc/refman/8.0/en/server-options.html#option_mysqld_admin-ssl) server options. + + The [`have_ssl`](/doc/refman/8.0/en/server-system-variables.html#sysvar_have_ssl) and + [`have_openssl`](/doc/refman/8.0/en/server-system-variables.html#sysvar_have_openssl) system + variables. + + The [`--ssl`](/doc/refman/8.0/en/server-options.html#option_mysqld_ssl) and + [`--admin-ssl`](/doc/refman/8.0/en/server-options.html#option_mysqld_admin-ssl) options are enabled + by default, so it is normally unnecessary to specify them. As an + alternative to specifying those options in negated form, if it + is desired to disable encrypted connections for the main or + administrative interface, set the corresponding TLS version + system variable to the empty value to indicate that no TLS + versions are supported. For example, these lines in the server + `my.cnf` file disable encrypted connections + for both interfaces: + + ```None + [mysqld] + tls_version='' + admin_tls_version='' + ``` + + (WL #14481) + +### Error Handling + +* Information written to the server error log for client timeouts + now includes (if available) the timeout value, and client user + and host. + (Bug #31581289, Bug #100112) + +### Event Scheduler Notes + +* If the Event Scheduler is enabled, enabling the + [`super_read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only) system variable + prevents it from updating event “last executed” + timestamps in the `events` data dictionary + table. This causes the Event Scheduler to stop the next time it + tries to execute a scheduled event, after writing a message to + the server error log. + + Previously, if enabling + [`super_read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only) caused the + Event Scheduler to stop, then after subsequently disabling + [`super_read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only), it was + necessary to manually restart the Event Scheduler by enabling it + again. As a convenience, the server now automatically restarts + the Event Scheduler as needed when either + [`read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_read_only) or + [`super_read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only) is disabled. + (Bug #31633859) + +### Firewall Notes + +* In MySQL 8.0.23, MySQL Enterprise Firewall implemented group profiles that each can + apply to multiple accounts, in addition to the previously + implemented account profiles that each apply to a single + account. See [Using MySQL Enterprise Firewall](/doc/refman/8.0/en/firewall-usage.html). + + A group profile with a single member account is logically + equivalent to an account profile for that account, so it is + possible to administer the firewall using group profiles + exclusively, rather than a mix of account and group profiles. + For new firewall installations, that is accomplished by + uniformly creating new profiles as group profiles and avoiding + account profiles. For upgrades from firewall installations that + already contain account profiles, MySQL Enterprise Firewall now includes a stored + procedure named + `sp_migrate_firewall_user_to_group()` for + converting account profiles to group profiles. + + Due to the greater flexibility offered by group profiles, all + aspects of the firewall related to account profiles are now + deprecated and subject to removal in a future MySQL version: + + + `INFORMATION_SCHEMA` tables: + `MYSQL_FIREWALL_USERS`, + `MYSQL_FIREWALL_WHITELIST` + + `mysql` system schema tables: + `firewall_users`, + `firewall_whitelist` + + `mysql` system schema stored procedures: + `sp_reload_firewall_rules()`, + `sp_set_firewall_mode()` + + Loadable functions: + `read_firewall_users()`, + `read_firewall_whitelist()`, + `set_firewall_mode()` + + Additionally, if the server detects account profiles at startup, + it writes a warning for every successfully loaded account + profile. + + For information about converting account profiles to group + profiles (which you should do at your earliest convenience), see + [Migrating Account Profiles to Group Profiles](/doc/refman/8.0/en/firewall-usage.html#firewall-account-profile-migration). + (WL #14174) + +### Packaging Notes + +* Binary packages that include `curl` rather than + linking to the system `curl` library have been + upgraded to use `curl` 7.77.0. + (Bug #33077562) +* For Ubuntu packages, the AppArmor profile for + **mysqld** was too restrictive regarding PID and + socket file names and failed for servers not using the exact + names in the profile. Now the profile applies to the directories + in which the files live, enabling it to apply for different file + names, and multiple servers. + (Bug #32857611) +* The `dh-systemd` package has been removed from + Ubuntu 21.04, so the dependency on it has been removed from + MySQL packages built for that distribution. + (Bug #32688072) +* For Debian packages, an `EnvironmentFile` + directive was added to enable the systemd service to read + environmental variables from the + `/etc/default/mysql` file if it is present. + (Bug #32082863, Bug #101363) +* Debian packages now use `/run` rather than + `/var/run` for path names. + (Bug #31955638) +* The bundled `lz4` library was upgraded to + version 1.9.3. + (Bug #29747853) +* For Debian packages, the `update-alternatives` + priority of the MySQL configuration file was increased to ensure + it replaces an existing file from a previously installed + distribution. + (Bug #29606955) + +### Pluggable Authentication + +* **Linux:** + MySQL Enterprise Edition now supports an authentication method that enables users + to authenticate to MySQL Server using Kerberos, provided that + appropriate Kerberos tickets are available or can be obtained. + It is available only on MySQL server and client hosts running + Linux, but can access Kerberos services running on non-Linux + hosts. For details, see + [Kerberos Pluggable Authentication](/doc/refman/8.0/en/kerberos-pluggable-authentication.html). + + This authentication method uses a pair of plugins, + `authentication_kerberos` on the server side + and `authentication_kerberos_client` on the + client side. The server-side Kerberos authentication plugin is + included only in MySQL Enterprise Edition. It is not included in MySQL community + distributions. The client-side plugin is included in all + distributions, including community distributions. This enables + clients from any distribution to connect to a server that has + the server-side plugin loaded. + (WL #14336) + +### Server Administration + +* Setting the session value of the + [`innodb_strict_mode`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_strict_mode) system + variable is now a restricted operation and the session user must + have privileges sufficient to set restricted session variables. + + For information about the privileges required to set restricted + session variables, see + [System Variable Privileges](/doc/refman/8.0/en/system-variable-privileges.html). + (Bug #32944980, WL #14610) + +### Spatial Data Support + +* The [`ST_Buffer()`](/doc/refman/8.0/en/spatial-operator-functions.html#function_st-buffer) function now + permits the geometry argument to have a geographic spatial + reference system (SRS), if the geometry is a point value. + Previously, [`ST_Buffer()`](/doc/refman/8.0/en/spatial-operator-functions.html#function_st-buffer) supported + only geometry arguments in a Cartesian SRS. The + [`ST_Difference()`](/doc/refman/8.0/en/spatial-operator-functions.html#function_st-difference) and + [`ST_Union()`](/doc/refman/8.0/en/spatial-operator-functions.html#function_st-union) functions now permit + the geometry arguments to have a geographic SRS. Previously, + [`ST_Difference()`](/doc/refman/8.0/en/spatial-operator-functions.html#function_st-difference) and + [`ST_Union()`](/doc/refman/8.0/en/spatial-operator-functions.html#function_st-union) supported only + geometry arguments in a Cartesian SRS. See + [Spatial Operator Functions](/doc/refman/8.0/en/spatial-operator-functions.html). + (WL #14126, WL #14188, WL #14266) + +### X Plugin Notes + +* When the X DevAPI `Session.run_sql()` method + was used to execute a query that returned multiple results, due + to a caching issue, the `result.columns` + property was not updated to reflect the columns present in the + active result, although the + `result.column_names` property was. + (Bug #32887586) +* During an upgrade process, X Plugin logged a message stating + that it was ready for connections once the TCP port and UNIX + socket had been allocated. However, connections could not + actually be accepted until after the upgrade process was + complete. The message is now issued only after the upgrade has + finished. + (Bug #32814997) + +### Functionality Added or Changed + +* **Incompatible Change:** + From MySQL 8.0.26, new aliases or replacement names are provided + for most remaining identifiers that contain the terms + “master”, which is changed to + “source”; “slave”, which is changed to + “replica”; and “mts” (for + “multithreaded slave”), which is changed to + “mta” (for “multithreaded applier”). + Help text is also changed where applicable to use the new names. + + The following name replacements are visible in the Performance + Schema tables, the process list, and the replica status + information. These changes are incompatible with earlier + releases. Monitoring tools that work with these instrumentation + names might be impacted: + + + Instrumented locks (mutexes), visible in the + `mutex_instances` and + `events_waits_*` Performance Schema tables + with the prefix `wait/synch/mutex/` + + Read/write locks, visible in the + `rwlock_instances` and + `events_waits_*` Performance Schema tables + with the prefix `wait/synch/rwlock/` + + Instrumented condition variables, visible in the + `cond_instances` and + `events_waits_*` Performance Schema tables + with the prefix `wait/synch/cond/` + + Instrumented memory allocations, visible in the + `memory_summary_*` Performance Schema + tables with the prefix `memory/sql/` + + Thread names, visible in the `threads` + Performance Schema table with the prefix + `thread/sql/` + + Thread stages, visible in the + `events_stages_*` Performance Schema tables + with the prefix `stage/sql/`, and without + the prefix in the `threads` and + `processlist` Performance Schema tables, + the output from the `SHOW PROCESSLIST` + statement, the Information Schema + `processlist` table, and the slow query log + + Thread commands, visible in the + `events_statements_history*` and + `events_statements_summary_*_by_event_name` + Performance Schema tables with the prefix + `statement/com/`, and without the prefix in + the `threads` and + `processlist` Performance Schema tables, + the output from the `SHOW PROCESSLIST` + statement, the Information Schema + `processlist` table, and the output from + the `SHOW REPLICA STATUS` statement + + If the incompatible changes do have an impact for you, you can + set the new system variable + `terminology_use_previous` to + `BEFORE_8_0_26` to make MySQL Server use the + old versions of the names for the objects specified in the + previous list. This enables monitoring tools that rely on the + old names to continue working until they can be updated to use + the new names. The system variable can be set with session scope + to support individual functions, or global scope to be a default + for all new sessions. When global scope is used, the slow query + log contains the old versions of the names. + + For semisynchronous replication, you can choose whether to use + the new or the old versions of the system variables and status + variables. New versions of the plugins that implement + semisynchronous replication, one for the source server and one + for the replica, are supplied that replace the terms master and + slave with source and replica, and you can install these + versions instead of the old ones: + + + The `rpl_semi_sync_master` plugin + (`semisync_master.so` library) for the + source has a new version + `rpl_semi_sync_source` + (`semisync_source.so` library) + + The `rpl_semi_sync_slave` plugin + (`semisync_slave.so` library) for the + replica has a new version + `rpl_semi_sync_replica` + (`semisync_replica.so` library) + + You cannot have both the new and the old version of the relevant + plugin installed on an instance. If you use the new version of + the plugins, the new system variables and status variables are + available but the old ones are not. If you use the old version + of the plugins, the old system variables and status variables + are available but the new ones are not. + + The following internal-use items are converted to use the new + terms but are not externalized to users or monitoring tools, and + MySQL Server handles any necessary resolution internally: + + + C++ filenames in source code + + Header guards in C++ files + + Debug symbols + + User variables passed in the replication protocol handshake + by the replica when it connects to a replication source + server (the replica sets both the old and the new name) + + The following categories of identifiers have a new alias, and a + deprecation warning is issued when the old name is used, + although the old name continues to work. Both names are + available in Performance Schema tables and status displays, and + no deprecation warning is issued when reading these. The new + aliases are not affected by the new system variable + `terminology_use_previous`, and can still be + used when it is set: + + + System variables that contain the terms + “master”, “slave”, or + “mts”, with the exception of some that have + already been deprecated or are scheduled for deprecation, + and those defined by NDB. If these system variables are + persisted using a SET PERSIST statement, both the old and + the new name are persisted, regardless of which was + specified in the statement. With a RESET PERSIST statement, + both are reset. + + Status variables that contain the terms + “master”, “slave”, or + “mts”, with the exception of those defined by + NDB. + + Command-line options for **mysqld** that + contain the terms “master”, + “slave”, or “mts”, with the + exception of some that have already been deprecated or are + scheduled for deprecation, and those defined by NDB. + + Command-line options for **mysqladmin** that + contain the terms “master”, + “slave”, or “mts”. + + Command-line options for **mysqlbinlog** that + contain the terms “master”, + “slave”, or “mts”. + + Command-line options for **mysqldump** that + contain the terms “master”, + “slave”, or “mts”. + + An SQL function that contains the term + “master”. + + The complete list of identifiers with new aliases (or in the + case of semisynchronous replication, replacements) is as + follows: + + + System variables: + + - `master_verify_checksum` now has the + alias `source_verify_checksum` + - `sync_master_info` now has the alias + `sync_source_info` + - `init_slave` now has the alias + `init_replica` + - `rpl_stop_slave_timeout` now has the + alias `rpl_stop_replica_timeout` + - `log_slow_slave_statements` now has the + alias `log_slow_replica_statements` + - `slave_max_allowed_packet` now has the + alias `replica_max_allowed_packet` + - `slave_compressed_protocol` now has the + alias `replica_compressed_protocol` + - `slave_exec_mode` now has the alias + `replica_exec_mode` + - `slave_type_conversions` now has the + alias `replica_type_conversions` + - `slave_sql_verify_checksum` now has the + alias `replica_sql_verify_checksum` + - `slave_parallel_type` now has the alias + `replica_parallel_type` + - `slave_preserve_commit_order` now has + the alias + `replica_preserve_commit_order` + - `log_slave_updates` now has the alias + `log_replica_updates` + - `slave_allow_batching` now has the + alias `replica_allow_batching` + - `slave_load_tmpdir` now has the alias + `replica_load_tmpdir` + - `slave_net_timeout` now has the alias + `replica_net_timeout` + - `sql_slave_skip_counter` now has the + alias `sql_replica_skip_counter` + - `slave_skip_errors` now has the alias + `replica_skip_errors` + - `slave_checkpoint_period` now has the + alias `replica_checkpoint_period` + - `slave_checkpoint_group` now has the + alias `replica_checkpoint_group` + - `slave_transaction_retries` now has the + alias `replica_transaction_retries` + - `slave_parallel_workers` now has the + alias `replica_parallel_workers` + - `slave_pending_jobs_size_max` now has + the alias + `replica_pending_jobs_size_max` + - `pseudo_slave_mode` now has the alias + `pseudo_replica_mode` + - `skip_slave_start` now has the alias + `skip_replica_start` + + If the new `rpl_semi_sync_source` and + `rpl_semi_sync_replica` plugins are used + for semisynchronous replication: + + - `rpl_semi_sync_slave_enabled` is + replaced by + `rpl_semi_sync_replica_enabled` + - `rpl_semi_sync_slave_trace_level` is + replaced by + `rpl_semi_sync_replica_trace_level` + - `rpl_semi_sync_master_wait_for_slave_count` + is replaced by + rpl\_semi\_sync\_source\_wait\_for\_replica\_count + - `rpl_semi_sync_master_enabled` is + replaced by + `rpl_semi_sync_source_enabled` + - `rpl_semi_sync_master_timeout` is + replaced by + `rpl_semi_sync_source_timeout` + - `rpl_semi_sync_master_trace_level` is + replaced by + `rpl_semi_sync_source_trace_level` + - `rpl_semi_sync_master_wait_point` is + replaced by + `rpl_semi_sync_source_wait_point` + + The following system variables are not changed: + + - `ndb_slave_conflict_role` (NDB system + variables are not changed) + - `binlog_rotate_encryption_master_key_at_startup` + (“master key” is an accepted term) + - `slave_rows_search_algorithms` (This + system variable is already deprecated) + - `master_info_repository` (This system + variable is already deprecated) + + Status variables: + + - `Slave_open_temp_tables` now has the + alias `Replica_open_temp_tables` + - `Slave_rows_last_search_algorithm_used` + now has the alias + `Replica_rows_last_search_algorithm_used` + + If the new rpl\_semi\_sync\_source and rpl\_semi\_sync\_replica + plugins are used for semisynchronous replication: + + - `Rpl_semi_sync_slave_status` is + replaced by + `Rpl_semi_sync_replica_status` + - `Rpl_semi_sync_master_status` is + replaced by + `Rpl_semi_sync_source_status` + - `Rpl_semi_sync_master_clients` is + replaced by + `Rpl_semi_sync_source_clients` + - `Rpl_semi_sync_master_yes_tx` is + replaced by + `Rpl_semi_sync_source_yes_tx` + - `Rpl_semi_sync_master_no_tx` is + replaced by + `Rpl_semi_sync_source_no_tx` + - `Rpl_semi_sync_master_wait_sessions` is + replaced by + `Rpl_semi_sync_source_wait_sessions` + - `Rpl_semi_sync_master_no_times` is + replaced by + `Rpl_semi_sync_source_no_times` + - `Rpl_semi_sync_master_timefunc_failures` + is replaced by + `Rpl_semi_sync_source_timefunc_failures` + - `Rpl_semi_sync_master_wait_pos_backtraverse` + is replaced by + `Rpl_semi_sync_source_wait_pos_backtraverse` + - `Rpl_semi_sync_master_tx_wait_time` is + replaced by + `Rpl_semi_sync_source_tx_wait_time` + - `Rpl_semi_sync_master_tx_waits` is + replaced by + `Rpl_semi_sync_source_tx_waits` + - `Rpl_semi_sync_master_tx_avg_wait_time` + is replaced by + `Rpl_semi_sync_source_tx_avg_wait_time` + - `Rpl_semi_sync_master_net_wait_time` is + replaced by + `Rpl_semi_sync_source_net_wait_time` + - `Rpl_semi_sync_master_net_waits` is + replaced by + `Rpl_semi_sync_source_net_waits` + - `Rpl_semi_sync_master_net_avg_wait_time` + is replaced by + `Rpl_semi_sync_source_net_avg_wait_time` + + NDB-related status variables are not changed. + + For **mysqld**, the command-line versions of + all the aliased and replaced system variables in the lists + above have equivalent command-line aliases or replacements, + plus the following command-line option that is not a system + variable: + + - `show-slave-auth-info` has the alias + `show-replica-auth-info` + + The following command-line options are not changed: + + - `abort-slave-event-count` (This + command-line option is scheduled for deprecation) + - `disconnect-slave-event-count` (This + command-line option is scheduled for deprecation) + - `master-info-file` (This command-line + option is already deprecated) + - `master-retry-count` (This command-line + option is already deprecated) + + For **mysqladmin**, the option + `start-slave` now has the alias + `start-replica`, and the option + `stop-slave` now has the alias + `stop-replica`. + + For **mysqlbinlog**, the option + `read-from-remote-master` now has the alias + `read-from-remote-source`. + + For mysqldump, the following command-line options have new + aliases: + + - `apply-slave-statements` now has the + alias `apply-replica-statements` + - `delete-master-logs` now has the alias + `delete-source-logs` + - `dump-slave` now has the alias + `dump-replica` + - `include-master-host-port` now has the + alias `include-source-host-port` + - `master-data` now has the alias + `source-data` + + The built-in SQL function `MASTER_POS_WAIT` + has a new alias `SOURCE_POS_WAIT`. + + (WL #14194, WL #14628) +* **InnoDB:** + The new + [`innodb_segment_reserve_factor`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_segment_reserve_factor) + system variable permits configuring the percentage of tablespace + file segment pages that are reserved as empty pages. For more + information, see + [Configuring the Percentage of Reserved File Segment Pages](/doc/refman/8.0/en/innodb-file-space.html#innodb-config-reserved-file-segment-pages). + + Thanks to Facebook for the contribution. + (Bug #32312743, Bug #102044, WL #14521) +* **Group Replication:** + For Group Replication, a group in single-primary mode can now be + configured to stay in super read-only mode, so that it only + accepts replicated transactions and does not accept any direct + writes from clients. This setup means that when a group’s + purpose is to provide a secondary backup to another group for + disaster tolerance, you can ensure that the secondary group + remains synchronized with the first. You can configure the group + to remain in super read-only mode when a new primary is elected, + by disabling the action that normally takes place to remove that + mode on the primary. + + Administrators can configure a group in this way using the new + Group Replication functions + [`group_replication_enable_member_action()`](/doc/refman/8.0/en/group-replication-functions-for-member-actions.html#function_group-replication-enable-member-action) + and + [`group_replication_disable_member_action()`](/doc/refman/8.0/en/group-replication-functions-for-member-actions.html#function_group-replication-disable-member-action), + which can enable and disable actions for members of a group to + take in specified situations. The functions can also be used on + servers that are not part of a group, as long as the Group + Replication plugin is installed. Member actions are configured + on the primary and propagated to other group members and joining + members using group messages. Another function + [`group_replication_reset_member_actions()`](/doc/refman/8.0/en/group-replication-functions-for-member-actions.html#function_group-replication-reset-member-actions) + is available to reset the member actions configuration to the + default setting for all member actions. + (WL #13855) +* **Group Replication:** + You can now select an alternative UUID to form part of the GTIDs + that are used when internally generated transactions for view + changes (`View_change_log_event`) are written + to the binary log. The system variable + [`group_replication_view_change_uuid`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_view_change_uuid) + added in this release specifies a UUID that is used instead of + the group name (the value of + [`group_replication_group_name`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_group_name)). + The alternative UUID makes it easier to distinguish view change + events from transactions received by the group from clients. + This can be useful if your setup allows for failover between + groups, and you need to identify and discard transactions that + were specific to the backup group. Note that all members of the + group must have the same alternative UUID specified, so groups + set up in this way cannot include members from releases prior to + MySQL 8.0.26. + (WL #14539) +* The URL for downloading Boost was updated. Thanks to Marcelo + Altmann for the contribution. + (Bug #32856104, Bug #103611) +* The clone plugin now permits cloning from a donor MySQL server + instance to a hotfix MySQL server instance of the same version + and release. Previously, the hotfix server instance was not + recognized as the same MySQL version and release. + (Bug #32523635) +* These statements now report `utf8mb3` rather + than `utf8` when writing character set names: + [`EXPLAIN`](/doc/refman/8.0/en/explain.html), + [`SHOW CREATE PROCEDURE`](/doc/refman/8.0/en/show-create-procedure.html), + [`SHOW CREATE EVENT`](/doc/refman/8.0/en/show-create-event.html). + + Stored program definitions retrieved from the data dictionary + now report `utf8mb3` rather than + `utf8` in character set references. This + affects any output produced from those definitions, such as + `SHOW CREATE` statements. + + This error message now reports `utf8mb3` rather + than `utf8` when writing character set names: + [`ER_INVALID_CHARACTER_STRING`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_invalid_character_string). + (Bug #32233614, Bug #32392077, Bug #32392209, Bug #32428538, Bug #32428598) +* On platforms that support `fdatasync()` system + calls, the new + [`innodb_use_fdatasync`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_use_fdatasync) variable + permits using `fdatasync()` instead of + `fsync()` for operating system flushes. An + `fdatasync()` system call does not flush + changes to file metadata unless required for subsequent data + retrieval, providing a potential performance benefit. The + [`innodb_use_fdatasync`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_use_fdatasync) variable + can be set dynamically using a + [`SET`](/doc/refman/8.0/en/set-variable.html) + statement. + (WL #14452) + +### Bugs Fixed + +* **Incompatible Change:** + Within trigger bodies, `INSERT` or + `UPDATE` statements containing a + `SET` clause that used `OLD` + or `NEW` values as assignment targets could + raise an assertion or lead to a server exit. Such assignments + are no longer permitted. + (Bug #32803211) +* **Performance:** + Internal functions used to copy values between columns have been + improved such that computations not necessary when the values + are of similar types are no longer performed. Queries using + temporary tables should be noticeably faster with this + enhancement. Our internal testing has shown such queries being + executed up to 11% faster than previously; as always, your + results may differ from these depending on environment, + configuration, and other factors. + (Bug #32742537) +* **InnoDB:** + To reduce the number of unnecessary warning messages in the + error log, instances of the + `fil_space_acquire()` function in the + `InnoDB` sources were replaced by the + `fil_space_acquire_silent()` function where + possible. + (Bug #32944543) +* **InnoDB:** + The `TRX_FORCE_ROLLBACK_ASYNC` flag in the + `InnoDB` sources, which indicates whether a + transaction was rolled back asynchronously or by the owning + thread, was found to be redundant and has been removed. + (Bug #32912595) +* **InnoDB:** + Use of the `ut_delete` symbol instead of the + `UT_DELETE` macro in the InnoDB sources caused + a failure in builds that disable Performance Schema memory + tracing ([`-DDISABLE_PSI_MEMORY=ON`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_disable_psi_memory)). + (Bug #32910699) +* **InnoDB:** + Dictionary system `mutex_enter` and + `mutex_exit` calls in the + `InnoDB` sources were renamed to + `dict_sys_mutex_enter()` and + `dict_sys_mutex_exit()`, respectively. + (Bug #32907980) +* **InnoDB:** + Legacy `UNIV_INLINE` and + `UNIV_MATERIALIZE` artifacts were removed from + `InnoDB` sources. + `UNIV_HOTBACKUP` was added to method + declarations in some header files. + (Bug #32894165) +* **InnoDB:** + The `lock_sys` sharded + `rw_lock` index used random index values + generated by the `ut_rnd_interval()` function, + which was not optimal for low-concurrency workloads. + (Bug #32880577) +* **InnoDB:** + A string value setting for the + [`innodb_redo_log_encrypt`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_redo_log_encrypt) + variable was not handled properly. + (Bug #32851525) +* **InnoDB:** + Read-write transaction set + (`trx_sys->rw_trx_set`) shards, each with a + dedicated mutex, were introduced to alleviate transaction system + mutex (`trx_sys->mutex`) contention caused + by transaction set insertions and removals. Related enhancements + include moving transaction set modifiers to less critical + locations, eliminating heap allocation inside of the + `TrxUndoRsegs` constructor, converting + transaction state (`trx->state`) and + transaction start time (`trx->start_time`) + fields to `std::atomic` fields, and new + assertion code to validate threads that operate on transactions. + (Bug #32832196) +* **InnoDB:** + Record buffer logic for the `InnoDB` memcached + `GET` command was revised. + (Bug #32828352) +* **InnoDB:** + The `ut_list` base member in the + `InnoDB` sources now locates list nodes using + the element portion of the list type rather than storing a + member pointer in the base node of a list at runtime, which + waisted resources. The patch also includes other + `ut_list` related code improvements. + (Bug #32820458) +* **InnoDB:** + After upgrading from MySQL 5.6 to MySQL 5.7 and starting the + server with undo log truncation enabled + (`innodb_undo_log_truncate=ON`), a deadlock + occurred when an undo tablespace truncate operation was + initiated. The deadlock caused a long semaphore wait and an + eventual failure. A direct upgrade from MySQL 5.6 to MySQL + 5.7.35 or later avoids this potential issue. + (Bug #32800020) +* **InnoDB:** + Type-safe enhancements for PSI\_memory\_key identifiers were + introduced. PSI\_memory\_key identifiers are used by Performance + Schema for instrumentation of memory operations. With this + enhancement, + `ut::aligned_name`library functions are able to report type errors at + compile time. + (Bug #32797838) +* **InnoDB:** + The `buf_get_LRU_mutex()` function was + optimized to avoid acquiring the LRU mutex unnecessarily when + flushing from the flush list. + (Bug #32797451, Bug #103391) +* **InnoDB:** + In debug builds, an access to + `Fil_shard::m_deleted_spaces` (deleted + tablespaces vector) was not protected by the + `Fil_shard` mutex, causing a failure. + (Bug #32792816) +* **InnoDB:** + Attempting to start MySQL with + [`--innodb-dedicated-server`](/doc/refman/8.0/en/innodb-parameters.html#option_mysqld_innodb-dedicated-server) on a + machine with 2GB of RAM resulted in the creation of a single + redo log file, which prevented the server from starting. Now in + such cases, at least two log files are created. + + Our thanks to Adam Cable for the contribution. + (Bug #32788772, Bug #103372) +* **InnoDB:** + A failure occurred when truncating a partitioned table after an + operation that added too many columns to the table, exceeding + the column limit. The number of columns added is now evaluated + before an `ADD COLUMN` operation is permitted. + (Bug #32788564, Bug #103363) +* **InnoDB:** + On platforms that support punch hole where the disk is near + full, creating a tablespace with a large + `AUTOEXTEND_SIZE` setting could lead to a no + space on device failure and a subsequent + `InnoDB` recovery failures. + (Bug #32771235) +* **InnoDB:** + The list of table locks requested by a transaction + (`trx->lock.table_locks`), which is a subset + of the transaction lock list + (`trx->lock.trx_locks`), was removed. Table + locks requested by a transaction are now are now listed at the + beginning of the transaction lock list instead. + (Bug #32762881) +* **InnoDB:** + A failure occurred during recovery with the disk being near + full, leaving the data in an inconsistent state. The failure + occurred in the `fil_tablespace_redo_extend()` + function, which is used to redo a tablespace extension + operation. + (Bug #32749974, Bug #32748733) +* **InnoDB:** + After relocating a file-per-table tablespace offline and making + the new location known to `InnoDB` using the + [`innodb_directories`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_directories) option, an + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) operation that used + the `COPY` algorithm failed with a storage + engine error. The failure was due to a renaming check, which + searched the data directory instead of the new directory + location. + (Bug #32721533) +* **InnoDB:** + `ut_allocator()` compliance issues with the C++ + standard template library (STL) were addressed. + (Bug #32715698) +* **InnoDB:** + Instances of `ut_allocator::allocate()` + instantiated by `std::vector` in the + `InnoDB` sources failed to trace memory + allocations and deallocations performed implicitly by + `std::vector`. The same issue was found for + other C++ standard template library (STL) and STL-like + data-structures. + (Bug #32715688) +* **InnoDB:** + The u`t_allocator::construct()` interface in + the `InnoDB` sources, which is a custom + interface implemented in a pre-C++11 style, caused unnecessary + overhead. The interface was not necessary and has been removed. + (Bug #32715381) +* **InnoDB:** + The `ut_list` length member variable in the + `InnoDB` sources was replaced by an atomic + field to permit lock free access without undefined behavior. The + default `ut_list` constructor was replaced by a + new constructor that performs all list initialization. + (Bug #32715371) +* **InnoDB:** + The `ut_allocator()` out of memory reporting + mechanism in the `InnoDB` sources was not + reliable and has been removed. + (Bug #32715359) +* **InnoDB:** + Implicit handling of Performance Schema metadata was implemented + for `ut_allocator::allocate_large()` and + `ut_allocator::deallocate_large()` functions in + the `InnoDB` sources. This modification aligns + Performance Schema metadata handling with that of similar + allocation functions. + (Bug #32714144) +* **InnoDB:** + Stalls were caused by concurrent `SELECT + COUNT(*)` queries where the number of parallel read + threads exceeded the number of machine cores. A patch for this + issue was provided for Windows builds in MySQL 8.0.24. The MySQL + 8.0.26 patch addresses the same issue on other affected + platforms. + (Bug #32678019) + + References: See also: Bug #32224707. +* **InnoDB:** + To avoid costly calls to the + `rec_get_offsets()` function, which determines + the offsets for each field in a record, caching of offsets is + extended to indexes that meet certain requirements such as + having a fixed length, no virtual columns, instant columns, and + so on. + (Bug #32673649) +* **InnoDB:** + When starting the server with a data directory that was restored + by MySQL Enterprise Backup, the doublewrite buffer (controlled by the + [`innodb_doublewrite`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_doublewrite) variable) + remained disabled until the next server restart. + (Bug #32642866) +* **InnoDB:** + “Too many open files” errors were encountered when + creating a large number of tables. + (Bug #32634620) + + References: This issue is a regression of: Bug #32541241. +* **InnoDB:** + `InnoDB` recovery was unable to proceed due to + a page tracking system recovery failure, which should have been + non-blocking. + (Bug #32630875) +* **InnoDB:** + An integer underflow issue was addressed in the + `InnoDB` mecached plugin sources. + (Bug #32620378, Bug #32620398) +* **InnoDB:** + When a transaction started waiting for lock, the + `InnoDB` lock system provided information to + the server about the transaction currently holding the lock but + failed to inform the server after releasing the lock and grating + it to another waiting transaction. As a result, the replication + applier thread coordinator was unable to detect potential + deadlocks in the intended transaction commit order that could + occur if the third transaction in this scenario committed after + the initial waiting transaction. + (Bug #32618301) +* **InnoDB:** + When inserting a record into a unique secondary index, the index + record locks taken to prevent concurrent transactions from + inserting a conflicting record into the affected range included + an unnecessary gap lock on the first record after the range. + (Bug #32617942) +* **InnoDB:** + `InnoDB` code that creates dynamically + allocated over-aligned types was replaced by + `ut::aligned_name` + library functions. + (Bug #32601599) +* **InnoDB:** + Memory allocation functions belonging to the API that handles + dynamic storage of over-aligned types + (`ut::aligned_name` + library functions) were extended to support memory tracing using + Performance Schema. The + `HAVE_PSI_MEMORY_INTERFACE` source + configuration option enables the memory tracing module. + + An `aligned_zalloc()` library function, which + provides support for zero-initialized memory allocations, was + added to the API. + (Bug #32600981) + + References: See also: Bug #32601599, Bug #32246061, Bug #32246200. +* **InnoDB:** + Sampling of `InnoDB` data for the purpose of + generating histogram statistics is now supported with all + transaction isolation levels supported by + `InnoDB`. Previously, sampling was performed + using only the [`READ + UNCOMMITTED`](/doc/refman/8.0/en/innodb-transaction-isolation-levels.html#isolevel_read-uncommitted) isolation level. + (Bug #32555575) +* **InnoDB:** + An index with a key prefix length greater than 767 bytes was + permitted on a table defined with the + `REDUNDANT` row format, exceeding the index key + prefix length limit for that row format. The + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) operation that added + the index validated the index key prefix length for the row + format defined by the + [`innodb_default_row_format`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_default_row_format) + variable instead of the actual row format of the table. The fix + ensures that index key prefix length is validated for the + correct row format. + (Bug #32507117, Bug #102597) +* **InnoDB:** + Adaptive hash index latches did not provide meaningful latch + location information. + (Bug #32477773) +* **InnoDB:** + A dependency related to redo and undo log encryption at server + initialization time was removed. + (Bug #32476724) +* **InnoDB:** + An online buffer pool resizing operation freed the previous + buffer pool page hash, conflicting with a concurrent buffer pool + lookup that required the previous page hash. + (Bug #32460315) +* **InnoDB:** + When using the TempTable storage engine + ([`internal_tmp_mem_storage_engine=TempTable`](/doc/refman/8.0/en/server-system-variables.html#sysvar_internal_tmp_mem_storage_engine)), + more than 255 aggregate functions in a `SELECT` + list caused errors due to overflow of an internal variable that + stores indexed column field positions. + (Bug #32458104, Bug #102468) +* **InnoDB:** + A workload stalled while executing a undo tablespace truncation + operation on an instance with a large buffer pool. The function + that truncates marked undo tablespaces now takes a shared latch + instead of an exclusive latch, and the shared latch is taken for + a shorter period of time. + (Bug #32353863, Bug #102143) +* **InnoDB:** + A programming interface was added for handling dynamic storage + of over-aligned types. + (Bug #32246200, Bug #32246061) +* **InnoDB:** + Under certain circumstances, a failure during + `InnoDB` recovery could have caused a loss of + committed changes. Checkpoints permitted during recovery did not + handle page flushing, flush list maintenance, or persisting + changes to the data dictionary table buffer as necessary for a + proper checkpoint operations. Checkpoints and advancing the + checkpoint LSN are therefore no longer permitted until redo log + recovery is complete and data dictionary dynamic metadata + (`srv_dict_metadata`) is transferred to data + dictionary table (`dict_table_t`) objects. + Should the redo log run out of space during recovery or after + recovery (but before data dictionary dynamic metadata is + transferred to data dictionary table objects) as a result of + this change, an + [`innodb_force_recovery`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_force_recovery) restart + may be required, starting with at least the + `SRV_FORCE_NO_IBUF_MERGE` setting or, in case + that fails, the `SRV_FORCE_NO_LOG_REDO` + setting. If an + [`innodb_force_recovery`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_force_recovery) restart + fails in this scenario, recovery from backup may be necessary. + (Bug #32200595) +* **InnoDB:** + Rollback segments are now initialized in parallel during + startup. Previously, rollback segments were initialized + serially. + + Thanks to Zheng Lai and the Tencent Cloud-Native Database team + for submitting the contribution this bug fix is based on. + (Bug #32170127, Bug #101658) +* **InnoDB:** + A failure occurred during testing of + [`innodb_log_writer_threads`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_log_writer_threads) + variable configuration. The failure was caused by a race + condition. + (Bug #32129814) + + References: This issue is a regression of: Bug #30088404. +* **InnoDB:** + A race condition occurred between a purge thread that was + truncating an undo tablespace and a server thread that queried + the `INFORMATION_SCHEMA.FILES` table. As a + result, the truncated undo tablespace did not appear in the + [`INFORMATION_SCHEMA.FILES`](/doc/refman/8.0/en/information-schema-files-table.html) table when + queried, which in turn caused a MySQL Enterprise Backup failure due to a + dependency on the + [`INFORMATION_SCHEMA.FILES`](/doc/refman/8.0/en/information-schema-files-table.html) table for + undo tablespace file locations. + (Bug #32104924, Bug #32654667) +* **InnoDB:** + When DML operations are concentrated on a single table, purge + work was performed by a single purge thread, which could result + in slowed purge operations, increased purge lag, and increased + tablespace file size if DML operations involve large object + values. To address this issue, purge work is now automatically + redistributed among available purge threads when the purge lag + exceeds the + [`innodb_max_purge_lag`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_max_purge_lag) setting. + (Bug #32089028) +* **InnoDB:** + The function that populates the + `INFORMATION_SCHEMA.INNODB_TABLESPACES` table + accessed the space for a file and performed an unprotected + `stat()` operation and retrieval of file size + information. + (Bug #32025344) +* **InnoDB:** + Code related to the `trx_t::is_recovered` flag + in the `InnoDB` sources was revised to address + various complexity and correctness issues. One of the issues + addressed caused an XA transaction to be described incorrectly + as “recovered”, which occurred when a client + session disconnected from an XA transaction after `XA + PREPARE`. + (Bug #31870582) +* **InnoDB:** + TempTable debug assertion code for an + `Indexed_cells` member function + (`cell_from_mysql_buf_index_read()`) did not + account for non-nullable columns with zero length. + (Bug #31091089) +* **InnoDB:** + Using the InnoDB memcached plugin, attempting to retrieve + multiple values in a single get command returned an incorrect + value. + (Bug #29675958, Bug #95032) +* **InnoDB:** + The `trx_sys_t::serialisation_mutex` was + introduced to reduce contention on the on the + `trx_sys_t::mutex`. The new mutex protects the + `trx_sys_t::serialisation_list` when a + transaction number is assigned, which was previously protected + by the `trx_sys_t::mutex`. + + Thanks to Zhai Weixiang for the contribution. + (Bug #27933068, Bug #90643) +* **Partitioning:** + When a table was partitioned by + [`TIMESTAMP`](/doc/refman/8.0/en/datetime.html) and a timestamp literal + with a time zone offset was used in the `WHERE` + clause of a [`SELECT`](/doc/refman/8.0/en/select.html) statement, it + was possible for a partition to be omitted from the result set. + + When a time zone offset is specified in a timestamp literal, it + is expected to be converted to a timestamp without a time zone + offset, and then compared against a timestamp column, but this + was not done properly in all cases, with the result that a + partition could be pruned while selecting the partitions to be + scanned for the query. + + We fix this by making sure that a timestamp with a time zone + offset is always converted as described before comparing with + values from the column. + (Bug #101530, Bug #32134145) +* **Replication; Group Replication:** + When the system variable + [`replication_optimize_for_static_plugin_config`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_replication_optimize_for_static_plugin_config) + was set, the plugins for Group Replication and semi-synchronous + replication could not be uninstalled cleanly on server shutdown. + (Bug #32798287) +* **Replication:** + When the `SOURCE_CONNECTION_AUTO_FAILOVER=1` + option was set on the `CHANGE REPLICATION SOURCE + TO` statement for a replication channel, a + `STOP REPLICA IO_THREAD` statement did not stop + the monitor thread that monitors for connection failures on the + channel, and could incorrectly stop the applier thread. + (Bug #32892977) +* **Replication:** + A deadlock could occur when `START + GROUP_REPLICATION` and `STOP + GROUP_REPLICATION` statements were issued at the same + time that a view change was taking place for the group. + (Bug #32738137, Bug #32836868) +* **Replication:** + An incorrect default value in code meant that the allowlist of + IP addresses permitted for a replication group was implicitly + reconfigured although no value had been supplied. + (Bug #32714911) +* **Replication:** + A deadlock could occur if a `STOP + GROUP_REPLICATION` statement was issued when a + replication channel on a group member was attempting to commit a + transaction. The server now rolls back the transaction + immediately if it cannot acquire the relevant lock, rather than + waiting for the lock and the commit to complete and causing the + deadlock. + (Bug #32633176) +* **Replication:** + On a multithreaded replica, the reference to the active event + was sometimes managed incorrectly when retrying a transaction. + (Bug #32590974) +* **Replication:** + After a DML operation was performed on the last partition of a + table with more than 128 partitions, MySQL Server and MySQL + clients (such as **mysqlbinlog**) parsed the + event information from the binary log incorrectly, resulting in + an inaccurate partition ID being stated. The information is now + read using an event reader function that is endianness + independent. + (Bug #32358736, Bug #102191) +* **Replication:** + In a new MySQL Server installation, the + `mysql.gtid_executed` system table was missing + the property `STATS_PERSISTENT=0` to disable + persistent statistics, which is present for the other + replication-related tables. + (Bug #32250735) +* **Replication:** + When the same row in a table was updated multiple times by the + same event, the replication applier’s hash scan algorithm + omitted to check for JSON partial updates, which are logged when + `binlog_row_value_options=PARTIAL_JSON` is set. + This could result in replication stopping with a “key not + found” error. + (Bug #32221703) +* **Replication:** + Replica servers now check and validate the transaction ID part + of a GTID before applying and committing the transaction + associated with it. + (Bug #32103192) +* **Replication:** + Replication could stop on a multithreaded replica if a unique + secondary key was omitted from the writeset hashes used to + compute transaction dependencies, leading to errors when + executing the transactions on the multithreaded replica. Write + set hashes now always include unique secondary keys even if they + are not included in the read set and write set. + (Bug #31636339) +* **Replication:** + MySQL semisynchronous replication did not clean up connection + artifacts correctly after sending a reply to the source, causing + a mismatch that meant the connection had to be re-established. + The issue has now been fixed. + (Bug #31363518, Bug #32441220, Bug #32759421) +* **Replication:** + On a multithreaded replica (with `slave_parallel_workers + > 0` ), the algorithm used by GTID auto-positioning + to check for missing transactions briefly sets a low value (4) + for the event position in the course of its calculations. If the + operation is stopped at that moment, the recovery process that + resolves gaps in the sequence of transactions can fail. The + process to resolve gaps is not actually necessary when GTID + auto-positioning is used, so the process has now been disabled + in that situation. + + As a result, on a multithreaded replica, when `GTID_MODE + = ON` is set for the instance and + `SOURCE_AUTO_POSITION` is set for the channel + using the `CHANGE REPLICATION SOURCE TO` + statement, the following behaviors now apply: + + + A `START REPLICA UNTIL SQL_AFTER_MTS_GAPS` + statement just stops the applier thread when it finds the + first event to execute, and does not attempt to check for + gaps in the sequence of transactions. + + A `CHANGE REPLICATION SOURCE TO` statement + does not automatically fail if there are gaps in the + sequence of transactions. + + These changed behaviors only apply on a multithreaded replica + that uses GTIDs and GTID auto-positioning, and not on a replica + that uses binary log position-based replication. + (Bug #30571587, Bug #97694) +* **Group Replication:** + When running Group Replication in single-primary mode, + unnecessary copies of the transaction data were created during + data serialization. This is now done in a single step to reduce + the memory footprint. + (Bug #32781945) +* **Group Replication:** + Replicated transactions in GTID-based replication include an + `original_commit_timestamp` to show when the + transaction was committed on the original source server, and an + `immediate_commit_timestamp` to show when it + was committed on the replica. Previously, the + `original_commit_timestamp` was not set for + Group Replication view change events, which are agreed by the + group but then generated and applied by each group member, so + the timestamp appeared as zero in viewable output. For improved + observability, group members now set local timestamp values for + transactions associated with view change events. + (Bug #32668567) +* **Group Replication:** + Previously, a warning message was written to the error log if + the original commit timestamp on a replicated transaction was + more recent than the immediate commit timestamp on the replica + applying it. The message could occur inappropriately if the + fluctuation in the replication lag had a similar value to the + clock difference between the machines involved, which could be + made more likely by better quality connections between them. + During Group Replication failover, it was possible for a message + to be returned for every transaction, flooding the log. To avoid + this situation, the warning message has been withdrawn. + (Bug #32554807) +* **Group Replication:** + When `group_replication_consistency` was set to + `AFTER`, and a view change event was delayed + until after a locally prepared transaction was completed, a + different GTID could be applied to it, causing errors in + replication. The data is now processed in the same sequence it + is received to avoid the situation. + (Bug #31872708) +* **Microsoft Windows:** + Writing to Windows event logs could be unsuccessful. + (Bug #32890918) +* **JSON:** + Reading JSON values from tables that used the + [`CSV`](/doc/refman/8.0/en/csv-storage-engine.html) storage engine raised an error + such as Cannot create a JSON value from a string with + CHARACTER SET 'binary'. This happened because the + `CSV` engine uses + `my_charset_bin` as the character set for the + record buffer but creation of + [`JSON`](/doc/refman/8.0/en/json.html) values includes an explicit + check for `my_charset_bin`, and raises an error + if this character set is given. + + We handle this issue by passing the actual character set of the + column instead of the character set of the buffer holding the + data, which is always binary. + (Bug #102843, Bug #32597017) +* A query for which the derived condition pushdown optimization + could be applied was not so optimized when the query was part of + [`INSERT ... + SELECT`](/doc/refman/8.0/en/insert-select.html). + (Bug #32959186) +* Import operations for access privilege information became very + slow for large numbers of accounts and schemas. + (Bug #32934351) +* Queries which needed to sort the results of a full-text index + scan were in some circumstances not handled correctly. + (Bug #32924198) +* Thanks to Xiaoyu Wang for a code correction to + `PFS_notification_registry::is_empty()`. + (Bug #32919118, Bug #103788) +* Queries containing `GROUP BY`, `ORDER + BY`, and `LIMIT` in a subquery and + accessed using a cursor could cause a server exit. + (Bug #32918240) +* When invoked with the [`--help`](/doc/refman/8.0/en/server-options.html#option_mysqld_help) and + [`--verbose`](/doc/refman/8.0/en/server-options.html#option_mysqld_verbose) options, + **mysqld** created an + `auto.cnf` file in the current directory. + (Bug #32906164) +* Queries that involved pushing a condition with view references + down to a materialized derived table could cause a server exit. + (Bug #32905044, Bug #32324234) +* Messages for + [`ER_CANT_INITIALIZE_UDF`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_cant_initialize_udf) errors + could be truncated. + (Bug #32891703) +* A regression was found in the simplification of streaming + aggregation (`GROUP BY` of data already sorted) + that was performed in MySQL 8.0.23. + + We fix this issue as follows: When there is an implicit grouping + on a single table which is the subject of a fulltext search, we + now force insertion of a temporary table to materialize + `MATCH()` temporaries before they are sent to + the `AggregateIterator`, since it tries to save + and restore the rows it receives, but cannot properly include + the fulltext search information, as it is hidden. + (Bug #32889491) + + References: This issue is a regression of: Bug #31790217. +* For conversion of `-DBL_MAX` to string and back + to double, the new double value differed from the original and + was rejected as out of bounds. + (Bug #32888982, Bug #103709) +* Now, whenever the [`JSON_LENGTH()`](/doc/refman/8.0/en/json-attribute-functions.html#function_json-length) + function includes the optional *`path`* + argument, the server rewrites it as + `JSON_LENGTH(JSON_EXTRACT(doc, path))`. This + means that `JSON_LENGTH()` now supports + wildcards (such as `$`, `.`, + and `*`) and array ranges in the path, as shown + here: + + ```None + mysql> SELECT JSON_LENGTH('[1,2,3,4,5,6,7]', '$[2 to 4]') AS x; + +------+ + | x | + +------+ + | 3 | + +------+ + ``` + + (Bug #32877703) +* For flags typically used for RPM and Debian packages, the new + [`WITH_PACKAGE_FLAGS`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_package_flags) + **CMake** option controls whether to add those + flags to standalone builds on those platforms. The default is + `ON` for nondebug builds. This is used to + “harden” the builds; for example, by adding + `-D_FORTIFY_SOURCE=2`. + (Bug #32876974) +* The [`NULLIF()`](/doc/refman/8.0/en/flow-control-functions.html#function_nullif) function did not + perform all necessary checks for errors. + (Bug #32865008) +* For views that depended on other views, output from the + [`SHOW CREATE VIEW`](/doc/refman/8.0/en/show-create-view.html) statement used + during production of dump files could cause an error at restore + time. + (Bug #32854203, Bug #103583) +* The query-attributes code did not properly handle large 64-bit + numbers. + (Bug #32847269) +* Information retrieved from the Performance Schema + [`metadata_locks`](/doc/refman/8.0/en/performance-schema-metadata-locks-table.html) table could be + incorrect for foreign keys and `CHECK` + constraints. + (Bug #32832004, Bug #103532) +* When generating unique names for view columns, the server now + considers only those objects whose names are visible. + (Bug #32821372) +* When a condition is pushed down to a materialized derived table, + a clone of the derived table expression replaces the column + (from the outer query block) in the condition. When the cloned + item included a `FULLTEXT` function, it was + added to the outer query block instead of the derived table + query block, which led to problems. To fix this, we now use the + derived query block to clone such items. + (Bug #32820437) +* A common table expression which was used more than once in a + statement, at least once within a subquery that was subsequently + removed during resolution due to being always true, or always + false. + (Bug #32813547, Bug #32813554) +* If a statement is prepared against a table that is persistent at + preparation time but temporary at the time of first execution, + an assertion could be raised. + (Bug #32799797) +* An internal function used by spatial functions could reference + memory after freeing it. + (Bug #32793104) +* The `impossible filter` optimization removed + MRR access paths that were required by the corresponding BKA + access paths. + (Bug #32787415) +* The new + [`WITH_AUTHENTICATION_CLIENT_PLUGINS`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_authentication_client_plugins) + **CMake** option is enabled automatically if any + corresponding server authentication plugins are built. Its value + thus depends on other **CMake** options and it + should not be set explicitly. + (Bug #32778378) +* The MRR iterator normally filters out `NULL` + keys by checking `impossible_null_ref()`, but + when a join condition either contained an `IS + NULL` predicate, or used the + `NULL`-safe equals operator + `≪=>`, the optimizer had to check whether + the join condition used the predicate terms as part of its join + condition, and not set the internal flag + `HA_MRR_NO_NULL_ENDPOINTS` in such cases. Now + we check, using a bitmask, whether the each column in the key + rejects `NULL`, in which case we can set + `HA_MRR_NO_NULL_ENDPOINTS` without further + checks. + (Bug #32774281) +* For system variables with an enumeration type, + [`SET PERSIST_ONLY + var_name = DEFAULT`](/doc/refman/8.0/en/set-variable.html) + persisted the numeric value and not the symbolic name. + (Bug #32761053) +* The X DevAPI operations Collection.replaceOne and + Collection.addOrReplaceOne now verify that the value of the + `_id` field in a document matches the + `id` parameter specified for the operation. If + it does not, an error is returned. + (Bug #32753547) +* For applications that use the C API to execute prepared + statements, query attributes could not be used for prepared + statements with no parameters. + (Bug #32753030, Bug #32790714, Bug #32955044) +* The arguments to [`IN()`](/doc/refman/8.0/en/comparison-operators.html#operator_in) were not + always converted to the correct character set. + (Bug #32746552) +* The [`LOCATE()`](/doc/refman/8.0/en/string-functions.html#function_locate) function + unconditionally returned `NULL` when an + argument could not be evaluated. Now, when used in an expression + that is determined to be non-nullable, the function returns zero + instead. + (Bug #32746536) +* The internal function + `my_well_formed_len_utf32()` asserted when + presented with a string of invalid length. Now in such cases, + the function reports an invalid string instead. + (Bug #32745294) +* The functions [`TRIM()`](/doc/refman/8.0/en/string-functions.html#function_trim), + [`RTRIM()`](/doc/refman/8.0/en/string-functions.html#function_rtrim), and + [`LTRIM()`](/doc/refman/8.0/en/string-functions.html#function_ltrim) did not always perform + proper error checking. + (Bug #32744772) +* A previous fix in an internal resolver function ensured that it + raises an error when a generated column cannot be resolved. This + worked without any problem when the generated column is part of + a [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) statement, but in + the case where the table with the generated column was generated + on a MySQL 5.7 database and then upgraded to MySQL 8.0, an error + was reported and the upgrade terminated. + + We fix this by using the correct pointer when reporting the + table causing the error in the function + `fix_generated_columns_for_upgrade()`. + (Bug #32738972) +* When looking inside rollup wrappers in the + `SELECT` list, and trying to find the same item + in the `GROUP BY` list, the server did not take + into account that a cache might have been added around the + expression. Now any such caches are unwrapped before looking for + the item. + (Bug #32729377, Bug #32918400) +* A prepared statement that used + [`MIN()`](/doc/refman/8.0/en/aggregate-functions.html#function_min) or + [`MAX()`](/doc/refman/8.0/en/aggregate-functions.html#function_max) could return an incorrect + result if it also included dynamic parameters. + (Bug #32713860, Bug #103170) +* Replication could fail if a DML statement was executed + immediately after an XA transaction was rejected or forced to + rollback due to a deadlock. + (Bug #32707060) +* Queries containing multiple instances of + [`GROUPING()`](/doc/refman/8.0/en/miscellaneous-functions.html#function_grouping) were not always + handled correctly. + (Bug #32695103) +* When executing [`EXPLAIN ANALYZE`](/doc/refman/8.0/en/explain.html#explain-analyze), + materialization iterators count every single + `init()` call, even those that only retain + existing data, causes materializations to appear to cost too + little compared to the number of underlying calls. We fix this + by allowing the materialization iterator to override the call + and row counts with its own data. + (Bug #32688540) +* A race condition in the metadata locking code could result in a + server exit. + (Bug #32686116) +* An index-only scan on a covering full-text index could return + incorrect results for queries with multiple calls to + [`MATCH()`](/doc/refman/8.0/en/fulltext-search.html#function_match) function depending on the + order in which the [`MATCH()`](/doc/refman/8.0/en/fulltext-search.html#function_match) calls + were evaluated. + (Bug #32685616) +* Including query attributes for a prepared statement could cause + a statement execution failure. + (Bug #32676878) +* Executing DDL statements on a system table could cause a server + exit. + (Bug #32665990) +* With the + [`--online-migration`](/doc/refman/8.0/en/mysql-migrate-keyring.html#option_mysql_migrate_keyring_online-migration) + option, **mysql\_migrate\_keyring** could exit + during connection establishment to the migration server. + (Bug #32651203) +* **mysql\_migrate\_keyring** failed to enforce the + condition that the source and destination keystores must differ. + (Bug #32637784) +* System cache size checking could be inaccurate on Ubuntu. + (Bug #32619199, Bug #102926) +* The server did not process correctly some queries that used + `MATCH ... AGAINST` on a column with a fulltext + index in a `HAVING` clause. + (Bug #32617181) + + References: This issue is a regression of: Bug #30969045. +* Replicated transactions in GTID-based replication include an + `original_commit_timestamp` to show when the + transaction was committed on the original source server, and an + `immediate_commit_timestamp` to show when it + was committed on the replica. Previously, Group Replication + servers set the `original_commit_timestamp` + when they committed locally generated transactions, but they did + not set the `immediate_commit_timestamp`. For + improved observability, group members now set this timestamp. If + the transaction originated in the group, the + `original_commit_timestamp` and + `immediate_commit_timestamp` are both generated + by Group Replication, and are equal. If the transaction + originated outside the group, the + `original_commit_timestamp` is preserved, and + an `immediate_commit_timestamp` is set. + (Bug #32613896) +* The internal function `Item_func_match::eq()` + raised an assert failure in debug builds when it was called with + an argument that was an + `Item_func_match_predicate`. The assertion was + added with the expectation that an + `Item_func_match` object would not be compared + with an `Item_func_match_predicate` object, but + it was later found that this can happen during the + `ONLY_FULL_GROUP_BY` check when the predicate + is in a `HAVING` clause. + + We fix this by removing the assertion so that the function + returns false, instead. + (Bug #32611913) +* [`SELECT`](/doc/refman/8.0/en/select.html) using + `DISTINCT` with a `GROUP BY ... WITH + ROLLUP` on a primary key column returned a different + result than when the column was not a primary key. + (Bug #32565875) +* When an item in the [`SELECT`](/doc/refman/8.0/en/select.html) list + came from a table that was found to be constant, it was possible + to add caches around it before adding `ROLLUP` + wrappers, causing it to be unfindable in the group list (which + had no such wrappers). This is addressed by unwrapping the + caches. + (Bug #32559356) +* The C client library could produce a Malformed + communication packet error if a prepared statement + parameter was longer than 8KB and the next parameter represented + a `NULL` value. + (Bug #32558782) +* When comparing arguments of different types, and the arguments + are deemed constants, the server may insert its own hidden item + cache to save on repeated conversion (and possible warnings). + This is not visible in the output of any statements such as + [`EXPLAIN`](/doc/refman/8.0/en/explain.html). + + An issue arose due to the fact that resolution of + `ROLLUP` runs after the comparisons are set up, + and may replace the arguments, which could lead to incorrect + results from comparisons. Now when this happens, we signal that + the comparison needs to reconsider its caches, and not possibly + re-use stale values. + (Bug #32548377) +* Incorrect reference counting for a destructor in the + implementation of a loadable function could raise an assertion + for debug builds or report that the function does not exist for + nondebug builds. + (Bug #32528898, Bug #102649) +* MySQL source distributions now bundle the Google Test source + code, which no longer need be downloaded to run Google + Test-based unit tests. Consequently, the + [`WITH_GMOCK`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_gmock) and + [`ENABLE_DOWNLOADS`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_enable_downloads) + **CMake** options have been removed and are + ignored if specified. + + This change also corrects a couple of build issues whereby + source distributions incorrectly included an empty + `source_downloads` directory, and + **CMake** did not fail when + [`WITH_UNIT_TESTS`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_unit_tests) was enabled but + the Google Test source was not found. (For the latter issue, it + can no longer occur because the source is always present.) + (Bug #32512077, Bug #27326599, Bug #29935278) +* When outer batched key access and block-nested loop (or hash + join) occurred together in a query, both were reverted to nested + loops in the plan interpretation to access paths. Problems arose + in some cases in which non-equality join conditions had been + pushed to a special kind of BKA index condition, and by + converting to a regular index lookup (which does not check the + BKA condition), it was possible to drop conditions that should + have been checked. + + We fix this by removing the BKA index condition; since its use + is very rare, potential gains in most practical queries are very + low, and removing it decreases complexity significantly. + (Bug #32424884) +* [`SHOW CREATE USER`](/doc/refman/8.0/en/show-create-user.html) could cause an + unexpected server exit if the structure of the + `mysql.user` system table was manually altered. + (Bug #32417780, Bug #31654586) +* For large values of the + [`group_concat_max_len`](/doc/refman/8.0/en/server-system-variables.html#sysvar_group_concat_max_len) system + variable, prepared statements that used the + [`GROUP_CONCAT()`](/doc/refman/8.0/en/aggregate-functions.html#function_group-concat) function could be + unnecessarily re-prepared across executions. + (Bug #32413530, Bug #102344) +* Changes were not properly rolled back on re-execution of + prepared statements or stored procedures for which walk and + replace was performed as part of optimization. + (Bug #32384324, Bug #32573871) +* Client programs using the asynchronous C API functions could + leak memory if a connection timeout occurred. Thanks to Facebook + for a contribution used in fixing this issue. + (Bug #32372038, Bug #102189, Bug #32800091, Bug #103409, Bug #33171164, Bug #104461) +* The dynamic statistics cache exposed by the + `INFORMATION_SCHEMA` could be updated in the + middle of a transaction before it was known whether the + transaction would commit, potentially caching information + corresponding to no committed state. + (Bug #32338335) +* Repreparation of a prepared statement at the beginning of an + implicit transaction could cause an + [`ER_GTID_NEXT_TYPE_UNDEFINED_GROUP`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_gtid_next_type_undefined_group) + error. + (Bug #32326510, Bug #102031) +* `USING HASH` was removed from the definitions + of Performance Schema thread pool tables because the Performance + Schema does not support hash indexes. + (Bug #32194617) +* Inserting a datetime literal with an explicit time zone offset + into a `TIMESTAMP` column could produce the + wrong time if [`time_zone=SYSTEM`](/doc/refman/8.0/en/server-system-variables.html#sysvar_time_zone) + and the system time zone has DST transitions. + (Bug #32173664, Bug #101670) +* While setting up `ORDER BY` for a window + function, a window definition including a subquery was removed + along with the subquery in the `ORDER BY`. + (Bug #32103260) +* The use of a `SET PERSIST` or `SET + PERSIST_ONLY` statement is now disallowed for the + [`group_replication_force_members`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_force_members) + system variable. This system variable must be cleared after use + before you can issue a `START + GROUP_REPLICATION` statement, so it should not be + persisted to the MySQL server instance’s option file. + (Bug #31983203) +* Upgrades from MySQL 5.7 to 8.0 failed if the MySQL installation + had `FEDERATED` tables. + (Bug #31973053) +* Persisting component-related system variables could result in + unnecessary “unknown variable” error messages. + (Bug #31968366) +* An out-of-memory error occurred when loading large amounts of + data into tables with full-text search indexes. Not all of the + memory allocated to the full-text search cache was accounted for + when inserting data into the full-text search auxiliary tables. + (Bug #31576731) +* The precision for a [`UNION`](/doc/refman/8.0/en/union.html) between + integer and decimal values could be calculated incorrectly, + leading to truncation of the integer in the result. + (Bug #31348202, Bug #99567) +* `InnoDB` wrote unnecessary warnings to the + error log indicating that table statistics could not be + calculated. + (Bug #30865032) +* A secondary index over a virtual column became corrupted when + the index was built online. + + For [`UPDATE`](/doc/refman/8.0/en/update.html) statements, we fix + this as follows: If the virtual column value of the index record + is set to `NULL`, then we generate this value + from the cluster index record. + (Bug #30556595) +* [`DROP DATABASE`](/doc/refman/8.0/en/drop-database.html) for a database with + a large number of tables (one million) could result in an + out-of-memory condition. + (Bug #29634540) +* The [`system_time_zone`](/doc/refman/8.0/en/server-system-variables.html#sysvar_system_time_zone) system + variable is initialized at server startup from the server host + settings and the **mysqld** environment, but if + the server host time zone changed (for example, due to daylight + saving time), [`system_time_zone`](/doc/refman/8.0/en/server-system-variables.html#sysvar_system_time_zone) + did not reflect the change. Now it does. + (Bug #29330089, Bug #94257) +* For upgrades on Ubuntu, if an existing + `my.cnf` file is found, it is renamed to + `my.cnf.bak` and a warning is issued. + (Bug #24486556, Bug #82639) +* Boolean system variables could be assigned a negative value. + (Bug #11758439, Bug #50643) +* Prepared statements did not always make use of index extensions + (see [Use of Index Extensions](/doc/refman/8.0/en/index-extensions.html)). + (Bug #103711, Bug #32897525) + + References: See also: Bug #103710, Bug #32897503. +* When enabled, the + [`prefer_ordering_index`](/doc/refman/8.0/en/switchable-optimizations.html#optflag_prefer-ordering-index) + optimizer switch had a negative effect on the performance of + prepared statements. + (Bug #103710, Bug #32897503) + + References: See also: Bug #103711, Bug #32897525. +* Successive [`INSERT()`](/doc/refman/8.0/en/string-functions.html#function_insert) function + calls could sometimes yield invalid `NULL` + results. + (Bug #103513, Bug #32824978) +* Some `NOT IN` subqueries did not return correct + results due to a regression in `NULL` handling. + (Bug #103331, Bug #32773801) + + References: This issue is a regression of: Bug #30473261. +* Whenever a [`SELECT ... + FOR UPDATE NOWAIT`](/doc/refman/8.0/en/select.html) statement was unable to obtain a + record lock, a message Got error 203 when reading + table ... was written to the error log, even though + though this is a relatively common occurrence, the logging of + which led to excessive use of disk space. + + Our thanks to Brian Yue for this contribution. + (Bug #103159, Bug #32705614) +* `0 - (MAX(BIGINT) + 1)` returned + `-(MAX(BIGINT) + 1)`. Now an out of range error + is returned instead. + (Bug #103093, Bug #32693863) diff --git a/corpus/changelog/mysql_releases/mysql_8027.md b/corpus/changelog/mysql_releases/mysql_8027.md new file mode 100644 index 0000000000000000000000000000000000000000..3a1e7bcf81a474d10066ca0c849686b015fadc2d --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8027.md @@ -0,0 +1,1733 @@ +# MySQL 8.0.27 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-27.html +Version: 8.0.27 + +## Changes in MySQL 8.0.27 (2021-10-19, General Availability) + +* [Audit Log Notes](news-8-0-27.html#mysqld-8-0-27-audit-log "Audit Log Notes") +* [Authentication Notes](news-8-0-27.html#mysqld-8-0-27-authentication "Authentication Notes") +* [Character Set Support](news-8-0-27.html#mysqld-8-0-27-charset "Character Set Support") +* [Compilation Notes](news-8-0-27.html#mysqld-8-0-27-compiling "Compilation Notes") +* [Connection Management Notes](news-8-0-27.html#mysqld-8-0-27-connection-management "Connection Management Notes") +* [Data Type Notes](news-8-0-27.html#mysqld-8-0-27-data-types "Data Type Notes") +* [Deprecation and Removal Notes](news-8-0-27.html#mysqld-8-0-27-deprecation-removal "Deprecation and Removal Notes") +* [Storage Engine Notes](news-8-0-27.html#mysqld-8-0-27-engines "Storage Engine Notes") +* [Firewall Notes](news-8-0-27.html#mysqld-8-0-27-firewall "Firewall Notes") +* [SQL Function and Operator Notes](news-8-0-27.html#mysqld-8-0-27-functions-operators "SQL Function and Operator Notes") +* [Keyring Notes](news-8-0-27.html#mysqld-8-0-27-keyring "Keyring Notes") +* [Optimizer Notes](news-8-0-27.html#mysqld-8-0-27-optimizer "Optimizer Notes") +* [Performance Schema Notes](news-8-0-27.html#mysqld-8-0-27-performance-schema "Performance Schema Notes") +* [Pluggable Authentication](news-8-0-27.html#mysqld-8-0-27-pluggable-auth "Pluggable Authentication") +* [Security Notes](news-8-0-27.html#mysqld-8-0-27-security "Security Notes") +* [Server Administration](news-8-0-27.html#mysqld-8-0-27-server-admin "Server Administration") +* [Spatial Data Support](news-8-0-27.html#mysqld-8-0-27-spatial-support "Spatial Data Support") +* [Functionality Added or Changed](news-8-0-27.html#mysqld-8-0-27-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-27.html#mysqld-8-0-27-bug "Bugs Fixed") + +### Audit Log Notes + +* A [`CREATE USER`](/doc/refman/8.0/en/create-user.html) statement + `BY 'auth_string'` + clause was written to the audit log and general query log as an + `AS 'auth_string'` + clause. + (Bug #33184550) + +### Authentication Notes + +* Previously, MySQL user accounts authenticated to the server + using a single authentication method. MySQL now supports + multifactor authentication (MFA), which makes it possible to + create accounts that have up to three authentication methods. + MFA support entails these changes: + + + [`CREATE USER`](/doc/refman/8.0/en/create-user.html) and + [`ALTER USER`](/doc/refman/8.0/en/alter-user.html) syntax has been + extended to permit specification of multiple authentication + methods. + + The [`authentication_policy`](/doc/refman/8.0/en/server-system-variables.html#sysvar_authentication_policy) + system variable enables MFA policy to be established by + controlling how many factors can be used and the types of + authentication permitted for each factor. This places + constraints on how the authentication-related clauses of + [`CREATE USER`](/doc/refman/8.0/en/create-user.html) and + [`ALTER USER`](/doc/refman/8.0/en/alter-user.html) statements may be + used. + + Client programs have new + [`--password1`](/doc/refman/8.0/en/connection-options.html#option_general_password1), + [`--password2`](/doc/refman/8.0/en/connection-options.html#option_general_password2), and + [`--password3`](/doc/refman/8.0/en/connection-options.html#option_general_password3) command-line + options for specifying multiple passwords. For applications + that use the C API, the new + `MYSQL_OPT_USER_PASSWORD` option for the + [`mysql_options4()`](/doc/c-api/8.0/en/mysql-options4.html) C API + function enables the same capability. + + In addition, MySQL Enterprise Edition now supports authentication to MySQL Server + using devices such as smart cards, security keys, and biometric + readers. This authentication method is based on the Fast + Identity Online (FIDO) standard, and uses a pair of plugins, + `authentication_fido` on the server side and + `authentication_fido_client` on the client + side. The server-side FIDO authentication plugin is included + only in MySQL Enterprise Edition distributions. + + Multifactor authentication can use existing MySQL authentication + methods, the new FIDO authentication method, or a combination of + both. For more information, see + [Multifactor Authentication](/doc/refman/8.0/en/multifactor-authentication.html). + (Bug #33159968, WL #14183) +* In cases where an authentication plugin performed no hashing of + the authentication string, [`CREATE + USER`](/doc/refman/8.0/en/create-user.html) statements with a `BY + 'auth_string'` clause failed + with an error. + (Bug #33125289) + +### Character Set Support + +* Regular expression functions now report an error when an + expression or pattern cannot be converted to a character set + which is suitable for the ICU regular expression engine. + + In addition, error checking in several geometry functions has + been improved. + (Bug #33290245) +* The [`gen_dictionary()`](/doc/refman/8.0/en/data-masking-component-functions.html#function_gen-dictionary) function now + takes `latin1` as the character set of its + argument, and returns the same character set. + (Bug #30389649) +* Otherwise identical strings, using, respectively, the ASCII + (collation `ascii_general_ci`) and UCS2 + (collation `ucs2_general_ci`) character sets + did not match as expected in join conditions. + (Bug #104571, Bug #33204161) + + References: See also: Bug #24847620, Bug #30746908, Bug #32244631, Bug #32501472. +* Given the default collation `c1` of a character + set `cs`, and a different collation + `c2` (that is, not equal to + `c1`), then the statement + [`CREATE DATABASE + d COLLATE c2 CHARACTER SET cs`](/doc/refman/8.0/en/create-database.html) created a new database + with the default collation set to `c1` instead + of `c2`. + (Bug #104504, Bug #33183590) + +### Compilation Notes + +* **InnoDB:** + A workaround was implemented for a Clang issue that causes a + build failure on Windows + ([Bugzilla + – Bug 51538](https://bugs.llvm.org/show_bug.cgi?id=51538)). + (Bug #33217633) +* MySQL now can be compiled using C++17. The following minimum + version requirements apply for compiler support: + + + GCC 7.1 or Clang 5 (Linux) + + XCode 10 (macOS) + + GCC 10 (Solaris) + + Visual Studio 2019 Update 4 (Windows) + + In particular, on Solaris, GCC is now the only supported + compiler. The code has been cleaned up to remove adaptations and + workarounds for Sun Studio, Oracle Studio, and SunPro. + (Bug #32907274, Bug #103757, Bug #32907475, Bug #32992125, Bug #32992242, Bug #33004840, Bug #33086882) + +### Connection Management Notes + +* Previously, if the server restricted a client to the sandbox + mode used to handle client connections for accounts with expired + passwords, the client could use the + [`SET`](/doc/refman/8.0/en/set-variable.html) + statement. This is no longer permitted. For more information + about sandbox mode, see + [Server Handling of Expired Passwords](/doc/refman/8.0/en/expired-password-handling.html). + (Bug #16369085, WL #13214) + +### Data Type Notes + +* [`YEAR`](/doc/refman/8.0/en/year.html) values were not always + interpreted correctly. + (Bug #33142669) + + References: This issue is a regression of: Bug #31994744. + +### Deprecation and Removal Notes + +* **Important Change:** + The + [`default_authentication_plugin`](/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin) + variable is deprecated as of MySQL 8.0.27; expect support for it + to be removed in a future version of MySQL. + + The + [`default_authentication_plugin`](/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin) + variable is still used in MySQL 8.0.27, but in conjunction with + and at a lower precedence than the new + `authentication_policy` system variable, which + is introduced in MySQL 8.0.27 with the multifactor + authentication feature. For details, see + [The Default Authentication Plugin](/doc/refman/8.0/en/pluggable-authentication.html#pluggable-authentication-default-plugin). + (Bug #27515356, WL #14138) +* **Important Change:** + The [`BINARY`](/doc/refman/8.0/en/cast-functions.html#operator_binary) operator is now + deprecated, and subject to removal in a future release of MySQL. + Use of `BINARY` now causes a warning. Use + [`CAST(... AS BINARY)`](/doc/refman/8.0/en/cast-functions.html#function_cast) instead. + (WL #13619) + +### Storage Engine Notes + +* The [`BLACKHOLE`](/doc/refman/8.0/en/blackhole-storage-engine.html) storage engine + maximum key length has been increased from 1000 to 3072 bytes + (the same as `InnoDB`). Thanks to Adam Cable + for the contribution. + (Bug #32788749, Bug #103371) + +### Firewall Notes + +* The new [`FIREWALL_EXEMPT`](/doc/refman/8.0/en/privileges-provided.html#priv_firewall-exempt) privilege + exempts a user from firewall restrictions. This is useful, for + example, for any database administrator who configures the + firewall, to avoid the possibility of a misconfiguration causing + even the administrator to be locked out and unable to execute + statements. See [MySQL Enterprise Firewall](/doc/refman/8.0/en/firewall.html). + (WL #14517) + +### SQL Function and Operator Notes + +* The [`SPACE()`](/doc/refman/8.0/en/string-functions.html#function_space) function did not + handle certain large or unsigned values correctly. + (Bug #33180446) +* Function arguments were not always evaluated correctly during + resolution of functions defined within views. + (Bug #33142010) + + References: This issue is a regression of: Bug #29904087. +* Bit functions in window expressions assert that the runtime size + of a bit mask is not bigger than its resolve time size. We found + several violations of this rule, listed here: + + + [`ENCRYPT()`](/doc/refman/5.7/en/encryption-functions.html#function_encrypt) sometimes computed + the maximum size of the result incorrectly. + + [`CONVERT()`](/doc/refman/8.0/en/cast-functions.html#function_convert), + [`CONCAT()`](/doc/refman/8.0/en/string-functions.html#function_concat), + [`CONCAT_WS()`](/doc/refman/8.0/en/string-functions.html#function_concat-ws), + [`EXPORT_SET()`](/doc/refman/8.0/en/string-functions.html#function_export-set), + [`INSERT()`](/doc/refman/8.0/en/string-functions.html#function_insert), + [`REPLACE()`](/doc/refman/8.0/en/string-functions.html#function_replace), and + [`WEIGHT_STRING()`](/doc/refman/8.0/en/string-functions.html#function_weight-string) did not + compute the maximum result length properly for the binary + character set. + + During resolution of + `REPLACE(str, + from_str, + to_str)` we assumed that + the entire length of *`from_str`* + would be replaced for each match in + *`str`*, but since + *`from_str`* may be only 1 character + long, it is possible for *`str`* to + be replaced with multiple copies of + *`to_str`*. + + [`COMPRESS()`](/doc/refman/8.0/en/encryption-functions.html#function_compress) computed the + maximum result length in an arbitrary fashion. Now we use + `compressBound` from the + `zlib` library instead. + + (Bug #32922688, Bug #33117410, Bug #33275424) + + References: See also: Bug #33516898. + +### Keyring Notes + +* Diagnostics for `keyring_hashicorp` plugin + configuration issues have been improved. + (Bug #32075854) + +### Optimizer Notes + +* [`EXPLAIN + FORMAT=TREE`](/doc/refman/8.0/en/explain.html#explain-execution-plan) now shows more precise information than + displayed previously about scans generated by the range + optimizer. In particular, sub-iterators are now displayed + explicitly, and are properly timed with + [`EXPLAIN ANALYZE`](/doc/refman/8.0/en/explain.html#explain-analyze); index range + scans now show the actual ranges being scanned. Descriptions in + the output are also more user-friendly than before; for example, + `index_for_group_by` shown for a query using + `DISTINCT` is replaced by `index skip + scan for deduplication`. + + In addition, a roundoff error causing inaccuracies in row count + estimation for read over range intersection scans has been + corrected, and optimizer traces for index range scans now + correctly displays implicit key parts from + [`InnoDB`](/doc/refman/8.0/en/innodb-storage-engine.html) primary keys when they are + used. + (Bug #33037007, Bug #33062448) +* When transforming `EXISTS` to a semijoin, and + when the query contained a view reference, the query was not + processed correctly. + (Bug #32813550) + + References: This issue is a regression of: Bug #30671329. +* In the case of a lateral derived table, if the creation of the + cache invalidator was delayed, the table materialization was + emitted without the invalidator, which kept rematerialization + from occurring during execution and led to wrong results. + + The pending cache invalidator was emitted only when the index of + the lateral table was less than that of the last table in the + table list being considered. When the table index of the pending + invalidator was equal to the last table of the join slice, the + cache invalidator was skipped and the materialization was + emitted without the invalidator. + + We fix this by creating the pending cache invalidator if the + table index of the pending invalidator is less than or equal to + that of the last table in the table list of the current join + slice. + (Bug #32407774) + +### Performance Schema Notes + +* To assist monitoring and troubleshooting, the Performance Schema + instrumentation is now used to export names of instrumented + threads to the operating system. This enables utilities that + display thread names, such as debuggers and the Unix + **ps** command, to display distinct + **mysqld** thread names rather than + “mysqld”. This feature is supported only on Linux, + macOS, and Windows. For more information, see + [The setup\_instruments Table](/doc/refman/8.0/en/performance-schema-setup-instruments-table.html). + (WL #14587) + +### Pluggable Authentication + +* **Microsoft Windows:** + The Kerberos authentication method added in MySQL 8.0.26 for + MySQL server and client hosts running Linux is now supported on + the client side for Windows. This enables MySQL client + applications running on Windows to connect to MySQL accounts on + Linux server hosts that authenticate using Kerberos. For + details, see + [Kerberos Pluggable Authentication](/doc/refman/8.0/en/kerberos-pluggable-authentication.html). + (WL #14605) + +### Security Notes + +* For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 1.1.1l. Issues fixed in the new OpenSSL version are described at + and at + . + (Bug #33273138, Bug #33309871) + +### Server Administration + +* Setting the session value of the following system variables is + now a restricted operation and the session user must have + privileges sufficient to set restricted session variables: + + + [`low_priority_updates`](/doc/refman/8.0/en/server-system-variables.html#sysvar_low_priority_updates) + + [`max_delayed_threads`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_delayed_threads) + + [`max_error_count`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_error_count) + + [`min_examined_row_limit`](/doc/refman/8.0/en/server-system-variables.html#sysvar_min_examined_row_limit) + + [`preload_buffer_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_preload_buffer_size) + + [`select_into_buffer_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_select_into_buffer_size) + + [`select_into_disk_sync_delay`](/doc/refman/8.0/en/server-system-variables.html#sysvar_select_into_disk_sync_delay) + + [`show_old_temporals`](/doc/refman/8.0/en/server-system-variables.html#sysvar_show_old_temporals) + + For information about the privileges required to set restricted + session variables, see + [System Variable Privileges](/doc/refman/8.0/en/system-variable-privileges.html). + (WL #14695) + +### Spatial Data Support + +* The [`ST_SymDifference()`](/doc/refman/8.0/en/spatial-operator-functions.html#function_st-symdifference) and + [`ST_Intersection()`](/doc/refman/8.0/en/spatial-operator-functions.html#function_st-intersection) functions now + permit the geometry arguments to have a geographic spatial + reference system (SRS). Previously, + [`ST_SymDifference()`](/doc/refman/8.0/en/spatial-operator-functions.html#function_st-symdifference) and + [`ST_Intersection()`](/doc/refman/8.0/en/spatial-operator-functions.html#function_st-intersection) supported only + geometry arguments in a Cartesian SRS. See + [Spatial Operator Functions](/doc/refman/8.0/en/spatial-operator-functions.html). + (WL #10996, WL #14273) + +### Functionality Added or Changed + +* **Important Change; Group Replication:** + The system variable + [`group_replication_components_stop_timeout`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_components_stop_timeout) + specifies the time that Group Replication waits for each of its + modules to complete ongoing processes while shutting down. The + component timeout applies after a [`STOP + GROUP_REPLICATION`](/doc/refman/8.0/en/stop-group-replication.html) statement is issued, which happens + automatically during server restart or auto-rejoin. The timeout + is used to resolve situations in which Group Replication + components cannot be stopped normally, which might happen if the + member is expelled from the group while it is in an error state, + or while a process such as MySQL Enterprise Backup holds a global lock on tables + on the member. In such situations, the member cannot stop the + applier thread or complete the distributed recovery process to + rejoin. The `STOP GROUP_REPLICATION` statement + does not complete until either the situation is resolved (for + example, by the lock being released), or the component timeout + expires and the modules are shut down regardless of their + status. + + Previously, the timeout value defaulted to 31536000 seconds (365 + days), which did not help in situations such as those just + described. The new default value is 300 seconds, so that Group + Replication components are stopped after 5 minutes if the + situation is not resolved before that time, allowing the member + to be restarted and to rejoin. + (WL #14245) + + References: See also: Bug #31460690, Bug #31648211, Bug #32309647. +* **Replication:** + When GTID-based replication is in use on a replica server, the + replication applier and receiver threads still track and have + some dependencies on binary log file names and file positions, + as used for the alternative binary log file position based + replication. A new option for the [`CHANGE + REPLICATION SOURCE TO`](/doc/refman/8.0/en/change-replication-source-to.html) statement, + `GTID_ONLY`, removes the persistence of file + names and file positions from the replication metadata + repositories. For replication channels with this setting, + in-memory file positions are still tracked, and file positions + can still be observed for debugging purposes in error messages + and through interfaces such as [`SHOW REPLICA + STATUS`](/doc/refman/8.0/en/show-replica-status.html) statements (where they are shown as being + invalid if they are out of date). However, the writes and reads + required to persist and check the file positions are avoided in + situations where GTID-based replication does not actually + require them, including the transaction queuing and application + process. The GTID\_ONLY setting also means that the replication + metadata is flushed less frequently. + + The `GTID_ONLY` option is disabled by default + for asynchronous replication channels, but it is enabled by + default for group replication channels, and it cannot be + disabled for them. To set `GTID_ONLY = 1` for a + replication channel, GTIDs must be in use on the server + (`gtid_mode = ON`), and row-based binary + logging must be in use on the source (statement-based + replication is not supported). The `CHANGE REPLICATION + SOURCE TO` options + `REQUIRE_ROW_FORMAT` and + `SOURCE_AUTO_POSITION` must each be set to 1 + for the replication channel. When `GTID_ONLY` + is set to 1, the replica uses + `replica_parallel_workers=1` if that system + variable is set to zero for the server, so it is always + technically a multi-threaded applier. This is because a + multi-threaded applier uses saved positions rather than the + replication metadata repositories to locate the start of a + transaction that it needs to reapply. + + Thanks to Facebook for offering a contribution related to this + issue. + (Bug #94360, Bug #29364334, WL #7491) +* **Replication:** + Multithreading is now enabled by default for replica servers. A + multithreaded applier has a number of applier threads that + execute transactions in parallel. This behavior can avoid many + cases of unwanted replication lag that can cause temporary + divergence between the source and replicas. + + The following default server settings are used to produce the + multithreading behavior: + + + [`replica_parallel_workers=4`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_replica_parallel_workers). + This setting enables multithreading and creates four applier + threads on the replica, plus a coordinator thread to manage + them. If you are using multiple replication channels, each + channel has this number of threads. Four applier threads + provide a base level of parallelism, and you can change the + setting to specify up to 1024 applier threads. + + [`replica_preserve_commit_order=1`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_replica_preserve_commit_order). + This setting ensures that transactions are externalized on + the replica in the same order as they appear in the + replica's relay log, so the replica never enters a state + that the master was not in, and there are no gaps in the + sequence of transactions that have been executed from the + relay log. + + [`replica_parallel_type=LOGICAL_CLOCK`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_replica_parallel_type). + This setting specifies that transactions that are part of + the same binary log group commit on a replication source + server are applied in parallel on a replica. It is required + when + [`replica_preserve_commit_order=1`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_replica_preserve_commit_order) + is set. + + To override the new defaults and disable multithreading for a + replica server, specify + [`replica_parallel_workers=0`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_replica_parallel_workers). + This setting disables parallel execution and gives the replica a + single applier thread and no coordinator thread. When you apply + this setting, the + [`replica_parallel_type`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_replica_parallel_type) and + [`replica_preserve_commit_order`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_replica_preserve_commit_order) + options have no effect and are ignored. + (WL #10475) +* **Group Replication:** + The asynchronous connection failover mechanism for MySQL + replication now enables a replica that is part of a managed + replication group to automatically reconnect to the sender if + the current receiver (the primary of the group) fails. The new + feature works with Group Replication, on a group configured in + single-primary mode, where the group’s primary is a replica + that has a replication channel with + `SOURCE_CONNECTION_AUTO_FAILOVER` set to + `ON`. The feature operates by default on a + group in this situation, although you can disable it for the + group by disabling the new member action + `mysql_start_failover_channels_if_primary`, + using the + `group_replication_disable_member_action()` + function. The feature is designed for a group of senders and a + group of receivers to keep synchronized with each other even + when some members are temporarily unavailable. It also + synchronizes a group of receivers with one or more senders that + are not part of a managed group. A replica that is not part of a + replication group cannot use this feature. + + To configure this feature, the replication channel and the + replication user account and password for the channel must be + set up on all the member servers in the replication group, and + on any new joining members. You can do this using the + [`CHANGE REPLICATION SOURCE TO`](/doc/refman/8.0/en/change-replication-source-to.html) + statement, or if the new servers are provisioned using MySQL’s + clone functionality, this all happens automatically. The + `SOURCE_CONNECTION_AUTO_FAILOVER` setting for + the channel is broadcast to group members from the primary when + they join, and also if it is changed. The source list is + broadcast to all members when they join or when it is updated. + If the primary goes offline or into an error state, the new + primary that is selected for the group has the source list and + the channel configuration already in place, and establishes a + replacement asynchronous replication connection with the source. + + A new function + `asynchronous_connection_failover_reset()` is + also provided for administrators to remove all settings relating + to the asynchronous connection failover mechanism. Use this + function to clean up a server that is no longer being used in a + managed group. + (WL #14020) +* **Group Replication:** + The group communication engine for Group Replication (XCom, a + Paxos variant) defaults to using every member of the group as a + leader. When the Group Replication communication protocol + version is set to 8.0.27 or later, the group communication + engine can now use a single leader to drive consensus when the + group is in single-primary mode. Operating with a single + consensus leader improves performance and resilience in + single-primary mode, particularly when some of the group’s + secondary members are currently unreachable. + + The single consensus leader is colocated with the group’s + primary, and changes when a new primary is elected. The + Performance Schema table + `replication_group_communication_information` + shows the preferred and actual consensus leader, or leaders if + all members are used as a leader, the communication protocol + version, and the write concurrency. + + To enable the new behavior, set the system variable + [`group_replication_paxos_single_leader`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_paxos_single_leader) + to `ON` (the default is + `OFF`). When Group Replication is running in + multi-primary mode, or with earlier communication protocol + versions, or when + `group_replication_paxos_single_leader` is set + to `OFF`, the group communication engine + operates using every member of the group as a leader. + + Note that when you manually upgrade the members of a replication + group to a new MySQL Server release, the group's communication + protocol version is not automatically upgraded to match. If you + no longer need to support members at earlier releases, you can + use the + `group_replication_set_communication_protocol()` + function to set the communication protocol version to the new + MySQL Server version to which you have upgraded the members. + MySQL InnoDB Cluster manages the communication protocol version + automatically for replication groups created using that + function. + (WL #9149) +* **Group Replication:** + In previous releases, Group Replication secured group + communication connections and distributed recovery connections + between members using its own implementation of the security + protocols, including TLS/SSL and the use of an allowlist for + incoming Group Communication System (GCS) connections. + Replication groups can now use the MySQL Server's own connection + security in place of the Group Replication implementation. Using + the MySQL protocol means that standard methods of user + authentication can be used for granting (or revoking) access to + the group in place of the allowlist, and that the latest + functionality of the server's protocol is always available on + release. Network namespaces are supported for Group Replication + when the MySQL communication stack is used. + + To use the MySQL Server's implementation of the connection + security management in place of the Group Replication + implementation, set the new system variable + [`group_replication_communication_stack`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_communication_stack) + to `MYSQL`. In addition, the network address + set by + [`group_replication_local_address`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_local_address) + for each group member must be changed to one of the IP addresses + and ports which MySQL Server is listening on, as specified by + [`bind_address`](/doc/refman/8.0/en/server-system-variables.html#sysvar_bind_address). If a network + namespace is used, this must be configured using the + [`CHANGE REPLICATION SOURCE TO`](/doc/refman/8.0/en/change-replication-source-to.html) + statement in the `group_replication_recovery` + channel. + + Authentication is carried out using the existing replication + user account that Group Replication uses for distributed + recovery, as set using `CHANGE REPLICATION SOURCE + TO`, and this user must be given the new + [`GROUP_REPLICATION_STREAM`](/doc/refman/8.0/en/privileges-provided.html#priv_group-replication-stream) + privilege. The TLS/SSL configuration for the connection is taken + from Group Replication's existing settings for securing + distributed recovery, plus the + [`group_replication_ssl_mode`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_ssl_mode) + system variable that specifies whether TLS/ SSL is enabled or + disabled for group communications. These settings must be + configured if they are not already in place. All these settings + must be the same on all group members to avoid communication + issues. + + As part of this work, the default value for the + [`performance_schema_max_cond_classes`](/doc/refman/8.0/en/performance-schema-system-variables.html#sysvar_performance_schema_max_cond_classes) + system variable is increased from 100 to 150. + + See [Group Replication Requirements For The MySQL Communication Stack](/doc/refman/8.0/en/group-replication-connection-security.html#group-replication-configure-mysql-stack) + for more details. + (WL #9852) +* Programs that encounter issues while processing + `include` or `includedir` + directives in option files now produce error messages that are + more informative about the cause of the errors. + (Bug #32798288, Bug #103397) +* The default value for the + [`thread_stack`](/doc/refman/8.0/en/server-system-variables.html#sysvar_thread_stack) system variable + has been increased to 1048576 on all supported platforms. + (Bug #103912, Bug #32965326) + + References: See also: Bug #32934187. +* A default time zone can now be set for a server by using the + server option [`--default-time-zone`](/doc/refman/8.0/en/server-options.html#option_mysqld_default-time-zone) + while starting a MySQL Server Docker container. Before, the + container failed to start if the option was used. + (WL #14703) +* For online DDL operations, storage is usually the bottleneck. To + address this issue, CPU utilization and index building has been + improved. Indexes can now be built simultaneously instead of + serially. Memory management has also been tightened to respect + memory configuration limits set by the user. See + [Configuring Parallel Threads for Online DDL Operations](/doc/refman/8.0/en/online-ddl-parallel-thread-configuration.html). + + The new [`innodb_ddl_threads`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_ddl_threads) + variable defines the maximum number of parallel threads for the + sort and build phases of index creation. + + The new [`innodb_ddl_buffer_size`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_ddl_buffer_size) + variable defines the maximum buffer size for DDL operations. The + default setting is 1048576 bytes (approximately 1 MB). Defining + a buffer size limit avoids potential out of memory errors for + online DDL operations that create or rebuild secondary indexes. + See [Online DDL Memory Management](/doc/refman/8.0/en/online-ddl-memory-management.html). + (WL #14283) +* The clone plugin now permits concurrent DDL operations on the + donor MySQL Server instance while a cloning operation is in + progress. Previously, a backup lock was held during the cloning + operation, preventing concurrent DDL on the donor. To revert to + the previous behavior of blocking concurrent DDL on the donor + during a clone operation, enable the + [`clone_block_ddl`](/doc/refman/8.0/en/clone-plugin-options-variables.html#sysvar_clone_block_ddl) variable. See + [Cloning and Concurrent DDL](/doc/refman/8.0/en/clone-plugin-concurrent-ddl.html). + (WL #9683) +* Setting a session value for the + [`internal_tmp_mem_storage_engine`](/doc/refman/8.0/en/server-system-variables.html#sysvar_internal_tmp_mem_storage_engine) + variable now requires the + [`SESSION_VARIABLES_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_session-variables-admin) or + [`SYSTEM_VARIABLES_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_system-variables-admin) privilege. + (WL #14728) + +### Bugs Fixed + +* **Incompatible Change:** + For all [`SELECT`](/doc/refman/8.0/en/select.html) statements on a + view, the query digest was based on the view definition. As a + result, different queries had the same digest and aggregated + together in the Performance Schema table + [`events_statements_summary_by_digest`](/doc/refman/8.0/en/performance-schema-statement-summary-tables.html), + so statistics in that table were not usable for distinguishing + distinct [`SELECT`](/doc/refman/8.0/en/select.html) statements. + + The query digest for each [`SELECT`](/doc/refman/8.0/en/select.html) + statement on a view now is based on the + [`SELECT`](/doc/refman/8.0/en/select.html), not the view definition. + This enables distinguishing distinct + [`SELECT`](/doc/refman/8.0/en/select.html) statements in the + [`events_statements_summary_by_digest`](/doc/refman/8.0/en/performance-schema-statement-summary-tables.html) + table. However, tools that use query digests may need some + adjustment to account for this change. For example, MySQL Enterprise Firewall and + query rewrite plugins rely on query digests and existing rules + for them that are associated with views may need to be updated. + (Bug #27540213, Bug #89559, Bug #31761802) +* **Important Change:** + [`EXPLAIN + FORMAT=TREE`](/doc/refman/8.0/en/explain.html) now shows whether an index scan uses a + covering index, and thus does not need to look up other columns + from the table/clustered index. For example, if + `idx1` is a covering index, the old output + `Index scan on t1 using idx1` is now shown as + `Covering index scan on t1 using idx1`. + Previously, this information was shown only for + `FORMAT=TRADITIONAL` and + `FORMAT=JSON`. + + This fix also improves the wording used for full-text search to + align with this change. For example, the old output + `Indexed full text search on t1` (which was the + same in both the covering and non-covering cases) is now + `Full-text index search on t1` when there is no + covering index, and `Full-text covering index search on + t1` when a covering index is used. + (Bug #32825235) +* **InnoDB:** + An excessive number of notes were written to the error log when + the [`innodb_open_files`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_open_files) limit was + temporarily exceeded. + (Bug #33343690) +* **InnoDB:** + An in-place DDL operation failed to flush all modified pages. + (Bug #33290335, Bug #33238133) +* **InnoDB:** + A parallel scan returned an incorrect partition ID when loading + data into MySQL HeatWave from a subpartitioned + `InnoDB` table. + (Bug #33276021) +* **InnoDB:** + The unused `os_event::event_iter` field in the + `InnoDB` sources was removed to reduce memory + use in the `os_event` structure. + + Our thanks to Facebook for the contribution. + (Bug #33252468) +* **InnoDB:** + The `srv_purge_thread` and + `srv_worker_thread` threads were duplicated in + the [`performance_schema.threads`](/doc/refman/8.0/en/performance-schema-threads-table.html) + table. + + Thanks to Kaige Ye for the contribution. + (Bug #33209066, Bug #104575) +* **InnoDB:** + Truncation of an undo tablespace during use by an active + transaction raised an assertion failure. The transaction was + prematurely marked as complete, permitting the truncation + operation. + (Bug #33162828) +* **InnoDB:** + When loading data into MySQL HeatWave from a partitioned table with + concurrent DML modifying the primary key, the partition ID + reported in the load callback was found to be incorrect for some + records. + (Bug #33139692) +* **InnoDB:** + Instances of `MY_ATTRIBUTE((noreturn))` and + `MY_ATTRIBUTE((unused))` in the + `InnoDB` sources were replaced by C++17 + `[[noreturn]]` and + `[[maybe_unused]]` attributes. + (Bug #33112971) +* **InnoDB:** + Each buffer pool block includes a + `block->lock_hash_val` field. Caching of + this value was determined to be unnecessary, as it introduced + unnecessary coupling of the buffer and lock system and + unnecessary memory usage. + (Bug #33072415) +* **InnoDB:** + A query that performed an index merge with retrieval ordered by + row ID raised an assertion failure. The record buffer set up for + the index merge could not be used due to the scanned table + containing a primary key with a BLOB component. A record buffer + cannot be used for reading BLOBs, which are stored outside of + the record. The BLOB primary key was not detected when the + record buffer was set up, as the primary key column was not yet + in the read set. Retrievals ordered by row ID temporarily add + the primary key at a later stage when needed. To address this + issue, a record buffer is no longer requested for row-ordered + retrievals if the primary key has a BLOB component. + (Bug #33067554) +* **InnoDB:** + Deleting or updating a row from a parent table initiated a + cascading `SET NULL` operation on the child + table that set a virtual column value to NULL. The virtual + column value should have been derived from the base column + value. + + Thanks to Yin Peng at Tencent for the contribution. + (Bug #33053297) +* **InnoDB:** + On a system that was nearing disk capacity, an + `InnoDB` recovery operation involving + application of file extension redo log records + (`MLOG_FILE_EXTEND`) could cause a failure. + (Bug #33002492) +* **InnoDB:** + Conflicting explicit locks granted on the same record raised an + assertion failure. + (Bug #33000142) +* **InnoDB:** + Freeing the first page of LOB at the end of purge batch raised + an assertion failure. The failure was due an invalid root page + number. + (Bug #32958624) +* **InnoDB:** + To facilitate failure reporting and resolution, the + `ib::fatal()` function in the + `InnoDB` sources was revised to include the + caller's location. + (Bug #32957311) +* **InnoDB:** + Recovery on the clone recipient server failed with the following + error: Error reading encryption for + innodb\_undo\_007. The encryption key was not written + to encrypted spaces created during the page copy phase of the + clone operation. + (Bug #32950216) +* **InnoDB:** + To avoid generating unwanted warning messages, the + `fil_space_acquire()` function in the + `InnoDB` sources was replaced by the + `fil_space_acquire_silent()` function where + possible. Both functions are used by background threads to + acquire a tablespace. + (Bug #32944543) +* **InnoDB:** + `InnoDB` CRC32 checksum algorithm + implementations have now been optimized for use with ARM and + x86/x64 architectures. + (Bug #32887066) +* **InnoDB:** + Startup on an instance with thousands of tables took an + excessive amount of time due a large amount of traffic on the + error logging subsystem. + (Bug #32846656) +* **InnoDB:** + The [`INFORMATION_SCHEMA.FILES`](/doc/refman/8.0/en/information-schema-files-table.html) view + did not show the current path of the temporary tablespace file, + and the file name shown was different from the one defined by + the + `innodb_temp_data_file_path` + variable. + (Bug #32840635, Bug #103553) +* **InnoDB:** + On Windows, keeping a file open without a shared write lock + while attempting to acquire the `fil_shard` + mutex caused a deadlock with another thread that had acquired + the `fil_shard` mutex and was attempting to + access the same file. + (Bug #32808809) +* **InnoDB:** + Starting a MySQL Server instance using the same + `InnoDB` data files as an another running MySQL + Server instance resulted in an initialization failure. + (Bug #32777654, Bug #103338) +* **InnoDB:** + The `InnoDB` recovery process did not recognize + that page compression had been applied to data that was being + recovered, causing the tablespace data file to increase in size + during the redo log apply phase, which could lead to a recovery + failure for systems approaching a disk-full state. + (Bug #32771259) +* **InnoDB:** + An assert that traversed a list of file segments which were not + full to calculate the number of used pages for comparison with + the number of used pages tracked by a field in the file segment + inode failed sporadically. + (Bug #31685095) +* **InnoDB:** + A transaction failed to roll back when the server was restarted + after failure occurred during an online DDL operation. Table + locks could not be resurrected for the uncommitted transaction + and the data dictionary table object could not be loaded for the + affected table. + + Thanks to Shaohua Wang for the contribution. + (Bug #31131530, Bug #99174) +* **InnoDB:** + A query that used a temporary table for aggregation exhausted + the memory available to the `TempTable` storage + engine, causing an update operation to fail with a table is full + error. + (Bug #31117893, Bug #99100) +* **Replication:** + The replication applier (SQL) thread overrode retryable errors + (such as deadlocks and wait timeouts) from storage engines with + a key not found error, causing + replication to stop without retrying the transaction. These + errors are no longer overridden. + (Bug #33107663) +* **Replication:** + When the Group Replication distributed recovery process + synchronized a joining member with the donor, the Performance + Schema table + [`replication_group_member_stats`](/doc/refman/8.0/en/performance-schema-replication-group-member-stats-table.html) + table was not updated with the current number of transactions + queued on the `group_replication_applier` + channel (the + `COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE` + field.) The count is now tracked while new transactions are + arriving during distributed recovery, although it remains zero + until the joiner has certified the transactions that were + received in the first phase of distributed recovery. + (Bug #33067441) +* **Replication:** + For multithreaded replicas (replicas on which + [`replica_parallel_workers`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_replica_parallel_workers) is set + to a value greater than 0), if + `replica_parallel_workers` is set to 1, the + setting for + [`replica_preserve_commit_order`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_replica_preserve_commit_order) + is now ignored. When there is a single applier, transactions are + always executed and committed in the same order as in the + replica's relay log; ignoring the process to preserve the commit + order avoids potential performance degradation. + (Bug #33048169) +* **Replication:** + An assertion was raised if a replica MySQL Server instance with + unpopulated time zones attempted to replicate a statement that + set a time zone value that was unknown to the replica. Replicas + now handle this situation correctly. + (Bug #32986721) +* **Replication:** + The error messages issued by MySQL Replication when GTIDs + required for auto-positioning have been purged could be + incorrectly assigned or scrambled in some situations. + (Bug #32965864) +* **Replication:** + If a group member was elected as the primary right before or + while it was shutting down, the shutdown process hung while + waiting on the primary election process, which was attempting to + make the server leave the group since the election had failed + due to the shutdown. The error handling process for primary + elections now takes this into account, and does not take any + further actions if the member is already leaving the group. + (Bug #32884709) +* **Replication:** + Querying the Performance Schema table + `replication_asynchronous_connection_failover` + could return an error if a row was deleted during the query + process. In this situation, the row count is now returned as + zero, and the query can be retried. + (Bug #32701593) +* **Replication:** + In some situations, a replica that used connection compression + was not able to re-establish a lost connection to the source + server. The issue has now been fixed. + (Bug #32494609) +* **Group Replication:** + During the Group Replication auto-rejoin procedure, a group + member sets its status to `RECOVERING`. If the + group member does not manage to rejoin, it should change the + status to `ERROR`, but if a view change + occurred in the meantime, it was possible for the status to + remain in `RECOVERING`. The member status is + now set to `ERROR` after an unsuccessful + auto-rejoin procedure, regardless of any ongoing or stuck view + changes. + (Bug #33276418) +* **Group Replication:** + Garbage collection for certification information has been moved + from the Group Replication Group Communication System (GCS) + thread to a background thread, so that sending and receiving of + messages are not blocked while garbage collection is in + progress. + (Bug #33190276) +* **Group Replication:** + When + [`group_replication_consistency`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_consistency) + is `BEFORE_ON_PRIMARY_FAILOVER`, in the event + of a primary failover, client connections are held until the new + primary has the same state as the previous primary. Some + monitoring and administration statements are exempt from this + hold, so that the new primary can be inspected during the + failover process. + + Previously, [`DO`](/doc/refman/8.0/en/do.html) statements had a + blanket exemption from this hold, but now only + `DO` statements that do not use tables or + loadable functions are exempt; this is the same as for + [`SELECT`](/doc/refman/8.0/en/select.html). + (Bug #33130768) +* **Group Replication:** + MySQL Server incorrectly permitted reads from Performance Schema + tables relating to Group Replication while Group Replication was + stopping or restarting, and the data concerned should not have + been used. The server now checks whether Group Replication is in + `OFFLINE` status or uninitialized before + executing the query. + (Bug #33085494) +* **Group Replication:** + When + [`group_replication_consistency`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_consistency) + is set to `BEFORE_ON_PRIMARY_FAILOVER`, in the + event of a primary failover, client connections are held until + the new primary has the same state as the previous primary. Some + monitoring and administration statements are exempt from this + hold, so that the new primary can be inspected during the + failover process. Previously, + [`SHOW`](/doc/refman/8.0/en/show.html) statements had a blanket + exemption from the hold (with the exception of + [`SHOW CREATE USER`](/doc/refman/8.0/en/show-create-user.html)), but now only + `SHOW` statements that do not depend on data + (only on status or configuration) are exempt. See + [Configuring Transaction Consistency Guarantees](/doc/refman/8.0/en/group-replication-configuring-consistency-guarantees.html), + for a complete listing of exempt `SHOW` + statements. + (Bug #33082509) +* **Group Replication:** + A deadlock could occur when a statement referencing Access + Control Lists (ACLs), such as [`CREATE + USER`](/doc/refman/8.0/en/create-user.html), was executed on the primary of a Group + Replication group, and a member joined the group immediately + afterwards before the transaction commit was confirmed by the + other group members. The distributed recovery process needs a + read lock on the ACL cache which is locked by the ACL statement. + This situation blocked Group Replication's Group Communication + System (GCS) thread until the ACL statement timed out, making + the primary unreachable and possibly preventing the new member + from joining. The ACL cache lock is now no longer required for + the distributed recovery process, although the lock in the + situation described is only released after the view change is + complete and the ACL statement is committed. Any new connections + or statements that require the ACL cache lock, including a + member join when Group Replication uses the MySQL communication + stack, must therefore wait on this or fail and retry. + (Bug #33025231) +* **Group Replication:** + If the thread that runs the Group Replication applier module is + stopped, the group cannot function properly because it cannot + exchange group transactions and messages. Previously, a member + in this situation remained in `ONLINE` status + and ignored the internal errors. The member now changes to + `ERROR` status if the thread is stopped, and + takes the action specified by + [`group_replication_exit_state_action`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_exit_state_action). + (Bug #32934479) +* **Group Replication:** + In MySQL 8.0.22 and later, a replication source server writes a + [`TRUNCATE TABLE`](/doc/refman/8.0/en/truncate-table.html) statement to the + binary log to notify replicas to empty a + [`MEMORY`](/doc/refman/8.0/en/memory-storage-engine.html) table the first time it is + used after a server restart. Previously, the thread where the + statement was logged was not registered with the global thread + manager, so Group Replication was not able to acknowledge it. + The issue has now been corrected. + (Bug #32355801) +* **JSON:** + Made additional improvements in JSON function error handling to + those made in MySQL 8.0.23. + (Bug #32864910) + + References: See also: Bug #31856260. +* **JSON:** + [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table) allowed duplicate + column names when the names differed in case only, although + column names are case-insensitive in MySQL. + + Now this function compares column names in case-insensitive + fashion. + (Bug #102824, Bug #32591074) +* Added Ubuntu 21.10 packages. + (Bug #33501583, Bug #105274) +* The MySQL client library could contribute to a memory leak if + MySQL was linked against OpenSSL 1.0.1, as is the case for + builds on EL6. + (Bug #33335046) +* Implicitly grouped queries sometimes calculate aggregates during + optimization when their values can be easily retrieved from + indexes. When a predicate referenced a column that was declared + with a `NO PAD` collation, that predicate might + be evaluated using `PAD SPACE` semantics, and + so return wrong results. This was because an internal function + that checked for insignificant trailing spaces made the + assumption that all nonbinary collations had `PAD + SPACE` semantics, which was true of MySQL 5.7, but is + not the case for MySQL 8.0, which has added many collations + having `NO PAD` semantics, including the + default collation (`utf8mb4_0900_ai_ci`). + + We fix this by explicitly checking the padding attribute of the + collation in such cases. + (Bug #33282123) +* A query containing a common table expression with a + `MATCH() AGAINST()` clause executed on a table + defined without a full-text index raised an assertion failure. + (Bug #33264864) +* Several Performance Schema tables contained default timestamp + values of 0 (zero) which conflicted with the default + [`sql_mode`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_mode) values + `NO_ZERO_IN_DATE` and + `NO_ZERO_DATE`. + + For example, attempting to create a new table based on such a + Performance Schema table resulted in an error similar to the + following: `ERROR 1067 (42000): Invalid default value + for 'FIRST_SEEN'` + + Default timestamp values have been removed from the following + tables: + + + [`performance_schema.events_errors_summary_by_account_by_error`](/doc/refman/8.0/en/performance-schema-error-summary-tables.html) + + [`performance_schema.events_errors_summary_by_host_by_error`](/doc/refman/8.0/en/performance-schema-error-summary-tables.html) + + [`performance_schema.events_errors_summary_by_thread_by_error`](/doc/refman/8.0/en/performance-schema-error-summary-tables.html) + + [`performance_schema.events_errors_summary_by_user_by_error`](/doc/refman/8.0/en/performance-schema-error-summary-tables.html) + + [`performance_schema.events_errors_summary_global_by_error`](/doc/refman/8.0/en/performance-schema-error-summary-tables.html) + + [`performance_schema.events_statements_summary_by_digest`](/doc/refman/8.0/en/performance-schema-statement-summary-tables.html) + + [`performance_schema.host_cache`](/doc/refman/8.0/en/performance-schema-host-cache-table.html) + + [`performance_schema.replication_applier_filters`](/doc/refman/8.0/en/performance-schema-replication-applier-filters-table.html) + + [`performance_schema.replication_applier_global_filters`](/doc/refman/8.0/en/performance-schema-replication-applier-global-filters-table.html) + + (Bug #33240123, Bug #104643) +* A failed write to the `NOTIFY_SOCKET` + environment variable caused a failure. The + [`ER_SYSTEMD_NOTIFY_WRITE_FAILED`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_systemd_notify_write_failed) + error associated with the failed write has two parameters, but + only one parameter was passed to the error logging routine. + (Bug #33239183) +* An incorrectly type-casted variable was used when setting the + [`--ssl-fips-mode`](/doc/refman/8.0/en/server-system-variables.html#sysvar_ssl_fips_mode) option. + (Bug #33223230) +* The following threads were not present in the + [`performance_schema.threads`](/doc/refman/8.0/en/performance-schema-threads-table.html) table: + + + `buf_resize_thread` + + `fts_optimize_thread` + + Thanks to Kaige Ye for the contribution. + + Thanks to Kaige Ye for the contribution. + (Bug #33214130, Bug #104582, Bug #33214136, Bug #104583) +* A recursive call to an internal save function led to an + unexpected error. + (Bug #33198164) +* The internal `mysqld_list_fields()` function + failed to remove temporary tables created to evaluate + `JSON` table functions. + (Bug #33177686) +* The code to produce minimal TAR packages added debug symbols to + the packages, which caused larger (roughly by 10x) builds. Now + DEB/RPM compiler flags are on by default for debug symbol + builds, and off by default for minimal sized release builds. + (Bug #33151629, Bug #104402) +* Some multi-table [`DELETE`](/doc/refman/8.0/en/delete.html) + statements were found to leak memory. + (Bug #33151275) + + References: See also: Bug #18684036. +* The return value for a copy function internal to the server was + not handled as expected. + (Bug #33142669) + + References: This issue is a regression of: Bug #31982292. +* Empty range frames were not always handled correctly. + (Bug #33142418) + + References: This issue is a regression of: Bug #90300, Bug #27808099. +* In debug builds, the [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) + statement could produce an error if it added a new virtual + column with the same name as one of the columns later referred + to by a foreign key. This fix now ignores a virtual column if + the name is duplicated and instead uses existing, non-virtual + column names to check conditions. + (Bug #33114045) +* An assert condition to ensure that execution of a stored program + instruction is started when there are no errors did not work + properly for a [`CASE`](/doc/refman/8.0/en/case.html) statement in + a loop. + (Bug #33079184) +* In debug builds, [`ANALYZE TABLE`](/doc/refman/8.0/en/analyze-table.html) + with the `UPDATE HISTOGRAM` clause could return + a non-success value to the caller, instead of a success value, + after successfully clearing the diagnostics area. + (Bug #33079073) +* The [`mecab_charset`](/doc/refman/8.0/en/server-status-variables.html#statvar_mecab_charset) system + status variable now reports its value as + `utf8mb4` rather than `utf8`, + which is deprecated. + (Bug #33078623) +* In debug builds, MySQL Enterprise Encryption UDFs did not set the nullable flag + when returning NULL. + (Bug #33077931) +* The range optimizer was sometimes called when a plan lock was in + force. This caused issues since the range optimizer can call + itself, but a plan lock does not allow for recursion. + (Bug #33076462) + + References: This issue is a regression of: Bug #18684036. +* [`CAST()`](/doc/refman/8.0/en/cast-functions.html#function_cast) and + [`DEFAULT()`](/doc/refman/8.0/en/miscellaneous-functions.html#function_default), when used inside + stored routines, were not always handled correctly. + (Bug #33075828) +* String functions that use temporary string buffers during + evaluation could lead to unexpected shutdowns. + (Bug #33073951) +* The error message emitted after a host name failed to resolve to + an IP address did not include a meaningful + `errno` value. Now, `(-2)` + indicating `EAI_NONAME` is returned in the + message instead of `(0)`. + (Bug #33064143) +* A statement such as + [`CREATE + TABLE t SELECT 1`](/doc/refman/8.0/en/create-table-select.html) created an + [`InnoDB`](/doc/refman/8.0/en/innodb-storage-engine.html) table that was written + incorrectly to the binary log if the value of + [`binlog_format`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_format) was set to + `ROW` and + [`sql_mode`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_mode) was in ANSI mode. As a + result, replication of the statement failed with an error on the + replica. Applying the **mysqlbinlog** utility to + such a binary log could also fail. + + The atomic `CREATE...SELECT` was implemented by + adding a new clause to [`CREATE + TABLE`](/doc/refman/8.0/en/create-table.html) called `START TRANSACTION`. + However, this clause was not added when ANSI mode was enabled. + This in turn caused the execution of an ordinary implicitly + committed [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) in the + middle of the transaction and produced an error in GTID mode if + the transaction had an assigned GTID. The issue is fixed by + removing the SQL mode dependency from the new clause. + (Bug #33064062, Bug #104153) +* A log file containing a malformed ISO8601 timestamp was + processed incorrectly. + (Bug #33060440) +* String conversion warnings that previously referred to + `utf8` now reference `utf8mb3` + instead. + (Bug #33059330) +* When building MySQL from source on Unix platforms, + `.bz2` files are now used for Boost archive + downloads rather than `.tar.gz` files. + (Bug #33052171) +* For Enterprise Linux 8 (and Fedora), fixed the debuginfo RPMS + packages by disabling REPRODUCIBLE\_BUILD in fprofile.cmake. + (Bug #33037380) +* For a query with rollup, when setting an expression as nullable + because it had a grouping column, we missed setting all + expressions within that expression as nullable, doing so only + for the topmost expression. This meant that, during evaluation, + a `NULL` generated by rollup was not always + propagated correctly. To fix this, we now set all the + expressions having a grouping column as nullable when the query + uses rollup. + (Bug #33036184) +* During execution of [`EXPLAIN`](/doc/refman/8.0/en/explain.html), when + crossing into a different query block through a streaming or + materialization node, this node was counted as the root, rather + than the actual root node. + (Bug #33030136) +* Fixed an undefined conversion from double to + `int64` in + `sql/join_optimizer/cost_model.cc`. + (Bug #33024410) +* The internal function `find_in_group_list()` + did not match up match up all items correctly during + `ROLLUP` processing. We fix this by adding + casts to `GROUP BY` expressions. + (Bug #33022742, Bug #33123934) + + References: This issue is a regression of: Bug #30969045. +* A missing test for success of a memory allocation in the MySQL + client library could lead to a client exit. + (Bug #33019026) +* An audit log function call from a prepared statement caused an + error. + (Bug #33016004) +* Avoid adding column names prefixed with + `!hidden!` to ensure that new names do not + collide with names used by existing hidden columns for + functional indexes. Generated hidden column names now have the + following new form that extends the use of functional indexes + into environments that do not support names generated by + [`MD5()`](/doc/refman/8.0/en/encryption-functions.html#function_md5): + + `!hidden!index_name!key_part_number!counter` + + The *`counter`* value of a generated name + is zero unless a column with that name already exists in the + table. In this case, the value is incremented until the name + becomes unique. + (Bug #32983024) +* Removed an unnecessary hard-coded dependency on the range + optimizer from `sql_help.cc`. + (Bug #32976042) +* Insufficient buffer space allocation during window function + execution could cause an assertion to be raised. + (Bug #32975889) +* When finding the list of tables under a hash join, we did not + take into account those that were also hidden under ZERO\_ROWS + iterators. This could lead to NULL row flags not being set + correctly, which also caused problems when weedout wanted to + save row IDs for them. + (Bug #32975168) +* The [`gen_dictionary()`](/doc/refman/8.0/en/data-masking-component-functions.html#function_gen-dictionary), + [`gen_range()`](/doc/refman/8.0/en/data-masking-component-functions.html#function_gen-range), and + [`gen_rnd_pan()`](/doc/refman/8.0/en/data-masking-component-functions.html#function_gen-rnd-pan) data masking + functions each could generate the same value if executed in + close temporal proximity multiple times. + (Bug #32970772) +* Creation and deletion of temporary tables used in resolution of + common table expressions and having table references created + within subqueries were not always managed correctly. + (Bug #32962511) +* When the `-–binary-as-hex` + option is enabled for the **mysql** client, empty + strings are now printed as `0x` instead of + `NULL`. + (Bug #32961656, Bug #103906) +* The resolver usually terminates the analysis and exits after + encountering an error in a statement. In the case of duplicate + column analysis, the resolver continued to the end of the column + list, possibly adding multiple error messages to the diagnostics + object. + (Bug #32960158) +* When a scalar subquery returned multiple rows, the resulting + error was not always handled correctly. + (Bug #32956779) +* Changing the server SQL mode after creating a table containing + generated columns could cause spurious messages to be written to + the error log. + (Bug #32954466) +* Manifest file reading could fail on Windows. + (Bug #32950322) +* Evaluation of the values in an [`IN()`](/doc/refman/8.0/en/comparison-operators.html#operator_in) + list did not stop immediately on error, which led to assert + failures. We fix this by stopping evaluation in such cases as + soon as an error has been raised. + (Bug #32942328) +* If an error was raised while evaluating a comparison of two + non-nullable values as strings, the result of the comparison was + set to `NULL`, even though the result was + non-nullable according to the comparison operator metadata. The + error was correctly returned to the user, but an assertion was + raised by this inconsistency when running in debug mode. + + This is fixed by causing `Arg_comparator` not + to set its owner to `NULL` when the owner is + not nullable. + (Bug #32942327) +* An unset variable referenced in an SQL script executed during an + upgrade operation caused a failure. + (Bug #32939819) +* Improper error propagation in `filesort` + operations could raise an assertion. + (Bug #32932969) +* In the internal `WalkAndReplace()` function, + errors from `set_cmp_func()` were not correctly + propagated. + (Bug #32918927, Bug #33007298) + + References: This issue is a regression of: Bug #32548377. +* A deadlock could occur if a `RESET REPLICA ALL` + statement was used while the channel configuration was being + read. + (Bug #32906709) +* A potential race condition in accessing the persisted variables + cache has been eliminated. + (Bug #32901419) +* The constant propagation performed by the MySQL optimizer could + in some cases replace references to a column that was not + nullable with a nullable expression. When this occurred, the + parent item of the replaced column reference could sometimes + have the wrong nullability, leading assert failures later, + during execution, when a non-nullable item unexpectedly returned + `NULL`. + + We fix this by skipping constant propagation in cases where a + non-nullable column reference is replaced by a nullable + expression. + (Bug #32895824) + + References: This issue is a regression of: Bug #32371039. +* A column name provided in a query could differ in collation + details, or because the name was provided as an expression alias + in the query, and still match a column name in the dictionary. + The query output contained the column name specified in the + query (for example, `aaa`) rather than the + column name from the dictionary (for example, + `AAA`). + (Bug #32892045) +* When the server SQL mode is other than strict mode, certain + string functions return `NULL` to indicate that + the result is too large for the result buffer, which could lead + to in inconsistent behaviour such as incorrectly sorted output. + In addition, the functions + [`LAST_INSERT_ID()`](/doc/refman/8.0/en/information-functions.html#function_last-insert-id) and + [`CAST(... AS + CHAR)`](/doc/refman/8.0/en/cast-functions.html#function_cast) did not maintain nullability properly for all + cases. + (Bug #32864958) +* Hidden items added as part of an `ORDER BY`, + windowing function, or a reference to a view were not always + handled correctly in implicitly grouped queries. + (Bug #32863279, Bug #33079592) +* Type resolution for negation did not set the proper precision + when converting the type from integer to decimal. This is fixed + by assigning the same precision as the argument. + (Bug #32863037) + + References: This issue is a regression of: Bug #31348202. +* Improper error propagation for failed + [`CREATE + TABLE ... SELECT`](/doc/refman/8.0/en/create-table-select.html) statements caused rollback not to + occur. + (Bug #32855882) +* When used in a subquery, a [`VALUES`](/doc/refman/8.0/en/values.html) + having more than one `ROW()` was not always + handled correctly. + (Bug #32851684) +* The error packet that MySQL Server sends to a client program + when the wait timeout expires + ([`ER_CLIENT_INTERACTION_TIMEOUT`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_client_interaction_timeout)) + used an incorrect sequence number of 2 instead of 0 in the + packet header when protocol compression was used. + (Bug #32835205, Bug #103412) +* Concurrent insert operations on multiple tables with full-text + indexes caused a large number of full-text index synchronization + requests, resulting in an out of memory condition. + (Bug #32831765, Bug #103523) +* The fix for a previous issue, following subsequent work which + made it redundant and which led to invalid results from + expressions used in window functions, has been reverted. + (Bug #32820802) + + References: Reverted patches: Bug #26389508. +* In prepared statements, [`NULLIF()`](/doc/refman/8.0/en/flow-control-functions.html#function_nullif) + result type determination could be incorrect. + (Bug #32816305, Bug #103458) +* Creating and dropping of views within stored routines were not + always handled correctly. + (Bug #32807430) +* The fix for a previous issue included a minor refactoring of how + the precision and scale of a decimal expression were determined. + It later emerged that, for the + [`TRUNCATE()`](/doc/refman/8.0/en/mathematical-functions.html#function_truncate) function, we might end + up with a precision of zero, which is invalid. + + We fix this problem by treating a precision of zero as one. + (Bug #32802251) + + References: See also: Bug #31348202. +* For legacy reasons, we can have composite access paths including + `Filter` and `Sort` inside + `table_path`. For ease of analysis and better + formatting, we move the [`EXPLAIN`](/doc/refman/8.0/en/explain.html) + output for these previous to the `Materialize` + access path. + + We show here examples of an `EXPLAIN` statement + run both prior to and following this change: + + ```None + # Table created as follows: + mysql> DROP TABLE IF EXISTS t1; + Query OK, 0 rows affected (0.02 sec) + + mysql> CREATE TABLE t1 ( f1 INTEGER ); + Query OK, 0 rows affected (0.03 sec) + + + # Previous to change: + mysql> EXPLAIN FORMAT=TREE + -> SELECT * FROM ( SELECT * FROM t1 LIMIT 2 OFFSET 1 ) AS alias1 + -> WHERE f1 <= ANY ( SELECT f1 FROM t1 ) ORDER BY f1\G + *************************** 1. row *************************** + EXPLAIN: -> Sort: alias1.f1 + -> Filter: ((alias1.f1 <= (select #3))) (cost=2.62 rows=2) [other sub-iterators not shown] + -> Table scan on alias1 (cost=2.62 rows=2) + -> Materialize (cost=0.35..0.35 rows=0) + -> Limit/Offset: 2/1 row(s) (cost=0.35 rows=0) + -> Table scan on t1 (cost=0.35 rows=1) + + # Following change: + mysql> EXPLAIN FORMAT=TREE + -> SELECT * FROM ( SELECT * FROM t1 LIMIT 2 OFFSET 1 ) AS alias1 + -> WHERE f1 <= ANY ( SELECT f1 FROM t1 ) ORDER BY f1\G + *************************** 1. row *************************** + EXPLAIN: + -> Sort: alias1.f1 (cost=0.35..0.35 rows=0) + -> Filter: ((alias1.f1 <= (select #3))) (cost=2.62 rows=2) + -> Table scan on alias1 (cost=2.62 rows=2) + -> Materialize (cost=0.35..0.35 rows=0) + -> Limit/Offset: 2/1 row(s) (cost=0.35 rows=0) + -> Table scan on t1 (cost=0.35 rows=1) + -> Select #3 (subquery in condition; run only once) + -> Aggregate: max(t1.f1) (cost=0.45 rows=1) + -> Table scan on t1 (cost=0.35 rows=1) + ``` + + After this change, the only legal access paths within + `table_path` are `TABLE_SCAN`, + `REF`, `REF_OR_NULL`, + `EQ_REF`, and `ALTERNATIVE`. + (Bug #32788576, Bug #32915233) +* Constant folding did not always handle errors correctly when + evaluating decimal expressions. + (Bug #32785804) +* A call order mismatch in + `Query_block::prepare_values()` caused + `setup_order()` to be called after + `resolve_subquery()`, which meant that, for a + `VALUES` clause that was a subquery, the + subquery could be merged into the outer query block before + calling `setup_order()`, leading to + inconsistent data structures and an error. + + We fix this issue by performing `setup_order()` + earlier, and, if the column is not found, resolution is aborted. + (Bug #32783943) + + References: This issue is a regression of: Bug #31387510. +* In the Performance Schema table + `variables.info`, the system variable + `skip_slave_start` was incorrectly listed as + `COMPILED` when the global value was actually + loaded from the persisted variables file, so + `PERSISTED` should have been used. + (Bug #32640588) +* A [`SELECT`](/doc/refman/8.0/en/select.html) query on the + [`INFORMATION_SCHEMA.PROCESSLIST`](/doc/refman/8.0/en/information-schema-processlist-table.html) view + with concurrent MySQL Server load caused a failure. + (Bug #32625376) +* When a query uses a temporary table for aggregation, the group + by item is used as a unique constraint on the temporary table: + If the item value is already present, the row is updated; + otherwise, a new row is inserted into the temporary table. If + the item has a result field or reference item, it evaluated + twice, once to check whether the result exists in the temporary + table and, if not, again while constructing the row to be + inserted. When the group by item was nondeterministic, the + result value used to check for existence differed from that with + which an insert was attempted, causing the insert to be rejected + if the value already existed in the table. + + We fix this by using the hash of any nondeterministic items as + the unique constraint, so that the hash is evaluated once only. + (Bug #32552332) +* Privilege-checking for table-specific roles was in some contexts + not restrictive enough. + (Bug #32400788) +* Inconsistencies in how certain comparison predicates were + evaluated (for example, when part of a `WHERE` + clause) could return different results if a function was used + instead of a string literal. + (Bug #32345941, Bug #102151) +* Columns of type [`ENUM`](/doc/refman/8.0/en/enum.html) or + [`SET`](/doc/refman/8.0/en/set.html) are ordered based on numeric + comparison, but the comparison function for range expressions + (that is, expressions used for ordering in case of a range frame + specification) of a window function is set based on the result + type of the column, which for `ENUM` and + `SET` is `String`. As a + result, processing of rows for a window frame (to see whether a + row is before or after the frame) did not work correctly; for + example, a string comparison might determine that a row occurs + before a frame, while a numeric comparison would have placed the + row after. + + To fix this problem, we implement integer cache items for + `ENUM` and `SET`, as well as + integer comparison functions for use when + `ENUM` or `SET` types are + involved in range expressions. + (Bug #32328576) +* A DML statement, when accessing a subquery which had been + optimized away and cleaned up, led to an unplanned shutdown of + the server. + (Bug #32244822) +* When resolving columns, their names are compared in + case-insensitive fashion using + `utf8_general_ci`, which does not always follow + the same comparison rules as those for the collation actually + used for the table. Previously, when a table had in excess of 32 + columns, name lookup was performed using a hash table. Hashing + is collation-aware, and so follows the collation's comparison + rules; this caused name lookup and duplication detection to be + done in an inconsistent fashion. We solve this problem by + removing the hash, and performing column name resolution in the + same way in all cases regardless of the number of columns. + (Bug #32169656) +* For a nullable column, when adjacent ranges were rounded off to + the same value by range optimizer, wrong results were returned. + (Bug #31870920) + + References: See also: Bug #98826, Bug #30988735. +* Quote handling was improved for the [`SHOW + GRANTS`](/doc/refman/8.0/en/show-grants.html) statement. + (Bug #31716706) +* An attempt could be made to write a + [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table) expression to the + optimizer trace before the temporary table backing the table + function had been created, causing an assertion to be raised. + Now when the column type is not yet available, + `` is + written. + (Bug #31578783) +* Validity checks for + [`mandatory_roles`](/doc/refman/8.0/en/server-system-variables.html#sysvar_mandatory_roles) system variable + settings are now synchronized with validity checks performed for + [`GRANT + role`](/doc/refman/8.0/en/grant.html) statements. + (Bug #31218040) +* The + [`keyring_hashicorp_update_config()`](/doc/refman/8.0/en/keyring-functions-plugin-specific.html#function_keyring-hashicorp-update-config) + function was not safe for concurrent execution. + (Bug #31205028) +* The query rewrite plugin failed when refreshing the rewrite + rules and the table holding the rewrite rules contained rows + that had been marked as deleted, but not physically removed. + + We fix this by causing the query rewrite plugin to skip the + deleted rows instead of failing when it sees them. + (Bug #22654105) +* Refactoring done as part of implementing window functions in + MySQL made it possible to refer to aliases of aggregates in + `ORDER BY` clauses but also allowed direct + references to such aggregates, even though this should not be + allowed. Now the server checks explicitly for such illegal + references. + (Bug #13633829, Bug #30106081) +* In certain cases, the view reference cloned when pushing a + condition down to a derived table was not always resolved in the + desired context. In addition, a check for a null condition was + not performed correctly. + (Bug #104574, Bug #33209907, Bug #33197276) +* Some queries using `HAVING COUNT(DISTINCT ...)` + did not return any rows when one was expected. + (Bug #104411, Bug #33152269) + + References: This issue is a regression of: Bug #31790217. +* Multi-valued indexes were not used in the following cases: + + + In views + + In prepared statements + + In a `WHERE` containing + [`MEMBER OF()`](/doc/refman/8.0/en/json-search-functions.html#operator_member-of) combined using + `OR` with another predicate + + In addition, MySQL wrongly reported `impossible + condition` for a `WHERE` clause in the + form `f() AND + f()`, where + *`f()`* was any of `MEMBER + OF()`, [`JSON_CONTAINS()`](/doc/refman/8.0/en/json-search-functions.html#function_json-contains), + or [`JSON_OVERLAPS()`](/doc/refman/8.0/en/json-search-functions.html#function_json-overlaps). + + Our thanks to Yubao Liu for the contribution. + (Bug #104325, Bug #104700, Bug #104721, Bug #33123079, Bug #33268466, Bug #33275457) + + References: See also: Bug #102359, Bug #32427727. This issue is a regression of: Bug #30838807. +* When `NULL` was passed to a user-created + function that called + [`REGEXP_INSTR()`](/doc/refman/8.0/en/regexp.html#function_regexp-instr), the first + invocation of the function returned `NULL` as + expected, but each subsequent invocation of the function also + returned `NULL` without regard to the value + passed to it. + (Bug #104239, Bug #33089668) +* Some of the functions defined in + `mbr_utils.cc` threw heap-allocated + exceptions in some situations. Memory allocated for the + exception object in these cases was never freed, which meant + that a small amount of memory leaked each time an exception was + thrown. + + This is fixed by allocating the exception on the stack in such + cases, instead. + (Bug #104214, Bug #33086286) +* Column names were not displayed correctly in the results of + `ROLLUP` queries when the + [`subquery_to_derived`](/doc/refman/8.0/en/switchable-optimizations.html#optflag_subquery-to-derived) + optimization was enabled. + (Bug #104139, Bug #33057397, Bug #33104036) +* A stored procedure containing an + [`IF`](/doc/refman/8.0/en/if.html) statement using + `EXISTS`, which acted on one or more tables + that were deleted and recreated between executions, did not + execute correctly for subsequent invocations following the first + one. + (Bug #103607, Bug #32855634) +* When executing a range query with multiple identical ranges + joined by `OR` (for example, a query with + `WHERE (a=1 AND b=2 AND c=3) OR (a=1 AND b=2 AND + c=3)`), the optimizer lost part of the range, and so + chose a query plan that was not optimal. + + Our thanks to Facebook for the contribution. + (Bug #102634, Bug #32523520) +* While evaluating a loose index scan as a possible option for + performing grouping and finding the minimum value, the cost + calculation did not reflect the fact that the query looked at + one group only, due to the equality predicates on the grouping + attributes. This resulted in examination of additional rows + since grouping is performed after reading the rows from the + index. + + We fix this by determining whether a query produces only one + group by checking for the presence of equality predicates on + grouping attributes and using these for calculating the cost. + This causes the optimizer to pick loose index scan for such + cases when doing so is found to be beneficial. + (Bug #101838, Bug #32266286) + + References: See also: Bug #18109609. +* When resolving integer division, the precision of the result is + taken from the dividend. When the divisor is a decimal number, + it may be less than 1, which may cause the result to use more + digits than the dividend. This yielded incorrect values in some + cases in which the result of integer division was a decimal or + float. + (Bug #100259, Bug #31641064) +* Added an in-memory estimate to the optimizer trace to indicate + how much of a given table is buffered in the buffer pool. + + Our thanks to Øystein Grøvlen for the contribution. + (Bug #99993, Bug #31544522) +* The [`EXPLAIN`](/doc/refman/8.0/en/explain.html) output for a DML + statement contains the table identifier, which normally includes + the database name, in the output of `SHOW + WARNINGS`. For some statements such as + [`CREATE VIEW`](/doc/refman/8.0/en/create-view.html), the database name + should be omitted, which is enforced by setting the + `alias_name_used` flag to true in the cached + table object, but when the cached table was reused following + `CREATE VIEW`, the flag was not reset, which + caused the database name to be omitted from the warnings + following `EXPLAIN` for statements run after a + `CREATE VIEW` which access the same cached + table as the view. + + We fix this by ensuring that the + `alias_name_used` flag is always set to an + appropriate value during table initialization. + + Our thanks to Kaiwang Chen for the contribution. + (Bug #98635, Bug #30909064) diff --git a/corpus/changelog/mysql_releases/mysql_8028.md b/corpus/changelog/mysql_releases/mysql_8028.md new file mode 100644 index 0000000000000000000000000000000000000000..b1c3f77b85e711fa503bcbdf81f08029a8bc7097 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8028.md @@ -0,0 +1,1585 @@ +# MySQL 8.0.28 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-28.html +Version: 8.0.28 + +## Changes in MySQL 8.0.28 (2022-01-18, General Availability) + +* [Audit Log Notes](news-8-0-28.html#mysqld-8-0-28-audit-log "Audit Log Notes") +* [C API Notes](news-8-0-28.html#mysqld-8-0-28-capi "C API Notes") +* [Character Set Support](news-8-0-28.html#mysqld-8-0-28-charset "Character Set Support") +* [Compilation Notes](news-8-0-28.html#mysqld-8-0-28-compiling "Compilation Notes") +* [Data Type Notes](news-8-0-28.html#mysqld-8-0-28-data-types "Data Type Notes") +* [Deprecation and Removal Notes](news-8-0-28.html#mysqld-8-0-28-deprecation-removal "Deprecation and Removal Notes") +* [Event Scheduler Notes](news-8-0-28.html#mysqld-8-0-28-event-scheduler "Event Scheduler Notes") +* [Full-Text Search Notes](news-8-0-28.html#mysqld-8-0-28-full-text "Full-Text Search Notes") +* [SQL Function and Operator Notes](news-8-0-28.html#mysqld-8-0-28-functions-operators "SQL Function and Operator Notes") +* [Optimizer Notes](news-8-0-28.html#mysqld-8-0-28-optimizer "Optimizer Notes") +* [Packaging Notes](news-8-0-28.html#mysqld-8-0-28-packaging "Packaging Notes") +* [Performance Schema Notes](news-8-0-28.html#mysqld-8-0-28-performance-schema "Performance Schema Notes") +* [Functionality Added or Changed](news-8-0-28.html#mysqld-8-0-28-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-28.html#mysqld-8-0-28-bug "Bugs Fixed") + +### Audit Log Notes + +* The new [`audit_log_disable`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_disable) + system variable permits disabling audit logging for all + connecting and connected sessions. See + [Disabling Audit Logging](/doc/refman/8.0/en/audit-log-disabling.html). + (WL #14699) + +### C API Notes + +* Building C API client programs on Windows using Clang as the + compiler returned various compiler warnings, including an unused + variable warning. + (Bug #33520805, Bug #33520861) + +### Character Set Support + +* **Incompatible Change:** + [`CONVERT(string + USING charset)`](/doc/refman/8.0/en/cast-functions.html#function_convert) did not + compute the correct maximum length for its return value, which + should be the same as that calculated for + [`CAST(string AS + charset)`](/doc/refman/8.0/en/cast-functions.html#function_cast). This meant that + some conversions of strings from + [`BINARY`](/doc/refman/8.0/en/binary-varbinary.html) to nonbinary character + sets which should have been rejected as invalid returned values + instead. + + Prior to upgrading, applications that may rely on the previous + `CONVERT()` behavior should be checked and + updated as necessary. In particular, for indexes on generated + columns using `CONVERT()` with invalid values, + you should correct such values, drop the index, then re-create + it before upgrading to this release. In some cases, it may be + simpler to rebuild the table using + [`ALTER TABLE + table FORCE`](/doc/refman/8.0/en/alter-table.html), rather than + dropping and re-creating the index. See + [SQL Changes](/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-sql-changes), for more information. + (Bug #33199145) +* The output from + [`EXPLAIN + FORMAT=TREE`](/doc/refman/8.0/en/explain.html#explain-execution-plan) hex-encoded ranges for multi-valued + indexes, even when the data type was not a binary one. In + addition, ranges using string types were also printed with + hex-encoded values, when they had a binary collation. The latter + issue also affected regular indexes, but was more visible with + multi-valued indexes, since these always use + `utf8mb4_0900_bin` collation. Now, hex-encoding + is used only for string types having a binary character set. + Strings with non-binary character sets are now printed in + `EXPLAIN FORMAT=TREE` output as plain text, + with escaping for any special characters. + (Bug #33343948) +* For some functions, the resolved character set was not always + the same as the character set of the first argument. + (Bug #32668730, Bug #33238711) + +### Compilation Notes + +* **InnoDB:** + Compilation issues associated with the following MSVC++ level 4 + compiler warnings were addressed: C4201, C4701, C4702, C4703, + C4706. The compiler warnings, which were previously disabled, + are now enabled. + (Bug #33464699) +* **InnoDB:** + MSVC++ level 4 compiler warnings were enabled. + (Bug #33437498) +* **InnoDB:** + An access violation occurred when building a debug version of + MySQL using Visual Studio 2019 version 16.10 or version 16.11. + The violation was due to an STL iterator bug. + (Bug #33223243) +* Binary packages that include curl rather than linking to the + system curl library have been upgraded to use curl 7.80.0. + (Bug #33576431) + +### Data Type Notes + +* This release fixes the following two issues relating to date and + time values: + + + Inserting a [`CHAR`](/doc/refman/8.0/en/char.html) value such + as `'12:00:00'` into a + [`DATE`](/doc/refman/8.0/en/datetime.html), + [`DATETIME`](/doc/refman/8.0/en/datetime.html), or + [`TIMESTAMP`](/doc/refman/8.0/en/datetime.html) column raised the + wrong error. In the case of a `DATE` + column, this error was similar to Data + truncation: Incorrect date value: '2012-00-00' for column + 'd' at row 1. This occurred for both the binary + and text protocols. + + Inserting a value with an offset into a + [`DATE`](/doc/refman/8.0/en/datetime.html) or + [`TIME`](/doc/refman/8.0/en/time.html) column using the binary + protocol gave a wrong result. For example, when the + connection time zone was set to GMT-5, inserting + `'2021-10-10 00:00:00.123+01:00'` into a + `TIME` column yielded + `'18:00:00'`; that is, the value was + converted to the connection time zone (this should be done + only with respect to `DATETIME` columns). + + We fix these by recognizing and adjusting for time zone offsets + whenever a `TIMESTAMP` value with a time zone + offset is inserted into a `TIME` or + `DATE` column. + (Bug #33616957, Bug #33649009) + + References: See also: Bug #33539844. +* A fix in MySQL 8.0.27 for a previous issue changed the resolved + type of a boolean expression from signed + [`INT`](/doc/refman/8.0/en/integer-types.html) to unsigned + [`BIGINT`](/doc/refman/8.0/en/integer-types.html) in order to simplify type + handling, but what appeared then as a harmless metadata change + turned out to cause problems for some of the MySQL Connectors. + + We now revert the metadata change and provide a different fix + for the original problem, by adjusting the + `max_length` for the negation of an integer to + at least two characters. + (Bug #33516898) + + References: This issue is a regression of: Bug #33117410. +* Sorts of some column types, including + [`JSON`](/doc/refman/8.0/en/json.html) and + [`TEXT`](/doc/refman/8.0/en/blob.html), sometimes exhausted the + sort buffer if its size was not at least 15 times that of the + largest row in the sort. Now the sort buffer need only be only + 15 times as large as the largest sort key. + (Bug #103325, Bug #105532, Bug #32738705, Bug #33501541) + + References: This issue is a regression of: Bug #30400985, Bug #30804356. + +### Deprecation and Removal Notes + +* Support for the TLS v1.0 and TLS v1.1 connection protocols is + removed as of MySQL 8.0.28. The protocols were deprecated from + MySQL 8.0.26. For background, refer to the IETF memo + [Deprecating TLS v1.0 and TLSv 1.1](https://tools.ietf.org/id/draft-ietf-tls-oldversions-deprecate-02.html). Make connections + using the more-secure TLSv1.2 and TLSv1.3 protocols. TLSv1.3 + requires that both the MySQL Server software and the client + application were compiled with OpenSSL 1.1.1 or higher. + + From MySQL 8.0.28, client programs, including MySQL Shell, that + support a `--tls-version` option for specifying + TLS protocols for connections to the MySQL server cannot make a + TLS/SSL connection with the protocol set to TLSv1 or TLSv1.1. If + a client attempts to connect using these protocols, for TCP + connections, the connection fails, and an error is returned to + the client. For socket connections, if + `--ssl-mode` is set to REQUIRED, the connection + fails, otherwise the connection is made but with TLS/SSL + disabled. + + On the server side, the following settings are changed from + MySQL 8.0.28: + + + Permitted values for + [`tls_version`](/doc/refman/8.0/en/server-system-variables.html#sysvar_tls_version) and + [`admin_tls_version`](/doc/refman/8.0/en/server-system-variables.html#sysvar_admin_tls_version) no longer + include `TLSv1` or + `TLSv1.1`. + + Permitted values for + [`group_replication_recovery_tls_version`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_recovery_tls_version) + no longer include `TLSv1` or + `TLSv1.1`. + + For asynchronous replication, replicas can no longer set the + protocol for connections to the source server + (`SOURCE_TLS_VERSION` option for + [`CHANGE REPLICATION SOURCE TO`](/doc/refman/8.0/en/change-replication-source-to.html)) + to `TLSv1` or `TLSv1.1`. + + (WL #14775) +* The shortcuts `ASCII` for `CHARACTER + SET latin1` and `UNICODE` for + `CHARACTER SET ucs2` are now deprecated, and + you should expect their removal in a future version of MySQL. + Using either of these now raises a warning; use + `CHARACTER SET` instead. + (WL #13146) +* The character sets listed here, along with all of their + collations, are now deprecated, and subject to removal in a + subsequent release of MySQL: + + + `ucs2` + + `macroman` and `macce` + + `dec` + + `hp8` + + The use of any of these character sets or their collations in + SQL statements or elsewhere in the MySQL server now produces a + deprecation warning. + + You should use `utf8mb4` instead of any of the + character sets just listed. See also + [The ucs2 Character Set (UCS-2 Unicode Encoding)](/doc/refman/8.0/en/charset-unicode-ucs2.html), + [West European Character Sets](/doc/refman/8.0/en/charset-we-sets.html), and + [Central European Character Sets](/doc/refman/8.0/en/charset-ce-sets.html). + (WL #13594, WL #13595, WL #13596, WL #13597) + +### Event Scheduler Notes + +* As a previous convenience, the server automatically restarted + the Event Scheduler as needed when the + [`super_read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only) system variable + was disabled. Now this same convenience is applied independently + when the [`read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_read_only) system + variable is disabled. Prior to this update, disabling + [`read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_read_only) could also disable + [`super_read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only) if needed, but + because the code was separate, the Event Scheduler was not + restarted. + (Bug #33539082) + +### Full-Text Search Notes + +* Due to the fact that, as implemented, + [`MATCH()`](/doc/refman/8.0/en/fulltext-search.html#function_match) does not act as a + function of its arguments, but rather as a function of the row + ID of the current row in the underlying scan of the base table, + a query using a rollup column as the argument to this function + tended to perform poorly, and with unreliable results. This + being the case, the use of a rollup column with + `MATCH()` is no longer permitted whenever the + following conditions are true: + + + `MATCH()` appears in the + [`SELECT`](/doc/refman/8.0/en/select.html) list, `GROUP + BY` clause, `HAVING` clause, or + `ORDER BY` clause. + + The query uses `GROUP BY ... WITH ROLLUP`. + + A grouping column is used as the argument to + `MATCH()`. + + Any such queries are now rejected with + [`ER_FULLTEXT_WITH_ROLLUP`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_fulltext_with_rollup). (The + use of `MATCH()` with a rollup column in the + `WHERE` clause is not affected by this change, + and is still permitted.) + + For more information, see [Full-Text Search Functions](/doc/refman/8.0/en/fulltext-search.html). + (Bug #32565923, Bug #32996762, WL #14697) + +### SQL Function and Operator Notes + +* **Important Change:** + When using prepared statements, the + [`DATE_ADD()`](/doc/refman/8.0/en/date-and-time-functions.html#function_date-add) and + [`DATE_SUB()`](/doc/refman/8.0/en/date-and-time-functions.html#function_date-sub) functions returned + [`DATETIME`](/doc/refman/8.0/en/datetime.html) values, even when + calculations involved combinations of + [`YEAR`](/doc/refman/8.0/en/year.html), `MONTH`, + or `DAY` parts only (that is, no time parts). + + Previous to implementing single preparation of prepared + statements in MySQL 8.0.22, [`TIME`](/doc/refman/8.0/en/time.html) + values were returned in such cases; before this was done, values + used as arguments and their types were used to determine the + result type of certain temporal functions at resolution time, + such as `DATE_ADD()`, + `DATE_SUB()`, and + [`ADDTIME()`](/doc/refman/8.0/en/date-and-time-functions.html#function_addtime). Afterwards, user + variable references and dynamic parameters are considered + constant for the lifetime of one execution only, requiring that + the return type be determined in another fashion, in this case + from the function type. For example, the default resolved type + for `DATE_ADD()` was deemed to be + `DATETIME` if the first argument was a dynamic + parameter, since `DATETIME` accomodates all + temporal values and thus an implicit reprepare can be avoided. + + The change just described represents a regression; the problem + is better solved by deriving a more precise resolved data type, + and performing a reprepare only if that does not match the + actual value of the parameter. (Such functionality was already + in use in the MySQL server for numeric parameters.) This + solution is implemented by this fix. + + We now parse string and numeric values when temporal values are + expected. When a valid temporal value is found, the value is + converted. This fix also improves determination of resolved data + types for temporal functions. + + With this fix, the `DATE_ADD()` and + `DATE_SUB()` functions (and their synonyms + functions [`ADDDATE()`](/doc/refman/8.0/en/date-and-time-functions.html#function_adddate) and + [`SUBDATE()`](/doc/refman/8.0/en/date-and-time-functions.html#function_subdate)) resolve types as + follows: + + + If the first argument is a dynamic parameter, its resolved + type is [`DATE`](/doc/refman/8.0/en/datetime.html) if the second + argument is an interval that contains some combination of + `YEAR`, `MONTH`, or + `DAY` values only; otherwise, its type is + [`DATETIME`](/doc/refman/8.0/en/datetime.html). + + If the first argument is resolved as + [`DATETIME`](/doc/refman/8.0/en/datetime.html), the resolved type + of the function is also `DATETIME`. + + If the first argument is a `DATE`, the + resolved type of the function is also + [`DATE`](/doc/refman/8.0/en/datetime.html), unless the interval + argument uses `HOUR`, + `MINUTE`, or `SECOND`, in + which case it is [`DATETIME`](/doc/refman/8.0/en/datetime.html). + + If the first argument is a + [`TIME`](/doc/refman/8.0/en/time.html) value, the resolved type + is also `TIME`, unless the interval + argument uses any of `YEAR`, + `MONTH`, or `DAY`, in + which case the resolved type of the function is + [`DATETIME`](/doc/refman/8.0/en/datetime.html). + + If none of the preceding conditions are met, the function is + resolved as [`VARCHAR`](/doc/refman/8.0/en/char.html) (as in MySQL + 8.0.21 and earlier). + + The `ADDTIME()` and + [`SUBTIME()`](/doc/refman/8.0/en/date-and-time-functions.html#function_subtime) functions now resolve + types as follows: + + + If the first argument is a dynamic parameter, the resolved + type is `TIME`, rather than + `DATETIME`. + + Otherwise, the resolved type of the function is derived from + the resolved type of the first argument. + + In addition, for `DATE_ADD()` and + `DATE_SUB()`, if the resolved type of the first + argument is `DATE`, and a + `DATETIME` value is provided, the statement is + reprepared so that the function has the resolved type + `DATETIME`. Behavior is unchanged when a + `TIME` value is provided. + + For `ADDTIME()` and + `SUBTIME()`, there are no forced reprepares. + (Bug #103781, Bug #32915973, Bug #33477883, Bug #33539844) +* Previously, loadable functions and stored functions shared the + same namespace and could not have the same name. A subsequent + implementation change eliminated the reason to share the same + namespace and permitted a stored function to be created with the + same name as an existing loadable function. To invoke the stored + function, it is necessary to qualify it with a schema name. The + server now generates a warning if the stored function name + collides with an existing loadable function name. + (Bug #33301931) +* Queries making use of the + [`MBRContains()`](/doc/refman/8.0/en/spatial-relation-functions-mbr.html#function_mbrcontains) function did not + employ all available spatial indexes. + (Bug #32975221) + + References: This issue is a regression of: Bug #29770705. +* The [`FORMAT()`](/doc/refman/8.0/en/string-functions.html#function_format) function returned a + formatted number without showing the thousands separator and + grouping between separators when either the es\_ES or es\_MX + locale was specified. + (Bug #31374305) +* The result length of the + [`GROUP_CONCAT()`](/doc/refman/8.0/en/aggregate-functions.html#function_group-concat) function was wrong + when the value of + [`group_concat_max_len`](/doc/refman/8.0/en/server-system-variables.html#sysvar_group_concat_max_len) was + increased. With a small + [`group_concat_max_len`](/doc/refman/8.0/en/server-system-variables.html#sysvar_group_concat_max_len) value, the + result was correct. This issue was caused by arithmetic + overflow. + + Our thanks to Hope Lee for the contribution. + (Bug #105380, Bug #33521497) + +### Optimizer Notes + +* For a query, a range scan can be picked first and the optimizer + decide that the same range scan can be used to skip ordering. In + some cases, when the requested order is not the same as the + index order, a reverse index scan is required. If the requested + ordering is on the key part that is not already used by the + range scan, we update the number of used key parts for the range + scan to reflect the change. The issue occurred because the key + part information was not also updated, and when it was necessary + to access key part information based on the number of key parts + used. + + We also now note when a reverse scan uses extended key parts, + and set the correct flags for evaluation accordingly. + (Bug #33615893) + + References: This issue is a regression of: Bug #33037007. +* In both optimizer trace and + [`EXPLAIN + FORMAT=TREE`](/doc/refman/8.0/en/explain.html#explain-execution-plan) output, date ranges were printed as + binary. Now in such cases we print temporal values as quoted + strings. + (Bug #33335079) +* When a condition was pushed down, the result of evaluating + assignments to user variables in the `SELECT` + list of the subquery were sometimes affected. For this reason, + we now prevent condition pushdown for statements with + assignments to user variables. + + Our thanks to Casa Zhang and the Tencent team for the + contribution. + (Bug #104918, Bug #33341080) +* When the join buffer was set to certain arbitrary sizes, the + number of chunk files created for hash joins was too small. This + meant that each file contained more rows than could fit in the + join buffer, so that the probe chunks needed to be read multiple + times. This was caused by using integer division when computing + how many chunk files are needed; we fix this by using + floating-point division instead. + + Our thanks to Øystein Grøvlen for the contribution. + (Bug #104186, Bug #33073354) +* A query using aggregation on a + [`BIT`](/doc/refman/8.0/en/bit-type.html) type could return different + results depending on the indexes or join type employed. This was + due to the fact that a DML statement using such an aggregation + caches the `BIT` values using an integer type, + and later looks up and converts to a string format for output. + The current issue arose because this lookup treated the + `BIT` value as an integer, resulting in an + incorrect string value. + + This is fixed by adding a new internal class for cached + `BIT` values which can convert bit values to + string formats correctly. + + Our thanks to Hope Lee for the contribution. + (Bug #100859, Bug #31894023) +* When a DML statement containing an outer + `DISTINCT` query with a subquery inside a + `HAVING` clause, the inner subquery attempts to + use a column reference for a column from the outer + `DISTINCT` query, but this should be allowed + only if the subquery is used somewhere outside of the + `HAVING`, or if the outer + `SELECT` does not use grouping. The current + issue came about because such a query was allowed to run even + though neither of these conditions were met. + + To fix this, the column reference check is expanded to detect an + invalid column reference of this sort, and to return an error if + it does. + + Our thanks to Song Zhibai for the contribution. + (Bug #97742, Bug #30617496) + +### Packaging Notes + +* The GnuPG build key used to sign MySQL downloadable packages has + been updated. The previous GnuPG build key is set to expire on + 2022-02-16. For information about verifying the integrity and + authenticity of MySQL downloadable packages using GnuPG + signature checking, or to obtain a copy of our public GnuPG + build key, see [Signature Checking Using GnuPG](/doc/refman/8.0/en/checking-gpg-signature.html). + + Due to the GnuPG key update, systems configured to use + `repo.mysql.com` may report a signature + verification error when upgrading to MySQL 5.7.37 and higher or + to MySQL 8.0.28 and higher using `apt` or + `yum`. Use one of the following methods to + resolve this issue: + + 1. Manually reinstall the MySQL APT or YUM repository setup + package from + . + 2. Download the MySQL GnuPG public key and add it your system + GPG keyring. + + + For MySQL APT repository instructions, see + [Appendix + A: Adding and Configuring the MySQL APT Repository + Manually](/doc/mysql-apt-repo-quick-guide/en/#repo-qg-apt-repo-manual-setup). + + For MySQL YUM repository instructions, see + [Upgrading + MySQL with the MySQL Yum Repository](/doc/mysql-yum-repo-quick-guide/en/#repo-qg-yum-upgrading). + + (Bug #33587308) +* The bundled `libedit` library was upgraded to + version 20210910-3.1. + (Bug #33568767) + +### Performance Schema Notes + +* A new statement metric, `CPU_TIME`, is now + available, enabling you to measure the CPU time spent on a + query. + + The following changes were made to support this: + + + A timer, `THREAD_CPU`, was added to the + Performance Schema + [`PERFORMANCE_TIMERS`](/doc/refman/8.0/en/performance-schema-performance-timers-table.html) table. + + A consumer, `events_statements_cpu` was + added to the Performance Schema + [`setup_consumers`](/doc/refman/8.0/en/performance-schema-setup-consumers-table.html) table. + + `events_statements_cpu` is disabled by + default. + + A Performance Schema command option, + `performance-schema-consumer-events-statements-cpu` + to enable or disable the consumer, + `events_statements_cpu`. + + See [Performance Schema Command Options](/doc/refman/8.0/en/performance-schema-options.html) for more + information. + + The following columns were added: + + - `CPU_TIME` column was added to the + following Performance Schema tables: + + * [`events_statements_current`](/doc/refman/8.0/en/performance-schema-events-statements-current-table.html) + * [`events_statements_history`](/doc/refman/8.0/en/performance-schema-events-statements-history-table.html) + * [`events_statements_history_long`](/doc/refman/8.0/en/performance-schema-events-statements-history-long-table.html) + + `CPU_TIME` is the time spent on CPU + for the current thread, expressed in picoseconds. + - `SUM_CPU_TIME` column was added to + the following Performance Schema tables: + + * [`events_statements_summary_by_thread_by_event_name`](/doc/refman/8.0/en/performance-schema-statement-summary-tables.html) + * [`events_statements_summary_by_account_by_event_name`](/doc/refman/8.0/en/performance-schema-statement-summary-tables.html) + * [`events_statements_summary_by_user_by_event_name`](/doc/refman/8.0/en/performance-schema-statement-summary-tables.html) + * [`events_statements_summary_by_host_by_event_name`](/doc/refman/8.0/en/performance-schema-statement-summary-tables.html) + * [`events_statements_summary_global_by_event_name`](/doc/refman/8.0/en/performance-schema-statement-summary-tables.html) + * [`events_statements_summary_by_digest`](/doc/refman/8.0/en/performance-schema-statement-summary-tables.html) + * [`events_statements_summary_by_program`](/doc/refman/8.0/en/performance-schema-statement-summary-tables.html) + * [`prepared_statements_instances`](/doc/refman/8.0/en/performance-schema-prepared-statements-instances-table.html) + + SUM\_CPU\_TIME is the CPU time spent on the current + thread, expressed in picoseconds, for the + corresponding aggregations. + - `CPU_LATENCY` column was added to + the following sys schema tables: + + * [`statement_analysis`](/doc/refman/8.0/en/sys-statement-analysis.html) + * [`user_summary_by_statement_type`](/doc/refman/8.0/en/sys-user-summary-by-statement-type.html) + * [`user_summary_by_statement_latency`](/doc/refman/8.0/en/sys-user-summary-by-statement-latency.html) + * [`host_summary_by_statement_type`](/doc/refman/8.0/en/sys-host-summary-by-statement-type.html) + * [`host_summary_by_statement_latency`](/doc/refman/8.0/en/sys-host-summary-by-statement-latency.html) + * [`processlist`](/doc/refman/8.0/en/sys-processlist.html) + * [`session`](/doc/refman/8.0/en/sys-session.html) + + CPU latency is the CPU time spent on the current + thread, expressed in human-readable form. + - `CPU_LATENCY` column was added to + the following sys schema `x$` + tables: + + * [`x$statement_analysis`](/doc/refman/8.0/en/sys-statement-analysis.html) + * [`x$user_summary_by_statement_type`](/doc/refman/8.0/en/sys-user-summary-by-statement-type.html) + * [`x$host_summary_by_statement_type`](/doc/refman/8.0/en/sys-host-summary-by-statement-type.html) + * [`x$processlist`](/doc/refman/8.0/en/sys-processlist.html) + * [`x$session`](/doc/refman/8.0/en/sys-session.html) + * [`x$user_summary_by_statement_latency`](/doc/refman/8.0/en/sys-user-summary-by-statement-latency.html) + * [`x$host_summary_by_statement_latency`](/doc/refman/8.0/en/sys-host-summary-by-statement-latency.html) + + CPU latency is the CPU time spent on the current + thread, expressed in picoseconds. + + Our thanks to Facebook for their contribution to this fix. + (Bug #32202060, Bug #101764, WL #14779) + +### Functionality Added or Changed + +* **Important Change:** + The number of distinct windows which can appear in a given + [`SELECT`](/doc/refman/8.0/en/select.html) is now limited to 127. The + number of distinct windows is the sum of the named windows and + the implicit windows specified as part of any window function's + `OVER` clause. + + In order to use a large number of windows, it may be necessary + to increase the value of the + [`thread_stack`](/doc/refman/8.0/en/server-system-variables.html#sysvar_thread_stack) server system + variable. + (Bug #33279604) +* **InnoDB:** + `InnoDB` now supports + [`ALTER TABLE ... + RENAME COLUMN`](/doc/refman/8.0/en/alter-table.html) operations using + `ALGORITHM=INSTANT`. + + Operations that support `ALGORITHM=INSTANT` + only modify metadata in the data dictionary. Table data is + unaffected, making the operations instantaneous. If not + specified explicitly, `ALGORITHM=INSTANT` is + used by default by DDL operations that support it. + + For more information about this and other DDL operations that + support `ALGORITHM=INSTANT`, see + [Online DDL Operations](/doc/refman/8.0/en/innodb-online-ddl-operations.html). + (WL #14785) +* It is theoretically possible for a user with sufficient + permissions using MySQL Enterprise Audit to mistakenly create an + “abort” item in the audit log filter that prevents + themselves and other administrators from accessing the system. + From MySQL 8.0.28, the `AUDIT_ABORT_EXEMPT` + privilege is available to permit a user account’s queries to + always be executed even if an “abort” item would + block them. Accounts with this privilege can therefore be used + to regain access to a system following an audit + misconfiguration. The query is still logged in the audit log, + but instead of being rejected, it is permitted due to the + privilege. + + Accounts created in MySQL 8.0.28 or later with the + `SYSTEM_USER` privilege have the + `AUDIT_ABORT_EXEMPT` privilege assigned + automatically when they are created. The + `AUDIT_ABORT_EXEMPT` privilege is also assigned + to existing accounts with the `SYSTEM_USER` + privilege when you carry out an upgrade procedure with MySQL + 8.0.28 or later, if no existing accounts have that privilege + assigned. + (WL #14670) +* The [`tmp_table_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_tmp_table_size) variable now + defines the maximum size of individual in-memory internal + temporary tables created by the TempTable storage engine. An + appropriate size limit prevents individual queries from + consuming an inordinate amount global TempTable resources. See + [Internal Temporary Table Storage Engine](/doc/refman/8.0/en/internal-temporary-tables.html#internal-temporary-tables-engines). + (WL #14647) +* The [`innodb_open_files`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_open_files) variable, + which defines the number of files `InnoDB` can + have open at one time, can now be set at runtime using a + `SELECT + innodb_set_open_files_limit(N)` + statement. The statement executes a stored procedure that sets + the new limit. + + To prevent non-LRU manged files from consuming the entire + [`innodb_open_files`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_open_files) limit, + non-LRU managed files are now limited to 90 percent of the + [`innodb_open_files`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_open_files) limit, which + reserves 10 percent of the + [`innodb_open_files`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_open_files) limit for LRU + managed files. + + The [`innodb_open_files`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_open_files) limit now + includes temporary tablespace files, which were not counted + toward the limit previously. + (WL #14591) +* The functions [`FROM_UNIXTIME()`](/doc/refman/8.0/en/date-and-time-functions.html#function_from-unixtime), + [`UNIX_TIMESTAMP()`](/doc/refman/8.0/en/date-and-time-functions.html#function_unix-timestamp), and + [`CONVERT_TZ()`](/doc/refman/8.0/en/date-and-time-functions.html#function_convert-tz) now handle 64-bit + values on platforms that support them, including 64-bit versions + of Linux, MacOS, and Windows. + + On compatible platforms, `FROM_UNIXTIME()` now + accepts a maximum argument of 32536771199.999999 seconds, + corresponding to `'3001-01-18 23:59:59.999999'` + UTC (including the optional fraction of up to 6 digits). If the + argument is larger than this, the function returns + `NULL`. + + On compatible platforms, `UNIX_TIMESTAMP()` now + accepts a maximum value of `'3001-01-18 + 23:59:59.999999'` UTC, corresponding to + 32536771199.999999 seconds since the Unix Epoch. If the argument + is larger than this, the function returns `0`. + + In addition, on compatible platforms, + `CONVERT_TZ()` now performs time zone + conversion beyond 2038, up to `'3001-01-18 + 23:59:59.999999'` UTC. If the datetime argument exceeds + this value, the argument is returned unchanged. This + “no-op” behavior is the same as previously with + values beyond `'2038-01-19 03:14:07.999999'` + UTC. + + The behavior of these 3 functions on 32-bit platforms is + unchanged. + + The behavior of the [`TIMESTAMP`](/doc/refman/8.0/en/datetime.html) + type is also unaffected by this change; its maximum allowed + value remains `'2038-01-19 03:14:07.999999'` + UTC, regardless of platform. For dates futureward of this, use + the MySQL [`DATETIME`](/doc/refman/8.0/en/datetime.html) type instead. + (WL #14630) +* This release introduces monitoring and limiting of memory + allocation on a global and per-user basis. You can now observe + the total memory consumed by all user connections by checking + the value of the + [`Global_connection_memory`](/doc/refman/8.0/en/server-status-variables.html#statvar_Global_connection_memory) + status variable, which must be enabled by setting + [`global_connection_memory_tracking = + 1`](/doc/refman/8.0/en/server-system-variables.html#sysvar_global_connection_memory_tracking). + + The total includes memory used by system processes, or by the + MySQL root user, although these users are not subject to + disconnection due to memory usage. + + Memory used by the [`InnoDB`](/doc/refman/8.0/en/innodb-storage-engine.html) buffer + pool is not included in the total. + + You can control indirectly how often the status variable is + updated by adjusting + [`connection_memory_chunk_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_connection_memory_chunk_size); + `Global_connection_memory` is updated only when + the total memory usage varies by more than this amount. + + You can specify limits on resource consumption per user + connection by setting + [`connection_memory_limit`](/doc/refman/8.0/en/server-system-variables.html#sysvar_connection_memory_limit); any + user whose memory usage exceeds this amount cannot issue + additional queries. You can also impose a global memory limit by + setting + [`global_connection_memory_limit`](/doc/refman/8.0/en/server-system-variables.html#sysvar_global_connection_memory_limit). + Whenever `Global_connection_memory` exceeds the + global limit, no regular users can issue new queries requiring + memory usage. System users such as MySQL root are not bound by + these limits. + (WL #13458) + +### Bugs Fixed + +* **InnoDB:** + The minimum I/O buffer size calculated during an index creation + operation did not align with the I/O block size, permitting a + record to exceed the buffer boundary. + (Bug #33570629) +* **InnoDB:** + The `sync_array_detect_deadlock` algorithm used + by the semaphore deadlock checker in debug builds was simplified + in terms of code and time complexity, and an implementation of + the algorithm was introduced for use in release builds. + (Bug #33538505) +* **InnoDB:** + The `ut::make_unique` library function in the + `InnoDB` sources now permits specifying the + type of field allocated. + (Bug #33538461) +* **InnoDB:** + A Performance Schema instrumentation was added for tracking redo + log buffer memory allocations. + (Bug #33527660) +* **InnoDB:** + Warnings printed to the error log for long semaphore waits did + not provide information about the latch owner. + (Bug #33509386) +* **InnoDB:** + A latch release and reacquisition mechanism was introduced to + reduce the amount of time that threads spend in critical + sections protected by a global lock system latch. + (Bug #33502610, Bug #33563523) +* **InnoDB:** + A hole punch operation on Windows caused a failure. The + operation was performed as an overlapped (asynchronous) + operation, which requires a `OVERLAPPED` + structure containing a handle to an event object. The + `OVERLAPPED` structure was not provided. + (Bug #33496778) +* **InnoDB:** + The `ut_time()` infrastructure in the + `InnoDB` sources was replaced with a + type-checked standard library implementation. + (Bug #33460092) +* **InnoDB:** + Numerous Trying to access missing tablespace + errors were printed to the error log following a + restore operation. + (Bug #33437625) +* **InnoDB:** + Performance Schema aware `ut::make_unique` and + `ut::make_shared` memory management library + functions were added to the `InnoDB` sources. + Similar functions (`ut::make_unique_aligned` + and `ut::make_shared_aligned`) were added for + types with extended alignment. + (Bug #33420694) +* **InnoDB:** + The `buf_validate()` function in the + `InnoDB` sources was optimized, improving + performance on debug builds. + + Thanks to Hobert Lu for the contribution. + (Bug #33417058, Bug #104967) +* **InnoDB:** + On a NUMA-enabled system, the page size of memory chunks + allocated to the buffer pool did not align with the system page + size in certain scenarios, causing in the following error: + Failed to set NUMA memory policy of buffer pool page + frames to MPOL\_INTERLEAVE. + (Bug #33406701) + + References: This issue is a regression of: Bug #32714144. +* **InnoDB:** + Two instances of `std::unique_ptr` with + `mem_heap` in the `InnoDB` + sources now use the `Scoped_heap()` wrapper, + which uses a stateless function object instead of a pointer to a + function. + (Bug #33405520) +* **InnoDB:** + The `m_end_range` flag in the + `prebuilt` struct, which is set to true when + the end of the range is exceeded while populating the prefetch + cache, was not set to false when the prefetch cache was reset + (initialized). As a result, in cases where the end of the range + is not exceeded and the handler is reused, the + `m_end_range` flag could be set incorrectly the + next time the prefect cache is used. + (Bug #33384537) +* **InnoDB:** + Column metadata in the data dictionary was not updated when a + new table ID was assigned to a table after discarding the + table's tablespace during a table import operation. + (Bug #33319149) +* **InnoDB:** + Setting the `innodb_interpreter` debug-only + system variable to `NULL` caused a failure. + (Bug #33316661) +* **InnoDB:** + Full-text index creation file management was improved. + (Bug #33270893) +* **InnoDB:** + An update operation that inserted a new row into a temporary + table used for aggregation caused the temporary table to be + moved to disk and the update operation to be retried on the new + on-disk temporary table. A BLOB pointer in the record data + prepared before the temporary table was moved to disk was + rendered stale, causing a failure. + (Bug #33242407) +* **InnoDB:** + Memory allocation is now performed by a new standards-compliant + custom memory allocator which is compatible with Performance + Schema. + (Bug #33159210) +* **InnoDB:** + A race condition between threads attempting to deinitialize and + initialize statistics for the same table raised and assertion + failure. + (Bug #33135425) +* **InnoDB:** + An + [`innodb_flush_log_at_trx_commit`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_flush_log_at_trx_commit) + setting other than 1 or a long running transaction could have + resulted in an inconsistent rate of redo log flushing. + (Bug #33128461) +* **InnoDB:** + Allocation of large pages is now handled by a library designed + to handle this. In cases where the large page allocation + mechanism cannot be used, a fallback mechanism allocates regular + aligned pages. Fallback can occur when large page address space + is exhausted, when large page support is disabled by the + underlying hardware or operating system architecture, or when + large page support in MySQL is disabled explicitly + ([`--large-pages=0`](/doc/refman/8.0/en/server-options.html#option_mysqld_large-pages)). Occurrences of + `ut_allocator` functions for allocation and + deallocation of large pages have been replaced by the new + library functions. + (Bug #33119009, Bug #33118309, Bug #33149501, Bug #32135935) +* **InnoDB:** + Handling of regular 4K page-aligned allocations is now performed + by a self-contained library which is compatible with Performance + Schema. + (Bug #33118362) +* **InnoDB:** + Functions belonging to a new `InnoDB` library + responsible for dynamic storage management of suitably aligned + types has replaced the functions previously used for this + purpose. + (Bug #33110341) +* **InnoDB:** + Dynamic allocation of suitably aligned types is now handled by a + library which is compatible with Performance Schema. + (Bug #33110312) +* **InnoDB:** + While a purge thread was freeing LOB pages at end of a purge + batch, a required index data structure was freed, causing a + failure. + (Bug #32918325) +* **InnoDB:** + Inconsistencies in Performance Schema instrumentation logic for + dynamic memory management functions (`ut_*` + functions) were addressed. + (Bug #32715466) +* **InnoDB:** + `InnoDB` dynamic allocation routine limitations + prevented dynamic allocation of an array of constructible types. + The limitations have been addressed, permitting allocation of + default constructible types, non-default constructible types, + and types that are both default and non-default constructible. + (Bug #32714047) +* **InnoDB:** + When using [`READ COMMITTED`](/doc/refman/8.0/en/innodb-transaction-isolation-levels.html#isolevel_read-committed) or + [`READ UNCOMMITTED`](/doc/refman/8.0/en/innodb-transaction-isolation-levels.html#isolevel_read-uncommitted), certain + queries executed on a table inside of a trigger or function + prevented concurrent transactions on the same table. The + acquired locks were too restrictive. + (Bug #32636792) +* **InnoDB:** + Hole punch functionality was not working as expected for + tablespace pages that were encrypted and compressed, for most + pages on Windows, and for Windows volumes that do not implement + Microsoft volume management functions. + (Bug #32136255) +* **InnoDB:** + Replacing the `ut_time()` infrastructure with a + type-checked standard library (`std`) + implementation in MySQL 8.0.28 caused a performance regression. + The regression was due the time library used by + `std` clocks, which generates system calls. Low + resolution clocks are now used instead. + (Bug #107763, Bug #34352870) + + References: This issue is a regression of: Bug #33460092. +* **Packaging:** + Added an `icu-data-files` RPM that was + separated from the `server` package. This is a + package of ICU data files needed by MySQL regular expressions. + (Bug #35162346) +* **Partitioning:** + Creating a table with nondeterministic functions in generated + column expressions should not be possible, but this was not + enforced in all cases; a series of one or more + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) statements could be + employed to arrive at a partitioned table with one or more such + generated columns. When attempting to execute the + [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) statement obtained + by running [`SHOW CREATE TABLE`](/doc/refman/8.0/en/show-create-table.html) + against this table, MySQL rejected the statement with a + misleading error message referring to the partitioning + expression rather than to the problematic column, despite the + fact that the partitioning expression itself was legal. + + This was caused by the result of a check for any unsafe + expressions defined for a generated column (in the internal + variable `thd->safe_to_cache_query`), which + was later checked again without being cleared while parsing the + partition expression, leading to an error even when the + partition expression did not refer to the problematic generated + column expression. Now in such cases, we reset + `thd->safe_to_cache_query` before parsing + the partition function. + + The issue of allowing the use of certain nondeterminstic + functions ([`AES_ENCRYPT()`](/doc/refman/8.0/en/encryption-functions.html#function_aes-encrypt), + [`AES_DECRYPT()`](/doc/refman/8.0/en/encryption-functions.html#function_aes-decrypt), + [`RANDOM_BYTES()`](/doc/refman/8.0/en/encryption-functions.html#function_random-bytes)) in generated + columns is handled separately. + (Bug #29268656) + + References: See also: Bug #32592320. +* **Partitioning:** + A query using an index other than the primary key of a + partitioned table sometimes resulted in excessive CPU load. + (Bug #104576, Bug #33238010) +* **Replication:** + A `PURGE BINARY LOGS` statement could be issued + while the instance was locked for backup, which contravened the + rules of the backup lock by removing files from the server. The + statement now cannot be used while a LOCK INSTANCE FOR BACKUP + statement is in effect. + (Bug #33437026) +* **Replication:** + Replication stopped with an error when reading a table map event + if the name of the table or database was over 64 bytes – the + limit is 64 characters, so the use of multi-byte characters + could cause this situation. The replica now no longer checks the + size of the table and database names, and supports the + transmission of longer names. + (Bug #33305975, Bug #104798) +* **Replication:** + A lock conflict could occur if the Performance Schema table + `replication_applier_status_by_worker` was + queried while a `STOP REPLICA` command was in + progress. The issue has now been resolved. + (Bug #33290947) +* **Replication:** + From MySQL 8.0.26, new versions of the plugins that implement + semisynchronous replication are supplied to replace the terms + “master” and “slave” with “source” and + “replica”. Following this, the `UNINSTALL + PLUGIN` statement incorrectly allowed the old versions + of the plugins, `rpl_semi_sync_master` and + `rpl_semi_sync_slave`, to be uninstalled when + replication channels were currently using them. The issue has + now been fixed. + (Bug #33270401) +* **Replication:** + When the `PAD_CHAR_TO_FULL_LENGTH` SQL mode was + enabled on a replica server, trailing spaces could be added to a + replication channel’s name in the replication metadata + repository tables, resulting in errors in replication operations + that identified the channel using that data. The issue has now + been fixed in MySQL 8.0 by using VARCHAR for character columns, + and in MySQL 5.7 by disabling the SQL mode when reading from + those tables. Thanks to Brian Yue for the contribution. + (Bug #33213841) +* **Replication:** + If a replica was disconnecting while a `SHOW + REPLICAS` statement was being issued, the server was + able to access deleted data. + (Bug #33206343, Bug #104566) +* **Replication:** + If a replica server with the system variable + `replica_preserve_commit_order = 1` set was + used under intensive load for a long period, the instance could + run out of commit order sequence tickets. Incorrect behavior + after the maximum value was exceeded caused the applier to hang + and the applier worker threads to wait indefinitely on the + commit order queue. The commit order sequence ticket generator + now wraps around correctly. Thanks to Zhai Weixiang for the + contribution. + (Bug #32891221, Bug #103636) +* **Replication:** + The replication receiver thread stopped with an error if the + replication source server sent a heartbeat event containing a + binary log file position that was above the 4GB offset, due to + the large size of the binary log file. A new heartbeat event + (Heartbeat\_log\_event\_v2, log event type 41) that handles the + larger value correctly has been added for use in this situation. + (Bug #29913991) +* **Group Replication:** + Group Replication could stop unexpectedly during the auto-rejoin + procedure while the Performance Schema replication group member + statistics table was being checked. The concurrency of the + operations is now handled correctly. + (Bug #33609089) +* **Group Replication:** + Group Replication's selection process for a group member to be + the donor for distributed recovery involves the use of the + standard random selector defined for the operating system. If + this random device was not available and an exception was + thrown, the member's joining process stopped. Group Replication + now takes this possibility into account and uses a fallback + random selector if the one on the operating system returns an + error. + (Bug #33596124) +* **Group Replication:** + The `STOP GROUP_REPLICATION` statement stops + asynchronous replication channels on the group member, but it + does not implicitly commit transactions that are in progress on + them like `STOP REPLICA` does. This is because + on a Group Replication group member, an additional transaction + committed during the shutdown operation would leave the member + inconsistent with the group and cause an issue with rejoining. + The server is left in a read-only state after the operation is + completed. This situation leads to failed commits for + transactions that are in progress while stopping Group + Replication, so to avoid these, the `STOP + GROUP_REPLICATION` statement now cannot be issued while + a GTID is assigned as the value of the + `gtid_next` system variable. + (Bug #33412483) +* **Group Replication:** + An expelled group member using the Group Replication auto-rejoin + procedure reported its state as RECOVERING too early on, while + it was still collecting information from other group members and + before the compatibility checks were complete. The state change + is now carried out while the view is being installed, which is + the point where the rejoining member is actually accepted as a + group member. + (Bug #33380840) +* **Group Replication:** + Disabling the Group Replication plugin in a MySQL source + distribution using the CMake option + `DWITH_GROUP_REPLICATION=0` did not disable + applications and tests related to Group Replication, which + caused them to build incorrectly. + (Bug #33308513) +* **Group Replication:** + In Group Replication, if a `SET gtid_next` + statement is used on a group member to set the GTID for the next + transaction, it is possible for the same GTID to be used for a + transaction that starts concurrently on another member. If both + transactions reach the commit stage, the second one in the total + order is rolled back, resolving the situation. However, when the + transaction consistency level for Group Replication (the + `group_replication_consistency` system + variable) was set to `BEFORE` or + `BEFORE_AND_AFTER`, members could reach a + deadlock with one holding ownership of a GTID in the + `gtid_owned` set, and another waiting for + ownership to be released before committing the transaction. The + wait function now only considers the GTIDs for committed + transactions and not the GTIDs that are owned but not committed, + except where a session owns a GTID that is concurrently + committed, in which case the executing session errors out. + (Bug #33051454, Bug #104096) +* **Group Replication:** + The group communication engine for Group Replication (XCom, a + Paxos variant) now logs more information in the situation where + the existing group members have difficulty in communicating with + a joining member, for example due to network issues. This can + result in the group remembering an old incarnation of the + joining member and not allowing it to attempt to join again. + (Bug #32873315) +* **Group Replication:** + Group Replication's Group Communication System (GCS) now + differentiates in its records of expelled members between those + that had successfully joined the group, and those that never did + manage to join the group. + (Bug #32630484) +* **Group Replication:** + A race condition occurred if the Group Replication group member + statistics in the Performance Schema were queried when Group + Replication was being started or stopped. + (Bug #32392468) +* **Microsoft Windows:** + On Windows, added missing debug and test suite binaries for + MySQL Server (commercial) and MySQL NDB Cluster (commercial and + community). + (Bug #32713189) +* **JSON:** + When the first argument passed to + [`JSON_TABLE()`](/doc/refman/8.0/en/json-table-functions.html#function_json-table) was a row instead of + a single JSON value, an assertion was raised while trying to + evaluate the row expression. We fix this by raising an error + during function resolution if the first argument is a row, so + that the row expression itself is never evaluated. + (Bug #33414235) +* Using [`LPAD()`](/doc/refman/8.0/en/string-functions.html#function_lpad) or + [`RPAD()`](/doc/refman/8.0/en/string-functions.html#function_rpad) in the expression for a + generated column led to corrupted indexes on the parent table. + (Bug #33661337) + + References: See also: Bug #32668730, Bug #33238711. +* In some cases where warnings were issued, rows were missing from + the results of aggregation using a temporary table. + (Bug #33603911) +* For openSUSE 15, added the libtirpc rpcgen build requirement in + `mysql.spec` to now use TI-RPC. + (Bug #33582982) +* An [`UPDATE`](/doc/refman/8.0/en/update.html) statement acting on + multiple tables sometimes adds elements to a list each time it + is executed. Elements were never removed from this list, which + increased the memory footprint for each execution of the + statement. We fix this by clearing the element list following + execution. + (Bug #33574408) +* The size of the `HOST` column of the + Performance Schema [`processlist`](/doc/refman/8.0/en/performance-schema-processlist-table.html) + table is increased from VARCHAR(255) to VARCHAR(261). + (Bug #33570218) +* A keyring migration failure due to an OpenSSL error raised an + assertion. The SSL error state was not flushed from the thread's + OpenSSL error queue. + (Bug #33546207) +* A process listing function call caused a failure. + (Bug #33511690) +* The commercial Debian server packages contained two testing + plugins (component\_test\_page\_track\_component.so and + component\_test\_global\_priv\_registration.so); they were moved to + the separate and optional testing package. + (Bug #33504443) +* For Fedora, increased the release package version number from 1 + to 10; this to help eliminate potential installation related + problems with native Fedora dnf/yum packages of the same + version. + (Bug #33504443) +* Increased compat level to 11 for Debian-based packages as the + previous level of 9 is deprecated; and replaced calls to + dh\_systemd\_enable + dh\_systemd\_start with dh\_installsystemd to + satisfy requirements for compatibility level 10+. + (Bug #33458752) +* A delete operation involving a full-text search query caused a + failure. + (Bug #33455243) +* An improperly handled error caused a startup failure when using + the `keyring_okv` plugin. + (Bug #33449117) +* For Debian, added a `mysql-community-server` + dependency to the + `mysql-community-server-debug` package so as to + pull in all required packages needed by the debug build. + (Bug #33426737) +* For virtual generated columns of type + [`DECIMAL`](/doc/refman/8.0/en/fixed-point-types.html), we now always store some + data, so that we avoid undefined behavior when trying to convert + the field buffer to a decimal value. + (Bug #33424846) +* MySQL now supports pushing a condition down to a derived table + when an expression from the underlying derived table contains a + variable set by a stored procedure. + (Bug #33423394) +* [`tls_version`](/doc/refman/8.0/en/server-system-variables.html#sysvar_tls_version) and + [`admin_tls_version`](/doc/refman/8.0/en/server-system-variables.html#sysvar_admin_tls_version) settings are + now validated server startup. + (Bug #33390209) +* The [`admin_tls_version`](/doc/refman/8.0/en/server-system-variables.html#sysvar_admin_tls_version) variable + accepted an invalid value. + (Bug #33389818) +* If two or more deprecated system variables were persisted using + a `SET PERSIST` statement, when the server was + restarted, a deprecation warning was only logged for the first + of the deprecated system variables. + (Bug #33388488) +* For an index range scan whose key parts are equal, the range is + now shown as an equality. For example, `a = 3` + is now displayed, instead of `3 <= a <= + 3` previous to this change. + (Bug #33351123) +* Replaced `/var/run` references with + `/run` as `/var/run` usage + is + [deprecated](https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html) + for `tmpfiles.d` configuration files. The + symlink from `/var/run` to + `/run` remains to keep current setups + functional. + (Bug #33351110, Bug #33588618) +* Executing [`SHOW PROCESSLIST`](/doc/refman/8.0/en/show-processlist.html) or + accessing + [`INFORMATION_SCHEMA.PROCESSLIST`](/doc/refman/8.0/en/information-schema-processlist-table.html) on a + server with a specific configuration caused a failure. + (Bug #33341623) +* Added a mapping from ICU error code + `U_FILE_ACCESS_ERROR` to the new MySQL error + code [`ER_REGEXP_MISSING_FILE`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_regexp_missing_file). + (Bug #33326003) +* A failed keyring function argument validation check caused a + failure. + (Bug #33319782) +* The index range scan iterator did not always increment the + number of rows examined as expected. + (Bug #33305632) +* Enabling the `create_admin_listener_thread` + system variable on the command line could cause a server exit + during startup under specific error conditions. + (Bug #33300587) +* The [`SUBSTR()`](/doc/refman/8.0/en/string-functions.html#function_substr) function did not + always correctly handle errors raised when trying to evaluate + its arguments. + (Bug #33290160) +* International Components for Unicode version 67 introduced a new + implementation for `\X` (match a grapheme + cluster), which requires locale data not currently included with + MySQL. + + This means that, when using the version of ICU bundled with + MySQL, a query using `\X` raises the error + [`ER_REGEXP_MISSING_RESOURCE`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_regexp_missing_resource); when + using ICU supplied by the system, we report + [`ER_WARN_REGEXP_USING_DEFAULT`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_warn_regexp_using_default) as + a Note. + (Bug #33290090) +* A full-text search query on a table stored in the + `BLACKHOLE` storage engine where the chosen + query plan used a full-text index scan caused an error instead + of returning an empty result set. + (Bug #33250020) +* The `LOCK_TIME` returned by the performance + schema was under evaluated, missing time spent in rows locks, + and time spent when locking multiple tables. As of this release, + `LOCK_TIME` accounts for: + + + all the time waited on SQL TABLES + + all the time waited on DATA locks + + `LOCK_TIME` is now reported consistently in the + slow log and the performance schema. + (Bug #33236909) +* A new option `\T` for the + **mysql** client prompt prints an asterisk + (`*`) if the current session is inside a + transaction block. You can use the option with the + `--prompt` command-line option, in a MySQL + option file, or with the `MYSQL_PS1` + environment variable. Thanks to Murakami Kohei for the + contribution. + (Bug #33214862, Bug #104598) +* Constant subqueries in `RANGE INTERVAL` + expressions were not always handled correctly. + (Bug #33197418) +* Decimal expressions which evaluated as `NULL` + were not always handled correctly. + (Bug #33169048) +* A user account that was granted a MySQL role with a global + [`SELECT`](/doc/refman/8.0/en/privileges-provided.html#priv_select) privilege was denied + access to the `mysql` database. The user + account's global privileges were not checked when the role was + granted. + (Bug #33159353, Bug #104423) +* When setting up an `Item_ref` to a + [`SELECT`](/doc/refman/8.0/en/select.html) alias, its cached + properties are copied (including whether it is part of a + `ROLLUP` expression or not). However, these + might not yet be correctly computed, so the computation should + to be done first or the values could be wrong. Having the wrong + value could cause certain expressions to be materialized in an + intermediate step when they should not (because they contain + `ROLLUP` expressions that are not ready for + computation, but having the wrong value is unknown at this + point). The issue is fixed by forcing cached values to be + recomputed when an item is designated as a rollup item. + (Bug #33149402, Bug #104394) +* An invalid comment string detected while upgrading a table from + MySQL 5.7 to MySQL 8.0 caused the upgrade to fail with errors + that did not provide sufficient contextual information. + (Bug #33148961) +* It was possible in some cases to create a generated column of + type `SERIAL`, which is not allowed. + + See [Numeric Data Type Syntax](/doc/refman/8.0/en/numeric-type-syntax.html), and + [CREATE TABLE and Generated Columns](/doc/refman/8.0/en/create-table-generated-columns.html), for more + information + (Bug #33141966) +* Statements which commit a transaction implicitly or explicitly + are not allowed inside a trigger or a stored function. Both + [`CREATE TRIGGER`](/doc/refman/8.0/en/create-trigger.html) and + [`CREATE FUNCTION`](/doc/refman/8.0/en/create-function.html) should report an + error + ([`ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_commit_not_allowed_in_sf_or_trg)) + in this case, but did not correctly handle + [`DROP TABLESPACE`](/doc/refman/8.0/en/drop-tablespace.html). + (Bug #33141958) +* A [`SHOW TABLE STATUS`](/doc/refman/8.0/en/show-table-status.html) operation + raised an assertion failure when run on a table defined with a + very large `AVG_ROW_LENGTH` value. + (Bug #33114368) +* When calculating the maximum number of rows likely to be read + from a scan, the intermediate result was a double that could + become greater than the maximum allowed value for a 64-bit + unsigned integer. This triggered undefined behavior when + converting the intermediate double value to an integer, which in + some cases could lead to assert failures. + + We fix this by clamping the result in the range [1, + `UINT64_MAX`]. + (Bug #33066458) +* Queries using both `UNION` and `LIMIT + 0` triggered an assert failure in debug builds. + (Bug #33066455) + + References: This issue is a regression of: Bug #32302724. +* Renaming an event using + [`ALTER EVENT ... + RENAME TO`](/doc/refman/8.0/en/alter-event.html) did not delete the Performance Schema + instrumentation for the original event. + (Bug #33059358) +* An SSL handshake assertion was raised on debug builds when using + the thread pool plugin. + (Bug #33012398) +* Some prepared statements using either `GROUP BY WITH + ROLLUP` or one or more window functions could be + executed successfully only once. + (Bug #33007266) +* An error occurred for statements of the form + [`INSERT INTO + view + VALUE(tuple) AS + row_alias(id_list)`](/doc/refman/8.0/en/insert.html). + When executing such statements, the server calls the internal + function + `Sql_cmd_insert_base::prepare_values_table()` + in order to prepare the derived table created as a + `VALUES` alias; this function populates + `Sql_cmd_insert_base.values_field_list` with + `Item_field` objects pointing to the columns of + the underlying table. When inserting into a view rather than a + table, an expected `real_item()` transform, + needed to map from an `Item_view_ref` + referencing the view column to an `Item_field` + representing the corresponding column in the underlying table, + was not performed. + (Bug #32858783) +* Some multiply-nested subselects were not handled correctly, and + could lead to an unplanned shutdown of the server. + (Bug #32547812) +* Inspection of a session thread object during a `SHOW + PROCESSLIST` operation and a concurrent change to the + thread's security context resulted in a race condition. + (Bug #32320541, Bug #102052) +* In cases where there are no operations to be performed on the + result of a [`UNION`](/doc/refman/8.0/en/union.html), the rows are + streamed without storing them in a temporary table, although a + placeholder for the temporary table still exists in the query + block. Since this table is not instantiated, a check for + estimates of the cost of reading the rows from the table while + calculating the access cost and optimizing for range based + access had unpredictable results. + + We fix this by skipping retrieval of such row estimates in the + case of an uninstantiated temporary table. + (Bug #32255904) +* A multi-table [`DELETE`](/doc/refman/8.0/en/delete.html) statement + using common table expressions was not always handled correctly. + (Bug #32238558) + + References: This issue is a regression of: Bug #98330, Bug #30796015. +* If a [`CR_UNKNOWN_ERROR`](/doc/mysql-errors/8.0/en/client-error-reference.html#error_cr_unknown_error) was to be + sent to a client, an exception could occur. + (Bug #31933415) +* SSL-related code was revised to avoid a potential memory leak. + (Bug #31933295) +* In some cases, multiple-table + [`UPDATE`](/doc/refman/8.0/en/update.html) statements could block + concurrent access. + (Bug #31731752) +* Keyring system variables that use an internal slot for complex + settings no longer accept a setting of + `DEFAULT`. + (Bug #30879700) +* The `Timestamp` column in the + `mysql.tables_priv` and + `myql.columns_priv` grant tables was set to a + zero timestamp value (`"0000-00-00 00:00:00"`) + for [`GRANT`](/doc/refman/8.0/en/grant.html) and + [`REVOKE`](/doc/refman/8.0/en/revoke.html) operations, preventing a + logical restore of the grant tables. As of MySQL 8.0.28, a valid + start time value is written to the Timestamp column. + + If you have existing grant table records with zero timestamp + values that are preventing a logical restore of the grant + tables, a workaround is to update records in the grant tables or + in the dump files, replacing zero timestamp values with + [`CURRENT_TIMESTAMP`](/doc/refman/8.0/en/date-and-time-functions.html#function_current-timestamp). + + Thanks to Venkatesh Prasad Venugopal for the contribution. + (Bug #30863899, Bug #98495) +* Producing a per-table dump using **mysqldump** in + MySQL 5.7 and 8.0 requires a longer execution time compared to + MySQL 5.6. This is because the + `information_schema.files` table, which is + queried for information on log file groups by + **mysqldump**, contains information about InnoDB + data files as well as NDB data files from MySQL 5.7. In MySQL + 8.0, the issue has been fixed by rewriting the query to select + only the appropriate data files. In MySQL 5.7, Information + Schema tables do not have indexes, so a full table scan is still + required. + (Bug #29210990, Bug #93875) +* Keyring memory management was improved. + (Bug #25042167) +* Incorrect values for `FORCE INDEX FOR GROUP BY` + could be set while saving and restoring the presence of + `FORCE INDEX` hints within tables. + (Bug #105694, Bug #33604416) +* If a query with the + [`sql_buffer_result`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_buffer_result) system + variable enabled returned just one row, and an attempt was made + to insert the result into a table, then an error in setting the + output from the temporary table could produce a data exception. + (Bug #105351, Bug #33515752) + + References: This issue is a regression of: Bug #33152269. +* Resetting of the active slice was not performed in + `WindowIterator::Read()` at the end the end of + the input result set for windowing. This led to reading wrong + values on reaching the `ORDER BY` sort, since + the number of the active slice was still set to 1—that is, + to the items being read from the input table—while the + `ORDER BY` sorting stage needs to read the + values after computation of any window functions. For this, it + needs the active slice to be that of the last window's output + table. + + We fix this by moving the resetting of the slice to the output + slice immediately following the read, so that it is already set + correctly when returning at the end of the input set and moving + on to the ordering. + + Our thanks to Casa Zhang and the Tencent team for the + contribution. + (Bug #105045, Bug #33399696) +* Code inspection revealed use of `strncpy()` in + the internal function + `set_parse_error_message()` without making sure + that the last byte of the buffer being copied into was a null + byte. We fix this by using `snprintf()` instead + of `strncpy()`; this ensures that the result is + valid even if it is truncated. + (Bug #104856, Bug #33321787) +* When executing prepared statements that activated a trigger + created with the `DEFINER` clause (or a stored + function), invoker privileges were used for checking table + access instead of definer privileges. This, in turn, could cause + privilege checks on tables used by the trigger or stored + function to fail. + (Bug #104168, Bug #33064461) +* When a singleton histogram is constructed, its cumulative + frequency is calculated by adding frequencies of previous + buckets with the current bucket; because a floating-point value + was used for the accumulator, this sometimes led to accumulated + float errors, with the final cumulative frequency fractionally + greater than 1.0. + + This fix accumulates the frequency with an integer type instead, + to avoid intermediate floating-point errors. + + Our thanks to Casa Zhang and the Tencent team for the + contribution. + (Bug #104108, Bug #33045336) +* With + [`index_condition_pushdown=ON`](/doc/refman/8.0/en/server-system-variables.html#sysvar_optimizer_switch) + and + [`transaction_isolation='READ-COMMITTED'`](/doc/refman/8.0/en/server-system-variables.html#sysvar_transaction_isolation), + locks on secondary indexes were not released until the + transaction was either committed or rolled back, even though the + secondary indexes were unmatched. + (Bug #102722, Bug #32554667) +* Multi-valued indexes were not used for queries executed from + within stored functions. + (Bug #102359, Bug #32427727) + + References: See also: Bug #104700, Bug #33268466. +* An error occurred for an SQL statement having the form shown + here: + + ```None + INSERT INTO target_table + SELECT aggregate_expression, non_aggregate_expression + FROM empty_table; + ``` + + This happened when the query plan used aggregation from a + temporary table, and when + *`non_aggregate_expression`* was constant + during one execution of the query, but could vary between + executions. Such an expression might, for example, include a + function such as [`NOW()`](/doc/refman/8.0/en/date-and-time-functions.html#function_now) or + [`USER()`](/doc/refman/8.0/en/information-functions.html#function_user). This resulted in the + temporary table getting a column for + *`non_aggregate_expression`*, which is + unnecessary, since all rows have the same value. In addition, if + there were no rows, there was no legal value to insert into + *`target_table`*, which is what actually + triggered the error. + + We fix this by not using a temporary table column when + *`non_aggregate_expression`* is + `const` for the current execution. + (Bug #102252, Bug #32384355, Bug #33546083) +* When executing a prepared statement that included values passed + in as strings, MySQL attempted to parse them as integers and + could return an error unrelated to the input value. + + After a recent change, dynamic parameter handling was refactored + so that the derived data type for parameters was determined + based on context. For example, in a comparison such as + `int_col = ?`, the + parameter was given the same type as the (integer) column it was + compared to. To preserve compatibility with existing MySQL + applications, if a decimal or float value was supplied as + parameter, the statement was automatically reprepared with new + type assigned to the parameter based on the actual value. This + handling preserved compatibility for numeric parameters. + + However, if a string parameter was supplied, it was still + interpreted as an integer (the resolved data type) and this + behavior was not compatible with older MySQL versions that + detected the actual type of the value. The consequences being + that if `int_col = + ?` is executed with the parameter value + `'1.7'`, only the integer part of the string + was used, making the effective comparison + `int_col = 1`. + + To fix the issue, now when a string parameter is supplied, the + parameter is analyzed to determine if it is an integer, a + decimal, or a float value and the actual data type of the + parameter is updated accordingly. Later, the actual type is + compared to the resolved type and if it is incompatible, the + statement is reprepared with the new actual type. So, the + previous statement now evaluates as + `int_col = 1.7` and + the comparison evaluates using decimal numbers. + (Bug #101806, Bug #32213576, Bug #103364, Bug #32787037) diff --git a/corpus/changelog/mysql_releases/mysql_8029.md b/corpus/changelog/mysql_releases/mysql_8029.md new file mode 100644 index 0000000000000000000000000000000000000000..b0792018919916da16106db21ac4934fb3adb417 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8029.md @@ -0,0 +1,1432 @@ +# MySQL 8.0.29 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-29.html +Version: 8.0.29 + +## Changes in MySQL 8.0.29 (2022-04-26, General Availability) + +Important + +This release is no longer available for download. It was +removed due to a critical issue that could cause data in +[`InnoDB`](/doc/refman/8.0/en/innodb-storage-engine.html) tables having added +columns to be interpreted incorrectly. Please upgrade to MySQL +8.0.30 instead. + +* [Authentication Notes](news-8-0-29.html#mysqld-8-0-29-authentication "Authentication Notes") +* [Character Set Support](news-8-0-29.html#mysqld-8-0-29-charset "Character Set Support") +* [Compilation Notes](news-8-0-29.html#mysqld-8-0-29-compiling "Compilation Notes") +* [Deprecation and Removal Notes](news-8-0-29.html#mysqld-8-0-29-deprecation-removal "Deprecation and Removal Notes") +* [SQL Function and Operator Notes](news-8-0-29.html#mysqld-8-0-29-functions-operators "SQL Function and Operator Notes") +* [Optimizer Notes](news-8-0-29.html#mysqld-8-0-29-optimizer "Optimizer Notes") +* [Performance Schema Notes](news-8-0-29.html#mysqld-8-0-29-performance-schema "Performance Schema Notes") +* [Security Notes](news-8-0-29.html#mysqld-8-0-29-security "Security Notes") +* [SQL Syntax Notes](news-8-0-29.html#mysqld-8-0-29-sql-syntax "SQL Syntax Notes") +* [Test Suite Notes](news-8-0-29.html#mysqld-8-0-29-test-suite "Test Suite Notes") +* [XA Transaction Notes](news-8-0-29.html#mysqld-8-0-29-xa "XA Transaction Notes") +* [X Plugin Notes](news-8-0-29.html#mysqld-8-0-29-xplugin "X Plugin Notes") +* [Functionality Added or Changed](news-8-0-29.html#mysqld-8-0-29-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-29.html#mysqld-8-0-29-bug "Bugs Fixed") + +### Authentication Notes + +* The maximum size of FIDO authenticator data was increased. + (Bug #33655192) + +### Character Set Support + +* **Important Note:** + The server now uses `utf8mb3` rather than + `utf8` in the following cases: + + + In the output of `SHOW` SQL statements + ([`SHOW CREATE TABLE`](/doc/refman/8.0/en/show-create-table.html), + [`SHOW CREATE VIEW`](/doc/refman/8.0/en/show-create-view.html), + [`SHOW CREATE DATABASE`](/doc/refman/8.0/en/show-create-database.html)) + + When reporting invalid strings. + + (Bug #33385252, Bug #33395007) +* The server now uses `utf8mb3` in place of the + alias `utf8` for character set names when + populating data dictionary tables from built-in character sets. + This affects the display of character set and related + information in the MySQL Information Schema tables listed here: + + + [`CHARACTER_SETS`](/doc/refman/8.0/en/information-schema-character-sets-table.html) + + [`COLLATIONS`](/doc/refman/8.0/en/information-schema-collations-table.html) + + [`COLUMNS`](/doc/refman/8.0/en/information-schema-columns-table.html) + + [`COLLATION_CHARACTER_SET_APPLICABILITY`](/doc/refman/8.0/en/information-schema-collation-character-set-applicability-table.html) + + [`PARAMETERS`](/doc/refman/8.0/en/information-schema-parameters-table.html) + + [`ROUTINES`](/doc/refman/8.0/en/information-schema-routines-table.html) + + [`SCHEMATA`](/doc/refman/8.0/en/information-schema-schemata-table.html) + + This change also affects the output of the SQL + [`SHOW CHARACTER SET`](/doc/refman/8.0/en/show-character-set.html), + [`SHOW COLLATION`](/doc/refman/8.0/en/show-collation.html), + [`SHOW CREATE DATABASE`](/doc/refman/8.0/en/show-create-database.html), and + [`SHOW CREATE TABLE`](/doc/refman/8.0/en/show-create-table.html) statements. + (Bug #30624990) + +### Compilation Notes + +* **InnoDB:** + After addressing the associated issues, the C4100, C4127, C4245 + and C4389 MSVC++ level 4 compiler warnings were re-enabled. + (Bug #33437498, Bug #33571677) +* GCC 11 is now a supported compiler for building MySQL on EL7 or + EL8. This compiler is available in the + `devtoolset-11` (EL7) or + `gcc-toolset-11` (EL8) package. It is also + recommended to use GCC 11 when building third-party applications + that are based on the `libmysqlclient` C API + library. + (Bug #33730302) +* The server could not be compiled with Bison 3.8.1 or newer. + (Bug #33488047) + +### Deprecation and Removal Notes + +* **Important Change:** + Previously, MySQL allowed arbitrary delimiters and an arbitrary + number of them in [`TIME`](/doc/refman/8.0/en/time.html), + [`DATE`](/doc/refman/8.0/en/datetime.html), + [`DATETIME`](/doc/refman/8.0/en/datetime.html), and + [`TIMESTAMP`](/doc/refman/8.0/en/datetime.html) literals, as well as an + arbitrary number of whitespaces before, after, and between the + date and time values in `DATETIME` and + `TIMESTAMP` literals. This behavior is now + deprecated, and you should expect it to be removed in a future + version of MySQL. With this release, the use of any nonstandard + or excess delimiter or whitespace characters now triggers a + warning of the form Delimiter + '*`char`*' in position + *`pos`* in datetime value + '*`value`*' at row + *`rownum`* is superfluous and is + deprecated, followed by Please + remove, or in cases in which a suitable replacement + can be suggested, Prefer the standard + '*`replacementchar`*'. + + A deprecation warning is returned only for the first nonstandard + delimiter or whitespace character encountered in the literal + value. An example is shown here: + + ```None + mysql> SELECT DATE"2020/02/20"; + +------------------+ + | DATE"2020/02/20" | + +------------------+ + | 2020-02-20 | + +------------------+ + 1 row in set, 1 warning (0.00 sec) + + mysql> SHOW WARNINGS\G + *************************** 1. row *************************** + Level: Warning + Code: 4095 + Message: Delimiter '/' in position 4 in datetime value '2020/02/20' at row 1 is + deprecated. Prefer the standard '-'. + 1 row in set (0.00 sec) + ``` + + Such warnings are not elevated to errors in strict mode. + + For more information and examples, see + [String and Numeric Literals in Date and Time Context](/doc/refman/8.0/en/date-and-time-literals.html#date-and-time-string-numeric-literals). + (WL #13601) +* **Replication:** + The [`replica_parallel_type`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_replica_parallel_type) + system variable is now deprecated; whenever this variable is + read or set, or the equivalent option is set in + `my.cnf`, the server now issues a deprecation + warning, as shown here: + + ```None + mysql> SELECT @@replica_parallel_type; SHOW WARNINGS\G + +-------------------------+ + | @@replica_parallel_type | + +-------------------------+ + | LOGICAL_CLOCK | + +-------------------------+ + 1 row in set, 1 warning (0.00 sec) + + *************************** 1. row *************************** + Level: Warning + Code: 1287 + Message: '@@replica_parallel_type' is deprecated and will be removed in a future + release. + 1 row in set (0.00 sec) + ``` + + You should expect this variable and the equivalent server option + `--replica-parallel-type` to be removed in a + future MySQL release. +* The [`myisam_repair_threads`](/doc/refman/8.0/en/server-system-variables.html#sysvar_myisam_repair_threads) + system variable and **myisamchk** + [`--parallel-recover`](/doc/refman/8.0/en/myisamchk-repair-options.html#option_myisamchk_parallel-recover) option are + deprecated; expect support for both to be removed in a future + release of MySQL. + + Values other than 1 (the default) for + [`myisam_repair_threads`](/doc/refman/8.0/en/server-system-variables.html#sysvar_myisam_repair_threads) produce a + warning. + (WL #14937) +* The server system variables + [`query_prealloc_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_query_prealloc_size) and + [`transaction_prealloc_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_transaction_prealloc_size) are + now deprecated, and setting either or both of these no longer + has any effect in the MySQL server. Expect them to be removed in + a future MySQL release. + + For more information, see the descriptions of these variables in + the documentation ([Server System Variables](/doc/refman/8.0/en/server-system-variables.html)). + (WL #13720) + + References: See also: Bug #26940369. +* The [`--abort-slave-event-count`](/doc/refman/8.0/en/replication-options-replica.html#option_mysqld_abort-slave-event-count) and + `--disconnect-slave-event-count` + options for **mysqld**, previously used in + testing, and not normally required in a production setting, have + been deprecated. Expect them to be removed in a future version + of MySQL. + (WL #14526) + +### SQL Function and Operator Notes + +* Aggregate functions based on expressions comparing values with a + `NULL` were not ignoring the + `NULL` correctly. + (Bug #33624777, Bug #105762) +* When an aggregation function is evaluated during optimization, + it is presumed that the `WHERE` condition has + already been evaluated; thus, it can be removed. Before the + removal, the optimizer verifies whether the + `WHERE` condition has any table-independent + conditions by making a call to + `make_cond_for_table()`. When a condition was + considered expensive (for example, it used a stored procedure), + it was incorrectly assumed that there was a table-independent + condition. We fix this by excluding expensive conditions in the + call to `make_cond_for_table()`. + + In addition, a constant condition which was expensive to + evaluate, such as `f() = 1` where function + `f()` did not use any tables, often led to + incorrect results. In most cases, if a condition is constant for + execution, it is evaluated when optimizing the + `WHERE` condition, skipping it if it is + considered too expensive. The present issue arose due to + skipping the condition while optimizing an implicitly grouped + query. To avoid this, we now evaluate such conditions prior to + aggregation. + (Bug #33305617) +* Columns used by the [`DEFAULT()`](/doc/refman/8.0/en/miscellaneous-functions.html#function_default) + function were not marked internally as `READ` + when fixing its arguments. + (Bug #33142135) + +### Optimizer Notes + +* If the column of a table being loaded using + [`LOAD DATA`](/doc/refman/8.0/en/load-data.html) was used in the + `WHERE` clause of a subquery used inside a + [`SET`](/doc/refman/8.0/en/set-variable.html) + statement, the column was reported as + `unknown`. + (Bug #33714885) +* Aggregated queries that performed an index lookup + (`eq_ref`) could in some cases return wrong + results. This was seen when the execution plan used streaming + aggregation instead of aggregation in temporary tables. + + We fix this by disabling `eq_ref` caching below + aggregate nodes. + (Bug #33491183) + + References: This issue is a regression of: Bug #100614, Bug #31790217. +* The derived materialized table condition pushdown optimization + can now be used with most unions. This means that an outer + `WHERE` condition can now be pushed down to + every query block of the query expression of the materialized + derived table or view. + + Suppose we create tables `t1` and + `t2`, and then the view `v` + based on these two tables, using the SQL statements shown here: + + ```None + CREATE TABLE t1 ( + id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + c1 INT, + KEY i1 (c1) + ); + + CREATE TABLE t2 ( + id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + c1 INT, + KEY i1 (c1) + ); + + CREATE OR REPLACE VIEW v AS + SELECT id, c1 FROM t1 + UNION ALL + SELECT id, c1 FROM t2; + ``` + + Now, when the query `SELECT * FROM v WHERE c1 = + 12` is executed, the condition `c1 = + 12` is pushed down to both query blocks of view + `v`, as shown here in the output of + [`EXPLAIN`](/doc/refman/8.0/en/explain.html#explain-execution-plan): + + ```None + mysql> EXPLAIN FORMAT=TREE SELECT * FROM v WHERE c1 = 12\G + *************************** 1. row *************************** + EXPLAIN: -> Table scan on v (cost=1.26..2.52 rows=2) + -> Union materialize (cost=2.16..3.42 rows=2) + -> Covering index lookup on t1 using i1 (c1=12) (cost=0.35 rows=1) + -> Covering index lookup on t2 using i1 (c1=12) (cost=0.35 rows=1) + + 1 row in set (0.00 sec) + ``` + + This can now be done for most `UNION` queries. + For exceptions, and additional information, see + [Derived Condition Pushdown Optimization](/doc/refman/8.0/en/derived-condition-pushdown-optimization.html). + (Bug #24012, Bug #36802, Bug #106006, Bug #11746156, Bug #11748590, Bug #13650627, Bug #30587347, Bug #33318096, Bug #33738597, WL #13730) + +### Performance Schema Notes + +* New Performance Schema instrumentation collects information + about whether a query was processed on the + `PRIMARY` or `SECONDARY` + engine, where the `PRIMARY` engine is + `InnoDB` and the `SECONDARY` + engine is MySQL HeatWave. This instrumentation is intended for use with + MySQL Database Service with MySQL HeatWave. + + Two new Performance Schema table columns were added: + + + An `EXECUTION_ENGINE` column that indicates + whether a query was processed on the + `PRIMARY` or `SECONDARY` + engine was added to the Performance Schema statement event + tables (see + [Performance Schema Statement Event Tables](/doc/refman/8.0/en/performance-schema-statement-tables.html)), and + to the + [`performance_scema.threads`](/doc/refman/8.0/en/performance-schema-threads-table.html) and + [`performance_scema.processlist`](/doc/refman/8.0/en/performance-schema-processlist-table.html) + tables. + + A `COUNT_SECONDARY` column that indicates + the number of times a query was processed on the + `SECONDARY` engine was added to the + Performance Schema statement summary tables (see + [Statement Summary Tables](/doc/refman/8.0/en/performance-schema-statement-summary-tables.html)). + + An `execution_engine` column was also added to + the `sys.processlist` and + `sys.x$processlist` views in the MySQL + [`sys`](/doc/refman/8.0/en/sys-schema.html) Schema. + (WL #14346) + +### Security Notes + +* For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 1.1.1n from 1.1.1l. Issues fixed in OpenSSL are described at + and at + . + (Bug #33840722, Bug #33970835) + +### SQL Syntax Notes + +* An `IF NOT EXISTS` option is now supported for + the statements [`CREATE FUNCTION`](/doc/refman/8.0/en/create-function.html), + [`CREATE PROCEDURE`](/doc/refman/8.0/en/create-procedure.html), and + [`CREATE TRIGGER`](/doc/refman/8.0/en/create-trigger.html). + + For `CREATE FUNCTION`, when used to create a + stored function, and for `CREATE PROCEDURE`, + this option prevents an error from occurring if there is already + a routine having the same name. For + [`CREATE + FUNCTION`](/doc/refman/8.0/en/create-function-loadable.html), when used to create a loadable function, the + option prevents an error in the event there already exists a + loadable function having that name. For `CREATE + TRIGGER`, the option prevents an error from occurring + if there is already a trigger with the same name, on the same + table, and in the same schema. This is intended to improve ease + of use for these statements in scripting, rapid (re)deployment, + replication, and other instances of potential repeated use. + + This enhancement makes the syntax of these statements more + consistent with that of [`CREATE + DATABASE`](/doc/refman/8.0/en/create-database.html), [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html), + [`CREATE USER`](/doc/refman/8.0/en/create-user.html), and + [`CREATE EVENT`](/doc/refman/8.0/en/create-event.html), all of which + already support `IF NOT EXISTS`. This also + provides a complement to the `IF EXISTS` option + already supported by [`DROP + PROCEDURE`](/doc/refman/8.0/en/drop-procedure.html), [`DROP + FUNCTION`](/doc/refman/8.0/en/drop-function.html), and [`DROP + TRIGGER`](/doc/refman/8.0/en/drop-trigger.html). + + For more information, see [Stored Objects](/doc/refman/8.0/en/stored-objects.html), as + well as [Function Name Resolution](/doc/refman/8.0/en/function-resolution.html#function-name-resolution). See also + [Replication of CREATE TABLE ... SELECT Statements](/doc/refman/8.0/en/replication-features-create-select.html). + (Bug #15287, Bug #11745440, WL #14722) + + References: See also: Bug #33301931. + +### Test Suite Notes + +* Null pointers now are checked to reduce + `heap-use-after-free` errors under Valgrind + with the `--async-client` option. + (Bug #33702755) + +### XA Transaction Notes + +* **Group Replication:** + Group replication in some scenarios faced problems because it + was not possible to commit an XA transaction prepared on another + connection. To address such issues, MySQL now supports detached + XA transactions; once prepared, an XA transaction is no longer + connected to the current session. This happens as part of + executing [`XA + PREPARE`](/doc/refman/8.0/en/xa-statements.html). The prepared XA transaction can be committed + or rolled back by another connection, and the current session + can then initiate another XA or local transaction without + waiting for the prepared XA transaction to complete. + + Support for this feature can be disabled, and the classic + behavior reinstated, by setting the + [`xa_detach_on_prepare`](/doc/refman/8.0/en/server-system-variables.html#sysvar_xa_detach_on_prepare) system + variable introduced in this release to `OFF`. + The default is `ON`, which is recommended, + especially in a replication setting. + + You should be aware that, when detached XA transaction support + is enabled (`xa_detach_on_prepare = ON`), it is + not possible to use temporary tables within XA transactions. + + For more information, see [XA Transaction States](/doc/refman/8.0/en/xa-states.html), as well + as [Server Instance Configuration](/doc/refman/8.0/en/group-replication-requirements.html#group-replication-configuration). + (Bug #100163, Bug #31599926, WL #14700) + +### X Plugin Notes + +* A difference in format between Unix socket lock files for + classic MySQL protocol and X Protocol meant that the server + could not start if the file for the other protocol was present. + For the benefit of instances where it is not possible to remove + the file manually, such as MySQL Database Service instances, the + protocols now use the same format for the file. + (Bug #31468581) + +### Functionality Added or Changed + +* **Incompatible Change:** + MySQL Server now has the capability to store securely persisted + system variable values containing sensitive data such as private + keys or passwords, and to restrict viewing of the values. No + MySQL Server system variables are currently marked as sensitive, + but the new capability allows system variables containing + sensitive data to be persisted securely in the future. A keyring + component must be enabled on the MySQL Server instance to + support secure storage for persisted system variable values, + rather than a keyring plugin, which do not support the function. + + Important + + As part of this this change, component keyring files are now + loaded prior to initializing the MySQL Server data directory. + This means that it is no longer possible to keep such files in + the MySQL data directory. + + In the operating system file where persisted system variables + are stored, the names and values of sensitive system variables + are stored in an encrypted format, along with a generated file + key to decrypt them. The generated file key is in turn encrypted + using a master key that is stored in a keyring. After upgrading + to MySQL 8.0.29, the format of the `mysqld-auto.cnf` option file remains the same until the first time a + [`SET + PERSIST`](/doc/refman/8.0/en/set-variable.html) or `SET PERSIST ONLY` + statement is issued, and at that point it is changed to a new + format, even if the system variable involved is not sensitive. + An option file using the new format cannot be read by older + releases of MySQL Server. + + The new system variable + [`persist_sensitive_variables_in_plaintext`](/doc/refman/8.0/en/server-system-variables.html#sysvar_persist_sensitive_variables_in_plaintext) + controls whether the server is permitted to store the values of + sensitive system variables in an unencrypted format, if keyring + component support is not available at the time when `SET + PERSIST` is used to set the value. The default setting, + `ON`, encrypts the values if keyring component + support is available, and persists them unencrypted (with a + warning) if it is not. This setting also allows the server to + start if encrypted system variable values cannot be decrypted, + in which case their defaults are used. When + `persist_sensitive_variables_in_plaintext` is + set to `OFF`, which is the most secure setting, + sensitive system variable values cannot be persisted if keyring + component support is unavailable, and the server does not start + if encrypted system variable values cannot be decrypted. + + The values of sensitive system variables are also protected when + they are handled. If a `SET` statement is + issued for a sensitive system variable, the query is rewritten + to replace its value with `redacted` before it + is logged to the general log and audit log. The new privilege + [`SENSITIVE_VARIABLES_OBSERVER`](/doc/refman/8.0/en/privileges-provided.html#priv_sensitive-variables-observer) + allows a holder to view the values of sensitive system variables + in the Performance Schema tables + [`global_variables`](/doc/refman/8.0/en/performance-schema-system-variable-tables.html), + [`session_variables`](/doc/refman/8.0/en/performance-schema-system-variable-tables.html), + [`variables_by_thread`](/doc/refman/8.0/en/performance-schema-system-variable-tables.html), and + [`persisted_variables`](/doc/refman/8.0/en/performance-schema-persisted-variables-table.html), to issue + [`SELECT`](/doc/refman/8.0/en/select.html) statements to return their + values, and to track changes to them in session trackers for + connections. Users without this privilege cannot view those + system variable values. + (WL #13469) +* **InnoDB:** + To improve code quality and facilitate debugging, instances of + `#define` in the `InnoDB` + sources were replaced by `constexpr` specifiers + or inline functions. + (WL #14680) +* **InnoDB:** + `InnoDB` now supports + [`ALTER TABLE ... + DROP COLUMN`](/doc/refman/8.0/en/alter-table.html) operations using + `ALGORITHM=INSTANT`. + + Operations that support `ALGORITHM=INSTANT` + only modify metadata in the data dictionary. Table data is + unaffected, making the operations instantaneous. If not + specified explicitly, `ALGORITHM=INSTANT` is + used by default by DDL operations that support it. + + Prior to MySQL 8.0.29, an instantly added column could only be + added as the last column of the table. From MySQL 8.0.29, an + instantly added column can be added to any position in the + table. + + Instantly added or dropped columns create a new row version. Up + to 64 row versions are permitted. A new + `TOTAL_ROW_VERSIONS` column was added to the + [`INFORMATION_SCHEMA.INNODB_TABLES`](/doc/refman/8.0/en/information-schema-innodb-tables-table.html) + table to track the number of row versions. + + For more information about DDL operations that support + `ALGORITHM=INSTANT`, see + [Online DDL Operations](/doc/refman/8.0/en/innodb-online-ddl-operations.html). + (WL #13899) +* **Replication:** + Automatic purging of binary log files by the server is now + controlled using the + [`binlog_expire_logs_auto_purge`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_expire_logs_auto_purge) + system variable introduced in this release. By default, + automatic purging is enabled + (`binlog_expire_logs_auto_purge` set to + `ON`); to disable it, set the value of this + variable to `OFF`. + + The interval to wait before purging is controlled by + [`binlog_expire_logs_seconds`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_expire_logs_seconds) and + [`expire_logs_days`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_expire_logs_days). Setting both + of these system variables to 0 stops automatic purging from + taking place, even when + `binlog_expire_logs_auto_purge` is set to + `ON`. + (WL #14930) +* **Microsoft Windows:** + Added jemalloc support on Windows, and enabled it for official + MySQL binaries. The new `WITH_WIN_JEMALLOC` CMake + option accepts a directory containing + `jemalloc.dll` that's copied to the same + directory as `mysqld.exe` and/or + `mysqld-debug.exe` and utilizes it for memory + management operations. Standard memory functions are used if + `jemalloc.dll` is not found or does not + export the required functions. An INFORMATION level log message + records whether or not jemalloc is found and used. + (WL #14633) +* The new + [`clone_delay_after_data_drop`](/doc/refman/8.0/en/clone-plugin-options-variables.html#sysvar_clone_delay_after_data_drop) + variable permits specifying a delay period immediately after + removing existing data on the recipient MySQL Server instance at + the start of a remote cloning operation. The delay is intended + to provide enough time for the file system on the recipient host + to free space before data is cloned from the donor MySQL Server + instance. Certain file systems free space asynchronously in a + background process. On these file systems, cloning data too soon + after dropping existing data can result in clone operation + failures due to insufficient space. The maximum delay period is + 3600 seconds (1 hour). The default setting is 0 (no delay). + (Bug #32826134, WL #14857) +* The `group_replication_set_as_primary` function + appoints a specified group member as the new primary and + overrides the election process. Previously, the function waited + for all active transactions on the existing primary to end, + including incoming transactions after the function was used, + before making the current primary read only and changing to the + new primary. There was no upper limit to the wait time. + + An optional `timeout` parameter is now + available to let you set a timeout for running transactions. You + can set a timeout from 0 seconds (immediately) up to 3600 + seconds (60 minutes) for transactions that are running when you + use the function. There is no default setting for the timeout, + so if you do not set it the former behavior of the function + still applies, with no upper limit to the wait time. When the + timeout expires, for any transactions that did not yet reach + their commit phase, the client session is disconnected so that + the transaction does not proceed. Transactions that reached + their commit phase are allowed to complete. When you set a + timeout, it also prevents new transactions starting on the + primary from that point on. Explicitly defined transactions + (with a `START TRANSACTION` or + `BEGIN` statement) are subject to the timeout, + disconnection, and incoming transaction blocking even if they do + not modify any data. To allow inspection of the primary while + the function is operating, single statements that do not modify + data, as listed in + [Permitted Queries Under Consistency Rules](/doc/refman/8.0/en/group-replication-configuring-consistency-guarantees.html#group-replication-nonblocking), are permitted + to proceed. + (WL #14585) +* The `keyring_okv` keyring plugin, which uses + the Key Management Interoperability Protocol (KMIP) to + communicate securely, is used with MySQL’s keyring service to + store keyring data in a KMIP-compatible back end keyring storage + product such as Oracle Key Vault, Gemalto SafeNet KeySecure + Appliance, Townsend Alliance Key Manager, and Entrust + KeyControl. The plugin now allows you to specify more than one + standby server to provide backup connections to the back end + keyring storage product if the primary server is unavailable. + You can add up to 64 standby servers by editing the + `okvclient.ora` file to specify the IP + addresses and port numbers of the servers as a comma-separated + list in the value of the `STANDBY_SERVER` + variable. The plugin iterates over the standby servers until it + can establish a connection, with a 20-second wait for each + connection attempt. You should therefore ensure that the list of + standby servers is kept short, accurate, and up to date, and + servers that are no longer valid are removed, as they can + significantly affect the `keyring_okv` + plugin’s connection time and therefore the server startup + time. + (WL #14363) +* Isolation of access to system variables is now better enforced + in the server code that parses, resolves, and executes SQL + statements accessing or updating such variables. + (WL #14529) +* MySQL Server now supports SSL session reuse by default with a + timeout setting to control how long the server maintains a + session cache that establishes the period during which a client + is permitted to request session reuse for new connections. All + MySQL client programs support session reuse. For server-side and + client-side configuration information, see + [Reusing SSL Sessions](/doc/refman/8.0/en/reusing-ssl-sessions.html). + + In addition, C applications now can use the C API capabilities + to enable session reuse for encrypted connections (see + [SSL Session Reuse](/doc/c-api/8.0/en/c-api-ssl-session-reuse.html)). + (WL #13075) + +### Bugs Fixed + +* **InnoDB:** + A failure occurred when attempting to purge undo records for a + table with an instantly added column. + (Bug #33924532) +* **InnoDB:** + High-priority transactions were not permitted to stop waiting + when interrupted or to timeout while waiting for a lock, + preventing deadlocks from being resolved. In cases where the + blocking transaction is also high-priority, high-priority + transactions are now permitted to stop waiting when interrupted + or timeout when exceeding the lock wait timeout period. If a + blocking transaction is not high-priority, high-priority + transactions wait for the blocking transaction to release its + locks. + (Bug #33856332) +* **InnoDB:** + The AIO synchronization queue used on Windows was removed. The + synchronous file I/O read-write function + (`SyncFileIO::execute`) was revised to handle + files opened for both normal and overlapped I/O, as it does on + Linux. + (Bug #33840645) +* **InnoDB:** + Table version metadata was not reset after truncating all + partitions of a table with an instantly added column. + (Bug #33822729) +* **InnoDB:** + The `srv_error_monitor_thread()` function, + which prints warnings about semaphore waits, failed to handle a + long semaphore wait as expected. To address this issue, a + blocking call was moved to a more appropriate location. Related + monitor thread code was simplified and improved, and missing + shutdown signals were added for several server threads. + + Enabling and disabling of the standard monitor by InnoDB is now + performed independently of the user-settable + [`innodb_status_output`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_status_output) variable. + This change addresses an issue in which the monitor was enabled + by `InnoDB` in a particular scenario but not + set back to its previous value. Thanks to Yuhui Wang for the + contribution. + (Bug #33789526, Bug #93878) +* **InnoDB:** + Valgrind testing identified an off-by-one error in + `rec_convert_dtuple_to_rec_old()` in the InnoDB + sources. + (Bug #33784672) +* **InnoDB:** + The `UNIV_DEBUG` variant of the + `mem_heap_alloc()` function in the + `InnoDB` sources was modified to improve + Valgrind error detection. + (Bug #33783709) +* **InnoDB:** + A fast shutdown did not wait for all active I/O operations to + finish before closing all files. + (Bug #33768584) +* **InnoDB:** + A Clang warning reported an incorrectly placed + `@return` command. + (Bug #33734011) +* **InnoDB:** + Values of the new record locks array + (`m_prebuilt->new_rec_locks[]`) were not + properly synchronized when switching between partitions, causing + an assertion failure due to locks being freed or not freed as + expected. + (Bug #33724166) +* **InnoDB:** + A race condition in the function that updates the double write + buffer when a write request is completed caused a long semaphore + wait error. + (Bug #33712370) +* **InnoDB:** + A function wrongly assumed that changing a record in an indexed + column always requires creating a new record in the secondary + index, resulting in an lock-related assertion failure. To + address this and other similar cases, the + `lock_rec_convert_impl_to_expl()` function that + converts an implicit record lock to an explicit record lock is + now used only when an implicit record lock is actually held. + (Bug #33657235) +* **InnoDB:** + A number of Doxygen issues in the `InnoDB` + sources were addressed. + (Bug #33603036) +* **InnoDB:** + A missing null pointer check for an index instance caused a + failure. + (Bug #33600109) +* **InnoDB:** + Starting the server after an incremental backup failed with an + error indicating that page tracking was unusable. + (Bug #33521528) +* **InnoDB:** + An assertion failure was raised during `InnoDB` + recovery. The failure was due to a server exit that occurred + after pages were freed in a local mini-transaction before the + free list and index list could be reset. The free list and index + list, which spanned the freed pages, were traversed during + recovery. + (Bug #33454557) +* **InnoDB:** + The `btr_insert_into_right_sibling()` B-tree + function, which is inserts a tuple into the right sibling page + when the cursor is at the end of a page, caused an ACID + violation due to an incorrect lock function call. + (Bug #33405696) +* **InnoDB:** + When using `COMPACT` or + `REDUNDANT` row format, it was possible to + create a table that exceeded the maximum row size, which could + eventually result in 'Row size too large' errors when inserting + data. BLOB prefixes were not included in the record size check + performed during the [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) + operation. + (Bug #33399379) +* **InnoDB:** + A function that retrieves the master encryption key + (`get_master_key()`) tried to acquire the + master key ID mutex (`master_key_id_mutex`), + which was not yet initialized. + (Bug #33067891) +* **InnoDB:** + A redundant and costly check was removed from the + `lock_sec_rec_read_check_and_lock` lock system + function, which is used to place a lock on a secondary index + record. + (Bug #33059387) +* **InnoDB:** + The `TempTable` storage engine did not properly + handle a file-full error. + (Bug #32929392) +* **InnoDB:** + A DDL log error encountered during an + [`ALTER TABLE ... + ALGORITHM=COPY`](/doc/refman/8.0/en/alter-table.html) operation was not handled, causing a + failure during a subsequent `ALTER + TABLE ... ALGORITHM=INPLACE` operation. + (Bug #32716838) +* **InnoDB:** + Purge threads processed undo records of an encrypted table for + which the tablespace was not loaded, causing a failure. + (Bug #32586721) +* **InnoDB:** + A thread posted an asynchronous I/O operation and closed itself, + resulting in an operating system file operation error. + (Bug #30567295) +* **InnoDB:** + Incorrect `AUTO_INCREMENT` values were + generated when the maximum integer column value was exceeded. + The error was due to the maximum column value not being + considered. The previous valid `AUTO_INCREMENT` + value should have been returned in this case, causing a + duplicate key error. + (Bug #87926, Bug #26906787) +* **InnoDB:** + Transaction lock priority was modified so that a transaction + holding a shared lock and waiting to upgrade to an exclusive + lock is prioritized ahead of a another transaction waiting for + an exclusive lock on the same row. In other words, the + transaction that already holds a shared lock is granted an + exclusive lock first. Some other transaction holding a shared + lock on the same row can still prevent an exclusive lock from + being a granted in this scenario. + + The `lock_rec_find_set_bit` and + `lock_rec_has_expl` functions in the + transaction lock system sources were optimized. + (Bug #21356, Bug #11745929) +* **Partitioning:** + In some cases, establishing a connection to MySQL server could + fail if the `.ibd` file for a partition was + missing. + (Bug #33459653) +* **Partitioning:** + Following work done in MySQL 8.0.17 to cause all `NOT + IN` and `NOT EXISTS` subqueries to be + transformed into antijoins, the inner part of a nested outer + join produced by this transformation was not considered while + pruning table partitions. + (Bug #33060953) +* **Replication:** + In a replication group with + `group_replication_consistency=AFTER` set, if a + new primary was elected and then the previous primary was + restarted, the new primary left the group with an error message. + The handling of delayed view changes and transaction prepares + has been adjusted to prevent this situation. + (Bug #33755920) +* **Replication:** + A deadlock caused when the network provider was being stopped + could cause [`STOP + GROUP_REPLICATION`](/doc/refman/8.0/en/stop-group-replication.html) to wait indefinitely on some group + members. + (Bug #33044886) +* **Group Replication:** + Group Replication checked too late in the auto-rejoin process + that a rejoining member was the only type of instance allowed to + enter a group while in an error state. The issue has now been + fixed. + (Bug #33615493) +* **Group Replication:** + Group Replication could log a warning message about a member + joining while a group configuration operation was running, in + situations where there was no joining member, just a view + change. The message is now only logged when appropriate. + (Bug #33378364) +* **Group Replication:** + Group Replication now logs operating system errors returned when + there is a problem connecting to the local XCom instance, so it + is easier to resolve issues such as a firewall blocking the + connection. + (Bug #33189767, Bug #104523) +* **Group Replication:** + To help prevent a primary election from hanging, Group + Replication stops waiting for a confirmation from any members + that leave the group during the election. If all the members for + which confirmation was pending leave, Group Replication declares + that the primary election completed successfully. Previously, if + the primary member was one of the members that left, a primary + change was incorrectly stated as having happened when that had + not been able to take place. Now, if the primary member leaves + during an election, Group Replication declares the primary + election as an unsuccessful election with no primary change. + (Bug #33059773) +* **Microsoft Windows:** + On Windows, added WinFlexBison support. + (Bug #33788290) +* On EL6/EL7, a mysql-community-server-debug installation was not + obsoleted by installing commercial packages. + (Bug #33956760) +* MySQL Server would not build EL7 on ARM when building against + shared libraries that are copied by the cmake build system, such + as a non-system OpenSSL. Now *--page-size* is + set as reported by getconf. + (Bug #33904267) +* An anonymous user with the `PROCESS` privilege + could not select rows from the + [`processlist`](/doc/refman/8.0/en/performance-schema-processlist-table.html) table. + (Bug #33869388) +* The range optimizer did not take into account the session memory + limit. + (Bug #33869004) +* When sorting subqueries, the same filesort operation may be + executed many times, with different input, and so the longest + add-on column may change between executions, but the buffer for + this column was not reallocated when necessary. Now, when the + previously allocated buffer is sufficiently large, we reuse it, + otherwise we allocate a new one. + (Bug #33865094) +* An invalid result was obtained from a common table expression + that was materialized and used in multiple query blocks, where, + in the first query block that used the CTE, there were multiple + possible key definitions, which caused the internal function + `JOIN::finalize_derived_keys()` to move the + definition of the key used into position zero, and the second + query block using the CTE manipulated an index that occupied the + same position as the original position for the key chosen for + the first query block. This happened as an unintended side + effect of work done in MySQL 8.0.22 to prepare DML statements + once only. + + For more information, see [WITH (Common Table Expressions)](/doc/refman/8.0/en/with.html). + (Bug #33856374) +* Improved error handling when executing stored procedures and + stored functions. + (Bug #33851256) +* A trigger that selected from a view did not always yield the + expected result. + (Bug #33847722) +* Computations performed while loading time zone information + require negative values of `my_time_t`. + Normally, that type's minimum value is zero, corresponding to + the start of the UNIX Epoch (`1970-01-01 + 00:00:00`, with no time zone offset), which is + reflected in the constant `MYTIME_MIN_VALUE`. + This minimum value did not work correctly for setting up the + `TIME_ZONE_INFO` data structures in all cases, + since some time zone offsets are negative. This fix permits + negative values for `my_time_t` while + populating the time zone information database cache. + (Bug #33837691) +* If a MySQL instance stopped unexpectedly or was restarted + shortly after a `SET PERSIST` statement was + used to record system variable settings, the configuration file + `mysqld-auto.cnf` could be left empty, in + which case the server restart could not proceed. The persisted + system variables are now written to a backup file, which is only + renamed to `mysqld-auto.cnf` after the + success of the write has been verified, leaving the original + `mysqld-auto.cnf` file still available. On a + restart, if a backup file with valid contents is found, the + server reads from that file. Otherwise the + `mysqld-auto.cnf` file is used and the backup + file is deleted. + (Bug #33830493) +* `filesort` did not always check the lengths of + string values properly when calculating sort keys. + (Bug #33830073) + + References: This issue is a regression of: Bug #29739778. +* A primary key comprising the `GROUP_ID` and + `MEMBER_ID` columns was added to the + `mysql.firewall_membership` table. + (Bug #33824544) +* A fix made in MySQL 8.0.20 for an inconsistency in the + `rows matched` value when updating an updatable + view having `WITH CHECK OPTION` handled this + issue for an update of a single table only. In this release, we + fix the issue for multi-table + [`UPDATE`](/doc/refman/8.0/en/update.html) statements as well. + (Bug #33815426) + + References: See also: Bug #30158954. +* The linked ProtoBuf library for MySQL Server has been updated to + version 3.19.4. Issues fixed in the new Protobuf version are + described at + . + (Bug #33813846) +* It was possible to insert invalid characters into a + `utf32` column. + (Bug #33810558) +* Reinstalling the MySQL Enterprise Firewall plugin caused a failure. The failure was + due to a call to update a previously persisted firewall system + variable before the plugin was fully initialized. + (Bug #33809478) +* Hash joins using [`VARCHAR`](/doc/refman/8.0/en/char.html) or + [`DECIMAL`](/doc/refman/8.0/en/fixed-point-types.html) join columns returned an + excessive number of rows. An example using + `VARCHAR` is shown here: + + ```None + # Create and populate table + CREATE TABLE t(a VARCHAR(10), b VARCHAR(10)); + INSERT INTO t VALUES ('x', 'xx'), ('xx', 'x'); + + # No indexes, so uses a hash join + SELECT * FROM t AS t1, t AS t2 WHERE t1.a = t2.a AND t1.b = t2.b; + ``` + + Prior to the fix, the query just shown returned four rows; now + it returns two rows as expected. + (Bug #33794977) +* The + [`INFORMATION_SCHEMA.KEY_COLUMN_USAGE`](/doc/refman/8.0/en/information-schema-key-column-usage-table.html) + table did not list invisible key columns. + (Bug #33781534) +* The server did not perform proper cleanup after accessing a view + created from a view. + (Bug #33777821) +* In a grouped query using `WITH ROLLUP` and a + window function which ordered on an aggregate already present in + the `SELECT` list, an extra (and unnecessary) + aggregate was added as a hidden column when resolving the + window's ordering clause. + (Bug #33769911) +* The data masking [`mask_ssn()`](/doc/refman/8.0/en/data-masking-component-functions.html#function_mask-ssn) + function returned a 'String argument width too + large' error for a valid non-constant value (data + read from a database row as opposed to a hard-coded value). + Additionally, validation was not performed for zero-length + constant and non-constant values (empty strings) or for constant + values that are too small. These issues were addressed for all + data masking functions that string inputs with length + boundaries. + (Bug #33759276) +* `ROLLUP` was not handled correctly in some + cases with `ORDER BY` and a window function. + (Bug #33753245) +* Corrected a number of issues in Doxygen comments. + (Bug #33734001, Bug #33734035, Bug #33734062, Bug #33734075, Bug #33734104, Bug #33734117, Bug #33734129, Bug #33734143, Bug #33734155, Bug #33734181, Bug #33734188, Bug #33734206) +* Statements that cannot be parsed (due, for example, to syntax + errors) are no longer written to the slow query log. + (Bug #33732907) +* The message describing MySQL Enterprise Thread Pool’s initial + configuration is now issued as a SYSTEM message rather than + informational, so that it is visible at the default logging + level. + (Bug #33729821) +* A pre-locking optimization related to session tracking caused + recursive locking in some scenarios. + (Bug #33728209) +* A union involving an `IN` subquery was not + always handled properly when it also used an `ORDER + BY` clause. + (Bug #33725507) +* The **mysqlpump** client utility could stop + unexpectedly when a password prompt was requested using command + line options. If an error is encountered during this process an + appropriate error message is now returned before the client + exits. + (Bug #33688141) +* Implemented standard package policy to ship separate debuginfo + RPMs for the following platforms: SLES/openSUSE, and community + EL6 and EL7. Commercial versions of EL6 and EL7 are now built + with the RelWithDebInfo build type instead of Debug, which + greatly decreases their size. + (Bug #33663811, Bug #33684418, Bug #33664929) +* It was not possible to run `mysqld` with the + trace log enabled. + (Bug #33653824) +* When the `--fido-register-factor` option was used + at startup for FIDO device registration, the + **mysql** client could use incorrect syntax in + the [`ALTER USER`](/doc/refman/8.0/en/alter-user.html) statement, + resulting in a failure. The issue has now been fixed. + (Bug #33650498) +* When searching a [`SET`](/doc/refman/8.0/en/set.html) column + value, a user variable passed as the first argument to + [`FIND_IN_SET()`](/doc/refman/8.0/en/string-functions.html#function_find-in-set) did not produce the + same result as a constant value used in the same manner. + + *Example*: Consider the table + `t1` created and populated as shown here: + + ```None + CREATE TABLE t1 (c1 SET('a', 'b', 'c', 'd')); + + INSERT INTO t1 (c1) VALUES ('a, c, d'), ('c'); + ``` + + The values shown for `var` and + `str` should be the same in both rows of the + output from the following query, but were not: + + ```None + SET @a = 'c'; + + SELECT FIND_IN_SET(@a, c1) AS var, FIND_IN_SET('c', c1) AS str FROM t1; + ``` + + Now we make sure in such cases to return the position of the + match within the set used for the column definition whether the + value sought is a constant or a column value. + (Bug #33635637) +* A `SET PASSWORD` operation using an + authentication method that does support it produced a warning + instead of an expected error. + (Bug #33635445) +* If the plugin directory was not specified at MySQL Server + startup, and a user attempted FIDO device registration, the + **mysql** client stopped unexpectedly. The + situation is now handled and an appropriate error is reported. + (Bug #33631144) +* A change made in MySQL 8.0.27 moved the + [`EXPLAIN`](/doc/refman/8.0/en/explain.html) output for composite + access paths including filter and sort from inside the table + path to the `MATERIALIZE` access path, but did + not include `INDEX_RANGE_SCAN` among the + composite access paths. This could in some cases result in + undefined behavior. + (Bug #33611545) + + References: This issue is a regression of: Bug #32788576. +* It was not possible to revoke the + [`DROP`](/doc/refman/8.0/en/privileges-provided.html#priv_drop) privilege on the Performance + Schema. + (Bug #33578113) +* The internal `CreateIteratorFromAccessPath()` + function has been rewritten so that it is no longer employs + recursion; this is expected to reduce stack usage significantly + when executing queries. + (Bug #33569770) +* The **mysql** client could stop unexpectedly when + attempting FIDO device registration with a challenge-response + error. The issue has now been fixed. + (Bug #33568944) +* An [`INFORMATION_SCHEMA.FILES`](/doc/refman/8.0/en/information-schema-files-table.html) or + [`INFORMATION_SCHEMA.TABLES`](/doc/refman/8.0/en/information-schema-tables-table.html) query + executed by prepared statement or stored function returned stale + data. Cached data was reported after the data had changed. + (Bug #33538106, Bug #105450) +* A query returned an incorrect result when it met all of the + following conditions: + + + The result set contained a column with a nondeterministic + element. + + The column did not refer to a table. + + There was implicit grouping. + + The query plan used aggregation from a temporary table. This + temporary table was empty. + + Given an empty table `t` with column + `c1`, the statement `INSERT INTO t + SELECT MAX(t.c1), RAND(0) AS x FROM t` provides an + example of such a query; by inserting into the same table, we + ensure that the query plan aggregates from a temporary table. + The temporary table has a column for `c1`, and + the (single) result row picks `c1` from the + first row of the temporary table. If the temporary table was + empty, there was no first row, and `c1` became + 0; this led to the insertion of `(NULL, 0)` + rather than, for example, `(NULL, 0.155)` into + `t`. + + We fix this by not storing such columns in the temporary table. + (Bug #33535379) + + References: See also: Bug #32384355. +* Following changes in password handling in MySQL 8.0.27, if the + **mysql** client was interrupted with + **Ctrl + C**, a password prompt could be issued + requiring the user’s password in order to action the + interrupt. The password is now recorded when it is provided in + response to a prompt (as well as when it is provided on the + command line at startup), so it can be used automatically by the + new connection that is established for the interrupt. + (Bug #33514253) +* The internal `keyread` flag indicates reading + only index entries and not full rows. When this flag was set for + an index merge scan during initialization, it was subsequently + reset when initializing the individual range scans picked as + part of the index merge scan, which indicated reading rows + instead of index entries. We fix this by setting the indexes + chosen as covering indexes while reading the index entries. + (Bug #33499071) +* Data copying stalled when cloning page-compressed tables where + the compressed data size on the donor host was equivalent to the + available disk space on the recipient host. The holes punched on + the recipient host were smaller than the page size, resulting in + disk fragmentation that limited the amount of space available + for cloned data. The process for handling page-compressed tables + on the recipient host was modified to reduce fragmentation and + improve data copying speed. + + To improve the rate of flushing, the clone plugin now uses the + `fsync` flush method when flushing + page-compressed tables on file systems that support hole + punching. + (Bug #33482747) +* It was possible, when creating a view, for a subquery to be + evaluated during resolution when it was deemed constant. + (Bug #33438883) +* Nominally, in + [`EXPLAIN + FORMAT=TREE`](/doc/refman/8.0/en/explain.html#explain-analyze) output, we write a number of rows only as + an integer. For a result of zero, it was difficult to determine + whether this was 0.49 or 0.00001, so we add enough precision to + get one leading digit in such cases. + (Bug #33426283) +* [`VALUES`](/doc/refman/8.0/en/values.html) in some instances did not + function as specified. + (Bug #33414289) +* In debug builds, certain combinations of user variables of type + `MYSQL_TYPE_DOUBLE` hit an assert when used in + the context of [`CAST()`](/doc/refman/8.0/en/cast-functions.html#function_cast) or + [`CONVERT()`](/doc/refman/8.0/en/cast-functions.html#function_convert). + (Bug #33406728) +* When setting up multiple equalities, the optimizer added an + outer reference when it was not required. + (Bug #33394701) +* The minimum supported version of the Boost library for MySQL + builds has now been raised to 1.77.0. + (Bug #33353637) + + References: See also: Bug #33052171. +* Redundant `init` and + `checkout_access_maps` function code was + removed from the `Security_context` class. + (Bug #33339129, Bug #104915) +* The sys schema view + [`schema_unused_indexes`](/doc/refman/8.0/en/sys-schema-unused-indexes.html) did not + update correctly. + + [`schema_unused_indexes`](/doc/refman/8.0/en/sys-schema-unused-indexes.html) retrieves + unused index information from + [`table_io_waits_summary_by_index_usage`](/doc/refman/8.0/en/performance-schema-table-wait-summary-tables.html#performance-schema-table-io-waits-summary-by-index-usage-table), + returning no data if the index was used to query a row which is + not present in the table. + + As of this release, + [`schema_unused_indexes`](/doc/refman/8.0/en/sys-schema-unused-indexes.html) is updated + even if the row is not found. + (Bug #33302400) +* Some queries using common table expressions were not handled + correctly by [`EXPLAIN`](/doc/refman/8.0/en/explain.html). + (Bug #33300271) +* The server did not obtain index statistics correctly for certain + complex queries. + (Bug #33270516) +* Under certain circumstances, when executing `TRUNCATE + TABLE performance_schema.status_by_thread;` a race + condition could occur. + + Our thanks to Facebook for their contribution to this fix. + (Bug #33165726) +* A page cleaner thread timed out as it waited for an exclusive + lock on an index page held by a full-text index creation + operation on a large table. + (Bug #33101844) +* For an `InnoDB` table, a secondary index is + extended to include the table's primary key; that is, all + columns that are part of the primary key are marked as being + part of all secondary indexes. An exception to this is when a + secondary index is defined as unique, server does not use the + primary key extension. This could lead to problems while setting + up the read sets for dynamic range scan. We fix this issue by + making sure in the case of a unique seconary index to include + all primary key parts in the read set. + (Bug #33101025) + + References: This issue is a regression of: Bug #30417361. +* An existing foreign key constraint that referenced a + non-existing table could result in a connection error after the + table was created or renamed. + (Bug #33054071) +* While creating a value list for an empty + `VALUES` during execution of an + [`INSERT`](/doc/refman/8.0/en/insert-on-duplicate.html) + statement, a hidden element was added, which subsequently led to + an assertion in debug builds. To fix the problem, we now skip + any hidden elements when the `VALUES` list is + created. + + See [INSERT ... ON DUPLICATE KEY UPDATE Statement](/doc/refman/8.0/en/insert-on-duplicate.html), for more information. + (Bug #32774799) +* Aliases to [`SELECT`](/doc/refman/8.0/en/select.html) list items in + `ORDER BY` which were part of expressions were + not resolved in the same way as standalone aliases, so that + `ORDER BY alias` was + resolved correctly, but `ORDER BY + function(alias)` + was not. + (Bug #32695670) +* An offline keyring migration from an empty or non-existing + keyring source (specified by + [`keyring_file_data`](/doc/refman/8.0/en/keyring-system-variables.html#sysvar_keyring_file_data)) appeared to + complete successfully, without warning. The keyring migration + process now checks for errors when fetching keys. If no keys are + found at the specified keyring source, a warning message is + written to the error log indicating that the keyring has no + keys. + (Bug #32327411) +* When removing a condition which was always true, a subquery + referring to a view was removed even though the subquery was + itself referred to elsewhere in the query. + (Bug #31946448) + + References: See also: Bug #31216115. +* An [`EXPLAIN`](/doc/refman/8.0/en/explain.html) statement, if used + with multiple-table [`UPDATE`](/doc/refman/8.0/en/update.html) + statements that contained derived tables, could cause the server + to exit. + (Bug #31884434) +* A memory leak occurred if **mysqldump** was used + on more than one table with the + `--order-by-primary` option. The memory + allocated for sorting each table’s rows is now freed after + every table, rather than only once. + (Bug #30042589, Bug #96178) +* **mysqld\_safe** log message textual errors were + corrected. Thanks to Bin Wang at China Mobile for the + contribution. + (Bug #106590, Bug #33903639) +* Equivalent queries could return different results because the + execution paths differed slightly. For example, + `Item::val_int_from_string()` and + `Item_string::val_int()` should use the same + algorithm for string to integer conversion. + (Bug #106517, Bug #33881339) +* Updated CMake rules to handle the deprecated + `PermissionsStartOnly` systemd option. The + alternative executable prefix was added in systemd 231 (July + 2016) while PermissionsStartOnly was deprecated in systemd 240 + (Dec 2018). The preferred executable prefix is now used where + available. + (Bug #106468, Bug #33862323) +* Following work done in MySQL 8.0.22 to implement condition + pushdown for materialized derived tables, an implicitly grouped + query with an aggregation function in some cases returned an + empty set instead of `NULL`. + (Bug #106414, Bug #33838439) +* A prepared and executed query like `'SELECT ?'` + with a [`DATE`](/doc/refman/8.0/en/datetime.html), + [`TIME`](/doc/refman/8.0/en/time.html), + [`DATETIME`](/doc/refman/8.0/en/datetime.html), or + [`TIMESTAMP`](/doc/refman/8.0/en/datetime.html) as the bound argument + could return the wrong column type. The issue is fixed by + restoring the previous logic that reprepared such queries to + give each dynamic parameter its literal value. + (Bug #106352, Bug #33813951) + + References: This issue is a regression of: Bug #32915973. +* A null-safe comparison + ([`≪=>`](/doc/refman/8.0/en/comparison-operators.html#operator_equal-to)) + did not evaluate correctly for a + [`TIMESTAMP`](/doc/refman/8.0/en/datetime.html) column in a trigger. + (Bug #106286, Bug #33790919) + + References: This issue is a regression of: Bug #32942327. +* When writing [`DECIMAL`](/doc/refman/8.0/en/fixed-point-types.html) values to + the hash join buffer, the values were first normalized. This + normalization could in some cases unintentionally alter the + values, which made the values fall into the wrong hash bucket + and caused incorrect results to be returned from the join. + + The problem was that the normalization removed leading zeros in + a manner which caused some values to lose some of their least + significant digits. We fix this by calculating the desired + precision and passing the calculated value instead of changing + the original value. + (Bug #106272, Bug #33787914) +* A query having a `WHERE` condition of the form + `c NOT`[`BETWEEN`](/doc/refman/8.0/en/comparison-operators.html#operator_between) `NULL AND`[`COALESCE(a, b)`](/doc/refman/8.0/en/comparison-operators.html#function_coalesce), having + [`DATETIME`](/doc/refman/8.0/en/datetime.html) columns + `a`, `b`, and + `c`, with columns `a` and + `c` created as `NOT NULL`, did + not return correct results. Further investigation showed that, + in such cases, when the second or third argument to + `BETWEEN` was `NULL`, the + comparison results were inverted, causing it to evaluate as + `NULL` for `FALSE`, and + `FALSE` for `NULL`. + (Bug #106267, Bug #33788832) +* A NULL-safe comparison between `0` + (`FALSE`) and `NULL` could + return `TRUE`, even though the implementation + responsible for evaluating an object of this type can never + result in `NULL` and should always return + `FALSE`. + (Bug #105773, Bug #33630225) +* The `QUICK_RANGE` constructor used the main + thread memory root for allocating keys, rather than the same + memory root as used for allocating the + `QUICK_RANGE` object itself. This resulted in + unexpectedly high memory usage when executing multiple queries + using a range check for the query plan. + (Bug #105331, Bug #33516707) + + References: See also: Bug #28805105, Bug #28857990. +* [`SELECT + DISTINCT`](/doc/refman/8.0/en/select.html) on a [`VARCHAR`](/doc/refman/8.0/en/char.html) + column returned 2 distinct values when the column contained an + empty string and a string consisting of a single whitespace + character when the TempTable storage engine was used + ([`internal_tmp_mem_storage_engine`](/doc/refman/8.0/en/server-system-variables.html#sysvar_internal_tmp_mem_storage_engine)`= TempTable`). This behavior was incorrect when using a + `utf8_bin` collation with `PAD + SPACE`; trailing spaces should have been ignored when + selecting distinct values. + + For temporary tables created using the + `TempTable` storage engine, the two strings + were hashed to different values, since the + `TempTable` hashing function always hashed + zero-length data to `0`. (In the case just + described, the empty string was hashed to `0` + while the space character from the other string was used to + generate a nonzero hash value.) + + This is now fixed by removing any special handling for + zero-length data in the `TempTable` storage + engine's hashing function. + + Our thanks to Brian Yue for the contribution. + (Bug #105316, Bug #33506241) +* [`SELECT`](/doc/refman/8.0/en/select.html) + [`COUNT(*)`](/doc/refman/8.0/en/aggregate-functions.html#function_count) using a multi-valued + index reported the wrong number of rows. + (Bug #104898, Bug #33334928) +* The test program `main.ssl-big` failed with + Too many connections. + + Our thanks to Facebook for the contribution. + (Bug #104377, Bug #33139204, Bug #33165693) +* The two types of histograms supported by MySQL, singleton and + equi-height, previously stored their collections of buckets in a + map and a set, respectively. This release changes both histogram + types such that they now store buckets in dynamic arrays + instead, which reduces space overhead and speeds up selectivity + estimation due to reduced indirection when performing binary + search on the buckets. + + Because both types of histograms are constructed by inserting + buckets in sorted order, and buckets are serialized to JSON in + sorted order, there is no additional work involved in switching + to a dynamic array. + (Bug #104109, Bug #33045204) +* An invalid conversion between signed and unsigned variables led + to incorrect result from a query of the form `SELECT ALL + t1.c1,t2.c1 FROM t1,t2 WHERE t1.c1 > t2.c1`. + (Bug #102025, Bug #32302724) +* As of this release, the Performance Schema is collation-aware + (Bug #98545, Bug #30881109) +* An assert error could occur when inserting data larger than 32 + bytes in the `ROLE` column of + [`setup_actors`](/doc/refman/8.0/en/performance-schema-setup-actors-table.html). As of this release, + the `ROLE` column is increased from CHAR(32) to + CHAR(96). + (Bug #74678, Bug #19947842) diff --git a/corpus/changelog/mysql_releases/mysql_8030.md b/corpus/changelog/mysql_releases/mysql_8030.md new file mode 100644 index 0000000000000000000000000000000000000000..ca829663cc647afdcb9ea27588ec03d38d7ddedf --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8030.md @@ -0,0 +1,1269 @@ +# MySQL 8.0.30 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-30.html +Version: 8.0.30 + +## Changes in MySQL 8.0.30 (2022-07-26, General Availability) + +* [Character Set Support](news-8-0-30.html#mysqld-8-0-30-charset "Character Set Support") +* [Compilation Notes](news-8-0-30.html#mysqld-8-0-30-compiling "Compilation Notes") +* [Deprecation and Removal Notes](news-8-0-30.html#mysqld-8-0-30-deprecation-removal "Deprecation and Removal Notes") +* [Generated Invisible Primary Keys (GIPKs)](news-8-0-30.html#mysqld-8-0-30-gipk "Generated Invisible Primary Keys (GIPKs)") +* [Keyring Notes](news-8-0-30.html#mysqld-8-0-30-keyring "Keyring Notes") +* [Performance Schema Notes](news-8-0-30.html#mysqld-8-0-30-performance-schema "Performance Schema Notes") +* [Pluggable Authentication](news-8-0-30.html#mysqld-8-0-30-pluggable-auth "Pluggable Authentication") +* [Security Notes](news-8-0-30.html#mysqld-8-0-30-security "Security Notes") +* [Spatial Data Support](news-8-0-30.html#mysqld-8-0-30-spatial-support "Spatial Data Support") +* [SQL Syntax Notes](news-8-0-30.html#mysqld-8-0-30-sql-syntax "SQL Syntax Notes") +* [XA Transaction Notes](news-8-0-30.html#mysqld-8-0-30-xa "XA Transaction Notes") +* [Functionality Added or Changed](news-8-0-30.html#mysqld-8-0-30-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-30.html#mysqld-8-0-30-bug "Bugs Fixed") + +### Character Set Support + +* **Important Change:** + A previous change renamed character sets having deprecated names + prefixed with `utf8_` to use + `utf8mb3_` instead. In this release, we rename + the `utf8_` collations as well, using the + `utf8mb3_` prefix; this is to make the + collation names consistent with those of the character sets, not + to rely any longer on the deprecated collation names, and to + clarify the distinction between `utf8mb3` and + `utf8mb4`. The names using the + `utf8mb3_` prefix are now used exclusively for + these collations in the output of `SHOW` + statements such as [`SHOW CREATE + TABLE`](/doc/refman/8.0/en/show-create-table.html), as well as in the values displayed in the + columns of Information Schema tables including the + [`COLLATIONS`](/doc/refman/8.0/en/information-schema-collations-table.html) and + [`COLUMNS`](/doc/refman/8.0/en/information-schema-columns-table.html) tables. + (Bug #33787300) + + References: See also: Bug #30624990. +* **Important Change:** + When more than one language had the same collation definition, + MySQL implemented collations for only one of the languages. This + meant that some languages were covered only by + `utf8mb4` Unicode 9.0 collations that are + specific to other languages. This release fixes such issues by + adding language-specific collations for those languages that + were previously covered only by language-specific collations for + other languages. The new collations are listed here: + + + *Norwegian* + + - (Bokmål) `utf8mb4_nb_0900_ai_ci` + - (Bokmål) `utf8mb4_nb_0900_as_cs` + - (Nynorsk) `utf8mb4_nn_0900_ai_ci` + - (Nynorsk) `utf8mb4_nn_0900_as_cs` + + *Serbian with Latin characters*: + + - `utf8mb4_sr_latn_0900_ai_ci` + - `utf8mb4_sr_latn_0900_as_cs` + + *Bosnian with Latin characters*: + + - `utf8mb4_bs_0900_ai_ci` + - `utf8mb4_bs_0900_as_cs` + + *Bulgarian*: + + - `utf8mb4_bg_0900_ai_ci` + - `utf8mb4_bg_0900_as_cs` + + *Galician*: + + - `utf8mb4_gl_0900_ai_ci` + - `utf8mb4_gl_0900_as_cs` + + *Mongolian with Cyrillic letters*: + + - `utf8mb4_mn_cyrl_0900_ai_ci` + - `utf8mb4_mn_cyrl_0900_as_cs` + + For more information, see + [Language-Specific Collations](/doc/refman/8.0/en/charset-unicode-sets.html#charset-unicode-sets-language-specific-collations). + (Bug #31885256, WL #14307) + +### Compilation Notes + +* On Enterprise Linux, fixed ADD\_LINUX\_RPM\_FLAGS so that the + initial values of CMAKE\_C\_FLAGS and CMAKE\_CXX\_FLAGS are used + before modifying them. + (Bug #34131794) + + References: This issue is a regression of: Bug #33730302. +* Added a new SHOW\_SUPPRESSED\_COMPILER\_WARNINGS CMake option. + Enable it to show suppressed compiler warnings, and do so + without failing with -Werror. It defaults to OFF. + (Bug #34046748) +* Added macOS/ARM support. + (Bug #34017614) +* On Windows, deprecation warnings (C4996) were globally disabled + with the /wd4996 command-line option; now deprecation warnings + are disabled on the localized level where appropriate. + (Bug #33975638) +* On Windows, improved the generated INFO\_BIN and INFO\_SRC files. + (Bug #33972317, Bug #34052301) +* Improved GCC 8 support to include -lstdc++fs in order to use + std::filesystem. + (Bug #33939798) + +### Deprecation and Removal Notes + +* **Replication:** + Setting the + [`replica_parallel_workers`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_replica_parallel_workers) system + variable (or the equivalent server option + `--replica-parallel-workers`) to 0 is now + deprecated, and doing so now raises a warning. + + To achieve the same result (that is, use single threading) + without the warning, set + `replica_parallel_workers=1` instead. + (WL #13956) +* The [`--skip-host-cache`](/doc/refman/8.0/en/server-options.html#option_mysqld_skip-host-cache) server + option is now deprecated, and subject to removal in a future + release. + + Use a statement such as + [`SET GLOBAL + host_cache_size = 0`](/doc/refman/8.0/en/set-variable.html), or set + [`host_cache_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_host_cache_size) in the + `my.cnf` file, instead. + (WL #14359) +* The [`--old-style-user-limits`](/doc/refman/8.0/en/server-options.html#option_mysqld_old-style-user-limits) + option causes the server to enforce user limits as they were + prior to MySQL 5.0.3, and is intended for backwards + compatibility with very old releases. This option is now + deprecated, and using it now raises a warning. You should expect + this option to be removed in a future release of MySQL, and so + you are advised to begin now to remove any dependency your MySQL + applications might have on this option. + (WL #13228) + +### Generated Invisible Primary Keys (GIPKs) + +* MySQL 8.0.30 now supports GIPK mode, which causes a generated + invisible primary key (GIPK) to be added to any + [`InnoDB`](/doc/refman/8.0/en/innodb-storage-engine.html) table that is created + without an explicit primary key. This enhancement applies to + `InnoDB` tables only. + + The definition of the generated key column added to an + `InnoDB` table by GIPK mode is shown here: + + ```None + my_row_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT INVISIBLE PRIMARY KEY + ``` + + The name of the generated primary key is always + `my_row_id`; you cannot, while GIPK mode is in + effect, use this as a column name in a + [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) statement that + creates a new `InnoDB` table unless it includes + an explicit primary key. + + GIPKs are not enabled by default. To enable them, set the + [`sql_generate_invisible_primary_key`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_generate_invisible_primary_key) + server system variable (also introduced in this release) to + `ON`. This setting has no effect on replication + applier threads; this means that a replica never generates a + primary key for a replicated table that was not created on the + source with a primary key. + + You cannot alter a generated invisible primary key while GIPKs + are in effect, with one exception: You can toggle the visibility + of the GIPK using `ALTER TABLE + tbl CHANGE COLUMN my_row_id SET + VISIBLE` and `ALTER TABLE + tbl CHANGE COLUMN my_row_id SET + INVISIBLE`. + + By default, generated invisible primary keys can be seen in the + output of [`SHOW CREATE TABLE`](/doc/refman/8.0/en/show-create-table.html) and + [`SHOW INDEX`](/doc/refman/8.0/en/show-index.html); they are also visible + in MySQL Information Schema tables such as the + [`COLUMNS`](/doc/refman/8.0/en/information-schema-columns-table.html) and + [`STATISTICS`](/doc/refman/8.0/en/information-schema-statistics-table.html) tables. You can make + them hidden instead by setting + [`show_gipk_in_create_table_and_information_schema`](/doc/refman/8.0/en/server-system-variables.html#sysvar_show_gipk_in_create_table_and_information_schema) + to `OFF`. + + You can exclude generated invisible primary keys from the output + of **mysqldump** using the + [`--skip-generated-invisible-primary-key`](/doc/refman/8.0/en/mysqldump.html#option_mysqldump_skip-generated-invisible-primary-key) + option added in this release. **mysqlpump** also + now supports a + [`--skip-generated-invisible-primary-key`](/doc/refman/8.0/en/mysqlpump.html#option_mysqlpump_skip-generated-invisible-primary-key) + option which excludes GIPKs from its output. + + For more information and examples, see + [Generated Invisible Primary Keys](/doc/refman/8.0/en/create-table-gipks.html). For general information on + invisible column support in MySQL, see + [Invisible Columns](/doc/refman/8.0/en/invisible-columns.html). + (Bug #34092605, WL #13784) + +### Keyring Notes + +* The `keyring_aws` plugin has been updated to + use the latest AWS Encryption SDK for C (version 1.9.186). + + The [`keyring_aws_region`](/doc/refman/8.0/en/keyring-system-variables.html#sysvar_keyring_aws_region) variable + supports the additional AWS regions supported by the new SDK. + Refer to the variable description for a list of supported AWS + regions. + (WL #14547) + +### Performance Schema Notes + +* **InnoDB:** + In the Performance Schema instrumentation for InnoDB read-write + locks, lock acquisition failures and successes for TRY (no-wait) + operations were instrumented incorrectly. + (Bug #34131395) +* **Group Replication:** + [Performance Schema](/doc/refman/8.0/en/performance-schema.html) now + provides instrumentation for performance monitoring of Group + Replication memory usage. + + See [Monitoring Group Replication Memory Usage with Performance Schema Memory Instrumentation](/doc/refman/8.0/en/mysql-gr-memory-monitoring-ps-instruments.html). + (WL #14726) + +### Pluggable Authentication + +* The SASL LDAP plugin failed to properly parse Kerberos Key + Distribution Center (KDC) host information read from the + Kerberos configuration file, resulting in SASL authentication + error. + (Bug #31862170) + +### Security Notes + +* It is now possible to compile the MySQL server package + (**mysqld** + `libmysql` + + client tools) using OpenSSL 3.0 on supported platforms, which + should not change the behavior of the server or client programs. + For additional information, see + . + (WL #14683) + +### Spatial Data Support + +* Previously, the [`ST_TRANSFORM()`](/doc/refman/8.0/en/spatial-operator-functions.html#function_st-transform) + function added in MySQL 8.0.13 did not support Cartesian Spatial + Reference Systems. Beginning with this release, support is + provided by this function for the Popular Visualisation Pseudo + Mercator (EPSG 1024) projection method, used for WGS 84 + Pseudo-Mercator (SRID 3857). + (WL #11961) + +### SQL Syntax Notes + +* It is now possible to determine whether a + [`REVOKE`](/doc/refman/8.0/en/revoke.html) statement which cannot be + executed raises an error or a warning. This is implemented with + the addition of two new statement options, listed here with + brief descriptions: + + + `IF EXISTS` causes + `REVOKE` to raise a warning rather than an + error as long as the target user or role does not exist. + + `IGNORE UNKNOWN USER` causes + `REVOKE` to raise a warning instead of an + error if the target user or role is not known, but the + statement would otherwise succeed. + + For a single target user or role and a given privilege or role + to be removed, using the `IF EXISTS` and + `IGNORE UNKNOWN USER` options together in the + same `REVOKE` statement means that the + statement succeeds (albeit doing nothing, and with a warning), + even if both the target user or role and the privilege or role + to be removed are unknown, as long as the statement is otherwise + valid. In the case of multiple targets, multiple privileges or + roles to be removed, or both, the statement succeeds, performing + those removals which are valid, and issuing warnings for those + which are not. + + For more information, see [REVOKE Statement](/doc/refman/8.0/en/revoke.html). + (Bug #102232, Bug #32495441, WL #14690) + +### XA Transaction Notes + +* **Replication; Group Replication:** + Previously, recovery was not guaranteed when a server node in a + replication topology unexpectedly halted while executing + [`XA + PREPARE`](/doc/refman/8.0/en/xa-statements.html), `XA COMMIT`, or `XA + ROLLBACK`. To address this problem, MySQL now maintains + consistent XA transaction state across a topology using either + MySQL “classic” Replication or MySQL Group + Replication when a server node is lost from the topology and + then regained. This also means that XA transaction state is now + propagated so that nodes do not diverge while doing work within + a given transaction in the event that a server node halts, + recovers, and rejoins the topology. + + For any multi-server replication topology (including one using + Group Replication), the XA transaction state propagates + consistently, so that all servers remain in the same state at + all times. For any such topology of any size (including a single + server, as long as binary logging is enabled), it is now + possible to recover any server to a consistent state after it + has halted unexpectedly and been made to rejoin the topology + after dropping out. + + This enhancement is implemented for the case of a single server + by adding support for a two-phase XA prepare between the storage + engine and the server's internal transaction coordinator (ITC), + with the state of the prepare retained by both. This means that + the ITC can purge its internal logs safely, without the risk of + losing state, should the server halt following the purge. In the + single-node case, imposing order of execution between the + storage engine and the binary log prevents externalization of + GTIDs before the corresponding changes become visible to the + storage engine; in a topology comprising multiple servers, this + keeps the transaction state from being broadcast to the topology + before it is guaranteed to be locally consistent and persistent. + In all cases, the state of the XA transaction is extracted from + the last binary log file to be written and synchronized with the + transaction state obtained from the storage engine. + + A known issue in this release can be encountered when the same + transaction XID has been used to execute XA transactions + sequentially. If there a disruption in operation occurs while + the server is processing `XA COMMIT ... ONE + PHASE` using this same XID, after the transaction has + been prepared in the storage engine, the state between the + binary log and the storage engine can no longer be reliably + synchronized. + + For more information, see [XA Transactions](/doc/refman/8.0/en/xa.html). + (WL #11300) + +### Functionality Added or Changed + +* **Important Change:** + Binary packages that include curl rather than linking to the + system curl library have been upgraded to use curl 7.83.1. + (Bug #34138733) +* **Important Change:** + For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 1.1.1o. Issues fixed in OpenSSL version 1.1.1o are described at + + and + . + (Bug #34133985) +* **Important Change:** + The `fido2` library included with MySQL, used + with the `authentication_fido` plugin, has been + upgraded to version 1.8.0. (Previously, version 1.5.0 was + included with MySQL.) + (WL #15111) +* **InnoDB:** + The [`innodb_doublewrite`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_doublewrite) system + variable, which enables or disables the doublewrite buffer, has + two new settings, `DETECT_ONLY` and + `DETECT_AND_RECOVER`. With the + `DETECT_ONLY` setting, database page content is + not written to the doublewrite buffer, and recovery does not use + the doublewrite buffer to fix incomplete page writes. This + lightweight setting is intended for detecting incomplete page + writes only. The `DETECT_AND_RECOVER` setting + is equivalent to the existing `ON` setting. For + more information, see + [Doublewrite Buffer](/doc/refman/8.0/en/innodb-doublewrite-buffer.html). + + Thanks to Facebook for the contribution. + (Bug #32727919, Bug #103211, WL #14719) +* **InnoDB:** + `InnoDB` now supports dynamic configuration of + redo log capacity. The + [`innodb_redo_log_capacity`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_redo_log_capacity) system + variable can be set at runtime to increase or decrease the total + amount of disk space occupied by redo log files. + + With this change, the number of redo log files and their default + location has also changed. From MySQL 8.0.30, + `InnoDB` maintains 32 redo log files in the + `#innodb_redo` directory in the data + directory. Previously, `InnoDB` created two + redo log files in the data directory by default, and the number + and size of redo log files were controlled by the + [`innodb_log_files_in_group`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_log_files_in_group) and + [`innodb_log_file_size`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_log_file_size) variables. + These two variables are now deprecated. + + When the `innodb_redo_log_capacity` setting is + defined, `innodb_log_files_in_group` and + `innodb_log_file_size` settings are ignored; + otherwise, those settings are used to compute the + `innodb_redo_log_capacity` setting + (`innodb_log_files_in_group` \* + `innodb_log_file_size` = + `innodb_redo_log_capacity`). If none of those + variables are set, redo log capacity is set to the + `innodb_redo_log_capacity` default value, which + is 104857600 bytes (100MB). + + Several status variables are provided for monitoring the redo + log and redo log capacity resize operations. + + As is generally required for any upgrade, this change requires a + clean shutdown before upgrading. + + For more information about this feature, see + [Redo Log](/doc/refman/8.0/en/innodb-redo-log.html). + (WL #12527) +* Added Ubuntu 22.04 support. + (Bug #34123545) +* The order of the columns in the primary key definition for a few + tables in the `mysql` schema has been changed, + so that the columns containing the host name and user name are + together in sequence at the start of the primary key. ACL + queries on these tables are performed using only the host name + and user name, and if those columns are not together in + sequence, a full table scan must be performed to identify the + relevant record. Placing the host name and user name together + means that index lookup can be used, which improves performance + for `CREATE USER`, `DROP + USER`, and `RENAME USER` statements, + and for ACL checks for multiple users with multiple privileges. + + The changed tables are `mysql.db`, + `mysql.tables_priv`, + `mysql.columns_priv` and + `mysql.procs_priv`. When you upgrade to MySQL + 8.0.30 or later, these tables are modified in the second step of + the MySQL upgrade process. Use the + `--upgrade=FORCE` option when performing + logical upgrades using a backup or export utility such as + **mysqldump** or **mysqlpump**, + which ensures that the table structures are checked and rebuilt + with the new column order. + (Bug #33644645, Bug #33637244, WL #14965) +* The [`myisam_repair_threads`](/doc/refman/8.0/en/server-system-variables.html#sysvar_myisam_repair_threads) + system variable and **myisamchk** + [`--parallel-recover`](/doc/refman/8.0/en/myisamchk-repair-options.html#option_myisamchk_parallel-recover) option were + removed. + (Bug #31052408, WL #14938) +* A new **mysqldump** option + `--mysqld-long-query-time` lets you set a + custom value of the `long_query_time` system + variable for **mysqldump**’s session. Use the + new option to increase the elapsed time allowed for + **mysqldump**’s queries before they are written + to the slow query log file, in order to avoid unnecessary + logging. Thanks to Facebook for the contribution. + (Bug #96369, Bug #96369, Bug #30110717, WL #13447) +* Error log components can now be loaded implicitly at startup + before the `InnoDB` storage engine is + available. This new method of loading error log components loads + and enables the components defined by the + [`log_error_services`](/doc/refman/8.0/en/server-system-variables.html#sysvar_log_error_services) variable. + + Previously, error log components had to be installed first using + [`INSTALL COMPONENT`](/doc/refman/8.0/en/install-component.html) and were only + loaded after `InnoDB` was fully available, as + the list of components to load was read from the + `mysql.components` table, which is an + `InnoDB` table. + + Implicit load of error log components has these advantages: + + + Log components are loaded early in the startup sequence, + making logged information available sooner. + + It helps avoid loss of buffered log information should a + failure occur during startup. + + Loading log components using [`INSTALL + COMPONENT`](/doc/refman/8.0/en/install-component.html) is not required, simplifying error log + configuration. + + For more information about this feature, see + [Error Log Configuration](/doc/refman/8.0/en/error-log-configuration.html). + + If you have previously installed loadable log components using + `INSTALL COMPONENT` and you list + those components in a + [`log_error_services`](/doc/refman/8.0/en/server-system-variables.html#sysvar_log_error_services) setting that + is read at startup (from an option file, for example), your + configuration should be updated to avoid startup warnings. For + more information, see + [Error Log Configuration Methods](/doc/refman/8.0/en/error-log-configuration.html#error-log-configuration-methods). + (WL #14793) +* MySQL Enterprise Audit’s audit log file can now be extended + with optional data fields to show the query time, the number of + bytes sent and received, the number of rows returned to the + client, and the number of rows examined. This data is available + in the slow query log for qualifying queries, and in the context + of the audit log it similarly helps to detect outliers for + activity analysis. It is delivered to the audit log through new + component services that you set up as an audit log filtering + function. The extended data fields can only be added when the + audit log is in JSON format + (`audit_log_format=JSON`), which is not the + default setting. + (WL #14921) +* MySQL Server’s `AES_ENCRYPT()` and + `AES_DECRYPT()` functions now support the use + of a key derivation function (KDF) to create a cryptographically + strong secret key from information such as a password or a + passphrase that you pass to the function. The derived key is + used to encrypt and decrypt the data, and it remains in the + MySQL Server instance and is not accessible to users. Using a + KDF is highly recommended, as it provides better security than + specifying your own premade key or deriving it by a simpler + method when you use the function. The functions support HKDF + (available from OpenSSL 1.1.0), for which you can specify an + optional salt and context-specific information to include in the + keying material, and PBKDF2 (available from OpenSSL 1.0.2), for + which you can specify an optional salt and set the number of + iterations used to produce the key. + (WL #12669, WL #15188) +* A new system status variable + `Tls_library_version` shows the runtime version + of the OpenSSL library that is in use for the MySQL instance. + The version of OpenSSL affects features such as support for + TLSv1.3. + (WL #13407) +* From MySQL 8.0.30, MySQL Enterprise Encryption’s functions are + provided by a component, rather than being installed from the + `openssl_udf` shared library. The new functions + provided by the component use only the generally preferred RSA + algorithm, not the DSA algorithm or the Diffie-Hellman key + exchange method, and they follow current best practice on + minimum key size. The component functions also add support for + SHA3 for digests (provided that OpenSSL 1.1.1 is in use), and do + not require digests for signatures, although they support them. + + If you upgrade to MySQL 8.0.30 from an earlier release where the + functions are installed manually from the + `openssl_udf` shared library file, the + functions you created remain available and are supported. + However, these legacy functions are deprecated from this + release, and it is recommended that you install the component + instead. The component functions are backward compatible, so RSA + public and private keys, encrypted data, and signatures that + were produced by the legacy functions can be used with the + component functions. For the component functions to support + decryption and verification for content produced by the legacy + functions, you must set the new system variable + `enterprise_encryption.rsa_support_legacy_padding` + to `ON` (the default is + `OFF`). + + The component functions generate public and private RSA keys in + PKCS #8 format. They allow a minimum key size of 2048 bits, + which is a suitable minimum RSA key length for current best + practice. You can set a maximum key size up to 16384 bits using + the system variable + `enterprise_encryption.maximum_rsa_key_size`, + which defaults to a maximum key size of 4096 bits. + (WL #15024) +* Connections whose users have the + [`CONNECTION_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_connection-admin) privilege are + not terminated when MySQL Server is set to offline mode, which + is done by changing the value of the + [`offline_mode`](/doc/refman/8.0/en/server-system-variables.html#sysvar_offline_mode) system variable to + `ON`. Previously, checking for connections that + had the [`CONNECTION_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_connection-admin) + privilege could cause a race condition because it involved + accessing other threads. Now, a flag for each thread caches + whether or not the user for the thread has the + [`CONNECTION_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_connection-admin) privilege. The + flag is updated if the user privilege changes. When offline mode + is activated for the server, this flag is checked for each + thread, rather than the security context of another thread. This + change makes the operation threadsafe. + + In addition, when offline mode is activated, connections whose + users have the [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) + privilege are now only terminated if the user that runs the + operation also has the + [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) privilege. Users that + only have the + [`SYSTEM_VARIABLES_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_system-variables-admin) privilege, + and do not have the [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) + privilege, can set the + [`offline_mode`](/doc/refman/8.0/en/server-system-variables.html#sysvar_offline_mode) system variable to + `ON` to activate offline mode. However, when + they run the operation, any sessions whose users have the + [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) privilege remain + connected, in addition to any sessions whose users have the + [`CONNECTION_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_connection-admin) privilege. This + only applies to existing connections at the time of the + operation; users with the + [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) privilege but without + the [`CONNECTION_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_connection-admin) privilege + cannot make new connections to a system in offline mode. + (WL #14317) + +### Bugs Fixed + +* **InnoDB:** + A [`TRUNCATE TABLE`](/doc/refman/8.0/en/truncate-table.html) operation failed + to remove data dictionary entries for columns that were dropped + using `ALGORITHM=INSTANT`. + + Thanks to Marcelo Altmann for the contribution. + (Bug #34302445) +* **InnoDB:** + An incorrect nullable column calculation on tables with + instantly added columns caused data to be interpreted + incorrectly. + (Bug #34243694) +* **InnoDB:** + After upgrading to MySQL 8.0.29, a failure occurred when + attempting to access a table with an instantly added column. + (Bug #34233264) +* **InnoDB:** + Only the physical position of instantly added columns was + logged, which was not sufficient for index recovery. The logical + position of columns was also required. + (Bug #34181432) +* **InnoDB:** + The `field_phy_pos` debug variable in the + `InnoDB` sources was not updated for child + tables during a cascading update operation. + (Bug #34181419) +* **InnoDB:** + Some instances of the + `rec_get_instant_row_version_old()` function in + the InnoDB sources did not check for row versioning. + (Bug #34173616) +* **InnoDB:** + The `read_2_bytes()` function in the InnoDB + sources, which reads bytes from the log buffer, returned a null + pointer. + (Bug #34173425) +* **InnoDB:** + In a specific locking scenario, an implicit lock was not + converted to an explicit lock as expected, triggering a + `lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP, block, + heap_no, trx`) debug assertion failure. + (Bug #34123159) +* **InnoDB:** + A check that determines if a table has instantly added columns + was performed for each column, which affected the performance of + `ADD` and `DROP COLUMN` + operations on tables with numerous columns. The check is now + performed once per table. + (Bug #34112147) +* **InnoDB:** + A workload that generated a large number of lock requests and + numerous timeouts caused a long semaphore wait failure. To + address this issue, optimizations were implemented to reduce the + number of exclusive global lock system latches. + (Bug #34097862) +* **InnoDB:** + The `m_flush_bit` in the redo log block header, + which was set for the first block of multiple blocks written in + a single log write call, provided no benefit and has been + removed. + (Bug #34091444) +* **InnoDB:** + Fixed clang-tidy and cppcheck warnings, which included the + removal of unused code and unnecessary checks. + (Bug #33957087) +* **InnoDB:** + Recovery of a redo log file mini-transaction + (`mtr`) caused a debug assertion failure on a + MySQL Server instance with a small + [`innodb_log_buffer_size`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_log_buffer_size) setting. + + Thanks to Mengchu Shi for the contribution. + (Bug #33945602) +* **InnoDB:** + Compiling with the [`WITH_VALGRIND`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_valgrind) + source configuration option produced + `Wunused-variable` warnings. + (Bug #33899862) +* **InnoDB:** + Multiple issues with the lock-free hash table + (`ut_lock_free_hash_t`) were addressed. + (Bug #33830934) +* **InnoDB:** + A query on a generated column with a secondary index caused a + failure. The field number representing the position of the + generated column was not valid. + (Bug #33825077) +* **InnoDB:** + Memory consumption was greater than expected when updating and + inserting rows with multi-valued index columns. The memory + allocated for multi-valued columns for each row update was held + until the file handle was released. + (Bug #33766482) +* **InnoDB:** + The `UT_LOCATION_HERE` structure in the + `InnoDB` sources was not used consistently. + (Bug #33436161) +* **InnoDB:** + A table object needed to retrieve an array of values from a + multi-valued index column when computing the value of a + generated column was unavailable. + (Bug #32725063) +* **InnoDB:** + A 4GB tablespace file size limit on Windows 32-bit systems has + been removed. The limit was due to an incorrect calculation + performed while extending the tablespace. + (Bug #28934351) +* **InnoDB:** + Hash and random generator functions in the + `InnoDB` sources were improved. + (Bug #16739204, Bug #23584861) +* **InnoDB:** + A [`DROP TABLE`](/doc/refman/8.0/en/drop-table.html) operation on a table + with a discarded tablespace caused an unnecessary assertion + failure. + (Bug #107207, Bug #34135187) +* **InnoDB:** + A query on a table with a `JSON` column + returned only a partial result set after adding a multi-valued + index. + (Bug #106621, Bug #33917625) +* **InnoDB:** + Purging a record with multiple binary large object values raised + an insertion failure due to a mini-transaction (mtr) conflict. + (Bug #105592, Bug #33574272) +* **InnoDB:** + Enabling the adaptive hash index (AHI) on a high-concurrency + instance caused temporary AHI search latch contention while the + hash index was being built. + + Thanks to Zhou Xinjing from CDB Team at Tencent for the patch. + (Bug #100512, Bug #31750840) +* **Packaging:** + The SASL LDAP clientside plugin was missing from the MySQL + Community packages for Windows. +* **Replication:** + When a table definition diverged between the source and the + replica because the replica had an extra primary key, updates + and deletes on the replica would fail if that table had an index + that was present both on the source and the replica. Primary + keys for an InnoDB table are automatically included in all + indexes, and the replication applier needs values for all parts + of the key to be included in an event in order to search the + index. Previously, the applier checked that all the user-defined + key parts were present, but the check did not cover hidden + primary keys that were automatically included. The applier now + validates that both user-defined and automatically included key + parts are present in an event before using the index to search + the data. + (Bug #34122738) +* **Replication:** + The write sets extracted by MySQL Replication from transactions + when the `transaction_write_set_extraction` + system variable is enabled (which is the default) are extracted + from primary keys, unique keys, and foreign keys. They are used + to detect dependencies and conflicts between transactions. + Previously, write sets involving multi-column foreign keys were + incorrectly identifying each column as a separate foreign key. + The issue has now been fixed and foreign key write sets include + all referenced key columns. + (Bug #34095747, Bug #34144531) +* **Replication:** + When row-based replication was in use, a replica could sometimes + override the SQL mode value that was sent by the source, in an + attempt to avoid issues with additional columns on the slave. In + extreme cases this could lead to data divergence. The problem + has been corrected so the replica now preserves the source’s + SQL mode wherever possible. + (Bug #33945038) +* **Replication:** + MySQL’s semisynchronous replication did not respect the value + of the `net_read_timeout` system variable and + forced a read timeout of one millisecond. This could result in + the function experiencing partial reads of acknowledgment + messages and packets arriving out of order, while other + connections in the MySQL system were functioning correctly. The + value of the `net_read_timeout` system variable + is now applied to connections for semisynchronous replication. + (Bug #101056, Bug #31976209) +* **Replication:** + When the `--replicate-same-server-id` option + was used to make the replica not skip events that have its own + server ID, if the log file was rotated, replication stopped with + an error. The log rotation event now checks and applies the + current value of the option. + (Bug #89375, Bug #27492990) +* **Group Replication:** + The + `COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE` + column in the Performance Schema table + `replication_group_member_stats` could + persistently show transactions related to view change events + (`View_change_log_event`) that had already been + applied. These events are queued in the Group Replication + applier channel but applied in the Group Replication recovery + channel, causing a race condition that could result in the + counter decrement being lost. The increment of the count now + takes place at a more suitable point, and the counter for + `COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE` is + also now set to zero when the applier is not busy. + (Bug #33602354, Bug #33674059) +* **Group Replication:** + A deadlock could occur in Group Replication when a member was + interacting with the service infrastructure, such as a joining + member checking for incompatible configuration and then leaving + the group due to it. The issue has now been fixed. + (Bug #32688091) +* **Group Replication:** + The message logged when a member tries to rejoin a Group + Replication topology when there is an old incarnation of the + same server still present has been upgraded from an + informational note to a warning message. + (Bug #32651024) +* **API:** + Applications that previously used the MySQL client library to + perform an automatic reconnection to the server received the + following mysql\_query error after the server was upgraded: + + [4031] The client was disconnected by the server because of + inactivity. See wait\_timeout and interactive\_timeout for + configuring this behavior. + (Bug #105229, Bug #34007830) +* Pushing a condition down to a derived table was not handled + correctly in all cases. + (Bug #34311090) +* After pushing down a condition to a derived table having a set + operation, while folding an always true boolean condition, the + rewrite was not correct due to not setting + `abort_on_null` to true for the cloned + condition when making a copy during condition pushdown to a + derived table with a set operation. + (Bug #34298238) +* A missing error return when processing an invalid `ORDER + BY` expression in a view definition led to an assert in + debug builds. + (Bug #34239456) +* MySQL Server would not compile with the latest version of Visual + Studio 2022. + (Bug #34231639) +* While attempting to clone a system variable during condition + pushdown, the server sometimes could not determine the correct + context of the cloned expression. + + To prevent this, we disallow condition pushdown to derived + tables when they use system variables, or if the underlying + expressions in the derived table contain system variables. + (Bug #34205559) +* Added Enterprise Linux 9 (EL9) support. + (Bug #34190004) +* On macOS 11, MySQL Server did not have the correct entitlement + to generate a core dump in the event of an unexpected server + halt. A build option WITH\_DEVELOPER\_ENTITLEMENTS has been added + to allow a build to generate core dumps. + (Bug #34163987) +* Improved error handling for '-DWITH\_LIBEVENT=system' and + '-DWITH\_EDITLINE=system' on systems missing libevent-devel or + libedit-devel. + (Bug #34131334, Bug #34123545) +* The fix for Bug #33830493 in MySQL 8.0.29 addressed the + situation where if a MySQL instance stopped unexpectedly or was + restarted shortly after a `SET PERSIST` + statement was used to record system variable settings, the + configuration file `mysqld-auto.cnf` could be + left empty, in which case the server restart could not proceed. + The persisted system variables are now written to a backup file, + which is only renamed to `mysqld-auto.cnf` + after the success of the write has been verified, leaving the + original `mysqld-auto.cnf` file still + available. On a restart, if a backup file with valid contents is + found, the server reads from that file. Otherwise the + `mysqld-auto.cnf` file is used and the backup + file is deleted. The file was not flushed to disk by this fix, + so it was still possible for the issue to occur. This patch adds + those operations. + (Bug #34122866) +* Fixed the -DENABLE\_GCOV CMake option. + (Bug #34113243) +* The [`SENSITIVE_VARIABLES_OBSERVER`](/doc/refman/8.0/en/privileges-provided.html#priv_sensitive-variables-observer) + privilege, introduced in MySQL 8.0.29, is now granted to users + with the [`SYSTEM_VARIABLES_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_system-variables-admin) + privilege during upgrade. Previously, the privilege was not + granted to any database user during upgrade. + (Bug #34068378) +* A select from a view that used left joins did not return any + results. + (Bug #34060289) +* Under certain circumstances `TRUNCATE + performance_schema.accounts` caused duplicated counts + in [`global_status`](/doc/refman/8.0/en/performance-schema-status-variable-tables.html). + + This occurred if some hosts were not instrumented. For example, + if + [`performance_schema_hosts_size`](/doc/refman/8.0/en/performance-schema-system-variables.html#sysvar_performance_schema_hosts_size) + was set to a low value. + + Our thanks to Yuxiang Jiang and the Tencent team for the + contribution. + (Bug #34057013, Bug #106939) +* It was possible under certain conditions for + [`EXPLAIN ANALYZE`](/doc/refman/8.0/en/explain.html#explain-analyze) to attempt access + of an iterator that did not exist. + (Bug #34051681) + + References: This issue is a regression of: Bug #33905399. +* Support was added for compiling the + `keyring_oci` plugin with OpenSSL 3. + (Bug #34043013) +* Corrected two issues found with [`EXPLAIN + ANALYZE`](/doc/refman/8.0/en/explain.html#explain-analyze): + + + Timings displayed as actual time were not cumulative. + + For a materialized table, the output now show the number of + rows materialized, rather than the number of rows read from + the materialized table. + + (Bug #34025798, Bug #34135465) + + References: See also: Bug #33834146, Bug #34678179. +* Events recorded in the Performance Schema tables for thread + creation and deletion were retained until server shutdown, + instead of being removed when the client connection ended. + Thread creation and deletion now takes place after the + Performance Schema instrumentation is created for the user + session, so it is cleaned up when the session ends. + (Bug #34019988) +* Upgraded the bundled zlib library to zlib 1.2.12. Also made zlib + 1.2.12 the minimum zlib version supported, and removed WITH\_ZLIB + from the WITH\_SYSTEM\_LIBS CMake option. + (Bug #34015600) +* The [`CONNECTION_ID()`](/doc/refman/8.0/en/information-functions.html#function_connection-id) function, + since it returns a session ID which remains constant for the + lifetime of the session, was treated as a constant function. + This caused issues when `CONNECTION_ID()` was + used inside a trigger attached to a table which might be reused + by other sessions. We fix this by making the function + `const` for execution, and returning the actual + session ID when the function is evaluated. + (Bug #34009876) +* Executed `codespell` on the source code and + fixed the reported spelling errors in the code comments. + (Bug #34006439) +* The MySQL Enterprise Encryption `openssl_udf` function + library plugin was reimplemented to use OpenSSL 3 APIs. + (Bug #33992115) +* `FEDERATED` storage engine code was revised to + address NULL pointer and variable access issues. + (Bug #33962357) +* Histograms in MySQL returned a selectivity estimate of + `0` for values that outside buckets. This meant + that values might be missing from the histogram because they + were missed during sampling, or because the histogram had grown + stale. To prevent this, we introduce a constant lower bound of + `0.001` on the selectivity estimates produced + by histograms. This choice of lower bound corresponds to the + selectivity of a value or range that we are likely to miss + during sampling. + + Using a constant lower bound rather than a statistical estimate + for the selectivity of a missing value has the advantage of + simplicity and predictability, and provides some protection + against underestimating the selectivity due to stale histograms + and within-bucket heuristics. + + For more information about histograms in MySQL, see + [Optimizer Statistics](/doc/refman/8.0/en/optimizer-statistics.html). + (Bug #33935417) +* For certain queries using a common table expression (CTE), + [`EXPLAIN ANALYZE`](/doc/refman/8.0/en/explain.html#explain-analyze) did not provide + any profiling data for the CTE even when the CTE was known to be + executed. This happened when the following conditions were met: + + + The CTE was referenced more than once in the query plan. + + The first reference to the CTE (in the order of the output + of `EXPLAIN FORMAT=TREE`) was never + executed. + + At least one of the subsequent references was executed at + least once. + + The problem was that the CTE plan was always printed when + encountering the first reference to the CTE; if that reference + was never executed, the CTE was not materialized there; and thus + there was no profiling data to print. + + The fix for this issue ensures that we print the CTE plan when + it is first executed, that is, the point at which it is + materialized. The output then includes profiling data. If the + CTE is never executed, we print the plan at the last reference, + when there is no profiling data. + (Bug #33905399) +* The output from the command `mysqld --verbose + --help` previously showed plugin load options as + `ON` even when they were off by default, or + turned off using an option. The output now shows the current + value for the plugin. + (Bug #33870892) +* The Server now bundles curl (7.83.1) and only uses it when + alternative SSL systems are used, such as openssl11 on EL7. + (Bug #33859507, Bug #34154806) +* Debug MySQL binaries can now be built using `-0g` + and `-fno-inline`. + (Bug #33855533) +* The [`FIREWALL_EXEMPT`](/doc/refman/8.0/en/privileges-provided.html#priv_firewall-exempt) privilege, + introduced in MySQL 8.0.27, is now granted to users with the + [`SYSTEM_USER`](/doc/refman/8.0/en/privileges-provided.html#priv_system-user) during upgrade. + Previously, the privilege was not granted to any database user + during upgrade. + (Bug #33854409) +* A correlated subquery did not use a functional index as + expected. This occurred when an outer column reference used + inside the subquery was not considered as constant for subquery + execution, which allowed consideration of the functional index + to be skipped. + + We fix this problem by making sure to consider the outer column + reference as constant while executing the subquery. + (Bug #33851055) +* Added alternate OpenSSL system package support by passing in + openssl11 on EL7 or openssl3 on EL8 to the WITH\_SSL Cmake + option. Authentication plugins, such as LDAP and Kerberos, are + disabled as they do not support these alternative versions of + OpenSSL. + (Bug #33835934) +* Prepared statements with subqueries that accessed no tables, but + the subquery evaluation raised an error, triggered an assert + failure in debug builds. + (Bug #33773799) +* Some stored functions were not executed correctly following the + first invocation. + (Bug #33754993) +* When performing a query using a recursive common table + expression (CTE) with a removal of a query expression after + constant predicate elimination, it is expected that when the + reference count of table objects for the CTE temporary table + reaches zero, it should be possible once again to recreate the + table, but in certain cases one of the table references was not + properly recorded as attached to the CTE. + (Bug #33725503) + + References: See also: Bug #32962511. +* Added a missing error return to the parser. + (Bug #33725502) +* A number of issues with pushdown of conditions making use of + outer references, relating to work done in MySQL 8.0.22 to + implement condition pushdown for materialized derived tables, + have been identified and resolved. + (Bug #33725403, Bug #33725500, Bug #33725508, Bug #33725534, Bug #33725545) +* The plan generated for a [`SELECT`](/doc/refman/8.0/en/select.html) + using a common table expression involves table materialization + and an index scan on the materialized table. Because the + `temptable` engine does not yet support all + index scan methods, such queries might not always execute + correctly. + + With other MySQL engines, the materialization access path has + special handling when the access path is not considered basic; + for `temptable`, an index scan was not + considered basic, which led to undefined behavior. + + We fix this issue by considering the index scan access path + basic, and thus avoiding use of any index scan access methods on + `temptable` tables. + (Bug #33700735) +* The `Data_free` column in the + [`INFORMATION_SCHEMA.FILES`](/doc/refman/8.0/en/information-schema-files-table.html) table was + not updated after adding a new data file to the + `InnoDB` system tablespace. + (Bug #33508534) +* If a plugin attempted to register a system variable with a name + that duplicated that of an existing system variable, the + existing static system variable might be overwritten, and + uninstalling the plugin might leave pointers to the freed + memory. The issues have now been fixed. + (Bug #33451101) +* `SHOW TABLES` and `SELECT * FROM + INFORMATION_SCHEMA.TABLES` did not return any results + from the Performance Schema if the user had access privileges on + individual Performance Schema tables, only. + (Bug #33283709) +* Calling a function relating to the + `data_masking` plugin without first installing + the plugin led to an unplanned server shutdown. Functions + relating to this plugin are initialized by calling init + functions which in turn access the UDF metadata service, but + this is valid only when the data masking plugin is installed. We + fix this problem by adding a check to verify that the plugin is + installed before initializing such functions, and to return an + appropriate error message if the plugin providing them is not + installed. + (Bug #33234046) +* Under certain conditions, the server did not handle the + expiration of + [`max_execution_time`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_execution_time) or the + execution of a [`KILL`](/doc/refman/8.0/en/kill.html) statement + correctly. + (Bug #33218625) +* **mysqlslap**, which uses multiple threads to + connect to the server, could not run with a user account that + used FIDO authentication. The issue has been fixed by an update + to the FIDO library allowing the authentication to be performed + on multiple threads. + (Bug #33067183) +* If an incorrect value was set for the + `binlog_checksum` system variable during a + session, a **COM\_BINLOG\_DUMP** command made in + the same session to request a binary log stream from a source + failed. The server now validates the specified checksum value + before starting the checksum algorithm setup process. + (Bug #32442749) +* For slow query logging, the + [`Slow_queries`](/doc/refman/8.0/en/server-status-variables.html#statvar_Slow_queries) status variable + was not implemented unless the slow query log was enabled, + contrary to the documentation. + (Bug #28268680, Bug #91496) +* New parameters (`examined_row_count`, + `affected_row_count`, and + `return_row_count`) were added to the audit + plugin. Our thanks to J D for the contribution. + (Bug #110628, Bug #35267239) +* A prepared statement could accept an empty string as a valid + float value, which represents a regression from 8.0.27 behavior. + This fix explicitly checks that the length of an interpreted + string is non-empty and fully interpreted as a (float) number. + In addition, new verification now ensures that: + + + All numeric values are supported with empty strings and + strings that are all spaces. + + Regular numeric values are supported, as well as numeric + values with leading and trailing spaces. + + (Bug #107399, Bug #34213338) + + References: This issue is a regression of: Bug #32213576. +* Upgrading to MySQL 8.0.29 led to issues with existing spatial + indexes (see [Creating Spatial Indexes](/doc/refman/8.0/en/creating-spatial-indexes.html)). The + root cause of the problem was a change in how geographic area + computations were performed by the included Boost library, which + was upgraded to version 1.77.0 in MySQL 8.0.29. We fix this by + ensuring that we accommodate the new method whenever such + computations are performed. + (Bug #107320, Bug #34184111) + + References: This issue is a regression of: Bug #33353637. +* When pushing a condition down to derived table for prepared + statements, we clone a condition which also includes parameters + when a derived table contains unions. When a statement needed to + be reprepared during execution—for example, when the + signedness of the value specified did not match that of the + actual datatype—the parameter was not cloned correctly + resulting in errors. This occurred because the value specified + for the parameter was used to print the string for reparsing, + instead of a literal `?` placeholder character. + + Now in such cases we set a flag + `QT_NO_DATA_EXPANSION` for printing parameters + for reparsing which, when enabled, causes the + `?` placeholder to be printed, rather than the + actual value. + (Bug #107230, Bug #34148712) +* On MacOS, improved Boost library detection logic for Homebrew as + a potentially incompatible system's Boost version could get used + even with `-DWITH_BOOST` set. + (Bug #107151, Bug #34121866) + + References: This issue is a regression of: Bug #33769505. +* On RHEL 7.x, fetching the CPU cache line size returned 0 on + s390x RHEL 7.x which caused rpl\_commit\_order\_queue and + integrals\_lockfree\_queue to fail. + + Our thanks to Namrata Bhave for the contribution. + (Bug #107081, Bug #34095278) +* When the **mysql** client was unable to reconnect + to the server following an unexpected server halt, the process + of building the completion hash allocated memory that was not + freed. The reconnection operation now does not build the + completion hash if the client fails to reconnect, and the memory + concerned is freed if the client is disconnected. + (Bug #106864, Bug #34019571) +* Added a cycle timer for the s390x architecture. + + Our thanks to Namrata Bhave for the contribution. + (Bug #106824, Bug #33997819) +* In certain cases, incorrect results could result from execution + of a semijoin with materialization, when the + `WHERE` clause of the subquery contained an + equality. In some cases, such as when one side of such an + equality was an `IN` or `NOT + IN` subquery, the equality was neither pushed down to + the materialized subquery, nor evaluated as part of the + semijoin. This also caused issues with some inner hash joins. + (Bug #106710, Bug #106718, Bug #33952115, Bug #33957233) + + References: See also: Bug #84705, Bug #25466100. +* Comparator functions for queries like `( + ) IN ((val1, val2), (val3, val4), + …)` could return the wrong results. + (Bug #106567, Bug #33897969) +* Fixed an assert definition in SetOsLimitMaxOpenFiles; our thanks + to hongyuan li for the contribution. + (Bug #106555, Bug #33893197) +* Previously, it was assumed that, when the same non-nullable + expression was used as both the first and second arguments to + [`LIKE`](/doc/refman/8.0/en/string-comparison-functions.html#operator_like), the result was always true, + and so could be optimized away. This assumption turns out not to + be valid, due to the fact that `LIKE` treats + the backslash (`\`) as an escape character, + even when `ESCAPE` is not specified. This led + to different results when the condition was used in the + `SELECT` list as opposed to the + `WHERE` clause. To fix the problem, we no + longer perform this optimization with `LIKE`, + with or without an `ESCAPE` clause. + (Bug #106444, Bug #33852756) +* In some cases, when arguments other than global transaction IDs + (such as column values) were passed to + [`GTID_SUBSET()`](/doc/refman/8.0/en/gtid-functions.html#function_gtid-subset), the function + returned values other than the expected `NULL`. + (Bug #106298, Bug #33793942) +* A problem with evaluation of general quantified comparison + predicates occurred when the left-hand side of the predicate was + `NULL`. In such cases, the value of the + subquery evaluation from the last current row is saved, so that + it does not need re-evaluation, but the cached value + (`result_for_null_param`) was not cleared + between executions, so that the next execution could re-use the + result from the previous execution. One consequence of this was + that, when a subquery execution first caused zero rows to match + from the subquery—which for an `ALL` + predicate should return `TRUE`—a + subsequent execution causing at least one row to match also + returned `TRUE`, even though + `FALSE` was expected. + + To solve this issue, we now make sure to clear + `result_for_null_param` while cleaning up the + subquery predicate following execution. + (Bug #106164, Bug #33755139) +* Test cases executed with the `--async-client` + option and shutdown commands caused **mysqltest** + to halt unexpectedly. + (Bug #105797, Bug #33643149) +* MySQL supports the use of equiheight histograms to improve + selectivity estimates. Each bucket in an equiheight histogram + for a column should contain roughly the same number of values + (rows); keeping the buckets small helps minimize any error. + + When constructing an equiheight histogram, too many values were + sometime placed in the same bucket, which could result in + substantial errors in selectivity estimation. We fix this by + introducing a new equiheight construction algorithm that + guarantees low error, and adapts to the distribution of the data + to make efficient use of its buckets. In addition, a new + estimator for the number of distinct values in histogram buckets + provides improved worst-case error guarantees. + + See + [The INFORMATION\_SCHEMA COLUMN\_STATISTICS Table](/doc/refman/8.0/en/information-schema-column-statistics-table.html), + and [Optimizer Statistics](/doc/refman/8.0/en/optimizer-statistics.html), for more + information. + (Bug #104789, Bug #33302021) +* Deprecation warnings returned to client programs were sent to + `stdout` rather than `stderr`, + which in the case of **mysqldump** could mean + that the dump file no longer worked because the warnings were + included in it. The issue has now been fixed and the warnings + are sent to `stderr`. + (Bug #104769, Bug #33733529) +* Extended support for chained SSL certificates. + (Bug #54158, Bug #27491518) diff --git a/corpus/changelog/mysql_releases/mysql_8031.md b/corpus/changelog/mysql_releases/mysql_8031.md new file mode 100644 index 0000000000000000000000000000000000000000..d850e9025eee9684be3542575dc3b29899af3264 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8031.md @@ -0,0 +1,1201 @@ +# MySQL 8.0.31 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-31.html +Version: 8.0.31 + +## Changes in MySQL 8.0.31 (2022-10-11, General Availability) + +* [Audit Log Notes](news-8-0-31.html#mysqld-8-0-31-audit-log "Audit Log Notes") +* [Compilation Notes](news-8-0-31.html#mysqld-8-0-31-compiling "Compilation Notes") +* [Component Notes](news-8-0-31.html#mysqld-8-0-31-components "Component Notes") +* [Deprecation and Removal Notes](news-8-0-31.html#mysqld-8-0-31-deprecation-removal "Deprecation and Removal Notes") +* [Keyring Notes](news-8-0-31.html#mysqld-8-0-31-keyring "Keyring Notes") +* [Optimizer Notes](news-8-0-31.html#mysqld-8-0-31-optimizer "Optimizer Notes") +* [Performance Schema Notes](news-8-0-31.html#mysqld-8-0-31-performance-schema "Performance Schema Notes") +* [SQL Syntax Notes](news-8-0-31.html#mysqld-8-0-31-sql-syntax "SQL Syntax Notes") +* [Functionality Added or Changed](news-8-0-31.html#mysqld-8-0-31-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-31.html#mysqld-8-0-31-bug "Bugs Fixed") + +### Audit Log Notes + +* The [`audit_log_rotate()`](/doc/refman/8.0/en/audit-log-reference.html#function_audit-log-rotate) function + simplifies audit log file rotation. Previously, audit log file + rotation required renaming the file manually and setting + [`audit_log_flush = ON`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_flush) to close + the file and open a new log file with the original name. The + `audit_log_rotate()` function renames the + current file and creates a new one. Manually renaming the audit + log file is no longer necessary. + + The [`audit_log_flush`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_flush) variable is + deprecated as of MySQL 8.0.31; expect support for it to be + removed in a future version of MySQL. + (WL #15249) + +### Compilation Notes + +* **Microsoft Windows:** + Fixed all C++ deprecation warnings by not using deprecated C++ + STL features. + (Bug #33985941) +* Renamed internal Performance Schema functions from \_utf8\* to + \_utf8mb4\* as they've used utf8mb4 since v8.0.11. + (Bug #34351301) + + References: See also: Bug #27407745. +* Fixed linker flags for clang/ubsan to work around a LLVM/Clang + related integer issue as described in LLVM bug #16404. + (Bug #34311325) +* Updated helper scripts to use 'utf8mb3' for charsets/collations + instead of 'utf8' for future compatibility. + + Renamed functions and data structures used to handle utf8mb3 + character sets and collations to help clarify their utf8mb3 + usage. + (Bug #34263480, Bug #34025412) +* Cleaned up CMake code, and simplified INFO\_BIN and INFO\_SRC. + (Bug #34139084) + +### Component Notes + +* New component services now enable server components and plugins + to query within the local server. The new MySQL command services + are similar to C API functions in `libmysql`, + except they do not expose protocol internals to the client. For + information about these services, see the MySQL Server Doxygen + documentation, available at + https://dev.mysql.com/doc/index-other.html. Search for: + + + `s_mysql_mysql_command_factory` + + `s_mysql_mysql_command_options` + + `s_mysql_mysql_command_query` + + `s_mysql_mysql_command_query_result` + + `s_mysql_mysql_command_field_info` + + `s_mysql_mysql_command_error_info` + + (WL #14293) + +### Deprecation and Removal Notes + +* The `keyring_oci` plugin is deprecated and + subject to removal in a future release of MySQL. Instead, + consider using the `component_keyring_oci` + component for storing keyring data (see + [Using the Oracle Cloud Infrastructure Vault Keyring Component](/doc/refman/8.0/en/keyring-oci-component.html)). + (WL #14943) + +### Keyring Notes + +* MySQL Keyring previously implemented Oracle Cloud Infrastructure Vault Keyring + keystore capabilities using a server plugin, but now is + transitioning to use the MySQL component infrastructure. The new + keyring component has similarities to the existing + `keyring_oci` plugin, but is configured + differently and can access keys that were created using the + `keyring_oci` plugin when a similar set of + configuration options are used to initialize the new component. + For configuration details, see + [Using the Oracle Cloud Infrastructure Vault Keyring Component](/doc/refman/8.0/en/keyring-oci-component.html). + + `component_keyring_oci` is not loaded using the + [`--early-plugin-load`](/doc/refman/8.0/en/server-options.html#option_mysqld_early-plugin-load) server option + during startup or configured during startup or at runtime using + system variables: + + + During startup, the server determines which keyring + component to load using a manifest file, and the loaded + component consults its own configuration file when it + initializes. See + [Keyring Component Installation](/doc/refman/8.0/en/keyring-component-installation.html). + + At runtime, the [`ALTER INSTANCE RELOAD + KEYRING`](/doc/refman/8.0/en/alter-instance.html#alter-instance-reload-keyring) statement enables reconfiguring an + installed keyring component after changes to its + configuration file. See [ALTER INSTANCE Statement](/doc/refman/8.0/en/alter-instance.html). + + If a keyring component is installed, the Performance Schema + [`keyring_component_status`](/doc/refman/8.0/en/performance-schema-keyring-component-status-table.html) table + provides status information about it. See + [The keyring\_component\_status Table](/doc/refman/8.0/en/performance-schema-keyring-component-status-table.html). + (WL #14943) + +### Optimizer Notes + +* **Important Change:** + The MySQL Optimizer's internal management of set operations has + been improved, with the following effects: + + + Bodies of parenthesized query expressions can now be nested + to in combination with [`UNION`](/doc/refman/8.0/en/union.html). + For example, the query shown here, previously rejected with + error [`ER_NOT_SUPPORTED_YET`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_not_supported_yet), + is now allowed: + + ```None + ( + (SELECT a, b, c FROM t ORDER BY a LIMIT 3) ORDER BY b LIMIT 2 + ) ORDER BY c LIMIT 1; + ``` + + When collapsing parenthesized expression bodies, MySQL now + follows the semantics specified in the SQL standard, so that + a higher outer limit cannot override an inner lower one. + This means that the expression `(SELECT ... LIMIT 3) + LIMIT 5` can return at most three rows. + + `UNION DISTINCT` and `UNION + ALL` can now be nested in arbitrary combinations. + + The maximum nesting level supported in all the cases just listed + is 63; this follows any simplifications or merging performed by + the parser. See + [Parenthesized Query Expressions](/doc/refman/8.0/en/parenthesized-query-expressions.html), for more + information. + (Bug #103954, WL #11350) +* An outer reference in a derived table pointing to a table in a + [`JOIN`](/doc/refman/8.0/en/join.html) operation that was not + available for the subquery to be reported (incorrectly) as + valid, whereas such a reference without a derived table was + correctly reported as invalid. + + In a related issue, an outer reference to a derived table placed + inside the `VALUES` clause of an + [`INSERT`](/doc/refman/8.0/en/insert.html) statement was not + recognized as valid, whereas a similar reference without a + derived table was so recognized. Now such a reference to a + derived table is accepted within `VALUES`. + + In both cases, we fix the problem by making sure that the + correct name resolution context is used for the outer reference. + (Bug #32678303, Bug #34131822) + +### Performance Schema Notes + +* The Performance and sys schemas now expose metrics for the + global and session memory limits introduced in MySQL 8.0.28. + + The following columns were added to tables of the Performance + Schema: + + + [`SETUP_INSTRUMENTS`](/doc/refman/8.0/en/performance-schema-setup-instruments-table.html): + + - `FLAGS` + + [`THREADS`](/doc/refman/8.0/en/performance-schema-threads-table.html): + + - `CONTROLLED_MEMORY` + - `MAX_CONTROLLED_MEMORY` + - `TOTAL_MEMORY` + - `MAX_TOTAL_MEMORY` + + [`EVENTS_STATEMENTS_CURRENT`](/doc/refman/8.0/en/performance-schema-events-statements-current-table.html), + [`EVENTS_STATEMENTS_HISTORY`](/doc/refman/8.0/en/performance-schema-events-statements-history-table.html), and + [`EVENTS_STATEMENTS_HISTORY_LONG`](/doc/refman/8.0/en/performance-schema-events-statements-history-long-table.html): + + - `MAX_CONTROLLED_MEMORY` + - `MAX_TOTAL_MEMORY` + + [Statement Summary Tables](/doc/refman/8.0/en/performance-schema-statement-summary-tables.html): + + - `MAX_CONTROLLED_MEMORY` + - `MAX_TOTAL_MEMORY` + + [Performance Schema Connection Tables](/doc/refman/8.0/en/performance-schema-connection-tables.html): + + - `MAX_SESSION_CONTROLLED_MEMORY` + - `MAX_SESSION_TOTAL_MEMORY` + + [`PREPARED_STATEMENTS_INSTANCES`](/doc/refman/8.0/en/performance-schema-prepared-statements-instances-table.html): + + - `MAX_CONTROLLED_MEMORY` + - `MAX_TOTAL_MEMORY` + + The following columns were added to the sys schema + [`STATEMENT_ANALYSIS`](/doc/refman/8.0/en/sys-statement-analysis.html) and + [`X$STATEMENT_ANALYSIS`](/doc/refman/8.0/en/sys-statement-analysis.html) views: + + + `MAX_CONTROLLED_MEMORY` + + `MAX_TOTAL_MEMORY` + + The PROPERTIES column of the + [`SETUP_INSTRUMENTS`](/doc/refman/8.0/en/performance-schema-setup-instruments-table.html) table was updated + with the `controlled_by_default` flag. + + You can also add, or remove, non-global memory instruments to + the set of controlled-memory instruments by setting the value of + the `FLAGS` column of + [`SETUP_INSTRUMENTS`](/doc/refman/8.0/en/performance-schema-setup-instruments-table.html).For example: + + ```None + SQL> UPDATE PERFORMANCE_SCHEMA.SETUP_INTRUMENTS SET FLAGS="controlled" + WHERE NAME='memory/sql/NET::buff'; + ``` + + (WL #14432) + +### SQL Syntax Notes + +* It is now possible to set a column histogram to a user-specified + JSON value. This can be useful when sampling leaves out + important values. This also means that a secondary (replica) + MySQL server can assume the work of sampling the data and + building the histogram, which can then be used on the primary + (source) without impacting its performance. + + This capability is provided through an extension to + [`ANALYZE TABLE ... + UPDATE HISTOGRAM`](/doc/refman/8.0/en/analyze-table.html). The following statement sets the + histogram for column *`col_name`* of + table *`tbl_name`* to the histogram's + JSON representation *`json_data`*: + + ```None + ANALYZE TABLE tbl_name + UPDATE HISTOGRAM ON col_name + USING DATA 'json_data' + ``` + + You can confirm afterwards this by checking the value of the + `HISTOGRAM` column of the Information Schema + [`COLUMN_STATISTICS`](/doc/refman/8.0/en/information-schema-column-statistics-table.html) table. + + See + [Histogram Statistics Analysis](/doc/refman/8.0/en/analyze-table.html#analyze-table-histogram-statistics-analysis), + for more information and examples. + + Our thanks to Kaiwang Chen for this contribution to MySQL. + (Bug #104040, Bug #33012389, WL #15123) +* In this release MySQL adds support for the SQL standard + [`INTERSECT`](/doc/refman/8.0/en/intersect.html) and + [`EXCEPT`](/doc/refman/8.0/en/except.html) table operators. + + `query_a INTERSECT + query_b` includes only rows + appearing in both result sets. + + `query_a EXCEPT + query_b` returns any rows + from the result set of *`query_a`* which + are *not* in the result of + *`query_b`*. + + `INTERSECT` and `EXCEPT` both + support `DISTINCT` and `ALL`, + with `DISTINCT` the default in both cases. + (This is the same as for [`UNION`](/doc/refman/8.0/en/union.html)). + + `INTERSECT` groups before + `EXCEPT` or + [`UNION`](/doc/refman/8.0/en/union.html), so + [`TABLE`](/doc/refman/8.0/en/table.html) `r EXCEPT TABLE s + INTERSECT TABLE t` is evaluated as `TABLE r + EXCEPT (TABLE s INTERSECT TABLE t)`. + + See [INTERSECT Clause](/doc/refman/8.0/en/intersect.html), and [EXCEPT Clause](/doc/refman/8.0/en/except.html), + for additional information and examples. + (Bug #1309, Bug #31336, Bug #11747209, Bug #11744757, WL #349) + +### Functionality Added or Changed + +* **Important Change; Replication:** + The `Rewriter` plugin rewrites SQL queries + according to a table of rewriter rules. Previously, all queries + were subject to rewrites, including those from any user + regardless of privileges, as well as internal system queries + like those performed by the replication applier thread, by + bootstrapping the MySQL Server, and by storage engines. This + MySQL release provides a mechanism for allowing the plugin to + skip rewrites for certain queries, such as those executed by + system threads, and those from designated users. + + We do this by implementing a new privilege + [`SKIP_QUERY_REWRITE`](/doc/refman/8.0/en/privileges-provided.html#priv_skip-query-rewrite), which + indicates a user whose queries are not rewritten. A new system + variable + [`rewriter_enabled_for_threads_without_privilege_checks`](/doc/refman/8.0/en/rewriter-query-rewrite-plugin-reference.html#sysvar_rewriter_enabled_for_threads_without_privilege_checks) + controls whether rewrites are skipped for threads executing with + privilege checks disabled. Such threads include upgrade threads, + initialisation threads, and replication threads which have + `PRIVILEGE_CHECKS_USER` as + `NULL`. To preserve backward compatibility, the + default setting for this variable is variable is + `ON`, although the recommended setting is + `OFF`. + + Both `SKIP_QUERY_REWRITE` and + `rewriter_enabled_for_threads_without_privilege_checks` + are available only if the `Rewriter` plugin is + installed. + + For more information, see + [The Rewriter Query Rewrite Plugin](/doc/refman/8.0/en/rewriter-query-rewrite-plugin.html). + (WL #14527) +* **Important Change:** + For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 1.1.1q. Issues fixed in OpenSSL version 1.1.1q are described at + + and + . + (Bug #34414695) +* **InnoDB:** + Two new status variables are provided for monitoring online + buffer pool resizing operations. The + [`Innodb_buffer_pool_resize_status_code`](/doc/refman/8.0/en/server-status-variables.html#statvar_Innodb_buffer_pool_resize_status_code) + status variable reports a status code indicating the stage of an + online buffer pool resizing operation. The + [`Innodb_buffer_pool_resize_status_progress`](/doc/refman/8.0/en/server-status-variables.html#statvar_Innodb_buffer_pool_resize_status_progress) + status variable reports a percentage value indicating the + progress of each stage. + + For more information, see + [Configuring InnoDB Buffer Pool Size](/doc/refman/8.0/en/innodb-buffer-pool-resize.html). + (WL #15175) +* **Replication:** + When replication filtering is in use, a replica no longer raises + replication errors related to privilege checks or + [`require_row_format`](/doc/refman/8.0/en/server-system-variables.html#sysvar_require_row_format) validation + for events which are filtered out. Previously, all privileges + were checked in the applier, with some being checked before + applying filters and others not until after; with this release, + privilege checks are now deferred until after all replication + filters have been applied. In addition, prior to this release, + checks for `require_row_format` equal to + `1` took place on both the receiver and the + applier; now the applier alone performs this check, before any + filters are evaluated. + + This makes it possible to filter out any transactions that fail + validation, using existing replication filters, and for the + replica to accept only that part of the database to which a + given user has been granted access, as long as updates to this + part of the database are replicated only in row-based format. + Another instance in which this might be desirable is when + migrating to MySQL Database Service from on-premise or cloud + services which use administration tables to which the inbound + replication user does not have access. + + Privilege checks protect against updating critical tables on the + replica. Checking `require_row_format` protects + against replicating unsafe operations; this is used in + conjunction with privilege checks, because the guaranteed + absence of unsafe operations removes the need for some session + context initialization and cleanup actions, which in turn + removes the need to grant privileges for those operations. + + Other behavior changes associated with this work are noted in + the following list: + + + The receiver thread no longer errors out when an event that + violates require row format validation is received; the + applier thread no longer errors out when an event that + violates require row format validation is handled and + subsequently filtered out due to replication filters. + + The applier thread no longer errors out for + `Query` log events that are filtered out + due to lack of privileges for setting any of the system + variables listed here: + + - [`pseudo_thread_id`](/doc/refman/8.0/en/server-system-variables.html#sysvar_pseudo_thread_id) + - [`sql_require_primary_key`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_require_primary_key) + - [`default_table_encryption`](/doc/refman/8.0/en/server-system-variables.html#sysvar_default_table_encryption) + + This is because setting the variable and checking whether + the applier is authorized to set it are now performed only + after filtering takes place. If an event is filtered out, + the applier does not try to set the variable, and thus never + fails a check whether it has the necessary privileges to do + so. + + The applier thread no longer errors out on privilege checks + when an `Execute_load_query` event is + handled and ends up being filtered out due to replication + filters. This is also the case when an + `Append_block` or + `Begin_load_query` event is applied, and a + subsequent `Execute_load_query` event is + handled and then filtered out. + + The applier thread no longer errors out on privilege checks + or `require_row_format` checks for + `Delete_file` events. These events are not + filterable, because they do not contain the table name or + database name, so we assume they are filtered out. We assume + this to be safe because Delete\_file events do not alter + database state. + + The applier thread no longer creates or deletes files in the + filesystem during the handling of + `Append_block` or + `Delete_file` events, when there is a user + account configured by + `PRIVILEGE_CHECKS_USER` and it does not + have the [`FILE`](/doc/refman/8.0/en/privileges-provided.html#priv_file) privilege, nor + if `require_row_format` is enabled. + + For a replication event altered by + [`--replicate-rewrite-db`](/doc/refman/8.0/en/replication-options-replica.html#option_mysqld_replicate-rewrite-db), any + privilege checks apply to the rewritten database. + + See [How Servers Evaluate Replication Filtering Rules](/doc/refman/8.0/en/replication-rules.html), and + [Replica Errors During Replication](/doc/refman/8.0/en/replication-features-errors.html), for more + information. + (Bug #33704306, Bug #33733677, WL #15032) +* The new + [`Resource_group_supported`](/doc/refman/8.0/en/server-status-variables.html#statvar_Resource_group_supported) + status variable is added to indicate whether a server supports + the resource group feature. + (Bug #34264356) +* Binary packages that include curl rather than linking to the + system curl library have been upgraded to use curl 7.85.0. + (Bug #34138733, Bug #34614578) +* The new + [`thread_pool_transaction_delay`](/doc/refman/8.0/en/server-system-variables.html#sysvar_thread_pool_transaction_delay) + system variable permits specifying a delay period, in + milliseconds, before worker threads start executing a new + transaction. The maximum value is 300000 (5 minutes). + + A transaction delay can be used in cases where parallel + transactions affect the performance of other operations due to + resource contention. For example, if parallel transactions + affect index creation or an online buffer pool resizing + operation, you can configure a transaction delay to reduce + resource contention while those operations are running. + (WL #15277) +* The new `thread_pool_query_threads_per_group` + system variable lets you increase the number of query threads in + a thread group, from the default of a single query thread. When + you are using the high concurrency thread pool algorithm + (`thread_pool_algorithm=1`), consider + increasing the value if you experience slower response times due + to long-running transactions. It cannot exceed the value of + `thread_pool_max_transactions_limit`. + (WL #15330) +* Thread pool plugin features previously only available with MySQL + Database Service, are now available in MySQL Enterprise Edition. + + + The `thread_pool_max_transactions_limit` + variable defines the maximum number of transactions + permitted by the thread pool plugin. Defining a transaction + limit binds a thread to a transaction until it commits, + which helps stabilize throughput during high concurrency. + + The `thread_pool_dedicated_listeners` + variable dedicates a listener thread in each thread group to + listen for incoming statements from connections assigned to + the group. This variable is only useful when a transaction + limit is defined by + `thread_pool_max_transactions_limit`. + Having an additional dedicated listener thread in each + thread group consumes more resources and affects thread pool + performance. + `thread_pool_dedicated_listeners` should + therefore be used cautiously. + + The `TP_CONNECTION_ADMIN` privilege enables + a user to access the server with a privileged connection. + When the limit defined by + `thread_pool_max_transactions_limit` has + been reached, new connections cannot access the server. A + privileged connection ignores the limit defined by + `thread_pool_max_transactions_limit` and + permits connecting to the server to increase the transaction + limit, remove the limit, or kill running transactions. + + (WL #15293) +* The new field + `WRITE_CONSENSUS_SINGLE_LEADER_CAPABLE` in the + Performance Schema table + [`replication_group_communication_information`](/doc/refman/8.0/en/performance-schema-replication-group-communication-information-table.html) + shows whether the replication group supports the use of a single + consensus leader, even if + `group_replication_paxos_single_leader` is + currently set to `OFF` on the queried member. + The field is set to 1 if the group was started with + `group_replication_paxos_single_leader` set to + `ON`, and its communication protocol version is + MySQL 8.0.27 or above. + (WL #15203) +* Activating MySQL Server’s offline mode, which is done by + changing the value of the `offline_mode` system + variable to `ON`, now requires the + `CONNECTION_ADMIN` privilege in addition to the + `SYSTEM_VARIABLES_ADMIN` privilege (or the + deprecated `SUPER` privilege, which covers both + these privileges). Sessions whose users have the + `CONNECTION_ADMIN` privilege remain connected + when offline mode is activated, and users with that privilege + can make new connections to an offline server instance. The new + requirement means that administrators who can activate offline + mode cannot inadvertently lock themselves out by doing so. + (WL #13400) +* Added the read-only [`build_id`](/doc/refman/8.0/en/server-system-variables.html#sysvar_build_id) + system variable. On Linux systems, a 160-bit + `SHA1` signature is generated at compile time; + this value, converted to a hexadecimal string, provides a unique + identifier for the build. This value is written in the server + log at startup. + + This variable is not supported on platforms other than Linux. + (WL #15161) +* Added Ubuntu 22.10 support. + +### Bugs Fixed + +* **Incompatible Change:** + The service `pfs_plugin_table`, deprecated + since MySQL 8.0.14, is removed in this release. + + Plugins or components using this service must be updated to use + `pfs_plugin_table_v1` and + `pfs_plugin_column_*` + instead. + (Bug #34361827) +* **Important Change; Replication:** + Query log events filtered by the default database whenever + [`--replicate-do-db`](/doc/refman/8.0/en/replication-options-replica.html#option_mysqld_replicate-do-db) or + [`--replicate-ignore-db`](/doc/refman/8.0/en/replication-options-replica.html#option_mysqld_replicate-ignore-db) was used + included [`XA + START`](/doc/refman/8.0/en/xa-statements.html), `XA END`, `XA + COMMIT`, and `XA ROLLBACK` (but not + `XA PREPARE` or `XA COMMIT + ONE_PHASE`), regardless of the binary log format. + + This can lead to one of the issues listed here: + + + When `XA START` or `XA + END` was filtered out, the sequence of XA + statements within the first part of the transaction were + rendered invalid, which made the replica stop with an error. + + When `XA START` and `XA + END` were preserved while `XA + COMMIT` or `XA ROLLBACK` was + filtered out, then a transaction could remain in the + prepared state indefinitely on the replica. + + To prevent either of these problems from occurring, we no longer + filter `XA START`, `XA END`, + `XA COMMIT`, or `XA ROLLBACK` + statements by the default database with + `--replicate-do-db` or + `--replica-ignore-db`. + (Bug #106201, Bug #33764808) +* **InnoDB:** + After upgrading to a release that supports row versions for + columns added or dropped using + `ALGORITHM-INSTANT`, a failure occurred during + an instant `ADD COLUMN` operation on a table + with a nullable column and an instantly added column. + (Bug #34488482) +* **InnoDB:** + Adding a virtual column and dropping a column in the same + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) statement raised an + invalid debug assertion failure. + (Bug #34467592) +* **InnoDB:** + The physical position of columns were not set correctly after + dropping a column and renaming an existing column to the name of + the dropped column. + (Bug #34463089) +* **InnoDB:** + A Valgrind error detected in `mtr_t::start()` + was corrected. + (Bug #34327575) +* **InnoDB:** + A DDL operation on a corrupted partitioned table raised an + assertion failure. + (Bug #34293555) +* **InnoDB:** + An index block latch order violation during histogram sampling + blocked concurrent inserts and could cause a deadlock failure. + (Bug #34282448, Bug #34174927, Bug #107299) +* **InnoDB:** + An [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) operation executed + while a data load operation was in progress raised an assertion + failure. + (Bug #34267618) +* **InnoDB:** + `InnoDB` memory leaks during MySQL server + initialization, identified by Address Sanitizer (ASAN) builds, + were fixed. + (Bug #34156050) +* **InnoDB:** + During recovery, a tablespace object associated with encrypted + undo tablespace pages that were fetched from disk did not + contain the encryption keys required to decrypt the pages, + resulting in a failure. + (Bug #34148143) +* **InnoDB:** + In debug builds, a descending b-tree scan raised a debug + assertion failure. + (Bug #34144951) +* **InnoDB:** + The `innodb_redo_log_consumer_advance()` + function failed to handle an invalid argument. + (Bug #34052884) +* **InnoDB:** + A column added using `ALGORITHM=INSTANT` was + visible in read views created before the DDL operation that + added the column. + (Bug #33937504) +* **InnoDB:** + A failure occurred while upgrading a MySQL instance with a MySQL + 5.6 data directory containing user-created table with a + particular table ID. Assignment of that table ID resulted in + assignment of conflicting data dictionary table IDs while + upgrading from MySQL 5.7 to MySQL 8.0. + + Thanks to Rahul Malik for the contribution. + (Bug #33919635) +* **InnoDB:** + A buffer block containing intrinsic temporary table page was + relocated during page traversal, causing an assertion failure. + (Bug #33715694) +* **InnoDB:** + Dropping a table with a discarded tablespace caused an assertion + failure. + (Bug #33232978) +* **InnoDB:** + Page I/O reads not completed before shutdown reached the flush + phase caused an assertion failure in cases where pages had + change buffer merges to be completed after the I/O read. + (Bug #33192496) +* **InnoDB:** + An index latch order violation in + `dict_table_x_lock_indexes()` caused an + assertion failure. + (Bug #32912868) +* **InnoDB:** + A [`TRUNCATE TABLE`](/doc/refman/8.0/en/truncate-table.html) operation failed + to free an acquired mutex in specific cases. + (Bug #107858, Bug #34380370) +* **InnoDB:** + In debug builds, importing a tablespace without a + `.cfg` file for table with an instantly added + or dropped column raised an assertion failure. + (Bug #107517, Bug #34307874) +* **InnoDB:** + A potential memory leak in the + `trx_undo_prev_version_build()` function was + corrected. + + Thanks to Alex Xing for the contribution. + (Bug #106952, Bug #34051207) +* **InnoDB:** + A debug assertion failure occurred while redoing a space + deletion during recovery. + (Bug #103482, Bug #32819101) +* **InnoDB:** + An `InnoDB` startup message that specified the + number of object pools was removed to avoid confusion with the + number of buffer pool instances. + (Bug #80248, Bug #22653060) +* **Partitioning:** + A partitioned table was not repartitioned as expected when an + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) statement acted to + change the character set of any of its columns. The root cause + of this was that, when determining whether a change in character + set could be done as an in-place alter operation, we did not + consider whether any columns affected by the character set + change were part of the table's partitioning expression. Since + such a change might lead to a repartitioning of the table, it + could not be done in place. Now when a change in character set + is planned, we also check whether this affects any columns that + are part of a partitioning expression; if not, then we can + perform the operation in place. + (Bug #106884, Bug #34031693) +* **Replication:** + Corrected an internal error in replication information handling. + (Bug #34214416) +* **Replication:** + When a single event caused multiple updates to the same row of a + table on a replica, the change could not be applied if the + replica had a primary key on the table that did not exist in the + source. The hash-based row lookup algorithm now operates in this + situation even if a primary key is present in the replica’s + table. + (Bug #34114296) +* **Replication:** + When a single statement generated multiple write events for + different tables on a replica, extra auto-increment columns in + the replica’s tables were only cleaned up for the last event + generated. They were not cleaned up at all if the last event did + not involve a table with an extra auto-increment column. The + cleanup process now always takes place for multiple write + events. + (Bug #34095290) +* **Replication:** + A misleading error was returned to the client if the + `group_replication_force_members` system + variable was set, and the wait for the view change timed out. + The error, and associated errors, have been updated so they do + not suggest that the values given for the system variable were + incorrect. + (Bug #34091087) +* **Replication:** + The FILTER\_RULE column in the Performance Schema table + `replication_applier_filters` showed incorrect + data for filters whose rule did not exist. The table now + displays the empty string in this situation. + (Bug #33885484) +* **Replication:** + It was possible in some rare instances of flushing or + synchronization errors for the server to attempt an update of + the endpoint of the binary log using invalid values for both the + file and position within the file, leading to undefined + behavior. + + To solve this issue, we now call the internal function + `update_binlog_end_pos(binlog_file, + pos)` only when both the + file and position parameters are known to be valid. + (Bug #33818238) +* **Replication:** + Operations using the SID of a invalid GTID log event sometimes + led to undefined behavior. + + We solve this issue by ensuring that the SID is always + initialized, even when it belongs to an invalid GTID log event. + (Bug #33784022) +* **Replication:** + Calculation of the maximum length of status variables + (`MAX_SIZE_LOG_EVENT_STATUS`) was not performed + correctly. + + Issues corrected in this fix are listed here: + + + [`sql_require_primary_key`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_require_primary_key) and + [`default_table_encryption`](/doc/refman/8.0/en/server-system-variables.html#sysvar_default_table_encryption) + require 2 bytes (one for type ID, one for the variable) + + The maximum length of + [`time_zone`](/doc/refman/8.0/en/server-system-variables.html#sysvar_time_zone) was calculated as + 255 instead of `MAX_TIME_ZONE_NAME_LENGTH` + + An additional byte (each) is required to save the length of + the user variable, the number of database IDs stored in + `binlog_accessed_db_names`, and the type of + microseconds + + In addition, `master_data_written`, which was + not actually used, has been removed. + (Bug #33713071) +* **Replication:** + On 32-bit platforms, setting + [`binlog_expire_logs_seconds`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_expire_logs_seconds) to + `2147483648` + (`231`) or more had + the effect of causing all binary logs to be purged before the + specified time had elapsed. + (Bug #33670457) +* **Replication:** + If a group configuration change is in progress, new members + cannot join. The error message issued in this scenario now + states what operation is in progress, such as a primary + election, a swap between single primary mode and multi-primary + mode, or a change of group communication protocol. + (Bug #32766981) +* **Replication:** + When the binary log sender thread waited for updates with + heartbeats enabled, it sometimes missed update signals, so that + changes were not replicated until the next signal was issued and + noticed by the thread. + + Our thanks to Facebook for the contribution. + (Bug #104491, Bug #33176377) +* **Group Replication:** + The [`START REPLICA`](/doc/refman/8.0/en/start-replica.html) and + [`STOP REPLICA`](/doc/refman/8.0/en/stop-replica.html) statements were + permitted for the Group Replication applier channel + (`group_replication_applier`), but stopping and + starting the channel manually can leave online members of the + replication group incapable of committing remote transactions. + These statements can no longer be used for the channel when + Group Replication is running. + (Bug #34231291) +* **Group Replication:** + A deadlock could occur when Group Replication was started on a + server instance, but errors such as incompatible configuration + caused the member to leave immediately. The service registry now + manages the registration and deregistration of services by an + alternative process that avoids the issue. + (Bug #34194893) +* **Group Replication:** + In an InnoDB ClusterSet, in the event of a commit order deadlock + and subsequent retry, Group Replication could roll back a + transaction during certification with an error stating that the + GTID for the transaction had already been used. The error is now + only returned if the GTID has been used on the server instance + as well as in the group. + (Bug #34157846) +* **Group Replication:** + After checking a transaction commit has no conflicts and is in + the correct order, Group Replication reports back to the + committing session. When the event scheduler thread was started, + Group Replication was not able to find the committing session, + resulting in the member entering `ERROR` state + and leaving the group. The procedure to locate the committing + session was extended to find daemon threads, as used to start + the event scheduler thread. Thanks to Lou Shuai for the + contribution. + (Bug #107635, Bug #34312482) +* Calling many stored procedures from the same connection led the + server to consume an ever-increasing amount of virtual memory. + (Bug #35110491) +* When the system variable + `replication_optimize_for_static_plugin_config` + was enabled to improve performance for semisynchronous + replication, the `RAPID` plugin could not be + used in the server due to issues with notification handling. The + issue has now been fixed. + (Bug #34549470) +* Strings containing many leading zeros were incorrectly marked as + overflowing when converting them to decimal, causing the value + returned to be the maximum decimal value for the given precision + and scale. + + We fix this by replacing all leading zeros in such cases with a + single `0`, prior to conversion. + (Bug #34479194) +* Differences between the `WSAPoll` function on + Windows and the `poll()` function on Unix-like + systems caused thread pool code on Windows to consider invalid + file descriptors or sockets as ready for I/O. + (Bug #34478731) +* If a MySQL instance at MySQL 8.0.27 or above joined a + replication group running at MySQL 8.0.26, the member action + `mysql_start_failover_channels_if_primary` was + removed to match the member actions configuration for to the + rest of the group. However, if the instances were upgraded to + run at MySQL 8.0.27 or above, the member action was not + reinstated unless + `group_replication_reset_member_actions()` was + issued on a server that then bootstrapped the group. Joining + members now check if the member action + `mysql_start_failover_channels_if_primary` is + available to them, and add it to their member actions + configuration if it is. + (Bug #34464526) +* A constant expression used in the + [`SELECT`](/doc/refman/8.0/en/select.html) list of a query was not + always handled correctly by the server. + (Bug #34418412) +* Added a missing error check in + `Json_table_column::fill_column()`. + (Bug #34416304) +* Some string functions accepting multiple arguments did not + process all of the arguments properly. + (Bug #34393009) +* Columns of type [`YEAR`](/doc/refman/8.0/en/year.html) created for + temporary tables holding [`UNION`](/doc/refman/8.0/en/union.html) + results were not always guaranteed to be of the correct length. + (Bug #34370933) +* If a view (`v1`) accessed another view + (`v2`), and if `v2` was + recreated, then + [`SHOW COLUMNS FROM + v1`](/doc/refman/8.0/en/show-columns.html) reported an invalid view error. This issue could + occur only when the user was granted global privileges with + roles, but not table-level privileges. It is fixed by checking + for global privileges if table-level privileges are absent. + (Bug #34341533) +* Queries on the Performance Schema table + `replication_group_member_actions` could fail + due to conflicts between threads. The issue has now been fixed. + (Bug #34337673) +* Added a missing error check after an item evaluation when + reading const tables. + (Bug #34327798) +* Reparsing and cloning of derived tables was not always handled + correctly in certain cases. + (Bug #34317258, Bug #34408241) +* Pushing a condition down to a derived table with set operations + when multiple query blocks were present was not always handled + correctly. + (Bug #34306361) +* A startup failure during RSA key creation resulted in empty or + incomplete keys. Keys are now generated in a fail-safe manner. + (Bug #34274914) +* When comparing two string values with explicit + `COLLATE` clauses, these should have the same + collation, else the comparison should be rejected, but this was + not always enforced. + + For more information, see + [Collation Coercibility in Expressions](/doc/refman/8.0/en/charset-collation-coercibility.html). + (Bug #34274525) +* A [`CREATE USER`](/doc/refman/8.0/en/create-user.html) operation read from + binary log failed to execute on a replica server due to an + unexpected syntax error. + (Bug #34178823) +* A precision mismatch could sometimes occur in a + [`CAST`](/doc/refman/8.0/en/cast-functions.html#function_cast) to `FLOAT` + operation on an integer value, when using + `SQL_SMALL_RESULT` as opposed to + `SQL_BIG_RESULT` (see + [SELECT Statement](/doc/refman/8.0/en/select.html)). + + For `SQL_BIG_RESULT`, the value was truncated + according to the inherent precision of an IEEE 32 bit floating + point value, which is the correct behavior. With + `SQL_SMALL_RESULT`, the precision from the + original integer value was preserved; this happened because the + value was copied to a temporary table which supported only + double precision values, and these values were later copied back + to the client. + + We fix this by distinguishing the type of floating point value + when copying such values to a temporary table, so that double + precision values are stored as type double and single precision + values are stored as type float. + (Bug #34167787) +* Executed `codespell` on the majority of source + code, and fixed the reported spelling errors in the code + comments. + (Bug #34163323) +* In certain cases, when checking an internal function pointer + before it was called, the wrong pointer was validated. + (Bug #34134738) +* Both the access path and the iterator for + `eq_ref` access had a + `use_order` member for determining whether to + use an ordered index scan. Since `eq_ref` + always returns at most one row, ordering it is not necessary; + thus, `use_order` serves no purpose here, and + has been removed from the access path and the corresponding + iterator. + (Bug #34122706) +* Improved the [`ADD_GDB_INDEX`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_add_gdb_index) + **CMake** option to also function when loading + unit tests. + (Bug #34117732) + + References: See also: Bug #29925009. +* Removed GNU 'gold' linker support, including the associated + USE\_LD\_GOLD CMake option. + (Bug #34094324) +* Manually created directories in a MySQL 5.7 data directory + (treated as schema directories in MySQL 5.7) with special + characters in the directory name or schemas and tables created + with special characters in their name using a + `` `#mysql50#` `` prefix caused DDL failures after + upgrading to MySQL 8.0. In MYSQL 8.0, the special characters are + replaced with question mark characters (`?`) + when the object names are added to the data dictionary. The name + mismatch caused DDL operations on the affected objects to fail. + Upgrade now stops with an error if invalid schema and table + names are encountered. + + In MySQL 5.7, you can update invalid schema and table names to a + valid encoding using **mysqlcheck**. To identify + invalid names, run: + + ```None + mysqlcheck --check-upgrade --all-databases + ``` + + To fix invalid names, run: + + ```None + mysqlcheck --fix-db-names --fix-table-names --all-databases + ``` + + In MySQL 5.7, directory names that have special characters can + also be updated to use valid encoding using the following SQL + syntax: + + ```None + ALTER DATABASE `directory_name` UPGRADE DATA DIRECTORY NAME; + ``` + + (Bug #34066605) +* Conditions using the null-safe equals operator + ([`<=>`](/doc/refman/8.0/en/comparison-operators.html#operator_equal-to)) + can now considered by the executor as equijoin conditions. + Predicates using such conditions are not considered as equijoin + predicates, but rather as extra predicates to evaluate following + the join. + (Bug #34063499) +* Support was added for compiling the MySQL Enterprise Encryption component with + OpenSSL 3. + (Bug #34043029) +* Executed `codespell` on the source code and + fixed the reported spelling errors in the code comments. + (Bug #34006439) +* When one or more arguments to + [`GREATEST()`](/doc/refman/8.0/en/comparison-operators.html#function_greatest) were temporal values, + the order in which they were passed to the function could affect + the result. + (Bug #33996054) +* A [`SELECT`](/doc/refman/8.0/en/select.html) with a `LEFT + JOIN` on a derived table containing a nested subquery + as part of a `WHERE` clause with an + [`IN`](/doc/refman/8.0/en/comparison-operators.html#operator_in) predicate returned incorrect + results. + (Bug #33971286) +* Calls to `ERR_clear_error()` in the + `vio_ssl_write()` and + `ssl_handshake_loop()` functions caused errors + when compiling with OpenSSL 3.0. + (Bug #33967647) +* The server did not always process nested views as expected. + (Bug #33876690) +* **mysqlpump** might not be given the correct + permissions to use derived tables (tables that are generated by + a query `FROM` clause), causing the dump + process to stop if these were present. Derived tables are now + handled separately and privileges are set for them. + (Bug #33866103) +* Repeated execution of a stored routine having as a subquery a + [`SELECT`](/doc/refman/8.0/en/select.html) containing multiple + `AND`, `OR`, or + `XOR` conditions led to excessive consumption + and possibly eventual exhaustion of virtual memory. + (Bug #33852530) +* [`EXPLAIN ANALYZE`](/doc/refman/8.0/en/explain.html#explain-analyze) provides + information about the estimated cost and elapsed time for each + iterator in the query plan. We expect these numbers to be + cumulative, so that the cost (or time) for a given iterator + includes the cost of any iterators on which this iterator + depends. For example, the estimated cost of joining table + `t1` with table `t2`, using a + table scan of `t1` followed by a primary key + lookup on `t2`, should be no less than the cost + of scanning `t1` plus the cost of the + cardinality lookups on `t2`. + + For some queries involving materialization or temporary tables, + these numbers were not cumulative. In addition, cost estimates + were incorrect when materializing the result of a + [`UNION`](/doc/refman/8.0/en/union.html) operation and subsequently + performing a table scan on the temporary (materialized) table. + (Bug #33834146, Bug #34302461) +* Coercion of collations for comparisons of two string values was + dependent upon the order of the operands. Given one string using + the `utf8mb4` character set and one using + `utf8mb3`, the comparison was carried out using + the `utf8mb4` collation when the left operand + was `utf8mb4`, and `utf8mb3` + when the left operand was `utf8mb3`. + + The root of the problem was with the special handling used for + coercion of ASCII strings; since both strings were literals, + they were scanned for ASCII and non-ASCII characters, and the + repertoire property set according to this. This meant that it + was possible for one string to be treated as ASCII while the + other string was not; when the `utf8mb4` string + was considered ASCII and thus compatible with the + `utf8mb3` string it was (wrongly) converted + prior to the comparison. + + We fix this by using the internal + `MY_CS_PUREASCII` property rather than + `MY_REPERTOIRE_ASCII`; + `MY_CS_PUREASCII` is derived strictly from the + character set, and not the actual string, which makes + determination of collation deterministic. Now in such cases, + neither string is identified as ASCII, which leads to conversion + of the `utf8mb3` to `utf8mb4` + before the comparison is performed, as expected. + (Bug #33801312) +* The scope of the + [`connect_timeout`](/doc/refman/8.0/en/server-system-variables.html#sysvar_connect_timeout) limit was + extended to full-packet reads. + (Bug #33723597) + + References: See also: Bug #34574013. +* New validation was added to ensure that the Event Scheduler + restarts automatically on the server as expected. + (Bug #33711304) + + References: See also: Bug #33539082. +* When a prepared statement was executed with no cursor, it could + return the wrong result if the previous execution used a cursor. + This issue is fixed by creating and saving two query result + objects, one for use with a cursor and one for use without a + cursor. The objects are created on demand, so if a prepared + statement is never used with cursors, the cursor-specific query + result object is never created. + (Bug #33535746) +* A prepared statement with parameters could fail to update a row, + but the same statement with the same data did update the row + when issued as a query. The fix for the problem is to assign a + default data type to the parameters, although this can be + inefficient because there is no context available for data type + propagation and a character string type is given implicitly. In + this case, the best practice is to wrap such parameter + declarations in [`CAST`](/doc/refman/8.0/en/cast-functions.html#function_cast) clauses that + supply the desired data types. + (Bug #33521861) +* For a table using the FEDERATED storage engine, if consecutive + queries on the local server had a delay between them that + exceeded the remote server’s wait timeout + (`wait_timeout` setting), a packet error was + returned on the local server. The timeout error from the remote + server is now handled correctly by the local server, and it + reconnects and executes the statement again. + (Bug #33500956) +* Handled an unexpected condition which could arise during join + optimization. + (Bug #31401468) + + References: See also: Bug #34350945. +* Following execution of `SET @@character_set_client = + @@character_set_system`, optimizer hints were not + parsed correctly. + (Bug #107820, Bug #34370403) +* A query performing a full-text search in boolean mode on a + column of a [`MyISAM`](/doc/refman/8.0/en/myisam-storage-engine.html) table led to an + assertion in debug builds when the column was not of a string + type. This was due to the fact that `MyISAM` + allows `MATCH` columns without indexes in + boolean mode, and therefore also allows integer columns, which + are subject to constant propagation. Such queries on tables + using any storage engine other than `MyISAM` + were not affected by this issue. + + This is fixed by disabling constant propagation on the + `MATCH` clause when the column is not of a + string type, so that we can safely assume that it contains only + column references. + (Bug #107638, Bug #34311472) +* Corrected errors in comments in `my_time.cc`. + Our thanks to Dimitry Kudryavtsev for the contribution. + (Bug #107633, Bug #34308417) +* Following changes to connection error handling in MySQL 8.0.24, + if an error such as exceeding + `max_allowed_packet` caused the + **mysql** client to disconnect from the server, + the error was not reset afterwards to indicate the disconnect. + On subsequent queries, the original error was returned, and + automatic reconnection did not take place because the + **mysql** client did not have a disconnection + error. The error is now reset to indicate disconnection and + allow clients to reconnect. + (Bug #107605, Bug #34303841) +* Following a bug fix in MySQL 8.0.29, if the password was + provided in an option file, the **mysql** client + did not prompt for a password if the `-p` + option was specified at login. The client now always prompts for + a password when the `-p` option is specified + and uses the specified password, even if an alternative was + populated from an option file. + (Bug #107205, Bug #34134984) +* The alternative for the deprecated `--ssl=off` + server option to disable the use of encrypted connections was + not working as documented, or as presented in the deprecation + warning. Setting the `tls_version` system + variable to the empty value (`tls_version=''`) + now works correctly for this purpose. + (Bug #106459, Bug #33858646) +* An aggregate query on a [`BIT`](/doc/refman/8.0/en/bit-type.html) + column returned a value that was formatted as a bit string, but + also had the `BINARY` flag added automatically. + New validation now checks for and skips setting the + `BINARY` flag for + [`BIT`](/doc/refman/8.0/en/bit-type.html) results. + (Bug #106241, Bug #33781442) +* `SHOW SLAVE STATUS` and `SHOW SLAVE + HOSTS` used more CPU following the introduction of + `SHOW REPLICA STATUS` and `SHOW REPLICA + HOSTS` than previously. + (Bug #105924, Bug #33684069) +* When a [`NO_SKIP_SCAN`](/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-index-level) hint + referred to a specific index not to be used for a table skip + scan, all other possible indexes were also ignored, and, thus, a + skip scan was not used for any indexes on the table. + + This occurred because processing was not performed for all + possible keys for a skip scan if the + `NO_SKIP_SCAN` hint was not applicable to all + indexes. + (Bug #104670, Bug #33251616) +* Queries using `WHERE column + IN (list)` took an + increasingly excess amount of CPU time as the list of values + grew in length. + (Bug #102037, Bug #32311183) diff --git a/corpus/changelog/mysql_releases/mysql_8032.md b/corpus/changelog/mysql_releases/mysql_8032.md new file mode 100644 index 0000000000000000000000000000000000000000..d62c44a76f11c3306ba86097d62a3e20576356db --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8032.md @@ -0,0 +1,1033 @@ +# MySQL 8.0.32 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-32.html +Version: 8.0.32 + +## Changes in MySQL 8.0.32 (2023-01-17, General Availability) + +* [Authentication Notes](news-8-0-32.html#mysqld-8-0-32-authentication "Authentication Notes") +* [C API Notes](news-8-0-32.html#mysqld-8-0-32-capi "C API Notes") +* [Compilation Notes](news-8-0-32.html#mysqld-8-0-32-compiling "Compilation Notes") +* [Deprecation and Removal Notes](news-8-0-32.html#mysqld-8-0-32-deprecation-removal "Deprecation and Removal Notes") +* [Generated Invisible Primary Keys (GIPKs)](news-8-0-32.html#mysqld-8-0-32-gipk "Generated Invisible Primary Keys (GIPKs)") +* [Keyring Notes](news-8-0-32.html#mysqld-8-0-32-keyring "Keyring Notes") +* [Pluggable Authentication](news-8-0-32.html#mysqld-8-0-32-pluggable-auth "Pluggable Authentication") +* [Spatial Data Support](news-8-0-32.html#mysqld-8-0-32-spatial-support "Spatial Data Support") +* [SQL Syntax Notes](news-8-0-32.html#mysqld-8-0-32-sql-syntax "SQL Syntax Notes") +* [Thread Pool Notes](news-8-0-32.html#mysqld-8-0-32-thread-pool "Thread Pool Notes") +* [Functionality Added or Changed](news-8-0-32.html#mysqld-8-0-32-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-32.html#mysqld-8-0-32-bug "Bugs Fixed") + +### Authentication Notes + +* The server could return `LDAP_OPERATIONS_ERROR` + for LDAP authentication failures, rather than only for actual + LDAP server errors such as when an AD domain is not accessible. + Now, the server returns + `LDAP_AUTHENTICATION_ERROR`, a MySQL-specific + error code, to indicate authentication errors. + (Bug #100333, Bug #31680279) + +### C API Notes + +* The `sha256_password_auth_client_nonblocking()` + function always returned an error, even when the public key was + available. (See the MySQL Server Doxygen documentation, + available at [https://dev.mysql.com/doc/index-other.html](/doc/index-other.html).) Our + thanks to Facebook for the several fixes in this patch. + (Bug #34556764) + +### Compilation Notes + +* **Microsoft Windows:** + The `authentication_ldap_sasl` server plugin is + no longer built for Windows as only the client is supported for + SASL-based LDAP authentication. + (Bug #34448155) +* On Windows, compiling MySQL server using VS 2022 would emit an + error about two projects named "parser-t" if tests and the NDB + storage engine were enabled. The tests were renamed to avoid + conflict on case-insensitive operating systems. + (Bug #34790413) +* On MacOS, silenced deprecation warnings generated by Xcode 14; + this includes suggestions to use `snprintf(3)` + instead of `sprintf(3)`, and warnings about + possible loss of precision when converting from 64-bit to 32-bit + integers. + (Bug #34776172) +* Removed the boost library usage from the plugins. + (Bug #34694419) +* Removed all 3rd party files named + '`Makefile`' as they were not used. + (Bug #34648199) +* Added clang 15 support. + (Bug #34638573) +* Located and removed unused code; located it using fastcov. + (Bug #34583577) +* Improved code related to building the ndbcluster plugin by + fixing warnings generated with 'gcc 11.2.0 RelWithDebInfo on + Ubuntu 22.04' and 'gcc 8.3.1 on el6'. + (Bug #34384889) +* Now use full file paths for the Bison and Flex source files to + help simplify debugging and gcov reports. + (Bug #109022, Bug #34776151) +* Building MySQL would fail if the building user lacked access to + the **mysqld** temporary directory. Now + `--no-defaults` is used when creating the + `INFO_BIN` file. + (Bug #108947, Bug #34756282) + +### Deprecation and Removal Notes + +* Use of the dollar sign (`$`) as the first + character of an unquoted identifier is now deprecated, raises a + warning + ([`ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_warn_deprecated_syntax_no_replacement)), + and is subject to removal in a future release. + + This affects statements using such an identifier for the name of + any database, table, view, column, stored program, or alias. + Identifiers beginning with a dollar sign are still permitted + only when they are quoted—that is, delimited by single or + double quote marks (`'` or + `"`), or by backtick characters + (`` ` ``), depending on the server SQL mode. + *Example*: + + ```None + mysql> TABLE $t; # Unquoted, produces warning + +------+ + | a | + +------+ + | 1 | + | 2 | + +------+ + 2 rows in set, 1 warning (0.00 sec) + + mysql> SHOW WARNINGS\G + *************************** 1. row *************************** + Level: Warning + Code: 1681 + Message: '$ as the first character of an unquoted identifier' is deprecated and + will be removed in a future release. + 1 row in set (0.00 sec) + + mysql> TABLE `$t`; # Quoted, no warning + +------+ + | a | + +------+ + | 1 | + | 2 | + +------+ + 2 rows in set (0.00 sec) + ``` + + User variables are not affected by this change. For example, the + statement `SELECT 1 INTO @$x` does not produce + a warning. + + See [Schema Object Names](/doc/refman/8.0/en/identifiers.html), for more information. + (Bug #34785775, WL #15422) + + References: See also: Bug #34684193. +* The `CLIENT_NO_SCHEMA` flag is deprecated. + Client programs that specify `CLIENT_NO_SCHEMA` + as the `client_flag` argument to + [`mysql_real_connect()`](/doc/c-api/8.0/en/mysql-real-connect.html) can now + omit the flag and the `db` argument to have the + connection set the database value to the current (or default) + database. The `libmysqlclient` library now + prints a warning on standard error when + [`mysql_real_connect()`](/doc/c-api/8.0/en/mysql-real-connect.html) is called + with `CLIENT_NO_SCHEMA`. In addition, the + server adds a deprecation warning for every non-prepared query + executed, if the connection has + `CLIENT_NO_SCHEMA`. + (WL #13128) +* Previously, legacy compression-control parameters were + deprecated and replaced with new configuration parameters for + greater control over the use of compression in connections to + the server. The new and deprecated parameters are: + + + The [`--compression-algorithms`](/doc/refman/8.0/en/connection-options.html#option_general_compression-algorithms) + client option enables deprecation of the legacy + [`--compress`](/doc/refman/8.0/en/connection-options.html#option_general_compress) client option and + the [`Compression`](/doc/refman/8.0/en/server-status-variables.html#statvar_Compression) status + variable. + + The `MYSQL_OPT_COMPRESSION_ALGORITHMS` C + API option enables deprecation of the legacy + `MYSQL_OPT_COMPRESS` C API option. + + The `MASTER_COMPRESSION_ALGORITHMS` option + for the [`CHANGE MASTER TO`](/doc/refman/8.0/en/change-master-to.html) + statement enables deprecation of the legacy + [`slave_compressed_protocol`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_slave_compressed_protocol) + system variable. + + The deprecated parameters will be removed in a future MySQL + version. + + Now, the following client programs print a deprecation warning + to standard error when a client user invokes one of the programs + with [`--compress`](/doc/refman/8.0/en/connection-options.html#option_general_compress) (or + `-C`, if applicable): + **mysqlpump**, **mysqlcheck**, + **mysql**, **mysqladmin**, + **mysqlbinlog**, **mysqldump**, + **mysqlimport**, **mysqlshow**, + **mysqlslap**, **mysql\_upgrade**, + and mysqltest. + + The **mysqlbackup** + [`--compress`](/doc/refman/8.0/en/connection-options.html#option_general_compress) option has different + capabilities and is not deprecated. + (WL #13292) + +### Generated Invisible Primary Keys (GIPKs) + +* **Replication:** + It is now possible to cause a replica to add a generated + invisible primary key to any [`InnoDB`](/doc/refman/8.0/en/innodb-storage-engine.html) + table that otherwise, as replicated, has no primary key. This is + implemented by adding `GENERATE` as a possible + value for the [`CHANGE REPLICATION SOURCE + TO`](/doc/refman/8.0/en/change-replication-source-to.html) statement's + `REQUIRE_TABLE_PRIMARY_KEY_CHECK` option. + + `REQUIRE_TABLE_PRIMARY_KEY_CHECK = GENERATE` + can be used on a per-channel basis. Suppose the replica is + configured with two replication channels, named + `ch1` and `ch2`, and you + execute the statements shown here: + + ```None + STOP REPLICA; + + SET @@sql_require_primary_key = ON; + + CHANGE REPLICA SOURCE TO + REQUIRE_TABLE_PRIMARY_KEY_CHECK = GENERATE + FOR CHANNEL ch1; + + START REPLICA; + ``` + + The effect of these statements is that the replica now adds an + invisible primary key for tables whose creation is replicated by + channel `ch1`, but does not do so for any + keyless table that is created in the context of + `ch2`. + + A replica ignores any setting for + [`sql_generate_invisible_primary_key`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_generate_invisible_primary_key) + that has been made on the source, and this variable is not + replicated. (This behavior is unchanged from previous releases.) + + `REQUIRE_TABLE_PRIMARY_KEY_CHECK = GENERATE` is + not compatible with MySQL Group Replication, where + `ON`, `OFF`, and + `STREAM` are the only supported values for this + option. + + See [CHANGE REPLICATION SOURCE TO Statement](/doc/refman/8.0/en/change-replication-source-to.html), and + [Generated Invisible Primary Keys](/doc/refman/8.0/en/create-table-gipks.html), for further information. + (WL #15419) + +### Keyring Notes + +* Host names of endpoints specified in + `component_keyring_oci` configuration files, + and obtained from the Oracle Cloud Infrastructure Console or by querying the Oracle Cloud Infrastructure + API, now can retain the `https://` prefix that + previously had to be removed when generating a MySQL + configuration for the Oracle Cloud Infrastructure Vault keyring component. + (Bug #34636297) + +### Pluggable Authentication + +* On Windows, the client-side Kerberos authentication plugin now + supports GSSAPI through the MIT Kerberos library. It is possible + to choose between SSPI and GSSAPI at runtime using a new plugin + option supported by the + `authentication_kerberos_client` authentication + plugin on Windows. Client users invoke **mysql** + or **mysqldump** with the + `--plugin-authentication-kerberos-client-mode` + command-line option to set the mode to GSSAPI. The default mode + of the `authentication_kerberos_client` plugin + is SSPI, previously the only authentication method on Windows. + + For more information, see Connection Commands for Windows + Clients in GSSAPI Mode. + (WL #15336) + +### Spatial Data Support + +* The MySQL [`ST_Transform()`](/doc/refman/8.0/en/spatial-operator-functions.html#function_st-transform) function + now supports all Cartesian projections, with the exceptions of + EPSG 1042 (Krovak Modified), EPSG 1043 (Krovak Modified (North + Orientated)), EPSG 9816 (Tunisia Mining Grid), and EPSG 9826 + (Lambert Conic Conformal (West Orientated)). + (Bug #27272733, Bug #34495023, WL #15164) + +### SQL Syntax Notes + +* **Important Change:** + Previously, MySQL supported the use of “full” as + the name of a table, column, view, stored procedure, or stored + function, as well as for the alias of a table, view, or column. + Beginning with this release, using “full” + (regardless of letter case) in this fashion as an unquoted + identifier is now deprecated, and raises a warning. This is to + align more closely with the SQL standard, in which + `FULL` is reserved as a keyword. + + For example, the following [`CREATE + TABLE`](/doc/refman/8.0/en/create-table.html) and [`DROP TABLE`](/doc/refman/8.0/en/drop-table.html) + statements now raise warnings, as shown here: + + ```None + mysql> CREATE TABLE full (c1 INT, c2 INT); + Query OK, 0 rows affected, 1 warning (0.03 sec) + + mysql> SHOW WARNINGS\G + *************************** 1. row *************************** + Level: Warning + Code: 4119 + Message: Using FULL as unquoted identifier is deprecated, please use quotes or + rename the identifier. + 1 row in set (0.00 sec) + + mysql> DROP TABLE full; + Query OK, 0 rows affected, 1 warning (0.01 sec) + + mysql> SHOW WARNINGS\G + *************************** 1. row *************************** + Level: Warning + Code: 4119 + Message: Using FULL as unquoted identifier is deprecated, please use quotes or + rename the identifier. + 1 row in set (0.00 sec) + ``` + + To execute the statements without the warnings, encase the table + name in each of them with backtick characters + (`` ` ``), like this: + + ```None + mysql> CREATE TABLE `full` (c1 INT, c2 INT); + Query OK, 0 rows affected (0.03 sec) + + mysql> DROP TABLE `full`; + Query OK, 0 rows affected (0.02 sec) + ``` + + The use of `FULL` in the right hand side of a + value assignment is *not* affected by this + change. For example, the [`SET`](/doc/refman/8.0/en/set.html) + statement shown here remains valid: + + ```None + mysql> SHOW VARIABLES LIKE '%metadata%'; + +---------------------------------------+---------+ + | Variable_name | Value | + +---------------------------------------+---------+ + | binlog_row_metadata | MINIMAL | + | innodb_stats_on_metadata | OFF | + | performance_schema_max_metadata_locks | -1 | + | resultset_metadata | FULL | + +---------------------------------------+---------+ + 4 rows in set (0.00 sec) + + mysql> SET @@global.binlog_row_metadata=FULL; + Query OK, 0 rows affected (0.00 sec) + + mysql> SHOW VARIABLES LIKE '%metadata%'; + +---------------------------------------+-------+ + | Variable_name | Value | + +---------------------------------------+-------+ + | binlog_row_metadata | FULL | + | innodb_stats_on_metadata | OFF | + | performance_schema_max_metadata_locks | -1 | + | resultset_metadata | FULL | + +---------------------------------------+-------+ + 4 rows in set (0.00 sec) + ``` + + For more information, see [Keywords and Reserved Words](/doc/refman/8.0/en/keywords.html). + (WL #15241) +* It is now possible to set the default format for the output of + any + [`EXPLAIN`](/doc/refman/8.0/en/explain.html#explain-execution-plan) + statement which obtains a query execution plan, and which has no + `FORMAT` option, using the + [`explain_format`](/doc/refman/8.0/en/server-system-variables.html#sysvar_explain_format) system variable + added in this release. Like the `FORMAT` + option, this variable can take any of the values + `TRADITIONAL`, `JSON`, or + `TREE`. `DEFAULT` is also + supported as a synonym for `TRADITIONAL`. + (`DEFAULT` is *not* + supported with the `FORMAT` option for + `EXPLAIN`.) Suppose the value of + `explain_format` is `TREE`; in + this case, the output from any such `EXPLAIN` + statement uses the tree-based format, as though + `FORMAT=TREE` had been specified as part of the + `EXPLAIN` statement. + + Any value set for `explain_format` is + overridden by a `FORMAT` option. This means + that, if *`explain_format`* is set to + *`TREE`*, supplying + `FORMAT=JSON` when invoking + `EXPLAIN` causes the value of + `explain_format` to be ignored, and the result + is displayed using the `JSON` format. + + `explain_format` also affects the behavior of + [`EXPLAIN ANALYZE`](/doc/refman/8.0/en/explain.html#explain-analyze); since this + statement supports only the `TREE` format, if + the value of explain\_format is not `TREE`, this + means that any `EXPLAIN ANALYZE` statement that + does not specify the `TREE` format explicitly + raises the error This version of MySQL doesn't yet + support 'EXPLAIN ANALYZE with *`format`* + format'. + + The new system variable has both global and session scope, can + be persisted, and can be set from the command line (as + `--explain-format`) or in a + `my.cnf` option file. + + See the description of + [`explain_format`](/doc/refman/8.0/en/server-system-variables.html#sysvar_explain_format). See also + [Obtaining Execution Plan Information](/doc/refman/8.0/en/explain.html#explain-execution-plan), and + [Obtaining Information with EXPLAIN ANALYZE](/doc/refman/8.0/en/explain.html#explain-analyze), for further information and + examples. + (WL #15040) + + References: See also: Bug #33629360. + +### Thread Pool Notes + +* Whenever a connection was terminated due to inactivity, the + thread pool plugin printed only a generic message about + connections timing out; this often made analysis of such + timeouts more difficult than necessary. A new + `INFO_LEVEL` message makes it clear that a + connection has been terminated due to inactivity in the thread + pool, as well as which timeout value was used to make this + determination. + (Bug #34767607) +* Two columns added to the Performance Schema + [`tp_thread_state`](/doc/refman/8.0/en/performance-schema-tp-thread-state-table.html) table in this + release make it possible to identify a thread's type, and to map + threads in this table to those in the Performance Schema + [`threads`](/doc/refman/8.0/en/performance-schema-threads-table.html) table. The type of thread + is now shown in the `tp_thread_state` table's + `TP_THREAD_TYPE` column, and the thread's + unique ID in the `THREAD_ID` column. For more + information, see + [The tp\_thread\_state Table](/doc/refman/8.0/en/performance-schema-tp-thread-state-table.html). + (Bug #34020058) + +### Functionality Added or Changed + +* **Important Change:** + For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 1.1.1s. Issues fixed in OpenSSL version 1.1.1s are described at + . + (Bug #34828308) +* Binary packages that include curl rather than linking to the + system curl library have been upgraded to use curl 7.86.0. + (Bug #34828111) +* The internal resource-group enhancement added in MySQL 8.0.31 is + refactored, but it continues to support the + [`Resource_group_supported`](/doc/refman/8.0/en/server-status-variables.html#statvar_Resource_group_supported) + status variable. + (Bug #34702833, Bug #34699751) + + References: Reverted patches: Bug #34264356. + +### Bugs Fixed + +* **Important Change:** + The implementation of the + [`max_join_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_join_size) system variable, + although documented as a maximum number of rows or disk seeks, + did not check the number of rows or disk seeks directly, but + instead treated `max_join_size` as the maximum + estimated cost to permit. While cost and row count are + correlated, they are not the same, and this could lead to + unexpected results when some large queries were allowed to + proceed. + + In this release, we change how `max_join_size` + is used, so that it now actually limits the maximum number of + row accesses in base tables. If the estimate indicates that a + greater number of rows must be read from the base tables, an + error is raised. This makes the actual behavior better reflect + what is documented. + (Bug #83885, Bug #25118903) +* **InnoDB:** + Undetectable problems after upgrade from 8.0.28, crash and + corruption. + + Any new row inserted after upgrade will have all columns added + with `ALGORITHM=INSTANT` materialized and have + version=0. + + In the new implementation, a column added with + `ALGORITHM=INSTANT` will fail if the maximum + possible size of a row exceeds the row size limit. So new rows + with materialized `ALGORITHM=INSTANT` columns + will always be within row size limit. + (Bug #34558510) +* **InnoDB:** + No more garbled UTF characters in SHOW ENGINE INNODB STATUS + (Bug #34486877, Bug #108111) +* **InnoDB:** + Alter handler adjusted so that adding more than 1024 columns + with `ALGORITHM=INSTANT` no longer causes a + crash. + (Bug #34378513, Bug #107854) +* **InnoDB:** + After a column added with `ALGORITHM=INSTANT`, + an online rebuild DDL no longer crashes. + (Bug #33788578, Bug #106279) +* **InnoDB:** + Several adaptive hash index (AHI) code optimizations and + improvements were implemented, addressing various issues + including potential race conditions. + (Bug #33601434) +* **Replication:** + When `SOURCE_HEARTBEAT_PERIOD` was set to a + very small value (such as 1 microsecond) on the server using + [`CHANGE REPLICATION SOURCE TO`](/doc/refman/8.0/en/change-replication-source-to.html), and + the **mysqlbinlog** client program was started + with + [`--read-from-remote-server`](/doc/refman/8.0/en/mysqlbinlog.html#option_mysqlbinlog_read-from-remote-server) + and [`--stop-never=1`](/doc/refman/8.0/en/mysqlbinlog.html#option_mysqlbinlog_stop-never), it was + possible for the binary log dump thread to send an + `EOF` packet to the client before all events + had been sent. + (Bug #34860923) +* **Replication:** + Removed an assert from + `sql/rpl_group_replication.cc` which + triggered a false error in testing. + (Bug #34619134) +* **Replication:** + After MySQL was started with + [`--server-id=0`](/doc/refman/8.0/en/replication-options.html#sysvar_server_id), trying to change + the server ID by using + [`SET + PERSIST server_id=N`](/doc/refman/8.0/en/set-variable.html#set-variable-system-variables) (where + N is an integer greater than zero) and restarting the server had + the following results: + + + [`SELECT + @@server_id`](/doc/refman/8.0/en/select.html) returned *`N`*. + + Any replication SQL statement such as + [`START REPLICA`](/doc/refman/8.0/en/start-replica.html) was rejected + with [`ER_SLAVE_CONFIGURATION`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_slave_configuration). + + To fix this problem, we now ensure that such checks use the + value of the server variable rather than the value passed to the + startup option. + (Bug #34412816) +* **Replication:** + When replicating compressed binary log events generated by the + [`NDB`](/doc/refman/8.0/en/mysql-cluster.html) binary log injector, relay log + positions were not updated in the multithreaded applier, thus + causing replication to hang. + (Bug #33889030) + + References: See also: Bug #33784241. +* **Replication:** + Issuing [`STOP + REPLICA SQL_THREAD`](/doc/refman/8.0/en/stop-replica.html) while the SQL thread was handling a + transaction caused replication to stop immediately, instead of + waiting 60 seconds for the event group to complete before + shutting down the SQL thread as expected. + + The root cause of this issue was due to the internal variable + storing the last event start time not being reset after the SQL + thread was restarted. + + We fix this by resetting the variable holding the last event + start time whenever the SQL thread is started. + (Bug #33646899) +* **Replication:** + While their wording might imply otherwise, the log messages + `Setting super_read_only=ON` + ([`ER_GRP_RPL_SUPER_READ_ON`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_grp_rpl_super_read_on)) and + `Setting super_read_only=OFF` + ([`ER_GRP_RPL_SUPER_READ_OFF`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_grp_rpl_super_read_off)) were + written only after the operations were attempted, and not + beforehand, or while the operations were ongoing. This sometimes + led to confusion when setting the variable was rejected, and + this was logged prior to the set attempt itself being logged. To + keep this from happening, these messages are now logged just + prior to attempting the operation. + (Bug #108843, Bug #34728079) +* **Replication:** + The [`relay_log_space_limit`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_relay_log_space_limit) + system variable is a 64-bit value, but its valid maximum was + specified internally as that of a 32-bit value. + (Bug #106323, Bug #33799840) +* **Replication:** + Eliminated an unnecessary update of the + `gtid_executed` table which was performed when + rotating the binary logs. + (Bug #106116, Bug #33759477) +* **Group Replication:** + The `WRITE_CONSENSUS_SINGLE_LEADER_CAPABLE` + column of the MySQL Performance Schema's + [`replication_group_communication_information`](/doc/refman/8.0/en/performance-schema-replication-group-communication-information-table.html) + table reflects the runtime value of a Paxos Single Leader setup + in a group, letting users know what the value of + [`group_replication_paxos_single_leader`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_paxos_single_leader) + must be on joining members. + + A group that was bootstrapped with single-leader enabled but + with its protocol version downgraded to one that did not support + it reported + `WRITE_CONSENSUS_SINGLE_LEADER_CAPABLE` equal + to `0`, as expected, but attempting to join an + instance to the group using + `group_replication_paxos_single_leader = 0` was + not possible. + + To solve this problem, we change the behaviour and make the + value of + `group_replication_paxos_single_leader` + consistent with the communication version that the group is + running. Since this variable was introduced in MySQL 8.0.27, it + is not known or used in any previous version, and so we now + enforce the following rules: + + + When a node tries to join a group that is running MySQL + 8.0.26 or earlier and we are version 8.0.27 or later, we + reject the attempt with an error stating that + `group_replication_paxos_single_leader` + must be `OFF` before joining the group + + When we try to use + [`group_replication_set_communication_protocol()`](/doc/refman/8.0/en/group-replication-functions-for-communication-protocol.html#function_group-replication-set-communication-protocol) + to set a version less than 8.0.27 and we are of version + 8.0.27 or later, we reject the function call if + `group_replication_paxos_single_leader` is + not `OFF`. + + In addition, we also change the value checked to determine + whether changing the group leader is allowed after running + `group_replication_set_communication_protocol()`. + Previously, this was the runtime value of + `group_replication_paxos_single_leader`, which + takes effect only after a group reboot. Instead, when we run + `group_replication_set_communication_protocol()`, + we now use the value shown by the + `replication_group_communication_information` + table's `WRITE_CONSENSUS_SINGLE_LEADER_CAPABLE` + column, described previously. + (Bug #34555045, Bug #34828311) +* **Group Replication:** + In a 3 node cluster, all nodes were killed due to running out of + memory. Subsequently, after all nodes were restarted + successfully, attempting to bring the cluster back online caused + the node that had been the primary to hang. + + For more information, see [Rebooting a Cluster from a Major Outage](/doc/mysql-shell/8.0/en/reboot-outage.html). + (Bug #108339, Bug #34564856) +* **Group Replication:** + When a group was run with + [`group_replication_consistency = + AFTER`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_consistency) and a secondary failed due to external + conditions such as an unstable network, the secondary could + sometimes encounter the error Transaction 'GTID' does + not exist on Group Replication consistency manager while + receiving remote transaction prepare. + + The root cause of this issue was that the primary might log out + of order the `View_change_log_event` with which + the secondary rejoined; when the secondary used the primary as + the group donor, this could cause the secondary to catch up with + the group improperly and, eventually, generate incorrect GTIDs + for the group transactions. The group replication primary + ensures that the `View_change_log_event` is + logged after all preceding transactions, but there was a window + during which transactions ordered after the + `View_change_log_event` on the group global + order could be logged before the event. + + To solve this issue, we now make sure that transactions ordered + before a view are always logged before the + `View_change_log_event`, and that transactions + ordered after a view are always logged after this event. This is + now done by the binary log ticket manager, which guarantees the + order in which transactions in the binary log group commit are + committed. + (Bug #104980, Bug #33405699) + + References: See also: Bug #34746357. +* **Microsoft Windows:** + When compiling MySQL on Windows platforms, the CMake + [`-DWITH_WIN_JEMALLOC`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_win_jemalloc) option was not + always handled correctly. + (Bug #108341, Bug #34698376) +* **JSON:** + While saving the result of + [`JSON_ARRAYAGG()`](/doc/refman/8.0/en/aggregate-functions.html#function_json-arrayagg) or + [`JSON_OBJECTAGG()`](/doc/refman/8.0/en/aggregate-functions.html#function_json-objectagg) in a column, the + data type information was lost due to the result being an item + of type `SUM_FUNC_ITEM`. To fix this, we remove + the type check and this way retain the original type + information. + (Bug #108326, Bug #34548259) +* Some remote connections to the server were not handled + correctly. This issue arose as the result of a previous fix for + an issue with + [`require_secure_transport`](/doc/refman/8.0/en/server-system-variables.html#sysvar_require_secure_transport). + (Bug #34857411) + + References: This issue is a regression of: Bug #34094706. +* Some query plans were not stable due to nondeterministic sorting + of `Key_use_array` in + `sql_optimizer.cc`; now we sort it with + `std::stable_sort()` instead of + `std::sort()`. + (Bug #34823952) + + References: This issue is a regression of: Bug #25965593. +* Binary packages that include OpenLDAP rather than linking to the + system OpenLDAP library were upgraded to use version 2.5.13. + (Bug #34815046) +* In some cases, an unexpected packet sent by the server to a + MySQL client program during authentication could result in an + infinite loop. + (Bug #34805922) +* GIS data was not always handled correctly in windowing + functions. + (Bug #34778646) +* A thread remained bound to the CPU of a dropped resource group + even after it was assigned to the user default resource group + (`USR_default`). `USR_default` + has 0 CPU priority and no CPU affinity, so with this fix, the + thread now is able to run any CPU with + `USR_default`. + (Bug #34748973) +* With JSON logging enabled, calling the + [`audit_log_rotate()`](/doc/refman/8.0/en/audit-log-reference.html#function_audit-log-rotate) function did + not rotate the file as expected. A rotated file name consists of + the timestamp from the last event logged into the file. When the + file is empty, last timestamp is the same as the timestamp in + the already created file. To fix this issue, the function now + uses the current time to name the file if the file is empty. + (Bug #34733508) +* Some queries having multiple lateral derived tables did not + produce the expected result. + (Bug #34716246) +* The bundled zlib library has been upgraded to zlib 1.2.13; zlib + 1.2.13 is now the minimum zlib version supported. + (Bug #34711762, Bug #34711758) +* Certain [`INTERSECT`](/doc/refman/8.0/en/intersect.html) queries were + not handled correctly. + (Bug #34642435) +* Using the [`MAX_EXECUTION_TIME`](/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-execution-time) + optimizer hint with a value greater than the stated maximum kept + an upgrade to MySQL 8.0.30 from completing; this caused the + server to report a warning which was interpreted by the upgrade + process as an unrecoverable error. + (Bug #34607401) +* In certain cases, evaluation of window functions was not + performed correctly. + (Bug #34572136) + + References: This issue is a regression of: Bug #32644631, Bug #32802301. +* Some CTEs were not processed correctly. + (Bug #34572040, Bug #34634469) + + References: This issue is a regression of: Bug #33856374. +* Values returned from functions or operators that convert a value + to [`FLOAT`](/doc/refman/8.0/en/floating-point-types.html) + ([`CAST(... AS FLOAT)`](/doc/refman/8.0/en/cast-functions.html#function_cast), + [`CONVERT(..., FLOAT)`](/doc/refman/8.0/en/cast-functions.html#function_convert), + [`JSON_VALUE(... RETURNING FLOAT))`](/doc/refman/8.0/en/json-search-functions.html#function_json-value) + may have extra precision in their internal representation, since + they are stored in double precision internally. This sometimes + caused unexpected results when checking such values for + equality, such as [`SELECT + DISTINCT`](/doc/refman/8.0/en/select.html) returning duplicates and comparison operators + incorrectly reporting two equal values as unequal. + + We fix this problem by stripping off the extra double precision + from the values before returning them, and by making any + conversion from float to string in these conversion operators + use float format instead of double format. + (Bug #34554755) +* Removed an assertion in + `query_expression::assert_not_fully_clean()`. + (Bug #34526104) +* Upgrading from MySQL 5.7 to MySQL 8.0 with a very large number + of tables in a single database caused the server to consume + excessive memory. It was found that, during the process of + checking whether tables could be upgraded, we fetched all the + data dictionary `Table` objects upfront, + processing each and fetching its name, then performed + [`CHECK + TABLE ... FOR UPGRADE`](/doc/refman/8.0/en/check-table.html#check-table-version-compatibility) on the list. Fetching all + objects beforehand was not necessary in this case, and + contributed greatly to memory consumption. + + To correct this problem, we now fetch one + `Table` object at a time in such cases, + performing any required checks, fetching its name, and releasing + the object, before proceeding with the next one. + (Bug #34526001) +* When creating natural join columns, a hidden column added as + part of a materialized derived table is used in constructing the + join condition, which is later used to check whether the join + eligible for pushdown to derived tables. The current issue arose + when this column was not retrieved from the derived table due to + it being hidden; this occurred even when the condition pushdown + optimization was not enabled. We solve this problem by rejecting + all hidden columns added internally, and not merely for hidden + columns added for functional indexes. + (Bug #34523627) +* Types were not derived consistently from user variables. This + could be seen, for example, by executing the following + statements repeatedly: + + ```None + CREATE TABLE t AS SELECT @max_error_count UNION SELECT 'a'; + + SHOW CREATE TABLE t; + ``` + + In this particular case, the output of the + [`SHOW CREATE TABLE`](/doc/refman/8.0/en/show-create-table.html) statement + showed `` `@max_error_count` text `` the first + time, and `` `@max_error_count` mediumblob `` in + successive iterations. (The second is correct.) + (Bug #34523475) +* Following work done in MySQL 8.0.23 to improve host resolution + for user accounts, the time needed for + [`CREATE USER`](/doc/refman/8.0/en/create-user.html) to complete increased + significantly, particularly when running many such statements in + close succession. + + Prior to upgrading to this release, you can work around this + issue when issuing many such statements in succession by + preceding them with a single `CREATE USER 'fakeuser' + ACCOUNT LOCK` (you can use any user name that does not + conflict with existing ones for this). When finished, you can + (and should) clean up by issuing the following statements: + + ```None + DROP USER 'fakeuser'; + FLUSH PRIVILEGES; + ``` + + For more information, see [Access Control, Stage 1: Connection Verification](/doc/refman/8.0/en/connection-access.html). + (Bug #34449016) +* The `data_masking` server-side plugin could + emit a runtime error and halt unexpectedly. + (Bug #34445632) +* Stack overruns could be erroneously reported when using the + thread pool under heavy load. The race condition causing this in + the thread pool has been avoided with an additional thread group + ID check. + (Bug #34414959) +* When merging a derived table, a nested join condition is added + to the derived table and the underlying tables are added to this + join nest. In addition, the join condition is associated with + the derived table. + + Evaluation for range access is skipped if the table is an inner + table of an outer join or if the table is an inner table and the + join is not a semijoin. For a derived table, the underlying base + table was treated as being of the latter kind, range analysis + was skipped, and the range access method was thus unavailable. + + To fix this problem, we now evaluate for range access when the + embedding table is a derived table, and ensure that the join + condition associated with the derived table is used for the + range optimization. + (Bug #34347116) +* A [`LOAD DATA + INFILE`](/doc/refman/8.0/en/load-data.html) statement issued with a subquery could cause + the server to return an incorrect warning (`Subquery + returns more than 1 row`). + (Bug #34336033) +* Improved handling of resource allocation for internal temporary + tables. + (Bug #34174001) +* A specific column added after a drop using the + `INSTANT` algorithm could cause a data error + and a server exit. + (Bug #34122122) +* A query such as `SELECT 1 AS one FROM t WHERE 1=(SELECT + 1 UNION SELECT 2)` is transformed to this: + + ```None + SELECT 1 AS one + FROM t + JOIN ( SELECT 1 AS col1 UNION SELECT 2) derived + WHERE 1 = derived.col1; + ``` + + The optimizer in this case pushed down `1 = + derived.col1` into the union, removing the contribution + from `SELECT 2`, which led to an erroneous + result. We now no longer push the condition down in such cases. + (Bug #33910786) +* Some parenthesized query expressions with either or both of + `ORDER BY` and `LIMIT` were + not always handled correctly. + (Bug #33725530) +* Reimplemented retention of item trees having multiple + references, by using a reference count in every + `Item` object. Also removed old code no longer + needed due to this change. + (Bug #33725415) +* An assert occurred in [`InnoDB`](/doc/refman/8.0/en/innodb-storage-engine.html) during + upgrade of the data dictionary when the definition of the + `innodb_ddl_log` table changed, even when such + changes were effectively null operations, such as updating + `utf8` and `utf8_bin` in table + and column definitions to `utf8mb3` and + `utf8mb3_bin`, respectively. + (Bug #33688509) + + References: This issue is a regression of: Bug #33787300. +* Data and GTIDs backed up by **mysqldump** were + inconsistent when the options + [`--single-transaction`](/doc/refman/8.0/en/mysqldump.html#option_mysqldump_single-transaction) and + [`--set-gtid-purged=ON`](/doc/refman/8.0/en/mysqldump.html#option_mysqldump_set-gtid-purged) were both + used. This was because, between the start of the transaction by + **mysqldump** and the fetching of + `GTID_EXECUTED`, GTIDs on the server could have + increased already. With this fix, a [`FLUSH + TABLES WITH READ LOCK`](/doc/refman/8.0/en/flush.html#flush-tables-with-read-lock) is performed before fetching + `GTID_EXECUTED`, to ensure that its value is + consistent with the snapshot taken by + **mysqldump**. + + Our thanks to Marcelo Altmann for the contribution. + + *Limitation*: This fix adds a requirement for + the [`RELOAD`](/doc/refman/8.0/en/privileges-provided.html#priv_reload) privilege when using + [`--single-transaction`](/doc/refman/8.0/en/mysqldump.html#option_mysqldump_single-transaction) to + execute `FLUSH TABLES WITH READ LOCK`; the + MySQL team is investigating a solution. + (Bug #33630199, Bug #105761) +* [`SET + PERSIST`](/doc/refman/8.0/en/set-variable.html#set-variable-system-variables) accepted dot-separated names of variables + registered by components as well as + [`MyISAM`](/doc/refman/8.0/en/myisam-storage-engine.html) multiple key cache + variables, but [`RESET PERSIST`](/doc/refman/8.0/en/reset-persist.html) + rejected the same names with a syntax error. To fix this + discrepancy, we add support in this to `RESET + PERSIST` for variable names containing a dot character + (`.`). + (Bug #33417357) +* Some grouped queries were not always handled correctly. + (Bug #33294005, Bug #33349994) +* When multifactor authentication used the + `auth_socket` authentication plugin for the + first factor, the server executed the wrong code during the + second-factor authentication workflow and returned an error + message. The second factor could be any authentication plugin. + (Bug #33192223) +* Use of a wild card as a column identifier in an + [`INSERT`](/doc/refman/8.0/en/insert.html) statement was allowed by + the parser even though the syntax is not supported, which led to + an assert in debug builds and a silent rejection of the + statement in release builds. This construction has been removed + as a possibility from the grammar, and is now handled strictly + as a syntax error. + (Bug #33142665) + + References: This issue is a regression of: Bug #30528450. +* In prepared statements, some types of subqueries could cause a + server exit. + (Bug #33100586) +* Some floating-point literals were not always handled correctly. + (Bug #32824429) +* A [`DELETE`](/doc/refman/8.0/en/delete.html) statement with a table + alias could result in an intermittent server exit. + (Bug #32762229) +* Moved INFO\_SRC and INFO\_BIN from the mysql-common package to the + mysql-community-server-core package, the same package as mysqld + and more consistent with RPM packaging. + (Bug #32752147) +* Some queries making use of + [`MATCH()`](/doc/refman/8.0/en/fulltext-search.html#function_match) within a + `HAVING` clause were not handled correctly. + (Bug #32616816, Bug #32934558, Bug #34782389) +* A [`CREATE VIEW`](/doc/refman/8.0/en/create-view.html) statement that + contained a subquery sometimes led to an assertion in debug + builds. + (Bug #108783, Bug #34703610) +* The deduction of data types for dynamic parameters passed as + parameters to a user-defined SQL function was correct only for a + single parameter; with more than one parameter, no such + deduction was performed for the second and following parameters, + with the result that their types were always reported + erroneously to clients as `MYSQL_TYPE_INVALID`. + (Bug #108545, Bug #34629157) +* The internal function + `clone_os_copy_file_to_buf()` did not advance + the buffer position in the event of a partial read. + + Our thanks to Laurynas Biveinis for the contribution. + (Bug #108317, Bug #34543194) +* Views that access system views could encounter an access-denied + error during normal use if the pushdown condition included + expressions that used native functions from the system view. + (Bug #108202, Bug #34515868) +* When using window functions, the current row could reevaluate + itself based on the wrong record in some cases. + (Bug #108008, Bug #34431996) +* A condition pushdown into a [`UNION`](/doc/refman/8.0/en/union.html) + of queries having [`LIKE`](/doc/refman/8.0/en/string-comparison-functions.html#operator_like) clauses did + not preserve the correct character set, leading to an + (erroneous) empty result. + + We solve this problem in two parts: + + 1. By refactoring resolution of `LIKE` + expressions, in which character set determination and + propagation were previously performed in two separate blocks + of the code that were not always consistent with one + another. + 2. By adding, in the internal + `parse_expression()` function, a character + set prefix to any literal character string that is cloned. + + (Bug #107787, Bug #34359297, Bug #34589153) +* Some multiply nested queries were not performed correctly. + (Bug #107660, Bug #34321147, Bug #34377854) +* The `audit_log` server-side plugin always + logged an entire multiple query, rather than logging only the + specific part of the query that was executed. Changing when the + query length is set resolves the issue. + (Bug #107390, Bug #34207811) +* Following an upgrade to MySQL 8.0.27 a specific query started + consuming comparatively high amounts of memory whenever it was + run within a stored procedure. + (Bug #107327, Bug #34190122) +* When a **mysqld** startup option was used with + the `maximum-` prefix, the upper bound for the + corresponding system variable was set but its current value was + not checked against or adjusted according to the new limit and + thus could in some cases be greater than the stated maximum. We + fix this by adjusting the current value if it is larger than the + new user defined maximum value. + (Bug #99029, Bug #31072098) +* The [`mysql_stmt_close()`](/doc/c-api/8.0/en/mysql-stmt-close.html) C API + function could stop responding after a prepared statement was + canceled using [`KILL + QUERY`](/doc/refman/8.0/en/kill.html). + (Bug #84470, Bug #25584097) diff --git a/corpus/changelog/mysql_releases/mysql_8033.md b/corpus/changelog/mysql_releases/mysql_8033.md new file mode 100644 index 0000000000000000000000000000000000000000..1975c62ed43d24953653e86050f9d55ba0f9a2ff --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8033.md @@ -0,0 +1,741 @@ +# MySQL 8.0.33 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-33.html +Version: 8.0.33 + +## Changes in MySQL 8.0.33 (2023-04-18, General Availability) + +* [Audit Log Notes](news-8-0-33.html#mysqld-8-0-33-audit-log "Audit Log Notes") +* [Compilation Notes](news-8-0-33.html#mysqld-8-0-33-compiling "Compilation Notes") +* [Component Notes](news-8-0-33.html#mysqld-8-0-33-components "Component Notes") +* [Deprecation and Removal Notes](news-8-0-33.html#mysqld-8-0-33-deprecation-removal "Deprecation and Removal Notes") +* [MySQL Enterprise Notes](news-8-0-33.html#mysqld-8-0-33-mysql-enterprise "MySQL Enterprise Notes") +* [Performance Schema Notes](news-8-0-33.html#mysqld-8-0-33-performance-schema "Performance Schema Notes") +* [Plugin Notes](news-8-0-33.html#mysqld-8-0-33-plugins "Plugin Notes") +* [Functionality Added or Changed](news-8-0-33.html#mysqld-8-0-33-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-33.html#mysqld-8-0-33-bug "Bugs Fixed") + +### Audit Log Notes + +* MySQL Enterprise Audit previously used tables in the `mysql` + system database for persistent storage of filter and user + account data. For enhanced flexibility, the new + [`audit_log_database`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_database) server + system variable now permits specifying other databases in the + global schema namespace at server startup. The + `mysql` system database is the default setting + for table storage. + (WL #15500) + +### Compilation Notes + +* **Microsoft Windows:** + Added MSVC Code Analysis support for Visual Studio 2017 and + higher. This adds a new MSVC\_CPPCHECK (defaults to OFF) CMake + option that either enables or disables this analysis on the + current directory and its subdirectories. + (Bug #34828882) +* Downgraded curl deprecation warnings to + *-Wno-error* for curl versions greater than + 7.86 when MySQL is built with a GNU compiler or clang. + (Bug #35111625) +* On macOS, added *-framework CoreFoundation* + and *-framework SystemConfiguration* when + linking the curl interface to link with shared system libraries + as needed. + (Bug #35104962) +* Replaced the `MY_INCLUDE_SYSTEM_DIRECTORIES` + macro with library interfaces. + (Bug #35018072, Bug #35028089, Bug #35072295) +* Improved CMake code to support alternative linkers. + (Bug #34963568) +* Removed the deprecated `Docs/mysql.info` file + from the build system. + (Bug #34960126) +* Added a top-level `.clang-tidy` file and + associated `.clang.tidy` files in the + `strings/` and `mysys/` + directories. Also enabled *compdb* support to + enable clang-tidy usage on header files. + (Bug #34917075) +* Removed several unmaintained or unused C++ source files for + functionality such as uca-dump and uctypedump. + (Bug #34898978) +* Added a CMake build option to enable colorized compiler output + for GCC and Clang when compiling on the command line. To enable, + pass [`-DFORCE_COLORED_OUTPUT=1`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_force_colored_output) to + CMake. + (Bug #34897192) +* On Windows, also install .pdb files for associated .dll files if + they are found for 3rd-party libraries. + (Bug #34863555) +* Enterprise Linux 8 and Enterprise Linux 9 builds now use GCC 12 + instead of GCC 11. + (Bug #34829151) +* Building with -static-libgcc -static-libstdc++ now also builds + the bundled protobuf with static libraries, as required. + + Thanks to Alex Xing for the contribution. + (Bug #110216, Bug #35123848) + +### Component Notes + +* [`INSTALL COMPONENT`](/doc/refman/8.0/en/install-component.html) now includes + the `SET` clause, which sets the values of + component system variables while installing one or more + components. The new clause reduces the inconvenience and + limitations associated with the other ways of assigning variable + values. For usage information, see + [INSTALL COMPONENT Statement](/doc/refman/8.0/en/install-component.html). + (WL #10916) + +### Deprecation and Removal Notes + +* User-defined collations (see [Adding a Collation to a Character Set](/doc/refman/8.0/en/adding-collation.html)) + are now deprecated. Either of the following now causes a warning + to be written to the log: + + + Any occurrence of `COLLATE` followed by the + name of a user-defined collation in an SQL statement + + Use of the name of a user-defined collation as the value of + [`collation_server`](/doc/refman/8.0/en/server-system-variables.html#sysvar_collation_server), + [`collation_database`](/doc/refman/8.0/en/server-system-variables.html#sysvar_collation_database), or + [`collation_connection`](/doc/refman/8.0/en/server-system-variables.html#sysvar_collation_connection) + + You should expect support for user-defined collations to be + removed in a future version of MySQL. + (WL #14277) + +### MySQL Enterprise Notes + +* MySQL Enterprise Edition now provides data masking and de-identification + capabilities based on components, rather than being based on a + plugin library that was introduced in MySQL 8.0.13. The + component implementation provides dedicated privileges to manage + dictionaries and extends the list of specific types to include: + + + Canada Social Insurance Number + + United Kingdom National Insurance Number + + International Bank Account Number + + Universally Unique Identifier (UUID) + + An improved table-based dictionary registry replaces the + file-based dictionary used by the plugin. For a summary of the + differences between the component and plugin implementations, + see [Data-Masking Components Versus the Data-Masking Plugin](/doc/refman/8.0/en/data-masking-components-vs-plugin.html). + Existing plugin users should uninstall the server-side plugin + and drop its loadable functions before installing the new + MySQL Enterprise Data Masking and De-Identification components. + (Bug #33851601, WL #12641) + +### Performance Schema Notes + +* The Performance Schema Server Telemetry Traces service is added + in this release. An interface which provides plugins and + components a way to retrieve notifications related to SQL + statements' lifetime. + + For more information on this interface, see the *Server + telemetry traces service* section in the MySQL Source + Code documentation. + + The following were added: + + + Status variable + [`Telemetry_traces_supported`](/doc/refman/8.0/en/server-status-variables.html#statvar_Telemetry_traces_supported). + Whether server telemetry traces is supported. (Boolean) + + `TELEMETRY_ACTIVE` column was added to the + [`threads`](/doc/refman/8.0/en/performance-schema-threads-table.html) table. Indicates + whether the thread has an active telemetry session attached. + + (WL #15059) + +### Plugin Notes + +* The length of a digest for the query rewrite plugin should be 32 + bytes, but this was not always enforced. + (Bug #34991760) + +### Functionality Added or Changed + +* **Important Change:** + For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 1.1.1t. Issues fixed in OpenSSL version 1.1.1t are described at + . + (Bug #35092429) +* **Replication:** + As part of ongoing work to change old terminology used in MySQL + products, the terms “master”, “slave”, + and “MTS” have been replaced in error messages + relating to MySQL Replication by “source”, + “replica”, and “MTA”, respectively. + This includes all error messages listed in + `messages_to_clients.txt` and + `messages_to_error_log.txt` relating to + replication; the present task does not perform this replacement + for messages used in other contexts. + + See the [MySQL + 8.0 Error Message Reference](/doc/mysql-errors/8.0/en/), for more information. + (Bug #108422, Bug #34594819, WL #14191) +* **Replication:** + **mysqlbinlog** + [`--start-position`](/doc/refman/8.0/en/mysqlbinlog.html#option_mysqlbinlog_start-position) now accepts + values up to 18446744073709551615, unless the + [`--read-from-remote-server`](/doc/refman/8.0/en/mysqlbinlog.html#option_mysqlbinlog_read-from-remote-server) or + [`--read-from-remote-source`](/doc/refman/8.0/en/mysqlbinlog.html#option_mysqlbinlog_read-from-remote-source) + option is also used, in which case the maximum is 4294967295. + (Bug #77818, Bug #21498994) +* Binary packages that include curl rather than linking to the + system curl library have been upgraded to use curl 7.88.1. + (Bug #34828111) +* The use of a generated column with + [`DEFAULT(col_name)`](/doc/refman/8.0/en/miscellaneous-functions.html#function_default) + to specify the default value for a named column is not permitted + and now emits an error message. + (Bug #34463652, Bug #34369580) +* The new [`TELEMETRY_LOG_ADMIN`](/doc/refman/8.0/en/privileges-provided.html#priv_telemetry-log-admin) + privilege now enables telemetry log configuration. This + privilege is defined by the `telemetry_log` + plugin, which is deployed exclusively through MySQL HeatWave on AWS. + (Bug #111395, Bug #35494180) +* It is now possible to return the Statement ID to the client for + successfully executed statements. To enable this per session, + add `statement_id` to the value of + [`session_track_system_variables`](/doc/refman/8.0/en/server-system-variables.html#sysvar_session_track_system_variables), + or set + [`session_track_system_variables`](/doc/refman/8.0/en/server-system-variables.html#sysvar_session_track_system_variables) + to the special value `*` (asterisk). + (WL #15418) + +### Bugs Fixed + +* **NDB Cluster:** + Occasional temporary errors which could occur when opening a + table from the `NDB` dictionary while + repeatedly performing concurrent schema operations were not + retried. + (Bug #34843889) +* **NDB Cluster:** + During iteration, ordered index scans retain a cursor position + within each concurrently scanned ordered index fragment. Ordered + index fragments are modified and balanced as a result of + committing DML transactions, which can require scan cursors to + be moved within the tree. When running with query threads + configured + ([`AutomaticThreadConfig`](/doc/refman/8.0/en/mysql-cluster-ndbd-definition.html#ndbparam-ndbmtd-automaticthreadconfig) + set to 1), multiple threads can access the same index fragment + tree structure, and the scans of multiple threads can have their + cursors present in the same structure. + + The current issue arose due to an assumption in the logic for + moving scan cursors when committing DML operations that all scan + cursors belonged to the LDM thread owning the index fragment, + which did not allow for the possibility that such fragments + might belong to query threads. + (Bug #33379702) + + References: See also: Bug #32257063. +* **InnoDB:** + Error messages related to + [`innodb_doublewrite`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_doublewrite) now appear + in the error log. + (Bug #34883045, Bug #109330) +* **InnoDB:** + Prevent online DDL operations from accessing out-of-bounds + memory. + (Bug #34750489, Bug #108925) +* **InnoDB:** + [`ALTER TABLE ... + AUTO_INCREMENT`](/doc/refman/8.0/en/alter-table.html) could be set to less than MAX + 1 and + not forced to MAX + 1. + (Bug #33419246, Bug #105092) +* **InnoDB:** + [`Innodb_data_pending_fsyncs`](/doc/refman/8.0/en/server-status-variables.html#statvar_Innodb_data_pending_fsyncs) + could show extremely high inaccurate values because of a + variable overflow. + (Bug #30133150) +* **Partitioning:** + Some `IN()` queries on partitioned tables were + not always handled correctly. + (Bug #34801284) + + References: This issue is a regression of: Bug #32311183. +* **Partitioning:** + Queries using the [`INDEX_MERGE`](/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-index-level) + optimizer hint was not handled correctly in all cases. + (Bug #34797257) +* **Replication:** + XA transactions whose XIDs contained null bytes could not be + recovered. + (Bug #34918985) +* **Replication:** + When [`binlog_order_commits`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_order_commits) was + set equal to `1`, for any two transactions and + for any sub-step of the commit phase, the transaction that was + written to the binary log first did not always execute the + sub-step first, as expected. + (Bug #34703698) +* **Replication:** + Some binary log events were not always handled correctly. + (Bug #34617506) +* **Replication:** + The binary log recovery process did not report all possible + error states. + (Bug #33658850) +* **Replication:** + Following + [`CHANGE + REPLICATION SOURCE TO + SOURCE_CONNECTION_AUTO_FAILOVER=1`](/doc/refman/8.0/en/change-replication-source-to.html), failover generated + a number of misleading warnings in the log that implied there + were problems when in fact conditions were those expected for + such a failover. These log messages have been updated + accordingly. + (Bug #32135376) +* **Replication:** + When a transaction failed, as a side effect, extraneous error + messages relating the replication data repositories were written + to the log. Now in such cases, we suppress such error messages, + which are not directly related to the issue of the failed + transaction or its cause. + (Bug #19820134) +* **Replication:** + Setting [`binlog_order_commits`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_order_commits) to + `OFF` could lead to a missed GTID in the next + binary log file's `Previous_gtids` event. + + Our thanks to Yewei Xu and the Tencent team for the + contribution. + (Bug #109485, Bug #34930969) +* **Replication:** + Corrected the SQL statements suggested in the error message text + for + [`ER_RPL_REPLICA_ERROR_RUNNING_QUERY`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_rpl_replica_error_running_query). + + Our thanks to Dan McCombs for the contribution. + (Bug #109154, Bug #34822612) +* **Replication:** + A hash scan builds a hash of changes, scans the target table or + index, and applies any matching change for the current entry. In + the build phase, it uses only the before image, and skips any + after image. Problems arose in some cases because generated + columns were computed for the (skipped) after image, leading to + replication errors. This is fixed by not computing generated + columns any longer for seek-only calls such as hash scans. + + Our thanks to dc huang for the contribution. + (Bug #107366, Bug #34198907) +* **Replication:** + In certain rare cases, it was possible to set + [`gtid_mode=OFF`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_mode) for one session + while another session, after + [`WAIT_FOR_EXECUTED_GTID_SET()`](/doc/refman/8.0/en/gtid-functions.html#function_wait-for-executed-gtid-set) was + issued by a user in this second session, was still waiting for + the next GTID set from the first session. This could result in + the second session waiting indefinitely for the function to + return. + (Bug #99921, Bug #31505993) +* **Group Replication:** + Accessing the Performance Schema + [`replication_group_communication_information`](/doc/refman/8.0/en/performance-schema-replication-group-communication-information-table.html) + and [`replication_group_member_stats`](/doc/refman/8.0/en/performance-schema-replication-group-member-stats-table.html) + tables in parallel sometimes caused subsequent group replication + operations to hang. + (Bug #34870181) +* **Group Replication:** + In certain cases, the group replication secondary node + unexpectedly shut down while purging the relay log. + (Bug #34397106) +* **Group Replication:** + When shutting down the Group Replication plugin, the order in + which the associated events were reported the error log + sometimes led to confusion. To remove any doubts, we now make + sure that `Plugin group_replication reported: 'Plugin + 'group_replication' has been stopped.` is in fact the + last log message relating to the shutdown, written only when all + other events associated with shutting down the plugin have been + logged. + (Bug #109345, Bug #34887491) +* **Microsoft Windows:** + The `authentication_fido_client` plugin stopped + responding during the authentication process if it was unable to + find a FIDO device on the Windows client host. + (Bug #34918044) +* In certain cases, + [`CONVERT(utf8mb3_column + USING UTF16)`](/doc/refman/8.0/en/cast-functions.html#function_convert) was rejected with the error + Cannot convert string '\x--...' from binary to + utf16. + (Bug #35129361) +* When joining two tables on a string column, and the column from + one of the tables has an additional predicate comparing it with + a temporal literal, constant propagation in some cases + incorrectly caused the join condition to be modified such that + it used temporal rather than string semantics when comparing the + strings. This caused incorrect results to be returned from the + join. + (Bug #35115909) +* Error messages returned after calling the + [`mysql_reset_connection()`](/doc/c-api/8.0/en/mysql-reset-connection.html) C API + function in a prepared statement did not identify the function + name properly. + (Bug #35107280) +* Fixed a regression in a previous fix for an issue with windowing + functions. + + Our thanks to Dmitry Lenev for the contribution. + (Bug #35061924) + + References: This issue is a regression of: Bug #34572136. +* When replacing subqueries in transforms, the internal flag + showing whether a given query block contains any subqueries + (`PROP_SUBQUERY`) was not updated afterwards. + (Bug #35060385) +* A client setting the character set to an impermissible client + character set (`ucs2`, + `utf16`, `utf16le`, or + `utf32`) could cause unexpected behavior when + the client used an authentication plugin. + (Bug #35054579) +* [`EXPLAIN ANALYZE`](/doc/refman/8.0/en/explain.html#explain-analyze) displayed 0 when + the average number of rows was less than 1. To fix this, we now + format numbers in the output of `EXPLAIN + ANALYZE` and `EXPLAIN FORMAT=TREE` + such that numbers in the range 0.001-999999.5 are printed as + decimal numbers, and numbers outside this range are printed + using engineering notation (for example: + `1.23e+9`, `934e-6`). In + addition, trailing zeroes are no longer printed, and numbers + less than `1e-12` are printed as + `0`. + + This helps ensure consistent precision regardless of the + number's value and improve readability, while producing minimal + rounding errors. + (Bug #34990948) +* The [`NTILE()`](/doc/refman/8.0/en/window-function-descriptions.html#function_ntile) function did not work + correctly in all cases. + (Bug #34986665) +* Some joins on views did not perform correctly. + (Bug #34985359) +* Transforming a correlated scalar subquery to a derived table led + to a wrong result for [`InnoDB`](/doc/refman/8.0/en/innodb-storage-engine.html) tables + when the subquery included duplicate predicates. An example of a + query which could be affected by this issue is shown here: + + ```None + SELECT * FROM t1 + WHERE ( + SELECT t2.a FROM t2 + WHERE t2.a = t1.a AND t2.a = t1.a + ) > 0; + ``` + + (Bug #34973220) +* Fixed an assert in `sql/item_strfunc.cc` that + could potentially lead to issues with the + [`SPACE()`](/doc/refman/8.0/en/string-functions.html#function_space) function. + (Bug #34962821) +* Using [`ROW_COUNT()`](/doc/refman/8.0/en/information-functions.html#function_row-count) as the + *`length`* argument to + [`LPAD()`](/doc/refman/8.0/en/string-functions.html#function_lpad) or + [`RPAD()`](/doc/refman/8.0/en/string-functions.html#function_rpad) did not perform as + expected. + (Bug #34961236) +* A query with a window function having an expression with a + [`CASE`](/doc/refman/8.0/en/flow-control-functions.html#operator_case) function in its `ORDER + BY` clause could lead to a server exit. + (Bug #34933045) +* The fix for a previous issue introduced an assertion in debug + builds when optimizing a `HAVING` clause. + (Bug #34923792) + + References: This issue is a regression of: Bug #33725415. +* When using `mysqld_multi`, the system that + obscures "--password" usage as "--password=\*\*\*\*\*" would also + match "--password-history" and "--password-require-current" + definitions as "--password", but now explicitly checks for + "--password=" instead. + (Bug #34918740) +* In some cases, calling the + [`mysql_bind_param()`](/doc/c-api/8.0/en/mysql-bind-param.html) C API + function could cause the server to become unresponsive. + (Bug #34869076) +* The `authentication_oci_client` plugin was + unable to open a valid configuration file if any of its entries + contained an equals sign character separated by spaces (for + example, `key_file = + /home/user/.oci/oci_api_key.pem`). Now, both + '*`key`*=*`value`*' + and '*`key`* = + *`value`*' entry formats are supported. + (Bug #34864078) +* Incorrect results were returned when the result of an + [`INTERSECT`](/doc/refman/8.0/en/intersect.html) or + [`EXCEPT`](/doc/refman/8.0/en/except.html) operation was joined with + another table. This issue affected these operations in such + cases when used with either `DISTINCT` or + `ALL`. + (Bug #34843764) +* When preparing a view query, the operation used the system + character set (instead of the character set stored in data + dictionary) and then reported an invalid character-string error. + (Bug #34800905) +* Prepared statements that operate on derived tables, including + views, could stop unexpectedly due to problems with the code for + reopening tables after an error. + (Bug #34798403) +* Removed an assertion raised in certain cases by the + [`RANDOM_BYTES()`](/doc/refman/8.0/en/encryption-functions.html#function_random-bytes) function in debug + builds. + (Bug #34781507) +* There was an issue in how persisted variables were set on + startup, causing certain variables not to get properly set to + their persisted value. + (Bug #34751419) +* The [`MAKETIME()`](/doc/refman/8.0/en/date-and-time-functions.html#function_maketime) function did not + perform correctly in all cases. + (Bug #34745241) +* Some functions with multiple arguments did not produce the + expected results. + (Bug #34741801) +* A table reference in an `ORDER BY` outside the + parenthesized query block in which the table was used, and which + query block had no `LIMIT` or `ORDER + BY` of its own, raised an error. + (Bug #34704011) + + References: This issue is a regression of: Bug #103954, Bug #32980249. +* A left join with an impossible condition as part of an + `ON` clause was not optimized as in MySQL 5.7, + so that, in later versions, the query executed more quickly + without the impossible condition than with it. An example of + such a query, impossible condition included, is `SELECT + * FROM t1 JOIN t2 ON t1.c1=t2.c1 AND 1=2`. + (Bug #34668756) +* When a user defined function was part of a derived table that + was merged into the outer query block, or was part of a subquery + converted to a semi-join, knowledge of whether this UDF was + deterministic (or not) was lost during processing. + (Bug #34666531) +* With JSON logging enabled and an event subclass specified in the + audit log filter definition, an empty item (`"" : { + }`) was appended to the end of the logged event. + (Bug #34659904) +* Some subqueries did not execute properly. + (Bug #34616553) +* After the [`asymmetric_encrypt()`](/doc/refman/8.0/en/enterprise-encryption-functions.html#function_asymmetric-encrypt) + component function in a [`SELECT`](/doc/refman/8.0/en/select.html) + query encountered a NULL field to decrypt, it could return NULL + values for other non-NULL encrypted fields. + (Bug #34598912) +* The server did not always shut down cleanly after uninstalling + the audit log plugin. + (Bug #34594035) +* Certain antijoins were not handled correctly by the server. + (Bug #34370673) + + References: This issue is a regression of: Bug #30573446. +* When the MySQL 5.7 Optimizer has 2 choices for an index to + filter rows, one primary and one secondary, it picks a range + scan on the secondary index because the range scan uses more key + parts. MySQL 8.0 did not use this logic, instead choosing the + primary index to filter rows with `WHERE` + clause filtering. Primary key use is not suitable in such cases + due to the presence of `LIMIT`, and due to the + nature of data distribution. The secondary index was not + considered while resolving order by due to constant elimination. + This resulted in much different query plans in MySQL 5.7 and + MySQL 8.0 for the same query. + + We solve this issue in MySQL 8.0 by skipping the constant key + parts of the index during order-by evaluation only if the query + is constant-optimized, which can be done at this time, but not + during `LIMIT` analysis. + (Bug #34291261) +* The MySQL data dictionary caches failed lookups of + `se_private_id` values (IDs which are not + found), which speeds up execution of code specific to + [`InnoDB`](/doc/refman/8.0/en/innodb-storage-engine.html), relying on the fact that + `InnoDB` does not reuse these IDs. This + assumption does not necessarily hold for other storage engines, + most notably [`NDB`](/doc/refman/8.0/en/mysql-cluster.html), where this + problem was resolved previously by not using this cache. + + We extend the previous fix made for `NDB` so + that the cache lookup is now employed only when the table uses + the `InnoDB` storage engine. + (Bug #34145006) + + References: See also: Bug #33824058. +* Unexpected results were seen in some queries using + [`DENSE_RANK()`](/doc/refman/8.0/en/window-function-descriptions.html#function_dense-rank), possibly with the + addition of `WITH ROLLUP`. + (Bug #34099408) +* Fixed an assert raised in + `sql/sql_tmp_table.cc` following work done + previously to reimplement `ROLLUP` processing. + (Bug #33830659) + + References: This issue is a regression of: Bug #30969045. +* Some CTEs that did not use any tables were not always handled + correctly. + (Bug #33725542) + + References: This issue is a regression of: Bug #27062031. +* Accessing rows from a window frame of a window function call + present only in the query's `ORDER BY` + list raised an error. + (Bug #33069747) +* [`PERCENT_RANK()`](/doc/refman/8.0/en/window-function-descriptions.html#function_percent-rank) used with + `ORDER BY column` + did not return the correct result. + (Bug #33064174) + + References: This issue is a regression of: Bug #27484133. +* The [`--exclude-tables`](/doc/refman/8.0/en/mysqlpump.html#option_mysqlpump_exclude-tables) and + [`--include-tables`](/doc/refman/8.0/en/mysqlpump.html#option_mysqlpump_include-tables) + **mysqlpump** options did not handle views. + (Bug #21303549) +* Changed the MySQL systemd service unit configuration from + `After=network-online.target` to + `Wants=network-online.target` to ensure that + all configured network devices are available and have an IP + address assigned before the service is started. + (Bug #109996, Bug #35068274) +* [`AVG(...)`](/doc/refman/8.0/en/aggregate-functions.html#function_avg) `OVER (ROWS + BETWEEN 1 FOLLOWING AND UNBOUNDED FOLLOWING)` did not + return the correct result. + (Bug #109725, Bug #35013880) + + References: This issue is a regression of: Bug #108008, Bug #34431996. +* A query of the form `SELECT 1 FROM t1 WHERE NOT EXISTS + (VALUES ROW(1), ROW(2))` caused an assert in debug + builds when the `subquery_to_derived` optimizer + switch was enabled. + (Bug #109723, Bug #35014318) + + References: See also: Bug #108910, Bug #34746261. +* **mysqlimport** did not escape reserved word + table names when used with the + [`--delete`](/doc/refman/8.0/en/mysqlimport.html#option_mysqlimport_delete) option. + (Bug #109711, Bug #34999015) +* When cloning a condition to push down to a derived table, + characters in strings representing conditions were converted to + `utfmb4` correctly only for values less than + 128 (the ASCII subset), and code points outside the ASCII subset + were converted to invalid characters, causing the resulting + character strings to become invalid. For derived tables without + [`UNION`](/doc/refman/8.0/en/union.html), this led to problems when + a column name from the derived table used characters outside the + ASCII subset, and was used in the `WHERE` + condition. For derived tables with `UNION`, it + created problems when a character outside the ASCII subset was + present in a `WHERE` condition. + + We fix these issues by initializing the string used for + representing the condition in such cases to the connection + character set. + (Bug #109699, Bug #34996488) +* Using [`--single-transaction`](/doc/refman/8.0/en/mysqldump.html#option_mysqldump_single-transaction) + with **mysqldump** version 8.0.32 required either + the [`RELOAD`](/doc/refman/8.0/en/privileges-provided.html#priv_reload) or + [`FLUSH_TABLES`](/doc/refman/8.0/en/privileges-provided.html#priv_flush-tables) privilege. This + requirement now applies only when both + [`gtid_mode=ON`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_mode) (default + `OFF`) and with + [`--set-gtid-purged = ON|AUTO`](/doc/refman/8.0/en/mysqldump.html#option_mysqldump_set-gtid-purged) + (default `AUTO`). + (Bug #109685, Bug #109701, Bug #34993824, Bug #34998910, Bug #35020512) + + References: This issue is a regression of: Bug #105761, Bug #33630199. +* Fixed a number of issues present in the internal documentation + for the scramble generator algorithm in + `sha256_scramble_generator.cc` and + `sha2_password_common.cc`. + + Our thanks to Niklas Keller for the contribution. + (Bug #109576, Bug #34967141) +* [`CREATE USER IF NOT + EXISTS`](/doc/refman/8.0/en/create-user.html) added a password history entry even when the + user already existed and the password was not updated. This + caused a subsequent [`ALTER USER`](/doc/refman/8.0/en/alter-user.html) + statement to be rejected. + (Bug #109415, Bug #34906592) +* Many joins using `eq_ref` access did not + perform as well as in previous versions. This issue was first + reported in MySQL 8.0.29. + (Bug #109361, Bug #34891365) +* A hash outer join sometimes incorrectly matched + `NULL` with a decimal zero or an empty string + that used a non-padding collation, leading to erroneous results. + (Bug #109211, Bug #34837464) + + References: This issue is a regression of: Bug #33794977. +* An object used internally by [`ALTER INSTANCE + RELOAD TLS`](/doc/refman/8.0/en/alter-instance.html#alter-instance-reload-tls) was not freed until the number of readers + reached 0, under the assumption is that the number of readers + should reach 0 fairly frequently. The read lock held during an + SSL handshake is generally an expensive operation, with network + calls, so when round trips between the client and the server + took excessively long, the lock was held for a relatively long + amount of time. This meant that, when changing the value of this + object and there were a sufficient number of incoming SSL + connections being made, the number of readers might not reach 0 + in a reasonable length of time, leaving the thread holding the + lock using 100% of the CPU until the lock was released. + + We fix this by adding a wait after setting the pointer to this + object to a new value, but before releasing the old object. + + Our thanks to Sinisa Milivojevic for the contribution. + (Bug #107567, Bug #34284186) +* If **mysqldump** or **mysqlpump** + could not convert a field's default value to UTF-8 (for + instance, if the field was of type + [`BINARY`](/doc/refman/8.0/en/binary-varbinary.html) and the default value did + not coincide with valid UTF-8), the operation produced results + that were not valid to import. Further, using the + `--hex-blob` option did not resolve the issue. We + now convert the default value to the system character set. If + this fails, the server sends the value as hexadecimal instead to + make it more human-readable. + (Bug #104840, Bug #33322551) +* A connection using the C API (`libmysqlclient`) + client library could fail with the `FUTURE` + crypto policy. + (Bug #104778, Bug #33316709) +* While cloning a temporary table for a common table expression + which used shared materialization, the cloned temp table was not + marked as using hash deduplication, leading to wrong results. We + now set the hash field for the cloned temporary table correctly, + and update the hidden field count to take this into account. + (Bug #102251, Bug #32383712) + + References: See also: Bug #103052, Bug #32659629. +* [`CREATE EVENT`](/doc/refman/8.0/en/create-event.html) and + [`ALTER EVENT`](/doc/refman/8.0/en/alter-event.html) assumed that all + values passed to them (other than in a `DO` + clause) resolved as scalars without actually checking the + values. This led to assertions when any such values actually + rows. + + We now perform an explicit check for the number of columns when + resolving such items, and report an error when one produces a + row and not a scalar value. + (Bug #57552, Bug #11764690) +* A view reference whose underlying field is a constant is not + marked as constant when the reference is part of an inner table + of an outer join. It was found that, when pushing a condition + down to a derived table, the reference was stripped off and only + the underlying field was cloned, which made it a constant, and + led to wrong results. + + To fix this problem, we ensure that we do not push such a + condition down to the derived table by adding a check to see + first whether the table used by the condition matches the + derived table or is a constant expression; only when it is one + or the other of these do we actually push the condition down. + (Bug #34661, Bug #11747971) diff --git a/corpus/changelog/mysql_releases/mysql_8034.md b/corpus/changelog/mysql_releases/mysql_8034.md new file mode 100644 index 0000000000000000000000000000000000000000..fae6dd0389183e323e4c2c85b2def88189ad8aeb --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8034.md @@ -0,0 +1,915 @@ +# MySQL 8.0.34 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-34.html +Version: 8.0.34 + +## Changes in MySQL 8.0.34 (2023-07-18, General Availability) + +* [Account Management Notes](news-8-0-34.html#mysqld-8-0-34-account-management "Account Management Notes") +* [Audit Log Notes](news-8-0-34.html#mysqld-8-0-34-audit-log "Audit Log Notes") +* [Binary Logging](news-8-0-34.html#mysqld-8-0-34-binlog "Binary Logging") +* [C API Notes](news-8-0-34.html#mysqld-8-0-34-capi "C API Notes") +* [Compilation Notes](news-8-0-34.html#mysqld-8-0-34-compiling "Compilation Notes") +* [Deprecation and Removal Notes](news-8-0-34.html#mysqld-8-0-34-deprecation-removal "Deprecation and Removal Notes") +* [Performance Schema Notes](news-8-0-34.html#mysqld-8-0-34-performance-schema "Performance Schema Notes") +* [SQL Syntax Notes](news-8-0-34.html#mysqld-8-0-34-sql-syntax "SQL Syntax Notes") +* [Functionality Added or Changed](news-8-0-34.html#mysqld-8-0-34-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-34.html#mysqld-8-0-34-bug "Bugs Fixed") + +### Account Management Notes + +* A new password-validation system variable now permits the + configuration and enforcement of a minimum number of characters + that users must change when attempting to replace their own + MySQL account passwords. This new verification setting is a + percentage of the total characters in the current password. For + example, if + [`validate_password.changed_characters_percentage`](/doc/refman/8.0/en/validate-password-options-variables.html#sysvar_validate_password.changed_characters_percentage) + has a value of 50, at least half of the characters in the + replacement account password must not be present in the current + password, or the password is rejected. + + This new capability is one several that provide DBAs more + complete control over password management. For more information, + see [Password Management](/doc/refman/8.0/en/password-management.html). + (WL #15751) + +### Audit Log Notes + +* In MySQL 8.0.33, the `audit_log` plugin added + support for choosing which database to use to store JSON filter + tables. It is now possible to specify an alternative to the + default system database, `mysql`, when running + the plugin installation script. Use the + [`audit_log_database`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_database) server + system variable (or `-D + database_name`) on the + command line together with the alternative database name, for + example: + + ```None + $> mysql -u root -D database_name -p < audit_log_filter_linux_install.sql + ``` + + For additional information about using + `audit_log` plugin installation scripts, see + [Installing or Uninstalling MySQL Enterprise Audit](/doc/refman/8.0/en/audit-log-installation.html). + (Bug #35252268) +* MySQL Enterprise Audit now supports using the scheduler component to + configure and execute a recurring task to flush the in-memory + cache. For setup instructions, see + [Enabling the Audit Log Flush Task](/doc/refman/8.0/en/audit-log-logging-configuration.html#audit-log-flush-task). + (WL #15567) + +### Binary Logging + +* Several functions now are added to the + `libmysqlclient.so` shared library that + enable developers to access a MySQL server binary log: + [`mysql_binlog_open()`](/doc/c-api/8.0/en/mysql-binlog-open.html), + [`mysql_binlog_fetch()`](/doc/c-api/8.0/en/mysql-binlog-fetch.html), and + [`mysql_binlog_close()`](/doc/c-api/8.0/en/mysql-binlog-close.html). + + Our thanks to Yura Sorokin for the contribution. + (Bug #110658, Bug #35282154) + +### C API Notes + +* In the calling function, `len` is initialized + to 0 and never changed if `net->vio` is + null. This fix adds a check of `net` before + dereferencing `vio`. + + Our thanks to Meta for the contribution. + (Bug #30809590) +* A variable in the `async` client was + uninitialized in certain code paths. It is fixed by always + initializing the variable. + + Our thanks to Meta for the contribution. + (Bug #30809568) + +### Compilation Notes + +* **Microsoft Windows:** + For Windows, improved + [`MSVC_CPPCHECK`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_msvc_cppcheck) support; and check + for MSVC warnings similar to "maintainer" mode. For example, + check after all third party configurations are complete. + (Bug #35283401) + + References: See also: Bug #34828882. +* **Microsoft Windows:** + For Windows builds, improved WIN\_DEBUG\_NO\_INLINE=1 support; + usage would exceed the library limit of 65535 objects. + (Bug #35259704) +* Upgraded the bundled robin-hood-hashing from v3.8.1 to v3.11.5. + (Bug #35448980) +* Removed the unused `extra/libcbor/doc/` + directory as + `extra/libcbor/doc/source/requirements.txt` + inspired bogus pull requests on GitHub. + (Bug #35433370) +* Updated the bundled ICU files from version 69.1 to version 73 + for the `icu-data-files` package. + (Bug #35353708) +* ZSTD sources bundled in the source tree were upgraded to ZSTD + 1.5.5 from 1.5.0. + (Bug #35353698) +* Initialize the internal `MEM_ROOT` class memory + with garbage using the TRASH macro to make easier to reproduce + bugs caused by reading initialized memory allocated from + MEM\_ROOT. + (Bug #35277644) +* We now determine stack direction at runtime rather than at + configure time. + (Bug #35181008) +* Added the + [`OPTIMIZE_SANITIZER_BUILDS`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_optimize_sanitizer_builds) CMake + option that adds `-O1 -fno-inline` to sanitizer + builds. It defaults to ON. + (Bug #35158758) +* Changed the minimum Bison version requirement from v2.1 to + v3.0.4. For macOS, this may require installing Bison via a + package manager such as Homebrew. + (Bug #35154645, Bug #35191333) +* MySQL now sets LANG=C in the environment when executing + `readelf` to avoid problems with non-ASCII + output. + + Our thanks to Kento Takeuchi for the contribution. + (Bug #111190, Bug #35442825) +* On macOS, MySQL would not compile if rapidjson was installed via + Homebrew. The workaround was to `brew unlink + rapidjson`. + (Bug #110736, Bug #35311140) + + References: This issue is a regression of: Bug #35006191. +* MySQL would not build with + `-DWITH_ZLIB=system`; it'd complain about not + finding the system zlib library despite finding it. + (Bug #110727, Bug #110745, Bug #35307674, Bug #35312227) + +### Deprecation and Removal Notes + +* **Important Change:** + Since MySQL provides other means of performing database dumps + and backups with the same or additional functionality, including + **mysqldump** and + [MySQL Shell Utilities](/doc/mysql-shell/8.0/en/mysql-shell-utilities.html), the + **mysqlpump** client utility program has become + redundant, and is now deprecated. Invocation of this program now + produces a warning. You should keep in mind that + **mysqlpump** is subject to removal in a future + version of MySQL, and move applications depending on it to + another solution, such as those mentioned previously. + (WL #15652) +* **Replication:** + The [`sync_relay_log_info`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_sync_relay_log_info) server + system variable is deprecated in this release, and getting or + setting this variable or its equivalent startup option + [`--sync-relay-log-info`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_sync_relay_log_info) now raises + a warning. + + Expect this variable to be removed in a future version of MySQL; + applications which make use of it should be rewritten not to + depend on it before this happens. + (Bug #35367005, WL #13968) +* **Replication:** + The [`binlog_format`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_format) server system + variable is now deprecated, and subject to removal in a future + version of MySQL. The functionality associated with this + variable, that of changing the binary logging format, is also + deprecated. + + The implication of this change is that, when + `binlog_format` is removed, only row-based + binary logging, already the default in MySQL 8.0, will be + supported by the MySQL server. For this reason, new + installations should use only row-based binary logging, and + existing ones using the statement-based or mixed logging format + should be migrated to the row-based format. See + [Replication Formats](/doc/refman/8.0/en/replication-formats.html), for more information. + + The system variables + [`log_bin_trust_function_creators`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_log_bin_trust_function_creators) + and + [`log_statements_unsafe_for_binlog`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_log_statements_unsafe_for_binlog), + being useful only in the context of statement-based logging, are + now also deprecated, and are thus also subject to removal in a + future release of MySQL. + + Setting or selecting the values of any of the variables just + mentioned now raises a warning. + (WL #13966, WL #15669) +* **Group Replication:** + The + [`group_replication_recovery_complete_at`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_recovery_complete_at) + server system variable is now deprecated, and setting it + produces a warning. You should expect its removal in a future + release of MySQL. + (WL #15460) +* The `mysql_native_password` authentication + plugin now is deprecated and subject to removal in a future + version of MySQL. [`CREATE USER`](/doc/refman/8.0/en/create-user.html), + [`ALTER USER`](/doc/refman/8.0/en/alter-user.html), and + [`SET PASSWORD`](/doc/refman/8.0/en/set-password.html) operations now + insert a deprecation warning into the server error log if an + account attempts to authenticate using + `mysql_native_password` as an authentication + method. + (Bug #35336317) +* Previously, if the `audit_log` plugin was + installed without the accompanying audit tables and functions + needed for rule-based filtering, the plugin operated in legacy + filtering mode. Now, legacy filtering mode is deprecated. New + deprecation warnings are emitted for legacy audit log filtering + system variables. These deprecated variables are either + read-only or dynamic. + + (Read-only) [`audit_log_policy`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_policy) + now writes a warning message to the MySQL server error log + during server startup when the value is not + `ALL` (default value). + + (Dynamic) + [`audit_log_include_accounts`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_include_accounts), + [`audit_log_exclude_accounts`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_exclude_accounts), + [`audit_log_statement_policy`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_statement_policy), and + [`audit_log_connection_policy`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_connection_policy). + Dynamic variables print a warning message based on usage: + + + Passing in a non-NULL value to + [`audit_log_include_accounts`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_include_accounts) + or + [`audit_log_exclude_accounts`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_exclude_accounts) + during MySQL server startup now writes a warning message to + the server error log. + + Passing in a non-default value to + [`audit_log_statement_policy`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_statement_policy) + or + [`audit_log_connection_policy`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_connection_policy) + during MySQL server startup now writes a warning message to + the server error log. `ALL` is the default + value for both variables. + + Changing an existing value using + [`SET`](/doc/refman/8.0/en/set.html) syntax during a MySQL + client session now writes a warning message to the client + log. + + Persisting a variable using + [`SET + PERSIST`](/doc/refman/8.0/en/set-variable.html) syntax during a MySQL client session now + writes a warning message to the client log. + + (WL #11248) +* MySQL enables control of FIPS mode on the server side and the + client side using a system variable and client option. + Application programs can use the + `MYSQL_OPT_SSL_FIPS_MODE` option to + [`mysql_options()`](/doc/c-api/8.0/en/mysql-options.html) to enable FIPS + mode on the client. Alternatively, it is possible to handle FIPS + mode directly through OpenSSL configuration files rather than + using the current server-side system variable and client-side + options. When MySQL is compiled using OpenSSL 3.0, and an + OpenSSL library and FIPS Object Module are available at runtime, + the server reads the OpenSSL configuration file and respects the + preference to use a FIPS provider, if one is set. OpenSSL 3.0 is + certified for use with FIPS. + + To favor the OpenSSL alternative, the + [`ssl_fips_mode`](/doc/refman/8.0/en/server-system-variables.html#sysvar_ssl_fips_mode) server system + variable, [`--ssl-fips-mode`](/doc/refman/8.0/en/connection-options.html#option_general_ssl-fips-mode) client + option, and the `MYSQL_OPT_SSL_FIPS_MODE` + option now are deprecated and subject to removal in a future + version of MySQL. A deprecation warning prints to standard error + output when an application uses the + `MYSQL_OPT_SSL_FIPS_MODE` option or when a + client user specifies the + [`--ssl-fips-mode`](/doc/refman/8.0/en/connection-options.html#option_general_ssl-fips-mode) option on the + command line, through option files, or both. + + Prior to being deprecated, the + [`ssl_fips_mode`](/doc/refman/8.0/en/server-system-variables.html#sysvar_ssl_fips_mode) server-side + system variable was dynamically settable. It is now a read-only + variable (accepts `SET PERSIST_ONLY`, but not + `SET PERSIST` or `SET + GLOBAL`). When specified on the command line or in the + `mysqld-auto.cnf` option file (with + `SET PERSIST_ONLY`) a deprecation warning + prints to the server error log. + (WL #15631) +* The **mysql\_ssl\_rsa\_setup** program originally + provided a simple way for community users to generate + certificates manually, if OpenSSL was installed on the system. + Now, **mysql\_ssl\_rsa\_setup** is deprecated + because MySQL Community Edition no longer supports using yaSSL as the SSL library, + and source distributions no longer include yaSSL. Instead, use + MySQL server to generate missing SSL and RSA files automatically + at startup (see + [Automatic SSL and RSA File Generation](/doc/refman/8.0/en/creating-ssl-rsa-files-using-mysql.html#creating-ssl-rsa-files-using-mysql-automatic)). + (WL #15668) +* The `keyring_file` and + `keyring_encrypted_file` plugins now are + deprecated. These keyring plugins are superseded by the + `component_keyring_file` and + `component_keyring_encrypted_file` components. + For a concise comparison of keyring components and plugins, see + [Keyring Components Versus Keyring Plugins](/doc/refman/8.0/en/keyring-component-plugin-comparison.html). + (WL #15659) +* Previously, the MySQL server processed a version-specific + comment without regard as to whether any whitespace followed the + MySQL version number contained within it. For example, the + comments `/*!80034KEY_BLOCK_SIZE=1024*/` and + `/*!80034 KEY_BLOCK_SIZE=1024*/` were handled + identically. Beginning with this release, when the next + character following the version number in such a comment is + neither a whitespace character nor the end of the comment, the + server issues a warning: Immediately starting the + version comment after the version number is deprecated and may + change behavior in a future release. Please insert a whitespace + character after the version number. + + You should expect the whitespace requirement for + version-specific comments to become strictly enforced in a + future version of MySQL. + + See [Comments](/doc/refman/8.0/en/comments.html), for more information. + (WL #15686) +* The MySQL client library currently supports performing an + automatic reconnection to the server if it finds that the + connection is down and an application attempts to send a + statement to the server to be executed. Now, this feature is + deprecated and subject to removal in a future release of MySQL. + + The related `MYSQL_OPT_RECONNECT` option is + still available but it is also deprecated. C API functions + [`mysql_get_option()`](/doc/c-api/8.0/en/mysql-get-option.html) and + [`mysql_options()`](/doc/c-api/8.0/en/mysql-options.html) now write a + deprecation warning to the standard error output when an + application specifies `MYSQL_OPT_RECONNECT`. + (WL #15766) + +### Performance Schema Notes + +* The type used for the Performance Schema + [`clone_status`](/doc/refman/8.0/en/performance-schema-clone-status-table.html) table's + `gtid_executed` column has been changed from + [`VARCHAR(4096)`](/doc/refman/8.0/en/char.html) to + [`LONGTEXT`](/doc/refman/8.0/en/blob.html). + (Bug #109171, Bug #34828542) + +### SQL Syntax Notes + +* [`CURRENT_USER()`](/doc/refman/8.0/en/information-functions.html#function_current-user) can now be used as + a default value for [`VARCHAR`](/doc/refman/8.0/en/char.html) and + [`TEXT`](/doc/refman/8.0/en/blob.html) columns in + [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) and + [`ALTER + TABLE ... ADD COLUMN`](/doc/refman/8.0/en/alter-table.html#alter-table-add-drop-column) statements. + + The functions [`SESSION_USER()`](/doc/refman/8.0/en/information-functions.html#function_session-user), + [`USER()`](/doc/refman/8.0/en/information-functions.html#function_user), and + [`SYSTEM_USER()`](/doc/refman/8.0/en/information-functions.html#function_system-user) are also supported + in all of the cases just mentioned. By way of example, the + following sequence of statements now works similarly to what is + shown here, with the precise output dependent on your + environment: + + ```None + mysql> SELECT CURRENT_USER(); + +-------------------+ + | CURRENT_USER() | + +-------------------+ + | sakila@localhost | + +-------------------+ + 1 row in set (0.00 sec) + + mysql> CREATE TABLE t ( + > c1 VARCHAR(288) DEFAULT (USER()), + > c2 VARCHAR(288) DEFAULT (CURRENT_USER()), + > c3 VARCHAR(288) DEFAULT (SESSION_USER()), + > c4 VARCHAR(288) DEFAULT (SYSTEM_USER()) + > ); + Query OK, 0 rows affected (0.04 sec) + + mysql> INSERT INTO t VALUES ROW(); + Query OK, 1 row affected (0.01 sec) + + mysql> TABLE t; + +-------------------+-------------------+-------------------+-------------------+ + | c1 | c2 | c3 | c4 | + +-------------------+-------------------+-------------------+-------------------+ + | sakila@localhost | sakila@localhost | sakila@localhost | sakila@localhost | + +-------------------+-------------------+-------------------+-------------------+ + 1 row in set (0.00 sec) + ``` + + When used in this way, these functions are also included in the + output of [`SHOW CREATE TABLE`](/doc/refman/8.0/en/show-create-table.html) and + [`SHOW COLUMNS`](/doc/refman/8.0/en/show-columns.html), and referenced in + the `COLUMN_DEFAULT` column of the Information + Schema [`COLUMNS`](/doc/refman/8.0/en/information-schema-columns-table.html) table where + applicable. + + If you need to insure that values having the maximum possible + length can be stored in such a column, you should make sure that + the column can accommodate at least 288 characters (255 for the + user name and 32 for the host name, plus 1 for the separator + `@`). For this reason—while it is + possible to use one of these functions as the default for a + [`CHAR`](/doc/refman/8.0/en/char.html) column, it is not + recommended due to the risk of errors or truncation of values. + (Bug #17809, Bug #11745618) + +### Functionality Added or Changed + +* **Important Change:** + For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated from OpenSSL + 1.1.1 to OpenSSL 3.0. The exact version is now 3.0.9. More + information on changes from 1.1.1 to 3.0 can be found at + . + (Bug #35475140, WL #15614) +* **Packaging:** + Beginning with this release, binary archive packages previously + named using `-el7-x86_64.tar` and + `-el7-x86_64.tar.gz` are now named using + `-linux-glibc2.17-x86_64.tar` and + `-linux-glibc2.17-x86_64.tar.gz`, + respectively. For example, if you used + `mysql-8.0.33-el7-x86_64.tar` to install or + upgrade to MySQL 8.0.33, you should use + `mysql-8.0.34-linux-glibc2.17-x86_64.tar` for + installing or upgrading to MySQL 8.0.34. + + The naming change reflects the fact that these binaries are + intended to be compatible with any Linux system using + `glibc2.17` or newer; this includes Enterprise + Linux 7, EL8, and EL9. +* Binary packages that include curl rather than linking to the + system curl library have been upgraded to use curl 8.1.2. + (Bug #35329529) + +### Bugs Fixed + +* **Important Change:** + The default value of the + [`connection_memory_chunk_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_connection_memory_chunk_size) + server system variable, when introduced in MySQL 8.0.28, was + mistakenly set at 8912. This fix changes the default to 8192, + which is the value originally intended. + (Bug #35218020) +* **NDB Cluster:** + The fix for a previous issue introduced a slight possibility of + unequal string values comparing as equal, if any Unicode 9.0 + collations were in use, and the collation hash methods + calculated identical hash keys for two unequal strings. + (Bug #35168702) + + References: See also: Bug #27522732. This issue is a regression of: Bug #30884622. +* **InnoDB:** + Purging a large number of system threads sometimes led to + congestion. + (Bug #35289390, Bug #110685) +* **InnoDB:** + `ddl::Aligned_buffer()` now uses the standard + memory allocator rather than kernel memory management. + (Bug #35194732, Bug #110411) +* **InnoDB:** + An upgrade from MySQL 5.7 to MySQL 8.0.32 or 8.0.33 sometimes + failed due to use of the deprecated system variables + `innodb_log_file_size`, + `innodb_log_files_in_group`, or both. To work + around this problem prior to upgrading to MySQL 8.0.34, start + the server with + [`--innodb-redo-log-capacity=206158430208`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_redo_log_capacity). + (Bug #35155280) +* **InnoDB:** + Changes in hashing functions made in MySQL 8.0.30 had an adverse + effect on performance. + (Bug #34870256) +* **InnoDB:** + The rules used for aggregating entries in the redo log have been + improved. + (Bug #34752625, Bug #108944) +* **InnoDB:** + In some cases, tablespace deletion caused issues with the buffer + pool. + (Bug #34330475, Bug #107689) +* **Packaging; Group Replication:** + The group replication plugin from the Generic Linux packages did + not load on some platforms that lacked a compatible version of + `tirpc`. + (Bug #35323208) +* **Replication:** + Changes in [`session_track_gtids`](/doc/refman/8.0/en/server-system-variables.html#sysvar_session_track_gtids) + were not always propagated correctly. + (Bug #35401212) +* **Replication:** + By design, all DDL operations (including binary log operations + such as purging the binary log) acquire a shared lock on the + `BACKUP_LOCK` object, which helps to prevent + simultaneous backup and DDL operations. For binary log + operations, we checked whether any locks existed on + `BACKUP_LOCK` but did not check the types of + any such locks. This caused problems due to the fact that binary + log operations should be prevented only when an exclusive lock + is held on the `BACKUP_LOCK` object, that is, + only when a backup is actually in progress, and backups should + be prevented when purging the binary log. + + Now in such cases, instead of checking for locks held on the + `BACKUP_LOCK` object, we acquire a shared lock + on `BACKUP_LOCK` while purging the binary log. + (Bug #35342521) +* **Replication:** + In all cases except one, when **mysqlbinlog** + encountered an error while reading an event, it wrote an error + message and returned a nonzero exit code, the exception being + for the active binary log file (or any binary log where the + format\_description\_log\_event had the + `LOG_EVENT_BINLOG_IN_USE_F` flag set), in which + case it did not write a message, and returned exit code 0, thus + hiding the error. + + Now **mysqlbinlog** suppresses only those errors + which are related to truncated events, and when doing so, prints + a comment rather than an error message. This fix also improves + the help text for the + [`--force-if-open`](/doc/refman/8.0/en/mysqlbinlog.html#option_mysqlbinlog_force-if-open) option. + (Bug #35083373) +* **Replication:** + Compressed binary log event handling was improved. + (Bug #33666652) +* **Replication:** + A transaction consisting of events each smaller than 1 GiB, but + whose total size was larger than 1 GiB, and where compression + did not make it smaller than 1 GiB, was still written to the + binary log as one event bigger than 1 GiB. This made the binary + log unusable; in effect, it was corrupted since neither the + server nor other tools such as **mysqlbinlog** + could read it. + + Now, when the compressed data grows larger than 1 GiB, we fall + back to processing the transaction without any compression. + (Bug #33588473) +* **Group Replication:** + In a group replication setup, when there was a source of + transactions other than the applier channel, the following + sequence of events was possible: + + 1. Several transactions being applied locally were already + certified, and so were associated with a ticket, which we + refer to as Ticket 2, but had not yet been committed. These + could be local or nonlocal transactions. + 2. A view is created with Ticket 3, and must wait on + transactions from Ticket 2. + 3. The view change (VC1) entered the GR applier channel applier + and waited for the ticket to change to 3. + 4. Another group change, and another view change (VC2), + occurred while the transactions from Ticket 2 were still + completing. + + This gave rise to the following issue: There was a window + wherein the last transaction from Ticket 2 had already marked + itself as being executed but had not yet popped the ticket; VC2 + popped the ticket instead but never notified any of the + participants. This meant that VC1 continued to wait indefinitely + for the ticket to change, and with the additional effect that + the worker could not be killed. + + We fix this by checking for the need to break each second so + that this loop is responsive to changes in the loop condition; + we also register a new stage, so that the loop is more + responsive to kill signals. + (Bug #35392640) + + References: See also: Bug #35206392, Bug #35374425. +* **Group Replication:** + Removed a memory leak discovered in + `Network_provider_manager::open_xcom_connection()`. + (Bug #34991101) +* **Group Replication:** + When a group action was sent to the group and the connection was + killed on the coordinator, group members were in different + states, with members which received the coordinated action + waiting for the member that executed it, and the member which + started execution having nothing to process, which caused + problems with coordination of the group. + + Now in such cases, we prevent this issue from occurring by + causing group actions to wait until all members have completed + the action. + (Bug #34815537) +* **Group Replication:** + Cleanup of resources used by OpenSSL connections created + indirectly by group replication was not carried out as expected + at all times. We fix this by adding cleanup functionality that + can be called at any time such connections are created by group + replication. + (Bug #34727136) +* **JSON:** + When the result of [`JSON_VALUE()`](/doc/refman/8.0/en/json-search-functions.html#function_json-value) + was an empty string and was assigned to a user variable, the + user variable could in some cases be set to + `NULL` instead, as shown here: + + ```None + mysql> SELECT JSON_VALUE('{"fname": "Joe", "lname": ""}', '$.lname') INTO @myvar; + Query OK, 1 row affected (0.01 sec) + + mysql> SELECT @myvar = '', @myvar IS NULL; + +-------------+----------------+ + | @myvar = '' | @myvar IS NULL | + +-------------+----------------+ + | NULL | 1 | + +-------------+----------------+ + 1 row in set (0.00 sec) + ``` + + With this fix, the query just shown now returns `(1, + 0)`, as expected. + (Bug #35206138) +* **JSON:** + Some JSON schemas were not always processed correctly by + [`JSON_SCHEMA_VALID()`](/doc/refman/8.0/en/json-validation-functions.html#function_json-schema-valid). + (Bug #109296, Bug #34867398) +* In rare cases, MySQL server could exit rather than emit an error + message as expected. + (Bug #35442407) +* The internal resource-group enhancement added in MySQL 8.0.31 + and refactored in MySQL 8.0.32 is now reverted. + (Bug #35434219) + + References: Reverted patches: Bug #34702833. +* An in-place upgrade from MySQL 5.7 to MySQL 8.0, without a + server restart, could result in unexpected errors when executing + queries on tables. This fix eliminates the need to restart the + server between the upgrade and queries. + (Bug #35410528) +* A fix in MySQL 8.0.33 made a change for `ORDER + BY` items already resolved so as not to resolve them + again (as is usually the case when a derived table is merged), + but this did not handle the case in which an `ORDER + BY` item was itself a reference. + (Bug #35410465) + + References: This issue is a regression of: Bug #34890862. +* Changes in [`session_track_gtids`](/doc/refman/8.0/en/server-system-variables.html#sysvar_session_track_gtids) + were not always handled correctly. + (Bug #35401212) +* Some pointers were not always released following statement + execution. + (Bug #35395965) +* Some instances of subqueries within stored routines were not + always handled correctly. + (Bug #35377192) +* Fortified parsing of the network packet data sent by the server + to the client. + (Bug #35374491) +* Encryption enhancements now strengthen compliance and remove the + use of deprecated APIs. + (Bug #35339886) +* When a column reference given by table name and column name was + looked up in the function + `find_item_in_list()`, we ignored that the item + searched for might not have a table name, as it was not yet + resolved. We fix this by making an explicit check for a null + table name in the sought-after item. + (Bug #35338776) +* Deprecated the **lz4\_decompress** and + **zlib\_decompress** command-line utilities that + exist to support the deprecated **mysqlpump** + command-line utility. + (Bug #35328235) +* Queries using `LIKE '%...%'` ran more poorly + than in previous versions of MySQL. + (Bug #35296563) +* In `Bounded_queue::push()`, when + `Key_generator::make_sortkey()` returns + `UINT_MAX` (error), then no key has been + produced; now when this occurs, we no longer update the internal + queue. + + As part of this fix, `push()` now returns true + on error. + (Bug #35237721) +* The `authentication_oci` plugin is fixed to + allow federated and provisioned users to connect to a DB System + as a mapped Proxy User using an ephemeral key-pair generated + through the OCI CLI. + (Bug #35232697) +* Some queries using common table expressions were not always + processed correctly. + (Bug #35231475) +* The internal function + `compare_pair_for_nulls()` did not always set + an explicit return value. + (Bug #35217471) +* Removed the clang-tidy checks that clash with the MySQL coding + style. + (Bug #35208735) +* Some subqueries using `EXISTS` in both the + inner and outer parts of the query were not handled correctly. + (Bug #35201901) +* Rotated audit log files now always reset the ID value of the + bookmark to zero, rather than continuing the value from the + previous file. + (Bug #35200070) +* Errors were not always propagated correctly when evaluating + items to be sorted by filesort. + (Bug #35195181) + + References: See also: Bug #35145246. +* The fix for a previous issue with `ROLLUP` led + to a premature server exit in debug builds. + (Bug #35168639) + + References: This issue is a regression of: Bug #33830659. +* Simplified the implementation of + `Item_func_make_set::val_str()` to make sure + that we never try to reuse any of the input arguments, always + using the local string buffer instead. + (Bug #35154335, Bug #35158340) +* When transforming subqueries to a join with derived tables, with + the containing query being grouped, we created an extra derived + table in which to do the grouping. This process moved the + initial select list items from the containing query into the + extra derived table, replacing all of the original select list + items (other than subqueries, which get their own derived + tables) with columns from the extra derived table. + + This logic did not handle `DEFAULT` correctly + due to the manner in which default values were modelled + internally. This fix adds support for + `DEFAULT(expression)` + in queries undergoing the transform previously mentioned. This + fix also solves an issue with item names in metadata whereby two + occurrences of the same column in the select list were given the + same item name as a result of this same transform. + (Bug #35150085, Bug #35101169) +* A query of the form `SELECT * FROM t1 WHERE (SELECT a + FROM t2 WHERE t2.a=t1.a + ABS(t2.b)) > 0` should be + rejected with Subquery returns more than 1 + row, but when the + [`subquery_to_derived`](/doc/refman/8.0/en/switchable-optimizations.html#optflag_subquery-to-derived) + optimization was enabled, the transform was erroneously applied + and the query returned an incorrect result. + (Bug #35101630) +* Handling of certain potentially conflicting + [`GRANT`](/doc/refman/8.0/en/grant.html) statements has been + improved. + (Bug #35089304) +* A query using both [`MEMBER OF()`](/doc/refman/8.0/en/json-search-functions.html#operator_member-of) and + `ORDER BY DESC` returned only a partial result + set following the creation of a multi-valued index on a JSON + column. This is similar to an issue fixed in MySQL 8.0.30, but + with the addition of the `ORDER BY DESC` clause + to the prblematic query. + (Bug #35012146) + + References: See also: Bug #106621, Bug #33917625. +* The debug server asserted on certain operations involving + [`DECIMAL`](/doc/refman/8.0/en/fixed-point-types.html) values. + (Bug #34973932) +* All instances of adding and replacing expressions in the select + list when transforming subqueries to use derived tables and + joins have been changed so that their reference counts are + maintained properly. + (Bug #34927110) +* Index Merge (see [Index Merge Optimization](/doc/refman/8.0/en/index-merge-optimization.html)) + should favor ROR-union plans (that is, using RowID Ordered + Retrieval) over sort-union plans if they have similar costs, + since sort-union requires additionally sorting of the rows by + row ID whereas ROR-union does not. + + For each part of a `WHERE` clause containing an + `OR` condition, the range optimizer gets the + best range scan possible and uses all these range scans to build + an index merge scan (that is, a sort-union scan). If it finds + that all the best range scans are also ROR-scans, the range + optimizer always proposes a ROR-union scan because it is always + cheaper than a sort-union scan. Problems arose when the best + range scan for any one part of an `OR` + condition is not a ROR-scan, in which case, the range optimizer + always chose sort-union. This was true even in cases, where it + might be advantageous to choose a ROR-scan (even though it might + not be the best range scan to handle one part of the OR + condition), since this would eleminate any need to sort the rows + by row ID. + + Now, in such cases, when determining the best range scan, the + range optimizer also detects whether there is any possible + ROR-scan, and uses this information to see whether each part of + the `OR` condition has at least one possible + ROR-scan. If so, we rerun the range optimizer to obtain the best + ROR-scan for handling each part of the `OR` + condition, and to make a ROR-union path. We then compare this + cost with the cost of a sort-union when proposing the final + plan. + (Bug #34826692, Bug #35302794) +* Selecting from a view sometimes raised the error + Illegal mix of collations ... for operation + '=' when the collation used in the table or tables + from which the view definition selected did not match the + current session value of + [`collation_connection`](/doc/refman/8.0/en/server-system-variables.html#sysvar_collation_connection). + (Bug #34801210) +* Valid MySQL commands (`use` and + `status`) and C API functions + (`mysql_refresh`, + `mysql_stat`, + `mysql_dump_debug_info`, + `mysql_ping`, + `mysql_set_server_option`, + `mysql_list_processes`, and + `mysql_reset_connection`) could write an error + message to the audit log, even though running the command or + calling the function emitted no such error. + (Bug #33966181) +* Increased the maximum fixed array size to 8192 instead of 512. + This fixes an issue with **mysqladmin** extended + status requests, which can exceed 512 entries. + + Our thanks to Meta for the contribution. + (Bug #30810617) +* The **mysqldump** + `--column-statistics` option + attempted to select from + [`information_schema.column_statistics`](/doc/refman/8.0/en/information-schema-column-statistics-table.html) + against MySQL versions before 8.0.2, but this now generates the + warning column statistics not supported by the + server and sets the option to false. + + Our thanks to Meta for the contribution. + (Bug #28782417) +* The function used by MySQL to get the length of a directory name + was enhanced. + (Bug #28047376) +* Executing a query with an implicit aggregation should return + exactly one row, unless the query has a + `HAVING` clause that filters out the row, but a + query with a `HAVING` clause which evaluated to + `FALSE` sometimes ignored this, and returned a + row regardless. + (Bug #14272020) +* The presence of an unused window function in a query, along with + an `ORDER BY` that could have been eliminated, + led to an unplanned server exit. + (Bug #111585, Bug #35168639, Bug #35204224, Bug #35545377) + + References: This issue is a regression of: Bug #35118579. +* `ORDER BY` + [`RANDOM_BYTES()`](/doc/refman/8.0/en/encryption-functions.html#function_random-bytes) had no effect on + query output. + (Bug #111252, Bug #35148945, Bug #35457136) +* Fixed an issue which could occur when loading user-defined + functions. + (Bug #110576, Bug #35242734) +* Concurrent execution of `FLUSH STATUS`, + `COM_CHANGE_USER`, and `SELECT FROM + I_S.PROCESSLIST` could result in a deadlock. A similar + issue was observed for concurrent execution of + `COM_STATISTICS`, + `COM_CHANGE_USER`, and `SHOW + PROCESSLIST`. + + Our thanks to Dmitry Lenev for the contribution. + (Bug #110494, Bug #35218030) +* The **mysqldump** utility could generate invalid + INSERT statements for generated columns. + (Bug #110462, Bug #35208605) +* During optimization, range-select tree creation uses logic which + differs based on the left-hand side of the + `IN()` predicate. For a field item, each value + on the right-hand side is added to an OR tree to create the + necessary expression. In the case of a row item comparison + (example: `WHERE (a,b) IN ((n1,m1), (n2, m2), + ...)`), an expression in disjunctive normal form (DNF) + is needed. A DNF expression is created by adding an + `AND` tree with column values to an + `OR` tree for each set of RHS values, but + instead the `OR` tree was added to the + `AND` tree causing the tree merge to require + exponential time due to O(n2) runtime + complexity. + (Bug #108963, Bug #34758905) +* When using [`SELECT`](/doc/refman/8.0/en/select.html) to create a + table and the statement has an expression of type + [`GEOMETRY`](/doc/refman/8.0/en/spatial-type-overview.html), MySQL could generate an + empty string as the column value by default. To resolve this + issue, MySQL no longer generates default values for columns of + type `GEOMETRY` under these circumstances. Our + thanks to Tencent for the contribution. + (Bug #107996, Bug #34426943) +* For index skip scans, the first range read set an end-of-range + value to indicate the end of the first range, but the next range + read did not clear the stale end-of-range value and applies this + stale value to the current range. Since the indicated + end-of-range boundary had already been crossed in the previous + range read, this caused the reads to stop, causing multiple rows + to be missed in the result. + + We fix this by making sure in such cases that the old + end-of-range value is cleared. + (Bug #107460, Bug #34235624, Bug #34982949) diff --git a/corpus/changelog/mysql_releases/mysql_8035.md b/corpus/changelog/mysql_releases/mysql_8035.md new file mode 100644 index 0000000000000000000000000000000000000000..aace94f06476b4e20a1813a5a01d49904a1ff4b4 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8035.md @@ -0,0 +1,438 @@ +# MySQL 8.0.35 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-35.html +Version: 8.0.35 + +## Changes in MySQL 8.0.35 (2023-10-25, General Availability) + +* [Audit Log Notes](news-8-0-35.html#mysqld-8-0-35-audit-log "Audit Log Notes") +* [Authentication Notes](news-8-0-35.html#mysqld-8-0-35-authentication "Authentication Notes") +* [C API Notes](news-8-0-35.html#mysqld-8-0-35-capi "C API Notes") +* [Compilation Notes](news-8-0-35.html#mysqld-8-0-35-compiling "Compilation Notes") +* [Deprecation and Removal Notes](news-8-0-35.html#mysqld-8-0-35-deprecation-removal "Deprecation and Removal Notes") +* [SQL Function and Operator Notes](news-8-0-35.html#mysqld-8-0-35-functions-operators "SQL Function and Operator Notes") +* [Packaging Notes](news-8-0-35.html#mysqld-8-0-35-packaging "Packaging Notes") +* [Security Notes](news-8-0-35.html#mysqld-8-0-35-security "Security Notes") +* [Functionality Added or Changed](news-8-0-35.html#mysqld-8-0-35-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-35.html#mysqld-8-0-35-bug "Bugs Fixed") + +### Audit Log Notes + +* Added the new + `audit_log_filter_uninstall.sql` script to + simplify removing MySQL Enterprise Audit. For information about this plugin, + see [MySQL Enterprise Audit](/doc/refman/8.0/en/audit-log.html). + (Bug #35611072) + +### Authentication Notes + +* The pluggable FIDO authentication method is deprecated and + subject to removal in a future MySQL release. + (WL #15006) + +### C API Notes + +* Earlier distributions, such as MySQL 5.1 and MySQL 5.0, included + servers that did not advertise pluggable authentication. When a + newer client using any pluggable authentication method attempted + to connect to one of these older servers, the server emitted a + “bad handshake” error message. This fix now ensures + that client-side authentication (specifically, the + `--default-auth` option) works + properly for all servers, including those that do not support + pluggable authentication. In addition, + `mysql_native_password` now replaces + `caching_sha2_password` as the default + authentication method when the server does not support pluggable + authentication. + (Bug #90994, Bug #28082093) +* The [`mysql_ssl_set()`](/doc/c-api/8.0/en/mysql-ssl-set.html) C API + function is deprecated and subject to removal in a future MySQL + release. There are equivalent + [`mysql_options()`](/doc/c-api/8.0/en/mysql-options.html) TLS options for + all [`mysql_ssl_set()`](/doc/c-api/8.0/en/mysql-ssl-set.html) parameters. + (WL #11091) + +### Compilation Notes + +* Fixed the + [`WITH_DEVELOPER_ENTITLEMENTS`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_developer_entitlements) macOS + CMake option; it did not activate due to a typo. + (Bug #35374026) +* Fixed a string concatenation warning produced when compiling + with Clang 12. + (Bug #111614, Bug #35549962) +* Made additional improvements to + [`WITH_ZLIB`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_zlib) functionality. + + Thanks to Nikolai Kostrigin for the contribution. + (Bug #111549, Bug #35534309) +* Building with WITH\_PROTOBUF=system failed with Protobuf 22 or + newer due to Protobuf 22 adding the Abseil dependency. + (Bug #111469, Bug #111623, Bug #35546459, Bug #35550389) +* Building with [`WITH_ZLIB`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_zlib)="system" + would break the MySQL build as it failed to find ZLIB. + + Our thanks to Meng-Hsiu Chiang and the team at Amazon for + contributing to this fix. + (Bug #111467, Bug #35511210) + + References: This issue is a regression of: Bug #35057542. +* On EL7 aarch64-based platforms, fixed an issue related to how + fetching the CPU cache line size returned 0 that caused the + MySQL server to unexpectedly halt. + (Bug #110752, Bug #35479763) + + References: See also: Bug #107081, Bug #34095278. +* The C++ Standardization Committee's Library Working Group + recently resolved an issue + ([LWG-3865 + *Sorting a range of pairs*](https://cplusplus.github.io/LWG/issue3865)) which + changes how the comparison operators are defined for + `std::pair`. This fix updates the equality + operator used in two files in `sql/auth` to + align with this change. + + Based on a suggestion by the Microsoft Visual Studio team. + (Bug #110254, Bug #35137978) + +### Deprecation and Removal Notes + +* **Replication:** + The `binlog_transaction_dependency_tracking` + server system variable is now deprecated, and subject to removal + in a future version of MySQL. Setting or retrieving the value of + this variable now triggers a warning, as does using the + equivalent startup option + `--binlog-transaction-dependency-tracking`. + Applications depending on this variable (or option) should begin + migrating away from it as soon as possible. No replacement for + this variable or its functionality is planned or needed. + (WL #13964) +* The `old` and `new` server + system variables are now deprecated, and a warning is now issued + whenever either of these variables is set or read. Expect these + variables are to be removed in a future version of MySQL; + applications which rely on them should migrate away from such + dependencies as soon as possible. + (WL #8609) +* The `--character-set-client-handshake` server + option, originally intended for use with upgrades from very old + versions of MySQL, is now deprecated, and a warning is issued + whenever it is used. You should expect this option to be removed + in a future version of MySQL; applications depending on this + option should begin migration away from it as soon as possible. + (WL #13220) +* Two changes in this release affect granting of privileges in + MySQL. One of these changes impacts database grants; the other + concerns host names used in grants. These changes are listed + here: + + 1. **Database-level grants.** + The use of the characters `%` and + `_` as wildcards in database-level grants + is now deprecated, and you should expect for this wildcard + functionality to be removed in a future MySQL release. The + intent is for these characters always to be treated as + literals, as they are already whenever the value of the + [`partial_revokes`](/doc/refman/8.0/en/server-system-variables.html#sysvar_partial_revokes) server + system variable is `ON`. + + For example, with `partial_revokes` set to + `ON`, `GRANT SELECT ON db_.* TO + user1` allows `user1` to select + from any table in a database named `db_`, + but does *not* allow + `user1` to select from tables in databases + `db1`, `db2`, + `dbx`, `dby`, and so on. + You should expect this always to be the case once support + for wildcards in database names in grants is removed. + 2. **Host name '%' in grants.** + The treatment of `%` by the server as a + synonym for `localhost` when checking + privileges is now also deprecated and thus also subject to + removal in a future version of MySQL. + + Currently, privileges granted to + `'user1'@'%'` are also granted to + `'user1'@'localhost'`. This automatic + assignment is now deprecated; once the behavior is removed, + it will be necessary always to grant privileges to + `'user1'@'localhost'` explicitly, using the + `localhost` host name. + + Note + + In both of the cases listed, no warnings or errors are raised + in the user session or logs, since doing so could very quickly + produce a great many such messages. + + (WL #14280, WL #15676) +* [`INFORMATION_SCHEMA.PROCESSLIST`](/doc/refman/8.0/en/information-schema-processlist-table.html) is + deprecated and subject to removal in a future MySQL release. As + such, the implementation of [`SHOW + PROCESSLIST`](/doc/refman/8.0/en/show-processlist.html) which uses that table is also deprecated. + + It is recommended to use the Performance Schema implementation + of [`SHOW PROCESSLIST`](/doc/refman/8.0/en/show-processlist.html) instead. As + such, + [`performance_schema_show_processlist`](/doc/refman/8.0/en/performance-schema-system-variables.html#sysvar_performance_schema_show_processlist) + is also deprecated and subject to removal in a future MySQL + release. + (WL #15915) +* Support for the `TLS_AES_128_CCM_8_SHA256` + ciphersuite now is deprecated and subject to removal in a future + version of MySQL. Any attempt to set it using either the + [`tls_ciphersuites`](/doc/refman/8.0/en/server-system-variables.html#sysvar_tls_ciphersuites) or + [`admin_tls_ciphersuites`](/doc/refman/8.0/en/server-system-variables.html#sysvar_admin_tls_ciphersuites) system + variable now returns a warning. By default, both system + variables accept these ciphersuites: + + + `TLS_AES_128_GCM_SHA256` + + `TLS_AES_256_GCM_SHA384` + + `TLS_CHACHA20_POLY1305_SHA256` + + `TLS_AES_128_CCM_SHA256` + + Several previously supported ciphers now are deprecated and + subject to removal in a future version of MySQL. If the + deprecated ciphers are specified using either the + [`ssl_cipher`](/doc/refman/8.0/en/server-system-variables.html#sysvar_ssl_cipher) or + [`admin_ssl_cipher`](/doc/refman/8.0/en/server-system-variables.html#sysvar_admin_ssl_cipher) system + variable, then a warning now is issued. The following ciphers + continue to be supported without emitting a deprecation warning: + + + `ECDHE-ECDSA-AES128-GCM-SHA256` + + `ECDHE-ECDSA-AES256-GCM-SHA384` + + `ECDHE-RSA-AES128-GCM-SHA256` + + `ECDHE-RSA-AES256-GCM-SHA384` + + `ECDHE-ECDSA-CHACHA20-POLY1305` + + `ECDHE-RSA-CHACHA20-POLY1305` + + `ECDHE-ECDSA-AES256-CCM` + + `ECDHE-ECDSA-AES128-CCM` + + `DHE-RSA-AES128-GCM-SHA256` + + `DHE-RSA-AES256-GCM-SHA384` + + `DHE-RSA-AES256-CCM` + + `DHE-RSA-AES128-CCM` + + `DHE-RSA-CHACHA20-POLY1305` + + (WL #15800) + +### SQL Function and Operator Notes + +* The [`STR_TO_DATE()`](/doc/refman/8.0/en/date-and-time-functions.html#function_str-to-date) function did + not perform complete range checking on the string to be + converted, so that it was possible to pass to it a string which + would yield an invalid date, such as + `'2021-11-31'`. + (Bug #108782, Bug #34704094) + +### Packaging Notes + +* On Windows, the MSI package definition files were updated to + work with the Windows Installer XML (WiX) toolset version 4. + Note that they can no longer be used with previous versions of + the toolset. + (Bug #35613791) +* The bundled `libedit` library was upgraded to + version 20221030-3.1. + (Bug #35489173) + +### Security Notes + +* Binary packages that include curl rather than linking to the + system curl library have been upgraded to use curl 8.4.0. + Important issues fixed in curl version 8.4.0 are described at + . + (Bug #35897778) + + References: See also: Bug #35709229. + +### Functionality Added or Changed + +* **Incompatible Change:** + Upgraded the bundled libfido2 library to libfido2 v1.13.0. This + libfido2 version requires OpenSSL 1.1.1 or higher, which means + the authentication\_fido and authentication\_fido\_client + authentication plugins are no longer available on the following + platforms: Enterprise Linux 6 and 7, Solaris 11, and SLES 12. + (Bug #35685515) +* **Important Change; Group Replication:** + Version requirements for groups are relaxed beginning with this + release, as follows: + + + A server running any MySQL 8.0 release of version 8.0.35 + *or newer* can join the same group. + + A group member running any MySQL 8.0 release *newer + than* 8.0.35 can be downgraded in place to the + previous release. + + This change does not affect the requirement that, when selected, + the primary must be running the lowest MySQL version present in + the group; this remains true whether this is automatic, or is + performed by executing + [`group_replication_set_as_primary()`](/doc/refman/8.0/en/group-replication-functions-for-new-primary.html#function_group-replication-set-as-primary). + (Bug #35397276) +* **Important Change:** + For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 3.0.10. Issues fixed in OpenSSL version 3.0.10 are described at + . + (Bug #35702863, Bug #35732474) + +### Bugs Fixed + +* **Performance:** + `records_in_range` performed an excessive + number of disk reads for insert operations. + + Our thanks to Facebook for the contribution. + (Bug #109595, Bug #34976138) +* **InnoDB:** + Fixed processing of single character tokens by a FTS parser + plugin. + + Our thanks to Shaohua Wang for the contribution. + (Bug #35432973) +* **InnoDB:** + On Windows, the redo log file was not flushed even with + [`innodb_flush_log_at_trx_commit=1`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_flush_log_at_trx_commit). + (Bug #112078, Bug #35713721) +* **InnoDB:** + Fixed a potential transaction rollback issue stemming from the + ALTER TABLE EXCHANGE PARTITIONS statement. + (Bug #110869, Bug #35352168) + + References: This issue is a regression of: Bug #33700835. +* **InnoDB:** + When creating full-text indexes spanning multiple columns, index + creation could fail with an error similar to "ERROR 1062 + (23000): Duplicate entry 'NULL-NULL'." + (Bug #109242, Bug #33542939, Bug #34846823) +* **InnoDB:** + The last detected deadlock section of the engine status log was + only showing 1024 characters for the combined thread and query + information. Fixing by removing the printed query string limit. + (Bug #80927, Bug #23036096) +* **Replication:** + Memory used by binary log compression was not instrumented. + (Bug #35290223) +* **Replication:** + To detect dependencies and conflicts among transactions, MySQL + Replication uses writesets which are extracted from keys that + are `NOT NULL` (primary keys by definition, as + well as unique and foreign keys which are `NOT + NULL`) whenever + [`binlog_format`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_format) is + `ROW` and + `transaction_write_set_extraction` is enabled + (the default in both cases). In the case of multi-column unique + keys using only the leading parts of column values (see + [Column Prefix Key Parts](/doc/refman/8.0/en/create-index.html#create-index-column-prefixes)), the writesets + were not properly generated, which sometimes led to spurious + duplicate key errors; this was due to the fact that the whole + values of referenced key columns were added to the writeset in + such cases, even though the keys themselves referenced only the + column prefix. + (Bug #111027, Bug #35404584) +* Following a change made in MySQL 8.0.23, in some cases where + [`GROUP_CONCAT()`](/doc/refman/8.0/en/aggregate-functions.html#function_group-concat) had previously + returned `NULL`, it did so no longer. + (Bug #35730982) + + References: This issue is a regression of: Bug #32053547. +* When no rows matched the `WHERE` condition of a + query, the results of the query as prepared (using + [`PREPARE`](/doc/refman/8.0/en/prepare.html)) differed from those of + the same query when run directly. + (Bug #35689804) +* Some queries using [`INTERSECT`](/doc/refman/8.0/en/intersect.html) were + not always processed correctly. + (Bug #35504625) + + References: See also: Bug #35362424. +* In some cases, the [`QUOTE()`](/doc/refman/8.0/en/string-functions.html#function_quote) + function returned binary data rather than the expected + `NULL`. + (Bug #35499232) +* Previously, executing + [`audit_log_rotate()`](/doc/refman/8.0/en/audit-log-reference.html#function_audit-log-rotate) manually could + cause the function to appear unresponsive when the output + performance was low, the workload on the server was heavy, and + the [`audit_log_strategy`](/doc/refman/8.0/en/audit-log-reference.html#sysvar_audit_log_strategy) system + variable had a write strategy of `ASYNCHRONOUS` + or `PERFORMANCE`. + (Bug #35397216) +* In some cases the [`QUOTE()`](/doc/refman/8.0/en/string-functions.html#function_quote) + function returned `NULL` even though it had + previously been resolved as non-nullable. + (Bug #35381715) + + References: See also: Bug #35145246, Bug #35195181. +* A previous fix in MySQL 8.0.30 for a stored program that was not + executed correctly following the first invocation did not cover + the case where it contained a [`SET`](/doc/refman/8.0/en/set.html) + statement. + + Our thanks to Hao Lu for the contribution. + (Bug #35328028) + + References: This issue is a regression of: Bug #33754993. +* An issue with stored functions was found to be a regression from + work done previously to improve internal functions that are used + in copying values between columns. + (Bug #35150382) + + References: This issue is a regression of: Bug #32742537. +* Some cached queries were not always handled correctly. + + Thanks to Nicholas Othieno and Amazon for the contribution. + (Bug #35105404, Bug #35511208) +* Updated the Kerberos library bundled with commercial builds to + version 1.21.2. + (Bug #35001935) +* Some inserts on tables with triggers were not always handled + correctly. + (Bug #34920120) + + References: See also: Bug #35178672, Bug #35195079. +* Some [`DESCRIBE`](/doc/refman/8.0/en/describe.html) statements using + `FORMAT = JSON` were not always processed + correctly, and sometimes raised assertions in debug builds. + (Bug #34909766) +* Some complex queries using multiple common table expressions + were not always handled correctly. + (Bug #34900334) + + References: This issue is a regression of: Bug #34377854. +* Some queries with window functions were not pushed down + correctly. + (Bug #34778435) +* Some complex queries using multiple common table expressions + were not always handled correctly. + (Bug #112021, Bug #35284734, Bug #35694546) + + References: See also: Bug #111994, Bug #35686058. This issue is a regression of: Bug #34377854. +* For Enterprise Linux, changed the krb5-devel build requirement + from commercial to all builds. + (Bug #111596, Bug #35546449) +* [`CREATE ROLE`](/doc/refman/8.0/en/create-role.html) and + [`DROP ROLE`](/doc/refman/8.0/en/drop-role.html) statements were not + handled correctly when checking for orphaned SQL objects. + (Bug #111303, Bug #35471453) +* `Clone_Snapshot::extend_and_flush_files()` + always created files of type + `OS_CLONE_DATA_FILE`. This function uses + `flush_redo()` to handle redo log files, which + must be of type `OS_CLONE_LOG_FILE`, which + could sometimes lead to errors in + `os_file_set_size()`. + + This problem is now fixed by ensuring that the type is set + correctly when creating the new file. + + Our thanks to Tencent for the contribution. + (Bug #110569, Bug #35240055) +* The low limit heuristic did not work well for `ORDER BY + DESC` due to choosing the wrong index. + (Bug #107626, Bug #34306497) diff --git a/corpus/changelog/mysql_releases/mysql_8036.md b/corpus/changelog/mysql_releases/mysql_8036.md new file mode 100644 index 0000000000000000000000000000000000000000..e9c944c3641437da0d199b52a51a53867ee0d5ba --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8036.md @@ -0,0 +1,274 @@ +# MySQL 8.0.36 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-36.html +Version: 8.0.36 + +## Changes in MySQL 8.0.36 (2024-01-16, General Availability) + +* [Audit Log Notes](news-8-0-36.html#mysqld-8-0-36-audit-log "Audit Log Notes") +* [Compilation Notes](news-8-0-36.html#mysqld-8-0-36-compiling "Compilation Notes") +* [Optimizer Notes](news-8-0-36.html#mysqld-8-0-36-optimizer "Optimizer Notes") +* [Packaging Notes](news-8-0-36.html#mysqld-8-0-36-packaging "Packaging Notes") +* [Performance Schema Notes](news-8-0-36.html#mysqld-8-0-36-performance-schema "Performance Schema Notes") +* [Pluggable Authentication](news-8-0-36.html#mysqld-8-0-36-pluggable-auth "Pluggable Authentication") +* [Functionality Added or Changed](news-8-0-36.html#mysqld-8-0-36-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-36.html#mysqld-8-0-36-bug "Bugs Fixed") + +### Audit Log Notes + +* In some cases, calling + [`audit_log_read`](/doc/refman/8.0/en/audit-log-reference.html#function_audit-log-read)`(` + [`audit_log_read_bookmark`](/doc/refman/8.0/en/audit-log-reference.html#function_audit-log-read-bookmark)`() + )` led to an Out of memory + error. + (Bug #35957453) + +### Compilation Notes + +* **Microsoft Windows:** + MySQL did not compile correctly using Visual Studio 2022. + (Bug #35967676) +* Improved the `-DWITH_ZLIB=system` check. + (Bug #35968195) +* For compiling on Linux, changed the + `no-error=deprecated-declarations` flag to + `no-deprecated-declarations` for the OpenSSL 3 + library. + + Our thanks to karry zhang for the contribution. + (Bug #112209, Bug #35755328) + +### Optimizer Notes + +* The hashing algorithm employed yielded poor performance when + using a `HASH` field to check for uniqueness. + (Bug #109548, Bug #34959356) + +### Packaging Notes + +* **Important Change:** + The GnuPG build key (`A8D3785C`) used to sign + MySQL downloadable packages has been updated. The previous GnuPG + build key (`3A79BD29`) expired on 2023-12-14. + For information about verifying the integrity and authenticity + of MySQL downloadable packages using GnuPG signature checking, + or to obtain a copy of our public GnuPG build key, see + [Signature Checking Using GnuPG](/doc/refman/8.0/en/checking-gpg-signature.html). + + Due to the GnuPG key update, systems configured to use + `repo.mysql.com` may report a signature + verification error when upgrading to MySQL 8.0.36 and higher or + to MySQL 8.3.0 and higher using `apt` or + `yum`. Use one of the following methods to + resolve this issue: + + 1. Manually reinstall the MySQL APT or YUM repository setup + package from + . + 2. Download the MySQL GnuPG public key and add it your system + GPG keyring. + +### Performance Schema Notes + +* When executing a stored program, the Performance Schema + instrumentation caused some unnecessary overhead. + + As of this release, all stored procedure micro instructions + (`statement/sp/%`), except + `statement/sp/stmt`, are disabled by default. + (Bug #27934653) +* The performance of the Performance Schema statement + instrumentation has been improved. Specifically, collecting + `MESSAGE_TEXT` data is now more efficient. + (Bug #112621, Bug #35916912) + +### Pluggable Authentication + +* Beginning with this release, the behavior of the + `AUTHENTICATION_PAM_LOG` environment variable + used in debugging the PAM authentication plugin is changed as + follows: + + + Setting `AUTHENTICATION_PAM_LOG` to an + arbitrary value (except as noted in the next item) no longer + includes passwords in its diagnostic messages. + + To include passwords in the diagnostic messages, set + `AUTHENTICATION_PAM_LOG=PAM_LOG_WITH_SECRET_INFO`. + + For more information, see + [PAM Authentication Debugging](/doc/refman/8.0/en/pam-pluggable-authentication.html#pam-pluggable-authentication-debugging). + (Bug #74313, Bug #20042010) + +### Functionality Added or Changed + +* **Important Change:** + For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 3.0.12. Issues fixed in OpenSSL version 3.0.12 are described at + . + (Bug #36033684) + +### Bugs Fixed + +* **Performance; InnoDB:** + The hashing function used by the `InnoDB` + adaptive hash index became more expensive as an unintended + result of refactoring done in MySQL 8.0.30. + (Bug #111538, Bug #35531293) + + References: This issue is a regression of: Bug #81814, Bug #16739204, Bug #23584861. +* **InnoDB:** + The hash function used by the adaptive hash index (AHI) was + improved to increase performance. + (Bug #35449386) +* **InnoDB:** + If change buffer entries are present during startup, a disabled + [`innodb_validate_tablespace_paths`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_validate_tablespace_paths) + option will no longer be enforced and instead the MySQL server + will proceed to validate all tablespaces. Otherwise, secondary + indexes could end up corrupted. + (Bug #35208990) +* **InnoDB:** + During concurrent DDL and DML operations, DDL could fail if the + online log grew too large. Buffer handling was improved to + prevent this issue. + (Bug #35115601) +* **Replication:** + An issue with calculating the current number of bytes used for + `Log_event` events in Performance Schema memory + instrumentation made it appear as though the + `sql/replica_sql` thread on the replica grew + endlessly and never decreased in size. + (Bug #35546877) +* **Replication:** + Stopping replication while replicating `CREATE TABLE AS + SELECT` caused the server to exit. + (Bug #33934013) +* **Group Replication:** + A forced [`START GROUP_REPLICATION`](/doc/refman/8.0/en/start-group-replication.html) + while a replication channel was in an error state could lead to + an unplanned server exit. + (Bug #34724344) +* For building Enterprise Linux 8 RPMs, the build scripts now + point to a newer **strip** command (under + `/opt/rh/gcc-toolset-12`), and they now check + that the corresponding **dwz** tool is available. + (Bug #36086236) +* In some cases, calling a loadable function installed by an + improperly initialized plugin caused an unplanned shutdown. + (Bug #35889261) +* Found and fixed an assertion failure at + `handler::ha_index_end()` in + `handler.cc`. + (Bug #35877600) +* When the `MYSQL_FIREWALL` plugin failed to + initialize properly during server startup, this led to errors in + the server log and sometimes unplanned termination of + **mysqld**. + (Bug #35853298) +* Some nested queries with `GROUP BY` were not + handled correctly. + (Bug #35846402, Bug #35945822) + + References: This issue is a regression of: Bug #32918400. +* In limited cases, passing data to the + [`MD5()`](/doc/refman/8.0/en/encryption-functions.html#function_md5) encryption function could + halt the server. + (Bug #35764496) +* Some subselects from views were not always handled correctly. + (Bug #35738548) +* While performing an operation such as the bulk renaming of many + tables, simultaneously executing a data definition statement + similar to + [`CREATE + TABLE ... SELECT`](/doc/refman/8.0/en/create-table-select.html) could stop the server unexpectedly. + (Bug #35735937) +* [`UPDATE + HISTOGRAM`](/doc/refman/8.0/en/explain.html#explain-analyze) did not behave as expected in all cases. + + UPDATE HISTOGRAM did not behave as expected in all cases. + (Bug #35710404) +* [`EXPLAIN ANALYZE`](/doc/refman/8.0/en/explain.html#explain-analyze) did not always + produce the expected result. + (Bug #35710383) +* An error occurred during subquery resolution. + (Bug #35710373) + + References: This issue is a regression of: Bug #35184353. +* Refreshing of used table information is now postponed to the + start of the next execution, just after tables have been opened, + when we know that all table objects are in a proper state. + (Bug #35710213, Bug #36030073) +* Some `HAVING` queries did not produce expected + results. + (Bug #35710183) +* Some recursive CTEs did not function as expected. + (Bug #35654240) +* Some queries using `OVER (PARTITION ...)` were + not always executed successfully. + (Bug #35627798) +* Some subqueries with `ROLLUP` were not always + handled correctly. + (Bug #35621842, Bug #35804794) +* Removed the + `CPACK_COMPONENT_GROUP_INFO_DISPLAY_NAME` + configuration option from the Windows installation MSI + interface. Now the `INFO_BIN` and + `INFO_SRC` files are always installed. + (Bug #35529968) +* Some queries using windowing functions were not always handled + correctly. + (Bug #35471471) +* In debug builds, a case-altered column name could cause the + server to exit. + (Bug #35449266) +* MySQL Server installation packages contained two copies of the + `INFO_SRC` file. + (Bug #35400142) +* A [`SELECT`](/doc/refman/8.0/en/select.html) statement within a + prepared statement unexpectedly returned different results on + successive executions. + (Bug #35340987, Bug #35846585, Bug #35846873) + + References: This issue is a regression of: Bug #35060385. +* Some `SELECT DISTINCT` queries were not always + handled correctly. + (Bug #33725447) +* Removed an assertion failure in + `sql/field.cc`. + (Bug #112503, Bug #35846221) +* Sme queries having the form `SELECT AVG(...) OVER + (PARTITION BY ...)` were not always handled correctly. + (Bug #112460, Bug #35710179, Bug #35845413) +* Upgrading MySQL using an official MySQL Yum or SUSE repository + always enables the MySQL service. Now it enables the service + only after installing, and preserves (and does not edit) the + existing value while upgrading. + (Bug #112382, Bug #35823558) +* For a query with a derived condition pushdown where a column in + the condition needs to be replaced, a matching item could not + found, even when known to be present, when the replacement item + was wrapped in a `ROLLUP` while the matching + item was not. + (Bug #111665, Bug #35498378, Bug #35570065, Bug #35826171) + + References: This issue is a regression of: Bug #33349994. +* Ordering a nested block where the `ORDER BY` + contained a window function raised an assert in + `sql/sql_executor.cc`. + (Bug #111306, Bug #34856256, Bug #35471522) +* Performing an arithmetic operation on the result over a window + function in a stored procedure gave the correct result the first + time the procedure was executed, but returned an incorrect + result on all subsequent invocations. + (Bug #110983, Bug #35380604) + + References: See also: Bug #110847, Bug #35340987. +* MySQL did not build correctly using the `musl` + version of `libc`. + + Our thanks to Sam James for the contribution. + (Bug #110808, Bug #35330950) +* In some cases, selecting from a view leaked a small amount of + memory. + (Bug #103133, Bug #32764586) diff --git a/corpus/changelog/mysql_releases/mysql_8037.md b/corpus/changelog/mysql_releases/mysql_8037.md new file mode 100644 index 0000000000000000000000000000000000000000..742228fdd414b4844260f2ae9113472d58ba7edf --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8037.md @@ -0,0 +1,457 @@ +# MySQL 8.0.37 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-37.html +Version: 8.0.37 + +## Changes in MySQL 8.0.37 (2024-04-30, General Availability) + +* [Audit Log Notes](news-8-0-37.html#mysqld-8-0-37-audit-log "Audit Log Notes") +* [Character Set Support](news-8-0-37.html#mysqld-8-0-37-charset "Character Set Support") +* [Compilation Notes](news-8-0-37.html#mysqld-8-0-37-compiling "Compilation Notes") +* [Component Notes](news-8-0-37.html#mysqld-8-0-37-components "Component Notes") +* [Optimizer Notes](news-8-0-37.html#mysqld-8-0-37-optimizer "Optimizer Notes") +* [Performance Schema Notes](news-8-0-37.html#mysqld-8-0-37-performance-schema "Performance Schema Notes") +* [Functionality Added or Changed](news-8-0-37.html#mysqld-8-0-37-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-37.html#mysqld-8-0-37-bug "Bugs Fixed") + +### Audit Log Notes + +* MySQL now calls `plugin->deinit()` with a + valid plugin struct as an argument regardless of the + plugin's type. + + Our thanks to Martin Alderete for the contribution. + +### Character Set Support + +* When the [`character_set_server`](/doc/refman/8.0/en/server-system-variables.html#sysvar_character_set_server) + system variable was set using + [`SET + PERSIST`](/doc/refman/8.0/en/set-variable.html) or `SET GLOBAL`, it did not + take effect for new client sessions or for a client establishing + a connection to the server after the server was restarted. The + only workaround was to set the corresponding command-line option + when starting the server. + + To fix this, we now make sure that, at the time of server + restart, the configuration data is read in the correct order so + that the variable setting takes effect as expected. + (Bug #35529604) + +### Compilation Notes + +* Warnings for unused variables are turned into compilation errors + when compiling with + [`-DMYSQL_MAINTAINER_MODE=1`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_mysql_maintainer_mode). To + avoid this use `-DMYSQL_MAINTAINER_MODE=0` to + disable such errors. + (Bug #113662, Bug #36198423) +* Improved the cycle timer for the s390x architecture. + + Our thanks to Jonathan Albrecht for the contribution. + (Bug #112845, Bug #35949958) + +### Component Notes + +* The values for component options set using the + `--loose` prefix were not read when the component + was installed. + (Bug #28341329) + +### Optimizer Notes + +* The multi-range read (MRR) optimization did not perform as well + as in previous releases. + (Bug #113711, Bug #36220640) + +### Performance Schema Notes + +* User variables assigned decimal values were rounded up in the + [`user_variables_by_thread`](/doc/refman/8.0/en/performance-schema-user-variable-tables.html) table. + (Bug #35781732) +* Executing `SELECT * from + performance_schema.data_locks` on a server under heavy + load could cause MySQL to consume too much memory and close + unexpectedly. + + As of this release, memory used executing such a query is now + instrumented with + `memory/performance_schema/data_container`, + enabling you to observe memory consumption. + (Bug #35240825) +* Executing `SELECT * from + performance_schema.data_locks` on a server under heavy + load could cause a deadlock in InnoDB. + (Bug #35068461) + + References: See also: Bug #35240825. + +### Functionality Added or Changed + +* **Important Change; Group Replication:** + When issued with + [`group_replication_consistency`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_consistency) + set to `BEFORE_ON_PRIMARY_FAILOVER`, the MySQL + [`KILL`](/doc/refman/8.0/en/kill.html) statement now ignores any + consistency guarantees, with any interrupted transactions now + being rolled back. +* **Important Change:** + For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 3.0.13. Issues fixed in OpenSSL version 3.0.13 are described at + . + (Bug #36261675) +* **Packaging:** + Added support for Fedora 40 and Ubuntu 24.04. +* **Microsoft Windows:** + MySQL Windows binary files (`.exe` and + `.dll` files) now display additional + information when their properties are viewed. + (Bug #36379291) +* Clone plugin version requirements have been relaxed to allow + cloning between different point releases in the same series. In + other words, only the major and minor version numbers must match + when previously the release number also had to match. + + For example, cloning of MySQL 8.0.37 to (a future) MySQL 8.0.42, + or the reverse, is supported. Previous restrictions still apply + to versions older than 8.0.37, for example, so cloning of MySQL + 8.0.36 to any other MySQL release (or from a different MySQL + release to 8.0.36) remains unsupported. + + For more information, see [The Clone Plugin](/doc/refman/8.0/en/clone-plugin.html). + (Bug #36293529, WL #15989) + +### Bugs Fixed + +* **Important Change:** + The Robin Hood hashing library has been replaced with + `unordered_dense`. + (Bug #36158022) +* **InnoDB; Microsoft Windows:** + Improved redo log performance on Windows by opening redo log + files in overlapped mode. + (Bug #36154818) + + References: This issue is a regression of: Bug #12527. +* **InnoDB:** + The log writer calls functions that temporarily release + `log.writer_mutex`; when + [`innodb_log_writer_threads=OFF`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_log_writer_threads), + this potentially led to other threads writing to the redo log in + between these times. + (Bug #36425219) +* **InnoDB:** + Some FTS operations on tables with FTS indexes led to + inconsistent results. For example, if the server terminated + while synchronizing the FTS cache or when synchronization + occurred concurrently with another FTS operation. + + Our thanks to Yin Peng and the Tencent team for the + contribution. + (Bug #36347647) +* **InnoDB:** + When creating an index on a table containing data, + `valgrind` occasionally reported reads of + uninitialized memory from + `ddl::Builder::bulk_add_row()`. + (Bug #36342792) +* **InnoDB:** + Fixed an issue relating to the merge sort buffer. + (Bug #36319083) +* **InnoDB:** + On Windows, keeping a file open without a shared write lock and + attempting to acquire the `fil_shard` mutex + caused a deadlock with another thread that had acquired the + `fil_shard` mutex and was attempting to access + the same file. + (Bug #36159317) + + References: See also: Bug #32808809. +* **InnoDB:** + Fixed a potential redo log rotation issue that could emit a + "Found existing redo log files, but at least one is missing" + error during recovery. + (Bug #36124625) +* **InnoDB:** + Improved `os_innodb_umask` handling, and made + it read-only. + (Bug #35932118) + + References: This issue is a regression of: Bug #29472125. +* **InnoDB:** + Found and fixed an assertion failure related to full-text + indexes. + (Bug #35836581) +* **InnoDB:** + Improved buffer handling during the tablespace deletion process, + a situation that could have potentially caused an assertion + failure. + (Bug #35676106, Bug #36343647) +* **InnoDB:** + If a MySQL table in a system schema had an INSTANT ADD column + that was added before 8.0.29 (they are not allowed as of that + version), and after MySQL was upgraded to a version greater than + 8.0.29, DMLs on these tables would result in the server + unexpectedly closing. + + Our thanks to Richard Dang for the contribution. + (Bug #35625510, Bug #35981565, Bug #36180360) +* **InnoDB:** + The redo log would potentially not log a column order change + with instant DDL, which could cause an incorrect log replay + during recovery. + (Bug #35183686) +* **InnoDB:** + Results for [`SHOW + ENGINE INNODB STATUS`](/doc/refman/8.0/en/show-engine.html) showed an invalid value + (`NULL`) as the name of the first thread in the + `File IO` section. + (Bug #113819, Bug #36118112) + + References: This issue is a regression of: Bug #34992157. +* **InnoDB:** + With + [`innodb_parallel_read_threads`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_parallel_read_threads) + set to a value greater than 1, + [`InnoDB`](/doc/refman/8.0/en/innodb-storage-engine.html) unnecessarily disabled + read-ahead heuristics which resulted in stalls when pages were + not already in the buffer pool. + (Bug #113482, Bug #36142806) +* **InnoDB:** + Running a query that used a unique hash index with the TempTable + storage engine could take significantly more time compared to + running the query with the MEMORY engine. + + Our thanks to xiaoyang chen for the contribution. + (Bug #113178, Bug #36037224, Bug #36224958) +* **InnoDB:** + In debug builds, there was an assertion failure in InnoDB's + background when a transaction it wanted to acquire an MDL lock + on was no longer active. + + This fix is based on a patch from Genze Wu with Alibaba, thank + you for the contribution. + (Bug #112424, Bug #35835864) + + References: This issue is a regression of: Bug #33700835. +* **InnoDB:** + With + [`innodb_parallel_read_threads`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_parallel_read_threads) + set to a value greater than 1, InnoDB would unnecessarily + request asynchronous reads which required more synchronization + during I/O completion and created a bottleneck due to the + limited number of available threads + ([`innodb_read_io_threads`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_read_io_threads)) for + handling I/O operations. Now this performs synchronous instead + of asynchronous reads. + (Bug #112137, Bug #35740866) +* **InnoDB:** + A trx would unexpectedly halt after encountering an incorrect + trx->in\_innodb value. + + Our thanks to Shaohua Wang for the contribution. + (Bug #110652, Bug #35277407) +* **InnoDB:** + `SELECT ... GROUP BY` queries were at least + twice as slow with the TempTable engine than the Memory engine. + (Bug #107700, Bug #34338001) +* **InnoDB:** + MySQL no longer ignores the optimizer hint to use a secondary + index scan, which instead forced a clustered (parallel) index + scan. + (Bug #100597, Bug #112767, Bug #31791868, Bug #35952353) +* **Group Replication:** + Problems arose when members `M1` and + `M2` were in a group, with + `M1` using `u1` as its + recovery user and `M2` using + `u2` as its own recovery user, and both users + `u1` and `u2` existing on + `M1` and `M2` with all + necessary privileges, and when a new member + `M3` joined the group using + `u2` as its recovery user. + `M3` knew only of user `u2`, + but did not know of user `u1`, leading + [`START GROUP REPLICATION`](/doc/refman/8.0/en/start-group-replication.html) on + `M2` to be rejected since `M1` + was unable to connect to `M2`. This also + generated a new `view_id` listing the group + members as `M1` and `M2`, but + `M1` nevertheless continued trying to connect + to `M3`, with `M1` logging + Error in establishing mysql connection + and M3 logging Access denied errors for + the connection attempts from `M1`. + + By design, XCom stores the last three known configurations, + including references to physical connections shared among all + past and present configurations. This is done to facilitate + quick reconnections by nodes rejoining the group, explicitly or + implicitly, and that were already present in any of those + configurations. + + A side effect of this was that we might keep attempting to + connect to a node that was currently not in the group. To solve + this problem, we inhibit error logging if the node is not in the + current configuration, in order to avoid false negatives which + might lead a DBA or an operator to think mistakenly that there + is a problem in the system. + (Bug #36210988) + + References: See also: Bug #32592027. +* **Group Replication:** + Improved handling of GTID sets. + (Bug #36093405) +* **Group Replication:** + Two cases were found in which a member exited the group and + moved to the `ERROR` state, but did not honor + the action specified by + [`group_replication_exit_state_action`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_exit_state_action); + these are listed here: + + + When an error occurred while enabling + [`super_read_only`](/doc/refman/8.0/en/server-system-variables.html#sysvar_super_read_only) + + When member join recovery was not possible, due to missing + binary logs and clone groups on group members + + *Example*: When the value of + `group_replication_exit_state_action` was + `OFFLINE_MODE` and one of these events took + place, offline mode was not enabled as expected. + (Bug #36076308) +* **Group Replication:** + After successfully setting a new primary, + [`group_replication_set_as_primary()`](/doc/refman/8.0/en/group-replication-functions-for-new-primary.html#function_group-replication-set-as-primary) + in some cases waited indefinitely for the operation to complete. + (Bug #36059098) +* **JSON:** + `JOIN` and `GROUP BY` handled + some `JSON` column values differently. + (Bug #101048, Bug #31969607) +* **MySQL NDB ClusterJ:** + The + `setLimits()` + method can now be chained to + `deletePersistentAll()` + to limit the number of items to delete. See the description of + `deletePersistentAll()` + for details. + (Bug #36049906) +* Updated `BuildRequire` rules to align with + versions now required for CMake and Bison. + (Bug #36343254) +* [`SET + GLOBAL`](/doc/refman/8.0/en/set-variable.html) + [`offline_mode=ON`](/doc/refman/8.0/en/server-system-variables.html#sysvar_offline_mode) did not always + perform correctly when issued under high loads. + (Bug #36275182) + + References: See also: Bug #36405894. +* Upgraded `curl` to version 8.6.0. + (Bug #36267545) +* **mysqldump** did not always interpret the server + version correctly. + (Bug #36248967) + + References: See also: Bug #36405879. +* Condition pushdown to a view was rejected with a collation + mismatch if the view was created with a different character set + than the character set used when querying the view. + (Bug #36246859) +* Use of the deprecated `exec_program()` command + has been replaced by `execute_process()` to + provide compatibility with CMake 3.28.1 and later. + (Bug #36220656) +* Upgraded the `protobuf` library to version + 25.1. + (Bug #36108397) +* For building Enterprise Linux RPMs, the build scripts now point + to a newer **strip** command (under + `/opt/rh/gcc-toolset-12`), and they now check + that the corresponding **dwz** tool is available. + Previously this was only implemented for EL8. + (Bug #36090069) +* We now look for `gcc-ar` and + `gcc-ranlib` when building on Oracle Linux with + link-time optimization. + (Bug #36089900) +* The server sometimes terminated unexpectedly in response to a + specific query. + (Bug #35957627) +* In certain cases, a lateral join was not handled correctly. + (Bug #35945239) + + References: See also: Bug #107700, Bug #34338001. This issue is a regression of: Bug #32644631. +* Improved view and trigger definer handling by view and table + DDL. + (Bug #35942937) +* The server did not always return metadata to the client + correctly for certain queries. + (Bug #35904044, Bug #36521376) +* When running queries against a table with a multi-value index, + the server sometimes exited unexpectedly, often while executing + a complex [`SELECT`](/doc/refman/8.0/en/select.html) query which used + this index. + (Bug #35789759) +* Improved code in `sql/item_subselect.cc`. + (Bug #35733778, Bug #35738531, Bug #35779012) +* [`CREATE USER IF + EXISTS`](/doc/refman/8.0/en/create-user.html) was not always logged correctly. + (Bug #35530823) +* The server did not disallow subqueries in partition expressions + properly. These are invalid, and should cause a syntax error. + (Bug #35476172) +* Some `RANK() ... OVER()` queries raised an + assertion in `sql/sql_executor.cc`. + (Bug #35228083) +* When successive + [`ALTER TABLE ... + ALGORITHM=COPY`](/doc/refman/8.0/en/alter-table.html) statements were issued within 10 + seconds of one another, the `n_rows` value + became 0. + (Bug #35127747) +* Updated the URL used for downloading the Boost C++ libraries. + (Bug #113576, Bug #36164514) +* The fix for a previous issue, first addressed in MySQL 8.0.30, + was incomplete. + + Our thanks to Hao Lu for the contribution. + (Bug #113174, Bug #36035044) + + References: This issue is a regression of: Bug #110801, Bug #35328028. +* On s390x, we now compile the FMA test with `-O2` + to avoid overoptimization. + + Our thanks to Jonathan Albrecht for the contribution. + (Bug #113096, Bug #36016140) +* Although s390x is a big-endian platform, the little-endian ICU + data directory was used for compiling. + + Our thanks to Jonathan Albrecht for the contribution. + (Bug #113095, Bug #36016141) +* Incorrect results were sometimes obtained from a query that used + a group by loose index scan. + (Bug #112541, Bug #35854362) +* An assertion failed in debug builds when inserting data with a + zero-length column, such as + [`CHAR(0)`](/doc/refman/8.0/en/char.html) or + [`BINARY(0)`](/doc/refman/8.0/en/binary-varbinary.html), into a table. Now, a + less strict assertion more accurately fails only if it detects + that a non-zero number of bytes copied from a source is + identical to the target. + (Bug #111450, Bug #35507763) +* A [`VALUES`](/doc/refman/8.0/en/values.html) statement in a + correlated lateral or (other) dependent subquery yielded an + incorrect result. + (Bug #109252, Bug #110076, Bug #34852090, Bug #35087820) +* [`IN`](/doc/refman/8.0/en/comparison-operators.html#operator_in) should return + `NULL` not only if the expression on the left + hand side is `NULL`, but when no match is found + in the list and one of the expressions in the list is + `NULL` as well. In some cases, it was found + that adding rows to a table caused a subsequent prepared + `SELECT NULL IN (SELECT ...)` query to return a + different result when the result should have remained the same. + (Bug #94857, Bug #29602835) diff --git a/corpus/changelog/mysql_releases/mysql_8038.md b/corpus/changelog/mysql_releases/mysql_8038.md new file mode 100644 index 0000000000000000000000000000000000000000..1a8a883d6434f18297df1f8d1f7de8661fd7164b --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8038.md @@ -0,0 +1,378 @@ +# MySQL 8.0.38 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-38.html +Version: 8.0.38 + +## Changes in MySQL 8.0.38 (2024-07-01, General Availability) + +Important + +This release is no longer available for download. It was +removed due to a critical issue that could stop the server +from restarting following the creation of a very large number +of tables (8001 or more). Please upgrade to MySQL 8.0.39 +instead. + +* [Audit Log Notes](news-8-0-38.html#mysqld-8-0-38-audit-log "Audit Log Notes") +* [C API Notes](news-8-0-38.html#mysqld-8-0-38-capi "C API Notes") +* [Compilation Notes](news-8-0-38.html#mysqld-8-0-38-compiling "Compilation Notes") +* [Connection Management Notes](news-8-0-38.html#mysqld-8-0-38-connection-management "Connection Management Notes") +* [Data Dictionary Notes](news-8-0-38.html#mysqld-8-0-38-data-dictionary "Data Dictionary Notes") +* [Performance Schema Notes](news-8-0-38.html#mysqld-8-0-38-performance-schema "Performance Schema Notes") +* [Pluggable Authentication](news-8-0-38.html#mysqld-8-0-38-pluggable-auth "Pluggable Authentication") +* [Thread Pool Notes](news-8-0-38.html#mysqld-8-0-38-thread-pool "Thread Pool Notes") +* [Bugs Fixed](news-8-0-38.html#mysqld-8-0-38-bug "Bugs Fixed") + +### Audit Log Notes + +* Audit log pruning did not function after removing or renaming a + file from the audit log. Now pruning continues in such cases, + but with a warning printed in the error log stating that it was + not possible to delete the missing audit log file. + (Bug #35902913) + +### C API Notes + +* C API applications stalled while receiving results for server + side prepared statements. + +### Compilation Notes + +* Upgraded the bundled `googletest` and + `googlemock` sources to version 1.14.0. + (Bug #36562482) +* Added a missing dependency on `GenError`. + (Bug #36551721) +* It is now possible on Linux systems to build MySQL using a + bundled `tcmalloc` library that is provided + with the source by specifying + [`-DWITH_TCMALLOC=BUNDLED`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_with_tcmalloc). This is + supported on Linux only. + (Bug #36313839) +* The bundled `tcmalloc()` is now used when + building MySQL on Enterprise Linux 8. + (Bug #114844, Bug #35674008) +* Linux `aarch64` platform binaries are now built + using **patchelf** + `--page-size=65536` for compatibility with + systems using either 4k or 64k for the page size. + (Bug #114233, Bug #36393794) + +### Connection Management Notes + +* The `conn_delay/Waiting in connection_control + plugin` stage was not reset after a delay introduced by + the connection control plugin which resulted in incorrect + monitoring information. + (Bug #35205358) + +### Data Dictionary Notes + +* Attempting to upgrade a [`MyISAM`](/doc/refman/8.0/en/myisam-storage-engine.html) + table containing a mix of regular columns and generated columns + from MySQL 5.7 to 8.0 or later led to table corruption. + (Bug #105301, Bug #33503328) + +### Performance Schema Notes + +* Under certain conditions, a race condition could result in the + amount of RAM used by [`TABLE_HANDLES`](/doc/refman/8.0/en/performance-schema-table-handles-table.html) + increasing to a maximum of 9GB. + (Bug #36170903) +* The `PROCESSLIST_INFO` column of + [`THREADS`](/doc/refman/8.0/en/performance-schema-threads-table.html) was not updated when + executing a prepared statement. + + Thanks to Daniel Lenski and Amazon for the contribution. + (Bug #104121, Bug #33057164) + +### Pluggable Authentication + +* The deprecation warning issued when authenticating with the + `mysql_native_password` plugin is now issued + only once. + (Bug #35792948) + +### Thread Pool Notes + +* Connecting to a thread group that had no connection handler + threads stalled. We fix this by making sure that connection + handler threads terminate only if there is at least one + connection thread left. + (Bug #36550125) + +### Bugs Fixed + +* **InnoDB:** + MySQL unexpectedly halted on an + [`UPDATE`](/doc/refman/8.0/en/update.html) after an + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) operation. + (Bug #36571091) + + References: This issue is a regression of: Bug #35183686. +* **InnoDB:** + The log index size calculation now accounts for column order + changes. + (Bug #36526369) + + References: This issue is a regression of: Bug #35183686. +* **InnoDB:** + File system operations performed by `InnoDB` + now consistently `fsync` the parent directory + when performing directory altering tasks. + (Bug #36174938) +* **InnoDB:** + In debug builds, setting the + `innodb_interpreter_output` debug variable + would cause the server to unexpectedly halt. This is now a + read-only variable. + (Bug #36041032) +* **InnoDB:** + For tables created with an index on a column that was too wide + for the redundant row format (allowed before MySQL 5.7.35), an + in-place upgrade silently imported the table but it was not + accessible, which interfered with making backups. Now all + operations that involve using the invalid index are rejected + with [`ER_INDEX_CORRUPT`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_index_corrupt) until the + index is dropped. An + [`ER_IB_INDEX_PART_TOO_LONG`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_ib_index_part_too_long) error + is also reported in the error log. + (Bug #35869747) + + References: See also: Bug #34826861. +* **InnoDB:** + An `InnoDB` assertion error referencing an + invalid column index was triggered when the column index was + valid. + (Bug #34800754) +* **InnoDB:** + With an empty + [`XA`](/doc/refman/8.0/en/xa-statements.html) + transaction, shutting the server down after an `XA + START` would cause the server to halt unexpectedly. + (Bug #32416819) +* **InnoDB:** + Shutting down the replication applier or binlog applier while + processing an empty XA transaction caused the system to + unexpectedly halt. + (Bug #32416819) +* **InnoDB:** + Removed unnecessary heap usage in the + `Validate_files::check()` function. + + Our thanks to Huaxiong Song for the contribution. + (Bug #115041, Bug #36626203) +* **InnoDB:** + If a partition table was read with + [`innodb_parallel_read_threads=1`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_parallel_read_threads), + read performance greatly decreased from any table after 256 + reads. InnoDB behaved as if it reached the maximum capacity of + parallel read threads despite not using any. + + Our thanks to Ke Yu for the contribution. + (Bug #114154, Bug #36347408) +* **InnoDB:** + The result from a spatial index containing a column with a + spatial reference identifier (SRID) attribute was empty. In + addition, using `FORCE INDEX` to force a + covering index scan on a spatial index led to an assertion. + (Bug #112676, Bug #114200, Bug #35894664, Bug #36361834) +* **InnoDB:** + Fixed performance issues related to querying the + `data_lock` and + `data_lock_waits` tables when thousands of + read-only transactions were present. + (Bug #109539, Bug #34951273) +* **Replication:** + If a source contained a stored, generated column populated by a + JSON function and + [`binlog_row_image`](/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_row_image) was set to + `MINIMAL`, any subsequent update or deletion on + the underlying column failed with the following error: + + ```None + Invalid JSON text in argument 1 to function json_extract: 'The document is empty.' + ``` + + The replica attempted to re-evaluate the generated column and + failed with that error because the underlying column was + unavailable. As of this release, stored, generated columns are + not re-evaluated when the underlying columns are unavailable. + (Bug #36515172) +* **Replication:** + When running GTID-based replication with + [`relay_log_space_limit`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_relay_log_space_limit) enabled, + a restart of the auto positioning protocol sometimes resulted in + an infinite loop, leading to a deadlock in replication. This was + because `relay_log_space_limit` was not + honored, not only for transactions whose size exceed this limit, + but when the replica could not purge previous logs as well. + + To fix this issue, we make the following changes: + + + The receiver respects + `relay_log_space_limit` as set by the user, + unless a transaction received by the receiver cannot fit + into the purged relay log. Before queuing the received + transaction, receiver now checks whether scheduling a full + transaction is possible. If not, the receiver performs the + following actions: + + - Sets the flag indicating that receiver is waiting + - Rotates the relay log + - Waits until it is notified that relay log purge was + executed and that the applier has purged all available + relay logs; after this, the receiver may queue a + transaction without checking the limit again + + Before moving to the next file, the coordinator checks + whether the receiver is waiting for available relay log + space. If so, the coordinator forcibly purges the applied + logs, including the current relay log file. To purge the + current relay log file safely, the coordinator must do the + following: + + - Synchronize all of its workers before moving to the next + file + - Forcibly update group positions, which is necessary to + allow current purging of the relay log + - Update the variable read by the receiver which contains + relay log filename to which applier was moved + + These operations are allowed because we know that receiver + waits at a transaction boundary and rotates the relay log + before waiting. + + (Bug #36507020) +* **Replication:** + Worker jobs now contain information about the relay log file + which initiated the transaction, instead of using the default + defined by [`relay_log`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_relay_log). + (Bug #36395631) +* **Replication:** + Handling an incident while transactions were being committed to + the binary log caused MySQL to wait indefinitely. + (Bug #35671897) +* **Group Replication:** + Removed a memory leak from + `/xcom/gcs_xcom_networking.cc`. + (Bug #36532199) +* **Group Replication:** + Under certain circumstances, if a primary's host experienced + network inactivity of 20 seconds or more, the secondaries could + stop unexpectedly. + (Bug #36306144) +* **Group Replication:** + Under certain circumstances, if garbage collection occurred just + before a relay log rotation, it could cause the applier to stop + applying new transactions on the secondary members. + + This was caused by garbage collection incrementing the relay + log's `last_committed` and + `sequence_number`, creating a gap in the + recorded `sequence_number` after the log + rotation. The applier was unaffected if the gap occurred + anywhere else in the relay log. + + As of this release, only `last_committed` is + updated during garbage collection. + (Bug #36280130, Bug #36446250) +* **JSON:** + Added missing checks for error handling to + [`NULLIF()`](/doc/refman/8.0/en/flow-control-functions.html#function_nullif), + [`COALESCE()`](/doc/refman/8.0/en/comparison-operators.html#function_coalesce), and the shift + ([`>>`](/doc/refman/8.0/en/bit-functions.html#operator_right-shift)) + operator. + (Bug #113668, Bug #35513196, Bug #36198403) + + References: See also: Bug #31358416. +* **MySQL NDB ClusterJ:** + Running the ClusterJ test suite resulted in an error message + saying a number of threads did not exist. That was due to some + wrong handling of threads and connections, which was corrected + by this patch. + (Bug #36086735) +* Averages of certain numbers were not always computed correctly. + (Bug #36563773) +* The following files in `strings` contained + incorrect license information: + + + `mb_wc.h` + + `ctype-uca.cc` + + `ctype-ucs2.cc` + + `ctype-utf8.cc` + + `dtoa.cc` + + `strxmov.cc` + + `strxnmov.cc` + + (Bug #36506181) +* In certain unusual cases, the + [`UpdateXML()`](/doc/refman/8.0/en/xml-functions.html#function_updatexml) function did not + process all of its arguments correctly. + (Bug #36479091) +* Explaining a query which used `FORCE INDEX` on + a spatial index containing a column with SRID attributes led to + an unplanned exit. + (Bug #36418426) +* When incrementing the reference count for an expression, + underlying expressions within this expression are not looked at. + While removing an expression, after decrementing the reference + count, even the underlying expressions were examined, which led + to unintentional deletion of the underlying expressions. This + issue manifested in `Item_ref::real_item()` as + well as in an assert in `sql/item.h`. We fix + this by not looking at the underlying expression unless the + current expression contains the only remaining reference. + (Bug #36204344, Bug #36356279) +* Under certain conditions, + [`EXPLAIN FORMAT=JSON FOR + CONNECTION`](/doc/refman/8.0/en/explain.html) sometimes led to an unplanned exit. + (Bug #36189820) +* Some [`CREATE USER`](/doc/refman/8.0/en/create-user.html) statements were + not handled correctly. + (Bug #36022885) +* For a [`SELECT`](/doc/refman/8.0/en/select.html) with `ORDER + BY` and `LIMIT`, the optimizer first + chose a full table scan with a very expensive cost, then + performed another check and used the + `perform_order_index` type of path, but this + was not reflected by the cost in the optimizer plan. + (Bug #35930969) +* Client connections were not alway terminated correctly during + shutdown. + (Bug #35854919) +* All internal ACL bitmask variables are now explicitly 32 bits + (`uint32_t`). + (Bug #35507223) +* It was not possible to add a functional index on + [`FIND_IN_SET()`](/doc/refman/8.0/en/string-functions.html#function_find-in-set). + (Bug #35352161) +* Running two concurrent [`OPTIMIZE + TABLE`](/doc/refman/8.0/en/optimize-table.html) statements on the same table with fulltext + indexes and + [`innodb_optimize_fulltext_only`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_optimize_fulltext_only) + enabled sometimes caused the server to exit. + (Bug #34929814) +* Removed a memory leak observed while running + `authentication_kerberos` under Valgrind. + (Bug #34482788, Bug #36570929) +* The + [`gen_range()`](/doc/refman/8.0/en/data-masking-plugin-functions.html#function_gen-range-plugin) + function as implemented by the (deprecated) data masking plugin + did not always return the correct result. + + This issue affected the data masking plugin only, and did not + affect the data masking component which supersedes it. + (Bug #34163992) +* Fixed an erroneous comment in + `include/my_command.h`. + + Our thanks to Sho Nakazono for the contribution. + (Bug #114507, Bug #36455468) +* It was possible for a deterministic stored function to return an + incorrect result when the function used `JOIN + ON` inside the `return` statement. If + the query needed to be reprepared due to a table metadata caused + by, for example, [`FLUSH + TABLES`](/doc/refman/8.0/en/flush.html) between two executions, the + `ON` clause was sometimes lost. + (Bug #114235, Bug #36379879) diff --git a/corpus/changelog/mysql_releases/mysql_8039.md b/corpus/changelog/mysql_releases/mysql_8039.md new file mode 100644 index 0000000000000000000000000000000000000000..4a9512f503afe1d90d3b1dbc04476470db9adb74 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8039.md @@ -0,0 +1,26 @@ +# MySQL 8.0.39 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-39.html +Version: 8.0.39 + +## Changes in MySQL 8.0.39 (2024-07-23, General Availability) + +### Bugs Fixed + +* **InnoDB:** + In some cases, following the creation of a very large number of + tables (8001 or more), the server could not be restarted + successfully. + (Bug #36808732) + + References: This issue is a regression of: Bug #33398681. +* **InnoDB:** + Improved tablespace file scan performance at startup. + (Bug #110402, Bug #35200385) +* **Group Replication:** + Running a + [`CREATE + TABLE ... SELECT`](/doc/refman/8.0/en/create-table-select.html) statement on a source coming from an + asynchronous channel to Group Replication led to errors on the + replica. + (Bug #36784284) diff --git a/corpus/changelog/mysql_releases/mysql_8040.md b/corpus/changelog/mysql_releases/mysql_8040.md new file mode 100644 index 0000000000000000000000000000000000000000..b9b26cc1c95f87ec33cb92d31412723eca99bf7a --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8040.md @@ -0,0 +1,442 @@ +# MySQL 8.0.40 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-40.html +Version: 8.0.40 + +## Changes in MySQL 8.0.40 (2024-10-15, General Availability) + +* [C API Notes](news-8-0-40.html#mysqld-8-0-40-capi "C API Notes") +* [Compilation Notes](news-8-0-40.html#mysqld-8-0-40-compiling "Compilation Notes") +* [SQL Function and Operator Notes](news-8-0-40.html#mysqld-8-0-40-functions-operators "SQL Function and Operator Notes") +* [Performance Schema Notes](news-8-0-40.html#mysqld-8-0-40-performance-schema "Performance Schema Notes") +* [sys Schema Notes](news-8-0-40.html#mysqld-8-0-40-sys-schema "sys Schema Notes") +* [Thread Pool Notes](news-8-0-40.html#mysqld-8-0-40-thread-pool "Thread Pool Notes") +* [Functionality Added or Changed](news-8-0-40.html#mysqld-8-0-40-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-40.html#mysqld-8-0-40-bug "Bugs Fixed") + +### C API Notes + +* The asynchronous interface used unsafe static local variables to + store state information. + (Bug #115703, Bug #36891894) + +### Compilation Notes + +* MySQL did not compile on Fedora 41. + (Bug #37046924) +* MySQL did not compile on Ubuntu 24.10. + (Bug #37042308) +* Added `CONTRIBUTING.md` and + `SECURITY.md` files to the MySQL sources to + conform to Oracle's Open Source guidelines. + (Bug #36998165) +* Aligned `CMAKE_MINIMUM_REQUIRED` with the correct + required CMake version (3.14.6) as well as CMake policies for + third-party libraries used by MySQL. + (Bug #36978193) +* Binary packages that include curl rather than linking to the + system curl library have been upgraded to use curl 8.9.1. + Important issues fixed in curl version 8.9.1 are described at + . + (Bug #36967379, Bug #36955197) +* The included `zlib` library has been upgraded + from version 1.2.13 to version 1.3.1. + (Bug #36950863) +* CMake options `BUILD_SHARED_LIBS` and + `CMAKE_SKIP_INSTALL_ALL_DEPENDENCY` are now set + to `OFF` in the top level of the build. + (Bug #36930664) +* Upgraded the bundled `libcurl` library to + version 8.9.0. + (Bug #36886877) +* The bundled `lz4` library was upgraded to + version 1.10.0. + (Bug #36886747) +* The [`-DWITHOUT_SERVER`](/doc/refman/8.0/en/source-configuration-options.html#option_cmake_without_server) option for + CMake did not work on Enterprise Linux 7. + (Bug #36824515) +* The version of `libfido` used with MySQL was + upgraded to 1.15.0. + (Bug #36752604) +* The version of **clang-format** + used for the MySQL codebase was upgraded from 10 to 15. + (Bug #36500268) +* The bundled version of TI-RPC was upgraded to 1.3.5. + (Bug #115698, Bug #36886602) +* It was not possible to build MySQL using Protobuf 22 or later. + + Our thanks to Gordon Wang for the contribution. + (Bug #115163, Bug #36678092) + +### SQL Function and Operator Notes + +* The output from [`DATABASE()`](/doc/refman/8.0/en/information-functions.html#function_database) was + truncated when this function was used as part of a + [`UNION`](/doc/refman/8.0/en/union.html) query. + (Bug #36871927) + +### Performance Schema Notes + +* Redesigned the performance schema + [`data_locks`](/doc/refman/8.0/en/performance-schema-data-locks-table.html) and + [`data_lock_waits`](/doc/refman/8.0/en/performance-schema-data-lock-waits-table.html) tables so that + querying them does not require an exclusive global mutex on the + transaction or lock system. It now iterates over buckets of hash + tables that hold the locks to only latch the actively processed + shard, when previously it iterated over the transactions. This + also improves the iteration logic complexity in terms of speed + and memory to decrease the impact of these queries on the rest + of the system. + + Note that the query result might show an incomplete list of + transaction locks if it committed, started, or otherwise changed + the set of owned locks in-between visiting two buckets. This + differs from previous behavior which always showed a consistent + snapshot of locks held by individual transactions, although two + different transactions could have been presented at different + moments. In other words, the new approach gives a consistent + view of a single wait queue to show conflicting locks with a + waiting lock because they are always in the same bucket, while + the old approach could miss some of them because they belonged + to other transactions. The old approach would always show all + the other locks held by a reported transaction but could miss + locks of other transactions even if they were conflicting. + (Bug #112035, Bug #113761, Bug #36302624, Bug #36015586, Bug #36690035, Bug #35712638, Bug #36891888) +* Running `SELECT * FROM sys.innodb_lock_waits;` + on an instance which was under heavy load affected the + performance of the server. + + As of this release, `SELECT * FROM + sys.innodb_lock_waits;` fetches only 2 locks for each + wait, instead of scanning all locks twice for each wait. + + As part of this fix, primary keys were added to + [`DATA_LOCKS`](/doc/refman/8.0/en/performance-schema-data-locks-table.html) and + [`DATA_LOCK_WAITS`](/doc/refman/8.0/en/performance-schema-data-lock-waits-table.html). + (Bug #100537, Bug #31763497) + +### sys Schema Notes + +* The performance of the + [`innodb_lock_waits`](/doc/refman/8.0/en/sys-innodb-lock-waits.html) view is improved + in this release. + (Bug #36337708) + +### Thread Pool Notes + +* Some concurrent connection attempts were not handled correctly. + (Bug #36625082) + +### Functionality Added or Changed + +* **Important Change:** + For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 3.0.15. For more information, see + [OpenSSL + 3.0 Series Release Notes](https://openssl-library.org/news/openssl-3.0-notes/) and + [OpenSSL + Security Advisory [3rd September 2024]](https://openssl-library.org/news/secadv/20240903.txt). + (Bug #37021075) +* Added the [`--system-command`](/doc/refman/8.0/en/mysql-command-options.html#option_mysql_system-command) option + for the **mysql** client, which enables or + disables the `system` client command. + + This option is enabled by default. To disable it, use + [`--system-command=OFF`](/doc/refman/8.0/en/mysql-command-options.html#option_mysql_system-command) or + [`--skip-system-command`](/doc/refman/8.0/en/mysql-command-options.html#option_mysql_skip-system-command), which + causes the `system` command to be rejected with + an error. + (Bug #36377685, WL #16482) + + References: See also: Bug #36248967. + +### Bugs Fixed + +* **Performance; InnoDB:** + Several functions internal to `InnoDB`, which + were defined as inline in MySQL 8.0.28, were found to be no + longer inline in MySQL 8.0.33, due in part to refactoring which + accompanied improvements made in MySQL 8.0.30 to improve the + `InnoDB` adaptive hash index. This had an + adverse effect on queries using joins on + `InnoDB` tables. + (Bug #111538, Bug #35531293) + + References: This issue is a regression of: Bug #81814, Bug #16739204, Bug #23584861. +* **InnoDB:** + InnoDB did not allow updating a `REDUNDANT` + table column that was altered with `NULL` as + the default value using the `INSTANT` + algorithm. Instead, MySQL unexpectedly halted. + (Bug #36840107) +* **InnoDB:** + When redo log capacity was reduced with + `log_files_truncate`, under rare circumstances + the `file.end_lsn` equaled + `log_sys->write_lsn` thus disallowing future + redo log writes. + (Bug #36730830) +* **InnoDB:** + It was possible for the MySQL server to halt unexpectedly when + executing a [`DELETE`](/doc/refman/8.0/en/delete.html) or + [`UPDATE`](/doc/refman/8.0/en/update.html) statement after a column + was dropped using the `INSTANT` algorithm. + (Bug #36723117) +* **InnoDB:** + FTS index optimization would sometimes not function correctly + with tokens equal in collation order but different in terms of + bytes. + (Bug #36652127) +* **InnoDB:** + Replaced + `std::this_thread::sleep_for(std::chrono::seconds(0))` + usage with `std::this_thread::yield()` to + prevent it from being optimized out while compiled. + (Bug #36522343) +* **InnoDB:** + The upgrade process unexpectedly halted when the database + contained a full-text index created in MySQL 5.7 with a + user-created `FTS_DOC_ID` column as the primary + key. + + Our thanks to Huaxiong Song and the team at Alibaba for + contributing to this fix. + (Bug #36496164) +* **InnoDB:** + Disabled the optimizer for indexes with range conditions on + multiple-value virtual columns. + (Bug #36341532) +* **InnoDB:** + On Windows, fixed a doublewrite buffer regression that slowed + file access, and refactored + `FILE_FLAG_OVERLAPPED` flag usage for opening + files. + (Bug #36259487) +* **InnoDB:** + A schema mismatch was possible when a table was imported with a + different [`sql_mode`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_mode) than when it + was created, because strict mode influences the number of + nullable columns in a table's secondary index. Now the + secondary index trees are also checked for corruption after a + tablespace is imported. + (Bug #35799038) +* **InnoDB:** + Given a table with an FTS index, when its tablespace is + discarded the corresponding FTS tables are also dropped. When + performing an operation that cleared out these tables, the code + incorrectly assumed that the FTS tables must also exist if the + FTS indexes were present in the table metadata. + (Bug #35343458) +* **InnoDB:** + An uninitialized buffer was being written to a temporary file + when checking if the system supports a different sector size for + FusionIO. This check is made when + [`innodb_flush_method`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_flush_method) is set to + `O_DIRECT` or + `O_DIRECT_NO_FSYNC`. + (Bug #115229, Bug #36705034) +* **InnoDB:** + Table rebuild operations involving secondary indexes required + greater file I/O for `InnoDB` temporary files + as compared with MySQL 8.0.26, which degraded query performance. + (Bug #114465, Bug #36444172) +* **InnoDB:** + Adding indexes with the parallel index builder was much slower + with the Performance Schema enabled due to issues in the + `Alter_stage` class. + (Bug #113505, Bug #36163502) +* **InnoDB:** + Fixed an `innodb.parallel_read_kill` related + unit test to better account for recent optimizer changes, and + fixed an `innodb.ddl_kill` unit test and its + associated macro usage. + + Our thanks to Dmitry Lenev and the team at Percona for + contributing to these fixes. + (Bug #113002, Bug #115416, Bug #35992036, Bug #36764973) + + References: See also: Bug #112767. +* **Partitioning:** + [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) did not always work + correctly with partitioned tables. + (Bug #36677952) +* **Group Replication:** + Under certain conditions, all secondaries shut down unexpectedly + following a brief period of network inactivity on the primary + host. + (Bug #35642087) + + References: See also: Bug #32673639, Bug #34565855. +* **Group Replication:** + Memory aggregated by threads as reported did not account for all + `memory/sql/Gtid_set::Interval_chunk` freed by + other threads from what was allocated, leading to a incorrect + ever-increasing consumption of resources by Group Replication + thread + `thread/group_rpl/THD_applier_module_receiver`. + + Global memory as reported by + [`performance_schema.memory_summary_global_by_event_name`](/doc/refman/8.0/en/performance-schema-memory-summary-tables.html) + was not affected by this issue. + (Bug #34819861) +* **Group Replication:** + Removed a potential memory leak from + `xcom\network\xcom_network_provider_native_lib.cc`. + (Bug #115162, Bug #36673883) +* The server did not always handle connections correctly when + running with both the thread pool and audit log plugins. + (Bug #37039422) +* Packages for Debian-based systems are now built with + `WITH_ZLIB=system`, and disable + `MYSQL_MAINTAINER_MODE` for debug builds. + (Bug #37038213) +* Updated the Kerberos library bundled with commercial builds to + version 1.21.3. For more information, see the + [Kerberos 5 + 1.21.x Release Notes](https://web.mit.edu/kerberos/krb5-1.21/). + (Bug #37034600) +* Removed a heap-use-after-free warning in + `regexp::Regexp_facade::~Regexp_facade()`. + (Bug #36867806) +* While dumping tablespaces, **mysqldump** did not + properly escape certain SQL statements in its output. In + addition, the dump now encloses the following identifiers within + backticks: `LOGFILE GROUP`, + `TABLESPACE`, and `ENGINE`. + (Bug #36816986) +* A previous fix for an issue in + `sql/sql_executor.cc` checked for + `const_item()` rather than + `const_for_execution()`. + (Bug #36804785) + + References: This issue is a regression of: Bug #34951115. +* When executing an index range scan using + `IndexRangeScanIterator` the record buffer was + never set due to the fact that the data type used for + `IndexRangeScanIterator::m_expected_rows` had + been changed from double to boolean during refactoring. This + unintended change has been reverted. + + In addition, when the record buffer was enabled for index range + scans a problem arose with multi-valued indexes used for + covering these scans. (This is possible only when they are used + as part of index merge scans, since index merge scans force + covering index scans.) The source of the problem was that the + implementation of + `Field_typed_array::key_cmp()` needs the value + of the generated column for the indexed expression, and this + column is not available in the multi-valued index, so the + storage engine cannot safely evaluate the end range condition + when filling the record buffer for a covering scan. To fix this, + we now disable the record buffer when multi-valued indexes are + used for covering index range scans. + (Bug #36775910) + + References: See also: Bug #36341532. +* Certain triggers and stored procedures were not handled + correctly. + (Bug #36775910) +* Some errors raised when referencing external tables were not + handled correctly. + (Bug #36758378) +* On Debian, stopped stripping + `libmysqlclient.a` to increase LTO build + compatibility. + (Bug #36737581) +* The internal function `my_convert_internal()` + sometimes returned a pointer rather than the intended value. + (Bug #36684463) + + References: This issue is a regression of: Bug #36479091. +* Removed a memory issue in the server component. + (Bug #36600205) +* Fixed a memory leak in the **mysql** client. + (Bug #36600203) +* The [`AES_ENCRYPT()`](/doc/refman/8.0/en/encryption-functions.html#function_aes-encrypt) function did + not always return a valid result. + (Bug #36593265) +* In some cases a join involving a very large number of rows and + many tables was not processed correctly. + (Bug #36562979) +* [`DROP INDEX`](/doc/refman/8.0/en/drop-index.html) with the addition of a + `FULLTEXT` index in the same transaction + sometimes led to an unplanned server exit. + (Bug #36559642) +* Some combinations of optimizer hints did not function correctly. + (Bug #36492114) +* Following the fix for a previous issue, a + `const` item that is part of a `GROUP + BY` and is not found in the select list is not added as + a hidden item to the field list, but this was not taken into + consideration while checking for replacements for expressions + involving `ROLLUP` operations while creating a + temporary table. We fix this by checking whether the item that + is not found in the field list is a `const` + item, and if so, we use the same item as a replacement. + (Bug #36444257) + + References: This issue is a regression of: Bug #34951115. +* Removed assertions found during testing of the data masking + functions [`gen_rnd_pan()`](/doc/refman/8.0/en/data-masking-component-functions.html#function_gen-rnd-pan) and + [`mask_ssn()`](/doc/refman/8.0/en/data-masking-component-functions.html#function_mask-ssn). + (Bug #36397869, Bug #36398272) + + References: See also: Bug #36398221. +* Fixed an issue relating to FTS comparisons. + + Our thanks to Shaohua Wang and the team at Alibaba for the + contribution. + (Bug #36210202) +* Some [`CREATE + TABLE ... SELECT`](/doc/refman/8.0/en/create-table-select.html) statements were not always processed + correctly. + (Bug #36138460) +* RelWithDebInfo builds are no longer compiled with the "-g1" + flag, thus increasing the available debugging information and + generated file sizes. + (Bug #36111629) + + References: See also: Bug #33664929. +* Corrected potential misbehavior when the server was run with + [`--skip-grant-tables`](/doc/refman/8.0/en/server-options.html#option_mysqld_skip-grant-tables). + (Bug #36043213) +* Fixed a regression in an earlier fix for a problem with + references to columns from tables of outer query blocks in the + `ON` condition of a join. + (Bug #35854686) + + References: This issue is a regression of: Bug #96946, Bug #30350696. +* In certain rare cases, a [`CREATE + TABLE`](/doc/refman/8.0/en/create-table.html) statement involving the creation of a table with + foreign keys was not processed correctly. + (Bug #35553557, Bug #36350852) +* Fixed an issue relating to [`SHOW + INDEX`](/doc/refman/8.0/en/show-index.html) and generated columns. + (Bug #35497623) +* In some cases, table DDL in prepared statements was not handled + correctly. + (Bug #35221658) +* Changed the SLES 15 target platform from openSUSE 15.5 to 15.6, + which also means using GCC 13 instead of GCC 12 and building + against the system's OpenSSL 3.x instead of OpenSSL 1.1.x. + (Bug #115535, Bug #36934913) +* Fixed a typo in the Debian package description. + + Our thanks to Henning Pöttker for the contribution. + (Bug #115363, Bug #36749142) +* With + [`prefer_ordering_index=off`](/doc/refman/8.0/en/switchable-optimizations.html#optflag_prefer-ordering-index), a + query with no reference key reverted to scanning and sorting the + full table even though it should have been possible to avoid the + sort. + + Our thanks to Daniel Nichter for the contribution. + (Bug #113699, Bug #36213938) +* A query using a greater-than (`>`) or + less-than (`<`) comparison with a + multi-valued index executed much more slowly than the same query + using an equality (`=`) comparison with the + same index. + (Bug #104897, Bug #33334911) diff --git a/corpus/changelog/mysql_releases/mysql_8041.md b/corpus/changelog/mysql_releases/mysql_8041.md new file mode 100644 index 0000000000000000000000000000000000000000..8f6e49051ddbb66d3fcce6a4bc6f8bc72900237f --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8041.md @@ -0,0 +1,491 @@ +# MySQL 8.0.41 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-41.html +Version: 8.0.41 + +## Changes in MySQL 8.0.41 (2025-01-21, General Availability) + +* [Account Management Notes](news-8-0-41.html#mysqld-8-0-41-account-management "Account Management Notes") +* [Character Set Support](news-8-0-41.html#mysqld-8-0-41-charset "Character Set Support") +* [Compilation Notes](news-8-0-41.html#mysqld-8-0-41-compiling "Compilation Notes") +* [Component Notes](news-8-0-41.html#mysqld-8-0-41-components "Component Notes") +* [Firewall Notes](news-8-0-41.html#mysqld-8-0-41-firewall "Firewall Notes") +* [Optimizer Notes](news-8-0-41.html#mysqld-8-0-41-optimizer "Optimizer Notes") +* [Performance Schema Notes](news-8-0-41.html#mysqld-8-0-41-performance-schema "Performance Schema Notes") +* [Functionality Added or Changed](news-8-0-41.html#mysqld-8-0-41-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-41.html#mysqld-8-0-41-bug "Bugs Fixed") + +### Account Management Notes + +* The database cache was not flushed properly following execution + of [`DROP USER`](/doc/refman/8.0/en/drop-user.html). + (Bug #37132323) +* Failed password validation was not always handled correctly. + (Bug #37041439) + +### Character Set Support + +* Zero rows resulted (where one row was expected) when selecting + from a view created with its connection and client character set + to `latin1`, where a query on the view used + `utf8` as its connection and client character + set, the view contained literal values with non-ASCII + characters, and the query performed a condition pushdown into a + [`UNION`](/doc/refman/8.0/en/union.html) of query blocks of the + view. + + This problem was related to a previous issue which fixed an + error for a similar problem: The problem in that case was + properly considering the character set of the view definition + when pushing down conditions contained in the view to inner + query blocks, but the fix implemented at that time did not take + into account the possibility that the view might contain + non-ASCII characters. + + This meant that the condition to be pushed down was written to a + text string with the wrong character set. We fix this oversight + by ensuring that the string is created with the correct + character set. + (Bug #37111452) + + References: See also: Bug #36246859. + +### Compilation Notes + +* **macOS:** + Removed obsolete CMake code from MacOS builds. + (Bug #37258036) +* **macOS:** + Removed warnings of the form ld: warning: ignoring + duplicate libraries and warnings specific to + `xcodebuild`. + (Bug #37065301) +* **Solaris:** + The minimum required version of GCC to build MySQL on Solaris + has been raised to 11.4. See + [Source Installation Prerequisites](/doc/refman/8.0/en/source-installation-prerequisites.html), for more + information. + (Bug #37256600) +* Starting with CMake 3.26, CMake writes the file + `CMakeFiles/CMakeConfigureLog.yaml`, which + supersedes `CMakeError.log`. References to + `CMakeError.log` have therefore been removed. + (Bug #37305289) +* The version of `libedit` used to compile MySQL + was upgraded to 20240808-3.1. + (Bug #37101293) +* Removed an error in + `mysql_prepare_create_table()` (in the file + `sql/sql_table.cc`) found when compiling + MySQL with XCode 16. + (Bug #37068527) +* The server could not be built on Fedora 40 (and possibly other + Linux platforms) using cmake 3.11, due to an issue with TIRPC. + (Bug #116164, Bug #37080195) + +### Component Notes + +* [`INSTALL COMPONENT`](/doc/refman/8.0/en/install-component.html) issued + concurrently with a [`SET + PERSIST`](/doc/refman/8.0/en/set.html) which used a subquery could sometimes lead to + an unplanned exit of the server. + (Bug #36559078) + + References: See also: Bug #35647759. + +### Firewall Notes + +* In some cases, after performing an upgrade, stored procedures + relating to MySQL Enterprise Firewall were not processed correctly. + (Bug #36084822) + +### Optimizer Notes + +* Pushing down a condition which had an aggregate function in a + `WHERE` clause caused the aggregate function to + be evaluated when it should not have been. + (Bug #36421735) + +### Performance Schema Notes + +* If a user other than root ran [`START + REPLICA`](/doc/refman/8.0/en/start-replica.html), + [`PERFORMANCE_SCHEMA.PROCESSLIST`](/doc/refman/8.0/en/performance-schema-processlist-table.html) + assigned that user's name to the newly spawned foreground + replication threads instead of `system user`. + + As of this release, `system user` is assigned + to all foreground system threads. + (Bug #37357562) +* Under certain circumstances, a metadata lock can be upgraded or + downgraded to a different `LOCK_TYPE`. This + change was not reflected in the + [`PERFORMANCE_SCHEMA.METADATA_LOCKS`](/doc/refman/8.0/en/performance-schema-metadata-locks-table.html) + table. + + Our thanks to George Ma and the Alibaba team for the + contribution. + (Bug #116625, Bug #37271768) + +### Functionality Added or Changed + +* Binary packages that include `curl` rather than + linking to the system `curl` library have been + upgraded to use `curl` 8.11.1. + (Bug #37389565) + +### Bugs Fixed + +* **Incompatible Change:** + Corruption occurred in a spatial index when an update of a + geometry with a minimal change in the minimum bounding rectangle + (MBR) was followed by a delete operation. + + When upgrading to this release, it is recommended that you drop + any spatial indexes beforehand, then re-create them after the + upgrade is complete. Alternatively, you can drop and re-create + such indexes immediately following the upgrade, but before + making use of any of the tables in which they occur. You should + also be aware that downgrading to any previous version + reintroduces the original problem described previously. + + For more information, see + [Creating Spatial Indexes](/doc/refman/8.0/en/creating-spatial-indexes.html). + (Bug #36452528) +* **InnoDB:** + Concurrently truncating a table while querying the Performance + Schema sometimes cause MySQL to halt unexpectedly. + (Bug #37271715) +* **InnoDB:** + It was possible for an `ALTER TABLE` operation + using the `INPLACE` algorithm on a table + containing both a spatial index and an auto-increment column to + cause corruption or, in debug builds, to trigger a debug assert. + This was due to the auto-increment column value being + overwritten in the old records of the spatial index while the + new record was prepared. + (Bug #37189985) +* **InnoDB:** + Certain IO buffer serializations triggered an assertion in debug + builds that caused the system to hang. + (Bug #37139618) +* **InnoDB:** + Improved `InnoDB` start up time. + (Bug #36880863) + + References: This issue is a regression of: Bug #36808732. +* **InnoDB:** + An assertion failure was raised when creating a + `FULLTEXT` index on a table with an + `FTS_DOC_ID` value greater than 4294967295. + (Bug #36879147) + + References: See also: Bug #37387224. +* **InnoDB:** + Dropping a primary key, and then adding a new + `AUTO_INCREMENT` column as a primary key in + descending order using the `INPLACE` algorithm + failed. + + Our thanks to Shaohua Wang and the team at Alibaba for the + contribution. + (Bug #36658450) +* **InnoDB:** + Extending a user tablespace produces file extension redo log + records (`MLOG_FILE_EXTEND`), but they were not + produced when extending the system tablespace. + (Bug #36511673) +* **InnoDB:** + A `DELETE` operation on a table with a self + referential foreign key and full-text index could have triggered + an assertion. + (Bug #36234681) +* **InnoDB:** + When clearing an AHI index from all buffer pool pages, the block + state would potentially change to BUF\_BLOCK\_MEMORY before + acquiring the block mutex thus causing an unexpected halt. + (Bug #35037114) +* **InnoDB:** + Common prefix compression for redo log inserts + (`MLOG_REC_INSERT`) was disabled but is now + enabled when the versions match. + (Bug #34946626) + + References: This issue is a regression of: Bug #13899. +* **InnoDB:** + Virtual column information for a row containing an externally + stored [`BLOB`](/doc/refman/8.0/en/blob.html) was not always logged + during an `UPDATE` operation, which sometimes + resulted in an Index PRIMARY is corrupted + error. + (Bug #34574604) +* **InnoDB:** + `ON DELETE CASCADE` with generated columns + containing secondary indexes sometimes failed, due to virtual + column templates not being initialized before deletion. + + Our thanks to Rahul Malik for the contribution. + (Bug #33691659) +* **InnoDB:** + An update operation attempted to update a virtual column while + building an update node for a child table, but should not have + done so since foreign key constraints cannot reference virtual + columns. + (Bug #33327093) +* **InnoDB:** + It was possible for `ALTER TABLE`, which + rebuilds `InnoDB` tables using the + `INPLACE` algorithm, to be rejected with a + duplicate key error due to a non-duplicate record being inserted + concurrently while the rebuild was paused to release a page + latch. + + Our thanks to Dmitry Lenev and the team at Percona for + contributing to this fix. + (Bug #115511, Bug #36808088) +* **InnoDB:** + The check enforcing the rule that + `ALGORITHM=INSTANT` cannot be used on a column + referenced by a foreign key constraint from another table did + not inspect the last field of said constraint. + (Bug #115457, Bug #36796094) +* **InnoDB:** + CPU usage statistics did not account for a processor count over + 128, which could degrade performance on these larger systems. + (Bug #115399, Bug #36765223) +* **InnoDB:** + Executing `ALTER TABLE` with `ADD + COLUMN` or `DROP COLUMN` against an + empty table now uses the `INPLACE` algorithm by + default instead of `INSTANT`. This change means + the row version is no longer incremented for these simple + operations. + (Bug #113051, Bug #36004394) +* **InnoDB:** + An [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) operation that + rebuilt an `InnoDB` table using the + `INPLACE` algorithm potentially led to losing a + row of data if a purge occurred concurrently on the altered + table that contained a clustered or spatial index. + + Our thanks to Dmitry Lenev and the team at Percona for + contributing to this fix. + (Bug #110706, Bug #113812, Bug #115608, Bug #116764, Bug #35303494, Bug #36261480, Bug #36846567, Bug #37318367) +* **InnoDB:** + Queries with a descending primary key and the + `index_merge` optimization sometimes yielded + incorrect results such as missing rows. + (Bug #106207, Bug #33767814) +* **Replication:** + In an InnoDB ClusterSet setup, when + [`autocommit`](/doc/refman/8.0/en/server-system-variables.html#sysvar_autocommit) was set to + `OFF` on all nodes in the cluster, a controlled + switchover using MySQL Shell was rejected with Error 1105 + (Unknown error). + + To fix this, we now force a new transaction in + `channel_change_source_connection_auto_failover()` + whenever `autocommit=OFF` to prevent table + access deadlocks when an info repository transaction is executed + after changing + `SOURCE_CONNECTION_AUTO_FAILOVER`. + (Bug #37173907) +* **Replication:** + While large transactions were being received and applied, and a + request to stop the replication channel was made using + [`STOP REPLICA`](/doc/refman/8.0/en/stop-replica.html), MySQL did not do so + properly, and subsequently did not process any channel commands. + In addition, the server shutdown process did not complete + gracefully, and required either the MySQL process to be killed + or the host system to be restarted. + (Bug #115966, Bug #37008345) +* **Replication:** + The log message written when a replica reconnects to the source + (when, for example, it is stopped and restarted by issuing + [`STOP REPLICA`](/doc/refman/8.0/en/stop-replica.html) followed by + [`START REPLICA`](/doc/refman/8.0/en/start-replica.html)) `While + initializing dump thread for replica with UUID + uuid, found a zombie dump thread with + the same UUID. Source is killing the zombie dump + thread(thread_id)` has been + improved to `Upon reconnection with the replica, while + initializing the dump thread for UUID + uuid, an existing dump thread with + the same UUID was detected. The source is terminating the + previous dump thread (thread_id), + which is normal and expected`. + (Bug #84358, Bug #25330090) +* **Group Replication:** + Removed a potential race condition between the internal + functions + `cs::apply::Commit_order_queue::front()` and + `cs::apply::Commit_order_queue::remove()`. + (Bug #37223451) + + References: See also: Bug #35206392. +* **Group Replication:** + When the primary node unexpectedly left the group and quickly + attempted to rejoin, the member which had been elected to remove + other, faulty members tried to expel or remove the faulty node + but could not do so due to lack of a majority. When the expelled + or removed node was the primary, this left the cluster without a + primary, resulting in an unusable state. + (Bug #36991859) + + References: See also: Bug #37181867. +* **Group Replication:** + In some cases, adding a new secondary caused existing + secondaries to lag, leading to a deadlock which persisted with + no more writes possible until the primary was restarted. + + This deadlock occurred between the ticket manager, which ensures + that transactions are committed on the correct side of a view + change (before or after the view change), and the commit order + manager on the inbound replication channel, which ensures that + transactions are committed in the same order in which they are + received, when these two managers required different orders. + This meant that, in some cases, adding a new secondary caused + the group primary to be unable to do writes. + + We solve this issue by ignoring the commit order manager + ordering and enforcing the ticket manager ordering for + non-conflicting transactions when such a deadlock occurs. A + consequence of this is that + [`replica_preserve_commit_order`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_replica_preserve_commit_order) + may not be strictly honored near a + `View_change_log_event`. In other words, + `replica_preserve_commit_order` no longer + provides a strict guarantee on an inbound channel on a Group + Replication primary. + [`replica_preserve_commit_order`](/doc/refman/8.0/en/replication-options-replica.html#sysvar_replica_preserve_commit_order) + still ensures that transactions are ordered correctly, with the + only exception being non-conflicting transactions around view + change log events. + (Bug #35206392) + + References: See also: Bug #37223451. +* **Group Replication:** + Improved garbage collection in Group Replication by eliminating + non-essential calls to + `is_subset_not_equals()`. + (Bug #110673, Bug #35286974) +* **Group Replication:** + Removing a group member from a group in which all members were + running the same version of MySQL, upgrading it to a later + version (from a later release series), and then requesting it to + rejoin the group caused the upgraded group member to hang in the + recovering state. +* The errors `ER_DD_UPDATE_DATADIR_FLAG_FAIL`, + `ER_IB_MSG_FIL_STATE_MOVED_PREV_OR_HAS_DATADIR`, + `ER_RPL_KILL_OLD_DUMP_THREAD_ENCOUNTERED`, and + `ER_RPL_MTA_ALLOW_COMMIT_OUT_OF_ORDER` were + originally defined in MySQL 8.0, but were subsequently assigned + different error code numbers (but with the same names) in MySQL + 8.4. The numbers assigned in MySQL 8.0 now apply to MySQL 8.0 + only; in the MySQL 8.4 and later release series, only the + numbers assigned in MySQL 8.4 are used. + (Bug #37284176) +* In `sql/item_cmpfunc.cc`, + `Item_bool_func2::resolve_type()` made an + unchecked call to + `Item_bool_func::resolve_type()`; the call to + `Item_bool_func::resolve_type()` ignored its + return value, and execution continued even in case of an error. + (Bug #37143289) +* AppArmor denied access to + `/proc/$pid/task/$thread_id/mem`, a file + required to generate a stack trace. + (Bug #37063288) + + References: See also: Bug #37387034. +* A filter condition in a subquery was sometimes ignored when a + query used the [`index_subquery`](/doc/refman/8.0/en/explain-output.html#jointype_index_subquery) + join type for subquery execution, and the subquery table used + materialization in the execution plan. The derived table access + path replaced the filter condition, resulting a final plan + without the filter layer. To fix this, in such cases, we now add + the derived table access path along with the filter access path + instead of replacing the latter. + (Bug #36918913) +* Some [`UNION`](/doc/refman/8.0/en/union.html) operations similar to + `a UNION b UNION c ...` consumed excessive + memory. To help keep this from happening, we now flatten equal + set operations at the parsing level, before contextualization + occurs, which should result in reduced resource usage by such + operations. + (Bug #36652610) +* Improved the internal function + `my_print_help()`. + (Bug #36615714) + + References: See also: Bug #37387224. +* Removed incorrect code from `Acl_cache`. + (Bug #36608160) +* A subquery containing an aggregate function `WITH + ROLLUP` which was part of a row value comparator was + not always processed correctly. + (Bug #36593235) + + References: See also: Bug #37387180. This issue is a regression of: Bug #30969045, Bug #30921780, Bug #26227613, Bug #29134467, Bug #30967158. +* It was possible for errors raised when persisting variables not + to be reported correctly. + (Bug #36574732) +* Some subqueries using `WITH ROLLUP` were not + always processed correctly. + (Bug #36421704) +* Improved the output from + `my_print_stacktrace()`, which prints the stack + trace when MySQL terminates unexpectedly. + (Bug #34904177, Bug #36027494) +* Fixed an issue relating to FTS and concurrent DDL or DML. + (Bug #34633727) +* [`DROP VIEW + name`](/doc/refman/8.0/en/drop-view.html) was rejected with + [`ER_BAD_TABLE_ERROR`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_bad_table_error) if there + existed a table with the same *`name`*. + (Bug #33200087) +* Incorrect results were returned by some queries that used hash + antijoins when the hash table did not fit in the join buffer and + spilled to disk. (The query triggering the issue actually + specified `LEFT JOIN`, but this was transformed + internally from a left outer join to an antijoin.) + + The problem was that some rows in the probe table were skipped + when writing the probe rows to chunk files, the skipped rows + being those that had `NULL` in part of the join + key. Such rows can be skipped for inner joins and semijoins, as + they are known to have no match in the build table, but for + outer joins and antijoins, rows in the probe table which have no + matching row in the build table should be part of the join + result, so they must be included in the chunk files. + + We already preserved these rows in the chunk files for outer + joins. This fix extends the logic used for that purpose so that + it also applies for antijoins. + (Bug #116334, Bug #37161583) +* In MySQL 8.0 and later, queries of the form + [`SELECT DISTINCT ... FROM + t1 WHERE NOT IN(SELECT ...)`](/doc/refman/8.0/en/select.html) were transformed into an + antijoin if possible, causing the optimizer not to choose a + group skip scan for table t1 whereas it would have been chosen + in MySQL 5.7. This resulted in a performance degradation for + such queries. Group skip scan is not chosen, since the query is + now no longer a single-table query following the antijoin + transformation, and this access method is enabled only for + single table queries. The same behavior can be seen for queries + which are transformed into semijoins as well. In such cases, + group skip scan access method can still be used if the access + method is used only for duplicate removal (that is, with + `DISTINCT` or `GROUP BY`, but + without aggregate functions). + + To fix this, we enable group skip scan when there is only one + table in the original query, irrespective of the number of + semijoin tables present after internal transformations as long + as the query contains no aggregate functions. + (Bug #112362, Bug #35842412) +* The **mysql** client did not allow using '#' or + '--' inside an optimizer hint comment. + + Our thanks to Kaiwang Chen for the contribution. + (Bug #98521, Bug #30875669) diff --git a/corpus/changelog/mysql_releases/mysql_8042.md b/corpus/changelog/mysql_releases/mysql_8042.md new file mode 100644 index 0000000000000000000000000000000000000000..e26372db57c26b4cd09d99e707e3a2b4c5523ed5 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8042.md @@ -0,0 +1,496 @@ +# MySQL 8.0.42 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-42.html +Version: 8.0.42 + +## Changes in MySQL 8.0.42 (2025-04-15, General Availability) + +* [Audit Log Notes](news-8-0-42.html#mysqld-8-0-42-audit-log "Audit Log Notes") +* [Compilation Notes](news-8-0-42.html#mysqld-8-0-42-compiling "Compilation Notes") +* [SQL Function and Operator Notes](news-8-0-42.html#mysqld-8-0-42-functions-operators "SQL Function and Operator Notes") +* [INFORMATION\_SCHEMA Notes](news-8-0-42.html#mysqld-8-0-42-information-schema "INFORMATION_SCHEMA Notes") +* [InnoDB Notes](news-8-0-42.html#mysqld-8-0-42-innodb "InnoDB Notes") +* [Functionality Added or Changed](news-8-0-42.html#mysqld-8-0-42-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-42.html#mysqld-8-0-42-bug "Bugs Fixed") + +### Audit Log Notes + +* `` was not populated for + `Execute`. + + For more information, see + [Logging Specific Event Classes](/doc/refman/8.0/en/audit-log-filter-definitions.html#audit-log-filtering-class-logging). + (Bug #36686351) + +### Compilation Notes + +* **Group Replication:** + The OpenSSL Engine interface is deprecated, and is no longer + being included in OpenSSL v3 main packages by some Linux + distributions, including Fedora. + + To avoid build issues, the usage of the OpenSSL Engine interface + by the Group Communication System (GCS) is now restricted to + OpenSSL versions previous to 1.1. + (Bug #37475769) +* **Linux:** + Use /usr/bin/gcc (GCC 14.2.1) when building the server on Oracle + Linux 10. + (Bug #37616148) +* Upgraded the bundled Curl library to version 8.12.1. + (Bug #37633587) +* Abseil could not be built on FreeBSD. + (Bug #37611924) +* In order to use `xxhash` functions + independently from the `lz4` library (bundled + or source), we compiled `xxhash.c` into our + own binaries, which required using a great many CMake + directives. Instead, we now build an interface library for + `xxhash`, and link with that wherever such + functions are used. + (Bug #37417386) +* Use xxHash-0.8.2 from GitHub rather than the version bundled + with lz4. + (Bug #37387318) + +### SQL Function and Operator Notes + +* **Important Change:** + When an SQL function is improved from one release to the next, + it may throw SQL errors in situations in which it previously did + not. If this happens in a table's constraints, default + expressions, partitioning expressions, or virtual columns, the + table could not be opened. This prevented both analyzing the + problem (using, for example, [`SHOW CREATE + TABLE`](/doc/refman/8.0/en/show-create-table.html)) and addressing it (such as with an + [`ALTER TABLE ... + DROP ...`](/doc/refman/8.0/en/alter-table.html) statement). + + Now, on server upgrade, we scan the data dictionary for tables + that use any of the features just mentioned. We then try to open + such tables, and if we fail to do so, we alert the user. This + patch addresses this. The + [`--check-table-functions`](/doc/refman/8.0/en/server-options.html#option_mysqld_check-table-functions) server + option introduced in this release helps to address this problem + by making it possible to specify the server's behavior when + encountering an error with such a function. Set this option to + `WARN` in order to log a warning for each table + which the server could not open; setting it to + `ABORT` also logs these warnings as + `WARN`, but aborts the server upgrade if any + issues were found. + + `ABORT` is the default; this enables the user + to fix the issue using the older version of the server before + upgrading to the new one. `WARN` flags the + issues, but allows the user to continue in interactive mode + while addressing the problem. + (Bug #36890891) + + References: See also: Bug #37009318. This issue is a regression of: Bug #98950, Bug #98951, Bug #31031886, Bug #31031888. + +### INFORMATION\_SCHEMA Notes + +* Fixed a performance issue in the + [`PROCESSLIST`](/doc/refman/8.0/en/information-schema-processlist-table.html) table. + (Bug #36778475) + +### InnoDB Notes + +* **InnoDB:** + InnoDB now uses simplified APIs for saving and restoring level + one progress during parallel scans. + (Bug #37517125) + +### Functionality Added or Changed + +* **Important Change:** + For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 3.0.16. For more information, see + [OpenSSL + 3.0 Series Release Notes](https://openssl-library.org/news/openssl-3.0-notes/) and + [OpenSSL + Security Advisory (11th February 2025)](https://openssl-library.org/news/secadv/20250211.txt). + (Bug #36033684) +* **Performance; Replication:** + The data structure used in tracking binary log transaction + dependencies has been changed from `Tree` to + `ankerl::unordered_dense::map`, which uses + approximately 60% less space, and which should thus contribute + to better dependency tracking performance. + (Bug #37008442, Bug #37529256) +* **InnoDB:** + To improve debugging, the `buf_page_t` and + `buf_block_t` structure's metadata is now + printed to the error log. + (Bug #35115629) + + References: See also: Bug #35115601. +* Increased the historical 1024-byte limit when printing the + current query during signal handling to 1073741824 (1024 \* 1024 + \* 1024). + (Bug #37603354) + +### Bugs Fixed + +* **InnoDB:** + Fixed a potential memory leak in several places in the innobase + code. + (Bug #37403052) +* **InnoDB:** + Under certain circumstances, MySQL could crash during shutdown + due to pages which were still fixed or dirty. Errors similar to + the following were logged: + + ```None + [ERROR] [MY-011908] [InnoDB] [FATAL] Page [page id: space=46, page number=75] still fixed or dirty + [ERROR] [MY-013183] [InnoDB] Assertion failure: buf0buf.cc:5889:ib::fatal triggered thread 139963705668608 + ``` + + (Bug #37391519) + + References: See also: Bug #35115601. +* **InnoDB:** + [`CHECK TABLE`](/doc/refman/8.0/en/check-table.html) for spatial indexes + did not verify the MBR against the geometry MBR stored in the + clustered index record. This could result in incorrect behavior + of spatial indexes. + + As of this release, `CHECK TABLE EXTENDED` + verifies the MBR matches the MBR stored in the clustered index + record. + (Bug #37359538) +* **InnoDB:** + Fixed an issue relating to pessimistic row update. + + Our thanks to Mengchu Shi and the team at Alibaba for the + contribution. + (Bug #37292404) +* **InnoDB:** + The [`CHECK TABLE`](/doc/refman/8.0/en/check-table.html) operation could + incorrectly report corruption in spatial indexes. + (Bug #37286473) +* **InnoDB:** + Fixed an issue relating to InnoDB redo log recovery. + (Bug #37061960) +* **InnoDB:** + Fixed an issue relating to reading `index_id` + values. + (Bug #36993445, Bug #37709706) +* **InnoDB:** + Fixed an issue relating to + [`lower_case_table_names`](/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names). + (Bug #32288105) +* **InnoDB:** + Partition table indexes were not checked when retrieving a + record count while that table's definition was being altered by + another client session. The record count was executed without + error. + + As of this release, the index is checked to ensure it is usable + when retrieving a record count. + (Bug #117459, Bug #37617773) +* **InnoDB:** + Refactored code related to BPR\_PCUR\_\* positioning for restore + operations. + (Bug #117259, Bug #37505746) + + References: This issue is a regression of: Bug #37318367. +* **InnoDB:** + Changes made to + [`innodb_spin_wait_delay`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_spin_wait_delay) in MySQL + 8.0.30 negatively impacted performance. + (Bug #116463, Bug #37212019) +* **InnoDB:** + Under certain circumstances, using [`ALTER + TABLE`](/doc/refman/8.0/en/alter-table.html) with `INPLACE` to modify the + size of a column could result in an index which exceeds the + valid size limit (767 bytes). This occurred for tables with a + row format of `Redundant` or + `Compact` and the row format was not explicitly + defined in the table creation. + + As of this release, a validation is performed and an error + returned by any ALTER TABLE, INPLACE operation which will result + in an invalid index size. + (Bug #116353, Bug #37168132) +* **InnoDB:** + Fixed a memory leak in the `Clone_persist_gtid` + thread. + + Our thanks to Baolin Huang and the team at Alibaba for the + contribution. + (Bug #107991, Bug #34454572) +* **Partitioning:** + When inserting [`NOW()`](/doc/refman/8.0/en/date-and-time-functions.html#function_now) into a + column not part of the partition key of a partitioned table, all + partitions were retrieved, and no pruning occurred. + (Bug #37397306) +* **Replication:** + In a source-replica setup, the replica encountered irregular + failures of [`UPDATE`](/doc/refman/8.0/en/update.html) and + [`DELETE`](/doc/refman/8.0/en/delete.html) statements with + [`ER_KEY_NOT_FOUND`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_key_not_found) errors on the + same table. (The replica's binary log and GTID records + showed that the row required was committed, and had not been + deleted or updated.) This occurred on the replica when the + row-matching algorithm used was `HASH_SCAN` and + two rows in the same table had the same CRC32 value. + + In the event of such a CRC32 collision, finding a matching CRC32 + in the hash table does not guarantee that the correct row is + being updated, so the algorithm iterates over any multiple + entries having the same CRC32, and compares the full record for + each of them in a loop; the problem occurred due to the fact + that the logic to exit this loop was incorrect. This logic has + now been corrected. + (Bug #37462058, Bug #37731216) +* **Replication:** + The + [`asynchronous_connection_failover_delete_source()`](/doc/refman/8.0/en/replication-functions-async-failover.html#function_asynchronous-connection-failover-delete-source) + function did not always perform as expected in all cases. + (Bug #36479088) +* **Replication:** + In some cases, the + [`asynchronous_connection_failover_add_source()`](/doc/refman/8.0/en/replication-functions-async-failover.html#function_asynchronous-connection-failover-add-source) + function did not perform as expected. + (Bug #36479083) +* **Replication:** + In some cases, [`MASTER_POS_WAIT()`](/doc/refman/8.0/en/replication-functions-synchronization.html#function_master-pos-wait) + did not perform as expected. + (Bug #36421684, Bug #37709187) +* **Replication:** + The + [`asynchronous_connection_failover_add_managed()`](/doc/refman/8.0/en/replication-functions-async-failover.html#function_asynchronous-connection-failover-add-managed) + function in some cases did not produce the expected result. + (Bug #34648589) +* **Replication:** + When the server was under a heavy write load, the binary log + position for [`gtid_executed`](/doc/refman/8.0/en/replication-options-gtids.html#sysvar_gtid_executed) as + shown in the Performance Schema + [`log_status`](/doc/refman/8.0/en/performance-schema-log-status-table.html) table did not match that + of the gtid shown in the binary log file. + + We fix this by increasing the scope of the lock on the + `log_status` table when querying it to ensure + that transactions in the commit pipeline are completed. This + ensures that a query against the `log_status` + table waits until `gtid_executed` has been + fully updated, thereby guaranteeing consistency with its + position in the binary log. + (Bug #102175, Bug #32442772) +* **Group Replication:** + When a secondary joined the group, it might happen that all + group members started to grow the value of the column + `COUNT_TRANSACTIONS_ROWS_VALIDATING` column of + the Performance Schema + [`replication_group_member_stats`](/doc/refman/8.0/en/performance-schema-replication-group-member-stats-table.html) + table indefinitely. This impacted memory consumption in all + group members, eventually leading to thrashing if not mitigated + by restarting the secondary group member that triggered the + behavior, or in some cases, by restarting the whole group. + + Analysis pointed to issues with the Group Replication start + operation, which checks whether there are partial transactions + on the `group_replication_applier` channel from + previous group participation; if any are found, this channel is + stopped after applying all complete transactions and its relay + logs purged, and then the channel is restarted. After this, + distributed recovery is performed, applying any missing data + from group members. + + The issues arose when the Group Replication pipeline operation + for stopping the `group_replication_applier` + channel incorrectly stopped a periodic task from the certifier + module, which caused some periodic internal operations not to + take place. One of these tasks was the periodic sending of the + committed transactions; this omission prevented garbage + collection for certification, which in turn caused a continuous + increase in + `COUNT_TRANSACTIONS_ROWS_VALIDATING` in the + Performance Schema + `replication_group_member_stats` table. + + To solve this problem, we have taken steps to ensure that the + pipeline operation for stopping the + `group_replication_applier` channel no longer + interferes with the certifier module, which also stops spurious + values from being added for + `COUNT_TRANSACTIONS_ROWS_VALIDATING`. + (Bug #37613510) +* **Group Replication:** + When running Group Replication, some transactions may not have + write sets, as with empty transactions with GTID\_NEXT specified, + or DDL statements. For such transactions, Group Replication + cannot check conflicts; thus, it is not known whether they can + be applied in parallel, and for this reason, Group Replication + follows a pessimistic approach, and runs them sequentially, + potentially leading to an impact on performance. + + While DDL must be applied sequentially, there is no actual + reason to force such behavior for empty transactions, so this + fix makes it possible for empty transactions to be applied + concurrently with other nondependent transactions. + (Bug #37597512, Bug #37569333) +* **Group Replication:** + A group running group replication with a primary + `i1` and two secondaries `i2` + and `i3` started to have intermittent issues + because of high memory usage on the primary. The secondaries + began reporting the primary as unreachable then reachable again, + and the primary began reporting the secondaries as + intermittently reachable then reachable as well. Following a + period of such instability, the secondaries expelled the + original primary (`i1`) and elected a new one + (`i2`). + + Under these conditions, queries against the + [`performance_schema.replication_group_members`](/doc/refman/8.0/en/performance-schema-replication-group-members-table.html) + table on the former primary (`i1`) reported + `i1` as `ONLINE` and + `PRIMARY`, `i2` as + `ONLINE` and `SECONDARY`, and + `i3` as `ONLINE` and + `SECONDARY` for an extended period of time (12 + hours or more) until the **mysqld** process was + restarted on `i1`. + + The problems observed were found to have begun on the original + primary (`i1`) when one of the secondaries was + overloaded and began intermittently leaving and joining the + group, its connections being dropped and recreated repeatedly on + the primary server. During the reconnection process, the primary + hung when trying to create the connection, thus blocking the + single XCom thread. This was traced to the invocation of + `SSL_connect()` on the XCom communication + stack, which changed in MySQL 8.0.27 from asynchronous to + synchronous form. When a node was overloaded, it might not + respond to the `SSL_connect()` call, leaving + the connecting end blocked indefinitely. + + To fix this, we now connect in a way that is non-blocking, and + that returns in case of a timeout, leaving the retry attempts to + the caller—in this specific case, the XCom thread when + trying to reconnect to another node. + (Bug #34348094, Bug #36047891) + + References: See also: Bug #37587252. +* The `fprintf_string()` function in + **mysqldump** did not use the actual quote + character for string escaping. + (Bug #37607195) +* [`EXPLAIN`](/doc/refman/8.0/en/explain.html) did not always handle + subqueries correctly. + (Bug #37560280) +* If a demangled function name exceeded 512 bytes in a stack + trace, the function name was truncated and a newline was not + printed. + + As of this release, long strings, such as filenames and + demangled functions, are written directly to the output. + (Bug #37543598) +* **mysqldump** did not escape certain special + characters properly in its output. With this fix, + **mysqldump** now follows the rules as described + in [String Literals](/doc/refman/8.0/en/string-literals.html). + (Bug #37540722, Bug #37709163) +* Some operations on tables having functional indexes were not + handled properly. + (Bug #37523857) +* Attempting to install an unknown component using + [`INSTALL COMPONENT`](/doc/refman/8.0/en/install-component.html) was not always + handled correctly. + (Bug #37437317) +* The Audit Log plugin did not handle errors correctly when + writing JSON output. + + See [MySQL Enterprise Audit](/doc/refman/8.0/en/audit-log.html), for more information. + (Bug #37370439) +* An [`UPDATE`](/doc/refman/8.0/en/update.html) subsequent to an + [`INSERT`](/doc/refman/8.0/en/insert.html) affecting a table which + had a `BEFORE INSERT` trigger was sometimes + rejected with a null value error when the + `INSERT` had set a `NOT NULL` + column to `NULL`, even though this should have + been allowed by the server + [`sql_mode`](/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_mode) in effect. + (Bug #37337527) +* In some cases, components could not reuse the same connection + for running multiple queries. + (Bug #37286895) +* Improved error handling for stored routines. + (Bug #37193011) +* Stored routines were not always invoked correctly in prepared + statements. + (Bug #37077424, Bug #37292797) +* Increased the size of `SEL_ROOT::elements` from + `uint16` to `size_t`. + (Bug #36610878) +* Removed an issue with multibyte UTF8 handling. + (Bug #36593253) +* An `ORDER BY` containing an aggregation was not + always handled correctly. + (Bug #36593244) +* An optimizer hint was ignored, unexpectedly requiring the use of + `FORCE INDEX`, when querying a view that + included a [`UNION`](/doc/refman/8.0/en/union.html). For more + information, see [Optimizer Hints](/doc/refman/8.0/en/optimizer-hints.html). + (Bug #36536936) +* Some subselects were not handled correctly. + (Bug #36421690) +* An invalid DDL statement in certain cases was not always + rejected as expected. + (Bug #35721121) +* Improved the internal function + `append_identifier()`. + (Bug #35633084) +* Normally, a view with an unused window definition should be + updatable, but when it contained a subquery, it was marked as + not updatable. At update time, the window was eliminated, but + this was too late to allow an update to be performed. + + We fix this by testing mergeability, by checking the presence of + window functions, rather than that of window definitions; this + allows the view to be updatable, and the problematic + [`UPDATE`](/doc/refman/8.0/en/update.html) to succeed. + (Bug #35507777) +* In some cases, [`SET`](/doc/refman/8.0/en/set.html) did not + perform correctly in prepared statements. + (Bug #35308309) +* This fix addresses the following issues: + + + `Query_expression::is_set_operation()` was + not always executed properly. + + Some sequences of DML statements could lead to an unplanned + exit. + + Some nested subselects were not always handled correctly. + + (Bug #34361287, Bug #35889583, Bug #35996409, Bug #36404149, Bug #36863048, Bug #37611264) +* On Debian, **dh\_strip\_nondeterminism** is no + longer executed on zip and gzip files within the packages. + (Bug #33791880) +* Removed an issue relating to invalid UTF8 values. + (Bug #27618273, Bug #37709687) +* Addressed an issue relating to an invalid identifier. + (Bug #22958632, Bug #37709664) +* A negative impact in performance was observed when using a + multivalued index with `ORDER BY DESC` and + `LIMIT` in a query, where the value specified + by `LIMIT` was greater than the number of rows + actually in the result. + (Bug #117085, Bug #37436310) + + References: This issue is a regression of: Bug #104897, Bug #33334911. +* When pushing a condition down to a derived table, we clone the + condition, and, if the underlying field is a view reference + (that is, a field from a merged derived table), we strip off the + view reference and clone the expression that it references. When + the underlying expression is a constant expression from a table + that is on the inner side of an outer join, it cannot be treated + as a normal constant because of the need to generate + `NULL` values. When we stripped off the view + reference, this information was lost, leading to wrong results. + + We fix this by avoiding condition pushdown for such cases. + (Bug #111355, Bug #35634714) diff --git a/corpus/changelog/mysql_releases/mysql_8043.md b/corpus/changelog/mysql_releases/mysql_8043.md new file mode 100644 index 0000000000000000000000000000000000000000..dee72a6c2f5774293bca7c5db86b50df7a24a205 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8043.md @@ -0,0 +1,390 @@ +# MySQL 8.0.43 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-43.html +Version: 8.0.43 + +## Changes in MySQL 8.0.43 (2025-07-22, General Availability) + +Note + +These release notes were created with the assistance of +MySQL HeatWave GenAI. + +* [Compilation Notes](news-8-0-43.html#mysqld-8-0-43-compiling "Compilation Notes") +* [InnoDB Notes](news-8-0-43.html#mysqld-8-0-43-innodb "InnoDB Notes") +* [Installation Notes](news-8-0-43.html#mysqld-8-0-43-installation "Installation Notes") +* [Packaging Notes](news-8-0-43.html#mysqld-8-0-43-packaging "Packaging Notes") +* [Functionality Added or Changed](news-8-0-43.html#mysqld-8-0-43-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-0-43.html#mysqld-8-0-43-bug "Bugs Fixed") + +### Compilation Notes + +* **macOS:** + It is now possible to compile the server on MacOS using + `-DWITH_KERBEROS`. +* Upgraded the bundled `libcurl` library to + version 8.14.1. + (Bug #38042758) +* MySQL Server now supports CMake 4, ensuring compatibility with + future CMake versions where support for versions prior to 3.10 + is expected to be discontinued. + (Bug #38027636) +* The included ICU library has been upgraded to version 77-1. + (Bug #37870791) +* The included `zstd` library has been upgraded + to version 1.5.7. + (Bug #37869972) +* Disabled `clang::musttail` when building with + GCC 15. + (Bug #37776018) +* Implemented the standards-compliant + `my_char_traits` for use + as a drop-in replacement for + `std::char_traits`, which + was deprecated in Clang 18 and removed in Clang 19. + (Bug #37273525, Bug #37785339) +* The linker tried to use the empty Cmake variable + `${ICU_LIBRARIES}`, even though the correct + library (`ext::icu`) was already linked + elsewhere. + (Bug #36524167) +* When compiling on Fedora 38, **grep + -E** is now used in place of + **egrep**. + (Bug #36507549) +* Compiling on macOS looked explicitly for + `openssl@1.1` but now looks for the generic + `openssl` symlink instead, to allow for + `openssl@3`. + (Bug #35468370) + +### InnoDB Notes + +* Fixed an issue relating to importing tables. + (Bug #37621360) + +### Installation Notes + +* Debian packages for installing MySQL can now be run by users + other than root. This helps prevent issues for Debian or Ubuntu + systems that require rootless installations. + (Bug #37765153) + +### Packaging Notes + +* On Fedora 24, Oracle MySQL RPMs could not be installed due to + package conflicts when MariaDB was already installed on the + system. With this fix, the conflicts are not properly handled to + allow MySQL Server to be installed successfully. + (Bug #37798784) + +### Functionality Added or Changed + +* **Important Change:** + Added the **mysql** client + [`--commands`](/doc/refman/8.0/en/mysql-command-options.html#option_mysql_commands) option, which enables + or disables most **mysql** client commands. + + This option is enabled by default. To disable it, start the + client with `--commands=OFF` or + [`--skip-commands`](/doc/refman/8.0/en/mysql-command-options.html#option_mysql_commands). + + For a complete list of all commands affected by this option, and + additional information, see + [mysql Client Options](/doc/refman/8.0/en/mysql-command-options.html). + (WL #16949) + + References: See also: Bug #36416568, Bug #38066040. +* **Group Replication:** + Added the error + [`ER_GRP_RPL_APPLIER_THD_KILLED`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_grp_rpl_applier_thd_killed), + to distinguish when the applier thread has been terminated using + SQL KILL, rather than stopped by an error. + (Bug #37764717) +* Binary packages that include `curl` rather than + linking to the system `curl` library have been + upgraded to use `curl` 8.14.1. + (Bug #37389565) + +### Bugs Fixed + +* **Important Note; Group Replication:** + The Group Communication System (GCS) handles Group Replication + communication between members, and keeps track of the group + membership and connections between all group members. Membership + tracking includes the membership's current and previous two + iterations. When a member leaves, the remaining members in the + group keep a record of the departing member but stop + communicating with it until it returns. For example: The group + contains members M1, M2, and M3. M3 leaves the group; M1 and M2 + stop communicating with M3. When a new member (M4) joins, it + learns the previous iterations of this group's membership + and attempts to communicate with all servers, including those + from previous iterations (in this case, M3). + + In the event that some previous servers were gone and did not + return, the new member continuously tried to connect to the + missing servers; in some conditions, these ongoing connection + attempts could introduce network latency affecting group member + communication. + + In order to avoid this issue, connections to servers that belong + to iterations of the group membership are now stopped after 5 + minutes, which should be sufficient time to re-establish valid + connections without imposing a continuing impact on group + communication. + (Bug #37704514) +* **NDB Cluster:** + Following an upgrade from NDB 8.0 to NDB 8.4, all data nodes in + the cluster underwent an unexpected simultaneous restart. This + occurred when the transaction coordinator had no scan state, + leading to protocol timeout; the resulting misalignment in + protocol states caused data nodes to shut down unexpectedly. + This is fixed by extending existing handling of an unexpected + `SCAN_NEXTREQ` signal to cover the case when + the scan is already stateless. + (Bug #37994985) + + References: This issue is a regression of: Bug #37022901. +* **NDB Cluster:** + Concurrent [`ALTER TABLE`](/doc/refman/8.0/en/alter-table.html) statements + could cause delays of up to 100 \* + `TransactionDeadlockDetectionTimeout` + before failing with a lock wait timeout when a client held a + conflicting row lock, stalling the accompanying + `get_commit_count()` call. The retry mechanism + has been adjusted to identify locking issues sooner. + (Bug #37955025) +* **InnoDB:** + When rebuilding a primary key, the server sometimes encountered + issues when duplicates were present, potentially leading to the + server stopping unexpectedly. + + Our thanks to Xizhe Zhang and the team at Alibaba for the + contribution. + (Bug #37822992) +* **InnoDB:** + Fixed an issue relating to dropping columns that were part of an + index. + (Bug #37726881) +* **InnoDB:** + Fixed an issue relating to DELETE operations. + (Bug #37478594) +* **InnoDB:** + Creating a secondary index on a + [`VARCHAR`](/doc/refman/8.0/en/char.html) column could allocate + more memory than configured, with the amount allocated being + directly related to the value of + [`innodb_ddl_buffer_size`](/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_ddl_buffer_size), leading + to errors similar to ERROR 1136 (21S01): Column count + doesn't match value count at row 1. + (Bug #37233273) +* **InnoDB:** + Fixed an issue relating to indexing spatial datatype columns. + (Bug #36682518) +* **InnoDB:** + A long semaphore wait crash could occur when a redo log consumer + lagged behind after a failed MySQL Enterprise Backup incremental backup, + preventing the redo log writer thread from advancing. Error + messages were returned similar to the following: + + ```None + [Warning] [MY-013934] [InnoDB] Redo log writer is waiting for MEB redo + log consumer which is currently reading LSN=23335640211468 preventing + reclamation of subsequent portion of the redo log. Consider + increasing innodb_redo_log_capacity. + ``` + + (Bug #36330455) +* **InnoDB:** + Fixed an issue relating to range queries on tables. + (Bug #31360522) + + References: See also: Bug #38063122. +* **Partitioning:** + Truncating a partition was rejected with a duplicate entry error + when the partition ID exceeded `INT_MAX`, + preventing creation of new partitioned tables. To mitigate this + issue, the `Table_partition_values_pk` class + constructor now uses `ulonglong` instead of + `int` for the object ID. + (Bug #35912852) +* **Replication:** + When using replication in a chain, + [`CREATE + TABLE ... AS SELECT`](/doc/refman/8.0/en/create-table-select.html) sometimes resulted in inconsistent + entries in the binary log, potentially causing replication to + break on downstream servers. Error messages related to this + issue included errors resulting from missing + [`START + TRANSACTION`](/doc/refman/8.0/en/commit.html) statements in the log. + (Bug #37986380) +* **Replication:** + During semisync replication, when the length of the binary log + suffix exceeded six digits (`.999999`), so + that the next log file became—for + example—`mysql-bin.1000000`, the + replication protocol unexpectedly changed from semisynchronous + to asynchronous. + + Our thanks to Wuhao Cao and Karry Zhang and the team at Alibaba + for the contribution. + (Bug #115861, Bug #113813, Bug #37024069, Bug #36246779) +* **Group Replication:** + In an unstable network environment, a Group Replication + InnoDB Cluster with + [`group_replication_paxos_single_leader=ON`](/doc/refman/8.0/en/group-replication-system-variables.html#sysvar_group_replication_paxos_single_leader) + experienced several long-running transactions that became stuck + in the `waiting for handler commit` state. As a + consequence, + [`group_replication_set_as_primary()`](/doc/refman/8.0/en/group-replication-functions-for-new-primary.html#function_group-replication-set-as-primary) + was forced to wait, which in turn blocked other incoming queries + and rendered the cluster unwritable. + + The issue involving long-running transactions stuck in + `waiting for handler commit` occurred as + follows: During an intermittent network partition, a secondary + node incorrectly assumed the leader role due to outdated or + inaccurate membership information. This resulted in conflicts in + synode number allocation, causing transactions originating from + the primary node to remain incomplete. + + We fix this by making sure that a secondary node always reflect + the latest, accurate state before pushing the view message to + Paxos. This ensures that outdated or inconsistent membership + information does not lead to conflicts in leadership or synode + number allocation. + (Bug #37764970) + + References: See also: Bug #117424, Bug #37237959, Bug #37645674. +* **NDB Cluster APIs:** + Excluding a [`VARCHAR`](/doc/refman/8.0/en/char.html) column from + an event definition resulted in an Invalid schema + object version error. + (Bug #37766391) + + References: See also: Bug #31848270. +* Some triggers which called stored routines did not always + execute correctly. + (Bug #37915445) +* A view using a CTE which contained a subquery was not always + handled correctly. + (Bug #37832605) +* [`WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS()`](/doc/refman/8.0/en/gtid-functions.html#function_wait-until-sql-thread-after-gtids) + did not always execute correctly. + (Bug #37829550) + + References: See also: Bug #38063175. +* Improved a previous fix for an issue in which client connections + were not always terminated correctly during shutdown. + (Bug #37755594) + + References: This issue is a regression of: Bug #35854919. +* The Fedora 42 RPM installation packages have been adapted to + accommodate the merged `/usr/bin` and + `/usr/sbin` directories in Fedora 42 and + later. + (Bug #37737658) +* Performance of fulltext searches using + `InnoDB`, particularly for phrase searches, has + been improved. The efficiency of `doc_id` + matching has been enhanced. + (Bug #37682648) +* Queries against the + [`performance_schema.keyring_keys`](/doc/refman/8.0/en/performance-schema-keyring-keys-table.html) + table caused issues when the `keyring_okv` + plugin (see [Using the keyring\_okv KMIP Plugin](/doc/refman/8.0/en/keyring-okv-plugin.html)) was installed + but not configured correctly. + (Bug #37655299) +* The fix for Bug #30875669 was not actually included in the code + for the **mysql** client when the bug was closed. + The changes are now implemented. + (Bug #37572191) + + References: See also: Bug #30875669. +* An init file having one or more single lines, each containing + multiple SQL statements, sometimes gave rise to errors during + initialization. + (Bug #37559598) +* Some sequences of [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) + and [`DROP TABLE`](/doc/refman/8.0/en/drop-table.html) statements were + not handled correctly. + (Bug #37534068) + + References: This issue is a regression of: Bug #35721121. +* [`UPDATE ... SET + ...`](/doc/refman/8.0/en/update.html) could not always be rolled back successfully. + (Bug #37489167) +* Multiple `DEFAULT` column expressions in + [`CREATE TABLE`](/doc/refman/8.0/en/create-table.html) statements were not + always handled correctly. + (Bug #37436220) +* Queries having a correlated subquery which performed aggregation + were sometimes (incorrectly) rejected with duplicate key errors + during execution. + + This issue was introduced by a previous fix which removed the + restoration of the original reference slice + (`set_ref_item_slice(REF_SLICE_SAVED_BASE)`) + during `JOIN::cleanup()` execution under the + assumption that this was not necessary. As a result, temporary + table field references from previous executions were not + cleared, leading to attempts to insert duplicate keys into + temporary tables triggering the error Can't write; + duplicate key in table. + + We fix this by restoring the original reference slice during + cleanup, ensuring that any stale references are discarded. + (Bug #37415167) + + References: See also: Bug #32141711. This issue is a regression of: Bug #35856247. +* Unquoted semicolon characters (`;`) within + comments were not always flagged as errors, in spite of the fact + that they are not allowed. + (Bug #37117875) + + References: See also: Bug #38063286. +* A query using a nested aggregate function which contained a + subquery was not always properly handled. + (Bug #36421727) +* When attempting to transform a subquery to a derived table, + certain cases were not always considered. + (Bug #36421710) + + References: This issue is a regression of: Bug #36921175. +* With [`optimizer_switch`](/doc/refman/8.0/en/server-system-variables.html#sysvar_optimizer_switch) set to + [`subquery_to_derived=on`](/doc/refman/8.0/en/switchable-optimizations.html#optflag_subquery-to-derived), some + queries with `ROLLUP` were not handled + properly. + (Bug #36314993) +* Setting [`max_join_size`](/doc/refman/8.0/en/server-system-variables.html#sysvar_max_join_size) led to + improper processing of some nested queries. + (Bug #35625769) +* Events created within stored programs were not always handled + correctly. + (Bug #35395333, Bug #36402968, Bug #37918920) + + References: This issue is a regression of: Bug #17809, Bug #11745618. +* The transform of a scalar subquery into a join with a derived + table where the subquery is in the + [`SELECT`](/doc/refman/8.0/en/select.html) list and the containing + query is implicitly grouped should be allowed, but was rejected + when the [`subquery_to_derived`](/doc/refman/8.0/en/switchable-optimizations.html#optflag_subquery-to-derived) + optimizer switch was enabled. + (Bug #35150438) +* An error in `include/assert_grep.inc` could + lead to erroneous results from any file that included it. + + Out thanks to Ke Yu for the contribution. + (Bug #116239, Bug #37105430, Bug #37675340) +* The query rewrite plugin (see + [The Rewriter Query Rewrite Plugin](/doc/refman/8.0/en/rewriter-query-rewrite-plugin.html)) did not work + properly when the server was run with + [`autocommit=OFF`](/doc/refman/8.0/en/server-system-variables.html#sysvar_autocommit). + (Bug #115437, Bug #36784795) +* Improved comments in + `sql/range_optimizer/rowid_ordered_retrieval_plan.cc`. + + Our thanks to Xiaodong Huang and the Tencent team for the + contribution. + (Bug #107972, Bug #34422274) diff --git a/corpus/changelog/mysql_releases/mysql_8044.md b/corpus/changelog/mysql_releases/mysql_8044.md new file mode 100644 index 0000000000000000000000000000000000000000..9b00b123c3e256f2755d7321c0c16c9c50095264 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8044.md @@ -0,0 +1,139 @@ +# MySQL 8.0.44 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-44.html +Version: 8.0.44 + +## Changes in MySQL 8.0.44 (2025-10-21, General Availability) + +Note + +These release notes were created with the assistance of +MySQL HeatWave GenAI. + +* [Audit Log Notes](news-8-0-44.html#mysqld-8-0-44-audit-log "Audit Log Notes") +* [Compilation Notes](news-8-0-44.html#mysqld-8-0-44-compiling "Compilation Notes") +* [SQL Function and Operator Notes](news-8-0-44.html#mysqld-8-0-44-functions-operators "SQL Function and Operator Notes") +* [InnoDB Notes](news-8-0-44.html#mysqld-8-0-44-innodb "InnoDB Notes") +* [Optimizer Notes](news-8-0-44.html#mysqld-8-0-44-optimizer "Optimizer Notes") +* [Packaging Notes](news-8-0-44.html#mysqld-8-0-44-packaging "Packaging Notes") +* [Performance Schema Notes](news-8-0-44.html#mysqld-8-0-44-performance-schema "Performance Schema Notes") +* [Bugs Fixed](news-8-0-44.html#mysqld-8-0-44-bug "Bugs Fixed") + +### Audit Log Notes + +* Improved performance related to adding multiple + `general_sql_command.str` fields to an + Enterprise Audit filter. + (Bug #38053242) +* Fixed an issue related to `audit_log_read` + performance. + (Bug #36281295, Bug #38275868) + +### Compilation Notes + +* OpenSSL 3 is now used on Solaris. + (Bug #38193362) +* Upgraded the bundled googletest library to version 1.17. + (Bug #38152017) +* Upgraded the bundled libbacktrace library to the latest version + (April 2025). + (Bug #38151970) +* Warnings raised by Clang 20 for non-trivially copyable types, + deprecated literal operators, and incorrect + `main` function declarations are no longer + generated. + (Bug #37785251) + +### SQL Function and Operator Notes + +* Fixed an issue related to executing certain UPDATE statements. + (Bug #37590580) + + References: This issue is a regression of: Bug #31562881. + +### InnoDB Notes + +* Creating a thread for parallel scan may fail, resulting in + assertion failures when it fell back to single-thread mode. + Errors were returned similar to the following: + + ```None + Assertion failure: row0pread.h:306:active >= n_threads + ``` + + (Bug #38325137) +* Under certain circumstances, a virtual index rollback could fail + on 32-bit builds of MySQL Server. + (Bug #38167527) +* If the buffer pool was very large, it could lead to a large + number of chunks required by each buffer pool instance, which + could fail if the operating system was unable to allocate the + required memory. + + As of this release, this allocation is checked to ensure it is + allocated correctly. + (Bug #37994397) +* Users could encounter an assertion failure due to a data size + and bounds mismatch. Errors were returned similar to the + following: + + ```None + Assertion failure: ddl0file-reader.cc:193:m_ptr + data_size < + m_bounds.second + ``` + + (Bug #37882398) + + References: This issue is a regression of: Bug #37233273. +* Fixed an issue relating to modifying the internal FTS + configuration. + (Bug #37792010) +* Fixed an issue related to virtual indexes. + (Bug #37602657) +* If the row size exceeded the maximum allowed size due to + `innodb_strict_mode=OFF`, confusing warning + messages similar to "Cannot add field" could appear in certain + situations, such as selecting from a table or dropping a column. + + Error messages are improved for this scenario. + (Bug #37003342, Bug #36768046, Bug #36867372) + +### Optimizer Notes + +* Fixed an issue relating to SQL queries involving correlated + scalar subqueries and JSON tables. + (Bug #36684370) + +### Packaging Notes + +* For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 3.0.17. For more information, see + [OpenSSL + 3.0 Series Release Notes](https://github.com/openssl/openssl/blob/openssl-3.0/CHANGES.md). + (Bug #38457056) +* The RPM specification and DEB control files were missing several + requirements, making it impossible to build those formats. + (Bug #38310603) + +### Performance Schema Notes + +* Connections waiting on the connection control plugin were not + displayed in the + `performance_schema.processlist` table. + (Bug #38043683) + +### Bugs Fixed + +* Logical clock handling for `CREATE ... SELECT` + statements has been improved to ensure accurate logical clock + values in the replica relay log. + (Bug #38383106) +* The server sometimes processed table references incorrectly. + (Bug #38001000) +* `PARTITION BY ... (DEFAULT + (column))` was not always + handled correctly. + (Bug #111234, Bug #35451459) + + References: This issue is a regression of: Bug #33142135. diff --git a/corpus/changelog/mysql_releases/mysql_8045.md b/corpus/changelog/mysql_releases/mysql_8045.md new file mode 100644 index 0000000000000000000000000000000000000000..579de4338cf2e6d88c9a1e749f25207baa9db7cd --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_8045.md @@ -0,0 +1,85 @@ +# MySQL 8.0.45 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-45.html +Version: 8.0.45 + +## Changes in MySQL 8.0.45 (2026-01-20, General Availability) + +Note + +These release notes were created with the assistance of +MySQL HeatWave GenAI. + +* [InnoDB Notes](news-8-0-45.html#mysqld-8-0-45-innodb "InnoDB Notes") +* [Optimizer Notes](news-8-0-45.html#mysqld-8-0-45-optimizer "Optimizer Notes") +* [Packaging Notes](news-8-0-45.html#mysqld-8-0-45-packaging "Packaging Notes") +* [Bugs Fixed](news-8-0-45.html#mysqld-8-0-45-bug "Bugs Fixed") + +### InnoDB Notes + +* **InnoDB:** + InnoDB redo logging error messages now include the current LSN + and redo log capacity information. A new warning code + [`ER_IB_WRN_REDO_DISABLED_INFO`](/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_ib_wrn_redo_disabled_info) is + added which includes the current LSN. A new error code + `ER_IB_MSG_LOG_WRITER_WAIT_ON_NEW_LOG_FILE_INFO` + is added to include the current log capacity and the current log + capacity used. The `MONITOR` output has been + enhanced to include redo log capacity details and current log + capacity. + + The warning `ER_IB_WRN_REDO_DISABLED` was + removed, as was the error + `ER_IB_MSG_LOG_WRITER_WAIT_ON_NEW_LOG_FILE`. + (Bug #37645185) +* Fixed an issue related to bulk inserts. + (Bug #38208188) + +### Optimizer Notes + +* Fixed an issue relating to Common Table Expressions (CTE). + (Bug #38573285) +* Fixed an issue related to executing specific SQL queries. + (Bug #38448700) +* Fixed an issue relating to `SHOW CREATE TABLE`. + (Bug #38298692) +* Queries which used REGEXP took longer to execute as prepared + statements than as direct queries. + (Bug #114056, Bug #36326728) + +### Packaging Notes + +* For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 3.0.18. For more information, see + [OpenSSL + 3.0 Series Release Notes](https://github.com/openssl/openssl/blob/openssl-3.0/CHANGES.md). + (Bug #38632932) + +### Bugs Fixed + +* **InnoDB:** + Under certain circumstances, when using the + `que_eval_sql` interface, a race condition + could occur. + (Bug #118705, Bug #38310595) +* Binary log purged before persisted + `binlog_expire_*` options were loaded. + (Bug #38554467) +* When 2 of 6 instances in a geographically dispersed + InnoDB Cluster lost connectivity, the primary server became + unresponsive, causing the `COMMIT` and + `INSERT` operations to become unresponsive as + well. + (Bug #38380392) +* Fixed several issues relating to Thread Pool blocking + connections from closing. + (Bug #38170188, Bug #36782728, Bug #38549372) +* GTID gaps were generated because of the `replica- + skip-errors` option. + (Bug #28590993) +* If server was started on Windows platforms with + --skip-grant-tables, privileges were not checked and remote + connections were not permitted. As a result, the server might + not start. + (Bug #118805, Bug #38328780) diff --git a/corpus/changelog/mysql_releases/mysql_840.md b/corpus/changelog/mysql_releases/mysql_840.md new file mode 100644 index 0000000000000000000000000000000000000000..4bdaed285553ca8065bc08d0480c5d3f4442ef1a --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_840.md @@ -0,0 +1,1641 @@ +# MySQL 8.4.0 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.4/en/news-8-4-0.html +Version: 8.4.0 + +## Changes in MySQL 8.4.0 (2024-04-30, LTS Release) + +* [Audit Log Notes](news-8-4-0.html#mysqld-8-4-0-audit-log "Audit Log Notes") +* [C API Notes](news-8-4-0.html#mysqld-8-4-0-capi "C API Notes") +* [Character Set Support](news-8-4-0.html#mysqld-8-4-0-charset "Character Set Support") +* [Compilation Notes](news-8-4-0.html#mysqld-8-4-0-compiling "Compilation Notes") +* [Configuration Notes](news-8-4-0.html#mysqld-8-4-0-configuration "Configuration Notes") +* [Deprecation and Removal Notes](news-8-4-0.html#mysqld-8-4-0-deprecation-removal "Deprecation and Removal Notes") +* [Firewall Notes](news-8-4-0.html#mysqld-8-4-0-firewall "Firewall Notes") +* [INFORMATION\_SCHEMA Notes](news-8-4-0.html#mysqld-8-4-0-information-schema "INFORMATION_SCHEMA Notes") +* [Installation Notes](news-8-4-0.html#mysqld-8-4-0-installation "Installation Notes") +* [Keyring Notes](news-8-4-0.html#mysqld-8-4-0-keyring "Keyring Notes") +* [Optimizer Notes](news-8-4-0.html#mysqld-8-4-0-optimizer "Optimizer Notes") +* [Performance Schema Notes](news-8-4-0.html#mysqld-8-4-0-performance-schema "Performance Schema Notes") +* [Server Administration](news-8-4-0.html#mysqld-8-4-0-server-admin "Server Administration") +* [Thread Pool Notes](news-8-4-0.html#mysqld-8-4-0-thread-pool "Thread Pool Notes") +* [Functionality Added or Changed](news-8-4-0.html#mysqld-8-4-0-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-4-0.html#mysqld-8-4-0-bug "Bugs Fixed") + +### Audit Log Notes + +* Invoking + [`audit_api_message_emit_udf()`](/doc/refman/8.4/en/audit-api-message-emit.html#function_audit-api-message-emit-udf) with + arguments of mixed types could lead to an unplanned shutdown of + the server. + (Bug #36301441) +* Audit log filtering by type, using error as the type, did not + work correctly. + (Bug #36142157) +* Following an unplanned shutdown and restart, the file that was + in use by the server for writing at the time may be broken or + otherwise unreadable. The Audit Log plugin log message + indicating unreadability of the file was shown as an error; now + instead this message is treated as a warning. + (Bug #36118809) + +### C API Notes + +* **Important Change:** + The following MySQL C API functions, removed in MySQL 8.3, have + been reimplemented and restored in MySQL 8.4.0: + + + [`mysql_kill()`](/doc/c-api/8.4/en/mysql-kill.html): In place of + `COM_PROCESS_KILL` (removed), this function + has been reimplemented such that it uses + [`mysql_real_query()`](/doc/c-api/8.4/en/mysql-real-query.html) to + execute [`KILL`](/doc/refman/8.4/en/kill.html). + + [`mysql_list_fields()`](/doc/c-api/8.4/en/mysql-list-fields.html): + Restored as previously implemented, along with + `COM_FIELD_LIST`. + + [`mysql_list_processes()`](/doc/c-api/8.4/en/mysql-list-processes.html): + Reimplemented using + [`mysql_real_query()`](/doc/c-api/8.4/en/mysql-real-query.html) to + execute [`SHOW PROCESSLIST`](/doc/refman/8.4/en/show-processlist.html), in + place of `COM_PROCESS_INFO` (removed). + + [`mysql_refresh()`](/doc/c-api/8.4/en/mysql-refresh.html): + Reimplemented using + [`mysql_real_query()`](/doc/c-api/8.4/en/mysql-real-query.html) to + execute [`FLUSH`](/doc/refman/8.4/en/flush.html) statements in + place of `COM_REFRESH`, which was removed + in MySQL 8.3. + + [`mysql_reload()`](/doc/c-api/8.4/en/mysql-reload.html) + + [`mysql_shutdown()`](/doc/c-api/8.4/en/mysql-shutdown.html): + Reimplemented using mysql\_real\_query() to execute a shutdown + command rather than `COM_SHUTDOWN`, removed + in MySQL 8.3. + + [`mysql_ssl_set()`](/doc/c-api/8.4/en/mysql-ssl-set.html) + + [`mysql_stmt_bind_param()`](/doc/c-api/8.4/en/mysql-stmt-bind-param.html) + + The functions just listed are supported for the lifetime of the + MySQL 8.4 series. + (WL #16221) +* **Microsoft Windows:** + Third party DLL files on which MySQL plugins depend are located, + when installed, in the same directory as the MySQL executables. + The default Windows behavior is to look for dependences in the + same directory as the current executable, which is not + appropriate for clients using `libmysql.dll` + outside of the installation directory. + + We fix this by that changing the default behavior of MySQL + clients so that the loader looks for dependencies in the + directory of current module (the executable or + `libmysql.dll`). In addition, since + `libsasl.dll` expects to load all its + required dependencies from a directory of its won, SASL plugins + are now located in a dedicated subdirectory. + (Bug #36006295) + +### Character Set Support + +* When the [`character_set_server`](/doc/refman/8.4/en/server-system-variables.html#sysvar_character_set_server) + system variable was set using + [`SET + PERSIST`](/doc/refman/8.4/en/set-variable.html) or `SET GLOBAL`, it did not + take effect for new client sessions or for a client establishing + a connection to the server after the server was restarted. The + only workaround was to set the corresponding command-line option + when starting the server. + + To fix this, we now make sure that, at the time of server + restart, the configuration data is read in the correct order so + that the variable setting takes effect as expected. + (Bug #35529604) + +### Compilation Notes + +* The `libevent` library has been removed. + (Bug #36357190) +* Added the `libcno` library. + (Bug #36357181) +* Some of the files in `extra/libbacktrace` + contained incorrect licensing information, copyright + information, or both. + (Bug #36118772) +* Warnings for unused variables are turned into compilation errors + when compiling with + [`-DMYSQL_MAINTAINER_MODE=1`](/doc/refman/8.4/en/source-configuration-options.html#option_cmake_mysql_maintainer_mode). To + avoid this use `-DMYSQL_MAINTAINER_MODE=0` to + disable such errors. + (Bug #113662, Bug #36198423) + +### Configuration Notes + +* **Microsoft Windows:** + On Windows, *MySQL Configurator* incorrectly + altered the configuration settings after the + Back and Next buttons + were used. + (Bug #36156577) +* **Microsoft Windows:** + On Windows, *MySQL Configurator* no longer + opens when removing a MySQL Server that was not configured. + (Bug #35709927) +* **Microsoft Windows:** + On Windows, MySQL Configurator stopped adding the + `default_authentication_plugin` variable to the + generated `my.ini` file, a variable removed + in MySQL Server 8.4. It also removes it when upgrading an + installation to MySQL 8.4. Note that the replacement variable + `authentication_policy` is not set by + *MySQL Configurator*. + (WL #16137) +* **Microsoft Windows:** + On Windows, MySQL Configurator no longer allows upgrading from + MySQL 5.7 or earlier, when before it allowed the upgrade to + execute after stating that it was not officially supported. + (WL #16138) + +### Deprecation and Removal Notes + +* **Important Change:** + The deprecated `mysql_native_password` + authentication plugin is now disabled by default. It can be + enabled by starting MySQL with the new + [`--mysql-native-password=ON`](/doc/refman/8.4/en/server-options.html#option_mysqld_mysql-native-password) server + option, or by adding `mysql_native_password=ON` + to the `[mysqld]` section of your MySQL + configuration file. + + For more information, see + [Native Pluggable Authentication](/doc/refman/8.4/en/native-pluggable-authentication.html). + (Bug #36337893) +* **Partitioning:** + Silent omission of columns with index prefixes as part of a + table's partitioning key was deprecated in MySQL 8.0.21, + and generated a warning. In this release, the use of any such + columns in the proposed partitioning key is now expressly + disallowed, and causes the [`CREATE + TABLE`](/doc/refman/8.4/en/create-table.html) or [`ALTER TABLE`](/doc/refman/8.4/en/alter-table.html) + statement in which it occurs to be rejected with an error. + + For more information, see + [Column index prefixes not supported for key partitioning](/doc/refman/8.4/en/partitioning-limitations.html#partitioning-limitations-prefixes), and + [KEY Partitioning](/doc/refman/8.4/en/partitioning-key.html). + (WL #16054) + + References: See also: Bug #31100205. +* **Replication:** + Syntax for a number of features relating to MySQL Replication + that was deprecated in previous versions of MySQL has now been + removed. These features include aspects of SQL statement syntax + as well as several system status variables in the MySQL server. + These changes are detailed following. + + **SQL statements removed.** + The following SQL statements have been removed (replacements + in brackets): `START SLAVE` + ([`START REPLICA`](/doc/refman/8.4/en/start-replica.html)); `STOP + SLAVE` ([`STOP REPLICA`](/doc/refman/8.4/en/stop-replica.html)); + `SHOW SLAVE STATUS` + ([`SHOW REPLICA STATUS`](/doc/refman/8.4/en/show-replica-status.html)); + `SHOW SLAVE HOSTS` ([`SHOW + REPLICAS`](/doc/refman/8.4/en/show-replicas.html)); `RESET SLAVE` + (`RESET REPLICA`); `CHANGE MASTER + TO` ([`CHANGE REPLICATION SOURCE + TO`](/doc/refman/8.4/en/change-replication-source-to.html)); `RESET MASTER` + ([`RESET BINARY LOGS AND GTIDS`](/doc/refman/8.4/en/reset-binary-logs-and-gtids.html)); + `SHOW MASTER STATUS` + ([`SHOW BINARY LOG STATUS`](/doc/refman/8.4/en/show-binary-log-status.html)); + `PURGE MASTER LOGS` + ([`PURGE BINARY LOGS`](/doc/refman/8.4/en/purge-binary-logs.html)); and + `SHOW MASTER LOGS` ([`SHOW + BINARY LOGS`](/doc/refman/8.4/en/show-binary-logs.html)). + + The statements just listed have also been removed from all MySQL + test programs and files, and elsewhere, where used internally. + + **Statement options removed.** + The following options formerly supported by + [`CHANGE REPLICATION SOURCE TO`](/doc/refman/8.4/en/change-replication-source-to.html) + and [`START REPLICA`](/doc/refman/8.4/en/start-replica.html) have been + removed and are no longer accepted by the server. They are + listed here for each of these statements, with their + replacements in brackets: + + + `CHANGE REPLICATION SOURCE TO` options + removed: + + `MASTER_AUTO_POSITION` + ([`SOURCE_AUTO_POSITION`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_auto_position)), + `MASTER_HOST` + ([`SOURCE_HOST`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_host)), + `MASTER_BIND` + ([`SOURCE_BIND`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_bind)), + `MASTER_USER` + ([`SOURCE_USER`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_user)), + `MASTER_PASSWORD` + ([`SOURCE_PASSWORD`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_password)), + `MASTER_PORT` + ([`SOURCE_PORT`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_port)), + `MASTER_CONNECT_RETRY` + ([`SOURCE_CONNECT_RETRY`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_connect_retry)), + `MASTER_RETRY_COUNT` + ([`SOURCE_RETRY_COUNT`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_retry_count)), + `MASTER_DELAY` + ([`SOURCE_DELAY`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_delay)), + `MASTER_SSL` + ([`SOURCE_SSL`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_ssl)), + `MASTER_SSL_CA` + ([`SOURCE_SSL_CA`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_ssl_xxx)), + `MASTER_SSL_CAPATH` + ([`SOURCE_SSL_CAPATH`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_ssl_xxx)), + `MASTER_SSL_CIPHER` + ([`SOURCE_SSL_CIPHER`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_ssl_xxx)), + `MASTER_SSL_CRL` + ([`SOURCE_SSL_CRL`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_ssl_xxx)), + `MASTER_SSL_CRLPATH` + ([`SOURCE_SSL_CRLPATH`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_ssl_xxx)), + `MASTER_SSL_KEY` + ([`SOURCE_SSL_KEY`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_ssl_xxx)), + `MASTER_SSL_VERIFY_SERVER_CERT` + ([`SOURCE_SSL_VERIFY_SERVER_CERT`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_ssl_xxx)), + `MASTER_TLS_VERSION` + ([`SOURCE_TLS_VERSION`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_ssl_xxx)), + `MASTER_TLS_CIPHERSUITES` + ([`SOURCE_TLS_CIPHERSUITES`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_ssl_xxx)), + `MASTER_SSL_CERT` + ([`SOURCE_SSL_CERT`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_ssl_xxx)), + `MASTER_PUBLIC_KEY_PATH` + ([`SOURCE_PUBLIC_KEY_PATH`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_public_key_path)), + `GET_MASTER_PUBLIC_KEY` + ([`GET_SOURCE_PUBLIC_KEY`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-get_source_public_key)), + `MASTER_HEARTBEAT_PERIOD` + ([`SOURCE_HEARTBEAT_PERIOD`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_heartbeat_period)), + `MASTER_COMPRESSION_ALGORITHMS` + ([`SOURCE_COMPRESSION_ALGORITHMS`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_compression_algorithms)), + `MASTER_ZSTD_COMPRESSION_LEVEL` + ([`SOURCE_ZSTD_COMPRESSION_LEVEL`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_zstd_compression_level)), + `MASTER_LOG_FILE` + ([`SOURCE_LOG_FILE`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_log_file)), and + `MASTER_LOG_POS` + ([`SOURCE_LOG_POS`](/doc/refman/8.4/en/change-replication-source-to.html#crs-opt-source_log_file)). + + `START REPLICA` options removed: + `MASTER_LOG_FILE` + (`SOURCE_LOG_FILE`) and + `MASTER_LOG_POS` + (`SOURCE_LOG_POS`). + + **Status variables removed.** + Also as part of this work, the following system status + variables have been removed from the server, and no longer + appear in the output of statements such as + [`SHOW STATUS`](/doc/refman/8.4/en/show-status.html). These variables + are listed here, with their replacements in brackets: + `Com_slave_start` + (`Com_replica_start`); + `Com_slave_stop` + (`Com_replica_stop`); + `Com_show_slave_status` + (`Com_show_replica_status`); + `Com_show_slave_hosts` + (`Com_show_replicas`); + `Com_show_master_status` + (`Com_show_binary_log_status`); and + `Com_change_master` + (`Com_change_replication_source`). + + See also [Com\_xxx Variables](/doc/refman/8.4/en/server-status-variables.html#statvar_Com_xxx). + (WL #15831, WL #16063, WL #16069, WL #16086, WL #16087, WL #16088, WL #16089, WL #16090) +* **Group Replication:** + The + [`group_replication_allow_local_lower_version_join`](/doc/refman/8.4/en/group-replication-system-variables.html#sysvar_group_replication_allow_local_lower_version_join) + system variable is now deprecated, and setting it raises a + warning + ([`ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT`](/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_warn_deprecated_syntax_no_replacement)). + + You should expect this variable to be removed in a future + version of MySQL. Since there is no longer any reason to allow + incompatible members to join a group, no replacement for this + functionality is planned. + (WL #16018) +* A number of server options and variables supported in previous + versions of MySQL have been removed in this release. Attempting + to set any of them in MySQL 8.4 raises an error. These options + and variables are listed here: + + + `binlog_transaction_dependency_tracking`: + Deprecated in MySQL 8.0.35 and MySQL 8.2.0. + + There are no plans to replace this variable or its + functionality, which has been made internal to the server: + Now, when multithreaded replicas are in use, the source + **mysqld** uses always writesets to generate + dependency information for the binary log; this has the same + effect as setting + `binlog_transaction_dependency_tracking` to + `WRITESET` in previous versions of MySQL. + + `group_replication_recovery_complete_at`: + Deprecated in MySQL 8.0.34. + + Beginning with this release, the policy applied during the + distributed recovery process is always to mark a new member + online only after it has received, certified, and applied + all transactions that took place before it joined the group; + this is equivalent to setting + `group_replication_recovery_complete_at` to + `TRANSACTIONS_APPLIED` in previous versions + of MySQL. + + `avoid_temporal_upgrade` and + `show_old_temporals`: Both deprecated in + MySQL 5.6. Each of these variables no longer had any effect, + and has been removed. There are no plans to replace either + variable. + + `--no-dd-upgrade`: Deprecated in MySQL + 8.0.16, now removed. Use + [`--upgrade=NONE`](/doc/refman/8.4/en/server-options.html#option_mysqld_upgrade) instead. + + `--old` and `--new`: Both + deprecated in MySQL 8.0.35 and MySQL 8.2.0, and now removed. + + `--language`: This option was deprecated in + MySQL 5.5, and has now been removed. + + The `--ssl`, `--skip-ssl`, and + `--admin-ssl` server options, as well as the + `have_ssl` and + `have_openssl` server system variables, + were all deprecated in MySQL 8.0.26, and are all removed in + this release. Use + [`--tls-version`](/doc/refman/8.4/en/server-system-variables.html#sysvar_tls_version) and + [`--admin-tls-version`](/doc/refman/8.4/en/server-system-variables.html#sysvar_admin_tls_version) instead. + + `default_authentication_plugin`: Deprecated + in MySQL 8.0.27, and now removed. Use + [`authentication_policy`](/doc/refman/8.4/en/server-system-variables.html#sysvar_authentication_policy) + instead. + + You should also be aware that the syntax for setting the + [`authentication_policy`](/doc/refman/8.4/en/server-system-variables.html#sysvar_authentication_policy) + variable has changed; see its description in the Manual for + more information. + + (Bug #36337893, WL #9677, WL #13965, WL #15461, WL #15839, WL #16056, WL #16058, WL #16059, WL #16095) +* In cases where an aliased table was referenced in + [`EXPLAIN`](/doc/refman/8.4/en/explain.html) output, the table name + was qualified with a schema name, which was not necessary and + could result in confusion. These schema qualifications have been + removed from the output. + (Bug #36053664) +* The unused `INFORMATION_SCHEMA.TABLESPACES` + table, deprecated in MySQL 8.0.22, has now been removed. + + For [`InnoDB`](/doc/refman/8.4/en/innodb-storage-engine.html) tables, the Information + Schema [`INNODB_TABLESPACES`](/doc/refman/8.4/en/information-schema-innodb-tablespaces-table.html) and + [`INNODB_DATAFILES`](/doc/refman/8.4/en/information-schema-innodb-datafiles-table.html) tables provide + tablespace metadata. + (WL #14065) +* `LOW_PRIORITY` used with + [`LOCK TABLES ... + WRITE`](/doc/refman/8.4/en/lock-tables.html) had had no effect since MySQL 5.5, and was + deprecated in MySQL 5.6. It is removed in this release; + including `LOW_PRIORITY` in `LOCK + TABLES` now causes a syntax error. + (WL #16057) +* Support for use of the `AUTO_INCREMENT` + modifier with [`FLOAT`](/doc/refman/8.4/en/floating-point-types.html) and + [`DOUBLE`](/doc/refman/8.4/en/floating-point-types.html) columns was deprecated in + MySQL 8.0, and is now removed. Attempting to use these together + in [`CREATE TABLE`](/doc/refman/8.4/en/create-table.html) and + [`ALTER TABLE`](/doc/refman/8.4/en/alter-table.html) statements now causes + an Incorrect column specifier for column + error ([`ER_WRONG_FIELD_SPEC`](/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_wrong_field_spec)). + + Important + + Prior to upgrading to this release, you + *must* alter any table having a + `FLOAT ... AUTO_INCREMENT` or `DOUBLE + ... AUTO_INCREMENT` column that it no longer uses + either of these. Otherwise, the table cannot be upgraded. + + (WL #13103) +* The **mysql\_ssl\_rsa\_setup** + utility, which was deprecated in MySQL 8.0.34, is removed in + this release. For MySQL distributions compiled using OpenSSL, + the MySQL server can perform automatic generation of missing SSL + and RSA files at startup. For more inforamtion, + [Creating SSL and RSA Certificates and Keys using MySQL](/doc/refman/8.4/en/creating-ssl-rsa-files-using-mysql.html). + (WL #16205) +* This release removes support for the `ENGINE` + clause from the following SQL statements: + + + [`DROP TABLESPACE`](/doc/refman/8.4/en/drop-tablespace.html) (all + variants) + + [`ALTER + TABLESPACE ... DROP DATAFILE`](/doc/refman/8.4/en/alter-tablespace.html) + + All other variants of `ALTER TABLESPACE`, + with the two exceptions listed here: + + 1. `ALTER TABLESPACE ... ADD DATAFILE + ENGINE={NDB|NDBCLUSTER}` + 2. `ALTER UNDO TABLESPACE ... SET {ACTIVE|INACTIVE} + ENGINE=INNODB` + + Other than in the exceptional cases listed previously, use of + the `ENGINE` clause with `ALTER + TABLESPACE` or `DROP TABLESPACE` + causes the statement to be rejected with an error. + + `ENGINE` clauses for the `ALTER + TABLESPACE` and `DROP TABLESPACE` + statements were deprecated in MySQL 8.0. + (WL #16055) +* The `SET_USER_ID` privilege, deprecated in + MySQL 8.2.0, has been removed in this release, and its use in + [`GRANT`](/doc/refman/8.4/en/grant.html) statements now causes a + syntax error. Use the + [`SET_ANY_DEFINER`](/doc/refman/8.4/en/privileges-provided.html#priv_set-any-definer) and + [`ALLOW_NONEXISTENT_DEFINER`](/doc/refman/8.4/en/privileges-provided.html#priv_allow-nonexistent-definer) + privileges instead. + (WL #15875) +* Removed the **mysql\_upgrade** + utility, which was deprecated in MySQL 8.0.16. + (WL #16096) +* Removed the deprecated + **mysqlpump** utility along with + its associated **lz4\_decompress** + and **zlib\_decompress** helper + utilities. Instead, use **mysqldump** or the + [MySQL + Shell dump utilities](/doc/mysql-shell/8.4/en/mysql-shell-utilities-dump-instance-schema.html). + (WL #16096) +* The following plugins have been removed. They are noted in the + list provided here, along with any server system variables, + CMake options, and other features associated with them which + have also been removed: + + + `authentication_fido`, + `authentication_fido_client`: Use + `authentication_webauthn` instead; see + [WebAuthn Pluggable Authentication](/doc/refman/8.4/en/webauthn-pluggable-authentication.html). + + The `authentication_fido_rp_id` server + system variable, **mysql** client + `--fido-register-factor` option, and the + `-DWITH_FIDO` CMake option have also been + removed. + + `keyring_file`: Use + `component_keyring_file` instead; see + [Using the component\_keyring\_file File-Based Keyring Component](/doc/refman/8.4/en/keyring-file-component.html). + + The `keyring_file_data` system variable has + also been removed. In addition, the CMake options + `-DINSTALL_MYSQLKEYRINGDIR` and + `-DWITH_KEYRING_TEST` have been removed. + + `keyring_encrypted_file`: Use + `component_keyring_encrypted_file` instead; + see [Using the component\_keyring\_encrypted\_file Encrypted File-Based Keyring Component](/doc/refman/8.4/en/keyring-encrypted-file-component.html). + + The `keyring_encrypted_file_data` and + `keyring_encrypted_file_password` server + system variables have also been removed. + + `keyring_oci`: Use + `component_keyring_oci` instead; see + [Using the Oracle Cloud Infrastructure Vault Keyring Component](/doc/refman/8.4/en/keyring-oci-component.html). + + The following server system variables have also been + removed: `keyring_oci_ca_certificate`, + `keyring_oci_compartment`, + `keyring_oci_encryption_endpoint`, + `keyring_oci_key_file`, + `keyring_oci_key_fingerprint`, + `keyring_oci_management_endpoint`, + `keyring_oci_master_key`, + `keyring_oci_secrets_endpoint`, + `keyring_oci_tenancy`, + `keyring_oci_user`, + `keyring_oci_vaults_endpoint`, and + `keyring_oci_virtual_vault`. + + `openssl_udf`: Use the MySQL Enterprise Encryption + component instead; see + [MySQL Enterprise Encryption](/doc/refman/8.4/en/enterprise-encryption.html). + + (WL #15937, WL #15938, WL #15939, WL #15941, WL #16140) +* Support for weak encryption ciphers has been removed. This means + that, when configuring encrypted connections, MySQL no longer + allows specifying any cipher that does not meet the following + conditions: + + + Proper TLS version (TLS v1.2 or TLSv1.3, as appropriate) + + Forward secrecy + + SHA2 in cipher, certificate, or both + + AES in GCM or any other AEAD algorithms or modes + + This has implications for setting the system variables + [`ssl_cipher`](/doc/refman/8.4/en/server-system-variables.html#sysvar_ssl_cipher), + [`admin_ssl_cipher`](/doc/refman/8.4/en/server-system-variables.html#sysvar_admin_ssl_cipher), + [`tls_ciphersuites`](/doc/refman/8.4/en/server-system-variables.html#sysvar_tls_ciphersuites), and + [`admin_tls_ciphersuites`](/doc/refman/8.4/en/server-system-variables.html#sysvar_admin_tls_ciphersuites). See the + descriptions of these variables for their permitted values. + + You should be aware that `libmysqlclient` is + not affected in this change, and continues to support ciphers + that do not satisfy its conditions so that it can continue to + connect to previous versions of MySQL. + (WL #15801) +* The use of non-unique or partial keys as foreign keys is + deprecated in MySQL. Beginning with this release, you must + explicitly enable such nonstandard keys in one of the ways + listed here: + + + Set + [`restrict_fk_on_non_standard_key`](/doc/refman/8.4/en/server-system-variables.html#sysvar_restrict_fk_on_non_standard_key) + (added in this release) to `OFF`. + + Start the server with the + `--skip-restrict-fk-on-non-standard-key` + option (also new in this release). + + The `restrict_fk_on_non_standard_key` server + system variable is `ON` by default. This means + that any attempt to use a nonstandard key as a foreign key in a + [`CREATE TABLE`](/doc/refman/8.4/en/create-table.html) or + [`ALTER TABLE`](/doc/refman/8.4/en/alter-table.html) statement is rejected + with the error + [`ER_FK_NO_INDEX_PARENT`](/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_fk_no_index_parent); setting + it to `ON` allows such statements to run, but + they raise + [`ER_WARN_DEPRECATED_NON_STANDARD_KEY`](/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_warn_deprecated_non_standard_key) + as a warning. + + Upgrades to MySQL 8.4 releases from MySQL 8.0 are supported even + if the old database contains one or more foreign keys referring + to non-unique or partial keys. As part of the upgrade process, + the server prints a list of warning messages with the names of + those foreign keys referring to nonstandard keys. + + See the description of + [`restrict_fk_on_non_standard_key`](/doc/refman/8.4/en/server-system-variables.html#sysvar_restrict_fk_on_non_standard_key) + for more information. + (WL #15699) + + References: See also: Bug #30615520, Bug #97836. + +### Firewall Notes + +* Following an upgrade, some MySQL Firewall stored procedures were + not updated as expected. + (Bug #36084930) +* Several enhancements have been made in the stored procedures + provided by MySQL Enterprise Firewall. These improvements are listed here: + + + Stored procedures provided by MySQL Enterprise Firewall are now transactional. + When an error occurs during execution of a firewall stored + procedure, an error is reported, and all changes made by the + stored procedure up to that point in time are rolled back. + + Firewall stored procedures now avoid performing unnecessary + combinations of [`DELETE`](/doc/refman/8.4/en/delete.html) plus + [`INSERT`](/doc/refman/8.4/en/insert.html) statements, as well as + those of [`INSERT + IGNORE`](/doc/refman/8.4/en/insert.html) plus [`UPDATE`](/doc/refman/8.4/en/update.html) + operations, making them faster and more efficient. + + User-based stored procedures and UDFs, previously + deprecated, now raise a deprecation warning, such that + calling either of `sp_set_firewall_mode()` + or `sp_reload_firewall_rules()` now + generates such a warning. See + [Firewall Account Profile Stored Procedures](/doc/refman/8.4/en/firewall-reference.html#firewall-stored-routines-account), as well + as [Migrating Account Profiles to Group Profiles](/doc/refman/8.4/en/firewall-usage.html#firewall-account-profile-migration), for + more information. + + (WL #15790) + +### INFORMATION\_SCHEMA Notes + +* Fixed a potential race condition in the + [`PROCESSLIST`](/doc/refman/8.4/en/information-schema-processlist-table.html) table. + (Bug #35509371) + +### Installation Notes + +* As part of the installation process, a file in JSON format named + `mysql_upgrade_history` is now created in the + server's data directory, or updated if it already exists. + Information contained in this file includes the following items, + among others: + + The day and time of the installation + + The MySQL server version installed + + The maturity level of the release (LTS or Innovation) + + The `mysql_upgrade_info` file was deprecated + in MySQL 8.0.17, and is no longer used; its presence is now + checked for, and if this file is found, it is removed as part of + the installation process. + (WL #16039) + + References: See also: Bug #95165, Bug #29702060. + +### Keyring Notes + +* Migration from a keyring component to a keyring plugin is now + supported. To perform such a migration, use the + [`--keyring-migration-from-component`](/doc/refman/8.4/en/keyring-options.html#option_mysqld_keyring-migration-from-component) + server option introduced in this release, setting + [`--keyring-migration-source`](/doc/refman/8.4/en/keyring-options.html#option_mysqld_keyring-migration-source) to the + name of the source component, and + [`--keyring-migration-destination`](/doc/refman/8.4/en/keyring-options.html#option_mysqld_keyring-migration-destination) + the name of the target plugin. + + See + [Key Migration Using a Migration Server](/doc/refman/8.4/en/keyring-key-migration.html#keyring-key-migration-using-migration-server), + for more information. + (WL #16017) + +### Optimizer Notes + +* This release adds support for automatic updates of histograms. + When this feature is enabled for a given histogram, the + histogram is updated whenever [`ANALYZE + TABLE`](/doc/refman/8.4/en/analyze-table.html) is run on the parent table. Automatic + recalculation of persistent statistics by + `InnoDB` also updates the histogram when + automatic updates are enabled. + + Automatic histogram updates use the same number of buckets as + the histogram was originally specified with, if any. + + To enable automatic histogram updates, include the `AUTO + UPDATE` option (added in this release) for the + `ANALYZE TABLE` statement. To disable it, + include `MANUAL UPDATE` instead. + `MANUAL UPDATE` (no automatic updates) is the + default if neither option is specified. When upgrading to this + release, existing histograms are treated as though they had been + created using `MANUAL UPDATE`. + + For more information, see + [Histogram Statistics Analysis](/doc/refman/8.4/en/analyze-table.html#analyze-table-histogram-statistics-analysis). + See also [Configuring Persistent Optimizer Statistics Parameters](/doc/refman/8.4/en/innodb-persistent-stats.html). + (Bug #36053241, WL #15786) +* The multi-range read (MRR) optimization did not perform as well + as in previous releases. + (Bug #113711, Bug #36220640) +* In this release, we lift the requirement for transforming a + correlated scalar subquery to a derived table that an operand of + the equality expression which does not contain an outer + reference must be a simple column reference. + + This means that inner columns can be contained in deterministic + expressions, as shown here: + + ```None + func1(.., funcN(.., inner-column-a, ..), inner-column-b) = outside-expression + + inner-column-a + inner-column-b = outside-expression + ``` + + For example, the following query is now supported for + optimization: + + ```None + SELECT * FROM t1 + WHERE ( SELECT func(t2.a) FROM t2 + WHERE func(t2.a) = t1.a ) > 0; + ``` + + The inner operand cannot contain outer column references; + likewise, the outer operand cannot contain inner column + references. In addition, the inner operand cannot contain a + subquery. + + If the transformed subquery has explicit grouping, functional + dependency analysis may be excessively pessimistic, resulting in + an error such as ERROR 1055 (42000): Expression #2 of + SELECT list is not in GROUP BY clause and contains nonaggregated + column .... For [`InnoDB`](/doc/refman/8.4/en/innodb-storage-engine.html), + the transform is disabled by default, in which case such queries + pass without error (but are not transformed). + + For more information, see + [Correlated Subqueries](/doc/refman/8.4/en/correlated-subqueries.html). + (WL #15540) + +### Performance Schema Notes + +* User variables assigned decimal values were rounded up in the + [`user_variables_by_thread`](/doc/refman/8.4/en/performance-schema-user-variable-tables.html) table. + (Bug #35781732) + +### Server Administration + +* **Important Change:** + This release adds a privilege which is specific to the use of + the [`FLUSH + PRIVILEGES`](/doc/refman/8.4/en/flush.html) statements. Unlike the existing + [`RELOAD`](/doc/refman/8.4/en/privileges-provided.html#priv_reload) privilege, the new + [`FLUSH_PRIVILEGES`](/doc/refman/8.4/en/privileges-provided.html#priv_flush-privileges) privilege + applies only to `FLUSH PRIVILEGES` statements. + This privilege is global in scope, and is applicable to users + and roles. + + The `RELOAD` privilege continues to be + supported in this capacity to provide backwards compatibility; + users having this privilege can still execute `FLUSH + PRIVILEGES` statements following an upgrade. As part of + upgrading to a MySQL 8.4 release, a check is performed to see + whether there are any users having the + [`FLUSH_PRIVILEGES`](/doc/refman/8.4/en/privileges-provided.html#priv_flush-privileges) privilege; if + there are none, users having the + [`RELOAD`](/doc/refman/8.4/en/privileges-provided.html#priv_reload) privilege are + automatically assigned the new privilege as well. + (WL #16044) +* **Important Change:** + This release adds a new + [`OPTIMIZE_LOCAL_TABLE`](/doc/refman/8.4/en/privileges-provided.html#priv_optimize-local-table) privilege. + Users must have this privilege to execute + [`OPTIMIZE LOCAL + TABLE`](/doc/refman/8.4/en/optimize-table.html) and + [`OPTIMIZE + NO_WRITE_TO_BINLOG TABLE`](/doc/refman/8.4/en/optimize-table.html) statements. + + When upgrading from a previous releases, users already having + the [`SYSTEM_USER`](/doc/refman/8.4/en/privileges-provided.html#priv_system-user) privilege are + automatically granted the + [`OPTIMIZE_LOCAL_TABLE`](/doc/refman/8.4/en/privileges-provided.html#priv_optimize-local-table) privilege. + (WL #15819) + +### Thread Pool Notes + +* **Important Change:** + Previously, when the limit defined by + [`thread_pool_max_transactions_limit`](/doc/refman/8.4/en/server-system-variables.html#sysvar_thread_pool_max_transactions_limit) + was reached, new connections or transactions on existing + connections sometimes appeared to hang until one or more of the + existing transactions were completed. This release introduces a + way to mitigate this issue in many cases by setting an upper + limit + [`thread_pool_longrun_trx_limit`](/doc/refman/8.4/en/server-system-variables.html#sysvar_thread_pool_longrun_trx_limit) + (added in this release) on the length of time during which the + number of ongoing transactions is allowed to match the maximum + number of thread pool transactions specified by + [`thread_pool_max_transactions_limit`](/doc/refman/8.4/en/server-system-variables.html#sysvar_thread_pool_max_transactions_limit); + once this limit is reached, the upper limit on the number of + transactions is suspended for the thread group. + + When the number of long-running transactions decreases + appreciably, + `thread_pool_max_transactions_limit` can be + (and is) enforced again. See the description of the + [`thread_pool_longrun_trx_limit`](/doc/refman/8.4/en/server-system-variables.html#sysvar_thread_pool_longrun_trx_limit) + server system variable for more information about how this is + determined. + (WL #16132) +* The Performance Schema + [`tp_connections`](/doc/refman/8.4/en/performance-schema-tp-connections-table.html) thread pool plugin + table contained no entries for connections that were in the + `admin` group. + (Bug #36296830) + +### Functionality Added or Changed + +* **Important Change; Group Replication:** + MySQL 8.0 performs special handling for group members whose + version is 8.0.17 or earlier. This special handling is removed + in the current release. + + Users of MySQL 8.0 are encouraged to upgrade all instances to + the latest 8.0 release prior to upgrading to MySQL 8.4. + (Bug #36314222) +* **Important Change; Group Replication:** + In-place downgrades of servers within groups are supported + within the MySQL 8.4 LTS series. For example, a member of a + group running MySQL 8.4.2 can be downgraded to MySQL 8.4.0. + + Similarly, cross-version group membership is also supported + within the 8.4 release series. For example, a server running + MySQL 8.4.0 can join a group all of whose members currently run + MySQL 8.4.2, as can a server running MySQL 8.4.3. + + For more information, see + [Upgrading Group Replication](/doc/refman/8.4/en/group-replication-upgrade.html). + (Bug #35918034) + + References: See also: Bug #35397276. +* **Important Change; Group Replication:** + The default values of two server system variables relating to + Group Replication have changed: + + + The default value of the + [`group_replication_consistency`](/doc/refman/8.4/en/group-replication-system-variables.html#sysvar_group_replication_consistency) + system variable is now + `BEFORE_ON_PRIMARY_FAILOVER`; previously, + this was `EVENTUAL`. + + The default value of the + [`group_replication_exit_state_action`](/doc/refman/8.4/en/group-replication-system-variables.html#sysvar_group_replication_exit_state_action) + system variable is now `OFFLINE_MODE`; + previously, this was `READ_ONLY`. + + For more information, see the descriptions of the variables + listed, as well as + [Configuring Transaction Consistency Guarantees](/doc/refman/8.4/en/group-replication-configuring-consistency-guarantees.html), + and [Responses to Failure Detection and Network Partitioning](/doc/refman/8.4/en/group-replication-responses-failure.html). + (WL #15712, WL #15713) +* **Important Change; Group Replication:** + When issued with + [`group_replication_consistency`](/doc/refman/8.4/en/group-replication-system-variables.html#sysvar_group_replication_consistency) + set to `BEFORE_ON_PRIMARY_FAILOVER`, the MySQL + [`KILL`](/doc/refman/8.4/en/kill.html) statement now ignores any + consistency guarantees, with any interrupted transactions now + being rolled back. +* **Important Change:** + For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 3.0.13. Issues fixed in OpenSSL version 3.0.13 are described at + . + (Bug #36261675) +* **Important Change:** + Upgrading from MySQL 5.7 to MySQL 8.4 is not supported; the code + and behavior was updated to reflect this. Upgrade MySQL 5.7 to + 8.0 before proceeding to 8.4. + (WL #15924) +* **InnoDB:** + Progress messages are now logged periodically during + long-running rollbacks as informational note level error + messages, initially as + [`ER_IB_LONG_ROLLBACK_FULL`](/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_ib_long_rollback_full) (which + appends transaction information) followed by successive + [`ER_IB_LONG_ROLLBACK`](/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_ib_long_rollback). + (WL #15822) +* **InnoDB:** + Changed the default values for the following + `InnoDB` configuration options: + [`innodb_adaptive_hash_index`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_adaptive_hash_index), + [`innodb_buffer_pool_in_core_file`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_buffer_pool_in_core_file), + [`innodb_buffer_pool_instances`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_buffer_pool_instances), + [`innodb_change_buffering`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_change_buffering), + [`innodb_doublewrite_files`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_doublewrite_files), + [`innodb_doublewrite_pages`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_doublewrite_pages), + [`innodb_flush_method`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_flush_method), + [`innodb_io_capacity`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_io_capacity), + [`innodb_io_capacity_max`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_io_capacity_max), + [`innodb_log_buffer_size`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_log_buffer_size), + [`innodb_numa_interleave`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_numa_interleave), + [`innodb_page_cleaners`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_page_cleaners), + [`innodb_parallel_read_threads`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_parallel_read_threads), + [`innodb_purge_threads`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_purge_threads), + [`innodb_read_io_threads`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_read_io_threads), + [`innodb_use_fdatasync`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_use_fdatasync), + [`temptable_max_ram`](/doc/refman/8.4/en/server-system-variables.html#sysvar_temptable_max_ram), + [`temptable_max_mmap`](/doc/refman/8.4/en/server-system-variables.html#sysvar_temptable_max_mmap), and + [`temptable_use_mmap`](/doc/refman/8.4/en/server-system-variables.html#sysvar_temptable_use_mmap). + + The settings affected by the + [`--innodb-dedicated-server`](/doc/refman/8.4/en/innodb-parameters.html#option_mysqld_innodb-dedicated-server) startup + option have also changed. + + For a list of the new default values, see + [What Is New in MySQL 8.4 since MySQL 8.0](/doc/refman/8.4/en/mysql-nutshell.html). See also + [Enabling Automatic InnoDB Configuration for a Dedicated MySQL Server](/doc/refman/8.4/en/innodb-dedicated-server.html). + (WL #16179) +* **Packaging:** + Added support for Fedora 40 and Ubuntu 24.04. +* **Replication:** + It is now possible to recover the relay log with any incomplete + transactions removed. The relay log is now sanitized when the + server is started with + [`--relay-log-recovery=OFF`](/doc/refman/8.4/en/replication-options-replica.html#sysvar_relay_log_recovery) (the + default). This means that, on startup, the server removes all of + the following items: + + + Incomplete transactions + + Relay log files containing incomplete transactions or parts + of incomplete transactions only + + References in the relay log index file to any relay log + files removed + + For more information, see the description of the + [`relay_log_recovery`](/doc/refman/8.4/en/replication-options-replica.html#sysvar_relay_log_recovery) server + system variable. +* **Group Replication:** + When a member rejoining a group has transactions to apply on the + `group_replication_applier` channel from + previous participation in the group, those transactions are + applied when the member rejoins before connections to a donor + during distributed recovery. + + This backlog of transactions to apply can be monitored using the + [`performance_schema.replication_applier_status_by_worker`](/doc/refman/8.4/en/performance-schema-replication-applier-status-by-worker-table.html) + table, but there was no information about it in the error log, + which could lead to the mistaken impression that the server was + stalled. + + Now in such cases, one of the messages Distributed + recovery will wait until the transactions ... contained on the + group\_replication\_applier channel are applied or + Distributed recovery finished applying the + transactions ... contained on the group\_replication\_applier + channel is also written to the error log, as + appropriate. + (Bug #36229998) +* **Group Replication:** + As of this release, distributed recovery using the clone plugin + is permitted between different releases in the same LTS series. + (Bug #35992145) +* **Group Replication:** + MySQL Group Replication now supports preemptive certification + information garbage collection when running in single-primary + mode. This feature can be enabled using the + [`group_replication_preemptive_garbage_collection`](/doc/refman/8.4/en/group-replication-system-variables.html#sysvar_group_replication_preemptive_garbage_collection) + system variable added in this release; when enabled, only the + write sets for those transactions that have not yet been + committed are kept, which can save time and memory consumption. + [`group_replication_preemptive_garbage_collection_rows_threshold`](/doc/refman/8.4/en/group-replication-system-variables.html#sysvar_group_replication_preemptive_garbage_collection_rows_threshold) + (also introduced in in this release) sets a lower bound on the + number of certification rows needed to trigger preemptive + garbage collection when the feature is enabled; the default + value is 100000. + + The value of + `group_replication_preemptive_garbage_collection` + can be changed only when Group Replication is not running, and + has no effect on a group running in multi-primary mode. When + this system variable is enabled, it is not possible to change + between multi-primary mode and single-primary mode (see + [Changing the Group Mode](/doc/refman/8.4/en/group-replication-changing-group-mode.html)). For + help with obtaining information about memory consumed by the + garbage collection process, see + [Monitoring Group Replication Memory Usage with Performance Schema Memory Instrumentation](/doc/refman/8.4/en/mysql-gr-memory-monitoring-ps-instruments.html). + (WL #15923) +* **Microsoft Windows:** + MySQL Windows binary files (`.exe` and + `.dll` files) now display additional + information when their properties are viewed. + (Bug #36379291) +* Clone plugin version requirements have been relaxed to allow + cloning between different point releases in the same series. In + other words, only the major and minor version numbers must match + when previously the release number also had to match. + + For example, cloning of MySQL 8.4.0 to (a future) MySQL 8.4.14, + or from MySQL 8.4.14 to 8.4.0, is now supported. + + For more information, see [The Clone Plugin](/doc/refman/8.4/en/clone-plugin.html). + (Bug #36293529, WL #15989) +* When using the iterator-based format for + [`EXPLAIN + FORMAT=JSON`](/doc/refman/8.4/en/explain.html) (that is, when + [`explain_json_format_version`](/doc/refman/8.4/en/server-system-variables.html#sysvar_explain_json_format_version) is + `2`), the output now contains a + `query_type` field identifying the type of + statement (select, insert, delete, and so on). + (Bug #36134568) + +### Bugs Fixed + +* **Important Change; Replication:** + The [`TRANSACTION_GTID_TAG`](/doc/refman/8.4/en/privileges-provided.html#priv_transaction-gtid-tag) + privilege is now required to set the + [`gtid_executed`](/doc/refman/8.4/en/replication-options-gtids.html#sysvar_gtid_executed) server system + variable. + (Bug #36201133) +* **Important Change:** + The Robin Hood hashing library has been replaced with + `unordered_dense`. + (Bug #36158022) +* **InnoDB; Microsoft Windows:** + Improved redo log performance on Windows by opening redo log + files in overlapped mode. + (Bug #36154818) + + References: This issue is a regression of: Bug #12527. +* **InnoDB:** + The log writer calls functions that temporarily release + `log.writer_mutex`; when + [`innodb_log_writer_threads=OFF`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_log_writer_threads), + this potentially led to other threads writing to the redo log in + between these times. + (Bug #36425219) +* **InnoDB:** + Some FTS operations on tables with FTS indexes led to + inconsistent results. For example, if the server terminated + while synchronizing the FTS cache or when synchronization + occurred concurrently with another FTS operation. + + Our thanks to Yin Peng and the Tencent team for the + contribution. + (Bug #36347647) +* **InnoDB:** + When creating an index on a table containing data, + `valgrind` occasionally reported reads of + uninitialized memory from + `ddl::Builder::bulk_add_row()`. + (Bug #36342792) +* **InnoDB:** + On Windows, keeping a file open without a shared write lock and + attempting to acquire the `fil_shard` mutex + caused a deadlock with another thread that had acquired the + `fil_shard` mutex and was attempting to access + the same file. + (Bug #36159317) + + References: See also: Bug #32808809. +* **InnoDB:** + Fixed a potential redo log rotation issue that could emit a + "Found existing redo log files, but at least one is missing" + error during recovery. + (Bug #36124625) +* **InnoDB:** + Found and fixed an assertion failure related to full-text + indexes. + (Bug #35836581) +* **InnoDB:** + Added a log buffer check to the fil\_tablespace\_redo\_\* functions + for them to better handle corrupt redo logs. + (Bug #35676721) +* **InnoDB:** + Improved buffer handling during the tablespace deletion process, + a situation that could have potentially caused an assertion + failure. + (Bug #35676106, Bug #36343647) +* **InnoDB:** + The redo log would potentially not log a column order change + with instant DDL, which could cause an incorrect log replay + during recovery. + (Bug #35183686) +* **InnoDB:** + Results for [`SHOW + ENGINE INNODB STATUS`](/doc/refman/8.4/en/show-engine.html) showed an invalid value + (`NULL`) as the name of the first thread in the + `File IO` section. + (Bug #113819, Bug #36118112) + + References: This issue is a regression of: Bug #34992157. +* **InnoDB:** + With + [`innodb_parallel_read_threads`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_parallel_read_threads) + set to a value greater than 1, + [`InnoDB`](/doc/refman/8.4/en/innodb-storage-engine.html) unnecessarily disabled + read-ahead heuristics which resulted in stalls when pages were + not already in the buffer pool. + (Bug #113482, Bug #36142806) +* **InnoDB:** + Importing a tablespace had a hard limit of 128 characters for + the imported column names, which did not properly account for + variable-length encodings. It's now set to 64 \* the maximum + length of a multi-byte characters. + + Our thanks to Lee Adria for the contribution. + (Bug #113208, Bug #36047803) +* **InnoDB:** + Running a query that used a unique hash index with the TempTable + storage engine could take significantly more time compared to + running the query with the MEMORY engine. + + Our thanks to xiaoyang chen for the contribution. + (Bug #113178, Bug #36037224, Bug #36224958) +* **InnoDB:** + The redo log consumer could not advance if capacity was full and + another thread was executing USER-related operations such as + [`CREATE USER`](/doc/refman/8.4/en/create-user.html). This also blocked + new connections, which potentially prevented the workaround + solution of increasing + [`innodb_redo_log_capacity`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_redo_log_capacity) size. + (Bug #112608, Bug #36004840) +* **InnoDB:** + In debug builds, there was an assertion failure in InnoDB's + background when a transaction it wanted to acquire an MDL lock + on was no longer active. + + This fix is based on a patch from Genze Wu with Alibaba, thank + you for the contribution. + (Bug #112424, Bug #35835864) + + References: This issue is a regression of: Bug #33700835. +* **InnoDB:** + The MySQL truncate undo operation (purge thread) did not remove + the `undo_{space_number}_trunc.log` file when + attempting to truncate the undo tablespace. + (Bug #112262, Bug #35784192) +* **InnoDB:** + With + [`innodb_parallel_read_threads`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_parallel_read_threads) + set to a value greater than 1, InnoDB would unnecessarily + request asynchronous reads which required more synchronization + during I/O completion and created a bottleneck due to the + limited number of available threads + ([`innodb_read_io_threads`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_read_io_threads)) for + handling I/O operations. Now this performs synchronous instead + of asynchronous reads. + (Bug #112137, Bug #35740866) +* **InnoDB:** + A trx would unexpectedly halt after encountering an incorrect + trx->in\_innodb value. + + Our thanks to Shaohua Wang for the contribution. + (Bug #110652, Bug #35277407) +* **InnoDB:** + Fixed performance issues related to querying the + `data_lock` and + `data_lock_waits` tables when thousands of + read-only transactions were present. + (Bug #109539, Bug #34951273) +* **InnoDB:** + MySQL no longer ignores the optimizer hint to use a secondary + index scan, which instead forced a clustered (parallel) index + scan. + (Bug #100597, Bug #112767, Bug #31791868, Bug #35952353) +* **Replication:** + `diagnostics.sql` prevented upgrades to MySQL + 8.4.0 from earlier versions of MySQL when restoring from data + containing old replication terminology such as `SHOW + SLAVE STATUS`. + (Bug #36323066) +* **Replication:** + `Gtid_tagged_log_event` encoded the correct + value only when the original commit timestamp was equal to the + immediate commit timestamp, instead of only when they were + different. + (Bug #36312880) +* **Replication:** + In certain cases, the [`gtid_next`](/doc/refman/8.4/en/replication-options-gtids.html#sysvar_gtid_next) + server system variable accepted an invalid value, displayed an + invalid value after setting it (even to a legal value), or both. + (Bug #36308318) +* **Replication:** + The replication receiver thread did not report errors when a + replication channel was configured with an unknown network + namespace. The receiver thread stopped when such an error + occurred but no reason for the halt was shown or logged. + (Bug #36054355) +* **Replication:** + With [`binlog_format=ROW`](/doc/refman/8.4/en/replication-options-binary-log.html#sysvar_binlog_format) and + [`gtid_mode=OFF`](/doc/refman/8.4/en/replication-options-gtids.html#sysvar_gtid_mode), deadlocks were + sometimes reported among workers contending for the + auto-increment lock when applier concurrency was high on the + replica. + (Bug #35851009) +* **Replication:** + In certain cases, the SQL thread terminated with error + MY-001755 + ([`ER_MTA_CANT_PARALLEL`](/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_mta_cant_parallel)) when + executed with the parallel applier. + (Bug #35431274) +* **Replication:** + Failure of [`XA + COMMIT`](/doc/refman/8.4/en/xa-statements.html) of a prepared transaction could result in + transaction rollback. + (Bug #33650776) +* **Replication:** + The replication receiver thread stopped with an error if the + replication source server sent a heartbeat event containing a + binary log file position that was above the 4GB offset, due to + the large size of the binary log file. A new heartbeat event + (Heartbeat\_log\_event\_v2, log event type 41) that handles the + larger value correctly has been added for use in this situation. + (Bug #29913991) +* **Replication:** + When the server printed an + [`ER_REPLICA_HEARTBEAT_FAILURE`](/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_replica_heartbeat_failure) + error message, it did not respect the length of the master log + file name, leading to it print unrelated data. + (Bug #29913928) +* **Group Replication:** + Problems arose when members `M1` and + `M2` were in a group, with + `M1` using `u1` as its + recovery user and `M2` using + `u2` as its own recovery user, and both users + `u1` and `u2` existing on + `M1` and `M2` with all + necessary privileges, and when a new member + `M3` joined the group using + `u2` as its recovery user. + `M3` knew only of user `u2`, + but did not know of user `u1`, leading + [`START GROUP REPLICATION`](/doc/refman/8.4/en/start-group-replication.html) on + `M2` to be rejected since `M1` + was unable to connect to `M2`. This also + generated a new `view_id` listing the group + members as `M1` and `M2`, but + `M1` nevertheless continued trying to connect + to `M3`, with `M1` logging + Error in establishing mysql connection + and M3 logging Access denied errors for + the connection attempts from `M1`. + + By design, XCom stores the last three known configurations, + including references to physical connections shared among all + past and present configurations. This is done to facilitate + quick reconnections by nodes rejoining the group, explicitly or + implicitly, and that were already present in any of those + configurations. + + A side effect of this was that we might keep attempting to + connect to a node that was currently not in the group. To solve + this problem, we inhibit error logging if the node is not in the + current configuration, in order to avoid false negatives which + might lead a DBA or an operator to think mistakenly that there + is a problem in the system. + (Bug #36210988) + + References: See also: Bug #32592027. +* **Group Replication:** + Improved handling of GTID sets. + (Bug #36093405) +* **Group Replication:** + Two cases were found in which a member exited the group and + moved to the `ERROR` state, but did not honor + the action specified by + [`group_replication_exit_state_action`](/doc/refman/8.4/en/group-replication-system-variables.html#sysvar_group_replication_exit_state_action); + these are listed here: + + + When an error occurred while enabling + [`super_read_only`](/doc/refman/8.4/en/server-system-variables.html#sysvar_super_read_only) + + When member join recovery was not possible, due to missing + binary logs and clone groups on group members + + *Example*: When the value of + `group_replication_exit_state_action` was + `OFFLINE_MODE` and one of these events took + place, offline mode was not enabled as expected. + (Bug #36076308) +* **Group Replication:** + After successfully setting a new primary, + [`group_replication_set_as_primary()`](/doc/refman/8.4/en/group-replication-functions-for-new-primary.html#function_group-replication-set-as-primary) + in some cases waited indefinitely for the operation to complete. + (Bug #36059098) +* **Group Replication:** + For errors affecting transactions with `AFTER` + ([`ER_GRP_RPL_TRX_WAIT_FOR_GROUP_PREPARE_FAILED`](/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_grp_rpl_trx_wait_for_group_prepare_failed)), + the message that was written to the error log referenced a + session ID instead of the UUID. + (Bug #35953196) +* **Group Replication:** + A group running group replication with a primary + `i1` and two secondaries `i2` + and `i3` started to have intermittent issues + because of high memory usage on the primary. The secondaries + began reporting the primary as unreachable then reachable again, + and the primary began reporting the secondaries as + intermittently reachable then reachable as well. Following a + period of such instability, the secondaries expelled the + original primary (`i1`) and elected a new one + (`i2`). + + Under these conditions, queries against the + [`performance_schema.replication_group_members`](/doc/refman/8.4/en/performance-schema-replication-group-members-table.html) + table on the former primary (`i1`) reported + `i1` as `ONLINE` and + `PRIMARY`, `i2` as + `ONLINE` and `SECONDARY`, and + `i3` as `ONLINE` and + `SECONDARY` for an extended period of time (12 + hours or more) until the **mysqld** process was + restarted on `i1`. + + The problems observed were found to have begun on the original + primary (`i1`) when one of the secondaries was + overloaded and began intermittently leaving and joining the + group, its connections being dropped and recreated repeatedly on + the primary server. During the reconnection process, the primary + hung when trying to create the connection, thus blocking the + single XCom thread. This was traced to the invocation of + `SSL_connect()` on the XCom communication + stack, which changed in MySQL 8.0.27 from asynchronous to + synchronous form. When a node was overloaded, it might not + respond to the `SSL_connect()` call, leaving + the connecting end blocked indefinitely. + + To fix this, we now connect in a way that is non-blocking, and + that returns in case of a timeout, leaving the retry attempts to + the caller—in this specific case, the XCom thread when + trying to reconnect to another node. + (Bug #34348094, Bug #36047891) + + References: See also: Bug #37587252. +* **JSON:** + `JOIN` and `GROUP BY` handled + some `JSON` column values differently. + (Bug #101048, Bug #31969607) +* **MySQL NDB ClusterJ:** + The + `setLimits()` + method can now be chained to + `deletePersistentAll()` + to limit the number of items to delete. See the description of + `deletePersistentAll()` + for details. + (Bug #36049906) +* The `strings` and + `strings_shared` library files declared but did + not supply the function + `mysql::collation::find_by_id()`. + (Bug #36353447) +* Raised the minimum required version of CMake to build MySQL from + 3.5.1 to 3.14.6. + (Bug #36338366) + + References: See also: Bug #35553331. +* Configuration of the backtrace library was performed too early + in the build process, and the library itself was built with an + incomplete set of compiler flags, differing in both these + respects from the rest of the server. + (Bug #36292247) +* [`SET + GLOBAL`](/doc/refman/8.4/en/set-variable.html) + [`offline_mode=ON`](/doc/refman/8.4/en/server-system-variables.html#sysvar_offline_mode) did not always + perform correctly when issued under high loads. + (Bug #36275182) + + References: See also: Bug #36405894. +* Upgraded `curl` to version 8.6.0. + (Bug #36267545) +* Added a new error message for the case when a timeout is + detected in `net_read_raw_loop()` rather than + in the thread pool code. This includes information about the + conditions triggering the timeout. This is an error-level + message if the timeout occurs earlier than indicated by + [`wait_timeout`](/doc/refman/8.4/en/server-system-variables.html#sysvar_wait_timeout). + (Bug #36250895) + + References: See also: Bug #34857147. +* **mysqldump** did not always interpret the server + version correctly. + (Bug #36248967) + + References: See also: Bug #36405879. +* Condition pushdown to a view was rejected with a collation + mismatch if the view was created with a different character set + than the character set used when querying the view. + (Bug #36246859) +* Improved the SQL grammar in `sql/sql_yacc.yy` + by removing four shift-reduce conflicts which were not needed. + (Bug #36221823) +* Use of the deprecated `exec_program()` command + has been replaced by `execute_process()` to + provide compatibility with CMake 3.28.1 and later. + (Bug #36220656) +* The MLE component was added to the minimal RPM build. + (Bug #36210740) +* Some queries using [`NULLIF()`](/doc/refman/8.4/en/flow-control-functions.html#function_nullif) and + [`EXCEPT`](/doc/refman/8.4/en/except.html) raised an assertion in + `set_typelib()`. + (Bug #36151537) + + References: See also: Bug #33045412. +* Certain queries raised an assertion in + `EstimateDeleteRowsCost()`. + (Bug #36130806) + + References: This issue is a regression of: Bug #35590128. +* A query of the form `SELECT 1 FROM t WHERE CAST(a AS + UNSIGNED INTEGER) = 1 AND a = (SELECT 1 FROM t)` led to + an assertion in `item_func.cc`. + (Bug #36128964) +* When selecting two empty strings that were combined with + [`UNION`](/doc/refman/8.4/en/union.html) as in `SELECT '' AS + a UNION SELECT '' AS b`, the type of the resulting data + was [`CHAR(0)`](/doc/refman/8.4/en/char.html) instead of + [`VARCHAR(0)`](/doc/refman/8.4/en/char.html). + + We fix this by removing an exception that was made for strings + of length 0. + (Bug #36112585) +* Upgraded the `protobuf` library to version + 25.1. + (Bug #36108397) +* For building Enterprise Linux RPMs, the build scripts now point + to a newer **strip** command (under + `/opt/rh/gcc-toolset-12`), and they now check + that the corresponding **dwz** tool is available. + Previously this was only implemented for EL8. + (Bug #36090069) +* We now look for `gcc-ar` and + `gcc-ranlib` when building on Oracle Linux with + link-time optimization. + (Bug #36089900) +* Use `sa_sigaction` rather than + `sh_handler` for catching fatal signals, which + allows the signal handler to output more information when + handling `SIGSEGV` or `SIGFPE` + signals. + (Bug #36082110) +* The MySQL client was unable to authenticate with + mysql\_native\_password to old MySQL Server versions that don't + support pluggable authentication, such as MySQL 5.0.15. + (Bug #36066161) +* Improved the messages written to the log during a server + downgrade. + (Bug #36053108) +* Keyring component error logging now supplies more information + than previously when the component is unable to initialize. + (Bug #36037172) +* Set `_ITERATOR_DEBUG_LEVEL` to + `0` when compiling debug builds on Windows + using Clang. + (Bug #36032501) +* When performing a rollup on an + [`ENUM`](/doc/refman/8.4/en/enum.html) or + [`SET`](/doc/refman/8.4/en/set.html) column, an assertion was + raised in `sql/item_sum.cc` during resolution + when type information for neither of these types could be found. + (Bug #36028294) + + References: See also: Bug #33045412. +* When a Common Table Expression (CTE) contained an + [`INTERSECT`](/doc/refman/8.4/en/intersect.html) or + [`EXCEPT`](/doc/refman/8.4/en/except.html) set operation, the second + use of the same CTE in a subsequent join returned a wrong + result. + (Bug #36002215) +* Killing a query, while it was evaluating an uncorrelated + subquery containing a hash join during optimization, led to an + assert in `sql/sql_select.cc`. + (Bug #35991384) +* The server sometimes terminated unexpectedly in response to a + specific query. + (Bug #35957627) +* A rollup query with a window function such as + [`COUNT()`](/doc/refman/8.4/en/aggregate-functions.html#function_count) in the select list, which + was also part of an `ORDER BY`, led to an + unexpected shutdown of the server. + (Bug #35947358) + + References: This issue is a regression of: Bug #33069747. +* Improved view and trigger definer handling by view and table + DDL. + (Bug #35942937) +* The server did not always return metadata to the client + correctly for certain queries. + (Bug #35904044, Bug #36521376) +* Found and fixed an assertion failure at + `handler::ha_index_end()` in + `handler.cc`. + (Bug #35877600) +* For a query such as `SELECT DISTINCT t1.x, t2.x FROM t + AS t1, t AS t2 WHERE t1.pk = t2.x`, where + `t1.pk = t2.x` and `pk` is the + primary key, there is a functional dependency + `t2.x->t1.x`. This means that some candidate + plans grouped on `{t2.x, t1.x}` and others on + `{t1.x}`, which were both valid but yielded + different row estimates for two sets of fields, since this did + not take functional dependencies into account. + + Now we ensure that we perform a single calculation of the number + of distinct rows, and use that number for all plan candidates. + (Bug #35855573) +* When running queries against a table with a multi-value index, + the server sometimes exited unexpectedly, often while executing + a complex [`SELECT`](/doc/refman/8.4/en/select.html) query which used + this index. + (Bug #35789759) +* Improved code in `sql/item_subselect.cc`. + (Bug #35733778, Bug #35738531, Bug #35779012) +* Some aggregations of window functions were not handled + correctly. + (Bug #35560806) +* [`CREATE USER IF + EXISTS`](/doc/refman/8.4/en/create-user.html) was not always logged correctly. + (Bug #35530823) +* The server did not disallow subqueries in partition expressions + properly. These are invalid, and should cause a syntax error. + (Bug #35476172) +* Events created within stored programs were not always handled + correctly. + (Bug #35395333, Bug #36402968, Bug #37918920) + + References: This issue is a regression of: Bug #17809, Bug #11745618. +* Upgraded the minimum Boost version used to 1.84.0. + (Bug #35259498) +* Some `RANK() ... OVER()` queries raised an + assertion in `sql/sql_executor.cc`. + (Bug #35228083) +* When successive + [`ALTER TABLE ... + ALGORITHM=COPY`](/doc/refman/8.4/en/alter-table.html) statements were issued within 10 + seconds of one another, the `n_rows` value + became 0. + (Bug #35127747) +* Removed a memory leak observed while running + `authentication_kerberos` under Valgrind. + (Bug #34482788, Bug #36570929) +* A query using + [`MAX(column)`](/doc/refman/8.4/en/aggregate-functions.html#function_max) + gave different results before and after an index was added to + the column. + (Bug #34057432) +* Some queries that used the [`LEAD()`](/doc/refman/8.4/en/window-function-descriptions.html#function_lead) + or [`LAG()`](/doc/refman/8.4/en/window-function-descriptions.html#function_lag) window functions on a + column of type [`SET`](/doc/refman/8.4/en/set.html) or + [`ENUM`](/doc/refman/8.4/en/enum.html) hit an assertion during + resolution. The same assertion was hit in some queries using the + [`LEAST()`](/doc/refman/8.4/en/comparison-operators.html#function_least) or + [`GREATEST()`](/doc/refman/8.4/en/comparison-operators.html#function_greatest) function on a + `SET` or `ENUM` column. + (Bug #33045412) +* When adding a `HAVING` condition to a temporary + table, it is expected that all the fields in the + `HAVING` condition are already replaced with + the temporary table fields, but for a query which had an + expression involving the internal `Item_row` + type in the `HAVING` clause, constant + expressions were not getting cached, so that the + `HAVING` clause still held references to the + fields from the underlying tables. + (Bug #30112096) +* In queries that materialized rows in a temporary table before + performing hash join or streaming aggregation, data was + sometimes copied twice from the temporary table to the join + buffer or aggregation buffer. While this did not cause any wrong + results, it led to inefficient use of buffer space with a + possible negative impact on performance. + + This was due to the internal + `WalkTablesUnderAccessPath()` function visiting + tables in `MATERIALIZE` access paths twice: + first when it saw the `MATERIALIZE` access path + itself, and then again when it visited the + `table_path` member of the MATERIALIZE access + path. + + We fix this by not visiting the table when seeing the + `MATERIALIZE` path, and doing so only when + seeing the `table_path` below + `MATERIALIZE`. + (Bug #113647, Bug #36190386) +* Updated the URL used for downloading the Boost C++ libraries. + (Bug #113576, Bug #36164514) +* In the debug server, an intersection comparing columns of + different types sometimes triggered an assert in + `sql/item.cc`. + (Bug #113385, Bug #36094867) +* A transform could be semantically invalid when the selected item + in the subquery tested for `NULL`; the left + outer join with a grouped derived table might in such cases + produce `NULL` while the original subquery + might not. To prevent this from happening, we now bar such + subqueries from being transformed. + (Bug #113318, Bug #36070542) +* The fix for a previous issue, first addressed in MySQL 8.0.30, + was incomplete. + + Our thanks to Hao Lu for the contribution. + (Bug #113174, Bug #36035044) + + References: This issue is a regression of: Bug #110801, Bug #35328028. +* On s390x, we now compile the FMA test with `-O2` + to avoid overoptimization. + + Our thanks to Jonathan Albrecht for the contribution. + (Bug #113096, Bug #36016140) +* Although s390x is a big-endian platform, the little-endian ICU + data directory was used for compiling. + + Our thanks to Jonathan Albrecht for the contribution. + (Bug #113095, Bug #36016141) +* `SET SESSION optimizer_switch = + 'hash_set_operations=off'` after preparing a statement + led to an assertion in `sql/sql_select.cc` + when trying to execute the same prepared statement. + (Bug #112919, Bug #35970620) +* The server now uses + [`ER_NO_REFERENCED_ROW_2`](/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_no_referenced_row_2) or + [`ER_ROW_IS_REFERENCED_2`](/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_row_is_referenced_2) for + foreign key errors whether error details are displayed, or not. + In addition, we now display parent and child table details in + error messages when the user has the proper grants. + (Bug #112589, Bug #35868410) +* Incorrect results were sometimes obtained from a query that used + a group by loose index scan. + (Bug #112541, Bug #35854362) +* An assertion in `sql/sql_derived.cc` that + checked whether a referenced item in an + `Item_ref` object had consistent outer + reference information failed when the reference was of type + `OUTER_REF`. For objects of type + `Item_outer_ref`, dependency information was + set for the `Item_outer_ref` object and the + original expression that this reference points to, but an + intermediate reference object between the + `Item_outer_ref` and the original expression + did not contain this information. + (Bug #112478, Bug #35846847) +* An assertion failed in debug builds when inserting data with a + zero-length column, such as + [`CHAR(0)`](/doc/refman/8.4/en/char.html) or + [`BINARY(0)`](/doc/refman/8.4/en/binary-varbinary.html), into a table. Now, a + less strict assertion more accurately fails only if it detects + that a non-zero number of bytes copied from a source is + identical to the target. + (Bug #111450, Bug #35507763) +* MySQL did not build correctly using the `musl` + version of `libc`. + + Our thanks to Sam James for the contribution. + (Bug #110808, Bug #35330950) +* Using a default string histogram on a + [`TEXT`](/doc/refman/8.4/en/blob.html) column raised an assertion + due to a collation mismatch when comparing histograms bucket + values with the string returned by + [`REVERSE(1)`](/doc/refman/8.4/en/string-functions.html#function_reverse). + (Bug #110527, Bug #35227319) +* A [`VALUES`](/doc/refman/8.4/en/values.html) statement in a + correlated lateral or (other) dependent subquery yielded an + incorrect result. + (Bug #109252, Bug #110076, Bug #34852090, Bug #35087820) diff --git a/corpus/changelog/mysql_releases/mysql_841.md b/corpus/changelog/mysql_releases/mysql_841.md new file mode 100644 index 0000000000000000000000000000000000000000..86a3006805ddcb0a5713aca96d6a0329bb6eabb4 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_841.md @@ -0,0 +1,561 @@ +# MySQL 8.4.1 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.4/en/news-8-4-1.html +Version: 8.4.1 + +## Changes in MySQL 8.4.1 (2024-07-01, LTS Release) + +Important + +This release is no longer available for download. It was +removed due to a critical issue that could stop the server +from restarting following the creation of a very large number +of tables (8001 or more). Please upgrade to MySQL 8.4.2 +instead. + +* [Audit Log Notes](news-8-4-1.html#mysqld-8-4-1-audit-log "Audit Log Notes") +* [Authentication Notes](news-8-4-1.html#mysqld-8-4-1-authentication "Authentication Notes") +* [C API Notes](news-8-4-1.html#mysqld-8-4-1-capi "C API Notes") +* [Compilation Notes](news-8-4-1.html#mysqld-8-4-1-compiling "Compilation Notes") +* [Component Notes](news-8-4-1.html#mysqld-8-4-1-components "Component Notes") +* [Configuration Notes](news-8-4-1.html#mysqld-8-4-1-configuration "Configuration Notes") +* [Connection Management Notes](news-8-4-1.html#mysqld-8-4-1-connection-management "Connection Management Notes") +* [Data Dictionary Notes](news-8-4-1.html#mysqld-8-4-1-data-dictionary "Data Dictionary Notes") +* [Performance Schema Notes](news-8-4-1.html#mysqld-8-4-1-performance-schema "Performance Schema Notes") +* [Pluggable Authentication](news-8-4-1.html#mysqld-8-4-1-pluggable-auth "Pluggable Authentication") +* [Thread Pool Notes](news-8-4-1.html#mysqld-8-4-1-thread-pool "Thread Pool Notes") +* [X Plugin Notes](news-8-4-1.html#mysqld-8-4-1-xplugin "X Plugin Notes") +* [Bugs Fixed](news-8-4-1.html#mysqld-8-4-1-bug "Bugs Fixed") + +### Audit Log Notes + +* Audit log pruning did not function after removing or renaming a + file from the audit log. Now pruning continues in such cases, + but with a warning printed in the error log stating that it was + not possible to delete the missing audit log file. + (Bug #35902913) +* MySQL now calls `plugin->deinit()` with a + valid plugin struct as an argument regardless of the + plugin's type. + + Our thanks to Martin Alderete for the contribution. + +### Authentication Notes + +* Improved log messages to provide clear reasons for + Access denied errors when using the + `authentication_ldap_sasl` plugin without + proxying. + (Bug #35317691) +* MySQL LDAP SASL authentication, when used with the GSSAPI method + to access an OpenLDAP server, was rejected with the MySQL server + error Plugin authentication\_ldap\_sasl reported: 'LDAP + authentication failed or group retrieval failed: LDAP error: + Invalid DN syntax', because OpenLDAP did not + recognize the root DN used. + (Bug #32631511) + +### C API Notes + +* C API applications stalled while receiving results for server + side prepared statements. + +### Compilation Notes + +* **macOS:** + The Xcode version of `zlib` was removed from + the default list of system libraries to use when configuring + with [`-DWITH_SYSTEM_LIBS=ON`](/doc/refman/8.4/en/source-configuration-options.html#option_cmake_with_system_libs). + (Bug #36537593) +* **Microsoft Windows:** + The `BUILD_ALL` target did not work when + compiling on Windows. + (Bug #36424619) +* **Microsoft Windows:** + Excessive RAM usage led to disk swapping when compiling MySQL on + Windows using Ninja. + (Bug #36399256) +* Maintainer mode is now disabled when building the debug version + of the server for `.deb` packages. + (Bug #36619757) +* Upgraded the bundled `googletest` and + `googlemock` sources to version 1.14.0. + (Bug #36562482) +* Added a missing dependency on `GenError`. + (Bug #36551721) +* When compiling on Fedora 38, **grep + -E** is now used in place of + **egrep**. + (Bug #36507549) +* It is now possible on Linux systems to build MySQL using a + bundled `tcmalloc` library that is provided + with the source by specifying + [`-DWITH_TCMALLOC=BUNDLED`](/doc/refman/8.4/en/source-configuration-options.html#option_cmake_with_tcmalloc). This is + supported on Linux only. + (Bug #36313839) +* The bundled `tcmalloc()` is now used when + building MySQL on Enterprise Linux 8. + (Bug #114844, Bug #35674008) +* Removed warnings raised in + `sql/statement/ed_connection.cc` when + building on Ubuntu 23.04. + (Bug #114436, Bug #36428465) +* Linux `aarch64` platform binaries are now built + using **patchelf** + `--page-size=65536` for compatibility with + systems using either 4k or 64k for the page size. + (Bug #114233, Bug #36393794) + +### Component Notes + +* The values for component options set using the + `--loose` prefix were not read when the component + was installed. + (Bug #28341329) + +### Configuration Notes + +* **Microsoft Windows:** + On Windows, *MySQL Configurator* was updated + to support in-place upgrades as per + [Upgrade Paths](/doc/refman/8.4/en/upgrade-paths.html). + (Bug #36685422) +* **Microsoft Windows:** + For MSI installations on Windows, *MySQL + Configurator* now automatically upgrades MySQL 8.4 LTS + installations without user intervention. + (WL #16274) + +### Connection Management Notes + +* The `conn_delay/Waiting in connection_control + plugin` stage was not reset after a delay introduced by + the connection control plugin which resulted in incorrect + monitoring information. + (Bug #35205358) + +### Data Dictionary Notes + +* Attempting to upgrade a [`MyISAM`](/doc/refman/8.4/en/myisam-storage-engine.html) + table containing a mix of regular columns and generated columns + from MySQL 5.7 to 8.0 or later led to table corruption. + (Bug #105301, Bug #33503328) + +### Performance Schema Notes + +* **Group Replication:** + The following tables did not contain data on replication + channels which did not have a configured hostname, such as Group + Replication recovery channels: + + + [`REPLICATION_CONNECTION_STATUS`](/doc/refman/8.4/en/performance-schema-replication-connection-status-table.html) + + [`REPLICATION_CONNECTION_CONFIGURATION`](/doc/refman/8.4/en/performance-schema-replication-connection-configuration-table.html) + + [`REPLICATION_APPLIER_CONFIGURATION`](/doc/refman/8.4/en/performance-schema-replication-applier-configuration-table.html) + + [`REPLICATION_APPLIER_STATUS`](/doc/refman/8.4/en/performance-schema-replication-applier-status-table.html) + + [`REPLICATION_APPLIER_STATUS_BY_COORDINATOR`](/doc/refman/8.4/en/performance-schema-replication-applier-status-by-coordinator-table.html) + + [`REPLICATION_APPLIER_STATUS_BY_WORKER`](/doc/refman/8.4/en/performance-schema-replication-applier-status-by-worker-table.html) + + As of this release, these tables contain data for partially + configured Group Replication channels. + (Bug #36018242) +* Under certain conditions, a race condition could result in the + amount of RAM used by [`TABLE_HANDLES`](/doc/refman/8.4/en/performance-schema-table-handles-table.html) + increasing to a maximum of 9GB. + (Bug #36170903) +* The `PROCESSLIST_INFO` column of + [`THREADS`](/doc/refman/8.4/en/performance-schema-threads-table.html) was not updated when + executing a prepared statement. + + Thanks to Daniel Lenski and Amazon for the contribution. + (Bug #104121, Bug #33057164) + +### Pluggable Authentication + +* The deprecation warning issued when authenticating with the + `mysql_native_password` plugin is now issued + only once. + (Bug #35792948) + +### Thread Pool Notes + +* Connecting to a thread group that had no connection handler + threads stalled. We fix this by making sure that connection + handler threads terminate only if there is at least one + connection thread left. + (Bug #36550125) +* Previous refactoring incorrectly removed the connection locking + performed when processing incoming connection requests, which + ledto a race condition between the thread adding new connections + and the connection handler thread processing them. This appeared + to cause a situation in which connection requests might be + ignored and not processed, so that the connection attempt + appeared to hang. + + We fix this by taking the connection before processing the + queue, and releasing it before waking or creating new threads. + (Bug #36548687) +* It was possible to set the + [`thread_pool_longrun_trx_limit`](/doc/refman/8.4/en/server-system-variables.html#sysvar_thread_pool_longrun_trx_limit) + system variable to values outside its stated range. + + In addition, settings for this variable were not reflected in + the output of SHOW VARIABLES or SELECT. + (Bug #36347102, Bug #36371145) +* [`SET + PERSIST_ONLY`](/doc/refman/8.4/en/set-variable.html) did not work correctly with + [`thread_pool_max_transactions_limit`](/doc/refman/8.4/en/server-system-variables.html#sysvar_thread_pool_max_transactions_limit). + (Bug #35019884) + +### X Plugin Notes + +* The system variable + [`caching_sha2_password_digest_rounds`](/doc/refman/8.4/en/server-system-variables.html#sysvar_caching_sha2_password_digest_rounds) + could not be set to a non-default value using X Protocol. + (Bug #36402455) +* An outdated link to the MySQL documentation in the + `mysql_function_names` unit test source file + has been updated. + + Our thanks to Minha Jeong for the contribution. + (Bug #113500, Bug #36137217) + +### Bugs Fixed + +* **InnoDB:** + MySQL unexpectedly halted on an + [`UPDATE`](/doc/refman/8.4/en/update.html) after an + [`ALTER TABLE`](/doc/refman/8.4/en/alter-table.html) operation. + (Bug #36571091) + + References: This issue is a regression of: Bug #35183686. +* **InnoDB:** + The log index size calculation now accounts for column order + changes. + (Bug #36526369) + + References: This issue is a regression of: Bug #35183686. +* **InnoDB:** + File system operations performed by `InnoDB` + now consistently `fsync` the parent directory + when performing directory altering tasks. + (Bug #36174938) +* **InnoDB:** + In debug builds, setting the + `innodb_interpreter_output` debug variable + would cause the server to unexpectedly halt. This is now a + read-only variable. + (Bug #36041032) +* **InnoDB:** + Improved `os_innodb_umask` handling, and made + it read-only. + (Bug #35932118) + + References: This issue is a regression of: Bug #29472125. +* **InnoDB:** + For tables created with an index on a column that was too wide + for the redundant row format (allowed before MySQL 5.7.35), an + in-place upgrade silently imported the table but it was not + accessible, which interfered with making backups. Now all + operations that involve using the invalid index are rejected + with [`ER_INDEX_CORRUPT`](/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_index_corrupt) until the + index is dropped. An + [`ER_IB_INDEX_PART_TOO_LONG`](/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_ib_index_part_too_long) error + is also reported in the error log. + (Bug #35869747) + + References: See also: Bug #34826861. +* **InnoDB:** + An `InnoDB` assertion error referencing an + invalid column index was triggered when the column index was + valid. + (Bug #34800754) +* **InnoDB:** + With an empty + [`XA`](/doc/refman/8.4/en/xa-statements.html) + transaction, shutting the server down after an `XA + START` would cause the server to halt unexpectedly. + (Bug #32416819) +* **InnoDB:** + Shutting down the replication applier or binlog applier while + processing an empty XA transaction caused the system to + unexpectedly halt. + (Bug #32416819) +* **InnoDB:** + Removed unnecessary heap usage in the + `Validate_files::check()` function. + + Our thanks to Huaxiong Song for the contribution. + (Bug #115041, Bug #36626203) +* **InnoDB:** + If a partition table was read with + [`innodb_parallel_read_threads=1`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_parallel_read_threads), + read performance greatly decreased from any table after 256 + reads. InnoDB behaved as if it reached the maximum capacity of + parallel read threads despite not using any. + + Our thanks to Ke Yu for the contribution. + (Bug #114154, Bug #36347408) +* **InnoDB:** + The result from a spatial index containing a column with a + spatial reference identifier (SRID) attribute was empty. In + addition, using `FORCE INDEX` to force a + covering index scan on a spatial index led to an assertion. + (Bug #112676, Bug #114200, Bug #35894664, Bug #36361834) +* **InnoDB:** + `SELECT ... GROUP BY` queries were at least + twice as slow with the TempTable engine than the Memory engine. + (Bug #107700, Bug #34338001) +* **Replication:** + If a source contained a stored, generated column populated by a + JSON function and + [`binlog_row_image`](/doc/refman/8.4/en/replication-options-binary-log.html#sysvar_binlog_row_image) was set to + `MINIMAL`, any subsequent update or deletion on + the underlying column failed with the following error: + + ```None + Invalid JSON text in argument 1 to function json_extract: 'The document is empty.' + ``` + + The replica attempted to re-evaluate the generated column and + failed with that error because the underlying column was + unavailable. As of this release, stored, generated columns are + not re-evaluated when the underlying columns are unavailable. + (Bug #36515172) +* **Replication:** + When running GTID-based replication with + [`relay_log_space_limit`](/doc/refman/8.4/en/replication-options-replica.html#sysvar_relay_log_space_limit) enabled, + a restart of the auto positioning protocol sometimes resulted in + an infinite loop, leading to a deadlock in replication. This was + because `relay_log_space_limit` was not + honored, not only for transactions whose size exceed this limit, + but when the replica could not purge previous logs as well. + + To fix this issue, we make the following changes: + + + The receiver respects + `relay_log_space_limit` as set by the user, + unless a transaction received by the receiver cannot fit + into the purged relay log. Before queuing the received + transaction, receiver now checks whether scheduling a full + transaction is possible. If not, the receiver performs the + following actions: + + - Sets the flag indicating that receiver is waiting + - Rotates the relay log + - Waits until it is notified that relay log purge was + executed and that the applier has purged all available + relay logs; after this, the receiver may queue a + transaction without checking the limit again + + Before moving to the next file, the coordinator checks + whether the receiver is waiting for available relay log + space. If so, the coordinator forcibly purges the applied + logs, including the current relay log file. To purge the + current relay log file safely, the coordinator must do the + following: + + - Synchronize all of its workers before moving to the next + file + - Forcibly update group positions, which is necessary to + allow current purging of the relay log + - Update the variable read by the receiver which contains + relay log filename to which applier was moved + + These operations are allowed because we know that receiver + waits at a transaction boundary and rotates the relay log + before waiting. + + (Bug #36507020) +* **Replication:** + Worker jobs now contain information about the relay log file + which initiated the transaction, instead of using the default + defined by [`relay_log`](/doc/refman/8.4/en/replication-options-replica.html#sysvar_relay_log). + (Bug #36395631) +* **Replication:** + Handling an incident while transactions were being committed to + the binary log caused MySQL to wait indefinitely. + (Bug #35671897) +* **Group Replication:** + Removed a memory leak from + `/xcom/gcs_xcom_networking.cc`. + (Bug #36532199) +* **Group Replication:** + Under certain circumstances, if a primary's host experienced + network inactivity of 20 seconds or more, the secondaries could + stop unexpectedly. + (Bug #36306144) +* **Group Replication:** + Under certain circumstances, if garbage collection occurred just + before a relay log rotation, it could cause the applier to stop + applying new transactions on the secondary members. + + This was caused by garbage collection incrementing the relay + log's `last_committed` and + `sequence_number`, creating a gap in the + recorded `sequence_number` after the log + rotation. The applier was unaffected if the gap occurred + anywhere else in the relay log. + + As of this release, only `last_committed` is + updated during garbage collection. + (Bug #36280130, Bug #36446250) +* **JSON:** + Added missing checks for error handling to + [`NULLIF()`](/doc/refman/8.4/en/flow-control-functions.html#function_nullif), + [`COALESCE()`](/doc/refman/8.4/en/comparison-operators.html#function_coalesce), and the shift + ([`>>`](/doc/refman/8.4/en/bit-functions.html#operator_right-shift)) + operator. + (Bug #113668, Bug #35513196, Bug #36198403) + + References: See also: Bug #31358416. +* **MySQL NDB ClusterJ:** + Running the ClusterJ test suite resulted in an error message + saying a number of threads did not exist. That was due to some + wrong handling of threads and connections, which was corrected + by this patch. + (Bug #36086735) +* On macOS, reinstated the MySQL preference pane's ability to + load a custom `my.cnf` configuration file. + This includes loading it before initializing a new data + directory. + (Bug #36630493) +* On Fedora 40, there were conflicts when installing MySQL 8.4.0 + community server on a system with native + `mysql-server` packages present. + (Bug #36575524) +* Averages of certain numbers were not always computed correctly. + (Bug #36563773) +* The following files in `strings` contained + incorrect license information: + + + `mb_wc.h` + + `ctype-uca.cc` + + `ctype-ucs2.cc` + + `ctype-utf8.cc` + + `dtoa.cc` + + `strxmov.cc` + + `strxnmov.cc` + + (Bug #36506181) +* In certain unusual cases, the + [`UpdateXML()`](/doc/refman/8.4/en/xml-functions.html#function_updatexml) function did not + process all of its arguments correctly. + (Bug #36479091) +* Explaining a query which used `FORCE INDEX` on + a spatial index containing a column with SRID attributes led to + an unplanned exit. + (Bug #36418426) +* Added the + [`ER_LOG_PARTITION_PREFIX_KEY_NOT_SUPPORTED`](/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_log_partition_prefix_key_not_supported) + error definition, which references functionality added in MySQL + 8.4.0. + (Bug #36350938) +* Updated `BuildRequire` rules to align with + versions now required for CMake and Bison. + (Bug #36343254) +* Some prepared statements were not reprepared correctly. + (Bug #36267792, Bug #35712413) + + References: This issue is a regression of: Bug #34929930. +* When incrementing the reference count for an expression, + underlying expressions within this expression are not looked at. + While removing an expression, after decrementing the reference + count, even the underlying expressions were examined, which led + to unintentional deletion of the underlying expressions. This + issue manifested in `Item_ref::real_item()` as + well as in an assert in `sql/item.h`. We fix + this by not looking at the underlying expression unless the + current expression contains the only remaining reference. + (Bug #36204344, Bug #36356279) +* Under certain conditions, + [`EXPLAIN FORMAT=JSON FOR + CONNECTION`](/doc/refman/8.4/en/explain.html) sometimes led to an unplanned exit. + (Bug #36189820) +* Some [`CREATE USER`](/doc/refman/8.4/en/create-user.html) statements were + not handled correctly. + (Bug #36022885) +* In certain cases, a lateral join was not handled correctly. + (Bug #35945239) + + References: See also: Bug #107700, Bug #34338001. This issue is a regression of: Bug #32644631. +* For a [`SELECT`](/doc/refman/8.4/en/select.html) with `ORDER + BY` and `LIMIT`, the optimizer first + chose a full table scan with a very expensive cost, then + performed another check and used the + `perform_order_index` type of path, but this + was not reflected by the cost in the optimizer plan. + (Bug #35930969) +* Client connections were not alway terminated correctly during + shutdown. + (Bug #35854919) +* Executing **mysqldump** on a replica would insert + the [`FLUSH + TABLES`](/doc/refman/8.4/en/flush.html) operation, an operation that writes to the + binary log. Now [`FLUSH + LOCAL TABLES`](/doc/refman/8.4/en/flush.html) is inserted instead to prevent GTID + related issues during replication due to these binary log + changes. + + The workaround was to set the + [`--source-data`](/doc/refman/8.4/en/mysqldump.html#option_mysqldump_source-data) option to 1 or + 2. + (Bug #35665076) + + References: This issue is a regression of: Bug #33630199. +* All internal ACL bitmask variables are now explicitly 32 bits + (`uint32_t`). + (Bug #35507223) +* It was not possible to add a functional index on + [`FIND_IN_SET()`](/doc/refman/8.4/en/string-functions.html#function_find-in-set). + (Bug #35352161) +* Running two concurrent [`OPTIMIZE + TABLE`](/doc/refman/8.4/en/optimize-table.html) statements on the same table with fulltext + indexes and + [`innodb_optimize_fulltext_only`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_optimize_fulltext_only) + enabled sometimes caused the server to exit. + (Bug #34929814) +* The + [`gen_range()`](/doc/refman/8.4/en/data-masking-plugin-functions.html#function_gen-range-plugin) + function as implemented by the (deprecated) data masking plugin + did not always return the correct result. + + This issue affected the data masking plugin only, and did not + affect the data masking component which supersedes it. + (Bug #34163992) +* In some circumstances, such when DDL operations were performed + on a very large number of tables, the error log was flooded with + warnings from background histogram updates; the offending + warning was concerning a failure to acquire metadata locks on a + table. + + To remedy this problem we now throttle messages written to the + error log from background histogram update operations, the rate + being capped at one message per minute, which should suffice for + the user to identify potential problems with background + histogram updates. In addition, we downgrade all error events + that occur during background histogram updates from errors to + warnings. + (Bug #114845, Bug #36574298) +* On macOS, the DMG now installs the keyring component instead of + installing keyring plugin functionality that was removed in + MySQL Server 8.4.0. + + The 8.4.0 workaround was to disable the "Keyring Data File" + option in the preference pane or to manually remove the two + keyring lines from the launchd plist. + (Bug #114836, Bug #36577944) +* Fixed an erroneous comment in + `include/my_command.h`. + + Our thanks to Sho Nakazono for the contribution. + (Bug #114507, Bug #36455468) +* It was possible for a deterministic stored function to return an + incorrect result when the function used `JOIN + ON` inside the `return` statement. If + the query needed to be reprepared due to a table metadata caused + by, for example, [`FLUSH + TABLES`](/doc/refman/8.4/en/flush.html) between two executions, the + `ON` clause was sometimes lost. + (Bug #114235, Bug #36379879) +* Added the missing `mysql-community-libs-compat` + package for the EL8 and EL9 platforms. + (Bug #112949, Bug #35975348) diff --git a/corpus/changelog/mysql_releases/mysql_842.md b/corpus/changelog/mysql_releases/mysql_842.md new file mode 100644 index 0000000000000000000000000000000000000000..cfbfb75bd8eaeb67dc2bf95787e1352a0a9aebfb --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_842.md @@ -0,0 +1,26 @@ +# MySQL 8.4.2 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.4/en/news-8-4-2.html +Version: 8.4.2 + +## Changes in MySQL 8.4.2 (2024-07-23, LTS Release) + +### Bugs Fixed + +* **InnoDB:** + In some cases, following the creation of a very large number of + tables (8001 or more), the server could not be restarted + successfully. + (Bug #36808732) + + References: This issue is a regression of: Bug #33398681. +* **InnoDB:** + Improved tablespace file scan performance at startup. + (Bug #110402, Bug #35200385) +* **Group Replication:** + Running a + [`CREATE + TABLE ... SELECT`](/doc/refman/8.4/en/create-table-select.html) statement on a source coming from an + asynchronous channel to Group Replication led to errors on the + replica. + (Bug #36784284) diff --git a/corpus/changelog/mysql_releases/mysql_843.md b/corpus/changelog/mysql_releases/mysql_843.md new file mode 100644 index 0000000000000000000000000000000000000000..7df2d08bcc66141bb011b0f29e16fc9ced2b1e7b --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_843.md @@ -0,0 +1,601 @@ +# MySQL 8.4.3 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.4/en/news-8-4-3.html +Version: 8.4.3 + +## Changes in MySQL 8.4.3 (2024-10-15, LTS Release) + +* [C API Notes](news-8-4-3.html#mysqld-8-4-3-capi "C API Notes") +* [Compilation Notes](news-8-4-3.html#mysqld-8-4-3-compiling "Compilation Notes") +* [Configuration Notes](news-8-4-3.html#mysqld-8-4-3-configuration "Configuration Notes") +* [SQL Function and Operator Notes](news-8-4-3.html#mysqld-8-4-3-functions-operators "SQL Function and Operator Notes") +* [JavaScript Programs](news-8-4-3.html#mysqld-8-4-3-js-programs "JavaScript Programs") +* [Performance Schema Notes](news-8-4-3.html#mysqld-8-4-3-performance-schema "Performance Schema Notes") +* [sys Schema Notes](news-8-4-3.html#mysqld-8-4-3-sys-schema "sys Schema Notes") +* [Thread Pool Notes](news-8-4-3.html#mysqld-8-4-3-thread-pool "Thread Pool Notes") +* [Functionality Added or Changed](news-8-4-3.html#mysqld-8-4-3-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-4-3.html#mysqld-8-4-3-bug "Bugs Fixed") + +### C API Notes + +* The asynchronous interface used unsafe static local variables to + store state information. + (Bug #115703, Bug #36891894) + +### Compilation Notes + +* MySQL did not compile on Fedora 41. + (Bug #37046924) +* MySQL did not compile on Ubuntu 24.10. + (Bug #37042308) +* Added `CONTRIBUTING.md` and + `SECURITY.md` files to the MySQL sources to + conform to Oracle's Open Source guidelines. + (Bug #36998165) +* Aligned `CMAKE_MINIMUM_REQUIRED` with the correct + required CMake version (3.14.6) as well as CMake policies for + third-party libraries used by MySQL. + (Bug #36978193) +* Binary packages that include curl rather than linking to the + system curl library have been upgraded to use curl 8.9.1. + Important issues fixed in curl version 8.9.1 are described at + . + (Bug #36967379, Bug #36955197) +* The included `zlib` library has been upgraded + from version 1.2.13 to version 1.3.1. + (Bug #36950863) +* CMake options `BUILD_SHARED_LIBS` and + `CMAKE_SKIP_INSTALL_ALL_DEPENDENCY` are now set + to `OFF` in the top level of the build. + (Bug #36930664) +* Pulling in the most recent CMake packages for gRPC and Protobuf + caused the builds for these libraries to fail. Fixed by + rewriting the package lookup to work for both older and newer + CMake packages. + (Bug #36905657) +* Upgraded the bundled `libcurl` library to + version 8.9.0. + (Bug #36886877) +* The bundled `lz4` library was upgraded to + version 1.10.0. + (Bug #36886747) +* The [`-DWITHOUT_SERVER`](/doc/refman/8.4/en/source-configuration-options.html#option_cmake_without_server) option for + CMake did not work on Enterprise Linux 7. + (Bug #36824515) +* Linking with **mold** did not work + on Enterprise Linux 9. + (Bug #36818902) + + References: See also: Bug #34099162. +* The version of `libfido` used with MySQL was + upgraded to 1.15.0. + (Bug #36752604) +* The RE2 regular expression library is now bundled with the MySQL + sources. + (Bug #36729026) +* The version of **clang-format** + used for the MySQL codebase was upgraded from 10 to 15. + (Bug #36500268) +* The bundled version of TI-RPC was upgraded to 1.3.5. + (Bug #115698, Bug #36886602) +* It was not possible to build MySQL using Protobuf 22 or later. + + Our thanks to Gordon Wang for the contribution. + (Bug #115163, Bug #36678092) + +### Configuration Notes + +* **Microsoft Windows:** + On Windows, *MySQL Configurator* revert + button functionality did not always revert to the original + value. + (Bug #36702176) +* **Microsoft Windows:** + On Windows, the *MySQL Configurator* data + directory file browsing mechanism required the + `ProgramData` folder but can now function + outside of that folder. + (Bug #36702072) +* **Microsoft Windows:** + On Windows, clicking the [X] close button + on a *MySQL Configurator* wizard's page now + yields a confirmation popup if the wizard is busy executing an + operation. + (Bug #36671317) +* **Microsoft Windows:** + On Windows, *MySQL Configurator* no longer + defines a custom `server_type` variable in the + generated MySQL Server configuration file. This information is + now stored in the `configurator_settings.xml` + file. + (Bug #36670309) +* **Microsoft Windows:** + On Windows, the `Removing Windows Firewall` + step in *MySQL Configurator* would fail if + the `my.ini` file was missing a + `mysqlx_port` definition. + (Bug #36666260) +* **Microsoft Windows:** + On Windows, *MySQL Configurator* no longer + performs unnecessary background operations after clicking + Next if the selected options did not + change. + (Bug #36395605) +* **Microsoft Windows:** + On Windows, if *MySQL Configurator* failed to + find a valid `my.ini` or + `my.cnf` file from the *MySQL Server + Installations* page, then clicking the + Browse button disabled the + Next button even when the selected file + was valid. + (Bug #36395569) +* **Microsoft Windows:** + On Windows, *MySQL Configurator* now only + shows the removal steps if the associated MySQL Server was + previously configured. + (Bug #36395417) +* **Microsoft Windows:** + On Windows, MySQL Configurator described an empty password as + strong rather than weak. + (Bug #35533726) + +### SQL Function and Operator Notes + +* The output from [`DATABASE()`](/doc/refman/8.4/en/information-functions.html#function_database) was + truncated when this function was used as part of a + [`UNION`](/doc/refman/8.4/en/union.html) query. + (Bug #36871927) + +### JavaScript Programs + +* Employing a user variable in a DML statement within a stored + procedure that used the Statement handle interface sometimes led + to an unplanned server exit when any statement was executed + following execution of such a stored procedure. To address this + issue, we now reset the memory used to the store the user + variable and its value to the statement execution memory root + after executing a sub-statement from the Statement handle + interface. + (Bug #36892945) + +### Performance Schema Notes + +* Fixed issues relating to the OTLP exporter. + (Bug #36792180, Bug #36783070) +* Running `SELECT * FROM sys.innodb_lock_waits;` + on an instance which was under heavy load affected the + performance of the server. + + As of this release, `SELECT * FROM + sys.innodb_lock_waits;` fetches only 2 locks for each + wait, instead of scanning all locks twice for each wait. + + As part of this fix, primary keys were added to + [`DATA_LOCKS`](/doc/refman/8.4/en/performance-schema-data-locks-table.html) and + [`DATA_LOCK_WAITS`](/doc/refman/8.4/en/performance-schema-data-lock-waits-table.html). + (Bug #100537, Bug #31763497) + +### sys Schema Notes + +* The performance of the + [`innodb_lock_waits`](/doc/refman/8.4/en/sys-innodb-lock-waits.html) view is improved + in this release. + (Bug #36337708) + +### Thread Pool Notes + +* Some concurrent connection attempts were not handled correctly. + (Bug #36625082) + +### Functionality Added or Changed + +* **Important Change:** + For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 3.0.15. For more information, see + [OpenSSL + 3.0 Series Release Notes](https://openssl-library.org/news/openssl-3.0-notes/) and + [OpenSSL + Security Advisory [3rd September 2024]](https://openssl-library.org/news/secadv/20240903.txt). + (Bug #37021075) +* **Performance; Replication:** + The data structure used in tracking binary log transaction + dependencies has been changed from `Tree` to + `ankerl::unordered_dense::map`, which uses + approximately 60% less space, and which should thus contribute + to better dependency tracking performance. + (Bug #37008442, Bug #37529256) +* Added the [`--system-command`](/doc/refman/8.4/en/mysql-command-options.html#option_mysql_system-command) option + for the **mysql** client, which enables or + disables the `system` client command. + + This option is enabled by default. To disable it, use + [`--system-command=OFF`](/doc/refman/8.4/en/mysql-command-options.html#option_mysql_system-command) or + [`--skip-system-command`](/doc/refman/8.4/en/mysql-command-options.html#option_mysql_skip-system-command), which + causes the `system` command to be rejected with + an error. + (Bug #36377685, WL #16482) + + References: See also: Bug #36248967. +* The MySQL server now supports an alternative syntax for the + `GROUP BY` clause `ROLLUP` + modifier. Consider the following query: + + ```None + SELECT + IF(GROUPING(year), 'All years', year) AS year, + IF(GROUPING(country), 'All countries', country) AS country, + IF(GROUPING(product), 'All products', product) AS product, + SUM(profit) AS profit + FROM sales + GROUP BY year, country, product WITH ROLLUP; + ``` + + Using the alternative syntax, the same query can be written like + this: + + ```None + SELECT + IF(GROUPING(year), 'All years', year) AS year, + IF(GROUPING(country), 'All countries', country) AS country, + IF(GROUPING(product), 'All products', product) AS product, + SUM(profit) AS profit + FROM sales + GROUP BY ROLLUP (year, country, product); + ``` + + Either version of the query produces the same result. + + For more information, see [GROUP BY Modifiers](/doc/refman/8.4/en/group-by-modifiers.html), + as well, as [SELECT Statement](/doc/refman/8.4/en/select.html). + (WL #15843) + +### Bugs Fixed + +* **Performance; InnoDB:** + Several functions internal to `InnoDB`, which + were defined as inline in MySQL 8.0.28, were found to be no + longer inline in MySQL 8.0.33, due in part to refactoring which + accompanied improvements made in MySQL 8.0.30 to improve the + `InnoDB` adaptive hash index. This had an + adverse effect on queries using joins on + `InnoDB` tables. + (Bug #111538, Bug #35531293) + + References: This issue is a regression of: Bug #81814, Bug #16739204, Bug #23584861. +* **InnoDB:** + InnoDB did not allow updating a `REDUNDANT` + table column that was altered with `NULL` as + the default value using the `INSTANT` + algorithm. Instead, MySQL unexpectedly halted. + (Bug #36840107) +* **InnoDB:** + When redo log capacity was reduced with + `log_files_truncate`, under rare circumstances + the `file.end_lsn` equaled + `log_sys->write_lsn` thus disallowing future + redo log writes. + (Bug #36730830) +* **InnoDB:** + It was possible for the MySQL server to halt unexpectedly when + executing a [`DELETE`](/doc/refman/8.4/en/delete.html) or + [`UPDATE`](/doc/refman/8.4/en/update.html) statement after a column + was dropped using the `INSTANT` algorithm. + (Bug #36723117) +* **InnoDB:** + FTS index optimization would sometimes not function correctly + with tokens equal in collation order but different in terms of + bytes. + (Bug #36652127) +* **InnoDB:** + Replaced + `std::this_thread::sleep_for(std::chrono::seconds(0))` + usage with `std::this_thread::yield()` to + prevent it from being optimized out while compiled. + (Bug #36522343) +* **InnoDB:** + The upgrade process unexpectedly halted when the database + contained a full-text index created in MySQL 5.7 with a + user-created `FTS_DOC_ID` column as the primary + key. + + Our thanks to Huaxiong Song and the team at Alibaba for + contributing to this fix. + (Bug #36496164) +* **InnoDB:** + Disabled the optimizer for indexes with range conditions on + multiple-value virtual columns. + (Bug #36341532) +* **InnoDB:** + Redesigned the performance schema + [`data_locks`](/doc/refman/8.4/en/performance-schema-data-locks-table.html) and + [`data_lock_waits`](/doc/refman/8.4/en/performance-schema-data-lock-waits-table.html) tables so that + querying them does not require an exclusive global mutex on the + transaction or lock system. It now iterates over buckets of hash + tables that hold the locks to only latch the actively processed + shard, when previously it iterated over the transactions. This + also improves the iteration logic complexity in terms of speed + and memory to decrease the impact of these queries on the rest + of the system. + + Note that the query result might show an incomplete list of + transaction locks if it committed, started, or otherwise changed + the set of owned locks in-between visiting two buckets. This + differs from previous behavior which always showed a consistent + snapshot of locks held by individual transactions, although two + different transactions could have been presented at different + moments. In other words, the new approach gives a consistent + view of a single wait queue to show conflicting locks with a + waiting lock because they are always in the same bucket, while + the old approach could miss some of them because they belonged + to other transactions. The old approach would always show all + the other locks held by a reported transaction but could miss + locks of other transactions even if they were conflicting. + (Bug #36302624) +* **InnoDB:** + On Windows, fixed a doublewrite buffer regression that slowed + file access, and refactored + `FILE_FLAG_OVERLAPPED` flag usage for opening + files. + (Bug #36259487) +* **InnoDB:** + A schema mismatch was possible when a table was imported with a + different [`sql_mode`](/doc/refman/8.4/en/server-system-variables.html#sysvar_sql_mode) than when it + was created, because strict mode influences the number of + nullable columns in a table's secondary index. Now the + secondary index trees are also checked for corruption after a + tablespace is imported. + (Bug #35799038) +* **InnoDB:** + Given a table with an FTS index, when its tablespace is + discarded the corresponding FTS tables are also dropped. When + performing an operation that cleared out these tables, the code + incorrectly assumed that the FTS tables must also exist if the + FTS indexes were present in the table metadata. + (Bug #35343458) +* **InnoDB:** + An uninitialized buffer was being written to a temporary file + when checking if the system supports a different sector size for + FusionIO. This check is made when + [`innodb_flush_method`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_flush_method) is set to + `O_DIRECT` or + `O_DIRECT_NO_FSYNC`. + (Bug #115229, Bug #36705034) +* **InnoDB:** + Table rebuild operations involving secondary indexes required + greater file I/O for `InnoDB` temporary files + as compared with MySQL 8.0.26, which degraded query performance. + (Bug #114465, Bug #36444172) +* **InnoDB:** + Adding indexes with the parallel index builder was much slower + with the Performance Schema enabled due to issues in the + `Alter_stage` class. + (Bug #113505, Bug #36163502) +* **InnoDB:** + Fixed an `innodb.parallel_read_kill` related + unit test to better account for recent optimizer changes, and + fixed an `innodb.ddl_kill` unit test and its + associated macro usage. + + Our thanks to Dmitry Lenev and the team at Percona for + contributing to these fixes. + (Bug #113002, Bug #115416, Bug #35992036, Bug #36764973) + + References: See also: Bug #112767. +* **Partitioning:** + [`ALTER TABLE`](/doc/refman/8.4/en/alter-table.html) did not always work + correctly with partitioned tables. + (Bug #36677952) +* **Group Replication:** + Under certain conditions, all secondaries shut down unexpectedly + following a brief period of network inactivity on the primary + host. + (Bug #35642087) + + References: See also: Bug #32673639, Bug #34565855. +* **Group Replication:** + Memory aggregated by threads as reported did not account for all + `memory/sql/Gtid_set::Interval_chunk` freed by + other threads from what was allocated, leading to a incorrect + ever-increasing consumption of resources by Group Replication + thread + `thread/group_rpl/THD_applier_module_receiver`. + + Global memory as reported by + [`performance_schema.memory_summary_global_by_event_name`](/doc/refman/8.4/en/performance-schema-memory-summary-tables.html) + was not affected by this issue. + (Bug #34819861) +* **Group Replication:** + Removed a potential memory leak from + `xcom\network\xcom_network_provider_native_lib.cc`. + (Bug #115162, Bug #36673883) +* The server did not always handle connections correctly when + running with both the thread pool and audit log plugins. + (Bug #37039422) +* Packages for Debian-based systems are now built with + `WITH_ZLIB=system`, and disable + `MYSQL_MAINTAINER_MODE` for debug builds. + (Bug #37038213) +* Updated the Kerberos library bundled with commercial builds to + version 1.21.3. For more information, see the + [Kerberos 5 + 1.21.x Release Notes](https://web.mit.edu/kerberos/krb5-1.21/). + (Bug #37034600) +* Removed a heap-use-after-free warning in + `regexp::Regexp_facade::~Regexp_facade()`. + (Bug #36867806) +* While dumping tablespaces, **mysqldump** did not + properly escape certain SQL statements in its output. In + addition, the dump now encloses the following identifiers within + backticks: `LOGFILE GROUP`, + `TABLESPACE`, and `ENGINE`. + (Bug #36816986) +* Eliminated unnecessary copying in + `StoreLinkedImmutableStringFromTableBuffers()`, + improving the performance of some hash joins by 5 to 10 percent. + (Bug #36805260) +* A previous fix for an issue in + `sql/sql_executor.cc` checked for + `const_item()` rather than + `const_for_execution()`. + (Bug #36804785) + + References: This issue is a regression of: Bug #34951115. +* When executing an index range scan using + `IndexRangeScanIterator` the record buffer was + never set due to the fact that the data type used for + `IndexRangeScanIterator::m_expected_rows` had + been changed from double to boolean during refactoring. This + unintended change has been reverted. + + In addition, when the record buffer was enabled for index range + scans a problem arose with multi-valued indexes used for + covering these scans. (This is possible only when they are used + as part of index merge scans, since index merge scans force + covering index scans.) The source of the problem was that the + implementation of + `Field_typed_array::key_cmp()` needs the value + of the generated column for the indexed expression, and this + column is not available in the multi-valued index, so the + storage engine cannot safely evaluate the end range condition + when filling the record buffer for a covering scan. To fix this, + we now disable the record buffer when multi-valued indexes are + used for covering index range scans. + (Bug #36775910) + + References: See also: Bug #36341532. +* Certain triggers and stored procedures were not handled + correctly. + (Bug #36775910) +* Some errors raised when referencing external tables were not + handled correctly. + (Bug #36758378) +* On Debian, stopped stripping + `libmysqlclient.a` to increase LTO build + compatibility. + (Bug #36737581) +* The internal function `my_convert_internal()` + sometimes returned a pointer rather than the intended value. + (Bug #36684463) + + References: This issue is a regression of: Bug #36479091. +* Removed a memory issue in the server component. + (Bug #36600205) +* Fixed a memory leak in the **mysql** client. + (Bug #36600203) +* The [`AES_ENCRYPT()`](/doc/refman/8.4/en/encryption-functions.html#function_aes-encrypt) function did + not always return a valid result. + (Bug #36593265) +* In some cases a join involving a very large number of rows and + many tables was not processed correctly. + (Bug #36562979) +* Preparation of table value constructors did not track the number + of hidden columns added for expressions in an `ORDER + BY` clause. This could cause problems later in the + resolution process, possibly leading to an unplanned server + exit. + + We fix this by counting the number of hidden items in table + value constructors in the same way as this is done in other + query blocks. + (Bug #36560156) + + References: This issue is a regression of: Bug #35785452. +* [`DROP INDEX`](/doc/refman/8.4/en/drop-index.html) with the addition of a + `FULLTEXT` index in the same transaction + sometimes led to an unplanned server exit. + (Bug #36559642) +* Some combinations of optimizer hints did not function correctly. + (Bug #36492114) +* Following the fix for a previous issue, a + `const` item that is part of a `GROUP + BY` and is not found in the select list is not added as + a hidden item to the field list, but this was not taken into + consideration while checking for replacements for expressions + involving `ROLLUP` operations while creating a + temporary table. We fix this by checking whether the item that + is not found in the field list is a `const` + item, and if so, we use the same item as a replacement. + (Bug #36444257) + + References: This issue is a regression of: Bug #34951115. +* Removed assertions found during testing of the data masking + functions [`gen_rnd_pan()`](/doc/refman/8.4/en/data-masking-component-functions.html#function_gen-rnd-pan) and + [`mask_ssn()`](/doc/refman/8.4/en/data-masking-component-functions.html#function_mask-ssn). + (Bug #36397869, Bug #36398272) + + References: See also: Bug #36398221. +* Fixed an issue relating to FTS comparisons. + + Our thanks to Shaohua Wang and the team at Alibaba for the + contribution. + (Bug #36210202) +* Some [`CREATE + TABLE ... SELECT`](/doc/refman/8.4/en/create-table-select.html) statements were not always processed + correctly. + (Bug #36138460) +* RelWithDebInfo builds are no longer compiled with the "-g1" + flag, thus increasing the available debugging information and + generated file sizes. + (Bug #36111629) + + References: See also: Bug #33664929. +* Corrected potential misbehavior when the server was run with + [`--skip-grant-tables`](/doc/refman/8.4/en/server-options.html#option_mysqld_skip-grant-tables). + (Bug #36043213) +* Fixed a regression in an earlier fix for a problem with + references to columns from tables of outer query blocks in the + `ON` condition of a join. + (Bug #35854686) + + References: This issue is a regression of: Bug #96946, Bug #30350696. +* In certain rare cases, a [`CREATE + TABLE`](/doc/refman/8.4/en/create-table.html) statement involving the creation of a table with + foreign keys was not processed correctly. + (Bug #35553557, Bug #36350852) +* Fixed an issue relating to [`SHOW + INDEX`](/doc/refman/8.4/en/show-index.html) and generated columns. + (Bug #35497623) +* In some cases, table DDL in prepared statements was not handled + correctly. + (Bug #35221658) +* A left join with an impossible condition as part of an + `ON` clause was not optimized as in MySQL 5.7, + so that, in later versions, the query executed more quickly + without the impossible condition than with it. An example of + such a query, impossible condition included, is `SELECT + * FROM t1 JOIN t2 ON t1.c1=t2.c1 AND 1=2`. + (Bug #34668756) +* The XML function [`ExtractValue()`](/doc/refman/8.4/en/xml-functions.html#function_extractvalue) + did not handle arguments containing accented characters + correctly. + (Bug #117778, Bug #36236440) +* Changed the SLES 15 target platform from openSUSE 15.5 to 15.6, + which also means using GCC 13 instead of GCC 12 and building + against the system's OpenSSL 3.x instead of OpenSSL 1.1.x. + (Bug #115535, Bug #36934913) +* Fixed a typo in the Debian package description. + + Our thanks to Henning Pöttker for the contribution. + (Bug #115363, Bug #36749142) +* `MYSQL_TYPE_JSON` was missing from the + description of binary resultsets in the MySQL source code + documentation. + + Our thanks to Daniël van Eeden for the contribution. + (Bug #115360, Bug #36740656) +* With + [`prefer_ordering_index=off`](/doc/refman/8.4/en/switchable-optimizations.html#optflag_prefer-ordering-index), a + query with no reference key reverted to scanning and sorting the + full table even though it should have been possible to avoid the + sort. + + Our thanks to Daniel Nichter for the contribution. + (Bug #113699, Bug #36213938) +* A query using a greater-than (`>`) or + less-than (`<`) comparison with a + multi-valued index executed much more slowly than the same query + using an equality (`=`) comparison with the + same index. + (Bug #104897, Bug #33334911) diff --git a/corpus/changelog/mysql_releases/mysql_844.md b/corpus/changelog/mysql_releases/mysql_844.md new file mode 100644 index 0000000000000000000000000000000000000000..c44e9dcf9c4f402041bfeb04c47a591e243c2cd9 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_844.md @@ -0,0 +1,558 @@ +# MySQL 8.4.4 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.4/en/news-8-4-4.html +Version: 8.4.4 + +## Changes in MySQL 8.4.4 (2025-01-21, LTS Release) + +* [Account Management Notes](news-8-4-4.html#mysqld-8-4-4-account-management "Account Management Notes") +* [C API Notes](news-8-4-4.html#mysqld-8-4-4-capi "C API Notes") +* [Character Set Support](news-8-4-4.html#mysqld-8-4-4-charset "Character Set Support") +* [Compilation Notes](news-8-4-4.html#mysqld-8-4-4-compiling "Compilation Notes") +* [Component Notes](news-8-4-4.html#mysqld-8-4-4-components "Component Notes") +* [Firewall Notes](news-8-4-4.html#mysqld-8-4-4-firewall "Firewall Notes") +* [Installation Notes](news-8-4-4.html#mysqld-8-4-4-installation "Installation Notes") +* [Optimizer Notes](news-8-4-4.html#mysqld-8-4-4-optimizer "Optimizer Notes") +* [Performance Schema Notes](news-8-4-4.html#mysqld-8-4-4-performance-schema "Performance Schema Notes") +* [Functionality Added or Changed](news-8-4-4.html#mysqld-8-4-4-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-4-4.html#mysqld-8-4-4-bug "Bugs Fixed") + +### Account Management Notes + +* The database cache was not flushed properly following execution + of [`DROP USER`](/doc/refman/8.4/en/drop-user.html). + (Bug #37132323) +* Failed password validation was not always handled correctly. + (Bug #37041439) + +### C API Notes + +* Process memory usage grew when the + `libmysqlclient` API user tried to cache and + reuse a prepared statement, preparing it once and then calling + either of + [`mysql_stmt_bind_param()`](/doc/c-api/8.4/en/mysql-stmt-bind-param.html) or + [`mysql_stmt_bind_named_param()`](/doc/c-api/8.4/en/mysql-stmt-bind-named-param.html) + followed by + [`mysql_stmt_execute()`](/doc/c-api/8.4/en/mysql-stmt-execute.html), repeatedly + without calling the matching + [`mysql_stmt_close()`](/doc/c-api/8.4/en/mysql-stmt-close.html), or calling + it in the distant future (on application exit, for example). + + We solve this by introducing a separate + `MEM_ROOT` object for storing the bind + parameters array, which object can be cleared (deallocating the + memory) on each call to + `mysql_stmt_bind_param()` or + `mysql_stmt_bind_named_param()`. + (Bug #37202066) + +### Character Set Support + +* Zero rows resulted (where one row was expected) when selecting + from a view created with its connection and client character set + to `latin1`, where a query on the view used + `utf8` as its connection and client character + set, the view contained literal values with non-ASCII + characters, and the query performed a condition pushdown into a + [`UNION`](/doc/refman/8.4/en/union.html) of query blocks of the + view. + + This problem was related to a previous issue which fixed an + error for a similar problem: The problem in that case was + properly considering the character set of the view definition + when pushing down conditions contained in the view to inner + query blocks, but the fix implemented at that time did not take + into account the possibility that the view might contain + non-ASCII characters. + + This meant that the condition to be pushed down was written to a + text string with the wrong character set. We fix this oversight + by ensuring that the string is created with the correct + character set. + (Bug #37111452) + + References: See also: Bug #36246859. + +### Compilation Notes + +* **macOS:** + Removed obsolete CMake code from MacOS builds. + (Bug #37258036) +* **macOS:** + It is now possible to build MySQL using the Homebrew version of + Clang. + (Bug #37256912) +* **macOS:** + Removed warnings of the form ld: warning: ignoring + duplicate libraries and warnings specific to + `xcodebuild`. + (Bug #37065301) +* **Microsoft Windows:** + Disabled windows compiler warnings C26445 and C26821 in + `cmake/msvc_cppcheck.cmake`. Both of these + relate to MSVC substitution of `gsl::span` for + `std::span`, which is not used for MySQL. + (Bug #37158156) +* **Solaris:** + The minimum required version of GCC to build MySQL on Solaris + has been raised to 11.4. See + [Source Installation Prerequisites](/doc/refman/8.4/en/source-installation-prerequisites.html), for more + information. + (Bug #37256600) +* Starting with CMake 3.26, CMake writes the file + `CMakeFiles/CMakeConfigureLog.yaml`, which + supersedes `CMakeError.log`. References to + `CMakeError.log` have therefore been removed. + (Bug #37305289) +* Implemented the standards-compliant + `my_char_traits` for use + as a drop-in replacement for + `std::char_traits`, which + was deprecated in Clang 18 and removed in Clang 19. + (Bug #37273525, Bug #37785339) +* Removed a maybe-uninitialized error found + in `sql/item.cc` when building MySQL with GCC + 14. + (Bug #37157201) +* The version of `libedit` used to compile MySQL + was upgraded to 20240808-3.1. + (Bug #37101293) +* The server could not be built on Ubuntu 22.04 using Clang 13. + (Bug #37075154) +* Removed an error in + `mysql_prepare_create_table()` (in the file + `sql/sql_table.cc`) found when compiling + MySQL with XCode 16. + (Bug #37068527) +* MySQL could not be compiled using Clang 19. + (Bug #37014761) +* `#include ` was missing from + `plugin/group_replication/libmysqlgcs/src/bindings/xcom/xcom/task.cc` + even though `std::chrono::duration_cast()` was + referenced in this file. + (Bug #116779, Bug #37329617) +* The server could not be built on Fedora 40 (and possibly other + Linux platforms) using cmake 3.11, due to an issue with TIRPC. + (Bug #116164, Bug #37080195) + +### Component Notes + +* [`INSTALL COMPONENT`](/doc/refman/8.4/en/install-component.html) issued + concurrently with a [`SET + PERSIST`](/doc/refman/8.4/en/set.html) which used a subquery could sometimes lead to + an unplanned exit of the server. + (Bug #36559078) + + References: See also: Bug #35647759. + +### Firewall Notes + +* In some cases, after performing an upgrade, stored procedures + relating to MySQL Enterprise Firewall were not processed correctly. + (Bug #36084822) + +### Installation Notes + +* When upgrading from MySQL 5.7 to a later MySQL release series, + the system-created `mysql.sys` and + `mysql.session` accounts are now modified to + use the `caching_sha2_password` authentication + plugin instead of the `mysql_native_password` + plugin, which is deprecated in MySQL 8.0, and removed in MySQL + 9.0. + (Bug #36608636) + +### Optimizer Notes + +* Pushing down a condition which had an aggregate function in a + `WHERE` clause caused the aggregate function to + be evaluated when it should not have been. + (Bug #36421735) + +### Performance Schema Notes + +* If a user other than root ran [`START + REPLICA`](/doc/refman/8.4/en/start-replica.html), + [`PERFORMANCE_SCHEMA.PROCESSLIST`](/doc/refman/8.4/en/performance-schema-processlist-table.html) + assigned that user's name to the newly spawned foreground + replication threads instead of `system user`. + + As of this release, `system user` is assigned + to all foreground system threads. + (Bug #37357562) +* Under certain circumstances, a metadata lock can be upgraded or + downgraded to a different `LOCK_TYPE`. This + change was not reflected in the + [`PERFORMANCE_SCHEMA.METADATA_LOCKS`](/doc/refman/8.4/en/performance-schema-metadata-locks-table.html) + table. + + Our thanks to George Ma and the Alibaba team for the + contribution. + (Bug #116625, Bug #37271768) + +### Functionality Added or Changed + +* Binary packages that include `curl` rather than + linking to the system `curl` library have been + upgraded to use `curl` 8.11.1. + (Bug #37389565) + +### Bugs Fixed + +* **Incompatible Change:** + Corruption occurred in a spatial index when an update of a + geometry with a minimal change in the minimum bounding rectangle + (MBR) was followed by a delete operation. + + When upgrading to this release, it is recommended that you drop + any spatial indexes beforehand, then re-create them after the + upgrade is complete. Alternatively, you can drop and re-create + such indexes immediately following the upgrade, but before + making use of any of the tables in which they occur. You should + also be aware that downgrading to any previous version + reintroduces the original problem described previously. + + For more information, see + [Creating Spatial Indexes](/doc/refman/8.4/en/creating-spatial-indexes.html). + (Bug #36452528) +* **InnoDB:** + Concurrently truncating a table while querying the Performance + Schema sometimes cause MySQL to halt unexpectedly. + (Bug #37271715) +* **InnoDB:** + It was possible for an `ALTER TABLE` operation + using the `INPLACE` algorithm on a table + containing both a spatial index and an auto-increment column to + cause corruption or, in debug builds, to trigger a debug assert. + This was due to the auto-increment column value being + overwritten in the old records of the spatial index while the + new record was prepared. + (Bug #37189985) +* **InnoDB:** + Certain IO buffer serializations triggered an assertion in debug + builds that caused the system to hang. + (Bug #37139618) +* **InnoDB:** + Improved `InnoDB` start up time. + (Bug #36880863) + + References: This issue is a regression of: Bug #36808732. +* **InnoDB:** + An assertion failure was raised when creating a + `FULLTEXT` index on a table with an + `FTS_DOC_ID` value greater than 4294967295. + (Bug #36879147) + + References: See also: Bug #37387224. +* **InnoDB:** + Dropping a primary key, and then adding a new + `AUTO_INCREMENT` column as a primary key in + descending order using the `INPLACE` algorithm + failed. + + Our thanks to Shaohua Wang and the team at Alibaba for the + contribution. + (Bug #36658450) +* **InnoDB:** + Extending a user tablespace produces file extension redo log + records (`MLOG_FILE_EXTEND`), but they were not + produced when extending the system tablespace. + (Bug #36511673) +* **InnoDB:** + A `DELETE` operation on a table with a self + referential foreign key and full-text index could have triggered + an assertion. + (Bug #36234681) +* **InnoDB:** + When clearing an AHI index from all buffer pool pages, the block + state would potentially change to BUF\_BLOCK\_MEMORY before + acquiring the block mutex thus causing an unexpected halt. + (Bug #35037114) +* **InnoDB:** + Common prefix compression for redo log inserts + (`MLOG_REC_INSERT`) was disabled but is now + enabled when the versions match. + (Bug #34946626) + + References: This issue is a regression of: Bug #13899. +* **InnoDB:** + Virtual column information for a row containing an externally + stored [`BLOB`](/doc/refman/8.4/en/blob.html) was not always logged + during an `UPDATE` operation, which sometimes + resulted in an Index PRIMARY is corrupted + error. + (Bug #34574604) +* **InnoDB:** + `ON DELETE CASCADE` with generated columns + containing secondary indexes sometimes failed, due to virtual + column templates not being initialized before deletion. + + Our thanks to Rahul Malik for the contribution. + (Bug #33691659) +* **InnoDB:** + An update operation attempted to update a virtual column while + building an update node for a child table, but should not have + done so since foreign key constraints cannot reference virtual + columns. + (Bug #33327093) +* **InnoDB:** + It was possible for `ALTER TABLE`, which + rebuilds `InnoDB` tables using the + `INPLACE` algorithm, to be rejected with a + duplicate key error due to a non-duplicate record being inserted + concurrently while the rebuild was paused to release a page + latch. + + Our thanks to Dmitry Lenev and the team at Percona for + contributing to this fix. + (Bug #115511, Bug #36808088) +* **InnoDB:** + The check enforcing the rule that + `ALGORITHM=INSTANT` cannot be used on a column + referenced by a foreign key constraint from another table did + not inspect the last field of said constraint. + (Bug #115457, Bug #36796094) +* **InnoDB:** + CPU usage statistics did not account for a processor count over + 128, which could degrade performance on these larger systems. + (Bug #115399, Bug #36765223) +* **InnoDB:** + Executing `ALTER TABLE` with `ADD + COLUMN` or `DROP COLUMN` against an + empty table now uses the `INPLACE` algorithm by + default instead of `INSTANT`. This change means + the row version is no longer incremented for these simple + operations. + (Bug #113051, Bug #36004394) +* **InnoDB:** + An [`ALTER TABLE`](/doc/refman/8.4/en/alter-table.html) operation that + rebuilt an `InnoDB` table using the + `INPLACE` algorithm potentially led to losing a + row of data if a purge occurred concurrently on the altered + table that contained a clustered or spatial index. + + Our thanks to Dmitry Lenev and the team at Percona for + contributing to this fix. + (Bug #110706, Bug #113812, Bug #115608, Bug #116764, Bug #35303494, Bug #36261480, Bug #36846567, Bug #37318367) +* **InnoDB:** + Queries with a descending primary key and the + `index_merge` optimization sometimes yielded + incorrect results such as missing rows. + (Bug #106207, Bug #33767814) +* **Replication:** + In an InnoDB ClusterSet setup, when + [`autocommit`](/doc/refman/8.4/en/server-system-variables.html#sysvar_autocommit) was set to + `OFF` on all nodes in the cluster, a controlled + switchover using MySQL Shell was rejected with Error 1105 + (Unknown error). + + To fix this, we now force a new transaction in + `channel_change_source_connection_auto_failover()` + whenever `autocommit=OFF` to prevent table + access deadlocks when an info repository transaction is executed + after changing + `SOURCE_CONNECTION_AUTO_FAILOVER`. + (Bug #37173907) +* **Replication:** + While large transactions were being received and applied, and a + request to stop the replication channel was made using + [`STOP REPLICA`](/doc/refman/8.4/en/stop-replica.html), MySQL did not do so + properly, and subsequently did not process any channel commands. + In addition, the server shutdown process did not complete + gracefully, and required either the MySQL process to be killed + or the host system to be restarted. + (Bug #115966, Bug #37008345) +* **Replication:** + The log message written when a replica reconnects to the source + (when, for example, it is stopped and restarted by issuing + [`STOP REPLICA`](/doc/refman/8.4/en/stop-replica.html) followed by + [`START REPLICA`](/doc/refman/8.4/en/start-replica.html)) `While + initializing dump thread for replica with UUID + uuid, found a zombie dump thread with + the same UUID. Source is killing the zombie dump + thread(thread_id)` has been + improved to `Upon reconnection with the replica, while + initializing the dump thread for UUID + uuid, an existing dump thread with + the same UUID was detected. The source is terminating the + previous dump thread (thread_id), + which is normal and expected`. + (Bug #84358, Bug #25330090) +* **Group Replication:** + Removed a potential race condition between the internal + functions + `cs::apply::Commit_order_queue::front()` and + `cs::apply::Commit_order_queue::remove()`. + (Bug #37223451) + + References: See also: Bug #35206392. +* **Group Replication:** + When the primary node unexpectedly left the group and quickly + attempted to rejoin, the member which had been elected to remove + other, faulty members tried to expel or remove the faulty node + but could not do so due to lack of a majority. When the expelled + or removed node was the primary, this left the cluster without a + primary, resulting in an unusable state. + (Bug #36991859) + + References: See also: Bug #37181867. +* **Group Replication:** + In some cases, adding a new secondary caused existing + secondaries to lag, leading to a deadlock which persisted with + no more writes possible until the primary was restarted. + + This deadlock occurred between the ticket manager, which ensures + that transactions are committed on the correct side of a view + change (before or after the view change), and the commit order + manager on the inbound replication channel, which ensures that + transactions are committed in the same order in which they are + received, when these two managers required different orders. + This meant that, in some cases, adding a new secondary caused + the group primary to be unable to do writes. + + We solve this issue by ignoring the commit order manager + ordering and enforcing the ticket manager ordering for + non-conflicting transactions when such a deadlock occurs. A + consequence of this is that + [`replica_preserve_commit_order`](/doc/refman/8.4/en/replication-options-replica.html#sysvar_replica_preserve_commit_order) + may not be strictly honored near a + `View_change_log_event`. In other words, + `replica_preserve_commit_order` no longer + provides a strict guarantee on an inbound channel on a Group + Replication primary. + [`replica_preserve_commit_order`](/doc/refman/8.4/en/replication-options-replica.html#sysvar_replica_preserve_commit_order) + still ensures that transactions are ordered correctly, with the + only exception being non-conflicting transactions around view + change log events. + (Bug #35206392) + + References: See also: Bug #37223451. +* **Group Replication:** + Improved garbage collection in Group Replication by eliminating + non-essential calls to + `is_subset_not_equals()`. + (Bug #110673, Bug #35286974) +* **Group Replication:** + Removing a group member from a group in which all members were + running the same version of MySQL, upgrading it to a later + version (from a later release series), and then requesting it to + rejoin the group caused the upgraded group member to hang in the + recovering state. +* The errors `ER_DD_UPDATE_DATADIR_FLAG_FAIL`, + `ER_IB_MSG_FIL_STATE_MOVED_PREV_OR_HAS_DATADIR`, + `ER_RPL_KILL_OLD_DUMP_THREAD_ENCOUNTERED`, and + `ER_RPL_MTA_ALLOW_COMMIT_OUT_OF_ORDER` were + originally defined in MySQL 8.0, but were subsequently assigned + different error code numbers (but with the same names) in MySQL + 8.4. The numbers assigned in MySQL 8.0 now apply to MySQL 8.0 + only; in the MySQL 8.4 and later release series, only the + numbers assigned in MySQL 8.4 are used. + (Bug #37284176) +* Added missing checks for `NULL` input arguments + in `mle::validate()` and + `validate_session_options()`. + (Bug #37267887) +* In `sql/item_cmpfunc.cc`, + `Item_bool_func2::resolve_type()` made an + unchecked call to + `Item_bool_func::resolve_type()`; the call to + `Item_bool_func::resolve_type()` ignored its + return value, and execution continued even in case of an error. + (Bug #37143289) +* AppArmor denied access to + `/proc/$pid/task/$thread_id/mem`, a file + required to generate a stack trace. + (Bug #37063288) + + References: See also: Bug #37387034. +* A filter condition in a subquery was sometimes ignored when a + query used the [`index_subquery`](/doc/refman/8.4/en/explain-output.html#jointype_index_subquery) + join type for subquery execution, and the subquery table used + materialization in the execution plan. The derived table access + path replaced the filter condition, resulting a final plan + without the filter layer. To fix this, in such cases, we now add + the derived table access path along with the filter access path + instead of replacing the latter. + (Bug #36918913) +* Some [`UNION`](/doc/refman/8.4/en/union.html) operations similar to + `a UNION b UNION c ...` consumed excessive + memory. To help keep this from happening, we now flatten equal + set operations at the parsing level, before contextualization + occurs, which should result in reduced resource usage by such + operations. + (Bug #36652610) +* Improved the internal function + `my_print_help()`. + (Bug #36615714) + + References: See also: Bug #37387224. +* Removed incorrect code from `Acl_cache`. + (Bug #36608160) +* A subquery containing an aggregate function `WITH + ROLLUP` which was part of a row value comparator was + not always processed correctly. + (Bug #36593235) + + References: See also: Bug #37387180. This issue is a regression of: Bug #30969045, Bug #30921780, Bug #26227613, Bug #29134467, Bug #30967158. +* It was possible for errors raised when persisting variables not + to be reported correctly. + (Bug #36574732) +* Some subqueries using `WITH ROLLUP` were not + always processed correctly. + (Bug #36421704) +* [`MyISAM`](/doc/refman/8.4/en/myisam-storage-engine.html) block length calculations + were not always performed correctly. + (Bug #36347992) +* Fixed an issue relating to FTS and concurrent DDL or DML. + (Bug #34633727) +* [`DROP VIEW + name`](/doc/refman/8.4/en/drop-view.html) was rejected with + [`ER_BAD_TABLE_ERROR`](/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_bad_table_error) if there + existed a table with the same *`name`*. + (Bug #33200087) +* Incorrect results were returned by some queries that used hash + antijoins when the hash table did not fit in the join buffer and + spilled to disk. (The query triggering the issue actually + specified `LEFT JOIN`, but this was transformed + internally from a left outer join to an antijoin.) + + The problem was that some rows in the probe table were skipped + when writing the probe rows to chunk files, the skipped rows + being those that had `NULL` in part of the join + key. Such rows can be skipped for inner joins and semijoins, as + they are known to have no match in the build table, but for + outer joins and antijoins, rows in the probe table which have no + matching row in the build table should be part of the join + result, so they must be included in the chunk files. + + We already preserved these rows in the chunk files for outer + joins. This fix extends the logic used for that purpose so that + it also applies for antijoins. + (Bug #116334, Bug #37161583) +* In MySQL 8.0 and later, queries of the form + [`SELECT DISTINCT ... FROM + t1 WHERE NOT IN(SELECT ...)`](/doc/refman/8.4/en/select.html) were transformed into an + antijoin if possible, causing the optimizer not to choose a + group skip scan for table t1 whereas it would have been chosen + in MySQL 5.7. This resulted in a performance degradation for + such queries. Group skip scan is not chosen, since the query is + now no longer a single-table query following the antijoin + transformation, and this access method is enabled only for + single table queries. The same behavior can be seen for queries + which are transformed into semijoins as well. In such cases, + group skip scan access method can still be used if the access + method is used only for duplicate removal (that is, with + `DISTINCT` or `GROUP BY`, but + without aggregate functions). + + To fix this, we enable group skip scan when there is only one + table in the original query, irrespective of the number of + semijoin tables present after internal transformations as long + as the query contains no aggregate functions. + (Bug #112362, Bug #35842412) +* The **mysql** client did not allow using '#' or + '--' inside an optimizer hint comment. + + Our thanks to Kaiwang Chen for the contribution. + (Bug #98521, Bug #30875669) diff --git a/corpus/changelog/mysql_releases/mysql_845.md b/corpus/changelog/mysql_releases/mysql_845.md new file mode 100644 index 0000000000000000000000000000000000000000..d92cf1654d98ef8832aab7a0ca08eb4d11bbc0c2 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_845.md @@ -0,0 +1,462 @@ +# MySQL 8.4.5 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.4/en/news-8-4-5.html +Version: 8.4.5 + +## Changes in MySQL 8.4.5 (2025-04-15, LTS Release) + +* [Account Management Notes](news-8-4-5.html#mysqld-8-4-5-account-management "Account Management Notes") +* [Audit Log Notes](news-8-4-5.html#mysqld-8-4-5-audit-log "Audit Log Notes") +* [Compilation Notes](news-8-4-5.html#mysqld-8-4-5-compiling "Compilation Notes") +* [SQL Function and Operator Notes](news-8-4-5.html#mysqld-8-4-5-functions-operators "SQL Function and Operator Notes") +* [INFORMATION\_SCHEMA Notes](news-8-4-5.html#mysqld-8-4-5-information-schema "INFORMATION_SCHEMA Notes") +* [InnoDB Notes](news-8-4-5.html#mysqld-8-4-5-innodb "InnoDB Notes") +* [Functionality Added or Changed](news-8-4-5.html#mysqld-8-4-5-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-4-5.html#mysqld-8-4-5-bug "Bugs Fixed") + +### Account Management Notes + +* It was possible in some cases to grant a user the + [`EXECUTE`](/doc/refman/8.4/en/privileges-provided.html#priv_execute) privilege, but + subsequently to be unable to revoke it from the same user. + (Bug #37570206) + +### Audit Log Notes + +* `` was not populated for + `Execute`. + + For more information, see + [Logging Specific Event Classes](/doc/refman/8.4/en/audit-log-filter-definitions.html#audit-log-filtering-class-logging). + (Bug #36686351) + +### Compilation Notes + +* **Group Replication:** + The OpenSSL Engine interface is deprecated, and is no longer + being included in OpenSSL v3 main packages by some Linux + distributions, including Fedora. + + To avoid build issues, the usage of the OpenSSL Engine interface + by the Group Communication System (GCS) is now restricted to + OpenSSL versions previous to 1.1. + (Bug #37475769) +* **Linux:** + Use /usr/bin/gcc (GCC 14.2.1) when building the server on Oracle + Linux 10. + (Bug #37616148) +* Upgraded the bundled Curl library to version 8.12.1. + (Bug #37633587) +* Abseil could not be built on FreeBSD. + (Bug #37611924) +* The bundled version of `opentelemetry-cpp` was + upgraded to version 1.19.0. + (Bug #37506554) +* In order to use `xxhash` functions + independently from the `lz4` library (bundled + or source), we compiled `xxhash.c` into our + own binaries, which required using a great many CMake + directives. Instead, we now build an interface library for + `xxhash`, and link with that wherever such + functions are used. + (Bug #37417386) +* Use xxHash-0.8.2 from GitHub rather than the version bundled + with lz4. + (Bug #37387318) + +### SQL Function and Operator Notes + +* **Important Change:** + When an SQL function is improved from one release to the next, + it may throw SQL errors in situations in which it previously did + not. If this happens in a table's constraints, default + expressions, partitioning expressions, or virtual columns, the + table could not be opened. This prevented both analyzing the + problem (using, for example, [`SHOW CREATE + TABLE`](/doc/refman/8.4/en/show-create-table.html)) and addressing it (such as with an + [`ALTER TABLE ... + DROP ...`](/doc/refman/8.4/en/alter-table.html) statement). + + Now, on server upgrade, we scan the data dictionary for tables + that use any of the features just mentioned. We then try to open + such tables, and if we fail to do so, we alert the user. This + patch addresses this. The + [`--check-table-functions`](/doc/refman/8.4/en/server-options.html#option_mysqld_check-table-functions) server + option introduced in this release helps to address this problem + by making it possible to specify the server's behavior when + encountering an error with such a function. Set this option to + `WARN` in order to log a warning for each table + which the server could not open; setting it to + `ABORT` also logs these warnings as + `WARN`, but aborts the server upgrade if any + issues were found. + + `ABORT` is the default; this enables the user + to fix the issue using the older version of the server before + upgrading to the new one. `WARN` flags the + issues, but allows the user to continue in interactive mode + while addressing the problem. + (Bug #36890891) + + References: See also: Bug #37009318. This issue is a regression of: Bug #98950, Bug #98951, Bug #31031886, Bug #31031888. + +### INFORMATION\_SCHEMA Notes + +* Fixed a performance issue in the + [`PROCESSLIST`](/doc/refman/8.4/en/information-schema-processlist-table.html) table. + (Bug #36778475) + +### InnoDB Notes + +* **InnoDB:** + InnoDB now uses simplified APIs for saving and restoring level + one progress during parallel scans. + (Bug #37517125) + +### Functionality Added or Changed + +* **Important Change:** + For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 3.0.16. For more information, see + [OpenSSL + 3.0 Series Release Notes](https://openssl-library.org/news/openssl-3.0-notes/) and + [OpenSSL + Security Advisory (11th February 2025)](https://openssl-library.org/news/secadv/20250211.txt). + (Bug #36033684) +* **InnoDB:** + To improve debugging, the `buf_page_t` and + `buf_block_t` structure's metadata is now + printed to the error log. + (Bug #35115629) + + References: See also: Bug #35115601. +* Increased the historical 1024-byte limit when printing the + current query during signal handling to 1073741824 (1024 \* 1024 + \* 1024). + (Bug #37603354) + +### Bugs Fixed + +* **InnoDB:** + Fixed a potential memory leak in several places in the innobase + code. + (Bug #37403052) +* **InnoDB:** + Under certain circumstances, MySQL could crash during shutdown + due to pages which were still fixed or dirty. Errors similar to + the following were logged: + + ```None + [ERROR] [MY-011908] [InnoDB] [FATAL] Page [page id: space=46, page number=75] still fixed or dirty + [ERROR] [MY-013183] [InnoDB] Assertion failure: buf0buf.cc:5889:ib::fatal triggered thread 139963705668608 + ``` + + (Bug #37391519) + + References: See also: Bug #35115601. +* **InnoDB:** + [`CHECK TABLE`](/doc/refman/8.4/en/check-table.html) for spatial indexes + did not verify the MBR against the geometry MBR stored in the + clustered index record. This could result in incorrect behavior + of spatial indexes. + + As of this release, `CHECK TABLE EXTENDED` + verifies the MBR matches the MBR stored in the clustered index + record. + (Bug #37359538) +* **InnoDB:** + Fixed an issue relating to pessimistic row update. + + Our thanks to Mengchu Shi and the team at Alibaba for the + contribution. + (Bug #37292404) +* **InnoDB:** + The [`CHECK TABLE`](/doc/refman/8.4/en/check-table.html) operation could + incorrectly report corruption in spatial indexes. + (Bug #37286473) +* **InnoDB:** + Fixed an issue relating to InnoDB redo log recovery. + (Bug #37061960) +* **InnoDB:** + Fixed an issue relating to reading `index_id` + values. + (Bug #36993445, Bug #37709706) +* **InnoDB:** + Fixed an issue relating to + [`lower_case_table_names`](/doc/refman/8.4/en/server-system-variables.html#sysvar_lower_case_table_names). + (Bug #32288105) +* **InnoDB:** + Partition table indexes were not checked when retrieving a + record count while that table's definition was being altered by + another client session. The record count was executed without + error. + + As of this release, the index is checked to ensure it is usable + when retrieving a record count. + (Bug #117459, Bug #37617773) +* **InnoDB:** + Refactored code related to BPR\_PCUR\_\* positioning for restore + operations. + (Bug #117259, Bug #37505746) + + References: This issue is a regression of: Bug #37318367. +* **InnoDB:** + Changes made to + [`innodb_spin_wait_delay`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_spin_wait_delay) in MySQL + 8.0.30 negatively impacted performance. + (Bug #116463, Bug #37212019) +* **InnoDB:** + Under certain circumstances, using [`ALTER + TABLE`](/doc/refman/8.4/en/alter-table.html) with `INPLACE` to modify the + size of a column could result in an index which exceeds the + valid size limit (767 bytes). This occurred for tables with a + row format of `Redundant` or + `Compact` and the row format was not explicitly + defined in the table creation. + + As of this release, a validation is performed and an error + returned by any ALTER TABLE, INPLACE operation which will result + in an invalid index size. + (Bug #116353, Bug #37168132) +* **InnoDB:** + Fixed a memory leak in the `Clone_persist_gtid` + thread. + + Our thanks to Baolin Huang and the team at Alibaba for the + contribution. + (Bug #107991, Bug #34454572) +* **Partitioning:** + When inserting [`NOW()`](/doc/refman/8.4/en/date-and-time-functions.html#function_now) into a + column not part of the partition key of a partitioned table, all + partitions were retrieved, and no pruning occurred. + (Bug #37397306) +* **Replication:** + When the log sanitizer analyzes relay log files, it first + searches for a starting point (such as a rotation event or + transaction end), but in some cases, it was possible for a + binary log file containing a needed GTID to be deleted as having + no relevant data; this resulted in the point-in-time recovery + process hanging indefinitely while waiting for the missing GTID + to be applied. Now in such cases, the analysis skips parsing of + transaction boundaries until the start point is established. + (Bug #37635908) +* **Replication:** + In a source-replica setup, the replica encountered irregular + failures of [`UPDATE`](/doc/refman/8.4/en/update.html) and + [`DELETE`](/doc/refman/8.4/en/delete.html) statements with + [`ER_KEY_NOT_FOUND`](/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_key_not_found) errors on the + same table. (The replica's binary log and GTID records + showed that the row required was committed, and had not been + deleted or updated.) This occurred on the replica when the + row-matching algorithm used was `HASH_SCAN` and + two rows in the same table had the same CRC32 value. + + In the event of such a CRC32 collision, finding a matching CRC32 + in the hash table does not guarantee that the correct row is + being updated, so the algorithm iterates over any multiple + entries having the same CRC32, and compares the full record for + each of them in a loop; the problem occurred due to the fact + that the logic to exit this loop was incorrect. This logic has + now been corrected. + (Bug #37462058, Bug #37731216) +* **Replication:** + The + [`asynchronous_connection_failover_delete_source()`](/doc/refman/8.4/en/replication-functions-async-failover.html#function_asynchronous-connection-failover-delete-source) + function did not always perform as expected in all cases. + (Bug #36479088) +* **Replication:** + In some cases, the + [`asynchronous_connection_failover_add_source()`](/doc/refman/8.4/en/replication-functions-async-failover.html#function_asynchronous-connection-failover-add-source) + function did not perform as expected. + (Bug #36479083) +* **Replication:** + In some cases, [`MASTER_POS_WAIT()`](/doc/refman/8.4/en/replication-functions-synchronization.html#function_master-pos-wait) + did not perform as expected. + (Bug #36421684, Bug #37709187) +* **Replication:** + The + [`asynchronous_connection_failover_add_managed()`](/doc/refman/8.4/en/replication-functions-async-failover.html#function_asynchronous-connection-failover-add-managed) + function in some cases did not produce the expected result. + (Bug #34648589) +* **Replication:** + When the server was under a heavy write load, the binary log + position for [`gtid_executed`](/doc/refman/8.4/en/replication-options-gtids.html#sysvar_gtid_executed) as + shown in the Performance Schema + [`log_status`](/doc/refman/8.4/en/performance-schema-log-status-table.html) table did not match that + of the gtid shown in the binary log file. + + We fix this by increasing the scope of the lock on the + `log_status` table when querying it to ensure + that transactions in the commit pipeline are completed. This + ensures that a query against the `log_status` + table waits until `gtid_executed` has been + fully updated, thereby guaranteeing consistency with its + position in the binary log. + (Bug #102175, Bug #32442772) +* **Group Replication:** + When a secondary joined the group, it might happen that all + group members started to grow the value of the column + `COUNT_TRANSACTIONS_ROWS_VALIDATING` column of + the Performance Schema + [`replication_group_member_stats`](/doc/refman/8.4/en/performance-schema-replication-group-member-stats-table.html) + table indefinitely. This impacted memory consumption in all + group members, eventually leading to thrashing if not mitigated + by restarting the secondary group member that triggered the + behavior, or in some cases, by restarting the whole group. + + Analysis pointed to issues with the Group Replication start + operation, which checks whether there are partial transactions + on the `group_replication_applier` channel from + previous group participation; if any are found, this channel is + stopped after applying all complete transactions and its relay + logs purged, and then the channel is restarted. After this, + distributed recovery is performed, applying any missing data + from group members. + + The issues arose when the Group Replication pipeline operation + for stopping the `group_replication_applier` + channel incorrectly stopped a periodic task from the certifier + module, which caused some periodic internal operations not to + take place. One of these tasks was the periodic sending of the + committed transactions; this omission prevented garbage + collection for certification, which in turn caused a continuous + increase in + `COUNT_TRANSACTIONS_ROWS_VALIDATING` in the + Performance Schema + `replication_group_member_stats` table. + + To solve this problem, we have taken steps to ensure that the + pipeline operation for stopping the + `group_replication_applier` channel no longer + interferes with the certifier module, which also stops spurious + values from being added for + `COUNT_TRANSACTIONS_ROWS_VALIDATING`. + (Bug #37613510) +* **Group Replication:** + When running Group Replication, some transactions may not have + write sets, as with empty transactions with GTID\_NEXT specified, + or DDL statements. For such transactions, Group Replication + cannot check conflicts; thus, it is not known whether they can + be applied in parallel, and for this reason, Group Replication + follows a pessimistic approach, and runs them sequentially, + potentially leading to an impact on performance. + + While DDL must be applied sequentially, there is no actual + reason to force such behavior for empty transactions, so this + fix makes it possible for empty transactions to be applied + concurrently with other nondependent transactions. + (Bug #37597512, Bug #37569333) +* The `fprintf_string()` function in + **mysqldump** did not use the actual quote + character for string escaping. + (Bug #37607195) +* [`EXPLAIN`](/doc/refman/8.4/en/explain.html) did not always handle + subqueries correctly. + (Bug #37560280) +* If a demangled function name exceeded 512 bytes in a stack + trace, the function name was truncated and a newline was not + printed. + + As of this release, long strings, such as filenames and + demangled functions, are written directly to the output. + (Bug #37543598) +* **mysqldump** did not escape certain special + characters properly in its output. With this fix, + **mysqldump** now follows the rules as described + in [String Literals](/doc/refman/8.4/en/string-literals.html). + (Bug #37540722, Bug #37709163) +* Some operations on tables having functional indexes were not + handled properly. + (Bug #37523857) +* Attempting to install an unknown component using + [`INSTALL COMPONENT`](/doc/refman/8.4/en/install-component.html) was not always + handled correctly. + (Bug #37437317) +* The Audit Log plugin did not handle errors correctly when + writing JSON output. + + See [MySQL Enterprise Audit](/doc/refman/8.4/en/audit-log.html), for more information. + (Bug #37370439) +* An [`UPDATE`](/doc/refman/8.4/en/update.html) subsequent to an + [`INSERT`](/doc/refman/8.4/en/insert.html) affecting a table which + had a `BEFORE INSERT` trigger was sometimes + rejected with a null value error when the + `INSERT` had set a `NOT NULL` + column to `NULL`, even though this should have + been allowed by the server + [`sql_mode`](/doc/refman/8.4/en/server-system-variables.html#sysvar_sql_mode) in effect. + (Bug #37337527) +* In some cases, components could not reuse the same connection + for running multiple queries. + (Bug #37286895) +* Improved error handling for stored routines. + (Bug #37193011) +* Stored routines were not always invoked correctly in prepared + statements. + (Bug #37077424, Bug #37292797) +* Increased the size of `SEL_ROOT::elements` from + `uint16` to `size_t`. + (Bug #36610878) +* Removed an issue with multibyte UTF8 handling. + (Bug #36593253) +* An `ORDER BY` containing an aggregation was not + always handled correctly. + (Bug #36593244) +* An optimizer hint was ignored, unexpectedly requiring the use of + `FORCE INDEX`, when querying a view that + included a [`UNION`](/doc/refman/8.4/en/union.html). For more + information, see [Optimizer Hints](/doc/refman/8.4/en/optimizer-hints.html). + (Bug #36536936) +* Some subselects were not handled correctly. + (Bug #36421690) +* An invalid DDL statement in certain cases was not always + rejected as expected. + (Bug #35721121) +* Improved the internal function + `append_identifier()`. + (Bug #35633084) +* Normally, a view with an unused window definition should be + updatable, but when it contained a subquery, it was marked as + not updatable. At update time, the window was eliminated, but + this was too late to allow an update to be performed. + + We fix this by testing mergeability, by checking the presence of + window functions, rather than that of window definitions; this + allows the view to be updatable, and the problematic + [`UPDATE`](/doc/refman/8.4/en/update.html) to succeed. + (Bug #35507777) +* In some cases, [`SET`](/doc/refman/8.4/en/set.html) did not + perform correctly in prepared statements. + (Bug #35308309) +* This fix addresses the following issues: + + + `Query_expression::is_set_operation()` was + not always executed properly. + + Some sequences of DML statements could lead to an unplanned + exit. + + Some nested subselects were not always handled correctly. + + (Bug #34361287, Bug #35889583, Bug #35996409, Bug #36404149, Bug #36863048, Bug #37611264) +* On Debian, **dh\_strip\_nondeterminism** is no + longer executed on zip and gzip files within the packages. + (Bug #33791880) +* Removed an issue relating to invalid UTF8 values. + (Bug #27618273, Bug #37709687) +* Addressed an issue relating to an invalid identifier. + (Bug #22958632, Bug #37709664) +* A negative impact in performance was observed when using a + multivalued index with `ORDER BY DESC` and + `LIMIT` in a query, where the value specified + by `LIMIT` was greater than the number of rows + actually in the result. + (Bug #117085, Bug #37436310) + + References: This issue is a regression of: Bug #104897, Bug #33334911. +* If one client session had a uncommitted transaction that caused + a `DROP TABLE` statement + in another client session to be blocked, a third client session + hung when trying to issue a + `USE DATABASE` + statement. + (Bug #115706, Bug #36892499) diff --git a/corpus/changelog/mysql_releases/mysql_846.md b/corpus/changelog/mysql_releases/mysql_846.md new file mode 100644 index 0000000000000000000000000000000000000000..808773f95c05ab4619e9b8ed3d0dce5b37f57d38 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_846.md @@ -0,0 +1,433 @@ +# MySQL 8.4.6 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.4/en/news-8-4-6.html +Version: 8.4.6 + +## Changes in MySQL 8.4.6 (2025-07-22, LTS Release) + +Note + +These release notes were created with the assistance of +MySQL HeatWave GenAI. + +* [Compilation Notes](news-8-4-6.html#mysqld-8-4-6-compiling "Compilation Notes") +* [Configuration Notes](news-8-4-6.html#mysqld-8-4-6-configuration "Configuration Notes") +* [InnoDB Notes](news-8-4-6.html#mysqld-8-4-6-innodb "InnoDB Notes") +* [Installation Notes](news-8-4-6.html#mysqld-8-4-6-installation "Installation Notes") +* [Packaging Notes](news-8-4-6.html#mysqld-8-4-6-packaging "Packaging Notes") +* [Functionality Added or Changed](news-8-4-6.html#mysqld-8-4-6-feature "Functionality Added or Changed") +* [Bugs Fixed](news-8-4-6.html#mysqld-8-4-6-bug "Bugs Fixed") + +### Compilation Notes + +* **macOS:** + It is now possible to compile the server on MacOS using + `-DWITH_KERBEROS`. +* **Solaris:** + Clang and GCC now can be used for compiling MySQL on Solaris. + (Bug #30562248) +* Upgraded the bundled `libcurl` library to + version 8.14.1. + (Bug #38042758) +* MySQL Server now supports CMake 4, ensuring compatibility with + future CMake versions where support for versions prior to 3.10 + is expected to be discontinued. + (Bug #38027636) +* The included ICU library has been upgraded to version 77-1. + (Bug #37870791) +* The included `zstd` library has been upgraded + to version 1.5.7. + (Bug #37869972) +* Disabled `clang::musttail` when building with + GCC 15. + (Bug #37776018) +* Worked around an issue with list handling in certain older + versions of CMake. + (Bug #37709169) +* Some compiler features tests did not pass when building with + `-fprofile-use`. + (Bug #37707556) +* The linker tried to use the empty Cmake variable + `${ICU_LIBRARIES}`, even though the correct + library (`ext::icu`) was already linked + elsewhere. + (Bug #36524167) +* On MacOS, silenced deprecation warnings generated by Xcode 14; + this includes suggestions to use `snprintf(3)` + instead of `sprintf(3)`, and warnings about + possible loss of precision when converting from 64-bit to 32-bit + integers. + (Bug #34776172) + +### Configuration Notes + +* **Microsoft Windows:** + An in-place upgrade of MySQL Server using MySQL Configurator failed when + a Windows service name other than the default had been used. + (Bug #37917039) +* **Microsoft Windows:** + When upgrading a server from 8.0 to a higher series, MySQL Configurator + did not persist custom server settings in the + `my.ini` file. + (Bug #37481548) +* **Microsoft Windows:** + When upgrading a MySQL Server using MySQL Configurator, the process hung + in the "Starting the server and upgrading system tables" step if + a custom error log name was used. + (Bug #37463478) + +### InnoDB Notes + +* Fixed an issue relating to importing tables. + (Bug #37621360) + +### Installation Notes + +* Debian packages for installing MySQL can now be run by users + other than root. This helps prevent issues for Debian or Ubuntu + systems that require rootless installations. + (Bug #37765153) +* RPM and Yum repository installation are now supported for Red + Hat Enterprise Linux and Oracle Linux 10. + (Bug #37592019) + +### Packaging Notes + +* On Fedora 24, Oracle MySQL RPMs could not be installed due to + package conflicts when MariaDB was already installed on the + system. With this fix, the conflicts are not properly handled to + allow MySQL Server to be installed successfully. + (Bug #37798784) + +### Functionality Added or Changed + +* **Important Change:** + Added the **mysql** client + [`--commands`](/doc/refman/8.4/en/mysql-command-options.html#option_mysql_commands) option, which enables + or disables most **mysql** client commands. + + This option is enabled by default. To disable it, start the + client with `--commands=OFF` or + [`--skip-commands`](/doc/refman/8.4/en/mysql-command-options.html#option_mysql_commands). + + For a complete list of all commands affected by this option, and + additional information, see + [mysql Client Options](/doc/refman/8.4/en/mysql-command-options.html). + (WL #16949) + + References: See also: Bug #36416568, Bug #38066040. +* **Group Replication:** + Added the error + [`ER_GRP_RPL_APPLIER_THD_KILLED`](/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_grp_rpl_applier_thd_killed), + to distinguish when the applier thread has been terminated using + SQL KILL, rather than stopped by an error. + (Bug #37764717) +* Binary packages that include `curl` rather than + linking to the system `curl` library have been + upgraded to use `curl` 8.14.1. + (Bug #37389565) + +### Bugs Fixed + +* **Important Note; Group Replication:** + The Group Communication System (GCS) handles Group Replication + communication between members, and keeps track of the group + membership and connections between all group members. Membership + tracking includes the membership's current and previous two + iterations. When a member leaves, the remaining members in the + group keep a record of the departing member but stop + communicating with it until it returns. For example: The group + contains members M1, M2, and M3. M3 leaves the group; M1 and M2 + stop communicating with M3. When a new member (M4) joins, it + learns the previous iterations of this group's membership + and attempts to communicate with all servers, including those + from previous iterations (in this case, M3). + + In the event that some previous servers were gone and did not + return, the new member continuously tried to connect to the + missing servers; in some conditions, these ongoing connection + attempts could introduce network latency affecting group member + communication. + + In order to avoid this issue, connections to servers that belong + to iterations of the group membership are now stopped after 5 + minutes, which should be sufficient time to re-establish valid + connections without imposing a continuing impact on group + communication. + (Bug #37704514) +* **Performance:** + Redundant conditions in some queries optimized away in MySQL 8.0 + were no longer removed in later versions, leading to a + significant drop in the performance of such queries. + (Bug #117907, Bug #37808260) + + References: This issue is a regression of: Bug #30112096. +* **NDB Cluster:** + Following an upgrade from NDB 8.0 to NDB 8.4, all data nodes in + the cluster underwent an unexpected simultaneous restart. This + occurred when the transaction coordinator had no scan state, + leading to protocol timeout; the resulting misalignment in + protocol states caused data nodes to shut down unexpectedly. + This is fixed by extending existing handling of an unexpected + `SCAN_NEXTREQ` signal to cover the case when + the scan is already stateless. + (Bug #37994985) + + References: This issue is a regression of: Bug #37022901. +* **NDB Cluster:** + Concurrent [`ALTER TABLE`](/doc/refman/8.4/en/alter-table.html) statements + could cause delays of up to 100 \* + `TransactionDeadlockDetectionTimeout` + before failing with a lock wait timeout when a client held a + conflicting row lock, stalling the accompanying + `get_commit_count()` call. The retry mechanism + has been adjusted to identify locking issues sooner. + (Bug #37955025) +* **InnoDB:** + When rebuilding a primary key, the server sometimes encountered + issues when duplicates were present, potentially leading to the + server stopping unexpectedly. + + Our thanks to Xizhe Zhang and the team at Alibaba for the + contribution. + (Bug #37822992) +* **InnoDB:** + Fixed an issue relating to dropping columns that were part of an + index. + (Bug #37726881) +* **InnoDB:** + MySQL Community Edition binaries included unnecessary OpenTelemetry symbols, due + to unprotected static arrays. + (Bug #37689163) +* **InnoDB:** + The double write buffer was unnecessarily large. When + calculating the number of segments per file, one extra segment + was always added, whereas an extra segment should be added only + if the number of `Double_write` instances is + not divisible by the number of `dblwr` files. + (Bug #37684656) +* **InnoDB:** + Fixed an issue relating to DELETE operations. + (Bug #37478594) +* **InnoDB:** + Creating a secondary index on a + [`VARCHAR`](/doc/refman/8.4/en/char.html) column could allocate + more memory than configured, with the amount allocated being + directly related to the value of + [`innodb_ddl_buffer_size`](/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_ddl_buffer_size), leading + to errors similar to ERROR 1136 (21S01): Column count + doesn't match value count at row 1. + (Bug #37233273) +* **InnoDB:** + Fixed an issue relating to indexing spatial datatype columns. + (Bug #36682518) +* **InnoDB:** + The `temptable` handler did not terminate + cleanly during server shutdown, potentially causing the server + to terminate unexpectedly. This issue has been addressed by + implementing a mechanism to track and properly clean up + temptable objects associated with each thread. + (Bug #36538081) +* **InnoDB:** + A long semaphore wait crash could occur when a redo log consumer + lagged behind after a failed MySQL Enterprise Backup incremental backup, + preventing the redo log writer thread from advancing. Error + messages were returned similar to the following: + + ```None + [Warning] [MY-013934] [InnoDB] Redo log writer is waiting for MEB redo + log consumer which is currently reading LSN=23335640211468 preventing + reclamation of subsequent portion of the redo log. Consider + increasing innodb_redo_log_capacity. + ``` + + (Bug #36330455) +* **InnoDB:** + Fixed an issue relating to range queries on tables. + (Bug #31360522) + + References: See also: Bug #38063122. +* **Partitioning:** + Truncating a partition was rejected with a duplicate entry error + when the partition ID exceeded `INT_MAX`, + preventing creation of new partitioned tables. To mitigate this + issue, the `Table_partition_values_pk` class + constructor now uses `ulonglong` instead of + `int` for the object ID. + (Bug #35912852) +* **Replication:** + When using replication in a chain, + [`CREATE + TABLE ... AS SELECT`](/doc/refman/8.4/en/create-table-select.html) sometimes resulted in inconsistent + entries in the binary log, potentially causing replication to + break on downstream servers. Error messages related to this + issue included errors resulting from missing + [`START + TRANSACTION`](/doc/refman/8.4/en/commit.html) statements in the log. + (Bug #37986380) +* **Replication:** + During semisync replication, when the length of the binary log + suffix exceeded six digits (`.999999`), so + that the next log file became—for + example—`mysql-bin.1000000`, the + replication protocol unexpectedly changed from semisynchronous + to asynchronous. + + Our thanks to Wuhao Cao and Karry Zhang and the team at Alibaba + for the contribution. + (Bug #115861, Bug #113813, Bug #37024069, Bug #36246779) +* **Group Replication:** + The + [`Gr_empty_consensus_proposals_count`](/doc/refman/8.4/en/group-replication-status-variables.html#statvar_Gr_empty_consensus_proposals_count) + system status variable was not updated as expected. + (Bug #37937927) +* **Group Replication:** + In an unstable network environment, a Group Replication + InnoDB Cluster with + [`group_replication_paxos_single_leader=ON`](/doc/refman/8.4/en/group-replication-system-variables.html#sysvar_group_replication_paxos_single_leader) + experienced several long-running transactions that became stuck + in the `waiting for handler commit` state. As a + consequence, + [`group_replication_set_as_primary()`](/doc/refman/8.4/en/group-replication-functions-for-new-primary.html#function_group-replication-set-as-primary) + was forced to wait, which in turn blocked other incoming queries + and rendered the cluster unwritable. + + The issue involving long-running transactions stuck in + `waiting for handler commit` occurred as + follows: During an intermittent network partition, a secondary + node incorrectly assumed the leader role due to outdated or + inaccurate membership information. This resulted in conflicts in + synode number allocation, causing transactions originating from + the primary node to remain incomplete. + + We fix this by making sure that a secondary node always reflect + the latest, accurate state before pushing the view message to + Paxos. This ensures that outdated or inconsistent membership + information does not lead to conflicts in leadership or synode + number allocation. + (Bug #37764970) + + References: See also: Bug #117424, Bug #37237959, Bug #37645674. +* **NDB Cluster APIs:** + Excluding a [`VARCHAR`](/doc/refman/8.4/en/char.html) column from + an event definition resulted in an Invalid schema + object version error. + (Bug #37766391) + + References: See also: Bug #31848270. +* RPM installations on Fedora 24 could not be completed because + conflicting packages were pulled from upstream. This fix adds + the proper obsoletes to block the conflicting packages. + (Bug #37976913) +* Some triggers which called stored routines did not always + execute correctly. + (Bug #37915445) +* A view using a CTE which contained a subquery was not always + handled correctly. + (Bug #37832605) +* Installing Oracle packages for MySQL on an Ubuntu 25.04 system + was not possible where MySQL was already installed using the + system's APT repositories. + (Bug #37804480) +* Improved a previous fix for an issue in which client connections + were not always terminated correctly during shutdown. + (Bug #37755594) + + References: This issue is a regression of: Bug #35854919. +* The Fedora 42 RPM installation packages have been adapted to + accommodate the merged `/usr/bin` and + `/usr/sbin` directories in Fedora 42 and + later. + (Bug #37737658) +* Performance of fulltext searches using + `InnoDB`, particularly for phrase searches, has + been improved. The efficiency of `doc_id` + matching has been enhanced. + (Bug #37682648) +* Queries against the + [`performance_schema.keyring_keys`](/doc/refman/8.4/en/performance-schema-keyring-keys-table.html) + table caused issues when the `keyring_okv` + plugin (see [Using the keyring\_okv KMIP Plugin](/doc/refman/8.4/en/keyring-okv-plugin.html)) was installed + but not configured correctly. + (Bug #37655299) +* The fix for Bug #30875669 was not actually included in the code + for the **mysql** client when the bug was closed. + The changes are now implemented. + (Bug #37572191) + + References: See also: Bug #30875669. +* An init file having one or more single lines, each containing + multiple SQL statements, sometimes gave rise to errors during + initialization. + (Bug #37559598) +* Some sequences of [`CREATE TABLE`](/doc/refman/8.4/en/create-table.html) + and [`DROP TABLE`](/doc/refman/8.4/en/drop-table.html) statements were + not handled correctly. + (Bug #37534068) + + References: This issue is a regression of: Bug #35721121. +* [`UPDATE ... SET + ...`](/doc/refman/8.4/en/update.html) could not always be rolled back successfully. + (Bug #37489167) +* Multiple `DEFAULT` column expressions in + [`CREATE TABLE`](/doc/refman/8.4/en/create-table.html) statements were not + always handled correctly. + (Bug #37436220) +* Queries having a correlated subquery which performed aggregation + were sometimes (incorrectly) rejected with duplicate key errors + during execution. + + This issue was introduced by a previous fix which removed the + restoration of the original reference slice + (`set_ref_item_slice(REF_SLICE_SAVED_BASE)`) + during `JOIN::cleanup()` execution under the + assumption that this was not necessary. As a result, temporary + table field references from previous executions were not + cleared, leading to attempts to insert duplicate keys into + temporary tables triggering the error Can't write; + duplicate key in table. + + We fix this by restoring the original reference slice during + cleanup, ensuring that any stale references are discarded. + (Bug #37415167) + + References: See also: Bug #32141711. This issue is a regression of: Bug #35856247. +* Unquoted semicolon characters (`;`) within + comments were not always flagged as errors, in spite of the fact + that they are not allowed. + (Bug #37117875) + + References: See also: Bug #38063286. +* A query using a nested aggregate function which contained a + subquery was not always properly handled. + (Bug #36421727) +* When attempting to transform a subquery to a derived table, + certain cases were not always considered. + (Bug #36421710) + + References: This issue is a regression of: Bug #36921175. +* With [`optimizer_switch`](/doc/refman/8.4/en/server-system-variables.html#sysvar_optimizer_switch) set to + [`subquery_to_derived=on`](/doc/refman/8.4/en/switchable-optimizations.html#optflag_subquery-to-derived), some + queries with `ROLLUP` were not handled + properly. + (Bug #36314993) +* Setting [`max_join_size`](/doc/refman/8.4/en/server-system-variables.html#sysvar_max_join_size) led to + improper processing of some nested queries. + (Bug #35625769) +* The transform of a scalar subquery into a join with a derived + table where the subquery is in the + [`SELECT`](/doc/refman/8.4/en/select.html) list and the containing + query is implicitly grouped should be allowed, but was rejected + when the [`subquery_to_derived`](/doc/refman/8.4/en/switchable-optimizations.html#optflag_subquery-to-derived) + optimizer switch was enabled. + (Bug #35150438) +* An error in `include/assert_grep.inc` could + lead to erroneous results from any file that included it. + + Out thanks to Ke Yu for the contribution. + (Bug #116239, Bug #37105430, Bug #37675340) +* The query rewrite plugin (see + [The Rewriter Query Rewrite Plugin](/doc/refman/8.4/en/rewriter-query-rewrite-plugin.html)) did not work + properly when the server was run with + [`autocommit=OFF`](/doc/refman/8.4/en/server-system-variables.html#sysvar_autocommit). + (Bug #115437, Bug #36784795) diff --git a/corpus/changelog/mysql_releases/mysql_847.md b/corpus/changelog/mysql_releases/mysql_847.md new file mode 100644 index 0000000000000000000000000000000000000000..f7c25d87cc80658453c4796e6eaa3bde5fc21c40 --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_847.md @@ -0,0 +1,155 @@ +# MySQL 8.4.7 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.4/en/news-8-4-7.html +Version: 8.4.7 + +## Changes in MySQL 8.4.7 (2025-10-21, LTS Release) + +Note + +These release notes were created with the assistance of +MySQL HeatWave GenAI. + +* [Audit Log Notes](news-8-4-7.html#mysqld-8-4-7-audit-log "Audit Log Notes") +* [Compilation Notes](news-8-4-7.html#mysqld-8-4-7-compiling "Compilation Notes") +* [SQL Function and Operator Notes](news-8-4-7.html#mysqld-8-4-7-functions-operators "SQL Function and Operator Notes") +* [InnoDB Notes](news-8-4-7.html#mysqld-8-4-7-innodb "InnoDB Notes") +* [Optimizer Notes](news-8-4-7.html#mysqld-8-4-7-optimizer "Optimizer Notes") +* [Packaging Notes](news-8-4-7.html#mysqld-8-4-7-packaging "Packaging Notes") +* [Performance Schema Notes](news-8-4-7.html#mysqld-8-4-7-performance-schema "Performance Schema Notes") +* [Bugs Fixed](news-8-4-7.html#mysqld-8-4-7-bug "Bugs Fixed") + +### Audit Log Notes + +* Fixed an issue related to audit log strategy. + (Bug #38223011) +* Improved performance related to adding multiple + `general_sql_command.str` fields to an + Enterprise Audit filter. + (Bug #38053242) +* Fixed an issue related to `audit_log_read` + performance. + (Bug #36281295, Bug #38275868) + +### Compilation Notes + +* OpenSSL 3 is now used on Solaris. + (Bug #38193362) +* Upgraded the bundled googletest library to version 1.17. + (Bug #38152017) +* Upgraded the bundled libbacktrace library to the latest version + (April 2025). + (Bug #38151970) +* Warnings raised by Clang 20 for non-trivially copyable types, + deprecated literal operators, and incorrect + `main` function declarations are no longer + generated. + (Bug #37785251) + +### SQL Function and Operator Notes + +* Fixed an issue related to executing certain UPDATE statements. + (Bug #37590580) + + References: This issue is a regression of: Bug #31562881. + +### InnoDB Notes + +* Creating a thread for parallel scan may fail, resulting in + assertion failures when it fell back to single-thread mode. + Errors were returned similar to the following: + + ```None + Assertion failure: row0pread.h:306:active >= n_threads + ``` + + (Bug #38325137) +* Under certain circumstances, a virtual index rollback could fail + on 32-bit builds of MySQL Server. + (Bug #38167527) +* If the buffer pool was very large, it could lead to a large + number of chunks required by each buffer pool instance, which + could fail if the operating system was unable to allocate the + required memory. + + As of this release, this allocation is checked to ensure it is + allocated correctly. + (Bug #37994397) +* Users could encounter an assertion failure due to a data size + and bounds mismatch. Errors were returned similar to the + following: + + ```None + Assertion failure: ddl0file-reader.cc:193:m_ptr + data_size < + m_bounds.second + ``` + + (Bug #37882398) + + References: This issue is a regression of: Bug #37233273. +* Fixed an issue relating to modifying the internal FTS + configuration. + (Bug #37792010) +* Fixed an issue related to virtual indexes. + (Bug #37602657) +* If the row size exceeded the maximum allowed size due to + `innodb_strict_mode=OFF`, confusing warning + messages similar to "Cannot add field" could appear in certain + situations, such as selecting from a table or dropping a column. + + Error messages are improved for this scenario. + (Bug #37003342, Bug #36768046, Bug #36867372) + +### Optimizer Notes + +* Fixed an issue relating to SQL queries involving correlated + scalar subqueries and JSON tables. + (Bug #36684370) + +### Packaging Notes + +* For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 3.0.17. For more information, see + [OpenSSL + 3.0 Series Release Notes](https://github.com/openssl/openssl/blob/openssl-3.0/CHANGES.md). + (Bug #38457056) +* MySQL Server RPM installation on Fedora 42 could fail due to + conflicts with MariaDB 11.8 packages. Errors were returned + similar to the following: + + ```None + file /usr/bin/mysqld conflicts between mysql-community-server-8.4.7 + and mariadb11.8-server-3:11.8.3, file + /usr/share/man/man1/mysql.1.gz conflicts between mysql-community- + client-8.4.7 and mariadb11.8, file + /usr/lib/systemd/system/mysqld.service conflicts between mysql- + community-server-8.4.7 and mariadb11.8-server + ``` + + (Bug #38384844) +* The RPM specification and DEB control files were missing several + requirements, making it impossible to build those formats. + (Bug #38310603) + +### Performance Schema Notes + +* Connections waiting on the connection control plugin were not + displayed in the + `performance_schema.processlist` table. + (Bug #38043683) + +### Bugs Fixed + +* Logical clock handling for `CREATE ... SELECT` + statements has been improved to ensure accurate logical clock + values in the replica relay log. + (Bug #38383106) +* The server sometimes processed table references incorrectly. + (Bug #38001000) +* `PARTITION BY ... (DEFAULT + (column))` was not always + handled correctly. + (Bug #111234, Bug #35451459) + + References: This issue is a regression of: Bug #33142135. diff --git a/corpus/changelog/mysql_releases/mysql_848.md b/corpus/changelog/mysql_releases/mysql_848.md new file mode 100644 index 0000000000000000000000000000000000000000..cfcfed9d3f5acfb4a465d2c2c2c8c588e1b37d8d --- /dev/null +++ b/corpus/changelog/mysql_releases/mysql_848.md @@ -0,0 +1,140 @@ +# MySQL 8.4.8 Release Notes + +Source: https://dev.mysql.com/doc/relnotes/mysql/8.4/en/news-8-4-8.html +Version: 8.4.8 + +## Changes in MySQL 8.4.8 (2026-01-20, LTS Release) + +Note + +These release notes were created with the assistance of +MySQL HeatWave GenAI. + +* [Compilation Notes](news-8-4-8.html#mysqld-8-4-8-compiling "Compilation Notes") +* [Configuration Notes](news-8-4-8.html#mysqld-8-4-8-configuration "Configuration Notes") +* [InnoDB Notes](news-8-4-8.html#mysqld-8-4-8-innodb "InnoDB Notes") +* [Optimizer Notes](news-8-4-8.html#mysqld-8-4-8-optimizer "Optimizer Notes") +* [Packaging Notes](news-8-4-8.html#mysqld-8-4-8-packaging "Packaging Notes") +* [Pluggable Authentication](news-8-4-8.html#mysqld-8-4-8-pluggable-auth "Pluggable Authentication") +* [Security Notes](news-8-4-8.html#mysqld-8-4-8-security "Security Notes") +* [Bugs Fixed](news-8-4-8.html#mysqld-8-4-8-bug "Bugs Fixed") + +### Compilation Notes + +* The cmake macro `MYSQL_CHECK_PROTOBUF` did not + properly handle multiple calls when using system protobuf. + Errors were returned similar to the following: + + ```None + ADD_LIBRARY cannot create imported target + "ext::libprotobuf" because another target with the same + name already exists. + ``` + + (Bug #38417986) + +### Configuration Notes + +* The `mysqlx_port` server variable was not + persisted in the `my.ini` file when set through + the Type and Networking configuration page. + (Bug #38728671) + +### InnoDB Notes + +* **InnoDB:** + InnoDB redo logging error messages now include the current LSN + and redo log capacity information. A new warning code + [`ER_IB_WRN_REDO_DISABLED_INFO`](/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_ib_wrn_redo_disabled_info) is + added which includes the current LSN. A new error code + `ER_IB_MSG_LOG_WRITER_WAIT_ON_NEW_LOG_FILE_INFO` + is added to include the current log capacity and the current log + capacity used. The `MONITOR` output has been + enhanced to include redo log capacity details and current log + capacity. + + The warning `ER_IB_WRN_REDO_DISABLED` was + removed, as was the error + `ER_IB_MSG_LOG_WRITER_WAIT_ON_NEW_LOG_FILE`. + (Bug #37645185) +* Fixed an issue related to bulk inserts. + (Bug #38208188) + +### Optimizer Notes + +* Fixed an issue relating to Common Table Expressions (CTE). + (Bug #38573285) +* Fixed an issue related to executing specific SQL queries. + (Bug #38448700) +* Fixed an issue relating to `SHOW CREATE TABLE`. + (Bug #38298692) +* Queries which used REGEXP took longer to execute as prepared + statements than as direct queries. + (Bug #114056, Bug #36326728) + +### Packaging Notes + +* For platforms on which OpenSSL libraries are bundled, the linked + OpenSSL library for MySQL Server has been updated to version + 3.0.18. For more information, see + [OpenSSL + 3.0 Series Release Notes](https://github.com/openssl/openssl/blob/openssl-3.0/CHANGES.md). + (Bug #38632932) + +### Pluggable Authentication + +* Connecting to a MySQL server with a non-existing user now + consistently returns an "Access denied for user" error + message, regardless of the username length or MySQL version. + Previously, errors were returned similar to the following: + + ```None + ERROR 1045 (28000): Access denied for user + 'foo'@'localhost' (using password: NO), ERROR + 1524 (HY000): Plugin 'mysql_native_password' is not + loaded + ``` + + (Bug #36527984) + +### Security Notes + +* Fixed an issue relating to authentication. + (Bug #118447, Bug #38077617) + +### Bugs Fixed + +* **InnoDB:** + Under certain circumstances, when using the + `que_eval_sql` interface, a race condition + could occur. + (Bug #118705, Bug #38310595) +* Running SET PERSIST on a system variable after an upgrade can + result in duplicate variable entries across different sections + in `mysqld-auto.cnf`. + (Bug #38680162) +* Binary log purged before persisted + `binlog_expire_*` options were loaded. + (Bug #38554467) +* When 2 of 6 instances in a geographically dispersed + InnoDB Cluster lost connectivity, the primary server became + unresponsive, causing the `COMMIT` and + `INSERT` operations to become unresponsive as + well. + (Bug #38380392) +* **mysqldump**'s + `--order-by-primary` option sorted data by + every index on the table, instead of just sorting by the primary + key. + (Bug #38284832) +* Fixed several issues relating to Thread Pool blocking + connections from closing. + (Bug #38170188, Bug #36782728, Bug #38549372) +* GTID gaps were generated because of the `replica- + skip-errors` option. + (Bug #28590993) +* If server was started on Windows platforms with + --skip-grant-tables, privileges were not checked and remote + connections were not permitted. As a result, the server might + not start. + (Bug #118805, Bug #38328780) diff --git a/corpus/changelog/numpy_releases/numpy_200.md b/corpus/changelog/numpy_releases/numpy_200.md new file mode 100644 index 0000000000000000000000000000000000000000..541157660c0df9a15edd958f2bf157340ea13c17 --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_200.md @@ -0,0 +1,1322 @@ +# NumPy 2.0.0 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.0.0-notes.html +Version: 2.0.0 + +NumPy 2.0.0 is the first major release since 2006. It is the result of 11 +months of development since the last feature release and is the work of 212 +contributors spread over 1078 pull requests. It contains a large number of +exciting new features as well as changes to both the Python and C APIs. + +This major release includes breaking changes that could not happen in a regular +minor (feature) release - including an ABI break, changes to type promotion +rules, and API changes which may not have been emitting deprecation warnings +in 1.26.x. Key documents related to how to adapt to changes in NumPy 2.0, in +addition to these release notes, include: + +* The [NumPy 2.0 migration guide](../numpy_2_0_migration_guide.html#numpy-2-migration-guide) +* The [NumPy 2.0-specific advice](../dev/depending_on_numpy.html#numpy-2-abi-handling) in + [For downstream package authors](../dev/depending_on_numpy.html#for-downstream-package-authors) + +## Highlights[#](#highlights "Link to this heading") + +Highlights of this release include: + +* New features: + + + A new variable-length string dtype, [`StringDType`](../reference/routines.dtypes.html#numpy.dtypes.StringDType "numpy.dtypes.StringDType") and a new + [`numpy.strings`](../reference/routines.strings.html#module-numpy.strings "numpy.strings") namespace with performant ufuncs for string operations, + + Support for `float32` and `longdouble` in all [`numpy.fft`](../reference/routines.fft.html#module-numpy.fft "numpy.fft") functions, + + Support for the array API standard in the main `numpy` namespace. +* Performance improvements: + + + Sorting functions ([`sort`](../reference/generated/numpy.sort.html#numpy.sort "numpy.sort"), [`argsort`](../reference/generated/numpy.argsort.html#numpy.argsort "numpy.argsort"), [`partition`](../reference/generated/numpy.partition.html#numpy.partition "numpy.partition"), [`argpartition`](../reference/generated/numpy.argpartition.html#numpy.argpartition "numpy.argpartition")) + have been accelerated through the use of the Intel x86-simd-sort and Google + Highway libraries, and may see large (hardware-specific) speedups, + + macOS Accelerate support and binary wheels for macOS >=14, with significant + performance improvements for linear algebra operations on macOS, and wheels + that are about 3 times smaller, + + [`numpy.char`](../reference/routines.char.html#module-numpy.char "numpy.char") fixed-length string operations have been accelerated by + implementing ufuncs that also support [`StringDType`](../reference/routines.dtypes.html#numpy.dtypes.StringDType "numpy.dtypes.StringDType") in + addition to the fixed-length string dtypes, + + A new tracing and introspection API, [`opt_func_info`](../reference/generated/numpy.lib.introspect.opt_func_info.html#numpy.lib.introspect.opt_func_info "numpy.lib.introspect.opt_func_info"), + to determine which hardware-specific kernels are available and will be + dispatched to. + + [`numpy.save`](../reference/generated/numpy.save.html#numpy.save "numpy.save") now uses pickle protocol version 4 for saving arrays with + object dtype, which allows for pickle objects larger than 4GB and improves + saving speed by about 5% for large arrays. +* Python API improvements: + + + A clear split between public and private API, with a new + [module structure](../reference/module_structure.html#module-structure), and each public function now + available in a single place, + + Many removals of non-recommended functions and aliases. This should make + it easier to learn and use NumPy. The number of objects in the main + namespace decreased by ~10% and in `numpy.lib` by ~80%, + + [Canonical dtype names](../user/basics.types.html#canonical-python-and-c-types) and a new + [`isdtype`](../reference/generated/numpy.isdtype.html#numpy.isdtype "numpy.isdtype") introspection function, +* C API improvements: + + + A new [public C API for creating custom dtypes](../reference/c-api/array.html#dtype-api), + + Many outdated functions and macros removed, and private internals hidden to + ease future extensibility, + + New, easier to use, initialization functions: + [`PyArray_ImportNumPyAPI`](../reference/c-api/array.html#c.PyArray_ImportNumPyAPI "PyArray_ImportNumPyAPI") and [`PyUFunc_ImportUFuncAPI`](../reference/c-api/ufunc.html#c.PyUFunc_ImportUFuncAPI "PyUFunc_ImportUFuncAPI"). +* Improved behavior: + + + Improvements to type promotion behavior was changed by adopting [NEP + 50](https://numpy.org/neps/nep-0050-scalar-promotion.html#nep50 "(in NumPy Enhancement Proposals)"). This fixes many user surprises about promotions which + previously often depended on data values of input arrays rather than only + their dtypes. Please see the NEP and the [NumPy 2.0 migration guide](../numpy_2_0_migration_guide.html#numpy-2-migration-guide) + for details as this change can lead to changes in output dtypes and lower + precision results for mixed-dtype operations. + + The default integer type on Windows is now `int64` rather than `int32`, + matching the behavior on other platforms, + + The maximum number of array dimensions is changed from 32 to 64 +* Documentation: + + + The reference guide navigation was significantly improved, and there is now + documentation on NumPy’s [module structure](../reference/module_structure.html#module-structure), + + The [building from source](../building/index.html#building-from-source) documentation was + completely rewritten, + +Furthermore there are many changes to NumPy internals, including continuing to +migrate code from C to C++, that will make it easier to improve and maintain +NumPy in the future. + +The “no free lunch” theorem dictates that there is a price to pay for all these +API and behavior improvements and better future extensibility. This price is: + +1. Backwards compatibility. There are a significant number of breaking changes + to both the Python and C APIs. In the majority of cases, there are clear + error messages that will inform the user how to adapt their code. However, + there are also changes in behavior for which it was not possible to give + such an error message - these cases are all covered in the Deprecation and + Compatibility sections below, and in the [NumPy 2.0 migration guide](../numpy_2_0_migration_guide.html#numpy-2-migration-guide). + + Note that there is a `ruff` mode to auto-fix many things in Python code. +2. Breaking changes to the NumPy ABI. As a result, binaries of packages that + use the NumPy C API and were built against a NumPy 1.xx release will not + work with NumPy 2.0. On import, such packages will see an `ImportError` + with a message about binary incompatibility. + + It is possible to build binaries against NumPy 2.0 that will work at runtime + with both NumPy 2.0 and 1.x. See [NumPy 2.0-specific advice](../dev/depending_on_numpy.html#numpy-2-abi-handling) for more details. + + **All downstream packages that depend on the NumPy ABI are advised to do a + new release built against NumPy 2.0 and verify that that release works with + both 2.0 and 1.26 - ideally in the period between 2.0.0rc1 (which will be + ABI-stable) and the final 2.0.0 release to avoid problems for their users.** + +The Python versions supported by this release are 3.9-3.12. + +## NumPy 2.0 Python API removals[#](#numpy-2-0-python-api-removals "Link to this heading") + +* `np.geterrobj`, `np.seterrobj` and the related ufunc keyword argument + `extobj=` have been removed. The preferred replacement for all of these + is using the context manager `with np.errstate():`. + + ([gh-23922](https://github.com/numpy/numpy/pull/23922)) +* `np.cast` has been removed. The literal replacement for + `np.cast[dtype](arg)` is `np.asarray(arg, dtype=dtype)`. +* `np.source` has been removed. The preferred replacement is + `inspect.getsource`. +* `np.lookfor` has been removed. + + ([gh-24144](https://github.com/numpy/numpy/pull/24144)) +* `numpy.who` has been removed. As an alternative for the removed functionality, one + can use a variable explorer that is available in IDEs such as Spyder or Jupyter Notebook. + + ([gh-24321](https://github.com/numpy/numpy/pull/24321)) +* Warnings and exceptions present in [`numpy.exceptions`](../reference/routines.exceptions.html#module-numpy.exceptions "numpy.exceptions") (e.g, + [`ComplexWarning`](../reference/generated/numpy.exceptions.ComplexWarning.html#numpy.exceptions.ComplexWarning "numpy.exceptions.ComplexWarning"), + [`VisibleDeprecationWarning`](../reference/generated/numpy.exceptions.VisibleDeprecationWarning.html#numpy.exceptions.VisibleDeprecationWarning "numpy.exceptions.VisibleDeprecationWarning")) are no longer exposed in the + main namespace. +* Multiple niche enums, expired members and functions have been removed from + the main namespace, such as: `ERR_*`, `SHIFT_*`, `np.fastCopyAndTranspose`, + `np.kernel_version`, `np.numarray`, `np.oldnumeric` and `np.set_numeric_ops`. + + ([gh-24316](https://github.com/numpy/numpy/pull/24316)) +* Replaced `from ... import *` in the `numpy/__init__.py` with explicit imports. + As a result, these main namespace members got removed: `np.FLOATING_POINT_SUPPORT`, + `np.FPE_*`, `np.NINF`, `np.PINF`, `np.NZERO`, `np.PZERO`, `np.CLIP`, + `np.WRAP`, `np.WRAP`, `np.RAISE`, `np.BUFSIZE`, `np.UFUNC_BUFSIZE_DEFAULT`, + `np.UFUNC_PYVALS_NAME`, `np.ALLOW_THREADS`, `np.MAXDIMS`, `np.MAY_SHARE_EXACT`, + `np.MAY_SHARE_BOUNDS`, `add_newdoc`, `np.add_docstring` and + `np.add_newdoc_ufunc`. + + ([gh-24357](https://github.com/numpy/numpy/pull/24357)) +* Alias `np.float_` has been removed. Use `np.float64` instead. +* Alias `np.complex_` has been removed. Use `np.complex128` instead. +* Alias `np.longfloat` has been removed. Use `np.longdouble` instead. +* Alias `np.singlecomplex` has been removed. Use `np.complex64` instead. +* Alias `np.cfloat` has been removed. Use `np.complex128` instead. +* Alias `np.longcomplex` has been removed. Use `np.clongdouble` instead. +* Alias `np.clongfloat` has been removed. Use `np.clongdouble` instead. +* Alias `np.string_` has been removed. Use `np.bytes_` instead. +* Alias `np.unicode_` has been removed. Use `np.str_` instead. +* Alias `np.Inf` has been removed. Use `np.inf` instead. +* Alias `np.Infinity` has been removed. Use `np.inf` instead. +* Alias `np.NaN` has been removed. Use `np.nan` instead. +* Alias `np.infty` has been removed. Use `np.inf` instead. +* Alias `np.mat` has been removed. Use `np.asmatrix` instead. +* `np.issubclass_` has been removed. Use the `issubclass` builtin instead. +* `np.asfarray` has been removed. Use `np.asarray` with a proper dtype instead. +* `np.set_string_function` has been removed. Use `np.set_printoptions` + instead with a formatter for custom printing of NumPy objects. +* `np.tracemalloc_domain` is now only available from `np.lib`. +* `np.recfromcsv` and `np.recfromtxt` were removed from the main namespace. + Use `np.genfromtxt` with comma delimiter instead. +* `np.issctype`, `np.maximum_sctype`, `np.obj2sctype`, `np.sctype2char`, + `np.sctypes`, `np.issubsctype` were all removed from the + main namespace without replacement, as they where niche members. +* Deprecated `np.deprecate` and `np.deprecate_with_doc` has been removed + from the main namespace. Use `DeprecationWarning` instead. +* Deprecated `np.safe_eval` has been removed from the main namespace. + Use `ast.literal_eval` instead. + + ([gh-24376](https://github.com/numpy/numpy/pull/24376)) +* `np.find_common_type` has been removed. Use `numpy.promote_types` or + `numpy.result_type` instead. To achieve semantics for the `scalar_types` + argument, use `numpy.result_type` and pass `0`, `0.0`, or `0j` as a + Python scalar instead. +* `np.round_` has been removed. Use `np.round` instead. +* `np.nbytes` has been removed. Use `np.dtype().itemsize` instead. + + ([gh-24477](https://github.com/numpy/numpy/pull/24477)) +* `np.compare_chararrays` has been removed from the main namespace. + Use `np.char.compare_chararrays` instead. +* The `charrarray` in the main namespace has been deprecated. It can be imported + without a deprecation warning from `np.char.chararray` for now, + but we are planning to fully deprecate and remove `chararray` in the future. +* `np.format_parser` has been removed from the main namespace. + Use `np.rec.format_parser` instead. + + ([gh-24587](https://github.com/numpy/numpy/pull/24587)) +* Support for seven data type string aliases has been removed from `np.dtype`: + `int0`, `uint0`, `void0`, `object0`, `str0`, `bytes0` and `bool8`. + + ([gh-24807](https://github.com/numpy/numpy/pull/24807)) +* The experimental `numpy.array_api` submodule has been removed. Use the main + `numpy` namespace for regular usage instead, or the separate + `array-api-strict` package for the compliance testing use case for which + `numpy.array_api` was mostly used. + + ([gh-25911](https://github.com/numpy/numpy/pull/25911)) + +### `__array_prepare__` is removed[#](#array-prepare-is-removed "Link to this heading") + +UFuncs called `__array_prepare__` before running computations +for normal ufunc calls (not generalized ufuncs, reductions, etc.). +The function was also called instead of `__array_wrap__` on the +results of some linear algebra functions. + +It is now removed. If you use it, migrate to `__array_ufunc__` or rely on +`__array_wrap__` which is called with a context in all cases, although only +after the result array is filled. In those code paths, `__array_wrap__` will +now be passed a base class, rather than a subclass array. + +([gh-25105](https://github.com/numpy/numpy/pull/25105)) + +## Deprecations[#](#deprecations "Link to this heading") + +* `np.compat` has been deprecated, as Python 2 is no longer supported. +* `numpy.int8` and similar classes will no longer support conversion of + out of bounds python integers to integer arrays. For example, + conversion of 255 to int8 will not return -1. + `numpy.iinfo(dtype)` can be used to check the machine limits for data types. + For example, `np.iinfo(np.uint16)` returns min = 0 and max = 65535. + + `np.array(value).astype(dtype)` will give the desired result. +* `np.safe_eval` has been deprecated. `ast.literal_eval` should be used instead. + + ([gh-23830](https://github.com/numpy/numpy/pull/23830)) +* `np.recfromcsv`, `np.recfromtxt`, `np.disp`, `np.get_array_wrap`, + `np.maximum_sctype`, `np.deprecate` and `np.deprecate_with_doc` + have been deprecated. + + ([gh-24154](https://github.com/numpy/numpy/pull/24154)) +* `np.trapz` has been deprecated. Use `np.trapezoid` or a `scipy.integrate` function instead. +* `np.in1d` has been deprecated. Use `np.isin` instead. +* Alias `np.row_stack` has been deprecated. Use `np.vstack` directly. + + ([gh-24445](https://github.com/numpy/numpy/pull/24445)) +* `__array_wrap__` is now passed `arr, context, return_scalar` and + support for implementations not accepting all three are deprecated. Its signature + should be `__array_wrap__(self, arr, context=None, return_scalar=False)` + + ([gh-25409](https://github.com/numpy/numpy/pull/25409)) +* Arrays of 2-dimensional vectors for `np.cross` have been deprecated. Use + arrays of 3-dimensional vectors instead. + + ([gh-24818](https://github.com/numpy/numpy/pull/24818)) +* `np.dtype("a")` alias for `np.dtype(np.bytes_)` was deprecated. Use + `np.dtype("S")` alias instead. + + ([gh-24854](https://github.com/numpy/numpy/pull/24854)) +* Use of keyword arguments `x` and `y` with functions + `assert_array_equal` and `assert_array_almost_equal` has been deprecated. + Pass the first two arguments as positional arguments instead. + + ([gh-24978](https://github.com/numpy/numpy/pull/24978)) + +### `numpy.fft` deprecations for n-D transforms with None values in arguments[#](#numpy-fft-deprecations-for-n-d-transforms-with-none-values-in-arguments "Link to this heading") + +Using `fftn`, `ifftn`, `rfftn`, `irfftn`, `fft2`, `ifft2`, +`rfft2` or `irfft2` with the `s` parameter set to a value that is not +`None` and the `axes` parameter set to `None` has been deprecated, in +line with the array API standard. To retain current behaviour, pass a sequence +[0, …, k-1] to `axes` for an array of dimension k. + +Furthermore, passing an array to `s` which contains `None` values is +deprecated as the parameter is documented to accept a sequence of integers +in both the NumPy docs and the array API specification. To use the default +behaviour of the corresponding 1-D transform, pass the value matching +the default for its `n` parameter. To use the default behaviour for every +axis, the `s` argument can be omitted. + +([gh-25495](https://github.com/numpy/numpy/pull/25495)) + +### `np.linalg.lstsq` now defaults to a new `rcond` value[#](#np-linalg-lstsq-now-defaults-to-a-new-rcond-value "Link to this heading") + +[`lstsq`](../reference/generated/numpy.linalg.lstsq.html#numpy.linalg.lstsq "numpy.linalg.lstsq") now uses the new rcond value of the machine precision +times `max(M, N)`. Previously, the machine precision was used but a +FutureWarning was given to notify that this change will happen eventually. +That old behavior can still be achieved by passing `rcond=-1`. + +([gh-25721](https://github.com/numpy/numpy/pull/25721)) + +## Expired deprecations[#](#expired-deprecations "Link to this heading") + +* The `np.core.umath_tests` submodule has been removed from the public API. + (Deprecated in NumPy 1.15) + + ([gh-23809](https://github.com/numpy/numpy/pull/23809)) +* The `PyDataMem_SetEventHook` deprecation has expired and it is + removed. Use `tracemalloc` and the `np.lib.tracemalloc_domain` + domain. (Deprecated in NumPy 1.23) + + ([gh-23921](https://github.com/numpy/numpy/pull/23921)) +* The deprecation of `set_numeric_ops` and the C functions + `PyArray_SetNumericOps` and `PyArray_GetNumericOps` has + been expired and the functions removed. (Deprecated in NumPy 1.16) + + ([gh-23998](https://github.com/numpy/numpy/pull/23998)) +* The `fasttake`, `fastclip`, and `fastputmask` `ArrFuncs` + deprecation is now finalized. +* The deprecated function `fastCopyAndTranspose` and its C counterpart + are now removed. +* The deprecation of `PyArray_ScalarFromObject` is now finalized. + + ([gh-24312](https://github.com/numpy/numpy/pull/24312)) +* `np.msort` has been removed. For a replacement, `np.sort(a, axis=0)` + should be used instead. + + ([gh-24494](https://github.com/numpy/numpy/pull/24494)) +* `np.dtype(("f8", 1)` will now return a shape 1 subarray dtype + rather than a non-subarray one. + + ([gh-25761](https://github.com/numpy/numpy/pull/25761)) +* Assigning to the `.data` attribute of an ndarray is disallowed and will + raise. +* `np.binary_repr(a, width)` will raise if width is too small. +* Using `NPY_CHAR` in `PyArray_DescrFromType()` will raise, use + `NPY_STRING` `NPY_UNICODE`, or `NPY_VSTRING` instead. + + ([gh-25794](https://github.com/numpy/numpy/pull/25794)) + +## Compatibility notes[#](#compatibility-notes "Link to this heading") + +### `loadtxt` and `genfromtxt` default encoding changed[#](#loadtxt-and-genfromtxt-default-encoding-changed "Link to this heading") + +`loadtxt` and `genfromtxt` now both default to `encoding=None` +which may mainly modify how `converters` work. +These will now be passed `str` rather than `bytes`. Pass the +encoding explicitly to always get the new or old behavior. +For `genfromtxt` the change also means that returned values will now be +unicode strings rather than bytes. + +([gh-25158](https://github.com/numpy/numpy/pull/25158)) + +### `f2py` compatibility notes[#](#f2py-compatibility-notes "Link to this heading") + +* `f2py` will no longer accept ambiguous `-m` and `.pyf` CLI + combinations. When more than one `.pyf` file is passed, an error is + raised. When both `-m` and a `.pyf` is passed, a warning is emitted and + the `-m` provided name is ignored. + + ([gh-25181](https://github.com/numpy/numpy/pull/25181)) +* The `f2py.compile()` helper has been removed because it leaked memory, has + been marked as experimental for several years now, and was implemented as a + thin `subprocess.run` wrapper. It was also one of the test bottlenecks. See + [gh-25122](https://github.com/numpy/numpy/issues/25122) for the full + rationale. It also used several `np.distutils` features which are too + fragile to be ported to work with `meson`. +* Users are urged to replace calls to `f2py.compile` with calls to + `subprocess.run("python", "-m", "numpy.f2py",...` instead, and to use + environment variables to interact with `meson`. [Native files](https://mesonbuild.com/Machine-files.html) are also an option. + + ([gh-25193](https://github.com/numpy/numpy/pull/25193)) + +### Minor changes in behavior of sorting functions[#](#minor-changes-in-behavior-of-sorting-functions "Link to this heading") + +Due to algorithmic changes and use of SIMD code, sorting functions with methods +that aren’t stable may return slightly different results in 2.0.0 compared to +1.26.x. This includes the default method of [`argsort`](../reference/generated/numpy.argsort.html#numpy.argsort "numpy.argsort") and +[`argpartition`](../reference/generated/numpy.argpartition.html#numpy.argpartition "numpy.argpartition"). + +### Removed ambiguity when broadcasting in `np.solve`[#](#removed-ambiguity-when-broadcasting-in-np-solve "Link to this heading") + +The broadcasting rules for `np.solve(a, b)` were ambiguous when `b` had 1 +fewer dimensions than `a`. This has been resolved in a backward-incompatible +way and is now compliant with the Array API. The old behaviour can be +reconstructed by using `np.solve(a, b[..., None])[..., 0]`. + +([gh-25914](https://github.com/numpy/numpy/pull/25914)) + +### Modified representation for `Polynomial`[#](#modified-representation-for-polynomial "Link to this heading") + +The representation method for [`Polynomial`](../reference/generated/numpy.polynomial.polynomial.Polynomial.html#numpy.polynomial.polynomial.Polynomial "numpy.polynomial.polynomial.Polynomial") was +updated to include the domain in the representation. The plain text and latex +representations are now consistent. For example the output of +`str(np.polynomial.Polynomial([1, 1], domain=[.1, .2]))` used to be `1.0 + +1.0 x`, but now is `1.0 + 1.0 (-3.0000000000000004 + 20.0 x)`. + +([gh-21760](https://github.com/numpy/numpy/pull/21760)) + +## C API changes[#](#c-api-changes "Link to this heading") + +* The `PyArray_CGT`, `PyArray_CLT`, `PyArray_CGE`, `PyArray_CLE`, + `PyArray_CEQ`, `PyArray_CNE` macros have been removed. +* `PyArray_MIN` and `PyArray_MAX` have been moved from `ndarraytypes.h` + to `npy_math.h`. + + ([gh-24258](https://github.com/numpy/numpy/pull/24258)) +* A C API for working with [`numpy.dtypes.StringDType`](../reference/routines.dtypes.html#numpy.dtypes.StringDType "numpy.dtypes.StringDType") arrays has been exposed. + This includes functions for acquiring and releasing mutexes which lock access + to the string data, as well as packing and unpacking UTF-8 bytestreams from + array entries. +* `NPY_NTYPES` has been renamed to `NPY_NTYPES_LEGACY` as it does not + include new NumPy built-in DTypes. In particular the new string DType + will likely not work correctly with code that handles legacy DTypes. + + ([gh-25347](https://github.com/numpy/numpy/pull/25347)) +* The C-API now only exports the static inline function versions + of the array accessors (previously this depended on using “deprecated API”). + While we discourage it, the struct fields can still be used directly. + + ([gh-25789](https://github.com/numpy/numpy/pull/25789)) +* NumPy now defines [`PyArray_Pack`](../reference/c-api/array.html#c.PyArray_Pack "PyArray_Pack") to set an individual memory + address. Unlike `PyArray_SETITEM` this function is equivalent to setting + an individual array item and does not require a NumPy array input. + + ([gh-25954](https://github.com/numpy/numpy/pull/25954)) +* The `->f` slot has been removed from `PyArray_Descr`. + If you use this slot, replace accessing it with + `PyDataType_GetArrFuncs` (see its documentation and the + [NumPy 2.0 migration guide](../numpy_2_0_migration_guide.html#numpy-2-migration-guide)). In some cases using other functions like + `PyArray_GETITEM` may be an alternatives. +* `PyArray_GETITEM` and `PyArray_SETITEM` now require the import of the + NumPy API table to be used and are no longer defined in `ndarraytypes.h`. + + ([gh-25812](https://github.com/numpy/numpy/pull/25812)) +* Due to runtime dependencies, the definition for functionality accessing + the dtype flags was moved from `numpy/ndarraytypes.h` and is only available + after including `numpy/ndarrayobject.h` as it requires `import_array()`. + This includes `PyDataType_FLAGCHK`, `PyDataType_REFCHK` and + `NPY_BEGIN_THREADS_DESCR`. +* The dtype flags on `PyArray_Descr` must now be accessed through the + `PyDataType_FLAGS` inline function to be compatible with both 1.x and 2.x. + This function is defined in `npy_2_compat.h` to allow backporting. + Most or all users should use `PyDataType_FLAGCHK` which is available on + 1.x and does not require backporting. + Cython users should use Cython 3. Otherwise access will go through Python + unless they use `PyDataType_FLAGCHK` instead. + + ([gh-25816](https://github.com/numpy/numpy/pull/25816)) + +### Datetime functionality exposed in the C API and Cython bindings[#](#datetime-functionality-exposed-in-the-c-api-and-cython-bindings "Link to this heading") + +The functions `NpyDatetime_ConvertDatetime64ToDatetimeStruct`, +`NpyDatetime_ConvertDatetimeStructToDatetime64`, +`NpyDatetime_ConvertPyDateTimeToDatetimeStruct`, +`NpyDatetime_GetDatetimeISO8601StrLen`, `NpyDatetime_MakeISO8601Datetime`, +and `NpyDatetime_ParseISO8601Datetime` have been added to the C API to +facilitate converting between strings, Python datetimes, and NumPy datetimes in +external libraries. + +([gh-21199](https://github.com/numpy/numpy/pull/21199)) + +### Const correctness for the generalized ufunc C API[#](#const-correctness-for-the-generalized-ufunc-c-api "Link to this heading") + +The NumPy C API’s functions for constructing generalized ufuncs +(`PyUFunc_FromFuncAndData`, `PyUFunc_FromFuncAndDataAndSignature`, +`PyUFunc_FromFuncAndDataAndSignatureAndIdentity`) take `types` and `data` +arguments that are not modified by NumPy’s internals. Like the `name` and +`doc` arguments, third-party Python extension modules are likely to supply +these arguments from static constants. The `types` and `data` arguments are +now const-correct: they are declared as `const char *types` and +`void *const *data`, respectively. C code should not be affected, but C++ +code may be. + +([gh-23847](https://github.com/numpy/numpy/pull/23847)) + +### Larger `NPY_MAXDIMS` and `NPY_MAXARGS`, `NPY_RAVEL_AXIS` introduced[#](#larger-npy-maxdims-and-npy-maxargs-npy-ravel-axis-introduced "Link to this heading") + +`NPY_MAXDIMS` is now 64, you may want to review its use. This is usually +used in a stack allocation, where the increase should be safe. +However, we do encourage generally to remove any use of `NPY_MAXDIMS` and +`NPY_MAXARGS` to eventually allow removing the constraint completely. +For the conversion helper and C-API functions mirroring Python ones such as +`take`, `NPY_MAXDIMS` was used to mean `axis=None`. Such usage must be +replaced with `NPY_RAVEL_AXIS`. See also [Increased maximum number of dimensions](../numpy_2_0_migration_guide.html#migration-maxdims). + +([gh-25149](https://github.com/numpy/numpy/pull/25149)) + +### `NPY_MAXARGS` not constant and `PyArrayMultiIterObject` size change[#](#npy-maxargs-not-constant-and-pyarraymultiiterobject-size-change "Link to this heading") + +Since `NPY_MAXARGS` was increased, it is now a runtime constant and not +compile-time constant anymore. +We expect almost no users to notice this. But if used for stack allocations +it now must be replaced with a custom constant using `NPY_MAXARGS` as an +additional runtime check. + +The `sizeof(PyArrayMultiIterObject)` no longer includes the full size +of the object. We expect nobody to notice this change. It was necessary +to avoid issues with Cython. + +([gh-25271](https://github.com/numpy/numpy/pull/25271)) + +### Required changes for custom legacy user dtypes[#](#required-changes-for-custom-legacy-user-dtypes "Link to this heading") + +In order to improve our DTypes it is unfortunately necessary +to break the ABI, which requires some changes for dtypes registered +with `PyArray_RegisterDataType`. +Please see the documentation of `PyArray_RegisterDataType` for how +to adapt your code and achieve compatibility with both 1.x and 2.x. + +([gh-25792](https://github.com/numpy/numpy/pull/25792)) + +### New Public DType API[#](#new-public-dtype-api "Link to this heading") + +The C implementation of the NEP 42 DType API is now public. While the DType API +has shipped in NumPy for a few versions, it was only usable in sessions with a +special environment variable set. It is now possible to write custom DTypes +outside of NumPy using the new DType API and the normal `import_array()` +mechanism for importing the numpy C API. + +See [Custom Data Types](../reference/c-api/array.html#dtype-api) for more details about the API. As always with a new +feature, please report any bugs you run into implementing or using a new +DType. It is likely that downstream C code that works with dtypes will need to +be updated to work correctly with new DTypes. + +([gh-25754](https://github.com/numpy/numpy/pull/25754)) + +### New C-API import functions[#](#new-c-api-import-functions "Link to this heading") + +We have now added `PyArray_ImportNumPyAPI` and `PyUFunc_ImportUFuncAPI` +as static inline functions to import the NumPy C-API tables. +The new functions have two advantages over `import_array` and +`import_ufunc`: + +* They check whether the import was already performed and are light-weight + if not, allowing to add them judiciously (although this is not preferable + in most cases). +* The old mechanisms were macros rather than functions which included a + `return` statement. + +The `PyArray_ImportNumPyAPI()` function is included in `npy_2_compat.h` +for simpler backporting. + +([gh-25866](https://github.com/numpy/numpy/pull/25866)) + +### Structured dtype information access through functions[#](#structured-dtype-information-access-through-functions "Link to this heading") + +The dtype structures fields `c_metadata`, `names`, +`fields`, and `subarray` must now be accessed through new +functions following the same names, such as `PyDataType_NAMES`. +Direct access of the fields is not valid as they do not exist for +all `PyArray_Descr` instances. +The `metadata` field is kept, but the macro version should also be preferred. + +([gh-25802](https://github.com/numpy/numpy/pull/25802)) + +### Descriptor `elsize` and `alignment` access[#](#descriptor-elsize-and-alignment-access "Link to this heading") + +Unless compiling only with NumPy 2 support, the `elsize` and `alignment` +fields must now be accessed via `PyDataType_ELSIZE`, +`PyDataType_SET_ELSIZE`, and `PyDataType_ALIGNMENT`. +In cases where the descriptor is attached to an array, we advise +using `PyArray_ITEMSIZE` as it exists on all NumPy versions. +Please see [The PyArray\_Descr struct has been changed](../numpy_2_0_migration_guide.html#migration-c-descr) for more information. + +([gh-25943](https://github.com/numpy/numpy/pull/25943)) + +## NumPy 2.0 C API removals[#](#numpy-2-0-c-api-removals "Link to this heading") + +* `npy_interrupt.h` and the corresponding macros like `NPY_SIGINT_ON` + have been removed. We recommend querying `PyErr_CheckSignals()` or + `PyOS_InterruptOccurred()` periodically (these do currently require + holding the GIL though). +* The `noprefix.h` header has been removed. Replace missing symbols with + their prefixed counterparts (usually an added `NPY_` or `npy_`). + + ([gh-23919](https://github.com/numpy/numpy/pull/23919)) +* `PyUFunc_GetPyVals`, `PyUFunc_handlefperr`, and `PyUFunc_checkfperr` + have been removed. + If needed, a new backwards compatible function to raise floating point errors + could be restored. Reason for removal: there are no known users and the + functions would have made `with np.errstate()` fixes much more difficult). + + ([gh-23922](https://github.com/numpy/numpy/pull/23922)) +* The `numpy/old_defines.h` which was part of the API deprecated since NumPy 1.7 + has been removed. This removes macros of the form `PyArray_CONSTANT`. + The [replace\_old\_macros.sed](https://github.com/numpy/numpy/blob/main/tools/replace_old_macros.sed) + script may be useful to convert them to the `NPY_CONSTANT` version. + + ([gh-24011](https://github.com/numpy/numpy/pull/24011)) +* The `legacy_inner_loop_selector` member of the ufunc struct is removed + to simplify improvements to the dispatching system. + There are no known users overriding or directly accessing this member. + + ([gh-24271](https://github.com/numpy/numpy/pull/24271)) +* `NPY_INTPLTR` has been removed to avoid confusion (see `intp` + redefinition). + + ([gh-24888](https://github.com/numpy/numpy/pull/24888)) +* The advanced indexing `MapIter` and related API has been removed. + The (truly) public part of it was not well tested and had only one + known user (Theano). Making it private will simplify improvements + to speed up `ufunc.at`, make advanced indexing more maintainable, + and was important for increasing the maximum number of dimensions of arrays + to 64. Please let us know if this API is important to you so we can find a + solution together. + + ([gh-25138](https://github.com/numpy/numpy/pull/25138)) +* The `NPY_MAX_ELSIZE` macro has been removed, as it only ever reflected + builtin numeric types and served no internal purpose. + + ([gh-25149](https://github.com/numpy/numpy/pull/25149)) +* `PyArray_REFCNT` and `NPY_REFCOUNT` are removed. Use `Py_REFCNT` instead. + + ([gh-25156](https://github.com/numpy/numpy/pull/25156)) +* `PyArrayFlags_Type` and `PyArray_NewFlagsObject` as well as + `PyArrayFlagsObject` are private now. + There is no known use-case; use the Python API if needed. +* `PyArray_MoveInto`, `PyArray_CastTo`, `PyArray_CastAnyTo` are removed + use `PyArray_CopyInto` and if absolutely needed `PyArray_CopyAnyInto` + (the latter does a flat copy). +* `PyArray_FillObjectArray` is removed, its only true use was for + implementing `np.empty`. Create a new empty array or use + `PyArray_FillWithScalar()` (decrefs existing objects). +* `PyArray_CompareUCS4` and `PyArray_CompareString` are removed. + Use the standard C string comparison functions. +* `PyArray_ISPYTHON` is removed as it is misleading, has no known + use-cases, and is easy to replace. +* `PyArray_FieldNames` is removed, as it is unclear what it would + be useful for. It also has incorrect semantics in some possible + use-cases. +* `PyArray_TypestrConvert` is removed, since it seems a misnomer and unlikely + to be used by anyone. If you know the size or are limited to few types, just + use it explicitly, otherwise go via Python strings. + + ([gh-25292](https://github.com/numpy/numpy/pull/25292)) +* `PyDataType_GetDatetimeMetaData` is removed, it did not actually + do anything since at least NumPy 1.7. + + ([gh-25802](https://github.com/numpy/numpy/pull/25802)) +* `PyArray_GetCastFunc` is removed. Note that custom legacy user dtypes + can still provide a castfunc as their implementation, but any access to them + is now removed. The reason for this is that NumPy never used these + internally for many years. If you use simple numeric types, please just use + C casts directly. In case you require an alternative, please let us know so + we can create new API such as `PyArray_CastBuffer()` which could use old or + new cast functions depending on the NumPy version. + + ([gh-25161](https://github.com/numpy/numpy/pull/25161)) + +## New Features[#](#new-features "Link to this heading") + +### `np.add` was extended to work with `unicode` and `bytes` dtypes.[#](#np-add-was-extended-to-work-with-unicode-and-bytes-dtypes "Link to this heading") + +> ([gh-24858](https://github.com/numpy/numpy/pull/24858)) + +### A new `bitwise_count` function[#](#a-new-bitwise-count-function "Link to this heading") + +This new function counts the number of 1-bits in a number. +[`bitwise_count`](../reference/generated/numpy.bitwise_count.html#numpy.bitwise_count "numpy.bitwise_count") works on all the numpy integer types and +integer-like objects. + +```None +>>> a = np.array([2**i - 1 for i in range(16)]) +>>> np.bitwise_count(a) +array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], + dtype=uint8) +``` + +([gh-19355](https://github.com/numpy/numpy/pull/19355)) + +### macOS Accelerate support, including the ILP64[#](#macos-accelerate-support-including-the-ilp64 "Link to this heading") + +Support for the updated Accelerate BLAS/LAPACK library, including ILP64 (64-bit +integer) support, in macOS 13.3 has been added. This brings arm64 support, and +significant performance improvements of up to 10x for commonly used linear +algebra operations. When Accelerate is selected at build time, or if no +explicit BLAS library selection is done, the 13.3+ version will automatically +be used if available. + +([gh-24053](https://github.com/numpy/numpy/pull/24053)) + +Binary wheels are also available. On macOS >=14.0, users who install NumPy from +PyPI will get wheels built against Accelerate rather than OpenBLAS. + +([gh-25255](https://github.com/numpy/numpy/pull/25255)) + +### Option to use weights for quantile and percentile functions[#](#option-to-use-weights-for-quantile-and-percentile-functions "Link to this heading") + +A `weights` keyword is now available for [`quantile`](../reference/generated/numpy.quantile.html#numpy.quantile "numpy.quantile"), +[`percentile`](../reference/generated/numpy.percentile.html#numpy.percentile "numpy.percentile"), [`nanquantile`](../reference/generated/numpy.nanquantile.html#numpy.nanquantile "numpy.nanquantile") and [`nanpercentile`](../reference/generated/numpy.nanpercentile.html#numpy.nanpercentile "numpy.nanpercentile"). Only +`method="inverted_cdf"` supports weights. + +([gh-24254](https://github.com/numpy/numpy/pull/24254)) + +### Improved CPU optimization tracking[#](#improved-cpu-optimization-tracking "Link to this heading") + +A new tracer mechanism is available which enables tracking of the enabled +targets for each optimized function (i.e., that uses hardware-specific SIMD +instructions) in the NumPy library. With this enhancement, it becomes possible +to precisely monitor the enabled CPU dispatch targets for the dispatched +functions. + +A new function named `opt_func_info` has been added to the new namespace +[`numpy.lib.introspect`](../reference/generated/numpy.lib.introspect.html#module-numpy.lib.introspect "numpy.lib.introspect"), offering this tracing capability. This function allows +you to retrieve information about the enabled targets based on function names +and data type signatures. + +([gh-24420](https://github.com/numpy/numpy/pull/24420)) + +### A new Meson backend for `f2py`[#](#a-new-meson-backend-for-f2py "Link to this heading") + +`f2py` in compile mode (i.e. `f2py -c`) now accepts the `--backend meson` +option. This is the default option for Python >=3.12. For older Python versions, +`f2py` will still default to `--backend distutils`. + +To support this in realistic use-cases, in compile mode `f2py` takes a +`--dep` flag one or many times which maps to `dependency()` calls in the +`meson` backend, and does nothing in the `distutils` backend. + +There are no changes for users of `f2py` only as a code generator, i.e. without `-c`. + +([gh-24532](https://github.com/numpy/numpy/pull/24532)) + +### `bind(c)` support for `f2py`[#](#bind-c-support-for-f2py "Link to this heading") + +Both functions and subroutines can be annotated with `bind(c)`. `f2py` will +handle both the correct type mapping, and preserve the unique label for other +C interfaces. + +**Note:** `bind(c, name = 'routine_name_other_than_fortran_routine')` is not +honored by the `f2py` bindings by design, since `bind(c)` with the `name` +is meant to guarantee only the same name in C and Fortran, not in Python and +Fortran. + +([gh-24555](https://github.com/numpy/numpy/pull/24555)) + +### A new `strict` option for several testing functions[#](#a-new-strict-option-for-several-testing-functions "Link to this heading") + +The `strict` keyword is now available for [`assert_allclose`](../reference/generated/numpy.testing.assert_allclose.html#numpy.testing.assert_allclose "numpy.testing.assert_allclose"), +[`assert_equal`](../reference/generated/numpy.testing.assert_equal.html#numpy.testing.assert_equal "numpy.testing.assert_equal"), and [`assert_array_less`](../reference/generated/numpy.testing.assert_array_less.html#numpy.testing.assert_array_less "numpy.testing.assert_array_less"). +Setting `strict=True` will disable the broadcasting behaviour for scalars +and ensure that input arrays have the same data type. + +([gh-24680](https://github.com/numpy/numpy/pull/24680), +[gh-24770](https://github.com/numpy/numpy/pull/24770), +[gh-24775](https://github.com/numpy/numpy/pull/24775)) + +### Add `np.core.umath.find` and `np.core.umath.rfind` UFuncs[#](#add-np-core-umath-find-and-np-core-umath-rfind-ufuncs "Link to this heading") + +Add two `find` and `rfind` UFuncs that operate on unicode or byte strings +and are used in `np.char`. They operate similar to `str.find` and +`str.rfind`. + +([gh-24868](https://github.com/numpy/numpy/pull/24868)) + +### `diagonal` and `trace` for `numpy.linalg`[#](#diagonal-and-trace-for-numpy-linalg "Link to this heading") + +[`numpy.linalg.diagonal`](../reference/generated/numpy.linalg.diagonal.html#numpy.linalg.diagonal "numpy.linalg.diagonal") and [`numpy.linalg.trace`](../reference/generated/numpy.linalg.trace.html#numpy.linalg.trace "numpy.linalg.trace") have been +added, which are array API standard-compatible variants of [`numpy.diagonal`](../reference/generated/numpy.diagonal.html#numpy.diagonal "numpy.diagonal") and +[`numpy.trace`](../reference/generated/numpy.trace.html#numpy.trace "numpy.trace"). They differ in the default axis selection which define 2-D +sub-arrays. + +([gh-24887](https://github.com/numpy/numpy/pull/24887)) + +### New `long` and `ulong` dtypes[#](#new-long-and-ulong-dtypes "Link to this heading") + +[`numpy.long`](../reference/arrays.scalars.html#numpy.long "numpy.long") and [`numpy.ulong`](../reference/arrays.scalars.html#numpy.ulong "numpy.ulong") have been added as NumPy integers mapping +to C’s `long` and `unsigned long`. Prior to NumPy 1.24, `numpy.long` was +an alias to Python’s `int`. + +([gh-24922](https://github.com/numpy/numpy/pull/24922)) + +### `svdvals` for `numpy.linalg`[#](#svdvals-for-numpy-linalg "Link to this heading") + +[`numpy.linalg.svdvals`](../reference/generated/numpy.linalg.svdvals.html#numpy.linalg.svdvals "numpy.linalg.svdvals") has been added. It computes singular values for +(a stack of) matrices. Executing `np.svdvals(x)` is the same as calling +`np.svd(x, compute_uv=False, hermitian=False)`. +This function is compatible with the array API standard. + +([gh-24940](https://github.com/numpy/numpy/pull/24940)) + +### A new `isdtype` function[#](#a-new-isdtype-function "Link to this heading") + +[`numpy.isdtype`](../reference/generated/numpy.isdtype.html#numpy.isdtype "numpy.isdtype") was added to provide a canonical way to classify NumPy’s dtypes +in compliance with the array API standard. + +([gh-25054](https://github.com/numpy/numpy/pull/25054)) + +### A new `astype` function[#](#a-new-astype-function "Link to this heading") + +[`numpy.astype`](../reference/generated/numpy.astype.html#numpy.astype "numpy.astype") was added to provide an array API standard-compatible +alternative to the [`numpy.ndarray.astype`](../reference/generated/numpy.ndarray.astype.html#numpy.ndarray.astype "numpy.ndarray.astype") method. + +([gh-25079](https://github.com/numpy/numpy/pull/25079)) + +### Array API compatible functions’ aliases[#](#array-api-compatible-functions-aliases "Link to this heading") + +13 aliases for existing functions were added to improve compatibility with the array API standard: + +* Trigonometry: `acos`, `acosh`, `asin`, `asinh`, `atan`, `atanh`, `atan2`. +* Bitwise: `bitwise_left_shift`, `bitwise_invert`, `bitwise_right_shift`. +* Misc: `concat`, `permute_dims`, `pow`. +* In `numpy.linalg`: `tensordot`, `matmul`. + +([gh-25086](https://github.com/numpy/numpy/pull/25086)) + +### New `unique_*` functions[#](#new-unique-functions "Link to this heading") + +The [`unique_all`](../reference/generated/numpy.unique_all.html#numpy.unique_all "numpy.unique_all"), [`unique_counts`](../reference/generated/numpy.unique_counts.html#numpy.unique_counts "numpy.unique_counts"), [`unique_inverse`](../reference/generated/numpy.unique_inverse.html#numpy.unique_inverse "numpy.unique_inverse"), +and [`unique_values`](../reference/generated/numpy.unique_values.html#numpy.unique_values "numpy.unique_values") functions have been added. They provide +functionality of [`unique`](../reference/generated/numpy.unique.html#numpy.unique "numpy.unique") with different sets of flags. They are array API +standard-compatible, and because the number of arrays they return does not +depend on the values of input arguments, they are easier to target for JIT +compilation. + +([gh-25088](https://github.com/numpy/numpy/pull/25088)) + +### Matrix transpose support for ndarrays[#](#matrix-transpose-support-for-ndarrays "Link to this heading") + +NumPy now offers support for calculating the matrix transpose of an array (or +stack of arrays). The matrix transpose is equivalent to swapping the last two +axes of an array. Both `np.ndarray` and `np.ma.MaskedArray` now expose a +`.mT` attribute, and there is a matching new [`numpy.matrix_transpose`](../reference/generated/numpy.matrix_transpose.html#numpy.matrix_transpose "numpy.matrix_transpose") +function. + +([gh-23762](https://github.com/numpy/numpy/pull/23762)) + +### Array API compatible functions for `numpy.linalg`[#](#array-api-compatible-functions-for-numpy-linalg "Link to this heading") + +Six new functions and two aliases were added to improve compatibility with +the Array API standard for [`numpy.linalg`](../reference/routines.linalg.html#module-numpy.linalg "numpy.linalg"): + +* [`numpy.linalg.matrix_norm`](../reference/generated/numpy.linalg.matrix_norm.html#numpy.linalg.matrix_norm "numpy.linalg.matrix_norm") - Computes the matrix norm of a matrix (or a stack of matrices). +* [`numpy.linalg.vector_norm`](../reference/generated/numpy.linalg.vector_norm.html#numpy.linalg.vector_norm "numpy.linalg.vector_norm") - Computes the vector norm of a vector (or batch of vectors). +* [`numpy.vecdot`](../reference/generated/numpy.vecdot.html#numpy.vecdot "numpy.vecdot") - Computes the (vector) dot product of two arrays. +* [`numpy.linalg.vecdot`](../reference/generated/numpy.linalg.vecdot.html#numpy.linalg.vecdot "numpy.linalg.vecdot") - An alias for [`numpy.vecdot`](../reference/generated/numpy.vecdot.html#numpy.vecdot "numpy.vecdot"). +* [`numpy.linalg.matrix_transpose`](../reference/generated/numpy.linalg.matrix_transpose.html#numpy.linalg.matrix_transpose "numpy.linalg.matrix_transpose") - An alias for [`numpy.matrix_transpose`](../reference/generated/numpy.matrix_transpose.html#numpy.matrix_transpose "numpy.matrix_transpose"). + + ([gh-25155](https://github.com/numpy/numpy/pull/25155)) +* [`numpy.linalg.outer`](../reference/generated/numpy.linalg.outer.html#numpy.linalg.outer "numpy.linalg.outer") has been added. It computes the outer product of two + vectors. It differs from [`numpy.outer`](../reference/generated/numpy.outer.html#numpy.outer "numpy.outer") by accepting one-dimensional arrays + only. This function is compatible with the array API standard. + + ([gh-25101](https://github.com/numpy/numpy/pull/25101)) +* [`numpy.linalg.cross`](../reference/generated/numpy.linalg.cross.html#numpy.linalg.cross "numpy.linalg.cross") has been added. It computes the cross product of two + (arrays of) 3-dimensional vectors. It differs from [`numpy.cross`](../reference/generated/numpy.cross.html#numpy.cross "numpy.cross") by accepting + three-dimensional vectors only. This function is compatible with the array + API standard. + + ([gh-25145](https://github.com/numpy/numpy/pull/25145)) + +### A `correction` argument for `var` and `std`[#](#a-correction-argument-for-var-and-std "Link to this heading") + +A `correction` argument was added to [`var`](../reference/generated/numpy.var.html#numpy.var "numpy.var") and [`std`](../reference/generated/numpy.std.html#numpy.std "numpy.std"), which is +an array API standard compatible alternative to `ddof`. As both arguments +serve a similar purpose, only one of them can be provided at the same time. + +([gh-25169](https://github.com/numpy/numpy/pull/25169)) + +### `ndarray.device` and `ndarray.to_device`[#](#ndarray-device-and-ndarray-to-device "Link to this heading") + +An `ndarray.device` attribute and `ndarray.to_device` method were +added to `numpy.ndarray` for array API standard compatibility. + +Additionally, `device` keyword-only arguments were added to: +[`asarray`](../reference/generated/numpy.asarray.html#numpy.asarray "numpy.asarray"), [`arange`](../reference/generated/numpy.arange.html#numpy.arange "numpy.arange"), [`empty`](../reference/generated/numpy.empty.html#numpy.empty "numpy.empty"), [`empty_like`](../reference/generated/numpy.empty_like.html#numpy.empty_like "numpy.empty_like"), +[`eye`](../reference/generated/numpy.eye.html#numpy.eye "numpy.eye"), [`full`](../reference/generated/numpy.full.html#numpy.full "numpy.full"), [`full_like`](../reference/generated/numpy.full_like.html#numpy.full_like "numpy.full_like"), [`linspace`](../reference/generated/numpy.linspace.html#numpy.linspace "numpy.linspace"), +[`ones`](../reference/generated/numpy.ones.html#numpy.ones "numpy.ones"), [`ones_like`](../reference/generated/numpy.ones_like.html#numpy.ones_like "numpy.ones_like"), [`zeros`](../reference/generated/numpy.zeros.html#numpy.zeros "numpy.zeros"), and [`zeros_like`](../reference/generated/numpy.zeros_like.html#numpy.zeros_like "numpy.zeros_like"). + +For all these new arguments, only `device="cpu"` is supported. + +([gh-25233](https://github.com/numpy/numpy/pull/25233)) + +### StringDType has been added to NumPy[#](#stringdtype-has-been-added-to-numpy "Link to this heading") + +We have added a new variable-width UTF-8 encoded string data type, implementing +a “NumPy array of Python strings”, including support for a user-provided missing +data sentinel. It is intended as a drop-in replacement for arrays of Python +strings and missing data sentinels using the object dtype. See [NEP 55](https://numpy.org/neps/nep-0055-string_dtype.html) and [the +documentation](../user/basics.strings.html#stringdtype) for more details. + +([gh-25347](https://github.com/numpy/numpy/pull/25347)) + +### New keywords for `cholesky` and `pinv`[#](#new-keywords-for-cholesky-and-pinv "Link to this heading") + +The `upper` and `rtol` keywords were added to [`numpy.linalg.cholesky`](../reference/generated/numpy.linalg.cholesky.html#numpy.linalg.cholesky "numpy.linalg.cholesky") and +[`numpy.linalg.pinv`](../reference/generated/numpy.linalg.pinv.html#numpy.linalg.pinv "numpy.linalg.pinv"), respectively, to improve array API standard compatibility. + +For [`pinv`](../reference/generated/numpy.linalg.pinv.html#numpy.linalg.pinv "numpy.linalg.pinv"), if neither `rcond` nor `rtol` is specified, +the `rcond`’s default is used. We plan to deprecate and remove `rcond` in +the future. + +([gh-25388](https://github.com/numpy/numpy/pull/25388)) + +### New keywords for `sort`, `argsort` and `linalg.matrix_rank`[#](#new-keywords-for-sort-argsort-and-linalg-matrix-rank "Link to this heading") + +New keyword parameters were added to improve array API standard compatibility: + +* `rtol` was added to [`matrix_rank`](../reference/generated/numpy.linalg.matrix_rank.html#numpy.linalg.matrix_rank "numpy.linalg.matrix_rank"). +* `stable` was added to [`sort`](../reference/generated/numpy.sort.html#numpy.sort "numpy.sort") and [`argsort`](../reference/generated/numpy.argsort.html#numpy.argsort "numpy.argsort"). + +([gh-25437](https://github.com/numpy/numpy/pull/25437)) + +### New `numpy.strings` namespace for string ufuncs[#](#new-numpy-strings-namespace-for-string-ufuncs "Link to this heading") + +NumPy now implements some string operations as ufuncs. The old `np.char` +namespace is still available, and where possible the string manipulation +functions in that namespace have been updated to use the new ufuncs, +substantially improving their performance. + +Where possible, we suggest updating code to use functions in `np.strings` +instead of `np.char`. In the future we may deprecate `np.char` in favor of +`np.strings`. + +([gh-25463](https://github.com/numpy/numpy/pull/25463)) + +### `numpy.fft` support for different precisions and in-place calculations[#](#numpy-fft-support-for-different-precisions-and-in-place-calculations "Link to this heading") + +The various FFT routines in [`numpy.fft`](../reference/routines.fft.html#module-numpy.fft "numpy.fft") now do their calculations natively in +float, double, or long double precision, depending on the input precision, +instead of always calculating in double precision. Hence, the calculation will +now be less precise for single and more precise for long double precision. +The data type of the output array will now be adjusted accordingly. + +Furthermore, all FFT routines have gained an `out` argument that can be used +for in-place calculations. + +([gh-25536](https://github.com/numpy/numpy/pull/25536)) + +### configtool and pkg-config support[#](#configtool-and-pkg-config-support "Link to this heading") + +A new `numpy-config` CLI script is available that can be queried for the +NumPy version and for compile flags needed to use the NumPy C API. This will +allow build systems to better support the use of NumPy as a dependency. +Also, a `numpy.pc` pkg-config file is now included with Numpy. In order to +find its location for use with `PKG_CONFIG_PATH`, use +`numpy-config --pkgconfigdir`. + +([gh-25730](https://github.com/numpy/numpy/pull/25730)) + +### Array API standard support in the main namespace[#](#array-api-standard-support-in-the-main-namespace "Link to this heading") + +The main `numpy` namespace now supports the array API standard. See +[Array API standard compatibility](../reference/array_api.html#array-api-standard-compatibility) for details. + +([gh-25911](https://github.com/numpy/numpy/pull/25911)) + +## Improvements[#](#improvements "Link to this heading") + +### Strings are now supported by `any`, `all`, and the logical ufuncs.[#](#strings-are-now-supported-by-any-all-and-the-logical-ufuncs "Link to this heading") + +> ([gh-25651](https://github.com/numpy/numpy/pull/25651)) + +### Integer sequences as the shape argument for `memmap`[#](#integer-sequences-as-the-shape-argument-for-memmap "Link to this heading") + +[`numpy.memmap`](../reference/generated/numpy.memmap.html#numpy.memmap "numpy.memmap") can now be created with any integer sequence as the `shape` +argument, such as a list or numpy array of integers. Previously, only the +types of tuple and int could be used without raising an error. + +([gh-23729](https://github.com/numpy/numpy/pull/23729)) + +### `errstate` is now faster and context safe[#](#errstate-is-now-faster-and-context-safe "Link to this heading") + +The [`numpy.errstate`](../reference/generated/numpy.errstate.html#numpy.errstate "numpy.errstate") context manager/decorator is now faster and +safer. Previously, it was not context safe and had (rare) +issues with thread-safety. + +([gh-23936](https://github.com/numpy/numpy/pull/23936)) + +### AArch64 quicksort speed improved by using Highway’s VQSort[#](#aarch64-quicksort-speed-improved-by-using-highway-s-vqsort "Link to this heading") + +The first introduction of the Google Highway library, using VQSort on AArch64. +Execution time is improved by up to 16x in some cases, see the PR for benchmark +results. Extensions to other platforms will be done in the future. + +([gh-24018](https://github.com/numpy/numpy/pull/24018)) + +### Complex types - underlying C type changes[#](#complex-types-underlying-c-type-changes "Link to this heading") + +* The underlying C types for all of NumPy’s complex types have been changed to + use C99 complex types. +* While this change does not affect the memory layout of complex types, it + changes the API to be used to directly retrieve or write the real or + complex part of the complex number, since direct field access (as in `c.real` + or `c.imag`) is no longer an option. You can now use utilities provided in + `numpy/npy_math.h` to do these operations, like this: + + ```None + npy_cdouble c; + npy_csetreal(&c, 1.0); + npy_csetimag(&c, 0.0); + printf("%d + %di\n", npy_creal(c), npy_cimag(c)); + ``` +* To ease cross-version compatibility, equivalent macros and a compatibility + layer have been added which can be used by downstream packages to continue + to support both NumPy 1.x and 2.x. See [Support for complex numbers](../reference/c-api/coremath.html#complex-numbers) for more info. +* `numpy/npy_common.h` now includes `complex.h`, which means that `complex` + is now a reserved keyword. + +([gh-24085](https://github.com/numpy/numpy/pull/24085)) + +### `iso_c_binding` support and improved common blocks for `f2py`[#](#iso-c-binding-support-and-improved-common-blocks-for-f2py "Link to this heading") + +Previously, users would have to define their own custom `f2cmap` file to use +type mappings defined by the Fortran2003 `iso_c_binding` intrinsic module. +These type maps are now natively supported by `f2py` + +([gh-24555](https://github.com/numpy/numpy/pull/24555)) + +`f2py` now handles `common` blocks which have `kind` specifications from +modules. This further expands the usability of intrinsics like +`iso_fortran_env` and `iso_c_binding`. + +([gh-25186](https://github.com/numpy/numpy/pull/25186)) + +### Call `str` automatically on third argument to functions like `assert_equal`[#](#call-str-automatically-on-third-argument-to-functions-like-assert-equal "Link to this heading") + +The third argument to functions like [`assert_equal`](../reference/generated/numpy.testing.assert_equal.html#numpy.testing.assert_equal "numpy.testing.assert_equal") now has +`str` called on it automatically. This way it mimics the built-in `assert` +statement, where `assert_equal(a, b, obj)` works like `assert a == b, obj`. + +([gh-24877](https://github.com/numpy/numpy/pull/24877)) + +### Support for array-like `atol`/`rtol` in `isclose`, `allclose`[#](#support-for-array-like-atol-rtol-in-isclose-allclose "Link to this heading") + +The keywords `atol` and `rtol` in [`isclose`](../reference/generated/numpy.isclose.html#numpy.isclose "numpy.isclose") and [`allclose`](../reference/generated/numpy.allclose.html#numpy.allclose "numpy.allclose") +now accept both scalars and arrays. An array, if given, must broadcast +to the shapes of the first two array arguments. + +([gh-24878](https://github.com/numpy/numpy/pull/24878)) + +### Consistent failure messages in test functions[#](#consistent-failure-messages-in-test-functions "Link to this heading") + +Previously, some [`numpy.testing`](../reference/routines.testing.html#module-numpy.testing "numpy.testing") assertions printed messages that +referred to the actual and desired results as `x` and `y`. +Now, these values are consistently referred to as `ACTUAL` and +`DESIRED`. + +([gh-24931](https://github.com/numpy/numpy/pull/24931)) + +### n-D FFT transforms allow `s[i] == -1`[#](#n-d-fft-transforms-allow-s-i-1 "Link to this heading") + +The [`fftn`](../reference/generated/numpy.fft.fftn.html#numpy.fft.fftn "numpy.fft.fftn"), [`ifftn`](../reference/generated/numpy.fft.ifftn.html#numpy.fft.ifftn "numpy.fft.ifftn"), [`rfftn`](../reference/generated/numpy.fft.rfftn.html#numpy.fft.rfftn "numpy.fft.rfftn"), +[`irfftn`](../reference/generated/numpy.fft.irfftn.html#numpy.fft.irfftn "numpy.fft.irfftn"), [`fft2`](../reference/generated/numpy.fft.fft2.html#numpy.fft.fft2 "numpy.fft.fft2"), [`ifft2`](../reference/generated/numpy.fft.ifft2.html#numpy.fft.ifft2 "numpy.fft.ifft2"), [`rfft2`](../reference/generated/numpy.fft.rfft2.html#numpy.fft.rfft2 "numpy.fft.rfft2") +and [`irfft2`](../reference/generated/numpy.fft.irfft2.html#numpy.fft.irfft2 "numpy.fft.irfft2") functions now use the whole input array along the axis +`i` if `s[i] == -1`, in line with the array API standard. + +([gh-25495](https://github.com/numpy/numpy/pull/25495)) + +### Guard PyArrayScalar\_VAL and PyUnicodeScalarObject for the limited API[#](#guard-pyarrayscalar-val-and-pyunicodescalarobject-for-the-limited-api "Link to this heading") + +`PyUnicodeScalarObject` holds a `PyUnicodeObject`, which is not available +when using `Py_LIMITED_API`. Add guards to hide it and consequently also make +the `PyArrayScalar_VAL` macro hidden. + +([gh-25531](https://github.com/numpy/numpy/pull/25531)) + +## Changes[#](#changes "Link to this heading") + +* `np.gradient()` now returns a tuple rather than a list making the + return value immutable. + + ([gh-23861](https://github.com/numpy/numpy/pull/23861)) +* Being fully context and thread-safe, `np.errstate` can only + be entered once now. +* `np.setbufsize` is now tied to `np.errstate()`: leaving an + `np.errstate` context will also reset the `bufsize`. + + ([gh-23936](https://github.com/numpy/numpy/pull/23936)) +* A new public `np.lib.array_utils` submodule has been introduced and it + currently contains three functions: `byte_bounds` (moved from + `np.lib.utils`), `normalize_axis_tuple` and `normalize_axis_index`. + + ([gh-24540](https://github.com/numpy/numpy/pull/24540)) +* Introduce [`numpy.bool`](../reference/arrays.scalars.html#numpy.bool "numpy.bool") as the new canonical name for NumPy’s boolean dtype, + and make [`numpy.bool_`](../reference/arrays.scalars.html#numpy.bool_ "numpy.bool_") an alias to it. Note that until NumPy 1.24, + `np.bool` was an alias to Python’s builtin `bool`. The new name helps + with array API standard compatibility and is a more intuitive name. + + ([gh-25080](https://github.com/numpy/numpy/pull/25080)) +* The `dtype.flags` value was previously stored as a signed integer. + This means that the aligned dtype struct flag lead to negative flags being + set (-128 rather than 128). This flag is now stored unsigned (positive). Code + which checks flags manually may need to adapt. This may include code + compiled with Cython 0.29.x. + + ([gh-25816](https://github.com/numpy/numpy/pull/25816)) + +### Representation of NumPy scalars changed[#](#representation-of-numpy-scalars-changed "Link to this heading") + +As per [NEP 51](https://numpy.org/neps/nep-0051-scalar-representation.html#nep51 "(in NumPy Enhancement Proposals)"), the scalar representation has been +updated to include the type information to avoid confusion with +Python scalars. + +Scalars are now printed as `np.float64(3.0)` rather than just `3.0`. +This may disrupt workflows that store representations of numbers +(e.g., to files) making it harder to read them. They should be stored as +explicit strings, for example by using `str()` or `f"{scalar!s}"`. +For the time being, affected users can use `np.set_printoptions(legacy="1.25")` +to get the old behavior (with possibly a few exceptions). +Documentation of downstream projects may require larger updates, +if code snippets are tested. We are working on tooling for +[doctest-plus](https://github.com/scientific-python/pytest-doctestplus/issues/107) +to facilitate updates. + +([gh-22449](https://github.com/numpy/numpy/pull/22449)) + +### Truthiness of NumPy strings changed[#](#truthiness-of-numpy-strings-changed "Link to this heading") + +NumPy strings previously were inconsistent about how they defined +if the string is `True` or `False` and the definition did not +match the one used by Python. +Strings are now considered `True` when they are non-empty and +`False` when they are empty. +This changes the following distinct cases: + +* Casts from string to boolean were previously roughly equivalent + to `string_array.astype(np.int64).astype(bool)`, meaning that only + valid integers could be cast. + Now a string of `"0"` will be considered `True` since it is not empty. + If you need the old behavior, you may use the above step (casting + to integer first) or `string_array == "0"` (if the input is only ever `0` or `1`). + To get the new result on old NumPy versions use `string_array != ""`. +* `np.nonzero(string_array)` previously ignored whitespace so that + a string only containing whitespace was considered `False`. + Whitespace is now considered `True`. + +This change does not affect `np.loadtxt`, `np.fromstring`, or `np.genfromtxt`. +The first two still use the integer definition, while `genfromtxt` continues to +match for `"true"` (ignoring case). +However, if `np.bool_` is used as a converter the result will change. + +The change does affect `np.fromregex` as it uses direct assignments. + +([gh-23871](https://github.com/numpy/numpy/pull/23871)) + +### A `mean` keyword was added to var and std function[#](#a-mean-keyword-was-added-to-var-and-std-function "Link to this heading") + +Often when the standard deviation is needed the mean is also needed. The same +holds for the variance and the mean. Until now the mean is then calculated twice, +the change introduced here for the [`var`](../reference/generated/numpy.var.html#numpy.var "numpy.var") and [`std`](../reference/generated/numpy.std.html#numpy.std "numpy.std") functions +allows for passing in a precalculated mean as an keyword argument. See the +docstrings for details and an example illustrating the speed-up. + +([gh-24126](https://github.com/numpy/numpy/pull/24126)) + +### Remove datetime64 deprecation warning when constructing with timezone[#](#remove-datetime64-deprecation-warning-when-constructing-with-timezone "Link to this heading") + +The [`numpy.datetime64`](../reference/arrays.scalars.html#numpy.datetime64 "numpy.datetime64") method now issues a UserWarning rather than a +DeprecationWarning whenever a timezone is included in the datetime +string that is provided. + +([gh-24193](https://github.com/numpy/numpy/pull/24193)) + +### Default integer dtype is now 64-bit on 64-bit Windows[#](#default-integer-dtype-is-now-64-bit-on-64-bit-windows "Link to this heading") + +The default NumPy integer is now 64-bit on all 64-bit systems as the historic +32-bit default on Windows was a common source of issues. Most users should not +notice this. The main issues may occur with code interfacing with libraries +written in a compiled language like C. For more information see +[Windows default integer](../numpy_2_0_migration_guide.html#migration-windows-int64). + +([gh-24224](https://github.com/numpy/numpy/pull/24224)) + +### Renamed `numpy.core` to `numpy._core`[#](#renamed-numpy-core-to-numpy-core "Link to this heading") + +Accessing `numpy.core` now emits a DeprecationWarning. In practice +we have found that most downstream usage of `numpy.core` was to access +functionality that is available in the main `numpy` namespace. +If for some reason you are using functionality in `numpy.core` that +is not available in the main `numpy` namespace, this means you are likely +using private NumPy internals. You can still access these internals via +`numpy._core` without a deprecation warning but we do not provide any +backward compatibility guarantees for NumPy internals. Please open an issue +if you think a mistake was made and something needs to be made public. + +([gh-24634](https://github.com/numpy/numpy/pull/24634)) + +The “relaxed strides” debug build option, which was previously enabled through +the `NPY_RELAXED_STRIDES_DEBUG` environment variable or the +`-Drelaxed-strides-debug` config-settings flag has been removed. + +([gh-24717](https://github.com/numpy/numpy/pull/24717)) + +### Redefinition of `np.intp`/`np.uintp` (almost never a change)[#](#redefinition-of-np-intp-np-uintp-almost-never-a-change "Link to this heading") + +Due to the actual use of these types almost always matching the use of +`size_t`/`Py_ssize_t` this is now the definition in C. +Previously, it matched `intptr_t` and `uintptr_t` which would often +have been subtly incorrect. +This has no effect on the vast majority of machines since the size +of these types only differ on extremely niche platforms. + +However, it means that: + +* Pointers may not necessarily fit into an `intp` typed array anymore. + The `p` and `P` character codes can still be used, however. +* Creating `intptr_t` or `uintptr_t` typed arrays in C remains possible + in a cross-platform way via `PyArray_DescrFromType('p')`. +* The new character codes `nN` were introduced. +* It is now correct to use the Python C-API functions when parsing + to `npy_intp` typed arguments. + +([gh-24888](https://github.com/numpy/numpy/pull/24888)) + +### `numpy.fft.helper` made private[#](#numpy-fft-helper-made-private "Link to this heading") + +`numpy.fft.helper` was renamed to `numpy.fft._helper` to indicate +that it is a private submodule. All public functions exported by it +should be accessed from [`numpy.fft`](../reference/routines.fft.html#module-numpy.fft "numpy.fft"). + +([gh-24945](https://github.com/numpy/numpy/pull/24945)) + +### `numpy.linalg.linalg` made private[#](#numpy-linalg-linalg-made-private "Link to this heading") + +`numpy.linalg.linalg` was renamed to `numpy.linalg._linalg` +to indicate that it is a private submodule. All public functions +exported by it should be accessed from [`numpy.linalg`](../reference/routines.linalg.html#module-numpy.linalg "numpy.linalg"). + +([gh-24946](https://github.com/numpy/numpy/pull/24946)) + +### Out-of-bound axis not the same as `axis=None`[#](#out-of-bound-axis-not-the-same-as-axis-none "Link to this heading") + +In some cases `axis=32` or for concatenate any large value +was the same as `axis=None`. +Except for `concatenate` this was deprecate. +Any out of bound axis value will now error, make sure to use +`axis=None`. + +([gh-25149](https://github.com/numpy/numpy/pull/25149)) + +### New `copy` keyword meaning for `array` and `asarray` constructors[#](#new-copy-keyword-meaning-for-array-and-asarray-constructors "Link to this heading") + +Now [`numpy.array`](../reference/generated/numpy.array.html#numpy.array "numpy.array") and [`numpy.asarray`](../reference/generated/numpy.asarray.html#numpy.asarray "numpy.asarray") support three values for `copy` parameter: + +* `None` - A copy will only be made if it is necessary. +* `True` - Always make a copy. +* `False` - Never make a copy. If a copy is required a `ValueError` is raised. + +The meaning of `False` changed as it now raises an exception if a copy is needed. + +([gh-25168](https://github.com/numpy/numpy/pull/25168)) + +### The `__array__` special method now takes a `copy` keyword argument.[#](#the-array-special-method-now-takes-a-copy-keyword-argument "Link to this heading") + +NumPy will pass `copy` to the `__array__` special method in situations where +it would be set to a non-default value (e.g. in a call to +`np.asarray(some_object, copy=False)`). Currently, if an +unexpected keyword argument error is raised after this, NumPy will print a +warning and re-try without the `copy` keyword argument. Implementations of +objects implementing the `__array__` protocol should accept a `copy` keyword +argument with the same meaning as when passed to [`numpy.array`](../reference/generated/numpy.array.html#numpy.array "numpy.array") or +[`numpy.asarray`](../reference/generated/numpy.asarray.html#numpy.asarray "numpy.asarray"). + +([gh-25168](https://github.com/numpy/numpy/pull/25168)) + +### Cleanup of initialization of `numpy.dtype` with strings with commas[#](#cleanup-of-initialization-of-numpy-dtype-with-strings-with-commas "Link to this heading") + +The interpretation of strings with commas is changed slightly, in that a +trailing comma will now always create a structured dtype. E.g., where +previously `np.dtype("i")` and `np.dtype("i,")` were treated as identical, +now `np.dtype("i,")` will create a structured dtype, with a single +field. This is analogous to `np.dtype("i,i")` creating a structured dtype +with two fields, and makes the behaviour consistent with that expected of +tuples. + +At the same time, the use of single number surrounded by parenthesis to +indicate a sub-array shape, like in `np.dtype("(2)i,")`, is deprecated. +Instead; one should use `np.dtype("(2,)i")` or `np.dtype("2i")`. +Eventually, using a number in parentheses will raise an exception, like is the +case for initializations without a comma, like `np.dtype("(2)i")`. + +([gh-25434](https://github.com/numpy/numpy/pull/25434)) + +### Change in how complex sign is calculated[#](#change-in-how-complex-sign-is-calculated "Link to this heading") + +Following the array API standard, the complex sign is now calculated as +`z / |z|` (instead of the rather less logical case where the sign of +the real part was taken, unless the real part was zero, in which case +the sign of the imaginary part was returned). Like for real numbers, +zero is returned if `z==0`. + +([gh-25441](https://github.com/numpy/numpy/pull/25441)) + +### Return types of functions that returned a list of arrays[#](#return-types-of-functions-that-returned-a-list-of-arrays "Link to this heading") + +Functions that returned a list of ndarrays have been changed to return a tuple +of ndarrays instead. Returning tuples consistently whenever a sequence of +arrays is returned makes it easier for JIT compilers like Numba, as well as for +static type checkers in some cases, to support these functions. Changed +functions are: [`atleast_1d`](../reference/generated/numpy.atleast_1d.html#numpy.atleast_1d "numpy.atleast_1d"), [`atleast_2d`](../reference/generated/numpy.atleast_2d.html#numpy.atleast_2d "numpy.atleast_2d"), [`atleast_3d`](../reference/generated/numpy.atleast_3d.html#numpy.atleast_3d "numpy.atleast_3d"), +[`broadcast_arrays`](../reference/generated/numpy.broadcast_arrays.html#numpy.broadcast_arrays "numpy.broadcast_arrays"), [`meshgrid`](../reference/generated/numpy.meshgrid.html#numpy.meshgrid "numpy.meshgrid"), [`ogrid`](../reference/generated/numpy.ogrid.html#numpy.ogrid "numpy.ogrid"), +[`histogramdd`](../reference/generated/numpy.histogramdd.html#numpy.histogramdd "numpy.histogramdd"). + +### `np.unique` `return_inverse` shape for multi-dimensional inputs[#](#np-unique-return-inverse-shape-for-multi-dimensional-inputs "Link to this heading") + +When multi-dimensional inputs are passed to `np.unique` with `return_inverse=True`, +the `unique_inverse` output is now shaped such that the input can be reconstructed +directly using `np.take(unique, unique_inverse)` when `axis=None`, and +`np.take_along_axis(unique, unique_inverse, axis=axis)` otherwise. + +Note + +This change was reverted in 2.0.1 except for `axis=None`. The correct +reconstruction is always `np.take(unique, unique_inverse, axis=axis)`. +When 2.0.0 needs to be supported, add `unique_inverse.reshape(-1)` +to code. + +([gh-25553](https://github.com/numpy/numpy/pull/25553), +[gh-25570](https://github.com/numpy/numpy/pull/25570)) + +### `any` and `all` return booleans for object arrays[#](#any-and-all-return-booleans-for-object-arrays "Link to this heading") + +The `any` and `all` functions and methods now return +booleans also for object arrays. Previously, they did +a reduction which behaved like the Python `or` and +`and` operators which evaluates to one of the arguments. +You can use `np.logical_or.reduce` and `np.logical_and.reduce` +to achieve the previous behavior. + +([gh-25712](https://github.com/numpy/numpy/pull/25712)) + +### `np.can_cast` cannot be called on Python int, float, or complex[#](#np-can-cast-cannot-be-called-on-python-int-float-or-complex "Link to this heading") + +`np.can_cast` cannot be called with Python int, float, or complex instances +anymore. This is because NEP 50 means that the result of `can_cast` must +not depend on the value passed in. +Unfortunately, for Python scalars whether a cast should be considered +`"same_kind"` or `"safe"` may depend on the context and value so that +this is currently not implemented. +In some cases, this means you may have to add a specific path for: +`if type(obj) in (int, float, complex): ...`. + +([gh-26393](https://github.com/numpy/numpy/pull/26393)) diff --git a/corpus/changelog/numpy_releases/numpy_201.md b/corpus/changelog/numpy_releases/numpy_201.md new file mode 100644 index 0000000000000000000000000000000000000000..d5932ececcd448765ff8357af8213fa09fc261c5 --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_201.md @@ -0,0 +1,70 @@ +# NumPy 2.0.1 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.0.1-notes.html +Version: 2.0.1 + +NumPy 2.0.1 is a maintenance release that fixes bugs and regressions +discovered after the 2.0.0 release. NumPy 2.0.1 is the last planned +release in the 2.0.x series, 2.1.0rc1 should be out shortly. + +The Python versions supported by this release are 3.9-3.12. + +## Improvements[#](#improvements "Link to this heading") + +### `np.quantile` with method `closest_observation` chooses nearest even order statistic[#](#np-quantile-with-method-closest-observation-chooses-nearest-even-order-statistic "Link to this heading") + +This changes the definition of nearest for border cases from the nearest odd +order statistic to nearest even order statistic. The numpy implementation now +matches other reference implementations. + +([gh-26656](https://github.com/numpy/numpy/pull/26656)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 15 people contributed to this release. People with a “+” by their +names contributed a patch for the first time. + +* @vahidmech + +* Alex Herbert + +* Charles Harris +* Giovanni Del Monte + +* Leo Singer +* Lysandros Nikolaou +* Matti Picus +* Nathan Goldbaum +* Patrick J. Roddy + +* Raghuveer Devulapalli +* Ralf Gommers +* Rostan Tabet + +* Sebastian Berg +* Tyler Reddy +* Yannik Wicke + + +## Pull requests merged[#](#pull-requests-merged "Link to this heading") + +A total of 24 pull requests were merged for this release. + +* [#26711](https://github.com/numpy/numpy/pull/26711): MAINT: prepare 2.0.x for further development +* [#26792](https://github.com/numpy/numpy/pull/26792): TYP: fix incorrect import in `ma/extras.pyi` stub +* [#26793](https://github.com/numpy/numpy/pull/26793): DOC: Mention ‘1.25’ legacy printing mode in `set_printoptions` +* [#26794](https://github.com/numpy/numpy/pull/26794): DOC: Remove mention of NaN and NAN aliases from constants +* [#26821](https://github.com/numpy/numpy/pull/26821): BLD: Fix x86-simd-sort build failure on openBSD +* [#26822](https://github.com/numpy/numpy/pull/26822): BUG: Ensure output order follows input in numpy.fft +* [#26823](https://github.com/numpy/numpy/pull/26823): TYP: fix missing sys import in numeric.pyi +* [#26832](https://github.com/numpy/numpy/pull/26832): DOC: remove hack to override \_add\_newdocs\_scalars (#26826) +* [#26835](https://github.com/numpy/numpy/pull/26835): BUG: avoid side-effect of ‘include complex.h’ +* [#26836](https://github.com/numpy/numpy/pull/26836): BUG: fix max\_rows and chunked string/datetime reading in `loadtxt` +* [#26837](https://github.com/numpy/numpy/pull/26837): BUG: fix PyArray\_ImportNumPyAPI under -Werror=strict-prototypes +* [#26856](https://github.com/numpy/numpy/pull/26856): DOC: Update some documentation +* [#26868](https://github.com/numpy/numpy/pull/26868): BUG: fancy indexing copy +* [#26869](https://github.com/numpy/numpy/pull/26869): BUG: Mismatched allocation domains in `PyArray_FillWithScalar` +* [#26870](https://github.com/numpy/numpy/pull/26870): BUG: Handle –f77flags and –f90flags for meson [wheel build] +* [#26887](https://github.com/numpy/numpy/pull/26887): BUG: Fix new DTypes and new string promotion when signature is… +* [#26888](https://github.com/numpy/numpy/pull/26888): BUG: remove numpy.f2py from excludedimports +* [#26959](https://github.com/numpy/numpy/pull/26959): BUG: Quantile closest\_observation to round to nearest even order +* [#26960](https://github.com/numpy/numpy/pull/26960): BUG: Fix off-by-one error in amount of characters in strip +* [#26961](https://github.com/numpy/numpy/pull/26961): API: Partially revert unique with return\_inverse +* [#26962](https://github.com/numpy/numpy/pull/26962): BUG,MAINT: Fix utf-8 character stripping memory access +* [#26963](https://github.com/numpy/numpy/pull/26963): BUG: Fix out-of-bound minimum offset for in1d table method +* [#26971](https://github.com/numpy/numpy/pull/26971): BUG: fix f2py tests to work with v2 API +* [#26995](https://github.com/numpy/numpy/pull/26995): BUG: Add object cast to avoid warning with limited API diff --git a/corpus/changelog/numpy_releases/numpy_202.md b/corpus/changelog/numpy_releases/numpy_202.md new file mode 100644 index 0000000000000000000000000000000000000000..37c211a72b5704b031f7765a0d7230ad15150f60 --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_202.md @@ -0,0 +1,52 @@ +# NumPy 2.0.2 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.0.2-notes.html +Version: 2.0.2 + +NumPy 2.0.2 is a maintenance release that fixes bugs and regressions +discovered after the 2.0.1 release. + +The Python versions supported by this release are 3.9-3.12. + +## Contributors[#](#contributors "Link to this heading") + +A total of 13 people contributed to this release. People with a “+” by their +names contributed a patch for the first time. + +* Bruno Oliveira + +* Charles Harris +* Chris Sidebottom +* Christian Heimes + +* Christopher Sidebottom +* Mateusz Sokół +* Matti Picus +* Nathan Goldbaum +* Pieter Eendebak +* Raghuveer Devulapalli +* Ralf Gommers +* Sebastian Berg +* Yair Chuchem + + +## Pull requests merged[#](#pull-requests-merged "Link to this heading") + +A total of 19 pull requests were merged for this release. + +* [#27000](https://github.com/numpy/numpy/pull/27000): REL: Prepare for the NumPy 2.0.1 release [wheel build] +* [#27001](https://github.com/numpy/numpy/pull/27001): MAINT: prepare 2.0.x for further development +* [#27021](https://github.com/numpy/numpy/pull/27021): BUG: cfuncs.py: fix crash when sys.stderr is not available +* [#27022](https://github.com/numpy/numpy/pull/27022): DOC: Fix migration note for `alltrue` and `sometrue` +* [#27061](https://github.com/numpy/numpy/pull/27061): BUG: use proper input and output descriptor in array\_assign\_subscript… +* [#27073](https://github.com/numpy/numpy/pull/27073): BUG: Mirror VQSORT\_ENABLED logic in Quicksort +* [#27074](https://github.com/numpy/numpy/pull/27074): BUG: Bump Highway to latest master +* [#27077](https://github.com/numpy/numpy/pull/27077): BUG: Off by one in memory overlap check +* [#27122](https://github.com/numpy/numpy/pull/27122): BUG: Use the new `npyv_loadable_stride_` functions for ldexp and… +* [#27126](https://github.com/numpy/numpy/pull/27126): BUG: Bump Highway to latest +* [#27128](https://github.com/numpy/numpy/pull/27128): BUG: add missing error handling in public\_dtype\_api.c +* [#27129](https://github.com/numpy/numpy/pull/27129): BUG: fix another cast setup in array\_assign\_subscript +* [#27130](https://github.com/numpy/numpy/pull/27130): BUG: Fix building NumPy in FIPS mode +* [#27131](https://github.com/numpy/numpy/pull/27131): BLD: update vendored Meson for cross-compilation patches +* [#27146](https://github.com/numpy/numpy/pull/27146): MAINT: Scipy openblas 0.3.27.44.4 +* [#27151](https://github.com/numpy/numpy/pull/27151): BUG: Do not accidentally store dtype metadata in `np.save` +* [#27195](https://github.com/numpy/numpy/pull/27195): REV: Revert undef I and document it +* [#27213](https://github.com/numpy/numpy/pull/27213): BUG: Fix NPY\_RAVEL\_AXIS on backwards compatible NumPy 2 builds +* [#27279](https://github.com/numpy/numpy/pull/27279): BUG: Fix array\_equal for numeric and non-numeric scalar types diff --git a/corpus/changelog/numpy_releases/numpy_210.md b/corpus/changelog/numpy_releases/numpy_210.md new file mode 100644 index 0000000000000000000000000000000000000000..d186f45e2310d82c47fb886901bd91c836897433 --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_210.md @@ -0,0 +1,325 @@ +# NumPy 2.1.0 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.1.0-notes.html +Version: 2.1.0 + +NumPy 2.1.0 provides support for the upcoming Python 3.13 release and drops +support for Python 3.9. In addition to the usual bug fixes and updated Python +support, it helps get us back into our usual release cycle after the extended +development of 2.0. The highlights for this release are: + +* Support for the array-api 2023.12 standard. +* Support for Python 3.13. +* Preliminary support for free threaded Python 3.13. + +Python versions 3.10-3.13 are supported in this release. + +## New functions[#](#new-functions "Link to this heading") + +### New function `numpy.unstack`[#](#new-function-numpy-unstack "Link to this heading") + +A new function `np.unstack(array, axis=...)` was added, which splits +an array into a tuple of arrays along an axis. It serves as the inverse +of [`numpy.stack`](../reference/generated/numpy.stack.html#numpy.stack "numpy.stack"). + +([gh-26579](https://github.com/numpy/numpy/pull/26579)) + +## Deprecations[#](#deprecations "Link to this heading") + +* The `fix_imports` keyword argument in `numpy.save` is deprecated. Since + NumPy 1.17, `numpy.save` uses a pickle protocol that no longer supports + Python 2, and ignored `fix_imports` keyword. This keyword is kept only + for backward compatibility. It is now deprecated. + + ([gh-26452](https://github.com/numpy/numpy/pull/26452)) +* Passing non-integer inputs as the first argument of [`bincount`](../reference/generated/numpy.bincount.html#numpy.bincount "numpy.bincount") is now + deprecated, because such inputs are silently cast to integers with no + warning about loss of precision. + + ([gh-27076](https://github.com/numpy/numpy/pull/27076)) + +## Expired deprecations[#](#expired-deprecations "Link to this heading") + +* Scalars and 0D arrays are disallowed for `numpy.nonzero` and `numpy.ndarray.nonzero`. + + ([gh-26268](https://github.com/numpy/numpy/pull/26268)) +* `set_string_function` internal function was removed and `PyArray_SetStringFunction` + was stubbed out. + + ([gh-26611](https://github.com/numpy/numpy/pull/26611)) + +## C API changes[#](#c-api-changes "Link to this heading") + +### API symbols now hidden but customizable[#](#api-symbols-now-hidden-but-customizable "Link to this heading") + +NumPy now defaults to hide the API symbols it adds to allow all NumPy API +usage. This means that by default you cannot dynamically fetch the NumPy API +from another library (this was never possible on windows). + +If you are experiencing linking errors related to `PyArray_API` or +`PyArray_RUNTIME_VERSION`, you can define the +`NPY_API_SYMBOL_ATTRIBUTE` to opt-out of this change. + +If you are experiencing problems due to an upstream header including NumPy, +the solution is to make sure you `#include "numpy/ndarrayobject.h"` before +their header and import NumPy yourself based on `including-the-c-api`. + +([gh-26103](https://github.com/numpy/numpy/pull/26103)) + +### Many shims removed from npy\_3kcompat.h[#](#many-shims-removed-from-npy-3kcompat-h "Link to this heading") + +Many of the old shims and helper functions were removed from +`npy_3kcompat.h`. If you find yourself in need of these, vendor the previous +version of the file into your codebase. + +([gh-26842](https://github.com/numpy/numpy/pull/26842)) + +### New `PyUFuncObject` field `process_core_dims_func`[#](#new-pyufuncobject-field-process-core-dims-func "Link to this heading") + +The field `process_core_dims_func` was added to the structure +`PyUFuncObject`. For generalized ufuncs, this field can be set to a function +of type `PyUFunc_ProcessCoreDimsFunc` that will be called when the ufunc is +called. It allows the ufunc author to check that core dimensions satisfy +additional constraints, and to set output core dimension sizes if they have not +been provided. + +([gh-26908](https://github.com/numpy/numpy/pull/26908)) + +## New Features[#](#new-features "Link to this heading") + +### Preliminary Support for Free-Threaded CPython 3.13[#](#preliminary-support-for-free-threaded-cpython-3-13 "Link to this heading") + +CPython 3.13 will be available as an experimental free-threaded build. See +, [PEP 703](https://peps.python.org/pep-0703/) and the [CPython 3.13 release notes](https://docs.python.org/3.13/whatsnew/3.13.html#free-threaded-cpython) for +more detail about free-threaded Python. + +NumPy 2.1 has preliminary support for the free-threaded build of CPython +3.13. This support was enabled by fixing a number of C thread-safety issues in +NumPy. Before NumPy 2.1, NumPy used a large number of C global static variables +to store runtime caches and other state. We have either refactored to avoid the +need for global state, converted the global state to thread-local state, or +added locking. + +Support for free-threaded Python does not mean that NumPy is thread +safe. Read-only shared access to ndarray should be safe. NumPy exposes shared +mutable state and we have not added any locking to the array object itself to +serialize access to shared state. Care must be taken in user code to avoid +races if you would like to mutate the same array in multiple threads. It is +certainly possible to crash NumPy by mutating an array simultaneously in +multiple threads, for example by calling a ufunc and the `resize` method +simultaneously. For now our guidance is: “don’t do that”. In the future we would +like to provide stronger guarantees. + +Object arrays in particular need special care, since the GIL +previously provided locking for object array access and no longer does. See +[Issue #27199](https://github.com/numpy/numpy/issues/27199) for more +information about object arrays in the free-threaded build. + +If you are interested in free-threaded Python, for example because you have a +multiprocessing-based workflow that you are interested in running with Python +threads, we encourage testing and experimentation. + +If you run into problems that you suspect are because of NumPy, please [open an +issue](https://github.com/numpy/numpy/issues/new/choose), checking first if +the bug also occurs in the “regular” non-free-threaded CPython 3.13 build. Many +threading bugs can also occur in code that releases the GIL; disabling the GIL +only makes it easier to hit threading bugs. + +([gh-26157](https://github.com/numpy/numpy/issues/26157#issuecomment-2233864940)) + +* `numpy.reshape` and `numpy.ndarray.reshape` now support `shape` and + `copy` arguments. + + ([gh-26292](https://github.com/numpy/numpy/pull/26292)) +* NumPy now supports DLPack v1, support for older versions will + be deprecated in the future. + + ([gh-26501](https://github.com/numpy/numpy/pull/26501)) +* `numpy.asanyarray` now supports `copy` and `device` arguments, matching + `numpy.asarray`. + + ([gh-26580](https://github.com/numpy/numpy/pull/26580)) +* `numpy.printoptions`, `numpy.get_printoptions`, and + `numpy.set_printoptions` now support a new option, `override_repr`, for + defining custom `repr(array)` behavior. + + ([gh-26611](https://github.com/numpy/numpy/pull/26611)) +* `numpy.cumulative_sum` and `numpy.cumulative_prod` were added as Array + API compatible alternatives for `numpy.cumsum` and `numpy.cumprod`. The + new functions can include a fixed initial (zeros for `sum` and ones for + `prod`) in the result. + + ([gh-26724](https://github.com/numpy/numpy/pull/26724)) +* `numpy.clip` now supports `max` and `min` keyword arguments which are + meant to replace `a_min` and `a_max`. Also, for `np.clip(a)` or + `np.clip(a, None, None)` a copy of the input array will be returned instead + of raising an error. + + ([gh-26724](https://github.com/numpy/numpy/pull/26724)) +* `numpy.astype` now supports `device` argument. + + ([gh-26724](https://github.com/numpy/numpy/pull/26724)) + +### `f2py` can generate freethreading-compatible C extensions[#](#f2py-can-generate-freethreading-compatible-c-extensions "Link to this heading") + +Pass `--freethreading-compatible` to the f2py CLI tool to produce a C +extension marked as compatible with the free threading CPython +interpreter. Doing so prevents the interpreter from re-enabling the GIL at +runtime when it imports the C extension. Note that `f2py` does not analyze +fortran code for thread safety, so you must verify that the wrapped fortran +code is thread safe before marking the extension as compatible. + +([gh-26981](https://github.com/numpy/numpy/pull/26981)) + +## Improvements[#](#improvements "Link to this heading") + +### `histogram` auto-binning now returns bin sizes >=1 for integer input data[#](#histogram-auto-binning-now-returns-bin-sizes-1-for-integer-input-data "Link to this heading") + +For integer input data, bin sizes smaller than 1 result in spurious empty +bins. This is now avoided when the number of bins is computed using one of the +algorithms provided by `histogram_bin_edges`. + +([gh-12150](https://github.com/numpy/numpy/pull/12150)) + +### `ndarray` shape-type parameter is now covariant and bound to `tuple[int, ...]`[#](#ndarray-shape-type-parameter-is-now-covariant-and-bound-to-tuple-int "Link to this heading") + +Static typing for `ndarray` is a long-term effort that continues +with this change. It is a generic type with type parameters for +the shape and the data type. Previously, the shape type parameter could be +any value. This change restricts it to a tuple of ints, as one would expect +from using `ndarray.shape`. Further, the shape-type parameter has been +changed from invariant to covariant. This change also applies to the subtypes +of `ndarray`, e.g. `numpy.ma.MaskedArray`. See the +[typing docs](https://typing.readthedocs.io/en/latest/reference/generics.html#variance-of-generic-types) +for more information. + +([gh-26081](https://github.com/numpy/numpy/pull/26081)) + +### `np.quantile` with method `closest_observation` chooses nearest even order statistic[#](#np-quantile-with-method-closest-observation-chooses-nearest-even-order-statistic "Link to this heading") + +This changes the definition of nearest for border cases from the nearest odd +order statistic to nearest even order statistic. The numpy implementation now +matches other reference implementations. + +([gh-26656](https://github.com/numpy/numpy/pull/26656)) + +### `lapack_lite` is now thread safe[#](#lapack-lite-is-now-thread-safe "Link to this heading") + +NumPy provides a minimal low-performance version of LAPACK named `lapack_lite` +that can be used if no BLAS/LAPACK system is detected at build time. + +Until now, `lapack_lite` was not thread safe. Single-threaded use cases did +not hit any issues, but running linear algebra operations in multiple threads +could lead to errors, incorrect results, or segfaults due to data races. + +We have added a global lock, serializing access to `lapack_lite` in multiple +threads. + +([gh-26750](https://github.com/numpy/numpy/pull/26750)) + +### The `numpy.printoptions` context manager is now thread and async-safe[#](#the-numpy-printoptions-context-manager-is-now-thread-and-async-safe "Link to this heading") + +In prior versions of NumPy, the printoptions were defined using a combination +of Python and C global variables. We have refactored so the state is stored in +a python `ContextVar`, making the context manager thread and async-safe. + +([gh-26846](https://github.com/numpy/numpy/pull/26846)) + +### Type hinting `numpy.polynomial`[#](#type-hinting-numpy-polynomial "Link to this heading") + +Starting from the 2.1 release, PEP 484 type annotations have been included for +the functions and convenience classes in `numpy.polynomial` and its +sub-packages. + +([gh-26897](https://github.com/numpy/numpy/pull/26897)) + +### Improved `numpy.dtypes` type hints[#](#improved-numpy-dtypes-type-hints "Link to this heading") + +The type annotations for `numpy.dtypes` are now a better reflection of the +runtime: The `numpy.dtype` type-aliases have been replaced with specialized +`dtype` *subtypes*, and the previously missing annotations for +`numpy.dtypes.StringDType` have been added. + +([gh-27008](https://github.com/numpy/numpy/pull/27008)) + +## Performance improvements and changes[#](#performance-improvements-and-changes "Link to this heading") + +* `numpy.save` now uses pickle protocol version 4 for saving arrays with + object dtype, which allows for pickle objects larger than 4GB and improves + saving speed by about 5% for large arrays. + + ([gh-26388](https://github.com/numpy/numpy/pull/26388)) +* OpenBLAS on x86\_64 and i686 is built with fewer kernels. Based on + benchmarking, there are 5 clusters of performance around these kernels: + `PRESCOTT NEHALEM SANDYBRIDGE HASWELL SKYLAKEX`. + + ([gh-27147](https://github.com/numpy/numpy/pull/27147)) +* OpenBLAS on windows is linked without quadmath, simplifying licensing + + ([gh-27147](https://github.com/numpy/numpy/pull/27147)) +* Due to a regression in OpenBLAS on windows, the performance improvements when + using multiple threads for OpenBLAS 0.3.26 were reverted. + + ([gh-27147](https://github.com/numpy/numpy/pull/27147)) + +### `ma.cov` and `ma.corrcoef` are now significantly faster[#](#ma-cov-and-ma-corrcoef-are-now-significantly-faster "Link to this heading") + +The private function has been refactored along with `ma.cov` and +`ma.corrcoef`. They are now significantly faster, particularly on large, +masked arrays. + +([gh-26285](https://github.com/numpy/numpy/pull/26285)) + +## Changes[#](#changes "Link to this heading") + +* As `numpy.vecdot` is now a ufunc it has a less precise signature. + This is due to the limitations of ufunc’s typing stub. + + ([gh-26313](https://github.com/numpy/numpy/pull/26313)) +* `numpy.floor`, `numpy.ceil`, and `numpy.trunc` now won’t perform + casting to a floating dtype for integer and boolean dtype input arrays. + + ([gh-26766](https://github.com/numpy/numpy/pull/26766)) + +### `ma.corrcoef` may return a slightly different result[#](#ma-corrcoef-may-return-a-slightly-different-result "Link to this heading") + +A pairwise observation approach is currently used in `ma.corrcoef` to +calculate the standard deviations for each pair of variables. This has been +changed as it is being used to normalise the covariance, estimated using +`ma.cov`, which does not consider the observations for each variable in a +pairwise manner, rendering it unnecessary. The normalisation has been replaced +by the more appropriate standard deviation for each variable, which +significantly reduces the wall time, but will return slightly different +estimates of the correlation coefficients in cases where the observations +between a pair of variables are not aligned. However, it will return the same +estimates in all other cases, including returning the same correlation matrix +as `corrcoef` when using a masked array with no masked values. + +([gh-26285](https://github.com/numpy/numpy/pull/26285)) + +### Cast-safety fixes in `copyto` and `full`[#](#cast-safety-fixes-in-copyto-and-full "Link to this heading") + +`copyto` now uses NEP 50 correctly and applies this to its cast safety. +Python integer to NumPy integer casts and Python float to NumPy float casts +are now considered “safe” even if assignment may fail or precision may be lost. +This means the following examples change slightly: + +* `np.copyto(int8_arr, 1000)` previously performed an unsafe/same-kind cast + : of the Python integer. It will now always raise, to achieve an unsafe cast + you must pass an array or NumPy scalar. +* `np.copyto(uint8_arr, 1000, casting="safe")` will raise an OverflowError + rather than a TypeError due to same-kind casting. +* `np.copyto(float32_arr, 1e300, casting="safe")` will overflow to `inf` + (float32 cannot hold `1e300`) rather raising a TypeError. + +Further, only the dtype is used when assigning NumPy scalars (or 0-d arrays), +meaning that the following behaves differently: + +* `np.copyto(float32_arr, np.float64(3.0), casting="safe")` raises. +* `np.coptyo(int8_arr, np.int64(100), casting="safe")` raises. + Previously, NumPy checked whether the 100 fits the `int8_arr`. + +This aligns `copyto`, `full`, and `full_like` with the correct NumPy 2 +behavior. + +([gh-27091](https://github.com/numpy/numpy/pull/27091)) diff --git a/corpus/changelog/numpy_releases/numpy_211.md b/corpus/changelog/numpy_releases/numpy_211.md new file mode 100644 index 0000000000000000000000000000000000000000..9dc0119221c65d282423b9b678e1ed6be3ccd26b --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_211.md @@ -0,0 +1,37 @@ +# NumPy 2.1.1 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.1.1-notes.html +Version: 2.1.1 + +NumPy 2.1.1 is a maintenance release that fixes bugs and regressions +discovered after the 2.1.0 release. + +The Python versions supported by this release are 3.10-3.13. + +## Contributors[#](#contributors "Link to this heading") + +A total of 7 people contributed to this release. People with a “+” by their +names contributed a patch for the first time. + +* Andrew Nelson +* Charles Harris +* Mateusz Sokół +* Maximilian Weigand + +* Nathan Goldbaum +* Pieter Eendebak +* Sebastian Berg + +## Pull requests merged[#](#pull-requests-merged "Link to this heading") + +A total of 10 pull requests were merged for this release. + +* [#27236](https://github.com/numpy/numpy/pull/27236): REL: Prepare for the NumPy 2.1.0 release [wheel build] +* [#27252](https://github.com/numpy/numpy/pull/27252): MAINT: prepare 2.1.x for further development +* [#27259](https://github.com/numpy/numpy/pull/27259): BUG: revert unintended change in the return value of set\_printoptions +* [#27266](https://github.com/numpy/numpy/pull/27266): BUG: fix reference counting bug in \_\_array\_interface\_\_ implementation… +* [#27267](https://github.com/numpy/numpy/pull/27267): TST: Add regression test for missing descr in array-interface +* [#27276](https://github.com/numpy/numpy/pull/27276): BUG: Fix #27256 and #27257 +* [#27278](https://github.com/numpy/numpy/pull/27278): BUG: Fix array\_equal for numeric and non-numeric scalar types +* [#27287](https://github.com/numpy/numpy/pull/27287): MAINT: Update maintenance/2.1.x after the 2.0.2 release +* [#27303](https://github.com/numpy/numpy/pull/27303): BLD: cp311- macosx\_arm64 wheels [wheel build] +* [#27304](https://github.com/numpy/numpy/pull/27304): BUG: f2py: better handle filtering of public/private subroutines diff --git a/corpus/changelog/numpy_releases/numpy_212.md b/corpus/changelog/numpy_releases/numpy_212.md new file mode 100644 index 0000000000000000000000000000000000000000..f45ca1a67b2492ed49638a0dccc622d7b116416a --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_212.md @@ -0,0 +1,45 @@ +# NumPy 2.1.2 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.1.2-notes.html +Version: 2.1.2 + +NumPy 2.1.2 is a maintenance release that fixes bugs and regressions +discovered after the 2.1.1 release. + +The Python versions supported by this release are 3.10-3.13. + +## Contributors[#](#contributors "Link to this heading") + +A total of 11 people contributed to this release. People with a “+” by their +names contributed a patch for the first time. + +* Charles Harris +* Chris Sidebottom +* Ishan Koradia + +* João Eiras + +* Katie Rust + +* Marten van Kerkwijk +* Matti Picus +* Nathan Goldbaum +* Peter Hawkins +* Pieter Eendebak +* Slava Gorloff + + +## Pull requests merged[#](#pull-requests-merged "Link to this heading") + +A total of 14 pull requests were merged for this release. + +* [#27333](https://github.com/numpy/numpy/pull/27333): MAINT: prepare 2.1.x for further development +* [#27400](https://github.com/numpy/numpy/pull/27400): BUG: apply critical sections around populating the dispatch cache +* [#27406](https://github.com/numpy/numpy/pull/27406): BUG: Stub out get\_build\_msvc\_version if distutils.msvccompiler… +* [#27416](https://github.com/numpy/numpy/pull/27416): BUILD: fix missing include for std::ptrdiff\_t for C++23 language… +* [#27433](https://github.com/numpy/numpy/pull/27433): BLD: pin setuptools to avoid breaking numpy.distutils +* [#27437](https://github.com/numpy/numpy/pull/27437): BUG: Allow unsigned shift argument for np.roll +* [#27439](https://github.com/numpy/numpy/pull/27439): BUG: Disable SVE VQSort +* [#27471](https://github.com/numpy/numpy/pull/27471): BUG: rfftn axis bug +* [#27479](https://github.com/numpy/numpy/pull/27479): BUG: Fix extra decref of PyArray\_UInt8DType. +* [#27480](https://github.com/numpy/numpy/pull/27480): CI: use PyPI not scientific-python-nightly-wheels for CI doc… +* [#27481](https://github.com/numpy/numpy/pull/27481): MAINT: Check for SVE support on demand +* [#27484](https://github.com/numpy/numpy/pull/27484): BUG: initialize the promotion state to be weak +* [#27501](https://github.com/numpy/numpy/pull/27501): MAINT: Bump pypa/cibuildwheel from 2.20.0 to 2.21.2 +* [#27506](https://github.com/numpy/numpy/pull/27506): BUG: avoid segfault on bad arguments in ndarray.\_\_array\_function\_\_ diff --git a/corpus/changelog/numpy_releases/numpy_213.md b/corpus/changelog/numpy_releases/numpy_213.md new file mode 100644 index 0000000000000000000000000000000000000000..aa7d4f39334f463e4aca84687fce1b2c8feaef95 --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_213.md @@ -0,0 +1,71 @@ +# NumPy 2.1.3 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.1.3-notes.html +Version: 2.1.3 + +NumPy 2.1.3 is a maintenance release that fixes bugs and regressions +discovered after the 2.1.2 release. + +The Python versions supported by this release are 3.10-3.13. + +## Improvements[#](#improvements "Link to this heading") + +* Fixed a number of issues around promotion for string ufuncs with StringDType + arguments. Mixing StringDType and the fixed-width DTypes using the string + ufuncs should now generate much more uniform results. + + ([gh-27636](https://github.com/numpy/numpy/pull/27636)) + +## Changes[#](#changes "Link to this heading") + +* [`numpy.fix`](../reference/generated/numpy.fix.html#numpy.fix "numpy.fix") now won’t perform casting to a floating data-type for integer + and boolean data-type input arrays. + + ([gh-26766](https://github.com/numpy/numpy/pull/26766)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 15 people contributed to this release. People with a “+” by their +names contributed a patch for the first time. + +* Abhishek Kumar + +* Austin + +* Benjamin A. Beasley + +* Charles Harris +* Christian Lorentzen +* Marcel Telka + +* Matti Picus +* Michael Davidsaver + +* Nathan Goldbaum +* Peter Hawkins +* Raghuveer Devulapalli +* Ralf Gommers +* Sebastian Berg +* dependabot[bot] +* kp2pml30 + + +## Pull requests merged[#](#pull-requests-merged "Link to this heading") + +A total of 21 pull requests were merged for this release. + +* [#27512](https://github.com/numpy/numpy/pull/27512): MAINT: prepare 2.1.x for further development +* [#27537](https://github.com/numpy/numpy/pull/27537): MAINT: Bump actions/cache from 4.0.2 to 4.1.1 +* [#27538](https://github.com/numpy/numpy/pull/27538): MAINT: Bump pypa/cibuildwheel from 2.21.2 to 2.21.3 +* [#27539](https://github.com/numpy/numpy/pull/27539): MAINT: MSVC does not support #warning directive +* [#27543](https://github.com/numpy/numpy/pull/27543): BUG: Fix user dtype can-cast with python scalar during promotion +* [#27561](https://github.com/numpy/numpy/pull/27561): DEV: bump `python` to 3.12 in environment.yml +* [#27562](https://github.com/numpy/numpy/pull/27562): BLD: update vendored Meson to 1.5.2 +* [#27563](https://github.com/numpy/numpy/pull/27563): BUG: weighted quantile for some zero weights (#27549) +* [#27565](https://github.com/numpy/numpy/pull/27565): MAINT: Use miniforge for macos conda test. +* [#27566](https://github.com/numpy/numpy/pull/27566): BUILD: satisfy gcc-13 pendantic errors +* [#27569](https://github.com/numpy/numpy/pull/27569): BUG: handle possible error for PyTraceMallocTrack +* [#27570](https://github.com/numpy/numpy/pull/27570): BLD: start building Windows free-threaded wheels [wheel build] +* [#27571](https://github.com/numpy/numpy/pull/27571): BUILD: vendor tempita from Cython +* [#27574](https://github.com/numpy/numpy/pull/27574): BUG: Fix warning “differs in levels of indirection” in npy\_atomic.h… +* [#27592](https://github.com/numpy/numpy/pull/27592): MAINT: Update Highway to latest +* [#27593](https://github.com/numpy/numpy/pull/27593): BUG: Adjust numpy.i for SWIG 4.3 compatibility +* [#27616](https://github.com/numpy/numpy/pull/27616): BUG: Fix Linux QEMU CI workflow +* [#27668](https://github.com/numpy/numpy/pull/27668): BLD: Do not set \_\_STDC\_VERSION\_\_ to zero during build +* [#27669](https://github.com/numpy/numpy/pull/27669): ENH: fix wasm32 runtime type error in numpy.\_core +* [#27672](https://github.com/numpy/numpy/pull/27672): BUG: Fix a reference count leak in npy\_find\_descr\_for\_scalar. +* [#27673](https://github.com/numpy/numpy/pull/27673): BUG: fixes for StringDType/unicode promoters diff --git a/corpus/changelog/numpy_releases/numpy_220.md b/corpus/changelog/numpy_releases/numpy_220.md new file mode 100644 index 0000000000000000000000000000000000000000..5a2e2b143dacf9b8d87498f0baace9186a362364 --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_220.md @@ -0,0 +1,180 @@ +# NumPy 2.2.0 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.2.0-notes.html +Version: 2.2.0 + +The NumPy 2.2.0 release is quick release that brings us back into sync with the +usual twice yearly release cycle. There have been an number of small cleanups, +as well as work bringing the new StringDType to completion and improving support +for free threaded Python. Highlights are: + +* New functions `matvec` and `vecmat`, see below. +* Many improved annotations. +* Improved support for the new StringDType. +* Improved support for free threaded Python +* Fixes for f2py + +This release supports Python versions 3.10-3.13. + +## Deprecations[#](#deprecations "Link to this heading") + +* `_add_newdoc_ufunc` is now deprecated. `ufunc.__doc__ = newdoc` should + be used instead. + + ([gh-27735](https://github.com/numpy/numpy/pull/27735)) + +## Expired deprecations[#](#expired-deprecations "Link to this heading") + +* `bool(np.array([]))` and other empty arrays will now raise an error. + Use `arr.size > 0` instead to check whether an array has no elements. + + ([gh-27160](https://github.com/numpy/numpy/pull/27160)) + +## Compatibility notes[#](#compatibility-notes "Link to this heading") + +* [`numpy.cov`](../reference/generated/numpy.cov.html#numpy.cov "numpy.cov") now properly transposes single-row (2d array) design matrices + when `rowvar=False`. Previously, single-row design matrices would return a + scalar in this scenario, which is not correct, so this is a behavior change + and an array of the appropriate shape will now be returned. + + ([gh-27661](https://github.com/numpy/numpy/pull/27661)) + +## New Features[#](#new-features "Link to this heading") + +* New functions for matrix-vector and vector-matrix products + + Two new generalized ufuncs were defined: + + + [`numpy.matvec`](../reference/generated/numpy.matvec.html#numpy.matvec "numpy.matvec") - matrix-vector product, treating the arguments as + stacks of matrices and column vectors, respectively. + + [`numpy.vecmat`](../reference/generated/numpy.vecmat.html#numpy.vecmat "numpy.vecmat") - vector-matrix product, treating the arguments as + stacks of column vectors and matrices, respectively. For complex + vectors, the conjugate is taken. + + These add to the existing [`numpy.matmul`](../reference/generated/numpy.matmul.html#numpy.matmul "numpy.matmul") as well as to [`numpy.vecdot`](../reference/generated/numpy.vecdot.html#numpy.vecdot "numpy.vecdot"), + which was added in numpy 2.0. + + Note that [`numpy.matmul`](../reference/generated/numpy.matmul.html#numpy.matmul "numpy.matmul") never takes a complex conjugate, also not + when its left input is a vector, while both [`numpy.vecdot`](../reference/generated/numpy.vecdot.html#numpy.vecdot "numpy.vecdot") and + [`numpy.vecmat`](../reference/generated/numpy.vecmat.html#numpy.vecmat "numpy.vecmat") do take the conjugate for complex vectors on the + left-hand side (which are taken to be the ones that are transposed, + following the physics convention). + + ([gh-25675](https://github.com/numpy/numpy/pull/25675)) +* `np.complexfloating[T, T]` can now also be written as + `np.complexfloating[T]` + + ([gh-27420](https://github.com/numpy/numpy/pull/27420)) +* UFuncs now support `__dict__` attribute and allow overriding `__doc__` + (either directly or via `ufunc.__dict__["__doc__"]`). `__dict__` can be + used to also override other properties, such as `__module__` or + `__qualname__`. + + ([gh-27735](https://github.com/numpy/numpy/pull/27735)) +* The “nbit” type parameter of `np.number` and its subtypes now defaults + to `typing.Any`. This way, type-checkers will infer annotations such as + `x: np.floating` as `x: np.floating[Any]`, even in strict mode. + + ([gh-27736](https://github.com/numpy/numpy/pull/27736)) + +## Improvements[#](#improvements "Link to this heading") + +* The `datetime64` and `timedelta64` hashes now correctly match the Pythons + builtin `datetime` and `timedelta` ones. The hashes now evaluated equal + even for equal values with different time units. + + ([gh-14622](https://github.com/numpy/numpy/pull/14622)) +* Fixed a number of issues around promotion for string ufuncs with StringDType + arguments. Mixing StringDType and the fixed-width DTypes using the string + ufuncs should now generate much more uniform results. + + ([gh-27636](https://github.com/numpy/numpy/pull/27636)) +* Improved support for empty [`memmap`](../reference/generated/numpy.memmap.html#numpy.memmap "numpy.memmap"). Previously an empty [`memmap`](../reference/generated/numpy.memmap.html#numpy.memmap "numpy.memmap") would fail + unless a non-zero `offset` was set. Now a zero-size [`memmap`](../reference/generated/numpy.memmap.html#numpy.memmap "numpy.memmap") is supported + even if `offset=0`. To achieve this, if a [`memmap`](../reference/generated/numpy.memmap.html#numpy.memmap "numpy.memmap") is mapped to an empty + file that file is padded with a single byte. + + ([gh-27723](https://github.com/numpy/numpy/pull/27723)) + +### `f2py` handles multiple modules and exposes variables again[#](#f2py-handles-multiple-modules-and-exposes-variables-again "Link to this heading") + +A regression has been fixed which allows F2PY users to expose variables to +Python in modules with only assignments, and also fixes situations where +multiple modules are present within a single source file. + +([gh-27695](https://github.com/numpy/numpy/pull/27695)) + +## Performance improvements and changes[#](#performance-improvements-and-changes "Link to this heading") + +* Improved multithreaded scaling on the free-threaded build when many threads + simultaneously call the same ufunc operations. + + ([gh-27896](https://github.com/numpy/numpy/pull/27896)) +* NumPy now uses fast-on-failure attribute lookups for protocols. This can + greatly reduce overheads of function calls or array creation especially with + custom Python objects. The largest improvements will be seen on Python 3.12 + or newer. + + ([gh-27119](https://github.com/numpy/numpy/pull/27119)) +* OpenBLAS on x86\_64 and i686 is built with fewer kernels. Based on + benchmarking, there are 5 clusters of performance around these kernels: + `PRESCOTT NEHALEM SANDYBRIDGE HASWELL SKYLAKEX`. +* OpenBLAS on windows is linked without quadmath, simplifying licensing +* Due to a regression in OpenBLAS on windows, the performance improvements + when using multiple threads for OpenBLAS 0.3.26 were reverted. + + ([gh-27147](https://github.com/numpy/numpy/pull/27147)) +* NumPy now indicates hugepages also for large `np.zeros` allocations + on linux. Thus should generally improve performance. + + ([gh-27808](https://github.com/numpy/numpy/pull/27808)) + +## Changes[#](#changes "Link to this heading") + +* [`numpy.fix`](../reference/generated/numpy.fix.html#numpy.fix "numpy.fix") now won’t perform casting to a floating data-type for integer + and boolean data-type input arrays. + + ([gh-26766](https://github.com/numpy/numpy/pull/26766)) +* The type annotations of `numpy.float64` and `numpy.complex128` now + reflect that they are also subtypes of the built-in `float` and `complex` + types, respectively. This update prevents static type-checkers from reporting + errors in cases such as: + + ```None + x: float = numpy.float64(6.28) # valid + z: complex = numpy.complex128(-1j) # valid + ``` + + ([gh-27334](https://github.com/numpy/numpy/pull/27334)) +* The `repr` of arrays large enough to be summarized (i.e., where elements + are replaced with `...`) now includes the `shape` of the array, similar + to what already was the case for arrays with zero size and non-obvious + shape. With this change, the shape is always given when it cannot be + inferred from the values. Note that while written as `shape=...`, this + argument cannot actually be passed in to the `np.array` constructor. If + you encounter problems, e.g., due to failing doctests, you can use the print + option `legacy=2.1` to get the old behaviour. + + ([gh-27482](https://github.com/numpy/numpy/pull/27482)) +* Calling `__array_wrap__` directly on NumPy arrays or scalars now does the + right thing when `return_scalar` is passed (Added in NumPy 2). It is + further safe now to call the scalar `__array_wrap__` on a non-scalar + result. + + ([gh-27807](https://github.com/numpy/numpy/pull/27807)) + +Bump the musllinux CI image and wheels to 1\_2 from 1\_1. This is because 1\_1 is +[end of life](https://github.com/pypa/manylinux/issues/1629). + +([gh-27088](https://github.com/numpy/numpy/pull/27088)) + +### NEP 50 promotion state option removed[#](#nep-50-promotion-state-option-removed "Link to this heading") + +The NEP 50 promotion state settings are now removed. They were always meant as +temporary means for testing. A warning will be given if the environment +variable is set to anything but `NPY_PROMOTION_STATE=weak` while +`_set_promotion_state` and `_get_promotion_state` are removed. In case +code used `_no_nep50_warning`, a `contextlib.nullcontext` could be used to +replace it when not available. + +([gh-27156](https://github.com/numpy/numpy/pull/27156)) diff --git a/corpus/changelog/numpy_releases/numpy_221.md b/corpus/changelog/numpy_releases/numpy_221.md new file mode 100644 index 0000000000000000000000000000000000000000..d06723c9d08ba32777aa04a7967ff4c2a851fc69 --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_221.md @@ -0,0 +1,48 @@ +# NumPy 2.2.1 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.2.1-notes.html +Version: 2.2.1 + +NumPy 2.2.1 is a patch release following 2.2.0. It fixes bugs found after the +2.2.0 release and has several maintenance pins to work around upstream changes. + +There was some breakage in downstream projects following the 2.2.0 release due +to updates to NumPy typing. Because of problems due to MyPy defects, we +recommend using basedpyright for type checking, it can be installed from +PyPI. The Pylance extension for Visual Studio Code is also based on Pyright. +Problems that persist when using basedpyright should be reported as issues +on the NumPy github site. + +This release supports Python 3.10-3.13. + +## Contributors[#](#contributors "Link to this heading") + +A total of 9 people contributed to this release. People with a “+” by their +names contributed a patch for the first time. + +* Charles Harris +* Joren Hammudoglu +* Matti Picus +* Nathan Goldbaum +* Peter Hawkins +* Simon Altrogge +* Thomas A Caswell +* Warren Weckesser +* Yang Wang + + +## Pull requests merged[#](#pull-requests-merged "Link to this heading") + +A total of 12 pull requests were merged for this release. + +* [#27935](https://github.com/numpy/numpy/pull/27935): MAINT: Prepare 2.2.x for further development +* [#27950](https://github.com/numpy/numpy/pull/27950): TEST: cleanups [skip cirrus][skip azp] +* [#27958](https://github.com/numpy/numpy/pull/27958): BUG: fix use-after-free error in npy\_hashtable.cpp (#27955) +* [#27959](https://github.com/numpy/numpy/pull/27959): BLD: add missing include +* [#27982](https://github.com/numpy/numpy/pull/27982): BUG:fix compile error libatomic link test to meson.build +* [#27990](https://github.com/numpy/numpy/pull/27990): TYP: Fix falsely rejected value types in `ndarray.__setitem__` +* [#27991](https://github.com/numpy/numpy/pull/27991): MAINT: Don’t wrap `#include ` with `extern "C"` +* [#27993](https://github.com/numpy/numpy/pull/27993): BUG: Fix segfault in stringdtype lexsort +* [#28006](https://github.com/numpy/numpy/pull/28006): MAINT: random: Tweak module code in mtrand.pyx to fix a Cython… +* [#28007](https://github.com/numpy/numpy/pull/28007): BUG: Cython API was missing NPY\_UINTP. +* [#28021](https://github.com/numpy/numpy/pull/28021): CI: pin scipy-doctest to 1.5.1 +* [#28044](https://github.com/numpy/numpy/pull/28044): TYP: allow `None` in operand sequence of nditer diff --git a/corpus/changelog/numpy_releases/numpy_222.md b/corpus/changelog/numpy_releases/numpy_222.md new file mode 100644 index 0000000000000000000000000000000000000000..ffb35155b631dff1572a87351fa2e3597fd30824 --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_222.md @@ -0,0 +1,43 @@ +# NumPy 2.2.2 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.2.2-notes.html +Version: 2.2.2 + +NumPy 2.2.2 is a patch release that fixes bugs found after the 2.2.1 release. +The number of typing fixes/updates is notable. This release supports Python +versions 3.10-3.13. + +## Contributors[#](#contributors "Link to this heading") + +A total of 8 people contributed to this release. People with a “+” by their +names contributed a patch for the first time. + +* Alicia Boya García + +* Charles Harris +* Joren Hammudoglu +* Kai Germaschewski + +* Nathan Goldbaum +* PTUsumit + +* Rohit Goswami +* Sebastian Berg + +## Pull requests merged[#](#pull-requests-merged "Link to this heading") + +A total of 16 pull requests were merged for this release. + +* [#28050](https://github.com/numpy/numpy/pull/28050): MAINT: Prepare 2.2.x for further development +* [#28055](https://github.com/numpy/numpy/pull/28055): TYP: fix `void` arrays not accepting `str` keys in `__setitem__` +* [#28066](https://github.com/numpy/numpy/pull/28066): TYP: fix unnecessarily broad `integer` binop return types (#28065) +* [#28112](https://github.com/numpy/numpy/pull/28112): TYP: Better `ndarray` binop return types for `float64` &… +* [#28113](https://github.com/numpy/numpy/pull/28113): TYP: Return the correct `bool` from `issubdtype` +* [#28114](https://github.com/numpy/numpy/pull/28114): TYP: Always accept `date[time]` in the `datetime64` constructor +* [#28120](https://github.com/numpy/numpy/pull/28120): BUG: Fix auxdata initialization in ufunc slow path +* [#28131](https://github.com/numpy/numpy/pull/28131): BUG: move reduction initialization to ufunc initialization +* [#28132](https://github.com/numpy/numpy/pull/28132): TYP: Fix `interp` to accept and return scalars +* [#28137](https://github.com/numpy/numpy/pull/28137): BUG: call PyType\_Ready in f2py to avoid data races +* [#28145](https://github.com/numpy/numpy/pull/28145): BUG: remove unnecessary call to PyArray\_UpdateFlags +* [#28160](https://github.com/numpy/numpy/pull/28160): BUG: Avoid data race in PyArray\_CheckFromAny\_int +* [#28175](https://github.com/numpy/numpy/pull/28175): BUG: Fix f2py directives and –lower casing +* [#28176](https://github.com/numpy/numpy/pull/28176): TYP: Fix overlapping overloads issue in 2->1 ufuncs +* [#28177](https://github.com/numpy/numpy/pull/28177): TYP: preserve shape-type in ndarray.astype() +* [#28178](https://github.com/numpy/numpy/pull/28178): TYP: Fix missing and spurious top-level exports diff --git a/corpus/changelog/numpy_releases/numpy_223.md b/corpus/changelog/numpy_releases/numpy_223.md new file mode 100644 index 0000000000000000000000000000000000000000..4057e5853c977f2f0d9ce42799ee0854c4809bd8 --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_223.md @@ -0,0 +1,52 @@ +# NumPy 2.2.3 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.2.3-notes.html +Version: 2.2.3 + +NumPy 2.2.3 is a patch release that fixes bugs found after the 2.2.2 release. +The majority of the changes are typing improvements and fixes for free +threaded Python. Both of those areas are still under development, so if you +discover new problems, please report them. + +This release supports Python versions 3.10-3.13. + +## Contributors[#](#contributors "Link to this heading") + +A total of 9 people contributed to this release. People with a “+” by their +names contributed a patch for the first time. + +* !amotzop +* Charles Harris +* Chris Sidebottom +* Joren Hammudoglu +* Matthew Brett +* Nathan Goldbaum +* Raghuveer Devulapalli +* Sebastian Berg +* Yakov Danishevsky + + +## Pull requests merged[#](#pull-requests-merged "Link to this heading") + +A total of 21 pull requests were merged for this release. + +* [#28185](https://github.com/numpy/numpy/pull/28185): MAINT: Prepare 2.2.x for further development +* [#28201](https://github.com/numpy/numpy/pull/28201): BUG: fix data race in a more minimal way on stable branch +* [#28208](https://github.com/numpy/numpy/pull/28208): BUG: Fix `from_float_positional` errors for huge pads +* [#28209](https://github.com/numpy/numpy/pull/28209): BUG: fix data race in np.repeat +* [#28212](https://github.com/numpy/numpy/pull/28212): MAINT: Use VQSORT\_COMPILER\_COMPATIBLE to determine if we should… +* [#28224](https://github.com/numpy/numpy/pull/28224): MAINT: update highway to latest +* [#28236](https://github.com/numpy/numpy/pull/28236): BUG: Add cpp atomic support (#28234) +* [#28237](https://github.com/numpy/numpy/pull/28237): BLD: Compile fix for clang-cl on WoA +* [#28243](https://github.com/numpy/numpy/pull/28243): TYP: Avoid upcasting `float64` in the set-ops +* [#28249](https://github.com/numpy/numpy/pull/28249): BLD: better fix for clang / ARM compiles +* [#28266](https://github.com/numpy/numpy/pull/28266): TYP: Fix `timedelta64.__divmod__` and `timedelta64.__mod__`… +* [#28274](https://github.com/numpy/numpy/pull/28274): TYP: Fixed missing typing information of set\_printoptions +* [#28278](https://github.com/numpy/numpy/pull/28278): BUG: backport resource cleanup bugfix from gh-28273 +* [#28282](https://github.com/numpy/numpy/pull/28282): BUG: fix incorrect bytes to stringdtype coercion +* [#28283](https://github.com/numpy/numpy/pull/28283): TYP: Fix scalar constructors +* [#28284](https://github.com/numpy/numpy/pull/28284): TYP: stub `numpy.matlib` +* [#28285](https://github.com/numpy/numpy/pull/28285): TYP: stub the missing `numpy.testing` modules +* [#28286](https://github.com/numpy/numpy/pull/28286): CI: Fix the github label for `TYP:` PR’s and issues +* [#28305](https://github.com/numpy/numpy/pull/28305): TYP: Backport typing updates from main +* [#28321](https://github.com/numpy/numpy/pull/28321): BUG: fix race initializing legacy dtype casts +* [#28324](https://github.com/numpy/numpy/pull/28324): CI: update test\_moderately\_small\_alpha diff --git a/corpus/changelog/numpy_releases/numpy_224.md b/corpus/changelog/numpy_releases/numpy_224.md new file mode 100644 index 0000000000000000000000000000000000000000..e9cdd164f131da5549b76fcb1e7a5a3011bc0a5a --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_224.md @@ -0,0 +1,53 @@ +# NumPy 2.2.4 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.2.4-notes.html +Version: 2.2.4 + +NumPy 2.2.4 is a patch release that fixes bugs found after the 2.2.3 release. +There are a large number of typing improvements, the rest of the changes are +the usual mix of bug fixes and platform maintenance. + +This release supports Python versions 3.10-3.13. + +## Contributors[#](#contributors "Link to this heading") + +A total of 15 people contributed to this release. People with a “+” by their +names contributed a patch for the first time. + +* Abhishek Kumar +* Andrej Zhilenkov +* Andrew Nelson +* Charles Harris +* Giovanni Del Monte +* Guan Ming(Wesley) Chiu + +* Jonathan Albrecht + +* Joren Hammudoglu +* Mark Harfouche +* Matthieu Darbois +* Nathan Goldbaum +* Pieter Eendebak +* Sebastian Berg +* Tyler Reddy +* lvllvl + + +## Pull requests merged[#](#pull-requests-merged "Link to this heading") + +A total of 17 pull requests were merged for this release. + +* [#28333](https://github.com/numpy/numpy/pull/28333): MAINT: Prepare 2.2.x for further development. +* [#28348](https://github.com/numpy/numpy/pull/28348): TYP: fix positional- and keyword-only params in astype, cross… +* [#28377](https://github.com/numpy/numpy/pull/28377): MAINT: Update FreeBSD version and fix test failure +* [#28379](https://github.com/numpy/numpy/pull/28379): BUG: numpy.loadtxt reads only 50000 lines when skip\_rows >= max\_rows +* [#28385](https://github.com/numpy/numpy/pull/28385): BUG: Make np.nonzero threading safe +* [#28420](https://github.com/numpy/numpy/pull/28420): BUG: safer bincount casting (backport to 2.2.x) +* [#28422](https://github.com/numpy/numpy/pull/28422): BUG: Fix building on s390x with clang +* [#28423](https://github.com/numpy/numpy/pull/28423): CI: use QEMU 9.2.2 for Linux Qemu tests +* [#28424](https://github.com/numpy/numpy/pull/28424): BUG: skip legacy dtype multithreaded test on 32 bit runners +* [#28435](https://github.com/numpy/numpy/pull/28435): BUG: Fix searchsorted and CheckFromAny byte-swapping logic +* [#28449](https://github.com/numpy/numpy/pull/28449): BUG: sanity check `__array_interface__` number of dimensions +* [#28510](https://github.com/numpy/numpy/pull/28510): MAINT: Hide decorator from pytest traceback +* [#28512](https://github.com/numpy/numpy/pull/28512): TYP: Typing fixes backported from #28452, #28491, #28494 +* [#28521](https://github.com/numpy/numpy/pull/28521): TYP: Backport fixes from #28505, #28506, #28508, and #28511 +* [#28533](https://github.com/numpy/numpy/pull/28533): TYP: Backport typing fixes from main (2) +* [#28534](https://github.com/numpy/numpy/pull/28534): TYP: Backport typing fixes from main (3) +* [#28542](https://github.com/numpy/numpy/pull/28542): TYP: Backport typing fixes from main (4) diff --git a/corpus/changelog/numpy_releases/numpy_225.md b/corpus/changelog/numpy_releases/numpy_225.md new file mode 100644 index 0000000000000000000000000000000000000000..208874e8a61071b20eecdb1e82d5c437eb7f3af4 --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_225.md @@ -0,0 +1,47 @@ +# NumPy 2.2.5 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.2.5-notes.html +Version: 2.2.5 + +NumPy 2.2.5 is a patch release that fixes bugs found after the 2.2.4 release. +It has a large number of typing fixes/improvements as well as the normal bug +fixes and some CI maintenance. + +This release supports Python versions 3.10-3.13. + +## Contributors[#](#contributors "Link to this heading") + +A total of 7 people contributed to this release. People with a “+” by their +names contributed a patch for the first time. + +* Charles Harris +* Joren Hammudoglu +* Baskar Gopinath + +* Nathan Goldbaum +* Nicholas Christensen + +* Sayed Adel +* karl + + +## Pull requests merged[#](#pull-requests-merged "Link to this heading") + +A total of 19 pull requests were merged for this release. + +* [#28545](https://github.com/numpy/numpy/pull/28545): MAINT: Prepare 2.2.x for further development +* [#28582](https://github.com/numpy/numpy/pull/28582): BUG: Fix return type of NpyIter\_GetIterNext in Cython declarations +* [#28583](https://github.com/numpy/numpy/pull/28583): BUG: avoid deadlocks with C++ shared mutex in dispatch cache +* [#28585](https://github.com/numpy/numpy/pull/28585): TYP: fix typing errors in `_core.strings` +* [#28631](https://github.com/numpy/numpy/pull/28631): MAINT, CI: Update Ubuntu to 22.04 in azure-pipelines +* [#28632](https://github.com/numpy/numpy/pull/28632): BUG: Set writeable flag for writeable dlpacks. +* [#28633](https://github.com/numpy/numpy/pull/28633): BUG: Fix crackfortran parsing error when a division occurs within… +* [#28650](https://github.com/numpy/numpy/pull/28650): TYP: fix `ndarray.tolist()` and `.item()` for unknown dtype +* [#28654](https://github.com/numpy/numpy/pull/28654): BUG: fix deepcopying StringDType arrays (#28643) +* [#28661](https://github.com/numpy/numpy/pull/28661): TYP: Accept objects that `write()` to `str` in `savetxt` +* [#28663](https://github.com/numpy/numpy/pull/28663): CI: Replace QEMU armhf with native (32-bit compatibility mode) +* [#28682](https://github.com/numpy/numpy/pull/28682): SIMD: Resolve Highway QSort symbol linking error on aarch32/ASIMD +* [#28683](https://github.com/numpy/numpy/pull/28683): TYP: add missing `"b1"` literals for `dtype[bool]` +* [#28705](https://github.com/numpy/numpy/pull/28705): TYP: Fix false rejection of `NDArray[object_].__abs__()` +* [#28706](https://github.com/numpy/numpy/pull/28706): TYP: Fix inconsistent `NDArray[float64].__[r]truediv__` return… +* [#28723](https://github.com/numpy/numpy/pull/28723): TYP: fix string-like `ndarray` rich comparison operators +* [#28758](https://github.com/numpy/numpy/pull/28758): TYP: some `[arg]partition` fixes +* [#28772](https://github.com/numpy/numpy/pull/28772): TYP: fix incorrect `random.Generator.integers` return type +* [#28774](https://github.com/numpy/numpy/pull/28774): TYP: fix `count_nonzero` signature diff --git a/corpus/changelog/numpy_releases/numpy_226.md b/corpus/changelog/numpy_releases/numpy_226.md new file mode 100644 index 0000000000000000000000000000000000000000..d652a337b0ade47aaa35c2c78e2261da72defe66 --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_226.md @@ -0,0 +1,40 @@ +# NumPy 2.2.6 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.2.6-notes.html +Version: 2.2.6 + +NumPy 2.2.6 is a patch release that fixes bugs found after the 2.2.5 release. +It is a mix of typing fixes/improvements as well as the normal bug +fixes and some CI maintenance. + +This release supports Python versions 3.10-3.13. + +## Contributors[#](#contributors "Link to this heading") + +A total of 8 people contributed to this release. People with a “+” by their +names contributed a patch for the first time. + +* Charles Harris +* Ilhan Polat +* Joren Hammudoglu +* Marco Gorelli + +* Matti Picus +* Nathan Goldbaum +* Peter Hawkins +* Sayed Adel + +## Pull requests merged[#](#pull-requests-merged "Link to this heading") + +A total of 11 pull requests were merged for this release. + +* [#28778](https://github.com/numpy/numpy/pull/28778): MAINT: Prepare 2.2.x for further development +* [#28851](https://github.com/numpy/numpy/pull/28851): BLD: Update vendor-meson to fix module\_feature conflicts arguments… +* [#28852](https://github.com/numpy/numpy/pull/28852): BUG: fix heap buffer overflow in np.strings.find +* [#28853](https://github.com/numpy/numpy/pull/28853): TYP: fix `NDArray[floating] + float` return type +* [#28864](https://github.com/numpy/numpy/pull/28864): BUG: fix stringdtype singleton thread safety +* [#28865](https://github.com/numpy/numpy/pull/28865): MAINT: use OpenBLAS 0.3.29 +* [#28889](https://github.com/numpy/numpy/pull/28889): MAINT: from\_dlpack thread safety fixes +* [#28913](https://github.com/numpy/numpy/pull/28913): TYP: Fix non-existent `CanIndex` annotation in `ndarray.setfield` +* [#28915](https://github.com/numpy/numpy/pull/28915): MAINT: Avoid dereferencing/strict aliasing warnings +* [#28916](https://github.com/numpy/numpy/pull/28916): BUG: Fix missing check for PyErr\_Occurred() in \_pyarray\_correlate. +* [#28966](https://github.com/numpy/numpy/pull/28966): TYP: reject complex scalar types in ndarray.\_\_ifloordiv\_\_ diff --git a/corpus/changelog/numpy_releases/numpy_230.md b/corpus/changelog/numpy_releases/numpy_230.md new file mode 100644 index 0000000000000000000000000000000000000000..27a6f96f45179e8698dd93beaddc8072bcfc9728 --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_230.md @@ -0,0 +1,468 @@ +# NumPy 2.3.0 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.3.0-notes.html +Version: 2.3.0 + +The NumPy 2.3.0 release continues the work to improve free threaded Python +support and annotations together with the usual set of bug fixes. It is unusual +in the number of expired deprecations, code modernizations, and style cleanups. +The latter may not be visible to users, but is important for code maintenance +over the long term. Note that we have also upgraded from manylinux2014 to +manylinux\_2\_28. + +Users running on a Mac having an M4 cpu might see various warnings about +invalid values and such. The warnings are a known problem with Accelerate. +They are annoying, but otherwise harmless. Apple promises to fix them. + +This release supports Python versions 3.11-3.13, Python 3.14 will be supported +when it is released. + +## Highlights[#](#highlights "Link to this heading") + +* Interactive examples in the NumPy documentation. +* Building NumPy with OpenMP Parallelization. +* Preliminary support for Windows on ARM. +* Improved support for free threaded Python. +* Improved annotations. + +## New functions[#](#new-functions "Link to this heading") + +### New function `numpy.strings.slice`[#](#new-function-numpy-strings-slice "Link to this heading") + +The new function `numpy.strings.slice` was added, which implements fast +native slicing of string arrays. It supports the full slicing API including +negative slice offsets and steps. + +([gh-27789](https://github.com/numpy/numpy/pull/27789)) + +## Deprecations[#](#deprecations "Link to this heading") + +* The `numpy.typing.mypy_plugin` has been deprecated in favor of platform-agnostic + static type inference. Please remove `numpy.typing.mypy_plugin` from the `plugins` + section of your mypy configuration. If this change results in new errors being + reported, kindly open an issue. + + ([gh-28129](https://github.com/numpy/numpy/pull/28129)) +* The `numpy.typing.NBitBase` type has been deprecated and will be removed in + a future version. + + This type was previously intended to be used as a generic upper bound for + type-parameters, for example: + + ```None + import numpy as np + import numpy.typing as npt + + def f[NT: npt.NBitBase](x: np.complexfloating[NT]) -> np.floating[NT]: ... + ``` + + But in NumPy 2.2.0, `float64` and `complex128` were changed to concrete + subtypes, causing static type-checkers to reject `x: np.float64 = + f(np.complex128(42j))`. + + So instead, the better approach is to use `typing.overload`: + + ```None + import numpy as np + from typing import overload + + @overload + def f(x: np.complex64) -> np.float32: ... + @overload + def f(x: np.complex128) -> np.float64: ... + @overload + def f(x: np.clongdouble) -> np.longdouble: ... + ``` + + ([gh-28884](https://github.com/numpy/numpy/pull/28884)) + +## Expired deprecations[#](#expired-deprecations "Link to this heading") + +* Remove deprecated macros like `NPY_OWNDATA` from Cython interfaces in favor + of `NPY_ARRAY_OWNDATA` (deprecated since 1.7) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* Remove `numpy/npy_1_7_deprecated_api.h` and C macros like `NPY_OWNDATA` + in favor of `NPY_ARRAY_OWNDATA` (deprecated since 1.7) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* Remove alias `generate_divbyzero_error` to + `npy_set_floatstatus_divbyzero` and `generate_overflow_error` to + `npy_set_floatstatus_overflow` (deprecated since 1.10) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* Remove `np.tostring` (deprecated since 1.19) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* Raise on `np.conjugate` of non-numeric types (deprecated since 1.13) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* Raise when using `np.bincount(...minlength=None)`, use 0 instead + (deprecated since 1.14) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* Passing `shape=None` to functions with a non-optional shape argument + errors, use `()` instead (deprecated since 1.20) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* Inexact matches for `mode` and `searchside` raise (deprecated since 1.20) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* Setting `__array_finalize__ = None` errors (deprecated since 1.23) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* `np.fromfile` and `np.fromstring` error on bad data, previously they + would guess (deprecated since 1.18) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* `datetime64` and `timedelta64` construction with a tuple no longer + accepts an `event` value, either use a two-tuple of (unit, num) or a + 4-tuple of (unit, num, den, 1) (deprecated since 1.14) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* When constructing a `dtype` from a class with a `dtype` attribute, that + attribute must be a dtype-instance rather than a thing that can be parsed as + a dtype instance (deprecated in 1.19). At some point the whole construct of + using a dtype attribute will be deprecated (see #25306) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* Passing booleans as partition index errors (deprecated since 1.23) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* Out-of-bounds indexes error even on empty arrays (deprecated since 1.20) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* `np.tostring` has been removed, use `tobytes` instead (deprecated since 1.19) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* Disallow make a non-writeable array writeable for arrays with a base that do + not own their data (deprecated since 1.17) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* `concatenate()` with `axis=None` uses `same-kind` casting by default, + not `unsafe` (deprecated since 1.20) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* Unpickling a scalar with object dtype errors (deprecated since 1.20) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* The binary mode of `fromstring` now errors, use `frombuffer` instead + (deprecated since 1.14) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* Converting `np.inexact` or `np.floating` to a dtype errors (deprecated + since 1.19) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* Converting `np.complex`, `np.integer`, `np.signedinteger`, + `np.unsignedinteger`, `np.generic` to a dtype errors (deprecated since + 1.19) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* The Python built-in `round` errors for complex scalars. Use `np.round` or + `scalar.round` instead (deprecated since 1.19) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* ‘np.bool’ scalars can no longer be interpreted as an index (deprecated since 1.19) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* Parsing an integer via a float string is no longer supported. (deprecated + since 1.23) To avoid this error you can + \* make sure the original data is stored as integers. + \* use the `converters=float` keyword argument. + \* Use `np.loadtxt(...).astype(np.int64)` + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* The use of a length 1 tuple for the ufunc `signature` errors. Use `dtype` + or fill the tuple with `None` (deprecated since 1.19) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* Special handling of matrix is in np.outer is removed. Convert to a ndarray + via `matrix.A` (deprecated since 1.20) + + ([gh-28254](https://github.com/numpy/numpy/pull/28254)) +* Removed the `np.compat` package source code (removed in 2.0) + + ([gh-28961](https://github.com/numpy/numpy/pull/28961)) + +## C API changes[#](#c-api-changes "Link to this heading") + +* `NpyIter_GetTransferFlags` is now available to check if + the iterator needs the Python API or if casts may cause floating point + errors (FPE). FPEs can for example be set when casting `float64(1e300)` + to `float32` (overflow to infinity) or a NaN to an integer (invalid value). + + ([gh-27883](https://github.com/numpy/numpy/pull/27883)) +* `NpyIter` now has no limit on the number of operands it supports. + + ([gh-28080](https://github.com/numpy/numpy/pull/28080)) + +### New `NpyIter_GetTransferFlags` and `NpyIter_IterationNeedsAPI` change[#](#new-npyiter-gettransferflags-and-npyiter-iterationneedsapi-change "Link to this heading") + +NumPy now has the new `NpyIter_GetTransferFlags` function as a more precise +way checking of iterator/buffering needs. I.e. whether the Python API/GIL is +required or floating point errors may occur. +This function is also faster if you already know your needs without buffering. + +The `NpyIter_IterationNeedsAPI` function now performs all the checks that were +previously performed at setup time. While it was never necessary to call it +multiple times, doing so will now have a larger cost. + +([gh-27998](https://github.com/numpy/numpy/pull/27998)) + +## New Features[#](#new-features "Link to this heading") + +* The type parameter of `np.dtype` now defaults to `typing.Any`. + This way, static type-checkers will infer `dtype: np.dtype` as + `dtype: np.dtype[Any]`, without reporting an error. + + ([gh-28669](https://github.com/numpy/numpy/pull/28669)) +* Static type-checkers now interpret: + + + `_: np.ndarray` as `_: npt.NDArray[typing.Any]`. + + `_: np.flatiter` as `_: np.flatiter[np.ndarray]`. + + This is because their type parameters now have default values. + + ([gh-28940](https://github.com/numpy/numpy/pull/28940)) + +### NumPy now registers its pkg-config paths with the [pkgconf](https://github.com/pypackaging-native/pkgconf-pypi) PyPI package[#](#numpy-now-registers-its-pkg-config-paths-with-the-pkgconf-pypi-package "Link to this heading") + +The [pkgconf](https://github.com/pypackaging-native/pkgconf-pypi) PyPI package provides an interface for projects like NumPy to +register their own paths to be added to the pkg-config search path. This means +that when using [pkgconf](https://github.com/pypackaging-native/pkgconf-pypi) from PyPI, NumPy will be discoverable without needing +for any custom environment configuration. + +Attention + +Attention + +This only applies when using the [pkgconf](https://github.com/pypackaging-native/pkgconf-pypi) package from [PyPI](https://pypi.org/), or put another +way, this only applies when installing [pkgconf](https://github.com/pypackaging-native/pkgconf-pypi) via a Python package +manager. + +If you are using `pkg-config` or `pkgconf` provided by your system, or +any other source that does not use the [pkgconf-pypi](https://github.com/pypackaging-native/pkgconf-pypi) project, the NumPy +pkg-config directory will not be automatically added to the search path. In +these situations, you might want to use `numpy-config`. + +([gh-28214](https://github.com/numpy/numpy/pull/28214)) + +### Allow `out=...` in ufuncs to ensure array result[#](#allow-out-in-ufuncs-to-ensure-array-result "Link to this heading") + +NumPy has the sometimes difficult behavior that it currently usually +returns scalars rather than 0-D arrays (even if the inputs were 0-D arrays). +This is especially problematic for non-numerical dtypes (e.g. `object`). + +For ufuncs (i.e. most simple math functions) it is now possible to use +`out=...` (literally `…`, e.g. `out=Ellipsis`) which is identical in +behavior to `out` not being passed, but will ensure a non-scalar return. +This spelling is borrowed from `arr1d[0, ...]` where the `...` also ensures +a non-scalar return. + +Other functions with an `out=` kwarg should gain support eventually. +Downstream libraries that interoperate via `__array_ufunc__` or +`__array_function__` may need to adapt to support this. + +([gh-28576](https://github.com/numpy/numpy/pull/28576)) + +### Building NumPy with OpenMP Parallelization[#](#building-numpy-with-openmp-parallelization "Link to this heading") + +NumPy now supports OpenMP parallel processing capabilities when built with the +`-Denable_openmp=true` Meson build flag. This feature is disabled by default. +When enabled, `np.sort` and `np.argsort` functions can utilize OpenMP for +parallel thread execution, improving performance for these operations. + +([gh-28619](https://github.com/numpy/numpy/pull/28619)) + +### Interactive examples in the NumPy documentation[#](#interactive-examples-in-the-numpy-documentation "Link to this heading") + +The NumPy documentation includes a number of examples that +can now be run interactively in your browser using WebAssembly +and Pyodide. + +Please note that the examples are currently experimental in +nature and may not work as expected for all methods in the +public API. + +([gh-26745](https://github.com/numpy/numpy/pull/26745)) + +## Improvements[#](#improvements "Link to this heading") + +* Scalar comparisons between non-comparable dtypes such as + `np.array(1) == np.array('s')` now return a NumPy bool instead of + a Python bool. + + ([gh-27288](https://github.com/numpy/numpy/pull/27288)) +* `np.nditer` now has no limit on the number of supported operands + (C-integer). + + ([gh-28080](https://github.com/numpy/numpy/pull/28080)) +* No-copy pickling is now supported for any + array that can be transposed to a C-contiguous array. + + ([gh-28105](https://github.com/numpy/numpy/pull/28105)) +* The `__repr__` for user-defined dtypes now prefers the `__name__` of the + custom dtype over a more generic name constructed from its `kind` and + `itemsize`. + + ([gh-28250](https://github.com/numpy/numpy/pull/28250)) +* `np.dot` now reports floating point exceptions. + + ([gh-28442](https://github.com/numpy/numpy/pull/28442)) +* `np.dtypes.StringDType` is now a + [generic type](https://typing.python.org/en/latest/spec/generics.html) which + accepts a type argument for `na_object` that defaults to `typing.Never`. + For example, `StringDType(na_object=None)` returns a `StringDType[None]`, + and `StringDType()` returns a `StringDType[typing.Never]`. + + ([gh-28856](https://github.com/numpy/numpy/pull/28856)) + +### Added warnings to `np.isclose`[#](#added-warnings-to-np-isclose "Link to this heading") + +Added warning messages if at least one of atol or rtol are either `np.nan` or +`np.inf` within `np.isclose`. + +* Warnings follow the user’s `np.seterr` settings + +([gh-28205](https://github.com/numpy/numpy/pull/28205)) + +## Performance improvements and changes[#](#performance-improvements-and-changes "Link to this heading") + +### Performance improvements to `np.unique`[#](#performance-improvements-to-np-unique "Link to this heading") + +`np.unique` now tries to use a hash table to find unique values instead of +sorting values before finding unique values. This is limited to certain dtypes +for now, and the function is now faster for those dtypes. The function now also +exposes a `sorted` parameter to allow returning unique values as they were +found, instead of sorting them afterwards. + +([gh-26018](https://github.com/numpy/numpy/pull/26018)) + +### Performance improvements to `np.sort` and `np.argsort`[#](#performance-improvements-to-np-sort-and-np-argsort "Link to this heading") + +`np.sort` and `np.argsort` functions now can leverage OpenMP for parallel +thread execution, resulting in up to 3.5x speedups on x86 architectures with +AVX2 or AVX-512 instructions. This opt-in feature requires NumPy to be built +with the -Denable\_openmp Meson flag. Users can control the number of threads +used by setting the OMP\_NUM\_THREADS environment variable. + +([gh-28619](https://github.com/numpy/numpy/pull/28619)) + +### Performance improvements for `np.float16` casts[#](#performance-improvements-for-np-float16-casts "Link to this heading") + +Earlier, floating point casts to and from `np.float16` types +were emulated in software on all platforms. + +Now, on ARM devices that support Neon float16 intrinsics (such as +recent Apple Silicon), the native float16 path is used to achieve +the best performance. + +([gh-28769](https://github.com/numpy/numpy/pull/28769)) + +### Performance improvements for `np.matmul`[#](#performance-improvements-for-np-matmul "Link to this heading") + +Enable using BLAS for `matmul` even when operands are non-contiguous by copying +if needed. + +([gh-23752](https://github.com/numpy/numpy/pull/23752)) + +## Changes[#](#changes "Link to this heading") + +* The vector norm `ord=inf` and the matrix norms `ord={1, 2, inf, 'nuc'}` + now always returns zero for empty arrays. Empty arrays have at least one axis + of size zero. This affects `np.linalg.norm`, `np.linalg.vector_norm`, and + `np.linalg.matrix_norm`. Previously, NumPy would raises errors or return + zero depending on the shape of the array. + + ([gh-28343](https://github.com/numpy/numpy/pull/28343)) +* A spelling error in the error message returned when converting a string to a + float with the method `np.format_float_positional` has been fixed. + + ([gh-28569](https://github.com/numpy/numpy/pull/28569)) +* NumPy’s `__array_api_version__` was upgraded from `2023.12` to `2024.12`. +* `numpy.count_nonzero` for `axis=None` (default) now returns a NumPy scalar + instead of a Python integer. +* The parameter `axis` in `numpy.take_along_axis` function has now a default + value of `-1`. + + ([gh-28615](https://github.com/numpy/numpy/pull/28615)) +* Printing of `np.float16` and `np.float32` scalars and arrays have been improved by + adjusting the transition to scientific notation based on the floating point precision. + A new legacy `np.printoptions` mode `'2.2'` has been added for backwards compatibility. + + ([gh-28703](https://github.com/numpy/numpy/pull/28703)) +* Multiplication between a string and integer now raises OverflowError instead + of MemoryError if the result of the multiplication would create a string that + is too large to be represented. This follows Python’s behavior. + + ([gh-29060](https://github.com/numpy/numpy/pull/29060)) + +### `unique_values` may return unsorted data[#](#unique-values-may-return-unsorted-data "Link to this heading") + +The relatively new function (added in NumPy 2.0) `unique_values` may now +return unsorted results. Just as `unique_counts` and `unique_all` these +never guaranteed a sorted result, however, the result was sorted until now. In +cases where these do return a sorted result, this may change in future releases +to improve performance. + +([gh-26018](https://github.com/numpy/numpy/pull/26018)) + +### Changes to the main iterator and potential numerical changes[#](#changes-to-the-main-iterator-and-potential-numerical-changes "Link to this heading") + +The main iterator, used in math functions and via `np.nditer` from Python and +`NpyIter` in C, now behaves differently for some buffered iterations. This +means that: + +* The buffer size used will often be smaller than the maximum buffer sized + allowed by the `buffersize` parameter. +* The “growinner” flag is now honored with buffered reductions when no operand + requires buffering. + +For `np.sum()` such changes in buffersize may slightly change numerical +results of floating point operations. Users who use “growinner” for custom +reductions could notice changes in precision (for example, in NumPy we removed +it from `einsum` to avoid most precision changes and improve precision for +some 64bit floating point inputs). + +([gh-27883](https://github.com/numpy/numpy/pull/27883)) + +### The minimum supported GCC version is now 9.3.0[#](#the-minimum-supported-gcc-version-is-now-9-3-0 "Link to this heading") + +The minimum supported version was updated from 8.4.0 to 9.3.0, primarily in +order to reduce the chance of platform-specific bugs in old GCC versions from +causing issues. + +([gh-28102](https://github.com/numpy/numpy/pull/28102)) + +### Changes to automatic bin selection in numpy.histogram[#](#changes-to-automatic-bin-selection-in-numpy-histogram "Link to this heading") + +The automatic bin selection algorithm in `numpy.histogram` has been modified +to avoid out-of-memory errors for samples with low variation. For full control +over the selected bins the user can use set the `bin` or `range` parameters +of `numpy.histogram`. + +([gh-28426](https://github.com/numpy/numpy/pull/28426)) + +### Build manylinux\_2\_28 wheels[#](#build-manylinux-2-28-wheels "Link to this heading") + +Wheels for linux systems will use the `manylinux_2_28` tag (instead of the +`manylinux2014` tag), which means dropping support for redhat7/centos7, +amazonlinux2, debian9, ubuntu18.04, and other pre-glibc2.28 operating system +versions, as per the [PEP 600 support table](https://github.com/mayeut/pep600_compliance?tab=readme-ov-file#pep600-compliance-check). + +([gh-28436](https://github.com/numpy/numpy/pull/28436)) + +### Remove use of -Wl,-ld\_classic on macOS[#](#remove-use-of-wl-ld-classic-on-macos "Link to this heading") + +Remove use of -Wl,-ld\_classic on macOS. This hack is no longer needed by Spack, +and results in libraries that cannot link to other libraries built with ld +(new). + +([gh-28713](https://github.com/numpy/numpy/pull/28713)) + +### Re-enable overriding functions in the `numpy.strings`[#](#re-enable-overriding-functions-in-the-numpy-strings "Link to this heading") + +Re-enable overriding functions in the `numpy.strings` module. + +([gh-28741](https://github.com/numpy/numpy/pull/28741)) diff --git a/corpus/changelog/numpy_releases/numpy_231.md b/corpus/changelog/numpy_releases/numpy_231.md new file mode 100644 index 0000000000000000000000000000000000000000..d569ff2f75062593b4c382a6af2b0658cc5d8bbd --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_231.md @@ -0,0 +1,47 @@ +# NumPy 2.3.1 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.3.1-notes.html +Version: 2.3.1 + +The NumPy 2.3.1 release is a patch release with several bug fixes, annotation +improvements, and better support for OpenBSD. Highlights are: + +* Fix bug in `matmul` for non-contiguous out kwarg parameter +* Fix for Accelerate runtime warnings on M4 hardware +* Fix new in NumPy 2.3.0 `np.vectorize` casting errors +* Improved support of cpu features for FreeBSD and OpenBSD + +This release supports Python versions 3.11-3.13, Python 3.14 will be supported +when it is released. + +## Contributors[#](#contributors "Link to this heading") + +A total of 9 people contributed to this release. People with a “+” by their +names contributed a patch for the first time. + +* Brad Smith + +* Charles Harris +* Developer-Ecosystem-Engineering +* François Rozet +* Joren Hammudoglu +* Matti Picus +* Mugundan Selvanayagam +* Nathan Goldbaum +* Sebastian Berg + +## Pull requests merged[#](#pull-requests-merged "Link to this heading") + +A total of 12 pull requests were merged for this release. + +* [#29140](https://github.com/numpy/numpy/pull/29140): MAINT: Prepare 2.3.x for further development +* [#29191](https://github.com/numpy/numpy/pull/29191): BUG: fix matmul with transposed out arg (#29179) +* [#29192](https://github.com/numpy/numpy/pull/29192): TYP: Backport typing fixes and improvements. +* [#29205](https://github.com/numpy/numpy/pull/29205): BUG: Revert `np.vectorize` casting to legacy behavior (#29196) +* [#29222](https://github.com/numpy/numpy/pull/29222): TYP: Backport typing fixes +* [#29233](https://github.com/numpy/numpy/pull/29233): BUG: avoid negating unsigned integers in resize implementation… +* [#29234](https://github.com/numpy/numpy/pull/29234): TST: Fix test that uses uninitialized memory (#29232) +* [#29235](https://github.com/numpy/numpy/pull/29235): BUG: Address interaction between SME and FPSR (#29223) +* [#29237](https://github.com/numpy/numpy/pull/29237): BUG: Enforce integer limitation in concatenate (#29231) +* [#29238](https://github.com/numpy/numpy/pull/29238): CI: Add support for building NumPy with LLVM for Win-ARM64 +* [#29241](https://github.com/numpy/numpy/pull/29241): ENH: Detect CPU features on OpenBSD ARM and PowerPC64 +* [#29242](https://github.com/numpy/numpy/pull/29242): ENH: Detect CPU features on FreeBSD / OpenBSD RISC-V64. diff --git a/corpus/changelog/numpy_releases/numpy_232.md b/corpus/changelog/numpy_releases/numpy_232.md new file mode 100644 index 0000000000000000000000000000000000000000..e6c46a638c4fee044b36762ac47c495bc68b8e08 --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_232.md @@ -0,0 +1,49 @@ +# NumPy 2.3.2 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.3.2-notes.html +Version: 2.3.2 + +The NumPy 2.3.2 release is a patch release with a number of bug fixes and +maintenance updates. The highlights are: + +* Wheels for Python 3.14.0rc1 +* PyPy updated to the latest stable release +* OpenBLAS updated to 0.3.30 + +This release supports Python versions 3.11-3.14 + +## Contributors[#](#contributors "Link to this heading") + +A total of 9 people contributed to this release. People with a “+” by their +names contributed a patch for the first time. + +* !DWesl +* Charles Harris +* Joren Hammudoglu +* Maanas Arora +* Marco Edward Gorelli +* Matti Picus +* Nathan Goldbaum +* Sebastian Berg +* kostayScr + + +## Pull requests merged[#](#pull-requests-merged "Link to this heading") + +A total of 16 pull requests were merged for this release. + +* [#29256](https://github.com/numpy/numpy/pull/29256): MAINT: Prepare 2.3.x for further development +* [#29283](https://github.com/numpy/numpy/pull/29283): TYP: Work around a mypy issue with bool arrays (#29248) +* [#29284](https://github.com/numpy/numpy/pull/29284): BUG: fix fencepost error in StringDType internals +* [#29287](https://github.com/numpy/numpy/pull/29287): BUG: handle case in mapiter where descriptors might get replaced… +* [#29350](https://github.com/numpy/numpy/pull/29350): BUG: Fix shape error path in array-interface +* [#29412](https://github.com/numpy/numpy/pull/29412): BUG: Allow reading non-npy files in npz and add test +* [#29413](https://github.com/numpy/numpy/pull/29413): TST: Avoid uninitialized values in test (#29341) +* [#29414](https://github.com/numpy/numpy/pull/29414): BUG: Fix reference leakage for output arrays in reduction functions +* [#29415](https://github.com/numpy/numpy/pull/29415): BUG: fix casting issue in center, ljust, rjust, and zfill (#29369) +* [#29416](https://github.com/numpy/numpy/pull/29416): TYP: Fix overloads in `np.char.array` and `np.char.asarray`… +* [#29417](https://github.com/numpy/numpy/pull/29417): BUG: Any dtype should call `square` on `arr \*\* 2` (#29392) +* [#29424](https://github.com/numpy/numpy/pull/29424): MAINT: use a stable pypy release in CI +* [#29425](https://github.com/numpy/numpy/pull/29425): MAINT: Support python 314rc1 +* [#29429](https://github.com/numpy/numpy/pull/29429): MAINT: Update highway to match main. +* [#29430](https://github.com/numpy/numpy/pull/29430): BLD: use github to build macos-arm64 wheels with OpenBLAS and… +* [#29437](https://github.com/numpy/numpy/pull/29437): BUG: fix datetime/timedelta hash memory leak (#29411) diff --git a/corpus/changelog/numpy_releases/numpy_233.md b/corpus/changelog/numpy_releases/numpy_233.md new file mode 100644 index 0000000000000000000000000000000000000000..043a6b001db8f9cb2823d72284986b130e38e9a2 --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_233.md @@ -0,0 +1,56 @@ +# NumPy 2.3.3 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.3.3-notes.html +Version: 2.3.3 + +The NumPy 2.3.3 release is a patch release split between a number of maintenance +updates and bug fixes. This release supports Python versions 3.11-3.14. Note +that the 3.14.0 final is currently expected in Oct, 2025. This release is based +on 3.14.0rc2. + +## Contributors[#](#contributors "Link to this heading") + +A total of 13 people contributed to this release. People with a “+” by their +names contributed a patch for the first time. + +* Aleksandr A. Voyt + +* Bernard Roesler + +* Charles Harris +* Hunter Hogan + +* Joren Hammudoglu +* Maanas Arora +* Matti Picus +* Nathan Goldbaum +* Raghuveer Devulapalli +* Sanjay Kumar Sakamuri Kamalakar + +* Tobias Markus + +* Warren Weckesser +* Zebreus + + +## Pull requests merged[#](#pull-requests-merged "Link to this heading") + +A total of 23 pull requests were merged for this release. + +* [#29440](https://github.com/numpy/numpy/pull/29440): MAINT: Prepare 2.3.x for further development. +* [#29446](https://github.com/numpy/numpy/pull/29446): BUG: Fix test\_configtool\_pkgconfigdir to resolve PKG\_CONFIG\_DIR… +* [#29447](https://github.com/numpy/numpy/pull/29447): BLD: allow targeting webassembly without emscripten +* [#29460](https://github.com/numpy/numpy/pull/29460): MAINT: Backport write\_release.py +* [#29473](https://github.com/numpy/numpy/pull/29473): MAINT: Bump pypa/cibuildwheel from 3.1.0 to 3.1.2 +* [#29500](https://github.com/numpy/numpy/pull/29500): BUG: Always return a real dtype from linalg.cond (gh-18304) (#29333) +* [#29501](https://github.com/numpy/numpy/pull/29501): MAINT: Add .file entry to all .s SVML files +* [#29556](https://github.com/numpy/numpy/pull/29556): BUG: Casting from one timedelta64 to another didn’t handle NAT. +* [#29562](https://github.com/numpy/numpy/pull/29562): BLD: update vendored Meson to 1.8.3 [wheel build] +* [#29563](https://github.com/numpy/numpy/pull/29563): BUG: Fix metadata not roundtripping when pickling datetime (#29555) +* [#29587](https://github.com/numpy/numpy/pull/29587): TST: update link and version for Intel SDE download +* [#29593](https://github.com/numpy/numpy/pull/29593): TYP: add `sorted` kwarg to `unique` +* [#29672](https://github.com/numpy/numpy/pull/29672): MAINT: Update pythoncapi-compat from main. +* [#29673](https://github.com/numpy/numpy/pull/29673): MAINT: Update cibuildwheel. +* [#29674](https://github.com/numpy/numpy/pull/29674): MAINT: Fix typo in wheels.yml +* [#29683](https://github.com/numpy/numpy/pull/29683): BUG, BLD: Correct regex for ppc64 VSX3/VSX4 feature detection +* [#29684](https://github.com/numpy/numpy/pull/29684): TYP: ndarray.fill() takes no keyword arguments +* [#29685](https://github.com/numpy/numpy/pull/29685): BUG: avoid thread-unsafe refcount check in temp elision +* [#29687](https://github.com/numpy/numpy/pull/29687): CI: replace comment-hider action in mypy\_primer workflow +* [#29689](https://github.com/numpy/numpy/pull/29689): BLD: Add missing include +* [#29691](https://github.com/numpy/numpy/pull/29691): BUG: use correct input dtype in flatiter assignment +* [#29700](https://github.com/numpy/numpy/pull/29700): TYP: fix np.bool method declarations +* [#29701](https://github.com/numpy/numpy/pull/29701): BUG: Correct ambiguous logic for s390x CPU feature detection diff --git a/corpus/changelog/numpy_releases/numpy_234.md b/corpus/changelog/numpy_releases/numpy_234.md new file mode 100644 index 0000000000000000000000000000000000000000..8c62752a68a6d6226892c9b9e973a58ca86f0e50 --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_234.md @@ -0,0 +1,76 @@ +# NumPy 2.3.4 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.3.4-notes.html +Version: 2.3.4 + +The NumPy 2.3.4 release is a patch release split between a number of maintenance +updates and bug fixes. This release supports Python versions 3.11-3.14. This +release is based on the Python 3.14.0 final. + +## Changes[#](#changes "Link to this heading") + +The `npymath` and `npyrandom` libraries now have a `.lib` rather than a +`.a` file extension on win-arm64, for compatibility for building with MSVC and +`setuptools`. Please note that using these static libraries is discouraged +and for existing projects using it, it’s best to use it with a matching +compiler toolchain, which is `clang-cl` on Windows on Arm. + +([gh-29750](https://github.com/numpy/numpy/pull/29750)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 17 people contributed to this release. People with a “+” by their +names contributed a patch for the first time. + +* !DWesl +* Charles Harris +* Christian Barbia + +* Evgeni Burovski +* Joren Hammudoglu +* Maaz + +* Mateusz Sokół +* Matti Picus +* Nathan Goldbaum +* Ralf Gommers +* Riku Sakamoto + +* Sandeep Gupta + +* Sayed Awad +* Sebastian Berg +* Sergey Fedorov + +* Warren Weckesser +* dependabot[bot] + +## Pull requests merged[#](#pull-requests-merged "Link to this heading") + +A total of 30 pull requests were merged for this release. + +* [#29725](https://github.com/numpy/numpy/pull/29725): MAINT: Prepare 2.3.x for further development +* [#29781](https://github.com/numpy/numpy/pull/29781): MAINT: Pin some upstream dependences +* [#29782](https://github.com/numpy/numpy/pull/29782): BLD: enable x86-simd-sort to build on KNL with -mavx512f +* [#29783](https://github.com/numpy/numpy/pull/29783): BUG: Include python-including headers first (#29281) +* [#29784](https://github.com/numpy/numpy/pull/29784): TYP: fix np.number and np.\*integer method declaration +* [#29785](https://github.com/numpy/numpy/pull/29785): TYP: mypy 1.18.1 +* [#29788](https://github.com/numpy/numpy/pull/29788): TYP: replace scalar type \_\_init\_\_ with \_\_new\_\_ +* [#29790](https://github.com/numpy/numpy/pull/29790): BUG: Fix `dtype` refcount in `__array__` (#29715) +* [#29791](https://github.com/numpy/numpy/pull/29791): TYP: fix method declarations in floating, timedelta64, and datetime64Backport +* [#29792](https://github.com/numpy/numpy/pull/29792): MAINT: delete unused variables in unary logical dispatch +* [#29797](https://github.com/numpy/numpy/pull/29797): BUG: Fix pocketfft umath strides for AIX compatibility (#29768) +* [#29798](https://github.com/numpy/numpy/pull/29798): BUG: np.setbufsize should raise ValueError for negative input +* [#29799](https://github.com/numpy/numpy/pull/29799): BUG: Fix assert in nditer buffer setup +* [#29800](https://github.com/numpy/numpy/pull/29800): BUG: Stable ScalarType ordering +* [#29838](https://github.com/numpy/numpy/pull/29838): TST: Pin pyparsing to avoid matplotlib errors. +* [#29839](https://github.com/numpy/numpy/pull/29839): BUG: linalg: emit a MemoryError on a malloc failure (#29811) +* [#29840](https://github.com/numpy/numpy/pull/29840): BLD: change file extension for libnpymath on win-arm64 from .a… +* [#29864](https://github.com/numpy/numpy/pull/29864): CI: Fix loongarch64 CI (#29856) +* [#29865](https://github.com/numpy/numpy/pull/29865): TYP: Various typing fixes +* [#29910](https://github.com/numpy/numpy/pull/29910): BUG: Fix float16-sort failures on 32-bit x86 MSVC (#29908) +* [#29911](https://github.com/numpy/numpy/pull/29911): TYP: add missing `__slots__` (#29901) +* [#29913](https://github.com/numpy/numpy/pull/29913): TYP: wrong argument defaults in `testing._private` (#29902) +* [#29920](https://github.com/numpy/numpy/pull/29920): BUG: avoid segmentation fault in string\_expandtabs\_length\_promoter +* [#29921](https://github.com/numpy/numpy/pull/29921): BUG: Fix INT\_MIN % -1 to return 0 for all signed integer types… +* [#29922](https://github.com/numpy/numpy/pull/29922): TYP: minor fixes related to `errstate` (#29914) +* [#29923](https://github.com/numpy/numpy/pull/29923): TST: use requirements/test\_requirements across CI (#29919) +* [#29926](https://github.com/numpy/numpy/pull/29926): BUG: fix negative samples generated by Wald distribution (#29609) +* [#29940](https://github.com/numpy/numpy/pull/29940): MAINT: Bump pypa/cibuildwheel from 3.1.4 to 3.2.1 +* [#29949](https://github.com/numpy/numpy/pull/29949): STY: rename @classmethod arg to cls +* [#29950](https://github.com/numpy/numpy/pull/29950): MAINT: Simplify string arena growth strategy (#29885) diff --git a/corpus/changelog/numpy_releases/numpy_235.md b/corpus/changelog/numpy_releases/numpy_235.md new file mode 100644 index 0000000000000000000000000000000000000000..e518027be3a5936dfdb6149de87277b30bdecbd3 --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_235.md @@ -0,0 +1,44 @@ +# NumPy 2.3.5 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.3.5-notes.html +Version: 2.3.5 + +The NumPy 2.3.5 release is a patch release split between a number of maintenance +updates and bug fixes. This release supports Python versions 3.11-3.14. + +## Contributors[#](#contributors "Link to this heading") + +A total of 10 people contributed to this release. People with a “+” by their +names contributed a patch for the first time. + +* Aaron Kollasch + +* Charles Harris +* Joren Hammudoglu +* Matti Picus +* Nathan Goldbaum +* Rafael Laboissière + +* Sayed Awad +* Sebastian Berg +* Warren Weckesser +* Yasir Ashfaq + + +## Pull requests merged[#](#pull-requests-merged "Link to this heading") + +A total of 16 pull requests were merged for this release. + +* [#29979](https://github.com/numpy/numpy/pull/29979): MAINT: Prepare 2.3.x for further development +* [#30026](https://github.com/numpy/numpy/pull/30026): SIMD, BLD: Backport FPMATH mode on x86-32 and filter successor… +* [#30029](https://github.com/numpy/numpy/pull/30029): MAINT: Backport write\_release.py +* [#30041](https://github.com/numpy/numpy/pull/30041): TYP: Various typing updates +* [#30059](https://github.com/numpy/numpy/pull/30059): BUG: Fix np.strings.slice if stop=None or start and stop >= len… +* [#30063](https://github.com/numpy/numpy/pull/30063): BUG: Fix np.strings.slice if start > stop +* [#30076](https://github.com/numpy/numpy/pull/30076): BUG: avoid negating INT\_MIN in PyArray\_Round implementation (#30071) +* [#30090](https://github.com/numpy/numpy/pull/30090): BUG: Fix resize when it contains references (#29970) +* [#30129](https://github.com/numpy/numpy/pull/30129): BLD: update scipy-openblas, use -Dpkg\_config\_path (#30049) +* [#30130](https://github.com/numpy/numpy/pull/30130): BUG: Avoid compilation error of wrapper file generated with SWIG… +* [#30157](https://github.com/numpy/numpy/pull/30157): BLD: use scipy-openblas 0.3.30.7 (#30132) +* [#30158](https://github.com/numpy/numpy/pull/30158): DOC: Remove nonexistent `order` parameter docs of `ma.asanyarray`… +* [#30185](https://github.com/numpy/numpy/pull/30185): BUG: Fix check of PyMem\_Calloc return value. (#30176) +* [#30217](https://github.com/numpy/numpy/pull/30217): DOC: fix links for newly rebuilt numpy-tutorials site +* [#30218](https://github.com/numpy/numpy/pull/30218): BUG: Fix build on s390x with clang (#30214) +* [#30237](https://github.com/numpy/numpy/pull/30237): ENH: Make FPE blas check a runtime check for all apple arm systems diff --git a/corpus/changelog/numpy_releases/numpy_240.md b/corpus/changelog/numpy_releases/numpy_240.md new file mode 100644 index 0000000000000000000000000000000000000000..f54cb014d8245a43607f4df8b56485367695f9f2 --- /dev/null +++ b/corpus/changelog/numpy_releases/numpy_240.md @@ -0,0 +1,675 @@ +# NumPy 2.4.0 Release Notes# + +Source: https://numpy.org/doc/stable/release/2.4.0-notes.html +Version: 2.4.0 + +The NumPy 2.4.0 release continues the work to improve free threaded Python +support, user dtypes implementation, and annotations. There are many expired +deprecations and bug fixes as well. + +This release supports Python versions 3.11-3.14 + +## Highlights[#](#highlights "Link to this heading") + +Apart from annotations and `same_value` kwarg, the 2.4 highlights are mostly +of interest to downstream developers. They should help in implementing new user +dtypes. + +* Many annotation improvements. In particular, runtime signature introspection. +* New `casting` kwarg `'same_value'` for casting by value. +* New `PyUFunc_AddLoopsFromSpec` function that can be used to add user sort + loops using the `ArrayMethod` API. +* New `__numpy_dtype__` protocol. + +## Deprecations[#](#deprecations "Link to this heading") + +### Setting the `strides` attribute is deprecated[#](#setting-the-strides-attribute-is-deprecated "Link to this heading") + +Setting the strides attribute is now deprecated since mutating +an array is unsafe if an array is shared, especially by multiple +threads. As an alternative, you can create a new view (no copy) via: + +* `np.lib.stride_tricks.strided_window_view` if applicable, +* `np.lib.stride_tricks.as_strided` for the general case, +* or the `np.ndarray` constructor (`buffer` is the original array) for a + light-weight version. + +([gh-28925](https://github.com/numpy/numpy/pull/28925)) + +### Positional `out` argument to `np.maximum`, `np.minimum` is deprecated[#](#positional-out-argument-to-np-maximum-np-minimum-is-deprecated "Link to this heading") + +Passing the output array `out` positionally to `numpy.maximum` and +`numpy.minimum` is deprecated. For example, `np.maximum(a, b, c)` will emit +a deprecation warning, since `c` is treated as the output buffer rather than +a third input. + +Always pass the output with the keyword form, e.g. `np.maximum(a, b, +out=c)`. This makes intent clear and simplifies type annotations. + +([gh-29052](https://github.com/numpy/numpy/pull/29052)) + +### `align=` must be passed as boolean to `np.dtype()`[#](#align-must-be-passed-as-boolean-to-np-dtype "Link to this heading") + +When creating a new `dtype` a `VisibleDeprecationWarning` will be given if +`align=` is not a boolean. This is mainly to prevent accidentally passing a +subarray align flag where it has no effect, such as `np.dtype("f8", 3)` +instead of `np.dtype(("f8", 3))`. We strongly suggest to always pass +`align=` as a keyword argument. + +([gh-29301](https://github.com/numpy/numpy/pull/29301)) + +### Assertion and warning control utilities are deprecated[#](#assertion-and-warning-control-utilities-are-deprecated "Link to this heading") + +`np.testing.assert_warns` and `np.testing.suppress_warnings` are +deprecated. Use `warnings.catch_warnings`, `warnings.filterwarnings`, +`pytest.warns`, or `pytest.filterwarnings` instead. + +([gh-29550](https://github.com/numpy/numpy/pull/29550)) + +### `np.fix` is pending deprecation[#](#np-fix-is-pending-deprecation "Link to this heading") + +The `numpy.fix` function will be deprecated in a future release. It is +recommended to use `numpy.trunc` instead, as it provides the same +functionality of truncating decimal values to their integer parts. Static type +checkers might already report a warning for the use of `numpy.fix`. + +([gh-30168](https://github.com/numpy/numpy/pull/30168)) + +### in-place modification of `ndarray.shape` is pending deprecation[#](#in-place-modification-of-ndarray-shape-is-pending-deprecation "Link to this heading") + +Setting the `ndarray.shape` attribute directly will be deprecated in a future +release. Instead of modifying the shape in place, it is recommended to use the +`numpy.reshape` function. Static type checkers might already report a +warning for assignments to `ndarray.shape`. + +([gh-30282](https://github.com/numpy/numpy/pull/30282)) + +### Deprecation of `numpy.lib.user_array.container`[#](#deprecation-of-numpy-lib-user-array-container "Link to this heading") + +The `numpy.lib.user_array.container` class is deprecated and will be removed +in a future version. + +([gh-30284](https://github.com/numpy/numpy/pull/30284)) + +## Expired deprecations[#](#expired-deprecations "Link to this heading") + +### Removed deprecated `MachAr` runtime discovery mechanism.[#](#removed-deprecated-machar-runtime-discovery-mechanism "Link to this heading") + +([gh-29836](https://github.com/numpy/numpy/pull/29836)) + +### Raise `TypeError` on attempt to convert array with `ndim > 0` to scalar[#](#raise-typeerror-on-attempt-to-convert-array-with-ndim-0-to-scalar "Link to this heading") + +Conversion of an array with `ndim > 0` to a scalar was deprecated in NumPy +1.25. Now, attempting to do so raises `TypeError`. Ensure you extract a +single element from your array before performing this operation. + +([gh-29841](https://github.com/numpy/numpy/pull/29841)) + +### Removed numpy.linalg.linalg and numpy.fft.helper[#](#removed-numpy-linalg-linalg-and-numpy-fft-helper "Link to this heading") + +The following were deprecated in NumPy 2.0 and have been moved to private +modules: + +* `numpy.linalg.linalg` + Use `numpy.linalg` instead. +* `numpy.fft.helper` + Use `numpy.fft` instead. + +([gh-29909](https://github.com/numpy/numpy/pull/29909)) + +### Removed `interpolation` parameter from quantile and percentile functions[#](#removed-interpolation-parameter-from-quantile-and-percentile-functions "Link to this heading") + +The `interpolation` parameter was deprecated in NumPy 1.22.0 and has been +removed from the following functions: + +* `numpy.percentile` +* `numpy.nanpercentile` +* `numpy.quantile` +* `numpy.nanquantile` + +Use the `method` parameter instead. + +([gh-29973](https://github.com/numpy/numpy/pull/29973)) + +### Removed `numpy.in1d`[#](#removed-numpy-in1d "Link to this heading") + +`numpy.in1d` has been deprecated since NumPy 2.0 and is now removed in favor of `numpy.isin`. + +([gh-29978](https://github.com/numpy/numpy/pull/29978)) + +### Removed `numpy.ndindex.ndincr()`[#](#removed-numpy-ndindex-ndincr "Link to this heading") + +The `ndindex.ndincr()` method has been deprecated since NumPy 1.20 and is now +removed; use `next(ndindex)` instead. + +([gh-29980](https://github.com/numpy/numpy/pull/29980)) + +### Removed `fix_imports` parameter from `numpy.save`[#](#removed-fix-imports-parameter-from-numpy-save "Link to this heading") + +The `fix_imports` parameter was deprecated in NumPy 2.1.0 and is now removed. +This flag has been ignored since NumPy 1.17 and was only needed to support +loading files in Python 2 that were written in Python 3. + +([gh-29984](https://github.com/numpy/numpy/pull/29984)) + +### Removal of four undocumented `ndarray.ctypes` methods[#](#removal-of-four-undocumented-ndarray-ctypes-methods "Link to this heading") + +Four undocumented methods of the `ndarray.ctypes` object have been removed: + +* `_ctypes.get_data()` (use `_ctypes.data` instead) +* `_ctypes.get_shape()` (use `_ctypes.shape` instead) +* `_ctypes.get_strides()` (use `_ctypes.strides` instead) +* `_ctypes.get_as_parameter()` (use `_ctypes._as_parameter_` instead) + +These methods have been deprecated since NumPy 1.21. + +([gh-29986](https://github.com/numpy/numpy/pull/29986)) + +### Removed `newshape` parameter from `numpy.reshape`[#](#removed-newshape-parameter-from-numpy-reshape "Link to this heading") + +The `newshape` parameter was deprecated in NumPy 2.1.0 and has been +removed from `numpy.reshape`. Pass it positionally or use `shape=` +on newer NumPy versions. + +([gh-29994](https://github.com/numpy/numpy/pull/29994)) + +### Removal of deprecated functions and arguments[#](#removal-of-deprecated-functions-and-arguments "Link to this heading") + +The following long-deprecated APIs have been removed: + +* `numpy.trapz` — deprecated since NumPy 2.0 (2023-08-18). Use `numpy.trapezoid` or + `scipy.integrate` functions instead. +* `disp` function — deprecated from 2.0 release and no longer functional. Use + your own printing function instead. +* `bias` and `ddof` arguments in `numpy.corrcoef` — these had no effect + since NumPy 1.10. + +([gh-29997](https://github.com/numpy/numpy/pull/29997)) + +### Removed `delimitor` parameter from `numpy.ma.mrecords.fromtextfile()`[#](#removed-delimitor-parameter-from-numpy-ma-mrecords-fromtextfile "Link to this heading") + +The `delimitor` parameter was deprecated in NumPy 1.22.0 and has been +removed from `numpy.ma.mrecords.fromtextfile()`. Use `delimiter` instead. + +([gh-30021](https://github.com/numpy/numpy/pull/30021)) + +### `numpy.array2string` and `numpy.sum` deprecations finalized[#](#numpy-array2string-and-numpy-sum-deprecations-finalized "Link to this heading") + +The following long-deprecated APIs have been removed or converted to errors: + +* The `style` parameter has been removed from `numpy.array2string`. + This argument had no effect since Numpy 1.14.0. Any arguments following + it, such as `formatter` have now been made keyword-only. +* Calling `np.sum(generator)` directly on a generator object now raises a + `TypeError`. This behavior was deprecated in NumPy 1.15.0. Use + `np.sum(np.fromiter(generator))` or the python `sum` builtin instead. + +([gh-30068](https://github.com/numpy/numpy/pull/30068)) + +## Compatibility notes[#](#compatibility-notes "Link to this heading") + +* NumPy’s C extension modules have begun to use multi-phase initialisation, as + defined by PEP 489. As part of this, a new explicit check has been added that + each such module is only imported once per Python process. This comes with + the side-effect that deleting `numpy` from `sys.modules` and re-importing + it will now fail with an `ImportError`. This has always been unsafe, with + unexpected side-effects, though did not previously raise an error. + + ([gh-29030](https://github.com/numpy/numpy/pull/29030)) +* `numpy.round` now always returns a copy. Previously, it returned a view + for integer inputs for `decimals >= 0` and a copy in all other cases. + This change brings `round` in line with `ceil`, `floor` and `trunc`. + + ([gh-29137](https://github.com/numpy/numpy/pull/29137)) +* Type-checkers will no longer accept calls to `numpy.arange` with + `start` as a keyword argument. This was done for compatibility with + the Array API standard. At runtime it is still possible to use + `numpy.arange` with `start` as a keyword argument. + + ([gh-30147](https://github.com/numpy/numpy/pull/30147)) +* The Macro NPY\_ALIGNMENT\_REQUIRED has been removed The macro was defined in + the `npy_cpu.h` file, so might be regarded as semi public. As it turns out, + with modern compilers and hardware it is almost always the case that + alignment is required, so numpy no longer uses the macro. It is unlikely + anyone uses it, but you might want to compile with the `-Wundef` flag or + equivalent to be sure. + + ([gh-29094](https://github.com/numpy/numpy/pull/29094)) + +## C API changes[#](#c-api-changes "Link to this heading") + +### The NPY\_SORTKIND enum has been enhanced with new variables[#](#the-npy-sortkind-enum-has-been-enhanced-with-new-variables "Link to this heading") + +This is of interest if you are using `PyArray_Sort` or `PyArray_ArgSort`. +We have changed the semantics of the old names in the `NPY_SORTKIND` enum and +added new ones. The changes are backward compatible, and no recompilation is +needed. The new names of interest are: + +* `NPY_SORT_DEFAULT` – default sort (same value as `NPY_QUICKSORT`) +* `NPY_SORT_STABLE` – the sort must be stable (same value as `NPY_MERGESORT`) +* `NPY_SORT_DESCENDING` – the sort must be descending + +The semantic change is that `NPY_HEAPSORT` is mapped to `NPY_QUICKSORT` when used. +Note that `NPY_SORT_DESCENDING` is not yet implemented. + +([gh-29642](https://github.com/numpy/numpy/pull/29642)) + +### New `NPY_DT_get_constant` slot for DType constant retrieval[#](#new-npy-dt-get-constant-slot-for-dtype-constant-retrieval "Link to this heading") + +A new slot `NPY_DT_get_constant` has been added to the DType API, allowing +dtype implementations to provide constant values such as machine limits and +special values. The slot function has the signature: + +```None +int get_constant(PyArray_Descr *descr, int constant_id, void *ptr) +``` + +It returns 1 on success, 0 if the constant is not available, or -1 on error. +The function is always called with the GIL held and may write to unaligned memory. + +Integer constants (marked with the `1 << 16` bit) return `npy_intp` values, +while floating-point constants return values of the dtype’s native type. + +Implementing this can be used by user DTypes to provide `numpy.finfo` values. + +([gh-29836](https://github.com/numpy/numpy/pull/29836)) + +### A new `PyUFunc_AddLoopsFromSpecs` convenience function has been added to the C API.[#](#a-new-pyufunc-addloopsfromspecs-convenience-function-has-been-added-to-the-c-api "Link to this heading") + +This function allows adding multiple ufunc loops from their specs in one call +using a NULL-terminated array of `PyUFunc_LoopSlot` structs. It allows +registering sorting and argsorting loops using the new ArrayMethod API. + +([gh-29900](https://github.com/numpy/numpy/pull/29900)) + +## New Features[#](#new-features "Link to this heading") + +* Let `np.size` accept multiple axes. + + ([gh-29240](https://github.com/numpy/numpy/pull/29240)) +* Extend `numpy.pad` to accept a dictionary for the `pad_width` argument. + + ([gh-29273](https://github.com/numpy/numpy/pull/29273)) + +### `'same_value'` for casting by value[#](#same-value-for-casting-by-value "Link to this heading") + +The `casting` kwarg now has a `'same_value'` option that checks the actual +values can be round-trip cast without changing value. Currently it is only +implemented in `ndarray.astype`. This will raise a `ValueError` if any of the +values in the array would change as a result of the cast, including rounding of +floats or overflowing of ints. + +([gh-29129](https://github.com/numpy/numpy/pull/29129)) + +### `StringDType` fill\_value support in `numpy.ma.MaskedArray`[#](#stringdtype-fill-value-support-in-numpy-ma-maskedarray "Link to this heading") + +Masked arrays now accept and preserve a Python `str` as their `fill_value` +when using the variable‑width `StringDType` (kind `'T'`), including through +slicing and views. The default is `'N/A'` and may be overridden by any valid +string. This fixes issue [gh‑29421](https://github.com/numpy/numpy/issues/29421) +and was implemented in pull request [gh‑29423](https://github.com/numpy/numpy/pull/29423). + +([gh-29423](https://github.com/numpy/numpy/pull/29423)) + +### `ndmax` option for `numpy.array`[#](#ndmax-option-for-numpy-array "Link to this heading") + +The `ndmax` option is now available for `numpy.array`. +It explicitly limits the maximum number of dimensions created from nested sequences. + +This is particularly useful when creating arrays of list-like objects with `dtype=object`. +By default, NumPy recurses through all nesting levels to create the highest possible +dimensional array, but this behavior may not be desired when the intent is to preserve +nested structures as objects. The `ndmax` parameter provides explicit control over +this recursion depth. + +```None +# Default behavior: Creates a 2D array +>>> a = np.array([[1, 2], [3, 4]], dtype=object) +>>> a +array([[1, 2], + [3, 4]], dtype=object) +>>> a.shape +(2, 2) + +# With ndmax=1: Creates a 1D array +>>> b = np.array([[1, 2], [3, 4]], dtype=object, ndmax=1) +>>> b +array([list([1, 2]), list([3, 4])], dtype=object) +>>> b.shape +(2,) +``` + +([gh-29569](https://github.com/numpy/numpy/pull/29569)) + +### Warning emitted when using `where` without `out`[#](#warning-emitted-when-using-where-without-out "Link to this heading") + +Ufuncs called with a `where` mask and without an `out` positional or kwarg will +now emit a warning. This usage tends to trip up users who expect some value in +output locations where the mask is `False` (the ufunc will not touch those +locations). The warning can be suppressed by using `out=None`. + +([gh-29813](https://github.com/numpy/numpy/pull/29813)) + +### DType sorting and argsorting supports the ArrayMethod API[#](#dtype-sorting-and-argsorting-supports-the-arraymethod-api "Link to this heading") + +User-defined dtypes can now implement custom sorting and argsorting using the +`ArrayMethod` API. This mechanism can be used in place of the +`PyArray_ArrFuncs` slots which may be deprecated in the future. + +The sorting and argsorting methods are registered by passing the arraymethod +specs that implement the operations to the new `PyUFunc_AddLoopsFromSpecs` +function. See the `ArrayMethod` API documentation for details. + +([gh-29900](https://github.com/numpy/numpy/pull/29900)) + +### New `__numpy_dtype__` protocol[#](#new-numpy-dtype-protocol "Link to this heading") + +NumPy now has a new `__numpy_dtype__` protocol. NumPy will check +for this attribute when converting to a NumPy dtype via `np.dtype(obj)` +or any `dtype=` argument. + +Downstream projects are encouraged to implement this for all dtype like +objects which may previously have used a `.dtype` attribute that returned +a NumPy dtype. +We expect to deprecate `.dtype` in the future to prevent interpreting +array-like objects with a `.dtype` attribute as a dtype. +If you wish you can implement `__numpy_dtype__` to ensure an earlier +warning or error (`.dtype` is ignored if this is found). + +([gh-30179](https://github.com/numpy/numpy/pull/30179)) + +## Improvements[#](#improvements "Link to this heading") + +### Fix `flatiter` indexing edge cases[#](#fix-flatiter-indexing-edge-cases "Link to this heading") + +The `flatiter` object now shares the same index preparation logic as +`ndarray`, ensuring consistent behavior and fixing several issues where +invalid indices were previously accepted or misinterpreted. + +Key fixes and improvements: + +* Stricter index validation + + + Boolean non-array indices like `arr.flat[[True, True]]` were + incorrectly treated as `arr.flat[np.array([1, 1], dtype=int)]`. + They now raise an index error. Note that indices that match the + iterator’s shape are expected to not raise in the future and be + handled as regular boolean indices. Use `np.asarray()` if + you want to match that behavior. + + Float non-array indices were also cast to integer and incorrectly + treated as `arr.flat[np.array([1.0, 1.0], dtype=int)]`. This is now + deprecated and will be removed in a future version. + + 0-dimensional boolean indices like `arr.flat[True]` are also + deprecated and will be removed in a future version. +* Consistent error types: + + Certain invalid `flatiter` indices that previously raised `ValueError` + now correctly raise `IndexError`, aligning with `ndarray` behavior. +* Improved error messages: + + The error message for unsupported index operations now provides more + specific details, including explicitly listing the valid index types, + instead of the generic `IndexError: unsupported index operation`. + +([gh-28590](https://github.com/numpy/numpy/pull/28590)) + +### Improved error handling in `np.quantile`[#](#improved-error-handling-in-np-quantile "Link to this heading") + +*np.quantile* now raises errors if: + +* All weights are zero +* At least one weight is `np.nan` +* At least one weight is `np.inf` + +([gh-28595](https://github.com/numpy/numpy/pull/28595)) + +### Improved error message for `assert_array_compare`[#](#improved-error-message-for-assert-array-compare "Link to this heading") + +The error message generated by `assert_array_compare` which is used by functions +like `assert_allclose`, `assert_array_less` etc. now also includes information +about the indices at which the assertion fails. + +([gh-29112](https://github.com/numpy/numpy/pull/29112)) + +### Show unit information in `__repr__` for `datetime64("NaT")`[#](#show-unit-information-in-repr-for-datetime64-nat "Link to this heading") + +When a `datetime64` object is “Not a Time” (NaT), its `__repr__` method now +includes the time unit of the datetime64 type. This makes it consistent with +the behavior of a `timedelta64` object. + +([gh-29396](https://github.com/numpy/numpy/pull/29396)) + +### Performance increase for scalar calculations[#](#performance-increase-for-scalar-calculations "Link to this heading") + +The speed of calculations on scalars has been improved by about a factor 6 for +ufuncs that take only one input (like `np.sin(scalar)`), reducing the speed +difference from their `math` equivalents from a factor 19 to 3 (the speed +for arrays is left unchanged). + +([gh-29819](https://github.com/numpy/numpy/pull/29819)) + +### `numpy.finfo` Refactor[#](#numpy-finfo-refactor "Link to this heading") + +The `numpy.finfo` class has been completely refactored to obtain floating-point +constants directly from C compiler macros rather than deriving them at runtime. +This provides better accuracy, platform compatibility and corrected +several attribute calculations: + +* Constants like `eps`, `min`, `max`, `smallest_normal`, and + `smallest_subnormal` now come directly from standard C macros (`FLT_EPSILON`, + `DBL_MIN`, etc.), ensuring platform-correct values. +* The deprecated `MachAr` runtime discovery mechanism has been removed. +* Derived attributes have been corrected to match standard definitions: + `machep` and `negep` now use `int(log2(eps))`; `nexp` accounts for + all exponent patterns; `nmant` excludes the implicit bit; and `minexp` + follows the C standard definition. +* longdouble constants, Specifically `smallest_normal` now follows the + C standard definitions as per respecitive platform. +* Special handling added for PowerPC’s IBM double-double format. +* New test suite added in `test_finfo.py` to validate all + `finfo` properties against expected machine arithmetic values for + float16, float32, and float64 types. + +([gh-29836](https://github.com/numpy/numpy/pull/29836)) + +### Multiple axes are now supported in `numpy.trim_zeros`[#](#multiple-axes-are-now-supported-in-numpy-trim-zeros "Link to this heading") + +The `axis` argument of `numpy.trim_zeros` now accepts a sequence; for example +`np.trim_zeros(x, axis=(0, 1))` will trim the zeros from a multi-dimensional +array `x` along axes 0 and 1. This fixes issue +[gh‑29945](https://github.com/numpy/numpy/issues/29945) and was implemented +in pull request [gh‑29947](https://github.com/numpy/numpy/pull/29947). + +([gh-29947](https://github.com/numpy/numpy/pull/29947)) + +### Runtime signature introspection support has been significantly improved[#](#runtime-signature-introspection-support-has-been-significantly-improved "Link to this heading") + +Many NumPy functions, classes, and methods that previously raised +`ValueError` when passed to `inspect.signature()` now return meaningful +signatures. This improves support for runtime type checking, IDE autocomplete, +documentation generation, and runtime introspection capabilities across the +NumPy API. + +Over three hundred classes and functions have been updated in total, including, +but not limited to, core classes such as `ndarray`, `generic`, `dtype`, +`ufunc`, `broadcast`, `nditer`, etc., most methods of `ndarray` and +scalar types, array constructor functions (`array`, `empty`, `arange`, +`fromiter`, etc.), all `ufuncs`, and many other commonly used functions, +including `dot`, `concat`, `where`, `bincount`, `can_cast`, and +numerous others. + +([gh-30208](https://github.com/numpy/numpy/pull/30208)) + +## Performance improvements and changes[#](#performance-improvements-and-changes "Link to this heading") + +### Performance improvements to `np.unique` for string dtypes[#](#performance-improvements-to-np-unique-for-string-dtypes "Link to this heading") + +The hash-based algorithm for unique extraction provides an order-of-magnitude +speedup on large string arrays. In an internal benchmark with about 1 billion +string elements, the hash-based np.unique completed in roughly 33.5 seconds, +compared to 498 seconds with the sort-based method – about 15× faster for +unsorted unique operations on strings. This improvement greatly reduces the +time to find unique values in very large string datasets. + +([gh-28767](https://github.com/numpy/numpy/pull/28767)) + +### Rewrite of `np.ndindex` using `itertools.product`[#](#rewrite-of-np-ndindex-using-itertools-product "Link to this heading") + +The `numpy.ndindex` function now uses `itertools.product` internally, +providing significant improvements in performance for large iteration spaces, +while maintaining the original behavior and interface. For example, for an +array of shape (50, 60, 90) the NumPy `ndindex` benchmark improves +performance by a factor 5.2. + +([gh-29165](https://github.com/numpy/numpy/pull/29165)) + +### Performance improvements to `np.unique` for complex dtypes[#](#performance-improvements-to-np-unique-for-complex-dtypes "Link to this heading") + +The hash-based algorithm for unique extraction now also supports +complex dtypes, offering noticeable performance gains. + +In our benchmarks on complex128 arrays with 200,000 elements, +the hash-based approach was about 1.4–1.5× faster +than the sort-based baseline when there were 20% of unique values, +and about 5× faster when there were 0.2% of unique values. + +([gh-29537](https://github.com/numpy/numpy/pull/29537)) + +## Changes[#](#changes "Link to this heading") + +* Multiplication between a string and integer now raises OverflowError instead + of MemoryError if the result of the multiplication would create a string that + is too large to be represented. This follows Python’s behavior. + + ([gh-29060](https://github.com/numpy/numpy/pull/29060)) +* The accuracy of `np.quantile` and `np.percentile` for 16- and 32-bit + floating point input data has been improved. + + ([gh-29105](https://github.com/numpy/numpy/pull/29105)) + +### `unique_values` for string dtypes may return unsorted data[#](#unique-values-for-string-dtypes-may-return-unsorted-data "Link to this heading") + +np.unique now supports hash‐based duplicate removal for string dtypes. +This enhancement extends the hash-table algorithm to byte strings (‘S’), +Unicode strings (‘U’), and the experimental string dtype (‘T’, StringDType). +As a result, calling np.unique() on an array of strings will use +the faster hash-based method to obtain unique values. +Note that this hash-based method does not guarantee that the returned unique values will be sorted. +This also works for StringDType arrays containing None (missing values) +when using equal\_nan=True (treating missing values as equal). + +([gh-28767](https://github.com/numpy/numpy/pull/28767)) + +### Modulate dispatched x86 CPU features[#](#modulate-dispatched-x86-cpu-features "Link to this heading") + +**IMPORTANT**: The default setting for `cpu-baseline` on x86 has been raised +to `x86-64-v2` microarchitecture. This can be changed to none during build +time to support older CPUs, though SIMD optimizations for pre-2009 processors +are no longer maintained. + +NumPy has reorganized x86 CPU features into microarchitecture-based groups +instead of individual features, aligning with Linux distribution standards and +Google Highway requirements. + +Key changes: + +* Replaced individual x86 features with microarchitecture levels: `X86_V2`, + `X86_V3`, and `X86_V4` +* Raised the baseline to `X86_V2` +* Improved `-` operator behavior to properly exclude successor features that + imply the excluded feature +* Added meson redirections for removed feature names to maintain backward + compatibility +* Removed compiler compatibility workarounds for partial feature support (e.g., + AVX512 without mask operations) +* Removed legacy AMD features (XOP, FMA4) and discontinued Intel Xeon Phi + support + +New Feature Group Hierarchy: + +| Name | Implies | Includes | +| --- | --- | --- | +| `X86_V2` | | `SSE` `SSE2` `SSE3` `SSSE3` `SSE4_1` `SSE4_2` `POPCNT` `CX16` `LAHF` | +| `X86_V3` | `X86_V2` | `AVX` `AVX2` `FMA3` `BMI` `BMI2` `LZCNT` `F16C` `MOVBE` | +| `X86_V4` | `X86_V3` | `AVX512F` `AVX512CD` `AVX512VL` `AVX512BW` `AVX512DQ` | +| `AVX512_ICL` | `X86_V4` | `AVX512VBMI` `AVX512VBMI2` `AVX512VNNI` `AVX512BITALG` `AVX512VPOPCNTDQ` `AVX512IFMA` `VAES` `GFNI` `VPCLMULQDQ` | +| `AVX512_SPR` | `AVX512_ICL` | `AVX512FP16` | + +These groups correspond to CPU generations: + +* `X86_V2`: x86-64-v2 microarchitectures (CPUs since 2009) +* `X86_V3`: x86-64-v3 microarchitectures (CPUs since 2015) +* `X86_V4`: x86-64-v4 microarchitectures (AVX-512 capable CPUs) +* `AVX512_ICL`: Intel Ice Lake and similar CPUs +* `AVX512_SPR`: Intel Sapphire Rapids and newer CPUs + +Note + +On 32-bit x86, `cx16` is excluded from `X86_V2`. + +Documentation has been updated with details on using these new feature groups +with the current meson build system. + +([gh-28896](https://github.com/numpy/numpy/pull/28896)) + +### Fix bug in `matmul` for non-contiguous out kwarg parameter[#](#fix-bug-in-matmul-for-non-contiguous-out-kwarg-parameter "Link to this heading") + +In some cases, if `out` was non-contiguous, `np.matmul` would cause memory +corruption or a c-level assert. This was new to v2.3.0 and fixed in v2.3.1. + +([gh-29179](https://github.com/numpy/numpy/pull/29179)) + +### `__array_interface__` with NULL pointer changed[#](#array-interface-with-null-pointer-changed "Link to this heading") + +The array interface now accepts NULL pointers (NumPy will do its own dummy +allocation, though). Previously, these incorrectly triggered an undocumented +scalar path. In the unlikely event that the scalar path was actually desired, +you can (for now) achieve the previous behavior via the correct scalar path by +not providing a `data` field at all. + +([gh-29338](https://github.com/numpy/numpy/pull/29338)) + +### `unique_values` for complex dtypes may return unsorted data[#](#unique-values-for-complex-dtypes-may-return-unsorted-data "Link to this heading") + +np.unique now supports hash‐based duplicate removal for complex dtypes. This +enhancement extends the hash‐table algorithm to all complex types (‘c’), and +their extended precision variants. The hash‐based method provides faster +extraction of unique values but does not guarantee that the result will be +sorted. + +([gh-29537](https://github.com/numpy/numpy/pull/29537)) + +### Sorting `kind='heapsort'` now maps to `kind='quicksort'`[#](#sorting-kind-heapsort-now-maps-to-kind-quicksort "Link to this heading") + +It is unlikely that this change will be noticed, but if you do see a change in +execution time or unstable argsort order, that is likely the cause. Please let +us know if there is a performance regression. Congratulate us if it is improved +:) + +([gh-29642](https://github.com/numpy/numpy/pull/29642)) + +### `numpy.typing.DTypeLike` no longer accepts `None`[#](#numpy-typing-dtypelike-no-longer-accepts-none "Link to this heading") + +The type alias `numpy.typing.DTypeLike` no longer accepts `None`. Instead of + +```None +dtype: DTypeLike = None +``` + +it should now be + +```None +dtype: DTypeLike | None = None +``` + +instead. + +([gh-29739](https://github.com/numpy/numpy/pull/29739)) + +The `npymath` and `npyrandom` libraries now have a `.lib` rather than a +`.a` file extension on win-arm64, for compatibility for building with MSVC +and `setuptools`. Please note that using these static libraries is +discouraged and for existing projects using it, it’s best to use it with a +matching compiler toolchain, which is `clang-cl` on Windows on Arm. + +([gh-29750](https://github.com/numpy/numpy/pull/29750)) diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.13.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.13.0.md new file mode 100644 index 0000000000000000000000000000000000000000..ba129139cb8cf9bca30eb3fb1c7cb00798d1fd4b --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.13.0.md @@ -0,0 +1,1669 @@ +# What's new in pandas 0.13.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.13.0.html + +# Version 0.13.0 (January 3, 2014)[#](#version-0-13-0-january-3-2014 "Link to this heading") + +This is a major release from 0.12.0 and includes a number of API changes, several new features and +enhancements along with a large number of bug fixes. + +Highlights include: + +* support for a new index type `Float64Index`, and other Indexing enhancements +* `HDFStore` has a new string based syntax for query specification +* support for new methods of interpolation +* updated `timedelta` operations +* a new string manipulation method `extract` +* Nanosecond support for Offsets +* `isin` for DataFrames + +Several experimental features are added, including: + +* new `eval/query` methods for expression evaluation +* support for `msgpack` serialization +* an i/o interface to Google’s `BigQuery` + +Their are several new or updated docs sections including: + +* [Comparison with SQL](../getting_started/comparison/comparison_with_sql.html#compare-with-sql), which should be useful for those familiar with SQL but still learning pandas. +* [Comparison with R](../getting_started/comparison/comparison_with_r.html#compare-with-r), idiom translations from R to pandas. +* [Enhancing Performance](../user_guide/enhancingperf.html#enhancingperf), ways to enhance pandas performance with `eval/query`. + +Warning + +In 0.13.0 `Series` has internally been refactored to no longer sub-class `ndarray` +but instead subclass `NDFrame`, similar to the rest of the pandas containers. This should be +a transparent change with only very limited API implications. See [Internal Refactoring](#whatsnew-0130-refactoring) + +## API changes[#](#api-changes "Link to this heading") + +* `read_excel` now supports an integer in its `sheetname` argument giving + the index of the sheet to read in ([GH 4301](https://github.com/pandas-dev/pandas/issues/4301)). +* Text parser now treats anything that reads like inf (“inf”, “Inf”, “-Inf”, + “iNf”, etc.) as infinity. ([GH 4220](https://github.com/pandas-dev/pandas/issues/4220), [GH 4219](https://github.com/pandas-dev/pandas/issues/4219)), affecting + `read_table`, `read_csv`, etc. +* `pandas` now is Python 2/3 compatible without the need for 2to3 thanks to + @jtratner. As a result, pandas now uses iterators more extensively. This + also led to the introduction of substantive parts of the Benjamin + Peterson’s `six` library into compat. ([GH 4384](https://github.com/pandas-dev/pandas/issues/4384), [GH 4375](https://github.com/pandas-dev/pandas/issues/4375), + [GH 4372](https://github.com/pandas-dev/pandas/issues/4372)) +* `pandas.util.compat` and `pandas.util.py3compat` have been merged into + `pandas.compat`. `pandas.compat` now includes many functions allowing + 2/3 compatibility. It contains both list and iterator versions of range, + filter, map and zip, plus other necessary elements for Python 3 + compatibility. `lmap`, `lzip`, `lrange` and `lfilter` all produce + lists instead of iterators, for compatibility with `numpy`, subscripting + and `pandas` constructors.([GH 4384](https://github.com/pandas-dev/pandas/issues/4384), [GH 4375](https://github.com/pandas-dev/pandas/issues/4375), [GH 4372](https://github.com/pandas-dev/pandas/issues/4372)) +* `Series.get` with negative indexers now returns the same as `[]` ([GH 4390](https://github.com/pandas-dev/pandas/issues/4390)) +* Changes to how `Index` and `MultiIndex` handle metadata (`levels`, + `labels`, and `names`) ([GH 4039](https://github.com/pandas-dev/pandas/issues/4039)): + + ```None + # previously, you would have set levels or labels directly + >>> pd.index.levels = [[1, 2, 3, 4], [1, 2, 4, 4]] + + # now, you use the set_levels or set_labels methods + >>> index = pd.index.set_levels([[1, 2, 3, 4], [1, 2, 4, 4]]) + + # similarly, for names, you can rename the object + # but setting names is not deprecated + >>> index = pd.index.set_names(["bob", "cranberry"]) + + # and all methods take an inplace kwarg - but return None + >>> pd.index.set_names(["bob", "cranberry"], inplace=True) + ``` +* **All** division with `NDFrame` objects is now *truedivision*, regardless + of the future import. This means that operating on pandas objects will by default + use *floating point* division, and return a floating point dtype. + You can use `//` and `floordiv` to do integer division. + + Integer division + + ```None + In [3]: arr = np.array([1, 2, 3, 4]) + + In [4]: arr2 = np.array([5, 3, 2, 1]) + + In [5]: arr / arr2 + Out[5]: array([0, 0, 1, 4]) + + In [6]: pd.Series(arr) // pd.Series(arr2) + Out[6]: + 0 0 + 1 0 + 2 1 + 3 4 + dtype: int64 + ``` + + True Division + + ```None + In [7]: pd.Series(arr) / pd.Series(arr2) # no future import required + Out[7]: + 0 0.200000 + 1 0.666667 + 2 1.500000 + 3 4.000000 + dtype: float64 + ``` +* Infer and downcast dtype if `downcast='infer'` is passed to `fillna/ffill/bfill` ([GH 4604](https://github.com/pandas-dev/pandas/issues/4604)) +* `__nonzero__` for all NDFrame objects, will now raise a `ValueError`, this reverts back to ([GH 1073](https://github.com/pandas-dev/pandas/issues/1073), [GH 4633](https://github.com/pandas-dev/pandas/issues/4633)) + behavior. See [gotchas](../user_guide/gotchas.html#gotchas-truth) for a more detailed discussion. + + This prevents doing boolean comparison on *entire* pandas objects, which is inherently ambiguous. These all will raise a `ValueError`. + + ```None + >>> df = pd.DataFrame({'A': np.random.randn(10), + ... 'B': np.random.randn(10), + ... 'C': pd.date_range('20130101', periods=10) + ... }) + ... + >>> if df: + ... pass + ... + Traceback (most recent call last): + ... + ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, + a.bool(), a.item(), a.any() or a.all(). + + >>> df1 = df + >>> df2 = df + >>> df1 and df2 + Traceback (most recent call last): + ... + ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, + a.bool(), a.item(), a.any() or a.all(). + + >>> d = [1, 2, 3] + >>> s1 = pd.Series(d) + >>> s2 = pd.Series(d) + >>> s1 and s2 + Traceback (most recent call last): + ... + ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, + a.bool(), a.item(), a.any() or a.all(). + ``` + + Added the `.bool()` method to `NDFrame` objects to facilitate evaluating of single-element boolean Series: + + ```None + >>> pd.Series([True]).bool() + True + >>> pd.Series([False]).bool() + False + >>> pd.DataFrame([[True]]).bool() + True + >>> pd.DataFrame([[False]]).bool() + False + ``` +* All non-Index NDFrames (`Series`, `DataFrame`, `Panel`, `Panel4D`, + `SparsePanel`, etc.), now support the entire set of arithmetic operators + and arithmetic flex methods (add, sub, mul, etc.). `SparsePanel` does not + support `pow` or `mod` with non-scalars. ([GH 3765](https://github.com/pandas-dev/pandas/issues/3765)) +* `Series` and `DataFrame` now have a `mode()` method to calculate the + statistical mode(s) by axis/Series. ([GH 5367](https://github.com/pandas-dev/pandas/issues/5367)) +* Chained assignment will now by default warn if the user is assigning to a copy. This can be changed + with the option `mode.chained_assignment`, allowed options are `raise/warn/None`. See [the docs](../user_guide/indexing.html#indexing-view-versus-copy). + + ```None + In [1]: dfc = pd.DataFrame({'A': ['aaa', 'bbb', 'ccc'], 'B': [1, 2, 3]}) + + In [2]: pd.set_option('chained_assignment', 'warn') + ``` + + The following warning / exception will show if this is attempted. + + ```None + In [3]: dfc.loc[0]['A'] = 1111 + ``` + + ```None + Traceback (most recent call last) + ... + SettingWithCopyWarning: + A value is trying to be set on a copy of a slice from a DataFrame. + Try using .loc[row_index,col_indexer] = value instead + ``` + + Here is the correct method of assignment. + + ```None + In [4]: dfc.loc[0, 'A'] = 11 + + In [5]: dfc + Out[5]: + A B + 0 11 1 + 1 bbb 2 + 2 ccc 3 + ``` +* `Panel.reindex` has the following call signature `Panel.reindex(items=None, major_axis=None, minor_axis=None, **kwargs)` + : to conform with other `NDFrame` objects. See [Internal Refactoring](#whatsnew-0130-refactoring) for more information. +* `Series.argmin` and `Series.argmax` are now aliased to `Series.idxmin` and `Series.idxmax`. These return the *index* of the + : min or max element respectively. Prior to 0.13.0 these would return the position of the min / max element. ([GH 6214](https://github.com/pandas-dev/pandas/issues/6214)) + +## Prior version deprecations/changes[#](#prior-version-deprecations-changes "Link to this heading") + +These were announced changes in 0.12 or prior that are taking effect as of 0.13.0 + +* Remove deprecated `Factor` ([GH 3650](https://github.com/pandas-dev/pandas/issues/3650)) +* Remove deprecated `set_printoptions/reset_printoptions` ([GH 3046](https://github.com/pandas-dev/pandas/issues/3046)) +* Remove deprecated `_verbose_info` ([GH 3215](https://github.com/pandas-dev/pandas/issues/3215)) +* Remove deprecated `read_clipboard/to_clipboard/ExcelFile/ExcelWriter` from `pandas.io.parsers` ([GH 3717](https://github.com/pandas-dev/pandas/issues/3717)) + These are available as functions in the main pandas namespace (e.g. `pd.read_clipboard`) +* default for `tupleize_cols` is now `False` for both `to_csv` and `read_csv`. Fair warning in 0.12 ([GH 3604](https://github.com/pandas-dev/pandas/issues/3604)) +* default for `display.max_seq_len` is now 100 rather than `None`. This activates + truncated display (”…”) of long sequences in various places. ([GH 3391](https://github.com/pandas-dev/pandas/issues/3391)) + +## Deprecations[#](#deprecations "Link to this heading") + +Deprecated in 0.13.0 + +* deprecated `iterkv`, which will be removed in a future release (this was + an alias of iteritems used to bypass `2to3`’s changes). + ([GH 4384](https://github.com/pandas-dev/pandas/issues/4384), [GH 4375](https://github.com/pandas-dev/pandas/issues/4375), [GH 4372](https://github.com/pandas-dev/pandas/issues/4372)) +* deprecated the string method `match`, whose role is now performed more + idiomatically by `extract`. In a future release, the default behavior + of `match` will change to become analogous to `contains`, which returns + a boolean indexer. (Their + distinction is strictness: `match` relies on `re.match` while + `contains` relies on `re.search`.) In this release, the deprecated + behavior is the default, but the new behavior is available through the + keyword argument `as_indexer=True`. + +## Indexing API changes[#](#indexing-api-changes "Link to this heading") + +Prior to 0.13, it was impossible to use a label indexer (`.loc/.ix`) to set a value that +was not contained in the index of a particular axis. ([GH 2578](https://github.com/pandas-dev/pandas/issues/2578)). See [the docs](../user_guide/indexing.html#indexing-basics-partial-setting) + +In the `Series` case this is effectively an appending operation + +```None +In [6]: s = pd.Series([1, 2, 3]) + +In [7]: s +Out[7]: +0 1 +1 2 +2 3 +dtype: int64 + +In [8]: s[5] = 5. + +In [9]: s +Out[9]: +0 1.0 +1 2.0 +2 3.0 +5 5.0 +dtype: float64 +``` + +```None +In [10]: dfi = pd.DataFrame(np.arange(6).reshape(3, 2), + ....: columns=['A', 'B']) + ....: + +In [11]: dfi +Out[11]: + A B +0 0 1 +1 2 3 +2 4 5 +``` + +This would previously `KeyError` + +```None +In [12]: dfi.loc[:, 'C'] = dfi.loc[:, 'A'] + +In [13]: dfi +Out[13]: + A B C +0 0 1 0 +1 2 3 2 +2 4 5 4 +``` + +This is like an `append` operation. + +```None +In [14]: dfi.loc[3] = 5 + +In [15]: dfi +Out[15]: + A B C +0 0 1 0 +1 2 3 2 +2 4 5 4 +3 5 5 5 +``` + +A Panel setting operation on an arbitrary axis aligns the input to the Panel + +```None +In [20]: p = pd.Panel(np.arange(16).reshape(2, 4, 2), + ....: items=['Item1', 'Item2'], + ....: major_axis=pd.date_range('2001/1/12', periods=4), + ....: minor_axis=['A', 'B'], dtype='float64') + ....: + +In [21]: p +Out[21]: + +Dimensions: 2 (items) x 4 (major_axis) x 2 (minor_axis) +Items axis: Item1 to Item2 +Major_axis axis: 2001-01-12 00:00:00 to 2001-01-15 00:00:00 +Minor_axis axis: A to B + +In [22]: p.loc[:, :, 'C'] = pd.Series([30, 32], index=p.items) + +In [23]: p +Out[23]: + +Dimensions: 2 (items) x 4 (major_axis) x 3 (minor_axis) +Items axis: Item1 to Item2 +Major_axis axis: 2001-01-12 00:00:00 to 2001-01-15 00:00:00 +Minor_axis axis: A to C + +In [24]: p.loc[:, :, 'C'] +Out[24]: + Item1 Item2 +2001-01-12 30.0 32.0 +2001-01-13 30.0 32.0 +2001-01-14 30.0 32.0 +2001-01-15 30.0 32.0 +``` + +## Float64Index API change[#](#float64index-api-change "Link to this heading") + +* Added a new index type, `Float64Index`. This will be automatically created when passing floating values in index creation. + This enables a pure label-based slicing paradigm that makes `[],ix,loc` for scalar indexing and slicing work exactly the + same. ([GH 263](https://github.com/pandas-dev/pandas/issues/263)) + + Construction is by default for floating type values. + + ```None + In [16]: index = pd.Index([1.5, 2, 3, 4.5, 5]) + + In [17]: index + Out[17]: Index([1.5, 2.0, 3.0, 4.5, 5.0], dtype='float64') + + In [18]: s = pd.Series(range(5), index=index) + + In [19]: s + Out[19]: + 1.5 0 + 2.0 1 + 3.0 2 + 4.5 3 + 5.0 4 + dtype: int64 + ``` + + Scalar selection for `[],.ix,.loc` will always be label based. An integer will match an equal float index (e.g. `3` is equivalent to `3.0`) + + ```None + In [20]: s[3] + Out[20]: 2 + + In [21]: s.loc[3] + Out[21]: 2 + ``` + + The only positional indexing is via `iloc` + + ```None + In [22]: s.iloc[3] + Out[22]: 3 + ``` + + A scalar index that is not found will raise `KeyError` + + Slicing is ALWAYS on the values of the index, for `[],ix,loc` and ALWAYS positional with `iloc` + + ```None + In [23]: s[2:4] + Out[23]: + 2.0 1 + 3.0 2 + dtype: int64 + + In [24]: s.loc[2:4] + Out[24]: + 2.0 1 + 3.0 2 + dtype: int64 + + In [25]: s.iloc[2:4] + Out[25]: + 3.0 2 + 4.5 3 + dtype: int64 + ``` + + In float indexes, slicing using floats are allowed + + ```None + In [26]: s[2.1:4.6] + Out[26]: + 3.0 2 + 4.5 3 + dtype: int64 + + In [27]: s.loc[2.1:4.6] + Out[27]: + 3.0 2 + 4.5 3 + dtype: int64 + ``` +* Indexing on other index types are preserved (and positional fallback for `[],ix`), with the exception, that floating point slicing + on indexes on non `Float64Index` will now raise a `TypeError`. + + ```None + In [1]: pd.Series(range(5))[3.5] + TypeError: the label [3.5] is not a proper indexer for this index type (Int64Index) + + In [1]: pd.Series(range(5))[3.5:4.5] + TypeError: the slice start [3.5] is not a proper indexer for this index type (Int64Index) + ``` + + Using a scalar float indexer will be deprecated in a future version, but is allowed for now. + + ```None + In [3]: pd.Series(range(5))[3.0] + Out[3]: 3 + ``` + +## HDFStore API changes[#](#hdfstore-api-changes "Link to this heading") + +* Query Format Changes. A much more string-like query format is now supported. See [the docs](../user_guide/io.html#io-hdf5-query). + + ```None + In [28]: path = 'test.h5' + + In [29]: dfq = pd.DataFrame(np.random.randn(10, 4), + ....: columns=list('ABCD'), + ....: index=pd.date_range('20130101', periods=10)) + ....: + + In [30]: dfq.to_hdf(path, key='dfq', format='table', data_columns=True) + ``` + + Use boolean expressions, with in-line function evaluation. + + ```None + In [31]: pd.read_hdf(path, 'dfq', + ....: where="index>Timestamp('20130104') & columns=['A', 'B']") + ....: + Out[31]: + A B + 2013-01-05 -0.424972 0.567020 + 2013-01-06 -0.673690 0.113648 + 2013-01-07 0.404705 0.577046 + 2013-01-08 -0.370647 -1.157892 + 2013-01-09 1.075770 -0.109050 + 2013-01-10 0.357021 -0.674600 + ``` + + Use an inline column reference + + ```None + In [32]: pd.read_hdf(path, 'dfq', + ....: where="A>0 or C>0") + ....: + Out[32]: + A B C D + 2013-01-01 0.469112 -0.282863 -1.509059 -1.135632 + 2013-01-02 1.212112 -0.173215 0.119209 -1.044236 + 2013-01-04 0.721555 -0.706771 -1.039575 0.271860 + 2013-01-05 -0.424972 0.567020 0.276232 -1.087401 + 2013-01-07 0.404705 0.577046 -1.715002 -1.039268 + 2013-01-09 1.075770 -0.109050 1.643563 -1.469388 + 2013-01-10 0.357021 -0.674600 -1.776904 -0.968914 + ``` +* the `format` keyword now replaces the `table` keyword; allowed values are `fixed(f)` or `table(t)` + the same defaults as prior < 0.13.0 remain, e.g. `put` implies `fixed` format and `append` implies + `table` format. This default format can be set as an option by setting `io.hdf.default_format`. + + ```None + In [33]: path = 'test.h5' + + In [34]: df = pd.DataFrame(np.random.randn(10, 2)) + + In [35]: df.to_hdf(path, key='df_table', format='table') + + In [36]: df.to_hdf(path, key='df_table2', append=True) + + In [37]: df.to_hdf(path, key='df_fixed') + + In [38]: with pd.HDFStore(path) as store: + ....: print(store) + ....: + + File path: test.h5 + ``` +* Significant table writing performance improvements +* handle a passed `Series` in table format ([GH 4330](https://github.com/pandas-dev/pandas/issues/4330)) +* can now serialize a `timedelta64[ns]` dtype in a table ([GH 3577](https://github.com/pandas-dev/pandas/issues/3577)), See [the docs](../user_guide/io.html#io-hdf5-timedelta). +* added an `is_open` property to indicate if the underlying file handle is\_open; + a closed store will now report ‘CLOSED’ when viewing the store (rather than raising an error) + ([GH 4409](https://github.com/pandas-dev/pandas/issues/4409)) +* a close of a `HDFStore` now will close that instance of the `HDFStore` + but will only close the actual file if the ref count (by `PyTables`) w.r.t. all of the open handles + are 0. Essentially you have a local instance of `HDFStore` referenced by a variable. Once you + close it, it will report closed. Other references (to the same file) will continue to operate + until they themselves are closed. Performing an action on a closed file will raise + `ClosedFileError` + + ```None + In [39]: path = 'test.h5' + + In [40]: df = pd.DataFrame(np.random.randn(10, 2)) + + In [41]: store1 = pd.HDFStore(path) + + In [42]: store2 = pd.HDFStore(path) + + In [43]: store1.append('df', df) + + In [44]: store2.append('df2', df) + + In [45]: store1 + Out[45]: + + File path: test.h5 + + In [46]: store2 + Out[46]: + + File path: test.h5 + + In [47]: store1.close() + + In [48]: store2 + Out[48]: + + File path: test.h5 + + In [49]: store2.close() + + In [50]: store2 + Out[50]: + + File path: test.h5 + ``` +* removed the `_quiet` attribute, replace by a `DuplicateWarning` if retrieving + duplicate rows from a table ([GH 4367](https://github.com/pandas-dev/pandas/issues/4367)) +* removed the `warn` argument from `open`. Instead a `PossibleDataLossError` exception will + be raised if you try to use `mode='w'` with an OPEN file handle ([GH 4367](https://github.com/pandas-dev/pandas/issues/4367)) +* allow a passed locations array or mask as a `where` condition ([GH 4467](https://github.com/pandas-dev/pandas/issues/4467)). + See [the docs](../user_guide/io.html#io-hdf5-where-mask) for an example. +* add the keyword `dropna=True` to `append` to change whether ALL nan rows are not written + to the store (default is `True`, ALL nan rows are NOT written), also settable + via the option `io.hdf.dropna_table` ([GH 4625](https://github.com/pandas-dev/pandas/issues/4625)) +* pass through store creation arguments; can be used to support in-memory stores + +## DataFrame repr changes[#](#dataframe-repr-changes "Link to this heading") + +The HTML and plain text representations of [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") now show +a truncated view of the table once it exceeds a certain size, rather +than switching to the short info view ([GH 4886](https://github.com/pandas-dev/pandas/issues/4886), [GH 5550](https://github.com/pandas-dev/pandas/issues/5550)). +This makes the representation more consistent as small DataFrames get +larger. + +![Truncated HTML representation of a DataFrame](../_images/df_repr_truncated.png) + +To get the info view, call [`DataFrame.info()`](../reference/api/pandas.DataFrame.info.html#pandas.DataFrame.info "pandas.DataFrame.info"). If you prefer the +info view as the repr for large DataFrames, you can set this by running +`set_option('display.large_repr', 'info')`. + +## Enhancements[#](#enhancements "Link to this heading") + +* `df.to_clipboard()` learned a new `excel` keyword that let’s you + paste df data directly into excel (enabled by default). ([GH 5070](https://github.com/pandas-dev/pandas/issues/5070)). +* `read_html` now raises a `URLError` instead of catching and raising a + `ValueError` ([GH 4303](https://github.com/pandas-dev/pandas/issues/4303), [GH 4305](https://github.com/pandas-dev/pandas/issues/4305)) +* Added a test for `read_clipboard()` and `to_clipboard()` ([GH 4282](https://github.com/pandas-dev/pandas/issues/4282)) +* Clipboard functionality now works with PySide ([GH 4282](https://github.com/pandas-dev/pandas/issues/4282)) +* Added a more informative error message when plot arguments contain + overlapping color and style arguments ([GH 4402](https://github.com/pandas-dev/pandas/issues/4402)) +* `to_dict` now takes `records` as a possible out type. Returns an array + of column-keyed dictionaries. ([GH 4936](https://github.com/pandas-dev/pandas/issues/4936)) +* `NaN` handing in get\_dummies ([GH 4446](https://github.com/pandas-dev/pandas/issues/4446)) with `dummy_na` + + ```None + # previously, nan was erroneously counted as 2 here + # now it is not counted at all + In [51]: pd.get_dummies([1, 2, np.nan]) + Out[51]: + 1.0 2.0 + 0 True False + 1 False True + 2 False False + + # unless requested + In [52]: pd.get_dummies([1, 2, np.nan], dummy_na=True) + Out[52]: + 1.0 2.0 NaN + 0 True False False + 1 False True False + 2 False False True + ``` +* `timedelta64[ns]` operations. See [the docs](../user_guide/timedeltas.html#timedeltas-timedeltas-convert). + + Warning + + Most of these operations require `numpy >= 1.7` + + Using the new top-level `to_timedelta`, you can convert a scalar or array from the standard + timedelta format (produced by `to_csv`) into a timedelta type (`np.timedelta64` in `nanoseconds`). + + ```None + In [53]: pd.to_timedelta('1 days 06:05:01.00003') + Out[53]: Timedelta('1 days 06:05:01.000030') + + In [54]: pd.to_timedelta('15.5us') + Out[54]: Timedelta('0 days 00:00:00.000015500') + + In [55]: pd.to_timedelta(['1 days 06:05:01.00003', '15.5us', 'nan']) + Out[55]: TimedeltaIndex(['1 days 06:05:01.000030', '0 days 00:00:00.000015500', NaT], dtype='timedelta64[ns]', freq=None) + + In [56]: pd.to_timedelta(np.arange(5), unit='s') + Out[56]: + TimedeltaIndex(['0 days 00:00:00', '0 days 00:00:01', '0 days 00:00:02', + '0 days 00:00:03', '0 days 00:00:04'], + dtype='timedelta64[ns]', freq=None) + + In [57]: pd.to_timedelta(np.arange(5), unit='d') + Out[57]: TimedeltaIndex(['0 days', '1 days', '2 days', '3 days', '4 days'], dtype='timedelta64[ns]', freq=None) + ``` + + A Series of dtype `timedelta64[ns]` can now be divided by another + `timedelta64[ns]` object, or astyped to yield a `float64` dtyped Series. This + is frequency conversion. See [the docs](../user_guide/timedeltas.html#timedeltas-timedeltas-convert) for the docs. + + ```None + In [58]: import datetime + + In [59]: td = pd.Series(pd.date_range('20130101', periods=4)) - pd.Series( + ....: pd.date_range('20121201', periods=4)) + ....: + + In [60]: td[2] += np.timedelta64(datetime.timedelta(minutes=5, seconds=3)) + + In [61]: td[3] = np.nan + + In [62]: td + Out[62]: + 0 31 days 00:00:00 + 1 31 days 00:00:00 + 2 31 days 00:05:03 + 3 NaT + dtype: timedelta64[ns] + ``` + + ```None + # to days + In [63]: td / np.timedelta64(1, 'D') + Out[63]: + 0 31.000000 + 1 31.000000 + 2 31.003507 + 3 NaN + dtype: float64 + + In [64]: td.astype('timedelta64[D]') + Out[64]: + 0 31.0 + 1 31.0 + 2 31.0 + 3 NaN + dtype: float64 + + # to seconds + In [65]: td / np.timedelta64(1, 's') + Out[65]: + 0 2678400.0 + 1 2678400.0 + 2 2678703.0 + 3 NaN + dtype: float64 + + In [66]: td.astype('timedelta64[s]') + Out[66]: + 0 2678400.0 + 1 2678400.0 + 2 2678703.0 + 3 NaN + dtype: float64 + ``` + + Dividing or multiplying a `timedelta64[ns]` Series by an integer or integer Series + + ```None + In [63]: td * -1 + Out[63]: + 0 -31 days +00:00:00 + 1 -31 days +00:00:00 + 2 -32 days +23:54:57 + 3 NaT + dtype: timedelta64[ns] + + In [64]: td * pd.Series([1, 2, 3, 4]) + Out[64]: + 0 31 days 00:00:00 + 1 62 days 00:00:00 + 2 93 days 00:15:09 + 3 NaT + dtype: timedelta64[ns] + ``` + + Absolute `DateOffset` objects can act equivalently to `timedeltas` + + ```None + In [65]: from pandas import offsets + + In [66]: td + offsets.Minute(5) + offsets.Milli(5) + Out[66]: + 0 31 days 00:05:00.005000 + 1 31 days 00:05:00.005000 + 2 31 days 00:10:03.005000 + 3 NaT + dtype: timedelta64[ns] + ``` + + Fillna is now supported for timedeltas + + ```None + In [67]: td.fillna(pd.Timedelta(0)) + Out[67]: + 0 31 days 00:00:00 + 1 31 days 00:00:00 + 2 31 days 00:05:03 + 3 0 days 00:00:00 + dtype: timedelta64[ns] + + In [68]: td.fillna(datetime.timedelta(days=1, seconds=5)) + Out[68]: + 0 31 days 00:00:00 + 1 31 days 00:00:00 + 2 31 days 00:05:03 + 3 1 days 00:00:05 + dtype: timedelta64[ns] + ``` + + You can do numeric reduction operations on timedeltas. + + ```None + In [69]: td.mean() + Out[69]: Timedelta('31 days 00:01:41') + + In [70]: td.quantile(.1) + Out[70]: Timedelta('31 days 00:00:00') + ``` +* `plot(kind='kde')` now accepts the optional parameters `bw_method` and + `ind`, passed to scipy.stats.gaussian\_kde() (for scipy >= 0.11.0) to set + the bandwidth, and to gkde.evaluate() to specify the indices at which it + is evaluated, respectively. See scipy docs. ([GH 4298](https://github.com/pandas-dev/pandas/issues/4298)) +* DataFrame constructor now accepts a numpy masked record array ([GH 3478](https://github.com/pandas-dev/pandas/issues/3478)) +* The new vectorized string method `extract` return regular expression + matches more conveniently. + + ```None + In [71]: pd.Series(['a1', 'b2', 'c3']).str.extract('[ab](\\d)') + Out[71]: + 0 + 0 1 + 1 2 + 2 NaN + ``` + + Elements that do not match return `NaN`. Extracting a regular expression + with more than one group returns a DataFrame with one column per group. + + ```None + In [72]: pd.Series(['a1', 'b2', 'c3']).str.extract('([ab])(\\d)') + Out[72]: + 0 1 + 0 a 1 + 1 b 2 + 2 NaN NaN + ``` + + Elements that do not match return a row of `NaN`. + Thus, a Series of messy strings can be *converted* into a + like-indexed Series or DataFrame of cleaned-up or more useful strings, + without necessitating `get()` to access tuples or `re.match` objects. + + Named groups like + + ```None + In [73]: pd.Series(['a1', 'b2', 'c3']).str.extract( + ....: '(?P[ab])(?P\\d)') + ....: + Out[73]: + letter digit + 0 a 1 + 1 b 2 + 2 NaN NaN + ``` + + and optional groups can also be used. + + ```None + In [74]: pd.Series(['a1', 'b2', '3']).str.extract( + ....: '(?P[ab])?(?P\\d)') + ....: + Out[74]: + letter digit + 0 a 1 + 1 b 2 + 2 NaN 3 + ``` +* `read_stata` now accepts Stata 13 format ([GH 4291](https://github.com/pandas-dev/pandas/issues/4291)) +* `read_fwf` now infers the column specifications from the first 100 rows of + the file if the data has correctly separated and properly aligned columns + using the delimiter provided to the function ([GH 4488](https://github.com/pandas-dev/pandas/issues/4488)). +* support for nanosecond times as an offset + + Warning + + These operations require `numpy >= 1.7` + + Period conversions in the range of seconds and below were reworked and extended + up to nanoseconds. Periods in the nanosecond range are now available. + + ```None + In [79]: pd.date_range('2013-01-01', periods=5, freq='5N') + Out[79]: + DatetimeIndex([ '2013-01-01 00:00:00', + '2013-01-01 00:00:00.000000005', + '2013-01-01 00:00:00.000000010', + '2013-01-01 00:00:00.000000015', + '2013-01-01 00:00:00.000000020'], + dtype='datetime64[ns]', freq='5N') + ``` + + or with frequency as offset + + ```None + In [75]: pd.date_range('2013-01-01', periods=5, freq=pd.offsets.Nano(5)) + Out[75]: + DatetimeIndex([ '2013-01-01 00:00:00', + '2013-01-01 00:00:00.000000005', + '2013-01-01 00:00:00.000000010', + '2013-01-01 00:00:00.000000015', + '2013-01-01 00:00:00.000000020'], + dtype='datetime64[ns]', freq='5ns') + ``` + + Timestamps can be modified in the nanosecond range + + ```None + In [76]: t = pd.Timestamp('20130101 09:01:02') + + In [77]: t + pd.tseries.offsets.Nano(123) + Out[77]: Timestamp('2013-01-01 09:01:02.000000123') + ``` +* A new method, `isin` for DataFrames, which plays nicely with boolean indexing. The argument to `isin`, what we’re comparing the DataFrame to, can be a DataFrame, Series, dict, or array of values. See [the docs](../user_guide/indexing.html#indexing-basics-indexing-isin) for more. + + To get the rows where any of the conditions are met: + + ```None + In [78]: dfi = pd.DataFrame({'A': [1, 2, 3, 4], 'B': ['a', 'b', 'f', 'n']}) + + In [79]: dfi + Out[79]: + A B + 0 1 a + 1 2 b + 2 3 f + 3 4 n + + In [80]: other = pd.DataFrame({'A': [1, 3, 3, 7], 'B': ['e', 'f', 'f', 'e']}) + + In [81]: mask = dfi.isin(other) + + In [82]: mask + Out[82]: + A B + 0 True False + 1 False False + 2 True True + 3 False False + + In [83]: dfi[mask.any(axis=1)] + Out[83]: + A B + 0 1 a + 2 3 f + ``` +* `Series` now supports a `to_frame` method to convert it to a single-column DataFrame ([GH 5164](https://github.com/pandas-dev/pandas/issues/5164)) +* All R datasets listed here can now be loaded into pandas objects + + ```None + # note that pandas.rpy was deprecated in v0.16.0 + import pandas.rpy.common as com + com.load_data('Titanic') + ``` +* `tz_localize` can infer a fall daylight savings transition based on the structure + of the unlocalized data ([GH 4230](https://github.com/pandas-dev/pandas/issues/4230)), see [the docs](../user_guide/timeseries.html#timeseries-timezone) +* `DatetimeIndex` is now in the API documentation, see [the docs](../reference/indexing.html#api-datetimeindex) +* `json_normalize()` is a new method to allow you to create a flat table + from semi-structured JSON data. See [the docs](../user_guide/io.html#io-json-normalize) ([GH 1067](https://github.com/pandas-dev/pandas/issues/1067)) +* Added PySide support for the qtpandas DataFrameModel and DataFrameWidget. +* Python csv parser now supports usecols ([GH 4335](https://github.com/pandas-dev/pandas/issues/4335)) +* Frequencies gained several new offsets: + + + `LastWeekOfMonth` ([GH 4637](https://github.com/pandas-dev/pandas/issues/4637)) + + `FY5253`, and `FY5253Quarter` ([GH 4511](https://github.com/pandas-dev/pandas/issues/4511)) +* DataFrame has a new `interpolate` method, similar to Series ([GH 4434](https://github.com/pandas-dev/pandas/issues/4434), [GH 1892](https://github.com/pandas-dev/pandas/issues/1892)) + + ```None + In [84]: df = pd.DataFrame({'A': [1, 2.1, np.nan, 4.7, 5.6, 6.8], + ....: 'B': [.25, np.nan, np.nan, 4, 12.2, 14.4]}) + ....: + + In [85]: df.interpolate() + Out[85]: + A B + 0 1.0 0.25 + 1 2.1 1.50 + 2 3.4 2.75 + 3 4.7 4.00 + 4 5.6 12.20 + 5 6.8 14.40 + ``` + + Additionally, the `method` argument to `interpolate` has been expanded + to include `'nearest', 'zero', 'slinear', 'quadratic', 'cubic', + 'barycentric', 'krogh', 'piecewise_polynomial', 'pchip', 'polynomial', 'spline'` + The new methods require [scipy](http://www.scipy.org). Consult the Scipy reference [guide](https://docs.scipy.org/doc/scipy/tutorial/interpolate.html) and [documentation](http://docs.scipy.org/doc/scipy/reference/interpolate.html#univariate-interpolation) for more information + about when the various methods are appropriate. See [the docs](../user_guide/missing_data.html#missing-data-interpolate). + + Interpolate now also accepts a `limit` keyword argument. + This works similar to `fillna`’s limit: + + ```None + In [86]: ser = pd.Series([1, 3, np.nan, np.nan, np.nan, 11]) + + In [87]: ser.interpolate(limit=2) + Out[87]: + 0 1.0 + 1 3.0 + 2 5.0 + 3 7.0 + 4 NaN + 5 11.0 + dtype: float64 + ``` +* Added `wide_to_long` panel data convenience function. See [the docs](../user_guide/reshaping.html#reshaping-melt). + + ```None + In [88]: np.random.seed(123) + + In [89]: df = pd.DataFrame({"A1970" : {0 : "a", 1 : "b", 2 : "c"}, + ....: "A1980" : {0 : "d", 1 : "e", 2 : "f"}, + ....: "B1970" : {0 : 2.5, 1 : 1.2, 2 : .7}, + ....: "B1980" : {0 : 3.2, 1 : 1.3, 2 : .1}, + ....: "X" : dict(zip(range(3), np.random.randn(3))) + ....: }) + ....: + + In [90]: df["id"] = df.index + + In [91]: df + Out[91]: + A1970 A1980 B1970 B1980 X id + 0 a d 2.5 3.2 -1.085631 0 + 1 b e 1.2 1.3 0.997345 1 + 2 c f 0.7 0.1 0.282978 2 + + In [92]: pd.wide_to_long(df, ["A", "B"], i="id", j="year") + Out[92]: + X A B + id year + 0 1970 -1.085631 a 2.5 + 1 1970 0.997345 b 1.2 + 2 1970 0.282978 c 0.7 + 0 1980 -1.085631 d 3.2 + 1 1980 0.997345 e 1.3 + 2 1980 0.282978 f 0.1 + ``` + +* `to_csv` now takes a `date_format` keyword argument that specifies how + output datetime objects should be formatted. Datetimes encountered in the + index, columns, and values will all have this formatting applied. ([GH 4313](https://github.com/pandas-dev/pandas/issues/4313)) +* `DataFrame.plot` will scatter plot x versus y by passing `kind='scatter'` ([GH 2215](https://github.com/pandas-dev/pandas/issues/2215)) +* Added support for Google Analytics v3 API segment IDs that also supports v2 IDs. ([GH 5271](https://github.com/pandas-dev/pandas/issues/5271)) + +## Experimental[#](#experimental "Link to this heading") + +* The new [`eval()`](../reference/api/pandas.eval.html#pandas.eval "pandas.eval") function implements expression evaluation using + `numexpr` behind the scenes. This results in large speedups for + complicated expressions involving large DataFrames/Series. For example, + + ```None + In [93]: nrows, ncols = 20000, 100 + + In [94]: df1, df2, df3, df4 = [pd.DataFrame(np.random.randn(nrows, ncols)) + ....: for _ in range(4)] + ....: + ``` + + ```None + # eval with NumExpr backend + In [95]: %timeit pd.eval('df1 + df2 + df3 + df4') + 7.71 ms +- 273 us per loop (mean +- std. dev. of 7 runs, 100 loops each) + ``` + + ```None + # pure Python evaluation + In [96]: %timeit df1 + df2 + df3 + df4 + 7.19 ms +- 306 us per loop (mean +- std. dev. of 7 runs, 100 loops each) + ``` + + For more details, see the [the docs](../user_guide/enhancingperf.html#enhancingperf-eval) +* Similar to `pandas.eval`, [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") has a new + `DataFrame.eval` method that evaluates an expression in the context of + the `DataFrame`. For example, + + ```None + In [97]: df = pd.DataFrame(np.random.randn(10, 2), columns=['a', 'b']) + + In [98]: df.eval('a + b') + Out[98]: + 0 -0.685204 + 1 1.589745 + 2 0.325441 + 3 -1.784153 + 4 -0.432893 + 5 0.171850 + 6 1.895919 + 7 3.065587 + 8 -0.092759 + 9 1.391365 + dtype: float64 + ``` +* [`query()`](../reference/api/pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") method has been added that allows + you to select elements of a `DataFrame` using a natural query syntax + nearly identical to Python syntax. For example, + + ```None + In [99]: n = 20 + + In [100]: df = pd.DataFrame(np.random.randint(n, size=(n, 3)), columns=['a', 'b', 'c']) + + In [101]: df.query('a < b < c') + Out[101]: + a b c + 11 1 5 8 + 15 8 16 19 + ``` + + selects all the rows of `df` where `a < b < c` evaluates to `True`. + For more details see the [the docs](../user_guide/indexing.html#indexing-query). +* `pd.read_msgpack()` and `pd.to_msgpack()` are now a supported method of serialization + of arbitrary pandas (and python objects) in a lightweight portable binary format. See [the docs](../user_guide/io.html#io-msgpack) + + Warning + + Since this is an EXPERIMENTAL LIBRARY, the storage format may not be stable until a future release. + + ```None + df = pd.DataFrame(np.random.rand(5, 2), columns=list('AB')) + df.to_msgpack('foo.msg') + pd.read_msgpack('foo.msg') + + s = pd.Series(np.random.rand(5), index=pd.date_range('20130101', periods=5)) + pd.to_msgpack('foo.msg', df, s) + pd.read_msgpack('foo.msg') + ``` + + You can pass `iterator=True` to iterator over the unpacked results + + ```None + for o in pd.read_msgpack('foo.msg', iterator=True): + print(o) + ``` +* `pandas.io.gbq` provides a simple way to extract from, and load data into, + Google’s BigQuery Data Sets by way of pandas DataFrames. BigQuery is a high + performance SQL-like database service, useful for performing ad-hoc queries + against extremely large datasets. [See the docs](../user_guide/io.html#io-bigquery) + + ```None + from pandas.io import gbq + + # A query to select the average monthly temperatures in the + # in the year 2000 across the USA. The dataset, + # publicata:samples.gsod, is available on all BigQuery accounts, + # and is based on NOAA gsod data. + + query = """SELECT station_number as STATION, + month as MONTH, AVG(mean_temp) as MEAN_TEMP + FROM publicdata:samples.gsod + WHERE YEAR = 2000 + GROUP BY STATION, MONTH + ORDER BY STATION, MONTH ASC""" + + # Fetch the result set for this query + + # Your Google BigQuery Project ID + # To find this, see your dashboard: + # https://console.developers.google.com/iam-admin/projects?authuser=0 + projectid = 'xxxxxxxxx' + df = gbq.read_gbq(query, project_id=projectid) + + # Use pandas to process and reshape the dataset + + df2 = df.pivot(index='STATION', columns='MONTH', values='MEAN_TEMP') + df3 = pd.concat([df2.min(), df2.mean(), df2.max()], + axis=1, keys=["Min Tem", "Mean Temp", "Max Temp"]) + ``` + + The resulting DataFrame is: + + ```None + > df3 + Min Tem Mean Temp Max Temp + MONTH + 1 -53.336667 39.827892 89.770968 + 2 -49.837500 43.685219 93.437932 + 3 -77.926087 48.708355 96.099998 + 4 -82.892858 55.070087 97.317240 + 5 -92.378261 61.428117 102.042856 + 6 -77.703334 65.858888 102.900000 + 7 -87.821428 68.169663 106.510714 + 8 -89.431999 68.614215 105.500000 + 9 -86.611112 63.436935 107.142856 + 10 -78.209677 56.880838 92.103333 + 11 -50.125000 48.861228 94.996428 + 12 -50.332258 42.286879 94.396774 + ``` + + Warning + + To use this module, you will need a BigQuery account. See + <> for details. + + As of 10/10/13, there is a bug in Google’s API preventing result sets + from being larger than 100,000 rows. A patch is scheduled for the week of + 10/14/13. + +## Internal refactoring[#](#internal-refactoring "Link to this heading") + +In 0.13.0 there is a major refactor primarily to subclass `Series` from +`NDFrame`, which is the base class currently for `DataFrame` and `Panel`, +to unify methods and behaviors. Series formerly subclassed directly from +`ndarray`. ([GH 4080](https://github.com/pandas-dev/pandas/issues/4080), [GH 3862](https://github.com/pandas-dev/pandas/issues/3862), [GH 816](https://github.com/pandas-dev/pandas/issues/816)) + +Warning + +There are two potential incompatibilities from < 0.13.0 + +* Using certain numpy functions would previously return a `Series` if passed a `Series` + as an argument. This seems only to affect `np.ones_like`, `np.empty_like`, + `np.diff` and `np.where`. These now return `ndarrays`. + + ```None + In [102]: s = pd.Series([1, 2, 3, 4]) + ``` + + Numpy Usage + + ```None + In [103]: np.ones_like(s) + Out[103]: array([1, 1, 1, 1]) + + In [104]: np.diff(s) + Out[104]: array([1, 1, 1]) + + In [105]: np.where(s > 1, s, np.nan) + Out[105]: array([nan, 2., 3., 4.]) + ``` + + Pandonic Usage + + ```None + In [106]: pd.Series(1, index=s.index) + Out[106]: + 0 1 + 1 1 + 2 1 + 3 1 + dtype: int64 + + In [107]: s.diff() + Out[107]: + 0 NaN + 1 1.0 + 2 1.0 + 3 1.0 + dtype: float64 + + In [108]: s.where(s > 1) + Out[108]: + 0 NaN + 1 2.0 + 2 3.0 + 3 4.0 + dtype: float64 + ``` +* Passing a `Series` directly to a cython function expecting an `ndarray` type will no + long work directly, you must pass `Series.values`, See [Enhancing Performance](../user_guide/enhancingperf.html#enhancingperf-ndarray) +* `Series(0.5)` would previously return the scalar `0.5`, instead this will return a 1-element `Series` +* This change breaks `rpy2<=2.3.8`. an Issue has been opened against rpy2 and a workaround + is detailed in [GH 5698](https://github.com/pandas-dev/pandas/issues/5698). Thanks @JanSchulz. + +* Pickle compatibility is preserved for pickles created prior to 0.13. These must be unpickled with `pd.read_pickle`, see [Pickling](../user_guide/io.html#io-pickle). +* Refactor of series.py/frame.py/panel.py to move common code to generic.py + + + added `_setup_axes` to created generic NDFrame structures + + moved methods + + - `from_axes,_wrap_array,axes,ix,loc,iloc,shape,empty,swapaxes,transpose,pop` + - `__iter__,keys,__contains__,__len__,__neg__,__invert__` + - `convert_objects,as_blocks,as_matrix,values` + - `__getstate__,__setstate__` (compat remains in frame/panel) + - `__getattr__,__setattr__` + - `_indexed_same,reindex_like,align,where,mask` + - `fillna,replace` (`Series` replace is now consistent with `DataFrame`) + - `filter` (also added axis argument to selectively filter on a different axis) + - `reindex,reindex_axis,take` + - `truncate` (moved to become part of `NDFrame`) +* These are API changes which make `Panel` more consistent with `DataFrame` + + + `swapaxes` on a `Panel` with the same axes specified now return a copy + + support attribute access for setting + + filter supports the same API as the original `DataFrame` filter +* Reindex called with no arguments will now return a copy of the input object +* `TimeSeries` is now an alias for `Series`. the property `is_time_series` + can be used to distinguish (if desired) +* Refactor of Sparse objects to use BlockManager + + + Created a new block type in internals, `SparseBlock`, which can hold multi-dtypes + and is non-consolidatable. `SparseSeries` and `SparseDataFrame` now inherit + more methods from there hierarchy (Series/DataFrame), and no longer inherit + from `SparseArray` (which instead is the object of the `SparseBlock`) + + Sparse suite now supports integration with non-sparse data. Non-float sparse + data is supportable (partially implemented) + + Operations on sparse structures within DataFrames should preserve sparseness, + merging type operations will convert to dense (and back to sparse), so might + be somewhat inefficient + + enable setitem on `SparseSeries` for boolean/integer/slices + + `SparsePanels` implementation is unchanged (e.g. not using BlockManager, needs work) +* added `ftypes` method to Series/DataFrame, similar to `dtypes`, but indicates + if the underlying is sparse/dense (as well as the dtype) +* All `NDFrame` objects can now use `__finalize__()` to specify various + values to propagate to new objects from an existing one (e.g. `name` in `Series` will + follow more automatically now) +* Internal type checking is now done via a suite of generated classes, allowing `isinstance(value, klass)` + without having to directly import the klass, courtesy of @jtratner +* Bug in Series update where the parent frame is not updating its cache based on + changes ([GH 4080](https://github.com/pandas-dev/pandas/issues/4080)) or types ([GH 3217](https://github.com/pandas-dev/pandas/issues/3217)), fillna ([GH 3386](https://github.com/pandas-dev/pandas/issues/3386)) +* Indexing with dtype conversions fixed ([GH 4463](https://github.com/pandas-dev/pandas/issues/4463), [GH 4204](https://github.com/pandas-dev/pandas/issues/4204)) +* Refactor `Series.reindex` to core/generic.py ([GH 4604](https://github.com/pandas-dev/pandas/issues/4604), [GH 4618](https://github.com/pandas-dev/pandas/issues/4618)), allow `method=` in reindexing + on a Series to work +* `Series.copy` no longer accepts the `order` parameter and is now consistent with `NDFrame` copy +* Refactor `rename` methods to core/generic.py; fixes `Series.rename` for ([GH 4605](https://github.com/pandas-dev/pandas/issues/4605)), and adds `rename` + with the same signature for `Panel` +* Refactor `clip` methods to core/generic.py ([GH 4798](https://github.com/pandas-dev/pandas/issues/4798)) +* Refactor of `_get_numeric_data/_get_bool_data` to core/generic.py, allowing Series/Panel functionality +* `Series` (for index) / `Panel` (for items) now allow attribute access to its elements ([GH 1903](https://github.com/pandas-dev/pandas/issues/1903)) + + ```None + In [109]: s = pd.Series([1, 2, 3], index=list('abc')) + + In [110]: s.b + Out[110]: 2 + + In [111]: s.a = 5 + + In [112]: s + Out[112]: + a 5 + b 2 + c 3 + dtype: int64 + ``` + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* `HDFStore` + + + raising an invalid `TypeError` rather than `ValueError` when + appending with a different block ordering ([GH 4096](https://github.com/pandas-dev/pandas/issues/4096)) + + `read_hdf` was not respecting as passed `mode` ([GH 4504](https://github.com/pandas-dev/pandas/issues/4504)) + + appending a 0-len table will work correctly ([GH 4273](https://github.com/pandas-dev/pandas/issues/4273)) + + `to_hdf` was raising when passing both arguments `append` and + `table` ([GH 4584](https://github.com/pandas-dev/pandas/issues/4584)) + + reading from a store with duplicate columns across dtypes would raise + ([GH 4767](https://github.com/pandas-dev/pandas/issues/4767)) + + Fixed a bug where `ValueError` wasn’t correctly raised when column + names weren’t strings ([GH 4956](https://github.com/pandas-dev/pandas/issues/4956)) + + A zero length series written in Fixed format not deserializing properly. + ([GH 4708](https://github.com/pandas-dev/pandas/issues/4708)) + + Fixed decoding perf issue on pyt3 ([GH 5441](https://github.com/pandas-dev/pandas/issues/5441)) + + Validate levels in a MultiIndex before storing ([GH 5527](https://github.com/pandas-dev/pandas/issues/5527)) + + Correctly handle `data_columns` with a Panel ([GH 5717](https://github.com/pandas-dev/pandas/issues/5717)) +* Fixed bug in tslib.tz\_convert(vals, tz1, tz2): it could raise IndexError + exception while trying to access trans[pos + 1] ([GH 4496](https://github.com/pandas-dev/pandas/issues/4496)) +* The `by` argument now works correctly with the `layout` argument + ([GH 4102](https://github.com/pandas-dev/pandas/issues/4102), [GH 4014](https://github.com/pandas-dev/pandas/issues/4014)) in `*.hist` plotting methods +* Fixed bug in `PeriodIndex.map` where using `str` would return the str + representation of the index ([GH 4136](https://github.com/pandas-dev/pandas/issues/4136)) +* Fixed test failure `test_time_series_plot_color_with_empty_kwargs` when + using custom matplotlib default colors ([GH 4345](https://github.com/pandas-dev/pandas/issues/4345)) +* Fix running of stata IO tests. Now uses temporary files to write + ([GH 4353](https://github.com/pandas-dev/pandas/issues/4353)) +* Fixed an issue where `DataFrame.sum` was slower than `DataFrame.mean` + for integer valued frames ([GH 4365](https://github.com/pandas-dev/pandas/issues/4365)) +* `read_html` tests now work with Python 2.6 ([GH 4351](https://github.com/pandas-dev/pandas/issues/4351)) +* Fixed bug where `network` testing was throwing `NameError` because a + local variable was undefined ([GH 4381](https://github.com/pandas-dev/pandas/issues/4381)) +* In `to_json`, raise if a passed `orient` would cause loss of data + because of a duplicate index ([GH 4359](https://github.com/pandas-dev/pandas/issues/4359)) +* In `to_json`, fix date handling so milliseconds are the default timestamp + as the docstring says ([GH 4362](https://github.com/pandas-dev/pandas/issues/4362)). +* `as_index` is no longer ignored when doing groupby apply ([GH 4648](https://github.com/pandas-dev/pandas/issues/4648), + [GH 3417](https://github.com/pandas-dev/pandas/issues/3417)) +* JSON NaT handling fixed, NaTs are now serialized to `null` ([GH 4498](https://github.com/pandas-dev/pandas/issues/4498)) +* Fixed JSON handling of escapable characters in JSON object keys + ([GH 4593](https://github.com/pandas-dev/pandas/issues/4593)) +* Fixed passing `keep_default_na=False` when `na_values=None` + ([GH 4318](https://github.com/pandas-dev/pandas/issues/4318)) +* Fixed bug with `values` raising an error on a DataFrame with duplicate + columns and mixed dtypes, surfaced in ([GH 4377](https://github.com/pandas-dev/pandas/issues/4377)) +* Fixed bug with duplicate columns and type conversion in `read_json` when + `orient='split'` ([GH 4377](https://github.com/pandas-dev/pandas/issues/4377)) +* Fixed JSON bug where locales with decimal separators other than ‘.’ threw + exceptions when encoding / decoding certain values. ([GH 4918](https://github.com/pandas-dev/pandas/issues/4918)) +* Fix `.iat` indexing with a `PeriodIndex` ([GH 4390](https://github.com/pandas-dev/pandas/issues/4390)) +* Fixed an issue where `PeriodIndex` joining with self was returning a new + instance rather than the same instance ([GH 4379](https://github.com/pandas-dev/pandas/issues/4379)); also adds a test + for this for the other index types +* Fixed a bug with all the dtypes being converted to object when using the + CSV cparser with the usecols parameter ([GH 3192](https://github.com/pandas-dev/pandas/issues/3192)) +* Fix an issue in merging blocks where the resulting DataFrame had partially + set \_ref\_locs ([GH 4403](https://github.com/pandas-dev/pandas/issues/4403)) +* Fixed an issue where hist subplots were being overwritten when they were + called using the top level matplotlib API ([GH 4408](https://github.com/pandas-dev/pandas/issues/4408)) +* Fixed a bug where calling `Series.astype(str)` would truncate the string + ([GH 4405](https://github.com/pandas-dev/pandas/issues/4405), [GH 4437](https://github.com/pandas-dev/pandas/issues/4437)) +* Fixed a py3 compat issue where bytes were being repr’d as tuples + ([GH 4455](https://github.com/pandas-dev/pandas/issues/4455)) +* Fixed Panel attribute naming conflict if item is named ‘a’ + ([GH 3440](https://github.com/pandas-dev/pandas/issues/3440)) +* Fixed an issue where duplicate indexes were raising when plotting + ([GH 4486](https://github.com/pandas-dev/pandas/issues/4486)) +* Fixed an issue where cumsum and cumprod didn’t work with bool dtypes + ([GH 4170](https://github.com/pandas-dev/pandas/issues/4170), [GH 4440](https://github.com/pandas-dev/pandas/issues/4440)) +* Fixed Panel slicing issued in `xs` that was returning an incorrect dimmed + object ([GH 4016](https://github.com/pandas-dev/pandas/issues/4016)) +* Fix resampling bug where custom reduce function not used if only one group + ([GH 3849](https://github.com/pandas-dev/pandas/issues/3849), [GH 4494](https://github.com/pandas-dev/pandas/issues/4494)) +* Fixed Panel assignment with a transposed frame ([GH 3830](https://github.com/pandas-dev/pandas/issues/3830)) +* Raise on set indexing with a Panel and a Panel as a value which needs + alignment ([GH 3777](https://github.com/pandas-dev/pandas/issues/3777)) +* frozenset objects now raise in the `Series` constructor ([GH 4482](https://github.com/pandas-dev/pandas/issues/4482), + [GH 4480](https://github.com/pandas-dev/pandas/issues/4480)) +* Fixed issue with sorting a duplicate MultiIndex that has multiple dtypes + ([GH 4516](https://github.com/pandas-dev/pandas/issues/4516)) +* Fixed bug in `DataFrame.set_values` which was causing name attributes to + be lost when expanding the index. ([GH 3742](https://github.com/pandas-dev/pandas/issues/3742), [GH 4039](https://github.com/pandas-dev/pandas/issues/4039)) +* Fixed issue where individual `names`, `levels` and `labels` could be + set on `MultiIndex` without validation ([GH 3714](https://github.com/pandas-dev/pandas/issues/3714), [GH 4039](https://github.com/pandas-dev/pandas/issues/4039)) +* Fixed ([GH 3334](https://github.com/pandas-dev/pandas/issues/3334)) in pivot\_table. Margins did not compute if values is + the index. +* Fix bug in having a rhs of `np.timedelta64` or `np.offsets.DateOffset` + when operating with datetimes ([GH 4532](https://github.com/pandas-dev/pandas/issues/4532)) +* Fix arithmetic with series/datetimeindex and `np.timedelta64` not working + the same ([GH 4134](https://github.com/pandas-dev/pandas/issues/4134)) and buggy timedelta in NumPy 1.6 ([GH 4135](https://github.com/pandas-dev/pandas/issues/4135)) +* Fix bug in `pd.read_clipboard` on windows with PY3 ([GH 4561](https://github.com/pandas-dev/pandas/issues/4561)); not + decoding properly +* `tslib.get_period_field()` and `tslib.get_period_field_arr()` now raise + if code argument out of range ([GH 4519](https://github.com/pandas-dev/pandas/issues/4519), [GH 4520](https://github.com/pandas-dev/pandas/issues/4520)) +* Fix boolean indexing on an empty series loses index names ([GH 4235](https://github.com/pandas-dev/pandas/issues/4235)), + infer\_dtype works with empty arrays. +* Fix reindexing with multiple axes; if an axes match was not replacing the + current axes, leading to a possible lazy frequency inference issue + ([GH 3317](https://github.com/pandas-dev/pandas/issues/3317)) +* Fixed issue where `DataFrame.apply` was reraising exceptions incorrectly + (causing the original stack trace to be truncated). +* Fix selection with `ix/loc` and non\_unique selectors ([GH 4619](https://github.com/pandas-dev/pandas/issues/4619)) +* Fix assignment with iloc/loc involving a dtype change in an existing column + ([GH 4312](https://github.com/pandas-dev/pandas/issues/4312), [GH 5702](https://github.com/pandas-dev/pandas/issues/5702)) have internal setitem\_with\_indexer in core/indexing + to use Block.setitem +* Fixed bug where thousands operator was not handled correctly for floating + point numbers in csv\_import ([GH 4322](https://github.com/pandas-dev/pandas/issues/4322)) +* Fix an issue with CacheableOffset not properly being used by many + DateOffset; this prevented the DateOffset from being cached ([GH 4609](https://github.com/pandas-dev/pandas/issues/4609)) +* Fix boolean comparison with a DataFrame on the lhs, and a list/tuple on the + rhs ([GH 4576](https://github.com/pandas-dev/pandas/issues/4576)) +* Fix error/dtype conversion with setitem of `None` on `Series/DataFrame` + ([GH 4667](https://github.com/pandas-dev/pandas/issues/4667)) +* Fix decoding based on a passed in non-default encoding in `pd.read_stata` + ([GH 4626](https://github.com/pandas-dev/pandas/issues/4626)) +* Fix `DataFrame.from_records` with a plain-vanilla `ndarray`. + ([GH 4727](https://github.com/pandas-dev/pandas/issues/4727)) +* Fix some inconsistencies with `Index.rename` and `MultiIndex.rename`, + etc. ([GH 4718](https://github.com/pandas-dev/pandas/issues/4718), [GH 4628](https://github.com/pandas-dev/pandas/issues/4628)) +* Bug in using `iloc/loc` with a cross-sectional and duplicate indices + ([GH 4726](https://github.com/pandas-dev/pandas/issues/4726)) +* Bug with using `QUOTE_NONE` with `to_csv` causing `Exception`. + ([GH 4328](https://github.com/pandas-dev/pandas/issues/4328)) +* Bug with Series indexing not raising an error when the right-hand-side has + an incorrect length ([GH 2702](https://github.com/pandas-dev/pandas/issues/2702)) +* Bug in MultiIndexing with a partial string selection as one part of a + MultIndex ([GH 4758](https://github.com/pandas-dev/pandas/issues/4758)) +* Bug with reindexing on the index with a non-unique index will now raise + `ValueError` ([GH 4746](https://github.com/pandas-dev/pandas/issues/4746)) +* Bug in setting with `loc/ix` a single indexer with a MultiIndex axis and + a NumPy array, related to ([GH 3777](https://github.com/pandas-dev/pandas/issues/3777)) +* Bug in concatenation with duplicate columns across dtypes not merging with + axis=0 ([GH 4771](https://github.com/pandas-dev/pandas/issues/4771), [GH 4975](https://github.com/pandas-dev/pandas/issues/4975)) +* Bug in `iloc` with a slice index failing ([GH 4771](https://github.com/pandas-dev/pandas/issues/4771)) +* Incorrect error message with no colspecs or width in `read_fwf`. + ([GH 4774](https://github.com/pandas-dev/pandas/issues/4774)) +* Fix bugs in indexing in a Series with a duplicate index ([GH 4548](https://github.com/pandas-dev/pandas/issues/4548), + [GH 4550](https://github.com/pandas-dev/pandas/issues/4550)) +* Fixed bug with reading compressed files with `read_fwf` in Python 3. + ([GH 3963](https://github.com/pandas-dev/pandas/issues/3963)) +* Fixed an issue with a duplicate index and assignment with a dtype change + ([GH 4686](https://github.com/pandas-dev/pandas/issues/4686)) +* Fixed bug with reading compressed files in as `bytes` rather than `str` + in Python 3. Simplifies bytes-producing file-handling in Python 3 + ([GH 3963](https://github.com/pandas-dev/pandas/issues/3963), [GH 4785](https://github.com/pandas-dev/pandas/issues/4785)). +* Fixed an issue related to ticklocs/ticklabels with log scale bar plots + across different versions of matplotlib ([GH 4789](https://github.com/pandas-dev/pandas/issues/4789)) +* Suppressed DeprecationWarning associated with internal calls issued by + repr() ([GH 4391](https://github.com/pandas-dev/pandas/issues/4391)) +* Fixed an issue with a duplicate index and duplicate selector with `.loc` + ([GH 4825](https://github.com/pandas-dev/pandas/issues/4825)) +* Fixed an issue with `DataFrame.sort_index` where, when sorting by a + single column and passing a list for `ascending`, the argument for + `ascending` was being interpreted as `True` ([GH 4839](https://github.com/pandas-dev/pandas/issues/4839), + [GH 4846](https://github.com/pandas-dev/pandas/issues/4846)) +* Fixed `Panel.tshift` not working. Added `freq` support to `Panel.shift` + ([GH 4853](https://github.com/pandas-dev/pandas/issues/4853)) +* Fix an issue in TextFileReader w/ Python engine (i.e. PythonParser) + with thousands != “,” ([GH 4596](https://github.com/pandas-dev/pandas/issues/4596)) +* Bug in getitem with a duplicate index when using where ([GH 4879](https://github.com/pandas-dev/pandas/issues/4879)) +* Fix Type inference code coerces float column into datetime ([GH 4601](https://github.com/pandas-dev/pandas/issues/4601)) +* Fixed `_ensure_numeric` does not check for complex numbers + ([GH 4902](https://github.com/pandas-dev/pandas/issues/4902)) +* Fixed a bug in `Series.hist` where two figures were being created when + the `by` argument was passed ([GH 4112](https://github.com/pandas-dev/pandas/issues/4112), [GH 4113](https://github.com/pandas-dev/pandas/issues/4113)). +* Fixed a bug in `convert_objects` for > 2 ndims ([GH 4937](https://github.com/pandas-dev/pandas/issues/4937)) +* Fixed a bug in DataFrame/Panel cache insertion and subsequent indexing + ([GH 4939](https://github.com/pandas-dev/pandas/issues/4939), [GH 5424](https://github.com/pandas-dev/pandas/issues/5424)) +* Fixed string methods for `FrozenNDArray` and `FrozenList` + ([GH 4929](https://github.com/pandas-dev/pandas/issues/4929)) +* Fixed a bug with setting invalid or out-of-range values in indexing + enlargement scenarios ([GH 4940](https://github.com/pandas-dev/pandas/issues/4940)) +* Tests for fillna on empty Series ([GH 4346](https://github.com/pandas-dev/pandas/issues/4346)), thanks @immerrr +* Fixed `copy()` to shallow copy axes/indices as well and thereby keep + separate metadata. ([GH 4202](https://github.com/pandas-dev/pandas/issues/4202), [GH 4830](https://github.com/pandas-dev/pandas/issues/4830)) +* Fixed skiprows option in Python parser for read\_csv ([GH 4382](https://github.com/pandas-dev/pandas/issues/4382)) +* Fixed bug preventing `cut` from working with `np.inf` levels without + explicitly passing labels ([GH 3415](https://github.com/pandas-dev/pandas/issues/3415)) +* Fixed wrong check for overlapping in `DatetimeIndex.union` + ([GH 4564](https://github.com/pandas-dev/pandas/issues/4564)) +* Fixed conflict between thousands separator and date parser in csv\_parser + ([GH 4678](https://github.com/pandas-dev/pandas/issues/4678)) +* Fix appending when dtypes are not the same (error showing mixing + float/np.datetime64) ([GH 4993](https://github.com/pandas-dev/pandas/issues/4993)) +* Fix repr for DateOffset. No longer show duplicate entries in kwds. + Removed unused offset fields. ([GH 4638](https://github.com/pandas-dev/pandas/issues/4638)) +* Fixed wrong index name during read\_csv if using usecols. Applies to c + parser only. ([GH 4201](https://github.com/pandas-dev/pandas/issues/4201)) +* `Timestamp` objects can now appear in the left hand side of a comparison + operation with a `Series` or `DataFrame` object ([GH 4982](https://github.com/pandas-dev/pandas/issues/4982)). +* Fix a bug when indexing with `np.nan` via `iloc/loc` ([GH 5016](https://github.com/pandas-dev/pandas/issues/5016)) +* Fixed a bug where low memory c parser could create different types in + different chunks of the same file. Now coerces to numerical type or raises + warning. ([GH 3866](https://github.com/pandas-dev/pandas/issues/3866)) +* Fix a bug where reshaping a `Series` to its own shape raised + `TypeError` ([GH 4554](https://github.com/pandas-dev/pandas/issues/4554)) and other reshaping issues. +* Bug in setting with `ix/loc` and a mixed int/string index ([GH 4544](https://github.com/pandas-dev/pandas/issues/4544)) +* Make sure series-series boolean comparisons are label based ([GH 4947](https://github.com/pandas-dev/pandas/issues/4947)) +* Bug in multi-level indexing with a Timestamp partial indexer + ([GH 4294](https://github.com/pandas-dev/pandas/issues/4294)) +* Tests/fix for MultiIndex construction of an all-nan frame ([GH 4078](https://github.com/pandas-dev/pandas/issues/4078)) +* Fixed a bug where [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") wasn’t correctly inferring + values of tables with commas ([GH 5029](https://github.com/pandas-dev/pandas/issues/5029)) +* Fixed a bug where [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") wasn’t providing a stable + ordering of returned tables ([GH 4770](https://github.com/pandas-dev/pandas/issues/4770), [GH 5029](https://github.com/pandas-dev/pandas/issues/5029)). +* Fixed a bug where [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") was incorrectly parsing when + passed `index_col=0` ([GH 5066](https://github.com/pandas-dev/pandas/issues/5066)). +* Fixed a bug where [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") was incorrectly inferring the + type of headers ([GH 5048](https://github.com/pandas-dev/pandas/issues/5048)). +* Fixed a bug where `DatetimeIndex` joins with `PeriodIndex` caused a + stack overflow ([GH 3899](https://github.com/pandas-dev/pandas/issues/3899)). +* Fixed a bug where `groupby` objects didn’t allow plots ([GH 5102](https://github.com/pandas-dev/pandas/issues/5102)). +* Fixed a bug where `groupby` objects weren’t tab-completing column names + ([GH 5102](https://github.com/pandas-dev/pandas/issues/5102)). +* Fixed a bug where `groupby.plot()` and friends were duplicating figures + multiple times ([GH 5102](https://github.com/pandas-dev/pandas/issues/5102)). +* Provide automatic conversion of `object` dtypes on fillna, related + ([GH 5103](https://github.com/pandas-dev/pandas/issues/5103)) +* Fixed a bug where default options were being overwritten in the option + parser cleaning ([GH 5121](https://github.com/pandas-dev/pandas/issues/5121)). +* Treat a list/ndarray identically for `iloc` indexing with list-like + ([GH 5006](https://github.com/pandas-dev/pandas/issues/5006)) +* Fix `MultiIndex.get_level_values()` with missing values ([GH 5074](https://github.com/pandas-dev/pandas/issues/5074)) +* Fix bound checking for Timestamp() with datetime64 input ([GH 4065](https://github.com/pandas-dev/pandas/issues/4065)) +* Fix a bug where `TestReadHtml` wasn’t calling the correct `read_html()` + function ([GH 5150](https://github.com/pandas-dev/pandas/issues/5150)). +* Fix a bug with `NDFrame.replace()` which made replacement appear as + though it was (incorrectly) using regular expressions ([GH 5143](https://github.com/pandas-dev/pandas/issues/5143)). +* Fix better error message for to\_datetime ([GH 4928](https://github.com/pandas-dev/pandas/issues/4928)) +* Made sure different locales are tested on travis-ci ([GH 4918](https://github.com/pandas-dev/pandas/issues/4918)). Also + adds a couple of utilities for getting locales and setting locales with a + context manager. +* Fixed segfault on `isnull(MultiIndex)` (now raises an error instead) + ([GH 5123](https://github.com/pandas-dev/pandas/issues/5123), [GH 5125](https://github.com/pandas-dev/pandas/issues/5125)) +* Allow duplicate indices when performing operations that align + ([GH 5185](https://github.com/pandas-dev/pandas/issues/5185), [GH 5639](https://github.com/pandas-dev/pandas/issues/5639)) +* Compound dtypes in a constructor raise `NotImplementedError` + ([GH 5191](https://github.com/pandas-dev/pandas/issues/5191)) +* Bug in comparing duplicate frames ([GH 4421](https://github.com/pandas-dev/pandas/issues/4421)) related +* Bug in describe on duplicate frames +* Bug in `to_datetime` with a format and `coerce=True` not raising + ([GH 5195](https://github.com/pandas-dev/pandas/issues/5195)) +* Bug in `loc` setting with multiple indexers and a rhs of a Series that + needs broadcasting ([GH 5206](https://github.com/pandas-dev/pandas/issues/5206)) +* Fixed bug where inplace setting of levels or labels on `MultiIndex` would + not clear cached `values` property and therefore return wrong `values`. + ([GH 5215](https://github.com/pandas-dev/pandas/issues/5215)) +* Fixed bug where filtering a grouped DataFrame or Series did not maintain + the original ordering ([GH 4621](https://github.com/pandas-dev/pandas/issues/4621)). +* Fixed `Period` with a business date freq to always roll-forward if on a + non-business date. ([GH 5203](https://github.com/pandas-dev/pandas/issues/5203)) +* Fixed bug in Excel writers where frames with duplicate column names weren’t + written correctly. ([GH 5235](https://github.com/pandas-dev/pandas/issues/5235)) +* Fixed issue with `drop` and a non-unique index on Series ([GH 5248](https://github.com/pandas-dev/pandas/issues/5248)) +* Fixed segfault in C parser caused by passing more names than columns in + the file. ([GH 5156](https://github.com/pandas-dev/pandas/issues/5156)) +* Fix `Series.isin` with date/time-like dtypes ([GH 5021](https://github.com/pandas-dev/pandas/issues/5021)) +* C and Python Parser can now handle the more common MultiIndex column + format which doesn’t have a row for index names ([GH 4702](https://github.com/pandas-dev/pandas/issues/4702)) +* Bug when trying to use an out-of-bounds date as an object dtype + ([GH 5312](https://github.com/pandas-dev/pandas/issues/5312)) +* Bug when trying to display an embedded PandasObject ([GH 5324](https://github.com/pandas-dev/pandas/issues/5324)) +* Allows operating of Timestamps to return a datetime if the result is out-of-bounds + related ([GH 5312](https://github.com/pandas-dev/pandas/issues/5312)) +* Fix return value/type signature of `initObjToJSON()` to be compatible + with numpy’s `import_array()` ([GH 5334](https://github.com/pandas-dev/pandas/issues/5334), [GH 5326](https://github.com/pandas-dev/pandas/issues/5326)) +* Bug when renaming then set\_index on a DataFrame ([GH 5344](https://github.com/pandas-dev/pandas/issues/5344)) +* Test suite no longer leaves around temporary files when testing graphics. ([GH 5347](https://github.com/pandas-dev/pandas/issues/5347)) + (thanks for catching this @yarikoptic!) +* Fixed html tests on win32. ([GH 4580](https://github.com/pandas-dev/pandas/issues/4580)) +* Make sure that `head/tail` are `iloc` based, ([GH 5370](https://github.com/pandas-dev/pandas/issues/5370)) +* Fixed bug for `PeriodIndex` string representation if there are 1 or 2 + elements. ([GH 5372](https://github.com/pandas-dev/pandas/issues/5372)) +* The GroupBy methods `transform` and `filter` can be used on Series + and DataFrames that have repeated (non-unique) indices. ([GH 4620](https://github.com/pandas-dev/pandas/issues/4620)) +* Fix empty series not printing name in repr ([GH 4651](https://github.com/pandas-dev/pandas/issues/4651)) +* Make tests create temp files in temp directory by default. ([GH 5419](https://github.com/pandas-dev/pandas/issues/5419)) +* `pd.to_timedelta` of a scalar returns a scalar ([GH 5410](https://github.com/pandas-dev/pandas/issues/5410)) +* `pd.to_timedelta` accepts `NaN` and `NaT`, returning `NaT` instead of raising ([GH 5437](https://github.com/pandas-dev/pandas/issues/5437)) +* performance improvements in `isnull` on larger size pandas objects +* Fixed various setitem with 1d ndarray that does not have a matching + length to the indexer ([GH 5508](https://github.com/pandas-dev/pandas/issues/5508)) +* Bug in getitem with a MultiIndex and `iloc` ([GH 5528](https://github.com/pandas-dev/pandas/issues/5528)) +* Bug in delitem on a Series ([GH 5542](https://github.com/pandas-dev/pandas/issues/5542)) +* Bug fix in apply when using custom function and objects are not mutated ([GH 5545](https://github.com/pandas-dev/pandas/issues/5545)) +* Bug in selecting from a non-unique index with `loc` ([GH 5553](https://github.com/pandas-dev/pandas/issues/5553)) +* Bug in groupby returning non-consistent types when user function returns a `None`, ([GH 5592](https://github.com/pandas-dev/pandas/issues/5592)) +* Work around regression in numpy 1.7.0 which erroneously raises IndexError from `ndarray.item` ([GH 5666](https://github.com/pandas-dev/pandas/issues/5666)) +* Bug in repeated indexing of object with resultant non-unique index ([GH 5678](https://github.com/pandas-dev/pandas/issues/5678)) +* Bug in fillna with Series and a passed series/dict ([GH 5703](https://github.com/pandas-dev/pandas/issues/5703)) +* Bug in groupby transform with a datetime-like grouper ([GH 5712](https://github.com/pandas-dev/pandas/issues/5712)) +* Bug in MultiIndex selection in PY3 when using certain keys ([GH 5725](https://github.com/pandas-dev/pandas/issues/5725)) +* Row-wise concat of differing dtypes failing in certain cases ([GH 5754](https://github.com/pandas-dev/pandas/issues/5754)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 77 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Agustín Herranz + +* Alex Gaudio + +* Alex Rothberg + +* Andreas Klostermann + +* Andreas Würl + +* Andy Hayden +* Ben Alex + +* Benedikt Sauer + +* Brad Buran +* Caleb Epstein + +* Chang She +* Christopher Whelan +* DSM + +* Dale Jung + +* Dan Birken +* David Rasch + +* Dieter Vandenbussche +* Gabi Davar + +* Garrett Drapala +* Goyo + +* Greg Reda + +* Ivan Smirnov + +* Jack Kelly + +* Jacob Schaer + +* Jan Schulz + +* Jeff Tratner +* Jeffrey Tratner +* John McNamara + +* John W. O’Brien + +* Joris Van den Bossche +* Justin Bozonier + +* Kelsey Jordahl +* Kevin Stone +* Kieran O’Mahony +* Kyle Hausmann + +* Kyle Kelley + +* Kyle Meyer +* Mike Kelly +* Mortada Mehyar + +* Nick Foti + +* Olivier Harris + +* Ondřej Čertík + +* PKEuS +* Phillip Cloud +* Pierre Haessig + +* Richard T. Guy + +* Roman Pekar + +* Roy Hyunjin Han +* Skipper Seabold +* Sten + +* Thomas A Caswell + +* Thomas Kluyver +* Tiago Requeijo + +* TomAugspurger +* Trent Hauck +* Valentin Haenel + +* Viktor Kerkez + +* Vincent Arel-Bundock +* Wes McKinney +* Wes Turner + +* Weston Renoud + +* Yaroslav Halchenko +* Zach Dwiel + +* chapman siu + +* chappers + +* d10genes + +* danielballan +* daydreamt + +* engstrom + +* jreback +* monicaBee + +* prossahl + +* rockg + +* unutbu + +* westurner + +* y-p +* zach powers diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.13.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.13.1.md new file mode 100644 index 0000000000000000000000000000000000000000..ac8a1c4229db03953aaf5f89dfe285de821ca862 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.13.1.md @@ -0,0 +1,582 @@ +# What's new in pandas 0.13.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.13.1.html + +# Version 0.13.1 (February 3, 2014)[#](#version-0-13-1-february-3-2014 "Link to this heading") + +This is a minor release from 0.13.0 and includes a small number of API changes, several new features, +enhancements, and performance improvements along with a large number of bug fixes. We recommend that all +users upgrade to this version. + +Highlights include: + +* Added `infer_datetime_format` keyword to `read_csv/to_datetime` to allow speedups for homogeneously formatted datetimes. +* Will intelligently limit display precision for datetime/timedelta formats. +* Enhanced Panel `apply()` method. +* Suggested tutorials in new [Tutorials](https://matplotlib.org/stable/tutorials/index.html#tutorials "(in Matplotlib v3.10.6)") section. +* Our pandas ecosystem is growing, We now feature related projects in a new [ecosystem page](https://pandas.pydata.org/community/ecosystem.html) section. +* Much work has been taking place on improving the docs, and a new [Contributing](../development/contributing.html#contributing) section has been added. +* Even though it may only be of interest to devs, we <3 our new CI status page: [ScatterCI](http://scatterci.github.io/pydata/pandas). + +Warning + +0.13.1 fixes a bug that was caused by a combination of having numpy < 1.8, and doing +chained assignment on a string-like array. Please review [the docs](../user_guide/indexing.html#indexing-view-versus-copy), +chained indexing can have unexpected results and should generally be avoided. + +This would previously segfault: + +```None +df = pd.DataFrame({"A": np.array(["foo", "bar", "bah", "foo", "bar"])}) +df["A"].iloc[0] = np.nan +``` + +The recommended way to do this type of assignment is: + +```None +In [1]: df = pd.DataFrame({"A": np.array(["foo", "bar", "bah", "foo", "bar"])}) + +In [2]: df.loc[0, "A"] = np.nan + +In [3]: df +Out[3]: + A +0 NaN +1 bar +2 bah +3 foo +4 bar +``` + +## Output formatting enhancements[#](#output-formatting-enhancements "Link to this heading") + +* df.info() view now display dtype info per column ([GH 5682](https://github.com/pandas-dev/pandas/issues/5682)) +* df.info() now honors the option `max_info_rows`, to disable null counts for large frames ([GH 5974](https://github.com/pandas-dev/pandas/issues/5974)) + + ```None + In [4]: max_info_rows = pd.get_option("max_info_rows") + + In [5]: df = pd.DataFrame( + ...: { + ...: "A": np.random.randn(10), + ...: "B": np.random.randn(10), + ...: "C": pd.date_range("20130101", periods=10), + ...: } + ...: ) + ...: + + In [6]: df.iloc[3:6, [0, 2]] = np.nan + ``` + + ```None + # set to not display the null counts + In [7]: pd.set_option("max_info_rows", 0) + + In [8]: df.info() + + RangeIndex: 10 entries, 0 to 9 + Data columns (total 3 columns): + # Column Dtype + --- ------ ----- + 0 A float64 + 1 B float64 + 2 C datetime64[ns] + dtypes: datetime64[ns](1), float64(2) + memory usage: 368.0 bytes + ``` + + ```None + # this is the default (same as in 0.13.0) + In [9]: pd.set_option("max_info_rows", max_info_rows) + + In [10]: df.info() + + RangeIndex: 10 entries, 0 to 9 + Data columns (total 3 columns): + # Column Non-Null Count Dtype + --- ------ -------------- ----- + 0 A 7 non-null float64 + 1 B 10 non-null float64 + 2 C 7 non-null datetime64[ns] + dtypes: datetime64[ns](1), float64(2) + memory usage: 368.0 bytes + ``` +* Add `show_dimensions` display option for the new DataFrame repr to control whether the dimensions print. + + ```None + In [11]: df = pd.DataFrame([[1, 2], [3, 4]]) + + In [12]: pd.set_option("show_dimensions", False) + + In [13]: df + Out[13]: + 0 1 + 0 1 2 + 1 3 4 + + In [14]: pd.set_option("show_dimensions", True) + + In [15]: df + Out[15]: + 0 1 + 0 1 2 + 1 3 4 + + [2 rows x 2 columns] + ``` +* The `ArrayFormatter` for `datetime` and `timedelta64` now intelligently + limit precision based on the values in the array ([GH 3401](https://github.com/pandas-dev/pandas/issues/3401)) + + Previously output might look like: + + ```None + age today diff + 0 2001-01-01 00:00:00 2013-04-19 00:00:00 4491 days, 00:00:00 + 1 2004-06-01 00:00:00 2013-04-19 00:00:00 3244 days, 00:00:00 + ``` + + Now the output looks like: + + ```None + In [16]: df = pd.DataFrame( + ....: [pd.Timestamp("20010101"), pd.Timestamp("20040601")], columns=["age"] + ....: ) + ....: + + In [17]: df["today"] = pd.Timestamp("20130419") + + In [18]: df["diff"] = df["today"] - df["age"] + + In [19]: df + Out[19]: + age today diff + 0 2001-01-01 2013-04-19 4491 days + 1 2004-06-01 2013-04-19 3244 days + + [2 rows x 3 columns] + ``` + +## API changes[#](#api-changes "Link to this heading") + +* Add `-NaN` and `-nan` to the default set of NA values ([GH 5952](https://github.com/pandas-dev/pandas/issues/5952)). + See [NA Values](../user_guide/io.html#io-na-values). +* Added `Series.str.get_dummies` vectorized string method ([GH 6021](https://github.com/pandas-dev/pandas/issues/6021)), to extract + dummy/indicator variables for separated string columns: + + ```None + In [20]: s = pd.Series(["a", "a|b", np.nan, "a|c"]) + + In [21]: s.str.get_dummies(sep="|") + Out[21]: + a b c + 0 1 0 0 + 1 1 1 0 + 2 0 0 0 + 3 1 0 1 + + [4 rows x 3 columns] + ``` +* Added the `NDFrame.equals()` method to compare if two NDFrames are + equal have equal axes, dtypes, and values. Added the + `array_equivalent` function to compare if two ndarrays are + equal. NaNs in identical locations are treated as + equal. ([GH 5283](https://github.com/pandas-dev/pandas/issues/5283)) See also [the docs](../user_guide/basics.html#basics-equals) for a motivating example. + + ```None + df = pd.DataFrame({"col": ["foo", 0, np.nan]}) + df2 = pd.DataFrame({"col": [np.nan, 0, "foo"]}, index=[2, 1, 0]) + df.equals(df2) + df.equals(df2.sort_index()) + ``` +* `DataFrame.apply` will use the `reduce` argument to determine whether a + `Series` or a `DataFrame` should be returned when the `DataFrame` is + empty ([GH 6007](https://github.com/pandas-dev/pandas/issues/6007)). + + Previously, calling `DataFrame.apply` an empty `DataFrame` would return + either a `DataFrame` if there were no columns, or the function being + applied would be called with an empty `Series` to guess whether a + `Series` or `DataFrame` should be returned: + + ```None + In [32]: def applied_func(col): + ....: print("Apply function being called with: ", col) + ....: return col.sum() + ....: + + In [33]: empty = DataFrame(columns=['a', 'b']) + + In [34]: empty.apply(applied_func) + Apply function being called with: Series([], Length: 0, dtype: float64) + Out[34]: + a NaN + b NaN + Length: 2, dtype: float64 + ``` + + Now, when `apply` is called on an empty `DataFrame`: if the `reduce` + argument is `True` a `Series` will returned, if it is `False` a + `DataFrame` will be returned, and if it is `None` (the default) the + function being applied will be called with an empty series to try and guess + the return type. + + ```None + In [35]: empty.apply(applied_func, reduce=True) + Out[35]: + a NaN + b NaN + Length: 2, dtype: float64 + + In [36]: empty.apply(applied_func, reduce=False) + Out[36]: + Empty DataFrame + Columns: [a, b] + Index: [] + + [0 rows x 2 columns] + ``` + +## Prior version deprecations/changes[#](#prior-version-deprecations-changes "Link to this heading") + +There are no announced changes in 0.13 or prior that are taking effect as of 0.13.1 + +## Deprecations[#](#deprecations "Link to this heading") + +There are no deprecations of prior behavior in 0.13.1 + +## Enhancements[#](#enhancements "Link to this heading") + +* `pd.read_csv` and `pd.to_datetime` learned a new `infer_datetime_format` keyword which greatly + improves parsing perf in many cases. Thanks to @lexual for suggesting and @danbirken + for rapidly implementing. ([GH 5490](https://github.com/pandas-dev/pandas/issues/5490), [GH 6021](https://github.com/pandas-dev/pandas/issues/6021)) + + If `parse_dates` is enabled and this flag is set, pandas will attempt to + infer the format of the datetime strings in the columns, and if it can + be inferred, switch to a faster method of parsing them. In some cases + this can increase the parsing speed by ~5-10x. + + ```None + # Try to infer the format for the index column + df = pd.read_csv( + "foo.csv", index_col=0, parse_dates=True, infer_datetime_format=True + ) + ``` +* `date_format` and `datetime_format` keywords can now be specified when writing to `excel` + files ([GH 4133](https://github.com/pandas-dev/pandas/issues/4133)) +* `MultiIndex.from_product` convenience function for creating a MultiIndex from + the cartesian product of a set of iterables ([GH 6055](https://github.com/pandas-dev/pandas/issues/6055)): + + ```None + In [22]: shades = ["light", "dark"] + + In [23]: colors = ["red", "green", "blue"] + + In [24]: pd.MultiIndex.from_product([shades, colors], names=["shade", "color"]) + Out[24]: + MultiIndex([('light', 'red'), + ('light', 'green'), + ('light', 'blue'), + ( 'dark', 'red'), + ( 'dark', 'green'), + ( 'dark', 'blue')], + names=['shade', 'color']) + ``` +* Panel `apply()` will work on non-ufuncs. See [the docs](../user_guide/basics.html#basics-apply). + + ```None + In [28]: import pandas._testing as tm + + In [29]: panel = tm.makePanel(5) + + In [30]: panel + Out[30]: + + Dimensions: 3 (items) x 5 (major_axis) x 4 (minor_axis) + Items axis: ItemA to ItemC + Major_axis axis: 2000-01-03 00:00:00 to 2000-01-07 00:00:00 + Minor_axis axis: A to D + + In [31]: panel['ItemA'] + Out[31]: + A B C D + 2000-01-03 -0.673690 0.577046 -1.344312 -1.469388 + 2000-01-04 0.113648 -1.715002 0.844885 0.357021 + 2000-01-05 -1.478427 -1.039268 1.075770 -0.674600 + 2000-01-06 0.524988 -0.370647 -0.109050 -1.776904 + 2000-01-07 0.404705 -1.157892 1.643563 -0.968914 + + [5 rows x 4 columns] + ``` + + Specifying an `apply` that operates on a Series (to return a single element) + + ```None + In [32]: panel.apply(lambda x: x.dtype, axis='items') + Out[32]: + A B C D + 2000-01-03 float64 float64 float64 float64 + 2000-01-04 float64 float64 float64 float64 + 2000-01-05 float64 float64 float64 float64 + 2000-01-06 float64 float64 float64 float64 + 2000-01-07 float64 float64 float64 float64 + + [5 rows x 4 columns] + ``` + + A similar reduction type operation + + ```None + In [33]: panel.apply(lambda x: x.sum(), axis='major_axis') + Out[33]: + ItemA ItemB ItemC + A -1.108775 -1.090118 -2.984435 + B -3.705764 0.409204 1.866240 + C 2.110856 2.960500 -0.974967 + D -4.532785 0.303202 -3.685193 + + [4 rows x 3 columns] + ``` + + This is equivalent to + + ```None + In [34]: panel.sum('major_axis') + Out[34]: + ItemA ItemB ItemC + A -1.108775 -1.090118 -2.984435 + B -3.705764 0.409204 1.866240 + C 2.110856 2.960500 -0.974967 + D -4.532785 0.303202 -3.685193 + + [4 rows x 3 columns] + ``` + + A transformation operation that returns a Panel, but is computing + the z-score across the major\_axis + + ```None + In [35]: result = panel.apply(lambda x: (x - x.mean()) / x.std(), + ....: axis='major_axis') + ....: + + In [36]: result + Out[36]: + + Dimensions: 3 (items) x 5 (major_axis) x 4 (minor_axis) + Items axis: ItemA to ItemC + Major_axis axis: 2000-01-03 00:00:00 to 2000-01-07 00:00:00 + Minor_axis axis: A to D + + In [37]: result['ItemA'] # noqa E999 + Out[37]: + A B C D + 2000-01-03 -0.535778 1.500802 -1.506416 -0.681456 + 2000-01-04 0.397628 -1.108752 0.360481 1.529895 + 2000-01-05 -1.489811 -0.339412 0.557374 0.280845 + 2000-01-06 0.885279 0.421830 -0.453013 -1.053785 + 2000-01-07 0.742682 -0.474468 1.041575 -0.075499 + + [5 rows x 4 columns] + ``` +* Panel `apply()` operating on cross-sectional slabs. ([GH 1148](https://github.com/pandas-dev/pandas/issues/1148)) + + ```None + In [38]: def f(x): + ....: return ((x.T - x.mean(1)) / x.std(1)).T + ....: + + In [39]: result = panel.apply(f, axis=['items', 'major_axis']) + + In [40]: result + Out[40]: + + Dimensions: 4 (items) x 5 (major_axis) x 3 (minor_axis) + Items axis: A to D + Major_axis axis: 2000-01-03 00:00:00 to 2000-01-07 00:00:00 + Minor_axis axis: ItemA to ItemC + + In [41]: result.loc[:, :, 'ItemA'] + Out[41]: + A B C D + 2000-01-03 0.012922 -0.030874 -0.629546 -0.757034 + 2000-01-04 0.392053 -1.071665 0.163228 0.548188 + 2000-01-05 -1.093650 -0.640898 0.385734 -1.154310 + 2000-01-06 1.005446 -1.154593 -0.595615 -0.809185 + 2000-01-07 0.783051 -0.198053 0.919339 -1.052721 + + [5 rows x 4 columns] + ``` + + This is equivalent to the following + + ```None + In [42]: result = pd.Panel({ax: f(panel.loc[:, :, ax]) for ax in panel.minor_axis}) + + In [43]: result + Out[43]: + + Dimensions: 4 (items) x 5 (major_axis) x 3 (minor_axis) + Items axis: A to D + Major_axis axis: 2000-01-03 00:00:00 to 2000-01-07 00:00:00 + Minor_axis axis: ItemA to ItemC + + In [44]: result.loc[:, :, 'ItemA'] + Out[44]: + A B C D + 2000-01-03 0.012922 -0.030874 -0.629546 -0.757034 + 2000-01-04 0.392053 -1.071665 0.163228 0.548188 + 2000-01-05 -1.093650 -0.640898 0.385734 -1.154310 + 2000-01-06 1.005446 -1.154593 -0.595615 -0.809185 + 2000-01-07 0.783051 -0.198053 0.919339 -1.052721 + + [5 rows x 4 columns] + ``` + +## Performance[#](#performance "Link to this heading") + +Performance improvements for 0.13.1 + +* Series datetime/timedelta binary operations ([GH 5801](https://github.com/pandas-dev/pandas/issues/5801)) +* DataFrame `count/dropna` for `axis=1` +* Series.str.contains now has a `regex=False` keyword which can be faster for plain (non-regex) string patterns. ([GH 5879](https://github.com/pandas-dev/pandas/issues/5879)) +* Series.str.extract ([GH 5944](https://github.com/pandas-dev/pandas/issues/5944)) +* `dtypes/ftypes` methods ([GH 5968](https://github.com/pandas-dev/pandas/issues/5968)) +* indexing with object dtypes ([GH 5968](https://github.com/pandas-dev/pandas/issues/5968)) +* `DataFrame.apply` ([GH 6013](https://github.com/pandas-dev/pandas/issues/6013)) +* Regression in JSON IO ([GH 5765](https://github.com/pandas-dev/pandas/issues/5765)) +* Index construction from Series ([GH 6150](https://github.com/pandas-dev/pandas/issues/6150)) + +## Experimental[#](#experimental "Link to this heading") + +There are no experimental changes in 0.13.1 + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in `io.wb.get_countries` not including all countries ([GH 6008](https://github.com/pandas-dev/pandas/issues/6008)) +* Bug in Series replace with timestamp dict ([GH 5797](https://github.com/pandas-dev/pandas/issues/5797)) +* read\_csv/read\_table now respects the `prefix` kwarg ([GH 5732](https://github.com/pandas-dev/pandas/issues/5732)). +* Bug in selection with missing values via `.ix` from a duplicate indexed DataFrame failing ([GH 5835](https://github.com/pandas-dev/pandas/issues/5835)) +* Fix issue of boolean comparison on empty DataFrames ([GH 5808](https://github.com/pandas-dev/pandas/issues/5808)) +* Bug in isnull handling `NaT` in an object array ([GH 5443](https://github.com/pandas-dev/pandas/issues/5443)) +* Bug in `to_datetime` when passed a `np.nan` or integer datelike and a format string ([GH 5863](https://github.com/pandas-dev/pandas/issues/5863)) +* Bug in groupby dtype conversion with datetimelike ([GH 5869](https://github.com/pandas-dev/pandas/issues/5869)) +* Regression in handling of empty Series as indexers to Series ([GH 5877](https://github.com/pandas-dev/pandas/issues/5877)) +* Bug in internal caching, related to ([GH 5727](https://github.com/pandas-dev/pandas/issues/5727)) +* Testing bug in reading JSON/msgpack from a non-filepath on windows under py3 ([GH 5874](https://github.com/pandas-dev/pandas/issues/5874)) +* Bug when assigning to .ix[tuple(…)] ([GH 5896](https://github.com/pandas-dev/pandas/issues/5896)) +* Bug in fully reindexing a Panel ([GH 5905](https://github.com/pandas-dev/pandas/issues/5905)) +* Bug in idxmin/max with object dtypes ([GH 5914](https://github.com/pandas-dev/pandas/issues/5914)) +* Bug in `BusinessDay` when adding n days to a date not on offset when n>5 and n%5==0 ([GH 5890](https://github.com/pandas-dev/pandas/issues/5890)) +* Bug in assigning to chained series with a series via ix ([GH 5928](https://github.com/pandas-dev/pandas/issues/5928)) +* Bug in creating an empty DataFrame, copying, then assigning ([GH 5932](https://github.com/pandas-dev/pandas/issues/5932)) +* Bug in DataFrame.tail with empty frame ([GH 5846](https://github.com/pandas-dev/pandas/issues/5846)) +* Bug in propagating metadata on `resample` ([GH 5862](https://github.com/pandas-dev/pandas/issues/5862)) +* Fixed string-representation of `NaT` to be “NaT” ([GH 5708](https://github.com/pandas-dev/pandas/issues/5708)) +* Fixed string-representation for Timestamp to show nanoseconds if present ([GH 5912](https://github.com/pandas-dev/pandas/issues/5912)) +* `pd.match` not returning passed sentinel +* `Panel.to_frame()` no longer fails when `major_axis` is a + `MultiIndex` ([GH 5402](https://github.com/pandas-dev/pandas/issues/5402)). +* Bug in `pd.read_msgpack` with inferring a `DateTimeIndex` frequency + incorrectly ([GH 5947](https://github.com/pandas-dev/pandas/issues/5947)) +* Fixed `to_datetime` for array with both Tz-aware datetimes and `NaT`’s ([GH 5961](https://github.com/pandas-dev/pandas/issues/5961)) +* Bug in rolling skew/kurtosis when passed a Series with bad data ([GH 5749](https://github.com/pandas-dev/pandas/issues/5749)) +* Bug in scipy `interpolate` methods with a datetime index ([GH 5975](https://github.com/pandas-dev/pandas/issues/5975)) +* Bug in NaT comparison if a mixed datetime/np.datetime64 with NaT were passed ([GH 5968](https://github.com/pandas-dev/pandas/issues/5968)) +* Fixed bug with `pd.concat` losing dtype information if all inputs are empty ([GH 5742](https://github.com/pandas-dev/pandas/issues/5742)) +* Recent changes in IPython cause warnings to be emitted when using previous versions + of pandas in QTConsole, now fixed. If you’re using an older version and + need to suppress the warnings, see ([GH 5922](https://github.com/pandas-dev/pandas/issues/5922)). +* Bug in merging `timedelta` dtypes ([GH 5695](https://github.com/pandas-dev/pandas/issues/5695)) +* Bug in plotting.scatter\_matrix function. Wrong alignment among diagonal + and off-diagonal plots, see ([GH 5497](https://github.com/pandas-dev/pandas/issues/5497)). +* Regression in Series with a MultiIndex via ix ([GH 6018](https://github.com/pandas-dev/pandas/issues/6018)) +* Bug in Series.xs with a MultiIndex ([GH 6018](https://github.com/pandas-dev/pandas/issues/6018)) +* Bug in Series construction of mixed type with datelike and an integer (which should result in + object type and not automatic conversion) ([GH 6028](https://github.com/pandas-dev/pandas/issues/6028)) +* Possible segfault when chained indexing with an object array under NumPy 1.7.1 ([GH 6026](https://github.com/pandas-dev/pandas/issues/6026), [GH 6056](https://github.com/pandas-dev/pandas/issues/6056)) +* Bug in setting using fancy indexing a single element with a non-scalar (e.g. a list), + ([GH 6043](https://github.com/pandas-dev/pandas/issues/6043)) +* `to_sql` did not respect `if_exists` ([GH 4110](https://github.com/pandas-dev/pandas/issues/4110) [GH 4304](https://github.com/pandas-dev/pandas/issues/4304)) +* Regression in `.get(None)` indexing from 0.12 ([GH 5652](https://github.com/pandas-dev/pandas/issues/5652)) +* Subtle `iloc` indexing bug, surfaced in ([GH 6059](https://github.com/pandas-dev/pandas/issues/6059)) +* Bug with insert of strings into DatetimeIndex ([GH 5818](https://github.com/pandas-dev/pandas/issues/5818)) +* Fixed unicode bug in to\_html/HTML repr ([GH 6098](https://github.com/pandas-dev/pandas/issues/6098)) +* Fixed missing arg validation in get\_options\_data ([GH 6105](https://github.com/pandas-dev/pandas/issues/6105)) +* Bug in assignment with duplicate columns in a frame where the locations + are a slice (e.g. next to each other) ([GH 6120](https://github.com/pandas-dev/pandas/issues/6120)) +* Bug in propagating \_ref\_locs during construction of a DataFrame with dups + index/columns ([GH 6121](https://github.com/pandas-dev/pandas/issues/6121)) +* Bug in `DataFrame.apply` when using mixed datelike reductions ([GH 6125](https://github.com/pandas-dev/pandas/issues/6125)) +* Bug in `DataFrame.append` when appending a row with different columns ([GH 6129](https://github.com/pandas-dev/pandas/issues/6129)) +* Bug in DataFrame construction with recarray and non-ns datetime dtype ([GH 6140](https://github.com/pandas-dev/pandas/issues/6140)) +* Bug in `.loc` setitem indexing with a dataframe on rhs, multiple item setting, and + a datetimelike ([GH 6152](https://github.com/pandas-dev/pandas/issues/6152)) +* Fixed a bug in `query`/`eval` during lexicographic string comparisons ([GH 6155](https://github.com/pandas-dev/pandas/issues/6155)). +* Fixed a bug in `query` where the index of a single-element `Series` was + being thrown away ([GH 6148](https://github.com/pandas-dev/pandas/issues/6148)). +* Bug in `HDFStore` on appending a dataframe with MultiIndexed columns to + an existing table ([GH 6167](https://github.com/pandas-dev/pandas/issues/6167)) +* Consistency with dtypes in setting an empty DataFrame ([GH 6171](https://github.com/pandas-dev/pandas/issues/6171)) +* Bug in selecting on a MultiIndex `HDFStore` even in the presence of under + specified column spec ([GH 6169](https://github.com/pandas-dev/pandas/issues/6169)) +* Bug in `nanops.var` with `ddof=1` and 1 elements would sometimes return `inf` + rather than `nan` on some platforms ([GH 6136](https://github.com/pandas-dev/pandas/issues/6136)) +* Bug in Series and DataFrame bar plots ignoring the `use_index` keyword ([GH 6209](https://github.com/pandas-dev/pandas/issues/6209)) +* Bug in groupby with mixed str/int under python3 fixed; `argsort` was failing ([GH 6212](https://github.com/pandas-dev/pandas/issues/6212)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 52 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Alex Rothberg +* Alok Singhal + +* Andrew Burrows + +* Andy Hayden +* Bjorn Arneson + +* Brad Buran +* Caleb Epstein +* Chapman Siu +* Chase Albert + +* Clark Fitzgerald + +* DSM +* Dan Birken +* Daniel Waeber + +* David Wolever + +* Doran Deluz + +* Douglas McNeil + +* Douglas Rudd + +* Dražen Lučanin +* Elliot S + +* Felix Lawrence + +* George Kuan + +* Guillaume Gay + +* Jacob Schaer +* Jan Wagner + +* Jeff Tratner +* John McNamara +* Joris Van den Bossche +* Julia Evans + +* Kieran O’Mahony +* Michael Schatzow + +* Naveen Michaud-Agrawal + +* Patrick O’Keeffe + +* Phillip Cloud +* Roman Pekar +* Skipper Seabold +* Spencer Lyon +* Tom Augspurger + +* TomAugspurger +* acorbe + +* akittredge + +* bmu + +* bwignall + +* chapman siu +* danielballan +* david + +* davidshinn +* immerrr + +* jreback +* lexual +* mwaskom + +* unutbu +* y-p diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.14.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.14.0.md new file mode 100644 index 0000000000000000000000000000000000000000..ac351ad73e51299a8a213378a486b4ad30e25bbf --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.14.0.md @@ -0,0 +1,1515 @@ +# What's new in pandas 0.14.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.14.0.html + +# Version 0.14.0 (May 31 , 2014)[#](#version-0-14-0-may-31-2014 "Link to this heading") + +This is a major release from 0.13.1 and includes a small number of API changes, several new features, +enhancements, and performance improvements along with a large number of bug fixes. We recommend that all +users upgrade to this version. + +* Highlights include: + + + Officially support Python 3.4 + + SQL interfaces updated to use `sqlalchemy`, See [Here](#whatsnew-0140-sql). + + Display interface changes, See [Here](#whatsnew-0140-display) + + MultiIndexing Using Slicers, See [Here](#whatsnew-0140-slicers). + + Ability to join a singly-indexed DataFrame with a MultiIndexed DataFrame, see [Here](../user_guide/merging.html#merging-join-on-mi) + + More consistency in groupby results and more flexible groupby specifications, See [Here](#whatsnew-0140-groupby) + + Holiday calendars are now supported in `CustomBusinessDay`, see [Here](../user_guide/timeseries.html#timeseries-holiday) + + Several improvements in plotting functions, including: hexbin, area and pie plots, see [Here](#whatsnew-0140-plotting). + + Performance doc section on I/O operations, See [Here](../user_guide/io.html#io-perf) +* [Other Enhancements](#whatsnew-0140-enhancements) +* [API Changes](#whatsnew-0140-api) +* [Text Parsing API Changes](#whatsnew-0140-parsing) +* [Groupby API Changes](#whatsnew-0140-groupby) +* [Performance Improvements](#whatsnew-0140-performance) +* [Prior Deprecations](#whatsnew-0140-prior-deprecations) +* [Deprecations](#whatsnew-0140-deprecations) +* [Known Issues](#whatsnew-0140-knownissues) +* [Bug Fixes](#whatsnew-0140-bug-fixes) + +Warning + +In 0.14.0 all `NDFrame` based containers have undergone significant internal refactoring. Before that each block of +homogeneous data had its own labels and extra care was necessary to keep those in sync with the parent container’s labels. +This should not have any visible user/API behavior changes ([GH 6745](https://github.com/pandas-dev/pandas/issues/6745)) + +## API changes[#](#api-changes "Link to this heading") + +* `read_excel` uses 0 as the default sheet ([GH 6573](https://github.com/pandas-dev/pandas/issues/6573)) +* `iloc` will now accept out-of-bounds indexers for slices, e.g. a value that exceeds the length of the object being + indexed. These will be excluded. This will make pandas conform more with python/numpy indexing of out-of-bounds + values. A single indexer that is out-of-bounds and drops the dimensions of the object will still raise + `IndexError` ([GH 6296](https://github.com/pandas-dev/pandas/issues/6296), [GH 6299](https://github.com/pandas-dev/pandas/issues/6299)). This could result in an empty axis (e.g. an empty DataFrame being returned) + + ```None + In [1]: dfl = pd.DataFrame(np.random.randn(5, 2), columns=list('AB')) + + In [2]: dfl + Out[2]: + A B + 0 0.469112 -0.282863 + 1 -1.509059 -1.135632 + 2 1.212112 -0.173215 + 3 0.119209 -1.044236 + 4 -0.861849 -2.104569 + + [5 rows x 2 columns] + + In [3]: dfl.iloc[:, 2:3] + Out[3]: + Empty DataFrame + Columns: [] + Index: [0, 1, 2, 3, 4] + + [5 rows x 0 columns] + + In [4]: dfl.iloc[:, 1:3] + Out[4]: + B + 0 -0.282863 + 1 -1.135632 + 2 -0.173215 + 3 -1.044236 + 4 -2.104569 + + [5 rows x 1 columns] + + In [5]: dfl.iloc[4:6] + Out[5]: + A B + 4 -0.861849 -2.104569 + + [1 rows x 2 columns] + ``` + + These are out-of-bounds selections + + ```None + >>> dfl.iloc[[4, 5, 6]] + IndexError: positional indexers are out-of-bounds + + >>> dfl.iloc[:, 4] + IndexError: single positional indexer is out-of-bounds + ``` +* Slicing with negative start, stop & step values handles corner cases better ([GH 6531](https://github.com/pandas-dev/pandas/issues/6531)): + + + `df.iloc[:-len(df)]` is now empty + + `df.iloc[len(df)::-1]` now enumerates all elements in reverse +* The [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") keyword `downcast` default has been changed from `infer` to + `None`. This is to preserve the original dtype unless explicitly requested otherwise ([GH 6290](https://github.com/pandas-dev/pandas/issues/6290)). +* When converting a dataframe to HTML it used to return `Empty DataFrame`. This special case has + been removed, instead a header with the column names is returned ([GH 6062](https://github.com/pandas-dev/pandas/issues/6062)). +* `Series` and `Index` now internally share more common operations, e.g. `factorize(),nunique(),value_counts()` are + now supported on `Index` types as well. The `Series.weekday` property from is removed + from Series for API consistency. Using a `DatetimeIndex/PeriodIndex` method on a Series will now raise a `TypeError`. + ([GH 4551](https://github.com/pandas-dev/pandas/issues/4551), [GH 4056](https://github.com/pandas-dev/pandas/issues/4056), [GH 5519](https://github.com/pandas-dev/pandas/issues/5519), [GH 6380](https://github.com/pandas-dev/pandas/issues/6380), [GH 7206](https://github.com/pandas-dev/pandas/issues/7206)). +* Add `is_month_start`, `is_month_end`, `is_quarter_start`, `is_quarter_end`, `is_year_start`, `is_year_end` accessors for `DateTimeIndex` / `Timestamp` which return a boolean array of whether the timestamp(s) are at the start/end of the month/quarter/year defined by the frequency of the `DateTimeIndex` / `Timestamp` ([GH 4565](https://github.com/pandas-dev/pandas/issues/4565), [GH 6998](https://github.com/pandas-dev/pandas/issues/6998)) +* Local variable usage has changed in + [`pandas.eval()`](../reference/api/pandas.eval.html#pandas.eval "pandas.eval")/[`DataFrame.eval()`](../reference/api/pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval")/[`DataFrame.query()`](../reference/api/pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") + ([GH 5987](https://github.com/pandas-dev/pandas/issues/5987)). For the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") methods, two things have + changed + + + Column names are now given precedence over locals + + Local variables must be referred to explicitly. This means that even if + you have a local variable that is *not* a column you must still refer to + it with the `'@'` prefix. + + You can have an expression like `df.query('@a < a')` with no complaints + from `pandas` about ambiguity of the name `a`. + + The top-level [`pandas.eval()`](../reference/api/pandas.eval.html#pandas.eval "pandas.eval") function does not allow you use the + `'@'` prefix and provides you with an error message telling you so. + + `NameResolutionError` was removed because it isn’t necessary anymore. +* Define and document the order of column vs index names in query/eval ([GH 6676](https://github.com/pandas-dev/pandas/issues/6676)) +* `concat` will now concatenate mixed Series and DataFrames using the Series name + or numbering columns as needed ([GH 2385](https://github.com/pandas-dev/pandas/issues/2385)). See [the docs](../user_guide/merging.html#merging-mixed-ndims) +* Slicing and advanced/boolean indexing operations on `Index` classes as well + as [`Index.delete()`](../reference/api/pandas.Index.delete.html#pandas.Index.delete "pandas.Index.delete") and [`Index.drop()`](../reference/api/pandas.Index.drop.html#pandas.Index.drop "pandas.Index.drop") methods will no longer change the type of the + resulting index ([GH 6440](https://github.com/pandas-dev/pandas/issues/6440), [GH 7040](https://github.com/pandas-dev/pandas/issues/7040)) + + ```None + In [6]: i = pd.Index([1, 2, 3, 'a', 'b', 'c']) + + In [7]: i[[0, 1, 2]] + Out[7]: Index([1, 2, 3], dtype='object') + + In [8]: i.drop(['a', 'b', 'c']) + Out[8]: Index([1, 2, 3], dtype='object') + ``` + + Previously, the above operation would return `Int64Index`. If you’d like + to do this manually, use [`Index.astype()`](../reference/api/pandas.Index.astype.html#pandas.Index.astype "pandas.Index.astype") + + ```None + In [9]: i[[0, 1, 2]].astype(np.int_) + Out[9]: Index([1, 2, 3], dtype='int64') + ``` +* `set_index` no longer converts MultiIndexes to an Index of tuples. For example, + the old behavior returned an Index in this case ([GH 6459](https://github.com/pandas-dev/pandas/issues/6459)): + + ```None + # Old behavior, casted MultiIndex to an Index + In [10]: tuple_ind + Out[10]: Index([('a', 'c'), ('a', 'd'), ('b', 'c'), ('b', 'd')], dtype='object') + + In [11]: df_multi.set_index(tuple_ind) + Out[11]: + 0 1 + (a, c) 0.471435 -1.190976 + (a, d) 1.432707 -0.312652 + (b, c) -0.720589 0.887163 + (b, d) 0.859588 -0.636524 + + [4 rows x 2 columns] + + # New behavior + In [12]: mi + Out[12]: + MultiIndex([('a', 'c'), + ('a', 'd'), + ('b', 'c'), + ('b', 'd')], + ) + + In [13]: df_multi.set_index(mi) + Out[13]: + 0 1 + a c 0.471435 -1.190976 + d 1.432707 -0.312652 + b c -0.720589 0.887163 + d 0.859588 -0.636524 + + [4 rows x 2 columns] + ``` + + This also applies when passing multiple indices to `set_index`: + + ```None + # Old output, 2-level MultiIndex of tuples + In [14]: df_multi.set_index([df_multi.index, df_multi.index]) + Out[14]: + 0 1 + (a, c) (a, c) 0.471435 -1.190976 + (a, d) (a, d) 1.432707 -0.312652 + (b, c) (b, c) -0.720589 0.887163 + (b, d) (b, d) 0.859588 -0.636524 + + [4 rows x 2 columns] + + # New output, 4-level MultiIndex + In [15]: df_multi.set_index([df_multi.index, df_multi.index]) + Out[15]: + 0 1 + a c a c 0.471435 -1.190976 + d a d 1.432707 -0.312652 + b c b c -0.720589 0.887163 + d b d 0.859588 -0.636524 + + [4 rows x 2 columns] + ``` +* `pairwise` keyword was added to the statistical moment functions + `rolling_cov`, `rolling_corr`, `ewmcov`, `ewmcorr`, + `expanding_cov`, `expanding_corr` to allow the calculation of moving + window covariance and correlation matrices ([GH 4950](https://github.com/pandas-dev/pandas/issues/4950)). See + [Computing rolling pairwise covariances and correlations](../user_guide/window.html#window-corr-pairwise) in the docs. + + ```None + In [1]: df = pd.DataFrame(np.random.randn(10, 4), columns=list('ABCD')) + + In [4]: covs = pd.rolling_cov(df[['A', 'B', 'C']], + ....: df[['B', 'C', 'D']], + ....: 5, + ....: pairwise=True) + + + In [5]: covs[df.index[-1]] + Out[5]: + B C D + A 0.035310 0.326593 -0.505430 + B 0.137748 -0.006888 -0.005383 + C -0.006888 0.861040 0.020762 + ``` +* `Series.iteritems()` is now lazy (returns an iterator rather than a list). This was the documented behavior prior to 0.14. ([GH 6760](https://github.com/pandas-dev/pandas/issues/6760)) +* Added `nunique` and `value_counts` functions to `Index` for counting unique elements. ([GH 6734](https://github.com/pandas-dev/pandas/issues/6734)) +* `stack` and `unstack` now raise a `ValueError` when the `level` keyword refers + to a non-unique item in the `Index` (previously raised a `KeyError`). ([GH 6738](https://github.com/pandas-dev/pandas/issues/6738)) +* drop unused order argument from `Series.sort`; args now are in the same order as `Series.order`; + add `na_position` arg to conform to `Series.order` ([GH 6847](https://github.com/pandas-dev/pandas/issues/6847)) +* default sorting algorithm for `Series.order` is now `quicksort`, to conform with `Series.sort` + (and numpy defaults) +* add `inplace` keyword to `Series.order/sort` to make them inverses ([GH 6859](https://github.com/pandas-dev/pandas/issues/6859)) +* `DataFrame.sort` now places NaNs at the beginning or end of the sort according to the `na_position` parameter. ([GH 3917](https://github.com/pandas-dev/pandas/issues/3917)) +* accept `TextFileReader` in `concat`, which was affecting a common user idiom ([GH 6583](https://github.com/pandas-dev/pandas/issues/6583)), this was a regression + from 0.13.1 +* Added `factorize` functions to `Index` and `Series` to get indexer and unique values ([GH 7090](https://github.com/pandas-dev/pandas/issues/7090)) +* `describe` on a DataFrame with a mix of Timestamp and string like objects returns a different Index ([GH 7088](https://github.com/pandas-dev/pandas/issues/7088)). + Previously the index was unintentionally sorted. +* Arithmetic operations with **only** `bool` dtypes now give a warning indicating + that they are evaluated in Python space for `+`, `-`, + and `*` operations and raise for all others ([GH 7011](https://github.com/pandas-dev/pandas/issues/7011), [GH 6762](https://github.com/pandas-dev/pandas/issues/6762), + [GH 7015](https://github.com/pandas-dev/pandas/issues/7015), [GH 7210](https://github.com/pandas-dev/pandas/issues/7210)) + + ```None + >>> x = pd.Series(np.random.rand(10) > 0.5) + >>> y = True + >>> x + y # warning generated: should do x | y instead + UserWarning: evaluating in Python space because the '+' operator is not + supported by numexpr for the bool dtype, use '|' instead + >>> x / y # this raises because it doesn't make sense + NotImplementedError: operator '/' not implemented for bool dtypes + ``` +* In `HDFStore`, `select_as_multiple` will always raise a `KeyError`, when a key or the selector is not found ([GH 6177](https://github.com/pandas-dev/pandas/issues/6177)) +* `df['col'] = value` and `df.loc[:,'col'] = value` are now completely equivalent; + previously the `.loc` would not necessarily coerce the dtype of the resultant series ([GH 6149](https://github.com/pandas-dev/pandas/issues/6149)) +* `dtypes` and `ftypes` now return a series with `dtype=object` on empty containers ([GH 5740](https://github.com/pandas-dev/pandas/issues/5740)) +* `df.to_csv` will now return a string of the CSV data if neither a target path nor a buffer is provided + ([GH 6061](https://github.com/pandas-dev/pandas/issues/6061)) +* `pd.infer_freq()` will now raise a `TypeError` if given an invalid `Series/Index` + type ([GH 6407](https://github.com/pandas-dev/pandas/issues/6407), [GH 6463](https://github.com/pandas-dev/pandas/issues/6463)) +* A tuple passed to `DataFame.sort_index` will be interpreted as the levels of + the index, rather than requiring a list of tuple ([GH 4370](https://github.com/pandas-dev/pandas/issues/4370)) +* all offset operations now return `Timestamp` types (rather than datetime), Business/Week frequencies were incorrect ([GH 4069](https://github.com/pandas-dev/pandas/issues/4069)) +* `to_excel` now converts `np.inf` into a string representation, + customizable by the `inf_rep` keyword argument (Excel has no native inf + representation) ([GH 6782](https://github.com/pandas-dev/pandas/issues/6782)) +* Replace `pandas.compat.scipy.scoreatpercentile` with `numpy.percentile` ([GH 6810](https://github.com/pandas-dev/pandas/issues/6810)) +* `.quantile` on a `datetime[ns]` series now returns `Timestamp` instead + of `np.datetime64` objects ([GH 6810](https://github.com/pandas-dev/pandas/issues/6810)) +* change `AssertionError` to `TypeError` for invalid types passed to `concat` ([GH 6583](https://github.com/pandas-dev/pandas/issues/6583)) +* Raise a `TypeError` when `DataFrame` is passed an iterator as the + `data` argument ([GH 5357](https://github.com/pandas-dev/pandas/issues/5357)) + +## Display changes[#](#display-changes "Link to this heading") + +* The default way of printing large DataFrames has changed. DataFrames + exceeding `max_rows` and/or `max_columns` are now displayed in a + centrally truncated view, consistent with the printing of a + [`pandas.Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") ([GH 5603](https://github.com/pandas-dev/pandas/issues/5603)). + + In previous versions, a DataFrame was truncated once the dimension + constraints were reached and an ellipse (…) signaled that part of + the data was cut off. + + ![The previous look of truncate.](../_images/trunc_before.png) + + In the current version, large DataFrames are centrally truncated, + showing a preview of head and tail in both dimensions. + + ![The new look.](../_images/trunc_after.png) +* allow option `'truncate'` for `display.show_dimensions` to only show the dimensions if the + frame is truncated ([GH 6547](https://github.com/pandas-dev/pandas/issues/6547)). + + The default for `display.show_dimensions` will now be `truncate`. This is consistent with + how Series display length. + + ```None + In [16]: dfd = pd.DataFrame(np.arange(25).reshape(-1, 5), + ....: index=[0, 1, 2, 3, 4], + ....: columns=[0, 1, 2, 3, 4]) + ....: + + # show dimensions since this is truncated + In [17]: with pd.option_context('display.max_rows', 2, 'display.max_columns', 2, + ....: 'display.show_dimensions', 'truncate'): + ....: print(dfd) + ....: + 0 ... 4 + 0 0 ... 4 + .. .. ... .. + 4 20 ... 24 + + [5 rows x 5 columns] + + # will not show dimensions since it is not truncated + In [18]: with pd.option_context('display.max_rows', 10, 'display.max_columns', 40, + ....: 'display.show_dimensions', 'truncate'): + ....: print(dfd) + ....: + 0 1 2 3 4 + 0 0 1 2 3 4 + 1 5 6 7 8 9 + 2 10 11 12 13 14 + 3 15 16 17 18 19 + 4 20 21 22 23 24 + ``` +* Regression in the display of a MultiIndexed Series with `display.max_rows` is less than the + length of the series ([GH 7101](https://github.com/pandas-dev/pandas/issues/7101)) +* Fixed a bug in the HTML repr of a truncated Series or DataFrame not showing the class name with the + `large_repr` set to ‘info’ ([GH 7105](https://github.com/pandas-dev/pandas/issues/7105)) +* The `verbose` keyword in `DataFrame.info()`, which controls whether to shorten the `info` + representation, is now `None` by default. This will follow the global setting in + `display.max_info_columns`. The global setting can be overridden with `verbose=True` or + `verbose=False`. +* Fixed a bug with the `info` repr not honoring the `display.max_info_columns` setting ([GH 6939](https://github.com/pandas-dev/pandas/issues/6939)) +* Offset/freq info now in Timestamp \_\_repr\_\_ ([GH 4553](https://github.com/pandas-dev/pandas/issues/4553)) + +## Text parsing API changes[#](#text-parsing-api-changes "Link to this heading") + +[`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv")/[`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") will now be noisier w.r.t invalid options rather than falling back to the `PythonParser`. + +* Raise `ValueError` when `sep` specified with + `delim_whitespace=True` in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv")/[`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") + ([GH 6607](https://github.com/pandas-dev/pandas/issues/6607)) +* Raise `ValueError` when `engine='c'` specified with unsupported + options in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv")/[`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") ([GH 6607](https://github.com/pandas-dev/pandas/issues/6607)) +* Raise `ValueError` when fallback to python parser causes options to be + ignored ([GH 6607](https://github.com/pandas-dev/pandas/issues/6607)) +* Produce `ParserWarning` on fallback to python + parser when no options are ignored ([GH 6607](https://github.com/pandas-dev/pandas/issues/6607)) +* Translate `sep='\s+'` to `delim_whitespace=True` in + [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv")/[`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") if no other C-unsupported options + specified ([GH 6607](https://github.com/pandas-dev/pandas/issues/6607)) + +## GroupBy API changes[#](#groupby-api-changes "Link to this heading") + +More consistent behavior for some groupby methods: + +* groupby `head` and `tail` now act more like `filter` rather than an aggregation: + + ```None + In [1]: df = pd.DataFrame([[1, 2], [1, 4], [5, 6]], columns=['A', 'B']) + + In [2]: g = df.groupby('A') + + In [3]: g.head(1) # filters DataFrame + Out[3]: + A B + 0 1 2 + 2 5 6 + + In [4]: g.apply(lambda x: x.head(1)) # used to simply fall-through + Out[4]: + A B + A + 1 0 1 2 + 5 2 5 6 + ``` +* groupby head and tail respect column selection: + + ```None + In [19]: g[['B']].head(1) + Out[19]: + B + 0 2 + 2 6 + + [2 rows x 1 columns] + ``` +* groupby `nth` now reduces by default; filtering can be achieved by passing `as_index=False`. With an optional `dropna` argument to ignore + NaN. See [the docs](../user_guide/groupby.html#groupby-nth). + + Reducing + + ```None + In [19]: df = pd.DataFrame([[1, np.nan], [1, 4], [5, 6]], columns=['A', 'B']) + + In [20]: g = df.groupby('A') + + In [21]: g.nth(0) + Out[21]: + A B + 0 1 NaN + 2 5 6.0 + + [2 rows x 2 columns] + + # this is equivalent to g.first() + In [22]: g.nth(0, dropna='any') + Out[22]: + A B + 1 1 4.0 + 2 5 6.0 + + [2 rows x 2 columns] + + # this is equivalent to g.last() + In [23]: g.nth(-1, dropna='any') + Out[23]: + A B + 1 1 4.0 + 2 5 6.0 + + [2 rows x 2 columns] + ``` + + Filtering + + ```None + In [24]: gf = df.groupby('A', as_index=False) + + In [25]: gf.nth(0) + Out[25]: + A B + 0 1 NaN + 2 5 6.0 + + [2 rows x 2 columns] + + In [26]: gf.nth(0, dropna='any') + Out[26]: + A B + 1 1 4.0 + 2 5 6.0 + + [2 rows x 2 columns] + ``` +* groupby will now not return the grouped column for non-cython functions ([GH 5610](https://github.com/pandas-dev/pandas/issues/5610), [GH 5614](https://github.com/pandas-dev/pandas/issues/5614), [GH 6732](https://github.com/pandas-dev/pandas/issues/6732)), + as its already the index + + ```None + In [27]: df = pd.DataFrame([[1, np.nan], [1, 4], [5, 6], [5, 8]], columns=['A', 'B']) + + In [28]: g = df.groupby('A') + + In [29]: g.count() + Out[29]: + B + A + 1 1 + 5 2 + + [2 rows x 1 columns] + + In [30]: g.describe() + Out[30]: + B + count mean std min 25% 50% 75% max + A + 1 1.0 4.0 NaN 4.0 4.0 4.0 4.0 4.0 + 5 2.0 7.0 1.414214 6.0 6.5 7.0 7.5 8.0 + + [2 rows x 8 columns] + ``` +* passing `as_index` will leave the grouped column in-place (this is not change in 0.14.0) + + ```None + In [31]: df = pd.DataFrame([[1, np.nan], [1, 4], [5, 6], [5, 8]], columns=['A', 'B']) + + In [32]: g = df.groupby('A', as_index=False) + + In [33]: g.count() + Out[33]: + A B + 0 1 1 + 1 5 2 + + [2 rows x 2 columns] + + In [34]: g.describe() + Out[34]: + A B + count mean std min 25% 50% 75% max + 0 1 1.0 4.0 NaN 4.0 4.0 4.0 4.0 4.0 + 1 5 2.0 7.0 1.414214 6.0 6.5 7.0 7.5 8.0 + + [2 rows x 9 columns] + ``` +* Allow specification of a more complex groupby via `pd.Grouper`, such as grouping + by a Time and a string field simultaneously. See [the docs](../user_guide/groupby.html#groupby-specify). ([GH 3794](https://github.com/pandas-dev/pandas/issues/3794)) +* Better propagation/preservation of Series names when performing groupby + operations: + + + `SeriesGroupBy.agg` will ensure that the name attribute of the original + series is propagated to the result ([GH 6265](https://github.com/pandas-dev/pandas/issues/6265)). + + If the function provided to `GroupBy.apply` returns a named series, the + name of the series will be kept as the name of the column index of the + DataFrame returned by `GroupBy.apply` ([GH 6124](https://github.com/pandas-dev/pandas/issues/6124)). This facilitates + `DataFrame.stack` operations where the name of the column index is used as + the name of the inserted column containing the pivoted data. + +## SQL[#](#sql "Link to this heading") + +The SQL reading and writing functions now support more database flavors +through SQLAlchemy ([GH 2717](https://github.com/pandas-dev/pandas/issues/2717), [GH 4163](https://github.com/pandas-dev/pandas/issues/4163), [GH 5950](https://github.com/pandas-dev/pandas/issues/5950), [GH 6292](https://github.com/pandas-dev/pandas/issues/6292)). +All databases supported by SQLAlchemy can be used, such +as PostgreSQL, MySQL, Oracle, Microsoft SQL server (see documentation of +SQLAlchemy on [included dialects](https://sqlalchemy.readthedocs.io/en/latest/dialects/index.html)). + +The functionality of providing DBAPI connection objects will only be supported +for sqlite3 in the future. The `'mysql'` flavor is deprecated. + +The new functions [`read_sql_query()`](../reference/api/pandas.read_sql_query.html#pandas.read_sql_query "pandas.read_sql_query") and [`read_sql_table()`](../reference/api/pandas.read_sql_table.html#pandas.read_sql_table "pandas.read_sql_table") +are introduced. The function [`read_sql()`](../reference/api/pandas.read_sql.html#pandas.read_sql "pandas.read_sql") is kept as a convenience +wrapper around the other two and will delegate to specific function depending on +the provided input (database table name or sql query). + +In practice, you have to provide a SQLAlchemy `engine` to the sql functions. +To connect with SQLAlchemy you use the `create_engine()` function to create an engine +object from database URI. You only need to create the engine once per database you are +connecting to. For an in-memory sqlite database: + +```None +In [35]: from sqlalchemy import create_engine + +# Create your connection. +In [36]: engine = create_engine('sqlite:///:memory:') +``` + +This `engine` can then be used to write or read data to/from this database: + +```None +In [37]: df = pd.DataFrame({'A': [1, 2, 3], 'B': ['a', 'b', 'c']}) + +In [38]: df.to_sql(name='db_table', con=engine, index=False) +Out[38]: 3 +``` + +You can read data from a database by specifying the table name: + +```None +In [39]: pd.read_sql_table('db_table', engine) +Out[39]: + A B +0 1 a +1 2 b +2 3 c + +[3 rows x 2 columns] +``` + +or by specifying a sql query: + +```None +In [40]: pd.read_sql_query('SELECT * FROM db_table', engine) +Out[40]: + A B +0 1 a +1 2 b +2 3 c + +[3 rows x 2 columns] +``` + +Some other enhancements to the sql functions include: + +* support for writing the index. This can be controlled with the `index` + keyword (default is True). +* specify the column label to use when writing the index with `index_label`. +* specify string columns to parse as datetimes with the `parse_dates` + keyword in [`read_sql_query()`](../reference/api/pandas.read_sql_query.html#pandas.read_sql_query "pandas.read_sql_query") and [`read_sql_table()`](../reference/api/pandas.read_sql_table.html#pandas.read_sql_table "pandas.read_sql_table"). + +Warning + +Some of the existing functions or function aliases have been deprecated +and will be removed in future versions. This includes: `tquery`, `uquery`, +`read_frame`, `frame_query`, `write_frame`. + +Warning + +The support for the ‘mysql’ flavor when using DBAPI connection objects has been deprecated. +MySQL will be further supported with SQLAlchemy engines ([GH 6900](https://github.com/pandas-dev/pandas/issues/6900)). + +## Multi-indexing using slicers[#](#multi-indexing-using-slicers "Link to this heading") + +In 0.14.0 we added a new way to slice MultiIndexed objects. +You can slice a MultiIndex by providing multiple indexers. + +You can provide any of the selectors as if you are indexing by label, see [Selection by Label](../user_guide/indexing.html#indexing-label), +including slices, lists of labels, labels, and boolean indexers. + +You can use `slice(None)` to select all the contents of *that* level. You do not need to specify all the +*deeper* levels, they will be implied as `slice(None)`. + +As usual, **both sides** of the slicers are included as this is label indexing. + +See [the docs](../user_guide/advanced.html#advanced-mi-slicers) +See also issues ([GH 6134](https://github.com/pandas-dev/pandas/issues/6134), [GH 4036](https://github.com/pandas-dev/pandas/issues/4036), [GH 3057](https://github.com/pandas-dev/pandas/issues/3057), [GH 2598](https://github.com/pandas-dev/pandas/issues/2598), [GH 5641](https://github.com/pandas-dev/pandas/issues/5641), [GH 7106](https://github.com/pandas-dev/pandas/issues/7106)) + +Warning + +> You should specify all axes in the `.loc` specifier, meaning the indexer for the **index** and +> for the **columns**. Their are some ambiguous cases where the passed indexer could be mis-interpreted +> as indexing *both* axes, rather than into say the MultiIndex for the rows. +> +> You should do this: + +```None + >>> df.loc[(slice('A1', 'A3'), ...), :] # noqa: E901 + +rather than this: +``` + +```None +>>> df.loc[(slice('A1', 'A3'), ...)] # noqa: E901 +``` + +Warning + +You will need to make sure that the selection axes are fully lexsorted! + +```None +In [41]: def mklbl(prefix, n): + ....: return ["%s%s" % (prefix, i) for i in range(n)] + ....: + +In [42]: index = pd.MultiIndex.from_product([mklbl('A', 4), + ....: mklbl('B', 2), + ....: mklbl('C', 4), + ....: mklbl('D', 2)]) + ....: + +In [43]: columns = pd.MultiIndex.from_tuples([('a', 'foo'), ('a', 'bar'), + ....: ('b', 'foo'), ('b', 'bah')], + ....: names=['lvl0', 'lvl1']) + ....: + +In [44]: df = pd.DataFrame(np.arange(len(index) * len(columns)).reshape((len(index), + ....: len(columns))), + ....: index=index, + ....: columns=columns).sort_index().sort_index(axis=1) + ....: + +In [45]: df +Out[45]: +lvl0 a b +lvl1 bar foo bah foo +A0 B0 C0 D0 1 0 3 2 + D1 5 4 7 6 + C1 D0 9 8 11 10 + D1 13 12 15 14 + C2 D0 17 16 19 18 +... ... ... ... ... +A3 B1 C1 D1 237 236 239 238 + C2 D0 241 240 243 242 + D1 245 244 247 246 + C3 D0 249 248 251 250 + D1 253 252 255 254 + +[64 rows x 4 columns] +``` + +Basic MultiIndex slicing using slices, lists, and labels. + +```None +In [46]: df.loc[(slice('A1', 'A3'), slice(None), ['C1', 'C3']), :] +Out[46]: +lvl0 a b +lvl1 bar foo bah foo +A1 B0 C1 D0 73 72 75 74 + D1 77 76 79 78 + C3 D0 89 88 91 90 + D1 93 92 95 94 + B1 C1 D0 105 104 107 106 +... ... ... ... ... +A3 B0 C3 D1 221 220 223 222 + B1 C1 D0 233 232 235 234 + D1 237 236 239 238 + C3 D0 249 248 251 250 + D1 253 252 255 254 + +[24 rows x 4 columns] +``` + +You can use a `pd.IndexSlice` to shortcut the creation of these slices + +```None +In [47]: idx = pd.IndexSlice + +In [48]: df.loc[idx[:, :, ['C1', 'C3']], idx[:, 'foo']] +Out[48]: +lvl0 a b +lvl1 foo foo +A0 B0 C1 D0 8 10 + D1 12 14 + C3 D0 24 26 + D1 28 30 + B1 C1 D0 40 42 +... ... ... +A3 B0 C3 D1 220 222 + B1 C1 D0 232 234 + D1 236 238 + C3 D0 248 250 + D1 252 254 + +[32 rows x 2 columns] +``` + +It is possible to perform quite complicated selections using this method on multiple +axes at the same time. + +```None +In [49]: df.loc['A1', (slice(None), 'foo')] +Out[49]: +lvl0 a b +lvl1 foo foo +B0 C0 D0 64 66 + D1 68 70 + C1 D0 72 74 + D1 76 78 + C2 D0 80 82 +... ... ... +B1 C1 D1 108 110 + C2 D0 112 114 + D1 116 118 + C3 D0 120 122 + D1 124 126 + +[16 rows x 2 columns] + +In [50]: df.loc[idx[:, :, ['C1', 'C3']], idx[:, 'foo']] +Out[50]: +lvl0 a b +lvl1 foo foo +A0 B0 C1 D0 8 10 + D1 12 14 + C3 D0 24 26 + D1 28 30 + B1 C1 D0 40 42 +... ... ... +A3 B0 C3 D1 220 222 + B1 C1 D0 232 234 + D1 236 238 + C3 D0 248 250 + D1 252 254 + +[32 rows x 2 columns] +``` + +Using a boolean indexer you can provide selection related to the *values*. + +```None +In [51]: mask = df[('a', 'foo')] > 200 + +In [52]: df.loc[idx[mask, :, ['C1', 'C3']], idx[:, 'foo']] +Out[52]: +lvl0 a b +lvl1 foo foo +A3 B0 C1 D1 204 206 + C3 D0 216 218 + D1 220 222 + B1 C1 D0 232 234 + D1 236 238 + C3 D0 248 250 + D1 252 254 + +[7 rows x 2 columns] +``` + +You can also specify the `axis` argument to `.loc` to interpret the passed +slicers on a single axis. + +```None +In [53]: df.loc(axis=0)[:, :, ['C1', 'C3']] +Out[53]: +lvl0 a b +lvl1 bar foo bah foo +A0 B0 C1 D0 9 8 11 10 + D1 13 12 15 14 + C3 D0 25 24 27 26 + D1 29 28 31 30 + B1 C1 D0 41 40 43 42 +... ... ... ... ... +A3 B0 C3 D1 221 220 223 222 + B1 C1 D0 233 232 235 234 + D1 237 236 239 238 + C3 D0 249 248 251 250 + D1 253 252 255 254 + +[32 rows x 4 columns] +``` + +Furthermore you can *set* the values using these methods + +```None +In [54]: df2 = df.copy() + +In [55]: df2.loc(axis=0)[:, :, ['C1', 'C3']] = -10 + +In [56]: df2 +Out[56]: +lvl0 a b +lvl1 bar foo bah foo +A0 B0 C0 D0 1 0 3 2 + D1 5 4 7 6 + C1 D0 -10 -10 -10 -10 + D1 -10 -10 -10 -10 + C2 D0 17 16 19 18 +... ... ... ... ... +A3 B1 C1 D1 -10 -10 -10 -10 + C2 D0 241 240 243 242 + D1 245 244 247 246 + C3 D0 -10 -10 -10 -10 + D1 -10 -10 -10 -10 + +[64 rows x 4 columns] +``` + +You can use a right-hand-side of an alignable object as well. + +```None +In [57]: df2 = df.copy() + +In [58]: df2.loc[idx[:, :, ['C1', 'C3']], :] = df2 * 1000 + +In [59]: df2 +Out[59]: +lvl0 a b +lvl1 bar foo bah foo +A0 B0 C0 D0 1 0 3 2 + D1 5 4 7 6 + C1 D0 9000 8000 11000 10000 + D1 13000 12000 15000 14000 + C2 D0 17 16 19 18 +... ... ... ... ... +A3 B1 C1 D1 237000 236000 239000 238000 + C2 D0 241 240 243 242 + D1 245 244 247 246 + C3 D0 249000 248000 251000 250000 + D1 253000 252000 255000 254000 + +[64 rows x 4 columns] +``` + +## Plotting[#](#plotting "Link to this heading") + +* Hexagonal bin plots from `DataFrame.plot` with `kind='hexbin'` ([GH 5478](https://github.com/pandas-dev/pandas/issues/5478)), See [the docs](../user_guide/visualization.html#visualization-hexbin). +* `DataFrame.plot` and `Series.plot` now supports area plot with specifying `kind='area'` ([GH 6656](https://github.com/pandas-dev/pandas/issues/6656)), See [the docs](../user_guide/visualization.html#visualization-area-plot) +* Pie plots from `Series.plot` and `DataFrame.plot` with `kind='pie'` ([GH 6976](https://github.com/pandas-dev/pandas/issues/6976)), See [the docs](../user_guide/visualization.html#visualization-pie). +* Plotting with Error Bars is now supported in the `.plot` method of `DataFrame` and `Series` objects ([GH 3796](https://github.com/pandas-dev/pandas/issues/3796), [GH 6834](https://github.com/pandas-dev/pandas/issues/6834)), See [the docs](../user_guide/visualization.html#visualization-errorbars). +* `DataFrame.plot` and `Series.plot` now support a `table` keyword for plotting `matplotlib.Table`, See [the docs](../user_guide/visualization.html#visualization-table). The `table` keyword can receive the following values. + + + `False`: Do nothing (default). + + `True`: Draw a table using the `DataFrame` or `Series` called `plot` method. Data will be transposed to meet matplotlib’s default layout. + + `DataFrame` or `Series`: Draw matplotlib.table using the passed data. The data will be drawn as displayed in print method (not transposed automatically). + Also, helper function `pandas.tools.plotting.table` is added to create a table from `DataFrame` and `Series`, and add it to an `matplotlib.Axes`. +* `plot(legend='reverse')` will now reverse the order of legend labels for + most plot kinds. ([GH 6014](https://github.com/pandas-dev/pandas/issues/6014)) +* Line plot and area plot can be stacked by `stacked=True` ([GH 6656](https://github.com/pandas-dev/pandas/issues/6656)) +* Following keywords are now acceptable for [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") with `kind='bar'` and `kind='barh'`: + + + `width`: Specify the bar width. In previous versions, static value 0.5 was passed to matplotlib and it cannot be overwritten. ([GH 6604](https://github.com/pandas-dev/pandas/issues/6604)) + + `align`: Specify the bar alignment. Default is `center` (different from matplotlib). In previous versions, pandas passes `align='edge'` to matplotlib and adjust the location to `center` by itself, and it results `align` keyword is not applied as expected. ([GH 4525](https://github.com/pandas-dev/pandas/issues/4525)) + + `position`: Specify relative alignments for bar plot layout. From 0 (left/bottom-end) to 1(right/top-end). Default is 0.5 (center). ([GH 6604](https://github.com/pandas-dev/pandas/issues/6604)) + + Because of the default `align` value changes, coordinates of bar plots are now located on integer values (0.0, 1.0, 2.0 …). This is intended to make bar plot be located on the same coordinates as line plot. However, bar plot may differs unexpectedly when you manually adjust the bar location or drawing area, such as using `set_xlim`, `set_ylim`, etc. In this cases, please modify your script to meet with new coordinates. +* The `parallel_coordinates()` function now takes argument `color` + instead of `colors`. A `FutureWarning` is raised to alert that + the old `colors` argument will not be supported in a future release. ([GH 6956](https://github.com/pandas-dev/pandas/issues/6956)) +* The `parallel_coordinates()` and `andrews_curves()` functions now take + positional argument `frame` instead of `data`. A `FutureWarning` is + raised if the old `data` argument is used by name. ([GH 6956](https://github.com/pandas-dev/pandas/issues/6956)) +* [`DataFrame.boxplot()`](../reference/api/pandas.DataFrame.boxplot.html#pandas.DataFrame.boxplot "pandas.DataFrame.boxplot") now supports `layout` keyword ([GH 6769](https://github.com/pandas-dev/pandas/issues/6769)) +* [`DataFrame.boxplot()`](../reference/api/pandas.DataFrame.boxplot.html#pandas.DataFrame.boxplot "pandas.DataFrame.boxplot") has a new keyword argument, `return_type`. It accepts `'dict'`, + `'axes'`, or `'both'`, in which case a namedtuple with the matplotlib + axes and a dict of matplotlib Lines is returned. + +## Prior version deprecations/changes[#](#prior-version-deprecations-changes "Link to this heading") + +There are prior version deprecations that are taking effect as of 0.14.0. + +* Remove `DateRange` in favor of [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") ([GH 6816](https://github.com/pandas-dev/pandas/issues/6816)) +* Remove `column` keyword from `DataFrame.sort` ([GH 4370](https://github.com/pandas-dev/pandas/issues/4370)) +* Remove `precision` keyword from [`set_eng_float_format()`](../reference/api/pandas.set_eng_float_format.html#pandas.set_eng_float_format "pandas.set_eng_float_format") ([GH 395](https://github.com/pandas-dev/pandas/issues/395)) +* Remove `force_unicode` keyword from [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string"), + [`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex"), and [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html"); these function + encode in unicode by default ([GH 2224](https://github.com/pandas-dev/pandas/issues/2224), [GH 2225](https://github.com/pandas-dev/pandas/issues/2225)) +* Remove `nanRep` keyword from [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") and + [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string") ([GH 275](https://github.com/pandas-dev/pandas/issues/275)) +* Remove `unique` keyword from `HDFStore.select_column()` ([GH 3256](https://github.com/pandas-dev/pandas/issues/3256)) +* Remove `inferTimeRule` keyword from `Timestamp.offset()` ([GH 391](https://github.com/pandas-dev/pandas/issues/391)) +* Remove `name` keyword from `get_data_yahoo()` and + `get_data_google()` ( [commit b921d1a](https://github.com/pandas-dev/pandas/commit/b921d1a2) ) +* Remove `offset` keyword from [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") constructor + ( [commit 3136390](https://github.com/pandas-dev/pandas/commit/3136390) ) +* Remove `time_rule` from several rolling-moment statistical functions, such + as `rolling_sum()` ([GH 1042](https://github.com/pandas-dev/pandas/issues/1042)) +* Removed neg `-` boolean operations on numpy arrays in favor of inv `~`, as this is going to + be deprecated in numpy 1.9 ([GH 6960](https://github.com/pandas-dev/pandas/issues/6960)) + +## Deprecations[#](#deprecations "Link to this heading") + +* The [`pivot_table()`](../reference/api/pandas.pivot_table.html#pandas.pivot_table "pandas.pivot_table")/[`DataFrame.pivot_table()`](../reference/api/pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table") and [`crosstab()`](../reference/api/pandas.crosstab.html#pandas.crosstab "pandas.crosstab") functions + now take arguments `index` and `columns` instead of `rows` and `cols`. A + `FutureWarning` is raised to alert that the old `rows` and `cols` arguments + will not be supported in a future release ([GH 5505](https://github.com/pandas-dev/pandas/issues/5505)) +* The [`DataFrame.drop_duplicates()`](../reference/api/pandas.DataFrame.drop_duplicates.html#pandas.DataFrame.drop_duplicates "pandas.DataFrame.drop_duplicates") and [`DataFrame.duplicated()`](../reference/api/pandas.DataFrame.duplicated.html#pandas.DataFrame.duplicated "pandas.DataFrame.duplicated") methods + now take argument `subset` instead of `cols` to better align with + [`DataFrame.dropna()`](../reference/api/pandas.DataFrame.dropna.html#pandas.DataFrame.dropna "pandas.DataFrame.dropna"). A `FutureWarning` is raised to alert that the old + `cols` arguments will not be supported in a future release ([GH 6680](https://github.com/pandas-dev/pandas/issues/6680)) +* The [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") and [`DataFrame.to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel") functions + now takes argument `columns` instead of `cols`. A + `FutureWarning` is raised to alert that the old `cols` arguments + will not be supported in a future release ([GH 6645](https://github.com/pandas-dev/pandas/issues/6645)) +* Indexers will warn `FutureWarning` when used with a scalar indexer and + a non-floating point Index ([GH 4892](https://github.com/pandas-dev/pandas/issues/4892), [GH 6960](https://github.com/pandas-dev/pandas/issues/6960)) + + ```None + # non-floating point indexes can only be indexed by integers / labels + In [1]: pd.Series(1, np.arange(5))[3.0] + pandas/core/index.py:469: FutureWarning: scalar indexers for index type Int64Index should be integers and not floating point + Out[1]: 1 + + In [2]: pd.Series(1, np.arange(5)).iloc[3.0] + pandas/core/index.py:469: FutureWarning: scalar indexers for index type Int64Index should be integers and not floating point + Out[2]: 1 + + In [3]: pd.Series(1, np.arange(5)).iloc[3.0:4] + pandas/core/index.py:527: FutureWarning: slice indexers when using iloc should be integers and not floating point + Out[3]: + 3 1 + dtype: int64 + + # these are Float64Indexes, so integer or floating point is acceptable + In [4]: pd.Series(1, np.arange(5.))[3] + Out[4]: 1 + + In [5]: pd.Series(1, np.arange(5.))[3.0] + Out[6]: 1 + ``` +* Numpy 1.9 compat w.r.t. deprecation warnings ([GH 6960](https://github.com/pandas-dev/pandas/issues/6960)) +* `Panel.shift()` now has a function signature that matches [`DataFrame.shift()`](../reference/api/pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift"). + The old positional argument `lags` has been changed to a keyword argument + `periods` with a default value of 1. A `FutureWarning` is raised if the + old argument `lags` is used by name. ([GH 6910](https://github.com/pandas-dev/pandas/issues/6910)) +* The `order` keyword argument of [`factorize()`](../reference/api/pandas.factorize.html#pandas.factorize "pandas.factorize") will be removed. ([GH 6926](https://github.com/pandas-dev/pandas/issues/6926)). +* Remove the `copy` keyword from [`DataFrame.xs()`](../reference/api/pandas.DataFrame.xs.html#pandas.DataFrame.xs "pandas.DataFrame.xs"), `Panel.major_xs()`, `Panel.minor_xs()`. A view will be + returned if possible, otherwise a copy will be made. Previously the user could think that `copy=False` would + ALWAYS return a view. ([GH 6894](https://github.com/pandas-dev/pandas/issues/6894)) +* The `parallel_coordinates()` function now takes argument `color` + instead of `colors`. A `FutureWarning` is raised to alert that + the old `colors` argument will not be supported in a future release. ([GH 6956](https://github.com/pandas-dev/pandas/issues/6956)) +* The `parallel_coordinates()` and `andrews_curves()` functions now take + positional argument `frame` instead of `data`. A `FutureWarning` is + raised if the old `data` argument is used by name. ([GH 6956](https://github.com/pandas-dev/pandas/issues/6956)) +* The support for the ‘mysql’ flavor when using DBAPI connection objects has been deprecated. + MySQL will be further supported with SQLAlchemy engines ([GH 6900](https://github.com/pandas-dev/pandas/issues/6900)). +* The following `io.sql` functions have been deprecated: `tquery`, `uquery`, `read_frame`, `frame_query`, `write_frame`. +* The `percentile_width` keyword argument in [`describe()`](../reference/api/pandas.DataFrame.describe.html#pandas.DataFrame.describe "pandas.DataFrame.describe") has been deprecated. + Use the `percentiles` keyword instead, which takes a list of percentiles to display. The + default output is unchanged. +* The default return type of `boxplot()` will change from a dict to a matplotlib Axes + in a future release. You can use the future behavior now by passing `return_type='axes'` + to boxplot. + +## Known issues[#](#known-issues "Link to this heading") + +* OpenPyXL 2.0.0 breaks backwards compatibility ([GH 7169](https://github.com/pandas-dev/pandas/issues/7169)) + +## Enhancements[#](#enhancements "Link to this heading") + +* DataFrame and Series will create a MultiIndex object if passed a tuples dict, See [the docs](../user_guide/dsintro.html#basics-dataframe-from-dict-of-tuples) ([GH 3323](https://github.com/pandas-dev/pandas/issues/3323)) + + ```None + In [60]: pd.Series({('a', 'b'): 1, ('a', 'a'): 0, + ....: ('a', 'c'): 2, ('b', 'a'): 3, ('b', 'b'): 4}) + ....: + Out[60]: + a b 1 + a 0 + c 2 + b a 3 + b 4 + Length: 5, dtype: int64 + + In [61]: pd.DataFrame({('a', 'b'): {('A', 'B'): 1, ('A', 'C'): 2}, + ....: ('a', 'a'): {('A', 'C'): 3, ('A', 'B'): 4}, + ....: ('a', 'c'): {('A', 'B'): 5, ('A', 'C'): 6}, + ....: ('b', 'a'): {('A', 'C'): 7, ('A', 'B'): 8}, + ....: ('b', 'b'): {('A', 'D'): 9, ('A', 'B'): 10}}) + ....: + Out[61]: + a b + b a c a b + A B 1.0 4.0 5.0 8.0 10.0 + C 2.0 3.0 6.0 7.0 NaN + D NaN NaN NaN NaN 9.0 + + [3 rows x 5 columns] + ``` +* Added the `sym_diff` method to `Index` ([GH 5543](https://github.com/pandas-dev/pandas/issues/5543)) +* `DataFrame.to_latex` now takes a longtable keyword, which if True will return a table in a longtable environment. ([GH 6617](https://github.com/pandas-dev/pandas/issues/6617)) +* Add option to turn off escaping in `DataFrame.to_latex` ([GH 6472](https://github.com/pandas-dev/pandas/issues/6472)) +* `pd.read_clipboard` will, if the keyword `sep` is unspecified, try to detect data copied from a spreadsheet + and parse accordingly. ([GH 6223](https://github.com/pandas-dev/pandas/issues/6223)) +* Joining a singly-indexed DataFrame with a MultiIndexed DataFrame ([GH 3662](https://github.com/pandas-dev/pandas/issues/3662)) + + See [the docs](../user_guide/merging.html#merging-join-on-mi). Joining MultiIndex DataFrames on both the left and right is not yet supported ATM. + + ```None + In [62]: household = pd.DataFrame({'household_id': [1, 2, 3], + ....: 'male': [0, 1, 0], + ....: 'wealth': [196087.3, 316478.7, 294750] + ....: }, + ....: columns=['household_id', 'male', 'wealth'] + ....: ).set_index('household_id') + ....: + + In [63]: household + Out[63]: + male wealth + household_id + 1 0 196087.3 + 2 1 316478.7 + 3 0 294750.0 + + [3 rows x 2 columns] + + In [64]: portfolio = pd.DataFrame({'household_id': [1, 2, 2, 3, 3, 3, 4], + ....: 'asset_id': ["nl0000301109", + ....: "nl0000289783", + ....: "gb00b03mlx29", + ....: "gb00b03mlx29", + ....: "lu0197800237", + ....: "nl0000289965", + ....: np.nan], + ....: 'name': ["ABN Amro", + ....: "Robeco", + ....: "Royal Dutch Shell", + ....: "Royal Dutch Shell", + ....: "AAB Eastern Europe Equity Fund", + ....: "Postbank BioTech Fonds", + ....: np.nan], + ....: 'share': [1.0, 0.4, 0.6, 0.15, 0.6, 0.25, 1.0] + ....: }, + ....: columns=['household_id', 'asset_id', 'name', 'share'] + ....: ).set_index(['household_id', 'asset_id']) + ....: + + In [65]: portfolio + Out[65]: + name share + household_id asset_id + 1 nl0000301109 ABN Amro 1.00 + 2 nl0000289783 Robeco 0.40 + gb00b03mlx29 Royal Dutch Shell 0.60 + 3 gb00b03mlx29 Royal Dutch Shell 0.15 + lu0197800237 AAB Eastern Europe Equity Fund 0.60 + nl0000289965 Postbank BioTech Fonds 0.25 + 4 NaN NaN 1.00 + + [7 rows x 2 columns] + + In [66]: household.join(portfolio, how='inner') + Out[66]: + male ... share + household_id asset_id ... + 1 nl0000301109 0 ... 1.00 + 2 nl0000289783 1 ... 0.40 + gb00b03mlx29 1 ... 0.60 + 3 gb00b03mlx29 0 ... 0.15 + lu0197800237 0 ... 0.60 + nl0000289965 0 ... 0.25 + + [6 rows x 4 columns] + ``` +* `quotechar`, `doublequote`, and `escapechar` can now be specified when + using `DataFrame.to_csv` ([GH 5414](https://github.com/pandas-dev/pandas/issues/5414), [GH 4528](https://github.com/pandas-dev/pandas/issues/4528)) +* Partially sort by only the specified levels of a MultiIndex with the + `sort_remaining` boolean kwarg. ([GH 3984](https://github.com/pandas-dev/pandas/issues/3984)) +* Added `to_julian_date` to `TimeStamp` and `DatetimeIndex`. The Julian + Date is used primarily in astronomy and represents the number of days from + noon, January 1, 4713 BC. Because nanoseconds are used to define the time + in pandas the actual range of dates that you can use is 1678 AD to 2262 AD. ([GH 4041](https://github.com/pandas-dev/pandas/issues/4041)) +* `DataFrame.to_stata` will now check data for compatibility with Stata data types + and will upcast when needed. When it is not possible to losslessly upcast, a warning + is issued ([GH 6327](https://github.com/pandas-dev/pandas/issues/6327)) +* `DataFrame.to_stata` and `StataWriter` will accept keyword arguments time\_stamp + and data\_label which allow the time stamp and dataset label to be set when creating a + file. ([GH 6545](https://github.com/pandas-dev/pandas/issues/6545)) +* `pandas.io.gbq` now handles reading unicode strings properly. ([GH 5940](https://github.com/pandas-dev/pandas/issues/5940)) +* [Holidays Calendars](../user_guide/timeseries.html#timeseries-holiday) are now available and can be used with the `CustomBusinessDay` offset ([GH 6719](https://github.com/pandas-dev/pandas/issues/6719)) +* `Float64Index` is now backed by a `float64` dtype ndarray instead of an + `object` dtype array ([GH 6471](https://github.com/pandas-dev/pandas/issues/6471)). +* Implemented `Panel.pct_change` ([GH 6904](https://github.com/pandas-dev/pandas/issues/6904)) +* Added `how` option to rolling-moment functions to dictate how to handle resampling; `rolling_max()` defaults to max, + `rolling_min()` defaults to min, and all others default to mean ([GH 6297](https://github.com/pandas-dev/pandas/issues/6297)) +* `CustomBusinessMonthBegin` and `CustomBusinessMonthEnd` are now available ([GH 6866](https://github.com/pandas-dev/pandas/issues/6866)) +* [`Series.quantile()`](../reference/api/pandas.Series.quantile.html#pandas.Series.quantile "pandas.Series.quantile") and [`DataFrame.quantile()`](../reference/api/pandas.DataFrame.quantile.html#pandas.DataFrame.quantile "pandas.DataFrame.quantile") now accept an array of + quantiles. +* [`describe()`](../reference/api/pandas.DataFrame.describe.html#pandas.DataFrame.describe "pandas.DataFrame.describe") now accepts an array of percentiles to include in the summary statistics ([GH 4196](https://github.com/pandas-dev/pandas/issues/4196)) +* `pivot_table` can now accept `Grouper` by `index` and `columns` keywords ([GH 6913](https://github.com/pandas-dev/pandas/issues/6913)) + + ```None + In [67]: import datetime + + In [68]: df = pd.DataFrame({ + ....: 'Branch': 'A A A A A B'.split(), + ....: 'Buyer': 'Carl Mark Carl Carl Joe Joe'.split(), + ....: 'Quantity': [1, 3, 5, 1, 8, 1], + ....: 'Date': [datetime.datetime(2013, 11, 1, 13, 0), + ....: datetime.datetime(2013, 9, 1, 13, 5), + ....: datetime.datetime(2013, 10, 1, 20, 0), + ....: datetime.datetime(2013, 10, 2, 10, 0), + ....: datetime.datetime(2013, 11, 1, 20, 0), + ....: datetime.datetime(2013, 10, 2, 10, 0)], + ....: 'PayDay': [datetime.datetime(2013, 10, 4, 0, 0), + ....: datetime.datetime(2013, 10, 15, 13, 5), + ....: datetime.datetime(2013, 9, 5, 20, 0), + ....: datetime.datetime(2013, 11, 2, 10, 0), + ....: datetime.datetime(2013, 10, 7, 20, 0), + ....: datetime.datetime(2013, 9, 5, 10, 0)]}) + ....: + + In [69]: df + Out[69]: + Branch Buyer Quantity Date PayDay + 0 A Carl 1 2013-11-01 13:00:00 2013-10-04 00:00:00 + 1 A Mark 3 2013-09-01 13:05:00 2013-10-15 13:05:00 + 2 A Carl 5 2013-10-01 20:00:00 2013-09-05 20:00:00 + 3 A Carl 1 2013-10-02 10:00:00 2013-11-02 10:00:00 + 4 A Joe 8 2013-11-01 20:00:00 2013-10-07 20:00:00 + 5 B Joe 1 2013-10-02 10:00:00 2013-09-05 10:00:00 + + [6 rows x 5 columns] + ``` + + ```None + In [75]: df.pivot_table(values='Quantity', + ....: index=pd.Grouper(freq='M', key='Date'), + ....: columns=pd.Grouper(freq='M', key='PayDay'), + ....: aggfunc="sum") + Out[75]: + PayDay 2013-09-30 2013-10-31 2013-11-30 + Date + 2013-09-30 NaN 3.0 NaN + 2013-10-31 6.0 NaN 1.0 + 2013-11-30 NaN 9.0 NaN + + [3 rows x 3 columns] + ``` +* Arrays of strings can be wrapped to a specified width (`str.wrap`) ([GH 6999](https://github.com/pandas-dev/pandas/issues/6999)) +* Add [`nsmallest()`](../reference/api/pandas.Series.nsmallest.html#pandas.Series.nsmallest "pandas.Series.nsmallest") and [`Series.nlargest()`](../reference/api/pandas.Series.nlargest.html#pandas.Series.nlargest "pandas.Series.nlargest") methods to Series, See [the docs](../user_guide/basics.html#basics-nsorted) ([GH 3960](https://github.com/pandas-dev/pandas/issues/3960)) +* `PeriodIndex` fully supports partial string indexing like `DatetimeIndex` ([GH 7043](https://github.com/pandas-dev/pandas/issues/7043)) + + ```None + In [76]: prng = pd.period_range('2013-01-01 09:00', periods=100, freq='H') + + In [77]: ps = pd.Series(np.random.randn(len(prng)), index=prng) + + In [78]: ps + Out[78]: + 2013-01-01 09:00 0.015696 + 2013-01-01 10:00 -2.242685 + 2013-01-01 11:00 1.150036 + 2013-01-01 12:00 0.991946 + 2013-01-01 13:00 0.953324 + ... + 2013-01-05 08:00 0.285296 + 2013-01-05 09:00 0.484288 + 2013-01-05 10:00 1.363482 + 2013-01-05 11:00 -0.781105 + 2013-01-05 12:00 -0.468018 + Freq: H, Length: 100, dtype: float64 + + In [79]: ps['2013-01-02'] + Out[79]: + 2013-01-02 00:00 0.553439 + 2013-01-02 01:00 1.318152 + 2013-01-02 02:00 -0.469305 + 2013-01-02 03:00 0.675554 + 2013-01-02 04:00 -1.817027 + ... + 2013-01-02 19:00 0.036142 + 2013-01-02 20:00 -2.074978 + 2013-01-02 21:00 0.247792 + 2013-01-02 22:00 -0.897157 + 2013-01-02 23:00 -0.136795 + Freq: H, Length: 24, dtype: float64 + ``` +* `read_excel` can now read milliseconds in Excel dates and times with xlrd >= 0.9.3. ([GH 5945](https://github.com/pandas-dev/pandas/issues/5945)) +* `pd.stats.moments.rolling_var` now uses Welford’s method for increased numerical stability ([GH 6817](https://github.com/pandas-dev/pandas/issues/6817)) +* pd.expanding\_apply and pd.rolling\_apply now take args and kwargs that are passed on to + the func ([GH 6289](https://github.com/pandas-dev/pandas/issues/6289)) +* `DataFrame.rank()` now has a percentage rank option ([GH 5971](https://github.com/pandas-dev/pandas/issues/5971)) +* `Series.rank()` now has a percentage rank option ([GH 5971](https://github.com/pandas-dev/pandas/issues/5971)) +* `Series.rank()` and `DataFrame.rank()` now accept `method='dense'` for ranks without gaps ([GH 6514](https://github.com/pandas-dev/pandas/issues/6514)) +* Support passing `encoding` with xlwt ([GH 3710](https://github.com/pandas-dev/pandas/issues/3710)) +* Refactor Block classes removing `Block.items` attributes to avoid duplication + in item handling ([GH 6745](https://github.com/pandas-dev/pandas/issues/6745), [GH 6988](https://github.com/pandas-dev/pandas/issues/6988)). +* Testing statements updated to use specialized asserts ([GH 6175](https://github.com/pandas-dev/pandas/issues/6175)) + +## Performance[#](#performance "Link to this heading") + +* Performance improvement when converting `DatetimeIndex` to floating ordinals + using `DatetimeConverter` ([GH 6636](https://github.com/pandas-dev/pandas/issues/6636)) +* Performance improvement for `DataFrame.shift` ([GH 5609](https://github.com/pandas-dev/pandas/issues/5609)) +* Performance improvement in indexing into a MultiIndexed Series ([GH 5567](https://github.com/pandas-dev/pandas/issues/5567)) +* Performance improvements in single-dtyped indexing ([GH 6484](https://github.com/pandas-dev/pandas/issues/6484)) +* Improve performance of DataFrame construction with certain offsets, by removing faulty caching + (e.g. MonthEnd,BusinessMonthEnd), ([GH 6479](https://github.com/pandas-dev/pandas/issues/6479)) +* Improve performance of `CustomBusinessDay` ([GH 6584](https://github.com/pandas-dev/pandas/issues/6584)) +* improve performance of slice indexing on Series with string keys ([GH 6341](https://github.com/pandas-dev/pandas/issues/6341), [GH 6372](https://github.com/pandas-dev/pandas/issues/6372)) +* Performance improvement for `DataFrame.from_records` when reading a + specified number of rows from an iterable ([GH 6700](https://github.com/pandas-dev/pandas/issues/6700)) +* Performance improvements in timedelta conversions for integer dtypes ([GH 6754](https://github.com/pandas-dev/pandas/issues/6754)) +* Improved performance of compatible pickles ([GH 6899](https://github.com/pandas-dev/pandas/issues/6899)) +* Improve performance in certain reindexing operations by optimizing `take_2d` ([GH 6749](https://github.com/pandas-dev/pandas/issues/6749)) +* `GroupBy.count()` is now implemented in Cython and is much faster for large + numbers of groups ([GH 7016](https://github.com/pandas-dev/pandas/issues/7016)). + +## Experimental[#](#experimental "Link to this heading") + +There are no experimental changes in 0.14.0 + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in Series ValueError when index doesn’t match data ([GH 6532](https://github.com/pandas-dev/pandas/issues/6532)) +* Prevent segfault due to MultiIndex not being supported in HDFStore table + format ([GH 1848](https://github.com/pandas-dev/pandas/issues/1848)) +* Bug in `pd.DataFrame.sort_index` where mergesort wasn’t stable when `ascending=False` ([GH 6399](https://github.com/pandas-dev/pandas/issues/6399)) +* Bug in `pd.tseries.frequencies.to_offset` when argument has leading zeros ([GH 6391](https://github.com/pandas-dev/pandas/issues/6391)) +* Bug in version string gen. for dev versions with shallow clones / install from tarball ([GH 6127](https://github.com/pandas-dev/pandas/issues/6127)) +* Inconsistent tz parsing `Timestamp` / `to_datetime` for current year ([GH 5958](https://github.com/pandas-dev/pandas/issues/5958)) +* Indexing bugs with reordered indexes ([GH 6252](https://github.com/pandas-dev/pandas/issues/6252), [GH 6254](https://github.com/pandas-dev/pandas/issues/6254)) +* Bug in `.xs` with a Series multiindex ([GH 6258](https://github.com/pandas-dev/pandas/issues/6258), [GH 5684](https://github.com/pandas-dev/pandas/issues/5684)) +* Bug in conversion of a string types to a DatetimeIndex with a specified frequency ([GH 6273](https://github.com/pandas-dev/pandas/issues/6273), [GH 6274](https://github.com/pandas-dev/pandas/issues/6274)) +* Bug in `eval` where type-promotion failed for large expressions ([GH 6205](https://github.com/pandas-dev/pandas/issues/6205)) +* Bug in interpolate with `inplace=True` ([GH 6281](https://github.com/pandas-dev/pandas/issues/6281)) +* `HDFStore.remove` now handles start and stop ([GH 6177](https://github.com/pandas-dev/pandas/issues/6177)) +* `HDFStore.select_as_multiple` handles start and stop the same way as `select` ([GH 6177](https://github.com/pandas-dev/pandas/issues/6177)) +* `HDFStore.select_as_coordinates` and `select_column` works with a `where` clause that results in filters ([GH 6177](https://github.com/pandas-dev/pandas/issues/6177)) +* Regression in join of non\_unique\_indexes ([GH 6329](https://github.com/pandas-dev/pandas/issues/6329)) +* Issue with groupby `agg` with a single function and a mixed-type frame ([GH 6337](https://github.com/pandas-dev/pandas/issues/6337)) +* Bug in `DataFrame.replace()` when passing a non- `bool` + `to_replace` argument ([GH 6332](https://github.com/pandas-dev/pandas/issues/6332)) +* Raise when trying to align on different levels of a MultiIndex assignment ([GH 3738](https://github.com/pandas-dev/pandas/issues/3738)) +* Bug in setting complex dtypes via boolean indexing ([GH 6345](https://github.com/pandas-dev/pandas/issues/6345)) +* Bug in TimeGrouper/resample when presented with a non-monotonic DatetimeIndex that would return invalid results. ([GH 4161](https://github.com/pandas-dev/pandas/issues/4161)) +* Bug in index name propagation in TimeGrouper/resample ([GH 4161](https://github.com/pandas-dev/pandas/issues/4161)) +* TimeGrouper has a more compatible API to the rest of the groupers (e.g. `groups` was missing) ([GH 3881](https://github.com/pandas-dev/pandas/issues/3881)) +* Bug in multiple grouping with a TimeGrouper depending on target column order ([GH 6764](https://github.com/pandas-dev/pandas/issues/6764)) +* Bug in `pd.eval` when parsing strings with possible tokens like `'&'` + ([GH 6351](https://github.com/pandas-dev/pandas/issues/6351)) +* Bug correctly handle placements of `-inf` in Panels when dividing by integer 0 ([GH 6178](https://github.com/pandas-dev/pandas/issues/6178)) +* `DataFrame.shift` with `axis=1` was raising ([GH 6371](https://github.com/pandas-dev/pandas/issues/6371)) +* Disabled clipboard tests until release time (run locally with `nosetests -A disabled`) ([GH 6048](https://github.com/pandas-dev/pandas/issues/6048)). +* Bug in `DataFrame.replace()` when passing a nested `dict` that contained + keys not in the values to be replaced ([GH 6342](https://github.com/pandas-dev/pandas/issues/6342)) +* `str.match` ignored the na flag ([GH 6609](https://github.com/pandas-dev/pandas/issues/6609)). +* Bug in take with duplicate columns that were not consolidated ([GH 6240](https://github.com/pandas-dev/pandas/issues/6240)) +* Bug in interpolate changing dtypes ([GH 6290](https://github.com/pandas-dev/pandas/issues/6290)) +* Bug in `Series.get`, was using a buggy access method ([GH 6383](https://github.com/pandas-dev/pandas/issues/6383)) +* Bug in hdfstore queries of the form `where=[('date', '>=', datetime(2013,1,1)), ('date', '<=', datetime(2014,1,1))]` ([GH 6313](https://github.com/pandas-dev/pandas/issues/6313)) +* Bug in `DataFrame.dropna` with duplicate indices ([GH 6355](https://github.com/pandas-dev/pandas/issues/6355)) +* Regression in chained getitem indexing with embedded list-like from 0.12 ([GH 6394](https://github.com/pandas-dev/pandas/issues/6394)) +* `Float64Index` with nans not comparing correctly ([GH 6401](https://github.com/pandas-dev/pandas/issues/6401)) +* `eval`/`query` expressions with strings containing the `@` character + will now work ([GH 6366](https://github.com/pandas-dev/pandas/issues/6366)). +* Bug in `Series.reindex` when specifying a `method` with some nan values was inconsistent (noted on a resample) ([GH 6418](https://github.com/pandas-dev/pandas/issues/6418)) +* Bug in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") where nested dicts were erroneously + depending on the order of dictionary keys and values ([GH 5338](https://github.com/pandas-dev/pandas/issues/5338)). +* Performance issue in concatenating with empty objects ([GH 3259](https://github.com/pandas-dev/pandas/issues/3259)) +* Clarify sorting of `sym_diff` on `Index` objects with `NaN` values ([GH 6444](https://github.com/pandas-dev/pandas/issues/6444)) +* Regression in `MultiIndex.from_product` with a `DatetimeIndex` as input ([GH 6439](https://github.com/pandas-dev/pandas/issues/6439)) +* Bug in `str.extract` when passed a non-default index ([GH 6348](https://github.com/pandas-dev/pandas/issues/6348)) +* Bug in `str.split` when passed `pat=None` and `n=1` ([GH 6466](https://github.com/pandas-dev/pandas/issues/6466)) +* Bug in `io.data.DataReader` when passed `"F-F_Momentum_Factor"` and `data_source="famafrench"` ([GH 6460](https://github.com/pandas-dev/pandas/issues/6460)) +* Bug in `sum` of a `timedelta64[ns]` series ([GH 6462](https://github.com/pandas-dev/pandas/issues/6462)) +* Bug in `resample` with a timezone and certain offsets ([GH 6397](https://github.com/pandas-dev/pandas/issues/6397)) +* Bug in `iat/iloc` with duplicate indices on a Series ([GH 6493](https://github.com/pandas-dev/pandas/issues/6493)) +* Bug in `read_html` where nan’s were incorrectly being used to indicate + missing values in text. Should use the empty string for consistency with the + rest of pandas ([GH 5129](https://github.com/pandas-dev/pandas/issues/5129)). +* Bug in `read_html` tests where redirected invalid URLs would make one test + fail ([GH 6445](https://github.com/pandas-dev/pandas/issues/6445)). +* Bug in multi-axis indexing using `.loc` on non-unique indices ([GH 6504](https://github.com/pandas-dev/pandas/issues/6504)) +* Bug that caused \_ref\_locs corruption when slice indexing across columns axis of a DataFrame ([GH 6525](https://github.com/pandas-dev/pandas/issues/6525)) +* Regression from 0.13 in the treatment of numpy `datetime64` non-ns dtypes in Series creation ([GH 6529](https://github.com/pandas-dev/pandas/issues/6529)) +* `.names` attribute of MultiIndexes passed to `set_index` are now preserved ([GH 6459](https://github.com/pandas-dev/pandas/issues/6459)). +* Bug in setitem with a duplicate index and an alignable rhs ([GH 6541](https://github.com/pandas-dev/pandas/issues/6541)) +* Bug in setitem with `.loc` on mixed integer Indexes ([GH 6546](https://github.com/pandas-dev/pandas/issues/6546)) +* Bug in `pd.read_stata` which would use the wrong data types and missing values ([GH 6327](https://github.com/pandas-dev/pandas/issues/6327)) +* Bug in `DataFrame.to_stata` that lead to data loss in certain cases, and could be exported using the + wrong data types and missing values ([GH 6335](https://github.com/pandas-dev/pandas/issues/6335)) +* `StataWriter` replaces missing values in string columns by empty string ([GH 6802](https://github.com/pandas-dev/pandas/issues/6802)) +* Inconsistent types in `Timestamp` addition/subtraction ([GH 6543](https://github.com/pandas-dev/pandas/issues/6543)) +* Bug in preserving frequency across Timestamp addition/subtraction ([GH 4547](https://github.com/pandas-dev/pandas/issues/4547)) +* Bug in empty list lookup caused `IndexError` exceptions ([GH 6536](https://github.com/pandas-dev/pandas/issues/6536), [GH 6551](https://github.com/pandas-dev/pandas/issues/6551)) +* `Series.quantile` raising on an `object` dtype ([GH 6555](https://github.com/pandas-dev/pandas/issues/6555)) +* Bug in `.xs` with a `nan` in level when dropped ([GH 6574](https://github.com/pandas-dev/pandas/issues/6574)) +* Bug in fillna with `method='bfill/ffill'` and `datetime64[ns]` dtype ([GH 6587](https://github.com/pandas-dev/pandas/issues/6587)) +* Bug in sql writing with mixed dtypes possibly leading to data loss ([GH 6509](https://github.com/pandas-dev/pandas/issues/6509)) +* Bug in `Series.pop` ([GH 6600](https://github.com/pandas-dev/pandas/issues/6600)) +* Bug in `iloc` indexing when positional indexer matched `Int64Index` of the corresponding axis and no reordering happened ([GH 6612](https://github.com/pandas-dev/pandas/issues/6612)) +* Bug in `fillna` with `limit` and `value` specified +* Bug in `DataFrame.to_stata` when columns have non-string names ([GH 4558](https://github.com/pandas-dev/pandas/issues/4558)) +* Bug in compat with `np.compress`, surfaced in ([GH 6658](https://github.com/pandas-dev/pandas/issues/6658)) +* Bug in binary operations with a rhs of a Series not aligning ([GH 6681](https://github.com/pandas-dev/pandas/issues/6681)) +* Bug in `DataFrame.to_stata` which incorrectly handles nan values and ignores `with_index` keyword argument ([GH 6685](https://github.com/pandas-dev/pandas/issues/6685)) +* Bug in resample with extra bins when using an evenly divisible frequency ([GH 4076](https://github.com/pandas-dev/pandas/issues/4076)) +* Bug in consistency of groupby aggregation when passing a custom function ([GH 6715](https://github.com/pandas-dev/pandas/issues/6715)) +* Bug in resample when `how=None` resample freq is the same as the axis frequency ([GH 5955](https://github.com/pandas-dev/pandas/issues/5955)) +* Bug in downcasting inference with empty arrays ([GH 6733](https://github.com/pandas-dev/pandas/issues/6733)) +* Bug in `obj.blocks` on sparse containers dropping all but the last items of same for dtype ([GH 6748](https://github.com/pandas-dev/pandas/issues/6748)) +* Bug in unpickling `NaT (NaTType)` ([GH 4606](https://github.com/pandas-dev/pandas/issues/4606)) +* Bug in `DataFrame.replace()` where regex meta characters were being treated + as regex even when `regex=False` ([GH 6777](https://github.com/pandas-dev/pandas/issues/6777)). +* Bug in timedelta ops on 32-bit platforms ([GH 6808](https://github.com/pandas-dev/pandas/issues/6808)) +* Bug in setting a tz-aware index directly via `.index` ([GH 6785](https://github.com/pandas-dev/pandas/issues/6785)) +* Bug in expressions.py where numexpr would try to evaluate arithmetic ops + ([GH 6762](https://github.com/pandas-dev/pandas/issues/6762)). +* Bug in Makefile where it didn’t remove Cython generated C files with `make + clean` ([GH 6768](https://github.com/pandas-dev/pandas/issues/6768)) +* Bug with numpy < 1.7.2 when reading long strings from `HDFStore` ([GH 6166](https://github.com/pandas-dev/pandas/issues/6166)) +* Bug in `DataFrame._reduce` where non bool-like (0/1) integers were being + converted into bools. ([GH 6806](https://github.com/pandas-dev/pandas/issues/6806)) +* Regression from 0.13 with `fillna` and a Series on datetime-like ([GH 6344](https://github.com/pandas-dev/pandas/issues/6344)) +* Bug in adding `np.timedelta64` to `DatetimeIndex` with timezone outputs incorrect results ([GH 6818](https://github.com/pandas-dev/pandas/issues/6818)) +* Bug in `DataFrame.replace()` where changing a dtype through replacement + would only replace the first occurrence of a value ([GH 6689](https://github.com/pandas-dev/pandas/issues/6689)) +* Better error message when passing a frequency of ‘MS’ in `Period` construction (GH5332) +* Bug in `Series.__unicode__` when `max_rows=None` and the Series has more than 1000 rows. ([GH 6863](https://github.com/pandas-dev/pandas/issues/6863)) +* Bug in `groupby.get_group` where a datelike wasn’t always accepted ([GH 5267](https://github.com/pandas-dev/pandas/issues/5267)) +* Bug in `groupBy.get_group` created by `TimeGrouper` raises `AttributeError` ([GH 6914](https://github.com/pandas-dev/pandas/issues/6914)) +* Bug in `DatetimeIndex.tz_localize` and `DatetimeIndex.tz_convert` converting `NaT` incorrectly ([GH 5546](https://github.com/pandas-dev/pandas/issues/5546)) +* Bug in arithmetic operations affecting `NaT` ([GH 6873](https://github.com/pandas-dev/pandas/issues/6873)) +* Bug in `Series.str.extract` where the resulting `Series` from a single + group match wasn’t renamed to the group name +* Bug in `DataFrame.to_csv` where setting `index=False` ignored the + `header` kwarg ([GH 6186](https://github.com/pandas-dev/pandas/issues/6186)) +* Bug in `DataFrame.plot` and `Series.plot`, where the legend behave inconsistently when plotting to the same axes repeatedly ([GH 6678](https://github.com/pandas-dev/pandas/issues/6678)) +* Internal tests for patching `__finalize__` / bug in merge not finalizing ([GH 6923](https://github.com/pandas-dev/pandas/issues/6923), [GH 6927](https://github.com/pandas-dev/pandas/issues/6927)) +* accept `TextFileReader` in `concat`, which was affecting a common user idiom ([GH 6583](https://github.com/pandas-dev/pandas/issues/6583)) +* Bug in C parser with leading white space ([GH 3374](https://github.com/pandas-dev/pandas/issues/3374)) +* Bug in C parser with `delim_whitespace=True` and `\r`-delimited lines +* Bug in python parser with explicit MultiIndex in row following column header ([GH 6893](https://github.com/pandas-dev/pandas/issues/6893)) +* Bug in `Series.rank` and `DataFrame.rank` that caused small floats (<1e-13) to all receive the same rank ([GH 6886](https://github.com/pandas-dev/pandas/issues/6886)) +* Bug in `DataFrame.apply` with functions that used `*args` or `**kwargs` and returned + an empty result ([GH 6952](https://github.com/pandas-dev/pandas/issues/6952)) +* Bug in sum/mean on 32-bit platforms on overflows ([GH 6915](https://github.com/pandas-dev/pandas/issues/6915)) +* Moved `Panel.shift` to `NDFrame.slice_shift` and fixed to respect multiple dtypes. ([GH 6959](https://github.com/pandas-dev/pandas/issues/6959)) +* Bug in enabling `subplots=True` in `DataFrame.plot` only has single column raises `TypeError`, and `Series.plot` raises `AttributeError` ([GH 6951](https://github.com/pandas-dev/pandas/issues/6951)) +* Bug in `DataFrame.plot` draws unnecessary axes when enabling `subplots` and `kind=scatter` ([GH 6951](https://github.com/pandas-dev/pandas/issues/6951)) +* Bug in `read_csv` from a filesystem with non-utf-8 encoding ([GH 6807](https://github.com/pandas-dev/pandas/issues/6807)) +* Bug in `iloc` when setting / aligning ([GH 6766](https://github.com/pandas-dev/pandas/issues/6766)) +* Bug causing UnicodeEncodeError when get\_dummies called with unicode values and a prefix ([GH 6885](https://github.com/pandas-dev/pandas/issues/6885)) +* Bug in timeseries-with-frequency plot cursor display ([GH 5453](https://github.com/pandas-dev/pandas/issues/5453)) +* Bug surfaced in `groupby.plot` when using a `Float64Index` ([GH 7025](https://github.com/pandas-dev/pandas/issues/7025)) +* Stopped tests from failing if options data isn’t able to be downloaded from Yahoo ([GH 7034](https://github.com/pandas-dev/pandas/issues/7034)) +* Bug in `parallel_coordinates` and `radviz` where reordering of class column + caused possible color/class mismatch ([GH 6956](https://github.com/pandas-dev/pandas/issues/6956)) +* Bug in `radviz` and `andrews_curves` where multiple values of ‘color’ + were being passed to plotting method ([GH 6956](https://github.com/pandas-dev/pandas/issues/6956)) +* Bug in `Float64Index.isin()` where containing `nan` s would make indices + claim that they contained all the things ([GH 7066](https://github.com/pandas-dev/pandas/issues/7066)). +* Bug in `DataFrame.boxplot` where it failed to use the axis passed as the `ax` argument ([GH 3578](https://github.com/pandas-dev/pandas/issues/3578)) +* Bug in the `XlsxWriter` and `XlwtWriter` implementations that resulted in datetime columns being formatted without the time ([GH 7075](https://github.com/pandas-dev/pandas/issues/7075)) + were being passed to plotting method +* [`read_fwf()`](../reference/api/pandas.read_fwf.html#pandas.read_fwf "pandas.read_fwf") treats `None` in `colspec` like regular python slices. It now reads from the beginning + or until the end of the line when `colspec` contains a `None` (previously raised a `TypeError`) +* Bug in cache coherence with chained indexing and slicing; add `_is_view` property to `NDFrame` to correctly predict + views; mark `is_copy` on `xs` only if its an actual copy (and not a view) ([GH 7084](https://github.com/pandas-dev/pandas/issues/7084)) +* Bug in DatetimeIndex creation from string ndarray with `dayfirst=True` ([GH 5917](https://github.com/pandas-dev/pandas/issues/5917)) +* Bug in `MultiIndex.from_arrays` created from `DatetimeIndex` doesn’t preserve `freq` and `tz` ([GH 7090](https://github.com/pandas-dev/pandas/issues/7090)) +* Bug in `unstack` raises `ValueError` when `MultiIndex` contains `PeriodIndex` ([GH 4342](https://github.com/pandas-dev/pandas/issues/4342)) +* Bug in `boxplot` and `hist` draws unnecessary axes ([GH 6769](https://github.com/pandas-dev/pandas/issues/6769)) +* Regression in `groupby.nth()` for out-of-bounds indexers ([GH 6621](https://github.com/pandas-dev/pandas/issues/6621)) +* Bug in `quantile` with datetime values ([GH 6965](https://github.com/pandas-dev/pandas/issues/6965)) +* Bug in `Dataframe.set_index`, `reindex` and `pivot` don’t preserve `DatetimeIndex` and `PeriodIndex` attributes ([GH 3950](https://github.com/pandas-dev/pandas/issues/3950), [GH 5878](https://github.com/pandas-dev/pandas/issues/5878), [GH 6631](https://github.com/pandas-dev/pandas/issues/6631)) +* Bug in `MultiIndex.get_level_values` doesn’t preserve `DatetimeIndex` and `PeriodIndex` attributes ([GH 7092](https://github.com/pandas-dev/pandas/issues/7092)) +* Bug in `Groupby` doesn’t preserve `tz` ([GH 3950](https://github.com/pandas-dev/pandas/issues/3950)) +* Bug in `PeriodIndex` partial string slicing ([GH 6716](https://github.com/pandas-dev/pandas/issues/6716)) +* Bug in the HTML repr of a truncated Series or DataFrame not showing the class name with the `large_repr` set to ‘info’ + ([GH 7105](https://github.com/pandas-dev/pandas/issues/7105)) +* Bug in `DatetimeIndex` specifying `freq` raises `ValueError` when passed value is too short ([GH 7098](https://github.com/pandas-dev/pandas/issues/7098)) +* Fixed a bug with the `info` repr not honoring the `display.max_info_columns` setting ([GH 6939](https://github.com/pandas-dev/pandas/issues/6939)) +* Bug `PeriodIndex` string slicing with out of bounds values ([GH 5407](https://github.com/pandas-dev/pandas/issues/5407)) +* Fixed a memory error in the hashtable implementation/factorizer on resizing of large tables ([GH 7157](https://github.com/pandas-dev/pandas/issues/7157)) +* Bug in `isnull` when applied to 0-dimensional object arrays ([GH 7176](https://github.com/pandas-dev/pandas/issues/7176)) +* Bug in `query`/`eval` where global constants were not looked up correctly + ([GH 7178](https://github.com/pandas-dev/pandas/issues/7178)) +* Bug in recognizing out-of-bounds positional list indexers with `iloc` and a multi-axis tuple indexer ([GH 7189](https://github.com/pandas-dev/pandas/issues/7189)) +* Bug in setitem with a single value, MultiIndex and integer indices ([GH 7190](https://github.com/pandas-dev/pandas/issues/7190), [GH 7218](https://github.com/pandas-dev/pandas/issues/7218)) +* Bug in expressions evaluation with reversed ops, showing in series-dataframe ops ([GH 7198](https://github.com/pandas-dev/pandas/issues/7198), [GH 7192](https://github.com/pandas-dev/pandas/issues/7192)) +* Bug in multi-axis indexing with > 2 ndim and a MultiIndex ([GH 7199](https://github.com/pandas-dev/pandas/issues/7199)) +* Fix a bug where invalid eval/query operations would blow the stack ([GH 5198](https://github.com/pandas-dev/pandas/issues/5198)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 94 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Acanthostega + +* Adam Marcus + +* Alex Gaudio +* Alex Rothberg +* AllenDowney + +* Andrew Rosenfeld + +* Andy Hayden +* Antoine Mazières + +* Benedikt Sauer +* Brad Buran +* Christopher Whelan +* Clark Fitzgerald +* DSM +* Dale Jung +* Dan Allan +* Dan Birken +* Daniel Waeber +* David Jung + +* David Stephens + +* Douglas McNeil +* Garrett Drapala +* Gouthaman Balaraman + +* Guillaume Poulin + +* Jacob Howard + +* Jacob Schaer +* Jason Sexauer + +* Jeff Reback +* Jeff Tratner +* Jeffrey Starr + +* John David Reaver + +* John McNamara +* John W. O’Brien +* Jonathan Chambers +* Joris Van den Bossche +* Julia Evans +* Júlio + +* K.-Michael Aye +* Katie Atkinson + +* Kelsey Jordahl +* Kevin Sheppard + +* Matt Wittmann + +* Matthias Kuhn + +* Max Grender-Jones + +* Michael E. Gruen + +* Mike Kelly +* Nipun Batra + +* Noah Spies + +* PKEuS +* Patrick O’Keeffe +* Phillip Cloud +* Pietro Battiston + +* Randy Carnevale + +* Robert Gibboni + +* Skipper Seabold +* SplashDance + +* Stephan Hoyer + +* Tim Cera + +* Tobias Brandt +* Todd Jennings + +* Tom Augspurger +* TomAugspurger +* Yaroslav Halchenko +* agijsberts + +* akittredge +* ankostis + +* anomrake +* anton-d + +* bashtage + +* benjamin + +* bwignall +* cgohlke + +* chebee7i + +* clham + +* danielballan +* hshimizu77 + +* hugo + +* immerrr +* ischwabacher + +* jaimefrio + +* jreback +* jsexauer + +* kdiether + +* michaelws + +* mikebailey + +* ojdo + +* onesandzeroes + +* phaebz + +* ribonoous + +* rockg +* sinhrks + +* unutbu +* westurner +* y-p +* zach powers diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.14.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.14.1.md new file mode 100644 index 0000000000000000000000000000000000000000..c0d503c8ea418a1a5ebb8ce5d248c424d6008df0 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.14.1.md @@ -0,0 +1,302 @@ +# What's new in pandas 0.14.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.14.1.html + +# Version 0.14.1 (July 11, 2014)[#](#version-0-14-1-july-11-2014 "Link to this heading") + +This is a minor release from 0.14.0 and includes a small number of API changes, several new features, +enhancements, and performance improvements along with a large number of bug fixes. We recommend that all +users upgrade to this version. + +* Highlights include: + + + New methods [`select_dtypes()`](../reference/api/pandas.DataFrame.select_dtypes.html#pandas.DataFrame.select_dtypes "pandas.DataFrame.select_dtypes") to select columns + based on the dtype and [`sem()`](../reference/api/pandas.Series.sem.html#pandas.Series.sem "pandas.Series.sem") to calculate the + standard error of the mean. + + Support for dateutil timezones (see [docs](../user_guide/timeseries.html#timeseries-timezone)). + + Support for ignoring full line comments in the [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") + text parser. + + New documentation section on [Options and Settings](../user_guide/options.html#options). + + Lots of bug fixes. +* [Enhancements](#whatsnew-0141-enhancements) +* [API Changes](#whatsnew-0141-api) +* [Performance Improvements](#whatsnew-0141-performance) +* [Experimental Changes](#whatsnew-0141-experimental) +* [Bug Fixes](#whatsnew-0141-bug-fixes) + +## API changes[#](#api-changes "Link to this heading") + +* Openpyxl now raises a ValueError on construction of the openpyxl writer + instead of warning on pandas import ([GH 7284](https://github.com/pandas-dev/pandas/issues/7284)). +* For `StringMethods.extract`, when no match is found, the result - only + containing `NaN` values - now also has `dtype=object` instead of + `float` ([GH 7242](https://github.com/pandas-dev/pandas/issues/7242)) +* `Period` objects no longer raise a `TypeError` when compared using `==` + with another object that *isn’t* a `Period`. Instead + when comparing a `Period` with another object using `==` if the other + object isn’t a `Period` `False` is returned. ([GH 7376](https://github.com/pandas-dev/pandas/issues/7376)) +* Previously, the behaviour on resetting the time or not in + `offsets.apply`, `rollforward` and `rollback` operations differed + between offsets. With the support of the `normalize` keyword for all offsets(see + below) with a default value of False (preserve time), the behaviour changed for certain + offsets (BusinessMonthBegin, MonthEnd, BusinessMonthEnd, CustomBusinessMonthEnd, + BusinessYearBegin, LastWeekOfMonth, FY5253Quarter, LastWeekOfMonth, Easter): + + ```None + In [6]: from pandas.tseries import offsets + + In [7]: d = pd.Timestamp('2014-01-01 09:00') + + # old behaviour < 0.14.1 + In [8]: d + offsets.MonthEnd() + Out[8]: pd.Timestamp('2014-01-31 00:00:00') + ``` + + Starting from 0.14.1 all offsets preserve time by default. The old + behaviour can be obtained with `normalize=True` + + ```None + # new behaviour + In [1]: d + offsets.MonthEnd() + Out[1]: Timestamp('2014-01-31 09:00:00') + + In [2]: d + offsets.MonthEnd(normalize=True) + Out[2]: Timestamp('2014-01-31 00:00:00') + ``` + + Note that for the other offsets the default behaviour did not change. +* Add back `#N/A N/A` as a default NA value in text parsing, (regression from 0.12) ([GH 5521](https://github.com/pandas-dev/pandas/issues/5521)) +* Raise a `TypeError` on inplace-setting with a `.where` and a non `np.nan` value as this is inconsistent + with a set-item expression like `df[mask] = None` ([GH 7656](https://github.com/pandas-dev/pandas/issues/7656)) + +## Enhancements[#](#enhancements "Link to this heading") + +* Add `dropna` argument to `value_counts` and `nunique` ([GH 5569](https://github.com/pandas-dev/pandas/issues/5569)). +* Add [`select_dtypes()`](../reference/api/pandas.DataFrame.select_dtypes.html#pandas.DataFrame.select_dtypes "pandas.DataFrame.select_dtypes") method to allow selection of + columns based on dtype ([GH 7316](https://github.com/pandas-dev/pandas/issues/7316)). See [the docs](../user_guide/basics.html#basics-selectdtypes). +* All `offsets` supports the `normalize` keyword to specify whether + `offsets.apply`, `rollforward` and `rollback` resets the time (hour, + minute, etc) or not (default `False`, preserves time) ([GH 7156](https://github.com/pandas-dev/pandas/issues/7156)): + + ```None + import pandas.tseries.offsets as offsets + + day = offsets.Day() + day.apply(pd.Timestamp("2014-01-01 09:00")) + + day = offsets.Day(normalize=True) + day.apply(pd.Timestamp("2014-01-01 09:00")) + ``` +* `PeriodIndex` is represented as the same format as `DatetimeIndex` ([GH 7601](https://github.com/pandas-dev/pandas/issues/7601)) +* `StringMethods` now work on empty Series ([GH 7242](https://github.com/pandas-dev/pandas/issues/7242)) +* The file parsers `read_csv` and `read_table` now ignore line comments provided by + the parameter `comment`, which accepts only a single character for the C reader. + In particular, they allow for comments before file data begins ([GH 2685](https://github.com/pandas-dev/pandas/issues/2685)) +* Add `NotImplementedError` for simultaneous use of `chunksize` and `nrows` + for read\_csv() ([GH 6774](https://github.com/pandas-dev/pandas/issues/6774)). +* Tests for basic reading of public S3 buckets now exist ([GH 7281](https://github.com/pandas-dev/pandas/issues/7281)). +* `read_html` now sports an `encoding` argument that is passed to the + underlying parser library. You can use this to read non-ascii encoded web + pages ([GH 7323](https://github.com/pandas-dev/pandas/issues/7323)). +* `read_excel` now supports reading from URLs in the same way + that `read_csv` does. ([GH 6809](https://github.com/pandas-dev/pandas/issues/6809)) +* Support for dateutil timezones, which can now be used in the same way as + pytz timezones across pandas. ([GH 4688](https://github.com/pandas-dev/pandas/issues/4688)) + + ```None + In [3]: rng = pd.date_range( + ...: "3/6/2012 00:00", periods=10, freq="D", tz="dateutil/Europe/London" + ...: ) + ...: + + In [4]: rng.tz + Out[4]: tzfile('/usr/share/zoneinfo/Europe/London') + ``` + + See [the docs](../user_guide/timeseries.html#timeseries-timezone). +* Implemented `sem` (standard error of the mean) operation for `Series`, + `DataFrame`, `Panel`, and `Groupby` ([GH 6897](https://github.com/pandas-dev/pandas/issues/6897)) +* Add `nlargest` and `nsmallest` to the `Series` `groupby` allowlist, + which means you can now use these methods on a `SeriesGroupBy` object + ([GH 7053](https://github.com/pandas-dev/pandas/issues/7053)). +* All offsets `apply`, `rollforward` and `rollback` can now handle `np.datetime64`, previously results in `ApplyTypeError` ([GH 7452](https://github.com/pandas-dev/pandas/issues/7452)) +* `Period` and `PeriodIndex` can contain `NaT` in its values ([GH 7485](https://github.com/pandas-dev/pandas/issues/7485)) +* Support pickling `Series`, `DataFrame` and `Panel` objects with + non-unique labels along *item* axis (`index`, `columns` and `items` + respectively) ([GH 7370](https://github.com/pandas-dev/pandas/issues/7370)). +* Improved inference of datetime/timedelta with mixed null objects. Regression from 0.13.1 in interpretation of an object Index + with all null elements ([GH 7431](https://github.com/pandas-dev/pandas/issues/7431)) + +## Performance[#](#performance "Link to this heading") + +* Improvements in dtype inference for numeric operations involving yielding performance gains for dtypes: `int64`, `timedelta64`, `datetime64` ([GH 7223](https://github.com/pandas-dev/pandas/issues/7223)) +* Improvements in Series.transform for significant performance gains ([GH 6496](https://github.com/pandas-dev/pandas/issues/6496)) +* Improvements in DataFrame.transform with ufuncs and built-in grouper functions for significant performance gains ([GH 7383](https://github.com/pandas-dev/pandas/issues/7383)) +* Regression in groupby aggregation of datetime64 dtypes ([GH 7555](https://github.com/pandas-dev/pandas/issues/7555)) +* Improvements in `MultiIndex.from_product` for large iterables ([GH 7627](https://github.com/pandas-dev/pandas/issues/7627)) + +## Experimental[#](#experimental "Link to this heading") + +* `pandas.io.data.Options` has a new method, `get_all_data` method, and now consistently returns a + MultiIndexed `DataFrame` ([GH 5602](https://github.com/pandas-dev/pandas/issues/5602)) +* `io.gbq.read_gbq` and `io.gbq.to_gbq` were refactored to remove the + dependency on the Google `bq.py` command line client. This submodule + now uses `httplib2` and the Google `apiclient` and `oauth2client` API client + libraries which should be more stable and, therefore, reliable than + `bq.py`. See [the docs](../user_guide/io.html#io-bigquery). ([GH 6937](https://github.com/pandas-dev/pandas/issues/6937)). + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in `DataFrame.where` with a symmetric shaped frame and a passed other of a DataFrame ([GH 7506](https://github.com/pandas-dev/pandas/issues/7506)) +* Bug in Panel indexing with a MultiIndex axis ([GH 7516](https://github.com/pandas-dev/pandas/issues/7516)) +* Regression in datetimelike slice indexing with a duplicated index and non-exact end-points ([GH 7523](https://github.com/pandas-dev/pandas/issues/7523)) +* Bug in setitem with list-of-lists and single vs mixed types ([GH 7551](https://github.com/pandas-dev/pandas/issues/7551):) +* Bug in time ops with non-aligned Series ([GH 7500](https://github.com/pandas-dev/pandas/issues/7500)) +* Bug in timedelta inference when assigning an incomplete Series ([GH 7592](https://github.com/pandas-dev/pandas/issues/7592)) +* Bug in groupby `.nth` with a Series and integer-like column name ([GH 7559](https://github.com/pandas-dev/pandas/issues/7559)) +* Bug in `Series.get` with a boolean accessor ([GH 7407](https://github.com/pandas-dev/pandas/issues/7407)) +* Bug in `value_counts` where `NaT` did not qualify as missing (`NaN`) ([GH 7423](https://github.com/pandas-dev/pandas/issues/7423)) +* Bug in `to_timedelta` that accepted invalid units and misinterpreted ‘m/h’ ([GH 7611](https://github.com/pandas-dev/pandas/issues/7611), [GH 6423](https://github.com/pandas-dev/pandas/issues/6423)) +* Bug in line plot doesn’t set correct `xlim` if `secondary_y=True` ([GH 7459](https://github.com/pandas-dev/pandas/issues/7459)) +* Bug in grouped `hist` and `scatter` plots use old `figsize` default ([GH 7394](https://github.com/pandas-dev/pandas/issues/7394)) +* Bug in plotting subplots with `DataFrame.plot`, `hist` clears passed `ax` even if the number of subplots is one ([GH 7391](https://github.com/pandas-dev/pandas/issues/7391)). +* Bug in plotting subplots with `DataFrame.boxplot` with `by` kw raises `ValueError` if the number of subplots exceeds 1 ([GH 7391](https://github.com/pandas-dev/pandas/issues/7391)). +* Bug in subplots displays `ticklabels` and `labels` in different rule ([GH 5897](https://github.com/pandas-dev/pandas/issues/5897)) +* Bug in `Panel.apply` with a MultiIndex as an axis ([GH 7469](https://github.com/pandas-dev/pandas/issues/7469)) +* Bug in `DatetimeIndex.insert` doesn’t preserve `name` and `tz` ([GH 7299](https://github.com/pandas-dev/pandas/issues/7299)) +* Bug in `DatetimeIndex.asobject` doesn’t preserve `name` ([GH 7299](https://github.com/pandas-dev/pandas/issues/7299)) +* Bug in MultiIndex slicing with datetimelike ranges (strings and Timestamps), ([GH 7429](https://github.com/pandas-dev/pandas/issues/7429)) +* Bug in `Index.min` and `max` doesn’t handle `nan` and `NaT` properly ([GH 7261](https://github.com/pandas-dev/pandas/issues/7261)) +* Bug in `PeriodIndex.min/max` results in `int` ([GH 7609](https://github.com/pandas-dev/pandas/issues/7609)) +* Bug in `resample` where `fill_method` was ignored if you passed `how` ([GH 2073](https://github.com/pandas-dev/pandas/issues/2073)) +* Bug in `TimeGrouper` doesn’t exclude column specified by `key` ([GH 7227](https://github.com/pandas-dev/pandas/issues/7227)) +* Bug in `DataFrame` and `Series` bar and barh plot raises `TypeError` when `bottom` + and `left` keyword is specified ([GH 7226](https://github.com/pandas-dev/pandas/issues/7226)) +* Bug in `DataFrame.hist` raises `TypeError` when it contains non numeric column ([GH 7277](https://github.com/pandas-dev/pandas/issues/7277)) +* Bug in `Index.delete` does not preserve `name` and `freq` attributes ([GH 7302](https://github.com/pandas-dev/pandas/issues/7302)) +* Bug in `DataFrame.query()`/`eval` where local string variables with the @ + sign were being treated as temporaries attempting to be deleted + ([GH 7300](https://github.com/pandas-dev/pandas/issues/7300)). +* Bug in `Float64Index` which didn’t allow duplicates ([GH 7149](https://github.com/pandas-dev/pandas/issues/7149)). +* Bug in `DataFrame.replace()` where truthy values were being replaced + ([GH 7140](https://github.com/pandas-dev/pandas/issues/7140)). +* Bug in `StringMethods.extract()` where a single match group Series + would use the matcher’s name instead of the group name ([GH 7313](https://github.com/pandas-dev/pandas/issues/7313)). +* Bug in `isnull()` when `mode.use_inf_as_null == True` where isnull + wouldn’t test `True` when it encountered an `inf`/`-inf` + ([GH 7315](https://github.com/pandas-dev/pandas/issues/7315)). +* Bug in inferred\_freq results in None for eastern hemisphere timezones ([GH 7310](https://github.com/pandas-dev/pandas/issues/7310)) +* Bug in `Easter` returns incorrect date when offset is negative ([GH 7195](https://github.com/pandas-dev/pandas/issues/7195)) +* Bug in broadcasting with `.div`, integer dtypes and divide-by-zero ([GH 7325](https://github.com/pandas-dev/pandas/issues/7325)) +* Bug in `CustomBusinessDay.apply` raises `NameError` when `np.datetime64` object is passed ([GH 7196](https://github.com/pandas-dev/pandas/issues/7196)) +* Bug in `MultiIndex.append`, `concat` and `pivot_table` don’t preserve timezone ([GH 6606](https://github.com/pandas-dev/pandas/issues/6606)) +* Bug in `.loc` with a list of indexers on a single-multi index level (that is not nested) ([GH 7349](https://github.com/pandas-dev/pandas/issues/7349)) +* Bug in `Series.map` when mapping a dict with tuple keys of different lengths ([GH 7333](https://github.com/pandas-dev/pandas/issues/7333)) +* Bug all `StringMethods` now work on empty Series ([GH 7242](https://github.com/pandas-dev/pandas/issues/7242)) +* Fix delegation of `read_sql` to `read_sql_query` when query does not contain ‘select’ ([GH 7324](https://github.com/pandas-dev/pandas/issues/7324)). +* Bug where a string column name assignment to a `DataFrame` with a + `Float64Index` raised a `TypeError` during a call to `np.isnan` + ([GH 7366](https://github.com/pandas-dev/pandas/issues/7366)). +* Bug where `NDFrame.replace()` didn’t correctly replace objects with + `Period` values ([GH 7379](https://github.com/pandas-dev/pandas/issues/7379)). +* Bug in `.ix` getitem should always return a Series ([GH 7150](https://github.com/pandas-dev/pandas/issues/7150)) +* Bug in MultiIndex slicing with incomplete indexers ([GH 7399](https://github.com/pandas-dev/pandas/issues/7399)) +* Bug in MultiIndex slicing with a step in a sliced level ([GH 7400](https://github.com/pandas-dev/pandas/issues/7400)) +* Bug where negative indexers in `DatetimeIndex` were not correctly sliced + ([GH 7408](https://github.com/pandas-dev/pandas/issues/7408)) +* Bug where `NaT` wasn’t repr’d correctly in a `MultiIndex` ([GH 7406](https://github.com/pandas-dev/pandas/issues/7406), + [GH 7409](https://github.com/pandas-dev/pandas/issues/7409)). +* Bug where bool objects were converted to `nan` in `convert_objects` + ([GH 7416](https://github.com/pandas-dev/pandas/issues/7416)). +* Bug in `quantile` ignoring the axis keyword argument ([GH 7306](https://github.com/pandas-dev/pandas/issues/7306)) +* Bug where `nanops._maybe_null_out` doesn’t work with complex numbers + ([GH 7353](https://github.com/pandas-dev/pandas/issues/7353)) +* Bug in several `nanops` functions when `axis==0` for + 1-dimensional `nan` arrays ([GH 7354](https://github.com/pandas-dev/pandas/issues/7354)) +* Bug where `nanops.nanmedian` doesn’t work when `axis==None` + ([GH 7352](https://github.com/pandas-dev/pandas/issues/7352)) +* Bug where `nanops._has_infs` doesn’t work with many dtypes + ([GH 7357](https://github.com/pandas-dev/pandas/issues/7357)) +* Bug in `StataReader.data` where reading a 0-observation dta failed ([GH 7369](https://github.com/pandas-dev/pandas/issues/7369)) +* Bug in `StataReader` when reading Stata 13 (117) files containing fixed width strings ([GH 7360](https://github.com/pandas-dev/pandas/issues/7360)) +* Bug in `StataWriter` where encoding was ignored ([GH 7286](https://github.com/pandas-dev/pandas/issues/7286)) +* Bug in `DatetimeIndex` comparison doesn’t handle `NaT` properly ([GH 7529](https://github.com/pandas-dev/pandas/issues/7529)) +* Bug in passing input with `tzinfo` to some offsets `apply`, `rollforward` or `rollback` resets `tzinfo` or raises `ValueError` ([GH 7465](https://github.com/pandas-dev/pandas/issues/7465)) +* Bug in `DatetimeIndex.to_period`, `PeriodIndex.asobject`, `PeriodIndex.to_timestamp` doesn’t preserve `name` ([GH 7485](https://github.com/pandas-dev/pandas/issues/7485)) +* Bug in `DatetimeIndex.to_period` and `PeriodIndex.to_timestamp` handle `NaT` incorrectly ([GH 7228](https://github.com/pandas-dev/pandas/issues/7228)) +* Bug in `offsets.apply`, `rollforward` and `rollback` may return normal `datetime` ([GH 7502](https://github.com/pandas-dev/pandas/issues/7502)) +* Bug in `resample` raises `ValueError` when target contains `NaT` ([GH 7227](https://github.com/pandas-dev/pandas/issues/7227)) +* Bug in `Timestamp.tz_localize` resets `nanosecond` info ([GH 7534](https://github.com/pandas-dev/pandas/issues/7534)) +* Bug in `DatetimeIndex.asobject` raises `ValueError` when it contains `NaT` ([GH 7539](https://github.com/pandas-dev/pandas/issues/7539)) +* Bug in `Timestamp.__new__` doesn’t preserve nanosecond properly ([GH 7610](https://github.com/pandas-dev/pandas/issues/7610)) +* Bug in `Index.astype(float)` where it would return an `object` dtype + `Index` ([GH 7464](https://github.com/pandas-dev/pandas/issues/7464)). +* Bug in `DataFrame.reset_index` loses `tz` ([GH 3950](https://github.com/pandas-dev/pandas/issues/3950)) +* Bug in `DatetimeIndex.freqstr` raises `AttributeError` when `freq` is `None` ([GH 7606](https://github.com/pandas-dev/pandas/issues/7606)) +* Bug in `GroupBy.size` created by `TimeGrouper` raises `AttributeError` ([GH 7453](https://github.com/pandas-dev/pandas/issues/7453)) +* Bug in single column bar plot is misaligned ([GH 7498](https://github.com/pandas-dev/pandas/issues/7498)). +* Bug in area plot with tz-aware time series raises `ValueError` ([GH 7471](https://github.com/pandas-dev/pandas/issues/7471)) +* Bug in non-monotonic `Index.union` may preserve `name` incorrectly ([GH 7458](https://github.com/pandas-dev/pandas/issues/7458)) +* Bug in `DatetimeIndex.intersection` doesn’t preserve timezone ([GH 4690](https://github.com/pandas-dev/pandas/issues/4690)) +* Bug in `rolling_var` where a window larger than the array would raise an error([GH 7297](https://github.com/pandas-dev/pandas/issues/7297)) +* Bug with last plotted timeseries dictating `xlim` ([GH 2960](https://github.com/pandas-dev/pandas/issues/2960)) +* Bug with `secondary_y` axis not being considered for timeseries `xlim` ([GH 3490](https://github.com/pandas-dev/pandas/issues/3490)) +* Bug in `Float64Index` assignment with a non scalar indexer ([GH 7586](https://github.com/pandas-dev/pandas/issues/7586)) +* Bug in `pandas.core.strings.str_contains` does not properly match in a case insensitive fashion when `regex=False` and `case=False` ([GH 7505](https://github.com/pandas-dev/pandas/issues/7505)) +* Bug in `expanding_cov`, `expanding_corr`, `rolling_cov`, and `rolling_corr` for two arguments with mismatched index ([GH 7512](https://github.com/pandas-dev/pandas/issues/7512)) +* Bug in `to_sql` taking the boolean column as text column ([GH 7678](https://github.com/pandas-dev/pandas/issues/7678)) +* Bug in grouped `hist` doesn’t handle `rot` kw and `sharex` kw properly ([GH 7234](https://github.com/pandas-dev/pandas/issues/7234)) +* Bug in `.loc` performing fallback integer indexing with `object` dtype indices ([GH 7496](https://github.com/pandas-dev/pandas/issues/7496)) +* Bug (regression) in `PeriodIndex` constructor when passed `Series` objects ([GH 7701](https://github.com/pandas-dev/pandas/issues/7701)). + +## Contributors[#](#contributors "Link to this heading") + +A total of 46 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Andrew Rosenfeld +* Andy Hayden +* Benjamin Adams + +* Benjamin M. Gross + +* Brian Quistorff + +* Brian Wignall + +* DSM +* Daniel Waeber +* David Bew + +* David Stephens +* Jacob Schaer +* Jan Schulz +* John David Reaver +* John W. O’Brien +* Joris Van den Bossche +* Julien Danjou + +* K.-Michael Aye +* Kevin Sheppard +* Kyle Meyer +* Matt Wittmann +* Matthew Brett + +* Michael Mueller + +* Mortada Mehyar +* Phillip Cloud +* Rob Levy + +* Schaer, Jacob C + +* Stephan Hoyer +* Thomas Kluyver +* Todd Jennings +* Tom Augspurger +* TomAugspurger +* bwignall +* clham +* dsm054 + +* helger + +* immerrr +* jaimefrio +* jreback +* lexual +* onesandzeroes +* rockg +* sanguineturtle + +* seth-p + +* sinhrks +* unknown +* yelite + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.15.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.15.0.md new file mode 100644 index 0000000000000000000000000000000000000000..09aa337a96f50366c64b79edc753dd0cb71e2a7f --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.15.0.md @@ -0,0 +1,1681 @@ +# What's new in pandas 0.15.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.15.0.html + +# Version 0.15.0 (October 18, 2014)[#](#version-0-15-0-october-18-2014 "Link to this heading") + +This is a major release from 0.14.1 and includes a small number of API changes, several new features, +enhancements, and performance improvements along with a large number of bug fixes. We recommend that all +users upgrade to this version. + +Warning + +pandas >= 0.15.0 will no longer support compatibility with NumPy versions < +1.7.0. If you want to use the latest versions of pandas, please upgrade to +NumPy >= 1.7.0 ([GH 7711](https://github.com/pandas-dev/pandas/issues/7711)) + +* Highlights include: + + + The `Categorical` type was integrated as a first-class pandas type, see [here](#whatsnew-0150-cat) + + New scalar type `Timedelta`, and a new index type `TimedeltaIndex`, see [here](#whatsnew-0150-timedeltaindex) + + New datetimelike properties accessor `.dt` for Series, see [Datetimelike Properties](#whatsnew-0150-dt) + + New DataFrame default display for `df.info()` to include memory usage, see [Memory Usage](#whatsnew-0150-memory) + + `read_csv` will now by default ignore blank lines when parsing, see [here](#whatsnew-0150-blanklines) + + API change in using Indexes in set operations, see [here](#whatsnew-0150-index-set-ops) + + Enhancements in the handling of timezones, see [here](#whatsnew-0150-tz) + + A lot of improvements to the rolling and expanding moment functions, see [here](#whatsnew-0150-roll) + + Internal refactoring of the `Index` class to no longer sub-class `ndarray`, see [Internal Refactoring](#whatsnew-0150-refactoring) + + dropping support for `PyTables` less than version 3.0.0, and `numexpr` less than version 2.1 ([GH 7990](https://github.com/pandas-dev/pandas/issues/7990)) + + Split indexing documentation into [Indexing and Selecting Data](../user_guide/indexing.html#indexing) and [MultiIndex / Advanced Indexing](../user_guide/advanced.html#advanced) + + Split out string methods documentation into [Working with Text Data](../user_guide/text.html#text) +* Check the [API Changes](#whatsnew-0150-api) and [deprecations](#whatsnew-0150-deprecations) before updating +* [Other Enhancements](#whatsnew-0150-enhancements) +* [Performance Improvements](#whatsnew-0150-performance) +* [Bug Fixes](#whatsnew-0150-bug-fixes) + +Warning + +In 0.15.0 `Index` has internally been refactored to no longer sub-class `ndarray` +but instead subclass `PandasObject`, similarly to the rest of the pandas objects. This change allows very easy sub-classing and creation of new index types. This should be +a transparent change with only very limited API implications (See the [Internal Refactoring](#whatsnew-0150-refactoring)) + +Warning + +The refactoring in [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") changed the two argument constructor from +“codes/labels and levels” to “values and levels (now called ‘categories’)”. This can lead to subtle bugs. If you use +[`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") directly, please audit your code before updating to this pandas +version and change it to use the [`from_codes()`](../reference/api/pandas.Categorical.from_codes.html#pandas.Categorical.from_codes "pandas.Categorical.from_codes") constructor. See more on `Categorical` [here](#whatsnew-0150-cat) + +## New features[#](#new-features "Link to this heading") + +### Categoricals in Series/DataFrame[#](#categoricals-in-series-dataframe "Link to this heading") + +[`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") can now be included in `Series` and `DataFrames` and gained new +methods to manipulate. Thanks to Jan Schulz for much of this API/implementation. ([GH 3943](https://github.com/pandas-dev/pandas/issues/3943), [GH 5313](https://github.com/pandas-dev/pandas/issues/5313), [GH 5314](https://github.com/pandas-dev/pandas/issues/5314), +[GH 7444](https://github.com/pandas-dev/pandas/issues/7444), [GH 7839](https://github.com/pandas-dev/pandas/issues/7839), [GH 7848](https://github.com/pandas-dev/pandas/issues/7848), [GH 7864](https://github.com/pandas-dev/pandas/issues/7864), [GH 7914](https://github.com/pandas-dev/pandas/issues/7914), [GH 7768](https://github.com/pandas-dev/pandas/issues/7768), [GH 8006](https://github.com/pandas-dev/pandas/issues/8006), [GH 3678](https://github.com/pandas-dev/pandas/issues/3678), +[GH 8075](https://github.com/pandas-dev/pandas/issues/8075), [GH 8076](https://github.com/pandas-dev/pandas/issues/8076), [GH 8143](https://github.com/pandas-dev/pandas/issues/8143), [GH 8453](https://github.com/pandas-dev/pandas/issues/8453), [GH 8518](https://github.com/pandas-dev/pandas/issues/8518)). + +For full docs, see the [categorical introduction](../user_guide/categorical.html#categorical) and the +[API documentation](../reference/arrays.html#api-arrays-categorical). + +```None +In [1]: df = pd.DataFrame({"id": [1, 2, 3, 4, 5, 6], + ...: "raw_grade": ['a', 'b', 'b', 'a', 'a', 'e']}) + ...: + +In [2]: df["grade"] = df["raw_grade"].astype("category") + +In [3]: df["grade"] +Out[3]: +0 a +1 b +2 b +3 a +4 a +5 e +Name: grade, Length: 6, dtype: category +Categories (3, object): ['a', 'b', 'e'] + +# Rename the categories +In [4]: df["grade"] = df["grade"].cat.rename_categories(["very good", "good", "very bad"]) + +# Reorder the categories and simultaneously add the missing categories +In [5]: df["grade"] = df["grade"].cat.set_categories(["very bad", "bad", + ...: "medium", "good", "very good"]) + ...: + +In [6]: df["grade"] +Out[6]: +0 very good +1 good +2 good +3 very good +4 very good +5 very bad +Name: grade, Length: 6, dtype: category +Categories (5, object): ['very bad', 'bad', 'medium', 'good', 'very good'] + +In [7]: df.sort_values("grade") +Out[7]: + id raw_grade grade +5 6 e very bad +1 2 b good +2 3 b good +0 1 a very good +3 4 a very good +4 5 a very good + +[6 rows x 3 columns] + +In [8]: df.groupby("grade", observed=False).size() +Out[8]: +grade +very bad 1 +bad 0 +medium 0 +good 2 +very good 3 +Length: 5, dtype: int64 +``` + +* `pandas.core.group_agg` and `pandas.core.factor_agg` were removed. As an alternative, construct + a dataframe and use `df.groupby().agg()`. +* Supplying “codes/labels and levels” to the [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") constructor is not + supported anymore. Supplying two arguments to the constructor is now interpreted as + “values and levels (now called ‘categories’)”. Please change your code to use the [`from_codes()`](../reference/api/pandas.Categorical.from_codes.html#pandas.Categorical.from_codes "pandas.Categorical.from_codes") + constructor. +* The `Categorical.labels` attribute was renamed to `Categorical.codes` and is read + only. If you want to manipulate codes, please use one of the + [API methods on Categoricals](../reference/arrays.html#api-arrays-categorical). +* The `Categorical.levels` attribute is renamed to `Categorical.categories`. + +### TimedeltaIndex/scalar[#](#timedeltaindex-scalar "Link to this heading") + +We introduce a new scalar type `Timedelta`, which is a subclass of `datetime.timedelta`, and behaves in a similar manner, +but allows compatibility with `np.timedelta64` types as well as a host of custom representation, parsing, and attributes. +This type is very similar to how `Timestamp` works for `datetimes`. It is a nice-API box for the type. See the [docs](../user_guide/timedeltas.html#timedeltas-timedeltas). +([GH 3009](https://github.com/pandas-dev/pandas/issues/3009), [GH 4533](https://github.com/pandas-dev/pandas/issues/4533), [GH 8209](https://github.com/pandas-dev/pandas/issues/8209), [GH 8187](https://github.com/pandas-dev/pandas/issues/8187), [GH 8190](https://github.com/pandas-dev/pandas/issues/8190), [GH 7869](https://github.com/pandas-dev/pandas/issues/7869), [GH 7661](https://github.com/pandas-dev/pandas/issues/7661), [GH 8345](https://github.com/pandas-dev/pandas/issues/8345), [GH 8471](https://github.com/pandas-dev/pandas/issues/8471)) + +Warning + +`Timedelta` scalars (and `TimedeltaIndex`) component fields are *not the same* as the component fields on a `datetime.timedelta` object. For example, `.seconds` on a `datetime.timedelta` object returns the total number of seconds combined between `hours`, `minutes` and `seconds`. In contrast, the pandas `Timedelta` breaks out hours, minutes, microseconds and nanoseconds separately. + +```None +# Timedelta accessor +In [9]: tds = pd.Timedelta('31 days 5 min 3 sec') + +In [10]: tds.minutes +Out[10]: 5L + +In [11]: tds.seconds +Out[11]: 3L + +# datetime.timedelta accessor +# this is 5 minutes * 60 + 3 seconds +In [12]: tds.to_pytimedelta().seconds +Out[12]: 303 +``` + +**Note**: this is no longer true starting from v0.16.0, where full +compatibility with `datetime.timedelta` is introduced. See the +[0.16.0 whatsnew entry](v0.16.0.html#whatsnew-0160-api-breaking-timedelta) + +Warning + +Prior to 0.15.0 `pd.to_timedelta` would return a `Series` for list-like/Series input, and a `np.timedelta64` for scalar input. +It will now return a `TimedeltaIndex` for list-like input, `Series` for Series input, and `Timedelta` for scalar input. + +The arguments to `pd.to_timedelta` are now `(arg,unit='ns',box=True,coerce=False)`, previously were `(arg,box=True,unit='ns')` as these are more logical. + +Construct a scalar + +```None +In [9]: pd.Timedelta('1 days 06:05:01.00003') +Out[9]: Timedelta('1 days 06:05:01.000030') + +In [10]: pd.Timedelta('15.5us') +Out[10]: Timedelta('0 days 00:00:00.000015500') + +In [11]: pd.Timedelta('1 hour 15.5us') +Out[11]: Timedelta('0 days 01:00:00.000015500') + +# negative Timedeltas have this string repr +# to be more consistent with datetime.timedelta conventions +In [12]: pd.Timedelta('-1us') +Out[12]: Timedelta('-1 days +23:59:59.999999') + +# a NaT +In [13]: pd.Timedelta('nan') +Out[13]: NaT +``` + +Access fields for a `Timedelta` + +```None +In [14]: td = pd.Timedelta('1 hour 3m 15.5us') + +In [15]: td.seconds +Out[15]: 3780 + +In [16]: td.microseconds +Out[16]: 15 + +In [17]: td.nanoseconds +Out[17]: 500 +``` + +Construct a `TimedeltaIndex` + +```None +In [18]: pd.TimedeltaIndex(['1 days', '1 days, 00:00:05', + ....: np.timedelta64(2, 'D'), + ....: datetime.timedelta(days=2, seconds=2)]) + ....: +Out[18]: +TimedeltaIndex(['1 days 00:00:00', '1 days 00:00:05', '2 days 00:00:00', + '2 days 00:00:02'], + dtype='timedelta64[ns]', freq=None) +``` + +Constructing a `TimedeltaIndex` with a regular range + +```None +In [19]: pd.timedelta_range('1 days', periods=5, freq='D') +Out[19]: TimedeltaIndex(['1 days', '2 days', '3 days', '4 days', '5 days'], dtype='timedelta64[ns]', freq='D') +``` + +```None +In [20]: pd.timedelta_range(start='1 days', end='2 days', freq='30T') +Out[20]: +TimedeltaIndex(['1 days 00:00:00', '1 days 00:30:00', '1 days 01:00:00', + '1 days 01:30:00', '1 days 02:00:00', '1 days 02:30:00', + '1 days 03:00:00', '1 days 03:30:00', '1 days 04:00:00', + '1 days 04:30:00', '1 days 05:00:00', '1 days 05:30:00', + '1 days 06:00:00', '1 days 06:30:00', '1 days 07:00:00', + '1 days 07:30:00', '1 days 08:00:00', '1 days 08:30:00', + '1 days 09:00:00', '1 days 09:30:00', '1 days 10:00:00', + '1 days 10:30:00', '1 days 11:00:00', '1 days 11:30:00', + '1 days 12:00:00', '1 days 12:30:00', '1 days 13:00:00', + '1 days 13:30:00', '1 days 14:00:00', '1 days 14:30:00', + '1 days 15:00:00', '1 days 15:30:00', '1 days 16:00:00', + '1 days 16:30:00', '1 days 17:00:00', '1 days 17:30:00', + '1 days 18:00:00', '1 days 18:30:00', '1 days 19:00:00', + '1 days 19:30:00', '1 days 20:00:00', '1 days 20:30:00', + '1 days 21:00:00', '1 days 21:30:00', '1 days 22:00:00', + '1 days 22:30:00', '1 days 23:00:00', '1 days 23:30:00', + '2 days 00:00:00'], + dtype='timedelta64[ns]', freq='30T') +``` + +You can now use a `TimedeltaIndex` as the index of a pandas object + +```None +In [20]: s = pd.Series(np.arange(5), + ....: index=pd.timedelta_range('1 days', periods=5, freq='s')) + ....: + +In [21]: s +Out[21]: +1 days 00:00:00 0 +1 days 00:00:01 1 +1 days 00:00:02 2 +1 days 00:00:03 3 +1 days 00:00:04 4 +Freq: s, Length: 5, dtype: int64 +``` + +You can select with partial string selections + +```None +In [22]: s['1 day 00:00:02'] +Out[22]: 2 + +In [23]: s['1 day':'1 day 00:00:02'] +Out[23]: +1 days 00:00:00 0 +1 days 00:00:01 1 +1 days 00:00:02 2 +Freq: s, Length: 3, dtype: int64 +``` + +Finally, the combination of `TimedeltaIndex` with `DatetimeIndex` allow certain combination operations that are `NaT` preserving: + +```None +In [24]: tdi = pd.TimedeltaIndex(['1 days', pd.NaT, '2 days']) + +In [25]: tdi.tolist() +Out[25]: [Timedelta('1 days 00:00:00'), NaT, Timedelta('2 days 00:00:00')] + +In [26]: dti = pd.date_range('20130101', periods=3) + +In [27]: dti.tolist() +Out[27]: +[Timestamp('2013-01-01 00:00:00'), + Timestamp('2013-01-02 00:00:00'), + Timestamp('2013-01-03 00:00:00')] + +In [28]: (dti + tdi).tolist() +Out[28]: [Timestamp('2013-01-02 00:00:00'), NaT, Timestamp('2013-01-05 00:00:00')] + +In [29]: (dti - tdi).tolist() +Out[29]: [Timestamp('2012-12-31 00:00:00'), NaT, Timestamp('2013-01-01 00:00:00')] +``` + +* iteration of a `Series` e.g. `list(Series(...))` of `timedelta64[ns]` would prior to v0.15.0 return `np.timedelta64` for each element. These will now be wrapped in `Timedelta`. + +### Memory usage[#](#memory-usage "Link to this heading") + +Implemented methods to find memory usage of a DataFrame. See the [FAQ](../user_guide/gotchas.html#df-memory-usage) for more. ([GH 6852](https://github.com/pandas-dev/pandas/issues/6852)). + +A new display option `display.memory_usage` (see [Options and settings](../user_guide/options.html#options)) sets the default behavior of the `memory_usage` argument in the `df.info()` method. By default `display.memory_usage` is `True`. + +```None +In [30]: dtypes = ['int64', 'float64', 'datetime64[ns]', 'timedelta64[ns]', + ....: 'complex128', 'object', 'bool'] + ....: + +In [31]: n = 5000 + +In [32]: data = {t: np.random.randint(100, size=n).astype(t) for t in dtypes} + +In [33]: df = pd.DataFrame(data) + +In [34]: df['categorical'] = df['object'].astype('category') + +In [35]: df.info() + +RangeIndex: 5000 entries, 0 to 4999 +Data columns (total 8 columns): + # Column Non-Null Count Dtype +--- ------ -------------- ----- + 0 int64 5000 non-null int64 + 1 float64 5000 non-null float64 + 2 datetime64[ns] 5000 non-null datetime64[ns] + 3 timedelta64[ns] 5000 non-null timedelta64[ns] + 4 complex128 5000 non-null complex128 + 5 object 5000 non-null object + 6 bool 5000 non-null bool + 7 categorical 5000 non-null category +dtypes: bool(1), category(1), complex128(1), datetime64[ns](1), float64(1), int64(1), object(1), timedelta64[ns](1) +memory usage: 288.2+ KB +``` + +Additionally [`memory_usage()`](../reference/api/pandas.DataFrame.memory_usage.html#pandas.DataFrame.memory_usage "pandas.DataFrame.memory_usage") is an available method for a dataframe object which returns the memory usage of each column. + +```None +In [36]: df.memory_usage(index=True) +Out[36]: +Index 128 +int64 40000 +float64 40000 +datetime64[ns] 40000 +timedelta64[ns] 40000 +complex128 80000 +object 40000 +bool 5000 +categorical 9968 +Length: 9, dtype: int64 +``` + +### Series.dt accessor[#](#series-dt-accessor "Link to this heading") + +`Series` has gained an accessor to succinctly return datetime like properties for the *values* of the Series, if its a datetime/period like Series. ([GH 7207](https://github.com/pandas-dev/pandas/issues/7207)) +This will return a Series, indexed like the existing Series. See the [docs](../user_guide/basics.html#basics-dt-accessors) + +```None +# datetime +In [37]: s = pd.Series(pd.date_range('20130101 09:10:12', periods=4)) + +In [38]: s +Out[38]: +0 2013-01-01 09:10:12 +1 2013-01-02 09:10:12 +2 2013-01-03 09:10:12 +3 2013-01-04 09:10:12 +Length: 4, dtype: datetime64[ns] + +In [39]: s.dt.hour +Out[39]: +0 9 +1 9 +2 9 +3 9 +Length: 4, dtype: int32 + +In [40]: s.dt.second +Out[40]: +0 12 +1 12 +2 12 +3 12 +Length: 4, dtype: int32 + +In [41]: s.dt.day +Out[41]: +0 1 +1 2 +2 3 +3 4 +Length: 4, dtype: int32 + +In [42]: s.dt.freq +Out[42]: 'D' +``` + +This enables nice expressions like this: + +```None +In [43]: s[s.dt.day == 2] +Out[43]: +1 2013-01-02 09:10:12 +Length: 1, dtype: datetime64[ns] +``` + +You can easily produce tz aware transformations: + +```None +In [44]: stz = s.dt.tz_localize('US/Eastern') + +In [45]: stz +Out[45]: +0 2013-01-01 09:10:12-05:00 +1 2013-01-02 09:10:12-05:00 +2 2013-01-03 09:10:12-05:00 +3 2013-01-04 09:10:12-05:00 +Length: 4, dtype: datetime64[ns, US/Eastern] + +In [46]: stz.dt.tz +Out[46]: +``` + +You can also chain these types of operations: + +```None +In [47]: s.dt.tz_localize('UTC').dt.tz_convert('US/Eastern') +Out[47]: +0 2013-01-01 04:10:12-05:00 +1 2013-01-02 04:10:12-05:00 +2 2013-01-03 04:10:12-05:00 +3 2013-01-04 04:10:12-05:00 +Length: 4, dtype: datetime64[ns, US/Eastern] +``` + +The `.dt` accessor works for period and timedelta dtypes. + +```None +# period +In [48]: s = pd.Series(pd.period_range('20130101', periods=4, freq='D')) + +In [49]: s +Out[49]: +0 2013-01-01 +1 2013-01-02 +2 2013-01-03 +3 2013-01-04 +Length: 4, dtype: period[D] + +In [50]: s.dt.year +Out[50]: +0 2013 +1 2013 +2 2013 +3 2013 +Length: 4, dtype: int64 + +In [51]: s.dt.day +Out[51]: +0 1 +1 2 +2 3 +3 4 +Length: 4, dtype: int64 +``` + +```None +# timedelta +In [52]: s = pd.Series(pd.timedelta_range('1 day 00:00:05', periods=4, freq='s')) + +In [53]: s +Out[53]: +0 1 days 00:00:05 +1 1 days 00:00:06 +2 1 days 00:00:07 +3 1 days 00:00:08 +Length: 4, dtype: timedelta64[ns] + +In [54]: s.dt.days +Out[54]: +0 1 +1 1 +2 1 +3 1 +Length: 4, dtype: int64 + +In [55]: s.dt.seconds +Out[55]: +0 5 +1 6 +2 7 +3 8 +Length: 4, dtype: int32 + +In [56]: s.dt.components +Out[56]: + days hours minutes seconds milliseconds microseconds nanoseconds +0 1 0 0 5 0 0 0 +1 1 0 0 6 0 0 0 +2 1 0 0 7 0 0 0 +3 1 0 0 8 0 0 0 + +[4 rows x 7 columns] +``` + +### Timezone handling improvements[#](#timezone-handling-improvements "Link to this heading") + +* `tz_localize(None)` for tz-aware `Timestamp` and `DatetimeIndex` now removes timezone holding local time, + previously this resulted in `Exception` or `TypeError` ([GH 7812](https://github.com/pandas-dev/pandas/issues/7812)) + + ```None + In [58]: ts = pd.Timestamp('2014-08-01 09:00', tz='US/Eastern') + + In[59]: ts + Out[59]: Timestamp('2014-08-01 09:00:00-0400', tz='US/Eastern') + + In [60]: ts.tz_localize(None) + Out[60]: Timestamp('2014-08-01 09:00:00') + + In [61]: didx = pd.date_range(start='2014-08-01 09:00', freq='H', + ....: periods=10, tz='US/Eastern') + ....: + + In [62]: didx + Out[62]: + DatetimeIndex(['2014-08-01 09:00:00-04:00', '2014-08-01 10:00:00-04:00', + '2014-08-01 11:00:00-04:00', '2014-08-01 12:00:00-04:00', + '2014-08-01 13:00:00-04:00', '2014-08-01 14:00:00-04:00', + '2014-08-01 15:00:00-04:00', '2014-08-01 16:00:00-04:00', + '2014-08-01 17:00:00-04:00', '2014-08-01 18:00:00-04:00'], + dtype='datetime64[ns, US/Eastern]', freq='H') + + In [63]: didx.tz_localize(None) + Out[63]: + DatetimeIndex(['2014-08-01 09:00:00', '2014-08-01 10:00:00', + '2014-08-01 11:00:00', '2014-08-01 12:00:00', + '2014-08-01 13:00:00', '2014-08-01 14:00:00', + '2014-08-01 15:00:00', '2014-08-01 16:00:00', + '2014-08-01 17:00:00', '2014-08-01 18:00:00'], + dtype='datetime64[ns]', freq=None) + ``` +* `tz_localize` now accepts the `ambiguous` keyword which allows for passing an array of bools + indicating whether the date belongs in DST or not, ‘NaT’ for setting transition times to NaT, + ‘infer’ for inferring DST/non-DST, and ‘raise’ (default) for an `AmbiguousTimeError` to be raised. See [the docs](../user_guide/timeseries.html#timeseries-timezone-ambiguous) for more details ([GH 7943](https://github.com/pandas-dev/pandas/issues/7943)) +* `DataFrame.tz_localize` and `DataFrame.tz_convert` now accepts an optional `level` argument + for localizing a specific level of a MultiIndex ([GH 7846](https://github.com/pandas-dev/pandas/issues/7846)) +* `Timestamp.tz_localize` and `Timestamp.tz_convert` now raise `TypeError` in error cases, rather than `Exception` ([GH 8025](https://github.com/pandas-dev/pandas/issues/8025)) +* a timeseries/index localized to UTC when inserted into a Series/DataFrame will preserve the UTC timezone (rather than being a naive `datetime64[ns]`) as `object` dtype ([GH 8411](https://github.com/pandas-dev/pandas/issues/8411)) +* `Timestamp.__repr__` displays `dateutil.tz.tzoffset` info ([GH 7907](https://github.com/pandas-dev/pandas/issues/7907)) + +### Rolling/expanding moments improvements[#](#rolling-expanding-moments-improvements "Link to this heading") + +* `rolling_min()`, `rolling_max()`, `rolling_cov()`, and `rolling_corr()` + now return objects with all `NaN` when `len(arg) < min_periods <= window` rather + than raising. (This makes all rolling functions consistent in this behavior). ([GH 7766](https://github.com/pandas-dev/pandas/issues/7766)) + + Prior to 0.15.0 + + ```None + In [57]: s = pd.Series([10, 11, 12, 13]) + ``` + + ```None + In [15]: pd.rolling_min(s, window=10, min_periods=5) + ValueError: min_periods (5) must be <= window (4) + ``` + + New behavior + + ```None + In [4]: pd.rolling_min(s, window=10, min_periods=5) + Out[4]: + 0 NaN + 1 NaN + 2 NaN + 3 NaN + dtype: float64 + ``` +* `rolling_max()`, `rolling_min()`, `rolling_sum()`, `rolling_mean()`, `rolling_median()`, + `rolling_std()`, `rolling_var()`, `rolling_skew()`, `rolling_kurt()`, `rolling_quantile()`, + `rolling_cov()`, `rolling_corr()`, `rolling_corr_pairwise()`, + `rolling_window()`, and `rolling_apply()` with `center=True` previously would return a result of the same + structure as the input `arg` with `NaN` in the final `(window-1)/2` entries. + + Now the final `(window-1)/2` entries of the result are calculated as if the input `arg` were followed + by `(window-1)/2` `NaN` values (or with shrinking windows, in the case of `rolling_apply()`). + ([GH 7925](https://github.com/pandas-dev/pandas/issues/7925), [GH 8269](https://github.com/pandas-dev/pandas/issues/8269)) + + Prior behavior (note final value is `NaN`): + + ```None + In [7]: pd.rolling_sum(Series(range(4)), window=3, min_periods=0, center=True) + Out[7]: + 0 1 + 1 3 + 2 6 + 3 NaN + dtype: float64 + ``` + + New behavior (note final value is `5 = sum([2, 3, NaN])`): + + ```None + In [7]: pd.rolling_sum(pd.Series(range(4)), window=3, + ....: min_periods=0, center=True) + Out[7]: + 0 1 + 1 3 + 2 6 + 3 5 + dtype: float64 + ``` +* `rolling_window()` now normalizes the weights properly in rolling mean mode (mean=True) so that + the calculated weighted means (e.g. ‘triang’, ‘gaussian’) are distributed about the same means as those + calculated without weighting (i.e. ‘boxcar’). See [the note on normalization](../user_guide/window.html#window-weighted) for further details. ([GH 7618](https://github.com/pandas-dev/pandas/issues/7618)) + + ```None + In [58]: s = pd.Series([10.5, 8.8, 11.4, 9.7, 9.3]) + ``` + + Behavior prior to 0.15.0: + + ```None + In [39]: pd.rolling_window(s, window=3, win_type='triang', center=True) + Out[39]: + 0 NaN + 1 6.583333 + 2 6.883333 + 3 6.683333 + 4 NaN + dtype: float64 + ``` + + New behavior + + ```None + In [10]: pd.rolling_window(s, window=3, win_type='triang', center=True) + Out[10]: + 0 NaN + 1 9.875 + 2 10.325 + 3 10.025 + 4 NaN + dtype: float64 + ``` +* Removed `center` argument from all `expanding_` functions (see [list](../reference/window.html#api-functions-expanding)), + as the results produced when `center=True` did not make much sense. ([GH 7925](https://github.com/pandas-dev/pandas/issues/7925)) +* Added optional `ddof` argument to `expanding_cov()` and `rolling_cov()`. + The default value of `1` is backwards-compatible. ([GH 8279](https://github.com/pandas-dev/pandas/issues/8279)) +* Documented the `ddof` argument to `expanding_var()`, `expanding_std()`, + `rolling_var()`, and `rolling_std()`. These functions’ support of a + `ddof` argument (with a default value of `1`) was previously undocumented. ([GH 8064](https://github.com/pandas-dev/pandas/issues/8064)) +* `ewma()`, `ewmstd()`, `ewmvol()`, `ewmvar()`, `ewmcov()`, and `ewmcorr()` + now interpret `min_periods` in the same manner that the `rolling_*()` and `expanding_*()` functions do: + a given result entry will be `NaN` if the (expanding, in this case) window does not contain + at least `min_periods` values. The previous behavior was to set to `NaN` the `min_periods` entries + starting with the first non- `NaN` value. ([GH 7977](https://github.com/pandas-dev/pandas/issues/7977)) + + Prior behavior (note values start at index `2`, which is `min_periods` after index `0` + (the index of the first non-empty value)): + + ```None + In [59]: s = pd.Series([1, None, None, None, 2, 3]) + ``` + + ```None + In [51]: pd.ewma(s, com=3., min_periods=2) + Out[51]: + 0 NaN + 1 NaN + 2 1.000000 + 3 1.000000 + 4 1.571429 + 5 2.189189 + dtype: float64 + ``` + + New behavior (note values start at index `4`, the location of the 2nd (since `min_periods=2`) non-empty value): + + ```None + In [2]: pd.ewma(s, com=3., min_periods=2) + Out[2]: + 0 NaN + 1 NaN + 2 NaN + 3 NaN + 4 1.759644 + 5 2.383784 + dtype: float64 + ``` +* `ewmstd()`, `ewmvol()`, `ewmvar()`, `ewmcov()`, and `ewmcorr()` + now have an optional `adjust` argument, just like `ewma()` does, + affecting how the weights are calculated. + The default value of `adjust` is `True`, which is backwards-compatible. + See [Exponentially weighted moment functions](../user_guide/window.html#window-exponentially-weighted) for details. ([GH 7911](https://github.com/pandas-dev/pandas/issues/7911)) +* `ewma()`, `ewmstd()`, `ewmvol()`, `ewmvar()`, `ewmcov()`, and `ewmcorr()` + now have an optional `ignore_na` argument. + When `ignore_na=False` (the default), missing values are taken into account in the weights calculation. + When `ignore_na=True` (which reproduces the pre-0.15.0 behavior), missing values are ignored in the weights calculation. + ([GH 7543](https://github.com/pandas-dev/pandas/issues/7543)) + + ```None + In [7]: pd.ewma(pd.Series([None, 1., 8.]), com=2.) + Out[7]: + 0 NaN + 1 1.0 + 2 5.2 + dtype: float64 + + In [8]: pd.ewma(pd.Series([1., None, 8.]), com=2., + ....: ignore_na=True) # pre-0.15.0 behavior + Out[8]: + 0 1.0 + 1 1.0 + 2 5.2 + dtype: float64 + + In [9]: pd.ewma(pd.Series([1., None, 8.]), com=2., + ....: ignore_na=False) # new default + Out[9]: + 0 1.000000 + 1 1.000000 + 2 5.846154 + dtype: float64 + ``` + + Warning + + By default (`ignore_na=False`) the `ewm*()` functions’ weights calculation + in the presence of missing values is different than in pre-0.15.0 versions. + To reproduce the pre-0.15.0 calculation of weights in the presence of missing values + one must specify explicitly `ignore_na=True`. +* Bug in `expanding_cov()`, `expanding_corr()`, `rolling_cov()`, `rolling_cor()`, `ewmcov()`, and `ewmcorr()` + returning results with columns sorted by name and producing an error for non-unique columns; + now handles non-unique columns and returns columns in original order + (except for the case of two DataFrames with `pairwise=False`, where behavior is unchanged) ([GH 7542](https://github.com/pandas-dev/pandas/issues/7542)) +* Bug in `rolling_count()` and `expanding_*()` functions unnecessarily producing error message for zero-length data ([GH 8056](https://github.com/pandas-dev/pandas/issues/8056)) +* Bug in `rolling_apply()` and `expanding_apply()` interpreting `min_periods=0` as `min_periods=1` ([GH 8080](https://github.com/pandas-dev/pandas/issues/8080)) +* Bug in `expanding_std()` and `expanding_var()` for a single value producing a confusing error message ([GH 7900](https://github.com/pandas-dev/pandas/issues/7900)) +* Bug in `rolling_std()` and `rolling_var()` for a single value producing `0` rather than `NaN` ([GH 7900](https://github.com/pandas-dev/pandas/issues/7900)) +* Bug in `ewmstd()`, `ewmvol()`, `ewmvar()`, and `ewmcov()` + calculation of de-biasing factors when `bias=False` (the default). + Previously an incorrect constant factor was used, based on `adjust=True`, `ignore_na=True`, + and an infinite number of observations. + Now a different factor is used for each entry, based on the actual weights + (analogous to the usual `N/(N-1)` factor). + In particular, for a single point a value of `NaN` is returned when `bias=False`, + whereas previously a value of (approximately) `0` was returned. + + For example, consider the following pre-0.15.0 results for `ewmvar(..., bias=False)`, + and the corresponding debiasing factors: + + ```None + In [60]: s = pd.Series([1., 2., 0., 4.]) + ``` + + ```None + In [89]: pd.ewmvar(s, com=2., bias=False) + Out[89]: + 0 -2.775558e-16 + 1 3.000000e-01 + 2 9.556787e-01 + 3 3.585799e+00 + dtype: float64 + + In [90]: pd.ewmvar(s, com=2., bias=False) / pd.ewmvar(s, com=2., bias=True) + Out[90]: + 0 1.25 + 1 1.25 + 2 1.25 + 3 1.25 + dtype: float64 + ``` + + Note that entry `0` is approximately 0, and the debiasing factors are a constant 1.25. + By comparison, the following 0.15.0 results have a `NaN` for entry `0`, + and the debiasing factors are decreasing (towards 1.25): + + ```None + In [14]: pd.ewmvar(s, com=2., bias=False) + Out[14]: + 0 NaN + 1 0.500000 + 2 1.210526 + 3 4.089069 + dtype: float64 + + In [15]: pd.ewmvar(s, com=2., bias=False) / pd.ewmvar(s, com=2., bias=True) + Out[15]: + 0 NaN + 1 2.083333 + 2 1.583333 + 3 1.425439 + dtype: float64 + ``` + + See [Exponentially weighted moment functions](../user_guide/window.html#window-exponentially-weighted) for details. ([GH 7912](https://github.com/pandas-dev/pandas/issues/7912)) + +### Improvements in the SQL IO module[#](#improvements-in-the-sql-io-module "Link to this heading") + +* Added support for a `chunksize` parameter to `to_sql` function. This allows DataFrame to be written in chunks and avoid packet-size overflow errors ([GH 8062](https://github.com/pandas-dev/pandas/issues/8062)). +* Added support for a `chunksize` parameter to `read_sql` function. Specifying this argument will return an iterator through chunks of the query result ([GH 2908](https://github.com/pandas-dev/pandas/issues/2908)). +* Added support for writing `datetime.date` and `datetime.time` object columns with `to_sql` ([GH 6932](https://github.com/pandas-dev/pandas/issues/6932)). +* Added support for specifying a `schema` to read from/write to with `read_sql_table` and `to_sql` ([GH 7441](https://github.com/pandas-dev/pandas/issues/7441), [GH 7952](https://github.com/pandas-dev/pandas/issues/7952)). + For example: + + ```None + df.to_sql('table', engine, schema='other_schema') # noqa F821 + pd.read_sql_table('table', engine, schema='other_schema') # noqa F821 + ``` +* Added support for writing `NaN` values with `to_sql` ([GH 2754](https://github.com/pandas-dev/pandas/issues/2754)). +* Added support for writing datetime64 columns with `to_sql` for all database flavors ([GH 7103](https://github.com/pandas-dev/pandas/issues/7103)). + +## Backwards incompatible API changes[#](#backwards-incompatible-api-changes "Link to this heading") + +### Breaking changes[#](#breaking-changes "Link to this heading") + +API changes related to `Categorical` (see [here](#whatsnew-0150-cat) +for more details): + +* The `Categorical` constructor with two arguments changed from + “codes/labels and levels” to “values and levels (now called ‘categories’)”. + This can lead to subtle bugs. If you use [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") directly, + please audit your code by changing it to use the [`from_codes()`](../reference/api/pandas.Categorical.from_codes.html#pandas.Categorical.from_codes "pandas.Categorical.from_codes") + constructor. + + An old function call like (prior to 0.15.0): + + ```None + pd.Categorical([0,1,0,2,1], levels=['a', 'b', 'c']) + ``` + + will have to adapted to the following to keep the same behaviour: + + ```None + In [2]: pd.Categorical.from_codes([0,1,0,2,1], categories=['a', 'b', 'c']) + Out[2]: + [a, b, a, c, b] + Categories (3, object): [a, b, c] + ``` + +API changes related to the introduction of the `Timedelta` scalar (see +[above](#whatsnew-0150-timedeltaindex) for more details): + +* Prior to 0.15.0 [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta") would return a `Series` for list-like/Series input, + and a `np.timedelta64` for scalar input. It will now return a `TimedeltaIndex` for + list-like input, `Series` for Series input, and `Timedelta` for scalar input. + +For API changes related to the rolling and expanding functions, see detailed overview [above](#whatsnew-0150-roll). + +Other notable API changes: + +* Consistency when indexing with `.loc` and a list-like indexer when no values are found. + + ```None + In [61]: df = pd.DataFrame([['a'], ['b']], index=[1, 2]) + + In [62]: df + Out[62]: + 0 + 1 a + 2 b + + [2 rows x 1 columns] + ``` + + In prior versions there was a difference in these two constructs: + + + `df.loc[[3]]` would return a frame reindexed by 3 (with all `np.nan` values) + + `df.loc[[3],:]` would raise `KeyError`. + + Both will now raise a `KeyError`. The rule is that *at least 1* indexer must be found when using a list-like and `.loc` ([GH 7999](https://github.com/pandas-dev/pandas/issues/7999)) + + Furthermore in prior versions these were also different: + + + `df.loc[[1,3]]` would return a frame reindexed by [1,3] + + `df.loc[[1,3],:]` would raise `KeyError`. + + Both will now return a frame reindex by [1,3]. E.g. + + ```None + In [3]: df.loc[[1, 3]] + Out[3]: + 0 + 1 a + 3 NaN + + In [4]: df.loc[[1, 3], :] + Out[4]: + 0 + 1 a + 3 NaN + ``` + + This can also be seen in multi-axis indexing with a `Panel`. + + ```None + >>> p = pd.Panel(np.arange(2 * 3 * 4).reshape(2, 3, 4), + ... items=['ItemA', 'ItemB'], + ... major_axis=[1, 2, 3], + ... minor_axis=['A', 'B', 'C', 'D']) + >>> p + + Dimensions: 2 (items) x 3 (major_axis) x 4 (minor_axis) + Items axis: ItemA to ItemB + Major_axis axis: 1 to 3 + Minor_axis axis: A to D + ``` + + The following would raise `KeyError` prior to 0.15.0: + + ```None + In [5]: + Out[5]: + ItemA ItemD + 1 3 NaN + 2 7 NaN + 3 11 NaN + ``` + + Furthermore, `.loc` will raise If no values are found in a MultiIndex with a list-like indexer: + + ```None + In [63]: s = pd.Series(np.arange(3, dtype='int64'), + ....: index=pd.MultiIndex.from_product([['A'], + ....: ['foo', 'bar', 'baz']], + ....: names=['one', 'two']) + ....: ).sort_index() + ....: + + In [64]: s + Out[64]: + one two + A bar 1 + baz 2 + foo 0 + Length: 3, dtype: int64 + + In [65]: try: + ....: s.loc[['D']] + ....: except KeyError as e: + ....: print("KeyError: " + str(e)) + ....: + KeyError: "['D'] not in index" + ``` +* Assigning values to `None` now considers the dtype when choosing an ‘empty’ value ([GH 7941](https://github.com/pandas-dev/pandas/issues/7941)). + + Previously, assigning to `None` in numeric containers changed the + dtype to object (or errored, depending on the call). It now uses + `NaN`: + + ```None + In [66]: s = pd.Series([1., 2., 3.]) + + In [67]: s.loc[0] = None + + In [68]: s + Out[68]: + 0 NaN + 1 2.0 + 2 3.0 + Length: 3, dtype: float64 + ``` + + `NaT` is now used similarly for datetime containers. + + For object containers, we now preserve `None` values (previously these + were converted to `NaN` values). + + ```None + In [69]: s = pd.Series(["a", "b", "c"]) + + In [70]: s.loc[0] = None + + In [71]: s + Out[71]: + 0 None + 1 b + 2 c + Length: 3, dtype: object + ``` + + To insert a `NaN`, you must explicitly use `np.nan`. See the [docs](../user_guide/missing_data.html#missing-inserting). +* In prior versions, updating a pandas object inplace would not reflect in other python references to this object. ([GH 8511](https://github.com/pandas-dev/pandas/issues/8511), [GH 5104](https://github.com/pandas-dev/pandas/issues/5104)) + + ```None + In [72]: s = pd.Series([1, 2, 3]) + + In [73]: s2 = s + + In [74]: s += 1.5 + ``` + + Behavior prior to v0.15.0 + + ```None + # the original object + In [5]: s + Out[5]: + 0 2.5 + 1 3.5 + 2 4.5 + dtype: float64 + + + # a reference to the original object + In [7]: s2 + Out[7]: + 0 1 + 1 2 + 2 3 + dtype: int64 + ``` + + This is now the correct behavior + + ```None + # the original object + In [75]: s + Out[75]: + 0 2.5 + 1 3.5 + 2 4.5 + Length: 3, dtype: float64 + + # a reference to the original object + In [76]: s2 + Out[76]: + 0 2.5 + 1 3.5 + 2 4.5 + Length: 3, dtype: float64 + ``` + +* Made both the C-based and Python engines for `read_csv` and `read_table` ignore empty lines in input as well as + white space-filled lines, as long as `sep` is not white space. This is an API change + that can be controlled by the keyword parameter `skip_blank_lines`. See [the docs](../user_guide/io.html#io-skiplines) ([GH 4466](https://github.com/pandas-dev/pandas/issues/4466)) +* A timeseries/index localized to UTC when inserted into a Series/DataFrame will preserve the UTC timezone + and inserted as `object` dtype rather than being converted to a naive `datetime64[ns]` ([GH 8411](https://github.com/pandas-dev/pandas/issues/8411)). +* Bug in passing a `DatetimeIndex` with a timezone that was not being retained in DataFrame construction from a dict ([GH 7822](https://github.com/pandas-dev/pandas/issues/7822)) + + In prior versions this would drop the timezone, now it retains the timezone, + but gives a column of `object` dtype: + + ```None + In [77]: i = pd.date_range('1/1/2011', periods=3, freq='10s', tz='US/Eastern') + + In [78]: i + Out[78]: + DatetimeIndex(['2011-01-01 00:00:00-05:00', '2011-01-01 00:00:10-05:00', + '2011-01-01 00:00:20-05:00'], + dtype='datetime64[ns, US/Eastern]', freq='10s') + + In [79]: df = pd.DataFrame({'a': i}) + + In [80]: df + Out[80]: + a + 0 2011-01-01 00:00:00-05:00 + 1 2011-01-01 00:00:10-05:00 + 2 2011-01-01 00:00:20-05:00 + + [3 rows x 1 columns] + + In [81]: df.dtypes + Out[81]: + a datetime64[ns, US/Eastern] + Length: 1, dtype: object + ``` + + Previously this would have yielded a column of `datetime64` dtype, but without timezone info. + + The behaviour of assigning a column to an existing dataframe as `df['a'] = i` + remains unchanged (this already returned an `object` column with a timezone). +* When passing multiple levels to [`stack()`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack"), it will now raise a `ValueError` when the + levels aren’t all level names or all level numbers ([GH 7660](https://github.com/pandas-dev/pandas/issues/7660)). See + [Reshaping by stacking and unstacking](../user_guide/reshaping.html#reshaping-stack-multiple). +* Raise a `ValueError` in `df.to_hdf` with ‘fixed’ format, if `df` has non-unique columns as the resulting file will be broken ([GH 7761](https://github.com/pandas-dev/pandas/issues/7761)) +* `SettingWithCopy` raise/warnings (according to the option `mode.chained_assignment`) will now be issued when setting a value on a sliced mixed-dtype DataFrame using chained-assignment. ([GH 7845](https://github.com/pandas-dev/pandas/issues/7845), [GH 7950](https://github.com/pandas-dev/pandas/issues/7950)) + + ```None + In [1]: df = pd.DataFrame(np.arange(0, 9), columns=['count']) + + In [2]: df['group'] = 'b' + + In [3]: df.iloc[0:5]['group'] = 'a' + /usr/local/bin/ipython:1: SettingWithCopyWarning: + A value is trying to be set on a copy of a slice from a DataFrame. + Try using .loc[row_indexer,col_indexer] = value instead + + See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy + ``` +* `merge`, `DataFrame.merge`, and `ordered_merge` now return the same type + as the `left` argument ([GH 7737](https://github.com/pandas-dev/pandas/issues/7737)). +* Previously an enlargement with a mixed-dtype frame would act unlike `.append` which will preserve dtypes (related [GH 2578](https://github.com/pandas-dev/pandas/issues/2578), [GH 8176](https://github.com/pandas-dev/pandas/issues/8176)): + + ```None + In [82]: df = pd.DataFrame([[True, 1], [False, 2]], + ....: columns=["female", "fitness"]) + ....: + + In [83]: df + Out[83]: + female fitness + 0 True 1 + 1 False 2 + + [2 rows x 2 columns] + + In [84]: df.dtypes + Out[84]: + female bool + fitness int64 + Length: 2, dtype: object + + # dtypes are now preserved + In [85]: df.loc[2] = df.loc[1] + + In [86]: df + Out[86]: + female fitness + 0 True 1 + 1 False 2 + 2 False 2 + + [3 rows x 2 columns] + + In [87]: df.dtypes + Out[87]: + female bool + fitness int64 + Length: 2, dtype: object + ``` +* `Series.to_csv()` now returns a string when `path=None`, matching the behaviour of `DataFrame.to_csv()` ([GH 8215](https://github.com/pandas-dev/pandas/issues/8215)). +* `read_hdf` now raises `IOError` when a file that doesn’t exist is passed in. Previously, a new, empty file was created, and a `KeyError` raised ([GH 7715](https://github.com/pandas-dev/pandas/issues/7715)). +* `DataFrame.info()` now ends its output with a newline character ([GH 8114](https://github.com/pandas-dev/pandas/issues/8114)) +* Concatenating no objects will now raise a `ValueError` rather than a bare `Exception`. +* Merge errors will now be sub-classes of `ValueError` rather than raw `Exception` ([GH 8501](https://github.com/pandas-dev/pandas/issues/8501)) +* `DataFrame.plot` and `Series.plot` keywords are now have consistent orders ([GH 8037](https://github.com/pandas-dev/pandas/issues/8037)) + +### Internal refactoring[#](#internal-refactoring "Link to this heading") + +In 0.15.0 `Index` has internally been refactored to no longer sub-class `ndarray` +but instead subclass `PandasObject`, similarly to the rest of the pandas objects. This +change allows very easy sub-classing and creation of new index types. This should be +a transparent change with only very limited API implications ([GH 5080](https://github.com/pandas-dev/pandas/issues/5080), [GH 7439](https://github.com/pandas-dev/pandas/issues/7439), [GH 7796](https://github.com/pandas-dev/pandas/issues/7796), [GH 8024](https://github.com/pandas-dev/pandas/issues/8024), [GH 8367](https://github.com/pandas-dev/pandas/issues/8367), [GH 7997](https://github.com/pandas-dev/pandas/issues/7997), [GH 8522](https://github.com/pandas-dev/pandas/issues/8522)): + +* you may need to unpickle pandas version < 0.15.0 pickles using `pd.read_pickle` rather than `pickle.load`. See [pickle docs](../user_guide/io.html#io-pickle) +* when plotting with a `PeriodIndex`, the matplotlib internal axes will now be arrays of `Period` rather than a `PeriodIndex` (this is similar to how a `DatetimeIndex` passes arrays of `datetimes` now) +* MultiIndexes will now raise similarly to other pandas objects w.r.t. truth testing, see [here](../user_guide/gotchas.html#gotchas-truth) ([GH 7897](https://github.com/pandas-dev/pandas/issues/7897)). +* When plotting a DatetimeIndex directly with matplotlib’s `plot` function, + the axis labels will no longer be formatted as dates but as integers (the + internal representation of a `datetime64`). **UPDATE** This is fixed + in 0.15.1, see [here](v0.15.1.html#whatsnew-0151-datetime64-plotting). + +### Deprecations[#](#deprecations "Link to this heading") + +* The attributes `Categorical` `labels` and `levels` attributes are + deprecated and renamed to `codes` and `categories`. +* The `outtype` argument to `pd.DataFrame.to_dict` has been deprecated in favor of `orient`. ([GH 7840](https://github.com/pandas-dev/pandas/issues/7840)) +* The `convert_dummies` method has been deprecated in favor of + `get_dummies` ([GH 8140](https://github.com/pandas-dev/pandas/issues/8140)) +* The `infer_dst` argument in `tz_localize` will be deprecated in favor of + `ambiguous` to allow for more flexibility in dealing with DST transitions. + Replace `infer_dst=True` with `ambiguous='infer'` for the same behavior ([GH 7943](https://github.com/pandas-dev/pandas/issues/7943)). + See [the docs](../user_guide/timeseries.html#timeseries-timezone-ambiguous) for more details. +* The top-level `pd.value_range` has been deprecated and can be replaced by `.describe()` ([GH 8481](https://github.com/pandas-dev/pandas/issues/8481)) + +* The `Index` set operations `+` and `-` were deprecated in order to provide these for numeric type operations on certain index types. `+` can be replaced by `.union()` or `|`, and `-` by `.difference()`. Further the method name `Index.diff()` is deprecated and can be replaced by `Index.difference()` ([GH 8226](https://github.com/pandas-dev/pandas/issues/8226)) + + ```None + # + + pd.Index(['a', 'b', 'c']) + pd.Index(['b', 'c', 'd']) + + # should be replaced by + pd.Index(['a', 'b', 'c']).union(pd.Index(['b', 'c', 'd'])) + ``` + + ```None + # - + pd.Index(['a', 'b', 'c']) - pd.Index(['b', 'c', 'd']) + + # should be replaced by + pd.Index(['a', 'b', 'c']).difference(pd.Index(['b', 'c', 'd'])) + ``` +* The `infer_types` argument to [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") now has no + effect and is deprecated ([GH 7762](https://github.com/pandas-dev/pandas/issues/7762), [GH 7032](https://github.com/pandas-dev/pandas/issues/7032)). + +### Removal of prior version deprecations/changes[#](#removal-of-prior-version-deprecations-changes "Link to this heading") + +* Remove `DataFrame.delevel` method in favor of `DataFrame.reset_index` + +## Enhancements[#](#enhancements "Link to this heading") + +Enhancements in the importing/exporting of Stata files: + +* Added support for bool, uint8, uint16 and uint32 data types in `to_stata` ([GH 7097](https://github.com/pandas-dev/pandas/issues/7097), [GH 7365](https://github.com/pandas-dev/pandas/issues/7365)) +* Added conversion option when importing Stata files ([GH 8527](https://github.com/pandas-dev/pandas/issues/8527)) +* `DataFrame.to_stata` and `StataWriter` check string length for + compatibility with limitations imposed in dta files where fixed-width + strings must contain 244 or fewer characters. Attempting to write Stata + dta files with strings longer than 244 characters raises a `ValueError`. ([GH 7858](https://github.com/pandas-dev/pandas/issues/7858)) +* `read_stata` and `StataReader` can import missing data information into a + `DataFrame` by setting the argument `convert_missing` to `True`. When + using this options, missing values are returned as `StataMissingValue` + objects and columns containing missing values have `object` data type. ([GH 8045](https://github.com/pandas-dev/pandas/issues/8045)) + +Enhancements in the plotting functions: + +* Added `layout` keyword to `DataFrame.plot`. You can pass a tuple of `(rows, columns)`, one of which can be `-1` to automatically infer ([GH 6667](https://github.com/pandas-dev/pandas/issues/6667), [GH 8071](https://github.com/pandas-dev/pandas/issues/8071)). +* Allow to pass multiple axes to `DataFrame.plot`, `hist` and `boxplot` ([GH 5353](https://github.com/pandas-dev/pandas/issues/5353), [GH 6970](https://github.com/pandas-dev/pandas/issues/6970), [GH 7069](https://github.com/pandas-dev/pandas/issues/7069)) +* Added support for `c`, `colormap` and `colorbar` arguments for `DataFrame.plot` with `kind='scatter'` ([GH 7780](https://github.com/pandas-dev/pandas/issues/7780)) +* Histogram from `DataFrame.plot` with `kind='hist'` ([GH 7809](https://github.com/pandas-dev/pandas/issues/7809)), See [the docs](../user_guide/visualization.html#visualization-hist). +* Boxplot from `DataFrame.plot` with `kind='box'` ([GH 7998](https://github.com/pandas-dev/pandas/issues/7998)), See [the docs](../user_guide/visualization.html#visualization-box). + +Other: + +* `read_csv` now has a keyword parameter `float_precision` which specifies which floating-point converter the C engine should use during parsing, see [here](../user_guide/io.html#io-float-precision) ([GH 8002](https://github.com/pandas-dev/pandas/issues/8002), [GH 8044](https://github.com/pandas-dev/pandas/issues/8044)) +* Added `searchsorted` method to `Series` objects ([GH 7447](https://github.com/pandas-dev/pandas/issues/7447)) +* `describe()` on mixed-types DataFrames is more flexible. Type-based column filtering is now possible via the `include`/`exclude` arguments. + See the [docs](../user_guide/basics.html#basics-describe) ([GH 8164](https://github.com/pandas-dev/pandas/issues/8164)). + + ```None + In [88]: df = pd.DataFrame({'catA': ['foo', 'foo', 'bar'] * 8, + ....: 'catB': ['a', 'b', 'c', 'd'] * 6, + ....: 'numC': np.arange(24), + ....: 'numD': np.arange(24.) + .5}) + ....: + + In [89]: df.describe(include=["object"]) + Out[89]: + catA catB + count 24 24 + unique 2 4 + top foo a + freq 16 6 + + [4 rows x 2 columns] + + In [90]: df.describe(include=["number", "object"], exclude=["float"]) + Out[90]: + catA catB numC + count 24 24 24.000000 + unique 2 4 NaN + top foo a NaN + freq 16 6 NaN + mean NaN NaN 11.500000 + std NaN NaN 7.071068 + min NaN NaN 0.000000 + 25% NaN NaN 5.750000 + 50% NaN NaN 11.500000 + 75% NaN NaN 17.250000 + max NaN NaN 23.000000 + + [11 rows x 3 columns] + ``` + + Requesting all columns is possible with the shorthand ‘all’ + + ```None + In [91]: df.describe(include='all') + Out[91]: + catA catB numC numD + count 24 24 24.000000 24.000000 + unique 2 4 NaN NaN + top foo a NaN NaN + freq 16 6 NaN NaN + mean NaN NaN 11.500000 12.000000 + std NaN NaN 7.071068 7.071068 + min NaN NaN 0.000000 0.500000 + 25% NaN NaN 5.750000 6.250000 + 50% NaN NaN 11.500000 12.000000 + 75% NaN NaN 17.250000 17.750000 + max NaN NaN 23.000000 23.500000 + + [11 rows x 4 columns] + ``` + + Without those arguments, `describe` will behave as before, including only numerical columns or, if none are, only categorical columns. See also the [docs](../user_guide/basics.html#basics-describe) +* Added `split` as an option to the `orient` argument in `pd.DataFrame.to_dict`. ([GH 7840](https://github.com/pandas-dev/pandas/issues/7840)) +* The `get_dummies` method can now be used on DataFrames. By default only + categorical columns are encoded as 0’s and 1’s, while other columns are + left untouched. + + ```None + In [92]: df = pd.DataFrame({'A': ['a', 'b', 'a'], 'B': ['c', 'c', 'b'], + ....: 'C': [1, 2, 3]}) + ....: + + In [93]: pd.get_dummies(df) + Out[93]: + C A_a A_b B_b B_c + 0 1 True False False True + 1 2 False True False True + 2 3 True False True False + + [3 rows x 5 columns] + ``` +* `PeriodIndex` supports `resolution` as the same as `DatetimeIndex` ([GH 7708](https://github.com/pandas-dev/pandas/issues/7708)) +* `pandas.tseries.holiday` has added support for additional holidays and ways to observe holidays ([GH 7070](https://github.com/pandas-dev/pandas/issues/7070)) +* `pandas.tseries.holiday.Holiday` now supports a list of offsets in Python3 ([GH 7070](https://github.com/pandas-dev/pandas/issues/7070)) +* `pandas.tseries.holiday.Holiday` now supports a days\_of\_week parameter ([GH 7070](https://github.com/pandas-dev/pandas/issues/7070)) +* `GroupBy.nth()` now supports selecting multiple nth values ([GH 7910](https://github.com/pandas-dev/pandas/issues/7910)) + + ```None + In [94]: business_dates = pd.date_range(start='4/1/2014', end='6/30/2014', freq='B') + + In [95]: df = pd.DataFrame(1, index=business_dates, columns=['a', 'b']) + + # get the first, 4th, and last date index for each month + In [96]: df.groupby([df.index.year, df.index.month]).nth([0, 3, -1]) + Out[96]: + a b + 2014-04-01 1 1 + 2014-04-04 1 1 + 2014-04-30 1 1 + 2014-05-01 1 1 + 2014-05-06 1 1 + 2014-05-30 1 1 + 2014-06-02 1 1 + 2014-06-05 1 1 + 2014-06-30 1 1 + + [9 rows x 2 columns] + ``` +* `Period` and `PeriodIndex` supports addition/subtraction with `timedelta`-likes ([GH 7966](https://github.com/pandas-dev/pandas/issues/7966)) + + If `Period` freq is `D`, `H`, `T`, `S`, `L`, `U`, `N`, `Timedelta`-like can be added if the result can have same freq. Otherwise, only the same `offsets` can be added. + + ```None + In [104]: idx = pd.period_range('2014-07-01 09:00', periods=5, freq='H') + + In [105]: idx + Out[105]: + PeriodIndex(['2014-07-01 09:00', '2014-07-01 10:00', '2014-07-01 11:00', + '2014-07-01 12:00', '2014-07-01 13:00'], + dtype='period[H]') + + In [106]: idx + pd.offsets.Hour(2) + Out[106]: + PeriodIndex(['2014-07-01 11:00', '2014-07-01 12:00', '2014-07-01 13:00', + '2014-07-01 14:00', '2014-07-01 15:00'], + dtype='period[H]') + + In [107]: idx + pd.Timedelta('120m') + Out[107]: + PeriodIndex(['2014-07-01 11:00', '2014-07-01 12:00', '2014-07-01 13:00', + '2014-07-01 14:00', '2014-07-01 15:00'], + dtype='period[H]') + + In [108]: idx = pd.period_range('2014-07', periods=5, freq='M') + + In [109]: idx + Out[109]: PeriodIndex(['2014-07', '2014-08', '2014-09', '2014-10', '2014-11'], dtype='period[M]') + + In [110]: idx + pd.offsets.MonthEnd(3) + Out[110]: PeriodIndex(['2014-10', '2014-11', '2014-12', '2015-01', '2015-02'], dtype='period[M]') + ``` +* Added experimental compatibility with `openpyxl` for versions >= 2.0. The `DataFrame.to_excel` + method `engine` keyword now recognizes `openpyxl1` and `openpyxl2` + which will explicitly require openpyxl v1 and v2 respectively, failing if + the requested version is not available. The `openpyxl` engine is a now a + meta-engine that automatically uses whichever version of openpyxl is + installed. ([GH 7177](https://github.com/pandas-dev/pandas/issues/7177)) +* `DataFrame.fillna` can now accept a `DataFrame` as a fill value ([GH 8377](https://github.com/pandas-dev/pandas/issues/8377)) +* Passing multiple levels to [`stack()`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack") will now work when multiple level + numbers are passed ([GH 7660](https://github.com/pandas-dev/pandas/issues/7660)). See + [Reshaping by stacking and unstacking](../user_guide/reshaping.html#reshaping-stack-multiple). +* `set_names()`, `set_labels()`, and `set_levels()` methods now take an optional `level` keyword argument to all modification of specific level(s) of a MultiIndex. Additionally `set_names()` now accepts a scalar string value when operating on an `Index` or on a specific level of a `MultiIndex` ([GH 7792](https://github.com/pandas-dev/pandas/issues/7792)) + + ```None + In [97]: idx = pd.MultiIndex.from_product([['a'], range(3), list("pqr")], + ....: names=['foo', 'bar', 'baz']) + ....: + + In [98]: idx.set_names('qux', level=0) + Out[98]: + MultiIndex([('a', 0, 'p'), + ('a', 0, 'q'), + ('a', 0, 'r'), + ('a', 1, 'p'), + ('a', 1, 'q'), + ('a', 1, 'r'), + ('a', 2, 'p'), + ('a', 2, 'q'), + ('a', 2, 'r')], + names=['qux', 'bar', 'baz']) + + In [99]: idx.set_names(['qux', 'corge'], level=[0, 1]) + Out[99]: + MultiIndex([('a', 0, 'p'), + ('a', 0, 'q'), + ('a', 0, 'r'), + ('a', 1, 'p'), + ('a', 1, 'q'), + ('a', 1, 'r'), + ('a', 2, 'p'), + ('a', 2, 'q'), + ('a', 2, 'r')], + names=['qux', 'corge', 'baz']) + + In [100]: idx.set_levels(['a', 'b', 'c'], level='bar') + Out[100]: + MultiIndex([('a', 'a', 'p'), + ('a', 'a', 'q'), + ('a', 'a', 'r'), + ('a', 'b', 'p'), + ('a', 'b', 'q'), + ('a', 'b', 'r'), + ('a', 'c', 'p'), + ('a', 'c', 'q'), + ('a', 'c', 'r')], + names=['foo', 'bar', 'baz']) + + In [101]: idx.set_levels([['a', 'b', 'c'], [1, 2, 3]], level=[1, 2]) + Out[101]: + MultiIndex([('a', 'a', 1), + ('a', 'a', 2), + ('a', 'a', 3), + ('a', 'b', 1), + ('a', 'b', 2), + ('a', 'b', 3), + ('a', 'c', 1), + ('a', 'c', 2), + ('a', 'c', 3)], + names=['foo', 'bar', 'baz']) + ``` +* `Index.isin` now supports a `level` argument to specify which index level + to use for membership tests ([GH 7892](https://github.com/pandas-dev/pandas/issues/7892), [GH 7890](https://github.com/pandas-dev/pandas/issues/7890)) + + ```None + In [1]: idx = pd.MultiIndex.from_product([[0, 1], ['a', 'b', 'c']]) + + In [2]: idx.values + Out[2]: array([(0, 'a'), (0, 'b'), (0, 'c'), (1, 'a'), (1, 'b'), (1, 'c')], dtype=object) + + In [3]: idx.isin(['a', 'c', 'e'], level=1) + Out[3]: array([ True, False, True, True, False, True], dtype=bool) + ``` +* `Index` now supports `duplicated` and `drop_duplicates`. ([GH 4060](https://github.com/pandas-dev/pandas/issues/4060)) + + ```None + In [102]: idx = pd.Index([1, 2, 3, 4, 1, 2]) + + In [103]: idx + Out[103]: Index([1, 2, 3, 4, 1, 2], dtype='int64') + + In [104]: idx.duplicated() + Out[104]: array([False, False, False, False, True, True]) + + In [105]: idx.drop_duplicates() + Out[105]: Index([1, 2, 3, 4], dtype='int64') + ``` +* add `copy=True` argument to `pd.concat` to enable pass through of complete blocks ([GH 8252](https://github.com/pandas-dev/pandas/issues/8252)) +* Added support for numpy 1.8+ data types (`bool_`, `int_`, `float_`, `string_`) for conversion to R dataframe ([GH 8400](https://github.com/pandas-dev/pandas/issues/8400)) + +## Performance[#](#performance "Link to this heading") + +* Performance improvements in `DatetimeIndex.__iter__` to allow faster iteration ([GH 7683](https://github.com/pandas-dev/pandas/issues/7683)) +* Performance improvements in `Period` creation (and `PeriodIndex` setitem) ([GH 5155](https://github.com/pandas-dev/pandas/issues/5155)) +* Improvements in Series.transform for significant performance gains (revised) ([GH 6496](https://github.com/pandas-dev/pandas/issues/6496)) +* Performance improvements in `StataReader` when reading large files ([GH 8040](https://github.com/pandas-dev/pandas/issues/8040), [GH 8073](https://github.com/pandas-dev/pandas/issues/8073)) +* Performance improvements in `StataWriter` when writing large files ([GH 8079](https://github.com/pandas-dev/pandas/issues/8079)) +* Performance and memory usage improvements in multi-key `groupby` ([GH 8128](https://github.com/pandas-dev/pandas/issues/8128)) +* Performance improvements in groupby `.agg` and `.apply` where builtins max/min were not mapped to numpy/cythonized versions ([GH 7722](https://github.com/pandas-dev/pandas/issues/7722)) +* Performance improvement in writing to sql (`to_sql`) of up to 50% ([GH 8208](https://github.com/pandas-dev/pandas/issues/8208)). +* Performance benchmarking of groupby for large value of ngroups ([GH 6787](https://github.com/pandas-dev/pandas/issues/6787)) +* Performance improvement in `CustomBusinessDay`, `CustomBusinessMonth` ([GH 8236](https://github.com/pandas-dev/pandas/issues/8236)) +* Performance improvement for `MultiIndex.values` for multi-level indexes containing datetimes ([GH 8543](https://github.com/pandas-dev/pandas/issues/8543)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in pivot\_table, when using margins and a dict aggfunc ([GH 8349](https://github.com/pandas-dev/pandas/issues/8349)) +* Bug in `read_csv` where `squeeze=True` would return a view ([GH 8217](https://github.com/pandas-dev/pandas/issues/8217)) +* Bug in checking of table name in `read_sql` in certain cases ([GH 7826](https://github.com/pandas-dev/pandas/issues/7826)). +* Bug in `DataFrame.groupby` where `Grouper` does not recognize level when frequency is specified ([GH 7885](https://github.com/pandas-dev/pandas/issues/7885)) +* Bug in multiindexes dtypes getting mixed up when DataFrame is saved to SQL table ([GH 8021](https://github.com/pandas-dev/pandas/issues/8021)) +* Bug in `Series` 0-division with a float and integer operand dtypes ([GH 7785](https://github.com/pandas-dev/pandas/issues/7785)) +* Bug in `Series.astype("unicode")` not calling `unicode` on the values correctly ([GH 7758](https://github.com/pandas-dev/pandas/issues/7758)) +* Bug in `DataFrame.as_matrix()` with mixed `datetime64[ns]` and `timedelta64[ns]` dtypes ([GH 7778](https://github.com/pandas-dev/pandas/issues/7778)) +* Bug in `HDFStore.select_column()` not preserving UTC timezone info when selecting a `DatetimeIndex` ([GH 7777](https://github.com/pandas-dev/pandas/issues/7777)) +* Bug in `to_datetime` when `format='%Y%m%d'` and `coerce=True` are specified, where previously an object array was returned (rather than + a coerced time-series with `NaT`), ([GH 7930](https://github.com/pandas-dev/pandas/issues/7930)) +* Bug in `DatetimeIndex` and `PeriodIndex` in-place addition and subtraction cause different result from normal one ([GH 6527](https://github.com/pandas-dev/pandas/issues/6527)) +* Bug in adding and subtracting `PeriodIndex` with `PeriodIndex` raise `TypeError` ([GH 7741](https://github.com/pandas-dev/pandas/issues/7741)) +* Bug in `combine_first` with `PeriodIndex` data raises `TypeError` ([GH 3367](https://github.com/pandas-dev/pandas/issues/3367)) +* Bug in MultiIndex slicing with missing indexers ([GH 7866](https://github.com/pandas-dev/pandas/issues/7866)) +* Bug in MultiIndex slicing with various edge cases ([GH 8132](https://github.com/pandas-dev/pandas/issues/8132)) +* Regression in MultiIndex indexing with a non-scalar type object ([GH 7914](https://github.com/pandas-dev/pandas/issues/7914)) +* Bug in `Timestamp` comparisons with `==` and `int64` dtype ([GH 8058](https://github.com/pandas-dev/pandas/issues/8058)) +* Bug in pickles contains `DateOffset` may raise `AttributeError` when `normalize` attribute is referred internally ([GH 7748](https://github.com/pandas-dev/pandas/issues/7748)) +* Bug in `Panel` when using `major_xs` and `copy=False` is passed (deprecation warning fails because of missing `warnings`) ([GH 8152](https://github.com/pandas-dev/pandas/issues/8152)). +* Bug in pickle deserialization that failed for pre-0.14.1 containers with dup items trying to avoid ambiguity + when matching block and manager items, when there’s only one block there’s no ambiguity ([GH 7794](https://github.com/pandas-dev/pandas/issues/7794)) +* Bug in putting a `PeriodIndex` into a `Series` would convert to `int64` dtype, rather than `object` of `Periods` ([GH 7932](https://github.com/pandas-dev/pandas/issues/7932)) +* Bug in `HDFStore` iteration when passing a where ([GH 8014](https://github.com/pandas-dev/pandas/issues/8014)) +* Bug in `DataFrameGroupby.transform` when transforming with a passed non-sorted key ([GH 8046](https://github.com/pandas-dev/pandas/issues/8046), [GH 8430](https://github.com/pandas-dev/pandas/issues/8430)) +* Bug in repeated timeseries line and area plot may result in `ValueError` or incorrect kind ([GH 7733](https://github.com/pandas-dev/pandas/issues/7733)) +* Bug in inference in a `MultiIndex` with `datetime.date` inputs ([GH 7888](https://github.com/pandas-dev/pandas/issues/7888)) +* Bug in `get` where an `IndexError` would not cause the default value to be returned ([GH 7725](https://github.com/pandas-dev/pandas/issues/7725)) +* Bug in `offsets.apply`, `rollforward` and `rollback` may reset nanosecond ([GH 7697](https://github.com/pandas-dev/pandas/issues/7697)) +* Bug in `offsets.apply`, `rollforward` and `rollback` may raise `AttributeError` if `Timestamp` has `dateutil` tzinfo ([GH 7697](https://github.com/pandas-dev/pandas/issues/7697)) +* Bug in sorting a MultiIndex frame with a `Float64Index` ([GH 8017](https://github.com/pandas-dev/pandas/issues/8017)) +* Bug in inconsistent panel setitem with a rhs of a `DataFrame` for alignment ([GH 7763](https://github.com/pandas-dev/pandas/issues/7763)) +* Bug in `is_superperiod` and `is_subperiod` cannot handle higher frequencies than `S` ([GH 7760](https://github.com/pandas-dev/pandas/issues/7760), [GH 7772](https://github.com/pandas-dev/pandas/issues/7772), [GH 7803](https://github.com/pandas-dev/pandas/issues/7803)) +* Bug in 32-bit platforms with `Series.shift` ([GH 8129](https://github.com/pandas-dev/pandas/issues/8129)) +* Bug in `PeriodIndex.unique` returns int64 `np.ndarray` ([GH 7540](https://github.com/pandas-dev/pandas/issues/7540)) +* Bug in `groupby.apply` with a non-affecting mutation in the function ([GH 8467](https://github.com/pandas-dev/pandas/issues/8467)) +* Bug in `DataFrame.reset_index` which has `MultiIndex` contains `PeriodIndex` or `DatetimeIndex` with tz raises `ValueError` ([GH 7746](https://github.com/pandas-dev/pandas/issues/7746), [GH 7793](https://github.com/pandas-dev/pandas/issues/7793)) +* Bug in `DataFrame.plot` with `subplots=True` may draw unnecessary minor xticks and yticks ([GH 7801](https://github.com/pandas-dev/pandas/issues/7801)) +* Bug in `StataReader` which did not read variable labels in 117 files due to difference between Stata documentation and implementation ([GH 7816](https://github.com/pandas-dev/pandas/issues/7816)) +* Bug in `StataReader` where strings were always converted to 244 characters-fixed width irrespective of underlying string size ([GH 7858](https://github.com/pandas-dev/pandas/issues/7858)) +* Bug in `DataFrame.plot` and `Series.plot` may ignore `rot` and `fontsize` keywords ([GH 7844](https://github.com/pandas-dev/pandas/issues/7844)) +* Bug in `DatetimeIndex.value_counts` doesn’t preserve tz ([GH 7735](https://github.com/pandas-dev/pandas/issues/7735)) +* Bug in `PeriodIndex.value_counts` results in `Int64Index` ([GH 7735](https://github.com/pandas-dev/pandas/issues/7735)) +* Bug in `DataFrame.join` when doing left join on index and there are multiple matches ([GH 5391](https://github.com/pandas-dev/pandas/issues/5391)) +* Bug in `GroupBy.transform()` where int groups with a transform that + didn’t preserve the index were incorrectly truncated ([GH 7972](https://github.com/pandas-dev/pandas/issues/7972)). +* Bug in `groupby` where callable objects without name attributes would take the wrong path, + and produce a `DataFrame` instead of a `Series` ([GH 7929](https://github.com/pandas-dev/pandas/issues/7929)) +* Bug in `groupby` error message when a DataFrame grouping column is duplicated ([GH 7511](https://github.com/pandas-dev/pandas/issues/7511)) +* Bug in `read_html` where the `infer_types` argument forced coercion of + date-likes incorrectly ([GH 7762](https://github.com/pandas-dev/pandas/issues/7762), [GH 7032](https://github.com/pandas-dev/pandas/issues/7032)). +* Bug in `Series.str.cat` with an index which was filtered as to not include the first item ([GH 7857](https://github.com/pandas-dev/pandas/issues/7857)) +* Bug in `Timestamp` cannot parse `nanosecond` from string ([GH 7878](https://github.com/pandas-dev/pandas/issues/7878)) +* Bug in `Timestamp` with string offset and `tz` results incorrect ([GH 7833](https://github.com/pandas-dev/pandas/issues/7833)) +* Bug in `tslib.tz_convert` and `tslib.tz_convert_single` may return different results ([GH 7798](https://github.com/pandas-dev/pandas/issues/7798)) +* Bug in `DatetimeIndex.intersection` of non-overlapping timestamps with tz raises `IndexError` ([GH 7880](https://github.com/pandas-dev/pandas/issues/7880)) +* Bug in alignment with TimeOps and non-unique indexes ([GH 8363](https://github.com/pandas-dev/pandas/issues/8363)) +* Bug in `GroupBy.filter()` where fast path vs. slow path made the filter + return a non scalar value that appeared valid but wasn’t ([GH 7870](https://github.com/pandas-dev/pandas/issues/7870)). +* Bug in `date_range()`/`DatetimeIndex()` when the timezone was inferred from input dates yet incorrect + times were returned when crossing DST boundaries ([GH 7835](https://github.com/pandas-dev/pandas/issues/7835), [GH 7901](https://github.com/pandas-dev/pandas/issues/7901)). +* Bug in `to_excel()` where a negative sign was being prepended to positive infinity and was absent for negative infinity ([GH 7949](https://github.com/pandas-dev/pandas/issues/7949)) +* Bug in area plot draws legend with incorrect `alpha` when `stacked=True` ([GH 8027](https://github.com/pandas-dev/pandas/issues/8027)) +* `Period` and `PeriodIndex` addition/subtraction with `np.timedelta64` results in incorrect internal representations ([GH 7740](https://github.com/pandas-dev/pandas/issues/7740)) +* Bug in `Holiday` with no offset or observance ([GH 7987](https://github.com/pandas-dev/pandas/issues/7987)) +* Bug in `DataFrame.to_latex` formatting when columns or index is a `MultiIndex` ([GH 7982](https://github.com/pandas-dev/pandas/issues/7982)). +* Bug in `DateOffset` around Daylight Savings Time produces unexpected results ([GH 5175](https://github.com/pandas-dev/pandas/issues/5175)). +* Bug in `DataFrame.shift` where empty columns would throw `ZeroDivisionError` on numpy 1.7 ([GH 8019](https://github.com/pandas-dev/pandas/issues/8019)) +* Bug in installation where `html_encoding/*.html` wasn’t installed and + therefore some tests were not running correctly ([GH 7927](https://github.com/pandas-dev/pandas/issues/7927)). +* Bug in `read_html` where `bytes` objects were not tested for in + `_read` ([GH 7927](https://github.com/pandas-dev/pandas/issues/7927)). +* Bug in `DataFrame.stack()` when one of the column levels was a datelike ([GH 8039](https://github.com/pandas-dev/pandas/issues/8039)) +* Bug in broadcasting numpy scalars with `DataFrame` ([GH 8116](https://github.com/pandas-dev/pandas/issues/8116)) +* Bug in `pivot_table` performed with nameless `index` and `columns` raises `KeyError` ([GH 8103](https://github.com/pandas-dev/pandas/issues/8103)) +* Bug in `DataFrame.plot(kind='scatter')` draws points and errorbars with different colors when the color is specified by `c` keyword ([GH 8081](https://github.com/pandas-dev/pandas/issues/8081)) +* Bug in `Float64Index` where `iat` and `at` were not testing and were + failing ([GH 8092](https://github.com/pandas-dev/pandas/issues/8092)). +* Bug in `DataFrame.boxplot()` where y-limits were not set correctly when + producing multiple axes ([GH 7528](https://github.com/pandas-dev/pandas/issues/7528), [GH 5517](https://github.com/pandas-dev/pandas/issues/5517)). +* Bug in `read_csv` where line comments were not handled correctly given + a custom line terminator or `delim_whitespace=True` ([GH 8122](https://github.com/pandas-dev/pandas/issues/8122)). +* Bug in `read_html` where empty tables caused a `StopIteration` ([GH 7575](https://github.com/pandas-dev/pandas/issues/7575)) +* Bug in casting when setting a column in a same-dtype block ([GH 7704](https://github.com/pandas-dev/pandas/issues/7704)) +* Bug in accessing groups from a `GroupBy` when the original grouper + was a tuple ([GH 8121](https://github.com/pandas-dev/pandas/issues/8121)). +* Bug in `.at` that would accept integer indexers on a non-integer index and do fallback ([GH 7814](https://github.com/pandas-dev/pandas/issues/7814)) +* Bug with kde plot and NaNs ([GH 8182](https://github.com/pandas-dev/pandas/issues/8182)) +* Bug in `GroupBy.count` with float32 data type were nan values were not excluded ([GH 8169](https://github.com/pandas-dev/pandas/issues/8169)). +* Bug with stacked barplots and NaNs ([GH 8175](https://github.com/pandas-dev/pandas/issues/8175)). +* Bug in resample with non evenly divisible offsets (e.g. ‘7s’) ([GH 8371](https://github.com/pandas-dev/pandas/issues/8371)) +* Bug in interpolation methods with the `limit` keyword when no values needed interpolating ([GH 7173](https://github.com/pandas-dev/pandas/issues/7173)). +* Bug where `col_space` was ignored in `DataFrame.to_string()` when `header=False` ([GH 8230](https://github.com/pandas-dev/pandas/issues/8230)). +* Bug with `DatetimeIndex.asof` incorrectly matching partial strings and returning the wrong date ([GH 8245](https://github.com/pandas-dev/pandas/issues/8245)). +* Bug in plotting methods modifying the global matplotlib rcParams ([GH 8242](https://github.com/pandas-dev/pandas/issues/8242)). +* Bug in `DataFrame.__setitem__` that caused errors when setting a dataframe column to a sparse array ([GH 8131](https://github.com/pandas-dev/pandas/issues/8131)) +* Bug where `Dataframe.boxplot()` failed when entire column was empty ([GH 8181](https://github.com/pandas-dev/pandas/issues/8181)). +* Bug with messed variables in `radviz` visualization ([GH 8199](https://github.com/pandas-dev/pandas/issues/8199)). +* Bug in interpolation methods with the `limit` keyword when no values needed interpolating ([GH 7173](https://github.com/pandas-dev/pandas/issues/7173)). +* Bug where `col_space` was ignored in `DataFrame.to_string()` when `header=False` ([GH 8230](https://github.com/pandas-dev/pandas/issues/8230)). +* Bug in `to_clipboard` that would clip long column data ([GH 8305](https://github.com/pandas-dev/pandas/issues/8305)) +* Bug in `DataFrame` terminal display: Setting max\_column/max\_rows to zero did not trigger auto-resizing of dfs to fit terminal width/height ([GH 7180](https://github.com/pandas-dev/pandas/issues/7180)). +* Bug in OLS where running with “cluster” and “nw\_lags” parameters did not work correctly, but also did not throw an error + ([GH 5884](https://github.com/pandas-dev/pandas/issues/5884)). +* Bug in `DataFrame.dropna` that interpreted non-existent columns in the subset argument as the ‘last column’ ([GH 8303](https://github.com/pandas-dev/pandas/issues/8303)) +* Bug in `Index.intersection` on non-monotonic non-unique indexes ([GH 8362](https://github.com/pandas-dev/pandas/issues/8362)). +* Bug in masked series assignment where mismatching types would break alignment ([GH 8387](https://github.com/pandas-dev/pandas/issues/8387)) +* Bug in `NDFrame.equals` gives false negatives with dtype=object ([GH 8437](https://github.com/pandas-dev/pandas/issues/8437)) +* Bug in assignment with indexer where type diversity would break alignment ([GH 8258](https://github.com/pandas-dev/pandas/issues/8258)) +* Bug in `NDFrame.loc` indexing when row/column names were lost when target was a list/ndarray ([GH 6552](https://github.com/pandas-dev/pandas/issues/6552)) +* Regression in `NDFrame.loc` indexing when rows/columns were converted to Float64Index if target was an empty list/ndarray ([GH 7774](https://github.com/pandas-dev/pandas/issues/7774)) +* Bug in `Series` that allows it to be indexed by a `DataFrame` which has unexpected results. Such indexing is no longer permitted ([GH 8444](https://github.com/pandas-dev/pandas/issues/8444)) +* Bug in item assignment of a `DataFrame` with MultiIndex columns where right-hand-side columns were not aligned ([GH 7655](https://github.com/pandas-dev/pandas/issues/7655)) +* Suppress FutureWarning generated by NumPy when comparing object arrays containing NaN for equality ([GH 7065](https://github.com/pandas-dev/pandas/issues/7065)) +* Bug in `DataFrame.eval()` where the dtype of the `not` operator (`~`) + was not correctly inferred as `bool`. + +## Contributors[#](#contributors "Link to this heading") + +A total of 80 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Aaron Schumacher + +* Adam Greenhall +* Andy Hayden +* Anthony O’Brien + +* Artemy Kolchinsky + +* Ben Schiller + +* Benedikt Sauer +* Benjamin Thyreau + +* BorisVerk + +* Chris Reynolds + +* Chris Stoafer + +* DSM +* Dav Clark + +* FragLegs + +* German Gomez-Herrero + +* Hsiaoming Yang + +* Huan Li + +* Hyungtae Kim + +* Isaac Slavitt + +* Jacob Schaer +* Jacob Wasserman + +* Jan Schulz +* Jeff Reback +* Jeff Tratner +* Jesse Farnham + +* Joe Bradish + +* Joerg Rittinger + +* John W. O’Brien +* Joris Van den Bossche +* Kevin Sheppard +* Kyle Meyer +* Max Chang + +* Michael Mueller +* Michael W Schatzow + +* Mike Kelly +* Mortada Mehyar +* Nathan Sanders + +* Nathan Typanski + +* Paul Masurel + +* Phillip Cloud +* Pietro Battiston +* RenzoBertocchi + +* Ross Petchler + +* Shahul Hameed + +* Shashank Agarwal + +* Stephan Hoyer +* Tom Augspurger +* TomAugspurger +* Tony Lorenzo + +* Wes Turner +* Wilfred Hughes + +* Yevgeniy Grechka + +* Yoshiki Vázquez Baeza + +* behzad nouri + +* benjamin +* bjonen + +* dlovell + +* dsm054 +* hunterowens + +* immerrr +* ischwabacher +* jmorris0x0 + +* jnmclarty + +* jreback +* klonuo + +* lexual +* mcjcode + +* mtrbean + +* onesandzeroes +* rockg +* seth-p +* sinhrks +* someben + +* stahlous + +* stas-sl + +* thatneat + +* tom-alcorn + +* unknown +* unutbu +* zachcp + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.15.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.15.1.md new file mode 100644 index 0000000000000000000000000000000000000000..12a129457f8e88b39a56ba23bc7afc8b0253e31f --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.15.1.md @@ -0,0 +1,387 @@ +# What's new in pandas 0.15.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.15.1.html + +# Version 0.15.1 (November 9, 2014)[#](#version-0-15-1-november-9-2014 "Link to this heading") + +This is a minor bug-fix release from 0.15.0 and includes a small number of API changes, several new features, +enhancements, and performance improvements along with a large number of bug fixes. We recommend that all +users upgrade to this version. + +* [Enhancements](#whatsnew-0151-enhancements) +* [API Changes](#whatsnew-0151-api) +* [Bug Fixes](#whatsnew-0151-bug-fixes) + +## API changes[#](#api-changes "Link to this heading") + +* `s.dt.hour` and other `.dt` accessors will now return `np.nan` for missing values (rather than previously -1), ([GH 8689](https://github.com/pandas-dev/pandas/issues/8689)) + + ```None + In [1]: s = pd.Series(pd.date_range("20130101", periods=5, freq="D")) + + In [2]: s.iloc[2] = np.nan + + In [3]: s + Out[3]: + 0 2013-01-01 + 1 2013-01-02 + 2 NaT + 3 2013-01-04 + 4 2013-01-05 + Length: 5, dtype: datetime64[ns] + ``` + + previous behavior: + + ```None + In [6]: s.dt.hour + Out[6]: + 0 0 + 1 0 + 2 -1 + 3 0 + 4 0 + dtype: int64 + ``` + + current behavior: + + ```None + In [4]: s.dt.hour + Out[4]: + 0 0.0 + 1 0.0 + 2 NaN + 3 0.0 + 4 0.0 + Length: 5, dtype: float64 + ``` +* `groupby` with `as_index=False` will not add erroneous extra columns to + result ([GH 8582](https://github.com/pandas-dev/pandas/issues/8582)): + + ```None + In [5]: np.random.seed(2718281) + + In [6]: df = pd.DataFrame(np.random.randint(0, 100, (10, 2)), columns=["jim", "joe"]) + + In [7]: df.head() + Out[7]: + jim joe + 0 61 81 + 1 96 49 + 2 55 65 + 3 72 51 + 4 77 12 + + [5 rows x 2 columns] + + In [8]: ts = pd.Series(5 * np.random.randint(0, 3, 10)) + ``` + + previous behavior: + + ```None + In [4]: df.groupby(ts, as_index=False).max() + Out[4]: + NaN jim joe + 0 0 72 83 + 1 5 77 84 + 2 10 96 65 + ``` + + current behavior: + + ```None + In [4]: df.groupby(ts, as_index=False).max() + Out[4]: + jim joe + 0 72 83 + 1 77 84 + 2 96 65 + ``` +* `groupby` will not erroneously exclude columns if the column name conflicts + with the grouper name ([GH 8112](https://github.com/pandas-dev/pandas/issues/8112)): + + ```None + In [9]: df = pd.DataFrame({"jim": range(5), "joe": range(5, 10)}) + + In [10]: df + Out[10]: + jim joe + 0 0 5 + 1 1 6 + 2 2 7 + 3 3 8 + 4 4 9 + + [5 rows x 2 columns] + + In [11]: gr = df.groupby(df["jim"] < 2) + ``` + + previous behavior (excludes 1st column from output): + + ```None + In [4]: gr.apply(sum) + Out[4]: + joe + jim + False 24 + True 11 + ``` + + current behavior: + + ```None + In [12]: gr.apply(sum) + Out[12]: + jim joe + jim + False 9 24 + True 1 11 + + [2 rows x 2 columns] + ``` +* Support for slicing with monotonic decreasing indexes, even if `start` or `stop` is + not found in the index ([GH 7860](https://github.com/pandas-dev/pandas/issues/7860)): + + ```None + In [13]: s = pd.Series(["a", "b", "c", "d"], [4, 3, 2, 1]) + + In [14]: s + Out[14]: + 4 a + 3 b + 2 c + 1 d + Length: 4, dtype: object + ``` + + previous behavior: + + ```None + In [8]: s.loc[3.5:1.5] + KeyError: 3.5 + ``` + + current behavior: + + ```None + In [15]: s.loc[3.5:1.5] + Out[15]: + 3 b + 2 c + Length: 2, dtype: object + ``` +* `io.data.Options` has been fixed for a change in the format of the Yahoo Options page ([GH 8612](https://github.com/pandas-dev/pandas/issues/8612)), ([GH 8741](https://github.com/pandas-dev/pandas/issues/8741)) + + Note + + As a result of a change in Yahoo’s option page layout, when an expiry date is given, + `Options` methods now return data for a single expiry date. Previously, methods returned all + data for the selected month. + + The `month` and `year` parameters have been undeprecated and can be used to get all + options data for a given month. + + If an expiry date that is not valid is given, data for the next expiry after the given + date is returned. + + Option data frames are now saved on the instance as `callsYYMMDD` or `putsYYMMDD`. Previously + they were saved as `callsMMYY` and `putsMMYY`. The next expiry is saved as `calls` and `puts`. + + New features: + + + The expiry parameter can now be a single date or a list-like object containing dates. + + A new property `expiry_dates` was added, which returns all available expiry dates. + + Current behavior: + + ```None + In [17]: from pandas.io.data import Options + + In [18]: aapl = Options('aapl', 'yahoo') + + In [19]: aapl.get_call_data().iloc[0:5, 0:1] + Out[19]: + Last + Strike Expiry Type Symbol + 80 2014-11-14 call AAPL141114C00080000 29.05 + 84 2014-11-14 call AAPL141114C00084000 24.80 + 85 2014-11-14 call AAPL141114C00085000 24.05 + 86 2014-11-14 call AAPL141114C00086000 22.76 + 87 2014-11-14 call AAPL141114C00087000 21.74 + + In [20]: aapl.expiry_dates + Out[20]: + [datetime.date(2014, 11, 14), + datetime.date(2014, 11, 22), + datetime.date(2014, 11, 28), + datetime.date(2014, 12, 5), + datetime.date(2014, 12, 12), + datetime.date(2014, 12, 20), + datetime.date(2015, 1, 17), + datetime.date(2015, 2, 20), + datetime.date(2015, 4, 17), + datetime.date(2015, 7, 17), + datetime.date(2016, 1, 15), + datetime.date(2017, 1, 20)] + + In [21]: aapl.get_near_stock_price(expiry=aapl.expiry_dates[0:3]).iloc[0:5, 0:1] + Out[21]: + Last + Strike Expiry Type Symbol + 109 2014-11-22 call AAPL141122C00109000 1.48 + 2014-11-28 call AAPL141128C00109000 1.79 + 110 2014-11-14 call AAPL141114C00110000 0.55 + 2014-11-22 call AAPL141122C00110000 1.02 + 2014-11-28 call AAPL141128C00110000 1.32 + ``` + +* pandas now also registers the `datetime64` dtype in matplotlib’s units registry + to plot such values as datetimes. This is activated once pandas is imported. In + previous versions, plotting an array of `datetime64` values will have resulted + in plotted integer values. To keep the previous behaviour, you can do + `del matplotlib.units.registry[np.datetime64]` ([GH 8614](https://github.com/pandas-dev/pandas/issues/8614)). + +## Enhancements[#](#enhancements "Link to this heading") + +* `concat` permits a wider variety of iterables of pandas objects to be + passed as the first parameter ([GH 8645](https://github.com/pandas-dev/pandas/issues/8645)): + + ```None + In [16]: from collections import deque + + In [17]: df1 = pd.DataFrame([1, 2, 3]) + + In [18]: df2 = pd.DataFrame([4, 5, 6]) + ``` + + previous behavior: + + ```None + In [7]: pd.concat(deque((df1, df2))) + TypeError: first argument must be a list-like of pandas objects, you passed an object of type "deque" + ``` + + current behavior: + + ```None + In [19]: pd.concat(deque((df1, df2))) + Out[19]: + 0 + 0 1 + 1 2 + 2 3 + 0 4 + 1 5 + 2 6 + + [6 rows x 1 columns] + ``` +* Represent `MultiIndex` labels with a dtype that utilizes memory based on the level size. In prior versions, the memory usage was a constant 8 bytes per element in each level. In addition, in prior versions, the *reported* memory usage was incorrect as it didn’t show the usage for the memory occupied by the underling data array. ([GH 8456](https://github.com/pandas-dev/pandas/issues/8456)) + + ```None + In [20]: dfi = pd.DataFrame( + ....: 1, index=pd.MultiIndex.from_product([["a"], range(1000)]), columns=["A"] + ....: ) + ....: + ``` + + previous behavior: + + ```None + # this was underreported in prior versions + In [1]: dfi.memory_usage(index=True) + Out[1]: + Index 8000 # took about 24008 bytes in < 0.15.1 + A 8000 + dtype: int64 + ``` + + current behavior: + + ```None + In [21]: dfi.memory_usage(index=True) + Out[21]: + Index 44212 + A 8000 + Length: 2, dtype: int64 + ``` +* Added Index properties `is_monotonic_increasing` and `is_monotonic_decreasing` ([GH 8680](https://github.com/pandas-dev/pandas/issues/8680)). +* Added option to select columns when importing Stata files ([GH 7935](https://github.com/pandas-dev/pandas/issues/7935)) +* Qualify memory usage in `DataFrame.info()` by adding `+` if it is a lower bound ([GH 8578](https://github.com/pandas-dev/pandas/issues/8578)) +* Raise errors in certain aggregation cases where an argument such as `numeric_only` is not handled ([GH 8592](https://github.com/pandas-dev/pandas/issues/8592)). +* Added support for 3-character ISO and non-standard country codes in `io.wb.download()` ([GH 8482](https://github.com/pandas-dev/pandas/issues/8482)) +* World Bank data requests now will warn/raise based + on an `errors` argument, as well as a list of hard-coded country codes and + the World Bank’s JSON response. In prior versions, the error messages + didn’t look at the World Bank’s JSON response. Problem-inducing input were + simply dropped prior to the request. The issue was that many good countries + were cropped in the hard-coded approach. All countries will work now, but + some bad countries will raise exceptions because some edge cases break the + entire response. ([GH 8482](https://github.com/pandas-dev/pandas/issues/8482)) +* Added option to `Series.str.split()` to return a `DataFrame` rather than a `Series` ([GH 8428](https://github.com/pandas-dev/pandas/issues/8428)) +* Added option to `df.info(null_counts=None|True|False)` to override the default display options and force showing of the null-counts ([GH 8701](https://github.com/pandas-dev/pandas/issues/8701)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in unpickling of a `CustomBusinessDay` object ([GH 8591](https://github.com/pandas-dev/pandas/issues/8591)) +* Bug in coercing `Categorical` to a records array, e.g. `df.to_records()` ([GH 8626](https://github.com/pandas-dev/pandas/issues/8626)) +* Bug in `Categorical` not created properly with `Series.to_frame()` ([GH 8626](https://github.com/pandas-dev/pandas/issues/8626)) +* Bug in coercing in astype of a `Categorical` of a passed `pd.Categorical` (this now raises `TypeError` correctly), ([GH 8626](https://github.com/pandas-dev/pandas/issues/8626)) +* Bug in `cut`/`qcut` when using `Series` and `retbins=True` ([GH 8589](https://github.com/pandas-dev/pandas/issues/8589)) +* Bug in writing Categorical columns to an SQL database with `to_sql` ([GH 8624](https://github.com/pandas-dev/pandas/issues/8624)). +* Bug in comparing `Categorical` of datetime raising when being compared to a scalar datetime ([GH 8687](https://github.com/pandas-dev/pandas/issues/8687)) +* Bug in selecting from a `Categorical` with `.iloc` ([GH 8623](https://github.com/pandas-dev/pandas/issues/8623)) +* Bug in groupby-transform with a Categorical ([GH 8623](https://github.com/pandas-dev/pandas/issues/8623)) +* Bug in duplicated/drop\_duplicates with a Categorical ([GH 8623](https://github.com/pandas-dev/pandas/issues/8623)) +* Bug in `Categorical` reflected comparison operator raising if the first argument was a numpy array scalar (e.g. np.int64) ([GH 8658](https://github.com/pandas-dev/pandas/issues/8658)) +* Bug in Panel indexing with a list-like ([GH 8710](https://github.com/pandas-dev/pandas/issues/8710)) +* Compat issue is `DataFrame.dtypes` when `options.mode.use_inf_as_null` is True ([GH 8722](https://github.com/pandas-dev/pandas/issues/8722)) +* Bug in `read_csv`, `dialect` parameter would not take a string ([GH 8703](https://github.com/pandas-dev/pandas/issues/8703)) +* Bug in slicing a MultiIndex level with an empty-list ([GH 8737](https://github.com/pandas-dev/pandas/issues/8737)) +* Bug in numeric index operations of add/sub with Float/Index Index with numpy arrays ([GH 8608](https://github.com/pandas-dev/pandas/issues/8608)) +* Bug in setitem with empty indexer and unwanted coercion of dtypes ([GH 8669](https://github.com/pandas-dev/pandas/issues/8669)) +* Bug in ix/loc block splitting on setitem (manifests with integer-like dtypes, e.g. datetime64) ([GH 8607](https://github.com/pandas-dev/pandas/issues/8607)) +* Bug when doing label based indexing with integers not found in the index for + non-unique but monotonic indexes ([GH 8680](https://github.com/pandas-dev/pandas/issues/8680)). +* Bug when indexing a Float64Index with `np.nan` on numpy 1.7 ([GH 8980](https://github.com/pandas-dev/pandas/issues/8980)). +* Fix `shape` attribute for `MultiIndex` ([GH 8609](https://github.com/pandas-dev/pandas/issues/8609)) +* Bug in `GroupBy` where a name conflict between the grouper and columns + would break `groupby` operations ([GH 7115](https://github.com/pandas-dev/pandas/issues/7115), [GH 8112](https://github.com/pandas-dev/pandas/issues/8112)) +* Fixed a bug where plotting a column `y` and specifying a label would mutate the index name of the original DataFrame ([GH 8494](https://github.com/pandas-dev/pandas/issues/8494)) +* Fix regression in plotting of a DatetimeIndex directly with matplotlib ([GH 8614](https://github.com/pandas-dev/pandas/issues/8614)). +* Bug in `date_range` where partially-specified dates would incorporate current date ([GH 6961](https://github.com/pandas-dev/pandas/issues/6961)) +* Bug in Setting by indexer to a scalar value with a mixed-dtype `Panel4d` was failing ([GH 8702](https://github.com/pandas-dev/pandas/issues/8702)) +* Bug where `DataReader`’s would fail if one of the symbols passed was invalid. Now returns data for valid symbols and np.nan for invalid ([GH 8494](https://github.com/pandas-dev/pandas/issues/8494)) +* Bug in `get_quote_yahoo` that wouldn’t allow non-float return values ([GH 5229](https://github.com/pandas-dev/pandas/issues/5229)). + +## Contributors[#](#contributors "Link to this heading") + +A total of 23 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Aaron Staple + +* Andrew Rosenfeld +* Anton I. Sipos +* Artemy Kolchinsky +* Bill Letson + +* Dave Hughes + +* David Stephens +* Guillaume Horel + +* Jeff Reback +* Joris Van den Bossche +* Kevin Sheppard +* Nick Stahl + +* Sanghee Kim + +* Stephan Hoyer +* Tom Augspurger +* TomAugspurger +* WANG Aiyong + +* behzad nouri +* immerrr +* jnmclarty +* jreback +* pallav-fdsi + +* unutbu diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.15.2.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.15.2.md new file mode 100644 index 0000000000000000000000000000000000000000..0722c83ae00f388f90cdf346a279a489dbf88578 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.15.2.md @@ -0,0 +1,341 @@ +# What's new in pandas 0.15.2 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.15.2.html + +# Version 0.15.2 (December 12, 2014)[#](#version-0-15-2-december-12-2014 "Link to this heading") + +This is a minor release from 0.15.1 and includes a large number of bug fixes +along with several new features, enhancements, and performance improvements. +A small number of API changes were necessary to fix existing bugs. +We recommend that all users upgrade to this version. + +* [Enhancements](#whatsnew-0152-enhancements) +* [API Changes](#whatsnew-0152-api) +* [Performance Improvements](#whatsnew-0152-performance) +* [Bug Fixes](#whatsnew-0152-bug-fixes) + +## API changes[#](#api-changes "Link to this heading") + +* Indexing in `MultiIndex` beyond lex-sort depth is now supported, though + a lexically sorted index will have a better performance. ([GH 2646](https://github.com/pandas-dev/pandas/issues/2646)) + + ```None + In [1]: df = pd.DataFrame({'jim':[0, 0, 1, 1], + ...: 'joe':['x', 'x', 'z', 'y'], + ...: 'jolie':np.random.rand(4)}).set_index(['jim', 'joe']) + ...: + + In [2]: df + Out[2]: + jolie + jim joe + 0 x 0.126970 + x 0.966718 + 1 z 0.260476 + y 0.897237 + + [4 rows x 1 columns] + + In [3]: df.index.lexsort_depth + Out[3]: 1 + + # in prior versions this would raise a KeyError + # will now show a PerformanceWarning + In [4]: df.loc[(1, 'z')] + Out[4]: + jolie + jim joe + 1 z 0.260476 + + [1 rows x 1 columns] + + # lexically sorting + In [5]: df2 = df.sort_index() + + In [6]: df2 + Out[6]: + jolie + jim joe + 0 x 0.126970 + x 0.966718 + 1 y 0.897237 + z 0.260476 + + [4 rows x 1 columns] + + In [7]: df2.index.lexsort_depth + Out[7]: 2 + + In [8]: df2.loc[(1,'z')] + Out[8]: + jolie + jim joe + 1 z 0.260476 + + [1 rows x 1 columns] + ``` +* Bug in unique of Series with `category` dtype, which returned all categories regardless + whether they were “used” or not (see [GH 8559](https://github.com/pandas-dev/pandas/issues/8559) for the discussion). + Previous behaviour was to return all categories: + + ```None + In [3]: cat = pd.Categorical(['a', 'b', 'a'], categories=['a', 'b', 'c']) + + In [4]: cat + Out[4]: + [a, b, a] + Categories (3, object): [a < b < c] + + In [5]: cat.unique() + Out[5]: array(['a', 'b', 'c'], dtype=object) + ``` + + Now, only the categories that do effectively occur in the array are returned: + + ```None + In [1]: cat = pd.Categorical(['a', 'b', 'a'], categories=['a', 'b', 'c']) + + In [2]: cat.unique() + Out[2]: + ['a', 'b'] + Categories (3, object): ['a', 'b', 'c'] + ``` +* `Series.all` and `Series.any` now support the `level` and `skipna` parameters. `Series.all`, `Series.any`, `Index.all`, and `Index.any` no longer support the `out` and `keepdims` parameters, which existed for compatibility with ndarray. Various index types no longer support the `all` and `any` aggregation functions and will now raise `TypeError`. ([GH 8302](https://github.com/pandas-dev/pandas/issues/8302)). +* Allow equality comparisons of Series with a categorical dtype and object dtype; previously these would raise `TypeError` ([GH 8938](https://github.com/pandas-dev/pandas/issues/8938)) +* Bug in `NDFrame`: conflicting attribute/column names now behave consistently between getting and setting. Previously, when both a column and attribute named `y` existed, `data.y` would return the attribute, while `data.y = z` would update the column ([GH 8994](https://github.com/pandas-dev/pandas/issues/8994)) + + ```None + In [3]: data = pd.DataFrame({'x': [1, 2, 3]}) + + In [4]: data.y = 2 + + In [5]: data['y'] = [2, 4, 6] + + In [6]: data + Out[6]: + x y + 0 1 2 + 1 2 4 + 2 3 6 + + [3 rows x 2 columns] + + # this assignment was inconsistent + In [7]: data.y = 5 + ``` + + Old behavior: + + ```None + In [6]: data.y + Out[6]: 2 + + In [7]: data['y'].values + Out[7]: array([5, 5, 5]) + ``` + + New behavior: + + ```None + In [8]: data.y + Out[8]: 5 + + In [9]: data['y'].values + Out[9]: array([2, 4, 6]) + ``` +* `Timestamp('now')` is now equivalent to `Timestamp.now()` in that it returns the local time rather than UTC. Also, `Timestamp('today')` is now equivalent to `Timestamp.today()` and both have `tz` as a possible argument. ([GH 9000](https://github.com/pandas-dev/pandas/issues/9000)) +* Fix negative step support for label-based slices ([GH 8753](https://github.com/pandas-dev/pandas/issues/8753)) + + Old behavior: + + ```None + In [1]: s = pd.Series(np.arange(3), ['a', 'b', 'c']) + Out[1]: + a 0 + b 1 + c 2 + dtype: int64 + + In [2]: s.loc['c':'a':-1] + Out[2]: + c 2 + dtype: int64 + ``` + + New behavior: + + ```None + In [10]: s = pd.Series(np.arange(3), ['a', 'b', 'c']) + + In [11]: s.loc['c':'a':-1] + Out[11]: + c 2 + b 1 + a 0 + Length: 3, dtype: int64 + ``` + +## Enhancements[#](#enhancements "Link to this heading") + +`Categorical` enhancements: + +* Added ability to export Categorical data to Stata ([GH 8633](https://github.com/pandas-dev/pandas/issues/8633)). See [here](../user_guide/io.html#io-stata-categorical) for limitations of categorical variables exported to Stata data files. +* Added flag `order_categoricals` to `StataReader` and `read_stata` to select whether to order imported categorical data ([GH 8836](https://github.com/pandas-dev/pandas/issues/8836)). See [here](../user_guide/io.html#io-stata-categorical) for more information on importing categorical variables from Stata data files. +* Added ability to export Categorical data to/from HDF5 ([GH 7621](https://github.com/pandas-dev/pandas/issues/7621)). Queries work the same as if it was an object array. However, the `category` dtyped data is stored in a more efficient manner. See [here](../user_guide/io.html#io-hdf5-categorical) for an example and caveats w.r.t. prior versions of pandas. +* Added support for `searchsorted()` on `Categorical` class ([GH 8420](https://github.com/pandas-dev/pandas/issues/8420)). + +Other enhancements: + +* Added the ability to specify the SQL type of columns when writing a DataFrame + to a database ([GH 8778](https://github.com/pandas-dev/pandas/issues/8778)). + For example, specifying to use the sqlalchemy `String` type instead of the + default `Text` type for string columns: + + ```None + from sqlalchemy.types import String + data.to_sql('data_dtype', engine, dtype={'Col_1': String}) # noqa F821 + ``` +* `Series.all` and `Series.any` now support the `level` and `skipna` parameters ([GH 8302](https://github.com/pandas-dev/pandas/issues/8302)): + + ```None + >>> s = pd.Series([False, True, False], index=[0, 0, 1]) + >>> s.any(level=0) + 0 True + 1 False + dtype: bool + ``` +* `Panel` now supports the `all` and `any` aggregation functions. ([GH 8302](https://github.com/pandas-dev/pandas/issues/8302)): + + ```None + >>> p = pd.Panel(np.random.rand(2, 5, 4) > 0.1) + >>> p.all() + 0 1 2 3 + 0 True True True True + 1 True False True True + 2 True True True True + 3 False True False True + 4 True True True True + ``` +* Added support for `utcfromtimestamp()`, `fromtimestamp()`, and `combine()` on `Timestamp` class ([GH 5351](https://github.com/pandas-dev/pandas/issues/5351)). +* Added Google Analytics (pandas.io.ga) basic documentation ([GH 8835](https://github.com/pandas-dev/pandas/issues/8835)). See [here](https://pandas.pydata.org/pandas-docs/version/0.15.2/remote_data.html#remote-data-ga). +* `Timedelta` arithmetic returns `NotImplemented` in unknown cases, allowing extensions by custom classes ([GH 8813](https://github.com/pandas-dev/pandas/issues/8813)). +* `Timedelta` now supports arithmetic with `numpy.ndarray` objects of the appropriate dtype (numpy 1.8 or newer only) ([GH 8884](https://github.com/pandas-dev/pandas/issues/8884)). +* Added `Timedelta.to_timedelta64()` method to the public API ([GH 8884](https://github.com/pandas-dev/pandas/issues/8884)). +* Added `gbq.generate_bq_schema()` function to the gbq module ([GH 8325](https://github.com/pandas-dev/pandas/issues/8325)). +* `Series` now works with map objects the same way as generators ([GH 8909](https://github.com/pandas-dev/pandas/issues/8909)). +* Added context manager to `HDFStore` for automatic closing ([GH 8791](https://github.com/pandas-dev/pandas/issues/8791)). +* `to_datetime` gains an `exact` keyword to allow for a format to not require an exact match for a provided format string (if its `False`). `exact` defaults to `True` (meaning that exact matching is still the default) ([GH 8904](https://github.com/pandas-dev/pandas/issues/8904)) +* Added `axvlines` boolean option to parallel\_coordinates plot function, determines whether vertical lines will be printed, default is True +* Added ability to read table footers to read\_html ([GH 8552](https://github.com/pandas-dev/pandas/issues/8552)) +* `to_sql` now infers data types of non-NA values for columns that contain NA values and have dtype `object` ([GH 8778](https://github.com/pandas-dev/pandas/issues/8778)). + +## Performance[#](#performance "Link to this heading") + +* Reduce memory usage when skiprows is an integer in read\_csv ([GH 8681](https://github.com/pandas-dev/pandas/issues/8681)) +* Performance boost for `to_datetime` conversions with a passed `format=`, and the `exact=False` ([GH 8904](https://github.com/pandas-dev/pandas/issues/8904)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in concat of Series with `category` dtype which were coercing to `object`. ([GH 8641](https://github.com/pandas-dev/pandas/issues/8641)) +* Bug in Timestamp-Timestamp not returning a Timedelta type and datelike-datelike ops with timezones ([GH 8865](https://github.com/pandas-dev/pandas/issues/8865)) +* Made consistent a timezone mismatch exception (either tz operated with None or incompatible timezone), will now return `TypeError` rather than `ValueError` (a couple of edge cases only), ([GH 8865](https://github.com/pandas-dev/pandas/issues/8865)) +* Bug in using a `pd.Grouper(key=...)` with no level/axis or level only ([GH 8795](https://github.com/pandas-dev/pandas/issues/8795), [GH 8866](https://github.com/pandas-dev/pandas/issues/8866)) +* Report a `TypeError` when invalid/no parameters are passed in a groupby ([GH 8015](https://github.com/pandas-dev/pandas/issues/8015)) +* Bug in packaging pandas with `py2app/cx_Freeze` ([GH 8602](https://github.com/pandas-dev/pandas/issues/8602), [GH 8831](https://github.com/pandas-dev/pandas/issues/8831)) +* Bug in `groupby` signatures that didn’t include \*args or \*\*kwargs ([GH 8733](https://github.com/pandas-dev/pandas/issues/8733)). +* `io.data.Options` now raises `RemoteDataError` when no expiry dates are available from Yahoo and when it receives no data from Yahoo ([GH 8761](https://github.com/pandas-dev/pandas/issues/8761)), ([GH 8783](https://github.com/pandas-dev/pandas/issues/8783)). +* Unclear error message in csv parsing when passing dtype and names and the parsed data is a different data type ([GH 8833](https://github.com/pandas-dev/pandas/issues/8833)) +* Bug in slicing a MultiIndex with an empty list and at least one boolean indexer ([GH 8781](https://github.com/pandas-dev/pandas/issues/8781)) +* `io.data.Options` now raises `RemoteDataError` when no expiry dates are available from Yahoo ([GH 8761](https://github.com/pandas-dev/pandas/issues/8761)). +* `Timedelta` kwargs may now be numpy ints and floats ([GH 8757](https://github.com/pandas-dev/pandas/issues/8757)). +* Fixed several outstanding bugs for `Timedelta` arithmetic and comparisons ([GH 8813](https://github.com/pandas-dev/pandas/issues/8813), [GH 5963](https://github.com/pandas-dev/pandas/issues/5963), [GH 5436](https://github.com/pandas-dev/pandas/issues/5436)). +* `sql_schema` now generates dialect appropriate `CREATE TABLE` statements ([GH 8697](https://github.com/pandas-dev/pandas/issues/8697)) +* `slice` string method now takes step into account ([GH 8754](https://github.com/pandas-dev/pandas/issues/8754)) +* Bug in `BlockManager` where setting values with different type would break block integrity ([GH 8850](https://github.com/pandas-dev/pandas/issues/8850)) +* Bug in `DatetimeIndex` when using `time` object as key ([GH 8667](https://github.com/pandas-dev/pandas/issues/8667)) +* Bug in `merge` where `how='left'` and `sort=False` would not preserve left frame order ([GH 7331](https://github.com/pandas-dev/pandas/issues/7331)) +* Bug in `MultiIndex.reindex` where reindexing at level would not reorder labels ([GH 4088](https://github.com/pandas-dev/pandas/issues/4088)) +* Bug in certain operations with dateutil timezones, manifesting with dateutil 2.3 ([GH 8639](https://github.com/pandas-dev/pandas/issues/8639)) +* Regression in DatetimeIndex iteration with a Fixed/Local offset timezone ([GH 8890](https://github.com/pandas-dev/pandas/issues/8890)) +* Bug in `to_datetime` when parsing a nanoseconds using the `%f` format ([GH 8989](https://github.com/pandas-dev/pandas/issues/8989)) +* `io.data.Options` now raises `RemoteDataError` when no expiry dates are available from Yahoo and when it receives no data from Yahoo ([GH 8761](https://github.com/pandas-dev/pandas/issues/8761)), ([GH 8783](https://github.com/pandas-dev/pandas/issues/8783)). +* Fix: The font size was only set on x axis if vertical or the y axis if horizontal. ([GH 8765](https://github.com/pandas-dev/pandas/issues/8765)) +* Fixed division by 0 when reading big csv files in python 3 ([GH 8621](https://github.com/pandas-dev/pandas/issues/8621)) +* Bug in outputting a MultiIndex with `to_html,index=False` which would add an extra column ([GH 8452](https://github.com/pandas-dev/pandas/issues/8452)) +* Imported categorical variables from Stata files retain the ordinal information in the underlying data ([GH 8836](https://github.com/pandas-dev/pandas/issues/8836)). +* Defined `.size` attribute across `NDFrame` objects to provide compat with numpy >= 1.9.1; buggy with `np.array_split` ([GH 8846](https://github.com/pandas-dev/pandas/issues/8846)) +* Skip testing of histogram plots for matplotlib <= 1.2 ([GH 8648](https://github.com/pandas-dev/pandas/issues/8648)). +* Bug where `get_data_google` returned object dtypes ([GH 3995](https://github.com/pandas-dev/pandas/issues/3995)) +* Bug in `DataFrame.stack(..., dropna=False)` when the DataFrame’s `columns` is a `MultiIndex` + whose `labels` do not reference all its `levels`. ([GH 8844](https://github.com/pandas-dev/pandas/issues/8844)) +* Bug in that Option context applied on `__enter__` ([GH 8514](https://github.com/pandas-dev/pandas/issues/8514)) +* Bug in resample that causes a ValueError when resampling across multiple days + and the last offset is not calculated from the start of the range ([GH 8683](https://github.com/pandas-dev/pandas/issues/8683)) +* Bug where `DataFrame.plot(kind='scatter')` fails when checking if an np.array is in the DataFrame ([GH 8852](https://github.com/pandas-dev/pandas/issues/8852)) +* Bug in `pd.infer_freq/DataFrame.inferred_freq` that prevented proper sub-daily frequency inference when the index contained DST days ([GH 8772](https://github.com/pandas-dev/pandas/issues/8772)). +* Bug where index name was still used when plotting a series with `use_index=False` ([GH 8558](https://github.com/pandas-dev/pandas/issues/8558)). +* Bugs when trying to stack multiple columns, when some (or all) of the level names are numbers ([GH 8584](https://github.com/pandas-dev/pandas/issues/8584)). +* Bug in `MultiIndex` where `__contains__` returns wrong result if index is not lexically sorted or unique ([GH 7724](https://github.com/pandas-dev/pandas/issues/7724)) +* BUG CSV: fix problem with trailing white space in skipped rows, ([GH 8679](https://github.com/pandas-dev/pandas/issues/8679)), ([GH 8661](https://github.com/pandas-dev/pandas/issues/8661)), ([GH 8983](https://github.com/pandas-dev/pandas/issues/8983)) +* Regression in `Timestamp` does not parse ‘Z’ zone designator for UTC ([GH 8771](https://github.com/pandas-dev/pandas/issues/8771)) +* Bug in `StataWriter` the produces writes strings with 244 characters irrespective of actual size ([GH 8969](https://github.com/pandas-dev/pandas/issues/8969)) +* Fixed ValueError raised by cummin/cummax when datetime64 Series contains NaT. ([GH 8965](https://github.com/pandas-dev/pandas/issues/8965)) +* Bug in DataReader returns object dtype if there are missing values ([GH 8980](https://github.com/pandas-dev/pandas/issues/8980)) +* Bug in plotting if sharex was enabled and index was a timeseries, would show labels on multiple axes ([GH 3964](https://github.com/pandas-dev/pandas/issues/3964)). +* Bug where passing a unit to the TimedeltaIndex constructor applied the to nano-second conversion twice. ([GH 9011](https://github.com/pandas-dev/pandas/issues/9011)). +* Bug in plotting of a period-like array ([GH 9012](https://github.com/pandas-dev/pandas/issues/9012)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 49 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Aaron Staple +* Angelos Evripiotis + +* Artemy Kolchinsky +* Benoit Pointet + +* Brian Jacobowski + +* Charalampos Papaloizou + +* Chris Warth + +* David Stephens +* Fabio Zanini + +* Francesc Via + +* Henry Kleynhans + +* Jake VanderPlas + +* Jan Schulz +* Jeff Reback +* Jeff Tratner +* Joris Van den Bossche +* Kevin Sheppard +* Matt Suggit + +* Matthew Brett +* Phillip Cloud +* Rupert Thompson + +* Scott E Lasley + +* Stephan Hoyer +* Stephen Simmons + +* Sylvain Corlay + +* Thomas Grainger + +* Tiago Antao + +* Tom Augspurger +* Trent Hauck +* Victor Chaves + +* Victor Salgado + +* Vikram Bhandoh + +* WANG Aiyong +* Will Holmgren + +* behzad nouri +* broessli + +* charalampos papaloizou + +* immerrr +* jnmclarty +* jreback +* mgilbert + +* onesandzeroes +* peadarcoyle + +* rockg +* seth-p +* sinhrks +* unutbu +* wavedatalab + +* Åsmund Hjulstad + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.16.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.16.0.md new file mode 100644 index 0000000000000000000000000000000000000000..c837c8590db98ca7da002e1b95c12a69a5793a49 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.16.0.md @@ -0,0 +1,842 @@ +# What's new in pandas 0.16.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.16.0.html + +# Version 0.16.0 (March 22, 2015)[#](#version-0-16-0-march-22-2015 "Link to this heading") + +This is a major release from 0.15.2 and includes a small number of API changes, several new features, +enhancements, and performance improvements along with a large number of bug fixes. We recommend that all +users upgrade to this version. + +Highlights include: + +* `DataFrame.assign` method, see [here](#whatsnew-0160-enhancements-assign) +* `Series.to_coo/from_coo` methods to interact with `scipy.sparse`, see [here](#whatsnew-0160-enhancements-sparse) +* Backwards incompatible change to `Timedelta` to conform the `.seconds` attribute with `datetime.timedelta`, see [here](#whatsnew-0160-api-breaking-timedelta) +* Changes to the `.loc` slicing API to conform with the behavior of `.ix` see [here](#whatsnew-0160-api-breaking-indexing) +* Changes to the default for ordering in the `Categorical` constructor, see [here](#whatsnew-0160-api-breaking-categorical) +* Enhancement to the `.str` accessor to make string operations easier, see [here](#whatsnew-0160-enhancements-string) +* The `pandas.tools.rplot`, `pandas.sandbox.qtpandas` and `pandas.rpy` + modules are deprecated. We refer users to external packages like + [seaborn](http://stanford.edu/~mwaskom/software/seaborn/), + [pandas-qt](https://github.com/datalyze-solutions/pandas-qt) and + [rpy2](http://rpy2.bitbucket.org/) for similar or equivalent + functionality, see [here](#whatsnew-0160-deprecations) + +Check the [API Changes](#whatsnew-0160-api) and [deprecations](#whatsnew-0160-deprecations) before updating. + +What’s new in v0.16.0 + +* [New features](#new-features) + + + [DataFrame assign](#dataframe-assign) + + [Interaction with scipy.sparse](#interaction-with-scipy-sparse) + + [String methods enhancements](#string-methods-enhancements) + + [Other enhancements](#other-enhancements) +* [Backwards incompatible API changes](#backwards-incompatible-api-changes) + + + [Changes in timedelta](#changes-in-timedelta) + + [Indexing changes](#indexing-changes) + + [Categorical changes](#categorical-changes) + + [Other API changes](#other-api-changes) + + [Deprecations](#deprecations) + + [Removal of prior version deprecations/changes](#removal-of-prior-version-deprecations-changes) +* [Performance improvements](#performance-improvements) +* [Bug fixes](#bug-fixes) +* [Contributors](#contributors) + +## New features[#](#new-features "Link to this heading") + +### DataFrame assign[#](#dataframe-assign "Link to this heading") + +Inspired by [dplyr’s](https://dplyr.tidyverse.org/articles/dplyr.html#mutating-operations) `mutate` verb, DataFrame has a new +[`assign()`](../reference/api/pandas.DataFrame.assign.html#pandas.DataFrame.assign "pandas.DataFrame.assign") method. +The function signature for `assign` is simply `**kwargs`. The keys +are the column names for the new fields, and the values are either a value +to be inserted (for example, a `Series` or NumPy array), or a function +of one argument to be called on the `DataFrame`. The new values are inserted, +and the entire DataFrame (with all original and new columns) is returned. + +```None +In [1]: iris = pd.read_csv('data/iris.data') + +In [2]: iris.head() +Out[2]: + SepalLength SepalWidth PetalLength PetalWidth Name +0 5.1 3.5 1.4 0.2 Iris-setosa +1 4.9 3.0 1.4 0.2 Iris-setosa +2 4.7 3.2 1.3 0.2 Iris-setosa +3 4.6 3.1 1.5 0.2 Iris-setosa +4 5.0 3.6 1.4 0.2 Iris-setosa + +[5 rows x 5 columns] + +In [3]: iris.assign(sepal_ratio=iris['SepalWidth'] / iris['SepalLength']).head() +Out[3]: + SepalLength SepalWidth PetalLength PetalWidth Name sepal_ratio +0 5.1 3.5 1.4 0.2 Iris-setosa 0.686275 +1 4.9 3.0 1.4 0.2 Iris-setosa 0.612245 +2 4.7 3.2 1.3 0.2 Iris-setosa 0.680851 +3 4.6 3.1 1.5 0.2 Iris-setosa 0.673913 +4 5.0 3.6 1.4 0.2 Iris-setosa 0.720000 + +[5 rows x 6 columns] +``` + +Above was an example of inserting a precomputed value. We can also pass in +a function to be evaluated. + +```None +In [4]: iris.assign(sepal_ratio=lambda x: (x['SepalWidth'] + ...: / x['SepalLength'])).head() + ...: +Out[4]: + SepalLength SepalWidth PetalLength PetalWidth Name sepal_ratio +0 5.1 3.5 1.4 0.2 Iris-setosa 0.686275 +1 4.9 3.0 1.4 0.2 Iris-setosa 0.612245 +2 4.7 3.2 1.3 0.2 Iris-setosa 0.680851 +3 4.6 3.1 1.5 0.2 Iris-setosa 0.673913 +4 5.0 3.6 1.4 0.2 Iris-setosa 0.720000 + +[5 rows x 6 columns] +``` + +The power of `assign` comes when used in chains of operations. For example, +we can limit the DataFrame to just those with a Sepal Length greater than 5, +calculate the ratio, and plot + +```None +In [5]: iris = pd.read_csv('data/iris.data') + +In [6]: (iris.query('SepalLength > 5') + ...: .assign(SepalRatio=lambda x: x.SepalWidth / x.SepalLength, + ...: PetalRatio=lambda x: x.PetalWidth / x.PetalLength) + ...: .plot(kind='scatter', x='SepalRatio', y='PetalRatio')) + ...: +Out[6]: +``` + +[![../_images/whatsnew_assign.png](../_images/whatsnew_assign.png)](../_images/whatsnew_assign.png) + +See the [documentation](../user_guide/dsintro.html#dsintro-chained-assignment) for more. ([GH 9229](https://github.com/pandas-dev/pandas/issues/9229)) + +### Interaction with scipy.sparse[#](#interaction-with-scipy-sparse "Link to this heading") + +Added `SparseSeries.to_coo()` and `SparseSeries.from_coo()` methods ([GH 8048](https://github.com/pandas-dev/pandas/issues/8048)) for converting to and from `scipy.sparse.coo_matrix` instances (see [here](../user_guide/sparse.html#sparse-scipysparse)). For example, given a SparseSeries with MultiIndex we can convert to a `scipy.sparse.coo_matrix` by specifying the row and column labels as index levels: + +```None +s = pd.Series([3.0, np.nan, 1.0, 3.0, np.nan, np.nan]) +s.index = pd.MultiIndex.from_tuples([(1, 2, 'a', 0), + (1, 2, 'a', 1), + (1, 1, 'b', 0), + (1, 1, 'b', 1), + (2, 1, 'b', 0), + (2, 1, 'b', 1)], + names=['A', 'B', 'C', 'D']) + +s + +# SparseSeries +ss = s.to_sparse() +ss + +A, rows, columns = ss.to_coo(row_levels=['A', 'B'], + column_levels=['C', 'D'], + sort_labels=False) + +A +A.todense() +rows +columns +``` + +The from\_coo method is a convenience method for creating a `SparseSeries` +from a `scipy.sparse.coo_matrix`: + +```None +from scipy import sparse +A = sparse.coo_matrix(([3.0, 1.0, 2.0], ([1, 0, 0], [0, 2, 3])), + shape=(3, 4)) +A +A.todense() + +ss = pd.SparseSeries.from_coo(A) +ss +``` + +### String methods enhancements[#](#string-methods-enhancements "Link to this heading") + +* Following new methods are accessible via `.str` accessor to apply the function to each values. This is intended to make it more consistent with standard methods on strings. ([GH 9282](https://github.com/pandas-dev/pandas/issues/9282), [GH 9352](https://github.com/pandas-dev/pandas/issues/9352), [GH 9386](https://github.com/pandas-dev/pandas/issues/9386), [GH 9387](https://github.com/pandas-dev/pandas/issues/9387), [GH 9439](https://github.com/pandas-dev/pandas/issues/9439)) + + | | | Methods | | | + | --- | --- | --- | --- | --- | + | `isalnum()` | `isalpha()` | `isdigit()` | `isdigit()` | `isspace()` | + | `islower()` | `isupper()` | `istitle()` | `isnumeric()` | `isdecimal()` | + | `find()` | `rfind()` | `ljust()` | `rjust()` | `zfill()` | + + ```None + In [7]: s = pd.Series(['abcd', '3456', 'EFGH']) + + In [8]: s.str.isalpha() + Out[8]: + 0 True + 1 False + 2 True + Length: 3, dtype: bool + + In [9]: s.str.find('ab') + Out[9]: + 0 0 + 1 -1 + 2 -1 + Length: 3, dtype: int64 + ``` +* [`Series.str.pad()`](../reference/api/pandas.Series.str.pad.html#pandas.Series.str.pad "pandas.Series.str.pad") and [`Series.str.center()`](../reference/api/pandas.Series.str.center.html#pandas.Series.str.center "pandas.Series.str.center") now accept `fillchar` option to specify filling character ([GH 9352](https://github.com/pandas-dev/pandas/issues/9352)) + + ```None + In [10]: s = pd.Series(['12', '300', '25']) + + In [11]: s.str.pad(5, fillchar='_') + Out[11]: + 0 ___12 + 1 __300 + 2 ___25 + Length: 3, dtype: object + ``` +* Added [`Series.str.slice_replace()`](../reference/api/pandas.Series.str.slice_replace.html#pandas.Series.str.slice_replace "pandas.Series.str.slice_replace"), which previously raised `NotImplementedError` ([GH 8888](https://github.com/pandas-dev/pandas/issues/8888)) + + ```None + In [12]: s = pd.Series(['ABCD', 'EFGH', 'IJK']) + + In [13]: s.str.slice_replace(1, 3, 'X') + Out[13]: + 0 AXD + 1 EXH + 2 IX + Length: 3, dtype: object + + # replaced with empty char + In [14]: s.str.slice_replace(0, 1) + Out[14]: + 0 BCD + 1 FGH + 2 JK + Length: 3, dtype: object + ``` + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* Reindex now supports `method='nearest'` for frames or series with a monotonic increasing or decreasing index ([GH 9258](https://github.com/pandas-dev/pandas/issues/9258)): + + ```None + In [15]: df = pd.DataFrame({'x': range(5)}) + + In [16]: df.reindex([0.2, 1.8, 3.5], method='nearest') + Out[16]: + x + 0.2 0 + 1.8 2 + 3.5 4 + + [3 rows x 1 columns] + ``` + + This method is also exposed by the lower level `Index.get_indexer` and `Index.get_loc` methods. +* The `read_excel()` function’s [sheetname](../user_guide/io.html#io-excel-specifying-sheets) argument now accepts a list and `None`, to get multiple or all sheets respectively. If more than one sheet is specified, a dictionary is returned. ([GH 9450](https://github.com/pandas-dev/pandas/issues/9450)) + + ```None + # Returns the 1st and 4th sheet, as a dictionary of DataFrames. + pd.read_excel('path_to_file.xls', sheetname=['Sheet1', 3]) + ``` +* Allow Stata files to be read incrementally with an iterator; support for long strings in Stata files. See the docs [here](../user_guide/io.html#io-stata-reader) ([GH 9493](https://github.com/pandas-dev/pandas/issues/9493):). +* Paths beginning with ~ will now be expanded to begin with the user’s home directory ([GH 9066](https://github.com/pandas-dev/pandas/issues/9066)) +* Added time interval selection in `get_data_yahoo` ([GH 9071](https://github.com/pandas-dev/pandas/issues/9071)) +* Added `Timestamp.to_datetime64()` to complement `Timedelta.to_timedelta64()` ([GH 9255](https://github.com/pandas-dev/pandas/issues/9255)) +* `tseries.frequencies.to_offset()` now accepts `Timedelta` as input ([GH 9064](https://github.com/pandas-dev/pandas/issues/9064)) +* Lag parameter was added to the autocorrelation method of `Series`, defaults to lag-1 autocorrelation ([GH 9192](https://github.com/pandas-dev/pandas/issues/9192)) +* `Timedelta` will now accept `nanoseconds` keyword in constructor ([GH 9273](https://github.com/pandas-dev/pandas/issues/9273)) +* SQL code now safely escapes table and column names ([GH 8986](https://github.com/pandas-dev/pandas/issues/8986)) +* Added auto-complete for `Series.str.`, `Series.dt.` and `Series.cat.` ([GH 9322](https://github.com/pandas-dev/pandas/issues/9322)) +* `Index.get_indexer` now supports `method='pad'` and `method='backfill'` even for any target array, not just monotonic targets. These methods also work for monotonic decreasing as well as monotonic increasing indexes ([GH 9258](https://github.com/pandas-dev/pandas/issues/9258)). +* `Index.asof` now works on all index types ([GH 9258](https://github.com/pandas-dev/pandas/issues/9258)). +* A `verbose` argument has been augmented in `io.read_excel()`, defaults to False. Set to True to print sheet names as they are parsed. ([GH 9450](https://github.com/pandas-dev/pandas/issues/9450)) +* Added `days_in_month` (compatibility alias `daysinmonth`) property to `Timestamp`, `DatetimeIndex`, `Period`, `PeriodIndex`, and `Series.dt` ([GH 9572](https://github.com/pandas-dev/pandas/issues/9572)) +* Added `decimal` option in `to_csv` to provide formatting for non-‘.’ decimal separators ([GH 781](https://github.com/pandas-dev/pandas/issues/781)) +* Added `normalize` option for `Timestamp` to normalized to midnight ([GH 8794](https://github.com/pandas-dev/pandas/issues/8794)) +* Added example for `DataFrame` import to R using HDF5 file and `rhdf5` + library. See the documentation for more + ([GH 9636](https://github.com/pandas-dev/pandas/issues/9636)). + +## Backwards incompatible API changes[#](#backwards-incompatible-api-changes "Link to this heading") + +### Changes in timedelta[#](#changes-in-timedelta "Link to this heading") + +In v0.15.0 a new scalar type `Timedelta` was introduced, that is a +sub-class of `datetime.timedelta`. Mentioned [here](v0.15.0.html#whatsnew-0150-timedeltaindex) was a notice of an API change w.r.t. the `.seconds` accessor. The intent was to provide a user-friendly set of accessors that give the ‘natural’ value for that unit, e.g. if you had a `Timedelta('1 day, 10:11:12')`, then `.seconds` would return 12. However, this is at odds with the definition of `datetime.timedelta`, which defines `.seconds` as `10 * 3600 + 11 * 60 + 12 == 36672`. + +So in v0.16.0, we are restoring the API to match that of `datetime.timedelta`. Further, the component values are still available through the `.components` accessor. This affects the `.seconds` and `.microseconds` accessors, and removes the `.hours`, `.minutes`, `.milliseconds` accessors. These changes affect `TimedeltaIndex` and the Series `.dt` accessor as well. ([GH 9185](https://github.com/pandas-dev/pandas/issues/9185), [GH 9139](https://github.com/pandas-dev/pandas/issues/9139)) + +Previous behavior + +```None +In [2]: t = pd.Timedelta('1 day, 10:11:12.100123') + +In [3]: t.days +Out[3]: 1 + +In [4]: t.seconds +Out[4]: 12 + +In [5]: t.microseconds +Out[5]: 123 +``` + +New behavior + +```None +In [17]: t = pd.Timedelta('1 day, 10:11:12.100123') + +In [18]: t.days +Out[18]: 1 + +In [19]: t.seconds +Out[19]: 36672 + +In [20]: t.microseconds +Out[20]: 100123 +``` + +Using `.components` allows the full component access + +```None +In [21]: t.components +Out[21]: Components(days=1, hours=10, minutes=11, seconds=12, milliseconds=100, microseconds=123, nanoseconds=0) + +In [22]: t.components.seconds +Out[22]: 12 +``` + +### Indexing changes[#](#indexing-changes "Link to this heading") + +The behavior of a small sub-set of edge cases for using `.loc` have changed ([GH 8613](https://github.com/pandas-dev/pandas/issues/8613)). Furthermore we have improved the content of the error messages that are raised: + +* Slicing with `.loc` where the start and/or stop bound is not found in the index is now allowed; this previously would raise a `KeyError`. This makes the behavior the same as `.ix` in this case. This change is only for slicing, not when indexing with a single label. + + ```None + In [23]: df = pd.DataFrame(np.random.randn(5, 4), + ....: columns=list('ABCD'), + ....: index=pd.date_range('20130101', periods=5)) + ....: + + In [24]: df + Out[24]: + A B C D + 2013-01-01 0.469112 -0.282863 -1.509059 -1.135632 + 2013-01-02 1.212112 -0.173215 0.119209 -1.044236 + 2013-01-03 -0.861849 -2.104569 -0.494929 1.071804 + 2013-01-04 0.721555 -0.706771 -1.039575 0.271860 + 2013-01-05 -0.424972 0.567020 0.276232 -1.087401 + + [5 rows x 4 columns] + + In [25]: s = pd.Series(range(5), [-2, -1, 1, 2, 3]) + + In [26]: s + Out[26]: + -2 0 + -1 1 + 1 2 + 2 3 + 3 4 + Length: 5, dtype: int64 + ``` + + Previous behavior + + ```None + In [4]: df.loc['2013-01-02':'2013-01-10'] + KeyError: 'stop bound [2013-01-10] is not in the [index]' + + In [6]: s.loc[-10:3] + KeyError: 'start bound [-10] is not the [index]' + ``` + + New behavior + + ```None + In [27]: df.loc['2013-01-02':'2013-01-10'] + Out[27]: + A B C D + 2013-01-02 1.212112 -0.173215 0.119209 -1.044236 + 2013-01-03 -0.861849 -2.104569 -0.494929 1.071804 + 2013-01-04 0.721555 -0.706771 -1.039575 0.271860 + 2013-01-05 -0.424972 0.567020 0.276232 -1.087401 + + [4 rows x 4 columns] + + In [28]: s.loc[-10:3] + Out[28]: + -2 0 + -1 1 + 1 2 + 2 3 + 3 4 + Length: 5, dtype: int64 + ``` +* Allow slicing with float-like values on an integer index for `.ix`. Previously this was only enabled for `.loc`: + + Previous behavior + + ```None + In [8]: s.ix[-1.0:2] + TypeError: the slice start value [-1.0] is not a proper indexer for this index type (Int64Index) + ``` + + New behavior + + ```None + In [2]: s.ix[-1.0:2] + Out[2]: + -1 1 + 1 2 + 2 3 + dtype: int64 + ``` +* Provide a useful exception for indexing with an invalid type for that index when using `.loc`. For example trying to use `.loc` on an index of type `DatetimeIndex` or `PeriodIndex` or `TimedeltaIndex`, with an integer (or a float). + + Previous behavior + + ```None + In [4]: df.loc[2:3] + KeyError: 'start bound [2] is not the [index]' + ``` + + New behavior + + ```None + In [4]: df.loc[2:3] + TypeError: Cannot do slice indexing on with keys + ``` + +### Categorical changes[#](#categorical-changes "Link to this heading") + +In prior versions, `Categoricals` that had an unspecified ordering (meaning no `ordered` keyword was passed) were defaulted as `ordered` Categoricals. Going forward, the `ordered` keyword in the `Categorical` constructor will default to `False`. Ordering must now be explicit. + +Furthermore, previously you *could* change the `ordered` attribute of a Categorical by just setting the attribute, e.g. `cat.ordered=True`; This is now deprecated and you should use `cat.as_ordered()` or `cat.as_unordered()`. These will by default return a **new** object and not modify the existing object. ([GH 9347](https://github.com/pandas-dev/pandas/issues/9347), [GH 9190](https://github.com/pandas-dev/pandas/issues/9190)) + +Previous behavior + +```None +In [3]: s = pd.Series([0, 1, 2], dtype='category') + +In [4]: s +Out[4]: +0 0 +1 1 +2 2 +dtype: category +Categories (3, int64): [0 < 1 < 2] + +In [5]: s.cat.ordered +Out[5]: True + +In [6]: s.cat.ordered = False + +In [7]: s +Out[7]: +0 0 +1 1 +2 2 +dtype: category +Categories (3, int64): [0, 1, 2] +``` + +New behavior + +```None +In [29]: s = pd.Series([0, 1, 2], dtype='category') + +In [30]: s +Out[30]: +0 0 +1 1 +2 2 +Length: 3, dtype: category +Categories (3, int64): [0, 1, 2] + +In [31]: s.cat.ordered +Out[31]: False + +In [32]: s = s.cat.as_ordered() + +In [33]: s +Out[33]: +0 0 +1 1 +2 2 +Length: 3, dtype: category +Categories (3, int64): [0 < 1 < 2] + +In [34]: s.cat.ordered +Out[34]: True + +# you can set in the constructor of the Categorical +In [35]: s = pd.Series(pd.Categorical([0, 1, 2], ordered=True)) + +In [36]: s +Out[36]: +0 0 +1 1 +2 2 +Length: 3, dtype: category +Categories (3, int64): [0 < 1 < 2] + +In [37]: s.cat.ordered +Out[37]: True +``` + +For ease of creation of series of categorical data, we have added the ability to pass keywords when calling `.astype()`. These are passed directly to the constructor. + +```None +In [54]: s = pd.Series(["a", "b", "c", "a"]).astype('category', ordered=True) + +In [55]: s +Out[55]: +0 a +1 b +2 c +3 a +dtype: category +Categories (3, object): [a < b < c] + +In [56]: s = (pd.Series(["a", "b", "c", "a"]) + ....: .astype('category', categories=list('abcdef'), ordered=False)) + +In [57]: s +Out[57]: +0 a +1 b +2 c +3 a +dtype: category +Categories (6, object): [a, b, c, d, e, f] +``` + +### Other API changes[#](#other-api-changes "Link to this heading") + +* `Index.duplicated` now returns `np.array(dtype=bool)` rather than `Index(dtype=object)` containing `bool` values. ([GH 8875](https://github.com/pandas-dev/pandas/issues/8875)) +* `DataFrame.to_json` now returns accurate type serialisation for each column for frames of mixed dtype ([GH 9037](https://github.com/pandas-dev/pandas/issues/9037)) + + Previously data was coerced to a common dtype before serialisation, which for + example resulted in integers being serialised to floats: + + ```None + In [2]: pd.DataFrame({'i': [1,2], 'f': [3.0, 4.2]}).to_json() + Out[2]: '{"f":{"0":3.0,"1":4.2},"i":{"0":1.0,"1":2.0}}' + ``` + + Now each column is serialised using its correct dtype: + + ```None + In [2]: pd.DataFrame({'i': [1,2], 'f': [3.0, 4.2]}).to_json() + Out[2]: '{"f":{"0":3.0,"1":4.2},"i":{"0":1,"1":2}}' + ``` +* `DatetimeIndex`, `PeriodIndex` and `TimedeltaIndex.summary` now output the same format. ([GH 9116](https://github.com/pandas-dev/pandas/issues/9116)) +* `TimedeltaIndex.freqstr` now output the same string format as `DatetimeIndex`. ([GH 9116](https://github.com/pandas-dev/pandas/issues/9116)) +* Bar and horizontal bar plots no longer add a dashed line along the info axis. The prior style can be achieved with matplotlib’s `axhline` or `axvline` methods ([GH 9088](https://github.com/pandas-dev/pandas/issues/9088)). +* `Series` accessors `.dt`, `.cat` and `.str` now raise `AttributeError` instead of `TypeError` if the series does not contain the appropriate type of data ([GH 9617](https://github.com/pandas-dev/pandas/issues/9617)). This follows Python’s built-in exception hierarchy more closely and ensures that tests like `hasattr(s, 'cat')` are consistent on both Python 2 and 3. +* `Series` now supports bitwise operation for integral types ([GH 9016](https://github.com/pandas-dev/pandas/issues/9016)). Previously even if the input dtypes were integral, the output dtype was coerced to `bool`. + + Previous behavior + + ```None + In [2]: pd.Series([0, 1, 2, 3], list('abcd')) | pd.Series([4, 4, 4, 4], list('abcd')) + Out[2]: + a True + b True + c True + d True + dtype: bool + ``` + + New behavior. If the input dtypes are integral, the output dtype is also integral and the output + values are the result of the bitwise operation. + + ```None + In [2]: pd.Series([0, 1, 2, 3], list('abcd')) | pd.Series([4, 4, 4, 4], list('abcd')) + Out[2]: + a 4 + b 5 + c 6 + d 7 + dtype: int64 + ``` +* During division involving a `Series` or `DataFrame`, `0/0` and `0//0` now give `np.nan` instead of `np.inf`. ([GH 9144](https://github.com/pandas-dev/pandas/issues/9144), [GH 8445](https://github.com/pandas-dev/pandas/issues/8445)) + + Previous behavior + + ```None + In [2]: p = pd.Series([0, 1]) + + In [3]: p / 0 + Out[3]: + 0 inf + 1 inf + dtype: float64 + + In [4]: p // 0 + Out[4]: + 0 inf + 1 inf + dtype: float64 + ``` + + New behavior + + ```None + In [38]: p = pd.Series([0, 1]) + + In [39]: p / 0 + Out[39]: + 0 NaN + 1 inf + Length: 2, dtype: float64 + + In [40]: p // 0 + Out[40]: + 0 NaN + 1 inf + Length: 2, dtype: float64 + ``` +* `Series.values_counts` and `Series.describe` for categorical data will now put `NaN` entries at the end. ([GH 9443](https://github.com/pandas-dev/pandas/issues/9443)) +* `Series.describe` for categorical data will now give counts and frequencies of 0, not `NaN`, for unused categories ([GH 9443](https://github.com/pandas-dev/pandas/issues/9443)) +* Due to a bug fix, looking up a partial string label with `DatetimeIndex.asof` now includes values that match the string, even if they are after the start of the partial string label ([GH 9258](https://github.com/pandas-dev/pandas/issues/9258)). + + Old behavior: + + ```None + In [4]: pd.to_datetime(['2000-01-31', '2000-02-28']).asof('2000-02') + Out[4]: Timestamp('2000-01-31 00:00:00') + ``` + + Fixed behavior: + + ```None + In [41]: pd.to_datetime(['2000-01-31', '2000-02-28']).asof('2000-02') + Out[41]: Timestamp('2000-02-28 00:00:00') + ``` + + To reproduce the old behavior, simply add more precision to the label (e.g., use `2000-02-01` instead of `2000-02`). + +### Deprecations[#](#deprecations "Link to this heading") + +* The `rplot` trellis plotting interface is deprecated and will be removed + in a future version. We refer to external packages like + [seaborn](http://stanford.edu/~mwaskom/software/seaborn/) for similar + but more refined functionality ([GH 3445](https://github.com/pandas-dev/pandas/issues/3445)). + The documentation includes some examples how to convert your existing code + from `rplot` to seaborn [here](https://pandas.pydata.org/pandas-docs/version/0.18.1/visualization.html#trellis-plotting-interface). +* The `pandas.sandbox.qtpandas` interface is deprecated and will be removed in a future version. + We refer users to the external package [pandas-qt](https://github.com/datalyze-solutions/pandas-qt). ([GH 9615](https://github.com/pandas-dev/pandas/issues/9615)) +* The `pandas.rpy` interface is deprecated and will be removed in a future version. + Similar functionality can be accessed through the [rpy2](http://rpy2.bitbucket.org/) project ([GH 9602](https://github.com/pandas-dev/pandas/issues/9602)) +* Adding `DatetimeIndex/PeriodIndex` to another `DatetimeIndex/PeriodIndex` is being deprecated as a set-operation. This will be changed to a `TypeError` in a future version. `.union()` should be used for the union set operation. ([GH 9094](https://github.com/pandas-dev/pandas/issues/9094)) +* Subtracting `DatetimeIndex/PeriodIndex` from another `DatetimeIndex/PeriodIndex` is being deprecated as a set-operation. This will be changed to an actual numeric subtraction yielding a `TimeDeltaIndex` in a future version. `.difference()` should be used for the differencing set operation. ([GH 9094](https://github.com/pandas-dev/pandas/issues/9094)) + +### Removal of prior version deprecations/changes[#](#removal-of-prior-version-deprecations-changes "Link to this heading") + +* `DataFrame.pivot_table` and `crosstab`’s `rows` and `cols` keyword arguments were removed in favor + of `index` and `columns` ([GH 6581](https://github.com/pandas-dev/pandas/issues/6581)) +* `DataFrame.to_excel` and `DataFrame.to_csv` `cols` keyword argument was removed in favor of `columns` ([GH 6581](https://github.com/pandas-dev/pandas/issues/6581)) +* Removed `convert_dummies` in favor of `get_dummies` ([GH 6581](https://github.com/pandas-dev/pandas/issues/6581)) +* Removed `value_range` in favor of `describe` ([GH 6581](https://github.com/pandas-dev/pandas/issues/6581)) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Fixed a performance regression for `.loc` indexing with an array or list-like ([GH 9126](https://github.com/pandas-dev/pandas/issues/9126):). +* `DataFrame.to_json` 30x performance improvement for mixed dtype frames. ([GH 9037](https://github.com/pandas-dev/pandas/issues/9037)) +* Performance improvements in `MultiIndex.duplicated` by working with labels instead of values ([GH 9125](https://github.com/pandas-dev/pandas/issues/9125)) +* Improved the speed of `nunique` by calling `unique` instead of `value_counts` ([GH 9129](https://github.com/pandas-dev/pandas/issues/9129), [GH 7771](https://github.com/pandas-dev/pandas/issues/7771)) +* Performance improvement of up to 10x in `DataFrame.count` and `DataFrame.dropna` by taking advantage of homogeneous/heterogeneous dtypes appropriately ([GH 9136](https://github.com/pandas-dev/pandas/issues/9136)) +* Performance improvement of up to 20x in `DataFrame.count` when using a `MultiIndex` and the `level` keyword argument ([GH 9163](https://github.com/pandas-dev/pandas/issues/9163)) +* Performance and memory usage improvements in `merge` when key space exceeds `int64` bounds ([GH 9151](https://github.com/pandas-dev/pandas/issues/9151)) +* Performance improvements in multi-key `groupby` ([GH 9429](https://github.com/pandas-dev/pandas/issues/9429)) +* Performance improvements in `MultiIndex.sortlevel` ([GH 9445](https://github.com/pandas-dev/pandas/issues/9445)) +* Performance and memory usage improvements in `DataFrame.duplicated` ([GH 9398](https://github.com/pandas-dev/pandas/issues/9398)) +* Cythonized `Period` ([GH 9440](https://github.com/pandas-dev/pandas/issues/9440)) +* Decreased memory usage on `to_hdf` ([GH 9648](https://github.com/pandas-dev/pandas/issues/9648)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Changed `.to_html` to remove leading/trailing spaces in table body ([GH 4987](https://github.com/pandas-dev/pandas/issues/4987)) +* Fixed issue using `read_csv` on s3 with Python 3 ([GH 9452](https://github.com/pandas-dev/pandas/issues/9452)) +* Fixed compatibility issue in `DatetimeIndex` affecting architectures where `numpy.int_` defaults to `numpy.int32` ([GH 8943](https://github.com/pandas-dev/pandas/issues/8943)) +* Bug in Panel indexing with an object-like ([GH 9140](https://github.com/pandas-dev/pandas/issues/9140)) +* Bug in the returned `Series.dt.components` index was reset to the default index ([GH 9247](https://github.com/pandas-dev/pandas/issues/9247)) +* Bug in `Categorical.__getitem__/__setitem__` with listlike input getting incorrect results from indexer coercion ([GH 9469](https://github.com/pandas-dev/pandas/issues/9469)) +* Bug in partial setting with a DatetimeIndex ([GH 9478](https://github.com/pandas-dev/pandas/issues/9478)) +* Bug in groupby for integer and datetime64 columns when applying an aggregator that caused the value to be + changed when the number was sufficiently large ([GH 9311](https://github.com/pandas-dev/pandas/issues/9311), [GH 6620](https://github.com/pandas-dev/pandas/issues/6620)) +* Fixed bug in `to_sql` when mapping a `Timestamp` object column (datetime + column with timezone info) to the appropriate sqlalchemy type ([GH 9085](https://github.com/pandas-dev/pandas/issues/9085)). +* Fixed bug in `to_sql` `dtype` argument not accepting an instantiated + SQLAlchemy type ([GH 9083](https://github.com/pandas-dev/pandas/issues/9083)). +* Bug in `.loc` partial setting with a `np.datetime64` ([GH 9516](https://github.com/pandas-dev/pandas/issues/9516)) +* Incorrect dtypes inferred on datetimelike looking `Series` & on `.xs` slices ([GH 9477](https://github.com/pandas-dev/pandas/issues/9477)) +* Items in `Categorical.unique()` (and `s.unique()` if `s` is of dtype `category`) now appear in the order in which they are originally found, not in sorted order ([GH 9331](https://github.com/pandas-dev/pandas/issues/9331)). This is now consistent with the behavior for other dtypes in pandas. +* Fixed bug on big endian platforms which produced incorrect results in `StataReader` ([GH 8688](https://github.com/pandas-dev/pandas/issues/8688)). +* Bug in `MultiIndex.has_duplicates` when having many levels causes an indexer overflow ([GH 9075](https://github.com/pandas-dev/pandas/issues/9075), [GH 5873](https://github.com/pandas-dev/pandas/issues/5873)) +* Bug in `pivot` and `unstack` where `nan` values would break index alignment ([GH 4862](https://github.com/pandas-dev/pandas/issues/4862), [GH 7401](https://github.com/pandas-dev/pandas/issues/7401), [GH 7403](https://github.com/pandas-dev/pandas/issues/7403), [GH 7405](https://github.com/pandas-dev/pandas/issues/7405), [GH 7466](https://github.com/pandas-dev/pandas/issues/7466), [GH 9497](https://github.com/pandas-dev/pandas/issues/9497)) +* Bug in left `join` on MultiIndex with `sort=True` or null values ([GH 9210](https://github.com/pandas-dev/pandas/issues/9210)). +* Bug in `MultiIndex` where inserting new keys would fail ([GH 9250](https://github.com/pandas-dev/pandas/issues/9250)). +* Bug in `groupby` when key space exceeds `int64` bounds ([GH 9096](https://github.com/pandas-dev/pandas/issues/9096)). +* Bug in `unstack` with `TimedeltaIndex` or `DatetimeIndex` and nulls ([GH 9491](https://github.com/pandas-dev/pandas/issues/9491)). +* Bug in `rank` where comparing floats with tolerance will cause inconsistent behaviour ([GH 8365](https://github.com/pandas-dev/pandas/issues/8365)). +* Fixed character encoding bug in `read_stata` and `StataReader` when loading data from a URL ([GH 9231](https://github.com/pandas-dev/pandas/issues/9231)). +* Bug in adding `offsets.Nano` to other offsets raises `TypeError` ([GH 9284](https://github.com/pandas-dev/pandas/issues/9284)) +* Bug in `DatetimeIndex` iteration, related to ([GH 8890](https://github.com/pandas-dev/pandas/issues/8890)), fixed in ([GH 9100](https://github.com/pandas-dev/pandas/issues/9100)) +* Bugs in `resample` around DST transitions. This required fixing offset classes so they behave correctly on DST transitions. ([GH 5172](https://github.com/pandas-dev/pandas/issues/5172), [GH 8744](https://github.com/pandas-dev/pandas/issues/8744), [GH 8653](https://github.com/pandas-dev/pandas/issues/8653), [GH 9173](https://github.com/pandas-dev/pandas/issues/9173), [GH 9468](https://github.com/pandas-dev/pandas/issues/9468)). +* Bug in binary operator method (eg `.mul()`) alignment with integer levels ([GH 9463](https://github.com/pandas-dev/pandas/issues/9463)). +* Bug in boxplot, scatter and hexbin plot may show an unnecessary warning ([GH 8877](https://github.com/pandas-dev/pandas/issues/8877)) +* Bug in subplot with `layout` kw may show unnecessary warning ([GH 9464](https://github.com/pandas-dev/pandas/issues/9464)) +* Bug in using grouper functions that need passed through arguments (e.g. axis), when using wrapped function (e.g. `fillna`), ([GH 9221](https://github.com/pandas-dev/pandas/issues/9221)) +* `DataFrame` now properly supports simultaneous `copy` and `dtype` arguments in constructor ([GH 9099](https://github.com/pandas-dev/pandas/issues/9099)) +* Bug in `read_csv` when using skiprows on a file with CR line endings with the c engine. ([GH 9079](https://github.com/pandas-dev/pandas/issues/9079)) +* `isnull` now detects `NaT` in `PeriodIndex` ([GH 9129](https://github.com/pandas-dev/pandas/issues/9129)) +* Bug in groupby `.nth()` with a multiple column groupby ([GH 8979](https://github.com/pandas-dev/pandas/issues/8979)) +* Bug in `DataFrame.where` and `Series.where` coerce numerics to string incorrectly ([GH 9280](https://github.com/pandas-dev/pandas/issues/9280)) +* Bug in `DataFrame.where` and `Series.where` raise `ValueError` when string list-like is passed. ([GH 9280](https://github.com/pandas-dev/pandas/issues/9280)) +* Accessing `Series.str` methods on with non-string values now raises `TypeError` instead of producing incorrect results ([GH 9184](https://github.com/pandas-dev/pandas/issues/9184)) +* Bug in `DatetimeIndex.__contains__` when index has duplicates and is not monotonic increasing ([GH 9512](https://github.com/pandas-dev/pandas/issues/9512)) +* Fixed division by zero error for `Series.kurt()` when all values are equal ([GH 9197](https://github.com/pandas-dev/pandas/issues/9197)) +* Fixed issue in the `xlsxwriter` engine where it added a default ‘General’ format to cells if no other format was applied. This prevented other row or column formatting being applied. ([GH 9167](https://github.com/pandas-dev/pandas/issues/9167)) +* Fixes issue with `index_col=False` when `usecols` is also specified in `read_csv`. ([GH 9082](https://github.com/pandas-dev/pandas/issues/9082)) +* Bug where `wide_to_long` would modify the input stub names list ([GH 9204](https://github.com/pandas-dev/pandas/issues/9204)) +* Bug in `to_sql` not storing float64 values using double precision. ([GH 9009](https://github.com/pandas-dev/pandas/issues/9009)) +* `SparseSeries` and `SparsePanel` now accept zero argument constructors (same as their non-sparse counterparts) ([GH 9272](https://github.com/pandas-dev/pandas/issues/9272)). +* Regression in merging `Categorical` and `object` dtypes ([GH 9426](https://github.com/pandas-dev/pandas/issues/9426)) +* Bug in `read_csv` with buffer overflows with certain malformed input files ([GH 9205](https://github.com/pandas-dev/pandas/issues/9205)) +* Bug in groupby MultiIndex with missing pair ([GH 9049](https://github.com/pandas-dev/pandas/issues/9049), [GH 9344](https://github.com/pandas-dev/pandas/issues/9344)) +* Fixed bug in `Series.groupby` where grouping on `MultiIndex` levels would ignore the sort argument ([GH 9444](https://github.com/pandas-dev/pandas/issues/9444)) +* Fix bug in `DataFrame.Groupby` where `sort=False` is ignored in the case of Categorical columns. ([GH 8868](https://github.com/pandas-dev/pandas/issues/8868)) +* Fixed bug with reading CSV files from Amazon S3 on python 3 raising a TypeError ([GH 9452](https://github.com/pandas-dev/pandas/issues/9452)) +* Bug in the Google BigQuery reader where the ‘jobComplete’ key may be present but False in the query results ([GH 8728](https://github.com/pandas-dev/pandas/issues/8728)) +* Bug in `Series.values_counts` with excluding `NaN` for categorical type `Series` with `dropna=True` ([GH 9443](https://github.com/pandas-dev/pandas/issues/9443)) +* Fixed missing numeric\_only option for `DataFrame.std/var/sem` ([GH 9201](https://github.com/pandas-dev/pandas/issues/9201)) +* Support constructing `Panel` or `Panel4D` with scalar data ([GH 8285](https://github.com/pandas-dev/pandas/issues/8285)) +* `Series` text representation disconnected from `max_rows`/`max_columns` ([GH 7508](https://github.com/pandas-dev/pandas/issues/7508)). + +* `Series` number formatting inconsistent when truncated ([GH 8532](https://github.com/pandas-dev/pandas/issues/8532)). + + Previous behavior + + ```None + In [2]: pd.options.display.max_rows = 10 + In [3]: s = pd.Series([1,1,1,1,1,1,1,1,1,1,0.9999,1,1]*10) + In [4]: s + Out[4]: + 0 1 + 1 1 + 2 1 + ... + 127 0.9999 + 128 1.0000 + 129 1.0000 + Length: 130, dtype: float64 + ``` + + New behavior + + ```None + 0 1.0000 + 1 1.0000 + 2 1.0000 + 3 1.0000 + 4 1.0000 + ... + 125 1.0000 + 126 1.0000 + 127 0.9999 + 128 1.0000 + 129 1.0000 + dtype: float64 + ``` +* A Spurious `SettingWithCopy` Warning was generated when setting a new item in a frame in some cases ([GH 8730](https://github.com/pandas-dev/pandas/issues/8730)) + + The following would previously report a `SettingWithCopy` Warning. + + ```None + In [42]: df1 = pd.DataFrame({'x': pd.Series(['a', 'b', 'c']), + ....: 'y': pd.Series(['d', 'e', 'f'])}) + ....: + + In [43]: df2 = df1[['x']] + + In [44]: df2['y'] = ['g', 'h', 'i'] + ``` + +## Contributors[#](#contributors "Link to this heading") + +A total of 60 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Aaron Toth + +* Alan Du + +* Alessandro Amici + +* Artemy Kolchinsky +* Ashwini Chaudhary + +* Ben Schiller +* Bill Letson +* Brandon Bradley + +* Chau Hoang + +* Chris Reynolds +* Chris Whelan + +* Christer van der Meeren + +* David Cottrell + +* David Stephens +* Ehsan Azarnasab + +* Garrett-R + +* Guillaume Gay +* Jake Torcasso + +* Jason Sexauer +* Jeff Reback +* John McNamara +* Joris Van den Bossche +* Joschka zur Jacobsmühlen + +* Juarez Bochi + +* Junya Hayashi + +* K.-Michael Aye +* Kerby Shedden + +* Kevin Sheppard +* Kieran O’Mahony +* Kodi Arfer + +* Matti Airas + +* Min RK + +* Mortada Mehyar +* Robert + +* Scott E Lasley +* Scott Lasley + +* Sergio Pascual + +* Skipper Seabold +* Stephan Hoyer +* Thomas Grainger +* Tom Augspurger +* TomAugspurger +* Vladimir Filimonov + +* Vyomkesh Tripathi + +* Will Holmgren +* Yulong Yang + +* behzad nouri +* bertrandhaut + +* bjonen +* cel4 + +* clham +* hsperr + +* ischwabacher +* jnmclarty +* josham + +* jreback +* omtinez + +* roch + +* sinhrks +* unutbu diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.16.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.16.1.md new file mode 100644 index 0000000000000000000000000000000000000000..b32090fdd9d6fd77d3c0e38ee8525ae8384ff71d --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.16.1.md @@ -0,0 +1,617 @@ +# What's new in pandas 0.16.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.16.1.html + +# Version 0.16.1 (May 11, 2015)[#](#version-0-16-1-may-11-2015 "Link to this heading") + +This is a minor bug-fix release from 0.16.0 and includes a large number of +bug fixes along several new features, enhancements, and performance improvements. +We recommend that all users upgrade to this version. + +Highlights include: + +* Support for a `CategoricalIndex`, a category based index, see [here](#whatsnew-0161-enhancements-categoricalindex) +* New section on how-to-contribute to *pandas*, see [here](../development/contributing.html#contributing) +* Revised “Merge, join, and concatenate” documentation, including graphical examples to make it easier to understand each operations, see [here](../user_guide/merging.html#merging) +* New method `sample` for drawing random samples from Series, DataFrames and Panels. See [here](#whatsnew-0161-enhancements-sample) +* The default `Index` printing has changed to a more uniform format, see [here](#whatsnew-0161-index-repr) +* `BusinessHour` datetime-offset is now supported, see [here](../user_guide/timeseries.html#timeseries-businesshour) +* Further enhancement to the `.str` accessor to make string operations easier, see [here](#whatsnew-0161-enhancements-string) + +What’s new in v0.16.1 + +* [Enhancements](#enhancements) + + + [CategoricalIndex](#categoricalindex) + + [Sample](#sample) + + [String methods enhancements](#string-methods-enhancements) + + [Other enhancements](#other-enhancements) +* [API changes](#api-changes) + + + [Deprecations](#deprecations) +* [Index representation](#index-representation) +* [Performance improvements](#performance-improvements) +* [Bug fixes](#bug-fixes) +* [Contributors](#contributors) + +Warning + +In pandas 0.17.0, the sub-package `pandas.io.data` will be removed in favor of a separately installable package ([GH 8961](https://github.com/pandas-dev/pandas/issues/8961)). + +## Enhancements[#](#enhancements "Link to this heading") + +### CategoricalIndex[#](#categoricalindex "Link to this heading") + +We introduce a `CategoricalIndex`, a new type of index object that is useful for supporting +indexing with duplicates. This is a container around a `Categorical` (introduced in v0.15.0) +and allows efficient indexing and storage of an index with a large number of duplicated elements. Prior to 0.16.1, +setting the index of a `DataFrame/Series` with a `category` dtype would convert this to regular object-based `Index`. + +```None +In [1]: df = pd.DataFrame({'A': np.arange(6), + ...: 'B': pd.Series(list('aabbca')) + ...: .astype('category', categories=list('cab')) + ...: }) + ...: + +In [2]: df +Out[2]: + A B +0 0 a +1 1 a +2 2 b +3 3 b +4 4 c +5 5 a + +In [3]: df.dtypes +Out[3]: +A int64 +B category +dtype: object + +In [4]: df.B.cat.categories +Out[4]: Index(['c', 'a', 'b'], dtype='object') +``` + +setting the index, will create a `CategoricalIndex` + +```None +In [5]: df2 = df.set_index('B') + +In [6]: df2.index +Out[6]: CategoricalIndex(['a', 'a', 'b', 'b', 'c', 'a'], categories=['c', 'a', 'b'], ordered=False, name='B', dtype='category') +``` + +indexing with `__getitem__/.iloc/.loc/.ix` works similarly to an Index with duplicates. +The indexers MUST be in the category or the operation will raise. + +```None +In [7]: df2.loc['a'] +Out[7]: + A +B +a 0 +a 1 +a 5 +``` + +and preserves the `CategoricalIndex` + +```None +In [8]: df2.loc['a'].index +Out[8]: CategoricalIndex(['a', 'a', 'a'], categories=['c', 'a', 'b'], ordered=False, name='B', dtype='category') +``` + +sorting will order by the order of the categories + +```None +In [9]: df2.sort_index() +Out[9]: + A +B +c 4 +a 0 +a 1 +a 5 +b 2 +b 3 +``` + +groupby operations on the index will preserve the index nature as well + +```None +In [10]: df2.groupby(level=0).sum() +Out[10]: + A +B +c 4 +a 6 +b 5 + +In [11]: df2.groupby(level=0).sum().index +Out[11]: CategoricalIndex(['c', 'a', 'b'], categories=['c', 'a', 'b'], ordered=False, name='B', dtype='category') +``` + +reindexing operations, will return a resulting index based on the type of the passed +indexer, meaning that passing a list will return a plain-old-`Index`; indexing with +a `Categorical` will return a `CategoricalIndex`, indexed according to the categories +of the PASSED `Categorical` dtype. This allows one to arbitrarily index these even with +values NOT in the categories, similarly to how you can reindex ANY pandas index. + +```None +In [12]: df2.reindex(['a', 'e']) +Out[12]: + A +B +a 0.0 +a 1.0 +a 5.0 +e NaN + +In [13]: df2.reindex(['a', 'e']).index +Out[13]: pd.Index(['a', 'a', 'a', 'e'], dtype='object', name='B') + +In [14]: df2.reindex(pd.Categorical(['a', 'e'], categories=list('abcde'))) +Out[14]: + A +B +a 0.0 +a 1.0 +a 5.0 +e NaN + +In [15]: df2.reindex(pd.Categorical(['a', 'e'], categories=list('abcde'))).index +Out[15]: pd.CategoricalIndex(['a', 'a', 'a', 'e'], + categories=['a', 'b', 'c', 'd', 'e'], + ordered=False, name='B', + dtype='category') +``` + +See the [documentation](../user_guide/advanced.html#advanced-categoricalindex) for more. ([GH 7629](https://github.com/pandas-dev/pandas/issues/7629), [GH 10038](https://github.com/pandas-dev/pandas/issues/10038), [GH 10039](https://github.com/pandas-dev/pandas/issues/10039)) + +### Sample[#](#sample "Link to this heading") + +Series, DataFrames, and Panels now have a new method: [`sample()`](../reference/api/pandas.DataFrame.sample.html#pandas.DataFrame.sample "pandas.DataFrame.sample"). +The method accepts a specific number of rows or columns to return, or a fraction of the +total number or rows or columns. It also has options for sampling with or without replacement, +for passing in a column for weights for non-uniform sampling, and for setting seed values to +facilitate replication. ([GH 2419](https://github.com/pandas-dev/pandas/issues/2419)) + +```None +In [1]: example_series = pd.Series([0, 1, 2, 3, 4, 5]) + +# When no arguments are passed, returns 1 +In [2]: example_series.sample() +Out[2]: +3 3 +Length: 1, dtype: int64 + +# One may specify either a number of rows: +In [3]: example_series.sample(n=3) +Out[3]: +2 2 +1 1 +0 0 +Length: 3, dtype: int64 + +# Or a fraction of the rows: +In [4]: example_series.sample(frac=0.5) +Out[4]: +1 1 +5 5 +3 3 +Length: 3, dtype: int64 + +# weights are accepted. +In [5]: example_weights = [0, 0, 0.2, 0.2, 0.2, 0.4] + +In [6]: example_series.sample(n=3, weights=example_weights) +Out[6]: +2 2 +4 4 +3 3 +Length: 3, dtype: int64 + +# weights will also be normalized if they do not sum to one, +# and missing values will be treated as zeros. +In [7]: example_weights2 = [0.5, 0, 0, 0, None, np.nan] + +In [8]: example_series.sample(n=1, weights=example_weights2) +Out[8]: +0 0 +Length: 1, dtype: int64 +``` + +When applied to a DataFrame, one may pass the name of a column to specify sampling weights +when sampling from rows. + +```None +In [9]: df = pd.DataFrame({"col1": [9, 8, 7, 6], "weight_column": [0.5, 0.4, 0.1, 0]}) + +In [10]: df.sample(n=3, weights="weight_column") +Out[10]: + col1 weight_column +0 9 0.5 +1 8 0.4 +2 7 0.1 + +[3 rows x 2 columns] +``` + +### String methods enhancements[#](#string-methods-enhancements "Link to this heading") + +[Continuing from v0.16.0](v0.16.0.html#whatsnew-0160-enhancements-string), the following +enhancements make string operations easier and more consistent with standard python string operations. + +* Added `StringMethods` (`.str` accessor) to `Index` ([GH 9068](https://github.com/pandas-dev/pandas/issues/9068)) + + The `.str` accessor is now available for both `Series` and `Index`. + + ```None + In [11]: idx = pd.Index([" jack", "jill ", " jesse ", "frank"]) + + In [12]: idx.str.strip() + Out[12]: Index(['jack', 'jill', 'jesse', 'frank'], dtype='object') + ``` + + One special case for the `.str` accessor on `Index` is that if a string method returns `bool`, the `.str` accessor + will return a `np.array` instead of a boolean `Index` ([GH 8875](https://github.com/pandas-dev/pandas/issues/8875)). This enables the following expression + to work naturally: + + ```None + In [13]: idx = pd.Index(["a1", "a2", "b1", "b2"]) + + In [14]: s = pd.Series(range(4), index=idx) + + In [15]: s + Out[15]: + a1 0 + a2 1 + b1 2 + b2 3 + Length: 4, dtype: int64 + + In [16]: idx.str.startswith("a") + Out[16]: array([ True, True, False, False]) + + In [17]: s[s.index.str.startswith("a")] + Out[17]: + a1 0 + a2 1 + Length: 2, dtype: int64 + ``` +* The following new methods are accessible via `.str` accessor to apply the function to each values. ([GH 9766](https://github.com/pandas-dev/pandas/issues/9766), [GH 9773](https://github.com/pandas-dev/pandas/issues/9773), [GH 10031](https://github.com/pandas-dev/pandas/issues/10031), [GH 10045](https://github.com/pandas-dev/pandas/issues/10045), [GH 10052](https://github.com/pandas-dev/pandas/issues/10052)) + + | | | Methods | | | + | --- | --- | --- | --- | --- | + | `capitalize()` | `swapcase()` | `normalize()` | `partition()` | `rpartition()` | + | `index()` | `rindex()` | `translate()` | | | +* `split` now takes `expand` keyword to specify whether to expand dimensionality. `return_type` is deprecated. ([GH 9847](https://github.com/pandas-dev/pandas/issues/9847)) + + ```None + In [18]: s = pd.Series(["a,b", "a,c", "b,c"]) + + # return Series + In [19]: s.str.split(",") + Out[19]: + 0 [a, b] + 1 [a, c] + 2 [b, c] + Length: 3, dtype: object + + # return DataFrame + In [20]: s.str.split(",", expand=True) + Out[20]: + 0 1 + 0 a b + 1 a c + 2 b c + + [3 rows x 2 columns] + + In [21]: idx = pd.Index(["a,b", "a,c", "b,c"]) + + # return Index + In [22]: idx.str.split(",") + Out[22]: Index([['a', 'b'], ['a', 'c'], ['b', 'c']], dtype='object') + + # return MultiIndex + In [23]: idx.str.split(",", expand=True) + Out[23]: + MultiIndex([('a', 'b'), + ('a', 'c'), + ('b', 'c')], + ) + ``` +* Improved `extract` and `get_dummies` methods for `Index.str` ([GH 9980](https://github.com/pandas-dev/pandas/issues/9980)) + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* `BusinessHour` offset is now supported, which represents business hours starting from 09:00 - 17:00 on `BusinessDay` by default. See [Here](../user_guide/timeseries.html#timeseries-businesshour) for details. ([GH 7905](https://github.com/pandas-dev/pandas/issues/7905)) + + ```None + In [24]: pd.Timestamp("2014-08-01 09:00") + pd.tseries.offsets.BusinessHour() + Out[24]: Timestamp('2014-08-01 10:00:00') + + In [25]: pd.Timestamp("2014-08-01 07:00") + pd.tseries.offsets.BusinessHour() + Out[25]: Timestamp('2014-08-01 10:00:00') + + In [26]: pd.Timestamp("2014-08-01 16:30") + pd.tseries.offsets.BusinessHour() + Out[26]: Timestamp('2014-08-04 09:30:00') + ``` +* `DataFrame.diff` now takes an `axis` parameter that determines the direction of differencing ([GH 9727](https://github.com/pandas-dev/pandas/issues/9727)) +* Allow `clip`, `clip_lower`, and `clip_upper` to accept array-like arguments as thresholds (This is a regression from 0.11.0). These methods now have an `axis` parameter which determines how the Series or DataFrame will be aligned with the threshold(s). ([GH 6966](https://github.com/pandas-dev/pandas/issues/6966)) +* `DataFrame.mask()` and `Series.mask()` now support same keywords as `where` ([GH 8801](https://github.com/pandas-dev/pandas/issues/8801)) +* `drop` function can now accept `errors` keyword to suppress `ValueError` raised when any of label does not exist in the target data. ([GH 6736](https://github.com/pandas-dev/pandas/issues/6736)) + + ```None + In [27]: df = pd.DataFrame(np.random.randn(3, 3), columns=["A", "B", "C"]) + + In [28]: df.drop(["A", "X"], axis=1, errors="ignore") + Out[28]: + B C + 0 -0.706771 -1.039575 + 1 -0.424972 0.567020 + 2 -1.087401 -0.673690 + + [3 rows x 2 columns] + ``` +* Add support for separating years and quarters using dashes, for + example 2014-Q1. ([GH 9688](https://github.com/pandas-dev/pandas/issues/9688)) +* Allow conversion of values with dtype `datetime64` or `timedelta64` to strings using `astype(str)` ([GH 9757](https://github.com/pandas-dev/pandas/issues/9757)) +* `get_dummies` function now accepts `sparse` keyword. If set to `True`, the return `DataFrame` is sparse, e.g. `SparseDataFrame`. ([GH 8823](https://github.com/pandas-dev/pandas/issues/8823)) +* `Period` now accepts `datetime64` as value input. ([GH 9054](https://github.com/pandas-dev/pandas/issues/9054)) +* Allow timedelta string conversion when leading zero is missing from time definition, ie `0:00:00` vs `00:00:00`. ([GH 9570](https://github.com/pandas-dev/pandas/issues/9570)) +* Allow `Panel.shift` with `axis='items'` ([GH 9890](https://github.com/pandas-dev/pandas/issues/9890)) +* Trying to write an excel file now raises `NotImplementedError` if the `DataFrame` has a `MultiIndex` instead of writing a broken Excel file. ([GH 9794](https://github.com/pandas-dev/pandas/issues/9794)) +* Allow `Categorical.add_categories` to accept `Series` or `np.array`. ([GH 9927](https://github.com/pandas-dev/pandas/issues/9927)) +* Add/delete `str/dt/cat` accessors dynamically from `__dir__`. ([GH 9910](https://github.com/pandas-dev/pandas/issues/9910)) +* Add `normalize` as a `dt` accessor method. ([GH 10047](https://github.com/pandas-dev/pandas/issues/10047)) +* `DataFrame` and `Series` now have `_constructor_expanddim` property as overridable constructor for one higher dimensionality data. This should be used only when it is really needed, see [here](../development/extending.html#extending-subclassing-pandas) +* `pd.lib.infer_dtype` now returns `'bytes'` in Python 3 where appropriate. ([GH 10032](https://github.com/pandas-dev/pandas/issues/10032)) + +## API changes[#](#api-changes "Link to this heading") + +* When passing in an ax to `df.plot( ..., ax=ax)`, the `sharex` kwarg will now default to `False`. + The result is that the visibility of xlabels and xticklabels will not anymore be changed. You + have to do that by yourself for the right axes in your figure or set `sharex=True` explicitly + (but this changes the visible for all axes in the figure, not only the one which is passed in!). + If pandas creates the subplots itself (e.g. no passed in `ax` kwarg), then the + default is still `sharex=True` and the visibility changes are applied. +* [`assign()`](../reference/api/pandas.DataFrame.assign.html#pandas.DataFrame.assign "pandas.DataFrame.assign") now inserts new columns in alphabetical order. Previously + the order was arbitrary. ([GH 9777](https://github.com/pandas-dev/pandas/issues/9777)) +* By default, `read_csv` and `read_table` will now try to infer the compression type based on the file extension. Set `compression=None` to restore the previous behavior (no decompression). ([GH 9770](https://github.com/pandas-dev/pandas/issues/9770)) + +### Deprecations[#](#deprecations "Link to this heading") + +* `Series.str.split`’s `return_type` keyword was removed in favor of `expand` ([GH 9847](https://github.com/pandas-dev/pandas/issues/9847)) + +## Index representation[#](#index-representation "Link to this heading") + +The string representation of `Index` and its sub-classes have now been unified. These will show a single-line display if there are few values; a wrapped multi-line display for a lot of values (but less than `display.max_seq_items`; if lots of items (> `display.max_seq_items`) will show a truncated display (the head and tail of the data). The formatting for `MultiIndex` is unchanged (a multi-line wrapped display). The display width responds to the option `display.max_seq_items`, which is defaulted to 100. ([GH 6482](https://github.com/pandas-dev/pandas/issues/6482)) + +Previous behavior + +```None +In [2]: pd.Index(range(4), name='foo') +Out[2]: Int64Index([0, 1, 2, 3], dtype='int64') + +In [3]: pd.Index(range(104), name='foo') +Out[3]: Int64Index([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...], dtype='int64') + +In [4]: pd.date_range('20130101', periods=4, name='foo', tz='US/Eastern') +Out[4]: + +[2013-01-01 00:00:00-05:00, ..., 2013-01-04 00:00:00-05:00] +Length: 4, Freq: D, Timezone: US/Eastern + +In [5]: pd.date_range('20130101', periods=104, name='foo', tz='US/Eastern') +Out[5]: + +[2013-01-01 00:00:00-05:00, ..., 2013-04-14 00:00:00-04:00] +Length: 104, Freq: D, Timezone: US/Eastern +``` + +New behavior + +```None +In [29]: pd.set_option("display.width", 80) + +In [30]: pd.Index(range(4), name="foo") +Out[30]: RangeIndex(start=0, stop=4, step=1, name='foo') + +In [31]: pd.Index(range(30), name="foo") +Out[31]: RangeIndex(start=0, stop=30, step=1, name='foo') + +In [32]: pd.Index(range(104), name="foo") +Out[32]: RangeIndex(start=0, stop=104, step=1, name='foo') + +In [33]: pd.CategoricalIndex(["a", "bb", "ccc", "dddd"], ordered=True, name="foobar") +Out[33]: CategoricalIndex(['a', 'bb', 'ccc', 'dddd'], categories=['a', 'bb', 'ccc', 'dddd'], ordered=True, dtype='category', name='foobar') + +In [34]: pd.CategoricalIndex(["a", "bb", "ccc", "dddd"] * 10, ordered=True, name="foobar") +Out[34]: +CategoricalIndex(['a', 'bb', 'ccc', 'dddd', 'a', 'bb', 'ccc', 'dddd', 'a', + 'bb', 'ccc', 'dddd', 'a', 'bb', 'ccc', 'dddd', 'a', 'bb', + 'ccc', 'dddd', 'a', 'bb', 'ccc', 'dddd', 'a', 'bb', 'ccc', + 'dddd', 'a', 'bb', 'ccc', 'dddd', 'a', 'bb', 'ccc', 'dddd', + 'a', 'bb', 'ccc', 'dddd'], + categories=['a', 'bb', 'ccc', 'dddd'], ordered=True, dtype='category', name='foobar') + +In [35]: pd.CategoricalIndex(["a", "bb", "ccc", "dddd"] * 100, ordered=True, name="foobar") +Out[35]: +CategoricalIndex(['a', 'bb', 'ccc', 'dddd', 'a', 'bb', 'ccc', 'dddd', 'a', + 'bb', + ... + 'ccc', 'dddd', 'a', 'bb', 'ccc', 'dddd', 'a', 'bb', 'ccc', + 'dddd'], + categories=['a', 'bb', 'ccc', 'dddd'], ordered=True, dtype='category', name='foobar', length=400) + +In [36]: pd.date_range("20130101", periods=4, name="foo", tz="US/Eastern") +Out[36]: +DatetimeIndex(['2013-01-01 00:00:00-05:00', '2013-01-02 00:00:00-05:00', + '2013-01-03 00:00:00-05:00', '2013-01-04 00:00:00-05:00'], + dtype='datetime64[ns, US/Eastern]', name='foo', freq='D') + +In [37]: pd.date_range("20130101", periods=25, freq="D") +Out[37]: +DatetimeIndex(['2013-01-01', '2013-01-02', '2013-01-03', '2013-01-04', + '2013-01-05', '2013-01-06', '2013-01-07', '2013-01-08', + '2013-01-09', '2013-01-10', '2013-01-11', '2013-01-12', + '2013-01-13', '2013-01-14', '2013-01-15', '2013-01-16', + '2013-01-17', '2013-01-18', '2013-01-19', '2013-01-20', + '2013-01-21', '2013-01-22', '2013-01-23', '2013-01-24', + '2013-01-25'], + dtype='datetime64[ns]', freq='D') + +In [38]: pd.date_range("20130101", periods=104, name="foo", tz="US/Eastern") +Out[38]: +DatetimeIndex(['2013-01-01 00:00:00-05:00', '2013-01-02 00:00:00-05:00', + '2013-01-03 00:00:00-05:00', '2013-01-04 00:00:00-05:00', + '2013-01-05 00:00:00-05:00', '2013-01-06 00:00:00-05:00', + '2013-01-07 00:00:00-05:00', '2013-01-08 00:00:00-05:00', + '2013-01-09 00:00:00-05:00', '2013-01-10 00:00:00-05:00', + ... + '2013-04-05 00:00:00-04:00', '2013-04-06 00:00:00-04:00', + '2013-04-07 00:00:00-04:00', '2013-04-08 00:00:00-04:00', + '2013-04-09 00:00:00-04:00', '2013-04-10 00:00:00-04:00', + '2013-04-11 00:00:00-04:00', '2013-04-12 00:00:00-04:00', + '2013-04-13 00:00:00-04:00', '2013-04-14 00:00:00-04:00'], + dtype='datetime64[ns, US/Eastern]', name='foo', length=104, freq='D') +``` + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Improved csv write performance with mixed dtypes, including datetimes by up to 5x ([GH 9940](https://github.com/pandas-dev/pandas/issues/9940)) +* Improved csv write performance generally by 2x ([GH 9940](https://github.com/pandas-dev/pandas/issues/9940)) +* Improved the performance of `pd.lib.max_len_string_array` by 5-7x ([GH 10024](https://github.com/pandas-dev/pandas/issues/10024)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug where labels did not appear properly in the legend of `DataFrame.plot()`, passing `label=` arguments works, and Series indices are no longer mutated. ([GH 9542](https://github.com/pandas-dev/pandas/issues/9542)) +* Bug in json serialization causing a segfault when a frame had zero length. ([GH 9805](https://github.com/pandas-dev/pandas/issues/9805)) +* Bug in `read_csv` where missing trailing delimiters would cause segfault. ([GH 5664](https://github.com/pandas-dev/pandas/issues/5664)) +* Bug in retaining index name on appending ([GH 9862](https://github.com/pandas-dev/pandas/issues/9862)) +* Bug in `scatter_matrix` draws unexpected axis ticklabels ([GH 5662](https://github.com/pandas-dev/pandas/issues/5662)) +* Fixed bug in `StataWriter` resulting in changes to input `DataFrame` upon save ([GH 9795](https://github.com/pandas-dev/pandas/issues/9795)). +* Bug in `transform` causing length mismatch when null entries were present and a fast aggregator was being used ([GH 9697](https://github.com/pandas-dev/pandas/issues/9697)) +* Bug in `equals` causing false negatives when block order differed ([GH 9330](https://github.com/pandas-dev/pandas/issues/9330)) +* Bug in grouping with multiple `pd.Grouper` where one is non-time based ([GH 10063](https://github.com/pandas-dev/pandas/issues/10063)) +* Bug in `read_sql_table` error when reading postgres table with timezone ([GH 7139](https://github.com/pandas-dev/pandas/issues/7139)) +* Bug in `DataFrame` slicing may not retain metadata ([GH 9776](https://github.com/pandas-dev/pandas/issues/9776)) +* Bug where `TimdeltaIndex` were not properly serialized in fixed `HDFStore` ([GH 9635](https://github.com/pandas-dev/pandas/issues/9635)) +* Bug with `TimedeltaIndex` constructor ignoring `name` when given another `TimedeltaIndex` as data ([GH 10025](https://github.com/pandas-dev/pandas/issues/10025)). +* Bug in `DataFrameFormatter._get_formatted_index` with not applying `max_colwidth` to the `DataFrame` index ([GH 7856](https://github.com/pandas-dev/pandas/issues/7856)) +* Bug in `.loc` with a read-only ndarray data source ([GH 10043](https://github.com/pandas-dev/pandas/issues/10043)) +* Bug in `groupby.apply()` that would raise if a passed user defined function either returned only `None` (for all input). ([GH 9685](https://github.com/pandas-dev/pandas/issues/9685)) +* Always use temporary files in pytables tests ([GH 9992](https://github.com/pandas-dev/pandas/issues/9992)) +* Bug in plotting continuously using `secondary_y` may not show legend properly. ([GH 9610](https://github.com/pandas-dev/pandas/issues/9610), [GH 9779](https://github.com/pandas-dev/pandas/issues/9779)) +* Bug in `DataFrame.plot(kind="hist")` results in `TypeError` when `DataFrame` contains non-numeric columns ([GH 9853](https://github.com/pandas-dev/pandas/issues/9853)) +* Bug where repeated plotting of `DataFrame` with a `DatetimeIndex` may raise `TypeError` ([GH 9852](https://github.com/pandas-dev/pandas/issues/9852)) +* Bug in `setup.py` that would allow an incompat cython version to build ([GH 9827](https://github.com/pandas-dev/pandas/issues/9827)) +* Bug in plotting `secondary_y` incorrectly attaches `right_ax` property to secondary axes specifying itself recursively. ([GH 9861](https://github.com/pandas-dev/pandas/issues/9861)) +* Bug in `Series.quantile` on empty Series of type `Datetime` or `Timedelta` ([GH 9675](https://github.com/pandas-dev/pandas/issues/9675)) +* Bug in `where` causing incorrect results when upcasting was required ([GH 9731](https://github.com/pandas-dev/pandas/issues/9731)) +* Bug in `FloatArrayFormatter` where decision boundary for displaying “small” floats in decimal format is off by one order of magnitude for a given display.precision ([GH 9764](https://github.com/pandas-dev/pandas/issues/9764)) +* Fixed bug where `DataFrame.plot()` raised an error when both `color` and `style` keywords were passed and there was no color symbol in the style strings ([GH 9671](https://github.com/pandas-dev/pandas/issues/9671)) +* Not showing a `DeprecationWarning` on combining list-likes with an `Index` ([GH 10083](https://github.com/pandas-dev/pandas/issues/10083)) +* Bug in `read_csv` and `read_table` when using `skip_rows` parameter if blank lines are present. ([GH 9832](https://github.com/pandas-dev/pandas/issues/9832)) +* Bug in `read_csv()` interprets `index_col=True` as `1` ([GH 9798](https://github.com/pandas-dev/pandas/issues/9798)) +* Bug in index equality comparisons using `==` failing on Index/MultiIndex type incompatibility ([GH 9785](https://github.com/pandas-dev/pandas/issues/9785)) +* Bug in which `SparseDataFrame` could not take `nan` as a column name ([GH 8822](https://github.com/pandas-dev/pandas/issues/8822)) +* Bug in `to_msgpack` and `read_msgpack` zlib and blosc compression support ([GH 9783](https://github.com/pandas-dev/pandas/issues/9783)) +* Bug `GroupBy.size` doesn’t attach index name properly if grouped by `TimeGrouper` ([GH 9925](https://github.com/pandas-dev/pandas/issues/9925)) +* Bug causing an exception in slice assignments because `length_of_indexer` returns wrong results ([GH 9995](https://github.com/pandas-dev/pandas/issues/9995)) +* Bug in csv parser causing lines with initial white space plus one non-space character to be skipped. ([GH 9710](https://github.com/pandas-dev/pandas/issues/9710)) +* Bug in C csv parser causing spurious NaNs when data started with newline followed by white space. ([GH 10022](https://github.com/pandas-dev/pandas/issues/10022)) +* Bug causing elements with a null group to spill into the final group when grouping by a `Categorical` ([GH 9603](https://github.com/pandas-dev/pandas/issues/9603)) +* Bug where .iloc and .loc behavior is not consistent on empty dataframes ([GH 9964](https://github.com/pandas-dev/pandas/issues/9964)) +* Bug in invalid attribute access on a `TimedeltaIndex` incorrectly raised `ValueError` instead of `AttributeError` ([GH 9680](https://github.com/pandas-dev/pandas/issues/9680)) +* Bug in unequal comparisons between categorical data and a scalar, which was not in the categories (e.g. `Series(Categorical(list("abc"), ordered=True)) > "d"`. This returned `False` for all elements, but now raises a `TypeError`. Equality comparisons also now return `False` for `==` and `True` for `!=`. ([GH 9848](https://github.com/pandas-dev/pandas/issues/9848)) +* Bug in DataFrame `__setitem__` when right hand side is a dictionary ([GH 9874](https://github.com/pandas-dev/pandas/issues/9874)) +* Bug in `where` when dtype is `datetime64/timedelta64`, but dtype of other is not ([GH 9804](https://github.com/pandas-dev/pandas/issues/9804)) +* Bug in `MultiIndex.sortlevel()` results in unicode level name breaks ([GH 9856](https://github.com/pandas-dev/pandas/issues/9856)) +* Bug in which `groupby.transform` incorrectly enforced output dtypes to match input dtypes. ([GH 9807](https://github.com/pandas-dev/pandas/issues/9807)) +* Bug in `DataFrame` constructor when `columns` parameter is set, and `data` is an empty list ([GH 9939](https://github.com/pandas-dev/pandas/issues/9939)) +* Bug in bar plot with `log=True` raises `TypeError` if all values are less than 1 ([GH 9905](https://github.com/pandas-dev/pandas/issues/9905)) +* Bug in horizontal bar plot ignores `log=True` ([GH 9905](https://github.com/pandas-dev/pandas/issues/9905)) +* Bug in PyTables queries that did not return proper results using the index ([GH 8265](https://github.com/pandas-dev/pandas/issues/8265), [GH 9676](https://github.com/pandas-dev/pandas/issues/9676)) +* Bug where dividing a dataframe containing values of type `Decimal` by another `Decimal` would raise. ([GH 9787](https://github.com/pandas-dev/pandas/issues/9787)) +* Bug where using DataFrames asfreq would remove the name of the index. ([GH 9885](https://github.com/pandas-dev/pandas/issues/9885)) +* Bug causing extra index point when resample BM/BQ ([GH 9756](https://github.com/pandas-dev/pandas/issues/9756)) +* Changed caching in `AbstractHolidayCalendar` to be at the instance level rather than at the class level as the latter can result in unexpected behaviour. ([GH 9552](https://github.com/pandas-dev/pandas/issues/9552)) +* Fixed latex output for MultiIndexed dataframes ([GH 9778](https://github.com/pandas-dev/pandas/issues/9778)) +* Bug causing an exception when setting an empty range using `DataFrame.loc` ([GH 9596](https://github.com/pandas-dev/pandas/issues/9596)) +* Bug in hiding ticklabels with subplots and shared axes when adding a new plot to an existing grid of axes ([GH 9158](https://github.com/pandas-dev/pandas/issues/9158)) +* Bug in `transform` and `filter` when grouping on a categorical variable ([GH 9921](https://github.com/pandas-dev/pandas/issues/9921)) +* Bug in `transform` when groups are equal in number and dtype to the input index ([GH 9700](https://github.com/pandas-dev/pandas/issues/9700)) +* Google BigQuery connector now imports dependencies on a per-method basis.([GH 9713](https://github.com/pandas-dev/pandas/issues/9713)) +* Updated BigQuery connector to no longer use deprecated `oauth2client.tools.run()` ([GH 8327](https://github.com/pandas-dev/pandas/issues/8327)) +* Bug in subclassed `DataFrame`. It may not return the correct class, when slicing or subsetting it. ([GH 9632](https://github.com/pandas-dev/pandas/issues/9632)) +* Bug in `.median()` where non-float null values are not handled correctly ([GH 10040](https://github.com/pandas-dev/pandas/issues/10040)) +* Bug in Series.fillna() where it raises if a numerically convertible string is given ([GH 10092](https://github.com/pandas-dev/pandas/issues/10092)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 58 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Alfonso MHC + +* Andy Hayden +* Artemy Kolchinsky +* Chris Gilmer + +* Chris Grinolds + +* Dan Birken +* David BROCHART + +* David Hirschfeld + +* David Stephens +* Dr. Leo + +* Evan Wright + +* Frans van Dunné + +* Hatem Nassrat + +* Henning Sperr + +* Hugo Herter + +* Jan Schulz +* Jeff Blackburne + +* Jeff Reback +* Jim Crist + +* Jonas Abernot + +* Joris Van den Bossche +* Kerby Shedden +* Leo Razoumov + +* Manuel Riel + +* Mortada Mehyar +* Nick Burns + +* Nick Eubank + +* Olivier Grisel +* Phillip Cloud +* Pietro Battiston +* Roy Hyunjin Han +* Sam Zhang + +* Scott Sanderson + +* Sinhrks + +* Stephan Hoyer +* Tiago Antao +* Tom Ajamian + +* Tom Augspurger +* Tomaz Berisa + +* Vikram Shirgur + +* Vladimir Filimonov +* William Hogman + +* Yasin A + +* Younggun Kim + +* behzad nouri +* dsm054 +* floydsoft + +* flying-sheep + +* gfr + +* jnmclarty +* jreback +* ksanghai + +* lucas + +* mschmohl + +* ptype + +* rockg +* scls19fr + +* sinhrks diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.16.2.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.16.2.md new file mode 100644 index 0000000000000000000000000000000000000000..f47ba548524b3f843f0edcae0ad817e332551001 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.16.2.md @@ -0,0 +1,224 @@ +# What's new in pandas 0.16.2 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.16.2.html + +# Version 0.16.2 (June 12, 2015)[#](#version-0-16-2-june-12-2015 "Link to this heading") + +This is a minor bug-fix release from 0.16.1 and includes a large number of +bug fixes along some new features ([`pipe()`](../reference/api/pandas.DataFrame.pipe.html#pandas.DataFrame.pipe "pandas.DataFrame.pipe") method), enhancements, and performance improvements. + +We recommend that all users upgrade to this version. + +Highlights include: + +* A new `pipe` method, see [here](#whatsnew-0162-enhancements-pipe) +* Documentation on how to use [numba](http://numba.pydata.org) with *pandas*, see [here](../user_guide/enhancingperf.html#enhancingperf-numba) + +What’s new in v0.16.2 + +* [New features](#new-features) + + + [Pipe](#pipe) + + [Other enhancements](#other-enhancements) +* [API changes](#api-changes) +* [Performance improvements](#performance-improvements) +* [Bug fixes](#bug-fixes) +* [Contributors](#contributors) + +## New features[#](#new-features "Link to this heading") + +### Pipe[#](#pipe "Link to this heading") + +We’ve introduced a new method [`DataFrame.pipe()`](../reference/api/pandas.DataFrame.pipe.html#pandas.DataFrame.pipe "pandas.DataFrame.pipe"). As suggested by the name, `pipe` +should be used to pipe data through a chain of function calls. +The goal is to avoid confusing nested function calls like + +```None +# df is a DataFrame +# f, g, and h are functions that take and return DataFrames +f(g(h(df), arg1=1), arg2=2, arg3=3) # noqa F821 +``` + +The logic flows from inside out, and function names are separated from their keyword arguments. +This can be rewritten as + +```None +( + df.pipe(h) # noqa F821 + .pipe(g, arg1=1) # noqa F821 + .pipe(f, arg2=2, arg3=3) # noqa F821 +) +``` + +Now both the code and the logic flow from top to bottom. Keyword arguments are next to +their functions. Overall the code is much more readable. + +In the example above, the functions `f`, `g`, and `h` each expected the DataFrame as the first positional argument. +When the function you wish to apply takes its data anywhere other than the first argument, pass a tuple +of `(function, keyword)` indicating where the DataFrame should flow. For example: + +```None +In [1]: import statsmodels.formula.api as sm + +In [2]: bb = pd.read_csv("data/baseball.csv", index_col="id") + +# sm.ols takes (formula, data) +In [3]: ( +...: bb.query("h > 0") +...: .assign(ln_h=lambda df: np.log(df.h)) +...: .pipe((sm.ols, "data"), "hr ~ ln_h + year + g + C(lg)") +...: .fit() +...: .summary() +...: ) +...: +Out[3]: + +""" + OLS Regression Results +============================================================================== +Dep. Variable: hr R-squared: 0.685 +Model: OLS Adj. R-squared: 0.665 +Method: Least Squares F-statistic: 34.28 +Date: Tue, 22 Nov 2022 Prob (F-statistic): 3.48e-15 +Time: 05:35:23 Log-Likelihood: -205.92 +No. Observations: 68 AIC: 421.8 +Df Residuals: 63 BIC: 432.9 +Df Model: 4 +Covariance Type: nonrobust +=============================================================================== + coef std err t P>|t| [0.025 0.975] +------------------------------------------------------------------------------- +Intercept -8484.7720 4664.146 -1.819 0.074 -1.78e+04 835.780 +C(lg)[T.NL] -2.2736 1.325 -1.716 0.091 -4.922 0.375 +ln_h -1.3542 0.875 -1.547 0.127 -3.103 0.395 +year 4.2277 2.324 1.819 0.074 -0.417 8.872 +g 0.1841 0.029 6.258 0.000 0.125 0.243 +============================================================================== +Omnibus: 10.875 Durbin-Watson: 1.999 +Prob(Omnibus): 0.004 Jarque-Bera (JB): 17.298 +Skew: 0.537 Prob(JB): 0.000175 +Kurtosis: 5.225 Cond. No. 1.49e+07 +============================================================================== + +Notes: +[1] Standard Errors assume that the covariance matrix of the errors is correctly specified. +[2] The condition number is large, 1.49e+07. This might indicate that there are +strong multicollinearity or other numerical problems. +""" +``` + +The pipe method is inspired by unix pipes, which stream text through +processes. More recently [dplyr](https://github.com/tidyverse/dplyr) and [magrittr](https://github.com/smbache/magrittr) have introduced the +popular `(%>%)` pipe operator for [R](http://www.r-project.org). + +See the [documentation](../user_guide/basics.html#basics-pipe) for more. ([GH 10129](https://github.com/pandas-dev/pandas/issues/10129)) + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* Added `rsplit` to Index/Series StringMethods ([GH 10303](https://github.com/pandas-dev/pandas/issues/10303)) +* Removed the hard-coded size limits on the `DataFrame` HTML representation + in the IPython notebook, and leave this to IPython itself (only for IPython + v3.0 or greater). This eliminates the duplicate scroll bars that appeared in + the notebook with large frames ([GH 10231](https://github.com/pandas-dev/pandas/issues/10231)). + + Note that the notebook has a `toggle output scrolling` feature to limit the + display of very large frames (by clicking left of the output). + You can also configure the way DataFrames are displayed using the pandas + options, see here [here](../user_guide/options.html#options-frequently-used). +* `axis` parameter of `DataFrame.quantile` now accepts also `index` and `column`. ([GH 9543](https://github.com/pandas-dev/pandas/issues/9543)) + +## API changes[#](#api-changes "Link to this heading") + +* `Holiday` now raises `NotImplementedError` if both `offset` and `observance` are used in the constructor instead of returning an incorrect result ([GH 10217](https://github.com/pandas-dev/pandas/issues/10217)). + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Improved `Series.resample` performance with `dtype=datetime64[ns]` ([GH 7754](https://github.com/pandas-dev/pandas/issues/7754)) +* Increase performance of `str.split` when `expand=True` ([GH 10081](https://github.com/pandas-dev/pandas/issues/10081)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in `Series.hist` raises an error when a one row `Series` was given ([GH 10214](https://github.com/pandas-dev/pandas/issues/10214)) +* Bug where `HDFStore.select` modifies the passed columns list ([GH 7212](https://github.com/pandas-dev/pandas/issues/7212)) +* Bug in `Categorical` repr with `display.width` of `None` in Python 3 ([GH 10087](https://github.com/pandas-dev/pandas/issues/10087)) +* Bug in `to_json` with certain orients and a `CategoricalIndex` would segfault ([GH 10317](https://github.com/pandas-dev/pandas/issues/10317)) +* Bug where some of the nan functions do not have consistent return dtypes ([GH 10251](https://github.com/pandas-dev/pandas/issues/10251)) +* Bug in `DataFrame.quantile` on checking that a valid axis was passed ([GH 9543](https://github.com/pandas-dev/pandas/issues/9543)) +* Bug in `groupby.apply` aggregation for `Categorical` not preserving categories ([GH 10138](https://github.com/pandas-dev/pandas/issues/10138)) +* Bug in `to_csv` where `date_format` is ignored if the `datetime` is fractional ([GH 10209](https://github.com/pandas-dev/pandas/issues/10209)) +* Bug in `DataFrame.to_json` with mixed data types ([GH 10289](https://github.com/pandas-dev/pandas/issues/10289)) +* Bug in cache updating when consolidating ([GH 10264](https://github.com/pandas-dev/pandas/issues/10264)) +* Bug in `mean()` where integer dtypes can overflow ([GH 10172](https://github.com/pandas-dev/pandas/issues/10172)) +* Bug where `Panel.from_dict` does not set dtype when specified ([GH 10058](https://github.com/pandas-dev/pandas/issues/10058)) +* Bug in `Index.union` raises `AttributeError` when passing array-likes. ([GH 10149](https://github.com/pandas-dev/pandas/issues/10149)) +* Bug in `Timestamp`’s’ `microsecond`, `quarter`, `dayofyear`, `week` and `daysinmonth` properties return `np.int` type, not built-in `int`. ([GH 10050](https://github.com/pandas-dev/pandas/issues/10050)) +* Bug in `NaT` raises `AttributeError` when accessing to `daysinmonth`, `dayofweek` properties. ([GH 10096](https://github.com/pandas-dev/pandas/issues/10096)) +* Bug in Index repr when using the `max_seq_items=None` setting ([GH 10182](https://github.com/pandas-dev/pandas/issues/10182)). +* Bug in getting timezone data with `dateutil` on various platforms ( [GH 9059](https://github.com/pandas-dev/pandas/issues/9059), [GH 8639](https://github.com/pandas-dev/pandas/issues/8639), [GH 9663](https://github.com/pandas-dev/pandas/issues/9663), [GH 10121](https://github.com/pandas-dev/pandas/issues/10121)) +* Bug in displaying datetimes with mixed frequencies; display ‘ms’ datetimes to the proper precision. ([GH 10170](https://github.com/pandas-dev/pandas/issues/10170)) +* Bug in `setitem` where type promotion is applied to the entire block ([GH 10280](https://github.com/pandas-dev/pandas/issues/10280)) +* Bug in `Series` arithmetic methods may incorrectly hold names ([GH 10068](https://github.com/pandas-dev/pandas/issues/10068)) +* Bug in `GroupBy.get_group` when grouping on multiple keys, one of which is categorical. ([GH 10132](https://github.com/pandas-dev/pandas/issues/10132)) +* Bug in `DatetimeIndex` and `TimedeltaIndex` names are lost after timedelta arithmetic ( [GH 9926](https://github.com/pandas-dev/pandas/issues/9926)) +* Bug in `DataFrame` construction from nested `dict` with `datetime64` ([GH 10160](https://github.com/pandas-dev/pandas/issues/10160)) +* Bug in `Series` construction from `dict` with `datetime64` keys ([GH 9456](https://github.com/pandas-dev/pandas/issues/9456)) +* Bug in `Series.plot(label="LABEL")` not correctly setting the label ([GH 10119](https://github.com/pandas-dev/pandas/issues/10119)) +* Bug in `plot` not defaulting to matplotlib `axes.grid` setting ([GH 9792](https://github.com/pandas-dev/pandas/issues/9792)) +* Bug causing strings containing an exponent, but no decimal to be parsed as `int` instead of `float` in `engine='python'` for the `read_csv` parser ([GH 9565](https://github.com/pandas-dev/pandas/issues/9565)) +* Bug in `Series.align` resets `name` when `fill_value` is specified ([GH 10067](https://github.com/pandas-dev/pandas/issues/10067)) +* Bug in `read_csv` causing index name not to be set on an empty DataFrame ([GH 10184](https://github.com/pandas-dev/pandas/issues/10184)) +* Bug in `SparseSeries.abs` resets `name` ([GH 10241](https://github.com/pandas-dev/pandas/issues/10241)) +* Bug in `TimedeltaIndex` slicing may reset freq ([GH 10292](https://github.com/pandas-dev/pandas/issues/10292)) +* Bug in `GroupBy.get_group` raises `ValueError` when group key contains `NaT` ([GH 6992](https://github.com/pandas-dev/pandas/issues/6992)) +* Bug in `SparseSeries` constructor ignores input data name ([GH 10258](https://github.com/pandas-dev/pandas/issues/10258)) +* Bug in `Categorical.remove_categories` causing a `ValueError` when removing the `NaN` category if underlying dtype is floating-point ([GH 10156](https://github.com/pandas-dev/pandas/issues/10156)) +* Bug where infer\_freq infers time rule (WOM-5XXX) unsupported by to\_offset ([GH 9425](https://github.com/pandas-dev/pandas/issues/9425)) +* Bug in `DataFrame.to_hdf()` where table format would raise a seemingly unrelated error for invalid (non-string) column names. This is now explicitly forbidden. ([GH 9057](https://github.com/pandas-dev/pandas/issues/9057)) +* Bug to handle masking empty `DataFrame` ([GH 10126](https://github.com/pandas-dev/pandas/issues/10126)). +* Bug where MySQL interface could not handle numeric table/column names ([GH 10255](https://github.com/pandas-dev/pandas/issues/10255)) +* Bug in `read_csv` with a `date_parser` that returned a `datetime64` array of other time resolution than `[ns]` ([GH 10245](https://github.com/pandas-dev/pandas/issues/10245)) +* Bug in `Panel.apply` when the result has ndim=0 ([GH 10332](https://github.com/pandas-dev/pandas/issues/10332)) +* Bug in `read_hdf` where `auto_close` could not be passed ([GH 9327](https://github.com/pandas-dev/pandas/issues/9327)). +* Bug in `read_hdf` where open stores could not be used ([GH 10330](https://github.com/pandas-dev/pandas/issues/10330)). +* Bug in adding empty `DataFrames`, now results in a `DataFrame` that `.equals` an empty `DataFrame` ([GH 10181](https://github.com/pandas-dev/pandas/issues/10181)). +* Bug in `to_hdf` and `HDFStore` which did not check that complib choices were valid ([GH 4582](https://github.com/pandas-dev/pandas/issues/4582), [GH 8874](https://github.com/pandas-dev/pandas/issues/8874)). + +## Contributors[#](#contributors "Link to this heading") + +A total of 34 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Andrew Rosenfeld +* Artemy Kolchinsky +* Bernard Willers + +* Christer van der Meeren +* Christian Hudon + +* Constantine Glen Evans + +* Daniel Julius Lasiman + +* Evan Wright +* Francesco Brundu + +* Gaëtan de Menten + +* Jake VanderPlas +* James Hiebert + +* Jeff Reback +* Joris Van den Bossche +* Justin Lecher + +* Ka Wo Chen + +* Kevin Sheppard +* Mortada Mehyar +* Morton Fox + +* Robin Wilson + +* Sinhrks +* Stephan Hoyer +* Thomas Grainger +* Tom Ajamian +* Tom Augspurger +* Yoshiki Vázquez Baeza +* Younggun Kim +* austinc + +* behzad nouri +* jreback +* lexual +* rekcahpassyla + +* scls19fr +* sinhrks diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.17.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.17.0.md new file mode 100644 index 0000000000000000000000000000000000000000..a2e5f406778395b54fe913cb851c1d391819d154 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.17.0.md @@ -0,0 +1,1446 @@ +# What's new in pandas 0.17.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.17.0.html + +# Version 0.17.0 (October 9, 2015)[#](#version-0-17-0-october-9-2015 "Link to this heading") + +This is a major release from 0.16.2 and includes a small number of API changes, several new features, +enhancements, and performance improvements along with a large number of bug fixes. We recommend that all +users upgrade to this version. + +Warning + +pandas >= 0.17.0 will no longer support compatibility with Python version 3.2 ([GH 9118](https://github.com/pandas-dev/pandas/issues/9118)) + +Warning + +The `pandas.io.data` package is deprecated and will be replaced by the +[pandas-datareader package](https://github.com/pydata/pandas-datareader). +This will allow the data modules to be independently updated to your pandas +installation. The API for `pandas-datareader v0.1.1` is exactly the same +as in `pandas v0.17.0` ([GH 8961](https://github.com/pandas-dev/pandas/issues/8961), [GH 10861](https://github.com/pandas-dev/pandas/issues/10861)). + +After installing pandas-datareader, you can easily change your imports: + +```None +from pandas.io import data, wb +``` + +becomes + +```None +from pandas_datareader import data, wb +``` + +Highlights include: + +* Release the Global Interpreter Lock (GIL) on some cython operations, see [here](#whatsnew-0170-gil) +* Plotting methods are now available as attributes of the `.plot` accessor, see [here](#whatsnew-0170-plot) +* The sorting API has been revamped to remove some long-time inconsistencies, see [here](#whatsnew-0170-api-breaking-sorting) +* Support for a `datetime64[ns]` with timezones as a first-class dtype, see [here](#whatsnew-0170-tz) +* The default for `to_datetime` will now be to `raise` when presented with unparsable formats, + previously this would return the original input. Also, date parse + functions now return consistent results. See [here](#whatsnew-0170-api-breaking-to-datetime) +* The default for `dropna` in `HDFStore` has changed to `False`, to store by default all rows even + if they are all `NaN`, see [here](#whatsnew-0170-api-breaking-hdf-dropna) +* Datetime accessor (`dt`) now supports `Series.dt.strftime` to generate formatted strings for datetime-likes, and `Series.dt.total_seconds` to generate each duration of the timedelta in seconds. See [here](#whatsnew-0170-strftime) +* `Period` and `PeriodIndex` can handle multiplied freq like `3D`, which corresponding to 3 days span. See [here](#whatsnew-0170-periodfreq) +* Development installed versions of pandas will now have `PEP440` compliant version strings ([GH 9518](https://github.com/pandas-dev/pandas/issues/9518)) +* Development support for benchmarking with the [Air Speed Velocity library](https://github.com/spacetelescope/asv/) ([GH 8361](https://github.com/pandas-dev/pandas/issues/8361)) +* Support for reading SAS xport files, see [here](#whatsnew-0170-enhancements-sas-xport) +* Documentation comparing SAS to *pandas*, see [here](../getting_started/comparison/comparison_with_sas.html#compare-with-sas) +* Removal of the automatic TimeSeries broadcasting, deprecated since 0.8.0, see [here](#whatsnew-0170-prior-deprecations) +* Display format with plain text can optionally align with Unicode East Asian Width, see [here](#whatsnew-0170-east-asian-width) +* Compatibility with Python 3.5 ([GH 11097](https://github.com/pandas-dev/pandas/issues/11097)) +* Compatibility with matplotlib 1.5.0 ([GH 11111](https://github.com/pandas-dev/pandas/issues/11111)) + +Check the [API Changes](#whatsnew-0170-api) and [deprecations](#whatsnew-0170-deprecations) before updating. + +What’s new in v0.17.0 + +* [New features](#new-features) + + + [Datetime with TZ](#datetime-with-tz) + + [Releasing the GIL](#releasing-the-gil) + + [Plot submethods](#plot-submethods) + + [Additional methods for `dt` accessor](#additional-methods-for-dt-accessor) + + - [Series.dt.strftime](#series-dt-strftime) + - [Series.dt.total\_seconds](#series-dt-total-seconds) + + [Period frequency enhancement](#period-frequency-enhancement) + + [Support for SAS XPORT files](#support-for-sas-xport-files) + + [Support for math functions in .eval()](#support-for-math-functions-in-eval) + + [Changes to Excel with `MultiIndex`](#changes-to-excel-with-multiindex) + + [Google BigQuery enhancements](#google-bigquery-enhancements) + + [Display alignment with Unicode East Asian width](#display-alignment-with-unicode-east-asian-width) + + [Other enhancements](#other-enhancements) +* [Backwards incompatible API changes](#backwards-incompatible-api-changes) + + + [Changes to sorting API](#changes-to-sorting-api) + + [Changes to to\_datetime and to\_timedelta](#changes-to-to-datetime-and-to-timedelta) + + - [Error handling](#error-handling) + - [Consistent parsing](#consistent-parsing) + + [Changes to Index comparisons](#changes-to-index-comparisons) + + [Changes to boolean comparisons vs. None](#changes-to-boolean-comparisons-vs-none) + + [HDFStore dropna behavior](#hdfstore-dropna-behavior) + + [Changes to `display.precision` option](#changes-to-display-precision-option) + + [Changes to `Categorical.unique`](#changes-to-categorical-unique) + + [Changes to `bool` passed as `header` in parsers](#changes-to-bool-passed-as-header-in-parsers) + + [Other API changes](#other-api-changes) + + [Deprecations](#deprecations) + + [Removal of prior version deprecations/changes](#removal-of-prior-version-deprecations-changes) +* [Performance improvements](#performance-improvements) +* [Bug fixes](#bug-fixes) +* [Contributors](#contributors) + +## New features[#](#new-features "Link to this heading") + +### Datetime with TZ[#](#datetime-with-tz "Link to this heading") + +We are adding an implementation that natively supports datetime with timezones. A `Series` or a `DataFrame` column previously +*could* be assigned a datetime with timezones, and would work as an `object` dtype. This had performance issues with a large +number rows. See the [docs](../user_guide/timeseries.html#timeseries-timezone-series) for more details. ([GH 8260](https://github.com/pandas-dev/pandas/issues/8260), [GH 10763](https://github.com/pandas-dev/pandas/issues/10763), [GH 11034](https://github.com/pandas-dev/pandas/issues/11034)). + +The new implementation allows for having a single-timezone across all rows, with operations in a performant manner. + +```None +In [1]: df = pd.DataFrame( + ...: { + ...: "A": pd.date_range("20130101", periods=3), + ...: "B": pd.date_range("20130101", periods=3, tz="US/Eastern"), + ...: "C": pd.date_range("20130101", periods=3, tz="CET"), + ...: } + ...: ) + ...: + +In [2]: df +Out[2]: + A B C +0 2013-01-01 2013-01-01 00:00:00-05:00 2013-01-01 00:00:00+01:00 +1 2013-01-02 2013-01-02 00:00:00-05:00 2013-01-02 00:00:00+01:00 +2 2013-01-03 2013-01-03 00:00:00-05:00 2013-01-03 00:00:00+01:00 + +[3 rows x 3 columns] + +In [3]: df.dtypes +Out[3]: +A datetime64[ns] +B datetime64[ns, US/Eastern] +C datetime64[ns, CET] +Length: 3, dtype: object +``` + +```None +In [4]: df.B +Out[4]: +0 2013-01-01 00:00:00-05:00 +1 2013-01-02 00:00:00-05:00 +2 2013-01-03 00:00:00-05:00 +Name: B, Length: 3, dtype: datetime64[ns, US/Eastern] + +In [5]: df.B.dt.tz_localize(None) +Out[5]: +0 2013-01-01 +1 2013-01-02 +2 2013-01-03 +Name: B, Length: 3, dtype: datetime64[ns] +``` + +This uses a new-dtype representation as well, that is very similar in look-and-feel to its numpy cousin `datetime64[ns]` + +```None +In [6]: df["B"].dtype +Out[6]: datetime64[ns, US/Eastern] + +In [7]: type(df["B"].dtype) +Out[7]: pandas.core.dtypes.dtypes.DatetimeTZDtype +``` + +Note + +There is a slightly different string repr for the underlying `DatetimeIndex` as a result of the dtype changes, but +functionally these are the same. + +Previous behavior: + +```None +In [1]: pd.date_range('20130101', periods=3, tz='US/Eastern') +Out[1]: DatetimeIndex(['2013-01-01 00:00:00-05:00', '2013-01-02 00:00:00-05:00', + '2013-01-03 00:00:00-05:00'], + dtype='datetime64[ns]', freq='D', tz='US/Eastern') + +In [2]: pd.date_range('20130101', periods=3, tz='US/Eastern').dtype +Out[2]: dtype(', ...)`, you can now also use `series.plot.(...)`: + +```None +In [10]: df = pd.DataFrame(np.random.rand(10, 2), columns=['a', 'b']) + +In [11]: df.plot.bar() +``` + +![../_images/whatsnew_plot_submethods.png](../_images/whatsnew_plot_submethods.png) + +As a result of this change, these methods are now all discoverable via tab-completion: + +```None +In [12]: df.plot. # noqa: E225, E999 +df.plot.area df.plot.barh df.plot.density df.plot.hist df.plot.line df.plot.scatter +df.plot.bar df.plot.box df.plot.hexbin df.plot.kde df.plot.pie +``` + +Each method signature only includes relevant arguments. Currently, these are limited to required arguments, but in the future these will include optional arguments, as well. For an overview, see the new [Plotting](../reference/frame.html#api-dataframe-plotting) API documentation. + +### Additional methods for `dt` accessor[#](#additional-methods-for-dt-accessor "Link to this heading") + +#### Series.dt.strftime[#](#series-dt-strftime "Link to this heading") + +We are now supporting a `Series.dt.strftime` method for datetime-likes to generate a formatted string ([GH 10110](https://github.com/pandas-dev/pandas/issues/10110)). Examples: + +```None +# DatetimeIndex +In [13]: s = pd.Series(pd.date_range("20130101", periods=4)) + +In [14]: s +Out[14]: +0 2013-01-01 +1 2013-01-02 +2 2013-01-03 +3 2013-01-04 +Length: 4, dtype: datetime64[ns] + +In [15]: s.dt.strftime("%Y/%m/%d") +Out[15]: +0 2013/01/01 +1 2013/01/02 +2 2013/01/03 +3 2013/01/04 +Length: 4, dtype: object +``` + +```None +# PeriodIndex +In [16]: s = pd.Series(pd.period_range("20130101", periods=4)) + +In [17]: s +Out[17]: +0 2013-01-01 +1 2013-01-02 +2 2013-01-03 +3 2013-01-04 +Length: 4, dtype: period[D] + +In [18]: s.dt.strftime("%Y/%m/%d") +Out[18]: +0 2013/01/01 +1 2013/01/02 +2 2013/01/03 +3 2013/01/04 +Length: 4, dtype: object +``` + +The string format is as the python standard library and details can be found [here](https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior) + +#### Series.dt.total\_seconds[#](#series-dt-total-seconds "Link to this heading") + +`pd.Series` of type `timedelta64` has new method `.dt.total_seconds()` returning the duration of the timedelta in seconds ([GH 10817](https://github.com/pandas-dev/pandas/issues/10817)) + +```None +# TimedeltaIndex +In [19]: s = pd.Series(pd.timedelta_range("1 minutes", periods=4)) + +In [20]: s +Out[20]: +0 0 days 00:01:00 +1 1 days 00:01:00 +2 2 days 00:01:00 +3 3 days 00:01:00 +Length: 4, dtype: timedelta64[ns] + +In [21]: s.dt.total_seconds() +Out[21]: +0 60.0 +1 86460.0 +2 172860.0 +3 259260.0 +Length: 4, dtype: float64 +``` + +### Period frequency enhancement[#](#period-frequency-enhancement "Link to this heading") + +`Period`, `PeriodIndex` and `period_range` can now accept multiplied freq. Also, `Period.freq` and `PeriodIndex.freq` are now stored as a `DateOffset` instance like `DatetimeIndex`, and not as `str` ([GH 7811](https://github.com/pandas-dev/pandas/issues/7811)) + +A multiplied freq represents a span of corresponding length. The example below creates a period of 3 days. Addition and subtraction will shift the period by its span. + +```None +In [22]: p = pd.Period("2015-08-01", freq="3D") + +In [23]: p +Out[23]: Period('2015-08-01', '3D') + +In [24]: p + 1 +Out[24]: Period('2015-08-04', '3D') + +In [25]: p - 2 +Out[25]: Period('2015-07-26', '3D') + +In [26]: p.to_timestamp() +Out[26]: Timestamp('2015-08-01 00:00:00') + +In [27]: p.to_timestamp(how="E") +Out[27]: Timestamp('2015-08-03 23:59:59.999999999') +``` + +You can use the multiplied freq in `PeriodIndex` and `period_range`. + +```None +In [28]: idx = pd.period_range("2015-08-01", periods=4, freq="2D") + +In [29]: idx +Out[29]: PeriodIndex(['2015-08-01', '2015-08-03', '2015-08-05', '2015-08-07'], dtype='period[2D]') + +In [30]: idx + 1 +Out[30]: PeriodIndex(['2015-08-03', '2015-08-05', '2015-08-07', '2015-08-09'], dtype='period[2D]') +``` + +### Support for SAS XPORT files[#](#support-for-sas-xport-files "Link to this heading") + +`read_sas()` provides support for reading *SAS XPORT* format files. ([GH 4052](https://github.com/pandas-dev/pandas/issues/4052)). + +```None +df = pd.read_sas("sas_xport.xpt") +``` + +It is also possible to obtain an iterator and read an XPORT file +incrementally. + +```None +for df in pd.read_sas("sas_xport.xpt", chunksize=10000): + do_something(df) +``` + +See the [docs](../user_guide/io.html#io-sas) for more details. + +### Support for math functions in .eval()[#](#support-for-math-functions-in-eval "Link to this heading") + +[`eval()`](../reference/api/pandas.eval.html#pandas.eval "pandas.eval") now supports calling math functions ([GH 4893](https://github.com/pandas-dev/pandas/issues/4893)) + +```None +df = pd.DataFrame({"a": np.random.randn(10)}) +df.eval("b = sin(a)") +``` + +The support math functions are `sin`, `cos`, `exp`, `log`, `expm1`, `log1p`, +`sqrt`, `sinh`, `cosh`, `tanh`, `arcsin`, `arccos`, `arctan`, `arccosh`, +`arcsinh`, `arctanh`, `abs` and `arctan2`. + +These functions map to the intrinsics for the `NumExpr` engine. For the Python +engine, they are mapped to `NumPy` calls. + +### Changes to Excel with `MultiIndex`[#](#changes-to-excel-with-multiindex "Link to this heading") + +In version 0.16.2 a `DataFrame` with `MultiIndex` columns could not be written to Excel via `to_excel`. +That functionality has been added ([GH 10564](https://github.com/pandas-dev/pandas/issues/10564)), along with updating `read_excel` so that the data can +be read back with, no loss of information, by specifying which columns/rows make up the `MultiIndex` +in the `header` and `index_col` parameters ([GH 4679](https://github.com/pandas-dev/pandas/issues/4679)) + +See the [documentation](../user_guide/io.html#io-excel) for more details. + +```None +In [31]: df = pd.DataFrame( + ....: [[1, 2, 3, 4], [5, 6, 7, 8]], + ....: columns=pd.MultiIndex.from_product( + ....: [["foo", "bar"], ["a", "b"]], names=["col1", "col2"] + ....: ), + ....: index=pd.MultiIndex.from_product([["j"], ["l", "k"]], names=["i1", "i2"]), + ....: ) + ....: + +In [32]: df +Out[32]: +col1 foo bar +col2 a b a b +i1 i2 +j l 1 2 3 4 + k 5 6 7 8 + +[2 rows x 4 columns] + +In [33]: df.to_excel("test.xlsx") + +In [34]: df = pd.read_excel("test.xlsx", header=[0, 1], index_col=[0, 1]) + +In [35]: df +Out[35]: +col1 foo bar +col2 a b a b +i1 i2 +j l 1 2 3 4 + k 5 6 7 8 + +[2 rows x 4 columns] +``` + +Previously, it was necessary to specify the `has_index_names` argument in `read_excel`, +if the serialized data had index names. For version 0.17.0 the output format of `to_excel` +has been changed to make this keyword unnecessary - the change is shown below. + +**Old** + +![../_images/old-excel-index.png](../_images/old-excel-index.png) + +**New** + +![../_images/new-excel-index.png](../_images/new-excel-index.png) + +Warning + +Excel files saved in version 0.16.2 or prior that had index names will still able to be read in, +but the `has_index_names` argument must specified to `True`. + +### Google BigQuery enhancements[#](#google-bigquery-enhancements "Link to this heading") + +* Added ability to automatically create a table/dataset using the `pandas.io.gbq.to_gbq()` function if the destination table/dataset does not exist. ([GH 8325](https://github.com/pandas-dev/pandas/issues/8325), [GH 11121](https://github.com/pandas-dev/pandas/issues/11121)). +* Added ability to replace an existing table and schema when calling the `pandas.io.gbq.to_gbq()` function via the `if_exists` argument. See the [docs](https://pandas-gbq.readthedocs.io/en/latest/writing.html) for more details ([GH 8325](https://github.com/pandas-dev/pandas/issues/8325)). +* `InvalidColumnOrder` and `InvalidPageToken` in the gbq module will raise `ValueError` instead of `IOError`. +* The `generate_bq_schema()` function is now deprecated and will be removed in a future version ([GH 11121](https://github.com/pandas-dev/pandas/issues/11121)) +* The gbq module will now support Python 3 ([GH 11094](https://github.com/pandas-dev/pandas/issues/11094)). + +### Display alignment with Unicode East Asian width[#](#display-alignment-with-unicode-east-asian-width "Link to this heading") + +Warning + +Enabling this option will affect the performance for printing of `DataFrame` and `Series` (about 2 times slower). +Use only when it is actually required. + +Some East Asian countries use Unicode characters its width is corresponding to 2 alphabets. If a `DataFrame` or `Series` contains these characters, the default output cannot be aligned properly. The following options are added to enable precise handling for these characters. + +* `display.unicode.east_asian_width`: Whether to use the Unicode East Asian Width to calculate the display text width. ([GH 2612](https://github.com/pandas-dev/pandas/issues/2612)) +* `display.unicode.ambiguous_as_wide`: Whether to handle Unicode characters belong to Ambiguous as Wide. ([GH 11102](https://github.com/pandas-dev/pandas/issues/11102)) + +```None +In [36]: df = pd.DataFrame({u"国籍": ["UK", u"日本"], u"名前": ["Alice", u"しのぶ"]}) + +In [37]: df +Out[37]: + 国籍 名前 +0 UK Alice +1 日本 しのぶ + +[2 rows x 2 columns] +``` + +```None +In [38]: pd.set_option("display.unicode.east_asian_width", True) + +In [39]: df +Out[39]: + 国籍 名前 +0 UK Alice +1 日本 しのぶ + +[2 rows x 2 columns] +``` + +For further details, see [here](../user_guide/options.html#options-east-asian-width) + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* Support for `openpyxl` >= 2.2. The API for style support is now stable ([GH 10125](https://github.com/pandas-dev/pandas/issues/10125)) +* `merge` now accepts the argument `indicator` which adds a Categorical-type column (by default called `_merge`) to the output object that takes on the values ([GH 8790](https://github.com/pandas-dev/pandas/issues/8790)) + + | Observation Origin | `_merge` value | + | --- | --- | + | Merge key only in `'left'` frame | `left_only` | + | Merge key only in `'right'` frame | `right_only` | + | Merge key in both frames | `both` | + + ```None + In [40]: df1 = pd.DataFrame({"col1": [0, 1], "col_left": ["a", "b"]}) + + In [41]: df2 = pd.DataFrame({"col1": [1, 2, 2], "col_right": [2, 2, 2]}) + + In [42]: pd.merge(df1, df2, on="col1", how="outer", indicator=True) + Out[42]: + col1 col_left col_right _merge + 0 0 a NaN left_only + 1 1 b 2.0 both + 2 2 NaN 2.0 right_only + 3 2 NaN 2.0 right_only + + [4 rows x 4 columns] + ``` + + For more, see the [updated docs](../user_guide/merging.html#merging-indicator) +* `pd.to_numeric` is a new function to coerce strings to numbers (possibly with coercion) ([GH 11133](https://github.com/pandas-dev/pandas/issues/11133)) +* `pd.merge` will now allow duplicate column names if they are not merged upon ([GH 10639](https://github.com/pandas-dev/pandas/issues/10639)). +* `pd.pivot` will now allow passing index as `None` ([GH 3962](https://github.com/pandas-dev/pandas/issues/3962)). +* `pd.concat` will now use existing Series names if provided ([GH 10698](https://github.com/pandas-dev/pandas/issues/10698)). + + ```None + In [43]: foo = pd.Series([1, 2], name="foo") + + In [44]: bar = pd.Series([1, 2]) + + In [45]: baz = pd.Series([4, 5]) + ``` + + Previous behavior: + + ```None + In [1]: pd.concat([foo, bar, baz], axis=1) + Out[1]: + 0 1 2 + 0 1 1 4 + 1 2 2 5 + ``` + + New behavior: + + ```None + In [46]: pd.concat([foo, bar, baz], axis=1) + Out[46]: + foo 0 1 + 0 1 1 4 + 1 2 2 5 + + [2 rows x 3 columns] + ``` +* `DataFrame` has gained the `nlargest` and `nsmallest` methods ([GH 10393](https://github.com/pandas-dev/pandas/issues/10393)) +* Add a `limit_direction` keyword argument that works with `limit` to enable `interpolate` to fill `NaN` values forward, backward, or both ([GH 9218](https://github.com/pandas-dev/pandas/issues/9218), [GH 10420](https://github.com/pandas-dev/pandas/issues/10420), [GH 11115](https://github.com/pandas-dev/pandas/issues/11115)) + + ```None + In [47]: ser = pd.Series([np.nan, np.nan, 5, np.nan, np.nan, np.nan, 13]) + + In [48]: ser.interpolate(limit=1, limit_direction="both") + Out[48]: + 0 NaN + 1 5.0 + 2 5.0 + 3 7.0 + 4 NaN + 5 11.0 + 6 13.0 + Length: 7, dtype: float64 + ``` +* Added a `DataFrame.round` method to round the values to a variable number of decimal places ([GH 10568](https://github.com/pandas-dev/pandas/issues/10568)). + + ```None + In [49]: df = pd.DataFrame( + ....: np.random.random([3, 3]), + ....: columns=["A", "B", "C"], + ....: index=["first", "second", "third"], + ....: ) + ....: + + In [50]: df + Out[50]: + A B C + first 0.126970 0.966718 0.260476 + second 0.897237 0.376750 0.336222 + third 0.451376 0.840255 0.123102 + + [3 rows x 3 columns] + + In [51]: df.round(2) + Out[51]: + A B C + first 0.13 0.97 0.26 + second 0.90 0.38 0.34 + third 0.45 0.84 0.12 + + [3 rows x 3 columns] + + In [52]: df.round({"A": 0, "C": 2}) + Out[52]: + A B C + first 0.0 0.966718 0.26 + second 1.0 0.376750 0.34 + third 0.0 0.840255 0.12 + + [3 rows x 3 columns] + ``` +* `drop_duplicates` and `duplicated` now accept a `keep` keyword to target first, last, and all duplicates. The `take_last` keyword is deprecated, see [here](#whatsnew-0170-deprecations) ([GH 6511](https://github.com/pandas-dev/pandas/issues/6511), [GH 8505](https://github.com/pandas-dev/pandas/issues/8505)) + + ```None + In [53]: s = pd.Series(["A", "B", "C", "A", "B", "D"]) + + In [54]: s.drop_duplicates() + Out[54]: + 0 A + 1 B + 2 C + 5 D + Length: 4, dtype: object + + In [55]: s.drop_duplicates(keep="last") + Out[55]: + 2 C + 3 A + 4 B + 5 D + Length: 4, dtype: object + + In [56]: s.drop_duplicates(keep=False) + Out[56]: + 2 C + 5 D + Length: 2, dtype: object + ``` +* Reindex now has a `tolerance` argument that allows for finer control of [Limits on filling while reindexing](../user_guide/basics.html#basics-limits-on-reindex-fill) ([GH 10411](https://github.com/pandas-dev/pandas/issues/10411)): + + ```None + In [57]: df = pd.DataFrame({"x": range(5), "t": pd.date_range("2000-01-01", periods=5)}) + + In [58]: df.reindex([0.1, 1.9, 3.5], method="nearest", tolerance=0.2) + Out[58]: + x t + 0.1 0.0 2000-01-01 + 1.9 2.0 2000-01-03 + 3.5 NaN NaT + + [3 rows x 2 columns] + ``` + + When used on a `DatetimeIndex`, `TimedeltaIndex` or `PeriodIndex`, `tolerance` will coerced into a `Timedelta` if possible. This allows you to specify tolerance with a string: + + ```None + In [59]: df = df.set_index("t") + + In [60]: df.reindex(pd.to_datetime(["1999-12-31"]), method="nearest", tolerance="1 day") + Out[60]: + x + 1999-12-31 0 + + [1 rows x 1 columns] + ``` + + `tolerance` is also exposed by the lower level `Index.get_indexer` and `Index.get_loc` methods. +* Added functionality to use the `base` argument when resampling a `TimeDeltaIndex` ([GH 10530](https://github.com/pandas-dev/pandas/issues/10530)) +* `DatetimeIndex` can be instantiated using strings contains `NaT` ([GH 7599](https://github.com/pandas-dev/pandas/issues/7599)) +* `to_datetime` can now accept the `yearfirst` keyword ([GH 7599](https://github.com/pandas-dev/pandas/issues/7599)) +* `pandas.tseries.offsets` larger than the `Day` offset can now be used with a `Series` for addition/subtraction ([GH 10699](https://github.com/pandas-dev/pandas/issues/10699)). See the [docs](../user_guide/timeseries.html#timeseries-offsetseries) for more details. +* `pd.Timedelta.total_seconds()` now returns Timedelta duration to ns precision (previously microsecond precision) ([GH 10939](https://github.com/pandas-dev/pandas/issues/10939)) +* `PeriodIndex` now supports arithmetic with `np.ndarray` ([GH 10638](https://github.com/pandas-dev/pandas/issues/10638)) +* Support pickling of `Period` objects ([GH 10439](https://github.com/pandas-dev/pandas/issues/10439)) +* `.as_blocks` will now take a `copy` optional argument to return a copy of the data, default is to copy (no change in behavior from prior versions), ([GH 9607](https://github.com/pandas-dev/pandas/issues/9607)) +* `regex` argument to `DataFrame.filter` now handles numeric column names instead of raising `ValueError` ([GH 10384](https://github.com/pandas-dev/pandas/issues/10384)). +* Enable reading gzip compressed files via URL, either by explicitly setting the compression parameter or by inferring from the presence of the HTTP Content-Encoding header in the response ([GH 8685](https://github.com/pandas-dev/pandas/issues/8685)) +* Enable writing Excel files in [memory](../user_guide/io.html#io-excel-writing-buffer) using StringIO/BytesIO ([GH 7074](https://github.com/pandas-dev/pandas/issues/7074)) +* Enable serialization of lists and dicts to strings in `ExcelWriter` ([GH 8188](https://github.com/pandas-dev/pandas/issues/8188)) +* SQL io functions now accept a SQLAlchemy connectable. ([GH 7877](https://github.com/pandas-dev/pandas/issues/7877)) +* `pd.read_sql` and `to_sql` can accept database URI as `con` parameter ([GH 10214](https://github.com/pandas-dev/pandas/issues/10214)) +* `read_sql_table` will now allow reading from views ([GH 10750](https://github.com/pandas-dev/pandas/issues/10750)). +* Enable writing complex values to `HDFStores` when using the `table` format ([GH 10447](https://github.com/pandas-dev/pandas/issues/10447)) +* Enable `pd.read_hdf` to be used without specifying a key when the HDF file contains a single dataset ([GH 10443](https://github.com/pandas-dev/pandas/issues/10443)) +* `pd.read_stata` will now read Stata 118 type files. ([GH 9882](https://github.com/pandas-dev/pandas/issues/9882)) +* `msgpack` submodule has been updated to 0.4.6 with backward compatibility ([GH 10581](https://github.com/pandas-dev/pandas/issues/10581)) +* `DataFrame.to_dict` now accepts `orient='index'` keyword argument ([GH 10844](https://github.com/pandas-dev/pandas/issues/10844)). +* `DataFrame.apply` will return a Series of dicts if the passed function returns a dict and `reduce=True` ([GH 8735](https://github.com/pandas-dev/pandas/issues/8735)). +* Allow passing `kwargs` to the interpolation methods ([GH 10378](https://github.com/pandas-dev/pandas/issues/10378)). +* Improved error message when concatenating an empty iterable of `Dataframe` objects ([GH 9157](https://github.com/pandas-dev/pandas/issues/9157)) +* `pd.read_csv` can now read bz2-compressed files incrementally, and the C parser can read bz2-compressed files from AWS S3 ([GH 11070](https://github.com/pandas-dev/pandas/issues/11070), [GH 11072](https://github.com/pandas-dev/pandas/issues/11072)). +* In `pd.read_csv`, recognize `s3n://` and `s3a://` URLs as designating S3 file storage ([GH 11070](https://github.com/pandas-dev/pandas/issues/11070), [GH 11071](https://github.com/pandas-dev/pandas/issues/11071)). +* Read CSV files from AWS S3 incrementally, instead of first downloading the entire file. (Full file download still required for compressed files in Python 2.) ([GH 11070](https://github.com/pandas-dev/pandas/issues/11070), [GH 11073](https://github.com/pandas-dev/pandas/issues/11073)) +* `pd.read_csv` is now able to infer compression type for files read from AWS S3 storage ([GH 11070](https://github.com/pandas-dev/pandas/issues/11070), [GH 11074](https://github.com/pandas-dev/pandas/issues/11074)). + +## Backwards incompatible API changes[#](#backwards-incompatible-api-changes "Link to this heading") + +### Changes to sorting API[#](#changes-to-sorting-api "Link to this heading") + +The sorting API has had some longtime inconsistencies. ([GH 9816](https://github.com/pandas-dev/pandas/issues/9816), [GH 8239](https://github.com/pandas-dev/pandas/issues/8239)). + +Here is a summary of the API **PRIOR** to 0.17.0: + +* `Series.sort` is **INPLACE** while `DataFrame.sort` returns a new object. +* `Series.order` returns a new object +* It was possible to use `Series/DataFrame.sort_index` to sort by **values** by passing the `by` keyword. +* `Series/DataFrame.sortlevel` worked only on a `MultiIndex` for sorting by index. + +To address these issues, we have revamped the API: + +* We have introduced a new method, [`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values"), which is the merger of `DataFrame.sort()`, `Series.sort()`, + and `Series.order()`, to handle sorting of **values**. +* The existing methods `Series.sort()`, `Series.order()`, and `DataFrame.sort()` have been deprecated and will be removed in a + future version. +* The `by` argument of `DataFrame.sort_index()` has been deprecated and will be removed in a future version. +* The existing method `.sort_index()` will gain the `level` keyword to enable level sorting. + +We now have two distinct and non-overlapping methods of sorting. A `*` marks items that +will show a `FutureWarning`. + +To sort by the **values**: + +| Previous | Replacement | +| --- | --- | +| \* `Series.order()` | `Series.sort_values()` | +| \* `Series.sort()` | `Series.sort_values(inplace=True)` | +| \* `DataFrame.sort(columns=...)` | `DataFrame.sort_values(by=...)` | + +To sort by the **index**: + +| Previous | Replacement | +| --- | --- | +| `Series.sort_index()` | `Series.sort_index()` | +| `Series.sortlevel(level=...)` | `Series.sort_index(level=...`) | +| `DataFrame.sort_index()` | `DataFrame.sort_index()` | +| `DataFrame.sortlevel(level=...)` | `DataFrame.sort_index(level=...)` | +| \* `DataFrame.sort()` | `DataFrame.sort_index()` | + +We have also deprecated and changed similar methods in two Series-like classes, `Index` and `Categorical`. + +| Previous | Replacement | +| --- | --- | +| \* `Index.order()` | `Index.sort_values()` | +| \* `Categorical.order()` | `Categorical.sort_values()` | + +### Changes to to\_datetime and to\_timedelta[#](#changes-to-to-datetime-and-to-timedelta "Link to this heading") + +#### Error handling[#](#error-handling "Link to this heading") + +The default for `pd.to_datetime` error handling has changed to `errors='raise'`. +In prior versions it was `errors='ignore'`. Furthermore, the `coerce` argument +has been deprecated in favor of `errors='coerce'`. This means that invalid parsing +will raise rather that return the original input as in previous versions. ([GH 10636](https://github.com/pandas-dev/pandas/issues/10636)) + +Previous behavior: + +```None +In [2]: pd.to_datetime(['2009-07-31', 'asd']) +Out[2]: array(['2009-07-31', 'asd'], dtype=object) +``` + +New behavior: + +```None +In [3]: pd.to_datetime(['2009-07-31', 'asd']) +ValueError: Unknown string format +``` + +Of course you can coerce this as well. + +```None +In [61]: pd.to_datetime(["2009-07-31", "asd"], errors="coerce") +Out[61]: DatetimeIndex(['2009-07-31', 'NaT'], dtype='datetime64[ns]', freq=None) +``` + +To keep the previous behavior, you can use `errors='ignore'`: + +```None +In [4]: pd.to_datetime(["2009-07-31", "asd"], errors="ignore") +Out[4]: Index(['2009-07-31', 'asd'], dtype='object') +``` + +Furthermore, `pd.to_timedelta` has gained a similar API, of `errors='raise'|'ignore'|'coerce'`, and the `coerce` keyword +has been deprecated in favor of `errors='coerce'`. + +#### Consistent parsing[#](#consistent-parsing "Link to this heading") + +The string parsing of `to_datetime`, `Timestamp` and `DatetimeIndex` has +been made consistent. ([GH 7599](https://github.com/pandas-dev/pandas/issues/7599)) + +Prior to v0.17.0, `Timestamp` and `to_datetime` may parse year-only datetime-string incorrectly using today’s date, otherwise `DatetimeIndex` +uses the beginning of the year. `Timestamp` and `to_datetime` may raise `ValueError` in some types of datetime-string which `DatetimeIndex` +can parse, such as a quarterly string. + +Previous behavior: + +```None +In [1]: pd.Timestamp('2012Q2') +Traceback + ... +ValueError: Unable to parse 2012Q2 + +# Results in today's date. +In [2]: pd.Timestamp('2014') +Out [2]: 2014-08-12 00:00:00 +``` + +v0.17.0 can parse them as below. It works on `DatetimeIndex` also. + +New behavior: + +```None +In [62]: pd.Timestamp("2012Q2") +Out[62]: Timestamp('2012-04-01 00:00:00') + +In [63]: pd.Timestamp("2014") +Out[63]: Timestamp('2014-01-01 00:00:00') + +In [64]: pd.DatetimeIndex(["2012Q2", "2014"]) +Out[64]: DatetimeIndex(['2012-04-01', '2014-01-01'], dtype='datetime64[ns]', freq=None) +``` + +Note + +If you want to perform calculations based on today’s date, use `Timestamp.now()` and `pandas.tseries.offsets`. + +```None +In [65]: import pandas.tseries.offsets as offsets + +In [66]: pd.Timestamp.now() +Out[66]: Timestamp('2025-09-29 22:21:01.322703') + +In [67]: pd.Timestamp.now() + offsets.DateOffset(years=1) +Out[67]: Timestamp('2026-09-29 22:21:01.323808') +``` + +### Changes to Index comparisons[#](#changes-to-index-comparisons "Link to this heading") + +Operator equal on `Index` should behavior similarly to `Series` ([GH 9947](https://github.com/pandas-dev/pandas/issues/9947), [GH 10637](https://github.com/pandas-dev/pandas/issues/10637)) + +Starting in v0.17.0, comparing `Index` objects of different lengths will raise +a `ValueError`. This is to be consistent with the behavior of `Series`. + +Previous behavior: + +```None +In [2]: pd.Index([1, 2, 3]) == pd.Index([1, 4, 5]) +Out[2]: array([ True, False, False], dtype=bool) + +In [3]: pd.Index([1, 2, 3]) == pd.Index([2]) +Out[3]: array([False, True, False], dtype=bool) + +In [4]: pd.Index([1, 2, 3]) == pd.Index([1, 2]) +Out[4]: False +``` + +New behavior: + +```None +In [8]: pd.Index([1, 2, 3]) == pd.Index([1, 4, 5]) +Out[8]: array([ True, False, False], dtype=bool) + +In [9]: pd.Index([1, 2, 3]) == pd.Index([2]) +ValueError: Lengths must match to compare + +In [10]: pd.Index([1, 2, 3]) == pd.Index([1, 2]) +ValueError: Lengths must match to compare +``` + +Note that this is different from the `numpy` behavior where a comparison can +be broadcast: + +```None +In [68]: np.array([1, 2, 3]) == np.array([1]) +Out[68]: array([ True, False, False]) +``` + +or it can return False if broadcasting can not be done: + +```None +In [11]: np.array([1, 2, 3]) == np.array([1, 2]) +Out[11]: False +``` + +### Changes to boolean comparisons vs. None[#](#changes-to-boolean-comparisons-vs-none "Link to this heading") + +Boolean comparisons of a `Series` vs `None` will now be equivalent to comparing with `np.nan`, rather than raise `TypeError`. ([GH 1079](https://github.com/pandas-dev/pandas/issues/1079)). + +```None +In [69]: s = pd.Series(range(3), dtype="float") + +In [70]: s.iloc[1] = None + +In [71]: s +Out[71]: +0 0.0 +1 NaN +2 2.0 +Length: 3, dtype: float64 +``` + +Previous behavior: + +```None +In [5]: s == None +TypeError: Could not compare type with Series +``` + +New behavior: + +```None +In [72]: s == None +Out[72]: +0 False +1 False +2 False +Length: 3, dtype: bool +``` + +Usually you simply want to know which values are null. + +```None +In [73]: s.isnull() +Out[73]: +0 False +1 True +2 False +Length: 3, dtype: bool +``` + +Warning + +You generally will want to use `isnull/notnull` for these types of comparisons, as `isnull/notnull` tells you which elements are null. One has to be +mindful that `nan's` don’t compare equal, but `None's` do. Note that pandas/numpy uses the fact that `np.nan != np.nan`, and treats `None` like `np.nan`. + +```None +In [74]: None == None +Out[74]: True + +In [75]: np.nan == np.nan +Out[75]: False +``` + +### HDFStore dropna behavior[#](#hdfstore-dropna-behavior "Link to this heading") + +The default behavior for HDFStore write functions with `format='table'` is now to keep rows that are all missing. Previously, the behavior was to drop rows that were all missing save the index. The previous behavior can be replicated using the `dropna=True` option. ([GH 9382](https://github.com/pandas-dev/pandas/issues/9382)) + +Previous behavior: + +```None +In [76]: df_with_missing = pd.DataFrame( + ....: {"col1": [0, np.nan, 2], "col2": [1, np.nan, np.nan]} + ....: ) + ....: + +In [77]: df_with_missing +Out[77]: + col1 col2 +0 0.0 1.0 +1 NaN NaN +2 2.0 NaN + +[3 rows x 2 columns] +``` + +```None +In [27]: +df_with_missing.to_hdf('file.h5', + key='df_with_missing', + format='table', + mode='w') + +In [28]: pd.read_hdf('file.h5', 'df_with_missing') + +Out [28]: + col1 col2 + 0 0 1 + 2 2 NaN +``` + +New behavior: + +```None +In [78]: df_with_missing.to_hdf("file.h5", key="df_with_missing", format="table", mode="w") + +In [79]: pd.read_hdf("file.h5", "df_with_missing") +Out[79]: + col1 col2 +0 0.0 1.0 +1 NaN NaN +2 2.0 NaN + +[3 rows x 2 columns] +``` + +See the [docs](../user_guide/io.html#io-hdf5) for more details. + +### Changes to `display.precision` option[#](#changes-to-display-precision-option "Link to this heading") + +The `display.precision` option has been clarified to refer to decimal places ([GH 10451](https://github.com/pandas-dev/pandas/issues/10451)). + +Earlier versions of pandas would format floating point numbers to have one less decimal place than the value in +`display.precision`. + +```None +In [1]: pd.set_option('display.precision', 2) + +In [2]: pd.DataFrame({'x': [123.456789]}) +Out[2]: + x +0 123.5 +``` + +If interpreting precision as “significant figures” this did work for scientific notation but that same interpretation +did not work for values with standard formatting. It was also out of step with how numpy handles formatting. + +Going forward the value of `display.precision` will directly control the number of places after the decimal, for +regular formatting as well as scientific notation, similar to how numpy’s `precision` print option works. + +```None +In [80]: pd.set_option("display.precision", 2) + +In [81]: pd.DataFrame({"x": [123.456789]}) +Out[81]: + x +0 123.46 + +[1 rows x 1 columns] +``` + +To preserve output behavior with prior versions the default value of `display.precision` has been reduced to `6` +from `7`. + +### Changes to `Categorical.unique`[#](#changes-to-categorical-unique "Link to this heading") + +`Categorical.unique` now returns new `Categoricals` with `categories` and `codes` that are unique, rather than returning `np.array` ([GH 10508](https://github.com/pandas-dev/pandas/issues/10508)) + +* unordered category: values and categories are sorted by appearance order. +* ordered category: values are sorted by appearance order, categories keep existing order. + +```None +In [82]: cat = pd.Categorical(["C", "A", "B", "C"], categories=["A", "B", "C"], ordered=True) + +In [83]: cat +Out[83]: +['C', 'A', 'B', 'C'] +Categories (3, object): ['A' < 'B' < 'C'] + +In [84]: cat.unique() +Out[84]: +['C', 'A', 'B'] +Categories (3, object): ['A' < 'B' < 'C'] + +In [85]: cat = pd.Categorical(["C", "A", "B", "C"], categories=["A", "B", "C"]) + +In [86]: cat +Out[86]: +['C', 'A', 'B', 'C'] +Categories (3, object): ['A', 'B', 'C'] + +In [87]: cat.unique() +Out[87]: +['C', 'A', 'B'] +Categories (3, object): ['A', 'B', 'C'] +``` + +### Changes to `bool` passed as `header` in parsers[#](#changes-to-bool-passed-as-header-in-parsers "Link to this heading") + +In earlier versions of pandas, if a bool was passed the `header` argument of +`read_csv`, `read_excel`, or `read_html` it was implicitly converted to +an integer, resulting in `header=0` for `False` and `header=1` for `True` +([GH 6113](https://github.com/pandas-dev/pandas/issues/6113)) + +A `bool` input to `header` will now raise a `TypeError` + +```None +In [29]: df = pd.read_csv('data.csv', header=False) +TypeError: Passing a bool to header is invalid. Use header=None for no header or +header=int or list-like of ints to specify the row(s) making up the column names +``` + +### Other API changes[#](#other-api-changes "Link to this heading") + +* Line and kde plot with `subplots=True` now uses default colors, not all black. Specify `color='k'` to draw all lines in black ([GH 9894](https://github.com/pandas-dev/pandas/issues/9894)) +* Calling the `.value_counts()` method on a Series with a `categorical` dtype now returns a Series with a `CategoricalIndex` ([GH 10704](https://github.com/pandas-dev/pandas/issues/10704)) +* The metadata properties of subclasses of pandas objects will now be serialized ([GH 10553](https://github.com/pandas-dev/pandas/issues/10553)). +* `groupby` using `Categorical` follows the same rule as `Categorical.unique` described above ([GH 10508](https://github.com/pandas-dev/pandas/issues/10508)) +* When constructing `DataFrame` with an array of `complex64` dtype previously meant the corresponding column + was automatically promoted to the `complex128` dtype. pandas will now preserve the itemsize of the input for complex data ([GH 10952](https://github.com/pandas-dev/pandas/issues/10952)) +* some numeric reduction operators would return `ValueError`, rather than `TypeError` on object types that includes strings and numbers ([GH 11131](https://github.com/pandas-dev/pandas/issues/11131)) +* Passing currently unsupported `chunksize` argument to `read_excel` or `ExcelFile.parse` will now raise `NotImplementedError` ([GH 8011](https://github.com/pandas-dev/pandas/issues/8011)) +* Allow an `ExcelFile` object to be passed into `read_excel` ([GH 11198](https://github.com/pandas-dev/pandas/issues/11198)) +* `DatetimeIndex.union` does not infer `freq` if `self` and the input have `None` as `freq` ([GH 11086](https://github.com/pandas-dev/pandas/issues/11086)) +* `NaT`’s methods now either raise `ValueError`, or return `np.nan` or `NaT` ([GH 9513](https://github.com/pandas-dev/pandas/issues/9513)) + + | Behavior | Methods | + | --- | --- | + | return `np.nan` | `weekday`, `isoweekday` | + | return `NaT` | `date`, `now`, `replace`, `to_datetime`, `today` | + | return `np.datetime64('NaT')` | `to_datetime64` (unchanged) | + | raise `ValueError` | All other public methods (names not beginning with underscores) | + +### Deprecations[#](#deprecations "Link to this heading") + +* For `Series` the following indexing functions are deprecated ([GH 10177](https://github.com/pandas-dev/pandas/issues/10177)). + + | Deprecated Function | Replacement | + | --- | --- | + | `.irow(i)` | `.iloc[i]` or `.iat[i]` | + | `.iget(i)` | `.iloc[i]` or `.iat[i]` | + | `.iget_value(i)` | `.iloc[i]` or `.iat[i]` | +* For `DataFrame` the following indexing functions are deprecated ([GH 10177](https://github.com/pandas-dev/pandas/issues/10177)). + + | Deprecated Function | Replacement | + | --- | --- | + | `.irow(i)` | `.iloc[i]` | + | `.iget_value(i, j)` | `.iloc[i, j]` or `.iat[i, j]` | + | `.icol(j)` | `.iloc[:, j]` | + +Note + +These indexing function have been deprecated in the documentation since 0.11.0. + +* `Categorical.name` was deprecated to make `Categorical` more `numpy.ndarray` like. Use `Series(cat, name="whatever")` instead ([GH 10482](https://github.com/pandas-dev/pandas/issues/10482)). +* Setting missing values (NaN) in a `Categorical`’s `categories` will issue a warning ([GH 10748](https://github.com/pandas-dev/pandas/issues/10748)). You can still have missing values in the `values`. +* `drop_duplicates` and `duplicated`’s `take_last` keyword was deprecated in favor of `keep`. ([GH 6511](https://github.com/pandas-dev/pandas/issues/6511), [GH 8505](https://github.com/pandas-dev/pandas/issues/8505)) +* `Series.nsmallest` and `nlargest`’s `take_last` keyword was deprecated in favor of `keep`. ([GH 10792](https://github.com/pandas-dev/pandas/issues/10792)) +* `DataFrame.combineAdd` and `DataFrame.combineMult` are deprecated. They + can easily be replaced by using the `add` and `mul` methods: + `DataFrame.add(other, fill_value=0)` and `DataFrame.mul(other, fill_value=1.)` + ([GH 10735](https://github.com/pandas-dev/pandas/issues/10735)). +* `TimeSeries` deprecated in favor of `Series` (note that this has been an alias since 0.13.0), ([GH 10890](https://github.com/pandas-dev/pandas/issues/10890)) +* `SparsePanel` deprecated and will be removed in a future version ([GH 11157](https://github.com/pandas-dev/pandas/issues/11157)). +* `Series.is_time_series` deprecated in favor of `Series.index.is_all_dates` ([GH 11135](https://github.com/pandas-dev/pandas/issues/11135)) +* Legacy offsets (like `'A@JAN'`) are deprecated (note that this has been alias since 0.8.0) ([GH 10878](https://github.com/pandas-dev/pandas/issues/10878)) +* `WidePanel` deprecated in favor of `Panel`, `LongPanel` in favor of `DataFrame` (note these have been aliases since < 0.11.0), ([GH 10892](https://github.com/pandas-dev/pandas/issues/10892)) +* `DataFrame.convert_objects` has been deprecated in favor of type-specific functions `pd.to_datetime`, `pd.to_timestamp` and `pd.to_numeric` (new in 0.17.0) ([GH 11133](https://github.com/pandas-dev/pandas/issues/11133)). + +### Removal of prior version deprecations/changes[#](#removal-of-prior-version-deprecations-changes "Link to this heading") + +* Removal of `na_last` parameters from `Series.order()` and `Series.sort()`, in favor of `na_position`. ([GH 5231](https://github.com/pandas-dev/pandas/issues/5231)) +* Remove of `percentile_width` from `.describe()`, in favor of `percentiles`. ([GH 7088](https://github.com/pandas-dev/pandas/issues/7088)) +* Removal of `colSpace` parameter from `DataFrame.to_string()`, in favor of `col_space`, circa 0.8.0 version. +* Removal of automatic time-series broadcasting ([GH 2304](https://github.com/pandas-dev/pandas/issues/2304)) + + ```None + In [88]: np.random.seed(1234) + + In [89]: df = pd.DataFrame( + ....: np.random.randn(5, 2), + ....: columns=list("AB"), + ....: index=pd.date_range("2013-01-01", periods=5), + ....: ) + ....: + + In [90]: df + Out[90]: + A B + 2013-01-01 0.471435 -1.190976 + 2013-01-02 1.432707 -0.312652 + 2013-01-03 -0.720589 0.887163 + 2013-01-04 0.859588 -0.636524 + 2013-01-05 0.015696 -2.242685 + + [5 rows x 2 columns] + ``` + + Previously + + ```None + In [3]: df + df.A + FutureWarning: TimeSeries broadcasting along DataFrame index by default is deprecated. + Please use DataFrame. to explicitly broadcast arithmetic operations along the index + + Out[3]: + A B + 2013-01-01 0.942870 -0.719541 + 2013-01-02 2.865414 1.120055 + 2013-01-03 -1.441177 0.166574 + 2013-01-04 1.719177 0.223065 + 2013-01-05 0.031393 -2.226989 + ``` + + Current + + ```None + In [91]: df.add(df.A, axis="index") + Out[91]: + A B + 2013-01-01 0.942870 -0.719541 + 2013-01-02 2.865414 1.120055 + 2013-01-03 -1.441177 0.166574 + 2013-01-04 1.719177 0.223065 + 2013-01-05 0.031393 -2.226989 + + [5 rows x 2 columns] + ``` +* Remove `table` keyword in `HDFStore.put/append`, in favor of using `format=` ([GH 4645](https://github.com/pandas-dev/pandas/issues/4645)) +* Remove `kind` in `read_excel/ExcelFile` as its unused ([GH 4712](https://github.com/pandas-dev/pandas/issues/4712)) +* Remove `infer_type` keyword from `pd.read_html` as its unused ([GH 4770](https://github.com/pandas-dev/pandas/issues/4770), [GH 7032](https://github.com/pandas-dev/pandas/issues/7032)) +* Remove `offset` and `timeRule` keywords from `Series.tshift/shift`, in favor of `freq` ([GH 4853](https://github.com/pandas-dev/pandas/issues/4853), [GH 4864](https://github.com/pandas-dev/pandas/issues/4864)) +* Remove `pd.load/pd.save` aliases in favor of `pd.to_pickle/pd.read_pickle` ([GH 3787](https://github.com/pandas-dev/pandas/issues/3787)) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Development support for benchmarking with the [Air Speed Velocity library](https://github.com/spacetelescope/asv/) ([GH 8361](https://github.com/pandas-dev/pandas/issues/8361)) +* Added vbench benchmarks for alternative ExcelWriter engines and reading Excel files ([GH 7171](https://github.com/pandas-dev/pandas/issues/7171)) +* Performance improvements in `Categorical.value_counts` ([GH 10804](https://github.com/pandas-dev/pandas/issues/10804)) +* Performance improvements in `SeriesGroupBy.nunique` and `SeriesGroupBy.value_counts` and `SeriesGroupby.transform` ([GH 10820](https://github.com/pandas-dev/pandas/issues/10820), [GH 11077](https://github.com/pandas-dev/pandas/issues/11077)) +* Performance improvements in `DataFrame.drop_duplicates` with integer dtypes ([GH 10917](https://github.com/pandas-dev/pandas/issues/10917)) +* Performance improvements in `DataFrame.duplicated` with wide frames. ([GH 10161](https://github.com/pandas-dev/pandas/issues/10161), [GH 11180](https://github.com/pandas-dev/pandas/issues/11180)) +* 4x improvement in `timedelta` string parsing ([GH 6755](https://github.com/pandas-dev/pandas/issues/6755), [GH 10426](https://github.com/pandas-dev/pandas/issues/10426)) +* 8x improvement in `timedelta64` and `datetime64` ops ([GH 6755](https://github.com/pandas-dev/pandas/issues/6755)) +* Significantly improved performance of indexing `MultiIndex` with slicers ([GH 10287](https://github.com/pandas-dev/pandas/issues/10287)) +* 8x improvement in `iloc` using list-like input ([GH 10791](https://github.com/pandas-dev/pandas/issues/10791)) +* Improved performance of `Series.isin` for datetimelike/integer Series ([GH 10287](https://github.com/pandas-dev/pandas/issues/10287)) +* 20x improvement in `concat` of Categoricals when categories are identical ([GH 10587](https://github.com/pandas-dev/pandas/issues/10587)) +* Improved performance of `to_datetime` when specified format string is ISO8601 ([GH 10178](https://github.com/pandas-dev/pandas/issues/10178)) +* 2x improvement of `Series.value_counts` for float dtype ([GH 10821](https://github.com/pandas-dev/pandas/issues/10821)) +* Enable `infer_datetime_format` in `to_datetime` when date components do not have 0 padding ([GH 11142](https://github.com/pandas-dev/pandas/issues/11142)) +* Regression from 0.16.1 in constructing `DataFrame` from nested dictionary ([GH 11084](https://github.com/pandas-dev/pandas/issues/11084)) +* Performance improvements in addition/subtraction operations for `DateOffset` with `Series` or `DatetimeIndex` ([GH 10744](https://github.com/pandas-dev/pandas/issues/10744), [GH 11205](https://github.com/pandas-dev/pandas/issues/11205)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in incorrect computation of `.mean()` on `timedelta64[ns]` because of overflow ([GH 9442](https://github.com/pandas-dev/pandas/issues/9442)) +* Bug in `.isin` on older numpies ([GH 11232](https://github.com/pandas-dev/pandas/issues/11232)) +* Bug in `DataFrame.to_html(index=False)` renders unnecessary `name` row ([GH 10344](https://github.com/pandas-dev/pandas/issues/10344)) +* Bug in `DataFrame.to_latex()` the `column_format` argument could not be passed ([GH 9402](https://github.com/pandas-dev/pandas/issues/9402)) +* Bug in `DatetimeIndex` when localizing with `NaT` ([GH 10477](https://github.com/pandas-dev/pandas/issues/10477)) +* Bug in `Series.dt` ops in preserving meta-data ([GH 10477](https://github.com/pandas-dev/pandas/issues/10477)) +* Bug in preserving `NaT` when passed in an otherwise invalid `to_datetime` construction ([GH 10477](https://github.com/pandas-dev/pandas/issues/10477)) +* Bug in `DataFrame.apply` when function returns categorical series. ([GH 9573](https://github.com/pandas-dev/pandas/issues/9573)) +* Bug in `to_datetime` with invalid dates and formats supplied ([GH 10154](https://github.com/pandas-dev/pandas/issues/10154)) +* Bug in `Index.drop_duplicates` dropping name(s) ([GH 10115](https://github.com/pandas-dev/pandas/issues/10115)) +* Bug in `Series.quantile` dropping name ([GH 10881](https://github.com/pandas-dev/pandas/issues/10881)) +* Bug in `pd.Series` when setting a value on an empty `Series` whose index has a frequency. ([GH 10193](https://github.com/pandas-dev/pandas/issues/10193)) +* Bug in `pd.Series.interpolate` with invalid `order` keyword values. ([GH 10633](https://github.com/pandas-dev/pandas/issues/10633)) +* Bug in `DataFrame.plot` raises `ValueError` when color name is specified by multiple characters ([GH 10387](https://github.com/pandas-dev/pandas/issues/10387)) +* Bug in `Index` construction with a mixed list of tuples ([GH 10697](https://github.com/pandas-dev/pandas/issues/10697)) +* Bug in `DataFrame.reset_index` when index contains `NaT`. ([GH 10388](https://github.com/pandas-dev/pandas/issues/10388)) +* Bug in `ExcelReader` when worksheet is empty ([GH 6403](https://github.com/pandas-dev/pandas/issues/6403)) +* Bug in `BinGrouper.group_info` where returned values are not compatible with base class ([GH 10914](https://github.com/pandas-dev/pandas/issues/10914)) +* Bug in clearing the cache on `DataFrame.pop` and a subsequent inplace op ([GH 10912](https://github.com/pandas-dev/pandas/issues/10912)) +* Bug in indexing with a mixed-integer `Index` causing an `ImportError` ([GH 10610](https://github.com/pandas-dev/pandas/issues/10610)) +* Bug in `Series.count` when index has nulls ([GH 10946](https://github.com/pandas-dev/pandas/issues/10946)) +* Bug in pickling of a non-regular freq `DatetimeIndex` ([GH 11002](https://github.com/pandas-dev/pandas/issues/11002)) +* Bug causing `DataFrame.where` to not respect the `axis` parameter when the frame has a symmetric shape. ([GH 9736](https://github.com/pandas-dev/pandas/issues/9736)) +* Bug in `Table.select_column` where name is not preserved ([GH 10392](https://github.com/pandas-dev/pandas/issues/10392)) +* Bug in `offsets.generate_range` where `start` and `end` have finer precision than `offset` ([GH 9907](https://github.com/pandas-dev/pandas/issues/9907)) +* Bug in `pd.rolling_*` where `Series.name` would be lost in the output ([GH 10565](https://github.com/pandas-dev/pandas/issues/10565)) +* Bug in `stack` when index or columns are not unique. ([GH 10417](https://github.com/pandas-dev/pandas/issues/10417)) +* Bug in setting a `Panel` when an axis has a MultiIndex ([GH 10360](https://github.com/pandas-dev/pandas/issues/10360)) +* Bug in `USFederalHolidayCalendar` where `USMemorialDay` and `USMartinLutherKingJr` were incorrect ([GH 10278](https://github.com/pandas-dev/pandas/issues/10278) and [GH 9760](https://github.com/pandas-dev/pandas/issues/9760) ) +* Bug in `.sample()` where returned object, if set, gives unnecessary `SettingWithCopyWarning` ([GH 10738](https://github.com/pandas-dev/pandas/issues/10738)) +* Bug in `.sample()` where weights passed as `Series` were not aligned along axis before being treated positionally, potentially causing problems if weight indices were not aligned with sampled object. ([GH 10738](https://github.com/pandas-dev/pandas/issues/10738)) +* Regression fixed in ([GH 9311](https://github.com/pandas-dev/pandas/issues/9311), [GH 6620](https://github.com/pandas-dev/pandas/issues/6620), [GH 9345](https://github.com/pandas-dev/pandas/issues/9345)), where groupby with a datetime-like converting to float with certain aggregators ([GH 10979](https://github.com/pandas-dev/pandas/issues/10979)) +* Bug in `DataFrame.interpolate` with `axis=1` and `inplace=True` ([GH 10395](https://github.com/pandas-dev/pandas/issues/10395)) +* Bug in `io.sql.get_schema` when specifying multiple columns as primary + key ([GH 10385](https://github.com/pandas-dev/pandas/issues/10385)). +* Bug in `groupby(sort=False)` with datetime-like `Categorical` raises `ValueError` ([GH 10505](https://github.com/pandas-dev/pandas/issues/10505)) +* Bug in `groupby(axis=1)` with `filter()` throws `IndexError` ([GH 11041](https://github.com/pandas-dev/pandas/issues/11041)) +* Bug in `test_categorical` on big-endian builds ([GH 10425](https://github.com/pandas-dev/pandas/issues/10425)) +* Bug in `Series.shift` and `DataFrame.shift` not supporting categorical data ([GH 9416](https://github.com/pandas-dev/pandas/issues/9416)) +* Bug in `Series.map` using categorical `Series` raises `AttributeError` ([GH 10324](https://github.com/pandas-dev/pandas/issues/10324)) +* Bug in `MultiIndex.get_level_values` including `Categorical` raises `AttributeError` ([GH 10460](https://github.com/pandas-dev/pandas/issues/10460)) +* Bug in `pd.get_dummies` with `sparse=True` not returning `SparseDataFrame` ([GH 10531](https://github.com/pandas-dev/pandas/issues/10531)) +* Bug in `Index` subtypes (such as `PeriodIndex`) not returning their own type for `.drop` and `.insert` methods ([GH 10620](https://github.com/pandas-dev/pandas/issues/10620)) +* Bug in `algos.outer_join_indexer` when `right` array is empty ([GH 10618](https://github.com/pandas-dev/pandas/issues/10618)) +* Bug in `filter` (regression from 0.16.0) and `transform` when grouping on multiple keys, one of which is datetime-like ([GH 10114](https://github.com/pandas-dev/pandas/issues/10114)) +* Bug in `to_datetime` and `to_timedelta` causing `Index` name to be lost ([GH 10875](https://github.com/pandas-dev/pandas/issues/10875)) +* Bug in `len(DataFrame.groupby)` causing `IndexError` when there’s a column containing only NaNs ([GH 11016](https://github.com/pandas-dev/pandas/issues/11016)) +* Bug that caused segfault when resampling an empty Series ([GH 10228](https://github.com/pandas-dev/pandas/issues/10228)) +* Bug in `DatetimeIndex` and `PeriodIndex.value_counts` resets name from its result, but retains in result’s `Index`. ([GH 10150](https://github.com/pandas-dev/pandas/issues/10150)) +* Bug in `pd.eval` using `numexpr` engine coerces 1 element numpy array to scalar ([GH 10546](https://github.com/pandas-dev/pandas/issues/10546)) +* Bug in `pd.concat` with `axis=0` when column is of dtype `category` ([GH 10177](https://github.com/pandas-dev/pandas/issues/10177)) +* Bug in `read_msgpack` where input type is not always checked ([GH 10369](https://github.com/pandas-dev/pandas/issues/10369), [GH 10630](https://github.com/pandas-dev/pandas/issues/10630)) +* Bug in `pd.read_csv` with kwargs `index_col=False`, `index_col=['a', 'b']` or `dtype` + ([GH 10413](https://github.com/pandas-dev/pandas/issues/10413), [GH 10467](https://github.com/pandas-dev/pandas/issues/10467), [GH 10577](https://github.com/pandas-dev/pandas/issues/10577)) +* Bug in `Series.from_csv` with `header` kwarg not setting the `Series.name` or the `Series.index.name` ([GH 10483](https://github.com/pandas-dev/pandas/issues/10483)) +* Bug in `groupby.var` which caused variance to be inaccurate for small float values ([GH 10448](https://github.com/pandas-dev/pandas/issues/10448)) +* Bug in `Series.plot(kind='hist')` Y Label not informative ([GH 10485](https://github.com/pandas-dev/pandas/issues/10485)) +* Bug in `read_csv` when using a converter which generates a `uint8` type ([GH 9266](https://github.com/pandas-dev/pandas/issues/9266)) +* Bug causes memory leak in time-series line and area plot ([GH 9003](https://github.com/pandas-dev/pandas/issues/9003)) +* Bug when setting a `Panel` sliced along the major or minor axes when the right-hand side is a `DataFrame` ([GH 11014](https://github.com/pandas-dev/pandas/issues/11014)) +* Bug that returns `None` and does not raise `NotImplementedError` when operator functions (e.g. `.add`) of `Panel` are not implemented ([GH 7692](https://github.com/pandas-dev/pandas/issues/7692)) +* Bug in line and kde plot cannot accept multiple colors when `subplots=True` ([GH 9894](https://github.com/pandas-dev/pandas/issues/9894)) +* Bug in `DataFrame.plot` raises `ValueError` when color name is specified by multiple characters ([GH 10387](https://github.com/pandas-dev/pandas/issues/10387)) +* Bug in left and right `align` of `Series` with `MultiIndex` may be inverted ([GH 10665](https://github.com/pandas-dev/pandas/issues/10665)) +* Bug in left and right `join` of with `MultiIndex` may be inverted ([GH 10741](https://github.com/pandas-dev/pandas/issues/10741)) +* Bug in `read_stata` when reading a file with a different order set in `columns` ([GH 10757](https://github.com/pandas-dev/pandas/issues/10757)) +* Bug in `Categorical` may not representing properly when category contains `tz` or `Period` ([GH 10713](https://github.com/pandas-dev/pandas/issues/10713)) +* Bug in `Categorical.__iter__` may not returning correct `datetime` and `Period` ([GH 10713](https://github.com/pandas-dev/pandas/issues/10713)) +* Bug in indexing with a `PeriodIndex` on an object with a `PeriodIndex` ([GH 4125](https://github.com/pandas-dev/pandas/issues/4125)) +* Bug in `read_csv` with `engine='c'`: EOF preceded by a comment, blank line, etc. was not handled correctly ([GH 10728](https://github.com/pandas-dev/pandas/issues/10728), [GH 10548](https://github.com/pandas-dev/pandas/issues/10548)) +* Reading “famafrench” data via `DataReader` results in HTTP 404 error because of the website url is changed ([GH 10591](https://github.com/pandas-dev/pandas/issues/10591)). +* Bug in `read_msgpack` where DataFrame to decode has duplicate column names ([GH 9618](https://github.com/pandas-dev/pandas/issues/9618)) +* Bug in `io.common.get_filepath_or_buffer` which caused reading of valid S3 files to fail if the bucket also contained keys for which the user does not have read permission ([GH 10604](https://github.com/pandas-dev/pandas/issues/10604)) +* Bug in vectorised setting of timestamp columns with python `datetime.date` and numpy `datetime64` ([GH 10408](https://github.com/pandas-dev/pandas/issues/10408), [GH 10412](https://github.com/pandas-dev/pandas/issues/10412)) +* Bug in `Index.take` may add unnecessary `freq` attribute ([GH 10791](https://github.com/pandas-dev/pandas/issues/10791)) +* Bug in `merge` with empty `DataFrame` may raise `IndexError` ([GH 10824](https://github.com/pandas-dev/pandas/issues/10824)) +* Bug in `to_latex` where unexpected keyword argument for some documented arguments ([GH 10888](https://github.com/pandas-dev/pandas/issues/10888)) +* Bug in indexing of large `DataFrame` where `IndexError` is uncaught ([GH 10645](https://github.com/pandas-dev/pandas/issues/10645) and [GH 10692](https://github.com/pandas-dev/pandas/issues/10692)) +* Bug in `read_csv` when using the `nrows` or `chunksize` parameters if file contains only a header line ([GH 9535](https://github.com/pandas-dev/pandas/issues/9535)) +* Bug in serialization of `category` types in HDF5 in presence of alternate encodings. ([GH 10366](https://github.com/pandas-dev/pandas/issues/10366)) +* Bug in `pd.DataFrame` when constructing an empty DataFrame with a string dtype ([GH 9428](https://github.com/pandas-dev/pandas/issues/9428)) +* Bug in `pd.DataFrame.diff` when DataFrame is not consolidated ([GH 10907](https://github.com/pandas-dev/pandas/issues/10907)) +* Bug in `pd.unique` for arrays with the `datetime64` or `timedelta64` dtype that meant an array with object dtype was returned instead the original dtype ([GH 9431](https://github.com/pandas-dev/pandas/issues/9431)) +* Bug in `Timedelta` raising error when slicing from 0s ([GH 10583](https://github.com/pandas-dev/pandas/issues/10583)) +* Bug in `DatetimeIndex.take` and `TimedeltaIndex.take` may not raise `IndexError` against invalid index ([GH 10295](https://github.com/pandas-dev/pandas/issues/10295)) +* Bug in `Series([np.nan]).astype('M8[ms]')`, which now returns `Series([pd.NaT])` ([GH 10747](https://github.com/pandas-dev/pandas/issues/10747)) +* Bug in `PeriodIndex.order` reset freq ([GH 10295](https://github.com/pandas-dev/pandas/issues/10295)) +* Bug in `date_range` when `freq` divides `end` as nanos ([GH 10885](https://github.com/pandas-dev/pandas/issues/10885)) +* Bug in `iloc` allowing memory outside bounds of a Series to be accessed with negative integers ([GH 10779](https://github.com/pandas-dev/pandas/issues/10779)) +* Bug in `read_msgpack` where encoding is not respected ([GH 10581](https://github.com/pandas-dev/pandas/issues/10581)) +* Bug preventing access to the first index when using `iloc` with a list containing the appropriate negative integer ([GH 10547](https://github.com/pandas-dev/pandas/issues/10547), [GH 10779](https://github.com/pandas-dev/pandas/issues/10779)) +* Bug in `TimedeltaIndex` formatter causing error while trying to save `DataFrame` with `TimedeltaIndex` using `to_csv` ([GH 10833](https://github.com/pandas-dev/pandas/issues/10833)) +* Bug in `DataFrame.where` when handling Series slicing ([GH 10218](https://github.com/pandas-dev/pandas/issues/10218), [GH 9558](https://github.com/pandas-dev/pandas/issues/9558)) +* Bug where `pd.read_gbq` throws `ValueError` when Bigquery returns zero rows ([GH 10273](https://github.com/pandas-dev/pandas/issues/10273)) +* Bug in `to_json` which was causing segmentation fault when serializing 0-rank ndarray ([GH 9576](https://github.com/pandas-dev/pandas/issues/9576)) +* Bug in plotting functions may raise `IndexError` when plotted on `GridSpec` ([GH 10819](https://github.com/pandas-dev/pandas/issues/10819)) +* Bug in plot result may show unnecessary minor ticklabels ([GH 10657](https://github.com/pandas-dev/pandas/issues/10657)) +* Bug in `groupby` incorrect computation for aggregation on `DataFrame` with `NaT` (E.g `first`, `last`, `min`). ([GH 10590](https://github.com/pandas-dev/pandas/issues/10590), [GH 11010](https://github.com/pandas-dev/pandas/issues/11010)) +* Bug when constructing `DataFrame` where passing a dictionary with only scalar values and specifying columns did not raise an error ([GH 10856](https://github.com/pandas-dev/pandas/issues/10856)) +* Bug in `.var()` causing roundoff errors for highly similar values ([GH 10242](https://github.com/pandas-dev/pandas/issues/10242)) +* Bug in `DataFrame.plot(subplots=True)` with duplicated columns outputs incorrect result ([GH 10962](https://github.com/pandas-dev/pandas/issues/10962)) +* Bug in `Index` arithmetic may result in incorrect class ([GH 10638](https://github.com/pandas-dev/pandas/issues/10638)) +* Bug in `date_range` results in empty if freq is negative annually, quarterly and monthly ([GH 11018](https://github.com/pandas-dev/pandas/issues/11018)) +* Bug in `DatetimeIndex` cannot infer negative freq ([GH 11018](https://github.com/pandas-dev/pandas/issues/11018)) +* Remove use of some deprecated numpy comparison operations, mainly in tests. ([GH 10569](https://github.com/pandas-dev/pandas/issues/10569)) +* Bug in `Index` dtype may not applied properly ([GH 11017](https://github.com/pandas-dev/pandas/issues/11017)) +* Bug in `io.gbq` when testing for minimum google api client version ([GH 10652](https://github.com/pandas-dev/pandas/issues/10652)) +* Bug in `DataFrame` construction from nested `dict` with `timedelta` keys ([GH 11129](https://github.com/pandas-dev/pandas/issues/11129)) +* Bug in `.fillna` against may raise `TypeError` when data contains datetime dtype ([GH 7095](https://github.com/pandas-dev/pandas/issues/7095), [GH 11153](https://github.com/pandas-dev/pandas/issues/11153)) +* Bug in `.groupby` when number of keys to group by is same as length of index ([GH 11185](https://github.com/pandas-dev/pandas/issues/11185)) +* Bug in `convert_objects` where converted values might not be returned if all null and `coerce` ([GH 9589](https://github.com/pandas-dev/pandas/issues/9589)) +* Bug in `convert_objects` where `copy` keyword was not respected ([GH 9589](https://github.com/pandas-dev/pandas/issues/9589)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 112 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Alex Rothberg +* Andrea Bedini + +* Andrew Rosenfeld +* Andy Hayden +* Andy Li + +* Anthonios Partheniou + +* Artemy Kolchinsky +* Bernard Willers +* Charlie Clark + +* Chris + +* Chris Whelan +* Christoph Gohlke + +* Christopher Whelan +* Clark Fitzgerald +* Clearfield Christopher + +* Dan Ringwalt + +* Daniel Ni + +* Data & Code Expert Experimenting with Code on Data + +* David Cottrell +* David John Gagne + +* David Kelly + +* ETF + +* Eduardo Schettino + +* Egor + +* Egor Panfilov + +* Evan Wright +* Frank Pinter + +* Gabriel Araujo + +* Garrett-R +* Gianluca Rossi + +* Guillaume Gay +* Guillaume Poulin +* Harsh Nisar + +* Ian Henriksen + +* Ian Hoegen + +* Jaidev Deshpande + +* Jan Rudolph + +* Jan Schulz +* Jason Swails + +* Jeff Reback +* Jonas Buyl + +* Joris Van den Bossche +* Joris Vankerschaver + +* Josh Levy-Kramer + +* Julien Danjou +* Ka Wo Chen +* Karrie Kehoe + +* Kelsey Jordahl +* Kerby Shedden +* Kevin Sheppard +* Lars Buitinck +* Leif Johnson + +* Luis Ortiz + +* Mac + +* Matt Gambogi + +* Matt Savoie + +* Matthew Gilbert + +* Maximilian Roos + +* Michelangelo D’Agostino + +* Mortada Mehyar +* Nick Eubank +* Nipun Batra +* Ondřej Čertík +* Phillip Cloud +* Pratap Vardhan + +* Rafal Skolasinski + +* Richard Lewis + +* Rinoc Johnson + +* Rob Levy +* Robert Gieseke +* Safia Abdalla + +* Samuel Denny + +* Saumitra Shahapure + +* Sebastian Pölsterl + +* Sebastian Rubbert + +* Sheppard, Kevin + +* Sinhrks +* Siu Kwan Lam + +* Skipper Seabold +* Spencer Carrucciu + +* Stephan Hoyer +* Stephen Hoover + +* Stephen Pascoe + +* Terry Santegoeds + +* Thomas Grainger +* Tjerk Santegoeds + +* Tom Augspurger +* Vincent Davis + +* Winterflower + +* Yaroslav Halchenko +* Yuan Tang (Terry) + +* agijsberts +* ajcr + +* behzad nouri +* cel4 +* chris-b1 + +* cyrusmaher + +* davidovitch + +* ganego + +* jreback +* juricast + +* larvian + +* maximilianr + +* msund + +* rekcahpassyla +* robertzk + +* scls19fr +* seth-p +* sinhrks +* springcoil + +* terrytangyuan + +* tzinckgraf + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.17.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.17.1.md new file mode 100644 index 0000000000000000000000000000000000000000..a413e69cb98a6650003b14cd3515dc8c762e548d --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.17.1.md @@ -0,0 +1,322 @@ +# What's new in pandas 0.17.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.17.1.html + +# Version 0.17.1 (November 21, 2015)[#](#version-0-17-1-november-21-2015 "Link to this heading") + +Note + +We are proud to announce that *pandas* has become a sponsored project of the ([NumFOCUS organization](http://www.numfocus.org/blog/numfocus-announces-new-fiscally-sponsored-project-pandas)). This will help ensure the success of development of *pandas* as a world-class open-source project. + +This is a minor bug-fix release from 0.17.0 and includes a large number of +bug fixes along several new features, enhancements, and performance improvements. +We recommend that all users upgrade to this version. + +Highlights include: + +* Support for Conditional HTML Formatting, see [here](#whatsnew-0171-style) +* Releasing the GIL on the csv reader & other ops, see [here](#whatsnew-0171-performance) +* Fixed regression in `DataFrame.drop_duplicates` from 0.16.2, causing incorrect results on integer values ([GH 11376](https://github.com/pandas-dev/pandas/issues/11376)) + +What’s new in v0.17.1 + +* [New features](#new-features) + + + [Conditional HTML formatting](#conditional-html-formatting) +* [Enhancements](#enhancements) +* [API changes](#api-changes) + + + [Deprecations](#deprecations) +* [Performance improvements](#performance-improvements) +* [Bug fixes](#bug-fixes) +* [Contributors](#contributors) + +## New features[#](#new-features "Link to this heading") + +### Conditional HTML formatting[#](#conditional-html-formatting "Link to this heading") + +Warning + +This is a new feature and is under active development. +We’ll be adding features an possibly making breaking changes in future +releases. Feedback is welcome in [GH 11610](https://github.com/pandas-dev/pandas/issues/11610) + +We’ve added *experimental* support for conditional HTML formatting: +the visual styling of a DataFrame based on the data. +The styling is accomplished with HTML and CSS. +Accesses the styler class with the [`pandas.DataFrame.style`](../reference/api/pandas.DataFrame.style.html#pandas.DataFrame.style "pandas.DataFrame.style"), attribute, +an instance of [`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") with your data attached. + +Here’s a quick example: + +> ```None +> In [1]: np.random.seed(123) +> +> In [2]: df = pd.DataFrame(np.random.randn(10, 5), columns=list("abcde")) +> +> In [3]: html = df.style.background_gradient(cmap="viridis", low=0.5) +> ``` + +We can render the HTML to get the following table. + +| a b c d e | | | | | | +| --- | --- | --- | --- | --- | --- | +| 0 -1.085631 0.997345 0.282978 -1.506295 -0.5786 | | | | | | +| 1 1.651437 -2.426679 -0.428913 1.265936 -0.86674 | | | | | | +| 2 -0.678886 -0.094709 1.49139 -0.638902 -0.443982 | | | | | | +| 3 -0.434351 2.20593 2.186786 1.004054 0.386186 | | | | | | +| 4 0.737369 1.490732 -0.935834 1.175829 -1.253881 | | | | | | +| 5 -0.637752 0.907105 -1.428681 -0.140069 -0.861755 | | | | | | +| 6 -0.255619 -2.798589 -1.771533 -0.699877 0.927462 | | | | | | +| 7 -0.173636 0.002846 0.688223 -0.879536 0.283627 | | | | | | +| 8 -0.805367 -1.727669 -0.3909 0.573806 0.338589 | | | | | | +| 9 -0.01183 2.392365 0.412912 0.978736 2.238143 | | | | | | + +[`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") interacts nicely with the Jupyter Notebook. +See the [documentation](../user_guide/style.html) for more. + +## Enhancements[#](#enhancements "Link to this heading") + +* `DatetimeIndex` now supports conversion to strings with `astype(str)` ([GH 10442](https://github.com/pandas-dev/pandas/issues/10442)) +* Support for `compression` (gzip/bz2) in [`pandas.DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") ([GH 7615](https://github.com/pandas-dev/pandas/issues/7615)) +* `pd.read_*` functions can now also accept [`pathlib.Path`](https://docs.python.org/3/library/pathlib.html#pathlib.Path "(in Python v3.13)"), or `py:py._path.local.LocalPath` + objects for the `filepath_or_buffer` argument. ([GH 11033](https://github.com/pandas-dev/pandas/issues/11033)) + - The `DataFrame` and `Series` functions `.to_csv()`, `.to_html()` and `.to_latex()` can now handle paths beginning with tildes (e.g. `~/Documents/`) ([GH 11438](https://github.com/pandas-dev/pandas/issues/11438)) +* `DataFrame` now uses the fields of a `namedtuple` as columns, if columns are not supplied ([GH 11181](https://github.com/pandas-dev/pandas/issues/11181)) +* `DataFrame.itertuples()` now returns `namedtuple` objects, when possible. ([GH 11269](https://github.com/pandas-dev/pandas/issues/11269), [GH 11625](https://github.com/pandas-dev/pandas/issues/11625)) +* Added `axvlines_kwds` to parallel coordinates plot ([GH 10709](https://github.com/pandas-dev/pandas/issues/10709)) +* Option to `.info()` and `.memory_usage()` to provide for deep introspection of memory consumption. Note that this can be expensive to compute and therefore is an optional parameter. ([GH 11595](https://github.com/pandas-dev/pandas/issues/11595)) + + ```None + In [4]: df = pd.DataFrame({"A": ["foo"] * 1000}) # noqa: F821 + + In [5]: df["B"] = df["A"].astype("category") + + # shows the '+' as we have object dtypes + In [6]: df.info() + + RangeIndex: 1000 entries, 0 to 999 + Data columns (total 2 columns): + # Column Non-Null Count Dtype + --- ------ -------------- ----- + 0 A 1000 non-null object + 1 B 1000 non-null category + dtypes: category(1), object(1) + memory usage: 9.0+ KB + + # we have an accurate memory assessment (but can be expensive to compute this) + In [7]: df.info(memory_usage="deep") + + RangeIndex: 1000 entries, 0 to 999 + Data columns (total 2 columns): + # Column Non-Null Count Dtype + --- ------ -------------- ----- + 0 A 1000 non-null object + 1 B 1000 non-null category + dtypes: category(1), object(1) + memory usage: 59.9 KB + ``` +* `Index` now has a `fillna` method ([GH 10089](https://github.com/pandas-dev/pandas/issues/10089)) + + ```None + In [8]: pd.Index([1, np.nan, 3]).fillna(2) + Out[8]: Index([1.0, 2.0, 3.0], dtype='float64') + ``` +* Series of type `category` now make `.str.<...>` and `.dt.<...>` accessor methods / properties available, if the categories are of that type. ([GH 10661](https://github.com/pandas-dev/pandas/issues/10661)) + + ```None + In [9]: s = pd.Series(list("aabb")).astype("category") + + In [10]: s + Out[10]: + 0 a + 1 a + 2 b + 3 b + Length: 4, dtype: category + Categories (2, object): ['a', 'b'] + + In [11]: s.str.contains("a") + Out[11]: + 0 True + 1 True + 2 False + 3 False + Length: 4, dtype: bool + + In [12]: date = pd.Series(pd.date_range("1/1/2015", periods=5)).astype("category") + + In [13]: date + Out[13]: + 0 2015-01-01 + 1 2015-01-02 + 2 2015-01-03 + 3 2015-01-04 + 4 2015-01-05 + Length: 5, dtype: category + Categories (5, datetime64[ns]): [2015-01-01, 2015-01-02, 2015-01-03, 2015-01-04, 2015-01-05] + + In [14]: date.dt.day + Out[14]: + 0 1 + 1 2 + 2 3 + 3 4 + 4 5 + Length: 5, dtype: int32 + ``` +* `pivot_table` now has a `margins_name` argument so you can use something other than the default of ‘All’ ([GH 3335](https://github.com/pandas-dev/pandas/issues/3335)) +* Implement export of `datetime64[ns, tz]` dtypes with a fixed HDF5 store ([GH 11411](https://github.com/pandas-dev/pandas/issues/11411)) +* Pretty printing sets (e.g. in DataFrame cells) now uses set literal syntax (`{x, y}`) instead of + Legacy Python syntax (`set([x, y])`) ([GH 11215](https://github.com/pandas-dev/pandas/issues/11215)) +* Improve the error message in `pandas.io.gbq.to_gbq()` when a streaming insert fails ([GH 11285](https://github.com/pandas-dev/pandas/issues/11285)) + and when the DataFrame does not match the schema of the destination table ([GH 11359](https://github.com/pandas-dev/pandas/issues/11359)) + +## API changes[#](#api-changes "Link to this heading") + +* raise `NotImplementedError` in `Index.shift` for non-supported index types ([GH 8038](https://github.com/pandas-dev/pandas/issues/8038)) +* `min` and `max` reductions on `datetime64` and `timedelta64` dtyped series now + result in `NaT` and not `nan` ([GH 11245](https://github.com/pandas-dev/pandas/issues/11245)). +* Indexing with a null key will raise a `TypeError`, instead of a `ValueError` ([GH 11356](https://github.com/pandas-dev/pandas/issues/11356)) +* `Series.ptp` will now ignore missing values by default ([GH 11163](https://github.com/pandas-dev/pandas/issues/11163)) + +### Deprecations[#](#deprecations "Link to this heading") + +* The `pandas.io.ga` module which implements `google-analytics` support is deprecated and will be removed in a future version ([GH 11308](https://github.com/pandas-dev/pandas/issues/11308)) +* Deprecate the `engine` keyword in `.to_csv()`, which will be removed in a future version ([GH 11274](https://github.com/pandas-dev/pandas/issues/11274)) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Checking monotonic-ness before sorting on an index ([GH 11080](https://github.com/pandas-dev/pandas/issues/11080)) +* `Series.dropna` performance improvement when its dtype can’t contain `NaN` ([GH 11159](https://github.com/pandas-dev/pandas/issues/11159)) +* Release the GIL on most datetime field operations (e.g. `DatetimeIndex.year`, `Series.dt.year`), normalization, and conversion to and from `Period`, `DatetimeIndex.to_period` and `PeriodIndex.to_timestamp` ([GH 11263](https://github.com/pandas-dev/pandas/issues/11263)) +* Release the GIL on some rolling algos: `rolling_median`, `rolling_mean`, `rolling_max`, `rolling_min`, `rolling_var`, `rolling_kurt`, `rolling_skew` ([GH 11450](https://github.com/pandas-dev/pandas/issues/11450)) +* Release the GIL when reading and parsing text files in `read_csv`, `read_table` ([GH 11272](https://github.com/pandas-dev/pandas/issues/11272)) +* Improved performance of `rolling_median` ([GH 11450](https://github.com/pandas-dev/pandas/issues/11450)) +* Improved performance of `to_excel` ([GH 11352](https://github.com/pandas-dev/pandas/issues/11352)) +* Performance bug in repr of `Categorical` categories, which was rendering the strings before chopping them for display ([GH 11305](https://github.com/pandas-dev/pandas/issues/11305)) +* Performance improvement in `Categorical.remove_unused_categories`, ([GH 11643](https://github.com/pandas-dev/pandas/issues/11643)). +* Improved performance of `Series` constructor with no data and `DatetimeIndex` ([GH 11433](https://github.com/pandas-dev/pandas/issues/11433)) +* Improved performance of `shift`, `cumprod`, and `cumsum` with groupby ([GH 4095](https://github.com/pandas-dev/pandas/issues/4095)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* `SparseArray.__iter__()` now does not cause `PendingDeprecationWarning` in Python 3.5 ([GH 11622](https://github.com/pandas-dev/pandas/issues/11622)) +* Regression from 0.16.2 for output formatting of long floats/nan, restored in ([GH 11302](https://github.com/pandas-dev/pandas/issues/11302)) +* `Series.sort_index()` now correctly handles the `inplace` option ([GH 11402](https://github.com/pandas-dev/pandas/issues/11402)) +* Incorrectly distributed .c file in the build on `PyPi` when reading a csv of floats and passing `na_values=` would show an exception ([GH 11374](https://github.com/pandas-dev/pandas/issues/11374)) +* Bug in `.to_latex()` output broken when the index has a name ([GH 10660](https://github.com/pandas-dev/pandas/issues/10660)) +* Bug in `HDFStore.append` with strings whose encoded length exceeded the max unencoded length ([GH 11234](https://github.com/pandas-dev/pandas/issues/11234)) +* Bug in merging `datetime64[ns, tz]` dtypes ([GH 11405](https://github.com/pandas-dev/pandas/issues/11405)) +* Bug in `HDFStore.select` when comparing with a numpy scalar in a where clause ([GH 11283](https://github.com/pandas-dev/pandas/issues/11283)) +* Bug in using `DataFrame.ix` with a MultiIndex indexer ([GH 11372](https://github.com/pandas-dev/pandas/issues/11372)) +* Bug in `date_range` with ambiguous endpoints ([GH 11626](https://github.com/pandas-dev/pandas/issues/11626)) +* Prevent adding new attributes to the accessors `.str`, `.dt` and `.cat`. Retrieving such + a value was not possible, so error out on setting it. ([GH 10673](https://github.com/pandas-dev/pandas/issues/10673)) +* Bug in tz-conversions with an ambiguous time and `.dt` accessors ([GH 11295](https://github.com/pandas-dev/pandas/issues/11295)) +* Bug in output formatting when using an index of ambiguous times ([GH 11619](https://github.com/pandas-dev/pandas/issues/11619)) +* Bug in comparisons of Series vs list-likes ([GH 11339](https://github.com/pandas-dev/pandas/issues/11339)) +* Bug in `DataFrame.replace` with a `datetime64[ns, tz]` and a non-compat to\_replace ([GH 11326](https://github.com/pandas-dev/pandas/issues/11326), [GH 11153](https://github.com/pandas-dev/pandas/issues/11153)) +* Bug in `isnull` where `numpy.datetime64('NaT')` in a `numpy.array` was not determined to be null([GH 11206](https://github.com/pandas-dev/pandas/issues/11206)) +* Bug in list-like indexing with a mixed-integer Index ([GH 11320](https://github.com/pandas-dev/pandas/issues/11320)) +* Bug in `pivot_table` with `margins=True` when indexes are of `Categorical` dtype ([GH 10993](https://github.com/pandas-dev/pandas/issues/10993)) +* Bug in `DataFrame.plot` cannot use hex strings colors ([GH 10299](https://github.com/pandas-dev/pandas/issues/10299)) +* Regression in `DataFrame.drop_duplicates` from 0.16.2, causing incorrect results on integer values ([GH 11376](https://github.com/pandas-dev/pandas/issues/11376)) +* Bug in `pd.eval` where unary ops in a list error ([GH 11235](https://github.com/pandas-dev/pandas/issues/11235)) +* Bug in `squeeze()` with zero length arrays ([GH 11230](https://github.com/pandas-dev/pandas/issues/11230), [GH 8999](https://github.com/pandas-dev/pandas/issues/8999)) +* Bug in `describe()` dropping column names for hierarchical indexes ([GH 11517](https://github.com/pandas-dev/pandas/issues/11517)) +* Bug in `DataFrame.pct_change()` not propagating `axis` keyword on `.fillna` method ([GH 11150](https://github.com/pandas-dev/pandas/issues/11150)) +* Bug in `.to_csv()` when a mix of integer and string column names are passed as the `columns` parameter ([GH 11637](https://github.com/pandas-dev/pandas/issues/11637)) +* Bug in indexing with a `range`, ([GH 11652](https://github.com/pandas-dev/pandas/issues/11652)) +* Bug in inference of numpy scalars and preserving dtype when setting columns ([GH 11638](https://github.com/pandas-dev/pandas/issues/11638)) +* Bug in `to_sql` using unicode column names giving UnicodeEncodeError with ([GH 11431](https://github.com/pandas-dev/pandas/issues/11431)). +* Fix regression in setting of `xticks` in `plot` ([GH 11529](https://github.com/pandas-dev/pandas/issues/11529)). +* Bug in `holiday.dates` where observance rules could not be applied to holiday and doc enhancement ([GH 11477](https://github.com/pandas-dev/pandas/issues/11477), [GH 11533](https://github.com/pandas-dev/pandas/issues/11533)) +* Fix plotting issues when having plain `Axes` instances instead of `SubplotAxes` ([GH 11520](https://github.com/pandas-dev/pandas/issues/11520), [GH 11556](https://github.com/pandas-dev/pandas/issues/11556)). +* Bug in `DataFrame.to_latex()` produces an extra rule when `header=False` ([GH 7124](https://github.com/pandas-dev/pandas/issues/7124)) +* Bug in `df.groupby(...).apply(func)` when a func returns a `Series` containing a new datetimelike column ([GH 11324](https://github.com/pandas-dev/pandas/issues/11324)) +* Bug in `pandas.json` when file to load is big ([GH 11344](https://github.com/pandas-dev/pandas/issues/11344)) +* Bugs in `to_excel` with duplicate columns ([GH 11007](https://github.com/pandas-dev/pandas/issues/11007), [GH 10982](https://github.com/pandas-dev/pandas/issues/10982), [GH 10970](https://github.com/pandas-dev/pandas/issues/10970)) +* Fixed a bug that prevented the construction of an empty series of dtype `datetime64[ns, tz]` ([GH 11245](https://github.com/pandas-dev/pandas/issues/11245)). +* Bug in `read_excel` with MultiIndex containing integers ([GH 11317](https://github.com/pandas-dev/pandas/issues/11317)) +* Bug in `to_excel` with openpyxl 2.2+ and merging ([GH 11408](https://github.com/pandas-dev/pandas/issues/11408)) +* Bug in `DataFrame.to_dict()` produces a `np.datetime64` object instead of `Timestamp` when only datetime is present in data ([GH 11327](https://github.com/pandas-dev/pandas/issues/11327)) +* Bug in `DataFrame.corr()` raises exception when computes Kendall correlation for DataFrames with boolean and not boolean columns ([GH 11560](https://github.com/pandas-dev/pandas/issues/11560)) +* Bug in the link-time error caused by C `inline` functions on FreeBSD 10+ (with `clang`) ([GH 10510](https://github.com/pandas-dev/pandas/issues/10510)) +* Bug in `DataFrame.to_csv` in passing through arguments for formatting `MultiIndexes`, including `date_format` ([GH 7791](https://github.com/pandas-dev/pandas/issues/7791)) +* Bug in `DataFrame.join()` with `how='right'` producing a `TypeError` ([GH 11519](https://github.com/pandas-dev/pandas/issues/11519)) +* Bug in `Series.quantile` with empty list results has `Index` with `object` dtype ([GH 11588](https://github.com/pandas-dev/pandas/issues/11588)) +* Bug in `pd.merge` results in empty `Int64Index` rather than `Index(dtype=object)` when the merge result is empty ([GH 11588](https://github.com/pandas-dev/pandas/issues/11588)) +* Bug in `Categorical.remove_unused_categories` when having `NaN` values ([GH 11599](https://github.com/pandas-dev/pandas/issues/11599)) +* Bug in `DataFrame.to_sparse()` loses column names for MultiIndexes ([GH 11600](https://github.com/pandas-dev/pandas/issues/11600)) +* Bug in `DataFrame.round()` with non-unique column index producing a Fatal Python error ([GH 11611](https://github.com/pandas-dev/pandas/issues/11611)) +* Bug in `DataFrame.round()` with `decimals` being a non-unique indexed Series producing extra columns ([GH 11618](https://github.com/pandas-dev/pandas/issues/11618)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 63 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Aleksandr Drozd + +* Alex Chase + +* Anthonios Partheniou +* BrenBarn + +* Brian J. McGuirk + +* Chris +* Christian Berendt + +* Christian Perez + +* Cody Piersall + +* Data & Code Expert Experimenting with Code on Data +* DrIrv + +* Evan Wright +* Guillaume Gay +* Hamed Saljooghinejad + +* Iblis Lin + +* Jake VanderPlas +* Jan Schulz +* Jean-Mathieu Deschenes + +* Jeff Reback +* Jimmy Callin + +* Joris Van den Bossche +* K.-Michael Aye +* Ka Wo Chen +* Loïc Séguin-C + +* Luo Yicheng + +* Magnus Jöud + +* Manuel Leonhardt + +* Matthew Gilbert +* Maximilian Roos +* Michael + +* Nicholas Stahl + +* Nicolas Bonnotte + +* Pastafarianist + +* Petra Chong + +* Phil Schaf + +* Philipp A + +* Rob deCarvalho + +* Roman Khomenko + +* Rémy Léone + +* Sebastian Bank + +* Sinhrks +* Stephan Hoyer +* Thierry Moisan +* Tom Augspurger +* Tux1 + +* Varun + +* Wieland Hoffmann + +* Winterflower +* Yoav Ram + +* Younggun Kim +* Zeke + +* ajcr +* azuranski + +* behzad nouri +* cel4 +* emilydolson + +* hironow + +* lexual +* llllllllll + +* rockg +* silentquasar + +* sinhrks +* taeold + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.18.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.18.0.md new file mode 100644 index 0000000000000000000000000000000000000000..93921bc1d287d43e7e12b8269dc33aed68ee886e --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.18.0.md @@ -0,0 +1,1824 @@ +# What's new in pandas 0.18.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.18.0.html + +# Version 0.18.0 (March 13, 2016)[#](#version-0-18-0-march-13-2016 "Link to this heading") + +This is a major release from 0.17.1 and includes a small number of API changes, several new features, +enhancements, and performance improvements along with a large number of bug fixes. We recommend that all +users upgrade to this version. + +Warning + +pandas >= 0.18.0 no longer supports compatibility with Python version 2.6 +and 3.3 ([GH 7718](https://github.com/pandas-dev/pandas/issues/7718), [GH 11273](https://github.com/pandas-dev/pandas/issues/11273)) + +Warning + +`numexpr` version 2.4.4 will now show a warning and not be used as a computation back-end for pandas because of some buggy behavior. This does not affect other versions (>= 2.1 and >= 2.4.6). ([GH 12489](https://github.com/pandas-dev/pandas/issues/12489)) + +Highlights include: + +* Moving and expanding window functions are now methods on Series and DataFrame, + similar to `.groupby`, see [here](#whatsnew-0180-enhancements-moments). +* Adding support for a `RangeIndex` as a specialized form of the `Int64Index` + for memory savings, see [here](#whatsnew-0180-enhancements-rangeindex). +* API breaking change to the `.resample` method to make it more `.groupby` + like, see [here](#whatsnew-0180-breaking-resample). +* Removal of support for positional indexing with floats, which was deprecated + since 0.14.0. This will now raise a `TypeError`, see [here](#whatsnew-0180-float-indexers). +* The `.to_xarray()` function has been added for compatibility with the + [xarray package](http://xarray.pydata.org/en/stable/), see [here](#whatsnew-0180-enhancements-xarray). +* The `read_sas` function has been enhanced to read `sas7bdat` files, see [here](#whatsnew-0180-enhancements-sas). +* Addition of the [.str.extractall() method](#whatsnew-0180-enhancements-extract), + and API changes to the [.str.extract() method](#whatsnew-0180-enhancements-extract) + and [.str.cat() method](#whatsnew-0180-enhancements-strcat). +* `pd.test()` top-level nose test runner is available ([GH 4327](https://github.com/pandas-dev/pandas/issues/4327)). + +Check the [API Changes](#whatsnew-0180-api-breaking) and [deprecations](#whatsnew-0180-deprecations) before updating. + +What’s new in v0.18.0 + +* [New features](#new-features) + + + [Window functions are now methods](#window-functions-are-now-methods) + + [Changes to rename](#changes-to-rename) + + [Range Index](#range-index) + + [Changes to str.extract](#changes-to-str-extract) + + [Addition of str.extractall](#addition-of-str-extractall) + + [Changes to str.cat](#changes-to-str-cat) + + [Datetimelike rounding](#datetimelike-rounding) + + [Formatting of integers in FloatIndex](#formatting-of-integers-in-floatindex) + + [Changes to dtype assignment behaviors](#changes-to-dtype-assignment-behaviors) + + [Method to\_xarray](#method-to-xarray) + + [Latex representation](#latex-representation) + + [`pd.read_sas()` changes](#pd-read-sas-changes) + + [Other enhancements](#other-enhancements) +* [Backwards incompatible API changes](#backwards-incompatible-api-changes) + + + [NaT and Timedelta operations](#nat-and-timedelta-operations) + + [Changes to msgpack](#changes-to-msgpack) + + [Signature change for .rank](#signature-change-for-rank) + + [Bug in QuarterBegin with n=0](#bug-in-quarterbegin-with-n-0) + + [Resample API](#resample-api) + + - [Downsampling](#downsampling) + - [Upsampling](#upsampling) + - [Previous API will work but with deprecations](#previous-api-will-work-but-with-deprecations) + + [Changes to eval](#changes-to-eval) + + [Other API changes](#other-api-changes) + + [Deprecations](#deprecations) + + [Removal of deprecated float indexers](#removal-of-deprecated-float-indexers) + + [Removal of prior version deprecations/changes](#removal-of-prior-version-deprecations-changes) +* [Performance improvements](#performance-improvements) +* [Bug fixes](#bug-fixes) +* [Contributors](#contributors) + +## New features[#](#new-features "Link to this heading") + +### Window functions are now methods[#](#window-functions-are-now-methods "Link to this heading") + +Window functions have been refactored to be methods on `Series/DataFrame` objects, rather than top-level functions, which are now deprecated. This allows these window-type functions, to have a similar API to that of `.groupby`. See the full documentation [here](../user_guide/window.html#window-overview) ([GH 11603](https://github.com/pandas-dev/pandas/issues/11603), [GH 12373](https://github.com/pandas-dev/pandas/issues/12373)) + +```None +In [1]: np.random.seed(1234) + +In [2]: df = pd.DataFrame({'A': range(10), 'B': np.random.randn(10)}) + +In [3]: df +Out[3]: + A B +0 0 0.471435 +1 1 -1.190976 +2 2 1.432707 +3 3 -0.312652 +4 4 -0.720589 +5 5 0.887163 +6 6 0.859588 +7 7 -0.636524 +8 8 0.015696 +9 9 -2.242685 + +[10 rows x 2 columns] +``` + +Previous behavior: + +```None +In [8]: pd.rolling_mean(df, window=3) + FutureWarning: pd.rolling_mean is deprecated for DataFrame and will be removed in a future version, replace with + DataFrame.rolling(window=3,center=False).mean() +Out[8]: + A B +0 NaN NaN +1 NaN NaN +2 1 0.237722 +3 2 -0.023640 +4 3 0.133155 +5 4 -0.048693 +6 5 0.342054 +7 6 0.370076 +8 7 0.079587 +9 8 -0.954504 +``` + +New behavior: + +```None +In [4]: r = df.rolling(window=3) +``` + +These show a descriptive repr + +```None +In [5]: r +Out[5]: Rolling [window=3,center=False,axis=0,method=single] +``` + +with tab-completion of available methods and properties. + +```None +In [9]: r. # noqa E225, E999 +r.A r.agg r.apply r.count r.exclusions r.max r.median r.name r.skew r.sum +r.B r.aggregate r.corr r.cov r.kurt r.mean r.min r.quantile r.std r.var +``` + +The methods operate on the `Rolling` object itself + +```None +In [6]: r.mean() +Out[6]: + A B +0 NaN NaN +1 NaN NaN +2 1.0 0.237722 +3 2.0 -0.023640 +4 3.0 0.133155 +5 4.0 -0.048693 +6 5.0 0.342054 +7 6.0 0.370076 +8 7.0 0.079587 +9 8.0 -0.954504 + +[10 rows x 2 columns] +``` + +They provide getitem accessors + +```None +In [7]: r['A'].mean() +Out[7]: +0 NaN +1 NaN +2 1.0 +3 2.0 +4 3.0 +5 4.0 +6 5.0 +7 6.0 +8 7.0 +9 8.0 +Name: A, Length: 10, dtype: float64 +``` + +And multiple aggregations + +```None +In [8]: r.agg({'A': ['mean', 'std'], + ...: 'B': ['mean', 'std']}) + ...: +Out[8]: + A B + mean std mean std +0 NaN NaN NaN NaN +1 NaN NaN NaN NaN +2 1.0 1.0 0.237722 1.327364 +3 2.0 1.0 -0.023640 1.335505 +4 3.0 1.0 0.133155 1.143778 +5 4.0 1.0 -0.048693 0.835747 +6 5.0 1.0 0.342054 0.920379 +7 6.0 1.0 0.370076 0.871850 +8 7.0 1.0 0.079587 0.750099 +9 8.0 1.0 -0.954504 1.162285 + +[10 rows x 4 columns] +``` + +### Changes to rename[#](#changes-to-rename "Link to this heading") + +`Series.rename` and `NDFrame.rename_axis` can now take a scalar or list-like +argument for altering the Series or axis *name*, in addition to their old behaviors of altering labels. ([GH 9494](https://github.com/pandas-dev/pandas/issues/9494), [GH 11965](https://github.com/pandas-dev/pandas/issues/11965)) + +```None +In [9]: s = pd.Series(np.random.randn(5)) + +In [10]: s.rename('newname') +Out[10]: +0 1.150036 +1 0.991946 +2 0.953324 +3 -2.021255 +4 -0.334077 +Name: newname, Length: 5, dtype: float64 +``` + +```None +In [11]: df = pd.DataFrame(np.random.randn(5, 2)) + +In [12]: (df.rename_axis("indexname") + ....: .rename_axis("columns_name", axis="columns")) + ....: +Out[12]: +columns_name 0 1 +indexname +0 0.002118 0.405453 +1 0.289092 1.321158 +2 -1.546906 -0.202646 +3 -0.655969 0.193421 +4 0.553439 1.318152 + +[5 rows x 2 columns] +``` + +The new functionality works well in method chains. Previously these methods only accepted functions or dicts mapping a *label* to a new label. +This continues to work as before for function or dict-like values. + +### Range Index[#](#range-index "Link to this heading") + +A `RangeIndex` has been added to the `Int64Index` sub-classes to support a memory saving alternative for common use cases. This has a similar implementation to the python `range` object (`xrange` in python 2), in that it only stores the start, stop, and step values for the index. It will transparently interact with the user API, converting to `Int64Index` if needed. + +This will now be the default constructed index for `NDFrame` objects, rather than previous an `Int64Index`. ([GH 939](https://github.com/pandas-dev/pandas/issues/939), [GH 12070](https://github.com/pandas-dev/pandas/issues/12070), [GH 12071](https://github.com/pandas-dev/pandas/issues/12071), [GH 12109](https://github.com/pandas-dev/pandas/issues/12109), [GH 12888](https://github.com/pandas-dev/pandas/issues/12888)) + +Previous behavior: + +```None +In [3]: s = pd.Series(range(1000)) + +In [4]: s.index +Out[4]: +Int64Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + ... + 990, 991, 992, 993, 994, 995, 996, 997, 998, 999], dtype='int64', length=1000) + +In [6]: s.index.nbytes +Out[6]: 8000 +``` + +New behavior: + +```None +In [13]: s = pd.Series(range(1000)) + +In [14]: s.index +Out[14]: RangeIndex(start=0, stop=1000, step=1) + +In [15]: s.index.nbytes +Out[15]: 128 +``` + +### Changes to str.extract[#](#changes-to-str-extract "Link to this heading") + +The [.str.extract](../user_guide/text.html#text-extract) method takes a regular +expression with capture groups, finds the first match in each subject +string, and returns the contents of the capture groups +([GH 11386](https://github.com/pandas-dev/pandas/issues/11386)). + +In v0.18.0, the `expand` argument was added to +`extract`. + +* `expand=False`: it returns a `Series`, `Index`, or `DataFrame`, depending on the subject and regular expression pattern (same behavior as pre-0.18.0). +* `expand=True`: it always returns a `DataFrame`, which is more consistent and less confusing from the perspective of a user. + +Currently the default is `expand=None` which gives a `FutureWarning` and uses `expand=False`. To avoid this warning, please explicitly specify `expand`. + +```None +In [1]: pd.Series(['a1', 'b2', 'c3']).str.extract(r'[ab](\d)', expand=None) +FutureWarning: currently extract(expand=None) means expand=False (return Index/Series/DataFrame) +but in a future version of pandas this will be changed to expand=True (return DataFrame) + +Out[1]: +0 1 +1 2 +2 NaN +dtype: object +``` + +Extracting a regular expression with one group returns a Series if +`expand=False`. + +```None +In [16]: pd.Series(['a1', 'b2', 'c3']).str.extract(r'[ab](\d)', expand=False) +Out[16]: +0 1 +1 2 +2 NaN +Length: 3, dtype: object +``` + +It returns a `DataFrame` with one column if `expand=True`. + +```None +In [17]: pd.Series(['a1', 'b2', 'c3']).str.extract(r'[ab](\d)', expand=True) +Out[17]: + 0 +0 1 +1 2 +2 NaN + +[3 rows x 1 columns] +``` + +Calling on an `Index` with a regex with exactly one capture group +returns an `Index` if `expand=False`. + +```None +In [18]: s = pd.Series(["a1", "b2", "c3"], ["A11", "B22", "C33"]) + +In [19]: s.index +Out[19]: Index(['A11', 'B22', 'C33'], dtype='object') + +In [20]: s.index.str.extract("(?P[a-zA-Z])", expand=False) +Out[20]: Index(['A', 'B', 'C'], dtype='object', name='letter') +``` + +It returns a `DataFrame` with one column if `expand=True`. + +```None +In [21]: s.index.str.extract("(?P[a-zA-Z])", expand=True) +Out[21]: + letter +0 A +1 B +2 C + +[3 rows x 1 columns] +``` + +Calling on an `Index` with a regex with more than one capture group +raises `ValueError` if `expand=False`. + +```None +>>> s.index.str.extract("(?P[a-zA-Z])([0-9]+)", expand=False) +ValueError: only one regex group is supported with Index +``` + +It returns a `DataFrame` if `expand=True`. + +```None +In [22]: s.index.str.extract("(?P[a-zA-Z])([0-9]+)", expand=True) +Out[22]: + letter 1 +0 A 11 +1 B 22 +2 C 33 + +[3 rows x 2 columns] +``` + +In summary, `extract(expand=True)` always returns a `DataFrame` +with a row for every subject string, and a column for every capture +group. + +### Addition of str.extractall[#](#addition-of-str-extractall "Link to this heading") + +The [.str.extractall](../user_guide/text.html#text-extractall) method was added +([GH 11386](https://github.com/pandas-dev/pandas/issues/11386)). Unlike `extract`, which returns only the first +match. + +```None +In [23]: s = pd.Series(["a1a2", "b1", "c1"], ["A", "B", "C"]) + +In [24]: s +Out[24]: +A a1a2 +B b1 +C c1 +Length: 3, dtype: object + +In [25]: s.str.extract(r"(?P[ab])(?P\d)", expand=False) +Out[25]: + letter digit +A a 1 +B b 1 +C NaN NaN + +[3 rows x 2 columns] +``` + +The `extractall` method returns all matches. + +```None +In [26]: s.str.extractall(r"(?P[ab])(?P\d)") +Out[26]: + letter digit + match +A 0 a 1 + 1 a 2 +B 0 b 1 + +[3 rows x 2 columns] +``` + +### Changes to str.cat[#](#changes-to-str-cat "Link to this heading") + +The method `.str.cat()` concatenates the members of a `Series`. Before, if `NaN` values were present in the Series, calling `.str.cat()` on it would return `NaN`, unlike the rest of the `Series.str.*` API. This behavior has been amended to ignore `NaN` values by default. ([GH 11435](https://github.com/pandas-dev/pandas/issues/11435)). + +A new, friendlier `ValueError` is added to protect against the mistake of supplying the `sep` as an arg, rather than as a kwarg. ([GH 11334](https://github.com/pandas-dev/pandas/issues/11334)). + +```None +In [27]: pd.Series(['a', 'b', np.nan, 'c']).str.cat(sep=' ') +Out[27]: 'a b c' + +In [28]: pd.Series(['a', 'b', np.nan, 'c']).str.cat(sep=' ', na_rep='?') +Out[28]: 'a b ? c' +``` + +```None +In [2]: pd.Series(['a', 'b', np.nan, 'c']).str.cat(' ') +ValueError: Did you mean to supply a ``sep`` keyword? +``` + +### Datetimelike rounding[#](#datetimelike-rounding "Link to this heading") + +`DatetimeIndex`, `Timestamp`, `TimedeltaIndex`, `Timedelta` have gained the `.round()`, `.floor()` and `.ceil()` method for datetimelike rounding, flooring and ceiling. ([GH 4314](https://github.com/pandas-dev/pandas/issues/4314), [GH 11963](https://github.com/pandas-dev/pandas/issues/11963)) + +Naive datetimes + +```None +In [29]: dr = pd.date_range('20130101 09:12:56.1234', periods=3) + +In [30]: dr +Out[30]: +DatetimeIndex(['2013-01-01 09:12:56.123400', '2013-01-02 09:12:56.123400', + '2013-01-03 09:12:56.123400'], + dtype='datetime64[ns]', freq='D') + +In [31]: dr.round('s') +Out[31]: +DatetimeIndex(['2013-01-01 09:12:56', '2013-01-02 09:12:56', + '2013-01-03 09:12:56'], + dtype='datetime64[ns]', freq=None) + +# Timestamp scalar +In [32]: dr[0] +Out[32]: Timestamp('2013-01-01 09:12:56.123400') + +In [33]: dr[0].round('10s') +Out[33]: Timestamp('2013-01-01 09:13:00') +``` + +Tz-aware are rounded, floored and ceiled in local times + +```None +In [34]: dr = dr.tz_localize('US/Eastern') + +In [35]: dr +Out[35]: +DatetimeIndex(['2013-01-01 09:12:56.123400-05:00', + '2013-01-02 09:12:56.123400-05:00', + '2013-01-03 09:12:56.123400-05:00'], + dtype='datetime64[ns, US/Eastern]', freq=None) + +In [36]: dr.round('s') +Out[36]: +DatetimeIndex(['2013-01-01 09:12:56-05:00', '2013-01-02 09:12:56-05:00', + '2013-01-03 09:12:56-05:00'], + dtype='datetime64[ns, US/Eastern]', freq=None) +``` + +Timedeltas + +```None +In [37]: t = pd.timedelta_range('1 days 2 hr 13 min 45 us', periods=3, freq='d') + +In [38]: t +Out[38]: +TimedeltaIndex(['1 days 02:13:00.000045', '2 days 02:13:00.000045', + '3 days 02:13:00.000045'], + dtype='timedelta64[ns]', freq='D') + +In [39]: t.round('10min') +Out[39]: TimedeltaIndex(['1 days 02:10:00', '2 days 02:10:00', '3 days 02:10:00'], dtype='timedelta64[ns]', freq=None) + +# Timedelta scalar +In [40]: t[0] +Out[40]: Timedelta('1 days 02:13:00.000045') + +In [41]: t[0].round('2h') +Out[41]: Timedelta('1 days 02:00:00') +``` + +In addition, `.round()`, `.floor()` and `.ceil()` will be available through the `.dt` accessor of `Series`. + +```None +In [42]: s = pd.Series(dr) + +In [43]: s +Out[43]: +0 2013-01-01 09:12:56.123400-05:00 +1 2013-01-02 09:12:56.123400-05:00 +2 2013-01-03 09:12:56.123400-05:00 +Length: 3, dtype: datetime64[ns, US/Eastern] + +In [44]: s.dt.round('D') +Out[44]: +0 2013-01-01 00:00:00-05:00 +1 2013-01-02 00:00:00-05:00 +2 2013-01-03 00:00:00-05:00 +Length: 3, dtype: datetime64[ns, US/Eastern] +``` + +### Formatting of integers in FloatIndex[#](#formatting-of-integers-in-floatindex "Link to this heading") + +Integers in `FloatIndex`, e.g. 1., are now formatted with a decimal point and a `0` digit, e.g. `1.0` ([GH 11713](https://github.com/pandas-dev/pandas/issues/11713)) +This change not only affects the display to the console, but also the output of IO methods like `.to_csv` or `.to_html`. + +Previous behavior: + +```None +In [2]: s = pd.Series([1, 2, 3], index=np.arange(3.)) + +In [3]: s +Out[3]: +0 1 +1 2 +2 3 +dtype: int64 + +In [4]: s.index +Out[4]: Float64Index([0.0, 1.0, 2.0], dtype='float64') + +In [5]: print(s.to_csv(path=None)) +0,1 +1,2 +2,3 +``` + +New behavior: + +```None +In [45]: s = pd.Series([1, 2, 3], index=np.arange(3.)) + +In [46]: s +Out[46]: +0.0 1 +1.0 2 +2.0 3 +Length: 3, dtype: int64 + +In [47]: s.index +Out[47]: Index([0.0, 1.0, 2.0], dtype='float64') + +In [48]: print(s.to_csv(path_or_buf=None, header=False)) +0.0,1 +1.0,2 +2.0,3 +``` + +### Changes to dtype assignment behaviors[#](#changes-to-dtype-assignment-behaviors "Link to this heading") + +When a DataFrame’s slice is updated with a new slice of the same dtype, the dtype of the DataFrame will now remain the same. ([GH 10503](https://github.com/pandas-dev/pandas/issues/10503)) + +Previous behavior: + +```None +In [5]: df = pd.DataFrame({'a': [0, 1, 1], + 'b': pd.Series([100, 200, 300], dtype='uint32')}) + +In [7]: df.dtypes +Out[7]: +a int64 +b uint32 +dtype: object + +In [8]: ix = df['a'] == 1 + +In [9]: df.loc[ix, 'b'] = df.loc[ix, 'b'] + +In [11]: df.dtypes +Out[11]: +a int64 +b int64 +dtype: object +``` + +New behavior: + +```None +In [49]: df = pd.DataFrame({'a': [0, 1, 1], + ....: 'b': pd.Series([100, 200, 300], dtype='uint32')}) + ....: + +In [50]: df.dtypes +Out[50]: +a int64 +b uint32 +Length: 2, dtype: object + +In [51]: ix = df['a'] == 1 + +In [52]: df.loc[ix, 'b'] = df.loc[ix, 'b'] + +In [53]: df.dtypes +Out[53]: +a int64 +b uint32 +Length: 2, dtype: object +``` + +When a DataFrame’s integer slice is partially updated with a new slice of floats that could potentially be down-casted to integer without losing precision, the dtype of the slice will be set to float instead of integer. + +Previous behavior: + +```None +In [4]: df = pd.DataFrame(np.array(range(1,10)).reshape(3,3), + columns=list('abc'), + index=[[4,4,8], [8,10,12]]) + +In [5]: df +Out[5]: + a b c +4 8 1 2 3 + 10 4 5 6 +8 12 7 8 9 + +In [7]: df.ix[4, 'c'] = np.array([0., 1.]) + +In [8]: df +Out[8]: + a b c +4 8 1 2 0 + 10 4 5 1 +8 12 7 8 9 +``` + +New behavior: + +```None +In [54]: df = pd.DataFrame(np.array(range(1,10)).reshape(3,3), + ....: columns=list('abc'), + ....: index=[[4,4,8], [8,10,12]]) + ....: + +In [55]: df +Out[55]: + a b c +4 8 1 2 3 + 10 4 5 6 +8 12 7 8 9 + +[3 rows x 3 columns] + +In [56]: df.loc[4, 'c'] = np.array([0., 1.]) + +In [57]: df +Out[57]: + a b c +4 8 1 2 0 + 10 4 5 1 +8 12 7 8 9 + +[3 rows x 3 columns] +``` + +### Method to\_xarray[#](#method-to-xarray "Link to this heading") + +In a future version of pandas, we will be deprecating `Panel` and other > 2 ndim objects. In order to provide for continuity, +all `NDFrame` objects have gained the `.to_xarray()` method in order to convert to `xarray` objects, which has +a pandas-like interface for > 2 ndim. ([GH 11972](https://github.com/pandas-dev/pandas/issues/11972)) + +See the [xarray full-documentation here](http://xarray.pydata.org/en/stable/). + +```None +In [1]: p = Panel(np.arange(2*3*4).reshape(2,3,4)) + +In [2]: p.to_xarray() +Out[2]: + +array([[[ 0, 1, 2, 3], + [ 4, 5, 6, 7], + [ 8, 9, 10, 11]], + + [[12, 13, 14, 15], + [16, 17, 18, 19], + [20, 21, 22, 23]]]) +Coordinates: + * items (items) int64 0 1 + * major_axis (major_axis) int64 0 1 2 + * minor_axis (minor_axis) int64 0 1 2 3 +``` + +### Latex representation[#](#latex-representation "Link to this heading") + +`DataFrame` has gained a `._repr_latex_()` method in order to allow for conversion to latex in a ipython/jupyter notebook using nbconvert. ([GH 11778](https://github.com/pandas-dev/pandas/issues/11778)) + +Note that this must be activated by setting the option `pd.display.latex.repr=True` ([GH 12182](https://github.com/pandas-dev/pandas/issues/12182)) + +For example, if you have a jupyter notebook you plan to convert to latex using nbconvert, place the statement `pd.display.latex.repr=True` in the first cell to have the contained DataFrame output also stored as latex. + +The options `display.latex.escape` and `display.latex.longtable` have also been added to the configuration and are used automatically by the `to_latex` +method. See the [available options docs](../user_guide/options.html#options-available) for more info. + +### `pd.read_sas()` changes[#](#pd-read-sas-changes "Link to this heading") + +`read_sas` has gained the ability to read SAS7BDAT files, including compressed files. The files can be read in entirety, or incrementally. For full details see [here](../user_guide/io.html#io-sas). ([GH 4052](https://github.com/pandas-dev/pandas/issues/4052)) + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* Handle truncated floats in SAS xport files ([GH 11713](https://github.com/pandas-dev/pandas/issues/11713)) +* Added option to hide index in `Series.to_string` ([GH 11729](https://github.com/pandas-dev/pandas/issues/11729)) +* `read_excel` now supports s3 urls of the format `s3://bucketname/filename` ([GH 11447](https://github.com/pandas-dev/pandas/issues/11447)) +* add support for `AWS_S3_HOST` env variable when reading from s3 ([GH 12198](https://github.com/pandas-dev/pandas/issues/12198)) +* A simple version of `Panel.round()` is now implemented ([GH 11763](https://github.com/pandas-dev/pandas/issues/11763)) +* For Python 3.x, `round(DataFrame)`, `round(Series)`, `round(Panel)` will work ([GH 11763](https://github.com/pandas-dev/pandas/issues/11763)) +* `sys.getsizeof(obj)` returns the memory usage of a pandas object, including the + values it contains ([GH 11597](https://github.com/pandas-dev/pandas/issues/11597)) +* `Series` gained an `is_unique` attribute ([GH 11946](https://github.com/pandas-dev/pandas/issues/11946)) +* `DataFrame.quantile` and `Series.quantile` now accept `interpolation` keyword ([GH 10174](https://github.com/pandas-dev/pandas/issues/10174)). +* Added `DataFrame.style.format` for more flexible formatting of cell values ([GH 11692](https://github.com/pandas-dev/pandas/issues/11692)) +* `DataFrame.select_dtypes` now allows the `np.float16` type code ([GH 11990](https://github.com/pandas-dev/pandas/issues/11990)) +* `pivot_table()` now accepts most iterables for the `values` parameter ([GH 12017](https://github.com/pandas-dev/pandas/issues/12017)) +* Added Google `BigQuery` service account authentication support, which enables authentication on remote servers. ([GH 11881](https://github.com/pandas-dev/pandas/issues/11881), [GH 12572](https://github.com/pandas-dev/pandas/issues/12572)). For further details see [here](https://pandas-gbq.readthedocs.io/en/latest/intro.html) +* `HDFStore` is now iterable: `for k in store` is equivalent to `for k in store.keys()` ([GH 12221](https://github.com/pandas-dev/pandas/issues/12221)). +* Add missing methods/fields to `.dt` for `Period` ([GH 8848](https://github.com/pandas-dev/pandas/issues/8848)) +* The entire code base has been `PEP`-ified ([GH 12096](https://github.com/pandas-dev/pandas/issues/12096)) + +## Backwards incompatible API changes[#](#backwards-incompatible-api-changes "Link to this heading") + +* the leading white spaces have been removed from the output of `.to_string(index=False)` method ([GH 11833](https://github.com/pandas-dev/pandas/issues/11833)) +* the `out` parameter has been removed from the `Series.round()` method. ([GH 11763](https://github.com/pandas-dev/pandas/issues/11763)) +* `DataFrame.round()` leaves non-numeric columns unchanged in its return, rather than raises. ([GH 11885](https://github.com/pandas-dev/pandas/issues/11885)) +* `DataFrame.head(0)` and `DataFrame.tail(0)` return empty frames, rather than `self`. ([GH 11937](https://github.com/pandas-dev/pandas/issues/11937)) +* `Series.head(0)` and `Series.tail(0)` return empty series, rather than `self`. ([GH 11937](https://github.com/pandas-dev/pandas/issues/11937)) +* `to_msgpack` and `read_msgpack` encoding now defaults to `'utf-8'`. ([GH 12170](https://github.com/pandas-dev/pandas/issues/12170)) +* the order of keyword arguments to text file parsing functions (`.read_csv()`, `.read_table()`, `.read_fwf()`) changed to group related arguments. ([GH 11555](https://github.com/pandas-dev/pandas/issues/11555)) +* `NaTType.isoformat` now returns the string `'NaT` to allow the result to + be passed to the constructor of `Timestamp`. ([GH 12300](https://github.com/pandas-dev/pandas/issues/12300)) + +### NaT and Timedelta operations[#](#nat-and-timedelta-operations "Link to this heading") + +`NaT` and `Timedelta` have expanded arithmetic operations, which are extended to `Series` +arithmetic where applicable. Operations defined for `datetime64[ns]` or `timedelta64[ns]` +are now also defined for `NaT` ([GH 11564](https://github.com/pandas-dev/pandas/issues/11564)). + +`NaT` now supports arithmetic operations with integers and floats. + +```None +In [58]: pd.NaT * 1 +Out[58]: NaT + +In [59]: pd.NaT * 1.5 +Out[59]: NaT + +In [60]: pd.NaT / 2 +Out[60]: NaT + +In [61]: pd.NaT * np.nan +Out[61]: NaT +``` + +`NaT` defines more arithmetic operations with `datetime64[ns]` and `timedelta64[ns]`. + +```None +In [62]: pd.NaT / pd.NaT +Out[62]: nan + +In [63]: pd.Timedelta('1s') / pd.NaT +Out[63]: nan +``` + +`NaT` may represent either a `datetime64[ns]` null or a `timedelta64[ns]` null. +Given the ambiguity, it is treated as a `timedelta64[ns]`, which allows more operations +to succeed. + +```None +In [64]: pd.NaT + pd.NaT +Out[64]: NaT + +# same as +In [65]: pd.Timedelta('1s') + pd.Timedelta('1s') +Out[65]: Timedelta('0 days 00:00:02') +``` + +as opposed to + +```None +In [3]: pd.Timestamp('19900315') + pd.Timestamp('19900315') +TypeError: unsupported operand type(s) for +: 'Timestamp' and 'Timestamp' +``` + +However, when wrapped in a `Series` whose `dtype` is `datetime64[ns]` or `timedelta64[ns]`, +the `dtype` information is respected. + +```None +In [1]: pd.Series([pd.NaT], dtype='=0.18 / any Python | +| 0.17 / Python 3 | >=0.18 / any Python | +| 0.18 | >= 0.18 | + +0.18.0 is backward-compatible for reading files packed by older versions, except for files packed with 0.17 in Python 2, in which case only they can only be unpacked in Python 2. + +### Signature change for .rank[#](#signature-change-for-rank "Link to this heading") + +`Series.rank` and `DataFrame.rank` now have the same signature ([GH 11759](https://github.com/pandas-dev/pandas/issues/11759)) + +Previous signature + +```None +In [3]: pd.Series([0,1]).rank(method='average', na_option='keep', + ascending=True, pct=False) +Out[3]: +0 1 +1 2 +dtype: float64 + +In [4]: pd.DataFrame([0,1]).rank(axis=0, numeric_only=None, + method='average', na_option='keep', + ascending=True, pct=False) +Out[4]: + 0 +0 1 +1 2 +``` + +New signature + +```None +In [71]: pd.Series([0,1]).rank(axis=0, method='average', numeric_only=False, + ....: na_option='keep', ascending=True, pct=False) + ....: +Out[71]: +0 1.0 +1 2.0 +Length: 2, dtype: float64 + +In [72]: pd.DataFrame([0,1]).rank(axis=0, method='average', numeric_only=False, + ....: na_option='keep', ascending=True, pct=False) + ....: +Out[72]: + 0 +0 1.0 +1 2.0 + +[2 rows x 1 columns] +``` + +### Bug in QuarterBegin with n=0[#](#bug-in-quarterbegin-with-n-0 "Link to this heading") + +In previous versions, the behavior of the QuarterBegin offset was inconsistent +depending on the date when the `n` parameter was 0. ([GH 11406](https://github.com/pandas-dev/pandas/issues/11406)) + +The general semantics of anchored offsets for `n=0` is to not move the date +when it is an anchor point (e.g., a quarter start date), and otherwise roll +forward to the next anchor point. + +```None +In [73]: d = pd.Timestamp('2014-02-01') + +In [74]: d +Out[74]: Timestamp('2014-02-01 00:00:00') + +In [75]: d + pd.offsets.QuarterBegin(n=0, startingMonth=2) +Out[75]: Timestamp('2014-02-01 00:00:00') + +In [76]: d + pd.offsets.QuarterBegin(n=0, startingMonth=1) +Out[76]: Timestamp('2014-04-01 00:00:00') +``` + +For the `QuarterBegin` offset in previous versions, the date would be rolled +*backwards* if date was in the same month as the quarter start date. + +```None +In [3]: d = pd.Timestamp('2014-02-15') + +In [4]: d + pd.offsets.QuarterBegin(n=0, startingMonth=2) +Out[4]: Timestamp('2014-02-01 00:00:00') +``` + +This behavior has been corrected in version 0.18.0, which is consistent with +other anchored offsets like `MonthBegin` and `YearBegin`. + +```None +In [77]: d = pd.Timestamp('2014-02-15') + +In [78]: d + pd.offsets.QuarterBegin(n=0, startingMonth=2) +Out[78]: Timestamp('2014-05-01 00:00:00') +``` + +### Resample API[#](#resample-api "Link to this heading") + +Like the change in the window functions API [above](#whatsnew-0180-enhancements-moments), `.resample(...)` is changing to have a more groupby-like API. ([GH 11732](https://github.com/pandas-dev/pandas/issues/11732), [GH 12702](https://github.com/pandas-dev/pandas/issues/12702), [GH 12202](https://github.com/pandas-dev/pandas/issues/12202), [GH 12332](https://github.com/pandas-dev/pandas/issues/12332), [GH 12334](https://github.com/pandas-dev/pandas/issues/12334), [GH 12348](https://github.com/pandas-dev/pandas/issues/12348), [GH 12448](https://github.com/pandas-dev/pandas/issues/12448)). + +```None +In [79]: np.random.seed(1234) + +In [80]: df = pd.DataFrame(np.random.rand(10,4), + ....: columns=list('ABCD'), + ....: index=pd.date_range('2010-01-01 09:00:00', + ....: periods=10, freq='s')) + ....: + +In [81]: df +Out[81]: + A B C D +2010-01-01 09:00:00 0.191519 0.622109 0.437728 0.785359 +2010-01-01 09:00:01 0.779976 0.272593 0.276464 0.801872 +2010-01-01 09:00:02 0.958139 0.875933 0.357817 0.500995 +2010-01-01 09:00:03 0.683463 0.712702 0.370251 0.561196 +2010-01-01 09:00:04 0.503083 0.013768 0.772827 0.882641 +2010-01-01 09:00:05 0.364886 0.615396 0.075381 0.368824 +2010-01-01 09:00:06 0.933140 0.651378 0.397203 0.788730 +2010-01-01 09:00:07 0.316836 0.568099 0.869127 0.436173 +2010-01-01 09:00:08 0.802148 0.143767 0.704261 0.704581 +2010-01-01 09:00:09 0.218792 0.924868 0.442141 0.909316 + +[10 rows x 4 columns] +``` + +**Previous API**: + +You would write a resampling operation that immediately evaluates. If a `how` parameter was not provided, it +would default to `how='mean'`. + +```None +In [6]: df.resample('2s') +Out[6]: + A B C D +2010-01-01 09:00:00 0.485748 0.447351 0.357096 0.793615 +2010-01-01 09:00:02 0.820801 0.794317 0.364034 0.531096 +2010-01-01 09:00:04 0.433985 0.314582 0.424104 0.625733 +2010-01-01 09:00:06 0.624988 0.609738 0.633165 0.612452 +2010-01-01 09:00:08 0.510470 0.534317 0.573201 0.806949 +``` + +You could also specify a `how` directly + +```None +In [7]: df.resample('2s', how='sum') +Out[7]: + A B C D +2010-01-01 09:00:00 0.971495 0.894701 0.714192 1.587231 +2010-01-01 09:00:02 1.641602 1.588635 0.728068 1.062191 +2010-01-01 09:00:04 0.867969 0.629165 0.848208 1.251465 +2010-01-01 09:00:06 1.249976 1.219477 1.266330 1.224904 +2010-01-01 09:00:08 1.020940 1.068634 1.146402 1.613897 +``` + +**New API**: + +Now, you can write `.resample(..)` as a 2-stage operation like `.groupby(...)`, which +yields a `Resampler`. + +```None +In [82]: r = df.resample('2s') + +In [83]: r +Out[83]: +``` + +#### Downsampling[#](#downsampling "Link to this heading") + +You can then use this object to perform operations. +These are downsampling operations (going from a higher frequency to a lower one). + +```None +In [84]: r.mean() +Out[84]: + A B C D +2010-01-01 09:00:00 0.485748 0.447351 0.357096 0.793615 +2010-01-01 09:00:02 0.820801 0.794317 0.364034 0.531096 +2010-01-01 09:00:04 0.433985 0.314582 0.424104 0.625733 +2010-01-01 09:00:06 0.624988 0.609738 0.633165 0.612452 +2010-01-01 09:00:08 0.510470 0.534317 0.573201 0.806949 + +[5 rows x 4 columns] +``` + +```None +In [85]: r.sum() +Out[85]: + A B C D +2010-01-01 09:00:00 0.971495 0.894701 0.714192 1.587231 +2010-01-01 09:00:02 1.641602 1.588635 0.728068 1.062191 +2010-01-01 09:00:04 0.867969 0.629165 0.848208 1.251465 +2010-01-01 09:00:06 1.249976 1.219477 1.266330 1.224904 +2010-01-01 09:00:08 1.020940 1.068634 1.146402 1.613897 + +[5 rows x 4 columns] +``` + +Furthermore, resample now supports `getitem` operations to perform the resample on specific columns. + +```None +In [86]: r[['A','C']].mean() +Out[86]: + A C +2010-01-01 09:00:00 0.485748 0.357096 +2010-01-01 09:00:02 0.820801 0.364034 +2010-01-01 09:00:04 0.433985 0.424104 +2010-01-01 09:00:06 0.624988 0.633165 +2010-01-01 09:00:08 0.510470 0.573201 + +[5 rows x 2 columns] +``` + +and `.aggregate` type operations. + +```None +In [87]: r.agg({'A' : 'mean', 'B' : 'sum'}) +Out[87]: + A B +2010-01-01 09:00:00 0.485748 0.894701 +2010-01-01 09:00:02 0.820801 1.588635 +2010-01-01 09:00:04 0.433985 0.629165 +2010-01-01 09:00:06 0.624988 1.219477 +2010-01-01 09:00:08 0.510470 1.068634 + +[5 rows x 2 columns] +``` + +These accessors can of course, be combined + +```None +In [88]: r[['A','B']].agg(['mean','sum']) +Out[88]: + A B + mean sum mean sum +2010-01-01 09:00:00 0.485748 0.971495 0.447351 0.894701 +2010-01-01 09:00:02 0.820801 1.641602 0.794317 1.588635 +2010-01-01 09:00:04 0.433985 0.867969 0.314582 0.629165 +2010-01-01 09:00:06 0.624988 1.249976 0.609738 1.219477 +2010-01-01 09:00:08 0.510470 1.020940 0.534317 1.068634 + +[5 rows x 4 columns] +``` + +#### Upsampling[#](#upsampling "Link to this heading") + +Upsampling operations take you from a lower frequency to a higher frequency. These are now +performed with the `Resampler` objects with `backfill()`, +`ffill()`, `fillna()` and `asfreq()` methods. + +```None +In [89]: s = pd.Series(np.arange(5, dtype='int64'), + index=pd.date_range('2010-01-01', periods=5, freq='Q')) + +In [90]: s +Out[90]: +2010-03-31 0 +2010-06-30 1 +2010-09-30 2 +2010-12-31 3 +2011-03-31 4 +Freq: Q-DEC, Length: 5, dtype: int64 +``` + +Previously + +```None +In [6]: s.resample('M', fill_method='ffill') +Out[6]: +2010-03-31 0 +2010-04-30 0 +2010-05-31 0 +2010-06-30 1 +2010-07-31 1 +2010-08-31 1 +2010-09-30 2 +2010-10-31 2 +2010-11-30 2 +2010-12-31 3 +2011-01-31 3 +2011-02-28 3 +2011-03-31 4 +Freq: M, dtype: int64 +``` + +New API + +```None +In [91]: s.resample('M').ffill() +Out[91]: +2010-03-31 0 +2010-04-30 0 +2010-05-31 0 +2010-06-30 1 +2010-07-31 1 +2010-08-31 1 +2010-09-30 2 +2010-10-31 2 +2010-11-30 2 +2010-12-31 3 +2011-01-31 3 +2011-02-28 3 +2011-03-31 4 +Freq: M, Length: 13, dtype: int64 +``` + +Note + +In the new API, you can either downsample OR upsample. The prior implementation would allow you to pass an aggregator function (like `mean`) even though you were upsampling, providing a bit of confusion. + +#### Previous API will work but with deprecations[#](#previous-api-will-work-but-with-deprecations "Link to this heading") + +Warning + +This new API for resample includes some internal changes for the prior-to-0.18.0 API, to work with a deprecation warning in most cases, as the resample operation returns a deferred object. We can intercept operations and just do what the (pre 0.18.0) API did (with a warning). Here is a typical use case: + +```None +In [4]: r = df.resample('2s') + +In [6]: r*10 +pandas/tseries/resample.py:80: FutureWarning: .resample() is now a deferred operation +use .resample(...).mean() instead of .resample(...) + +Out[6]: + A B C D +2010-01-01 09:00:00 4.857476 4.473507 3.570960 7.936154 +2010-01-01 09:00:02 8.208011 7.943173 3.640340 5.310957 +2010-01-01 09:00:04 4.339846 3.145823 4.241039 6.257326 +2010-01-01 09:00:06 6.249881 6.097384 6.331650 6.124518 +2010-01-01 09:00:08 5.104699 5.343172 5.732009 8.069486 +``` + +However, getting and assignment operations directly on a `Resampler` will raise a `ValueError`: + +```None +In [7]: r.iloc[0] = 5 +ValueError: .resample() is now a deferred operation +use .resample(...).mean() instead of .resample(...) +``` + +There is a situation where the new API can not perform all the operations when using original code. +This code is intending to resample every 2s, take the `mean` AND then take the `min` of those results. + +```None +In [4]: df.resample('2s').min() +Out[4]: +A 0.433985 +B 0.314582 +C 0.357096 +D 0.531096 +dtype: float64 +``` + +The new API will: + +```None +In [89]: df.resample('2s').min() +Out[89]: + A B C D +2010-01-01 09:00:00 0.191519 0.272593 0.276464 0.785359 +2010-01-01 09:00:02 0.683463 0.712702 0.357817 0.500995 +2010-01-01 09:00:04 0.364886 0.013768 0.075381 0.368824 +2010-01-01 09:00:06 0.316836 0.568099 0.397203 0.436173 +2010-01-01 09:00:08 0.218792 0.143767 0.442141 0.704581 + +[5 rows x 4 columns] +``` + +The good news is the return dimensions will differ between the new API and the old API, so this should loudly raise +an exception. + +To replicate the original operation + +```None +In [90]: df.resample('2s').mean().min() +Out[90]: +A 0.433985 +B 0.314582 +C 0.357096 +D 0.531096 +Length: 4, dtype: float64 +``` + +### Changes to eval[#](#changes-to-eval "Link to this heading") + +In prior versions, new columns assignments in an `eval` expression resulted +in an inplace change to the `DataFrame`. ([GH 9297](https://github.com/pandas-dev/pandas/issues/9297), [GH 8664](https://github.com/pandas-dev/pandas/issues/8664), [GH 10486](https://github.com/pandas-dev/pandas/issues/10486)) + +```None +In [91]: df = pd.DataFrame({'a': np.linspace(0, 10, 5), 'b': range(5)}) + +In [92]: df +Out[92]: + a b +0 0.0 0 +1 2.5 1 +2 5.0 2 +3 7.5 3 +4 10.0 4 + +[5 rows x 2 columns] +``` + +```None +In [12]: df.eval('c = a + b') +FutureWarning: eval expressions containing an assignment currentlydefault to operating inplace. +This will change in a future version of pandas, use inplace=True to avoid this warning. + +In [13]: df +Out[13]: + a b c +0 0.0 0 0.0 +1 2.5 1 3.5 +2 5.0 2 7.0 +3 7.5 3 10.5 +4 10.0 4 14.0 +``` + +In version 0.18.0, a new `inplace` keyword was added to choose whether the +assignment should be done inplace or return a copy. + +```None +In [93]: df +Out[93]: + a b c +0 0.0 0 0.0 +1 2.5 1 3.5 +2 5.0 2 7.0 +3 7.5 3 10.5 +4 10.0 4 14.0 + +[5 rows x 3 columns] + +In [94]: df.eval('d = c - b', inplace=False) +Out[94]: + a b c d +0 0.0 0 0.0 0.0 +1 2.5 1 3.5 2.5 +2 5.0 2 7.0 5.0 +3 7.5 3 10.5 7.5 +4 10.0 4 14.0 10.0 + +[5 rows x 4 columns] + +In [95]: df +Out[95]: + a b c +0 0.0 0 0.0 +1 2.5 1 3.5 +2 5.0 2 7.0 +3 7.5 3 10.5 +4 10.0 4 14.0 + +[5 rows x 3 columns] + +In [96]: df.eval('d = c - b', inplace=True) + +In [97]: df +Out[97]: + a b c d +0 0.0 0 0.0 0.0 +1 2.5 1 3.5 2.5 +2 5.0 2 7.0 5.0 +3 7.5 3 10.5 7.5 +4 10.0 4 14.0 10.0 + +[5 rows x 4 columns] +``` + +Warning + +For backwards compatibility, `inplace` defaults to `True` if not specified. +This will change in a future version of pandas. If your code depends on an +inplace assignment you should update to explicitly set `inplace=True` + +The `inplace` keyword parameter was also added the `query` method. + +```None +In [98]: df.query('a > 5') +Out[98]: + a b c d +3 7.5 3 10.5 7.5 +4 10.0 4 14.0 10.0 + +[2 rows x 4 columns] + +In [99]: df.query('a > 5', inplace=True) + +In [100]: df +Out[100]: + a b c d +3 7.5 3 10.5 7.5 +4 10.0 4 14.0 10.0 + +[2 rows x 4 columns] +``` + +Warning + +Note that the default value for `inplace` in a `query` +is `False`, which is consistent with prior versions. + +`eval` has also been updated to allow multi-line expressions for multiple +assignments. These expressions will be evaluated one at a time in order. Only +assignments are valid for multi-line expressions. + +```None +In [101]: df +Out[101]: + a b c d +3 7.5 3 10.5 7.5 +4 10.0 4 14.0 10.0 + +[2 rows x 4 columns] + +In [102]: df.eval(""" + .....: e = d + a + .....: f = e - 22 + .....: g = f / 2.0""", inplace=True) + .....: + +In [103]: df +Out[103]: + a b c d e f g +3 7.5 3 10.5 7.5 15.0 -7.0 -3.5 +4 10.0 4 14.0 10.0 20.0 -2.0 -1.0 + +[2 rows x 7 columns] +``` + +### Other API changes[#](#other-api-changes "Link to this heading") + +* `DataFrame.between_time` and `Series.between_time` now only parse a fixed set of time strings. Parsing of date strings is no longer supported and raises a `ValueError`. ([GH 11818](https://github.com/pandas-dev/pandas/issues/11818)) + + ```None + In [107]: s = pd.Series(range(10), pd.date_range('2015-01-01', freq='H', periods=10)) + + In [108]: s.between_time("7:00am", "9:00am") + Out[108]: + 2015-01-01 07:00:00 7 + 2015-01-01 08:00:00 8 + 2015-01-01 09:00:00 9 + Freq: H, Length: 3, dtype: int64 + ``` + + This will now raise. + + ```None + In [2]: s.between_time('20150101 07:00:00','20150101 09:00:00') + ValueError: Cannot convert arg ['20150101 07:00:00'] to a time. + ``` +* `.memory_usage()` now includes values in the index, as does memory\_usage in `.info()` ([GH 11597](https://github.com/pandas-dev/pandas/issues/11597)) +* `DataFrame.to_latex()` now supports non-ascii encodings (eg `utf-8`) in Python 2 with the parameter `encoding` ([GH 7061](https://github.com/pandas-dev/pandas/issues/7061)) +* `pandas.merge()` and `DataFrame.merge()` will show a specific error message when trying to merge with an object that is not of type `DataFrame` or a subclass ([GH 12081](https://github.com/pandas-dev/pandas/issues/12081)) +* `DataFrame.unstack` and `Series.unstack` now take `fill_value` keyword to allow direct replacement of missing values when an unstack results in missing values in the resulting `DataFrame`. As an added benefit, specifying `fill_value` will preserve the data type of the original stacked data. ([GH 9746](https://github.com/pandas-dev/pandas/issues/9746)) +* As part of the new API for [window functions](#whatsnew-0180-enhancements-moments) and [resampling](#whatsnew-0180-breaking-resample), aggregation functions have been clarified, raising more informative error messages on invalid aggregations. ([GH 9052](https://github.com/pandas-dev/pandas/issues/9052)). A full set of examples are presented in [groupby](../user_guide/groupby.html#groupby-aggregate). +* Statistical functions for `NDFrame` objects (like `sum(), mean(), min()`) will now raise if non-numpy-compatible arguments are passed in for `**kwargs` ([GH 12301](https://github.com/pandas-dev/pandas/issues/12301)) +* `.to_latex` and `.to_html` gain a `decimal` parameter like `.to_csv`; the default is `'.'` ([GH 12031](https://github.com/pandas-dev/pandas/issues/12031)) +* More helpful error message when constructing a `DataFrame` with empty data but with indices ([GH 8020](https://github.com/pandas-dev/pandas/issues/8020)) +* `.describe()` will now properly handle bool dtype as a categorical ([GH 6625](https://github.com/pandas-dev/pandas/issues/6625)) +* More helpful error message with an invalid `.transform` with user defined input ([GH 10165](https://github.com/pandas-dev/pandas/issues/10165)) +* Exponentially weighted functions now allow specifying alpha directly ([GH 10789](https://github.com/pandas-dev/pandas/issues/10789)) and raise `ValueError` if parameters violate `0 < alpha <= 1` ([GH 12492](https://github.com/pandas-dev/pandas/issues/12492)) + +### Deprecations[#](#deprecations "Link to this heading") + +* The functions `pd.rolling_*`, `pd.expanding_*`, and `pd.ewm*` are deprecated and replaced by the corresponding method call. Note that + the new suggested syntax includes all of the arguments (even if default) ([GH 11603](https://github.com/pandas-dev/pandas/issues/11603)) + + ```None + In [1]: s = pd.Series(range(3)) + + In [2]: pd.rolling_mean(s,window=2,min_periods=1) + FutureWarning: pd.rolling_mean is deprecated for Series and + will be removed in a future version, replace with + Series.rolling(min_periods=1,window=2,center=False).mean() + Out[2]: + 0 0.0 + 1 0.5 + 2 1.5 + dtype: float64 + + In [3]: pd.rolling_cov(s, s, window=2) + FutureWarning: pd.rolling_cov is deprecated for Series and + will be removed in a future version, replace with + Series.rolling(window=2).cov(other=) + Out[3]: + 0 NaN + 1 0.5 + 2 0.5 + dtype: float64 + ``` +* The `freq` and `how` arguments to the `.rolling`, `.expanding`, and `.ewm` (new) functions are deprecated, and will be removed in a future version. You can simply resample the input prior to creating a window function. ([GH 11603](https://github.com/pandas-dev/pandas/issues/11603)). + + For example, instead of `s.rolling(window=5,freq='D').max()` to get the max value on a rolling 5 Day window, one could use `s.resample('D').mean().rolling(window=5).max()`, which first resamples the data to daily data, then provides a rolling 5 day window. +* `pd.tseries.frequencies.get_offset_name` function is deprecated. Use offset’s `.freqstr` property as alternative ([GH 11192](https://github.com/pandas-dev/pandas/issues/11192)) +* `pandas.stats.fama_macbeth` routines are deprecated and will be removed in a future version ([GH 6077](https://github.com/pandas-dev/pandas/issues/6077)) +* `pandas.stats.ols`, `pandas.stats.plm` and `pandas.stats.var` routines are deprecated and will be removed in a future version ([GH 6077](https://github.com/pandas-dev/pandas/issues/6077)) +* show a `FutureWarning` rather than a `DeprecationWarning` on using long-time deprecated syntax in `HDFStore.select`, where the `where` clause is not a string-like ([GH 12027](https://github.com/pandas-dev/pandas/issues/12027)) +* The `pandas.options.display.mpl_style` configuration has been deprecated + and will be removed in a future version of pandas. This functionality + is better handled by matplotlib’s [style sheets](http://matplotlib.org/users/style_sheets.html) ([GH 11783](https://github.com/pandas-dev/pandas/issues/11783)). + +### Removal of deprecated float indexers[#](#removal-of-deprecated-float-indexers "Link to this heading") + +In [GH 4892](https://github.com/pandas-dev/pandas/issues/4892) indexing with floating point numbers on a non-`Float64Index` was deprecated (in version 0.14.0). +In 0.18.0, this deprecation warning is removed and these will now raise a `TypeError`. ([GH 12165](https://github.com/pandas-dev/pandas/issues/12165), [GH 12333](https://github.com/pandas-dev/pandas/issues/12333)) + +```None +In [104]: s = pd.Series([1, 2, 3], index=[4, 5, 6]) + +In [105]: s +Out[105]: +4 1 +5 2 +6 3 +Length: 3, dtype: int64 + +In [106]: s2 = pd.Series([1, 2, 3], index=list('abc')) + +In [107]: s2 +Out[107]: +a 1 +b 2 +c 3 +Length: 3, dtype: int64 +``` + +Previous behavior: + +```None +# this is label indexing +In [2]: s[5.0] +FutureWarning: scalar indexers for index type Int64Index should be integers and not floating point +Out[2]: 2 + +# this is positional indexing +In [3]: s.iloc[1.0] +FutureWarning: scalar indexers for index type Int64Index should be integers and not floating point +Out[3]: 2 + +# this is label indexing +In [4]: s.loc[5.0] +FutureWarning: scalar indexers for index type Int64Index should be integers and not floating point +Out[4]: 2 + +# .ix would coerce 1.0 to the positional 1, and index +In [5]: s2.ix[1.0] = 10 +FutureWarning: scalar indexers for index type Index should be integers and not floating point + +In [6]: s2 +Out[6]: +a 1 +b 10 +c 3 +dtype: int64 +``` + +New behavior: + +For iloc, getting & setting via a float scalar will always raise. + +```None +In [3]: s.iloc[2.0] +TypeError: cannot do label indexing on with these indexers [2.0] of +``` + +Other indexers will coerce to a like integer for both getting and setting. The `FutureWarning` has been dropped for `.loc`, `.ix` and `[]`. + +```None +In [108]: s[5.0] +Out[108]: 2 + +In [109]: s.loc[5.0] +Out[109]: 2 +``` + +and setting + +```None +In [110]: s_copy = s.copy() + +In [111]: s_copy[5.0] = 10 + +In [112]: s_copy +Out[112]: +4 1 +5 10 +6 3 +Length: 3, dtype: int64 + +In [113]: s_copy = s.copy() + +In [114]: s_copy.loc[5.0] = 10 + +In [115]: s_copy +Out[115]: +4 1 +5 10 +6 3 +Length: 3, dtype: int64 +``` + +Positional setting with `.ix` and a float indexer will ADD this value to the index, rather than previously setting the value by position. + +```None +In [3]: s2.ix[1.0] = 10 +In [4]: s2 +Out[4]: +a 1 +b 2 +c 3 +1.0 10 +dtype: int64 +``` + +Slicing will also coerce integer-like floats to integers for a non-`Float64Index`. + +```None +In [116]: s.loc[5.0:6] +Out[116]: +5 2 +6 3 +Length: 2, dtype: int64 +``` + +Note that for floats that are NOT coercible to ints, the label based bounds will be excluded + +```None +In [117]: s.loc[5.1:6] +Out[117]: +6 3 +Length: 1, dtype: int64 +``` + +Float indexing on a `Float64Index` is unchanged. + +```None +In [118]: s = pd.Series([1, 2, 3], index=np.arange(3.)) + +In [119]: s[1.0] +Out[119]: 2 + +In [120]: s[1.0:2.5] +Out[120]: +1.0 2 +2.0 3 +Length: 2, dtype: int64 +``` + +### Removal of prior version deprecations/changes[#](#removal-of-prior-version-deprecations-changes "Link to this heading") + +* Removal of `rolling_corr_pairwise` in favor of `.rolling().corr(pairwise=True)` ([GH 4950](https://github.com/pandas-dev/pandas/issues/4950)) +* Removal of `expanding_corr_pairwise` in favor of `.expanding().corr(pairwise=True)` ([GH 4950](https://github.com/pandas-dev/pandas/issues/4950)) +* Removal of `DataMatrix` module. This was not imported into the pandas namespace in any event ([GH 12111](https://github.com/pandas-dev/pandas/issues/12111)) +* Removal of `cols` keyword in favor of `subset` in `DataFrame.duplicated()` and `DataFrame.drop_duplicates()` ([GH 6680](https://github.com/pandas-dev/pandas/issues/6680)) +* Removal of the `read_frame` and `frame_query` (both aliases for `pd.read_sql`) + and `write_frame` (alias of `to_sql`) functions in the `pd.io.sql` namespace, + deprecated since 0.14.0 ([GH 6292](https://github.com/pandas-dev/pandas/issues/6292)). +* Removal of the `order` keyword from `.factorize()` ([GH 6930](https://github.com/pandas-dev/pandas/issues/6930)) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Improved performance of `andrews_curves` ([GH 11534](https://github.com/pandas-dev/pandas/issues/11534)) +* Improved huge `DatetimeIndex`, `PeriodIndex` and `TimedeltaIndex`’s ops performance including `NaT` ([GH 10277](https://github.com/pandas-dev/pandas/issues/10277)) +* Improved performance of `pandas.concat` ([GH 11958](https://github.com/pandas-dev/pandas/issues/11958)) +* Improved performance of `StataReader` ([GH 11591](https://github.com/pandas-dev/pandas/issues/11591)) +* Improved performance in construction of `Categoricals` with `Series` of datetimes containing `NaT` ([GH 12077](https://github.com/pandas-dev/pandas/issues/12077)) +* Improved performance of ISO 8601 date parsing for dates without separators ([GH 11899](https://github.com/pandas-dev/pandas/issues/11899)), leading zeros ([GH 11871](https://github.com/pandas-dev/pandas/issues/11871)) and with white space preceding the time zone ([GH 9714](https://github.com/pandas-dev/pandas/issues/9714)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in `GroupBy.size` when data-frame is empty. ([GH 11699](https://github.com/pandas-dev/pandas/issues/11699)) +* Bug in `Period.end_time` when a multiple of time period is requested ([GH 11738](https://github.com/pandas-dev/pandas/issues/11738)) +* Regression in `.clip` with tz-aware datetimes ([GH 11838](https://github.com/pandas-dev/pandas/issues/11838)) +* Bug in `date_range` when the boundaries fell on the frequency ([GH 11804](https://github.com/pandas-dev/pandas/issues/11804), [GH 12409](https://github.com/pandas-dev/pandas/issues/12409)) +* Bug in consistency of passing nested dicts to `.groupby(...).agg(...)` ([GH 9052](https://github.com/pandas-dev/pandas/issues/9052)) +* Accept unicode in `Timedelta` constructor ([GH 11995](https://github.com/pandas-dev/pandas/issues/11995)) +* Bug in value label reading for `StataReader` when reading incrementally ([GH 12014](https://github.com/pandas-dev/pandas/issues/12014)) +* Bug in vectorized `DateOffset` when `n` parameter is `0` ([GH 11370](https://github.com/pandas-dev/pandas/issues/11370)) +* Compat for numpy 1.11 w.r.t. `NaT` comparison changes ([GH 12049](https://github.com/pandas-dev/pandas/issues/12049)) +* Bug in `read_csv` when reading from a `StringIO` in threads ([GH 11790](https://github.com/pandas-dev/pandas/issues/11790)) +* Bug in not treating `NaT` as a missing value in datetimelikes when factorizing & with `Categoricals` ([GH 12077](https://github.com/pandas-dev/pandas/issues/12077)) +* Bug in getitem when the values of a `Series` were tz-aware ([GH 12089](https://github.com/pandas-dev/pandas/issues/12089)) +* Bug in `Series.str.get_dummies` when one of the variables was ‘name’ ([GH 12180](https://github.com/pandas-dev/pandas/issues/12180)) +* Bug in `pd.concat` while concatenating tz-aware NaT series. ([GH 11693](https://github.com/pandas-dev/pandas/issues/11693), [GH 11755](https://github.com/pandas-dev/pandas/issues/11755), [GH 12217](https://github.com/pandas-dev/pandas/issues/12217)) +* Bug in `pd.read_stata` with version <= 108 files ([GH 12232](https://github.com/pandas-dev/pandas/issues/12232)) +* Bug in `Series.resample` using a frequency of `Nano` when the index is a `DatetimeIndex` and contains non-zero nanosecond parts ([GH 12037](https://github.com/pandas-dev/pandas/issues/12037)) +* Bug in resampling with `.nunique` and a sparse index ([GH 12352](https://github.com/pandas-dev/pandas/issues/12352)) +* Removed some compiler warnings ([GH 12471](https://github.com/pandas-dev/pandas/issues/12471)) +* Work around compat issues with `boto` in python 3.5 ([GH 11915](https://github.com/pandas-dev/pandas/issues/11915)) +* Bug in `NaT` subtraction from `Timestamp` or `DatetimeIndex` with timezones ([GH 11718](https://github.com/pandas-dev/pandas/issues/11718)) +* Bug in subtraction of `Series` of a single tz-aware `Timestamp` ([GH 12290](https://github.com/pandas-dev/pandas/issues/12290)) +* Use compat iterators in PY2 to support `.next()` ([GH 12299](https://github.com/pandas-dev/pandas/issues/12299)) +* Bug in `Timedelta.round` with negative values ([GH 11690](https://github.com/pandas-dev/pandas/issues/11690)) +* Bug in `.loc` against `CategoricalIndex` may result in normal `Index` ([GH 11586](https://github.com/pandas-dev/pandas/issues/11586)) +* Bug in `DataFrame.info` when duplicated column names exist ([GH 11761](https://github.com/pandas-dev/pandas/issues/11761)) +* Bug in `.copy` of datetime tz-aware objects ([GH 11794](https://github.com/pandas-dev/pandas/issues/11794)) +* Bug in `Series.apply` and `Series.map` where `timedelta64` was not boxed ([GH 11349](https://github.com/pandas-dev/pandas/issues/11349)) +* Bug in `DataFrame.set_index()` with tz-aware `Series` ([GH 12358](https://github.com/pandas-dev/pandas/issues/12358)) +* Bug in subclasses of `DataFrame` where `AttributeError` did not propagate ([GH 11808](https://github.com/pandas-dev/pandas/issues/11808)) +* Bug groupby on tz-aware data where selection not returning `Timestamp` ([GH 11616](https://github.com/pandas-dev/pandas/issues/11616)) +* Bug in `pd.read_clipboard` and `pd.to_clipboard` functions not supporting Unicode; upgrade included `pyperclip` to v1.5.15 ([GH 9263](https://github.com/pandas-dev/pandas/issues/9263)) +* Bug in `DataFrame.query` containing an assignment ([GH 8664](https://github.com/pandas-dev/pandas/issues/8664)) +* Bug in `from_msgpack` where `__contains__()` fails for columns of the unpacked `DataFrame`, if the `DataFrame` has object columns. ([GH 11880](https://github.com/pandas-dev/pandas/issues/11880)) +* Bug in `.resample` on categorical data with `TimedeltaIndex` ([GH 12169](https://github.com/pandas-dev/pandas/issues/12169)) +* Bug in timezone info lost when broadcasting scalar datetime to `DataFrame` ([GH 11682](https://github.com/pandas-dev/pandas/issues/11682)) +* Bug in `Index` creation from `Timestamp` with mixed tz coerces to UTC ([GH 11488](https://github.com/pandas-dev/pandas/issues/11488)) +* Bug in `to_numeric` where it does not raise if input is more than one dimension ([GH 11776](https://github.com/pandas-dev/pandas/issues/11776)) +* Bug in parsing timezone offset strings with non-zero minutes ([GH 11708](https://github.com/pandas-dev/pandas/issues/11708)) +* Bug in `df.plot` using incorrect colors for bar plots under matplotlib 1.5+ ([GH 11614](https://github.com/pandas-dev/pandas/issues/11614)) +* Bug in the `groupby` `plot` method when using keyword arguments ([GH 11805](https://github.com/pandas-dev/pandas/issues/11805)). +* Bug in `DataFrame.duplicated` and `drop_duplicates` causing spurious matches when setting `keep=False` ([GH 11864](https://github.com/pandas-dev/pandas/issues/11864)) +* Bug in `.loc` result with duplicated key may have `Index` with incorrect dtype ([GH 11497](https://github.com/pandas-dev/pandas/issues/11497)) +* Bug in `pd.rolling_median` where memory allocation failed even with sufficient memory ([GH 11696](https://github.com/pandas-dev/pandas/issues/11696)) +* Bug in `DataFrame.style` with spurious zeros ([GH 12134](https://github.com/pandas-dev/pandas/issues/12134)) +* Bug in `DataFrame.style` with integer columns not starting at 0 ([GH 12125](https://github.com/pandas-dev/pandas/issues/12125)) +* Bug in `.style.bar` may not rendered properly using specific browser ([GH 11678](https://github.com/pandas-dev/pandas/issues/11678)) +* Bug in rich comparison of `Timedelta` with a `numpy.array` of `Timedelta` that caused an infinite recursion ([GH 11835](https://github.com/pandas-dev/pandas/issues/11835)) +* Bug in `DataFrame.round` dropping column index name ([GH 11986](https://github.com/pandas-dev/pandas/issues/11986)) +* Bug in `df.replace` while replacing value in mixed dtype `Dataframe` ([GH 11698](https://github.com/pandas-dev/pandas/issues/11698)) +* Bug in `Index` prevents copying name of passed `Index`, when a new name is not provided ([GH 11193](https://github.com/pandas-dev/pandas/issues/11193)) +* Bug in `read_excel` failing to read any non-empty sheets when empty sheets exist and `sheetname=None` ([GH 11711](https://github.com/pandas-dev/pandas/issues/11711)) +* Bug in `read_excel` failing to raise `NotImplemented` error when keywords `parse_dates` and `date_parser` are provided ([GH 11544](https://github.com/pandas-dev/pandas/issues/11544)) +* Bug in `read_sql` with `pymysql` connections failing to return chunked data ([GH 11522](https://github.com/pandas-dev/pandas/issues/11522)) +* Bug in `.to_csv` ignoring formatting parameters `decimal`, `na_rep`, `float_format` for float indexes ([GH 11553](https://github.com/pandas-dev/pandas/issues/11553)) +* Bug in `Int64Index` and `Float64Index` preventing the use of the modulo operator ([GH 9244](https://github.com/pandas-dev/pandas/issues/9244)) +* Bug in `MultiIndex.drop` for not lexsorted MultiIndexes ([GH 12078](https://github.com/pandas-dev/pandas/issues/12078)) +* Bug in `DataFrame` when masking an empty `DataFrame` ([GH 11859](https://github.com/pandas-dev/pandas/issues/11859)) +* Bug in `.plot` potentially modifying the `colors` input when the number of columns didn’t match the number of series provided ([GH 12039](https://github.com/pandas-dev/pandas/issues/12039)). +* Bug in `Series.plot` failing when index has a `CustomBusinessDay` frequency ([GH 7222](https://github.com/pandas-dev/pandas/issues/7222)). +* Bug in `.to_sql` for `datetime.time` values with sqlite fallback ([GH 8341](https://github.com/pandas-dev/pandas/issues/8341)) +* Bug in `read_excel` failing to read data with one column when `squeeze=True` ([GH 12157](https://github.com/pandas-dev/pandas/issues/12157)) +* Bug in `read_excel` failing to read one empty column ([GH 12292](https://github.com/pandas-dev/pandas/issues/12292), [GH 9002](https://github.com/pandas-dev/pandas/issues/9002)) +* Bug in `.groupby` where a `KeyError` was not raised for a wrong column if there was only one row in the dataframe ([GH 11741](https://github.com/pandas-dev/pandas/issues/11741)) +* Bug in `.read_csv` with dtype specified on empty data producing an error ([GH 12048](https://github.com/pandas-dev/pandas/issues/12048)) +* Bug in `.read_csv` where strings like `'2E'` are treated as valid floats ([GH 12237](https://github.com/pandas-dev/pandas/issues/12237)) +* Bug in building *pandas* with debugging symbols ([GH 12123](https://github.com/pandas-dev/pandas/issues/12123)) +* Removed `millisecond` property of `DatetimeIndex`. This would always raise a `ValueError` ([GH 12019](https://github.com/pandas-dev/pandas/issues/12019)). +* Bug in `Series` constructor with read-only data ([GH 11502](https://github.com/pandas-dev/pandas/issues/11502)) +* Removed `pandas._testing.choice()`. Should use `np.random.choice()`, instead. ([GH 12386](https://github.com/pandas-dev/pandas/issues/12386)) +* Bug in `.loc` setitem indexer preventing the use of a TZ-aware DatetimeIndex ([GH 12050](https://github.com/pandas-dev/pandas/issues/12050)) +* Bug in `.style` indexes and MultiIndexes not appearing ([GH 11655](https://github.com/pandas-dev/pandas/issues/11655)) +* Bug in `to_msgpack` and `from_msgpack` which did not correctly serialize or deserialize `NaT` ([GH 12307](https://github.com/pandas-dev/pandas/issues/12307)). +* Bug in `.skew` and `.kurt` due to roundoff error for highly similar values ([GH 11974](https://github.com/pandas-dev/pandas/issues/11974)) +* Bug in `Timestamp` constructor where microsecond resolution was lost if HHMMSS were not separated with ‘:’ ([GH 10041](https://github.com/pandas-dev/pandas/issues/10041)) +* Bug in `buffer_rd_bytes` src->buffer could be freed more than once if reading failed, causing a segfault ([GH 12098](https://github.com/pandas-dev/pandas/issues/12098)) +* Bug in `crosstab` where arguments with non-overlapping indexes would return a `KeyError` ([GH 10291](https://github.com/pandas-dev/pandas/issues/10291)) +* Bug in `DataFrame.apply` in which reduction was not being prevented for cases in which `dtype` was not a numpy dtype ([GH 12244](https://github.com/pandas-dev/pandas/issues/12244)) +* Bug when initializing categorical series with a scalar value. ([GH 12336](https://github.com/pandas-dev/pandas/issues/12336)) +* Bug when specifying a UTC `DatetimeIndex` by setting `utc=True` in `.to_datetime` ([GH 11934](https://github.com/pandas-dev/pandas/issues/11934)) +* Bug when increasing the buffer size of CSV reader in `read_csv` ([GH 12494](https://github.com/pandas-dev/pandas/issues/12494)) +* Bug when setting columns of a `DataFrame` with duplicate column names ([GH 12344](https://github.com/pandas-dev/pandas/issues/12344)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 101 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* ARF + +* Alex Alekseyev + +* Andrew McPherson + +* Andrew Rosenfeld +* Andy Hayden +* Anthonios Partheniou +* Anton I. Sipos +* Ben + +* Ben North + +* Bran Yang + +* Chris +* Chris Carroux + +* Christopher C. Aycock + +* Christopher Scanlin + +* Cody + +* Da Wang + +* Daniel Grady + +* Dorozhko Anton + +* Dr-Irv + +* Erik M. Bray + +* Evan Wright +* Francis T. O’Donovan + +* Frank Cleary + +* Gianluca Rossi +* Graham Jeffries + +* Guillaume Horel +* Henry Hammond + +* Isaac Schwabacher + +* Jean-Mathieu Deschenes +* Jeff Reback +* Joe Jevnik + +* John Freeman + +* John Fremlin + +* Jonas Hoersch + +* Joris Van den Bossche +* Joris Vankerschaver +* Justin Lecher +* Justin Lin + +* Ka Wo Chen +* Keming Zhang + +* Kerby Shedden +* Kyle + +* Marco Farrugia + +* MasonGallo + +* MattRijk + +* Matthew Lurie + +* Maximilian Roos +* Mayank Asthana + +* Mortada Mehyar +* Moussa Taifi + +* Navreet Gill + +* Nicolas Bonnotte +* Paul Reiners + +* Philip Gura + +* Pietro Battiston +* RahulHP + +* Randy Carnevale +* Rinoc Johnson +* Rishipuri + +* Sangmin Park + +* Scott E Lasley +* Sereger13 + +* Shannon Wang + +* Skipper Seabold +* Thierry Moisan +* Thomas A Caswell +* Toby Dylan Hocking + +* Tom Augspurger +* Travis + +* Trent Hauck +* Tux1 +* Varun +* Wes McKinney +* Will Thompson + +* Yoav Ram +* Yoong Kang Lim + +* Yoshiki Vázquez Baeza +* Young Joong Kim + +* Younggun Kim +* Yuval Langer + +* alex argunov + +* behzad nouri +* boombard + +* brian-pantano + +* chromy + +* daniel + +* dgram0 + +* gfyoung + +* hack-c + +* hcontrast + +* jfoo + +* kaustuv deolal + +* llllllllll +* ranarag + +* rockg +* scls19fr +* seales + +* sinhrks +* srib + +* surveymedia.ca + +* tworec + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.18.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.18.1.md new file mode 100644 index 0000000000000000000000000000000000000000..05a3e31e56563d91394b2d06ec80369a064b034a --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.18.1.md @@ -0,0 +1,969 @@ +# What's new in pandas 0.18.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.18.1.html + +# Version 0.18.1 (May 3, 2016)[#](#version-0-18-1-may-3-2016 "Link to this heading") + +This is a minor bug-fix release from 0.18.0 and includes a large number of +bug fixes along with several new features, enhancements, and performance improvements. +We recommend that all users upgrade to this version. + +Highlights include: + +* `.groupby(...)` has been enhanced to provide convenient syntax when working with `.rolling(..)`, `.expanding(..)` and `.resample(..)` per group, see [here](#whatsnew-0181-deferred-ops) +* `pd.to_datetime()` has gained the ability to assemble dates from a `DataFrame`, see [here](#whatsnew-0181-enhancements-assembling) +* Method chaining improvements, see [here](#whatsnew-0181-enhancements-method-chain). +* Custom business hour offset, see [here](#whatsnew-0181-enhancements-custombusinesshour). +* Many bug fixes in the handling of `sparse`, see [here](#whatsnew-0181-sparse) +* Expanded the [Tutorials section](../getting_started/tutorials.html#tutorial-modern) with a feature on modern pandas, courtesy of [@TomAugsburger](https://twitter.com/TomAugspurger). ([GH 13045](https://github.com/pandas-dev/pandas/issues/13045)). + +What’s new in v0.18.1 + +* [New features](#new-features) + + + [Custom business hour](#custom-business-hour) + + [Method `.groupby(..)` syntax with window and resample operations](#method-groupby-syntax-with-window-and-resample-operations) + + [Method chaining improvements](#method-chaining-improvements) + + - [Methods `.where()` and `.mask()`](#methods-where-and-mask) + - [Methods `.loc[]`, `.iloc[]`, `.ix[]`](#methods-loc-iloc-ix) + - [Indexing with `[]`](#indexing-with) + + [Partial string indexing on `DatetimeIndex` when part of a `MultiIndex`](#partial-string-indexing-on-datetimeindex-when-part-of-a-multiindex) + + [Assembling datetimes](#assembling-datetimes) + + [Other enhancements](#other-enhancements) +* [Sparse changes](#sparse-changes) +* [API changes](#api-changes) + + + [Method `.groupby(..).nth()` changes](#method-groupby-nth-changes) + + [NumPy function compatibility](#numpy-function-compatibility) + + [Using `.apply` on GroupBy resampling](#using-apply-on-groupby-resampling) + + [Changes in `read_csv` exceptions](#changes-in-read-csv-exceptions) + + [Method `to_datetime` error changes](#method-to-datetime-error-changes) + + [Other API changes](#other-api-changes) + + [Deprecations](#deprecations) +* [Performance improvements](#performance-improvements) +* [Bug fixes](#bug-fixes) +* [Contributors](#contributors) + +## New features[#](#new-features "Link to this heading") + +### Custom business hour[#](#custom-business-hour "Link to this heading") + +The `CustomBusinessHour` is a mixture of `BusinessHour` and `CustomBusinessDay` which +allows you to specify arbitrary holidays. For details, +see [Custom Business Hour](../user_guide/timeseries.html#timeseries-custombusinesshour) ([GH 11514](https://github.com/pandas-dev/pandas/issues/11514)) + +```None +In [1]: from pandas.tseries.offsets import CustomBusinessHour + +In [2]: from pandas.tseries.holiday import USFederalHolidayCalendar + +In [3]: bhour_us = CustomBusinessHour(calendar=USFederalHolidayCalendar()) +``` + +Friday before MLK Day + +```None +In [4]: import datetime + +In [5]: dt = datetime.datetime(2014, 1, 17, 15) + +In [6]: dt + bhour_us +Out[6]: Timestamp('2014-01-17 16:00:00') +``` + +Tuesday after MLK Day (Monday is skipped because it’s a holiday) + +```None +In [7]: dt + bhour_us * 2 +Out[7]: Timestamp('2014-01-20 09:00:00') +``` + +### Method `.groupby(..)` syntax with window and resample operations[#](#method-groupby-syntax-with-window-and-resample-operations "Link to this heading") + +`.groupby(...)` has been enhanced to provide convenient syntax when working with `.rolling(..)`, `.expanding(..)` and `.resample(..)` per group, see ([GH 12486](https://github.com/pandas-dev/pandas/issues/12486), [GH 12738](https://github.com/pandas-dev/pandas/issues/12738)). + +You can now use `.rolling(..)` and `.expanding(..)` as methods on groupbys. These return another deferred object (similar to what `.rolling()` and `.expanding()` do on ungrouped pandas objects). You can then operate on these `RollingGroupby` objects in a similar manner. + +Previously you would have to do this to get a rolling window mean per-group: + +```None +In [8]: df = pd.DataFrame({"A": [1] * 20 + [2] * 12 + [3] * 8, "B": np.arange(40)}) + +In [9]: df +Out[9]: + A B +0 1 0 +1 1 1 +2 1 2 +3 1 3 +4 1 4 +.. .. .. +35 3 35 +36 3 36 +37 3 37 +38 3 38 +39 3 39 + +[40 rows x 2 columns] +``` + +```None +In [1]: df.groupby("A").apply(lambda x: x.rolling(4).B.mean()) +Out[1]: +A +1 0 NaN + 1 NaN + 2 NaN + 3 1.5 + 4 2.5 + 5 3.5 + 6 4.5 + 7 5.5 + 8 6.5 + 9 7.5 + 10 8.5 + 11 9.5 + 12 10.5 + 13 11.5 + 14 12.5 + 15 13.5 + 16 14.5 + 17 15.5 + 18 16.5 + 19 17.5 +2 20 NaN + 21 NaN + 22 NaN + 23 21.5 + 24 22.5 + 25 23.5 + 26 24.5 + 27 25.5 + 28 26.5 + 29 27.5 + 30 28.5 + 31 29.5 +3 32 NaN + 33 NaN + 34 NaN + 35 33.5 + 36 34.5 + 37 35.5 + 38 36.5 + 39 37.5 +Name: B, dtype: float64 +``` + +Now you can do: + +```None +In [10]: df.groupby("A").rolling(4).B.mean() +Out[10]: +A +1 0 NaN + 1 NaN + 2 NaN + 3 1.5 + 4 2.5 + ... +3 35 33.5 + 36 34.5 + 37 35.5 + 38 36.5 + 39 37.5 +Name: B, Length: 40, dtype: float64 +``` + +For `.resample(..)` type of operations, previously you would have to: + +```None +In [11]: df = pd.DataFrame( + ....: { + ....: "date": pd.date_range(start="2016-01-01", periods=4, freq="W"), + ....: "group": [1, 1, 2, 2], + ....: "val": [5, 6, 7, 8], + ....: } + ....: ).set_index("date") + ....: + +In [12]: df +Out[12]: + group val +date +2016-01-03 1 5 +2016-01-10 1 6 +2016-01-17 2 7 +2016-01-24 2 8 + +[4 rows x 2 columns] +``` + +```None +In[1]: df.groupby("group").apply(lambda x: x.resample("1D").ffill()) +Out[1]: + group val +group date +1 2016-01-03 1 5 + 2016-01-04 1 5 + 2016-01-05 1 5 + 2016-01-06 1 5 + 2016-01-07 1 5 + 2016-01-08 1 5 + 2016-01-09 1 5 + 2016-01-10 1 6 +2 2016-01-17 2 7 + 2016-01-18 2 7 + 2016-01-19 2 7 + 2016-01-20 2 7 + 2016-01-21 2 7 + 2016-01-22 2 7 + 2016-01-23 2 7 + 2016-01-24 2 8 +``` + +Now you can do: + +```None +In[1]: df.groupby("group").resample("1D").ffill() +Out[1]: + group val +group date +1 2016-01-03 1 5 + 2016-01-04 1 5 + 2016-01-05 1 5 + 2016-01-06 1 5 + 2016-01-07 1 5 + 2016-01-08 1 5 + 2016-01-09 1 5 + 2016-01-10 1 6 +2 2016-01-17 2 7 + 2016-01-18 2 7 + 2016-01-19 2 7 + 2016-01-20 2 7 + 2016-01-21 2 7 + 2016-01-22 2 7 + 2016-01-23 2 7 + 2016-01-24 2 8 +``` + +### Method chaining improvements[#](#method-chaining-improvements "Link to this heading") + +The following methods / indexers now accept a `callable`. It is intended to make +these more useful in method chains, see the [documentation](../user_guide/indexing.html#indexing-callable). +([GH 11485](https://github.com/pandas-dev/pandas/issues/11485), [GH 12533](https://github.com/pandas-dev/pandas/issues/12533)) + +* `.where()` and `.mask()` +* `.loc[]`, `iloc[]` and `.ix[]` +* `[]` indexing + +#### Methods `.where()` and `.mask()`[#](#methods-where-and-mask "Link to this heading") + +These can accept a callable for the condition and `other` +arguments. + +```None +In [13]: df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6], "C": [7, 8, 9]}) + +In [14]: df.where(lambda x: x > 4, lambda x: x + 10) +Out[14]: + A B C +0 11 14 7 +1 12 5 8 +2 13 6 9 + +[3 rows x 3 columns] +``` + +#### Methods `.loc[]`, `.iloc[]`, `.ix[]`[#](#methods-loc-iloc-ix "Link to this heading") + +These can accept a callable, and a tuple of callable as a slicer. The callable +can return a valid boolean indexer or anything which is valid for these indexer’s input. + +```None +# callable returns bool indexer +In [15]: df.loc[lambda x: x.A >= 2, lambda x: x.sum() > 10] +Out[15]: + B C +1 5 8 +2 6 9 + +[2 rows x 2 columns] + +# callable returns list of labels +In [16]: df.loc[lambda x: [1, 2], lambda x: ["A", "B"]] +Out[16]: + A B +1 2 5 +2 3 6 + +[2 rows x 2 columns] +``` + +#### Indexing with `[]`[#](#indexing-with "Link to this heading") + +Finally, you can use a callable in `[]` indexing of Series, DataFrame and Panel. +The callable must return a valid input for `[]` indexing depending on its +class and index type. + +```None +In [17]: df[lambda x: "A"] +Out[17]: +0 1 +1 2 +2 3 +Name: A, Length: 3, dtype: int64 +``` + +Using these methods / indexers, you can chain data selection operations +without using temporary variable. + +```None +In [18]: bb = pd.read_csv("data/baseball.csv", index_col="id") + +In [19]: (bb.groupby(["year", "team"]).sum(numeric_only=True).loc[lambda df: df.r > 100]) +Out[19]: + stint g ab r h X2b ... so ibb hbp sh sf gidp +year team ... +2007 CIN 6 379 745 101 203 35 ... 127.0 14.0 1.0 1.0 15.0 18.0 + DET 5 301 1062 162 283 54 ... 176.0 3.0 10.0 4.0 8.0 28.0 + HOU 4 311 926 109 218 47 ... 212.0 3.0 9.0 16.0 6.0 17.0 + LAN 11 413 1021 153 293 61 ... 141.0 8.0 9.0 3.0 8.0 29.0 + NYN 13 622 1854 240 509 101 ... 310.0 24.0 23.0 18.0 15.0 48.0 + SFN 5 482 1305 198 337 67 ... 188.0 51.0 8.0 16.0 6.0 41.0 + TEX 2 198 729 115 200 40 ... 140.0 4.0 5.0 2.0 8.0 16.0 + TOR 4 459 1408 187 378 96 ... 265.0 16.0 12.0 4.0 16.0 38.0 + +[8 rows x 18 columns] +``` + +### Partial string indexing on `DatetimeIndex` when part of a `MultiIndex`[#](#partial-string-indexing-on-datetimeindex-when-part-of-a-multiindex "Link to this heading") + +Partial string indexing now matches on `DateTimeIndex` when part of a `MultiIndex` ([GH 10331](https://github.com/pandas-dev/pandas/issues/10331)) + +```None +In [20]: dft2 = pd.DataFrame( + ....: np.random.randn(20, 1), + ....: columns=["A"], + ....: index=pd.MultiIndex.from_product( + ....: [pd.date_range("20130101", periods=10, freq="12H"), ["a", "b"]] + ....: ), + ....: ) + ....: + +In [21]: dft2 +Out[21]: + A +2013-01-01 00:00:00 a 0.469112 + b -0.282863 +2013-01-01 12:00:00 a -1.509059 + b -1.135632 +2013-01-02 00:00:00 a 1.212112 +... ... +2013-01-04 12:00:00 b 0.271860 +2013-01-05 00:00:00 a -0.424972 + b 0.567020 +2013-01-05 12:00:00 a 0.276232 + b -1.087401 + +[20 rows x 1 columns] + +In [22]: dft2.loc["2013-01-05"] +Out[22]: + A +2013-01-05 00:00:00 a -0.424972 + b 0.567020 +2013-01-05 12:00:00 a 0.276232 + b -1.087401 + +[4 rows x 1 columns] +``` + +On other levels + +```None +In [26]: idx = pd.IndexSlice + +In [27]: dft2 = dft2.swaplevel(0, 1).sort_index() + +In [28]: dft2 +Out[28]: + A +a 2013-01-01 00:00:00 0.469112 + 2013-01-01 12:00:00 -1.509059 + 2013-01-02 00:00:00 1.212112 + 2013-01-02 12:00:00 0.119209 + 2013-01-03 00:00:00 -0.861849 +... ... +b 2013-01-03 12:00:00 1.071804 + 2013-01-04 00:00:00 -0.706771 + 2013-01-04 12:00:00 0.271860 + 2013-01-05 00:00:00 0.567020 + 2013-01-05 12:00:00 -1.087401 + +[20 rows x 1 columns] + +In [29]: dft2.loc[idx[:, "2013-01-05"], :] +Out[29]: + A +a 2013-01-05 00:00:00 -0.424972 + 2013-01-05 12:00:00 0.276232 +b 2013-01-05 00:00:00 0.567020 + 2013-01-05 12:00:00 -1.087401 + +[4 rows x 1 columns] +``` + +### Assembling datetimes[#](#assembling-datetimes "Link to this heading") + +`pd.to_datetime()` has gained the ability to assemble datetimes from a passed in `DataFrame` or a dict. ([GH 8158](https://github.com/pandas-dev/pandas/issues/8158)). + +```None +In [20]: df = pd.DataFrame( + ....: {"year": [2015, 2016], "month": [2, 3], "day": [4, 5], "hour": [2, 3]} + ....: ) + ....: + +In [21]: df +Out[21]: + year month day hour +0 2015 2 4 2 +1 2016 3 5 3 + +[2 rows x 4 columns] +``` + +Assembling using the passed frame. + +```None +In [22]: pd.to_datetime(df) +Out[22]: +0 2015-02-04 02:00:00 +1 2016-03-05 03:00:00 +Length: 2, dtype: datetime64[ns] +``` + +You can pass only the columns that you need to assemble. + +```None +In [23]: pd.to_datetime(df[["year", "month", "day"]]) +Out[23]: +0 2015-02-04 +1 2016-03-05 +Length: 2, dtype: datetime64[ns] +``` + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* `pd.read_csv()` now supports `delim_whitespace=True` for the Python engine ([GH 12958](https://github.com/pandas-dev/pandas/issues/12958)) +* `pd.read_csv()` now supports opening ZIP files that contains a single CSV, via extension inference or explicit `compression='zip'` ([GH 12175](https://github.com/pandas-dev/pandas/issues/12175)) +* `pd.read_csv()` now supports opening files using xz compression, via extension inference or explicit `compression='xz'` is specified; `xz` compressions is also supported by `DataFrame.to_csv` in the same way ([GH 11852](https://github.com/pandas-dev/pandas/issues/11852)) +* `pd.read_msgpack()` now always gives writeable ndarrays even when compression is used ([GH 12359](https://github.com/pandas-dev/pandas/issues/12359)). +* `pd.read_msgpack()` now supports serializing and de-serializing categoricals with msgpack ([GH 12573](https://github.com/pandas-dev/pandas/issues/12573)) +* `.to_json()` now supports `NDFrames` that contain categorical and sparse data ([GH 10778](https://github.com/pandas-dev/pandas/issues/10778)) +* `interpolate()` now supports `method='akima'` ([GH 7588](https://github.com/pandas-dev/pandas/issues/7588)). +* `pd.read_excel()` now accepts path objects (e.g. `pathlib.Path`, `py.path.local`) for the file path, in line with other `read_*` functions ([GH 12655](https://github.com/pandas-dev/pandas/issues/12655)) +* Added `.weekday_name` property as a component to `DatetimeIndex` and the `.dt` accessor. ([GH 11128](https://github.com/pandas-dev/pandas/issues/11128)) +* `Index.take` now handles `allow_fill` and `fill_value` consistently ([GH 12631](https://github.com/pandas-dev/pandas/issues/12631)) + + ```None + In [24]: idx = pd.Index([1.0, 2.0, 3.0, 4.0], dtype="float") + + # default, allow_fill=True, fill_value=None + In [25]: idx.take([2, -1]) + Out[25]: Index([3.0, 4.0], dtype='float64') + + In [26]: idx.take([2, -1], fill_value=True) + Out[26]: Index([3.0, nan], dtype='float64') + ``` +* `Index` now supports `.str.get_dummies()` which returns `MultiIndex`, see [Creating Indicator Variables](../user_guide/text.html#text-indicator) ([GH 10008](https://github.com/pandas-dev/pandas/issues/10008), [GH 10103](https://github.com/pandas-dev/pandas/issues/10103)) + + ```None + In [27]: idx = pd.Index(["a|b", "a|c", "b|c"]) + + In [28]: idx.str.get_dummies("|") + Out[28]: + MultiIndex([(1, 1, 0), + (1, 0, 1), + (0, 1, 1)], + names=['a', 'b', 'c']) + ``` +* `pd.crosstab()` has gained a `normalize` argument for normalizing frequency tables ([GH 12569](https://github.com/pandas-dev/pandas/issues/12569)). Examples in the updated docs [here](../user_guide/reshaping.html#reshaping-crosstabulations). +* `.resample(..).interpolate()` is now supported ([GH 12925](https://github.com/pandas-dev/pandas/issues/12925)) +* `.isin()` now accepts passed `sets` ([GH 12988](https://github.com/pandas-dev/pandas/issues/12988)) + +## Sparse changes[#](#sparse-changes "Link to this heading") + +These changes conform sparse handling to return the correct types and work to make a smoother experience with indexing. + +`SparseArray.take` now returns a scalar for scalar input, `SparseArray` for others. Furthermore, it handles a negative indexer with the same rule as `Index` ([GH 10560](https://github.com/pandas-dev/pandas/issues/10560), [GH 12796](https://github.com/pandas-dev/pandas/issues/12796)) + +```None +s = pd.SparseArray([np.nan, np.nan, 1, 2, 3, np.nan, 4, 5, np.nan, 6]) +s.take(0) +s.take([1, 2, 3]) +``` + +* Bug in `SparseSeries[]` indexing with `Ellipsis` raises `KeyError` ([GH 9467](https://github.com/pandas-dev/pandas/issues/9467)) +* Bug in `SparseArray[]` indexing with tuples are not handled properly ([GH 12966](https://github.com/pandas-dev/pandas/issues/12966)) +* Bug in `SparseSeries.loc[]` with list-like input raises `TypeError` ([GH 10560](https://github.com/pandas-dev/pandas/issues/10560)) +* Bug in `SparseSeries.iloc[]` with scalar input may raise `IndexError` ([GH 10560](https://github.com/pandas-dev/pandas/issues/10560)) +* Bug in `SparseSeries.loc[]`, `.iloc[]` with `slice` returns `SparseArray`, rather than `SparseSeries` ([GH 10560](https://github.com/pandas-dev/pandas/issues/10560)) +* Bug in `SparseDataFrame.loc[]`, `.iloc[]` may results in dense `Series`, rather than `SparseSeries` ([GH 12787](https://github.com/pandas-dev/pandas/issues/12787)) +* Bug in `SparseArray` addition ignores `fill_value` of right hand side ([GH 12910](https://github.com/pandas-dev/pandas/issues/12910)) +* Bug in `SparseArray` mod raises `AttributeError` ([GH 12910](https://github.com/pandas-dev/pandas/issues/12910)) +* Bug in `SparseArray` pow calculates `1 ** np.nan` as `np.nan` which must be 1 ([GH 12910](https://github.com/pandas-dev/pandas/issues/12910)) +* Bug in `SparseArray` comparison output may incorrect result or raise `ValueError` ([GH 12971](https://github.com/pandas-dev/pandas/issues/12971)) +* Bug in `SparseSeries.__repr__` raises `TypeError` when it is longer than `max_rows` ([GH 10560](https://github.com/pandas-dev/pandas/issues/10560)) +* Bug in `SparseSeries.shape` ignores `fill_value` ([GH 10452](https://github.com/pandas-dev/pandas/issues/10452)) +* Bug in `SparseSeries` and `SparseArray` may have different `dtype` from its dense values ([GH 12908](https://github.com/pandas-dev/pandas/issues/12908)) +* Bug in `SparseSeries.reindex` incorrectly handle `fill_value` ([GH 12797](https://github.com/pandas-dev/pandas/issues/12797)) +* Bug in `SparseArray.to_frame()` results in `DataFrame`, rather than `SparseDataFrame` ([GH 9850](https://github.com/pandas-dev/pandas/issues/9850)) +* Bug in `SparseSeries.value_counts()` does not count `fill_value` ([GH 6749](https://github.com/pandas-dev/pandas/issues/6749)) +* Bug in `SparseArray.to_dense()` does not preserve `dtype` ([GH 10648](https://github.com/pandas-dev/pandas/issues/10648)) +* Bug in `SparseArray.to_dense()` incorrectly handle `fill_value` ([GH 12797](https://github.com/pandas-dev/pandas/issues/12797)) +* Bug in `pd.concat()` of `SparseSeries` results in dense ([GH 10536](https://github.com/pandas-dev/pandas/issues/10536)) +* Bug in `pd.concat()` of `SparseDataFrame` incorrectly handle `fill_value` ([GH 9765](https://github.com/pandas-dev/pandas/issues/9765)) +* Bug in `pd.concat()` of `SparseDataFrame` may raise `AttributeError` ([GH 12174](https://github.com/pandas-dev/pandas/issues/12174)) +* Bug in `SparseArray.shift()` may raise `NameError` or `TypeError` ([GH 12908](https://github.com/pandas-dev/pandas/issues/12908)) + +## API changes[#](#api-changes "Link to this heading") + +### Method `.groupby(..).nth()` changes[#](#method-groupby-nth-changes "Link to this heading") + +The index in `.groupby(..).nth()` output is now more consistent when the `as_index` argument is passed ([GH 11039](https://github.com/pandas-dev/pandas/issues/11039)): + +```None +In [29]: df = pd.DataFrame({"A": ["a", "b", "a"], "B": [1, 2, 3]}) + +In [30]: df +Out[30]: + A B +0 a 1 +1 b 2 +2 a 3 + +[3 rows x 2 columns] +``` + +Previous behavior: + +```None +In [3]: df.groupby('A', as_index=True)['B'].nth(0) +Out[3]: +0 1 +1 2 +Name: B, dtype: int64 + +In [4]: df.groupby('A', as_index=False)['B'].nth(0) +Out[4]: +0 1 +1 2 +Name: B, dtype: int64 +``` + +New behavior: + +```None +In [31]: df.groupby("A", as_index=True)["B"].nth(0) +Out[31]: +0 1 +1 2 +Name: B, Length: 2, dtype: int64 + +In [32]: df.groupby("A", as_index=False)["B"].nth(0) +Out[32]: +0 1 +1 2 +Name: B, Length: 2, dtype: int64 +``` + +Furthermore, previously, a `.groupby` would always sort, regardless if `sort=False` was passed with `.nth()`. + +```None +In [33]: np.random.seed(1234) + +In [34]: df = pd.DataFrame(np.random.randn(100, 2), columns=["a", "b"]) + +In [35]: df["c"] = np.random.randint(0, 4, 100) +``` + +Previous behavior: + +```None +In [4]: df.groupby('c', sort=True).nth(1) +Out[4]: + a b +c +0 -0.334077 0.002118 +1 0.036142 -2.074978 +2 -0.720589 0.887163 +3 0.859588 -0.636524 + +In [5]: df.groupby('c', sort=False).nth(1) +Out[5]: + a b +c +0 -0.334077 0.002118 +1 0.036142 -2.074978 +2 -0.720589 0.887163 +3 0.859588 -0.636524 +``` + +New behavior: + +```None +In [36]: df.groupby("c", sort=True).nth(1) +Out[36]: + a b c +2 -0.720589 0.887163 2 +3 0.859588 -0.636524 3 +7 -0.334077 0.002118 0 +21 0.036142 -2.074978 1 + +[4 rows x 3 columns] + +In [37]: df.groupby("c", sort=False).nth(1) +Out[37]: + a b c +2 -0.720589 0.887163 2 +3 0.859588 -0.636524 3 +7 -0.334077 0.002118 0 +21 0.036142 -2.074978 1 + +[4 rows x 3 columns] +``` + +### NumPy function compatibility[#](#numpy-function-compatibility "Link to this heading") + +Compatibility between pandas array-like methods (e.g. `sum` and `take`) and their `numpy` +counterparts has been greatly increased by augmenting the signatures of the `pandas` methods so +as to accept arguments that can be passed in from `numpy`, even if they are not necessarily +used in the `pandas` implementation ([GH 12644](https://github.com/pandas-dev/pandas/issues/12644), [GH 12638](https://github.com/pandas-dev/pandas/issues/12638), [GH 12687](https://github.com/pandas-dev/pandas/issues/12687)) + +* `.searchsorted()` for `Index` and `TimedeltaIndex` now accept a `sorter` argument to maintain compatibility with numpy’s `searchsorted` function ([GH 12238](https://github.com/pandas-dev/pandas/issues/12238)) +* Bug in numpy compatibility of `np.round()` on a `Series` ([GH 12600](https://github.com/pandas-dev/pandas/issues/12600)) + +An example of this signature augmentation is illustrated below: + +```None +sp = pd.SparseDataFrame([1, 2, 3]) +sp +``` + +Previous behaviour: + +```None +In [2]: np.cumsum(sp, axis=0) +... +TypeError: cumsum() takes at most 2 arguments (4 given) +``` + +New behaviour: + +```None +np.cumsum(sp, axis=0) +``` + +### Using `.apply` on GroupBy resampling[#](#using-apply-on-groupby-resampling "Link to this heading") + +Using `apply` on resampling groupby operations (using a `pd.TimeGrouper`) now has the same output types as similar `apply` calls on other groupby operations. ([GH 11742](https://github.com/pandas-dev/pandas/issues/11742)). + +```None +In [38]: df = pd.DataFrame( + ....: {"date": pd.to_datetime(["10/10/2000", "11/10/2000"]), "value": [10, 13]} + ....: ) + ....: + +In [39]: df +Out[39]: + date value +0 2000-10-10 10 +1 2000-11-10 13 + +[2 rows x 2 columns] +``` + +Previous behavior: + +```None +In [1]: df.groupby(pd.TimeGrouper(key='date', + ...: freq='M')).apply(lambda x: x.value.sum()) +Out[1]: +... +TypeError: cannot concatenate a non-NDFrame object + +# Output is a Series +In [2]: df.groupby(pd.TimeGrouper(key='date', + ...: freq='M')).apply(lambda x: x[['value']].sum()) +Out[2]: +date +2000-10-31 value 10 +2000-11-30 value 13 +dtype: int64 +``` + +New behavior: + +```None +# Output is a Series +In [55]: df.groupby(pd.TimeGrouper(key='date', + ...: freq='M')).apply(lambda x: x.value.sum()) +Out[55]: +date +2000-10-31 10 +2000-11-30 13 +Freq: M, dtype: int64 + +# Output is a DataFrame +In [56]: df.groupby(pd.TimeGrouper(key='date', + ...: freq='M')).apply(lambda x: x[['value']].sum()) +Out[56]: + value +date +2000-10-31 10 +2000-11-30 13 +``` + +### Changes in `read_csv` exceptions[#](#changes-in-read-csv-exceptions "Link to this heading") + +In order to standardize the `read_csv` API for both the `c` and `python` engines, both will now raise an +`EmptyDataError`, a subclass of `ValueError`, in response to empty columns or header ([GH 12493](https://github.com/pandas-dev/pandas/issues/12493), [GH 12506](https://github.com/pandas-dev/pandas/issues/12506)) + +Previous behaviour: + +```None +In [1]: import io + +In [2]: df = pd.read_csv(io.StringIO(''), engine='c') +... +ValueError: No columns to parse from file + +In [3]: df = pd.read_csv(io.StringIO(''), engine='python') +... +StopIteration +``` + +New behaviour: + +```None +In [1]: df = pd.read_csv(io.StringIO(''), engine='c') +... +pandas.io.common.EmptyDataError: No columns to parse from file + +In [2]: df = pd.read_csv(io.StringIO(''), engine='python') +... +pandas.io.common.EmptyDataError: No columns to parse from file +``` + +In addition to this error change, several others have been made as well: + +* `CParserError` now sub-classes `ValueError` instead of just a `Exception` ([GH 12551](https://github.com/pandas-dev/pandas/issues/12551)) +* A `CParserError` is now raised instead of a generic `Exception` in `read_csv` when the `c` engine cannot parse a column ([GH 12506](https://github.com/pandas-dev/pandas/issues/12506)) +* A `ValueError` is now raised instead of a generic `Exception` in `read_csv` when the `c` engine encounters a `NaN` value in an integer column ([GH 12506](https://github.com/pandas-dev/pandas/issues/12506)) +* A `ValueError` is now raised instead of a generic `Exception` in `read_csv` when `true_values` is specified, and the `c` engine encounters an element in a column containing unencodable bytes ([GH 12506](https://github.com/pandas-dev/pandas/issues/12506)) +* `pandas.parser.OverflowError` exception has been removed and has been replaced with Python’s built-in `OverflowError` exception ([GH 12506](https://github.com/pandas-dev/pandas/issues/12506)) +* `pd.read_csv()` no longer allows a combination of strings and integers for the `usecols` parameter ([GH 12678](https://github.com/pandas-dev/pandas/issues/12678)) + +### Method `to_datetime` error changes[#](#method-to-datetime-error-changes "Link to this heading") + +Bugs in `pd.to_datetime()` when passing a `unit` with convertible entries and `errors='coerce'` or non-convertible with `errors='ignore'`. Furthermore, an `OutOfBoundsDateime` exception will be raised when an out-of-range value is encountered for that unit when `errors='raise'`. ([GH 11758](https://github.com/pandas-dev/pandas/issues/11758), [GH 13052](https://github.com/pandas-dev/pandas/issues/13052), [GH 13059](https://github.com/pandas-dev/pandas/issues/13059)) + +Previous behaviour: + +```None +In [27]: pd.to_datetime(1420043460, unit='s', errors='coerce') +Out[27]: NaT + +In [28]: pd.to_datetime(11111111, unit='D', errors='ignore') +OverflowError: Python int too large to convert to C long + +In [29]: pd.to_datetime(11111111, unit='D', errors='raise') +OverflowError: Python int too large to convert to C long +``` + +New behaviour: + +```None +In [2]: pd.to_datetime(1420043460, unit='s', errors='coerce') +Out[2]: Timestamp('2014-12-31 16:31:00') + +In [3]: pd.to_datetime(11111111, unit='D', errors='ignore') +Out[3]: 11111111 + +In [4]: pd.to_datetime(11111111, unit='D', errors='raise') +OutOfBoundsDatetime: cannot convert input with unit 'D' +``` + +### Other API changes[#](#other-api-changes "Link to this heading") + +* `.swaplevel()` for `Series`, `DataFrame`, `Panel`, and `MultiIndex` now features defaults for its first two parameters `i` and `j` that swap the two innermost levels of the index. ([GH 12934](https://github.com/pandas-dev/pandas/issues/12934)) +* `.searchsorted()` for `Index` and `TimedeltaIndex` now accept a `sorter` argument to maintain compatibility with numpy’s `searchsorted` function ([GH 12238](https://github.com/pandas-dev/pandas/issues/12238)) +* `Period` and `PeriodIndex` now raises `IncompatibleFrequency` error which inherits `ValueError` rather than raw `ValueError` ([GH 12615](https://github.com/pandas-dev/pandas/issues/12615)) +* `Series.apply` for category dtype now applies the passed function to each of the `.categories` (and not the `.codes`), and returns a `category` dtype if possible ([GH 12473](https://github.com/pandas-dev/pandas/issues/12473)) +* `read_csv` will now raise a `TypeError` if `parse_dates` is neither a boolean, list, or dictionary (matches the doc-string) ([GH 5636](https://github.com/pandas-dev/pandas/issues/5636)) +* The default for `.query()/.eval()` is now `engine=None`, which will use `numexpr` if it’s installed; otherwise it will fallback to the `python` engine. This mimics the pre-0.18.1 behavior if `numexpr` is installed (and which, previously, if numexpr was not installed, `.query()/.eval()` would raise). ([GH 12749](https://github.com/pandas-dev/pandas/issues/12749)) +* `pd.show_versions()` now includes `pandas_datareader` version ([GH 12740](https://github.com/pandas-dev/pandas/issues/12740)) +* Provide a proper `__name__` and `__qualname__` attributes for generic functions ([GH 12021](https://github.com/pandas-dev/pandas/issues/12021)) +* `pd.concat(ignore_index=True)` now uses `RangeIndex` as default ([GH 12695](https://github.com/pandas-dev/pandas/issues/12695)) +* `pd.merge()` and `DataFrame.join()` will show a `UserWarning` when merging/joining a single- with a multi-leveled dataframe ([GH 9455](https://github.com/pandas-dev/pandas/issues/9455), [GH 12219](https://github.com/pandas-dev/pandas/issues/12219)) +* Compat with `scipy` > 0.17 for deprecated `piecewise_polynomial` interpolation method; support for the replacement `from_derivatives` method ([GH 12887](https://github.com/pandas-dev/pandas/issues/12887)) + +### Deprecations[#](#deprecations "Link to this heading") + +* The method name `Index.sym_diff()` is deprecated and can be replaced by `Index.symmetric_difference()` ([GH 12591](https://github.com/pandas-dev/pandas/issues/12591)) +* The method name `Categorical.sort()` is deprecated in favor of `Categorical.sort_values()` ([GH 12882](https://github.com/pandas-dev/pandas/issues/12882)) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Improved speed of SAS reader ([GH 12656](https://github.com/pandas-dev/pandas/issues/12656), [GH 12961](https://github.com/pandas-dev/pandas/issues/12961)) +* Performance improvements in `.groupby(..).cumcount()` ([GH 11039](https://github.com/pandas-dev/pandas/issues/11039)) +* Improved memory usage in `pd.read_csv()` when using `skiprows=an_integer` ([GH 13005](https://github.com/pandas-dev/pandas/issues/13005)) +* Improved performance of `DataFrame.to_sql` when checking case sensitivity for tables. Now only checks if table has been created correctly when table name is not lower case. ([GH 12876](https://github.com/pandas-dev/pandas/issues/12876)) +* Improved performance of `Period` construction and time series plotting ([GH 12903](https://github.com/pandas-dev/pandas/issues/12903), [GH 11831](https://github.com/pandas-dev/pandas/issues/11831)). +* Improved performance of `.str.encode()` and `.str.decode()` methods ([GH 13008](https://github.com/pandas-dev/pandas/issues/13008)) +* Improved performance of `to_numeric` if input is numeric dtype ([GH 12777](https://github.com/pandas-dev/pandas/issues/12777)) +* Improved performance of sparse arithmetic with `IntIndex` ([GH 13036](https://github.com/pandas-dev/pandas/issues/13036)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* `usecols` parameter in `pd.read_csv` is now respected even when the lines of a CSV file are not even ([GH 12203](https://github.com/pandas-dev/pandas/issues/12203)) +* Bug in `groupby.transform(..)` when `axis=1` is specified with a non-monotonic ordered index ([GH 12713](https://github.com/pandas-dev/pandas/issues/12713)) +* Bug in `Period` and `PeriodIndex` creation raises `KeyError` if `freq="Minute"` is specified. Note that “Minute” freq is deprecated in v0.17.0, and recommended to use `freq="T"` instead ([GH 11854](https://github.com/pandas-dev/pandas/issues/11854)) +* Bug in `.resample(...).count()` with a `PeriodIndex` always raising a `TypeError` ([GH 12774](https://github.com/pandas-dev/pandas/issues/12774)) +* Bug in `.resample(...)` with a `PeriodIndex` casting to a `DatetimeIndex` when empty ([GH 12868](https://github.com/pandas-dev/pandas/issues/12868)) +* Bug in `.resample(...)` with a `PeriodIndex` when resampling to an existing frequency ([GH 12770](https://github.com/pandas-dev/pandas/issues/12770)) +* Bug in printing data which contains `Period` with different `freq` raises `ValueError` ([GH 12615](https://github.com/pandas-dev/pandas/issues/12615)) +* Bug in `Series` construction with `Categorical` and `dtype='category'` is specified ([GH 12574](https://github.com/pandas-dev/pandas/issues/12574)) +* Bugs in concatenation with a coercible dtype was too aggressive, resulting in different dtypes in output formatting when an object was longer than `display.max_rows` ([GH 12411](https://github.com/pandas-dev/pandas/issues/12411), [GH 12045](https://github.com/pandas-dev/pandas/issues/12045), [GH 11594](https://github.com/pandas-dev/pandas/issues/11594), [GH 10571](https://github.com/pandas-dev/pandas/issues/10571), [GH 12211](https://github.com/pandas-dev/pandas/issues/12211)) +* Bug in `float_format` option with option not being validated as a callable. ([GH 12706](https://github.com/pandas-dev/pandas/issues/12706)) +* Bug in `GroupBy.filter` when `dropna=False` and no groups fulfilled the criteria ([GH 12768](https://github.com/pandas-dev/pandas/issues/12768)) +* Bug in `__name__` of `.cum*` functions ([GH 12021](https://github.com/pandas-dev/pandas/issues/12021)) +* Bug in `.astype()` of a `Float64Inde/Int64Index` to an `Int64Index` ([GH 12881](https://github.com/pandas-dev/pandas/issues/12881)) +* Bug in round tripping an integer based index in `.to_json()/.read_json()` when `orient='index'` (the default) ([GH 12866](https://github.com/pandas-dev/pandas/issues/12866)) +* Bug in plotting `Categorical` dtypes cause error when attempting stacked bar plot ([GH 13019](https://github.com/pandas-dev/pandas/issues/13019)) +* Compat with >= `numpy` 1.11 for `NaT` comparisons ([GH 12969](https://github.com/pandas-dev/pandas/issues/12969)) +* Bug in `.drop()` with a non-unique `MultiIndex`. ([GH 12701](https://github.com/pandas-dev/pandas/issues/12701)) +* Bug in `.concat` of datetime tz-aware and naive DataFrames ([GH 12467](https://github.com/pandas-dev/pandas/issues/12467)) +* Bug in correctly raising a `ValueError` in `.resample(..).fillna(..)` when passing a non-string ([GH 12952](https://github.com/pandas-dev/pandas/issues/12952)) +* Bug fixes in various encoding and header processing issues in `pd.read_sas()` ([GH 12659](https://github.com/pandas-dev/pandas/issues/12659), [GH 12654](https://github.com/pandas-dev/pandas/issues/12654), [GH 12647](https://github.com/pandas-dev/pandas/issues/12647), [GH 12809](https://github.com/pandas-dev/pandas/issues/12809)) +* Bug in `pd.crosstab()` where would silently ignore `aggfunc` if `values=None` ([GH 12569](https://github.com/pandas-dev/pandas/issues/12569)). +* Potential segfault in `DataFrame.to_json` when serialising `datetime.time` ([GH 11473](https://github.com/pandas-dev/pandas/issues/11473)). +* Potential segfault in `DataFrame.to_json` when attempting to serialise 0d array ([GH 11299](https://github.com/pandas-dev/pandas/issues/11299)). +* Segfault in `to_json` when attempting to serialise a `DataFrame` or `Series` with non-ndarray values; now supports serialization of `category`, `sparse`, and `datetime64[ns, tz]` dtypes ([GH 10778](https://github.com/pandas-dev/pandas/issues/10778)). +* Bug in `DataFrame.to_json` with unsupported dtype not passed to default handler ([GH 12554](https://github.com/pandas-dev/pandas/issues/12554)). +* Bug in `.align` not returning the sub-class ([GH 12983](https://github.com/pandas-dev/pandas/issues/12983)) +* Bug in aligning a `Series` with a `DataFrame` ([GH 13037](https://github.com/pandas-dev/pandas/issues/13037)) +* Bug in `ABCPanel` in which `Panel4D` was not being considered as a valid instance of this generic type ([GH 12810](https://github.com/pandas-dev/pandas/issues/12810)) +* Bug in consistency of `.name` on `.groupby(..).apply(..)` cases ([GH 12363](https://github.com/pandas-dev/pandas/issues/12363)) +* Bug in `Timestamp.__repr__` that caused `pprint` to fail in nested structures ([GH 12622](https://github.com/pandas-dev/pandas/issues/12622)) +* Bug in `Timedelta.min` and `Timedelta.max`, the properties now report the true minimum/maximum `timedeltas` as recognized by pandas. See the [documentation](../user_guide/timedeltas.html#timedeltas-limitations). ([GH 12727](https://github.com/pandas-dev/pandas/issues/12727)) +* Bug in `.quantile()` with interpolation may coerce to `float` unexpectedly ([GH 12772](https://github.com/pandas-dev/pandas/issues/12772)) +* Bug in `.quantile()` with empty `Series` may return scalar rather than empty `Series` ([GH 12772](https://github.com/pandas-dev/pandas/issues/12772)) +* Bug in `.loc` with out-of-bounds in a large indexer would raise `IndexError` rather than `KeyError` ([GH 12527](https://github.com/pandas-dev/pandas/issues/12527)) +* Bug in resampling when using a `TimedeltaIndex` and `.asfreq()`, would previously not include the final fencepost ([GH 12926](https://github.com/pandas-dev/pandas/issues/12926)) +* Bug in equality testing with a `Categorical` in a `DataFrame` ([GH 12564](https://github.com/pandas-dev/pandas/issues/12564)) +* Bug in `GroupBy.first()`, `.last()` returns incorrect row when `TimeGrouper` is used ([GH 7453](https://github.com/pandas-dev/pandas/issues/7453)) +* Bug in `pd.read_csv()` with the `c` engine when specifying `skiprows` with newlines in quoted items ([GH 10911](https://github.com/pandas-dev/pandas/issues/10911), [GH 12775](https://github.com/pandas-dev/pandas/issues/12775)) +* Bug in `DataFrame` timezone lost when assigning tz-aware datetime `Series` with alignment ([GH 12981](https://github.com/pandas-dev/pandas/issues/12981)) +* Bug in `.value_counts()` when `normalize=True` and `dropna=True` where nulls still contributed to the normalized count ([GH 12558](https://github.com/pandas-dev/pandas/issues/12558)) +* Bug in `Series.value_counts()` loses name if its dtype is `category` ([GH 12835](https://github.com/pandas-dev/pandas/issues/12835)) +* Bug in `Series.value_counts()` loses timezone info ([GH 12835](https://github.com/pandas-dev/pandas/issues/12835)) +* Bug in `Series.value_counts(normalize=True)` with `Categorical` raises `UnboundLocalError` ([GH 12835](https://github.com/pandas-dev/pandas/issues/12835)) +* Bug in `Panel.fillna()` ignoring `inplace=True` ([GH 12633](https://github.com/pandas-dev/pandas/issues/12633)) +* Bug in `pd.read_csv()` when specifying `names`, `usecols`, and `parse_dates` simultaneously with the `c` engine ([GH 9755](https://github.com/pandas-dev/pandas/issues/9755)) +* Bug in `pd.read_csv()` when specifying `delim_whitespace=True` and `lineterminator` simultaneously with the `c` engine ([GH 12912](https://github.com/pandas-dev/pandas/issues/12912)) +* Bug in `Series.rename`, `DataFrame.rename` and `DataFrame.rename_axis` not treating `Series` as mappings to relabel ([GH 12623](https://github.com/pandas-dev/pandas/issues/12623)). +* Clean in `.rolling.min` and `.rolling.max` to enhance dtype handling ([GH 12373](https://github.com/pandas-dev/pandas/issues/12373)) +* Bug in `groupby` where complex types are coerced to float ([GH 12902](https://github.com/pandas-dev/pandas/issues/12902)) +* Bug in `Series.map` raises `TypeError` if its dtype is `category` or tz-aware `datetime` ([GH 12473](https://github.com/pandas-dev/pandas/issues/12473)) +* Bugs on 32bit platforms for some test comparisons ([GH 12972](https://github.com/pandas-dev/pandas/issues/12972)) +* Bug in index coercion when falling back from `RangeIndex` construction ([GH 12893](https://github.com/pandas-dev/pandas/issues/12893)) +* Better error message in window functions when invalid argument (e.g. a float window) is passed ([GH 12669](https://github.com/pandas-dev/pandas/issues/12669)) +* Bug in slicing subclassed `DataFrame` defined to return subclassed `Series` may return normal `Series` ([GH 11559](https://github.com/pandas-dev/pandas/issues/11559)) +* Bug in `.str` accessor methods may raise `ValueError` if input has `name` and the result is `DataFrame` or `MultiIndex` ([GH 12617](https://github.com/pandas-dev/pandas/issues/12617)) +* Bug in `DataFrame.last_valid_index()` and `DataFrame.first_valid_index()` on empty frames ([GH 12800](https://github.com/pandas-dev/pandas/issues/12800)) +* Bug in `CategoricalIndex.get_loc` returns different result from regular `Index` ([GH 12531](https://github.com/pandas-dev/pandas/issues/12531)) +* Bug in `PeriodIndex.resample` where name not propagated ([GH 12769](https://github.com/pandas-dev/pandas/issues/12769)) +* Bug in `date_range` `closed` keyword and timezones ([GH 12684](https://github.com/pandas-dev/pandas/issues/12684)). +* Bug in `pd.concat` raises `AttributeError` when input data contains tz-aware datetime and timedelta ([GH 12620](https://github.com/pandas-dev/pandas/issues/12620)) +* Bug in `pd.concat` did not handle empty `Series` properly ([GH 11082](https://github.com/pandas-dev/pandas/issues/11082)) +* Bug in `.plot.bar` alignment when `width` is specified with `int` ([GH 12979](https://github.com/pandas-dev/pandas/issues/12979)) +* Bug in `fill_value` is ignored if the argument to a binary operator is a constant ([GH 12723](https://github.com/pandas-dev/pandas/issues/12723)) +* Bug in `pd.read_html()` when using bs4 flavor and parsing table with a header and only one column ([GH 9178](https://github.com/pandas-dev/pandas/issues/9178)) +* Bug in `.pivot_table` when `margins=True` and `dropna=True` where nulls still contributed to margin count ([GH 12577](https://github.com/pandas-dev/pandas/issues/12577)) +* Bug in `.pivot_table` when `dropna=False` where table index/column names disappear ([GH 12133](https://github.com/pandas-dev/pandas/issues/12133)) +* Bug in `pd.crosstab()` when `margins=True` and `dropna=False` which raised ([GH 12642](https://github.com/pandas-dev/pandas/issues/12642)) +* Bug in `Series.name` when `name` attribute can be a hashable type ([GH 12610](https://github.com/pandas-dev/pandas/issues/12610)) +* Bug in `.describe()` resets categorical columns information ([GH 11558](https://github.com/pandas-dev/pandas/issues/11558)) +* Bug where `loffset` argument was not applied when calling `resample().count()` on a timeseries ([GH 12725](https://github.com/pandas-dev/pandas/issues/12725)) +* `pd.read_excel()` now accepts column names associated with keyword argument `names` ([GH 12870](https://github.com/pandas-dev/pandas/issues/12870)) +* Bug in `pd.to_numeric()` with `Index` returns `np.ndarray`, rather than `Index` ([GH 12777](https://github.com/pandas-dev/pandas/issues/12777)) +* Bug in `pd.to_numeric()` with datetime-like may raise `TypeError` ([GH 12777](https://github.com/pandas-dev/pandas/issues/12777)) +* Bug in `pd.to_numeric()` with scalar raises `ValueError` ([GH 12777](https://github.com/pandas-dev/pandas/issues/12777)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 60 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Andrew Fiore-Gartland + +* Bastiaan + +* Benoît Vinot + +* Brandon Rhodes + +* DaCoEx + +* Drew Fustin + +* Ernesto Freitas + +* Filip Ter + +* Gregory Livschitz + +* Gábor Lipták +* Hassan Kibirige + +* Iblis Lin +* Israel Saeta Pérez + +* Jason Wolosonovich + +* Jeff Reback +* Joe Jevnik +* Joris Van den Bossche +* Joshua Storck + +* Ka Wo Chen +* Kerby Shedden +* Kieran O’Mahony +* Leif Walsh + +* Mahmoud Lababidi + +* Maoyuan Liu + +* Mark Roth + +* Matt Wittmann +* MaxU + +* Maximilian Roos +* Michael Droettboom + +* Nick Eubank +* Nicolas Bonnotte +* OXPHOS + +* Pauli Virtanen + +* Peter Waller + +* Pietro Battiston +* Prabhjot Singh + +* Robin Wilson +* Roger Thomas + +* Sebastian Bank +* Stephen Hoover +* Tim Hopper + +* Tom Augspurger +* WANG Aiyong +* Wes Turner +* Winand + +* Xbar + +* Yan Facai + +* adneu + +* ajenkins-cargometrics + +* behzad nouri +* chinskiy + +* gfyoung +* jeps-journal + +* jonaslb + +* kotrfa + +* nileracecrew + +* onesandzeroes +* rs2 + +* sinhrks +* tsdlovell + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.19.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.19.0.md new file mode 100644 index 0000000000000000000000000000000000000000..6412eb9c94cefdd3ad65ac76417c843097951079 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.19.0.md @@ -0,0 +1,2238 @@ +# What's new in pandas 0.19.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.19.0.html + +# Version 0.19.0 (October 2, 2016)[#](#version-0-19-0-october-2-2016 "Link to this heading") + +This is a major release from 0.18.1 and includes number of API changes, several new features, +enhancements, and performance improvements along with a large number of bug fixes. We recommend that all +users upgrade to this version. + +Highlights include: + +* [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") for asof-style time-series joining, see [here](#whatsnew-0190-enhancements-asof-merge) +* `.rolling()` is now time-series aware, see [here](#whatsnew-0190-enhancements-rolling-ts) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") now supports parsing `Categorical` data, see [here](#whatsnew-0190-enhancements-read-csv-categorical) +* A function `union_categorical()` has been added for combining categoricals, see [here](#whatsnew-0190-enhancements-union-categoricals) +* `PeriodIndex` now has its own `period` dtype, and changed to be more consistent with other `Index` classes. See [here](#whatsnew-0190-api-period) +* Sparse data structures gained enhanced support of `int` and `bool` dtypes, see [here](#whatsnew-0190-sparse) +* Comparison operations with `Series` no longer ignores the index, see [here](#whatsnew-0190-api-series-ops) for an overview of the API changes. +* Introduction of a pandas development API for utility functions, see [here](#whatsnew-0190-dev-api). +* Deprecation of `Panel4D` and `PanelND`. We recommend to represent these types of n-dimensional data with the [xarray package](http://xarray.pydata.org/en/stable/). +* Removal of the previously deprecated modules `pandas.io.data`, `pandas.io.wb`, `pandas.tools.rplot`. + +Warning + +pandas >= 0.19.0 will no longer silence numpy ufunc warnings upon import, see [here](#whatsnew-0190-errstate). + +What’s new in v0.19.0 + +* [New features](#new-features) + + + [Function `merge_asof` for asof-style time-series joining](#function-merge-asof-for-asof-style-time-series-joining) + + [Method `.rolling()` is now time-series aware](#method-rolling-is-now-time-series-aware) + + [Method `read_csv` has improved support for duplicate column names](#method-read-csv-has-improved-support-for-duplicate-column-names) + + [Method `read_csv` supports parsing `Categorical` directly](#method-read-csv-supports-parsing-categorical-directly) + + [Categorical concatenation](#categorical-concatenation) + + [Semi-month offsets](#semi-month-offsets) + + [New Index methods](#new-index-methods) + + [Google BigQuery enhancements](#google-bigquery-enhancements) + + [Fine-grained NumPy errstate](#fine-grained-numpy-errstate) + + [Method `get_dummies` now returns integer dtypes](#method-get-dummies-now-returns-integer-dtypes) + + [Downcast values to smallest possible dtype in `to_numeric`](#downcast-values-to-smallest-possible-dtype-in-to-numeric) + + [pandas development API](#pandas-development-api) + + [Other enhancements](#other-enhancements) +* [API changes](#api-changes) + + + [`Series.tolist()` will now return Python types](#series-tolist-will-now-return-python-types) + + [`Series` operators for different indexes](#series-operators-for-different-indexes) + + - [Arithmetic operators](#arithmetic-operators) + - [Comparison operators](#comparison-operators) + - [Logical operators](#logical-operators) + - [Flexible comparison methods](#flexible-comparison-methods) + + [`Series` type promotion on assignment](#series-type-promotion-on-assignment) + + [Function `.to_datetime()` changes](#function-to-datetime-changes) + + [Merging changes](#merging-changes) + + [Method `.describe()` changes](#method-describe-changes) + + [`Period` changes](#period-changes) + + - [The `PeriodIndex` now has `period` dtype](#the-periodindex-now-has-period-dtype) + - [`Period('NaT')` now returns `pd.NaT`](#period-nat-now-returns-pd-nat) + - [`PeriodIndex.values` now returns array of `Period` object](#periodindex-values-now-returns-array-of-period-object) + + [Index `+` / `-` no longer used for set operations](#index-no-longer-used-for-set-operations) + + [`Index.difference` and `.symmetric_difference` changes](#index-difference-and-symmetric-difference-changes) + + [`Index.unique` consistently returns `Index`](#index-unique-consistently-returns-index) + + [`MultiIndex` constructors, `groupby` and `set_index` preserve categorical dtypes](#multiindex-constructors-groupby-and-set-index-preserve-categorical-dtypes) + + [Function `read_csv` will progressively enumerate chunks](#function-read-csv-will-progressively-enumerate-chunks) + + [Sparse changes](#sparse-changes) + + - [Types `int64` and `bool` support enhancements](#types-int64-and-bool-support-enhancements) + - [Operators now preserve dtypes](#operators-now-preserve-dtypes) + - [Other sparse fixes](#other-sparse-fixes) + + [Indexer dtype changes](#indexer-dtype-changes) + + [Other API changes](#other-api-changes) +* [Deprecations](#deprecations) +* [Removal of prior version deprecations/changes](#removal-of-prior-version-deprecations-changes) +* [Performance improvements](#performance-improvements) +* [Bug fixes](#bug-fixes) +* [Contributors](#contributors) + +## New features[#](#new-features "Link to this heading") + +### Function `merge_asof` for asof-style time-series joining[#](#function-merge-asof-for-asof-style-time-series-joining "Link to this heading") + +A long-time requested feature has been added through the [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") function, to +support asof style joining of time-series ([GH 1870](https://github.com/pandas-dev/pandas/issues/1870), [GH 13695](https://github.com/pandas-dev/pandas/issues/13695), [GH 13709](https://github.com/pandas-dev/pandas/issues/13709), [GH 13902](https://github.com/pandas-dev/pandas/issues/13902)). Full documentation is +[here](../user_guide/merging.html#merging-merge-asof). + +The [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") performs an asof merge, which is similar to a left-join +except that we match on nearest key rather than equal keys. + +```None +In [1]: left = pd.DataFrame({"a": [1, 5, 10], "left_val": ["a", "b", "c"]}) + +In [2]: right = pd.DataFrame({"a": [1, 2, 3, 6, 7], "right_val": [1, 2, 3, 6, 7]}) + +In [3]: left +Out[3]: + a left_val +0 1 a +1 5 b +2 10 c + +[3 rows x 2 columns] + +In [4]: right +Out[4]: + a right_val +0 1 1 +1 2 2 +2 3 3 +3 6 6 +4 7 7 + +[5 rows x 2 columns] +``` + +We typically want to match exactly when possible, and use the most +recent value otherwise. + +```None +In [5]: pd.merge_asof(left, right, on="a") +Out[5]: + a left_val right_val +0 1 a 1 +1 5 b 3 +2 10 c 7 + +[3 rows x 3 columns] +``` + +We can also match rows ONLY with prior data, and not an exact match. + +```None +In [6]: pd.merge_asof(left, right, on="a", allow_exact_matches=False) +Out[6]: + a left_val right_val +0 1 a NaN +1 5 b 3.0 +2 10 c 7.0 + +[3 rows x 3 columns] +``` + +In a typical time-series example, we have `trades` and `quotes` and we want to `asof-join` them. +This also illustrates using the `by` parameter to group data before merging. + +```None +In [7]: trades = pd.DataFrame( + ...: { + ...: "time": pd.to_datetime( + ...: [ + ...: "20160525 13:30:00.023", + ...: "20160525 13:30:00.038", + ...: "20160525 13:30:00.048", + ...: "20160525 13:30:00.048", + ...: "20160525 13:30:00.048", + ...: ] + ...: ), + ...: "ticker": ["MSFT", "MSFT", "GOOG", "GOOG", "AAPL"], + ...: "price": [51.95, 51.95, 720.77, 720.92, 98.00], + ...: "quantity": [75, 155, 100, 100, 100], + ...: }, + ...: columns=["time", "ticker", "price", "quantity"], + ...: ) + ...: + +In [8]: quotes = pd.DataFrame( + ...: { + ...: "time": pd.to_datetime( + ...: [ + ...: "20160525 13:30:00.023", + ...: "20160525 13:30:00.023", + ...: "20160525 13:30:00.030", + ...: "20160525 13:30:00.041", + ...: "20160525 13:30:00.048", + ...: "20160525 13:30:00.049", + ...: "20160525 13:30:00.072", + ...: "20160525 13:30:00.075", + ...: ] + ...: ), + ...: "ticker": ["GOOG", "MSFT", "MSFT", "MSFT", "GOOG", "AAPL", "GOOG", "MSFT"], + ...: "bid": [720.50, 51.95, 51.97, 51.99, 720.50, 97.99, 720.50, 52.01], + ...: "ask": [720.93, 51.96, 51.98, 52.00, 720.93, 98.01, 720.88, 52.03], + ...: }, + ...: columns=["time", "ticker", "bid", "ask"], + ...: ) + ...: +``` + +```None +In [9]: trades +Out[9]: + time ticker price quantity +0 2016-05-25 13:30:00.023 MSFT 51.95 75 +1 2016-05-25 13:30:00.038 MSFT 51.95 155 +2 2016-05-25 13:30:00.048 GOOG 720.77 100 +3 2016-05-25 13:30:00.048 GOOG 720.92 100 +4 2016-05-25 13:30:00.048 AAPL 98.00 100 + +[5 rows x 4 columns] + +In [10]: quotes +Out[10]: + time ticker bid ask +0 2016-05-25 13:30:00.023 GOOG 720.50 720.93 +1 2016-05-25 13:30:00.023 MSFT 51.95 51.96 +2 2016-05-25 13:30:00.030 MSFT 51.97 51.98 +3 2016-05-25 13:30:00.041 MSFT 51.99 52.00 +4 2016-05-25 13:30:00.048 GOOG 720.50 720.93 +5 2016-05-25 13:30:00.049 AAPL 97.99 98.01 +6 2016-05-25 13:30:00.072 GOOG 720.50 720.88 +7 2016-05-25 13:30:00.075 MSFT 52.01 52.03 + +[8 rows x 4 columns] +``` + +An asof merge joins on the `on`, typically a datetimelike field, which is ordered, and +in this case we are using a grouper in the `by` field. This is like a left-outer join, except +that forward filling happens automatically taking the most recent non-NaN value. + +```None +In [11]: pd.merge_asof(trades, quotes, on="time", by="ticker") +Out[11]: + time ticker price quantity bid ask +0 2016-05-25 13:30:00.023 MSFT 51.95 75 51.95 51.96 +1 2016-05-25 13:30:00.038 MSFT 51.95 155 51.97 51.98 +2 2016-05-25 13:30:00.048 GOOG 720.77 100 720.50 720.93 +3 2016-05-25 13:30:00.048 GOOG 720.92 100 720.50 720.93 +4 2016-05-25 13:30:00.048 AAPL 98.00 100 NaN NaN + +[5 rows x 6 columns] +``` + +This returns a merged DataFrame with the entries in the same order as the original left +passed DataFrame (`trades` in this case), with the fields of the `quotes` merged. + +### Method `.rolling()` is now time-series aware[#](#method-rolling-is-now-time-series-aware "Link to this heading") + +`.rolling()` objects are now time-series aware and can accept a time-series offset (or convertible) for the `window` argument ([GH 13327](https://github.com/pandas-dev/pandas/issues/13327), [GH 12995](https://github.com/pandas-dev/pandas/issues/12995)). +See the full documentation [here](../user_guide/window.html#window-generic). + +```None +In [12]: dft = pd.DataFrame( + ....: {"B": [0, 1, 2, np.nan, 4]}, + ....: index=pd.date_range("20130101 09:00:00", periods=5, freq="s"), + ....: ) + ....: + +In [13]: dft +Out[13]: + B +2013-01-01 09:00:00 0.0 +2013-01-01 09:00:01 1.0 +2013-01-01 09:00:02 2.0 +2013-01-01 09:00:03 NaN +2013-01-01 09:00:04 4.0 + +[5 rows x 1 columns] +``` + +This is a regular frequency index. Using an integer window parameter works to roll along the window frequency. + +```None +In [14]: dft.rolling(2).sum() +Out[14]: + B +2013-01-01 09:00:00 NaN +2013-01-01 09:00:01 1.0 +2013-01-01 09:00:02 3.0 +2013-01-01 09:00:03 NaN +2013-01-01 09:00:04 NaN + +[5 rows x 1 columns] + +In [15]: dft.rolling(2, min_periods=1).sum() +Out[15]: + B +2013-01-01 09:00:00 0.0 +2013-01-01 09:00:01 1.0 +2013-01-01 09:00:02 3.0 +2013-01-01 09:00:03 2.0 +2013-01-01 09:00:04 4.0 + +[5 rows x 1 columns] +``` + +Specifying an offset allows a more intuitive specification of the rolling frequency. + +```None +In [16]: dft.rolling("2s").sum() +Out[16]: + B +2013-01-01 09:00:00 0.0 +2013-01-01 09:00:01 1.0 +2013-01-01 09:00:02 3.0 +2013-01-01 09:00:03 2.0 +2013-01-01 09:00:04 4.0 + +[5 rows x 1 columns] +``` + +Using a non-regular, but still monotonic index, rolling with an integer window does not impart any special calculation. + +```None +In [17]: dft = pd.DataFrame( + ....: {"B": [0, 1, 2, np.nan, 4]}, + ....: index=pd.Index( + ....: [ + ....: pd.Timestamp("20130101 09:00:00"), + ....: pd.Timestamp("20130101 09:00:02"), + ....: pd.Timestamp("20130101 09:00:03"), + ....: pd.Timestamp("20130101 09:00:05"), + ....: pd.Timestamp("20130101 09:00:06"), + ....: ], + ....: name="foo", + ....: ), + ....: ) + ....: + +In [18]: dft +Out[18]: + B +foo +2013-01-01 09:00:00 0.0 +2013-01-01 09:00:02 1.0 +2013-01-01 09:00:03 2.0 +2013-01-01 09:00:05 NaN +2013-01-01 09:00:06 4.0 + +[5 rows x 1 columns] + +In [19]: dft.rolling(2).sum() +Out[19]: + B +foo +2013-01-01 09:00:00 NaN +2013-01-01 09:00:02 1.0 +2013-01-01 09:00:03 3.0 +2013-01-01 09:00:05 NaN +2013-01-01 09:00:06 NaN + +[5 rows x 1 columns] +``` + +Using the time-specification generates variable windows for this sparse data. + +```None +In [20]: dft.rolling("2s").sum() +Out[20]: + B +foo +2013-01-01 09:00:00 0.0 +2013-01-01 09:00:02 1.0 +2013-01-01 09:00:03 3.0 +2013-01-01 09:00:05 NaN +2013-01-01 09:00:06 4.0 + +[5 rows x 1 columns] +``` + +Furthermore, we now allow an optional `on` parameter to specify a column (rather than the +default of the index) in a DataFrame. + +```None +In [21]: dft = dft.reset_index() + +In [22]: dft +Out[22]: + foo B +0 2013-01-01 09:00:00 0.0 +1 2013-01-01 09:00:02 1.0 +2 2013-01-01 09:00:03 2.0 +3 2013-01-01 09:00:05 NaN +4 2013-01-01 09:00:06 4.0 + +[5 rows x 2 columns] + +In [23]: dft.rolling("2s", on="foo").sum() +Out[23]: + foo B +0 2013-01-01 09:00:00 0.0 +1 2013-01-01 09:00:02 1.0 +2 2013-01-01 09:00:03 3.0 +3 2013-01-01 09:00:05 NaN +4 2013-01-01 09:00:06 4.0 + +[5 rows x 2 columns] +``` + +### Method `read_csv` has improved support for duplicate column names[#](#method-read-csv-has-improved-support-for-duplicate-column-names "Link to this heading") + +[Duplicate column names](../user_guide/io.html#io-dupe-names) are now supported in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") whether +they are in the file or passed in as the `names` parameter ([GH 7160](https://github.com/pandas-dev/pandas/issues/7160), [GH 9424](https://github.com/pandas-dev/pandas/issues/9424)) + +```None +In [24]: data = "0,1,2\n3,4,5" + +In [25]: names = ["a", "b", "a"] +``` + +**Previous behavior**: + +```None +In [2]: pd.read_csv(StringIO(data), names=names) +Out[2]: + a b a +0 2 1 2 +1 5 4 5 +``` + +The first `a` column contained the same data as the second `a` column, when it should have +contained the values `[0, 3]`. + +**New behavior**: + +```None +In [26]: pd.read_csv(StringIO(data), names=names) +--------------------------------------------------------------------------- +ValueError Traceback (most recent call last) +Cell In[26], line 1 +----> 1 pd.read_csv(StringIO(data), names=names) + +File ~/work/pandas/pandas/pandas/io/parsers/readers.py:1026, in read_csv(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, date_format, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, encoding_errors, dialect, on_bad_lines, delim_whitespace, low_memory, memory_map, float_precision, storage_options, dtype_backend) + 1013 kwds_defaults = _refine_defaults_read( + 1014 dialect, + 1015 delimiter, + (...) + 1022 dtype_backend=dtype_backend, + 1023 ) + 1024 kwds.update(kwds_defaults) +-> 1026 return _read(filepath_or_buffer, kwds) + +File ~/work/pandas/pandas/pandas/io/parsers/readers.py:617, in _read(filepath_or_buffer, kwds) + 614 nrows = kwds.get("nrows", None) + 616 # Check for duplicates in names. +--> 617 _validate_names(kwds.get("names", None)) + 619 # Create the parser. + 620 parser = TextFileReader(filepath_or_buffer, **kwds) + +File ~/work/pandas/pandas/pandas/io/parsers/readers.py:576, in _validate_names(names) + 574 if names is not None: + 575 if len(names) != len(set(names)): +--> 576 raise ValueError("Duplicate names are not allowed.") + 577 if not ( + 578 is_list_like(names, allow_sets=False) or isinstance(names, abc.KeysView) + 579 ): + 580 raise ValueError("Names should be an ordered collection.") + +ValueError: Duplicate names are not allowed. +``` + +### Method `read_csv` supports parsing `Categorical` directly[#](#method-read-csv-supports-parsing-categorical-directly "Link to this heading") + +The [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") function now supports parsing a `Categorical` column when +specified as a dtype ([GH 10153](https://github.com/pandas-dev/pandas/issues/10153)). Depending on the structure of the data, +this can result in a faster parse time and lower memory usage compared to +converting to `Categorical` after parsing. See the io [docs here](../user_guide/io.html#io-categorical). + +```None +In [27]: data = """ + ....: col1,col2,col3 + ....: a,b,1 + ....: a,b,2 + ....: c,d,3 + ....: """ + ....: + +In [28]: pd.read_csv(StringIO(data)) +Out[28]: + col1 col2 col3 +0 a b 1 +1 a b 2 +2 c d 3 + +[3 rows x 3 columns] + +In [29]: pd.read_csv(StringIO(data)).dtypes +Out[29]: +col1 object +col2 object +col3 int64 +Length: 3, dtype: object + +In [30]: pd.read_csv(StringIO(data), dtype="category").dtypes +Out[30]: +col1 category +col2 category +col3 category +Length: 3, dtype: object +``` + +Individual columns can be parsed as a `Categorical` using a dict specification + +```None +In [31]: pd.read_csv(StringIO(data), dtype={"col1": "category"}).dtypes +Out[31]: +col1 category +col2 object +col3 int64 +Length: 3, dtype: object +``` + +Note + +The resulting categories will always be parsed as strings (object dtype). +If the categories are numeric they can be converted using the +[`to_numeric()`](../reference/api/pandas.to_numeric.html#pandas.to_numeric "pandas.to_numeric") function, or as appropriate, another converter +such as [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime"). + +```None +In [32]: df = pd.read_csv(StringIO(data), dtype="category") + +In [33]: df.dtypes +Out[33]: +col1 category +col2 category +col3 category +Length: 3, dtype: object + +In [34]: df["col3"] +Out[34]: +0 1 +1 2 +2 3 +Name: col3, Length: 3, dtype: category +Categories (3, object): ['1', '2', '3'] + +In [35]: new_categories = pd.to_numeric(df["col3"].cat.categories) + +In [36]: df["col3"] = df["col3"].cat.rename_categories(new_categories) + +In [37]: df["col3"] +Out[37]: +0 1 +1 2 +2 3 +Name: col3, Length: 3, dtype: category +Categories (3, int64): [1, 2, 3] +``` + +### Categorical concatenation[#](#categorical-concatenation "Link to this heading") + +* A function `union_categoricals()` has been added for combining categoricals, see [Unioning Categoricals](../user_guide/categorical.html#categorical-union) ([GH 13361](https://github.com/pandas-dev/pandas/issues/13361), [GH 13763](https://github.com/pandas-dev/pandas/issues/13763), [GH 13846](https://github.com/pandas-dev/pandas/issues/13846), [GH 14173](https://github.com/pandas-dev/pandas/issues/14173)) + + ```None + In [38]: from pandas.api.types import union_categoricals + + In [39]: a = pd.Categorical(["b", "c"]) + + In [40]: b = pd.Categorical(["a", "b"]) + + In [41]: union_categoricals([a, b]) + Out[41]: + ['b', 'c', 'a', 'b'] + Categories (3, object): ['b', 'c', 'a'] + ``` +* `concat` and `append` now can concat `category` dtypes with different `categories` as `object` dtype ([GH 13524](https://github.com/pandas-dev/pandas/issues/13524)) + + ```None + In [42]: s1 = pd.Series(["a", "b"], dtype="category") + + In [43]: s2 = pd.Series(["b", "c"], dtype="category") + ``` + +**Previous behavior**: + +```None +In [1]: pd.concat([s1, s2]) +ValueError: incompatible categories in categorical concat +``` + +**New behavior**: + +```None +In [44]: pd.concat([s1, s2]) +Out[44]: +0 a +1 b +0 b +1 c +Length: 4, dtype: object +``` + +### Semi-month offsets[#](#semi-month-offsets "Link to this heading") + +pandas has gained new frequency offsets, `SemiMonthEnd` (‘SM’) and `SemiMonthBegin` (‘SMS’). +These provide date offsets anchored (by default) to the 15th and end of month, and 15th and 1st of month respectively. +([GH 1543](https://github.com/pandas-dev/pandas/issues/1543)) + +```None +In [45]: from pandas.tseries.offsets import SemiMonthEnd, SemiMonthBegin +``` + +**SemiMonthEnd**: + +```None +In [46]: pd.Timestamp("2016-01-01") + SemiMonthEnd() +Out[46]: Timestamp('2016-01-15 00:00:00') + +In [47]: pd.date_range("2015-01-01", freq="SM", periods=4) +Out[47]: DatetimeIndex(['2015-01-15', '2015-01-31', '2015-02-15', '2015-02-28'], dtype='datetime64[ns]', freq='SM-15') +``` + +**SemiMonthBegin**: + +```None +In [46]: pd.Timestamp("2016-01-01") + SemiMonthBegin() +Out[46]: Timestamp('2016-01-15 00:00:00') + +In [47]: pd.date_range("2015-01-01", freq="SMS", periods=4) +Out[47]: DatetimeIndex(['2015-01-01', '2015-01-15', '2015-02-01', '2015-02-15'], dtype='datetime64[ns]', freq='SMS-15') +``` + +Using the anchoring suffix, you can also specify the day of month to use instead of the 15th. + +```None +In [50]: pd.date_range("2015-01-01", freq="SMS-16", periods=4) +Out[50]: DatetimeIndex(['2015-01-01', '2015-01-16', '2015-02-01', '2015-02-16'], dtype='datetime64[ns]', freq='SMS-16') + +In [51]: pd.date_range("2015-01-01", freq="SM-14", periods=4) +Out[51]: DatetimeIndex(['2015-01-14', '2015-01-31', '2015-02-14', '2015-02-28'], dtype='datetime64[ns]', freq='SM-14') +``` + +### New Index methods[#](#new-index-methods "Link to this heading") + +The following methods and options are added to `Index`, to be more consistent with the `Series` and `DataFrame` API. + +`Index` now supports the `.where()` function for same shape indexing ([GH 13170](https://github.com/pandas-dev/pandas/issues/13170)) + +```None +In [48]: idx = pd.Index(["a", "b", "c"]) + +In [49]: idx.where([True, False, True]) +Out[49]: Index(['a', None, 'c'], dtype='object') +``` + +`Index` now supports `.dropna()` to exclude missing values ([GH 6194](https://github.com/pandas-dev/pandas/issues/6194)) + +```None +In [50]: idx = pd.Index([1, 2, np.nan, 4]) + +In [51]: idx.dropna() +Out[51]: Index([1.0, 2.0, 4.0], dtype='float64') +``` + +For `MultiIndex`, values are dropped if any level is missing by default. Specifying +`how='all'` only drops values where all levels are missing. + +```None +In [52]: midx = pd.MultiIndex.from_arrays([[1, 2, np.nan, 4], [1, 2, np.nan, np.nan]]) + +In [53]: midx +Out[53]: +MultiIndex([(1.0, 1.0), + (2.0, 2.0), + (nan, nan), + (4.0, nan)], + ) + +In [54]: midx.dropna() +Out[54]: +MultiIndex([(1, 1), + (2, 2)], + ) + +In [55]: midx.dropna(how="all") +Out[55]: +MultiIndex([(1, 1.0), + (2, 2.0), + (4, nan)], + ) +``` + +`Index` now supports `.str.extractall()` which returns a `DataFrame`, see the [docs here](../user_guide/text.html#text-extractall) ([GH 10008](https://github.com/pandas-dev/pandas/issues/10008), [GH 13156](https://github.com/pandas-dev/pandas/issues/13156)) + +```None +In [56]: idx = pd.Index(["a1a2", "b1", "c1"]) + +In [57]: idx.str.extractall(r"[ab](?P\d)") +Out[57]: + digit + match +0 0 1 + 1 2 +1 0 1 + +[3 rows x 1 columns] +``` + +`Index.astype()` now accepts an optional boolean argument `copy`, which allows optional copying if the requirements on dtype are satisfied ([GH 13209](https://github.com/pandas-dev/pandas/issues/13209)) + +### Google BigQuery enhancements[#](#google-bigquery-enhancements "Link to this heading") + +* The [`read_gbq()`](../reference/api/pandas.read_gbq.html#pandas.read_gbq "pandas.read_gbq") method has gained the `dialect` argument to allow users to specify whether to use BigQuery’s legacy SQL or BigQuery’s standard SQL. See the [docs](https://pandas-gbq.readthedocs.io/en/latest/reading.html) for more details ([GH 13615](https://github.com/pandas-dev/pandas/issues/13615)). +* The [`to_gbq()`](../reference/api/pandas.DataFrame.to_gbq.html#pandas.DataFrame.to_gbq "pandas.DataFrame.to_gbq") method now allows the DataFrame column order to differ from the destination table schema ([GH 11359](https://github.com/pandas-dev/pandas/issues/11359)). + +### Fine-grained NumPy errstate[#](#fine-grained-numpy-errstate "Link to this heading") + +Previous versions of pandas would permanently silence numpy’s ufunc error handling when `pandas` was imported. pandas did this in order to silence the warnings that would arise from using numpy ufuncs on missing data, which are usually represented as `NaN` s. Unfortunately, this silenced legitimate warnings arising in non-pandas code in the application. Starting with 0.19.0, pandas will use the `numpy.errstate` context manager to silence these warnings in a more fine-grained manner, only around where these operations are actually used in the pandas code base. ([GH 13109](https://github.com/pandas-dev/pandas/issues/13109), [GH 13145](https://github.com/pandas-dev/pandas/issues/13145)) + +After upgrading pandas, you may see *new* `RuntimeWarnings` being issued from your code. These are likely legitimate, and the underlying cause likely existed in the code when using previous versions of pandas that simply silenced the warning. Use [numpy.errstate](https://numpy.org/doc/stable/reference/generated/numpy.errstate.html) around the source of the `RuntimeWarning` to control how these conditions are handled. + +### Method `get_dummies` now returns integer dtypes[#](#method-get-dummies-now-returns-integer-dtypes "Link to this heading") + +The `pd.get_dummies` function now returns dummy-encoded columns as small integers, rather than floats ([GH 8725](https://github.com/pandas-dev/pandas/issues/8725)). This should provide an improved memory footprint. + +**Previous behavior**: + +```None +In [1]: pd.get_dummies(['a', 'b', 'a', 'c']).dtypes + +Out[1]: +a float64 +b float64 +c float64 +dtype: object +``` + +**New behavior**: + +```None +In [58]: pd.get_dummies(["a", "b", "a", "c"]).dtypes +Out[58]: +a bool +b bool +c bool +Length: 3, dtype: object +``` + +### Downcast values to smallest possible dtype in `to_numeric`[#](#downcast-values-to-smallest-possible-dtype-in-to-numeric "Link to this heading") + +`pd.to_numeric()` now accepts a `downcast` parameter, which will downcast the data if possible to smallest specified numerical dtype ([GH 13352](https://github.com/pandas-dev/pandas/issues/13352)) + +```None +In [59]: s = ["1", 2, 3] + +In [60]: pd.to_numeric(s, downcast="unsigned") +Out[60]: array([1, 2, 3], dtype=uint8) + +In [61]: pd.to_numeric(s, downcast="integer") +Out[61]: array([1, 2, 3], dtype=int8) +``` + +### pandas development API[#](#pandas-development-api "Link to this heading") + +As part of making pandas API more uniform and accessible in the future, we have created a standard +sub-package of pandas, `pandas.api` to hold public API’s. We are starting by exposing type +introspection functions in `pandas.api.types`. More sub-packages and officially sanctioned API’s +will be published in future versions of pandas ([GH 13147](https://github.com/pandas-dev/pandas/issues/13147), [GH 13634](https://github.com/pandas-dev/pandas/issues/13634)) + +The following are now part of this API: + +```None +In [62]: import pprint + +In [63]: from pandas.api import types + +In [64]: funcs = [f for f in dir(types) if not f.startswith("_")] + +In [65]: pprint.pprint(funcs) +['CategoricalDtype', + 'DatetimeTZDtype', + 'IntervalDtype', + 'PeriodDtype', + 'infer_dtype', + 'is_any_real_numeric_dtype', + 'is_array_like', + 'is_bool', + 'is_bool_dtype', + 'is_categorical_dtype', + 'is_complex', + 'is_complex_dtype', + 'is_datetime64_any_dtype', + 'is_datetime64_dtype', + 'is_datetime64_ns_dtype', + 'is_datetime64tz_dtype', + 'is_dict_like', + 'is_dtype_equal', + 'is_extension_array_dtype', + 'is_file_like', + 'is_float', + 'is_float_dtype', + 'is_hashable', + 'is_int64_dtype', + 'is_integer', + 'is_integer_dtype', + 'is_interval', + 'is_interval_dtype', + 'is_iterator', + 'is_list_like', + 'is_named_tuple', + 'is_number', + 'is_numeric_dtype', + 'is_object_dtype', + 'is_period_dtype', + 'is_re', + 'is_re_compilable', + 'is_scalar', + 'is_signed_integer_dtype', + 'is_sparse', + 'is_string_dtype', + 'is_timedelta64_dtype', + 'is_timedelta64_ns_dtype', + 'is_unsigned_integer_dtype', + 'pandas_dtype', + 'union_categoricals'] +``` + +Note + +Calling these functions from the internal module `pandas.core.common` will now show a `DeprecationWarning` ([GH 13990](https://github.com/pandas-dev/pandas/issues/13990)) + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* `Timestamp` can now accept positional and keyword parameters similar to `datetime.datetime()` ([GH 10758](https://github.com/pandas-dev/pandas/issues/10758), [GH 11630](https://github.com/pandas-dev/pandas/issues/11630)) + + ```None + In [66]: pd.Timestamp(2012, 1, 1) + Out[66]: Timestamp('2012-01-01 00:00:00') + + In [67]: pd.Timestamp(year=2012, month=1, day=1, hour=8, minute=30) + Out[67]: Timestamp('2012-01-01 08:30:00') + ``` +* The `.resample()` function now accepts a `on=` or `level=` parameter for resampling on a datetimelike column or `MultiIndex` level ([GH 13500](https://github.com/pandas-dev/pandas/issues/13500)) + + ```None + In [68]: df = pd.DataFrame( + ....: {"date": pd.date_range("2015-01-01", freq="W", periods=5), "a": np.arange(5)}, + ....: index=pd.MultiIndex.from_arrays( + ....: [[1, 2, 3, 4, 5], pd.date_range("2015-01-01", freq="W", periods=5)], + ....: names=["v", "d"], + ....: ), + ....: ) + ....: + + In [69]: df + Out[69]: + date a + v d + 1 2015-01-04 2015-01-04 0 + 2 2015-01-11 2015-01-11 1 + 3 2015-01-18 2015-01-18 2 + 4 2015-01-25 2015-01-25 3 + 5 2015-02-01 2015-02-01 4 + + [5 rows x 2 columns] + ``` + + ```None + In [74]: df.resample("M", on="date")[["a"]].sum() + Out[74]: + a + date + 2015-01-31 6 + 2015-02-28 4 + + [2 rows x 1 columns] + + In [75]: df.resample("M", level="d")[["a"]].sum() + Out[75]: + a + d + 2015-01-31 6 + 2015-02-28 4 + + [2 rows x 1 columns] + ``` +* The `.get_credentials()` method of `GbqConnector` can now first try to fetch [the application default credentials](https://developers.google.com/identity/protocols/application-default-credentials). See the docs for more details ([GH 13577](https://github.com/pandas-dev/pandas/issues/13577)). +* The `.tz_localize()` method of `DatetimeIndex` and `Timestamp` has gained the `errors` keyword, so you can potentially coerce nonexistent timestamps to `NaT`. The default behavior remains to raising a `NonExistentTimeError` ([GH 13057](https://github.com/pandas-dev/pandas/issues/13057)) +* `.to_hdf/read_hdf()` now accept path objects (e.g. `pathlib.Path`, `py.path.local`) for the file path ([GH 11773](https://github.com/pandas-dev/pandas/issues/11773)) +* The `pd.read_csv()` with `engine='python'` has gained support for the + `decimal` ([GH 12933](https://github.com/pandas-dev/pandas/issues/12933)), `na_filter` ([GH 13321](https://github.com/pandas-dev/pandas/issues/13321)) and the `memory_map` option ([GH 13381](https://github.com/pandas-dev/pandas/issues/13381)). +* Consistent with the Python API, `pd.read_csv()` will now interpret `+inf` as positive infinity ([GH 13274](https://github.com/pandas-dev/pandas/issues/13274)) +* The `pd.read_html()` has gained support for the `na_values`, `converters`, `keep_default_na` options ([GH 13461](https://github.com/pandas-dev/pandas/issues/13461)) +* `Categorical.astype()` now accepts an optional boolean argument `copy`, effective when dtype is categorical ([GH 13209](https://github.com/pandas-dev/pandas/issues/13209)) +* `DataFrame` has gained the `.asof()` method to return the last non-NaN values according to the selected subset ([GH 13358](https://github.com/pandas-dev/pandas/issues/13358)) +* The `DataFrame` constructor will now respect key ordering if a list of `OrderedDict` objects are passed in ([GH 13304](https://github.com/pandas-dev/pandas/issues/13304)) +* `pd.read_html()` has gained support for the `decimal` option ([GH 12907](https://github.com/pandas-dev/pandas/issues/12907)) +* `Series` has gained the properties `.is_monotonic`, `.is_monotonic_increasing`, `.is_monotonic_decreasing`, similar to `Index` ([GH 13336](https://github.com/pandas-dev/pandas/issues/13336)) +* `DataFrame.to_sql()` now allows a single value as the SQL type for all columns ([GH 11886](https://github.com/pandas-dev/pandas/issues/11886)). +* `Series.append` now supports the `ignore_index` option ([GH 13677](https://github.com/pandas-dev/pandas/issues/13677)) +* `.to_stata()` and `StataWriter` can now write variable labels to Stata dta files using a dictionary to make column names to labels ([GH 13535](https://github.com/pandas-dev/pandas/issues/13535), [GH 13536](https://github.com/pandas-dev/pandas/issues/13536)) +* `.to_stata()` and `StataWriter` will automatically convert `datetime64[ns]` columns to Stata format `%tc`, rather than raising a `ValueError` ([GH 12259](https://github.com/pandas-dev/pandas/issues/12259)) +* `read_stata()` and `StataReader` raise with a more explicit error message when reading Stata files with repeated value labels when `convert_categoricals=True` ([GH 13923](https://github.com/pandas-dev/pandas/issues/13923)) +* `DataFrame.style` will now render sparsified MultiIndexes ([GH 11655](https://github.com/pandas-dev/pandas/issues/11655)) +* `DataFrame.style` will now show column level names (e.g. `DataFrame.columns.names`) ([GH 13775](https://github.com/pandas-dev/pandas/issues/13775)) +* `DataFrame` has gained support to re-order the columns based on the values + in a row using `df.sort_values(by='...', axis=1)` ([GH 10806](https://github.com/pandas-dev/pandas/issues/10806)) + + ```None + In [70]: df = pd.DataFrame({"A": [2, 7], "B": [3, 5], "C": [4, 8]}, index=["row1", "row2"]) + + In [71]: df + Out[71]: + A B C + row1 2 3 4 + row2 7 5 8 + + [2 rows x 3 columns] + + In [72]: df.sort_values(by="row2", axis=1) + Out[72]: + B A C + row1 3 2 4 + row2 5 7 8 + + [2 rows x 3 columns] + ``` +* Added documentation to [I/O](../user_guide/io.html#io-dtypes) regarding the perils of reading in columns with mixed dtypes and how to handle it ([GH 13746](https://github.com/pandas-dev/pandas/issues/13746)) +* [`to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") now has a `border` argument to control the value in the opening `` tag. The default is the value of the `html.border` option, which defaults to 1. This also affects the notebook HTML repr, but since Jupyter’s CSS includes a border-width attribute, the visual effect is the same. ([GH 11563](https://github.com/pandas-dev/pandas/issues/11563)). +* Raise `ImportError` in the sql functions when `sqlalchemy` is not installed and a connection string is used ([GH 11920](https://github.com/pandas-dev/pandas/issues/11920)). +* Compatibility with matplotlib 2.0. Older versions of pandas should also work with matplotlib 2.0 ([GH 13333](https://github.com/pandas-dev/pandas/issues/13333)) +* `Timestamp`, `Period`, `DatetimeIndex`, `PeriodIndex` and `.dt` accessor have gained a `.is_leap_year` property to check whether the date belongs to a leap year. ([GH 13727](https://github.com/pandas-dev/pandas/issues/13727)) +* `astype()` will now accept a dict of column name to data types mapping as the `dtype` argument. ([GH 12086](https://github.com/pandas-dev/pandas/issues/12086)) +* The `pd.read_json` and `DataFrame.to_json` has gained support for reading and writing json lines with `lines` option see [Line delimited json](../user_guide/io.html#io-jsonl) ([GH 9180](https://github.com/pandas-dev/pandas/issues/9180)) +* [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") now supports the true\_values and false\_values keyword arguments ([GH 13347](https://github.com/pandas-dev/pandas/issues/13347)) +* `groupby()` will now accept a scalar and a single-element list for specifying `level` on a non-`MultiIndex` grouper. ([GH 13907](https://github.com/pandas-dev/pandas/issues/13907)) +* Non-convertible dates in an excel date column will be returned without conversion and the column will be `object` dtype, rather than raising an exception ([GH 10001](https://github.com/pandas-dev/pandas/issues/10001)). +* `pd.Timedelta(None)` is now accepted and will return `NaT`, mirroring `pd.Timestamp` ([GH 13687](https://github.com/pandas-dev/pandas/issues/13687)) +* `pd.read_stata()` can now handle some format 111 files, which are produced by SAS when generating Stata dta files ([GH 11526](https://github.com/pandas-dev/pandas/issues/11526)) +* `Series` and `Index` now support `divmod` which will return a tuple of + series or indices. This behaves like a standard binary operator with regards + to broadcasting rules ([GH 14208](https://github.com/pandas-dev/pandas/issues/14208)). + +## API changes[#](#api-changes "Link to this heading") + +### `Series.tolist()` will now return Python types[#](#series-tolist-will-now-return-python-types "Link to this heading") + +`Series.tolist()` will now return Python types in the output, mimicking NumPy `.tolist()` behavior ([GH 10904](https://github.com/pandas-dev/pandas/issues/10904)) + +```None +In [73]: s = pd.Series([1, 2, 3]) +``` + +**Previous behavior**: + +```None +In [7]: type(s.tolist()[0]) +Out[7]: + +``` + +**New behavior**: + +```None +In [74]: type(s.tolist()[0]) +Out[74]: int +``` + +### `Series` operators for different indexes[#](#series-operators-for-different-indexes "Link to this heading") + +Following `Series` operators have been changed to make all operators consistent, +including `DataFrame` ([GH 1134](https://github.com/pandas-dev/pandas/issues/1134), [GH 4581](https://github.com/pandas-dev/pandas/issues/4581), [GH 13538](https://github.com/pandas-dev/pandas/issues/13538)) + +* `Series` comparison operators now raise `ValueError` when `index` are different. +* `Series` logical operators align both `index` of left and right hand side. + +Warning + +Until 0.18.1, comparing `Series` with the same length, would succeed even if +the `.index` are different (the result ignores `.index`). As of 0.19.0, this will raises `ValueError` to be more strict. This section also describes how to keep previous behavior or align different indexes, using the flexible comparison methods like `.eq`. + +As a result, `Series` and `DataFrame` operators behave as below: + +#### Arithmetic operators[#](#arithmetic-operators "Link to this heading") + +Arithmetic operators align both `index` (no changes). + +```None +In [75]: s1 = pd.Series([1, 2, 3], index=list("ABC")) + +In [76]: s2 = pd.Series([2, 2, 2], index=list("ABD")) + +In [77]: s1 + s2 +Out[77]: +A 3.0 +B 4.0 +C NaN +D NaN +Length: 4, dtype: float64 + +In [78]: df1 = pd.DataFrame([1, 2, 3], index=list("ABC")) + +In [79]: df2 = pd.DataFrame([2, 2, 2], index=list("ABD")) + +In [80]: df1 + df2 +Out[80]: + 0 +A 3.0 +B 4.0 +C NaN +D NaN + +[4 rows x 1 columns] +``` + +#### Comparison operators[#](#comparison-operators "Link to this heading") + +Comparison operators raise `ValueError` when `.index` are different. + +**Previous behavior** (`Series`): + +`Series` compared values ignoring the `.index` as long as both had the same length: + +```None +In [1]: s1 == s2 +Out[1]: +A False +B True +C False +dtype: bool +``` + +**New behavior** (`Series`): + +```None +In [2]: s1 == s2 +Out[2]: +ValueError: Can only compare identically-labeled Series objects +``` + +Note + +To achieve the same result as previous versions (compare values based on locations ignoring `.index`), compare both `.values`. + +```None +In [81]: s1.values == s2.values +Out[81]: array([False, True, False]) +``` + +If you want to compare `Series` aligning its `.index`, see flexible comparison methods section below: + +```None +In [82]: s1.eq(s2) +Out[82]: +A False +B True +C False +D False +Length: 4, dtype: bool +``` + +**Current behavior** (`DataFrame`, no change): + +```None +In [3]: df1 == df2 +Out[3]: +ValueError: Can only compare identically-labeled DataFrame objects +``` + +#### Logical operators[#](#logical-operators "Link to this heading") + +Logical operators align both `.index` of left and right hand side. + +**Previous behavior** (`Series`), only left hand side `index` was kept: + +```None +In [4]: s1 = pd.Series([True, False, True], index=list('ABC')) +In [5]: s2 = pd.Series([True, True, True], index=list('ABD')) +In [6]: s1 & s2 +Out[6]: +A True +B False +C False +dtype: bool +``` + +**New behavior** (`Series`): + +```None +In [83]: s1 = pd.Series([True, False, True], index=list("ABC")) + +In [84]: s2 = pd.Series([True, True, True], index=list("ABD")) + +In [85]: s1 & s2 +Out[85]: +A True +B False +C False +D False +Length: 4, dtype: bool +``` + +Note + +`Series` logical operators fill a `NaN` result with `False`. + +Note + +To achieve the same result as previous versions (compare values based on only left hand side index), you can use `reindex_like`: + +```None +In [86]: s1 & s2.reindex_like(s1) +Out[86]: +A True +B False +C False +Length: 3, dtype: bool +``` + +**Current behavior** (`DataFrame`, no change): + +```None +In [87]: df1 = pd.DataFrame([True, False, True], index=list("ABC")) + +In [88]: df2 = pd.DataFrame([True, True, True], index=list("ABD")) + +In [89]: df1 & df2 +Out[89]: + 0 +A True +B False +C False +D False + +[4 rows x 1 columns] +``` + +#### Flexible comparison methods[#](#flexible-comparison-methods "Link to this heading") + +`Series` flexible comparison methods like `eq`, `ne`, `le`, `lt`, `ge` and `gt` now align both `index`. Use these operators if you want to compare two `Series` +which has the different `index`. + +```None +In [90]: s1 = pd.Series([1, 2, 3], index=["a", "b", "c"]) + +In [91]: s2 = pd.Series([2, 2, 2], index=["b", "c", "d"]) + +In [92]: s1.eq(s2) +Out[92]: +a False +b True +c False +d False +Length: 4, dtype: bool + +In [93]: s1.ge(s2) +Out[93]: +a False +b True +c True +d False +Length: 4, dtype: bool +``` + +Previously, this worked the same as comparison operators (see above). + +### `Series` type promotion on assignment[#](#series-type-promotion-on-assignment "Link to this heading") + +A `Series` will now correctly promote its dtype for assignment with incompat values to the current dtype ([GH 13234](https://github.com/pandas-dev/pandas/issues/13234)) + +```None +In [94]: s = pd.Series() +``` + +**Previous behavior**: + +```None +In [2]: s["a"] = pd.Timestamp("2016-01-01") + +In [3]: s["b"] = 3.0 +TypeError: invalid type promotion +``` + +**New behavior**: + +```None +In [95]: s["a"] = pd.Timestamp("2016-01-01") + +In [96]: s["b"] = 3.0 + +In [97]: s +Out[97]: +a 2016-01-01 00:00:00 +b 3.0 +Length: 2, dtype: object + +In [98]: s.dtype +Out[98]: dtype('O') +``` + +### Function `.to_datetime()` changes[#](#function-to-datetime-changes "Link to this heading") + +Previously if `.to_datetime()` encountered mixed integers/floats and strings, but no datetimes with `errors='coerce'` it would convert all to `NaT`. + +**Previous behavior**: + +```None +In [2]: pd.to_datetime([1, 'foo'], errors='coerce') +Out[2]: DatetimeIndex(['NaT', 'NaT'], dtype='datetime64[ns]', freq=None) +``` + +**Current behavior**: + +This will now convert integers/floats with the default unit of `ns`. + +```None +In [99]: pd.to_datetime([1, "foo"], errors="coerce") +Out[99]: DatetimeIndex(['1970-01-01 00:00:00.000000001', 'NaT'], dtype='datetime64[ns]', freq=None) +``` + +Bug fixes related to `.to_datetime()`: + +* Bug in `pd.to_datetime()` when passing integers or floats, and no `unit` and `errors='coerce'` ([GH 13180](https://github.com/pandas-dev/pandas/issues/13180)). +* Bug in `pd.to_datetime()` when passing invalid data types (e.g. bool); will now respect the `errors` keyword ([GH 13176](https://github.com/pandas-dev/pandas/issues/13176)) +* Bug in `pd.to_datetime()` which overflowed on `int8`, and `int16` dtypes ([GH 13451](https://github.com/pandas-dev/pandas/issues/13451)) +* Bug in `pd.to_datetime()` raise `AttributeError` with `NaN` and the other string is not valid when `errors='ignore'` ([GH 12424](https://github.com/pandas-dev/pandas/issues/12424)) +* Bug in `pd.to_datetime()` did not cast floats correctly when `unit` was specified, resulting in truncated datetime ([GH 13834](https://github.com/pandas-dev/pandas/issues/13834)) + +### Merging changes[#](#merging-changes "Link to this heading") + +Merging will now preserve the dtype of the join keys ([GH 8596](https://github.com/pandas-dev/pandas/issues/8596)) + +```None +In [100]: df1 = pd.DataFrame({"key": [1], "v1": [10]}) + +In [101]: df1 +Out[101]: + key v1 +0 1 10 + +[1 rows x 2 columns] + +In [102]: df2 = pd.DataFrame({"key": [1, 2], "v1": [20, 30]}) + +In [103]: df2 +Out[103]: + key v1 +0 1 20 +1 2 30 + +[2 rows x 2 columns] +``` + +**Previous behavior**: + +```None +In [5]: pd.merge(df1, df2, how='outer') +Out[5]: + key v1 +0 1.0 10.0 +1 1.0 20.0 +2 2.0 30.0 + +In [6]: pd.merge(df1, df2, how='outer').dtypes +Out[6]: +key float64 +v1 float64 +dtype: object +``` + +**New behavior**: + +We are able to preserve the join keys + +```None +In [104]: pd.merge(df1, df2, how="outer") +Out[104]: + key v1 +0 1 10 +1 1 20 +2 2 30 + +[3 rows x 2 columns] + +In [105]: pd.merge(df1, df2, how="outer").dtypes +Out[105]: +key int64 +v1 int64 +Length: 2, dtype: object +``` + +Of course if you have missing values that are introduced, then the +resulting dtype will be upcast, which is unchanged from previous. + +```None +In [106]: pd.merge(df1, df2, how="outer", on="key") +Out[106]: + key v1_x v1_y +0 1 10.0 20 +1 2 NaN 30 + +[2 rows x 3 columns] + +In [107]: pd.merge(df1, df2, how="outer", on="key").dtypes +Out[107]: +key int64 +v1_x float64 +v1_y int64 +Length: 3, dtype: object +``` + +### Method `.describe()` changes[#](#method-describe-changes "Link to this heading") + +Percentile identifiers in the index of a `.describe()` output will now be rounded to the least precision that keeps them distinct ([GH 13104](https://github.com/pandas-dev/pandas/issues/13104)) + +```None +In [108]: s = pd.Series([0, 1, 2, 3, 4]) + +In [109]: df = pd.DataFrame([0, 1, 2, 3, 4]) +``` + +**Previous behavior**: + +The percentiles were rounded to at most one decimal place, which could raise `ValueError` for a data frame if the percentiles were duplicated. + +```None +In [3]: s.describe(percentiles=[0.0001, 0.0005, 0.001, 0.999, 0.9995, 0.9999]) +Out[3]: +count 5.000000 +mean 2.000000 +std 1.581139 +min 0.000000 +0.0% 0.000400 +0.1% 0.002000 +0.1% 0.004000 +50% 2.000000 +99.9% 3.996000 +100.0% 3.998000 +100.0% 3.999600 +max 4.000000 +dtype: float64 + +In [4]: df.describe(percentiles=[0.0001, 0.0005, 0.001, 0.999, 0.9995, 0.9999]) +Out[4]: +... +ValueError: cannot reindex from a duplicate axis +``` + +**New behavior**: + +```None +In [110]: s.describe(percentiles=[0.0001, 0.0005, 0.001, 0.999, 0.9995, 0.9999]) +Out[110]: +count 5.000000 +mean 2.000000 +std 1.581139 +min 0.000000 +0.01% 0.000400 +0.05% 0.002000 +0.1% 0.004000 +50% 2.000000 +99.9% 3.996000 +99.95% 3.998000 +99.99% 3.999600 +max 4.000000 +Length: 12, dtype: float64 + +In [111]: df.describe(percentiles=[0.0001, 0.0005, 0.001, 0.999, 0.9995, 0.9999]) +Out[111]: + 0 +count 5.000000 +mean 2.000000 +std 1.581139 +min 0.000000 +0.01% 0.000400 +0.05% 0.002000 +0.1% 0.004000 +50% 2.000000 +99.9% 3.996000 +99.95% 3.998000 +99.99% 3.999600 +max 4.000000 + +[12 rows x 1 columns] +``` + +Furthermore: + +* Passing duplicated `percentiles` will now raise a `ValueError`. +* Bug in `.describe()` on a DataFrame with a mixed-dtype column index, which would previously raise a `TypeError` ([GH 13288](https://github.com/pandas-dev/pandas/issues/13288)) + +### `Period` changes[#](#period-changes "Link to this heading") + +#### The `PeriodIndex` now has `period` dtype[#](#the-periodindex-now-has-period-dtype "Link to this heading") + +`PeriodIndex` now has its own `period` dtype. The `period` dtype is a +pandas extension dtype like `category` or the [timezone aware dtype](../user_guide/timeseries.html#timeseries-timezone-series) (`datetime64[ns, tz]`) ([GH 13941](https://github.com/pandas-dev/pandas/issues/13941)). +As a consequence of this change, `PeriodIndex` no longer has an integer dtype: + +**Previous behavior**: + +```None +In [1]: pi = pd.PeriodIndex(['2016-08-01'], freq='D') + +In [2]: pi +Out[2]: PeriodIndex(['2016-08-01'], dtype='int64', freq='D') + +In [3]: pd.api.types.is_integer_dtype(pi) +Out[3]: True + +In [4]: pi.dtype +Out[4]: dtype('int64') +``` + +**New behavior**: + +```None +In [112]: pi = pd.PeriodIndex(["2016-08-01"], freq="D") + +In [113]: pi +Out[113]: PeriodIndex(['2016-08-01'], dtype='period[D]') + +In [114]: pd.api.types.is_integer_dtype(pi) +Out[114]: False + +In [115]: pd.api.types.is_period_dtype(pi) +Out[115]: True + +In [116]: pi.dtype +Out[116]: period[D] + +In [117]: type(pi.dtype) +Out[117]: pandas.core.dtypes.dtypes.PeriodDtype +``` + +#### `Period('NaT')` now returns `pd.NaT`[#](#period-nat-now-returns-pd-nat "Link to this heading") + +Previously, `Period` has its own `Period('NaT')` representation different from `pd.NaT`. Now `Period('NaT')` has been changed to return `pd.NaT`. ([GH 12759](https://github.com/pandas-dev/pandas/issues/12759), [GH 13582](https://github.com/pandas-dev/pandas/issues/13582)) + +**Previous behavior**: + +```None +In [5]: pd.Period('NaT', freq='D') +Out[5]: Period('NaT', 'D') +``` + +**New behavior**: + +These result in `pd.NaT` without providing `freq` option. + +```None +In [118]: pd.Period("NaT") +Out[118]: NaT + +In [119]: pd.Period(None) +Out[119]: NaT +``` + +To be compatible with `Period` addition and subtraction, `pd.NaT` now supports addition and subtraction with `int`. Previously it raised `ValueError`. + +**Previous behavior**: + +```None +In [5]: pd.NaT + 1 +... +ValueError: Cannot add integral value to Timestamp without freq. +``` + +**New behavior**: + +```None +In [120]: pd.NaT + 1 +Out[120]: NaT + +In [121]: pd.NaT - 1 +Out[121]: NaT +``` + +#### `PeriodIndex.values` now returns array of `Period` object[#](#periodindex-values-now-returns-array-of-period-object "Link to this heading") + +`.values` is changed to return an array of `Period` objects, rather than an array +of integers ([GH 13988](https://github.com/pandas-dev/pandas/issues/13988)). + +**Previous behavior**: + +```None +In [6]: pi = pd.PeriodIndex(['2011-01', '2011-02'], freq='M') +In [7]: pi.values +Out[7]: array([492, 493]) +``` + +**New behavior**: + +```None +In [122]: pi = pd.PeriodIndex(["2011-01", "2011-02"], freq="M") + +In [123]: pi.values +Out[123]: array([Period('2011-01', 'M'), Period('2011-02', 'M')], dtype=object) +``` + +### Index `+` / `-` no longer used for set operations[#](#index-no-longer-used-for-set-operations "Link to this heading") + +Addition and subtraction of the base Index type and of DatetimeIndex +(not the numeric index types) +previously performed set operations (set union and difference). This +behavior was already deprecated since 0.15.0 (in favor using the specific +`.union()` and `.difference()` methods), and is now disabled. When +possible, `+` and `-` are now used for element-wise operations, for +example for concatenating strings or subtracting datetimes +([GH 8227](https://github.com/pandas-dev/pandas/issues/8227), [GH 14127](https://github.com/pandas-dev/pandas/issues/14127)). + +Previous behavior: + +```None +In [1]: pd.Index(['a', 'b']) + pd.Index(['a', 'c']) +FutureWarning: using '+' to provide set union with Indexes is deprecated, use '|' or .union() +Out[1]: Index(['a', 'b', 'c'], dtype='object') +``` + +**New behavior**: the same operation will now perform element-wise addition: + +```None +In [124]: pd.Index(["a", "b"]) + pd.Index(["a", "c"]) +Out[124]: Index(['aa', 'bc'], dtype='object') +``` + +Note that numeric Index objects already performed element-wise operations. +For example, the behavior of adding two integer Indexes is unchanged. +The base `Index` is now made consistent with this behavior. + +```None +In [125]: pd.Index([1, 2, 3]) + pd.Index([2, 3, 4]) +Out[125]: Index([3, 5, 7], dtype='int64') +``` + +Further, because of this change, it is now possible to subtract two +DatetimeIndex objects resulting in a TimedeltaIndex: + +**Previous behavior**: + +```None +In [1]: (pd.DatetimeIndex(['2016-01-01', '2016-01-02']) + ...: - pd.DatetimeIndex(['2016-01-02', '2016-01-03'])) +FutureWarning: using '-' to provide set differences with datetimelike Indexes is deprecated, use .difference() +Out[1]: DatetimeIndex(['2016-01-01'], dtype='datetime64[ns]', freq=None) +``` + +**New behavior**: + +```None +In [126]: ( + .....: pd.DatetimeIndex(["2016-01-01", "2016-01-02"]) + .....: - pd.DatetimeIndex(["2016-01-02", "2016-01-03"]) + .....: ) + .....: +Out[126]: TimedeltaIndex(['-1 days', '-1 days'], dtype='timedelta64[ns]', freq=None) +``` + +### `Index.difference` and `.symmetric_difference` changes[#](#index-difference-and-symmetric-difference-changes "Link to this heading") + +`Index.difference` and `Index.symmetric_difference` will now, more consistently, treat `NaN` values as any other values. ([GH 13514](https://github.com/pandas-dev/pandas/issues/13514)) + +```None +In [127]: idx1 = pd.Index([1, 2, 3, np.nan]) + +In [128]: idx2 = pd.Index([0, 1, np.nan]) +``` + +**Previous behavior**: + +```None +In [3]: idx1.difference(idx2) +Out[3]: Float64Index([nan, 2.0, 3.0], dtype='float64') + +In [4]: idx1.symmetric_difference(idx2) +Out[4]: Float64Index([0.0, nan, 2.0, 3.0], dtype='float64') +``` + +**New behavior**: + +```None +In [129]: idx1.difference(idx2) +Out[129]: Index([2.0, 3.0], dtype='float64') + +In [130]: idx1.symmetric_difference(idx2) +Out[130]: Index([0.0, 2.0, 3.0], dtype='float64') +``` + +### `Index.unique` consistently returns `Index`[#](#index-unique-consistently-returns-index "Link to this heading") + +`Index.unique()` now returns unique values as an +`Index` of the appropriate `dtype`. ([GH 13395](https://github.com/pandas-dev/pandas/issues/13395)). +Previously, most `Index` classes returned `np.ndarray`, and `DatetimeIndex`, +`TimedeltaIndex` and `PeriodIndex` returned `Index` to keep metadata like timezone. + +**Previous behavior**: + +```None +In [1]: pd.Index([1, 2, 3]).unique() +Out[1]: array([1, 2, 3]) + +In [2]: pd.DatetimeIndex(['2011-01-01', '2011-01-02', + ...: '2011-01-03'], tz='Asia/Tokyo').unique() +Out[2]: +DatetimeIndex(['2011-01-01 00:00:00+09:00', '2011-01-02 00:00:00+09:00', + '2011-01-03 00:00:00+09:00'], + dtype='datetime64[ns, Asia/Tokyo]', freq=None) +``` + +**New behavior**: + +```None +In [131]: pd.Index([1, 2, 3]).unique() +Out[131]: Index([1, 2, 3], dtype='int64') + +In [132]: pd.DatetimeIndex( + .....: ["2011-01-01", "2011-01-02", "2011-01-03"], tz="Asia/Tokyo" + .....: ).unique() + .....: +Out[132]: +DatetimeIndex(['2011-01-01 00:00:00+09:00', '2011-01-02 00:00:00+09:00', + '2011-01-03 00:00:00+09:00'], + dtype='datetime64[ns, Asia/Tokyo]', freq=None) +``` + +### `MultiIndex` constructors, `groupby` and `set_index` preserve categorical dtypes[#](#multiindex-constructors-groupby-and-set-index-preserve-categorical-dtypes "Link to this heading") + +`MultiIndex.from_arrays` and `MultiIndex.from_product` will now preserve categorical dtype +in `MultiIndex` levels ([GH 13743](https://github.com/pandas-dev/pandas/issues/13743), [GH 13854](https://github.com/pandas-dev/pandas/issues/13854)). + +```None +In [133]: cat = pd.Categorical(["a", "b"], categories=list("bac")) + +In [134]: lvl1 = ["foo", "bar"] + +In [135]: midx = pd.MultiIndex.from_arrays([cat, lvl1]) + +In [136]: midx +Out[136]: +MultiIndex([('a', 'foo'), + ('b', 'bar')], + ) +``` + +**Previous behavior**: + +```None +In [4]: midx.levels[0] +Out[4]: Index(['b', 'a', 'c'], dtype='object') + +In [5]: midx.get_level_values[0] +Out[5]: Index(['a', 'b'], dtype='object') +``` + +**New behavior**: the single level is now a `CategoricalIndex`: + +```None +In [137]: midx.levels[0] +Out[137]: CategoricalIndex(['b', 'a', 'c'], categories=['b', 'a', 'c'], ordered=False, dtype='category') + +In [138]: midx.get_level_values(0) +Out[138]: CategoricalIndex(['a', 'b'], categories=['b', 'a', 'c'], ordered=False, dtype='category') +``` + +An analogous change has been made to `MultiIndex.from_product`. +As a consequence, `groupby` and `set_index` also preserve categorical dtypes in indexes + +```None +In [139]: df = pd.DataFrame({"A": [0, 1], "B": [10, 11], "C": cat}) + +In [140]: df_grouped = df.groupby(by=["A", "C"], observed=False).first() + +In [141]: df_set_idx = df.set_index(["A", "C"]) +``` + +**Previous behavior**: + +```None +In [11]: df_grouped.index.levels[1] +Out[11]: Index(['b', 'a', 'c'], dtype='object', name='C') +In [12]: df_grouped.reset_index().dtypes +Out[12]: +A int64 +C object +B float64 +dtype: object + +In [13]: df_set_idx.index.levels[1] +Out[13]: Index(['b', 'a', 'c'], dtype='object', name='C') +In [14]: df_set_idx.reset_index().dtypes +Out[14]: +A int64 +C object +B int64 +dtype: object +``` + +**New behavior**: + +```None +In [142]: df_grouped.index.levels[1] +Out[142]: CategoricalIndex(['b', 'a', 'c'], categories=['b', 'a', 'c'], ordered=False, dtype='category', name='C') + +In [143]: df_grouped.reset_index().dtypes +Out[143]: +A int64 +C category +B float64 +Length: 3, dtype: object + +In [144]: df_set_idx.index.levels[1] +Out[144]: CategoricalIndex(['b', 'a', 'c'], categories=['b', 'a', 'c'], ordered=False, dtype='category', name='C') + +In [145]: df_set_idx.reset_index().dtypes +Out[145]: +A int64 +C category +B int64 +Length: 3, dtype: object +``` + +### Function `read_csv` will progressively enumerate chunks[#](#function-read-csv-will-progressively-enumerate-chunks "Link to this heading") + +When [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") is called with `chunksize=n` and without specifying an index, +each chunk used to have an independently generated index from `0` to `n-1`. +They are now given instead a progressive index, starting from `0` for the first chunk, +from `n` for the second, and so on, so that, when concatenated, they are identical to +the result of calling [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") without the `chunksize=` argument +([GH 12185](https://github.com/pandas-dev/pandas/issues/12185)). + +```None +In [146]: data = "A,B\n0,1\n2,3\n4,5\n6,7" +``` + +**Previous behavior**: + +```None +In [2]: pd.concat(pd.read_csv(StringIO(data), chunksize=2)) +Out[2]: + A B +0 0 1 +1 2 3 +0 4 5 +1 6 7 +``` + +**New behavior**: + +```None +In [147]: pd.concat(pd.read_csv(StringIO(data), chunksize=2)) +Out[147]: + A B +0 0 1 +1 2 3 +2 4 5 +3 6 7 + +[4 rows x 2 columns] +``` + +### Sparse changes[#](#sparse-changes "Link to this heading") + +These changes allow pandas to handle sparse data with more dtypes, and for work to make a smoother experience with data handling. + +#### Types `int64` and `bool` support enhancements[#](#types-int64-and-bool-support-enhancements "Link to this heading") + +Sparse data structures now gained enhanced support of `int64` and `bool` `dtype` ([GH 667](https://github.com/pandas-dev/pandas/issues/667), [GH 13849](https://github.com/pandas-dev/pandas/issues/13849)). + +Previously, sparse data were `float64` dtype by default, even if all inputs were of `int` or `bool` dtype. You had to specify `dtype` explicitly to create sparse data with `int64` dtype. Also, `fill_value` had to be specified explicitly because the default was `np.nan` which doesn’t appear in `int64` or `bool` data. + +```None +In [1]: pd.SparseArray([1, 2, 0, 0]) +Out[1]: +[1.0, 2.0, 0.0, 0.0] +Fill: nan +IntIndex +Indices: array([0, 1, 2, 3], dtype=int32) + +# specifying int64 dtype, but all values are stored in sp_values because +# fill_value default is np.nan +In [2]: pd.SparseArray([1, 2, 0, 0], dtype=np.int64) +Out[2]: +[1, 2, 0, 0] +Fill: nan +IntIndex +Indices: array([0, 1, 2, 3], dtype=int32) + +In [3]: pd.SparseArray([1, 2, 0, 0], dtype=np.int64, fill_value=0) +Out[3]: +[1, 2, 0, 0] +Fill: 0 +IntIndex +Indices: array([0, 1], dtype=int32) +``` + +As of v0.19.0, sparse data keeps the input dtype, and uses more appropriate `fill_value` defaults (`0` for `int64` dtype, `False` for `bool` dtype). + +```None +In [148]: pd.arrays.SparseArray([1, 2, 0, 0], dtype=np.int64) +Out[148]: +[1, 2, 0, 0] +Fill: 0 +IntIndex +Indices: array([0, 1], dtype=int32) + +In [149]: pd.arrays.SparseArray([True, False, False, False]) +Out[149]: +[True, False, False, False] +Fill: False +IntIndex +Indices: array([0], dtype=int32) +``` + +See the [docs](../user_guide/sparse.html#sparse-dtype) for more details. + +#### Operators now preserve dtypes[#](#operators-now-preserve-dtypes "Link to this heading") + +* Sparse data structure now can preserve `dtype` after arithmetic ops ([GH 13848](https://github.com/pandas-dev/pandas/issues/13848)) + +```None +s = pd.SparseSeries([0, 2, 0, 1], fill_value=0, dtype=np.int64) +s.dtype + +s + 1 +``` + +* Sparse data structure now support `astype` to convert internal `dtype` ([GH 13900](https://github.com/pandas-dev/pandas/issues/13900)) + +```None +s = pd.SparseSeries([1.0, 0.0, 2.0, 0.0], fill_value=0) +s +s.astype(np.int64) +``` + +`astype` fails if data contains values which cannot be converted to specified `dtype`. +Note that the limitation is applied to `fill_value` which default is `np.nan`. + +```None +In [7]: pd.SparseSeries([1., np.nan, 2., np.nan], fill_value=np.nan).astype(np.int64) +Out[7]: +ValueError: unable to coerce current fill_value nan to int64 dtype +``` + +#### Other sparse fixes[#](#other-sparse-fixes "Link to this heading") + +* Subclassed `SparseDataFrame` and `SparseSeries` now preserve class types when slicing or transposing. ([GH 13787](https://github.com/pandas-dev/pandas/issues/13787)) +* `SparseArray` with `bool` dtype now supports logical (bool) operators ([GH 14000](https://github.com/pandas-dev/pandas/issues/14000)) +* Bug in `SparseSeries` with `MultiIndex` `[]` indexing may raise `IndexError` ([GH 13144](https://github.com/pandas-dev/pandas/issues/13144)) +* Bug in `SparseSeries` with `MultiIndex` `[]` indexing result may have normal `Index` ([GH 13144](https://github.com/pandas-dev/pandas/issues/13144)) +* Bug in `SparseDataFrame` in which `axis=None` did not default to `axis=0` ([GH 13048](https://github.com/pandas-dev/pandas/issues/13048)) +* Bug in `SparseSeries` and `SparseDataFrame` creation with `object` dtype may raise `TypeError` ([GH 11633](https://github.com/pandas-dev/pandas/issues/11633)) +* Bug in `SparseDataFrame` doesn’t respect passed `SparseArray` or `SparseSeries` ‘s dtype and `fill_value` ([GH 13866](https://github.com/pandas-dev/pandas/issues/13866)) +* Bug in `SparseArray` and `SparseSeries` don’t apply ufunc to `fill_value` ([GH 13853](https://github.com/pandas-dev/pandas/issues/13853)) +* Bug in `SparseSeries.abs` incorrectly keeps negative `fill_value` ([GH 13853](https://github.com/pandas-dev/pandas/issues/13853)) +* Bug in single row slicing on multi-type `SparseDataFrame` s, types were previously forced to float ([GH 13917](https://github.com/pandas-dev/pandas/issues/13917)) +* Bug in `SparseSeries` slicing changes integer dtype to float ([GH 8292](https://github.com/pandas-dev/pandas/issues/8292)) +* Bug in `SparseDataFarme` comparison ops may raise `TypeError` ([GH 13001](https://github.com/pandas-dev/pandas/issues/13001)) +* Bug in `SparseDataFarme.isnull` raises `ValueError` ([GH 8276](https://github.com/pandas-dev/pandas/issues/8276)) +* Bug in `SparseSeries` representation with `bool` dtype may raise `IndexError` ([GH 13110](https://github.com/pandas-dev/pandas/issues/13110)) +* Bug in `SparseSeries` and `SparseDataFrame` of `bool` or `int64` dtype may display its values like `float64` dtype ([GH 13110](https://github.com/pandas-dev/pandas/issues/13110)) +* Bug in sparse indexing using `SparseArray` with `bool` dtype may return incorrect result ([GH 13985](https://github.com/pandas-dev/pandas/issues/13985)) +* Bug in `SparseArray` created from `SparseSeries` may lose `dtype` ([GH 13999](https://github.com/pandas-dev/pandas/issues/13999)) +* Bug in `SparseSeries` comparison with dense returns normal `Series` rather than `SparseSeries` ([GH 13999](https://github.com/pandas-dev/pandas/issues/13999)) + +### Indexer dtype changes[#](#indexer-dtype-changes "Link to this heading") + +Note + +This change only affects 64 bit python running on Windows, and only affects relatively advanced +indexing operations + +Methods such as `Index.get_indexer` that return an indexer array, coerce that array to a “platform int”, so that it can be +directly used in 3rd party library operations like `numpy.take`. Previously, a platform int was defined as `np.int_` +which corresponds to a C integer, but the correct type, and what is being used now, is `np.intp`, which corresponds +to the C integer size that can hold a pointer ([GH 3033](https://github.com/pandas-dev/pandas/issues/3033), [GH 13972](https://github.com/pandas-dev/pandas/issues/13972)). + +These types are the same on many platform, but for 64 bit python on Windows, +`np.int_` is 32 bits, and `np.intp` is 64 bits. Changing this behavior improves performance for many +operations on that platform. + +**Previous behavior**: + +```None +In [1]: i = pd.Index(['a', 'b', 'c']) + +In [2]: i.get_indexer(['b', 'b', 'c']).dtype +Out[2]: dtype('int32') +``` + +**New behavior**: + +```None +In [1]: i = pd.Index(['a', 'b', 'c']) + +In [2]: i.get_indexer(['b', 'b', 'c']).dtype +Out[2]: dtype('int64') +``` + +### Other API changes[#](#other-api-changes "Link to this heading") + +* `Timestamp.to_pydatetime` will issue a `UserWarning` when `warn=True`, and the instance has a non-zero number of nanoseconds, previously this would print a message to stdout ([GH 14101](https://github.com/pandas-dev/pandas/issues/14101)). +* `Series.unique()` with datetime and timezone now returns return array of `Timestamp` with timezone ([GH 13565](https://github.com/pandas-dev/pandas/issues/13565)). +* `Panel.to_sparse()` will raise a `NotImplementedError` exception when called ([GH 13778](https://github.com/pandas-dev/pandas/issues/13778)). +* `Index.reshape()` will raise a `NotImplementedError` exception when called ([GH 12882](https://github.com/pandas-dev/pandas/issues/12882)). +* `.filter()` enforces mutual exclusion of the keyword arguments ([GH 12399](https://github.com/pandas-dev/pandas/issues/12399)). +* `eval`’s upcasting rules for `float32` types have been updated to be more consistent with NumPy’s rules. New behavior will not upcast to `float64` if you multiply a pandas `float32` object by a scalar float64 ([GH 12388](https://github.com/pandas-dev/pandas/issues/12388)). +* An `UnsupportedFunctionCall` error is now raised if NumPy ufuncs like `np.mean` are called on groupby or resample objects ([GH 12811](https://github.com/pandas-dev/pandas/issues/12811)). +* `__setitem__` will no longer apply a callable rhs as a function instead of storing it. Call `where` directly to get the previous behavior ([GH 13299](https://github.com/pandas-dev/pandas/issues/13299)). +* Calls to `.sample()` will respect the random seed set via `numpy.random.seed(n)` ([GH 13161](https://github.com/pandas-dev/pandas/issues/13161)) +* `Styler.apply` is now more strict about the outputs your function must return. For `axis=0` or `axis=1`, the output shape must be identical. For `axis=None`, the output must be a DataFrame with identical columns and index labels ([GH 13222](https://github.com/pandas-dev/pandas/issues/13222)). +* `Float64Index.astype(int)` will now raise `ValueError` if `Float64Index` contains `NaN` values ([GH 13149](https://github.com/pandas-dev/pandas/issues/13149)) +* `TimedeltaIndex.astype(int)` and `DatetimeIndex.astype(int)` will now return `Int64Index` instead of `np.array` ([GH 13209](https://github.com/pandas-dev/pandas/issues/13209)) +* Passing `Period` with multiple frequencies to normal `Index` now returns `Index` with `object` dtype ([GH 13664](https://github.com/pandas-dev/pandas/issues/13664)) +* `PeriodIndex.fillna` with `Period` has different freq now coerces to `object` dtype ([GH 13664](https://github.com/pandas-dev/pandas/issues/13664)) +* Faceted boxplots from `DataFrame.boxplot(by=col)` now return a `Series` when `return_type` is not None. Previously these returned an `OrderedDict`. Note that when `return_type=None`, the default, these still return a 2-D NumPy array ([GH 12216](https://github.com/pandas-dev/pandas/issues/12216), [GH 7096](https://github.com/pandas-dev/pandas/issues/7096)). +* `pd.read_hdf` will now raise a `ValueError` instead of `KeyError`, if a mode other than `r`, `r+` and `a` is supplied. ([GH 13623](https://github.com/pandas-dev/pandas/issues/13623)) +* `pd.read_csv()`, `pd.read_table()`, and `pd.read_hdf()` raise the builtin `FileNotFoundError` exception for Python 3.x when called on a nonexistent file; this is back-ported as `IOError` in Python 2.x ([GH 14086](https://github.com/pandas-dev/pandas/issues/14086)) +* More informative exceptions are passed through the csv parser. The exception type would now be the original exception type instead of `CParserError` ([GH 13652](https://github.com/pandas-dev/pandas/issues/13652)). +* `pd.read_csv()` in the C engine will now issue a `ParserWarning` or raise a `ValueError` when `sep` encoded is more than one character long ([GH 14065](https://github.com/pandas-dev/pandas/issues/14065)) +* `DataFrame.values` will now return `float64` with a `DataFrame` of mixed `int64` and `uint64` dtypes, conforming to `np.find_common_type` ([GH 10364](https://github.com/pandas-dev/pandas/issues/10364), [GH 13917](https://github.com/pandas-dev/pandas/issues/13917)) +* `.groupby.groups` will now return a dictionary of `Index` objects, rather than a dictionary of `np.ndarray` or `lists` ([GH 14293](https://github.com/pandas-dev/pandas/issues/14293)) + +## Deprecations[#](#deprecations "Link to this heading") + +* `Series.reshape` and `Categorical.reshape` have been deprecated and will be removed in a subsequent release ([GH 12882](https://github.com/pandas-dev/pandas/issues/12882), [GH 12882](https://github.com/pandas-dev/pandas/issues/12882)) +* `PeriodIndex.to_datetime` has been deprecated in favor of `PeriodIndex.to_timestamp` ([GH 8254](https://github.com/pandas-dev/pandas/issues/8254)) +* `Timestamp.to_datetime` has been deprecated in favor of `Timestamp.to_pydatetime` ([GH 8254](https://github.com/pandas-dev/pandas/issues/8254)) +* `Index.to_datetime` and `DatetimeIndex.to_datetime` have been deprecated in favor of `pd.to_datetime` ([GH 8254](https://github.com/pandas-dev/pandas/issues/8254)) +* `pandas.core.datetools` module has been deprecated and will be removed in a subsequent release ([GH 14094](https://github.com/pandas-dev/pandas/issues/14094)) +* `SparseList` has been deprecated and will be removed in a future version ([GH 13784](https://github.com/pandas-dev/pandas/issues/13784)) +* `DataFrame.to_html()` and `DataFrame.to_latex()` have dropped the `colSpace` parameter in favor of `col_space` ([GH 13857](https://github.com/pandas-dev/pandas/issues/13857)) +* `DataFrame.to_sql()` has deprecated the `flavor` parameter, as it is superfluous when SQLAlchemy is not installed ([GH 13611](https://github.com/pandas-dev/pandas/issues/13611)) +* Deprecated `read_csv` keywords: + + + `compact_ints` and `use_unsigned` have been deprecated and will be removed in a future version ([GH 13320](https://github.com/pandas-dev/pandas/issues/13320)) + + `buffer_lines` has been deprecated and will be removed in a future version ([GH 13360](https://github.com/pandas-dev/pandas/issues/13360)) + + `as_recarray` has been deprecated and will be removed in a future version ([GH 13373](https://github.com/pandas-dev/pandas/issues/13373)) + + `skip_footer` has been deprecated in favor of `skipfooter` and will be removed in a future version ([GH 13349](https://github.com/pandas-dev/pandas/issues/13349)) +* top-level `pd.ordered_merge()` has been renamed to `pd.merge_ordered()` and the original name will be removed in a future version ([GH 13358](https://github.com/pandas-dev/pandas/issues/13358)) +* `Timestamp.offset` property (and named arg in the constructor), has been deprecated in favor of `freq` ([GH 12160](https://github.com/pandas-dev/pandas/issues/12160)) +* `pd.tseries.util.pivot_annual` is deprecated. Use `pivot_table` as alternative, an example is [here](../user_guide/cookbook.html#cookbook-pivot) ([GH 736](https://github.com/pandas-dev/pandas/issues/736)) +* `pd.tseries.util.isleapyear` has been deprecated and will be removed in a subsequent release. Datetime-likes now have a `.is_leap_year` property ([GH 13727](https://github.com/pandas-dev/pandas/issues/13727)) +* `Panel4D` and `PanelND` constructors are deprecated and will be removed in a future version. The recommended way to represent these types of n-dimensional data are with the [xarray package](http://xarray.pydata.org/en/stable/). pandas provides a `to_xarray()` method to automate this conversion ([GH 13564](https://github.com/pandas-dev/pandas/issues/13564)). +* `pandas.tseries.frequencies.get_standard_freq` is deprecated. Use `pandas.tseries.frequencies.to_offset(freq).rule_code` instead ([GH 13874](https://github.com/pandas-dev/pandas/issues/13874)) +* `pandas.tseries.frequencies.to_offset`’s `freqstr` keyword is deprecated in favor of `freq` ([GH 13874](https://github.com/pandas-dev/pandas/issues/13874)) +* `Categorical.from_array` has been deprecated and will be removed in a future version ([GH 13854](https://github.com/pandas-dev/pandas/issues/13854)) + +## Removal of prior version deprecations/changes[#](#removal-of-prior-version-deprecations-changes "Link to this heading") + +* The `SparsePanel` class has been removed ([GH 13778](https://github.com/pandas-dev/pandas/issues/13778)) +* The `pd.sandbox` module has been removed in favor of the external library `pandas-qt` ([GH 13670](https://github.com/pandas-dev/pandas/issues/13670)) +* The `pandas.io.data` and `pandas.io.wb` modules are removed in favor of + the [pandas-datareader package](https://github.com/pydata/pandas-datareader) ([GH 13724](https://github.com/pandas-dev/pandas/issues/13724)). +* The `pandas.tools.rplot` module has been removed in favor of + the [seaborn package](https://github.com/mwaskom/seaborn) ([GH 13855](https://github.com/pandas-dev/pandas/issues/13855)) +* `DataFrame.to_csv()` has dropped the `engine` parameter, as was deprecated in 0.17.1 ([GH 11274](https://github.com/pandas-dev/pandas/issues/11274), [GH 13419](https://github.com/pandas-dev/pandas/issues/13419)) +* `DataFrame.to_dict()` has dropped the `outtype` parameter in favor of `orient` ([GH 13627](https://github.com/pandas-dev/pandas/issues/13627), [GH 8486](https://github.com/pandas-dev/pandas/issues/8486)) +* `pd.Categorical` has dropped setting of the `ordered` attribute directly in favor of the `set_ordered` method ([GH 13671](https://github.com/pandas-dev/pandas/issues/13671)) +* `pd.Categorical` has dropped the `levels` attribute in favor of `categories` ([GH 8376](https://github.com/pandas-dev/pandas/issues/8376)) +* `DataFrame.to_sql()` has dropped the `mysql` option for the `flavor` parameter ([GH 13611](https://github.com/pandas-dev/pandas/issues/13611)) +* `Panel.shift()` has dropped the `lags` parameter in favor of `periods` ([GH 14041](https://github.com/pandas-dev/pandas/issues/14041)) +* `pd.Index` has dropped the `diff` method in favor of `difference` ([GH 13669](https://github.com/pandas-dev/pandas/issues/13669)) +* `pd.DataFrame` has dropped the `to_wide` method in favor of `to_panel` ([GH 14039](https://github.com/pandas-dev/pandas/issues/14039)) +* `Series.to_csv` has dropped the `nanRep` parameter in favor of `na_rep` ([GH 13804](https://github.com/pandas-dev/pandas/issues/13804)) +* `Series.xs`, `DataFrame.xs`, `Panel.xs`, `Panel.major_xs`, and `Panel.minor_xs` have dropped the `copy` parameter ([GH 13781](https://github.com/pandas-dev/pandas/issues/13781)) +* `str.split` has dropped the `return_type` parameter in favor of `expand` ([GH 13701](https://github.com/pandas-dev/pandas/issues/13701)) +* Removal of the legacy time rules (offset aliases), deprecated since 0.17.0 (this has been alias since 0.8.0) ([GH 13590](https://github.com/pandas-dev/pandas/issues/13590), [GH 13868](https://github.com/pandas-dev/pandas/issues/13868)). Now legacy time rules raises `ValueError`. For the list of currently supported offsets, see [here](../user_guide/timeseries.html#timeseries-offset-aliases). +* The default value for the `return_type` parameter for `DataFrame.plot.box` and `DataFrame.boxplot` changed from `None` to `"axes"`. These methods will now return a matplotlib axes by default instead of a dictionary of artists. See [here](../user_guide/visualization.html#visualization-box-return) ([GH 6581](https://github.com/pandas-dev/pandas/issues/6581)). +* The `tquery` and `uquery` functions in the `pandas.io.sql` module are removed ([GH 5950](https://github.com/pandas-dev/pandas/issues/5950)). + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Improved performance of sparse `IntIndex.intersect` ([GH 13082](https://github.com/pandas-dev/pandas/issues/13082)) +* Improved performance of sparse arithmetic with `BlockIndex` when the number of blocks are large, though recommended to use `IntIndex` in such cases ([GH 13082](https://github.com/pandas-dev/pandas/issues/13082)) +* Improved performance of `DataFrame.quantile()` as it now operates per-block ([GH 11623](https://github.com/pandas-dev/pandas/issues/11623)) +* Improved performance of float64 hash table operations, fixing some very slow indexing and groupby operations in python 3 ([GH 13166](https://github.com/pandas-dev/pandas/issues/13166), [GH 13334](https://github.com/pandas-dev/pandas/issues/13334)) +* Improved performance of `DataFrameGroupBy.transform` ([GH 12737](https://github.com/pandas-dev/pandas/issues/12737)) +* Improved performance of `Index` and `Series` `.duplicated` ([GH 10235](https://github.com/pandas-dev/pandas/issues/10235)) +* Improved performance of `Index.difference` ([GH 12044](https://github.com/pandas-dev/pandas/issues/12044)) +* Improved performance of `RangeIndex.is_monotonic_increasing` and `is_monotonic_decreasing` ([GH 13749](https://github.com/pandas-dev/pandas/issues/13749)) +* Improved performance of datetime string parsing in `DatetimeIndex` ([GH 13692](https://github.com/pandas-dev/pandas/issues/13692)) +* Improved performance of hashing `Period` ([GH 12817](https://github.com/pandas-dev/pandas/issues/12817)) +* Improved performance of `factorize` of datetime with timezone ([GH 13750](https://github.com/pandas-dev/pandas/issues/13750)) +* Improved performance of by lazily creating indexing hashtables on larger Indexes ([GH 14266](https://github.com/pandas-dev/pandas/issues/14266)) +* Improved performance of `groupby.groups` ([GH 14293](https://github.com/pandas-dev/pandas/issues/14293)) +* Unnecessary materializing of a MultiIndex when introspecting for memory usage ([GH 14308](https://github.com/pandas-dev/pandas/issues/14308)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in `groupby().shift()`, which could cause a segfault or corruption in rare circumstances when grouping by columns with missing values ([GH 13813](https://github.com/pandas-dev/pandas/issues/13813)) +* Bug in `groupby().cumsum()` calculating `cumprod` when `axis=1`. ([GH 13994](https://github.com/pandas-dev/pandas/issues/13994)) +* Bug in `pd.to_timedelta()` in which the `errors` parameter was not being respected ([GH 13613](https://github.com/pandas-dev/pandas/issues/13613)) +* Bug in `io.json.json_normalize()`, where non-ascii keys raised an exception ([GH 13213](https://github.com/pandas-dev/pandas/issues/13213)) +* Bug when passing a not-default-indexed `Series` as `xerr` or `yerr` in `.plot()` ([GH 11858](https://github.com/pandas-dev/pandas/issues/11858)) +* Bug in area plot draws legend incorrectly if subplot is enabled or legend is moved after plot (matplotlib 1.5.0 is required to draw area plot legend properly) ([GH 9161](https://github.com/pandas-dev/pandas/issues/9161), [GH 13544](https://github.com/pandas-dev/pandas/issues/13544)) +* Bug in `DataFrame` assignment with an object-dtyped `Index` where the resultant column is mutable to the original object. ([GH 13522](https://github.com/pandas-dev/pandas/issues/13522)) +* Bug in matplotlib `AutoDataFormatter`; this restores the second scaled formatting and re-adds micro-second scaled formatting ([GH 13131](https://github.com/pandas-dev/pandas/issues/13131)) +* Bug in selection from a `HDFStore` with a fixed format and `start` and/or `stop` specified will now return the selected range ([GH 8287](https://github.com/pandas-dev/pandas/issues/8287)) +* Bug in `Categorical.from_codes()` where an unhelpful error was raised when an invalid `ordered` parameter was passed in ([GH 14058](https://github.com/pandas-dev/pandas/issues/14058)) +* Bug in `Series` construction from a tuple of integers on windows not returning default dtype (int64) ([GH 13646](https://github.com/pandas-dev/pandas/issues/13646)) +* Bug in `TimedeltaIndex` addition with a Datetime-like object where addition overflow was not being caught ([GH 14068](https://github.com/pandas-dev/pandas/issues/14068)) +* Bug in `.groupby(..).resample(..)` when the same object is called multiple times ([GH 13174](https://github.com/pandas-dev/pandas/issues/13174)) +* Bug in `.to_records()` when index name is a unicode string ([GH 13172](https://github.com/pandas-dev/pandas/issues/13172)) +* Bug in calling `.memory_usage()` on object which doesn’t implement ([GH 12924](https://github.com/pandas-dev/pandas/issues/12924)) +* Regression in `Series.quantile` with nans (also shows up in `.median()` and `.describe()` ); furthermore now names the `Series` with the quantile ([GH 13098](https://github.com/pandas-dev/pandas/issues/13098), [GH 13146](https://github.com/pandas-dev/pandas/issues/13146)) +* Bug in `SeriesGroupBy.transform` with datetime values and missing groups ([GH 13191](https://github.com/pandas-dev/pandas/issues/13191)) +* Bug where empty `Series` were incorrectly coerced in datetime-like numeric operations ([GH 13844](https://github.com/pandas-dev/pandas/issues/13844)) +* Bug in `Categorical` constructor when passed a `Categorical` containing datetimes with timezones ([GH 14190](https://github.com/pandas-dev/pandas/issues/14190)) +* Bug in `Series.str.extractall()` with `str` index raises `ValueError` ([GH 13156](https://github.com/pandas-dev/pandas/issues/13156)) +* Bug in `Series.str.extractall()` with single group and quantifier ([GH 13382](https://github.com/pandas-dev/pandas/issues/13382)) +* Bug in `DatetimeIndex` and `Period` subtraction raises `ValueError` or `AttributeError` rather than `TypeError` ([GH 13078](https://github.com/pandas-dev/pandas/issues/13078)) +* Bug in `Index` and `Series` created with `NaN` and `NaT` mixed data may not have `datetime64` dtype ([GH 13324](https://github.com/pandas-dev/pandas/issues/13324)) +* Bug in `Index` and `Series` may ignore `np.datetime64('nat')` and `np.timdelta64('nat')` to infer dtype ([GH 13324](https://github.com/pandas-dev/pandas/issues/13324)) +* Bug in `PeriodIndex` and `Period` subtraction raises `AttributeError` ([GH 13071](https://github.com/pandas-dev/pandas/issues/13071)) +* Bug in `PeriodIndex` construction returning a `float64` index in some circumstances ([GH 13067](https://github.com/pandas-dev/pandas/issues/13067)) +* Bug in `.resample(..)` with a `PeriodIndex` not changing its `freq` appropriately when empty ([GH 13067](https://github.com/pandas-dev/pandas/issues/13067)) +* Bug in `.resample(..)` with a `PeriodIndex` not retaining its type or name with an empty `DataFrame` appropriately when empty ([GH 13212](https://github.com/pandas-dev/pandas/issues/13212)) +* Bug in `groupby(..).apply(..)` when the passed function returns scalar values per group ([GH 13468](https://github.com/pandas-dev/pandas/issues/13468)). +* Bug in `groupby(..).resample(..)` where passing some keywords would raise an exception ([GH 13235](https://github.com/pandas-dev/pandas/issues/13235)) +* Bug in `.tz_convert` on a tz-aware `DateTimeIndex` that relied on index being sorted for correct results ([GH 13306](https://github.com/pandas-dev/pandas/issues/13306)) +* Bug in `.tz_localize` with `dateutil.tz.tzlocal` may return incorrect result ([GH 13583](https://github.com/pandas-dev/pandas/issues/13583)) +* Bug in `DatetimeTZDtype` dtype with `dateutil.tz.tzlocal` cannot be regarded as valid dtype ([GH 13583](https://github.com/pandas-dev/pandas/issues/13583)) +* Bug in `pd.read_hdf()` where attempting to load an HDF file with a single dataset, that had one or more categorical columns, failed unless the key argument was set to the name of the dataset. ([GH 13231](https://github.com/pandas-dev/pandas/issues/13231)) +* Bug in `.rolling()` that allowed a negative integer window in construction of the `Rolling()` object, but would later fail on aggregation ([GH 13383](https://github.com/pandas-dev/pandas/issues/13383)) +* Bug in `Series` indexing with tuple-valued data and a numeric index ([GH 13509](https://github.com/pandas-dev/pandas/issues/13509)) +* Bug in printing `pd.DataFrame` where unusual elements with the `object` dtype were causing segfaults ([GH 13717](https://github.com/pandas-dev/pandas/issues/13717)) +* Bug in ranking `Series` which could result in segfaults ([GH 13445](https://github.com/pandas-dev/pandas/issues/13445)) +* Bug in various index types, which did not propagate the name of passed index ([GH 12309](https://github.com/pandas-dev/pandas/issues/12309)) +* Bug in `DatetimeIndex`, which did not honour the `copy=True` ([GH 13205](https://github.com/pandas-dev/pandas/issues/13205)) +* Bug in `DatetimeIndex.is_normalized` returns incorrectly for normalized date\_range in case of local timezones ([GH 13459](https://github.com/pandas-dev/pandas/issues/13459)) +* Bug in `pd.concat` and `.append` may coerces `datetime64` and `timedelta` to `object` dtype containing python built-in `datetime` or `timedelta` rather than `Timestamp` or `Timedelta` ([GH 13626](https://github.com/pandas-dev/pandas/issues/13626)) +* Bug in `PeriodIndex.append` may raises `AttributeError` when the result is `object` dtype ([GH 13221](https://github.com/pandas-dev/pandas/issues/13221)) +* Bug in `CategoricalIndex.append` may accept normal `list` ([GH 13626](https://github.com/pandas-dev/pandas/issues/13626)) +* Bug in `pd.concat` and `.append` with the same timezone get reset to UTC ([GH 7795](https://github.com/pandas-dev/pandas/issues/7795)) +* Bug in `Series` and `DataFrame` `.append` raises `AmbiguousTimeError` if data contains datetime near DST boundary ([GH 13626](https://github.com/pandas-dev/pandas/issues/13626)) +* Bug in `DataFrame.to_csv()` in which float values were being quoted even though quotations were specified for non-numeric values only ([GH 12922](https://github.com/pandas-dev/pandas/issues/12922), [GH 13259](https://github.com/pandas-dev/pandas/issues/13259)) +* Bug in `DataFrame.describe()` raising `ValueError` with only boolean columns ([GH 13898](https://github.com/pandas-dev/pandas/issues/13898)) +* Bug in `MultiIndex` slicing where extra elements were returned when level is non-unique ([GH 12896](https://github.com/pandas-dev/pandas/issues/12896)) +* Bug in `.str.replace` does not raise `TypeError` for invalid replacement ([GH 13438](https://github.com/pandas-dev/pandas/issues/13438)) +* Bug in `MultiIndex.from_arrays` which didn’t check for input array lengths matching ([GH 13599](https://github.com/pandas-dev/pandas/issues/13599)) +* Bug in `cartesian_product` and `MultiIndex.from_product` which may raise with empty input arrays ([GH 12258](https://github.com/pandas-dev/pandas/issues/12258)) +* Bug in `pd.read_csv()` which may cause a segfault or corruption when iterating in large chunks over a stream/file under rare circumstances ([GH 13703](https://github.com/pandas-dev/pandas/issues/13703)) +* Bug in `pd.read_csv()` which caused errors to be raised when a dictionary containing scalars is passed in for `na_values` ([GH 12224](https://github.com/pandas-dev/pandas/issues/12224)) +* Bug in `pd.read_csv()` which caused BOM files to be incorrectly parsed by not ignoring the BOM ([GH 4793](https://github.com/pandas-dev/pandas/issues/4793)) +* Bug in `pd.read_csv()` with `engine='python'` which raised errors when a numpy array was passed in for `usecols` ([GH 12546](https://github.com/pandas-dev/pandas/issues/12546)) +* Bug in `pd.read_csv()` where the index columns were being incorrectly parsed when parsed as dates with a `thousands` parameter ([GH 14066](https://github.com/pandas-dev/pandas/issues/14066)) +* Bug in `pd.read_csv()` with `engine='python'` in which `NaN` values weren’t being detected after data was converted to numeric values ([GH 13314](https://github.com/pandas-dev/pandas/issues/13314)) +* Bug in `pd.read_csv()` in which the `nrows` argument was not properly validated for both engines ([GH 10476](https://github.com/pandas-dev/pandas/issues/10476)) +* Bug in `pd.read_csv()` with `engine='python'` in which infinities of mixed-case forms were not being interpreted properly ([GH 13274](https://github.com/pandas-dev/pandas/issues/13274)) +* Bug in `pd.read_csv()` with `engine='python'` in which trailing `NaN` values were not being parsed ([GH 13320](https://github.com/pandas-dev/pandas/issues/13320)) +* Bug in `pd.read_csv()` with `engine='python'` when reading from a `tempfile.TemporaryFile` on Windows with Python 3 ([GH 13398](https://github.com/pandas-dev/pandas/issues/13398)) +* Bug in `pd.read_csv()` that prevents `usecols` kwarg from accepting single-byte unicode strings ([GH 13219](https://github.com/pandas-dev/pandas/issues/13219)) +* Bug in `pd.read_csv()` that prevents `usecols` from being an empty set ([GH 13402](https://github.com/pandas-dev/pandas/issues/13402)) +* Bug in `pd.read_csv()` in the C engine where the NULL character was not being parsed as NULL ([GH 14012](https://github.com/pandas-dev/pandas/issues/14012)) +* Bug in `pd.read_csv()` with `engine='c'` in which NULL `quotechar` was not accepted even though `quoting` was specified as `None` ([GH 13411](https://github.com/pandas-dev/pandas/issues/13411)) +* Bug in `pd.read_csv()` with `engine='c'` in which fields were not properly cast to float when quoting was specified as non-numeric ([GH 13411](https://github.com/pandas-dev/pandas/issues/13411)) +* Bug in `pd.read_csv()` in Python 2.x with non-UTF8 encoded, multi-character separated data ([GH 3404](https://github.com/pandas-dev/pandas/issues/3404)) +* Bug in `pd.read_csv()`, where aliases for utf-xx (e.g. UTF-xx, UTF\_xx, utf\_xx) raised UnicodeDecodeError ([GH 13549](https://github.com/pandas-dev/pandas/issues/13549)) +* Bug in `pd.read_csv`, `pd.read_table`, `pd.read_fwf`, `pd.read_stata` and `pd.read_sas` where files were opened by parsers but not closed if both `chunksize` and `iterator` were `None`. ([GH 13940](https://github.com/pandas-dev/pandas/issues/13940)) +* Bug in `StataReader`, `StataWriter`, `XportReader` and `SAS7BDATReader` where a file was not properly closed when an error was raised. ([GH 13940](https://github.com/pandas-dev/pandas/issues/13940)) +* Bug in `pd.pivot_table()` where `margins_name` is ignored when `aggfunc` is a list ([GH 13354](https://github.com/pandas-dev/pandas/issues/13354)) +* Bug in `pd.Series.str.zfill`, `center`, `ljust`, `rjust`, and `pad` when passing non-integers, did not raise `TypeError` ([GH 13598](https://github.com/pandas-dev/pandas/issues/13598)) +* Bug in checking for any null objects in a `TimedeltaIndex`, which always returned `True` ([GH 13603](https://github.com/pandas-dev/pandas/issues/13603)) +* Bug in `Series` arithmetic raises `TypeError` if it contains datetime-like as `object` dtype ([GH 13043](https://github.com/pandas-dev/pandas/issues/13043)) +* Bug `Series.isnull()` and `Series.notnull()` ignore `Period('NaT')` ([GH 13737](https://github.com/pandas-dev/pandas/issues/13737)) +* Bug `Series.fillna()` and `Series.dropna()` don’t affect to `Period('NaT')` ([GH 13737](https://github.com/pandas-dev/pandas/issues/13737) +* Bug in `.fillna(value=np.nan)` incorrectly raises `KeyError` on a `category` dtyped `Series` ([GH 14021](https://github.com/pandas-dev/pandas/issues/14021)) +* Bug in extension dtype creation where the created types were not is/identical ([GH 13285](https://github.com/pandas-dev/pandas/issues/13285)) +* Bug in `.resample(..)` where incorrect warnings were triggered by IPython introspection ([GH 13618](https://github.com/pandas-dev/pandas/issues/13618)) +* Bug in `NaT` - `Period` raises `AttributeError` ([GH 13071](https://github.com/pandas-dev/pandas/issues/13071)) +* Bug in `Series` comparison may output incorrect result if rhs contains `NaT` ([GH 9005](https://github.com/pandas-dev/pandas/issues/9005)) +* Bug in `Series` and `Index` comparison may output incorrect result if it contains `NaT` with `object` dtype ([GH 13592](https://github.com/pandas-dev/pandas/issues/13592)) +* Bug in `Period` addition raises `TypeError` if `Period` is on right hand side ([GH 13069](https://github.com/pandas-dev/pandas/issues/13069)) +* Bug in `Period` and `Series` or `Index` comparison raises `TypeError` ([GH 13200](https://github.com/pandas-dev/pandas/issues/13200)) +* Bug in `pd.set_eng_float_format()` that would prevent NaN and Inf from formatting ([GH 11981](https://github.com/pandas-dev/pandas/issues/11981)) +* Bug in `.unstack` with `Categorical` dtype resets `.ordered` to `True` ([GH 13249](https://github.com/pandas-dev/pandas/issues/13249)) +* Clean some compile time warnings in datetime parsing ([GH 13607](https://github.com/pandas-dev/pandas/issues/13607)) +* Bug in `factorize` raises `AmbiguousTimeError` if data contains datetime near DST boundary ([GH 13750](https://github.com/pandas-dev/pandas/issues/13750)) +* Bug in `.set_index` raises `AmbiguousTimeError` if new index contains DST boundary and multi levels ([GH 12920](https://github.com/pandas-dev/pandas/issues/12920)) +* Bug in `.shift` raises `AmbiguousTimeError` if data contains datetime near DST boundary ([GH 13926](https://github.com/pandas-dev/pandas/issues/13926)) +* Bug in `pd.read_hdf()` returns incorrect result when a `DataFrame` with a `categorical` column and a query which doesn’t match any values ([GH 13792](https://github.com/pandas-dev/pandas/issues/13792)) +* Bug in `.iloc` when indexing with a non lexsorted MultiIndex ([GH 13797](https://github.com/pandas-dev/pandas/issues/13797)) +* Bug in `.loc` when indexing with date strings in a reverse sorted `DatetimeIndex` ([GH 14316](https://github.com/pandas-dev/pandas/issues/14316)) +* Bug in `Series` comparison operators when dealing with zero dim NumPy arrays ([GH 13006](https://github.com/pandas-dev/pandas/issues/13006)) +* Bug in `.combine_first` may return incorrect `dtype` ([GH 7630](https://github.com/pandas-dev/pandas/issues/7630), [GH 10567](https://github.com/pandas-dev/pandas/issues/10567)) +* Bug in `groupby` where `apply` returns different result depending on whether first result is `None` or not ([GH 12824](https://github.com/pandas-dev/pandas/issues/12824)) +* Bug in `groupby(..).nth()` where the group key is included inconsistently if called after `.head()/.tail()` ([GH 12839](https://github.com/pandas-dev/pandas/issues/12839)) +* Bug in `.to_html`, `.to_latex` and `.to_string` silently ignore custom datetime formatter passed through the `formatters` key word ([GH 10690](https://github.com/pandas-dev/pandas/issues/10690)) +* Bug in `DataFrame.iterrows()`, not yielding a `Series` subclasse if defined ([GH 13977](https://github.com/pandas-dev/pandas/issues/13977)) +* Bug in `pd.to_numeric` when `errors='coerce'` and input contains non-hashable objects ([GH 13324](https://github.com/pandas-dev/pandas/issues/13324)) +* Bug in invalid `Timedelta` arithmetic and comparison may raise `ValueError` rather than `TypeError` ([GH 13624](https://github.com/pandas-dev/pandas/issues/13624)) +* Bug in invalid datetime parsing in `to_datetime` and `DatetimeIndex` may raise `TypeError` rather than `ValueError` ([GH 11169](https://github.com/pandas-dev/pandas/issues/11169), [GH 11287](https://github.com/pandas-dev/pandas/issues/11287)) +* Bug in `Index` created with tz-aware `Timestamp` and mismatched `tz` option incorrectly coerces timezone ([GH 13692](https://github.com/pandas-dev/pandas/issues/13692)) +* Bug in `DatetimeIndex` with nanosecond frequency does not include timestamp specified with `end` ([GH 13672](https://github.com/pandas-dev/pandas/issues/13672)) +* Bug in `Series` when setting a slice with a `np.timedelta64` ([GH 14155](https://github.com/pandas-dev/pandas/issues/14155)) +* Bug in `Index` raises `OutOfBoundsDatetime` if `datetime` exceeds `datetime64[ns]` bounds, rather than coercing to `object` dtype ([GH 13663](https://github.com/pandas-dev/pandas/issues/13663)) +* Bug in `Index` may ignore specified `datetime64` or `timedelta64` passed as `dtype` ([GH 13981](https://github.com/pandas-dev/pandas/issues/13981)) +* Bug in `RangeIndex` can be created without no arguments rather than raises `TypeError` ([GH 13793](https://github.com/pandas-dev/pandas/issues/13793)) +* Bug in `.value_counts()` raises `OutOfBoundsDatetime` if data exceeds `datetime64[ns]` bounds ([GH 13663](https://github.com/pandas-dev/pandas/issues/13663)) +* Bug in `DatetimeIndex` may raise `OutOfBoundsDatetime` if input `np.datetime64` has other unit than `ns` ([GH 9114](https://github.com/pandas-dev/pandas/issues/9114)) +* Bug in `Series` creation with `np.datetime64` which has other unit than `ns` as `object` dtype results in incorrect values ([GH 13876](https://github.com/pandas-dev/pandas/issues/13876)) +* Bug in `resample` with timedelta data where data was casted to float ([GH 13119](https://github.com/pandas-dev/pandas/issues/13119)). +* Bug in `pd.isnull()` `pd.notnull()` raise `TypeError` if input datetime-like has other unit than `ns` ([GH 13389](https://github.com/pandas-dev/pandas/issues/13389)) +* Bug in `pd.merge()` may raise `TypeError` if input datetime-like has other unit than `ns` ([GH 13389](https://github.com/pandas-dev/pandas/issues/13389)) +* Bug in `HDFStore`/`read_hdf()` discarded `DatetimeIndex.name` if `tz` was set ([GH 13884](https://github.com/pandas-dev/pandas/issues/13884)) +* Bug in `Categorical.remove_unused_categories()` changes `.codes` dtype to platform int ([GH 13261](https://github.com/pandas-dev/pandas/issues/13261)) +* Bug in `groupby` with `as_index=False` returns all NaN’s when grouping on multiple columns including a categorical one ([GH 13204](https://github.com/pandas-dev/pandas/issues/13204)) +* Bug in `df.groupby(...)[...]` where getitem with `Int64Index` raised an error ([GH 13731](https://github.com/pandas-dev/pandas/issues/13731)) +* Bug in the CSS classes assigned to `DataFrame.style` for index names. Previously they were assigned `"col_heading level col"` where `n` was the number of levels + 1. Now they are assigned `"index_name level"`, where `n` is the correct level for that MultiIndex. +* Bug where `pd.read_gbq()` could throw `ImportError: No module named discovery` as a result of a naming conflict with another python package called apiclient ([GH 13454](https://github.com/pandas-dev/pandas/issues/13454)) +* Bug in `Index.union` returns an incorrect result with a named empty index ([GH 13432](https://github.com/pandas-dev/pandas/issues/13432)) +* Bugs in `Index.difference` and `DataFrame.join` raise in Python3 when using mixed-integer indexes ([GH 13432](https://github.com/pandas-dev/pandas/issues/13432), [GH 12814](https://github.com/pandas-dev/pandas/issues/12814)) +* Bug in subtract tz-aware `datetime.datetime` from tz-aware `datetime64` series ([GH 14088](https://github.com/pandas-dev/pandas/issues/14088)) +* Bug in `.to_excel()` when DataFrame contains a MultiIndex which contains a label with a NaN value ([GH 13511](https://github.com/pandas-dev/pandas/issues/13511)) +* Bug in invalid frequency offset string like “D1”, “-2-3H” may not raise `ValueError` ([GH 13930](https://github.com/pandas-dev/pandas/issues/13930)) +* Bug in `concat` and `groupby` for hierarchical frames with `RangeIndex` levels ([GH 13542](https://github.com/pandas-dev/pandas/issues/13542)). +* Bug in `Series.str.contains()` for Series containing only `NaN` values of `object` dtype ([GH 14171](https://github.com/pandas-dev/pandas/issues/14171)) +* Bug in `agg()` function on groupby dataframe changes dtype of `datetime64[ns]` column to `float64` ([GH 12821](https://github.com/pandas-dev/pandas/issues/12821)) +* Bug in using NumPy ufunc with `PeriodIndex` to add or subtract integer raise `IncompatibleFrequency`. Note that using standard operator like `+` or `-` is recommended, because standard operators use more efficient path ([GH 13980](https://github.com/pandas-dev/pandas/issues/13980)) +* Bug in operations on `NaT` returning `float` instead of `datetime64[ns]` ([GH 12941](https://github.com/pandas-dev/pandas/issues/12941)) +* Bug in `Series` flexible arithmetic methods (like `.add()`) raises `ValueError` when `axis=None` ([GH 13894](https://github.com/pandas-dev/pandas/issues/13894)) +* Bug in `DataFrame.to_csv()` with `MultiIndex` columns in which a stray empty line was added ([GH 6618](https://github.com/pandas-dev/pandas/issues/6618)) +* Bug in `DatetimeIndex`, `TimedeltaIndex` and `PeriodIndex.equals()` may return `True` when input isn’t `Index` but contains the same values ([GH 13107](https://github.com/pandas-dev/pandas/issues/13107)) +* Bug in assignment against datetime with timezone may not work if it contains datetime near DST boundary ([GH 14146](https://github.com/pandas-dev/pandas/issues/14146)) +* Bug in `pd.eval()` and `HDFStore` query truncating long float literals with python 2 ([GH 14241](https://github.com/pandas-dev/pandas/issues/14241)) +* Bug in `Index` raises `KeyError` displaying incorrect column when column is not in the df and columns contains duplicate values ([GH 13822](https://github.com/pandas-dev/pandas/issues/13822)) +* Bug in `Period` and `PeriodIndex` creating wrong dates when frequency has combined offset aliases ([GH 13874](https://github.com/pandas-dev/pandas/issues/13874)) +* Bug in `.to_string()` when called with an integer `line_width` and `index=False` raises an UnboundLocalError exception because `idx` referenced before assignment. +* Bug in `eval()` where the `resolvers` argument would not accept a list ([GH 14095](https://github.com/pandas-dev/pandas/issues/14095)) +* Bugs in `stack`, `get_dummies`, `make_axis_dummies` which don’t preserve categorical dtypes in (multi)indexes ([GH 13854](https://github.com/pandas-dev/pandas/issues/13854)) +* `PeriodIndex` can now accept `list` and `array` which contains `pd.NaT` ([GH 13430](https://github.com/pandas-dev/pandas/issues/13430)) +* Bug in `df.groupby` where `.median()` returns arbitrary values if grouped dataframe contains empty bins ([GH 13629](https://github.com/pandas-dev/pandas/issues/13629)) +* Bug in `Index.copy()` where `name` parameter was ignored ([GH 14302](https://github.com/pandas-dev/pandas/issues/14302)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 117 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Adrien Emery + +* Alex Alekseyev +* Alex Vig + +* Allen Riddell + +* Amol + +* Amol Agrawal + +* Andy R. Terrel + +* Anthonios Partheniou +* Ben Kandel + +* Bob Baxley + +* Brett Rosen + +* Camilo Cota + +* Chris +* Chris Grinolds +* Chris Warth +* Christian Hudon +* Christopher C. Aycock +* Daniel Siladji + +* Douglas McNeil +* Drewrey Lupton + +* Eduardo Blancas Reyes + +* Elliot Marsden + +* Evan Wright +* Felix Marczinowski + +* Francis T. O’Donovan +* Geraint Duck + +* Giacomo Ferroni + +* Grant Roch + +* Gábor Lipták +* Haleemur Ali + +* Hassan Shamim + +* Iulius Curt + +* Ivan Nazarov + +* Jeff Reback +* Jeffrey Gerard + +* Jenn Olsen + +* Jim Crist +* Joe Jevnik +* John Evans + +* John Freeman +* John Liekezer + +* John W. O’Brien +* John Zwinck + +* Johnny Gill + +* Jordan Erenrich + +* Joris Van den Bossche +* Josh Howes + +* Jozef Brandys + +* Ka Wo Chen +* Kamil Sindi + +* Kerby Shedden +* Kernc + +* Kevin Sheppard +* Matthieu Brucher + +* Maximilian Roos +* Michael Scherer + +* Mike Graham + +* Mortada Mehyar +* Muhammad Haseeb Tariq + +* Nate George + +* Neil Parley + +* Nicolas Bonnotte +* OXPHOS +* Pan Deng / Zora + +* Paul + +* Paul Mestemaker + +* Pauli Virtanen +* Pawel Kordek + +* Pietro Battiston +* Piotr Jucha + +* Ravi Kumar Nimmi + +* Robert Gieseke +* Robert Kern + +* Roger Thomas +* Roy Keyes + +* Russell Smith + +* Sahil Dua + +* Sanjiv Lobo + +* Sašo Stanovnik + +* Shawn Heide + +* Sinhrks +* Stephen Kappel + +* Steve Choi + +* Stewart Henderson + +* Sudarshan Konge + +* Thomas A Caswell +* Tom Augspurger +* Tom Bird + +* Uwe Hoffmann + +* WillAyd + +* Xiang Zhang + +* YG-Riku + +* Yadunandan + +* Yaroslav Halchenko +* Yuichiro Kaneko + +* adneu +* agraboso + +* babakkeyvani + +* c123w + +* chris-b1 +* cmazzullo + +* conquistador1492 + +* cr3 + +* dsm054 +* gfyoung +* harshul1610 + +* iamsimha + +* jackieleng + +* mpuels + +* pijucha + +* priyankjain + +* sinhrks +* wcwagner + +* yui-knk + +* zhangjinjie + +* znmean + +* 颜发才(Yan Facai) + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.19.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.19.1.md new file mode 100644 index 0000000000000000000000000000000000000000..da34efd1ea8a42a8771910eac00c8131fc113864 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.19.1.md @@ -0,0 +1,92 @@ +# What's new in pandas 0.19.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.19.1.html + +# Version 0.19.1 (November 3, 2016)[#](#version-0-19-1-november-3-2016 "Link to this heading") + +This is a minor bug-fix release from 0.19.0 and includes some small regression fixes, +bug fixes and performance improvements. +We recommend that all users upgrade to this version. + +What’s new in v0.19.1 + +* [Performance improvements](#performance-improvements) +* [Bug fixes](#bug-fixes) +* [Contributors](#contributors) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Fixed performance regression in factorization of `Period` data ([GH 14338](https://github.com/pandas-dev/pandas/issues/14338)) +* Fixed performance regression in `Series.asof(where)` when `where` is a scalar ([GH 14461](https://github.com/pandas-dev/pandas/issues/14461)) +* Improved performance in `DataFrame.asof(where)` when `where` is a scalar ([GH 14461](https://github.com/pandas-dev/pandas/issues/14461)) +* Improved performance in `.to_json()` when `lines=True` ([GH 14408](https://github.com/pandas-dev/pandas/issues/14408)) +* Improved performance in certain types of `loc` indexing with a MultiIndex ([GH 14551](https://github.com/pandas-dev/pandas/issues/14551)). + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Source installs from PyPI will now again work without `cython` installed, as in previous versions ([GH 14204](https://github.com/pandas-dev/pandas/issues/14204)) +* Compat with Cython 0.25 for building ([GH 14496](https://github.com/pandas-dev/pandas/issues/14496)) +* Fixed regression where user-provided file handles were closed in `read_csv` (c engine) ([GH 14418](https://github.com/pandas-dev/pandas/issues/14418)). +* Fixed regression in `DataFrame.quantile` when missing values where present in some columns ([GH 14357](https://github.com/pandas-dev/pandas/issues/14357)). +* Fixed regression in `Index.difference` where the `freq` of a `DatetimeIndex` was incorrectly set ([GH 14323](https://github.com/pandas-dev/pandas/issues/14323)) +* Added back `pandas.core.common.array_equivalent` with a deprecation warning ([GH 14555](https://github.com/pandas-dev/pandas/issues/14555)). +* Bug in `pd.read_csv` for the C engine in which quotation marks were improperly parsed in skipped rows ([GH 14459](https://github.com/pandas-dev/pandas/issues/14459)) +* Bug in `pd.read_csv` for Python 2.x in which Unicode quote characters were no longer being respected ([GH 14477](https://github.com/pandas-dev/pandas/issues/14477)) +* Fixed regression in `Index.append` when categorical indices were appended ([GH 14545](https://github.com/pandas-dev/pandas/issues/14545)). +* Fixed regression in `pd.DataFrame` where constructor fails when given dict with `None` value ([GH 14381](https://github.com/pandas-dev/pandas/issues/14381)) +* Fixed regression in `DatetimeIndex._maybe_cast_slice_bound` when index is empty ([GH 14354](https://github.com/pandas-dev/pandas/issues/14354)). +* Bug in localizing an ambiguous timezone when a boolean is passed ([GH 14402](https://github.com/pandas-dev/pandas/issues/14402)) +* Bug in `TimedeltaIndex` addition with a Datetime-like object where addition overflow in the negative direction was not being caught ([GH 14068](https://github.com/pandas-dev/pandas/issues/14068), [GH 14453](https://github.com/pandas-dev/pandas/issues/14453)) +* Bug in string indexing against data with `object` `Index` may raise `AttributeError` ([GH 14424](https://github.com/pandas-dev/pandas/issues/14424)) +* Correctly raise `ValueError` on empty input to `pd.eval()` and `df.query()` ([GH 13139](https://github.com/pandas-dev/pandas/issues/13139)) +* Bug in `RangeIndex.intersection` when result is a empty set ([GH 14364](https://github.com/pandas-dev/pandas/issues/14364)). +* Bug in groupby-transform broadcasting that could cause incorrect dtype coercion ([GH 14457](https://github.com/pandas-dev/pandas/issues/14457)) +* Bug in `Series.__setitem__` which allowed mutating read-only arrays ([GH 14359](https://github.com/pandas-dev/pandas/issues/14359)). +* Bug in `DataFrame.insert` where multiple calls with duplicate columns can fail ([GH 14291](https://github.com/pandas-dev/pandas/issues/14291)) +* `pd.merge()` will raise `ValueError` with non-boolean parameters in passed boolean type arguments ([GH 14434](https://github.com/pandas-dev/pandas/issues/14434)) +* Bug in `Timestamp` where dates very near the minimum (1677-09) could underflow on creation ([GH 14415](https://github.com/pandas-dev/pandas/issues/14415)) +* Bug in `pd.concat` where names of the `keys` were not propagated to the resulting `MultiIndex` ([GH 14252](https://github.com/pandas-dev/pandas/issues/14252)) +* Bug in `pd.concat` where `axis` cannot take string parameters `'rows'` or `'columns'` ([GH 14369](https://github.com/pandas-dev/pandas/issues/14369)) +* Bug in `pd.concat` with dataframes heterogeneous in length and tuple `keys` ([GH 14438](https://github.com/pandas-dev/pandas/issues/14438)) +* Bug in `MultiIndex.set_levels` where illegal level values were still set after raising an error ([GH 13754](https://github.com/pandas-dev/pandas/issues/13754)) +* Bug in `DataFrame.to_json` where `lines=True` and a value contained a `}` character ([GH 14391](https://github.com/pandas-dev/pandas/issues/14391)) +* Bug in `df.groupby` causing an `AttributeError` when grouping a single index frame by a column and the index level ([GH 14327](https://github.com/pandas-dev/pandas/issues/14327)) +* Bug in `df.groupby` where `TypeError` raised when `pd.Grouper(key=...)` is passed in a list ([GH 14334](https://github.com/pandas-dev/pandas/issues/14334)) +* Bug in `pd.pivot_table` may raise `TypeError` or `ValueError` when `index` or `columns` + is not scalar and `values` is not specified ([GH 14380](https://github.com/pandas-dev/pandas/issues/14380)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 30 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Adam Chainz + +* Anthonios Partheniou +* Arash Rouhani + +* Ben Kandel +* Brandon M. Burroughs + +* Chris +* Chris Warth +* David Krych + +* Iván Vallés Pérez + +* Jeff Reback +* Joe Jevnik +* Jon M. Mease + +* Jon Mease + +* Joris Van den Bossche +* Josh Owen + +* Keshav Ramaswamy + +* Larry Ren + +* Michael Felt + +* Piotr Chromiec + +* Robert Bradshaw + +* Sinhrks +* Thiago Serafim + +* Tom Bird +* bkandel + +* chris-b1 +* dubourg + +* gfyoung +* mattrijk + +* paul-mannino + +* sinhrks diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.19.2.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.19.2.md new file mode 100644 index 0000000000000000000000000000000000000000..f6067b0d604173b20ab009604ee3ba54ede845e4 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.19.2.md @@ -0,0 +1,113 @@ +# What's new in pandas 0.19.2 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.19.2.html + +# Version 0.19.2 (December 24, 2016)[#](#version-0-19-2-december-24-2016 "Link to this heading") + +This is a minor bug-fix release in the 0.19.x series and includes some small regression fixes, +bug fixes and performance improvements. +We recommend that all users upgrade to this version. + +Highlights include: + +* Compatibility with Python 3.6 +* Added a [Pandas Cheat Sheet](https://github.com/pandas-dev/pandas/tree/main/doc/cheatsheet/Pandas_Cheat_Sheet.pdf). ([GH 13202](https://github.com/pandas-dev/pandas/issues/13202)). + +What’s new in v0.19.2 + +* [Enhancements](#enhancements) +* [Performance improvements](#performance-improvements) +* [Bug fixes](#bug-fixes) +* [Contributors](#contributors) + +## Enhancements[#](#enhancements "Link to this heading") + +The `pd.merge_asof()`, added in 0.19.0, gained some improvements: + +* `pd.merge_asof()` gained `left_index`/`right_index` and `left_by`/`right_by` arguments ([GH 14253](https://github.com/pandas-dev/pandas/issues/14253)) +* `pd.merge_asof()` can take multiple columns in `by` parameter and has specialized dtypes for better performance ([GH 13936](https://github.com/pandas-dev/pandas/issues/13936)) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Performance regression with `PeriodIndex` ([GH 14822](https://github.com/pandas-dev/pandas/issues/14822)) +* Performance regression in indexing with getitem ([GH 14930](https://github.com/pandas-dev/pandas/issues/14930)) +* Improved performance of `.replace()` ([GH 12745](https://github.com/pandas-dev/pandas/issues/12745)) +* Improved performance `Series` creation with a datetime index and dictionary data ([GH 14894](https://github.com/pandas-dev/pandas/issues/14894)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Compat with python 3.6 for pickling of some offsets ([GH 14685](https://github.com/pandas-dev/pandas/issues/14685)) +* Compat with python 3.6 for some indexing exception types ([GH 14684](https://github.com/pandas-dev/pandas/issues/14684), [GH 14689](https://github.com/pandas-dev/pandas/issues/14689)) +* Compat with python 3.6 for deprecation warnings in the test suite ([GH 14681](https://github.com/pandas-dev/pandas/issues/14681)) +* Compat with python 3.6 for Timestamp pickles ([GH 14689](https://github.com/pandas-dev/pandas/issues/14689)) +* Compat with `dateutil==2.6.0`; segfault reported in the testing suite ([GH 14621](https://github.com/pandas-dev/pandas/issues/14621)) +* Allow `nanoseconds` in `Timestamp.replace` as a kwarg ([GH 14621](https://github.com/pandas-dev/pandas/issues/14621)) +* Bug in `pd.read_csv` in which aliasing was being done for `na_values` when passed in as a dictionary ([GH 14203](https://github.com/pandas-dev/pandas/issues/14203)) +* Bug in `pd.read_csv` in which column indices for a dict-like `na_values` were not being respected ([GH 14203](https://github.com/pandas-dev/pandas/issues/14203)) +* Bug in `pd.read_csv` where reading files fails, if the number of headers is equal to the number of lines in the file ([GH 14515](https://github.com/pandas-dev/pandas/issues/14515)) +* Bug in `pd.read_csv` for the Python engine in which an unhelpful error message was being raised when multi-char delimiters were not being respected with quotes ([GH 14582](https://github.com/pandas-dev/pandas/issues/14582)) +* Fix bugs ([GH 14734](https://github.com/pandas-dev/pandas/issues/14734), [GH 13654](https://github.com/pandas-dev/pandas/issues/13654)) in `pd.read_sas` and `pandas.io.sas.sas7bdat.SAS7BDATReader` that caused problems when reading a SAS file incrementally. +* Bug in `pd.read_csv` for the Python engine in which an unhelpful error message was being raised when `skipfooter` was not being respected by Python’s CSV library ([GH 13879](https://github.com/pandas-dev/pandas/issues/13879)) +* Bug in `.fillna()` in which timezone aware datetime64 values were incorrectly rounded ([GH 14872](https://github.com/pandas-dev/pandas/issues/14872)) +* Bug in `.groupby(..., sort=True)` of a non-lexsorted MultiIndex when grouping with multiple levels ([GH 14776](https://github.com/pandas-dev/pandas/issues/14776)) +* Bug in `pd.cut` with negative values and a single bin ([GH 14652](https://github.com/pandas-dev/pandas/issues/14652)) +* Bug in `pd.to_numeric` where a 0 was not unsigned on a `downcast='unsigned'` argument ([GH 14401](https://github.com/pandas-dev/pandas/issues/14401)) +* Bug in plotting regular and irregular timeseries using shared axes + (`sharex=True` or `ax.twinx()`) ([GH 13341](https://github.com/pandas-dev/pandas/issues/13341), [GH 14322](https://github.com/pandas-dev/pandas/issues/14322)). +* Bug in not propagating exceptions in parsing invalid datetimes, noted in python 3.6 ([GH 14561](https://github.com/pandas-dev/pandas/issues/14561)) +* Bug in resampling a `DatetimeIndex` in local TZ, covering a DST change, which would raise `AmbiguousTimeError` ([GH 14682](https://github.com/pandas-dev/pandas/issues/14682)) +* Bug in indexing that transformed `RecursionError` into `KeyError` or `IndexingError` ([GH 14554](https://github.com/pandas-dev/pandas/issues/14554)) +* Bug in `HDFStore` when writing a `MultiIndex` when using `data_columns=True` ([GH 14435](https://github.com/pandas-dev/pandas/issues/14435)) +* Bug in `HDFStore.append()` when writing a `Series` and passing a `min_itemsize` argument containing a value for the `index` ([GH 11412](https://github.com/pandas-dev/pandas/issues/11412)) +* Bug when writing to a `HDFStore` in `table` format with a `min_itemsize` value for the `index` and without asking to append ([GH 10381](https://github.com/pandas-dev/pandas/issues/10381)) +* Bug in `Series.groupby.nunique()` raising an `IndexError` for an empty `Series` ([GH 12553](https://github.com/pandas-dev/pandas/issues/12553)) +* Bug in `DataFrame.nlargest` and `DataFrame.nsmallest` when the index had duplicate values ([GH 13412](https://github.com/pandas-dev/pandas/issues/13412)) +* Bug in clipboard functions on linux with python2 with unicode and separators ([GH 13747](https://github.com/pandas-dev/pandas/issues/13747)) +* Bug in clipboard functions on Windows 10 and python 3 ([GH 14362](https://github.com/pandas-dev/pandas/issues/14362), [GH 12807](https://github.com/pandas-dev/pandas/issues/12807)) +* Bug in `.to_clipboard()` and Excel compat ([GH 12529](https://github.com/pandas-dev/pandas/issues/12529)) +* Bug in `DataFrame.combine_first()` for integer columns ([GH 14687](https://github.com/pandas-dev/pandas/issues/14687)). +* Bug in `pd.read_csv()` in which the `dtype` parameter was not being respected for empty data ([GH 14712](https://github.com/pandas-dev/pandas/issues/14712)) +* Bug in `pd.read_csv()` in which the `nrows` parameter was not being respected for large input when using the C engine for parsing ([GH 7626](https://github.com/pandas-dev/pandas/issues/7626)) +* Bug in `pd.merge_asof()` could not handle timezone-aware DatetimeIndex when a tolerance was specified ([GH 14844](https://github.com/pandas-dev/pandas/issues/14844)) +* Explicit check in `to_stata` and `StataWriter` for out-of-range values when writing doubles ([GH 14618](https://github.com/pandas-dev/pandas/issues/14618)) +* Bug in `.plot(kind='kde')` which did not drop missing values to generate the KDE Plot, instead generating an empty plot. ([GH 14821](https://github.com/pandas-dev/pandas/issues/14821)) +* Bug in `unstack()` if called with a list of column(s) as an argument, regardless of the dtypes of all columns, they get coerced to `object` ([GH 11847](https://github.com/pandas-dev/pandas/issues/11847)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 33 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Ajay Saxena + +* Ben Kandel +* Chris +* Chris Ham + +* Christopher C. Aycock +* Daniel Himmelstein + +* Dave Willmer + +* Dr-Irv +* Jeff Carey + +* Jeff Reback +* Joe Jevnik +* Joris Van den Bossche +* Julian Santander + +* Kerby Shedden +* Keshav Ramaswamy +* Kevin Sheppard +* Luca Scarabello + +* Matt Roeschke + +* Matti Picus + +* Maximilian Roos +* Mykola Golubyev + +* Nate Yoder + +* Nicholas Ver Halen + +* Pawel Kordek +* Pietro Battiston +* Rodolfo Fernandez + +* Tara Adiseshan + +* Tom Augspurger +* Yaroslav Halchenko +* gfyoung +* hesham.shabana@hotmail.com + +* sinhrks +* wandersoncferreira + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.20.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.20.1.md new file mode 100644 index 0000000000000000000000000000000000000000..36b4792d593450990a39bba41ff025681c9ded97 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.20.1.md @@ -0,0 +1,2342 @@ +# What's new in pandas 0.20.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.20.0.html + +# Version 0.20.1 (May 5, 2017)[#](#version-0-20-1-may-5-2017 "Link to this heading") + +This is a major release from 0.19.2 and includes a number of API changes, deprecations, new features, +enhancements, and performance improvements along with a large number of bug fixes. We recommend that all +users upgrade to this version. + +Highlights include: + +* New `.agg()` API for Series/DataFrame similar to the groupby-rolling-resample API’s, see [here](#whatsnew-0200-enhancements-agg) +* Integration with the `feather-format`, including a new top-level `pd.read_feather()` and `DataFrame.to_feather()` method, see [here](../user_guide/io.html#io-feather). +* The `.ix` indexer has been deprecated, see [here](#whatsnew-0200-api-breaking-deprecate-ix) +* `Panel` has been deprecated, see [here](#whatsnew-0200-api-breaking-deprecate-panel) +* Addition of an `IntervalIndex` and `Interval` scalar type, see [here](#whatsnew-0200-enhancements-intervalindex) +* Improved user API when grouping by index levels in `.groupby()`, see [here](#whatsnew-0200-enhancements-groupby-access) +* Improved support for `UInt64` dtypes, see [here](#whatsnew-0200-enhancements-uint64-support) +* A new orient for JSON serialization, `orient='table'`, that uses the Table Schema spec and that gives the possibility for a more interactive repr in the Jupyter Notebook, see [here](#whatsnew-0200-enhancements-table-schema) +* Experimental support for exporting styled DataFrames (`DataFrame.style`) to Excel, see [here](#whatsnew-0200-enhancements-style-excel) +* Window binary corr/cov operations now return a MultiIndexed `DataFrame` rather than a `Panel`, as `Panel` is now deprecated, see [here](#whatsnew-0200-api-breaking-rolling-pairwise) +* Support for S3 handling now uses `s3fs`, see [here](#whatsnew-0200-api-breaking-s3) +* Google BigQuery support now uses the `pandas-gbq` library, see [here](#whatsnew-0200-api-breaking-gbq) + +Warning + +pandas has changed the internal structure and layout of the code base. +This can affect imports that are not from the top-level `pandas.*` namespace, please see the changes [here](#whatsnew-0200-privacy). + +Check the [API Changes](#whatsnew-0200-api-breaking) and [deprecations](#whatsnew-0200-deprecations) before updating. + +Note + +This is a combined release for 0.20.0 and 0.20.1. +Version 0.20.1 contains one additional change for backwards-compatibility with downstream projects using pandas’ `utils` routines. ([GH 16250](https://github.com/pandas-dev/pandas/issues/16250)) + +What’s new in v0.20.0 + +* [New features](#new-features) + + + [Method `agg` API for DataFrame/Series](#method-agg-api-for-dataframe-series) + + [Keyword argument `dtype` for data IO](#keyword-argument-dtype-for-data-io) + + [Method `.to_datetime()` has gained an `origin` parameter](#method-to-datetime-has-gained-an-origin-parameter) + + [GroupBy enhancements](#groupby-enhancements) + + [Better support for compressed URLs in `read_csv`](#better-support-for-compressed-urls-in-read-csv) + + [Pickle file IO now supports compression](#pickle-file-io-now-supports-compression) + + [UInt64 support improved](#uint64-support-improved) + + [GroupBy on categoricals](#groupby-on-categoricals) + + [Table schema output](#table-schema-output) + + [SciPy sparse matrix from/to SparseDataFrame](#scipy-sparse-matrix-from-to-sparsedataframe) + + [Excel output for styled DataFrames](#excel-output-for-styled-dataframes) + + [IntervalIndex](#intervalindex) + + [Other enhancements](#other-enhancements) +* [Backwards incompatible API changes](#backwards-incompatible-api-changes) + + + [Possible incompatibility for HDF5 formats created with pandas < 0.13.0](#possible-incompatibility-for-hdf5-formats-created-with-pandas-0-13-0) + + [Map on Index types now return other Index types](#map-on-index-types-now-return-other-index-types) + + [Accessing datetime fields of Index now return Index](#accessing-datetime-fields-of-index-now-return-index) + + [pd.unique will now be consistent with extension types](#pd-unique-will-now-be-consistent-with-extension-types) + + [S3 file handling](#s3-file-handling) + + [Partial string indexing changes](#partial-string-indexing-changes) + + [Concat of different float dtypes will not automatically upcast](#concat-of-different-float-dtypes-will-not-automatically-upcast) + + [pandas Google BigQuery support has moved](#pandas-google-bigquery-support-has-moved) + + [Memory usage for Index is more accurate](#memory-usage-for-index-is-more-accurate) + + [DataFrame.sort\_index changes](#dataframe-sort-index-changes) + + [GroupBy describe formatting](#groupby-describe-formatting) + + [Window binary corr/cov operations return a MultiIndex DataFrame](#window-binary-corr-cov-operations-return-a-multiindex-dataframe) + + [HDFStore where string comparison](#hdfstore-where-string-comparison) + + [Index.intersection and inner join now preserve the order of the left Index](#index-intersection-and-inner-join-now-preserve-the-order-of-the-left-index) + + [Pivot table always returns a DataFrame](#pivot-table-always-returns-a-dataframe) + + [Other API changes](#other-api-changes) +* [Reorganization of the library: privacy changes](#reorganization-of-the-library-privacy-changes) + + + [Modules privacy has changed](#modules-privacy-has-changed) + + [`pandas.errors`](#pandas-errors) + + [`pandas.testing`](#pandas-testing) + + [`pandas.plotting`](#pandas-plotting) + + [Other development changes](#other-development-changes) +* [Deprecations](#deprecations) + + + [Deprecate `.ix`](#deprecate-ix) + + [Deprecate Panel](#deprecate-panel) + + [Deprecate groupby.agg() with a dictionary when renaming](#deprecate-groupby-agg-with-a-dictionary-when-renaming) + + [Deprecate .plotting](#deprecate-plotting) + + [Other deprecations](#other-deprecations) +* [Removal of prior version deprecations/changes](#removal-of-prior-version-deprecations-changes) +* [Performance improvements](#performance-improvements) +* [Bug fixes](#bug-fixes) + + + [Conversion](#conversion) + + [Indexing](#indexing) + + [IO](#io) + + [Plotting](#plotting) + + [GroupBy/resample/rolling](#groupby-resample-rolling) + + [Sparse](#sparse) + + [Reshaping](#reshaping) + + [Numeric](#numeric) + + [Other](#other) +* [Contributors](#contributors) + +## New features[#](#new-features "Link to this heading") + +### Method `agg` API for DataFrame/Series[#](#method-agg-api-for-dataframe-series "Link to this heading") + +Series & DataFrame have been enhanced to support the aggregation API. This is a familiar API +from groupby, window operations, and resampling. This allows aggregation operations in a concise way +by using [`agg()`](../reference/api/pandas.DataFrame.agg.html#pandas.DataFrame.agg "pandas.DataFrame.agg") and [`transform()`](../reference/api/pandas.DataFrame.transform.html#pandas.DataFrame.transform "pandas.DataFrame.transform"). The full documentation +is [here](../user_guide/basics.html#basics-aggregate) ([GH 1623](https://github.com/pandas-dev/pandas/issues/1623)). + +Here is a sample + +```None +In [1]: df = pd.DataFrame(np.random.randn(10, 3), columns=['A', 'B', 'C'], + ...: index=pd.date_range('1/1/2000', periods=10)) + ...: + +In [2]: df.iloc[3:7] = np.nan + +In [3]: df +Out[3]: + A B C +2000-01-01 0.469112 -0.282863 -1.509059 +2000-01-02 -1.135632 1.212112 -0.173215 +2000-01-03 0.119209 -1.044236 -0.861849 +2000-01-04 NaN NaN NaN +2000-01-05 NaN NaN NaN +2000-01-06 NaN NaN NaN +2000-01-07 NaN NaN NaN +2000-01-08 0.113648 -1.478427 0.524988 +2000-01-09 0.404705 0.577046 -1.715002 +2000-01-10 -1.039268 -0.370647 -1.157892 + +[10 rows x 3 columns] +``` + +One can operate using string function names, callables, lists, or dictionaries of these. + +Using a single function is equivalent to `.apply`. + +```None +In [4]: df.agg('sum') +Out[4]: +A -1.068226 +B -1.387015 +C -4.892029 +Length: 3, dtype: float64 +``` + +Multiple aggregations with a list of functions. + +```None +In [5]: df.agg(['sum', 'min']) +Out[5]: + A B C +sum -1.068226 -1.387015 -4.892029 +min -1.135632 -1.478427 -1.715002 + +[2 rows x 3 columns] +``` + +Using a dict provides the ability to apply specific aggregations per column. +You will get a matrix-like output of all of the aggregators. The output has one column +per unique function. Those functions applied to a particular column will be `NaN`: + +```None +In [6]: df.agg({'A': ['sum', 'min'], 'B': ['min', 'max']}) +Out[6]: + A B +sum -1.068226 NaN +min -1.135632 -1.478427 +max NaN 1.212112 + +[3 rows x 2 columns] +``` + +The API also supports a `.transform()` function for broadcasting results. + +```None +In [7]: df.transform(['abs', lambda x: x - x.min()]) +Out[7]: + A B C + abs abs abs +2000-01-01 0.469112 1.604745 0.282863 1.195563 1.509059 0.205944 +2000-01-02 1.135632 0.000000 1.212112 2.690539 0.173215 1.541787 +2000-01-03 0.119209 1.254841 1.044236 0.434191 0.861849 0.853153 +2000-01-04 NaN NaN NaN NaN NaN NaN +2000-01-05 NaN NaN NaN NaN NaN NaN +2000-01-06 NaN NaN NaN NaN NaN NaN +2000-01-07 NaN NaN NaN NaN NaN NaN +2000-01-08 0.113648 1.249281 1.478427 0.000000 0.524988 2.239990 +2000-01-09 0.404705 1.540338 0.577046 2.055473 1.715002 0.000000 +2000-01-10 1.039268 0.096364 0.370647 1.107780 1.157892 0.557110 + +[10 rows x 6 columns] +``` + +When presented with mixed dtypes that cannot be aggregated, `.agg()` will only take the valid +aggregations. This is similar to how groupby `.agg()` works. ([GH 15015](https://github.com/pandas-dev/pandas/issues/15015)) + +```None +In [8]: df = pd.DataFrame({'A': [1, 2, 3], + ...: 'B': [1., 2., 3.], + ...: 'C': ['foo', 'bar', 'baz'], + ...: 'D': pd.date_range('20130101', periods=3)}) + ...: + +In [9]: df.dtypes +Out[9]: +A int64 +B float64 +C object +D datetime64[ns] +Length: 4, dtype: object +``` + +```None +In [10]: df.agg(['min', 'sum']) +Out[10]: + A B C D +min 1 1.0 bar 2013-01-01 +sum 6 6.0 foobarbaz NaT +``` + +### Keyword argument `dtype` for data IO[#](#keyword-argument-dtype-for-data-io "Link to this heading") + +The `'python'` engine for [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv"), as well as the [`read_fwf()`](../reference/api/pandas.read_fwf.html#pandas.read_fwf "pandas.read_fwf") function for parsing +fixed-width text files and [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") for parsing Excel files, now accept the `dtype` keyword argument for specifying the types of specific columns ([GH 14295](https://github.com/pandas-dev/pandas/issues/14295)). See the [io docs](../user_guide/io.html#io-dtypes) for more information. + +```None +In [10]: data = "a b\n1 2\n3 4" + +In [11]: pd.read_fwf(StringIO(data)).dtypes +Out[11]: +a int64 +b int64 +Length: 2, dtype: object + +In [12]: pd.read_fwf(StringIO(data), dtype={'a': 'float64', 'b': 'object'}).dtypes +Out[12]: +a float64 +b object +Length: 2, dtype: object +``` + +### Method `.to_datetime()` has gained an `origin` parameter[#](#method-to-datetime-has-gained-an-origin-parameter "Link to this heading") + +[`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") has gained a new parameter, `origin`, to define a reference date +from where to compute the resulting timestamps when parsing numerical values with a specific `unit` specified. ([GH 11276](https://github.com/pandas-dev/pandas/issues/11276), [GH 11745](https://github.com/pandas-dev/pandas/issues/11745)) + +For example, with 1960-01-01 as the starting date: + +```None +In [13]: pd.to_datetime([1, 2, 3], unit='D', origin=pd.Timestamp('1960-01-01')) +Out[13]: DatetimeIndex(['1960-01-02', '1960-01-03', '1960-01-04'], dtype='datetime64[ns]', freq=None) +``` + +The default is set at `origin='unix'`, which defaults to `1970-01-01 00:00:00`, which is +commonly called ‘unix epoch’ or POSIX time. This was the previous default, so this is a backward compatible change. + +```None +In [14]: pd.to_datetime([1, 2, 3], unit='D') +Out[14]: DatetimeIndex(['1970-01-02', '1970-01-03', '1970-01-04'], dtype='datetime64[ns]', freq=None) +``` + +### GroupBy enhancements[#](#groupby-enhancements "Link to this heading") + +Strings passed to `DataFrame.groupby()` as the `by` parameter may now reference either column names or index level names. Previously, only column names could be referenced. This allows to easily group by a column and index level at the same time. ([GH 5677](https://github.com/pandas-dev/pandas/issues/5677)) + +```None +In [15]: arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'], + ....: ['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']] + ....: + +In [16]: index = pd.MultiIndex.from_arrays(arrays, names=['first', 'second']) + +In [17]: df = pd.DataFrame({'A': [1, 1, 1, 1, 2, 2, 3, 3], + ....: 'B': np.arange(8)}, + ....: index=index) + ....: + +In [18]: df +Out[18]: + A B +first second +bar one 1 0 + two 1 1 +baz one 1 2 + two 1 3 +foo one 2 4 + two 2 5 +qux one 3 6 + two 3 7 + +[8 rows x 2 columns] + +In [19]: df.groupby(['second', 'A']).sum() +Out[19]: + B +second A +one 1 2 + 2 4 + 3 6 +two 1 4 + 2 5 + 3 7 + +[6 rows x 1 columns] +``` + +### Better support for compressed URLs in `read_csv`[#](#better-support-for-compressed-urls-in-read-csv "Link to this heading") + +The compression code was refactored ([GH 12688](https://github.com/pandas-dev/pandas/issues/12688)). As a result, reading +dataframes from URLs in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") or [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") now supports +additional compression methods: `xz`, `bz2`, and `zip` ([GH 14570](https://github.com/pandas-dev/pandas/issues/14570)). +Previously, only `gzip` compression was supported. By default, compression of +URLs and paths are now inferred using their file extensions. Additionally, +support for bz2 compression in the python 2 C-engine improved ([GH 14874](https://github.com/pandas-dev/pandas/issues/14874)). + +```None +In [20]: url = ('https://github.com/{repo}/raw/{branch}/{path}' + ....: .format(repo='pandas-dev/pandas', + ....: branch='main', + ....: path='pandas/tests/io/parser/data/salaries.csv.bz2')) + ....: + +# default, infer compression +In [21]: df = pd.read_csv(url, sep='\t', compression='infer') + +# explicitly specify compression +In [22]: df = pd.read_csv(url, sep='\t', compression='bz2') + +In [23]: df.head(2) +Out[23]: + S X E M +0 13876 1 1 1 +1 11608 1 3 0 + +[2 rows x 4 columns] +``` + +### Pickle file IO now supports compression[#](#pickle-file-io-now-supports-compression "Link to this heading") + +[`read_pickle()`](../reference/api/pandas.read_pickle.html#pandas.read_pickle "pandas.read_pickle"), [`DataFrame.to_pickle()`](../reference/api/pandas.DataFrame.to_pickle.html#pandas.DataFrame.to_pickle "pandas.DataFrame.to_pickle") and [`Series.to_pickle()`](../reference/api/pandas.Series.to_pickle.html#pandas.Series.to_pickle "pandas.Series.to_pickle") +can now read from and write to compressed pickle files. Compression methods +can be an explicit parameter or be inferred from the file extension. +See [the docs here.](../user_guide/io.html#io-pickle-compression) + +```None +In [24]: df = pd.DataFrame({'A': np.random.randn(1000), + ....: 'B': 'foo', + ....: 'C': pd.date_range('20130101', periods=1000, freq='s')}) + ....: +``` + +Using an explicit compression type + +```None +In [25]: df.to_pickle("data.pkl.compress", compression="gzip") + +In [26]: rt = pd.read_pickle("data.pkl.compress", compression="gzip") + +In [27]: rt.head() +Out[27]: + A B C +0 -1.344312 foo 2013-01-01 00:00:00 +1 0.844885 foo 2013-01-01 00:00:01 +2 1.075770 foo 2013-01-01 00:00:02 +3 -0.109050 foo 2013-01-01 00:00:03 +4 1.643563 foo 2013-01-01 00:00:04 + +[5 rows x 3 columns] +``` + +The default is to infer the compression type from the extension (`compression='infer'`): + +```None +In [28]: df.to_pickle("data.pkl.gz") + +In [29]: rt = pd.read_pickle("data.pkl.gz") + +In [30]: rt.head() +Out[30]: + A B C +0 -1.344312 foo 2013-01-01 00:00:00 +1 0.844885 foo 2013-01-01 00:00:01 +2 1.075770 foo 2013-01-01 00:00:02 +3 -0.109050 foo 2013-01-01 00:00:03 +4 1.643563 foo 2013-01-01 00:00:04 + +[5 rows x 3 columns] + +In [31]: df["A"].to_pickle("s1.pkl.bz2") + +In [32]: rt = pd.read_pickle("s1.pkl.bz2") + +In [33]: rt.head() +Out[33]: +0 -1.344312 +1 0.844885 +2 1.075770 +3 -0.109050 +4 1.643563 +Name: A, Length: 5, dtype: float64 +``` + +### UInt64 support improved[#](#uint64-support-improved "Link to this heading") + +pandas has significantly improved support for operations involving unsigned, +or purely non-negative, integers. Previously, handling these integers would +result in improper rounding or data-type casting, leading to incorrect results. +Notably, a new numerical index, `UInt64Index`, has been created ([GH 14937](https://github.com/pandas-dev/pandas/issues/14937)) + +```None +In [1]: idx = pd.UInt64Index([1, 2, 3]) +In [2]: df = pd.DataFrame({'A': ['a', 'b', 'c']}, index=idx) +In [3]: df.index +Out[3]: UInt64Index([1, 2, 3], dtype='uint64') +``` + +* Bug in converting object elements of array-like objects to unsigned 64-bit integers ([GH 4471](https://github.com/pandas-dev/pandas/issues/4471), [GH 14982](https://github.com/pandas-dev/pandas/issues/14982)) +* Bug in `Series.unique()` in which unsigned 64-bit integers were causing overflow ([GH 14721](https://github.com/pandas-dev/pandas/issues/14721)) +* Bug in `DataFrame` construction in which unsigned 64-bit integer elements were being converted to objects ([GH 14881](https://github.com/pandas-dev/pandas/issues/14881)) +* Bug in `pd.read_csv()` in which unsigned 64-bit integer elements were being improperly converted to the wrong data types ([GH 14983](https://github.com/pandas-dev/pandas/issues/14983)) +* Bug in `pd.unique()` in which unsigned 64-bit integers were causing overflow ([GH 14915](https://github.com/pandas-dev/pandas/issues/14915)) +* Bug in `pd.value_counts()` in which unsigned 64-bit integers were being erroneously truncated in the output ([GH 14934](https://github.com/pandas-dev/pandas/issues/14934)) + +### GroupBy on categoricals[#](#groupby-on-categoricals "Link to this heading") + +In previous versions, `.groupby(..., sort=False)` would fail with a `ValueError` when grouping on a categorical series with some categories not appearing in the data. ([GH 13179](https://github.com/pandas-dev/pandas/issues/13179)) + +```None +In [34]: chromosomes = np.r_[np.arange(1, 23).astype(str), ['X', 'Y']] + +In [35]: df = pd.DataFrame({ + ....: 'A': np.random.randint(100), + ....: 'B': np.random.randint(100), + ....: 'C': np.random.randint(100), + ....: 'chromosomes': pd.Categorical(np.random.choice(chromosomes, 100), + ....: categories=chromosomes, + ....: ordered=True)}) + ....: + +In [36]: df +Out[36]: + A B C chromosomes +0 87 22 81 4 +1 87 22 81 13 +2 87 22 81 22 +3 87 22 81 2 +4 87 22 81 6 +.. .. .. .. ... +95 87 22 81 8 +96 87 22 81 11 +97 87 22 81 X +98 87 22 81 1 +99 87 22 81 19 + +[100 rows x 4 columns] +``` + +**Previous behavior**: + +```None +In [3]: df[df.chromosomes != '1'].groupby('chromosomes', observed=False, sort=False).sum() +--------------------------------------------------------------------------- +ValueError: items in new_categories are not the same as in old categories +``` + +**New behavior**: + +```None +In [37]: df[df.chromosomes != '1'].groupby('chromosomes', observed=False, sort=False).sum() +Out[37]: + A B C +chromosomes +4 348 88 324 +13 261 66 243 +22 348 88 324 +2 348 88 324 +6 174 44 162 +... ... .. ... +3 348 88 324 +11 348 88 324 +19 174 44 162 +1 0 0 0 +21 0 0 0 + +[24 rows x 3 columns] +``` + +### Table schema output[#](#table-schema-output "Link to this heading") + +The new orient `'table'` for [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") +will generate a [Table Schema](http://specs.frictionlessdata.io/json-table-schema/) compatible string representation of +the data. + +```None +In [38]: df = pd.DataFrame( + ....: {'A': [1, 2, 3], + ....: 'B': ['a', 'b', 'c'], + ....: 'C': pd.date_range('2016-01-01', freq='d', periods=3)}, + ....: index=pd.Index(range(3), name='idx')) + ....: + +In [39]: df +Out[39]: + A B C +idx +0 1 a 2016-01-01 +1 2 b 2016-01-02 +2 3 c 2016-01-03 + +[3 rows x 3 columns] + +In [40]: df.to_json(orient='table') +Out[40]: '{"schema":{"fields":[{"name":"idx","type":"integer"},{"name":"A","type":"integer"},{"name":"B","type":"string"},{"name":"C","type":"datetime"}],"primaryKey":["idx"],"pandas_version":"1.4.0"},"data":[{"idx":0,"A":1,"B":"a","C":"2016-01-01T00:00:00.000"},{"idx":1,"A":2,"B":"b","C":"2016-01-02T00:00:00.000"},{"idx":2,"A":3,"B":"c","C":"2016-01-03T00:00:00.000"}]}' +``` + +See [IO: Table Schema for more information](../user_guide/io.html#io-table-schema). + +Additionally, the repr for `DataFrame` and `Series` can now publish +this JSON Table schema representation of the Series or DataFrame if you are +using IPython (or another frontend like [nteract](https://nteract.io/) using the Jupyter messaging +protocol). +This gives frontends like the Jupyter notebook and [nteract](https://nteract.io/) +more flexibility in how they display pandas objects, since they have +more information about the data. +You must enable this by setting the `display.html.table_schema` option to `True`. + +### SciPy sparse matrix from/to SparseDataFrame[#](#scipy-sparse-matrix-from-to-sparsedataframe "Link to this heading") + +pandas now supports creating sparse dataframes directly from `scipy.sparse.spmatrix` instances. +See the [documentation](../user_guide/sparse.html#sparse-scipysparse) for more information. ([GH 4343](https://github.com/pandas-dev/pandas/issues/4343)) + +All sparse formats are supported, but matrices that are not in [`COOrdinate`](https://docs.scipy.org/doc/scipy/reference/sparse.html#module-scipy.sparse "(in SciPy v1.16.2)") format will be converted, copying data as needed. + +```None +from scipy.sparse import csr_matrix +arr = np.random.random(size=(1000, 5)) +arr[arr < .9] = 0 +sp_arr = csr_matrix(arr) +sp_arr +sdf = pd.SparseDataFrame(sp_arr) +sdf +``` + +To convert a `SparseDataFrame` back to sparse SciPy matrix in COO format, you can use: + +```None +sdf.to_coo() +``` + +### Excel output for styled DataFrames[#](#excel-output-for-styled-dataframes "Link to this heading") + +Experimental support has been added to export `DataFrame.style` formats to Excel using the `openpyxl` engine. ([GH 15530](https://github.com/pandas-dev/pandas/issues/15530)) + +For example, after running the following, `styled.xlsx` renders as below: + +```None +In [41]: np.random.seed(24) + +In [42]: df = pd.DataFrame({'A': np.linspace(1, 10, 10)}) + +In [43]: df = pd.concat([df, pd.DataFrame(np.random.RandomState(24).randn(10, 4), + ....: columns=list('BCDE'))], + ....: axis=1) + ....: + +In [44]: df.iloc[0, 2] = np.nan + +In [45]: df +Out[45]: + A B C D E +0 1.0 1.329212 NaN -0.316280 -0.990810 +1 2.0 -1.070816 -1.438713 0.564417 0.295722 +2 3.0 -1.626404 0.219565 0.678805 1.889273 +3 4.0 0.961538 0.104011 -0.481165 0.850229 +4 5.0 1.453425 1.057737 0.165562 0.515018 +5 6.0 -1.336936 0.562861 1.392855 -0.063328 +6 7.0 0.121668 1.207603 -0.002040 1.627796 +7 8.0 0.354493 1.037528 -0.385684 0.519818 +8 9.0 1.686583 -1.325963 1.428984 -2.089354 +9 10.0 -0.129820 0.631523 -0.586538 0.290720 + +[10 rows x 5 columns] + +In [46]: styled = (df.style + ....: .applymap(lambda val: 'color:red;' if val < 0 else 'color:black;') + ....: .highlight_max()) + ....: + +In [47]: styled.to_excel('styled.xlsx', engine='openpyxl') +``` + +![../_images/style-excel.png](../_images/style-excel.png) + +See the [Style documentation](../user_guide/style.html#Export-to-Excel) for more detail. + +### IntervalIndex[#](#intervalindex "Link to this heading") + +pandas has gained an `IntervalIndex` with its own dtype, `interval` as well as the `Interval` scalar type. These allow first-class support for interval +notation, specifically as a return type for the categories in [`cut()`](../reference/api/pandas.cut.html#pandas.cut "pandas.cut") and [`qcut()`](../reference/api/pandas.qcut.html#pandas.qcut "pandas.qcut"). The `IntervalIndex` allows some unique indexing, see the +[docs](../user_guide/advanced.html#advanced-intervalindex). ([GH 7640](https://github.com/pandas-dev/pandas/issues/7640), [GH 8625](https://github.com/pandas-dev/pandas/issues/8625)) + +Warning + +These indexing behaviors of the IntervalIndex are provisional and may change in a future version of pandas. Feedback on usage is welcome. + +Previous behavior: + +The returned categories were strings, representing Intervals + +```None +In [1]: c = pd.cut(range(4), bins=2) + +In [2]: c +Out[2]: +[(-0.003, 1.5], (-0.003, 1.5], (1.5, 3], (1.5, 3]] +Categories (2, object): [(-0.003, 1.5] < (1.5, 3]] + +In [3]: c.categories +Out[3]: Index(['(-0.003, 1.5]', '(1.5, 3]'], dtype='object') +``` + +New behavior: + +```None +In [48]: c = pd.cut(range(4), bins=2) + +In [49]: c +Out[49]: +[(-0.003, 1.5], (-0.003, 1.5], (1.5, 3.0], (1.5, 3.0]] +Categories (2, interval[float64, right]): [(-0.003, 1.5] < (1.5, 3.0]] + +In [50]: c.categories +Out[50]: IntervalIndex([(-0.003, 1.5], (1.5, 3.0]], dtype='interval[float64, right]') +``` + +Furthermore, this allows one to bin *other* data with these same bins, with `NaN` representing a missing +value similar to other dtypes. + +```None +In [51]: pd.cut([0, 3, 5, 1], bins=c.categories) +Out[51]: +[(-0.003, 1.5], (1.5, 3.0], NaN, (-0.003, 1.5]] +Categories (2, interval[float64, right]): [(-0.003, 1.5] < (1.5, 3.0]] +``` + +An `IntervalIndex` can also be used in `Series` and `DataFrame` as the index. + +```None +In [52]: df = pd.DataFrame({'A': range(4), + ....: 'B': pd.cut([0, 3, 1, 1], bins=c.categories) + ....: }).set_index('B') + ....: + +In [53]: df +Out[53]: + A +B +(-0.003, 1.5] 0 +(1.5, 3.0] 1 +(-0.003, 1.5] 2 +(-0.003, 1.5] 3 + +[4 rows x 1 columns] +``` + +Selecting via a specific interval: + +```None +In [54]: df.loc[pd.Interval(1.5, 3.0)] +Out[54]: +A 1 +Name: (1.5, 3.0], Length: 1, dtype: int64 +``` + +Selecting via a scalar value that is contained *in* the intervals. + +```None +In [55]: df.loc[0] +Out[55]: + A +B +(-0.003, 1.5] 0 +(-0.003, 1.5] 2 +(-0.003, 1.5] 3 + +[3 rows x 1 columns] +``` + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* `DataFrame.rolling()` now accepts the parameter `closed='right'|'left'|'both'|'neither'` to choose the rolling window-endpoint closedness. See the [documentation](../user_guide/window.html#window-endpoints) ([GH 13965](https://github.com/pandas-dev/pandas/issues/13965)) +* Integration with the `feather-format`, including a new top-level `pd.read_feather()` and `DataFrame.to_feather()` method, see [here](../user_guide/io.html#io-feather). +* `Series.str.replace()` now accepts a callable, as replacement, which is passed to `re.sub` ([GH 15055](https://github.com/pandas-dev/pandas/issues/15055)) +* `Series.str.replace()` now accepts a compiled regular expression as a pattern ([GH 15446](https://github.com/pandas-dev/pandas/issues/15446)) +* `Series.sort_index` accepts parameters `kind` and `na_position` ([GH 13589](https://github.com/pandas-dev/pandas/issues/13589), [GH 14444](https://github.com/pandas-dev/pandas/issues/14444)) +* `DataFrame` and `DataFrame.groupby()` have gained a `nunique()` method to count the distinct values over an axis ([GH 14336](https://github.com/pandas-dev/pandas/issues/14336), [GH 15197](https://github.com/pandas-dev/pandas/issues/15197)). +* `DataFrame` has gained a `melt()` method, equivalent to `pd.melt()`, for unpivoting from a wide to long format ([GH 12640](https://github.com/pandas-dev/pandas/issues/12640)). +* `pd.read_excel()` now preserves sheet order when using `sheetname=None` ([GH 9930](https://github.com/pandas-dev/pandas/issues/9930)) +* Multiple offset aliases with decimal points are now supported (e.g. `0.5min` is parsed as `30s`) ([GH 8419](https://github.com/pandas-dev/pandas/issues/8419)) +* `.isnull()` and `.notnull()` have been added to `Index` object to make them more consistent with the `Series` API ([GH 15300](https://github.com/pandas-dev/pandas/issues/15300)) +* New `UnsortedIndexError` (subclass of `KeyError`) raised when indexing/slicing into an + unsorted MultiIndex ([GH 11897](https://github.com/pandas-dev/pandas/issues/11897)). This allows differentiation between errors due to lack + of sorting or an incorrect key. See [here](../user_guide/advanced.html#advanced-unsorted) +* `MultiIndex` has gained a `.to_frame()` method to convert to a `DataFrame` ([GH 12397](https://github.com/pandas-dev/pandas/issues/12397)) +* `pd.cut` and `pd.qcut` now support datetime64 and timedelta64 dtypes ([GH 14714](https://github.com/pandas-dev/pandas/issues/14714), [GH 14798](https://github.com/pandas-dev/pandas/issues/14798)) +* `pd.qcut` has gained the `duplicates='raise'|'drop'` option to control whether to raise on duplicated edges ([GH 7751](https://github.com/pandas-dev/pandas/issues/7751)) +* `Series` provides a `to_excel` method to output Excel files ([GH 8825](https://github.com/pandas-dev/pandas/issues/8825)) +* The `usecols` argument in `pd.read_csv()` now accepts a callable function as a value ([GH 14154](https://github.com/pandas-dev/pandas/issues/14154)) +* The `skiprows` argument in `pd.read_csv()` now accepts a callable function as a value ([GH 10882](https://github.com/pandas-dev/pandas/issues/10882)) +* The `nrows` and `chunksize` arguments in `pd.read_csv()` are supported if both are passed ([GH 6774](https://github.com/pandas-dev/pandas/issues/6774), [GH 15755](https://github.com/pandas-dev/pandas/issues/15755)) +* `DataFrame.plot` now prints a title above each subplot if `suplots=True` and `title` is a list of strings ([GH 14753](https://github.com/pandas-dev/pandas/issues/14753)) +* `DataFrame.plot` can pass the matplotlib 2.0 default color cycle as a single string as color parameter, see [here](http://matplotlib.org/2.0.0/users/colors.html#cn-color-selection). ([GH 15516](https://github.com/pandas-dev/pandas/issues/15516)) +* `Series.interpolate()` now supports timedelta as an index type with `method='time'` ([GH 6424](https://github.com/pandas-dev/pandas/issues/6424)) +* Addition of a `level` keyword to `DataFrame/Series.rename` to rename + labels in the specified level of a MultiIndex ([GH 4160](https://github.com/pandas-dev/pandas/issues/4160)). +* `DataFrame.reset_index()` will now interpret a tuple `index.name` as a key spanning across levels of `columns`, if this is a `MultiIndex` ([GH 16164](https://github.com/pandas-dev/pandas/issues/16164)) +* `Timedelta.isoformat` method added for formatting Timedeltas as an [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations). See the [Timedelta docs](../user_guide/timedeltas.html#timedeltas-isoformat) ([GH 15136](https://github.com/pandas-dev/pandas/issues/15136)) +* `.select_dtypes()` now allows the string `datetimetz` to generically select datetimes with tz ([GH 14910](https://github.com/pandas-dev/pandas/issues/14910)) +* The `.to_latex()` method will now accept `multicolumn` and `multirow` arguments to use the accompanying LaTeX enhancements +* `pd.merge_asof()` gained the option `direction='backward'|'forward'|'nearest'` ([GH 14887](https://github.com/pandas-dev/pandas/issues/14887)) +* `Series/DataFrame.asfreq()` have gained a `fill_value` parameter, to fill missing values ([GH 3715](https://github.com/pandas-dev/pandas/issues/3715)). +* `Series/DataFrame.resample.asfreq` have gained a `fill_value` parameter, to fill missing values during resampling ([GH 3715](https://github.com/pandas-dev/pandas/issues/3715)). +* [`pandas.util.hash_pandas_object()`](../reference/api/pandas.util.hash_pandas_object.html#pandas.util.hash_pandas_object "pandas.util.hash_pandas_object") has gained the ability to hash a `MultiIndex` ([GH 15224](https://github.com/pandas-dev/pandas/issues/15224)) +* `Series/DataFrame.squeeze()` have gained the `axis` parameter. ([GH 15339](https://github.com/pandas-dev/pandas/issues/15339)) +* `DataFrame.to_excel()` has a new `freeze_panes` parameter to turn on Freeze Panes when exporting to Excel ([GH 15160](https://github.com/pandas-dev/pandas/issues/15160)) +* `pd.read_html()` will parse multiple header rows, creating a MultiIndex header. ([GH 13434](https://github.com/pandas-dev/pandas/issues/13434)). +* HTML table output skips `colspan` or `rowspan` attribute if equal to 1. ([GH 15403](https://github.com/pandas-dev/pandas/issues/15403)) +* [`pandas.io.formats.style.Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") template now has blocks for easier extension, see the [example notebook](../user_guide/style.html#Subclassing) ([GH 15649](https://github.com/pandas-dev/pandas/issues/15649)) +* `Styler.render()` now accepts `**kwargs` to allow user-defined variables in the template ([GH 15649](https://github.com/pandas-dev/pandas/issues/15649)) +* Compatibility with Jupyter notebook 5.0; MultiIndex column labels are left-aligned and MultiIndex row-labels are top-aligned ([GH 15379](https://github.com/pandas-dev/pandas/issues/15379)) +* `TimedeltaIndex` now has a custom date-tick formatter specifically designed for nanosecond level precision ([GH 8711](https://github.com/pandas-dev/pandas/issues/8711)) +* `pd.api.types.union_categoricals` gained the `ignore_ordered` argument to allow ignoring the ordered attribute of unioned categoricals ([GH 13410](https://github.com/pandas-dev/pandas/issues/13410)). See the [categorical union docs](../user_guide/categorical.html#categorical-union) for more information. +* `DataFrame.to_latex()` and `DataFrame.to_string()` now allow optional header aliases. ([GH 15536](https://github.com/pandas-dev/pandas/issues/15536)) +* Re-enable the `parse_dates` keyword of `pd.read_excel()` to parse string columns as dates ([GH 14326](https://github.com/pandas-dev/pandas/issues/14326)) +* Added `.empty` property to subclasses of `Index`. ([GH 15270](https://github.com/pandas-dev/pandas/issues/15270)) +* Enabled floor division for `Timedelta` and `TimedeltaIndex` ([GH 15828](https://github.com/pandas-dev/pandas/issues/15828)) +* `pandas.io.json.json_normalize()` gained the option `errors='ignore'|'raise'`; the default is `errors='raise'` which is backward compatible. ([GH 14583](https://github.com/pandas-dev/pandas/issues/14583)) +* `pandas.io.json.json_normalize()` with an empty `list` will return an empty `DataFrame` ([GH 15534](https://github.com/pandas-dev/pandas/issues/15534)) +* `pandas.io.json.json_normalize()` has gained a `sep` option that accepts `str` to separate joined fields; the default is “.”, which is backward compatible. ([GH 14883](https://github.com/pandas-dev/pandas/issues/14883)) +* [`MultiIndex.remove_unused_levels()`](../reference/api/pandas.MultiIndex.remove_unused_levels.html#pandas.MultiIndex.remove_unused_levels "pandas.MultiIndex.remove_unused_levels") has been added to facilitate [removing unused levels](../user_guide/advanced.html#advanced-shown-levels). ([GH 15694](https://github.com/pandas-dev/pandas/issues/15694)) +* `pd.read_csv()` will now raise a `ParserError` error whenever any parsing error occurs ([GH 15913](https://github.com/pandas-dev/pandas/issues/15913), [GH 15925](https://github.com/pandas-dev/pandas/issues/15925)) +* `pd.read_csv()` now supports the `error_bad_lines` and `warn_bad_lines` arguments for the Python parser ([GH 15925](https://github.com/pandas-dev/pandas/issues/15925)) +* The `display.show_dimensions` option can now also be used to specify + whether the length of a `Series` should be shown in its repr ([GH 7117](https://github.com/pandas-dev/pandas/issues/7117)). +* `parallel_coordinates()` has gained a `sort_labels` keyword argument that sorts class labels and the colors assigned to them ([GH 15908](https://github.com/pandas-dev/pandas/issues/15908)) +* Options added to allow one to turn on/off using `bottleneck` and `numexpr`, see [here](../user_guide/basics.html#basics-accelerate) ([GH 16157](https://github.com/pandas-dev/pandas/issues/16157)) +* `DataFrame.style.bar()` now accepts two more options to further customize the bar chart. Bar alignment is set with `align='left'|'mid'|'zero'`, the default is “left”, which is backward compatible; You can now pass a list of `color=[color_negative, color_positive]`. ([GH 14757](https://github.com/pandas-dev/pandas/issues/14757)) + +## Backwards incompatible API changes[#](#backwards-incompatible-api-changes "Link to this heading") + +### Possible incompatibility for HDF5 formats created with pandas < 0.13.0[#](#possible-incompatibility-for-hdf5-formats-created-with-pandas-0-13-0 "Link to this heading") + +`pd.TimeSeries` was deprecated officially in 0.17.0, though has already been an alias since 0.13.0. It has +been dropped in favor of `pd.Series`. ([GH 15098](https://github.com/pandas-dev/pandas/issues/15098)). + +This *may* cause HDF5 files that were created in prior versions to become unreadable if `pd.TimeSeries` +was used. This is most likely to be for pandas < 0.13.0. If you find yourself in this situation. +You can use a recent prior version of pandas to read in your HDF5 files, +then write them out again after applying the procedure below. + +```None +In [2]: s = pd.TimeSeries([1, 2, 3], index=pd.date_range('20130101', periods=3)) + +In [3]: s +Out[3]: +2013-01-01 1 +2013-01-02 2 +2013-01-03 3 +Freq: D, dtype: int64 + +In [4]: type(s) +Out[4]: pandas.core.series.TimeSeries + +In [5]: s = pd.Series(s) + +In [6]: s +Out[6]: +2013-01-01 1 +2013-01-02 2 +2013-01-03 3 +Freq: D, dtype: int64 + +In [7]: type(s) +Out[7]: pandas.core.series.Series +``` + +### Map on Index types now return other Index types[#](#map-on-index-types-now-return-other-index-types "Link to this heading") + +`map` on an `Index` now returns an `Index`, not a numpy array ([GH 12766](https://github.com/pandas-dev/pandas/issues/12766)) + +```None +In [56]: idx = pd.Index([1, 2]) + +In [57]: idx +Out[57]: Index([1, 2], dtype='int64') + +In [58]: mi = pd.MultiIndex.from_tuples([(1, 2), (2, 4)]) + +In [59]: mi +Out[59]: +MultiIndex([(1, 2), + (2, 4)], + ) +``` + +Previous behavior: + +```None +In [5]: idx.map(lambda x: x * 2) +Out[5]: array([2, 4]) + +In [6]: idx.map(lambda x: (x, x * 2)) +Out[6]: array([(1, 2), (2, 4)], dtype=object) + +In [7]: mi.map(lambda x: x) +Out[7]: array([(1, 2), (2, 4)], dtype=object) + +In [8]: mi.map(lambda x: x[0]) +Out[8]: array([1, 2]) +``` + +New behavior: + +```None +In [60]: idx.map(lambda x: x * 2) +Out[60]: Index([2, 4], dtype='int64') + +In [61]: idx.map(lambda x: (x, x * 2)) +Out[61]: +MultiIndex([(1, 2), + (2, 4)], + ) + +In [62]: mi.map(lambda x: x) +Out[62]: +MultiIndex([(1, 2), + (2, 4)], + ) + +In [63]: mi.map(lambda x: x[0]) +Out[63]: Index([1, 2], dtype='int64') +``` + +`map` on a `Series` with `datetime64` values may return `int64` dtypes rather than `int32` + +```None +In [64]: s = pd.Series(pd.date_range('2011-01-02T00:00', '2011-01-02T02:00', freq='H') + ....: .tz_localize('Asia/Tokyo')) + ....: + +In [65]: s +Out[65]: +0 2011-01-02 00:00:00+09:00 +1 2011-01-02 01:00:00+09:00 +2 2011-01-02 02:00:00+09:00 +Length: 3, dtype: datetime64[ns, Asia/Tokyo] +``` + +Previous behavior: + +```None +In [9]: s.map(lambda x: x.hour) +Out[9]: +0 0 +1 1 +2 2 +dtype: int32 +``` + +New behavior: + +```None +In [66]: s.map(lambda x: x.hour) +Out[66]: +0 0 +1 1 +2 2 +Length: 3, dtype: int64 +``` + +### Accessing datetime fields of Index now return Index[#](#accessing-datetime-fields-of-index-now-return-index "Link to this heading") + +The datetime-related attributes (see [here](../user_guide/timeseries.html#timeseries-components) +for an overview) of `DatetimeIndex`, `PeriodIndex` and `TimedeltaIndex` previously +returned numpy arrays. They will now return a new `Index` object, except +in the case of a boolean field, where the result will still be a boolean ndarray. ([GH 15022](https://github.com/pandas-dev/pandas/issues/15022)) + +Previous behaviour: + +```None +In [1]: idx = pd.date_range("2015-01-01", periods=5, freq='10H') + +In [2]: idx.hour +Out[2]: array([ 0, 10, 20, 6, 16], dtype=int32) +``` + +New behavior: + +```None +In [67]: idx = pd.date_range("2015-01-01", periods=5, freq='10H') + +In [68]: idx.hour +Out[68]: Index([0, 10, 20, 6, 16], dtype='int32') +``` + +This has the advantage that specific `Index` methods are still available on the +result. On the other hand, this might have backward incompatibilities: e.g. +compared to numpy arrays, `Index` objects are not mutable. To get the original +ndarray, you can always convert explicitly using `np.asarray(idx.hour)`. + +### pd.unique will now be consistent with extension types[#](#pd-unique-will-now-be-consistent-with-extension-types "Link to this heading") + +In prior versions, using [`Series.unique()`](../reference/api/pandas.Series.unique.html#pandas.Series.unique "pandas.Series.unique") and [`pandas.unique()`](../reference/api/pandas.unique.html#pandas.unique "pandas.unique") on `Categorical` and tz-aware +data-types would yield different return types. These are now made consistent. ([GH 15903](https://github.com/pandas-dev/pandas/issues/15903)) + +* Datetime tz-aware + + Previous behaviour: + + ```None + # Series + In [5]: pd.Series([pd.Timestamp('20160101', tz='US/Eastern'), + ...: pd.Timestamp('20160101', tz='US/Eastern')]).unique() + Out[5]: array([Timestamp('2016-01-01 00:00:00-0500', tz='US/Eastern')], dtype=object) + + In [6]: pd.unique(pd.Series([pd.Timestamp('20160101', tz='US/Eastern'), + ...: pd.Timestamp('20160101', tz='US/Eastern')])) + Out[6]: array(['2016-01-01T05:00:00.000000000'], dtype='datetime64[ns]') + + # Index + In [7]: pd.Index([pd.Timestamp('20160101', tz='US/Eastern'), + ...: pd.Timestamp('20160101', tz='US/Eastern')]).unique() + Out[7]: DatetimeIndex(['2016-01-01 00:00:00-05:00'], dtype='datetime64[ns, US/Eastern]', freq=None) + + In [8]: pd.unique([pd.Timestamp('20160101', tz='US/Eastern'), + ...: pd.Timestamp('20160101', tz='US/Eastern')]) + Out[8]: array(['2016-01-01T05:00:00.000000000'], dtype='datetime64[ns]') + ``` + + New behavior: + + ```None + # Series, returns an array of Timestamp tz-aware + In [64]: pd.Series([pd.Timestamp(r'20160101', tz=r'US/Eastern'), + ....: pd.Timestamp(r'20160101', tz=r'US/Eastern')]).unique() + ....: + Out[64]: + + ['2016-01-01 00:00:00-05:00'] + Length: 1, dtype: datetime64[ns, US/Eastern] + + In [65]: pd.unique(pd.Series([pd.Timestamp('20160101', tz='US/Eastern'), + ....: pd.Timestamp('20160101', tz='US/Eastern')])) + ....: + Out[65]: + + ['2016-01-01 00:00:00-05:00'] + Length: 1, dtype: datetime64[ns, US/Eastern] + + # Index, returns a DatetimeIndex + In [66]: pd.Index([pd.Timestamp('20160101', tz='US/Eastern'), + ....: pd.Timestamp('20160101', tz='US/Eastern')]).unique() + ....: + Out[66]: DatetimeIndex(['2016-01-01 00:00:00-05:00'], dtype='datetime64[ns, US/Eastern]', freq=None) + + In [67]: pd.unique(pd.Index([pd.Timestamp('20160101', tz='US/Eastern'), + ....: pd.Timestamp('20160101', tz='US/Eastern')])) + ....: + Out[67]: DatetimeIndex(['2016-01-01 00:00:00-05:00'], dtype='datetime64[ns, US/Eastern]', freq=None) + ``` +* Categoricals + + Previous behaviour: + + ```None + In [1]: pd.Series(list('baabc'), dtype='category').unique() + Out[1]: + [b, a, c] + Categories (3, object): [b, a, c] + + In [2]: pd.unique(pd.Series(list('baabc'), dtype='category')) + Out[2]: array(['b', 'a', 'c'], dtype=object) + ``` + + New behavior: + + ```None + # returns a Categorical + In [68]: pd.Series(list('baabc'), dtype='category').unique() + Out[68]: + ['b', 'a', 'c'] + Categories (3, object): ['a', 'b', 'c'] + + In [69]: pd.unique(pd.Series(list('baabc'), dtype='category')) + Out[69]: + ['b', 'a', 'c'] + Categories (3, object): ['a', 'b', 'c'] + ``` + +### S3 file handling[#](#s3-file-handling "Link to this heading") + +pandas now uses [s3fs](http://s3fs.readthedocs.io/) for handling S3 connections. This shouldn’t break +any code. However, since `s3fs` is not a required dependency, you will need to install it separately, like `boto` +in prior versions of pandas. ([GH 11915](https://github.com/pandas-dev/pandas/issues/11915)). + +### Partial string indexing changes[#](#partial-string-indexing-changes "Link to this heading") + +[DatetimeIndex Partial String Indexing](../user_guide/timeseries.html#timeseries-partialindexing) now works as an exact match, provided that string resolution coincides with index resolution, including a case when both are seconds ([GH 14826](https://github.com/pandas-dev/pandas/issues/14826)). See [Slice vs. Exact Match](../user_guide/timeseries.html#timeseries-slice-vs-exact-match) for details. + +```None +In [70]: df = pd.DataFrame({'a': [1, 2, 3]}, pd.DatetimeIndex(['2011-12-31 23:59:59', + ....: '2012-01-01 00:00:00', + ....: '2012-01-01 00:00:01'])) + ....: +``` + +Previous behavior: + +```None +In [4]: df['2011-12-31 23:59:59'] +Out[4]: + a +2011-12-31 23:59:59 1 + +In [5]: df['a']['2011-12-31 23:59:59'] +Out[5]: +2011-12-31 23:59:59 1 +Name: a, dtype: int64 +``` + +New behavior: + +```None +In [4]: df['2011-12-31 23:59:59'] +KeyError: '2011-12-31 23:59:59' + +In [5]: df['a']['2011-12-31 23:59:59'] +Out[5]: 1 +``` + +### Concat of different float dtypes will not automatically upcast[#](#concat-of-different-float-dtypes-will-not-automatically-upcast "Link to this heading") + +Previously, `concat` of multiple objects with different `float` dtypes would automatically upcast results to a dtype of `float64`. +Now the smallest acceptable dtype will be used ([GH 13247](https://github.com/pandas-dev/pandas/issues/13247)) + +```None +In [71]: df1 = pd.DataFrame(np.array([1.0], dtype=np.float32, ndmin=2)) + +In [72]: df1.dtypes +Out[72]: +0 float32 +Length: 1, dtype: object + +In [73]: df2 = pd.DataFrame(np.array([np.nan], dtype=np.float32, ndmin=2)) + +In [74]: df2.dtypes +Out[74]: +0 float32 +Length: 1, dtype: object +``` + +Previous behavior: + +```None +In [7]: pd.concat([df1, df2]).dtypes +Out[7]: +0 float64 +dtype: object +``` + +New behavior: + +```None +In [75]: pd.concat([df1, df2]).dtypes +Out[75]: +0 float32 +Length: 1, dtype: object +``` + +### pandas Google BigQuery support has moved[#](#pandas-google-bigquery-support-has-moved "Link to this heading") + +pandas has split off Google BigQuery support into a separate package `pandas-gbq`. You can `conda install pandas-gbq -c conda-forge` or +`pip install pandas-gbq` to get it. The functionality of [`read_gbq()`](../reference/api/pandas.read_gbq.html#pandas.read_gbq "pandas.read_gbq") and [`DataFrame.to_gbq()`](../reference/api/pandas.DataFrame.to_gbq.html#pandas.DataFrame.to_gbq "pandas.DataFrame.to_gbq") remain the same with the +currently released version of `pandas-gbq=0.1.4`. Documentation is now hosted [here](https://pandas-gbq.readthedocs.io/) ([GH 15347](https://github.com/pandas-dev/pandas/issues/15347)) + +### Memory usage for Index is more accurate[#](#memory-usage-for-index-is-more-accurate "Link to this heading") + +In previous versions, showing `.memory_usage()` on a pandas structure that has an index, would only include actual index values and not include structures that facilitated fast indexing. This will generally be different for `Index` and `MultiIndex` and less-so for other index types. ([GH 15237](https://github.com/pandas-dev/pandas/issues/15237)) + +Previous behavior: + +```None +In [8]: index = pd.Index(['foo', 'bar', 'baz']) + +In [9]: index.memory_usage(deep=True) +Out[9]: 180 + +In [10]: index.get_loc('foo') +Out[10]: 0 + +In [11]: index.memory_usage(deep=True) +Out[11]: 180 +``` + +New behavior: + +```None +In [8]: index = pd.Index(['foo', 'bar', 'baz']) + +In [9]: index.memory_usage(deep=True) +Out[9]: 180 + +In [10]: index.get_loc('foo') +Out[10]: 0 + +In [11]: index.memory_usage(deep=True) +Out[11]: 260 +``` + +### DataFrame.sort\_index changes[#](#dataframe-sort-index-changes "Link to this heading") + +In certain cases, calling `.sort_index()` on a MultiIndexed DataFrame would return the *same* DataFrame without seeming to sort. +This would happen with a `lexsorted`, but non-monotonic levels. ([GH 15622](https://github.com/pandas-dev/pandas/issues/15622), [GH 15687](https://github.com/pandas-dev/pandas/issues/15687), [GH 14015](https://github.com/pandas-dev/pandas/issues/14015), [GH 13431](https://github.com/pandas-dev/pandas/issues/13431), [GH 15797](https://github.com/pandas-dev/pandas/issues/15797)) + +This is *unchanged* from prior versions, but shown for illustration purposes: + +```None +In [81]: df = pd.DataFrame(np.arange(6), columns=['value'], + ....: index=pd.MultiIndex.from_product([list('BA'), range(3)])) + ....: +In [82]: df + +Out[82]: + value +B 0 0 + 1 1 + 2 2 +A 0 3 + 1 4 + 2 5 + +[6 rows x 1 columns] +``` + +```None +In [87]: df.index.is_lexsorted() +Out[87]: False + +In [88]: df.index.is_monotonic +Out[88]: False +``` + +Sorting works as expected + +```None +In [76]: df.sort_index() +Out[76]: + a +2011-12-31 23:59:59 1 +2012-01-01 00:00:00 2 +2012-01-01 00:00:01 3 + +[3 rows x 1 columns] +``` + +```None +In [90]: df.sort_index().index.is_lexsorted() +Out[90]: True + +In [91]: df.sort_index().index.is_monotonic +Out[91]: True +``` + +However, this example, which has a non-monotonic 2nd level, +doesn’t behave as desired. + +```None +In [77]: df = pd.DataFrame({'value': [1, 2, 3, 4]}, + ....: index=pd.MultiIndex([['a', 'b'], ['bb', 'aa']], + ....: [[0, 0, 1, 1], [0, 1, 0, 1]])) + ....: + +In [78]: df +Out[78]: + value +a bb 1 + aa 2 +b bb 3 + aa 4 + +[4 rows x 1 columns] +``` + +Previous behavior: + +```None +In [11]: df.sort_index() +Out[11]: + value +a bb 1 + aa 2 +b bb 3 + aa 4 + +In [14]: df.sort_index().index.is_lexsorted() +Out[14]: True + +In [15]: df.sort_index().index.is_monotonic +Out[15]: False +``` + +New behavior: + +```None +In [94]: df.sort_index() +Out[94]: + value +a aa 2 + bb 1 +b aa 4 + bb 3 + +[4 rows x 1 columns] + +In [95]: df.sort_index().index.is_lexsorted() +Out[95]: True + +In [96]: df.sort_index().index.is_monotonic +Out[96]: True +``` + +### GroupBy describe formatting[#](#groupby-describe-formatting "Link to this heading") + +The output formatting of `groupby.describe()` now labels the `describe()` metrics in the columns instead of the index. +This format is consistent with `groupby.agg()` when applying multiple functions at once. ([GH 4792](https://github.com/pandas-dev/pandas/issues/4792)) + +Previous behavior: + +```None +In [1]: df = pd.DataFrame({'A': [1, 1, 2, 2], 'B': [1, 2, 3, 4]}) + +In [2]: df.groupby('A').describe() +Out[2]: + B +A +1 count 2.000000 + mean 1.500000 + std 0.707107 + min 1.000000 + 25% 1.250000 + 50% 1.500000 + 75% 1.750000 + max 2.000000 +2 count 2.000000 + mean 3.500000 + std 0.707107 + min 3.000000 + 25% 3.250000 + 50% 3.500000 + 75% 3.750000 + max 4.000000 + +In [3]: df.groupby('A').agg(["mean", "std", "min", "max"]) +Out[3]: + B + mean std amin amax +A +1 1.5 0.707107 1 2 +2 3.5 0.707107 3 4 +``` + +New behavior: + +```None +In [79]: df = pd.DataFrame({'A': [1, 1, 2, 2], 'B': [1, 2, 3, 4]}) + +In [80]: df.groupby('A').describe() +Out[80]: + B + count mean std min 25% 50% 75% max +A +1 2.0 1.5 0.707107 1.0 1.25 1.5 1.75 2.0 +2 2.0 3.5 0.707107 3.0 3.25 3.5 3.75 4.0 + +[2 rows x 8 columns] + +In [81]: df.groupby('A').agg(["mean", "std", "min", "max"]) +Out[81]: + B + mean std min max +A +1 1.5 0.707107 1 2 +2 3.5 0.707107 3 4 + +[2 rows x 4 columns] +``` + +### Window binary corr/cov operations return a MultiIndex DataFrame[#](#window-binary-corr-cov-operations-return-a-multiindex-dataframe "Link to this heading") + +A binary window operation, like `.corr()` or `.cov()`, when operating on a `.rolling(..)`, `.expanding(..)`, or `.ewm(..)` object, +will now return a 2-level `MultiIndexed DataFrame` rather than a `Panel`, as `Panel` is now deprecated, +see [here](#whatsnew-0200-api-breaking-deprecate-panel). These are equivalent in function, +but a MultiIndexed `DataFrame` enjoys more support in pandas. +See the section on [Windowed Binary Operations](../user_guide/window.html#window-cov-corr) for more information. ([GH 15677](https://github.com/pandas-dev/pandas/issues/15677)) + +```None +In [82]: np.random.seed(1234) + +In [83]: df = pd.DataFrame(np.random.rand(100, 2), + ....: columns=pd.Index(['A', 'B'], name='bar'), + ....: index=pd.date_range('20160101', + ....: periods=100, freq='D', name='foo')) + ....: + +In [84]: df.tail() +Out[84]: +bar A B +foo +2016-04-05 0.640880 0.126205 +2016-04-06 0.171465 0.737086 +2016-04-07 0.127029 0.369650 +2016-04-08 0.604334 0.103104 +2016-04-09 0.802374 0.945553 + +[5 rows x 2 columns] +``` + +Previous behavior: + +```None +In [2]: df.rolling(12).corr() +Out[2]: + +Dimensions: 100 (items) x 2 (major_axis) x 2 (minor_axis) +Items axis: 2016-01-01 00:00:00 to 2016-04-09 00:00:00 +Major_axis axis: A to B +Minor_axis axis: A to B +``` + +New behavior: + +```None +In [85]: res = df.rolling(12).corr() + +In [86]: res.tail() +Out[86]: +bar A B +foo bar +2016-04-07 B -0.132090 1.000000 +2016-04-08 A 1.000000 -0.145775 + B -0.145775 1.000000 +2016-04-09 A 1.000000 0.119645 + B 0.119645 1.000000 + +[5 rows x 2 columns] +``` + +Retrieving a correlation matrix for a cross-section + +```None +In [87]: df.rolling(12).corr().loc['2016-04-07'] +Out[87]: +bar A B +bar +A 1.00000 -0.13209 +B -0.13209 1.00000 + +[2 rows x 2 columns] +``` + +### HDFStore where string comparison[#](#hdfstore-where-string-comparison "Link to this heading") + +In previous versions most types could be compared to string column in a `HDFStore` +usually resulting in an invalid comparison, returning an empty result frame. These comparisons will now raise a +`TypeError` ([GH 15492](https://github.com/pandas-dev/pandas/issues/15492)) + +```None +In [88]: df = pd.DataFrame({'unparsed_date': ['2014-01-01', '2014-01-01']}) + +In [89]: df.to_hdf('store.h5', key='key', format='table', data_columns=True) + +In [90]: df.dtypes +Out[90]: +unparsed_date object +Length: 1, dtype: object +``` + +Previous behavior: + +```None +In [4]: pd.read_hdf('store.h5', 'key', where='unparsed_date > ts') +File "", line 1 + (unparsed_date > 1970-01-01 00:00:01.388552400) + ^ +SyntaxError: invalid token +``` + +New behavior: + +```None +In [18]: ts = pd.Timestamp('2014-01-01') + +In [19]: pd.read_hdf('store.h5', 'key', where='unparsed_date > ts') +TypeError: Cannot compare 2014-01-01 00:00:00 of +type to string column +``` + +### Index.intersection and inner join now preserve the order of the left Index[#](#index-intersection-and-inner-join-now-preserve-the-order-of-the-left-index "Link to this heading") + +[`Index.intersection()`](../reference/api/pandas.Index.intersection.html#pandas.Index.intersection "pandas.Index.intersection") now preserves the order of the calling `Index` (left) +instead of the other `Index` (right) ([GH 15582](https://github.com/pandas-dev/pandas/issues/15582)). This affects inner +joins, [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") and [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge"), and the `.align` method. + +* `Index.intersection` + + ```None + In [91]: left = pd.Index([2, 1, 0]) + + In [92]: left + Out[92]: Index([2, 1, 0], dtype='int64') + + In [93]: right = pd.Index([1, 2, 3]) + + In [94]: right + Out[94]: Index([1, 2, 3], dtype='int64') + ``` + + Previous behavior: + + ```None + In [4]: left.intersection(right) + Out[4]: Int64Index([1, 2], dtype='int64') + ``` + + New behavior: + + ```None + In [95]: left.intersection(right) + Out[95]: Index([2, 1], dtype='int64') + ``` +* `DataFrame.join` and `pd.merge` + + ```None + In [96]: left = pd.DataFrame({'a': [20, 10, 0]}, index=[2, 1, 0]) + + In [97]: left + Out[97]: + a + 2 20 + 1 10 + 0 0 + + [3 rows x 1 columns] + + In [98]: right = pd.DataFrame({'b': [100, 200, 300]}, index=[1, 2, 3]) + + In [99]: right + Out[99]: + b + 1 100 + 2 200 + 3 300 + + [3 rows x 1 columns] + ``` + + Previous behavior: + + ```None + In [4]: left.join(right, how='inner') + Out[4]: + a b + 1 10 100 + 2 20 200 + ``` + + New behavior: + + ```None + In [100]: left.join(right, how='inner') + Out[100]: + a b + 2 20 200 + 1 10 100 + + [2 rows x 2 columns] + ``` + +### Pivot table always returns a DataFrame[#](#pivot-table-always-returns-a-dataframe "Link to this heading") + +The documentation for [`pivot_table()`](../reference/api/pandas.pivot_table.html#pandas.pivot_table "pandas.pivot_table") states that a `DataFrame` is *always* returned. Here a bug +is fixed that allowed this to return a `Series` under certain circumstance. ([GH 4386](https://github.com/pandas-dev/pandas/issues/4386)) + +```None +In [101]: df = pd.DataFrame({'col1': [3, 4, 5], + .....: 'col2': ['C', 'D', 'E'], + .....: 'col3': [1, 3, 9]}) + .....: + +In [102]: df +Out[102]: + col1 col2 col3 +0 3 C 1 +1 4 D 3 +2 5 E 9 + +[3 rows x 3 columns] +``` + +Previous behavior: + +```None +In [2]: df.pivot_table('col1', index=['col3', 'col2'], aggfunc="sum") +Out[2]: +col3 col2 +1 C 3 +3 D 4 +9 E 5 +Name: col1, dtype: int64 +``` + +New behavior: + +```None +In [103]: df.pivot_table('col1', index=['col3', 'col2'], aggfunc="sum") +Out[103]: + col1 +col3 col2 +1 C 3 +3 D 4 +9 E 5 + +[3 rows x 1 columns] +``` + +### Other API changes[#](#other-api-changes "Link to this heading") + +* `numexpr` version is now required to be >= 2.4.6 and it will not be used at all if this requisite is not fulfilled ([GH 15213](https://github.com/pandas-dev/pandas/issues/15213)). +* `CParserError` has been renamed to `ParserError` in `pd.read_csv()` and will be removed in the future ([GH 12665](https://github.com/pandas-dev/pandas/issues/12665)) +* `SparseArray.cumsum()` and `SparseSeries.cumsum()` will now always return `SparseArray` and `SparseSeries` respectively ([GH 12855](https://github.com/pandas-dev/pandas/issues/12855)) +* `DataFrame.applymap()` with an empty `DataFrame` will return a copy of the empty `DataFrame` instead of a `Series` ([GH 8222](https://github.com/pandas-dev/pandas/issues/8222)) +* `Series.map()` now respects default values of dictionary subclasses with a `__missing__` method, such as `collections.Counter` ([GH 15999](https://github.com/pandas-dev/pandas/issues/15999)) +* `.loc` has compat with `.ix` for accepting iterators, and NamedTuples ([GH 15120](https://github.com/pandas-dev/pandas/issues/15120)) +* `interpolate()` and `fillna()` will raise a `ValueError` if the `limit` keyword argument is not greater than 0. ([GH 9217](https://github.com/pandas-dev/pandas/issues/9217)) +* `pd.read_csv()` will now issue a `ParserWarning` whenever there are conflicting values provided by the `dialect` parameter and the user ([GH 14898](https://github.com/pandas-dev/pandas/issues/14898)) +* `pd.read_csv()` will now raise a `ValueError` for the C engine if the quote character is larger than one byte ([GH 11592](https://github.com/pandas-dev/pandas/issues/11592)) +* `inplace` arguments now require a boolean value, else a `ValueError` is thrown ([GH 14189](https://github.com/pandas-dev/pandas/issues/14189)) +* `pandas.api.types.is_datetime64_ns_dtype` will now report `True` on a tz-aware dtype, similar to `pandas.api.types.is_datetime64_any_dtype` +* `DataFrame.asof()` will return a null filled `Series` instead the scalar `NaN` if a match is not found ([GH 15118](https://github.com/pandas-dev/pandas/issues/15118)) +* Specific support for `copy.copy()` and `copy.deepcopy()` functions on NDFrame objects ([GH 15444](https://github.com/pandas-dev/pandas/issues/15444)) +* `Series.sort_values()` accepts a one element list of bool for consistency with the behavior of `DataFrame.sort_values()` ([GH 15604](https://github.com/pandas-dev/pandas/issues/15604)) +* `.merge()` and `.join()` on `category` dtype columns will now preserve the category dtype when possible ([GH 10409](https://github.com/pandas-dev/pandas/issues/10409)) +* `SparseDataFrame.default_fill_value` will be 0, previously was `nan` in the return from `pd.get_dummies(..., sparse=True)` ([GH 15594](https://github.com/pandas-dev/pandas/issues/15594)) +* The default behaviour of `Series.str.match` has changed from extracting + groups to matching the pattern. The extracting behaviour was deprecated + since pandas version 0.13.0 and can be done with the `Series.str.extract` + method ([GH 5224](https://github.com/pandas-dev/pandas/issues/5224)). As a consequence, the `as_indexer` keyword is + ignored (no longer needed to specify the new behaviour) and is deprecated. +* `NaT` will now correctly report `False` for datetimelike boolean operations such as `is_month_start` ([GH 15781](https://github.com/pandas-dev/pandas/issues/15781)) +* `NaT` will now correctly return `np.nan` for `Timedelta` and `Period` accessors such as `days` and `quarter` ([GH 15782](https://github.com/pandas-dev/pandas/issues/15782)) +* `NaT` will now returns `NaT` for `tz_localize` and `tz_convert` + methods ([GH 15830](https://github.com/pandas-dev/pandas/issues/15830)) +* `DataFrame` and `Panel` constructors with invalid input will now raise `ValueError` rather than `PandasError`, if called with scalar inputs and not axes ([GH 15541](https://github.com/pandas-dev/pandas/issues/15541)) +* `DataFrame` and `Panel` constructors with invalid input will now raise `ValueError` rather than `pandas.core.common.PandasError`, if called with scalar inputs and not axes; The exception `PandasError` is removed as well. ([GH 15541](https://github.com/pandas-dev/pandas/issues/15541)) +* The exception `pandas.core.common.AmbiguousIndexError` is removed as it is not referenced ([GH 15541](https://github.com/pandas-dev/pandas/issues/15541)) + +## Reorganization of the library: privacy changes[#](#reorganization-of-the-library-privacy-changes "Link to this heading") + +### Modules privacy has changed[#](#modules-privacy-has-changed "Link to this heading") + +Some formerly public python/c/c++/cython extension modules have been moved and/or renamed. These are all removed from the public API. +Furthermore, the `pandas.core`, `pandas.compat`, and `pandas.util` top-level modules are now considered to be PRIVATE. +If indicated, a deprecation warning will be issued if you reference these modules. ([GH 12588](https://github.com/pandas-dev/pandas/issues/12588)) + +| Previous Location | New Location | Deprecated | +| --- | --- | --- | +| pandas.lib | pandas.\_libs.lib | X | +| pandas.tslib | pandas.\_libs.tslib | X | +| pandas.computation | pandas.core.computation | X | +| pandas.msgpack | pandas.io.msgpack | | +| pandas.index | pandas.\_libs.index | | +| pandas.algos | pandas.\_libs.algos | | +| pandas.hashtable | pandas.\_libs.hashtable | | +| pandas.indexes | pandas.core.indexes | | +| pandas.json | pandas.\_libs.json / pandas.io.json | X | +| pandas.parser | pandas.\_libs.parsers | X | +| pandas.formats | pandas.io.formats | | +| pandas.sparse | pandas.core.sparse | | +| pandas.tools | pandas.core.reshape | X | +| pandas.types | pandas.core.dtypes | X | +| pandas.io.sas.saslib | pandas.io.sas.\_sas | | +| pandas.\_join | pandas.\_libs.join | | +| pandas.\_hash | pandas.\_libs.hashing | | +| pandas.\_period | pandas.\_libs.period | | +| pandas.\_sparse | pandas.\_libs.sparse | | +| pandas.\_testing | pandas.\_libs.testing | | +| pandas.\_window | pandas.\_libs.window | | + +Some new subpackages are created with public functionality that is not directly +exposed in the top-level namespace: `pandas.errors`, `pandas.plotting` and +`pandas.testing` (more details below). Together with `pandas.api.types` and +certain functions in the `pandas.io` and `pandas.tseries` submodules, +these are now the public subpackages. + +Further changes: + +* The function [`union_categoricals()`](../reference/api/pandas.api.types.union_categoricals.html#pandas.api.types.union_categoricals "pandas.api.types.union_categoricals") is now importable from `pandas.api.types`, formerly from `pandas.types.concat` ([GH 15998](https://github.com/pandas-dev/pandas/issues/15998)) +* The type import `pandas.tslib.NaTType` is deprecated and can be replaced by using `type(pandas.NaT)` ([GH 16146](https://github.com/pandas-dev/pandas/issues/16146)) +* The public functions in `pandas.tools.hashing` deprecated from that locations, but are now importable from `pandas.util` ([GH 16223](https://github.com/pandas-dev/pandas/issues/16223)) +* The modules in `pandas.util`: `decorators`, `print_versions`, `doctools`, `validators`, `depr_module` are now private. Only the functions exposed in `pandas.util` itself are public ([GH 16223](https://github.com/pandas-dev/pandas/issues/16223)) + +### `pandas.errors`[#](#pandas-errors "Link to this heading") + +We are adding a standard public module for all pandas exceptions & warnings `pandas.errors`. ([GH 14800](https://github.com/pandas-dev/pandas/issues/14800)). Previously +these exceptions & warnings could be imported from `pandas.core.common` or `pandas.io.common`. These exceptions and warnings +will be removed from the `*.common` locations in a future release. ([GH 15541](https://github.com/pandas-dev/pandas/issues/15541)) + +The following are now part of this API: + +```None +['DtypeWarning', + 'EmptyDataError', + 'OutOfBoundsDatetime', + 'ParserError', + 'ParserWarning', + 'PerformanceWarning', + 'UnsortedIndexError', + 'UnsupportedFunctionCall'] +``` + +### `pandas.testing`[#](#pandas-testing "Link to this heading") + +We are adding a standard module that exposes the public testing functions in `pandas.testing` ([GH 9895](https://github.com/pandas-dev/pandas/issues/9895)). Those functions can be used when writing tests for functionality using pandas objects. + +The following testing functions are now part of this API: + +* [`testing.assert_frame_equal()`](../reference/api/pandas.testing.assert_frame_equal.html#pandas.testing.assert_frame_equal "pandas.testing.assert_frame_equal") +* [`testing.assert_series_equal()`](../reference/api/pandas.testing.assert_series_equal.html#pandas.testing.assert_series_equal "pandas.testing.assert_series_equal") +* [`testing.assert_index_equal()`](../reference/api/pandas.testing.assert_index_equal.html#pandas.testing.assert_index_equal "pandas.testing.assert_index_equal") + +### `pandas.plotting`[#](#pandas-plotting "Link to this heading") + +A new public `pandas.plotting` module has been added that holds plotting functionality that was previously in either `pandas.tools.plotting` or in the top-level namespace. See the [deprecations sections](#whatsnew-0200-privacy-deprecate-plotting) for more details. + +### Other development changes[#](#other-development-changes "Link to this heading") + +* Building pandas for development now requires `cython >= 0.23` ([GH 14831](https://github.com/pandas-dev/pandas/issues/14831)) +* Require at least 0.23 version of cython to avoid problems with character encodings ([GH 14699](https://github.com/pandas-dev/pandas/issues/14699)) +* Switched the test framework to use [pytest](http://doc.pytest.org/en/latest) ([GH 13097](https://github.com/pandas-dev/pandas/issues/13097)) +* Reorganization of tests directory layout ([GH 14854](https://github.com/pandas-dev/pandas/issues/14854), [GH 15707](https://github.com/pandas-dev/pandas/issues/15707)). + +## Deprecations[#](#deprecations "Link to this heading") + +### Deprecate `.ix`[#](#deprecate-ix "Link to this heading") + +The `.ix` indexer is deprecated, in favor of the more strict `.iloc` and `.loc` indexers. `.ix` offers a lot of magic on the inference of what the user wants to do. More specifically, `.ix` can decide to index *positionally* OR via *labels*, depending on the data type of the index. This has caused quite a bit of user confusion over the years. The full indexing documentation is [here](../user_guide/indexing.html#indexing). ([GH 14218](https://github.com/pandas-dev/pandas/issues/14218)) + +The recommended methods of indexing are: + +* `.loc` if you want to *label* index +* `.iloc` if you want to *positionally* index. + +Using `.ix` will now show a `DeprecationWarning` with a link to some examples of how to convert code [here](https://pandas.pydata.org/pandas-docs/version/1.0/user_guide/indexing.html#ix-indexer-is-deprecated). + +```None +In [104]: df = pd.DataFrame({'A': [1, 2, 3], + .....: 'B': [4, 5, 6]}, + .....: index=list('abc')) + .....: + +In [105]: df +Out[105]: + A B +a 1 4 +b 2 5 +c 3 6 + +[3 rows x 2 columns] +``` + +Previous behavior, where you wish to get the 0th and the 2nd elements from the index in the ‘A’ column. + +```None +In [3]: df.ix[[0, 2], 'A'] +Out[3]: +a 1 +c 3 +Name: A, dtype: int64 +``` + +Using `.loc`. Here we will select the appropriate indexes from the index, then use *label* indexing. + +```None +In [106]: df.loc[df.index[[0, 2]], 'A'] +Out[106]: +a 1 +c 3 +Name: A, Length: 2, dtype: int64 +``` + +Using `.iloc`. Here we will get the location of the ‘A’ column, then use *positional* indexing to select things. + +```None +In [107]: df.iloc[[0, 2], df.columns.get_loc('A')] +Out[107]: +a 1 +c 3 +Name: A, Length: 2, dtype: int64 +``` + +### Deprecate Panel[#](#deprecate-panel "Link to this heading") + +`Panel` is deprecated and will be removed in a future version. The recommended way to represent 3-D data are +with a `MultiIndex` on a `DataFrame` via the `to_frame()` or with the [xarray package](http://xarray.pydata.org/en/stable/). pandas +provides a `to_xarray()` method to automate this conversion ([GH 13563](https://github.com/pandas-dev/pandas/issues/13563)). + +```None +In [133]: import pandas._testing as tm + +In [134]: p = tm.makePanel() + +In [135]: p +Out[135]: + +Dimensions: 3 (items) x 3 (major_axis) x 4 (minor_axis) +Items axis: ItemA to ItemC +Major_axis axis: 2000-01-03 00:00:00 to 2000-01-05 00:00:00 +Minor_axis axis: A to D +``` + +Convert to a MultiIndex DataFrame + +```None +In [136]: p.to_frame() +Out[136]: + ItemA ItemB ItemC +major minor +2000-01-03 A 0.628776 -1.409432 0.209395 + B 0.988138 -1.347533 -0.896581 + C -0.938153 1.272395 -0.161137 + D -0.223019 -0.591863 -1.051539 +2000-01-04 A 0.186494 1.422986 -0.592886 + B -0.072608 0.363565 1.104352 + C -1.239072 -1.449567 0.889157 + D 2.123692 -0.414505 -0.319561 +2000-01-05 A 0.952478 -2.147855 -1.473116 + B -0.550603 -0.014752 -0.431550 + C 0.139683 -1.195524 0.288377 + D 0.122273 -1.425795 -0.619993 + +[12 rows x 3 columns] +``` + +Convert to an xarray DataArray + +```None +In [137]: p.to_xarray() +Out[137]: + +array([[[ 0.628776, 0.988138, -0.938153, -0.223019], + [ 0.186494, -0.072608, -1.239072, 2.123692], + [ 0.952478, -0.550603, 0.139683, 0.122273]], + + [[-1.409432, -1.347533, 1.272395, -0.591863], + [ 1.422986, 0.363565, -1.449567, -0.414505], + [-2.147855, -0.014752, -1.195524, -1.425795]], + + [[ 0.209395, -0.896581, -0.161137, -1.051539], + [-0.592886, 1.104352, 0.889157, -0.319561], + [-1.473116, -0.43155 , 0.288377, -0.619993]]]) +Coordinates: + * items (items) object 'ItemA' 'ItemB' 'ItemC' + * major_axis (major_axis) datetime64[ns] 2000-01-03 2000-01-04 2000-01-05 + * minor_axis (minor_axis) object 'A' 'B' 'C' 'D' +``` + +### Deprecate groupby.agg() with a dictionary when renaming[#](#deprecate-groupby-agg-with-a-dictionary-when-renaming "Link to this heading") + +The `.groupby(..).agg(..)`, `.rolling(..).agg(..)`, and `.resample(..).agg(..)` syntax can accept a variable of inputs, including scalars, +list, and a dict of column names to scalars or lists. This provides a useful syntax for constructing multiple +(potentially different) aggregations. + +However, `.agg(..)` can *also* accept a dict that allows ‘renaming’ of the result columns. This is a complicated and confusing syntax, as well as not consistent +between `Series` and `DataFrame`. We are deprecating this ‘renaming’ functionality. + +* We are deprecating passing a dict to a grouped/rolled/resampled `Series`. This allowed + one to `rename` the resulting aggregation, but this had a completely different + meaning than passing a dictionary to a grouped `DataFrame`, which accepts column-to-aggregations. +* We are deprecating passing a dict-of-dicts to a grouped/rolled/resampled `DataFrame` in a similar manner. + +This is an illustrative example: + +```None +In [108]: df = pd.DataFrame({'A': [1, 1, 1, 2, 2], + .....: 'B': range(5), + .....: 'C': range(5)}) + .....: + +In [109]: df +Out[109]: + A B C +0 1 0 0 +1 1 1 1 +2 1 2 2 +3 2 3 3 +4 2 4 4 + +[5 rows x 3 columns] +``` + +Here is a typical useful syntax for computing different aggregations for different columns. This +is a natural, and useful syntax. We aggregate from the dict-to-list by taking the specified +columns and applying the list of functions. This returns a `MultiIndex` for the columns (this is *not* deprecated). + +```None +In [110]: df.groupby('A').agg({'B': 'sum', 'C': 'min'}) +Out[110]: + B C +A +1 3 0 +2 7 3 + +[2 rows x 2 columns] +``` + +Here’s an example of the first deprecation, passing a dict to a grouped `Series`. This +is a combination aggregation & renaming: + +```None +In [6]: df.groupby('A').B.agg({'foo': 'count'}) +FutureWarning: using a dict on a Series for aggregation +is deprecated and will be removed in a future version + +Out[6]: + foo +A +1 3 +2 2 +``` + +You can accomplish the same operation, more idiomatically by: + +```None +In [111]: df.groupby('A').B.agg(['count']).rename(columns={'count': 'foo'}) +Out[111]: + foo +A +1 3 +2 2 + +[2 rows x 1 columns] +``` + +Here’s an example of the second deprecation, passing a dict-of-dict to a grouped `DataFrame`: + +```None +In [23]: (df.groupby('A') + ...: .agg({'B': {'foo': 'sum'}, 'C': {'bar': 'min'}}) + ...: ) +FutureWarning: using a dict with renaming is deprecated and +will be removed in a future version + +Out[23]: + B C + foo bar +A +1 3 0 +2 7 3 +``` + +You can accomplish nearly the same by: + +```None +In [112]: (df.groupby('A') + .....: .agg({'B': 'sum', 'C': 'min'}) + .....: .rename(columns={'B': 'foo', 'C': 'bar'}) + .....: ) + .....: +Out[112]: + foo bar +A +1 3 0 +2 7 3 + +[2 rows x 2 columns] +``` + +### Deprecate .plotting[#](#deprecate-plotting "Link to this heading") + +The `pandas.tools.plotting` module has been deprecated, in favor of the top level `pandas.plotting` module. All the public plotting functions are now available +from `pandas.plotting` ([GH 12548](https://github.com/pandas-dev/pandas/issues/12548)). + +Furthermore, the top-level `pandas.scatter_matrix` and `pandas.plot_params` are deprecated. +Users can import these from `pandas.plotting` as well. + +Previous script: + +```None +pd.tools.plotting.scatter_matrix(df) +pd.scatter_matrix(df) +``` + +Should be changed to: + +```None +pd.plotting.scatter_matrix(df) +``` + +### Other deprecations[#](#other-deprecations "Link to this heading") + +* `SparseArray.to_dense()` has deprecated the `fill` parameter, as that parameter was not being respected ([GH 14647](https://github.com/pandas-dev/pandas/issues/14647)) +* `SparseSeries.to_dense()` has deprecated the `sparse_only` parameter ([GH 14647](https://github.com/pandas-dev/pandas/issues/14647)) +* `Series.repeat()` has deprecated the `reps` parameter in favor of `repeats` ([GH 12662](https://github.com/pandas-dev/pandas/issues/12662)) +* The `Series` constructor and `.astype` method have deprecated accepting timestamp dtypes without a frequency (e.g. `np.datetime64`) for the `dtype` parameter ([GH 15524](https://github.com/pandas-dev/pandas/issues/15524)) +* `Index.repeat()` and `MultiIndex.repeat()` have deprecated the `n` parameter in favor of `repeats` ([GH 12662](https://github.com/pandas-dev/pandas/issues/12662)) +* `Categorical.searchsorted()` and `Series.searchsorted()` have deprecated the `v` parameter in favor of `value` ([GH 12662](https://github.com/pandas-dev/pandas/issues/12662)) +* `TimedeltaIndex.searchsorted()`, `DatetimeIndex.searchsorted()`, and `PeriodIndex.searchsorted()` have deprecated the `key` parameter in favor of `value` ([GH 12662](https://github.com/pandas-dev/pandas/issues/12662)) +* `DataFrame.astype()` has deprecated the `raise_on_error` parameter in favor of `errors` ([GH 14878](https://github.com/pandas-dev/pandas/issues/14878)) +* `Series.sortlevel` and `DataFrame.sortlevel` have been deprecated in favor of `Series.sort_index` and `DataFrame.sort_index` ([GH 15099](https://github.com/pandas-dev/pandas/issues/15099)) +* importing `concat` from `pandas.tools.merge` has been deprecated in favor of imports from the `pandas` namespace. This should only affect explicit imports ([GH 15358](https://github.com/pandas-dev/pandas/issues/15358)) +* `Series/DataFrame/Panel.consolidate()` been deprecated as a public method. ([GH 15483](https://github.com/pandas-dev/pandas/issues/15483)) +* The `as_indexer` keyword of `Series.str.match()` has been deprecated (ignored keyword) ([GH 15257](https://github.com/pandas-dev/pandas/issues/15257)). +* The following top-level pandas functions have been deprecated and will be removed in a future version ([GH 13790](https://github.com/pandas-dev/pandas/issues/13790), [GH 15940](https://github.com/pandas-dev/pandas/issues/15940)) + + + `pd.pnow()`, replaced by `Period.now()` + + `pd.Term`, is removed, as it is not applicable to user code. Instead use in-line string expressions in the where clause when searching in HDFStore + + `pd.Expr`, is removed, as it is not applicable to user code. + + `pd.match()`, is removed. + + `pd.groupby()`, replaced by using the `.groupby()` method directly on a `Series/DataFrame` + + `pd.get_store()`, replaced by a direct call to `pd.HDFStore(...)` +* `is_any_int_dtype`, `is_floating_dtype`, and `is_sequence` are deprecated from `pandas.api.types` ([GH 16042](https://github.com/pandas-dev/pandas/issues/16042)) + +## Removal of prior version deprecations/changes[#](#removal-of-prior-version-deprecations-changes "Link to this heading") + +* The `pandas.rpy` module is removed. Similar functionality can be accessed + through the [rpy2](https://rpy2.readthedocs.io/) project. + See the [R interfacing docs](https://pandas.pydata.org/pandas-docs/version/0.20/r_interface.html) for more details. +* The `pandas.io.ga` module with a `google-analytics` interface is removed ([GH 11308](https://github.com/pandas-dev/pandas/issues/11308)). + Similar functionality can be found in the [Google2Pandas](https://github.com/panalysis/Google2Pandas) package. +* `pd.to_datetime` and `pd.to_timedelta` have dropped the `coerce` parameter in favor of `errors` ([GH 13602](https://github.com/pandas-dev/pandas/issues/13602)) +* `pandas.stats.fama_macbeth`, `pandas.stats.ols`, `pandas.stats.plm` and `pandas.stats.var`, as well as the top-level `pandas.fama_macbeth` and `pandas.ols` routines are removed. Similar functionality can be found in the [statsmodels](https://www.statsmodels.org/dev/) package. ([GH 11898](https://github.com/pandas-dev/pandas/issues/11898)) +* The `TimeSeries` and `SparseTimeSeries` classes, aliases of `Series` + and `SparseSeries`, are removed ([GH 10890](https://github.com/pandas-dev/pandas/issues/10890), [GH 15098](https://github.com/pandas-dev/pandas/issues/15098)). +* `Series.is_time_series` is dropped in favor of `Series.index.is_all_dates` ([GH 15098](https://github.com/pandas-dev/pandas/issues/15098)) +* The deprecated `irow`, `icol`, `iget` and `iget_value` methods are removed + in favor of `iloc` and `iat` as explained [here](v0.17.0.html#whatsnew-0170-deprecations) ([GH 10711](https://github.com/pandas-dev/pandas/issues/10711)). +* The deprecated `DataFrame.iterkv()` has been removed in favor of `DataFrame.iteritems()` ([GH 10711](https://github.com/pandas-dev/pandas/issues/10711)) +* The `Categorical` constructor has dropped the `name` parameter ([GH 10632](https://github.com/pandas-dev/pandas/issues/10632)) +* `Categorical` has dropped support for `NaN` categories ([GH 10748](https://github.com/pandas-dev/pandas/issues/10748)) +* The `take_last` parameter has been dropped from `duplicated()`, `drop_duplicates()`, `nlargest()`, and `nsmallest()` methods ([GH 10236](https://github.com/pandas-dev/pandas/issues/10236), [GH 10792](https://github.com/pandas-dev/pandas/issues/10792), [GH 10920](https://github.com/pandas-dev/pandas/issues/10920)) +* `Series`, `Index`, and `DataFrame` have dropped the `sort` and `order` methods ([GH 10726](https://github.com/pandas-dev/pandas/issues/10726)) +* Where clauses in `pytables` are only accepted as strings and expressions types and not other data-types ([GH 12027](https://github.com/pandas-dev/pandas/issues/12027)) +* `DataFrame` has dropped the `combineAdd` and `combineMult` methods in favor of `add` and `mul` respectively ([GH 10735](https://github.com/pandas-dev/pandas/issues/10735)) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Improved performance of `pd.wide_to_long()` ([GH 14779](https://github.com/pandas-dev/pandas/issues/14779)) +* Improved performance of `pd.factorize()` by releasing the GIL with `object` dtype when inferred as strings ([GH 14859](https://github.com/pandas-dev/pandas/issues/14859), [GH 16057](https://github.com/pandas-dev/pandas/issues/16057)) +* Improved performance of timeseries plotting with an irregular DatetimeIndex + (or with `compat_x=True`) ([GH 15073](https://github.com/pandas-dev/pandas/issues/15073)). +* Improved performance of `groupby().cummin()` and `groupby().cummax()` ([GH 15048](https://github.com/pandas-dev/pandas/issues/15048), [GH 15109](https://github.com/pandas-dev/pandas/issues/15109), [GH 15561](https://github.com/pandas-dev/pandas/issues/15561), [GH 15635](https://github.com/pandas-dev/pandas/issues/15635)) +* Improved performance and reduced memory when indexing with a `MultiIndex` ([GH 15245](https://github.com/pandas-dev/pandas/issues/15245)) +* When reading buffer object in `read_sas()` method without specified format, filepath string is inferred rather than buffer object. ([GH 14947](https://github.com/pandas-dev/pandas/issues/14947)) +* Improved performance of `.rank()` for categorical data ([GH 15498](https://github.com/pandas-dev/pandas/issues/15498)) +* Improved performance when using `.unstack()` ([GH 15503](https://github.com/pandas-dev/pandas/issues/15503)) +* Improved performance of merge/join on `category` columns ([GH 10409](https://github.com/pandas-dev/pandas/issues/10409)) +* Improved performance of `drop_duplicates()` on `bool` columns ([GH 12963](https://github.com/pandas-dev/pandas/issues/12963)) +* Improve performance of `pd.core.groupby.GroupBy.apply` when the applied + function used the `.name` attribute of the group DataFrame ([GH 15062](https://github.com/pandas-dev/pandas/issues/15062)). +* Improved performance of `iloc` indexing with a list or array ([GH 15504](https://github.com/pandas-dev/pandas/issues/15504)). +* Improved performance of `Series.sort_index()` with a monotonic index ([GH 15694](https://github.com/pandas-dev/pandas/issues/15694)) +* Improved performance in `pd.read_csv()` on some platforms with buffered reads ([GH 16039](https://github.com/pandas-dev/pandas/issues/16039)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +### Conversion[#](#conversion "Link to this heading") + +* Bug in `Timestamp.replace` now raises `TypeError` when incorrect argument names are given; previously this raised `ValueError` ([GH 15240](https://github.com/pandas-dev/pandas/issues/15240)) +* Bug in `Timestamp.replace` with compat for passing long integers ([GH 15030](https://github.com/pandas-dev/pandas/issues/15030)) +* Bug in `Timestamp` returning UTC based time/date attributes when a timezone was provided ([GH 13303](https://github.com/pandas-dev/pandas/issues/13303), [GH 6538](https://github.com/pandas-dev/pandas/issues/6538)) +* Bug in `Timestamp` incorrectly localizing timezones during construction ([GH 11481](https://github.com/pandas-dev/pandas/issues/11481), [GH 15777](https://github.com/pandas-dev/pandas/issues/15777)) +* Bug in `TimedeltaIndex` addition where overflow was being allowed without error ([GH 14816](https://github.com/pandas-dev/pandas/issues/14816)) +* Bug in `TimedeltaIndex` raising a `ValueError` when boolean indexing with `loc` ([GH 14946](https://github.com/pandas-dev/pandas/issues/14946)) +* Bug in catching an overflow in `Timestamp` + `Timedelta/Offset` operations ([GH 15126](https://github.com/pandas-dev/pandas/issues/15126)) +* Bug in `DatetimeIndex.round()` and `Timestamp.round()` floating point accuracy when rounding by milliseconds or less ([GH 14440](https://github.com/pandas-dev/pandas/issues/14440), [GH 15578](https://github.com/pandas-dev/pandas/issues/15578)) +* Bug in `astype()` where `inf` values were incorrectly converted to integers. Now raises error now with `astype()` for Series and DataFrames ([GH 14265](https://github.com/pandas-dev/pandas/issues/14265)) +* Bug in `DataFrame(..).apply(to_numeric)` when values are of type decimal.Decimal. ([GH 14827](https://github.com/pandas-dev/pandas/issues/14827)) +* Bug in `describe()` when passing a numpy array which does not contain the median to the `percentiles` keyword argument ([GH 14908](https://github.com/pandas-dev/pandas/issues/14908)) +* Cleaned up `PeriodIndex` constructor, including raising on floats more consistently ([GH 13277](https://github.com/pandas-dev/pandas/issues/13277)) +* Bug in using `__deepcopy__` on empty NDFrame objects ([GH 15370](https://github.com/pandas-dev/pandas/issues/15370)) +* Bug in `.replace()` may result in incorrect dtypes. ([GH 12747](https://github.com/pandas-dev/pandas/issues/12747), [GH 15765](https://github.com/pandas-dev/pandas/issues/15765)) +* Bug in `Series.replace` and `DataFrame.replace` which failed on empty replacement dicts ([GH 15289](https://github.com/pandas-dev/pandas/issues/15289)) +* Bug in `Series.replace` which replaced a numeric by string ([GH 15743](https://github.com/pandas-dev/pandas/issues/15743)) +* Bug in `Index` construction with `NaN` elements and integer dtype specified ([GH 15187](https://github.com/pandas-dev/pandas/issues/15187)) +* Bug in `Series` construction with a datetimetz ([GH 14928](https://github.com/pandas-dev/pandas/issues/14928)) +* Bug in `Series.dt.round()` inconsistent behaviour on `NaT` ‘s with different arguments ([GH 14940](https://github.com/pandas-dev/pandas/issues/14940)) +* Bug in `Series` constructor when both `copy=True` and `dtype` arguments are provided ([GH 15125](https://github.com/pandas-dev/pandas/issues/15125)) +* Incorrect dtyped `Series` was returned by comparison methods (e.g., `lt`, `gt`, …) against a constant for an empty `DataFrame` ([GH 15077](https://github.com/pandas-dev/pandas/issues/15077)) +* Bug in `Series.ffill()` with mixed dtypes containing tz-aware datetimes. ([GH 14956](https://github.com/pandas-dev/pandas/issues/14956)) +* Bug in `DataFrame.fillna()` where the argument `downcast` was ignored when fillna value was of type `dict` ([GH 15277](https://github.com/pandas-dev/pandas/issues/15277)) +* Bug in `.asfreq()`, where frequency was not set for empty `Series` ([GH 14320](https://github.com/pandas-dev/pandas/issues/14320)) +* Bug in `DataFrame` construction with nulls and datetimes in a list-like ([GH 15869](https://github.com/pandas-dev/pandas/issues/15869)) +* Bug in `DataFrame.fillna()` with tz-aware datetimes ([GH 15855](https://github.com/pandas-dev/pandas/issues/15855)) +* Bug in `is_string_dtype`, `is_timedelta64_ns_dtype`, and `is_string_like_dtype` in which an error was raised when `None` was passed in ([GH 15941](https://github.com/pandas-dev/pandas/issues/15941)) +* Bug in the return type of `pd.unique` on a `Categorical`, which was returning an ndarray and not a `Categorical` ([GH 15903](https://github.com/pandas-dev/pandas/issues/15903)) +* Bug in `Index.to_series()` where the index was not copied (and so mutating later would change the original), ([GH 15949](https://github.com/pandas-dev/pandas/issues/15949)) +* Bug in indexing with partial string indexing with a len-1 DataFrame ([GH 16071](https://github.com/pandas-dev/pandas/issues/16071)) +* Bug in `Series` construction where passing invalid dtype didn’t raise an error. ([GH 15520](https://github.com/pandas-dev/pandas/issues/15520)) + +### Indexing[#](#indexing "Link to this heading") + +* Bug in `Index` power operations with reversed operands ([GH 14973](https://github.com/pandas-dev/pandas/issues/14973)) +* Bug in `DataFrame.sort_values()` when sorting by multiple columns where one column is of type `int64` and contains `NaT` ([GH 14922](https://github.com/pandas-dev/pandas/issues/14922)) +* Bug in `DataFrame.reindex()` in which `method` was ignored when passing `columns` ([GH 14992](https://github.com/pandas-dev/pandas/issues/14992)) +* Bug in `DataFrame.loc` with indexing a `MultiIndex` with a `Series` indexer ([GH 14730](https://github.com/pandas-dev/pandas/issues/14730), [GH 15424](https://github.com/pandas-dev/pandas/issues/15424)) +* Bug in `DataFrame.loc` with indexing a `MultiIndex` with a numpy array ([GH 15434](https://github.com/pandas-dev/pandas/issues/15434)) +* Bug in `Series.asof` which raised if the series contained all `np.nan` ([GH 15713](https://github.com/pandas-dev/pandas/issues/15713)) +* Bug in `.at` when selecting from a tz-aware column ([GH 15822](https://github.com/pandas-dev/pandas/issues/15822)) +* Bug in `Series.where()` and `DataFrame.where()` where array-like conditionals were being rejected ([GH 15414](https://github.com/pandas-dev/pandas/issues/15414)) +* Bug in `Series.where()` where TZ-aware data was converted to float representation ([GH 15701](https://github.com/pandas-dev/pandas/issues/15701)) +* Bug in `.loc` that would not return the correct dtype for scalar access for a DataFrame ([GH 11617](https://github.com/pandas-dev/pandas/issues/11617)) +* Bug in output formatting of a `MultiIndex` when names are integers ([GH 12223](https://github.com/pandas-dev/pandas/issues/12223), [GH 15262](https://github.com/pandas-dev/pandas/issues/15262)) +* Bug in `Categorical.searchsorted()` where alphabetical instead of the provided categorical order was used ([GH 14522](https://github.com/pandas-dev/pandas/issues/14522)) +* Bug in `Series.iloc` where a `Categorical` object for list-like indexes input was returned, where a `Series` was expected. ([GH 14580](https://github.com/pandas-dev/pandas/issues/14580)) +* Bug in `DataFrame.isin` comparing datetimelike to empty frame ([GH 15473](https://github.com/pandas-dev/pandas/issues/15473)) +* Bug in `.reset_index()` when an all `NaN` level of a `MultiIndex` would fail ([GH 6322](https://github.com/pandas-dev/pandas/issues/6322)) +* Bug in `.reset_index()` when raising error for index name already present in `MultiIndex` columns ([GH 16120](https://github.com/pandas-dev/pandas/issues/16120)) +* Bug in creating a `MultiIndex` with tuples and not passing a list of names; this will now raise `ValueError` ([GH 15110](https://github.com/pandas-dev/pandas/issues/15110)) +* Bug in the HTML display with a `MultiIndex` and truncation ([GH 14882](https://github.com/pandas-dev/pandas/issues/14882)) +* Bug in the display of `.info()` where a qualifier (+) would always be displayed with a `MultiIndex` that contains only non-strings ([GH 15245](https://github.com/pandas-dev/pandas/issues/15245)) +* Bug in `pd.concat()` where the names of `MultiIndex` of resulting `DataFrame` are not handled correctly when `None` is presented in the names of `MultiIndex` of input `DataFrame` ([GH 15787](https://github.com/pandas-dev/pandas/issues/15787)) +* Bug in `DataFrame.sort_index()` and `Series.sort_index()` where `na_position` doesn’t work with a `MultiIndex` ([GH 14784](https://github.com/pandas-dev/pandas/issues/14784), [GH 16604](https://github.com/pandas-dev/pandas/issues/16604)) +* Bug in `pd.concat()` when combining objects with a `CategoricalIndex` ([GH 16111](https://github.com/pandas-dev/pandas/issues/16111)) +* Bug in indexing with a scalar and a `CategoricalIndex` ([GH 16123](https://github.com/pandas-dev/pandas/issues/16123)) + +### IO[#](#io "Link to this heading") + +* Bug in `pd.to_numeric()` in which float and unsigned integer elements were being improperly casted ([GH 14941](https://github.com/pandas-dev/pandas/issues/14941), [GH 15005](https://github.com/pandas-dev/pandas/issues/15005)) +* Bug in `pd.read_fwf()` where the skiprows parameter was not being respected during column width inference ([GH 11256](https://github.com/pandas-dev/pandas/issues/11256)) +* Bug in `pd.read_csv()` in which the `dialect` parameter was not being verified before processing ([GH 14898](https://github.com/pandas-dev/pandas/issues/14898)) +* Bug in `pd.read_csv()` in which missing data was being improperly handled with `usecols` ([GH 6710](https://github.com/pandas-dev/pandas/issues/6710)) +* Bug in `pd.read_csv()` in which a file containing a row with many columns followed by rows with fewer columns would cause a crash ([GH 14125](https://github.com/pandas-dev/pandas/issues/14125)) +* Bug in `pd.read_csv()` for the C engine where `usecols` were being indexed incorrectly with `parse_dates` ([GH 14792](https://github.com/pandas-dev/pandas/issues/14792)) +* Bug in `pd.read_csv()` with `parse_dates` when multi-line headers are specified ([GH 15376](https://github.com/pandas-dev/pandas/issues/15376)) +* Bug in `pd.read_csv()` with `float_precision='round_trip'` which caused a segfault when a text entry is parsed ([GH 15140](https://github.com/pandas-dev/pandas/issues/15140)) +* Bug in `pd.read_csv()` when an index was specified and no values were specified as null values ([GH 15835](https://github.com/pandas-dev/pandas/issues/15835)) +* Bug in `pd.read_csv()` in which certain invalid file objects caused the Python interpreter to crash ([GH 15337](https://github.com/pandas-dev/pandas/issues/15337)) +* Bug in `pd.read_csv()` in which invalid values for `nrows` and `chunksize` were allowed ([GH 15767](https://github.com/pandas-dev/pandas/issues/15767)) +* Bug in `pd.read_csv()` for the Python engine in which unhelpful error messages were being raised when parsing errors occurred ([GH 15910](https://github.com/pandas-dev/pandas/issues/15910)) +* Bug in `pd.read_csv()` in which the `skipfooter` parameter was not being properly validated ([GH 15925](https://github.com/pandas-dev/pandas/issues/15925)) +* Bug in `pd.to_csv()` in which there was numeric overflow when a timestamp index was being written ([GH 15982](https://github.com/pandas-dev/pandas/issues/15982)) +* Bug in `pd.util.hashing.hash_pandas_object()` in which hashing of categoricals depended on the ordering of categories, instead of just their values. ([GH 15143](https://github.com/pandas-dev/pandas/issues/15143)) +* Bug in `.to_json()` where `lines=True` and contents (keys or values) contain escaped characters ([GH 15096](https://github.com/pandas-dev/pandas/issues/15096)) +* Bug in `.to_json()` causing single byte ascii characters to be expanded to four byte unicode ([GH 15344](https://github.com/pandas-dev/pandas/issues/15344)) +* Bug in `.to_json()` for the C engine where rollover was not correctly handled for case where frac is odd and diff is exactly 0.5 ([GH 15716](https://github.com/pandas-dev/pandas/issues/15716), [GH 15864](https://github.com/pandas-dev/pandas/issues/15864)) +* Bug in `pd.read_json()` for Python 2 where `lines=True` and contents contain non-ascii unicode characters ([GH 15132](https://github.com/pandas-dev/pandas/issues/15132)) +* Bug in `pd.read_msgpack()` in which `Series` categoricals were being improperly processed ([GH 14901](https://github.com/pandas-dev/pandas/issues/14901)) +* Bug in `pd.read_msgpack()` which did not allow loading of a dataframe with an index of type `CategoricalIndex` ([GH 15487](https://github.com/pandas-dev/pandas/issues/15487)) +* Bug in `pd.read_msgpack()` when deserializing a `CategoricalIndex` ([GH 15487](https://github.com/pandas-dev/pandas/issues/15487)) +* Bug in `DataFrame.to_records()` with converting a `DatetimeIndex` with a timezone ([GH 13937](https://github.com/pandas-dev/pandas/issues/13937)) +* Bug in `DataFrame.to_records()` which failed with unicode characters in column names ([GH 11879](https://github.com/pandas-dev/pandas/issues/11879)) +* Bug in `.to_sql()` when writing a DataFrame with numeric index names ([GH 15404](https://github.com/pandas-dev/pandas/issues/15404)). +* Bug in `DataFrame.to_html()` with `index=False` and `max_rows` raising in `IndexError` ([GH 14998](https://github.com/pandas-dev/pandas/issues/14998)) +* Bug in `pd.read_hdf()` passing a `Timestamp` to the `where` parameter with a non date column ([GH 15492](https://github.com/pandas-dev/pandas/issues/15492)) +* Bug in `DataFrame.to_stata()` and `StataWriter` which produces incorrectly formatted files to be produced for some locales ([GH 13856](https://github.com/pandas-dev/pandas/issues/13856)) +* Bug in `StataReader` and `StataWriter` which allows invalid encodings ([GH 15723](https://github.com/pandas-dev/pandas/issues/15723)) +* Bug in the `Series` repr not showing the length when the output was truncated ([GH 15962](https://github.com/pandas-dev/pandas/issues/15962)). + +### Plotting[#](#plotting "Link to this heading") + +* Bug in `DataFrame.hist` where `plt.tight_layout` caused an `AttributeError` (use `matplotlib >= 2.0.1`) ([GH 9351](https://github.com/pandas-dev/pandas/issues/9351)) +* Bug in `DataFrame.boxplot` where `fontsize` was not applied to the tick labels on both axes ([GH 15108](https://github.com/pandas-dev/pandas/issues/15108)) +* Bug in the date and time converters pandas registers with matplotlib not handling multiple dimensions ([GH 16026](https://github.com/pandas-dev/pandas/issues/16026)) +* Bug in `pd.scatter_matrix()` could accept either `color` or `c`, but not both ([GH 14855](https://github.com/pandas-dev/pandas/issues/14855)) + +### GroupBy/resample/rolling[#](#groupby-resample-rolling "Link to this heading") + +* Bug in `.groupby(..).resample()` when passed the `on=` kwarg. ([GH 15021](https://github.com/pandas-dev/pandas/issues/15021)) +* Properly set `__name__` and `__qualname__` for `Groupby.*` functions ([GH 14620](https://github.com/pandas-dev/pandas/issues/14620)) +* Bug in `GroupBy.get_group()` failing with a categorical grouper ([GH 15155](https://github.com/pandas-dev/pandas/issues/15155)) +* Bug in `.groupby(...).rolling(...)` when `on` is specified and using a `DatetimeIndex` ([GH 15130](https://github.com/pandas-dev/pandas/issues/15130), [GH 13966](https://github.com/pandas-dev/pandas/issues/13966)) +* Bug in groupby operations with `timedelta64` when passing `numeric_only=False` ([GH 5724](https://github.com/pandas-dev/pandas/issues/5724)) +* Bug in `groupby.apply()` coercing `object` dtypes to numeric types, when not all values were numeric ([GH 14423](https://github.com/pandas-dev/pandas/issues/14423), [GH 15421](https://github.com/pandas-dev/pandas/issues/15421), [GH 15670](https://github.com/pandas-dev/pandas/issues/15670)) +* Bug in `resample`, where a non-string `loffset` argument would not be applied when resampling a timeseries ([GH 13218](https://github.com/pandas-dev/pandas/issues/13218)) +* Bug in `DataFrame.groupby().describe()` when grouping on `Index` containing tuples ([GH 14848](https://github.com/pandas-dev/pandas/issues/14848)) +* Bug in `groupby().nunique()` with a datetimelike-grouper where bins counts were incorrect ([GH 13453](https://github.com/pandas-dev/pandas/issues/13453)) +* Bug in `groupby.transform()` that would coerce the resultant dtypes back to the original ([GH 10972](https://github.com/pandas-dev/pandas/issues/10972), [GH 11444](https://github.com/pandas-dev/pandas/issues/11444)) +* Bug in `groupby.agg()` incorrectly localizing timezone on `datetime` ([GH 15426](https://github.com/pandas-dev/pandas/issues/15426), [GH 10668](https://github.com/pandas-dev/pandas/issues/10668), [GH 13046](https://github.com/pandas-dev/pandas/issues/13046)) +* Bug in `.rolling/expanding()` functions where `count()` was not counting `np.Inf`, nor handling `object` dtypes ([GH 12541](https://github.com/pandas-dev/pandas/issues/12541)) +* Bug in `.rolling()` where `pd.Timedelta` or `datetime.timedelta` was not accepted as a `window` argument ([GH 15440](https://github.com/pandas-dev/pandas/issues/15440)) +* Bug in `Rolling.quantile` function that caused a segmentation fault when called with a quantile value outside of the range [0, 1] ([GH 15463](https://github.com/pandas-dev/pandas/issues/15463)) +* Bug in `DataFrame.resample().median()` if duplicate column names are present ([GH 14233](https://github.com/pandas-dev/pandas/issues/14233)) + +### Sparse[#](#sparse "Link to this heading") + +* Bug in `SparseSeries.reindex` on single level with list of length 1 ([GH 15447](https://github.com/pandas-dev/pandas/issues/15447)) +* Bug in repr-formatting a `SparseDataFrame` after a value was set on (a copy of) one of its series ([GH 15488](https://github.com/pandas-dev/pandas/issues/15488)) +* Bug in `SparseDataFrame` construction with lists not coercing to dtype ([GH 15682](https://github.com/pandas-dev/pandas/issues/15682)) +* Bug in sparse array indexing in which indices were not being validated ([GH 15863](https://github.com/pandas-dev/pandas/issues/15863)) + +### Reshaping[#](#reshaping "Link to this heading") + +* Bug in `pd.merge_asof()` where `left_index` or `right_index` caused a failure when multiple `by` was specified ([GH 15676](https://github.com/pandas-dev/pandas/issues/15676)) +* Bug in `pd.merge_asof()` where `left_index`/`right_index` together caused a failure when `tolerance` was specified ([GH 15135](https://github.com/pandas-dev/pandas/issues/15135)) +* Bug in `DataFrame.pivot_table()` where `dropna=True` would not drop all-NaN columns when the columns was a `category` dtype ([GH 15193](https://github.com/pandas-dev/pandas/issues/15193)) +* Bug in `pd.melt()` where passing a tuple value for `value_vars` caused a `TypeError` ([GH 15348](https://github.com/pandas-dev/pandas/issues/15348)) +* Bug in `pd.pivot_table()` where no error was raised when values argument was not in the columns ([GH 14938](https://github.com/pandas-dev/pandas/issues/14938)) +* Bug in `pd.concat()` in which concatenating with an empty dataframe with `join='inner'` was being improperly handled ([GH 15328](https://github.com/pandas-dev/pandas/issues/15328)) +* Bug with `sort=True` in `DataFrame.join` and `pd.merge` when joining on indexes ([GH 15582](https://github.com/pandas-dev/pandas/issues/15582)) +* Bug in `DataFrame.nsmallest` and `DataFrame.nlargest` where identical values resulted in duplicated rows ([GH 15297](https://github.com/pandas-dev/pandas/issues/15297)) +* Bug in [`pandas.pivot_table()`](../reference/api/pandas.pivot_table.html#pandas.pivot_table "pandas.pivot_table") incorrectly raising `UnicodeError` when passing unicode input for `margins` keyword ([GH 13292](https://github.com/pandas-dev/pandas/issues/13292)) + +### Numeric[#](#numeric "Link to this heading") + +* Bug in `.rank()` which incorrectly ranks ordered categories ([GH 15420](https://github.com/pandas-dev/pandas/issues/15420)) +* Bug in `.corr()` and `.cov()` where the column and index were the same object ([GH 14617](https://github.com/pandas-dev/pandas/issues/14617)) +* Bug in `.mode()` where `mode` was not returned if was only a single value ([GH 15714](https://github.com/pandas-dev/pandas/issues/15714)) +* Bug in `pd.cut()` with a single bin on an all 0s array ([GH 15428](https://github.com/pandas-dev/pandas/issues/15428)) +* Bug in `pd.qcut()` with a single quantile and an array with identical values ([GH 15431](https://github.com/pandas-dev/pandas/issues/15431)) +* Bug in `pandas.tools.utils.cartesian_product()` with large input can cause overflow on windows ([GH 15265](https://github.com/pandas-dev/pandas/issues/15265)) +* Bug in `.eval()` which caused multi-line evals to fail with local variables not on the first line ([GH 15342](https://github.com/pandas-dev/pandas/issues/15342)) + +### Other[#](#other "Link to this heading") + +* Compat with SciPy 0.19.0 for testing on `.interpolate()` ([GH 15662](https://github.com/pandas-dev/pandas/issues/15662)) +* Compat for 32-bit platforms for `.qcut/cut`; bins will now be `int64` dtype ([GH 14866](https://github.com/pandas-dev/pandas/issues/14866)) +* Bug in interactions with `Qt` when a `QtApplication` already exists ([GH 14372](https://github.com/pandas-dev/pandas/issues/14372)) +* Avoid use of `np.finfo()` during `import pandas` removed to mitigate deadlock on Python GIL misuse ([GH 14641](https://github.com/pandas-dev/pandas/issues/14641)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 204 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Adam J. Stewart + +* Adrian + +* Ajay Saxena +* Akash Tandon + +* Albert Villanova del Moral + +* Aleksey Bilogur + +* Alexis Mignon + +* Amol Kahat + +* Andreas Winkler + +* Andrew Kittredge + +* Anthonios Partheniou +* Arco Bast + +* Ashish Singal + +* Baurzhan Muftakhidinov + +* Ben Kandel +* Ben Thayer + +* Ben Welsh + +* Bill Chambers + +* Brandon M. Burroughs +* Brian + +* Brian McFee + +* Carlos Souza + +* Chris +* Chris Ham +* Chris Warth +* Christoph Gohlke +* Christoph Paulik + +* Christopher C. Aycock +* Clemens Brunner + +* D.S. McNeil + +* DaanVanHauwermeiren + +* Daniel Himmelstein +* Dave Willmer +* David Cook + +* David Gwynne + +* David Hoffman + +* David Krych +* Diego Fernandez + +* Dimitris Spathis + +* Dmitry L + +* Dody Suria Wijaya + +* Dominik Stanczak + +* Dr-Irv +* Dr. Irv + +* Elliott Sales de Andrade + +* Ennemoser Christoph + +* Francesc Alted + +* Fumito Hamamura + +* Giacomo Ferroni +* Graham R. Jeffries + +* Greg Williams + +* Guilherme Beltramini + +* Guilherme Samora + +* Hao Wu + +* Harshit Patni + +* Ilya V. Schurov + +* Iván Vallés Pérez +* Jackie Leng + +* Jaehoon Hwang + +* James Draper + +* James Goppert + +* James McBride + +* James Santucci + +* Jan Schulz +* Jeff Carey +* Jeff Reback +* JennaVergeynst + +* Jim + +* Jim Crist +* Joe Jevnik +* Joel Nothman + +* John + +* John Tucker + +* John W. O’Brien +* John Zwinck +* Jon M. Mease +* Jon Mease +* Jonathan Whitmore + +* Jonathan de Bruin + +* Joost Kranendonk + +* Joris Van den Bossche +* Joshua Bradt + +* Julian Santander +* Julien Marrec + +* Jun Kim + +* Justin Solinsky + +* Kacawi + +* Kamal Kamalaldin + +* Kerby Shedden +* Kernc +* Keshav Ramaswamy +* Kevin Sheppard +* Kyle Kelley +* Larry Ren +* Leon Yin + +* Line Pedersen + +* Lorenzo Cestaro + +* Luca Scarabello +* Lukasz + +* Mahmoud Lababidi +* Mark Mandel + +* Matt Roeschke +* Matthew Brett +* Matthew Roeschke + +* Matti Picus +* Maximilian Roos +* Michael Charlton + +* Michael Felt +* Michael Lamparski + +* Michiel Stock + +* Mikolaj Chwalisz + +* Min RK +* Miroslav Šedivý + +* Mykola Golubyev +* Nate Yoder +* Nathalie Rud + +* Nicholas Ver Halen +* Nick Chmura + +* Nolan Nichols + +* Pankaj Pandey + +* Pawel Kordek +* Pete Huang + +* Peter + +* Peter Csizsek + +* Petio Petrov + +* Phil Ruffwind + +* Pietro Battiston +* Piotr Chromiec +* Prasanjit Prakash + +* Rob Forgione + +* Robert Bradshaw +* Robin + +* Rodolfo Fernandez +* Roger Thomas +* Rouz Azari + +* Sahil Dua +* Sam Foo + +* Sami Salonen + +* Sarah Bird + +* Sarma Tangirala + +* Scott Sanderson +* Sebastian Bank +* Sebastian Gsänger + +* Shawn Heide +* Shyam Saladi + +* Sinhrks +* Stephen Rauch + +* Sébastien de Menten + +* Tara Adiseshan +* Thiago Serafim +* Thoralf Gutierrez + +* Thrasibule + +* Tobias Gustafsson + +* Tom Augspurger +* Tong SHEN + +* Tong Shen + +* TrigonaMinima + +* Uwe + +* Wes Turner +* Wiktor Tomczak + +* WillAyd +* Yaroslav Halchenko +* Yimeng Zhang + +* abaldenko + +* adrian-stepien + +* alexandercbooth + +* atbd + +* bastewart + +* bmagnusson + +* carlosdanielcsantos + +* chaimdemulder + +* chris-b1 +* dickreuter + +* discort + +* dr-leo + +* dubourg +* dwkenefick + +* funnycrab + +* gfyoung +* goldenbull + +* hesham.shabana@hotmail.com +* jojomdt + +* linebp + +* manu + +* manuels + +* mattip + +* maxalbert + +* mcocdawc + +* nuffe + +* paul-mannino +* pbreach + +* sakkemo + +* scls19fr +* sinhrks +* stijnvanhoey + +* the-nose-knows + +* themrmax + +* tomrod + +* tzinckgraf +* wandersoncferreira +* watercrossing + +* wcwagner +* xgdgsc + +* yui-knk diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.20.2.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.20.2.md new file mode 100644 index 0000000000000000000000000000000000000000..913289615e0b55be01f141870bda57a479e9819a --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.20.2.md @@ -0,0 +1,155 @@ +# What's new in pandas 0.20.2 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.20.2.html + +# Version 0.20.2 (June 4, 2017)[#](#version-0-20-2-june-4-2017 "Link to this heading") + +This is a minor bug-fix release in the 0.20.x series and includes some small regression fixes, +bug fixes and performance improvements. +We recommend that all users upgrade to this version. + +What’s new in v0.20.2 + +* [Enhancements](#enhancements) +* [Performance improvements](#performance-improvements) +* [Bug fixes](#bug-fixes) + + + [Conversion](#conversion) + + [Indexing](#indexing) + + [IO](#io) + + [Plotting](#plotting) + + [GroupBy/resample/rolling](#groupby-resample-rolling) + + [Sparse](#sparse) + + [Reshaping](#reshaping) + + [Numeric](#numeric) + + [Categorical](#categorical) + + [Other](#other) +* [Contributors](#contributors) + +## Enhancements[#](#enhancements "Link to this heading") + +* Unblocked access to additional compression types supported in pytables: ‘blosc:blosclz, ‘blosc:lz4’, ‘blosc:lz4hc’, ‘blosc:snappy’, ‘blosc:zlib’, ‘blosc:zstd’ ([GH 14478](https://github.com/pandas-dev/pandas/issues/14478)) +* `Series` provides a `to_latex` method ([GH 16180](https://github.com/pandas-dev/pandas/issues/16180)) +* A new groupby method `GroupBy.ngroup()`, + parallel to the existing `GroupBy.cumcount()`, + has been added to return the group order ([GH 11642](https://github.com/pandas-dev/pandas/issues/11642)); see + [here](../user_guide/groupby.html#groupby-ngroup). + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Performance regression fix when indexing with a list-like ([GH 16285](https://github.com/pandas-dev/pandas/issues/16285)) +* Performance regression fix for MultiIndexes ([GH 16319](https://github.com/pandas-dev/pandas/issues/16319), [GH 16346](https://github.com/pandas-dev/pandas/issues/16346)) +* Improved performance of `.clip()` with scalar arguments ([GH 15400](https://github.com/pandas-dev/pandas/issues/15400)) +* Improved performance of groupby with categorical groupers ([GH 16413](https://github.com/pandas-dev/pandas/issues/16413)) +* Improved performance of `MultiIndex.remove_unused_levels()` ([GH 16556](https://github.com/pandas-dev/pandas/issues/16556)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Silenced a warning on some Windows environments about “tput: terminal attributes: No such device or address” when + detecting the terminal size. This fix only applies to python 3 ([GH 16496](https://github.com/pandas-dev/pandas/issues/16496)) +* Bug in using `pathlib.Path` or `py.path.local` objects with io functions ([GH 16291](https://github.com/pandas-dev/pandas/issues/16291)) +* Bug in `Index.symmetric_difference()` on two equal MultiIndex’s, results in a `TypeError` ([GH 13490](https://github.com/pandas-dev/pandas/issues/13490)) +* Bug in `DataFrame.update()` with `overwrite=False` and `NaN values` ([GH 15593](https://github.com/pandas-dev/pandas/issues/15593)) +* Passing an invalid engine to [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") now raises an informative + `ValueError` rather than `UnboundLocalError`. ([GH 16511](https://github.com/pandas-dev/pandas/issues/16511)) +* Bug in [`unique()`](../reference/api/pandas.unique.html#pandas.unique "pandas.unique") on an array of tuples ([GH 16519](https://github.com/pandas-dev/pandas/issues/16519)) +* Bug in [`cut()`](../reference/api/pandas.cut.html#pandas.cut "pandas.cut") when `labels` are set, resulting in incorrect label ordering ([GH 16459](https://github.com/pandas-dev/pandas/issues/16459)) +* Fixed a compatibility issue with IPython 6.0’s tab completion showing deprecation warnings on `Categoricals` ([GH 16409](https://github.com/pandas-dev/pandas/issues/16409)) + +### Conversion[#](#conversion "Link to this heading") + +* Bug in [`to_numeric()`](../reference/api/pandas.to_numeric.html#pandas.to_numeric "pandas.to_numeric") in which empty data inputs were causing a segfault of the interpreter ([GH 16302](https://github.com/pandas-dev/pandas/issues/16302)) +* Silence numpy warnings when broadcasting `DataFrame` to `Series` with comparison ops ([GH 16378](https://github.com/pandas-dev/pandas/issues/16378), [GH 16306](https://github.com/pandas-dev/pandas/issues/16306)) + +### Indexing[#](#indexing "Link to this heading") + +* Bug in `DataFrame.reset_index(level=)` with single level index ([GH 16263](https://github.com/pandas-dev/pandas/issues/16263)) +* Bug in partial string indexing with a monotonic, but not strictly-monotonic, index incorrectly reversing the slice bounds ([GH 16515](https://github.com/pandas-dev/pandas/issues/16515)) +* Bug in `MultiIndex.remove_unused_levels()` that would not return a `MultiIndex` equal to the original. ([GH 16556](https://github.com/pandas-dev/pandas/issues/16556)) + +### IO[#](#io "Link to this heading") + +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") when `comment` is passed in a space delimited text file ([GH 16472](https://github.com/pandas-dev/pandas/issues/16472)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") not raising an exception with nonexistent columns in `usecols` when it had the correct length ([GH 14671](https://github.com/pandas-dev/pandas/issues/14671)) +* Bug that would force importing of the clipboard routines unnecessarily, potentially causing an import error on startup ([GH 16288](https://github.com/pandas-dev/pandas/issues/16288)) +* Bug that raised `IndexError` when HTML-rendering an empty `DataFrame` ([GH 15953](https://github.com/pandas-dev/pandas/issues/15953)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") in which tarfile object inputs were raising an error in Python 2.x for the C engine ([GH 16530](https://github.com/pandas-dev/pandas/issues/16530)) +* Bug where `DataFrame.to_html()` ignored the `index_names` parameter ([GH 16493](https://github.com/pandas-dev/pandas/issues/16493)) +* Bug where `pd.read_hdf()` returns numpy strings for index names ([GH 13492](https://github.com/pandas-dev/pandas/issues/13492)) +* Bug in `HDFStore.select_as_multiple()` where start/stop arguments were not respected ([GH 16209](https://github.com/pandas-dev/pandas/issues/16209)) + +### Plotting[#](#plotting "Link to this heading") + +* Bug in `DataFrame.plot` with a single column and a list-like `color` ([GH 3486](https://github.com/pandas-dev/pandas/issues/3486)) +* Bug in `plot` where `NaT` in `DatetimeIndex` results in `Timestamp.min` ([GH 12405](https://github.com/pandas-dev/pandas/issues/12405)) +* Bug in `DataFrame.boxplot` where `figsize` keyword was not respected for non-grouped boxplots ([GH 11959](https://github.com/pandas-dev/pandas/issues/11959)) + +### GroupBy/resample/rolling[#](#groupby-resample-rolling "Link to this heading") + +* Bug in creating a time-based rolling window on an empty `DataFrame` ([GH 15819](https://github.com/pandas-dev/pandas/issues/15819)) +* Bug in `rolling.cov()` with offset window ([GH 16058](https://github.com/pandas-dev/pandas/issues/16058)) +* Bug in `.resample()` and `.groupby()` when aggregating on integers ([GH 16361](https://github.com/pandas-dev/pandas/issues/16361)) + +### Sparse[#](#sparse "Link to this heading") + +* Bug in construction of `SparseDataFrame` from `scipy.sparse.dok_matrix` ([GH 16179](https://github.com/pandas-dev/pandas/issues/16179)) + +### Reshaping[#](#reshaping "Link to this heading") + +* Bug in `DataFrame.stack` with unsorted levels in `MultiIndex` columns ([GH 16323](https://github.com/pandas-dev/pandas/issues/16323)) +* Bug in `pd.wide_to_long()` where no error was raised when `i` was not a unique identifier ([GH 16382](https://github.com/pandas-dev/pandas/issues/16382)) +* Bug in `Series.isin(..)` with a list of tuples ([GH 16394](https://github.com/pandas-dev/pandas/issues/16394)) +* Bug in construction of a `DataFrame` with mixed dtypes including an all-NaT column. ([GH 16395](https://github.com/pandas-dev/pandas/issues/16395)) +* Bug in `DataFrame.agg()` and `Series.agg()` with aggregating on non-callable attributes ([GH 16405](https://github.com/pandas-dev/pandas/issues/16405)) + +### Numeric[#](#numeric "Link to this heading") + +* Bug in `.interpolate()`, where `limit_direction` was not respected when `limit=None` (default) was passed ([GH 16282](https://github.com/pandas-dev/pandas/issues/16282)) + +### Categorical[#](#categorical "Link to this heading") + +* Fixed comparison operations considering the order of the categories when both categoricals are unordered ([GH 16014](https://github.com/pandas-dev/pandas/issues/16014)) + +### Other[#](#other "Link to this heading") + +* Bug in `DataFrame.drop()` with an empty-list with non-unique indices ([GH 16270](https://github.com/pandas-dev/pandas/issues/16270)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 34 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Aaron Barber + +* Andrew 亮 + +* Becky Sweger + +* Christian Prinoth + +* Christian Stade-Schuldt + +* DSM +* Erik Fredriksen + +* Hugues Valois + +* Jeff Reback +* Jeff Tratner +* JimStearns206 + +* John W. O’Brien +* Joris Van den Bossche +* JosephWagner + +* Keith Webber + +* Mehmet Ali “Mali” Akmanalp + +* Pankaj Pandey +* Patrick Luo + +* Patrick O’Melveny + +* Pietro Battiston +* RobinFiveWords + +* Ryan Hendrickson + +* SimonBaron + +* Tom Augspurger +* WBare + +* bpraggastis + +* chernrick + +* chris-b1 +* economy + +* gfyoung +* jaredsnyder + +* keitakurita + +* linebp +* lloydkirk + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.20.3.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.20.3.md new file mode 100644 index 0000000000000000000000000000000000000000..dcae04a592adeb0515129ebc0f81a4ac8dfca66f --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.20.3.md @@ -0,0 +1,86 @@ +# What's new in pandas 0.20.3 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.20.3.html + +# Version 0.20.3 (July 7, 2017)[#](#version-0-20-3-july-7-2017 "Link to this heading") + +This is a minor bug-fix release in the 0.20.x series and includes some small regression fixes +and bug fixes. We recommend that all users upgrade to this version. + +What’s new in v0.20.3 + +* [Bug fixes](#bug-fixes) + + + [Conversion](#conversion) + + [Indexing](#indexing) + + [IO](#io) + + [Plotting](#plotting) + + [Reshaping](#reshaping) + + [Categorical](#categorical) +* [Contributors](#contributors) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Fixed a bug in failing to compute rolling computations of a column-MultiIndexed `DataFrame` ([GH 16789](https://github.com/pandas-dev/pandas/issues/16789), [GH 16825](https://github.com/pandas-dev/pandas/issues/16825)) +* Fixed a pytest marker failing downstream packages’ tests suites ([GH 16680](https://github.com/pandas-dev/pandas/issues/16680)) + +### Conversion[#](#conversion "Link to this heading") + +* Bug in pickle compat prior to the v0.20.x series, when `UTC` is a timezone in a Series/DataFrame/Index ([GH 16608](https://github.com/pandas-dev/pandas/issues/16608)) +* Bug in `Series` construction when passing a `Series` with `dtype='category'` ([GH 16524](https://github.com/pandas-dev/pandas/issues/16524)). +* Bug in [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") when passing a `Series` as the `dtype` kwarg. ([GH 16717](https://github.com/pandas-dev/pandas/issues/16717)). + +### Indexing[#](#indexing "Link to this heading") + +* Bug in `Float64Index` causing an empty array instead of `None` to be returned from `.get(np.nan)` on a Series whose index did not contain any `NaN` s ([GH 8569](https://github.com/pandas-dev/pandas/issues/8569)) +* Bug in `MultiIndex.isin` causing an error when passing an empty iterable ([GH 16777](https://github.com/pandas-dev/pandas/issues/16777)) +* Fixed a bug in a slicing DataFrame/Series that have a `TimedeltaIndex` ([GH 16637](https://github.com/pandas-dev/pandas/issues/16637)) + +### IO[#](#io "Link to this heading") + +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") in which files weren’t opened as binary files by the C engine on Windows, causing EOF characters mid-field, which would fail ([GH 16039](https://github.com/pandas-dev/pandas/issues/16039), [GH 16559](https://github.com/pandas-dev/pandas/issues/16559), [GH 16675](https://github.com/pandas-dev/pandas/issues/16675)) +* Bug in [`read_hdf()`](../reference/api/pandas.read_hdf.html#pandas.read_hdf "pandas.read_hdf") in which reading a `Series` saved to an HDF file in ‘fixed’ format fails when an explicit `mode='r'` argument is supplied ([GH 16583](https://github.com/pandas-dev/pandas/issues/16583)) +* Bug in [`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex") where `bold_rows` was wrongly specified to be `True` by default, whereas in reality row labels remained non-bold whatever parameter provided. ([GH 16707](https://github.com/pandas-dev/pandas/issues/16707)) +* Fixed an issue with [`DataFrame.style()`](../reference/api/pandas.DataFrame.style.html#pandas.DataFrame.style "pandas.DataFrame.style") where generated element ids were not unique ([GH 16780](https://github.com/pandas-dev/pandas/issues/16780)) +* Fixed loading a `DataFrame` with a `PeriodIndex`, from a `format='fixed'` HDFStore, in Python 3, that was written in Python 2 ([GH 16781](https://github.com/pandas-dev/pandas/issues/16781)) + +### Plotting[#](#plotting "Link to this heading") + +* Fixed regression that prevented RGB and RGBA tuples from being used as color arguments ([GH 16233](https://github.com/pandas-dev/pandas/issues/16233)) +* Fixed an issue with [`DataFrame.plot.scatter()`](../reference/api/pandas.DataFrame.plot.scatter.html#pandas.DataFrame.plot.scatter "pandas.DataFrame.plot.scatter") that incorrectly raised a `KeyError` when categorical data is used for plotting ([GH 16199](https://github.com/pandas-dev/pandas/issues/16199)) + +### Reshaping[#](#reshaping "Link to this heading") + +* `PeriodIndex` / `TimedeltaIndex.join` was missing the `sort=` kwarg ([GH 16541](https://github.com/pandas-dev/pandas/issues/16541)) +* Bug in joining on a `MultiIndex` with a `category` dtype for a level ([GH 16627](https://github.com/pandas-dev/pandas/issues/16627)). +* Bug in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") when merging/joining with multiple categorical columns ([GH 16767](https://github.com/pandas-dev/pandas/issues/16767)) + +### Categorical[#](#categorical "Link to this heading") + +* Bug in `DataFrame.sort_values` not respecting the `kind` parameter with categorical data ([GH 16793](https://github.com/pandas-dev/pandas/issues/16793)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 20 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Bran Yang +* Chris +* Chris Kerr + +* DSM +* David Gwynne +* Douglas Rudd +* Forbidden Donut + +* Jeff Reback +* Joris Van den Bossche +* Karel De Brabandere + +* Peter Quackenbush + +* Pradyumna Reddy Chinthala + +* Telt + +* Tom Augspurger +* chris-b1 +* gfyoung +* ian + +* jdeschenes + +* kjford + +* ri938 + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.21.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.21.0.md new file mode 100644 index 0000000000000000000000000000000000000000..5f4465aafefc4d127c2343ba15bbd2791f472a2a --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.21.0.md @@ -0,0 +1,1519 @@ +# What's new in pandas 0.21.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.21.0.html + +# Version 0.21.0 (October 27, 2017)[#](#version-0-21-0-october-27-2017 "Link to this heading") + +This is a major release from 0.20.3 and includes a number of API changes, deprecations, new features, +enhancements, and performance improvements along with a large number of bug fixes. We recommend that all +users upgrade to this version. + +Highlights include: + +* Integration with [Apache Parquet](https://parquet.apache.org/), including a new top-level [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") function and [`DataFrame.to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") method, see [here](#whatsnew-0210-enhancements-parquet). +* New user-facing `pandas.api.types.CategoricalDtype` for specifying + categoricals independent of the data, see [here](#whatsnew-0210-enhancements-categorical-dtype). +* The behavior of `sum` and `prod` on all-NaN Series/DataFrames is now consistent and no longer depends on whether [bottleneck](https://bottleneck.readthedocs.io) is installed, and `sum` and `prod` on empty Series now return NaN instead of 0, see [here](#whatsnew-0210-api-breaking-bottleneck). +* Compatibility fixes for pypy, see [here](#whatsnew-0210-pypy). +* Additions to the `drop`, `reindex` and `rename` API to make them more consistent, see [here](#whatsnew-0210-enhancements-drop-api). +* Addition of the new methods `DataFrame.infer_objects` (see [here](#whatsnew-0210-enhancements-infer-objects)) and `GroupBy.pipe` (see [here](#whatsnew-0210-enhancements-groupby-pipe)). +* Indexing with a list of labels, where one or more of the labels is missing, is deprecated and will raise a KeyError in a future version, see [here](#whatsnew-0210-api-breaking-loc). + +Check the [API Changes](#whatsnew-0210-api-breaking) and [deprecations](#whatsnew-0210-deprecations) before updating. + +What’s new in v0.21.0 + +* [New features](#new-features) + + + [Integration with Apache Parquet file format](#integration-with-apache-parquet-file-format) + + [Method `infer_objects` type conversion](#method-infer-objects-type-conversion) + + [Improved warnings when attempting to create columns](#improved-warnings-when-attempting-to-create-columns) + + [Method `drop` now also accepts index/columns keywords](#method-drop-now-also-accepts-index-columns-keywords) + + [Methods `rename`, `reindex` now also accept axis keyword](#methods-rename-reindex-now-also-accept-axis-keyword) + + [`CategoricalDtype` for specifying categoricals](#categoricaldtype-for-specifying-categoricals) + + [`GroupBy` objects now have a `pipe` method](#groupby-objects-now-have-a-pipe-method) + + [`Categorical.rename_categories` accepts a dict-like](#categorical-rename-categories-accepts-a-dict-like) + + [Other enhancements](#other-enhancements) +* [Backwards incompatible API changes](#backwards-incompatible-api-changes) + + + [Dependencies have increased minimum versions](#dependencies-have-increased-minimum-versions) + + [Sum/prod of all-NaN or empty Series/DataFrames is now consistently NaN](#sum-prod-of-all-nan-or-empty-series-dataframes-is-now-consistently-nan) + + [Indexing with a list with missing labels is deprecated](#indexing-with-a-list-with-missing-labels-is-deprecated) + + [NA naming changes](#na-naming-changes) + + [Iteration of Series/Index will now return Python scalars](#iteration-of-series-index-will-now-return-python-scalars) + + [Indexing with a Boolean Index](#indexing-with-a-boolean-index) + + [`PeriodIndex` resampling](#periodindex-resampling) + + [Improved error handling during item assignment in pd.eval](#improved-error-handling-during-item-assignment-in-pd-eval) + + [Dtype conversions](#dtype-conversions) + + [MultiIndex constructor with a single level](#multiindex-constructor-with-a-single-level) + + [UTC localization with Series](#utc-localization-with-series) + + [Consistency of range functions](#consistency-of-range-functions) + + [No automatic Matplotlib converters](#no-automatic-matplotlib-converters) + + [Other API changes](#other-api-changes) +* [Deprecations](#deprecations) + + + [Series.select and DataFrame.select](#series-select-and-dataframe-select) + + [Series.argmax and Series.argmin](#series-argmax-and-series-argmin) +* [Removal of prior version deprecations/changes](#removal-of-prior-version-deprecations-changes) +* [Performance improvements](#performance-improvements) +* [Documentation changes](#documentation-changes) +* [Bug fixes](#bug-fixes) + + + [Conversion](#conversion) + + [Indexing](#indexing) + + [IO](#io) + + [Plotting](#plotting) + + [GroupBy/resample/rolling](#groupby-resample-rolling) + + [Sparse](#sparse) + + [Reshaping](#reshaping) + + [Numeric](#numeric) + + [Categorical](#categorical) + + [PyPy](#pypy) + + [Other](#other) +* [Contributors](#contributors) + +## New features[#](#new-features "Link to this heading") + +### Integration with Apache Parquet file format[#](#integration-with-apache-parquet-file-format "Link to this heading") + +Integration with [Apache Parquet](https://parquet.apache.org/), including a new top-level [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") and [`DataFrame.to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") method, see [here](../user_guide/io.html#io-parquet) ([GH 15838](https://github.com/pandas-dev/pandas/issues/15838), [GH 17438](https://github.com/pandas-dev/pandas/issues/17438)). + +[Apache Parquet](https://parquet.apache.org/) provides a cross-language, binary file format for reading and writing data frames efficiently. +Parquet is designed to faithfully serialize and de-serialize `DataFrame` s, supporting all of the pandas +dtypes, including extension dtypes such as datetime with timezones. + +This functionality depends on either the [pyarrow](http://arrow.apache.org/docs/python/) or [fastparquet](https://fastparquet.readthedocs.io/en/latest/) library. +For more details, see [the IO docs on Parquet](../user_guide/io.html#io-parquet). + +### Method `infer_objects` type conversion[#](#method-infer-objects-type-conversion "Link to this heading") + +The [`DataFrame.infer_objects()`](../reference/api/pandas.DataFrame.infer_objects.html#pandas.DataFrame.infer_objects "pandas.DataFrame.infer_objects") and [`Series.infer_objects()`](../reference/api/pandas.Series.infer_objects.html#pandas.Series.infer_objects "pandas.Series.infer_objects") +methods have been added to perform dtype inference on object columns, replacing +some of the functionality of the deprecated `convert_objects` +method. See the documentation [here](../user_guide/basics.html#basics-object-conversion) +for more details. ([GH 11221](https://github.com/pandas-dev/pandas/issues/11221)) + +This method only performs soft conversions on object columns, converting Python objects +to native types, but not any coercive conversions. For example: + +```None +In [1]: df = pd.DataFrame({'A': [1, 2, 3], + ...: 'B': np.array([1, 2, 3], dtype='object'), + ...: 'C': ['1', '2', '3']}) + ...: + +In [2]: df.dtypes +Out[2]: +A int64 +B object +C object +Length: 3, dtype: object + +In [3]: df.infer_objects().dtypes +Out[3]: +A int64 +B int64 +C object +Length: 3, dtype: object +``` + +Note that column `'C'` was not converted - only scalar numeric types +will be converted to a new type. Other types of conversion should be accomplished +using the [`to_numeric()`](../reference/api/pandas.to_numeric.html#pandas.to_numeric "pandas.to_numeric") function (or [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime"), [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta")). + +```None +In [4]: df = df.infer_objects() + +In [5]: df['C'] = pd.to_numeric(df['C'], errors='coerce') + +In [6]: df.dtypes +Out[6]: +A int64 +B int64 +C int64 +Length: 3, dtype: object +``` + +### Improved warnings when attempting to create columns[#](#improved-warnings-when-attempting-to-create-columns "Link to this heading") + +New users are often puzzled by the relationship between column operations and +attribute access on `DataFrame` instances ([GH 7175](https://github.com/pandas-dev/pandas/issues/7175)). One specific +instance of this confusion is attempting to create a new column by setting an +attribute on the `DataFrame`: + +```None +In [1]: df = pd.DataFrame({'one': [1., 2., 3.]}) +In [2]: df.two = [4, 5, 6] +``` + +This does not raise any obvious exceptions, but also does not create a new column: + +```None +In [3]: df +Out[3]: + one +0 1.0 +1 2.0 +2 3.0 +``` + +Setting a list-like data structure into a new attribute now raises a `UserWarning` about the potential for unexpected behavior. See [Attribute Access](../user_guide/indexing.html#indexing-attribute-access). + +### Method `drop` now also accepts index/columns keywords[#](#method-drop-now-also-accepts-index-columns-keywords "Link to this heading") + +The [`drop()`](../reference/api/pandas.DataFrame.drop.html#pandas.DataFrame.drop "pandas.DataFrame.drop") method has gained `index`/`columns` keywords as an +alternative to specifying the `axis`. This is similar to the behavior of `reindex` +([GH 12392](https://github.com/pandas-dev/pandas/issues/12392)). + +For example: + +```None +In [7]: df = pd.DataFrame(np.arange(8).reshape(2, 4), + ...: columns=['A', 'B', 'C', 'D']) + ...: + +In [8]: df +Out[8]: + A B C D +0 0 1 2 3 +1 4 5 6 7 + +[2 rows x 4 columns] + +In [9]: df.drop(['B', 'C'], axis=1) +Out[9]: + A D +0 0 3 +1 4 7 + +[2 rows x 2 columns] + +# the following is now equivalent +In [10]: df.drop(columns=['B', 'C']) +Out[10]: + A D +0 0 3 +1 4 7 + +[2 rows x 2 columns] +``` + +### Methods `rename`, `reindex` now also accept axis keyword[#](#methods-rename-reindex-now-also-accept-axis-keyword "Link to this heading") + +The [`DataFrame.rename()`](../reference/api/pandas.DataFrame.rename.html#pandas.DataFrame.rename "pandas.DataFrame.rename") and [`DataFrame.reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex") methods have gained +the `axis` keyword to specify the axis to target with the operation +([GH 12392](https://github.com/pandas-dev/pandas/issues/12392)). + +Here’s `rename`: + +```None +In [11]: df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]}) + +In [12]: df.rename(str.lower, axis='columns') +Out[12]: + a b +0 1 4 +1 2 5 +2 3 6 + +[3 rows x 2 columns] + +In [13]: df.rename(id, axis='index') +Out[13]: + A B +140206724563152 1 4 +140206724563184 2 5 +140206724563216 3 6 + +[3 rows x 2 columns] +``` + +And `reindex`: + +```None +In [14]: df.reindex(['A', 'B', 'C'], axis='columns') +Out[14]: + A B C +0 1 4 NaN +1 2 5 NaN +2 3 6 NaN + +[3 rows x 3 columns] + +In [15]: df.reindex([0, 1, 3], axis='index') +Out[15]: + A B +0 1.0 4.0 +1 2.0 5.0 +3 NaN NaN + +[3 rows x 2 columns] +``` + +The “index, columns” style continues to work as before. + +```None +In [16]: df.rename(index=id, columns=str.lower) +Out[16]: + a b +140206724563152 1 4 +140206724563184 2 5 +140206724563216 3 6 + +[3 rows x 2 columns] + +In [17]: df.reindex(index=[0, 1, 3], columns=['A', 'B', 'C']) +Out[17]: + A B C +0 1.0 4.0 NaN +1 2.0 5.0 NaN +3 NaN NaN NaN + +[3 rows x 3 columns] +``` + +We *highly* encourage using named arguments to avoid confusion when using either +style. + +### `CategoricalDtype` for specifying categoricals[#](#categoricaldtype-for-specifying-categoricals "Link to this heading") + +`pandas.api.types.CategoricalDtype` has been added to the public API and +expanded to include the `categories` and `ordered` attributes. A +`CategoricalDtype` can be used to specify the set of categories and +orderedness of an array, independent of the data. This can be useful for example, +when converting string data to a `Categorical` ([GH 14711](https://github.com/pandas-dev/pandas/issues/14711), +[GH 15078](https://github.com/pandas-dev/pandas/issues/15078), [GH 16015](https://github.com/pandas-dev/pandas/issues/16015), [GH 17643](https://github.com/pandas-dev/pandas/issues/17643)): + +```None +In [18]: from pandas.api.types import CategoricalDtype + +In [19]: s = pd.Series(['a', 'b', 'c', 'a']) # strings + +In [20]: dtype = CategoricalDtype(categories=['a', 'b', 'c', 'd'], ordered=True) + +In [21]: s.astype(dtype) +Out[21]: +0 a +1 b +2 c +3 a +Length: 4, dtype: category +Categories (4, object): ['a' < 'b' < 'c' < 'd'] +``` + +One place that deserves special mention is in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv"). Previously, with +`dtype={'col': 'category'}`, the returned values and categories would always +be strings. + +```None +In [22]: data = 'A,B\na,1\nb,2\nc,3' + +In [23]: pd.read_csv(StringIO(data), dtype={'B': 'category'}).B.cat.categories +Out[23]: Index(['1', '2', '3'], dtype='object') +``` + +Notice the “object” dtype. + +With a `CategoricalDtype` of all numerics, datetimes, or +timedeltas, we can automatically convert to the correct type + +```None +In [24]: dtype = {'B': CategoricalDtype([1, 2, 3])} + +In [25]: pd.read_csv(StringIO(data), dtype=dtype).B.cat.categories +Out[25]: Index([1, 2, 3], dtype='int64') +``` + +The values have been correctly interpreted as integers. + +The `.dtype` property of a `Categorical`, `CategoricalIndex` or a +`Series` with categorical type will now return an instance of +`CategoricalDtype`. While the repr has changed, `str(CategoricalDtype())` is +still the string `'category'`. We’ll take this moment to remind users that the +*preferred* way to detect categorical data is to use +[`pandas.api.types.is_categorical_dtype()`](../reference/api/pandas.api.types.is_categorical_dtype.html#pandas.api.types.is_categorical_dtype "pandas.api.types.is_categorical_dtype"), and not `str(dtype) == 'category'`. + +See the [CategoricalDtype docs](../user_guide/categorical.html#categorical-categoricaldtype) for more. + +### `GroupBy` objects now have a `pipe` method[#](#groupby-objects-now-have-a-pipe-method "Link to this heading") + +`GroupBy` objects now have a `pipe` method, similar to the one on +`DataFrame` and `Series`, that allow for functions that take a +`GroupBy` to be composed in a clean, readable syntax. ([GH 17871](https://github.com/pandas-dev/pandas/issues/17871)) + +For a concrete example on combining `.groupby` and `.pipe` , imagine having a +DataFrame with columns for stores, products, revenue and sold quantity. We’d like to +do a groupwise calculation of *prices* (i.e. revenue/quantity) per store and per product. +We could do this in a multi-step operation, but expressing it in terms of piping can make the +code more readable. + +First we set the data: + +```None +In [26]: import numpy as np + +In [27]: n = 1000 + +In [28]: df = pd.DataFrame({'Store': np.random.choice(['Store_1', 'Store_2'], n), + ....: 'Product': np.random.choice(['Product_1', + ....: 'Product_2', + ....: 'Product_3' + ....: ], n), + ....: 'Revenue': (np.random.random(n) * 50 + 10).round(2), + ....: 'Quantity': np.random.randint(1, 10, size=n)}) + ....: + +In [29]: df.head(2) +Out[29]: + Store Product Revenue Quantity +0 Store_2 Product_2 32.09 7 +1 Store_1 Product_3 14.20 1 + +[2 rows x 4 columns] +``` + +Now, to find prices per store/product, we can simply do: + +```None +In [30]: (df.groupby(['Store', 'Product']) + ....: .pipe(lambda grp: grp.Revenue.sum() / grp.Quantity.sum()) + ....: .unstack().round(2)) + ....: +Out[30]: +Product Product_1 Product_2 Product_3 +Store +Store_1 6.73 6.72 7.14 +Store_2 7.59 6.98 7.23 + +[2 rows x 3 columns] +``` + +See the [documentation](../user_guide/groupby.html#groupby-pipe) for more. + +### `Categorical.rename_categories` accepts a dict-like[#](#categorical-rename-categories-accepts-a-dict-like "Link to this heading") + +[`rename_categories()`](../reference/api/pandas.Series.cat.rename_categories.html#pandas.Series.cat.rename_categories "pandas.Series.cat.rename_categories") now accepts a dict-like argument for +`new_categories`. The previous categories are looked up in the dictionary’s +keys and replaced if found. The behavior of missing and extra keys is the same +as in [`DataFrame.rename()`](../reference/api/pandas.DataFrame.rename.html#pandas.DataFrame.rename "pandas.DataFrame.rename"). + +```None +In [31]: c = pd.Categorical(['a', 'a', 'b']) + +In [32]: c.rename_categories({"a": "eh", "b": "bee"}) +Out[32]: +['eh', 'eh', 'bee'] +Categories (2, object): ['eh', 'bee'] +``` + +Warning + +To assist with upgrading pandas, `rename_categories` treats `Series` as +list-like. Typically, Series are considered to be dict-like (e.g. in +`.rename`, `.map`). In a future version of pandas `rename_categories` +will change to treat them as dict-like. Follow the warning message’s +recommendations for writing future-proof code. + +```None +In [33]: c.rename_categories(pd.Series([0, 1], index=['a', 'c'])) +FutureWarning: Treating Series 'new_categories' as a list-like and using the values. +In a future version, 'rename_categories' will treat Series like a dictionary. +For dict-like, use 'new_categories.to_dict()' +For list-like, use 'new_categories.values'. +Out[33]: +[0, 0, 1] +Categories (2, int64): [0, 1] +``` + +### Other enhancements[#](#other-enhancements "Link to this heading") + +#### New functions or methods[#](#new-functions-or-methods "Link to this heading") + +* [`Resampler.nearest()`](../reference/api/pandas.core.resample.Resampler.nearest.html#pandas.core.resample.Resampler.nearest "pandas.core.resample.Resampler.nearest") is added to support nearest-neighbor upsampling ([GH 17496](https://github.com/pandas-dev/pandas/issues/17496)). +* [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") has added support for a `to_frame` method ([GH 15230](https://github.com/pandas-dev/pandas/issues/15230)). + +#### New keywords[#](#new-keywords "Link to this heading") + +* Added a `skipna` parameter to [`infer_dtype()`](../reference/api/pandas.api.types.infer_dtype.html#pandas.api.types.infer_dtype "pandas.api.types.infer_dtype") to + support type inference in the presence of missing values ([GH 17059](https://github.com/pandas-dev/pandas/issues/17059)). +* [`Series.to_dict()`](../reference/api/pandas.Series.to_dict.html#pandas.Series.to_dict "pandas.Series.to_dict") and [`DataFrame.to_dict()`](../reference/api/pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict") now support an `into` keyword which allows you to specify the `collections.Mapping` subclass that you would like returned. The default is `dict`, which is backwards compatible. ([GH 16122](https://github.com/pandas-dev/pandas/issues/16122)) +* [`Series.set_axis()`](../reference/api/pandas.Series.set_axis.html#pandas.Series.set_axis "pandas.Series.set_axis") and [`DataFrame.set_axis()`](../reference/api/pandas.DataFrame.set_axis.html#pandas.DataFrame.set_axis "pandas.DataFrame.set_axis") now support the `inplace` parameter. ([GH 14636](https://github.com/pandas-dev/pandas/issues/14636)) +* [`Series.to_pickle()`](../reference/api/pandas.Series.to_pickle.html#pandas.Series.to_pickle "pandas.Series.to_pickle") and [`DataFrame.to_pickle()`](../reference/api/pandas.DataFrame.to_pickle.html#pandas.DataFrame.to_pickle "pandas.DataFrame.to_pickle") have gained a `protocol` parameter ([GH 16252](https://github.com/pandas-dev/pandas/issues/16252)). By default, this parameter is set to [HIGHEST\_PROTOCOL](https://docs.python.org/3/library/pickle.html#data-stream-format) +* [`read_feather()`](../reference/api/pandas.read_feather.html#pandas.read_feather "pandas.read_feather") has gained the `nthreads` parameter for multi-threaded operations ([GH 16359](https://github.com/pandas-dev/pandas/issues/16359)) +* [`DataFrame.clip()`](../reference/api/pandas.DataFrame.clip.html#pandas.DataFrame.clip "pandas.DataFrame.clip") and [`Series.clip()`](../reference/api/pandas.Series.clip.html#pandas.Series.clip "pandas.Series.clip") have gained an `inplace` argument. ([GH 15388](https://github.com/pandas-dev/pandas/issues/15388)) +* [`crosstab()`](../reference/api/pandas.crosstab.html#pandas.crosstab "pandas.crosstab") has gained a `margins_name` parameter to define the name of the row / column that will contain the totals when `margins=True`. ([GH 15972](https://github.com/pandas-dev/pandas/issues/15972)) +* [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") now accepts a `chunksize` parameter that can be used when `lines=True`. If `chunksize` is passed, read\_json now returns an iterator which reads in `chunksize` lines with each iteration. ([GH 17048](https://github.com/pandas-dev/pandas/issues/17048)) +* [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") and [`to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") now accept a `compression` argument which allows them to transparently handle compressed files. ([GH 17798](https://github.com/pandas-dev/pandas/issues/17798)) + +#### Various enhancements[#](#various-enhancements "Link to this heading") + +* Improved the import time of pandas by about 2.25x. ([GH 16764](https://github.com/pandas-dev/pandas/issues/16764)) +* Support for [PEP 519 – Adding a file system path protocol](https://www.python.org/dev/peps/pep-0519/) on most readers (e.g. + [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv")) and writers (e.g. [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv")) ([GH 13823](https://github.com/pandas-dev/pandas/issues/13823)). +* Added a `__fspath__` method to `pd.HDFStore`, `pd.ExcelFile`, + and `pd.ExcelWriter` to work properly with the file system path protocol ([GH 13823](https://github.com/pandas-dev/pandas/issues/13823)). +* The `validate` argument for [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") now checks whether a merge is one-to-one, one-to-many, many-to-one, or many-to-many. If a merge is found to not be an example of specified merge type, an exception of type `MergeError` will be raised. For more, see [here](../user_guide/merging.html#merging-validation) ([GH 16270](https://github.com/pandas-dev/pandas/issues/16270)) +* Added support for [PEP 518](https://www.python.org/dev/peps/pep-0518/) (`pyproject.toml`) to the build system ([GH 16745](https://github.com/pandas-dev/pandas/issues/16745)) +* `RangeIndex.append()` now returns a `RangeIndex` object when possible ([GH 16212](https://github.com/pandas-dev/pandas/issues/16212)) +* [`Series.rename_axis()`](../reference/api/pandas.Series.rename_axis.html#pandas.Series.rename_axis "pandas.Series.rename_axis") and [`DataFrame.rename_axis()`](../reference/api/pandas.DataFrame.rename_axis.html#pandas.DataFrame.rename_axis "pandas.DataFrame.rename_axis") with `inplace=True` now return `None` while renaming the axis inplace. ([GH 15704](https://github.com/pandas-dev/pandas/issues/15704)) +* [`api.types.infer_dtype()`](../reference/api/pandas.api.types.infer_dtype.html#pandas.api.types.infer_dtype "pandas.api.types.infer_dtype") now infers decimals. ([GH 15690](https://github.com/pandas-dev/pandas/issues/15690)) +* [`DataFrame.select_dtypes()`](../reference/api/pandas.DataFrame.select_dtypes.html#pandas.DataFrame.select_dtypes "pandas.DataFrame.select_dtypes") now accepts scalar values for include/exclude as well as list-like. ([GH 16855](https://github.com/pandas-dev/pandas/issues/16855)) +* [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range") now accepts ‘YS’ in addition to ‘AS’ as an alias for start of year. ([GH 9313](https://github.com/pandas-dev/pandas/issues/9313)) +* [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range") now accepts ‘Y’ in addition to ‘A’ as an alias for end of year. ([GH 9313](https://github.com/pandas-dev/pandas/issues/9313)) +* [`DataFrame.add_prefix()`](../reference/api/pandas.DataFrame.add_prefix.html#pandas.DataFrame.add_prefix "pandas.DataFrame.add_prefix") and [`DataFrame.add_suffix()`](../reference/api/pandas.DataFrame.add_suffix.html#pandas.DataFrame.add_suffix "pandas.DataFrame.add_suffix") now accept strings containing the ‘%’ character. ([GH 17151](https://github.com/pandas-dev/pandas/issues/17151)) +* Read/write methods that infer compression ([`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv"), [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table"), [`read_pickle()`](../reference/api/pandas.read_pickle.html#pandas.read_pickle "pandas.read_pickle"), and [`to_pickle()`](../reference/api/pandas.DataFrame.to_pickle.html#pandas.DataFrame.to_pickle "pandas.DataFrame.to_pickle")) can now infer from path-like objects, such as `pathlib.Path`. ([GH 17206](https://github.com/pandas-dev/pandas/issues/17206)) +* [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") now recognizes much more of the most frequently used date (datetime) formats in SAS7BDAT files. ([GH 15871](https://github.com/pandas-dev/pandas/issues/15871)) +* [`DataFrame.items()`](../reference/api/pandas.DataFrame.items.html#pandas.DataFrame.items "pandas.DataFrame.items") and [`Series.items()`](../reference/api/pandas.Series.items.html#pandas.Series.items "pandas.Series.items") are now present in both Python 2 and 3 and is lazy in all cases. ([GH 13918](https://github.com/pandas-dev/pandas/issues/13918), [GH 17213](https://github.com/pandas-dev/pandas/issues/17213)) +* `pandas.io.formats.style.Styler.where()` has been implemented as a convenience for `pandas.io.formats.style.Styler.applymap()`. ([GH 17474](https://github.com/pandas-dev/pandas/issues/17474)) +* `MultiIndex.is_monotonic_decreasing()` has been implemented. Previously returned `False` in all cases. ([GH 16554](https://github.com/pandas-dev/pandas/issues/16554)) +* [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") raises `ImportError` with a better message if `xlrd` is not installed. ([GH 17613](https://github.com/pandas-dev/pandas/issues/17613)) +* [`DataFrame.assign()`](../reference/api/pandas.DataFrame.assign.html#pandas.DataFrame.assign "pandas.DataFrame.assign") will preserve the original order of `**kwargs` for Python 3.6+ users instead of sorting the column names. ([GH 14207](https://github.com/pandas-dev/pandas/issues/14207)) +* [`Series.reindex()`](../reference/api/pandas.Series.reindex.html#pandas.Series.reindex "pandas.Series.reindex"), [`DataFrame.reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex"), [`Index.get_indexer()`](../reference/api/pandas.Index.get_indexer.html#pandas.Index.get_indexer "pandas.Index.get_indexer") now support list-like argument for `tolerance`. ([GH 17367](https://github.com/pandas-dev/pandas/issues/17367)) + +## Backwards incompatible API changes[#](#backwards-incompatible-api-changes "Link to this heading") + +### Dependencies have increased minimum versions[#](#dependencies-have-increased-minimum-versions "Link to this heading") + +We have updated our minimum supported versions of dependencies ([GH 15206](https://github.com/pandas-dev/pandas/issues/15206), [GH 15543](https://github.com/pandas-dev/pandas/issues/15543), [GH 15214](https://github.com/pandas-dev/pandas/issues/15214)). +If installed, we now require: + +> | Package | Minimum Version | Required | +> | --- | --- | --- | +> | Numpy | 1.9.0 | X | +> | Matplotlib | 1.4.3 | | +> | Scipy | 0.14.0 | | +> | Bottleneck | 1.0.0 | | + +Additionally, support has been dropped for Python 3.4 ([GH 15251](https://github.com/pandas-dev/pandas/issues/15251)). + +### Sum/prod of all-NaN or empty Series/DataFrames is now consistently NaN[#](#sum-prod-of-all-nan-or-empty-series-dataframes-is-now-consistently-nan "Link to this heading") + +Note + +The changes described here have been partially reverted. See +the [v0.22.0 Whatsnew](v0.22.0.html#whatsnew-0220) for more. + +The behavior of `sum` and `prod` on all-NaN Series/DataFrames no longer depends on +whether [bottleneck](https://bottleneck.readthedocs.io) is installed, and return value of `sum` and `prod` on an empty Series has changed ([GH 9422](https://github.com/pandas-dev/pandas/issues/9422), [GH 15507](https://github.com/pandas-dev/pandas/issues/15507)). + +Calling `sum` or `prod` on an empty or all-`NaN` `Series`, or columns of a `DataFrame`, will result in `NaN`. See the [docs](../user_guide/missing_data.html#missing-data-calculations). + +```None +In [33]: s = pd.Series([np.nan]) +``` + +Previously WITHOUT `bottleneck` installed: + +```None +In [2]: s.sum() +Out[2]: np.nan +``` + +Previously WITH `bottleneck`: + +```None +In [2]: s.sum() +Out[2]: 0.0 +``` + +New behavior, without regard to the bottleneck installation: + +```None +In [34]: s.sum() +Out[34]: 0.0 +``` + +Note that this also changes the sum of an empty `Series`. Previously this always returned 0 regardless of a `bottleneck` installation: + +```None +In [1]: pd.Series([]).sum() +Out[1]: 0 +``` + +but for consistency with the all-NaN case, this was changed to return 0 as well: + +```None +In [2]: pd.Series([]).sum() +Out[2]: 0 +``` + +### Indexing with a list with missing labels is deprecated[#](#indexing-with-a-list-with-missing-labels-is-deprecated "Link to this heading") + +Previously, selecting with a list of labels, where one or more labels were missing would always succeed, returning `NaN` for missing labels. +This will now show a `FutureWarning`. In the future this will raise a `KeyError` ([GH 15747](https://github.com/pandas-dev/pandas/issues/15747)). +This warning will trigger on a `DataFrame` or a `Series` for using `.loc[]` or `[[]]` when passing a list-of-labels with at least 1 missing label. + +```None +In [35]: s = pd.Series([1, 2, 3]) + +In [36]: s +Out[36]: +0 1 +1 2 +2 3 +Length: 3, dtype: int64 +``` + +Previous behavior + +```None +In [4]: s.loc[[1, 2, 3]] +Out[4]: +1 2.0 +2 3.0 +3 NaN +dtype: float64 +``` + +Current behavior + +```None +In [4]: s.loc[[1, 2, 3]] +Passing list-likes to .loc or [] with any missing label will raise +KeyError in the future, you can use .reindex() as an alternative. + +See the documentation here: +https://pandas.pydata.org/pandas-docs/stable/indexing.html#deprecate-loc-reindex-listlike + +Out[4]: +1 2.0 +2 3.0 +3 NaN +dtype: float64 +``` + +The idiomatic way to achieve selecting potentially not-found elements is via `.reindex()` + +```None +In [37]: s.reindex([1, 2, 3]) +Out[37]: +1 2.0 +2 3.0 +3 NaN +Length: 3, dtype: float64 +``` + +Selection with all keys found is unchanged. + +```None +In [38]: s.loc[[1, 2]] +Out[38]: +1 2 +2 3 +Length: 2, dtype: int64 +``` + +### NA naming changes[#](#na-naming-changes "Link to this heading") + +In order to promote more consistency among the pandas API, we have added additional top-level +functions [`isna()`](../reference/api/pandas.isna.html#pandas.isna "pandas.isna") and [`notna()`](../reference/api/pandas.notna.html#pandas.notna "pandas.notna") that are aliases for [`isnull()`](../reference/api/pandas.isnull.html#pandas.isnull "pandas.isnull") and [`notnull()`](../reference/api/pandas.notnull.html#pandas.notnull "pandas.notnull"). +The naming scheme is now more consistent with methods like `.dropna()` and `.fillna()`. Furthermore +in all cases where `.isnull()` and `.notnull()` methods are defined, these have additional methods +named `.isna()` and `.notna()`, these are included for classes `Categorical`, +`Index`, `Series`, and `DataFrame`. ([GH 15001](https://github.com/pandas-dev/pandas/issues/15001)). + +The configuration option `pd.options.mode.use_inf_as_null` is deprecated, and `pd.options.mode.use_inf_as_na` is added as a replacement. + +### Iteration of Series/Index will now return Python scalars[#](#iteration-of-series-index-will-now-return-python-scalars "Link to this heading") + +Previously, when using certain iteration methods for a `Series` with dtype `int` or `float`, you would receive a `numpy` scalar, e.g. a `np.int64`, rather than a Python `int`. Issue ([GH 10904](https://github.com/pandas-dev/pandas/issues/10904)) corrected this for `Series.tolist()` and `list(Series)`. This change makes all iteration methods consistent, in particular, for `__iter__()` and `.map()`; note that this only affects int/float dtypes. ([GH 13236](https://github.com/pandas-dev/pandas/issues/13236), [GH 13258](https://github.com/pandas-dev/pandas/issues/13258), [GH 14216](https://github.com/pandas-dev/pandas/issues/14216)). + +```None +In [39]: s = pd.Series([1, 2, 3]) + +In [40]: s +Out[40]: +0 1 +1 2 +2 3 +Length: 3, dtype: int64 +``` + +Previously: + +```None +In [2]: type(list(s)[0]) +Out[2]: numpy.int64 +``` + +New behavior: + +```None +In [41]: type(list(s)[0]) +Out[41]: int +``` + +Furthermore this will now correctly box the results of iteration for [`DataFrame.to_dict()`](../reference/api/pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict") as well. + +```None +In [42]: d = {'a': [1], 'b': ['b']} + +In [43]: df = pd.DataFrame(d) +``` + +Previously: + +```None +In [8]: type(df.to_dict()['a'][0]) +Out[8]: numpy.int64 +``` + +New behavior: + +```None +In [44]: type(df.to_dict()['a'][0]) +Out[44]: int +``` + +### Indexing with a Boolean Index[#](#indexing-with-a-boolean-index "Link to this heading") + +Previously when passing a boolean `Index` to `.loc`, if the index of the `Series/DataFrame` had `boolean` labels, +you would get a label based selection, potentially duplicating result labels, rather than a boolean indexing selection +(where `True` selects elements), this was inconsistent how a boolean numpy array indexed. The new behavior is to +act like a boolean numpy array indexer. ([GH 17738](https://github.com/pandas-dev/pandas/issues/17738)) + +Previous behavior: + +```None +In [45]: s = pd.Series([1, 2, 3], index=[False, True, False]) + +In [46]: s +Out[46]: +False 1 +True 2 +False 3 +Length: 3, dtype: int64 +``` + +```None +In [59]: s.loc[pd.Index([True, False, True])] +Out[59]: +True 2 +False 1 +False 3 +True 2 +dtype: int64 +``` + +Current behavior + +```None +In [47]: s.loc[pd.Index([True, False, True])] +Out[47]: +False 1 +False 3 +Length: 2, dtype: int64 +``` + +Furthermore, previously if you had an index that was non-numeric (e.g. strings), then a boolean Index would raise a `KeyError`. +This will now be treated as a boolean indexer. + +Previously behavior: + +```None +In [48]: s = pd.Series([1, 2, 3], index=['a', 'b', 'c']) + +In [49]: s +Out[49]: +a 1 +b 2 +c 3 +Length: 3, dtype: int64 +``` + +```None +In [39]: s.loc[pd.Index([True, False, True])] +KeyError: "None of [Index([True, False, True], dtype='object')] are in the [index]" +``` + +Current behavior + +```None +In [50]: s.loc[pd.Index([True, False, True])] +Out[50]: +a 1 +c 3 +Length: 2, dtype: int64 +``` + +### `PeriodIndex` resampling[#](#periodindex-resampling "Link to this heading") + +In previous versions of pandas, resampling a `Series`/`DataFrame` indexed by a `PeriodIndex` returned a `DatetimeIndex` in some cases ([GH 12884](https://github.com/pandas-dev/pandas/issues/12884)). Resampling to a multiplied frequency now returns a `PeriodIndex` ([GH 15944](https://github.com/pandas-dev/pandas/issues/15944)). As a minor enhancement, resampling a `PeriodIndex` can now handle `NaT` values ([GH 13224](https://github.com/pandas-dev/pandas/issues/13224)) + +Previous behavior: + +```None +In [1]: pi = pd.period_range('2017-01', periods=12, freq='M') + +In [2]: s = pd.Series(np.arange(12), index=pi) + +In [3]: resampled = s.resample('2Q').mean() + +In [4]: resampled +Out[4]: +2017-03-31 1.0 +2017-09-30 5.5 +2018-03-31 10.0 +Freq: 2Q-DEC, dtype: float64 + +In [5]: resampled.index +Out[5]: DatetimeIndex(['2017-03-31', '2017-09-30', '2018-03-31'], dtype='datetime64[ns]', freq='2Q-DEC') +``` + +New behavior: + +```None +In [51]: pi = pd.period_range('2017-01', periods=12, freq='M') + +In [52]: s = pd.Series(np.arange(12), index=pi) + +In [53]: resampled = s.resample('2Q').mean() + +In [54]: resampled +Out[54]: +2017Q1 2.5 +2017Q3 8.5 +Freq: 2Q-DEC, Length: 2, dtype: float64 + +In [55]: resampled.index +Out[55]: PeriodIndex(['2017Q1', '2017Q3'], dtype='period[2Q-DEC]') +``` + +Upsampling and calling `.ohlc()` previously returned a `Series`, basically identical to calling `.asfreq()`. OHLC upsampling now returns a DataFrame with columns `open`, `high`, `low` and `close` ([GH 13083](https://github.com/pandas-dev/pandas/issues/13083)). This is consistent with downsampling and `DatetimeIndex` behavior. + +Previous behavior: + +```None +In [1]: pi = pd.period_range(start='2000-01-01', freq='D', periods=10) + +In [2]: s = pd.Series(np.arange(10), index=pi) + +In [3]: s.resample('H').ohlc() +Out[3]: +2000-01-01 00:00 0.0 + ... +2000-01-10 23:00 NaN +Freq: H, Length: 240, dtype: float64 + +In [4]: s.resample('M').ohlc() +Out[4]: + open high low close +2000-01 0 9 0 9 +``` + +New behavior: + +```None +In [56]: pi = pd.period_range(start='2000-01-01', freq='D', periods=10) + +In [57]: s = pd.Series(np.arange(10), index=pi) + +In [58]: s.resample('H').ohlc() +Out[58]: + open high low close +2000-01-01 00:00 0.0 0.0 0.0 0.0 +2000-01-01 01:00 NaN NaN NaN NaN +2000-01-01 02:00 NaN NaN NaN NaN +2000-01-01 03:00 NaN NaN NaN NaN +2000-01-01 04:00 NaN NaN NaN NaN +... ... ... ... ... +2000-01-10 19:00 NaN NaN NaN NaN +2000-01-10 20:00 NaN NaN NaN NaN +2000-01-10 21:00 NaN NaN NaN NaN +2000-01-10 22:00 NaN NaN NaN NaN +2000-01-10 23:00 NaN NaN NaN NaN + +[240 rows x 4 columns] + +In [59]: s.resample('M').ohlc() +Out[59]: + open high low close +2000-01 0 9 0 9 + +[1 rows x 4 columns] +``` + +### Improved error handling during item assignment in pd.eval[#](#improved-error-handling-during-item-assignment-in-pd-eval "Link to this heading") + +[`eval()`](../reference/api/pandas.eval.html#pandas.eval "pandas.eval") will now raise a `ValueError` when item assignment malfunctions, or +inplace operations are specified, but there is no item assignment in the expression ([GH 16732](https://github.com/pandas-dev/pandas/issues/16732)) + +```None +In [56]: arr = np.array([1, 2, 3]) +``` + +Previously, if you attempted the following expression, you would get a not very helpful error message: + +```None +In [3]: pd.eval("a = 1 + 2", target=arr, inplace=True) +... +IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) +and integer or boolean arrays are valid indices +``` + +This is a very long way of saying numpy arrays don’t support string-item indexing. With this +change, the error message is now this: + +```None +In [3]: pd.eval("a = 1 + 2", target=arr, inplace=True) +... +ValueError: Cannot assign expression output to target +``` + +It also used to be possible to evaluate expressions inplace, even if there was no item assignment: + +```None +In [4]: pd.eval("1 + 2", target=arr, inplace=True) +Out[4]: 3 +``` + +However, this input does not make much sense because the output is not being assigned to +the target. Now, a `ValueError` will be raised when such an input is passed in: + +```None +In [4]: pd.eval("1 + 2", target=arr, inplace=True) +... +ValueError: Cannot operate inplace if there is no assignment +``` + +### Dtype conversions[#](#dtype-conversions "Link to this heading") + +Previously assignments, `.where()` and `.fillna()` with a `bool` assignment, would coerce to same the type (e.g. int / float), or raise for datetimelikes. These will now preserve the bools with `object` dtypes. ([GH 16821](https://github.com/pandas-dev/pandas/issues/16821)). + +```None +In [57]: s = pd.Series([1, 2, 3]) +``` + +```None +In [5]: s[1] = True + +In [6]: s +Out[6]: +0 1 +1 1 +2 3 +dtype: int64 +``` + +New behavior + +```None +In [7]: s[1] = True + +In [8]: s +Out[8]: +0 1 +1 True +2 3 +Length: 3, dtype: object +``` + +Previously, as assignment to a datetimelike with a non-datetimelike would coerce the +non-datetime-like item being assigned ([GH 14145](https://github.com/pandas-dev/pandas/issues/14145)). + +```None +In [58]: s = pd.Series([pd.Timestamp('2011-01-01'), pd.Timestamp('2012-01-01')]) +``` + +```None +In [1]: s[1] = 1 + +In [2]: s +Out[2]: +0 2011-01-01 00:00:00.000000000 +1 1970-01-01 00:00:00.000000001 +dtype: datetime64[ns] +``` + +These now coerce to `object` dtype. + +```None +In [1]: s[1] = 1 + +In [2]: s +Out[2]: +0 2011-01-01 00:00:00 +1 1 +dtype: object +``` + +* Inconsistent behavior in `.where()` with datetimelikes which would raise rather than coerce to `object` ([GH 16402](https://github.com/pandas-dev/pandas/issues/16402)) +* Bug in assignment against `int64` data with `np.ndarray` with `float64` dtype may keep `int64` dtype ([GH 14001](https://github.com/pandas-dev/pandas/issues/14001)) + +### MultiIndex constructor with a single level[#](#multiindex-constructor-with-a-single-level "Link to this heading") + +The `MultiIndex` constructors no longer squeezes a MultiIndex with all +length-one levels down to a regular `Index`. This affects all the +`MultiIndex` constructors. ([GH 17178](https://github.com/pandas-dev/pandas/issues/17178)) + +Previous behavior: + +```None +In [2]: pd.MultiIndex.from_tuples([('a',), ('b',)]) +Out[2]: Index(['a', 'b'], dtype='object') +``` + +Length 1 levels are no longer special-cased. They behave exactly as if you had +length 2+ levels, so a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") is always returned from all of the +`MultiIndex` constructors: + +```None +In [59]: pd.MultiIndex.from_tuples([('a',), ('b',)]) +Out[59]: +MultiIndex([('a',), + ('b',)], + ) +``` + +### UTC localization with Series[#](#utc-localization-with-series "Link to this heading") + +Previously, [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") did not localize datetime `Series` data when `utc=True` was passed. Now, [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") will correctly localize `Series` with a `datetime64[ns, UTC]` dtype to be consistent with how list-like and `Index` data are handled. ([GH 6415](https://github.com/pandas-dev/pandas/issues/6415)). + +Previous behavior + +```None +In [60]: s = pd.Series(['20130101 00:00:00'] * 3) +``` + +```None +In [12]: pd.to_datetime(s, utc=True) +Out[12]: +0 2013-01-01 +1 2013-01-01 +2 2013-01-01 +dtype: datetime64[ns] +``` + +New behavior + +```None +In [61]: pd.to_datetime(s, utc=True) +Out[61]: +0 2013-01-01 00:00:00+00:00 +1 2013-01-01 00:00:00+00:00 +2 2013-01-01 00:00:00+00:00 +Length: 3, dtype: datetime64[ns, UTC] +``` + +Additionally, DataFrames with datetime columns that were parsed by [`read_sql_table()`](../reference/api/pandas.read_sql_table.html#pandas.read_sql_table "pandas.read_sql_table") and [`read_sql_query()`](../reference/api/pandas.read_sql_query.html#pandas.read_sql_query "pandas.read_sql_query") will also be localized to UTC only if the original SQL columns were timezone aware datetime columns. + +### Consistency of range functions[#](#consistency-of-range-functions "Link to this heading") + +In previous versions, there were some inconsistencies between the various range functions: [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range"), [`bdate_range()`](../reference/api/pandas.bdate_range.html#pandas.bdate_range "pandas.bdate_range"), [`period_range()`](../reference/api/pandas.period_range.html#pandas.period_range "pandas.period_range"), [`timedelta_range()`](../reference/api/pandas.timedelta_range.html#pandas.timedelta_range "pandas.timedelta_range"), and [`interval_range()`](../reference/api/pandas.interval_range.html#pandas.interval_range "pandas.interval_range"). ([GH 17471](https://github.com/pandas-dev/pandas/issues/17471)). + +One of the inconsistent behaviors occurred when the `start`, `end` and `period` parameters were all specified, potentially leading to ambiguous ranges. When all three parameters were passed, `interval_range` ignored the `period` parameter, `period_range` ignored the `end` parameter, and the other range functions raised. To promote consistency among the range functions, and avoid potentially ambiguous ranges, `interval_range` and `period_range` will now raise when all three parameters are passed. + +Previous behavior: + +```None + In [2]: pd.interval_range(start=0, end=4, periods=6) + Out[2]: + IntervalIndex([(0, 1], (1, 2], (2, 3]] + closed='right', + dtype='interval[int64]') + +In [3]: pd.period_range(start='2017Q1', end='2017Q4', periods=6, freq='Q') +Out[3]: PeriodIndex(['2017Q1', '2017Q2', '2017Q3', '2017Q4', '2018Q1', '2018Q2'], dtype='period[Q-DEC]', freq='Q-DEC') +``` + +New behavior: + +```None +In [2]: pd.interval_range(start=0, end=4, periods=6) +--------------------------------------------------------------------------- +ValueError: Of the three parameters: start, end, and periods, exactly two must be specified + +In [3]: pd.period_range(start='2017Q1', end='2017Q4', periods=6, freq='Q') +--------------------------------------------------------------------------- +ValueError: Of the three parameters: start, end, and periods, exactly two must be specified +``` + +Additionally, the endpoint parameter `end` was not included in the intervals produced by `interval_range`. However, all other range functions include `end` in their output. To promote consistency among the range functions, `interval_range` will now include `end` as the right endpoint of the final interval, except if `freq` is specified in a way which skips `end`. + +Previous behavior: + +```None +In [4]: pd.interval_range(start=0, end=4) +Out[4]: +IntervalIndex([(0, 1], (1, 2], (2, 3]] + closed='right', + dtype='interval[int64]') +``` + +New behavior: + +```None +In [62]: pd.interval_range(start=0, end=4) +Out[62]: IntervalIndex([(0, 1], (1, 2], (2, 3], (3, 4]], dtype='interval[int64, right]') +``` + +### No automatic Matplotlib converters[#](#no-automatic-matplotlib-converters "Link to this heading") + +pandas no longer registers our `date`, `time`, `datetime`, +`datetime64`, and `Period` converters with matplotlib when pandas is +imported. Matplotlib plot methods (`plt.plot`, `ax.plot`, …), will not +nicely format the x-axis for `DatetimeIndex` or `PeriodIndex` values. You +must explicitly register these methods: + +pandas built-in `Series.plot` and `DataFrame.plot` *will* register these +converters on first-use ([GH 17710](https://github.com/pandas-dev/pandas/issues/17710)). + +Note + +This change has been temporarily reverted in pandas 0.21.1, +for more details see [here](v0.21.1.html#whatsnew-0211-converters). + +### Other API changes[#](#other-api-changes "Link to this heading") + +* The Categorical constructor no longer accepts a scalar for the `categories` keyword. ([GH 16022](https://github.com/pandas-dev/pandas/issues/16022)) +* Accessing a non-existent attribute on a closed `HDFStore` will now + raise an `AttributeError` rather than a `ClosedFileError` ([GH 16301](https://github.com/pandas-dev/pandas/issues/16301)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") now issues a `UserWarning` if the `names` parameter contains duplicates ([GH 17095](https://github.com/pandas-dev/pandas/issues/17095)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") now treats `'null'` and `'n/a'` strings as missing values by default ([GH 16471](https://github.com/pandas-dev/pandas/issues/16471), [GH 16078](https://github.com/pandas-dev/pandas/issues/16078)) +* `pandas.HDFStore`’s string representation is now faster and less detailed. For the previous behavior, use `pandas.HDFStore.info()`. ([GH 16503](https://github.com/pandas-dev/pandas/issues/16503)). +* Compression defaults in HDF stores now follow pytables standards. Default is no compression and if `complib` is missing and `complevel` > 0 `zlib` is used ([GH 15943](https://github.com/pandas-dev/pandas/issues/15943)) +* `Index.get_indexer_non_unique()` now returns a ndarray indexer rather than an `Index`; this is consistent with `Index.get_indexer()` ([GH 16819](https://github.com/pandas-dev/pandas/issues/16819)) +* Removed the `@slow` decorator from `pandas._testing`, which caused issues for some downstream packages’ test suites. Use `@pytest.mark.slow` instead, which achieves the same thing ([GH 16850](https://github.com/pandas-dev/pandas/issues/16850)) +* Moved definition of `MergeError` to the `pandas.errors` module. +* The signature of [`Series.set_axis()`](../reference/api/pandas.Series.set_axis.html#pandas.Series.set_axis "pandas.Series.set_axis") and [`DataFrame.set_axis()`](../reference/api/pandas.DataFrame.set_axis.html#pandas.DataFrame.set_axis "pandas.DataFrame.set_axis") has been changed from `set_axis(axis, labels)` to `set_axis(labels, axis=0)`, for consistency with the rest of the API. The old signature is deprecated and will show a `FutureWarning` ([GH 14636](https://github.com/pandas-dev/pandas/issues/14636)) +* [`Series.argmin()`](../reference/api/pandas.Series.argmin.html#pandas.Series.argmin "pandas.Series.argmin") and [`Series.argmax()`](../reference/api/pandas.Series.argmax.html#pandas.Series.argmax "pandas.Series.argmax") will now raise a `TypeError` when used with `object` dtypes, instead of a `ValueError` ([GH 13595](https://github.com/pandas-dev/pandas/issues/13595)) +* [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") is now immutable, and will now raise an `AttributeError` when a user tries to assign a new value to the `ordinal` or `freq` attributes ([GH 17116](https://github.com/pandas-dev/pandas/issues/17116)). +* [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") when passed a tz-aware `origin=` kwarg will now raise a more informative `ValueError` rather than a `TypeError` ([GH 16842](https://github.com/pandas-dev/pandas/issues/16842)) +* [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") now raises a `ValueError` when format includes `%W` or `%U` without also including day of the week and calendar year ([GH 16774](https://github.com/pandas-dev/pandas/issues/16774)) +* Renamed non-functional `index` to `index_col` in [`read_stata()`](../reference/api/pandas.read_stata.html#pandas.read_stata "pandas.read_stata") to improve API consistency ([GH 16342](https://github.com/pandas-dev/pandas/issues/16342)) +* Bug in [`DataFrame.drop()`](../reference/api/pandas.DataFrame.drop.html#pandas.DataFrame.drop "pandas.DataFrame.drop") caused boolean labels `False` and `True` to be treated as labels 0 and 1 respectively when dropping indices from a numeric index. This will now raise a ValueError ([GH 16877](https://github.com/pandas-dev/pandas/issues/16877)) +* Restricted DateOffset keyword arguments. Previously, `DateOffset` subclasses allowed arbitrary keyword arguments which could lead to unexpected behavior. Now, only valid arguments will be accepted. ([GH 17176](https://github.com/pandas-dev/pandas/issues/17176)). + +## Deprecations[#](#deprecations "Link to this heading") + +* `DataFrame.from_csv()` and `Series.from_csv()` have been deprecated in favor of [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") ([GH 4191](https://github.com/pandas-dev/pandas/issues/4191)) +* [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") has deprecated `sheetname` in favor of `sheet_name` for consistency with `.to_excel()` ([GH 10559](https://github.com/pandas-dev/pandas/issues/10559)). +* [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") has deprecated `parse_cols` in favor of `usecols` for consistency with [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") ([GH 4988](https://github.com/pandas-dev/pandas/issues/4988)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") has deprecated the `tupleize_cols` argument. Column tuples will always be converted to a `MultiIndex` ([GH 17060](https://github.com/pandas-dev/pandas/issues/17060)) +* [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") has deprecated the `tupleize_cols` argument. MultiIndex columns will be always written as rows in the CSV file ([GH 17060](https://github.com/pandas-dev/pandas/issues/17060)) +* The `convert` parameter has been deprecated in the `.take()` method, as it was not being respected ([GH 16948](https://github.com/pandas-dev/pandas/issues/16948)) +* `pd.options.html.border` has been deprecated in favor of `pd.options.display.html.border` ([GH 15793](https://github.com/pandas-dev/pandas/issues/15793)). +* `SeriesGroupBy.nth()` has deprecated `True` in favor of `'all'` for its kwarg `dropna` ([GH 11038](https://github.com/pandas-dev/pandas/issues/11038)). +* `DataFrame.as_blocks()` is deprecated, as this is exposing the internal implementation ([GH 17302](https://github.com/pandas-dev/pandas/issues/17302)) +* `pd.TimeGrouper` is deprecated in favor of [`pandas.Grouper`](../reference/api/pandas.Grouper.html#pandas.Grouper "pandas.Grouper") ([GH 16747](https://github.com/pandas-dev/pandas/issues/16747)) +* `cdate_range` has been deprecated in favor of [`bdate_range()`](../reference/api/pandas.bdate_range.html#pandas.bdate_range "pandas.bdate_range"), which has gained `weekmask` and `holidays` parameters for building custom frequency date ranges. See the [documentation](../user_guide/timeseries.html#timeseries-custom-freq-ranges) for more details ([GH 17596](https://github.com/pandas-dev/pandas/issues/17596)) +* passing `categories` or `ordered` kwargs to [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") is deprecated, in favor of passing a [CategoricalDtype](#whatsnew-0210-enhancements-categorical-dtype) ([GH 17636](https://github.com/pandas-dev/pandas/issues/17636)) +* `.get_value` and `.set_value` on `Series`, `DataFrame`, `Panel`, `SparseSeries`, and `SparseDataFrame` are deprecated in favor of using `.iat[]` or `.at[]` accessors ([GH 15269](https://github.com/pandas-dev/pandas/issues/15269)) +* Passing a non-existent column in `.to_excel(..., columns=)` is deprecated and will raise a `KeyError` in the future ([GH 17295](https://github.com/pandas-dev/pandas/issues/17295)) +* `raise_on_error` parameter to [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where"), [`Series.mask()`](../reference/api/pandas.Series.mask.html#pandas.Series.mask "pandas.Series.mask"), [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where"), [`DataFrame.mask()`](../reference/api/pandas.DataFrame.mask.html#pandas.DataFrame.mask "pandas.DataFrame.mask") is deprecated, in favor of `errors=` ([GH 14968](https://github.com/pandas-dev/pandas/issues/14968)) +* Using [`DataFrame.rename_axis()`](../reference/api/pandas.DataFrame.rename_axis.html#pandas.DataFrame.rename_axis "pandas.DataFrame.rename_axis") and [`Series.rename_axis()`](../reference/api/pandas.Series.rename_axis.html#pandas.Series.rename_axis "pandas.Series.rename_axis") to alter index or column *labels* is now deprecated in favor of using `.rename`. `rename_axis` may still be used to alter the name of the index or columns ([GH 17833](https://github.com/pandas-dev/pandas/issues/17833)). +* `reindex_axis()` has been deprecated in favor of [`reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex"). See [here](#whatsnew-0210-enhancements-rename-reindex-axis) for more ([GH 17833](https://github.com/pandas-dev/pandas/issues/17833)). + +### Series.select and DataFrame.select[#](#series-select-and-dataframe-select "Link to this heading") + +The `Series.select()` and `DataFrame.select()` methods are deprecated in favor of using `df.loc[labels.map(crit)]` ([GH 12401](https://github.com/pandas-dev/pandas/issues/12401)) + +```None +In [63]: df = pd.DataFrame({'A': [1, 2, 3]}, index=['foo', 'bar', 'baz']) +``` + +```None +In [3]: df.select(lambda x: x in ['bar', 'baz']) +FutureWarning: select is deprecated and will be removed in a future release. You can use .loc[crit] as a replacement +Out[3]: + A +bar 2 +baz 3 +``` + +```None +In [64]: df.loc[df.index.map(lambda x: x in ['bar', 'baz'])] +Out[64]: + A +bar 2 +baz 3 + +[2 rows x 1 columns] +``` + +### Series.argmax and Series.argmin[#](#series-argmax-and-series-argmin "Link to this heading") + +The behavior of [`Series.argmax()`](../reference/api/pandas.Series.argmax.html#pandas.Series.argmax "pandas.Series.argmax") and [`Series.argmin()`](../reference/api/pandas.Series.argmin.html#pandas.Series.argmin "pandas.Series.argmin") have been deprecated in favor of [`Series.idxmax()`](../reference/api/pandas.Series.idxmax.html#pandas.Series.idxmax "pandas.Series.idxmax") and [`Series.idxmin()`](../reference/api/pandas.Series.idxmin.html#pandas.Series.idxmin "pandas.Series.idxmin"), respectively ([GH 16830](https://github.com/pandas-dev/pandas/issues/16830)). + +For compatibility with NumPy arrays, `pd.Series` implements `argmax` and +`argmin`. Since pandas 0.13.0, `argmax` has been an alias for +[`pandas.Series.idxmax()`](../reference/api/pandas.Series.idxmax.html#pandas.Series.idxmax "pandas.Series.idxmax"), and `argmin` has been an alias for +[`pandas.Series.idxmin()`](../reference/api/pandas.Series.idxmin.html#pandas.Series.idxmin "pandas.Series.idxmin"). They return the *label* of the maximum or minimum, +rather than the *position*. + +We’ve deprecated the current behavior of `Series.argmax` and +`Series.argmin`. Using either of these will emit a `FutureWarning`. Use +[`Series.idxmax()`](../reference/api/pandas.Series.idxmax.html#pandas.Series.idxmax "pandas.Series.idxmax") if you want the label of the maximum. Use +`Series.values.argmax()` if you want the position of the maximum. Likewise for +the minimum. In a future release `Series.argmax` and `Series.argmin` will +return the position of the maximum or minimum. + +## Removal of prior version deprecations/changes[#](#removal-of-prior-version-deprecations-changes "Link to this heading") + +* [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") has dropped the `has_index_names` parameter ([GH 10967](https://github.com/pandas-dev/pandas/issues/10967)) +* The `pd.options.display.height` configuration has been dropped ([GH 3663](https://github.com/pandas-dev/pandas/issues/3663)) +* The `pd.options.display.line_width` configuration has been dropped ([GH 2881](https://github.com/pandas-dev/pandas/issues/2881)) +* The `pd.options.display.mpl_style` configuration has been dropped ([GH 12190](https://github.com/pandas-dev/pandas/issues/12190)) +* `Index` has dropped the `.sym_diff()` method in favor of `.symmetric_difference()` ([GH 12591](https://github.com/pandas-dev/pandas/issues/12591)) +* `Categorical` has dropped the `.order()` and `.sort()` methods in favor of `.sort_values()` ([GH 12882](https://github.com/pandas-dev/pandas/issues/12882)) +* [`eval()`](../reference/api/pandas.eval.html#pandas.eval "pandas.eval") and [`DataFrame.eval()`](../reference/api/pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval") have changed the default of `inplace` from `None` to `False` ([GH 11149](https://github.com/pandas-dev/pandas/issues/11149)) +* The function `get_offset_name` has been dropped in favor of the `.freqstr` attribute for an offset ([GH 11834](https://github.com/pandas-dev/pandas/issues/11834)) +* pandas no longer tests for compatibility with hdf5-files created with pandas < 0.11 ([GH 17404](https://github.com/pandas-dev/pandas/issues/17404)). + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Improved performance of instantiating `SparseDataFrame` ([GH 16773](https://github.com/pandas-dev/pandas/issues/16773)) +* [`Series.dt`](../reference/api/pandas.Series.dt.html#pandas.Series.dt "pandas.Series.dt") no longer performs frequency inference, yielding a large speedup when accessing the attribute ([GH 17210](https://github.com/pandas-dev/pandas/issues/17210)) +* Improved performance of [`set_categories()`](../reference/api/pandas.Series.cat.set_categories.html#pandas.Series.cat.set_categories "pandas.Series.cat.set_categories") by not materializing the values ([GH 17508](https://github.com/pandas-dev/pandas/issues/17508)) +* [`Timestamp.microsecond`](../reference/api/pandas.Timestamp.microsecond.html#pandas.Timestamp.microsecond "pandas.Timestamp.microsecond") no longer re-computes on attribute access ([GH 17331](https://github.com/pandas-dev/pandas/issues/17331)) +* Improved performance of the [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") for data that is already categorical dtype ([GH 17513](https://github.com/pandas-dev/pandas/issues/17513)) +* Improved performance of `RangeIndex.min()` and `RangeIndex.max()` by using `RangeIndex` properties to perform the computations ([GH 17607](https://github.com/pandas-dev/pandas/issues/17607)) + +## Documentation changes[#](#documentation-changes "Link to this heading") + +* Several `NaT` method docstrings (e.g. `NaT.ctime()`) were incorrect ([GH 17327](https://github.com/pandas-dev/pandas/issues/17327)) +* The documentation has had references to versions < v0.17 removed and cleaned up ([GH 17442](https://github.com/pandas-dev/pandas/issues/17442), [GH 17442](https://github.com/pandas-dev/pandas/issues/17442), [GH 17404](https://github.com/pandas-dev/pandas/issues/17404) & [GH 17504](https://github.com/pandas-dev/pandas/issues/17504)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +### Conversion[#](#conversion "Link to this heading") + +* Bug in assignment against datetime-like data with `int` may incorrectly convert to datetime-like ([GH 14145](https://github.com/pandas-dev/pandas/issues/14145)) +* Bug in assignment against `int64` data with `np.ndarray` with `float64` dtype may keep `int64` dtype ([GH 14001](https://github.com/pandas-dev/pandas/issues/14001)) +* Fixed the return type of `IntervalIndex.is_non_overlapping_monotonic` to be a Python `bool` for consistency with similar attributes/methods. Previously returned a `numpy.bool_`. ([GH 17237](https://github.com/pandas-dev/pandas/issues/17237)) +* Bug in `IntervalIndex.is_non_overlapping_monotonic` when intervals are closed on both sides and overlap at a point ([GH 16560](https://github.com/pandas-dev/pandas/issues/16560)) +* Bug in [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") returns frame when `inplace=True` and `value` is dict ([GH 16156](https://github.com/pandas-dev/pandas/issues/16156)) +* Bug in `Timestamp.weekday_name` returning a UTC-based weekday name when localized to a timezone ([GH 17354](https://github.com/pandas-dev/pandas/issues/17354)) +* Bug in `Timestamp.replace` when replacing `tzinfo` around DST changes ([GH 15683](https://github.com/pandas-dev/pandas/issues/15683)) +* Bug in `Timedelta` construction and arithmetic that would not propagate the `Overflow` exception ([GH 17367](https://github.com/pandas-dev/pandas/issues/17367)) +* Bug in [`astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") converting to object dtype when passed extension type classes (`DatetimeTZDtype`, `CategoricalDtype`) rather than instances. Now a `TypeError` is raised when a class is passed ([GH 17780](https://github.com/pandas-dev/pandas/issues/17780)). +* Bug in [`to_numeric()`](../reference/api/pandas.to_numeric.html#pandas.to_numeric "pandas.to_numeric") in which elements were not always being coerced to numeric when `errors='coerce'` ([GH 17007](https://github.com/pandas-dev/pandas/issues/17007), [GH 17125](https://github.com/pandas-dev/pandas/issues/17125)) +* Bug in `DataFrame` and `Series` constructors where `range` objects are converted to `int32` dtype on Windows instead of `int64` ([GH 16804](https://github.com/pandas-dev/pandas/issues/16804)) + +### Indexing[#](#indexing "Link to this heading") + +* When called with a null slice (e.g. `df.iloc[:]`), the `.iloc` and `.loc` indexers return a shallow copy of the original object. Previously they returned the original object. ([GH 13873](https://github.com/pandas-dev/pandas/issues/13873)). +* When called on an unsorted `MultiIndex`, the `loc` indexer now will raise `UnsortedIndexError` only if proper slicing is used on non-sorted levels ([GH 16734](https://github.com/pandas-dev/pandas/issues/16734)). +* Fixes regression in 0.20.3 when indexing with a string on a `TimedeltaIndex` ([GH 16896](https://github.com/pandas-dev/pandas/issues/16896)). +* Fixed `TimedeltaIndex.get_loc()` handling of `np.timedelta64` inputs ([GH 16909](https://github.com/pandas-dev/pandas/issues/16909)). +* Fix `MultiIndex.sort_index()` ordering when `ascending` argument is a list, but not all levels are specified, or are in a different order ([GH 16934](https://github.com/pandas-dev/pandas/issues/16934)). +* Fixes bug where indexing with `np.inf` caused an `OverflowError` to be raised ([GH 16957](https://github.com/pandas-dev/pandas/issues/16957)) +* Bug in reindexing on an empty `CategoricalIndex` ([GH 16770](https://github.com/pandas-dev/pandas/issues/16770)) +* Fixes `DataFrame.loc` for setting with alignment and tz-aware `DatetimeIndex` ([GH 16889](https://github.com/pandas-dev/pandas/issues/16889)) +* Avoids `IndexError` when passing an Index or Series to `.iloc` with older numpy ([GH 17193](https://github.com/pandas-dev/pandas/issues/17193)) +* Allow unicode empty strings as placeholders in multilevel columns in Python 2 ([GH 17099](https://github.com/pandas-dev/pandas/issues/17099)) +* Bug in `.iloc` when used with inplace addition or assignment and an int indexer on a `MultiIndex` causing the wrong indexes to be read from and written to ([GH 17148](https://github.com/pandas-dev/pandas/issues/17148)) +* Bug in `.isin()` in which checking membership in empty `Series` objects raised an error ([GH 16991](https://github.com/pandas-dev/pandas/issues/16991)) +* Bug in `CategoricalIndex` reindexing in which specified indices containing duplicates were not being respected ([GH 17323](https://github.com/pandas-dev/pandas/issues/17323)) +* Bug in intersection of `RangeIndex` with negative step ([GH 17296](https://github.com/pandas-dev/pandas/issues/17296)) +* Bug in `IntervalIndex` where performing a scalar lookup fails for included right endpoints of non-overlapping monotonic decreasing indexes ([GH 16417](https://github.com/pandas-dev/pandas/issues/16417), [GH 17271](https://github.com/pandas-dev/pandas/issues/17271)) +* Bug in [`DataFrame.first_valid_index()`](../reference/api/pandas.DataFrame.first_valid_index.html#pandas.DataFrame.first_valid_index "pandas.DataFrame.first_valid_index") and [`DataFrame.last_valid_index()`](../reference/api/pandas.DataFrame.last_valid_index.html#pandas.DataFrame.last_valid_index "pandas.DataFrame.last_valid_index") when no valid entry ([GH 17400](https://github.com/pandas-dev/pandas/issues/17400)) +* Bug in [`Series.rename()`](../reference/api/pandas.Series.rename.html#pandas.Series.rename "pandas.Series.rename") when called with a callable, incorrectly alters the name of the `Series`, rather than the name of the `Index`. ([GH 17407](https://github.com/pandas-dev/pandas/issues/17407)) +* Bug in `String.str_get()` raises `IndexError` instead of inserting NaNs when using a negative index. ([GH 17704](https://github.com/pandas-dev/pandas/issues/17704)) + +### IO[#](#io "Link to this heading") + +* Bug in [`read_hdf()`](../reference/api/pandas.read_hdf.html#pandas.read_hdf "pandas.read_hdf") when reading a timezone aware index from `fixed` format HDFStore ([GH 17618](https://github.com/pandas-dev/pandas/issues/17618)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") in which columns were not being thoroughly de-duplicated ([GH 17060](https://github.com/pandas-dev/pandas/issues/17060)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") in which specified column names were not being thoroughly de-duplicated ([GH 17095](https://github.com/pandas-dev/pandas/issues/17095)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") in which non integer values for the header argument generated an unhelpful / unrelated error message ([GH 16338](https://github.com/pandas-dev/pandas/issues/16338)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") in which memory management issues in exception handling, under certain conditions, would cause the interpreter to segfault ([GH 14696](https://github.com/pandas-dev/pandas/issues/14696), [GH 16798](https://github.com/pandas-dev/pandas/issues/16798)). +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") when called with `low_memory=False` in which a CSV with at least one column > 2GB in size would incorrectly raise a `MemoryError` ([GH 16798](https://github.com/pandas-dev/pandas/issues/16798)). +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") when called with a single-element list `header` would return a `DataFrame` of all NaN values ([GH 7757](https://github.com/pandas-dev/pandas/issues/7757)) +* Bug in [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") defaulting to ‘ascii’ encoding in Python 3, instead of ‘utf-8’ ([GH 17097](https://github.com/pandas-dev/pandas/issues/17097)) +* Bug in [`read_stata()`](../reference/api/pandas.read_stata.html#pandas.read_stata "pandas.read_stata") where value labels could not be read when using an iterator ([GH 16923](https://github.com/pandas-dev/pandas/issues/16923)) +* Bug in [`read_stata()`](../reference/api/pandas.read_stata.html#pandas.read_stata "pandas.read_stata") where the index was not set ([GH 16342](https://github.com/pandas-dev/pandas/issues/16342)) +* Bug in [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") where import check fails when run in multiple threads ([GH 16928](https://github.com/pandas-dev/pandas/issues/16928)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") where automatic delimiter detection caused a `TypeError` to be thrown when a bad line was encountered rather than the correct error message ([GH 13374](https://github.com/pandas-dev/pandas/issues/13374)) +* Bug in [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") with `notebook=True` where DataFrames with named indices or non-MultiIndex indices had undesired horizontal or vertical alignment for column or row labels, respectively ([GH 16792](https://github.com/pandas-dev/pandas/issues/16792)) +* Bug in [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") in which there was no validation of the `justify` parameter ([GH 17527](https://github.com/pandas-dev/pandas/issues/17527)) +* Bug in [`HDFStore.select()`](../reference/api/pandas.HDFStore.select.html#pandas.HDFStore.select "pandas.HDFStore.select") when reading a contiguous mixed-data table featuring VLArray ([GH 17021](https://github.com/pandas-dev/pandas/issues/17021)) +* Bug in `to_json()` where several conditions (including objects with unprintable symbols, objects with deep recursion, overlong labels) caused segfaults instead of raising the appropriate exception ([GH 14256](https://github.com/pandas-dev/pandas/issues/14256)) + +### Plotting[#](#plotting "Link to this heading") + +* Bug in plotting methods using `secondary_y` and `fontsize` not setting secondary axis font size ([GH 12565](https://github.com/pandas-dev/pandas/issues/12565)) +* Bug when plotting `timedelta` and `datetime` dtypes on y-axis ([GH 16953](https://github.com/pandas-dev/pandas/issues/16953)) +* Line plots no longer assume monotonic x data when calculating xlims, they show the entire lines now even for unsorted x data. ([GH 11310](https://github.com/pandas-dev/pandas/issues/11310), [GH 11471](https://github.com/pandas-dev/pandas/issues/11471)) +* With matplotlib 2.0.0 and above, calculation of x limits for line plots is left to matplotlib, so that its new default settings are applied. ([GH 15495](https://github.com/pandas-dev/pandas/issues/15495)) +* Bug in `Series.plot.bar` or `DataFrame.plot.bar` with `y` not respecting user-passed `color` ([GH 16822](https://github.com/pandas-dev/pandas/issues/16822)) +* Bug causing `plotting.parallel_coordinates` to reset the random seed when using random colors ([GH 17525](https://github.com/pandas-dev/pandas/issues/17525)) + +### GroupBy/resample/rolling[#](#groupby-resample-rolling "Link to this heading") + +* Bug in `DataFrame.resample(...).size()` where an empty `DataFrame` did not return a `Series` ([GH 14962](https://github.com/pandas-dev/pandas/issues/14962)) +* Bug in [`infer_freq()`](../reference/api/pandas.infer_freq.html#pandas.infer_freq "pandas.infer_freq") causing indices with 2-day gaps during the working week to be wrongly inferred as business daily ([GH 16624](https://github.com/pandas-dev/pandas/issues/16624)) +* Bug in `.rolling(...).quantile()` which incorrectly used different defaults than [`Series.quantile()`](../reference/api/pandas.Series.quantile.html#pandas.Series.quantile "pandas.Series.quantile") and [`DataFrame.quantile()`](../reference/api/pandas.DataFrame.quantile.html#pandas.DataFrame.quantile "pandas.DataFrame.quantile") ([GH 9413](https://github.com/pandas-dev/pandas/issues/9413), [GH 16211](https://github.com/pandas-dev/pandas/issues/16211)) +* Bug in `groupby.transform()` that would coerce boolean dtypes back to float ([GH 16875](https://github.com/pandas-dev/pandas/issues/16875)) +* Bug in `Series.resample(...).apply()` where an empty `Series` modified the source index and did not return the name of a `Series` ([GH 14313](https://github.com/pandas-dev/pandas/issues/14313)) +* Bug in `.rolling(...).apply(...)` with a `DataFrame` with a `DatetimeIndex`, a `window` of a timedelta-convertible and `min_periods >= 1` ([GH 15305](https://github.com/pandas-dev/pandas/issues/15305)) +* Bug in `DataFrame.groupby` where index and column keys were not recognized correctly when the number of keys equaled the number of elements on the groupby axis ([GH 16859](https://github.com/pandas-dev/pandas/issues/16859)) +* Bug in `groupby.nunique()` with `TimeGrouper` which cannot handle `NaT` correctly ([GH 17575](https://github.com/pandas-dev/pandas/issues/17575)) +* Bug in `DataFrame.groupby` where a single level selection from a `MultiIndex` unexpectedly sorts ([GH 17537](https://github.com/pandas-dev/pandas/issues/17537)) +* Bug in `DataFrame.groupby` where spurious warning is raised when `Grouper` object is used to override ambiguous column name ([GH 17383](https://github.com/pandas-dev/pandas/issues/17383)) +* Bug in `TimeGrouper` differs when passes as a list and as a scalar ([GH 17530](https://github.com/pandas-dev/pandas/issues/17530)) + +### Sparse[#](#sparse "Link to this heading") + +* Bug in `SparseSeries` raises `AttributeError` when a dictionary is passed in as data ([GH 16905](https://github.com/pandas-dev/pandas/issues/16905)) +* Bug in `SparseDataFrame.fillna()` not filling all NaNs when frame was instantiated from SciPy sparse matrix ([GH 16112](https://github.com/pandas-dev/pandas/issues/16112)) +* Bug in `SparseSeries.unstack()` and `SparseDataFrame.stack()` ([GH 16614](https://github.com/pandas-dev/pandas/issues/16614), [GH 15045](https://github.com/pandas-dev/pandas/issues/15045)) +* Bug in `make_sparse()` treating two numeric/boolean data, which have same bits, as same when array `dtype` is `object` ([GH 17574](https://github.com/pandas-dev/pandas/issues/17574)) +* `SparseArray.all()` and `SparseArray.any()` are now implemented to handle `SparseArray`, these were used but not implemented ([GH 17570](https://github.com/pandas-dev/pandas/issues/17570)) + +### Reshaping[#](#reshaping "Link to this heading") + +* Joining/Merging with a non unique `PeriodIndex` raised a `TypeError` ([GH 16871](https://github.com/pandas-dev/pandas/issues/16871)) +* Bug in [`crosstab()`](../reference/api/pandas.crosstab.html#pandas.crosstab "pandas.crosstab") where non-aligned series of integers were casted to float ([GH 17005](https://github.com/pandas-dev/pandas/issues/17005)) +* Bug in merging with categorical dtypes with datetimelikes incorrectly raised a `TypeError` ([GH 16900](https://github.com/pandas-dev/pandas/issues/16900)) +* Bug when using `isin()` on a large object series and large comparison array ([GH 16012](https://github.com/pandas-dev/pandas/issues/16012)) +* Fixes regression from 0.20, [`Series.aggregate()`](../reference/api/pandas.Series.aggregate.html#pandas.Series.aggregate "pandas.Series.aggregate") and [`DataFrame.aggregate()`](../reference/api/pandas.DataFrame.aggregate.html#pandas.DataFrame.aggregate "pandas.DataFrame.aggregate") allow dictionaries as return values again ([GH 16741](https://github.com/pandas-dev/pandas/issues/16741)) +* Fixes dtype of result with integer dtype input, from [`pivot_table()`](../reference/api/pandas.pivot_table.html#pandas.pivot_table "pandas.pivot_table") when called with `margins=True` ([GH 17013](https://github.com/pandas-dev/pandas/issues/17013)) +* Bug in [`crosstab()`](../reference/api/pandas.crosstab.html#pandas.crosstab "pandas.crosstab") where passing two `Series` with the same name raised a `KeyError` ([GH 13279](https://github.com/pandas-dev/pandas/issues/13279)) +* [`Series.argmin()`](../reference/api/pandas.Series.argmin.html#pandas.Series.argmin "pandas.Series.argmin"), [`Series.argmax()`](../reference/api/pandas.Series.argmax.html#pandas.Series.argmax "pandas.Series.argmax"), and their counterparts on `DataFrame` and groupby objects work correctly with floating point data that contains infinite values ([GH 13595](https://github.com/pandas-dev/pandas/issues/13595)). +* Bug in [`unique()`](../reference/api/pandas.unique.html#pandas.unique "pandas.unique") where checking a tuple of strings raised a `TypeError` ([GH 17108](https://github.com/pandas-dev/pandas/issues/17108)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") where order of result index was unpredictable if it contained non-comparable elements ([GH 17344](https://github.com/pandas-dev/pandas/issues/17344)) +* Fixes regression when sorting by multiple columns on a `datetime64` dtype `Series` with `NaT` values ([GH 16836](https://github.com/pandas-dev/pandas/issues/16836)) +* Bug in [`pivot_table()`](../reference/api/pandas.pivot_table.html#pandas.pivot_table "pandas.pivot_table") where the result’s columns did not preserve the categorical dtype of `columns` when `dropna` was `False` ([GH 17842](https://github.com/pandas-dev/pandas/issues/17842)) +* Bug in `DataFrame.drop_duplicates` where dropping with non-unique column names raised a `ValueError` ([GH 17836](https://github.com/pandas-dev/pandas/issues/17836)) +* Bug in `unstack()` which, when called on a list of levels, would discard the `fillna` argument ([GH 13971](https://github.com/pandas-dev/pandas/issues/13971)) +* Bug in the alignment of `range` objects and other list-likes with `DataFrame` leading to operations being performed row-wise instead of column-wise ([GH 17901](https://github.com/pandas-dev/pandas/issues/17901)) + +### Numeric[#](#numeric "Link to this heading") + +* Bug in `.clip()` with `axis=1` and a list-like for `threshold` is passed; previously this raised `ValueError` ([GH 15390](https://github.com/pandas-dev/pandas/issues/15390)) +* [`Series.clip()`](../reference/api/pandas.Series.clip.html#pandas.Series.clip "pandas.Series.clip") and [`DataFrame.clip()`](../reference/api/pandas.DataFrame.clip.html#pandas.DataFrame.clip "pandas.DataFrame.clip") now treat NA values for upper and lower arguments as `None` instead of raising `ValueError` ([GH 17276](https://github.com/pandas-dev/pandas/issues/17276)). + +### Categorical[#](#categorical "Link to this heading") + +* Bug in [`Series.isin()`](../reference/api/pandas.Series.isin.html#pandas.Series.isin "pandas.Series.isin") when called with a categorical ([GH 16639](https://github.com/pandas-dev/pandas/issues/16639)) +* Bug in the categorical constructor with empty values and categories causing the `.categories` to be an empty `Float64Index` rather than an empty `Index` with object dtype ([GH 17248](https://github.com/pandas-dev/pandas/issues/17248)) +* Bug in categorical operations with [Series.cat](../user_guide/categorical.html#categorical-cat) not preserving the original Series’ name ([GH 17509](https://github.com/pandas-dev/pandas/issues/17509)) +* Bug in [`DataFrame.merge()`](../reference/api/pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge") failing for categorical columns with boolean/int data types ([GH 17187](https://github.com/pandas-dev/pandas/issues/17187)) +* Bug in constructing a `Categorical`/`CategoricalDtype` when the specified `categories` are of categorical type ([GH 17884](https://github.com/pandas-dev/pandas/issues/17884)). + +### PyPy[#](#pypy "Link to this heading") + +* Compatibility with PyPy in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") with `usecols=[]` and + [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") ([GH 17351](https://github.com/pandas-dev/pandas/issues/17351)) +* Split tests into cases for CPython and PyPy where needed, which highlights the fragility + of index matching with `float('nan')`, `np.nan` and `NAT` ([GH 17351](https://github.com/pandas-dev/pandas/issues/17351)) +* Fix [`DataFrame.memory_usage()`](../reference/api/pandas.DataFrame.memory_usage.html#pandas.DataFrame.memory_usage "pandas.DataFrame.memory_usage") to support PyPy. Objects on PyPy do not have a fixed size, + so an approximation is used instead ([GH 17228](https://github.com/pandas-dev/pandas/issues/17228)) + +### Other[#](#other "Link to this heading") + +* Bug where some inplace operators were not being wrapped and produced a copy when invoked ([GH 12962](https://github.com/pandas-dev/pandas/issues/12962)) +* Bug in [`eval()`](../reference/api/pandas.eval.html#pandas.eval "pandas.eval") where the `inplace` parameter was being incorrectly handled ([GH 16732](https://github.com/pandas-dev/pandas/issues/16732)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 206 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* 3553x + +* Aaron Barber +* Adam Gleave + +* Adam Smith + +* AdamShamlian + +* Adrian Liaw + +* Alan Velasco + +* Alan Yee + +* Alex B + +* Alex Lubbock + +* Alex Marchenko + +* Alex Rychyk + +* Amol K + +* Andreas Winkler +* Andrew + +* Andrew 亮 +* André Jonasson + +* Becky Sweger +* Berkay + +* Bob Haffner + +* Bran Yang +* Brian Tu + +* Brock Mendel + +* Carol Willing + +* Carter Green + +* Chankey Pathak + +* Chris +* Chris Billington +* Chris Filo Gorgolewski + +* Chris Kerr +* Chris M + +* Chris Mazzullo + +* Christian Prinoth +* Christian Stade-Schuldt +* Christoph Moehl + +* DSM +* Daniel Chen + +* Daniel Grady +* Daniel Himmelstein +* Dave Willmer +* David Cook +* David Gwynne +* David Read + +* Dillon Niederhut + +* Douglas Rudd +* Eric Stein + +* Eric Wieser + +* Erik Fredriksen +* Florian Wilhelm + +* Floris Kint + +* Forbidden Donut +* Gabe F + +* Giftlin + +* Giftlin Rajaiah + +* Giulio Pepe + +* Guilherme Beltramini +* Guillem Borrell + +* Hanmin Qin + +* Hendrik Makait + +* Hugues Valois +* Hussain Tamboli + +* Iva Miholic + +* Jan Novotný + +* Jan Rudolph +* Jean Helie + +* Jean-Baptiste Schiratti + +* Jean-Mathieu Deschenes +* Jeff Knupp + +* Jeff Reback +* Jeff Tratner +* JennaVergeynst +* JimStearns206 +* Joel Nothman +* John W. O’Brien +* Jon Crall + +* Jon Mease +* Jonathan J. Helmus + +* Joris Van den Bossche +* JosephWagner +* Juarez Bochi +* Julian Kuhlmann + +* Karel De Brabandere +* Kassandra Keeton + +* Keiron Pizzey + +* Keith Webber +* Kernc +* Kevin Sheppard +* Kirk Hansen + +* Licht Takeuchi + +* Lucas Kushner + +* Mahdi Ben Jelloul + +* Makarov Andrey + +* Malgorzata Turzanska + +* Marc Garcia + +* Margaret Sy + +* MarsGuy + +* Matt Bark + +* Matthew Roeschke +* Matti Picus +* Mehmet Ali “Mali” Akmanalp +* Michael Gasvoda + +* Michael Penkov + +* Milo + +* Morgan Stuart + +* Morgan243 + +* Nathan Ford + +* Nick Eubank +* Nick Garvey + +* Oleg Shteynbuk + +* P-Tillmann + +* Pankaj Pandey +* Patrick Luo +* Patrick O’Melveny +* Paul Reidy + +* Paula + +* Peter Quackenbush +* Peter Yanovich + +* Phillip Cloud +* Pierre Haessig +* Pietro Battiston +* Pradyumna Reddy Chinthala +* Prasanjit Prakash +* RobinFiveWords +* Ryan Hendrickson +* Sam Foo +* Sangwoong Yoon + +* Simon Gibbons + +* SimonBaron +* Steven Cutting + +* Sudeep + +* Sylvia + +* T N + +* Telt +* Thomas A Caswell +* Tim Swast + +* Tom Augspurger +* Tong SHEN +* Tuan + +* Utkarsh Upadhyay + +* Vincent La + +* Vivek + +* WANG Aiyong +* WBare +* Wes McKinney +* XF + +* Yi Liu + +* Yosuke Nakabayashi + +* aaron315 + +* abarber4gh + +* aernlund + +* agustín méndez + +* andymaheshw + +* ante328 + +* aviolov + +* bpraggastis +* cbertinato + +* cclauss + +* chernrick +* chris-b1 +* dkamm + +* dwkenefick +* economy +* faic + +* fding253 + +* gfyoung +* guygoldberg + +* hhuuggoo + +* huashuai + +* ian +* iulia + +* jaredsnyder +* jbrockmendel + +* jdeschenes +* jebob + +* jschendel + +* keitakurita +* kernc + +* kiwirob + +* kjford +* linebp +* lloydkirk +* louispotok + +* majiang + +* manikbhandari + +* margotphoenix + +* matthiashuschle + +* mattip +* mjlove12 + +* nmartensen + +* pandas-docs-bot + +* parchd-1 + +* philipphanemann + +* rdk1024 + +* reidy-p + +* ri938 +* ruiann + +* rvernica + +* s-weigand + +* scotthavard92 + +* skwbc + +* step4me + +* tobycheese + +* topper-123 + +* tsdlovell +* ysau + +* zzgao + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.21.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.21.1.md new file mode 100644 index 0000000000000000000000000000000000000000..5b8438e73084054dfbc7ff3ef5677043ffcc9127 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.21.1.md @@ -0,0 +1,210 @@ +# What's new in pandas 0.21.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.21.1.html + +# Version 0.21.1 (December 12, 2017)[#](#version-0-21-1-december-12-2017 "Link to this heading") + +This is a minor bug-fix release in the 0.21.x series and includes some small regression fixes, +bug fixes and performance improvements. +We recommend that all users upgrade to this version. + +Highlights include: + +* Temporarily restore matplotlib datetime plotting functionality. This should + resolve issues for users who implicitly relied on pandas to plot datetimes + with matplotlib. See [here](#whatsnew-0211-converters). +* Improvements to the Parquet IO functions introduced in 0.21.0. See + [here](#whatsnew-0211-enhancements-parquet). + +What’s new in v0.21.1 + +* [Restore Matplotlib datetime converter registration](#restore-matplotlib-datetime-converter-registration) +* [New features](#new-features) + + + [Improvements to the Parquet IO functionality](#improvements-to-the-parquet-io-functionality) + + [Other enhancements](#other-enhancements) +* [Deprecations](#deprecations) +* [Performance improvements](#performance-improvements) +* [Bug fixes](#bug-fixes) + + + [Conversion](#conversion) + + [Indexing](#indexing) + + [IO](#io) + + [Plotting](#plotting) + + [GroupBy/resample/rolling](#groupby-resample-rolling) + + [Reshaping](#reshaping) + + [Numeric](#numeric) + + [Categorical](#categorical) + + [String](#string) +* [Contributors](#contributors) + +## Restore Matplotlib datetime converter registration[#](#restore-matplotlib-datetime-converter-registration "Link to this heading") + +pandas implements some matplotlib converters for nicely formatting the axis +labels on plots with `datetime` or `Period` values. Prior to pandas 0.21.0, +these were implicitly registered with matplotlib, as a side effect of `import +pandas`. + +In pandas 0.21.0, we required users to explicitly register the +converter. This caused problems for some users who relied on those converters +being present for regular `matplotlib.pyplot` plotting methods, so we’re +temporarily reverting that change; pandas 0.21.1 again registers the converters on +import, just like before 0.21.0. + +We’ve added a new option to control the converters: +`pd.options.plotting.matplotlib.register_converters`. By default, they are +registered. Toggling this to `False` removes pandas’ formatters and restore +any converters we overwrote when registering them ([GH 18301](https://github.com/pandas-dev/pandas/issues/18301)). + +We’re working with the matplotlib developers to make this easier. We’re trying +to balance user convenience (automatically registering the converters) with +import performance and best practices (importing pandas shouldn’t have the side +effect of overwriting any custom converters you’ve already set). In the future +we hope to have most of the datetime formatting functionality in matplotlib, +with just the pandas-specific converters in pandas. We’ll then gracefully +deprecate the automatic registration of converters in favor of users explicitly +registering them when they want them. + +## New features[#](#new-features "Link to this heading") + +### Improvements to the Parquet IO functionality[#](#improvements-to-the-parquet-io-functionality "Link to this heading") + +* [`DataFrame.to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") will now write non-default indexes when the + underlying engine supports it. The indexes will be preserved when reading + back in with [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") ([GH 18581](https://github.com/pandas-dev/pandas/issues/18581)). +* [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") now allows to specify the columns to read from a parquet file ([GH 18154](https://github.com/pandas-dev/pandas/issues/18154)) +* [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") now allows to specify kwargs which are passed to the respective engine ([GH 18216](https://github.com/pandas-dev/pandas/issues/18216)) + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* [`Timestamp.timestamp()`](../reference/api/pandas.Timestamp.timestamp.html#pandas.Timestamp.timestamp "pandas.Timestamp.timestamp") is now available in Python 2.7. ([GH 17329](https://github.com/pandas-dev/pandas/issues/17329)) +* [`Grouper`](../reference/api/pandas.Grouper.html#pandas.Grouper "pandas.Grouper") and `TimeGrouper` now have a friendly repr output ([GH 18203](https://github.com/pandas-dev/pandas/issues/18203)). + +## Deprecations[#](#deprecations "Link to this heading") + +* `pandas.tseries.register` has been renamed to + [`pandas.plotting.register_matplotlib_converters()`](../reference/api/pandas.plotting.register_matplotlib_converters.html#pandas.plotting.register_matplotlib_converters "pandas.plotting.register_matplotlib_converters") ([GH 18301](https://github.com/pandas-dev/pandas/issues/18301)) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Improved performance of plotting large series/dataframes ([GH 18236](https://github.com/pandas-dev/pandas/issues/18236)). + +## Bug fixes[#](#bug-fixes "Link to this heading") + +### Conversion[#](#conversion "Link to this heading") + +* Bug in [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") subtraction could incorrectly overflow when `NaT` is present ([GH 17791](https://github.com/pandas-dev/pandas/issues/17791)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") subtracting datetimelike from DatetimeIndex could fail to overflow ([GH 18020](https://github.com/pandas-dev/pandas/issues/18020)) +* Bug in `IntervalIndex.copy()` when copying and `IntervalIndex` with non-default `closed` ([GH 18339](https://github.com/pandas-dev/pandas/issues/18339)) +* Bug in [`DataFrame.to_dict()`](../reference/api/pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict") where columns of datetime that are tz-aware were not converted to required arrays when used with `orient='records'`, raising `TypeError` ([GH 18372](https://github.com/pandas-dev/pandas/issues/18372)) +* Bug in `DateTimeIndex` and [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range") where mismatching tz-aware `start` and `end` timezones would not raise an err if `end.tzinfo` is None ([GH 18431](https://github.com/pandas-dev/pandas/issues/18431)) +* Bug in [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") which raised when passed a long integer on Python 2 ([GH 18159](https://github.com/pandas-dev/pandas/issues/18159)). + +### Indexing[#](#indexing "Link to this heading") + +* Bug in a boolean comparison of a `datetime.datetime` and a `datetime64[ns]` dtype Series ([GH 17965](https://github.com/pandas-dev/pandas/issues/17965)) +* Bug where a `MultiIndex` with more than a million records was not raising `AttributeError` when trying to access a missing attribute ([GH 18165](https://github.com/pandas-dev/pandas/issues/18165)) +* Bug in [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") constructor when a list of intervals is passed with non-default `closed` ([GH 18334](https://github.com/pandas-dev/pandas/issues/18334)) +* Bug in `Index.putmask` when an invalid mask passed ([GH 18368](https://github.com/pandas-dev/pandas/issues/18368)) +* Bug in masked assignment of a `timedelta64[ns]` dtype `Series`, incorrectly coerced to float ([GH 18493](https://github.com/pandas-dev/pandas/issues/18493)) + +### IO[#](#io "Link to this heading") + +* Bug in `StataReader` not converting date/time columns with display formatting addressed ([GH 17990](https://github.com/pandas-dev/pandas/issues/17990)). Previously columns with display formatting were normally left as ordinal numbers and not converted to datetime objects. +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") when reading a compressed UTF-16 encoded file ([GH 18071](https://github.com/pandas-dev/pandas/issues/18071)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") for handling null values in index columns when specifying `na_filter=False` ([GH 5239](https://github.com/pandas-dev/pandas/issues/5239)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") when reading numeric category fields with high cardinality ([GH 18186](https://github.com/pandas-dev/pandas/issues/18186)) +* Bug in [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") when the table had `MultiIndex` columns, and a list of strings was passed in for `header` ([GH 5539](https://github.com/pandas-dev/pandas/issues/5539)) +* Bug in parsing integer datetime-like columns with specified format in `read_sql` ([GH 17855](https://github.com/pandas-dev/pandas/issues/17855)). +* Bug in `DataFrame.to_msgpack()` when serializing data of the `numpy.bool_` datatype ([GH 18390](https://github.com/pandas-dev/pandas/issues/18390)) +* Bug in [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") not decoding when reading line delimited JSON from S3 ([GH 17200](https://github.com/pandas-dev/pandas/issues/17200)) +* Bug in `pandas.io.json.json_normalize()` to avoid modification of `meta` ([GH 18610](https://github.com/pandas-dev/pandas/issues/18610)) +* Bug in `to_latex()` where repeated MultiIndex values were not printed even though a higher level index differed from the previous row ([GH 14484](https://github.com/pandas-dev/pandas/issues/14484)) +* Bug when reading NaN-only categorical columns in `HDFStore` ([GH 18413](https://github.com/pandas-dev/pandas/issues/18413)) +* Bug in [`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex") with `longtable=True` where a latex multicolumn always spanned over three columns ([GH 17959](https://github.com/pandas-dev/pandas/issues/17959)) + +### Plotting[#](#plotting "Link to this heading") + +* Bug in `DataFrame.plot()` and `Series.plot()` with [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") where a figure generated by them is not pickleable in Python 3 ([GH 18439](https://github.com/pandas-dev/pandas/issues/18439)) + +### GroupBy/resample/rolling[#](#groupby-resample-rolling "Link to this heading") + +* Bug in `DataFrame.resample(...).apply(...)` when there is a callable that returns different columns ([GH 15169](https://github.com/pandas-dev/pandas/issues/15169)) +* Bug in `DataFrame.resample(...)` when there is a time change (DST) and resampling frequency is 12h or higher ([GH 15549](https://github.com/pandas-dev/pandas/issues/15549)) +* Bug in `pd.DataFrameGroupBy.count()` when counting over a datetimelike column ([GH 13393](https://github.com/pandas-dev/pandas/issues/13393)) +* Bug in `rolling.var` where calculation is inaccurate with a zero-valued array ([GH 18430](https://github.com/pandas-dev/pandas/issues/18430)) + +### Reshaping[#](#reshaping "Link to this heading") + +* Error message in `pd.merge_asof()` for key datatype mismatch now includes datatype of left and right key ([GH 18068](https://github.com/pandas-dev/pandas/issues/18068)) +* Bug in `pd.concat` when empty and non-empty DataFrames or Series are concatenated ([GH 18178](https://github.com/pandas-dev/pandas/issues/18178) [GH 18187](https://github.com/pandas-dev/pandas/issues/18187)) +* Bug in `DataFrame.filter(...)` when `unicode` is passed as a condition in Python 2 ([GH 13101](https://github.com/pandas-dev/pandas/issues/13101)) +* Bug when merging empty DataFrames when `np.seterr(divide='raise')` is set ([GH 17776](https://github.com/pandas-dev/pandas/issues/17776)) + +### Numeric[#](#numeric "Link to this heading") + +* Bug in `pd.Series.rolling.skew()` and `rolling.kurt()` with all equal values has floating issue ([GH 18044](https://github.com/pandas-dev/pandas/issues/18044)) + +### Categorical[#](#categorical "Link to this heading") + +* Bug in [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") where casting to ‘category’ on an empty `DataFrame` causes a segmentation fault ([GH 18004](https://github.com/pandas-dev/pandas/issues/18004)) +* Error messages in the testing module have been improved when items have different `CategoricalDtype` ([GH 18069](https://github.com/pandas-dev/pandas/issues/18069)) +* `CategoricalIndex` can now correctly take a `pd.api.types.CategoricalDtype` as its dtype ([GH 18116](https://github.com/pandas-dev/pandas/issues/18116)) +* Bug in `Categorical.unique()` returning read-only `codes` array when all categories were `NaN` ([GH 18051](https://github.com/pandas-dev/pandas/issues/18051)) +* Bug in `DataFrame.groupby(axis=1)` with a `CategoricalIndex` ([GH 18432](https://github.com/pandas-dev/pandas/issues/18432)) + +### String[#](#string "Link to this heading") + +* [`Series.str.split()`](../reference/api/pandas.Series.str.split.html#pandas.Series.str.split "pandas.Series.str.split") will now propagate `NaN` values across all expanded columns instead of `None` ([GH 18450](https://github.com/pandas-dev/pandas/issues/18450)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 46 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Aaron Critchley + +* Alex Rychyk +* Alexander Buchkovsky + +* Alexander Michael Schade + +* Chris Mazzullo +* Cornelius Riemenschneider + +* Dave Hirschfeld + +* David Fischer + +* David Stansby + +* Dror Atariah + +* Eric Kisslinger + +* Hans + +* Ingolf Becker + +* Jan Werkmann + +* Jeff Reback +* Joris Van den Bossche +* Jörg Döpfert + +* Kevin Kuhl + +* Krzysztof Chomski + +* Leif Walsh +* Licht Takeuchi +* Manraj Singh + +* Matt Braymer-Hayes + +* Michael Waskom + +* Mie~~~ + +* Peter Hoffmann + +* Robert Meyer + +* Sam Cohan + +* Sietse Brouwer + +* Sven + +* Tim Swast +* Tom Augspurger +* Wes Turner +* William Ayd + +* Yee Mey + +* bolkedebruin + +* cgohlke +* derestle-htwg + +* fjdiod + +* gabrielclow + +* gfyoung +* ghasemnaddaf + +* jbrockmendel +* jschendel +* miker985 + +* topper-123 diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.22.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.22.0.md new file mode 100644 index 0000000000000000000000000000000000000000..5ab1d254b1f76ba9631406cb3d62f098379b990c --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.22.0.md @@ -0,0 +1,287 @@ +# What's new in pandas 0.22.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.22.0.html + +# Version 0.22.0 (December 29, 2017)[#](#version-0-22-0-december-29-2017 "Link to this heading") + +This is a major release from 0.21.1 and includes a single, API-breaking change. +We recommend that all users upgrade to this version after carefully reading the +release note (singular!). + +## Backwards incompatible API changes[#](#backwards-incompatible-api-changes "Link to this heading") + +pandas 0.22.0 changes the handling of empty and all-*NA* sums and products. The +summary is that + +* The sum of an empty or all-*NA* `Series` is now `0` +* The product of an empty or all-*NA* `Series` is now `1` +* We’ve added a `min_count` parameter to `.sum()` and `.prod()` controlling + the minimum number of valid values for the result to be valid. If fewer than + `min_count` non-*NA* values are present, the result is *NA*. The default is + `0`. To return `NaN`, the 0.21 behavior, use `min_count=1`. + +Some background: In pandas 0.21, we fixed a long-standing inconsistency +in the return value of all-*NA* series depending on whether or not bottleneck +was installed. See [Sum/prod of all-NaN or empty Series/DataFrames is now consistently NaN](v0.21.0.html#whatsnew-0210-api-breaking-bottleneck). At the same +time, we changed the sum and prod of an empty `Series` to also be `NaN`. + +Based on feedback, we’ve partially reverted those changes. + +### Arithmetic operations[#](#arithmetic-operations "Link to this heading") + +The default sum for empty or all-*NA* `Series` is now `0`. + +*pandas 0.21.x* + +```None +In [1]: pd.Series([]).sum() +Out[1]: nan + +In [2]: pd.Series([np.nan]).sum() +Out[2]: nan +``` + +*pandas 0.22.0* + +```None +In [1]: pd.Series([]).sum() +Out[1]: 0 + +In [2]: pd.Series([np.nan]).sum() +Out[2]: 0.0 +``` + +The default behavior is the same as pandas 0.20.3 with bottleneck installed. It +also matches the behavior of NumPy’s `np.nansum` on empty and all-*NA* arrays. + +To have the sum of an empty series return `NaN` (the default behavior of +pandas 0.20.3 without bottleneck, or pandas 0.21.x), use the `min_count` +keyword. + +```None +In [3]: pd.Series([]).sum(min_count=1) +Out[3]: nan +``` + +Thanks to the `skipna` parameter, the `.sum` on an all-*NA* +series is conceptually the same as the `.sum` of an empty one with +`skipna=True` (the default). + +```None +In [4]: pd.Series([np.nan]).sum(min_count=1) # skipna=True by default +Out[4]: nan +``` + +The `min_count` parameter refers to the minimum number of *non-null* values +required for a non-NA sum or product. + +[`Series.prod()`](../reference/api/pandas.Series.prod.html#pandas.Series.prod "pandas.Series.prod") has been updated to behave the same as [`Series.sum()`](../reference/api/pandas.Series.sum.html#pandas.Series.sum "pandas.Series.sum"), +returning `1` instead. + +```None +In [5]: pd.Series([]).prod() +Out[5]: 1 + +In [6]: pd.Series([np.nan]).prod() +Out[6]: 1.0 + +In [7]: pd.Series([]).prod(min_count=1) +Out[7]: nan +``` + +These changes affect [`DataFrame.sum()`](../reference/api/pandas.DataFrame.sum.html#pandas.DataFrame.sum "pandas.DataFrame.sum") and [`DataFrame.prod()`](../reference/api/pandas.DataFrame.prod.html#pandas.DataFrame.prod "pandas.DataFrame.prod") as well. +Finally, a few less obvious places in pandas are affected by this change. + +### Grouping by a Categorical[#](#grouping-by-a-categorical "Link to this heading") + +Grouping by a `Categorical` and summing now returns `0` instead of +`NaN` for categories with no observations. The product now returns `1` +instead of `NaN`. + +*pandas 0.21.x* + +```None +In [8]: grouper = pd.Categorical(['a', 'a'], categories=['a', 'b']) + +In [9]: pd.Series([1, 2]).groupby(grouper, observed=False).sum() +Out[9]: +a 3.0 +b NaN +dtype: float64 +``` + +*pandas 0.22* + +```None +In [8]: grouper = pd.Categorical(["a", "a"], categories=["a", "b"]) + +In [9]: pd.Series([1, 2]).groupby(grouper, observed=False).sum() +Out[9]: +a 3 +b 0 +Length: 2, dtype: int64 +``` + +To restore the 0.21 behavior of returning `NaN` for unobserved groups, +use `min_count>=1`. + +```None +In [10]: pd.Series([1, 2]).groupby(grouper, observed=False).sum(min_count=1) +Out[10]: +a 3.0 +b NaN +Length: 2, dtype: float64 +``` + +### Resample[#](#resample "Link to this heading") + +The sum and product of all-*NA* bins has changed from `NaN` to `0` for +sum and `1` for product. + +*pandas 0.21.x* + +```None +In [11]: s = pd.Series([1, 1, np.nan, np.nan], + ....: index=pd.date_range('2017', periods=4)) + ....: s +Out[11]: +2017-01-01 1.0 +2017-01-02 1.0 +2017-01-03 NaN +2017-01-04 NaN +Freq: D, dtype: float64 + +In [12]: s.resample('2d').sum() +Out[12]: +2017-01-01 2.0 +2017-01-03 NaN +Freq: 2D, dtype: float64 +``` + +*pandas 0.22.0* + +```None +In [11]: s = pd.Series([1, 1, np.nan, np.nan], index=pd.date_range("2017", periods=4)) + +In [12]: s.resample("2d").sum() +Out[12]: +2017-01-01 2.0 +2017-01-03 0.0 +Freq: 2D, Length: 2, dtype: float64 +``` + +To restore the 0.21 behavior of returning `NaN`, use `min_count>=1`. + +```None +In [13]: s.resample("2d").sum(min_count=1) +Out[13]: +2017-01-01 2.0 +2017-01-03 NaN +Freq: 2D, Length: 2, dtype: float64 +``` + +In particular, upsampling and taking the sum or product is affected, as +upsampling introduces missing values even if the original series was +entirely valid. + +*pandas 0.21.x* + +```None +In [14]: idx = pd.DatetimeIndex(['2017-01-01', '2017-01-02']) + +In [15]: pd.Series([1, 2], index=idx).resample('12H').sum() +Out[15]: +2017-01-01 00:00:00 1.0 +2017-01-01 12:00:00 NaN +2017-01-02 00:00:00 2.0 +Freq: 12H, dtype: float64 +``` + +*pandas 0.22.0* + +```None +In [14]: idx = pd.DatetimeIndex(["2017-01-01", "2017-01-02"]) +In [15]: pd.Series([1, 2], index=idx).resample("12H").sum() +Out[15]: +2017-01-01 00:00:00 1 +2017-01-01 12:00:00 0 +2017-01-02 00:00:00 2 +Freq: 12H, Length: 3, dtype: int64 +``` + +Once again, the `min_count` keyword is available to restore the 0.21 behavior. + +```None +In [16]: pd.Series([1, 2], index=idx).resample("12H").sum(min_count=1) +Out[16]: +2017-01-01 00:00:00 1.0 +2017-01-01 12:00:00 NaN +2017-01-02 00:00:00 2.0 +Freq: 12H, Length: 3, dtype: float64 +``` + +### Rolling and expanding[#](#rolling-and-expanding "Link to this heading") + +Rolling and expanding already have a `min_periods` keyword that behaves +similar to `min_count`. The only case that changes is when doing a rolling +or expanding sum with `min_periods=0`. Previously this returned `NaN`, +when fewer than `min_periods` non-*NA* values were in the window. Now it +returns `0`. + +*pandas 0.21.1* + +```None +In [17]: s = pd.Series([np.nan, np.nan]) + +In [18]: s.rolling(2, min_periods=0).sum() +Out[18]: +0 NaN +1 NaN +dtype: float64 +``` + +*pandas 0.22.0* + +```None +In [14]: s = pd.Series([np.nan, np.nan]) + +In [15]: s.rolling(2, min_periods=0).sum() +Out[15]: +0 0.0 +1 0.0 +Length: 2, dtype: float64 +``` + +The default behavior of `min_periods=None`, implying that `min_periods` +equals the window size, is unchanged. + +## Compatibility[#](#compatibility "Link to this heading") + +If you maintain a library that should work across pandas versions, it +may be easiest to exclude pandas 0.21 from your requirements. Otherwise, all your +`sum()` calls would need to check if the `Series` is empty before summing. + +With setuptools, in your `setup.py` use: + +```None +install_requires=['pandas!=0.21.*', ...] +``` + +With conda, use + +```None +requirements: + run: + - pandas !=0.21.0,!=0.21.1 +``` + +Note that the inconsistency in the return value for all-*NA* series is still +there for pandas 0.20.3 and earlier. Avoiding pandas 0.21 will only help with +the empty case. + +## Contributors[#](#contributors "Link to this heading") + +A total of 1 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Tom Augspurger diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.23.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.23.0.md new file mode 100644 index 0000000000000000000000000000000000000000..ec0de9a0dd04a384cc60da1bdde66ff5cb00e476 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.23.0.md @@ -0,0 +1,2114 @@ +# What's new in pandas 0.23.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.23.0.html + +# What’s new in 0.23.0 (May 15, 2018)[#](#what-s-new-in-0-23-0-may-15-2018 "Link to this heading") + +This is a major release from 0.22.0 and includes a number of API changes, +deprecations, new features, enhancements, and performance improvements along +with a large number of bug fixes. We recommend that all users upgrade to this +version. + +Highlights include: + +* [Round-trippable JSON format with ‘table’ orient](#whatsnew-0230-enhancements-round-trippable-json). +* [Instantiation from dicts respects order for Python 3.6+](#whatsnew-0230-api-breaking-dict-insertion-order). +* [Dependent column arguments for assign](#whatsnew-0230-enhancements-assign-dependent). +* [Merging / sorting on a combination of columns and index levels](#whatsnew-0230-enhancements-merge-on-columns-and-levels). +* [Extending pandas with custom types](#whatsnew-023-enhancements-extension). +* [Excluding unobserved categories from groupby](#whatsnew-0230-enhancements-categorical-grouping). +* [Changes to make output shape of DataFrame.apply consistent](#whatsnew-0230-api-breaking-apply). + +Check the [API Changes](#whatsnew-0230-api-breaking) and [deprecations](#whatsnew-0230-deprecations) before updating. + +Warning + +Starting January 1, 2019, pandas feature releases will support Python 3 only. +See [Dropping Python 2.7](https://pandas.pydata.org/pandas-docs/version/0.24/install.html#install-dropping-27) for more. + +What’s new in v0.23.0 + +* [New features](#new-features) + + + [JSON read/write round-trippable with `orient='table'`](#json-read-write-round-trippable-with-orient-table) + + [Method `.assign()` accepts dependent arguments](#method-assign-accepts-dependent-arguments) + + [Merging on a combination of columns and index levels](#merging-on-a-combination-of-columns-and-index-levels) + + [Sorting by a combination of columns and index levels](#sorting-by-a-combination-of-columns-and-index-levels) + + [Extending pandas with custom types (experimental)](#extending-pandas-with-custom-types-experimental) + + [New `observed` keyword for excluding unobserved categories in `GroupBy`](#new-observed-keyword-for-excluding-unobserved-categories-in-groupby) + + [Rolling/Expanding.apply() accepts `raw=False` to pass a `Series` to the function](#rolling-expanding-apply-accepts-raw-false-to-pass-a-series-to-the-function) + + [`DataFrame.interpolate` has gained the `limit_area` kwarg](#dataframe-interpolate-has-gained-the-limit-area-kwarg) + + [Function `get_dummies` now supports `dtype` argument](#function-get-dummies-now-supports-dtype-argument) + + [Timedelta mod method](#timedelta-mod-method) + + [Method `.rank()` handles `inf` values when `NaN` are present](#method-rank-handles-inf-values-when-nan-are-present) + + [`Series.str.cat` has gained the `join` kwarg](#series-str-cat-has-gained-the-join-kwarg) + + [`DataFrame.astype` performs column-wise conversion to `Categorical`](#dataframe-astype-performs-column-wise-conversion-to-categorical) + + [Other enhancements](#other-enhancements) +* [Backwards incompatible API changes](#backwards-incompatible-api-changes) + + + [Dependencies have increased minimum versions](#dependencies-have-increased-minimum-versions) + + [Instantiation from dicts preserves dict insertion order for Python 3.6+](#instantiation-from-dicts-preserves-dict-insertion-order-for-python-3-6) + + [Deprecate Panel](#deprecate-panel) + + [pandas.core.common removals](#pandas-core-common-removals) + + [Changes to make output of `DataFrame.apply` consistent](#changes-to-make-output-of-dataframe-apply-consistent) + + [Concatenation will no longer sort](#concatenation-will-no-longer-sort) + + [Build changes](#build-changes) + + [Index division by zero fills correctly](#index-division-by-zero-fills-correctly) + + [Extraction of matching patterns from strings](#extraction-of-matching-patterns-from-strings) + + [Default value for the `ordered` parameter of `CategoricalDtype`](#default-value-for-the-ordered-parameter-of-categoricaldtype) + + [Better pretty-printing of DataFrames in a terminal](#better-pretty-printing-of-dataframes-in-a-terminal) + + [Datetimelike API changes](#datetimelike-api-changes) + + [Other API changes](#other-api-changes) +* [Deprecations](#deprecations) +* [Removal of prior version deprecations/changes](#removal-of-prior-version-deprecations-changes) +* [Performance improvements](#performance-improvements) +* [Documentation changes](#documentation-changes) +* [Bug fixes](#bug-fixes) + + + [Categorical](#categorical) + + [Datetimelike](#datetimelike) + + [Timedelta](#timedelta) + + [Timezones](#timezones) + + [Offsets](#offsets) + + [Numeric](#numeric) + + [Strings](#strings) + + [Indexing](#indexing) + + [MultiIndex](#multiindex) + + [IO](#io) + + [Plotting](#plotting) + + [GroupBy/resample/rolling](#groupby-resample-rolling) + + [Sparse](#sparse) + + [Reshaping](#reshaping) + + [Other](#other) +* [Contributors](#contributors) + +## New features[#](#new-features "Link to this heading") + +### JSON read/write round-trippable with `orient='table'`[#](#json-read-write-round-trippable-with-orient-table "Link to this heading") + +A `DataFrame` can now be written to and subsequently read back via JSON while preserving metadata through usage of the `orient='table'` argument (see [GH 18912](https://github.com/pandas-dev/pandas/issues/18912) and [GH 9146](https://github.com/pandas-dev/pandas/issues/9146)). Previously, none of the available `orient` values guaranteed the preservation of dtypes and index names, amongst other metadata. + +```None +In [1]: df = pd.DataFrame({'foo': [1, 2, 3, 4], + ...: 'bar': ['a', 'b', 'c', 'd'], + ...: 'baz': pd.date_range('2018-01-01', freq='d', periods=4), + ...: 'qux': pd.Categorical(['a', 'b', 'c', 'c'])}, + ...: index=pd.Index(range(4), name='idx')) + ...: + +In [2]: df +Out[2]: + foo bar baz qux +idx +0 1 a 2018-01-01 a +1 2 b 2018-01-02 b +2 3 c 2018-01-03 c +3 4 d 2018-01-04 c + +[4 rows x 4 columns] + +In [3]: df.dtypes +Out[3]: +foo int64 +bar object +baz datetime64[ns] +qux category +Length: 4, dtype: object + +In [4]: df.to_json('test.json', orient='table') + +In [5]: new_df = pd.read_json('test.json', orient='table') + +In [6]: new_df +Out[6]: + foo bar baz qux +idx +0 1 a 2018-01-01 a +1 2 b 2018-01-02 b +2 3 c 2018-01-03 c +3 4 d 2018-01-04 c + +[4 rows x 4 columns] + +In [7]: new_df.dtypes +Out[7]: +foo int64 +bar object +baz datetime64[ns] +qux category +Length: 4, dtype: object +``` + +Please note that the string `index` is not supported with the round trip format, as it is used by default in `write_json` to indicate a missing index name. + +```None +In [8]: df.index.name = 'index' + +In [9]: df.to_json('test.json', orient='table') + +In [10]: new_df = pd.read_json('test.json', orient='table') + +In [11]: new_df +Out[11]: + foo bar baz qux +0 1 a 2018-01-01 a +1 2 b 2018-01-02 b +2 3 c 2018-01-03 c +3 4 d 2018-01-04 c + +[4 rows x 4 columns] + +In [12]: new_df.dtypes +Out[12]: +foo int64 +bar object +baz datetime64[ns] +qux category +Length: 4, dtype: object +``` + +### Method `.assign()` accepts dependent arguments[#](#method-assign-accepts-dependent-arguments "Link to this heading") + +The [`DataFrame.assign()`](../reference/api/pandas.DataFrame.assign.html#pandas.DataFrame.assign "pandas.DataFrame.assign") now accepts dependent keyword arguments for python version later than 3.6 (see also [PEP 468](https://www.python.org/dev/peps/pep-0468/)). Later keyword arguments may now refer to earlier ones if the argument is a callable. See the +[documentation here](../user_guide/dsintro.html#dsintro-chained-assignment) ([GH 14207](https://github.com/pandas-dev/pandas/issues/14207)) + +```None +In [13]: df = pd.DataFrame({'A': [1, 2, 3]}) + +In [14]: df +Out[14]: + A +0 1 +1 2 +2 3 + +[3 rows x 1 columns] + +In [15]: df.assign(B=df.A, C=lambda x: x['A'] + x['B']) +Out[15]: + A B C +0 1 1 2 +1 2 2 4 +2 3 3 6 + +[3 rows x 3 columns] +``` + +Warning + +This may subtly change the behavior of your code when you’re +using `.assign()` to update an existing column. Previously, callables +referring to other variables being updated would get the “old” values + +Previous behavior: + +```None +In [2]: df = pd.DataFrame({"A": [1, 2, 3]}) + +In [3]: df.assign(A=lambda df: df.A + 1, C=lambda df: df.A * -1) +Out[3]: + A C +0 2 -1 +1 3 -2 +2 4 -3 +``` + +New behavior: + +```None +In [16]: df.assign(A=df.A + 1, C=lambda df: df.A * -1) +Out[16]: + A C +0 2 -2 +1 3 -3 +2 4 -4 + +[3 rows x 2 columns] +``` + +### Merging on a combination of columns and index levels[#](#merging-on-a-combination-of-columns-and-index-levels "Link to this heading") + +Strings passed to [`DataFrame.merge()`](../reference/api/pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge") as the `on`, `left_on`, and `right_on` +parameters may now refer to either column names or index level names. +This enables merging `DataFrame` instances on a combination of index levels +and columns without resetting indexes. See the [Merge on columns and +levels](../user_guide/merging.html#merging-merge-on-columns-and-levels) documentation section. +([GH 14355](https://github.com/pandas-dev/pandas/issues/14355)) + +```None +In [17]: left_index = pd.Index(['K0', 'K0', 'K1', 'K2'], name='key1') + +In [18]: left = pd.DataFrame({'A': ['A0', 'A1', 'A2', 'A3'], + ....: 'B': ['B0', 'B1', 'B2', 'B3'], + ....: 'key2': ['K0', 'K1', 'K0', 'K1']}, + ....: index=left_index) + ....: + +In [19]: right_index = pd.Index(['K0', 'K1', 'K2', 'K2'], name='key1') + +In [20]: right = pd.DataFrame({'C': ['C0', 'C1', 'C2', 'C3'], + ....: 'D': ['D0', 'D1', 'D2', 'D3'], + ....: 'key2': ['K0', 'K0', 'K0', 'K1']}, + ....: index=right_index) + ....: + +In [21]: left.merge(right, on=['key1', 'key2']) +Out[21]: + A B key2 C D +key1 +K0 A0 B0 K0 C0 D0 +K1 A2 B2 K0 C1 D1 +K2 A3 B3 K1 C3 D3 + +[3 rows x 5 columns] +``` + +### Sorting by a combination of columns and index levels[#](#sorting-by-a-combination-of-columns-and-index-levels "Link to this heading") + +Strings passed to [`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values") as the `by` parameter may +now refer to either column names or index level names. This enables sorting +`DataFrame` instances by a combination of index levels and columns without +resetting indexes. See the [Sorting by Indexes and Values](../user_guide/basics.html#basics-sort-indexes-and-values) documentation section. +([GH 14353](https://github.com/pandas-dev/pandas/issues/14353)) + +```None +# Build MultiIndex +In [22]: idx = pd.MultiIndex.from_tuples([('a', 1), ('a', 2), ('a', 2), + ....: ('b', 2), ('b', 1), ('b', 1)]) + ....: + +In [23]: idx.names = ['first', 'second'] + +# Build DataFrame +In [24]: df_multi = pd.DataFrame({'A': np.arange(6, 0, -1)}, + ....: index=idx) + ....: + +In [25]: df_multi +Out[25]: + A +first second +a 1 6 + 2 5 + 2 4 +b 2 3 + 1 2 + 1 1 + +[6 rows x 1 columns] + +# Sort by 'second' (index) and 'A' (column) +In [26]: df_multi.sort_values(by=['second', 'A']) +Out[26]: + A +first second +b 1 1 + 1 2 +a 1 6 +b 2 3 +a 2 4 + 2 5 + +[6 rows x 1 columns] +``` + +### Extending pandas with custom types (experimental)[#](#extending-pandas-with-custom-types-experimental "Link to this heading") + +pandas now supports storing array-like objects that aren’t necessarily 1-D NumPy +arrays as columns in a DataFrame or values in a Series. This allows third-party +libraries to implement extensions to NumPy’s types, similar to how pandas +implemented categoricals, datetimes with timezones, periods, and intervals. + +As a demonstration, we’ll use [cyberpandas](https://cyberpandas.readthedocs.io/en/latest/), which provides an `IPArray` type +for storing ip addresses. + +```None +In [1]: from cyberpandas import IPArray + +In [2]: values = IPArray([ + ...: 0, + ...: 3232235777, + ...: 42540766452641154071740215577757643572 + ...: ]) + ...: + ...: +``` + +`IPArray` isn’t a normal 1-D NumPy array, but because it’s a pandas +[`ExtensionArray`](../reference/api/pandas.api.extensions.ExtensionArray.html#pandas.api.extensions.ExtensionArray "pandas.api.extensions.ExtensionArray"), it can be stored properly inside pandas’ containers. + +```None +In [3]: ser = pd.Series(values) + +In [4]: ser +Out[4]: +0 0.0.0.0 +1 192.168.1.1 +2 2001:db8:85a3::8a2e:370:7334 +dtype: ip +``` + +Notice that the dtype is `ip`. The missing value semantics of the underlying +array are respected: + +```None +In [5]: ser.isna() +Out[5]: +0 True +1 False +2 False +dtype: bool +``` + +For more, see the [extension types](../development/extending.html#extending-extension-types) +documentation. If you build an extension array, publicize it on [the ecosystem page](https://pandas.pydata.org/community/ecosystem.html). + +### New `observed` keyword for excluding unobserved categories in `GroupBy`[#](#new-observed-keyword-for-excluding-unobserved-categories-in-groupby "Link to this heading") + +Grouping by a categorical includes the unobserved categories in the output. +When grouping by multiple categorical columns, this means you get the cartesian product of all the +categories, including combinations where there are no observations, which can result in a large +number of groups. We have added a keyword `observed` to control this behavior, it defaults to +`observed=False` for backward-compatibility. ([GH 14942](https://github.com/pandas-dev/pandas/issues/14942), [GH 8138](https://github.com/pandas-dev/pandas/issues/8138), [GH 15217](https://github.com/pandas-dev/pandas/issues/15217), [GH 17594](https://github.com/pandas-dev/pandas/issues/17594), [GH 8669](https://github.com/pandas-dev/pandas/issues/8669), [GH 20583](https://github.com/pandas-dev/pandas/issues/20583), [GH 20902](https://github.com/pandas-dev/pandas/issues/20902)) + +```None +In [27]: cat1 = pd.Categorical(["a", "a", "b", "b"], + ....: categories=["a", "b", "z"], ordered=True) + ....: + +In [28]: cat2 = pd.Categorical(["c", "d", "c", "d"], + ....: categories=["c", "d", "y"], ordered=True) + ....: + +In [29]: df = pd.DataFrame({"A": cat1, "B": cat2, "values": [1, 2, 3, 4]}) + +In [30]: df['C'] = ['foo', 'bar'] * 2 + +In [31]: df +Out[31]: + A B values C +0 a c 1 foo +1 a d 2 bar +2 b c 3 foo +3 b d 4 bar + +[4 rows x 4 columns] +``` + +To show all values, the previous behavior: + +```None +In [32]: df.groupby(['A', 'B', 'C'], observed=False).count() +Out[32]: + values +A B C +a c bar 0 + foo 1 + d bar 1 + foo 0 + y bar 0 +... ... +z c foo 0 + d bar 0 + foo 0 + y bar 0 + foo 0 + +[18 rows x 1 columns] +``` + +To show only observed values: + +```None +In [33]: df.groupby(['A', 'B', 'C'], observed=True).count() +Out[33]: + values +A B C +a c foo 1 + d bar 1 +b c foo 1 + d bar 1 + +[4 rows x 1 columns] +``` + +For pivoting operations, this behavior is *already* controlled by the `dropna` keyword: + +```None +In [34]: cat1 = pd.Categorical(["a", "a", "b", "b"], + ....: categories=["a", "b", "z"], ordered=True) + ....: + +In [35]: cat2 = pd.Categorical(["c", "d", "c", "d"], + ....: categories=["c", "d", "y"], ordered=True) + ....: + +In [36]: df = pd.DataFrame({"A": cat1, "B": cat2, "values": [1, 2, 3, 4]}) + +In [37]: df +Out[37]: + A B values +0 a c 1 +1 a d 2 +2 b c 3 +3 b d 4 + +[4 rows x 3 columns] +``` + +```None +In [1]: pd.pivot_table(df, values='values', index=['A', 'B'], dropna=True) + +Out[1]: + values +A B +a c 1.0 + d 2.0 +b c 3.0 + d 4.0 + +In [2]: pd.pivot_table(df, values='values', index=['A', 'B'], dropna=False) + +Out[2]: + values +A B +a c 1.0 + d 2.0 + y NaN +b c 3.0 + d 4.0 + y NaN +z c NaN + d NaN + y NaN +``` + +### Rolling/Expanding.apply() accepts `raw=False` to pass a `Series` to the function[#](#rolling-expanding-apply-accepts-raw-false-to-pass-a-series-to-the-function "Link to this heading") + +`Series.rolling().apply()`, `DataFrame.rolling().apply()`, +`Series.expanding().apply()`, and `DataFrame.expanding().apply()` have gained a `raw=None` parameter. +This is similar to `DataFame.apply()`. This parameter, if `True` allows one to send a `np.ndarray` to the applied function. If `False` a `Series` will be passed. The +default is `None`, which preserves backward compatibility, so this will default to `True`, sending an `np.ndarray`. +In a future version the default will be changed to `False`, sending a `Series`. ([GH 5071](https://github.com/pandas-dev/pandas/issues/5071), [GH 20584](https://github.com/pandas-dev/pandas/issues/20584)) + +```None +In [38]: s = pd.Series(np.arange(5), np.arange(5) + 1) + +In [39]: s +Out[39]: +1 0 +2 1 +3 2 +4 3 +5 4 +Length: 5, dtype: int64 +``` + +Pass a `Series`: + +```None +In [40]: s.rolling(2, min_periods=1).apply(lambda x: x.iloc[-1], raw=False) +Out[40]: +1 0.0 +2 1.0 +3 2.0 +4 3.0 +5 4.0 +Length: 5, dtype: float64 +``` + +Mimic the original behavior of passing a ndarray: + +```None +In [41]: s.rolling(2, min_periods=1).apply(lambda x: x[-1], raw=True) +Out[41]: +1 0.0 +2 1.0 +3 2.0 +4 3.0 +5 4.0 +Length: 5, dtype: float64 +``` + +### `DataFrame.interpolate` has gained the `limit_area` kwarg[#](#dataframe-interpolate-has-gained-the-limit-area-kwarg "Link to this heading") + +[`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") has gained a `limit_area` parameter to allow further control of which `NaN` s are replaced. +Use `limit_area='inside'` to fill only NaNs surrounded by valid values or use `limit_area='outside'` to fill only `NaN` s +outside the existing valid values while preserving those inside. ([GH 16284](https://github.com/pandas-dev/pandas/issues/16284)) See the [full documentation here](../user_guide/missing_data.html#missing-data-interp-limits). + +```None +In [42]: ser = pd.Series([np.nan, np.nan, 5, np.nan, np.nan, + ....: np.nan, 13, np.nan, np.nan]) + ....: + +In [43]: ser +Out[43]: +0 NaN +1 NaN +2 5.0 +3 NaN +4 NaN +5 NaN +6 13.0 +7 NaN +8 NaN +Length: 9, dtype: float64 +``` + +Fill one consecutive inside value in both directions + +```None +In [44]: ser.interpolate(limit_direction='both', limit_area='inside', limit=1) +Out[44]: +0 NaN +1 NaN +2 5.0 +3 7.0 +4 NaN +5 11.0 +6 13.0 +7 NaN +8 NaN +Length: 9, dtype: float64 +``` + +Fill all consecutive outside values backward + +```None +In [45]: ser.interpolate(limit_direction='backward', limit_area='outside') +Out[45]: +0 5.0 +1 5.0 +2 5.0 +3 NaN +4 NaN +5 NaN +6 13.0 +7 NaN +8 NaN +Length: 9, dtype: float64 +``` + +Fill all consecutive outside values in both directions + +```None +In [46]: ser.interpolate(limit_direction='both', limit_area='outside') +Out[46]: +0 5.0 +1 5.0 +2 5.0 +3 NaN +4 NaN +5 NaN +6 13.0 +7 13.0 +8 13.0 +Length: 9, dtype: float64 +``` + +### Function `get_dummies` now supports `dtype` argument[#](#function-get-dummies-now-supports-dtype-argument "Link to this heading") + +The [`get_dummies()`](../reference/api/pandas.get_dummies.html#pandas.get_dummies "pandas.get_dummies") now accepts a `dtype` argument, which specifies a dtype for the new columns. The default remains uint8. ([GH 18330](https://github.com/pandas-dev/pandas/issues/18330)) + +```None +In [47]: df = pd.DataFrame({'a': [1, 2], 'b': [3, 4], 'c': [5, 6]}) + +In [48]: pd.get_dummies(df, columns=['c']).dtypes +Out[48]: +a int64 +b int64 +c_5 bool +c_6 bool +Length: 4, dtype: object + +In [49]: pd.get_dummies(df, columns=['c'], dtype=bool).dtypes +Out[49]: +a int64 +b int64 +c_5 bool +c_6 bool +Length: 4, dtype: object +``` + +### Timedelta mod method[#](#timedelta-mod-method "Link to this heading") + +`mod` (%) and `divmod` operations are now defined on `Timedelta` objects +when operating with either timedelta-like or with numeric arguments. +See the [documentation here](../user_guide/timedeltas.html#timedeltas-mod-divmod). ([GH 19365](https://github.com/pandas-dev/pandas/issues/19365)) + +```None +In [50]: td = pd.Timedelta(hours=37) + +In [51]: td % pd.Timedelta(minutes=45) +Out[51]: Timedelta('0 days 00:15:00') +``` + +### Method `.rank()` handles `inf` values when `NaN` are present[#](#method-rank-handles-inf-values-when-nan-are-present "Link to this heading") + +In previous versions, `.rank()` would assign `inf` elements `NaN` as their ranks. Now ranks are calculated properly. ([GH 6945](https://github.com/pandas-dev/pandas/issues/6945)) + +```None +In [52]: s = pd.Series([-np.inf, 0, 1, np.nan, np.inf]) + +In [53]: s +Out[53]: +0 -inf +1 0.0 +2 1.0 +3 NaN +4 inf +Length: 5, dtype: float64 +``` + +Previous behavior: + +```None +In [11]: s.rank() +Out[11]: +0 1.0 +1 2.0 +2 3.0 +3 NaN +4 NaN +dtype: float64 +``` + +Current behavior: + +```None +In [54]: s.rank() +Out[54]: +0 1.0 +1 2.0 +2 3.0 +3 NaN +4 4.0 +Length: 5, dtype: float64 +``` + +Furthermore, previously if you rank `inf` or `-inf` values together with `NaN` values, the calculation won’t distinguish `NaN` from infinity when using ‘top’ or ‘bottom’ argument. + +```None +In [55]: s = pd.Series([np.nan, np.nan, -np.inf, -np.inf]) + +In [56]: s +Out[56]: +0 NaN +1 NaN +2 -inf +3 -inf +Length: 4, dtype: float64 +``` + +Previous behavior: + +```None +In [15]: s.rank(na_option='top') +Out[15]: +0 2.5 +1 2.5 +2 2.5 +3 2.5 +dtype: float64 +``` + +Current behavior: + +```None +In [57]: s.rank(na_option='top') +Out[57]: +0 1.5 +1 1.5 +2 3.5 +3 3.5 +Length: 4, dtype: float64 +``` + +These bugs were squashed: + +* Bug in [`DataFrame.rank()`](../reference/api/pandas.DataFrame.rank.html#pandas.DataFrame.rank "pandas.DataFrame.rank") and [`Series.rank()`](../reference/api/pandas.Series.rank.html#pandas.Series.rank "pandas.Series.rank") when `method='dense'` and `pct=True` in which percentile ranks were not being used with the number of distinct observations ([GH 15630](https://github.com/pandas-dev/pandas/issues/15630)) +* Bug in [`Series.rank()`](../reference/api/pandas.Series.rank.html#pandas.Series.rank "pandas.Series.rank") and [`DataFrame.rank()`](../reference/api/pandas.DataFrame.rank.html#pandas.DataFrame.rank "pandas.DataFrame.rank") when `ascending='False'` failed to return correct ranks for infinity if `NaN` were present ([GH 19538](https://github.com/pandas-dev/pandas/issues/19538)) +* Bug in `DataFrameGroupBy.rank()` where ranks were incorrect when both infinity and `NaN` were present ([GH 20561](https://github.com/pandas-dev/pandas/issues/20561)) + +### `Series.str.cat` has gained the `join` kwarg[#](#series-str-cat-has-gained-the-join-kwarg "Link to this heading") + +Previously, [`Series.str.cat()`](../reference/api/pandas.Series.str.cat.html#pandas.Series.str.cat "pandas.Series.str.cat") did not – in contrast to most of `pandas` – align [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") on their index before concatenation (see [GH 18657](https://github.com/pandas-dev/pandas/issues/18657)). +The method has now gained a keyword `join` to control the manner of alignment, see examples below and [here](../user_guide/text.html#text-concatenate). + +In v.0.23 `join` will default to None (meaning no alignment), but this default will change to `'left'` in a future version of pandas. + +```None +In [58]: s = pd.Series(['a', 'b', 'c', 'd']) + +In [59]: t = pd.Series(['b', 'd', 'e', 'c'], index=[1, 3, 4, 2]) + +In [60]: s.str.cat(t) +Out[60]: +0 NaN +1 bb +2 cc +3 dd +Length: 4, dtype: object + +In [61]: s.str.cat(t, join='left', na_rep='-') +Out[61]: +0 a- +1 bb +2 cc +3 dd +Length: 4, dtype: object +``` + +Furthermore, [`Series.str.cat()`](../reference/api/pandas.Series.str.cat.html#pandas.Series.str.cat "pandas.Series.str.cat") now works for `CategoricalIndex` as well (previously raised a `ValueError`; see [GH 20842](https://github.com/pandas-dev/pandas/issues/20842)). + +### `DataFrame.astype` performs column-wise conversion to `Categorical`[#](#dataframe-astype-performs-column-wise-conversion-to-categorical "Link to this heading") + +[`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") can now perform column-wise conversion to `Categorical` by supplying the string `'category'` or +a `CategoricalDtype`. Previously, attempting this would raise a `NotImplementedError`. See the +[Object creation](../user_guide/categorical.html#categorical-objectcreation) section of the documentation for more details and examples. ([GH 12860](https://github.com/pandas-dev/pandas/issues/12860), [GH 18099](https://github.com/pandas-dev/pandas/issues/18099)) + +Supplying the string `'category'` performs column-wise conversion, with only labels appearing in a given column set as categories: + +```None +In [62]: df = pd.DataFrame({'A': list('abca'), 'B': list('bccd')}) + +In [63]: df = df.astype('category') + +In [64]: df['A'].dtype +Out[64]: CategoricalDtype(categories=['a', 'b', 'c'], ordered=False, categories_dtype=object) + +In [65]: df['B'].dtype +Out[65]: CategoricalDtype(categories=['b', 'c', 'd'], ordered=False, categories_dtype=object) +``` + +Supplying a `CategoricalDtype` will make the categories in each column consistent with the supplied dtype: + +```None +In [66]: from pandas.api.types import CategoricalDtype + +In [67]: df = pd.DataFrame({'A': list('abca'), 'B': list('bccd')}) + +In [68]: cdt = CategoricalDtype(categories=list('abcd'), ordered=True) + +In [69]: df = df.astype(cdt) + +In [70]: df['A'].dtype +Out[70]: CategoricalDtype(categories=['a', 'b', 'c', 'd'], ordered=True, categories_dtype=object) + +In [71]: df['B'].dtype +Out[71]: CategoricalDtype(categories=['a', 'b', 'c', 'd'], ordered=True, categories_dtype=object) +``` + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* Unary `+` now permitted for `Series` and `DataFrame` as numeric operator ([GH 16073](https://github.com/pandas-dev/pandas/issues/16073)) +* Better support for [`to_excel()`](../reference/api/pandas.io.formats.style.Styler.to_excel.html#pandas.io.formats.style.Styler.to_excel "pandas.io.formats.style.Styler.to_excel") output with the `xlsxwriter` engine. ([GH 16149](https://github.com/pandas-dev/pandas/issues/16149)) +* [`pandas.tseries.frequencies.to_offset()`](../reference/api/pandas.tseries.frequencies.to_offset.html#pandas.tseries.frequencies.to_offset "pandas.tseries.frequencies.to_offset") now accepts leading ‘+’ signs e.g. ‘+1h’. ([GH 18171](https://github.com/pandas-dev/pandas/issues/18171)) +* `MultiIndex.unique()` now supports the `level=` argument, to get unique values from a specific index level ([GH 17896](https://github.com/pandas-dev/pandas/issues/17896)) +* [`pandas.io.formats.style.Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") now has method `hide_index()` to determine whether the index will be rendered in output ([GH 14194](https://github.com/pandas-dev/pandas/issues/14194)) +* [`pandas.io.formats.style.Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") now has method `hide_columns()` to determine whether columns will be hidden in output ([GH 14194](https://github.com/pandas-dev/pandas/issues/14194)) +* Improved wording of `ValueError` raised in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") when `unit=` is passed with a non-convertible value ([GH 14350](https://github.com/pandas-dev/pandas/issues/14350)) +* [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") now accepts a Series or a dict as a `value` for a categorical dtype ([GH 17033](https://github.com/pandas-dev/pandas/issues/17033)) +* [`pandas.read_clipboard()`](../reference/api/pandas.read_clipboard.html#pandas.read_clipboard "pandas.read_clipboard") updated to use qtpy, falling back to PyQt5 and then PyQt4, adding compatibility with Python3 and multiple python-qt bindings ([GH 17722](https://github.com/pandas-dev/pandas/issues/17722)) +* Improved wording of `ValueError` raised in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") when the `usecols` argument cannot match all columns. ([GH 17301](https://github.com/pandas-dev/pandas/issues/17301)) +* [`DataFrame.corrwith()`](../reference/api/pandas.DataFrame.corrwith.html#pandas.DataFrame.corrwith "pandas.DataFrame.corrwith") now silently drops non-numeric columns when passed a Series. Before, an exception was raised ([GH 18570](https://github.com/pandas-dev/pandas/issues/18570)). +* [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") now supports time zone aware `Interval` objects ([GH 18537](https://github.com/pandas-dev/pandas/issues/18537), [GH 18538](https://github.com/pandas-dev/pandas/issues/18538)) +* [`Series()`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") / [`DataFrame()`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") tab completion also returns identifiers in the first level of a [`MultiIndex()`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex"). ([GH 16326](https://github.com/pandas-dev/pandas/issues/16326)) +* [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") has gained the `nrows` parameter ([GH 16645](https://github.com/pandas-dev/pandas/issues/16645)) +* `DataFrame.append()` can now in more cases preserve the type of the calling dataframe’s columns (e.g. if both are `CategoricalIndex`) ([GH 18359](https://github.com/pandas-dev/pandas/issues/18359)) +* [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") and [`Series.to_json()`](../reference/api/pandas.Series.to_json.html#pandas.Series.to_json "pandas.Series.to_json") now accept an `index` argument which allows the user to exclude the index from the JSON output ([GH 17394](https://github.com/pandas-dev/pandas/issues/17394)) +* `IntervalIndex.to_tuples()` has gained the `na_tuple` parameter to control whether NA is returned as a tuple of NA, or NA itself ([GH 18756](https://github.com/pandas-dev/pandas/issues/18756)) +* `Categorical.rename_categories`, `CategoricalIndex.rename_categories` and [`Series.cat.rename_categories`](../reference/api/pandas.Series.cat.rename_categories.html#pandas.Series.cat.rename_categories "pandas.Series.cat.rename_categories") + can now take a callable as their argument ([GH 18862](https://github.com/pandas-dev/pandas/issues/18862)) +* [`Interval`](../reference/api/pandas.Interval.html#pandas.Interval "pandas.Interval") and [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") have gained a `length` attribute ([GH 18789](https://github.com/pandas-dev/pandas/issues/18789)) +* `Resampler` objects now have a functioning [`Resampler.pipe`](../reference/api/pandas.core.resample.Resampler.pipe.html#pandas.core.resample.Resampler.pipe "pandas.core.resample.Resampler.pipe") method. + Previously, calls to `pipe` were diverted to the `mean` method ([GH 17905](https://github.com/pandas-dev/pandas/issues/17905)). +* [`is_scalar()`](../reference/api/pandas.api.types.is_scalar.html#pandas.api.types.is_scalar "pandas.api.types.is_scalar") now returns `True` for `DateOffset` objects ([GH 18943](https://github.com/pandas-dev/pandas/issues/18943)). +* [`DataFrame.pivot()`](../reference/api/pandas.DataFrame.pivot.html#pandas.DataFrame.pivot "pandas.DataFrame.pivot") now accepts a list for the `values=` kwarg ([GH 17160](https://github.com/pandas-dev/pandas/issues/17160)). +* Added [`pandas.api.extensions.register_dataframe_accessor()`](../reference/api/pandas.api.extensions.register_dataframe_accessor.html#pandas.api.extensions.register_dataframe_accessor "pandas.api.extensions.register_dataframe_accessor"), + [`pandas.api.extensions.register_series_accessor()`](../reference/api/pandas.api.extensions.register_series_accessor.html#pandas.api.extensions.register_series_accessor "pandas.api.extensions.register_series_accessor"), and + [`pandas.api.extensions.register_index_accessor()`](../reference/api/pandas.api.extensions.register_index_accessor.html#pandas.api.extensions.register_index_accessor "pandas.api.extensions.register_index_accessor"), accessor for libraries downstream of pandas + to register custom accessors like `.cat` on pandas objects. See + [Registering Custom Accessors](../development/extending.html#extending-register-accessors) for more ([GH 14781](https://github.com/pandas-dev/pandas/issues/14781)). +* `IntervalIndex.astype` now supports conversions between subtypes when passed an `IntervalDtype` ([GH 19197](https://github.com/pandas-dev/pandas/issues/19197)) +* [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") and its associated constructor methods (`from_arrays`, `from_breaks`, `from_tuples`) have gained a `dtype` parameter ([GH 19262](https://github.com/pandas-dev/pandas/issues/19262)) +* Added `SeriesGroupBy.is_monotonic_increasing()` and `SeriesGroupBy.is_monotonic_decreasing()` ([GH 17015](https://github.com/pandas-dev/pandas/issues/17015)) +* For subclassed `DataFrames`, [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") will now preserve the `Series` subclass (if defined) when passing the data to the applied function ([GH 19822](https://github.com/pandas-dev/pandas/issues/19822)) +* [`DataFrame.from_dict()`](../reference/api/pandas.DataFrame.from_dict.html#pandas.DataFrame.from_dict "pandas.DataFrame.from_dict") now accepts a `columns` argument that can be used to specify the column names when `orient='index'` is used ([GH 18529](https://github.com/pandas-dev/pandas/issues/18529)) +* Added option `display.html.use_mathjax` so [MathJax](https://www.mathjax.org/) can be disabled when rendering tables in `Jupyter` notebooks ([GH 19856](https://github.com/pandas-dev/pandas/issues/19856), [GH 19824](https://github.com/pandas-dev/pandas/issues/19824)) +* [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") now supports the `method` parameter, which can be used to specify the replacement method when `to_replace` is a scalar, list or tuple and `value` is `None` ([GH 19632](https://github.com/pandas-dev/pandas/issues/19632)) +* [`Timestamp.month_name()`](../reference/api/pandas.Timestamp.month_name.html#pandas.Timestamp.month_name "pandas.Timestamp.month_name"), [`DatetimeIndex.month_name()`](../reference/api/pandas.DatetimeIndex.month_name.html#pandas.DatetimeIndex.month_name "pandas.DatetimeIndex.month_name"), and [`Series.dt.month_name()`](../reference/api/pandas.Series.dt.month_name.html#pandas.Series.dt.month_name "pandas.Series.dt.month_name") are now available ([GH 12805](https://github.com/pandas-dev/pandas/issues/12805)) +* [`Timestamp.day_name()`](../reference/api/pandas.Timestamp.day_name.html#pandas.Timestamp.day_name "pandas.Timestamp.day_name") and [`DatetimeIndex.day_name()`](../reference/api/pandas.DatetimeIndex.day_name.html#pandas.DatetimeIndex.day_name "pandas.DatetimeIndex.day_name") are now available to return day names with a specified locale ([GH 12806](https://github.com/pandas-dev/pandas/issues/12806)) +* [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") now performs a multi-value insert if the underlying connection supports itk rather than inserting row by row. + `SQLAlchemy` dialects supporting multi-value inserts include: `mysql`, `postgresql`, `sqlite` and any dialect with `supports_multivalues_insert`. ([GH 14315](https://github.com/pandas-dev/pandas/issues/14315), [GH 8953](https://github.com/pandas-dev/pandas/issues/8953)) +* [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") now accepts a `displayed_only` keyword argument to controls whether or not hidden elements are parsed (`True` by default) ([GH 20027](https://github.com/pandas-dev/pandas/issues/20027)) +* [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") now reads all `` elements in a `
`, not just the first. ([GH 20690](https://github.com/pandas-dev/pandas/issues/20690)) +* [`Rolling.quantile()`](../reference/api/pandas.core.window.rolling.Rolling.quantile.html#pandas.core.window.rolling.Rolling.quantile "pandas.core.window.rolling.Rolling.quantile") and [`Expanding.quantile()`](../reference/api/pandas.core.window.expanding.Expanding.quantile.html#pandas.core.window.expanding.Expanding.quantile "pandas.core.window.expanding.Expanding.quantile") now accept the `interpolation` keyword, `linear` by default ([GH 20497](https://github.com/pandas-dev/pandas/issues/20497)) +* zip compression is supported via `compression=zip` in [`DataFrame.to_pickle()`](../reference/api/pandas.DataFrame.to_pickle.html#pandas.DataFrame.to_pickle "pandas.DataFrame.to_pickle"), [`Series.to_pickle()`](../reference/api/pandas.Series.to_pickle.html#pandas.Series.to_pickle "pandas.Series.to_pickle"), [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv"), [`Series.to_csv()`](../reference/api/pandas.Series.to_csv.html#pandas.Series.to_csv "pandas.Series.to_csv"), [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json"), [`Series.to_json()`](../reference/api/pandas.Series.to_json.html#pandas.Series.to_json "pandas.Series.to_json"). ([GH 17778](https://github.com/pandas-dev/pandas/issues/17778)) +* [`WeekOfMonth`](../reference/api/pandas.tseries.offsets.WeekOfMonth.html#pandas.tseries.offsets.WeekOfMonth "pandas.tseries.offsets.WeekOfMonth") constructor now supports `n=0` ([GH 20517](https://github.com/pandas-dev/pandas/issues/20517)). +* [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") now support matrix multiplication (`@`) operator ([GH 10259](https://github.com/pandas-dev/pandas/issues/10259)) for Python>=3.5 +* Updated [`DataFrame.to_gbq()`](../reference/api/pandas.DataFrame.to_gbq.html#pandas.DataFrame.to_gbq "pandas.DataFrame.to_gbq") and [`pandas.read_gbq()`](../reference/api/pandas.read_gbq.html#pandas.read_gbq "pandas.read_gbq") signature and documentation to reflect changes from + the pandas-gbq library version 0.4.0. Adds intersphinx mapping to pandas-gbq + library. ([GH 20564](https://github.com/pandas-dev/pandas/issues/20564)) +* Added new writer for exporting Stata dta files in version 117, `StataWriter117`. This format supports exporting strings with lengths up to 2,000,000 characters ([GH 16450](https://github.com/pandas-dev/pandas/issues/16450)) +* `to_hdf()` and [`read_hdf()`](../reference/api/pandas.read_hdf.html#pandas.read_hdf "pandas.read_hdf") now accept an `errors` keyword argument to control encoding error handling ([GH 20835](https://github.com/pandas-dev/pandas/issues/20835)) +* [`cut()`](../reference/api/pandas.cut.html#pandas.cut "pandas.cut") has gained the `duplicates='raise'|'drop'` option to control whether to raise on duplicated edges ([GH 20947](https://github.com/pandas-dev/pandas/issues/20947)) +* [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range"), [`timedelta_range()`](../reference/api/pandas.timedelta_range.html#pandas.timedelta_range "pandas.timedelta_range"), and [`interval_range()`](../reference/api/pandas.interval_range.html#pandas.interval_range "pandas.interval_range") now return a linearly spaced index if `start`, `stop`, and `periods` are specified, but `freq` is not. ([GH 20808](https://github.com/pandas-dev/pandas/issues/20808), [GH 20983](https://github.com/pandas-dev/pandas/issues/20983), [GH 20976](https://github.com/pandas-dev/pandas/issues/20976)) + +## Backwards incompatible API changes[#](#backwards-incompatible-api-changes "Link to this heading") + +### Dependencies have increased minimum versions[#](#dependencies-have-increased-minimum-versions "Link to this heading") + +We have updated our minimum supported versions of dependencies ([GH 15184](https://github.com/pandas-dev/pandas/issues/15184)). +If installed, we now require: + +| Package | Minimum Version | Required | Issue | +| --- | --- | --- | --- | +| python-dateutil | 2.5.0 | X | [GH 15184](https://github.com/pandas-dev/pandas/issues/15184) | +| openpyxl | 2.4.0 | | [GH 15184](https://github.com/pandas-dev/pandas/issues/15184) | +| beautifulsoup4 | 4.2.1 | | [GH 20082](https://github.com/pandas-dev/pandas/issues/20082) | +| setuptools | 24.2.0 | | [GH 20698](https://github.com/pandas-dev/pandas/issues/20698) | + +### Instantiation from dicts preserves dict insertion order for Python 3.6+[#](#instantiation-from-dicts-preserves-dict-insertion-order-for-python-3-6 "Link to this heading") + +Until Python 3.6, dicts in Python had no formally defined ordering. For Python +version 3.6 and later, dicts are ordered by insertion order, see +[PEP 468](https://www.python.org/dev/peps/pep-0468/). +pandas will use the dict’s insertion order, when creating a `Series` or +`DataFrame` from a dict and you’re using Python version 3.6 or +higher. ([GH 19884](https://github.com/pandas-dev/pandas/issues/19884)) + +Previous behavior (and current behavior if on Python < 3.6): + +```None +In [16]: pd.Series({'Income': 2000, + ....: 'Expenses': -1500, + ....: 'Taxes': -200, + ....: 'Net result': 300}) +Out[16]: +Expenses -1500 +Income 2000 +Net result 300 +Taxes -200 +dtype: int64 +``` + +Note the Series above is ordered alphabetically by the index values. + +New behavior (for Python >= 3.6): + +```None +In [72]: pd.Series({'Income': 2000, + ....: 'Expenses': -1500, + ....: 'Taxes': -200, + ....: 'Net result': 300}) + ....: +Out[72]: +Income 2000 +Expenses -1500 +Taxes -200 +Net result 300 +Length: 4, dtype: int64 +``` + +Notice that the Series is now ordered by insertion order. This new behavior is +used for all relevant pandas types (`Series`, `DataFrame`, `SparseSeries` +and `SparseDataFrame`). + +If you wish to retain the old behavior while using Python >= 3.6, you can use +`.sort_index()`: + +```None +In [73]: pd.Series({'Income': 2000, + ....: 'Expenses': -1500, + ....: 'Taxes': -200, + ....: 'Net result': 300}).sort_index() + ....: +Out[73]: +Expenses -1500 +Income 2000 +Net result 300 +Taxes -200 +Length: 4, dtype: int64 +``` + +### Deprecate Panel[#](#deprecate-panel "Link to this heading") + +`Panel` was deprecated in the 0.20.x release, showing as a `DeprecationWarning`. Using `Panel` will now show a `FutureWarning`. The recommended way to represent 3-D data are +with a `MultiIndex` on a `DataFrame` via the `to_frame()` or with the [xarray package](http://xarray.pydata.org/en/stable/). pandas +provides a `to_xarray()` method to automate this conversion ([GH 13563](https://github.com/pandas-dev/pandas/issues/13563), [GH 18324](https://github.com/pandas-dev/pandas/issues/18324)). + +```None +In [75]: import pandas._testing as tm + +In [76]: p = tm.makePanel() + +In [77]: p +Out[77]: + +Dimensions: 3 (items) x 3 (major_axis) x 4 (minor_axis) +Items axis: ItemA to ItemC +Major_axis axis: 2000-01-03 00:00:00 to 2000-01-05 00:00:00 +Minor_axis axis: A to D +``` + +Convert to a MultiIndex DataFrame + +```None +In [78]: p.to_frame() +Out[78]: + ItemA ItemB ItemC +major minor +2000-01-03 A 0.469112 0.721555 0.404705 + B -1.135632 0.271860 -1.039268 + C 0.119209 0.276232 -1.344312 + D -2.104569 0.113648 -0.109050 +2000-01-04 A -0.282863 -0.706771 0.577046 + B 1.212112 -0.424972 -0.370647 + C -1.044236 -1.087401 0.844885 + D -0.494929 -1.478427 1.643563 +2000-01-05 A -1.509059 -1.039575 -1.715002 + B -0.173215 0.567020 -1.157892 + C -0.861849 -0.673690 1.075770 + D 1.071804 0.524988 -1.469388 + +[12 rows x 3 columns] +``` + +Convert to an xarray DataArray + +```None +In [79]: p.to_xarray() +Out[79]: + +array([[[ 0.469112, -1.135632, 0.119209, -2.104569], + [-0.282863, 1.212112, -1.044236, -0.494929], + [-1.509059, -0.173215, -0.861849, 1.071804]], + + [[ 0.721555, 0.27186 , 0.276232, 0.113648], + [-0.706771, -0.424972, -1.087401, -1.478427], + [-1.039575, 0.56702 , -0.67369 , 0.524988]], + + [[ 0.404705, -1.039268, -1.344312, -0.10905 ], + [ 0.577046, -0.370647, 0.844885, 1.643563], + [-1.715002, -1.157892, 1.07577 , -1.469388]]]) +Coordinates: + * items (items) object 'ItemA' 'ItemB' 'ItemC' + * major_axis (major_axis) datetime64[ns] 2000-01-03 2000-01-04 2000-01-05 + * minor_axis (minor_axis) object 'A' 'B' 'C' 'D' +``` + +### pandas.core.common removals[#](#pandas-core-common-removals "Link to this heading") + +The following error & warning messages are removed from `pandas.core.common` ([GH 13634](https://github.com/pandas-dev/pandas/issues/13634), [GH 19769](https://github.com/pandas-dev/pandas/issues/19769)): + +* `PerformanceWarning` +* `UnsupportedFunctionCall` +* `UnsortedIndexError` +* `AbstractMethodError` + +These are available from import from `pandas.errors` (since 0.19.0). + +### Changes to make output of `DataFrame.apply` consistent[#](#changes-to-make-output-of-dataframe-apply-consistent "Link to this heading") + +[`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") was inconsistent when applying an arbitrary user-defined-function that returned a list-like with `axis=1`. Several bugs and inconsistencies +are resolved. If the applied function returns a Series, then pandas will return a DataFrame; otherwise a Series will be returned, this includes the case +where a list-like (e.g. `tuple` or `list` is returned) ([GH 16353](https://github.com/pandas-dev/pandas/issues/16353), [GH 17437](https://github.com/pandas-dev/pandas/issues/17437), [GH 17970](https://github.com/pandas-dev/pandas/issues/17970), [GH 17348](https://github.com/pandas-dev/pandas/issues/17348), [GH 17892](https://github.com/pandas-dev/pandas/issues/17892), [GH 18573](https://github.com/pandas-dev/pandas/issues/18573), +[GH 17602](https://github.com/pandas-dev/pandas/issues/17602), [GH 18775](https://github.com/pandas-dev/pandas/issues/18775), [GH 18901](https://github.com/pandas-dev/pandas/issues/18901), [GH 18919](https://github.com/pandas-dev/pandas/issues/18919)). + +```None +In [74]: df = pd.DataFrame(np.tile(np.arange(3), 6).reshape(6, -1) + 1, + ....: columns=['A', 'B', 'C']) + ....: + +In [75]: df +Out[75]: + A B C +0 1 2 3 +1 1 2 3 +2 1 2 3 +3 1 2 3 +4 1 2 3 +5 1 2 3 + +[6 rows x 3 columns] +``` + +Previous behavior: if the returned shape happened to match the length of original columns, this would return a `DataFrame`. +If the return shape did not match, a `Series` with lists was returned. + +```None +In [3]: df.apply(lambda x: [1, 2, 3], axis=1) +Out[3]: + A B C +0 1 2 3 +1 1 2 3 +2 1 2 3 +3 1 2 3 +4 1 2 3 +5 1 2 3 + +In [4]: df.apply(lambda x: [1, 2], axis=1) +Out[4]: +0 [1, 2] +1 [1, 2] +2 [1, 2] +3 [1, 2] +4 [1, 2] +5 [1, 2] +dtype: object +``` + +New behavior: When the applied function returns a list-like, this will now *always* return a `Series`. + +```None +In [76]: df.apply(lambda x: [1, 2, 3], axis=1) +Out[76]: +0 [1, 2, 3] +1 [1, 2, 3] +2 [1, 2, 3] +3 [1, 2, 3] +4 [1, 2, 3] +5 [1, 2, 3] +Length: 6, dtype: object + +In [77]: df.apply(lambda x: [1, 2], axis=1) +Out[77]: +0 [1, 2] +1 [1, 2] +2 [1, 2] +3 [1, 2] +4 [1, 2] +5 [1, 2] +Length: 6, dtype: object +``` + +To have expanded columns, you can use `result_type='expand'` + +```None +In [78]: df.apply(lambda x: [1, 2, 3], axis=1, result_type='expand') +Out[78]: + 0 1 2 +0 1 2 3 +1 1 2 3 +2 1 2 3 +3 1 2 3 +4 1 2 3 +5 1 2 3 + +[6 rows x 3 columns] +``` + +To broadcast the result across the original columns (the old behaviour for +list-likes of the correct length), you can use `result_type='broadcast'`. +The shape must match the original columns. + +```None +In [79]: df.apply(lambda x: [1, 2, 3], axis=1, result_type='broadcast') +Out[79]: + A B C +0 1 2 3 +1 1 2 3 +2 1 2 3 +3 1 2 3 +4 1 2 3 +5 1 2 3 + +[6 rows x 3 columns] +``` + +Returning a `Series` allows one to control the exact return structure and column names: + +```None +In [80]: df.apply(lambda x: pd.Series([1, 2, 3], index=['D', 'E', 'F']), axis=1) +Out[80]: + D E F +0 1 2 3 +1 1 2 3 +2 1 2 3 +3 1 2 3 +4 1 2 3 +5 1 2 3 + +[6 rows x 3 columns] +``` + +### Concatenation will no longer sort[#](#concatenation-will-no-longer-sort "Link to this heading") + +In a future version of pandas [`pandas.concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") will no longer sort the non-concatenation axis when it is not already aligned. +The current behavior is the same as the previous (sorting), but now a warning is issued when `sort` is not specified and the non-concatenation axis is not aligned ([GH 4588](https://github.com/pandas-dev/pandas/issues/4588)). + +```None +In [81]: df1 = pd.DataFrame({"a": [1, 2], "b": [1, 2]}, columns=['b', 'a']) + +In [82]: df2 = pd.DataFrame({"a": [4, 5]}) + +In [83]: pd.concat([df1, df2]) +Out[83]: + b a +0 1.0 1 +1 2.0 2 +0 NaN 4 +1 NaN 5 + +[4 rows x 2 columns] +``` + +To keep the previous behavior (sorting) and silence the warning, pass `sort=True` + +```None +In [84]: pd.concat([df1, df2], sort=True) +Out[84]: + a b +0 1 1.0 +1 2 2.0 +0 4 NaN +1 5 NaN + +[4 rows x 2 columns] +``` + +To accept the future behavior (no sorting), pass `sort=False` + +Note that this change also applies to `DataFrame.append()`, which has also received a `sort` keyword for controlling this behavior. + +### Build changes[#](#build-changes "Link to this heading") + +* Building pandas for development now requires `cython >= 0.24` ([GH 18613](https://github.com/pandas-dev/pandas/issues/18613)) +* Building from source now explicitly requires `setuptools` in `setup.py` ([GH 18113](https://github.com/pandas-dev/pandas/issues/18113)) +* Updated conda recipe to be in compliance with conda-build 3.0+ ([GH 18002](https://github.com/pandas-dev/pandas/issues/18002)) + +### Index division by zero fills correctly[#](#index-division-by-zero-fills-correctly "Link to this heading") + +Division operations on `Index` and subclasses will now fill division of positive numbers by zero with `np.inf`, division of negative numbers by zero with `-np.inf` and `0 / 0` with `np.nan`. This matches existing `Series` behavior. ([GH 19322](https://github.com/pandas-dev/pandas/issues/19322), [GH 19347](https://github.com/pandas-dev/pandas/issues/19347)) + +Previous behavior: + +```None +In [6]: index = pd.Int64Index([-1, 0, 1]) + +In [7]: index / 0 +Out[7]: Int64Index([0, 0, 0], dtype='int64') + +# Previous behavior yielded different results depending on the type of zero in the divisor +In [8]: index / 0.0 +Out[8]: Float64Index([-inf, nan, inf], dtype='float64') + +In [9]: index = pd.UInt64Index([0, 1]) + +In [10]: index / np.array([0, 0], dtype=np.uint64) +Out[10]: UInt64Index([0, 0], dtype='uint64') + +In [11]: pd.RangeIndex(1, 5) / 0 +ZeroDivisionError: integer division or modulo by zero +``` + +Current behavior: + +```None +In [12]: index = pd.Int64Index([-1, 0, 1]) +# division by zero gives -infinity where negative, +# +infinity where positive, and NaN for 0 / 0 +In [13]: index / 0 + +# The result of division by zero should not depend on +# whether the zero is int or float +In [14]: index / 0.0 + +In [15]: index = pd.UInt64Index([0, 1]) +In [16]: index / np.array([0, 0], dtype=np.uint64) + +In [17]: pd.RangeIndex(1, 5) / 0 +``` + +### Extraction of matching patterns from strings[#](#extraction-of-matching-patterns-from-strings "Link to this heading") + +By default, extracting matching patterns from strings with `str.extract()` used to return a +`Series` if a single group was being extracted (a `DataFrame` if more than one group was +extracted). As of pandas 0.23.0 `str.extract()` always returns a `DataFrame`, unless +`expand` is set to `False`. Finally, `None` was an accepted value for +the `expand` parameter (which was equivalent to `False`), but now raises a `ValueError`. ([GH 11386](https://github.com/pandas-dev/pandas/issues/11386)) + +Previous behavior: + +```None +In [1]: s = pd.Series(['number 10', '12 eggs']) + +In [2]: extracted = s.str.extract(r'.*(\d\d).*') + +In [3]: extracted +Out [3]: +0 10 +1 12 +dtype: object + +In [4]: type(extracted) +Out [4]: +pandas.core.series.Series +``` + +New behavior: + +```None +In [85]: s = pd.Series(['number 10', '12 eggs']) + +In [86]: extracted = s.str.extract(r'.*(\d\d).*') + +In [87]: extracted +Out[87]: + 0 +0 10 +1 12 + +[2 rows x 1 columns] + +In [88]: type(extracted) +Out[88]: pandas.core.frame.DataFrame +``` + +To restore previous behavior, simply set `expand` to `False`: + +```None +In [89]: s = pd.Series(['number 10', '12 eggs']) + +In [90]: extracted = s.str.extract(r'.*(\d\d).*', expand=False) + +In [91]: extracted +Out[91]: +0 10 +1 12 +Length: 2, dtype: object + +In [92]: type(extracted) +Out[92]: pandas.core.series.Series +``` + +### Default value for the `ordered` parameter of `CategoricalDtype`[#](#default-value-for-the-ordered-parameter-of-categoricaldtype "Link to this heading") + +The default value of the `ordered` parameter for `CategoricalDtype` has changed from `False` to `None` to allow updating of `categories` without impacting `ordered`. Behavior should remain consistent for downstream objects, such as [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") ([GH 18790](https://github.com/pandas-dev/pandas/issues/18790)) + +In previous versions, the default value for the `ordered` parameter was `False`. This could potentially lead to the `ordered` parameter unintentionally being changed from `True` to `False` when users attempt to update `categories` if `ordered` is not explicitly specified, as it would silently default to `False`. The new behavior for `ordered=None` is to retain the existing value of `ordered`. + +New behavior: + +```None +In [2]: from pandas.api.types import CategoricalDtype + +In [3]: cat = pd.Categorical(list('abcaba'), ordered=True, categories=list('cba')) + +In [4]: cat +Out[4]: +[a, b, c, a, b, a] +Categories (3, object): [c < b < a] + +In [5]: cdt = CategoricalDtype(categories=list('cbad')) + +In [6]: cat.astype(cdt) +Out[6]: +[a, b, c, a, b, a] +Categories (4, object): [c < b < a < d] +``` + +Notice in the example above that the converted `Categorical` has retained `ordered=True`. Had the default value for `ordered` remained as `False`, the converted `Categorical` would have become unordered, despite `ordered=False` never being explicitly specified. To change the value of `ordered`, explicitly pass it to the new dtype, e.g. `CategoricalDtype(categories=list('cbad'), ordered=False)`. + +Note that the unintentional conversion of `ordered` discussed above did not arise in previous versions due to separate bugs that prevented `astype` from doing any type of category to category conversion ([GH 10696](https://github.com/pandas-dev/pandas/issues/10696), [GH 18593](https://github.com/pandas-dev/pandas/issues/18593)). These bugs have been fixed in this release, and motivated changing the default value of `ordered`. + +### Better pretty-printing of DataFrames in a terminal[#](#better-pretty-printing-of-dataframes-in-a-terminal "Link to this heading") + +Previously, the default value for the maximum number of columns was +`pd.options.display.max_columns=20`. This meant that relatively wide data +frames would not fit within the terminal width, and pandas would introduce line +breaks to display these 20 columns. This resulted in an output that was +relatively difficult to read: + +![../_images/print_df_old.png](../_images/print_df_old.png) + +If Python runs in a terminal, the maximum number of columns is now determined +automatically so that the printed data frame fits within the current terminal +width (`pd.options.display.max_columns=0`) ([GH 17023](https://github.com/pandas-dev/pandas/issues/17023)). If Python runs +as a Jupyter kernel (such as the Jupyter QtConsole or a Jupyter notebook, as +well as in many IDEs), this value cannot be inferred automatically and is thus +set to `20` as in previous versions. In a terminal, this results in a much +nicer output: + +![../_images/print_df_new.png](../_images/print_df_new.png) + +Note that if you don’t like the new default, you can always set this option +yourself. To revert to the old setting, you can run this line: + +```None +pd.options.display.max_columns = 20 +``` + +### Datetimelike API changes[#](#datetimelike-api-changes "Link to this heading") + +* The default `Timedelta` constructor now accepts an `ISO 8601 Duration` string as an argument ([GH 19040](https://github.com/pandas-dev/pandas/issues/19040)) +* Subtracting `NaT` from a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `dtype='datetime64[ns]'` returns a `Series` with `dtype='timedelta64[ns]'` instead of `dtype='datetime64[ns]'` ([GH 18808](https://github.com/pandas-dev/pandas/issues/18808)) +* Addition or subtraction of `NaT` from [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") will return `TimedeltaIndex` instead of `DatetimeIndex` ([GH 19124](https://github.com/pandas-dev/pandas/issues/19124)) +* `DatetimeIndex.shift()` and `TimedeltaIndex.shift()` will now raise `NullFrequencyError` (which subclasses `ValueError`, which was raised in older versions) when the index object frequency is `None` ([GH 19147](https://github.com/pandas-dev/pandas/issues/19147)) +* Addition and subtraction of `NaN` from a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `dtype='timedelta64[ns]'` will raise a `TypeError` instead of treating the `NaN` as `NaT` ([GH 19274](https://github.com/pandas-dev/pandas/issues/19274)) +* `NaT` division with [`datetime.timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta "(in Python v3.13)") will now return `NaN` instead of raising ([GH 17876](https://github.com/pandas-dev/pandas/issues/17876)) +* Operations between a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with dtype `dtype='datetime64[ns]'` and a [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") will correctly raises `TypeError` ([GH 18850](https://github.com/pandas-dev/pandas/issues/18850)) +* Subtraction of [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with timezone-aware `dtype='datetime64[ns]'` with mismatched timezones will raise `TypeError` instead of `ValueError` ([GH 18817](https://github.com/pandas-dev/pandas/issues/18817)) +* [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") will no longer silently ignore unused or invalid `tz` or `tzinfo` keyword arguments ([GH 17690](https://github.com/pandas-dev/pandas/issues/17690)) +* [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") will no longer silently ignore invalid `freq` arguments ([GH 5168](https://github.com/pandas-dev/pandas/issues/5168)) +* `CacheableOffset` and `WeekDay` are no longer available in the `pandas.tseries.offsets` module ([GH 17830](https://github.com/pandas-dev/pandas/issues/17830)) +* `pandas.tseries.frequencies.get_freq_group()` and `pandas.tseries.frequencies.DAYS` are removed from the public API ([GH 18034](https://github.com/pandas-dev/pandas/issues/18034)) +* [`Series.truncate()`](../reference/api/pandas.Series.truncate.html#pandas.Series.truncate "pandas.Series.truncate") and [`DataFrame.truncate()`](../reference/api/pandas.DataFrame.truncate.html#pandas.DataFrame.truncate "pandas.DataFrame.truncate") will raise a `ValueError` if the index is not sorted instead of an unhelpful `KeyError` ([GH 17935](https://github.com/pandas-dev/pandas/issues/17935)) +* [`Series.first`](../reference/api/pandas.Series.first.html#pandas.Series.first "pandas.Series.first") and [`DataFrame.first`](../reference/api/pandas.DataFrame.first.html#pandas.DataFrame.first "pandas.DataFrame.first") will now raise a `TypeError` + rather than `NotImplementedError` when index is not a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") ([GH 20725](https://github.com/pandas-dev/pandas/issues/20725)). +* [`Series.last`](../reference/api/pandas.Series.last.html#pandas.Series.last "pandas.Series.last") and [`DataFrame.last`](../reference/api/pandas.DataFrame.last.html#pandas.DataFrame.last "pandas.DataFrame.last") will now raise a `TypeError` + rather than `NotImplementedError` when index is not a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") ([GH 20725](https://github.com/pandas-dev/pandas/issues/20725)). +* Restricted `DateOffset` keyword arguments. Previously, `DateOffset` subclasses allowed arbitrary keyword arguments which could lead to unexpected behavior. Now, only valid arguments will be accepted. ([GH 17176](https://github.com/pandas-dev/pandas/issues/17176), [GH 18226](https://github.com/pandas-dev/pandas/issues/18226)). +* [`pandas.merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") provides a more informative error message when trying to merge on timezone-aware and timezone-naive columns ([GH 15800](https://github.com/pandas-dev/pandas/issues/15800)) +* For [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") and [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") with `freq=None`, addition or subtraction of integer-dtyped array or `Index` will raise `NullFrequencyError` instead of `TypeError` ([GH 19895](https://github.com/pandas-dev/pandas/issues/19895)) +* [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") constructor now accepts a `nanosecond` keyword or positional argument ([GH 18898](https://github.com/pandas-dev/pandas/issues/18898)) +* [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") will now raise an `AttributeError` when the `tz` attribute is set after instantiation ([GH 3746](https://github.com/pandas-dev/pandas/issues/3746)) +* [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with a `pytz` timezone will now return a consistent `pytz` timezone ([GH 18595](https://github.com/pandas-dev/pandas/issues/18595)) + +### Other API changes[#](#other-api-changes "Link to this heading") + +* [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") and [`Index.astype()`](../reference/api/pandas.Index.astype.html#pandas.Index.astype "pandas.Index.astype") with an incompatible dtype will now raise a `TypeError` rather than a `ValueError` ([GH 18231](https://github.com/pandas-dev/pandas/issues/18231)) +* `Series` construction with an `object` dtyped tz-aware datetime and `dtype=object` specified, will now return an `object` dtyped `Series`, previously this would infer the datetime dtype ([GH 18231](https://github.com/pandas-dev/pandas/issues/18231)) +* A [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") of `dtype=category` constructed from an empty `dict` will now have categories of `dtype=object` rather than `dtype=float64`, consistently with the case in which an empty list is passed ([GH 18515](https://github.com/pandas-dev/pandas/issues/18515)) +* All-NaN levels in a `MultiIndex` are now assigned `float` rather than `object` dtype, promoting consistency with `Index` ([GH 17929](https://github.com/pandas-dev/pandas/issues/17929)). +* Levels names of a `MultiIndex` (when not None) are now required to be unique: trying to create a `MultiIndex` with repeated names will raise a `ValueError` ([GH 18872](https://github.com/pandas-dev/pandas/issues/18872)) +* Both construction and renaming of `Index`/`MultiIndex` with non-hashable `name`/`names` will now raise `TypeError` ([GH 20527](https://github.com/pandas-dev/pandas/issues/20527)) +* [`Index.map()`](../reference/api/pandas.Index.map.html#pandas.Index.map "pandas.Index.map") can now accept `Series` and dictionary input objects ([GH 12756](https://github.com/pandas-dev/pandas/issues/12756), [GH 18482](https://github.com/pandas-dev/pandas/issues/18482), [GH 18509](https://github.com/pandas-dev/pandas/issues/18509)). +* [`DataFrame.unstack()`](../reference/api/pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack") will now default to filling with `np.nan` for `object` columns. ([GH 12815](https://github.com/pandas-dev/pandas/issues/12815)) +* [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") constructor will raise if the `closed` parameter conflicts with how the input data is inferred to be closed ([GH 18421](https://github.com/pandas-dev/pandas/issues/18421)) +* Inserting missing values into indexes will work for all types of indexes and automatically insert the correct type of missing value (`NaN`, `NaT`, etc.) regardless of the type passed in ([GH 18295](https://github.com/pandas-dev/pandas/issues/18295)) +* When created with duplicate labels, `MultiIndex` now raises a `ValueError`. ([GH 17464](https://github.com/pandas-dev/pandas/issues/17464)) +* [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") now raises a `TypeError` instead of a `ValueError` when passed a list, tuple or DataFrame as a `value` ([GH 18293](https://github.com/pandas-dev/pandas/issues/18293)) +* [`pandas.DataFrame.merge()`](../reference/api/pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge") no longer casts a `float` column to `object` when merging on `int` and `float` columns ([GH 16572](https://github.com/pandas-dev/pandas/issues/16572)) +* [`pandas.merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") now raises a `ValueError` when trying to merge on incompatible data types ([GH 9780](https://github.com/pandas-dev/pandas/issues/9780)) +* The default NA value for `UInt64Index` has changed from 0 to `NaN`, which impacts methods that mask with NA, such as `UInt64Index.where()` ([GH 18398](https://github.com/pandas-dev/pandas/issues/18398)) +* Refactored `setup.py` to use `find_packages` instead of explicitly listing out all subpackages ([GH 18535](https://github.com/pandas-dev/pandas/issues/18535)) +* Rearranged the order of keyword arguments in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") to align with [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") ([GH 16672](https://github.com/pandas-dev/pandas/issues/16672)) +* [`wide_to_long()`](../reference/api/pandas.wide_to_long.html#pandas.wide_to_long "pandas.wide_to_long") previously kept numeric-like suffixes as `object` dtype. Now they are cast to numeric if possible ([GH 17627](https://github.com/pandas-dev/pandas/issues/17627)) +* In [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel"), the `comment` argument is now exposed as a named parameter ([GH 18735](https://github.com/pandas-dev/pandas/issues/18735)) +* Rearranged the order of keyword arguments in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") to align with [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") ([GH 16672](https://github.com/pandas-dev/pandas/issues/16672)) +* The options `html.border` and `mode.use_inf_as_null` were deprecated in prior versions, these will now show `FutureWarning` rather than a `DeprecationWarning` ([GH 19003](https://github.com/pandas-dev/pandas/issues/19003)) +* [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") and `IntervalDtype` no longer support categorical, object, and string subtypes ([GH 19016](https://github.com/pandas-dev/pandas/issues/19016)) +* `IntervalDtype` now returns `True` when compared against `'interval'` regardless of subtype, and `IntervalDtype.name` now returns `'interval'` regardless of subtype ([GH 18980](https://github.com/pandas-dev/pandas/issues/18980)) +* `KeyError` now raises instead of `ValueError` in [`drop()`](../reference/api/pandas.DataFrame.drop.html#pandas.DataFrame.drop "pandas.DataFrame.drop"), `drop()`, [`drop()`](../reference/api/pandas.Series.drop.html#pandas.Series.drop "pandas.Series.drop"), [`drop()`](../reference/api/pandas.Index.drop.html#pandas.Index.drop "pandas.Index.drop") when dropping a non-existent element in an axis with duplicates ([GH 19186](https://github.com/pandas-dev/pandas/issues/19186)) +* [`Series.to_csv()`](../reference/api/pandas.Series.to_csv.html#pandas.Series.to_csv "pandas.Series.to_csv") now accepts a `compression` argument that works in the same way as the `compression` argument in [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") ([GH 18958](https://github.com/pandas-dev/pandas/issues/18958)) +* Set operations (union, difference…) on [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") with incompatible index types will now raise a `TypeError` rather than a `ValueError` ([GH 19329](https://github.com/pandas-dev/pandas/issues/19329)) +* `DateOffset` objects render more simply, e.g. `` instead of `` ([GH 19403](https://github.com/pandas-dev/pandas/issues/19403)) +* `Categorical.fillna` now validates its `value` and `method` keyword arguments. It now raises when both or none are specified, matching the behavior of [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") ([GH 19682](https://github.com/pandas-dev/pandas/issues/19682)) +* `pd.to_datetime('today')` now returns a datetime, consistent with `pd.Timestamp('today')`; previously `pd.to_datetime('today')` returned a `.normalized()` datetime ([GH 19935](https://github.com/pandas-dev/pandas/issues/19935)) +* [`Series.str.replace()`](../reference/api/pandas.Series.str.replace.html#pandas.Series.str.replace "pandas.Series.str.replace") now takes an optional `regex` keyword which, when set to `False`, uses literal string replacement rather than regex replacement ([GH 16808](https://github.com/pandas-dev/pandas/issues/16808)) +* [`DatetimeIndex.strftime()`](../reference/api/pandas.DatetimeIndex.strftime.html#pandas.DatetimeIndex.strftime "pandas.DatetimeIndex.strftime") and [`PeriodIndex.strftime()`](../reference/api/pandas.PeriodIndex.strftime.html#pandas.PeriodIndex.strftime "pandas.PeriodIndex.strftime") now return an `Index` instead of a numpy array to be consistent with similar accessors ([GH 20127](https://github.com/pandas-dev/pandas/issues/20127)) +* Constructing a Series from a list of length 1 no longer broadcasts this list when a longer index is specified ([GH 19714](https://github.com/pandas-dev/pandas/issues/19714), [GH 20391](https://github.com/pandas-dev/pandas/issues/20391)). +* [`DataFrame.to_dict()`](../reference/api/pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict") with `orient='index'` no longer casts int columns to float for a DataFrame with only int and float columns ([GH 18580](https://github.com/pandas-dev/pandas/issues/18580)) +* A user-defined-function that is passed to `Series.rolling().aggregate()`, `DataFrame.rolling().aggregate()`, or its expanding cousins, will now *always* be passed a `Series`, rather than a `np.array`; `.apply()` only has the `raw` keyword, see [here](#whatsnew-0230-enhancements-window-raw). This is consistent with the signatures of `.aggregate()` across pandas ([GH 20584](https://github.com/pandas-dev/pandas/issues/20584)) +* Rolling and Expanding types raise `NotImplementedError` upon iteration ([GH 11704](https://github.com/pandas-dev/pandas/issues/11704)). + +## Deprecations[#](#deprecations "Link to this heading") + +* `Series.from_array` and `SparseSeries.from_array` are deprecated. Use the normal constructor `Series(..)` and `SparseSeries(..)` instead ([GH 18213](https://github.com/pandas-dev/pandas/issues/18213)). +* `DataFrame.as_matrix` is deprecated. Use `DataFrame.values` instead ([GH 18458](https://github.com/pandas-dev/pandas/issues/18458)). +* `Series.asobject`, `DatetimeIndex.asobject`, `PeriodIndex.asobject` and `TimeDeltaIndex.asobject` have been deprecated. Use `.astype(object)` instead ([GH 18572](https://github.com/pandas-dev/pandas/issues/18572)) +* Grouping by a tuple of keys now emits a `FutureWarning` and is deprecated. + In the future, a tuple passed to `'by'` will always refer to a single key + that is the actual tuple, instead of treating the tuple as multiple keys. To + retain the previous behavior, use a list instead of a tuple ([GH 18314](https://github.com/pandas-dev/pandas/issues/18314)) +* `Series.valid` is deprecated. Use [`Series.dropna()`](../reference/api/pandas.Series.dropna.html#pandas.Series.dropna "pandas.Series.dropna") instead ([GH 18800](https://github.com/pandas-dev/pandas/issues/18800)). +* [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") has deprecated the `skip_footer` parameter. Use `skipfooter` instead ([GH 18836](https://github.com/pandas-dev/pandas/issues/18836)) +* [`ExcelFile.parse()`](../reference/api/pandas.ExcelFile.parse.html#pandas.ExcelFile.parse "pandas.ExcelFile.parse") has deprecated `sheetname` in favor of `sheet_name` for consistency with [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") ([GH 20920](https://github.com/pandas-dev/pandas/issues/20920)). +* The `is_copy` attribute is deprecated and will be removed in a future version ([GH 18801](https://github.com/pandas-dev/pandas/issues/18801)). +* `IntervalIndex.from_intervals` is deprecated in favor of the [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") constructor ([GH 19263](https://github.com/pandas-dev/pandas/issues/19263)) +* `DataFrame.from_items` is deprecated. Use [`DataFrame.from_dict()`](../reference/api/pandas.DataFrame.from_dict.html#pandas.DataFrame.from_dict "pandas.DataFrame.from_dict") instead, or `DataFrame.from_dict(OrderedDict())` if you wish to preserve the key order ([GH 17320](https://github.com/pandas-dev/pandas/issues/17320), [GH 17312](https://github.com/pandas-dev/pandas/issues/17312)) +* Indexing a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") or a `FloatIndex` with a list containing some missing keys will now show a [`FutureWarning`](https://docs.python.org/3/library/exceptions.html#FutureWarning "(in Python v3.13)"), which is consistent with other types of indexes ([GH 17758](https://github.com/pandas-dev/pandas/issues/17758)). +* The `broadcast` parameter of `.apply()` is deprecated in favor of `result_type='broadcast'` ([GH 18577](https://github.com/pandas-dev/pandas/issues/18577)) +* The `reduce` parameter of `.apply()` is deprecated in favor of `result_type='reduce'` ([GH 18577](https://github.com/pandas-dev/pandas/issues/18577)) +* The `order` parameter of [`factorize()`](../reference/api/pandas.factorize.html#pandas.factorize "pandas.factorize") is deprecated and will be removed in a future release ([GH 19727](https://github.com/pandas-dev/pandas/issues/19727)) +* `Timestamp.weekday_name`, `DatetimeIndex.weekday_name`, and `Series.dt.weekday_name` are deprecated in favor of [`Timestamp.day_name()`](../reference/api/pandas.Timestamp.day_name.html#pandas.Timestamp.day_name "pandas.Timestamp.day_name"), [`DatetimeIndex.day_name()`](../reference/api/pandas.DatetimeIndex.day_name.html#pandas.DatetimeIndex.day_name "pandas.DatetimeIndex.day_name"), and [`Series.dt.day_name()`](../reference/api/pandas.Series.dt.day_name.html#pandas.Series.dt.day_name "pandas.Series.dt.day_name") ([GH 12806](https://github.com/pandas-dev/pandas/issues/12806)) +* `pandas.tseries.plotting.tsplot` is deprecated. Use [`Series.plot()`](../reference/api/pandas.Series.plot.html#pandas.Series.plot "pandas.Series.plot") instead ([GH 18627](https://github.com/pandas-dev/pandas/issues/18627)) +* `Index.summary()` is deprecated and will be removed in a future version ([GH 18217](https://github.com/pandas-dev/pandas/issues/18217)) +* `NDFrame.get_ftype_counts()` is deprecated and will be removed in a future version ([GH 18243](https://github.com/pandas-dev/pandas/issues/18243)) +* The `convert_datetime64` parameter in [`DataFrame.to_records()`](../reference/api/pandas.DataFrame.to_records.html#pandas.DataFrame.to_records "pandas.DataFrame.to_records") has been deprecated and will be removed in a future version. The NumPy bug motivating this parameter has been resolved. The default value for this parameter has also changed from `True` to `None` ([GH 18160](https://github.com/pandas-dev/pandas/issues/18160)). +* `Series.rolling().apply()`, `DataFrame.rolling().apply()`, `Series.expanding().apply()`, and `DataFrame.expanding().apply()` have deprecated passing an `np.array` by default. One will need to pass the new `raw` parameter to be explicit about what is passed ([GH 20584](https://github.com/pandas-dev/pandas/issues/20584)) +* The `data`, `base`, `strides`, `flags` and `itemsize` properties + of the `Series` and `Index` classes have been deprecated and will be + removed in a future version ([GH 20419](https://github.com/pandas-dev/pandas/issues/20419)). +* `DatetimeIndex.offset` is deprecated. Use `DatetimeIndex.freq` instead ([GH 20716](https://github.com/pandas-dev/pandas/issues/20716)) +* Floor division between an integer ndarray and a [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") is deprecated. Divide by [`Timedelta.value`](../reference/api/pandas.Timedelta.value.html#pandas.Timedelta.value "pandas.Timedelta.value") instead ([GH 19761](https://github.com/pandas-dev/pandas/issues/19761)) +* Setting `PeriodIndex.freq` (which was not guaranteed to work correctly) is deprecated. Use [`PeriodIndex.asfreq()`](../reference/api/pandas.PeriodIndex.asfreq.html#pandas.PeriodIndex.asfreq "pandas.PeriodIndex.asfreq") instead ([GH 20678](https://github.com/pandas-dev/pandas/issues/20678)) +* `Index.get_duplicates()` is deprecated and will be removed in a future version ([GH 20239](https://github.com/pandas-dev/pandas/issues/20239)) +* The previous default behavior of negative indices in `Categorical.take` is deprecated. In a future version it will change from meaning missing values to meaning positional indices from the right. The future behavior is consistent with [`Series.take()`](../reference/api/pandas.Series.take.html#pandas.Series.take "pandas.Series.take") ([GH 20664](https://github.com/pandas-dev/pandas/issues/20664)). +* Passing multiple axes to the `axis` parameter in [`DataFrame.dropna()`](../reference/api/pandas.DataFrame.dropna.html#pandas.DataFrame.dropna "pandas.DataFrame.dropna") has been deprecated and will be removed in a future version ([GH 20987](https://github.com/pandas-dev/pandas/issues/20987)) + +## Removal of prior version deprecations/changes[#](#removal-of-prior-version-deprecations-changes "Link to this heading") + +* Warnings against the obsolete usage `Categorical(codes, categories)`, which were emitted for instance when the first two arguments to `Categorical()` had different dtypes, and recommended the use of `Categorical.from_codes`, have now been removed ([GH 8074](https://github.com/pandas-dev/pandas/issues/8074)) +* The `levels` and `labels` attributes of a `MultiIndex` can no longer be set directly ([GH 4039](https://github.com/pandas-dev/pandas/issues/4039)). +* `pd.tseries.util.pivot_annual` has been removed (deprecated since v0.19). Use `pivot_table` instead ([GH 18370](https://github.com/pandas-dev/pandas/issues/18370)) +* `pd.tseries.util.isleapyear` has been removed (deprecated since v0.19). Use `.is_leap_year` property in Datetime-likes instead ([GH 18370](https://github.com/pandas-dev/pandas/issues/18370)) +* `pd.ordered_merge` has been removed (deprecated since v0.19). Use `pd.merge_ordered` instead ([GH 18459](https://github.com/pandas-dev/pandas/issues/18459)) +* The `SparseList` class has been removed ([GH 14007](https://github.com/pandas-dev/pandas/issues/14007)) +* The `pandas.io.wb` and `pandas.io.data` stub modules have been removed ([GH 13735](https://github.com/pandas-dev/pandas/issues/13735)) +* `Categorical.from_array` has been removed ([GH 13854](https://github.com/pandas-dev/pandas/issues/13854)) +* The `freq` and `how` parameters have been removed from the `rolling`/`expanding`/`ewm` methods of DataFrame + and Series (deprecated since v0.18). Instead, resample before calling the methods. ([GH 18601](https://github.com/pandas-dev/pandas/issues/18601) & [GH 18668](https://github.com/pandas-dev/pandas/issues/18668)) +* `DatetimeIndex.to_datetime`, `Timestamp.to_datetime`, `PeriodIndex.to_datetime`, and `Index.to_datetime` have been removed ([GH 8254](https://github.com/pandas-dev/pandas/issues/8254), [GH 14096](https://github.com/pandas-dev/pandas/issues/14096), [GH 14113](https://github.com/pandas-dev/pandas/issues/14113)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") has dropped the `skip_footer` parameter ([GH 13386](https://github.com/pandas-dev/pandas/issues/13386)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") has dropped the `as_recarray` parameter ([GH 13373](https://github.com/pandas-dev/pandas/issues/13373)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") has dropped the `buffer_lines` parameter ([GH 13360](https://github.com/pandas-dev/pandas/issues/13360)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") has dropped the `compact_ints` and `use_unsigned` parameters ([GH 13323](https://github.com/pandas-dev/pandas/issues/13323)) +* The `Timestamp` class has dropped the `offset` attribute in favor of `freq` ([GH 13593](https://github.com/pandas-dev/pandas/issues/13593)) +* The `Series`, `Categorical`, and `Index` classes have dropped the `reshape` method ([GH 13012](https://github.com/pandas-dev/pandas/issues/13012)) +* `pandas.tseries.frequencies.get_standard_freq` has been removed in favor of `pandas.tseries.frequencies.to_offset(freq).rule_code` ([GH 13874](https://github.com/pandas-dev/pandas/issues/13874)) +* The `freqstr` keyword has been removed from `pandas.tseries.frequencies.to_offset` in favor of `freq` ([GH 13874](https://github.com/pandas-dev/pandas/issues/13874)) +* The `Panel4D` and `PanelND` classes have been removed ([GH 13776](https://github.com/pandas-dev/pandas/issues/13776)) +* The `Panel` class has dropped the `to_long` and `toLong` methods ([GH 19077](https://github.com/pandas-dev/pandas/issues/19077)) +* The options `display.line_with` and `display.height` are removed in favor of `display.width` and `display.max_rows` respectively ([GH 4391](https://github.com/pandas-dev/pandas/issues/4391), [GH 19107](https://github.com/pandas-dev/pandas/issues/19107)) +* The `labels` attribute of the `Categorical` class has been removed in favor of [`Categorical.codes`](../reference/api/pandas.Categorical.codes.html#pandas.Categorical.codes "pandas.Categorical.codes") ([GH 7768](https://github.com/pandas-dev/pandas/issues/7768)) +* The `flavor` parameter have been removed from `to_sql()` method ([GH 13611](https://github.com/pandas-dev/pandas/issues/13611)) +* The modules `pandas.tools.hashing` and `pandas.util.hashing` have been removed ([GH 16223](https://github.com/pandas-dev/pandas/issues/16223)) +* The top-level functions `pd.rolling_*`, `pd.expanding_*` and `pd.ewm*` have been removed (Deprecated since v0.18). + Instead, use the DataFrame/Series methods [`rolling`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling"), [`expanding`](../reference/api/pandas.DataFrame.expanding.html#pandas.DataFrame.expanding "pandas.DataFrame.expanding") and [`ewm`](../reference/api/pandas.DataFrame.ewm.html#pandas.DataFrame.ewm "pandas.DataFrame.ewm") ([GH 18723](https://github.com/pandas-dev/pandas/issues/18723)) +* Imports from `pandas.core.common` for functions such as `is_datetime64_dtype` are now removed. These are located in `pandas.api.types`. ([GH 13634](https://github.com/pandas-dev/pandas/issues/13634), [GH 19769](https://github.com/pandas-dev/pandas/issues/19769)) +* The `infer_dst` keyword in [`Series.tz_localize()`](../reference/api/pandas.Series.tz_localize.html#pandas.Series.tz_localize "pandas.Series.tz_localize"), [`DatetimeIndex.tz_localize()`](../reference/api/pandas.DatetimeIndex.tz_localize.html#pandas.DatetimeIndex.tz_localize "pandas.DatetimeIndex.tz_localize") + and [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") have been removed. `infer_dst=True` is equivalent to + `ambiguous='infer'`, and `infer_dst=False` to `ambiguous='raise'` ([GH 7963](https://github.com/pandas-dev/pandas/issues/7963)). +* When `.resample()` was changed from an eager to a lazy operation, like `.groupby()` in v0.18.0, we put in place compatibility (with a `FutureWarning`), + so operations would continue to work. This is now fully removed, so a `Resampler` will no longer forward compat operations ([GH 20554](https://github.com/pandas-dev/pandas/issues/20554)) +* Remove long deprecated `axis=None` parameter from `.replace()` ([GH 20271](https://github.com/pandas-dev/pandas/issues/20271)) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Indexers on `Series` or `DataFrame` no longer create a reference cycle ([GH 17956](https://github.com/pandas-dev/pandas/issues/17956)) +* Added a keyword argument, `cache`, to [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") that improved the performance of converting duplicate datetime arguments ([GH 11665](https://github.com/pandas-dev/pandas/issues/11665)) +* `DateOffset` arithmetic performance is improved ([GH 18218](https://github.com/pandas-dev/pandas/issues/18218)) +* Converting a `Series` of `Timedelta` objects to days, seconds, etc… sped up through vectorization of underlying methods ([GH 18092](https://github.com/pandas-dev/pandas/issues/18092)) +* Improved performance of `.map()` with a `Series/dict` input ([GH 15081](https://github.com/pandas-dev/pandas/issues/15081)) +* The overridden `Timedelta` properties of days, seconds and microseconds have been removed, leveraging their built-in Python versions instead ([GH 18242](https://github.com/pandas-dev/pandas/issues/18242)) +* `Series` construction will reduce the number of copies made of the input data in certain cases ([GH 17449](https://github.com/pandas-dev/pandas/issues/17449)) +* Improved performance of [`Series.dt.date()`](../reference/api/pandas.Series.dt.date.html#pandas.Series.dt.date "pandas.Series.dt.date") and [`DatetimeIndex.date()`](../reference/api/pandas.DatetimeIndex.date.html#pandas.DatetimeIndex.date "pandas.DatetimeIndex.date") ([GH 18058](https://github.com/pandas-dev/pandas/issues/18058)) +* Improved performance of [`Series.dt.time()`](../reference/api/pandas.Series.dt.time.html#pandas.Series.dt.time "pandas.Series.dt.time") and [`DatetimeIndex.time()`](../reference/api/pandas.DatetimeIndex.time.html#pandas.DatetimeIndex.time "pandas.DatetimeIndex.time") ([GH 18461](https://github.com/pandas-dev/pandas/issues/18461)) +* Improved performance of `IntervalIndex.symmetric_difference()` ([GH 18475](https://github.com/pandas-dev/pandas/issues/18475)) +* Improved performance of `DatetimeIndex` and `Series` arithmetic operations with Business-Month and Business-Quarter frequencies ([GH 18489](https://github.com/pandas-dev/pandas/issues/18489)) +* [`Series()`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") / [`DataFrame()`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") tab completion limits to 100 values, for better performance. ([GH 18587](https://github.com/pandas-dev/pandas/issues/18587)) +* Improved performance of [`DataFrame.median()`](../reference/api/pandas.DataFrame.median.html#pandas.DataFrame.median "pandas.DataFrame.median") with `axis=1` when bottleneck is not installed ([GH 16468](https://github.com/pandas-dev/pandas/issues/16468)) +* Improved performance of [`MultiIndex.get_loc()`](../reference/api/pandas.MultiIndex.get_loc.html#pandas.MultiIndex.get_loc "pandas.MultiIndex.get_loc") for large indexes, at the cost of a reduction in performance for small ones ([GH 18519](https://github.com/pandas-dev/pandas/issues/18519)) +* Improved performance of [`MultiIndex.remove_unused_levels()`](../reference/api/pandas.MultiIndex.remove_unused_levels.html#pandas.MultiIndex.remove_unused_levels "pandas.MultiIndex.remove_unused_levels") when there are no unused levels, at the cost of a reduction in performance when there are ([GH 19289](https://github.com/pandas-dev/pandas/issues/19289)) +* Improved performance of [`Index.get_loc()`](../reference/api/pandas.Index.get_loc.html#pandas.Index.get_loc "pandas.Index.get_loc") for non-unique indexes ([GH 19478](https://github.com/pandas-dev/pandas/issues/19478)) +* Improved performance of pairwise `.rolling()` and `.expanding()` with `.cov()` and `.corr()` operations ([GH 17917](https://github.com/pandas-dev/pandas/issues/17917)) +* Improved performance of `GroupBy.rank()` ([GH 15779](https://github.com/pandas-dev/pandas/issues/15779)) +* Improved performance of variable `.rolling()` on `.min()` and `.max()` ([GH 19521](https://github.com/pandas-dev/pandas/issues/19521)) +* Improved performance of `GroupBy.ffill()` and `GroupBy.bfill()` ([GH 11296](https://github.com/pandas-dev/pandas/issues/11296)) +* Improved performance of `GroupBy.any()` and `GroupBy.all()` ([GH 15435](https://github.com/pandas-dev/pandas/issues/15435)) +* Improved performance of `GroupBy.pct_change()` ([GH 19165](https://github.com/pandas-dev/pandas/issues/19165)) +* Improved performance of [`Series.isin()`](../reference/api/pandas.Series.isin.html#pandas.Series.isin "pandas.Series.isin") in the case of categorical dtypes ([GH 20003](https://github.com/pandas-dev/pandas/issues/20003)) +* Improved performance of `getattr(Series, attr)` when the Series has certain index types. This manifested in slow printing of large Series with a `DatetimeIndex` ([GH 19764](https://github.com/pandas-dev/pandas/issues/19764)) +* Fixed a performance regression for `GroupBy.nth()` and `GroupBy.last()` with some object columns ([GH 19283](https://github.com/pandas-dev/pandas/issues/19283)) +* Improved performance of `Categorical.from_codes()` ([GH 18501](https://github.com/pandas-dev/pandas/issues/18501)) + +## Documentation changes[#](#documentation-changes "Link to this heading") + +Thanks to all of the contributors who participated in the pandas Documentation +Sprint, which took place on March 10th. We had about 500 participants from over +30 locations across the world. You should notice that many of the +[API docstrings](../reference/index.html#api) have greatly improved. + +There were too many simultaneous contributions to include a release note for each +improvement, but this [GitHub search](https://github.com/pandas-dev/pandas/pulls?utf8=%E2%9C%93&q=is%3Apr+label%3ADocs+created%3A2018-03-10..2018-03-15+) should give you an idea of how many docstrings +were improved. + +Special thanks to [Marc Garcia](https://github.com/datapythonista) for organizing the sprint. For more information, +read the [NumFOCUS blogpost](https://www.numfocus.org/blog/worldwide-pandas-sprint/) recapping the sprint. + +* Changed spelling of “numpy” to “NumPy”, and “python” to “Python”. ([GH 19017](https://github.com/pandas-dev/pandas/issues/19017)) +* Consistency when introducing code samples, using either colon or period. + Rewrote some sentences for greater clarity, added more dynamic references + to functions, methods and classes. + ([GH 18941](https://github.com/pandas-dev/pandas/issues/18941), [GH 18948](https://github.com/pandas-dev/pandas/issues/18948), [GH 18973](https://github.com/pandas-dev/pandas/issues/18973), [GH 19017](https://github.com/pandas-dev/pandas/issues/19017)) +* Added a reference to [`DataFrame.assign()`](../reference/api/pandas.DataFrame.assign.html#pandas.DataFrame.assign "pandas.DataFrame.assign") in the concatenate section of the merging documentation ([GH 18665](https://github.com/pandas-dev/pandas/issues/18665)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +### Categorical[#](#categorical "Link to this heading") + +Warning + +A class of bugs were introduced in pandas 0.21 with `CategoricalDtype` that +affects the correctness of operations like `merge`, `concat`, and +indexing when comparing multiple unordered `Categorical` arrays that have +the same categories, but in a different order. We highly recommend upgrading +or manually aligning your categories before doing these operations. + +* Bug in `Categorical.equals` returning the wrong result when comparing two + unordered `Categorical` arrays with the same categories, but in a different + order ([GH 16603](https://github.com/pandas-dev/pandas/issues/16603)) +* Bug in [`pandas.api.types.union_categoricals()`](../reference/api/pandas.api.types.union_categoricals.html#pandas.api.types.union_categoricals "pandas.api.types.union_categoricals") returning the wrong result + when for unordered categoricals with the categories in a different order. + This affected [`pandas.concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") with Categorical data ([GH 19096](https://github.com/pandas-dev/pandas/issues/19096)). +* Bug in [`pandas.merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") returning the wrong result when joining on an + unordered `Categorical` that had the same categories but in a different + order ([GH 19551](https://github.com/pandas-dev/pandas/issues/19551)) +* Bug in `CategoricalIndex.get_indexer()` returning the wrong result when + `target` was an unordered `Categorical` that had the same categories as + `self` but in a different order ([GH 19551](https://github.com/pandas-dev/pandas/issues/19551)) +* Bug in [`Index.astype()`](../reference/api/pandas.Index.astype.html#pandas.Index.astype "pandas.Index.astype") with a categorical dtype where the resultant index is not converted to a [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") for all types of index ([GH 18630](https://github.com/pandas-dev/pandas/issues/18630)) +* Bug in [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") and `Categorical.astype()` where an existing categorical data does not get updated ([GH 10696](https://github.com/pandas-dev/pandas/issues/10696), [GH 18593](https://github.com/pandas-dev/pandas/issues/18593)) +* Bug in [`Series.str.split()`](../reference/api/pandas.Series.str.split.html#pandas.Series.str.split "pandas.Series.str.split") with `expand=True` incorrectly raising an IndexError on empty strings ([GH 20002](https://github.com/pandas-dev/pandas/issues/20002)). +* Bug in [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") constructor with `dtype=CategoricalDtype(...)` where `categories` and `ordered` are not maintained ([GH 19032](https://github.com/pandas-dev/pandas/issues/19032)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructor with scalar and `dtype=CategoricalDtype(...)` where `categories` and `ordered` are not maintained ([GH 19565](https://github.com/pandas-dev/pandas/issues/19565)) +* Bug in `Categorical.__iter__` not converting to Python types ([GH 19909](https://github.com/pandas-dev/pandas/issues/19909)) +* Bug in [`pandas.factorize()`](../reference/api/pandas.factorize.html#pandas.factorize "pandas.factorize") returning the unique codes for the `uniques`. This now returns a `Categorical` with the same dtype as the input ([GH 19721](https://github.com/pandas-dev/pandas/issues/19721)) +* Bug in [`pandas.factorize()`](../reference/api/pandas.factorize.html#pandas.factorize "pandas.factorize") including an item for missing values in the `uniques` return value ([GH 19721](https://github.com/pandas-dev/pandas/issues/19721)) +* Bug in [`Series.take()`](../reference/api/pandas.Series.take.html#pandas.Series.take "pandas.Series.take") with categorical data interpreting `-1` in `indices` as missing value markers, rather than the last element of the Series ([GH 20664](https://github.com/pandas-dev/pandas/issues/20664)) + +### Datetimelike[#](#datetimelike "Link to this heading") + +* Bug in `Series.__sub__()` subtracting a non-nanosecond `np.datetime64` object from a `Series` gave incorrect results ([GH 7996](https://github.com/pandas-dev/pandas/issues/7996)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex"), [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") addition and subtraction of zero-dimensional integer arrays gave incorrect results ([GH 19012](https://github.com/pandas-dev/pandas/issues/19012)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") and [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") where adding or subtracting an array-like of `DateOffset` objects either raised (`np.array`, `pd.Index`) or broadcast incorrectly (`pd.Series`) ([GH 18849](https://github.com/pandas-dev/pandas/issues/18849)) +* Bug in `Series.__add__()` adding Series with dtype `timedelta64[ns]` to a timezone-aware `DatetimeIndex` incorrectly dropped timezone information ([GH 13905](https://github.com/pandas-dev/pandas/issues/13905)) +* Adding a `Period` object to a `datetime` or `Timestamp` object will now correctly raise a `TypeError` ([GH 17983](https://github.com/pandas-dev/pandas/issues/17983)) +* Bug in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") where comparison with an array of `Timestamp` objects would result in a `RecursionError` ([GH 15183](https://github.com/pandas-dev/pandas/issues/15183)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") floor-division where operating on a scalar `timedelta` raises an exception ([GH 18846](https://github.com/pandas-dev/pandas/issues/18846)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") where the repr was not showing high-precision time values at the end of a day (e.g., 23:59:59.999999999) ([GH 19030](https://github.com/pandas-dev/pandas/issues/19030)) +* Bug in `.astype()` to non-ns timedelta units would hold the incorrect dtype ([GH 19176](https://github.com/pandas-dev/pandas/issues/19176), [GH 19223](https://github.com/pandas-dev/pandas/issues/19223), [GH 12425](https://github.com/pandas-dev/pandas/issues/12425)) +* Bug in subtracting [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") from `NaT` incorrectly returning `NaT` ([GH 19158](https://github.com/pandas-dev/pandas/issues/19158)) +* Bug in [`Series.truncate()`](../reference/api/pandas.Series.truncate.html#pandas.Series.truncate "pandas.Series.truncate") which raises `TypeError` with a monotonic `PeriodIndex` ([GH 17717](https://github.com/pandas-dev/pandas/issues/17717)) +* Bug in [`pct_change()`](../reference/api/pandas.DataFrame.pct_change.html#pandas.DataFrame.pct_change "pandas.DataFrame.pct_change") using `periods` and `freq` returned different length outputs ([GH 7292](https://github.com/pandas-dev/pandas/issues/7292)) +* Bug in comparison of [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") against `None` or `datetime.date` objects raising `TypeError` for `==` and `!=` comparisons instead of all-`False` and all-`True`, respectively ([GH 19301](https://github.com/pandas-dev/pandas/issues/19301)) +* Bug in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") and [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") where a string representing a barely out-of-bounds timestamp would be incorrectly rounded down instead of raising `OutOfBoundsDatetime` ([GH 19382](https://github.com/pandas-dev/pandas/issues/19382)) +* Bug in [`Timestamp.floor()`](../reference/api/pandas.Timestamp.floor.html#pandas.Timestamp.floor "pandas.Timestamp.floor") [`DatetimeIndex.floor()`](../reference/api/pandas.DatetimeIndex.floor.html#pandas.DatetimeIndex.floor "pandas.DatetimeIndex.floor") where time stamps far in the future and past were not rounded correctly ([GH 19206](https://github.com/pandas-dev/pandas/issues/19206)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") where passing an out-of-bounds datetime with `errors='coerce'` and `utc=True` would raise `OutOfBoundsDatetime` instead of parsing to `NaT` ([GH 19612](https://github.com/pandas-dev/pandas/issues/19612)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") and [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") addition and subtraction where name of the returned object was not always set consistently. ([GH 19744](https://github.com/pandas-dev/pandas/issues/19744)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") and [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") addition and subtraction where operations with numpy arrays raised `TypeError` ([GH 19847](https://github.com/pandas-dev/pandas/issues/19847)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") and [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") where setting the `freq` attribute was not fully supported ([GH 20678](https://github.com/pandas-dev/pandas/issues/20678)) + +### Timedelta[#](#timedelta "Link to this heading") + +* Bug in `Timedelta.__mul__()` where multiplying by `NaT` returned `NaT` instead of raising a `TypeError` ([GH 19819](https://github.com/pandas-dev/pandas/issues/19819)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `dtype='timedelta64[ns]'` where addition or subtraction of `TimedeltaIndex` had results cast to `dtype='int64'` ([GH 17250](https://github.com/pandas-dev/pandas/issues/17250)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `dtype='timedelta64[ns]'` where addition or subtraction of `TimedeltaIndex` could return a `Series` with an incorrect name ([GH 19043](https://github.com/pandas-dev/pandas/issues/19043)) +* Bug in `Timedelta.__floordiv__()` and `Timedelta.__rfloordiv__()` dividing by many incompatible numpy objects was incorrectly allowed ([GH 18846](https://github.com/pandas-dev/pandas/issues/18846)) +* Bug where dividing a scalar timedelta-like object with [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") performed the reciprocal operation ([GH 19125](https://github.com/pandas-dev/pandas/issues/19125)) +* Bug in [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") where division by a `Series` would return a `TimedeltaIndex` instead of a `Series` ([GH 19042](https://github.com/pandas-dev/pandas/issues/19042)) +* Bug in `Timedelta.__add__()`, `Timedelta.__sub__()` where adding or subtracting a `np.timedelta64` object would return another `np.timedelta64` instead of a `Timedelta` ([GH 19738](https://github.com/pandas-dev/pandas/issues/19738)) +* Bug in `Timedelta.__floordiv__()`, `Timedelta.__rfloordiv__()` where operating with a `Tick` object would raise a `TypeError` instead of returning a numeric value ([GH 19738](https://github.com/pandas-dev/pandas/issues/19738)) +* Bug in [`Period.asfreq()`](../reference/api/pandas.Period.asfreq.html#pandas.Period.asfreq "pandas.Period.asfreq") where periods near `datetime(1, 1, 1)` could be converted incorrectly ([GH 19643](https://github.com/pandas-dev/pandas/issues/19643), [GH 19834](https://github.com/pandas-dev/pandas/issues/19834)) +* Bug in [`Timedelta.total_seconds()`](../reference/api/pandas.Timedelta.total_seconds.html#pandas.Timedelta.total_seconds "pandas.Timedelta.total_seconds") causing precision errors, for example `Timedelta('30S').total_seconds()==30.000000000000004` ([GH 19458](https://github.com/pandas-dev/pandas/issues/19458)) +* Bug in `Timedelta.__rmod__()` where operating with a `numpy.timedelta64` returned a `timedelta64` object instead of a `Timedelta` ([GH 19820](https://github.com/pandas-dev/pandas/issues/19820)) +* Multiplication of [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") by `TimedeltaIndex` will now raise `TypeError` instead of raising `ValueError` in cases of length mismatch ([GH 19333](https://github.com/pandas-dev/pandas/issues/19333)) +* Bug in indexing a [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") with a `np.timedelta64` object which was raising a `TypeError` ([GH 20393](https://github.com/pandas-dev/pandas/issues/20393)) + +### Timezones[#](#timezones "Link to this heading") + +* Bug in creating a `Series` from an array that contains both tz-naive and tz-aware values will result in a `Series` whose dtype is tz-aware instead of object ([GH 16406](https://github.com/pandas-dev/pandas/issues/16406)) +* Bug in comparison of timezone-aware [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") against `NaT` incorrectly raising `TypeError` ([GH 19276](https://github.com/pandas-dev/pandas/issues/19276)) +* Bug in `DatetimeIndex.astype()` when converting between timezone aware dtypes, and converting from timezone aware to naive ([GH 18951](https://github.com/pandas-dev/pandas/issues/18951)) +* Bug in comparing [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex"), which failed to raise `TypeError` when attempting to compare timezone-aware and timezone-naive datetimelike objects ([GH 18162](https://github.com/pandas-dev/pandas/issues/18162)) +* Bug in localization of a naive, datetime string in a `Series` constructor with a `datetime64[ns, tz]` dtype ([GH 174151](https://github.com/pandas-dev/pandas/issues/174151)) +* [`Timestamp.replace()`](../reference/api/pandas.Timestamp.replace.html#pandas.Timestamp.replace "pandas.Timestamp.replace") will now handle Daylight Savings transitions gracefully ([GH 18319](https://github.com/pandas-dev/pandas/issues/18319)) +* Bug in tz-aware [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") where addition/subtraction with a [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") or array with `dtype='timedelta64[ns]'` was incorrect ([GH 17558](https://github.com/pandas-dev/pandas/issues/17558)) +* Bug in `DatetimeIndex.insert()` where inserting `NaT` into a timezone-aware index incorrectly raised ([GH 16357](https://github.com/pandas-dev/pandas/issues/16357)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor, where tz-aware Datetimeindex and a given column name will result in an empty `DataFrame` ([GH 19157](https://github.com/pandas-dev/pandas/issues/19157)) +* Bug in [`Timestamp.tz_localize()`](../reference/api/pandas.Timestamp.tz_localize.html#pandas.Timestamp.tz_localize "pandas.Timestamp.tz_localize") where localizing a timestamp near the minimum or maximum valid values could overflow and return a timestamp with an incorrect nanosecond value ([GH 12677](https://github.com/pandas-dev/pandas/issues/12677)) +* Bug when iterating over [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") that was localized with fixed timezone offset that rounded nanosecond precision to microseconds ([GH 19603](https://github.com/pandas-dev/pandas/issues/19603)) +* Bug in [`DataFrame.diff()`](../reference/api/pandas.DataFrame.diff.html#pandas.DataFrame.diff "pandas.DataFrame.diff") that raised an `IndexError` with tz-aware values ([GH 18578](https://github.com/pandas-dev/pandas/issues/18578)) +* Bug in [`melt()`](../reference/api/pandas.melt.html#pandas.melt "pandas.melt") that converted tz-aware dtypes to tz-naive ([GH 15785](https://github.com/pandas-dev/pandas/issues/15785)) +* Bug in `Dataframe.count()` that raised an `ValueError`, if `Dataframe.dropna()` was called for a single column with timezone-aware values. ([GH 13407](https://github.com/pandas-dev/pandas/issues/13407)) + +### Offsets[#](#offsets "Link to this heading") + +* Bug in `WeekOfMonth` and `Week` where addition and subtraction did not roll correctly ([GH 18510](https://github.com/pandas-dev/pandas/issues/18510), [GH 18672](https://github.com/pandas-dev/pandas/issues/18672), [GH 18864](https://github.com/pandas-dev/pandas/issues/18864)) +* Bug in `WeekOfMonth` and `LastWeekOfMonth` where default keyword arguments for constructor raised `ValueError` ([GH 19142](https://github.com/pandas-dev/pandas/issues/19142)) +* Bug in `FY5253Quarter`, `LastWeekOfMonth` where rollback and rollforward behavior was inconsistent with addition and subtraction behavior ([GH 18854](https://github.com/pandas-dev/pandas/issues/18854)) +* Bug in `FY5253` where `datetime` addition and subtraction incremented incorrectly for dates on the year-end but not normalized to midnight ([GH 18854](https://github.com/pandas-dev/pandas/issues/18854)) +* Bug in `FY5253` where date offsets could incorrectly raise an `AssertionError` in arithmetic operations ([GH 14774](https://github.com/pandas-dev/pandas/issues/14774)) + +### Numeric[#](#numeric "Link to this heading") + +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructor with an int or float list where specifying `dtype=str`, `dtype='str'` or `dtype='U'` failed to convert the data elements to strings ([GH 16605](https://github.com/pandas-dev/pandas/issues/16605)) +* Bug in [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") multiplication and division methods where operating with a `Series` would return an `Index` object instead of a `Series` object ([GH 19042](https://github.com/pandas-dev/pandas/issues/19042)) +* Bug in the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor in which data containing very large positive or very large negative numbers was causing `OverflowError` ([GH 18584](https://github.com/pandas-dev/pandas/issues/18584)) +* Bug in [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") constructor with `dtype='uint64'` where int-like floats were not coerced to `UInt64Index` ([GH 18400](https://github.com/pandas-dev/pandas/issues/18400)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") flex arithmetic (e.g. `df.add(other, fill_value=foo)`) with a `fill_value` other than `None` failed to raise `NotImplementedError` in corner cases where either the frame or `other` has length zero ([GH 19522](https://github.com/pandas-dev/pandas/issues/19522)) +* Multiplication and division of numeric-dtyped [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") objects with timedelta-like scalars returns `TimedeltaIndex` instead of raising `TypeError` ([GH 19333](https://github.com/pandas-dev/pandas/issues/19333)) +* Bug where `NaN` was returned instead of 0 by [`Series.pct_change()`](../reference/api/pandas.Series.pct_change.html#pandas.Series.pct_change "pandas.Series.pct_change") and [`DataFrame.pct_change()`](../reference/api/pandas.DataFrame.pct_change.html#pandas.DataFrame.pct_change "pandas.DataFrame.pct_change") when `fill_method` is not `None` ([GH 19873](https://github.com/pandas-dev/pandas/issues/19873)) + +### Strings[#](#strings "Link to this heading") + +* Bug in [`Series.str.get()`](../reference/api/pandas.Series.str.get.html#pandas.Series.str.get "pandas.Series.str.get") with a dictionary in the values and the index not in the keys, raising `KeyError` ([GH 20671](https://github.com/pandas-dev/pandas/issues/20671)) + +### Indexing[#](#indexing "Link to this heading") + +* Bug in [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") construction from list of mixed type tuples ([GH 18505](https://github.com/pandas-dev/pandas/issues/18505)) +* Bug in [`Index.drop()`](../reference/api/pandas.Index.drop.html#pandas.Index.drop "pandas.Index.drop") when passing a list of both tuples and non-tuples ([GH 18304](https://github.com/pandas-dev/pandas/issues/18304)) +* Bug in [`DataFrame.drop()`](../reference/api/pandas.DataFrame.drop.html#pandas.DataFrame.drop "pandas.DataFrame.drop"), `Panel.drop()`, [`Series.drop()`](../reference/api/pandas.Series.drop.html#pandas.Series.drop "pandas.Series.drop"), [`Index.drop()`](../reference/api/pandas.Index.drop.html#pandas.Index.drop "pandas.Index.drop") where no `KeyError` is raised when dropping a non-existent element from an axis that contains duplicates ([GH 19186](https://github.com/pandas-dev/pandas/issues/19186)) +* Bug in indexing a datetimelike `Index` that raised `ValueError` instead of `IndexError` ([GH 18386](https://github.com/pandas-dev/pandas/issues/18386)). +* [`Index.to_series()`](../reference/api/pandas.Index.to_series.html#pandas.Index.to_series "pandas.Index.to_series") now accepts `index` and `name` kwargs ([GH 18699](https://github.com/pandas-dev/pandas/issues/18699)) +* [`DatetimeIndex.to_series()`](../reference/api/pandas.DatetimeIndex.to_series.html#pandas.DatetimeIndex.to_series "pandas.DatetimeIndex.to_series") now accepts `index` and `name` kwargs ([GH 18699](https://github.com/pandas-dev/pandas/issues/18699)) +* Bug in indexing non-scalar value from `Series` having non-unique `Index` will return value flattened ([GH 17610](https://github.com/pandas-dev/pandas/issues/17610)) +* Bug in indexing with iterator containing only missing keys, which raised no error ([GH 20748](https://github.com/pandas-dev/pandas/issues/20748)) +* Fixed inconsistency in `.ix` between list and scalar keys when the index has integer dtype and does not include the desired keys ([GH 20753](https://github.com/pandas-dev/pandas/issues/20753)) +* Bug in `__setitem__` when indexing a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a 2-d boolean ndarray ([GH 18582](https://github.com/pandas-dev/pandas/issues/18582)) +* Bug in `str.extractall` when there were no matches empty [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") was returned instead of appropriate [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 19034](https://github.com/pandas-dev/pandas/issues/19034)) +* Bug in [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") where empty and purely NA data was constructed inconsistently depending on the construction method ([GH 18421](https://github.com/pandas-dev/pandas/issues/18421)) +* Bug in `IntervalIndex.symmetric_difference()` where the symmetric difference with a non-`IntervalIndex` did not raise ([GH 18475](https://github.com/pandas-dev/pandas/issues/18475)) +* Bug in [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") where set operations that returned an empty `IntervalIndex` had the wrong dtype ([GH 19101](https://github.com/pandas-dev/pandas/issues/19101)) +* Bug in [`DataFrame.drop_duplicates()`](../reference/api/pandas.DataFrame.drop_duplicates.html#pandas.DataFrame.drop_duplicates "pandas.DataFrame.drop_duplicates") where no `KeyError` is raised when passing in columns that don’t exist on the `DataFrame` ([GH 19726](https://github.com/pandas-dev/pandas/issues/19726)) +* Bug in `Index` subclasses constructors that ignore unexpected keyword arguments ([GH 19348](https://github.com/pandas-dev/pandas/issues/19348)) +* Bug in [`Index.difference()`](../reference/api/pandas.Index.difference.html#pandas.Index.difference "pandas.Index.difference") when taking difference of an `Index` with itself ([GH 20040](https://github.com/pandas-dev/pandas/issues/20040)) +* Bug in [`DataFrame.first_valid_index()`](../reference/api/pandas.DataFrame.first_valid_index.html#pandas.DataFrame.first_valid_index "pandas.DataFrame.first_valid_index") and [`DataFrame.last_valid_index()`](../reference/api/pandas.DataFrame.last_valid_index.html#pandas.DataFrame.last_valid_index "pandas.DataFrame.last_valid_index") in presence of entire rows of NaNs in the middle of values ([GH 20499](https://github.com/pandas-dev/pandas/issues/20499)). +* Bug in [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") where some indexing operations were not supported for overlapping or non-monotonic `uint64` data ([GH 20636](https://github.com/pandas-dev/pandas/issues/20636)) +* Bug in `Series.is_unique` where extraneous output in stderr is shown if Series contains objects with `__ne__` defined ([GH 20661](https://github.com/pandas-dev/pandas/issues/20661)) +* Bug in `.loc` assignment with a single-element list-like incorrectly assigns as a list ([GH 19474](https://github.com/pandas-dev/pandas/issues/19474)) +* Bug in partial string indexing on a `Series/DataFrame` with a monotonic decreasing `DatetimeIndex` ([GH 19362](https://github.com/pandas-dev/pandas/issues/19362)) +* Bug in performing in-place operations on a `DataFrame` with a duplicate `Index` ([GH 17105](https://github.com/pandas-dev/pandas/issues/17105)) +* Bug in [`IntervalIndex.get_loc()`](../reference/api/pandas.IntervalIndex.get_loc.html#pandas.IntervalIndex.get_loc "pandas.IntervalIndex.get_loc") and [`IntervalIndex.get_indexer()`](../reference/api/pandas.IntervalIndex.get_indexer.html#pandas.IntervalIndex.get_indexer "pandas.IntervalIndex.get_indexer") when used with an [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") containing a single interval ([GH 17284](https://github.com/pandas-dev/pandas/issues/17284), [GH 20921](https://github.com/pandas-dev/pandas/issues/20921)) +* Bug in `.loc` with a `uint64` indexer ([GH 20722](https://github.com/pandas-dev/pandas/issues/20722)) + +### MultiIndex[#](#multiindex "Link to this heading") + +* Bug in `MultiIndex.__contains__()` where non-tuple keys would return `True` even if they had been dropped ([GH 19027](https://github.com/pandas-dev/pandas/issues/19027)) +* Bug in `MultiIndex.set_labels()` which would cause casting (and potentially clipping) of the new labels if the `level` argument is not 0 or a list like [0, 1, … ] ([GH 19057](https://github.com/pandas-dev/pandas/issues/19057)) +* Bug in [`MultiIndex.get_level_values()`](../reference/api/pandas.MultiIndex.get_level_values.html#pandas.MultiIndex.get_level_values "pandas.MultiIndex.get_level_values") which would return an invalid index on level of ints with missing values ([GH 17924](https://github.com/pandas-dev/pandas/issues/17924)) +* Bug in `MultiIndex.unique()` when called on empty [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 20568](https://github.com/pandas-dev/pandas/issues/20568)) +* Bug in `MultiIndex.unique()` which would not preserve level names ([GH 20570](https://github.com/pandas-dev/pandas/issues/20570)) +* Bug in [`MultiIndex.remove_unused_levels()`](../reference/api/pandas.MultiIndex.remove_unused_levels.html#pandas.MultiIndex.remove_unused_levels "pandas.MultiIndex.remove_unused_levels") which would fill nan values ([GH 18417](https://github.com/pandas-dev/pandas/issues/18417)) +* Bug in [`MultiIndex.from_tuples()`](../reference/api/pandas.MultiIndex.from_tuples.html#pandas.MultiIndex.from_tuples "pandas.MultiIndex.from_tuples") which would fail to take zipped tuples in python3 ([GH 18434](https://github.com/pandas-dev/pandas/issues/18434)) +* Bug in [`MultiIndex.get_loc()`](../reference/api/pandas.MultiIndex.get_loc.html#pandas.MultiIndex.get_loc "pandas.MultiIndex.get_loc") which would fail to automatically cast values between float and int ([GH 18818](https://github.com/pandas-dev/pandas/issues/18818), [GH 15994](https://github.com/pandas-dev/pandas/issues/15994)) +* Bug in [`MultiIndex.get_loc()`](../reference/api/pandas.MultiIndex.get_loc.html#pandas.MultiIndex.get_loc "pandas.MultiIndex.get_loc") which would cast boolean to integer labels ([GH 19086](https://github.com/pandas-dev/pandas/issues/19086)) +* Bug in [`MultiIndex.get_loc()`](../reference/api/pandas.MultiIndex.get_loc.html#pandas.MultiIndex.get_loc "pandas.MultiIndex.get_loc") which would fail to locate keys containing `NaN` ([GH 18485](https://github.com/pandas-dev/pandas/issues/18485)) +* Bug in [`MultiIndex.get_loc()`](../reference/api/pandas.MultiIndex.get_loc.html#pandas.MultiIndex.get_loc "pandas.MultiIndex.get_loc") in large [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex"), would fail when levels had different dtypes ([GH 18520](https://github.com/pandas-dev/pandas/issues/18520)) +* Bug in indexing where nested indexers having only numpy arrays are handled incorrectly ([GH 19686](https://github.com/pandas-dev/pandas/issues/19686)) + +### IO[#](#io "Link to this heading") + +* [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") now rewinds seekable IO objects after parse failure, before attempting to parse with a new parser. If a parser errors and the object is non-seekable, an informative error is raised suggesting the use of a different parser ([GH 17975](https://github.com/pandas-dev/pandas/issues/17975)) +* [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") now has an option to add an id to the leading `
` tag ([GH 8496](https://github.com/pandas-dev/pandas/issues/8496)) +* Bug in `read_msgpack()` with a non existent file is passed in Python 2 ([GH 15296](https://github.com/pandas-dev/pandas/issues/15296)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") where a `MultiIndex` with duplicate columns was not being mangled appropriately ([GH 18062](https://github.com/pandas-dev/pandas/issues/18062)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") where missing values were not being handled properly when `keep_default_na=False` with dictionary `na_values` ([GH 19227](https://github.com/pandas-dev/pandas/issues/19227)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") causing heap corruption on 32-bit, big-endian architectures ([GH 20785](https://github.com/pandas-dev/pandas/issues/20785)) +* Bug in [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") where a file with 0 variables gave an `AttributeError` incorrectly. Now it gives an `EmptyDataError` ([GH 18184](https://github.com/pandas-dev/pandas/issues/18184)) +* Bug in [`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex") where pairs of braces meant to serve as invisible placeholders were escaped ([GH 18667](https://github.com/pandas-dev/pandas/issues/18667)) +* Bug in [`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex") where a `NaN` in a `MultiIndex` would cause an `IndexError` or incorrect output ([GH 14249](https://github.com/pandas-dev/pandas/issues/14249)) +* Bug in [`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex") where a non-string index-level name would result in an `AttributeError` ([GH 19981](https://github.com/pandas-dev/pandas/issues/19981)) +* Bug in [`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex") where the combination of an index name and the `index_names=False` option would result in incorrect output ([GH 18326](https://github.com/pandas-dev/pandas/issues/18326)) +* Bug in [`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex") where a `MultiIndex` with an empty string as its name would result in incorrect output ([GH 18669](https://github.com/pandas-dev/pandas/issues/18669)) +* Bug in [`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex") where missing space characters caused wrong escaping and produced non-valid latex in some cases ([GH 20859](https://github.com/pandas-dev/pandas/issues/20859)) +* Bug in [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") where large numeric values were causing an `OverflowError` ([GH 18842](https://github.com/pandas-dev/pandas/issues/18842)) +* Bug in [`DataFrame.to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") where an exception was raised if the write destination is S3 ([GH 19134](https://github.com/pandas-dev/pandas/issues/19134)) +* [`Interval`](../reference/api/pandas.Interval.html#pandas.Interval "pandas.Interval") now supported in [`DataFrame.to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel") for all Excel file types ([GH 19242](https://github.com/pandas-dev/pandas/issues/19242)) +* [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") now supported in [`DataFrame.to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel") for all Excel file types ([GH 19242](https://github.com/pandas-dev/pandas/issues/19242), [GH 9155](https://github.com/pandas-dev/pandas/issues/9155), [GH 19900](https://github.com/pandas-dev/pandas/issues/19900)) +* Bug in [`pandas.io.stata.StataReader.value_labels()`](../reference/api/pandas.io.stata.StataReader.value_labels.html#pandas.io.stata.StataReader.value_labels "pandas.io.stata.StataReader.value_labels") raising an `AttributeError` when called on very old files. Now returns an empty dict ([GH 19417](https://github.com/pandas-dev/pandas/issues/19417)) +* Bug in [`read_pickle()`](../reference/api/pandas.read_pickle.html#pandas.read_pickle "pandas.read_pickle") when unpickling objects with [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") or `Float64Index` created with pandas prior to version 0.20 ([GH 19939](https://github.com/pandas-dev/pandas/issues/19939)) +* Bug in `pandas.io.json.json_normalize()` where sub-records are not properly normalized if any sub-records values are NoneType ([GH 20030](https://github.com/pandas-dev/pandas/issues/20030)) +* Bug in `usecols` parameter in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") where error is not raised correctly when passing a string. ([GH 20529](https://github.com/pandas-dev/pandas/issues/20529)) +* Bug in [`HDFStore.keys()`](../reference/api/pandas.HDFStore.keys.html#pandas.HDFStore.keys "pandas.HDFStore.keys") when reading a file with a soft link causes exception ([GH 20523](https://github.com/pandas-dev/pandas/issues/20523)) +* Bug in `HDFStore.select_column()` where a key which is not a valid store raised an `AttributeError` instead of a `KeyError` ([GH 17912](https://github.com/pandas-dev/pandas/issues/17912)) + +### Plotting[#](#plotting "Link to this heading") + +* Better error message when attempting to plot but matplotlib is not installed ([GH 19810](https://github.com/pandas-dev/pandas/issues/19810)). +* [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") now raises a `ValueError` when the `x` or `y` argument is improperly formed ([GH 18671](https://github.com/pandas-dev/pandas/issues/18671)) +* Bug in [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") when `x` and `y` arguments given as positions caused incorrect referenced columns for line, bar and area plots ([GH 20056](https://github.com/pandas-dev/pandas/issues/20056)) +* Bug in formatting tick labels with `datetime.time()` and fractional seconds ([GH 18478](https://github.com/pandas-dev/pandas/issues/18478)). +* [`Series.plot.kde()`](../reference/api/pandas.Series.plot.kde.html#pandas.Series.plot.kde "pandas.Series.plot.kde") has exposed the args `ind` and `bw_method` in the docstring ([GH 18461](https://github.com/pandas-dev/pandas/issues/18461)). The argument `ind` may now also be an integer (number of sample points). +* [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") now supports multiple columns to the `y` argument ([GH 19699](https://github.com/pandas-dev/pandas/issues/19699)) + +### GroupBy/resample/rolling[#](#groupby-resample-rolling "Link to this heading") + +* Bug when grouping by a single column and aggregating with a class like `list` or `tuple` ([GH 18079](https://github.com/pandas-dev/pandas/issues/18079)) +* Fixed regression in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") which would not emit an error when called with a tuple key not in the index ([GH 18798](https://github.com/pandas-dev/pandas/issues/18798)) +* Bug in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") which silently ignored unsupported (or mistyped) options for `label`, `closed` and `convention` ([GH 19303](https://github.com/pandas-dev/pandas/issues/19303)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") where tuples were interpreted as lists of keys rather than as keys ([GH 17979](https://github.com/pandas-dev/pandas/issues/17979), [GH 18249](https://github.com/pandas-dev/pandas/issues/18249)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") where aggregation by `first`/`last`/`min`/`max` was causing timestamps to lose precision ([GH 19526](https://github.com/pandas-dev/pandas/issues/19526)) +* Bug in [`DataFrame.transform()`](../reference/api/pandas.DataFrame.transform.html#pandas.DataFrame.transform "pandas.DataFrame.transform") where particular aggregation functions were being incorrectly cast to match the dtype(s) of the grouped data ([GH 19200](https://github.com/pandas-dev/pandas/issues/19200)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") passing the `on=` kwarg, and subsequently using `.apply()` ([GH 17813](https://github.com/pandas-dev/pandas/issues/17813)) +* Bug in `DataFrame.resample().aggregate` not raising a `KeyError` when aggregating a non-existent column ([GH 16766](https://github.com/pandas-dev/pandas/issues/16766), [GH 19566](https://github.com/pandas-dev/pandas/issues/19566)) +* Bug in `DataFrameGroupBy.cumsum()` and `DataFrameGroupBy.cumprod()` when `skipna` was passed ([GH 19806](https://github.com/pandas-dev/pandas/issues/19806)) +* Bug in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") that dropped timezone information ([GH 13238](https://github.com/pandas-dev/pandas/issues/13238)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") where transformations using `np.all` and `np.any` were raising a `ValueError` ([GH 20653](https://github.com/pandas-dev/pandas/issues/20653)) +* Bug in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") where `ffill`, `bfill`, `pad`, `backfill`, `fillna`, `interpolate`, and `asfreq` were ignoring `loffset`. ([GH 20744](https://github.com/pandas-dev/pandas/issues/20744)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") when applying a function that has mixed data types and the user supplied function can fail on the grouping column ([GH 20949](https://github.com/pandas-dev/pandas/issues/20949)) +* Bug in `DataFrameGroupBy.rolling().apply()` where operations performed against the associated `DataFrameGroupBy` object could impact the inclusion of the grouped item(s) in the result ([GH 14013](https://github.com/pandas-dev/pandas/issues/14013)) + +### Sparse[#](#sparse "Link to this heading") + +* Bug in which creating a `SparseDataFrame` from a dense `Series` or an unsupported type raised an uncontrolled exception ([GH 19374](https://github.com/pandas-dev/pandas/issues/19374)) +* Bug in `SparseDataFrame.to_csv` causing exception ([GH 19384](https://github.com/pandas-dev/pandas/issues/19384)) +* Bug in `SparseSeries.memory_usage` which caused segfault by accessing non sparse elements ([GH 19368](https://github.com/pandas-dev/pandas/issues/19368)) +* Bug in constructing a `SparseArray`: if `data` is a scalar and `index` is defined it will coerce to `float64` regardless of scalar’s dtype. ([GH 19163](https://github.com/pandas-dev/pandas/issues/19163)) + +### Reshaping[#](#reshaping "Link to this heading") + +* Bug in [`DataFrame.merge()`](../reference/api/pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge") where referencing a `CategoricalIndex` by name, where the `by` kwarg would `KeyError` ([GH 20777](https://github.com/pandas-dev/pandas/issues/20777)) +* Bug in [`DataFrame.stack()`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack") which fails trying to sort mixed type levels under Python 3 ([GH 18310](https://github.com/pandas-dev/pandas/issues/18310)) +* Bug in [`DataFrame.unstack()`](../reference/api/pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack") which casts int to float if `columns` is a `MultiIndex` with unused levels ([GH 17845](https://github.com/pandas-dev/pandas/issues/17845)) +* Bug in [`DataFrame.unstack()`](../reference/api/pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack") which raises an error if `index` is a `MultiIndex` with unused labels on the unstacked level ([GH 18562](https://github.com/pandas-dev/pandas/issues/18562)) +* Fixed construction of a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") from a `dict` containing `NaN` as key ([GH 18480](https://github.com/pandas-dev/pandas/issues/18480)) +* Fixed construction of a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") from a `dict` containing `NaN` as key ([GH 18455](https://github.com/pandas-dev/pandas/issues/18455)) +* Disabled construction of a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") where len(index) > len(data) = 1, which previously would broadcast the data item, and now raises a `ValueError` ([GH 18819](https://github.com/pandas-dev/pandas/issues/18819)) +* Suppressed error in the construction of a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") from a `dict` containing scalar values when the corresponding keys are not included in the passed index ([GH 18600](https://github.com/pandas-dev/pandas/issues/18600)) +* Fixed (changed from `object` to `float64`) dtype of [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") initialized with axes, no data, and `dtype=int` ([GH 19646](https://github.com/pandas-dev/pandas/issues/19646)) +* Bug in [`Series.rank()`](../reference/api/pandas.Series.rank.html#pandas.Series.rank "pandas.Series.rank") where `Series` containing `NaT` modifies the `Series` inplace ([GH 18521](https://github.com/pandas-dev/pandas/issues/18521)) +* Bug in [`cut()`](../reference/api/pandas.cut.html#pandas.cut "pandas.cut") which fails when using readonly arrays ([GH 18773](https://github.com/pandas-dev/pandas/issues/18773)) +* Bug in [`DataFrame.pivot_table()`](../reference/api/pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table") which fails when the `aggfunc` arg is of type string. The behavior is now consistent with other methods like `agg` and `apply` ([GH 18713](https://github.com/pandas-dev/pandas/issues/18713)) +* Bug in [`DataFrame.merge()`](../reference/api/pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge") in which merging using `Index` objects as vectors raised an Exception ([GH 19038](https://github.com/pandas-dev/pandas/issues/19038)) +* Bug in [`DataFrame.stack()`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack"), [`DataFrame.unstack()`](../reference/api/pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack"), [`Series.unstack()`](../reference/api/pandas.Series.unstack.html#pandas.Series.unstack "pandas.Series.unstack") which were not returning subclasses ([GH 15563](https://github.com/pandas-dev/pandas/issues/15563)) +* Bug in timezone comparisons, manifesting as a conversion of the index to UTC in `.concat()` ([GH 18523](https://github.com/pandas-dev/pandas/issues/18523)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") when concatenating sparse and dense series it returns only a `SparseDataFrame`. Should be a `DataFrame`. ([GH 18914](https://github.com/pandas-dev/pandas/issues/18914), [GH 18686](https://github.com/pandas-dev/pandas/issues/18686), and [GH 16874](https://github.com/pandas-dev/pandas/issues/16874)) +* Improved error message for [`DataFrame.merge()`](../reference/api/pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge") when there is no common merge key ([GH 19427](https://github.com/pandas-dev/pandas/issues/19427)) +* Bug in [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") which does an `outer` instead of a `left` join when being called with multiple DataFrames and some have non-unique indices ([GH 19624](https://github.com/pandas-dev/pandas/issues/19624)) +* [`Series.rename()`](../reference/api/pandas.Series.rename.html#pandas.Series.rename "pandas.Series.rename") now accepts `axis` as a kwarg ([GH 18589](https://github.com/pandas-dev/pandas/issues/18589)) +* Bug in [`rename()`](../reference/api/pandas.DataFrame.rename.html#pandas.DataFrame.rename "pandas.DataFrame.rename") where an Index of same-length tuples was converted to a MultiIndex ([GH 19497](https://github.com/pandas-dev/pandas/issues/19497)) +* Comparisons between [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") would return a `Series` with an incorrect name, ignoring the `Index`’s name attribute ([GH 19582](https://github.com/pandas-dev/pandas/issues/19582)) +* Bug in [`qcut()`](../reference/api/pandas.qcut.html#pandas.qcut "pandas.qcut") where datetime and timedelta data with `NaT` present raised a `ValueError` ([GH 19768](https://github.com/pandas-dev/pandas/issues/19768)) +* Bug in [`DataFrame.iterrows()`](../reference/api/pandas.DataFrame.iterrows.html#pandas.DataFrame.iterrows "pandas.DataFrame.iterrows"), which would infers strings not compliant to [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) to datetimes ([GH 19671](https://github.com/pandas-dev/pandas/issues/19671)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructor with `Categorical` where a `ValueError` is not raised when an index of different length is given ([GH 19342](https://github.com/pandas-dev/pandas/issues/19342)) +* Bug in [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") where column metadata is lost when converting to categorical or a dictionary of dtypes ([GH 19920](https://github.com/pandas-dev/pandas/issues/19920)) +* Bug in [`cut()`](../reference/api/pandas.cut.html#pandas.cut "pandas.cut") and [`qcut()`](../reference/api/pandas.qcut.html#pandas.qcut "pandas.qcut") where timezone information was dropped ([GH 19872](https://github.com/pandas-dev/pandas/issues/19872)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructor with a `dtype=str`, previously raised in some cases ([GH 19853](https://github.com/pandas-dev/pandas/issues/19853)) +* Bug in [`get_dummies()`](../reference/api/pandas.get_dummies.html#pandas.get_dummies "pandas.get_dummies"), and `select_dtypes()`, where duplicate column names caused incorrect behavior ([GH 20848](https://github.com/pandas-dev/pandas/issues/20848)) +* Bug in [`isna()`](../reference/api/pandas.isna.html#pandas.isna "pandas.isna"), which cannot handle ambiguous typed lists ([GH 20675](https://github.com/pandas-dev/pandas/issues/20675)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") which raises an error when concatenating TZ-aware dataframes and all-NaT dataframes ([GH 12396](https://github.com/pandas-dev/pandas/issues/12396)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") which raises an error when concatenating empty TZ-aware series ([GH 18447](https://github.com/pandas-dev/pandas/issues/18447)) + +### Other[#](#other "Link to this heading") + +* Improved error message when attempting to use a Python keyword as an identifier in a `numexpr` backed query ([GH 18221](https://github.com/pandas-dev/pandas/issues/18221)) +* Bug in accessing a [`pandas.get_option()`](../reference/api/pandas.get_option.html#pandas.get_option "pandas.get_option"), which raised `KeyError` rather than `OptionError` when looking up a non-existent option key in some cases ([GH 19789](https://github.com/pandas-dev/pandas/issues/19789)) +* Bug in [`testing.assert_series_equal()`](../reference/api/pandas.testing.assert_series_equal.html#pandas.testing.assert_series_equal "pandas.testing.assert_series_equal") and [`testing.assert_frame_equal()`](../reference/api/pandas.testing.assert_frame_equal.html#pandas.testing.assert_frame_equal "pandas.testing.assert_frame_equal") for Series or DataFrames with differing unicode data ([GH 20503](https://github.com/pandas-dev/pandas/issues/20503)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 328 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Aaron Critchley +* AbdealiJK + +* Adam Hooper + +* Albert Villanova del Moral +* Alejandro Giacometti + +* Alejandro Hohmann + +* Alex Rychyk +* Alexander Buchkovsky +* Alexander Lenail + +* Alexander Michael Schade +* Aly Sivji + +* Andreas Költringer + +* Andrew +* Andrew Bui + +* András Novoszáth + +* Andy Craze + +* Andy R. Terrel +* Anh Le + +* Anil Kumar Pallekonda + +* Antoine Pitrou + +* Antonio Linde + +* Antonio Molina + +* Antonio Quinonez + +* Armin Varshokar + +* Artem Bogachev + +* Avi Sen + +* Azeez Oluwafemi + +* Ben Auffarth + +* Bernhard Thiel + +* Bhavesh Poddar + +* BielStela + +* Blair + +* Bob Haffner +* Brett Naul + +* Brock Mendel +* Bryce Guinta + +* Carlos Eduardo Moreira dos Santos + +* Carlos García Márquez + +* Carol Willing +* Cheuk Ting Ho + +* Chitrank Dixit + +* Chris +* Chris Burr + +* Chris Catalfo + +* Chris Mazzullo +* Christian Chwala + +* Cihan Ceyhan + +* Clemens Brunner +* Colin + +* Cornelius Riemenschneider +* Crystal Gong + +* DaanVanHauwermeiren +* Dan Dixey + +* Daniel Frank + +* Daniel Garrido + +* Daniel Sakuma + +* DataOmbudsman + +* Dave Hirschfeld +* Dave Lewis + +* David Adrián Cañones Castellano + +* David Arcos + +* David C Hall + +* David Fischer +* David Hoese + +* David Lutz + +* David Polo + +* David Stansby +* Dennis Kamau + +* Dillon Niederhut +* Dimitri + +* Dr. Irv +* Dror Atariah +* Eric Chea + +* Eric Kisslinger +* Eric O. LEBIGOT (EOL) + +* FAN-GOD + +* Fabian Retkowski + +* Fer Sar + +* Gabriel de Maeztu + +* Gianpaolo Macario + +* Giftlin Rajaiah +* Gilberto Olimpio + +* Gina + +* Gjelt + +* Graham Inggs + +* Grant Roch +* Grant Smith + +* Grzegorz Konefał + +* Guilherme Beltramini +* HagaiHargil + +* Hamish Pitkeathly + +* Hammad Mashkoor + +* Hannah Ferchland + +* Hans +* Haochen Wu + +* Hissashi Rocha + +* Iain Barr + +* Ibrahim Sharaf ElDen + +* Ignasi Fosch + +* Igor Conrado Alves de Lima + +* Igor Shelvinskyi + +* Imanflow + +* Ingolf Becker +* Israel Saeta Pérez +* Iva Koevska + +* Jakub Nowacki + +* Jan F-F + +* Jan Koch + +* Jan Werkmann +* Janelle Zoutkamp + +* Jason Bandlow + +* Jaume Bonet + +* Jay Alammar + +* Jeff Reback +* JennaVergeynst +* Jimmy Woo + +* Jing Qiang Goh + +* Joachim Wagner + +* Joan Martin Miralles + +* Joel Nothman +* Joeun Park + +* John Cant + +* Johnny Metz + +* Jon Mease +* Jonas Schulze + +* Jongwony + +* Jordi Contestí + +* Joris Van den Bossche +* José F. R. Fonseca + +* Jovixe + +* Julio Martinez + +* Jörg Döpfert +* KOBAYASHI Ittoku + +* Kate Surta + +* Kenneth + +* Kevin Kuhl +* Kevin Sheppard +* Krzysztof Chomski +* Ksenia + +* Ksenia Bobrova + +* Kunal Gosar + +* Kurtis Kerstein + +* Kyle Barron + +* Laksh Arora + +* Laurens Geffert + +* Leif Walsh +* Liam Marshall + +* Liam3851 + +* Licht Takeuchi +* Liudmila + +* Ludovico Russo + +* Mabel Villalba + +* Manan Pal Singh + +* Manraj Singh +* Marc + +* Marc Garcia +* Marco Hemken + +* Maria del Mar Bibiloni + +* Mario Corchero + +* Mark Woodbridge + +* Martin Journois + +* Mason Gallo + +* Matias Heikkilä + +* Matt Braymer-Hayes +* Matt Kirk + +* Matt Maybeno + +* Matthew Kirk + +* Matthew Rocklin + +* Matthew Roeschke +* Matthias Bussonnier + +* Max Mikhaylov + +* Maxim Veksler + +* Maximilian Roos +* Maximiliano Greco + +* Michael Penkov +* Michael Röttger + +* Michael Selik + +* Michael Waskom +* Mie~~~ +* Mike Kutzma + +* Ming Li + +* Mitar + +* Mitch Negus + +* Montana Low + +* Moritz Münst + +* Mortada Mehyar +* Myles Braithwaite + +* Nate Yoder +* Nicholas Ursa + +* Nick Chmura +* Nikos Karagiannakis + +* Nipun Sadvilkar + +* Nis Martensen + +* Noah + +* Noémi Éltető + +* Olivier Bilodeau + +* Ondrej Kokes + +* Onno Eberhard + +* Paul Ganssle + +* Paul Mannino + +* Paul Reidy +* Paulo Roberto de Oliveira Castro + +* Pepe Flores + +* Peter Hoffmann +* Phil Ngo + +* Pietro Battiston +* Pranav Suri + +* Priyanka Ojha + +* Pulkit Maloo + +* README Bot + +* Ray Bell + +* Riccardo Magliocchetti + +* Ridhwan Luthra + +* Robert Meyer +* Robin +* Robin Kiplang’at + +* Rohan Pandit + +* Rok Mihevc + +* Rouz Azari +* Ryszard T. Kaleta + +* Sam Cohan +* Sam Foo +* Samir Musali + +* Samuel Sinayoko + +* Sangwoong Yoon +* SarahJessica + +* Sharad Vijalapuram + +* Shubham Chaudhary + +* SiYoungOh + +* Sietse Brouwer +* Simone Basso + +* Stefania Delprete + +* Stefano Cianciulli + +* Stephen Childs + +* StephenVoland + +* Stijn Van Hoey + +* Sven +* Talitha Pumar + +* Tarbo Fukazawa + +* Ted Petrou + +* Thomas A Caswell +* Tim Hoffmann + +* Tim Swast +* Tom Augspurger +* Tommy + +* Tulio Casagrande + +* Tushar Gupta + +* Tushar Mittal + +* Upkar Lidder + +* Victor Villas + +* Vince W + +* Vinícius Figueiredo + +* Vipin Kumar + +* WBare +* Wenhuan + +* Wes Turner +* William Ayd +* Wilson Lin + +* Xbar +* Yaroslav Halchenko +* Yee Mey +* Yeongseon Choe + +* Yian + +* Yimeng Zhang +* ZhuBaohe + +* Zihao Zhao + +* adatasetaday + +* akielbowicz + +* akosel + +* alinde1 + +* amuta + +* bolkedebruin +* cbertinato +* cgohlke +* charlie0389 + +* chris-b1 +* csfarkas + +* dajcs + +* deflatSOCO + +* derestle-htwg +* discort +* dmanikowski-reef + +* donK23 + +* elrubio + +* fivemok + +* fjdiod +* fjetter + +* froessler + +* gabrielclow +* gfyoung +* ghasemnaddaf +* h-vetinari + +* himanshu awasthi + +* ignamv + +* jayfoad + +* jazzmuesli + +* jbrockmendel +* jen w + +* jjames34 + +* joaoavf + +* joders + +* jschendel +* juan huguet + +* l736x + +* luzpaz + +* mdeboc + +* miguelmorin + +* miker985 +* miquelcamprodon + +* orereta + +* ottiP + +* peterpanmj + +* rafarui + +* raph-m + +* readyready15728 + +* rmihael + +* samghelms + +* scriptomation + +* sfoo + +* stefansimik + +* stonebig +* tmnhat2001 + +* tomneep + +* topper-123 +* tv3141 + +* verakai + +* xpvpc + +* zhanghui + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.23.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.23.1.md new file mode 100644 index 0000000000000000000000000000000000000000..4d4503abfa067a0bdc0d8cf40cb2a9fd1216680c --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.23.1.md @@ -0,0 +1,171 @@ +# What's new in pandas 0.23.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.23.1.html + +# What’s new in 0.23.1 (June 12, 2018)[#](#what-s-new-in-0-23-1-june-12-2018 "Link to this heading") + +This is a minor bug-fix release in the 0.23.x series and includes some small regression fixes +and bug fixes. We recommend that all users upgrade to this version. + +Warning + +Starting January 1, 2019, pandas feature releases will support Python 3 only. +See [Dropping Python 2.7](https://pandas.pydata.org/pandas-docs/version/0.24/install.html#install-dropping-27) for more. + +What’s new in v0.23.1 + +* [Fixed regressions](#fixed-regressions) +* [Performance improvements](#performance-improvements) +* [Bug fixes](#bug-fixes) +* [Contributors](#contributors) + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +**Comparing Series with datetime.date** + +We’ve reverted a 0.23.0 change to comparing a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") holding datetimes and a `datetime.date` object ([GH 21152](https://github.com/pandas-dev/pandas/issues/21152)). +In pandas 0.22 and earlier, comparing a Series holding datetimes and `datetime.date` objects would coerce the `datetime.date` to a datetime before comparing. +This was inconsistent with Python, NumPy, and [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex"), which never consider a datetime and `datetime.date` equal. + +In 0.23.0, we unified operations between DatetimeIndex and Series, and in the process changed comparisons between a Series of datetimes and `datetime.date` without warning. + +We’ve temporarily restored the 0.22.0 behavior, so datetimes and dates may again compare equal, but restore the 0.23.0 behavior in a future release. + +To summarize, here’s the behavior in 0.22.0, 0.23.0, 0.23.1: + +```None +# 0.22.0... Silently coerce the datetime.date +>>> import datetime +>>> pd.Series(pd.date_range('2017', periods=2)) == datetime.date(2017, 1, 1) +0 True +1 False +dtype: bool + +# 0.23.0... Do not coerce the datetime.date +>>> pd.Series(pd.date_range('2017', periods=2)) == datetime.date(2017, 1, 1) +0 False +1 False +dtype: bool + +# 0.23.1... Coerce the datetime.date with a warning +>>> pd.Series(pd.date_range('2017', periods=2)) == datetime.date(2017, 1, 1) +/bin/python:1: FutureWarning: Comparing Series of datetimes with 'datetime.date'. Currently, the +'datetime.date' is coerced to a datetime. In the future pandas will +not coerce, and the values not compare equal to the 'datetime.date'. +To retain the current behavior, convert the 'datetime.date' to a +datetime with 'pd.Timestamp'. + #!/bin/python3 +0 True +1 False +dtype: bool +``` + +In addition, ordering comparisons will raise a `TypeError` in the future. + +**Other fixes** + +* Reverted the ability of [`to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") to perform multivalue + inserts as this caused regression in certain cases ([GH 21103](https://github.com/pandas-dev/pandas/issues/21103)). + In the future this will be made configurable. +* Fixed regression in the [`DatetimeIndex.date`](../reference/api/pandas.DatetimeIndex.date.html#pandas.DatetimeIndex.date "pandas.DatetimeIndex.date") and [`DatetimeIndex.time`](../reference/api/pandas.DatetimeIndex.time.html#pandas.DatetimeIndex.time "pandas.DatetimeIndex.time") + attributes in case of timezone-aware data: [`DatetimeIndex.time`](../reference/api/pandas.DatetimeIndex.time.html#pandas.DatetimeIndex.time "pandas.DatetimeIndex.time") returned + a tz-aware time instead of tz-naive ([GH 21267](https://github.com/pandas-dev/pandas/issues/21267)) and [`DatetimeIndex.date`](../reference/api/pandas.DatetimeIndex.date.html#pandas.DatetimeIndex.date "pandas.DatetimeIndex.date") + returned incorrect date when the input date has a non-UTC timezone ([GH 21230](https://github.com/pandas-dev/pandas/issues/21230)). +* Fixed regression in `pandas.io.json.json_normalize()` when called with `None` values + in nested levels in JSON, and to not drop keys with value as `None` ([GH 21158](https://github.com/pandas-dev/pandas/issues/21158), [GH 21356](https://github.com/pandas-dev/pandas/issues/21356)). +* Bug in [`to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") causes encoding error when compression and encoding are specified ([GH 21241](https://github.com/pandas-dev/pandas/issues/21241), [GH 21118](https://github.com/pandas-dev/pandas/issues/21118)) +* Bug preventing pandas from being importable with -OO optimization ([GH 21071](https://github.com/pandas-dev/pandas/issues/21071)) +* Bug in `Categorical.fillna()` incorrectly raising a `TypeError` when `value` the individual categories are iterable and `value` is an iterable ([GH 21097](https://github.com/pandas-dev/pandas/issues/21097), [GH 19788](https://github.com/pandas-dev/pandas/issues/19788)) +* Fixed regression in constructors coercing NA values like `None` to strings when passing `dtype=str` ([GH 21083](https://github.com/pandas-dev/pandas/issues/21083)) +* Regression in [`pivot_table()`](../reference/api/pandas.pivot_table.html#pandas.pivot_table "pandas.pivot_table") where an ordered `Categorical` with missing + values for the pivot’s `index` would give a mis-aligned result ([GH 21133](https://github.com/pandas-dev/pandas/issues/21133)) +* Fixed regression in merging on boolean index/columns ([GH 21119](https://github.com/pandas-dev/pandas/issues/21119)). + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Improved performance of `CategoricalIndex.is_monotonic_increasing()`, `CategoricalIndex.is_monotonic_decreasing()` and `CategoricalIndex.is_monotonic()` ([GH 21025](https://github.com/pandas-dev/pandas/issues/21025)) +* Improved performance of `CategoricalIndex.is_unique()` ([GH 21107](https://github.com/pandas-dev/pandas/issues/21107)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +**Groupby/resample/rolling** + +* Bug in [`DataFrame.agg()`](../reference/api/pandas.DataFrame.agg.html#pandas.DataFrame.agg "pandas.DataFrame.agg") where applying multiple aggregation functions to a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with duplicated column names would cause a stack overflow ([GH 21063](https://github.com/pandas-dev/pandas/issues/21063)) +* Bug in `GroupBy.ffill()` and `GroupBy.bfill()` where the fill within a grouping would not always be applied as intended due to the implementations’ use of a non-stable sort ([GH 21207](https://github.com/pandas-dev/pandas/issues/21207)) +* Bug in `GroupBy.rank()` where results did not scale to 100% when specifying `method='dense'` and `pct=True` +* Bug in [`pandas.DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") and [`pandas.Series.rolling()`](../reference/api/pandas.Series.rolling.html#pandas.Series.rolling "pandas.Series.rolling") which incorrectly accepted a 0 window size rather than raising ([GH 21286](https://github.com/pandas-dev/pandas/issues/21286)) + +**Data-type specific** + +* Bug in [`Series.str.replace()`](../reference/api/pandas.Series.str.replace.html#pandas.Series.str.replace "pandas.Series.str.replace") where the method throws `TypeError` on Python 3.5.2 ([GH 21078](https://github.com/pandas-dev/pandas/issues/21078)) +* Bug in [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") where passing a float with a unit would prematurely round the float precision ([GH 14156](https://github.com/pandas-dev/pandas/issues/14156)) +* Bug in [`pandas.testing.assert_index_equal()`](../reference/api/pandas.testing.assert_index_equal.html#pandas.testing.assert_index_equal "pandas.testing.assert_index_equal") which raised `AssertionError` incorrectly, when comparing two [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") objects with param `check_categorical=False` ([GH 19776](https://github.com/pandas-dev/pandas/issues/19776)) + +**Sparse** + +* Bug in `SparseArray.shape` which previously only returned the shape `SparseArray.sp_values` ([GH 21126](https://github.com/pandas-dev/pandas/issues/21126)) + +**Indexing** + +* Bug in [`Series.reset_index()`](../reference/api/pandas.Series.reset_index.html#pandas.Series.reset_index "pandas.Series.reset_index") where appropriate error was not raised with an invalid level name ([GH 20925](https://github.com/pandas-dev/pandas/issues/20925)) +* Bug in [`interval_range()`](../reference/api/pandas.interval_range.html#pandas.interval_range "pandas.interval_range") when `start`/`periods` or `end`/`periods` are specified with float `start` or `end` ([GH 21161](https://github.com/pandas-dev/pandas/issues/21161)) +* Bug in `MultiIndex.set_names()` where error raised for a `MultiIndex` with `nlevels == 1` ([GH 21149](https://github.com/pandas-dev/pandas/issues/21149)) +* Bug in [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") constructors where creating an `IntervalIndex` from categorical data was not fully supported ([GH 21243](https://github.com/pandas-dev/pandas/issues/21243), [GH 21253](https://github.com/pandas-dev/pandas/issues/21253)) +* Bug in `MultiIndex.sort_index()` which was not guaranteed to sort correctly with `level=1`; this was also causing data misalignment in particular [`DataFrame.stack()`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack") operations ([GH 20994](https://github.com/pandas-dev/pandas/issues/20994), [GH 20945](https://github.com/pandas-dev/pandas/issues/20945), [GH 21052](https://github.com/pandas-dev/pandas/issues/21052)) + +**Plotting** + +* New keywords (sharex, sharey) to turn on/off sharing of x/y-axis by subplots generated with pandas.DataFrame().groupby().boxplot() ([GH 20968](https://github.com/pandas-dev/pandas/issues/20968)) + +**I/O** + +* Bug in IO methods specifying `compression='zip'` which produced uncompressed zip archives ([GH 17778](https://github.com/pandas-dev/pandas/issues/17778), [GH 21144](https://github.com/pandas-dev/pandas/issues/21144)) +* Bug in [`DataFrame.to_stata()`](../reference/api/pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata") which prevented exporting DataFrames to buffers and most file-like objects ([GH 21041](https://github.com/pandas-dev/pandas/issues/21041)) +* Bug in [`read_stata()`](../reference/api/pandas.read_stata.html#pandas.read_stata "pandas.read_stata") and `StataReader` which did not correctly decode utf-8 strings on Python 3 from Stata 14 files (dta version 118) ([GH 21244](https://github.com/pandas-dev/pandas/issues/21244)) +* Bug in IO JSON [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") reading empty JSON schema with `orient='table'` back to [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") caused an error ([GH 21287](https://github.com/pandas-dev/pandas/issues/21287)) + +**Reshaping** + +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") where error was raised in concatenating [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with numpy scalar and tuple names ([GH 21015](https://github.com/pandas-dev/pandas/issues/21015)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") warning message providing the wrong guidance for future behavior ([GH 21101](https://github.com/pandas-dev/pandas/issues/21101)) + +**Other** + +* Tab completion on [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") in IPython no longer outputs deprecation warnings ([GH 21125](https://github.com/pandas-dev/pandas/issues/21125)) +* Bug preventing pandas being used on Windows without C++ redistributable installed ([GH 21106](https://github.com/pandas-dev/pandas/issues/21106)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 30 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Adam J. Stewart +* Adam Kim + +* Aly Sivji +* Chalmer Lowe + +* Damini Satya + +* Dr. Irv +* Gabe Fernando + +* Giftlin Rajaiah +* Jeff Reback +* Jeremy Schendel + +* Joris Van den Bossche +* Kalyan Gokhale + +* Kevin Sheppard +* Matthew Roeschke +* Max Kanter + +* Ming Li +* Pyry Kovanen + +* Stefano Cianciulli +* Tom Augspurger +* Uddeshya Singh + +* Wenhuan +* William Ayd +* chris-b1 +* gfyoung +* h-vetinari +* nprad + +* ssikdar1 + +* tmnhat2001 +* topper-123 +* zertrin + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.23.2.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.23.2.md new file mode 100644 index 0000000000000000000000000000000000000000..b199529e3089cfd920490865f6af598e32e54ea0 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.23.2.md @@ -0,0 +1,131 @@ +# What's new in pandas 0.23.2 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.23.2.html + +# What’s new in 0.23.2 (July 5, 2018)[#](#what-s-new-in-0-23-2-july-5-2018 "Link to this heading") + +This is a minor bug-fix release in the 0.23.x series and includes some small regression fixes +and bug fixes. We recommend that all users upgrade to this version. + +Note + +pandas 0.23.2 is first pandas release that’s compatible with +Python 3.7 ([GH 20552](https://github.com/pandas-dev/pandas/issues/20552)) + +Warning + +Starting January 1, 2019, pandas feature releases will support Python 3 only. +See [Dropping Python 2.7](https://pandas.pydata.org/pandas-docs/version/0.24/install.html#install-dropping-27) for more. + +What’s new in v0.23.2 + +* [Logical reductions over entire DataFrame](#logical-reductions-over-entire-dataframe) +* [Fixed regressions](#fixed-regressions) +* [Build changes](#build-changes) +* [Bug fixes](#bug-fixes) +* [Contributors](#contributors) + +## Logical reductions over entire DataFrame[#](#logical-reductions-over-entire-dataframe "Link to this heading") + +[`DataFrame.all()`](../reference/api/pandas.DataFrame.all.html#pandas.DataFrame.all "pandas.DataFrame.all") and [`DataFrame.any()`](../reference/api/pandas.DataFrame.any.html#pandas.DataFrame.any "pandas.DataFrame.any") now accept `axis=None` to reduce over all axes to a scalar ([GH 19976](https://github.com/pandas-dev/pandas/issues/19976)) + +```None +In [1]: df = pd.DataFrame({"A": [1, 2], "B": [True, False]}) + +In [2]: df.all(axis=None) +Out[2]: False +``` + +This also provides compatibility with NumPy 1.15, which now dispatches to `DataFrame.all`. +With NumPy 1.15 and pandas 0.23.1 or earlier, [`numpy.all()`](https://numpy.org/doc/stable/reference/generated/numpy.all.html#numpy.all "(in NumPy v2.3)") will no longer reduce over every axis: + +```None +>>> # NumPy 1.15, pandas 0.23.1 +>>> np.any(pd.DataFrame({"A": [False], "B": [False]})) +A False +B False +dtype: bool +``` + +With pandas 0.23.2, that will correctly return False, as it did with NumPy < 1.15. + +```None +In [3]: np.any(pd.DataFrame({"A": [False], "B": [False]})) +Out[3]: False +``` + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in `to_csv()` when handling file-like object incorrectly ([GH 21471](https://github.com/pandas-dev/pandas/issues/21471)) +* Re-allowed duplicate level names of a `MultiIndex`. Accessing a level that has a duplicate name by name still raises an error ([GH 19029](https://github.com/pandas-dev/pandas/issues/19029)). +* Bug in both [`DataFrame.first_valid_index()`](../reference/api/pandas.DataFrame.first_valid_index.html#pandas.DataFrame.first_valid_index "pandas.DataFrame.first_valid_index") and [`Series.first_valid_index()`](../reference/api/pandas.Series.first_valid_index.html#pandas.Series.first_valid_index "pandas.Series.first_valid_index") raised for a row index having duplicate values ([GH 21441](https://github.com/pandas-dev/pandas/issues/21441)) +* Fixed printing of DataFrames with hierarchical columns with long names ([GH 21180](https://github.com/pandas-dev/pandas/issues/21180)) +* Fixed regression in [`reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex") and [`groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") + with a MultiIndex or multiple keys that contains categorical datetime-like values ([GH 21390](https://github.com/pandas-dev/pandas/issues/21390)). +* Fixed regression in unary negative operations with object dtype ([GH 21380](https://github.com/pandas-dev/pandas/issues/21380)) +* Bug in [`Timestamp.ceil()`](../reference/api/pandas.Timestamp.ceil.html#pandas.Timestamp.ceil "pandas.Timestamp.ceil") and [`Timestamp.floor()`](../reference/api/pandas.Timestamp.floor.html#pandas.Timestamp.floor "pandas.Timestamp.floor") when timestamp is a multiple of the rounding frequency ([GH 21262](https://github.com/pandas-dev/pandas/issues/21262)) +* Fixed regression in `to_clipboard()` that defaulted to copying dataframes with space delimited instead of tab delimited ([GH 21104](https://github.com/pandas-dev/pandas/issues/21104)) + +## Build changes[#](#build-changes "Link to this heading") + +* The source and binary distributions no longer include test data files, resulting in smaller download sizes. Tests relying on these data files will be skipped when using `pandas.test()`. ([GH 19320](https://github.com/pandas-dev/pandas/issues/19320)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +**Conversion** + +* Bug in constructing [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with an iterator or generator ([GH 21470](https://github.com/pandas-dev/pandas/issues/21470)) +* Bug in [`Series.nlargest()`](../reference/api/pandas.Series.nlargest.html#pandas.Series.nlargest "pandas.Series.nlargest") for signed and unsigned integer dtypes when the minimum value is present ([GH 21426](https://github.com/pandas-dev/pandas/issues/21426)) + +**Indexing** + +* Bug in [`Index.get_indexer_non_unique()`](../reference/api/pandas.Index.get_indexer_non_unique.html#pandas.Index.get_indexer_non_unique "pandas.Index.get_indexer_non_unique") with categorical key ([GH 21448](https://github.com/pandas-dev/pandas/issues/21448)) +* Bug in comparison operations for [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") where error was raised on equality / inequality comparison involving a MultiIndex with `nlevels == 1` ([GH 21149](https://github.com/pandas-dev/pandas/issues/21149)) +* Bug in [`DataFrame.drop()`](../reference/api/pandas.DataFrame.drop.html#pandas.DataFrame.drop "pandas.DataFrame.drop") behaviour is not consistent for unique and non-unique indexes ([GH 21494](https://github.com/pandas-dev/pandas/issues/21494)) +* Bug in [`DataFrame.duplicated()`](../reference/api/pandas.DataFrame.duplicated.html#pandas.DataFrame.duplicated "pandas.DataFrame.duplicated") with a large number of columns causing a ‘maximum recursion depth exceeded’ ([GH 21524](https://github.com/pandas-dev/pandas/issues/21524)). + +**I/O** + +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") that caused it to incorrectly raise an error when `nrows=0`, `low_memory=True`, and `index_col` was not `None` ([GH 21141](https://github.com/pandas-dev/pandas/issues/21141)) +* Bug in [`json_normalize()`](../reference/api/pandas.json_normalize.html#pandas.json_normalize "pandas.json_normalize") when formatting the `record_prefix` with integer columns ([GH 21536](https://github.com/pandas-dev/pandas/issues/21536)) + +**Categorical** + +* Bug in rendering [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `Categorical` dtype in rare conditions under Python 2.7 ([GH 21002](https://github.com/pandas-dev/pandas/issues/21002)) + +**Timezones** + +* Bug in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") and [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") where passing a [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") localized after a DST transition would return a datetime before the DST transition ([GH 20854](https://github.com/pandas-dev/pandas/issues/20854)) +* Bug in comparing [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with tz-aware [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") columns with a DST transition that raised a `KeyError` ([GH 19970](https://github.com/pandas-dev/pandas/issues/19970)) +* Bug in `DatetimeIndex.shift()` where an `AssertionError` would raise when shifting across DST ([GH 8616](https://github.com/pandas-dev/pandas/issues/8616)) +* Bug in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") constructor where passing an invalid timezone offset designator (`Z`) would not raise a `ValueError` ([GH 8910](https://github.com/pandas-dev/pandas/issues/8910)) +* Bug in [`Timestamp.replace()`](../reference/api/pandas.Timestamp.replace.html#pandas.Timestamp.replace "pandas.Timestamp.replace") where replacing at a DST boundary would retain an incorrect offset ([GH 7825](https://github.com/pandas-dev/pandas/issues/7825)) +* Bug in `DatetimeIndex.reindex()` when reindexing a tz-naive and tz-aware [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") ([GH 8306](https://github.com/pandas-dev/pandas/issues/8306)) +* Bug in `DatetimeIndex.resample()` when downsampling across a DST boundary ([GH 8531](https://github.com/pandas-dev/pandas/issues/8531)) + +**Timedelta** + +* Bug in [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") where non-zero timedeltas shorter than 1 microsecond were considered False ([GH 21484](https://github.com/pandas-dev/pandas/issues/21484)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 17 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* David Krych +* Jacopo Rota + +* Jeff Reback +* Jeremy Schendel +* Joris Van den Bossche +* Kalyan Gokhale +* Matthew Roeschke +* Michael Odintsov + +* Ming Li +* Pietro Battiston +* Tom Augspurger +* Uddeshya Singh +* Vu Le + +* alimcmaster1 + +* david-liu-brattle-1 + +* gfyoung +* jbrockmendel diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.23.3.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.23.3.md new file mode 100644 index 0000000000000000000000000000000000000000..c8bb68c7942f21a6a8eeaa70513519ca3c173a5b --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.23.3.md @@ -0,0 +1,16 @@ +# What's new in pandas 0.23.3 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.23.3.html + +# What’s new in 0.23.3 (July 7, 2018)[#](#what-s-new-in-0-23-3-july-7-2018 "Link to this heading") + +This release fixes a build issue with the sdist for Python 3.7 ([GH 21785](https://github.com/pandas-dev/pandas/issues/21785)) +There are no other changes. + +## Contributors[#](#contributors "Link to this heading") + +A total of 2 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Tom Augspurger +* meeseeksdev[bot] + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.23.4.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.23.4.md new file mode 100644 index 0000000000000000000000000000000000000000..f09c7d21aa282db31ffe75909485c6ba034a56d0 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.23.4.md @@ -0,0 +1,46 @@ +# What's new in pandas 0.23.4 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.23.4.html + +# What’s new in 0.23.4 (August 3, 2018)[#](#what-s-new-in-0-23-4-august-3-2018 "Link to this heading") + +This is a minor bug-fix release in the 0.23.x series and includes some small regression fixes +and bug fixes. We recommend that all users upgrade to this version. + +Warning + +Starting January 1, 2019, pandas feature releases will support Python 3 only. +See [Dropping Python 2.7](https://pandas.pydata.org/pandas-docs/version/0.24/install.html#install-dropping-27) for more. + +What’s new in v0.23.4 + +* [Fixed regressions](#fixed-regressions) +* [Bug fixes](#bug-fixes) +* [Contributors](#contributors) + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Python 3.7 with Windows gave all missing values for rolling variance calculations ([GH 21813](https://github.com/pandas-dev/pandas/issues/21813)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +**Groupby/resample/rolling** + +* Bug where calling `DataFrameGroupBy.agg()` with a list of functions including `ohlc` as the non-initial element would raise a `ValueError` ([GH 21716](https://github.com/pandas-dev/pandas/issues/21716)) +* Bug in `roll_quantile` caused a memory leak when calling `.rolling(...).quantile(q)` with `q` in (0,1) ([GH 21965](https://github.com/pandas-dev/pandas/issues/21965)) + +**Missing** + +* Bug in [`Series.clip()`](../reference/api/pandas.Series.clip.html#pandas.Series.clip "pandas.Series.clip") and [`DataFrame.clip()`](../reference/api/pandas.DataFrame.clip.html#pandas.DataFrame.clip "pandas.DataFrame.clip") cannot accept list-like threshold containing `NaN` ([GH 19992](https://github.com/pandas-dev/pandas/issues/19992)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 6 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Jeff Reback +* MeeseeksMachine + +* Tom Augspurger +* chris-b1 +* h-vetinari +* meeseeksdev[bot] diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.24.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.24.0.md new file mode 100644 index 0000000000000000000000000000000000000000..3e1b572e3b3e42ca7900b52be5387cc80cc373f5 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.24.0.md @@ -0,0 +1,2483 @@ +# What's new in pandas 0.24.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.24.0.html + +# What’s new in 0.24.0 (January 25, 2019)[#](#what-s-new-in-0-24-0-january-25-2019 "Link to this heading") + +Warning + +The 0.24.x series of releases will be the last to support Python 2. Future feature +releases will support Python 3 only. See [Dropping Python 2.7](https://pandas.pydata.org/pandas-docs/version/0.24/install.html#install-dropping-27) for more +details. + +This is a major release from 0.23.4 and includes a number of API changes, new +features, enhancements, and performance improvements along with a large number +of bug fixes. + +Highlights include: + +* [Optional Integer NA Support](#whatsnew-0240-enhancements-intna) +* [New APIs for accessing the array backing a Series or Index](#whatsnew-0240-values-api) +* [A new top-level method for creating arrays](#whatsnew-0240-enhancements-array) +* [Store Interval and Period data in a Series or DataFrame](#whatsnew-0240-enhancements-interval) +* [Support for joining on two MultiIndexes](#whatsnew-0240-enhancements-join-with-two-multiindexes) + +Check the [API Changes](#whatsnew-0240-api-breaking) and [deprecations](#whatsnew-0240-deprecations) before updating. + +These are the changes in pandas 0.24.0. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Enhancements[#](#enhancements "Link to this heading") + +### Optional integer NA support[#](#optional-integer-na-support "Link to this heading") + +pandas has gained the ability to hold integer dtypes with missing values. This long requested feature is enabled through the use of [extension types](../development/extending.html#extending-extension-types). + +Note + +IntegerArray is currently experimental. Its API or implementation may +change without warning. + +We can construct a `Series` with the specified dtype. The dtype string `Int64` is a pandas `ExtensionDtype`. Specifying a list or array using the traditional missing value +marker of `np.nan` will infer to integer dtype. The display of the `Series` will also use the `NaN` to indicate missing values in string outputs. ([GH 20700](https://github.com/pandas-dev/pandas/issues/20700), [GH 20747](https://github.com/pandas-dev/pandas/issues/20747), [GH 22441](https://github.com/pandas-dev/pandas/issues/22441), [GH 21789](https://github.com/pandas-dev/pandas/issues/21789), [GH 22346](https://github.com/pandas-dev/pandas/issues/22346)) + +```None +In [1]: s = pd.Series([1, 2, np.nan], dtype='Int64') + +In [2]: s +Out[2]: +0 1 +1 2 +2 +Length: 3, dtype: Int64 +``` + +Operations on these dtypes will propagate `NaN` as other pandas operations. + +```None +# arithmetic +In [3]: s + 1 +Out[3]: +0 2 +1 3 +2 +Length: 3, dtype: Int64 + +# comparison +In [4]: s == 1 +Out[4]: +0 True +1 False +2 +Length: 3, dtype: boolean + +# indexing +In [5]: s.iloc[1:3] +Out[5]: +1 2 +2 +Length: 2, dtype: Int64 + +# operate with other dtypes +In [6]: s + s.iloc[1:3].astype('Int8') +Out[6]: +0 +1 4 +2 +Length: 3, dtype: Int64 + +# coerce when needed +In [7]: s + 0.01 +Out[7]: +0 1.01 +1 2.01 +2 +Length: 3, dtype: Float64 +``` + +These dtypes can operate as part of a `DataFrame`. + +```None +In [8]: df = pd.DataFrame({'A': s, 'B': [1, 1, 3], 'C': list('aab')}) + +In [9]: df +Out[9]: + A B C +0 1 1 a +1 2 1 a +2 3 b + +[3 rows x 3 columns] + +In [10]: df.dtypes +Out[10]: +A Int64 +B int64 +C object +Length: 3, dtype: object +``` + +These dtypes can be merged, reshaped, and casted. + +```None +In [11]: pd.concat([df[['A']], df[['B', 'C']]], axis=1).dtypes +Out[11]: +A Int64 +B int64 +C object +Length: 3, dtype: object + +In [12]: df['A'].astype(float) +Out[12]: +0 1.0 +1 2.0 +2 NaN +Name: A, Length: 3, dtype: float64 +``` + +Reduction and groupby operations such as `sum` work. + +```None +In [13]: df.sum() +Out[13]: +A 3 +B 5 +C aab +Length: 3, dtype: object + +In [14]: df.groupby('B').A.sum() +Out[14]: +B +1 3 +3 0 +Name: A, Length: 2, dtype: Int64 +``` + +Warning + +The Integer NA support currently uses the capitalized dtype version, e.g. `Int8` as compared to the traditional `int8`. This may be changed at a future date. + +See [Nullable integer data type](../user_guide/integer_na.html#integer-na) for more. + +### Accessing the values in a Series or Index[#](#accessing-the-values-in-a-series-or-index "Link to this heading") + +[`Series.array`](../reference/api/pandas.Series.array.html#pandas.Series.array "pandas.Series.array") and `Index.array` have been added for extracting the array backing a +`Series` or `Index`. ([GH 19954](https://github.com/pandas-dev/pandas/issues/19954), [GH 23623](https://github.com/pandas-dev/pandas/issues/23623)) + +```None +In [15]: idx = pd.period_range('2000', periods=4) + +In [16]: idx.array +Out[16]: + +['2000-01-01', '2000-01-02', '2000-01-03', '2000-01-04'] +Length: 4, dtype: period[D] + +In [17]: pd.Series(idx).array +Out[17]: + +['2000-01-01', '2000-01-02', '2000-01-03', '2000-01-04'] +Length: 4, dtype: period[D] +``` + +Historically, this would have been done with `series.values`, but with +`.values` it was unclear whether the returned value would be the actual array, +some transformation of it, or one of pandas custom arrays (like +`Categorical`). For example, with [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex"), `.values` generates +a new ndarray of period objects each time. + +```None +In [18]: idx.values +Out[18]: +array([Period('2000-01-01', 'D'), Period('2000-01-02', 'D'), + Period('2000-01-03', 'D'), Period('2000-01-04', 'D')], dtype=object) + +In [19]: id(idx.values) +Out[19]: 140203905696464 + +In [20]: id(idx.values) +Out[20]: 140204511501296 +``` + +If you need an actual NumPy array, use [`Series.to_numpy()`](../reference/api/pandas.Series.to_numpy.html#pandas.Series.to_numpy "pandas.Series.to_numpy") or `Index.to_numpy()`. + +```None +In [21]: idx.to_numpy() +Out[21]: +array([Period('2000-01-01', 'D'), Period('2000-01-02', 'D'), + Period('2000-01-03', 'D'), Period('2000-01-04', 'D')], dtype=object) + +In [22]: pd.Series(idx).to_numpy() +Out[22]: +array([Period('2000-01-01', 'D'), Period('2000-01-02', 'D'), + Period('2000-01-03', 'D'), Period('2000-01-04', 'D')], dtype=object) +``` + +For Series and Indexes backed by normal NumPy arrays, [`Series.array`](../reference/api/pandas.Series.array.html#pandas.Series.array "pandas.Series.array") will return a +new `arrays.PandasArray`, which is a thin (no-copy) wrapper around a +[`numpy.ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.3)"). `PandasArray` isn’t especially useful on its own, +but it does provide the same interface as any extension array defined in pandas or by +a third-party library. + +```None +In [23]: ser = pd.Series([1, 2, 3]) + +In [24]: ser.array +Out[24]: + +[1, 2, 3] +Length: 3, dtype: int64 + +In [25]: ser.to_numpy() +Out[25]: array([1, 2, 3]) +``` + +We haven’t removed or deprecated [`Series.values`](../reference/api/pandas.Series.values.html#pandas.Series.values "pandas.Series.values") or [`DataFrame.values`](../reference/api/pandas.DataFrame.values.html#pandas.DataFrame.values "pandas.DataFrame.values"), but we +highly recommend and using `.array` or `.to_numpy()` instead. + +See [Dtypes](../user_guide/basics.html#basics-dtypes) and [Attributes and Underlying Data](../user_guide/basics.html#basics-attrs) for more. + +### `pandas.array`: a new top-level method for creating arrays[#](#pandas-array-a-new-top-level-method-for-creating-arrays "Link to this heading") + +A new top-level method [`array()`](../reference/api/pandas.array.html#pandas.array "pandas.array") has been added for creating 1-dimensional arrays ([GH 22860](https://github.com/pandas-dev/pandas/issues/22860)). +This can be used to create any [extension array](../development/extending.html#extending-extension-types), including +extension arrays registered by [3rd party libraries](https://pandas.pydata.org/community/ecosystem.html). +See the [dtypes docs](../user_guide/basics.html#basics-dtypes) for more on extension arrays. + +```None +In [26]: pd.array([1, 2, np.nan], dtype='Int64') +Out[26]: + +[1, 2, ] +Length: 3, dtype: Int64 + +In [27]: pd.array(['a', 'b', 'c'], dtype='category') +Out[27]: +['a', 'b', 'c'] +Categories (3, object): ['a', 'b', 'c'] +``` + +Passing data for which there isn’t dedicated extension type (e.g. float, integer, etc.) +will return a new `arrays.PandasArray`, which is just a thin (no-copy) +wrapper around a [`numpy.ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.3)") that satisfies the pandas extension array interface. + +```None +In [28]: pd.array([1, 2, 3]) +Out[28]: + +[1, 2, 3] +Length: 3, dtype: Int64 +``` + +On their own, a `PandasArray` isn’t a very useful object. +But if you need write low-level code that works generically for any +[`ExtensionArray`](../reference/api/pandas.api.extensions.ExtensionArray.html#pandas.api.extensions.ExtensionArray "pandas.api.extensions.ExtensionArray"), `PandasArray` +satisfies that need. + +Notice that by default, if no `dtype` is specified, the dtype of the returned +array is inferred from the data. In particular, note that the first example of +`[1, 2, np.nan]` would have returned a floating-point array, since `NaN` +is a float. + +```None +In [29]: pd.array([1, 2, np.nan]) +Out[29]: + +[1, 2, ] +Length: 3, dtype: Int64 +``` + +### Storing Interval and Period data in Series and DataFrame[#](#storing-interval-and-period-data-in-series-and-dataframe "Link to this heading") + +[`Interval`](../reference/api/pandas.Interval.html#pandas.Interval "pandas.Interval") and [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") data may now be stored in a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame"), in addition to an +[`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") and [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") like previously ([GH 19453](https://github.com/pandas-dev/pandas/issues/19453), [GH 22862](https://github.com/pandas-dev/pandas/issues/22862)). + +```None +In [30]: ser = pd.Series(pd.interval_range(0, 5)) + +In [31]: ser +Out[31]: +0 (0, 1] +1 (1, 2] +2 (2, 3] +3 (3, 4] +4 (4, 5] +Length: 5, dtype: interval + +In [32]: ser.dtype +Out[32]: interval[int64, right] +``` + +For periods: + +```None +In [33]: pser = pd.Series(pd.period_range("2000", freq="D", periods=5)) + +In [34]: pser +Out[34]: +0 2000-01-01 +1 2000-01-02 +2 2000-01-03 +3 2000-01-04 +4 2000-01-05 +Length: 5, dtype: period[D] + +In [35]: pser.dtype +Out[35]: period[D] +``` + +Previously, these would be cast to a NumPy array with object dtype. In general, +this should result in better performance when storing an array of intervals or periods +in a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or column of a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame"). + +Use [`Series.array`](../reference/api/pandas.Series.array.html#pandas.Series.array "pandas.Series.array") to extract the underlying array of intervals or periods +from the `Series`: + +```None +In [36]: ser.array +Out[36]: + +[(0, 1], (1, 2], (2, 3], (3, 4], (4, 5]] +Length: 5, dtype: interval[int64, right] + +In [37]: pser.array +Out[37]: + +['2000-01-01', '2000-01-02', '2000-01-03', '2000-01-04', '2000-01-05'] +Length: 5, dtype: period[D] +``` + +These return an instance of [`arrays.IntervalArray`](../reference/api/pandas.arrays.IntervalArray.html#pandas.arrays.IntervalArray "pandas.arrays.IntervalArray") or [`arrays.PeriodArray`](../reference/api/pandas.arrays.PeriodArray.html#pandas.arrays.PeriodArray "pandas.arrays.PeriodArray"), +the new extension arrays that back interval and period data. + +Warning + +For backwards compatibility, [`Series.values`](../reference/api/pandas.Series.values.html#pandas.Series.values "pandas.Series.values") continues to return +a NumPy array of objects for Interval and Period data. We recommend +using [`Series.array`](../reference/api/pandas.Series.array.html#pandas.Series.array "pandas.Series.array") when you need the array of data stored in the +`Series`, and [`Series.to_numpy()`](../reference/api/pandas.Series.to_numpy.html#pandas.Series.to_numpy "pandas.Series.to_numpy") when you know you need a NumPy array. + +See [Dtypes](../user_guide/basics.html#basics-dtypes) and [Attributes and Underlying Data](../user_guide/basics.html#basics-attrs) +for more. + +### Joining with two multi-indexes[#](#joining-with-two-multi-indexes "Link to this heading") + +[`DataFrame.merge()`](../reference/api/pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge") and [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") can now be used to join multi-indexed `Dataframe` instances on the overlapping index levels ([GH 6360](https://github.com/pandas-dev/pandas/issues/6360)) + +See the [Merge, join, and concatenate](../user_guide/merging.html#merging-join-with-two-multi-indexes) documentation section. + +```None +In [38]: index_left = pd.MultiIndex.from_tuples([('K0', 'X0'), ('K0', 'X1'), + ....: ('K1', 'X2')], + ....: names=['key', 'X']) + ....: + +In [39]: left = pd.DataFrame({'A': ['A0', 'A1', 'A2'], + ....: 'B': ['B0', 'B1', 'B2']}, index=index_left) + ....: + +In [40]: index_right = pd.MultiIndex.from_tuples([('K0', 'Y0'), ('K1', 'Y1'), + ....: ('K2', 'Y2'), ('K2', 'Y3')], + ....: names=['key', 'Y']) + ....: + +In [41]: right = pd.DataFrame({'C': ['C0', 'C1', 'C2', 'C3'], + ....: 'D': ['D0', 'D1', 'D2', 'D3']}, index=index_right) + ....: + +In [42]: left.join(right) +Out[42]: + A B C D +key X Y +K0 X0 Y0 A0 B0 C0 D0 + X1 Y0 A1 B1 C0 D0 +K1 X2 Y1 A2 B2 C1 D1 + +[3 rows x 4 columns] +``` + +For earlier versions this can be done using the following. + +```None +In [43]: pd.merge(left.reset_index(), right.reset_index(), + ....: on=['key'], how='inner').set_index(['key', 'X', 'Y']) + ....: +Out[43]: + A B C D +key X Y +K0 X0 Y0 A0 B0 C0 D0 + X1 Y0 A1 B1 C0 D0 +K1 X2 Y1 A2 B2 C1 D1 + +[3 rows x 4 columns] +``` + +### Function `read_html` enhancements[#](#function-read-html-enhancements "Link to this heading") + +[`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") previously ignored `colspan` and `rowspan` attributes. +Now it understands them, treating them as sequences of cells with the same +value. ([GH 17054](https://github.com/pandas-dev/pandas/issues/17054)) + +```None +In [44]: from io import StringIO + +In [45]: result = pd.read_html(StringIO(""" + ....:
+ ....: + ....: + ....: + ....: + ....: + ....: + ....: + ....: + ....: + ....: + ....:
ABC
12
""")) + ....: +``` + +*Previous behavior*: + +```None +In [13]: result +Out [13]: +[ A B C + 0 1 2 NaN] +``` + +*New behavior*: + +```None +In [46]: result +Out[46]: +[ A B C + 0 1 1 2 + + [1 rows x 3 columns]] +``` + +### New `Styler.pipe()` method[#](#new-styler-pipe-method "Link to this heading") + +The [`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") class has gained a +[`pipe()`](../reference/api/pandas.io.formats.style.Styler.pipe.html#pandas.io.formats.style.Styler.pipe "pandas.io.formats.style.Styler.pipe") method. This provides a +convenient way to apply users’ predefined styling functions, and can help reduce +“boilerplate” when using DataFrame styling functionality repeatedly within a notebook. ([GH 23229](https://github.com/pandas-dev/pandas/issues/23229)) + +```None +In [47]: df = pd.DataFrame({'N': [1250, 1500, 1750], 'X': [0.25, 0.35, 0.50]}) + +In [48]: def format_and_align(styler): + ....: return (styler.format({'N': '{:,}', 'X': '{:.1%}'}) + ....: .set_properties(**{'text-align': 'right'})) + ....: + +In [49]: df.style.pipe(format_and_align).set_caption('Summary of results.') +Out[49]: +``` + +Similar methods already exist for other classes in pandas, including [`DataFrame.pipe()`](../reference/api/pandas.DataFrame.pipe.html#pandas.DataFrame.pipe "pandas.DataFrame.pipe"), +`GroupBy.pipe()`, and [`Resampler.pipe()`](../reference/api/pandas.core.resample.Resampler.pipe.html#pandas.core.resample.Resampler.pipe "pandas.core.resample.Resampler.pipe"). + +### Renaming names in a MultiIndex[#](#renaming-names-in-a-multiindex "Link to this heading") + +[`DataFrame.rename_axis()`](../reference/api/pandas.DataFrame.rename_axis.html#pandas.DataFrame.rename_axis "pandas.DataFrame.rename_axis") now supports `index` and `columns` arguments +and [`Series.rename_axis()`](../reference/api/pandas.Series.rename_axis.html#pandas.Series.rename_axis "pandas.Series.rename_axis") supports `index` argument ([GH 19978](https://github.com/pandas-dev/pandas/issues/19978)). + +This change allows a dictionary to be passed so that some of the names +of a `MultiIndex` can be changed. + +Example: + +```None +In [50]: mi = pd.MultiIndex.from_product([list('AB'), list('CD'), list('EF')], + ....: names=['AB', 'CD', 'EF']) + ....: + +In [51]: df = pd.DataFrame(list(range(len(mi))), index=mi, columns=['N']) + +In [52]: df +Out[52]: + N +AB CD EF +A C E 0 + F 1 + D E 2 + F 3 +B C E 4 + F 5 + D E 6 + F 7 + +[8 rows x 1 columns] + +In [53]: df.rename_axis(index={'CD': 'New'}) +Out[53]: + N +AB New EF +A C E 0 + F 1 + D E 2 + F 3 +B C E 4 + F 5 + D E 6 + F 7 + +[8 rows x 1 columns] +``` + +See the [Advanced documentation on renaming](../user_guide/advanced.html#advanced-index-names) for more details. + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") now directly allows merge between objects of type `DataFrame` and named `Series`, without the need to convert the `Series` object into a `DataFrame` beforehand ([GH 21220](https://github.com/pandas-dev/pandas/issues/21220)) +* `ExcelWriter` now accepts `mode` as a keyword argument, enabling append to existing workbooks when using the `openpyxl` engine ([GH 3441](https://github.com/pandas-dev/pandas/issues/3441)) +* `FrozenList` has gained the `.union()` and `.difference()` methods. This functionality greatly simplifies groupby’s that rely on explicitly excluding certain columns. See [Splitting an object into groups](../user_guide/groupby.html#groupby-split) for more information ([GH 15475](https://github.com/pandas-dev/pandas/issues/15475), [GH 15506](https://github.com/pandas-dev/pandas/issues/15506)). +* [`DataFrame.to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") now accepts `index` as an argument, allowing + the user to override the engine’s default behavior to include or omit the + dataframe’s indexes from the resulting Parquet file. ([GH 20768](https://github.com/pandas-dev/pandas/issues/20768)) +* [`read_feather()`](../reference/api/pandas.read_feather.html#pandas.read_feather "pandas.read_feather") now accepts `columns` as an argument, allowing the user to specify which columns should be read. ([GH 24025](https://github.com/pandas-dev/pandas/issues/24025)) +* [`DataFrame.corr()`](../reference/api/pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr") and [`Series.corr()`](../reference/api/pandas.Series.corr.html#pandas.Series.corr "pandas.Series.corr") now accept a callable for generic calculation methods of correlation, e.g. histogram intersection ([GH 22684](https://github.com/pandas-dev/pandas/issues/22684)) +* [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string") now accepts `decimal` as an argument, allowing the user to specify which decimal separator should be used in the output. ([GH 23614](https://github.com/pandas-dev/pandas/issues/23614)) +* [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") now accepts `render_links` as an argument, allowing the user to generate HTML with links to any URLs that appear in the DataFrame. + See the [section on writing HTML](../user_guide/io.html#io-html) in the IO docs for example usage. ([GH 2679](https://github.com/pandas-dev/pandas/issues/2679)) +* [`pandas.read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") now supports pandas extension types as an argument to `dtype`, allowing the user to use pandas extension types when reading CSVs. ([GH 23228](https://github.com/pandas-dev/pandas/issues/23228)) +* The [`shift()`](../reference/api/pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift") method now accepts `fill_value` as an argument, allowing the user to specify a value which will be used instead of NA/NaT in the empty periods. ([GH 15486](https://github.com/pandas-dev/pandas/issues/15486)) +* [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") now supports the `%Z` and `%z` directive when passed into `format` ([GH 13486](https://github.com/pandas-dev/pandas/issues/13486)) +* [`Series.mode()`](../reference/api/pandas.Series.mode.html#pandas.Series.mode "pandas.Series.mode") and [`DataFrame.mode()`](../reference/api/pandas.DataFrame.mode.html#pandas.DataFrame.mode "pandas.DataFrame.mode") now support the `dropna` parameter which can be used to specify whether `NaN`/`NaT` values should be considered ([GH 17534](https://github.com/pandas-dev/pandas/issues/17534)) +* [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") and [`Series.to_csv()`](../reference/api/pandas.Series.to_csv.html#pandas.Series.to_csv "pandas.Series.to_csv") now support the `compression` keyword when a file handle is passed. ([GH 21227](https://github.com/pandas-dev/pandas/issues/21227)) +* [`Index.droplevel()`](../reference/api/pandas.Index.droplevel.html#pandas.Index.droplevel "pandas.Index.droplevel") is now implemented also for flat indexes, for compatibility with [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 21115](https://github.com/pandas-dev/pandas/issues/21115)) +* [`Series.droplevel()`](../reference/api/pandas.Series.droplevel.html#pandas.Series.droplevel "pandas.Series.droplevel") and [`DataFrame.droplevel()`](../reference/api/pandas.DataFrame.droplevel.html#pandas.DataFrame.droplevel "pandas.DataFrame.droplevel") are now implemented ([GH 20342](https://github.com/pandas-dev/pandas/issues/20342)) +* Added support for reading from/writing to Google Cloud Storage via the `gcsfs` library ([GH 19454](https://github.com/pandas-dev/pandas/issues/19454), [GH 23094](https://github.com/pandas-dev/pandas/issues/23094)) +* [`DataFrame.to_gbq()`](../reference/api/pandas.DataFrame.to_gbq.html#pandas.DataFrame.to_gbq "pandas.DataFrame.to_gbq") and [`read_gbq()`](../reference/api/pandas.read_gbq.html#pandas.read_gbq "pandas.read_gbq") signature and documentation updated to + reflect changes from the [pandas-gbq library version 0.8.0](https://pandas-gbq.readthedocs.io/en/latest/changelog.html#changelog-0-8-0). + Adds a `credentials` argument, which enables the use of any kind of + [google-auth credentials](https://google-auth.readthedocs.io/en/latest/). ([GH 21627](https://github.com/pandas-dev/pandas/issues/21627), + [GH 22557](https://github.com/pandas-dev/pandas/issues/22557), [GH 23662](https://github.com/pandas-dev/pandas/issues/23662)) +* New method [`HDFStore.walk()`](../reference/api/pandas.HDFStore.walk.html#pandas.HDFStore.walk "pandas.HDFStore.walk") will recursively walk the group hierarchy of an HDF5 file ([GH 10932](https://github.com/pandas-dev/pandas/issues/10932)) +* [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") copies cell data across `colspan` and `rowspan`, and it treats all-`th` table rows as headers if `header` kwarg is not given and there is no `thead` ([GH 17054](https://github.com/pandas-dev/pandas/issues/17054)) +* [`Series.nlargest()`](../reference/api/pandas.Series.nlargest.html#pandas.Series.nlargest "pandas.Series.nlargest"), [`Series.nsmallest()`](../reference/api/pandas.Series.nsmallest.html#pandas.Series.nsmallest "pandas.Series.nsmallest"), [`DataFrame.nlargest()`](../reference/api/pandas.DataFrame.nlargest.html#pandas.DataFrame.nlargest "pandas.DataFrame.nlargest"), and [`DataFrame.nsmallest()`](../reference/api/pandas.DataFrame.nsmallest.html#pandas.DataFrame.nsmallest "pandas.DataFrame.nsmallest") now accept the value `"all"` for the `keep` argument. This keeps all ties for the nth largest/smallest value ([GH 16818](https://github.com/pandas-dev/pandas/issues/16818)) +* [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") has gained the [`set_closed()`](../reference/api/pandas.IntervalIndex.set_closed.html#pandas.IntervalIndex.set_closed "pandas.IntervalIndex.set_closed") method to change the existing `closed` value ([GH 21670](https://github.com/pandas-dev/pandas/issues/21670)) +* [`to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv"), [`to_csv()`](../reference/api/pandas.Series.to_csv.html#pandas.Series.to_csv "pandas.Series.to_csv"), [`to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json"), and [`to_json()`](../reference/api/pandas.Series.to_json.html#pandas.Series.to_json "pandas.Series.to_json") now support `compression='infer'` to infer compression based on filename extension ([GH 15008](https://github.com/pandas-dev/pandas/issues/15008)). + The default compression for `to_csv`, `to_json`, and `to_pickle` methods has been updated to `'infer'` ([GH 22004](https://github.com/pandas-dev/pandas/issues/22004)). +* [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") now supports writing `TIMESTAMP WITH TIME ZONE` types for supported databases. For databases that don’t support timezones, datetime data will be stored as timezone unaware local timestamps. See the [Datetime data types](../user_guide/io.html#io-sql-datetime-data) for implications ([GH 9086](https://github.com/pandas-dev/pandas/issues/9086)). +* [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta") now supports iso-formatted timedelta strings ([GH 21877](https://github.com/pandas-dev/pandas/issues/21877)) +* [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") now support `Iterable` objects in the constructor ([GH 2193](https://github.com/pandas-dev/pandas/issues/2193)) +* [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") has gained the [`DatetimeIndex.timetz`](../reference/api/pandas.DatetimeIndex.timetz.html#pandas.DatetimeIndex.timetz "pandas.DatetimeIndex.timetz") attribute. This returns the local time with timezone information. ([GH 21358](https://github.com/pandas-dev/pandas/issues/21358)) +* [`round()`](../reference/api/pandas.Timestamp.round.html#pandas.Timestamp.round "pandas.Timestamp.round"), [`ceil()`](../reference/api/pandas.Timestamp.ceil.html#pandas.Timestamp.ceil "pandas.Timestamp.ceil"), and [`floor()`](../reference/api/pandas.Timestamp.floor.html#pandas.Timestamp.floor "pandas.Timestamp.floor") for [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") and [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") + now support an `ambiguous` argument for handling datetimes that are rounded to ambiguous times ([GH 18946](https://github.com/pandas-dev/pandas/issues/18946)) + and a `nonexistent` argument for handling datetimes that are rounded to nonexistent times. See [Nonexistent times when localizing](../user_guide/timeseries.html#timeseries-timezone-nonexistent) ([GH 22647](https://github.com/pandas-dev/pandas/issues/22647)) +* The result of [`resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") is now iterable similar to `groupby()` ([GH 15314](https://github.com/pandas-dev/pandas/issues/15314)). +* [`Series.resample()`](../reference/api/pandas.Series.resample.html#pandas.Series.resample "pandas.Series.resample") and [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") have gained the [`Resampler.quantile()`](../reference/api/pandas.core.resample.Resampler.quantile.html#pandas.core.resample.Resampler.quantile "pandas.core.resample.Resampler.quantile") ([GH 15023](https://github.com/pandas-dev/pandas/issues/15023)). +* [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") and [`Series.resample()`](../reference/api/pandas.Series.resample.html#pandas.Series.resample "pandas.Series.resample") with a [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") will now respect the `base` argument in the same fashion as with a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex"). ([GH 23882](https://github.com/pandas-dev/pandas/issues/23882)) +* [`pandas.api.types.is_list_like()`](../reference/api/pandas.api.types.is_list_like.html#pandas.api.types.is_list_like "pandas.api.types.is_list_like") has gained a keyword `allow_sets` which is `True` by default; if `False`, + all instances of `set` will not be considered “list-like” anymore ([GH 23061](https://github.com/pandas-dev/pandas/issues/23061)) +* [`Index.to_frame()`](../reference/api/pandas.Index.to_frame.html#pandas.Index.to_frame "pandas.Index.to_frame") now supports overriding column name(s) ([GH 22580](https://github.com/pandas-dev/pandas/issues/22580)). +* [`Categorical.from_codes()`](../reference/api/pandas.Categorical.from_codes.html#pandas.Categorical.from_codes "pandas.Categorical.from_codes") now can take a `dtype` parameter as an alternative to passing `categories` and `ordered` ([GH 24398](https://github.com/pandas-dev/pandas/issues/24398)). +* New attribute `__git_version__` will return git commit sha of current build ([GH 21295](https://github.com/pandas-dev/pandas/issues/21295)). +* Compatibility with Matplotlib 3.0 ([GH 22790](https://github.com/pandas-dev/pandas/issues/22790)). +* Added [`Interval.overlaps()`](../reference/api/pandas.Interval.overlaps.html#pandas.Interval.overlaps "pandas.Interval.overlaps"), [`arrays.IntervalArray.overlaps()`](../reference/api/pandas.arrays.IntervalArray.overlaps.html#pandas.arrays.IntervalArray.overlaps "pandas.arrays.IntervalArray.overlaps"), and [`IntervalIndex.overlaps()`](../reference/api/pandas.IntervalIndex.overlaps.html#pandas.IntervalIndex.overlaps "pandas.IntervalIndex.overlaps") for determining overlaps between interval-like objects ([GH 21998](https://github.com/pandas-dev/pandas/issues/21998)) +* [`read_fwf()`](../reference/api/pandas.read_fwf.html#pandas.read_fwf "pandas.read_fwf") now accepts keyword `infer_nrows` ([GH 15138](https://github.com/pandas-dev/pandas/issues/15138)). +* [`to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") now supports writing a `DataFrame` as a directory of parquet files partitioned by a subset of the columns when `engine = 'pyarrow'` ([GH 23283](https://github.com/pandas-dev/pandas/issues/23283)) +* [`Timestamp.tz_localize()`](../reference/api/pandas.Timestamp.tz_localize.html#pandas.Timestamp.tz_localize "pandas.Timestamp.tz_localize"), [`DatetimeIndex.tz_localize()`](../reference/api/pandas.DatetimeIndex.tz_localize.html#pandas.DatetimeIndex.tz_localize "pandas.DatetimeIndex.tz_localize"), and [`Series.tz_localize()`](../reference/api/pandas.Series.tz_localize.html#pandas.Series.tz_localize "pandas.Series.tz_localize") have gained the `nonexistent` argument for alternative handling of nonexistent times. See [Nonexistent times when localizing](../user_guide/timeseries.html#timeseries-timezone-nonexistent) ([GH 8917](https://github.com/pandas-dev/pandas/issues/8917), [GH 24466](https://github.com/pandas-dev/pandas/issues/24466)) +* [`Index.difference()`](../reference/api/pandas.Index.difference.html#pandas.Index.difference "pandas.Index.difference"), [`Index.intersection()`](../reference/api/pandas.Index.intersection.html#pandas.Index.intersection "pandas.Index.intersection"), [`Index.union()`](../reference/api/pandas.Index.union.html#pandas.Index.union "pandas.Index.union"), and [`Index.symmetric_difference()`](../reference/api/pandas.Index.symmetric_difference.html#pandas.Index.symmetric_difference "pandas.Index.symmetric_difference") now have an optional `sort` parameter to control whether the results should be sorted if possible ([GH 17839](https://github.com/pandas-dev/pandas/issues/17839), [GH 24471](https://github.com/pandas-dev/pandas/issues/24471)) +* [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") now accepts `usecols` as a list of column names or callable ([GH 18273](https://github.com/pandas-dev/pandas/issues/18273)) +* [`MultiIndex.to_flat_index()`](../reference/api/pandas.MultiIndex.to_flat_index.html#pandas.MultiIndex.to_flat_index "pandas.MultiIndex.to_flat_index") has been added to flatten multiple levels into a single-level [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") object. +* [`DataFrame.to_stata()`](../reference/api/pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata") and `pandas.io.stata.StataWriter117` can write mixed string columns to Stata strl format ([GH 23633](https://github.com/pandas-dev/pandas/issues/23633)) +* [`DataFrame.between_time()`](../reference/api/pandas.DataFrame.between_time.html#pandas.DataFrame.between_time "pandas.DataFrame.between_time") and [`DataFrame.at_time()`](../reference/api/pandas.DataFrame.at_time.html#pandas.DataFrame.at_time "pandas.DataFrame.at_time") have gained the `axis` parameter ([GH 8839](https://github.com/pandas-dev/pandas/issues/8839)) +* [`DataFrame.to_records()`](../reference/api/pandas.DataFrame.to_records.html#pandas.DataFrame.to_records "pandas.DataFrame.to_records") now accepts `index_dtypes` and `column_dtypes` parameters to allow different data types in stored column and index records ([GH 18146](https://github.com/pandas-dev/pandas/issues/18146)) +* [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") has gained the [`is_overlapping`](../reference/api/pandas.IntervalIndex.is_overlapping.html#pandas.IntervalIndex.is_overlapping "pandas.IntervalIndex.is_overlapping") attribute to indicate if the `IntervalIndex` contains any overlapping intervals ([GH 23309](https://github.com/pandas-dev/pandas/issues/23309)) +* [`pandas.DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") has gained the `method` argument to control SQL insertion clause. See the [insertion method](../user_guide/io.html#io-sql-method) section in the documentation. ([GH 8953](https://github.com/pandas-dev/pandas/issues/8953)) +* [`DataFrame.corrwith()`](../reference/api/pandas.DataFrame.corrwith.html#pandas.DataFrame.corrwith "pandas.DataFrame.corrwith") now supports Spearman’s rank correlation, Kendall’s tau as well as callable correlation methods. ([GH 21925](https://github.com/pandas-dev/pandas/issues/21925)) +* [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json"), [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv"), [`DataFrame.to_pickle()`](../reference/api/pandas.DataFrame.to_pickle.html#pandas.DataFrame.to_pickle "pandas.DataFrame.to_pickle"), and other export methods now support tilde(~) in path argument. ([GH 23473](https://github.com/pandas-dev/pandas/issues/23473)) + +## Backwards incompatible API changes[#](#backwards-incompatible-api-changes "Link to this heading") + +pandas 0.24.0 includes a number of API breaking changes. + +### Increased minimum versions for dependencies[#](#increased-minimum-versions-for-dependencies "Link to this heading") + +We have updated our minimum supported versions of dependencies ([GH 21242](https://github.com/pandas-dev/pandas/issues/21242), [GH 18742](https://github.com/pandas-dev/pandas/issues/18742), [GH 23774](https://github.com/pandas-dev/pandas/issues/23774), [GH 24767](https://github.com/pandas-dev/pandas/issues/24767)). +If installed, we now require: + +| Package | Minimum Version | Required | +| --- | --- | --- | +| numpy | 1.12.0 | X | +| bottleneck | 1.2.0 | | +| fastparquet | 0.2.1 | | +| matplotlib | 2.0.0 | | +| numexpr | 2.6.1 | | +| pandas-gbq | 0.8.0 | | +| pyarrow | 0.9.0 | | +| pytables | 3.4.2 | | +| scipy | 0.18.1 | | +| xlrd | 1.0.0 | | +| pytest (dev) | 3.6 | | + +Additionally we no longer depend on `feather-format` for feather based storage +and replaced it with references to `pyarrow` ([GH 21639](https://github.com/pandas-dev/pandas/issues/21639) and [GH 23053](https://github.com/pandas-dev/pandas/issues/23053)). + +### `os.linesep` is used for `line_terminator` of `DataFrame.to_csv`[#](#os-linesep-is-used-for-line-terminator-of-dataframe-to-csv "Link to this heading") + +[`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") now uses `os.linesep()` rather than `'\n'` +for the default line terminator ([GH 20353](https://github.com/pandas-dev/pandas/issues/20353)). +This change only affects when running on Windows, where `'\r\n'` was used for line terminator +even when `'\n'` was passed in `line_terminator`. + +*Previous behavior* on Windows: + +```None +In [1]: data = pd.DataFrame({"string_with_lf": ["a\nbc"], + ...: "string_with_crlf": ["a\r\nbc"]}) + +In [2]: # When passing file PATH to to_csv, + ...: # line_terminator does not work, and csv is saved with '\r\n'. + ...: # Also, this converts all '\n's in the data to '\r\n'. + ...: data.to_csv("test.csv", index=False, line_terminator='\n') + +In [3]: with open("test.csv", mode='rb') as f: + ...: print(f.read()) +Out[3]: b'string_with_lf,string_with_crlf\r\n"a\r\nbc","a\r\r\nbc"\r\n' + +In [4]: # When passing file OBJECT with newline option to + ...: # to_csv, line_terminator works. + ...: with open("test2.csv", mode='w', newline='\n') as f: + ...: data.to_csv(f, index=False, line_terminator='\n') + +In [5]: with open("test2.csv", mode='rb') as f: + ...: print(f.read()) +Out[5]: b'string_with_lf,string_with_crlf\n"a\nbc","a\r\nbc"\n' +``` + +*New behavior* on Windows: + +Passing `line_terminator` explicitly, set the `line terminator` to that character. + +```None +In [1]: data = pd.DataFrame({"string_with_lf": ["a\nbc"], + ...: "string_with_crlf": ["a\r\nbc"]}) + +In [2]: data.to_csv("test.csv", index=False, line_terminator='\n') + +In [3]: with open("test.csv", mode='rb') as f: + ...: print(f.read()) +Out[3]: b'string_with_lf,string_with_crlf\n"a\nbc","a\r\nbc"\n' +``` + +On Windows, the value of `os.linesep` is `'\r\n'`, so if `line_terminator` is not +set, `'\r\n'` is used for line terminator. + +```None +In [1]: data = pd.DataFrame({"string_with_lf": ["a\nbc"], + ...: "string_with_crlf": ["a\r\nbc"]}) + +In [2]: data.to_csv("test.csv", index=False) + +In [3]: with open("test.csv", mode='rb') as f: + ...: print(f.read()) +Out[3]: b'string_with_lf,string_with_crlf\r\n"a\nbc","a\r\nbc"\r\n' +``` + +For file objects, specifying `newline` is not sufficient to set the line terminator. +You must pass in the `line_terminator` explicitly, even in this case. + +```None +In [1]: data = pd.DataFrame({"string_with_lf": ["a\nbc"], + ...: "string_with_crlf": ["a\r\nbc"]}) + +In [2]: with open("test2.csv", mode='w', newline='\n') as f: + ...: data.to_csv(f, index=False) + +In [3]: with open("test2.csv", mode='rb') as f: + ...: print(f.read()) +Out[3]: b'string_with_lf,string_with_crlf\r\n"a\nbc","a\r\nbc"\r\n' +``` + +### Proper handling of `np.nan` in a string data-typed column with the Python engine[#](#proper-handling-of-np-nan-in-a-string-data-typed-column-with-the-python-engine "Link to this heading") + +There was bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") and [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") with the Python +engine, where missing values turned to `'nan'` with `dtype=str` and +`na_filter=True`. Now, these missing values are converted to the string +missing indicator, `np.nan`. ([GH 20377](https://github.com/pandas-dev/pandas/issues/20377)) + +*Previous behavior*: + +```None +In [5]: data = 'a,b,c\n1,,3\n4,5,6' +In [6]: df = pd.read_csv(StringIO(data), engine='python', dtype=str, na_filter=True) +In [7]: df.loc[0, 'b'] +Out[7]: +'nan' +``` + +*New behavior*: + +```None +In [54]: data = 'a,b,c\n1,,3\n4,5,6' + +In [55]: df = pd.read_csv(StringIO(data), engine='python', dtype=str, na_filter=True) + +In [56]: df.loc[0, 'b'] +Out[56]: nan +``` + +Notice how we now instead output `np.nan` itself instead of a stringified form of it. + +### Parsing datetime strings with timezone offsets[#](#parsing-datetime-strings-with-timezone-offsets "Link to this heading") + +Previously, parsing datetime strings with UTC offsets with [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") +or [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") would automatically convert the datetime to UTC +without timezone localization. This is inconsistent from parsing the same +datetime string with [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") which would preserve the UTC +offset in the `tz` attribute. Now, [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") preserves the UTC +offset in the `tz` attribute when all the datetime strings have the same +UTC offset ([GH 17697](https://github.com/pandas-dev/pandas/issues/17697), [GH 11736](https://github.com/pandas-dev/pandas/issues/11736), [GH 22457](https://github.com/pandas-dev/pandas/issues/22457)) + +*Previous behavior*: + +```None +In [2]: pd.to_datetime("2015-11-18 15:30:00+05:30") +Out[2]: Timestamp('2015-11-18 10:00:00') + +In [3]: pd.Timestamp("2015-11-18 15:30:00+05:30") +Out[3]: Timestamp('2015-11-18 15:30:00+0530', tz='pytz.FixedOffset(330)') + +# Different UTC offsets would automatically convert the datetimes to UTC (without a UTC timezone) +In [4]: pd.to_datetime(["2015-11-18 15:30:00+05:30", "2015-11-18 16:30:00+06:30"]) +Out[4]: DatetimeIndex(['2015-11-18 10:00:00', '2015-11-18 10:00:00'], dtype='datetime64[ns]', freq=None) +``` + +*New behavior*: + +```None +In [57]: pd.to_datetime("2015-11-18 15:30:00+05:30") +Out[57]: Timestamp('2015-11-18 15:30:00+0530', tz='UTC+05:30') + +In [58]: pd.Timestamp("2015-11-18 15:30:00+05:30") +Out[58]: Timestamp('2015-11-18 15:30:00+0530', tz='UTC+05:30') +``` + +Parsing datetime strings with the same UTC offset will preserve the UTC offset in the `tz` + +```None +In [59]: pd.to_datetime(["2015-11-18 15:30:00+05:30"] * 2) +Out[59]: DatetimeIndex(['2015-11-18 15:30:00+05:30', '2015-11-18 15:30:00+05:30'], dtype='datetime64[ns, UTC+05:30]', freq=None) +``` + +Parsing datetime strings with different UTC offsets will now create an Index of +`datetime.datetime` objects with different UTC offsets + +```None +In [59]: idx = pd.to_datetime(["2015-11-18 15:30:00+05:30", + "2015-11-18 16:30:00+06:30"]) + +In[60]: idx +Out[60]: Index([2015-11-18 15:30:00+05:30, 2015-11-18 16:30:00+06:30], dtype='object') + +In[61]: idx[0] +Out[61]: Timestamp('2015-11-18 15:30:00+0530', tz='UTC+05:30') + +In[62]: idx[1] +Out[62]: Timestamp('2015-11-18 16:30:00+0630', tz='UTC+06:30') +``` + +Passing `utc=True` will mimic the previous behavior but will correctly indicate +that the dates have been converted to UTC + +```None +In [60]: pd.to_datetime(["2015-11-18 15:30:00+05:30", + ....: "2015-11-18 16:30:00+06:30"], utc=True) + ....: +Out[60]: DatetimeIndex(['2015-11-18 10:00:00+00:00', '2015-11-18 10:00:00+00:00'], dtype='datetime64[ns, UTC]', freq=None) +``` + +### Parsing mixed-timezones with [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv")[#](#parsing-mixed-timezones-with-read-csv "Link to this heading") + +[`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") no longer silently converts mixed-timezone columns to UTC ([GH 24987](https://github.com/pandas-dev/pandas/issues/24987)). + +*Previous behavior* + +```None +>>> import io +>>> content = """\ +... a +... 2000-01-01T00:00:00+05:00 +... 2000-01-01T00:00:00+06:00""" +>>> df = pd.read_csv(io.StringIO(content), parse_dates=['a']) +>>> df.a +0 1999-12-31 19:00:00 +1 1999-12-31 18:00:00 +Name: a, dtype: datetime64[ns] +``` + +*New behavior* + +```None +In[64]: import io + +In[65]: content = """\ + ...: a + ...: 2000-01-01T00:00:00+05:00 + ...: 2000-01-01T00:00:00+06:00""" + +In[66]: df = pd.read_csv(io.StringIO(content), parse_dates=['a']) + +In[67]: df.a +Out[67]: +0 2000-01-01 00:00:00+05:00 +1 2000-01-01 00:00:00+06:00 +Name: a, Length: 2, dtype: object +``` + +As can be seen, the `dtype` is object; each value in the column is a string. +To convert the strings to an array of datetimes, the `date_parser` argument + +```None +In [3]: df = pd.read_csv( + ...: io.StringIO(content), + ...: parse_dates=['a'], + ...: date_parser=lambda col: pd.to_datetime(col, utc=True), + ...: ) + +In [4]: df.a +Out[4]: +0 1999-12-31 19:00:00+00:00 +1 1999-12-31 18:00:00+00:00 +Name: a, dtype: datetime64[ns, UTC] +``` + +See [Parsing datetime strings with timezone offsets](#whatsnew-0240-api-timezone-offset-parsing) for more. + +### Time values in `dt.end_time` and `to_timestamp(how='end')`[#](#time-values-in-dt-end-time-and-to-timestamp-how-end "Link to this heading") + +The time values in [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") and [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") objects are now set +to ‘23:59:59.999999999’ when calling [`Series.dt.end_time`](../reference/api/pandas.Series.dt.end_time.html#pandas.Series.dt.end_time "pandas.Series.dt.end_time"), [`Period.end_time`](../reference/api/pandas.Period.end_time.html#pandas.Period.end_time "pandas.Period.end_time"), +[`PeriodIndex.end_time`](../reference/api/pandas.PeriodIndex.end_time.html#pandas.PeriodIndex.end_time "pandas.PeriodIndex.end_time"), [`Period.to_timestamp()`](../reference/api/pandas.Period.to_timestamp.html#pandas.Period.to_timestamp "pandas.Period.to_timestamp") with `how='end'`, +or [`PeriodIndex.to_timestamp()`](../reference/api/pandas.PeriodIndex.to_timestamp.html#pandas.PeriodIndex.to_timestamp "pandas.PeriodIndex.to_timestamp") with `how='end'` ([GH 17157](https://github.com/pandas-dev/pandas/issues/17157)) + +*Previous behavior*: + +```None +In [2]: p = pd.Period('2017-01-01', 'D') +In [3]: pi = pd.PeriodIndex([p]) + +In [4]: pd.Series(pi).dt.end_time[0] +Out[4]: Timestamp(2017-01-01 00:00:00) + +In [5]: p.end_time +Out[5]: Timestamp(2017-01-01 23:59:59.999999999) +``` + +*New behavior*: + +Calling [`Series.dt.end_time`](../reference/api/pandas.Series.dt.end_time.html#pandas.Series.dt.end_time "pandas.Series.dt.end_time") will now result in a time of ‘23:59:59.999999999’ as +is the case with [`Period.end_time`](../reference/api/pandas.Period.end_time.html#pandas.Period.end_time "pandas.Period.end_time"), for example + +```None +In [61]: p = pd.Period('2017-01-01', 'D') + +In [62]: pi = pd.PeriodIndex([p]) + +In [63]: pd.Series(pi).dt.end_time[0] +Out[63]: Timestamp('2017-01-01 23:59:59.999999999') + +In [64]: p.end_time +Out[64]: Timestamp('2017-01-01 23:59:59.999999999') +``` + +### Series.unique for timezone-aware data[#](#series-unique-for-timezone-aware-data "Link to this heading") + +The return type of [`Series.unique()`](../reference/api/pandas.Series.unique.html#pandas.Series.unique "pandas.Series.unique") for datetime with timezone values has changed +from an [`numpy.ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.3)") of [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") objects to a [`arrays.DatetimeArray`](../reference/api/pandas.arrays.DatetimeArray.html#pandas.arrays.DatetimeArray "pandas.arrays.DatetimeArray") ([GH 24024](https://github.com/pandas-dev/pandas/issues/24024)). + +```None +In [65]: ser = pd.Series([pd.Timestamp('2000', tz='UTC'), + ....: pd.Timestamp('2000', tz='UTC')]) + ....: +``` + +*Previous behavior*: + +```None +In [3]: ser.unique() +Out[3]: array([Timestamp('2000-01-01 00:00:00+0000', tz='UTC')], dtype=object) +``` + +*New behavior*: + +```None +In [66]: ser.unique() +Out[66]: + +['2000-01-01 00:00:00+00:00'] +Length: 1, dtype: datetime64[ns, UTC] +``` + +### Sparse data structure refactor[#](#sparse-data-structure-refactor "Link to this heading") + +`SparseArray`, the array backing `SparseSeries` and the columns in a `SparseDataFrame`, +is now an extension array ([GH 21978](https://github.com/pandas-dev/pandas/issues/21978), [GH 19056](https://github.com/pandas-dev/pandas/issues/19056), [GH 22835](https://github.com/pandas-dev/pandas/issues/22835)). +To conform to this interface and for consistency with the rest of pandas, some API breaking +changes were made: + +* `SparseArray` is no longer a subclass of [`numpy.ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.3)"). To convert a `SparseArray` to a NumPy array, use [`numpy.asarray()`](https://numpy.org/doc/stable/reference/generated/numpy.asarray.html#numpy.asarray "(in NumPy v2.3)"). +* `SparseArray.dtype` and `SparseSeries.dtype` are now instances of [`SparseDtype`](../reference/api/pandas.SparseDtype.html#pandas.SparseDtype "pandas.SparseDtype"), rather than `np.dtype`. Access the underlying dtype with `SparseDtype.subtype`. +* `numpy.asarray(sparse_array)` now returns a dense array with all the values, not just the non-fill-value values ([GH 14167](https://github.com/pandas-dev/pandas/issues/14167)) +* `SparseArray.take` now matches the API of [`pandas.api.extensions.ExtensionArray.take()`](../reference/api/pandas.api.extensions.ExtensionArray.take.html#pandas.api.extensions.ExtensionArray.take "pandas.api.extensions.ExtensionArray.take") ([GH 19506](https://github.com/pandas-dev/pandas/issues/19506)): + + + The default value of `allow_fill` has changed from `False` to `True`. + + The `out` and `mode` parameters are now longer accepted (previously, this raised if they were specified). + + Passing a scalar for `indices` is no longer allowed. +* The result of [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") with a mix of sparse and dense Series is a Series with sparse values, rather than a `SparseSeries`. +* `SparseDataFrame.combine` and `DataFrame.combine_first` no longer supports combining a sparse column with a dense column while preserving the sparse subtype. The result will be an object-dtype SparseArray. +* Setting `SparseArray.fill_value` to a fill value with a different dtype is now allowed. +* `DataFrame[column]` is now a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with sparse values, rather than a `SparseSeries`, when slicing a single column with sparse values ([GH 23559](https://github.com/pandas-dev/pandas/issues/23559)). +* The result of [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where") is now a `Series` with sparse values, like with other extension arrays ([GH 24077](https://github.com/pandas-dev/pandas/issues/24077)) + +Some new warnings are issued for operations that require or are likely to materialize a large dense array: + +* A [`errors.PerformanceWarning`](../reference/api/pandas.errors.PerformanceWarning.html#pandas.errors.PerformanceWarning "pandas.errors.PerformanceWarning") is issued when using fillna with a `method`, as a dense array is constructed to create the filled array. Filling with a `value` is the efficient way to fill a sparse array. +* A [`errors.PerformanceWarning`](../reference/api/pandas.errors.PerformanceWarning.html#pandas.errors.PerformanceWarning "pandas.errors.PerformanceWarning") is now issued when concatenating sparse Series with differing fill values. The fill value from the first sparse array continues to be used. + +In addition to these API breaking changes, many [Performance Improvements and Bug Fixes have been made](#whatsnew-0240-bug-fixes-sparse). + +Finally, a `Series.sparse` accessor was added to provide sparse-specific methods like [`Series.sparse.from_coo()`](../reference/api/pandas.Series.sparse.from_coo.html#pandas.Series.sparse.from_coo "pandas.Series.sparse.from_coo"). + +```None +In [67]: s = pd.Series([0, 0, 1, 1, 1], dtype='Sparse[int]') + +In [68]: s.sparse.density +Out[68]: 0.6 +``` + +### [`get_dummies()`](../reference/api/pandas.get_dummies.html#pandas.get_dummies "pandas.get_dummies") always returns a DataFrame[#](#get-dummies-always-returns-a-dataframe "Link to this heading") + +Previously, when `sparse=True` was passed to [`get_dummies()`](../reference/api/pandas.get_dummies.html#pandas.get_dummies "pandas.get_dummies"), the return value could be either +a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") or a `SparseDataFrame`, depending on whether all or a just a subset +of the columns were dummy-encoded. Now, a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") is always returned ([GH 24284](https://github.com/pandas-dev/pandas/issues/24284)). + +*Previous behavior* + +The first [`get_dummies()`](../reference/api/pandas.get_dummies.html#pandas.get_dummies "pandas.get_dummies") returns a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") because the column `A` +is not dummy encoded. When just `["B", "C"]` are passed to `get_dummies`, +then all the columns are dummy-encoded, and a `SparseDataFrame` was returned. + +```None +In [2]: df = pd.DataFrame({"A": [1, 2], "B": ['a', 'b'], "C": ['a', 'a']}) + +In [3]: type(pd.get_dummies(df, sparse=True)) +Out[3]: pandas.core.frame.DataFrame + +In [4]: type(pd.get_dummies(df[['B', 'C']], sparse=True)) +Out[4]: pandas.core.sparse.frame.SparseDataFrame +``` + +*New behavior* + +Now, the return type is consistently a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame"). + +```None +In [69]: type(pd.get_dummies(df, sparse=True)) +Out[69]: pandas.core.frame.DataFrame + +In [70]: type(pd.get_dummies(df[['B', 'C']], sparse=True)) +Out[70]: pandas.core.frame.DataFrame +``` + +Note + +There’s no difference in memory usage between a `SparseDataFrame` +and a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with sparse values. The memory usage will +be the same as in the previous version of pandas. + +### Raise ValueError in `DataFrame.to_dict(orient='index')`[#](#raise-valueerror-in-dataframe-to-dict-orient-index "Link to this heading") + +Bug in [`DataFrame.to_dict()`](../reference/api/pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict") raises `ValueError` when used with +`orient='index'` and a non-unique index instead of losing data ([GH 22801](https://github.com/pandas-dev/pandas/issues/22801)) + +```None +In [71]: df = pd.DataFrame({'a': [1, 2], 'b': [0.5, 0.75]}, index=['A', 'A']) + +In [72]: df +Out[72]: + a b +A 1 0.50 +A 2 0.75 + +[2 rows x 2 columns] + +In [73]: df.to_dict(orient='index') +--------------------------------------------------------------------------- +ValueError Traceback (most recent call last) +Cell In[73], line 1 +----> 1 df.to_dict(orient='index') + +File ~/work/pandas/pandas/pandas/util/_decorators.py:333, in deprecate_nonkeyword_arguments..decorate..wrapper(*args, **kwargs) + 327 if len(args) > num_allow_args: + 328 warnings.warn( + 329 msg.format(arguments=_format_argument_list(allow_args)), + 330 FutureWarning, + 331 stacklevel=find_stack_level(), + 332 ) +--> 333 return func(*args, **kwargs) + +File ~/work/pandas/pandas/pandas/core/frame.py:2187, in DataFrame.to_dict(self, orient, into, index) + 2084 """ + 2085 Convert the DataFrame to a dictionary. + 2086 + (...) + 2183 defaultdict(, {'col1': 2, 'col2': 0.75})] + 2184 """ + 2185 from pandas.core.methods.to_dict import to_dict +-> 2187 return to_dict(self, orient, into=into, index=index) + +File ~/work/pandas/pandas/pandas/core/methods/to_dict.py:242, in to_dict(df, orient, into, index) + 240 elif orient == "index": + 241 if not df.index.is_unique: +--> 242 raise ValueError("DataFrame index must be unique for orient='index'.") + 243 columns = df.columns.tolist() + 244 if are_all_object_dtype_cols: + +ValueError: DataFrame index must be unique for orient='index'. +``` + +### Tick DateOffset normalize restrictions[#](#tick-dateoffset-normalize-restrictions "Link to this heading") + +Creating a `Tick` object (`Day`, `Hour`, `Minute`, +`Second`, `Milli`, `Micro`, `Nano`) with +`normalize=True` is no longer supported. This prevents unexpected behavior +where addition could fail to be monotone or associative. ([GH 21427](https://github.com/pandas-dev/pandas/issues/21427)) + +*Previous behavior*: + +```None +In [2]: ts = pd.Timestamp('2018-06-11 18:01:14') + +In [3]: ts +Out[3]: Timestamp('2018-06-11 18:01:14') + +In [4]: tic = pd.offsets.Hour(n=2, normalize=True) + ...: + +In [5]: tic +Out[5]: <2 * Hours> + +In [6]: ts + tic +Out[6]: Timestamp('2018-06-11 00:00:00') + +In [7]: ts + tic + tic + tic == ts + (tic + tic + tic) +Out[7]: False +``` + +*New behavior*: + +```None +In [74]: ts = pd.Timestamp('2018-06-11 18:01:14') + +In [75]: tic = pd.offsets.Hour(n=2) + +In [76]: ts + tic + tic + tic == ts + (tic + tic + tic) +Out[76]: True +``` + +### Period subtraction[#](#period-subtraction "Link to this heading") + +Subtraction of a `Period` from another `Period` will give a `DateOffset`. +instead of an integer ([GH 21314](https://github.com/pandas-dev/pandas/issues/21314)) + +*Previous behavior*: + +```None +In [2]: june = pd.Period('June 2018') + +In [3]: april = pd.Period('April 2018') + +In [4]: june - april +Out [4]: 2 +``` + +*New behavior*: + +```None +In [77]: june = pd.Period('June 2018') + +In [78]: april = pd.Period('April 2018') + +In [79]: june - april +Out[79]: <2 * MonthEnds> +``` + +Similarly, subtraction of a `Period` from a `PeriodIndex` will now return +an `Index` of `DateOffset` objects instead of an `Int64Index` + +*Previous behavior*: + +```None +In [2]: pi = pd.period_range('June 2018', freq='M', periods=3) + +In [3]: pi - pi[0] +Out[3]: Int64Index([0, 1, 2], dtype='int64') +``` + +*New behavior*: + +```None +In [80]: pi = pd.period_range('June 2018', freq='M', periods=3) + +In [81]: pi - pi[0] +Out[81]: Index([<0 * MonthEnds>, , <2 * MonthEnds>], dtype='object') +``` + +### Addition/subtraction of `NaN` from [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame")[#](#addition-subtraction-of-nan-from-dataframe "Link to this heading") + +Adding or subtracting `NaN` from a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") column with +`timedelta64[ns]` dtype will now raise a `TypeError` instead of returning +all-`NaT`. This is for compatibility with `TimedeltaIndex` and +`Series` behavior ([GH 22163](https://github.com/pandas-dev/pandas/issues/22163)) + +```None +In [82]: df = pd.DataFrame([pd.Timedelta(days=1)]) + +In [83]: df +Out[83]: + 0 +0 1 days + +[1 rows x 1 columns] +``` + +*Previous behavior*: + +```None +In [4]: df = pd.DataFrame([pd.Timedelta(days=1)]) + +In [5]: df - np.nan +Out[5]: + 0 +0 NaT +``` + +*New behavior*: + +```None +In [2]: df - np.nan +... +TypeError: unsupported operand type(s) for -: 'TimedeltaIndex' and 'float' +``` + +### DataFrame comparison operations broadcasting changes[#](#dataframe-comparison-operations-broadcasting-changes "Link to this heading") + +Previously, the broadcasting behavior of [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") comparison +operations (`==`, `!=`, …) was inconsistent with the behavior of +arithmetic operations (`+`, `-`, …). The behavior of the comparison +operations has been changed to match the arithmetic operations in these cases. +([GH 22880](https://github.com/pandas-dev/pandas/issues/22880)) + +The affected cases are: + +* operating against a 2-dimensional `np.ndarray` with either 1 row or 1 column will now broadcast the same way a `np.ndarray` would ([GH 23000](https://github.com/pandas-dev/pandas/issues/23000)). +* a list or tuple with length matching the number of rows in the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") will now raise `ValueError` instead of operating column-by-column ([GH 22880](https://github.com/pandas-dev/pandas/issues/22880). +* a list or tuple with length matching the number of columns in the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") will now operate row-by-row instead of raising `ValueError` ([GH 22880](https://github.com/pandas-dev/pandas/issues/22880)). + +```None +In [84]: arr = np.arange(6).reshape(3, 2) + +In [85]: df = pd.DataFrame(arr) + +In [86]: df +Out[86]: + 0 1 +0 0 1 +1 2 3 +2 4 5 + +[3 rows x 2 columns] +``` + +*Previous behavior*: + +```None +In [5]: df == arr[[0], :] + ...: # comparison previously broadcast where arithmetic would raise +Out[5]: + 0 1 +0 True True +1 False False +2 False False +In [6]: df + arr[[0], :] +... +ValueError: Unable to coerce to DataFrame, shape must be (3, 2): given (1, 2) + +In [7]: df == (1, 2) + ...: # length matches number of columns; + ...: # comparison previously raised where arithmetic would broadcast +... +ValueError: Invalid broadcasting comparison [(1, 2)] with block values +In [8]: df + (1, 2) +Out[8]: + 0 1 +0 1 3 +1 3 5 +2 5 7 + +In [9]: df == (1, 2, 3) + ...: # length matches number of rows + ...: # comparison previously broadcast where arithmetic would raise +Out[9]: + 0 1 +0 False True +1 True False +2 False False +In [10]: df + (1, 2, 3) +... +ValueError: Unable to coerce to Series, length must be 2: given 3 +``` + +*New behavior*: + +```None +# Comparison operations and arithmetic operations both broadcast. +In [87]: df == arr[[0], :] +Out[87]: + 0 1 +0 True True +1 False False +2 False False + +[3 rows x 2 columns] + +In [88]: df + arr[[0], :] +Out[88]: + 0 1 +0 0 2 +1 2 4 +2 4 6 + +[3 rows x 2 columns] +``` + +```None +# Comparison operations and arithmetic operations both broadcast. +In [89]: df == (1, 2) +Out[89]: + 0 1 +0 False False +1 False False +2 False False + +[3 rows x 2 columns] + +In [90]: df + (1, 2) +Out[90]: + 0 1 +0 1 3 +1 3 5 +2 5 7 + +[3 rows x 2 columns] +``` + +```None +# Comparison operations and arithmetic operations both raise ValueError. +In [6]: df == (1, 2, 3) +... +ValueError: Unable to coerce to Series, length must be 2: given 3 + +In [7]: df + (1, 2, 3) +... +ValueError: Unable to coerce to Series, length must be 2: given 3 +``` + +### DataFrame arithmetic operations broadcasting changes[#](#dataframe-arithmetic-operations-broadcasting-changes "Link to this heading") + +[`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") arithmetic operations when operating with 2-dimensional +`np.ndarray` objects now broadcast in the same way as `np.ndarray` +broadcast. ([GH 23000](https://github.com/pandas-dev/pandas/issues/23000)) + +```None +In [91]: arr = np.arange(6).reshape(3, 2) + +In [92]: df = pd.DataFrame(arr) + +In [93]: df +Out[93]: + 0 1 +0 0 1 +1 2 3 +2 4 5 + +[3 rows x 2 columns] +``` + +*Previous behavior*: + +```None +In [5]: df + arr[[0], :] # 1 row, 2 columns +... +ValueError: Unable to coerce to DataFrame, shape must be (3, 2): given (1, 2) +In [6]: df + arr[:, [1]] # 1 column, 3 rows +... +ValueError: Unable to coerce to DataFrame, shape must be (3, 2): given (3, 1) +``` + +*New behavior*: + +```None +In [94]: df + arr[[0], :] # 1 row, 2 columns +Out[94]: + 0 1 +0 0 2 +1 2 4 +2 4 6 + +[3 rows x 2 columns] + +In [95]: df + arr[:, [1]] # 1 column, 3 rows +Out[95]: + 0 1 +0 1 2 +1 5 6 +2 9 10 + +[3 rows x 2 columns] +``` + +### Series and Index data-dtype incompatibilities[#](#series-and-index-data-dtype-incompatibilities "Link to this heading") + +`Series` and `Index` constructors now raise when the +data is incompatible with a passed `dtype=` ([GH 15832](https://github.com/pandas-dev/pandas/issues/15832)) + +*Previous behavior*: + +```None +In [4]: pd.Series([-1], dtype="uint64") +Out [4]: +0 18446744073709551615 +dtype: uint64 +``` + +*New behavior*: + +```None +In [4]: pd.Series([-1], dtype="uint64") +Out [4]: +... +OverflowError: Trying to coerce negative values to unsigned integers +``` + +### Concatenation changes[#](#concatenation-changes "Link to this heading") + +Calling [`pandas.concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") on a `Categorical` of ints with NA values now +causes them to be processed as objects when concatenating with anything +other than another `Categorical` of ints ([GH 19214](https://github.com/pandas-dev/pandas/issues/19214)) + +```None +In [96]: s = pd.Series([0, 1, np.nan]) + +In [97]: c = pd.Series([0, 1, np.nan], dtype="category") +``` + +*Previous behavior* + +```None +In [3]: pd.concat([s, c]) +Out[3]: +0 0.0 +1 1.0 +2 NaN +0 0.0 +1 1.0 +2 NaN +dtype: float64 +``` + +*New behavior* + +```None +In [98]: pd.concat([s, c]) +Out[98]: +0 0.0 +1 1.0 +2 NaN +0 0.0 +1 1.0 +2 NaN +Length: 6, dtype: float64 +``` + +### Datetimelike API changes[#](#datetimelike-api-changes "Link to this heading") + +* For [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") and [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") with non-`None` `freq` attribute, addition or subtraction of integer-dtyped array or `Index` will return an object of the same class ([GH 19959](https://github.com/pandas-dev/pandas/issues/19959)) +* `DateOffset` objects are now immutable. Attempting to alter one of these will now raise `AttributeError` ([GH 21341](https://github.com/pandas-dev/pandas/issues/21341)) +* [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") subtraction of another `PeriodIndex` will now return an object-dtype [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") of `DateOffset` objects instead of raising a `TypeError` ([GH 20049](https://github.com/pandas-dev/pandas/issues/20049)) +* [`cut()`](../reference/api/pandas.cut.html#pandas.cut "pandas.cut") and [`qcut()`](../reference/api/pandas.qcut.html#pandas.qcut "pandas.qcut") now returns a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") or [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") bins when the input is datetime or timedelta dtype respectively and `retbins=True` ([GH 19891](https://github.com/pandas-dev/pandas/issues/19891)) +* [`DatetimeIndex.to_period()`](../reference/api/pandas.DatetimeIndex.to_period.html#pandas.DatetimeIndex.to_period "pandas.DatetimeIndex.to_period") and [`Timestamp.to_period()`](../reference/api/pandas.Timestamp.to_period.html#pandas.Timestamp.to_period "pandas.Timestamp.to_period") will issue a warning when timezone information will be lost ([GH 21333](https://github.com/pandas-dev/pandas/issues/21333)) +* `PeriodIndex.tz_convert()` and `PeriodIndex.tz_localize()` have been removed ([GH 21781](https://github.com/pandas-dev/pandas/issues/21781)) + +### Other API changes[#](#other-api-changes "Link to this heading") + +* A newly constructed empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with integer as the `dtype` will now only be cast to `float64` if `index` is specified ([GH 22858](https://github.com/pandas-dev/pandas/issues/22858)) +* [`Series.str.cat()`](../reference/api/pandas.Series.str.cat.html#pandas.Series.str.cat "pandas.Series.str.cat") will now raise if `others` is a `set` ([GH 23009](https://github.com/pandas-dev/pandas/issues/23009)) +* Passing scalar values to [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") or [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") will now raise `TypeError` instead of `ValueError` ([GH 23539](https://github.com/pandas-dev/pandas/issues/23539)) +* `max_rows` and `max_cols` parameters removed from `HTMLFormatter` since truncation is handled by `DataFrameFormatter` ([GH 23818](https://github.com/pandas-dev/pandas/issues/23818)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") will now raise a `ValueError` if a column with missing values is declared as having dtype `bool` ([GH 20591](https://github.com/pandas-dev/pandas/issues/20591)) +* The column order of the resultant [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") from [`MultiIndex.to_frame()`](../reference/api/pandas.MultiIndex.to_frame.html#pandas.MultiIndex.to_frame "pandas.MultiIndex.to_frame") is now guaranteed to match the [`MultiIndex.names`](../reference/api/pandas.MultiIndex.names.html#pandas.MultiIndex.names "pandas.MultiIndex.names") order. ([GH 22420](https://github.com/pandas-dev/pandas/issues/22420)) +* Incorrectly passing a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") to [`MultiIndex.from_tuples()`](../reference/api/pandas.MultiIndex.from_tuples.html#pandas.MultiIndex.from_tuples "pandas.MultiIndex.from_tuples"), rather than a sequence of tuples, now raises a `TypeError` rather than a `ValueError` ([GH 24024](https://github.com/pandas-dev/pandas/issues/24024)) +* `pd.offsets.generate_range()` argument `time_rule` has been removed; use `offset` instead ([GH 24157](https://github.com/pandas-dev/pandas/issues/24157)) +* In 0.23.x, pandas would raise a `ValueError` on a merge of a numeric column (e.g. `int` dtyped column) and an `object` dtyped column ([GH 9780](https://github.com/pandas-dev/pandas/issues/9780)). We have re-enabled the ability to merge `object` and other dtypes; pandas will still raise on a merge between a numeric and an `object` dtyped column that is composed only of strings ([GH 21681](https://github.com/pandas-dev/pandas/issues/21681)) +* Accessing a level of a `MultiIndex` with a duplicate name (e.g. in + [`get_level_values()`](../reference/api/pandas.MultiIndex.get_level_values.html#pandas.MultiIndex.get_level_values "pandas.MultiIndex.get_level_values")) now raises a `ValueError` instead of a `KeyError` ([GH 21678](https://github.com/pandas-dev/pandas/issues/21678)). +* Invalid construction of `IntervalDtype` will now always raise a `TypeError` rather than a `ValueError` if the subdtype is invalid ([GH 21185](https://github.com/pandas-dev/pandas/issues/21185)) +* Trying to reindex a `DataFrame` with a non unique `MultiIndex` now raises a `ValueError` instead of an `Exception` ([GH 21770](https://github.com/pandas-dev/pandas/issues/21770)) +* [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") subtraction will attempt to operate element-wise instead of raising `TypeError` ([GH 19369](https://github.com/pandas-dev/pandas/issues/19369)) +* [`pandas.io.formats.style.Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") supports a `number-format` property when using [`to_excel()`](../reference/api/pandas.io.formats.style.Styler.to_excel.html#pandas.io.formats.style.Styler.to_excel "pandas.io.formats.style.Styler.to_excel") ([GH 22015](https://github.com/pandas-dev/pandas/issues/22015)) +* [`DataFrame.corr()`](../reference/api/pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr") and [`Series.corr()`](../reference/api/pandas.Series.corr.html#pandas.Series.corr "pandas.Series.corr") now raise a `ValueError` along with a helpful error message instead of a `KeyError` when supplied with an invalid method ([GH 22298](https://github.com/pandas-dev/pandas/issues/22298)) +* `shift()` will now always return a copy, instead of the previous behaviour of returning self when shifting by 0 ([GH 22397](https://github.com/pandas-dev/pandas/issues/22397)) +* [`DataFrame.set_index()`](../reference/api/pandas.DataFrame.set_index.html#pandas.DataFrame.set_index "pandas.DataFrame.set_index") now gives a better (and less frequent) KeyError, raises a `ValueError` for incorrect types, + and will not fail on duplicate column names with `drop=True`. ([GH 22484](https://github.com/pandas-dev/pandas/issues/22484)) +* Slicing a single row of a DataFrame with multiple ExtensionArrays of the same type now preserves the dtype, rather than coercing to object ([GH 22784](https://github.com/pandas-dev/pandas/issues/22784)) +* `DateOffset` attribute `_cacheable` and method `_should_cache` have been removed ([GH 23118](https://github.com/pandas-dev/pandas/issues/23118)) +* [`Series.searchsorted()`](../reference/api/pandas.Series.searchsorted.html#pandas.Series.searchsorted "pandas.Series.searchsorted"), when supplied a scalar value to search for, now returns a scalar instead of an array ([GH 23801](https://github.com/pandas-dev/pandas/issues/23801)). +* `Categorical.searchsorted()`, when supplied a scalar value to search for, now returns a scalar instead of an array ([GH 23466](https://github.com/pandas-dev/pandas/issues/23466)). +* `Categorical.searchsorted()` now raises a `KeyError` rather that a `ValueError`, if a searched for key is not found in its categories ([GH 23466](https://github.com/pandas-dev/pandas/issues/23466)). +* [`Index.hasnans()`](../reference/api/pandas.Index.hasnans.html#pandas.Index.hasnans "pandas.Index.hasnans") and [`Series.hasnans()`](../reference/api/pandas.Series.hasnans.html#pandas.Series.hasnans "pandas.Series.hasnans") now always return a python boolean. Previously, a python or a numpy boolean could be returned, depending on circumstances ([GH 23294](https://github.com/pandas-dev/pandas/issues/23294)). +* The order of the arguments of [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") and [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string") is rearranged to be consistent with each other. ([GH 23614](https://github.com/pandas-dev/pandas/issues/23614)) +* `CategoricalIndex.reindex()` now raises a `ValueError` if the target index is non-unique and not equal to the current index. It previously only raised if the target index was not of a categorical dtype ([GH 23963](https://github.com/pandas-dev/pandas/issues/23963)). +* [`Series.to_list()`](../reference/api/pandas.Series.to_list.html#pandas.Series.to_list "pandas.Series.to_list") and [`Index.to_list()`](../reference/api/pandas.Index.to_list.html#pandas.Index.to_list "pandas.Index.to_list") are now aliases of `Series.tolist` respectively `Index.tolist` ([GH 8826](https://github.com/pandas-dev/pandas/issues/8826)) +* The result of `SparseSeries.unstack` is now a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with sparse values, rather than a `SparseDataFrame` ([GH 24372](https://github.com/pandas-dev/pandas/issues/24372)). +* [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") and [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") no longer ignore the dtype precision. Passing a non-nanosecond resolution dtype will raise a `ValueError` ([GH 24753](https://github.com/pandas-dev/pandas/issues/24753)) + +## Extension type changes[#](#extension-type-changes "Link to this heading") + +**Equality and hashability** + +pandas now requires that extension dtypes be hashable (i.e. the respective +`ExtensionDtype` objects; hashability is not a requirement for the values +of the corresponding `ExtensionArray`). The base class implements +a default `__eq__` and `__hash__`. If you have a parametrized dtype, you should +update the `ExtensionDtype._metadata` tuple to match the signature of your +`__init__` method. See [`pandas.api.extensions.ExtensionDtype`](../reference/api/pandas.api.extensions.ExtensionDtype.html#pandas.api.extensions.ExtensionDtype "pandas.api.extensions.ExtensionDtype") for more ([GH 22476](https://github.com/pandas-dev/pandas/issues/22476)). + +**New and changed methods** + +* `dropna()` has been added ([GH 21185](https://github.com/pandas-dev/pandas/issues/21185)) +* `repeat()` has been added ([GH 24349](https://github.com/pandas-dev/pandas/issues/24349)) +* The `ExtensionArray` constructor, `_from_sequence` now take the keyword arg `copy=False` ([GH 21185](https://github.com/pandas-dev/pandas/issues/21185)) +* [`pandas.api.extensions.ExtensionArray.shift()`](../reference/api/pandas.api.extensions.ExtensionArray.shift.html#pandas.api.extensions.ExtensionArray.shift "pandas.api.extensions.ExtensionArray.shift") added as part of the basic `ExtensionArray` interface ([GH 22387](https://github.com/pandas-dev/pandas/issues/22387)). +* `searchsorted()` has been added ([GH 24350](https://github.com/pandas-dev/pandas/issues/24350)) +* Support for reduction operations such as `sum`, `mean` via opt-in base class method override ([GH 22762](https://github.com/pandas-dev/pandas/issues/22762)) +* `ExtensionArray.isna()` is allowed to return an `ExtensionArray` ([GH 22325](https://github.com/pandas-dev/pandas/issues/22325)). + +**Dtype changes** + +* `ExtensionDtype` has gained the ability to instantiate from string dtypes, e.g. `decimal` would instantiate a registered `DecimalDtype`; furthermore + the `ExtensionDtype` has gained the method `construct_array_type` ([GH 21185](https://github.com/pandas-dev/pandas/issues/21185)) +* Added `ExtensionDtype._is_numeric` for controlling whether an extension dtype is considered numeric ([GH 22290](https://github.com/pandas-dev/pandas/issues/22290)). +* Added `pandas.api.types.register_extension_dtype()` to register an extension type with pandas ([GH 22664](https://github.com/pandas-dev/pandas/issues/22664)) +* Updated the `.type` attribute for `PeriodDtype`, `DatetimeTZDtype`, and `IntervalDtype` to be instances of the dtype (`Period`, `Timestamp`, and `Interval` respectively) ([GH 22938](https://github.com/pandas-dev/pandas/issues/22938)) + +**Operator support** + +A `Series` based on an `ExtensionArray` now supports arithmetic and comparison +operators ([GH 19577](https://github.com/pandas-dev/pandas/issues/19577)). There are two approaches for providing operator support for an `ExtensionArray`: + +1. Define each of the operators on your `ExtensionArray` subclass. +2. Use an operator implementation from pandas that depends on operators that are already defined + on the underlying elements (scalars) of the `ExtensionArray`. + +See the [ExtensionArray Operator Support](../development/extending.html#extending-extension-operator) documentation section for details on both +ways of adding operator support. + +**Other changes** + +* A default repr for [`pandas.api.extensions.ExtensionArray`](../reference/api/pandas.api.extensions.ExtensionArray.html#pandas.api.extensions.ExtensionArray "pandas.api.extensions.ExtensionArray") is now provided ([GH 23601](https://github.com/pandas-dev/pandas/issues/23601)). +* `ExtensionArray._formatting_values()` is deprecated. Use `ExtensionArray._formatter` instead. ([GH 23601](https://github.com/pandas-dev/pandas/issues/23601)) +* An `ExtensionArray` with a boolean dtype now works correctly as a boolean indexer. [`pandas.api.types.is_bool_dtype()`](../reference/api/pandas.api.types.is_bool_dtype.html#pandas.api.types.is_bool_dtype "pandas.api.types.is_bool_dtype") now properly considers them boolean ([GH 22326](https://github.com/pandas-dev/pandas/issues/22326)) + +**Bug fixes** + +* Bug in [`Series.get()`](../reference/api/pandas.Series.get.html#pandas.Series.get "pandas.Series.get") for `Series` using `ExtensionArray` and integer index ([GH 21257](https://github.com/pandas-dev/pandas/issues/21257)) +* [`shift()`](../reference/api/pandas.Series.shift.html#pandas.Series.shift "pandas.Series.shift") now dispatches to `ExtensionArray.shift()` ([GH 22386](https://github.com/pandas-dev/pandas/issues/22386)) +* [`Series.combine()`](../reference/api/pandas.Series.combine.html#pandas.Series.combine "pandas.Series.combine") works correctly with [`ExtensionArray`](../reference/api/pandas.api.extensions.ExtensionArray.html#pandas.api.extensions.ExtensionArray "pandas.api.extensions.ExtensionArray") inside of [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") ([GH 20825](https://github.com/pandas-dev/pandas/issues/20825)) +* [`Series.combine()`](../reference/api/pandas.Series.combine.html#pandas.Series.combine "pandas.Series.combine") with scalar argument now works for any function type ([GH 21248](https://github.com/pandas-dev/pandas/issues/21248)) +* [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") and [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") now dispatch to `ExtensionArray.astype()` ([GH 21185](https://github.com/pandas-dev/pandas/issues/21185)). +* Slicing a single row of a `DataFrame` with multiple ExtensionArrays of the same type now preserves the dtype, rather than coercing to object ([GH 22784](https://github.com/pandas-dev/pandas/issues/22784)) +* Bug when concatenating multiple `Series` with different extension dtypes not casting to object dtype ([GH 22994](https://github.com/pandas-dev/pandas/issues/22994)) +* Series backed by an `ExtensionArray` now work with [`util.hash_pandas_object()`](../reference/api/pandas.util.hash_pandas_object.html#pandas.util.hash_pandas_object "pandas.util.hash_pandas_object") ([GH 23066](https://github.com/pandas-dev/pandas/issues/23066)) +* [`DataFrame.stack()`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack") no longer converts to object dtype for DataFrames where each column has the same extension dtype. The output Series will have the same dtype as the columns ([GH 23077](https://github.com/pandas-dev/pandas/issues/23077)). +* [`Series.unstack()`](../reference/api/pandas.Series.unstack.html#pandas.Series.unstack "pandas.Series.unstack") and [`DataFrame.unstack()`](../reference/api/pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack") no longer convert extension arrays to object-dtype ndarrays. Each column in the output `DataFrame` will now have the same dtype as the input ([GH 23077](https://github.com/pandas-dev/pandas/issues/23077)). +* Bug when grouping `Dataframe.groupby()` and aggregating on `ExtensionArray` it was not returning the actual `ExtensionArray` dtype ([GH 23227](https://github.com/pandas-dev/pandas/issues/23227)). +* Bug in [`pandas.merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") when merging on an extension array-backed column ([GH 23020](https://github.com/pandas-dev/pandas/issues/23020)). + +## Deprecations[#](#deprecations "Link to this heading") + +* `MultiIndex.labels` has been deprecated and replaced by [`MultiIndex.codes`](../reference/api/pandas.MultiIndex.codes.html#pandas.MultiIndex.codes "pandas.MultiIndex.codes"). + The functionality is unchanged. The new name better reflects the natures of + these codes and makes the `MultiIndex` API more similar to the API for [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") ([GH 13443](https://github.com/pandas-dev/pandas/issues/13443)). + As a consequence, other uses of the name `labels` in `MultiIndex` have also been deprecated and replaced with `codes`: + + + You should initialize a `MultiIndex` instance using a parameter named `codes` rather than `labels`. + + `MultiIndex.set_labels` has been deprecated in favor of [`MultiIndex.set_codes()`](../reference/api/pandas.MultiIndex.set_codes.html#pandas.MultiIndex.set_codes "pandas.MultiIndex.set_codes"). + + For method [`MultiIndex.copy()`](../reference/api/pandas.MultiIndex.copy.html#pandas.MultiIndex.copy "pandas.MultiIndex.copy"), the `labels` parameter has been deprecated and replaced by a `codes` parameter. +* [`DataFrame.to_stata()`](../reference/api/pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata"), [`read_stata()`](../reference/api/pandas.read_stata.html#pandas.read_stata "pandas.read_stata"), `StataReader` and `StataWriter` have deprecated the `encoding` argument. The encoding of a Stata dta file is determined by the file type and cannot be changed ([GH 21244](https://github.com/pandas-dev/pandas/issues/21244)) +* `MultiIndex.to_hierarchical()` is deprecated and will be removed in a future version ([GH 21613](https://github.com/pandas-dev/pandas/issues/21613)) +* `Series.ptp()` is deprecated. Use `numpy.ptp` instead ([GH 21614](https://github.com/pandas-dev/pandas/issues/21614)) +* `Series.compress()` is deprecated. Use `Series[condition]` instead ([GH 18262](https://github.com/pandas-dev/pandas/issues/18262)) +* The signature of [`Series.to_csv()`](../reference/api/pandas.Series.to_csv.html#pandas.Series.to_csv "pandas.Series.to_csv") has been uniformed to that of [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv"): the name of the first argument is now `path_or_buf`, the order of subsequent arguments has changed, the `header` argument now defaults to `True`. ([GH 19715](https://github.com/pandas-dev/pandas/issues/19715)) +* [`Categorical.from_codes()`](../reference/api/pandas.Categorical.from_codes.html#pandas.Categorical.from_codes "pandas.Categorical.from_codes") has deprecated providing float values for the `codes` argument. ([GH 21767](https://github.com/pandas-dev/pandas/issues/21767)) +* [`pandas.read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") is deprecated. Instead, use [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") passing `sep='\t'` if necessary. This deprecation has been removed in 0.25.0. ([GH 21948](https://github.com/pandas-dev/pandas/issues/21948)) +* [`Series.str.cat()`](../reference/api/pandas.Series.str.cat.html#pandas.Series.str.cat "pandas.Series.str.cat") has deprecated using arbitrary list-likes *within* list-likes. A list-like container may still contain + many `Series`, `Index` or 1-dimensional `np.ndarray`, or alternatively, only scalar values. ([GH 21950](https://github.com/pandas-dev/pandas/issues/21950)) +* `FrozenNDArray.searchsorted()` has deprecated the `v` parameter in favor of `value` ([GH 14645](https://github.com/pandas-dev/pandas/issues/14645)) +* `DatetimeIndex.shift()` and `PeriodIndex.shift()` now accept `periods` argument instead of `n` for consistency with [`Index.shift()`](../reference/api/pandas.Index.shift.html#pandas.Index.shift "pandas.Index.shift") and [`Series.shift()`](../reference/api/pandas.Series.shift.html#pandas.Series.shift "pandas.Series.shift"). Using `n` throws a deprecation warning ([GH 22458](https://github.com/pandas-dev/pandas/issues/22458), [GH 22912](https://github.com/pandas-dev/pandas/issues/22912)) +* The `fastpath` keyword of the different Index constructors is deprecated ([GH 23110](https://github.com/pandas-dev/pandas/issues/23110)). +* [`Timestamp.tz_localize()`](../reference/api/pandas.Timestamp.tz_localize.html#pandas.Timestamp.tz_localize "pandas.Timestamp.tz_localize"), [`DatetimeIndex.tz_localize()`](../reference/api/pandas.DatetimeIndex.tz_localize.html#pandas.DatetimeIndex.tz_localize "pandas.DatetimeIndex.tz_localize"), and [`Series.tz_localize()`](../reference/api/pandas.Series.tz_localize.html#pandas.Series.tz_localize "pandas.Series.tz_localize") have deprecated the `errors` argument in favor of the `nonexistent` argument ([GH 8917](https://github.com/pandas-dev/pandas/issues/8917)) +* The class `FrozenNDArray` has been deprecated. When unpickling, `FrozenNDArray` will be unpickled to `np.ndarray` once this class is removed ([GH 9031](https://github.com/pandas-dev/pandas/issues/9031)) +* The methods [`DataFrame.update()`](../reference/api/pandas.DataFrame.update.html#pandas.DataFrame.update "pandas.DataFrame.update") and `Panel.update()` have deprecated the `raise_conflict=False|True` keyword in favor of `errors='ignore'|'raise'` ([GH 23585](https://github.com/pandas-dev/pandas/issues/23585)) +* The methods [`Series.str.partition()`](../reference/api/pandas.Series.str.partition.html#pandas.Series.str.partition "pandas.Series.str.partition") and [`Series.str.rpartition()`](../reference/api/pandas.Series.str.rpartition.html#pandas.Series.str.rpartition "pandas.Series.str.rpartition") have deprecated the `pat` keyword in favor of `sep` ([GH 22676](https://github.com/pandas-dev/pandas/issues/22676)) +* Deprecated the `nthreads` keyword of [`pandas.read_feather()`](../reference/api/pandas.read_feather.html#pandas.read_feather "pandas.read_feather") in favor of `use_threads` to reflect the changes in `pyarrow>=0.11.0`. ([GH 23053](https://github.com/pandas-dev/pandas/issues/23053)) +* [`pandas.read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") has deprecated accepting `usecols` as an integer. Please pass in a list of ints from 0 to `usecols` inclusive instead ([GH 23527](https://github.com/pandas-dev/pandas/issues/23527)) +* Constructing a [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") from data with `datetime64`-dtyped data is deprecated, will raise `TypeError` in a future version ([GH 23539](https://github.com/pandas-dev/pandas/issues/23539)) +* Constructing a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") from data with `timedelta64`-dtyped data is deprecated, will raise `TypeError` in a future version ([GH 23675](https://github.com/pandas-dev/pandas/issues/23675)) +* The `keep_tz=False` option (the default) of the `keep_tz` keyword of + [`DatetimeIndex.to_series()`](../reference/api/pandas.DatetimeIndex.to_series.html#pandas.DatetimeIndex.to_series "pandas.DatetimeIndex.to_series") is deprecated ([GH 17832](https://github.com/pandas-dev/pandas/issues/17832)). +* Timezone converting a tz-aware `datetime.datetime` or [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") with [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") and the `tz` argument is now deprecated. Instead, use [`Timestamp.tz_convert()`](../reference/api/pandas.Timestamp.tz_convert.html#pandas.Timestamp.tz_convert "pandas.Timestamp.tz_convert") ([GH 23579](https://github.com/pandas-dev/pandas/issues/23579)) +* `pandas.api.types.is_period()` is deprecated in favor of `pandas.api.types.is_period_dtype` ([GH 23917](https://github.com/pandas-dev/pandas/issues/23917)) +* `pandas.api.types.is_datetimetz()` is deprecated in favor of `pandas.api.types.is_datetime64tz` ([GH 23917](https://github.com/pandas-dev/pandas/issues/23917)) +* Creating a [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex"), [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex"), or [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") by passing range arguments `start`, `end`, and `periods` is deprecated in favor of [`timedelta_range()`](../reference/api/pandas.timedelta_range.html#pandas.timedelta_range "pandas.timedelta_range"), [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range"), or [`period_range()`](../reference/api/pandas.period_range.html#pandas.period_range "pandas.period_range") ([GH 23919](https://github.com/pandas-dev/pandas/issues/23919)) +* Passing a string alias like `'datetime64[ns, UTC]'` as the `unit` parameter to [`DatetimeTZDtype`](../reference/api/pandas.DatetimeTZDtype.html#pandas.DatetimeTZDtype "pandas.DatetimeTZDtype") is deprecated. Use `DatetimeTZDtype.construct_from_string` instead ([GH 23990](https://github.com/pandas-dev/pandas/issues/23990)). +* The `skipna` parameter of [`infer_dtype()`](../reference/api/pandas.api.types.infer_dtype.html#pandas.api.types.infer_dtype "pandas.api.types.infer_dtype") will switch to `True` by default in a future version of pandas ([GH 17066](https://github.com/pandas-dev/pandas/issues/17066), [GH 24050](https://github.com/pandas-dev/pandas/issues/24050)) +* In [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where") with Categorical data, providing an `other` that is not present in the categories is deprecated. Convert the categorical to a different dtype or add the `other` to the categories first ([GH 24077](https://github.com/pandas-dev/pandas/issues/24077)). +* `Series.clip_lower()`, `Series.clip_upper()`, `DataFrame.clip_lower()` and `DataFrame.clip_upper()` are deprecated and will be removed in a future version. Use `Series.clip(lower=threshold)`, `Series.clip(upper=threshold)` and the equivalent `DataFrame` methods ([GH 24203](https://github.com/pandas-dev/pandas/issues/24203)) +* `Series.nonzero()` is deprecated and will be removed in a future version ([GH 18262](https://github.com/pandas-dev/pandas/issues/18262)) +* Passing an integer to [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") and [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") with `timedelta64[ns]` dtypes is deprecated, will raise `TypeError` in a future version. Use `obj.fillna(pd.Timedelta(...))` instead ([GH 24694](https://github.com/pandas-dev/pandas/issues/24694)) +* `Series.cat.categorical`, `Series.cat.name` and `Series.cat.index` have been deprecated. Use the attributes on `Series.cat` or `Series` directly. ([GH 24751](https://github.com/pandas-dev/pandas/issues/24751)). +* Passing a dtype without a precision like `np.dtype('datetime64')` or `timedelta64` to [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") and [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") is now deprecated. Use the nanosecond-precision dtype instead ([GH 24753](https://github.com/pandas-dev/pandas/issues/24753)). + +### Integer addition/subtraction with datetimes and timedeltas is deprecated[#](#integer-addition-subtraction-with-datetimes-and-timedeltas-is-deprecated "Link to this heading") + +In the past, users could—in some cases—add or subtract integers or integer-dtype +arrays from [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp"), [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") and [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex"). + +This usage is now deprecated. Instead add or subtract integer multiples of +the object’s `freq` attribute ([GH 21939](https://github.com/pandas-dev/pandas/issues/21939), [GH 23878](https://github.com/pandas-dev/pandas/issues/23878)). + +*Previous behavior*: + +```None +In [5]: ts = pd.Timestamp('1994-05-06 12:15:16', freq=pd.offsets.Hour()) +In [6]: ts + 2 +Out[6]: Timestamp('1994-05-06 14:15:16', freq='H') + +In [7]: tdi = pd.timedelta_range('1D', periods=2) +In [8]: tdi - np.array([2, 1]) +Out[8]: TimedeltaIndex(['-1 days', '1 days'], dtype='timedelta64[ns]', freq=None) + +In [9]: dti = pd.date_range('2001-01-01', periods=2, freq='7D') +In [10]: dti + pd.Index([1, 2]) +Out[10]: DatetimeIndex(['2001-01-08', '2001-01-22'], dtype='datetime64[ns]', freq=None) +``` + +*New behavior*: + +```None +In [108]: ts = pd.Timestamp('1994-05-06 12:15:16', freq=pd.offsets.Hour()) + +In[109]: ts + 2 * ts.freq +Out[109]: Timestamp('1994-05-06 14:15:16', freq='H') + +In [110]: tdi = pd.timedelta_range('1D', periods=2) + +In [111]: tdi - np.array([2 * tdi.freq, 1 * tdi.freq]) +Out[111]: TimedeltaIndex(['-1 days', '1 days'], dtype='timedelta64[ns]', freq=None) + +In [112]: dti = pd.date_range('2001-01-01', periods=2, freq='7D') + +In [113]: dti + pd.Index([1 * dti.freq, 2 * dti.freq]) +Out[113]: DatetimeIndex(['2001-01-08', '2001-01-22'], dtype='datetime64[ns]', freq=None) +``` + +### Passing integer data and a timezone to DatetimeIndex[#](#passing-integer-data-and-a-timezone-to-datetimeindex "Link to this heading") + +The behavior of [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") when passed integer data and +a timezone is changing in a future version of pandas. Previously, these +were interpreted as wall times in the desired timezone. In the future, +these will be interpreted as wall times in UTC, which are then converted +to the desired timezone ([GH 24559](https://github.com/pandas-dev/pandas/issues/24559)). + +The default behavior remains the same, but issues a warning: + +```None +In [3]: pd.DatetimeIndex([946684800000000000], tz="US/Central") +/bin/ipython:1: FutureWarning: + Passing integer-dtype data and a timezone to DatetimeIndex. Integer values + will be interpreted differently in a future version of pandas. Previously, + these were viewed as datetime64[ns] values representing the wall time + *in the specified timezone*. In the future, these will be viewed as + datetime64[ns] values representing the wall time *in UTC*. This is similar + to a nanosecond-precision UNIX epoch. To accept the future behavior, use + + pd.to_datetime(integer_data, utc=True).tz_convert(tz) + + To keep the previous behavior, use + + pd.to_datetime(integer_data).tz_localize(tz) + + #!/bin/python3 + Out[3]: DatetimeIndex(['2000-01-01 00:00:00-06:00'], dtype='datetime64[ns, US/Central]', freq=None) +``` + +As the warning message explains, opt in to the future behavior by specifying that +the integer values are UTC, and then converting to the final timezone: + +```None +In [99]: pd.to_datetime([946684800000000000], utc=True).tz_convert('US/Central') +Out[99]: DatetimeIndex(['1999-12-31 18:00:00-06:00'], dtype='datetime64[ns, US/Central]', freq=None) +``` + +The old behavior can be retained with by localizing directly to the final timezone: + +```None +In [100]: pd.to_datetime([946684800000000000]).tz_localize('US/Central') +Out[100]: DatetimeIndex(['2000-01-01 00:00:00-06:00'], dtype='datetime64[ns, US/Central]', freq=None) +``` + +### Converting timezone-aware Series and Index to NumPy arrays[#](#converting-timezone-aware-series-and-index-to-numpy-arrays "Link to this heading") + +The conversion from a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with timezone-aware +datetime data will change to preserve timezones by default ([GH 23569](https://github.com/pandas-dev/pandas/issues/23569)). + +NumPy doesn’t have a dedicated dtype for timezone-aware datetimes. +In the past, converting a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with +timezone-aware datatimes would convert to a NumPy array by + +1. converting the tz-aware data to UTC +2. dropping the timezone-info +3. returning a [`numpy.ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.3)") with `datetime64[ns]` dtype + +Future versions of pandas will preserve the timezone information by returning an +object-dtype NumPy array where each value is a [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") with the correct +timezone attached + +```None +In [101]: ser = pd.Series(pd.date_range('2000', periods=2, tz="CET")) + +In [102]: ser +Out[102]: +0 2000-01-01 00:00:00+01:00 +1 2000-01-02 00:00:00+01:00 +Length: 2, dtype: datetime64[ns, CET] +``` + +The default behavior remains the same, but issues a warning + +```None +In [8]: np.asarray(ser) +/bin/ipython:1: FutureWarning: Converting timezone-aware DatetimeArray to timezone-naive + ndarray with 'datetime64[ns]' dtype. In the future, this will return an ndarray + with 'object' dtype where each element is a 'pandas.Timestamp' with the correct 'tz'. + + To accept the future behavior, pass 'dtype=object'. + To keep the old behavior, pass 'dtype="datetime64[ns]"'. + #!/bin/python3 +Out[8]: +array(['1999-12-31T23:00:00.000000000', '2000-01-01T23:00:00.000000000'], + dtype='datetime64[ns]') +``` + +The previous or future behavior can be obtained, without any warnings, by specifying +the `dtype` + +*Previous behavior* + +```None +In [103]: np.asarray(ser, dtype='datetime64[ns]') +Out[103]: +array(['1999-12-31T23:00:00.000000000', '2000-01-01T23:00:00.000000000'], + dtype='datetime64[ns]') +``` + +*Future behavior* + +```None +# New behavior +In [104]: np.asarray(ser, dtype=object) +Out[104]: +array([Timestamp('2000-01-01 00:00:00+0100', tz='CET'), + Timestamp('2000-01-02 00:00:00+0100', tz='CET')], dtype=object) +``` + +Or by using [`Series.to_numpy()`](../reference/api/pandas.Series.to_numpy.html#pandas.Series.to_numpy "pandas.Series.to_numpy") + +```None +In [105]: ser.to_numpy() +Out[105]: +array([Timestamp('2000-01-01 00:00:00+0100', tz='CET'), + Timestamp('2000-01-02 00:00:00+0100', tz='CET')], dtype=object) + +In [106]: ser.to_numpy(dtype="datetime64[ns]") +Out[106]: +array(['1999-12-31T23:00:00.000000000', '2000-01-01T23:00:00.000000000'], + dtype='datetime64[ns]') +``` + +All the above applies to a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with tz-aware values as well. + +## Removal of prior version deprecations/changes[#](#removal-of-prior-version-deprecations-changes "Link to this heading") + +* The `LongPanel` and `WidePanel` classes have been removed ([GH 10892](https://github.com/pandas-dev/pandas/issues/10892)) +* [`Series.repeat()`](../reference/api/pandas.Series.repeat.html#pandas.Series.repeat "pandas.Series.repeat") has renamed the `reps` argument to `repeats` ([GH 14645](https://github.com/pandas-dev/pandas/issues/14645)) +* Several private functions were removed from the (non-public) module `pandas.core.common` ([GH 22001](https://github.com/pandas-dev/pandas/issues/22001)) +* Removal of the previously deprecated module `pandas.core.datetools` ([GH 14105](https://github.com/pandas-dev/pandas/issues/14105), [GH 14094](https://github.com/pandas-dev/pandas/issues/14094)) +* Strings passed into [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") that refer to both column and index levels will raise a `ValueError` ([GH 14432](https://github.com/pandas-dev/pandas/issues/14432)) +* [`Index.repeat()`](../reference/api/pandas.Index.repeat.html#pandas.Index.repeat "pandas.Index.repeat") and `MultiIndex.repeat()` have renamed the `n` argument to `repeats` ([GH 14645](https://github.com/pandas-dev/pandas/issues/14645)) +* The `Series` constructor and `.astype` method will now raise a `ValueError` if timestamp dtypes are passed in without a unit (e.g. `np.datetime64`) for the `dtype` parameter ([GH 15987](https://github.com/pandas-dev/pandas/issues/15987)) +* Removal of the previously deprecated `as_indexer` keyword completely from `str.match()` ([GH 22356](https://github.com/pandas-dev/pandas/issues/22356), [GH 6581](https://github.com/pandas-dev/pandas/issues/6581)) +* The modules `pandas.types`, `pandas.computation`, and `pandas.util.decorators` have been removed ([GH 16157](https://github.com/pandas-dev/pandas/issues/16157), [GH 16250](https://github.com/pandas-dev/pandas/issues/16250)) +* Removed the `pandas.formats.style` shim for [`pandas.io.formats.style.Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") ([GH 16059](https://github.com/pandas-dev/pandas/issues/16059)) +* `pandas.pnow`, `pandas.match`, `pandas.groupby`, `pd.get_store`, `pd.Expr`, and `pd.Term` have been removed ([GH 15538](https://github.com/pandas-dev/pandas/issues/15538), [GH 15940](https://github.com/pandas-dev/pandas/issues/15940)) +* `Categorical.searchsorted()` and [`Series.searchsorted()`](../reference/api/pandas.Series.searchsorted.html#pandas.Series.searchsorted "pandas.Series.searchsorted") have renamed the `v` argument to `value` ([GH 14645](https://github.com/pandas-dev/pandas/issues/14645)) +* `pandas.parser`, `pandas.lib`, and `pandas.tslib` have been removed ([GH 15537](https://github.com/pandas-dev/pandas/issues/15537)) +* [`Index.searchsorted()`](../reference/api/pandas.Index.searchsorted.html#pandas.Index.searchsorted "pandas.Index.searchsorted") have renamed the `key` argument to `value` ([GH 14645](https://github.com/pandas-dev/pandas/issues/14645)) +* `DataFrame.consolidate` and `Series.consolidate` have been removed ([GH 15501](https://github.com/pandas-dev/pandas/issues/15501)) +* Removal of the previously deprecated module `pandas.json` ([GH 19944](https://github.com/pandas-dev/pandas/issues/19944)) +* The module `pandas.tools` has been removed ([GH 15358](https://github.com/pandas-dev/pandas/issues/15358), [GH 16005](https://github.com/pandas-dev/pandas/issues/16005)) +* `SparseArray.get_values()` and `SparseArray.to_dense()` have dropped the `fill` parameter ([GH 14686](https://github.com/pandas-dev/pandas/issues/14686)) +* `DataFrame.sortlevel` and `Series.sortlevel` have been removed ([GH 15099](https://github.com/pandas-dev/pandas/issues/15099)) +* `SparseSeries.to_dense()` has dropped the `sparse_only` parameter ([GH 14686](https://github.com/pandas-dev/pandas/issues/14686)) +* [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") and [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") have renamed the `raise_on_error` argument to `errors` ([GH 14967](https://github.com/pandas-dev/pandas/issues/14967)) +* `is_sequence`, `is_any_int_dtype`, and `is_floating_dtype` have been removed from `pandas.api.types` ([GH 16163](https://github.com/pandas-dev/pandas/issues/16163), [GH 16189](https://github.com/pandas-dev/pandas/issues/16189)) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Slicing Series and DataFrames with an monotonically increasing [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") + is now very fast and has speed comparable to slicing with an `Int64Index`. + The speed increase is both when indexing by label (using .loc) and position(.iloc) ([GH 20395](https://github.com/pandas-dev/pandas/issues/20395)) + Slicing a monotonically increasing [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") itself (i.e. `ci[1000:2000]`) + shows similar speed improvements as above ([GH 21659](https://github.com/pandas-dev/pandas/issues/21659)) +* Improved performance of [`CategoricalIndex.equals()`](../reference/api/pandas.CategoricalIndex.equals.html#pandas.CategoricalIndex.equals "pandas.CategoricalIndex.equals") when comparing to another [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") ([GH 24023](https://github.com/pandas-dev/pandas/issues/24023)) +* Improved performance of [`Series.describe()`](../reference/api/pandas.Series.describe.html#pandas.Series.describe "pandas.Series.describe") in case of numeric dtpyes ([GH 21274](https://github.com/pandas-dev/pandas/issues/21274)) +* Improved performance of `GroupBy.rank()` when dealing with tied rankings ([GH 21237](https://github.com/pandas-dev/pandas/issues/21237)) +* Improved performance of [`DataFrame.set_index()`](../reference/api/pandas.DataFrame.set_index.html#pandas.DataFrame.set_index "pandas.DataFrame.set_index") with columns consisting of [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") objects ([GH 21582](https://github.com/pandas-dev/pandas/issues/21582), [GH 21606](https://github.com/pandas-dev/pandas/issues/21606)) +* Improved performance of [`Series.at()`](../reference/api/pandas.Series.at.html#pandas.Series.at "pandas.Series.at") and `Index.get_value()` for Extension Arrays values (e.g. [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical")) ([GH 24204](https://github.com/pandas-dev/pandas/issues/24204)) +* Improved performance of membership checks in [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") and [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") + (i.e. `x in cat`-style checks are much faster). `CategoricalIndex.contains()` + is likewise much faster ([GH 21369](https://github.com/pandas-dev/pandas/issues/21369), [GH 21508](https://github.com/pandas-dev/pandas/issues/21508)) +* Improved performance of [`HDFStore.groups()`](../reference/api/pandas.HDFStore.groups.html#pandas.HDFStore.groups "pandas.HDFStore.groups") (and dependent functions like + [`HDFStore.keys()`](../reference/api/pandas.HDFStore.keys.html#pandas.HDFStore.keys "pandas.HDFStore.keys"). (i.e. `x in store` checks are much faster) + ([GH 21372](https://github.com/pandas-dev/pandas/issues/21372)) +* Improved the performance of [`pandas.get_dummies()`](../reference/api/pandas.get_dummies.html#pandas.get_dummies "pandas.get_dummies") with `sparse=True` ([GH 21997](https://github.com/pandas-dev/pandas/issues/21997)) +* Improved performance of `IndexEngine.get_indexer_non_unique()` for sorted, non-unique indexes ([GH 9466](https://github.com/pandas-dev/pandas/issues/9466)) +* Improved performance of `PeriodIndex.unique()` ([GH 23083](https://github.com/pandas-dev/pandas/issues/23083)) +* Improved performance of [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") for `Series` objects ([GH 23404](https://github.com/pandas-dev/pandas/issues/23404)) +* Improved performance of [`DatetimeIndex.normalize()`](../reference/api/pandas.DatetimeIndex.normalize.html#pandas.DatetimeIndex.normalize "pandas.DatetimeIndex.normalize") and [`Timestamp.normalize()`](../reference/api/pandas.Timestamp.normalize.html#pandas.Timestamp.normalize "pandas.Timestamp.normalize") for timezone naive or UTC datetimes ([GH 23634](https://github.com/pandas-dev/pandas/issues/23634)) +* Improved performance of [`DatetimeIndex.tz_localize()`](../reference/api/pandas.DatetimeIndex.tz_localize.html#pandas.DatetimeIndex.tz_localize "pandas.DatetimeIndex.tz_localize") and various `DatetimeIndex` attributes with dateutil UTC timezone ([GH 23772](https://github.com/pandas-dev/pandas/issues/23772)) +* Fixed a performance regression on Windows with Python 3.7 of [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") ([GH 23516](https://github.com/pandas-dev/pandas/issues/23516)) +* Improved performance of [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") constructor for `Series` objects ([GH 23814](https://github.com/pandas-dev/pandas/issues/23814)) +* Improved performance of [`where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where") for Categorical data ([GH 24077](https://github.com/pandas-dev/pandas/issues/24077)) +* Improved performance of iterating over a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"). Using [`DataFrame.itertuples()`](../reference/api/pandas.DataFrame.itertuples.html#pandas.DataFrame.itertuples "pandas.DataFrame.itertuples") now creates iterators + without internally allocating lists of all elements ([GH 20783](https://github.com/pandas-dev/pandas/issues/20783)) +* Improved performance of [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") constructor, additionally benefitting `PeriodArray` and `PeriodIndex` creation ([GH 24084](https://github.com/pandas-dev/pandas/issues/24084), [GH 24118](https://github.com/pandas-dev/pandas/issues/24118)) +* Improved performance of tz-aware `DatetimeArray` binary operations ([GH 24491](https://github.com/pandas-dev/pandas/issues/24491)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +### Categorical[#](#categorical "Link to this heading") + +* Bug in [`Categorical.from_codes()`](../reference/api/pandas.Categorical.from_codes.html#pandas.Categorical.from_codes "pandas.Categorical.from_codes") where `NaN` values in `codes` were silently converted to `0` ([GH 21767](https://github.com/pandas-dev/pandas/issues/21767)). In the future this will raise a `ValueError`. Also changes the behavior of `.from_codes([1.1, 2.0])`. +* Bug in `Categorical.sort_values()` where `NaN` values were always positioned in front regardless of `na_position` value. ([GH 22556](https://github.com/pandas-dev/pandas/issues/22556)). +* Bug when indexing with a boolean-valued `Categorical`. Now a boolean-valued `Categorical` is treated as a boolean mask ([GH 22665](https://github.com/pandas-dev/pandas/issues/22665)) +* Constructing a [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") with empty values and boolean categories was raising a `ValueError` after a change to dtype coercion ([GH 22702](https://github.com/pandas-dev/pandas/issues/22702)). +* Bug in `Categorical.take()` with a user-provided `fill_value` not encoding the `fill_value`, which could result in a `ValueError`, incorrect results, or a segmentation fault ([GH 23296](https://github.com/pandas-dev/pandas/issues/23296)). +* In [`Series.unstack()`](../reference/api/pandas.Series.unstack.html#pandas.Series.unstack "pandas.Series.unstack"), specifying a `fill_value` not present in the categories now raises a `TypeError` rather than ignoring the `fill_value` ([GH 23284](https://github.com/pandas-dev/pandas/issues/23284)) +* Bug when resampling [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") and aggregating on categorical data, the categorical dtype was getting lost. ([GH 23227](https://github.com/pandas-dev/pandas/issues/23227)) +* Bug in many methods of the `.str`-accessor, which always failed on calling the `CategoricalIndex.str` constructor ([GH 23555](https://github.com/pandas-dev/pandas/issues/23555), [GH 23556](https://github.com/pandas-dev/pandas/issues/23556)) +* Bug in [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where") losing the categorical dtype for categorical data ([GH 24077](https://github.com/pandas-dev/pandas/issues/24077)) +* Bug in `Categorical.apply()` where `NaN` values could be handled unpredictably. They now remain unchanged ([GH 24241](https://github.com/pandas-dev/pandas/issues/24241)) +* Bug in [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") comparison methods incorrectly raising `ValueError` when operating against a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 24630](https://github.com/pandas-dev/pandas/issues/24630)) +* Bug in `Categorical.set_categories()` where setting fewer new categories with `rename=True` caused a segmentation fault ([GH 24675](https://github.com/pandas-dev/pandas/issues/24675)) + +### Datetimelike[#](#datetimelike "Link to this heading") + +* Fixed bug where two `DateOffset` objects with different `normalize` attributes could evaluate as equal ([GH 21404](https://github.com/pandas-dev/pandas/issues/21404)) +* Fixed bug where [`Timestamp.resolution()`](../reference/api/pandas.Timestamp.resolution.html#pandas.Timestamp.resolution "pandas.Timestamp.resolution") incorrectly returned 1-microsecond `timedelta` instead of 1-nanosecond [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") ([GH 21336](https://github.com/pandas-dev/pandas/issues/21336), [GH 21365](https://github.com/pandas-dev/pandas/issues/21365)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") that did not consistently return an [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") when `box=True` was specified ([GH 21864](https://github.com/pandas-dev/pandas/issues/21864)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") comparisons where string comparisons incorrectly raises `TypeError` ([GH 22074](https://github.com/pandas-dev/pandas/issues/22074)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") comparisons when comparing against `timedelta64[ns]` dtyped arrays; in some cases `TypeError` was incorrectly raised, in others it incorrectly failed to raise ([GH 22074](https://github.com/pandas-dev/pandas/issues/22074)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") comparisons when comparing against object-dtyped arrays ([GH 22074](https://github.com/pandas-dev/pandas/issues/22074)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with `datetime64[ns]` dtype addition and subtraction with `Timedelta`-like objects ([GH 22005](https://github.com/pandas-dev/pandas/issues/22005), [GH 22163](https://github.com/pandas-dev/pandas/issues/22163)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with `datetime64[ns]` dtype addition and subtraction with `DateOffset` objects returning an `object` dtype instead of `datetime64[ns]` dtype ([GH 21610](https://github.com/pandas-dev/pandas/issues/21610), [GH 22163](https://github.com/pandas-dev/pandas/issues/22163)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with `datetime64[ns]` dtype comparing against `NaT` incorrectly ([GH 22242](https://github.com/pandas-dev/pandas/issues/22242), [GH 22163](https://github.com/pandas-dev/pandas/issues/22163)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with `datetime64[ns]` dtype subtracting `Timestamp`-like object incorrectly returned `datetime64[ns]` dtype instead of `timedelta64[ns]` dtype ([GH 8554](https://github.com/pandas-dev/pandas/issues/8554), [GH 22163](https://github.com/pandas-dev/pandas/issues/22163)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with `datetime64[ns]` dtype subtracting `np.datetime64` object with non-nanosecond unit failing to convert to nanoseconds ([GH 18874](https://github.com/pandas-dev/pandas/issues/18874), [GH 22163](https://github.com/pandas-dev/pandas/issues/22163)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") comparisons against `Timestamp`-like objects failing to raise `TypeError` for inequality checks with mismatched types ([GH 8932](https://github.com/pandas-dev/pandas/issues/8932), [GH 22163](https://github.com/pandas-dev/pandas/issues/22163)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with mixed dtypes including `datetime64[ns]` incorrectly raising `TypeError` on equality comparisons ([GH 13128](https://github.com/pandas-dev/pandas/issues/13128), [GH 22163](https://github.com/pandas-dev/pandas/issues/22163)) +* Bug in [`DataFrame.values`](../reference/api/pandas.DataFrame.values.html#pandas.DataFrame.values "pandas.DataFrame.values") returning a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") for a single-column `DataFrame` with tz-aware datetime values. Now a 2-D [`numpy.ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.3)") of [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") objects is returned ([GH 24024](https://github.com/pandas-dev/pandas/issues/24024)) +* Bug in [`DataFrame.eq()`](../reference/api/pandas.DataFrame.eq.html#pandas.DataFrame.eq "pandas.DataFrame.eq") comparison against `NaT` incorrectly returning `True` or `NaN` ([GH 15697](https://github.com/pandas-dev/pandas/issues/15697), [GH 22163](https://github.com/pandas-dev/pandas/issues/22163)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") subtraction that incorrectly failed to raise `OverflowError` ([GH 22492](https://github.com/pandas-dev/pandas/issues/22492), [GH 22508](https://github.com/pandas-dev/pandas/issues/22508)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") incorrectly allowing indexing with `Timedelta` object ([GH 20464](https://github.com/pandas-dev/pandas/issues/20464)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") where frequency was being set if original frequency was `None` ([GH 22150](https://github.com/pandas-dev/pandas/issues/22150)) +* Bug in rounding methods of [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") ([`round()`](../reference/api/pandas.DatetimeIndex.round.html#pandas.DatetimeIndex.round "pandas.DatetimeIndex.round"), [`ceil()`](../reference/api/pandas.DatetimeIndex.ceil.html#pandas.DatetimeIndex.ceil "pandas.DatetimeIndex.ceil"), [`floor()`](../reference/api/pandas.DatetimeIndex.floor.html#pandas.DatetimeIndex.floor "pandas.DatetimeIndex.floor")) and [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") ([`round()`](../reference/api/pandas.Timestamp.round.html#pandas.Timestamp.round "pandas.Timestamp.round"), [`ceil()`](../reference/api/pandas.Timestamp.ceil.html#pandas.Timestamp.ceil "pandas.Timestamp.ceil"), [`floor()`](../reference/api/pandas.Timestamp.floor.html#pandas.Timestamp.floor "pandas.Timestamp.floor")) could give rise to loss of precision ([GH 22591](https://github.com/pandas-dev/pandas/issues/22591)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with an [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") argument that would drop the `name` from the result ([GH 21697](https://github.com/pandas-dev/pandas/issues/21697)) +* Bug in [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") where adding or subtracting a `timedelta` or `Tick` object produced incorrect results ([GH 22988](https://github.com/pandas-dev/pandas/issues/22988)) +* Bug in the [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") repr with period-dtype data missing a space before the data ([GH 23601](https://github.com/pandas-dev/pandas/issues/23601)) +* Bug in [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range") when decrementing a start date to a past end date by a negative frequency ([GH 23270](https://github.com/pandas-dev/pandas/issues/23270)) +* Bug in [`Series.min()`](../reference/api/pandas.Series.min.html#pandas.Series.min "pandas.Series.min") which would return `NaN` instead of `NaT` when called on a series of `NaT` ([GH 23282](https://github.com/pandas-dev/pandas/issues/23282)) +* Bug in [`Series.combine_first()`](../reference/api/pandas.Series.combine_first.html#pandas.Series.combine_first "pandas.Series.combine_first") not properly aligning categoricals, so that missing values in `self` where not filled by valid values from `other` ([GH 24147](https://github.com/pandas-dev/pandas/issues/24147)) +* Bug in [`DataFrame.combine()`](../reference/api/pandas.DataFrame.combine.html#pandas.DataFrame.combine "pandas.DataFrame.combine") with datetimelike values raising a TypeError ([GH 23079](https://github.com/pandas-dev/pandas/issues/23079)) +* Bug in [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range") with frequency of `Day` or higher where dates sufficiently far in the future could wrap around to the past instead of raising `OutOfBoundsDatetime` ([GH 14187](https://github.com/pandas-dev/pandas/issues/14187)) +* Bug in [`period_range()`](../reference/api/pandas.period_range.html#pandas.period_range "pandas.period_range") ignoring the frequency of `start` and `end` when those are provided as [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") objects ([GH 20535](https://github.com/pandas-dev/pandas/issues/20535)). +* Bug in [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") with attribute `freq.n` greater than 1 where adding a `DateOffset` object would return incorrect results ([GH 23215](https://github.com/pandas-dev/pandas/issues/23215)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") that interpreted string indices as lists of characters when setting datetimelike values ([GH 23451](https://github.com/pandas-dev/pandas/issues/23451)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") when creating a new column from an ndarray of [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") objects with timezones creating an object-dtype column, rather than datetime with timezone ([GH 23932](https://github.com/pandas-dev/pandas/issues/23932)) +* Bug in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") constructor which would drop the frequency of an input [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") ([GH 22311](https://github.com/pandas-dev/pandas/issues/22311)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") where calling `np.array(dtindex, dtype=object)` would incorrectly return an array of `long` objects ([GH 23524](https://github.com/pandas-dev/pandas/issues/23524)) +* Bug in [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") where passing a timezone-aware [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") and `dtype=object` would incorrectly raise a `ValueError` ([GH 23524](https://github.com/pandas-dev/pandas/issues/23524)) +* Bug in [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") where calling `np.array(dtindex, dtype=object)` on a timezone-naive [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") would return an array of `datetime` objects instead of [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") objects, potentially losing nanosecond portions of the timestamps ([GH 23524](https://github.com/pandas-dev/pandas/issues/23524)) +* Bug in `Categorical.__setitem__` not allowing setting with another `Categorical` when both are unordered and have the same categories, but in a different order ([GH 24142](https://github.com/pandas-dev/pandas/issues/24142)) +* Bug in [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range") where using dates with millisecond resolution or higher could return incorrect values or the wrong number of values in the index ([GH 24110](https://github.com/pandas-dev/pandas/issues/24110)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") where constructing a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") from a [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") or [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") would incorrectly drop timezone information ([GH 18664](https://github.com/pandas-dev/pandas/issues/18664)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") and [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") where indexing with `Ellipsis` would incorrectly lose the index’s `freq` attribute ([GH 21282](https://github.com/pandas-dev/pandas/issues/21282)) +* Clarified error message produced when passing an incorrect `freq` argument to [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with `NaT` as the first entry in the passed data ([GH 11587](https://github.com/pandas-dev/pandas/issues/11587)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") where `box` and `utc` arguments were ignored when passing a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") or `dict` of unit mappings ([GH 23760](https://github.com/pandas-dev/pandas/issues/23760)) +* Bug in [`Series.dt`](../reference/api/pandas.Series.dt.html#pandas.Series.dt "pandas.Series.dt") where the cache would not update properly after an in-place operation ([GH 24408](https://github.com/pandas-dev/pandas/issues/24408)) +* Bug in [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") where comparisons against an array-like object with length 1 failed to raise `ValueError` ([GH 23078](https://github.com/pandas-dev/pandas/issues/23078)) +* Bug in `DatetimeIndex.astype()`, `PeriodIndex.astype()` and `TimedeltaIndex.astype()` ignoring the sign of the `dtype` for unsigned integer dtypes ([GH 24405](https://github.com/pandas-dev/pandas/issues/24405)). +* Fixed bug in [`Series.max()`](../reference/api/pandas.Series.max.html#pandas.Series.max "pandas.Series.max") with `datetime64[ns]`-dtype failing to return `NaT` when nulls are present and `skipna=False` is passed ([GH 24265](https://github.com/pandas-dev/pandas/issues/24265)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") where arrays of `datetime` objects containing both timezone-aware and timezone-naive `datetimes` would fail to raise `ValueError` ([GH 24569](https://github.com/pandas-dev/pandas/issues/24569)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with invalid datetime format doesn’t coerce input to `NaT` even if `errors='coerce'` ([GH 24763](https://github.com/pandas-dev/pandas/issues/24763)) + +### Timedelta[#](#timedelta "Link to this heading") + +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with `timedelta64[ns]` dtype division by `Timedelta`-like scalar incorrectly returning `timedelta64[ns]` dtype instead of `float64` dtype ([GH 20088](https://github.com/pandas-dev/pandas/issues/20088), [GH 22163](https://github.com/pandas-dev/pandas/issues/22163)) +* Bug in adding a [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with object dtype to a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `timedelta64[ns]` dtype incorrectly raising ([GH 22390](https://github.com/pandas-dev/pandas/issues/22390)) +* Bug in multiplying a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with numeric dtype against a `timedelta` object ([GH 22390](https://github.com/pandas-dev/pandas/issues/22390)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with numeric dtype when adding or subtracting an array or `Series` with `timedelta64` dtype ([GH 22390](https://github.com/pandas-dev/pandas/issues/22390)) +* Bug in [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with numeric dtype when multiplying or dividing an array with dtype `timedelta64` ([GH 22390](https://github.com/pandas-dev/pandas/issues/22390)) +* Bug in [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") incorrectly allowing indexing with `Timestamp` object ([GH 20464](https://github.com/pandas-dev/pandas/issues/20464)) +* Fixed bug where subtracting [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") from an object-dtyped array would raise `TypeError` ([GH 21980](https://github.com/pandas-dev/pandas/issues/21980)) +* Fixed bug in adding a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with all-timedelta64[ns] dtypes to a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with all-integer dtypes returning incorrect results instead of raising `TypeError` ([GH 22696](https://github.com/pandas-dev/pandas/issues/22696)) +* Bug in [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") where adding a timezone-aware datetime scalar incorrectly returned a timezone-naive [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") ([GH 23215](https://github.com/pandas-dev/pandas/issues/23215)) +* Bug in [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") where adding `np.timedelta64('NaT')` incorrectly returned an all-`NaT` [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") instead of an all-`NaT` [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") ([GH 23215](https://github.com/pandas-dev/pandas/issues/23215)) +* Bug in [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") and [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta") have inconsistencies in supported unit string ([GH 21762](https://github.com/pandas-dev/pandas/issues/21762)) +* Bug in [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") division where dividing by another [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") raised `TypeError` instead of returning a `Float64Index` ([GH 23829](https://github.com/pandas-dev/pandas/issues/23829), [GH 22631](https://github.com/pandas-dev/pandas/issues/22631)) +* Bug in [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") comparison operations where comparing against non-`Timedelta`-like objects would raise `TypeError` instead of returning all-`False` for `__eq__` and all-`True` for `__ne__` ([GH 24056](https://github.com/pandas-dev/pandas/issues/24056)) +* Bug in [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") comparisons when comparing with a `Tick` object incorrectly raising `TypeError` ([GH 24710](https://github.com/pandas-dev/pandas/issues/24710)) + +### Timezones[#](#timezones "Link to this heading") + +* Bug in [`Index.shift()`](../reference/api/pandas.Index.shift.html#pandas.Index.shift "pandas.Index.shift") where an `AssertionError` would raise when shifting across DST ([GH 8616](https://github.com/pandas-dev/pandas/issues/8616)) +* Bug in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") constructor where passing an invalid timezone offset designator (`Z`) would not raise a `ValueError` ([GH 8910](https://github.com/pandas-dev/pandas/issues/8910)) +* Bug in [`Timestamp.replace()`](../reference/api/pandas.Timestamp.replace.html#pandas.Timestamp.replace "pandas.Timestamp.replace") where replacing at a DST boundary would retain an incorrect offset ([GH 7825](https://github.com/pandas-dev/pandas/issues/7825)) +* Bug in [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") with `datetime64[ns, tz]` data when replacing `NaT` ([GH 11792](https://github.com/pandas-dev/pandas/issues/11792)) +* Bug in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") when passing different string date formats with a timezone offset would produce different timezone offsets ([GH 12064](https://github.com/pandas-dev/pandas/issues/12064)) +* Bug when comparing a tz-naive [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") to a tz-aware [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") which would coerce the [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") to tz-naive ([GH 12601](https://github.com/pandas-dev/pandas/issues/12601)) +* Bug in [`Series.truncate()`](../reference/api/pandas.Series.truncate.html#pandas.Series.truncate "pandas.Series.truncate") with a tz-aware [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") which would cause a core dump ([GH 9243](https://github.com/pandas-dev/pandas/issues/9243)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructor which would coerce tz-aware and tz-naive [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") to tz-aware ([GH 13051](https://github.com/pandas-dev/pandas/issues/13051)) +* Bug in [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with `datetime64[ns, tz]` dtype that did not localize integer data correctly ([GH 20964](https://github.com/pandas-dev/pandas/issues/20964)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") where constructing with an integer and tz would not localize correctly ([GH 12619](https://github.com/pandas-dev/pandas/issues/12619)) +* Fixed bug where [`DataFrame.describe()`](../reference/api/pandas.DataFrame.describe.html#pandas.DataFrame.describe "pandas.DataFrame.describe") and [`Series.describe()`](../reference/api/pandas.Series.describe.html#pandas.Series.describe "pandas.Series.describe") on tz-aware datetimes did not show `first` and `last` result ([GH 21328](https://github.com/pandas-dev/pandas/issues/21328)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") comparisons failing to raise `TypeError` when comparing timezone-aware `DatetimeIndex` against `np.datetime64` ([GH 22074](https://github.com/pandas-dev/pandas/issues/22074)) +* Bug in `DataFrame` assignment with a timezone-aware scalar ([GH 19843](https://github.com/pandas-dev/pandas/issues/19843)) +* Bug in [`DataFrame.asof()`](../reference/api/pandas.DataFrame.asof.html#pandas.DataFrame.asof "pandas.DataFrame.asof") that raised a `TypeError` when attempting to compare tz-naive and tz-aware timestamps ([GH 21194](https://github.com/pandas-dev/pandas/issues/21194)) +* Bug when constructing a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") constructed with the `replace` method across DST ([GH 18785](https://github.com/pandas-dev/pandas/issues/18785)) +* Bug when setting a new value with [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") with a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with a DST transition ([GH 18308](https://github.com/pandas-dev/pandas/issues/18308), [GH 20724](https://github.com/pandas-dev/pandas/issues/20724)) +* Bug in [`Index.unique()`](../reference/api/pandas.Index.unique.html#pandas.Index.unique "pandas.Index.unique") that did not re-localize tz-aware dates correctly ([GH 21737](https://github.com/pandas-dev/pandas/issues/21737)) +* Bug when indexing a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with a DST transition ([GH 21846](https://github.com/pandas-dev/pandas/issues/21846)) +* Bug in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") and [`Series.resample()`](../reference/api/pandas.Series.resample.html#pandas.Series.resample "pandas.Series.resample") where an `AmbiguousTimeError` or `NonExistentTimeError` would raise if a timezone aware timeseries ended on a DST transition ([GH 19375](https://github.com/pandas-dev/pandas/issues/19375), [GH 10117](https://github.com/pandas-dev/pandas/issues/10117)) +* Bug in [`DataFrame.drop()`](../reference/api/pandas.DataFrame.drop.html#pandas.DataFrame.drop "pandas.DataFrame.drop") and [`Series.drop()`](../reference/api/pandas.Series.drop.html#pandas.Series.drop "pandas.Series.drop") when specifying a tz-aware Timestamp key to drop from a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with a DST transition ([GH 21761](https://github.com/pandas-dev/pandas/issues/21761)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") constructor where `NaT` and `dateutil.tz.tzlocal` would raise an `OutOfBoundsDatetime` error ([GH 23807](https://github.com/pandas-dev/pandas/issues/23807)) +* Bug in [`DatetimeIndex.tz_localize()`](../reference/api/pandas.DatetimeIndex.tz_localize.html#pandas.DatetimeIndex.tz_localize "pandas.DatetimeIndex.tz_localize") and [`Timestamp.tz_localize()`](../reference/api/pandas.Timestamp.tz_localize.html#pandas.Timestamp.tz_localize "pandas.Timestamp.tz_localize") with `dateutil.tz.tzlocal` near a DST transition that would return an incorrectly localized datetime ([GH 23807](https://github.com/pandas-dev/pandas/issues/23807)) +* Bug in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") constructor where a `dateutil.tz.tzutc` timezone passed with a `datetime.datetime` argument would be converted to a `pytz.UTC` timezone ([GH 23807](https://github.com/pandas-dev/pandas/issues/23807)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") where `utc=True` was not respected when specifying a `unit` and `errors='ignore'` ([GH 23758](https://github.com/pandas-dev/pandas/issues/23758)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") where `utc=True` was not respected when passing a [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") ([GH 24415](https://github.com/pandas-dev/pandas/issues/24415)) +* Bug in [`DataFrame.any()`](../reference/api/pandas.DataFrame.any.html#pandas.DataFrame.any "pandas.DataFrame.any") returns wrong value when `axis=1` and the data is of datetimelike type ([GH 23070](https://github.com/pandas-dev/pandas/issues/23070)) +* Bug in [`DatetimeIndex.to_period()`](../reference/api/pandas.DatetimeIndex.to_period.html#pandas.DatetimeIndex.to_period "pandas.DatetimeIndex.to_period") where a timezone aware index was converted to UTC first before creating [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") ([GH 22905](https://github.com/pandas-dev/pandas/issues/22905)) +* Bug in [`DataFrame.tz_localize()`](../reference/api/pandas.DataFrame.tz_localize.html#pandas.DataFrame.tz_localize "pandas.DataFrame.tz_localize"), [`DataFrame.tz_convert()`](../reference/api/pandas.DataFrame.tz_convert.html#pandas.DataFrame.tz_convert "pandas.DataFrame.tz_convert"), [`Series.tz_localize()`](../reference/api/pandas.Series.tz_localize.html#pandas.Series.tz_localize "pandas.Series.tz_localize"), and [`Series.tz_convert()`](../reference/api/pandas.Series.tz_convert.html#pandas.Series.tz_convert "pandas.Series.tz_convert") where `copy=False` would mutate the original argument inplace ([GH 6326](https://github.com/pandas-dev/pandas/issues/6326)) +* Bug in [`DataFrame.max()`](../reference/api/pandas.DataFrame.max.html#pandas.DataFrame.max "pandas.DataFrame.max") and [`DataFrame.min()`](../reference/api/pandas.DataFrame.min.html#pandas.DataFrame.min "pandas.DataFrame.min") with `axis=1` where a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `NaN` would be returned when all columns contained the same timezone ([GH 10390](https://github.com/pandas-dev/pandas/issues/10390)) + +### Offsets[#](#offsets "Link to this heading") + +* Bug in `FY5253` where date offsets could incorrectly raise an `AssertionError` in arithmetic operations ([GH 14774](https://github.com/pandas-dev/pandas/issues/14774)) +* Bug in `DateOffset` where keyword arguments `week` and `milliseconds` were accepted and ignored. Passing these will now raise `ValueError` ([GH 19398](https://github.com/pandas-dev/pandas/issues/19398)) +* Bug in adding `DateOffset` with [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") or [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") incorrectly raising `TypeError` ([GH 23215](https://github.com/pandas-dev/pandas/issues/23215)) +* Bug in comparing `DateOffset` objects with non-DateOffset objects, particularly strings, raising `ValueError` instead of returning `False` for equality checks and `True` for not-equal checks ([GH 23524](https://github.com/pandas-dev/pandas/issues/23524)) + +### Numeric[#](#numeric "Link to this heading") + +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") `__rmatmul__` doesn’t support matrix vector multiplication ([GH 21530](https://github.com/pandas-dev/pandas/issues/21530)) +* Bug in [`factorize()`](../reference/api/pandas.factorize.html#pandas.factorize "pandas.factorize") fails with read-only array ([GH 12813](https://github.com/pandas-dev/pandas/issues/12813)) +* Fixed bug in [`unique()`](../reference/api/pandas.unique.html#pandas.unique "pandas.unique") handled signed zeros inconsistently: for some inputs 0.0 and -0.0 were treated as equal and for some inputs as different. Now they are treated as equal for all inputs ([GH 21866](https://github.com/pandas-dev/pandas/issues/21866)) +* Bug in [`DataFrame.agg()`](../reference/api/pandas.DataFrame.agg.html#pandas.DataFrame.agg "pandas.DataFrame.agg"), [`DataFrame.transform()`](../reference/api/pandas.DataFrame.transform.html#pandas.DataFrame.transform "pandas.DataFrame.transform") and [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") where, + when supplied with a list of functions and `axis=1` (e.g. `df.apply(['sum', 'mean'], axis=1)`), + a `TypeError` was wrongly raised. For all three methods such calculation are now done correctly. ([GH 16679](https://github.com/pandas-dev/pandas/issues/16679)). +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") comparison against datetime-like scalars and arrays ([GH 22074](https://github.com/pandas-dev/pandas/issues/22074)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") multiplication between boolean dtype and integer returning `object` dtype instead of integer dtype ([GH 22047](https://github.com/pandas-dev/pandas/issues/22047), [GH 22163](https://github.com/pandas-dev/pandas/issues/22163)) +* Bug in [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") where, when supplied with a string argument and additional positional or keyword arguments (e.g. `df.apply('sum', min_count=1)`), a `TypeError` was wrongly raised ([GH 22376](https://github.com/pandas-dev/pandas/issues/22376)) +* Bug in [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") to extension dtype may raise `AttributeError` ([GH 22578](https://github.com/pandas-dev/pandas/issues/22578)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with `timedelta64[ns]` dtype arithmetic operations with `ndarray` with integer dtype incorrectly treating the narray as `timedelta64[ns]` dtype ([GH 23114](https://github.com/pandas-dev/pandas/issues/23114)) +* Bug in [`Series.rpow()`](../reference/api/pandas.Series.rpow.html#pandas.Series.rpow "pandas.Series.rpow") with object dtype `NaN` for `1 ** NA` instead of `1` ([GH 22922](https://github.com/pandas-dev/pandas/issues/22922)). +* [`Series.agg()`](../reference/api/pandas.Series.agg.html#pandas.Series.agg "pandas.Series.agg") can now handle numpy NaN-aware methods like [`numpy.nansum()`](https://numpy.org/doc/stable/reference/generated/numpy.nansum.html#numpy.nansum "(in NumPy v2.3)") ([GH 19629](https://github.com/pandas-dev/pandas/issues/19629)) +* Bug in [`Series.rank()`](../reference/api/pandas.Series.rank.html#pandas.Series.rank "pandas.Series.rank") and [`DataFrame.rank()`](../reference/api/pandas.DataFrame.rank.html#pandas.DataFrame.rank "pandas.DataFrame.rank") when `pct=True` and more than 224 rows are present resulted in percentages greater than 1.0 ([GH 18271](https://github.com/pandas-dev/pandas/issues/18271)) +* Calls such as [`DataFrame.round()`](../reference/api/pandas.DataFrame.round.html#pandas.DataFrame.round "pandas.DataFrame.round") with a non-unique [`CategoricalIndex()`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") now return expected data. Previously, data would be improperly duplicated ([GH 21809](https://github.com/pandas-dev/pandas/issues/21809)). +* Added `log10`, `floor` and `ceil` to the list of supported functions in [`DataFrame.eval()`](../reference/api/pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval") ([GH 24139](https://github.com/pandas-dev/pandas/issues/24139), [GH 24353](https://github.com/pandas-dev/pandas/issues/24353)) +* Logical operations `&, |, ^` between [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") will no longer raise `ValueError` ([GH 22092](https://github.com/pandas-dev/pandas/issues/22092)) +* Checking PEP 3141 numbers in [`is_scalar()`](../reference/api/pandas.api.types.is_scalar.html#pandas.api.types.is_scalar "pandas.api.types.is_scalar") function returns `True` ([GH 22903](https://github.com/pandas-dev/pandas/issues/22903)) +* Reduction methods like [`Series.sum()`](../reference/api/pandas.Series.sum.html#pandas.Series.sum "pandas.Series.sum") now accept the default value of `keepdims=False` when called from a NumPy ufunc, rather than raising a `TypeError`. Full support for `keepdims` has not been implemented ([GH 24356](https://github.com/pandas-dev/pandas/issues/24356)). + +### Conversion[#](#conversion "Link to this heading") + +* Bug in [`DataFrame.combine_first()`](../reference/api/pandas.DataFrame.combine_first.html#pandas.DataFrame.combine_first "pandas.DataFrame.combine_first") in which column types were unexpectedly converted to float ([GH 20699](https://github.com/pandas-dev/pandas/issues/20699)) +* Bug in [`DataFrame.clip()`](../reference/api/pandas.DataFrame.clip.html#pandas.DataFrame.clip "pandas.DataFrame.clip") in which column types are not preserved and casted to float ([GH 24162](https://github.com/pandas-dev/pandas/issues/24162)) +* Bug in [`DataFrame.clip()`](../reference/api/pandas.DataFrame.clip.html#pandas.DataFrame.clip "pandas.DataFrame.clip") when order of columns of dataframes doesn’t match, result observed is wrong in numeric values ([GH 20911](https://github.com/pandas-dev/pandas/issues/20911)) +* Bug in [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") where converting to an extension dtype when duplicate column names are present causes a `RecursionError` ([GH 24704](https://github.com/pandas-dev/pandas/issues/24704)) + +### Strings[#](#strings "Link to this heading") + +* Bug in `Index.str.partition()` was not nan-safe ([GH 23558](https://github.com/pandas-dev/pandas/issues/23558)). +* Bug in `Index.str.split()` was not nan-safe ([GH 23677](https://github.com/pandas-dev/pandas/issues/23677)). +* Bug [`Series.str.contains()`](../reference/api/pandas.Series.str.contains.html#pandas.Series.str.contains "pandas.Series.str.contains") not respecting the `na` argument for a `Categorical` dtype `Series` ([GH 22158](https://github.com/pandas-dev/pandas/issues/22158)) +* Bug in `Index.str.cat()` when the result contained only `NaN` ([GH 24044](https://github.com/pandas-dev/pandas/issues/24044)) + +### Interval[#](#interval "Link to this heading") + +* Bug in the [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") constructor where the `closed` parameter did not always override the inferred `closed` ([GH 19370](https://github.com/pandas-dev/pandas/issues/19370)) +* Bug in the `IntervalIndex` repr where a trailing comma was missing after the list of intervals ([GH 20611](https://github.com/pandas-dev/pandas/issues/20611)) +* Bug in [`Interval`](../reference/api/pandas.Interval.html#pandas.Interval "pandas.Interval") where scalar arithmetic operations did not retain the `closed` value ([GH 22313](https://github.com/pandas-dev/pandas/issues/22313)) +* Bug in [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") where indexing with datetime-like values raised a `KeyError` ([GH 20636](https://github.com/pandas-dev/pandas/issues/20636)) +* Bug in `IntervalTree` where data containing `NaN` triggered a warning and resulted in incorrect indexing queries with [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") ([GH 23352](https://github.com/pandas-dev/pandas/issues/23352)) + +### Indexing[#](#indexing "Link to this heading") + +* Bug in [`DataFrame.ne()`](../reference/api/pandas.DataFrame.ne.html#pandas.DataFrame.ne "pandas.DataFrame.ne") fails if columns contain column name “dtype” ([GH 22383](https://github.com/pandas-dev/pandas/issues/22383)) +* The traceback from a `KeyError` when asking `.loc` for a single missing label is now shorter and more clear ([GH 21557](https://github.com/pandas-dev/pandas/issues/21557)) +* [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") now emits a `KeyError` when a malformed string is looked up, which is consistent with the behavior of [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") ([GH 22803](https://github.com/pandas-dev/pandas/issues/22803)) +* When `.ix` is asked for a missing integer label in a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") with a first level of integer type, it now raises a `KeyError`, consistently with the case of a flat `Int64Index`, rather than falling back to positional indexing ([GH 21593](https://github.com/pandas-dev/pandas/issues/21593)) +* Bug in [`Index.reindex()`](../reference/api/pandas.Index.reindex.html#pandas.Index.reindex "pandas.Index.reindex") when reindexing a tz-naive and tz-aware [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") ([GH 8306](https://github.com/pandas-dev/pandas/issues/8306)) +* Bug in [`Series.reindex()`](../reference/api/pandas.Series.reindex.html#pandas.Series.reindex "pandas.Series.reindex") when reindexing an empty series with a `datetime64[ns, tz]` dtype ([GH 20869](https://github.com/pandas-dev/pandas/issues/20869)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") when setting values with `.loc` and a timezone aware [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") ([GH 11365](https://github.com/pandas-dev/pandas/issues/11365)) +* `DataFrame.__getitem__` now accepts dictionaries and dictionary keys as list-likes of labels, consistently with `Series.__getitem__` ([GH 21294](https://github.com/pandas-dev/pandas/issues/21294)) +* Fixed `DataFrame[np.nan]` when columns are non-unique ([GH 21428](https://github.com/pandas-dev/pandas/issues/21428)) +* Bug when indexing [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with nanosecond resolution dates and timezones ([GH 11679](https://github.com/pandas-dev/pandas/issues/11679)) +* Bug where indexing with a Numpy array containing negative values would mutate the indexer ([GH 21867](https://github.com/pandas-dev/pandas/issues/21867)) +* Bug where mixed indexes wouldn’t allow integers for `.at` ([GH 19860](https://github.com/pandas-dev/pandas/issues/19860)) +* `Float64Index.get_loc` now raises `KeyError` when boolean key passed. ([GH 19087](https://github.com/pandas-dev/pandas/issues/19087)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") when indexing with an [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") ([GH 19977](https://github.com/pandas-dev/pandas/issues/19977)) +* [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") no longer mangles `None`, `NaN` and `NaT`, i.e. they are treated as three different keys. However, for numeric Index all three are still coerced to a `NaN` ([GH 22332](https://github.com/pandas-dev/pandas/issues/22332)) +* Bug in `scalar in Index` if scalar is a float while the `Index` is of integer dtype ([GH 22085](https://github.com/pandas-dev/pandas/issues/22085)) +* Bug in [`MultiIndex.set_levels()`](../reference/api/pandas.MultiIndex.set_levels.html#pandas.MultiIndex.set_levels "pandas.MultiIndex.set_levels") when levels value is not subscriptable ([GH 23273](https://github.com/pandas-dev/pandas/issues/23273)) +* Bug where setting a timedelta column by `Index` causes it to be casted to double, and therefore lose precision ([GH 23511](https://github.com/pandas-dev/pandas/issues/23511)) +* Bug in [`Index.union()`](../reference/api/pandas.Index.union.html#pandas.Index.union "pandas.Index.union") and [`Index.intersection()`](../reference/api/pandas.Index.intersection.html#pandas.Index.intersection "pandas.Index.intersection") where name of the `Index` of the result was not computed correctly for certain cases ([GH 9943](https://github.com/pandas-dev/pandas/issues/9943), [GH 9862](https://github.com/pandas-dev/pandas/issues/9862)) +* Bug in [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") slicing with boolean [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") may raise `TypeError` ([GH 22533](https://github.com/pandas-dev/pandas/issues/22533)) +* Bug in `PeriodArray.__setitem__` when accepting slice and list-like value ([GH 23978](https://github.com/pandas-dev/pandas/issues/23978)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex"), [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") where indexing with `Ellipsis` would lose their `freq` attribute ([GH 21282](https://github.com/pandas-dev/pandas/issues/21282)) +* Bug in `iat` where using it to assign an incompatible value would create a new column ([GH 23236](https://github.com/pandas-dev/pandas/issues/23236)) + +### Missing[#](#missing "Link to this heading") + +* Bug in [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") where a `ValueError` would raise when one column contained a `datetime64[ns, tz]` dtype ([GH 15522](https://github.com/pandas-dev/pandas/issues/15522)) +* Bug in [`Series.hasnans()`](../reference/api/pandas.Series.hasnans.html#pandas.Series.hasnans "pandas.Series.hasnans") that could be incorrectly cached and return incorrect answers if null elements are introduced after an initial call ([GH 19700](https://github.com/pandas-dev/pandas/issues/19700)) +* [`Series.isin()`](../reference/api/pandas.Series.isin.html#pandas.Series.isin "pandas.Series.isin") now treats all NaN-floats as equal also for `np.object_`-dtype. This behavior is consistent with the behavior for float64 ([GH 22119](https://github.com/pandas-dev/pandas/issues/22119)) +* [`unique()`](../reference/api/pandas.unique.html#pandas.unique "pandas.unique") no longer mangles NaN-floats and the `NaT`-object for `np.object_`-dtype, i.e. `NaT` is no longer coerced to a NaN-value and is treated as a different entity. ([GH 22295](https://github.com/pandas-dev/pandas/issues/22295)) +* [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") now properly handle numpy masked arrays with hardened masks. Previously, constructing a DataFrame or Series from a masked array with a hard mask would create a pandas object containing the underlying value, rather than the expected NaN. ([GH 24574](https://github.com/pandas-dev/pandas/issues/24574)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor where `dtype` argument was not honored when handling numpy masked record arrays. ([GH 24874](https://github.com/pandas-dev/pandas/issues/24874)) + +### MultiIndex[#](#multiindex "Link to this heading") + +* Bug in `io.formats.style.Styler.applymap()` where `subset=` with [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") slice would reduce to [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") ([GH 19861](https://github.com/pandas-dev/pandas/issues/19861)) +* Removed compatibility for [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") pickles prior to version 0.8.0; compatibility with [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") pickles from version 0.13 forward is maintained ([GH 21654](https://github.com/pandas-dev/pandas/issues/21654)) +* [`MultiIndex.get_loc_level()`](../reference/api/pandas.MultiIndex.get_loc_level.html#pandas.MultiIndex.get_loc_level "pandas.MultiIndex.get_loc_level") (and as a consequence, `.loc` on a `Series` or `DataFrame` with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") index) will now raise a `KeyError`, rather than returning an empty `slice`, if asked a label which is present in the `levels` but is unused ([GH 22221](https://github.com/pandas-dev/pandas/issues/22221)) +* [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") has gained the [`MultiIndex.from_frame()`](../reference/api/pandas.MultiIndex.from_frame.html#pandas.MultiIndex.from_frame "pandas.MultiIndex.from_frame"), it allows constructing a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") object from a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 22420](https://github.com/pandas-dev/pandas/issues/22420)) +* Fix `TypeError` in Python 3 when creating [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") in which some levels have mixed types, e.g. when some labels are tuples ([GH 15457](https://github.com/pandas-dev/pandas/issues/15457)) + +### IO[#](#io "Link to this heading") + +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") in which a column specified with `CategoricalDtype` of boolean categories was not being correctly coerced from string values to booleans ([GH 20498](https://github.com/pandas-dev/pandas/issues/20498)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") in which unicode column names were not being properly recognized with Python 2.x ([GH 13253](https://github.com/pandas-dev/pandas/issues/13253)) +* Bug in [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") when writing timezone aware data (`datetime64[ns, tz]` dtype) would raise a `TypeError` ([GH 9086](https://github.com/pandas-dev/pandas/issues/9086)) +* Bug in [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") where a naive [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") would be written as `TIMESTAMP WITH TIMEZONE` type in supported databases, e.g. PostgreSQL ([GH 23510](https://github.com/pandas-dev/pandas/issues/23510)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") when `parse_cols` is specified with an empty dataset ([GH 9208](https://github.com/pandas-dev/pandas/issues/9208)) +* [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") no longer ignores all-whitespace `` within `` when considering the `skiprows` and `header` arguments. Previously, users had to decrease their `header` and `skiprows` values on such tables to work around the issue. ([GH 21641](https://github.com/pandas-dev/pandas/issues/21641)) +* [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") will correctly show the deprecation warning for previously deprecated `sheetname` ([GH 17994](https://github.com/pandas-dev/pandas/issues/17994)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") and [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") will throw `UnicodeError` and not coredump on badly encoded strings ([GH 22748](https://github.com/pandas-dev/pandas/issues/22748)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") will correctly parse timezone-aware datetimes ([GH 22256](https://github.com/pandas-dev/pandas/issues/22256)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") in which memory management was prematurely optimized for the C engine when the data was being read in chunks ([GH 23509](https://github.com/pandas-dev/pandas/issues/23509)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") in unnamed columns were being improperly identified when extracting a multi-index ([GH 23687](https://github.com/pandas-dev/pandas/issues/23687)) +* [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") will parse numbers in sas7bdat-files that have width less than 8 bytes correctly. ([GH 21616](https://github.com/pandas-dev/pandas/issues/21616)) +* [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") will correctly parse sas7bdat files with many columns ([GH 22628](https://github.com/pandas-dev/pandas/issues/22628)) +* [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") will correctly parse sas7bdat files with data page types having also bit 7 set (so page type is 128 + 256 = 384) ([GH 16615](https://github.com/pandas-dev/pandas/issues/16615)) +* Bug in [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") in which an incorrect error was raised on an invalid file format. ([GH 24548](https://github.com/pandas-dev/pandas/issues/24548)) +* Bug in `detect_client_encoding()` where potential `IOError` goes unhandled when importing in a mod\_wsgi process due to restricted access to stdout. ([GH 21552](https://github.com/pandas-dev/pandas/issues/21552)) +* Bug in [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") with `index=False` misses truncation indicators (…) on truncated DataFrame ([GH 15019](https://github.com/pandas-dev/pandas/issues/15019), [GH 22783](https://github.com/pandas-dev/pandas/issues/22783)) +* Bug in [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") with `index=False` when both columns and row index are `MultiIndex` ([GH 22579](https://github.com/pandas-dev/pandas/issues/22579)) +* Bug in [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") with `index_names=False` displaying index name ([GH 22747](https://github.com/pandas-dev/pandas/issues/22747)) +* Bug in [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") with `header=False` not displaying row index names ([GH 23788](https://github.com/pandas-dev/pandas/issues/23788)) +* Bug in [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") with `sparsify=False` that caused it to raise `TypeError` ([GH 22887](https://github.com/pandas-dev/pandas/issues/22887)) +* Bug in [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string") that broke column alignment when `index=False` and width of first column’s values is greater than the width of first column’s header ([GH 16839](https://github.com/pandas-dev/pandas/issues/16839), [GH 13032](https://github.com/pandas-dev/pandas/issues/13032)) +* Bug in [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string") that caused representations of [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") to not take up the whole window ([GH 22984](https://github.com/pandas-dev/pandas/issues/22984)) +* Bug in [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") where a single level MultiIndex incorrectly wrote a tuple. Now just the value of the index is written ([GH 19589](https://github.com/pandas-dev/pandas/issues/19589)). +* `HDFStore` will raise `ValueError` when the `format` kwarg is passed to the constructor ([GH 13291](https://github.com/pandas-dev/pandas/issues/13291)) +* Bug in [`HDFStore.append()`](../reference/api/pandas.HDFStore.append.html#pandas.HDFStore.append "pandas.HDFStore.append") when appending a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with an empty string column and `min_itemsize` < 8 ([GH 12242](https://github.com/pandas-dev/pandas/issues/12242)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") in which memory leaks occurred in the C engine when parsing `NaN` values due to insufficient cleanup on completion or error ([GH 21353](https://github.com/pandas-dev/pandas/issues/21353)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") in which incorrect error messages were being raised when `skipfooter` was passed in along with `nrows`, `iterator`, or `chunksize` ([GH 23711](https://github.com/pandas-dev/pandas/issues/23711)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") in which [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") index names were being improperly handled in the cases when they were not provided ([GH 23484](https://github.com/pandas-dev/pandas/issues/23484)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") in which unnecessary warnings were being raised when the dialect’s values conflicted with the default arguments ([GH 23761](https://github.com/pandas-dev/pandas/issues/23761)) +* Bug in [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") in which the error message was not displaying the valid flavors when an invalid one was provided ([GH 23549](https://github.com/pandas-dev/pandas/issues/23549)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") in which extraneous header names were extracted, even though none were specified ([GH 11733](https://github.com/pandas-dev/pandas/issues/11733)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") in which column names were not being properly converted to string sometimes in Python 2.x ([GH 23874](https://github.com/pandas-dev/pandas/issues/23874)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") in which `index_col=None` was not being respected and parsing index columns anyway ([GH 18792](https://github.com/pandas-dev/pandas/issues/18792), [GH 20480](https://github.com/pandas-dev/pandas/issues/20480)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") in which `usecols` was not being validated for proper column names when passed in as a string ([GH 20480](https://github.com/pandas-dev/pandas/issues/20480)) +* Bug in [`DataFrame.to_dict()`](../reference/api/pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict") when the resulting dict contains non-Python scalars in the case of numeric data ([GH 23753](https://github.com/pandas-dev/pandas/issues/23753)) +* [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string"), [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html"), [`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex") will correctly format output when a string is passed as the `float_format` argument ([GH 21625](https://github.com/pandas-dev/pandas/issues/21625), [GH 22270](https://github.com/pandas-dev/pandas/issues/22270)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") that caused it to raise `OverflowError` when trying to use ‘inf’ as `na_value` with integer index column ([GH 17128](https://github.com/pandas-dev/pandas/issues/17128)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") that caused the C engine on Python 3.6+ on Windows to improperly read CSV filenames with accented or special characters ([GH 15086](https://github.com/pandas-dev/pandas/issues/15086)) +* Bug in [`read_fwf()`](../reference/api/pandas.read_fwf.html#pandas.read_fwf "pandas.read_fwf") in which the compression type of a file was not being properly inferred ([GH 22199](https://github.com/pandas-dev/pandas/issues/22199)) +* Bug in `pandas.io.json.json_normalize()` that caused it to raise `TypeError` when two consecutive elements of `record_path` are dicts ([GH 22706](https://github.com/pandas-dev/pandas/issues/22706)) +* Bug in [`DataFrame.to_stata()`](../reference/api/pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata"), `pandas.io.stata.StataWriter` and `pandas.io.stata.StataWriter117` where a exception would leave a partially written and invalid dta file ([GH 23573](https://github.com/pandas-dev/pandas/issues/23573)) +* Bug in [`DataFrame.to_stata()`](../reference/api/pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata") and `pandas.io.stata.StataWriter117` that produced invalid files when using strLs with non-ASCII characters ([GH 23573](https://github.com/pandas-dev/pandas/issues/23573)) +* Bug in `HDFStore` that caused it to raise `ValueError` when reading a Dataframe in Python 3 from fixed format written in Python 2 ([GH 24510](https://github.com/pandas-dev/pandas/issues/24510)) +* Bug in [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string") and more generally in the floating `repr` formatter. Zeros were not trimmed if `inf` was present in a columns while it was the case with NA values. Zeros are now trimmed as in the presence of NA ([GH 24861](https://github.com/pandas-dev/pandas/issues/24861)). +* Bug in the `repr` when truncating the number of columns and having a wide last column ([GH 24849](https://github.com/pandas-dev/pandas/issues/24849)). + +### Plotting[#](#plotting "Link to this heading") + +* Bug in [`DataFrame.plot.scatter()`](../reference/api/pandas.DataFrame.plot.scatter.html#pandas.DataFrame.plot.scatter "pandas.DataFrame.plot.scatter") and [`DataFrame.plot.hexbin()`](../reference/api/pandas.DataFrame.plot.hexbin.html#pandas.DataFrame.plot.hexbin "pandas.DataFrame.plot.hexbin") caused x-axis label and ticklabels to disappear when colorbar was on in IPython inline backend ([GH 10611](https://github.com/pandas-dev/pandas/issues/10611), [GH 10678](https://github.com/pandas-dev/pandas/issues/10678), and [GH 20455](https://github.com/pandas-dev/pandas/issues/20455)) +* Bug in plotting a Series with datetimes using `matplotlib.axes.Axes.scatter()` ([GH 22039](https://github.com/pandas-dev/pandas/issues/22039)) +* Bug in [`DataFrame.plot.bar()`](../reference/api/pandas.DataFrame.plot.bar.html#pandas.DataFrame.plot.bar "pandas.DataFrame.plot.bar") caused bars to use multiple colors instead of a single one ([GH 20585](https://github.com/pandas-dev/pandas/issues/20585)) +* Bug in validating color parameter caused extra color to be appended to the given color array. This happened to multiple plotting functions using matplotlib. ([GH 20726](https://github.com/pandas-dev/pandas/issues/20726)) + +### GroupBy/resample/rolling[#](#groupby-resample-rolling "Link to this heading") + +* Bug in `Rolling.min()` and `Rolling.max()` with `closed='left'`, a datetime-like index and only one entry in the series leading to segfault ([GH 24718](https://github.com/pandas-dev/pandas/issues/24718)) +* Bug in `GroupBy.first()` and `GroupBy.last()` with `as_index=False` leading to the loss of timezone information ([GH 15884](https://github.com/pandas-dev/pandas/issues/15884)) +* Bug in `DateFrame.resample()` when downsampling across a DST boundary ([GH 8531](https://github.com/pandas-dev/pandas/issues/8531)) +* Bug in date anchoring for `DateFrame.resample()` with offset `Day` when n > 1 ([GH 24127](https://github.com/pandas-dev/pandas/issues/24127)) +* Bug where `ValueError` is wrongly raised when calling `SeriesGroupBy.count()` method of a + `SeriesGroupBy` when the grouping variable only contains NaNs and numpy version < 1.13 ([GH 21956](https://github.com/pandas-dev/pandas/issues/21956)). +* Multiple bugs in `Rolling.min()` with `closed='left'` and a + datetime-like index leading to incorrect results and also segfault. ([GH 21704](https://github.com/pandas-dev/pandas/issues/21704)) +* Bug in [`Resampler.apply()`](../reference/api/pandas.core.resample.Resampler.apply.html#pandas.core.resample.Resampler.apply "pandas.core.resample.Resampler.apply") when passing positional arguments to applied func ([GH 14615](https://github.com/pandas-dev/pandas/issues/14615)). +* Bug in [`Series.resample()`](../reference/api/pandas.Series.resample.html#pandas.Series.resample "pandas.Series.resample") when passing `numpy.timedelta64` to `loffset` kwarg ([GH 7687](https://github.com/pandas-dev/pandas/issues/7687)). +* Bug in [`Resampler.asfreq()`](../reference/api/pandas.core.resample.Resampler.asfreq.html#pandas.core.resample.Resampler.asfreq "pandas.core.resample.Resampler.asfreq") when frequency of `TimedeltaIndex` is a subperiod of a new frequency ([GH 13022](https://github.com/pandas-dev/pandas/issues/13022)). +* Bug in [`SeriesGroupBy.mean()`](../reference/api/pandas.core.groupby.SeriesGroupBy.mean.html#pandas.core.groupby.SeriesGroupBy.mean "pandas.core.groupby.SeriesGroupBy.mean") when values were integral but could not fit inside of int64, overflowing instead. ([GH 22487](https://github.com/pandas-dev/pandas/issues/22487)) +* `RollingGroupby.agg()` and `ExpandingGroupby.agg()` now support multiple aggregation functions as parameters ([GH 15072](https://github.com/pandas-dev/pandas/issues/15072)) +* Bug in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") and [`Series.resample()`](../reference/api/pandas.Series.resample.html#pandas.Series.resample "pandas.Series.resample") when resampling by a weekly offset (`'W'`) across a DST transition ([GH 9119](https://github.com/pandas-dev/pandas/issues/9119), [GH 21459](https://github.com/pandas-dev/pandas/issues/21459)) +* Bug in [`DataFrame.expanding()`](../reference/api/pandas.DataFrame.expanding.html#pandas.DataFrame.expanding "pandas.DataFrame.expanding") in which the `axis` argument was not being respected during aggregations ([GH 23372](https://github.com/pandas-dev/pandas/issues/23372)) +* Bug in `GroupBy.transform()` which caused missing values when the input function can accept a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") but renames it ([GH 23455](https://github.com/pandas-dev/pandas/issues/23455)). +* Bug in `GroupBy.nth()` where column order was not always preserved ([GH 20760](https://github.com/pandas-dev/pandas/issues/20760)) +* Bug in `GroupBy.rank()` with `method='dense'` and `pct=True` when a group has only one member would raise a `ZeroDivisionError` ([GH 23666](https://github.com/pandas-dev/pandas/issues/23666)). +* Calling `GroupBy.rank()` with empty groups and `pct=True` was raising a `ZeroDivisionError` ([GH 22519](https://github.com/pandas-dev/pandas/issues/22519)) +* Bug in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") when resampling `NaT` in `TimeDeltaIndex` ([GH 13223](https://github.com/pandas-dev/pandas/issues/13223)). +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") did not respect the `observed` argument when selecting a column and instead always used `observed=False` ([GH 23970](https://github.com/pandas-dev/pandas/issues/23970)) +* Bug in `SeriesGroupBy.pct_change()` or `DataFrameGroupBy.pct_change()` would previously work across groups when calculating the percent change, where it now correctly works per group ([GH 21200](https://github.com/pandas-dev/pandas/issues/21200), [GH 21235](https://github.com/pandas-dev/pandas/issues/21235)). +* Bug preventing hash table creation with very large number (2^32) of rows ([GH 22805](https://github.com/pandas-dev/pandas/issues/22805)) +* Bug in groupby when grouping on categorical causes `ValueError` and incorrect grouping if `observed=True` and `nan` is present in categorical column ([GH 24740](https://github.com/pandas-dev/pandas/issues/24740), [GH 21151](https://github.com/pandas-dev/pandas/issues/21151)). + +### Reshaping[#](#reshaping "Link to this heading") + +* Bug in [`pandas.concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") when joining resampled DataFrames with timezone aware index ([GH 13783](https://github.com/pandas-dev/pandas/issues/13783)) +* Bug in [`pandas.concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") when joining only `Series` the `names` argument of `concat` is no longer ignored ([GH 23490](https://github.com/pandas-dev/pandas/issues/23490)) +* Bug in [`Series.combine_first()`](../reference/api/pandas.Series.combine_first.html#pandas.Series.combine_first "pandas.Series.combine_first") with `datetime64[ns, tz]` dtype which would return tz-naive result ([GH 21469](https://github.com/pandas-dev/pandas/issues/21469)) +* Bug in [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where") and [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where") with `datetime64[ns, tz]` dtype ([GH 21546](https://github.com/pandas-dev/pandas/issues/21546)) +* Bug in [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where") with an empty DataFrame and empty `cond` having non-bool dtype ([GH 21947](https://github.com/pandas-dev/pandas/issues/21947)) +* Bug in [`Series.mask()`](../reference/api/pandas.Series.mask.html#pandas.Series.mask "pandas.Series.mask") and [`DataFrame.mask()`](../reference/api/pandas.DataFrame.mask.html#pandas.DataFrame.mask "pandas.DataFrame.mask") with `list` conditionals ([GH 21891](https://github.com/pandas-dev/pandas/issues/21891)) +* Bug in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") raises RecursionError when converting OutOfBounds `datetime64[ns, tz]` ([GH 20380](https://github.com/pandas-dev/pandas/issues/20380)) +* `GroupBy.rank()` now raises a `ValueError` when an invalid value is passed for argument `na_option` ([GH 22124](https://github.com/pandas-dev/pandas/issues/22124)) +* Bug in [`get_dummies()`](../reference/api/pandas.get_dummies.html#pandas.get_dummies "pandas.get_dummies") with Unicode attributes in Python 2 ([GH 22084](https://github.com/pandas-dev/pandas/issues/22084)) +* Bug in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") raises `RecursionError` when replacing empty lists ([GH 22083](https://github.com/pandas-dev/pandas/issues/22083)) +* Bug in [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") and [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") when dict is used as the `to_replace` value and one key in the dict is another key’s value, the results were inconsistent between using integer key and using string key ([GH 20656](https://github.com/pandas-dev/pandas/issues/20656)) +* Bug in [`DataFrame.drop_duplicates()`](../reference/api/pandas.DataFrame.drop_duplicates.html#pandas.DataFrame.drop_duplicates "pandas.DataFrame.drop_duplicates") for empty `DataFrame` which incorrectly raises an error ([GH 20516](https://github.com/pandas-dev/pandas/issues/20516)) +* Bug in [`pandas.wide_to_long()`](../reference/api/pandas.wide_to_long.html#pandas.wide_to_long "pandas.wide_to_long") when a string is passed to the stubnames argument and a column name is a substring of that stubname ([GH 22468](https://github.com/pandas-dev/pandas/issues/22468)) +* Bug in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") when merging `datetime64[ns, tz]` data that contained a DST transition ([GH 18885](https://github.com/pandas-dev/pandas/issues/18885)) +* Bug in [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") when merging on float values within defined tolerance ([GH 22981](https://github.com/pandas-dev/pandas/issues/22981)) +* Bug in [`pandas.concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") when concatenating a multicolumn DataFrame with tz-aware data against a DataFrame with a different number of columns ([GH 22796](https://github.com/pandas-dev/pandas/issues/22796)) +* Bug in [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") where confusing error message raised when attempting to merge with missing values ([GH 23189](https://github.com/pandas-dev/pandas/issues/23189)) +* Bug in [`DataFrame.nsmallest()`](../reference/api/pandas.DataFrame.nsmallest.html#pandas.DataFrame.nsmallest "pandas.DataFrame.nsmallest") and [`DataFrame.nlargest()`](../reference/api/pandas.DataFrame.nlargest.html#pandas.DataFrame.nlargest "pandas.DataFrame.nlargest") for dataframes that have a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") for columns ([GH 23033](https://github.com/pandas-dev/pandas/issues/23033)). +* Bug in [`pandas.melt()`](../reference/api/pandas.melt.html#pandas.melt "pandas.melt") when passing column names that are not present in `DataFrame` ([GH 23575](https://github.com/pandas-dev/pandas/issues/23575)) +* Bug in `DataFrame.append()` with a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with a dateutil timezone would raise a `TypeError` ([GH 23682](https://github.com/pandas-dev/pandas/issues/23682)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") construction when passing no data and `dtype=str` ([GH 22477](https://github.com/pandas-dev/pandas/issues/22477)) +* Bug in [`cut()`](../reference/api/pandas.cut.html#pandas.cut "pandas.cut") with `bins` as an overlapping `IntervalIndex` where multiple bins were returned per item instead of raising a `ValueError` ([GH 23980](https://github.com/pandas-dev/pandas/issues/23980)) +* Bug in [`pandas.concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") when joining `Series` datetimetz with `Series` category would lose timezone ([GH 23816](https://github.com/pandas-dev/pandas/issues/23816)) +* Bug in [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") when joining on partial MultiIndex would drop names ([GH 20452](https://github.com/pandas-dev/pandas/issues/20452)). +* [`DataFrame.nlargest()`](../reference/api/pandas.DataFrame.nlargest.html#pandas.DataFrame.nlargest "pandas.DataFrame.nlargest") and [`DataFrame.nsmallest()`](../reference/api/pandas.DataFrame.nsmallest.html#pandas.DataFrame.nsmallest "pandas.DataFrame.nsmallest") now returns the correct n values when keep != ‘all’ also when tied on the first columns ([GH 22752](https://github.com/pandas-dev/pandas/issues/22752)) +* Constructing a DataFrame with an index argument that wasn’t already an instance of [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") was broken ([GH 22227](https://github.com/pandas-dev/pandas/issues/22227)). +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") prevented list subclasses to be used to construction ([GH 21226](https://github.com/pandas-dev/pandas/issues/21226)) +* Bug in [`DataFrame.unstack()`](../reference/api/pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack") and [`DataFrame.pivot_table()`](../reference/api/pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table") returning a misleading error message when the resulting DataFrame has more elements than int32 can handle. Now, the error message is improved, pointing towards the actual problem ([GH 20601](https://github.com/pandas-dev/pandas/issues/20601)) +* Bug in [`DataFrame.unstack()`](../reference/api/pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack") where a `ValueError` was raised when unstacking timezone aware values ([GH 18338](https://github.com/pandas-dev/pandas/issues/18338)) +* Bug in [`DataFrame.stack()`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack") where timezone aware values were converted to timezone naive values ([GH 19420](https://github.com/pandas-dev/pandas/issues/19420)) +* Bug in [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") where a `TypeError` was raised when `by_col` were timezone aware values ([GH 21184](https://github.com/pandas-dev/pandas/issues/21184)) +* Bug showing an incorrect shape when throwing error during `DataFrame` construction. ([GH 20742](https://github.com/pandas-dev/pandas/issues/20742)) + +### Sparse[#](#sparse "Link to this heading") + +* Updating a boolean, datetime, or timedelta column to be Sparse now works ([GH 22367](https://github.com/pandas-dev/pandas/issues/22367)) +* Bug in `Series.to_sparse()` with Series already holding sparse data not constructing properly ([GH 22389](https://github.com/pandas-dev/pandas/issues/22389)) +* Providing a `sparse_index` to the SparseArray constructor no longer defaults the na-value to `np.nan` for all dtypes. The correct na\_value for `data.dtype` is now used. +* Bug in `SparseArray.nbytes` under-reporting its memory usage by not including the size of its sparse index. +* Improved performance of [`Series.shift()`](../reference/api/pandas.Series.shift.html#pandas.Series.shift "pandas.Series.shift") for non-NA `fill_value`, as values are no longer converted to a dense array. +* Bug in `DataFrame.groupby` not including `fill_value` in the groups for non-NA `fill_value` when grouping by a sparse column ([GH 5078](https://github.com/pandas-dev/pandas/issues/5078)) +* Bug in unary inversion operator (`~`) on a `SparseSeries` with boolean values. The performance of this has also been improved ([GH 22835](https://github.com/pandas-dev/pandas/issues/22835)) +* Bug in `SparseArary.unique()` not returning the unique values ([GH 19595](https://github.com/pandas-dev/pandas/issues/19595)) +* Bug in `SparseArray.nonzero()` and `SparseDataFrame.dropna()` returning shifted/incorrect results ([GH 21172](https://github.com/pandas-dev/pandas/issues/21172)) +* Bug in [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") where dtypes would lose sparseness ([GH 23744](https://github.com/pandas-dev/pandas/issues/23744)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") when concatenating a list of [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with all-sparse values changing the `fill_value` and converting to a dense Series ([GH 24371](https://github.com/pandas-dev/pandas/issues/24371)) + +### Style[#](#style "Link to this heading") + +* [`background_gradient()`](../reference/api/pandas.io.formats.style.Styler.background_gradient.html#pandas.io.formats.style.Styler.background_gradient "pandas.io.formats.style.Styler.background_gradient") now takes a `text_color_threshold` parameter to automatically lighten the text color based on the luminance of the background color. This improves readability with dark background colors without the need to limit the background colormap range. ([GH 21258](https://github.com/pandas-dev/pandas/issues/21258)) +* [`background_gradient()`](../reference/api/pandas.io.formats.style.Styler.background_gradient.html#pandas.io.formats.style.Styler.background_gradient "pandas.io.formats.style.Styler.background_gradient") now also supports tablewise application (in addition to rowwise and columnwise) with `axis=None` ([GH 15204](https://github.com/pandas-dev/pandas/issues/15204)) +* [`bar()`](../reference/api/pandas.io.formats.style.Styler.bar.html#pandas.io.formats.style.Styler.bar "pandas.io.formats.style.Styler.bar") now also supports tablewise application (in addition to rowwise and columnwise) with `axis=None` and setting clipping range with `vmin` and `vmax` ([GH 21548](https://github.com/pandas-dev/pandas/issues/21548) and [GH 21526](https://github.com/pandas-dev/pandas/issues/21526)). `NaN` values are also handled properly. + +### Build changes[#](#build-changes "Link to this heading") + +* Building pandas for development now requires `cython >= 0.28.2` ([GH 21688](https://github.com/pandas-dev/pandas/issues/21688)) +* Testing pandas now requires `hypothesis>=3.58`. You can find [the Hypothesis docs here](https://hypothesis.readthedocs.io/en/latest/index.html), and a pandas-specific introduction [in the contributing guide](../development/contributing_codebase.html#using-hypothesis). ([GH 22280](https://github.com/pandas-dev/pandas/issues/22280)) +* Building pandas on macOS now targets minimum macOS 10.9 if run on macOS 10.9 or above ([GH 23424](https://github.com/pandas-dev/pandas/issues/23424)) + +### Other[#](#other "Link to this heading") + +* Bug where C variables were declared with external linkage causing import errors if certain other C libraries were imported before pandas. ([GH 24113](https://github.com/pandas-dev/pandas/issues/24113)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 337 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* AJ Dyka + +* AJ Pryor, Ph.D + +* Aaron Critchley +* Adam Hooper +* Adam J. Stewart +* Adam Kim +* Adam Klimont + +* Addison Lynch + +* Alan Hogue + +* Alex Radu + +* Alex Rychyk +* Alex Strick van Linschoten + +* Alex Volkov + +* Alexander Buchkovsky +* Alexander Hess + +* Alexander Ponomaroff + +* Allison Browne + +* Aly Sivji +* Andrew +* Andrew Gross + +* Andrew Spott + +* Andy + +* Aniket uttam + +* Anjali2019 + +* Anjana S + +* Antti Kaihola + +* Anudeep Tubati + +* Arjun Sharma + +* Armin Varshokar +* Artem Bogachev +* ArtinSarraf + +* Barry Fitzgerald + +* Bart Aelterman + +* Ben James + +* Ben Nelson + +* Benjamin Grove + +* Benjamin Rowell + +* Benoit Paquet + +* Boris Lau + +* Brett Naul +* Brian Choi + +* C.A.M. Gerlach + +* Carl Johan + +* Chalmer Lowe +* Chang She +* Charles David + +* Cheuk Ting Ho +* Chris +* Chris Roberts + +* Christopher Whelan +* Chu Qing Hao + +* Da Cheezy Mobsta + +* Damini Satya +* Daniel Himmelstein +* Daniel Saxton + +* Darcy Meyer + +* DataOmbudsman +* David Arcos +* David Krych +* Dean Langsam + +* Diego Argueta + +* Diego Torres + +* Dobatymo + +* Doug Latornell + +* Dr. Irv +* Dylan Dmitri Gray + +* Eric Boxer + +* Eric Chea +* Erik + +* Erik Nilsson + +* Fabian Haase + +* Fabian Retkowski +* Fabien Aulaire + +* Fakabbir Amin + +* Fei Phoon + +* Fernando Margueirat + +* Florian Müller + +* Fábio Rosado + +* Gabe Fernando +* Gabriel Reid + +* Giftlin Rajaiah +* Gioia Ballin + +* Gjelt +* Gosuke Shibahara + +* Graham Inggs +* Guillaume Gay +* Guillaume Lemaitre + +* Hannah Ferchland +* Haochen Wu +* Hubert + +* HubertKl + +* HyunTruth + +* Iain Barr +* Ignacio Vergara Kausel + +* Irv Lustig + +* IsvenC + +* Jacopo Rota +* Jakob Jarmar + +* James Bourbeau + +* James Myatt + +* James Winegar + +* Jan Rudolph +* Jared Groves + +* Jason Kiley + +* Javad Noorbakhsh + +* Jay Offerdahl + +* Jeff Reback +* Jeongmin Yu + +* Jeremy Schendel +* Jerod Estapa + +* Jesper Dramsch + +* Jim Jeon + +* Joe Jevnik +* Joel Nothman +* Joel Ostblom + +* Jordi Contestí +* Jorge López Fueyo + +* Joris Van den Bossche +* Jose Quinones + +* Jose Rivera-Rubio + +* Josh +* Jun + +* Justin Zheng + +* Kaiqi Dong + +* Kalyan Gokhale +* Kang Yoosam + +* Karl Dunkle Werner + +* Karmanya Aggarwal + +* Kevin Markham + +* Kevin Sheppard +* Kimi Li + +* Koustav Samaddar + +* Krishna + +* Kristian Holsheimer + +* Ksenia Gueletina + +* Kyle Prestel + +* LJ + +* LeakedMemory + +* Li Jin + +* Licht Takeuchi +* Luca Donini + +* Luciano Viola + +* Mak Sze Chun + +* Marc Garcia +* Marius Potgieter + +* Mark Sikora + +* Markus Meier + +* Marlene Silva Marchena + +* Martin Babka + +* MatanCohe + +* Mateusz Woś + +* Mathew Topper + +* Matt Boggess + +* Matt Cooper + +* Matt Williams + +* Matthew Gilbert +* Matthew Roeschke +* Max Kanter +* Michael Odintsov +* Michael Silverstein + +* Michael-J-Ward + +* Mickaël Schoentgen + +* Miguel Sánchez de León Peque + +* Ming Li +* Mitar +* Mitch Negus +* Monson Shao + +* Moonsoo Kim + +* Mortada Mehyar +* Myles Braithwaite +* Nehil Jain + +* Nicholas Musolino + +* Nicolas Dickreuter + +* Nikhil Kumar Mengani + +* Nikoleta Glynatsi + +* Ondrej Kokes +* Pablo Ambrosio + +* Pamela Wu + +* Parfait G + +* Patrick Park + +* Paul +* Paul Ganssle +* Paul Reidy +* Paul van Mulbregt + +* Phillip Cloud +* Pietro Battiston +* Piyush Aggarwal + +* Prabakaran Kumaresshan + +* Pulkit Maloo +* Pyry Kovanen +* Rajib Mitra + +* Redonnet Louis + +* Rhys Parry + +* Rick + +* Robin +* Roei.r + +* RomainSa + +* Roman Imankulov + +* Roman Yurchak + +* Ruijing Li + +* Ryan + +* Ryan Nazareth + +* Rüdiger Busche + +* SEUNG HOON, SHIN + +* Sandrine Pataut + +* Sangwoong Yoon +* Santosh Kumar + +* Saurav Chakravorty + +* Scott McAllister + +* Sean Chan + +* Shadi Akiki + +* Shengpu Tang + +* Shirish Kadam + +* Simon Hawkins + +* Simon Riddell + +* Simone Basso +* Sinhrks +* Soyoun(Rose) Kim + +* Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) + +* Stefaan Lippens + +* Stefano Cianciulli +* Stefano Miccoli + +* Stephen Childs +* Stephen Pascoe +* Steve Baker + +* Steve Cook + +* Steve Dower + +* Stéphan Taljaard + +* Sumin Byeon + +* Sören + +* Tamas Nagy + +* Tanya Jain + +* Tarbo Fukazawa +* Thein Oo + +* Thiago Cordeiro da Fonseca + +* Thierry Moisan +* Thiviyan Thanapalasingam + +* Thomas Lentali + +* Tim D. Smith + +* Tim Swast +* Tom Augspurger +* Tomasz Kluczkowski + +* Tony Tao + +* Triple0 + +* Troels Nielsen + +* Tuhin Mahmud + +* Tyler Reddy + +* Uddeshya Singh +* Uwe L. Korn + +* Vadym Barda + +* Varad Gunjal + +* Victor Maryama + +* Victor Villas +* Vincent La +* Vitória Helena + +* Vu Le +* Vyom Jain + +* Weiwen Gu + +* Wenhuan +* Wes Turner +* Wil Tan + +* William Ayd +* Yeojin Kim + +* Yitzhak Andrade + +* Yuecheng Wu + +* Yuliya Dovzhenko + +* Yury Bayda + +* Zac Hatfield-Dodds + +* aberres + +* aeltanawy + +* ailchau + +* alimcmaster1 +* alphaCTzo7G + +* amphy + +* araraonline + +* azure-pipelines[bot] + +* benarthur91 + +* bk521234 + +* cgangwar11 + +* chris-b1 +* cxl923cc + +* dahlbaek + +* dannyhyunkim + +* darke-spirits + +* david-liu-brattle-1 +* davidmvalente + +* deflatSOCO +* doosik\_bae + +* dylanchase + +* eduardo naufel schettino + +* euri10 + +* evangelineliu + +* fengyqf + +* fjdiod +* fl4p + +* fleimgruber + +* gfyoung +* h-vetinari +* harisbal + +* henriqueribeiro + +* himanshu awasthi +* hongshaoyang + +* igorfassen + +* jalazbe + +* jbrockmendel +* jh-wu + +* justinchan23 + +* louispotok +* marcosrullan + +* miker985 +* nicolab100 + +* nprad +* nsuresh + +* ottiP +* pajachiet + +* raguiar2 + +* ratijas + +* realead + +* robbuckley + +* saurav2608 + +* sideeye + +* ssikdar1 +* svenharris + +* syutbai + +* testvinder + +* thatneat +* tmnhat2001 +* tomascassidy + +* tomneep +* topper-123 +* vkk800 + +* winlu + +* ym-pett + +* yrhooke + +* ywpark1 + +* zertrin +* zhezherun + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.24.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.24.1.md new file mode 100644 index 0000000000000000000000000000000000000000..30b1c2d787fa1d5fc186ae88ad57bfef6ae3aac7 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.24.1.md @@ -0,0 +1,77 @@ +# What's new in pandas 0.24.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.24.1.html + +# What’s new in 0.24.1 (February 3, 2019)[#](#what-s-new-in-0-24-1-february-3-2019 "Link to this heading") + +Warning + +The 0.24.x series of releases will be the last to support Python 2. Future feature +releases will support Python 3 only. See [Dropping Python 2.7](https://pandas.pydata.org/pandas-docs/version/0.24/install.html#install-dropping-27) for more. + +These are the changes in pandas 0.24.1. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. See [What’s new in 0.24.0 (January 25, 2019)](v0.24.0.html#whatsnew-0240) for the 0.24.0 changelog. + +## API changes[#](#api-changes "Link to this heading") + +### Changing the `sort` parameter for [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") set operations[#](#changing-the-sort-parameter-for-index-set-operations "Link to this heading") + +The default `sort` value for [`Index.union()`](../reference/api/pandas.Index.union.html#pandas.Index.union "pandas.Index.union") has changed from `True` to `None` ([GH 24959](https://github.com/pandas-dev/pandas/issues/24959)). +The default *behavior*, however, remains the same: the result is sorted, unless + +1. `self` and `other` are identical +2. `self` or `other` is empty +3. `self` or `other` contain values that can not be compared (a `RuntimeWarning` is raised). + +This change will allow `sort=True` to mean “always sort” in a future release. + +The same change applies to [`Index.difference()`](../reference/api/pandas.Index.difference.html#pandas.Index.difference "pandas.Index.difference") and [`Index.symmetric_difference()`](../reference/api/pandas.Index.symmetric_difference.html#pandas.Index.symmetric_difference "pandas.Index.symmetric_difference"), which +would not sort the result when the values could not be compared. + +The `sort` option for [`Index.intersection()`](../reference/api/pandas.Index.intersection.html#pandas.Index.intersection "pandas.Index.intersection") has changed in three ways. + +1. The default has changed from `True` to `False`, to restore the + pandas 0.23.4 and earlier behavior of not sorting by default. +2. The behavior of `sort=True` can now be obtained with `sort=None`. + This will sort the result only if the values in `self` and `other` + are not identical. +3. The value `sort=True` is no longer allowed. A future version of pandas + will properly support `sort=True` meaning “always sort”. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in [`DataFrame.to_dict()`](../reference/api/pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict") with `records` orient raising an + `AttributeError` when the `DataFrame` contained more than 255 columns, or + wrongly converting column names that were not valid python identifiers ([GH 24939](https://github.com/pandas-dev/pandas/issues/24939), [GH 24940](https://github.com/pandas-dev/pandas/issues/24940)). +* Fixed regression in [`read_sql()`](../reference/api/pandas.read_sql.html#pandas.read_sql "pandas.read_sql") when passing certain queries with MySQL/pymysql ([GH 24988](https://github.com/pandas-dev/pandas/issues/24988)). +* Fixed regression in [`Index.intersection`](../reference/api/pandas.Index.intersection.html#pandas.Index.intersection "pandas.Index.intersection") incorrectly sorting the values by default ([GH 24959](https://github.com/pandas-dev/pandas/issues/24959)). +* Fixed regression in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") when merging an empty `DataFrame` with multiple timezone-aware columns on one of the timezone-aware columns ([GH 25014](https://github.com/pandas-dev/pandas/issues/25014)). +* Fixed regression in [`Series.rename_axis()`](../reference/api/pandas.Series.rename_axis.html#pandas.Series.rename_axis "pandas.Series.rename_axis") and [`DataFrame.rename_axis()`](../reference/api/pandas.DataFrame.rename_axis.html#pandas.DataFrame.rename_axis "pandas.DataFrame.rename_axis") where passing `None` failed to remove the axis name ([GH 25034](https://github.com/pandas-dev/pandas/issues/25034)) +* Fixed regression in [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta") with `box=False` incorrectly returning a `datetime64` object instead of a `timedelta64` object ([GH 24961](https://github.com/pandas-dev/pandas/issues/24961)) +* Fixed regression where custom hashable types could not be used as column keys in [`DataFrame.set_index()`](../reference/api/pandas.DataFrame.set_index.html#pandas.DataFrame.set_index "pandas.DataFrame.set_index") ([GH 24969](https://github.com/pandas-dev/pandas/issues/24969)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +**Reshaping** + +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") with [`Grouper`](../reference/api/pandas.Grouper.html#pandas.Grouper "pandas.Grouper") when there is a time change (DST) and grouping frequency is `'1d'` ([GH 24972](https://github.com/pandas-dev/pandas/issues/24972)) + +**Visualization** + +* Fixed the warning for implicitly registered matplotlib converters not showing. See [Restore Matplotlib datetime converter registration](v0.21.1.html#whatsnew-0211-converters) for more ([GH 24963](https://github.com/pandas-dev/pandas/issues/24963)). + +**Other** + +* Fixed AttributeError when printing a DataFrame’s HTML repr after accessing the IPython config object ([GH 25036](https://github.com/pandas-dev/pandas/issues/25036)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 7 people contributed patches to this release. People with a “+” by their names contributed a patch for the first time. + +* Alex Buchkovsky +* Roman Yurchak +* h-vetinari +* jbrockmendel +* Jeremy Schendel +* Joris Van den Bossche +* Tom Augspurger diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.24.2.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.24.2.md new file mode 100644 index 0000000000000000000000000000000000000000..c12560bbbba139a7aca28767d88bc071ee48e04d --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.24.2.md @@ -0,0 +1,93 @@ +# What's new in pandas 0.24.2 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.24.2.html + +# What’s new in 0.24.2 (March 12, 2019)[#](#what-s-new-in-0-24-2-march-12-2019 "Link to this heading") + +Warning + +The 0.24.x series of releases will be the last to support Python 2. Future feature +releases will support Python 3 only. See [Dropping Python 2.7](https://pandas.pydata.org/pandas-docs/version/0.24/install.html#install-dropping-27) for more. + +These are the changes in pandas 0.24.2. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in [`DataFrame.all()`](../reference/api/pandas.DataFrame.all.html#pandas.DataFrame.all "pandas.DataFrame.all") and [`DataFrame.any()`](../reference/api/pandas.DataFrame.any.html#pandas.DataFrame.any "pandas.DataFrame.any") where `bool_only=True` was ignored ([GH 25101](https://github.com/pandas-dev/pandas/issues/25101)) +* Fixed issue in `DataFrame` construction with passing a mixed list of mixed types could segfault. ([GH 25075](https://github.com/pandas-dev/pandas/issues/25075)) +* Fixed regression in [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") causing `RecursionError` when `dict`-like classes were passed as argument. ([GH 25196](https://github.com/pandas-dev/pandas/issues/25196)) +* Fixed regression in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") where `regex=True` was only replacing patterns matching the start of the string ([GH 25259](https://github.com/pandas-dev/pandas/issues/25259)) +* Fixed regression in [`DataFrame.duplicated()`](../reference/api/pandas.DataFrame.duplicated.html#pandas.DataFrame.duplicated "pandas.DataFrame.duplicated"), where empty dataframe was not returning a boolean dtyped Series. ([GH 25184](https://github.com/pandas-dev/pandas/issues/25184)) +* Fixed regression in [`Series.min()`](../reference/api/pandas.Series.min.html#pandas.Series.min "pandas.Series.min") and [`Series.max()`](../reference/api/pandas.Series.max.html#pandas.Series.max "pandas.Series.max") where `numeric_only=True` was ignored when the `Series` contained `Categorical` data ([GH 25299](https://github.com/pandas-dev/pandas/issues/25299)) +* Fixed regression in subtraction between [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") objects with `datetime64[ns]` dtype incorrectly raising `OverflowError` when the `Series` on the right contains null values ([GH 25317](https://github.com/pandas-dev/pandas/issues/25317)) +* Fixed regression in [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") where `np.sum(index)` incorrectly returned a zero-dimensional object instead of a scalar ([GH 25282](https://github.com/pandas-dev/pandas/issues/25282)) +* Fixed regression in `IntervalDtype` construction where passing an incorrect string with ‘Interval’ as a prefix could result in a `RecursionError`. ([GH 25338](https://github.com/pandas-dev/pandas/issues/25338)) +* Fixed regression in creating a period-dtype array from a read-only NumPy array of period objects. ([GH 25403](https://github.com/pandas-dev/pandas/issues/25403)) +* Fixed regression in [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical"), where constructing it from a categorical `Series` and an explicit `categories=` that differed from that in the `Series` created an invalid object which could trigger segfaults. ([GH 25318](https://github.com/pandas-dev/pandas/issues/25318)) +* Fixed regression in [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta") losing precision when converting floating data to `Timedelta` data ([GH 25077](https://github.com/pandas-dev/pandas/issues/25077)). +* Fixed pip installing from source into an environment without NumPy ([GH 25193](https://github.com/pandas-dev/pandas/issues/25193)) +* Fixed regression in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") where large strings of numbers would be coerced into `int64`, causing an `OverflowError` ([GH 25616](https://github.com/pandas-dev/pandas/issues/25616)) +* Fixed regression in [`factorize()`](../reference/api/pandas.factorize.html#pandas.factorize "pandas.factorize") when passing a custom `na_sentinel` value with `sort=True` ([GH 25409](https://github.com/pandas-dev/pandas/issues/25409)). +* Fixed regression in [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") writing duplicate line endings with gzip compress ([GH 25311](https://github.com/pandas-dev/pandas/issues/25311)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +**I/O** + +* Better handling of terminal printing when the terminal dimensions are not known ([GH 25080](https://github.com/pandas-dev/pandas/issues/25080)) +* Bug in reading a HDF5 table-format `DataFrame` created in Python 2, in Python 3 ([GH 24925](https://github.com/pandas-dev/pandas/issues/24925)) +* Bug in reading a JSON with `orient='table'` generated by [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") with `index=False` ([GH 25170](https://github.com/pandas-dev/pandas/issues/25170)) +* Bug where float indexes could have misaligned values when printing ([GH 25061](https://github.com/pandas-dev/pandas/issues/25061)) + +**Categorical** + +* Bug where calling [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") on categorical data could return a `Series` with incorrect dimensions ([GH 24971](https://github.com/pandas-dev/pandas/issues/24971)) + +**Reshaping** + +* Bug in `GroupBy.transform()` where applying a function to a timezone aware column would return a timezone naive result ([GH 24198](https://github.com/pandas-dev/pandas/issues/24198)) +* Bug in [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") when joining on a timezone aware [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") ([GH 23931](https://github.com/pandas-dev/pandas/issues/23931)) + +**Visualization** + +* Bug in [`Series.plot()`](../reference/api/pandas.Series.plot.html#pandas.Series.plot "pandas.Series.plot") where a secondary y axis could not be set to log scale ([GH 25545](https://github.com/pandas-dev/pandas/issues/25545)) + +**Other** + +* Bug in [`Series.is_unique()`](../reference/api/pandas.Series.is_unique.html#pandas.Series.is_unique "pandas.Series.is_unique") where single occurrences of `NaN` were not considered unique ([GH 25180](https://github.com/pandas-dev/pandas/issues/25180)) +* Bug in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") when merging an empty `DataFrame` with an `Int64` column or a non-empty `DataFrame` with an `Int64` column that is all `NaN` ([GH 25183](https://github.com/pandas-dev/pandas/issues/25183)) +* Bug in `IntervalTree` where a `RecursionError` occurs upon construction due to an overflow when adding endpoints, which also causes [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") to crash during indexing operations ([GH 25485](https://github.com/pandas-dev/pandas/issues/25485)) +* Bug in [`Series.size`](../reference/api/pandas.Series.size.html#pandas.Series.size "pandas.Series.size") raising for some extension-array-backed `Series`, rather than returning the size ([GH 25580](https://github.com/pandas-dev/pandas/issues/25580)) +* Bug in resampling raising for nullable integer-dtype columns ([GH 25580](https://github.com/pandas-dev/pandas/issues/25580)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 25 people contributed patches to this release. People with a “+” by their names contributed a patch for the first time. + +* Albert Villanova del Moral +* Arno Veenstra + +* chris-b1 +* Devin Petersohn + +* EternalLearner42 + +* Flavien Lambert + +* gfyoung +* Gioia Ballin +* jbrockmendel +* Jeff Reback +* Jeremy Schendel +* Johan von Forstner + +* Joris Van den Bossche +* Josh +* Justin Zheng +* Kendall Masse +* Matthew Roeschke +* Max Bolingbroke + +* rbenes + +* Sterling Paramore + +* Tao He + +* Thomas A Caswell +* Tom Augspurger +* Vibhu Agarwal + +* William Ayd +* Zach Angell diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.25.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.25.0.md new file mode 100644 index 0000000000000000000000000000000000000000..79a993915d8497a255d30aac55c5480712d4bd0b --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.25.0.md @@ -0,0 +1,1643 @@ +# What's new in pandas 0.25.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.25.0.html + +# What’s new in 0.25.0 (July 18, 2019)[#](#what-s-new-in-0-25-0-july-18-2019 "Link to this heading") + +Warning + +Starting with the 0.25.x series of releases, pandas only supports Python 3.5.3 and higher. +See [Dropping Python 2.7](https://pandas.pydata.org/pandas-docs/version/0.24/install.html#install-dropping-27) for more details. + +Warning + +The minimum supported Python version will be bumped to 3.6 in a future release. + +Warning + +`Panel` has been fully removed. For N-D labeled data structures, please +use [xarray](https://xarray.pydata.org/en/stable/) + +Warning + +`read_pickle()` and `read_msgpack()` are only guaranteed backwards compatible back to +pandas version 0.20.3 ([GH 27082](https://github.com/pandas-dev/pandas/issues/27082)) + +These are the changes in pandas 0.25.0. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Enhancements[#](#enhancements "Link to this heading") + +### GroupBy aggregation with relabeling[#](#groupby-aggregation-with-relabeling "Link to this heading") + +pandas has added special groupby behavior, known as “named aggregation”, for naming the +output columns when applying multiple aggregation functions to specific columns ([GH 18366](https://github.com/pandas-dev/pandas/issues/18366), [GH 26512](https://github.com/pandas-dev/pandas/issues/26512)). + +```None +In [1]: animals = pd.DataFrame({'kind': ['cat', 'dog', 'cat', 'dog'], + ...: 'height': [9.1, 6.0, 9.5, 34.0], + ...: 'weight': [7.9, 7.5, 9.9, 198.0]}) + ...: + +In [2]: animals +Out[2]: + kind height weight +0 cat 9.1 7.9 +1 dog 6.0 7.5 +2 cat 9.5 9.9 +3 dog 34.0 198.0 + +[4 rows x 3 columns] + +In [3]: animals.groupby("kind").agg( + ...: min_height=pd.NamedAgg(column='height', aggfunc='min'), + ...: max_height=pd.NamedAgg(column='height', aggfunc='max'), + ...: average_weight=pd.NamedAgg(column='weight', aggfunc="mean"), + ...: ) + ...: +Out[3]: + min_height max_height average_weight +kind +cat 9.1 9.5 8.90 +dog 6.0 34.0 102.75 + +[2 rows x 3 columns] +``` + +Pass the desired columns names as the `**kwargs` to `.agg`. The values of `**kwargs` +should be tuples where the first element is the column selection, and the second element is the +aggregation function to apply. pandas provides the `pandas.NamedAgg` namedtuple to make it clearer +what the arguments to the function are, but plain tuples are accepted as well. + +```None +In [4]: animals.groupby("kind").agg( + ...: min_height=('height', 'min'), + ...: max_height=('height', 'max'), + ...: average_weight=('weight', 'mean'), + ...: ) + ...: +Out[4]: + min_height max_height average_weight +kind +cat 9.1 9.5 8.90 +dog 6.0 34.0 102.75 + +[2 rows x 3 columns] +``` + +Named aggregation is the recommended replacement for the deprecated “dict-of-dicts” +approach to naming the output of column-specific aggregations ([Deprecate groupby.agg() with a dictionary when renaming](v0.20.0.html#whatsnew-0200-api-breaking-deprecate-group-agg-dict)). + +A similar approach is now available for Series groupby objects as well. Because there’s no need for +column selection, the values can just be the functions to apply + +```None +In [5]: animals.groupby("kind").height.agg( + ...: min_height="min", + ...: max_height="max", + ...: ) + ...: +Out[5]: + min_height max_height +kind +cat 9.1 9.5 +dog 6.0 34.0 + +[2 rows x 2 columns] +``` + +This type of aggregation is the recommended alternative to the deprecated behavior when passing +a dict to a Series groupby aggregation ([Deprecate groupby.agg() with a dictionary when renaming](v0.20.0.html#whatsnew-0200-api-breaking-deprecate-group-agg-dict)). + +See [Named aggregation](../user_guide/groupby.html#groupby-aggregate-named) for more. + +### GroupBy aggregation with multiple lambdas[#](#groupby-aggregation-with-multiple-lambdas "Link to this heading") + +You can now provide multiple lambda functions to a list-like aggregation in +`GroupBy.agg` ([GH 26430](https://github.com/pandas-dev/pandas/issues/26430)). + +```None +In [6]: animals.groupby('kind').height.agg([ + ...: lambda x: x.iloc[0], lambda x: x.iloc[-1] + ...: ]) + ...: +Out[6]: + +kind +cat 9.1 9.5 +dog 6.0 34.0 + +[2 rows x 2 columns] + +In [7]: animals.groupby('kind').agg([ + ...: lambda x: x.iloc[0] - x.iloc[1], + ...: lambda x: x.iloc[0] + x.iloc[1] + ...: ]) + ...: +Out[7]: + height weight + +kind +cat -0.4 18.6 -2.0 17.8 +dog -28.0 40.0 -190.5 205.5 + +[2 rows x 4 columns] +``` + +Previously, these raised a `SpecificationError`. + +### Better repr for MultiIndex[#](#better-repr-for-multiindex "Link to this heading") + +Printing of [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") instances now shows tuples of each row and ensures +that the tuple items are vertically aligned, so it’s now easier to understand +the structure of the `MultiIndex`. ([GH 13480](https://github.com/pandas-dev/pandas/issues/13480)): + +The repr now looks like this: + +```None +In [8]: pd.MultiIndex.from_product([['a', 'abc'], range(500)]) +Out[8]: +MultiIndex([( 'a', 0), + ( 'a', 1), + ( 'a', 2), + ( 'a', 3), + ( 'a', 4), + ( 'a', 5), + ( 'a', 6), + ( 'a', 7), + ( 'a', 8), + ( 'a', 9), + ... + ('abc', 490), + ('abc', 491), + ('abc', 492), + ('abc', 493), + ('abc', 494), + ('abc', 495), + ('abc', 496), + ('abc', 497), + ('abc', 498), + ('abc', 499)], + length=1000) +``` + +Previously, outputting a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") printed all the `levels` and +`codes` of the `MultiIndex`, which was visually unappealing and made +the output more difficult to navigate. For example (limiting the range to 5): + +```None +In [1]: pd.MultiIndex.from_product([['a', 'abc'], range(5)]) +Out[1]: MultiIndex(levels=[['a', 'abc'], [0, 1, 2, 3]], + ...: codes=[[0, 0, 0, 0, 1, 1, 1, 1], [0, 1, 2, 3, 0, 1, 2, 3]]) +``` + +In the new repr, all values will be shown, if the number of rows is smaller +than `options.display.max_seq_items` (default: 100 items). Horizontally, +the output will truncate, if it’s wider than `options.display.width` +(default: 80 characters). + +### Shorter truncated repr for Series and DataFrame[#](#shorter-truncated-repr-for-series-and-dataframe "Link to this heading") + +Currently, the default display options of pandas ensure that when a Series +or DataFrame has more than 60 rows, its repr gets truncated to this maximum +of 60 rows (the `display.max_rows` option). However, this still gives +a repr that takes up a large part of the vertical screen estate. Therefore, +a new option `display.min_rows` is introduced with a default of 10 which +determines the number of rows showed in the truncated repr: + +* For small Series or DataFrames, up to `max_rows` number of rows is shown + (default: 60). +* For larger Series of DataFrame with a length above `max_rows`, only + `min_rows` number of rows is shown (default: 10, i.e. the first and last + 5 rows). + +This dual option allows to still see the full content of relatively small +objects (e.g. `df.head(20)` shows all 20 rows), while giving a brief repr +for large objects. + +To restore the previous behaviour of a single threshold, set +`pd.options.display.min_rows = None`. + +### JSON normalize with max\_level param support[#](#json-normalize-with-max-level-param-support "Link to this heading") + +[`json_normalize()`](../reference/api/pandas.json_normalize.html#pandas.json_normalize "pandas.json_normalize") normalizes the provided input dict to all +nested levels. The new max\_level parameter provides more control over +which level to end normalization ([GH 23843](https://github.com/pandas-dev/pandas/issues/23843)): + +The repr now looks like this: + +```None +from pandas.io.json import json_normalize +data = [{ + 'CreatedBy': {'Name': 'User001'}, + 'Lookup': {'TextField': 'Some text', + 'UserField': {'Id': 'ID001', 'Name': 'Name001'}}, + 'Image': {'a': 'b'} +}] +json_normalize(data, max_level=1) +``` + +### Series.explode to split list-like values to rows[#](#series-explode-to-split-list-like-values-to-rows "Link to this heading") + +[`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") have gained the [`DataFrame.explode()`](../reference/api/pandas.DataFrame.explode.html#pandas.DataFrame.explode "pandas.DataFrame.explode") methods to transform list-likes to individual rows. See [section on Exploding list-like column](../user_guide/reshaping.html#reshaping-explode) in docs for more information ([GH 16538](https://github.com/pandas-dev/pandas/issues/16538), [GH 10511](https://github.com/pandas-dev/pandas/issues/10511)) + +Here is a typical usecase. You have comma separated string in a column. + +```None +In [9]: df = pd.DataFrame([{'var1': 'a,b,c', 'var2': 1}, + ...: {'var1': 'd,e,f', 'var2': 2}]) + ...: + +In [10]: df +Out[10]: + var1 var2 +0 a,b,c 1 +1 d,e,f 2 + +[2 rows x 2 columns] +``` + +Creating a long form `DataFrame` is now straightforward using chained operations + +```None +In [11]: df.assign(var1=df.var1.str.split(',')).explode('var1') +Out[11]: + var1 var2 +0 a 1 +0 b 1 +0 c 1 +1 d 2 +1 e 2 +1 f 2 + +[6 rows x 2 columns] +``` + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") keywords `logy`, `logx` and `loglog` can now accept the value `'sym'` for symlog scaling. ([GH 24867](https://github.com/pandas-dev/pandas/issues/24867)) +* Added support for ISO week year format (‘%G-%V-%u’) when parsing datetimes using [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") ([GH 16607](https://github.com/pandas-dev/pandas/issues/16607)) +* Indexing of `DataFrame` and `Series` now accepts zerodim `np.ndarray` ([GH 24919](https://github.com/pandas-dev/pandas/issues/24919)) +* [`Timestamp.replace()`](../reference/api/pandas.Timestamp.replace.html#pandas.Timestamp.replace "pandas.Timestamp.replace") now supports the `fold` argument to disambiguate DST transition times ([GH 25017](https://github.com/pandas-dev/pandas/issues/25017)) +* [`DataFrame.at_time()`](../reference/api/pandas.DataFrame.at_time.html#pandas.DataFrame.at_time "pandas.DataFrame.at_time") and [`Series.at_time()`](../reference/api/pandas.Series.at_time.html#pandas.Series.at_time "pandas.Series.at_time") now support [`datetime.time`](https://docs.python.org/3/library/datetime.html#datetime.time "(in Python v3.13)") objects with timezones ([GH 24043](https://github.com/pandas-dev/pandas/issues/24043)) +* [`DataFrame.pivot_table()`](../reference/api/pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table") now accepts an `observed` parameter which is passed to underlying calls to [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") to speed up grouping categorical data. ([GH 24923](https://github.com/pandas-dev/pandas/issues/24923)) +* `Series.str` has gained [`Series.str.casefold()`](../reference/api/pandas.Series.str.casefold.html#pandas.Series.str.casefold "pandas.Series.str.casefold") method to removes all case distinctions present in a string ([GH 25405](https://github.com/pandas-dev/pandas/issues/25405)) +* [`DataFrame.set_index()`](../reference/api/pandas.DataFrame.set_index.html#pandas.DataFrame.set_index "pandas.DataFrame.set_index") now works for instances of `abc.Iterator`, provided their output is of the same length as the calling frame ([GH 22484](https://github.com/pandas-dev/pandas/issues/22484), [GH 24984](https://github.com/pandas-dev/pandas/issues/24984)) +* `DatetimeIndex.union()` now supports the `sort` argument. The behavior of the sort parameter matches that of [`Index.union()`](../reference/api/pandas.Index.union.html#pandas.Index.union "pandas.Index.union") ([GH 24994](https://github.com/pandas-dev/pandas/issues/24994)) +* `RangeIndex.union()` now supports the `sort` argument. If `sort=False` an unsorted `Int64Index` is always returned. `sort=None` is the default and returns a monotonically increasing `RangeIndex` if possible or a sorted `Int64Index` if not ([GH 24471](https://github.com/pandas-dev/pandas/issues/24471)) +* `TimedeltaIndex.intersection()` now also supports the `sort` keyword ([GH 24471](https://github.com/pandas-dev/pandas/issues/24471)) +* [`DataFrame.rename()`](../reference/api/pandas.DataFrame.rename.html#pandas.DataFrame.rename "pandas.DataFrame.rename") now supports the `errors` argument to raise errors when attempting to rename nonexistent keys ([GH 13473](https://github.com/pandas-dev/pandas/issues/13473)) +* Added [Sparse accessor](../reference/frame.html#api-frame-sparse) for working with a `DataFrame` whose values are sparse ([GH 25681](https://github.com/pandas-dev/pandas/issues/25681)) +* [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") has gained [`start`](../reference/api/pandas.RangeIndex.start.html#pandas.RangeIndex.start "pandas.RangeIndex.start"), [`stop`](../reference/api/pandas.RangeIndex.stop.html#pandas.RangeIndex.stop "pandas.RangeIndex.stop"), and [`step`](../reference/api/pandas.RangeIndex.step.html#pandas.RangeIndex.step "pandas.RangeIndex.step") attributes ([GH 25710](https://github.com/pandas-dev/pandas/issues/25710)) +* [`datetime.timezone`](https://docs.python.org/3/library/datetime.html#datetime.timezone "(in Python v3.13)") objects are now supported as arguments to timezone methods and constructors ([GH 25065](https://github.com/pandas-dev/pandas/issues/25065)) +* [`DataFrame.query()`](../reference/api/pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") and [`DataFrame.eval()`](../reference/api/pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval") now supports quoting column names with backticks to refer to names with spaces ([GH 6508](https://github.com/pandas-dev/pandas/issues/6508)) +* [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") now gives a more clear error message when merge keys are categoricals that are not equal ([GH 26136](https://github.com/pandas-dev/pandas/issues/26136)) +* `Rolling()` supports exponential (or Poisson) window type ([GH 21303](https://github.com/pandas-dev/pandas/issues/21303)) +* Error message for missing required imports now includes the original import error’s text ([GH 23868](https://github.com/pandas-dev/pandas/issues/23868)) +* [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") and [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") now have a `mean` method ([GH 24757](https://github.com/pandas-dev/pandas/issues/24757)) +* [`DataFrame.describe()`](../reference/api/pandas.DataFrame.describe.html#pandas.DataFrame.describe "pandas.DataFrame.describe") now formats integer percentiles without decimal point ([GH 26660](https://github.com/pandas-dev/pandas/issues/26660)) +* Added support for reading SPSS .sav files using [`read_spss()`](../reference/api/pandas.read_spss.html#pandas.read_spss "pandas.read_spss") ([GH 26537](https://github.com/pandas-dev/pandas/issues/26537)) +* Added new option `plotting.backend` to be able to select a plotting backend different than the existing `matplotlib` one. Use `pandas.set_option('plotting.backend', '')` where ` 1 pd.MultiIndex(levels=[[1, 2]], codes=[[0, -2]]) + +File ~/work/pandas/pandas/pandas/core/indexes/multi.py:365, in MultiIndex.__new__(cls, levels, codes, sortorder, names, dtype, copy, name, verify_integrity) + 362 result.sortorder = sortorder + 364 if verify_integrity: +--> 365 new_codes = result._verify_integrity() + 366 result._codes = new_codes + 368 result._reset_identity() + +File ~/work/pandas/pandas/pandas/core/indexes/multi.py:452, in MultiIndex._verify_integrity(self, codes, levels, levels_to_verify) + 446 raise ValueError( + 447 f"On level {i}, code max ({level_codes.max()}) >= length of " + 448 f"level ({len(level)}). NOTE: this index is in an " + 449 "inconsistent state" + 450 ) + 451 if len(level_codes) and level_codes.min() < -1: +--> 452 raise ValueError(f"On level {i}, code value ({level_codes.min()}) < -1") + 453 if not level.is_unique: + 454 raise ValueError( + 455 f"Level values must be unique: {list(level)} on level {i}" + 456 ) + +ValueError: On level 0, code value (-2) < -1 +``` + +### `GroupBy.apply` on `DataFrame` evaluates first group only once[#](#groupby-apply-on-dataframe-evaluates-first-group-only-once "Link to this heading") + +The implementation of [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") +previously evaluated the supplied function consistently twice on the first group +to infer if it is safe to use a fast code path. Particularly for functions with +side effects, this was an undesired behavior and may have led to surprises. ([GH 2936](https://github.com/pandas-dev/pandas/issues/2936), [GH 2656](https://github.com/pandas-dev/pandas/issues/2656), [GH 7739](https://github.com/pandas-dev/pandas/issues/7739), [GH 10519](https://github.com/pandas-dev/pandas/issues/10519), [GH 12155](https://github.com/pandas-dev/pandas/issues/12155), [GH 20084](https://github.com/pandas-dev/pandas/issues/20084), [GH 21417](https://github.com/pandas-dev/pandas/issues/21417)) + +Now every group is evaluated only a single time. + +```None +In [17]: df = pd.DataFrame({"a": ["x", "y"], "b": [1, 2]}) + +In [18]: df +Out[18]: + a b +0 x 1 +1 y 2 + +[2 rows x 2 columns] + +In [19]: def func(group): + ....: print(group.name) + ....: return group + ....: +``` + +*Previous behavior*: + +```None +In [3]: df.groupby('a').apply(func) +x +x +y +Out[3]: + a b +0 x 1 +1 y 2 +``` + +*New behavior*: + +```None +In [3]: df.groupby('a').apply(func) +x +y +Out[3]: + a b +0 x 1 +1 y 2 +``` + +### Concatenating sparse values[#](#concatenating-sparse-values "Link to this heading") + +When passed DataFrames whose values are sparse, [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") will now return a +[`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with sparse values, rather than a `SparseDataFrame` ([GH 25702](https://github.com/pandas-dev/pandas/issues/25702)). + +```None +In [20]: df = pd.DataFrame({"A": pd.arrays.SparseArray([0, 1])}) +``` + +*Previous behavior*: + +```None +In [2]: type(pd.concat([df, df])) +pandas.core.sparse.frame.SparseDataFrame +``` + +*New behavior*: + +```None +In [21]: type(pd.concat([df, df])) +Out[21]: pandas.core.frame.DataFrame +``` + +This now matches the existing behavior of [`concat`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") on `Series` with sparse values. +[`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") will continue to return a `SparseDataFrame` when all the values +are instances of `SparseDataFrame`. + +This change also affects routines using [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") internally, like [`get_dummies()`](../reference/api/pandas.get_dummies.html#pandas.get_dummies "pandas.get_dummies"), +which now returns a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") in all cases (previously a `SparseDataFrame` was +returned if all the columns were dummy encoded, and a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") otherwise). + +Providing any `SparseSeries` or `SparseDataFrame` to [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") will +cause a `SparseSeries` or `SparseDataFrame` to be returned, as before. + +### The `.str`-accessor performs stricter type checks[#](#the-str-accessor-performs-stricter-type-checks "Link to this heading") + +Due to the lack of more fine-grained dtypes, [`Series.str`](../reference/api/pandas.Series.str.html#pandas.Series.str "pandas.Series.str") so far only checked whether the data was +of `object` dtype. [`Series.str`](../reference/api/pandas.Series.str.html#pandas.Series.str "pandas.Series.str") will now infer the dtype data *within* the Series; in particular, +`'bytes'`-only data will raise an exception (except for [`Series.str.decode()`](../reference/api/pandas.Series.str.decode.html#pandas.Series.str.decode "pandas.Series.str.decode"), [`Series.str.get()`](../reference/api/pandas.Series.str.get.html#pandas.Series.str.get "pandas.Series.str.get"), +[`Series.str.len()`](../reference/api/pandas.Series.str.len.html#pandas.Series.str.len "pandas.Series.str.len"), [`Series.str.slice()`](../reference/api/pandas.Series.str.slice.html#pandas.Series.str.slice "pandas.Series.str.slice")), see [GH 23163](https://github.com/pandas-dev/pandas/issues/23163), [GH 23011](https://github.com/pandas-dev/pandas/issues/23011), [GH 23551](https://github.com/pandas-dev/pandas/issues/23551). + +*Previous behavior*: + +```None +In [1]: s = pd.Series(np.array(['a', 'ba', 'cba'], 'S'), dtype=object) + +In [2]: s +Out[2]: +0 b'a' +1 b'ba' +2 b'cba' +dtype: object + +In [3]: s.str.startswith(b'a') +Out[3]: +0 True +1 False +2 False +dtype: bool +``` + +*New behavior*: + +```None +In [22]: s = pd.Series(np.array(['a', 'ba', 'cba'], 'S'), dtype=object) + +In [23]: s +Out[23]: +0 b'a' +1 b'ba' +2 b'cba' +Length: 3, dtype: object + +In [24]: s.str.startswith(b'a') +--------------------------------------------------------------------------- +TypeError Traceback (most recent call last) +Cell In[24], line 1 +----> 1 s.str.startswith(b'a') + +File ~/work/pandas/pandas/pandas/core/strings/accessor.py:139, in forbid_nonstring_types.._forbid_nonstring_types..wrapper(self, *args, **kwargs) + 134 if self._inferred_dtype not in allowed_types: + 135 msg = ( + 136 f"Cannot use .str.{func_name} with values of " + 137 f"inferred dtype '{self._inferred_dtype}'." + 138 ) +--> 139 raise TypeError(msg) + 140 return func(self, *args, **kwargs) + +TypeError: Cannot use .str.startswith with values of inferred dtype 'bytes'. +``` + +### Categorical dtypes are preserved during GroupBy[#](#categorical-dtypes-are-preserved-during-groupby "Link to this heading") + +Previously, columns that were categorical, but not the groupby key(s) would be converted to `object` dtype during groupby operations. pandas now will preserve these dtypes. ([GH 18502](https://github.com/pandas-dev/pandas/issues/18502)) + +```None +In [25]: cat = pd.Categorical(["foo", "bar", "bar", "qux"], ordered=True) + +In [26]: df = pd.DataFrame({'payload': [-1, -2, -1, -2], 'col': cat}) + +In [27]: df +Out[27]: + payload col +0 -1 foo +1 -2 bar +2 -1 bar +3 -2 qux + +[4 rows x 2 columns] + +In [28]: df.dtypes +Out[28]: +payload int64 +col category +Length: 2, dtype: object +``` + +*Previous Behavior*: + +```None +In [5]: df.groupby('payload').first().col.dtype +Out[5]: dtype('O') +``` + +*New Behavior*: + +```None +In [29]: df.groupby('payload').first().col.dtype +Out[29]: CategoricalDtype(categories=['bar', 'foo', 'qux'], ordered=True, categories_dtype=object) +``` + +### Incompatible Index type unions[#](#incompatible-index-type-unions "Link to this heading") + +When performing [`Index.union()`](../reference/api/pandas.Index.union.html#pandas.Index.union "pandas.Index.union") operations between objects of incompatible dtypes, +the result will be a base [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") of dtype `object`. This behavior holds true for +unions between [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") objects that previously would have been prohibited. The dtype +of empty [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") objects will now be evaluated before performing union operations +rather than simply returning the other [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") object. [`Index.union()`](../reference/api/pandas.Index.union.html#pandas.Index.union "pandas.Index.union") can now be +considered commutative, such that `A.union(B) == B.union(A)` ([GH 23525](https://github.com/pandas-dev/pandas/issues/23525)). + +*Previous behavior*: + +```None +In [1]: pd.period_range('19910905', periods=2).union(pd.Int64Index([1, 2, 3])) +... +ValueError: can only call with other PeriodIndex-ed objects + +In [2]: pd.Index([], dtype=object).union(pd.Index([1, 2, 3])) +Out[2]: Int64Index([1, 2, 3], dtype='int64') +``` + +*New behavior*: + +```None +In [3]: pd.period_range('19910905', periods=2).union(pd.Int64Index([1, 2, 3])) +Out[3]: Index([1991-09-05, 1991-09-06, 1, 2, 3], dtype='object') +In [4]: pd.Index([], dtype=object).union(pd.Index([1, 2, 3])) +Out[4]: Index([1, 2, 3], dtype='object') +``` + +Note that integer- and floating-dtype indexes are considered “compatible”. The integer +values are coerced to floating point, which may result in loss of precision. See +[Set operations on Index objects](../user_guide/indexing.html#indexing-set-ops) for more. + +### `DataFrame` GroupBy ffill/bfill no longer return group labels[#](#dataframe-groupby-ffill-bfill-no-longer-return-group-labels "Link to this heading") + +The methods `ffill`, `bfill`, `pad` and `backfill` of +`DataFrameGroupBy` +previously included the group labels in the return value, which was +inconsistent with other groupby transforms. Now only the filled values +are returned. ([GH 21521](https://github.com/pandas-dev/pandas/issues/21521)) + +```None +In [30]: df = pd.DataFrame({"a": ["x", "y"], "b": [1, 2]}) + +In [31]: df +Out[31]: + a b +0 x 1 +1 y 2 + +[2 rows x 2 columns] +``` + +*Previous behavior*: + +```None +In [3]: df.groupby("a").ffill() +Out[3]: + a b +0 x 1 +1 y 2 +``` + +*New behavior*: + +```None +In [32]: df.groupby("a").ffill() +Out[32]: + b +0 1 +1 2 + +[2 rows x 1 columns] +``` + +### `DataFrame` describe on an empty Categorical / object column will return top and freq[#](#dataframe-describe-on-an-empty-categorical-object-column-will-return-top-and-freq "Link to this heading") + +When calling [`DataFrame.describe()`](../reference/api/pandas.DataFrame.describe.html#pandas.DataFrame.describe "pandas.DataFrame.describe") with an empty categorical / object +column, the ‘top’ and ‘freq’ columns were previously omitted, which was inconsistent with +the output for non-empty columns. Now the ‘top’ and ‘freq’ columns will always be included, +with `numpy.nan` in the case of an empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 26397](https://github.com/pandas-dev/pandas/issues/26397)) + +```None +In [33]: df = pd.DataFrame({"empty_col": pd.Categorical([])}) + +In [34]: df +Out[34]: +Empty DataFrame +Columns: [empty_col] +Index: [] + +[0 rows x 1 columns] +``` + +*Previous behavior*: + +```None +In [3]: df.describe() +Out[3]: + empty_col +count 0 +unique 0 +``` + +*New behavior*: + +```None +In [35]: df.describe() +Out[35]: + empty_col +count 0 +unique 0 +top NaN +freq NaN + +[4 rows x 1 columns] +``` + +### `__str__` methods now call `__repr__` rather than vice versa[#](#str-methods-now-call-repr-rather-than-vice-versa "Link to this heading") + +pandas has until now mostly defined string representations in a pandas objects’ +`__str__`/`__unicode__`/`__bytes__` methods, and called `__str__` from the `__repr__` +method, if a specific `__repr__` method is not found. This is not needed for Python3. +In pandas 0.25, the string representations of pandas objects are now generally +defined in `__repr__`, and calls to `__str__` in general now pass the call on to +the `__repr__`, if a specific `__str__` method doesn’t exist, as is standard for Python. +This change is backward compatible for direct usage of pandas, but if you subclass +pandas objects *and* give your subclasses specific `__str__`/`__repr__` methods, +you may have to adjust your `__str__`/`__repr__` methods ([GH 26495](https://github.com/pandas-dev/pandas/issues/26495)). + +### Indexing an `IntervalIndex` with `Interval` objects[#](#indexing-an-intervalindex-with-interval-objects "Link to this heading") + +Indexing methods for [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") have been modified to require exact matches only for [`Interval`](../reference/api/pandas.Interval.html#pandas.Interval "pandas.Interval") queries. +`IntervalIndex` methods previously matched on any overlapping `Interval`. Behavior with scalar points, e.g. querying +with an integer, is unchanged ([GH 16316](https://github.com/pandas-dev/pandas/issues/16316)). + +```None +In [36]: ii = pd.IntervalIndex.from_tuples([(0, 4), (1, 5), (5, 8)]) + +In [37]: ii +Out[37]: IntervalIndex([(0, 4], (1, 5], (5, 8]], dtype='interval[int64, right]') +``` + +The `in` operator (`__contains__`) now only returns `True` for exact matches to `Intervals` in the `IntervalIndex`, whereas +this would previously return `True` for any `Interval` overlapping an `Interval` in the `IntervalIndex`. + +*Previous behavior*: + +```None +In [4]: pd.Interval(1, 2, closed='neither') in ii +Out[4]: True + +In [5]: pd.Interval(-10, 10, closed='both') in ii +Out[5]: True +``` + +*New behavior*: + +```None +In [38]: pd.Interval(1, 2, closed='neither') in ii +Out[38]: False + +In [39]: pd.Interval(-10, 10, closed='both') in ii +Out[39]: False +``` + +The [`get_loc()`](../reference/api/pandas.IntervalIndex.get_loc.html#pandas.IntervalIndex.get_loc "pandas.IntervalIndex.get_loc") method now only returns locations for exact matches to `Interval` queries, as opposed to the previous behavior of +returning locations for overlapping matches. A `KeyError` will be raised if an exact match is not found. + +*Previous behavior*: + +```None +In [6]: ii.get_loc(pd.Interval(1, 5)) +Out[6]: array([0, 1]) + +In [7]: ii.get_loc(pd.Interval(2, 6)) +Out[7]: array([0, 1, 2]) +``` + +*New behavior*: + +```None +In [6]: ii.get_loc(pd.Interval(1, 5)) +Out[6]: 1 + +In [7]: ii.get_loc(pd.Interval(2, 6)) +--------------------------------------------------------------------------- +KeyError: Interval(2, 6, closed='right') +``` + +Likewise, [`get_indexer()`](../reference/api/pandas.IntervalIndex.get_indexer.html#pandas.IntervalIndex.get_indexer "pandas.IntervalIndex.get_indexer") and `get_indexer_non_unique()` will also only return locations for exact matches +to `Interval` queries, with `-1` denoting that an exact match was not found. + +These indexing changes extend to querying a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with an `IntervalIndex` index. + +```None +In [40]: s = pd.Series(list('abc'), index=ii) + +In [41]: s +Out[41]: +(0, 4] a +(1, 5] b +(5, 8] c +Length: 3, dtype: object +``` + +Selecting from a `Series` or `DataFrame` using `[]` (`__getitem__`) or `loc` now only returns exact matches for `Interval` queries. + +*Previous behavior*: + +```None +In [8]: s[pd.Interval(1, 5)] +Out[8]: +(0, 4] a +(1, 5] b +dtype: object + +In [9]: s.loc[pd.Interval(1, 5)] +Out[9]: +(0, 4] a +(1, 5] b +dtype: object +``` + +*New behavior*: + +```None +In [42]: s[pd.Interval(1, 5)] +Out[42]: 'b' + +In [43]: s.loc[pd.Interval(1, 5)] +Out[43]: 'b' +``` + +Similarly, a `KeyError` will be raised for non-exact matches instead of returning overlapping matches. + +*Previous behavior*: + +```None +In [9]: s[pd.Interval(2, 3)] +Out[9]: +(0, 4] a +(1, 5] b +dtype: object + +In [10]: s.loc[pd.Interval(2, 3)] +Out[10]: +(0, 4] a +(1, 5] b +dtype: object +``` + +*New behavior*: + +```None +In [6]: s[pd.Interval(2, 3)] +--------------------------------------------------------------------------- +KeyError: Interval(2, 3, closed='right') + +In [7]: s.loc[pd.Interval(2, 3)] +--------------------------------------------------------------------------- +KeyError: Interval(2, 3, closed='right') +``` + +The [`overlaps()`](../reference/api/pandas.IntervalIndex.overlaps.html#pandas.IntervalIndex.overlaps "pandas.IntervalIndex.overlaps") method can be used to create a boolean indexer that replicates the +previous behavior of returning overlapping matches. + +*New behavior*: + +```None +In [44]: idxr = s.index.overlaps(pd.Interval(2, 3)) + +In [45]: idxr +Out[45]: array([ True, True, False]) + +In [46]: s[idxr] +Out[46]: +(0, 4] a +(1, 5] b +Length: 2, dtype: object + +In [47]: s.loc[idxr] +Out[47]: +(0, 4] a +(1, 5] b +Length: 2, dtype: object +``` + +### Binary ufuncs on Series now align[#](#binary-ufuncs-on-series-now-align "Link to this heading") + +Applying a binary ufunc like `numpy.power()` now aligns the inputs +when both are [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") ([GH 23293](https://github.com/pandas-dev/pandas/issues/23293)). + +```None +In [48]: s1 = pd.Series([1, 2, 3], index=['a', 'b', 'c']) + +In [49]: s2 = pd.Series([3, 4, 5], index=['d', 'c', 'b']) + +In [50]: s1 +Out[50]: +a 1 +b 2 +c 3 +Length: 3, dtype: int64 + +In [51]: s2 +Out[51]: +d 3 +c 4 +b 5 +Length: 3, dtype: int64 +``` + +*Previous behavior* + +```None +In [5]: np.power(s1, s2) +Out[5]: +a 1 +b 16 +c 243 +dtype: int64 +``` + +*New behavior* + +```None +In [52]: np.power(s1, s2) +Out[52]: +a 1.0 +b 32.0 +c 81.0 +d NaN +Length: 4, dtype: float64 +``` + +This matches the behavior of other binary operations in pandas, like [`Series.add()`](../reference/api/pandas.Series.add.html#pandas.Series.add "pandas.Series.add"). +To retain the previous behavior, convert the other `Series` to an array before +applying the ufunc. + +```None +In [53]: np.power(s1, s2.array) +Out[53]: +a 1 +b 16 +c 243 +Length: 3, dtype: int64 +``` + +### Categorical.argsort now places missing values at the end[#](#categorical-argsort-now-places-missing-values-at-the-end "Link to this heading") + +`Categorical.argsort()` now places missing values at the end of the array, making it +consistent with NumPy and the rest of pandas ([GH 21801](https://github.com/pandas-dev/pandas/issues/21801)). + +```None +In [54]: cat = pd.Categorical(['b', None, 'a'], categories=['a', 'b'], ordered=True) +``` + +*Previous behavior* + +```None +In [2]: cat = pd.Categorical(['b', None, 'a'], categories=['a', 'b'], ordered=True) + +In [3]: cat.argsort() +Out[3]: array([1, 2, 0]) + +In [4]: cat[cat.argsort()] +Out[4]: +[NaN, a, b] +categories (2, object): [a < b] +``` + +*New behavior* + +```None +In [55]: cat.argsort() +Out[55]: array([2, 0, 1]) + +In [56]: cat[cat.argsort()] +Out[56]: +['a', 'b', NaN] +Categories (2, object): ['a' < 'b'] +``` + +### Column order is preserved when passing a list of dicts to DataFrame[#](#column-order-is-preserved-when-passing-a-list-of-dicts-to-dataframe "Link to this heading") + +Starting with Python 3.7 the key-order of `dict` is [guaranteed](https://mail.python.org/pipermail/python-dev/2017-December/151283.html). In practice, this has been true since +Python 3.6. The [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor now treats a list of dicts in the same way as +it does a list of `OrderedDict`, i.e. preserving the order of the dicts. +This change applies only when pandas is running on Python>=3.6 ([GH 27309](https://github.com/pandas-dev/pandas/issues/27309)). + +```None +In [57]: data = [ + ....: {'name': 'Joe', 'state': 'NY', 'age': 18}, + ....: {'name': 'Jane', 'state': 'KY', 'age': 19, 'hobby': 'Minecraft'}, + ....: {'name': 'Jean', 'state': 'OK', 'age': 20, 'finances': 'good'} + ....: ] + ....: +``` + +*Previous Behavior*: + +The columns were lexicographically sorted previously, + +```None +In [1]: pd.DataFrame(data) +Out[1]: + age finances hobby name state +0 18 NaN NaN Joe NY +1 19 NaN Minecraft Jane KY +2 20 good NaN Jean OK +``` + +*New Behavior*: + +The column order now matches the insertion-order of the keys in the `dict`, +considering all the records from top to bottom. As a consequence, the column +order of the resulting DataFrame has changed compared to previous pandas versions. + +```None +In [58]: pd.DataFrame(data) +Out[58]: + name state age hobby finances +0 Joe NY 18 NaN NaN +1 Jane KY 19 Minecraft NaN +2 Jean OK 20 NaN good + +[3 rows x 5 columns] +``` + +### Increased minimum versions for dependencies[#](#increased-minimum-versions-for-dependencies "Link to this heading") + +Due to dropping support for Python 2.7, a number of optional dependencies have updated minimum versions ([GH 25725](https://github.com/pandas-dev/pandas/issues/25725), [GH 24942](https://github.com/pandas-dev/pandas/issues/24942), [GH 25752](https://github.com/pandas-dev/pandas/issues/25752)). +Independently, some minimum supported versions of dependencies were updated ([GH 23519](https://github.com/pandas-dev/pandas/issues/23519), [GH 25554](https://github.com/pandas-dev/pandas/issues/25554)). +If installed, we now require: + +| Package | Minimum Version | Required | +| --- | --- | --- | +| numpy | 1.13.3 | X | +| pytz | 2015.4 | X | +| python-dateutil | 2.6.1 | X | +| bottleneck | 1.2.1 | | +| numexpr | 2.6.2 | | +| pytest (dev) | 4.0.2 | | + +For [optional libraries](https://pandas.pydata.org/docs/getting_started/install.html) the general recommendation is to use the latest version. +The following table lists the lowest version per library that is currently being tested throughout the development of pandas. +Optional libraries below the lowest tested version may still work, but are not considered supported. + +| Package | Minimum Version | +| --- | --- | +| beautifulsoup4 | 4.6.0 | +| fastparquet | 0.2.1 | +| gcsfs | 0.2.2 | +| lxml | 3.8.0 | +| matplotlib | 2.2.2 | +| openpyxl | 2.4.8 | +| pyarrow | 0.9.0 | +| pymysql | 0.7.1 | +| pytables | 3.4.2 | +| scipy | 0.19.0 | +| sqlalchemy | 1.1.4 | +| xarray | 0.8.2 | +| xlrd | 1.1.0 | +| xlsxwriter | 0.9.8 | +| xlwt | 1.2.0 | + +See [Dependencies](../getting_started/install.html#install-dependencies) and [Optional dependencies](../getting_started/install.html#install-optional-dependencies) for more. + +### Other API changes[#](#other-api-changes "Link to this heading") + +* [`DatetimeTZDtype`](../reference/api/pandas.DatetimeTZDtype.html#pandas.DatetimeTZDtype "pandas.DatetimeTZDtype") will now standardize pytz timezones to a common timezone instance ([GH 24713](https://github.com/pandas-dev/pandas/issues/24713)) +* [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") and [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") scalars now implement the `to_numpy()` method as aliases to [`Timestamp.to_datetime64()`](../reference/api/pandas.Timestamp.to_datetime64.html#pandas.Timestamp.to_datetime64 "pandas.Timestamp.to_datetime64") and [`Timedelta.to_timedelta64()`](../reference/api/pandas.Timedelta.to_timedelta64.html#pandas.Timedelta.to_timedelta64 "pandas.Timedelta.to_timedelta64"), respectively. ([GH 24653](https://github.com/pandas-dev/pandas/issues/24653)) +* [`Timestamp.strptime()`](../reference/api/pandas.Timestamp.strptime.html#pandas.Timestamp.strptime "pandas.Timestamp.strptime") will now rise a `NotImplementedError` ([GH 25016](https://github.com/pandas-dev/pandas/issues/25016)) +* Comparing [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") with unsupported objects now returns [`NotImplemented`](https://docs.python.org/3/library/constants.html#NotImplemented "(in Python v3.13)") instead of raising `TypeError`. This implies that unsupported rich comparisons are delegated to the other object, and are now consistent with Python 3 behavior for `datetime` objects ([GH 24011](https://github.com/pandas-dev/pandas/issues/24011)) +* Bug in [`DatetimeIndex.snap()`](../reference/api/pandas.DatetimeIndex.snap.html#pandas.DatetimeIndex.snap "pandas.DatetimeIndex.snap") which didn’t preserving the `name` of the input [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") ([GH 25575](https://github.com/pandas-dev/pandas/issues/25575)) +* The `arg` argument in [`DataFrameGroupBy.agg()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg") has been renamed to `func` ([GH 26089](https://github.com/pandas-dev/pandas/issues/26089)) +* The `arg` argument in `Window.aggregate()` has been renamed to `func` ([GH 26372](https://github.com/pandas-dev/pandas/issues/26372)) +* Most pandas classes had a `__bytes__` method, which was used for getting a python2-style bytestring representation of the object. This method has been removed as a part of dropping Python2 ([GH 26447](https://github.com/pandas-dev/pandas/issues/26447)) +* The `.str`-accessor has been disabled for 1-level [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex"), use [`MultiIndex.to_flat_index()`](../reference/api/pandas.MultiIndex.to_flat_index.html#pandas.MultiIndex.to_flat_index "pandas.MultiIndex.to_flat_index") if necessary ([GH 23679](https://github.com/pandas-dev/pandas/issues/23679)) +* Removed support of gtk package for clipboards ([GH 26563](https://github.com/pandas-dev/pandas/issues/26563)) +* Using an unsupported version of Beautiful Soup 4 will now raise an `ImportError` instead of a `ValueError` ([GH 27063](https://github.com/pandas-dev/pandas/issues/27063)) +* [`Series.to_excel()`](../reference/api/pandas.Series.to_excel.html#pandas.Series.to_excel "pandas.Series.to_excel") and [`DataFrame.to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel") will now raise a `ValueError` when saving timezone aware data. ([GH 27008](https://github.com/pandas-dev/pandas/issues/27008), [GH 7056](https://github.com/pandas-dev/pandas/issues/7056)) +* `ExtensionArray.argsort()` places NA values at the end of the sorted array. ([GH 21801](https://github.com/pandas-dev/pandas/issues/21801)) +* [`DataFrame.to_hdf()`](../reference/api/pandas.DataFrame.to_hdf.html#pandas.DataFrame.to_hdf "pandas.DataFrame.to_hdf") and [`Series.to_hdf()`](../reference/api/pandas.Series.to_hdf.html#pandas.Series.to_hdf "pandas.Series.to_hdf") will now raise a `NotImplementedError` when saving a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") with extension data types for a `fixed` format. ([GH 7775](https://github.com/pandas-dev/pandas/issues/7775)) +* Passing duplicate `names` in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") will now raise a `ValueError` ([GH 17346](https://github.com/pandas-dev/pandas/issues/17346)) + +## Deprecations[#](#deprecations "Link to this heading") + +### Sparse subclasses[#](#sparse-subclasses "Link to this heading") + +The `SparseSeries` and `SparseDataFrame` subclasses are deprecated. Their functionality is better-provided +by a `Series` or `DataFrame` with sparse values. + +**Previous way** + +```None +df = pd.SparseDataFrame({"A": [0, 0, 1, 2]}) +df.dtypes +``` + +**New way** + +```None +In [59]: df = pd.DataFrame({"A": pd.arrays.SparseArray([0, 0, 1, 2])}) + +In [60]: df.dtypes +Out[60]: +A Sparse[int64, 0] +Length: 1, dtype: object +``` + +The memory usage of the two approaches is identical ([GH 19239](https://github.com/pandas-dev/pandas/issues/19239)). + +### msgpack format[#](#msgpack-format "Link to this heading") + +The msgpack format is deprecated as of 0.25 and will be removed in a future version. It is recommended to use pyarrow for on-the-wire transmission of pandas objects. ([GH 27084](https://github.com/pandas-dev/pandas/issues/27084)) + +### Other deprecations[#](#other-deprecations "Link to this heading") + +* The deprecated `.ix[]` indexer now raises a more visible `FutureWarning` instead of `DeprecationWarning` ([GH 26438](https://github.com/pandas-dev/pandas/issues/26438)). +* Deprecated the `units=M` (months) and `units=Y` (year) parameters for `units` of [`pandas.to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta"), [`pandas.Timedelta()`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") and [`pandas.TimedeltaIndex()`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") ([GH 16344](https://github.com/pandas-dev/pandas/issues/16344)) +* [`pandas.concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") has deprecated the `join_axes`-keyword. Instead, use [`DataFrame.reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex") or [`DataFrame.reindex_like()`](../reference/api/pandas.DataFrame.reindex_like.html#pandas.DataFrame.reindex_like "pandas.DataFrame.reindex_like") on the result or on the inputs ([GH 21951](https://github.com/pandas-dev/pandas/issues/21951)) +* The `SparseArray.values` attribute is deprecated. You can use `np.asarray(...)` or + the `SparseArray.to_dense()` method instead ([GH 26421](https://github.com/pandas-dev/pandas/issues/26421)). +* The functions [`pandas.to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") and [`pandas.to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta") have deprecated the `box` keyword. Instead, use `to_numpy()` or [`Timestamp.to_datetime64()`](../reference/api/pandas.Timestamp.to_datetime64.html#pandas.Timestamp.to_datetime64 "pandas.Timestamp.to_datetime64") or [`Timedelta.to_timedelta64()`](../reference/api/pandas.Timedelta.to_timedelta64.html#pandas.Timedelta.to_timedelta64 "pandas.Timedelta.to_timedelta64"). ([GH 24416](https://github.com/pandas-dev/pandas/issues/24416)) +* The `DataFrame.compound()` and `Series.compound()` methods are deprecated and will be removed in a future version ([GH 26405](https://github.com/pandas-dev/pandas/issues/26405)). +* The internal attributes `_start`, `_stop` and `_step` attributes of [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") have been deprecated. + Use the public attributes [`start`](../reference/api/pandas.RangeIndex.start.html#pandas.RangeIndex.start "pandas.RangeIndex.start"), [`stop`](../reference/api/pandas.RangeIndex.stop.html#pandas.RangeIndex.stop "pandas.RangeIndex.stop") and [`step`](../reference/api/pandas.RangeIndex.step.html#pandas.RangeIndex.step "pandas.RangeIndex.step") instead ([GH 26581](https://github.com/pandas-dev/pandas/issues/26581)). +* The `Series.ftype()`, `Series.ftypes()` and `DataFrame.ftypes()` methods are deprecated and will be removed in a future version. + Instead, use [`Series.dtype()`](../reference/api/pandas.Series.dtype.html#pandas.Series.dtype "pandas.Series.dtype") and [`DataFrame.dtypes()`](../reference/api/pandas.DataFrame.dtypes.html#pandas.DataFrame.dtypes "pandas.DataFrame.dtypes") ([GH 26705](https://github.com/pandas-dev/pandas/issues/26705)). +* The `Series.get_values()`, `DataFrame.get_values()`, `Index.get_values()`, + `SparseArray.get_values()` and `Categorical.get_values()` methods are deprecated. + One of `np.asarray(..)` or [`to_numpy()`](../reference/api/pandas.Series.to_numpy.html#pandas.Series.to_numpy "pandas.Series.to_numpy") can be used instead ([GH 19617](https://github.com/pandas-dev/pandas/issues/19617)). +* The ‘outer’ method on NumPy ufuncs, e.g. `np.subtract.outer` has been deprecated on [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") objects. Convert the input to an array with [`Series.array`](../reference/api/pandas.Series.array.html#pandas.Series.array "pandas.Series.array") first ([GH 27186](https://github.com/pandas-dev/pandas/issues/27186)) +* [`Timedelta.resolution()`](../reference/api/pandas.Timedelta.resolution.html#pandas.Timedelta.resolution "pandas.Timedelta.resolution") is deprecated and replaced with `Timedelta.resolution_string()`. In a future version, [`Timedelta.resolution()`](../reference/api/pandas.Timedelta.resolution.html#pandas.Timedelta.resolution "pandas.Timedelta.resolution") will be changed to behave like the standard library [`datetime.timedelta.resolution`](https://docs.python.org/3/library/datetime.html#datetime.timedelta.resolution "(in Python v3.13)") ([GH 21344](https://github.com/pandas-dev/pandas/issues/21344)) +* [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") has been undeprecated. ([GH 25220](https://github.com/pandas-dev/pandas/issues/25220)) +* `Index.dtype_str` is deprecated. ([GH 18262](https://github.com/pandas-dev/pandas/issues/18262)) +* `Series.imag` and `Series.real` are deprecated. ([GH 18262](https://github.com/pandas-dev/pandas/issues/18262)) +* `Series.put()` is deprecated. ([GH 18262](https://github.com/pandas-dev/pandas/issues/18262)) +* [`Index.item()`](../reference/api/pandas.Index.item.html#pandas.Index.item "pandas.Index.item") and [`Series.item()`](../reference/api/pandas.Series.item.html#pandas.Series.item "pandas.Series.item") is deprecated. ([GH 18262](https://github.com/pandas-dev/pandas/issues/18262)) +* The default value `ordered=None` in `CategoricalDtype` has been deprecated in favor of `ordered=False`. When converting between categorical types `ordered=True` must be explicitly passed in order to be preserved. ([GH 26336](https://github.com/pandas-dev/pandas/issues/26336)) +* `Index.contains()` is deprecated. Use `key in index` (`__contains__`) instead ([GH 17753](https://github.com/pandas-dev/pandas/issues/17753)). +* `DataFrame.get_dtype_counts()` is deprecated. ([GH 18262](https://github.com/pandas-dev/pandas/issues/18262)) +* `Categorical.ravel()` will return a [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") instead of a `np.ndarray` ([GH 27199](https://github.com/pandas-dev/pandas/issues/27199)) + +## Removal of prior version deprecations/changes[#](#removal-of-prior-version-deprecations-changes "Link to this heading") + +* Removed `Panel` ([GH 25047](https://github.com/pandas-dev/pandas/issues/25047), [GH 25191](https://github.com/pandas-dev/pandas/issues/25191), [GH 25231](https://github.com/pandas-dev/pandas/issues/25231)) +* Removed the previously deprecated `sheetname` keyword in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") ([GH 16442](https://github.com/pandas-dev/pandas/issues/16442), [GH 20938](https://github.com/pandas-dev/pandas/issues/20938)) +* Removed the previously deprecated `TimeGrouper` ([GH 16942](https://github.com/pandas-dev/pandas/issues/16942)) +* Removed the previously deprecated `parse_cols` keyword in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") ([GH 16488](https://github.com/pandas-dev/pandas/issues/16488)) +* Removed the previously deprecated `pd.options.html.border` ([GH 16970](https://github.com/pandas-dev/pandas/issues/16970)) +* Removed the previously deprecated `convert_objects` ([GH 11221](https://github.com/pandas-dev/pandas/issues/11221)) +* Removed the previously deprecated `select` method of `DataFrame` and `Series` ([GH 17633](https://github.com/pandas-dev/pandas/issues/17633)) +* Removed the previously deprecated behavior of [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") treated as list-like in [`rename_categories()`](../reference/api/pandas.Series.cat.rename_categories.html#pandas.Series.cat.rename_categories "pandas.Series.cat.rename_categories") ([GH 17982](https://github.com/pandas-dev/pandas/issues/17982)) +* Removed the previously deprecated `DataFrame.reindex_axis` and `Series.reindex_axis` ([GH 17842](https://github.com/pandas-dev/pandas/issues/17842)) +* Removed the previously deprecated behavior of altering column or index labels with [`Series.rename_axis()`](../reference/api/pandas.Series.rename_axis.html#pandas.Series.rename_axis "pandas.Series.rename_axis") or [`DataFrame.rename_axis()`](../reference/api/pandas.DataFrame.rename_axis.html#pandas.DataFrame.rename_axis "pandas.DataFrame.rename_axis") ([GH 17842](https://github.com/pandas-dev/pandas/issues/17842)) +* Removed the previously deprecated `tupleize_cols` keyword argument in [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html"), [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv"), and [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") ([GH 17877](https://github.com/pandas-dev/pandas/issues/17877), [GH 17820](https://github.com/pandas-dev/pandas/issues/17820)) +* Removed the previously deprecated `DataFrame.from.csv` and `Series.from_csv` ([GH 17812](https://github.com/pandas-dev/pandas/issues/17812)) +* Removed the previously deprecated `raise_on_error` keyword argument in [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where") and [`DataFrame.mask()`](../reference/api/pandas.DataFrame.mask.html#pandas.DataFrame.mask "pandas.DataFrame.mask") ([GH 17744](https://github.com/pandas-dev/pandas/issues/17744)) +* Removed the previously deprecated `ordered` and `categories` keyword arguments in `astype` ([GH 17742](https://github.com/pandas-dev/pandas/issues/17742)) +* Removed the previously deprecated `cdate_range` ([GH 17691](https://github.com/pandas-dev/pandas/issues/17691)) +* Removed the previously deprecated `True` option for the `dropna` keyword argument in `SeriesGroupBy.nth()` ([GH 17493](https://github.com/pandas-dev/pandas/issues/17493)) +* Removed the previously deprecated `convert` keyword argument in [`Series.take()`](../reference/api/pandas.Series.take.html#pandas.Series.take "pandas.Series.take") and [`DataFrame.take()`](../reference/api/pandas.DataFrame.take.html#pandas.DataFrame.take "pandas.DataFrame.take") ([GH 17352](https://github.com/pandas-dev/pandas/issues/17352)) +* Removed the previously deprecated behavior of arithmetic operations with `datetime.date` objects ([GH 21152](https://github.com/pandas-dev/pandas/issues/21152)) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Significant speedup in `SparseArray` initialization that benefits most operations, fixing performance regression introduced in v0.20.0 ([GH 24985](https://github.com/pandas-dev/pandas/issues/24985)) +* [`DataFrame.to_stata()`](../reference/api/pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata") is now faster when outputting data with any string or non-native endian columns ([GH 25045](https://github.com/pandas-dev/pandas/issues/25045)) +* Improved performance of [`Series.searchsorted()`](../reference/api/pandas.Series.searchsorted.html#pandas.Series.searchsorted "pandas.Series.searchsorted"). The speedup is especially large when the dtype is + int8/int16/int32 and the searched key is within the integer bounds for the dtype ([GH 22034](https://github.com/pandas-dev/pandas/issues/22034)) +* Improved performance of `GroupBy.quantile()` ([GH 20405](https://github.com/pandas-dev/pandas/issues/20405)) +* Improved performance of slicing and other selected operation on a [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") ([GH 26565](https://github.com/pandas-dev/pandas/issues/26565), [GH 26617](https://github.com/pandas-dev/pandas/issues/26617), [GH 26722](https://github.com/pandas-dev/pandas/issues/26722)) +* [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") now performs standard lookup without instantiating an actual hashtable, hence saving memory ([GH 16685](https://github.com/pandas-dev/pandas/issues/16685)) +* Improved performance of [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") by faster tokenizing and faster parsing of small float numbers ([GH 25784](https://github.com/pandas-dev/pandas/issues/25784)) +* Improved performance of [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") by faster parsing of N/A and boolean values ([GH 25804](https://github.com/pandas-dev/pandas/issues/25804)) +* Improved performance of `IntervalIndex.is_monotonic`, `IntervalIndex.is_monotonic_increasing` and `IntervalIndex.is_monotonic_decreasing` by removing conversion to [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 24813](https://github.com/pandas-dev/pandas/issues/24813)) +* Improved performance of [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") when writing datetime dtypes ([GH 25708](https://github.com/pandas-dev/pandas/issues/25708)) +* Improved performance of [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") by much faster parsing of `MM/YYYY` and `DD/MM/YYYY` datetime formats ([GH 25922](https://github.com/pandas-dev/pandas/issues/25922)) +* Improved performance of nanops for dtypes that cannot store NaNs. Speedup is particularly prominent for [`Series.all()`](../reference/api/pandas.Series.all.html#pandas.Series.all "pandas.Series.all") and [`Series.any()`](../reference/api/pandas.Series.any.html#pandas.Series.any "pandas.Series.any") ([GH 25070](https://github.com/pandas-dev/pandas/issues/25070)) +* Improved performance of [`Series.map()`](../reference/api/pandas.Series.map.html#pandas.Series.map "pandas.Series.map") for dictionary mappers on categorical series by mapping the categories instead of mapping all values ([GH 23785](https://github.com/pandas-dev/pandas/issues/23785)) +* Improved performance of `IntervalIndex.intersection()` ([GH 24813](https://github.com/pandas-dev/pandas/issues/24813)) +* Improved performance of [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") by faster concatenating date columns without extra conversion to string for integer/float zero and float `NaN`; by faster checking the string for the possibility of being a date ([GH 25754](https://github.com/pandas-dev/pandas/issues/25754)) +* Improved performance of `IntervalIndex.is_unique` by removing conversion to `MultiIndex` ([GH 24813](https://github.com/pandas-dev/pandas/issues/24813)) +* Restored performance of `DatetimeIndex.__iter__()` by re-enabling specialized code path ([GH 26702](https://github.com/pandas-dev/pandas/issues/26702)) +* Improved performance when building [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") with at least one [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") level ([GH 22044](https://github.com/pandas-dev/pandas/issues/22044)) +* Improved performance by removing the need for a garbage collect when checking for `SettingWithCopyWarning` ([GH 27031](https://github.com/pandas-dev/pandas/issues/27031)) +* For [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") changed default value of cache parameter to `True` ([GH 26043](https://github.com/pandas-dev/pandas/issues/26043)) +* Improved performance of [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") and [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") slicing given non-unique, monotonic data ([GH 27136](https://github.com/pandas-dev/pandas/issues/27136)). +* Improved performance of `pd.read_json()` for index-oriented data. ([GH 26773](https://github.com/pandas-dev/pandas/issues/26773)) +* Improved performance of `MultiIndex.shape()` ([GH 27384](https://github.com/pandas-dev/pandas/issues/27384)). + +## Bug fixes[#](#bug-fixes "Link to this heading") + +### Categorical[#](#categorical "Link to this heading") + +* Bug in [`DataFrame.at()`](../reference/api/pandas.DataFrame.at.html#pandas.DataFrame.at "pandas.DataFrame.at") and [`Series.at()`](../reference/api/pandas.Series.at.html#pandas.Series.at "pandas.Series.at") that would raise exception if the index was a [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") ([GH 20629](https://github.com/pandas-dev/pandas/issues/20629)) +* Fixed bug in comparison of ordered [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") that contained missing values with a scalar which sometimes incorrectly resulted in `True` ([GH 26504](https://github.com/pandas-dev/pandas/issues/26504)) +* Bug in [`DataFrame.dropna()`](../reference/api/pandas.DataFrame.dropna.html#pandas.DataFrame.dropna "pandas.DataFrame.dropna") when the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") has a [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") containing [`Interval`](../reference/api/pandas.Interval.html#pandas.Interval "pandas.Interval") objects incorrectly raised a `TypeError` ([GH 25087](https://github.com/pandas-dev/pandas/issues/25087)) + +### Datetimelike[#](#datetimelike "Link to this heading") + +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") which would raise an (incorrect) `ValueError` when called with a date far into the future and the `format` argument specified instead of raising `OutOfBoundsDatetime` ([GH 23830](https://github.com/pandas-dev/pandas/issues/23830)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") which would raise `InvalidIndexError: Reindexing only valid with uniquely valued Index objects` when called with `cache=True`, with `arg` including at least two different elements from the set `{None, numpy.nan, pandas.NaT}` ([GH 22305](https://github.com/pandas-dev/pandas/issues/22305)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") where timezone aware data with `dtype='datetime64[ns]` was not cast to naive ([GH 25843](https://github.com/pandas-dev/pandas/issues/25843)) +* Improved [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") type checking in various datetime functions to prevent exceptions when using a subclassed `datetime` ([GH 25851](https://github.com/pandas-dev/pandas/issues/25851)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") repr where `np.datetime64('NaT')` and `np.timedelta64('NaT')` with `dtype=object` would be represented as `NaN` ([GH 25445](https://github.com/pandas-dev/pandas/issues/25445)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") which does not replace the invalid argument with `NaT` when error is set to coerce ([GH 26122](https://github.com/pandas-dev/pandas/issues/26122)) +* Bug in adding `DateOffset` with nonzero month to [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") would raise `ValueError` ([GH 26258](https://github.com/pandas-dev/pandas/issues/26258)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") which raises unhandled `OverflowError` when called with mix of invalid dates and `NaN` values with `format='%Y%m%d'` and `error='coerce'` ([GH 25512](https://github.com/pandas-dev/pandas/issues/25512)) +* Bug in `isin()` for datetimelike indexes; [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex"), [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") and [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") where the `levels` parameter was ignored. ([GH 26675](https://github.com/pandas-dev/pandas/issues/26675)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") which raises `TypeError` for `format='%Y%m%d'` when called for invalid integer dates with length >= 6 digits with `errors='ignore'` +* Bug when comparing a [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") against a zero-dimensional numpy array ([GH 26689](https://github.com/pandas-dev/pandas/issues/26689)) +* Bug in constructing a `Series` or `DataFrame` from a numpy `datetime64` array with a non-ns unit and out-of-bound timestamps generating rubbish data, which will now correctly raise an `OutOfBoundsDatetime` error ([GH 26206](https://github.com/pandas-dev/pandas/issues/26206)). +* Bug in [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range") with unnecessary `OverflowError` being raised for very large or very small dates ([GH 26651](https://github.com/pandas-dev/pandas/issues/26651)) +* Bug where adding [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") to a `np.timedelta64` object would raise instead of returning a [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") ([GH 24775](https://github.com/pandas-dev/pandas/issues/24775)) +* Bug where comparing a zero-dimensional numpy array containing a `np.datetime64` object to a [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") would incorrect raise `TypeError` ([GH 26916](https://github.com/pandas-dev/pandas/issues/26916)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") which would raise `ValueError: Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True` when called with `cache=True`, with `arg` including datetime strings with different offset ([GH 26097](https://github.com/pandas-dev/pandas/issues/26097)) + +### Timedelta[#](#timedelta "Link to this heading") + +* Bug in `TimedeltaIndex.intersection()` where for non-monotonic indices in some cases an empty `Index` was returned when in fact an intersection existed ([GH 25913](https://github.com/pandas-dev/pandas/issues/25913)) +* Bug with comparisons between [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") and `NaT` raising `TypeError` ([GH 26039](https://github.com/pandas-dev/pandas/issues/26039)) +* Bug when adding or subtracting a `BusinessHour` to a [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") with the resulting time landing in a following or prior day respectively ([GH 26381](https://github.com/pandas-dev/pandas/issues/26381)) +* Bug when comparing a [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") against a zero-dimensional numpy array ([GH 26689](https://github.com/pandas-dev/pandas/issues/26689)) + +### Timezones[#](#timezones "Link to this heading") + +* Bug in [`DatetimeIndex.to_frame()`](../reference/api/pandas.DatetimeIndex.to_frame.html#pandas.DatetimeIndex.to_frame "pandas.DatetimeIndex.to_frame") where timezone aware data would be converted to timezone naive data ([GH 25809](https://github.com/pandas-dev/pandas/issues/25809)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with `utc=True` and datetime strings that would apply previously parsed UTC offsets to subsequent arguments ([GH 24992](https://github.com/pandas-dev/pandas/issues/24992)) +* Bug in [`Timestamp.tz_localize()`](../reference/api/pandas.Timestamp.tz_localize.html#pandas.Timestamp.tz_localize "pandas.Timestamp.tz_localize") and [`Timestamp.tz_convert()`](../reference/api/pandas.Timestamp.tz_convert.html#pandas.Timestamp.tz_convert "pandas.Timestamp.tz_convert") does not propagate `freq` ([GH 25241](https://github.com/pandas-dev/pandas/issues/25241)) +* Bug in [`Series.at()`](../reference/api/pandas.Series.at.html#pandas.Series.at "pandas.Series.at") where setting [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") with timezone raises `TypeError` ([GH 25506](https://github.com/pandas-dev/pandas/issues/25506)) +* Bug in [`DataFrame.update()`](../reference/api/pandas.DataFrame.update.html#pandas.DataFrame.update "pandas.DataFrame.update") when updating with timezone aware data would return timezone naive data ([GH 25807](https://github.com/pandas-dev/pandas/issues/25807)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") where an uninformative `RuntimeError` was raised when passing a naive [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") with datetime strings with mixed UTC offsets ([GH 25978](https://github.com/pandas-dev/pandas/issues/25978)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with `unit='ns'` would drop timezone information from the parsed argument ([GH 26168](https://github.com/pandas-dev/pandas/issues/26168)) +* Bug in [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") where joining a timezone aware index with a timezone aware column would result in a column of `NaN` ([GH 26335](https://github.com/pandas-dev/pandas/issues/26335)) +* Bug in [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range") where ambiguous or nonexistent start or end times were not handled by the `ambiguous` or `nonexistent` keywords respectively ([GH 27088](https://github.com/pandas-dev/pandas/issues/27088)) +* Bug in `DatetimeIndex.union()` when combining a timezone aware and timezone unaware [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") ([GH 21671](https://github.com/pandas-dev/pandas/issues/21671)) +* Bug when applying a numpy reduction function (e.g. `numpy.minimum()`) to a timezone aware [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") ([GH 15552](https://github.com/pandas-dev/pandas/issues/15552)) + +### Numeric[#](#numeric "Link to this heading") + +* Bug in [`to_numeric()`](../reference/api/pandas.to_numeric.html#pandas.to_numeric "pandas.to_numeric") in which large negative numbers were being improperly handled ([GH 24910](https://github.com/pandas-dev/pandas/issues/24910)) +* Bug in [`to_numeric()`](../reference/api/pandas.to_numeric.html#pandas.to_numeric "pandas.to_numeric") in which numbers were being coerced to float, even though `errors` was not `coerce` ([GH 24910](https://github.com/pandas-dev/pandas/issues/24910)) +* Bug in [`to_numeric()`](../reference/api/pandas.to_numeric.html#pandas.to_numeric "pandas.to_numeric") in which invalid values for `errors` were being allowed ([GH 26466](https://github.com/pandas-dev/pandas/issues/26466)) +* Bug in `format` in which floating point complex numbers were not being formatted to proper display precision and trimming ([GH 25514](https://github.com/pandas-dev/pandas/issues/25514)) +* Bug in error messages in [`DataFrame.corr()`](../reference/api/pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr") and [`Series.corr()`](../reference/api/pandas.Series.corr.html#pandas.Series.corr "pandas.Series.corr"). Added the possibility of using a callable. ([GH 25729](https://github.com/pandas-dev/pandas/issues/25729)) +* Bug in `Series.divmod()` and `Series.rdivmod()` which would raise an (incorrect) `ValueError` rather than return a pair of [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") objects as result ([GH 25557](https://github.com/pandas-dev/pandas/issues/25557)) +* Raises a helpful exception when a non-numeric index is sent to `interpolate()` with methods which require numeric index. ([GH 21662](https://github.com/pandas-dev/pandas/issues/21662)) +* Bug in [`eval()`](../reference/api/pandas.eval.html#pandas.eval "pandas.eval") when comparing floats with scalar operators, for example: `x < -0.1` ([GH 25928](https://github.com/pandas-dev/pandas/issues/25928)) +* Fixed bug where casting all-boolean array to integer extension array failed ([GH 25211](https://github.com/pandas-dev/pandas/issues/25211)) +* Bug in `divmod` with a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") object containing zeros incorrectly raising `AttributeError` ([GH 26987](https://github.com/pandas-dev/pandas/issues/26987)) +* Inconsistency in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") floor-division (//) and `divmod` filling positive//zero with `NaN` instead of `Inf` ([GH 27321](https://github.com/pandas-dev/pandas/issues/27321)) + +### Conversion[#](#conversion "Link to this heading") + +* Bug in [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") when passing a dict of columns and types the `errors` parameter was ignored. ([GH 25905](https://github.com/pandas-dev/pandas/issues/25905)) + +### Strings[#](#strings "Link to this heading") + +* Bug in the `__name__` attribute of several methods of [`Series.str`](../reference/api/pandas.Series.str.html#pandas.Series.str "pandas.Series.str"), which were set incorrectly ([GH 23551](https://github.com/pandas-dev/pandas/issues/23551)) +* Improved error message when passing [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") of wrong dtype to [`Series.str.cat()`](../reference/api/pandas.Series.str.cat.html#pandas.Series.str.cat "pandas.Series.str.cat") ([GH 22722](https://github.com/pandas-dev/pandas/issues/22722)) + +### Interval[#](#interval "Link to this heading") + +* Construction of [`Interval`](../reference/api/pandas.Interval.html#pandas.Interval "pandas.Interval") is restricted to numeric, [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") and [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") endpoints ([GH 23013](https://github.com/pandas-dev/pandas/issues/23013)) +* Fixed bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series")/[`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") not displaying `NaN` in [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") with missing values ([GH 25984](https://github.com/pandas-dev/pandas/issues/25984)) +* Bug in [`IntervalIndex.get_loc()`](../reference/api/pandas.IntervalIndex.get_loc.html#pandas.IntervalIndex.get_loc "pandas.IntervalIndex.get_loc") where a `KeyError` would be incorrectly raised for a decreasing [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") ([GH 25860](https://github.com/pandas-dev/pandas/issues/25860)) +* Bug in [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") constructor where passing mixed closed [`Interval`](../reference/api/pandas.Interval.html#pandas.Interval "pandas.Interval") objects would result in a `ValueError` instead of an `object` dtype `Index` ([GH 27172](https://github.com/pandas-dev/pandas/issues/27172)) + +### Indexing[#](#indexing "Link to this heading") + +* Improved exception message when calling [`DataFrame.iloc()`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") with a list of non-numeric objects ([GH 25753](https://github.com/pandas-dev/pandas/issues/25753)). +* Improved exception message when calling `.iloc` or `.loc` with a boolean indexer with different length ([GH 26658](https://github.com/pandas-dev/pandas/issues/26658)). +* Bug in `KeyError` exception message when indexing a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") with a non-existent key not displaying the original key ([GH 27250](https://github.com/pandas-dev/pandas/issues/27250)). +* Bug in `.iloc` and `.loc` with a boolean indexer not raising an `IndexError` when too few items are passed ([GH 26658](https://github.com/pandas-dev/pandas/issues/26658)). +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") and [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") where `KeyError` was not raised for a `MultiIndex` when the key was less than or equal to the number of levels in the [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 14885](https://github.com/pandas-dev/pandas/issues/14885)). +* Bug in which `DataFrame.append()` produced an erroneous warning indicating that a `KeyError` will be thrown in the future when the data to be appended contains new columns ([GH 22252](https://github.com/pandas-dev/pandas/issues/22252)). +* Bug in which [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") caused a segfault for a reindexed data frame, when the indices were single-level [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 26303](https://github.com/pandas-dev/pandas/issues/26303)). +* Fixed bug where assigning a `arrays.PandasArray` to a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") would raise error ([GH 26390](https://github.com/pandas-dev/pandas/issues/26390)) +* Allow keyword arguments for callable local reference used in the [`DataFrame.query()`](../reference/api/pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") string ([GH 26426](https://github.com/pandas-dev/pandas/issues/26426)) +* Fixed a `KeyError` when indexing a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") level with a list containing exactly one label, which is missing ([GH 27148](https://github.com/pandas-dev/pandas/issues/27148)) +* Bug which produced `AttributeError` on partial matching [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") in a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 26944](https://github.com/pandas-dev/pandas/issues/26944)) +* Bug in [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") and [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") with [`Interval`](../reference/api/pandas.Interval.html#pandas.Interval "pandas.Interval") values when using the `in` operator (`__contains`) with objects that are not comparable to the values in the `Interval` ([GH 23705](https://github.com/pandas-dev/pandas/issues/23705)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") and [`DataFrame.iloc()`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") on a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a single timezone-aware datetime64[ns] column incorrectly returning a scalar instead of a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") ([GH 27110](https://github.com/pandas-dev/pandas/issues/27110)) +* Bug in [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") and [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") incorrectly raising `ValueError` instead of `TypeError` when a list is passed using the `in` operator (`__contains__`) ([GH 21729](https://github.com/pandas-dev/pandas/issues/21729)) +* Bug in setting a new value in a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with a [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") object incorrectly casting the value to an integer ([GH 22717](https://github.com/pandas-dev/pandas/issues/22717)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") setting a new key (`__setitem__`) with a timezone-aware datetime incorrectly raising `ValueError` ([GH 12862](https://github.com/pandas-dev/pandas/issues/12862)) +* Bug in [`DataFrame.iloc()`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") when indexing with a read-only indexer ([GH 17192](https://github.com/pandas-dev/pandas/issues/17192)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") setting an existing tuple key (`__setitem__`) with timezone-aware datetime values incorrectly raising `TypeError` ([GH 20441](https://github.com/pandas-dev/pandas/issues/20441)) + +### Missing[#](#missing "Link to this heading") + +* Fixed misleading exception message in [`Series.interpolate()`](../reference/api/pandas.Series.interpolate.html#pandas.Series.interpolate "pandas.Series.interpolate") if argument `order` is required, but omitted ([GH 10633](https://github.com/pandas-dev/pandas/issues/10633), [GH 24014](https://github.com/pandas-dev/pandas/issues/24014)). +* Fixed class type displayed in exception message in [`DataFrame.dropna()`](../reference/api/pandas.DataFrame.dropna.html#pandas.DataFrame.dropna "pandas.DataFrame.dropna") if invalid `axis` parameter passed ([GH 25555](https://github.com/pandas-dev/pandas/issues/25555)) +* A `ValueError` will now be thrown by [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") when `limit` is not a positive integer ([GH 27042](https://github.com/pandas-dev/pandas/issues/27042)) + +### MultiIndex[#](#multiindex "Link to this heading") + +* Bug in which incorrect exception raised by [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") when testing the membership of [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 24570](https://github.com/pandas-dev/pandas/issues/24570)) + +### IO[#](#io "Link to this heading") + +* Bug in [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") where values were truncated using display options instead of outputting the full content ([GH 17004](https://github.com/pandas-dev/pandas/issues/17004)) +* Fixed bug in missing text when using `to_clipboard()` if copying utf-16 characters in Python 3 on Windows ([GH 25040](https://github.com/pandas-dev/pandas/issues/25040)) +* Bug in [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") for `orient='table'` when it tries to infer dtypes by default, which is not applicable as dtypes are already defined in the JSON schema ([GH 21345](https://github.com/pandas-dev/pandas/issues/21345)) +* Bug in [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") for `orient='table'` and float index, as it infers index dtype by default, which is not applicable because index dtype is already defined in the JSON schema ([GH 25433](https://github.com/pandas-dev/pandas/issues/25433)) +* Bug in [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") for `orient='table'` and string of float column names, as it makes a column name type conversion to [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp"), which is not applicable because column names are already defined in the JSON schema ([GH 25435](https://github.com/pandas-dev/pandas/issues/25435)) +* Bug in [`json_normalize()`](../reference/api/pandas.json_normalize.html#pandas.json_normalize "pandas.json_normalize") for `errors='ignore'` where missing values in the input data, were filled in resulting `DataFrame` with the string `"nan"` instead of `numpy.nan` ([GH 25468](https://github.com/pandas-dev/pandas/issues/25468)) +* [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") now raises `TypeError` when using an invalid type for the `classes` parameter instead of `AssertionError` ([GH 25608](https://github.com/pandas-dev/pandas/issues/25608)) +* Bug in [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string") and [`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex") that would lead to incorrect output when the `header` keyword is used ([GH 16718](https://github.com/pandas-dev/pandas/issues/16718)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") not properly interpreting the UTF8 encoded filenames on Windows on Python 3.6+ ([GH 15086](https://github.com/pandas-dev/pandas/issues/15086)) +* Improved performance in [`pandas.read_stata()`](../reference/api/pandas.read_stata.html#pandas.read_stata "pandas.read_stata") and `pandas.io.stata.StataReader` when converting columns that have missing values ([GH 25772](https://github.com/pandas-dev/pandas/issues/25772)) +* Bug in [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") where header numbers would ignore display options when rounding ([GH 17280](https://github.com/pandas-dev/pandas/issues/17280)) +* Bug in [`read_hdf()`](../reference/api/pandas.read_hdf.html#pandas.read_hdf "pandas.read_hdf") where reading a table from an HDF5 file written directly with PyTables fails with a `ValueError` when using a sub-selection via the `start` or `stop` arguments ([GH 11188](https://github.com/pandas-dev/pandas/issues/11188)) +* Bug in [`read_hdf()`](../reference/api/pandas.read_hdf.html#pandas.read_hdf "pandas.read_hdf") not properly closing store after a `KeyError` is raised ([GH 25766](https://github.com/pandas-dev/pandas/issues/25766)) +* Improved the explanation for the failure when value labels are repeated in Stata dta files and suggested work-arounds ([GH 25772](https://github.com/pandas-dev/pandas/issues/25772)) +* Improved [`pandas.read_stata()`](../reference/api/pandas.read_stata.html#pandas.read_stata "pandas.read_stata") and `pandas.io.stata.StataReader` to read incorrectly formatted 118 format files saved by Stata ([GH 25960](https://github.com/pandas-dev/pandas/issues/25960)) +* Improved the `col_space` parameter in [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") to accept a string so CSS length values can be set correctly ([GH 25941](https://github.com/pandas-dev/pandas/issues/25941)) +* Fixed bug in loading objects from S3 that contain `#` characters in the URL ([GH 25945](https://github.com/pandas-dev/pandas/issues/25945)) +* Adds `use_bqstorage_api` parameter to [`read_gbq()`](../reference/api/pandas.read_gbq.html#pandas.read_gbq "pandas.read_gbq") to speed up downloads of large data frames. This feature requires version 0.10.0 of the `pandas-gbq` library as well as the `google-cloud-bigquery-storage` and `fastavro` libraries. ([GH 26104](https://github.com/pandas-dev/pandas/issues/26104)) +* Fixed memory leak in [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") when dealing with numeric data ([GH 24889](https://github.com/pandas-dev/pandas/issues/24889)) +* Bug in [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") where date strings with `Z` were not converted to a UTC timezone ([GH 26168](https://github.com/pandas-dev/pandas/issues/26168)) +* Added `cache_dates=True` parameter to [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv"), which allows to cache unique dates when they are parsed ([GH 25990](https://github.com/pandas-dev/pandas/issues/25990)) +* [`DataFrame.to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel") now raises a `ValueError` when the caller’s dimensions exceed the limitations of Excel ([GH 26051](https://github.com/pandas-dev/pandas/issues/26051)) +* Fixed bug in [`pandas.read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") where a BOM would result in incorrect parsing using engine=’python’ ([GH 26545](https://github.com/pandas-dev/pandas/issues/26545)) +* [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") now raises a `ValueError` when input is of type `pandas.io.excel.ExcelFile` and `engine` param is passed since `pandas.io.excel.ExcelFile` has an engine defined ([GH 26566](https://github.com/pandas-dev/pandas/issues/26566)) +* Bug while selecting from `HDFStore` with `where=''` specified ([GH 26610](https://github.com/pandas-dev/pandas/issues/26610)). +* Fixed bug in [`DataFrame.to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel") where custom objects (i.e. `PeriodIndex`) inside merged cells were not being converted into types safe for the Excel writer ([GH 27006](https://github.com/pandas-dev/pandas/issues/27006)) +* Bug in [`read_hdf()`](../reference/api/pandas.read_hdf.html#pandas.read_hdf "pandas.read_hdf") where reading a timezone aware [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") would raise a `TypeError` ([GH 11926](https://github.com/pandas-dev/pandas/issues/11926)) +* Bug in `to_msgpack()` and `read_msgpack()` which would raise a `ValueError` rather than a `FileNotFoundError` for an invalid path ([GH 27160](https://github.com/pandas-dev/pandas/issues/27160)) +* Fixed bug in [`DataFrame.to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") which would raise a `ValueError` when the dataframe had no columns ([GH 27339](https://github.com/pandas-dev/pandas/issues/27339)) +* Allow parsing of [`PeriodDtype`](../reference/api/pandas.PeriodDtype.html#pandas.PeriodDtype "pandas.PeriodDtype") columns when using [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") ([GH 26934](https://github.com/pandas-dev/pandas/issues/26934)) + +### Plotting[#](#plotting "Link to this heading") + +* Fixed bug where [`api.extensions.ExtensionArray`](../reference/api/pandas.api.extensions.ExtensionArray.html#pandas.api.extensions.ExtensionArray "pandas.api.extensions.ExtensionArray") could not be used in matplotlib plotting ([GH 25587](https://github.com/pandas-dev/pandas/issues/25587)) +* Bug in an error message in [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot"). Improved the error message if non-numerics are passed to [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") ([GH 25481](https://github.com/pandas-dev/pandas/issues/25481)) +* Bug in incorrect ticklabel positions when plotting an index that are non-numeric / non-datetime ([GH 7612](https://github.com/pandas-dev/pandas/issues/7612), [GH 15912](https://github.com/pandas-dev/pandas/issues/15912), [GH 22334](https://github.com/pandas-dev/pandas/issues/22334)) +* Fixed bug causing plots of [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") timeseries to fail if the frequency is a multiple of the frequency rule code ([GH 14763](https://github.com/pandas-dev/pandas/issues/14763)) +* Fixed bug when plotting a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with `datetime.timezone.utc` timezone ([GH 17173](https://github.com/pandas-dev/pandas/issues/17173)) + +### GroupBy/resample/rolling[#](#groupby-resample-rolling "Link to this heading") + +* Bug in `Resampler.agg()` with a timezone aware index where `OverflowError` would raise when passing a list of functions ([GH 22660](https://github.com/pandas-dev/pandas/issues/22660)) +* Bug in [`DataFrameGroupBy.nunique()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.nunique.html#pandas.core.groupby.DataFrameGroupBy.nunique "pandas.core.groupby.DataFrameGroupBy.nunique") in which the names of column levels were lost ([GH 23222](https://github.com/pandas-dev/pandas/issues/23222)) +* Bug in `GroupBy.agg()` when applying an aggregation function to timezone aware data ([GH 23683](https://github.com/pandas-dev/pandas/issues/23683)) +* Bug in `GroupBy.first()` and `GroupBy.last()` where timezone information would be dropped ([GH 21603](https://github.com/pandas-dev/pandas/issues/21603)) +* Bug in `GroupBy.size()` when grouping only NA values ([GH 23050](https://github.com/pandas-dev/pandas/issues/23050)) +* Bug in [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") where `observed` kwarg was previously ignored ([GH 24880](https://github.com/pandas-dev/pandas/issues/24880)) +* Bug in [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") where using `groupby` with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") Series with a list of labels equal to the length of the series caused incorrect grouping ([GH 25704](https://github.com/pandas-dev/pandas/issues/25704)) +* Ensured that ordering of outputs in `groupby` aggregation functions is consistent across all versions of Python ([GH 25692](https://github.com/pandas-dev/pandas/issues/25692)) +* Ensured that result group order is correct when grouping on an ordered `Categorical` and specifying `observed=True` ([GH 25871](https://github.com/pandas-dev/pandas/issues/25871), [GH 25167](https://github.com/pandas-dev/pandas/issues/25167)) +* Bug in [`Rolling.min()`](../reference/api/pandas.core.window.rolling.Rolling.min.html#pandas.core.window.rolling.Rolling.min "pandas.core.window.rolling.Rolling.min") and [`Rolling.max()`](../reference/api/pandas.core.window.rolling.Rolling.max.html#pandas.core.window.rolling.Rolling.max "pandas.core.window.rolling.Rolling.max") that caused a memory leak ([GH 25893](https://github.com/pandas-dev/pandas/issues/25893)) +* Bug in [`Rolling.count()`](../reference/api/pandas.core.window.rolling.Rolling.count.html#pandas.core.window.rolling.Rolling.count "pandas.core.window.rolling.Rolling.count") and `.Expanding.count` was previously ignoring the `axis` keyword ([GH 13503](https://github.com/pandas-dev/pandas/issues/13503)) +* Bug in `GroupBy.idxmax()` and `GroupBy.idxmin()` with datetime column would return incorrect dtype ([GH 25444](https://github.com/pandas-dev/pandas/issues/25444), [GH 15306](https://github.com/pandas-dev/pandas/issues/15306)) +* Bug in `GroupBy.cumsum()`, `GroupBy.cumprod()`, `GroupBy.cummin()` and `GroupBy.cummax()` with categorical column having absent categories, would return incorrect result or segfault ([GH 16771](https://github.com/pandas-dev/pandas/issues/16771)) +* Bug in `GroupBy.nth()` where NA values in the grouping would return incorrect results ([GH 26011](https://github.com/pandas-dev/pandas/issues/26011)) +* Bug in [`SeriesGroupBy.transform()`](../reference/api/pandas.core.groupby.SeriesGroupBy.transform.html#pandas.core.groupby.SeriesGroupBy.transform "pandas.core.groupby.SeriesGroupBy.transform") where transforming an empty group would raise a `ValueError` ([GH 26208](https://github.com/pandas-dev/pandas/issues/26208)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") where passing a [`Grouper`](../reference/api/pandas.Grouper.html#pandas.Grouper "pandas.Grouper") would return incorrect groups when using the `.groups` accessor ([GH 26326](https://github.com/pandas-dev/pandas/issues/26326)) +* Bug in `GroupBy.agg()` where incorrect results are returned for uint64 columns. ([GH 26310](https://github.com/pandas-dev/pandas/issues/26310)) +* Bug in [`Rolling.median()`](../reference/api/pandas.core.window.rolling.Rolling.median.html#pandas.core.window.rolling.Rolling.median "pandas.core.window.rolling.Rolling.median") and [`Rolling.quantile()`](../reference/api/pandas.core.window.rolling.Rolling.quantile.html#pandas.core.window.rolling.Rolling.quantile "pandas.core.window.rolling.Rolling.quantile") where MemoryError is raised with empty window ([GH 26005](https://github.com/pandas-dev/pandas/issues/26005)) +* Bug in [`Rolling.median()`](../reference/api/pandas.core.window.rolling.Rolling.median.html#pandas.core.window.rolling.Rolling.median "pandas.core.window.rolling.Rolling.median") and [`Rolling.quantile()`](../reference/api/pandas.core.window.rolling.Rolling.quantile.html#pandas.core.window.rolling.Rolling.quantile "pandas.core.window.rolling.Rolling.quantile") where incorrect results are returned with `closed='left'` and `closed='neither'` ([GH 26005](https://github.com/pandas-dev/pandas/issues/26005)) +* Improved `Rolling`, `Window` and `ExponentialMovingWindow` functions to exclude nuisance columns from results instead of raising errors and raise a `DataError` only if all columns are nuisance ([GH 12537](https://github.com/pandas-dev/pandas/issues/12537)) +* Bug in [`Rolling.max()`](../reference/api/pandas.core.window.rolling.Rolling.max.html#pandas.core.window.rolling.Rolling.max "pandas.core.window.rolling.Rolling.max") and [`Rolling.min()`](../reference/api/pandas.core.window.rolling.Rolling.min.html#pandas.core.window.rolling.Rolling.min "pandas.core.window.rolling.Rolling.min") where incorrect results are returned with an empty variable window ([GH 26005](https://github.com/pandas-dev/pandas/issues/26005)) +* Raise a helpful exception when an unsupported weighted window function is used as an argument of `Window.aggregate()` ([GH 26597](https://github.com/pandas-dev/pandas/issues/26597)) + +### Reshaping[#](#reshaping "Link to this heading") + +* Bug in [`pandas.merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") adds a string of `None`, if `None` is assigned in suffixes instead of remain the column name as-is ([GH 24782](https://github.com/pandas-dev/pandas/issues/24782)). +* Bug in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") when merging by index name would sometimes result in an incorrectly numbered index (missing index values are now assigned NA) ([GH 24212](https://github.com/pandas-dev/pandas/issues/24212), [GH 25009](https://github.com/pandas-dev/pandas/issues/25009)) +* `to_records()` now accepts dtypes to its `column_dtypes` parameter ([GH 24895](https://github.com/pandas-dev/pandas/issues/24895)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") where order of `OrderedDict` (and `dict` in Python 3.6+) is not respected, when passed in as `objs` argument ([GH 21510](https://github.com/pandas-dev/pandas/issues/21510)) +* Bug in [`pivot_table()`](../reference/api/pandas.pivot_table.html#pandas.pivot_table "pandas.pivot_table") where columns with `NaN` values are dropped even if `dropna` argument is `False`, when the `aggfunc` argument contains a `list` ([GH 22159](https://github.com/pandas-dev/pandas/issues/22159)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") where the resulting `freq` of two [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with the same `freq` would be dropped ([GH 3232](https://github.com/pandas-dev/pandas/issues/3232)). +* Bug in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") where merging with equivalent Categorical dtypes was raising an error ([GH 22501](https://github.com/pandas-dev/pandas/issues/22501)) +* bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") instantiating with a dict of iterators or generators (e.g. `pd.DataFrame({'A': reversed(range(3))})`) raised an error ([GH 26349](https://github.com/pandas-dev/pandas/issues/26349)). +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") instantiating with a `range` (e.g. `pd.DataFrame(range(3))`) raised an error ([GH 26342](https://github.com/pandas-dev/pandas/issues/26342)). +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor when passing non-empty tuples would cause a segmentation fault ([GH 25691](https://github.com/pandas-dev/pandas/issues/25691)) +* Bug in [`Series.apply()`](../reference/api/pandas.Series.apply.html#pandas.Series.apply "pandas.Series.apply") failed when the series is a timezone aware [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") ([GH 25959](https://github.com/pandas-dev/pandas/issues/25959)) +* Bug in [`pandas.cut()`](../reference/api/pandas.cut.html#pandas.cut "pandas.cut") where large bins could incorrectly raise an error due to an integer overflow ([GH 26045](https://github.com/pandas-dev/pandas/issues/26045)) +* Bug in [`DataFrame.sort_index()`](../reference/api/pandas.DataFrame.sort_index.html#pandas.DataFrame.sort_index "pandas.DataFrame.sort_index") where an error is thrown when a multi-indexed `DataFrame` is sorted on all levels with the initial level sorted last ([GH 26053](https://github.com/pandas-dev/pandas/issues/26053)) +* Bug in [`Series.nlargest()`](../reference/api/pandas.Series.nlargest.html#pandas.Series.nlargest "pandas.Series.nlargest") treats `True` as smaller than `False` ([GH 26154](https://github.com/pandas-dev/pandas/issues/26154)) +* Bug in [`DataFrame.pivot_table()`](../reference/api/pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table") with a [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") as pivot index would raise `TypeError` ([GH 25814](https://github.com/pandas-dev/pandas/issues/25814)) +* Bug in which [`DataFrame.from_dict()`](../reference/api/pandas.DataFrame.from_dict.html#pandas.DataFrame.from_dict "pandas.DataFrame.from_dict") ignored order of `OrderedDict` when `orient='index'` ([GH 8425](https://github.com/pandas-dev/pandas/issues/8425)). +* Bug in [`DataFrame.transpose()`](../reference/api/pandas.DataFrame.transpose.html#pandas.DataFrame.transpose "pandas.DataFrame.transpose") where transposing a DataFrame with a timezone-aware datetime column would incorrectly raise `ValueError` ([GH 26825](https://github.com/pandas-dev/pandas/issues/26825)) +* Bug in [`pivot_table()`](../reference/api/pandas.pivot_table.html#pandas.pivot_table "pandas.pivot_table") when pivoting a timezone aware column as the `values` would remove timezone information ([GH 14948](https://github.com/pandas-dev/pandas/issues/14948)) +* Bug in [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") when specifying multiple `by` columns where one is `datetime64[ns, tz]` dtype ([GH 26649](https://github.com/pandas-dev/pandas/issues/26649)) + +### Sparse[#](#sparse "Link to this heading") + +* Significant speedup in `SparseArray` initialization that benefits most operations, fixing performance regression introduced in v0.20.0 ([GH 24985](https://github.com/pandas-dev/pandas/issues/24985)) +* Bug in `SparseFrame` constructor where passing `None` as the data would cause `default_fill_value` to be ignored ([GH 16807](https://github.com/pandas-dev/pandas/issues/16807)) +* Bug in `SparseDataFrame` when adding a column in which the length of values does not match length of index, `AssertionError` is raised instead of raising `ValueError` ([GH 25484](https://github.com/pandas-dev/pandas/issues/25484)) +* Introduce a better error message in [`Series.sparse.from_coo()`](../reference/api/pandas.Series.sparse.from_coo.html#pandas.Series.sparse.from_coo "pandas.Series.sparse.from_coo") so it returns a `TypeError` for inputs that are not coo matrices ([GH 26554](https://github.com/pandas-dev/pandas/issues/26554)) +* Bug in `numpy.modf()` on a `SparseArray`. Now a tuple of `SparseArray` is returned ([GH 26946](https://github.com/pandas-dev/pandas/issues/26946)). + +### Build changes[#](#build-changes "Link to this heading") + +* Fix install error with PyPy on macOS ([GH 26536](https://github.com/pandas-dev/pandas/issues/26536)) + +### ExtensionArray[#](#extensionarray "Link to this heading") + +* Bug in [`factorize()`](../reference/api/pandas.factorize.html#pandas.factorize "pandas.factorize") when passing an `ExtensionArray` with a custom `na_sentinel` ([GH 25696](https://github.com/pandas-dev/pandas/issues/25696)). +* [`Series.count()`](../reference/api/pandas.Series.count.html#pandas.Series.count "pandas.Series.count") miscounts NA values in ExtensionArrays ([GH 26835](https://github.com/pandas-dev/pandas/issues/26835)) +* Added `Series.__array_ufunc__` to better handle NumPy ufuncs applied to Series backed by extension arrays ([GH 23293](https://github.com/pandas-dev/pandas/issues/23293)). +* Keyword argument `deep` has been removed from `ExtensionArray.copy()` ([GH 27083](https://github.com/pandas-dev/pandas/issues/27083)) + +### Other[#](#other "Link to this heading") + +* Removed unused C functions from vendored UltraJSON implementation ([GH 26198](https://github.com/pandas-dev/pandas/issues/26198)) +* Allow [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") and [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") to be passed to numpy `min` and `max` functions ([GH 26125](https://github.com/pandas-dev/pandas/issues/26125)) +* Use actual class name in repr of empty objects of a `Series` subclass ([GH 27001](https://github.com/pandas-dev/pandas/issues/27001)). +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") where passing an object array of timezone-aware `datetime` objects would incorrectly raise `ValueError` ([GH 13287](https://github.com/pandas-dev/pandas/issues/13287)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 231 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* 1\_x7 + +* Abdullah İhsan Seçer + +* Adam Bull + +* Adam Hooper +* Albert Villanova del Moral +* Alex Watt + +* AlexTereshenkov + +* Alexander Buchkovsky +* Alexander Hendorf + +* Alexander Nordin + +* Alexander Ponomaroff +* Alexandre Batisse + +* Alexandre Decan + +* Allen Downey + +* Alyssa Fu Ward + +* Andrew Gaspari + +* Andrew Wood + +* Antoine Viscardi + +* Antonio Gutierrez + +* Arno Veenstra + +* ArtinSarraf +* Batalex + +* Baurzhan Muftakhidinov +* Benjamin Rowell +* Bharat Raghunathan + +* Bhavani Ravi + +* Big Head + +* Brett Randall + +* Bryan Cutler + +* C John Klehm + +* Caleb Braun + +* Cecilia + +* Chris Bertinato + +* Chris Stadler + +* Christian Haege + +* Christian Hudon +* Christopher Whelan +* Chuanzhu Xu + +* Clemens Brunner +* Damian Kula + +* Daniel Hrisca + +* Daniel Luis Costa + +* Daniel Saxton +* DanielFEvans + +* David Liu + +* Deepyaman Datta + +* Denis Belavin + +* Devin Petersohn + +* Diane Trout + +* EdAbati + +* Enrico Rotundo + +* EternalLearner42 + +* Evan + +* Evan Livelo + +* Fabian Rost + +* Flavien Lambert + +* Florian Rathgeber + +* Frank Hoang + +* Gaibo Zhang + +* Gioia Ballin +* Giuseppe Romagnuolo + +* Gordon Blackadder + +* Gregory Rome + +* Guillaume Gay +* HHest + +* Hielke Walinga + +* How Si Wei + +* Hubert +* Huize Wang + +* Hyukjin Kwon + +* Ian Dunn + +* Inevitable-Marzipan + +* Irv Lustig +* JElfner + +* Jacob Bundgaard + +* James Cobon-Kerr + +* Jan-Philip Gehrcke + +* Jarrod Millman + +* Jayanth Katuri + +* Jeff Reback +* Jeremy Schendel +* Jiang Yue + +* Joel Ostblom +* Johan von Forstner + +* Johnny Chiu + +* Jonas + +* Jonathon Vandezande + +* Jop Vermeer + +* Joris Van den Bossche +* Josh +* Josh Friedlander + +* Justin Zheng +* Kaiqi Dong +* Kane + +* Kapil Patel + +* Kara de la Marck + +* Katherine Surta + +* Katrin Leinweber + +* Kendall Masse +* Kevin Sheppard +* Kyle Kosic + +* Lorenzo Stella + +* Maarten Rietbergen + +* Mak Sze Chun +* Marc Garcia +* Mateusz Woś +* Matias Heikkilä +* Mats Maiwald + +* Matthew Roeschke +* Max Bolingbroke + +* Max Kovalovs + +* Max van Deursen + +* Michael +* Michael Davis + +* Michael P. Moran + +* Mike Cramblett + +* Min ho Kim + +* Misha Veldhoen + +* Mukul Ashwath Ram + +* MusTheDataGuy + +* Nanda H Krishna + +* Nicholas Musolino +* Noam Hershtig + +* Noora Husseini + +* Paul +* Paul Reidy +* Pauli Virtanen +* Pav A + +* Peter Leimbigler + +* Philippe Ombredanne + +* Pietro Battiston +* Richard Eames + +* Roman Yurchak +* Ruijing Li +* Ryan +* Ryan Joyce + +* Ryan Nazareth +* Ryan Rehman + +* Sakar Panta + +* Samuel Sinayoko +* Sandeep Pathak + +* Sangwoong Yoon +* Saurav Chakravorty +* Scott Talbert + +* Sergey Kopylov + +* Shantanu Gontia + +* Shivam Rana + +* Shorokhov Sergey + +* Simon Hawkins +* Soyoun(Rose) Kim +* Stephan Hoyer +* Stephen Cowley + +* Stephen Rauch +* Sterling Paramore + +* Steven + +* Stijn Van Hoey +* Sumanau Sareen + +* Takuya N + +* Tan Tran + +* Tao He + +* Tarbo Fukazawa +* Terji Petersen + +* Thein Oo +* ThibTrip + +* Thijs Damsma + +* Thiviyan Thanapalasingam +* Thomas A Caswell +* Thomas Kluiters + +* Tilen Kusterle + +* Tim Gates + +* Tim Hoffmann +* Tim Swast +* Tom Augspurger +* Tom Neep + +* Tomáš Chvátal + +* Tyler Reddy +* Vaibhav Vishal + +* Vasily Litvinov + +* Vibhu Agarwal + +* Vikramjeet Das + +* Vladislav + +* Víctor Moron Tejero + +* Wenhuan +* Will Ayd + +* William Ayd +* Wouter De Coster + +* Yoann Goular + +* Zach Angell + +* alimcmaster1 +* anmyachev + +* chris-b1 +* danielplawrence + +* endenis + +* enisnazif + +* ezcitron + +* fjetter +* froessler +* gfyoung +* gwrome + +* h-vetinari +* haison + +* hannah-c + +* heckeop + +* iamshwin + +* jamesoliverh + +* jbrockmendel +* jkovacevic + +* killerontherun1 + +* knuu + +* kpapdac + +* kpflugshaupt + +* krsnik93 + +* leerssej + +* lrjball + +* mazayo + +* nathalier + +* nrebena + +* nullptr + +* pilkibun + +* pmaxey83 + +* rbenes + +* robbuckley +* shawnbrown + +* sudhir mohanraj + +* tadeja + +* tamuhey + +* thatneat +* topper-123 +* willweil + +* yehia67 + +* yhaque1213 + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.25.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.25.1.md new file mode 100644 index 0000000000000000000000000000000000000000..5438420170103f50c9c5c54493235c164937a09a --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.25.1.md @@ -0,0 +1,106 @@ +# What's new in pandas 0.25.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.25.1.html + +# What’s new in 0.25.1 (August 21, 2019)[#](#what-s-new-in-0-25-1-august-21-2019 "Link to this heading") + +These are the changes in pandas 0.25.1. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## IO and LZMA[#](#io-and-lzma "Link to this heading") + +Some users may unknowingly have an incomplete Python installation lacking the `lzma` module from the standard library. In this case, `import pandas` failed due to an `ImportError` ([GH 27575](https://github.com/pandas-dev/pandas/issues/27575)). +pandas will now warn, rather than raising an `ImportError` if the `lzma` module is not present. Any subsequent attempt to use `lzma` methods will raise a `RuntimeError`. +A possible fix for the lack of the `lzma` module is to ensure you have the necessary libraries and then re-install Python. +For example, on MacOS installing Python with `pyenv` may lead to an incomplete Python installation due to unmet system dependencies at compilation time (like `xz`). Compilation will succeed, but Python might fail at run time. The issue can be solved by installing the necessary dependencies and then re-installing Python. + +## Bug fixes[#](#bug-fixes "Link to this heading") + +### Categorical[#](#categorical "Link to this heading") + +* Bug in `Categorical.fillna()` that would replace all values, not just those that are `NaN` ([GH 26215](https://github.com/pandas-dev/pandas/issues/26215)) + +### Datetimelike[#](#datetimelike "Link to this heading") + +* Bug in `to_datetime()` where passing a timezone-naive `DatetimeArray` or `DatetimeIndex` and `utc=True` would incorrectly return a timezone-naive result ([GH 27733](https://github.com/pandas-dev/pandas/issues/27733)) +* Bug in `Period.to_timestamp()` where a `Period` outside the `Timestamp` implementation bounds (roughly 1677-09-21 to 2262-04-11) would return an incorrect `Timestamp` instead of raising `OutOfBoundsDatetime` ([GH 19643](https://github.com/pandas-dev/pandas/issues/19643)) +* Bug in iterating over `DatetimeIndex` when the underlying data is read-only ([GH 28055](https://github.com/pandas-dev/pandas/issues/28055)) + +### Timezones[#](#timezones "Link to this heading") + +* Bug in `Index` where a numpy object array with a timezone aware `Timestamp` and `np.nan` would not return a `DatetimeIndex` ([GH 27011](https://github.com/pandas-dev/pandas/issues/27011)) + +### Numeric[#](#numeric "Link to this heading") + +* Bug in `Series.interpolate()` when using a timezone aware `DatetimeIndex` ([GH 27548](https://github.com/pandas-dev/pandas/issues/27548)) +* Bug when printing negative floating point complex numbers would raise an `IndexError` ([GH 27484](https://github.com/pandas-dev/pandas/issues/27484)) +* Bug where `DataFrame` arithmetic operators such as `DataFrame.mul()` with a `Series` with axis=1 would raise an `AttributeError` on `DataFrame` larger than the minimum threshold to invoke numexpr ([GH 27636](https://github.com/pandas-dev/pandas/issues/27636)) +* Bug in `DataFrame` arithmetic where missing values in results were incorrectly masked with `NaN` instead of `Inf` ([GH 27464](https://github.com/pandas-dev/pandas/issues/27464)) + +### Conversion[#](#conversion "Link to this heading") + +* Improved the warnings for the deprecated methods `Series.real()` and `Series.imag()` ([GH 27610](https://github.com/pandas-dev/pandas/issues/27610)) + +### Interval[#](#interval "Link to this heading") + +* Bug in `IntervalIndex` where `dir(obj)` would raise `ValueError` ([GH 27571](https://github.com/pandas-dev/pandas/issues/27571)) + +### Indexing[#](#indexing "Link to this heading") + +* Bug in partial-string indexing returning a NumPy array rather than a `Series` when indexing with a scalar like `.loc['2015']` ([GH 27516](https://github.com/pandas-dev/pandas/issues/27516)) +* Break reference cycle involving `Index` and other index classes to allow garbage collection of index objects without running the GC. ([GH 27585](https://github.com/pandas-dev/pandas/issues/27585), [GH 27840](https://github.com/pandas-dev/pandas/issues/27840)) +* Fix regression in assigning values to a single column of a DataFrame with a `MultiIndex` columns ([GH 27841](https://github.com/pandas-dev/pandas/issues/27841)). +* Fix regression in `.ix` fallback with an `IntervalIndex` ([GH 27865](https://github.com/pandas-dev/pandas/issues/27865)). + +### Missing[#](#missing "Link to this heading") + +* Bug in [`pandas.isnull()`](../reference/api/pandas.isnull.html#pandas.isnull "pandas.isnull") or [`pandas.isna()`](../reference/api/pandas.isna.html#pandas.isna "pandas.isna") when the input is a type e.g. `type(pandas.Series())` ([GH 27482](https://github.com/pandas-dev/pandas/issues/27482)) + +### IO[#](#io "Link to this heading") + +* Avoid calling `S3File.s3` when reading parquet, as this was removed in s3fs version 0.3.0 ([GH 27756](https://github.com/pandas-dev/pandas/issues/27756)) +* Better error message when a negative header is passed in [`pandas.read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") ([GH 27779](https://github.com/pandas-dev/pandas/issues/27779)) +* Follow the `min_rows` display option (introduced in v0.25.0) correctly in the HTML repr in the notebook ([GH 27991](https://github.com/pandas-dev/pandas/issues/27991)). + +### Plotting[#](#plotting "Link to this heading") + +* Added a `pandas_plotting_backends` entrypoint group for registering plot backends. See [Plotting backends](../development/extending.html#extending-plotting-backends) for more ([GH 26747](https://github.com/pandas-dev/pandas/issues/26747)). +* Fixed the re-instatement of Matplotlib datetime converters after calling + [`pandas.plotting.deregister_matplotlib_converters()`](../reference/api/pandas.plotting.deregister_matplotlib_converters.html#pandas.plotting.deregister_matplotlib_converters "pandas.plotting.deregister_matplotlib_converters") ([GH 27481](https://github.com/pandas-dev/pandas/issues/27481)). +* Fix compatibility issue with matplotlib when passing a pandas `Index` to a plot call ([GH 27775](https://github.com/pandas-dev/pandas/issues/27775)). + +### GroupBy/resample/rolling[#](#groupby-resample-rolling "Link to this heading") + +* Fixed regression in `pands.core.groupby.DataFrameGroupBy.quantile()` raising when multiple quantiles are given ([GH 27526](https://github.com/pandas-dev/pandas/issues/27526)) +* Bug in [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") where applying a timezone conversion lambda function would drop timezone information ([GH 27496](https://github.com/pandas-dev/pandas/issues/27496)) +* Bug in `GroupBy.nth()` where `observed=False` was being ignored for Categorical groupers ([GH 26385](https://github.com/pandas-dev/pandas/issues/26385)) +* Bug in windowing over read-only arrays ([GH 27766](https://github.com/pandas-dev/pandas/issues/27766)) +* Fixed segfault in `.DataFrameGroupBy.quantile` when an invalid quantile was passed ([GH 27470](https://github.com/pandas-dev/pandas/issues/27470)) + +### Reshaping[#](#reshaping "Link to this heading") + +* A `KeyError` is now raised if `.unstack()` is called on a `Series` or `DataFrame` with a flat `Index` passing a name which is not the correct one ([GH 18303](https://github.com/pandas-dev/pandas/issues/18303)) +* Bug `merge_asof()` could not merge `Timedelta` objects when passing `tolerance` kwarg ([GH 27642](https://github.com/pandas-dev/pandas/issues/27642)) +* Bug in `DataFrame.crosstab()` when `margins` set to `True` and `normalize` is not `False`, an error is raised. ([GH 27500](https://github.com/pandas-dev/pandas/issues/27500)) +* `DataFrame.join()` now suppresses the `FutureWarning` when the sort parameter is specified ([GH 21952](https://github.com/pandas-dev/pandas/issues/21952)) +* Bug in `DataFrame.join()` raising with readonly arrays ([GH 27943](https://github.com/pandas-dev/pandas/issues/27943)) + +### Sparse[#](#sparse "Link to this heading") + +* Bug in reductions for `Series` with Sparse dtypes ([GH 27080](https://github.com/pandas-dev/pandas/issues/27080)) + +### Other[#](#other "Link to this heading") + +* Bug in `Series.replace()` and `DataFrame.replace()` when replacing timezone-aware timestamps using a dict-like replacer ([GH 27720](https://github.com/pandas-dev/pandas/issues/27720)) +* Bug in `Series.rename()` when using a custom type indexer. Now any value that isn’t callable or dict-like is treated as a scalar. ([GH 27814](https://github.com/pandas-dev/pandas/issues/27814)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 5 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Jeff Reback +* Joris Van den Bossche +* MeeseeksMachine + +* Tom Augspurger +* jbrockmendel diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.25.2.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.25.2.md new file mode 100644 index 0000000000000000000000000000000000000000..851baa9f5aaf836acaaa73d7ec625b5f67e701ba --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.25.2.md @@ -0,0 +1,48 @@ +# What's new in pandas 0.25.2 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.25.2.html + +# What’s new in 0.25.2 (October 15, 2019)[#](#what-s-new-in-0-25-2-october-15-2019 "Link to this heading") + +These are the changes in pandas 0.25.2. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +Note + +pandas 0.25.2 adds compatibility for Python 3.8 ([GH 28147](https://github.com/pandas-dev/pandas/issues/28147)). + +## Bug fixes[#](#bug-fixes "Link to this heading") + +### Indexing[#](#indexing "Link to this heading") + +* Fix regression in `DataFrame.reindex()` not following the `limit` argument ([GH 28631](https://github.com/pandas-dev/pandas/issues/28631)). +* Fix regression in `RangeIndex.get_indexer()` for decreasing `RangeIndex` where target values may be improperly identified as missing/present ([GH 28678](https://github.com/pandas-dev/pandas/issues/28678)) + +### IO[#](#io "Link to this heading") + +* Fix regression in notebook display where `` tags were missing for `DataFrame.index` values ([GH 28204](https://github.com/pandas-dev/pandas/issues/28204)). +* Regression in `to_csv()` where writing a `Series` or `DataFrame` indexed by an `IntervalIndex` would incorrectly raise a `TypeError` ([GH 28210](https://github.com/pandas-dev/pandas/issues/28210)) +* Fix `to_csv()` with `ExtensionArray` with list-like values ([GH 28840](https://github.com/pandas-dev/pandas/issues/28840)). + +### GroupBy/resample/rolling[#](#groupby-resample-rolling "Link to this heading") + +* Bug incorrectly raising an `IndexError` when passing a list of quantiles to [`DataFrameGroupBy.quantile()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.quantile.html#pandas.core.groupby.DataFrameGroupBy.quantile "pandas.core.groupby.DataFrameGroupBy.quantile") ([GH 28113](https://github.com/pandas-dev/pandas/issues/28113)). +* Bug in `GroupBy.shift()`, `GroupBy.bfill()` and `GroupBy.ffill()` where timezone information would be dropped ([GH 19995](https://github.com/pandas-dev/pandas/issues/19995), [GH 27992](https://github.com/pandas-dev/pandas/issues/27992)) + +### Other[#](#other "Link to this heading") + +* Compatibility with Python 3.8 in `DataFrame.query()` ([GH 27261](https://github.com/pandas-dev/pandas/issues/27261)) +* Fix to ensure that tab-completion in an IPython console does not raise + warnings for deprecated attributes ([GH 27900](https://github.com/pandas-dev/pandas/issues/27900)). + +## Contributors[#](#contributors "Link to this heading") + +A total of 6 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Felix Divo + +* Jeremy Schendel +* Joris Van den Bossche +* MeeseeksMachine +* Tom Augspurger +* jbrockmendel diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_0.25.3.md b/corpus/changelog/pandas_whatsnew/whatsnew_0.25.3.md new file mode 100644 index 0000000000000000000000000000000000000000..0360eab818f38b3681dfb6f2df92f277f9f38ebb --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_0.25.3.md @@ -0,0 +1,22 @@ +# What's new in pandas 0.25.3 + +Source: https://pandas.pydata.org/docs/whatsnew/v0.25.3.html + +# What’s new in 0.25.3 (October 31, 2019)[#](#what-s-new-in-0-25-3-october-31-2019 "Link to this heading") + +These are the changes in pandas 0.25.3. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Bug fixes[#](#bug-fixes "Link to this heading") + +### GroupBy/resample/rolling[#](#groupby-resample-rolling "Link to this heading") + +* Bug in `DataFrameGroupBy.quantile()` where NA values in the grouping could cause segfaults or incorrect results ([GH 28882](https://github.com/pandas-dev/pandas/issues/28882)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 2 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Will Ayd +* William Ayd diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.0.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.0.0.md new file mode 100644 index 0000000000000000000000000000000000000000..7f055b77a9963684f1df76faa9dfea5df5f8d592 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.0.0.md @@ -0,0 +1,1631 @@ +# What's new in pandas 1.0.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.0.0.html + +# What’s new in 1.0.0 (January 29, 2020)[#](#what-s-new-in-1-0-0-january-29-2020 "Link to this heading") + +These are the changes in pandas 1.0.0. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +Note + +The pandas 1.0 release removed a lot of functionality that was deprecated +in previous releases (see [below](#whatsnew-100-prior-deprecations) +for an overview). It is recommended to first upgrade to pandas 0.25 and to +ensure your code is working without warnings, before upgrading to pandas +1.0. + +## New deprecation policy[#](#new-deprecation-policy "Link to this heading") + +Starting with pandas 1.0.0, pandas will adopt a variant of [SemVer](https://semver.org) to +version releases. Briefly, + +* Deprecations will be introduced in minor releases (e.g. 1.1.0, 1.2.0, 2.1.0, …) +* Deprecations will be enforced in major releases (e.g. 1.0.0, 2.0.0, 3.0.0, …) +* API-breaking changes will be made only in major releases (except for experimental features) + +See [Version policy](../development/policies.html#policies-version) for more. + +## Enhancements[#](#enhancements "Link to this heading") + +### Using Numba in `rolling.apply` and `expanding.apply`[#](#using-numba-in-rolling-apply-and-expanding-apply "Link to this heading") + +We’ve added an `engine` keyword to [`apply()`](../reference/api/pandas.core.window.rolling.Rolling.apply.html#pandas.core.window.rolling.Rolling.apply "pandas.core.window.rolling.Rolling.apply") and [`apply()`](../reference/api/pandas.core.window.expanding.Expanding.apply.html#pandas.core.window.expanding.Expanding.apply "pandas.core.window.expanding.Expanding.apply") +that allows the user to execute the routine using [Numba](https://numba.pydata.org/) instead of Cython. +Using the Numba engine can yield significant performance gains if the apply function can operate on numpy arrays and +the data set is larger (1 million rows or greater). For more details, see +[rolling apply documentation](../user_guide/window.html#window-numba-engine) ([GH 28987](https://github.com/pandas-dev/pandas/issues/28987), [GH 30936](https://github.com/pandas-dev/pandas/issues/30936)) + +### Defining custom windows for rolling operations[#](#defining-custom-windows-for-rolling-operations "Link to this heading") + +We’ve added a [`pandas.api.indexers.BaseIndexer()`](../reference/api/pandas.api.indexers.BaseIndexer.html#pandas.api.indexers.BaseIndexer "pandas.api.indexers.BaseIndexer") class that allows users to define how +window bounds are created during `rolling` operations. Users can define their own `get_window_bounds` +method on a [`pandas.api.indexers.BaseIndexer()`](../reference/api/pandas.api.indexers.BaseIndexer.html#pandas.api.indexers.BaseIndexer "pandas.api.indexers.BaseIndexer") subclass that will generate the start and end +indices used for each window during the rolling aggregation. For more details and example usage, see +the [custom window rolling documentation](../user_guide/window.html#window-custom-rolling-window) + +### Converting to markdown[#](#converting-to-markdown "Link to this heading") + +We’ve added [`to_markdown()`](../reference/api/pandas.DataFrame.to_markdown.html#pandas.DataFrame.to_markdown "pandas.DataFrame.to_markdown") for creating a markdown table ([GH 11052](https://github.com/pandas-dev/pandas/issues/11052)) + +```None +In [1]: df = pd.DataFrame({"A": [1, 2, 3], "B": [1, 2, 3]}, index=['a', 'a', 'b']) + +In [2]: print(df.to_markdown()) +| | A | B | +|:---|----:|----:| +| a | 1 | 1 | +| a | 2 | 2 | +| b | 3 | 3 | +``` + +## Experimental new features[#](#experimental-new-features "Link to this heading") + +### Experimental `NA` scalar to denote missing values[#](#experimental-na-scalar-to-denote-missing-values "Link to this heading") + +A new `pd.NA` value (singleton) is introduced to represent scalar missing +values. Up to now, pandas used several values to represent missing data: `np.nan` is used for this for float data, `np.nan` or +`None` for object-dtype data and `pd.NaT` for datetime-like data. The +goal of `pd.NA` is to provide a “missing” indicator that can be used +consistently across data types. `pd.NA` is currently used by the nullable integer and boolean +data types and the new string data type ([GH 28095](https://github.com/pandas-dev/pandas/issues/28095)). + +Warning + +Experimental: the behaviour of `pd.NA` can still change without warning. + +For example, creating a Series using the nullable integer dtype: + +```None +In [3]: s = pd.Series([1, 2, None], dtype="Int64") + +In [4]: s +Out[4]: +0 1 +1 2 +2 +Length: 3, dtype: Int64 + +In [5]: s[2] +Out[5]: +``` + +Compared to `np.nan`, `pd.NA` behaves differently in certain operations. +In addition to arithmetic operations, `pd.NA` also propagates as “missing” +or “unknown” in comparison operations: + +```None +In [6]: np.nan > 1 +Out[6]: False + +In [7]: pd.NA > 1 +Out[7]: +``` + +For logical operations, `pd.NA` follows the rules of the +[three-valued logic](https://en.wikipedia.org/wiki/Three-valued_logic) (or +*Kleene logic*). For example: + +```None +In [8]: pd.NA | True +Out[8]: True +``` + +For more, see [NA section](../user_guide/missing_data.html#missing-data-na) in the user guide on missing +data. + +### Dedicated string data type[#](#dedicated-string-data-type "Link to this heading") + +We’ve added [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype"), an extension type dedicated to string data. +Previously, strings were typically stored in object-dtype NumPy arrays. ([GH 29975](https://github.com/pandas-dev/pandas/issues/29975)) + +Warning + +`StringDtype` is currently considered experimental. The implementation +and parts of the API may change without warning. + +The `'string'` extension type solves several issues with object-dtype NumPy arrays: + +1. You can accidentally store a *mixture* of strings and non-strings in an + `object` dtype array. A `StringArray` can only store strings. +2. `object` dtype breaks dtype-specific operations like [`DataFrame.select_dtypes()`](../reference/api/pandas.DataFrame.select_dtypes.html#pandas.DataFrame.select_dtypes "pandas.DataFrame.select_dtypes"). + There isn’t a clear way to select *just* text while excluding non-text, + but still object-dtype columns. +3. When reading code, the contents of an `object` dtype array is less clear + than `string`. + +```None +In [9]: pd.Series(['abc', None, 'def'], dtype=pd.StringDtype()) +Out[9]: +0 abc +1 +2 def +Length: 3, dtype: string +``` + +You can use the alias `"string"` as well. + +```None +In [10]: s = pd.Series(['abc', None, 'def'], dtype="string") + +In [11]: s +Out[11]: +0 abc +1 +2 def +Length: 3, dtype: string +``` + +The usual string accessor methods work. Where appropriate, the return type +of the Series or columns of a DataFrame will also have string dtype. + +```None +In [12]: s.str.upper() +Out[12]: +0 ABC +1 +2 DEF +Length: 3, dtype: string + +In [13]: s.str.split('b', expand=True).dtypes +Out[13]: +0 string[python] +1 string[python] +Length: 2, dtype: object +``` + +String accessor methods returning integers will return a value with [`Int64Dtype`](../reference/api/pandas.Int64Dtype.html#pandas.Int64Dtype "pandas.Int64Dtype") + +```None +In [14]: s.str.count("a") +Out[14]: +0 1 +1 +2 0 +Length: 3, dtype: Int64 +``` + +We recommend explicitly using the `string` data type when working with strings. +See [Text data types](../user_guide/text.html#text-types) for more. + +### Boolean data type with missing values support[#](#boolean-data-type-with-missing-values-support "Link to this heading") + +We’ve added [`BooleanDtype`](../reference/api/pandas.BooleanDtype.html#pandas.BooleanDtype "pandas.BooleanDtype") / [`BooleanArray`](../reference/api/pandas.arrays.BooleanArray.html#pandas.arrays.BooleanArray "pandas.arrays.BooleanArray"), an extension +type dedicated to boolean data that can hold missing values. The default +`bool` data type based on a bool-dtype NumPy array, the column can only hold +`True` or `False`, and not missing values. This new [`BooleanArray`](../reference/api/pandas.arrays.BooleanArray.html#pandas.arrays.BooleanArray "pandas.arrays.BooleanArray") +can store missing values as well by keeping track of this in a separate mask. +([GH 29555](https://github.com/pandas-dev/pandas/issues/29555), [GH 30095](https://github.com/pandas-dev/pandas/issues/30095), [GH 31131](https://github.com/pandas-dev/pandas/issues/31131)) + +```None +In [15]: pd.Series([True, False, None], dtype=pd.BooleanDtype()) +Out[15]: +0 True +1 False +2 +Length: 3, dtype: boolean +``` + +You can use the alias `"boolean"` as well. + +```None +In [16]: s = pd.Series([True, False, None], dtype="boolean") + +In [17]: s +Out[17]: +0 True +1 False +2 +Length: 3, dtype: boolean +``` + +### Method `convert_dtypes` to ease use of supported extension dtypes[#](#method-convert-dtypes-to-ease-use-of-supported-extension-dtypes "Link to this heading") + +In order to encourage use of the extension dtypes `StringDtype`, +`BooleanDtype`, `Int64Dtype`, `Int32Dtype`, etc., that support `pd.NA`, the +methods [`DataFrame.convert_dtypes()`](../reference/api/pandas.DataFrame.convert_dtypes.html#pandas.DataFrame.convert_dtypes "pandas.DataFrame.convert_dtypes") and [`Series.convert_dtypes()`](../reference/api/pandas.Series.convert_dtypes.html#pandas.Series.convert_dtypes "pandas.Series.convert_dtypes") +have been introduced. ([GH 29752](https://github.com/pandas-dev/pandas/issues/29752)) ([GH 30929](https://github.com/pandas-dev/pandas/issues/30929)) + +Example: + +```None +In [18]: df = pd.DataFrame({'x': ['abc', None, 'def'], + ....: 'y': [1, 2, np.nan], + ....: 'z': [True, False, True]}) + ....: + +In [19]: df +Out[19]: + x y z +0 abc 1.0 True +1 None 2.0 False +2 def NaN True + +[3 rows x 3 columns] + +In [20]: df.dtypes +Out[20]: +x object +y float64 +z bool +Length: 3, dtype: object +``` + +```None +In [21]: converted = df.convert_dtypes() + +In [22]: converted +Out[22]: + x y z +0 abc 1 True +1 2 False +2 def True + +[3 rows x 3 columns] + +In [23]: converted.dtypes +Out[23]: +x string[python] +y Int64 +z boolean +Length: 3, dtype: object +``` + +This is especially useful after reading in data using readers such as [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") +and [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel"). +See [here](../user_guide/missing_data.html#missing-data-na-conversion) for a description. + +## Other enhancements[#](#other-enhancements "Link to this heading") + +* [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string") added the `max_colwidth` parameter to control when wide columns are truncated ([GH 9784](https://github.com/pandas-dev/pandas/issues/9784)) +* Added the `na_value` argument to [`Series.to_numpy()`](../reference/api/pandas.Series.to_numpy.html#pandas.Series.to_numpy "pandas.Series.to_numpy"), `Index.to_numpy()` and [`DataFrame.to_numpy()`](../reference/api/pandas.DataFrame.to_numpy.html#pandas.DataFrame.to_numpy "pandas.DataFrame.to_numpy") to control the value used for missing data ([GH 30322](https://github.com/pandas-dev/pandas/issues/30322)) +* [`MultiIndex.from_product()`](../reference/api/pandas.MultiIndex.from_product.html#pandas.MultiIndex.from_product "pandas.MultiIndex.from_product") infers level names from inputs if not explicitly provided ([GH 27292](https://github.com/pandas-dev/pandas/issues/27292)) +* [`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex") now accepts `caption` and `label` arguments ([GH 25436](https://github.com/pandas-dev/pandas/issues/25436)) +* DataFrames with [nullable integer](../user_guide/integer_na.html#integer-na), the [new string dtype](../user_guide/text.html#text-types) + and period data type can now be converted to `pyarrow` (>=0.15.0), which means that it is + supported in writing to the Parquet file format when using the `pyarrow` engine ([GH 28368](https://github.com/pandas-dev/pandas/issues/28368)). + Full roundtrip to parquet (writing and reading back in with [`to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") / [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet")) + is supported starting with pyarrow >= 0.16 ([GH 20612](https://github.com/pandas-dev/pandas/issues/20612)). +* `to_parquet()` now appropriately handles the `schema` argument for user defined schemas in the pyarrow engine. ([GH 30270](https://github.com/pandas-dev/pandas/issues/30270)) +* [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") now accepts an `indent` integer argument to enable pretty printing of JSON output ([GH 12004](https://github.com/pandas-dev/pandas/issues/12004)) +* [`read_stata()`](../reference/api/pandas.read_stata.html#pandas.read_stata "pandas.read_stata") can read Stata 119 dta files. ([GH 28250](https://github.com/pandas-dev/pandas/issues/28250)) +* Implemented [`Window.var()`](../reference/api/pandas.core.window.rolling.Window.var.html#pandas.core.window.rolling.Window.var "pandas.core.window.rolling.Window.var") and [`Window.std()`](../reference/api/pandas.core.window.rolling.Window.std.html#pandas.core.window.rolling.Window.std "pandas.core.window.rolling.Window.std") functions ([GH 26597](https://github.com/pandas-dev/pandas/issues/26597)) +* Added `encoding` argument to [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string") for non-ascii text ([GH 28766](https://github.com/pandas-dev/pandas/issues/28766)) +* Added `encoding` argument to [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") for non-ascii text ([GH 28663](https://github.com/pandas-dev/pandas/issues/28663)) +* `Styler.background_gradient()` now accepts `vmin` and `vmax` arguments ([GH 12145](https://github.com/pandas-dev/pandas/issues/12145)) +* `Styler.format()` added the `na_rep` parameter to help format the missing values ([GH 21527](https://github.com/pandas-dev/pandas/issues/21527), [GH 28358](https://github.com/pandas-dev/pandas/issues/28358)) +* [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") now can read binary Excel (`.xlsb`) files by passing `engine='pyxlsb'`. For more details and example usage, see the [Binary Excel files documentation](../user_guide/io.html#io-xlsb). Closes [GH 8540](https://github.com/pandas-dev/pandas/issues/8540). +* The `partition_cols` argument in [`DataFrame.to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") now accepts a string ([GH 27117](https://github.com/pandas-dev/pandas/issues/27117)) +* [`pandas.read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") now parses `NaN`, `Infinity` and `-Infinity` ([GH 12213](https://github.com/pandas-dev/pandas/issues/12213)) +* DataFrame constructor preserve `ExtensionArray` dtype with `ExtensionArray` ([GH 11363](https://github.com/pandas-dev/pandas/issues/11363)) +* [`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values") and [`Series.sort_values()`](../reference/api/pandas.Series.sort_values.html#pandas.Series.sort_values "pandas.Series.sort_values") have gained `ignore_index` keyword to be able to reset index after sorting ([GH 30114](https://github.com/pandas-dev/pandas/issues/30114)) +* [`DataFrame.sort_index()`](../reference/api/pandas.DataFrame.sort_index.html#pandas.DataFrame.sort_index "pandas.DataFrame.sort_index") and [`Series.sort_index()`](../reference/api/pandas.Series.sort_index.html#pandas.Series.sort_index "pandas.Series.sort_index") have gained `ignore_index` keyword to reset index ([GH 30114](https://github.com/pandas-dev/pandas/issues/30114)) +* [`DataFrame.drop_duplicates()`](../reference/api/pandas.DataFrame.drop_duplicates.html#pandas.DataFrame.drop_duplicates "pandas.DataFrame.drop_duplicates") has gained `ignore_index` keyword to reset index ([GH 30114](https://github.com/pandas-dev/pandas/issues/30114)) +* Added new writer for exporting Stata dta files in versions 118 and 119, `StataWriterUTF8`. These files formats support exporting strings containing Unicode characters. Format 119 supports data sets with more than 32,767 variables ([GH 23573](https://github.com/pandas-dev/pandas/issues/23573), [GH 30959](https://github.com/pandas-dev/pandas/issues/30959)) +* [`Series.map()`](../reference/api/pandas.Series.map.html#pandas.Series.map "pandas.Series.map") now accepts `collections.abc.Mapping` subclasses as a mapper ([GH 29733](https://github.com/pandas-dev/pandas/issues/29733)) +* Added an experimental [`attrs`](../reference/api/pandas.DataFrame.attrs.html#pandas.DataFrame.attrs "pandas.DataFrame.attrs") for storing global metadata about a dataset ([GH 29062](https://github.com/pandas-dev/pandas/issues/29062)) +* `Timestamp.fromisocalendar()` is now compatible with python 3.8 and above ([GH 28115](https://github.com/pandas-dev/pandas/issues/28115)) +* [`DataFrame.to_pickle()`](../reference/api/pandas.DataFrame.to_pickle.html#pandas.DataFrame.to_pickle "pandas.DataFrame.to_pickle") and [`read_pickle()`](../reference/api/pandas.read_pickle.html#pandas.read_pickle "pandas.read_pickle") now accept URL ([GH 30163](https://github.com/pandas-dev/pandas/issues/30163)) + +## Backwards incompatible API changes[#](#backwards-incompatible-api-changes "Link to this heading") + +### Avoid using names from `MultiIndex.levels`[#](#avoid-using-names-from-multiindex-levels "Link to this heading") + +As part of a larger refactor to [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") the level names are now +stored separately from the levels ([GH 27242](https://github.com/pandas-dev/pandas/issues/27242)). We recommend using +[`MultiIndex.names`](../reference/api/pandas.MultiIndex.names.html#pandas.MultiIndex.names "pandas.MultiIndex.names") to access the names, and [`Index.set_names()`](../reference/api/pandas.Index.set_names.html#pandas.Index.set_names "pandas.Index.set_names") +to update the names. + +For backwards compatibility, you can still *access* the names via the levels. + +```None +In [24]: mi = pd.MultiIndex.from_product([[1, 2], ['a', 'b']], names=['x', 'y']) + +In [25]: mi.levels[0].name +Out[25]: 'x' +``` + +However, it is no longer possible to *update* the names of the `MultiIndex` +via the level. + +```None +In [26]: mi.levels[0].name = "new name" +--------------------------------------------------------------------------- +RuntimeError Traceback (most recent call last) +Cell In[26], line 1 +----> 1 mi.levels[0].name = "new name" + +File ~/work/pandas/pandas/pandas/core/indexes/base.py:1697, in Index.name(self, value) + 1693 @name.setter + 1694 def name(self, value: Hashable) -> None: + 1695 if self._no_setting_name: + 1696 # Used in MultiIndex.levels to avoid silently ignoring name updates. +-> 1697 raise RuntimeError( + 1698 "Cannot set name on a level of a MultiIndex. Use " + 1699 "'MultiIndex.set_names' instead." + 1700 ) + 1701 maybe_extract_name(value, None, type(self)) + 1702 self._name = value + +RuntimeError: Cannot set name on a level of a MultiIndex. Use 'MultiIndex.set_names' instead. + +In [27]: mi.names +Out[27]: FrozenList(['x', 'y']) +``` + +To update, use `MultiIndex.set_names`, which returns a new `MultiIndex`. + +```None +In [28]: mi2 = mi.set_names("new name", level=0) + +In [29]: mi2.names +Out[29]: FrozenList(['new name', 'y']) +``` + +### New repr for [`IntervalArray`](../reference/api/pandas.arrays.IntervalArray.html#pandas.arrays.IntervalArray "pandas.arrays.IntervalArray")[#](#new-repr-for-intervalarray "Link to this heading") + +[`pandas.arrays.IntervalArray`](../reference/api/pandas.arrays.IntervalArray.html#pandas.arrays.IntervalArray "pandas.arrays.IntervalArray") adopts a new `__repr__` in accordance with other array classes ([GH 25022](https://github.com/pandas-dev/pandas/issues/25022)) + +*pandas 0.25.x* + +```None +In [1]: pd.arrays.IntervalArray.from_tuples([(0, 1), (2, 3)]) +Out[2]: +IntervalArray([(0, 1], (2, 3]], + closed='right', + dtype='interval[int64]') +``` + +*pandas 1.0.0* + +```None +In [30]: pd.arrays.IntervalArray.from_tuples([(0, 1), (2, 3)]) +Out[30]: + +[(0, 1], (2, 3]] +Length: 2, dtype: interval[int64, right] +``` + +### `DataFrame.rename` now only accepts one positional argument[#](#dataframe-rename-now-only-accepts-one-positional-argument "Link to this heading") + +[`DataFrame.rename()`](../reference/api/pandas.DataFrame.rename.html#pandas.DataFrame.rename "pandas.DataFrame.rename") would previously accept positional arguments that would lead +to ambiguous or undefined behavior. From pandas 1.0, only the very first argument, which +maps labels to their new names along the default axis, is allowed to be passed by position +([GH 29136](https://github.com/pandas-dev/pandas/issues/29136)). + +*pandas 0.25.x* + +```None +In [1]: df = pd.DataFrame([[1]]) +In [2]: df.rename({0: 1}, {0: 2}) +Out[2]: +FutureWarning: ...Use named arguments to resolve ambiguity... + 2 +1 1 +``` + +*pandas 1.0.0* + +```None +In [3]: df.rename({0: 1}, {0: 2}) +Traceback (most recent call last): +... +TypeError: rename() takes from 1 to 2 positional arguments but 3 were given +``` + +Note that errors will now be raised when conflicting or potentially ambiguous arguments are provided. + +*pandas 0.25.x* + +```None +In [4]: df.rename({0: 1}, index={0: 2}) +Out[4]: + 0 +1 1 + +In [5]: df.rename(mapper={0: 1}, index={0: 2}) +Out[5]: + 0 +2 1 +``` + +*pandas 1.0.0* + +```None +In [6]: df.rename({0: 1}, index={0: 2}) +Traceback (most recent call last): +... +TypeError: Cannot specify both 'mapper' and any of 'index' or 'columns' + +In [7]: df.rename(mapper={0: 1}, index={0: 2}) +Traceback (most recent call last): +... +TypeError: Cannot specify both 'mapper' and any of 'index' or 'columns' +``` + +You can still change the axis along which the first positional argument is applied by +supplying the `axis` keyword argument. + +```None +In [31]: df.rename({0: 1}) +Out[31]: + 0 +1 1 + +[1 rows x 1 columns] + +In [32]: df.rename({0: 1}, axis=1) +Out[32]: + 1 +0 1 + +[1 rows x 1 columns] +``` + +If you would like to update both the index and column labels, be sure to use the respective +keywords. + +```None +In [33]: df.rename(index={0: 1}, columns={0: 2}) +Out[33]: + 2 +1 1 + +[1 rows x 1 columns] +``` + +### Extended verbose info output for [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame")[#](#extended-verbose-info-output-for-dataframe "Link to this heading") + +[`DataFrame.info()`](../reference/api/pandas.DataFrame.info.html#pandas.DataFrame.info "pandas.DataFrame.info") now shows line numbers for the columns summary ([GH 17304](https://github.com/pandas-dev/pandas/issues/17304)) + +*pandas 0.25.x* + +```None +In [1]: df = pd.DataFrame({"int_col": [1, 2, 3], +... "text_col": ["a", "b", "c"], +... "float_col": [0.0, 0.1, 0.2]}) +In [2]: df.info(verbose=True) + +RangeIndex: 3 entries, 0 to 2 +Data columns (total 3 columns): +int_col 3 non-null int64 +text_col 3 non-null object +float_col 3 non-null float64 +dtypes: float64(1), int64(1), object(1) +memory usage: 152.0+ bytes +``` + +*pandas 1.0.0* + +```None +In [34]: df = pd.DataFrame({"int_col": [1, 2, 3], + ....: "text_col": ["a", "b", "c"], + ....: "float_col": [0.0, 0.1, 0.2]}) + ....: + +In [35]: df.info(verbose=True) + +RangeIndex: 3 entries, 0 to 2 +Data columns (total 3 columns): + # Column Non-Null Count Dtype +--- ------ -------------- ----- + 0 int_col 3 non-null int64 + 1 text_col 3 non-null object + 2 float_col 3 non-null float64 +dtypes: float64(1), int64(1), object(1) +memory usage: 200.0+ bytes +``` + +### [`pandas.array()`](../reference/api/pandas.array.html#pandas.array "pandas.array") inference changes[#](#pandas-array-inference-changes "Link to this heading") + +[`pandas.array()`](../reference/api/pandas.array.html#pandas.array "pandas.array") now infers pandas’ new extension types in several cases ([GH 29791](https://github.com/pandas-dev/pandas/issues/29791)): + +1. String data (including missing values) now returns a [`arrays.StringArray`](../reference/api/pandas.arrays.StringArray.html#pandas.arrays.StringArray "pandas.arrays.StringArray"). +2. Integer data (including missing values) now returns a [`arrays.IntegerArray`](../reference/api/pandas.arrays.IntegerArray.html#pandas.arrays.IntegerArray "pandas.arrays.IntegerArray"). +3. Boolean data (including missing values) now returns the new [`arrays.BooleanArray`](../reference/api/pandas.arrays.BooleanArray.html#pandas.arrays.BooleanArray "pandas.arrays.BooleanArray") + +*pandas 0.25.x* + +```None +In [1]: pd.array(["a", None]) +Out[1]: + +['a', None] +Length: 2, dtype: object + +In [2]: pd.array([1, None]) +Out[2]: + +[1, None] +Length: 2, dtype: object +``` + +*pandas 1.0.0* + +```None +In [36]: pd.array(["a", None]) +Out[36]: + +['a', ] +Length: 2, dtype: string + +In [37]: pd.array([1, None]) +Out[37]: + +[1, ] +Length: 2, dtype: Int64 +``` + +As a reminder, you can specify the `dtype` to disable all inference. + +### [`arrays.IntegerArray`](../reference/api/pandas.arrays.IntegerArray.html#pandas.arrays.IntegerArray "pandas.arrays.IntegerArray") now uses [`pandas.NA`](../reference/api/pandas.NA.html#pandas.NA "pandas.NA")[#](#arrays-integerarray-now-uses-pandas-na "Link to this heading") + +[`arrays.IntegerArray`](../reference/api/pandas.arrays.IntegerArray.html#pandas.arrays.IntegerArray "pandas.arrays.IntegerArray") now uses [`pandas.NA`](../reference/api/pandas.NA.html#pandas.NA "pandas.NA") rather than +`numpy.nan` as its missing value marker ([GH 29964](https://github.com/pandas-dev/pandas/issues/29964)). + +*pandas 0.25.x* + +```None +In [1]: a = pd.array([1, 2, None], dtype="Int64") +In [2]: a +Out[2]: + +[1, 2, NaN] +Length: 3, dtype: Int64 + +In [3]: a[2] +Out[3]: +nan +``` + +*pandas 1.0.0* + +```None +In [38]: a = pd.array([1, 2, None], dtype="Int64") + +In [39]: a +Out[39]: + +[1, 2, ] +Length: 3, dtype: Int64 + +In [40]: a[2] +Out[40]: +``` + +This has a few API-breaking consequences. + +**Converting to a NumPy ndarray** + +When converting to a NumPy array missing values will be `pd.NA`, which cannot +be converted to a float. So calling `np.asarray(integer_array, dtype="float")` +will now raise. + +*pandas 0.25.x* + +```None +In [1]: np.asarray(a, dtype="float") +Out[1]: +array([ 1., 2., nan]) +``` + +*pandas 1.0.0* + +```None +In [41]: np.asarray(a, dtype="float") +Out[41]: array([ 1., 2., nan]) +``` + +Use `arrays.IntegerArray.to_numpy()` with an explicit `na_value` instead. + +```None +In [42]: a.to_numpy(dtype="float", na_value=np.nan) +Out[42]: array([ 1., 2., nan]) +``` + +**Reductions can return** `pd.NA` + +When performing a reduction such as a sum with `skipna=False`, the result +will now be `pd.NA` instead of `np.nan` in presence of missing values +([GH 30958](https://github.com/pandas-dev/pandas/issues/30958)). + +*pandas 0.25.x* + +```None +In [1]: pd.Series(a).sum(skipna=False) +Out[1]: +nan +``` + +*pandas 1.0.0* + +```None +In [43]: pd.Series(a).sum(skipna=False) +Out[43]: +``` + +**value\_counts returns a nullable integer dtype** + +[`Series.value_counts()`](../reference/api/pandas.Series.value_counts.html#pandas.Series.value_counts "pandas.Series.value_counts") with a nullable integer dtype now returns a nullable +integer dtype for the values. + +*pandas 0.25.x* + +```None +In [1]: pd.Series([2, 1, 1, None], dtype="Int64").value_counts().dtype +Out[1]: +dtype('int64') +``` + +*pandas 1.0.0* + +```None +In [44]: pd.Series([2, 1, 1, None], dtype="Int64").value_counts().dtype +Out[44]: Int64Dtype() +``` + +See [NA semantics](../user_guide/missing_data.html#missing-data-na) for more on the differences between [`pandas.NA`](../reference/api/pandas.NA.html#pandas.NA "pandas.NA") +and `numpy.nan`. + +### [`arrays.IntegerArray`](../reference/api/pandas.arrays.IntegerArray.html#pandas.arrays.IntegerArray "pandas.arrays.IntegerArray") comparisons return [`arrays.BooleanArray`](../reference/api/pandas.arrays.BooleanArray.html#pandas.arrays.BooleanArray "pandas.arrays.BooleanArray")[#](#arrays-integerarray-comparisons-return-arrays-booleanarray "Link to this heading") + +Comparison operations on a [`arrays.IntegerArray`](../reference/api/pandas.arrays.IntegerArray.html#pandas.arrays.IntegerArray "pandas.arrays.IntegerArray") now returns a +[`arrays.BooleanArray`](../reference/api/pandas.arrays.BooleanArray.html#pandas.arrays.BooleanArray "pandas.arrays.BooleanArray") rather than a NumPy array ([GH 29964](https://github.com/pandas-dev/pandas/issues/29964)). + +*pandas 0.25.x* + +```None +In [1]: a = pd.array([1, 2, None], dtype="Int64") +In [2]: a +Out[2]: + +[1, 2, NaN] +Length: 3, dtype: Int64 + +In [3]: a > 1 +Out[3]: +array([False, True, False]) +``` + +*pandas 1.0.0* + +```None +In [45]: a = pd.array([1, 2, None], dtype="Int64") + +In [46]: a > 1 +Out[46]: + +[False, True, ] +Length: 3, dtype: boolean +``` + +Note that missing values now propagate, rather than always comparing unequal +like `numpy.nan`. See [NA semantics](../user_guide/missing_data.html#missing-data-na) for more. + +### By default `Categorical.min()` now returns the minimum instead of np.nan[#](#by-default-categorical-min-now-returns-the-minimum-instead-of-np-nan "Link to this heading") + +When [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") contains `np.nan`, +`Categorical.min()` no longer return `np.nan` by default (skipna=True) ([GH 25303](https://github.com/pandas-dev/pandas/issues/25303)) + +*pandas 0.25.x* + +```None +In [1]: pd.Categorical([1, 2, np.nan], ordered=True).min() +Out[1]: nan +``` + +*pandas 1.0.0* + +```None +In [47]: pd.Categorical([1, 2, np.nan], ordered=True).min() +Out[47]: 1 +``` + +### Default dtype of empty [`pandas.Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series")[#](#default-dtype-of-empty-pandas-series "Link to this heading") + +Initialising an empty [`pandas.Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") without specifying a dtype will raise a `DeprecationWarning` now +([GH 17261](https://github.com/pandas-dev/pandas/issues/17261)). The default dtype will change from `float64` to `object` in future releases so that it is +consistent with the behaviour of [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"). + +*pandas 1.0.0* + +```None +In [1]: pd.Series() +Out[2]: +DeprecationWarning: The default dtype for empty Series will be 'object' instead of 'float64' in a future version. Specify a dtype explicitly to silence this warning. +Series([], dtype: float64) +``` + +### Result dtype inference changes for resample operations[#](#result-dtype-inference-changes-for-resample-operations "Link to this heading") + +The rules for the result dtype in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") aggregations have changed for extension types ([GH 31359](https://github.com/pandas-dev/pandas/issues/31359)). +Previously, pandas would attempt to convert the result back to the original dtype, falling back to the usual +inference rules if that was not possible. Now, pandas will only return a result of the original dtype if the +scalar values in the result are instances of the extension dtype’s scalar type. + +```None +In [48]: df = pd.DataFrame({"A": ['a', 'b']}, dtype='category', + ....: index=pd.date_range('2000', periods=2)) + ....: + +In [49]: df +Out[49]: + A +2000-01-01 a +2000-01-02 b + +[2 rows x 1 columns] +``` + +*pandas 0.25.x* + +```None +In [1]> df.resample("2D").agg(lambda x: 'a').A.dtype +Out[1]: +CategoricalDtype(categories=['a', 'b'], ordered=False) +``` + +*pandas 1.0.0* + +```None +In [50]: df.resample("2D").agg(lambda x: 'a').A.dtype +Out[50]: CategoricalDtype(categories=['a', 'b'], ordered=False, categories_dtype=object) +``` + +This fixes an inconsistency between `resample` and `groupby`. +This also fixes a potential bug, where the **values** of the result might change +depending on how the results are cast back to the original dtype. + +*pandas 0.25.x* + +```None +In [1] df.resample("2D").agg(lambda x: 'c') +Out[1]: + + A +0 NaN +``` + +*pandas 1.0.0* + +```None +In [51]: df.resample("2D").agg(lambda x: 'c') +Out[51]: + A +2000-01-01 c + +[1 rows x 1 columns] +``` + +### Increased minimum version for Python[#](#increased-minimum-version-for-python "Link to this heading") + +pandas 1.0.0 supports Python 3.6.1 and higher ([GH 29212](https://github.com/pandas-dev/pandas/issues/29212)). + +### Increased minimum versions for dependencies[#](#increased-minimum-versions-for-dependencies "Link to this heading") + +Some minimum supported versions of dependencies were updated ([GH 29766](https://github.com/pandas-dev/pandas/issues/29766), [GH 29723](https://github.com/pandas-dev/pandas/issues/29723)). +If installed, we now require: + +| Package | Minimum Version | Required | Changed | +| --- | --- | --- | --- | +| numpy | 1.13.3 | X | | +| pytz | 2015.4 | X | | +| python-dateutil | 2.6.1 | X | | +| bottleneck | 1.2.1 | | | +| numexpr | 2.6.2 | | | +| pytest (dev) | 4.0.2 | | | + +For [optional libraries](https://pandas.pydata.org/docs/getting_started/install.html) the general recommendation is to use the latest version. +The following table lists the lowest version per library that is currently being tested throughout the development of pandas. +Optional libraries below the lowest tested version may still work, but are not considered supported. + +| Package | Minimum Version | Changed | +| --- | --- | --- | +| beautifulsoup4 | 4.6.0 | | +| fastparquet | 0.3.2 | X | +| gcsfs | 0.2.2 | | +| lxml | 3.8.0 | | +| matplotlib | 2.2.2 | | +| numba | 0.46.0 | X | +| openpyxl | 2.5.7 | X | +| pyarrow | 0.13.0 | X | +| pymysql | 0.7.1 | | +| pytables | 3.4.2 | | +| s3fs | 0.3.0 | X | +| scipy | 0.19.0 | | +| sqlalchemy | 1.1.4 | | +| xarray | 0.8.2 | | +| xlrd | 1.1.0 | | +| xlsxwriter | 0.9.8 | | +| xlwt | 1.2.0 | | + +See [Dependencies](../getting_started/install.html#install-dependencies) and [Optional dependencies](../getting_started/install.html#install-optional-dependencies) for more. + +### Build changes[#](#build-changes "Link to this heading") + +pandas has added a [pyproject.toml](https://www.python.org/dev/peps/pep-0517/) file and will no longer include +cythonized files in the source distribution uploaded to PyPI ([GH 28341](https://github.com/pandas-dev/pandas/issues/28341), [GH 20775](https://github.com/pandas-dev/pandas/issues/20775)). If you’re installing +a built distribution (wheel) or via conda, this shouldn’t have any effect on you. If you’re building pandas from +source, you should no longer need to install Cython into your build environment before calling `pip install pandas`. + +### Other API changes[#](#other-api-changes "Link to this heading") + +* [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") and [`SeriesGroupBy.transform()`](../reference/api/pandas.core.groupby.SeriesGroupBy.transform.html#pandas.core.groupby.SeriesGroupBy.transform "pandas.core.groupby.SeriesGroupBy.transform") now raises on invalid operation names ([GH 27489](https://github.com/pandas-dev/pandas/issues/27489)) +* [`pandas.api.types.infer_dtype()`](../reference/api/pandas.api.types.infer_dtype.html#pandas.api.types.infer_dtype "pandas.api.types.infer_dtype") will now return “integer-na” for integer and `np.nan` mix ([GH 27283](https://github.com/pandas-dev/pandas/issues/27283)) +* [`MultiIndex.from_arrays()`](../reference/api/pandas.MultiIndex.from_arrays.html#pandas.MultiIndex.from_arrays "pandas.MultiIndex.from_arrays") will no longer infer names from arrays if `names=None` is explicitly provided ([GH 27292](https://github.com/pandas-dev/pandas/issues/27292)) +* In order to improve tab-completion, pandas does not include most deprecated attributes when introspecting a pandas object using `dir` (e.g. `dir(df)`). + To see which attributes are excluded, see an object’s `_deprecations` attribute, for example `pd.DataFrame._deprecations` ([GH 28805](https://github.com/pandas-dev/pandas/issues/28805)). +* The returned dtype of [`unique()`](../reference/api/pandas.unique.html#pandas.unique "pandas.unique") now matches the input dtype. ([GH 27874](https://github.com/pandas-dev/pandas/issues/27874)) +* Changed the default configuration value for `options.matplotlib.register_converters` from `True` to `"auto"` ([GH 18720](https://github.com/pandas-dev/pandas/issues/18720)). + Now, pandas custom formatters will only be applied to plots created by pandas, through [`plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot"). + Previously, pandas’ formatters would be applied to all plots created *after* a [`plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot"). + See [units registration](#whatsnew-100-matplotlib-units) for more. +* [`Series.dropna()`](../reference/api/pandas.Series.dropna.html#pandas.Series.dropna "pandas.Series.dropna") has dropped its `**kwargs` argument in favor of a single `how` parameter. + Supplying anything else than `how` to `**kwargs` raised a `TypeError` previously ([GH 29388](https://github.com/pandas-dev/pandas/issues/29388)) +* When testing pandas, the new minimum required version of pytest is 5.0.1 ([GH 29664](https://github.com/pandas-dev/pandas/issues/29664)) +* `Series.str.__iter__()` was deprecated and will be removed in future releases ([GH 28277](https://github.com/pandas-dev/pandas/issues/28277)). +* Added `` to the list of default NA values for [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") ([GH 30821](https://github.com/pandas-dev/pandas/issues/30821)) + +### Documentation improvements[#](#documentation-improvements "Link to this heading") + +* Added new section on [Scaling to large datasets](../user_guide/scale.html#scale) ([GH 28315](https://github.com/pandas-dev/pandas/issues/28315)). +* Added sub-section on [Query MultiIndex](../user_guide/io.html#io-query-multi) for HDF5 datasets ([GH 28791](https://github.com/pandas-dev/pandas/issues/28791)). + +## Deprecations[#](#deprecations "Link to this heading") + +* [`Series.item()`](../reference/api/pandas.Series.item.html#pandas.Series.item "pandas.Series.item") and [`Index.item()`](../reference/api/pandas.Index.item.html#pandas.Index.item "pandas.Index.item") have been \_undeprecated\_ ([GH 29250](https://github.com/pandas-dev/pandas/issues/29250)) +* `Index.set_value` has been deprecated. For a given index `idx`, array `arr`, + value in `idx` of `idx_val` and a new value of `val`, `idx.set_value(arr, idx_val, val)` + is equivalent to `arr[idx.get_loc(idx_val)] = val`, which should be used instead ([GH 28621](https://github.com/pandas-dev/pandas/issues/28621)). +* `is_extension_type()` is deprecated, `is_extension_array_dtype()` should be used instead ([GH 29457](https://github.com/pandas-dev/pandas/issues/29457)) +* [`eval()`](../reference/api/pandas.eval.html#pandas.eval "pandas.eval") keyword argument “truediv” is deprecated and will be removed in a future version ([GH 29812](https://github.com/pandas-dev/pandas/issues/29812)) +* `DateOffset.isAnchored()` and `DatetOffset.onOffset()` are deprecated and will be removed in a future version, use `DateOffset.is_anchored()` and `DateOffset.is_on_offset()` instead ([GH 30340](https://github.com/pandas-dev/pandas/issues/30340)) +* `pandas.tseries.frequencies.get_offset` is deprecated and will be removed in a future version, use `pandas.tseries.frequencies.to_offset` instead ([GH 4205](https://github.com/pandas-dev/pandas/issues/4205)) +* `Categorical.take_nd()` and `CategoricalIndex.take_nd()` are deprecated, use `Categorical.take()` and `CategoricalIndex.take()` instead ([GH 27745](https://github.com/pandas-dev/pandas/issues/27745)) +* The parameter `numeric_only` of `Categorical.min()` and `Categorical.max()` is deprecated and replaced with `skipna` ([GH 25303](https://github.com/pandas-dev/pandas/issues/25303)) +* The parameter `label` in [`lreshape()`](../reference/api/pandas.lreshape.html#pandas.lreshape "pandas.lreshape") has been deprecated and will be removed in a future version ([GH 29742](https://github.com/pandas-dev/pandas/issues/29742)) +* `pandas.core.index` has been deprecated and will be removed in a future version, the public classes are available in the top-level namespace ([GH 19711](https://github.com/pandas-dev/pandas/issues/19711)) +* [`pandas.json_normalize()`](../reference/api/pandas.json_normalize.html#pandas.json_normalize "pandas.json_normalize") is now exposed in the top-level namespace. + Usage of `json_normalize` as `pandas.io.json.json_normalize` is now deprecated and + it is recommended to use `json_normalize` as [`pandas.json_normalize()`](../reference/api/pandas.json_normalize.html#pandas.json_normalize "pandas.json_normalize") instead ([GH 27586](https://github.com/pandas-dev/pandas/issues/27586)). +* The `numpy` argument of [`pandas.read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") is deprecated ([GH 28512](https://github.com/pandas-dev/pandas/issues/28512)). +* [`DataFrame.to_stata()`](../reference/api/pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata"), [`DataFrame.to_feather()`](../reference/api/pandas.DataFrame.to_feather.html#pandas.DataFrame.to_feather "pandas.DataFrame.to_feather"), and [`DataFrame.to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") argument “fname” is deprecated, use “path” instead ([GH 23574](https://github.com/pandas-dev/pandas/issues/23574)) +* The deprecated internal attributes `_start`, `_stop` and `_step` of [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") now raise a `FutureWarning` instead of a `DeprecationWarning` ([GH 26581](https://github.com/pandas-dev/pandas/issues/26581)) +* The `pandas.util.testing` module has been deprecated. Use the public API in `pandas.testing` documented at [Assertion functions](../reference/testing.html#api-general-testing) ([GH 16232](https://github.com/pandas-dev/pandas/issues/16232)). +* `pandas.SparseArray` has been deprecated. Use `pandas.arrays.SparseArray` ([`arrays.SparseArray`](../reference/api/pandas.arrays.SparseArray.html#pandas.arrays.SparseArray "pandas.arrays.SparseArray")) instead. ([GH 30642](https://github.com/pandas-dev/pandas/issues/30642)) +* The parameter `is_copy` of [`Series.take()`](../reference/api/pandas.Series.take.html#pandas.Series.take "pandas.Series.take") and [`DataFrame.take()`](../reference/api/pandas.DataFrame.take.html#pandas.DataFrame.take "pandas.DataFrame.take") has been deprecated and will be removed in a future version. ([GH 27357](https://github.com/pandas-dev/pandas/issues/27357)) +* Support for multi-dimensional indexing (e.g. `index[:, None]`) on a [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") is deprecated and will be removed in a future version, convert to a numpy array before indexing instead ([GH 30588](https://github.com/pandas-dev/pandas/issues/30588)) +* The `pandas.np` submodule is now deprecated. Import numpy directly instead ([GH 30296](https://github.com/pandas-dev/pandas/issues/30296)) +* The `pandas.datetime` class is now deprecated. Import from `datetime` instead ([GH 30610](https://github.com/pandas-dev/pandas/issues/30610)) +* [`diff`](../reference/api/pandas.DataFrame.diff.html#pandas.DataFrame.diff "pandas.DataFrame.diff") will raise a `TypeError` rather than implicitly losing the dtype of extension types in the future. Convert to the correct dtype before calling `diff` instead ([GH 31025](https://github.com/pandas-dev/pandas/issues/31025)) + +**Selecting Columns from a Grouped DataFrame** + +When selecting columns from a `DataFrameGroupBy` object, passing individual keys (or a tuple of keys) inside single brackets is deprecated, +a list of items should be used instead. ([GH 23566](https://github.com/pandas-dev/pandas/issues/23566)) For example: + +```None +df = pd.DataFrame({ + "A": ["foo", "bar", "foo", "bar", "foo", "bar", "foo", "foo"], + "B": np.random.randn(8), + "C": np.random.randn(8), +}) +g = df.groupby('A') + +# single key, returns SeriesGroupBy +g['B'] + +# tuple of single key, returns SeriesGroupBy +g[('B',)] + +# tuple of multiple keys, returns DataFrameGroupBy, raises FutureWarning +g[('B', 'C')] + +# multiple keys passed directly, returns DataFrameGroupBy, raises FutureWarning +# (implicitly converts the passed strings into a single tuple) +g['B', 'C'] + +# proper way, returns DataFrameGroupBy +g[['B', 'C']] +``` + +## Removal of prior version deprecations/changes[#](#removal-of-prior-version-deprecations-changes "Link to this heading") + +**Removed SparseSeries and SparseDataFrame** + +`SparseSeries`, `SparseDataFrame` and the `DataFrame.to_sparse` method +have been removed ([GH 28425](https://github.com/pandas-dev/pandas/issues/28425)). We recommend using a `Series` or +`DataFrame` with sparse values instead. + +**Matplotlib unit registration** + +Previously, pandas would register converters with matplotlib as a side effect of importing pandas ([GH 18720](https://github.com/pandas-dev/pandas/issues/18720)). +This changed the output of plots made via matplotlib plots after pandas was imported, even if you were using +matplotlib directly rather than [`plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot"). + +To use pandas formatters with a matplotlib plot, specify + +```None +In [1]: import pandas as pd +In [2]: pd.options.plotting.matplotlib.register_converters = True +``` + +Note that plots created by [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") and [`Series.plot()`](../reference/api/pandas.Series.plot.html#pandas.Series.plot "pandas.Series.plot") *do* register the converters +automatically. The only behavior change is when plotting a date-like object via `matplotlib.pyplot.plot` +or `matplotlib.Axes.plot`. See [Custom formatters for timeseries plots](../user_guide/visualization.html#plotting-formatters) for more. + +**Other removals** + +* Removed the previously deprecated keyword “index” from [`read_stata()`](../reference/api/pandas.read_stata.html#pandas.read_stata "pandas.read_stata"), `StataReader`, and `StataReader.read()`, use “index\_col” instead ([GH 17328](https://github.com/pandas-dev/pandas/issues/17328)) +* Removed `StataReader.data` method, use `StataReader.read()` instead ([GH 9493](https://github.com/pandas-dev/pandas/issues/9493)) +* Removed `pandas.plotting._matplotlib.tsplot`, use [`Series.plot()`](../reference/api/pandas.Series.plot.html#pandas.Series.plot "pandas.Series.plot") instead ([GH 19980](https://github.com/pandas-dev/pandas/issues/19980)) +* `pandas.tseries.converter.register` has been moved to [`pandas.plotting.register_matplotlib_converters()`](../reference/api/pandas.plotting.register_matplotlib_converters.html#pandas.plotting.register_matplotlib_converters "pandas.plotting.register_matplotlib_converters") ([GH 18307](https://github.com/pandas-dev/pandas/issues/18307)) +* [`Series.plot()`](../reference/api/pandas.Series.plot.html#pandas.Series.plot "pandas.Series.plot") no longer accepts positional arguments, pass keyword arguments instead ([GH 30003](https://github.com/pandas-dev/pandas/issues/30003)) +* [`DataFrame.hist()`](../reference/api/pandas.DataFrame.hist.html#pandas.DataFrame.hist "pandas.DataFrame.hist") and [`Series.hist()`](../reference/api/pandas.Series.hist.html#pandas.Series.hist "pandas.Series.hist") no longer allows `figsize="default"`, specify figure size by passinig a tuple instead ([GH 30003](https://github.com/pandas-dev/pandas/issues/30003)) +* Floordiv of integer-dtyped array by [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") now raises `TypeError` ([GH 21036](https://github.com/pandas-dev/pandas/issues/21036)) +* [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") and [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") no longer accept non-nanosecond dtype strings like “timedelta64” or “datetime64”, use “timedelta64[ns]” and “datetime64[ns]” instead ([GH 24806](https://github.com/pandas-dev/pandas/issues/24806)) +* Changed the default “skipna” argument in [`pandas.api.types.infer_dtype()`](../reference/api/pandas.api.types.infer_dtype.html#pandas.api.types.infer_dtype "pandas.api.types.infer_dtype") from `False` to `True` ([GH 24050](https://github.com/pandas-dev/pandas/issues/24050)) +* Removed `Series.ix` and `DataFrame.ix` ([GH 26438](https://github.com/pandas-dev/pandas/issues/26438)) +* Removed `Index.summary` ([GH 18217](https://github.com/pandas-dev/pandas/issues/18217)) +* Removed the previously deprecated keyword “fastpath” from the [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") constructor ([GH 23110](https://github.com/pandas-dev/pandas/issues/23110)) +* Removed `Series.get_value`, `Series.set_value`, `DataFrame.get_value`, `DataFrame.set_value` ([GH 17739](https://github.com/pandas-dev/pandas/issues/17739)) +* Removed `Series.compound` and `DataFrame.compound` ([GH 26405](https://github.com/pandas-dev/pandas/issues/26405)) +* Changed the default “inplace” argument in [`DataFrame.set_index()`](../reference/api/pandas.DataFrame.set_index.html#pandas.DataFrame.set_index "pandas.DataFrame.set_index") and [`Series.set_axis()`](../reference/api/pandas.Series.set_axis.html#pandas.Series.set_axis "pandas.Series.set_axis") from `None` to `False` ([GH 27600](https://github.com/pandas-dev/pandas/issues/27600)) +* Removed `Series.cat.categorical`, `Series.cat.index`, `Series.cat.name` ([GH 24751](https://github.com/pandas-dev/pandas/issues/24751)) +* Removed the previously deprecated keyword “box” from [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") and [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta"); in addition these now always returns [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex"), [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex"), [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 24486](https://github.com/pandas-dev/pandas/issues/24486)) +* [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta"), [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta"), and [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") no longer allow “M”, “y”, or “Y” for the “unit” argument ([GH 23264](https://github.com/pandas-dev/pandas/issues/23264)) +* Removed the previously deprecated keyword “time\_rule” from (non-public) `offsets.generate_range`, which has been moved to `core.arrays._ranges.generate_range()` ([GH 24157](https://github.com/pandas-dev/pandas/issues/24157)) +* [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") or [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") with listlike indexers and missing labels will no longer reindex ([GH 17295](https://github.com/pandas-dev/pandas/issues/17295)) +* [`DataFrame.to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel") and [`Series.to_excel()`](../reference/api/pandas.Series.to_excel.html#pandas.Series.to_excel "pandas.Series.to_excel") with non-existent columns will no longer reindex ([GH 17295](https://github.com/pandas-dev/pandas/issues/17295)) +* Removed the previously deprecated keyword “join\_axes” from [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat"); use `reindex_like` on the result instead ([GH 22318](https://github.com/pandas-dev/pandas/issues/22318)) +* Removed the previously deprecated keyword “by” from [`DataFrame.sort_index()`](../reference/api/pandas.DataFrame.sort_index.html#pandas.DataFrame.sort_index "pandas.DataFrame.sort_index"), use [`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values") instead ([GH 10726](https://github.com/pandas-dev/pandas/issues/10726)) +* Removed support for nested renaming in [`DataFrame.aggregate()`](../reference/api/pandas.DataFrame.aggregate.html#pandas.DataFrame.aggregate "pandas.DataFrame.aggregate"), [`Series.aggregate()`](../reference/api/pandas.Series.aggregate.html#pandas.Series.aggregate "pandas.Series.aggregate"), [`core.groupby.DataFrameGroupBy.aggregate()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.aggregate.html#pandas.core.groupby.DataFrameGroupBy.aggregate "pandas.core.groupby.DataFrameGroupBy.aggregate"), [`core.groupby.SeriesGroupBy.aggregate()`](../reference/api/pandas.core.groupby.SeriesGroupBy.aggregate.html#pandas.core.groupby.SeriesGroupBy.aggregate "pandas.core.groupby.SeriesGroupBy.aggregate"), [`core.window.rolling.Rolling.aggregate()`](../reference/api/pandas.core.window.rolling.Rolling.aggregate.html#pandas.core.window.rolling.Rolling.aggregate "pandas.core.window.rolling.Rolling.aggregate") ([GH 18529](https://github.com/pandas-dev/pandas/issues/18529)) +* Passing `datetime64` data to [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") or `timedelta64` data to `DatetimeIndex` now raises `TypeError` ([GH 23539](https://github.com/pandas-dev/pandas/issues/23539), [GH 23937](https://github.com/pandas-dev/pandas/issues/23937)) +* Passing `int64` values to [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") and a timezone now interprets the values as nanosecond timestamps in UTC, not wall times in the given timezone ([GH 24559](https://github.com/pandas-dev/pandas/issues/24559)) +* A tuple passed to [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") is now exclusively treated as a single key ([GH 18314](https://github.com/pandas-dev/pandas/issues/18314)) +* Removed `Index.contains`, use `key in index` instead ([GH 30103](https://github.com/pandas-dev/pandas/issues/30103)) +* Addition and subtraction of `int` or integer-arrays is no longer allowed in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp"), [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex"), [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex"), use `obj + n * obj.freq` instead of `obj + n` ([GH 22535](https://github.com/pandas-dev/pandas/issues/22535)) +* Removed `Series.ptp` ([GH 21614](https://github.com/pandas-dev/pandas/issues/21614)) +* Removed `Series.from_array` ([GH 18258](https://github.com/pandas-dev/pandas/issues/18258)) +* Removed `DataFrame.from_items` ([GH 18458](https://github.com/pandas-dev/pandas/issues/18458)) +* Removed `DataFrame.as_matrix`, `Series.as_matrix` ([GH 18458](https://github.com/pandas-dev/pandas/issues/18458)) +* Removed `Series.asobject` ([GH 18477](https://github.com/pandas-dev/pandas/issues/18477)) +* Removed `DataFrame.as_blocks`, `Series.as_blocks`, `DataFrame.blocks`, `Series.blocks` ([GH 17656](https://github.com/pandas-dev/pandas/issues/17656)) +* [`pandas.Series.str.cat()`](../reference/api/pandas.Series.str.cat.html#pandas.Series.str.cat "pandas.Series.str.cat") now defaults to aligning `others`, using `join='left'` ([GH 27611](https://github.com/pandas-dev/pandas/issues/27611)) +* [`pandas.Series.str.cat()`](../reference/api/pandas.Series.str.cat.html#pandas.Series.str.cat "pandas.Series.str.cat") does not accept list-likes *within* list-likes anymore ([GH 27611](https://github.com/pandas-dev/pandas/issues/27611)) +* [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where") with `Categorical` dtype (or [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where") with `Categorical` column) no longer allows setting new categories ([GH 24114](https://github.com/pandas-dev/pandas/issues/24114)) +* Removed the previously deprecated keywords “start”, “end”, and “periods” from the [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex"), [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex"), and [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") constructors; use [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range"), [`timedelta_range()`](../reference/api/pandas.timedelta_range.html#pandas.timedelta_range "pandas.timedelta_range"), and [`period_range()`](../reference/api/pandas.period_range.html#pandas.period_range "pandas.period_range") instead ([GH 23919](https://github.com/pandas-dev/pandas/issues/23919)) +* Removed the previously deprecated keyword “verify\_integrity” from the [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") and [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") constructors ([GH 23919](https://github.com/pandas-dev/pandas/issues/23919)) +* Removed the previously deprecated keyword “fastpath” from `pandas.core.internals.blocks.make_block` ([GH 19265](https://github.com/pandas-dev/pandas/issues/19265)) +* Removed the previously deprecated keyword “dtype” from `Block.make_block_same_class()` ([GH 19434](https://github.com/pandas-dev/pandas/issues/19434)) +* Removed `ExtensionArray._formatting_values`. Use `ExtensionArray._formatter` instead. ([GH 23601](https://github.com/pandas-dev/pandas/issues/23601)) +* Removed `MultiIndex.to_hierarchical` ([GH 21613](https://github.com/pandas-dev/pandas/issues/21613)) +* Removed `MultiIndex.labels`, use [`MultiIndex.codes`](../reference/api/pandas.MultiIndex.codes.html#pandas.MultiIndex.codes "pandas.MultiIndex.codes") instead ([GH 23752](https://github.com/pandas-dev/pandas/issues/23752)) +* Removed the previously deprecated keyword “labels” from the [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") constructor, use “codes” instead ([GH 23752](https://github.com/pandas-dev/pandas/issues/23752)) +* Removed `MultiIndex.set_labels`, use [`MultiIndex.set_codes()`](../reference/api/pandas.MultiIndex.set_codes.html#pandas.MultiIndex.set_codes "pandas.MultiIndex.set_codes") instead ([GH 23752](https://github.com/pandas-dev/pandas/issues/23752)) +* Removed the previously deprecated keyword “labels” from [`MultiIndex.set_codes()`](../reference/api/pandas.MultiIndex.set_codes.html#pandas.MultiIndex.set_codes "pandas.MultiIndex.set_codes"), [`MultiIndex.copy()`](../reference/api/pandas.MultiIndex.copy.html#pandas.MultiIndex.copy "pandas.MultiIndex.copy"), [`MultiIndex.drop()`](../reference/api/pandas.MultiIndex.drop.html#pandas.MultiIndex.drop "pandas.MultiIndex.drop"), use “codes” instead ([GH 23752](https://github.com/pandas-dev/pandas/issues/23752)) +* Removed support for legacy HDF5 formats ([GH 29787](https://github.com/pandas-dev/pandas/issues/29787)) +* Passing a dtype alias (e.g. ‘datetime64[ns, UTC]’) to [`DatetimeTZDtype`](../reference/api/pandas.DatetimeTZDtype.html#pandas.DatetimeTZDtype "pandas.DatetimeTZDtype") is no longer allowed, use `DatetimeTZDtype.construct_from_string()` instead ([GH 23990](https://github.com/pandas-dev/pandas/issues/23990)) +* Removed the previously deprecated keyword “skip\_footer” from [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel"); use “skipfooter” instead ([GH 18836](https://github.com/pandas-dev/pandas/issues/18836)) +* [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") no longer allows an integer value for the parameter `usecols`, instead pass a list of integers from 0 to `usecols` inclusive ([GH 23635](https://github.com/pandas-dev/pandas/issues/23635)) +* Removed the previously deprecated keyword “convert\_datetime64” from [`DataFrame.to_records()`](../reference/api/pandas.DataFrame.to_records.html#pandas.DataFrame.to_records "pandas.DataFrame.to_records") ([GH 18902](https://github.com/pandas-dev/pandas/issues/18902)) +* Removed `IntervalIndex.from_intervals` in favor of the [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") constructor ([GH 19263](https://github.com/pandas-dev/pandas/issues/19263)) +* Changed the default “keep\_tz” argument in [`DatetimeIndex.to_series()`](../reference/api/pandas.DatetimeIndex.to_series.html#pandas.DatetimeIndex.to_series "pandas.DatetimeIndex.to_series") from `None` to `True` ([GH 23739](https://github.com/pandas-dev/pandas/issues/23739)) +* Removed `api.types.is_period` and `api.types.is_datetimetz` ([GH 23917](https://github.com/pandas-dev/pandas/issues/23917)) +* Ability to read pickles containing [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") instances created with pre-0.16 version of pandas has been removed ([GH 27538](https://github.com/pandas-dev/pandas/issues/27538)) +* Removed `pandas.tseries.plotting.tsplot` ([GH 18627](https://github.com/pandas-dev/pandas/issues/18627)) +* Removed the previously deprecated keywords “reduce” and “broadcast” from [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") ([GH 18577](https://github.com/pandas-dev/pandas/issues/18577)) +* Removed the previously deprecated `assert_raises_regex` function in `pandas._testing` ([GH 29174](https://github.com/pandas-dev/pandas/issues/29174)) +* Removed the previously deprecated `FrozenNDArray` class in `pandas.core.indexes.frozen` ([GH 29335](https://github.com/pandas-dev/pandas/issues/29335)) +* Removed the previously deprecated keyword “nthreads” from [`read_feather()`](../reference/api/pandas.read_feather.html#pandas.read_feather "pandas.read_feather"), use “use\_threads” instead ([GH 23053](https://github.com/pandas-dev/pandas/issues/23053)) +* Removed `Index.is_lexsorted_for_tuple` ([GH 29305](https://github.com/pandas-dev/pandas/issues/29305)) +* Removed support for nested renaming in [`DataFrame.aggregate()`](../reference/api/pandas.DataFrame.aggregate.html#pandas.DataFrame.aggregate "pandas.DataFrame.aggregate"), [`Series.aggregate()`](../reference/api/pandas.Series.aggregate.html#pandas.Series.aggregate "pandas.Series.aggregate"), [`core.groupby.DataFrameGroupBy.aggregate()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.aggregate.html#pandas.core.groupby.DataFrameGroupBy.aggregate "pandas.core.groupby.DataFrameGroupBy.aggregate"), [`core.groupby.SeriesGroupBy.aggregate()`](../reference/api/pandas.core.groupby.SeriesGroupBy.aggregate.html#pandas.core.groupby.SeriesGroupBy.aggregate "pandas.core.groupby.SeriesGroupBy.aggregate"), [`core.window.rolling.Rolling.aggregate()`](../reference/api/pandas.core.window.rolling.Rolling.aggregate.html#pandas.core.window.rolling.Rolling.aggregate "pandas.core.window.rolling.Rolling.aggregate") ([GH 29608](https://github.com/pandas-dev/pandas/issues/29608)) +* Removed `Series.valid`; use [`Series.dropna()`](../reference/api/pandas.Series.dropna.html#pandas.Series.dropna "pandas.Series.dropna") instead ([GH 18800](https://github.com/pandas-dev/pandas/issues/18800)) +* Removed `DataFrame.is_copy`, `Series.is_copy` ([GH 18812](https://github.com/pandas-dev/pandas/issues/18812)) +* Removed `DataFrame.get_ftype_counts`, `Series.get_ftype_counts` ([GH 18243](https://github.com/pandas-dev/pandas/issues/18243)) +* Removed `DataFrame.ftypes`, `Series.ftypes`, `Series.ftype` ([GH 26744](https://github.com/pandas-dev/pandas/issues/26744)) +* Removed `Index.get_duplicates`, use `idx[idx.duplicated()].unique()` instead ([GH 20239](https://github.com/pandas-dev/pandas/issues/20239)) +* Removed `Series.clip_upper`, `Series.clip_lower`, `DataFrame.clip_upper`, `DataFrame.clip_lower` ([GH 24203](https://github.com/pandas-dev/pandas/issues/24203)) +* Removed the ability to alter [`DatetimeIndex.freq`](../reference/api/pandas.DatetimeIndex.freq.html#pandas.DatetimeIndex.freq "pandas.DatetimeIndex.freq"), `TimedeltaIndex.freq`, or [`PeriodIndex.freq`](../reference/api/pandas.PeriodIndex.freq.html#pandas.PeriodIndex.freq "pandas.PeriodIndex.freq") ([GH 20772](https://github.com/pandas-dev/pandas/issues/20772)) +* Removed `DatetimeIndex.offset` ([GH 20730](https://github.com/pandas-dev/pandas/issues/20730)) +* Removed `DatetimeIndex.asobject`, `TimedeltaIndex.asobject`, `PeriodIndex.asobject`, use `astype(object)` instead ([GH 29801](https://github.com/pandas-dev/pandas/issues/29801)) +* Removed the previously deprecated keyword “order” from [`factorize()`](../reference/api/pandas.factorize.html#pandas.factorize "pandas.factorize") ([GH 19751](https://github.com/pandas-dev/pandas/issues/19751)) +* Removed the previously deprecated keyword “encoding” from [`read_stata()`](../reference/api/pandas.read_stata.html#pandas.read_stata "pandas.read_stata") and [`DataFrame.to_stata()`](../reference/api/pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata") ([GH 21400](https://github.com/pandas-dev/pandas/issues/21400)) +* Changed the default “sort” argument in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") from `None` to `False` ([GH 20613](https://github.com/pandas-dev/pandas/issues/20613)) +* Removed the previously deprecated keyword “raise\_conflict” from [`DataFrame.update()`](../reference/api/pandas.DataFrame.update.html#pandas.DataFrame.update "pandas.DataFrame.update"), use “errors” instead ([GH 23585](https://github.com/pandas-dev/pandas/issues/23585)) +* Removed the previously deprecated keyword “n” from `DatetimeIndex.shift()`, `TimedeltaIndex.shift()`, `PeriodIndex.shift()`, use “periods” instead ([GH 22458](https://github.com/pandas-dev/pandas/issues/22458)) +* Removed the previously deprecated keywords “how”, “fill\_method”, and “limit” from [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") ([GH 30139](https://github.com/pandas-dev/pandas/issues/30139)) +* Passing an integer to [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") or [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") with `timedelta64[ns]` dtype now raises `TypeError` ([GH 24694](https://github.com/pandas-dev/pandas/issues/24694)) +* Passing multiple axes to [`DataFrame.dropna()`](../reference/api/pandas.DataFrame.dropna.html#pandas.DataFrame.dropna "pandas.DataFrame.dropna") is no longer supported ([GH 20995](https://github.com/pandas-dev/pandas/issues/20995)) +* Removed `Series.nonzero`, use `to_numpy().nonzero()` instead ([GH 24048](https://github.com/pandas-dev/pandas/issues/24048)) +* Passing floating dtype `codes` to [`Categorical.from_codes()`](../reference/api/pandas.Categorical.from_codes.html#pandas.Categorical.from_codes "pandas.Categorical.from_codes") is no longer supported, pass `codes.astype(np.int64)` instead ([GH 21775](https://github.com/pandas-dev/pandas/issues/21775)) +* Removed the previously deprecated keyword “pat” from [`Series.str.partition()`](../reference/api/pandas.Series.str.partition.html#pandas.Series.str.partition "pandas.Series.str.partition") and [`Series.str.rpartition()`](../reference/api/pandas.Series.str.rpartition.html#pandas.Series.str.rpartition "pandas.Series.str.rpartition"), use “sep” instead ([GH 23767](https://github.com/pandas-dev/pandas/issues/23767)) +* Removed `Series.put` ([GH 27106](https://github.com/pandas-dev/pandas/issues/27106)) +* Removed `Series.real`, `Series.imag` ([GH 27106](https://github.com/pandas-dev/pandas/issues/27106)) +* Removed `Series.to_dense`, `DataFrame.to_dense` ([GH 26684](https://github.com/pandas-dev/pandas/issues/26684)) +* Removed `Index.dtype_str`, use `str(index.dtype)` instead ([GH 27106](https://github.com/pandas-dev/pandas/issues/27106)) +* `Categorical.ravel()` returns a [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") instead of a `ndarray` ([GH 27199](https://github.com/pandas-dev/pandas/issues/27199)) +* The ‘outer’ method on Numpy ufuncs, e.g. `np.subtract.outer` operating on [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") objects is no longer supported, and will raise `NotImplementedError` ([GH 27198](https://github.com/pandas-dev/pandas/issues/27198)) +* Removed `Series.get_dtype_counts` and `DataFrame.get_dtype_counts` ([GH 27145](https://github.com/pandas-dev/pandas/issues/27145)) +* Changed the default “fill\_value” argument in `Categorical.take()` from `True` to `False` ([GH 20841](https://github.com/pandas-dev/pandas/issues/20841)) +* Changed the default value for the `raw` argument in `Series.rolling().apply()`, `DataFrame.rolling().apply()`, `Series.expanding().apply()`, and `DataFrame.expanding().apply()` from `None` to `False` ([GH 20584](https://github.com/pandas-dev/pandas/issues/20584)) +* Removed deprecated behavior of [`Series.argmin()`](../reference/api/pandas.Series.argmin.html#pandas.Series.argmin "pandas.Series.argmin") and [`Series.argmax()`](../reference/api/pandas.Series.argmax.html#pandas.Series.argmax "pandas.Series.argmax"), use [`Series.idxmin()`](../reference/api/pandas.Series.idxmin.html#pandas.Series.idxmin "pandas.Series.idxmin") and [`Series.idxmax()`](../reference/api/pandas.Series.idxmax.html#pandas.Series.idxmax "pandas.Series.idxmax") for the old behavior ([GH 16955](https://github.com/pandas-dev/pandas/issues/16955)) +* Passing a tz-aware `datetime.datetime` or [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") into the [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") constructor with the `tz` argument now raises a `ValueError` ([GH 23621](https://github.com/pandas-dev/pandas/issues/23621)) +* Removed `Series.base`, `Index.base`, `Categorical.base`, `Series.flags`, `Index.flags`, `PeriodArray.flags`, `Series.strides`, `Index.strides`, `Series.itemsize`, `Index.itemsize`, `Series.data`, `Index.data` ([GH 20721](https://github.com/pandas-dev/pandas/issues/20721)) +* Changed [`Timedelta.resolution()`](../reference/api/pandas.Timedelta.resolution.html#pandas.Timedelta.resolution "pandas.Timedelta.resolution") to match the behavior of the standard library `datetime.timedelta.resolution`, for the old behavior, use `Timedelta.resolution_string()` ([GH 26839](https://github.com/pandas-dev/pandas/issues/26839)) +* Removed `Timestamp.weekday_name`, `DatetimeIndex.weekday_name`, and `Series.dt.weekday_name` ([GH 18164](https://github.com/pandas-dev/pandas/issues/18164)) +* Removed the previously deprecated keyword “errors” in [`Timestamp.tz_localize()`](../reference/api/pandas.Timestamp.tz_localize.html#pandas.Timestamp.tz_localize "pandas.Timestamp.tz_localize"), [`DatetimeIndex.tz_localize()`](../reference/api/pandas.DatetimeIndex.tz_localize.html#pandas.DatetimeIndex.tz_localize "pandas.DatetimeIndex.tz_localize"), and [`Series.tz_localize()`](../reference/api/pandas.Series.tz_localize.html#pandas.Series.tz_localize "pandas.Series.tz_localize") ([GH 22644](https://github.com/pandas-dev/pandas/issues/22644)) +* Changed the default “ordered” argument in [`CategoricalDtype`](../reference/api/pandas.CategoricalDtype.html#pandas.CategoricalDtype "pandas.CategoricalDtype") from `None` to `False` ([GH 26336](https://github.com/pandas-dev/pandas/issues/26336)) +* [`Series.set_axis()`](../reference/api/pandas.Series.set_axis.html#pandas.Series.set_axis "pandas.Series.set_axis") and [`DataFrame.set_axis()`](../reference/api/pandas.DataFrame.set_axis.html#pandas.DataFrame.set_axis "pandas.DataFrame.set_axis") now require “labels” as the first argument and “axis” as an optional named parameter ([GH 30089](https://github.com/pandas-dev/pandas/issues/30089)) +* Removed `to_msgpack`, `read_msgpack`, `DataFrame.to_msgpack`, `Series.to_msgpack` ([GH 27103](https://github.com/pandas-dev/pandas/issues/27103)) +* Removed `Series.compress` ([GH 21930](https://github.com/pandas-dev/pandas/issues/21930)) +* Removed the previously deprecated keyword “fill\_value” from `Categorical.fillna()`, use “value” instead ([GH 19269](https://github.com/pandas-dev/pandas/issues/19269)) +* Removed the previously deprecated keyword “data” from `andrews_curves()`, use “frame” instead ([GH 6956](https://github.com/pandas-dev/pandas/issues/6956)) +* Removed the previously deprecated keyword “data” from `parallel_coordinates()`, use “frame” instead ([GH 6956](https://github.com/pandas-dev/pandas/issues/6956)) +* Removed the previously deprecated keyword “colors” from `parallel_coordinates()`, use “color” instead ([GH 6956](https://github.com/pandas-dev/pandas/issues/6956)) +* Removed the previously deprecated keywords “verbose” and “private\_key” from [`read_gbq()`](../reference/api/pandas.read_gbq.html#pandas.read_gbq "pandas.read_gbq") ([GH 30200](https://github.com/pandas-dev/pandas/issues/30200)) +* Calling `np.array` and `np.asarray` on tz-aware [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") will now return an object array of tz-aware [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") ([GH 24596](https://github.com/pandas-dev/pandas/issues/24596)) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Performance improvement in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") arithmetic and comparison operations with scalars ([GH 24990](https://github.com/pandas-dev/pandas/issues/24990), [GH 29853](https://github.com/pandas-dev/pandas/issues/29853)) +* Performance improvement in indexing with a non-unique [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") ([GH 27489](https://github.com/pandas-dev/pandas/issues/27489)) +* Performance improvement in `MultiIndex.is_monotonic` ([GH 27495](https://github.com/pandas-dev/pandas/issues/27495)) +* Performance improvement in [`cut()`](../reference/api/pandas.cut.html#pandas.cut "pandas.cut") when `bins` is an [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") ([GH 27668](https://github.com/pandas-dev/pandas/issues/27668)) +* Performance improvement when initializing a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") using a `range` ([GH 30171](https://github.com/pandas-dev/pandas/issues/30171)) +* Performance improvement in [`DataFrame.corr()`](../reference/api/pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr") when `method` is `"spearman"` ([GH 28139](https://github.com/pandas-dev/pandas/issues/28139)) +* Performance improvement in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") when provided a list of values to replace ([GH 28099](https://github.com/pandas-dev/pandas/issues/28099)) +* Performance improvement in [`DataFrame.select_dtypes()`](../reference/api/pandas.DataFrame.select_dtypes.html#pandas.DataFrame.select_dtypes "pandas.DataFrame.select_dtypes") by using vectorization instead of iterating over a loop ([GH 28317](https://github.com/pandas-dev/pandas/issues/28317)) +* Performance improvement in `Categorical.searchsorted()` and `CategoricalIndex.searchsorted()` ([GH 28795](https://github.com/pandas-dev/pandas/issues/28795)) +* Performance improvement when comparing a [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") with a scalar and the scalar is not found in the categories ([GH 29750](https://github.com/pandas-dev/pandas/issues/29750)) +* Performance improvement when checking if values in a [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") are equal, equal or larger or larger than a given scalar. + The improvement is not present if checking if the [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") is less than or less than or equal than the scalar ([GH 29820](https://github.com/pandas-dev/pandas/issues/29820)) +* Performance improvement in [`Index.equals()`](../reference/api/pandas.Index.equals.html#pandas.Index.equals "pandas.Index.equals") and `MultiIndex.equals()` ([GH 29134](https://github.com/pandas-dev/pandas/issues/29134)) +* Performance improvement in [`infer_dtype()`](../reference/api/pandas.api.types.infer_dtype.html#pandas.api.types.infer_dtype "pandas.api.types.infer_dtype") when `skipna` is `True` ([GH 28814](https://github.com/pandas-dev/pandas/issues/28814)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +### Categorical[#](#categorical "Link to this heading") + +* Added test to assert the `fillna()` raises the correct `ValueError` message when the value isn’t a value from categories ([GH 13628](https://github.com/pandas-dev/pandas/issues/13628)) +* Bug in `Categorical.astype()` where `NaN` values were handled incorrectly when casting to int ([GH 28406](https://github.com/pandas-dev/pandas/issues/28406)) +* [`DataFrame.reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex") with a [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") would fail when the targets contained duplicates, and wouldn’t fail if the source contained duplicates ([GH 28107](https://github.com/pandas-dev/pandas/issues/28107)) +* Bug in `Categorical.astype()` not allowing for casting to extension dtypes ([GH 28668](https://github.com/pandas-dev/pandas/issues/28668)) +* Bug where [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") was unable to join on categorical and extension dtype columns ([GH 28668](https://github.com/pandas-dev/pandas/issues/28668)) +* `Categorical.searchsorted()` and `CategoricalIndex.searchsorted()` now work on unordered categoricals also ([GH 21667](https://github.com/pandas-dev/pandas/issues/21667)) +* Added test to assert roundtripping to parquet with [`DataFrame.to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") or [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") will preserve Categorical dtypes for string types ([GH 27955](https://github.com/pandas-dev/pandas/issues/27955)) +* Changed the error message in `Categorical.remove_categories()` to always show the invalid removals as a set ([GH 28669](https://github.com/pandas-dev/pandas/issues/28669)) +* Using date accessors on a categorical dtyped [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") of datetimes was not returning an object of the + same type as if one used the `str.()` / `dt.()` on a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") of that type. E.g. when accessing [`Series.dt.tz_localize()`](../reference/api/pandas.Series.dt.tz_localize.html#pandas.Series.dt.tz_localize "pandas.Series.dt.tz_localize") on a + [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") with duplicate entries, the accessor was skipping duplicates ([GH 27952](https://github.com/pandas-dev/pandas/issues/27952)) +* Bug in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") and [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") that would give incorrect results on categorical data ([GH 26988](https://github.com/pandas-dev/pandas/issues/26988)) +* Bug where calling `Categorical.min()` or `Categorical.max()` on an empty Categorical would raise a numpy exception ([GH 30227](https://github.com/pandas-dev/pandas/issues/30227)) +* The following methods now also correctly output values for unobserved categories when called through `groupby(..., observed=False)` ([GH 17605](https://github.com/pandas-dev/pandas/issues/17605)) + \* [`core.groupby.SeriesGroupBy.count()`](../reference/api/pandas.core.groupby.SeriesGroupBy.count.html#pandas.core.groupby.SeriesGroupBy.count "pandas.core.groupby.SeriesGroupBy.count") + \* [`core.groupby.SeriesGroupBy.size()`](../reference/api/pandas.core.groupby.SeriesGroupBy.size.html#pandas.core.groupby.SeriesGroupBy.size "pandas.core.groupby.SeriesGroupBy.size") + \* [`core.groupby.SeriesGroupBy.nunique()`](../reference/api/pandas.core.groupby.SeriesGroupBy.nunique.html#pandas.core.groupby.SeriesGroupBy.nunique "pandas.core.groupby.SeriesGroupBy.nunique") + \* [`core.groupby.SeriesGroupBy.nth()`](../reference/api/pandas.core.groupby.SeriesGroupBy.nth.html#pandas.core.groupby.SeriesGroupBy.nth "pandas.core.groupby.SeriesGroupBy.nth") + +### Datetimelike[#](#datetimelike "Link to this heading") + +* Bug in `Series.__setitem__()` incorrectly casting `np.timedelta64("NaT")` to `np.datetime64("NaT")` when inserting into a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with datetime64 dtype ([GH 27311](https://github.com/pandas-dev/pandas/issues/27311)) +* Bug in [`Series.dt()`](../reference/api/pandas.Series.dt.html#pandas.Series.dt "pandas.Series.dt") property lookups when the underlying data is read-only ([GH 27529](https://github.com/pandas-dev/pandas/issues/27529)) +* Bug in `HDFStore.__getitem__` incorrectly reading tz attribute created in Python 2 ([GH 26443](https://github.com/pandas-dev/pandas/issues/26443)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") where passing arrays of malformed `str` with errors=”coerce” could incorrectly lead to raising `ValueError` ([GH 28299](https://github.com/pandas-dev/pandas/issues/28299)) +* Bug in [`core.groupby.SeriesGroupBy.nunique()`](../reference/api/pandas.core.groupby.SeriesGroupBy.nunique.html#pandas.core.groupby.SeriesGroupBy.nunique "pandas.core.groupby.SeriesGroupBy.nunique") where `NaT` values were interfering with the count of unique values ([GH 27951](https://github.com/pandas-dev/pandas/issues/27951)) +* Bug in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") subtraction when subtracting a [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") from a `np.datetime64` object incorrectly raising `TypeError` ([GH 28286](https://github.com/pandas-dev/pandas/issues/28286)) +* Addition and subtraction of integer or integer-dtype arrays with [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") will now raise `NullFrequencyError` instead of `ValueError` ([GH 28268](https://github.com/pandas-dev/pandas/issues/28268)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with integer dtype failing to raise `TypeError` when adding or subtracting a `np.datetime64` object ([GH 28080](https://github.com/pandas-dev/pandas/issues/28080)) +* Bug in [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype"), [`Index.astype()`](../reference/api/pandas.Index.astype.html#pandas.Index.astype "pandas.Index.astype"), and [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") failing to handle `NaT` when casting to an integer dtype ([GH 28492](https://github.com/pandas-dev/pandas/issues/28492)) +* Bug in `Week` with `weekday` incorrectly raising `AttributeError` instead of `TypeError` when adding or subtracting an invalid type ([GH 28530](https://github.com/pandas-dev/pandas/issues/28530)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") arithmetic operations when operating with a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with dtype `'timedelta64[ns]'` ([GH 28049](https://github.com/pandas-dev/pandas/issues/28049)) +* Bug in `core.groupby.generic.SeriesGroupBy.apply()` raising `ValueError` when a column in the original DataFrame is a datetime and the column labels are not standard integers ([GH 28247](https://github.com/pandas-dev/pandas/issues/28247)) +* Bug in `pandas._config.localization.get_locales()` where the `locales -a` encodes the locales list as windows-1252 ([GH 23638](https://github.com/pandas-dev/pandas/issues/23638), [GH 24760](https://github.com/pandas-dev/pandas/issues/24760), [GH 27368](https://github.com/pandas-dev/pandas/issues/27368)) +* Bug in [`Series.var()`](../reference/api/pandas.Series.var.html#pandas.Series.var "pandas.Series.var") failing to raise `TypeError` when called with `timedelta64[ns]` dtype ([GH 28289](https://github.com/pandas-dev/pandas/issues/28289)) +* Bug in [`DatetimeIndex.strftime()`](../reference/api/pandas.DatetimeIndex.strftime.html#pandas.DatetimeIndex.strftime "pandas.DatetimeIndex.strftime") and [`Series.dt.strftime()`](../reference/api/pandas.Series.dt.strftime.html#pandas.Series.dt.strftime "pandas.Series.dt.strftime") where `NaT` was converted to the string `'NaT'` instead of `np.nan` ([GH 29578](https://github.com/pandas-dev/pandas/issues/29578)) +* Bug in masking datetime-like arrays with a boolean mask of an incorrect length not raising an `IndexError` ([GH 30308](https://github.com/pandas-dev/pandas/issues/30308)) +* Bug in [`Timestamp.resolution`](../reference/api/pandas.Timestamp.resolution.html#pandas.Timestamp.resolution "pandas.Timestamp.resolution") being a property instead of a class attribute ([GH 29910](https://github.com/pandas-dev/pandas/issues/29910)) +* Bug in [`pandas.to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") when called with `None` raising `TypeError` instead of returning `NaT` ([GH 30011](https://github.com/pandas-dev/pandas/issues/30011)) +* Bug in [`pandas.to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") failing for `deque` objects when using `cache=True` (the default) ([GH 29403](https://github.com/pandas-dev/pandas/issues/29403)) +* Bug in [`Series.item()`](../reference/api/pandas.Series.item.html#pandas.Series.item "pandas.Series.item") with `datetime64` or `timedelta64` dtype, `DatetimeIndex.item()`, and `TimedeltaIndex.item()` returning an integer instead of a [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") or [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") ([GH 30175](https://github.com/pandas-dev/pandas/issues/30175)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") addition when adding a non-optimized `DateOffset` incorrectly dropping timezone information ([GH 30336](https://github.com/pandas-dev/pandas/issues/30336)) +* Bug in [`DataFrame.drop()`](../reference/api/pandas.DataFrame.drop.html#pandas.DataFrame.drop "pandas.DataFrame.drop") where attempting to drop non-existent values from a DatetimeIndex would yield a confusing error message ([GH 30399](https://github.com/pandas-dev/pandas/issues/30399)) +* Bug in `DataFrame.append()` would remove the timezone-awareness of new data ([GH 30238](https://github.com/pandas-dev/pandas/issues/30238)) +* Bug in [`Series.cummin()`](../reference/api/pandas.Series.cummin.html#pandas.Series.cummin "pandas.Series.cummin") and [`Series.cummax()`](../reference/api/pandas.Series.cummax.html#pandas.Series.cummax "pandas.Series.cummax") with timezone-aware dtype incorrectly dropping its timezone ([GH 15553](https://github.com/pandas-dev/pandas/issues/15553)) +* Bug in `DatetimeArray`, `TimedeltaArray`, and `PeriodArray` where inplace addition and subtraction did not actually operate inplace ([GH 24115](https://github.com/pandas-dev/pandas/issues/24115)) +* Bug in [`pandas.to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") when called with `Series` storing `IntegerArray` raising `TypeError` instead of returning `Series` ([GH 30050](https://github.com/pandas-dev/pandas/issues/30050)) +* Bug in [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range") with custom business hours as `freq` and given number of `periods` ([GH 30593](https://github.com/pandas-dev/pandas/issues/30593)) +* Bug in [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") comparisons with incorrectly casting integers to [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") objects, inconsistent with the [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") comparison behavior ([GH 30722](https://github.com/pandas-dev/pandas/issues/30722)) +* Bug in `DatetimeIndex.insert()` raising a `ValueError` instead of a `TypeError` when trying to insert a timezone-aware [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") into a timezone-naive [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex"), or vice-versa ([GH 30806](https://github.com/pandas-dev/pandas/issues/30806)) + +### Timedelta[#](#timedelta "Link to this heading") + +* Bug in subtracting a [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") or `TimedeltaArray` from a `np.datetime64` object ([GH 29558](https://github.com/pandas-dev/pandas/issues/29558)) + +### Timezones[#](#timezones "Link to this heading") + +### Numeric[#](#numeric "Link to this heading") + +* Bug in [`DataFrame.quantile()`](../reference/api/pandas.DataFrame.quantile.html#pandas.DataFrame.quantile "pandas.DataFrame.quantile") with zero-column [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") incorrectly raising ([GH 23925](https://github.com/pandas-dev/pandas/issues/23925)) +* [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") flex inequality comparisons methods ([`DataFrame.lt()`](../reference/api/pandas.DataFrame.lt.html#pandas.DataFrame.lt "pandas.DataFrame.lt"), [`DataFrame.le()`](../reference/api/pandas.DataFrame.le.html#pandas.DataFrame.le "pandas.DataFrame.le"), [`DataFrame.gt()`](../reference/api/pandas.DataFrame.gt.html#pandas.DataFrame.gt "pandas.DataFrame.gt"), [`DataFrame.ge()`](../reference/api/pandas.DataFrame.ge.html#pandas.DataFrame.ge "pandas.DataFrame.ge")) with object-dtype and `complex` entries failing to raise `TypeError` like their [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") counterparts ([GH 28079](https://github.com/pandas-dev/pandas/issues/28079)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") logical operations (`&`, `|`, `^`) not matching [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") behavior by filling NA values ([GH 28741](https://github.com/pandas-dev/pandas/issues/28741)) +* Bug in [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") where specifying axis by name references variable before it is assigned ([GH 29142](https://github.com/pandas-dev/pandas/issues/29142)) +* Bug in [`Series.var()`](../reference/api/pandas.Series.var.html#pandas.Series.var "pandas.Series.var") not computing the right value with a nullable integer dtype series not passing through ddof argument ([GH 29128](https://github.com/pandas-dev/pandas/issues/29128)) +* Improved error message when using `frac` > 1 and `replace` = False ([GH 27451](https://github.com/pandas-dev/pandas/issues/27451)) +* Bug in numeric indexes resulted in it being possible to instantiate an `Int64Index`, `UInt64Index`, or `Float64Index` with an invalid dtype (e.g. datetime-like) ([GH 29539](https://github.com/pandas-dev/pandas/issues/29539)) +* Bug in `UInt64Index` precision loss while constructing from a list with values in the `np.uint64` range ([GH 29526](https://github.com/pandas-dev/pandas/issues/29526)) +* Bug in `NumericIndex` construction that caused indexing to fail when integers in the `np.uint64` range were used ([GH 28023](https://github.com/pandas-dev/pandas/issues/28023)) +* Bug in `NumericIndex` construction that caused `UInt64Index` to be casted to `Float64Index` when integers in the `np.uint64` range were used to index a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 28279](https://github.com/pandas-dev/pandas/issues/28279)) +* Bug in [`Series.interpolate()`](../reference/api/pandas.Series.interpolate.html#pandas.Series.interpolate "pandas.Series.interpolate") when using method=`index` with an unsorted index, would previously return incorrect results. ([GH 21037](https://github.com/pandas-dev/pandas/issues/21037)) +* Bug in [`DataFrame.round()`](../reference/api/pandas.DataFrame.round.html#pandas.DataFrame.round "pandas.DataFrame.round") where a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") of [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") columns would incorrectly raise a `TypeError` ([GH 30063](https://github.com/pandas-dev/pandas/issues/30063)) +* Bug in [`Series.pct_change()`](../reference/api/pandas.Series.pct_change.html#pandas.Series.pct_change "pandas.Series.pct_change") and [`DataFrame.pct_change()`](../reference/api/pandas.DataFrame.pct_change.html#pandas.DataFrame.pct_change "pandas.DataFrame.pct_change") when there are duplicated indices ([GH 30463](https://github.com/pandas-dev/pandas/issues/30463)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") cumulative operations (e.g. cumsum, cummax) incorrect casting to object-dtype ([GH 19296](https://github.com/pandas-dev/pandas/issues/19296)) +* Bug in [`diff`](../reference/api/pandas.DataFrame.diff.html#pandas.DataFrame.diff "pandas.DataFrame.diff") losing the dtype for extension types ([GH 30889](https://github.com/pandas-dev/pandas/issues/30889)) +* Bug in [`DataFrame.diff`](../reference/api/pandas.DataFrame.diff.html#pandas.DataFrame.diff "pandas.DataFrame.diff") raising an `IndexError` when one of the columns was a nullable integer dtype ([GH 30967](https://github.com/pandas-dev/pandas/issues/30967)) + +### Conversion[#](#conversion "Link to this heading") + +### Strings[#](#strings "Link to this heading") + +* Calling [`Series.str.isalnum()`](../reference/api/pandas.Series.str.isalnum.html#pandas.Series.str.isalnum "pandas.Series.str.isalnum") (and other “ismethods”) on an empty `Series` would return an `object` dtype instead of `bool` ([GH 29624](https://github.com/pandas-dev/pandas/issues/29624)) + +### Interval[#](#interval "Link to this heading") + +* Bug in [`IntervalIndex.get_indexer()`](../reference/api/pandas.IntervalIndex.get_indexer.html#pandas.IntervalIndex.get_indexer "pandas.IntervalIndex.get_indexer") where a [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") or [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") `target` would incorrectly raise a `TypeError` ([GH 30063](https://github.com/pandas-dev/pandas/issues/30063)) +* Bug in `pandas.core.dtypes.cast.infer_dtype_from_scalar` where passing `pandas_dtype=True` did not infer [`IntervalDtype`](../reference/api/pandas.IntervalDtype.html#pandas.IntervalDtype "pandas.IntervalDtype") ([GH 30337](https://github.com/pandas-dev/pandas/issues/30337)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructor where constructing a `Series` from a `list` of [`Interval`](../reference/api/pandas.Interval.html#pandas.Interval "pandas.Interval") objects resulted in `object` dtype instead of [`IntervalDtype`](../reference/api/pandas.IntervalDtype.html#pandas.IntervalDtype "pandas.IntervalDtype") ([GH 23563](https://github.com/pandas-dev/pandas/issues/23563)) +* Bug in [`IntervalDtype`](../reference/api/pandas.IntervalDtype.html#pandas.IntervalDtype "pandas.IntervalDtype") where the `kind` attribute was incorrectly set as `None` instead of `"O"` ([GH 30568](https://github.com/pandas-dev/pandas/issues/30568)) +* Bug in [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex"), [`IntervalArray`](../reference/api/pandas.arrays.IntervalArray.html#pandas.arrays.IntervalArray "pandas.arrays.IntervalArray"), and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with interval data where equality comparisons were incorrect ([GH 24112](https://github.com/pandas-dev/pandas/issues/24112)) + +### Indexing[#](#indexing "Link to this heading") + +* Bug in assignment using a reverse slicer ([GH 26939](https://github.com/pandas-dev/pandas/issues/26939)) +* Bug in [`DataFrame.explode()`](../reference/api/pandas.DataFrame.explode.html#pandas.DataFrame.explode "pandas.DataFrame.explode") would duplicate frame in the presence of duplicates in the index ([GH 28010](https://github.com/pandas-dev/pandas/issues/28010)) +* Bug in reindexing a [`PeriodIndex()`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") with another type of index that contained a `Period` ([GH 28323](https://github.com/pandas-dev/pandas/issues/28323)) ([GH 28337](https://github.com/pandas-dev/pandas/issues/28337)) +* Fix assignment of column via `.loc` with numpy non-ns datetime type ([GH 27395](https://github.com/pandas-dev/pandas/issues/27395)) +* Bug in `Float64Index.astype()` where `np.inf` was not handled properly when casting to an integer dtype ([GH 28475](https://github.com/pandas-dev/pandas/issues/28475)) +* [`Index.union()`](../reference/api/pandas.Index.union.html#pandas.Index.union "pandas.Index.union") could fail when the left contained duplicates ([GH 28257](https://github.com/pandas-dev/pandas/issues/28257)) +* Bug when indexing with `.loc` where the index was a [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") with non-string categories didn’t work ([GH 17569](https://github.com/pandas-dev/pandas/issues/17569), [GH 30225](https://github.com/pandas-dev/pandas/issues/30225)) +* [`Index.get_indexer_non_unique()`](../reference/api/pandas.Index.get_indexer_non_unique.html#pandas.Index.get_indexer_non_unique "pandas.Index.get_indexer_non_unique") could fail with `TypeError` in some cases, such as when searching for ints in a string index ([GH 28257](https://github.com/pandas-dev/pandas/issues/28257)) +* Bug in `Float64Index.get_loc()` incorrectly raising `TypeError` instead of `KeyError` ([GH 29189](https://github.com/pandas-dev/pandas/issues/29189)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") with incorrect dtype when setting Categorical value in 1-row DataFrame ([GH 25495](https://github.com/pandas-dev/pandas/issues/25495)) +* [`MultiIndex.get_loc()`](../reference/api/pandas.MultiIndex.get_loc.html#pandas.MultiIndex.get_loc "pandas.MultiIndex.get_loc") can’t find missing values when input includes missing values ([GH 19132](https://github.com/pandas-dev/pandas/issues/19132)) +* Bug in `Series.__setitem__()` incorrectly assigning values with boolean indexer when the length of new data matches the number of `True` values and new data is not a `Series` or an `np.array` ([GH 30567](https://github.com/pandas-dev/pandas/issues/30567)) +* Bug in indexing with a [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") incorrectly accepting integers representing years, use e.g. `ser.loc["2007"]` instead of `ser.loc[2007]` ([GH 30763](https://github.com/pandas-dev/pandas/issues/30763)) + +### Missing[#](#missing "Link to this heading") + +### MultiIndex[#](#multiindex "Link to this heading") + +* Constructor for [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") verifies that the given `sortorder` is compatible with the actual `lexsort_depth` if `verify_integrity` parameter is `True` (the default) ([GH 28735](https://github.com/pandas-dev/pandas/issues/28735)) +* Series and MultiIndex `.drop` with `MultiIndex` raise exception if labels not in given in level ([GH 8594](https://github.com/pandas-dev/pandas/issues/8594)) + +### IO[#](#io "Link to this heading") + +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") now accepts binary mode file buffers when using the Python csv engine ([GH 23779](https://github.com/pandas-dev/pandas/issues/23779)) +* Bug in [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") where using a Tuple as a column or index value and using `orient="columns"` or `orient="index"` would produce invalid JSON ([GH 20500](https://github.com/pandas-dev/pandas/issues/20500)) +* Improve infinity parsing. [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") now interprets `Infinity`, `+Infinity`, `-Infinity` as floating point values ([GH 10065](https://github.com/pandas-dev/pandas/issues/10065)) +* Bug in [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") where values were truncated when the length of `na_rep` was shorter than the text input data. ([GH 25099](https://github.com/pandas-dev/pandas/issues/25099)) +* Bug in [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string") where values were truncated using display options instead of outputting the full content ([GH 9784](https://github.com/pandas-dev/pandas/issues/9784)) +* Bug in [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") where a datetime column label would not be written out in ISO format with `orient="table"` ([GH 28130](https://github.com/pandas-dev/pandas/issues/28130)) +* Bug in [`DataFrame.to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") where writing to GCS would fail with `engine='fastparquet'` if the file did not already exist ([GH 28326](https://github.com/pandas-dev/pandas/issues/28326)) +* Bug in [`read_hdf()`](../reference/api/pandas.read_hdf.html#pandas.read_hdf "pandas.read_hdf") closing stores that it didn’t open when Exceptions are raised ([GH 28699](https://github.com/pandas-dev/pandas/issues/28699)) +* Bug in `DataFrame.read_json()` where using `orient="index"` would not maintain the order ([GH 28557](https://github.com/pandas-dev/pandas/issues/28557)) +* Bug in [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") where the length of the `formatters` argument was not verified ([GH 28469](https://github.com/pandas-dev/pandas/issues/28469)) +* Bug in `DataFrame.read_excel()` with `engine='ods'` when `sheet_name` argument references a non-existent sheet ([GH 27676](https://github.com/pandas-dev/pandas/issues/27676)) +* Bug in [`pandas.io.formats.style.Styler()`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") formatting for floating values not displaying decimals correctly ([GH 13257](https://github.com/pandas-dev/pandas/issues/13257)) +* Bug in [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") when using `formatters=` and `max_cols` together. ([GH 25955](https://github.com/pandas-dev/pandas/issues/25955)) +* Bug in `Styler.background_gradient()` not able to work with dtype `Int64` ([GH 28869](https://github.com/pandas-dev/pandas/issues/28869)) +* Bug in [`DataFrame.to_clipboard()`](../reference/api/pandas.DataFrame.to_clipboard.html#pandas.DataFrame.to_clipboard "pandas.DataFrame.to_clipboard") which did not work reliably in ipython ([GH 22707](https://github.com/pandas-dev/pandas/issues/22707)) +* Bug in [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") where default encoding was not set to `utf-8` ([GH 29565](https://github.com/pandas-dev/pandas/issues/29565)) +* Bug in `PythonParser` where str and bytes were being mixed when dealing with the decimal field ([GH 29650](https://github.com/pandas-dev/pandas/issues/29650)) +* [`read_gbq()`](../reference/api/pandas.read_gbq.html#pandas.read_gbq "pandas.read_gbq") now accepts `progress_bar_type` to display progress bar while the data downloads. ([GH 29857](https://github.com/pandas-dev/pandas/issues/29857)) +* Bug in `pandas.io.json.json_normalize()` where a missing value in the location specified by `record_path` would raise a `TypeError` ([GH 30148](https://github.com/pandas-dev/pandas/issues/30148)) +* [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") now accepts binary data ([GH 15914](https://github.com/pandas-dev/pandas/issues/15914)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") in which encoding handling was limited to just the string `utf-16` for the C engine ([GH 24130](https://github.com/pandas-dev/pandas/issues/24130)) + +### Plotting[#](#plotting "Link to this heading") + +* Bug in [`Series.plot()`](../reference/api/pandas.Series.plot.html#pandas.Series.plot "pandas.Series.plot") not able to plot boolean values ([GH 23719](https://github.com/pandas-dev/pandas/issues/23719)) +* Bug in [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") not able to plot when no rows ([GH 27758](https://github.com/pandas-dev/pandas/issues/27758)) +* Bug in [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") producing incorrect legend markers when plotting multiple series on the same axis ([GH 18222](https://github.com/pandas-dev/pandas/issues/18222)) +* Bug in [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") when `kind='box'` and data contains datetime or timedelta data. These types are now automatically dropped ([GH 22799](https://github.com/pandas-dev/pandas/issues/22799)) +* Bug in [`DataFrame.plot.line()`](../reference/api/pandas.DataFrame.plot.line.html#pandas.DataFrame.plot.line "pandas.DataFrame.plot.line") and [`DataFrame.plot.area()`](../reference/api/pandas.DataFrame.plot.area.html#pandas.DataFrame.plot.area "pandas.DataFrame.plot.area") produce wrong xlim in x-axis ([GH 27686](https://github.com/pandas-dev/pandas/issues/27686), [GH 25160](https://github.com/pandas-dev/pandas/issues/25160), [GH 24784](https://github.com/pandas-dev/pandas/issues/24784)) +* Bug where [`DataFrame.boxplot()`](../reference/api/pandas.DataFrame.boxplot.html#pandas.DataFrame.boxplot "pandas.DataFrame.boxplot") would not accept a `color` parameter like [`DataFrame.plot.box()`](../reference/api/pandas.DataFrame.plot.box.html#pandas.DataFrame.plot.box "pandas.DataFrame.plot.box") ([GH 26214](https://github.com/pandas-dev/pandas/issues/26214)) +* Bug in the `xticks` argument being ignored for [`DataFrame.plot.bar()`](../reference/api/pandas.DataFrame.plot.bar.html#pandas.DataFrame.plot.bar "pandas.DataFrame.plot.bar") ([GH 14119](https://github.com/pandas-dev/pandas/issues/14119)) +* [`set_option()`](../reference/api/pandas.set_option.html#pandas.set_option "pandas.set_option") now validates that the plot backend provided to `'plotting.backend'` implements the backend when the option is set, rather than when a plot is created ([GH 28163](https://github.com/pandas-dev/pandas/issues/28163)) +* [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") now allow a `backend` keyword argument to allow changing between backends in one session ([GH 28619](https://github.com/pandas-dev/pandas/issues/28619)). +* Bug in color validation incorrectly raising for non-color styles ([GH 29122](https://github.com/pandas-dev/pandas/issues/29122)). +* Allow [`DataFrame.plot.scatter()`](../reference/api/pandas.DataFrame.plot.scatter.html#pandas.DataFrame.plot.scatter "pandas.DataFrame.plot.scatter") to plot `objects` and `datetime` type data ([GH 18755](https://github.com/pandas-dev/pandas/issues/18755), [GH 30391](https://github.com/pandas-dev/pandas/issues/30391)) +* Bug in [`DataFrame.hist()`](../reference/api/pandas.DataFrame.hist.html#pandas.DataFrame.hist "pandas.DataFrame.hist"), `xrot=0` does not work with `by` and subplots ([GH 30288](https://github.com/pandas-dev/pandas/issues/30288)). + +### GroupBy/resample/rolling[#](#groupby-resample-rolling "Link to this heading") + +* Bug in [`core.groupby.DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") only showing output from a single group when function returns an [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") ([GH 28652](https://github.com/pandas-dev/pandas/issues/28652)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") with multiple groups where an `IndexError` would be raised if any group contained all NA values ([GH 20519](https://github.com/pandas-dev/pandas/issues/20519)) +* Bug in [`Resampler.size()`](../reference/api/pandas.core.resample.Resampler.size.html#pandas.core.resample.Resampler.size "pandas.core.resample.Resampler.size") and [`Resampler.count()`](../reference/api/pandas.core.resample.Resampler.count.html#pandas.core.resample.Resampler.count "pandas.core.resample.Resampler.count") returning wrong dtype when used with an empty [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 28427](https://github.com/pandas-dev/pandas/issues/28427)) +* Bug in [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") not allowing for rolling over datetimes when `axis=1` ([GH 28192](https://github.com/pandas-dev/pandas/issues/28192)) +* Bug in [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") not allowing rolling over multi-index levels ([GH 15584](https://github.com/pandas-dev/pandas/issues/15584)). +* Bug in [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") not allowing rolling on monotonic decreasing time indexes ([GH 19248](https://github.com/pandas-dev/pandas/issues/19248)). +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") not offering selection by column name when `axis=1` ([GH 27614](https://github.com/pandas-dev/pandas/issues/27614)) +* Bug in `core.groupby.DataFrameGroupby.agg()` not able to use lambda function with named aggregation ([GH 27519](https://github.com/pandas-dev/pandas/issues/27519)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") losing column name information when grouping by a categorical column ([GH 28787](https://github.com/pandas-dev/pandas/issues/28787)) +* Remove error raised due to duplicated input functions in named aggregation in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") and [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby"). Previously error will be raised if the same function is applied on the same column and now it is allowed if new assigned names are different. ([GH 28426](https://github.com/pandas-dev/pandas/issues/28426)) +* [`core.groupby.SeriesGroupBy.value_counts()`](../reference/api/pandas.core.groupby.SeriesGroupBy.value_counts.html#pandas.core.groupby.SeriesGroupBy.value_counts "pandas.core.groupby.SeriesGroupBy.value_counts") will be able to handle the case even when the [`Grouper`](../reference/api/pandas.Grouper.html#pandas.Grouper "pandas.Grouper") makes empty groups ([GH 28479](https://github.com/pandas-dev/pandas/issues/28479)) +* Bug in [`core.window.rolling.Rolling.quantile()`](../reference/api/pandas.core.window.rolling.Rolling.quantile.html#pandas.core.window.rolling.Rolling.quantile "pandas.core.window.rolling.Rolling.quantile") ignoring `interpolation` keyword argument when used within a groupby ([GH 28779](https://github.com/pandas-dev/pandas/issues/28779)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") where `any`, `all`, `nunique` and transform functions would incorrectly handle duplicate column labels ([GH 21668](https://github.com/pandas-dev/pandas/issues/21668)) +* Bug in [`core.groupby.DataFrameGroupBy.agg()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg") with timezone-aware datetime64 column incorrectly casting results to the original dtype ([GH 29641](https://github.com/pandas-dev/pandas/issues/29641)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") when using axis=1 and having a single level columns index ([GH 30208](https://github.com/pandas-dev/pandas/issues/30208)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") when using nunique on axis=1 ([GH 30253](https://github.com/pandas-dev/pandas/issues/30253)) +* Bug in [`DataFrameGroupBy.quantile()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.quantile.html#pandas.core.groupby.DataFrameGroupBy.quantile "pandas.core.groupby.DataFrameGroupBy.quantile") and [`SeriesGroupBy.quantile()`](../reference/api/pandas.core.groupby.SeriesGroupBy.quantile.html#pandas.core.groupby.SeriesGroupBy.quantile "pandas.core.groupby.SeriesGroupBy.quantile") with multiple list-like q value and integer column names ([GH 30289](https://github.com/pandas-dev/pandas/issues/30289)) +* Bug in [`DataFrameGroupBy.pct_change()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.pct_change.html#pandas.core.groupby.DataFrameGroupBy.pct_change "pandas.core.groupby.DataFrameGroupBy.pct_change") and [`SeriesGroupBy.pct_change()`](../reference/api/pandas.core.groupby.SeriesGroupBy.pct_change.html#pandas.core.groupby.SeriesGroupBy.pct_change "pandas.core.groupby.SeriesGroupBy.pct_change") causes `TypeError` when `fill_method` is `None` ([GH 30463](https://github.com/pandas-dev/pandas/issues/30463)) +* Bug in `Rolling.count()` and `Expanding.count()` argument where `min_periods` was ignored ([GH 26996](https://github.com/pandas-dev/pandas/issues/26996)) + +### Reshaping[#](#reshaping "Link to this heading") + +* Bug in [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") that caused incorrect output with empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 28202](https://github.com/pandas-dev/pandas/issues/28202), [GH 21959](https://github.com/pandas-dev/pandas/issues/21959)) +* Bug in [`DataFrame.stack()`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack") not handling non-unique indexes correctly when creating MultiIndex ([GH 28301](https://github.com/pandas-dev/pandas/issues/28301)) +* Bug in [`pivot_table()`](../reference/api/pandas.pivot_table.html#pandas.pivot_table "pandas.pivot_table") not returning correct type `float` when `margins=True` and `aggfunc='mean'` ([GH 24893](https://github.com/pandas-dev/pandas/issues/24893)) +* Bug [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") could not use [`datetime.timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta "(in Python v3.13)") for `tolerance` kwarg ([GH 28098](https://github.com/pandas-dev/pandas/issues/28098)) +* Bug in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge"), did not append suffixes correctly with MultiIndex ([GH 28518](https://github.com/pandas-dev/pandas/issues/28518)) +* [`qcut()`](../reference/api/pandas.qcut.html#pandas.qcut "pandas.qcut") and [`cut()`](../reference/api/pandas.cut.html#pandas.cut "pandas.cut") now handle boolean input ([GH 20303](https://github.com/pandas-dev/pandas/issues/20303)) +* Fix to ensure all int dtypes can be used in [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") when using a tolerance value. Previously every non-int64 type would raise an erroneous `MergeError` ([GH 28870](https://github.com/pandas-dev/pandas/issues/28870)). +* Better error message in [`get_dummies()`](../reference/api/pandas.get_dummies.html#pandas.get_dummies "pandas.get_dummies") when `columns` isn’t a list-like value ([GH 28383](https://github.com/pandas-dev/pandas/issues/28383)) +* Bug in [`Index.join()`](../reference/api/pandas.Index.join.html#pandas.Index.join "pandas.Index.join") that caused infinite recursion error for mismatched `MultiIndex` name orders. ([GH 25760](https://github.com/pandas-dev/pandas/issues/25760), [GH 28956](https://github.com/pandas-dev/pandas/issues/28956)) +* Bug [`Series.pct_change()`](../reference/api/pandas.Series.pct_change.html#pandas.Series.pct_change "pandas.Series.pct_change") where supplying an anchored frequency would throw a `ValueError` ([GH 28664](https://github.com/pandas-dev/pandas/issues/28664)) +* Bug where [`DataFrame.equals()`](../reference/api/pandas.DataFrame.equals.html#pandas.DataFrame.equals "pandas.DataFrame.equals") returned True incorrectly in some cases when two DataFrames had the same columns in different orders ([GH 28839](https://github.com/pandas-dev/pandas/issues/28839)) +* Bug in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") that caused non-numeric replacer’s dtype not respected ([GH 26632](https://github.com/pandas-dev/pandas/issues/26632)) +* Bug in [`melt()`](../reference/api/pandas.melt.html#pandas.melt "pandas.melt") where supplying mixed strings and numeric values for `id_vars` or `value_vars` would incorrectly raise a `ValueError` ([GH 29718](https://github.com/pandas-dev/pandas/issues/29718)) +* Dtypes are now preserved when transposing a `DataFrame` where each column is the same extension dtype ([GH 30091](https://github.com/pandas-dev/pandas/issues/30091)) +* Bug in [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") merging on a tz-aware `left_index` and `right_on` a tz-aware column ([GH 29864](https://github.com/pandas-dev/pandas/issues/29864)) +* Improved error message and docstring in [`cut()`](../reference/api/pandas.cut.html#pandas.cut "pandas.cut") and [`qcut()`](../reference/api/pandas.qcut.html#pandas.qcut "pandas.qcut") when `labels=True` ([GH 13318](https://github.com/pandas-dev/pandas/issues/13318)) +* Bug in missing `fill_na` parameter to [`DataFrame.unstack()`](../reference/api/pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack") with list of levels ([GH 30740](https://github.com/pandas-dev/pandas/issues/30740)) + +### Sparse[#](#sparse "Link to this heading") + +* Bug in `SparseDataFrame` arithmetic operations incorrectly casting inputs to float ([GH 28107](https://github.com/pandas-dev/pandas/issues/28107)) +* Bug in `DataFrame.sparse` returning a `Series` when there was a column named `sparse` rather than the accessor ([GH 30758](https://github.com/pandas-dev/pandas/issues/30758)) +* Fixed `operator.xor()` with a boolean-dtype `SparseArray`. Now returns a sparse result, rather than object dtype ([GH 31025](https://github.com/pandas-dev/pandas/issues/31025)) + +### ExtensionArray[#](#extensionarray "Link to this heading") + +* Bug in `arrays.PandasArray` when setting a scalar string ([GH 28118](https://github.com/pandas-dev/pandas/issues/28118), [GH 28150](https://github.com/pandas-dev/pandas/issues/28150)). +* Bug where nullable integers could not be compared to strings ([GH 28930](https://github.com/pandas-dev/pandas/issues/28930)) +* Bug where [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor raised `ValueError` with list-like data and `dtype` specified ([GH 30280](https://github.com/pandas-dev/pandas/issues/30280)) + +### Other[#](#other "Link to this heading") + +* Trying to set the `display.precision`, `display.max_rows` or `display.max_columns` using [`set_option()`](../reference/api/pandas.set_option.html#pandas.set_option "pandas.set_option") to anything but a `None` or a positive int will raise a `ValueError` ([GH 23348](https://github.com/pandas-dev/pandas/issues/23348)) +* Using [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") with overlapping keys in a nested dictionary will no longer raise, now matching the behavior of a flat dictionary ([GH 27660](https://github.com/pandas-dev/pandas/issues/27660)) +* [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") and [`Series.to_csv()`](../reference/api/pandas.Series.to_csv.html#pandas.Series.to_csv "pandas.Series.to_csv") now support dicts as `compression` argument with key `'method'` being the compression method and others as additional compression options when the compression method is `'zip'`. ([GH 26023](https://github.com/pandas-dev/pandas/issues/26023)) +* Bug in [`Series.diff()`](../reference/api/pandas.Series.diff.html#pandas.Series.diff "pandas.Series.diff") where a boolean series would incorrectly raise a `TypeError` ([GH 17294](https://github.com/pandas-dev/pandas/issues/17294)) +* `Series.append()` will no longer raise a `TypeError` when passed a tuple of `Series` ([GH 28410](https://github.com/pandas-dev/pandas/issues/28410)) +* Fix corrupted error message when calling `pandas.libs._json.encode()` on a 0d array ([GH 18878](https://github.com/pandas-dev/pandas/issues/18878)) +* Backtick quoting in [`DataFrame.query()`](../reference/api/pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") and [`DataFrame.eval()`](../reference/api/pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval") can now also be used to use invalid identifiers like names that start with a digit, are python keywords, or are using single character operators. ([GH 27017](https://github.com/pandas-dev/pandas/issues/27017)) +* Bug in `pd.core.util.hashing.hash_pandas_object` where arrays containing tuples were incorrectly treated as non-hashable ([GH 28969](https://github.com/pandas-dev/pandas/issues/28969)) +* Bug in `DataFrame.append()` that raised `IndexError` when appending with empty list ([GH 28769](https://github.com/pandas-dev/pandas/issues/28769)) +* Fix `AbstractHolidayCalendar` to return correct results for + years after 2030 (now goes up to 2200) ([GH 27790](https://github.com/pandas-dev/pandas/issues/27790)) +* Fixed [`IntegerArray`](../reference/api/pandas.arrays.IntegerArray.html#pandas.arrays.IntegerArray "pandas.arrays.IntegerArray") returning `inf` rather than `NaN` for operations dividing by `0` ([GH 27398](https://github.com/pandas-dev/pandas/issues/27398)) +* Fixed `pow` operations for [`IntegerArray`](../reference/api/pandas.arrays.IntegerArray.html#pandas.arrays.IntegerArray "pandas.arrays.IntegerArray") when the other value is `0` or `1` ([GH 29997](https://github.com/pandas-dev/pandas/issues/29997)) +* Bug in [`Series.count()`](../reference/api/pandas.Series.count.html#pandas.Series.count "pandas.Series.count") raises if use\_inf\_as\_na is enabled ([GH 29478](https://github.com/pandas-dev/pandas/issues/29478)) +* Bug in [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") where a non-hashable name could be set without raising `TypeError` ([GH 29069](https://github.com/pandas-dev/pandas/issues/29069)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor when passing a 2D `ndarray` and an extension dtype ([GH 12513](https://github.com/pandas-dev/pandas/issues/12513)) +* Bug in [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") when supplied a series with a `dtype="string"` and a `na_rep`, the `na_rep` was being truncated to 2 characters. ([GH 29975](https://github.com/pandas-dev/pandas/issues/29975)) +* Bug where [`DataFrame.itertuples()`](../reference/api/pandas.DataFrame.itertuples.html#pandas.DataFrame.itertuples "pandas.DataFrame.itertuples") would incorrectly determine whether or not namedtuples could be used for dataframes of 255 columns ([GH 28282](https://github.com/pandas-dev/pandas/issues/28282)) +* Handle nested NumPy `object` arrays in [`testing.assert_series_equal()`](../reference/api/pandas.testing.assert_series_equal.html#pandas.testing.assert_series_equal "pandas.testing.assert_series_equal") for ExtensionArray implementations ([GH 30841](https://github.com/pandas-dev/pandas/issues/30841)) +* Bug in [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") constructor incorrectly allowing 2-dimensional input arrays ([GH 13601](https://github.com/pandas-dev/pandas/issues/13601), [GH 27125](https://github.com/pandas-dev/pandas/issues/27125)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 308 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Aaditya Panikath + +* Abdullah İhsan Seçer +* Abhijeet Krishnan + +* Adam J. Stewart +* Adam Klaum + +* Addison Lynch +* Aivengoe + +* Alastair James + +* Albert Villanova del Moral +* Alex Kirko + +* Alfredo Granja + +* Allen Downey +* Alp Arıbal + +* Andreas Buhr + +* Andrew Munch + +* Andy +* Angela Ambroz + +* Aniruddha Bhattacharjee + +* Ankit Dhankhar + +* Antonio Andraues Jr + +* Arda Kosar + +* Asish Mahapatra + +* Austin Hackett + +* Avi Kelman + +* AyowoleT + +* Bas Nijholt + +* Ben Thayer +* Bharat Raghunathan +* Bhavani Ravi +* Bhuvana KA + +* Big Head +* Blake Hawkins + +* Bobae Kim + +* Brett Naul +* Brian Wignall +* Bruno P. Kinoshita + +* Bryant Moscon + +* Cesar H + +* Chris Stadler +* Chris Zimmerman + +* Christopher Whelan +* Clemens Brunner +* Clemens Tolboom + +* Connor Charles + +* Daniel Hähnke + +* Daniel Saxton +* Darin Plutchok + +* Dave Hughes +* David Stansby +* DavidRosen + +* Dean + +* Deepan Das + +* Deepyaman Datta +* DorAmram + +* Dorothy Kabarozi + +* Drew Heenan + +* Eliza Mae Saret + +* Elle + +* Endre Mark Borza + +* Eric Brassell + +* Eric Wong + +* Eunseop Jeong + +* Eyden Villanueva + +* Felix Divo +* ForTimeBeing + +* Francesco Truzzi + +* Gabriel Corona + +* Gabriel Monteiro + +* Galuh Sahid + +* Georgi Baychev + +* Gina +* GiuPassarelli + +* Grigorios Giannakopoulos + +* Guilherme Leite + +* Guilherme Salomé + +* Gyeongjae Choi + +* Harshavardhan Bachina + +* Harutaka Kawamura + +* Hassan Kibirige +* Hielke Walinga +* Hubert +* Hugh Kelley + +* Ian Eaves + +* Ignacio Santolin + +* Igor Filippov + +* Irv Lustig +* Isaac Virshup + +* Ivan Bessarabov + +* JMBurley + +* Jack Bicknell + +* Jacob Buckheit + +* Jan Koch +* Jan Pipek + +* Jan Škoda + +* Jan-Philip Gehrcke +* Jasper J.F. van den Bosch + +* Javad + +* Jeff Reback +* Jeremy Schendel +* Jeroen Kant + +* Jesse Pardue + +* Jethro Cao + +* Jiang Yue +* Jiaxiang + +* Jihyung Moon + +* Jimmy Callin +* Jinyang Zhou + +* Joao Victor Martinelli + +* Joaq Almirante + +* John G Evans + +* John Ward + +* Jonathan Larkin + +* Joris Van den Bossche +* Josh Dimarsky + +* Joshua Smith + +* Josiah Baker + +* Julia Signell + +* Jung Dong Ho + +* Justin Cole + +* Justin Zheng +* Kaiqi Dong +* Karthigeyan + +* Katherine Younglove + +* Katrin Leinweber +* Kee Chong Tan + +* Keith Kraus + +* Kevin Nguyen + +* Kevin Sheppard +* Kisekka David + +* Koushik + +* Kyle Boone + +* Kyle McCahill + +* Laura Collard, PhD + +* LiuSeeker + +* Louis Huynh + +* Lucas Scarlato Astur + +* Luiz Gustavo + +* Luke + +* Luke Shepard + +* MKhalusova + +* Mabel Villalba +* Maciej J + +* Mak Sze Chun +* Manu NALEPA + +* Marc +* Marc Garcia +* Marco Gorelli + +* Marco Neumann + +* Martin Winkel + +* Martina G. Vilas + +* Mateusz + +* Matthew Roeschke +* Matthew Tan + +* Max Bolingbroke +* Max Chen + +* MeeseeksMachine +* Miguel + +* MinGyo Jung + +* Mohamed Amine ZGHAL + +* Mohit Anand + +* MomIsBestFriend + +* Naomi Bonnin + +* Nathan Abel + +* Nico Cernek + +* Nigel Markey + +* Noritada Kobayashi + +* Oktay Sabak + +* Oliver Hofkens + +* Oluokun Adedayo + +* Osman + +* Oğuzhan Öğreden + +* Pandas Development Team + +* Patrik Hlobil + +* Paul Lee + +* Paul Siegel + +* Petr Baev + +* Pietro Battiston +* Prakhar Pandey + +* Puneeth K + +* Raghav + +* Rajat + +* Rajhans Jadhao + +* Rajiv Bharadwaj + +* Rik-de-Kort + +* Roei.r +* Rohit Sanjay + +* Ronan Lamy + +* Roshni + +* Roymprog + +* Rushabh Vasani + +* Ryan Grout + +* Ryan Nazareth +* Samesh Lakhotia + +* Samuel Sinayoko +* Samyak Jain + +* Sarah Donehower + +* Sarah Masud + +* Saul Shanabrook + +* Scott Cole + +* SdgJlbl + +* Seb + +* Sergei Ivko + +* Shadi Akiki +* Shorokhov Sergey +* Siddhesh Poyarekar + +* Sidharthan Nair + +* Simon Gibbons +* Simon Hawkins +* Simon-Martin Schröder + +* Sofiane Mahiou + +* Sourav kumar + +* Souvik Mandal + +* Soyoun Kim + +* Sparkle Russell-Puleri + +* Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) +* Stuart Berg + +* Sumanau Sareen +* Szymon Bednarek + +* Tambe Tabitha Achere + +* Tan Tran +* Tang Heyi + +* Tanmay Daripa + +* Tanya Jain +* Terji Petersen +* Thomas Li + +* Tirth Jain + +* Tola A + +* Tom Augspurger +* Tommy Lynch + +* Tomoyuki Suzuki + +* Tony Lorenzo +* Unprocessable + +* Uwe L. Korn +* Vaibhav Vishal +* Victoria Zdanovskaya + +* Vijayant + +* Vishwak Srinivasan + +* WANG Aiyong +* Wenhuan +* Wes McKinney +* Will Ayd +* Will Holmgren +* William Ayd +* William Blan + +* Wouter Overmeire +* Wuraola Oyewusi + +* YaOzI + +* Yash Shukla + +* Yu Wang + +* Yusei Tahara + +* alexander135 + +* alimcmaster1 +* avelineg + +* bganglia + +* bolkedebruin +* bravech + +* chinhwee + +* cruzzoe + +* dalgarno + +* daniellebrown + +* danielplawrence +* est271 + +* francisco souza + +* ganevgv + +* garanews + +* gfyoung +* h-vetinari +* hasnain2808 + +* ianzur + +* jalbritt + +* jbrockmendel +* jeschwar + +* jlamborn324 + +* joy-rosie + +* kernc +* killerontherun1 +* krey + +* lexy-lixinyu + +* lucyleeow + +* lukasbk + +* maheshbapatu + +* mck619 + +* nathalier +* naveenkaushik2504 + +* nlepleux + +* nrebena +* ohad83 + +* pilkibun +* pqzx + +* proost + +* pv8493013j + +* qudade + +* rhstanton + +* rmunjal29 + +* sangarshanan + +* sardonick + +* saskakarsi + +* shaido987 + +* ssikdar1 +* steveayers124 + +* tadashigaki + +* timcera + +* tlaytongoogle + +* tobycheese +* tonywu1999 + +* tsvikas + +* yogendrasoni + +* zys5945 + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.0.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.0.1.md new file mode 100644 index 0000000000000000000000000000000000000000..034ecba6fa947d96b5fe6d299db2d72065b621c0 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.0.1.md @@ -0,0 +1,75 @@ +# What's new in pandas 1.0.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.0.1.html + +# What’s new in 1.0.1 (February 5, 2020)[#](#what-s-new-in-1-0-1-february-5-2020 "Link to this heading") + +These are the changes in pandas 1.0.1. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") setting values with a slice (e.g. `df[-4:] = 1`) indexing by label instead of position ([GH 31469](https://github.com/pandas-dev/pandas/issues/31469)) +* Fixed regression when indexing a `Series` or `DataFrame` indexed by `DatetimeIndex` with a slice containing a [`datetime.date`](https://docs.python.org/3/library/datetime.html#datetime.date "(in Python v3.13)") ([GH 31501](https://github.com/pandas-dev/pandas/issues/31501)) +* Fixed regression in `DataFrame.__setitem__` raising an `AttributeError` with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") and a non-monotonic indexer ([GH 31449](https://github.com/pandas-dev/pandas/issues/31449)) +* Fixed regression in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") multiplication when multiplying a numeric [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with >10000 elements with a timedelta-like scalar ([GH 31457](https://github.com/pandas-dev/pandas/issues/31457)) +* Fixed regression in `.groupby().agg()` raising an `AssertionError` for some reductions like `min` on object-dtype columns ([GH 31522](https://github.com/pandas-dev/pandas/issues/31522)) +* Fixed regression in `.groupby()` aggregations with categorical dtype using Cythonized reduction functions (e.g. `first`) ([GH 31450](https://github.com/pandas-dev/pandas/issues/31450)) +* Fixed regression in [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") and [`SeriesGroupBy.apply()`](../reference/api/pandas.core.groupby.SeriesGroupBy.apply.html#pandas.core.groupby.SeriesGroupBy.apply "pandas.core.groupby.SeriesGroupBy.apply") if called with a function which returned a non-pandas non-scalar object (e.g. a list or numpy array) ([GH 31441](https://github.com/pandas-dev/pandas/issues/31441)) +* Fixed regression in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") whereby taking the minimum or maximum of a column with period dtype would raise a `TypeError`. ([GH 31471](https://github.com/pandas-dev/pandas/issues/31471)) +* Fixed regression in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") with an empty DataFrame grouping by a level of a MultiIndex ([GH 31670](https://github.com/pandas-dev/pandas/issues/31670)). +* Fixed regression in [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") with object dtype and non-reducing function ([GH 31505](https://github.com/pandas-dev/pandas/issues/31505)) +* Fixed regression in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") when parsing non-nanosecond resolution datetimes ([GH 31491](https://github.com/pandas-dev/pandas/issues/31491)) +* Fixed regression in [`to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") where specifying an `na_rep` might truncate the values written ([GH 31447](https://github.com/pandas-dev/pandas/issues/31447)) +* Fixed regression in [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") construction with `numpy.str_` categories ([GH 31499](https://github.com/pandas-dev/pandas/issues/31499)) +* Fixed regression in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") and [`DataFrame.iloc()`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") when selecting a row containing a single `datetime64` or `timedelta64` column ([GH 31649](https://github.com/pandas-dev/pandas/issues/31649)) +* Fixed regression where setting `pd.options.display.max_colwidth` was not accepting negative integer. In addition, this behavior has been deprecated in favor of using `None` ([GH 31532](https://github.com/pandas-dev/pandas/issues/31532)) +* Fixed regression in objTOJSON.c fix return-type warning ([GH 31463](https://github.com/pandas-dev/pandas/issues/31463)) +* Fixed regression in [`qcut()`](../reference/api/pandas.qcut.html#pandas.qcut "pandas.qcut") when passed a nullable integer. ([GH 31389](https://github.com/pandas-dev/pandas/issues/31389)) +* Fixed regression in assigning to a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") using a nullable integer dtype ([GH 31446](https://github.com/pandas-dev/pandas/issues/31446)) +* Fixed performance regression when indexing a `DataFrame` or `Series` with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") for the index using a list of labels ([GH 31648](https://github.com/pandas-dev/pandas/issues/31648)) +* Fixed regression in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") used in file like object `RawIOBase` is not recognize `encoding` option ([GH 31575](https://github.com/pandas-dev/pandas/issues/31575)) + +## Deprecations[#](#deprecations "Link to this heading") + +* Support for negative integer for `pd.options.display.max_colwidth` is deprecated in favor of using `None` ([GH 31532](https://github.com/pandas-dev/pandas/issues/31532)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +**Datetimelike** + +* Fixed bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") raising when `cache=True` and out-of-bound values are present ([GH 31491](https://github.com/pandas-dev/pandas/issues/31491)) + +**Numeric** + +* Bug in dtypes being lost in `DataFrame.__invert__` (`~` operator) with mixed dtypes ([GH 31183](https://github.com/pandas-dev/pandas/issues/31183)) + and for extension-array backed `Series` and `DataFrame` ([GH 23087](https://github.com/pandas-dev/pandas/issues/23087)) + +**Plotting** + +* Plotting tz-aware timeseries no longer gives UserWarning ([GH 31205](https://github.com/pandas-dev/pandas/issues/31205)) + +**Interval** + +* Bug in [`Series.shift()`](../reference/api/pandas.Series.shift.html#pandas.Series.shift "pandas.Series.shift") with `interval` dtype raising a `TypeError` when shifting an interval array of integers or datetimes ([GH 34195](https://github.com/pandas-dev/pandas/issues/34195)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 15 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Daniel Saxton +* Guillaume Lemaitre +* Jeff Reback +* Joris Van den Bossche +* Kaiqi Dong +* Marco Gorelli +* MeeseeksMachine +* Pandas Development Team +* Sebastián Vanrell + +* Tom Augspurger +* William Ayd +* alimcmaster1 +* jbrockmendel +* paihu + +* proost diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.0.2.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.0.2.md new file mode 100644 index 0000000000000000000000000000000000000000..6c6465001bb83384506a9790b8d067c691c6cef9 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.0.2.md @@ -0,0 +1,151 @@ +# What's new in pandas 1.0.2 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.0.2.html + +# What’s new in 1.0.2 (March 12, 2020)[#](#what-s-new-in-1-0-2-march-12-2020 "Link to this heading") + +These are the changes in pandas 1.0.2. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +**Groupby** + +* Fixed regression in [`DataFrameGroupBy.agg()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg") and [`SeriesGroupBy.agg()`](../reference/api/pandas.core.groupby.SeriesGroupBy.agg.html#pandas.core.groupby.SeriesGroupBy.agg "pandas.core.groupby.SeriesGroupBy.agg") which were failing on frames with [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") columns and a custom function ([GH 31777](https://github.com/pandas-dev/pandas/issues/31777)) +* Fixed regression in `groupby(..).rolling(..).apply()` (`RollingGroupby`) where the `raw` parameter was ignored ([GH 31754](https://github.com/pandas-dev/pandas/issues/31754)) +* Fixed regression in [`rolling(..).corr()`](../reference/api/pandas.core.window.rolling.Rolling.corr.html#pandas.core.window.rolling.Rolling.corr "pandas.core.window.rolling.Rolling.corr") when using a time offset ([GH 31789](https://github.com/pandas-dev/pandas/issues/31789)) +* Fixed regression in [`groupby(..).nunique()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.nunique.html#pandas.core.groupby.DataFrameGroupBy.nunique "pandas.core.groupby.DataFrameGroupBy.nunique") which was modifying the original values if `NaN` values were present ([GH 31950](https://github.com/pandas-dev/pandas/issues/31950)) +* Fixed regression in `DataFrame.groupby` raising a `ValueError` from an internal operation ([GH 31802](https://github.com/pandas-dev/pandas/issues/31802)) +* Fixed regression in [`DataFrameGroupBy.agg()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg") and [`SeriesGroupBy.agg()`](../reference/api/pandas.core.groupby.SeriesGroupBy.agg.html#pandas.core.groupby.SeriesGroupBy.agg "pandas.core.groupby.SeriesGroupBy.agg") calling a user-provided function an extra time on an empty input ([GH 31760](https://github.com/pandas-dev/pandas/issues/31760)) + +**I/O** + +* Fixed regression in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") in which the `encoding` option was not recognized with certain file-like objects ([GH 31819](https://github.com/pandas-dev/pandas/issues/31819)) +* Fixed regression in [`DataFrame.to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel") when the `columns` keyword argument is passed ([GH 31677](https://github.com/pandas-dev/pandas/issues/31677)) +* Fixed regression in [`ExcelFile`](../reference/api/pandas.ExcelFile.html#pandas.ExcelFile "pandas.ExcelFile") where the stream passed into the function was closed by the destructor. ([GH 31467](https://github.com/pandas-dev/pandas/issues/31467)) +* Fixed regression where [`read_pickle()`](../reference/api/pandas.read_pickle.html#pandas.read_pickle "pandas.read_pickle") raised a `UnicodeDecodeError` when reading a py27 pickle with [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") column ([GH 31988](https://github.com/pandas-dev/pandas/issues/31988)). + +**Reindexing/alignment** + +* Fixed regression in [`Series.align()`](../reference/api/pandas.Series.align.html#pandas.Series.align "pandas.Series.align") when `other` is a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and `method` is not `None` ([GH 31785](https://github.com/pandas-dev/pandas/issues/31785)) +* Fixed regression in [`DataFrame.reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex") and [`Series.reindex()`](../reference/api/pandas.Series.reindex.html#pandas.Series.reindex "pandas.Series.reindex") when reindexing with (tz-aware) index and `method=nearest` ([GH 26683](https://github.com/pandas-dev/pandas/issues/26683)) +* Fixed regression in [`DataFrame.reindex_like()`](../reference/api/pandas.DataFrame.reindex_like.html#pandas.DataFrame.reindex_like "pandas.DataFrame.reindex_like") on a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") subclass raised an `AssertionError` ([GH 31925](https://github.com/pandas-dev/pandas/issues/31925)) +* Fixed regression in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") arithmetic operations with mis-matched columns ([GH 31623](https://github.com/pandas-dev/pandas/issues/31623)) + +**Other** + +* Fixed regression in joining on [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") or [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") to preserve `freq` in simple cases ([GH 32166](https://github.com/pandas-dev/pandas/issues/32166)) +* Fixed regression in [`Series.shift()`](../reference/api/pandas.Series.shift.html#pandas.Series.shift "pandas.Series.shift") with `datetime64` dtype when passing an integer `fill_value` ([GH 32591](https://github.com/pandas-dev/pandas/issues/32591)) +* Fixed regression in the repr of an object-dtype [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with bools and missing values ([GH 32146](https://github.com/pandas-dev/pandas/issues/32146)) + +## Indexing with nullable boolean arrays[#](#indexing-with-nullable-boolean-arrays "Link to this heading") + +Previously indexing with a nullable Boolean array containing `NA` would raise a `ValueError`, however this is now permitted with `NA` being treated as `False`. ([GH 31503](https://github.com/pandas-dev/pandas/issues/31503)) + +```None +In [1]: s = pd.Series([1, 2, 3, 4]) + +In [2]: mask = pd.array([True, True, False, None], dtype="boolean") + +In [3]: s +Out[3]: +0 1 +1 2 +2 3 +3 4 +Length: 4, dtype: int64 + +In [4]: mask +Out[4]: + +[True, True, False, ] +Length: 4, dtype: boolean +``` + +*pandas 1.0.0-1.0.1* + +```None +>>> s[mask] +Traceback (most recent call last): +... +ValueError: cannot mask with array containing NA / NaN values +``` + +*pandas 1.0.2* + +```None +In [5]: s[mask] +Out[5]: +0 1 +1 2 +Length: 2, dtype: int64 +``` + +## Bug fixes[#](#bug-fixes "Link to this heading") + +**Datetimelike** + +* Bug in [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") not copying for tz-naive and tz-aware `datetime64` dtype ([GH 32490](https://github.com/pandas-dev/pandas/issues/32490)) +* Bug where [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") would raise when passed `pd.NA` ([GH 32213](https://github.com/pandas-dev/pandas/issues/32213)) +* Improved error message when subtracting two [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") that result in an out-of-bounds [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") ([GH 31774](https://github.com/pandas-dev/pandas/issues/31774)) + +**Categorical** + +* Fixed bug where [`Categorical.from_codes()`](../reference/api/pandas.Categorical.from_codes.html#pandas.Categorical.from_codes "pandas.Categorical.from_codes") improperly raised a `ValueError` when passed nullable integer codes. ([GH 31779](https://github.com/pandas-dev/pandas/issues/31779)) +* Fixed bug where [`Categorical()`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") constructor would raise a `TypeError` when given a numpy array containing `pd.NA`. ([GH 31927](https://github.com/pandas-dev/pandas/issues/31927)) +* Bug in [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") that would ignore or crash when calling [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") with a list-like `to_replace` ([GH 31720](https://github.com/pandas-dev/pandas/issues/31720)) + +**I/O** + +* Using `pd.NA` with [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") now correctly outputs a null value instead of an empty object ([GH 31615](https://github.com/pandas-dev/pandas/issues/31615)) +* Bug in [`pandas.json_normalize()`](../reference/api/pandas.json_normalize.html#pandas.json_normalize "pandas.json_normalize") when value in meta path is not iterable ([GH 31507](https://github.com/pandas-dev/pandas/issues/31507)) +* Fixed pickling of `pandas.NA`. Previously a new object was returned, which broke computations relying on `NA` being a singleton ([GH 31847](https://github.com/pandas-dev/pandas/issues/31847)) +* Fixed bug in parquet roundtrip with nullable unsigned integer dtypes ([GH 31896](https://github.com/pandas-dev/pandas/issues/31896)). + +**Experimental dtypes** + +* Fixed bug in [`DataFrame.convert_dtypes()`](../reference/api/pandas.DataFrame.convert_dtypes.html#pandas.DataFrame.convert_dtypes "pandas.DataFrame.convert_dtypes") for columns that were already using the `"string"` dtype ([GH 31731](https://github.com/pandas-dev/pandas/issues/31731)). +* Fixed bug in [`DataFrame.convert_dtypes()`](../reference/api/pandas.DataFrame.convert_dtypes.html#pandas.DataFrame.convert_dtypes "pandas.DataFrame.convert_dtypes") for series with mix of integers and strings ([GH 32117](https://github.com/pandas-dev/pandas/issues/32117)) +* Fixed bug in [`DataFrame.convert_dtypes()`](../reference/api/pandas.DataFrame.convert_dtypes.html#pandas.DataFrame.convert_dtypes "pandas.DataFrame.convert_dtypes") where `BooleanDtype` columns were converted to `Int64` ([GH 32287](https://github.com/pandas-dev/pandas/issues/32287)) +* Fixed bug in setting values using a slice indexer with string dtype ([GH 31772](https://github.com/pandas-dev/pandas/issues/31772)) +* Fixed bug where [`DataFrameGroupBy.first()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.first.html#pandas.core.groupby.DataFrameGroupBy.first "pandas.core.groupby.DataFrameGroupBy.first"), [`SeriesGroupBy.first()`](../reference/api/pandas.core.groupby.SeriesGroupBy.first.html#pandas.core.groupby.SeriesGroupBy.first "pandas.core.groupby.SeriesGroupBy.first"), [`DataFrameGroupBy.last()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.last.html#pandas.core.groupby.DataFrameGroupBy.last "pandas.core.groupby.DataFrameGroupBy.last"), and [`SeriesGroupBy.last()`](../reference/api/pandas.core.groupby.SeriesGroupBy.last.html#pandas.core.groupby.SeriesGroupBy.last "pandas.core.groupby.SeriesGroupBy.last") would raise a `TypeError` when groups contained `pd.NA` in a column of object dtype ([GH 32123](https://github.com/pandas-dev/pandas/issues/32123)) +* Fixed bug where `DataFrameGroupBy.mean()`, `DataFrameGroupBy.median()`, `DataFrameGroupBy.var()`, and `DataFrameGroupBy.std()` would raise a `TypeError` on `Int64` dtype columns ([GH 32219](https://github.com/pandas-dev/pandas/issues/32219)) + +**Strings** + +* Using `pd.NA` with [`Series.str.repeat()`](../reference/api/pandas.Series.str.repeat.html#pandas.Series.str.repeat "pandas.Series.str.repeat") now correctly outputs a null value instead of raising error for vector inputs ([GH 31632](https://github.com/pandas-dev/pandas/issues/31632)) + +**Rolling** + +* Fixed rolling operations with variable window (defined by time duration) on decreasing time index ([GH 32385](https://github.com/pandas-dev/pandas/issues/32385)). + +## Contributors[#](#contributors "Link to this heading") + +A total of 25 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Anna Daglis + +* Daniel Saxton +* Irv Lustig +* Jan Škoda +* Joris Van den Bossche +* Justin Zheng +* Kaiqi Dong +* Kendall Masse +* Marco Gorelli +* Matthew Roeschke +* MeeseeksMachine +* MomIsBestFriend +* Pandas Development Team +* Pedro Reys + +* Prakhar Pandey +* Robert de Vries + +* Rushabh Vasani +* Simon Hawkins +* Stijn Van Hoey +* Terji Petersen +* Tom Augspurger +* William Ayd +* alimcmaster1 +* gfyoung +* jbrockmendel diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.0.3.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.0.3.md new file mode 100644 index 0000000000000000000000000000000000000000..3259ef9896080a2004e93eab7f814fe2b85b25ca --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.0.3.md @@ -0,0 +1,26 @@ +# What's new in pandas 1.0.3 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.0.3.html + +# What’s new in 1.0.3 (March 17, 2020)[#](#what-s-new-in-1-0-3-march-17-2020 "Link to this heading") + +These are the changes in pandas 1.0.3. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in `resample.agg` when the underlying data is non-writeable ([GH 31710](https://github.com/pandas-dev/pandas/issues/31710)) +* Fixed regression in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") exponentiation with reindexing ([GH 32685](https://github.com/pandas-dev/pandas/issues/32685)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +## Contributors[#](#contributors "Link to this heading") + +A total of 5 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* MeeseeksMachine +* Pandas Development Team +* Tom Augspurger +* William Ayd +* jbrockmendel diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.0.4.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.0.4.md new file mode 100644 index 0000000000000000000000000000000000000000..759c461fc14fd956ee027c7a7479f2e26f296faf --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.0.4.md @@ -0,0 +1,59 @@ +# What's new in pandas 1.0.4 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.0.4.html + +# What’s new in 1.0.4 (May 28, 2020)[#](#what-s-new-in-1-0-4-may-28-2020 "Link to this heading") + +These are the changes in pandas 1.0.4. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fix regression where [`Series.isna()`](../reference/api/pandas.Series.isna.html#pandas.Series.isna "pandas.Series.isna") and [`DataFrame.isna()`](../reference/api/pandas.DataFrame.isna.html#pandas.DataFrame.isna "pandas.DataFrame.isna") would raise for categorical dtype when `pandas.options.mode.use_inf_as_na` was set to `True` ([GH 33594](https://github.com/pandas-dev/pandas/issues/33594)) +* Fix regression in [`DataFrameGroupBy.first()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.first.html#pandas.core.groupby.DataFrameGroupBy.first "pandas.core.groupby.DataFrameGroupBy.first"), [`SeriesGroupBy.first()`](../reference/api/pandas.core.groupby.SeriesGroupBy.first.html#pandas.core.groupby.SeriesGroupBy.first "pandas.core.groupby.SeriesGroupBy.first"), [`DataFrameGroupBy.last()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.last.html#pandas.core.groupby.DataFrameGroupBy.last "pandas.core.groupby.DataFrameGroupBy.last"), and [`SeriesGroupBy.last()`](../reference/api/pandas.core.groupby.SeriesGroupBy.last.html#pandas.core.groupby.SeriesGroupBy.last "pandas.core.groupby.SeriesGroupBy.last") where None is not preserved in object dtype ([GH 32800](https://github.com/pandas-dev/pandas/issues/32800)) +* Fix regression in DataFrame reductions using `numeric_only=True` and ExtensionArrays ([GH 33256](https://github.com/pandas-dev/pandas/issues/33256)). +* Fix performance regression in `memory_usage(deep=True)` for object dtype ([GH 33012](https://github.com/pandas-dev/pandas/issues/33012)) +* Fix regression where `Categorical.replace()` would replace with `NaN` whenever the new value and replacement value were equal ([GH 33288](https://github.com/pandas-dev/pandas/issues/33288)) +* Fix regression where an ordered [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") containing only `NaN` values would raise rather than returning `NaN` when taking the minimum or maximum ([GH 33450](https://github.com/pandas-dev/pandas/issues/33450)) +* Fix regression in `DataFrameGroupBy.agg()` with dictionary input losing `ExtensionArray` dtypes ([GH 32194](https://github.com/pandas-dev/pandas/issues/32194)) +* Fix to preserve the ability to index with the “nearest” method with xarray’s CFTimeIndex, an [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") subclass ([pydata/xarray#3751](https://github.com/pydata/xarray/issues/3751), [GH 32905](https://github.com/pandas-dev/pandas/issues/32905)). +* Fix regression in [`DataFrame.describe()`](../reference/api/pandas.DataFrame.describe.html#pandas.DataFrame.describe "pandas.DataFrame.describe") raising `TypeError: unhashable type: 'dict'` ([GH 32409](https://github.com/pandas-dev/pandas/issues/32409)) +* Fix regression in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") casts columns to `object` dtype if items in `to_replace` not in values ([GH 32988](https://github.com/pandas-dev/pandas/issues/32988)) +* Fix regression in [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") would raise `ValueError` when grouping by [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") level ([GH 34010](https://github.com/pandas-dev/pandas/issues/34010)) +* Fix regression in `DataFrameGroupBy.rolling.apply()` and `SeriesGroupBy.rolling.apply()` ignoring args and kwargs parameters ([GH 33433](https://github.com/pandas-dev/pandas/issues/33433)) +* Fix regression in error message with `np.min` or `np.max` on unordered [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") ([GH 33115](https://github.com/pandas-dev/pandas/issues/33115)) +* Fix regression in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") and [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") throwing an error when a `datetime64[ns, tz]` value is provided ([GH 32395](https://github.com/pandas-dev/pandas/issues/32395)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in `SeriesGroupBy.first()`, `SeriesGroupBy.last()`, `SeriesGroupBy.min()`, and `SeriesGroupBy.max()` returning floats when applied to nullable Booleans ([GH 33071](https://github.com/pandas-dev/pandas/issues/33071)) +* Bug in `Rolling.min()` and `Rolling.max()`: Growing memory usage after multiple calls when using a fixed window ([GH 30726](https://github.com/pandas-dev/pandas/issues/30726)) +* Bug in [`to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") was not raising `PermissionError` when writing to a private s3 bucket with invalid creds. ([GH 27679](https://github.com/pandas-dev/pandas/issues/27679)) +* Bug in [`to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") was silently failing when writing to an invalid s3 bucket. ([GH 32486](https://github.com/pandas-dev/pandas/issues/32486)) +* Bug in [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") was raising a `FileNotFoundError` when passed an s3 directory path. ([GH 26388](https://github.com/pandas-dev/pandas/issues/26388)) +* Bug in [`to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") was throwing an `AttributeError` when writing a partitioned parquet file to s3 ([GH 27596](https://github.com/pandas-dev/pandas/issues/27596)) +* Bug in [`DataFrameGroupBy.quantile()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.quantile.html#pandas.core.groupby.DataFrameGroupBy.quantile "pandas.core.groupby.DataFrameGroupBy.quantile") and [`SeriesGroupBy.quantile()`](../reference/api/pandas.core.groupby.SeriesGroupBy.quantile.html#pandas.core.groupby.SeriesGroupBy.quantile "pandas.core.groupby.SeriesGroupBy.quantile") causes the quantiles to be shifted when the `by` axis contains `NaN` ([GH 33200](https://github.com/pandas-dev/pandas/issues/33200), [GH 33569](https://github.com/pandas-dev/pandas/issues/33569)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 18 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Daniel Saxton +* JDkuba + +* Joris Van den Bossche +* Kaiqi Dong +* Mabel Villalba +* MeeseeksMachine +* MomIsBestFriend +* Pandas Development Team +* Simon Hawkins +* Spencer Clark + +* Tom Augspurger +* Vikas Pandey + +* alimcmaster1 +* h-vishal + +* jbrockmendel +* mproszewska + +* neilkg + +* rebecca-palmer + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.0.5.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.0.5.md new file mode 100644 index 0000000000000000000000000000000000000000..8656229a536b55b4c345de4af6e5c9715af0961b --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.0.5.md @@ -0,0 +1,38 @@ +# What's new in pandas 1.0.5 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.0.5.html + +# What’s new in 1.0.5 (June 17, 2020)[#](#what-s-new-in-1-0-5-june-17-2020 "Link to this heading") + +These are the changes in pandas 1.0.5. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fix regression in [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") when reading from file-like objects + ([GH 34467](https://github.com/pandas-dev/pandas/issues/34467)). +* Fix regression in reading from public S3 buckets ([GH 34626](https://github.com/pandas-dev/pandas/issues/34626)). + +Note this disables the ability to read Parquet files from directories on S3 +again ([GH 26388](https://github.com/pandas-dev/pandas/issues/26388), [GH 34632](https://github.com/pandas-dev/pandas/issues/34632)), which was added in the 1.0.4 release, +but is now targeted for pandas 1.1.0. + +* Fixed regression in [`replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") raising an `AssertionError` when replacing values in an extension dtype with values of a different dtype ([GH 34530](https://github.com/pandas-dev/pandas/issues/34530)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Fixed building from source with Python 3.8 fetching the wrong version of NumPy ([GH 34666](https://github.com/pandas-dev/pandas/issues/34666)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 8 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Joris Van den Bossche +* MeeseeksMachine +* Natalie Jann + +* Pandas Development Team +* Simon Hawkins +* Tom Augspurger +* William Ayd +* alimcmaster1 diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.1.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.1.0.md new file mode 100644 index 0000000000000000000000000000000000000000..8f28a6d377090fb5716e8d3cf5fe25990d9806f4 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.1.0.md @@ -0,0 +1,1790 @@ +# What's new in pandas 1.1.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.1.0.html + +# What’s new in 1.1.0 (July 28, 2020)[#](#what-s-new-in-1-1-0-july-28-2020 "Link to this heading") + +These are the changes in pandas 1.1.0. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Enhancements[#](#enhancements "Link to this heading") + +### KeyErrors raised by loc specify missing labels[#](#keyerrors-raised-by-loc-specify-missing-labels "Link to this heading") + +Previously, if labels were missing for a `.loc` call, a KeyError was raised stating that this was no longer supported. + +Now the error message also includes a list of the missing labels (max 10 items, display width 80 characters). See [GH 34272](https://github.com/pandas-dev/pandas/issues/34272). + +### All dtypes can now be converted to `StringDtype`[#](#all-dtypes-can-now-be-converted-to-stringdtype "Link to this heading") + +Previously, declaring or converting to [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") was in general only possible if the data was already only `str` or nan-like ([GH 31204](https://github.com/pandas-dev/pandas/issues/31204)). +[`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") now works in all situations where `astype(str)` or `dtype=str` work: + +For example, the below now works: + +```None +In [1]: ser = pd.Series([1, "abc", np.nan], dtype="string") + +In [2]: ser +Out[2]: +0 1 +1 abc +2 +Length: 3, dtype: string + +In [3]: ser[0] +Out[3]: '1' + +In [4]: pd.Series([1, 2, np.nan], dtype="Int64").astype("string") +Out[4]: +0 1 +1 2 +2 +Length: 3, dtype: string +``` + +### Non-monotonic PeriodIndex partial string slicing[#](#non-monotonic-periodindex-partial-string-slicing "Link to this heading") + +[`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") now supports partial string slicing for non-monotonic indexes, mirroring [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") behavior ([GH 31096](https://github.com/pandas-dev/pandas/issues/31096)) + +For example: + +```None +In [5]: dti = pd.date_range("2014-01-01", periods=30, freq="30D") + +In [6]: pi = dti.to_period("D") + +In [7]: ser_monotonic = pd.Series(np.arange(30), index=pi) + +In [8]: shuffler = list(range(0, 30, 2)) + list(range(1, 31, 2)) + +In [9]: ser = ser_monotonic.iloc[shuffler] + +In [10]: ser +Out[10]: +2014-01-01 0 +2014-03-02 2 +2014-05-01 4 +2014-06-30 6 +2014-08-29 8 + .. +2015-09-23 21 +2015-11-22 23 +2016-01-21 25 +2016-03-21 27 +2016-05-20 29 +Freq: D, Length: 30, dtype: int64 +``` + +```None +In [11]: ser["2014"] +Out[11]: +2014-01-01 0 +2014-03-02 2 +2014-05-01 4 +2014-06-30 6 +2014-08-29 8 +2014-10-28 10 +2014-12-27 12 +2014-01-31 1 +2014-04-01 3 +2014-05-31 5 +2014-07-30 7 +2014-09-28 9 +2014-11-27 11 +Freq: D, Length: 13, dtype: int64 + +In [12]: ser.loc["May 2015"] +Out[12]: +2015-05-26 17 +Freq: D, Length: 1, dtype: int64 +``` + +### Comparing two `DataFrame` or two `Series` and summarizing the differences[#](#comparing-two-dataframe-or-two-series-and-summarizing-the-differences "Link to this heading") + +We’ve added [`DataFrame.compare()`](../reference/api/pandas.DataFrame.compare.html#pandas.DataFrame.compare "pandas.DataFrame.compare") and [`Series.compare()`](../reference/api/pandas.Series.compare.html#pandas.Series.compare "pandas.Series.compare") for comparing two `DataFrame` or two `Series` ([GH 30429](https://github.com/pandas-dev/pandas/issues/30429)) + +```None +In [13]: df = pd.DataFrame( + ....: { + ....: "col1": ["a", "a", "b", "b", "a"], + ....: "col2": [1.0, 2.0, 3.0, np.nan, 5.0], + ....: "col3": [1.0, 2.0, 3.0, 4.0, 5.0] + ....: }, + ....: columns=["col1", "col2", "col3"], + ....: ) + ....: + +In [14]: df +Out[14]: + col1 col2 col3 +0 a 1.0 1.0 +1 a 2.0 2.0 +2 b 3.0 3.0 +3 b NaN 4.0 +4 a 5.0 5.0 + +[5 rows x 3 columns] +``` + +```None +In [15]: df2 = df.copy() + +In [16]: df2.loc[0, 'col1'] = 'c' + +In [17]: df2.loc[2, 'col3'] = 4.0 + +In [18]: df2 +Out[18]: + col1 col2 col3 +0 c 1.0 1.0 +1 a 2.0 2.0 +2 b 3.0 4.0 +3 b NaN 4.0 +4 a 5.0 5.0 + +[5 rows x 3 columns] +``` + +```None +In [19]: df.compare(df2) +Out[19]: + col1 col3 + self other self other +0 a c NaN NaN +2 NaN NaN 3.0 4.0 + +[2 rows x 4 columns] +``` + +See [User Guide](../user_guide/merging.html#merging-compare) for more details. + +### Allow NA in groupby key[#](#allow-na-in-groupby-key "Link to this heading") + +With [groupby](../user_guide/groupby.html#groupby-dropna) , we’ve added a `dropna` keyword to [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") and [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") in order to +allow `NA` values in group keys. Users can define `dropna` to `False` if they want to include +`NA` values in groupby keys. The default is set to `True` for `dropna` to keep backwards +compatibility ([GH 3729](https://github.com/pandas-dev/pandas/issues/3729)) + +```None +In [20]: df_list = [[1, 2, 3], [1, None, 4], [2, 1, 3], [1, 2, 2]] + +In [21]: df_dropna = pd.DataFrame(df_list, columns=["a", "b", "c"]) + +In [22]: df_dropna +Out[22]: + a b c +0 1 2.0 3 +1 1 NaN 4 +2 2 1.0 3 +3 1 2.0 2 + +[4 rows x 3 columns] +``` + +```None +# Default ``dropna`` is set to True, which will exclude NaNs in keys +In [23]: df_dropna.groupby(by=["b"], dropna=True).sum() +Out[23]: + a c +b +1.0 2 3 +2.0 2 5 + +[2 rows x 2 columns] + +# In order to allow NaN in keys, set ``dropna`` to False +In [24]: df_dropna.groupby(by=["b"], dropna=False).sum() +Out[24]: + a c +b +1.0 2 3 +2.0 2 5 +NaN 1 4 + +[3 rows x 2 columns] +``` + +The default setting of `dropna` argument is `True` which means `NA` are not included in group keys. + +### Sorting with keys[#](#sorting-with-keys "Link to this heading") + +We’ve added a `key` argument to the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") sorting methods, including +[`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values"), [`DataFrame.sort_index()`](../reference/api/pandas.DataFrame.sort_index.html#pandas.DataFrame.sort_index "pandas.DataFrame.sort_index"), [`Series.sort_values()`](../reference/api/pandas.Series.sort_values.html#pandas.Series.sort_values "pandas.Series.sort_values"), +and [`Series.sort_index()`](../reference/api/pandas.Series.sort_index.html#pandas.Series.sort_index "pandas.Series.sort_index"). The `key` can be any callable function which is applied +column-by-column to each column used for sorting, before sorting is performed ([GH 27237](https://github.com/pandas-dev/pandas/issues/27237)). +See [sort\_values with keys](../user_guide/basics.html#basics-sort-value-key) and [sort\_index with keys](../user_guide/basics.html#basics-sort-index-key) for more information. + +```None +In [25]: s = pd.Series(['C', 'a', 'B']) + +In [26]: s +Out[26]: +0 C +1 a +2 B +Length: 3, dtype: object +``` + +```None +In [27]: s.sort_values() +Out[27]: +2 B +0 C +1 a +Length: 3, dtype: object +``` + +Note how this is sorted with capital letters first. If we apply the [`Series.str.lower()`](../reference/api/pandas.Series.str.lower.html#pandas.Series.str.lower "pandas.Series.str.lower") +method, we get + +```None +In [28]: s.sort_values(key=lambda x: x.str.lower()) +Out[28]: +1 a +2 B +0 C +Length: 3, dtype: object +``` + +When applied to a `DataFrame`, they key is applied per-column to all columns or a subset if +`by` is specified, e.g. + +```None +In [29]: df = pd.DataFrame({'a': ['C', 'C', 'a', 'a', 'B', 'B'], + ....: 'b': [1, 2, 3, 4, 5, 6]}) + ....: + +In [30]: df +Out[30]: + a b +0 C 1 +1 C 2 +2 a 3 +3 a 4 +4 B 5 +5 B 6 + +[6 rows x 2 columns] +``` + +```None +In [31]: df.sort_values(by=['a'], key=lambda col: col.str.lower()) +Out[31]: + a b +2 a 3 +3 a 4 +4 B 5 +5 B 6 +0 C 1 +1 C 2 + +[6 rows x 2 columns] +``` + +For more details, see examples and documentation in [`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values"), +[`Series.sort_values()`](../reference/api/pandas.Series.sort_values.html#pandas.Series.sort_values "pandas.Series.sort_values"), and [`sort_index()`](../reference/api/pandas.DataFrame.sort_index.html#pandas.DataFrame.sort_index "pandas.DataFrame.sort_index"). + +### Fold argument support in Timestamp constructor[#](#fold-argument-support-in-timestamp-constructor "Link to this heading") + +`Timestamp:` now supports the keyword-only fold argument according to [PEP 495](https://www.python.org/dev/peps/pep-0495/#the-fold-attribute) similar to parent `datetime.datetime` class. It supports both accepting fold as an initialization argument and inferring fold from other constructor arguments ([GH 25057](https://github.com/pandas-dev/pandas/issues/25057), [GH 31338](https://github.com/pandas-dev/pandas/issues/31338)). Support is limited to `dateutil` timezones as `pytz` doesn’t support fold. + +For example: + +```None +In [32]: ts = pd.Timestamp("2019-10-27 01:30:00+00:00") + +In [33]: ts.fold +Out[33]: 0 +``` + +```None +In [34]: ts = pd.Timestamp(year=2019, month=10, day=27, hour=1, minute=30, + ....: tz="dateutil/Europe/London", fold=1) + ....: + +In [35]: ts +Out[35]: Timestamp('2019-10-27 01:30:00+0000', tz='dateutil//usr/share/zoneinfo/Europe/London') +``` + +For more on working with fold, see [Fold subsection](../user_guide/timeseries.html#timeseries-fold) in the user guide. + +### Parsing timezone-aware format with different timezones in to\_datetime[#](#parsing-timezone-aware-format-with-different-timezones-in-to-datetime "Link to this heading") + +[`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") now supports parsing formats containing timezone names (`%Z`) and UTC offsets (`%z`) from different timezones then converting them to UTC by setting `utc=True`. This would return a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with timezone at UTC as opposed to an [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with `object` dtype if `utc=True` is not set ([GH 32792](https://github.com/pandas-dev/pandas/issues/32792)). + +For example: + +```None +In [36]: tz_strs = ["2010-01-01 12:00:00 +0100", "2010-01-01 12:00:00 -0100", + ....: "2010-01-01 12:00:00 +0300", "2010-01-01 12:00:00 +0400"] + ....: + +In [37]: pd.to_datetime(tz_strs, format='%Y-%m-%d %H:%M:%S %z', utc=True) +Out[37]: +DatetimeIndex(['2010-01-01 11:00:00+00:00', '2010-01-01 13:00:00+00:00', + '2010-01-01 09:00:00+00:00', '2010-01-01 08:00:00+00:00'], + dtype='datetime64[ns, UTC]', freq=None) +``` + +```None +In[37]: pd.to_datetime(tz_strs, format='%Y-%m-%d %H:%M:%S %z') +Out[37]: +Index([2010-01-01 12:00:00+01:00, 2010-01-01 12:00:00-01:00, + 2010-01-01 12:00:00+03:00, 2010-01-01 12:00:00+04:00], + dtype='object') +``` + +### Grouper and resample now supports the arguments origin and offset[#](#grouper-and-resample-now-supports-the-arguments-origin-and-offset "Link to this heading") + +[`Grouper`](../reference/api/pandas.Grouper.html#pandas.Grouper "pandas.Grouper") and [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") now supports the arguments `origin` and `offset`. It let the user control the timestamp on which to adjust the grouping. ([GH 31809](https://github.com/pandas-dev/pandas/issues/31809)) + +The bins of the grouping are adjusted based on the beginning of the day of the time series starting point. This works well with frequencies that are multiples of a day (like `30D`) or that divides a day (like `90s` or `1min`). But it can create inconsistencies with some frequencies that do not meet this criteria. To change this behavior you can now specify a fixed timestamp with the argument `origin`. + +Two arguments are now deprecated (more information in the documentation of [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample")): + +* `base` should be replaced by `offset`. +* `loffset` should be replaced by directly adding an offset to the index [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") after being resampled. + +Small example of the use of `origin`: + +```None +In [38]: start, end = '2000-10-01 23:30:00', '2000-10-02 00:30:00' + +In [39]: middle = '2000-10-02 00:00:00' + +In [40]: rng = pd.date_range(start, end, freq='7min') + +In [41]: ts = pd.Series(np.arange(len(rng)) * 3, index=rng) + +In [42]: ts +Out[42]: +2000-10-01 23:30:00 0 +2000-10-01 23:37:00 3 +2000-10-01 23:44:00 6 +2000-10-01 23:51:00 9 +2000-10-01 23:58:00 12 +2000-10-02 00:05:00 15 +2000-10-02 00:12:00 18 +2000-10-02 00:19:00 21 +2000-10-02 00:26:00 24 +Freq: 7min, Length: 9, dtype: int64 +``` + +Resample with the default behavior `'start_day'` (origin is `2000-10-01 00:00:00`): + +```None +In [43]: ts.resample('17min').sum() +Out[43]: +2000-10-01 23:14:00 0 +2000-10-01 23:31:00 9 +2000-10-01 23:48:00 21 +2000-10-02 00:05:00 54 +2000-10-02 00:22:00 24 +Freq: 17min, Length: 5, dtype: int64 + +In [44]: ts.resample('17min', origin='start_day').sum() +Out[44]: +2000-10-01 23:14:00 0 +2000-10-01 23:31:00 9 +2000-10-01 23:48:00 21 +2000-10-02 00:05:00 54 +2000-10-02 00:22:00 24 +Freq: 17min, Length: 5, dtype: int64 +``` + +Resample using a fixed origin: + +```None +In [45]: ts.resample('17min', origin='epoch').sum() +Out[45]: +2000-10-01 23:18:00 0 +2000-10-01 23:35:00 18 +2000-10-01 23:52:00 27 +2000-10-02 00:09:00 39 +2000-10-02 00:26:00 24 +Freq: 17min, Length: 5, dtype: int64 + +In [46]: ts.resample('17min', origin='2000-01-01').sum() +Out[46]: +2000-10-01 23:24:00 3 +2000-10-01 23:41:00 15 +2000-10-01 23:58:00 45 +2000-10-02 00:15:00 45 +Freq: 17min, Length: 4, dtype: int64 +``` + +If needed you can adjust the bins with the argument `offset` (a [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta")) that would be added to the default `origin`. + +For a full example, see: [Use origin or offset to adjust the start of the bins](../user_guide/timeseries.html#timeseries-adjust-the-start-of-the-bins). + +### fsspec now used for filesystem handling[#](#fsspec-now-used-for-filesystem-handling "Link to this heading") + +For reading and writing to filesystems other than local and reading from HTTP(S), +the optional dependency `fsspec` will be used to dispatch operations ([GH 33452](https://github.com/pandas-dev/pandas/issues/33452)). +This will give unchanged +functionality for S3 and GCS storage, which were already supported, but also add +support for several other storage implementations such as [Azure Datalake and Blob](https://github.com/fsspec/adlfs), +SSH, FTP, dropbox and github. For docs and capabilities, see the [fsspec docs](https://filesystem-spec.readthedocs.io/en/latest/). + +The existing capability to interface with S3 and GCS will be unaffected by this +change, as `fsspec` will still bring in the same packages as before. + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* Compatibility with matplotlib 3.3.0 ([GH 34850](https://github.com/pandas-dev/pandas/issues/34850)) +* `IntegerArray.astype()` now supports `datetime64` dtype ([GH 32538](https://github.com/pandas-dev/pandas/issues/32538)) +* `IntegerArray` now implements the `sum` operation ([GH 33172](https://github.com/pandas-dev/pandas/issues/33172)) +* Added [`pandas.errors.InvalidIndexError`](../reference/api/pandas.errors.InvalidIndexError.html#pandas.errors.InvalidIndexError "pandas.errors.InvalidIndexError") ([GH 34570](https://github.com/pandas-dev/pandas/issues/34570)). +* Added [`DataFrame.value_counts()`](../reference/api/pandas.DataFrame.value_counts.html#pandas.DataFrame.value_counts "pandas.DataFrame.value_counts") ([GH 5377](https://github.com/pandas-dev/pandas/issues/5377)) +* Added a [`pandas.api.indexers.FixedForwardWindowIndexer()`](../reference/api/pandas.api.indexers.FixedForwardWindowIndexer.html#pandas.api.indexers.FixedForwardWindowIndexer "pandas.api.indexers.FixedForwardWindowIndexer") class to support forward-looking windows during `rolling` operations. +* Added a [`pandas.api.indexers.VariableOffsetWindowIndexer()`](../reference/api/pandas.api.indexers.VariableOffsetWindowIndexer.html#pandas.api.indexers.VariableOffsetWindowIndexer "pandas.api.indexers.VariableOffsetWindowIndexer") class to support `rolling` operations with non-fixed offsets ([GH 34994](https://github.com/pandas-dev/pandas/issues/34994)) +* [`describe()`](../reference/api/pandas.DataFrame.describe.html#pandas.DataFrame.describe "pandas.DataFrame.describe") now includes a `datetime_is_numeric` keyword to control how datetime columns are summarized ([GH 30164](https://github.com/pandas-dev/pandas/issues/30164), [GH 34798](https://github.com/pandas-dev/pandas/issues/34798)) +* [`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") may now render CSS more efficiently where multiple cells have the same styling ([GH 30876](https://github.com/pandas-dev/pandas/issues/30876)) +* [`highlight_null()`](../reference/api/pandas.io.formats.style.Styler.highlight_null.html#pandas.io.formats.style.Styler.highlight_null "pandas.io.formats.style.Styler.highlight_null") now accepts `subset` argument ([GH 31345](https://github.com/pandas-dev/pandas/issues/31345)) +* When writing directly to a sqlite connection [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") now supports the `multi` method ([GH 29921](https://github.com/pandas-dev/pandas/issues/29921)) +* [`pandas.errors.OptionError`](../reference/api/pandas.errors.OptionError.html#pandas.errors.OptionError "pandas.errors.OptionError") is now exposed in `pandas.errors` ([GH 27553](https://github.com/pandas-dev/pandas/issues/27553)) +* Added `api.extensions.ExtensionArray.argmax()` and `api.extensions.ExtensionArray.argmin()` ([GH 24382](https://github.com/pandas-dev/pandas/issues/24382)) +* [`timedelta_range()`](../reference/api/pandas.timedelta_range.html#pandas.timedelta_range "pandas.timedelta_range") will now infer a frequency when passed `start`, `stop`, and `periods` ([GH 32377](https://github.com/pandas-dev/pandas/issues/32377)) +* Positional slicing on a [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") now supports slices with `step > 1` ([GH 31658](https://github.com/pandas-dev/pandas/issues/31658)) +* [`Series.str`](../reference/api/pandas.Series.str.html#pandas.Series.str "pandas.Series.str") now has a `fullmatch` method that matches a regular expression against the entire string in each row of the [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), similar to `re.fullmatch` ([GH 32806](https://github.com/pandas-dev/pandas/issues/32806)). +* [`DataFrame.sample()`](../reference/api/pandas.DataFrame.sample.html#pandas.DataFrame.sample "pandas.DataFrame.sample") will now also allow array-like and BitGenerator objects to be passed to `random_state` as seeds ([GH 32503](https://github.com/pandas-dev/pandas/issues/32503)) +* [`Index.union()`](../reference/api/pandas.Index.union.html#pandas.Index.union "pandas.Index.union") will now raise `RuntimeWarning` for [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") objects if the object inside are unsortable. Pass `sort=False` to suppress this warning ([GH 33015](https://github.com/pandas-dev/pandas/issues/33015)) +* Added [`Series.dt.isocalendar()`](../reference/api/pandas.Series.dt.isocalendar.html#pandas.Series.dt.isocalendar "pandas.Series.dt.isocalendar") and `DatetimeIndex.isocalendar()` that returns a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with year, week, and day calculated according to the ISO 8601 calendar ([GH 33206](https://github.com/pandas-dev/pandas/issues/33206), [GH 34392](https://github.com/pandas-dev/pandas/issues/34392)). +* The [`DataFrame.to_feather()`](../reference/api/pandas.DataFrame.to_feather.html#pandas.DataFrame.to_feather "pandas.DataFrame.to_feather") method now supports additional keyword + arguments (e.g. to set the compression) that are added in pyarrow 0.17 + ([GH 33422](https://github.com/pandas-dev/pandas/issues/33422)). +* The [`cut()`](../reference/api/pandas.cut.html#pandas.cut "pandas.cut") will now accept parameter `ordered` with default `ordered=True`. If `ordered=False` and no labels are provided, an error will be raised ([GH 33141](https://github.com/pandas-dev/pandas/issues/33141)) +* [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv"), [`DataFrame.to_pickle()`](../reference/api/pandas.DataFrame.to_pickle.html#pandas.DataFrame.to_pickle "pandas.DataFrame.to_pickle"), + and [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") now support passing a dict of + compression arguments when using the `gzip` and `bz2` protocols. + This can be used to set a custom compression level, e.g., + `df.to_csv(path, compression={'method': 'gzip', 'compresslevel': 1}` + ([GH 33196](https://github.com/pandas-dev/pandas/issues/33196)) +* [`melt()`](../reference/api/pandas.melt.html#pandas.melt "pandas.melt") has gained an `ignore_index` (default `True`) argument that, if set to `False`, prevents the method from dropping the index ([GH 17440](https://github.com/pandas-dev/pandas/issues/17440)). +* [`Series.update()`](../reference/api/pandas.Series.update.html#pandas.Series.update "pandas.Series.update") now accepts objects that can be coerced to a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), + such as `dict` and `list`, mirroring the behavior of [`DataFrame.update()`](../reference/api/pandas.DataFrame.update.html#pandas.DataFrame.update "pandas.DataFrame.update") ([GH 33215](https://github.com/pandas-dev/pandas/issues/33215)) +* [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") and [`DataFrameGroupBy.aggregate()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.aggregate.html#pandas.core.groupby.DataFrameGroupBy.aggregate "pandas.core.groupby.DataFrameGroupBy.aggregate") have gained `engine` and `engine_kwargs` arguments that support executing functions with `Numba` ([GH 32854](https://github.com/pandas-dev/pandas/issues/32854), [GH 33388](https://github.com/pandas-dev/pandas/issues/33388)) +* [`Resampler.interpolate()`](../reference/api/pandas.core.resample.Resampler.interpolate.html#pandas.core.resample.Resampler.interpolate "pandas.core.resample.Resampler.interpolate") now supports SciPy interpolation method [`scipy.interpolate.CubicSpline`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.CubicSpline.html#scipy.interpolate.CubicSpline "(in SciPy v1.16.2)") as method `cubicspline` ([GH 33670](https://github.com/pandas-dev/pandas/issues/33670)) +* `DataFrameGroupBy` and `SeriesGroupBy` now implement the `sample` method for doing random sampling within groups ([GH 31775](https://github.com/pandas-dev/pandas/issues/31775)) +* [`DataFrame.to_numpy()`](../reference/api/pandas.DataFrame.to_numpy.html#pandas.DataFrame.to_numpy "pandas.DataFrame.to_numpy") now supports the `na_value` keyword to control the NA sentinel in the output array ([GH 33820](https://github.com/pandas-dev/pandas/issues/33820)) +* Added `api.extension.ExtensionArray.equals` to the extension array interface, similar to [`Series.equals()`](../reference/api/pandas.Series.equals.html#pandas.Series.equals "pandas.Series.equals") ([GH 27081](https://github.com/pandas-dev/pandas/issues/27081)) +* The minimum supported dta version has increased to 105 in [`read_stata()`](../reference/api/pandas.read_stata.html#pandas.read_stata "pandas.read_stata") and `StataReader` ([GH 26667](https://github.com/pandas-dev/pandas/issues/26667)). +* [`to_stata()`](../reference/api/pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata") supports compression using the `compression` + keyword argument. Compression can either be inferred or explicitly set using a string or a + dictionary containing both the method and any additional arguments that are passed to the + compression library. Compression was also added to the low-level Stata-file writers + `StataWriter`, `StataWriter117`, + and `StataWriterUTF8` ([GH 26599](https://github.com/pandas-dev/pandas/issues/26599)). +* [`HDFStore.put()`](../reference/api/pandas.HDFStore.put.html#pandas.HDFStore.put "pandas.HDFStore.put") now accepts a `track_times` parameter. This parameter is passed to the `create_table` method of `PyTables` ([GH 32682](https://github.com/pandas-dev/pandas/issues/32682)). +* [`Series.plot()`](../reference/api/pandas.Series.plot.html#pandas.Series.plot "pandas.Series.plot") and [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") now accepts `xlabel` and `ylabel` parameters to present labels on x and y axis ([GH 9093](https://github.com/pandas-dev/pandas/issues/9093)). +* Made `Rolling` and `Expanding` iterable([GH 11704](https://github.com/pandas-dev/pandas/issues/11704)) +* Made `option_context` a [`contextlib.ContextDecorator`](https://docs.python.org/3/library/contextlib.html#contextlib.ContextDecorator "(in Python v3.13)"), which allows it to be used as a decorator over an entire function ([GH 34253](https://github.com/pandas-dev/pandas/issues/34253)). +* [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") and [`Series.to_csv()`](../reference/api/pandas.Series.to_csv.html#pandas.Series.to_csv "pandas.Series.to_csv") now accept an `errors` argument ([GH 22610](https://github.com/pandas-dev/pandas/issues/22610)) +* `DataFrameGroupBy.groupby.transform()` now allows `func` to be `pad`, `backfill` and `cumcount` ([GH 31269](https://github.com/pandas-dev/pandas/issues/31269)). +* [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") now accepts an `nrows` parameter. ([GH 33916](https://github.com/pandas-dev/pandas/issues/33916)). +* [`DataFrame.hist()`](../reference/api/pandas.DataFrame.hist.html#pandas.DataFrame.hist "pandas.DataFrame.hist"), [`Series.hist()`](../reference/api/pandas.Series.hist.html#pandas.Series.hist "pandas.Series.hist"), [`core.groupby.DataFrameGroupBy.hist()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.hist.html#pandas.core.groupby.DataFrameGroupBy.hist "pandas.core.groupby.DataFrameGroupBy.hist"), and [`core.groupby.SeriesGroupBy.hist()`](../reference/api/pandas.core.groupby.SeriesGroupBy.hist.html#pandas.core.groupby.SeriesGroupBy.hist "pandas.core.groupby.SeriesGroupBy.hist") have gained the `legend` argument. Set to True to show a legend in the histogram. ([GH 6279](https://github.com/pandas-dev/pandas/issues/6279)) +* [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") and `append()` now preserve extension dtypes, for example + combining a nullable integer column with a numpy integer column will no longer + result in object dtype but preserve the integer dtype ([GH 33607](https://github.com/pandas-dev/pandas/issues/33607), [GH 34339](https://github.com/pandas-dev/pandas/issues/34339), [GH 34095](https://github.com/pandas-dev/pandas/issues/34095)). +* [`read_gbq()`](../reference/api/pandas.read_gbq.html#pandas.read_gbq "pandas.read_gbq") now allows to disable progress bar ([GH 33360](https://github.com/pandas-dev/pandas/issues/33360)). +* [`read_gbq()`](../reference/api/pandas.read_gbq.html#pandas.read_gbq "pandas.read_gbq") now supports the `max_results` kwarg from `pandas-gbq` ([GH 34639](https://github.com/pandas-dev/pandas/issues/34639)). +* [`DataFrame.cov()`](../reference/api/pandas.DataFrame.cov.html#pandas.DataFrame.cov "pandas.DataFrame.cov") and [`Series.cov()`](../reference/api/pandas.Series.cov.html#pandas.Series.cov "pandas.Series.cov") now support a new parameter `ddof` to support delta degrees of freedom as in the corresponding numpy methods ([GH 34611](https://github.com/pandas-dev/pandas/issues/34611)). +* [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") and [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string")’s `col_space` parameter now accepts a list or dict to change only some specific columns’ width ([GH 28917](https://github.com/pandas-dev/pandas/issues/28917)). +* [`DataFrame.to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel") can now also write OpenOffice spreadsheet (.ods) files ([GH 27222](https://github.com/pandas-dev/pandas/issues/27222)) +* [`explode()`](../reference/api/pandas.Series.explode.html#pandas.Series.explode "pandas.Series.explode") now accepts `ignore_index` to reset the index, similar to `pd.concat()` or [`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values") ([GH 34932](https://github.com/pandas-dev/pandas/issues/34932)). +* [`DataFrame.to_markdown()`](../reference/api/pandas.DataFrame.to_markdown.html#pandas.DataFrame.to_markdown "pandas.DataFrame.to_markdown") and [`Series.to_markdown()`](../reference/api/pandas.Series.to_markdown.html#pandas.Series.to_markdown "pandas.Series.to_markdown") now accept `index` argument as an alias for tabulate’s `showindex` ([GH 32667](https://github.com/pandas-dev/pandas/issues/32667)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") now accepts string values like “0”, “0.0”, “1”, “1.0” as convertible to the nullable Boolean dtype ([GH 34859](https://github.com/pandas-dev/pandas/issues/34859)) +* `ExponentialMovingWindow` now supports a `times` argument that allows `mean` to be calculated with observations spaced by the timestamps in `times` ([GH 34839](https://github.com/pandas-dev/pandas/issues/34839)) +* [`DataFrame.agg()`](../reference/api/pandas.DataFrame.agg.html#pandas.DataFrame.agg "pandas.DataFrame.agg") and [`Series.agg()`](../reference/api/pandas.Series.agg.html#pandas.Series.agg "pandas.Series.agg") now accept named aggregation for renaming the output columns/indexes. ([GH 26513](https://github.com/pandas-dev/pandas/issues/26513)) +* `compute.use_numba` now exists as a configuration option that utilizes the numba engine when available ([GH 33966](https://github.com/pandas-dev/pandas/issues/33966), [GH 35374](https://github.com/pandas-dev/pandas/issues/35374)) +* [`Series.plot()`](../reference/api/pandas.Series.plot.html#pandas.Series.plot "pandas.Series.plot") now supports asymmetric error bars. Previously, if [`Series.plot()`](../reference/api/pandas.Series.plot.html#pandas.Series.plot "pandas.Series.plot") received a “2xN” array with error values for `yerr` and/or `xerr`, the left/lower values (first row) were mirrored, while the right/upper values (second row) were ignored. Now, the first row represents the left/lower error values and the second row the right/upper error values. ([GH 9536](https://github.com/pandas-dev/pandas/issues/9536)) + +## Notable bug fixes[#](#notable-bug-fixes "Link to this heading") + +These are bug fixes that might have notable behavior changes. + +### `MultiIndex.get_indexer` interprets `method` argument correctly[#](#multiindex-get-indexer-interprets-method-argument-correctly "Link to this heading") + +This restores the behavior of [`MultiIndex.get_indexer()`](../reference/api/pandas.MultiIndex.get_indexer.html#pandas.MultiIndex.get_indexer "pandas.MultiIndex.get_indexer") with `method='backfill'` or `method='pad'` to the behavior before pandas 0.23.0. In particular, MultiIndexes are treated as a list of tuples and padding or backfilling is done with respect to the ordering of these lists of tuples ([GH 29896](https://github.com/pandas-dev/pandas/issues/29896)). + +As an example of this, given: + +```None +In [47]: df = pd.DataFrame({ + ....: 'a': [0, 0, 0, 0], + ....: 'b': [0, 2, 3, 4], + ....: 'c': ['A', 'B', 'C', 'D'], + ....: }).set_index(['a', 'b']) + ....: + +In [48]: mi_2 = pd.MultiIndex.from_product([[0], [-1, 0, 1, 3, 4, 5]]) +``` + +The differences in reindexing `df` with `mi_2` and using `method='backfill'` can be seen here: + +*pandas >= 0.23, < 1.1.0*: + +```None +In [1]: df.reindex(mi_2, method='backfill') +Out[1]: + c +0 -1 A + 0 A + 1 D + 3 A + 4 A + 5 C +``` + +*pandas <0.23, >= 1.1.0* + +```None +In [49]: df.reindex(mi_2, method='backfill') +Out[49]: + c +0 -1 A + 0 A + 1 B + 3 C + 4 D + 5 NaN + +[6 rows x 1 columns] +``` + +And the differences in reindexing `df` with `mi_2` and using `method='pad'` can be seen here: + +*pandas >= 0.23, < 1.1.0* + +```None +In [1]: df.reindex(mi_2, method='pad') +Out[1]: + c +0 -1 NaN + 0 NaN + 1 D + 3 NaN + 4 A + 5 C +``` + +*pandas < 0.23, >= 1.1.0* + +```None +In [50]: df.reindex(mi_2, method='pad') +Out[50]: + c +0 -1 NaN + 0 A + 1 A + 3 C + 4 D + 5 D + +[6 rows x 1 columns] +``` + +### Failed label-based lookups always raise KeyError[#](#failed-label-based-lookups-always-raise-keyerror "Link to this heading") + +Label lookups `series[key]`, `series.loc[key]` and `frame.loc[key]` +used to raise either `KeyError` or `TypeError` depending on the type of +key and type of [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"). These now consistently raise `KeyError` ([GH 31867](https://github.com/pandas-dev/pandas/issues/31867)) + +```None +In [51]: ser1 = pd.Series(range(3), index=[0, 1, 2]) + +In [52]: ser2 = pd.Series(range(3), index=pd.date_range("2020-02-01", periods=3)) +``` + +*Previous behavior*: + +```None +In [3]: ser1[1.5] +... +TypeError: cannot do label indexing on Int64Index with these indexers [1.5] of type float + +In [4] ser1["foo"] +... +KeyError: 'foo' + +In [5]: ser1.loc[1.5] +... +TypeError: cannot do label indexing on Int64Index with these indexers [1.5] of type float + +In [6]: ser1.loc["foo"] +... +KeyError: 'foo' + +In [7]: ser2.loc[1] +... +TypeError: cannot do label indexing on DatetimeIndex with these indexers [1] of type int + +In [8]: ser2.loc[pd.Timestamp(0)] +... +KeyError: Timestamp('1970-01-01 00:00:00') +``` + +*New behavior*: + +```None +In [3]: ser1[1.5] +... +KeyError: 1.5 + +In [4] ser1["foo"] +... +KeyError: 'foo' + +In [5]: ser1.loc[1.5] +... +KeyError: 1.5 + +In [6]: ser1.loc["foo"] +... +KeyError: 'foo' + +In [7]: ser2.loc[1] +... +KeyError: 1 + +In [8]: ser2.loc[pd.Timestamp(0)] +... +KeyError: Timestamp('1970-01-01 00:00:00') +``` + +Similarly, [`DataFrame.at()`](../reference/api/pandas.DataFrame.at.html#pandas.DataFrame.at "pandas.DataFrame.at") and [`Series.at()`](../reference/api/pandas.Series.at.html#pandas.Series.at "pandas.Series.at") will raise a `TypeError` instead of a `ValueError` if an incompatible key is passed, and `KeyError` if a missing key is passed, matching the behavior of `.loc[]` ([GH 31722](https://github.com/pandas-dev/pandas/issues/31722)) + +### Failed Integer Lookups on MultiIndex Raise KeyError[#](#failed-integer-lookups-on-multiindex-raise-keyerror "Link to this heading") + +Indexing with integers with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") that has an integer-dtype +first level incorrectly failed to raise `KeyError` when one or more of +those integer keys is not present in the first level of the index ([GH 33539](https://github.com/pandas-dev/pandas/issues/33539)) + +```None +In [53]: idx = pd.Index(range(4)) + +In [54]: dti = pd.date_range("2000-01-03", periods=3) + +In [55]: mi = pd.MultiIndex.from_product([idx, dti]) + +In [56]: ser = pd.Series(range(len(mi)), index=mi) +``` + +*Previous behavior*: + +```None +In [5]: ser[[5]] +Out[5]: Series([], dtype: int64) +``` + +*New behavior*: + +```None +In [5]: ser[[5]] +... +KeyError: '[5] not in index' +``` + +### [`DataFrame.merge()`](../reference/api/pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge") preserves right frame’s row order[#](#dataframe-merge-preserves-right-frame-s-row-order "Link to this heading") + +[`DataFrame.merge()`](../reference/api/pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge") now preserves the right frame’s row order when executing a right merge ([GH 27453](https://github.com/pandas-dev/pandas/issues/27453)) + +```None +In [57]: left_df = pd.DataFrame({'animal': ['dog', 'pig'], + ....: 'max_speed': [40, 11]}) + ....: + +In [58]: right_df = pd.DataFrame({'animal': ['quetzal', 'pig'], + ....: 'max_speed': [80, 11]}) + ....: + +In [59]: left_df +Out[59]: + animal max_speed +0 dog 40 +1 pig 11 + +[2 rows x 2 columns] + +In [60]: right_df +Out[60]: + animal max_speed +0 quetzal 80 +1 pig 11 + +[2 rows x 2 columns] +``` + +*Previous behavior*: + +```None +>>> left_df.merge(right_df, on=['animal', 'max_speed'], how="right") + animal max_speed +0 pig 11 +1 quetzal 80 +``` + +*New behavior*: + +```None +In [61]: left_df.merge(right_df, on=['animal', 'max_speed'], how="right") +Out[61]: + animal max_speed +0 quetzal 80 +1 pig 11 + +[2 rows x 2 columns] +``` + +### Assignment to multiple columns of a DataFrame when some columns do not exist[#](#assignment-to-multiple-columns-of-a-dataframe-when-some-columns-do-not-exist "Link to this heading") + +Assignment to multiple columns of a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") when some of the columns do not exist would previously assign the values to the last column. Now, new columns will be constructed with the right values. ([GH 13658](https://github.com/pandas-dev/pandas/issues/13658)) + +```None +In [62]: df = pd.DataFrame({'a': [0, 1, 2], 'b': [3, 4, 5]}) + +In [63]: df +Out[63]: + a b +0 0 3 +1 1 4 +2 2 5 + +[3 rows x 2 columns] +``` + +*Previous behavior*: + +```None +In [3]: df[['a', 'c']] = 1 +In [4]: df +Out[4]: + a b +0 1 1 +1 1 1 +2 1 1 +``` + +*New behavior*: + +```None +In [64]: df[['a', 'c']] = 1 + +In [65]: df +Out[65]: + a b c +0 1 3 1 +1 1 4 1 +2 1 5 1 + +[3 rows x 3 columns] +``` + +### Consistency across groupby reductions[#](#consistency-across-groupby-reductions "Link to this heading") + +Using [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") with `as_index=True` and the aggregation `nunique` would include the grouping column(s) in the columns of the result. Now the grouping column(s) only appear in the index, consistent with other reductions. ([GH 32579](https://github.com/pandas-dev/pandas/issues/32579)) + +```None +In [66]: df = pd.DataFrame({"a": ["x", "x", "y", "y"], "b": [1, 1, 2, 3]}) + +In [67]: df +Out[67]: + a b +0 x 1 +1 x 1 +2 y 2 +3 y 3 + +[4 rows x 2 columns] +``` + +*Previous behavior*: + +```None +In [3]: df.groupby("a", as_index=True).nunique() +Out[4]: + a b +a +x 1 1 +y 1 2 +``` + +*New behavior*: + +```None +In [68]: df.groupby("a", as_index=True).nunique() +Out[68]: + b +a +x 1 +y 2 + +[2 rows x 1 columns] +``` + +Using [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") with `as_index=False` and the function `idxmax`, `idxmin`, `mad`, `nunique`, `sem`, `skew`, or `std` would modify the grouping column. Now the grouping column remains unchanged, consistent with other reductions. ([GH 21090](https://github.com/pandas-dev/pandas/issues/21090), [GH 10355](https://github.com/pandas-dev/pandas/issues/10355)) + +*Previous behavior*: + +```None +In [3]: df.groupby("a", as_index=False).nunique() +Out[4]: + a b +0 1 1 +1 1 2 +``` + +*New behavior*: + +```None +In [69]: df.groupby("a", as_index=False).nunique() +Out[69]: + a b +0 x 1 +1 y 2 + +[2 rows x 2 columns] +``` + +The method [`DataFrameGroupBy.size()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.size.html#pandas.core.groupby.DataFrameGroupBy.size "pandas.core.groupby.DataFrameGroupBy.size") would previously ignore `as_index=False`. Now the grouping columns are returned as columns, making the result a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") instead of a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"). ([GH 32599](https://github.com/pandas-dev/pandas/issues/32599)) + +*Previous behavior*: + +```None +In [3]: df.groupby("a", as_index=False).size() +Out[4]: +a +x 2 +y 2 +dtype: int64 +``` + +*New behavior*: + +```None +In [70]: df.groupby("a", as_index=False).size() +Out[70]: + a size +0 x 2 +1 y 2 + +[2 rows x 2 columns] +``` + +### `DataFrameGroupby.agg()` lost results with `as_index=False` when relabeling columns[#](#dataframegroupby-agg-lost-results-with-as-index-false-when-relabeling-columns "Link to this heading") + +Previously `DataFrameGroupby.agg()` lost the result columns, when the `as_index` option was +set to `False` and the result columns were relabeled. In this case the result values were replaced with +the previous index ([GH 32240](https://github.com/pandas-dev/pandas/issues/32240)). + +```None +In [71]: df = pd.DataFrame({"key": ["x", "y", "z", "x", "y", "z"], + ....: "val": [1.0, 0.8, 2.0, 3.0, 3.6, 0.75]}) + ....: + +In [72]: df +Out[72]: + key val +0 x 1.00 +1 y 0.80 +2 z 2.00 +3 x 3.00 +4 y 3.60 +5 z 0.75 + +[6 rows x 2 columns] +``` + +*Previous behavior*: + +```None +In [2]: grouped = df.groupby("key", as_index=False) +In [3]: result = grouped.agg(min_val=pd.NamedAgg(column="val", aggfunc="min")) +In [4]: result +Out[4]: + min_val + 0 x + 1 y + 2 z +``` + +*New behavior*: + +```None +In [73]: grouped = df.groupby("key", as_index=False) + +In [74]: result = grouped.agg(min_val=pd.NamedAgg(column="val", aggfunc="min")) + +In [75]: result +Out[75]: + key min_val +0 x 1.00 +1 y 0.80 +2 z 0.75 + +[3 rows x 2 columns] +``` + +### apply and applymap on `DataFrame` evaluates first row/column only once[#](#apply-and-applymap-on-dataframe-evaluates-first-row-column-only-once "Link to this heading") + +```None +In [76]: df = pd.DataFrame({'a': [1, 2], 'b': [3, 6]}) + +In [77]: def func(row): + ....: print(row) + ....: return row + ....: +``` + +*Previous behavior*: + +```None +In [4]: df.apply(func, axis=1) +a 1 +b 3 +Name: 0, dtype: int64 +a 1 +b 3 +Name: 0, dtype: int64 +a 2 +b 6 +Name: 1, dtype: int64 +Out[4]: + a b +0 1 3 +1 2 6 +``` + +*New behavior*: + +```None +In [78]: df.apply(func, axis=1) +a 1 +b 3 +Name: 0, Length: 2, dtype: int64 +a 2 +b 6 +Name: 1, Length: 2, dtype: int64 +Out[78]: + a b +0 1 3 +1 2 6 + +[2 rows x 2 columns] +``` + +## Backwards incompatible API changes[#](#backwards-incompatible-api-changes "Link to this heading") + +### Added `check_freq` argument to `testing.assert_frame_equal` and `testing.assert_series_equal`[#](#added-check-freq-argument-to-testing-assert-frame-equal-and-testing-assert-series-equal "Link to this heading") + +The `check_freq` argument was added to [`testing.assert_frame_equal()`](../reference/api/pandas.testing.assert_frame_equal.html#pandas.testing.assert_frame_equal "pandas.testing.assert_frame_equal") and [`testing.assert_series_equal()`](../reference/api/pandas.testing.assert_series_equal.html#pandas.testing.assert_series_equal "pandas.testing.assert_series_equal") in pandas 1.1.0 and defaults to `True`. [`testing.assert_frame_equal()`](../reference/api/pandas.testing.assert_frame_equal.html#pandas.testing.assert_frame_equal "pandas.testing.assert_frame_equal") and [`testing.assert_series_equal()`](../reference/api/pandas.testing.assert_series_equal.html#pandas.testing.assert_series_equal "pandas.testing.assert_series_equal") now raise `AssertionError` if the indexes do not have the same frequency. Before pandas 1.1.0, the index frequency was not checked. + +### Increased minimum versions for dependencies[#](#increased-minimum-versions-for-dependencies "Link to this heading") + +Some minimum supported versions of dependencies were updated ([GH 33718](https://github.com/pandas-dev/pandas/issues/33718), [GH 29766](https://github.com/pandas-dev/pandas/issues/29766), [GH 29723](https://github.com/pandas-dev/pandas/issues/29723), pytables >= 3.4.3). +If installed, we now require: + +| Package | Minimum Version | Required | Changed | +| --- | --- | --- | --- | +| numpy | 1.15.4 | X | X | +| pytz | 2015.4 | X | | +| python-dateutil | 2.7.3 | X | X | +| bottleneck | 1.2.1 | | | +| numexpr | 2.6.2 | | | +| pytest (dev) | 4.0.2 | | | + +For [optional libraries](https://pandas.pydata.org/docs/getting_started/install.html) the general recommendation is to use the latest version. +The following table lists the lowest version per library that is currently being tested throughout the development of pandas. +Optional libraries below the lowest tested version may still work, but are not considered supported. + +| Package | Minimum Version | Changed | +| --- | --- | --- | +| beautifulsoup4 | 4.6.0 | | +| fastparquet | 0.3.2 | | +| fsspec | 0.7.4 | | +| gcsfs | 0.6.0 | X | +| lxml | 3.8.0 | | +| matplotlib | 2.2.2 | | +| numba | 0.46.0 | | +| openpyxl | 2.5.7 | | +| pyarrow | 0.13.0 | | +| pymysql | 0.7.1 | | +| pytables | 3.4.3 | X | +| s3fs | 0.4.0 | X | +| scipy | 1.2.0 | X | +| sqlalchemy | 1.1.4 | | +| xarray | 0.8.2 | | +| xlrd | 1.1.0 | | +| xlsxwriter | 0.9.8 | | +| xlwt | 1.2.0 | | +| pandas-gbq | 1.2.0 | X | + +See [Dependencies](../getting_started/install.html#install-dependencies) and [Optional dependencies](../getting_started/install.html#install-optional-dependencies) for more. + +### Development changes[#](#development-changes "Link to this heading") + +* The minimum version of Cython is now the most recent bug-fix version (0.29.16) ([GH 33334](https://github.com/pandas-dev/pandas/issues/33334)). + +## Deprecations[#](#deprecations "Link to this heading") + +* Lookups on a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with a single-item list containing a slice (e.g. `ser[[slice(0, 4)]]`) are deprecated and will raise in a future version. Either convert the list to a tuple, or pass the slice directly instead ([GH 31333](https://github.com/pandas-dev/pandas/issues/31333)) +* [`DataFrame.mean()`](../reference/api/pandas.DataFrame.mean.html#pandas.DataFrame.mean "pandas.DataFrame.mean") and [`DataFrame.median()`](../reference/api/pandas.DataFrame.median.html#pandas.DataFrame.median "pandas.DataFrame.median") with `numeric_only=None` will include `datetime64` and `datetime64tz` columns in a future version ([GH 29941](https://github.com/pandas-dev/pandas/issues/29941)) +* Setting values with `.loc` using a positional slice is deprecated and will raise in a future version. Use `.loc` with labels or `.iloc` with positions instead ([GH 31840](https://github.com/pandas-dev/pandas/issues/31840)) +* [`DataFrame.to_dict()`](../reference/api/pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict") has deprecated accepting short names for `orient` and will raise in a future version ([GH 32515](https://github.com/pandas-dev/pandas/issues/32515)) +* `Categorical.to_dense()` is deprecated and will be removed in a future version, use `np.asarray(cat)` instead ([GH 32639](https://github.com/pandas-dev/pandas/issues/32639)) +* The `fastpath` keyword in the `SingleBlockManager` constructor is deprecated and will be removed in a future version ([GH 33092](https://github.com/pandas-dev/pandas/issues/33092)) +* Providing `suffixes` as a `set` in [`pandas.merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") is deprecated. Provide a tuple instead ([GH 33740](https://github.com/pandas-dev/pandas/issues/33740), [GH 34741](https://github.com/pandas-dev/pandas/issues/34741)). +* Indexing a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with a multi-dimensional indexer like `[:, None]` to return an `ndarray` now raises a `FutureWarning`. Convert to a NumPy array before indexing instead ([GH 27837](https://github.com/pandas-dev/pandas/issues/27837)) +* `Index.is_mixed()` is deprecated and will be removed in a future version, check `index.inferred_type` directly instead ([GH 32922](https://github.com/pandas-dev/pandas/issues/32922)) +* Passing any arguments but the first one to [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") as + positional arguments is deprecated. All other + arguments should be given as keyword arguments ([GH 27573](https://github.com/pandas-dev/pandas/issues/27573)). +* Passing any arguments but `path_or_buf` (the first one) to + [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") as positional arguments is deprecated. All + other arguments should be given as keyword arguments ([GH 27573](https://github.com/pandas-dev/pandas/issues/27573)). +* Passing any arguments but the first two to [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") as + positional arguments is deprecated. All other + arguments should be given as keyword arguments ([GH 27573](https://github.com/pandas-dev/pandas/issues/27573)). +* `pandas.api.types.is_categorical()` is deprecated and will be removed in a future version; use [`pandas.api.types.is_categorical_dtype()`](../reference/api/pandas.api.types.is_categorical_dtype.html#pandas.api.types.is_categorical_dtype "pandas.api.types.is_categorical_dtype") instead ([GH 33385](https://github.com/pandas-dev/pandas/issues/33385)) +* `Index.get_value()` is deprecated and will be removed in a future version ([GH 19728](https://github.com/pandas-dev/pandas/issues/19728)) +* `Series.dt.week()` and `Series.dt.weekofyear()` are deprecated and will be removed in a future version, use `Series.dt.isocalendar().week()` instead ([GH 33595](https://github.com/pandas-dev/pandas/issues/33595)) +* `DatetimeIndex.week()` and `DatetimeIndex.weekofyear` are deprecated and will be removed in a future version, use `DatetimeIndex.isocalendar().week` instead ([GH 33595](https://github.com/pandas-dev/pandas/issues/33595)) +* `DatetimeArray.week()` and `DatetimeArray.weekofyear` are deprecated and will be removed in a future version, use `DatetimeArray.isocalendar().week` instead ([GH 33595](https://github.com/pandas-dev/pandas/issues/33595)) +* `DateOffset.__call__()` is deprecated and will be removed in a future version, use `offset + other` instead ([GH 34171](https://github.com/pandas-dev/pandas/issues/34171)) +* `apply_index()` is deprecated and will be removed in a future version. Use `offset + other` instead ([GH 34580](https://github.com/pandas-dev/pandas/issues/34580)) +* `DataFrame.tshift()` and `Series.tshift()` are deprecated and will be removed in a future version, use [`DataFrame.shift()`](../reference/api/pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift") and [`Series.shift()`](../reference/api/pandas.Series.shift.html#pandas.Series.shift "pandas.Series.shift") instead ([GH 11631](https://github.com/pandas-dev/pandas/issues/11631)) +* Indexing an [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") object with a float key is deprecated, and will + raise an `IndexError` in the future. You can manually convert to an integer key + instead ([GH 34191](https://github.com/pandas-dev/pandas/issues/34191)). +* The `squeeze` keyword in [`groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") is deprecated and will be removed in a future version ([GH 32380](https://github.com/pandas-dev/pandas/issues/32380)) +* The `tz` keyword in [`Period.to_timestamp()`](../reference/api/pandas.Period.to_timestamp.html#pandas.Period.to_timestamp "pandas.Period.to_timestamp") is deprecated and will be removed in a future version; use `per.to_timestamp(...).tz_localize(tz)` instead ([GH 34522](https://github.com/pandas-dev/pandas/issues/34522)) +* `DatetimeIndex.to_perioddelta()` is deprecated and will be removed in a future version. Use `index - index.to_period(freq).to_timestamp()` instead ([GH 34853](https://github.com/pandas-dev/pandas/issues/34853)) +* [`DataFrame.melt()`](../reference/api/pandas.DataFrame.melt.html#pandas.DataFrame.melt "pandas.DataFrame.melt") accepting a `value_name` that already exists is deprecated, and will be removed in a future version ([GH 34731](https://github.com/pandas-dev/pandas/issues/34731)) +* The `center` keyword in the [`DataFrame.expanding()`](../reference/api/pandas.DataFrame.expanding.html#pandas.DataFrame.expanding "pandas.DataFrame.expanding") function is deprecated and will be removed in a future version ([GH 20647](https://github.com/pandas-dev/pandas/issues/20647)) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Performance improvement in [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") constructor ([GH 30543](https://github.com/pandas-dev/pandas/issues/30543)) +* Performance improvement in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") constructor ([GH 30543](https://github.com/pandas-dev/pandas/issues/30543)) +* Performance improvement in flex arithmetic ops between [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `axis=0` ([GH 31296](https://github.com/pandas-dev/pandas/issues/31296)) +* Performance improvement in arithmetic ops between [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `axis=1` ([GH 33600](https://github.com/pandas-dev/pandas/issues/33600)) +* The internal index method `_shallow_copy()` now copies cached attributes over to the new index, + avoiding creating these again on the new index. This can speed up many operations that depend on creating copies of + existing indexes ([GH 28584](https://github.com/pandas-dev/pandas/issues/28584), [GH 32640](https://github.com/pandas-dev/pandas/issues/32640), [GH 32669](https://github.com/pandas-dev/pandas/issues/32669)) +* Significant performance improvement when creating a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with + sparse values from `scipy.sparse` matrices using the + [`DataFrame.sparse.from_spmatrix()`](../reference/api/pandas.DataFrame.sparse.from_spmatrix.html#pandas.DataFrame.sparse.from_spmatrix "pandas.DataFrame.sparse.from_spmatrix") constructor ([GH 32821](https://github.com/pandas-dev/pandas/issues/32821), + [GH 32825](https://github.com/pandas-dev/pandas/issues/32825), [GH 32826](https://github.com/pandas-dev/pandas/issues/32826), [GH 32856](https://github.com/pandas-dev/pandas/issues/32856), [GH 32858](https://github.com/pandas-dev/pandas/issues/32858)). +* Performance improvement for groupby methods `Groupby.first()` + and `Groupby.last()` ([GH 34178](https://github.com/pandas-dev/pandas/issues/34178)) +* Performance improvement in [`factorize()`](../reference/api/pandas.factorize.html#pandas.factorize "pandas.factorize") for nullable (integer and Boolean) dtypes ([GH 33064](https://github.com/pandas-dev/pandas/issues/33064)). +* Performance improvement when constructing [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") objects ([GH 33921](https://github.com/pandas-dev/pandas/issues/33921)) +* Fixed performance regression in [`pandas.qcut()`](../reference/api/pandas.qcut.html#pandas.qcut "pandas.qcut") and [`pandas.cut()`](../reference/api/pandas.cut.html#pandas.cut "pandas.cut") ([GH 33921](https://github.com/pandas-dev/pandas/issues/33921)) +* Performance improvement in reductions (`sum`, `prod`, `min`, `max`) for nullable (integer and Boolean) dtypes ([GH 30982](https://github.com/pandas-dev/pandas/issues/30982), [GH 33261](https://github.com/pandas-dev/pandas/issues/33261), [GH 33442](https://github.com/pandas-dev/pandas/issues/33442)). +* Performance improvement in arithmetic operations between two [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") objects ([GH 32779](https://github.com/pandas-dev/pandas/issues/32779)) +* Performance improvement in `RollingGroupby` ([GH 34052](https://github.com/pandas-dev/pandas/issues/34052)) +* Performance improvement in arithmetic operations (`sub`, `add`, `mul`, `div`) for [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 34297](https://github.com/pandas-dev/pandas/issues/34297)) +* Performance improvement in `DataFrame[bool_indexer]` when `bool_indexer` is a `list` ([GH 33924](https://github.com/pandas-dev/pandas/issues/33924)) +* Significant performance improvement of `io.formats.style.Styler.render()` with styles added with various ways such as [`io.formats.style.Styler.apply()`](../reference/api/pandas.io.formats.style.Styler.apply.html#pandas.io.formats.style.Styler.apply "pandas.io.formats.style.Styler.apply"), `io.formats.style.Styler.applymap()` or [`io.formats.style.Styler.bar()`](../reference/api/pandas.io.formats.style.Styler.bar.html#pandas.io.formats.style.Styler.bar "pandas.io.formats.style.Styler.bar") ([GH 19917](https://github.com/pandas-dev/pandas/issues/19917)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +### Categorical[#](#categorical "Link to this heading") + +* Passing an invalid `fill_value` to `Categorical.take()` raises a `ValueError` instead of `TypeError` ([GH 33660](https://github.com/pandas-dev/pandas/issues/33660)) +* Combining a [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") with integer categories and which contains missing values with a float dtype column in operations such as [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") or `append()` will now result in a float column instead of an object dtype column ([GH 33607](https://github.com/pandas-dev/pandas/issues/33607)) +* Bug where [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") was unable to join on non-unique categorical indices ([GH 28189](https://github.com/pandas-dev/pandas/issues/28189)) +* Bug when passing categorical data to [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") constructor along with `dtype=object` incorrectly returning a [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") instead of object-dtype [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") ([GH 32167](https://github.com/pandas-dev/pandas/issues/32167)) +* Bug where [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") comparison operator `__ne__` would incorrectly evaluate to `False` when either element was missing ([GH 32276](https://github.com/pandas-dev/pandas/issues/32276)) +* `Categorical.fillna()` now accepts [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") `other` argument ([GH 32420](https://github.com/pandas-dev/pandas/issues/32420)) +* Repr of [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") was not distinguishing between `int` and `str` ([GH 33676](https://github.com/pandas-dev/pandas/issues/33676)) + +### Datetimelike[#](#datetimelike "Link to this heading") + +* Passing an integer dtype other than `int64` to `np.array(period_index, dtype=...)` will now raise `TypeError` instead of incorrectly using `int64` ([GH 32255](https://github.com/pandas-dev/pandas/issues/32255)) +* [`Series.to_timestamp()`](../reference/api/pandas.Series.to_timestamp.html#pandas.Series.to_timestamp "pandas.Series.to_timestamp") now raises a `TypeError` if the axis is not a [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex"). Previously an `AttributeError` was raised ([GH 33327](https://github.com/pandas-dev/pandas/issues/33327)) +* [`Series.to_period()`](../reference/api/pandas.Series.to_period.html#pandas.Series.to_period "pandas.Series.to_period") now raises a `TypeError` if the axis is not a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex"). Previously an `AttributeError` was raised ([GH 33327](https://github.com/pandas-dev/pandas/issues/33327)) +* [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") no longer accepts tuples for the `freq` argument ([GH 34658](https://github.com/pandas-dev/pandas/issues/34658)) +* Bug in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") where constructing a [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") from ambiguous epoch time and calling constructor again changed the [`Timestamp.value()`](../reference/api/pandas.Timestamp.value.html#pandas.Timestamp.value "pandas.Timestamp.value") property ([GH 24329](https://github.com/pandas-dev/pandas/issues/24329)) +* `DatetimeArray.searchsorted()`, `TimedeltaArray.searchsorted()`, `PeriodArray.searchsorted()` not recognizing non-pandas scalars and incorrectly raising `ValueError` instead of `TypeError` ([GH 30950](https://github.com/pandas-dev/pandas/issues/30950)) +* Bug in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") where constructing [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") with dateutil timezone less than 128 nanoseconds before daylight saving time switch from winter to summer would result in nonexistent time ([GH 31043](https://github.com/pandas-dev/pandas/issues/31043)) +* Bug in [`Period.to_timestamp()`](../reference/api/pandas.Period.to_timestamp.html#pandas.Period.to_timestamp "pandas.Period.to_timestamp"), [`Period.start_time()`](../reference/api/pandas.Period.start_time.html#pandas.Period.start_time "pandas.Period.start_time") with microsecond frequency returning a timestamp one nanosecond earlier than the correct time ([GH 31475](https://github.com/pandas-dev/pandas/issues/31475)) +* [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") raised a confusing error message when year, month or day is missing ([GH 31200](https://github.com/pandas-dev/pandas/issues/31200)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") constructor incorrectly accepting `bool`-dtype inputs ([GH 32668](https://github.com/pandas-dev/pandas/issues/32668)) +* Bug in `DatetimeIndex.searchsorted()` not accepting a `list` or [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") as its argument ([GH 32762](https://github.com/pandas-dev/pandas/issues/32762)) +* Bug where [`PeriodIndex()`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") raised when passed a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") of strings ([GH 26109](https://github.com/pandas-dev/pandas/issues/26109)) +* Bug in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") arithmetic when adding or subtracting an `np.ndarray` with `timedelta64` dtype ([GH 33296](https://github.com/pandas-dev/pandas/issues/33296)) +* Bug in [`DatetimeIndex.to_period()`](../reference/api/pandas.DatetimeIndex.to_period.html#pandas.DatetimeIndex.to_period "pandas.DatetimeIndex.to_period") not inferring the frequency when called with no arguments ([GH 33358](https://github.com/pandas-dev/pandas/issues/33358)) +* Bug in [`DatetimeIndex.tz_localize()`](../reference/api/pandas.DatetimeIndex.tz_localize.html#pandas.DatetimeIndex.tz_localize "pandas.DatetimeIndex.tz_localize") incorrectly retaining `freq` in some cases where the original `freq` is no longer valid ([GH 30511](https://github.com/pandas-dev/pandas/issues/30511)) +* Bug in `DatetimeIndex.intersection()` losing `freq` and timezone in some cases ([GH 33604](https://github.com/pandas-dev/pandas/issues/33604)) +* Bug in `DatetimeIndex.get_indexer()` where incorrect output would be returned for mixed datetime-like targets ([GH 33741](https://github.com/pandas-dev/pandas/issues/33741)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") addition and subtraction with some types of `DateOffset` objects incorrectly retaining an invalid `freq` attribute ([GH 33779](https://github.com/pandas-dev/pandas/issues/33779)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") where setting the `freq` attribute on an index could silently change the `freq` attribute on another index viewing the same data ([GH 33552](https://github.com/pandas-dev/pandas/issues/33552)) +* [`DataFrame.min()`](../reference/api/pandas.DataFrame.min.html#pandas.DataFrame.min "pandas.DataFrame.min") and [`DataFrame.max()`](../reference/api/pandas.DataFrame.max.html#pandas.DataFrame.max "pandas.DataFrame.max") were not returning consistent results with [`Series.min()`](../reference/api/pandas.Series.min.html#pandas.Series.min "pandas.Series.min") and [`Series.max()`](../reference/api/pandas.Series.max.html#pandas.Series.max "pandas.Series.max") when called on objects initialized with empty `pd.to_datetime()` +* Bug in `DatetimeIndex.intersection()` and `TimedeltaIndex.intersection()` with results not having the correct `name` attribute ([GH 33904](https://github.com/pandas-dev/pandas/issues/33904)) +* Bug in `DatetimeArray.__setitem__()`, `TimedeltaArray.__setitem__()`, `PeriodArray.__setitem__()` incorrectly allowing values with `int64` dtype to be silently cast ([GH 33717](https://github.com/pandas-dev/pandas/issues/33717)) +* Bug in subtracting [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") from [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") incorrectly raising `TypeError` in some cases where it should succeed and `IncompatibleFrequency` in some cases where it should raise `TypeError` ([GH 33883](https://github.com/pandas-dev/pandas/issues/33883)) +* Bug in constructing a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") from a read-only NumPy array with non-ns + resolution which converted to object dtype instead of coercing to `datetime64[ns]` + dtype when within the timestamp bounds ([GH 34843](https://github.com/pandas-dev/pandas/issues/34843)). +* The `freq` keyword in [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period"), [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range"), [`period_range()`](../reference/api/pandas.period_range.html#pandas.period_range "pandas.period_range"), `pd.tseries.frequencies.to_offset()` no longer allows tuples, pass as string instead ([GH 34703](https://github.com/pandas-dev/pandas/issues/34703)) +* Bug in `DataFrame.append()` when appending a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") containing a scalar tz-aware [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") to an empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") resulted in an object column instead of `datetime64[ns, tz]` dtype ([GH 35038](https://github.com/pandas-dev/pandas/issues/35038)) +* `OutOfBoundsDatetime` issues an improved error message when timestamp is out of implementation bounds. ([GH 32967](https://github.com/pandas-dev/pandas/issues/32967)) +* Bug in `AbstractHolidayCalendar.holidays()` when no rules were defined ([GH 31415](https://github.com/pandas-dev/pandas/issues/31415)) +* Bug in `Tick` comparisons raising `TypeError` when comparing against timedelta-like objects ([GH 34088](https://github.com/pandas-dev/pandas/issues/34088)) +* Bug in `Tick` multiplication raising `TypeError` when multiplying by a float ([GH 34486](https://github.com/pandas-dev/pandas/issues/34486)) + +### Timedelta[#](#timedelta "Link to this heading") + +* Bug in constructing a [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") with a high precision integer that would round the [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") components ([GH 31354](https://github.com/pandas-dev/pandas/issues/31354)) +* Bug in dividing `np.nan` or `None` by [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") incorrectly returning `NaT` ([GH 31869](https://github.com/pandas-dev/pandas/issues/31869)) +* [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") now understands `µs` as an identifier for microsecond ([GH 32899](https://github.com/pandas-dev/pandas/issues/32899)) +* [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") string representation now includes nanoseconds, when nanoseconds are non-zero ([GH 9309](https://github.com/pandas-dev/pandas/issues/9309)) +* Bug in comparing a [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") object against an `np.ndarray` with `timedelta64` dtype incorrectly viewing all entries as unequal ([GH 33441](https://github.com/pandas-dev/pandas/issues/33441)) +* Bug in [`timedelta_range()`](../reference/api/pandas.timedelta_range.html#pandas.timedelta_range "pandas.timedelta_range") that produced an extra point on a edge case ([GH 30353](https://github.com/pandas-dev/pandas/issues/30353), [GH 33498](https://github.com/pandas-dev/pandas/issues/33498)) +* Bug in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") that produced an extra point on a edge case ([GH 30353](https://github.com/pandas-dev/pandas/issues/30353), [GH 13022](https://github.com/pandas-dev/pandas/issues/13022), [GH 33498](https://github.com/pandas-dev/pandas/issues/33498)) +* Bug in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") that ignored the `loffset` argument when dealing with timedelta ([GH 7687](https://github.com/pandas-dev/pandas/issues/7687), [GH 33498](https://github.com/pandas-dev/pandas/issues/33498)) +* Bug in [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") and [`pandas.to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta") that ignored the `unit` argument for string input ([GH 12136](https://github.com/pandas-dev/pandas/issues/12136)) + +### Timezones[#](#timezones "Link to this heading") + +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with `infer_datetime_format=True` where timezone names (e.g. `UTC`) would not be parsed correctly ([GH 33133](https://github.com/pandas-dev/pandas/issues/33133)) + +### Numeric[#](#numeric "Link to this heading") + +* Bug in [`DataFrame.floordiv()`](../reference/api/pandas.DataFrame.floordiv.html#pandas.DataFrame.floordiv "pandas.DataFrame.floordiv") with `axis=0` not treating division-by-zero like [`Series.floordiv()`](../reference/api/pandas.Series.floordiv.html#pandas.Series.floordiv "pandas.Series.floordiv") ([GH 31271](https://github.com/pandas-dev/pandas/issues/31271)) +* Bug in [`to_numeric()`](../reference/api/pandas.to_numeric.html#pandas.to_numeric "pandas.to_numeric") with string argument `"uint64"` and `errors="coerce"` silently fails ([GH 32394](https://github.com/pandas-dev/pandas/issues/32394)) +* Bug in [`to_numeric()`](../reference/api/pandas.to_numeric.html#pandas.to_numeric "pandas.to_numeric") with `downcast="unsigned"` fails for empty data ([GH 32493](https://github.com/pandas-dev/pandas/issues/32493)) +* Bug in [`DataFrame.mean()`](../reference/api/pandas.DataFrame.mean.html#pandas.DataFrame.mean "pandas.DataFrame.mean") with `numeric_only=False` and either `datetime64` dtype or `PeriodDtype` column incorrectly raising `TypeError` ([GH 32426](https://github.com/pandas-dev/pandas/issues/32426)) +* Bug in [`DataFrame.count()`](../reference/api/pandas.DataFrame.count.html#pandas.DataFrame.count "pandas.DataFrame.count") with `level="foo"` and index level `"foo"` containing NaNs causes segmentation fault ([GH 21824](https://github.com/pandas-dev/pandas/issues/21824)) +* Bug in [`DataFrame.diff()`](../reference/api/pandas.DataFrame.diff.html#pandas.DataFrame.diff "pandas.DataFrame.diff") with `axis=1` returning incorrect results with mixed dtypes ([GH 32995](https://github.com/pandas-dev/pandas/issues/32995)) +* Bug in [`DataFrame.corr()`](../reference/api/pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr") and [`DataFrame.cov()`](../reference/api/pandas.DataFrame.cov.html#pandas.DataFrame.cov "pandas.DataFrame.cov") raising when handling nullable integer columns with `pandas.NA` ([GH 33803](https://github.com/pandas-dev/pandas/issues/33803)) +* Bug in arithmetic operations between [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") objects with non-overlapping columns with duplicate labels causing an infinite loop ([GH 35194](https://github.com/pandas-dev/pandas/issues/35194)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") addition and subtraction between object-dtype objects and `datetime64` dtype objects ([GH 33824](https://github.com/pandas-dev/pandas/issues/33824)) +* Bug in [`Index.difference()`](../reference/api/pandas.Index.difference.html#pandas.Index.difference "pandas.Index.difference") giving incorrect results when comparing a `Float64Index` and object [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") ([GH 35217](https://github.com/pandas-dev/pandas/issues/35217)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") reductions (e.g. `df.min()`, `df.max()`) with `ExtensionArray` dtypes ([GH 34520](https://github.com/pandas-dev/pandas/issues/34520), [GH 32651](https://github.com/pandas-dev/pandas/issues/32651)) +* [`Series.interpolate()`](../reference/api/pandas.Series.interpolate.html#pandas.Series.interpolate "pandas.Series.interpolate") and [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") now raise a ValueError if `limit_direction` is `'forward'` or `'both'` and `method` is `'backfill'` or `'bfill'` or `limit_direction` is `'backward'` or `'both'` and `method` is `'pad'` or `'ffill'` ([GH 34746](https://github.com/pandas-dev/pandas/issues/34746)) + +### Conversion[#](#conversion "Link to this heading") + +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") construction from NumPy array with big-endian `datetime64` dtype ([GH 29684](https://github.com/pandas-dev/pandas/issues/29684)) +* Bug in [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") construction with large nanoseconds keyword value ([GH 32402](https://github.com/pandas-dev/pandas/issues/32402)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") construction where sets would be duplicated rather than raising ([GH 32582](https://github.com/pandas-dev/pandas/issues/32582)) +* The [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor no longer accepts a list of [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") objects. Because of changes to NumPy, [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") objects are now consistently treated as 2D objects, so a list of [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") objects is considered 3D, and no longer acceptable for the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor ([GH 32289](https://github.com/pandas-dev/pandas/issues/32289)). +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") when initiating a frame with lists and assign `columns` with nested list for `MultiIndex` ([GH 32173](https://github.com/pandas-dev/pandas/issues/32173)) +* Improved error message for invalid construction of list when creating a new index ([GH 35190](https://github.com/pandas-dev/pandas/issues/35190)) + +### Strings[#](#strings "Link to this heading") + +* Bug in the [`astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") method when converting “string” dtype data to nullable integer dtype ([GH 32450](https://github.com/pandas-dev/pandas/issues/32450)). +* Fixed issue where taking `min` or `max` of a `StringArray` or `Series` with `StringDtype` type would raise. ([GH 31746](https://github.com/pandas-dev/pandas/issues/31746)) +* Bug in [`Series.str.cat()`](../reference/api/pandas.Series.str.cat.html#pandas.Series.str.cat "pandas.Series.str.cat") returning `NaN` output when other had [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") type ([GH 33425](https://github.com/pandas-dev/pandas/issues/33425)) +* `pandas.api.dtypes.is_string_dtype()` no longer incorrectly identifies categorical series as string. + +### Interval[#](#interval "Link to this heading") + +* Bug in `IntervalArray` incorrectly allowing the underlying data to be changed when setting values ([GH 32782](https://github.com/pandas-dev/pandas/issues/32782)) + +### Indexing[#](#indexing "Link to this heading") + +* [`DataFrame.xs()`](../reference/api/pandas.DataFrame.xs.html#pandas.DataFrame.xs "pandas.DataFrame.xs") now raises a `TypeError` if a `level` keyword is supplied and the axis is not a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex"). Previously an `AttributeError` was raised ([GH 33610](https://github.com/pandas-dev/pandas/issues/33610)) +* Bug in slicing on a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with a partial-timestamp dropping high-resolution indices near the end of a year, quarter, or month ([GH 31064](https://github.com/pandas-dev/pandas/issues/31064)) +* Bug in `PeriodIndex.get_loc()` treating higher-resolution strings differently from `PeriodIndex.get_value()` ([GH 31172](https://github.com/pandas-dev/pandas/issues/31172)) +* Bug in [`Series.at()`](../reference/api/pandas.Series.at.html#pandas.Series.at "pandas.Series.at") and [`DataFrame.at()`](../reference/api/pandas.DataFrame.at.html#pandas.DataFrame.at "pandas.DataFrame.at") not matching `.loc` behavior when looking up an integer in a `Float64Index` ([GH 31329](https://github.com/pandas-dev/pandas/issues/31329)) +* Bug in `PeriodIndex.is_monotonic()` incorrectly returning `True` when containing leading `NaT` entries ([GH 31437](https://github.com/pandas-dev/pandas/issues/31437)) +* Bug in `DatetimeIndex.get_loc()` raising `KeyError` with converted-integer key instead of the user-passed key ([GH 31425](https://github.com/pandas-dev/pandas/issues/31425)) +* Bug in [`Series.xs()`](../reference/api/pandas.Series.xs.html#pandas.Series.xs "pandas.Series.xs") incorrectly returning `Timestamp` instead of `datetime64` in some object-dtype cases ([GH 31630](https://github.com/pandas-dev/pandas/issues/31630)) +* Bug in [`DataFrame.iat()`](../reference/api/pandas.DataFrame.iat.html#pandas.DataFrame.iat "pandas.DataFrame.iat") incorrectly returning `Timestamp` instead of `datetime` in some object-dtype cases ([GH 32809](https://github.com/pandas-dev/pandas/issues/32809)) +* Bug in [`DataFrame.at()`](../reference/api/pandas.DataFrame.at.html#pandas.DataFrame.at "pandas.DataFrame.at") when either columns or index is non-unique ([GH 33041](https://github.com/pandas-dev/pandas/issues/33041)) +* Bug in [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") and [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") when indexing with an integer key on a object-dtype [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") that is not all-integers ([GH 31905](https://github.com/pandas-dev/pandas/issues/31905)) +* Bug in `DataFrame.iloc.__setitem__()` on a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with duplicate columns incorrectly setting values for all matching columns ([GH 15686](https://github.com/pandas-dev/pandas/issues/15686), [GH 22036](https://github.com/pandas-dev/pandas/issues/22036)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") and [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") with a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex"), [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex"), or [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") incorrectly allowing lookups of non-matching datetime-like dtypes ([GH 32650](https://github.com/pandas-dev/pandas/issues/32650)) +* Bug in `Series.__getitem__()` indexing with non-standard scalars, e.g. `np.dtype` ([GH 32684](https://github.com/pandas-dev/pandas/issues/32684)) +* Bug in [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") constructor where an unhelpful error message was raised for NumPy scalars ([GH 33017](https://github.com/pandas-dev/pandas/issues/33017)) +* Bug in `DataFrame.lookup()` incorrectly raising an `AttributeError` when `frame.index` or `frame.columns` is not unique; this will now raise a `ValueError` with a helpful error message ([GH 33041](https://github.com/pandas-dev/pandas/issues/33041)) +* Bug in [`Interval`](../reference/api/pandas.Interval.html#pandas.Interval "pandas.Interval") where a [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") could not be added or subtracted from a [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") interval ([GH 32023](https://github.com/pandas-dev/pandas/issues/32023)) +* Bug in [`DataFrame.copy()`](../reference/api/pandas.DataFrame.copy.html#pandas.DataFrame.copy "pandas.DataFrame.copy") not invalidating \_item\_cache after copy caused post-copy value updates to not be reflected ([GH 31784](https://github.com/pandas-dev/pandas/issues/31784)) +* Fixed regression in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") and [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") throwing an error when a `datetime64[ns, tz]` value is provided ([GH 32395](https://github.com/pandas-dev/pandas/issues/32395)) +* Bug in `Series.__getitem__()` with an integer key and a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") with leading integer level failing to raise `KeyError` if the key is not present in the first level ([GH 33355](https://github.com/pandas-dev/pandas/issues/33355)) +* Bug in [`DataFrame.iloc()`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") when slicing a single column [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with `ExtensionDtype` (e.g. `df.iloc[:, :1]`) returning an invalid result ([GH 32957](https://github.com/pandas-dev/pandas/issues/32957)) +* Bug in `DatetimeIndex.insert()` and `TimedeltaIndex.insert()` causing index `freq` to be lost when setting an element into an empty [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") ([GH 33573](https://github.com/pandas-dev/pandas/issues/33573)) +* Bug in `Series.__setitem__()` with an [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") and a list-like key of integers ([GH 33473](https://github.com/pandas-dev/pandas/issues/33473)) +* Bug in `Series.__getitem__()` allowing missing labels with `np.ndarray`, [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") indexers but not `list`, these now all raise `KeyError` ([GH 33646](https://github.com/pandas-dev/pandas/issues/33646)) +* Bug in [`DataFrame.truncate()`](../reference/api/pandas.DataFrame.truncate.html#pandas.DataFrame.truncate "pandas.DataFrame.truncate") and [`Series.truncate()`](../reference/api/pandas.Series.truncate.html#pandas.Series.truncate "pandas.Series.truncate") where index was assumed to be monotone increasing ([GH 33756](https://github.com/pandas-dev/pandas/issues/33756)) +* Indexing with a list of strings representing datetimes failed on [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") or [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") ([GH 11278](https://github.com/pandas-dev/pandas/issues/11278)) +* Bug in [`Series.at()`](../reference/api/pandas.Series.at.html#pandas.Series.at "pandas.Series.at") when used with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") would raise an exception on valid inputs ([GH 26989](https://github.com/pandas-dev/pandas/issues/26989)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") with dictionary of values changes columns with dtype of `int` to `float` ([GH 34573](https://github.com/pandas-dev/pandas/issues/34573)) +* Bug in [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") when used with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") would raise an `IndexingError` when accessing a `None` value ([GH 34318](https://github.com/pandas-dev/pandas/issues/34318)) +* Bug in [`DataFrame.reset_index()`](../reference/api/pandas.DataFrame.reset_index.html#pandas.DataFrame.reset_index "pandas.DataFrame.reset_index") and [`Series.reset_index()`](../reference/api/pandas.Series.reset_index.html#pandas.Series.reset_index "pandas.Series.reset_index") would not preserve data types on an empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") or [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 19602](https://github.com/pandas-dev/pandas/issues/19602)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") indexing with a `time` key on a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with `NaT` entries ([GH 35114](https://github.com/pandas-dev/pandas/issues/35114)) + +### Missing[#](#missing "Link to this heading") + +* Calling `fillna()` on an empty [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") now correctly returns a shallow copied object. The behaviour is now consistent with [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and a non-empty [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") ([GH 32543](https://github.com/pandas-dev/pandas/issues/32543)). +* Bug in [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") when argument `to_replace` is of type dict/list and is used on a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") containing `` was raising a `TypeError`. The method now handles this by ignoring `` values when doing the comparison for the replacement ([GH 32621](https://github.com/pandas-dev/pandas/issues/32621)) +* Bug in [`any()`](../reference/api/pandas.Series.any.html#pandas.Series.any "pandas.Series.any") and [`all()`](../reference/api/pandas.Series.all.html#pandas.Series.all "pandas.Series.all") incorrectly returning `` for all `False` or all `True` values using the nulllable Boolean dtype and with `skipna=False` ([GH 33253](https://github.com/pandas-dev/pandas/issues/33253)) +* Clarified documentation on interpolate with `method=akima`. The `der` parameter must be scalar or `None` ([GH 33426](https://github.com/pandas-dev/pandas/issues/33426)) +* [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") uses the correct axis convention now. Previously interpolating along columns lead to interpolation along indices and vice versa. Furthermore interpolating with methods `pad`, `ffill`, `bfill` and `backfill` are identical to using these methods with [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") ([GH 12918](https://github.com/pandas-dev/pandas/issues/12918), [GH 29146](https://github.com/pandas-dev/pandas/issues/29146)) +* Bug in [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") when called on a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with column names of string type was throwing a ValueError. The method is now independent of the type of the column names ([GH 33956](https://github.com/pandas-dev/pandas/issues/33956)) +* Passing [`NA`](../reference/api/pandas.NA.html#pandas.NA "pandas.NA") into a format string using format specs will now work. For example `"{:.1f}".format(pd.NA)` would previously raise a `ValueError`, but will now return the string `""` ([GH 34740](https://github.com/pandas-dev/pandas/issues/34740)) +* Bug in [`Series.map()`](../reference/api/pandas.Series.map.html#pandas.Series.map "pandas.Series.map") not raising on invalid `na_action` ([GH 32815](https://github.com/pandas-dev/pandas/issues/32815)) + +### MultiIndex[#](#multiindex "Link to this heading") + +* `DataFrame.swaplevels()` now raises a `TypeError` if the axis is not a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex"). Previously an `AttributeError` was raised ([GH 31126](https://github.com/pandas-dev/pandas/issues/31126)) +* Bug in `Dataframe.loc()` when used with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex"). The returned values were not in the same order as the given inputs ([GH 22797](https://github.com/pandas-dev/pandas/issues/22797)) + +```None +In [79]: df = pd.DataFrame(np.arange(4), + ....: index=[["a", "a", "b", "b"], [1, 2, 1, 2]]) + ....: + +# Rows are now ordered as the requested keys +In [80]: df.loc[(['b', 'a'], [2, 1]), :] +Out[80]: + 0 +b 2 3 + 1 2 +a 2 1 + 1 0 + +[4 rows x 1 columns] +``` + +* Bug in `MultiIndex.intersection()` was not guaranteed to preserve order when `sort=False`. ([GH 31325](https://github.com/pandas-dev/pandas/issues/31325)) +* Bug in [`DataFrame.truncate()`](../reference/api/pandas.DataFrame.truncate.html#pandas.DataFrame.truncate "pandas.DataFrame.truncate") was dropping [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") names. ([GH 34564](https://github.com/pandas-dev/pandas/issues/34564)) + +```None +In [81]: left = pd.MultiIndex.from_arrays([["b", "a"], [2, 1]]) + +In [82]: right = pd.MultiIndex.from_arrays([["a", "b", "c"], [1, 2, 3]]) + +# Common elements are now guaranteed to be ordered by the left side +In [83]: left.intersection(right, sort=False) +Out[83]: +MultiIndex([('b', 2), + ('a', 1)], + ) +``` + +* Bug when joining two [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") without specifying level with different columns. Return-indexers parameter was ignored. ([GH 34074](https://github.com/pandas-dev/pandas/issues/34074)) + +### IO[#](#io "Link to this heading") + +* Passing a `set` as `names` argument to [`pandas.read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv"), [`pandas.read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table"), or [`pandas.read_fwf()`](../reference/api/pandas.read_fwf.html#pandas.read_fwf "pandas.read_fwf") will raise `ValueError: Names should be an ordered collection.` ([GH 34946](https://github.com/pandas-dev/pandas/issues/34946)) +* Bug in print-out when `display.precision` is zero. ([GH 20359](https://github.com/pandas-dev/pandas/issues/20359)) +* Bug in [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") where integer overflow was occurring when json contains big number strings. ([GH 30320](https://github.com/pandas-dev/pandas/issues/30320)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") will now raise a `ValueError` when the arguments `header` and `prefix` both are not `None`. ([GH 27394](https://github.com/pandas-dev/pandas/issues/27394)) +* Bug in [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") was raising `NotFoundError` when `path_or_buf` was an S3 URI ([GH 28375](https://github.com/pandas-dev/pandas/issues/28375)) +* Bug in [`DataFrame.to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") overwriting pyarrow’s default for + `coerce_timestamps`; following pyarrow’s default allows writing nanosecond + timestamps with `version="2.0"` ([GH 31652](https://github.com/pandas-dev/pandas/issues/31652)). +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") was raising `TypeError` when `sep=None` was used in combination with `comment` keyword ([GH 31396](https://github.com/pandas-dev/pandas/issues/31396)) +* Bug in `HDFStore` that caused it to set to `int64` the dtype of a `datetime64` column when reading a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") in Python 3 from fixed format written in Python 2 ([GH 31750](https://github.com/pandas-dev/pandas/issues/31750)) +* [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") now handles dates and datetimes larger than [`Timestamp.max`](../reference/api/pandas.Timestamp.max.html#pandas.Timestamp.max "pandas.Timestamp.max") returning them as [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.13)") objects ([GH 20927](https://github.com/pandas-dev/pandas/issues/20927)) +* Bug in [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") where `Timedelta` objects would not be serialized correctly with `date_format="iso"` ([GH 28256](https://github.com/pandas-dev/pandas/issues/28256)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") will raise a `ValueError` when the column names passed in `parse_dates` are missing in the `Dataframe` ([GH 31251](https://github.com/pandas-dev/pandas/issues/31251)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") where a UTF-8 string with a high surrogate would cause a segmentation violation ([GH 23809](https://github.com/pandas-dev/pandas/issues/23809)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") was causing a file descriptor leak on an empty file ([GH 31488](https://github.com/pandas-dev/pandas/issues/31488)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") was causing a segfault when there were blank lines between the header and data rows ([GH 28071](https://github.com/pandas-dev/pandas/issues/28071)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") was raising a misleading exception on a permissions issue ([GH 23784](https://github.com/pandas-dev/pandas/issues/23784)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") was raising an `IndexError` when `header=None` and two extra data columns +* Bug in [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") was raising an `AttributeError` when reading files from Google Cloud Storage ([GH 33069](https://github.com/pandas-dev/pandas/issues/33069)) +* Bug in [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") where an `AttributeError` was raised when saving an out of bounds date ([GH 26761](https://github.com/pandas-dev/pandas/issues/26761)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") did not correctly handle multiple embedded spaces in OpenDocument text cells. ([GH 32207](https://github.com/pandas-dev/pandas/issues/32207)) +* Bug in [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") was raising `TypeError` when reading a `list` of Booleans into a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"). ([GH 31464](https://github.com/pandas-dev/pandas/issues/31464)) +* Bug in `pandas.io.json.json_normalize()` where location specified by `record_path` doesn’t point to an array. ([GH 26284](https://github.com/pandas-dev/pandas/issues/26284)) +* [`pandas.read_hdf()`](../reference/api/pandas.read_hdf.html#pandas.read_hdf "pandas.read_hdf") has a more explicit error message when loading an + unsupported HDF file ([GH 9539](https://github.com/pandas-dev/pandas/issues/9539)) +* Bug in `read_feather()` was raising an `ArrowIOError` when reading an s3 or http file path ([GH 29055](https://github.com/pandas-dev/pandas/issues/29055)) +* Bug in [`to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel") could not handle the column name `render` and was raising an `KeyError` ([GH 34331](https://github.com/pandas-dev/pandas/issues/34331)) +* Bug in `execute()` was raising a `ProgrammingError` for some DB-API drivers when the SQL statement contained the `%` character and no parameters were present ([GH 34211](https://github.com/pandas-dev/pandas/issues/34211)) +* Bug in `StataReader()` which resulted in categorical variables with different dtypes when reading data using an iterator. ([GH 31544](https://github.com/pandas-dev/pandas/issues/31544)) +* [`HDFStore.keys()`](../reference/api/pandas.HDFStore.keys.html#pandas.HDFStore.keys "pandas.HDFStore.keys") has now an optional `include` parameter that allows the retrieval of all native HDF5 table names ([GH 29916](https://github.com/pandas-dev/pandas/issues/29916)) +* `TypeError` exceptions raised by [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") and [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") were showing as `parser_f` when an unexpected keyword argument was passed ([GH 25648](https://github.com/pandas-dev/pandas/issues/25648)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") for ODS files removes 0.0 values ([GH 27222](https://github.com/pandas-dev/pandas/issues/27222)) +* Bug in `ujson.encode()` was raising an `OverflowError` with numbers larger than `sys.maxsize` ([GH 34395](https://github.com/pandas-dev/pandas/issues/34395)) +* Bug in `HDFStore.append_to_multiple()` was raising a `ValueError` when the `min_itemsize` parameter is set ([GH 11238](https://github.com/pandas-dev/pandas/issues/11238)) +* Bug in `create_table()` now raises an error when `column` argument was not specified in `data_columns` on input ([GH 28156](https://github.com/pandas-dev/pandas/issues/28156)) +* [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") now could read line-delimited json file from a file url while `lines` and `chunksize` are set. +* Bug in [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") when reading DataFrames with `-np.inf` entries with MySQL now has a more explicit `ValueError` ([GH 34431](https://github.com/pandas-dev/pandas/issues/34431)) +* Bug where capitalised files extensions were not decompressed by read\_\* functions ([GH 35164](https://github.com/pandas-dev/pandas/issues/35164)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") that was raising a `TypeError` when `header=None` and `index_col` is given as a `list` ([GH 31783](https://github.com/pandas-dev/pandas/issues/31783)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") where datetime values are used in the header in a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 34748](https://github.com/pandas-dev/pandas/issues/34748)) +* [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") no longer takes `**kwds` arguments. This means that passing in the keyword argument `chunksize` now raises a `TypeError` (previously raised a `NotImplementedError`), while passing in the keyword argument `encoding` now raises a `TypeError` ([GH 34464](https://github.com/pandas-dev/pandas/issues/34464)) +* Bug in [`DataFrame.to_records()`](../reference/api/pandas.DataFrame.to_records.html#pandas.DataFrame.to_records "pandas.DataFrame.to_records") was incorrectly losing timezone information in timezone-aware `datetime64` columns ([GH 32535](https://github.com/pandas-dev/pandas/issues/32535)) + +### Plotting[#](#plotting "Link to this heading") + +* [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") for line/bar now accepts color by dictionary ([GH 8193](https://github.com/pandas-dev/pandas/issues/8193)). +* Bug in [`DataFrame.plot.hist()`](../reference/api/pandas.DataFrame.plot.hist.html#pandas.DataFrame.plot.hist "pandas.DataFrame.plot.hist") where weights are not working for multiple columns ([GH 33173](https://github.com/pandas-dev/pandas/issues/33173)) +* Bug in [`DataFrame.boxplot()`](../reference/api/pandas.DataFrame.boxplot.html#pandas.DataFrame.boxplot "pandas.DataFrame.boxplot") and `DataFrame.plot.boxplot()` lost color attributes of `medianprops`, `whiskerprops`, `capprops` and `boxprops` ([GH 30346](https://github.com/pandas-dev/pandas/issues/30346)) +* Bug in [`DataFrame.hist()`](../reference/api/pandas.DataFrame.hist.html#pandas.DataFrame.hist "pandas.DataFrame.hist") where the order of `column` argument was ignored ([GH 29235](https://github.com/pandas-dev/pandas/issues/29235)) +* Bug in [`DataFrame.plot.scatter()`](../reference/api/pandas.DataFrame.plot.scatter.html#pandas.DataFrame.plot.scatter "pandas.DataFrame.plot.scatter") that when adding multiple plots with different `cmap`, colorbars always use the first `cmap` ([GH 33389](https://github.com/pandas-dev/pandas/issues/33389)) +* Bug in [`DataFrame.plot.scatter()`](../reference/api/pandas.DataFrame.plot.scatter.html#pandas.DataFrame.plot.scatter "pandas.DataFrame.plot.scatter") was adding a colorbar to the plot even if the argument `c` was assigned to a column containing color names ([GH 34316](https://github.com/pandas-dev/pandas/issues/34316)) +* Bug in [`pandas.plotting.bootstrap_plot()`](../reference/api/pandas.plotting.bootstrap_plot.html#pandas.plotting.bootstrap_plot "pandas.plotting.bootstrap_plot") was causing cluttered axes and overlapping labels ([GH 34905](https://github.com/pandas-dev/pandas/issues/34905)) +* Bug in [`DataFrame.plot.scatter()`](../reference/api/pandas.DataFrame.plot.scatter.html#pandas.DataFrame.plot.scatter "pandas.DataFrame.plot.scatter") caused an error when plotting variable marker sizes ([GH 32904](https://github.com/pandas-dev/pandas/issues/32904)) + +### GroupBy/resample/rolling[#](#groupby-resample-rolling "Link to this heading") + +* Using a [`pandas.api.indexers.BaseIndexer`](../reference/api/pandas.api.indexers.BaseIndexer.html#pandas.api.indexers.BaseIndexer "pandas.api.indexers.BaseIndexer") with `count`, `min`, `max`, `median`, `skew`, `cov`, `corr` will now return correct results for any monotonic [`pandas.api.indexers.BaseIndexer`](../reference/api/pandas.api.indexers.BaseIndexer.html#pandas.api.indexers.BaseIndexer "pandas.api.indexers.BaseIndexer") descendant ([GH 32865](https://github.com/pandas-dev/pandas/issues/32865)) +* `DataFrameGroupby.mean()` and `SeriesGroupby.mean()` (and similarly for `median()`, `std()` and `var()`) now raise a `TypeError` if a non-accepted keyword argument is passed into it. Previously an `UnsupportedFunctionCall` was raised (`AssertionError` if `min_count` passed into `median()`) ([GH 31485](https://github.com/pandas-dev/pandas/issues/31485)) +* Bug in [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") and [`SeriesGroupBy.apply()`](../reference/api/pandas.core.groupby.SeriesGroupBy.apply.html#pandas.core.groupby.SeriesGroupBy.apply "pandas.core.groupby.SeriesGroupBy.apply") raising `ValueError` when the `by` axis is not sorted, has duplicates, and the applied `func` does not mutate passed in objects ([GH 30667](https://github.com/pandas-dev/pandas/issues/30667)) +* Bug in `DataFrameGroupBy.transform()` produces an incorrect result with transformation functions ([GH 30918](https://github.com/pandas-dev/pandas/issues/30918)) +* Bug in [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") and [`SeriesGroupBy.transform()`](../reference/api/pandas.core.groupby.SeriesGroupBy.transform.html#pandas.core.groupby.SeriesGroupBy.transform "pandas.core.groupby.SeriesGroupBy.transform") were returning the wrong result when grouping by multiple keys of which some were categorical and others not ([GH 32494](https://github.com/pandas-dev/pandas/issues/32494)) +* Bug in [`DataFrameGroupBy.count()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.count.html#pandas.core.groupby.DataFrameGroupBy.count "pandas.core.groupby.DataFrameGroupBy.count") and [`SeriesGroupBy.count()`](../reference/api/pandas.core.groupby.SeriesGroupBy.count.html#pandas.core.groupby.SeriesGroupBy.count "pandas.core.groupby.SeriesGroupBy.count") causing segmentation fault when grouped-by columns contain NaNs ([GH 32841](https://github.com/pandas-dev/pandas/issues/32841)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") and [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") produces inconsistent type when aggregating Boolean [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") ([GH 32894](https://github.com/pandas-dev/pandas/issues/32894)) +* Bug in `DataFrameGroupBy.sum()` and `SeriesGroupBy.sum()` where a large negative number would be returned when the number of non-null values was below `min_count` for nullable integer dtypes ([GH 32861](https://github.com/pandas-dev/pandas/issues/32861)) +* Bug in `SeriesGroupBy.quantile()` was raising on nullable integers ([GH 33136](https://github.com/pandas-dev/pandas/issues/33136)) +* Bug in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") where an `AmbiguousTimeError` would be raised when the resulting timezone aware [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") had a DST transition at midnight ([GH 25758](https://github.com/pandas-dev/pandas/issues/25758)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") where a `ValueError` would be raised when grouping by a categorical column with read-only categories and `sort=False` ([GH 33410](https://github.com/pandas-dev/pandas/issues/33410)) +* Bug in [`DataFrameGroupBy.agg()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg"), [`SeriesGroupBy.agg()`](../reference/api/pandas.core.groupby.SeriesGroupBy.agg.html#pandas.core.groupby.SeriesGroupBy.agg "pandas.core.groupby.SeriesGroupBy.agg"), [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform"), [`SeriesGroupBy.transform()`](../reference/api/pandas.core.groupby.SeriesGroupBy.transform.html#pandas.core.groupby.SeriesGroupBy.transform "pandas.core.groupby.SeriesGroupBy.transform"), [`DataFrameGroupBy.resample()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.resample.html#pandas.core.groupby.DataFrameGroupBy.resample "pandas.core.groupby.DataFrameGroupBy.resample"), and [`SeriesGroupBy.resample()`](../reference/api/pandas.core.groupby.SeriesGroupBy.resample.html#pandas.core.groupby.SeriesGroupBy.resample "pandas.core.groupby.SeriesGroupBy.resample") where subclasses are not preserved ([GH 28330](https://github.com/pandas-dev/pandas/issues/28330)) +* Bug in `SeriesGroupBy.agg()` where any column name was accepted in the named aggregation of `SeriesGroupBy` previously. The behaviour now allows only `str` and callables else would raise `TypeError`. ([GH 34422](https://github.com/pandas-dev/pandas/issues/34422)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") lost the name of the [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") when one of the `agg` keys referenced an empty list ([GH 32580](https://github.com/pandas-dev/pandas/issues/32580)) +* Bug in `Rolling.apply()` where `center=True` was ignored when `engine='numba'` was specified ([GH 34784](https://github.com/pandas-dev/pandas/issues/34784)) +* Bug in `DataFrame.ewm.cov()` was throwing `AssertionError` for [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") inputs ([GH 34440](https://github.com/pandas-dev/pandas/issues/34440)) +* Bug in [`core.groupby.DataFrameGroupBy.quantile()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.quantile.html#pandas.core.groupby.DataFrameGroupBy.quantile "pandas.core.groupby.DataFrameGroupBy.quantile") raised `TypeError` for non-numeric types rather than dropping the columns ([GH 27892](https://github.com/pandas-dev/pandas/issues/27892)) +* Bug in [`core.groupby.DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") when `func='nunique'` and columns are of type `datetime64`, the result would also be of type `datetime64` instead of `int64` ([GH 35109](https://github.com/pandas-dev/pandas/issues/35109)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") raising an `AttributeError` when selecting a column and aggregating with `as_index=False` ([GH 35246](https://github.com/pandas-dev/pandas/issues/35246)). +* Bug in `DataFrameGroupBy.first()` and `DataFrameGroupBy.last()` that would raise an unnecessary `ValueError` when grouping on multiple `Categoricals` ([GH 34951](https://github.com/pandas-dev/pandas/issues/34951)) + +### Reshaping[#](#reshaping "Link to this heading") + +* Bug effecting all numeric and Boolean reduction methods not returning subclassed data type. ([GH 25596](https://github.com/pandas-dev/pandas/issues/25596)) +* Bug in [`DataFrame.pivot_table()`](../reference/api/pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table") when only `MultiIndexed` columns is set ([GH 17038](https://github.com/pandas-dev/pandas/issues/17038)) +* Bug in [`DataFrame.unstack()`](../reference/api/pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack") and [`Series.unstack()`](../reference/api/pandas.Series.unstack.html#pandas.Series.unstack "pandas.Series.unstack") can take tuple names in `MultiIndexed` data ([GH 19966](https://github.com/pandas-dev/pandas/issues/19966)) +* Bug in [`DataFrame.pivot_table()`](../reference/api/pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table") when `margin` is `True` and only `column` is defined ([GH 31016](https://github.com/pandas-dev/pandas/issues/31016)) +* Fixed incorrect error message in [`DataFrame.pivot()`](../reference/api/pandas.DataFrame.pivot.html#pandas.DataFrame.pivot "pandas.DataFrame.pivot") when `columns` is set to `None`. ([GH 30924](https://github.com/pandas-dev/pandas/issues/30924)) +* Bug in [`crosstab()`](../reference/api/pandas.crosstab.html#pandas.crosstab "pandas.crosstab") when inputs are two [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and have tuple names, the output will keep a dummy [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") as columns. ([GH 18321](https://github.com/pandas-dev/pandas/issues/18321)) +* [`DataFrame.pivot()`](../reference/api/pandas.DataFrame.pivot.html#pandas.DataFrame.pivot "pandas.DataFrame.pivot") can now take lists for `index` and `columns` arguments ([GH 21425](https://github.com/pandas-dev/pandas/issues/21425)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") where the resulting indices are not copied when `copy=True` ([GH 29879](https://github.com/pandas-dev/pandas/issues/29879)) +* Bug in `SeriesGroupBy.aggregate()` was resulting in aggregations being overwritten when they shared the same name ([GH 30880](https://github.com/pandas-dev/pandas/issues/30880)) +* Bug where [`Index.astype()`](../reference/api/pandas.Index.astype.html#pandas.Index.astype "pandas.Index.astype") would lose the `name` attribute when converting from `Float64Index` to `Int64Index`, or when casting to an `ExtensionArray` dtype ([GH 32013](https://github.com/pandas-dev/pandas/issues/32013)) +* `Series.append()` will now raise a `TypeError` when passed a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") or a sequence containing [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 31413](https://github.com/pandas-dev/pandas/issues/31413)) +* [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") and [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") will raise a `TypeError` if `to_replace` is not an expected type. Previously the `replace` would fail silently ([GH 18634](https://github.com/pandas-dev/pandas/issues/18634)) +* Bug on inplace operation of a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") that was adding a column to the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") from where it was originally dropped from (using `inplace=True`) ([GH 30484](https://github.com/pandas-dev/pandas/issues/30484)) +* Bug in [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") where callback was called with [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") parameter even though `raw=True` requested. ([GH 32423](https://github.com/pandas-dev/pandas/issues/32423)) +* Bug in [`DataFrame.pivot_table()`](../reference/api/pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table") losing timezone information when creating a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") level from a column with timezone-aware dtype ([GH 32558](https://github.com/pandas-dev/pandas/issues/32558)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") where when passing a non-dict mapping as `objs` would raise a `TypeError` ([GH 32863](https://github.com/pandas-dev/pandas/issues/32863)) +* [`DataFrame.agg()`](../reference/api/pandas.DataFrame.agg.html#pandas.DataFrame.agg "pandas.DataFrame.agg") now provides more descriptive `SpecificationError` message when attempting to aggregate a non-existent column ([GH 32755](https://github.com/pandas-dev/pandas/issues/32755)) +* Bug in [`DataFrame.unstack()`](../reference/api/pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack") when [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") columns and [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") rows were used ([GH 32624](https://github.com/pandas-dev/pandas/issues/32624), [GH 24729](https://github.com/pandas-dev/pandas/issues/24729) and [GH 28306](https://github.com/pandas-dev/pandas/issues/28306)) +* Appending a dictionary to a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") without passing `ignore_index=True` will raise `TypeError: Can only append a dict if ignore_index=True` instead of `` TypeError: Can only append a :class:`Series` if ignore_index=True or if the :class:`Series` has a name `` ([GH 30871](https://github.com/pandas-dev/pandas/issues/30871)) +* Bug in [`DataFrame.corrwith()`](../reference/api/pandas.DataFrame.corrwith.html#pandas.DataFrame.corrwith "pandas.DataFrame.corrwith"), [`DataFrame.memory_usage()`](../reference/api/pandas.DataFrame.memory_usage.html#pandas.DataFrame.memory_usage "pandas.DataFrame.memory_usage"), [`DataFrame.dot()`](../reference/api/pandas.DataFrame.dot.html#pandas.DataFrame.dot "pandas.DataFrame.dot"), + [`DataFrame.idxmin()`](../reference/api/pandas.DataFrame.idxmin.html#pandas.DataFrame.idxmin "pandas.DataFrame.idxmin"), [`DataFrame.idxmax()`](../reference/api/pandas.DataFrame.idxmax.html#pandas.DataFrame.idxmax "pandas.DataFrame.idxmax"), [`DataFrame.duplicated()`](../reference/api/pandas.DataFrame.duplicated.html#pandas.DataFrame.duplicated "pandas.DataFrame.duplicated"), [`DataFrame.isin()`](../reference/api/pandas.DataFrame.isin.html#pandas.DataFrame.isin "pandas.DataFrame.isin"), + [`DataFrame.count()`](../reference/api/pandas.DataFrame.count.html#pandas.DataFrame.count "pandas.DataFrame.count"), [`Series.explode()`](../reference/api/pandas.Series.explode.html#pandas.Series.explode "pandas.Series.explode"), [`Series.asof()`](../reference/api/pandas.Series.asof.html#pandas.Series.asof "pandas.Series.asof") and [`DataFrame.asof()`](../reference/api/pandas.DataFrame.asof.html#pandas.DataFrame.asof "pandas.DataFrame.asof") not + returning subclassed types. ([GH 31331](https://github.com/pandas-dev/pandas/issues/31331)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") was not allowing for concatenation of [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with duplicate keys ([GH 33654](https://github.com/pandas-dev/pandas/issues/33654)) +* Bug in [`cut()`](../reference/api/pandas.cut.html#pandas.cut "pandas.cut") raised an error when the argument `labels` contains duplicates ([GH 33141](https://github.com/pandas-dev/pandas/issues/33141)) +* Ensure only named functions can be used in [`eval()`](../reference/api/pandas.eval.html#pandas.eval "pandas.eval") ([GH 32460](https://github.com/pandas-dev/pandas/issues/32460)) +* Bug in `Dataframe.aggregate()` and [`Series.aggregate()`](../reference/api/pandas.Series.aggregate.html#pandas.Series.aggregate "pandas.Series.aggregate") was causing a recursive loop in some cases ([GH 34224](https://github.com/pandas-dev/pandas/issues/34224)) +* Fixed bug in [`melt()`](../reference/api/pandas.melt.html#pandas.melt "pandas.melt") where melting [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") columns with `col_level > 0` would raise a `KeyError` on `id_vars` ([GH 34129](https://github.com/pandas-dev/pandas/issues/34129)) +* Bug in [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where") with an empty [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and empty `cond` having non-bool dtype ([GH 34592](https://github.com/pandas-dev/pandas/issues/34592)) +* Fixed regression where [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") would raise `ValueError` for elements with `S` dtype ([GH 34529](https://github.com/pandas-dev/pandas/issues/34529)) + +### Sparse[#](#sparse "Link to this heading") + +* Creating a `SparseArray` from timezone-aware dtype will issue a warning before dropping timezone information, instead of doing so silently ([GH 32501](https://github.com/pandas-dev/pandas/issues/32501)) +* Bug in `arrays.SparseArray.from_spmatrix()` wrongly read scipy sparse matrix ([GH 31991](https://github.com/pandas-dev/pandas/issues/31991)) +* Bug in [`Series.sum()`](../reference/api/pandas.Series.sum.html#pandas.Series.sum "pandas.Series.sum") with `SparseArray` raised a `TypeError` ([GH 25777](https://github.com/pandas-dev/pandas/issues/25777)) +* Bug where [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") containing an all-sparse `SparseArray` filled with `NaN` when indexed by a list-like ([GH 27781](https://github.com/pandas-dev/pandas/issues/27781), [GH 29563](https://github.com/pandas-dev/pandas/issues/29563)) +* The repr of [`SparseDtype`](../reference/api/pandas.SparseDtype.html#pandas.SparseDtype "pandas.SparseDtype") now includes the repr of its `fill_value` attribute. Previously it used `fill_value`’s string representation ([GH 34352](https://github.com/pandas-dev/pandas/issues/34352)) +* Bug where empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") could not be cast to [`SparseDtype`](../reference/api/pandas.SparseDtype.html#pandas.SparseDtype "pandas.SparseDtype") ([GH 33113](https://github.com/pandas-dev/pandas/issues/33113)) +* Bug in [`arrays.SparseArray()`](../reference/api/pandas.arrays.SparseArray.html#pandas.arrays.SparseArray "pandas.arrays.SparseArray") was returning the incorrect type when indexing a sparse dataframe with an iterable ([GH 34526](https://github.com/pandas-dev/pandas/issues/34526), [GH 34540](https://github.com/pandas-dev/pandas/issues/34540)) + +### ExtensionArray[#](#extensionarray "Link to this heading") + +* Fixed bug where [`Series.value_counts()`](../reference/api/pandas.Series.value_counts.html#pandas.Series.value_counts "pandas.Series.value_counts") would raise on empty input of `Int64` dtype ([GH 33317](https://github.com/pandas-dev/pandas/issues/33317)) +* Fixed bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") when concatenating [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") objects with non-overlapping columns resulting in object-dtype columns rather than preserving the extension dtype ([GH 27692](https://github.com/pandas-dev/pandas/issues/27692), [GH 33027](https://github.com/pandas-dev/pandas/issues/33027)) +* Fixed bug where `StringArray.isna()` would return `False` for NA values when `pandas.options.mode.use_inf_as_na` was set to `True` ([GH 33655](https://github.com/pandas-dev/pandas/issues/33655)) +* Fixed bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") construction with EA dtype and index but no data or scalar data fails ([GH 26469](https://github.com/pandas-dev/pandas/issues/26469)) +* Fixed bug that caused `Series.__repr__()` to crash for extension types whose elements are multidimensional arrays ([GH 33770](https://github.com/pandas-dev/pandas/issues/33770)). +* Fixed bug where [`Series.update()`](../reference/api/pandas.Series.update.html#pandas.Series.update "pandas.Series.update") would raise a `ValueError` for `ExtensionArray` dtypes with missing values ([GH 33980](https://github.com/pandas-dev/pandas/issues/33980)) +* Fixed bug where `StringArray.memory_usage()` was not implemented ([GH 33963](https://github.com/pandas-dev/pandas/issues/33963)) +* Fixed bug where `DataFrameGroupBy()` would ignore the `min_count` argument for aggregations on nullable Boolean dtypes ([GH 34051](https://github.com/pandas-dev/pandas/issues/34051)) +* Fixed bug where the constructor of [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with `dtype='string'` would fail ([GH 27953](https://github.com/pandas-dev/pandas/issues/27953), [GH 33623](https://github.com/pandas-dev/pandas/issues/33623)) +* Bug where [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") column set to scalar extension type was considered an object type rather than the extension type ([GH 34832](https://github.com/pandas-dev/pandas/issues/34832)) +* Fixed bug in `IntegerArray.astype()` to correctly copy the mask as well ([GH 34931](https://github.com/pandas-dev/pandas/issues/34931)). + +### Other[#](#other "Link to this heading") + +* Set operations on an object-dtype [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") now always return object-dtype results ([GH 31401](https://github.com/pandas-dev/pandas/issues/31401)) +* Fixed [`pandas.testing.assert_series_equal()`](../reference/api/pandas.testing.assert_series_equal.html#pandas.testing.assert_series_equal "pandas.testing.assert_series_equal") to correctly raise if the `left` argument is a different subclass with `check_series_type=True` ([GH 32670](https://github.com/pandas-dev/pandas/issues/32670)). +* Getting a missing attribute in a [`DataFrame.query()`](../reference/api/pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") or [`DataFrame.eval()`](../reference/api/pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval") string raises the correct `AttributeError` ([GH 32408](https://github.com/pandas-dev/pandas/issues/32408)) +* Fixed bug in [`pandas.testing.assert_series_equal()`](../reference/api/pandas.testing.assert_series_equal.html#pandas.testing.assert_series_equal "pandas.testing.assert_series_equal") where dtypes were checked for `Interval` and `ExtensionArray` operands when `check_dtype` was `False` ([GH 32747](https://github.com/pandas-dev/pandas/issues/32747)) +* Bug in `DataFrame.__dir__()` caused a segfault when using unicode surrogates in a column name ([GH 25509](https://github.com/pandas-dev/pandas/issues/25509)) +* Bug in [`DataFrame.equals()`](../reference/api/pandas.DataFrame.equals.html#pandas.DataFrame.equals "pandas.DataFrame.equals") and [`Series.equals()`](../reference/api/pandas.Series.equals.html#pandas.Series.equals "pandas.Series.equals") in allowing subclasses to be equal ([GH 34402](https://github.com/pandas-dev/pandas/issues/34402)). + +## Contributors[#](#contributors "Link to this heading") + +A total of 368 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* 3vts + +* A Brooks + +* Abbie Popa + +* Achmad Syarif Hidayatullah + +* Adam W Bagaskarta + +* Adrian Mastronardi + +* Aidan Montare + +* Akbar Septriyan + +* Akos Furton + +* Alejandro Hall + +* Alex Hall + +* Alex Itkes + +* Alex Kirko +* Ali McMaster + +* Alvaro Aleman + +* Amy Graham + +* Andrew Schonfeld + +* Andrew Shumanskiy + +* Andrew Wieteska + +* Angela Ambroz +* Anjali Singh + +* Anna Daglis +* Anthony Milbourne + +* Antony Lee + +* Ari Sosnovsky + +* Arkadeep Adhikari + +* Arunim Samudra + +* Ashkan + +* Ashwin Prakash Nalwade + +* Ashwin Srinath + +* Atsushi Nukariya + +* Ayappan + +* Ayla Khan + +* Bart + +* Bart Broere + +* Benjamin Beier Liu + +* Benjamin Fischer + +* Bharat Raghunathan +* Bradley Dice + +* Brendan Sullivan + +* Brian Strand + +* Carsten van Weelden + +* Chamoun Saoma + +* ChrisRobo + +* Christian Chwala +* Christopher Whelan +* Christos Petropoulos + +* Chuanzhu Xu +* CloseChoice + +* Clément Robert + +* CuylenE + +* DanBasson + +* Daniel Saxton +* Danilo Horta + +* DavaIlhamHaeruzaman + +* Dave Hirschfeld +* Dave Hughes +* David Rouquet + +* David S + +* Deepyaman Datta +* Dennis Bakhuis + +* Derek McCammond + +* Devjeet Roy + +* Diane Trout +* Dina + +* Dom + +* Drew Seibert + +* EdAbati +* Emiliano Jordan + +* Erfan Nariman + +* Eric Groszman + +* Erik Hasse + +* Erkam Uyanik + +* Evan D + +* Evan Kanter + +* Fangchen Li + +* Farhan Reynaldo + +* Farhan Reynaldo Hutabarat + +* Florian Jetter + +* Fred Reiss + +* GYHHAHA + +* Gabriel Moreira + +* Gabriel Tutui + +* Galuh Sahid +* Gaurav Chauhan + +* George Hartzell + +* Gim Seng + +* Giovanni Lanzani + +* Gordon Chen + +* Graham Wetzler + +* Guillaume Lemaitre +* Guillem Sánchez + +* HH-MWB + +* Harshavardhan Bachina +* How Si Wei +* Ian Eaves +* Iqrar Agalosi Nureyza + +* Irv Lustig +* Iva Laginja + +* JDkuba +* Jack Greisman + +* Jacob Austin + +* Jacob Deppen + +* Jacob Peacock + +* Jake Tae + +* Jake Vanderplas + +* James Cobon-Kerr +* Jan Červenka + +* Jan Škoda +* Jane Chen + +* Jean-Francois Zinque + +* Jeanderson Barros Candido + +* Jeff Reback +* Jered Dominguez-Trujillo + +* Jeremy Schendel +* Jesse Farnham +* Jiaxiang +* Jihwan Song + +* Joaquim L. Viegas + +* Joel Nothman +* John Bodley + +* John Paton + +* Jon Thielen + +* Joris Van den Bossche +* Jose Manuel Martí + +* Joseph Gulian + +* Josh Dimarsky +* Joy Bhalla + +* João Veiga + +* Julian de Ruiter + +* Justin Essert + +* Justin Zheng +* KD-dev-lab + +* Kaiqi Dong +* Karthik Mathur + +* Kaushal Rohit + +* Kee Chong Tan +* Ken Mankoff + +* Kendall Masse +* Kenny Huynh + +* Ketan + +* Kevin Anderson + +* Kevin Bowey + +* Kevin Sheppard +* Kilian Lieret + +* Koki Nishihara + +* Krishna Chivukula + +* KrishnaSai2020 + +* Lesley + +* Lewis Cowles + +* Linda Chen + +* Linxiao Wu + +* Lucca Delchiaro Costabile + +* MBrouns + +* Mabel Villalba +* Mabroor Ahmed + +* Madhuri Palanivelu + +* Mak Sze Chun +* Malcolm + +* Marc Garcia +* Marco Gorelli +* Marian Denes + +* Martin Bjeldbak Madsen + +* Martin Durant + +* Martin Fleischmann + +* Martin Jones + +* Martin Winkel +* Martina Oefelein + +* Marvzinc + +* María Marino + +* Matheus Cardoso + +* Mathis Felardos + +* Matt Roeschke +* Matteo Felici + +* Matteo Santamaria + +* Matthew Roeschke +* Matthias Bussonnier +* Max Chen +* Max Halford + +* Mayank Bisht + +* Megan Thong + +* Michael Marino + +* Miguel Marques + +* Mike Kutzma +* Mohammad Hasnain Mohsin Rajan + +* Mohammad Jafar Mashhadi + +* MomIsBestFriend +* Monica + +* Natalie Jann +* Nate Armstrong + +* Nathanael + +* Nick Newman + +* Nico Schlömer + +* Niklas Weber + +* ObliviousParadigm + +* Olga Lyashevska + +* OlivierLuG + +* Pandas Development Team +* Parallels + +* Patrick + +* Patrick Cando + +* Paul Lilley + +* Paul Sanders + +* Pearcekieser + +* Pedro Larroy + +* Pedro Reys +* Peter Bull + +* Peter Steinbach + +* Phan Duc Nhat Minh + +* Phil Kirlin + +* Pierre-Yves Bourguignon + +* Piotr Kasprzyk + +* Piotr Niełacny + +* Prakhar Pandey +* Prashant Anand + +* Puneetha Pai + +* Quang Nguyễn + +* Rafael Jaimes III + +* Rafif + +* RaisaDZ + +* Rakshit Naidu + +* Ram Rachum + +* Red + +* Ricardo Alanis + +* Richard Shadrach + +* Rik-de-Kort +* Robert de Vries +* Robin to Roxel + +* Roger Erens + +* Rohith295 + +* Roman Yurchak +* Ror + +* Rushabh Vasani +* Ryan +* Ryan Nazareth +* SAI SRAVAN MEDICHERLA + +* SHUBH CHATTERJEE + +* Sam Cohan +* Samira-g-js + +* Sandu Ursu + +* Sang Agung + +* SanthoshBala18 + +* Sasidhar Kasturi + +* SatheeshKumar Mohan + +* Saul Shanabrook +* Scott Gigante + +* Sebastian Berg + +* Sebastián Vanrell +* Sergei Chipiga + +* Sergey + +* ShilpaSugan + +* Simon Gibbons +* Simon Hawkins +* Simon Legner + +* Soham Tiwari + +* Song Wenhao + +* Souvik Mandal +* Spencer Clark +* Steffen Rehberg + +* Steffen Schmitz + +* Stijn Van Hoey +* Stéphan Taljaard +* SultanOrazbayev + +* Sumanau Sareen +* SurajH1 + +* Suvayu Ali + +* Terji Petersen +* Thomas J Fan + +* Thomas Li +* Thomas Smith + +* Tim Swast +* Tobias Pitters + +* Tom + +* Tom Augspurger +* Uwe L. Korn +* Valentin Iovene + +* Vandana Iyer + +* Venkatesh Datta + +* Vijay Sai Mutyala + +* Vikas Pandey +* Vipul Rai + +* Vishwam Pandya + +* Vladimir Berkutov + +* Will Ayd +* Will Holmgren +* William + +* William Ayd +* Yago González + +* Yosuke KOBAYASHI + +* Zachary Lawrence + +* Zaky Bilfagih + +* Zeb Nicholls + +* alimcmaster1 +* alm + +* andhikayusup + +* andresmcneill + +* avinashpancham + +* benabel + +* bernie gray + +* biddwan09 + +* brock + +* chris-b1 +* cleconte987 + +* dan1261 + +* david-cortes + +* davidwales + +* dequadras + +* dhuettenmoser + +* dilex42 + +* elmonsomiat + +* epizzigoni + +* fjetter +* gabrielvf1 + +* gdex1 + +* gfyoung +* guru kiran + +* h-vishal +* iamshwin +* jamin-aws-ospo + +* jbrockmendel +* jfcorbett + +* jnecus + +* kernc +* kota matsuoka + +* kylekeppler + +* leandermaben + +* link2xt + +* manoj\_koneni + +* marydmit + +* masterpiga + +* maxime.song + +* mglasder + +* moaraccounts + +* mproszewska +* neilkg +* nrebena +* ossdev07 + +* paihu +* pan Jacek + +* partev + +* patrick + +* pedrooa + +* pizzathief + +* proost +* pvanhauw + +* rbenes +* rebecca-palmer +* rhshadrach + +* rjfs + +* s-scherrer + +* sage + +* sagungrp + +* salem3358 + +* saloni30 + +* smartswdeveloper + +* smartvinnetou + +* themien + +* timhunderwood + +* tolhassianipar + +* tonywu1999 +* tsvikas +* tv3141 +* venkateshdatta1993 + +* vivikelapoutre + +* willbowditch + +* willpeppo + +* za + +* zaki-indra + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.1.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.1.1.md new file mode 100644 index 0000000000000000000000000000000000000000..5264f0c1c9ed35154c1c5256845383591f95aad7 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.1.1.md @@ -0,0 +1,62 @@ +# What's new in pandas 1.1.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.1.1.html + +# What’s new in 1.1.1 (August 20, 2020)[#](#what-s-new-in-1-1-1-august-20-2020 "Link to this heading") + +These are the changes in pandas 1.1.1. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in `CategoricalIndex.format()` where, when stringified scalars had different lengths, the shorter string would be right-filled with spaces, so it had the same length as the longest string ([GH 35439](https://github.com/pandas-dev/pandas/issues/35439)) +* Fixed regression in [`Series.truncate()`](../reference/api/pandas.Series.truncate.html#pandas.Series.truncate "pandas.Series.truncate") when trying to truncate a single-element series ([GH 35544](https://github.com/pandas-dev/pandas/issues/35544)) +* Fixed regression where [`DataFrame.to_numpy()`](../reference/api/pandas.DataFrame.to_numpy.html#pandas.DataFrame.to_numpy "pandas.DataFrame.to_numpy") would raise a `RuntimeError` for mixed dtypes when converting to `str` ([GH 35455](https://github.com/pandas-dev/pandas/issues/35455)) +* Fixed regression where [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") would raise a `ValueError` when `pandas.options.mode.use_inf_as_na` was set to `True` ([GH 35493](https://github.com/pandas-dev/pandas/issues/35493)) +* Fixed regression where [`pandas.testing.assert_series_equal()`](../reference/api/pandas.testing.assert_series_equal.html#pandas.testing.assert_series_equal "pandas.testing.assert_series_equal") would raise an error when non-numeric dtypes were passed with `check_exact=True` ([GH 35446](https://github.com/pandas-dev/pandas/issues/35446)) +* Fixed regression in `.groupby(..).rolling(..)` where column selection was ignored ([GH 35486](https://github.com/pandas-dev/pandas/issues/35486)) +* Fixed regression where [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") would raise a `TypeError` when the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") was empty ([GH 35598](https://github.com/pandas-dev/pandas/issues/35598)) +* Fixed regression in [`DataFrame.shift()`](../reference/api/pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift") with `axis=1` and heterogeneous dtypes ([GH 35488](https://github.com/pandas-dev/pandas/issues/35488)) +* Fixed regression in [`DataFrame.diff()`](../reference/api/pandas.DataFrame.diff.html#pandas.DataFrame.diff "pandas.DataFrame.diff") with read-only data ([GH 35559](https://github.com/pandas-dev/pandas/issues/35559)) +* Fixed regression in `.groupby(..).rolling(..)` where a segfault would occur with `center=True` and an odd number of values ([GH 35552](https://github.com/pandas-dev/pandas/issues/35552)) +* Fixed regression in [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") where functions that altered the input in-place only operated on a single row ([GH 35462](https://github.com/pandas-dev/pandas/issues/35462)) +* Fixed regression in [`DataFrame.reset_index()`](../reference/api/pandas.DataFrame.reset_index.html#pandas.DataFrame.reset_index "pandas.DataFrame.reset_index") would raise a `ValueError` on empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") with a `datetime64` dtype level ([GH 35606](https://github.com/pandas-dev/pandas/issues/35606), [GH 35657](https://github.com/pandas-dev/pandas/issues/35657)) +* Fixed regression where [`pandas.merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") would raise a `UnboundLocalError` when `left_index`, `right_index` and `tolerance` were set ([GH 35558](https://github.com/pandas-dev/pandas/issues/35558)) +* Fixed regression in `.groupby(..).rolling(..)` where a custom `BaseIndexer` would be ignored ([GH 35557](https://github.com/pandas-dev/pandas/issues/35557)) +* Fixed regression in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") and [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") where compiled regular expressions would be ignored during replacement ([GH 35680](https://github.com/pandas-dev/pandas/issues/35680)) +* Fixed regression in [`DataFrameGroupBy.aggregate()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.aggregate.html#pandas.core.groupby.DataFrameGroupBy.aggregate "pandas.core.groupby.DataFrameGroupBy.aggregate") where a list of functions would produce the wrong results if at least one of the functions did not aggregate ([GH 35490](https://github.com/pandas-dev/pandas/issues/35490)) +* Fixed memory usage issue when instantiating large [`pandas.arrays.StringArray`](../reference/api/pandas.arrays.StringArray.html#pandas.arrays.StringArray "pandas.arrays.StringArray") ([GH 35499](https://github.com/pandas-dev/pandas/issues/35499)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in [`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") whereby `cell_ids` argument had no effect due to other recent changes ([GH 35588](https://github.com/pandas-dev/pandas/issues/35588)) ([GH 35663](https://github.com/pandas-dev/pandas/issues/35663)) +* Bug in [`pandas.testing.assert_series_equal()`](../reference/api/pandas.testing.assert_series_equal.html#pandas.testing.assert_series_equal "pandas.testing.assert_series_equal") and [`pandas.testing.assert_frame_equal()`](../reference/api/pandas.testing.assert_frame_equal.html#pandas.testing.assert_frame_equal "pandas.testing.assert_frame_equal") where extension dtypes were not ignored when `check_dtypes` was set to `False` ([GH 35715](https://github.com/pandas-dev/pandas/issues/35715)) +* Bug in [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta") fails when `arg` is a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `Int64` dtype containing null values ([GH 35574](https://github.com/pandas-dev/pandas/issues/35574)) +* Bug in `.groupby(..).rolling(..)` where passing `closed` with column selection would raise a `ValueError` ([GH 35549](https://github.com/pandas-dev/pandas/issues/35549)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor failing to raise `ValueError` in some cases when `data` and `index` have mismatched lengths ([GH 33437](https://github.com/pandas-dev/pandas/issues/33437)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 20 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Ali McMaster +* Daniel Saxton +* Eric Goddard + +* Fangchen Li +* Isaac Virshup +* Joris Van den Bossche +* Kevin Sheppard +* Matthew Roeschke +* MeeseeksMachine + +* Pandas Development Team +* Richard Shadrach +* Simon Hawkins +* Terji Petersen +* Tom Augspurger +* Yutaro Ikeda + +* attack68 + +* edwardkong + +* gabicca + +* jbrockmendel +* sanderland + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.1.2.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.1.2.md new file mode 100644 index 0000000000000000000000000000000000000000..91057dac2ad0c0daa5672394ff15e463ae600eee --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.1.2.md @@ -0,0 +1,64 @@ +# What's new in pandas 1.1.2 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.1.2.html + +# What’s new in 1.1.2 (September 8, 2020)[#](#what-s-new-in-1-1-2-september-8-2020 "Link to this heading") + +These are the changes in pandas 1.1.2. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Regression in `DatetimeIndex.intersection()` incorrectly raising `AssertionError` when intersecting against a list ([GH 35876](https://github.com/pandas-dev/pandas/issues/35876)) +* Fix regression in updating a column inplace (e.g. using `df['col'].fillna(.., inplace=True)`) ([GH 35731](https://github.com/pandas-dev/pandas/issues/35731)) +* Fix regression in `DataFrame.append()` mixing tz-aware and tz-naive datetime columns ([GH 35460](https://github.com/pandas-dev/pandas/issues/35460)) +* Performance regression for `RangeIndex.format()` ([GH 35712](https://github.com/pandas-dev/pandas/issues/35712)) +* Regression where [`MultiIndex.get_loc()`](../reference/api/pandas.MultiIndex.get_loc.html#pandas.MultiIndex.get_loc "pandas.MultiIndex.get_loc") would return a slice spanning the full index when passed an empty list ([GH 35878](https://github.com/pandas-dev/pandas/issues/35878)) +* Fix regression in invalid cache after an indexing operation; this can manifest when setting which does not update the data ([GH 35521](https://github.com/pandas-dev/pandas/issues/35521)) +* Regression in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") where a `TypeError` would be raised when attempting to replace elements of type [`Interval`](../reference/api/pandas.Interval.html#pandas.Interval "pandas.Interval") ([GH 35931](https://github.com/pandas-dev/pandas/issues/35931)) +* Fix regression in pickle roundtrip of the `closed` attribute of [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") ([GH 35658](https://github.com/pandas-dev/pandas/issues/35658)) +* Fixed regression in `DataFrameGroupBy.agg()` where a `ValueError: buffer source array is read-only` would be raised when the underlying array is read-only ([GH 36014](https://github.com/pandas-dev/pandas/issues/36014)) +* Fixed regression in `Series.groupby.rolling()` number of levels of [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") in input was compressed to one ([GH 36018](https://github.com/pandas-dev/pandas/issues/36018)) +* Fixed regression in `DataFrameGroupBy` on an empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 36197](https://github.com/pandas-dev/pandas/issues/36197)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in [`DataFrame.eval()`](../reference/api/pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval") with `object` dtype column binary operations ([GH 35794](https://github.com/pandas-dev/pandas/issues/35794)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructor raising a `TypeError` when constructing sparse datetime64 dtypes ([GH 35762](https://github.com/pandas-dev/pandas/issues/35762)) +* Bug in [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") with `result_type="reduce"` returning with incorrect index ([GH 35683](https://github.com/pandas-dev/pandas/issues/35683)) +* Bug in [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") and [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") not respecting the `errors` argument when set to `"ignore"` for extension dtypes ([GH 35471](https://github.com/pandas-dev/pandas/issues/35471)) +* Bug in `DateTimeIndex.format()` and `PeriodIndex.format()` with `name=True` setting the first item to `"None"` where it should be `""` ([GH 35712](https://github.com/pandas-dev/pandas/issues/35712)) +* Bug in `Float64Index.__contains__()` incorrectly raising `TypeError` instead of returning `False` ([GH 35788](https://github.com/pandas-dev/pandas/issues/35788)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructor incorrectly raising a `TypeError` when passed an ordered set ([GH 36044](https://github.com/pandas-dev/pandas/issues/36044)) +* Bug in [`Series.dt.isocalendar()`](../reference/api/pandas.Series.dt.isocalendar.html#pandas.Series.dt.isocalendar "pandas.Series.dt.isocalendar") and `DatetimeIndex.isocalendar()` that returned incorrect year for certain dates ([GH 36032](https://github.com/pandas-dev/pandas/issues/36032)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") indexing returning an incorrect [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") in some cases when the series has been altered and a cache not invalidated ([GH 33675](https://github.com/pandas-dev/pandas/issues/33675)) +* Bug in [`DataFrame.corr()`](../reference/api/pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr") causing subsequent indexing lookups to be incorrect ([GH 35882](https://github.com/pandas-dev/pandas/issues/35882)) +* Bug in `import_optional_dependency()` returning incorrect package names in cases where package name is different from import name ([GH 35948](https://github.com/pandas-dev/pandas/issues/35948)) +* Bug when setting empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") column to a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") in preserving name of index in frame ([GH 31368](https://github.com/pandas-dev/pandas/issues/31368)) + +## Other[#](#other "Link to this heading") + +* [`factorize()`](../reference/api/pandas.factorize.html#pandas.factorize "pandas.factorize") now supports `na_sentinel=None` to include NaN in the uniques of the values and remove `dropna` keyword which was unintentionally exposed to public facing API in 1.1 version from [`factorize()`](../reference/api/pandas.factorize.html#pandas.factorize "pandas.factorize") ([GH 35667](https://github.com/pandas-dev/pandas/issues/35667)) +* [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") and [`Series.plot()`](../reference/api/pandas.Series.plot.html#pandas.Series.plot "pandas.Series.plot") raise `UserWarning` about usage of `FixedFormatter` and `FixedLocator` ([GH 35684](https://github.com/pandas-dev/pandas/issues/35684) and [GH 35945](https://github.com/pandas-dev/pandas/issues/35945)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 16 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Ali McMaster +* Asish Mahapatra +* Daniel Saxton +* Fangchen Li +* Harsh Sharma + +* Irv Lustig +* Jeet Parekh + +* Joris Van den Bossche +* Kaiqi Dong +* Matthew Roeschke +* MeeseeksMachine +* Pandas Development Team +* Simon Hawkins +* Terji Petersen +* jbrockmendel +* patrick diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.1.3.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.1.3.md new file mode 100644 index 0000000000000000000000000000000000000000..55ccc296e061a39b36943981176ce1a627b1cbfb --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.1.3.md @@ -0,0 +1,73 @@ +# What's new in pandas 1.1.3 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.1.3.html + +# What’s new in 1.1.3 (October 5, 2020)[#](#what-s-new-in-1-1-3-october-5-2020 "Link to this heading") + +These are the changes in pandas 1.1.3. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Enhancements[#](#enhancements "Link to this heading") + +### Added support for new Python version[#](#added-support-for-new-python-version "Link to this heading") + +pandas 1.1.3 now supports Python 3.9 ([GH 36296](https://github.com/pandas-dev/pandas/issues/36296)). + +### Development Changes[#](#development-changes "Link to this heading") + +* The minimum version of Cython is now the most recent bug-fix version (0.29.21) ([GH 36296](https://github.com/pandas-dev/pandas/issues/36296)). + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in [`DataFrame.agg()`](../reference/api/pandas.DataFrame.agg.html#pandas.DataFrame.agg "pandas.DataFrame.agg"), [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply"), [`Series.agg()`](../reference/api/pandas.Series.agg.html#pandas.Series.agg "pandas.Series.agg"), and [`Series.apply()`](../reference/api/pandas.Series.apply.html#pandas.Series.apply "pandas.Series.apply") where internal suffix is exposed to the users when no relabelling is applied ([GH 36189](https://github.com/pandas-dev/pandas/issues/36189)) +* Fixed regression in `IntegerArray` unary plus and minus operations raising a `TypeError` ([GH 36063](https://github.com/pandas-dev/pandas/issues/36063)) +* Fixed regression when adding a [`timedelta_range()`](../reference/api/pandas.timedelta_range.html#pandas.timedelta_range "pandas.timedelta_range") to a [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") raised a `ValueError` ([GH 35897](https://github.com/pandas-dev/pandas/issues/35897)) +* Fixed regression in `Series.__getitem__()` incorrectly raising when the input was a tuple ([GH 35534](https://github.com/pandas-dev/pandas/issues/35534)) +* Fixed regression in `Series.__getitem__()` incorrectly raising when the input was a frozenset ([GH 35747](https://github.com/pandas-dev/pandas/issues/35747)) +* Fixed regression in modulo of [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") using `numexpr` using C not Python semantics ([GH 36047](https://github.com/pandas-dev/pandas/issues/36047), [GH 36526](https://github.com/pandas-dev/pandas/issues/36526)) +* Fixed regression in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") with `engine="odf"` caused `UnboundLocalError` in some cases where cells had nested child nodes ([GH 36122](https://github.com/pandas-dev/pandas/issues/36122), [GH 35802](https://github.com/pandas-dev/pandas/issues/35802)) +* Fixed regression in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") inconsistent replace when using a float in the replace method ([GH 35376](https://github.com/pandas-dev/pandas/issues/35376)) +* Fixed regression in [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") on a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") containing [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") raising `InvalidIndexError` ([GH 35858](https://github.com/pandas-dev/pandas/issues/35858)) +* Fixed regression in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") comparisons between numeric arrays and strings ([GH 35700](https://github.com/pandas-dev/pandas/issues/35700), [GH 36377](https://github.com/pandas-dev/pandas/issues/36377)) +* Fixed regression in [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") with `raw=True` and user-function returning string ([GH 35940](https://github.com/pandas-dev/pandas/issues/35940)) +* Fixed regression when setting empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") column to a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") in preserving name of index in frame ([GH 36527](https://github.com/pandas-dev/pandas/issues/36527)) +* Fixed regression in [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") incorrect value for ordinal over the maximum timestamp ([GH 36430](https://github.com/pandas-dev/pandas/issues/36430)) +* Fixed regression in [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") raised `ValueError` when `delim_whitespace` was set to `True` ([GH 35958](https://github.com/pandas-dev/pandas/issues/35958)) +* Fixed regression in [`Series.dt.normalize()`](../reference/api/pandas.Series.dt.normalize.html#pandas.Series.dt.normalize "pandas.Series.dt.normalize") when normalizing pre-epoch dates the result was shifted one day ([GH 36294](https://github.com/pandas-dev/pandas/issues/36294)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in [`read_spss()`](../reference/api/pandas.read_spss.html#pandas.read_spss "pandas.read_spss") where passing a `pathlib.Path` as `path` would raise a `TypeError` ([GH 33666](https://github.com/pandas-dev/pandas/issues/33666)) +* Bug in [`Series.str.startswith()`](../reference/api/pandas.Series.str.startswith.html#pandas.Series.str.startswith "pandas.Series.str.startswith") and [`Series.str.endswith()`](../reference/api/pandas.Series.str.endswith.html#pandas.Series.str.endswith "pandas.Series.str.endswith") with `category` dtype not propagating `na` parameter ([GH 36241](https://github.com/pandas-dev/pandas/issues/36241)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructor where integer overflow would occur for sufficiently large scalar inputs when an index was provided ([GH 36291](https://github.com/pandas-dev/pandas/issues/36291)) +* Bug in [`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values") raising an `AttributeError` when sorting on a key that casts column to categorical dtype ([GH 36383](https://github.com/pandas-dev/pandas/issues/36383)) +* Bug in [`DataFrame.stack()`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack") raising a `ValueError` when stacking [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") columns based on position when the levels had duplicate names ([GH 36353](https://github.com/pandas-dev/pandas/issues/36353)) +* Bug in [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") showing too much precision when casting from `np.float32` to string dtype ([GH 36451](https://github.com/pandas-dev/pandas/issues/36451)) +* Bug in [`Series.isin()`](../reference/api/pandas.Series.isin.html#pandas.Series.isin "pandas.Series.isin") and [`DataFrame.isin()`](../reference/api/pandas.DataFrame.isin.html#pandas.DataFrame.isin "pandas.DataFrame.isin") when using `NaN` and a row length above 1,000,000 ([GH 22205](https://github.com/pandas-dev/pandas/issues/22205)) +* Bug in [`cut()`](../reference/api/pandas.cut.html#pandas.cut "pandas.cut") raising a `ValueError` when passed a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") of labels with `ordered=False` ([GH 36603](https://github.com/pandas-dev/pandas/issues/36603)) + +## Other[#](#other "Link to this heading") + +* Reverted enhancement added in pandas-1.1.0 where [`timedelta_range()`](../reference/api/pandas.timedelta_range.html#pandas.timedelta_range "pandas.timedelta_range") infers a frequency when passed `start`, `stop`, and `periods` ([GH 32377](https://github.com/pandas-dev/pandas/issues/32377)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 16 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Asish Mahapatra +* Dan Moore + +* Daniel Saxton +* Fangchen Li +* Hans +* Irv Lustig +* Joris Van den Bossche +* Kaiqi Dong +* MeeseeksMachine +* Number42 + +* Pandas Development Team +* Richard Shadrach +* Simon Hawkins +* jbrockmendel +* nrebena +* patrick diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.1.4.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.1.4.md new file mode 100644 index 0000000000000000000000000000000000000000..958e6b93f2294da71d293e8d1ada5b62b5b7b7b4 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.1.4.md @@ -0,0 +1,61 @@ +# What's new in pandas 1.1.4 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.1.4.html + +# What’s new in 1.1.4 (October 30, 2020)[#](#what-s-new-in-1-1-4-october-30-2020 "Link to this heading") + +These are the changes in pandas 1.1.4. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") raising a `ValueError` when `names` was of type `dict_keys` ([GH 36928](https://github.com/pandas-dev/pandas/issues/36928)) +* Fixed regression in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") with more than 1M rows and specifying a `index_col` argument ([GH 37094](https://github.com/pandas-dev/pandas/issues/37094)) +* Fixed regression where attempting to mutate a `DateOffset` object would no longer raise an `AttributeError` ([GH 36940](https://github.com/pandas-dev/pandas/issues/36940)) +* Fixed regression where [`DataFrame.agg()`](../reference/api/pandas.DataFrame.agg.html#pandas.DataFrame.agg "pandas.DataFrame.agg") would fail with [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.13)") when passed positional arguments to be passed on to the aggregation function ([GH 36948](https://github.com/pandas-dev/pandas/issues/36948)). +* Fixed regression in `RollingGroupby` with `sort=False` not being respected ([GH 36889](https://github.com/pandas-dev/pandas/issues/36889)) +* Fixed regression in [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") converting `None` to `"nan"` when casting to string ([GH 36904](https://github.com/pandas-dev/pandas/issues/36904)) +* Fixed regression in [`Series.rank()`](../reference/api/pandas.Series.rank.html#pandas.Series.rank "pandas.Series.rank") method failing for read-only data ([GH 37290](https://github.com/pandas-dev/pandas/issues/37290)) +* Fixed regression in `RollingGroupby` causing a segmentation fault with Index of dtype object ([GH 36727](https://github.com/pandas-dev/pandas/issues/36727)) +* Fixed regression in `DataFrame.resample(...).apply(...)()` raised `AttributeError` when input was a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and only a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") was evaluated ([GH 36951](https://github.com/pandas-dev/pandas/issues/36951)) +* Fixed regression in `DataFrame.groupby(..).std()` with nullable integer dtype ([GH 37415](https://github.com/pandas-dev/pandas/issues/37415)) +* Fixed regression in [`PeriodDtype`](../reference/api/pandas.PeriodDtype.html#pandas.PeriodDtype "pandas.PeriodDtype") comparing both equal and unequal to its string representation ([GH 37265](https://github.com/pandas-dev/pandas/issues/37265)) +* Fixed regression where slicing [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") raised [`AssertionError`](https://docs.python.org/3/library/exceptions.html#AssertionError "(in Python v3.13)") on irregular time series with `pd.NaT` or on unsorted indices ([GH 36953](https://github.com/pandas-dev/pandas/issues/36953) and [GH 35509](https://github.com/pandas-dev/pandas/issues/35509)) +* Fixed regression in certain offsets ([`pd.offsets.Day()`](../reference/api/pandas.tseries.offsets.Day.html#pandas.tseries.offsets.Day "pandas.tseries.offsets.Day") and below) no longer being hashable ([GH 37267](https://github.com/pandas-dev/pandas/issues/37267)) +* Fixed regression in `StataReader` which required `chunksize` to be manually set when using an iterator to read a dataset ([GH 37280](https://github.com/pandas-dev/pandas/issues/37280)) +* Fixed regression in setitem with [`DataFrame.iloc()`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") which raised error when trying to set a value while filtering with a boolean list ([GH 36741](https://github.com/pandas-dev/pandas/issues/36741)) +* Fixed regression in setitem with a Series getting aligned before setting the values ([GH 37427](https://github.com/pandas-dev/pandas/issues/37427)) +* Fixed regression in `MultiIndex.is_monotonic_increasing` returning wrong results with `NaN` in at least one of the levels ([GH 37220](https://github.com/pandas-dev/pandas/issues/37220)) +* Fixed regression in inplace arithmetic operation (+=) on a Series not updating the parent DataFrame/Series ([GH 36373](https://github.com/pandas-dev/pandas/issues/36373)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug causing `groupby(...).sum()` and similar to not preserve metadata ([GH 29442](https://github.com/pandas-dev/pandas/issues/29442)) +* Bug in [`Series.isin()`](../reference/api/pandas.Series.isin.html#pandas.Series.isin "pandas.Series.isin") and [`DataFrame.isin()`](../reference/api/pandas.DataFrame.isin.html#pandas.DataFrame.isin "pandas.DataFrame.isin") raising a `ValueError` when the target was read-only ([GH 37174](https://github.com/pandas-dev/pandas/issues/37174)) +* Bug in [`DataFrameGroupBy.fillna()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.fillna.html#pandas.core.groupby.DataFrameGroupBy.fillna "pandas.core.groupby.DataFrameGroupBy.fillna") and [`SeriesGroupBy.fillna()`](../reference/api/pandas.core.groupby.SeriesGroupBy.fillna.html#pandas.core.groupby.SeriesGroupBy.fillna "pandas.core.groupby.SeriesGroupBy.fillna") that introduced a performance regression after 1.0.5 ([GH 36757](https://github.com/pandas-dev/pandas/issues/36757)) +* Bug in [`DataFrame.info()`](../reference/api/pandas.DataFrame.info.html#pandas.DataFrame.info "pandas.DataFrame.info") was raising a `KeyError` when the DataFrame has integer column names ([GH 37245](https://github.com/pandas-dev/pandas/issues/37245)) +* Bug in `DataFrameGroupby.apply()` would drop a [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") when grouped on ([GH 35792](https://github.com/pandas-dev/pandas/issues/35792)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 18 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Daniel Saxton +* Fangchen Li +* Janus + +* Joris Van den Bossche +* Kevin Sheppard +* Marco Gorelli +* Matt Roeschke +* Matthew Roeschke +* MeeseeksMachine +* Pandas Development Team +* Paul Ganssle +* Richard Shadrach +* Simon Hawkins +* Thomas Smith +* Tobias Pitters +* abmyii + +* jbrockmendel +* patrick diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.1.5.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.1.5.md new file mode 100644 index 0000000000000000000000000000000000000000..1bac93013d8338b9d616b6390762c38adc25d6ca --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.1.5.md @@ -0,0 +1,52 @@ +# What's new in pandas 1.1.5 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.1.5.html + +# What’s new in 1.1.5 (December 07, 2020)[#](#what-s-new-in-1-1-5-december-07-2020 "Link to this heading") + +These are the changes in pandas 1.1.5. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in addition of a timedelta-like scalar to a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") raising incorrectly ([GH 37295](https://github.com/pandas-dev/pandas/issues/37295)) +* Fixed regression in [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") raising when the [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") of the [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") had a tuple as its name ([GH 37755](https://github.com/pandas-dev/pandas/issues/37755)) +* Fixed regression in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") and [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") for `__setitem__` when one-dimensional tuple was given to select from [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 37711](https://github.com/pandas-dev/pandas/issues/37711)) +* Fixed regression in inplace operations on [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `ExtensionDtype` with NumPy dtyped operand ([GH 37910](https://github.com/pandas-dev/pandas/issues/37910)) +* Fixed regression in metadata propagation for `groupby` iterator ([GH 37343](https://github.com/pandas-dev/pandas/issues/37343)) +* Fixed regression in [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") constructed from a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") not retaining frequency ([GH 35563](https://github.com/pandas-dev/pandas/issues/35563)) +* Fixed regression in [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") constructor raising a `AttributeError` when passed a `SparseArray` with datetime64 values ([GH 35843](https://github.com/pandas-dev/pandas/issues/35843)) +* Fixed regression in [`DataFrame.unstack()`](../reference/api/pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack") with columns with integer dtype ([GH 37115](https://github.com/pandas-dev/pandas/issues/37115)) +* Fixed regression in indexing on a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `CategoricalDtype` after unpickling ([GH 37631](https://github.com/pandas-dev/pandas/issues/37631)) +* Fixed regression in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") aggregation with out-of-bounds datetime objects in an object-dtype column ([GH 36003](https://github.com/pandas-dev/pandas/issues/36003)) +* Fixed regression in `df.groupby(..).rolling(..)` with the resulting [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") when grouping by a label that is in the index ([GH 37641](https://github.com/pandas-dev/pandas/issues/37641)) +* Fixed regression in [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") not filling `NaN` after other operations such as [`DataFrame.pivot()`](../reference/api/pandas.DataFrame.pivot.html#pandas.DataFrame.pivot "pandas.DataFrame.pivot") ([GH 36495](https://github.com/pandas-dev/pandas/issues/36495)). +* Fixed performance regression in `df.groupby(..).rolling(..)` ([GH 38038](https://github.com/pandas-dev/pandas/issues/38038)) +* Fixed regression in `MultiIndex.intersection()` returning duplicates when at least one of the indexes had duplicates ([GH 36915](https://github.com/pandas-dev/pandas/issues/36915)) +* Fixed regression in [`DataFrameGroupBy.first()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.first.html#pandas.core.groupby.DataFrameGroupBy.first "pandas.core.groupby.DataFrameGroupBy.first"), [`SeriesGroupBy.first()`](../reference/api/pandas.core.groupby.SeriesGroupBy.first.html#pandas.core.groupby.SeriesGroupBy.first "pandas.core.groupby.SeriesGroupBy.first"), [`DataFrameGroupBy.last()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.last.html#pandas.core.groupby.DataFrameGroupBy.last "pandas.core.groupby.DataFrameGroupBy.last"), and [`SeriesGroupBy.last()`](../reference/api/pandas.core.groupby.SeriesGroupBy.last.html#pandas.core.groupby.SeriesGroupBy.last "pandas.core.groupby.SeriesGroupBy.last") where `None` was considered a non-NA value ([GH 38286](https://github.com/pandas-dev/pandas/issues/38286)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in pytables methods in python 3.9 ([GH 38041](https://github.com/pandas-dev/pandas/issues/38041)) + +## Other[#](#other "Link to this heading") + +* Only set `-Werror` as a compiler flag in the CI jobs ([GH 33315](https://github.com/pandas-dev/pandas/issues/33315), [GH 33314](https://github.com/pandas-dev/pandas/issues/33314)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 12 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Andrew Wieteska +* Fangchen Li +* Janus +* Joris Van den Bossche +* Matthew Roeschke +* MeeseeksMachine +* Pandas Development Team +* Richard Shadrach +* Simon Hawkins +* Uwe L. Korn +* jbrockmendel +* patrick diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.2.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.2.0.md new file mode 100644 index 0000000000000000000000000000000000000000..48e6a6a0425f47fba9e0000821517d36b9e92c9b --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.2.0.md @@ -0,0 +1,1117 @@ +# What's new in pandas 1.2.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.2.0.html + +# What’s new in 1.2.0 (December 26, 2020)[#](#what-s-new-in-1-2-0-december-26-2020 "Link to this heading") + +These are the changes in pandas 1.2.0. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +Warning + +The [xlwt](https://xlwt.readthedocs.io/en/latest/) package for writing old-style `.xls` +excel files is no longer maintained. +The [xlrd](https://xlrd.readthedocs.io/en/latest/) package is now only for reading +old-style `.xls` files. + +Previously, the default argument `engine=None` to [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") +would result in using the `xlrd` engine in many cases, including new +Excel 2007+ (`.xlsx`) files. +If [openpyxl](https://openpyxl.readthedocs.io/en/stable/) is installed, +many of these cases will now default to using the `openpyxl` engine. +See the [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") documentation for more details. + +Thus, it is strongly encouraged to install `openpyxl` to read Excel 2007+ +(`.xlsx`) files. +**Please do not report issues when using ``xlrd`` to read ``.xlsx`` files.** +This is no longer supported, switch to using `openpyxl` instead. + +Attempting to use the `xlwt` engine will raise a `FutureWarning` +unless the option `io.excel.xls.writer` is set to `"xlwt"`. +While this option is now deprecated and will also raise a `FutureWarning`, +it can be globally set and the warning suppressed. Users are recommended to +write `.xlsx` files using the `openpyxl` engine instead. + +## Enhancements[#](#enhancements "Link to this heading") + +### Optionally disallow duplicate labels[#](#optionally-disallow-duplicate-labels "Link to this heading") + +[`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") can now be created with `allows_duplicate_labels=False` flag to +control whether the index or columns can contain duplicate labels ([GH 28394](https://github.com/pandas-dev/pandas/issues/28394)). This can be used to +prevent accidental introduction of duplicate labels, which can affect downstream operations. + +By default, duplicates continue to be allowed. + +```None +In [1]: pd.Series([1, 2], index=['a', 'a']) +Out[1]: +a 1 +a 2 +Length: 2, dtype: int64 + +In [2]: pd.Series([1, 2], index=['a', 'a']).set_flags(allows_duplicate_labels=False) +... +DuplicateLabelError: Index has duplicates. + positions +label +a [0, 1] +``` + +pandas will propagate the `allows_duplicate_labels` property through many operations. + +```None +In [3]: a = ( + ...: pd.Series([1, 2], index=['a', 'b']) + ...: .set_flags(allows_duplicate_labels=False) + ...: ) + +In [4]: a +Out[4]: +a 1 +b 2 +Length: 2, dtype: int64 + +# An operation introducing duplicates +In [5]: a.reindex(['a', 'b', 'a']) +... +DuplicateLabelError: Index has duplicates. + positions +label +a [0, 2] + +[1 rows x 1 columns] +``` + +Warning + +This is an experimental feature. Currently, many methods fail to +propagate the `allows_duplicate_labels` value. In future versions +it is expected that every method taking or returning one or more +DataFrame or Series objects will propagate `allows_duplicate_labels`. + +See [Duplicate Labels](../user_guide/duplicates.html#duplicates) for more. + +The `allows_duplicate_labels` flag is stored in the new `DataFrame.flags` +attribute. This stores global attributes that apply to the *pandas object*. This +differs from [`DataFrame.attrs`](../reference/api/pandas.DataFrame.attrs.html#pandas.DataFrame.attrs "pandas.DataFrame.attrs"), which stores information that applies to +the dataset. + +### Passing arguments to fsspec backends[#](#passing-arguments-to-fsspec-backends "Link to this heading") + +Many read/write functions have acquired the `storage_options` optional argument, +to pass a dictionary of parameters to the storage backend. This allows, for +example, for passing credentials to S3 and GCS storage. The details of what +parameters can be passed to which backends can be found in the documentation +of the individual storage backends (detailed from the fsspec docs for +[builtin implementations](https://filesystem-spec.readthedocs.io/en/latest/api.html#built-in-implementations) and linked to [external ones](https://filesystem-spec.readthedocs.io/en/latest/api.html#other-known-implementations)). See +Section [Reading/writing remote files](../user_guide/io.html#io-remote). + +[GH 35655](https://github.com/pandas-dev/pandas/issues/35655) added fsspec support (including `storage_options`) +for reading excel files. + +### Support for binary file handles in `to_csv`[#](#support-for-binary-file-handles-in-to-csv "Link to this heading") + +`to_csv()` supports file handles in binary mode ([GH 19827](https://github.com/pandas-dev/pandas/issues/19827) and [GH 35058](https://github.com/pandas-dev/pandas/issues/35058)) +with `encoding` ([GH 13068](https://github.com/pandas-dev/pandas/issues/13068) and [GH 23854](https://github.com/pandas-dev/pandas/issues/23854)) and `compression` ([GH 22555](https://github.com/pandas-dev/pandas/issues/22555)). +If pandas does not automatically detect whether the file handle is opened in binary or text mode, +it is necessary to provide `mode="wb"`. + +For example: + +```None +In [1]: import io + +In [2]: data = pd.DataFrame([0, 1, 2]) + +In [3]: buffer = io.BytesIO() + +In [4]: data.to_csv(buffer, encoding="utf-8", compression="gzip") +``` + +### Support for short caption and table position in `to_latex`[#](#support-for-short-caption-and-table-position-in-to-latex "Link to this heading") + +[`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex") now allows one to specify +a floating table position ([GH 35281](https://github.com/pandas-dev/pandas/issues/35281)) +and a short caption ([GH 36267](https://github.com/pandas-dev/pandas/issues/36267)). + +The keyword `position` has been added to set the position. + +```None +In [5]: data = pd.DataFrame({'a': [1, 2], 'b': [3, 4]}) + +In [6]: table = data.to_latex(position='ht') + +In [7]: print(table) +\begin{table}[ht] +\begin{tabular}{lrr} +\toprule + & a & b \\ +\midrule +0 & 1 & 3 \\ +1 & 2 & 4 \\ +\bottomrule +\end{tabular} +\end{table} +``` + +Usage of the keyword `caption` has been extended. +Besides taking a single string as an argument, +one can optionally provide a tuple `(full_caption, short_caption)` +to add a short caption macro. + +```None +In [8]: data = pd.DataFrame({'a': [1, 2], 'b': [3, 4]}) + +In [9]: table = data.to_latex(caption=('the full long caption', 'short caption')) + +In [10]: print(table) +\begin{table} +\caption[short caption]{the full long caption} +\begin{tabular}{lrr} +\toprule + & a & b \\ +\midrule +0 & 1 & 3 \\ +1 & 2 & 4 \\ +\bottomrule +\end{tabular} +\end{table} +``` + +### Change in default floating precision for `read_csv` and `read_table`[#](#change-in-default-floating-precision-for-read-csv-and-read-table "Link to this heading") + +For the C parsing engine, the methods [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") and [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") previously defaulted to a parser that +could read floating point numbers slightly incorrectly with respect to the last bit in precision. +The option `floating_precision="high"` has always been available to avoid this issue. +Beginning with this version, the default is now to use the more accurate parser by making +`floating_precision=None` correspond to the high precision parser, and the new option +`floating_precision="legacy"` to use the legacy parser. The change to using the higher precision +parser by default should have no impact on performance. ([GH 17154](https://github.com/pandas-dev/pandas/issues/17154)) + +### Experimental nullable data types for float data[#](#experimental-nullable-data-types-for-float-data "Link to this heading") + +We’ve added [`Float32Dtype`](../reference/api/pandas.Float32Dtype.html#pandas.Float32Dtype "pandas.Float32Dtype") / [`Float64Dtype`](../reference/api/pandas.Float64Dtype.html#pandas.Float64Dtype "pandas.Float64Dtype") and [`FloatingArray`](../reference/api/pandas.arrays.FloatingArray.html#pandas.arrays.FloatingArray "pandas.arrays.FloatingArray"). +These are extension data types dedicated to floating point data that can hold the +`pd.NA` missing value indicator ([GH 32265](https://github.com/pandas-dev/pandas/issues/32265), [GH 34307](https://github.com/pandas-dev/pandas/issues/34307)). + +While the default float data type already supports missing values using `np.nan`, +these new data types use `pd.NA` (and its corresponding behavior) as the missing +value indicator, in line with the already existing nullable [integer](../user_guide/integer_na.html#integer-na) +and [boolean](../user_guide/boolean.html#boolean) data types. + +One example where the behavior of `np.nan` and `pd.NA` is different is +comparison operations: + +```None +# the default NumPy float64 dtype +In [11]: s1 = pd.Series([1.5, None]) + +In [12]: s1 +Out[12]: +0 1.5 +1 NaN +Length: 2, dtype: float64 + +In [13]: s1 > 1 +Out[13]: +0 True +1 False +Length: 2, dtype: bool +``` + +```None +# the new nullable float64 dtype +In [14]: s2 = pd.Series([1.5, None], dtype="Float64") + +In [15]: s2 +Out[15]: +0 1.5 +1 +Length: 2, dtype: Float64 + +In [16]: s2 > 1 +Out[16]: +0 True +1 +Length: 2, dtype: boolean +``` + +See the [NA semantics](../user_guide/missing_data.html#missing-data-na) doc section for more details on the behavior +when using the `pd.NA` missing value indicator. + +As shown above, the dtype can be specified using the “Float64” or “Float32” +string (capitalized to distinguish it from the default “float64” data type). +Alternatively, you can also use the dtype object: + +```None +In [17]: pd.Series([1.5, None], dtype=pd.Float32Dtype()) +Out[17]: +0 1.5 +1 +Length: 2, dtype: Float32 +``` + +Operations with the existing integer or boolean nullable data types that +give float results will now also use the nullable floating data types ([GH 38178](https://github.com/pandas-dev/pandas/issues/38178)). + +Warning + +Experimental: the new floating data types are currently experimental, and their +behavior or API may still change without warning. Especially the behavior +regarding NaN (distinct from NA missing values) is subject to change. + +### Index/column name preservation when aggregating[#](#index-column-name-preservation-when-aggregating "Link to this heading") + +When aggregating using [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") or the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor, pandas +will now attempt to preserve index and column names whenever possible ([GH 35847](https://github.com/pandas-dev/pandas/issues/35847)). +In the case where all inputs share a common name, this name will be assigned to the +result. When the input names do not all agree, the result will be unnamed. Here is an +example where the index name is preserved: + +```None +In [18]: idx = pd.Index(range(5), name='abc') + +In [19]: ser = pd.Series(range(5, 10), index=idx) + +In [20]: pd.concat({'x': ser[1:], 'y': ser[:-1]}, axis=1) +Out[20]: + x y +abc +1 6.0 6.0 +2 7.0 7.0 +3 8.0 8.0 +4 9.0 NaN +0 NaN 5.0 + +[5 rows x 2 columns] +``` + +The same is true for [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex"), but the logic is applied separately on a +level-by-level basis. + +### GroupBy supports EWM operations directly[#](#groupby-supports-ewm-operations-directly "Link to this heading") + +`DataFrameGroupBy` now supports exponentially weighted window operations directly ([GH 16037](https://github.com/pandas-dev/pandas/issues/16037)). + +```None +In [21]: df = pd.DataFrame({'A': ['a', 'b', 'a', 'b'], 'B': range(4)}) + +In [22]: df +Out[22]: + A B +0 a 0 +1 b 1 +2 a 2 +3 b 3 + +[4 rows x 2 columns] + +In [23]: df.groupby('A').ewm(com=1.0).mean() +Out[23]: + B +A +a 0 0.000000 + 2 1.333333 +b 1 1.000000 + 3 2.333333 + +[4 rows x 1 columns] +``` + +Additionally `mean` supports execution via [Numba](https://numba.pydata.org/) with +the `engine` and `engine_kwargs` arguments. Numba must be installed as an optional dependency +to use this feature. + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* Added `day_of_week` (compatibility alias `dayofweek`) property to [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp"), [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex"), [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period"), [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") ([GH 9605](https://github.com/pandas-dev/pandas/issues/9605)) +* Added `day_of_year` (compatibility alias `dayofyear`) property to [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp"), [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex"), [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period"), [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") ([GH 9605](https://github.com/pandas-dev/pandas/issues/9605)) +* Added [`set_flags()`](../reference/api/pandas.DataFrame.set_flags.html#pandas.DataFrame.set_flags "pandas.DataFrame.set_flags") for setting table-wide flags on a Series or DataFrame ([GH 28394](https://github.com/pandas-dev/pandas/issues/28394)) +* [`DataFrame.applymap()`](../reference/api/pandas.DataFrame.applymap.html#pandas.DataFrame.applymap "pandas.DataFrame.applymap") now supports `na_action` ([GH 23803](https://github.com/pandas-dev/pandas/issues/23803)) +* [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with object dtype supports division and multiplication ([GH 34160](https://github.com/pandas-dev/pandas/issues/34160)) +* `io.sql.get_schema()` now supports a `schema` keyword argument that will add a schema into the create table statement ([GH 28486](https://github.com/pandas-dev/pandas/issues/28486)) +* [`DataFrame.explode()`](../reference/api/pandas.DataFrame.explode.html#pandas.DataFrame.explode "pandas.DataFrame.explode") and [`Series.explode()`](../reference/api/pandas.Series.explode.html#pandas.Series.explode "pandas.Series.explode") now support exploding of sets ([GH 35614](https://github.com/pandas-dev/pandas/issues/35614)) +* [`DataFrame.hist()`](../reference/api/pandas.DataFrame.hist.html#pandas.DataFrame.hist "pandas.DataFrame.hist") now supports time series (datetime) data ([GH 32590](https://github.com/pandas-dev/pandas/issues/32590)) +* [`Styler.set_table_styles()`](../reference/api/pandas.io.formats.style.Styler.set_table_styles.html#pandas.io.formats.style.Styler.set_table_styles "pandas.io.formats.style.Styler.set_table_styles") now allows the direct styling of rows and columns and can be chained ([GH 35607](https://github.com/pandas-dev/pandas/issues/35607)) +* [`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") now allows direct CSS class name addition to individual data cells ([GH 36159](https://github.com/pandas-dev/pandas/issues/36159)) +* [`Rolling.mean()`](../reference/api/pandas.core.window.rolling.Rolling.mean.html#pandas.core.window.rolling.Rolling.mean "pandas.core.window.rolling.Rolling.mean") and [`Rolling.sum()`](../reference/api/pandas.core.window.rolling.Rolling.sum.html#pandas.core.window.rolling.Rolling.sum "pandas.core.window.rolling.Rolling.sum") use Kahan summation to calculate the mean to avoid numerical problems ([GH 10319](https://github.com/pandas-dev/pandas/issues/10319), [GH 11645](https://github.com/pandas-dev/pandas/issues/11645), [GH 13254](https://github.com/pandas-dev/pandas/issues/13254), [GH 32761](https://github.com/pandas-dev/pandas/issues/32761), [GH 36031](https://github.com/pandas-dev/pandas/issues/36031)) +* `DatetimeIndex.searchsorted()`, `TimedeltaIndex.searchsorted()`, `PeriodIndex.searchsorted()`, and [`Series.searchsorted()`](../reference/api/pandas.Series.searchsorted.html#pandas.Series.searchsorted "pandas.Series.searchsorted") with datetime-like dtypes will now try to cast string arguments (list-like and scalar) to the matching datetime-like type ([GH 36346](https://github.com/pandas-dev/pandas/issues/36346)) +* Added methods `IntegerArray.prod()`, `IntegerArray.min()`, and `IntegerArray.max()` ([GH 33790](https://github.com/pandas-dev/pandas/issues/33790)) +* Calling a NumPy ufunc on a `DataFrame` with extension types now preserves the extension types when possible ([GH 23743](https://github.com/pandas-dev/pandas/issues/23743)) +* Calling a binary-input NumPy ufunc on multiple `DataFrame` objects now aligns, matching the behavior of binary operations and ufuncs on `Series` ([GH 23743](https://github.com/pandas-dev/pandas/issues/23743)). + This change has been reverted in pandas 1.2.1, and the behaviour to not align DataFrames + is deprecated instead, see the [the 1.2.1 release notes](v1.2.1.html#whatsnew-121-ufunc-deprecation). +* Where possible `RangeIndex.difference()` and `RangeIndex.symmetric_difference()` will return [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") instead of `Int64Index` ([GH 36564](https://github.com/pandas-dev/pandas/issues/36564)) +* [`DataFrame.to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") now supports [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") for columns in parquet format ([GH 34777](https://github.com/pandas-dev/pandas/issues/34777)) +* [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") gained a `use_nullable_dtypes=True` option to use nullable dtypes that use `pd.NA` as missing value indicator where possible for the resulting DataFrame (default is `False`, and only applicable for `engine="pyarrow"`) ([GH 31242](https://github.com/pandas-dev/pandas/issues/31242)) +* Added [`Rolling.sem()`](../reference/api/pandas.core.window.rolling.Rolling.sem.html#pandas.core.window.rolling.Rolling.sem "pandas.core.window.rolling.Rolling.sem") and `Expanding.sem()` to compute the standard error of the mean ([GH 26476](https://github.com/pandas-dev/pandas/issues/26476)) +* [`Rolling.var()`](../reference/api/pandas.core.window.rolling.Rolling.var.html#pandas.core.window.rolling.Rolling.var "pandas.core.window.rolling.Rolling.var") and [`Rolling.std()`](../reference/api/pandas.core.window.rolling.Rolling.std.html#pandas.core.window.rolling.Rolling.std "pandas.core.window.rolling.Rolling.std") use Kahan summation and Welford’s Method to avoid numerical issues ([GH 37051](https://github.com/pandas-dev/pandas/issues/37051)) +* [`DataFrame.corr()`](../reference/api/pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr") and [`DataFrame.cov()`](../reference/api/pandas.DataFrame.cov.html#pandas.DataFrame.cov "pandas.DataFrame.cov") use Welford’s Method to avoid numerical issues ([GH 37448](https://github.com/pandas-dev/pandas/issues/37448)) +* [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") now recognizes `xlabel` and `ylabel` arguments for plots of type `scatter` and `hexbin` ([GH 37001](https://github.com/pandas-dev/pandas/issues/37001)) +* [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") now supports the `divmod` operation ([GH 37165](https://github.com/pandas-dev/pandas/issues/37165)) +* [`DataFrame.to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") now returns a `bytes` object when no `path` argument is passed ([GH 37105](https://github.com/pandas-dev/pandas/issues/37105)) +* `Rolling` now supports the `closed` argument for fixed windows ([GH 34315](https://github.com/pandas-dev/pandas/issues/34315)) +* [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `datetime64` or `datetime64tz` dtypes now support `std` ([GH 37436](https://github.com/pandas-dev/pandas/issues/37436)) +* `Window` now supports all Scipy window types in `win_type` with flexible keyword argument support ([GH 34556](https://github.com/pandas-dev/pandas/issues/34556)) +* [`testing.assert_index_equal()`](../reference/api/pandas.testing.assert_index_equal.html#pandas.testing.assert_index_equal "pandas.testing.assert_index_equal") now has a `check_order` parameter that allows indexes to be checked in an order-insensitive manner ([GH 37478](https://github.com/pandas-dev/pandas/issues/37478)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") supports memory-mapping for compressed files ([GH 37621](https://github.com/pandas-dev/pandas/issues/37621)) +* Add support for `min_count` keyword for [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") and [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") for functions `min`, `max`, `first` and `last` ([GH 37821](https://github.com/pandas-dev/pandas/issues/37821), [GH 37768](https://github.com/pandas-dev/pandas/issues/37768)) +* Improve error reporting for [`DataFrame.merge()`](../reference/api/pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge") when invalid merge column definitions were given ([GH 16228](https://github.com/pandas-dev/pandas/issues/16228)) +* Improve numerical stability for [`Rolling.skew()`](../reference/api/pandas.core.window.rolling.Rolling.skew.html#pandas.core.window.rolling.Rolling.skew "pandas.core.window.rolling.Rolling.skew"), [`Rolling.kurt()`](../reference/api/pandas.core.window.rolling.Rolling.kurt.html#pandas.core.window.rolling.Rolling.kurt "pandas.core.window.rolling.Rolling.kurt"), `Expanding.skew()` and `Expanding.kurt()` through implementation of Kahan summation ([GH 6929](https://github.com/pandas-dev/pandas/issues/6929)) +* Improved error reporting for subsetting columns of a `DataFrameGroupBy` with `axis=1` ([GH 37725](https://github.com/pandas-dev/pandas/issues/37725)) +* Implement method `cross` for [`DataFrame.merge()`](../reference/api/pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge") and [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") ([GH 5401](https://github.com/pandas-dev/pandas/issues/5401)) +* When [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv"), [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") and [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") are called with `chunksize`/`iterator` they can be used in a `with` statement as they return context-managers ([GH 38225](https://github.com/pandas-dev/pandas/issues/38225)) +* Augmented the list of named colors available for styling Excel exports, enabling all of CSS4 colors ([GH 38247](https://github.com/pandas-dev/pandas/issues/38247)) + +## Notable bug fixes[#](#notable-bug-fixes "Link to this heading") + +These are bug fixes that might have notable behavior changes. + +### Consistency of DataFrame Reductions[#](#consistency-of-dataframe-reductions "Link to this heading") + +[`DataFrame.any()`](../reference/api/pandas.DataFrame.any.html#pandas.DataFrame.any "pandas.DataFrame.any") and [`DataFrame.all()`](../reference/api/pandas.DataFrame.all.html#pandas.DataFrame.all "pandas.DataFrame.all") with `bool_only=True` now +determines whether to exclude object-dtype columns on a column-by-column basis, +instead of checking if *all* object-dtype columns can be considered boolean. + +This prevents pathological behavior where applying the reduction on a subset +of columns could result in a larger Series result. See ([GH 37799](https://github.com/pandas-dev/pandas/issues/37799)). + +```None +In [24]: df = pd.DataFrame({"A": ["foo", "bar"], "B": [True, False]}, dtype=object) + +In [25]: df["C"] = pd.Series([True, True]) +``` + +*Previous behavior*: + +```None +In [5]: df.all(bool_only=True) +Out[5]: +C True +dtype: bool + +In [6]: df[["B", "C"]].all(bool_only=True) +Out[6]: +B False +C True +dtype: bool +``` + +*New behavior*: + +```None +In [26]: In [5]: df.all(bool_only=True) +Out[26]: +C True +Length: 1, dtype: bool + +In [27]: In [6]: df[["B", "C"]].all(bool_only=True) +Out[27]: +C True +Length: 1, dtype: bool +``` + +Other DataFrame reductions with `numeric_only=None` will also avoid +this pathological behavior ([GH 37827](https://github.com/pandas-dev/pandas/issues/37827)): + +```None +In [28]: df = pd.DataFrame({"A": [0, 1, 2], "B": ["a", "b", "c"]}, dtype=object) +``` + +*Previous behavior*: + +```None +In [3]: df.mean() +Out[3]: Series([], dtype: float64) + +In [4]: df[["A"]].mean() +Out[4]: +A 1.0 +dtype: float64 +``` + +*New behavior*: + +```None +In [3]: df.mean() +Out[3]: +A 1.0 +dtype: float64 + +In [4]: df[["A"]].mean() +Out[4]: +A 1.0 +dtype: float64 +``` + +Moreover, DataFrame reductions with `numeric_only=None` will now be +consistent with their Series counterparts. In particular, for +reductions where the Series method raises `TypeError`, the +DataFrame reduction will now consider that column non-numeric +instead of casting to a NumPy array which may have different semantics ([GH 36076](https://github.com/pandas-dev/pandas/issues/36076), +[GH 28949](https://github.com/pandas-dev/pandas/issues/28949), [GH 21020](https://github.com/pandas-dev/pandas/issues/21020)). + +```None +In [29]: ser = pd.Series([0, 1], dtype="category", name="A") + +In [30]: df = ser.to_frame() +``` + +*Previous behavior*: + +```None +In [5]: df.any() +Out[5]: +A True +dtype: bool +``` + +*New behavior*: + +```None +In [5]: df.any() +Out[5]: Series([], dtype: bool) +``` + +### Increased minimum version for Python[#](#increased-minimum-version-for-python "Link to this heading") + +pandas 1.2.0 supports Python 3.7.1 and higher ([GH 35214](https://github.com/pandas-dev/pandas/issues/35214)). + +### Increased minimum versions for dependencies[#](#increased-minimum-versions-for-dependencies "Link to this heading") + +Some minimum supported versions of dependencies were updated ([GH 35214](https://github.com/pandas-dev/pandas/issues/35214)). +If installed, we now require: + +| Package | Minimum Version | Required | Changed | +| --- | --- | --- | --- | +| numpy | 1.16.5 | X | X | +| pytz | 2017.3 | X | X | +| python-dateutil | 2.7.3 | X | | +| bottleneck | 1.2.1 | | | +| numexpr | 2.6.8 | | X | +| pytest (dev) | 5.0.1 | | X | +| mypy (dev) | 0.782 | | X | + +For [optional libraries](https://pandas.pydata.org/docs/getting_started/install.html) the general recommendation is to use the latest version. +The following table lists the lowest version per library that is currently being tested throughout the development of pandas. +Optional libraries below the lowest tested version may still work, but are not considered supported. + +| Package | Minimum Version | Changed | +| --- | --- | --- | +| beautifulsoup4 | 4.6.0 | | +| fastparquet | 0.3.2 | | +| fsspec | 0.7.4 | | +| gcsfs | 0.6.0 | | +| lxml | 4.3.0 | X | +| matplotlib | 2.2.3 | X | +| numba | 0.46.0 | | +| openpyxl | 2.6.0 | X | +| pyarrow | 0.15.0 | X | +| pymysql | 0.7.11 | X | +| pytables | 3.5.1 | X | +| s3fs | 0.4.0 | | +| scipy | 1.2.0 | | +| sqlalchemy | 1.2.8 | X | +| xarray | 0.12.3 | X | +| xlrd | 1.2.0 | X | +| xlsxwriter | 1.0.2 | X | +| xlwt | 1.3.0 | X | +| pandas-gbq | 0.12.0 | | + +See [Dependencies](../getting_started/install.html#install-dependencies) and [Optional dependencies](../getting_started/install.html#install-optional-dependencies) for more. + +### Other API changes[#](#other-api-changes "Link to this heading") + +* Sorting in descending order is now stable for [`Series.sort_values()`](../reference/api/pandas.Series.sort_values.html#pandas.Series.sort_values "pandas.Series.sort_values") and [`Index.sort_values()`](../reference/api/pandas.Index.sort_values.html#pandas.Index.sort_values "pandas.Index.sort_values") for Datetime-like [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") subclasses. This will affect sort order when sorting a DataFrame on multiple columns, sorting with a key function that produces duplicates, or requesting the sorting index when using [`Index.sort_values()`](../reference/api/pandas.Index.sort_values.html#pandas.Index.sort_values "pandas.Index.sort_values"). When using [`Series.value_counts()`](../reference/api/pandas.Series.value_counts.html#pandas.Series.value_counts "pandas.Series.value_counts"), the count of missing values is no longer necessarily last in the list of duplicate counts. Instead, its position corresponds to the position in the original Series. When using [`Index.sort_values()`](../reference/api/pandas.Index.sort_values.html#pandas.Index.sort_values "pandas.Index.sort_values") for Datetime-like [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") subclasses, NaTs ignored the `na_position` argument and were sorted to the beginning. Now they respect `na_position`, the default being `last`, same as other [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") subclasses ([GH 35992](https://github.com/pandas-dev/pandas/issues/35992)) +* Passing an invalid `fill_value` to `Categorical.take()`, `DatetimeArray.take()`, `TimedeltaArray.take()`, or `PeriodArray.take()` now raises a `TypeError` instead of a `ValueError` ([GH 37733](https://github.com/pandas-dev/pandas/issues/37733)) +* Passing an invalid `fill_value` to [`Series.shift()`](../reference/api/pandas.Series.shift.html#pandas.Series.shift "pandas.Series.shift") with a `CategoricalDtype` now raises a `TypeError` instead of a `ValueError` ([GH 37733](https://github.com/pandas-dev/pandas/issues/37733)) +* Passing an invalid value to `IntervalIndex.insert()` or `CategoricalIndex.insert()` now raises a `TypeError` instead of a `ValueError` ([GH 37733](https://github.com/pandas-dev/pandas/issues/37733)) +* Attempting to reindex a Series with a [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") with an invalid `fill_value` now raises a `TypeError` instead of a `ValueError` ([GH 37733](https://github.com/pandas-dev/pandas/issues/37733)) +* `CategoricalIndex.append()` with an index that contains non-category values will now cast instead of raising `TypeError` ([GH 38098](https://github.com/pandas-dev/pandas/issues/38098)) + +## Deprecations[#](#deprecations "Link to this heading") + +* Deprecated parameter `inplace` in [`MultiIndex.set_codes()`](../reference/api/pandas.MultiIndex.set_codes.html#pandas.MultiIndex.set_codes "pandas.MultiIndex.set_codes") and [`MultiIndex.set_levels()`](../reference/api/pandas.MultiIndex.set_levels.html#pandas.MultiIndex.set_levels "pandas.MultiIndex.set_levels") ([GH 35626](https://github.com/pandas-dev/pandas/issues/35626)) +* Deprecated parameter `dtype` of method [`copy()`](../reference/api/pandas.Index.copy.html#pandas.Index.copy "pandas.Index.copy") for all [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") subclasses. Use the [`astype()`](../reference/api/pandas.Index.astype.html#pandas.Index.astype "pandas.Index.astype") method instead for changing dtype ([GH 35853](https://github.com/pandas-dev/pandas/issues/35853)) +* Deprecated parameters `levels` and `codes` in [`MultiIndex.copy()`](../reference/api/pandas.MultiIndex.copy.html#pandas.MultiIndex.copy "pandas.MultiIndex.copy"). Use the [`set_levels()`](../reference/api/pandas.MultiIndex.set_levels.html#pandas.MultiIndex.set_levels "pandas.MultiIndex.set_levels") and [`set_codes()`](../reference/api/pandas.MultiIndex.set_codes.html#pandas.MultiIndex.set_codes "pandas.MultiIndex.set_codes") methods instead ([GH 36685](https://github.com/pandas-dev/pandas/issues/36685)) +* Date parser functions `parse_date_time()`, `parse_date_fields()`, `parse_all_fields()` and `generic_parser()` from `pandas.io.date_converters` are deprecated and will be removed in a future version; use [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") instead ([GH 35741](https://github.com/pandas-dev/pandas/issues/35741)) +* `DataFrame.lookup()` is deprecated and will be removed in a future version, use [`DataFrame.melt()`](../reference/api/pandas.DataFrame.melt.html#pandas.DataFrame.melt "pandas.DataFrame.melt") and [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") instead ([GH 35224](https://github.com/pandas-dev/pandas/issues/35224)) +* The method `Index.to_native_types()` is deprecated. Use `.astype(str)` instead ([GH 28867](https://github.com/pandas-dev/pandas/issues/28867)) +* Deprecated indexing [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") rows with a single datetime-like string as `df[string]` (given the ambiguity whether it is indexing the rows or selecting a column), use `df.loc[string]` instead ([GH 36179](https://github.com/pandas-dev/pandas/issues/36179)) +* Deprecated `Index.is_all_dates()` ([GH 27744](https://github.com/pandas-dev/pandas/issues/27744)) +* The default value of `regex` for [`Series.str.replace()`](../reference/api/pandas.Series.str.replace.html#pandas.Series.str.replace "pandas.Series.str.replace") will change from `True` to `False` in a future release. In addition, single character regular expressions will *not* be treated as literal strings when `regex=True` is set ([GH 24804](https://github.com/pandas-dev/pandas/issues/24804)) +* Deprecated automatic alignment on comparison operations between [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), do `frame, ser = frame.align(ser, axis=1, copy=False)` before e.g. `frame == ser` ([GH 28759](https://github.com/pandas-dev/pandas/issues/28759)) +* `Rolling.count()` with `min_periods=None` will default to the size of the window in a future version ([GH 31302](https://github.com/pandas-dev/pandas/issues/31302)) +* Using “outer” ufuncs on DataFrames to return 4d ndarray is now deprecated. Convert to an ndarray first ([GH 23743](https://github.com/pandas-dev/pandas/issues/23743)) +* Deprecated slice-indexing on tz-aware [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with naive `datetime` objects, to match scalar indexing behavior ([GH 36148](https://github.com/pandas-dev/pandas/issues/36148)) +* [`Index.ravel()`](../reference/api/pandas.Index.ravel.html#pandas.Index.ravel "pandas.Index.ravel") returning a `np.ndarray` is deprecated, in the future this will return a view on the same index ([GH 19956](https://github.com/pandas-dev/pandas/issues/19956)) +* Deprecate use of strings denoting units with ‘M’, ‘Y’ or ‘y’ in [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta") ([GH 36666](https://github.com/pandas-dev/pandas/issues/36666)) +* [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") methods `&`, `|`, and `^` behaving as the set operations [`Index.intersection()`](../reference/api/pandas.Index.intersection.html#pandas.Index.intersection "pandas.Index.intersection"), [`Index.union()`](../reference/api/pandas.Index.union.html#pandas.Index.union "pandas.Index.union"), and [`Index.symmetric_difference()`](../reference/api/pandas.Index.symmetric_difference.html#pandas.Index.symmetric_difference "pandas.Index.symmetric_difference"), respectively, are deprecated and in the future will behave as pointwise boolean operations matching [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") behavior. Use the named set methods instead ([GH 36758](https://github.com/pandas-dev/pandas/issues/36758)) +* `Categorical.is_dtype_equal()` and `CategoricalIndex.is_dtype_equal()` are deprecated, will be removed in a future version ([GH 37545](https://github.com/pandas-dev/pandas/issues/37545)) +* `Series.slice_shift()` and `DataFrame.slice_shift()` are deprecated, use [`Series.shift()`](../reference/api/pandas.Series.shift.html#pandas.Series.shift "pandas.Series.shift") or [`DataFrame.shift()`](../reference/api/pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift") instead ([GH 37601](https://github.com/pandas-dev/pandas/issues/37601)) +* Partial slicing on unordered [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") objects with keys that are not in the index is deprecated and will be removed in a future version ([GH 18531](https://github.com/pandas-dev/pandas/issues/18531)) +* The `how` keyword in `PeriodIndex.astype()` is deprecated and will be removed in a future version, use `index.to_timestamp(how=how)` instead ([GH 37982](https://github.com/pandas-dev/pandas/issues/37982)) +* Deprecated `Index.asi8()` for [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") subclasses other than [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex"), [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex"), and [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") ([GH 37877](https://github.com/pandas-dev/pandas/issues/37877)) +* The `inplace` parameter of `Categorical.remove_unused_categories()` is deprecated and will be removed in a future version ([GH 37643](https://github.com/pandas-dev/pandas/issues/37643)) +* The `null_counts` parameter of [`DataFrame.info()`](../reference/api/pandas.DataFrame.info.html#pandas.DataFrame.info "pandas.DataFrame.info") is deprecated and replaced by `show_counts`. It will be removed in a future version ([GH 37999](https://github.com/pandas-dev/pandas/issues/37999)) + +**Calling NumPy ufuncs on non-aligned DataFrames** + +Calling NumPy ufuncs on non-aligned DataFrames changed behaviour in pandas +1.2.0 (to align the inputs before calling the ufunc), but this change is +reverted in pandas 1.2.1. The behaviour to not align is now deprecated instead, +see the [the 1.2.1 release notes](v1.2.1.html#whatsnew-121-ufunc-deprecation) for +more details. + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Performance improvements when creating DataFrame or Series with dtype `str` or [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") from array with many string elements ([GH 36304](https://github.com/pandas-dev/pandas/issues/36304), [GH 36317](https://github.com/pandas-dev/pandas/issues/36317), [GH 36325](https://github.com/pandas-dev/pandas/issues/36325), [GH 36432](https://github.com/pandas-dev/pandas/issues/36432), [GH 37371](https://github.com/pandas-dev/pandas/issues/37371)) +* Performance improvement in [`DataFrameGroupBy.agg()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg") and [`SeriesGroupBy.agg()`](../reference/api/pandas.core.groupby.SeriesGroupBy.agg.html#pandas.core.groupby.SeriesGroupBy.agg "pandas.core.groupby.SeriesGroupBy.agg") with the `numba` engine ([GH 35759](https://github.com/pandas-dev/pandas/issues/35759)) +* Performance improvements when creating [`Series.map()`](../reference/api/pandas.Series.map.html#pandas.Series.map "pandas.Series.map") from a huge dictionary ([GH 34717](https://github.com/pandas-dev/pandas/issues/34717)) +* Performance improvement in [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") and [`SeriesGroupBy.transform()`](../reference/api/pandas.core.groupby.SeriesGroupBy.transform.html#pandas.core.groupby.SeriesGroupBy.transform "pandas.core.groupby.SeriesGroupBy.transform") with the `numba` engine ([GH 36240](https://github.com/pandas-dev/pandas/issues/36240)) +* [`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") uuid method altered to compress data transmission over web whilst maintaining reasonably low table collision probability ([GH 36345](https://github.com/pandas-dev/pandas/issues/36345)) +* Performance improvement in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with non-ns time unit for `float` `dtype` columns ([GH 20445](https://github.com/pandas-dev/pandas/issues/20445)) +* Performance improvement in setting values on an `IntervalArray` ([GH 36310](https://github.com/pandas-dev/pandas/issues/36310)) +* The internal index method `_shallow_copy()` now makes the new index and original index share cached attributes, avoiding creating these again, if created on either. This can speed up operations that depend on creating copies of existing indexes ([GH 36840](https://github.com/pandas-dev/pandas/issues/36840)) +* Performance improvement in `RollingGroupby.count()` ([GH 35625](https://github.com/pandas-dev/pandas/issues/35625)) +* Small performance decrease to [`Rolling.min()`](../reference/api/pandas.core.window.rolling.Rolling.min.html#pandas.core.window.rolling.Rolling.min "pandas.core.window.rolling.Rolling.min") and [`Rolling.max()`](../reference/api/pandas.core.window.rolling.Rolling.max.html#pandas.core.window.rolling.Rolling.max "pandas.core.window.rolling.Rolling.max") for fixed windows ([GH 36567](https://github.com/pandas-dev/pandas/issues/36567)) +* Reduced peak memory usage in [`DataFrame.to_pickle()`](../reference/api/pandas.DataFrame.to_pickle.html#pandas.DataFrame.to_pickle "pandas.DataFrame.to_pickle") when using `protocol=5` in python 3.8+ ([GH 34244](https://github.com/pandas-dev/pandas/issues/34244)) +* Faster `dir` calls when the object has many index labels, e.g. `dir(ser)` ([GH 37450](https://github.com/pandas-dev/pandas/issues/37450)) +* Performance improvement in `ExpandingGroupby` ([GH 37064](https://github.com/pandas-dev/pandas/issues/37064)) +* Performance improvement in [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") and [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") for [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") ([GH 8628](https://github.com/pandas-dev/pandas/issues/8628)) +* Performance improvement in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") for `float` `dtype` ([GH 28303](https://github.com/pandas-dev/pandas/issues/28303)), changes of the underlying hash-function can lead to changes in float based indexes sort ordering for ties (e.g. [`Index.value_counts()`](../reference/api/pandas.Index.value_counts.html#pandas.Index.value_counts "pandas.Index.value_counts")) +* Performance improvement in `pd.isin()` for inputs with more than 1e6 elements ([GH 36611](https://github.com/pandas-dev/pandas/issues/36611)) +* Performance improvement for `DataFrame.__setitem__()` with list-like indexers ([GH 37954](https://github.com/pandas-dev/pandas/issues/37954)) +* [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") now avoids reading entire file into memory when chunksize is specified ([GH 34548](https://github.com/pandas-dev/pandas/issues/34548)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +### Categorical[#](#categorical "Link to this heading") + +* `Categorical.fillna()` will always return a copy, validate a passed fill value regardless of whether there are any NAs to fill, and disallow an `NaT` as a fill value for numeric categories ([GH 36530](https://github.com/pandas-dev/pandas/issues/36530)) +* Bug in `Categorical.__setitem__()` that incorrectly raised when trying to set a tuple value ([GH 20439](https://github.com/pandas-dev/pandas/issues/20439)) +* Bug in [`CategoricalIndex.equals()`](../reference/api/pandas.CategoricalIndex.equals.html#pandas.CategoricalIndex.equals "pandas.CategoricalIndex.equals") incorrectly casting non-category entries to `np.nan` ([GH 37667](https://github.com/pandas-dev/pandas/issues/37667)) +* Bug in `CategoricalIndex.where()` incorrectly setting non-category entries to `np.nan` instead of raising `TypeError` ([GH 37977](https://github.com/pandas-dev/pandas/issues/37977)) +* Bug in `Categorical.to_numpy()` and `np.array(categorical)` with tz-aware `datetime64` categories incorrectly dropping the time zone information instead of casting to object dtype ([GH 38136](https://github.com/pandas-dev/pandas/issues/38136)) + +### Datetime-like[#](#datetime-like "Link to this heading") + +* Bug in [`DataFrame.combine_first()`](../reference/api/pandas.DataFrame.combine_first.html#pandas.DataFrame.combine_first "pandas.DataFrame.combine_first") that would convert datetime-like column on other [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") to integer when the column is not present in original [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 28481](https://github.com/pandas-dev/pandas/issues/28481)) +* Bug in `DatetimeArray.date` where a `ValueError` would be raised with a read-only backing array ([GH 33530](https://github.com/pandas-dev/pandas/issues/33530)) +* Bug in `NaT` comparisons failing to raise `TypeError` on invalid inequality comparisons ([GH 35046](https://github.com/pandas-dev/pandas/issues/35046)) +* Bug in [`DateOffset`](../reference/api/pandas.tseries.offsets.DateOffset.html#pandas.tseries.offsets.DateOffset "pandas.tseries.offsets.DateOffset") where attributes reconstructed from pickle files differ from original objects when input values exceed normal ranges (e.g. months=12) ([GH 34511](https://github.com/pandas-dev/pandas/issues/34511)) +* Bug in `DatetimeIndex.get_slice_bound()` where `datetime.date` objects were not accepted or naive [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") with a tz-aware [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") ([GH 35690](https://github.com/pandas-dev/pandas/issues/35690)) +* Bug in `DatetimeIndex.slice_locs()` where `datetime.date` objects were not accepted ([GH 34077](https://github.com/pandas-dev/pandas/issues/34077)) +* Bug in `DatetimeIndex.searchsorted()`, `TimedeltaIndex.searchsorted()`, `PeriodIndex.searchsorted()`, and [`Series.searchsorted()`](../reference/api/pandas.Series.searchsorted.html#pandas.Series.searchsorted "pandas.Series.searchsorted") with `datetime64`, `timedelta64` or [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") dtype placement of `NaT` values being inconsistent with NumPy ([GH 36176](https://github.com/pandas-dev/pandas/issues/36176), [GH 36254](https://github.com/pandas-dev/pandas/issues/36254)) +* Inconsistency in [`DatetimeArray`](../reference/api/pandas.arrays.DatetimeArray.html#pandas.arrays.DatetimeArray "pandas.arrays.DatetimeArray"), [`TimedeltaArray`](../reference/api/pandas.arrays.TimedeltaArray.html#pandas.arrays.TimedeltaArray "pandas.arrays.TimedeltaArray"), and [`PeriodArray`](../reference/api/pandas.arrays.PeriodArray.html#pandas.arrays.PeriodArray "pandas.arrays.PeriodArray") method `__setitem__` casting arrays of strings to datetime-like scalars but not scalar strings ([GH 36261](https://github.com/pandas-dev/pandas/issues/36261)) +* Bug in `DatetimeArray.take()` incorrectly allowing `fill_value` with a mismatched time zone ([GH 37356](https://github.com/pandas-dev/pandas/issues/37356)) +* Bug in `DatetimeIndex.shift` incorrectly raising when shifting empty indexes ([GH 14811](https://github.com/pandas-dev/pandas/issues/14811)) +* [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") and [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") comparisons between tz-aware and tz-naive objects now follow the standard library `datetime` behavior, returning `True`/`False` for `!=`/`==` and raising for inequality comparisons ([GH 28507](https://github.com/pandas-dev/pandas/issues/28507)) +* Bug in `DatetimeIndex.equals()` and `TimedeltaIndex.equals()` incorrectly considering `int64` indexes as equal ([GH 36744](https://github.com/pandas-dev/pandas/issues/36744)) +* [`Series.to_json()`](../reference/api/pandas.Series.to_json.html#pandas.Series.to_json "pandas.Series.to_json"), [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json"), and [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") now implement time zone parsing when orient structure is `table` ([GH 35973](https://github.com/pandas-dev/pandas/issues/35973)) +* `astype()` now attempts to convert to `datetime64[ns, tz]` directly from `object` with inferred time zone from string ([GH 35973](https://github.com/pandas-dev/pandas/issues/35973)) +* Bug in `TimedeltaIndex.sum()` and [`Series.sum()`](../reference/api/pandas.Series.sum.html#pandas.Series.sum "pandas.Series.sum") with `timedelta64` dtype on an empty index or series returning `NaT` instead of `Timedelta(0)` ([GH 31751](https://github.com/pandas-dev/pandas/issues/31751)) +* Bug in `DatetimeArray.shift()` incorrectly allowing `fill_value` with a mismatched time zone ([GH 37299](https://github.com/pandas-dev/pandas/issues/37299)) +* Bug in adding a [`BusinessDay`](../reference/api/pandas.tseries.offsets.BusinessDay.html#pandas.tseries.offsets.BusinessDay "pandas.tseries.offsets.BusinessDay") with nonzero `offset` to a non-scalar other ([GH 37457](https://github.com/pandas-dev/pandas/issues/37457)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with a read-only array incorrectly raising ([GH 34857](https://github.com/pandas-dev/pandas/issues/34857)) +* Bug in [`Series.isin()`](../reference/api/pandas.Series.isin.html#pandas.Series.isin "pandas.Series.isin") with `datetime64[ns]` dtype and `DatetimeIndex.isin()` incorrectly casting integers to datetimes ([GH 36621](https://github.com/pandas-dev/pandas/issues/36621)) +* Bug in [`Series.isin()`](../reference/api/pandas.Series.isin.html#pandas.Series.isin "pandas.Series.isin") with `datetime64[ns]` dtype and `DatetimeIndex.isin()` failing to consider tz-aware and tz-naive datetimes as always different ([GH 35728](https://github.com/pandas-dev/pandas/issues/35728)) +* Bug in [`Series.isin()`](../reference/api/pandas.Series.isin.html#pandas.Series.isin "pandas.Series.isin") with `PeriodDtype` dtype and `PeriodIndex.isin()` failing to consider arguments with different `PeriodDtype` as always different ([GH 37528](https://github.com/pandas-dev/pandas/issues/37528)) +* Bug in [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") constructor now correctly handles nanoseconds in the `value` argument ([GH 34621](https://github.com/pandas-dev/pandas/issues/34621) and [GH 17053](https://github.com/pandas-dev/pandas/issues/17053)) + +### Timedelta[#](#timedelta "Link to this heading") + +* Bug in [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex"), [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") floor-division with `timedelta64` dtypes and `NaT` in the denominator ([GH 35529](https://github.com/pandas-dev/pandas/issues/35529)) +* Bug in parsing of ISO 8601 durations in [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") and [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") ([GH 29773](https://github.com/pandas-dev/pandas/issues/29773), [GH 36204](https://github.com/pandas-dev/pandas/issues/36204)) +* Bug in [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta") with a read-only array incorrectly raising ([GH 34857](https://github.com/pandas-dev/pandas/issues/34857)) +* Bug in [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") incorrectly truncating to sub-second portion of a string input when it has precision higher than nanoseconds ([GH 36738](https://github.com/pandas-dev/pandas/issues/36738)) + +### Timezones[#](#timezones "Link to this heading") + +* Bug in [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range") was raising `AmbiguousTimeError` for valid input with `ambiguous=False` ([GH 35297](https://github.com/pandas-dev/pandas/issues/35297)) +* Bug in [`Timestamp.replace()`](../reference/api/pandas.Timestamp.replace.html#pandas.Timestamp.replace "pandas.Timestamp.replace") was losing fold information ([GH 37610](https://github.com/pandas-dev/pandas/issues/37610)) + +### Numeric[#](#numeric "Link to this heading") + +* Bug in [`to_numeric()`](../reference/api/pandas.to_numeric.html#pandas.to_numeric "pandas.to_numeric") where float precision was incorrect ([GH 31364](https://github.com/pandas-dev/pandas/issues/31364)) +* Bug in [`DataFrame.any()`](../reference/api/pandas.DataFrame.any.html#pandas.DataFrame.any "pandas.DataFrame.any") with `axis=1` and `bool_only=True` ignoring the `bool_only` keyword ([GH 32432](https://github.com/pandas-dev/pandas/issues/32432)) +* Bug in [`Series.equals()`](../reference/api/pandas.Series.equals.html#pandas.Series.equals "pandas.Series.equals") where a `ValueError` was raised when NumPy arrays were compared to scalars ([GH 35267](https://github.com/pandas-dev/pandas/issues/35267)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") where two Series each have a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with different time zones having those indexes incorrectly changed when performing arithmetic operations ([GH 33671](https://github.com/pandas-dev/pandas/issues/33671)) +* Bug in `pandas.testing` module functions when used with `check_exact=False` on complex numeric types ([GH 28235](https://github.com/pandas-dev/pandas/issues/28235)) +* Bug in `DataFrame.__rmatmul__()` error handling reporting transposed shapes ([GH 21581](https://github.com/pandas-dev/pandas/issues/21581)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") flex arithmetic methods where the result when operating with a `list`, `tuple` or `np.ndarray` would have an incorrect name ([GH 36760](https://github.com/pandas-dev/pandas/issues/36760)) +* Bug in [`IntegerArray`](../reference/api/pandas.arrays.IntegerArray.html#pandas.arrays.IntegerArray "pandas.arrays.IntegerArray") multiplication with `timedelta` and `np.timedelta64` objects ([GH 36870](https://github.com/pandas-dev/pandas/issues/36870)) +* Bug in [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") comparison with tuple incorrectly treating tuple as array-like ([GH 21517](https://github.com/pandas-dev/pandas/issues/21517)) +* Bug in [`DataFrame.diff()`](../reference/api/pandas.DataFrame.diff.html#pandas.DataFrame.diff "pandas.DataFrame.diff") with `datetime64` dtypes including `NaT` values failing to fill `NaT` results correctly ([GH 32441](https://github.com/pandas-dev/pandas/issues/32441)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") arithmetic ops incorrectly accepting keyword arguments ([GH 36843](https://github.com/pandas-dev/pandas/issues/36843)) +* Bug in [`IntervalArray`](../reference/api/pandas.arrays.IntervalArray.html#pandas.arrays.IntervalArray "pandas.arrays.IntervalArray") comparisons with [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") not returning Series ([GH 36908](https://github.com/pandas-dev/pandas/issues/36908)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") allowing arithmetic operations with list of array-likes with undefined results. Behavior changed to raising `ValueError` ([GH 36702](https://github.com/pandas-dev/pandas/issues/36702)) +* Bug in [`DataFrame.std()`](../reference/api/pandas.DataFrame.std.html#pandas.DataFrame.std "pandas.DataFrame.std") with `timedelta64` dtype and `skipna=False` ([GH 37392](https://github.com/pandas-dev/pandas/issues/37392)) +* Bug in [`DataFrame.min()`](../reference/api/pandas.DataFrame.min.html#pandas.DataFrame.min "pandas.DataFrame.min") and [`DataFrame.max()`](../reference/api/pandas.DataFrame.max.html#pandas.DataFrame.max "pandas.DataFrame.max") with `datetime64` dtype and `skipna=False` ([GH 36907](https://github.com/pandas-dev/pandas/issues/36907)) +* Bug in [`DataFrame.idxmax()`](../reference/api/pandas.DataFrame.idxmax.html#pandas.DataFrame.idxmax "pandas.DataFrame.idxmax") and [`DataFrame.idxmin()`](../reference/api/pandas.DataFrame.idxmin.html#pandas.DataFrame.idxmin "pandas.DataFrame.idxmin") with mixed dtypes incorrectly raising `TypeError` ([GH 38195](https://github.com/pandas-dev/pandas/issues/38195)) + +### Conversion[#](#conversion "Link to this heading") + +* Bug in [`DataFrame.to_dict()`](../reference/api/pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict") with `orient='records'` now returns python native datetime objects for datetime-like columns ([GH 21256](https://github.com/pandas-dev/pandas/issues/21256)) +* Bug in [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") conversion from `string` to `float` raised in presence of `pd.NA` values ([GH 37626](https://github.com/pandas-dev/pandas/issues/37626)) + +### Strings[#](#strings "Link to this heading") + +* Bug in [`Series.to_string()`](../reference/api/pandas.Series.to_string.html#pandas.Series.to_string "pandas.Series.to_string"), [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string"), and [`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex") adding a leading space when `index=False` ([GH 24980](https://github.com/pandas-dev/pandas/issues/24980)) +* Bug in [`to_numeric()`](../reference/api/pandas.to_numeric.html#pandas.to_numeric "pandas.to_numeric") raising a `TypeError` when attempting to convert a string dtype Series containing only numeric strings and `NA` ([GH 37262](https://github.com/pandas-dev/pandas/issues/37262)) + +### Interval[#](#interval "Link to this heading") + +* Bug in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") and [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") where [`Interval`](../reference/api/pandas.Interval.html#pandas.Interval "pandas.Interval") dtypes would be converted to object dtypes ([GH 34871](https://github.com/pandas-dev/pandas/issues/34871)) +* Bug in `IntervalIndex.take()` with negative indices and `fill_value=None` ([GH 37330](https://github.com/pandas-dev/pandas/issues/37330)) +* Bug in `IntervalIndex.putmask()` with datetime-like dtype incorrectly casting to object dtype ([GH 37968](https://github.com/pandas-dev/pandas/issues/37968)) +* Bug in `IntervalArray.astype()` incorrectly dropping dtype information with a [`CategoricalDtype`](../reference/api/pandas.CategoricalDtype.html#pandas.CategoricalDtype "pandas.CategoricalDtype") object ([GH 37984](https://github.com/pandas-dev/pandas/issues/37984)) + +### Indexing[#](#indexing "Link to this heading") + +* Bug in `PeriodIndex.get_loc()` incorrectly raising `ValueError` on non-datelike strings instead of `KeyError`, causing similar errors in `Series.__getitem__()`, `Series.__contains__()`, and `Series.loc.__getitem__()` ([GH 34240](https://github.com/pandas-dev/pandas/issues/34240)) +* Bug in [`Index.sort_values()`](../reference/api/pandas.Index.sort_values.html#pandas.Index.sort_values "pandas.Index.sort_values") where, when empty values were passed, the method would break by trying to compare missing values instead of pushing them to the end of the sort order ([GH 35584](https://github.com/pandas-dev/pandas/issues/35584)) +* Bug in [`Index.get_indexer()`](../reference/api/pandas.Index.get_indexer.html#pandas.Index.get_indexer "pandas.Index.get_indexer") and [`Index.get_indexer_non_unique()`](../reference/api/pandas.Index.get_indexer_non_unique.html#pandas.Index.get_indexer_non_unique "pandas.Index.get_indexer_non_unique") where `int64` arrays are returned instead of `intp` ([GH 36359](https://github.com/pandas-dev/pandas/issues/36359)) +* Bug in [`DataFrame.sort_index()`](../reference/api/pandas.DataFrame.sort_index.html#pandas.DataFrame.sort_index "pandas.DataFrame.sort_index") where parameter ascending passed as a list on a single level index gives wrong result ([GH 32334](https://github.com/pandas-dev/pandas/issues/32334)) +* Bug in [`DataFrame.reset_index()`](../reference/api/pandas.DataFrame.reset_index.html#pandas.DataFrame.reset_index "pandas.DataFrame.reset_index") was incorrectly raising a `ValueError` for input with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") with missing values in a level with `Categorical` dtype ([GH 24206](https://github.com/pandas-dev/pandas/issues/24206)) +* Bug in indexing with boolean masks on datetime-like values sometimes returning a view instead of a copy ([GH 36210](https://github.com/pandas-dev/pandas/issues/36210)) +* Bug in `DataFrame.__getitem__()` and `DataFrame.loc.__getitem__()` with [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") columns and a numeric indexer ([GH 26490](https://github.com/pandas-dev/pandas/issues/26490)) +* Bug in `Series.loc.__getitem__()` with a non-unique [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") and an empty-list indexer ([GH 13691](https://github.com/pandas-dev/pandas/issues/13691)) +* Bug in indexing on a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") and a level named `"0"` ([GH 37194](https://github.com/pandas-dev/pandas/issues/37194)) +* Bug in `Series.__getitem__()` when using an unsigned integer array as an indexer giving incorrect results or segfaulting instead of raising `KeyError` ([GH 37218](https://github.com/pandas-dev/pandas/issues/37218)) +* Bug in [`Index.where()`](../reference/api/pandas.Index.where.html#pandas.Index.where "pandas.Index.where") incorrectly casting numeric values to strings ([GH 37591](https://github.com/pandas-dev/pandas/issues/37591)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") returning empty result when indexer is a slice with negative step size ([GH 38071](https://github.com/pandas-dev/pandas/issues/38071)) +* Bug in [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") and [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") raises when the index was of `object` dtype and the given numeric label was in the index ([GH 26491](https://github.com/pandas-dev/pandas/issues/26491)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") returned requested key plus missing values when `loc` was applied to single level from a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 27104](https://github.com/pandas-dev/pandas/issues/27104)) +* Bug in indexing on a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") using a list-like indexer containing NA values ([GH 37722](https://github.com/pandas-dev/pandas/issues/37722)) +* Bug in `DataFrame.loc.__setitem__()` expanding an empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with mixed dtypes ([GH 37932](https://github.com/pandas-dev/pandas/issues/37932)) +* Bug in [`DataFrame.xs()`](../reference/api/pandas.DataFrame.xs.html#pandas.DataFrame.xs "pandas.DataFrame.xs") ignored `droplevel=False` for columns ([GH 19056](https://github.com/pandas-dev/pandas/issues/19056)) +* Bug in [`DataFrame.reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex") raising `IndexingError` wrongly for empty DataFrame with `tolerance` not `None` or `method="nearest"` ([GH 27315](https://github.com/pandas-dev/pandas/issues/27315)) +* Bug in indexing on a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") using list-like indexer that contains elements that are in the index’s `categories` but not in the index itself failing to raise `KeyError` ([GH 37901](https://github.com/pandas-dev/pandas/issues/37901)) +* Bug on inserting a boolean label into a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a numeric [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") columns incorrectly casting to integer ([GH 36319](https://github.com/pandas-dev/pandas/issues/36319)) +* Bug in [`DataFrame.iloc()`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") and [`Series.iloc()`](../reference/api/pandas.Series.iloc.html#pandas.Series.iloc "pandas.Series.iloc") aligning objects in `__setitem__` ([GH 22046](https://github.com/pandas-dev/pandas/issues/22046)) +* Bug in [`MultiIndex.drop()`](../reference/api/pandas.MultiIndex.drop.html#pandas.MultiIndex.drop "pandas.MultiIndex.drop") does not raise if labels are partially found ([GH 37820](https://github.com/pandas-dev/pandas/issues/37820)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") did not raise `KeyError` when missing combination was given with `slice(None)` for remaining levels ([GH 19556](https://github.com/pandas-dev/pandas/issues/19556)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") raising `TypeError` when non-integer slice was given to select values from [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 25165](https://github.com/pandas-dev/pandas/issues/25165), [GH 24263](https://github.com/pandas-dev/pandas/issues/24263)) +* Bug in [`Series.at()`](../reference/api/pandas.Series.at.html#pandas.Series.at "pandas.Series.at") returning [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with one element instead of scalar when index is a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") with one level ([GH 38053](https://github.com/pandas-dev/pandas/issues/38053)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") returning and assigning elements in wrong order when indexer is differently ordered than the [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") to filter ([GH 31330](https://github.com/pandas-dev/pandas/issues/31330), [GH 34603](https://github.com/pandas-dev/pandas/issues/34603)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") and `DataFrame.__getitem__()` raising `KeyError` when columns were [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") with only one level ([GH 29749](https://github.com/pandas-dev/pandas/issues/29749)) +* Bug in `Series.__getitem__()` and `DataFrame.__getitem__()` raising blank `KeyError` without missing keys for [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") ([GH 27365](https://github.com/pandas-dev/pandas/issues/27365)) +* Bug in setting a new label on a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") or [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with a [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") incorrectly raising `TypeError` when the new label is not among the index’s categories ([GH 38098](https://github.com/pandas-dev/pandas/issues/38098)) +* Bug in [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") and [`Series.iloc()`](../reference/api/pandas.Series.iloc.html#pandas.Series.iloc "pandas.Series.iloc") raising `ValueError` when inserting a list-like `np.array`, `list` or `tuple` in an `object` Series of equal length ([GH 37748](https://github.com/pandas-dev/pandas/issues/37748), [GH 37486](https://github.com/pandas-dev/pandas/issues/37486)) +* Bug in [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") and [`Series.iloc()`](../reference/api/pandas.Series.iloc.html#pandas.Series.iloc "pandas.Series.iloc") setting all the values of an `object` Series with those of a list-like `ExtensionArray` instead of inserting it ([GH 38271](https://github.com/pandas-dev/pandas/issues/38271)) + +### Missing[#](#missing "Link to this heading") + +* Bug in [`SeriesGroupBy.transform()`](../reference/api/pandas.core.groupby.SeriesGroupBy.transform.html#pandas.core.groupby.SeriesGroupBy.transform "pandas.core.groupby.SeriesGroupBy.transform") now correctly handles missing values for `dropna=False` ([GH 35014](https://github.com/pandas-dev/pandas/issues/35014)) +* Bug in [`Series.nunique()`](../reference/api/pandas.Series.nunique.html#pandas.Series.nunique "pandas.Series.nunique") with `dropna=True` was returning incorrect results when both `NA` and `None` missing values were present ([GH 37566](https://github.com/pandas-dev/pandas/issues/37566)) +* Bug in [`Series.interpolate()`](../reference/api/pandas.Series.interpolate.html#pandas.Series.interpolate "pandas.Series.interpolate") where kwarg `limit_area` and `limit_direction` had no effect when using methods `pad` and `backfill` ([GH 31048](https://github.com/pandas-dev/pandas/issues/31048)) + +### MultiIndex[#](#multiindex "Link to this heading") + +* Bug in [`DataFrame.xs()`](../reference/api/pandas.DataFrame.xs.html#pandas.DataFrame.xs "pandas.DataFrame.xs") when used with [`IndexSlice`](../reference/api/pandas.IndexSlice.html#pandas.IndexSlice "pandas.IndexSlice") raises `TypeError` with message `"Expected label or tuple of labels"` ([GH 35301](https://github.com/pandas-dev/pandas/issues/35301)) +* Bug in [`DataFrame.reset_index()`](../reference/api/pandas.DataFrame.reset_index.html#pandas.DataFrame.reset_index "pandas.DataFrame.reset_index") with `NaT` values in index raises `ValueError` with message `"cannot convert float NaN to integer"` ([GH 36541](https://github.com/pandas-dev/pandas/issues/36541)) +* Bug in [`DataFrame.combine_first()`](../reference/api/pandas.DataFrame.combine_first.html#pandas.DataFrame.combine_first "pandas.DataFrame.combine_first") when used with [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") containing string and `NaN` values raises `TypeError` ([GH 36562](https://github.com/pandas-dev/pandas/issues/36562)) +* Bug in [`MultiIndex.drop()`](../reference/api/pandas.MultiIndex.drop.html#pandas.MultiIndex.drop "pandas.MultiIndex.drop") dropped `NaN` values when non existing key was given as input ([GH 18853](https://github.com/pandas-dev/pandas/issues/18853)) +* Bug in [`MultiIndex.drop()`](../reference/api/pandas.MultiIndex.drop.html#pandas.MultiIndex.drop "pandas.MultiIndex.drop") dropping more values than expected when index has duplicates and is not sorted ([GH 33494](https://github.com/pandas-dev/pandas/issues/33494)) + +### I/O[#](#i-o "Link to this heading") + +* [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") no longer leaks resources on failure ([GH 35566](https://github.com/pandas-dev/pandas/issues/35566)) +* Bug in [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") and [`Series.to_csv()`](../reference/api/pandas.Series.to_csv.html#pandas.Series.to_csv "pandas.Series.to_csv") caused a `ValueError` when it was called with a filename in combination with `mode` containing a `b` ([GH 35058](https://github.com/pandas-dev/pandas/issues/35058)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") with `float_precision='round_trip'` did not handle `decimal` and `thousands` parameters ([GH 35365](https://github.com/pandas-dev/pandas/issues/35365)) +* `to_pickle()` and [`read_pickle()`](../reference/api/pandas.read_pickle.html#pandas.read_pickle "pandas.read_pickle") were closing user-provided file objects ([GH 35679](https://github.com/pandas-dev/pandas/issues/35679)) +* `to_csv()` passes compression arguments for `'gzip'` always to `gzip.GzipFile` ([GH 28103](https://github.com/pandas-dev/pandas/issues/28103)) +* `to_csv()` did not support zip compression for binary file object not having a filename ([GH 35058](https://github.com/pandas-dev/pandas/issues/35058)) +* `to_csv()` and [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") did not honor `compression` and `encoding` for path-like objects that are internally converted to file-like objects ([GH 35677](https://github.com/pandas-dev/pandas/issues/35677), [GH 26124](https://github.com/pandas-dev/pandas/issues/26124), [GH 32392](https://github.com/pandas-dev/pandas/issues/32392)) +* [`DataFrame.to_pickle()`](../reference/api/pandas.DataFrame.to_pickle.html#pandas.DataFrame.to_pickle "pandas.DataFrame.to_pickle"), [`Series.to_pickle()`](../reference/api/pandas.Series.to_pickle.html#pandas.Series.to_pickle "pandas.Series.to_pickle"), and [`read_pickle()`](../reference/api/pandas.read_pickle.html#pandas.read_pickle "pandas.read_pickle") did not support compression for file-objects ([GH 26237](https://github.com/pandas-dev/pandas/issues/26237), [GH 29054](https://github.com/pandas-dev/pandas/issues/29054), [GH 29570](https://github.com/pandas-dev/pandas/issues/29570)) +* Bug in `LongTableBuilder.middle_separator()` was duplicating LaTeX longtable entries in the List of Tables of a LaTeX document ([GH 34360](https://github.com/pandas-dev/pandas/issues/34360)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") with `engine='python'` truncating data if multiple items present in first row and first element started with BOM ([GH 36343](https://github.com/pandas-dev/pandas/issues/36343)) +* Removed `private_key` and `verbose` from [`read_gbq()`](../reference/api/pandas.read_gbq.html#pandas.read_gbq "pandas.read_gbq") as they are no longer supported in `pandas-gbq` ([GH 34654](https://github.com/pandas-dev/pandas/issues/34654), [GH 30200](https://github.com/pandas-dev/pandas/issues/30200)) +* Bumped minimum pytables version to 3.5.1 to avoid a `ValueError` in [`read_hdf()`](../reference/api/pandas.read_hdf.html#pandas.read_hdf "pandas.read_hdf") ([GH 24839](https://github.com/pandas-dev/pandas/issues/24839)) +* Bug in [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") and [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") when `delim_whitespace=True` and `sep=default` ([GH 36583](https://github.com/pandas-dev/pandas/issues/36583)) +* Bug in [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") and [`Series.to_json()`](../reference/api/pandas.Series.to_json.html#pandas.Series.to_json "pandas.Series.to_json") when used with `lines=True` and `orient='records'` the last line of the record is not appended with ‘new line character’ ([GH 36888](https://github.com/pandas-dev/pandas/issues/36888)) +* Bug in [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") with fixed offset time zones. String representation of time zones was not recognized ([GH 35997](https://github.com/pandas-dev/pandas/issues/35997), [GH 36004](https://github.com/pandas-dev/pandas/issues/36004)) +* Bug in [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html"), [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string"), and [`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex") ignoring the `na_rep` argument when `float_format` was also specified ([GH 9046](https://github.com/pandas-dev/pandas/issues/9046), [GH 13828](https://github.com/pandas-dev/pandas/issues/13828)) +* Bug in output rendering of complex numbers showing too many trailing zeros ([GH 36799](https://github.com/pandas-dev/pandas/issues/36799)) +* Bug in `HDFStore` threw a `TypeError` when exporting an empty DataFrame with `datetime64[ns, tz]` dtypes with a fixed HDF5 store ([GH 20594](https://github.com/pandas-dev/pandas/issues/20594)) +* Bug in `HDFStore` was dropping time zone information when exporting a Series with `datetime64[ns, tz]` dtypes with a fixed HDF5 store ([GH 20594](https://github.com/pandas-dev/pandas/issues/20594)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") was closing user-provided binary file handles when `engine="c"` and an `encoding` was requested ([GH 36980](https://github.com/pandas-dev/pandas/issues/36980)) +* Bug in [`DataFrame.to_hdf()`](../reference/api/pandas.DataFrame.to_hdf.html#pandas.DataFrame.to_hdf "pandas.DataFrame.to_hdf") was not dropping missing rows with `dropna=True` ([GH 35719](https://github.com/pandas-dev/pandas/issues/35719)) +* Bug in [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") was raising a `TypeError` when supplying a `pathlib.Path` argument to the `io` parameter ([GH 37705](https://github.com/pandas-dev/pandas/issues/37705)) +* [`DataFrame.to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel"), [`Series.to_excel()`](../reference/api/pandas.Series.to_excel.html#pandas.Series.to_excel "pandas.Series.to_excel"), [`DataFrame.to_markdown()`](../reference/api/pandas.DataFrame.to_markdown.html#pandas.DataFrame.to_markdown "pandas.DataFrame.to_markdown"), and [`Series.to_markdown()`](../reference/api/pandas.Series.to_markdown.html#pandas.Series.to_markdown "pandas.Series.to_markdown") now support writing to fsspec URLs such as S3 and Google Cloud Storage ([GH 33987](https://github.com/pandas-dev/pandas/issues/33987)) +* Bug in [`read_fwf()`](../reference/api/pandas.read_fwf.html#pandas.read_fwf "pandas.read_fwf") with `skip_blank_lines=True` was not skipping blank lines ([GH 37758](https://github.com/pandas-dev/pandas/issues/37758)) +* Parse missing values using [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") with `dtype=False` to `NaN` instead of `None` ([GH 28501](https://github.com/pandas-dev/pandas/issues/28501)) +* [`read_fwf()`](../reference/api/pandas.read_fwf.html#pandas.read_fwf "pandas.read_fwf") was inferring compression with `compression=None` which was not consistent with the other `read_*` functions ([GH 37909](https://github.com/pandas-dev/pandas/issues/37909)) +* [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") was ignoring `formatters` argument for `ExtensionDtype` columns ([GH 36525](https://github.com/pandas-dev/pandas/issues/36525)) +* Bumped minimum xarray version to 0.12.3 to avoid reference to the removed `Panel` class ([GH 27101](https://github.com/pandas-dev/pandas/issues/27101), [GH 37983](https://github.com/pandas-dev/pandas/issues/37983)) +* [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") was re-opening file-like handles that also implement `os.PathLike` ([GH 38125](https://github.com/pandas-dev/pandas/issues/38125)) +* Bug in the conversion of a sliced `pyarrow.Table` with missing values to a DataFrame ([GH 38525](https://github.com/pandas-dev/pandas/issues/38525)) +* Bug in [`read_sql_table()`](../reference/api/pandas.read_sql_table.html#pandas.read_sql_table "pandas.read_sql_table") raising a `sqlalchemy.exc.OperationalError` when column names contained a percentage sign ([GH 37517](https://github.com/pandas-dev/pandas/issues/37517)) + +### Period[#](#period "Link to this heading") + +* Bug in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") and [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") where [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") dtypes would be converted to object dtypes ([GH 34871](https://github.com/pandas-dev/pandas/issues/34871)) + +### Plotting[#](#plotting "Link to this heading") + +* Bug in [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") was rotating xticklabels when `subplots=True`, even if the x-axis wasn’t an irregular time series ([GH 29460](https://github.com/pandas-dev/pandas/issues/29460)) +* Bug in [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") where a marker letter in the `style` keyword sometimes caused a `ValueError` ([GH 21003](https://github.com/pandas-dev/pandas/issues/21003)) +* Bug in [`DataFrame.plot.bar()`](../reference/api/pandas.DataFrame.plot.bar.html#pandas.DataFrame.plot.bar "pandas.DataFrame.plot.bar") and [`Series.plot.bar()`](../reference/api/pandas.Series.plot.bar.html#pandas.Series.plot.bar "pandas.Series.plot.bar") where ticks positions were assigned by value order instead of using the actual value for numeric or a smart ordering for string ([GH 26186](https://github.com/pandas-dev/pandas/issues/26186), [GH 11465](https://github.com/pandas-dev/pandas/issues/11465)). This fix has been reverted in pandas 1.2.1, see [What’s new in 1.2.1 (January 20, 2021)](v1.2.1.html) +* Twinned axes were losing their tick labels which should only happen to all but the last row or column of ‘externally’ shared axes ([GH 33819](https://github.com/pandas-dev/pandas/issues/33819)) +* Bug in [`Series.plot()`](../reference/api/pandas.Series.plot.html#pandas.Series.plot "pandas.Series.plot") and [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") was throwing a [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.13)") when the Series or DataFrame was + indexed by a [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") with a fixed frequency and the x-axis lower limit was greater than the upper limit ([GH 37454](https://github.com/pandas-dev/pandas/issues/37454)) +* Bug in [`DataFrameGroupBy.boxplot()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.boxplot.html#pandas.core.groupby.DataFrameGroupBy.boxplot "pandas.core.groupby.DataFrameGroupBy.boxplot") when `subplots=False` would raise a `KeyError` ([GH 16748](https://github.com/pandas-dev/pandas/issues/16748)) +* Bug in [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") and [`Series.plot()`](../reference/api/pandas.Series.plot.html#pandas.Series.plot "pandas.Series.plot") was overwriting matplotlib’s shared y axes behavior when no `sharey` parameter was passed ([GH 37942](https://github.com/pandas-dev/pandas/issues/37942)) +* Bug in [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") was raising a `TypeError` with `ExtensionDtype` columns ([GH 32073](https://github.com/pandas-dev/pandas/issues/32073)) + +### Styler[#](#styler "Link to this heading") + +* Bug in `Styler.render()` HTML was generated incorrectly because of formatting error in `rowspan` attribute, it now matches with w3 syntax ([GH 38234](https://github.com/pandas-dev/pandas/issues/38234)) + +### Groupby/resample/rolling[#](#groupby-resample-rolling "Link to this heading") + +* Bug in [`DataFrameGroupBy.count()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.count.html#pandas.core.groupby.DataFrameGroupBy.count "pandas.core.groupby.DataFrameGroupBy.count") and `SeriesGroupBy.sum()` returning `NaN` for missing categories when grouped on multiple `Categoricals`. Now returning `0` ([GH 35028](https://github.com/pandas-dev/pandas/issues/35028)) +* Bug in [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") that would sometimes throw an erroneous `ValueError` if the grouping axis had duplicate entries ([GH 16646](https://github.com/pandas-dev/pandas/issues/16646)) +* Bug in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") that would throw a `ValueError` when resampling from `"D"` to `"24H"` over a transition into daylight savings time (DST) ([GH 35219](https://github.com/pandas-dev/pandas/issues/35219)) +* Bug when combining methods [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") with [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") and [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") raising a `TypeError` ([GH 35325](https://github.com/pandas-dev/pandas/issues/35325)) +* Bug in [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") where a non-nuisance grouping column would be dropped from the output columns if another groupby method was called before `.apply` ([GH 34656](https://github.com/pandas-dev/pandas/issues/34656)) +* Bug when subsetting columns on a `DataFrameGroupBy` (e.g. `df.groupby('a')[['b']])`) would reset the attributes `axis`, `dropna`, `group_keys`, `level`, `mutated`, `sort`, and `squeeze` to their default values ([GH 9959](https://github.com/pandas-dev/pandas/issues/9959)) +* Bug in `DataFrameGroupBy.tshift()` failing to raise `ValueError` when a frequency cannot be inferred for the index of a group ([GH 35937](https://github.com/pandas-dev/pandas/issues/35937)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") does not always maintain column index name for `any`, `all`, `bfill`, `ffill`, `shift` ([GH 29764](https://github.com/pandas-dev/pandas/issues/29764)) +* Bug in [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") raising error with `np.nan` group(s) when `dropna=False` ([GH 35889](https://github.com/pandas-dev/pandas/issues/35889)) +* Bug in [`Rolling.sum()`](../reference/api/pandas.core.window.rolling.Rolling.sum.html#pandas.core.window.rolling.Rolling.sum "pandas.core.window.rolling.Rolling.sum") returned wrong values when dtypes where mixed between float and integer and `axis=1` ([GH 20649](https://github.com/pandas-dev/pandas/issues/20649), [GH 35596](https://github.com/pandas-dev/pandas/issues/35596)) +* Bug in [`Rolling.count()`](../reference/api/pandas.core.window.rolling.Rolling.count.html#pandas.core.window.rolling.Rolling.count "pandas.core.window.rolling.Rolling.count") returned `np.nan` with [`FixedForwardWindowIndexer`](../reference/api/pandas.api.indexers.FixedForwardWindowIndexer.html#pandas.api.indexers.FixedForwardWindowIndexer "pandas.api.indexers.FixedForwardWindowIndexer") as window, `min_periods=0` and only missing values in the window ([GH 35579](https://github.com/pandas-dev/pandas/issues/35579)) +* Bug where `Rolling` produces incorrect window sizes when using a `PeriodIndex` ([GH 34225](https://github.com/pandas-dev/pandas/issues/34225)) +* Bug in [`DataFrameGroupBy.ffill()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.ffill.html#pandas.core.groupby.DataFrameGroupBy.ffill "pandas.core.groupby.DataFrameGroupBy.ffill") and [`DataFrameGroupBy.bfill()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.bfill.html#pandas.core.groupby.DataFrameGroupBy.bfill "pandas.core.groupby.DataFrameGroupBy.bfill") where a `NaN` group would return filled values instead of `NaN` when `dropna=True` ([GH 34725](https://github.com/pandas-dev/pandas/issues/34725)) +* Bug in `RollingGroupby.count()` where a `ValueError` was raised when specifying the `closed` parameter ([GH 35869](https://github.com/pandas-dev/pandas/issues/35869)) +* Bug in [`DataFrameGroupBy.rolling()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.rolling.html#pandas.core.groupby.DataFrameGroupBy.rolling "pandas.core.groupby.DataFrameGroupBy.rolling") returning wrong values with partial centered window ([GH 36040](https://github.com/pandas-dev/pandas/issues/36040)) +* Bug in [`DataFrameGroupBy.rolling()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.rolling.html#pandas.core.groupby.DataFrameGroupBy.rolling "pandas.core.groupby.DataFrameGroupBy.rolling") returned wrong values with time aware window containing `NaN`. Raises `ValueError` because windows are not monotonic now ([GH 34617](https://github.com/pandas-dev/pandas/issues/34617)) +* Bug in `Rolling.__iter__()` where a `ValueError` was not raised when `min_periods` was larger than `window` ([GH 37156](https://github.com/pandas-dev/pandas/issues/37156)) +* Using [`Rolling.var()`](../reference/api/pandas.core.window.rolling.Rolling.var.html#pandas.core.window.rolling.Rolling.var "pandas.core.window.rolling.Rolling.var") instead of [`Rolling.std()`](../reference/api/pandas.core.window.rolling.Rolling.std.html#pandas.core.window.rolling.Rolling.std "pandas.core.window.rolling.Rolling.std") avoids numerical issues for [`Rolling.corr()`](../reference/api/pandas.core.window.rolling.Rolling.corr.html#pandas.core.window.rolling.Rolling.corr "pandas.core.window.rolling.Rolling.corr") when [`Rolling.var()`](../reference/api/pandas.core.window.rolling.Rolling.var.html#pandas.core.window.rolling.Rolling.var "pandas.core.window.rolling.Rolling.var") is still within floating point precision while [`Rolling.std()`](../reference/api/pandas.core.window.rolling.Rolling.std.html#pandas.core.window.rolling.Rolling.std "pandas.core.window.rolling.Rolling.std") is not ([GH 31286](https://github.com/pandas-dev/pandas/issues/31286)) +* Bug in [`DataFrameGroupBy.quantile()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.quantile.html#pandas.core.groupby.DataFrameGroupBy.quantile "pandas.core.groupby.DataFrameGroupBy.quantile") and [`Resampler.quantile()`](../reference/api/pandas.core.resample.Resampler.quantile.html#pandas.core.resample.Resampler.quantile "pandas.core.resample.Resampler.quantile") raised `TypeError` when values were of type `Timedelta` ([GH 29485](https://github.com/pandas-dev/pandas/issues/29485)) +* Bug in [`Rolling.median()`](../reference/api/pandas.core.window.rolling.Rolling.median.html#pandas.core.window.rolling.Rolling.median "pandas.core.window.rolling.Rolling.median") and [`Rolling.quantile()`](../reference/api/pandas.core.window.rolling.Rolling.quantile.html#pandas.core.window.rolling.Rolling.quantile "pandas.core.window.rolling.Rolling.quantile") returned wrong values for [`BaseIndexer`](../reference/api/pandas.api.indexers.BaseIndexer.html#pandas.api.indexers.BaseIndexer "pandas.api.indexers.BaseIndexer") subclasses with non-monotonic starting or ending points for windows ([GH 37153](https://github.com/pandas-dev/pandas/issues/37153)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") dropped `nan` groups from result with `dropna=False` when grouping over a single column ([GH 35646](https://github.com/pandas-dev/pandas/issues/35646), [GH 35542](https://github.com/pandas-dev/pandas/issues/35542)) +* Bug in [`DataFrameGroupBy.head()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.head.html#pandas.core.groupby.DataFrameGroupBy.head "pandas.core.groupby.DataFrameGroupBy.head"), `DataFrameGroupBy.tail()`, `SeriesGroupBy.head()`, and `SeriesGroupBy.tail()` would raise when used with `axis=1` ([GH 9772](https://github.com/pandas-dev/pandas/issues/9772)) +* Bug in [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") would raise when used with `axis=1` and a transformation kernel (e.g. “shift”) ([GH 36308](https://github.com/pandas-dev/pandas/issues/36308)) +* Bug in [`DataFrameGroupBy.resample()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.resample.html#pandas.core.groupby.DataFrameGroupBy.resample "pandas.core.groupby.DataFrameGroupBy.resample") using `.agg` with sum produced different result than just calling `.sum` ([GH 33548](https://github.com/pandas-dev/pandas/issues/33548)) +* Bug in [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") dropped values on `nan` group when returning the same axes with the original frame ([GH 38227](https://github.com/pandas-dev/pandas/issues/38227)) +* Bug in [`DataFrameGroupBy.quantile()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.quantile.html#pandas.core.groupby.DataFrameGroupBy.quantile "pandas.core.groupby.DataFrameGroupBy.quantile") couldn’t handle with arraylike `q` when grouping by columns ([GH 33795](https://github.com/pandas-dev/pandas/issues/33795)) +* Bug in `DataFrameGroupBy.rank()` with `datetime64tz` or period dtype incorrectly casting results to those dtypes instead of returning `float64` dtype ([GH 38187](https://github.com/pandas-dev/pandas/issues/38187)) + +### Reshaping[#](#reshaping "Link to this heading") + +* Bug in `DataFrame.crosstab()` was returning incorrect results on inputs with duplicate row names, duplicate column names or duplicate names between row and column labels ([GH 22529](https://github.com/pandas-dev/pandas/issues/22529)) +* Bug in [`DataFrame.pivot_table()`](../reference/api/pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table") with `aggfunc='count'` or `aggfunc='sum'` returning `NaN` for missing categories when pivoted on a `Categorical`. Now returning `0` ([GH 31422](https://github.com/pandas-dev/pandas/issues/31422)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor where input index names are not preserved in some cases ([GH 13475](https://github.com/pandas-dev/pandas/issues/13475)) +* Bug in func [`crosstab()`](../reference/api/pandas.crosstab.html#pandas.crosstab "pandas.crosstab") when using multiple columns with `margins=True` and `normalize=True` ([GH 35144](https://github.com/pandas-dev/pandas/issues/35144)) +* Bug in [`DataFrame.stack()`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack") where an empty DataFrame.stack would raise an error ([GH 36113](https://github.com/pandas-dev/pandas/issues/36113)). Now returning an empty Series with empty MultiIndex. +* Bug in [`Series.unstack()`](../reference/api/pandas.Series.unstack.html#pandas.Series.unstack "pandas.Series.unstack"). Now a Series with single level of Index trying to unstack would raise a `ValueError` ([GH 36113](https://github.com/pandas-dev/pandas/issues/36113)) +* Bug in [`DataFrame.agg()`](../reference/api/pandas.DataFrame.agg.html#pandas.DataFrame.agg "pandas.DataFrame.agg") with `func={'name':}` incorrectly raising `TypeError` when `DataFrame.columns==['Name']` ([GH 36212](https://github.com/pandas-dev/pandas/issues/36212)) +* Bug in [`Series.transform()`](../reference/api/pandas.Series.transform.html#pandas.Series.transform "pandas.Series.transform") would give incorrect results or raise when the argument `func` was a dictionary ([GH 35811](https://github.com/pandas-dev/pandas/issues/35811)) +* Bug in [`DataFrame.pivot()`](../reference/api/pandas.DataFrame.pivot.html#pandas.DataFrame.pivot "pandas.DataFrame.pivot") did not preserve [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") level names for columns when rows and columns are both multiindexed ([GH 36360](https://github.com/pandas-dev/pandas/issues/36360)) +* Bug in [`DataFrame.pivot()`](../reference/api/pandas.DataFrame.pivot.html#pandas.DataFrame.pivot "pandas.DataFrame.pivot") modified `index` argument when `columns` was passed but `values` was not ([GH 37635](https://github.com/pandas-dev/pandas/issues/37635)) +* Bug in [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") returned a non deterministic level-order for the resulting [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 36910](https://github.com/pandas-dev/pandas/issues/36910)) +* Bug in [`DataFrame.combine_first()`](../reference/api/pandas.DataFrame.combine_first.html#pandas.DataFrame.combine_first "pandas.DataFrame.combine_first") caused wrong alignment with dtype `string` and one level of `MultiIndex` containing only `NA` ([GH 37591](https://github.com/pandas-dev/pandas/issues/37591)) +* Fixed regression in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") on merging [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with empty DataFrame ([GH 36895](https://github.com/pandas-dev/pandas/issues/36895)) +* Bug in [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") not setting index of return value when `func` return type is `dict` ([GH 37544](https://github.com/pandas-dev/pandas/issues/37544)) +* Bug in [`DataFrame.merge()`](../reference/api/pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge") and [`pandas.merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") returning inconsistent ordering in result for `how=right` and `how=left` ([GH 35382](https://github.com/pandas-dev/pandas/issues/35382)) +* Bug in [`merge_ordered()`](../reference/api/pandas.merge_ordered.html#pandas.merge_ordered "pandas.merge_ordered") couldn’t handle list-like `left_by` or `right_by` ([GH 35269](https://github.com/pandas-dev/pandas/issues/35269)) +* Bug in [`merge_ordered()`](../reference/api/pandas.merge_ordered.html#pandas.merge_ordered "pandas.merge_ordered") returned wrong join result when length of `left_by` or `right_by` equals to the rows of `left` or `right` ([GH 38166](https://github.com/pandas-dev/pandas/issues/38166)) +* Bug in [`merge_ordered()`](../reference/api/pandas.merge_ordered.html#pandas.merge_ordered "pandas.merge_ordered") didn’t raise when elements in `left_by` or `right_by` not exist in `left` columns or `right` columns ([GH 38167](https://github.com/pandas-dev/pandas/issues/38167)) +* Bug in [`DataFrame.drop_duplicates()`](../reference/api/pandas.DataFrame.drop_duplicates.html#pandas.DataFrame.drop_duplicates "pandas.DataFrame.drop_duplicates") not validating bool dtype for `ignore_index` keyword ([GH 38274](https://github.com/pandas-dev/pandas/issues/38274)) + +### ExtensionArray[#](#extensionarray "Link to this heading") + +* Fixed bug where [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") column set to scalar extension type via a dict instantiation was considered an object type rather than the extension type ([GH 35965](https://github.com/pandas-dev/pandas/issues/35965)) +* Fixed bug where `astype()` with equal dtype and `copy=False` would return a new object ([GH 28488](https://github.com/pandas-dev/pandas/issues/28488)) +* Fixed bug when applying a NumPy ufunc with multiple outputs to an [`IntegerArray`](../reference/api/pandas.arrays.IntegerArray.html#pandas.arrays.IntegerArray "pandas.arrays.IntegerArray") returning `None` ([GH 36913](https://github.com/pandas-dev/pandas/issues/36913)) +* Fixed an inconsistency in [`PeriodArray`](../reference/api/pandas.arrays.PeriodArray.html#pandas.arrays.PeriodArray "pandas.arrays.PeriodArray")’s `__init__` signature to those of [`DatetimeArray`](../reference/api/pandas.arrays.DatetimeArray.html#pandas.arrays.DatetimeArray "pandas.arrays.DatetimeArray") and [`TimedeltaArray`](../reference/api/pandas.arrays.TimedeltaArray.html#pandas.arrays.TimedeltaArray "pandas.arrays.TimedeltaArray") ([GH 37289](https://github.com/pandas-dev/pandas/issues/37289)) +* Reductions for [`BooleanArray`](../reference/api/pandas.arrays.BooleanArray.html#pandas.arrays.BooleanArray "pandas.arrays.BooleanArray"), [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical"), [`DatetimeArray`](../reference/api/pandas.arrays.DatetimeArray.html#pandas.arrays.DatetimeArray "pandas.arrays.DatetimeArray"), [`FloatingArray`](../reference/api/pandas.arrays.FloatingArray.html#pandas.arrays.FloatingArray "pandas.arrays.FloatingArray"), [`IntegerArray`](../reference/api/pandas.arrays.IntegerArray.html#pandas.arrays.IntegerArray "pandas.arrays.IntegerArray"), [`PeriodArray`](../reference/api/pandas.arrays.PeriodArray.html#pandas.arrays.PeriodArray "pandas.arrays.PeriodArray"), [`TimedeltaArray`](../reference/api/pandas.arrays.TimedeltaArray.html#pandas.arrays.TimedeltaArray "pandas.arrays.TimedeltaArray"), and `PandasArray` are now keyword-only methods ([GH 37541](https://github.com/pandas-dev/pandas/issues/37541)) +* Fixed a bug where a `TypeError` was wrongly raised if a membership check was made on an `ExtensionArray` containing nan-like values ([GH 37867](https://github.com/pandas-dev/pandas/issues/37867)) + +### Other[#](#other "Link to this heading") + +* Bug in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") and [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") incorrectly raising an `AssertionError` instead of a `ValueError` when invalid parameter combinations are passed ([GH 36045](https://github.com/pandas-dev/pandas/issues/36045)) +* Bug in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") and [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") with numeric values and string `to_replace` ([GH 34789](https://github.com/pandas-dev/pandas/issues/34789)) +* Fixed metadata propagation in [`Series.abs()`](../reference/api/pandas.Series.abs.html#pandas.Series.abs "pandas.Series.abs") and ufuncs called on Series and DataFrames ([GH 28283](https://github.com/pandas-dev/pandas/issues/28283)) +* Bug in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") and [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") incorrectly casting from `PeriodDtype` to object dtype ([GH 34871](https://github.com/pandas-dev/pandas/issues/34871)) +* Fixed bug in metadata propagation incorrectly copying DataFrame columns as metadata when the column name overlaps with the metadata name ([GH 37037](https://github.com/pandas-dev/pandas/issues/37037)) +* Fixed metadata propagation in the [`Series.dt`](../reference/api/pandas.Series.dt.html#pandas.Series.dt "pandas.Series.dt"), [`Series.str`](../reference/api/pandas.Series.str.html#pandas.Series.str "pandas.Series.str") accessors, [`DataFrame.duplicated`](../reference/api/pandas.DataFrame.duplicated.html#pandas.DataFrame.duplicated "pandas.DataFrame.duplicated"), [`DataFrame.stack`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack"), [`DataFrame.unstack`](../reference/api/pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack"), [`DataFrame.pivot`](../reference/api/pandas.DataFrame.pivot.html#pandas.DataFrame.pivot "pandas.DataFrame.pivot"), `DataFrame.append`, [`DataFrame.diff`](../reference/api/pandas.DataFrame.diff.html#pandas.DataFrame.diff "pandas.DataFrame.diff"), [`DataFrame.applymap`](../reference/api/pandas.DataFrame.applymap.html#pandas.DataFrame.applymap "pandas.DataFrame.applymap") and [`DataFrame.update`](../reference/api/pandas.DataFrame.update.html#pandas.DataFrame.update "pandas.DataFrame.update") methods ([GH 28283](https://github.com/pandas-dev/pandas/issues/28283), [GH 37381](https://github.com/pandas-dev/pandas/issues/37381)) +* Fixed metadata propagation when selecting columns with `DataFrame.__getitem__` ([GH 28283](https://github.com/pandas-dev/pandas/issues/28283)) +* Bug in [`Index.intersection()`](../reference/api/pandas.Index.intersection.html#pandas.Index.intersection "pandas.Index.intersection") with non-[`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") failing to set the correct name on the returned [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") ([GH 38111](https://github.com/pandas-dev/pandas/issues/38111)) +* Bug in `RangeIndex.intersection()` failing to set the correct name on the returned [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") in some corner cases ([GH 38197](https://github.com/pandas-dev/pandas/issues/38197)) +* Bug in [`Index.difference()`](../reference/api/pandas.Index.difference.html#pandas.Index.difference "pandas.Index.difference") failing to set the correct name on the returned [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") in some corner cases ([GH 38268](https://github.com/pandas-dev/pandas/issues/38268)) +* Bug in [`Index.union()`](../reference/api/pandas.Index.union.html#pandas.Index.union "pandas.Index.union") behaving differently depending on whether operand is an [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") or other list-like ([GH 36384](https://github.com/pandas-dev/pandas/issues/36384)) +* Bug in [`Index.intersection()`](../reference/api/pandas.Index.intersection.html#pandas.Index.intersection "pandas.Index.intersection") with non-matching numeric dtypes casting to `object` dtype instead of minimal common dtype ([GH 38122](https://github.com/pandas-dev/pandas/issues/38122)) +* Bug in `IntervalIndex.union()` returning an incorrectly-typed [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") when empty ([GH 38282](https://github.com/pandas-dev/pandas/issues/38282)) +* Passing an array with 2 or more dimensions to the [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructor now raises the more specific `ValueError` rather than a bare `Exception` ([GH 35744](https://github.com/pandas-dev/pandas/issues/35744)) +* Bug in `dir` where `dir(obj)` wouldn’t show attributes defined on the instance for pandas objects ([GH 37173](https://github.com/pandas-dev/pandas/issues/37173)) +* Bug in [`Index.drop()`](../reference/api/pandas.Index.drop.html#pandas.Index.drop "pandas.Index.drop") raising `InvalidIndexError` when index has duplicates ([GH 38051](https://github.com/pandas-dev/pandas/issues/38051)) +* Bug in `RangeIndex.difference()` returning `Int64Index` in some cases where it should return [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") ([GH 38028](https://github.com/pandas-dev/pandas/issues/38028)) +* Fixed bug in `assert_series_equal()` when comparing a datetime-like array with an equivalent non extension dtype array ([GH 37609](https://github.com/pandas-dev/pandas/issues/37609)) +* Bug in [`is_bool_dtype()`](../reference/api/pandas.api.types.is_bool_dtype.html#pandas.api.types.is_bool_dtype "pandas.api.types.is_bool_dtype") would raise when passed a valid string such as `"boolean"` ([GH 38386](https://github.com/pandas-dev/pandas/issues/38386)) +* Fixed regression in logical operators raising `ValueError` when columns of [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") are a [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") with unused categories ([GH 38367](https://github.com/pandas-dev/pandas/issues/38367)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 257 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* 21CSM + +* AbdulMAbdi + +* Abhiraj Hinge + +* Abhishek Mangla + +* Abo7atm + +* Adam Spannbauer + +* Albert Villanova del Moral +* Alex Kirko +* Alex Lim + +* Alex Thorne + +* Aleš Erjavec + +* Ali McMaster +* Amanda Dsouza + +* Amim Knabben + +* Andrew Wieteska +* Anshoo Rajput + +* Anthony Milbourne +* Arun12121 + +* Asish Mahapatra +* Avinash Pancham + +* BeanNan + +* Ben Forbes + +* Brendan Wilby + +* Bruno Almeida + +* Byron Boulton + +* Chankey Pathak +* Chris Barnes + +* Chris Lynch + +* Chris Withers +* Christoph Deil + +* Christopher Hadley + +* Chuanzhu Xu +* Coelhudo + +* Dan Moore +* Daniel Saxton +* David Kwong + +* David Li + +* David Mrva + +* Deepak Pandey + +* Deepyaman Datta +* Devin Petersohn +* Dmitriy Perepelkin + +* Douglas Hanley + +* Dāgs Grīnbergs + +* Eli Treuherz + +* Elliot Rampono + +* Erfan Nariman +* Eric Goddard +* Eric Leung + +* Eric Wieser +* Ethan Chen + +* Eve + +* Eyal Trabelsi + +* Fabian Gebhart + +* Fangchen Li +* Felix Claessen + +* Finlay Maguire + +* Florian Roscheck + +* Gabriel Monteiro +* Gautham + +* Gerard Jorgensen + +* Gregory Livschitz +* Hans +* Harsh Sharma +* Honfung Wong + +* Igor Gotlibovych + +* Iqrar Agalosi Nureyza +* Irv Lustig +* Isaac Virshup +* Jacob Peacock +* Jacob Stevens-Haas + +* Jan Müller + +* Janus +* Jeet Parekh +* Jeff Hernandez + +* Jeff Reback +* Jiaxiang +* Joao Pedro Berno Zanutto + +* Joel Nothman +* Joel Whittier + +* John Karasinski + +* John McGuigan + +* Johnny Pribyl + +* Jonas Laursen + +* Jonathan Shreckengost + +* Joris Van den Bossche +* Jose + +* JoseNavy + +* Josh Temple + +* Jun Kudo + +* Justin Essert +* Justin Sexton + +* Kaiqi Dong +* Kamil Trocewicz + +* Karthik Mathur +* Kashif + +* Kenny Huynh +* Kevin Sheppard +* Kumar Shivam + +* Leonardus Chen + +* Levi Matus + +* Lucas Rodés-Guirao + +* Luis Pinto + +* Lynch + +* Marc Garcia +* Marco Gorelli +* Maria-Alexandra Ilie + +* Marian Denes +* Mark Graham + +* Martin Durant +* Matt Roeschke +* Matthew Roeschke +* Matthias Bussonnier +* Maxim Ivanov + +* Mayank Chaudhary + +* MeeseeksMachine +* Meghana Varanasi + +* Metehan Kutlu + +* Micael Jarniac + +* Micah Smith + +* Michael Marino +* Miroslav Šedivý +* Mohammad Jafar Mashhadi +* Mohammed Kashif + +* Nagesh Kumar C + +* Nidhi Zare + +* Nikhil Choudhary + +* Number42 +* Oleh Kozynets + +* OlivierLuG +* Pandas Development Team +* Paolo Lammens + +* Paul Ganssle +* Pax + +* Peter Liu + +* Philip Cerles + +* Pranjal Bhardwaj + +* Prayag Savsani + +* Purushothaman Srikanth + +* Qbiwan + +* Rahul Chauhan + +* Rahul Sathanapalli + +* Rajat Bishnoi + +* Ray Bell +* Reshama Shaikh + +* Richard Shadrach +* Robert Bradshaw +* Robert de Vries +* Rohith295 +* S Mono + +* S.TAKENO + +* Sahid Velji + +* Sam Cohen + +* Sam Ezebunandu + +* Sander + +* Sarthak + +* Sarthak Vineet Kumar + +* Satrio H Wicaksono + +* Scott Lasley +* Shao Yang Hong + +* Sharon Woo + +* Shubham Mehra + +* Simon Hawkins +* Sixuan (Cherie) Wu + +* Souris Ash + +* Steffen Rehberg +* Suvayu Ali +* Sven +* SylvainLan + +* T. JEGHAM + +* Terji Petersen +* Thomas Dickson + +* Thomas Heavey + +* Thomas Smith +* Tobias Pitters +* Tom Augspurger +* Tomasz Sakrejda + +* Torsten Wörtwein + +* Ty Mick + +* UrielMaD + +* Uwe L. Korn +* Vikramaditya Gaonkar + +* VirosaLi + +* W.R + +* Warren White + +* Wesley Boelrijk + +* William Ayd +* Yanxian Lin + +* Yassir Karroum + +* Yong Kai Yi + +* Yuanhao Geng + +* Yury Mikhaylov + +* Yutaro Ikeda +* Yuya Takashina + +* Zach Brookler + +* Zak Kohler + +* ZhihuiChen0903 + +* abmyii +* alexhtn + +* asharma13524 + +* attack68 +* beanan + +* chinhwee +* cleconte987 +* danchev + +* ebardie + +* edwardkong +* elliot rampono + +* estasney + +* gabicca +* geetha-rangaswamaiah + +* gfyoung +* guru kiran +* hardikpnsp + +* icanhazcodeplz + +* ivanovmg + +* jbrockmendel +* jeschwar +* jnecus +* joooeey + +* junk + +* krajatcl + +* lacrosse91 + +* leo + +* lpkirwin + +* lrjball +* lucasrodes + +* ma3da + +* mavismonica + +* mlondschien + +* mzeitlin11 + +* nguevara + +* nrebena +* parkdj1 + +* partev +* patrick +* realead +* rxxg + +* samilAyoub + +* sanderland +* shawnbrown +* sm1899 + +* smartvinnetou +* ssortman + +* steveya + +* taytzehao + +* tiagohonorato + +* timhunderwood +* tkmz-n + +* tnwei + +* tpanza + +* vineethraj510 + +* vmdhhh + +* xinrong-databricks + +* yonas kassa + +* yonashub + +* Ádám Lippai + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.2.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.2.1.md new file mode 100644 index 0000000000000000000000000000000000000000..2574c8dbc7938086a2b2b6c957ad965608df2a18 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.2.1.md @@ -0,0 +1,150 @@ +# What's new in pandas 1.2.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.2.1.html + +# What’s new in 1.2.1 (January 20, 2021)[#](#what-s-new-in-1-2-1-january-20-2021 "Link to this heading") + +These are the changes in pandas 1.2.1. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in [`to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") that created corrupted zip files when there were more rows than `chunksize` ([GH 38714](https://github.com/pandas-dev/pandas/issues/38714)) +* Fixed regression in [`to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") opening `codecs.StreamReaderWriter` in binary mode instead of in text mode ([GH 39247](https://github.com/pandas-dev/pandas/issues/39247)) +* Fixed regression in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") and other read functions were the encoding error policy (`errors`) did not default to `"replace"` when no encoding was specified ([GH 38989](https://github.com/pandas-dev/pandas/issues/38989)) +* Fixed regression in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") with non-rawbyte file handles ([GH 38788](https://github.com/pandas-dev/pandas/issues/38788)) +* Fixed regression in [`DataFrame.to_stata()`](../reference/api/pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata") not removing the created file when an error occurred ([GH 39202](https://github.com/pandas-dev/pandas/issues/39202)) +* Fixed regression in `DataFrame.__setitem__` raising `ValueError` when expanding [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and new column is from type `"0 - name"` ([GH 39010](https://github.com/pandas-dev/pandas/issues/39010)) +* Fixed regression in setting with [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") raising `ValueError` when [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") has unsorted [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") columns and indexer is a scalar ([GH 38601](https://github.com/pandas-dev/pandas/issues/38601)) +* Fixed regression in setting with [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") raising `KeyError` with [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") and list-like columns indexer enlarging [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 39147](https://github.com/pandas-dev/pandas/issues/39147)) +* Fixed regression in [`groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") with [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") grouping column not showing unused categories for `grouped.indices` ([GH 38642](https://github.com/pandas-dev/pandas/issues/38642)) +* Fixed regression in [`DataFrameGroupBy.sem()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.sem.html#pandas.core.groupby.DataFrameGroupBy.sem "pandas.core.groupby.DataFrameGroupBy.sem") and [`SeriesGroupBy.sem()`](../reference/api/pandas.core.groupby.SeriesGroupBy.sem.html#pandas.core.groupby.SeriesGroupBy.sem "pandas.core.groupby.SeriesGroupBy.sem") where the presence of non-numeric columns would cause an error instead of being dropped ([GH 38774](https://github.com/pandas-dev/pandas/issues/38774)) +* Fixed regression in [`DataFrameGroupBy.diff()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.diff.html#pandas.core.groupby.DataFrameGroupBy.diff "pandas.core.groupby.DataFrameGroupBy.diff") raising for `int8` and `int16` columns ([GH 39050](https://github.com/pandas-dev/pandas/issues/39050)) +* Fixed regression in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") when aggregating an `ExtensionDType` that could fail for non-numeric values ([GH 38980](https://github.com/pandas-dev/pandas/issues/38980)) +* Fixed regression in [`Rolling.skew()`](../reference/api/pandas.core.window.rolling.Rolling.skew.html#pandas.core.window.rolling.Rolling.skew "pandas.core.window.rolling.Rolling.skew") and [`Rolling.kurt()`](../reference/api/pandas.core.window.rolling.Rolling.kurt.html#pandas.core.window.rolling.Rolling.kurt "pandas.core.window.rolling.Rolling.kurt") modifying the object inplace ([GH 38908](https://github.com/pandas-dev/pandas/issues/38908)) +* Fixed regression in [`DataFrame.any()`](../reference/api/pandas.DataFrame.any.html#pandas.DataFrame.any "pandas.DataFrame.any") and [`DataFrame.all()`](../reference/api/pandas.DataFrame.all.html#pandas.DataFrame.all "pandas.DataFrame.all") not returning a result for tz-aware `datetime64` columns ([GH 38723](https://github.com/pandas-dev/pandas/issues/38723)) +* Fixed regression in [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") with `axis=1` using str accessor in apply function ([GH 38979](https://github.com/pandas-dev/pandas/issues/38979)) +* Fixed regression in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") raising `ValueError` when [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") has dtype `bytes` ([GH 38900](https://github.com/pandas-dev/pandas/issues/38900)) +* Fixed regression in [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") that raised `RecursionError` with `datetime64[ns, UTC]` dtype ([GH 38851](https://github.com/pandas-dev/pandas/issues/38851)) +* Fixed regression in comparisons between `NaT` and `datetime.date` objects incorrectly returning `True` ([GH 39151](https://github.com/pandas-dev/pandas/issues/39151)) +* Fixed regression in calling NumPy `accumulate()` ufuncs on DataFrames, e.g. `np.maximum.accumulate(df)` ([GH 39259](https://github.com/pandas-dev/pandas/issues/39259)) +* Fixed regression in repr of float-like strings of an `object` dtype having trailing 0’s truncated after the decimal ([GH 38708](https://github.com/pandas-dev/pandas/issues/38708)) +* Fixed regression that raised `AttributeError` with PyArrow versions [0.16.0, 1.0.0) ([GH 38801](https://github.com/pandas-dev/pandas/issues/38801)) +* Fixed regression in [`pandas.testing.assert_frame_equal()`](../reference/api/pandas.testing.assert_frame_equal.html#pandas.testing.assert_frame_equal "pandas.testing.assert_frame_equal") raising `TypeError` with `check_like=True` when [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") or columns have mixed dtype ([GH 39168](https://github.com/pandas-dev/pandas/issues/39168)) + +We have reverted a commit that resulted in several plotting related regressions in pandas 1.2.0 ([GH 38969](https://github.com/pandas-dev/pandas/issues/38969), [GH 38736](https://github.com/pandas-dev/pandas/issues/38736), [GH 38865](https://github.com/pandas-dev/pandas/issues/38865), [GH 38947](https://github.com/pandas-dev/pandas/issues/38947) and [GH 39126](https://github.com/pandas-dev/pandas/issues/39126)). +As a result, bugs reported as fixed in pandas 1.2.0 related to inconsistent tick labeling in bar plots are again present ([GH 26186](https://github.com/pandas-dev/pandas/issues/26186) and [GH 11465](https://github.com/pandas-dev/pandas/issues/11465)) + +## Calling NumPy ufuncs on non-aligned DataFrames[#](#calling-numpy-ufuncs-on-non-aligned-dataframes "Link to this heading") + +Before pandas 1.2.0, calling a NumPy ufunc on non-aligned DataFrames (or +DataFrame / Series combination) would ignore the indices, only match +the inputs by shape, and use the index/columns of the first DataFrame for +the result: + +```None +In [1]: df1 = pd.DataFrame({"a": [1, 2], "b": [3, 4]}, index=[0, 1]) +In [2]: df2 = pd.DataFrame({"a": [1, 2], "b": [3, 4]}, index=[1, 2]) +In [3]: df1 +Out[3]: + a b +0 1 3 +1 2 4 +In [4]: df2 +Out[4]: + a b +1 1 3 +2 2 4 + +In [5]: np.add(df1, df2) +Out[5]: + a b +0 2 6 +1 4 8 +``` + +This contrasts with how other pandas operations work, which first align +the inputs: + +```None +In [6]: df1 + df2 +Out[6]: + a b +0 NaN NaN +1 3.0 7.0 +2 NaN NaN +``` + +In pandas 1.2.0, we refactored how NumPy ufuncs are called on DataFrames, and +this started to align the inputs first ([GH 39184](https://github.com/pandas-dev/pandas/issues/39184)), as happens in other +pandas operations and as it happens for ufuncs called on Series objects. + +For pandas 1.2.1, we restored the previous behaviour to avoid a breaking +change, but the above example of `np.add(df1, df2)` with non-aligned inputs +will now to raise a warning, and a future pandas 2.0 release will start +aligning the inputs first ([GH 39184](https://github.com/pandas-dev/pandas/issues/39184)). Calling a NumPy ufunc on Series +objects (eg `np.add(s1, s2)`) already aligns and continues to do so. + +To avoid the warning and keep the current behaviour of ignoring the indices, +convert one of the arguments to a NumPy array: + +```None +In [7]: np.add(df1, np.asarray(df2)) +Out[7]: + a b +0 2 6 +1 4 8 +``` + +To obtain the future behaviour and silence the warning, you can align manually +before passing the arguments to the ufunc: + +```None +In [8]: df1, df2 = df1.align(df2) +In [9]: np.add(df1, df2) +Out[9]: + a b +0 NaN NaN +1 3.0 7.0 +2 NaN NaN +``` + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") with `float_precision="high"` caused segfault or wrong parsing of long exponent strings. This resulted in a regression in some cases as the default for `float_precision` was changed in pandas 1.2.0 ([GH 38753](https://github.com/pandas-dev/pandas/issues/38753)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") not closing an opened file handle when a `csv.Error` or `UnicodeDecodeError` occurred while initializing ([GH 39024](https://github.com/pandas-dev/pandas/issues/39024)) +* Bug in [`pandas.testing.assert_index_equal()`](../reference/api/pandas.testing.assert_index_equal.html#pandas.testing.assert_index_equal "pandas.testing.assert_index_equal") raising `TypeError` with `check_order=False` when [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") has mixed dtype ([GH 39168](https://github.com/pandas-dev/pandas/issues/39168)) + +## Other[#](#other "Link to this heading") + +* The deprecated attributes `_AXIS_NAMES` and `_AXIS_NUMBERS` of [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") will no longer show up in `dir` or `inspect.getmembers` calls ([GH 38740](https://github.com/pandas-dev/pandas/issues/38740)) +* Bumped minimum fastparquet version to 0.4.0 to avoid `AttributeError` from numba ([GH 38344](https://github.com/pandas-dev/pandas/issues/38344)) +* Bumped minimum pymysql version to 0.8.1 to avoid test failures ([GH 38344](https://github.com/pandas-dev/pandas/issues/38344)) +* Fixed build failure on MacOS 11 in Python 3.9.1 ([GH 38766](https://github.com/pandas-dev/pandas/issues/38766)) +* Added reference to backwards incompatible `check_freq` arg of [`testing.assert_frame_equal()`](../reference/api/pandas.testing.assert_frame_equal.html#pandas.testing.assert_frame_equal "pandas.testing.assert_frame_equal") and [`testing.assert_series_equal()`](../reference/api/pandas.testing.assert_series_equal.html#pandas.testing.assert_series_equal "pandas.testing.assert_series_equal") in [pandas 1.1.0 what’s new](v1.1.0.html#whatsnew-110-api-breaking-testing-check-freq) ([GH 34050](https://github.com/pandas-dev/pandas/issues/34050)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 20 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Ada Draginda + +* Andrew Wieteska +* Bryan Cutler +* Fangchen Li +* Joris Van den Bossche +* Matthew Roeschke +* Matthew Zeitlin + +* MeeseeksMachine +* Micael Jarniac +* Omar Afifi + +* Pandas Development Team +* Richard Shadrach +* Simon Hawkins +* Terji Petersen +* Torsten Wörtwein +* WANG Aiyong +* jbrockmendel +* kylekeppler +* mzeitlin11 +* patrick diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.2.2.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.2.2.md new file mode 100644 index 0000000000000000000000000000000000000000..f35cc7b2d792c65fae56f7cfcee51be82db98197 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.2.2.md @@ -0,0 +1,49 @@ +# What's new in pandas 1.2.2 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.2.2.html + +# What’s new in 1.2.2 (February 09, 2021)[#](#what-s-new-in-1-2-2-february-09-2021 "Link to this heading") + +These are the changes in pandas 1.2.2. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") that caused it to raise `AttributeError` when checking version of older xlrd versions ([GH 38955](https://github.com/pandas-dev/pandas/issues/38955)) +* Fixed regression in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor reordering element when construction from datetime ndarray with dtype not `"datetime64[ns]"` ([GH 39422](https://github.com/pandas-dev/pandas/issues/39422)) +* Fixed regression in [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") and [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") not casting to bytes dtype ([GH 39474](https://github.com/pandas-dev/pandas/issues/39474)) +* Fixed regression in [`to_pickle()`](../reference/api/pandas.DataFrame.to_pickle.html#pandas.DataFrame.to_pickle "pandas.DataFrame.to_pickle") failing to create bz2/xz compressed pickle files with `protocol=5` ([GH 39002](https://github.com/pandas-dev/pandas/issues/39002)) +* Fixed regression in [`pandas.testing.assert_series_equal()`](../reference/api/pandas.testing.assert_series_equal.html#pandas.testing.assert_series_equal "pandas.testing.assert_series_equal") and [`pandas.testing.assert_frame_equal()`](../reference/api/pandas.testing.assert_frame_equal.html#pandas.testing.assert_frame_equal "pandas.testing.assert_frame_equal") always raising `AssertionError` when comparing extension dtypes ([GH 39410](https://github.com/pandas-dev/pandas/issues/39410)) +* Fixed regression in [`to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") opening `codecs.StreamWriter` in binary mode instead of in text mode and ignoring user-provided `mode` ([GH 39247](https://github.com/pandas-dev/pandas/issues/39247)) +* Fixed regression in `Categorical.astype()` casting to incorrect dtype when `np.int32` is passed to dtype argument ([GH 39402](https://github.com/pandas-dev/pandas/issues/39402)) +* Fixed regression in [`to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel") creating corrupt files when appending (`mode="a"`) to an existing file ([GH 39576](https://github.com/pandas-dev/pandas/issues/39576)) +* Fixed regression in [`DataFrame.transform()`](../reference/api/pandas.DataFrame.transform.html#pandas.DataFrame.transform "pandas.DataFrame.transform") failing in case of an empty DataFrame or Series ([GH 39636](https://github.com/pandas-dev/pandas/issues/39636)) +* Fixed regression in [`groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") or [`resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") when aggregating an all-NaN or numeric object dtype column ([GH 39329](https://github.com/pandas-dev/pandas/issues/39329)) +* Fixed regression in [`Rolling.count()`](../reference/api/pandas.core.window.rolling.Rolling.count.html#pandas.core.window.rolling.Rolling.count "pandas.core.window.rolling.Rolling.count") where the `min_periods` argument would be set to `0` after the operation ([GH 39554](https://github.com/pandas-dev/pandas/issues/39554)) +* Fixed regression in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") that incorrectly raised when the argument `io` was a non-path and non-buffer and the `engine` argument was specified ([GH 39528](https://github.com/pandas-dev/pandas/issues/39528)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* [`pandas.read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") error message when a specified `sheetname` does not exist is now uniform across engines ([GH 39250](https://github.com/pandas-dev/pandas/issues/39250)) +* Fixed bug in [`pandas.read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") producing incorrect results when the engine `openpyxl` is used and the excel file is missing or has incorrect dimension information; the fix requires `openpyxl` >= 3.0.0, prior versions may still fail ([GH 38956](https://github.com/pandas-dev/pandas/issues/38956), [GH 39001](https://github.com/pandas-dev/pandas/issues/39001)) +* Fixed bug in [`pandas.read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") sometimes producing a `DataFrame` with trailing rows of `np.nan` when the engine `openpyxl` is used ([GH 39181](https://github.com/pandas-dev/pandas/issues/39181)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 14 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Andrew Wieteska +* Erfan Nariman +* Joris Van den Bossche +* Matthew Roeschke +* MeeseeksMachine +* Pandas Development Team +* Pav A +* Richard Shadrach +* Simon Hawkins +* Thomas Li +* Torsten Wörtwein +* Vladimir Podolskiy + +* jbrockmendel +* patrick diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.2.3.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.2.3.md new file mode 100644 index 0000000000000000000000000000000000000000..0dca2807b16b1d5ebc91a583b98224619cbc3d70 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.2.3.md @@ -0,0 +1,37 @@ +# What's new in pandas 1.2.3 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.2.3.html + +# What’s new in 1.2.3 (March 02, 2021)[#](#what-s-new-in-1-2-3-march-02-2021 "Link to this heading") + +These are the changes in pandas 1.2.3. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in [`to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel") raising `KeyError` when giving duplicate columns with `columns` attribute ([GH 39695](https://github.com/pandas-dev/pandas/issues/39695)) +* Fixed regression in nullable integer unary ops propagating mask on assignment ([GH 39943](https://github.com/pandas-dev/pandas/issues/39943)) +* Fixed regression in `DataFrame.__setitem__()` not aligning [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") on right-hand side for boolean indexer ([GH 39931](https://github.com/pandas-dev/pandas/issues/39931)) +* Fixed regression in [`to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") failing to use `compression` with URL-like paths that are internally opened in binary mode or with user-provided file objects that are opened in binary mode ([GH 39985](https://github.com/pandas-dev/pandas/issues/39985)) +* Fixed regression in [`Series.sort_index()`](../reference/api/pandas.Series.sort_index.html#pandas.Series.sort_index "pandas.Series.sort_index") and [`DataFrame.sort_index()`](../reference/api/pandas.DataFrame.sort_index.html#pandas.DataFrame.sort_index "pandas.DataFrame.sort_index"), which exited with an ungraceful error when having kwarg `ascending=None` passed. Passing `ascending=None` is still considered invalid, and the improved error message suggests a proper usage (`ascending` must be a boolean or a list-like of boolean) ([GH 39434](https://github.com/pandas-dev/pandas/issues/39434)) +* Fixed regression in [`DataFrame.transform()`](../reference/api/pandas.DataFrame.transform.html#pandas.DataFrame.transform "pandas.DataFrame.transform") and [`Series.transform()`](../reference/api/pandas.Series.transform.html#pandas.Series.transform "pandas.Series.transform") giving incorrect column labels when passed a dictionary with a mix of list and non-list values ([GH 40018](https://github.com/pandas-dev/pandas/issues/40018)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 14 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Daniel Saxton +* Dylan Percy + +* Jody Klymak + +* Maxim Ivanov +* MeeseeksMachine +* Pandas Development Team +* Richard Shadrach +* Rohit Gupta + +* Simon Hawkins +* Torsten Wörtwein +* jbrockmendel +* morrme + +* partev +* patrick diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.2.4.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.2.4.md new file mode 100644 index 0000000000000000000000000000000000000000..adb53d26354be2f2f7b476d86a13557274616524 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.2.4.md @@ -0,0 +1,33 @@ +# What's new in pandas 1.2.4 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.2.4.html + +# What’s new in 1.2.4 (April 12, 2021)[#](#what-s-new-in-1-2-4-april-12-2021 "Link to this heading") + +These are the changes in pandas 1.2.4. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in [`DataFrame.sum()`](../reference/api/pandas.DataFrame.sum.html#pandas.DataFrame.sum "pandas.DataFrame.sum") when `min_count` greater than the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") shape was passed resulted in a `ValueError` ([GH 39738](https://github.com/pandas-dev/pandas/issues/39738)) +* Fixed regression in [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") raising `AttributeError` when run on PyPy ([GH 39837](https://github.com/pandas-dev/pandas/issues/39837)) +* Fixed regression in (in)equality comparison of `pd.NaT` with a non-datetimelike numpy array returning a scalar instead of an array ([GH 40722](https://github.com/pandas-dev/pandas/issues/40722)) +* Fixed regression in [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where") not returning a copy in the case of an all True condition ([GH 39595](https://github.com/pandas-dev/pandas/issues/39595)) +* Fixed regression in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") raising `IndexError` when `regex` was a multi-key dictionary ([GH 39338](https://github.com/pandas-dev/pandas/issues/39338)) +* Fixed regression in repr of floats in an `object` column not respecting `float_format` when printed in the console or outputted through [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string"), [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html"), and [`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex") ([GH 40024](https://github.com/pandas-dev/pandas/issues/40024)) +* Fixed regression in NumPy ufuncs such as `np.add` not passing through all arguments for [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 40662](https://github.com/pandas-dev/pandas/issues/40662)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 9 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Fangchen Li +* Joris Van den Bossche +* Matthew Zeitlin +* MeeseeksMachine +* Pandas Development Team +* Simon Hawkins +* jbrockmendel +* mzeitlin11 +* patrick diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.2.5.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.2.5.md new file mode 100644 index 0000000000000000000000000000000000000000..deed2c6c850c0d06603436977236920410d65936 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.2.5.md @@ -0,0 +1,35 @@ +# What's new in pandas 1.2.5 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.2.5.html + +# What’s new in 1.2.5 (June 22, 2021)[#](#what-s-new-in-1-2-5-june-22-2021 "Link to this heading") + +These are the changes in pandas 1.2.5. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") between two [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") where one has an [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") that is all-None and the other is [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") incorrectly raising ([GH 40841](https://github.com/pandas-dev/pandas/issues/40841)) +* Fixed regression in [`DataFrame.sum()`](../reference/api/pandas.DataFrame.sum.html#pandas.DataFrame.sum "pandas.DataFrame.sum") and [`DataFrame.prod()`](../reference/api/pandas.DataFrame.prod.html#pandas.DataFrame.prod "pandas.DataFrame.prod") when `min_count` and `numeric_only` are both given ([GH 41074](https://github.com/pandas-dev/pandas/issues/41074)) +* Fixed regression in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") when using `memory_map=True` with an non-UTF8 encoding ([GH 40986](https://github.com/pandas-dev/pandas/issues/40986)) +* Fixed regression in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") and [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") when the values to replace is a NumPy float array ([GH 40371](https://github.com/pandas-dev/pandas/issues/40371)) +* Fixed regression in [`ExcelFile()`](../reference/api/pandas.ExcelFile.html#pandas.ExcelFile "pandas.ExcelFile") when a corrupt file is opened but not closed ([GH 41778](https://github.com/pandas-dev/pandas/issues/41778)) +* Fixed regression in [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") with `dtype=str` failing to convert `NaN` in categorical columns ([GH 41797](https://github.com/pandas-dev/pandas/issues/41797)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 12 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Joris Van den Bossche +* Marc Garcia +* Matthew Zeitlin +* MeeseeksMachine +* Pandas Development Team +* Patrick Hoefler + +* Simon Hawkins +* Thomas Li +* Torsten Wörtwein +* hasan-yaman + +* jbrockmendel +* phofl + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.3.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.3.0.md new file mode 100644 index 0000000000000000000000000000000000000000..88409013eeb4c0c8cff2dc55f8dbda2a4c104d18 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.3.0.md @@ -0,0 +1,1513 @@ +# What's new in pandas 1.3.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.3.0.html + +# What’s new in 1.3.0 (July 2, 2021)[#](#what-s-new-in-1-3-0-july-2-2021 "Link to this heading") + +These are the changes in pandas 1.3.0. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +Warning + +When reading new Excel 2007+ (`.xlsx`) files, the default argument +`engine=None` to [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") will now result in using the +[openpyxl](https://openpyxl.readthedocs.io/en/stable/) engine in all cases +when the option `io.excel.xlsx.reader` is set to `"auto"`. +Previously, some cases would use the +[xlrd](https://xlrd.readthedocs.io/en/latest/) engine instead. See +[What’s new 1.2.0](v1.2.0.html#whatsnew-120) for background on this change. + +## Enhancements[#](#enhancements "Link to this heading") + +### Custom HTTP(s) headers when reading csv or json files[#](#custom-http-s-headers-when-reading-csv-or-json-files "Link to this heading") + +When reading from a remote URL that is not handled by fsspec (e.g. HTTP and +HTTPS) the dictionary passed to `storage_options` will be used to create the +headers included in the request. This can be used to control the User-Agent +header or send other custom headers ([GH 36688](https://github.com/pandas-dev/pandas/issues/36688)). +For example: + +```None +In [1]: headers = {"User-Agent": "pandas"} +In [2]: df = pd.read_csv( + ...: "https://download.bls.gov/pub/time.series/cu/cu.item", + ...: sep="\t", + ...: storage_options=headers + ...: ) +``` + +### Read and write XML documents[#](#read-and-write-xml-documents "Link to this heading") + +We added I/O support to read and render shallow versions of [XML](https://www.w3.org/standards/xml/core) documents with +[`read_xml()`](../reference/api/pandas.read_xml.html#pandas.read_xml "pandas.read_xml") and [`DataFrame.to_xml()`](../reference/api/pandas.DataFrame.to_xml.html#pandas.DataFrame.to_xml "pandas.DataFrame.to_xml"). Using [lxml](https://lxml.de) as parser, +both XPath 1.0 and XSLT 1.0 are available. ([GH 27554](https://github.com/pandas-dev/pandas/issues/27554)) + +```None +In [1]: xml = """ + ...: + ...: + ...: square + ...: 360 + ...: 4.0 + ...: + ...: + ...: circle + ...: 360 + ...: + ...: + ...: + ...: triangle + ...: 180 + ...: 3.0 + ...: + ...: """ + +In [2]: df = pd.read_xml(xml) +In [3]: df +Out[3]: + shape degrees sides +0 square 360 4.0 +1 circle 360 NaN +2 triangle 180 3.0 + +In [4]: df.to_xml() +Out[4]: + + + + 0 + square + 360 + 4.0 + + + 1 + circle + 360 + + + + 2 + triangle + 180 + 3.0 + + +``` + +For more, see [Writing XML](../user_guide/io.html#io-xml) in the user guide on IO tools. + +### Styler enhancements[#](#styler-enhancements "Link to this heading") + +We provided some focused development on [`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler"). See also the [Styler documentation](../user_guide/style.html) +which has been revised and improved ([GH 39720](https://github.com/pandas-dev/pandas/issues/39720), [GH 39317](https://github.com/pandas-dev/pandas/issues/39317), [GH 40493](https://github.com/pandas-dev/pandas/issues/40493)). + +> * The method [`Styler.set_table_styles()`](../reference/api/pandas.io.formats.style.Styler.set_table_styles.html#pandas.io.formats.style.Styler.set_table_styles "pandas.io.formats.style.Styler.set_table_styles") can now accept more natural CSS language for arguments, such as `'color:red;'` instead of `[('color', 'red')]` ([GH 39563](https://github.com/pandas-dev/pandas/issues/39563)) +> * The methods [`Styler.highlight_null()`](../reference/api/pandas.io.formats.style.Styler.highlight_null.html#pandas.io.formats.style.Styler.highlight_null "pandas.io.formats.style.Styler.highlight_null"), [`Styler.highlight_min()`](../reference/api/pandas.io.formats.style.Styler.highlight_min.html#pandas.io.formats.style.Styler.highlight_min "pandas.io.formats.style.Styler.highlight_min"), and [`Styler.highlight_max()`](../reference/api/pandas.io.formats.style.Styler.highlight_max.html#pandas.io.formats.style.Styler.highlight_max "pandas.io.formats.style.Styler.highlight_max") now allow custom CSS highlighting instead of the default background coloring ([GH 40242](https://github.com/pandas-dev/pandas/issues/40242)) +> * [`Styler.apply()`](../reference/api/pandas.io.formats.style.Styler.apply.html#pandas.io.formats.style.Styler.apply "pandas.io.formats.style.Styler.apply") now accepts functions that return an `ndarray` when `axis=None`, making it now consistent with the `axis=0` and `axis=1` behavior ([GH 39359](https://github.com/pandas-dev/pandas/issues/39359)) +> * When incorrectly formatted CSS is given via [`Styler.apply()`](../reference/api/pandas.io.formats.style.Styler.apply.html#pandas.io.formats.style.Styler.apply "pandas.io.formats.style.Styler.apply") or `Styler.applymap()`, an error is now raised upon rendering ([GH 39660](https://github.com/pandas-dev/pandas/issues/39660)) +> * [`Styler.format()`](../reference/api/pandas.io.formats.style.Styler.format.html#pandas.io.formats.style.Styler.format "pandas.io.formats.style.Styler.format") now accepts the keyword argument `escape` for optional HTML and LaTeX escaping ([GH 40388](https://github.com/pandas-dev/pandas/issues/40388), [GH 41619](https://github.com/pandas-dev/pandas/issues/41619)) +> * [`Styler.background_gradient()`](../reference/api/pandas.io.formats.style.Styler.background_gradient.html#pandas.io.formats.style.Styler.background_gradient "pandas.io.formats.style.Styler.background_gradient") has gained the argument `gmap` to supply a specific gradient map for shading ([GH 22727](https://github.com/pandas-dev/pandas/issues/22727)) +> * [`Styler.clear()`](../reference/api/pandas.io.formats.style.Styler.clear.html#pandas.io.formats.style.Styler.clear "pandas.io.formats.style.Styler.clear") now clears `Styler.hidden_index` and `Styler.hidden_columns` as well ([GH 40484](https://github.com/pandas-dev/pandas/issues/40484)) +> * Added the method [`Styler.highlight_between()`](../reference/api/pandas.io.formats.style.Styler.highlight_between.html#pandas.io.formats.style.Styler.highlight_between "pandas.io.formats.style.Styler.highlight_between") ([GH 39821](https://github.com/pandas-dev/pandas/issues/39821)) +> * Added the method [`Styler.highlight_quantile()`](../reference/api/pandas.io.formats.style.Styler.highlight_quantile.html#pandas.io.formats.style.Styler.highlight_quantile "pandas.io.formats.style.Styler.highlight_quantile") ([GH 40926](https://github.com/pandas-dev/pandas/issues/40926)) +> * Added the method [`Styler.text_gradient()`](../reference/api/pandas.io.formats.style.Styler.text_gradient.html#pandas.io.formats.style.Styler.text_gradient "pandas.io.formats.style.Styler.text_gradient") ([GH 41098](https://github.com/pandas-dev/pandas/issues/41098)) +> * Added the method [`Styler.set_tooltips()`](../reference/api/pandas.io.formats.style.Styler.set_tooltips.html#pandas.io.formats.style.Styler.set_tooltips "pandas.io.formats.style.Styler.set_tooltips") to allow hover tooltips; this can be used enhance interactive displays ([GH 21266](https://github.com/pandas-dev/pandas/issues/21266), [GH 40284](https://github.com/pandas-dev/pandas/issues/40284)) +> * Added the parameter `precision` to the method [`Styler.format()`](../reference/api/pandas.io.formats.style.Styler.format.html#pandas.io.formats.style.Styler.format "pandas.io.formats.style.Styler.format") to control the display of floating point numbers ([GH 40134](https://github.com/pandas-dev/pandas/issues/40134)) +> * [`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") rendered HTML output now follows the [w3 HTML Style Guide](https://www.w3schools.com/html/html5_syntax.asp) ([GH 39626](https://github.com/pandas-dev/pandas/issues/39626)) +> * Many features of the [`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") class are now either partially or fully usable on a DataFrame with a non-unique indexes or columns ([GH 41143](https://github.com/pandas-dev/pandas/issues/41143)) +> * One has greater control of the display through separate sparsification of the index or columns using the [new styler options](../user_guide/options.html#options-available), which are also usable via [`option_context()`](../reference/api/pandas.option_context.html#pandas.option_context "pandas.option_context") ([GH 41142](https://github.com/pandas-dev/pandas/issues/41142)) +> * Added the option `styler.render.max_elements` to avoid browser overload when styling large DataFrames ([GH 40712](https://github.com/pandas-dev/pandas/issues/40712)) +> * Added the method [`Styler.to_latex()`](../reference/api/pandas.io.formats.style.Styler.to_latex.html#pandas.io.formats.style.Styler.to_latex "pandas.io.formats.style.Styler.to_latex") ([GH 21673](https://github.com/pandas-dev/pandas/issues/21673), [GH 42320](https://github.com/pandas-dev/pandas/issues/42320)), which also allows some limited CSS conversion ([GH 40731](https://github.com/pandas-dev/pandas/issues/40731)) +> * Added the method [`Styler.to_html()`](../reference/api/pandas.io.formats.style.Styler.to_html.html#pandas.io.formats.style.Styler.to_html "pandas.io.formats.style.Styler.to_html") ([GH 13379](https://github.com/pandas-dev/pandas/issues/13379)) +> * Added the method [`Styler.set_sticky()`](../reference/api/pandas.io.formats.style.Styler.set_sticky.html#pandas.io.formats.style.Styler.set_sticky "pandas.io.formats.style.Styler.set_sticky") to make index and column headers permanently visible in scrolling HTML frames ([GH 29072](https://github.com/pandas-dev/pandas/issues/29072)) + +### DataFrame constructor honors `copy=False` with dict[#](#dataframe-constructor-honors-copy-false-with-dict "Link to this heading") + +When passing a dictionary to [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with `copy=False`, +a copy will no longer be made ([GH 32960](https://github.com/pandas-dev/pandas/issues/32960)). + +```None +In [1]: arr = np.array([1, 2, 3]) + +In [2]: df = pd.DataFrame({"A": arr, "B": arr.copy()}, copy=False) + +In [3]: df +Out[3]: + A B +0 1 1 +1 2 2 +2 3 3 +``` + +`df["A"]` remains a view on `arr`: + +```None +In [4]: arr[0] = 0 + +In [5]: assert df.iloc[0, 0] == 0 +``` + +The default behavior when not passing `copy` will remain unchanged, i.e. +a copy will be made. + +### PyArrow backed string data type[#](#pyarrow-backed-string-data-type "Link to this heading") + +We’ve enhanced the [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype"), an extension type dedicated to string data. +([GH 39908](https://github.com/pandas-dev/pandas/issues/39908)) + +It is now possible to specify a `storage` keyword option to [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype"). Use +pandas options or specify the dtype using `dtype='string[pyarrow]'` to allow the +StringArray to be backed by a PyArrow array instead of a NumPy array of Python objects. + +The PyArrow backed StringArray requires pyarrow 1.0.0 or greater to be installed. + +Warning + +`string[pyarrow]` is currently considered experimental. The implementation +and parts of the API may change without warning. + +```None +In [6]: pd.Series(['abc', None, 'def'], dtype=pd.StringDtype(storage="pyarrow")) +Out[6]: +0 abc +1 +2 def +dtype: string +``` + +You can use the alias `"string[pyarrow]"` as well. + +```None +In [7]: s = pd.Series(['abc', None, 'def'], dtype="string[pyarrow]") + +In [8]: s +Out[8]: +0 abc +1 +2 def +dtype: string +``` + +You can also create a PyArrow backed string array using pandas options. + +```None +In [9]: with pd.option_context("string_storage", "pyarrow"): + ...: s = pd.Series(['abc', None, 'def'], dtype="string") + ...: + +In [10]: s +Out[10]: +0 abc +1 +2 def +dtype: string +``` + +The usual string accessor methods work. Where appropriate, the return type of the Series +or columns of a DataFrame will also have string dtype. + +```None +In [11]: s.str.upper() +Out[11]: +0 ABC +1 +2 DEF +dtype: string + +In [12]: s.str.split('b', expand=True).dtypes +Out[12]: +0 string[pyarrow] +1 string[pyarrow] +dtype: object +``` + +String accessor methods returning integers will return a value with [`Int64Dtype`](../reference/api/pandas.Int64Dtype.html#pandas.Int64Dtype "pandas.Int64Dtype") + +```None +In [13]: s.str.count("a") +Out[13]: +0 1 +1 +2 0 +dtype: Int64 +``` + +### Centered datetime-like rolling windows[#](#centered-datetime-like-rolling-windows "Link to this heading") + +When performing rolling calculations on DataFrame and Series +objects with a datetime-like index, a centered datetime-like window can now be +used ([GH 38780](https://github.com/pandas-dev/pandas/issues/38780)). +For example: + +```None +In [14]: df = pd.DataFrame( + ....: {"A": [0, 1, 2, 3, 4]}, index=pd.date_range("2020", periods=5, freq="1D") + ....: ) + ....: + +In [15]: df +Out[15]: + A +2020-01-01 0 +2020-01-02 1 +2020-01-03 2 +2020-01-04 3 +2020-01-05 4 + +In [16]: df.rolling("2D", center=True).mean() +Out[16]: + A +2020-01-01 0.5 +2020-01-02 1.5 +2020-01-03 2.5 +2020-01-04 3.5 +2020-01-05 4.0 +``` + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling"), [`Series.rolling()`](../reference/api/pandas.Series.rolling.html#pandas.Series.rolling "pandas.Series.rolling"), [`DataFrame.expanding()`](../reference/api/pandas.DataFrame.expanding.html#pandas.DataFrame.expanding "pandas.DataFrame.expanding"), and [`Series.expanding()`](../reference/api/pandas.Series.expanding.html#pandas.Series.expanding "pandas.Series.expanding") now support a `method` argument with a `'table'` option that performs the windowing operation over an entire [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame"). See [Window Overview](../user_guide/window.html#window-overview) for performance and functional benefits ([GH 15095](https://github.com/pandas-dev/pandas/issues/15095), [GH 38995](https://github.com/pandas-dev/pandas/issues/38995)) +* `ExponentialMovingWindow` now support a `online` method that can perform `mean` calculations in an online fashion. See [Window Overview](../user_guide/window.html#window-overview) ([GH 41673](https://github.com/pandas-dev/pandas/issues/41673)) +* Added [`MultiIndex.dtypes()`](../reference/api/pandas.MultiIndex.dtypes.html#pandas.MultiIndex.dtypes "pandas.MultiIndex.dtypes") ([GH 37062](https://github.com/pandas-dev/pandas/issues/37062)) +* Added `end` and `end_day` options for the `origin` argument in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") ([GH 37804](https://github.com/pandas-dev/pandas/issues/37804)) +* Improved error message when `usecols` and `names` do not match for [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") and `engine="c"` ([GH 29042](https://github.com/pandas-dev/pandas/issues/29042)) +* Improved consistency of error messages when passing an invalid `win_type` argument in [Window methods](../reference/window.html#api-window) ([GH 15969](https://github.com/pandas-dev/pandas/issues/15969)) +* [`read_sql_query()`](../reference/api/pandas.read_sql_query.html#pandas.read_sql_query "pandas.read_sql_query") now accepts a `dtype` argument to cast the columnar data from the SQL database based on user input ([GH 10285](https://github.com/pandas-dev/pandas/issues/10285)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") now raising `ParserWarning` if length of header or given names does not match length of data when `usecols` is not specified ([GH 21768](https://github.com/pandas-dev/pandas/issues/21768)) +* Improved integer type mapping from pandas to SQLAlchemy when using [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") ([GH 35076](https://github.com/pandas-dev/pandas/issues/35076)) +* [`to_numeric()`](../reference/api/pandas.to_numeric.html#pandas.to_numeric "pandas.to_numeric") now supports downcasting of nullable `ExtensionDtype` objects ([GH 33013](https://github.com/pandas-dev/pandas/issues/33013)) +* Added support for dict-like names in `MultiIndex.set_names` and `MultiIndex.rename` ([GH 20421](https://github.com/pandas-dev/pandas/issues/20421)) +* [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") can now auto-detect .xlsb files and older .xls files ([GH 35416](https://github.com/pandas-dev/pandas/issues/35416), [GH 41225](https://github.com/pandas-dev/pandas/issues/41225)) +* [`ExcelWriter`](../reference/api/pandas.ExcelWriter.html#pandas.ExcelWriter "pandas.ExcelWriter") now accepts an `if_sheet_exists` parameter to control the behavior of append mode when writing to existing sheets ([GH 40230](https://github.com/pandas-dev/pandas/issues/40230)) +* [`Rolling.sum()`](../reference/api/pandas.core.window.rolling.Rolling.sum.html#pandas.core.window.rolling.Rolling.sum "pandas.core.window.rolling.Rolling.sum"), [`Expanding.sum()`](../reference/api/pandas.core.window.expanding.Expanding.sum.html#pandas.core.window.expanding.Expanding.sum "pandas.core.window.expanding.Expanding.sum"), [`Rolling.mean()`](../reference/api/pandas.core.window.rolling.Rolling.mean.html#pandas.core.window.rolling.Rolling.mean "pandas.core.window.rolling.Rolling.mean"), [`Expanding.mean()`](../reference/api/pandas.core.window.expanding.Expanding.mean.html#pandas.core.window.expanding.Expanding.mean "pandas.core.window.expanding.Expanding.mean"), [`ExponentialMovingWindow.mean()`](../reference/api/pandas.core.window.ewm.ExponentialMovingWindow.mean.html#pandas.core.window.ewm.ExponentialMovingWindow.mean "pandas.core.window.ewm.ExponentialMovingWindow.mean"), [`Rolling.median()`](../reference/api/pandas.core.window.rolling.Rolling.median.html#pandas.core.window.rolling.Rolling.median "pandas.core.window.rolling.Rolling.median"), [`Expanding.median()`](../reference/api/pandas.core.window.expanding.Expanding.median.html#pandas.core.window.expanding.Expanding.median "pandas.core.window.expanding.Expanding.median"), [`Rolling.max()`](../reference/api/pandas.core.window.rolling.Rolling.max.html#pandas.core.window.rolling.Rolling.max "pandas.core.window.rolling.Rolling.max"), [`Expanding.max()`](../reference/api/pandas.core.window.expanding.Expanding.max.html#pandas.core.window.expanding.Expanding.max "pandas.core.window.expanding.Expanding.max"), [`Rolling.min()`](../reference/api/pandas.core.window.rolling.Rolling.min.html#pandas.core.window.rolling.Rolling.min "pandas.core.window.rolling.Rolling.min"), and [`Expanding.min()`](../reference/api/pandas.core.window.expanding.Expanding.min.html#pandas.core.window.expanding.Expanding.min "pandas.core.window.expanding.Expanding.min") now support [Numba](http://numba.pydata.org/) execution with the `engine` keyword ([GH 38895](https://github.com/pandas-dev/pandas/issues/38895), [GH 41267](https://github.com/pandas-dev/pandas/issues/41267)) +* [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") can now accept NumPy unary operators as strings, e.g. `df.apply("sqrt")`, which was already the case for [`Series.apply()`](../reference/api/pandas.Series.apply.html#pandas.Series.apply "pandas.Series.apply") ([GH 39116](https://github.com/pandas-dev/pandas/issues/39116)) +* [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") can now accept non-callable DataFrame properties as strings, e.g. `df.apply("size")`, which was already the case for [`Series.apply()`](../reference/api/pandas.Series.apply.html#pandas.Series.apply "pandas.Series.apply") ([GH 39116](https://github.com/pandas-dev/pandas/issues/39116)) +* [`DataFrame.applymap()`](../reference/api/pandas.DataFrame.applymap.html#pandas.DataFrame.applymap "pandas.DataFrame.applymap") can now accept kwargs to pass on to the user-provided `func` ([GH 39987](https://github.com/pandas-dev/pandas/issues/39987)) +* Passing a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") indexer to `iloc` is now disallowed for `Series.__getitem__()` and `DataFrame.__getitem__()` ([GH 39004](https://github.com/pandas-dev/pandas/issues/39004)) +* [`Series.apply()`](../reference/api/pandas.Series.apply.html#pandas.Series.apply "pandas.Series.apply") can now accept list-like or dictionary-like arguments that aren’t lists or dictionaries, e.g. `ser.apply(np.array(["sum", "mean"]))`, which was already the case for [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") ([GH 39140](https://github.com/pandas-dev/pandas/issues/39140)) +* [`DataFrame.plot.scatter()`](../reference/api/pandas.DataFrame.plot.scatter.html#pandas.DataFrame.plot.scatter "pandas.DataFrame.plot.scatter") can now accept a categorical column for the argument `c` ([GH 12380](https://github.com/pandas-dev/pandas/issues/12380), [GH 31357](https://github.com/pandas-dev/pandas/issues/31357)) +* [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") now raises a helpful error message when the Series has a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") and the indexer has too many dimensions ([GH 35349](https://github.com/pandas-dev/pandas/issues/35349)) +* [`read_stata()`](../reference/api/pandas.read_stata.html#pandas.read_stata "pandas.read_stata") now supports reading data from compressed files ([GH 26599](https://github.com/pandas-dev/pandas/issues/26599)) +* Added support for parsing `ISO 8601`-like timestamps with negative signs to [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") ([GH 37172](https://github.com/pandas-dev/pandas/issues/37172)) +* Added support for unary operators in `FloatingArray` ([GH 38749](https://github.com/pandas-dev/pandas/issues/38749)) +* [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") can now be constructed by passing a `range` object directly e.g. `pd.RangeIndex(range(3))` ([GH 12067](https://github.com/pandas-dev/pandas/issues/12067)) +* [`Series.round()`](../reference/api/pandas.Series.round.html#pandas.Series.round "pandas.Series.round") and [`DataFrame.round()`](../reference/api/pandas.DataFrame.round.html#pandas.DataFrame.round "pandas.DataFrame.round") now work with nullable integer and floating dtypes ([GH 38844](https://github.com/pandas-dev/pandas/issues/38844)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") and [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") expose the argument `encoding_errors` to control how encoding errors are handled ([GH 39450](https://github.com/pandas-dev/pandas/issues/39450)) +* [`DataFrameGroupBy.any()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.any.html#pandas.core.groupby.DataFrameGroupBy.any "pandas.core.groupby.DataFrameGroupBy.any"), [`SeriesGroupBy.any()`](../reference/api/pandas.core.groupby.SeriesGroupBy.any.html#pandas.core.groupby.SeriesGroupBy.any "pandas.core.groupby.SeriesGroupBy.any"), [`DataFrameGroupBy.all()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.all.html#pandas.core.groupby.DataFrameGroupBy.all "pandas.core.groupby.DataFrameGroupBy.all"), and [`SeriesGroupBy.all()`](../reference/api/pandas.core.groupby.SeriesGroupBy.all.html#pandas.core.groupby.SeriesGroupBy.all "pandas.core.groupby.SeriesGroupBy.all") use Kleene logic with nullable data types ([GH 37506](https://github.com/pandas-dev/pandas/issues/37506)) +* [`DataFrameGroupBy.any()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.any.html#pandas.core.groupby.DataFrameGroupBy.any "pandas.core.groupby.DataFrameGroupBy.any"), [`SeriesGroupBy.any()`](../reference/api/pandas.core.groupby.SeriesGroupBy.any.html#pandas.core.groupby.SeriesGroupBy.any "pandas.core.groupby.SeriesGroupBy.any"), [`DataFrameGroupBy.all()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.all.html#pandas.core.groupby.DataFrameGroupBy.all "pandas.core.groupby.DataFrameGroupBy.all"), and [`SeriesGroupBy.all()`](../reference/api/pandas.core.groupby.SeriesGroupBy.all.html#pandas.core.groupby.SeriesGroupBy.all "pandas.core.groupby.SeriesGroupBy.all") return a `BooleanDtype` for columns with nullable data types ([GH 33449](https://github.com/pandas-dev/pandas/issues/33449)) +* [`DataFrameGroupBy.any()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.any.html#pandas.core.groupby.DataFrameGroupBy.any "pandas.core.groupby.DataFrameGroupBy.any"), [`SeriesGroupBy.any()`](../reference/api/pandas.core.groupby.SeriesGroupBy.any.html#pandas.core.groupby.SeriesGroupBy.any "pandas.core.groupby.SeriesGroupBy.any"), [`DataFrameGroupBy.all()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.all.html#pandas.core.groupby.DataFrameGroupBy.all "pandas.core.groupby.DataFrameGroupBy.all"), and [`SeriesGroupBy.all()`](../reference/api/pandas.core.groupby.SeriesGroupBy.all.html#pandas.core.groupby.SeriesGroupBy.all "pandas.core.groupby.SeriesGroupBy.all") raising with `object` data containing `pd.NA` even when `skipna=True` ([GH 37501](https://github.com/pandas-dev/pandas/issues/37501)) +* [`DataFrameGroupBy.rank()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.rank.html#pandas.core.groupby.DataFrameGroupBy.rank "pandas.core.groupby.DataFrameGroupBy.rank") and [`SeriesGroupBy.rank()`](../reference/api/pandas.core.groupby.SeriesGroupBy.rank.html#pandas.core.groupby.SeriesGroupBy.rank "pandas.core.groupby.SeriesGroupBy.rank") now supports object-dtype data ([GH 38278](https://github.com/pandas-dev/pandas/issues/38278)) +* Constructing a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") or [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with the `data` argument being a Python iterable that is *not* a NumPy `ndarray` consisting of NumPy scalars will now result in a dtype with a precision the maximum of the NumPy scalars; this was already the case when `data` is a NumPy `ndarray` ([GH 40908](https://github.com/pandas-dev/pandas/issues/40908)) +* Add keyword `sort` to [`pivot_table()`](../reference/api/pandas.pivot_table.html#pandas.pivot_table "pandas.pivot_table") to allow non-sorting of the result ([GH 39143](https://github.com/pandas-dev/pandas/issues/39143)) +* Add keyword `dropna` to [`DataFrame.value_counts()`](../reference/api/pandas.DataFrame.value_counts.html#pandas.DataFrame.value_counts "pandas.DataFrame.value_counts") to allow counting rows that include `NA` values ([GH 41325](https://github.com/pandas-dev/pandas/issues/41325)) +* [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") will now cast results to `PeriodDtype` where possible instead of `object` dtype ([GH 41526](https://github.com/pandas-dev/pandas/issues/41526)) +* Improved error message in `corr` and `cov` methods on `Rolling`, `Expanding`, and `ExponentialMovingWindow` when `other` is not a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") or [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") ([GH 41741](https://github.com/pandas-dev/pandas/issues/41741)) +* [`Series.between()`](../reference/api/pandas.Series.between.html#pandas.Series.between "pandas.Series.between") can now accept `left` or `right` as arguments to `inclusive` to include only the left or right boundary ([GH 40245](https://github.com/pandas-dev/pandas/issues/40245)) +* [`DataFrame.explode()`](../reference/api/pandas.DataFrame.explode.html#pandas.DataFrame.explode "pandas.DataFrame.explode") now supports exploding multiple columns. Its `column` argument now also accepts a list of str or tuples for exploding on multiple columns at the same time ([GH 39240](https://github.com/pandas-dev/pandas/issues/39240)) +* [`DataFrame.sample()`](../reference/api/pandas.DataFrame.sample.html#pandas.DataFrame.sample "pandas.DataFrame.sample") now accepts the `ignore_index` argument to reset the index after sampling, similar to [`DataFrame.drop_duplicates()`](../reference/api/pandas.DataFrame.drop_duplicates.html#pandas.DataFrame.drop_duplicates "pandas.DataFrame.drop_duplicates") and [`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values") ([GH 38581](https://github.com/pandas-dev/pandas/issues/38581)) + +## Notable bug fixes[#](#notable-bug-fixes "Link to this heading") + +These are bug fixes that might have notable behavior changes. + +### `Categorical.unique` now always maintains same dtype as original[#](#categorical-unique-now-always-maintains-same-dtype-as-original "Link to this heading") + +Previously, when calling `Categorical.unique()` with categorical data, unused categories in the new array +would be removed, making the dtype of the new array different than the +original ([GH 18291](https://github.com/pandas-dev/pandas/issues/18291)) + +As an example of this, given: + +```None +In [17]: dtype = pd.CategoricalDtype(['bad', 'neutral', 'good'], ordered=True) + +In [18]: cat = pd.Categorical(['good', 'good', 'bad', 'bad'], dtype=dtype) + +In [19]: original = pd.Series(cat) + +In [20]: unique = original.unique() +``` + +*Previous behavior*: + +```None +In [1]: unique +['good', 'bad'] +Categories (2, object): ['bad' < 'good'] +In [2]: original.dtype == unique.dtype +False +``` + +*New behavior*: + +```None +In [21]: unique +Out[21]: +['good', 'bad'] +Categories (3, object): ['bad' < 'neutral' < 'good'] + +In [22]: original.dtype == unique.dtype +Out[22]: True +``` + +### Preserve dtypes in [`DataFrame.combine_first()`](../reference/api/pandas.DataFrame.combine_first.html#pandas.DataFrame.combine_first "pandas.DataFrame.combine_first")[#](#preserve-dtypes-in-dataframe-combine-first "Link to this heading") + +[`DataFrame.combine_first()`](../reference/api/pandas.DataFrame.combine_first.html#pandas.DataFrame.combine_first "pandas.DataFrame.combine_first") will now preserve dtypes ([GH 7509](https://github.com/pandas-dev/pandas/issues/7509)) + +```None +In [23]: df1 = pd.DataFrame({"A": [1, 2, 3], "B": [1, 2, 3]}, index=[0, 1, 2]) + +In [24]: df1 +Out[24]: + A B +0 1 1 +1 2 2 +2 3 3 + +In [25]: df2 = pd.DataFrame({"B": [4, 5, 6], "C": [1, 2, 3]}, index=[2, 3, 4]) + +In [26]: df2 +Out[26]: + B C +2 4 1 +3 5 2 +4 6 3 + +In [27]: combined = df1.combine_first(df2) +``` + +*Previous behavior*: + +```None +In [1]: combined.dtypes +Out[2]: +A float64 +B float64 +C float64 +dtype: object +``` + +*New behavior*: + +```None +In [28]: combined.dtypes +Out[28]: +A float64 +B int64 +C float64 +dtype: object +``` + +### Groupby methods agg and transform no longer changes return dtype for callables[#](#groupby-methods-agg-and-transform-no-longer-changes-return-dtype-for-callables "Link to this heading") + +Previously the methods [`DataFrameGroupBy.aggregate()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.aggregate.html#pandas.core.groupby.DataFrameGroupBy.aggregate "pandas.core.groupby.DataFrameGroupBy.aggregate"), +[`SeriesGroupBy.aggregate()`](../reference/api/pandas.core.groupby.SeriesGroupBy.aggregate.html#pandas.core.groupby.SeriesGroupBy.aggregate "pandas.core.groupby.SeriesGroupBy.aggregate"), [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform"), and +[`SeriesGroupBy.transform()`](../reference/api/pandas.core.groupby.SeriesGroupBy.transform.html#pandas.core.groupby.SeriesGroupBy.transform "pandas.core.groupby.SeriesGroupBy.transform") might cast the result dtype when the argument `func` +is callable, possibly leading to undesirable results ([GH 21240](https://github.com/pandas-dev/pandas/issues/21240)). The cast would +occur if the result is numeric and casting back to the input dtype does not change any +values as measured by `np.allclose`. Now no such casting occurs. + +```None +In [29]: df = pd.DataFrame({'key': [1, 1], 'a': [True, False], 'b': [True, True]}) + +In [30]: df +Out[30]: + key a b +0 1 True True +1 1 False True +``` + +*Previous behavior*: + +```None +In [5]: df.groupby('key').agg(lambda x: x.sum()) +Out[5]: + a b +key +1 True 2 +``` + +*New behavior*: + +```None +In [31]: df.groupby('key').agg(lambda x: x.sum()) +Out[31]: + a b +key +1 1 2 +``` + +### `float` result for [`DataFrameGroupBy.mean()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.mean.html#pandas.core.groupby.DataFrameGroupBy.mean "pandas.core.groupby.DataFrameGroupBy.mean"), [`DataFrameGroupBy.median()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.median.html#pandas.core.groupby.DataFrameGroupBy.median "pandas.core.groupby.DataFrameGroupBy.median"), and `GDataFrameGroupBy.var()`, [`SeriesGroupBy.mean()`](../reference/api/pandas.core.groupby.SeriesGroupBy.mean.html#pandas.core.groupby.SeriesGroupBy.mean "pandas.core.groupby.SeriesGroupBy.mean"), [`SeriesGroupBy.median()`](../reference/api/pandas.core.groupby.SeriesGroupBy.median.html#pandas.core.groupby.SeriesGroupBy.median "pandas.core.groupby.SeriesGroupBy.median"), and [`SeriesGroupBy.var()`](../reference/api/pandas.core.groupby.SeriesGroupBy.var.html#pandas.core.groupby.SeriesGroupBy.var "pandas.core.groupby.SeriesGroupBy.var")[#](#float-result-for-dataframegroupby-mean-dataframegroupby-median-and-gdataframegroupby-var-seriesgroupby-mean-seriesgroupby-median-and-seriesgroupby-var "Link to this heading") + +Previously, these methods could result in different dtypes depending on the input values. +Now, these methods will always return a float dtype. ([GH 41137](https://github.com/pandas-dev/pandas/issues/41137)) + +```None +In [32]: df = pd.DataFrame({'a': [True], 'b': [1], 'c': [1.0]}) +``` + +*Previous behavior*: + +```None +In [5]: df.groupby(df.index).mean() +Out[5]: + a b c +0 True 1 1.0 +``` + +*New behavior*: + +```None +In [33]: df.groupby(df.index).mean() +Out[33]: + a b c +0 1.0 1.0 1.0 +``` + +### Try operating inplace when setting values with `loc` and `iloc`[#](#try-operating-inplace-when-setting-values-with-loc-and-iloc "Link to this heading") + +When setting an entire column using `loc` or `iloc`, pandas will try to +insert the values into the existing data rather than create an entirely new array. + +```None +In [34]: df = pd.DataFrame(range(3), columns=["A"], dtype="float64") + +In [35]: values = df.values + +In [36]: new = np.array([5, 6, 7], dtype="int64") + +In [37]: df.loc[[0, 1, 2], "A"] = new +``` + +In both the new and old behavior, the data in `values` is overwritten, but in +the old behavior the dtype of `df["A"]` changed to `int64`. + +*Previous behavior*: + +```None +In [1]: df.dtypes +Out[1]: +A int64 +dtype: object +In [2]: np.shares_memory(df["A"].values, new) +Out[2]: False +In [3]: np.shares_memory(df["A"].values, values) +Out[3]: False +``` + +In pandas 1.3.0, `df` continues to share data with `values` + +*New behavior*: + +```None +In [38]: df.dtypes +Out[38]: +A float64 +dtype: object + +In [39]: np.shares_memory(df["A"], new) +Out[39]: False + +In [40]: np.shares_memory(df["A"], values) +Out[40]: True +``` + +### Never operate inplace when setting `frame[keys] = values`[#](#never-operate-inplace-when-setting-frame-keys-values "Link to this heading") + +When setting multiple columns using `frame[keys] = values` new arrays will +replace pre-existing arrays for these keys, which will *not* be over-written +([GH 39510](https://github.com/pandas-dev/pandas/issues/39510)). As a result, the columns will retain the dtype(s) of `values`, +never casting to the dtypes of the existing arrays. + +```None +In [41]: df = pd.DataFrame(range(3), columns=["A"], dtype="float64") + +In [42]: df[["A"]] = 5 +``` + +In the old behavior, `5` was cast to `float64` and inserted into the existing +array backing `df`: + +*Previous behavior*: + +```None +In [1]: df.dtypes +Out[1]: +A float64 +``` + +In the new behavior, we get a new array, and retain an integer-dtyped `5`: + +*New behavior*: + +```None +In [43]: df.dtypes +Out[43]: +A int64 +dtype: object +``` + +### Consistent casting with setting into Boolean Series[#](#consistent-casting-with-setting-into-boolean-series "Link to this heading") + +Setting non-boolean values into a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `dtype=bool` now consistently +casts to `dtype=object` ([GH 38709](https://github.com/pandas-dev/pandas/issues/38709)) + +```None +In [1]: orig = pd.Series([True, False]) + +In [2]: ser = orig.copy() + +In [3]: ser.iloc[1] = np.nan + +In [4]: ser2 = orig.copy() + +In [5]: ser2.iloc[1] = 2.0 +``` + +*Previous behavior*: + +```None +In [1]: ser +Out [1]: +0 1.0 +1 NaN +dtype: float64 + +In [2]:ser2 +Out [2]: +0 True +1 2.0 +dtype: object +``` + +*New behavior*: + +```None +In [1]: ser +Out [1]: +0 True +1 NaN +dtype: object + +In [2]:ser2 +Out [2]: +0 True +1 2.0 +dtype: object +``` + +### DataFrameGroupBy.rolling and SeriesGroupBy.rolling no longer return grouped-by column in values[#](#dataframegroupby-rolling-and-seriesgroupby-rolling-no-longer-return-grouped-by-column-in-values "Link to this heading") + +The group-by column will now be dropped from the result of a +`groupby.rolling` operation ([GH 32262](https://github.com/pandas-dev/pandas/issues/32262)) + +```None +In [44]: df = pd.DataFrame({"A": [1, 1, 2, 3], "B": [0, 1, 2, 3]}) + +In [45]: df +Out[45]: + A B +0 1 0 +1 1 1 +2 2 2 +3 3 3 +``` + +*Previous behavior*: + +```None +In [1]: df.groupby("A").rolling(2).sum() +Out[1]: + A B +A +1 0 NaN NaN +1 2.0 1.0 +2 2 NaN NaN +3 3 NaN NaN +``` + +*New behavior*: + +```None +In [46]: df.groupby("A").rolling(2).sum() +Out[46]: + B +A +1 0 NaN + 1 1.0 +2 2 NaN +3 3 NaN +``` + +### Removed artificial truncation in rolling variance and standard deviation[#](#removed-artificial-truncation-in-rolling-variance-and-standard-deviation "Link to this heading") + +[`Rolling.std()`](../reference/api/pandas.core.window.rolling.Rolling.std.html#pandas.core.window.rolling.Rolling.std "pandas.core.window.rolling.Rolling.std") and [`Rolling.var()`](../reference/api/pandas.core.window.rolling.Rolling.var.html#pandas.core.window.rolling.Rolling.var "pandas.core.window.rolling.Rolling.var") will no longer +artificially truncate results that are less than `~1e-8` and `~1e-15` respectively to +zero ([GH 37051](https://github.com/pandas-dev/pandas/issues/37051), [GH 40448](https://github.com/pandas-dev/pandas/issues/40448), [GH 39872](https://github.com/pandas-dev/pandas/issues/39872)). + +However, floating point artifacts may now exist in the results when rolling over larger values. + +```None +In [47]: s = pd.Series([7, 5, 5, 5]) + +In [48]: s.rolling(3).var() +Out[48]: +0 NaN +1 NaN +2 1.333333 +3 0.000000 +dtype: float64 +``` + +### DataFrameGroupBy.rolling and SeriesGroupBy.rolling with MultiIndex no longer drop levels in the result[#](#dataframegroupby-rolling-and-seriesgroupby-rolling-with-multiindex-no-longer-drop-levels-in-the-result "Link to this heading") + +`DataFrameGroupBy.rolling()` and `SeriesGroupBy.rolling()` will no longer drop levels of a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") +with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") in the result. This can lead to a perceived duplication of levels in the resulting +[`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex"), but this change restores the behavior that was present in version 1.1.3 ([GH 38787](https://github.com/pandas-dev/pandas/issues/38787), [GH 38523](https://github.com/pandas-dev/pandas/issues/38523)). + +```None +In [49]: index = pd.MultiIndex.from_tuples([('idx1', 'idx2')], names=['label1', 'label2']) + +In [50]: df = pd.DataFrame({'a': [1], 'b': [2]}, index=index) + +In [51]: df +Out[51]: + a b +label1 label2 +idx1 idx2 1 2 +``` + +*Previous behavior*: + +```None +In [1]: df.groupby('label1').rolling(1).sum() +Out[1]: + a b +label1 +idx1 1.0 2.0 +``` + +*New behavior*: + +```None +In [52]: df.groupby('label1').rolling(1).sum() +Out[52]: + a b +label1 label1 label2 +idx1 idx1 idx2 1.0 2.0 +``` + +## Backwards incompatible API changes[#](#backwards-incompatible-api-changes "Link to this heading") + +### Increased minimum versions for dependencies[#](#increased-minimum-versions-for-dependencies "Link to this heading") + +Some minimum supported versions of dependencies were updated. +If installed, we now require: + +| Package | Minimum Version | Required | Changed | +| --- | --- | --- | --- | +| numpy | 1.17.3 | X | X | +| pytz | 2017.3 | X | | +| python-dateutil | 2.7.3 | X | | +| bottleneck | 1.2.1 | | | +| numexpr | 2.7.0 | | X | +| pytest (dev) | 6.0 | | X | +| mypy (dev) | 0.812 | | X | +| setuptools | 38.6.0 | | X | + +For [optional libraries](https://pandas.pydata.org/docs/getting_started/install.html) the general recommendation is to use the latest version. +The following table lists the lowest version per library that is currently being tested throughout the development of pandas. +Optional libraries below the lowest tested version may still work, but are not considered supported. + +| Package | Minimum Version | Changed | +| --- | --- | --- | +| beautifulsoup4 | 4.6.0 | | +| fastparquet | 0.4.0 | X | +| fsspec | 0.7.4 | | +| gcsfs | 0.6.0 | | +| lxml | 4.3.0 | | +| matplotlib | 2.2.3 | | +| numba | 0.46.0 | | +| openpyxl | 3.0.0 | X | +| pyarrow | 0.17.0 | X | +| pymysql | 0.8.1 | X | +| pytables | 3.5.1 | | +| s3fs | 0.4.0 | | +| scipy | 1.2.0 | | +| sqlalchemy | 1.3.0 | X | +| tabulate | 0.8.7 | X | +| xarray | 0.12.0 | | +| xlrd | 1.2.0 | | +| xlsxwriter | 1.0.2 | | +| xlwt | 1.3.0 | | +| pandas-gbq | 0.12.0 | | + +See [Dependencies](../getting_started/install.html#install-dependencies) and [Optional dependencies](../getting_started/install.html#install-optional-dependencies) for more. + +### Other API changes[#](#other-api-changes "Link to this heading") + +* Partially initialized [`CategoricalDtype`](../reference/api/pandas.CategoricalDtype.html#pandas.CategoricalDtype "pandas.CategoricalDtype") objects (i.e. those with `categories=None`) will no longer compare as equal to fully initialized dtype objects ([GH 38516](https://github.com/pandas-dev/pandas/issues/38516)) +* Accessing `_constructor_expanddim` on a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and `_constructor_sliced` on a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") now raise an `AttributeError`. Previously a `NotImplementedError` was raised ([GH 38782](https://github.com/pandas-dev/pandas/issues/38782)) +* Added new `engine` and `**engine_kwargs` parameters to [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") to support other future “SQL engines”. Currently we still only use `SQLAlchemy` under the hood, but more engines are planned to be supported such as [turbodbc](https://turbodbc.readthedocs.io/en/latest/) ([GH 36893](https://github.com/pandas-dev/pandas/issues/36893)) +* Removed redundant `freq` from [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") string representation ([GH 41653](https://github.com/pandas-dev/pandas/issues/41653)) +* `ExtensionDtype.construct_array_type()` is now a required method instead of an optional one for `ExtensionDtype` subclasses ([GH 24860](https://github.com/pandas-dev/pandas/issues/24860)) +* Calling `hash` on non-hashable pandas objects will now raise `TypeError` with the built-in error message (e.g. `unhashable type: 'Series'`). Previously it would raise a custom message such as `'Series' objects are mutable, thus they cannot be hashed`. Furthermore, `isinstance(, abc.collections.Hashable)` will now return `False` ([GH 40013](https://github.com/pandas-dev/pandas/issues/40013)) +* [`Styler.from_custom_template()`](../reference/api/pandas.io.formats.style.Styler.from_custom_template.html#pandas.io.formats.style.Styler.from_custom_template "pandas.io.formats.style.Styler.from_custom_template") now has two new arguments for template names, and removed the old `name`, due to template inheritance having been introducing for better parsing ([GH 42053](https://github.com/pandas-dev/pandas/issues/42053)). Subclassing modifications to Styler attributes are also needed. + +### Build[#](#build "Link to this heading") + +* Documentation in `.pptx` and `.pdf` formats are no longer included in wheels or source distributions. ([GH 30741](https://github.com/pandas-dev/pandas/issues/30741)) + +## Deprecations[#](#deprecations "Link to this heading") + +### Deprecated dropping nuisance columns in DataFrame reductions and DataFrameGroupBy operations[#](#deprecated-dropping-nuisance-columns-in-dataframe-reductions-and-dataframegroupby-operations "Link to this heading") + +Calling a reduction (e.g. `.min`, `.max`, `.sum`) on a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with +`numeric_only=None` (the default), columns where the reduction raises a `TypeError` +are silently ignored and dropped from the result. + +This behavior is deprecated. In a future version, the `TypeError` will be raised, +and users will need to select only valid columns before calling the function. + +For example: + +```None +In [53]: df = pd.DataFrame({"A": [1, 2, 3, 4], "B": pd.date_range("2016-01-01", periods=4)}) + +In [54]: df +Out[54]: + A B +0 1 2016-01-01 +1 2 2016-01-02 +2 3 2016-01-03 +3 4 2016-01-04 +``` + +*Old behavior*: + +```None +In [3]: df.prod() +Out[3]: +Out[3]: +A 24 +dtype: int64 +``` + +*Future behavior*: + +```None +In [4]: df.prod() +... +TypeError: 'DatetimeArray' does not implement reduction 'prod' + +In [5]: df[["A"]].prod() +Out[5]: +A 24 +dtype: int64 +``` + +Similarly, when applying a function to `DataFrameGroupBy`, columns on which +the function raises `TypeError` are currently silently ignored and dropped +from the result. + +This behavior is deprecated. In a future version, the `TypeError` +will be raised, and users will need to select only valid columns before calling +the function. + +For example: + +```None +In [55]: df = pd.DataFrame({"A": [1, 2, 3, 4], "B": pd.date_range("2016-01-01", periods=4)}) + +In [56]: gb = df.groupby([1, 1, 2, 2]) +``` + +*Old behavior*: + +```None +In [4]: gb.prod(numeric_only=False) +Out[4]: +A +1 2 +2 12 +``` + +*Future behavior*: + +```None +In [5]: gb.prod(numeric_only=False) +... +TypeError: datetime64 type does not support prod operations + +In [6]: gb[["A"]].prod(numeric_only=False) +Out[6]: + A +1 2 +2 12 +``` + +### Other Deprecations[#](#other-deprecations "Link to this heading") + +* Deprecated allowing scalars to be passed to the [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") constructor ([GH 38433](https://github.com/pandas-dev/pandas/issues/38433)) +* Deprecated constructing [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") without passing list-like data ([GH 38944](https://github.com/pandas-dev/pandas/issues/38944)) +* Deprecated allowing subclass-specific keyword arguments in the [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") constructor, use the specific subclass directly instead ([GH 14093](https://github.com/pandas-dev/pandas/issues/14093), [GH 21311](https://github.com/pandas-dev/pandas/issues/21311), [GH 22315](https://github.com/pandas-dev/pandas/issues/22315), [GH 26974](https://github.com/pandas-dev/pandas/issues/26974)) +* Deprecated the `astype()` method of datetimelike (`timedelta64[ns]`, `datetime64[ns]`, `Datetime64TZDtype`, `PeriodDtype`) to convert to integer dtypes, use `values.view(...)` instead ([GH 38544](https://github.com/pandas-dev/pandas/issues/38544)). This deprecation was later reverted in pandas 1.4.0. +* Deprecated `MultiIndex.is_lexsorted()` and `MultiIndex.lexsort_depth()`, use `MultiIndex.is_monotonic_increasing()` instead ([GH 32259](https://github.com/pandas-dev/pandas/issues/32259)) +* Deprecated keyword `try_cast` in [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where"), [`Series.mask()`](../reference/api/pandas.Series.mask.html#pandas.Series.mask "pandas.Series.mask"), [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where"), [`DataFrame.mask()`](../reference/api/pandas.DataFrame.mask.html#pandas.DataFrame.mask "pandas.DataFrame.mask"); cast results manually if desired ([GH 38836](https://github.com/pandas-dev/pandas/issues/38836)) +* Deprecated comparison of [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") objects with `datetime.date` objects. Instead of e.g. `ts <= mydate` use `ts <= pd.Timestamp(mydate)` or `ts.date() <= mydate` ([GH 36131](https://github.com/pandas-dev/pandas/issues/36131)) +* Deprecated `Rolling.win_type` returning `"freq"` ([GH 38963](https://github.com/pandas-dev/pandas/issues/38963)) +* Deprecated `Rolling.is_datetimelike` ([GH 38963](https://github.com/pandas-dev/pandas/issues/38963)) +* Deprecated [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") indexer for `Series.__setitem__()` and `DataFrame.__setitem__()` ([GH 39004](https://github.com/pandas-dev/pandas/issues/39004)) +* Deprecated `ExponentialMovingWindow.vol()` ([GH 39220](https://github.com/pandas-dev/pandas/issues/39220)) +* Using `.astype` to convert between `datetime64[ns]` dtype and [`DatetimeTZDtype`](../reference/api/pandas.DatetimeTZDtype.html#pandas.DatetimeTZDtype "pandas.DatetimeTZDtype") is deprecated and will raise in a future version, use `obj.tz_localize` or `obj.dt.tz_localize` instead ([GH 38622](https://github.com/pandas-dev/pandas/issues/38622)) +* Deprecated casting `datetime.date` objects to `datetime64` when used as `fill_value` in [`DataFrame.unstack()`](../reference/api/pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack"), [`DataFrame.shift()`](../reference/api/pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift"), [`Series.shift()`](../reference/api/pandas.Series.shift.html#pandas.Series.shift "pandas.Series.shift"), and [`DataFrame.reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex"), pass `pd.Timestamp(dateobj)` instead ([GH 39767](https://github.com/pandas-dev/pandas/issues/39767)) +* Deprecated `Styler.set_na_rep()` and `Styler.set_precision()` in favor of [`Styler.format()`](../reference/api/pandas.io.formats.style.Styler.format.html#pandas.io.formats.style.Styler.format "pandas.io.formats.style.Styler.format") with `na_rep` and `precision` as existing and new input arguments respectively ([GH 40134](https://github.com/pandas-dev/pandas/issues/40134), [GH 40425](https://github.com/pandas-dev/pandas/issues/40425)) +* Deprecated `Styler.where()` in favor of using an alternative formulation with `Styler.applymap()` ([GH 40821](https://github.com/pandas-dev/pandas/issues/40821)) +* Deprecated allowing partial failure in [`Series.transform()`](../reference/api/pandas.Series.transform.html#pandas.Series.transform "pandas.Series.transform") and [`DataFrame.transform()`](../reference/api/pandas.DataFrame.transform.html#pandas.DataFrame.transform "pandas.DataFrame.transform") when `func` is list-like or dict-like and raises anything but `TypeError`; `func` raising anything but a `TypeError` will raise in a future version ([GH 40211](https://github.com/pandas-dev/pandas/issues/40211)) +* Deprecated arguments `error_bad_lines` and `warn_bad_lines` in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") and [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") in favor of argument `on_bad_lines` ([GH 15122](https://github.com/pandas-dev/pandas/issues/15122)) +* Deprecated support for `np.ma.mrecords.MaskedRecords` in the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor, pass `{name: data[name] for name in data.dtype.names}` instead ([GH 40363](https://github.com/pandas-dev/pandas/issues/40363)) +* Deprecated using [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge"), [`DataFrame.merge()`](../reference/api/pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge"), and [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") on a different number of levels ([GH 34862](https://github.com/pandas-dev/pandas/issues/34862)) +* Deprecated the use of `**kwargs` in [`ExcelWriter`](../reference/api/pandas.ExcelWriter.html#pandas.ExcelWriter "pandas.ExcelWriter"); use the keyword argument `engine_kwargs` instead ([GH 40430](https://github.com/pandas-dev/pandas/issues/40430)) +* Deprecated the `level` keyword for [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") aggregations; use groupby instead ([GH 39983](https://github.com/pandas-dev/pandas/issues/39983)) +* Deprecated the `inplace` parameter of `Categorical.remove_categories()`, `Categorical.add_categories()`, `Categorical.reorder_categories()`, `Categorical.rename_categories()`, `Categorical.set_categories()` and will be removed in a future version ([GH 37643](https://github.com/pandas-dev/pandas/issues/37643)) +* Deprecated [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") producing duplicated columns through the `suffixes` keyword and already existing columns ([GH 22818](https://github.com/pandas-dev/pandas/issues/22818)) +* Deprecated setting `Categorical._codes`, create a new [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") with the desired codes instead ([GH 40606](https://github.com/pandas-dev/pandas/issues/40606)) +* Deprecated the `convert_float` optional argument in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") and [`ExcelFile.parse()`](../reference/api/pandas.ExcelFile.parse.html#pandas.ExcelFile.parse "pandas.ExcelFile.parse") ([GH 41127](https://github.com/pandas-dev/pandas/issues/41127)) +* Deprecated behavior of `DatetimeIndex.union()` with mixed timezones; in a future version both will be cast to UTC instead of object dtype ([GH 39328](https://github.com/pandas-dev/pandas/issues/39328)) +* Deprecated using `usecols` with out of bounds indices for [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") with `engine="c"` ([GH 25623](https://github.com/pandas-dev/pandas/issues/25623)) +* Deprecated special treatment of lists with first element a Categorical in the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor; pass as `pd.DataFrame({col: categorical, ...})` instead ([GH 38845](https://github.com/pandas-dev/pandas/issues/38845)) +* Deprecated behavior of [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor when a `dtype` is passed and the data cannot be cast to that dtype. In a future version, this will raise instead of being silently ignored ([GH 24435](https://github.com/pandas-dev/pandas/issues/24435)) +* Deprecated the `Timestamp.freq` attribute. For the properties that use it (`is_month_start`, `is_month_end`, `is_quarter_start`, `is_quarter_end`, `is_year_start`, `is_year_end`), when you have a `freq`, use e.g. `freq.is_month_start(ts)` ([GH 15146](https://github.com/pandas-dev/pandas/issues/15146)) +* Deprecated construction of [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with `DatetimeTZDtype` data and `datetime64[ns]` dtype. Use `Series(data).dt.tz_localize(None)` instead ([GH 41555](https://github.com/pandas-dev/pandas/issues/41555), [GH 33401](https://github.com/pandas-dev/pandas/issues/33401)) +* Deprecated behavior of [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") construction with large-integer values and small-integer dtype silently overflowing; use `Series(data).astype(dtype)` instead ([GH 41734](https://github.com/pandas-dev/pandas/issues/41734)) +* Deprecated behavior of [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") construction with floating data and integer dtype casting even when lossy; in a future version this will remain floating, matching [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") behavior ([GH 41770](https://github.com/pandas-dev/pandas/issues/41770)) +* Deprecated inference of `timedelta64[ns]`, `datetime64[ns]`, or `DatetimeTZDtype` dtypes in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") construction when data containing strings is passed and no `dtype` is passed ([GH 33558](https://github.com/pandas-dev/pandas/issues/33558)) +* In a future version, constructing [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with `datetime64[ns]` data and `DatetimeTZDtype` will treat the data as wall-times instead of as UTC times (matching DatetimeIndex behavior). To treat the data as UTC times, use `pd.Series(data).dt.tz_localize("UTC").dt.tz_convert(dtype.tz)` or `pd.Series(data.view("int64"), dtype=dtype)` ([GH 33401](https://github.com/pandas-dev/pandas/issues/33401)) +* Deprecated passing lists as `key` to [`DataFrame.xs()`](../reference/api/pandas.DataFrame.xs.html#pandas.DataFrame.xs "pandas.DataFrame.xs") and [`Series.xs()`](../reference/api/pandas.Series.xs.html#pandas.Series.xs "pandas.Series.xs") ([GH 41760](https://github.com/pandas-dev/pandas/issues/41760)) +* Deprecated boolean arguments of `inclusive` in [`Series.between()`](../reference/api/pandas.Series.between.html#pandas.Series.between "pandas.Series.between") to have `{"left", "right", "neither", "both"}` as standard argument values ([GH 40628](https://github.com/pandas-dev/pandas/issues/40628)) +* Deprecated passing arguments as positional for all of the following, with exceptions noted ([GH 41485](https://github.com/pandas-dev/pandas/issues/41485)): + + + [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") (other than `objs`) + + [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") (other than `filepath_or_buffer`) + + [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") (other than `filepath_or_buffer`) + + [`DataFrame.clip()`](../reference/api/pandas.DataFrame.clip.html#pandas.DataFrame.clip "pandas.DataFrame.clip") and [`Series.clip()`](../reference/api/pandas.Series.clip.html#pandas.Series.clip "pandas.Series.clip") (other than `upper` and `lower`) + + [`DataFrame.drop_duplicates()`](../reference/api/pandas.DataFrame.drop_duplicates.html#pandas.DataFrame.drop_duplicates "pandas.DataFrame.drop_duplicates") (except for `subset`), [`Series.drop_duplicates()`](../reference/api/pandas.Series.drop_duplicates.html#pandas.Series.drop_duplicates "pandas.Series.drop_duplicates"), [`Index.drop_duplicates()`](../reference/api/pandas.Index.drop_duplicates.html#pandas.Index.drop_duplicates "pandas.Index.drop_duplicates") and `MultiIndex.drop_duplicates()` + + [`DataFrame.drop()`](../reference/api/pandas.DataFrame.drop.html#pandas.DataFrame.drop "pandas.DataFrame.drop") (other than `labels`) and [`Series.drop()`](../reference/api/pandas.Series.drop.html#pandas.Series.drop "pandas.Series.drop") + + [`DataFrame.dropna()`](../reference/api/pandas.DataFrame.dropna.html#pandas.DataFrame.dropna "pandas.DataFrame.dropna") and [`Series.dropna()`](../reference/api/pandas.Series.dropna.html#pandas.Series.dropna "pandas.Series.dropna") + + [`DataFrame.ffill()`](../reference/api/pandas.DataFrame.ffill.html#pandas.DataFrame.ffill "pandas.DataFrame.ffill"), [`Series.ffill()`](../reference/api/pandas.Series.ffill.html#pandas.Series.ffill "pandas.Series.ffill"), [`DataFrame.bfill()`](../reference/api/pandas.DataFrame.bfill.html#pandas.DataFrame.bfill "pandas.DataFrame.bfill"), and [`Series.bfill()`](../reference/api/pandas.Series.bfill.html#pandas.Series.bfill "pandas.Series.bfill") + + [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") and [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") (apart from `value`) + + [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") and [`Series.interpolate()`](../reference/api/pandas.Series.interpolate.html#pandas.Series.interpolate "pandas.Series.interpolate") (other than `method`) + + [`DataFrame.mask()`](../reference/api/pandas.DataFrame.mask.html#pandas.DataFrame.mask "pandas.DataFrame.mask") and [`Series.mask()`](../reference/api/pandas.Series.mask.html#pandas.Series.mask "pandas.Series.mask") (other than `cond` and `other`) + + [`DataFrame.reset_index()`](../reference/api/pandas.DataFrame.reset_index.html#pandas.DataFrame.reset_index "pandas.DataFrame.reset_index") (other than `level`) and [`Series.reset_index()`](../reference/api/pandas.Series.reset_index.html#pandas.Series.reset_index "pandas.Series.reset_index") + + [`DataFrame.set_axis()`](../reference/api/pandas.DataFrame.set_axis.html#pandas.DataFrame.set_axis "pandas.DataFrame.set_axis") and [`Series.set_axis()`](../reference/api/pandas.Series.set_axis.html#pandas.Series.set_axis "pandas.Series.set_axis") (other than `labels`) + + [`DataFrame.set_index()`](../reference/api/pandas.DataFrame.set_index.html#pandas.DataFrame.set_index "pandas.DataFrame.set_index") (other than `keys`) + + [`DataFrame.sort_index()`](../reference/api/pandas.DataFrame.sort_index.html#pandas.DataFrame.sort_index "pandas.DataFrame.sort_index") and [`Series.sort_index()`](../reference/api/pandas.Series.sort_index.html#pandas.Series.sort_index "pandas.Series.sort_index") + + [`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values") (other than `by`) and [`Series.sort_values()`](../reference/api/pandas.Series.sort_values.html#pandas.Series.sort_values "pandas.Series.sort_values") + + [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where") and [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where") (other than `cond` and `other`) + + [`Index.set_names()`](../reference/api/pandas.Index.set_names.html#pandas.Index.set_names "pandas.Index.set_names") and `MultiIndex.set_names()` (except for `names`) + + [`MultiIndex.codes()`](../reference/api/pandas.MultiIndex.codes.html#pandas.MultiIndex.codes "pandas.MultiIndex.codes") (except for `codes`) + + [`MultiIndex.set_levels()`](../reference/api/pandas.MultiIndex.set_levels.html#pandas.MultiIndex.set_levels "pandas.MultiIndex.set_levels") (except for `levels`) + + `Resampler.interpolate()` (other than `method`) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Performance improvement in `IntervalIndex.isin()` ([GH 38353](https://github.com/pandas-dev/pandas/issues/38353)) +* Performance improvement in [`Series.mean()`](../reference/api/pandas.Series.mean.html#pandas.Series.mean "pandas.Series.mean") for nullable data types ([GH 34814](https://github.com/pandas-dev/pandas/issues/34814)) +* Performance improvement in [`Series.isin()`](../reference/api/pandas.Series.isin.html#pandas.Series.isin "pandas.Series.isin") for nullable data types ([GH 38340](https://github.com/pandas-dev/pandas/issues/38340)) +* Performance improvement in [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") with `method="pad"` or `method="backfill"` for nullable floating and nullable integer dtypes ([GH 39953](https://github.com/pandas-dev/pandas/issues/39953)) +* Performance improvement in [`DataFrame.corr()`](../reference/api/pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr") for `method=kendall` ([GH 28329](https://github.com/pandas-dev/pandas/issues/28329)) +* Performance improvement in [`DataFrame.corr()`](../reference/api/pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr") for `method=spearman` ([GH 40956](https://github.com/pandas-dev/pandas/issues/40956), [GH 41885](https://github.com/pandas-dev/pandas/issues/41885)) +* Performance improvement in [`Rolling.corr()`](../reference/api/pandas.core.window.rolling.Rolling.corr.html#pandas.core.window.rolling.Rolling.corr "pandas.core.window.rolling.Rolling.corr") and [`Rolling.cov()`](../reference/api/pandas.core.window.rolling.Rolling.cov.html#pandas.core.window.rolling.Rolling.cov "pandas.core.window.rolling.Rolling.cov") ([GH 39388](https://github.com/pandas-dev/pandas/issues/39388)) +* Performance improvement in `RollingGroupby.corr()`, `ExpandingGroupby.corr()`, `ExpandingGroupby.corr()` and `ExpandingGroupby.cov()` ([GH 39591](https://github.com/pandas-dev/pandas/issues/39591)) +* Performance improvement in [`unique()`](../reference/api/pandas.unique.html#pandas.unique "pandas.unique") for object data type ([GH 37615](https://github.com/pandas-dev/pandas/issues/37615)) +* Performance improvement in [`json_normalize()`](../reference/api/pandas.json_normalize.html#pandas.json_normalize "pandas.json_normalize") for basic cases (including separators) ([GH 40035](https://github.com/pandas-dev/pandas/issues/40035) [GH 15621](https://github.com/pandas-dev/pandas/issues/15621)) +* Performance improvement in `ExpandingGroupby` aggregation methods ([GH 39664](https://github.com/pandas-dev/pandas/issues/39664)) +* Performance improvement in [`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") where render times are more than 50% reduced and now matches [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") ([GH 39972](https://github.com/pandas-dev/pandas/issues/39972) [GH 39952](https://github.com/pandas-dev/pandas/issues/39952), [GH 40425](https://github.com/pandas-dev/pandas/issues/40425)) +* The method [`Styler.set_td_classes()`](../reference/api/pandas.io.formats.style.Styler.set_td_classes.html#pandas.io.formats.style.Styler.set_td_classes "pandas.io.formats.style.Styler.set_td_classes") is now as performant as [`Styler.apply()`](../reference/api/pandas.io.formats.style.Styler.apply.html#pandas.io.formats.style.Styler.apply "pandas.io.formats.style.Styler.apply") and `Styler.applymap()`, and even more so in some cases ([GH 40453](https://github.com/pandas-dev/pandas/issues/40453)) +* Performance improvement in [`ExponentialMovingWindow.mean()`](../reference/api/pandas.core.window.ewm.ExponentialMovingWindow.mean.html#pandas.core.window.ewm.ExponentialMovingWindow.mean "pandas.core.window.ewm.ExponentialMovingWindow.mean") with `times` ([GH 39784](https://github.com/pandas-dev/pandas/issues/39784)) +* Performance improvement in [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") and [`SeriesGroupBy.apply()`](../reference/api/pandas.core.groupby.SeriesGroupBy.apply.html#pandas.core.groupby.SeriesGroupBy.apply "pandas.core.groupby.SeriesGroupBy.apply") when requiring the Python fallback implementation ([GH 40176](https://github.com/pandas-dev/pandas/issues/40176)) +* Performance improvement in the conversion of a PyArrow Boolean array to a pandas nullable Boolean array ([GH 41051](https://github.com/pandas-dev/pandas/issues/41051)) +* Performance improvement for concatenation of data with type [`CategoricalDtype`](../reference/api/pandas.CategoricalDtype.html#pandas.CategoricalDtype "pandas.CategoricalDtype") ([GH 40193](https://github.com/pandas-dev/pandas/issues/40193)) +* Performance improvement in [`DataFrameGroupBy.cummin()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cummin.html#pandas.core.groupby.DataFrameGroupBy.cummin "pandas.core.groupby.DataFrameGroupBy.cummin"), [`SeriesGroupBy.cummin()`](../reference/api/pandas.core.groupby.SeriesGroupBy.cummin.html#pandas.core.groupby.SeriesGroupBy.cummin "pandas.core.groupby.SeriesGroupBy.cummin"), [`DataFrameGroupBy.cummax()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cummax.html#pandas.core.groupby.DataFrameGroupBy.cummax "pandas.core.groupby.DataFrameGroupBy.cummax"), and [`SeriesGroupBy.cummax()`](../reference/api/pandas.core.groupby.SeriesGroupBy.cummax.html#pandas.core.groupby.SeriesGroupBy.cummax "pandas.core.groupby.SeriesGroupBy.cummax") with nullable data types ([GH 37493](https://github.com/pandas-dev/pandas/issues/37493)) +* Performance improvement in [`Series.nunique()`](../reference/api/pandas.Series.nunique.html#pandas.Series.nunique "pandas.Series.nunique") with nan values ([GH 40865](https://github.com/pandas-dev/pandas/issues/40865)) +* Performance improvement in [`DataFrame.transpose()`](../reference/api/pandas.DataFrame.transpose.html#pandas.DataFrame.transpose "pandas.DataFrame.transpose"), [`Series.unstack()`](../reference/api/pandas.Series.unstack.html#pandas.Series.unstack "pandas.Series.unstack") with `DatetimeTZDtype` ([GH 40149](https://github.com/pandas-dev/pandas/issues/40149)) +* Performance improvement in [`Series.plot()`](../reference/api/pandas.Series.plot.html#pandas.Series.plot "pandas.Series.plot") and [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") with entry point lazy loading ([GH 41492](https://github.com/pandas-dev/pandas/issues/41492)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +### Categorical[#](#categorical "Link to this heading") + +* Bug in [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") incorrectly failing to raise `TypeError` when scalar data is passed ([GH 38614](https://github.com/pandas-dev/pandas/issues/38614)) +* Bug in `CategoricalIndex.reindex` failed when the [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") passed was not categorical but whose values were all labels in the category ([GH 28690](https://github.com/pandas-dev/pandas/issues/28690)) +* Bug where constructing a [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") from an object-dtype array of `date` objects did not round-trip correctly with `astype` ([GH 38552](https://github.com/pandas-dev/pandas/issues/38552)) +* Bug in constructing a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") from an `ndarray` and a [`CategoricalDtype`](../reference/api/pandas.CategoricalDtype.html#pandas.CategoricalDtype "pandas.CategoricalDtype") ([GH 38857](https://github.com/pandas-dev/pandas/issues/38857)) +* Bug in setting categorical values into an object-dtype column in a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 39136](https://github.com/pandas-dev/pandas/issues/39136)) +* Bug in [`DataFrame.reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex") was raising an `IndexError` when the new index contained duplicates and the old index was a [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") ([GH 38906](https://github.com/pandas-dev/pandas/issues/38906)) +* Bug in `Categorical.fillna()` with a tuple-like category raising `NotImplementedError` instead of `ValueError` when filling with a non-category tuple ([GH 41914](https://github.com/pandas-dev/pandas/issues/41914)) + +### Datetimelike[#](#datetimelike "Link to this heading") + +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructors sometimes dropping nanoseconds from [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") (resp. [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta")) `data`, with `dtype=datetime64[ns]` (resp. `timedelta64[ns]`) ([GH 38032](https://github.com/pandas-dev/pandas/issues/38032)) +* Bug in [`DataFrame.first()`](../reference/api/pandas.DataFrame.first.html#pandas.DataFrame.first "pandas.DataFrame.first") and [`Series.first()`](../reference/api/pandas.Series.first.html#pandas.Series.first "pandas.Series.first") with an offset of one month returning an incorrect result when the first day is the last day of a month ([GH 29623](https://github.com/pandas-dev/pandas/issues/29623)) +* Bug in constructing a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") or [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with mismatched `datetime64` data and `timedelta64` dtype, or vice-versa, failing to raise a `TypeError` ([GH 38575](https://github.com/pandas-dev/pandas/issues/38575), [GH 38764](https://github.com/pandas-dev/pandas/issues/38764), [GH 38792](https://github.com/pandas-dev/pandas/issues/38792)) +* Bug in constructing a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a `datetime` object out of bounds for `datetime64[ns]` dtype or a `timedelta` object out of bounds for `timedelta64[ns]` dtype ([GH 38792](https://github.com/pandas-dev/pandas/issues/38792), [GH 38965](https://github.com/pandas-dev/pandas/issues/38965)) +* Bug in `DatetimeIndex.intersection()`, `DatetimeIndex.symmetric_difference()`, `PeriodIndex.intersection()`, `PeriodIndex.symmetric_difference()` always returning object-dtype when operating with [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") ([GH 38741](https://github.com/pandas-dev/pandas/issues/38741)) +* Bug in `DatetimeIndex.intersection()` giving incorrect results with non-Tick frequencies with `n != 1` ([GH 42104](https://github.com/pandas-dev/pandas/issues/42104)) +* Bug in [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where") incorrectly casting `datetime64` values to `int64` ([GH 37682](https://github.com/pandas-dev/pandas/issues/37682)) +* Bug in [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") incorrectly typecasting `datetime` object to `Timestamp` ([GH 38878](https://github.com/pandas-dev/pandas/issues/38878)) +* Bug in comparisons between [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") object and `datetime64` objects just outside the implementation bounds for nanosecond `datetime64` ([GH 39221](https://github.com/pandas-dev/pandas/issues/39221)) +* Bug in [`Timestamp.round()`](../reference/api/pandas.Timestamp.round.html#pandas.Timestamp.round "pandas.Timestamp.round"), [`Timestamp.floor()`](../reference/api/pandas.Timestamp.floor.html#pandas.Timestamp.floor "pandas.Timestamp.floor"), [`Timestamp.ceil()`](../reference/api/pandas.Timestamp.ceil.html#pandas.Timestamp.ceil "pandas.Timestamp.ceil") for values near the implementation bounds of [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") ([GH 39244](https://github.com/pandas-dev/pandas/issues/39244)) +* Bug in [`Timedelta.round()`](../reference/api/pandas.Timedelta.round.html#pandas.Timedelta.round "pandas.Timedelta.round"), [`Timedelta.floor()`](../reference/api/pandas.Timedelta.floor.html#pandas.Timedelta.floor "pandas.Timedelta.floor"), [`Timedelta.ceil()`](../reference/api/pandas.Timedelta.ceil.html#pandas.Timedelta.ceil "pandas.Timedelta.ceil") for values near the implementation bounds of [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") ([GH 38964](https://github.com/pandas-dev/pandas/issues/38964)) +* Bug in [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range") incorrectly creating [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") containing `NaT` instead of raising `OutOfBoundsDatetime` in corner cases ([GH 24124](https://github.com/pandas-dev/pandas/issues/24124)) +* Bug in [`infer_freq()`](../reference/api/pandas.infer_freq.html#pandas.infer_freq "pandas.infer_freq") incorrectly fails to infer ‘H’ frequency of [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") if the latter has a timezone and crosses DST boundaries ([GH 39556](https://github.com/pandas-dev/pandas/issues/39556)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") backed by `DatetimeArray` or `TimedeltaArray` sometimes failing to set the array’s `freq` to `None` ([GH 41425](https://github.com/pandas-dev/pandas/issues/41425)) + +### Timedelta[#](#timedelta "Link to this heading") + +* Bug in constructing [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") from `np.timedelta64` objects with non-nanosecond units that are out of bounds for `timedelta64[ns]` ([GH 38965](https://github.com/pandas-dev/pandas/issues/38965)) +* Bug in constructing a [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") incorrectly accepting `np.datetime64("NaT")` objects ([GH 39462](https://github.com/pandas-dev/pandas/issues/39462)) +* Bug in constructing [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") from an input string with only symbols and no digits failed to raise an error ([GH 39710](https://github.com/pandas-dev/pandas/issues/39710)) +* Bug in [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") and [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta") failing to raise when passed non-nanosecond `timedelta64` arrays that overflow when converting to `timedelta64[ns]` ([GH 40008](https://github.com/pandas-dev/pandas/issues/40008)) + +### Timezones[#](#timezones "Link to this heading") + +* Bug in different `tzinfo` objects representing UTC not being treated as equivalent ([GH 39216](https://github.com/pandas-dev/pandas/issues/39216)) +* Bug in `dateutil.tz.gettz("UTC")` not being recognized as equivalent to other UTC-representing tzinfos ([GH 39276](https://github.com/pandas-dev/pandas/issues/39276)) + +### Numeric[#](#numeric "Link to this heading") + +* Bug in [`DataFrame.quantile()`](../reference/api/pandas.DataFrame.quantile.html#pandas.DataFrame.quantile "pandas.DataFrame.quantile"), [`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values") causing incorrect subsequent indexing behavior ([GH 38351](https://github.com/pandas-dev/pandas/issues/38351)) +* Bug in [`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values") raising an [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError "(in Python v3.13)") for empty `by` ([GH 40258](https://github.com/pandas-dev/pandas/issues/40258)) +* Bug in [`DataFrame.select_dtypes()`](../reference/api/pandas.DataFrame.select_dtypes.html#pandas.DataFrame.select_dtypes "pandas.DataFrame.select_dtypes") with `include=np.number` would drop numeric `ExtensionDtype` columns ([GH 35340](https://github.com/pandas-dev/pandas/issues/35340)) +* Bug in [`DataFrame.mode()`](../reference/api/pandas.DataFrame.mode.html#pandas.DataFrame.mode "pandas.DataFrame.mode") and [`Series.mode()`](../reference/api/pandas.Series.mode.html#pandas.Series.mode "pandas.Series.mode") not keeping consistent integer [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") for empty input ([GH 33321](https://github.com/pandas-dev/pandas/issues/33321)) +* Bug in [`DataFrame.rank()`](../reference/api/pandas.DataFrame.rank.html#pandas.DataFrame.rank "pandas.DataFrame.rank") when the DataFrame contained `np.inf` ([GH 32593](https://github.com/pandas-dev/pandas/issues/32593)) +* Bug in [`DataFrame.rank()`](../reference/api/pandas.DataFrame.rank.html#pandas.DataFrame.rank "pandas.DataFrame.rank") with `axis=0` and columns holding incomparable types raising an `IndexError` ([GH 38932](https://github.com/pandas-dev/pandas/issues/38932)) +* Bug in [`Series.rank()`](../reference/api/pandas.Series.rank.html#pandas.Series.rank "pandas.Series.rank"), [`DataFrame.rank()`](../reference/api/pandas.DataFrame.rank.html#pandas.DataFrame.rank "pandas.DataFrame.rank"), [`DataFrameGroupBy.rank()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.rank.html#pandas.core.groupby.DataFrameGroupBy.rank "pandas.core.groupby.DataFrameGroupBy.rank"), and [`SeriesGroupBy.rank()`](../reference/api/pandas.core.groupby.SeriesGroupBy.rank.html#pandas.core.groupby.SeriesGroupBy.rank "pandas.core.groupby.SeriesGroupBy.rank") treating the most negative `int64` value as missing ([GH 32859](https://github.com/pandas-dev/pandas/issues/32859)) +* Bug in [`DataFrame.select_dtypes()`](../reference/api/pandas.DataFrame.select_dtypes.html#pandas.DataFrame.select_dtypes "pandas.DataFrame.select_dtypes") different behavior between Windows and Linux with `include="int"` ([GH 36596](https://github.com/pandas-dev/pandas/issues/36596)) +* Bug in [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") and [`DataFrame.agg()`](../reference/api/pandas.DataFrame.agg.html#pandas.DataFrame.agg "pandas.DataFrame.agg") when passed the argument `func="size"` would operate on the entire `DataFrame` instead of rows or columns ([GH 39934](https://github.com/pandas-dev/pandas/issues/39934)) +* Bug in [`DataFrame.transform()`](../reference/api/pandas.DataFrame.transform.html#pandas.DataFrame.transform "pandas.DataFrame.transform") would raise a `SpecificationError` when passed a dictionary and columns were missing; will now raise a `KeyError` instead ([GH 40004](https://github.com/pandas-dev/pandas/issues/40004)) +* Bug in [`DataFrameGroupBy.rank()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.rank.html#pandas.core.groupby.DataFrameGroupBy.rank "pandas.core.groupby.DataFrameGroupBy.rank") and [`SeriesGroupBy.rank()`](../reference/api/pandas.core.groupby.SeriesGroupBy.rank.html#pandas.core.groupby.SeriesGroupBy.rank "pandas.core.groupby.SeriesGroupBy.rank") giving incorrect results with `pct=True` and equal values between consecutive groups ([GH 40518](https://github.com/pandas-dev/pandas/issues/40518)) +* Bug in [`Series.count()`](../reference/api/pandas.Series.count.html#pandas.Series.count "pandas.Series.count") would result in an `int32` result on 32-bit platforms when argument `level=None` ([GH 40908](https://github.com/pandas-dev/pandas/issues/40908)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") reductions with methods `any` and `all` not returning Boolean results for object data ([GH 12863](https://github.com/pandas-dev/pandas/issues/12863), [GH 35450](https://github.com/pandas-dev/pandas/issues/35450), [GH 27709](https://github.com/pandas-dev/pandas/issues/27709)) +* Bug in [`Series.clip()`](../reference/api/pandas.Series.clip.html#pandas.Series.clip "pandas.Series.clip") would fail if the Series contains NA values and has nullable int or float as a data type ([GH 40851](https://github.com/pandas-dev/pandas/issues/40851)) +* Bug in `UInt64Index.where()` and `UInt64Index.putmask()` with an `np.int64` dtype `other` incorrectly raising `TypeError` ([GH 41974](https://github.com/pandas-dev/pandas/issues/41974)) +* Bug in [`DataFrame.agg()`](../reference/api/pandas.DataFrame.agg.html#pandas.DataFrame.agg "pandas.DataFrame.agg") not sorting the aggregated axis in the order of the provided aggregation functions when one or more aggregation function fails to produce results ([GH 33634](https://github.com/pandas-dev/pandas/issues/33634)) +* Bug in [`DataFrame.clip()`](../reference/api/pandas.DataFrame.clip.html#pandas.DataFrame.clip "pandas.DataFrame.clip") not interpreting missing values as no threshold ([GH 40420](https://github.com/pandas-dev/pandas/issues/40420)) + +### Conversion[#](#conversion "Link to this heading") + +* Bug in [`Series.to_dict()`](../reference/api/pandas.Series.to_dict.html#pandas.Series.to_dict "pandas.Series.to_dict") with `orient='records'` now returns Python native types ([GH 25969](https://github.com/pandas-dev/pandas/issues/25969)) +* Bug in [`Series.view()`](../reference/api/pandas.Series.view.html#pandas.Series.view "pandas.Series.view") and [`Index.view()`](../reference/api/pandas.Index.view.html#pandas.Index.view "pandas.Index.view") when converting between datetime-like (`datetime64[ns]`, `datetime64[ns, tz]`, `timedelta64`, `period`) dtypes ([GH 39788](https://github.com/pandas-dev/pandas/issues/39788)) +* Bug in creating a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") from an empty `np.recarray` not retaining the original dtypes ([GH 40121](https://github.com/pandas-dev/pandas/issues/40121)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") failing to raise a `TypeError` when constructing from a `frozenset` ([GH 40163](https://github.com/pandas-dev/pandas/issues/40163)) +* Bug in [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") construction silently ignoring a passed `dtype` when the data cannot be cast to that dtype ([GH 21311](https://github.com/pandas-dev/pandas/issues/21311)) +* Bug in `StringArray.astype()` falling back to NumPy and raising when converting to `dtype='categorical'` ([GH 40450](https://github.com/pandas-dev/pandas/issues/40450)) +* Bug in [`factorize()`](../reference/api/pandas.factorize.html#pandas.factorize "pandas.factorize") where, when given an array with a numeric NumPy dtype lower than int64, uint64 and float64, the unique values did not keep their original dtype ([GH 41132](https://github.com/pandas-dev/pandas/issues/41132)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") construction with a dictionary containing an array-like with `ExtensionDtype` and `copy=True` failing to make a copy ([GH 38939](https://github.com/pandas-dev/pandas/issues/38939)) +* Bug in [`qcut()`](../reference/api/pandas.qcut.html#pandas.qcut "pandas.qcut") raising error when taking `Float64DType` as input ([GH 40730](https://github.com/pandas-dev/pandas/issues/40730)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") construction with `datetime64[ns]` data and `dtype=object` resulting in `datetime` objects instead of [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") objects ([GH 41599](https://github.com/pandas-dev/pandas/issues/41599)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") construction with `timedelta64[ns]` data and `dtype=object` resulting in `np.timedelta64` objects instead of [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") objects ([GH 41599](https://github.com/pandas-dev/pandas/issues/41599)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") construction when given a two-dimensional object-dtype `np.ndarray` of [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") or [`Interval`](../reference/api/pandas.Interval.html#pandas.Interval "pandas.Interval") objects failing to cast to [`PeriodDtype`](../reference/api/pandas.PeriodDtype.html#pandas.PeriodDtype "pandas.PeriodDtype") or [`IntervalDtype`](../reference/api/pandas.IntervalDtype.html#pandas.IntervalDtype "pandas.IntervalDtype"), respectively ([GH 41812](https://github.com/pandas-dev/pandas/issues/41812)) +* Bug in constructing a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") from a list and a `PandasDtype` ([GH 39357](https://github.com/pandas-dev/pandas/issues/39357)) +* Bug in creating a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") from a `range` object that does not fit in the bounds of `int64` dtype ([GH 30173](https://github.com/pandas-dev/pandas/issues/30173)) +* Bug in creating a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") from a `dict` with all-tuple keys and an [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") that requires reindexing ([GH 41707](https://github.com/pandas-dev/pandas/issues/41707)) +* Bug in [`infer_dtype()`](../reference/api/pandas.api.types.infer_dtype.html#pandas.api.types.infer_dtype "pandas.api.types.infer_dtype") not recognizing Series, Index, or array with a Period dtype ([GH 23553](https://github.com/pandas-dev/pandas/issues/23553)) +* Bug in [`infer_dtype()`](../reference/api/pandas.api.types.infer_dtype.html#pandas.api.types.infer_dtype "pandas.api.types.infer_dtype") raising an error for general [`ExtensionArray`](../reference/api/pandas.api.extensions.ExtensionArray.html#pandas.api.extensions.ExtensionArray "pandas.api.extensions.ExtensionArray") objects. It will now return `"unknown-array"` instead of raising ([GH 37367](https://github.com/pandas-dev/pandas/issues/37367)) +* Bug in [`DataFrame.convert_dtypes()`](../reference/api/pandas.DataFrame.convert_dtypes.html#pandas.DataFrame.convert_dtypes "pandas.DataFrame.convert_dtypes") incorrectly raised a `ValueError` when called on an empty DataFrame ([GH 40393](https://github.com/pandas-dev/pandas/issues/40393)) + +### Strings[#](#strings "Link to this heading") + +* Bug in the conversion from `pyarrow.ChunkedArray` to [`StringArray`](../reference/api/pandas.arrays.StringArray.html#pandas.arrays.StringArray "pandas.arrays.StringArray") when the original had zero chunks ([GH 41040](https://github.com/pandas-dev/pandas/issues/41040)) +* Bug in [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") and [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") ignoring replacements with `regex=True` for `StringDType` data ([GH 41333](https://github.com/pandas-dev/pandas/issues/41333), [GH 35977](https://github.com/pandas-dev/pandas/issues/35977)) +* Bug in [`Series.str.extract()`](../reference/api/pandas.Series.str.extract.html#pandas.Series.str.extract "pandas.Series.str.extract") with [`StringArray`](../reference/api/pandas.arrays.StringArray.html#pandas.arrays.StringArray "pandas.arrays.StringArray") returning object dtype for an empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 41441](https://github.com/pandas-dev/pandas/issues/41441)) +* Bug in [`Series.str.replace()`](../reference/api/pandas.Series.str.replace.html#pandas.Series.str.replace "pandas.Series.str.replace") where the `case` argument was ignored when `regex=False` ([GH 41602](https://github.com/pandas-dev/pandas/issues/41602)) + +### Interval[#](#interval "Link to this heading") + +* Bug in `IntervalIndex.intersection()` and `IntervalIndex.symmetric_difference()` always returning object-dtype when operating with [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") ([GH 38653](https://github.com/pandas-dev/pandas/issues/38653), [GH 38741](https://github.com/pandas-dev/pandas/issues/38741)) +* Bug in `IntervalIndex.intersection()` returning duplicates when at least one of the [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") objects have duplicates which are present in the other ([GH 38743](https://github.com/pandas-dev/pandas/issues/38743)) +* `IntervalIndex.union()`, `IntervalIndex.intersection()`, `IntervalIndex.difference()`, and `IntervalIndex.symmetric_difference()` now cast to the appropriate dtype instead of raising a `TypeError` when operating with another [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") with incompatible dtype ([GH 39267](https://github.com/pandas-dev/pandas/issues/39267)) +* `PeriodIndex.union()`, `PeriodIndex.intersection()`, `PeriodIndex.symmetric_difference()`, `PeriodIndex.difference()` now cast to object dtype instead of raising `IncompatibleFrequency` when operating with another [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") with incompatible dtype ([GH 39306](https://github.com/pandas-dev/pandas/issues/39306)) +* Bug in `IntervalIndex.is_monotonic()`, [`IntervalIndex.get_loc()`](../reference/api/pandas.IntervalIndex.get_loc.html#pandas.IntervalIndex.get_loc "pandas.IntervalIndex.get_loc"), `IntervalIndex.get_indexer_for()`, and `IntervalIndex.__contains__()` when NA values are present ([GH 41831](https://github.com/pandas-dev/pandas/issues/41831)) + +### Indexing[#](#indexing "Link to this heading") + +* Bug in [`Index.union()`](../reference/api/pandas.Index.union.html#pandas.Index.union "pandas.Index.union") and `MultiIndex.union()` dropping duplicate `Index` values when `Index` was not monotonic or `sort` was set to `False` ([GH 36289](https://github.com/pandas-dev/pandas/issues/36289), [GH 31326](https://github.com/pandas-dev/pandas/issues/31326), [GH 40862](https://github.com/pandas-dev/pandas/issues/40862)) +* Bug in `CategoricalIndex.get_indexer()` failing to raise `InvalidIndexError` when non-unique ([GH 38372](https://github.com/pandas-dev/pandas/issues/38372)) +* Bug in [`IntervalIndex.get_indexer()`](../reference/api/pandas.IntervalIndex.get_indexer.html#pandas.IntervalIndex.get_indexer "pandas.IntervalIndex.get_indexer") when `target` has `CategoricalDtype` and both the index and the target contain NA values ([GH 41934](https://github.com/pandas-dev/pandas/issues/41934)) +* Bug in [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") raising a `ValueError` when input was filtered with a Boolean list and values to set were a list with lower dimension ([GH 20438](https://github.com/pandas-dev/pandas/issues/20438)) +* Bug in inserting many new columns into a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") causing incorrect subsequent indexing behavior ([GH 38380](https://github.com/pandas-dev/pandas/issues/38380)) +* Bug in `DataFrame.__setitem__()` raising a `ValueError` when setting multiple values to duplicate columns ([GH 15695](https://github.com/pandas-dev/pandas/issues/15695)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc"), [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc"), `DataFrame.__getitem__()` and `Series.__getitem__()` returning incorrect elements for non-monotonic [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") for string slices ([GH 33146](https://github.com/pandas-dev/pandas/issues/33146)) +* Bug in [`DataFrame.reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex") and [`Series.reindex()`](../reference/api/pandas.Series.reindex.html#pandas.Series.reindex "pandas.Series.reindex") with timezone aware indexes raising a `TypeError` for `method="ffill"` and `method="bfill"` and specified `tolerance` ([GH 38566](https://github.com/pandas-dev/pandas/issues/38566)) +* Bug in [`DataFrame.reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex") with `datetime64[ns]` or `timedelta64[ns]` incorrectly casting to integers when the `fill_value` requires casting to object dtype ([GH 39755](https://github.com/pandas-dev/pandas/issues/39755)) +* Bug in `DataFrame.__setitem__()` raising a `ValueError` when setting on an empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") using specified columns and a nonempty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") value ([GH 38831](https://github.com/pandas-dev/pandas/issues/38831)) +* Bug in `DataFrame.loc.__setitem__()` raising a `ValueError` when operating on a unique column when the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") has duplicate columns ([GH 38521](https://github.com/pandas-dev/pandas/issues/38521)) +* Bug in `DataFrame.iloc.__setitem__()` and `DataFrame.loc.__setitem__()` with mixed dtypes when setting with a dictionary value ([GH 38335](https://github.com/pandas-dev/pandas/issues/38335)) +* Bug in `Series.loc.__setitem__()` and `DataFrame.loc.__setitem__()` raising `KeyError` when provided a Boolean generator ([GH 39614](https://github.com/pandas-dev/pandas/issues/39614)) +* Bug in [`Series.iloc()`](../reference/api/pandas.Series.iloc.html#pandas.Series.iloc "pandas.Series.iloc") and [`DataFrame.iloc()`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") raising a `KeyError` when provided a generator ([GH 39614](https://github.com/pandas-dev/pandas/issues/39614)) +* Bug in `DataFrame.__setitem__()` not raising a `ValueError` when the right hand side is a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with wrong number of columns ([GH 38604](https://github.com/pandas-dev/pandas/issues/38604)) +* Bug in `Series.__setitem__()` raising a `ValueError` when setting a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with a scalar indexer ([GH 38303](https://github.com/pandas-dev/pandas/issues/38303)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") dropping levels of a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") when the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") used as input has only one row ([GH 10521](https://github.com/pandas-dev/pandas/issues/10521)) +* Bug in `DataFrame.__getitem__()` and `Series.__getitem__()` always raising `KeyError` when slicing with existing strings where the [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") has milliseconds ([GH 33589](https://github.com/pandas-dev/pandas/issues/33589)) +* Bug in setting `timedelta64` or `datetime64` values into numeric [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") failing to cast to object dtype ([GH 39086](https://github.com/pandas-dev/pandas/issues/39086), [GH 39619](https://github.com/pandas-dev/pandas/issues/39619)) +* Bug in setting [`Interval`](../reference/api/pandas.Interval.html#pandas.Interval "pandas.Interval") values into a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with mismatched [`IntervalDtype`](../reference/api/pandas.IntervalDtype.html#pandas.IntervalDtype "pandas.IntervalDtype") incorrectly casting the new values to the existing dtype ([GH 39120](https://github.com/pandas-dev/pandas/issues/39120)) +* Bug in setting `datetime64` values into a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with integer-dtype incorrectly casting the datetime64 values to integers ([GH 39266](https://github.com/pandas-dev/pandas/issues/39266)) +* Bug in setting `np.datetime64("NaT")` into a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `Datetime64TZDtype` incorrectly treating the timezone-naive value as timezone-aware ([GH 39769](https://github.com/pandas-dev/pandas/issues/39769)) +* Bug in [`Index.get_loc()`](../reference/api/pandas.Index.get_loc.html#pandas.Index.get_loc "pandas.Index.get_loc") not raising `KeyError` when `key=NaN` and `method` is specified but `NaN` is not in the [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") ([GH 39382](https://github.com/pandas-dev/pandas/issues/39382)) +* Bug in `DatetimeIndex.insert()` when inserting `np.datetime64("NaT")` into a timezone-aware index incorrectly treating the timezone-naive value as timezone-aware ([GH 39769](https://github.com/pandas-dev/pandas/issues/39769)) +* Bug in incorrectly raising in [`Index.insert()`](../reference/api/pandas.Index.insert.html#pandas.Index.insert "pandas.Index.insert"), when setting a new column that cannot be held in the existing `frame.columns`, or in [`Series.reset_index()`](../reference/api/pandas.Series.reset_index.html#pandas.Series.reset_index "pandas.Series.reset_index") or [`DataFrame.reset_index()`](../reference/api/pandas.DataFrame.reset_index.html#pandas.DataFrame.reset_index "pandas.DataFrame.reset_index") instead of casting to a compatible dtype ([GH 39068](https://github.com/pandas-dev/pandas/issues/39068)) +* Bug in `RangeIndex.append()` where a single object of length 1 was concatenated incorrectly ([GH 39401](https://github.com/pandas-dev/pandas/issues/39401)) +* Bug in `RangeIndex.astype()` where when converting to [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex"), the categories became a `Int64Index` instead of a [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") ([GH 41263](https://github.com/pandas-dev/pandas/issues/41263)) +* Bug in setting `numpy.timedelta64` values into an object-dtype [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") using a Boolean indexer ([GH 39488](https://github.com/pandas-dev/pandas/issues/39488)) +* Bug in setting numeric values into a into a boolean-dtypes [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") using `at` or `iat` failing to cast to object-dtype ([GH 39582](https://github.com/pandas-dev/pandas/issues/39582)) +* Bug in `DataFrame.__setitem__()` and `DataFrame.iloc.__setitem__()` raising `ValueError` when trying to index with a row-slice and setting a list as values ([GH 40440](https://github.com/pandas-dev/pandas/issues/40440)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") not raising `KeyError` when the key was not found in [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") and the levels were not fully specified ([GH 41170](https://github.com/pandas-dev/pandas/issues/41170)) +* Bug in `DataFrame.loc.__setitem__()` when setting-with-expansion incorrectly raising when the index in the expanding axis contained duplicates ([GH 40096](https://github.com/pandas-dev/pandas/issues/40096)) +* Bug in `DataFrame.loc.__getitem__()` with [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") casting to float when at least one index column has float dtype and we retrieve a scalar ([GH 41369](https://github.com/pandas-dev/pandas/issues/41369)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") incorrectly matching non-Boolean index elements ([GH 20432](https://github.com/pandas-dev/pandas/issues/20432)) +* Bug in indexing with `np.nan` on a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") incorrectly raising `KeyError` when `np.nan` keys are present ([GH 41933](https://github.com/pandas-dev/pandas/issues/41933)) +* Bug in `Series.__delitem__()` with `ExtensionDtype` incorrectly casting to `ndarray` ([GH 40386](https://github.com/pandas-dev/pandas/issues/40386)) +* Bug in [`DataFrame.at()`](../reference/api/pandas.DataFrame.at.html#pandas.DataFrame.at "pandas.DataFrame.at") with a [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") returning incorrect results when passed integer keys ([GH 41846](https://github.com/pandas-dev/pandas/issues/41846)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") returning a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") in the wrong order if an indexer has duplicates ([GH 40978](https://github.com/pandas-dev/pandas/issues/40978)) +* Bug in `DataFrame.__setitem__()` raising a `TypeError` when using a `str` subclass as the column name with a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") ([GH 37366](https://github.com/pandas-dev/pandas/issues/37366)) +* Bug in `PeriodIndex.get_loc()` failing to raise a `KeyError` when given a [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") with a mismatched `freq` ([GH 41670](https://github.com/pandas-dev/pandas/issues/41670)) +* Bug `.loc.__getitem__` with a `UInt64Index` and negative-integer keys raising `OverflowError` instead of `KeyError` in some cases, wrapping around to positive integers in others ([GH 41777](https://github.com/pandas-dev/pandas/issues/41777)) +* Bug in [`Index.get_indexer()`](../reference/api/pandas.Index.get_indexer.html#pandas.Index.get_indexer "pandas.Index.get_indexer") failing to raise `ValueError` in some cases with invalid `method`, `limit`, or `tolerance` arguments ([GH 41918](https://github.com/pandas-dev/pandas/issues/41918)) +* Bug when slicing a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") when passing an invalid string raising `ValueError` instead of a `TypeError` ([GH 41821](https://github.com/pandas-dev/pandas/issues/41821)) +* Bug in [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") constructor sometimes silently ignoring a specified `dtype` ([GH 38879](https://github.com/pandas-dev/pandas/issues/38879)) +* [`Index.where()`](../reference/api/pandas.Index.where.html#pandas.Index.where "pandas.Index.where") behavior now mirrors [`Index.putmask()`](../reference/api/pandas.Index.putmask.html#pandas.Index.putmask "pandas.Index.putmask") behavior, i.e. `index.where(mask, other)` matches `index.putmask(~mask, other)` ([GH 39412](https://github.com/pandas-dev/pandas/issues/39412)) + +### Missing[#](#missing "Link to this heading") + +* Bug in [`Grouper`](../reference/api/pandas.Grouper.html#pandas.Grouper "pandas.Grouper") did not correctly propagate the `dropna` argument; [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") now correctly handles missing values for `dropna=True` ([GH 35612](https://github.com/pandas-dev/pandas/issues/35612)) +* Bug in [`isna()`](../reference/api/pandas.isna.html#pandas.isna "pandas.isna"), [`Series.isna()`](../reference/api/pandas.Series.isna.html#pandas.Series.isna "pandas.Series.isna"), [`Index.isna()`](../reference/api/pandas.Index.isna.html#pandas.Index.isna "pandas.Index.isna"), [`DataFrame.isna()`](../reference/api/pandas.DataFrame.isna.html#pandas.DataFrame.isna "pandas.DataFrame.isna"), and the corresponding `notna` functions not recognizing `Decimal("NaN")` objects ([GH 39409](https://github.com/pandas-dev/pandas/issues/39409)) +* Bug in [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") not accepting a dictionary for the `downcast` keyword ([GH 40809](https://github.com/pandas-dev/pandas/issues/40809)) +* Bug in [`isna()`](../reference/api/pandas.isna.html#pandas.isna "pandas.isna") not returning a copy of the mask for nullable types, causing any subsequent mask modification to change the original array ([GH 40935](https://github.com/pandas-dev/pandas/issues/40935)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") construction with float data containing `NaN` and an integer `dtype` casting instead of retaining the `NaN` ([GH 26919](https://github.com/pandas-dev/pandas/issues/26919)) +* Bug in [`Series.isin()`](../reference/api/pandas.Series.isin.html#pandas.Series.isin "pandas.Series.isin") and `MultiIndex.isin()` didn’t treat all nans as equivalent if they were in tuples ([GH 41836](https://github.com/pandas-dev/pandas/issues/41836)) + +### MultiIndex[#](#multiindex "Link to this heading") + +* Bug in [`DataFrame.drop()`](../reference/api/pandas.DataFrame.drop.html#pandas.DataFrame.drop "pandas.DataFrame.drop") raising a `TypeError` when the [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") is non-unique and `level` is not provided ([GH 36293](https://github.com/pandas-dev/pandas/issues/36293)) +* Bug in `MultiIndex.intersection()` duplicating `NaN` in the result ([GH 38623](https://github.com/pandas-dev/pandas/issues/38623)) +* Bug in `MultiIndex.equals()` incorrectly returning `True` when the [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") contained `NaN` even when they are differently ordered ([GH 38439](https://github.com/pandas-dev/pandas/issues/38439)) +* Bug in `MultiIndex.intersection()` always returning an empty result when intersecting with [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") ([GH 38653](https://github.com/pandas-dev/pandas/issues/38653)) +* Bug in `MultiIndex.difference()` incorrectly raising `TypeError` when indexes contain non-sortable entries ([GH 41915](https://github.com/pandas-dev/pandas/issues/41915)) +* Bug in `MultiIndex.reindex()` raising a `ValueError` when used on an empty [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") and indexing only a specific level ([GH 41170](https://github.com/pandas-dev/pandas/issues/41170)) +* Bug in `MultiIndex.reindex()` raising `TypeError` when reindexing against a flat [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") ([GH 41707](https://github.com/pandas-dev/pandas/issues/41707)) + +### I/O[#](#i-o "Link to this heading") + +* Bug in `Index.__repr__()` when `display.max_seq_items=1` ([GH 38415](https://github.com/pandas-dev/pandas/issues/38415)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") not recognizing scientific notation if the argument `decimal` is set and `engine="python"` ([GH 31920](https://github.com/pandas-dev/pandas/issues/31920)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") interpreting `NA` value as comment, when `NA` does contain the comment string fixed for `engine="python"` ([GH 34002](https://github.com/pandas-dev/pandas/issues/34002)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") raising an `IndexError` with multiple header columns and `index_col` is specified when the file has no data rows ([GH 38292](https://github.com/pandas-dev/pandas/issues/38292)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") not accepting `usecols` with a different length than `names` for `engine="python"` ([GH 16469](https://github.com/pandas-dev/pandas/issues/16469)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") returning object dtype when `delimiter=","` with `usecols` and `parse_dates` specified for `engine="python"` ([GH 35873](https://github.com/pandas-dev/pandas/issues/35873)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") raising a `TypeError` when `names` and `parse_dates` is specified for `engine="c"` ([GH 33699](https://github.com/pandas-dev/pandas/issues/33699)) +* Bug in [`read_clipboard()`](../reference/api/pandas.read_clipboard.html#pandas.read_clipboard "pandas.read_clipboard") and [`DataFrame.to_clipboard()`](../reference/api/pandas.DataFrame.to_clipboard.html#pandas.DataFrame.to_clipboard "pandas.DataFrame.to_clipboard") not working in WSL ([GH 38527](https://github.com/pandas-dev/pandas/issues/38527)) +* Allow custom error values for the `parse_dates` argument of [`read_sql()`](../reference/api/pandas.read_sql.html#pandas.read_sql "pandas.read_sql"), [`read_sql_query()`](../reference/api/pandas.read_sql_query.html#pandas.read_sql_query "pandas.read_sql_query") and [`read_sql_table()`](../reference/api/pandas.read_sql_table.html#pandas.read_sql_table "pandas.read_sql_table") ([GH 35185](https://github.com/pandas-dev/pandas/issues/35185)) +* Bug in [`DataFrame.to_hdf()`](../reference/api/pandas.DataFrame.to_hdf.html#pandas.DataFrame.to_hdf "pandas.DataFrame.to_hdf") and [`Series.to_hdf()`](../reference/api/pandas.Series.to_hdf.html#pandas.Series.to_hdf "pandas.Series.to_hdf") raising a `KeyError` when trying to apply for subclasses of `DataFrame` or `Series` ([GH 33748](https://github.com/pandas-dev/pandas/issues/33748)) +* Bug in [`HDFStore.put()`](../reference/api/pandas.HDFStore.put.html#pandas.HDFStore.put "pandas.HDFStore.put") raising a wrong `TypeError` when saving a DataFrame with non-string dtype ([GH 34274](https://github.com/pandas-dev/pandas/issues/34274)) +* Bug in [`json_normalize()`](../reference/api/pandas.json_normalize.html#pandas.json_normalize "pandas.json_normalize") resulting in the first element of a generator object not being included in the returned DataFrame ([GH 35923](https://github.com/pandas-dev/pandas/issues/35923)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") applying the thousands separator to date columns when the column should be parsed for dates and `usecols` is specified for `engine="python"` ([GH 39365](https://github.com/pandas-dev/pandas/issues/39365)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") forward filling [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") names when multiple header and index columns are specified ([GH 34673](https://github.com/pandas-dev/pandas/issues/34673)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") not respecting [`set_option()`](../reference/api/pandas.set_option.html#pandas.set_option "pandas.set_option") ([GH 34252](https://github.com/pandas-dev/pandas/issues/34252)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") not switching `true_values` and `false_values` for nullable Boolean dtype ([GH 34655](https://github.com/pandas-dev/pandas/issues/34655)) +* Bug in [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") when `orient="split"` not maintaining a numeric string index ([GH 28556](https://github.com/pandas-dev/pandas/issues/28556)) +* [`read_sql()`](../reference/api/pandas.read_sql.html#pandas.read_sql "pandas.read_sql") returned an empty generator if `chunksize` was non-zero and the query returned no results. Now returns a generator with a single empty DataFrame ([GH 34411](https://github.com/pandas-dev/pandas/issues/34411)) +* Bug in [`read_hdf()`](../reference/api/pandas.read_hdf.html#pandas.read_hdf "pandas.read_hdf") returning unexpected records when filtering on categorical string columns using the `where` parameter ([GH 39189](https://github.com/pandas-dev/pandas/issues/39189)) +* Bug in [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") raising a `ValueError` when `datetimes` were null ([GH 39725](https://github.com/pandas-dev/pandas/issues/39725)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") dropping empty values from single-column spreadsheets ([GH 39808](https://github.com/pandas-dev/pandas/issues/39808)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") loading trailing empty rows/columns for some filetypes ([GH 41167](https://github.com/pandas-dev/pandas/issues/41167)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") raising an `AttributeError` when the excel file had a `MultiIndex` header followed by two empty rows and no index ([GH 40442](https://github.com/pandas-dev/pandas/issues/40442)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel"), [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv"), [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table"), [`read_fwf()`](../reference/api/pandas.read_fwf.html#pandas.read_fwf "pandas.read_fwf"), and [`read_clipboard()`](../reference/api/pandas.read_clipboard.html#pandas.read_clipboard "pandas.read_clipboard") where one blank row after a `MultiIndex` header with no index would be dropped ([GH 40442](https://github.com/pandas-dev/pandas/issues/40442)) +* Bug in [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string") misplacing the truncation column when `index=False` ([GH 40904](https://github.com/pandas-dev/pandas/issues/40904)) +* Bug in [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string") adding an extra dot and misaligning the truncation row when `index=False` ([GH 40904](https://github.com/pandas-dev/pandas/issues/40904)) +* Bug in [`read_orc()`](../reference/api/pandas.read_orc.html#pandas.read_orc "pandas.read_orc") always raising an `AttributeError` ([GH 40918](https://github.com/pandas-dev/pandas/issues/40918)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") and [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") silently ignoring `prefix` if `names` and `prefix` are defined, now raising a `ValueError` ([GH 39123](https://github.com/pandas-dev/pandas/issues/39123)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") and [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") not respecting the dtype for a duplicated column name when `mangle_dupe_cols` is set to `True` ([GH 35211](https://github.com/pandas-dev/pandas/issues/35211)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") silently ignoring `sep` if `delimiter` and `sep` are defined, now raising a `ValueError` ([GH 39823](https://github.com/pandas-dev/pandas/issues/39823)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") and [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") misinterpreting arguments when `sys.setprofile` had been previously called ([GH 41069](https://github.com/pandas-dev/pandas/issues/41069)) +* Bug in the conversion from PyArrow to pandas (e.g. for reading Parquet) with nullable dtypes and a PyArrow array whose data buffer size is not a multiple of the dtype size ([GH 40896](https://github.com/pandas-dev/pandas/issues/40896)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") would raise an error when pandas could not determine the file type even though the user specified the `engine` argument ([GH 41225](https://github.com/pandas-dev/pandas/issues/41225)) +* Bug in [`read_clipboard()`](../reference/api/pandas.read_clipboard.html#pandas.read_clipboard "pandas.read_clipboard") copying from an excel file shifts values into the wrong column if there are null values in first column ([GH 41108](https://github.com/pandas-dev/pandas/issues/41108)) +* Bug in [`DataFrame.to_hdf()`](../reference/api/pandas.DataFrame.to_hdf.html#pandas.DataFrame.to_hdf "pandas.DataFrame.to_hdf") and [`Series.to_hdf()`](../reference/api/pandas.Series.to_hdf.html#pandas.Series.to_hdf "pandas.Series.to_hdf") raising a `TypeError` when trying to append a string column to an incompatible column ([GH 41897](https://github.com/pandas-dev/pandas/issues/41897)) + +### Period[#](#period "Link to this heading") + +* Comparisons of [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") objects or [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with mismatched `PeriodDtype` now behave like other mismatched-type comparisons, returning `False` for equals, `True` for not-equal, and raising `TypeError` for inequality checks ([GH 39274](https://github.com/pandas-dev/pandas/issues/39274)) + +### Plotting[#](#plotting "Link to this heading") + +* Bug in [`plotting.scatter_matrix()`](../reference/api/pandas.plotting.scatter_matrix.html#pandas.plotting.scatter_matrix "pandas.plotting.scatter_matrix") raising when 2d `ax` argument passed ([GH 16253](https://github.com/pandas-dev/pandas/issues/16253)) +* Prevent warnings when Matplotlib’s `constrained_layout` is enabled ([GH 25261](https://github.com/pandas-dev/pandas/issues/25261)) +* Bug in [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") was showing the wrong colors in the legend if the function was called repeatedly and some calls used `yerr` while others didn’t ([GH 39522](https://github.com/pandas-dev/pandas/issues/39522)) +* Bug in [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") was showing the wrong colors in the legend if the function was called repeatedly and some calls used `secondary_y` and others use `legend=False` ([GH 40044](https://github.com/pandas-dev/pandas/issues/40044)) +* Bug in [`DataFrame.plot.box()`](../reference/api/pandas.DataFrame.plot.box.html#pandas.DataFrame.plot.box "pandas.DataFrame.plot.box") when `dark_background` theme was selected, caps or min/max markers for the plot were not visible ([GH 40769](https://github.com/pandas-dev/pandas/issues/40769)) + +### Groupby/resample/rolling[#](#groupby-resample-rolling "Link to this heading") + +* Bug in [`DataFrameGroupBy.agg()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg") and [`SeriesGroupBy.agg()`](../reference/api/pandas.core.groupby.SeriesGroupBy.agg.html#pandas.core.groupby.SeriesGroupBy.agg "pandas.core.groupby.SeriesGroupBy.agg") with [`PeriodDtype`](../reference/api/pandas.PeriodDtype.html#pandas.PeriodDtype "pandas.PeriodDtype") columns incorrectly casting results too aggressively ([GH 38254](https://github.com/pandas-dev/pandas/issues/38254)) +* Bug in [`SeriesGroupBy.value_counts()`](../reference/api/pandas.core.groupby.SeriesGroupBy.value_counts.html#pandas.core.groupby.SeriesGroupBy.value_counts "pandas.core.groupby.SeriesGroupBy.value_counts") where unobserved categories in a grouped categorical Series were not tallied ([GH 38672](https://github.com/pandas-dev/pandas/issues/38672)) +* Bug in [`SeriesGroupBy.value_counts()`](../reference/api/pandas.core.groupby.SeriesGroupBy.value_counts.html#pandas.core.groupby.SeriesGroupBy.value_counts "pandas.core.groupby.SeriesGroupBy.value_counts") where an error was raised on an empty Series ([GH 39172](https://github.com/pandas-dev/pandas/issues/39172)) +* Bug in `GroupBy.indices()` would contain non-existent indices when null values were present in the groupby keys ([GH 9304](https://github.com/pandas-dev/pandas/issues/9304)) +* Fixed bug in [`DataFrameGroupBy.sum()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.sum.html#pandas.core.groupby.DataFrameGroupBy.sum "pandas.core.groupby.DataFrameGroupBy.sum") and [`SeriesGroupBy.sum()`](../reference/api/pandas.core.groupby.SeriesGroupBy.sum.html#pandas.core.groupby.SeriesGroupBy.sum "pandas.core.groupby.SeriesGroupBy.sum") causing a loss of precision by now using Kahan summation ([GH 38778](https://github.com/pandas-dev/pandas/issues/38778)) +* Fixed bug in [`DataFrameGroupBy.cumsum()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cumsum.html#pandas.core.groupby.DataFrameGroupBy.cumsum "pandas.core.groupby.DataFrameGroupBy.cumsum"), [`SeriesGroupBy.cumsum()`](../reference/api/pandas.core.groupby.SeriesGroupBy.cumsum.html#pandas.core.groupby.SeriesGroupBy.cumsum "pandas.core.groupby.SeriesGroupBy.cumsum"), [`DataFrameGroupBy.mean()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.mean.html#pandas.core.groupby.DataFrameGroupBy.mean "pandas.core.groupby.DataFrameGroupBy.mean"), and [`SeriesGroupBy.mean()`](../reference/api/pandas.core.groupby.SeriesGroupBy.mean.html#pandas.core.groupby.SeriesGroupBy.mean "pandas.core.groupby.SeriesGroupBy.mean") causing loss of precision through using Kahan summation ([GH 38934](https://github.com/pandas-dev/pandas/issues/38934)) +* Bug in [`Resampler.aggregate()`](../reference/api/pandas.core.resample.Resampler.aggregate.html#pandas.core.resample.Resampler.aggregate "pandas.core.resample.Resampler.aggregate") and [`DataFrame.transform()`](../reference/api/pandas.DataFrame.transform.html#pandas.DataFrame.transform "pandas.DataFrame.transform") raising a `TypeError` instead of `SpecificationError` when missing keys had mixed dtypes ([GH 39025](https://github.com/pandas-dev/pandas/issues/39025)) +* Bug in [`DataFrameGroupBy.idxmin()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.idxmin.html#pandas.core.groupby.DataFrameGroupBy.idxmin "pandas.core.groupby.DataFrameGroupBy.idxmin") and [`DataFrameGroupBy.idxmax()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.idxmax.html#pandas.core.groupby.DataFrameGroupBy.idxmax "pandas.core.groupby.DataFrameGroupBy.idxmax") with `ExtensionDtype` columns ([GH 38733](https://github.com/pandas-dev/pandas/issues/38733)) +* Bug in [`Series.resample()`](../reference/api/pandas.Series.resample.html#pandas.Series.resample "pandas.Series.resample") would raise when the index was a [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") consisting of `NaT` ([GH 39227](https://github.com/pandas-dev/pandas/issues/39227)) +* Bug in `RollingGroupby.corr()` and `ExpandingGroupby.corr()` where the groupby column would return `0` instead of `np.nan` when providing `other` that was longer than each group ([GH 39591](https://github.com/pandas-dev/pandas/issues/39591)) +* Bug in `ExpandingGroupby.corr()` and `ExpandingGroupby.cov()` where `1` would be returned instead of `np.nan` when providing `other` that was longer than each group ([GH 39591](https://github.com/pandas-dev/pandas/issues/39591)) +* Bug in [`DataFrameGroupBy.mean()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.mean.html#pandas.core.groupby.DataFrameGroupBy.mean "pandas.core.groupby.DataFrameGroupBy.mean"), [`SeriesGroupBy.mean()`](../reference/api/pandas.core.groupby.SeriesGroupBy.mean.html#pandas.core.groupby.SeriesGroupBy.mean "pandas.core.groupby.SeriesGroupBy.mean"), [`DataFrameGroupBy.median()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.median.html#pandas.core.groupby.DataFrameGroupBy.median "pandas.core.groupby.DataFrameGroupBy.median"), [`SeriesGroupBy.median()`](../reference/api/pandas.core.groupby.SeriesGroupBy.median.html#pandas.core.groupby.SeriesGroupBy.median "pandas.core.groupby.SeriesGroupBy.median"), and [`DataFrame.pivot_table()`](../reference/api/pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table") not propagating metadata ([GH 28283](https://github.com/pandas-dev/pandas/issues/28283)) +* Bug in [`Series.rolling()`](../reference/api/pandas.Series.rolling.html#pandas.Series.rolling "pandas.Series.rolling") and [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") not calculating window bounds correctly when window is an offset and dates are in descending order ([GH 40002](https://github.com/pandas-dev/pandas/issues/40002)) +* Bug in [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") and [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") on an empty `Series` or `DataFrame` would lose index, columns, and/or data types when directly using the methods `idxmax`, `idxmin`, `mad`, `min`, `max`, `sum`, `prod`, and `skew` or using them through `apply`, `aggregate`, or `resample` ([GH 26411](https://github.com/pandas-dev/pandas/issues/26411)) +* Bug in [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") and [`SeriesGroupBy.apply()`](../reference/api/pandas.core.groupby.SeriesGroupBy.apply.html#pandas.core.groupby.SeriesGroupBy.apply "pandas.core.groupby.SeriesGroupBy.apply") where a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") would be created instead of an [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") when used on a `RollingGroupby` object ([GH 39732](https://github.com/pandas-dev/pandas/issues/39732)) +* Bug in [`DataFrameGroupBy.sample()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.sample.html#pandas.core.groupby.DataFrameGroupBy.sample "pandas.core.groupby.DataFrameGroupBy.sample") where an error was raised when `weights` was specified and the index was an `Int64Index` ([GH 39927](https://github.com/pandas-dev/pandas/issues/39927)) +* Bug in [`DataFrameGroupBy.aggregate()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.aggregate.html#pandas.core.groupby.DataFrameGroupBy.aggregate "pandas.core.groupby.DataFrameGroupBy.aggregate") and [`Resampler.aggregate()`](../reference/api/pandas.core.resample.Resampler.aggregate.html#pandas.core.resample.Resampler.aggregate "pandas.core.resample.Resampler.aggregate") would sometimes raise a `SpecificationError` when passed a dictionary and columns were missing; will now always raise a `KeyError` instead ([GH 40004](https://github.com/pandas-dev/pandas/issues/40004)) +* Bug in [`DataFrameGroupBy.sample()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.sample.html#pandas.core.groupby.DataFrameGroupBy.sample "pandas.core.groupby.DataFrameGroupBy.sample") where column selection was not applied before computing the result ([GH 39928](https://github.com/pandas-dev/pandas/issues/39928)) +* Bug in `ExponentialMovingWindow` when calling `__getitem__` would incorrectly raise a `ValueError` when providing `times` ([GH 40164](https://github.com/pandas-dev/pandas/issues/40164)) +* Bug in `ExponentialMovingWindow` when calling `__getitem__` would not retain `com`, `span`, `alpha` or `halflife` attributes ([GH 40164](https://github.com/pandas-dev/pandas/issues/40164)) +* `ExponentialMovingWindow` now raises a `NotImplementedError` when specifying `times` with `adjust=False` due to an incorrect calculation ([GH 40098](https://github.com/pandas-dev/pandas/issues/40098)) +* Bug in `ExponentialMovingWindowGroupby.mean()` where the `times` argument was ignored when `engine='numba'` ([GH 40951](https://github.com/pandas-dev/pandas/issues/40951)) +* Bug in `ExponentialMovingWindowGroupby.mean()` where the wrong times were used the in case of multiple groups ([GH 40951](https://github.com/pandas-dev/pandas/issues/40951)) +* Bug in `ExponentialMovingWindowGroupby` where the times vector and values became out of sync for non-trivial groups ([GH 40951](https://github.com/pandas-dev/pandas/issues/40951)) +* Bug in [`Series.asfreq()`](../reference/api/pandas.Series.asfreq.html#pandas.Series.asfreq "pandas.Series.asfreq") and [`DataFrame.asfreq()`](../reference/api/pandas.DataFrame.asfreq.html#pandas.DataFrame.asfreq "pandas.DataFrame.asfreq") dropping rows when the index was not sorted ([GH 39805](https://github.com/pandas-dev/pandas/issues/39805)) +* Bug in aggregation functions for [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") not respecting `numeric_only` argument when `level` keyword was given ([GH 40660](https://github.com/pandas-dev/pandas/issues/40660)) +* Bug in [`SeriesGroupBy.aggregate()`](../reference/api/pandas.core.groupby.SeriesGroupBy.aggregate.html#pandas.core.groupby.SeriesGroupBy.aggregate "pandas.core.groupby.SeriesGroupBy.aggregate") where using a user-defined function to aggregate a Series with an object-typed [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") causes an incorrect [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") shape ([GH 40014](https://github.com/pandas-dev/pandas/issues/40014)) +* Bug in `RollingGroupby` where `as_index=False` argument in `groupby` was ignored ([GH 39433](https://github.com/pandas-dev/pandas/issues/39433)) +* Bug in [`DataFrameGroupBy.any()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.any.html#pandas.core.groupby.DataFrameGroupBy.any "pandas.core.groupby.DataFrameGroupBy.any"), [`SeriesGroupBy.any()`](../reference/api/pandas.core.groupby.SeriesGroupBy.any.html#pandas.core.groupby.SeriesGroupBy.any "pandas.core.groupby.SeriesGroupBy.any"), [`DataFrameGroupBy.all()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.all.html#pandas.core.groupby.DataFrameGroupBy.all "pandas.core.groupby.DataFrameGroupBy.all") and [`SeriesGroupBy.all()`](../reference/api/pandas.core.groupby.SeriesGroupBy.all.html#pandas.core.groupby.SeriesGroupBy.all "pandas.core.groupby.SeriesGroupBy.all") raising a `ValueError` when using with nullable type columns holding `NA` even with `skipna=True` ([GH 40585](https://github.com/pandas-dev/pandas/issues/40585)) +* Bug in [`DataFrameGroupBy.cummin()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cummin.html#pandas.core.groupby.DataFrameGroupBy.cummin "pandas.core.groupby.DataFrameGroupBy.cummin"), [`SeriesGroupBy.cummin()`](../reference/api/pandas.core.groupby.SeriesGroupBy.cummin.html#pandas.core.groupby.SeriesGroupBy.cummin "pandas.core.groupby.SeriesGroupBy.cummin"), [`DataFrameGroupBy.cummax()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cummax.html#pandas.core.groupby.DataFrameGroupBy.cummax "pandas.core.groupby.DataFrameGroupBy.cummax") and [`SeriesGroupBy.cummax()`](../reference/api/pandas.core.groupby.SeriesGroupBy.cummax.html#pandas.core.groupby.SeriesGroupBy.cummax "pandas.core.groupby.SeriesGroupBy.cummax") incorrectly rounding integer values near the `int64` implementations bounds ([GH 40767](https://github.com/pandas-dev/pandas/issues/40767)) +* Bug in [`DataFrameGroupBy.rank()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.rank.html#pandas.core.groupby.DataFrameGroupBy.rank "pandas.core.groupby.DataFrameGroupBy.rank") and [`SeriesGroupBy.rank()`](../reference/api/pandas.core.groupby.SeriesGroupBy.rank.html#pandas.core.groupby.SeriesGroupBy.rank "pandas.core.groupby.SeriesGroupBy.rank") with nullable dtypes incorrectly raising a `TypeError` ([GH 41010](https://github.com/pandas-dev/pandas/issues/41010)) +* Bug in [`DataFrameGroupBy.cummin()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cummin.html#pandas.core.groupby.DataFrameGroupBy.cummin "pandas.core.groupby.DataFrameGroupBy.cummin"), [`SeriesGroupBy.cummin()`](../reference/api/pandas.core.groupby.SeriesGroupBy.cummin.html#pandas.core.groupby.SeriesGroupBy.cummin "pandas.core.groupby.SeriesGroupBy.cummin"), [`DataFrameGroupBy.cummax()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cummax.html#pandas.core.groupby.DataFrameGroupBy.cummax "pandas.core.groupby.DataFrameGroupBy.cummax") and [`SeriesGroupBy.cummax()`](../reference/api/pandas.core.groupby.SeriesGroupBy.cummax.html#pandas.core.groupby.SeriesGroupBy.cummax "pandas.core.groupby.SeriesGroupBy.cummax") computing wrong result with nullable data types too large to roundtrip when casting to float ([GH 37493](https://github.com/pandas-dev/pandas/issues/37493)) +* Bug in [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") returning mean zero for all `NaN` window with `min_periods=0` if calculation is not numerical stable ([GH 41053](https://github.com/pandas-dev/pandas/issues/41053)) +* Bug in [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") returning sum not zero for all `NaN` window with `min_periods=0` if calculation is not numerical stable ([GH 41053](https://github.com/pandas-dev/pandas/issues/41053)) +* Bug in [`SeriesGroupBy.agg()`](../reference/api/pandas.core.groupby.SeriesGroupBy.agg.html#pandas.core.groupby.SeriesGroupBy.agg "pandas.core.groupby.SeriesGroupBy.agg") failing to retain ordered [`CategoricalDtype`](../reference/api/pandas.CategoricalDtype.html#pandas.CategoricalDtype "pandas.CategoricalDtype") on order-preserving aggregations ([GH 41147](https://github.com/pandas-dev/pandas/issues/41147)) +* Bug in [`DataFrameGroupBy.min()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.min.html#pandas.core.groupby.DataFrameGroupBy.min "pandas.core.groupby.DataFrameGroupBy.min"), [`SeriesGroupBy.min()`](../reference/api/pandas.core.groupby.SeriesGroupBy.min.html#pandas.core.groupby.SeriesGroupBy.min "pandas.core.groupby.SeriesGroupBy.min"), [`DataFrameGroupBy.max()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.max.html#pandas.core.groupby.DataFrameGroupBy.max "pandas.core.groupby.DataFrameGroupBy.max") and [`SeriesGroupBy.max()`](../reference/api/pandas.core.groupby.SeriesGroupBy.max.html#pandas.core.groupby.SeriesGroupBy.max "pandas.core.groupby.SeriesGroupBy.max") with multiple object-dtype columns and `numeric_only=False` incorrectly raising a `ValueError` ([GH 41111](https://github.com/pandas-dev/pandas/issues/41111)) +* Bug in [`DataFrameGroupBy.rank()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.rank.html#pandas.core.groupby.DataFrameGroupBy.rank "pandas.core.groupby.DataFrameGroupBy.rank") with the GroupBy object’s `axis=0` and the `rank` method’s keyword `axis=1` ([GH 41320](https://github.com/pandas-dev/pandas/issues/41320)) +* Bug in `DataFrameGroupBy.__getitem__()` with non-unique columns incorrectly returning a malformed `SeriesGroupBy` instead of `DataFrameGroupBy` ([GH 41427](https://github.com/pandas-dev/pandas/issues/41427)) +* Bug in [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") with non-unique columns incorrectly raising an `AttributeError` ([GH 41427](https://github.com/pandas-dev/pandas/issues/41427)) +* Bug in [`Resampler.apply()`](../reference/api/pandas.core.resample.Resampler.apply.html#pandas.core.resample.Resampler.apply "pandas.core.resample.Resampler.apply") with non-unique columns incorrectly dropping duplicated columns ([GH 41445](https://github.com/pandas-dev/pandas/issues/41445)) +* Bug in [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") aggregations incorrectly returning empty [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") instead of raising `TypeError` on aggregations that are invalid for its dtype, e.g. `.prod` with `datetime64[ns]` dtype ([GH 41342](https://github.com/pandas-dev/pandas/issues/41342)) +* Bug in `DataFrameGroupBy` aggregations incorrectly failing to drop columns with invalid dtypes for that aggregation when there are no valid columns ([GH 41291](https://github.com/pandas-dev/pandas/issues/41291)) +* Bug in `DataFrame.rolling.__iter__()` where `on` was not assigned to the index of the resulting objects ([GH 40373](https://github.com/pandas-dev/pandas/issues/40373)) +* Bug in [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") and [`DataFrameGroupBy.agg()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg") with `engine="numba"` where `*args` were being cached with the user passed function ([GH 41647](https://github.com/pandas-dev/pandas/issues/41647)) +* Bug in `DataFrameGroupBy` methods `agg`, `transform`, `sum`, `bfill`, `ffill`, `pad`, `pct_change`, `shift`, `ohlc` dropping `.columns.names` ([GH 41497](https://github.com/pandas-dev/pandas/issues/41497)) + +### Reshaping[#](#reshaping "Link to this heading") + +* Bug in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") raising error when performing an inner join with partial index and `right_index=True` when there was no overlap between indices ([GH 33814](https://github.com/pandas-dev/pandas/issues/33814)) +* Bug in [`DataFrame.unstack()`](../reference/api/pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack") with missing levels led to incorrect index names ([GH 37510](https://github.com/pandas-dev/pandas/issues/37510)) +* Bug in [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") propagating the right Index with `left_index=True` and `right_on` specification instead of left Index ([GH 33463](https://github.com/pandas-dev/pandas/issues/33463)) +* Bug in [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") on a DataFrame with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") returned the wrong result when one of both indexes had only one level ([GH 36909](https://github.com/pandas-dev/pandas/issues/36909)) +* [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") now raises a `ValueError` instead of a cryptic `TypeError` in case of non-numerical merge columns ([GH 29130](https://github.com/pandas-dev/pandas/issues/29130)) +* Bug in [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") not assigning values correctly when the DataFrame had a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") where at least one dimension had dtype `Categorical` with non-alphabetically sorted categories ([GH 38502](https://github.com/pandas-dev/pandas/issues/38502)) +* [`Series.value_counts()`](../reference/api/pandas.Series.value_counts.html#pandas.Series.value_counts "pandas.Series.value_counts") and [`Series.mode()`](../reference/api/pandas.Series.mode.html#pandas.Series.mode "pandas.Series.mode") now return consistent keys in original order ([GH 12679](https://github.com/pandas-dev/pandas/issues/12679), [GH 11227](https://github.com/pandas-dev/pandas/issues/11227) and [GH 39007](https://github.com/pandas-dev/pandas/issues/39007)) +* Bug in [`DataFrame.stack()`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack") not handling `NaN` in [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") columns correctly ([GH 39481](https://github.com/pandas-dev/pandas/issues/39481)) +* Bug in [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") would give incorrect results when the argument `func` was a string, `axis=1`, and the axis argument was not supported; now raises a `ValueError` instead ([GH 39211](https://github.com/pandas-dev/pandas/issues/39211)) +* Bug in [`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values") not reshaping the index correctly after sorting on columns when `ignore_index=True` ([GH 39464](https://github.com/pandas-dev/pandas/issues/39464)) +* Bug in `DataFrame.append()` returning incorrect dtypes with combinations of `ExtensionDtype` dtypes ([GH 39454](https://github.com/pandas-dev/pandas/issues/39454)) +* Bug in `DataFrame.append()` returning incorrect dtypes when used with combinations of `datetime64` and `timedelta64` dtypes ([GH 39574](https://github.com/pandas-dev/pandas/issues/39574)) +* Bug in `DataFrame.append()` with a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") and appending a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") whose [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") is not a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 41707](https://github.com/pandas-dev/pandas/issues/41707)) +* Bug in [`DataFrame.pivot_table()`](../reference/api/pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table") returning a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") for a single value when operating on an empty DataFrame ([GH 13483](https://github.com/pandas-dev/pandas/issues/13483)) +* [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") can now be passed to the [`numpy.all()`](https://numpy.org/doc/stable/reference/generated/numpy.all.html#numpy.all "(in NumPy v2.3)") function ([GH 40180](https://github.com/pandas-dev/pandas/issues/40180)) +* Bug in [`DataFrame.stack()`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack") not preserving `CategoricalDtype` in a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 36991](https://github.com/pandas-dev/pandas/issues/36991)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") raising an error when the input sequence contained unhashable items ([GH 39756](https://github.com/pandas-dev/pandas/issues/39756)) +* Bug in [`Series.explode()`](../reference/api/pandas.Series.explode.html#pandas.Series.explode "pandas.Series.explode") preserving the index when `ignore_index` was `True` and values were scalars ([GH 40487](https://github.com/pandas-dev/pandas/issues/40487)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") raising a `ValueError` when [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") contains `None` and `NaT` and has more than 50 elements ([GH 39882](https://github.com/pandas-dev/pandas/issues/39882)) +* Bug in [`Series.unstack()`](../reference/api/pandas.Series.unstack.html#pandas.Series.unstack "pandas.Series.unstack") and [`DataFrame.unstack()`](../reference/api/pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack") with object-dtype values containing timezone-aware datetime objects incorrectly raising `TypeError` ([GH 41875](https://github.com/pandas-dev/pandas/issues/41875)) +* Bug in [`DataFrame.melt()`](../reference/api/pandas.DataFrame.melt.html#pandas.DataFrame.melt "pandas.DataFrame.melt") raising `InvalidIndexError` when [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") has duplicate columns used as `value_vars` ([GH 41951](https://github.com/pandas-dev/pandas/issues/41951)) + +### Sparse[#](#sparse "Link to this heading") + +* Bug in [`DataFrame.sparse.to_coo()`](../reference/api/pandas.DataFrame.sparse.to_coo.html#pandas.DataFrame.sparse.to_coo "pandas.DataFrame.sparse.to_coo") raising a `KeyError` with columns that are a numeric [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") without a `0` ([GH 18414](https://github.com/pandas-dev/pandas/issues/18414)) +* Bug in `SparseArray.astype()` with `copy=False` producing incorrect results when going from integer dtype to floating dtype ([GH 34456](https://github.com/pandas-dev/pandas/issues/34456)) +* Bug in `SparseArray.max()` and `SparseArray.min()` would always return an empty result ([GH 40921](https://github.com/pandas-dev/pandas/issues/40921)) + +### ExtensionArray[#](#extensionarray "Link to this heading") + +* Bug in [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where") when `other` is a Series with an `ExtensionDtype` ([GH 38729](https://github.com/pandas-dev/pandas/issues/38729)) +* Fixed bug where [`Series.idxmax()`](../reference/api/pandas.Series.idxmax.html#pandas.Series.idxmax "pandas.Series.idxmax"), [`Series.idxmin()`](../reference/api/pandas.Series.idxmin.html#pandas.Series.idxmin "pandas.Series.idxmin"), [`Series.argmax()`](../reference/api/pandas.Series.argmax.html#pandas.Series.argmax "pandas.Series.argmax"), and [`Series.argmin()`](../reference/api/pandas.Series.argmin.html#pandas.Series.argmin "pandas.Series.argmin") would fail when the underlying data is an `ExtensionArray` ([GH 32749](https://github.com/pandas-dev/pandas/issues/32749), [GH 33719](https://github.com/pandas-dev/pandas/issues/33719), [GH 36566](https://github.com/pandas-dev/pandas/issues/36566)) +* Fixed bug where some properties of subclasses of `PandasExtensionDtype` where improperly cached ([GH 40329](https://github.com/pandas-dev/pandas/issues/40329)) +* Bug in [`DataFrame.mask()`](../reference/api/pandas.DataFrame.mask.html#pandas.DataFrame.mask "pandas.DataFrame.mask") where masking a DataFrame with an `ExtensionDtype` raises a `ValueError` ([GH 40941](https://github.com/pandas-dev/pandas/issues/40941)) + +### Styler[#](#styler "Link to this heading") + +* Bug in [`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") where the `subset` argument in methods raised an error for some valid MultiIndex slices ([GH 33562](https://github.com/pandas-dev/pandas/issues/33562)) +* [`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") rendered HTML output has seen minor alterations to support w3 good code standards ([GH 39626](https://github.com/pandas-dev/pandas/issues/39626)) +* Bug in [`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") where rendered HTML was missing a column class identifier for certain header cells ([GH 39716](https://github.com/pandas-dev/pandas/issues/39716)) +* Bug in [`Styler.background_gradient()`](../reference/api/pandas.io.formats.style.Styler.background_gradient.html#pandas.io.formats.style.Styler.background_gradient "pandas.io.formats.style.Styler.background_gradient") where text-color was not determined correctly ([GH 39888](https://github.com/pandas-dev/pandas/issues/39888)) +* Bug in [`Styler.set_table_styles()`](../reference/api/pandas.io.formats.style.Styler.set_table_styles.html#pandas.io.formats.style.Styler.set_table_styles "pandas.io.formats.style.Styler.set_table_styles") where multiple elements in CSS-selectors of the `table_styles` argument were not correctly added ([GH 34061](https://github.com/pandas-dev/pandas/issues/34061)) +* Bug in [`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") where copying from Jupyter dropped the top left cell and misaligned headers ([GH 12147](https://github.com/pandas-dev/pandas/issues/12147)) +* Bug in `Styler.where` where `kwargs` were not passed to the applicable callable ([GH 40845](https://github.com/pandas-dev/pandas/issues/40845)) +* Bug in [`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") causing CSS to duplicate on multiple renders ([GH 39395](https://github.com/pandas-dev/pandas/issues/39395), [GH 40334](https://github.com/pandas-dev/pandas/issues/40334)) + +### Other[#](#other "Link to this heading") + +* `inspect.getmembers(Series)` no longer raises an `AbstractMethodError` ([GH 38782](https://github.com/pandas-dev/pandas/issues/38782)) +* Bug in [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where") with numeric dtype and `other=None` not casting to `nan` ([GH 39761](https://github.com/pandas-dev/pandas/issues/39761)) +* Bug in [`assert_series_equal()`](../reference/api/pandas.testing.assert_series_equal.html#pandas.testing.assert_series_equal "pandas.testing.assert_series_equal"), [`assert_frame_equal()`](../reference/api/pandas.testing.assert_frame_equal.html#pandas.testing.assert_frame_equal "pandas.testing.assert_frame_equal"), [`assert_index_equal()`](../reference/api/pandas.testing.assert_index_equal.html#pandas.testing.assert_index_equal "pandas.testing.assert_index_equal") and [`assert_extension_array_equal()`](../reference/api/pandas.testing.assert_extension_array_equal.html#pandas.testing.assert_extension_array_equal "pandas.testing.assert_extension_array_equal") incorrectly raising when an attribute has an unrecognized NA type ([GH 39461](https://github.com/pandas-dev/pandas/issues/39461)) +* Bug in [`assert_index_equal()`](../reference/api/pandas.testing.assert_index_equal.html#pandas.testing.assert_index_equal "pandas.testing.assert_index_equal") with `exact=True` not raising when comparing [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") instances with `Int64Index` and `RangeIndex` categories ([GH 41263](https://github.com/pandas-dev/pandas/issues/41263)) +* Bug in [`DataFrame.equals()`](../reference/api/pandas.DataFrame.equals.html#pandas.DataFrame.equals "pandas.DataFrame.equals"), [`Series.equals()`](../reference/api/pandas.Series.equals.html#pandas.Series.equals "pandas.Series.equals"), and [`Index.equals()`](../reference/api/pandas.Index.equals.html#pandas.Index.equals "pandas.Index.equals") with object-dtype containing `np.datetime64("NaT")` or `np.timedelta64("NaT")` ([GH 39650](https://github.com/pandas-dev/pandas/issues/39650)) +* Bug in [`show_versions()`](../reference/api/pandas.show_versions.html#pandas.show_versions "pandas.show_versions") where console JSON output was not proper JSON ([GH 39701](https://github.com/pandas-dev/pandas/issues/39701)) +* pandas can now compile on z/OS when using [xlc](https://www.ibm.com/products/xl-cpp-compiler-zos) ([GH 35826](https://github.com/pandas-dev/pandas/issues/35826)) +* Bug in [`pandas.util.hash_pandas_object()`](../reference/api/pandas.util.hash_pandas_object.html#pandas.util.hash_pandas_object "pandas.util.hash_pandas_object") not recognizing `hash_key`, `encoding` and `categorize` when the input object type is a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 41404](https://github.com/pandas-dev/pandas/issues/41404)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 251 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Abhishek R + +* Ada Draginda +* Adam J. Stewart +* Adam Turner + +* Aidan Feldman + +* Ajitesh Singh + +* Akshat Jain + +* Albert Villanova del Moral +* Alexandre Prince-Levasseur + +* Andrew Hawyrluk + +* Andrew Wieteska +* AnglinaBhambra + +* Ankush Dua + +* Anna Daglis +* Ashlan Parker + +* Ashwani + +* Avinash Pancham +* Ayushman Kumar + +* BeanNan +* Benoît Vinot +* Bharat Raghunathan +* Bijay Regmi + +* Bobin Mathew + +* Bogdan Pilyavets + +* Brian Hulette + +* Brian Sun + +* Brock + +* Bryan Cutler +* Caleb + +* Calvin Ho + +* Chathura Widanage + +* Chinmay Rane + +* Chris Lynch +* Chris Withers +* Christos Petropoulos +* Corentin Girard + +* DaPy15 + +* Damodara Puddu + +* Daniel Hrisca +* Daniel Saxton +* DanielFEvans +* Dare Adewumi + +* Dave Willmer +* David Schlachter + +* David-dmh + +* Deepang Raval + +* Doris Lee + +* Dr. Jan-Philip Gehrcke + +* DriesS + +* Dylan Percy +* Erfan Nariman +* Eric Leung +* EricLeer + +* Eve +* Fangchen Li +* Felix Divo +* Florian Jetter +* Fred Reiss +* GFJ138 + +* Gaurav Sheni + +* Geoffrey B. Eisenbarth + +* Gesa Stupperich + +* Griffin Ansel + +* Gustavo C. Maciel + +* Heidi + +* Henry + +* Hung-Yi Wu + +* Ian Ozsvald + +* Irv Lustig +* Isaac Chung + +* Isaac Virshup +* JHM Darbyshire (MBP) + +* JHM Darbyshire (iMac) + +* Jack Liu + +* James Lamb + +* Jeet Parekh +* Jeff Reback +* Jiezheng2018 + +* Jody Klymak +* Johan Kåhrström + +* John McGuigan +* Joris Van den Bossche +* Jose +* JoseNavy +* Josh Dimarsky +* Josh Friedlander +* Joshua Klein + +* Julia Signell +* Julian Schnitzler + +* Kaiqi Dong +* Kasim Panjri + +* Katie Smith + +* Kelly + +* Kenil + +* Keppler, Kyle + +* Kevin Sheppard +* Khor Chean Wei + +* Kiley Hewitt + +* Larry Wong + +* Lightyears + +* Lucas Holtz + +* Lucas Rodés-Guirao +* Lucky Sivagurunathan + +* Luis Pinto +* Maciej Kos + +* Marc Garcia +* Marco Edward Gorelli + +* Marco Gorelli +* MarcoGorelli + +* Mark Graham +* Martin Dengler + +* Martin Grigorov + +* Marty Rudolf + +* Matt Roeschke +* Matthew Roeschke +* Matthew Zeitlin +* Max Bolingbroke +* Maxim Ivanov +* Maxim Kupfer + +* Mayur + +* MeeseeksMachine +* Micael Jarniac +* Michael Hsieh + +* Michel de Ruiter + +* Mike Roberts + +* Miroslav Šedivý +* Mohammad Jafar Mashhadi +* Morisa Manzella + +* Mortada Mehyar +* Muktan + +* Naveen Agrawal + +* Noah +* Nofar Mishraki + +* Oleh Kozynets +* Olga Matoula + +* Oli + +* Omar Afifi +* Omer Ozarslan + +* Owen Lamont + +* Ozan Öğreden + +* Pandas Development Team +* Paolo Lammens +* Parfait Gasana + +* Patrick Hoefler +* Paul McCarthy + +* Paulo S. Costa + +* Pav A +* Peter +* Pradyumna Rahul + +* Punitvara + +* QP Hou + +* Rahul Chauhan +* Rahul Sathanapalli +* Richard Shadrach +* Robert Bradshaw +* Robin to Roxel +* Rohit Gupta +* Sam Purkis + +* Samuel GIFFARD + +* Sean M. Law + +* Shahar Naveh + +* ShaharNaveh + +* Shiv Gupta + +* Shrey Dixit + +* Shudong Yang + +* Simon Boehm + +* Simon Hawkins +* Sioned Baker + +* Stefan Mejlgaard + +* Steven Pitman + +* Steven Schaerer + +* Stéphane Guillou + +* TLouf + +* Tegar D Pratama + +* Terji Petersen +* Theodoros Nikolaou + +* Thomas Dickson +* Thomas Li +* Thomas Smith +* Thomas Yu + +* ThomasBlauthQC + +* Tim Hoffmann +* Tom Augspurger +* Torsten Wörtwein +* Tyler Reddy +* UrielMaD +* Uwe L. Korn +* Venaturum + +* VirosaLi +* Vladimir Podolskiy +* Vyom Pathak + +* WANG Aiyong +* Waltteri Koskinen + +* Wenjun Si + +* William Ayd +* Yeshwanth N + +* Yuanhao Geng +* Zito Relova + +* aflah02 + +* arredond + +* attack68 +* cdknox + +* chinggg + +* fathomer + +* ftrihardjo + +* github-actions[bot] + +* gunjan-solanki + +* guru kiran +* hasan-yaman +* i-aki-y + +* jbrockmendel +* jmholzer + +* jordi-crespo + +* jotasi + +* jreback +* juliansmidek + +* kylekeppler +* lrepiton + +* lucasrodes +* maroth96 + +* mikeronayne + +* mlondschien +* moink + +* morrme +* mschmookler + +* mzeitlin11 +* na2 + +* nofarmishraki + +* partev +* patrick +* ptype +* realead +* rhshadrach +* rlukevie + +* rosagold + +* saucoide + +* sdementen + +* shawnbrown +* sstiijn + +* stphnlyd + +* sukriti1 + +* taytzehao +* theOehrly + +* theodorju + +* thordisstella + +* tonyyyyip + +* tsinggggg + +* tushushu + +* vangorade + +* vladu + +* wertha + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.3.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.3.1.md new file mode 100644 index 0000000000000000000000000000000000000000..988721d6ff8d3c77c3caecd2ea5d819cad2c0e82 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.3.1.md @@ -0,0 +1,56 @@ +# What's new in pandas 1.3.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.3.1.html + +# What’s new in 1.3.1 (July 25, 2021)[#](#what-s-new-in-1-3-1-july-25-2021 "Link to this heading") + +These are the changes in pandas 1.3.1. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Pandas could not be built on PyPy ([GH 42355](https://github.com/pandas-dev/pandas/issues/42355)) +* [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructed with an older version of pandas could not be unpickled ([GH 42345](https://github.com/pandas-dev/pandas/issues/42345)) +* Performance regression in constructing a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") from a dictionary of dictionaries ([GH 42248](https://github.com/pandas-dev/pandas/issues/42248)) +* Fixed regression in [`DataFrame.agg()`](../reference/api/pandas.DataFrame.agg.html#pandas.DataFrame.agg "pandas.DataFrame.agg") dropping values when the DataFrame had an Extension Array dtype, a duplicate index, and `axis=1` ([GH 42380](https://github.com/pandas-dev/pandas/issues/42380)) +* Fixed regression in [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") changing the order of noncontiguous data ([GH 42396](https://github.com/pandas-dev/pandas/issues/42396)) +* Performance regression in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") in reduction operations requiring casting such as [`DataFrame.mean()`](../reference/api/pandas.DataFrame.mean.html#pandas.DataFrame.mean "pandas.DataFrame.mean") on integer data ([GH 38592](https://github.com/pandas-dev/pandas/issues/38592)) +* Performance regression in [`DataFrame.to_dict()`](../reference/api/pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict") and [`Series.to_dict()`](../reference/api/pandas.Series.to_dict.html#pandas.Series.to_dict "pandas.Series.to_dict") when `orient` argument one of “records”, “dict”, or “split” ([GH 42352](https://github.com/pandas-dev/pandas/issues/42352)) +* Fixed regression in indexing with a `list` subclass incorrectly raising `TypeError` ([GH 42433](https://github.com/pandas-dev/pandas/issues/42433), [GH 42461](https://github.com/pandas-dev/pandas/issues/42461)) +* Fixed regression in [`DataFrame.isin()`](../reference/api/pandas.DataFrame.isin.html#pandas.DataFrame.isin "pandas.DataFrame.isin") and [`Series.isin()`](../reference/api/pandas.Series.isin.html#pandas.Series.isin "pandas.Series.isin") raising `TypeError` with nullable data containing at least one missing value ([GH 42405](https://github.com/pandas-dev/pandas/issues/42405)) +* Regression in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") between objects with bool dtype and integer dtype casting to object instead of to integer ([GH 42092](https://github.com/pandas-dev/pandas/issues/42092)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructor not accepting a `dask.Array` ([GH 38645](https://github.com/pandas-dev/pandas/issues/38645)) +* Fixed regression for `SettingWithCopyWarning` displaying incorrect stacklevel ([GH 42570](https://github.com/pandas-dev/pandas/issues/42570)) +* Fixed regression for [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") raising `KeyError` when one of the `by` columns is in the index ([GH 34488](https://github.com/pandas-dev/pandas/issues/34488)) +* Fixed regression in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") returning pd.NaT for inputs that produce duplicated values, when `cache=True` ([GH 42259](https://github.com/pandas-dev/pandas/issues/42259)) +* Fixed regression in `SeriesGroupBy.value_counts()` that resulted in an `IndexError` when called on a Series with one row ([GH 42618](https://github.com/pandas-dev/pandas/issues/42618)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Fixed bug in [`DataFrame.transpose()`](../reference/api/pandas.DataFrame.transpose.html#pandas.DataFrame.transpose "pandas.DataFrame.transpose") dropping values when the DataFrame had an Extension Array dtype and a duplicate index ([GH 42380](https://github.com/pandas-dev/pandas/issues/42380)) +* Fixed bug in [`DataFrame.to_xml()`](../reference/api/pandas.DataFrame.to_xml.html#pandas.DataFrame.to_xml "pandas.DataFrame.to_xml") raising `KeyError` when called with `index=False` and an offset index ([GH 42458](https://github.com/pandas-dev/pandas/issues/42458)) +* Fixed bug in [`Styler.set_sticky()`](../reference/api/pandas.io.formats.style.Styler.set_sticky.html#pandas.io.formats.style.Styler.set_sticky "pandas.io.formats.style.Styler.set_sticky") not handling index names correctly for single index columns case ([GH 42537](https://github.com/pandas-dev/pandas/issues/42537)) +* Fixed bug in [`DataFrame.copy()`](../reference/api/pandas.DataFrame.copy.html#pandas.DataFrame.copy "pandas.DataFrame.copy") failing to consolidate blocks in the result ([GH 42579](https://github.com/pandas-dev/pandas/issues/42579)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 17 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Fangchen Li +* GYvan + +* Matthew Roeschke +* Matthew Zeitlin +* MeeseeksMachine +* Pandas Development Team +* Patrick Hoefler +* Richard Shadrach +* Shoham Debnath + +* Simon Hawkins +* Stephan Heßelmann + +* Stephen + +* Thomas Li +* Zheyuan + +* attack68 +* jbrockmendel +* neelmraman + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.3.2.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.3.2.md new file mode 100644 index 0000000000000000000000000000000000000000..3886283e79d7cbe24e0d3ffd19081fb5285404ca --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.3.2.md @@ -0,0 +1,55 @@ +# What's new in pandas 1.3.2 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.3.2.html + +# What’s new in 1.3.2 (August 15, 2021)[#](#what-s-new-in-1-3-2-august-15-2021 "Link to this heading") + +These are the changes in pandas 1.3.2. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Performance regression in [`DataFrame.isin()`](../reference/api/pandas.DataFrame.isin.html#pandas.DataFrame.isin "pandas.DataFrame.isin") and [`Series.isin()`](../reference/api/pandas.Series.isin.html#pandas.Series.isin "pandas.Series.isin") for nullable data types ([GH 42714](https://github.com/pandas-dev/pandas/issues/42714)) +* Regression in updating values of [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") using boolean index, created by using [`DataFrame.pop()`](../reference/api/pandas.DataFrame.pop.html#pandas.DataFrame.pop "pandas.DataFrame.pop") ([GH 42530](https://github.com/pandas-dev/pandas/issues/42530)) +* Regression in [`DataFrame.from_records()`](../reference/api/pandas.DataFrame.from_records.html#pandas.DataFrame.from_records "pandas.DataFrame.from_records") with empty records ([GH 42456](https://github.com/pandas-dev/pandas/issues/42456)) +* Fixed regression in [`DataFrame.shift()`](../reference/api/pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift") where `TypeError` occurred when shifting DataFrame created by concatenation of slices and fills with values ([GH 42719](https://github.com/pandas-dev/pandas/issues/42719)) +* Regression in [`DataFrame.agg()`](../reference/api/pandas.DataFrame.agg.html#pandas.DataFrame.agg "pandas.DataFrame.agg") when the `func` argument returned lists and `axis=1` ([GH 42727](https://github.com/pandas-dev/pandas/issues/42727)) +* Regression in [`DataFrame.drop()`](../reference/api/pandas.DataFrame.drop.html#pandas.DataFrame.drop "pandas.DataFrame.drop") does nothing if [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") has duplicates and indexer is a tuple or list of tuples ([GH 42771](https://github.com/pandas-dev/pandas/issues/42771)) +* Fixed regression where [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") raised a `ValueError` when parameters `names` and `prefix` were both set to `None` ([GH 42387](https://github.com/pandas-dev/pandas/issues/42387)) +* Fixed regression in comparisons between [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") object and `datetime64` objects outside the implementation bounds for nanosecond `datetime64` ([GH 42794](https://github.com/pandas-dev/pandas/issues/42794)) +* Fixed regression in [`Styler.highlight_min()`](../reference/api/pandas.io.formats.style.Styler.highlight_min.html#pandas.io.formats.style.Styler.highlight_min "pandas.io.formats.style.Styler.highlight_min") and [`Styler.highlight_max()`](../reference/api/pandas.io.formats.style.Styler.highlight_max.html#pandas.io.formats.style.Styler.highlight_max "pandas.io.formats.style.Styler.highlight_max") where `pandas.NA` was not successfully ignored ([GH 42650](https://github.com/pandas-dev/pandas/issues/42650)) +* Fixed regression in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") where `copy=False` was not honored in `axis=1` Series concatenation ([GH 42501](https://github.com/pandas-dev/pandas/issues/42501)) +* Regression in [`Series.nlargest()`](../reference/api/pandas.Series.nlargest.html#pandas.Series.nlargest "pandas.Series.nlargest") and [`Series.nsmallest()`](../reference/api/pandas.Series.nsmallest.html#pandas.Series.nsmallest "pandas.Series.nsmallest") with nullable integer or float dtype ([GH 42816](https://github.com/pandas-dev/pandas/issues/42816)) +* Fixed regression in [`Series.quantile()`](../reference/api/pandas.Series.quantile.html#pandas.Series.quantile "pandas.Series.quantile") with [`Int64Dtype`](../reference/api/pandas.Int64Dtype.html#pandas.Int64Dtype "pandas.Int64Dtype") ([GH 42626](https://github.com/pandas-dev/pandas/issues/42626)) +* Fixed regression in [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") and [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") where supplying the `by` argument with a Series named with a tuple would incorrectly raise ([GH 42731](https://github.com/pandas-dev/pandas/issues/42731)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") modifies the dtypes dictionary when reading a file with duplicate columns ([GH 42462](https://github.com/pandas-dev/pandas/issues/42462)) +* 1D slices over extension types turn into N-dimensional slices over ExtensionArrays ([GH 42430](https://github.com/pandas-dev/pandas/issues/42430)) +* Fixed bug in [`Series.rolling()`](../reference/api/pandas.Series.rolling.html#pandas.Series.rolling "pandas.Series.rolling") and [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") not calculating window bounds correctly for the first row when `center=True` and `window` is an offset that covers all the rows ([GH 42753](https://github.com/pandas-dev/pandas/issues/42753)) +* `Styler.hide_columns()` now hides the index name header row as well as column headers ([GH 42101](https://github.com/pandas-dev/pandas/issues/42101)) +* [`Styler.set_sticky()`](../reference/api/pandas.io.formats.style.Styler.set_sticky.html#pandas.io.formats.style.Styler.set_sticky "pandas.io.formats.style.Styler.set_sticky") has amended CSS to control the column/index names and ensure the correct sticky positions ([GH 42537](https://github.com/pandas-dev/pandas/issues/42537)) +* Bug in de-serializing datetime indexes in PYTHONOPTIMIZED mode ([GH 42866](https://github.com/pandas-dev/pandas/issues/42866)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 16 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Alexander Gorodetsky + +* Fangchen Li +* Fred Reiss +* Justin McOmie + +* Matthew Zeitlin +* MeeseeksMachine +* Pandas Development Team +* Patrick Hoefler +* Richard Shadrach +* Shoham Debnath +* Simon Hawkins +* Thomas Li +* Wenjun Si +* attack68 +* dicristina + +* jbrockmendel diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.3.3.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.3.3.md new file mode 100644 index 0000000000000000000000000000000000000000..b7654310b5ab429ac2d79b08e746beaaeeb5f081 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.3.3.md @@ -0,0 +1,59 @@ +# What's new in pandas 1.3.3 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.3.3.html + +# What’s new in 1.3.3 (September 12, 2021)[#](#what-s-new-in-1-3-3-september-12-2021 "Link to this heading") + +These are the changes in pandas 1.3.3. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor failing to broadcast for defined [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") and len one list of [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") ([GH 42810](https://github.com/pandas-dev/pandas/issues/42810)) +* Fixed regression in [`DataFrameGroupBy.agg()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg") and [`SeriesGroupBy.agg()`](../reference/api/pandas.core.groupby.SeriesGroupBy.agg.html#pandas.core.groupby.SeriesGroupBy.agg "pandas.core.groupby.SeriesGroupBy.agg") incorrectly raising in some cases ([GH 42390](https://github.com/pandas-dev/pandas/issues/42390)) +* Fixed regression in [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") and [`SeriesGroupBy.apply()`](../reference/api/pandas.core.groupby.SeriesGroupBy.apply.html#pandas.core.groupby.SeriesGroupBy.apply "pandas.core.groupby.SeriesGroupBy.apply") where `nan` values were dropped even with `dropna=False` ([GH 43205](https://github.com/pandas-dev/pandas/issues/43205)) +* Fixed regression in [`DataFrameGroupBy.quantile()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.quantile.html#pandas.core.groupby.DataFrameGroupBy.quantile "pandas.core.groupby.DataFrameGroupBy.quantile") and [`SeriesGroupBy.quantile()`](../reference/api/pandas.core.groupby.SeriesGroupBy.quantile.html#pandas.core.groupby.SeriesGroupBy.quantile "pandas.core.groupby.SeriesGroupBy.quantile") which were failing with `pandas.NA` ([GH 42849](https://github.com/pandas-dev/pandas/issues/42849)) +* Fixed regression in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") where `on` columns with `ExtensionDtype` or `bool` data types were cast to `object` in `right` and `outer` merge ([GH 40073](https://github.com/pandas-dev/pandas/issues/40073)) +* Fixed regression in `RangeIndex.where()` and `RangeIndex.putmask()` raising `AssertionError` when result did not represent a [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") ([GH 43240](https://github.com/pandas-dev/pandas/issues/43240)) +* Fixed regression in [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") where the `fastparquet` engine would not work properly with fastparquet 0.7.0 ([GH 43075](https://github.com/pandas-dev/pandas/issues/43075)) +* Fixed regression in `DataFrame.loc.__setitem__()` raising `ValueError` when setting array as cell value ([GH 43422](https://github.com/pandas-dev/pandas/issues/43422)) +* Fixed regression in `is_list_like()` where objects with `__iter__` set to `None` would be identified as iterable ([GH 43373](https://github.com/pandas-dev/pandas/issues/43373)) +* Fixed regression in `DataFrame.__getitem__()` raising error for slice of [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") when index is non monotonic ([GH 43223](https://github.com/pandas-dev/pandas/issues/43223)) +* Fixed regression in [`Resampler.aggregate()`](../reference/api/pandas.core.resample.Resampler.aggregate.html#pandas.core.resample.Resampler.aggregate "pandas.core.resample.Resampler.aggregate") when used after column selection would raise if `func` is a list of aggregation functions ([GH 42905](https://github.com/pandas-dev/pandas/issues/42905)) +* Fixed regression in [`DataFrame.corr()`](../reference/api/pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr") where Kendall correlation would produce incorrect results for columns with repeated values ([GH 43401](https://github.com/pandas-dev/pandas/issues/43401)) +* Fixed regression in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") where aggregation on columns with object types dropped results on those columns ([GH 42395](https://github.com/pandas-dev/pandas/issues/42395), [GH 43108](https://github.com/pandas-dev/pandas/issues/43108)) +* Fixed regression in [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") raising `TypeError` when filling `float` `Series` with list-like fill value having a dtype which couldn’t cast lostlessly (like `float32` filled with `float64`) ([GH 43424](https://github.com/pandas-dev/pandas/issues/43424)) +* Fixed regression in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") raising `AttributeError` when the file handle is an `tempfile.SpooledTemporaryFile` object ([GH 43439](https://github.com/pandas-dev/pandas/issues/43439)) +* Fixed performance regression in [`core.window.ewm.ExponentialMovingWindow.mean()`](../reference/api/pandas.core.window.ewm.ExponentialMovingWindow.mean.html#pandas.core.window.ewm.ExponentialMovingWindow.mean "pandas.core.window.ewm.ExponentialMovingWindow.mean") ([GH 42333](https://github.com/pandas-dev/pandas/issues/42333)) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Performance improvement for `DataFrame.__setitem__()` when the key or value is not a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame"), or key is not list-like ([GH 43274](https://github.com/pandas-dev/pandas/issues/43274)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Fixed bug in [`DataFrameGroupBy.agg()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg") and [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") with `engine="numba"` where `index` data was not being correctly passed into `func` ([GH 43133](https://github.com/pandas-dev/pandas/issues/43133)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 18 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Ali McMaster +* Irv Lustig +* Matthew Roeschke +* Matthew Zeitlin +* MeeseeksMachine +* Pandas Development Team +* Patrick Hoefler +* Prerana Chakraborty + +* Richard Shadrach +* Shoham Debnath +* Simon Hawkins +* Thomas Li +* Torsten Wörtwein +* Zach Rait + +* aiudirog + +* attack68 +* jbrockmendel +* suoniq + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.3.4.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.3.4.md new file mode 100644 index 0000000000000000000000000000000000000000..848d4fc27fdfbf5cd9201cc10d7ff184445c65cc --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.3.4.md @@ -0,0 +1,58 @@ +# What's new in pandas 1.3.4 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.3.4.html + +# What’s new in 1.3.4 (October 17, 2021)[#](#what-s-new-in-1-3-4-october-17-2021 "Link to this heading") + +These are the changes in pandas 1.3.4. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in [`DataFrame.convert_dtypes()`](../reference/api/pandas.DataFrame.convert_dtypes.html#pandas.DataFrame.convert_dtypes "pandas.DataFrame.convert_dtypes") incorrectly converts byte strings to strings ([GH 43183](https://github.com/pandas-dev/pandas/issues/43183)) +* Fixed regression in [`DataFrameGroupBy.agg()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg") and [`SeriesGroupBy.agg()`](../reference/api/pandas.core.groupby.SeriesGroupBy.agg.html#pandas.core.groupby.SeriesGroupBy.agg "pandas.core.groupby.SeriesGroupBy.agg") were failing silently with mixed data types along `axis=1` and [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 43209](https://github.com/pandas-dev/pandas/issues/43209)) +* Fixed regression in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") with integer and `NaN` keys failing with `outer` merge ([GH 43550](https://github.com/pandas-dev/pandas/issues/43550)) +* Fixed regression in [`DataFrame.corr()`](../reference/api/pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr") raising `ValueError` with `method="spearman"` on 32-bit platforms ([GH 43588](https://github.com/pandas-dev/pandas/issues/43588)) +* Fixed performance regression in `MultiIndex.equals()` ([GH 43549](https://github.com/pandas-dev/pandas/issues/43549)) +* Fixed performance regression in [`DataFrameGroupBy.first()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.first.html#pandas.core.groupby.DataFrameGroupBy.first "pandas.core.groupby.DataFrameGroupBy.first"), [`SeriesGroupBy.first()`](../reference/api/pandas.core.groupby.SeriesGroupBy.first.html#pandas.core.groupby.SeriesGroupBy.first "pandas.core.groupby.SeriesGroupBy.first"), [`DataFrameGroupBy.last()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.last.html#pandas.core.groupby.DataFrameGroupBy.last "pandas.core.groupby.DataFrameGroupBy.last"), and [`SeriesGroupBy.last()`](../reference/api/pandas.core.groupby.SeriesGroupBy.last.html#pandas.core.groupby.SeriesGroupBy.last "pandas.core.groupby.SeriesGroupBy.last") with [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") ([GH 41596](https://github.com/pandas-dev/pandas/issues/41596)) +* Fixed regression in [`Series.cat.reorder_categories()`](../reference/api/pandas.Series.cat.reorder_categories.html#pandas.Series.cat.reorder_categories "pandas.Series.cat.reorder_categories") failing to update the categories on the `Series` ([GH 43232](https://github.com/pandas-dev/pandas/issues/43232)) +* Fixed regression in [`Series.cat.categories()`](../reference/api/pandas.Series.cat.categories.html#pandas.Series.cat.categories "pandas.Series.cat.categories") setter failing to update the categories on the `Series` ([GH 43334](https://github.com/pandas-dev/pandas/issues/43334)) +* Fixed regression in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") raising `UnicodeDecodeError` exception when `memory_map=True` ([GH 43540](https://github.com/pandas-dev/pandas/issues/43540)) +* Fixed regression in [`DataFrame.explode()`](../reference/api/pandas.DataFrame.explode.html#pandas.DataFrame.explode "pandas.DataFrame.explode") raising `AssertionError` when `column` is any scalar which is not a string ([GH 43314](https://github.com/pandas-dev/pandas/issues/43314)) +* Fixed regression in [`Series.aggregate()`](../reference/api/pandas.Series.aggregate.html#pandas.Series.aggregate "pandas.Series.aggregate") attempting to pass `args` and `kwargs` multiple times to the user supplied `func` in certain cases ([GH 43357](https://github.com/pandas-dev/pandas/issues/43357)) +* Fixed regression when iterating over a `DataFrame.groupby.rolling` object causing the resulting DataFrames to have an incorrect index if the input groupings were not sorted ([GH 43386](https://github.com/pandas-dev/pandas/issues/43386)) +* Fixed regression in `DataFrame.groupby.rolling.cov()` and `DataFrame.groupby.rolling.corr()` computing incorrect results if the input groupings were not sorted ([GH 43386](https://github.com/pandas-dev/pandas/issues/43386)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Fixed bug in `pandas.DataFrame.groupby.rolling()` and [`pandas.api.indexers.FixedForwardWindowIndexer`](../reference/api/pandas.api.indexers.FixedForwardWindowIndexer.html#pandas.api.indexers.FixedForwardWindowIndexer "pandas.api.indexers.FixedForwardWindowIndexer") leading to segfaults and window endpoints being mixed across groups ([GH 43267](https://github.com/pandas-dev/pandas/issues/43267)) +* Fixed bug in [`DataFrameGroupBy.mean()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.mean.html#pandas.core.groupby.DataFrameGroupBy.mean "pandas.core.groupby.DataFrameGroupBy.mean") and [`SeriesGroupBy.mean()`](../reference/api/pandas.core.groupby.SeriesGroupBy.mean.html#pandas.core.groupby.SeriesGroupBy.mean "pandas.core.groupby.SeriesGroupBy.mean") with datetimelike values including `NaT` values returning incorrect results ([GH 43132](https://github.com/pandas-dev/pandas/issues/43132)) +* Fixed bug in [`Series.aggregate()`](../reference/api/pandas.Series.aggregate.html#pandas.Series.aggregate "pandas.Series.aggregate") not passing the first `args` to the user supplied `func` in certain cases ([GH 43357](https://github.com/pandas-dev/pandas/issues/43357)) +* Fixed memory leaks in `Series.rolling.quantile()` and `Series.rolling.median()` ([GH 43339](https://github.com/pandas-dev/pandas/issues/43339)) + +## Other[#](#other "Link to this heading") + +* The minimum version of Cython needed to compile pandas is now `0.29.24` ([GH 43729](https://github.com/pandas-dev/pandas/issues/43729)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 17 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Alexey Györi + +* DSM +* Irv Lustig +* Jeff Reback +* Julien de la Bruère-T + +* Matthew Zeitlin +* MeeseeksMachine +* Pandas Development Team +* Patrick Hoefler +* Richard Shadrach +* Shoham Debnath +* Simon Hawkins +* Thomas Li +* aptalca + +* jbrockmendel +* michal-gh + +* realead diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.3.5.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.3.5.md new file mode 100644 index 0000000000000000000000000000000000000000..730bd1ece2a7f29c798f2ffd760cd175e11da10f --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.3.5.md @@ -0,0 +1,35 @@ +# What's new in pandas 1.3.5 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.3.5.html + +# What’s new in 1.3.5 (December 12, 2021)[#](#what-s-new-in-1-3-5-december-12-2021 "Link to this heading") + +These are the changes in pandas 1.3.5. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in [`Series.equals()`](../reference/api/pandas.Series.equals.html#pandas.Series.equals "pandas.Series.equals") when comparing floats with dtype object to None ([GH 44190](https://github.com/pandas-dev/pandas/issues/44190)) +* Fixed regression in [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") raising error when array was supplied as join key ([GH 42844](https://github.com/pandas-dev/pandas/issues/42844)) +* Fixed regression when resampling [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with `DateTimeIndex` with empty groups and `uint8`, `uint16` or `uint32` columns incorrectly raising `RuntimeError` ([GH 43329](https://github.com/pandas-dev/pandas/issues/43329)) +* Fixed regression in creating a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") from a timezone-aware [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") scalar near a Daylight Savings Time transition ([GH 42505](https://github.com/pandas-dev/pandas/issues/42505)) +* Fixed performance regression in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") ([GH 44106](https://github.com/pandas-dev/pandas/issues/44106)) +* Fixed regression in [`Series.duplicated()`](../reference/api/pandas.Series.duplicated.html#pandas.Series.duplicated "pandas.Series.duplicated") and [`Series.drop_duplicates()`](../reference/api/pandas.Series.drop_duplicates.html#pandas.Series.drop_duplicates "pandas.Series.drop_duplicates") when Series has [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") dtype with boolean categories ([GH 44351](https://github.com/pandas-dev/pandas/issues/44351)) +* Fixed regression in [`DataFrameGroupBy.sum()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.sum.html#pandas.core.groupby.DataFrameGroupBy.sum "pandas.core.groupby.DataFrameGroupBy.sum") and [`SeriesGroupBy.sum()`](../reference/api/pandas.core.groupby.SeriesGroupBy.sum.html#pandas.core.groupby.SeriesGroupBy.sum "pandas.core.groupby.SeriesGroupBy.sum") with `timedelta64[ns]` dtype containing `NaT` failing to treat that value as NA ([GH 42659](https://github.com/pandas-dev/pandas/issues/42659)) +* Fixed regression in `RollingGroupby.cov()` and `RollingGroupby.corr()` when `other` had the same shape as each group would incorrectly return superfluous groups in the result ([GH 42915](https://github.com/pandas-dev/pandas/issues/42915)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 10 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Ali McMaster +* Matthew Roeschke +* Matthew Zeitlin +* MeeseeksMachine +* Pandas Development Team +* Patrick Hoefler +* Simon Hawkins +* Thomas Li +* Tobias Pitters +* jbrockmendel diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.4.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.4.0.md new file mode 100644 index 0000000000000000000000000000000000000000..342e83f50482ab4ddfc231595592fd20f60f1561 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.4.0.md @@ -0,0 +1,1365 @@ +# What's new in pandas 1.4.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.4.0.html + +# What’s new in 1.4.0 (January 22, 2022)[#](#what-s-new-in-1-4-0-january-22-2022 "Link to this heading") + +These are the changes in pandas 1.4.0. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Enhancements[#](#enhancements "Link to this heading") + +### Improved warning messages[#](#improved-warning-messages "Link to this heading") + +Previously, warning messages may have pointed to lines within the pandas +library. Running the script `setting_with_copy_warning.py` + +```None +import pandas as pd + +df = pd.DataFrame({'a': [1, 2, 3]}) +df[:2].loc[:, 'a'] = 5 +``` + +with pandas 1.3 resulted in: + +```None +.../site-packages/pandas/core/indexing.py:1951: SettingWithCopyWarning: +A value is trying to be set on a copy of a slice from a DataFrame. +``` + +This made it difficult to determine where the warning was being generated from. +Now pandas will inspect the call stack, reporting the first line outside of the +pandas library that gave rise to the warning. The output of the above script is +now: + +```None +setting_with_copy_warning.py:4: SettingWithCopyWarning: +A value is trying to be set on a copy of a slice from a DataFrame. +``` + +### Index can hold arbitrary ExtensionArrays[#](#index-can-hold-arbitrary-extensionarrays "Link to this heading") + +Until now, passing a custom `ExtensionArray` to `pd.Index` would cast +the array to `object` dtype. Now [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") can directly hold arbitrary +ExtensionArrays ([GH 43930](https://github.com/pandas-dev/pandas/issues/43930)). + +*Previous behavior*: + +```None +In [1]: arr = pd.array([1, 2, pd.NA]) + +In [2]: idx = pd.Index(arr) +``` + +In the old behavior, `idx` would be object-dtype: + +*Previous behavior*: + +```None +In [1]: idx +Out[1]: Index([1, 2, ], dtype='object') +``` + +With the new behavior, we keep the original dtype: + +*New behavior*: + +```None +In [3]: idx +Out[3]: Index([1, 2, ], dtype='Int64') +``` + +One exception to this is `SparseArray`, which will continue to cast to numpy +dtype until pandas 2.0. At that point it will retain its dtype like other +ExtensionArrays. + +### Styler[#](#styler "Link to this heading") + +[`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") has been further developed in 1.4.0. The following general enhancements have been made: + +> * Styling and formatting of indexes has been added, with [`Styler.apply_index()`](../reference/api/pandas.io.formats.style.Styler.apply_index.html#pandas.io.formats.style.Styler.apply_index "pandas.io.formats.style.Styler.apply_index"), `Styler.applymap_index()` and [`Styler.format_index()`](../reference/api/pandas.io.formats.style.Styler.format_index.html#pandas.io.formats.style.Styler.format_index "pandas.io.formats.style.Styler.format_index"). These mirror the signature of the methods already used to style and format data values, and work with both HTML, LaTeX and Excel format ([GH 41893](https://github.com/pandas-dev/pandas/issues/41893), [GH 43101](https://github.com/pandas-dev/pandas/issues/43101), [GH 41993](https://github.com/pandas-dev/pandas/issues/41993), [GH 41995](https://github.com/pandas-dev/pandas/issues/41995)) +> * The new method [`Styler.hide()`](../reference/api/pandas.io.formats.style.Styler.hide.html#pandas.io.formats.style.Styler.hide "pandas.io.formats.style.Styler.hide") deprecates `Styler.hide_index()` and `Styler.hide_columns()` ([GH 43758](https://github.com/pandas-dev/pandas/issues/43758)) +> * The keyword arguments `level` and `names` have been added to [`Styler.hide()`](../reference/api/pandas.io.formats.style.Styler.hide.html#pandas.io.formats.style.Styler.hide "pandas.io.formats.style.Styler.hide") (and implicitly to the deprecated methods `Styler.hide_index()` and `Styler.hide_columns()`) for additional control of visibility of MultiIndexes and of Index names ([GH 25475](https://github.com/pandas-dev/pandas/issues/25475), [GH 43404](https://github.com/pandas-dev/pandas/issues/43404), [GH 43346](https://github.com/pandas-dev/pandas/issues/43346)) +> * The [`Styler.export()`](../reference/api/pandas.io.formats.style.Styler.export.html#pandas.io.formats.style.Styler.export "pandas.io.formats.style.Styler.export") and [`Styler.use()`](../reference/api/pandas.io.formats.style.Styler.use.html#pandas.io.formats.style.Styler.use "pandas.io.formats.style.Styler.use") have been updated to address all of the added functionality from v1.2.0 and v1.3.0 ([GH 40675](https://github.com/pandas-dev/pandas/issues/40675)) +> * Global options under the category `pd.options.styler` have been extended to configure default `Styler` properties which address formatting, encoding, and HTML and LaTeX rendering. Note that formerly `Styler` relied on `display.html.use_mathjax`, which has now been replaced by `styler.html.mathjax` ([GH 41395](https://github.com/pandas-dev/pandas/issues/41395)) +> * Validation of certain keyword arguments, e.g. `caption` ([GH 43368](https://github.com/pandas-dev/pandas/issues/43368)) +> * Various bug fixes as recorded below + +Additionally there are specific enhancements to the HTML specific rendering: + +> * [`Styler.bar()`](../reference/api/pandas.io.formats.style.Styler.bar.html#pandas.io.formats.style.Styler.bar "pandas.io.formats.style.Styler.bar") introduces additional arguments to control alignment and display ([GH 26070](https://github.com/pandas-dev/pandas/issues/26070), [GH 36419](https://github.com/pandas-dev/pandas/issues/36419)), and it also validates the input arguments `width` and `height` ([GH 42511](https://github.com/pandas-dev/pandas/issues/42511)) +> * [`Styler.to_html()`](../reference/api/pandas.io.formats.style.Styler.to_html.html#pandas.io.formats.style.Styler.to_html "pandas.io.formats.style.Styler.to_html") introduces keyword arguments `sparse_index`, `sparse_columns`, `bold_headers`, `caption`, `max_rows` and `max_columns` ([GH 41946](https://github.com/pandas-dev/pandas/issues/41946), [GH 43149](https://github.com/pandas-dev/pandas/issues/43149), [GH 42972](https://github.com/pandas-dev/pandas/issues/42972)) +> * [`Styler.to_html()`](../reference/api/pandas.io.formats.style.Styler.to_html.html#pandas.io.formats.style.Styler.to_html "pandas.io.formats.style.Styler.to_html") omits CSSStyle rules for hidden table elements as a performance enhancement ([GH 43619](https://github.com/pandas-dev/pandas/issues/43619)) +> * Custom CSS classes can now be directly specified without string replacement ([GH 43686](https://github.com/pandas-dev/pandas/issues/43686)) +> * Ability to render hyperlinks automatically via a new `hyperlinks` formatting keyword argument ([GH 45058](https://github.com/pandas-dev/pandas/issues/45058)) + +There are also some LaTeX specific enhancements: + +> * [`Styler.to_latex()`](../reference/api/pandas.io.formats.style.Styler.to_latex.html#pandas.io.formats.style.Styler.to_latex "pandas.io.formats.style.Styler.to_latex") introduces keyword argument `environment`, which also allows a specific “longtable” entry through a separate jinja2 template ([GH 41866](https://github.com/pandas-dev/pandas/issues/41866)) +> * Naive sparsification is now possible for LaTeX without the necessity of including the multirow package ([GH 43369](https://github.com/pandas-dev/pandas/issues/43369)) +> * *cline* support has been added for [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") row sparsification through a keyword argument ([GH 45138](https://github.com/pandas-dev/pandas/issues/45138)) + +### Multi-threaded CSV reading with a new CSV Engine based on pyarrow[#](#multi-threaded-csv-reading-with-a-new-csv-engine-based-on-pyarrow "Link to this heading") + +[`pandas.read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") now accepts `engine="pyarrow"` (requires at least +`pyarrow` 1.0.1) as an argument, allowing for faster csv parsing on multicore +machines with pyarrow installed. See the [I/O docs](../user_guide/io.html) for +more info. ([GH 23697](https://github.com/pandas-dev/pandas/issues/23697), [GH 43706](https://github.com/pandas-dev/pandas/issues/43706)) + +### Rank function for rolling and expanding windows[#](#rank-function-for-rolling-and-expanding-windows "Link to this heading") + +Added `rank` function to `Rolling` and `Expanding`. The new +function supports the `method`, `ascending`, and `pct` flags of +[`DataFrame.rank()`](../reference/api/pandas.DataFrame.rank.html#pandas.DataFrame.rank "pandas.DataFrame.rank"). The `method` argument supports `min`, `max`, and +`average` ranking methods. +Example: + +```None +In [4]: s = pd.Series([1, 4, 2, 3, 5, 3]) + +In [5]: s.rolling(3).rank() +Out[5]: +0 NaN +1 NaN +2 2.0 +3 2.0 +4 3.0 +5 1.5 +dtype: float64 + +In [6]: s.rolling(3).rank(method="max") +Out[6]: +0 NaN +1 NaN +2 2.0 +3 2.0 +4 3.0 +5 2.0 +dtype: float64 +``` + +### Groupby positional indexing[#](#groupby-positional-indexing "Link to this heading") + +It is now possible to specify positional ranges relative to the ends of each +group. + +Negative arguments for [`DataFrameGroupBy.head()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.head.html#pandas.core.groupby.DataFrameGroupBy.head "pandas.core.groupby.DataFrameGroupBy.head"), [`SeriesGroupBy.head()`](../reference/api/pandas.core.groupby.SeriesGroupBy.head.html#pandas.core.groupby.SeriesGroupBy.head "pandas.core.groupby.SeriesGroupBy.head"), [`DataFrameGroupBy.tail()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.tail.html#pandas.core.groupby.DataFrameGroupBy.tail "pandas.core.groupby.DataFrameGroupBy.tail"), and [`SeriesGroupBy.tail()`](../reference/api/pandas.core.groupby.SeriesGroupBy.tail.html#pandas.core.groupby.SeriesGroupBy.tail "pandas.core.groupby.SeriesGroupBy.tail") now work +correctly and result in ranges relative to the end and start of each group, +respectively. Previously, negative arguments returned empty frames. + +```None +In [7]: df = pd.DataFrame([["g", "g0"], ["g", "g1"], ["g", "g2"], ["g", "g3"], + ...: ["h", "h0"], ["h", "h1"]], columns=["A", "B"]) + ...: + +In [8]: df.groupby("A").head(-1) +Out[8]: + A B +0 g g0 +1 g g1 +2 g g2 +4 h h0 +``` + +[`DataFrameGroupBy.nth()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.nth.html#pandas.core.groupby.DataFrameGroupBy.nth "pandas.core.groupby.DataFrameGroupBy.nth") and [`SeriesGroupBy.nth()`](../reference/api/pandas.core.groupby.SeriesGroupBy.nth.html#pandas.core.groupby.SeriesGroupBy.nth "pandas.core.groupby.SeriesGroupBy.nth") now accept a slice or list of integers and slices. + +```None +In [9]: df.groupby("A").nth(slice(1, -1)) +Out[9]: + A B +1 g g1 +2 g g2 + +In [10]: df.groupby("A").nth([slice(None, 1), slice(-1, None)]) +Out[10]: + A B +0 g g0 +3 g g3 +4 h h0 +5 h h1 +``` + +[`DataFrameGroupBy.nth()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.nth.html#pandas.core.groupby.DataFrameGroupBy.nth "pandas.core.groupby.DataFrameGroupBy.nth") and [`SeriesGroupBy.nth()`](../reference/api/pandas.core.groupby.SeriesGroupBy.nth.html#pandas.core.groupby.SeriesGroupBy.nth "pandas.core.groupby.SeriesGroupBy.nth") now accept index notation. + +```None +In [11]: df.groupby("A").nth[1, -1] +Out[11]: + A B +1 g g1 +3 g g3 +5 h h1 + +In [12]: df.groupby("A").nth[1:-1] +Out[12]: + A B +1 g g1 +2 g g2 + +In [13]: df.groupby("A").nth[:1, -1:] +Out[13]: + A B +0 g g0 +3 g g3 +4 h h0 +5 h h1 +``` + +### DataFrame.from\_dict and DataFrame.to\_dict have new `'tight'` option[#](#dataframe-from-dict-and-dataframe-to-dict-have-new-tight-option "Link to this heading") + +A new `'tight'` dictionary format that preserves [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") entries +and names is now available with the [`DataFrame.from_dict()`](../reference/api/pandas.DataFrame.from_dict.html#pandas.DataFrame.from_dict "pandas.DataFrame.from_dict") and +[`DataFrame.to_dict()`](../reference/api/pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict") methods and can be used with the standard `json` +library to produce a tight representation of [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") objects +([GH 4889](https://github.com/pandas-dev/pandas/issues/4889)). + +```None +In [14]: df = pd.DataFrame.from_records( + ....: [[1, 3], [2, 4]], + ....: index=pd.MultiIndex.from_tuples([("a", "b"), ("a", "c")], + ....: names=["n1", "n2"]), + ....: columns=pd.MultiIndex.from_tuples([("x", 1), ("y", 2)], + ....: names=["z1", "z2"]), + ....: ) + ....: + +In [15]: df +Out[15]: +z1 x y +z2 1 2 +n1 n2 +a b 1 3 + c 2 4 + +In [16]: df.to_dict(orient='tight') +Out[16]: +{'index': [('a', 'b'), ('a', 'c')], + 'columns': [('x', 1), ('y', 2)], + 'data': [[1, 3], [2, 4]], + 'index_names': ['n1', 'n2'], + 'column_names': ['z1', 'z2']} +``` + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") will preserve the `attrs` when it is the same for all objects and discard the `attrs` when they are different ([GH 41828](https://github.com/pandas-dev/pandas/issues/41828)) +* `DataFrameGroupBy` operations with `as_index=False` now correctly retain `ExtensionDtype` dtypes for columns being grouped on ([GH 41373](https://github.com/pandas-dev/pandas/issues/41373)) +* Add support for assigning values to `by` argument in [`DataFrame.plot.hist()`](../reference/api/pandas.DataFrame.plot.hist.html#pandas.DataFrame.plot.hist "pandas.DataFrame.plot.hist") and [`DataFrame.plot.box()`](../reference/api/pandas.DataFrame.plot.box.html#pandas.DataFrame.plot.box "pandas.DataFrame.plot.box") ([GH 15079](https://github.com/pandas-dev/pandas/issues/15079)) +* [`Series.sample()`](../reference/api/pandas.Series.sample.html#pandas.Series.sample "pandas.Series.sample"), [`DataFrame.sample()`](../reference/api/pandas.DataFrame.sample.html#pandas.DataFrame.sample "pandas.DataFrame.sample"), [`DataFrameGroupBy.sample()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.sample.html#pandas.core.groupby.DataFrameGroupBy.sample "pandas.core.groupby.DataFrameGroupBy.sample"), and [`SeriesGroupBy.sample()`](../reference/api/pandas.core.groupby.SeriesGroupBy.sample.html#pandas.core.groupby.SeriesGroupBy.sample "pandas.core.groupby.SeriesGroupBy.sample") now accept a `np.random.Generator` as input to `random_state`. A generator will be more performant, especially with `replace=False` ([GH 38100](https://github.com/pandas-dev/pandas/issues/38100)) +* [`Series.ewm()`](../reference/api/pandas.Series.ewm.html#pandas.Series.ewm "pandas.Series.ewm") and [`DataFrame.ewm()`](../reference/api/pandas.DataFrame.ewm.html#pandas.DataFrame.ewm "pandas.DataFrame.ewm") now support a `method` argument with a `'table'` option that performs the windowing operation over an entire [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame"). See [Window Overview](../user_guide/window.html#window-overview) for performance and functional benefits ([GH 42273](https://github.com/pandas-dev/pandas/issues/42273)) +* [`DataFrameGroupBy.cummin()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cummin.html#pandas.core.groupby.DataFrameGroupBy.cummin "pandas.core.groupby.DataFrameGroupBy.cummin"), [`SeriesGroupBy.cummin()`](../reference/api/pandas.core.groupby.SeriesGroupBy.cummin.html#pandas.core.groupby.SeriesGroupBy.cummin "pandas.core.groupby.SeriesGroupBy.cummin"), [`DataFrameGroupBy.cummax()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cummax.html#pandas.core.groupby.DataFrameGroupBy.cummax "pandas.core.groupby.DataFrameGroupBy.cummax"), and [`SeriesGroupBy.cummax()`](../reference/api/pandas.core.groupby.SeriesGroupBy.cummax.html#pandas.core.groupby.SeriesGroupBy.cummax "pandas.core.groupby.SeriesGroupBy.cummax") now support the argument `skipna` ([GH 34047](https://github.com/pandas-dev/pandas/issues/34047)) +* [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") now supports the argument `storage_options` ([GH 39167](https://github.com/pandas-dev/pandas/issues/39167)) +* [`DataFrame.to_stata()`](../reference/api/pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata") and `StataWriter()` now accept the keyword only argument `value_labels` to save labels for non-categorical columns ([GH 38454](https://github.com/pandas-dev/pandas/issues/38454)) +* Methods that relied on hashmap based algos such as `DataFrameGroupBy.value_counts()`, `DataFrameGroupBy.count()` and [`factorize()`](../reference/api/pandas.factorize.html#pandas.factorize "pandas.factorize") ignored imaginary component for complex numbers ([GH 17927](https://github.com/pandas-dev/pandas/issues/17927)) +* Add [`Series.str.removeprefix()`](../reference/api/pandas.Series.str.removeprefix.html#pandas.Series.str.removeprefix "pandas.Series.str.removeprefix") and [`Series.str.removesuffix()`](../reference/api/pandas.Series.str.removesuffix.html#pandas.Series.str.removesuffix "pandas.Series.str.removesuffix") introduced in Python 3.9 to remove pre-/suffixes from string-type [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") ([GH 36944](https://github.com/pandas-dev/pandas/issues/36944)) +* Attempting to write into a file in missing parent directory with [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv"), [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html"), [`DataFrame.to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel"), [`DataFrame.to_feather()`](../reference/api/pandas.DataFrame.to_feather.html#pandas.DataFrame.to_feather "pandas.DataFrame.to_feather"), [`DataFrame.to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet"), [`DataFrame.to_stata()`](../reference/api/pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata"), [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json"), [`DataFrame.to_pickle()`](../reference/api/pandas.DataFrame.to_pickle.html#pandas.DataFrame.to_pickle "pandas.DataFrame.to_pickle"), and [`DataFrame.to_xml()`](../reference/api/pandas.DataFrame.to_xml.html#pandas.DataFrame.to_xml "pandas.DataFrame.to_xml") now explicitly mentions missing parent directory, the same is true for [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") counterparts ([GH 24306](https://github.com/pandas-dev/pandas/issues/24306)) +* Indexing with `.loc` and `.iloc` now supports `Ellipsis` ([GH 37750](https://github.com/pandas-dev/pandas/issues/37750)) +* `IntegerArray.all()` , `IntegerArray.any()`, `FloatingArray.any()`, and `FloatingArray.all()` use Kleene logic ([GH 41967](https://github.com/pandas-dev/pandas/issues/41967)) +* Added support for nullable boolean and integer types in [`DataFrame.to_stata()`](../reference/api/pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata"), `StataWriter`, `StataWriter117`, and `StataWriterUTF8` ([GH 40855](https://github.com/pandas-dev/pandas/issues/40855)) +* `DataFrame.__pos__()` and `DataFrame.__neg__()` now retain `ExtensionDtype` dtypes ([GH 43883](https://github.com/pandas-dev/pandas/issues/43883)) +* The error raised when an optional dependency can’t be imported now includes the original exception, for easier investigation ([GH 43882](https://github.com/pandas-dev/pandas/issues/43882)) +* Added [`ExponentialMovingWindow.sum()`](../reference/api/pandas.core.window.ewm.ExponentialMovingWindow.sum.html#pandas.core.window.ewm.ExponentialMovingWindow.sum "pandas.core.window.ewm.ExponentialMovingWindow.sum") ([GH 13297](https://github.com/pandas-dev/pandas/issues/13297)) +* [`Series.str.split()`](../reference/api/pandas.Series.str.split.html#pandas.Series.str.split "pandas.Series.str.split") now supports a `regex` argument that explicitly specifies whether the pattern is a regular expression. Default is `None` ([GH 43563](https://github.com/pandas-dev/pandas/issues/43563), [GH 32835](https://github.com/pandas-dev/pandas/issues/32835), [GH 25549](https://github.com/pandas-dev/pandas/issues/25549)) +* [`DataFrame.dropna()`](../reference/api/pandas.DataFrame.dropna.html#pandas.DataFrame.dropna "pandas.DataFrame.dropna") now accepts a single label as `subset` along with array-like ([GH 41021](https://github.com/pandas-dev/pandas/issues/41021)) +* Added `DataFrameGroupBy.value_counts()` ([GH 43564](https://github.com/pandas-dev/pandas/issues/43564)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") now accepts a `callable` function in `on_bad_lines` when `engine="python"` for custom handling of bad lines ([GH 5686](https://github.com/pandas-dev/pandas/issues/5686)) +* [`ExcelWriter`](../reference/api/pandas.ExcelWriter.html#pandas.ExcelWriter "pandas.ExcelWriter") argument `if_sheet_exists="overlay"` option added ([GH 40231](https://github.com/pandas-dev/pandas/issues/40231)) +* [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") now accepts a `decimal` argument that allow the user to specify the decimal point when parsing string columns to numeric ([GH 14403](https://github.com/pandas-dev/pandas/issues/14403)) +* [`DataFrameGroupBy.mean()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.mean.html#pandas.core.groupby.DataFrameGroupBy.mean "pandas.core.groupby.DataFrameGroupBy.mean"), [`SeriesGroupBy.mean()`](../reference/api/pandas.core.groupby.SeriesGroupBy.mean.html#pandas.core.groupby.SeriesGroupBy.mean "pandas.core.groupby.SeriesGroupBy.mean"), [`DataFrameGroupBy.std()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.std.html#pandas.core.groupby.DataFrameGroupBy.std "pandas.core.groupby.DataFrameGroupBy.std"), [`SeriesGroupBy.std()`](../reference/api/pandas.core.groupby.SeriesGroupBy.std.html#pandas.core.groupby.SeriesGroupBy.std "pandas.core.groupby.SeriesGroupBy.std"), [`DataFrameGroupBy.var()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.var.html#pandas.core.groupby.DataFrameGroupBy.var "pandas.core.groupby.DataFrameGroupBy.var"), [`SeriesGroupBy.var()`](../reference/api/pandas.core.groupby.SeriesGroupBy.var.html#pandas.core.groupby.SeriesGroupBy.var "pandas.core.groupby.SeriesGroupBy.var"), [`DataFrameGroupBy.sum()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.sum.html#pandas.core.groupby.DataFrameGroupBy.sum "pandas.core.groupby.DataFrameGroupBy.sum"), and [`SeriesGroupBy.sum()`](../reference/api/pandas.core.groupby.SeriesGroupBy.sum.html#pandas.core.groupby.SeriesGroupBy.sum "pandas.core.groupby.SeriesGroupBy.sum") now support [Numba](http://numba.pydata.org/) execution with the `engine` keyword ([GH 43731](https://github.com/pandas-dev/pandas/issues/43731), [GH 44862](https://github.com/pandas-dev/pandas/issues/44862), [GH 44939](https://github.com/pandas-dev/pandas/issues/44939)) +* [`Timestamp.isoformat()`](../reference/api/pandas.Timestamp.isoformat.html#pandas.Timestamp.isoformat "pandas.Timestamp.isoformat") now handles the `timespec` argument from the base `datetime` class ([GH 26131](https://github.com/pandas-dev/pandas/issues/26131)) +* `NaT.to_numpy()` `dtype` argument is now respected, so `np.timedelta64` can be returned ([GH 44460](https://github.com/pandas-dev/pandas/issues/44460)) +* New option `display.max_dir_items` customizes the number of columns added to `Dataframe.__dir__()` and suggested for tab completion ([GH 37996](https://github.com/pandas-dev/pandas/issues/37996)) +* Added “Juneteenth National Independence Day” to `USFederalHolidayCalendar` ([GH 44574](https://github.com/pandas-dev/pandas/issues/44574)) +* [`Rolling.var()`](../reference/api/pandas.core.window.rolling.Rolling.var.html#pandas.core.window.rolling.Rolling.var "pandas.core.window.rolling.Rolling.var"), [`Expanding.var()`](../reference/api/pandas.core.window.expanding.Expanding.var.html#pandas.core.window.expanding.Expanding.var "pandas.core.window.expanding.Expanding.var"), [`Rolling.std()`](../reference/api/pandas.core.window.rolling.Rolling.std.html#pandas.core.window.rolling.Rolling.std "pandas.core.window.rolling.Rolling.std"), and [`Expanding.std()`](../reference/api/pandas.core.window.expanding.Expanding.std.html#pandas.core.window.expanding.Expanding.std "pandas.core.window.expanding.Expanding.std") now support [Numba](http://numba.pydata.org/) execution with the `engine` keyword ([GH 44461](https://github.com/pandas-dev/pandas/issues/44461)) +* `Series.info()` has been added, for compatibility with [`DataFrame.info()`](../reference/api/pandas.DataFrame.info.html#pandas.DataFrame.info "pandas.DataFrame.info") ([GH 5167](https://github.com/pandas-dev/pandas/issues/5167)) +* Implemented `IntervalArray.min()` and `IntervalArray.max()`, as a result of which `min` and `max` now work for [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex"), [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with `IntervalDtype` ([GH 44746](https://github.com/pandas-dev/pandas/issues/44746)) +* `UInt64Index.map()` now retains `dtype` where possible ([GH 44609](https://github.com/pandas-dev/pandas/issues/44609)) +* [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") can now parse unsigned long long integers ([GH 26068](https://github.com/pandas-dev/pandas/issues/26068)) +* [`DataFrame.take()`](../reference/api/pandas.DataFrame.take.html#pandas.DataFrame.take "pandas.DataFrame.take") now raises a `TypeError` when passed a scalar for the indexer ([GH 42875](https://github.com/pandas-dev/pandas/issues/42875)) +* `is_list_like()` now identifies duck-arrays as list-like unless `.ndim == 0` ([GH 35131](https://github.com/pandas-dev/pandas/issues/35131)) +* `ExtensionDtype` and `ExtensionArray` are now (de)serialized when exporting a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") using `orient='table'` ([GH 20612](https://github.com/pandas-dev/pandas/issues/20612), [GH 44705](https://github.com/pandas-dev/pandas/issues/44705)) +* Add support for [Zstandard](http://facebook.github.io/zstd/) compression to [`DataFrame.to_pickle()`](../reference/api/pandas.DataFrame.to_pickle.html#pandas.DataFrame.to_pickle "pandas.DataFrame.to_pickle")/[`read_pickle()`](../reference/api/pandas.read_pickle.html#pandas.read_pickle "pandas.read_pickle") and friends ([GH 43925](https://github.com/pandas-dev/pandas/issues/43925)) +* [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") now returns an `int` of the number of written rows ([GH 23998](https://github.com/pandas-dev/pandas/issues/23998)) + +## Notable bug fixes[#](#notable-bug-fixes "Link to this heading") + +These are bug fixes that might have notable behavior changes. + +### Inconsistent date string parsing[#](#inconsistent-date-string-parsing "Link to this heading") + +The `dayfirst` option of [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") isn’t strict, and this can lead +to surprising behavior: + +```None +In [17]: pd.to_datetime(["31-12-2021"], dayfirst=False) +Out[17]: DatetimeIndex(['2021-12-31'], dtype='datetime64[ns]', freq=None) +``` + +Now, a warning will be raised if a date string cannot be parsed accordance to +the given `dayfirst` value when the value is a delimited date string (e.g. +`31-12-2012`). + +### Ignoring dtypes in concat with empty or all-NA columns[#](#ignoring-dtypes-in-concat-with-empty-or-all-na-columns "Link to this heading") + +Note + +This behaviour change has been reverted in pandas 1.4.3. + +When using [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") to concatenate two or more [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") objects, +if one of the DataFrames was empty or had all-NA values, its dtype was +*sometimes* ignored when finding the concatenated dtype. These are now +consistently *not* ignored ([GH 43507](https://github.com/pandas-dev/pandas/issues/43507)). + +```None +In [3]: df1 = pd.DataFrame({"bar": [pd.Timestamp("2013-01-01")]}, index=range(1)) +In [4]: df2 = pd.DataFrame({"bar": np.nan}, index=range(1, 2)) +In [5]: res = pd.concat([df1, df2]) +``` + +Previously, the float-dtype in `df2` would be ignored so the result dtype +would be `datetime64[ns]`. As a result, the `np.nan` would be cast to +`NaT`. + +*Previous behavior*: + +```None +In [6]: res +Out[6]: + bar +0 2013-01-01 +1 NaT +``` + +Now the float-dtype is respected. Since the common dtype for these DataFrames is +object, the `np.nan` is retained. + +*New behavior*: + +```None +In [6]: res +Out[6]: + bar +0 2013-01-01 00:00:00 +1 NaN +``` + +### Null-values are no longer coerced to NaN-value in value\_counts and mode[#](#null-values-are-no-longer-coerced-to-nan-value-in-value-counts-and-mode "Link to this heading") + +[`Series.value_counts()`](../reference/api/pandas.Series.value_counts.html#pandas.Series.value_counts "pandas.Series.value_counts") and [`Series.mode()`](../reference/api/pandas.Series.mode.html#pandas.Series.mode "pandas.Series.mode") no longer coerce `None`, +`NaT` and other null-values to a NaN-value for `np.object_`-dtype. This +behavior is now consistent with `unique`, `isin` and others +([GH 42688](https://github.com/pandas-dev/pandas/issues/42688)). + +```None +In [18]: s = pd.Series([True, None, pd.NaT, None, pd.NaT, None]) + +In [19]: res = s.value_counts(dropna=False) +``` + +Previously, all null-values were replaced by a NaN-value. + +*Previous behavior*: + +```None +In [3]: res +Out[3]: +NaN 5 +True 1 +dtype: int64 +``` + +Now null-values are no longer mangled. + +*New behavior*: + +```None +In [20]: res +Out[20]: +None 3 +NaT 2 +True 1 +Name: count, dtype: int64 +``` + +### mangle\_dupe\_cols in read\_csv no longer renames unique columns conflicting with target names[#](#mangle-dupe-cols-in-read-csv-no-longer-renames-unique-columns-conflicting-with-target-names "Link to this heading") + +[`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") no longer renames unique column labels which conflict with the target +names of duplicated columns. Already existing columns are skipped, i.e. the next +available index is used for the target column name ([GH 14704](https://github.com/pandas-dev/pandas/issues/14704)). + +```None +In [21]: import io + +In [22]: data = "a,a,a.1\n1,2,3" + +In [23]: res = pd.read_csv(io.StringIO(data)) +``` + +Previously, the second column was called `a.1`, while the third column was +also renamed to `a.1.1`. + +*Previous behavior*: + +```None +In [3]: res +Out[3]: + a a.1 a.1.1 +0 1 2 3 +``` + +Now the renaming checks if `a.1` already exists when changing the name of the +second column and jumps this index. The second column is instead renamed to +`a.2`. + +*New behavior*: + +```None +In [24]: res +Out[24]: + a a.2 a.1 +0 1 2 3 +``` + +### unstack and pivot\_table no longer raises ValueError for result that would exceed int32 limit[#](#unstack-and-pivot-table-no-longer-raises-valueerror-for-result-that-would-exceed-int32-limit "Link to this heading") + +Previously [`DataFrame.pivot_table()`](../reference/api/pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table") and [`DataFrame.unstack()`](../reference/api/pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack") would +raise a `ValueError` if the operation could produce a result with more than +`2**31 - 1` elements. This operation now raises a +[`errors.PerformanceWarning`](../reference/api/pandas.errors.PerformanceWarning.html#pandas.errors.PerformanceWarning "pandas.errors.PerformanceWarning") instead ([GH 26314](https://github.com/pandas-dev/pandas/issues/26314)). + +*Previous behavior*: + +```None +In [3]: df = DataFrame({"ind1": np.arange(2 ** 16), "ind2": np.arange(2 ** 16), "count": 0}) +In [4]: df.pivot_table(index="ind1", columns="ind2", values="count", aggfunc="count") +ValueError: Unstacked DataFrame is too big, causing int32 overflow +``` + +*New behavior*: + +```None +In [4]: df.pivot_table(index="ind1", columns="ind2", values="count", aggfunc="count") +PerformanceWarning: The following operation may generate 4294967296 cells in the resulting pandas object. +``` + +### groupby.apply consistent transform detection[#](#groupby-apply-consistent-transform-detection "Link to this heading") + +[`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") and [`SeriesGroupBy.apply()`](../reference/api/pandas.core.groupby.SeriesGroupBy.apply.html#pandas.core.groupby.SeriesGroupBy.apply "pandas.core.groupby.SeriesGroupBy.apply") are designed to be flexible, allowing users to perform +aggregations, transformations, filters, and use it with user-defined functions +that might not fall into any of these categories. As part of this, apply will +attempt to detect when an operation is a transform, and in such a case, the +result will have the same index as the input. In order to determine if the +operation is a transform, pandas compares the input’s index to the result’s and +determines if it has been mutated. Previously in pandas 1.3, different code +paths used different definitions of “mutated”: some would use Python’s `is` +whereas others would test only up to equality. + +This inconsistency has been removed, pandas now tests up to equality. + +```None +In [25]: def func(x): + ....: return x.copy() + ....: + +In [26]: df = pd.DataFrame({'a': [1, 2], 'b': [3, 4], 'c': [5, 6]}) + +In [27]: df +Out[27]: + a b c +0 1 3 5 +1 2 4 6 +``` + +*Previous behavior*: + +```None +In [3]: df.groupby(['a']).apply(func) +Out[3]: + a b c +a +1 0 1 3 5 +2 1 2 4 6 + +In [4]: df.set_index(['a', 'b']).groupby(['a']).apply(func) +Out[4]: + c +a b +1 3 5 +2 4 6 +``` + +In the examples above, the first uses a code path where pandas uses `is` and +determines that `func` is not a transform whereas the second tests up to +equality and determines that `func` is a transform. In the first case, the +result’s index is not the same as the input’s. + +*New behavior*: + +```None +In [5]: df.groupby(['a']).apply(func) +Out[5]: + a b c +0 1 3 5 +1 2 4 6 + +In [6]: df.set_index(['a', 'b']).groupby(['a']).apply(func) +Out[6]: + c +a b +1 3 5 +2 4 6 +``` + +Now in both cases it is determined that `func` is a transform. In each case, +the result has the same index as the input. + +## Backwards incompatible API changes[#](#backwards-incompatible-api-changes "Link to this heading") + +### Increased minimum version for Python[#](#increased-minimum-version-for-python "Link to this heading") + +pandas 1.4.0 supports Python 3.8 and higher. + +### Increased minimum versions for dependencies[#](#increased-minimum-versions-for-dependencies "Link to this heading") + +Some minimum supported versions of dependencies were updated. +If installed, we now require: + +| Package | Minimum Version | Required | Changed | +| --- | --- | --- | --- | +| numpy | 1.18.5 | X | X | +| pytz | 2020.1 | X | X | +| python-dateutil | 2.8.1 | X | X | +| bottleneck | 1.3.1 | | X | +| numexpr | 2.7.1 | | X | +| pytest (dev) | 6.0 | | | +| mypy (dev) | 0.930 | | X | + +For [optional libraries](https://pandas.pydata.org/docs/getting_started/install.html) the general +recommendation is to use the latest version. The following table lists the +lowest version per library that is currently being tested throughout the +development of pandas. Optional libraries below the lowest tested version may +still work, but are not considered supported. + +| Package | Minimum Version | Changed | +| --- | --- | --- | +| beautifulsoup4 | 4.8.2 | X | +| fastparquet | 0.4.0 | | +| fsspec | 0.7.4 | | +| gcsfs | 0.6.0 | | +| lxml | 4.5.0 | X | +| matplotlib | 3.3.2 | X | +| numba | 0.50.1 | X | +| openpyxl | 3.0.3 | X | +| pandas-gbq | 0.14.0 | X | +| pyarrow | 1.0.1 | X | +| pymysql | 0.10.1 | X | +| pytables | 3.6.1 | X | +| s3fs | 0.4.0 | | +| scipy | 1.4.1 | X | +| sqlalchemy | 1.4.0 | X | +| tabulate | 0.8.7 | | +| xarray | 0.15.1 | X | +| xlrd | 2.0.1 | X | +| xlsxwriter | 1.2.2 | X | +| xlwt | 1.3.0 | | + +See [Dependencies](../getting_started/install.html#install-dependencies) and [Optional dependencies](../getting_started/install.html#install-optional-dependencies) for more. + +### Other API changes[#](#other-api-changes "Link to this heading") + +* [`Index.get_indexer_for()`](../reference/api/pandas.Index.get_indexer_for.html#pandas.Index.get_indexer_for "pandas.Index.get_indexer_for") no longer accepts keyword arguments (other than `target`); in the past these would be silently ignored if the index was not unique ([GH 42310](https://github.com/pandas-dev/pandas/issues/42310)) +* Change in the position of the `min_rows` argument in [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string") due to change in the docstring ([GH 44304](https://github.com/pandas-dev/pandas/issues/44304)) +* Reduction operations for [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") or [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") now raising a `ValueError` when `None` is passed for `skipna` ([GH 44178](https://github.com/pandas-dev/pandas/issues/44178)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") and [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") no longer raising an error when one of the header rows consists only of `Unnamed:` columns ([GH 13054](https://github.com/pandas-dev/pandas/issues/13054)) +* Changed the `name` attribute of several holidays in + `USFederalHolidayCalendar` to match [official federal holiday + names](https://www.opm.gov/policy-data-oversight/pay-leave/federal-holidays/) + specifically: + + > + “New Year’s Day” gains the possessive apostrophe + > + “Presidents Day” becomes “Washington’s Birthday” + > + “Martin Luther King Jr. Day” is now “Birthday of Martin Luther King, Jr.” + > + “July 4th” is now “Independence Day” + > + “Thanksgiving” is now “Thanksgiving Day” + > + “Christmas” is now “Christmas Day” + > + Added “Juneteenth National Independence Day” + +## Deprecations[#](#deprecations "Link to this heading") + +### Deprecated Int64Index, UInt64Index & Float64Index[#](#deprecated-int64index-uint64index-float64index "Link to this heading") + +`Int64Index`, `UInt64Index` and `Float64Index` have been +deprecated in favor of the base [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") class and will be removed in +Pandas 2.0 ([GH 43028](https://github.com/pandas-dev/pandas/issues/43028)). + +For constructing a numeric index, you can use the base [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") class +instead specifying the data type (which will also work on older pandas +releases): + +```None +# replace +pd.Int64Index([1, 2, 3]) +# with +pd.Index([1, 2, 3], dtype="int64") +``` + +For checking the data type of an index object, you can replace `isinstance` +checks with checking the `dtype`: + +```None +# replace +isinstance(idx, pd.Int64Index) +# with +idx.dtype == "int64" +``` + +Currently, in order to maintain backward compatibility, calls to [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") +will continue to return `Int64Index`, `UInt64Index` and +`Float64Index` when given numeric data, but in the future, an +[`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") will be returned. + +*Current behavior*: + +```None +In [1]: pd.Index([1, 2, 3], dtype="int32") +Out [1]: Int64Index([1, 2, 3], dtype='int64') +In [1]: pd.Index([1, 2, 3], dtype="uint64") +Out [1]: UInt64Index([1, 2, 3], dtype='uint64') +``` + +*Future behavior*: + +```None +In [3]: pd.Index([1, 2, 3], dtype="int32") +Out [3]: Index([1, 2, 3], dtype='int32') +In [4]: pd.Index([1, 2, 3], dtype="uint64") +Out [4]: Index([1, 2, 3], dtype='uint64') +``` + +### Deprecated DataFrame.append and Series.append[#](#deprecated-dataframe-append-and-series-append "Link to this heading") + +`DataFrame.append()` and `Series.append()` have been deprecated and will +be removed in a future version. Use [`pandas.concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") instead ([GH 35407](https://github.com/pandas-dev/pandas/issues/35407)). + +*Deprecated syntax* + +```None +In [1]: pd.Series([1, 2]).append(pd.Series([3, 4]) +Out [1]: +:1: FutureWarning: The series.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead. +0 1 +1 2 +0 3 +1 4 +dtype: int64 + +In [2]: df1 = pd.DataFrame([[1, 2], [3, 4]], columns=list('AB')) +In [3]: df2 = pd.DataFrame([[5, 6], [7, 8]], columns=list('AB')) +In [4]: df1.append(df2) +Out [4]: +:1: FutureWarning: The series.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead. + A B +0 1 2 +1 3 4 +0 5 6 +1 7 8 +``` + +*Recommended syntax* + +```None +In [28]: pd.concat([pd.Series([1, 2]), pd.Series([3, 4])]) +Out[28]: +0 1 +1 2 +0 3 +1 4 +dtype: int64 + +In [29]: df1 = pd.DataFrame([[1, 2], [3, 4]], columns=list('AB')) + +In [30]: df2 = pd.DataFrame([[5, 6], [7, 8]], columns=list('AB')) + +In [31]: pd.concat([df1, df2]) +Out[31]: + A B +0 1 2 +1 3 4 +0 5 6 +1 7 8 +``` + +### Other Deprecations[#](#other-deprecations "Link to this heading") + +* Deprecated `Index.is_type_compatible()` ([GH 42113](https://github.com/pandas-dev/pandas/issues/42113)) +* Deprecated `method` argument in [`Index.get_loc()`](../reference/api/pandas.Index.get_loc.html#pandas.Index.get_loc "pandas.Index.get_loc"), use `index.get_indexer([label], method=...)` instead ([GH 42269](https://github.com/pandas-dev/pandas/issues/42269)) +* Deprecated treating integer keys in `Series.__setitem__()` as positional when the index is a `Float64Index` not containing the key, a [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") with no entries containing the key, or a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") with leading `Float64Index` level not containing the key ([GH 33469](https://github.com/pandas-dev/pandas/issues/33469)) +* Deprecated treating `numpy.datetime64` objects as UTC times when passed to the [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") constructor along with a timezone. In a future version, these will be treated as wall-times. To retain the old behavior, use `Timestamp(dt64).tz_localize("UTC").tz_convert(tz)` ([GH 24559](https://github.com/pandas-dev/pandas/issues/24559)) +* Deprecated ignoring missing labels when indexing with a sequence of labels on a level of a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 42351](https://github.com/pandas-dev/pandas/issues/42351)) +* Creating an empty [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") without a `dtype` will now raise a more visible `FutureWarning` instead of a `DeprecationWarning` ([GH 30017](https://github.com/pandas-dev/pandas/issues/30017)) +* Deprecated the `kind` argument in [`Index.get_slice_bound()`](../reference/api/pandas.Index.get_slice_bound.html#pandas.Index.get_slice_bound "pandas.Index.get_slice_bound"), [`Index.slice_indexer()`](../reference/api/pandas.Index.slice_indexer.html#pandas.Index.slice_indexer "pandas.Index.slice_indexer"), and [`Index.slice_locs()`](../reference/api/pandas.Index.slice_locs.html#pandas.Index.slice_locs "pandas.Index.slice_locs"); in a future version passing `kind` will raise ([GH 42857](https://github.com/pandas-dev/pandas/issues/42857)) +* Deprecated dropping of nuisance columns in `Rolling`, `Expanding`, and `EWM` aggregations ([GH 42738](https://github.com/pandas-dev/pandas/issues/42738)) +* Deprecated [`Index.reindex()`](../reference/api/pandas.Index.reindex.html#pandas.Index.reindex "pandas.Index.reindex") with a non-unique [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") ([GH 42568](https://github.com/pandas-dev/pandas/issues/42568)) +* Deprecated `Styler.render()` in favor of [`Styler.to_html()`](../reference/api/pandas.io.formats.style.Styler.to_html.html#pandas.io.formats.style.Styler.to_html "pandas.io.formats.style.Styler.to_html") ([GH 42140](https://github.com/pandas-dev/pandas/issues/42140)) +* Deprecated `Styler.hide_index()` and `Styler.hide_columns()` in favor of [`Styler.hide()`](../reference/api/pandas.io.formats.style.Styler.hide.html#pandas.io.formats.style.Styler.hide "pandas.io.formats.style.Styler.hide") ([GH 43758](https://github.com/pandas-dev/pandas/issues/43758)) +* Deprecated passing in a string column label into `times` in [`DataFrame.ewm()`](../reference/api/pandas.DataFrame.ewm.html#pandas.DataFrame.ewm "pandas.DataFrame.ewm") ([GH 43265](https://github.com/pandas-dev/pandas/issues/43265)) +* Deprecated the `include_start` and `include_end` arguments in [`DataFrame.between_time()`](../reference/api/pandas.DataFrame.between_time.html#pandas.DataFrame.between_time "pandas.DataFrame.between_time"); in a future version passing `include_start` or `include_end` will raise ([GH 40245](https://github.com/pandas-dev/pandas/issues/40245)) +* Deprecated the `squeeze` argument to [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv"), [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table"), and [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel"). Users should squeeze the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") afterwards with `.squeeze("columns")` instead ([GH 43242](https://github.com/pandas-dev/pandas/issues/43242)) +* Deprecated the `index` argument to `SparseArray` construction ([GH 23089](https://github.com/pandas-dev/pandas/issues/23089)) +* Deprecated the `closed` argument in [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range") and [`bdate_range()`](../reference/api/pandas.bdate_range.html#pandas.bdate_range "pandas.bdate_range") in favor of `inclusive` argument; In a future version passing `closed` will raise ([GH 40245](https://github.com/pandas-dev/pandas/issues/40245)) +* Deprecated `Rolling.validate()`, `Expanding.validate()`, and `ExponentialMovingWindow.validate()` ([GH 43665](https://github.com/pandas-dev/pandas/issues/43665)) +* Deprecated silent dropping of columns that raised a `TypeError` in [`Series.transform`](../reference/api/pandas.Series.transform.html#pandas.Series.transform "pandas.Series.transform") and [`DataFrame.transform`](../reference/api/pandas.DataFrame.transform.html#pandas.DataFrame.transform "pandas.DataFrame.transform") when used with a dictionary ([GH 43740](https://github.com/pandas-dev/pandas/issues/43740)) +* Deprecated silent dropping of columns that raised a `TypeError`, `DataError`, and some cases of `ValueError` in [`Series.aggregate()`](../reference/api/pandas.Series.aggregate.html#pandas.Series.aggregate "pandas.Series.aggregate"), [`DataFrame.aggregate()`](../reference/api/pandas.DataFrame.aggregate.html#pandas.DataFrame.aggregate "pandas.DataFrame.aggregate"), `Series.groupby.aggregate()`, and `DataFrame.groupby.aggregate()` when used with a list ([GH 43740](https://github.com/pandas-dev/pandas/issues/43740)) +* Deprecated casting behavior when setting timezone-aware value(s) into a timezone-aware [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") column when the timezones do not match. Previously this cast to object dtype. In a future version, the values being inserted will be converted to the series or column’s existing timezone ([GH 37605](https://github.com/pandas-dev/pandas/issues/37605)) +* Deprecated casting behavior when passing an item with mismatched-timezone to `DatetimeIndex.insert()`, `DatetimeIndex.putmask()`, `DatetimeIndex.where()` `DatetimeIndex.fillna()`, [`Series.mask()`](../reference/api/pandas.Series.mask.html#pandas.Series.mask "pandas.Series.mask"), [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where"), [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna"), [`Series.shift()`](../reference/api/pandas.Series.shift.html#pandas.Series.shift "pandas.Series.shift"), [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace"), [`Series.reindex()`](../reference/api/pandas.Series.reindex.html#pandas.Series.reindex "pandas.Series.reindex") (and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") column analogues). In the past this has cast to object `dtype`. In a future version, these will cast the passed item to the index or series’s timezone ([GH 37605](https://github.com/pandas-dev/pandas/issues/37605), [GH 44940](https://github.com/pandas-dev/pandas/issues/44940)) +* Deprecated the `prefix` keyword argument in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") and [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table"), in a future version the argument will be removed ([GH 43396](https://github.com/pandas-dev/pandas/issues/43396)) +* Deprecated passing non boolean argument to `sort` in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") ([GH 41518](https://github.com/pandas-dev/pandas/issues/41518)) +* Deprecated passing arguments as positional for [`read_fwf()`](../reference/api/pandas.read_fwf.html#pandas.read_fwf "pandas.read_fwf") other than `filepath_or_buffer` ([GH 41485](https://github.com/pandas-dev/pandas/issues/41485)) +* Deprecated passing arguments as positional for [`read_xml()`](../reference/api/pandas.read_xml.html#pandas.read_xml "pandas.read_xml") other than `path_or_buffer` ([GH 45133](https://github.com/pandas-dev/pandas/issues/45133)) +* Deprecated passing `skipna=None` for `DataFrame.mad()` and `Series.mad()`, pass `skipna=True` instead ([GH 44580](https://github.com/pandas-dev/pandas/issues/44580)) +* Deprecated the behavior of [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with the string “now” with `utc=False`; in a future version this will match `Timestamp("now")`, which in turn matches [`Timestamp.now()`](../reference/api/pandas.Timestamp.now.html#pandas.Timestamp.now "pandas.Timestamp.now") returning the local time ([GH 18705](https://github.com/pandas-dev/pandas/issues/18705)) +* Deprecated `DateOffset.apply()`, use `offset + other` instead ([GH 44522](https://github.com/pandas-dev/pandas/issues/44522)) +* Deprecated parameter `names` in [`Index.copy()`](../reference/api/pandas.Index.copy.html#pandas.Index.copy "pandas.Index.copy") ([GH 44916](https://github.com/pandas-dev/pandas/issues/44916)) +* A deprecation warning is now shown for [`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex") indicating the arguments signature may change and emulate more the arguments to [`Styler.to_latex()`](../reference/api/pandas.io.formats.style.Styler.to_latex.html#pandas.io.formats.style.Styler.to_latex "pandas.io.formats.style.Styler.to_latex") in future versions ([GH 44411](https://github.com/pandas-dev/pandas/issues/44411)) +* Deprecated behavior of [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") between objects with bool-dtype and numeric-dtypes; in a future version these will cast to object dtype instead of coercing bools to numeric values ([GH 39817](https://github.com/pandas-dev/pandas/issues/39817)) +* Deprecated `Categorical.replace()`, use [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") instead ([GH 44929](https://github.com/pandas-dev/pandas/issues/44929)) +* Deprecated passing `set` or `dict` as indexer for `DataFrame.loc.__setitem__()`, `DataFrame.loc.__getitem__()`, `Series.loc.__setitem__()`, `Series.loc.__getitem__()`, `DataFrame.__getitem__()`, `Series.__getitem__()` and `Series.__setitem__()` ([GH 42825](https://github.com/pandas-dev/pandas/issues/42825)) +* Deprecated `Index.__getitem__()` with a bool key; use `index.values[key]` to get the old behavior ([GH 44051](https://github.com/pandas-dev/pandas/issues/44051)) +* Deprecated downcasting column-by-column in [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where") with integer-dtypes ([GH 44597](https://github.com/pandas-dev/pandas/issues/44597)) +* Deprecated `DatetimeIndex.union_many()`, use `DatetimeIndex.union()` instead ([GH 44091](https://github.com/pandas-dev/pandas/issues/44091)) +* Deprecated `Groupby.pad()` in favor of `Groupby.ffill()` ([GH 33396](https://github.com/pandas-dev/pandas/issues/33396)) +* Deprecated `Groupby.backfill()` in favor of `Groupby.bfill()` ([GH 33396](https://github.com/pandas-dev/pandas/issues/33396)) +* Deprecated `Resample.pad()` in favor of `Resample.ffill()` ([GH 33396](https://github.com/pandas-dev/pandas/issues/33396)) +* Deprecated `Resample.backfill()` in favor of `Resample.bfill()` ([GH 33396](https://github.com/pandas-dev/pandas/issues/33396)) +* Deprecated `numeric_only=None` in [`DataFrame.rank()`](../reference/api/pandas.DataFrame.rank.html#pandas.DataFrame.rank "pandas.DataFrame.rank"); in a future version `numeric_only` must be either `True` or `False` (the default) ([GH 45036](https://github.com/pandas-dev/pandas/issues/45036)) +* Deprecated the behavior of [`Timestamp.utcfromtimestamp()`](../reference/api/pandas.Timestamp.utcfromtimestamp.html#pandas.Timestamp.utcfromtimestamp "pandas.Timestamp.utcfromtimestamp"), in the future it will return a timezone-aware UTC [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") ([GH 22451](https://github.com/pandas-dev/pandas/issues/22451)) +* Deprecated `NaT.freq()` ([GH 45071](https://github.com/pandas-dev/pandas/issues/45071)) +* Deprecated behavior of [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") construction when passed float-dtype data containing `NaN` and an integer dtype ignoring the dtype argument; in a future version this will raise ([GH 40110](https://github.com/pandas-dev/pandas/issues/40110)) +* Deprecated the behaviour of [`Series.to_frame()`](../reference/api/pandas.Series.to_frame.html#pandas.Series.to_frame "pandas.Series.to_frame") and [`Index.to_frame()`](../reference/api/pandas.Index.to_frame.html#pandas.Index.to_frame "pandas.Index.to_frame") to ignore the `name` argument when `name=None`. Currently, this means to preserve the existing name, but in the future explicitly passing `name=None` will set `None` as the name of the column in the resulting DataFrame ([GH 44212](https://github.com/pandas-dev/pandas/issues/44212)) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Performance improvement in [`DataFrameGroupBy.sample()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.sample.html#pandas.core.groupby.DataFrameGroupBy.sample "pandas.core.groupby.DataFrameGroupBy.sample") and [`SeriesGroupBy.sample()`](../reference/api/pandas.core.groupby.SeriesGroupBy.sample.html#pandas.core.groupby.SeriesGroupBy.sample "pandas.core.groupby.SeriesGroupBy.sample"), especially when `weights` argument provided ([GH 34483](https://github.com/pandas-dev/pandas/issues/34483)) +* Performance improvement when converting non-string arrays to string arrays ([GH 34483](https://github.com/pandas-dev/pandas/issues/34483)) +* Performance improvement in [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") and [`SeriesGroupBy.transform()`](../reference/api/pandas.core.groupby.SeriesGroupBy.transform.html#pandas.core.groupby.SeriesGroupBy.transform "pandas.core.groupby.SeriesGroupBy.transform") for user-defined functions ([GH 41598](https://github.com/pandas-dev/pandas/issues/41598)) +* Performance improvement in constructing [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") objects ([GH 42631](https://github.com/pandas-dev/pandas/issues/42631), [GH 43142](https://github.com/pandas-dev/pandas/issues/43142), [GH 43147](https://github.com/pandas-dev/pandas/issues/43147), [GH 43307](https://github.com/pandas-dev/pandas/issues/43307), [GH 43144](https://github.com/pandas-dev/pandas/issues/43144), [GH 44826](https://github.com/pandas-dev/pandas/issues/44826)) +* Performance improvement in [`DataFrameGroupBy.shift()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.shift.html#pandas.core.groupby.DataFrameGroupBy.shift "pandas.core.groupby.DataFrameGroupBy.shift") and [`SeriesGroupBy.shift()`](../reference/api/pandas.core.groupby.SeriesGroupBy.shift.html#pandas.core.groupby.SeriesGroupBy.shift "pandas.core.groupby.SeriesGroupBy.shift") when `fill_value` argument is provided ([GH 26615](https://github.com/pandas-dev/pandas/issues/26615)) +* Performance improvement in [`DataFrame.corr()`](../reference/api/pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr") for `method=pearson` on data without missing values ([GH 40956](https://github.com/pandas-dev/pandas/issues/40956)) +* Performance improvement in some [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") and [`SeriesGroupBy.apply()`](../reference/api/pandas.core.groupby.SeriesGroupBy.apply.html#pandas.core.groupby.SeriesGroupBy.apply "pandas.core.groupby.SeriesGroupBy.apply") operations ([GH 42992](https://github.com/pandas-dev/pandas/issues/42992), [GH 43578](https://github.com/pandas-dev/pandas/issues/43578)) +* Performance improvement in [`read_stata()`](../reference/api/pandas.read_stata.html#pandas.read_stata "pandas.read_stata") ([GH 43059](https://github.com/pandas-dev/pandas/issues/43059), [GH 43227](https://github.com/pandas-dev/pandas/issues/43227)) +* Performance improvement in [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") ([GH 43333](https://github.com/pandas-dev/pandas/issues/43333)) +* Performance improvement in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with `uint` dtypes ([GH 42606](https://github.com/pandas-dev/pandas/issues/42606)) +* Performance improvement in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with `infer_datetime_format` set to `True` ([GH 43901](https://github.com/pandas-dev/pandas/issues/43901)) +* Performance improvement in [`Series.sparse.to_coo()`](../reference/api/pandas.Series.sparse.to_coo.html#pandas.Series.sparse.to_coo "pandas.Series.sparse.to_coo") ([GH 42880](https://github.com/pandas-dev/pandas/issues/42880)) +* Performance improvement in indexing with a `UInt64Index` ([GH 43862](https://github.com/pandas-dev/pandas/issues/43862)) +* Performance improvement in indexing with a `Float64Index` ([GH 43705](https://github.com/pandas-dev/pandas/issues/43705)) +* Performance improvement in indexing with a non-unique [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") ([GH 43792](https://github.com/pandas-dev/pandas/issues/43792)) +* Performance improvement in indexing with a listlike indexer on a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 43370](https://github.com/pandas-dev/pandas/issues/43370)) +* Performance improvement in indexing with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") indexer on another [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 43370](https://github.com/pandas-dev/pandas/issues/43370)) +* Performance improvement in [`DataFrameGroupBy.quantile()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.quantile.html#pandas.core.groupby.DataFrameGroupBy.quantile "pandas.core.groupby.DataFrameGroupBy.quantile") and [`SeriesGroupBy.quantile()`](../reference/api/pandas.core.groupby.SeriesGroupBy.quantile.html#pandas.core.groupby.SeriesGroupBy.quantile "pandas.core.groupby.SeriesGroupBy.quantile") ([GH 43469](https://github.com/pandas-dev/pandas/issues/43469), [GH 43725](https://github.com/pandas-dev/pandas/issues/43725)) +* Performance improvement in [`DataFrameGroupBy.count()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.count.html#pandas.core.groupby.DataFrameGroupBy.count "pandas.core.groupby.DataFrameGroupBy.count") and [`SeriesGroupBy.count()`](../reference/api/pandas.core.groupby.SeriesGroupBy.count.html#pandas.core.groupby.SeriesGroupBy.count "pandas.core.groupby.SeriesGroupBy.count") ([GH 43730](https://github.com/pandas-dev/pandas/issues/43730), [GH 43694](https://github.com/pandas-dev/pandas/issues/43694)) +* Performance improvement in [`DataFrameGroupBy.any()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.any.html#pandas.core.groupby.DataFrameGroupBy.any "pandas.core.groupby.DataFrameGroupBy.any"), [`SeriesGroupBy.any()`](../reference/api/pandas.core.groupby.SeriesGroupBy.any.html#pandas.core.groupby.SeriesGroupBy.any "pandas.core.groupby.SeriesGroupBy.any"), [`DataFrameGroupBy.all()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.all.html#pandas.core.groupby.DataFrameGroupBy.all "pandas.core.groupby.DataFrameGroupBy.all"), and [`SeriesGroupBy.all()`](../reference/api/pandas.core.groupby.SeriesGroupBy.all.html#pandas.core.groupby.SeriesGroupBy.all "pandas.core.groupby.SeriesGroupBy.all") ([GH 43675](https://github.com/pandas-dev/pandas/issues/43675), [GH 42841](https://github.com/pandas-dev/pandas/issues/42841)) +* Performance improvement in [`DataFrameGroupBy.std()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.std.html#pandas.core.groupby.DataFrameGroupBy.std "pandas.core.groupby.DataFrameGroupBy.std") and [`SeriesGroupBy.std()`](../reference/api/pandas.core.groupby.SeriesGroupBy.std.html#pandas.core.groupby.SeriesGroupBy.std "pandas.core.groupby.SeriesGroupBy.std") ([GH 43115](https://github.com/pandas-dev/pandas/issues/43115), [GH 43576](https://github.com/pandas-dev/pandas/issues/43576)) +* Performance improvement in [`DataFrameGroupBy.cumsum()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cumsum.html#pandas.core.groupby.DataFrameGroupBy.cumsum "pandas.core.groupby.DataFrameGroupBy.cumsum") and [`SeriesGroupBy.cumsum()`](../reference/api/pandas.core.groupby.SeriesGroupBy.cumsum.html#pandas.core.groupby.SeriesGroupBy.cumsum "pandas.core.groupby.SeriesGroupBy.cumsum") ([GH 43309](https://github.com/pandas-dev/pandas/issues/43309)) +* `SparseArray.min()` and `SparseArray.max()` no longer require converting to a dense array ([GH 43526](https://github.com/pandas-dev/pandas/issues/43526)) +* Indexing into a `SparseArray` with a `slice` with `step=1` no longer requires converting to a dense array ([GH 43777](https://github.com/pandas-dev/pandas/issues/43777)) +* Performance improvement in `SparseArray.take()` with `allow_fill=False` ([GH 43654](https://github.com/pandas-dev/pandas/issues/43654)) +* Performance improvement in [`Rolling.mean()`](../reference/api/pandas.core.window.rolling.Rolling.mean.html#pandas.core.window.rolling.Rolling.mean "pandas.core.window.rolling.Rolling.mean"), [`Expanding.mean()`](../reference/api/pandas.core.window.expanding.Expanding.mean.html#pandas.core.window.expanding.Expanding.mean "pandas.core.window.expanding.Expanding.mean"), [`Rolling.sum()`](../reference/api/pandas.core.window.rolling.Rolling.sum.html#pandas.core.window.rolling.Rolling.sum "pandas.core.window.rolling.Rolling.sum"), [`Expanding.sum()`](../reference/api/pandas.core.window.expanding.Expanding.sum.html#pandas.core.window.expanding.Expanding.sum "pandas.core.window.expanding.Expanding.sum"), [`Rolling.max()`](../reference/api/pandas.core.window.rolling.Rolling.max.html#pandas.core.window.rolling.Rolling.max "pandas.core.window.rolling.Rolling.max"), [`Expanding.max()`](../reference/api/pandas.core.window.expanding.Expanding.max.html#pandas.core.window.expanding.Expanding.max "pandas.core.window.expanding.Expanding.max"), [`Rolling.min()`](../reference/api/pandas.core.window.rolling.Rolling.min.html#pandas.core.window.rolling.Rolling.min "pandas.core.window.rolling.Rolling.min") and [`Expanding.min()`](../reference/api/pandas.core.window.expanding.Expanding.min.html#pandas.core.window.expanding.Expanding.min "pandas.core.window.expanding.Expanding.min") with `engine="numba"` ([GH 43612](https://github.com/pandas-dev/pandas/issues/43612), [GH 44176](https://github.com/pandas-dev/pandas/issues/44176), [GH 45170](https://github.com/pandas-dev/pandas/issues/45170)) +* Improved performance of [`pandas.read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") with `memory_map=True` when file encoding is UTF-8 ([GH 43787](https://github.com/pandas-dev/pandas/issues/43787)) +* Performance improvement in `RangeIndex.sort_values()` overriding [`Index.sort_values()`](../reference/api/pandas.Index.sort_values.html#pandas.Index.sort_values "pandas.Index.sort_values") ([GH 43666](https://github.com/pandas-dev/pandas/issues/43666)) +* Performance improvement in `RangeIndex.insert()` ([GH 43988](https://github.com/pandas-dev/pandas/issues/43988)) +* Performance improvement in [`Index.insert()`](../reference/api/pandas.Index.insert.html#pandas.Index.insert "pandas.Index.insert") ([GH 43953](https://github.com/pandas-dev/pandas/issues/43953)) +* Performance improvement in `DatetimeIndex.tolist()` ([GH 43823](https://github.com/pandas-dev/pandas/issues/43823)) +* Performance improvement in `DatetimeIndex.union()` ([GH 42353](https://github.com/pandas-dev/pandas/issues/42353)) +* Performance improvement in [`Series.nsmallest()`](../reference/api/pandas.Series.nsmallest.html#pandas.Series.nsmallest "pandas.Series.nsmallest") ([GH 43696](https://github.com/pandas-dev/pandas/issues/43696)) +* Performance improvement in [`DataFrame.insert()`](../reference/api/pandas.DataFrame.insert.html#pandas.DataFrame.insert "pandas.DataFrame.insert") ([GH 42998](https://github.com/pandas-dev/pandas/issues/42998)) +* Performance improvement in [`DataFrame.dropna()`](../reference/api/pandas.DataFrame.dropna.html#pandas.DataFrame.dropna "pandas.DataFrame.dropna") ([GH 43683](https://github.com/pandas-dev/pandas/issues/43683)) +* Performance improvement in [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") ([GH 43316](https://github.com/pandas-dev/pandas/issues/43316)) +* Performance improvement in [`DataFrame.values()`](../reference/api/pandas.DataFrame.values.html#pandas.DataFrame.values "pandas.DataFrame.values") ([GH 43160](https://github.com/pandas-dev/pandas/issues/43160)) +* Performance improvement in [`DataFrame.select_dtypes()`](../reference/api/pandas.DataFrame.select_dtypes.html#pandas.DataFrame.select_dtypes "pandas.DataFrame.select_dtypes") ([GH 42611](https://github.com/pandas-dev/pandas/issues/42611)) +* Performance improvement in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") reductions ([GH 43185](https://github.com/pandas-dev/pandas/issues/43185), [GH 43243](https://github.com/pandas-dev/pandas/issues/43243), [GH 43311](https://github.com/pandas-dev/pandas/issues/43311), [GH 43609](https://github.com/pandas-dev/pandas/issues/43609)) +* Performance improvement in [`Series.unstack()`](../reference/api/pandas.Series.unstack.html#pandas.Series.unstack "pandas.Series.unstack") and [`DataFrame.unstack()`](../reference/api/pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack") ([GH 43335](https://github.com/pandas-dev/pandas/issues/43335), [GH 43352](https://github.com/pandas-dev/pandas/issues/43352), [GH 42704](https://github.com/pandas-dev/pandas/issues/42704), [GH 43025](https://github.com/pandas-dev/pandas/issues/43025)) +* Performance improvement in [`Series.to_frame()`](../reference/api/pandas.Series.to_frame.html#pandas.Series.to_frame "pandas.Series.to_frame") ([GH 43558](https://github.com/pandas-dev/pandas/issues/43558)) +* Performance improvement in `Series.mad()` ([GH 43010](https://github.com/pandas-dev/pandas/issues/43010)) +* Performance improvement in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") ([GH 43332](https://github.com/pandas-dev/pandas/issues/43332)) +* Performance improvement in `to_csv()` when index column is a datetime and is formatted ([GH 39413](https://github.com/pandas-dev/pandas/issues/39413)) +* Performance improvement in `to_csv()` when [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") contains a lot of unused levels ([GH 37484](https://github.com/pandas-dev/pandas/issues/37484)) +* Performance improvement in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") when `index_col` was set with a numeric column ([GH 44158](https://github.com/pandas-dev/pandas/issues/44158)) +* Performance improvement in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") ([GH 43354](https://github.com/pandas-dev/pandas/issues/43354)) +* Performance improvement in `SparseArray.__getitem__()` ([GH 23122](https://github.com/pandas-dev/pandas/issues/23122)) +* Performance improvement in constructing a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") from array-like objects like a `Pytorch` tensor ([GH 44616](https://github.com/pandas-dev/pandas/issues/44616)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +### Categorical[#](#categorical "Link to this heading") + +* Bug in setting dtype-incompatible values into a [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") (or `Series` or `DataFrame` backed by `Categorical`) raising `ValueError` instead of `TypeError` ([GH 41919](https://github.com/pandas-dev/pandas/issues/41919)) +* Bug in `Categorical.searchsorted()` when passing a dtype-incompatible value raising `KeyError` instead of `TypeError` ([GH 41919](https://github.com/pandas-dev/pandas/issues/41919)) +* Bug in `Categorical.astype()` casting datetimes and [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") to int for dtype `object` ([GH 44930](https://github.com/pandas-dev/pandas/issues/44930)) +* Bug in [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where") with `CategoricalDtype` when passing a dtype-incompatible value raising `ValueError` instead of `TypeError` ([GH 41919](https://github.com/pandas-dev/pandas/issues/41919)) +* Bug in `Categorical.fillna()` when passing a dtype-incompatible value raising `ValueError` instead of `TypeError` ([GH 41919](https://github.com/pandas-dev/pandas/issues/41919)) +* Bug in `Categorical.fillna()` with a tuple-like category raising `ValueError` instead of `TypeError` when filling with a non-category tuple ([GH 41919](https://github.com/pandas-dev/pandas/issues/41919)) + +### Datetimelike[#](#datetimelike "Link to this heading") + +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor unnecessarily copying non-datetimelike 2D object arrays ([GH 39272](https://github.com/pandas-dev/pandas/issues/39272)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with `format` and `pandas.NA` was raising `ValueError` ([GH 42957](https://github.com/pandas-dev/pandas/issues/42957)) +* [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") would silently swap `MM/DD/YYYY` and `DD/MM/YYYY` formats if the given `dayfirst` option could not be respected - now, a warning is raised in the case of delimited date strings (e.g. `31-12-2012`) ([GH 12585](https://github.com/pandas-dev/pandas/issues/12585)) +* Bug in [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range") and [`bdate_range()`](../reference/api/pandas.bdate_range.html#pandas.bdate_range "pandas.bdate_range") do not return right bound when `start` = `end` and set is closed on one side ([GH 43394](https://github.com/pandas-dev/pandas/issues/43394)) +* Bug in inplace addition and subtraction of [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") or [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") with `DatetimeArray` or `TimedeltaArray` ([GH 43904](https://github.com/pandas-dev/pandas/issues/43904)) +* Bug in calling `np.isnan`, `np.isfinite`, or `np.isinf` on a timezone-aware [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") incorrectly raising `TypeError` ([GH 43917](https://github.com/pandas-dev/pandas/issues/43917)) +* Bug in constructing a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") from datetime-like strings with mixed timezones incorrectly partially-inferring datetime values ([GH 40111](https://github.com/pandas-dev/pandas/issues/40111)) +* Bug in addition of a `Tick` object and a `np.timedelta64` object incorrectly raising instead of returning [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") ([GH 44474](https://github.com/pandas-dev/pandas/issues/44474)) +* `np.maximum.reduce` and `np.minimum.reduce` now correctly return [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") and [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") objects when operating on [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame"), or [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with `datetime64[ns]` or `timedelta64[ns]` dtype ([GH 43923](https://github.com/pandas-dev/pandas/issues/43923)) +* Bug in adding a `np.timedelta64` object to a `BusinessDay` or `CustomBusinessDay` object incorrectly raising ([GH 44532](https://github.com/pandas-dev/pandas/issues/44532)) +* Bug in [`Index.insert()`](../reference/api/pandas.Index.insert.html#pandas.Index.insert "pandas.Index.insert") for inserting `np.datetime64`, `np.timedelta64` or `tuple` into [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with `dtype='object'` with negative loc adding `None` and replacing existing value ([GH 44509](https://github.com/pandas-dev/pandas/issues/44509)) +* Bug in [`Timestamp.to_pydatetime()`](../reference/api/pandas.Timestamp.to_pydatetime.html#pandas.Timestamp.to_pydatetime "pandas.Timestamp.to_pydatetime") failing to retain the `fold` attribute ([GH 45087](https://github.com/pandas-dev/pandas/issues/45087)) +* Bug in [`Series.mode()`](../reference/api/pandas.Series.mode.html#pandas.Series.mode "pandas.Series.mode") with `DatetimeTZDtype` incorrectly returning timezone-naive and `PeriodDtype` incorrectly raising ([GH 41927](https://github.com/pandas-dev/pandas/issues/41927)) +* Fixed regression in [`reindex()`](../reference/api/pandas.Series.reindex.html#pandas.Series.reindex "pandas.Series.reindex") raising an error when using an incompatible fill value with a datetime-like dtype (or not raising a deprecation warning for using a `datetime.date` as fill value) ([GH 42921](https://github.com/pandas-dev/pandas/issues/42921)) +* Bug in `DateOffset` addition with [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") where `offset.nanoseconds` would not be included in the result ([GH 43968](https://github.com/pandas-dev/pandas/issues/43968), [GH 36589](https://github.com/pandas-dev/pandas/issues/36589)) +* Bug in [`Timestamp.fromtimestamp()`](../reference/api/pandas.Timestamp.fromtimestamp.html#pandas.Timestamp.fromtimestamp "pandas.Timestamp.fromtimestamp") not supporting the `tz` argument ([GH 45083](https://github.com/pandas-dev/pandas/issues/45083)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") construction from dict of [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with mismatched index dtypes sometimes raising depending on the ordering of the passed dict ([GH 44091](https://github.com/pandas-dev/pandas/issues/44091)) +* Bug in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") hashing during some DST transitions caused a segmentation fault ([GH 33931](https://github.com/pandas-dev/pandas/issues/33931) and [GH 40817](https://github.com/pandas-dev/pandas/issues/40817)) + +### Timedelta[#](#timedelta "Link to this heading") + +* Bug in division of all-`NaT` `TimeDeltaIndex`, [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") column with object-dtype array like of numbers failing to infer the result as timedelta64-dtype ([GH 39750](https://github.com/pandas-dev/pandas/issues/39750)) +* Bug in floor division of `timedelta64[ns]` data with a scalar returning garbage values ([GH 44466](https://github.com/pandas-dev/pandas/issues/44466)) +* Bug in [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") now properly taking into account any nanoseconds contribution of any kwarg ([GH 43764](https://github.com/pandas-dev/pandas/issues/43764), [GH 45227](https://github.com/pandas-dev/pandas/issues/45227)) + +### Time Zones[#](#time-zones "Link to this heading") + +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with `infer_datetime_format=True` failing to parse zero UTC offset (`Z`) correctly ([GH 41047](https://github.com/pandas-dev/pandas/issues/41047)) +* Bug in [`Series.dt.tz_convert()`](../reference/api/pandas.Series.dt.tz_convert.html#pandas.Series.dt.tz_convert "pandas.Series.dt.tz_convert") resetting index in a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") ([GH 43080](https://github.com/pandas-dev/pandas/issues/43080)) +* Bug in `Timestamp` and `DatetimeIndex` incorrectly raising a `TypeError` when subtracting two timezone-aware objects with mismatched timezones ([GH 31793](https://github.com/pandas-dev/pandas/issues/31793)) + +### Numeric[#](#numeric "Link to this heading") + +* Bug in floor-dividing a list or tuple of integers by a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") incorrectly raising ([GH 44674](https://github.com/pandas-dev/pandas/issues/44674)) +* Bug in [`DataFrame.rank()`](../reference/api/pandas.DataFrame.rank.html#pandas.DataFrame.rank "pandas.DataFrame.rank") raising `ValueError` with `object` columns and `method="first"` ([GH 41931](https://github.com/pandas-dev/pandas/issues/41931)) +* Bug in [`DataFrame.rank()`](../reference/api/pandas.DataFrame.rank.html#pandas.DataFrame.rank "pandas.DataFrame.rank") treating missing values and extreme values as equal (for example `np.nan` and `np.inf`), causing incorrect results when `na_option="bottom"` or `na_option="top` used ([GH 41931](https://github.com/pandas-dev/pandas/issues/41931)) +* Bug in `numexpr` engine still being used when the option `compute.use_numexpr` is set to `False` ([GH 32556](https://github.com/pandas-dev/pandas/issues/32556)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") arithmetic ops with a subclass whose `_constructor()` attribute is a callable other than the subclass itself ([GH 43201](https://github.com/pandas-dev/pandas/issues/43201)) +* Bug in arithmetic operations involving [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") where the result would have the incorrect `name` ([GH 43962](https://github.com/pandas-dev/pandas/issues/43962)) +* Bug in arithmetic operations involving [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") where the result could have the incorrect `name` when the operands having matching NA or matching tuple names ([GH 44459](https://github.com/pandas-dev/pandas/issues/44459)) +* Bug in division with `IntegerDtype` or `BooleanDtype` array and NA scalar incorrectly raising ([GH 44685](https://github.com/pandas-dev/pandas/issues/44685)) +* Bug in multiplying a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `FloatingDtype` with a timedelta-like scalar incorrectly raising ([GH 44772](https://github.com/pandas-dev/pandas/issues/44772)) + +### Conversion[#](#conversion "Link to this heading") + +* Bug in `UInt64Index` constructor when passing a list containing both positive integers small enough to cast to int64 and integers too large to hold in int64 ([GH 42201](https://github.com/pandas-dev/pandas/issues/42201)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructor returning 0 for missing values with dtype `int64` and `False` for dtype `bool` ([GH 43017](https://github.com/pandas-dev/pandas/issues/43017), [GH 43018](https://github.com/pandas-dev/pandas/issues/43018)) +* Bug in constructing a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") from a `PandasArray` containing [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") objects behaving differently than an equivalent `np.ndarray` ([GH 43986](https://github.com/pandas-dev/pandas/issues/43986)) +* Bug in `IntegerDtype` not allowing coercion from string dtype ([GH 25472](https://github.com/pandas-dev/pandas/issues/25472)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with `arg:xr.DataArray` and `unit="ns"` specified raises `TypeError` ([GH 44053](https://github.com/pandas-dev/pandas/issues/44053)) +* Bug in [`DataFrame.convert_dtypes()`](../reference/api/pandas.DataFrame.convert_dtypes.html#pandas.DataFrame.convert_dtypes "pandas.DataFrame.convert_dtypes") not returning the correct type when a subclass does not overload `_constructor_sliced()` ([GH 43201](https://github.com/pandas-dev/pandas/issues/43201)) +* Bug in [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") not propagating `attrs` from the original [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 44414](https://github.com/pandas-dev/pandas/issues/44414)) +* Bug in [`DataFrame.convert_dtypes()`](../reference/api/pandas.DataFrame.convert_dtypes.html#pandas.DataFrame.convert_dtypes "pandas.DataFrame.convert_dtypes") result losing `columns.names` ([GH 41435](https://github.com/pandas-dev/pandas/issues/41435)) +* Bug in constructing a `IntegerArray` from pyarrow data failing to validate dtypes ([GH 44891](https://github.com/pandas-dev/pandas/issues/44891)) +* Bug in [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") not allowing converting from a `PeriodDtype` to `datetime64` dtype, inconsistent with the [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") behavior ([GH 45038](https://github.com/pandas-dev/pandas/issues/45038)) + +### Strings[#](#strings "Link to this heading") + +* Bug in checking for `string[pyarrow]` dtype incorrectly raising an `ImportError` when pyarrow is not installed ([GH 44276](https://github.com/pandas-dev/pandas/issues/44276)) + +### Interval[#](#interval "Link to this heading") + +* Bug in [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where") with `IntervalDtype` incorrectly raising when the `where` call should not replace anything ([GH 44181](https://github.com/pandas-dev/pandas/issues/44181)) + +### Indexing[#](#indexing "Link to this heading") + +* Bug in [`Series.rename()`](../reference/api/pandas.Series.rename.html#pandas.Series.rename "pandas.Series.rename") with [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") and `level` is provided ([GH 43659](https://github.com/pandas-dev/pandas/issues/43659)) +* Bug in [`DataFrame.truncate()`](../reference/api/pandas.DataFrame.truncate.html#pandas.DataFrame.truncate "pandas.DataFrame.truncate") and [`Series.truncate()`](../reference/api/pandas.Series.truncate.html#pandas.Series.truncate "pandas.Series.truncate") when the object’s [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") has a length greater than one but only one unique value ([GH 42365](https://github.com/pandas-dev/pandas/issues/42365)) +* Bug in [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") and [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") when indexing with a tuple in which one of the levels is also a tuple ([GH 27591](https://github.com/pandas-dev/pandas/issues/27591)) +* Bug in [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") whose first level contains only `np.nan` values ([GH 42055](https://github.com/pandas-dev/pandas/issues/42055)) +* Bug in indexing on a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") when passing a string, the return type depended on whether the index was monotonic ([GH 24892](https://github.com/pandas-dev/pandas/issues/24892)) +* Bug in indexing on a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") failing to drop scalar levels when the indexer is a tuple containing a datetime-like string ([GH 42476](https://github.com/pandas-dev/pandas/issues/42476)) +* Bug in [`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values") and [`Series.sort_values()`](../reference/api/pandas.Series.sort_values.html#pandas.Series.sort_values "pandas.Series.sort_values") when passing an ascending value, failed to raise or incorrectly raising `ValueError` ([GH 41634](https://github.com/pandas-dev/pandas/issues/41634)) +* Bug in updating values of [`pandas.Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") using boolean index, created by using [`pandas.DataFrame.pop()`](../reference/api/pandas.DataFrame.pop.html#pandas.DataFrame.pop "pandas.DataFrame.pop") ([GH 42530](https://github.com/pandas-dev/pandas/issues/42530)) +* Bug in [`Index.get_indexer_non_unique()`](../reference/api/pandas.Index.get_indexer_non_unique.html#pandas.Index.get_indexer_non_unique "pandas.Index.get_indexer_non_unique") when index contains multiple `np.nan` ([GH 35392](https://github.com/pandas-dev/pandas/issues/35392)) +* Bug in [`DataFrame.query()`](../reference/api/pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") did not handle the degree sign in a backticked column name, such as `Temp(°C)`, used in an expression to query a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 42826](https://github.com/pandas-dev/pandas/issues/42826)) +* Bug in [`DataFrame.drop()`](../reference/api/pandas.DataFrame.drop.html#pandas.DataFrame.drop "pandas.DataFrame.drop") where the error message did not show missing labels with commas when raising `KeyError` ([GH 42881](https://github.com/pandas-dev/pandas/issues/42881)) +* Bug in [`DataFrame.query()`](../reference/api/pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") where method calls in query strings led to errors when the `numexpr` package was installed ([GH 22435](https://github.com/pandas-dev/pandas/issues/22435)) +* Bug in [`DataFrame.nlargest()`](../reference/api/pandas.DataFrame.nlargest.html#pandas.DataFrame.nlargest "pandas.DataFrame.nlargest") and [`Series.nlargest()`](../reference/api/pandas.Series.nlargest.html#pandas.Series.nlargest "pandas.Series.nlargest") where sorted result did not count indexes containing `np.nan` ([GH 28984](https://github.com/pandas-dev/pandas/issues/28984)) +* Bug in indexing on a non-unique object-dtype [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with an NA scalar (e.g. `np.nan`) ([GH 43711](https://github.com/pandas-dev/pandas/issues/43711)) +* Bug in `DataFrame.__setitem__()` incorrectly writing into an existing column’s array rather than setting a new array when the new dtype and the old dtype match ([GH 43406](https://github.com/pandas-dev/pandas/issues/43406)) +* Bug in setting floating-dtype values into a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with integer dtype failing to set inplace when those values can be losslessly converted to integers ([GH 44316](https://github.com/pandas-dev/pandas/issues/44316)) +* Bug in `Series.__setitem__()` with object dtype when setting an array with matching size and dtype=’datetime64[ns]’ or dtype=’timedelta64[ns]’ incorrectly converting the datetime/timedeltas to integers ([GH 43868](https://github.com/pandas-dev/pandas/issues/43868)) +* Bug in [`DataFrame.sort_index()`](../reference/api/pandas.DataFrame.sort_index.html#pandas.DataFrame.sort_index "pandas.DataFrame.sort_index") where `ignore_index=True` was not being respected when the index was already sorted ([GH 43591](https://github.com/pandas-dev/pandas/issues/43591)) +* Bug in [`Index.get_indexer_non_unique()`](../reference/api/pandas.Index.get_indexer_non_unique.html#pandas.Index.get_indexer_non_unique "pandas.Index.get_indexer_non_unique") when index contains multiple `np.datetime64("NaT")` and `np.timedelta64("NaT")` ([GH 43869](https://github.com/pandas-dev/pandas/issues/43869)) +* Bug in setting a scalar [`Interval`](../reference/api/pandas.Interval.html#pandas.Interval "pandas.Interval") value into a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `IntervalDtype` when the scalar’s sides are floats and the values’ sides are integers ([GH 44201](https://github.com/pandas-dev/pandas/issues/44201)) +* Bug when setting string-backed [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") values that can be parsed to datetimes into a `DatetimeArray` or [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") column backed by `DatetimeArray` failing to parse these strings ([GH 44236](https://github.com/pandas-dev/pandas/issues/44236)) +* Bug in `Series.__setitem__()` with an integer dtype other than `int64` setting with a `range` object unnecessarily upcasting to `int64` ([GH 44261](https://github.com/pandas-dev/pandas/issues/44261)) +* Bug in `Series.__setitem__()` with a boolean mask indexer setting a listlike value of length 1 incorrectly broadcasting that value ([GH 44265](https://github.com/pandas-dev/pandas/issues/44265)) +* Bug in [`Series.reset_index()`](../reference/api/pandas.Series.reset_index.html#pandas.Series.reset_index "pandas.Series.reset_index") not ignoring `name` argument when `drop` and `inplace` are set to `True` ([GH 44575](https://github.com/pandas-dev/pandas/issues/44575)) +* Bug in `DataFrame.loc.__setitem__()` and `DataFrame.iloc.__setitem__()` with mixed dtypes sometimes failing to operate in-place ([GH 44345](https://github.com/pandas-dev/pandas/issues/44345)) +* Bug in `DataFrame.loc.__getitem__()` incorrectly raising `KeyError` when selecting a single column with a boolean key ([GH 44322](https://github.com/pandas-dev/pandas/issues/44322)). +* Bug in setting [`DataFrame.iloc()`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") with a single `ExtensionDtype` column and setting 2D values e.g. `df.iloc[:] = df.values` incorrectly raising ([GH 44514](https://github.com/pandas-dev/pandas/issues/44514)) +* Bug in setting values with [`DataFrame.iloc()`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") with a single `ExtensionDtype` column and a tuple of arrays as the indexer ([GH 44703](https://github.com/pandas-dev/pandas/issues/44703)) +* Bug in indexing on columns with `loc` or `iloc` using a slice with a negative step with `ExtensionDtype` columns incorrectly raising ([GH 44551](https://github.com/pandas-dev/pandas/issues/44551)) +* Bug in `DataFrame.loc.__setitem__()` changing dtype when indexer was completely `False` ([GH 37550](https://github.com/pandas-dev/pandas/issues/37550)) +* Bug in `IntervalIndex.get_indexer_non_unique()` returning boolean mask instead of array of integers for a non unique and non monotonic index ([GH 44084](https://github.com/pandas-dev/pandas/issues/44084)) +* Bug in `IntervalIndex.get_indexer_non_unique()` not handling targets of `dtype` ‘object’ with NaNs correctly ([GH 44482](https://github.com/pandas-dev/pandas/issues/44482)) +* Fixed regression where a single column `np.matrix` was no longer coerced to a 1d `np.ndarray` when added to a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 42376](https://github.com/pandas-dev/pandas/issues/42376)) +* Bug in `Series.__getitem__()` with a [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") of integers treating lists of integers as positional indexers, inconsistent with the behavior with a single scalar integer ([GH 15470](https://github.com/pandas-dev/pandas/issues/15470), [GH 14865](https://github.com/pandas-dev/pandas/issues/14865)) +* Bug in `Series.__setitem__()` when setting floats or integers into integer-dtype [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") failing to upcast when necessary to retain precision ([GH 45121](https://github.com/pandas-dev/pandas/issues/45121)) +* Bug in `DataFrame.iloc.__setitem__()` ignores axis argument ([GH 45032](https://github.com/pandas-dev/pandas/issues/45032)) + +### Missing[#](#missing "Link to this heading") + +* Bug in [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") with `limit` and no `method` ignores `axis='columns'` or `axis = 1` ([GH 40989](https://github.com/pandas-dev/pandas/issues/40989), [GH 17399](https://github.com/pandas-dev/pandas/issues/17399)) +* Bug in [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") not replacing missing values when using a dict-like `value` and duplicate column names ([GH 43476](https://github.com/pandas-dev/pandas/issues/43476)) +* Bug in constructing a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a dictionary `np.datetime64` as a value and `dtype='timedelta64[ns]'`, or vice-versa, incorrectly casting instead of raising ([GH 44428](https://github.com/pandas-dev/pandas/issues/44428)) +* Bug in [`Series.interpolate()`](../reference/api/pandas.Series.interpolate.html#pandas.Series.interpolate "pandas.Series.interpolate") and [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") with `inplace=True` not writing to the underlying array(s) in-place ([GH 44749](https://github.com/pandas-dev/pandas/issues/44749)) +* Bug in [`Index.fillna()`](../reference/api/pandas.Index.fillna.html#pandas.Index.fillna "pandas.Index.fillna") incorrectly returning an unfilled [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") when NA values are present and `downcast` argument is specified. This now raises `NotImplementedError` instead; do not pass `downcast` argument ([GH 44873](https://github.com/pandas-dev/pandas/issues/44873)) +* Bug in [`DataFrame.dropna()`](../reference/api/pandas.DataFrame.dropna.html#pandas.DataFrame.dropna "pandas.DataFrame.dropna") changing [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") even if no entries were dropped ([GH 41965](https://github.com/pandas-dev/pandas/issues/41965)) +* Bug in [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") with an object-dtype incorrectly ignoring `downcast="infer"` ([GH 44241](https://github.com/pandas-dev/pandas/issues/44241)) + +### MultiIndex[#](#multiindex "Link to this heading") + +* Bug in [`MultiIndex.get_loc()`](../reference/api/pandas.MultiIndex.get_loc.html#pandas.MultiIndex.get_loc "pandas.MultiIndex.get_loc") where the first level is a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") and a string key is passed ([GH 42465](https://github.com/pandas-dev/pandas/issues/42465)) +* Bug in `MultiIndex.reindex()` when passing a `level` that corresponds to an `ExtensionDtype` level ([GH 42043](https://github.com/pandas-dev/pandas/issues/42043)) +* Bug in [`MultiIndex.get_loc()`](../reference/api/pandas.MultiIndex.get_loc.html#pandas.MultiIndex.get_loc "pandas.MultiIndex.get_loc") raising `TypeError` instead of `KeyError` on nested tuple ([GH 42440](https://github.com/pandas-dev/pandas/issues/42440)) +* Bug in `MultiIndex.union()` setting wrong `sortorder` causing errors in subsequent indexing operations with slices ([GH 44752](https://github.com/pandas-dev/pandas/issues/44752)) +* Bug in `MultiIndex.putmask()` where the other value was also a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 43212](https://github.com/pandas-dev/pandas/issues/43212)) +* Bug in [`MultiIndex.dtypes()`](../reference/api/pandas.MultiIndex.dtypes.html#pandas.MultiIndex.dtypes "pandas.MultiIndex.dtypes") duplicate level names returned only one dtype per name ([GH 45174](https://github.com/pandas-dev/pandas/issues/45174)) + +### I/O[#](#i-o "Link to this heading") + +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") attempting to read chart sheets from .xlsx files ([GH 41448](https://github.com/pandas-dev/pandas/issues/41448)) +* Bug in [`json_normalize()`](../reference/api/pandas.json_normalize.html#pandas.json_normalize "pandas.json_normalize") where `errors=ignore` could fail to ignore missing values of `meta` when `record_path` has a length greater than one ([GH 41876](https://github.com/pandas-dev/pandas/issues/41876)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") with multi-header input and arguments referencing column names as tuples ([GH 42446](https://github.com/pandas-dev/pandas/issues/42446)) +* Bug in [`read_fwf()`](../reference/api/pandas.read_fwf.html#pandas.read_fwf "pandas.read_fwf"), where difference in lengths of `colspecs` and `names` was not raising `ValueError` ([GH 40830](https://github.com/pandas-dev/pandas/issues/40830)) +* Bug in [`Series.to_json()`](../reference/api/pandas.Series.to_json.html#pandas.Series.to_json "pandas.Series.to_json") and [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") where some attributes were skipped when serializing plain Python objects to JSON ([GH 42768](https://github.com/pandas-dev/pandas/issues/42768), [GH 33043](https://github.com/pandas-dev/pandas/issues/33043)) +* Column headers are dropped when constructing a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") from a sqlalchemy’s `Row` object ([GH 40682](https://github.com/pandas-dev/pandas/issues/40682)) +* Bug in unpickling an [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with object dtype incorrectly inferring numeric dtypes ([GH 43188](https://github.com/pandas-dev/pandas/issues/43188)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") where reading multi-header input with unequal lengths incorrectly raised `IndexError` ([GH 43102](https://github.com/pandas-dev/pandas/issues/43102)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") raising `ParserError` when reading file in chunks and some chunk blocks have fewer columns than header for `engine="c"` ([GH 21211](https://github.com/pandas-dev/pandas/issues/21211)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv"), changed exception class when expecting a file path name or file-like object from `OSError` to `TypeError` ([GH 43366](https://github.com/pandas-dev/pandas/issues/43366)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") and [`read_fwf()`](../reference/api/pandas.read_fwf.html#pandas.read_fwf "pandas.read_fwf") ignoring all `skiprows` except first when `nrows` is specified for `engine='python'` ([GH 44021](https://github.com/pandas-dev/pandas/issues/44021), [GH 10261](https://github.com/pandas-dev/pandas/issues/10261)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") keeping the original column in object format when `keep_date_col=True` is set ([GH 13378](https://github.com/pandas-dev/pandas/issues/13378)) +* Bug in [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") not handling non-numpy dtypes correctly (especially `category`) ([GH 21892](https://github.com/pandas-dev/pandas/issues/21892), [GH 33205](https://github.com/pandas-dev/pandas/issues/33205)) +* Bug in [`json_normalize()`](../reference/api/pandas.json_normalize.html#pandas.json_normalize "pandas.json_normalize") where multi-character `sep` parameter is incorrectly prefixed to every key ([GH 43831](https://github.com/pandas-dev/pandas/issues/43831)) +* Bug in [`json_normalize()`](../reference/api/pandas.json_normalize.html#pandas.json_normalize "pandas.json_normalize") where reading data with missing multi-level metadata would not respect `errors="ignore"` ([GH 44312](https://github.com/pandas-dev/pandas/issues/44312)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") used second row to guess implicit index if `header` was set to `None` for `engine="python"` ([GH 22144](https://github.com/pandas-dev/pandas/issues/22144)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") not recognizing bad lines when `names` were given for `engine="c"` ([GH 22144](https://github.com/pandas-dev/pandas/issues/22144)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") with `float_precision="round_trip"` which did not skip initial/trailing whitespace ([GH 43713](https://github.com/pandas-dev/pandas/issues/43713)) +* Bug when Python is built without the lzma module: a warning was raised at the pandas import time, even if the lzma capability isn’t used ([GH 43495](https://github.com/pandas-dev/pandas/issues/43495)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") not applying dtype for `index_col` ([GH 9435](https://github.com/pandas-dev/pandas/issues/9435)) +* Bug in dumping/loading a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with `yaml.dump(frame)` ([GH 42748](https://github.com/pandas-dev/pandas/issues/42748)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") raising `ValueError` when `names` was longer than `header` but equal to data rows for `engine="python"` ([GH 38453](https://github.com/pandas-dev/pandas/issues/38453)) +* Bug in [`ExcelWriter`](../reference/api/pandas.ExcelWriter.html#pandas.ExcelWriter "pandas.ExcelWriter"), where `engine_kwargs` were not passed through to all engines ([GH 43442](https://github.com/pandas-dev/pandas/issues/43442)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") raising `ValueError` when `parse_dates` was used with [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") columns ([GH 8991](https://github.com/pandas-dev/pandas/issues/8991)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") not raising an `ValueError` when `\n` was specified as `delimiter` or `sep` which conflicts with `lineterminator` ([GH 43528](https://github.com/pandas-dev/pandas/issues/43528)) +* Bug in `to_csv()` converting datetimes in categorical [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") to integers ([GH 40754](https://github.com/pandas-dev/pandas/issues/40754)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") converting columns to numeric after date parsing failed ([GH 11019](https://github.com/pandas-dev/pandas/issues/11019)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") not replacing `NaN` values with `np.nan` before attempting date conversion ([GH 26203](https://github.com/pandas-dev/pandas/issues/26203)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") raising `AttributeError` when attempting to read a .csv file and infer index column dtype from an nullable integer type ([GH 44079](https://github.com/pandas-dev/pandas/issues/44079)) +* Bug in `to_csv()` always coercing datetime columns with different formats to the same format ([GH 21734](https://github.com/pandas-dev/pandas/issues/21734)) +* [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") and [`Series.to_csv()`](../reference/api/pandas.Series.to_csv.html#pandas.Series.to_csv "pandas.Series.to_csv") with `compression` set to `'zip'` no longer create a zip file containing a file ending with “.zip”. Instead, they try to infer the inner file name more smartly ([GH 39465](https://github.com/pandas-dev/pandas/issues/39465)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") where reading a mixed column of booleans and missing values to a float type results in the missing values becoming 1.0 rather than NaN ([GH 42808](https://github.com/pandas-dev/pandas/issues/42808), [GH 34120](https://github.com/pandas-dev/pandas/issues/34120)) +* Bug in `to_xml()` raising error for `pd.NA` with extension array dtype ([GH 43903](https://github.com/pandas-dev/pandas/issues/43903)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") when passing simultaneously a parser in `date_parser` and `parse_dates=False`, the parsing was still called ([GH 44366](https://github.com/pandas-dev/pandas/issues/44366)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") not setting name of [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") columns correctly when `index_col` is not the first column ([GH 38549](https://github.com/pandas-dev/pandas/issues/38549)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") silently ignoring errors when failing to create a memory-mapped file ([GH 44766](https://github.com/pandas-dev/pandas/issues/44766)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") when passing a `tempfile.SpooledTemporaryFile` opened in binary mode ([GH 44748](https://github.com/pandas-dev/pandas/issues/44748)) +* Bug in [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") raising `ValueError` when attempting to parse json strings containing “://” ([GH 36271](https://github.com/pandas-dev/pandas/issues/36271)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") when `engine="c"` and `encoding_errors=None` which caused a segfault ([GH 45180](https://github.com/pandas-dev/pandas/issues/45180)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") an invalid value of `usecols` leading to an unclosed file handle ([GH 45384](https://github.com/pandas-dev/pandas/issues/45384)) +* Bug in [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") fix memory leak ([GH 43877](https://github.com/pandas-dev/pandas/issues/43877)) + +### Period[#](#period "Link to this heading") + +* Bug in adding a [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") object to a `np.timedelta64` object incorrectly raising `TypeError` ([GH 44182](https://github.com/pandas-dev/pandas/issues/44182)) +* Bug in [`PeriodIndex.to_timestamp()`](../reference/api/pandas.PeriodIndex.to_timestamp.html#pandas.PeriodIndex.to_timestamp "pandas.PeriodIndex.to_timestamp") when the index has `freq="B"` inferring `freq="D"` for its result instead of `freq="B"` ([GH 44105](https://github.com/pandas-dev/pandas/issues/44105)) +* Bug in [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") constructor incorrectly allowing `np.timedelta64("NaT")` ([GH 44507](https://github.com/pandas-dev/pandas/issues/44507)) +* Bug in [`PeriodIndex.to_timestamp()`](../reference/api/pandas.PeriodIndex.to_timestamp.html#pandas.PeriodIndex.to_timestamp "pandas.PeriodIndex.to_timestamp") giving incorrect values for indexes with non-contiguous data ([GH 44100](https://github.com/pandas-dev/pandas/issues/44100)) +* Bug in [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where") with `PeriodDtype` incorrectly raising when the `where` call should not replace anything ([GH 45135](https://github.com/pandas-dev/pandas/issues/45135)) + +### Plotting[#](#plotting "Link to this heading") + +* When given non-numeric data, [`DataFrame.boxplot()`](../reference/api/pandas.DataFrame.boxplot.html#pandas.DataFrame.boxplot "pandas.DataFrame.boxplot") now raises a `ValueError` rather than a cryptic `KeyError` or `ZeroDivisionError`, in line with other plotting functions like [`DataFrame.hist()`](../reference/api/pandas.DataFrame.hist.html#pandas.DataFrame.hist "pandas.DataFrame.hist") ([GH 43480](https://github.com/pandas-dev/pandas/issues/43480)) + +### Groupby/resample/rolling[#](#groupby-resample-rolling "Link to this heading") + +* Bug in `SeriesGroupBy.apply()` where passing an unrecognized string argument failed to raise `TypeError` when the underlying `Series` is empty ([GH 42021](https://github.com/pandas-dev/pandas/issues/42021)) +* Bug in `Series.rolling.apply()`, `DataFrame.rolling.apply()`, `Series.expanding.apply()` and `DataFrame.expanding.apply()` with `engine="numba"` where `*args` were being cached with the user passed function ([GH 42287](https://github.com/pandas-dev/pandas/issues/42287)) +* Bug in [`DataFrameGroupBy.max()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.max.html#pandas.core.groupby.DataFrameGroupBy.max "pandas.core.groupby.DataFrameGroupBy.max"), [`SeriesGroupBy.max()`](../reference/api/pandas.core.groupby.SeriesGroupBy.max.html#pandas.core.groupby.SeriesGroupBy.max "pandas.core.groupby.SeriesGroupBy.max"), [`DataFrameGroupBy.min()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.min.html#pandas.core.groupby.DataFrameGroupBy.min "pandas.core.groupby.DataFrameGroupBy.min"), and [`SeriesGroupBy.min()`](../reference/api/pandas.core.groupby.SeriesGroupBy.min.html#pandas.core.groupby.SeriesGroupBy.min "pandas.core.groupby.SeriesGroupBy.min") with nullable integer dtypes losing precision ([GH 41743](https://github.com/pandas-dev/pandas/issues/41743)) +* Bug in `DataFrame.groupby.rolling.var()` would calculate the rolling variance only on the first group ([GH 42442](https://github.com/pandas-dev/pandas/issues/42442)) +* Bug in [`DataFrameGroupBy.shift()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.shift.html#pandas.core.groupby.DataFrameGroupBy.shift "pandas.core.groupby.DataFrameGroupBy.shift") and [`SeriesGroupBy.shift()`](../reference/api/pandas.core.groupby.SeriesGroupBy.shift.html#pandas.core.groupby.SeriesGroupBy.shift "pandas.core.groupby.SeriesGroupBy.shift") that would return the grouping columns if `fill_value` was not `None` ([GH 41556](https://github.com/pandas-dev/pandas/issues/41556)) +* Bug in `SeriesGroupBy.nlargest()` and `SeriesGroupBy.nsmallest()` would have an inconsistent index when the input [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") was sorted and `n` was greater than or equal to all group sizes ([GH 15272](https://github.com/pandas-dev/pandas/issues/15272), [GH 16345](https://github.com/pandas-dev/pandas/issues/16345), [GH 29129](https://github.com/pandas-dev/pandas/issues/29129)) +* Bug in [`pandas.DataFrame.ewm()`](../reference/api/pandas.DataFrame.ewm.html#pandas.DataFrame.ewm "pandas.DataFrame.ewm"), where non-float64 dtypes were silently failing ([GH 42452](https://github.com/pandas-dev/pandas/issues/42452)) +* Bug in [`pandas.DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") operation along rows (`axis=1`) incorrectly omits columns containing `float16` and `float32` ([GH 41779](https://github.com/pandas-dev/pandas/issues/41779)) +* Bug in `Resampler.aggregate()` did not allow the use of Named Aggregation ([GH 32803](https://github.com/pandas-dev/pandas/issues/32803)) +* Bug in [`Series.rolling()`](../reference/api/pandas.Series.rolling.html#pandas.Series.rolling "pandas.Series.rolling") when the [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") `dtype` was `Int64` ([GH 43016](https://github.com/pandas-dev/pandas/issues/43016)) +* Bug in `DataFrame.rolling.corr()` when the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") columns was a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 21157](https://github.com/pandas-dev/pandas/issues/21157)) +* Bug in `DataFrame.groupby.rolling()` when specifying `on` and calling `__getitem__` would subsequently return incorrect results ([GH 43355](https://github.com/pandas-dev/pandas/issues/43355)) +* Bug in [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") and [`SeriesGroupBy.apply()`](../reference/api/pandas.core.groupby.SeriesGroupBy.apply.html#pandas.core.groupby.SeriesGroupBy.apply "pandas.core.groupby.SeriesGroupBy.apply") with time-based [`Grouper`](../reference/api/pandas.Grouper.html#pandas.Grouper "pandas.Grouper") objects incorrectly raising `ValueError` in corner cases where the grouping vector contains a `NaT` ([GH 43500](https://github.com/pandas-dev/pandas/issues/43500), [GH 43515](https://github.com/pandas-dev/pandas/issues/43515)) +* Bug in [`DataFrameGroupBy.mean()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.mean.html#pandas.core.groupby.DataFrameGroupBy.mean "pandas.core.groupby.DataFrameGroupBy.mean") and [`SeriesGroupBy.mean()`](../reference/api/pandas.core.groupby.SeriesGroupBy.mean.html#pandas.core.groupby.SeriesGroupBy.mean "pandas.core.groupby.SeriesGroupBy.mean") failing with `complex` dtype ([GH 43701](https://github.com/pandas-dev/pandas/issues/43701)) +* Bug in [`Series.rolling()`](../reference/api/pandas.Series.rolling.html#pandas.Series.rolling "pandas.Series.rolling") and [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") not calculating window bounds correctly for the first row when `center=True` and index is decreasing ([GH 43927](https://github.com/pandas-dev/pandas/issues/43927)) +* Bug in [`Series.rolling()`](../reference/api/pandas.Series.rolling.html#pandas.Series.rolling "pandas.Series.rolling") and [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") for centered datetimelike windows with uneven nanosecond ([GH 43997](https://github.com/pandas-dev/pandas/issues/43997)) +* Bug in [`DataFrameGroupBy.mean()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.mean.html#pandas.core.groupby.DataFrameGroupBy.mean "pandas.core.groupby.DataFrameGroupBy.mean") and [`SeriesGroupBy.mean()`](../reference/api/pandas.core.groupby.SeriesGroupBy.mean.html#pandas.core.groupby.SeriesGroupBy.mean "pandas.core.groupby.SeriesGroupBy.mean") raising `KeyError` when column was selected at least twice ([GH 44924](https://github.com/pandas-dev/pandas/issues/44924)) +* Bug in [`DataFrameGroupBy.nth()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.nth.html#pandas.core.groupby.DataFrameGroupBy.nth "pandas.core.groupby.DataFrameGroupBy.nth") and [`SeriesGroupBy.nth()`](../reference/api/pandas.core.groupby.SeriesGroupBy.nth.html#pandas.core.groupby.SeriesGroupBy.nth "pandas.core.groupby.SeriesGroupBy.nth") failing on `axis=1` ([GH 43926](https://github.com/pandas-dev/pandas/issues/43926)) +* Bug in [`Series.rolling()`](../reference/api/pandas.Series.rolling.html#pandas.Series.rolling "pandas.Series.rolling") and [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") not respecting right bound on centered datetime-like windows, if the index contain duplicates ([GH 3944](https://github.com/pandas-dev/pandas/issues/3944)) +* Bug in [`Series.rolling()`](../reference/api/pandas.Series.rolling.html#pandas.Series.rolling "pandas.Series.rolling") and [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") when using a [`pandas.api.indexers.BaseIndexer`](../reference/api/pandas.api.indexers.BaseIndexer.html#pandas.api.indexers.BaseIndexer "pandas.api.indexers.BaseIndexer") subclass that returned unequal start and end arrays would segfault instead of raising a `ValueError` ([GH 44470](https://github.com/pandas-dev/pandas/issues/44470)) +* Bug in `Groupby.nunique()` not respecting `observed=True` for `categorical` grouping columns ([GH 45128](https://github.com/pandas-dev/pandas/issues/45128)) +* Bug in [`DataFrameGroupBy.head()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.head.html#pandas.core.groupby.DataFrameGroupBy.head "pandas.core.groupby.DataFrameGroupBy.head"), [`SeriesGroupBy.head()`](../reference/api/pandas.core.groupby.SeriesGroupBy.head.html#pandas.core.groupby.SeriesGroupBy.head "pandas.core.groupby.SeriesGroupBy.head"), [`DataFrameGroupBy.tail()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.tail.html#pandas.core.groupby.DataFrameGroupBy.tail "pandas.core.groupby.DataFrameGroupBy.tail"), and [`SeriesGroupBy.tail()`](../reference/api/pandas.core.groupby.SeriesGroupBy.tail.html#pandas.core.groupby.SeriesGroupBy.tail "pandas.core.groupby.SeriesGroupBy.tail") not dropping groups with `NaN` when `dropna=True` ([GH 45089](https://github.com/pandas-dev/pandas/issues/45089)) +* Bug in `GroupBy.__iter__()` after selecting a subset of columns in a `GroupBy` object, which returned all columns instead of the chosen subset ([GH 44821](https://github.com/pandas-dev/pandas/issues/44821)) +* Bug in `Groupby.rolling()` when non-monotonic data passed, fails to correctly raise `ValueError` ([GH 43909](https://github.com/pandas-dev/pandas/issues/43909)) +* Bug where grouping by a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") that has a `categorical` data type and length unequal to the axis of grouping raised `ValueError` ([GH 44179](https://github.com/pandas-dev/pandas/issues/44179)) + +### Reshaping[#](#reshaping "Link to this heading") + +* Improved error message when creating a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") column from a multi-dimensional [`numpy.ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.3)") ([GH 42463](https://github.com/pandas-dev/pandas/issues/42463)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") creating [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") with duplicate level entries when concatenating a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with duplicates in [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") and multiple keys ([GH 42651](https://github.com/pandas-dev/pandas/issues/42651)) +* Bug in [`pandas.cut()`](../reference/api/pandas.cut.html#pandas.cut "pandas.cut") on [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with duplicate indices and non-exact [`pandas.CategoricalIndex()`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") ([GH 42185](https://github.com/pandas-dev/pandas/issues/42185), [GH 42425](https://github.com/pandas-dev/pandas/issues/42425)) +* Bug in `DataFrame.append()` failing to retain dtypes when appended columns do not match ([GH 43392](https://github.com/pandas-dev/pandas/issues/43392)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") of `bool` and `boolean` dtypes resulting in `object` dtype instead of `boolean` dtype ([GH 42800](https://github.com/pandas-dev/pandas/issues/42800)) +* Bug in [`crosstab()`](../reference/api/pandas.crosstab.html#pandas.crosstab "pandas.crosstab") when inputs are categorical [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), there are categories that are not present in one or both of the [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), and `margins=True`. Previously the margin value for missing categories was `NaN`. It is now correctly reported as 0 ([GH 43505](https://github.com/pandas-dev/pandas/issues/43505)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") would fail when the `objs` argument all had the same index and the `keys` argument contained duplicates ([GH 43595](https://github.com/pandas-dev/pandas/issues/43595)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") which ignored the `sort` parameter ([GH 43375](https://github.com/pandas-dev/pandas/issues/43375)) +* Bug in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") with [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") as column index for the `on` argument returning an error when assigning a column internally ([GH 43734](https://github.com/pandas-dev/pandas/issues/43734)) +* Bug in [`crosstab()`](../reference/api/pandas.crosstab.html#pandas.crosstab "pandas.crosstab") would fail when inputs are lists or tuples ([GH 44076](https://github.com/pandas-dev/pandas/issues/44076)) +* Bug in `DataFrame.append()` failing to retain `index.name` when appending a list of [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") objects ([GH 44109](https://github.com/pandas-dev/pandas/issues/44109)) +* Fixed metadata propagation in `Dataframe.apply()` method, consequently fixing the same issue for `Dataframe.transform()`, `Dataframe.nunique()` and `Dataframe.mode()` ([GH 28283](https://github.com/pandas-dev/pandas/issues/28283)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") casting levels of [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") to float if all levels only consist of missing values ([GH 44900](https://github.com/pandas-dev/pandas/issues/44900)) +* Bug in [`DataFrame.stack()`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack") with `ExtensionDtype` columns incorrectly raising ([GH 43561](https://github.com/pandas-dev/pandas/issues/43561)) +* Bug in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") raising `KeyError` when joining over differently named indexes with on keywords ([GH 45094](https://github.com/pandas-dev/pandas/issues/45094)) +* Bug in [`Series.unstack()`](../reference/api/pandas.Series.unstack.html#pandas.Series.unstack "pandas.Series.unstack") with object doing unwanted type inference on resulting columns ([GH 44595](https://github.com/pandas-dev/pandas/issues/44595)) +* Bug in `MultiIndex.join()` with overlapping `IntervalIndex` levels ([GH 44096](https://github.com/pandas-dev/pandas/issues/44096)) +* Bug in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") and [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") results is different `dtype` based on `regex` parameter ([GH 44864](https://github.com/pandas-dev/pandas/issues/44864)) +* Bug in [`DataFrame.pivot()`](../reference/api/pandas.DataFrame.pivot.html#pandas.DataFrame.pivot "pandas.DataFrame.pivot") with `index=None` when the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") index was a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 23955](https://github.com/pandas-dev/pandas/issues/23955)) + +### Sparse[#](#sparse "Link to this heading") + +* Bug in [`DataFrame.sparse.to_coo()`](../reference/api/pandas.DataFrame.sparse.to_coo.html#pandas.DataFrame.sparse.to_coo "pandas.DataFrame.sparse.to_coo") raising `AttributeError` when column names are not unique ([GH 29564](https://github.com/pandas-dev/pandas/issues/29564)) +* Bug in `SparseArray.max()` and `SparseArray.min()` raising `ValueError` for arrays with 0 non-null elements ([GH 43527](https://github.com/pandas-dev/pandas/issues/43527)) +* Bug in [`DataFrame.sparse.to_coo()`](../reference/api/pandas.DataFrame.sparse.to_coo.html#pandas.DataFrame.sparse.to_coo "pandas.DataFrame.sparse.to_coo") silently converting non-zero fill values to zero ([GH 24817](https://github.com/pandas-dev/pandas/issues/24817)) +* Bug in `SparseArray` comparison methods with an array-like operand of mismatched length raising `AssertionError` or unclear `ValueError` depending on the input ([GH 43863](https://github.com/pandas-dev/pandas/issues/43863)) +* Bug in `SparseArray` arithmetic methods `floordiv` and `mod` behaviors when dividing by zero not matching the non-sparse [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") behavior ([GH 38172](https://github.com/pandas-dev/pandas/issues/38172)) +* Bug in `SparseArray` unary methods as well as `SparseArray.isna()` doesn’t recalculate indexes ([GH 44955](https://github.com/pandas-dev/pandas/issues/44955)) + +### ExtensionArray[#](#extensionarray "Link to this heading") + +* Bug in [`array()`](../reference/api/pandas.array.html#pandas.array "pandas.array") failing to preserve `PandasArray` ([GH 43887](https://github.com/pandas-dev/pandas/issues/43887)) +* NumPy ufuncs `np.abs`, `np.positive`, `np.negative` now correctly preserve dtype when called on ExtensionArrays that implement `__abs__, __pos__, __neg__`, respectively. In particular this is fixed for `TimedeltaArray` ([GH 43899](https://github.com/pandas-dev/pandas/issues/43899), [GH 23316](https://github.com/pandas-dev/pandas/issues/23316)) +* NumPy ufuncs `np.minimum.reduce` `np.maximum.reduce`, `np.add.reduce`, and `np.prod.reduce` now work correctly instead of raising `NotImplementedError` on [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `IntegerDtype` or `FloatDtype` ([GH 43923](https://github.com/pandas-dev/pandas/issues/43923), [GH 44793](https://github.com/pandas-dev/pandas/issues/44793)) +* NumPy ufuncs with `out` keyword are now supported by arrays with `IntegerDtype` and `FloatingDtype` ([GH 45122](https://github.com/pandas-dev/pandas/issues/45122)) +* Avoid raising `PerformanceWarning` about fragmented [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") when using many columns with an extension dtype ([GH 44098](https://github.com/pandas-dev/pandas/issues/44098)) +* Bug in `IntegerArray` and `FloatingArray` construction incorrectly coercing mismatched NA values (e.g. `np.timedelta64("NaT")`) to numeric NA ([GH 44514](https://github.com/pandas-dev/pandas/issues/44514)) +* Bug in `BooleanArray.__eq__()` and `BooleanArray.__ne__()` raising `TypeError` on comparison with an incompatible type (like a string). This caused [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") to sometimes raise a `TypeError` if a nullable boolean column was included ([GH 44499](https://github.com/pandas-dev/pandas/issues/44499)) +* Bug in [`array()`](../reference/api/pandas.array.html#pandas.array "pandas.array") incorrectly raising when passed a `ndarray` with `float16` dtype ([GH 44715](https://github.com/pandas-dev/pandas/issues/44715)) +* Bug in calling `np.sqrt` on `BooleanArray` returning a malformed `FloatingArray` ([GH 44715](https://github.com/pandas-dev/pandas/issues/44715)) +* Bug in [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where") with `ExtensionDtype` when `other` is a NA scalar incompatible with the [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") dtype (e.g. `NaT` with a numeric dtype) incorrectly casting to a compatible NA value ([GH 44697](https://github.com/pandas-dev/pandas/issues/44697)) +* Bug in [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") where explicitly passing `value=None` is treated as if no `value` was passed, and `None` not being in the result ([GH 36984](https://github.com/pandas-dev/pandas/issues/36984), [GH 19998](https://github.com/pandas-dev/pandas/issues/19998)) +* Bug in [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") with unwanted downcasting being done in no-op replacements ([GH 44498](https://github.com/pandas-dev/pandas/issues/44498)) +* Bug in [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") with `FloatDtype`, `string[python]`, or `string[pyarrow]` dtype not being preserved when possible ([GH 33484](https://github.com/pandas-dev/pandas/issues/33484), [GH 40732](https://github.com/pandas-dev/pandas/issues/40732), [GH 31644](https://github.com/pandas-dev/pandas/issues/31644), [GH 41215](https://github.com/pandas-dev/pandas/issues/41215), [GH 25438](https://github.com/pandas-dev/pandas/issues/25438)) + +### Styler[#](#id2 "Link to this heading") + +* Bug in [`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") where the `uuid` at initialization maintained a floating underscore ([GH 43037](https://github.com/pandas-dev/pandas/issues/43037)) +* Bug in [`Styler.to_html()`](../reference/api/pandas.io.formats.style.Styler.to_html.html#pandas.io.formats.style.Styler.to_html "pandas.io.formats.style.Styler.to_html") where the `Styler` object was updated if the `to_html` method was called with some args ([GH 43034](https://github.com/pandas-dev/pandas/issues/43034)) +* Bug in `Styler.copy()` where `uuid` was not previously copied ([GH 40675](https://github.com/pandas-dev/pandas/issues/40675)) +* Bug in `Styler.apply()` where functions which returned [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") objects were not correctly handled in terms of aligning their index labels ([GH 13657](https://github.com/pandas-dev/pandas/issues/13657), [GH 42014](https://github.com/pandas-dev/pandas/issues/42014)) +* Bug when rendering an empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a named [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") ([GH 43305](https://github.com/pandas-dev/pandas/issues/43305)) +* Bug when rendering a single level [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 43383](https://github.com/pandas-dev/pandas/issues/43383)) +* Bug when combining non-sparse rendering and `Styler.hide_columns()` or `Styler.hide_index()` ([GH 43464](https://github.com/pandas-dev/pandas/issues/43464)) +* Bug setting a table style when using multiple selectors in [`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") ([GH 44011](https://github.com/pandas-dev/pandas/issues/44011)) +* Bugs where row trimming and column trimming failed to reflect hidden rows ([GH 43703](https://github.com/pandas-dev/pandas/issues/43703), [GH 44247](https://github.com/pandas-dev/pandas/issues/44247)) + +### Other[#](#other "Link to this heading") + +* Bug in [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") with non-unique columns and a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") `dtype` argument ([GH 44417](https://github.com/pandas-dev/pandas/issues/44417)) +* Bug in `CustomBusinessMonthBegin.__add__()` (`CustomBusinessMonthEnd.__add__()`) not applying the extra `offset` parameter when beginning (end) of the target month is already a business day ([GH 41356](https://github.com/pandas-dev/pandas/issues/41356)) +* Bug in `RangeIndex.union()` with another `RangeIndex` with matching (even) `step` and starts differing by strictly less than `step / 2` ([GH 44019](https://github.com/pandas-dev/pandas/issues/44019)) +* Bug in `RangeIndex.difference()` with `sort=None` and `step<0` failing to sort ([GH 44085](https://github.com/pandas-dev/pandas/issues/44085)) +* Bug in [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") and [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") with `value=None` and ExtensionDtypes ([GH 44270](https://github.com/pandas-dev/pandas/issues/44270), [GH 37899](https://github.com/pandas-dev/pandas/issues/37899)) +* Bug in `FloatingArray.equals()` failing to consider two arrays equal if they contain `np.nan` values ([GH 44382](https://github.com/pandas-dev/pandas/issues/44382)) +* Bug in [`DataFrame.shift()`](../reference/api/pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift") with `axis=1` and `ExtensionDtype` columns incorrectly raising when an incompatible `fill_value` is passed ([GH 44564](https://github.com/pandas-dev/pandas/issues/44564)) +* Bug in [`DataFrame.shift()`](../reference/api/pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift") with `axis=1` and `periods` larger than `len(frame.columns)` producing an invalid [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 44978](https://github.com/pandas-dev/pandas/issues/44978)) +* Bug in [`DataFrame.diff()`](../reference/api/pandas.DataFrame.diff.html#pandas.DataFrame.diff "pandas.DataFrame.diff") when passing a NumPy integer object instead of an `int` object ([GH 44572](https://github.com/pandas-dev/pandas/issues/44572)) +* Bug in [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") raising `ValueError` when using `regex=True` with a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") containing `np.nan` values ([GH 43344](https://github.com/pandas-dev/pandas/issues/43344)) +* Bug in [`DataFrame.to_records()`](../reference/api/pandas.DataFrame.to_records.html#pandas.DataFrame.to_records "pandas.DataFrame.to_records") where an incorrect `n` was used when missing names were replaced by `level_n` ([GH 44818](https://github.com/pandas-dev/pandas/issues/44818)) +* Bug in [`DataFrame.eval()`](../reference/api/pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval") where `resolvers` argument was overriding the default resolvers ([GH 34966](https://github.com/pandas-dev/pandas/issues/34966)) +* `Series.__repr__()` and `DataFrame.__repr__()` no longer replace all null-values in indexes with “NaN” but use their real string-representations. “NaN” is used only for `float("nan")` ([GH 45263](https://github.com/pandas-dev/pandas/issues/45263)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 275 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Abhishek R +* Albert Villanova del Moral +* Alessandro Bisiani + +* Alex Lim +* Alex-Gregory-1 + +* Alexander Gorodetsky +* Alexander Regueiro + +* Alexey Györi +* Alexis Mignon +* Aleš Erjavec +* Ali McMaster +* Alibi + +* Andrei Batomunkuev + +* Andrew Eckart + +* Andrew Hawyrluk +* Andrew Wood +* Anton Lodder + +* Armin Berres + +* Arushi Sharma + +* Benedikt Heidrich + +* Beni Bienz + +* Benoît Vinot +* Bert Palm + +* Boris Rumyantsev + +* Brian Hulette +* Brock +* Bruno Costa + +* Bryan Racic + +* Caleb Epstein +* Calvin Ho +* ChristofKaufmann + +* Christopher Yeh + +* Chuliang Xiao + +* ClaudiaSilver + +* DSM +* Daniel Coll + +* Daniel Schmidt + +* Dare Adewumi +* David + +* David Sanders + +* David Wales + +* Derzan Chiang + +* DeviousLab + +* Dhruv B Shetty + +* Digres45 + +* Dominik Kutra + +* Drew Levitt + +* DriesS +* EdAbati +* Elle +* Elliot Rampono +* Endre Mark Borza +* Erfan Nariman +* Evgeny Naumov + +* Ewout ter Hoeven + +* Fangchen Li +* Felix Divo +* Felix Dulys + +* Francesco Andreuzzi + +* Francois Dion + +* Frans Larsson + +* Fred Reiss +* GYvan +* Gabriel Di Pardi Arruda + +* Gesa Stupperich +* Giacomo Caria + +* Greg Siano + +* Griffin Ansel +* Hiroaki Ogasawara + +* Horace + +* Horace Lai + +* Irv Lustig +* Isaac Virshup +* JHM Darbyshire (MBP) +* JHM Darbyshire (iMac) +* JHM Darbyshire + +* Jack Liu +* Jacob Skwirsk + +* Jaime Di Cristina + +* James Holcombe + +* Janosh Riebesell + +* Jarrod Millman +* Jason Bian + +* Jeff Reback +* Jernej Makovsek + +* Jim Bradley + +* Joel Gibson + +* Joeperdefloep + +* Johannes Mueller + +* John S Bogaardt + +* John Zangwill + +* Jon Haitz Legarreta Gorroño + +* Jon Wiggins + +* Jonas Haag + +* Joris Van den Bossche +* Josh Friedlander +* José Duarte + +* Julian Fleischer + +* Julien de la Bruère-T +* Justin McOmie +* Kadatatlu Kishore + +* Kaiqi Dong +* Kashif Khan + +* Kavya9986 + +* Kendall + +* Kevin Sheppard +* Kiley Hewitt +* Koen Roelofs + +* Krishna Chivukula +* KrishnaSai2020 +* Leonardo Freua + +* Leonardus Chen +* Liang-Chi Hsieh + +* Loic Diridollou + +* Lorenzo Maffioli + +* Luke Manley + +* LunarLanding + +* Marc Garcia +* Marcel Bittar + +* Marcel Gerber + +* Marco Edward Gorelli +* Marco Gorelli +* MarcoGorelli +* Marvin + +* Mateusz Piotrowski + +* Mathias Hauser + +* Matt Richards + +* Matthew Davis + +* Matthew Roeschke +* Matthew Zeitlin +* Matthias Bussonnier +* Matti Picus +* Mauro Silberberg + +* Maxim Ivanov +* Maximilian Carr + +* MeeseeksMachine +* Michael Sarrazin + +* Michael Wang + +* Michał Górny + +* Mike Phung + +* Mike Taves + +* Mohamad Hussein Rkein + +* NJOKU OKECHUKWU VALENTINE + +* Neal McBurnett + +* Nick Anderson + +* Nikita Sobolev + +* Olivier Cavadenti + +* PApostol + +* Pandas Development Team +* Patrick Hoefler +* Peter +* Peter Tillmann + +* Prabha Arivalagan + +* Pradyumna Rahul +* Prerana Chakraborty +* Prithvijit + +* Rahul Gaikwad + +* Ray Bell +* Ricardo Martins + +* Richard Shadrach +* Robbert-jan ‘t Hoen + +* Robert Voyer + +* Robin Raymond + +* Rohan Sharma + +* Rohan Sirohia + +* Roman Yurchak +* Ruan Pretorius + +* Sam James + +* Scott Talbert +* Shashwat Sharma + +* Sheogorath27 + +* Shiv Gupta +* Shoham Debnath +* Simon Hawkins +* Soumya + +* Stan West + +* Stefanie Molin + +* Stefano Alberto Russo + +* Stephan Heßelmann +* Stephen +* Suyash Gupta + +* Sven +* Swanand01 + +* Sylvain Marié + +* TLouf +* Tania Allard + +* Terji Petersen +* TheDerivator + +* Thomas Dickson +* Thomas Kastl + +* Thomas Kluyver +* Thomas Li +* Thomas Smith +* Tim Swast +* Tim Tran + +* Tobias McNulty + +* Tobias Pitters +* Tomoki Nakagawa + +* Tony Hirst + +* Torsten Wörtwein +* V.I. Wood + +* Vaibhav K + +* Valentin Oliver Loftsson + +* Varun Shrivastava + +* Vivek Thazhathattil + +* Vyom Pathak +* Wenjun Si +* William Andrea + +* William Bradley + +* Wojciech Sadowski + +* Yao-Ching Huang + +* Yash Gupta + +* Yiannis Hadjicharalambous + +* Yoshiki Vázquez Baeza +* Yuanhao Geng +* Yury Mikhaylov +* Yvan Gatete + +* Yves Delley + +* Zach Rait +* Zbyszek Królikowski + +* Zero + +* Zheyuan +* Zhiyi Wu + +* aiudirog +* ali sayyah + +* aneesh98 + +* aptalca +* arw2019 + +* attack68 +* brendandrury + +* bubblingoak + +* calvinsomething + +* claws + +* deponovo + +* dicristina +* el-g-1 + +* evensure + +* fotino21 + +* fshi01 + +* gfkang + +* github-actions[bot] +* i-aki-y +* jbrockmendel +* jreback +* juliandwain + +* jxb4892 + +* kendall smith + +* lmcindewar + +* lrepiton +* maximilianaccardo + +* michal-gh +* neelmraman +* partev +* phofl + +* pratyushsharan + +* quantumalaviya + +* rafael + +* realead +* rocabrera + +* rosagold +* saehuihwang + +* salomondush + +* shubham11941140 + +* srinivasan + +* stphnlyd +* suoniq +* trevorkask + +* tushushu +* tyuyoshi + +* usersblock + +* vernetya + +* vrserpa + +* willie3838 + +* zeitlinv + +* zhangxiaoxing + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.4.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.4.1.md new file mode 100644 index 0000000000000000000000000000000000000000..2fc93af51e9660a60af501b5f690c549f1094271 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.4.1.md @@ -0,0 +1,59 @@ +# What's new in pandas 1.4.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.4.1.html + +# What’s new in 1.4.1 (February 12, 2022)[#](#what-s-new-in-1-4-1-february-12-2022 "Link to this heading") + +These are the changes in pandas 1.4.1. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Regression in [`Series.mask()`](../reference/api/pandas.Series.mask.html#pandas.Series.mask "pandas.Series.mask") with `inplace=True` and `PeriodDtype` and an incompatible `other` coercing to a common dtype instead of raising ([GH 45546](https://github.com/pandas-dev/pandas/issues/45546)) +* Regression in [`assert_frame_equal()`](../reference/api/pandas.testing.assert_frame_equal.html#pandas.testing.assert_frame_equal "pandas.testing.assert_frame_equal") not respecting `check_flags=False` ([GH 45554](https://github.com/pandas-dev/pandas/issues/45554)) +* Regression in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") raising `ValueError` when indexing (getting values) on a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") with one level ([GH 45779](https://github.com/pandas-dev/pandas/issues/45779)) +* Regression in [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") with `downcast=False` incorrectly downcasting `object` dtype ([GH 45603](https://github.com/pandas-dev/pandas/issues/45603)) +* Regression in [`api.types.is_bool_dtype()`](../reference/api/pandas.api.types.is_bool_dtype.html#pandas.api.types.is_bool_dtype "pandas.api.types.is_bool_dtype") raising an `AttributeError` when evaluating a categorical [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") ([GH 45615](https://github.com/pandas-dev/pandas/issues/45615)) +* Regression in [`DataFrame.iat()`](../reference/api/pandas.DataFrame.iat.html#pandas.DataFrame.iat "pandas.DataFrame.iat") setting values leading to not propagating correctly in subsequent lookups ([GH 45684](https://github.com/pandas-dev/pandas/issues/45684)) +* Regression when setting values with [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") losing [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") name if [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") was empty before ([GH 45621](https://github.com/pandas-dev/pandas/issues/45621)) +* Regression in [`join()`](../reference/api/pandas.Index.join.html#pandas.Index.join "pandas.Index.join") with overlapping [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") raising an `InvalidIndexError` ([GH 45661](https://github.com/pandas-dev/pandas/issues/45661)) +* Regression when setting values with [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") raising with all `False` indexer and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") on the right hand side ([GH 45778](https://github.com/pandas-dev/pandas/issues/45778)) +* Regression in [`read_sql()`](../reference/api/pandas.read_sql.html#pandas.read_sql "pandas.read_sql") with a DBAPI2 connection that is not an instance of `sqlite3.Connection` incorrectly requiring SQLAlchemy be installed ([GH 45660](https://github.com/pandas-dev/pandas/issues/45660)) +* Regression in `DateOffset` when constructing with an integer argument with no keywords (e.g. `pd.DateOffset(n)`) would behave like `datetime.timedelta(days=0)` ([GH 45643](https://github.com/pandas-dev/pandas/issues/45643), [GH 45890](https://github.com/pandas-dev/pandas/issues/45890)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Fixed segfault in [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") when dumping tz-aware datetimes in Python 3.10 ([GH 42130](https://github.com/pandas-dev/pandas/issues/42130)) +* Stopped emitting unnecessary `FutureWarning` in [`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values") with sparse columns ([GH 45618](https://github.com/pandas-dev/pandas/issues/45618)) +* Fixed window aggregations in [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") and [`Series.rolling()`](../reference/api/pandas.Series.rolling.html#pandas.Series.rolling "pandas.Series.rolling") to skip over unused elements ([GH 45647](https://github.com/pandas-dev/pandas/issues/45647)) +* Fixed builtin highlighters in [`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") to be responsive to `NA` with nullable dtypes ([GH 45804](https://github.com/pandas-dev/pandas/issues/45804)) +* Bug in `apply()` with `axis=1` raising an erroneous `ValueError` ([GH 45912](https://github.com/pandas-dev/pandas/issues/45912)) + +## Other[#](#other "Link to this heading") + +* Reverted performance speedup of [`DataFrame.corr()`](../reference/api/pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr") for `method=pearson` to fix precision regression ([GH 45640](https://github.com/pandas-dev/pandas/issues/45640), [GH 42761](https://github.com/pandas-dev/pandas/issues/42761)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 19 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Adam Bowden + +* JHM Darbyshire +* Johannes Mueller +* John Zangwill +* Jonas Haag +* Matthew Roeschke +* MeeseeksMachine +* Pandas Development Team +* Patrick Hoefler +* Robbie Palmer + +* Simon Hawkins +* Thomas Li +* Tyler Reddy +* eshirvana + +* gesoos + +* hasan-yaman +* jbrockmendel +* partev +* rtpsw + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.4.2.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.4.2.md new file mode 100644 index 0000000000000000000000000000000000000000..f6cfbeaf2304ad8b7da23e548140a83d7335f0a7 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.4.2.md @@ -0,0 +1,48 @@ +# What's new in pandas 1.4.2 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.4.2.html + +# What’s new in 1.4.2 (April 2, 2022)[#](#what-s-new-in-1-4-2-april-2-2022 "Link to this heading") + +These are the changes in pandas 1.4.2. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in [`DataFrame.drop()`](../reference/api/pandas.DataFrame.drop.html#pandas.DataFrame.drop "pandas.DataFrame.drop") and [`Series.drop()`](../reference/api/pandas.Series.drop.html#pandas.Series.drop "pandas.Series.drop") when [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") had extension dtype and duplicates ([GH 45860](https://github.com/pandas-dev/pandas/issues/45860)) +* Fixed regression in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") killing python process when invalid file input was given for `engine="c"` ([GH 45957](https://github.com/pandas-dev/pandas/issues/45957)) +* Fixed memory performance regression in [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") when called on a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") column with `inplace=True` ([GH 46149](https://github.com/pandas-dev/pandas/issues/46149)) +* Provided an alternative solution for passing custom Excel formats in [`Styler.to_excel()`](../reference/api/pandas.io.formats.style.Styler.to_excel.html#pandas.io.formats.style.Styler.to_excel "pandas.io.formats.style.Styler.to_excel"), which was a regression based on stricter CSS validation. Examples available in the documentation for [`Styler.format()`](../reference/api/pandas.io.formats.style.Styler.format.html#pandas.io.formats.style.Styler.format "pandas.io.formats.style.Styler.format") ([GH 46152](https://github.com/pandas-dev/pandas/issues/46152)) +* Fixed regression in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") when a replacement value was also a target for replacement ([GH 46306](https://github.com/pandas-dev/pandas/issues/46306)) +* Fixed regression in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") when the replacement value was explicitly `None` when passed in a dictionary to `to_replace` ([GH 45601](https://github.com/pandas-dev/pandas/issues/45601), [GH 45836](https://github.com/pandas-dev/pandas/issues/45836)) +* Fixed regression when setting values with [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") losing [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") names if [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") was empty before ([GH 46317](https://github.com/pandas-dev/pandas/issues/46317)) +* Fixed regression when rendering boolean datatype columns with `Styler()` ([GH 46384](https://github.com/pandas-dev/pandas/issues/46384)) +* Fixed regression in `Groupby.rolling()` with a frequency window that would raise a `ValueError` even if the datetimes within each group were monotonic ([GH 46061](https://github.com/pandas-dev/pandas/issues/46061)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Fix some cases for subclasses that define their `_constructor` properties as general callables ([GH 46018](https://github.com/pandas-dev/pandas/issues/46018)) +* Fixed “longtable” formatting in [`Styler.to_latex()`](../reference/api/pandas.io.formats.style.Styler.to_latex.html#pandas.io.formats.style.Styler.to_latex "pandas.io.formats.style.Styler.to_latex") when `column_format` is given in extended format ([GH 46037](https://github.com/pandas-dev/pandas/issues/46037)) +* Fixed incorrect rendering in [`Styler.format()`](../reference/api/pandas.io.formats.style.Styler.format.html#pandas.io.formats.style.Styler.format "pandas.io.formats.style.Styler.format") with `hyperlinks="html"` when the url contains a colon or other special characters ([GH 46389](https://github.com/pandas-dev/pandas/issues/46389)) +* Improved error message in `Rolling` when `window` is a frequency and `NaT` is in the rolling axis ([GH 46087](https://github.com/pandas-dev/pandas/issues/46087)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 15 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Daniel Schmidt +* JHM Darbyshire +* Jonas Haag +* Jordan Hicks + +* Joris Van den Bossche +* Kian Eliasi + +* Luke Manley +* Marco Edward Gorelli +* Matthew Roeschke +* MeeseeksMachine +* Pandas Development Team +* Patrick Hoefler +* Richard Shadrach +* Simon Hawkins +* jbrockmendel diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.4.3.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.4.3.md new file mode 100644 index 0000000000000000000000000000000000000000..616ada2b68ffa602675fb09a55825001199f6210 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.4.3.md @@ -0,0 +1,70 @@ +# What's new in pandas 1.4.3 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.4.3.html + +# What’s new in 1.4.3 (June 23, 2022)[#](#what-s-new-in-1-4-3-june-23-2022 "Link to this heading") + +These are the changes in pandas 1.4.3. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Behavior of `concat` with empty or all-NA DataFrame columns[#](#behavior-of-concat-with-empty-or-all-na-dataframe-columns "Link to this heading") + +The behavior change in version 1.4.0 to stop ignoring the data type +of empty or all-NA columns with float or object dtype in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") +([Ignoring dtypes in concat with empty or all-NA columns](v1.4.0.html#whatsnew-140-notable-bug-fixes-concat-with-empty-or-all-na)) has been +reverted ([GH 45637](https://github.com/pandas-dev/pandas/issues/45637)). + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") when the replacement value was explicitly `None` when passed in a dictionary to `to_replace` also casting other columns to object dtype even when there were no values to replace ([GH 46634](https://github.com/pandas-dev/pandas/issues/46634)) +* Fixed regression in [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") raising error when [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") contains extension dtype categorical column ([GH 46297](https://github.com/pandas-dev/pandas/issues/46297), [GH 46812](https://github.com/pandas-dev/pandas/issues/46812)) +* Fixed regression in representation of `dtypes` attribute of [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 46900](https://github.com/pandas-dev/pandas/issues/46900)) +* Fixed regression when setting values with [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") updating [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") when index was set as new column and column was updated afterwards ([GH 47128](https://github.com/pandas-dev/pandas/issues/47128)) +* Fixed regression in [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") and [`DataFrame.update()`](../reference/api/pandas.DataFrame.update.html#pandas.DataFrame.update "pandas.DataFrame.update") creating a copy when updating inplace ([GH 47188](https://github.com/pandas-dev/pandas/issues/47188)) +* Fixed regression in [`DataFrame.nsmallest()`](../reference/api/pandas.DataFrame.nsmallest.html#pandas.DataFrame.nsmallest "pandas.DataFrame.nsmallest") led to wrong results when the sorting column has `np.nan` values ([GH 46589](https://github.com/pandas-dev/pandas/issues/46589)) +* Fixed regression in [`read_fwf()`](../reference/api/pandas.read_fwf.html#pandas.read_fwf "pandas.read_fwf") raising `ValueError` when `widths` was specified with `usecols` ([GH 46580](https://github.com/pandas-dev/pandas/issues/46580)) +* Fixed regression in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") not sorting columns for mixed column names ([GH 47127](https://github.com/pandas-dev/pandas/issues/47127)) +* Fixed regression in `Groupby.transform()` and `Groupby.agg()` failing with `engine="numba"` when the index was a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 46867](https://github.com/pandas-dev/pandas/issues/46867)) +* Fixed regression in `NaN` comparison for [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") operations where the same object was compared ([GH 47105](https://github.com/pandas-dev/pandas/issues/47105)) +* Fixed regression is [`Styler.to_latex()`](../reference/api/pandas.io.formats.style.Styler.to_latex.html#pandas.io.formats.style.Styler.to_latex "pandas.io.formats.style.Styler.to_latex") and [`Styler.to_html()`](../reference/api/pandas.io.formats.style.Styler.to_html.html#pandas.io.formats.style.Styler.to_html "pandas.io.formats.style.Styler.to_html") where `buf` failed in combination with `encoding` ([GH 47053](https://github.com/pandas-dev/pandas/issues/47053)) +* Fixed regression in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") with `index_col=False` identifying first row as index names when `header=None` ([GH 46955](https://github.com/pandas-dev/pandas/issues/46955)) +* Fixed regression in [`DataFrameGroupBy.agg()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg") when used with list-likes or dict-likes and `axis=1` that would give incorrect results; now raises `NotImplementedError` ([GH 46995](https://github.com/pandas-dev/pandas/issues/46995)) +* Fixed regression in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") and [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") when used with list-likes or dict-likes and `axis=1` that would raise an unintuitive error message; now raises `NotImplementedError` ([GH 46904](https://github.com/pandas-dev/pandas/issues/46904)) +* Fixed regression in [`testing.assert_index_equal()`](../reference/api/pandas.testing.assert_index_equal.html#pandas.testing.assert_index_equal "pandas.testing.assert_index_equal") when `check_order=False` and [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") has extension or object dtype ([GH 47207](https://github.com/pandas-dev/pandas/issues/47207)) +* Fixed regression in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") returning ints as floats on certain input sheets ([GH 46988](https://github.com/pandas-dev/pandas/issues/46988)) +* Fixed regression in [`DataFrame.shift()`](../reference/api/pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift") when `axis` is `columns` and `fill_value` is absent, `freq` is ignored ([GH 47039](https://github.com/pandas-dev/pandas/issues/47039)) +* Fixed regression in [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") causing a segmentation violation when [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") is created with an `index` parameter of the type [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") ([GH 46683](https://github.com/pandas-dev/pandas/issues/46683)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in [`pandas.eval()`](../reference/api/pandas.eval.html#pandas.eval "pandas.eval"), [`DataFrame.eval()`](../reference/api/pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval") and [`DataFrame.query()`](../reference/api/pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") where passing empty `local_dict` or `global_dict` was treated as passing `None` ([GH 47084](https://github.com/pandas-dev/pandas/issues/47084)) +* Most I/O methods no longer suppress `OSError` and `ValueError` when closing file handles ([GH 47136](https://github.com/pandas-dev/pandas/issues/47136)) +* Improving error message raised by [`DataFrame.from_dict()`](../reference/api/pandas.DataFrame.from_dict.html#pandas.DataFrame.from_dict "pandas.DataFrame.from_dict") when passing an invalid `orient` parameter ([GH 47450](https://github.com/pandas-dev/pandas/issues/47450)) + +## Other[#](#other "Link to this heading") + +* The minimum version of Cython needed to compile pandas is now `0.29.30` ([GH 41935](https://github.com/pandas-dev/pandas/issues/41935)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 18 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Alex-Blade + +* Andrew Hawyrluk +* JHM Darbyshire +* Jeff Reback +* Joris Van den Bossche +* Marc Garcia +* Marco Edward Gorelli +* Matthew Roeschke +* MeeseeksMachine +* Pandas Development Team +* Patrick Hoefler +* Richard Shadrach +* Robert de Vries +* Simon Hawkins +* Thomas Li +* Tim Swast +* Wenjun Si +* Yuanhao Geng diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.4.4.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.4.4.md new file mode 100644 index 0000000000000000000000000000000000000000..8ede7295d921e6bc72291be5092e9908398963d6 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.4.4.md @@ -0,0 +1,61 @@ +# What's new in pandas 1.4.4 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.4.4.html + +# What’s new in 1.4.4 (August 31, 2022)[#](#what-s-new-in-1-4-4-august-31-2022 "Link to this heading") + +These are the changes in pandas 1.4.4. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") not working on a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 47649](https://github.com/pandas-dev/pandas/issues/47649)) +* Fixed regression in taking NULL `objects` from a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") causing a segmentation violation. These NULL values are created by `numpy.empty_like()` ([GH 46848](https://github.com/pandas-dev/pandas/issues/46848)) +* Fixed regression in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") materializing the [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") during sorting even if the [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") was already sorted ([GH 47501](https://github.com/pandas-dev/pandas/issues/47501)) +* Fixed regression in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") or [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") handling of all-NaN ExtensionArrays with custom attributes ([GH 47762](https://github.com/pandas-dev/pandas/issues/47762)) +* Fixed regression in calling bitwise numpy ufuncs (for example, `np.bitwise_and`) on Index objects ([GH 46769](https://github.com/pandas-dev/pandas/issues/46769)) +* Fixed regression in [`cut()`](../reference/api/pandas.cut.html#pandas.cut "pandas.cut") when using a `datetime64` IntervalIndex as bins ([GH 46218](https://github.com/pandas-dev/pandas/issues/46218)) +* Fixed regression in [`DataFrame.select_dtypes()`](../reference/api/pandas.DataFrame.select_dtypes.html#pandas.DataFrame.select_dtypes "pandas.DataFrame.select_dtypes") where `include="number"` included [`BooleanDtype`](../reference/api/pandas.BooleanDtype.html#pandas.BooleanDtype "pandas.BooleanDtype") ([GH 46870](https://github.com/pandas-dev/pandas/issues/46870)) +* Fixed regression in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") raising error when indexing with a `NamedTuple` ([GH 48124](https://github.com/pandas-dev/pandas/issues/48124)) +* Fixed regression in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") not updating the cache correctly after values were set ([GH 47867](https://github.com/pandas-dev/pandas/issues/47867)) +* Fixed regression in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") not aligning index in some cases when setting a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 47578](https://github.com/pandas-dev/pandas/issues/47578)) +* Fixed regression in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") setting a length-1 array like value to a single value in the DataFrame ([GH 46268](https://github.com/pandas-dev/pandas/issues/46268)) +* Fixed regression when slicing with [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") with [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with a [`DateOffset`](../reference/api/pandas.tseries.offsets.DateOffset.html#pandas.tseries.offsets.DateOffset "pandas.tseries.offsets.DateOffset") object for its `freq` ([GH 46671](https://github.com/pandas-dev/pandas/issues/46671)) +* Fixed regression in setting `None` or non-string value into a `string`-dtype Series using a mask ([GH 47628](https://github.com/pandas-dev/pandas/issues/47628)) +* Fixed regression in updating a DataFrame column through Series `__setitem__` (using chained assignment) not updating column values inplace and using too much memory ([GH 47172](https://github.com/pandas-dev/pandas/issues/47172)) +* Fixed regression in [`DataFrame.select_dtypes()`](../reference/api/pandas.DataFrame.select_dtypes.html#pandas.DataFrame.select_dtypes "pandas.DataFrame.select_dtypes") returning a view on the original DataFrame ([GH 48090](https://github.com/pandas-dev/pandas/issues/48090)) +* Fixed regression using custom Index subclasses (for example, used in xarray) with [`reset_index()`](../reference/api/pandas.DataFrame.reset_index.html#pandas.DataFrame.reset_index "pandas.DataFrame.reset_index") or [`Index.insert()`](../reference/api/pandas.Index.insert.html#pandas.Index.insert "pandas.Index.insert") ([GH 47071](https://github.com/pandas-dev/pandas/issues/47071)) +* Fixed regression in [`intersection()`](../reference/api/pandas.Index.intersection.html#pandas.Index.intersection "pandas.Index.intersection") when the [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") has dates crossing daylight savings time ([GH 46702](https://github.com/pandas-dev/pandas/issues/46702)) +* Fixed regression in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") throwing an error when passing a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with a multi-level name ([GH 47946](https://github.com/pandas-dev/pandas/issues/47946)) +* Fixed regression in [`DataFrame.eval()`](../reference/api/pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval") creating a copy when updating inplace ([GH 47449](https://github.com/pandas-dev/pandas/issues/47449)) +* Fixed regression where getting a row using [`DataFrame.iloc()`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") with [`SparseDtype`](../reference/api/pandas.SparseDtype.html#pandas.SparseDtype "pandas.SparseDtype") would raise ([GH 46406](https://github.com/pandas-dev/pandas/issues/46406)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* The `FutureWarning` raised when passing arguments (other than `filepath_or_buffer`) as positional in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") is now raised at the correct stacklevel ([GH 47385](https://github.com/pandas-dev/pandas/issues/47385)) +* Bug in [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") when `method` was a `callable` that did not return an `int` and would raise a `TypeError` ([GH 46891](https://github.com/pandas-dev/pandas/issues/46891)) +* Bug in [`DataFrameGroupBy.value_counts()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.value_counts.html#pandas.core.groupby.DataFrameGroupBy.value_counts "pandas.core.groupby.DataFrameGroupBy.value_counts") where `subset` had no effect ([GH 46383](https://github.com/pandas-dev/pandas/issues/46383)) +* Bug when getting values with [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") with a list of keys causing an internal inconsistency that could lead to a disconnect between `frame.at[x, y]` vs `frame[y].loc[x]` ([GH 22372](https://github.com/pandas-dev/pandas/issues/22372)) +* Bug in the [`Series.dt.strftime()`](../reference/api/pandas.Series.dt.strftime.html#pandas.Series.dt.strftime "pandas.Series.dt.strftime") accessor return a float instead of object dtype Series for all-NaT input, which also causes a spurious deprecation warning ([GH 45858](https://github.com/pandas-dev/pandas/issues/45858)) + +## Other[#](#other "Link to this heading") + +* The minimum version of Cython needed to compile pandas is now `0.29.32` ([GH 47978](https://github.com/pandas-dev/pandas/issues/47978)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 12 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Jeff Reback +* Joris Van den Bossche +* Marco Edward Gorelli +* Matthew Roeschke +* MeeseeksMachine +* Nima Sarang + +* Pandas Development Team +* Patrick Hoefler +* Simon Hawkins +* Tobias Pitters +* Xingrong Chen + +* jbrockmendel diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.5.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.5.0.md new file mode 100644 index 0000000000000000000000000000000000000000..a3438406e0a03aa38bf9d1e6e201f10d3948316a --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.5.0.md @@ -0,0 +1,1510 @@ +# What's new in pandas 1.5.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.5.0.html + +# What’s new in 1.5.0 (September 19, 2022)[#](#what-s-new-in-1-5-0-september-19-2022 "Link to this heading") + +These are the changes in pandas 1.5.0. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Enhancements[#](#enhancements "Link to this heading") + +### `pandas-stubs`[#](#pandas-stubs "Link to this heading") + +The `pandas-stubs` library is now supported by the pandas development team, providing type stubs for the pandas API. Please visit +[pandas-dev/pandas-stubs](https://github.com/pandas-dev/pandas-stubs) for more information. + +We thank VirtusLab and Microsoft for their initial, significant contributions to `pandas-stubs` + +### Native PyArrow-backed ExtensionArray[#](#native-pyarrow-backed-extensionarray "Link to this heading") + +With [Pyarrow](https://arrow.apache.org/docs/python/index.html) installed, users can now create pandas objects +that are backed by a `pyarrow.ChunkedArray` and `pyarrow.DataType`. + +The `dtype` argument can accept a string of a [pyarrow data type](https://arrow.apache.org/docs/python/api/datatypes.html) +with `pyarrow` in brackets e.g. `"int64[pyarrow]"` or, for pyarrow data types that take parameters, a [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") +initialized with a `pyarrow.DataType`. + +```None +In [1]: import pyarrow as pa + +In [2]: ser_float = pd.Series([1.0, 2.0, None], dtype="float32[pyarrow]") + +In [3]: ser_float +Out[3]: +0 1.0 +1 2.0 +2 +dtype: float[pyarrow] + +In [4]: list_of_int_type = pd.ArrowDtype(pa.list_(pa.int64())) + +In [5]: ser_list = pd.Series([[1, 2], [3, None]], dtype=list_of_int_type) + +In [6]: ser_list +Out[6]: +0 [1. 2.] +1 [ 3. nan] +dtype: list[pyarrow] + +In [7]: ser_list.take([1, 0]) +Out[7]: +1 [ 3. nan] +0 [1. 2.] +dtype: list[pyarrow] + +In [8]: ser_float * 5 +Out[8]: +0 5.0 +1 10.0 +2 +dtype: float[pyarrow] + +In [9]: ser_float.mean() +Out[9]: 1.5 + +In [10]: ser_float.dropna() +Out[10]: +0 1.0 +1 2.0 +dtype: float[pyarrow] +``` + +Most operations are supported and have been implemented using [pyarrow compute](https://arrow.apache.org/docs/python/api/compute.html) functions. +We recommend installing the latest version of PyArrow to access the most recently implemented compute functions. + +Warning + +This feature is experimental, and the API can change in a future release without warning. + +### DataFrame interchange protocol implementation[#](#dataframe-interchange-protocol-implementation "Link to this heading") + +Pandas now implement the DataFrame interchange API spec. +See the full details on the API at + +The protocol consists of two parts: + +* New method [`DataFrame.__dataframe__()`](../reference/api/pandas.DataFrame.__dataframe__.html#pandas.DataFrame.__dataframe__ "pandas.DataFrame.__dataframe__") which produces the interchange object. + It effectively “exports” the pandas dataframe as an interchange object so + any other library which has the protocol implemented can “import” that dataframe + without knowing anything about the producer except that it makes an interchange object. +* New function [`pandas.api.interchange.from_dataframe()`](../reference/api/pandas.api.interchange.from_dataframe.html#pandas.api.interchange.from_dataframe "pandas.api.interchange.from_dataframe") which can take + an arbitrary interchange object from any conformant library and construct a + pandas DataFrame out of it. + +### Styler[#](#styler "Link to this heading") + +The most notable development is the new method [`Styler.concat()`](../reference/api/pandas.io.formats.style.Styler.concat.html#pandas.io.formats.style.Styler.concat "pandas.io.formats.style.Styler.concat") which +allows adding customised footer rows to visualise additional calculations on the data, +e.g. totals and counts etc. ([GH 43875](https://github.com/pandas-dev/pandas/issues/43875), [GH 46186](https://github.com/pandas-dev/pandas/issues/46186)) + +Additionally there is an alternative output method [`Styler.to_string()`](../reference/api/pandas.io.formats.style.Styler.to_string.html#pandas.io.formats.style.Styler.to_string "pandas.io.formats.style.Styler.to_string"), +which allows using the Styler’s formatting methods to create, for example, CSVs ([GH 44502](https://github.com/pandas-dev/pandas/issues/44502)). + +A new feature [`Styler.relabel_index()`](../reference/api/pandas.io.formats.style.Styler.relabel_index.html#pandas.io.formats.style.Styler.relabel_index "pandas.io.formats.style.Styler.relabel_index") is also made available to provide full customisation of the display of +index or column headers ([GH 47864](https://github.com/pandas-dev/pandas/issues/47864)) + +Minor feature improvements are: + +> * Adding the ability to render `border` and `border-{side}` CSS properties in Excel ([GH 42276](https://github.com/pandas-dev/pandas/issues/42276)) +> * Making keyword arguments consist: [`Styler.highlight_null()`](../reference/api/pandas.io.formats.style.Styler.highlight_null.html#pandas.io.formats.style.Styler.highlight_null "pandas.io.formats.style.Styler.highlight_null") now accepts `color` and deprecates `null_color` although this remains backwards compatible ([GH 45907](https://github.com/pandas-dev/pandas/issues/45907)) + +### Control of index with `group_keys` in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample")[#](#control-of-index-with-group-keys-in-dataframe-resample "Link to this heading") + +The argument `group_keys` has been added to the method [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample"). +As with [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby"), this argument controls the whether each group is added +to the index in the resample when [`Resampler.apply()`](../reference/api/pandas.core.resample.Resampler.apply.html#pandas.core.resample.Resampler.apply "pandas.core.resample.Resampler.apply") is used. + +Warning + +Not specifying the `group_keys` argument will retain the +previous behavior and emit a warning if the result will change +by specifying `group_keys=False`. In a future version +of pandas, not specifying `group_keys` will default to +the same behavior as `group_keys=False`. + +```None +In [11]: df = pd.DataFrame( + ....: {'a': range(6)}, + ....: index=pd.date_range("2021-01-01", periods=6, freq="8H") + ....: ) + ....: + +In [12]: df.resample("D", group_keys=True).apply(lambda x: x) +Out[12]: + a +2021-01-01 2021-01-01 00:00:00 0 + 2021-01-01 08:00:00 1 + 2021-01-01 16:00:00 2 +2021-01-02 2021-01-02 00:00:00 3 + 2021-01-02 08:00:00 4 + 2021-01-02 16:00:00 5 + +In [13]: df.resample("D", group_keys=False).apply(lambda x: x) +Out[13]: + a +2021-01-01 00:00:00 0 +2021-01-01 08:00:00 1 +2021-01-01 16:00:00 2 +2021-01-02 00:00:00 3 +2021-01-02 08:00:00 4 +2021-01-02 16:00:00 5 +``` + +Previously, the resulting index would depend upon the values returned by `apply`, +as seen in the following example. + +```None +In [1]: # pandas 1.3 +In [2]: df.resample("D").apply(lambda x: x) +Out[2]: + a +2021-01-01 00:00:00 0 +2021-01-01 08:00:00 1 +2021-01-01 16:00:00 2 +2021-01-02 00:00:00 3 +2021-01-02 08:00:00 4 +2021-01-02 16:00:00 5 + +In [3]: df.resample("D").apply(lambda x: x.reset_index()) +Out[3]: + index a +2021-01-01 0 2021-01-01 00:00:00 0 + 1 2021-01-01 08:00:00 1 + 2 2021-01-01 16:00:00 2 +2021-01-02 0 2021-01-02 00:00:00 3 + 1 2021-01-02 08:00:00 4 + 2 2021-01-02 16:00:00 5 +``` + +### from\_dummies[#](#from-dummies "Link to this heading") + +Added new function [`from_dummies()`](../reference/api/pandas.from_dummies.html#pandas.from_dummies "pandas.from_dummies") to convert a dummy coded [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") into a categorical [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame"). + +```None +In [11]: import pandas as pd + +In [12]: df = pd.DataFrame({"col1_a": [1, 0, 1], "col1_b": [0, 1, 0], + ....: "col2_a": [0, 1, 0], "col2_b": [1, 0, 0], + ....: "col2_c": [0, 0, 1]}) + ....: + +In [13]: pd.from_dummies(df, sep="_") +Out[13]: + col1 col2 +0 a b +1 b a +2 a c +``` + +### Writing to ORC files[#](#writing-to-orc-files "Link to this heading") + +The new method [`DataFrame.to_orc()`](../reference/api/pandas.DataFrame.to_orc.html#pandas.DataFrame.to_orc "pandas.DataFrame.to_orc") allows writing to ORC files ([GH 43864](https://github.com/pandas-dev/pandas/issues/43864)). + +This functionality depends the [pyarrow](http://arrow.apache.org/docs/python/) library. For more details, see [the IO docs on ORC](../user_guide/io.html#io-orc). + +Warning + +* It is *highly recommended* to install pyarrow using conda due to some issues occurred by pyarrow. +* [`to_orc()`](../reference/api/pandas.DataFrame.to_orc.html#pandas.DataFrame.to_orc "pandas.DataFrame.to_orc") requires pyarrow>=7.0.0. +* [`to_orc()`](../reference/api/pandas.DataFrame.to_orc.html#pandas.DataFrame.to_orc "pandas.DataFrame.to_orc") is not supported on Windows yet, you can find valid environments on [install optional dependencies](../getting_started/install.html#install-warn-orc). +* For supported dtypes please refer to [supported ORC features in Arrow](https://arrow.apache.org/docs/cpp/orc.html#data-types). +* Currently timezones in datetime columns are not preserved when a dataframe is converted into ORC files. + +```None +df = pd.DataFrame(data={"col1": [1, 2], "col2": [3, 4]}) +df.to_orc("./out.orc") +``` + +### Reading directly from TAR archives[#](#reading-directly-from-tar-archives "Link to this heading") + +I/O methods like [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") or [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") now allow reading and writing +directly on TAR archives ([GH 44787](https://github.com/pandas-dev/pandas/issues/44787)). + +```None +df = pd.read_csv("./movement.tar.gz") +# ... +df.to_csv("./out.tar.gz") +``` + +This supports `.tar`, `.tar.gz`, `.tar.bz` and `.tar.xz2` archives. +The used compression method is inferred from the filename. +If the compression method cannot be inferred, use the `compression` argument: + +```None +df = pd.read_csv(some_file_obj, compression={"method": "tar", "mode": "r:gz"}) # noqa F821 +``` + +(`mode` being one of `tarfile.open`’s modes: ) + +### read\_xml now supports `dtype`, `converters`, and `parse_dates`[#](#read-xml-now-supports-dtype-converters-and-parse-dates "Link to this heading") + +Similar to other IO methods, [`pandas.read_xml()`](../reference/api/pandas.read_xml.html#pandas.read_xml "pandas.read_xml") now supports assigning specific dtypes to columns, +apply converter methods, and parse dates ([GH 43567](https://github.com/pandas-dev/pandas/issues/43567)). + +```None +In [14]: from io import StringIO + +In [15]: xml_dates = """ + ....: + ....: + ....: square + ....: 00360 + ....: 4.0 + ....: 2020-01-01 + ....: + ....: + ....: circle + ....: 00360 + ....: + ....: 2021-01-01 + ....: + ....: + ....: triangle + ....: 00180 + ....: 3.0 + ....: 2022-01-01 + ....: + ....: """ + ....: + +In [16]: df = pd.read_xml( + ....: StringIO(xml_dates), + ....: dtype={'sides': 'Int64'}, + ....: converters={'degrees': str}, + ....: parse_dates=['date'] + ....: ) + ....: + +In [17]: df +Out[17]: + shape degrees sides date +0 square 00360 4 2020-01-01 +1 circle 00360 2021-01-01 +2 triangle 00180 3 2022-01-01 + +In [18]: df.dtypes +Out[18]: +shape object +degrees object +sides Int64 +date datetime64[ns] +dtype: object +``` + +### read\_xml now supports large XML using `iterparse`[#](#read-xml-now-supports-large-xml-using-iterparse "Link to this heading") + +For very large XML files that can range in hundreds of megabytes to gigabytes, [`pandas.read_xml()`](../reference/api/pandas.read_xml.html#pandas.read_xml "pandas.read_xml") +now supports parsing such sizeable files using [lxml’s iterparse](https://lxml.de/3.2/parsing.html#iterparse-and-iterwalk) and [etree’s iterparse](https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.iterparse) +which are memory-efficient methods to iterate through XML trees and extract specific elements +and attributes without holding entire tree in memory ([GH 45442](https://github.com/pandas-dev/pandas/issues/45442)). + +```None +In [1]: df = pd.read_xml( +... "/path/to/downloaded/enwikisource-latest-pages-articles.xml", +... iterparse = {"page": ["title", "ns", "id"]}) +... ) +df +Out[2]: + title ns id +0 Gettysburg Address 0 21450 +1 Main Page 0 42950 +2 Declaration by United Nations 0 8435 +3 Constitution of the United States of America 0 8435 +4 Declaration of Independence (Israel) 0 17858 +... ... ... ... +3578760 Page:Black cat 1897 07 v2 n10.pdf/17 104 219649 +3578761 Page:Black cat 1897 07 v2 n10.pdf/43 104 219649 +3578762 Page:Black cat 1897 07 v2 n10.pdf/44 104 219649 +3578763 The History of Tom Jones, a Foundling/Book IX 0 12084291 +3578764 Page:Shakespeare of Stratford (1926) Yale.djvu/91 104 21450 + +[3578765 rows x 3 columns] +``` + +### Copy on Write[#](#copy-on-write "Link to this heading") + +A new feature `copy_on_write` was added ([GH 46958](https://github.com/pandas-dev/pandas/issues/46958)). Copy on write ensures that +any DataFrame or Series derived from another in any way always behaves as a copy. +Copy on write disallows updating any other object than the object the method +was applied to. + +Copy on write can be enabled through: + +```None +pd.set_option("mode.copy_on_write", True) +pd.options.mode.copy_on_write = True +``` + +Alternatively, copy on write can be enabled locally through: + +```None +with pd.option_context("mode.copy_on_write", True): + ... +``` + +Without copy on write, the parent [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") is updated when updating a child +[`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") that was derived from this [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame"). + +```None +In [19]: df = pd.DataFrame({"foo": [1, 2, 3], "bar": 1}) + +In [20]: view = df["foo"] + +In [21]: view.iloc[0] +Out[21]: 1 + +In [22]: df +Out[22]: + foo bar +0 1 1 +1 2 1 +2 3 1 +``` + +With copy on write enabled, df won’t be updated anymore: + +```None +In [23]: with pd.option_context("mode.copy_on_write", True): + ....: df = pd.DataFrame({"foo": [1, 2, 3], "bar": 1}) + ....: view = df["foo"] + ....: view.iloc[0] + ....: df + ....: +``` + +A more detailed explanation can be found [here](https://phofl.github.io/cow-introduction.html). + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* [`Series.map()`](../reference/api/pandas.Series.map.html#pandas.Series.map "pandas.Series.map") now raises when `arg` is dict but `na_action` is not either `None` or `'ignore'` ([GH 46588](https://github.com/pandas-dev/pandas/issues/46588)) +* [`MultiIndex.to_frame()`](../reference/api/pandas.MultiIndex.to_frame.html#pandas.MultiIndex.to_frame "pandas.MultiIndex.to_frame") now supports the argument `allow_duplicates` and raises on duplicate labels if it is missing or False ([GH 45245](https://github.com/pandas-dev/pandas/issues/45245)) +* [`StringArray`](../reference/api/pandas.arrays.StringArray.html#pandas.arrays.StringArray "pandas.arrays.StringArray") now accepts array-likes containing nan-likes (`None`, `np.nan`) for the `values` parameter in its constructor in addition to strings and [`pandas.NA`](../reference/api/pandas.NA.html#pandas.NA "pandas.NA"). ([GH 40839](https://github.com/pandas-dev/pandas/issues/40839)) +* Improved the rendering of `categories` in [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") ([GH 45218](https://github.com/pandas-dev/pandas/issues/45218)) +* [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") will now allow the `subplots` parameter to be a list of iterables specifying column groups, so that columns may be grouped together in the same subplot ([GH 29688](https://github.com/pandas-dev/pandas/issues/29688)). +* [`to_numeric()`](../reference/api/pandas.to_numeric.html#pandas.to_numeric "pandas.to_numeric") now preserves float64 arrays when downcasting would generate values not representable in float32 ([GH 43693](https://github.com/pandas-dev/pandas/issues/43693)) +* [`Series.reset_index()`](../reference/api/pandas.Series.reset_index.html#pandas.Series.reset_index "pandas.Series.reset_index") and [`DataFrame.reset_index()`](../reference/api/pandas.DataFrame.reset_index.html#pandas.DataFrame.reset_index "pandas.DataFrame.reset_index") now support the argument `allow_duplicates` ([GH 44410](https://github.com/pandas-dev/pandas/issues/44410)) +* [`DataFrameGroupBy.min()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.min.html#pandas.core.groupby.DataFrameGroupBy.min "pandas.core.groupby.DataFrameGroupBy.min"), [`SeriesGroupBy.min()`](../reference/api/pandas.core.groupby.SeriesGroupBy.min.html#pandas.core.groupby.SeriesGroupBy.min "pandas.core.groupby.SeriesGroupBy.min"), [`DataFrameGroupBy.max()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.max.html#pandas.core.groupby.DataFrameGroupBy.max "pandas.core.groupby.DataFrameGroupBy.max"), and [`SeriesGroupBy.max()`](../reference/api/pandas.core.groupby.SeriesGroupBy.max.html#pandas.core.groupby.SeriesGroupBy.max "pandas.core.groupby.SeriesGroupBy.max") now supports [Numba](https://numba.pydata.org/) execution with the `engine` keyword ([GH 45428](https://github.com/pandas-dev/pandas/issues/45428)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") now supports `defaultdict` as a `dtype` parameter ([GH 41574](https://github.com/pandas-dev/pandas/issues/41574)) +* [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") and [`Series.rolling()`](../reference/api/pandas.Series.rolling.html#pandas.Series.rolling "pandas.Series.rolling") now support a `step` parameter with fixed-length windows ([GH 15354](https://github.com/pandas-dev/pandas/issues/15354)) +* Implemented a `bool`-dtype [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), passing a bool-dtype array-like to `pd.Index` will now retain `bool` dtype instead of casting to `object` ([GH 45061](https://github.com/pandas-dev/pandas/issues/45061)) +* Implemented a complex-dtype [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), passing a complex-dtype array-like to `pd.Index` will now retain complex dtype instead of casting to `object` ([GH 45845](https://github.com/pandas-dev/pandas/issues/45845)) +* [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with `IntegerDtype` now supports bitwise operations ([GH 34463](https://github.com/pandas-dev/pandas/issues/34463)) +* Add `milliseconds` field support for [`DateOffset`](../reference/api/pandas.tseries.offsets.DateOffset.html#pandas.tseries.offsets.DateOffset "pandas.tseries.offsets.DateOffset") ([GH 43371](https://github.com/pandas-dev/pandas/issues/43371)) +* [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where") tries to maintain dtype of [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") if fill value can be cast without loss of precision ([GH 45582](https://github.com/pandas-dev/pandas/issues/45582)) +* [`DataFrame.reset_index()`](../reference/api/pandas.DataFrame.reset_index.html#pandas.DataFrame.reset_index "pandas.DataFrame.reset_index") now accepts a `names` argument which renames the index names ([GH 6878](https://github.com/pandas-dev/pandas/issues/6878)) +* [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") now raises when `levels` is given but `keys` is None ([GH 46653](https://github.com/pandas-dev/pandas/issues/46653)) +* [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") now raises when `levels` contains duplicate values ([GH 46653](https://github.com/pandas-dev/pandas/issues/46653)) +* Added `numeric_only` argument to [`DataFrame.corr()`](../reference/api/pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr"), [`DataFrame.corrwith()`](../reference/api/pandas.DataFrame.corrwith.html#pandas.DataFrame.corrwith "pandas.DataFrame.corrwith"), [`DataFrame.cov()`](../reference/api/pandas.DataFrame.cov.html#pandas.DataFrame.cov "pandas.DataFrame.cov"), [`DataFrame.idxmin()`](../reference/api/pandas.DataFrame.idxmin.html#pandas.DataFrame.idxmin "pandas.DataFrame.idxmin"), [`DataFrame.idxmax()`](../reference/api/pandas.DataFrame.idxmax.html#pandas.DataFrame.idxmax "pandas.DataFrame.idxmax"), [`DataFrameGroupBy.idxmin()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.idxmin.html#pandas.core.groupby.DataFrameGroupBy.idxmin "pandas.core.groupby.DataFrameGroupBy.idxmin"), [`DataFrameGroupBy.idxmax()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.idxmax.html#pandas.core.groupby.DataFrameGroupBy.idxmax "pandas.core.groupby.DataFrameGroupBy.idxmax"), [`DataFrameGroupBy.var()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.var.html#pandas.core.groupby.DataFrameGroupBy.var "pandas.core.groupby.DataFrameGroupBy.var"), [`SeriesGroupBy.var()`](../reference/api/pandas.core.groupby.SeriesGroupBy.var.html#pandas.core.groupby.SeriesGroupBy.var "pandas.core.groupby.SeriesGroupBy.var"), [`DataFrameGroupBy.std()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.std.html#pandas.core.groupby.DataFrameGroupBy.std "pandas.core.groupby.DataFrameGroupBy.std"), [`SeriesGroupBy.std()`](../reference/api/pandas.core.groupby.SeriesGroupBy.std.html#pandas.core.groupby.SeriesGroupBy.std "pandas.core.groupby.SeriesGroupBy.std"), [`DataFrameGroupBy.sem()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.sem.html#pandas.core.groupby.DataFrameGroupBy.sem "pandas.core.groupby.DataFrameGroupBy.sem"), [`SeriesGroupBy.sem()`](../reference/api/pandas.core.groupby.SeriesGroupBy.sem.html#pandas.core.groupby.SeriesGroupBy.sem "pandas.core.groupby.SeriesGroupBy.sem"), and [`DataFrameGroupBy.quantile()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.quantile.html#pandas.core.groupby.DataFrameGroupBy.quantile "pandas.core.groupby.DataFrameGroupBy.quantile") ([GH 46560](https://github.com/pandas-dev/pandas/issues/46560)) +* A [`errors.PerformanceWarning`](../reference/api/pandas.errors.PerformanceWarning.html#pandas.errors.PerformanceWarning "pandas.errors.PerformanceWarning") is now thrown when using `string[pyarrow]` dtype with methods that don’t dispatch to `pyarrow.compute` methods ([GH 42613](https://github.com/pandas-dev/pandas/issues/42613), [GH 46725](https://github.com/pandas-dev/pandas/issues/46725)) +* Added `validate` argument to [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") ([GH 46622](https://github.com/pandas-dev/pandas/issues/46622)) +* Added `numeric_only` argument to [`Resampler.sum()`](../reference/api/pandas.core.resample.Resampler.sum.html#pandas.core.resample.Resampler.sum "pandas.core.resample.Resampler.sum"), [`Resampler.prod()`](../reference/api/pandas.core.resample.Resampler.prod.html#pandas.core.resample.Resampler.prod "pandas.core.resample.Resampler.prod"), [`Resampler.min()`](../reference/api/pandas.core.resample.Resampler.min.html#pandas.core.resample.Resampler.min "pandas.core.resample.Resampler.min"), [`Resampler.max()`](../reference/api/pandas.core.resample.Resampler.max.html#pandas.core.resample.Resampler.max "pandas.core.resample.Resampler.max"), [`Resampler.first()`](../reference/api/pandas.core.resample.Resampler.first.html#pandas.core.resample.Resampler.first "pandas.core.resample.Resampler.first"), and [`Resampler.last()`](../reference/api/pandas.core.resample.Resampler.last.html#pandas.core.resample.Resampler.last "pandas.core.resample.Resampler.last") ([GH 46442](https://github.com/pandas-dev/pandas/issues/46442)) +* `times` argument in `ExponentialMovingWindow` now accepts `np.timedelta64` ([GH 47003](https://github.com/pandas-dev/pandas/issues/47003)) +* [`DataError`](../reference/api/pandas.errors.DataError.html#pandas.errors.DataError "pandas.errors.DataError"), [`SpecificationError`](../reference/api/pandas.errors.SpecificationError.html#pandas.errors.SpecificationError "pandas.errors.SpecificationError"), [`SettingWithCopyError`](../reference/api/pandas.errors.SettingWithCopyError.html#pandas.errors.SettingWithCopyError "pandas.errors.SettingWithCopyError"), [`SettingWithCopyWarning`](../reference/api/pandas.errors.SettingWithCopyWarning.html#pandas.errors.SettingWithCopyWarning "pandas.errors.SettingWithCopyWarning"), [`NumExprClobberingError`](../reference/api/pandas.errors.NumExprClobberingError.html#pandas.errors.NumExprClobberingError "pandas.errors.NumExprClobberingError"), [`UndefinedVariableError`](../reference/api/pandas.errors.UndefinedVariableError.html#pandas.errors.UndefinedVariableError "pandas.errors.UndefinedVariableError"), [`IndexingError`](../reference/api/pandas.errors.IndexingError.html#pandas.errors.IndexingError "pandas.errors.IndexingError"), [`PyperclipException`](../reference/api/pandas.errors.PyperclipException.html#pandas.errors.PyperclipException "pandas.errors.PyperclipException"), [`PyperclipWindowsException`](../reference/api/pandas.errors.PyperclipWindowsException.html#pandas.errors.PyperclipWindowsException "pandas.errors.PyperclipWindowsException"), [`CSSWarning`](../reference/api/pandas.errors.CSSWarning.html#pandas.errors.CSSWarning "pandas.errors.CSSWarning"), [`PossibleDataLossError`](../reference/api/pandas.errors.PossibleDataLossError.html#pandas.errors.PossibleDataLossError "pandas.errors.PossibleDataLossError"), [`ClosedFileError`](../reference/api/pandas.errors.ClosedFileError.html#pandas.errors.ClosedFileError "pandas.errors.ClosedFileError"), [`IncompatibilityWarning`](../reference/api/pandas.errors.IncompatibilityWarning.html#pandas.errors.IncompatibilityWarning "pandas.errors.IncompatibilityWarning"), [`AttributeConflictWarning`](../reference/api/pandas.errors.AttributeConflictWarning.html#pandas.errors.AttributeConflictWarning "pandas.errors.AttributeConflictWarning"), [`DatabaseError`](../reference/api/pandas.errors.DatabaseError.html#pandas.errors.DatabaseError "pandas.errors.DatabaseError"), [`PossiblePrecisionLoss`](../reference/api/pandas.errors.PossiblePrecisionLoss.html#pandas.errors.PossiblePrecisionLoss "pandas.errors.PossiblePrecisionLoss"), [`ValueLabelTypeMismatch`](../reference/api/pandas.errors.ValueLabelTypeMismatch.html#pandas.errors.ValueLabelTypeMismatch "pandas.errors.ValueLabelTypeMismatch"), [`InvalidColumnName`](../reference/api/pandas.errors.InvalidColumnName.html#pandas.errors.InvalidColumnName "pandas.errors.InvalidColumnName"), and [`CategoricalConversionWarning`](../reference/api/pandas.errors.CategoricalConversionWarning.html#pandas.errors.CategoricalConversionWarning "pandas.errors.CategoricalConversionWarning") are now exposed in `pandas.errors` ([GH 27656](https://github.com/pandas-dev/pandas/issues/27656)) +* Added `check_like` argument to [`testing.assert_series_equal()`](../reference/api/pandas.testing.assert_series_equal.html#pandas.testing.assert_series_equal "pandas.testing.assert_series_equal") ([GH 47247](https://github.com/pandas-dev/pandas/issues/47247)) +* Add support for [`DataFrameGroupBy.ohlc()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.ohlc.html#pandas.core.groupby.DataFrameGroupBy.ohlc "pandas.core.groupby.DataFrameGroupBy.ohlc") and [`SeriesGroupBy.ohlc()`](../reference/api/pandas.core.groupby.SeriesGroupBy.ohlc.html#pandas.core.groupby.SeriesGroupBy.ohlc "pandas.core.groupby.SeriesGroupBy.ohlc") for extension array dtypes ([GH 37493](https://github.com/pandas-dev/pandas/issues/37493)) +* Allow reading compressed SAS files with [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") (e.g., `.sas7bdat.gz` files) +* [`pandas.read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") now supports extracting links from table cells ([GH 13141](https://github.com/pandas-dev/pandas/issues/13141)) +* `DatetimeIndex.astype()` now supports casting timezone-naive indexes to `datetime64[s]`, `datetime64[ms]`, and `datetime64[us]`, and timezone-aware indexes to the corresponding `datetime64[unit, tzname]` dtypes ([GH 47579](https://github.com/pandas-dev/pandas/issues/47579)) +* [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") reducers (e.g. `min`, `max`, `sum`, `mean`) will now successfully operate when the dtype is numeric and `numeric_only=True` is provided; previously this would raise a `NotImplementedError` ([GH 47500](https://github.com/pandas-dev/pandas/issues/47500)) +* `RangeIndex.union()` now can return a [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") instead of a `Int64Index` if the resulting values are equally spaced ([GH 47557](https://github.com/pandas-dev/pandas/issues/47557), [GH 43885](https://github.com/pandas-dev/pandas/issues/43885)) +* [`DataFrame.compare()`](../reference/api/pandas.DataFrame.compare.html#pandas.DataFrame.compare "pandas.DataFrame.compare") now accepts an argument `result_names` to allow the user to specify the result’s names of both left and right DataFrame which are being compared. This is by default `'self'` and `'other'` ([GH 44354](https://github.com/pandas-dev/pandas/issues/44354)) +* [`DataFrame.quantile()`](../reference/api/pandas.DataFrame.quantile.html#pandas.DataFrame.quantile "pandas.DataFrame.quantile") gained a `method` argument that can accept `table` to evaluate multi-column quantiles ([GH 43881](https://github.com/pandas-dev/pandas/issues/43881)) +* [`Interval`](../reference/api/pandas.Interval.html#pandas.Interval "pandas.Interval") now supports checking whether one interval is contained by another interval ([GH 46613](https://github.com/pandas-dev/pandas/issues/46613)) +* Added `copy` keyword to [`Series.set_axis()`](../reference/api/pandas.Series.set_axis.html#pandas.Series.set_axis "pandas.Series.set_axis") and [`DataFrame.set_axis()`](../reference/api/pandas.DataFrame.set_axis.html#pandas.DataFrame.set_axis "pandas.DataFrame.set_axis") to allow user to set axis on a new object without necessarily copying the underlying data ([GH 47932](https://github.com/pandas-dev/pandas/issues/47932)) +* The method [`ExtensionArray.factorize()`](../reference/api/pandas.api.extensions.ExtensionArray.factorize.html#pandas.api.extensions.ExtensionArray.factorize "pandas.api.extensions.ExtensionArray.factorize") accepts `use_na_sentinel=False` for determining how null values are to be treated ([GH 46601](https://github.com/pandas-dev/pandas/issues/46601)) +* The `Dockerfile` now installs a dedicated `pandas-dev` virtual environment for pandas development instead of using the `base` environment ([GH 48427](https://github.com/pandas-dev/pandas/issues/48427)) + +## Notable bug fixes[#](#notable-bug-fixes "Link to this heading") + +These are bug fixes that might have notable behavior changes. + +### Using `dropna=True` with `groupby` transforms[#](#using-dropna-true-with-groupby-transforms "Link to this heading") + +A transform is an operation whose result has the same size as its input. When the +result is a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") or [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), it is also required that the +index of the result matches that of the input. In pandas 1.4, using +[`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") or [`SeriesGroupBy.transform()`](../reference/api/pandas.core.groupby.SeriesGroupBy.transform.html#pandas.core.groupby.SeriesGroupBy.transform "pandas.core.groupby.SeriesGroupBy.transform") with null +values in the groups and `dropna=True` gave incorrect results. Demonstrated by the +examples below, the incorrect results either contained incorrect values, or the result +did not have the same index as the input. + +```None +In [24]: df = pd.DataFrame({'a': [1, 1, np.nan], 'b': [2, 3, 4]}) +``` + +*Old behavior*: + +```None +In [3]: # Value in the last row should be np.nan + df.groupby('a', dropna=True).transform('sum') +Out[3]: + b +0 5 +1 5 +2 5 + +In [3]: # Should have one additional row with the value np.nan + df.groupby('a', dropna=True).transform(lambda x: x.sum()) +Out[3]: + b +0 5 +1 5 + +In [3]: # The value in the last row is np.nan interpreted as an integer + df.groupby('a', dropna=True).transform('ffill') +Out[3]: + b +0 2 +1 3 +2 -9223372036854775808 + +In [3]: # Should have one additional row with the value np.nan + df.groupby('a', dropna=True).transform(lambda x: x) +Out[3]: + b +0 2 +1 3 +``` + +*New behavior*: + +```None +In [25]: df.groupby('a', dropna=True).transform('sum') +Out[25]: + b +0 5.0 +1 5.0 +2 NaN + +In [26]: df.groupby('a', dropna=True).transform(lambda x: x.sum()) +Out[26]: + b +0 5.0 +1 5.0 +2 NaN + +In [27]: df.groupby('a', dropna=True).transform('ffill') +Out[27]: + b +0 2.0 +1 3.0 +2 NaN + +In [28]: df.groupby('a', dropna=True).transform(lambda x: x) +Out[28]: + b +0 2.0 +1 3.0 +2 NaN +``` + +### Serializing tz-naive Timestamps with to\_json() with `iso_dates=True`[#](#serializing-tz-naive-timestamps-with-to-json-with-iso-dates-true "Link to this heading") + +[`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json"), [`Series.to_json()`](../reference/api/pandas.Series.to_json.html#pandas.Series.to_json "pandas.Series.to_json"), and `Index.to_json()` +would incorrectly localize DatetimeArrays/DatetimeIndexes with tz-naive Timestamps +to UTC. ([GH 38760](https://github.com/pandas-dev/pandas/issues/38760)) + +Note that this patch does not fix the localization of tz-aware Timestamps to UTC +upon serialization. (Related issue [GH 12997](https://github.com/pandas-dev/pandas/issues/12997)) + +*Old Behavior* + +```None +In [32]: index = pd.date_range( + ....: start='2020-12-28 00:00:00', + ....: end='2020-12-28 02:00:00', + ....: freq='1H', + ....: ) + ....: + +In [33]: a = pd.Series( + ....: data=range(3), + ....: index=index, + ....: ) + ....: + +In [4]: from io import StringIO + +In [5]: a.to_json(date_format='iso') +Out[5]: '{"2020-12-28T00:00:00.000Z":0,"2020-12-28T01:00:00.000Z":1,"2020-12-28T02:00:00.000Z":2}' + +In [6]: pd.read_json(StringIO(a.to_json(date_format='iso')), typ="series").index == a.index +Out[6]: array([False, False, False]) +``` + +*New Behavior* + +```None +In [34]: from io import StringIO + +In [35]: a.to_json(date_format='iso') +Out[35]: '{"2020-12-28T00:00:00.000Z":0,"2020-12-28T01:00:00.000Z":1,"2020-12-28T02:00:00.000Z":2}' + +# Roundtripping now works +In [36]: pd.read_json(StringIO(a.to_json(date_format='iso')), typ="series").index == a.index +Out[36]: array([ True, True, True]) +``` + +### DataFrameGroupBy.value\_counts with non-grouping categorical columns and `observed=True`[#](#dataframegroupby-value-counts-with-non-grouping-categorical-columns-and-observed-true "Link to this heading") + +Calling [`DataFrameGroupBy.value_counts()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.value_counts.html#pandas.core.groupby.DataFrameGroupBy.value_counts "pandas.core.groupby.DataFrameGroupBy.value_counts") with `observed=True` would incorrectly drop non-observed categories of non-grouping columns ([GH 46357](https://github.com/pandas-dev/pandas/issues/46357)). + +```None +In [6]: df = pd.DataFrame(["a", "b", "c"], dtype="category").iloc[0:2] +In [7]: df +Out[7]: + 0 +0 a +1 b +``` + +*Old Behavior* + +```None +In [8]: df.groupby(level=0, observed=True).value_counts() +Out[8]: +0 a 1 +1 b 1 +dtype: int64 +``` + +*New Behavior* + +```None +In [9]: df.groupby(level=0, observed=True).value_counts() +Out[9]: +0 a 1 +1 a 0 + b 1 +0 b 0 + c 0 +1 c 0 +dtype: int64 +``` + +## Backwards incompatible API changes[#](#backwards-incompatible-api-changes "Link to this heading") + +### Increased minimum versions for dependencies[#](#increased-minimum-versions-for-dependencies "Link to this heading") + +Some minimum supported versions of dependencies were updated. +If installed, we now require: + +| Package | Minimum Version | Required | Changed | +| --- | --- | --- | --- | +| numpy | 1.20.3 | X | X | +| mypy (dev) | 0.971 | | X | +| beautifulsoup4 | 4.9.3 | | X | +| blosc | 1.21.0 | | X | +| bottleneck | 1.3.2 | | X | +| fsspec | 2021.07.0 | | X | +| hypothesis | 6.13.0 | | X | +| gcsfs | 2021.07.0 | | X | +| jinja2 | 3.0.0 | | X | +| lxml | 4.6.3 | | X | +| numba | 0.53.1 | | X | +| numexpr | 2.7.3 | | X | +| openpyxl | 3.0.7 | | X | +| pandas-gbq | 0.15.0 | | X | +| psycopg2 | 2.8.6 | | X | +| pymysql | 1.0.2 | | X | +| pyreadstat | 1.1.2 | | X | +| pyxlsb | 1.0.8 | | X | +| s3fs | 2021.08.0 | | X | +| scipy | 1.7.1 | | X | +| sqlalchemy | 1.4.16 | | X | +| tabulate | 0.8.9 | | X | +| xarray | 0.19.0 | | X | +| xlsxwriter | 1.4.3 | | X | + +For [optional libraries](https://pandas.pydata.org/docs/getting_started/install.html) the general recommendation is to use the latest version. +The following table lists the lowest version per library that is currently being tested throughout the development of pandas. +Optional libraries below the lowest tested version may still work, but are not considered supported. + +| Package | Minimum Version | Changed | +| --- | --- | --- | +| beautifulsoup4 | 4.9.3 | X | +| blosc | 1.21.0 | X | +| bottleneck | 1.3.2 | X | +| brotlipy | 0.7.0 | | +| fastparquet | 0.4.0 | | +| fsspec | 2021.08.0 | X | +| html5lib | 1.1 | | +| hypothesis | 6.13.0 | X | +| gcsfs | 2021.08.0 | X | +| jinja2 | 3.0.0 | X | +| lxml | 4.6.3 | X | +| matplotlib | 3.3.2 | | +| numba | 0.53.1 | X | +| numexpr | 2.7.3 | X | +| odfpy | 1.4.1 | | +| openpyxl | 3.0.7 | X | +| pandas-gbq | 0.15.0 | X | +| psycopg2 | 2.8.6 | X | +| pyarrow | 1.0.1 | | +| pymysql | 1.0.2 | X | +| pyreadstat | 1.1.2 | X | +| pytables | 3.6.1 | | +| python-snappy | 0.6.0 | | +| pyxlsb | 1.0.8 | X | +| s3fs | 2021.08.0 | X | +| scipy | 1.7.1 | X | +| sqlalchemy | 1.4.16 | X | +| tabulate | 0.8.9 | X | +| tzdata | 2022a | | +| xarray | 0.19.0 | X | +| xlrd | 2.0.1 | | +| xlsxwriter | 1.4.3 | X | +| xlwt | 1.3.0 | | +| zstandard | 0.15.2 | | + +See [Dependencies](../getting_started/install.html#install-dependencies) and [Optional dependencies](../getting_started/install.html#install-optional-dependencies) for more. + +### Other API changes[#](#other-api-changes "Link to this heading") + +* BigQuery I/O methods [`read_gbq()`](../reference/api/pandas.read_gbq.html#pandas.read_gbq "pandas.read_gbq") and [`DataFrame.to_gbq()`](../reference/api/pandas.DataFrame.to_gbq.html#pandas.DataFrame.to_gbq "pandas.DataFrame.to_gbq") default to + `auth_local_webserver = True`. Google has deprecated the + `auth_local_webserver = False` [“out of band” (copy-paste) flow](https://developers.googleblog.com/2022/02/making-oauth-flows-safer.html?m=1#disallowed-oob). + The `auth_local_webserver = False` option is planned to stop working in + October 2022. ([GH 46312](https://github.com/pandas-dev/pandas/issues/46312)) +* [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") now raises `FileNotFoundError` (previously `ValueError`) when input is a string ending in `.json`, `.json.gz`, `.json.bz2`, etc. but no such file exists. ([GH 29102](https://github.com/pandas-dev/pandas/issues/29102)) +* Operations with [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") or [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") that would previously raise `OverflowError` instead raise `OutOfBoundsDatetime` or `OutOfBoundsTimedelta` where appropriate ([GH 47268](https://github.com/pandas-dev/pandas/issues/47268)) +* When [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") previously returned `None`, it now returns an empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 47410](https://github.com/pandas-dev/pandas/issues/47410)) +* [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor raises if `index` or `columns` arguments are sets ([GH 47215](https://github.com/pandas-dev/pandas/issues/47215)) + +## Deprecations[#](#deprecations "Link to this heading") + +Warning + +In the next major version release, 2.0, several larger API changes are being considered without a formal deprecation such as +making the standard library [zoneinfo](https://docs.python.org/3/library/zoneinfo.html) the default timezone implementation instead of `pytz`, +having the [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") support all data types instead of having multiple subclasses ([`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex"), `Int64Index`, etc.), and more. +The changes under consideration are logged in [this GitHub issue](https://github.com/pandas-dev/pandas/issues/44823), and any +feedback or concerns are welcome. + +### Label-based integer slicing on a Series with an Int64Index or RangeIndex[#](#label-based-integer-slicing-on-a-series-with-an-int64index-or-rangeindex "Link to this heading") + +In a future version, integer slicing on a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with a `Int64Index` or [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") will be treated as *label-based*, not positional. This will make the behavior consistent with other `Series.__getitem__()` and `Series.__setitem__()` behaviors ([GH 45162](https://github.com/pandas-dev/pandas/issues/45162)). + +For example: + +```None +In [29]: ser = pd.Series([1, 2, 3, 4, 5], index=[2, 3, 5, 7, 11]) +``` + +In the old behavior, `ser[2:4]` treats the slice as positional: + +*Old behavior*: + +```None +In [3]: ser[2:4] +Out[3]: +5 3 +7 4 +dtype: int64 +``` + +In a future version, this will be treated as label-based: + +*Future behavior*: + +```None +In [4]: ser.loc[2:4] +Out[4]: +2 1 +3 2 +dtype: int64 +``` + +To retain the old behavior, use `series.iloc[i:j]`. To get the future behavior, +use `series.loc[i:j]`. + +Slicing on a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") will not be affected. + +### [`ExcelWriter`](../reference/api/pandas.ExcelWriter.html#pandas.ExcelWriter "pandas.ExcelWriter") attributes[#](#excelwriter-attributes "Link to this heading") + +All attributes of [`ExcelWriter`](../reference/api/pandas.ExcelWriter.html#pandas.ExcelWriter "pandas.ExcelWriter") were previously documented as not +public. However some third party Excel engines documented accessing +`ExcelWriter.book` or `ExcelWriter.sheets`, and users were utilizing these +and possibly other attributes. Previously these attributes were not safe to use; +e.g. modifications to `ExcelWriter.book` would not update `ExcelWriter.sheets` +and conversely. In order to support this, pandas has made some attributes public +and improved their implementations so that they may now be safely used. ([GH 45572](https://github.com/pandas-dev/pandas/issues/45572)) + +The following attributes are now public and considered safe to access. + +> * `book` +> * `check_extension` +> * `close` +> * `date_format` +> * `datetime_format` +> * `engine` +> * `if_sheet_exists` +> * `sheets` +> * `supported_extensions` + +The following attributes have been deprecated. They now raise a `FutureWarning` +when accessed and will be removed in a future version. Users should be aware +that their usage is considered unsafe, and can lead to unexpected results. + +> * `cur_sheet` +> * `handles` +> * `path` +> * `save` +> * `write_cells` + +See the documentation of [`ExcelWriter`](../reference/api/pandas.ExcelWriter.html#pandas.ExcelWriter "pandas.ExcelWriter") for further details. + +### Using `group_keys` with transformers in [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") and [`SeriesGroupBy.apply()`](../reference/api/pandas.core.groupby.SeriesGroupBy.apply.html#pandas.core.groupby.SeriesGroupBy.apply "pandas.core.groupby.SeriesGroupBy.apply")[#](#using-group-keys-with-transformers-in-dataframegroupby-apply-and-seriesgroupby-apply "Link to this heading") + +In previous versions of pandas, if it was inferred that the function passed to +[`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") or [`SeriesGroupBy.apply()`](../reference/api/pandas.core.groupby.SeriesGroupBy.apply.html#pandas.core.groupby.SeriesGroupBy.apply "pandas.core.groupby.SeriesGroupBy.apply") was a transformer (i.e. the resulting index was equal to +the input index), the `group_keys` argument of [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") and +[`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") was ignored and the group keys would never be added to +the index of the result. In the future, the group keys will be added to the index +when the user specifies `group_keys=True`. + +As `group_keys=True` is the default value of [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") and +[`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby"), not specifying `group_keys` with a transformer will +raise a `FutureWarning`. This can be silenced and the previous behavior +retained by specifying `group_keys=False`. + +### Inplace operation when setting values with `loc` and `iloc`[#](#inplace-operation-when-setting-values-with-loc-and-iloc "Link to this heading") + +Most of the time setting values with [`DataFrame.iloc()`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") attempts to set values +inplace, only falling back to inserting a new array if necessary. There are +some cases where this rule is not followed, for example when setting an entire +column from an array with different dtype: + +```None +In [30]: df = pd.DataFrame({'price': [11.1, 12.2]}, index=['book1', 'book2']) + +In [31]: original_prices = df['price'] + +In [32]: new_prices = np.array([98, 99]) +``` + +*Old behavior*: + +```None +In [3]: df.iloc[:, 0] = new_prices +In [4]: df.iloc[:, 0] +Out[4]: +book1 98 +book2 99 +Name: price, dtype: int64 +In [5]: original_prices +Out[5]: +book1 11.1 +book2 12.2 +Name: price, float: 64 +``` + +This behavior is deprecated. In a future version, setting an entire column with +iloc will attempt to operate inplace. + +*Future behavior*: + +```None +In [3]: df.iloc[:, 0] = new_prices +In [4]: df.iloc[:, 0] +Out[4]: +book1 98.0 +book2 99.0 +Name: price, dtype: float64 +In [5]: original_prices +Out[5]: +book1 98.0 +book2 99.0 +Name: price, dtype: float64 +``` + +To get the old behavior, use `DataFrame.__setitem__()` directly: + +```None +In [3]: df[df.columns[0]] = new_prices +In [4]: df.iloc[:, 0] +Out[4] +book1 98 +book2 99 +Name: price, dtype: int64 +In [5]: original_prices +Out[5]: +book1 11.1 +book2 12.2 +Name: price, dtype: float64 +``` + +To get the old behaviour when `df.columns` is not unique and you want to +change a single column by index, you can use `DataFrame.isetitem()`, which +has been added in pandas 1.5: + +```None +In [3]: df_with_duplicated_cols = pd.concat([df, df], axis='columns') +In [3]: df_with_duplicated_cols.isetitem(0, new_prices) +In [4]: df_with_duplicated_cols.iloc[:, 0] +Out[4]: +book1 98 +book2 99 +Name: price, dtype: int64 +In [5]: original_prices +Out[5]: +book1 11.1 +book2 12.2 +Name: 0, dtype: float64 +``` + +### `numeric_only` default value[#](#numeric-only-default-value "Link to this heading") + +Across the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame"), `DataFrameGroupBy`, and `Resampler` operations such as +`min`, `sum`, and `idxmax`, the default +value of the `numeric_only` argument, if it exists at all, was inconsistent. +Furthermore, operations with the default value `None` can lead to surprising +results. ([GH 46560](https://github.com/pandas-dev/pandas/issues/46560)) + +```None +In [1]: df = pd.DataFrame({"a": [1, 2], "b": ["x", "y"]}) + +In [2]: # Reading the next line without knowing the contents of df, one would + # expect the result to contain the products for both columns a and b. + df[["a", "b"]].prod() +Out[2]: +a 2 +dtype: int64 +``` + +To avoid this behavior, the specifying the value `numeric_only=None` has been +deprecated, and will be removed in a future version of pandas. In the future, +all operations with a `numeric_only` argument will default to `False`. Users +should either call the operation only with columns that can be operated on, or +specify `numeric_only=True` to operate only on Boolean, integer, and float columns. + +In order to support the transition to the new behavior, the following methods have +gained the `numeric_only` argument. + +* [`DataFrame.corr()`](../reference/api/pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr") +* [`DataFrame.corrwith()`](../reference/api/pandas.DataFrame.corrwith.html#pandas.DataFrame.corrwith "pandas.DataFrame.corrwith") +* [`DataFrame.cov()`](../reference/api/pandas.DataFrame.cov.html#pandas.DataFrame.cov "pandas.DataFrame.cov") +* [`DataFrame.idxmin()`](../reference/api/pandas.DataFrame.idxmin.html#pandas.DataFrame.idxmin "pandas.DataFrame.idxmin") +* [`DataFrame.idxmax()`](../reference/api/pandas.DataFrame.idxmax.html#pandas.DataFrame.idxmax "pandas.DataFrame.idxmax") +* [`DataFrameGroupBy.cummin()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cummin.html#pandas.core.groupby.DataFrameGroupBy.cummin "pandas.core.groupby.DataFrameGroupBy.cummin") +* [`DataFrameGroupBy.cummax()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cummax.html#pandas.core.groupby.DataFrameGroupBy.cummax "pandas.core.groupby.DataFrameGroupBy.cummax") +* [`DataFrameGroupBy.idxmin()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.idxmin.html#pandas.core.groupby.DataFrameGroupBy.idxmin "pandas.core.groupby.DataFrameGroupBy.idxmin") +* [`DataFrameGroupBy.idxmax()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.idxmax.html#pandas.core.groupby.DataFrameGroupBy.idxmax "pandas.core.groupby.DataFrameGroupBy.idxmax") +* [`DataFrameGroupBy.var()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.var.html#pandas.core.groupby.DataFrameGroupBy.var "pandas.core.groupby.DataFrameGroupBy.var") +* [`DataFrameGroupBy.std()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.std.html#pandas.core.groupby.DataFrameGroupBy.std "pandas.core.groupby.DataFrameGroupBy.std") +* [`DataFrameGroupBy.sem()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.sem.html#pandas.core.groupby.DataFrameGroupBy.sem "pandas.core.groupby.DataFrameGroupBy.sem") +* [`DataFrameGroupBy.quantile()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.quantile.html#pandas.core.groupby.DataFrameGroupBy.quantile "pandas.core.groupby.DataFrameGroupBy.quantile") +* [`Resampler.mean()`](../reference/api/pandas.core.resample.Resampler.mean.html#pandas.core.resample.Resampler.mean "pandas.core.resample.Resampler.mean") +* [`Resampler.median()`](../reference/api/pandas.core.resample.Resampler.median.html#pandas.core.resample.Resampler.median "pandas.core.resample.Resampler.median") +* [`Resampler.sem()`](../reference/api/pandas.core.resample.Resampler.sem.html#pandas.core.resample.Resampler.sem "pandas.core.resample.Resampler.sem") +* [`Resampler.std()`](../reference/api/pandas.core.resample.Resampler.std.html#pandas.core.resample.Resampler.std "pandas.core.resample.Resampler.std") +* [`Resampler.var()`](../reference/api/pandas.core.resample.Resampler.var.html#pandas.core.resample.Resampler.var "pandas.core.resample.Resampler.var") +* [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") operations +* [`DataFrame.expanding()`](../reference/api/pandas.DataFrame.expanding.html#pandas.DataFrame.expanding "pandas.DataFrame.expanding") operations +* [`DataFrame.ewm()`](../reference/api/pandas.DataFrame.ewm.html#pandas.DataFrame.ewm "pandas.DataFrame.ewm") operations + +### Other Deprecations[#](#other-deprecations "Link to this heading") + +* Deprecated the keyword `line_terminator` in [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") and [`Series.to_csv()`](../reference/api/pandas.Series.to_csv.html#pandas.Series.to_csv "pandas.Series.to_csv"), use `lineterminator` instead; this is for consistency with [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") and the standard library ‘csv’ module ([GH 9568](https://github.com/pandas-dev/pandas/issues/9568)) +* Deprecated behavior of `SparseArray.astype()`, [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype"), and [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") with [`SparseDtype`](../reference/api/pandas.SparseDtype.html#pandas.SparseDtype "pandas.SparseDtype") when passing a non-sparse `dtype`. In a future version, this will cast to that non-sparse dtype instead of wrapping it in a [`SparseDtype`](../reference/api/pandas.SparseDtype.html#pandas.SparseDtype "pandas.SparseDtype") ([GH 34457](https://github.com/pandas-dev/pandas/issues/34457)) +* Deprecated behavior of `DatetimeIndex.intersection()` and `DatetimeIndex.symmetric_difference()` (`union` behavior was already deprecated in version 1.3.0) with mixed time zones; in a future version both will be cast to UTC instead of object dtype ([GH 39328](https://github.com/pandas-dev/pandas/issues/39328), [GH 45357](https://github.com/pandas-dev/pandas/issues/45357)) +* Deprecated `DataFrame.iteritems()`, `Series.iteritems()`, `HDFStore.iteritems()` in favor of [`DataFrame.items()`](../reference/api/pandas.DataFrame.items.html#pandas.DataFrame.items "pandas.DataFrame.items"), [`Series.items()`](../reference/api/pandas.Series.items.html#pandas.Series.items "pandas.Series.items"), `HDFStore.items()` ([GH 45321](https://github.com/pandas-dev/pandas/issues/45321)) +* Deprecated `Series.is_monotonic()` and `Index.is_monotonic()` in favor of [`Series.is_monotonic_increasing()`](../reference/api/pandas.Series.is_monotonic_increasing.html#pandas.Series.is_monotonic_increasing "pandas.Series.is_monotonic_increasing") and [`Index.is_monotonic_increasing()`](../reference/api/pandas.Index.is_monotonic_increasing.html#pandas.Index.is_monotonic_increasing "pandas.Index.is_monotonic_increasing") ([GH 45422](https://github.com/pandas-dev/pandas/issues/45422), [GH 21335](https://github.com/pandas-dev/pandas/issues/21335)) +* Deprecated behavior of `DatetimeIndex.astype()`, `TimedeltaIndex.astype()`, `PeriodIndex.astype()` when converting to an integer dtype other than `int64`. In a future version, these will convert to exactly the specified dtype (instead of always `int64`) and will raise if the conversion overflows ([GH 45034](https://github.com/pandas-dev/pandas/issues/45034)) +* Deprecated the `__array_wrap__` method of DataFrame and Series, rely on standard numpy ufuncs instead ([GH 45451](https://github.com/pandas-dev/pandas/issues/45451)) +* Deprecated treating float-dtype data as wall-times when passed with a timezone to [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") ([GH 45573](https://github.com/pandas-dev/pandas/issues/45573)) +* Deprecated the behavior of [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") and [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") with `timedelta64[ns]` dtype and incompatible fill value; in a future version this will cast to a common dtype (usually object) instead of raising, matching the behavior of other dtypes ([GH 45746](https://github.com/pandas-dev/pandas/issues/45746)) +* Deprecated the `warn` parameter in [`infer_freq()`](../reference/api/pandas.infer_freq.html#pandas.infer_freq "pandas.infer_freq") ([GH 45947](https://github.com/pandas-dev/pandas/issues/45947)) +* Deprecated allowing non-keyword arguments in [`ExtensionArray.argsort()`](../reference/api/pandas.api.extensions.ExtensionArray.argsort.html#pandas.api.extensions.ExtensionArray.argsort "pandas.api.extensions.ExtensionArray.argsort") ([GH 46134](https://github.com/pandas-dev/pandas/issues/46134)) +* Deprecated treating all-bool `object`-dtype columns as bool-like in [`DataFrame.any()`](../reference/api/pandas.DataFrame.any.html#pandas.DataFrame.any "pandas.DataFrame.any") and [`DataFrame.all()`](../reference/api/pandas.DataFrame.all.html#pandas.DataFrame.all "pandas.DataFrame.all") with `bool_only=True`, explicitly cast to bool instead ([GH 46188](https://github.com/pandas-dev/pandas/issues/46188)) +* Deprecated behavior of method [`DataFrame.quantile()`](../reference/api/pandas.DataFrame.quantile.html#pandas.DataFrame.quantile "pandas.DataFrame.quantile"), attribute `numeric_only` will default False. Including datetime/timedelta columns in the result ([GH 7308](https://github.com/pandas-dev/pandas/issues/7308)). +* Deprecated `Timedelta.freq` and `Timedelta.is_populated` ([GH 46430](https://github.com/pandas-dev/pandas/issues/46430)) +* Deprecated `Timedelta.delta` ([GH 46476](https://github.com/pandas-dev/pandas/issues/46476)) +* Deprecated passing arguments as positional in [`DataFrame.any()`](../reference/api/pandas.DataFrame.any.html#pandas.DataFrame.any "pandas.DataFrame.any") and [`Series.any()`](../reference/api/pandas.Series.any.html#pandas.Series.any "pandas.Series.any") ([GH 44802](https://github.com/pandas-dev/pandas/issues/44802)) +* Deprecated passing positional arguments to [`DataFrame.pivot()`](../reference/api/pandas.DataFrame.pivot.html#pandas.DataFrame.pivot "pandas.DataFrame.pivot") and [`pivot()`](../reference/api/pandas.pivot.html#pandas.pivot "pandas.pivot") except `data` ([GH 30228](https://github.com/pandas-dev/pandas/issues/30228)) +* Deprecated the methods `DataFrame.mad()`, `Series.mad()`, and the corresponding groupby methods ([GH 11787](https://github.com/pandas-dev/pandas/issues/11787)) +* Deprecated positional arguments to [`Index.join()`](../reference/api/pandas.Index.join.html#pandas.Index.join "pandas.Index.join") except for `other`, use keyword-only arguments instead of positional arguments ([GH 46518](https://github.com/pandas-dev/pandas/issues/46518)) +* Deprecated positional arguments to `StringMethods.rsplit()` and `StringMethods.split()` except for `pat`, use keyword-only arguments instead of positional arguments ([GH 47423](https://github.com/pandas-dev/pandas/issues/47423)) +* Deprecated indexing on a timezone-naive [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") using a string representing a timezone-aware datetime ([GH 46903](https://github.com/pandas-dev/pandas/issues/46903), [GH 36148](https://github.com/pandas-dev/pandas/issues/36148)) +* Deprecated allowing `unit="M"` or `unit="Y"` in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") constructor with a non-round float value ([GH 47267](https://github.com/pandas-dev/pandas/issues/47267)) +* Deprecated the `display.column_space` global configuration option ([GH 7576](https://github.com/pandas-dev/pandas/issues/7576)) +* Deprecated the argument `na_sentinel` in [`factorize()`](../reference/api/pandas.factorize.html#pandas.factorize "pandas.factorize"), [`Index.factorize()`](../reference/api/pandas.Index.factorize.html#pandas.Index.factorize "pandas.Index.factorize"), and [`ExtensionArray.factorize()`](../reference/api/pandas.api.extensions.ExtensionArray.factorize.html#pandas.api.extensions.ExtensionArray.factorize "pandas.api.extensions.ExtensionArray.factorize"); pass `use_na_sentinel=True` instead to use the sentinel `-1` for NaN values and `use_na_sentinel=False` instead of `na_sentinel=None` to encode NaN values ([GH 46910](https://github.com/pandas-dev/pandas/issues/46910)) +* Deprecated [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") not aligning the result when the UDF returned DataFrame ([GH 45648](https://github.com/pandas-dev/pandas/issues/45648)) +* Clarified warning from [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") when delimited dates can’t be parsed in accordance to specified `dayfirst` argument ([GH 46210](https://github.com/pandas-dev/pandas/issues/46210)) +* Emit warning from [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") when delimited dates can’t be parsed in accordance to specified `dayfirst` argument even for dates where leading zero is omitted (e.g. `31/1/2001`) ([GH 47880](https://github.com/pandas-dev/pandas/issues/47880)) +* Deprecated [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and `Resampler` reducers (e.g. `min`, `max`, `sum`, `mean`) raising a `NotImplementedError` when the dtype is non-numric and `numeric_only=True` is provided; this will raise a `TypeError` in a future version ([GH 47500](https://github.com/pandas-dev/pandas/issues/47500)) +* Deprecated [`Series.rank()`](../reference/api/pandas.Series.rank.html#pandas.Series.rank "pandas.Series.rank") returning an empty result when the dtype is non-numeric and `numeric_only=True` is provided; this will raise a `TypeError` in a future version ([GH 47500](https://github.com/pandas-dev/pandas/issues/47500)) +* Deprecated argument `errors` for [`Series.mask()`](../reference/api/pandas.Series.mask.html#pandas.Series.mask "pandas.Series.mask"), [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where"), [`DataFrame.mask()`](../reference/api/pandas.DataFrame.mask.html#pandas.DataFrame.mask "pandas.DataFrame.mask"), and [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where") as `errors` had no effect on this methods ([GH 47728](https://github.com/pandas-dev/pandas/issues/47728)) +* Deprecated arguments `*args` and `**kwargs` in `Rolling`, `Expanding`, and `ExponentialMovingWindow` ops. ([GH 47836](https://github.com/pandas-dev/pandas/issues/47836)) +* Deprecated the `inplace` keyword in `Categorical.set_ordered()`, `Categorical.as_ordered()`, and `Categorical.as_unordered()` ([GH 37643](https://github.com/pandas-dev/pandas/issues/37643)) +* Deprecated setting a categorical’s categories with `cat.categories = ['a', 'b', 'c']`, use `Categorical.rename_categories()` instead ([GH 37643](https://github.com/pandas-dev/pandas/issues/37643)) +* Deprecated unused arguments `encoding` and `verbose` in [`Series.to_excel()`](../reference/api/pandas.Series.to_excel.html#pandas.Series.to_excel "pandas.Series.to_excel") and [`DataFrame.to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel") ([GH 47912](https://github.com/pandas-dev/pandas/issues/47912)) +* Deprecated the `inplace` keyword in [`DataFrame.set_axis()`](../reference/api/pandas.DataFrame.set_axis.html#pandas.DataFrame.set_axis "pandas.DataFrame.set_axis") and [`Series.set_axis()`](../reference/api/pandas.Series.set_axis.html#pandas.Series.set_axis "pandas.Series.set_axis"), use `obj = obj.set_axis(..., copy=False)` instead ([GH 48130](https://github.com/pandas-dev/pandas/issues/48130)) +* Deprecated producing a single element when iterating over a `DataFrameGroupBy` or a `SeriesGroupBy` that has been grouped by a list of length 1; A tuple of length one will be returned instead ([GH 42795](https://github.com/pandas-dev/pandas/issues/42795)) +* Fixed up warning message of deprecation of `MultiIndex.lesort_depth()` as public method, as the message previously referred to `MultiIndex.is_lexsorted()` instead ([GH 38701](https://github.com/pandas-dev/pandas/issues/38701)) +* Deprecated the `sort_columns` argument in [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") and [`Series.plot()`](../reference/api/pandas.Series.plot.html#pandas.Series.plot "pandas.Series.plot") ([GH 47563](https://github.com/pandas-dev/pandas/issues/47563)). +* Deprecated positional arguments for all but the first argument of [`DataFrame.to_stata()`](../reference/api/pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata") and [`read_stata()`](../reference/api/pandas.read_stata.html#pandas.read_stata "pandas.read_stata"), use keyword arguments instead ([GH 48128](https://github.com/pandas-dev/pandas/issues/48128)). +* Deprecated the `mangle_dupe_cols` argument in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv"), [`read_fwf()`](../reference/api/pandas.read_fwf.html#pandas.read_fwf "pandas.read_fwf"), [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") and [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel"). The argument was never implemented, and a new argument where the renaming pattern can be specified will be added instead ([GH 47718](https://github.com/pandas-dev/pandas/issues/47718)) +* Deprecated allowing `dtype='datetime64'` or `dtype=np.datetime64` in [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype"), use “datetime64[ns]” instead ([GH 47844](https://github.com/pandas-dev/pandas/issues/47844)) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Performance improvement in [`DataFrame.corrwith()`](../reference/api/pandas.DataFrame.corrwith.html#pandas.DataFrame.corrwith "pandas.DataFrame.corrwith") for column-wise (axis=0) Pearson and Spearman correlation when other is a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") ([GH 46174](https://github.com/pandas-dev/pandas/issues/46174)) +* Performance improvement in [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") and [`SeriesGroupBy.transform()`](../reference/api/pandas.core.groupby.SeriesGroupBy.transform.html#pandas.core.groupby.SeriesGroupBy.transform "pandas.core.groupby.SeriesGroupBy.transform") for some user-defined DataFrame -> Series functions ([GH 45387](https://github.com/pandas-dev/pandas/issues/45387)) +* Performance improvement in [`DataFrame.duplicated()`](../reference/api/pandas.DataFrame.duplicated.html#pandas.DataFrame.duplicated "pandas.DataFrame.duplicated") when subset consists of only one column ([GH 45236](https://github.com/pandas-dev/pandas/issues/45236)) +* Performance improvement in [`DataFrameGroupBy.diff()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.diff.html#pandas.core.groupby.DataFrameGroupBy.diff "pandas.core.groupby.DataFrameGroupBy.diff") and [`SeriesGroupBy.diff()`](../reference/api/pandas.core.groupby.SeriesGroupBy.diff.html#pandas.core.groupby.SeriesGroupBy.diff "pandas.core.groupby.SeriesGroupBy.diff") ([GH 16706](https://github.com/pandas-dev/pandas/issues/16706)) +* Performance improvement in [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") and [`SeriesGroupBy.transform()`](../reference/api/pandas.core.groupby.SeriesGroupBy.transform.html#pandas.core.groupby.SeriesGroupBy.transform "pandas.core.groupby.SeriesGroupBy.transform") when broadcasting values for user-defined functions ([GH 45708](https://github.com/pandas-dev/pandas/issues/45708)) +* Performance improvement in [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") and [`SeriesGroupBy.transform()`](../reference/api/pandas.core.groupby.SeriesGroupBy.transform.html#pandas.core.groupby.SeriesGroupBy.transform "pandas.core.groupby.SeriesGroupBy.transform") for user-defined functions when only a single group exists ([GH 44977](https://github.com/pandas-dev/pandas/issues/44977)) +* Performance improvement in [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") and [`SeriesGroupBy.apply()`](../reference/api/pandas.core.groupby.SeriesGroupBy.apply.html#pandas.core.groupby.SeriesGroupBy.apply "pandas.core.groupby.SeriesGroupBy.apply") when grouping on a non-unique unsorted index ([GH 46527](https://github.com/pandas-dev/pandas/issues/46527)) +* Performance improvement in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") and [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") for tuple-based indexing of a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 45681](https://github.com/pandas-dev/pandas/issues/45681), [GH 46040](https://github.com/pandas-dev/pandas/issues/46040), [GH 46330](https://github.com/pandas-dev/pandas/issues/46330)) +* Performance improvement in [`DataFrameGroupBy.var()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.var.html#pandas.core.groupby.DataFrameGroupBy.var "pandas.core.groupby.DataFrameGroupBy.var") and [`SeriesGroupBy.var()`](../reference/api/pandas.core.groupby.SeriesGroupBy.var.html#pandas.core.groupby.SeriesGroupBy.var "pandas.core.groupby.SeriesGroupBy.var") with `ddof` other than one ([GH 48152](https://github.com/pandas-dev/pandas/issues/48152)) +* Performance improvement in [`DataFrame.to_records()`](../reference/api/pandas.DataFrame.to_records.html#pandas.DataFrame.to_records "pandas.DataFrame.to_records") when the index is a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 47263](https://github.com/pandas-dev/pandas/issues/47263)) +* Performance improvement in `MultiIndex.values` when the MultiIndex contains levels of type DatetimeIndex, TimedeltaIndex or ExtensionDtypes ([GH 46288](https://github.com/pandas-dev/pandas/issues/46288)) +* Performance improvement in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") when left and/or right are empty ([GH 45838](https://github.com/pandas-dev/pandas/issues/45838)) +* Performance improvement in [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") when left and/or right are empty ([GH 46015](https://github.com/pandas-dev/pandas/issues/46015)) +* Performance improvement in [`DataFrame.reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex") and [`Series.reindex()`](../reference/api/pandas.Series.reindex.html#pandas.Series.reindex "pandas.Series.reindex") when target is a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 46235](https://github.com/pandas-dev/pandas/issues/46235)) +* Performance improvement when setting values in a pyarrow backed string array ([GH 46400](https://github.com/pandas-dev/pandas/issues/46400)) +* Performance improvement in [`factorize()`](../reference/api/pandas.factorize.html#pandas.factorize "pandas.factorize") ([GH 46109](https://github.com/pandas-dev/pandas/issues/46109)) +* Performance improvement in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructors for extension dtype scalars ([GH 45854](https://github.com/pandas-dev/pandas/issues/45854)) +* Performance improvement in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") when `nrows` argument provided ([GH 32727](https://github.com/pandas-dev/pandas/issues/32727)) +* Performance improvement in [`Styler.to_excel()`](../reference/api/pandas.io.formats.style.Styler.to_excel.html#pandas.io.formats.style.Styler.to_excel "pandas.io.formats.style.Styler.to_excel") when applying repeated CSS formats ([GH 47371](https://github.com/pandas-dev/pandas/issues/47371)) +* Performance improvement in `MultiIndex.is_monotonic_increasing()` ([GH 47458](https://github.com/pandas-dev/pandas/issues/47458)) +* Performance improvement in `BusinessHour` `str` and `repr` ([GH 44764](https://github.com/pandas-dev/pandas/issues/44764)) +* Performance improvement in datetime arrays string formatting when one of the default strftime formats `"%Y-%m-%d %H:%M:%S"` or `"%Y-%m-%d %H:%M:%S.%f"` is used. ([GH 44764](https://github.com/pandas-dev/pandas/issues/44764)) +* Performance improvement in [`Series.to_sql()`](../reference/api/pandas.Series.to_sql.html#pandas.Series.to_sql "pandas.Series.to_sql") and [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") (`SQLiteTable`) when processing time arrays. ([GH 44764](https://github.com/pandas-dev/pandas/issues/44764)) +* Performance improvement to [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") ([GH 47404](https://github.com/pandas-dev/pandas/issues/47404)) +* Performance improvement in `argmax` and `argmin` for [`arrays.SparseArray`](../reference/api/pandas.arrays.SparseArray.html#pandas.arrays.SparseArray "pandas.arrays.SparseArray") ([GH 34197](https://github.com/pandas-dev/pandas/issues/34197)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +### Categorical[#](#categorical "Link to this heading") + +* Bug in `Categorical.view()` not accepting integer dtypes ([GH 25464](https://github.com/pandas-dev/pandas/issues/25464)) +* Bug in `CategoricalIndex.union()` when the index’s categories are integer-dtype and the index contains `NaN` values incorrectly raising instead of casting to `float64` ([GH 45362](https://github.com/pandas-dev/pandas/issues/45362)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") when concatenating two (or more) unordered [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") variables, whose categories are permutations, yields incorrect index values ([GH 24845](https://github.com/pandas-dev/pandas/issues/24845)) + +### Datetimelike[#](#datetimelike "Link to this heading") + +* Bug in [`DataFrame.quantile()`](../reference/api/pandas.DataFrame.quantile.html#pandas.DataFrame.quantile "pandas.DataFrame.quantile") with datetime-like dtypes and no rows incorrectly returning `float64` dtype instead of retaining datetime-like dtype ([GH 41544](https://github.com/pandas-dev/pandas/issues/41544)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with sequences of `np.str_` objects incorrectly raising ([GH 32264](https://github.com/pandas-dev/pandas/issues/32264)) +* Bug in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") construction when passing datetime components as positional arguments and `tzinfo` as a keyword argument incorrectly raising ([GH 31929](https://github.com/pandas-dev/pandas/issues/31929)) +* Bug in [`Index.astype()`](../reference/api/pandas.Index.astype.html#pandas.Index.astype "pandas.Index.astype") when casting from object dtype to `timedelta64[ns]` dtype incorrectly casting `np.datetime64("NaT")` values to `np.timedelta64("NaT")` instead of raising ([GH 45722](https://github.com/pandas-dev/pandas/issues/45722)) +* Bug in [`SeriesGroupBy.value_counts()`](../reference/api/pandas.core.groupby.SeriesGroupBy.value_counts.html#pandas.core.groupby.SeriesGroupBy.value_counts "pandas.core.groupby.SeriesGroupBy.value_counts") index when passing categorical column ([GH 44324](https://github.com/pandas-dev/pandas/issues/44324)) +* Bug in [`DatetimeIndex.tz_localize()`](../reference/api/pandas.DatetimeIndex.tz_localize.html#pandas.DatetimeIndex.tz_localize "pandas.DatetimeIndex.tz_localize") localizing to UTC failing to make a copy of the underlying data ([GH 46460](https://github.com/pandas-dev/pandas/issues/46460)) +* Bug in `DatetimeIndex.resolution()` incorrectly returning “day” instead of “nanosecond” for nanosecond-resolution indexes ([GH 46903](https://github.com/pandas-dev/pandas/issues/46903)) +* Bug in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") with an integer or float value and `unit="Y"` or `unit="M"` giving slightly-wrong results ([GH 47266](https://github.com/pandas-dev/pandas/issues/47266)) +* Bug in [`DatetimeArray`](../reference/api/pandas.arrays.DatetimeArray.html#pandas.arrays.DatetimeArray "pandas.arrays.DatetimeArray") construction when passed another [`DatetimeArray`](../reference/api/pandas.arrays.DatetimeArray.html#pandas.arrays.DatetimeArray "pandas.arrays.DatetimeArray") and `freq=None` incorrectly inferring the freq from the given array ([GH 47296](https://github.com/pandas-dev/pandas/issues/47296)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") where `OutOfBoundsDatetime` would be thrown even if `errors=coerce` if there were more than 50 rows ([GH 45319](https://github.com/pandas-dev/pandas/issues/45319)) +* Bug when adding a `DateOffset` to a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") would not add the `nanoseconds` field ([GH 47856](https://github.com/pandas-dev/pandas/issues/47856)) + +### Timedelta[#](#timedelta "Link to this heading") + +* Bug in `astype_nansafe()` astype(“timedelta64[ns]”) fails when np.nan is included ([GH 45798](https://github.com/pandas-dev/pandas/issues/45798)) +* Bug in constructing a [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") with a `np.timedelta64` object and a `unit` sometimes silently overflowing and returning incorrect results instead of raising `OutOfBoundsTimedelta` ([GH 46827](https://github.com/pandas-dev/pandas/issues/46827)) +* Bug in constructing a [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") from a large integer or float with `unit="W"` silently overflowing and returning incorrect results instead of raising `OutOfBoundsTimedelta` ([GH 47268](https://github.com/pandas-dev/pandas/issues/47268)) + +### Time Zones[#](#time-zones "Link to this heading") + +* Bug in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") constructor raising when passed a `ZoneInfo` tzinfo object ([GH 46425](https://github.com/pandas-dev/pandas/issues/46425)) + +### Numeric[#](#numeric "Link to this heading") + +* Bug in operations with array-likes with `dtype="boolean"` and [`NA`](../reference/api/pandas.NA.html#pandas.NA "pandas.NA") incorrectly altering the array in-place ([GH 45421](https://github.com/pandas-dev/pandas/issues/45421)) +* Bug in arithmetic operations with nullable types without [`NA`](../reference/api/pandas.NA.html#pandas.NA "pandas.NA") values not matching the same operation with non-nullable types ([GH 48223](https://github.com/pandas-dev/pandas/issues/48223)) +* Bug in `floordiv` when dividing by `IntegerDtype` `0` would return `0` instead of `inf` ([GH 48223](https://github.com/pandas-dev/pandas/issues/48223)) +* Bug in division, `pow` and `mod` operations on array-likes with `dtype="boolean"` not being like their `np.bool_` counterparts ([GH 46063](https://github.com/pandas-dev/pandas/issues/46063)) +* Bug in multiplying a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `IntegerDtype` or `FloatingDtype` by an array-like with `timedelta64[ns]` dtype incorrectly raising ([GH 45622](https://github.com/pandas-dev/pandas/issues/45622)) +* Bug in `mean()` where the optional dependency `bottleneck` causes precision loss linear in the length of the array. `bottleneck` has been disabled for `mean()` improving the loss to log-linear but may result in a performance decrease. ([GH 42878](https://github.com/pandas-dev/pandas/issues/42878)) + +### Conversion[#](#conversion "Link to this heading") + +* Bug in [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") not preserving subclasses ([GH 40810](https://github.com/pandas-dev/pandas/issues/40810)) +* Bug in constructing a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") from a float-containing list or a floating-dtype ndarray-like (e.g. `dask.Array`) and an integer dtype raising instead of casting like we would with an `np.ndarray` ([GH 40110](https://github.com/pandas-dev/pandas/issues/40110)) +* Bug in `Float64Index.astype()` to unsigned integer dtype incorrectly casting to `np.int64` dtype ([GH 45309](https://github.com/pandas-dev/pandas/issues/45309)) +* Bug in [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") and [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") from floating dtype to unsigned integer dtype failing to raise in the presence of negative values ([GH 45151](https://github.com/pandas-dev/pandas/issues/45151)) +* Bug in [`array()`](../reference/api/pandas.array.html#pandas.array "pandas.array") with `FloatingDtype` and values containing float-castable strings incorrectly raising ([GH 45424](https://github.com/pandas-dev/pandas/issues/45424)) +* Bug when comparing string and datetime64ns objects causing `OverflowError` exception. ([GH 45506](https://github.com/pandas-dev/pandas/issues/45506)) +* Bug in metaclass of generic abstract dtypes causing [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") and [`Series.apply()`](../reference/api/pandas.Series.apply.html#pandas.Series.apply "pandas.Series.apply") to raise for the built-in function `type` ([GH 46684](https://github.com/pandas-dev/pandas/issues/46684)) +* Bug in [`DataFrame.to_records()`](../reference/api/pandas.DataFrame.to_records.html#pandas.DataFrame.to_records "pandas.DataFrame.to_records") returning inconsistent numpy types if the index was a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 47263](https://github.com/pandas-dev/pandas/issues/47263)) +* Bug in [`DataFrame.to_dict()`](../reference/api/pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict") for `orient="list"` or `orient="index"` was not returning native types ([GH 46751](https://github.com/pandas-dev/pandas/issues/46751)) +* Bug in [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") that returns a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") instead of a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") when applied to an empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and `axis=1` ([GH 39111](https://github.com/pandas-dev/pandas/issues/39111)) +* Bug when inferring the dtype from an iterable that is *not* a NumPy `ndarray` consisting of all NumPy unsigned integer scalars did not result in an unsigned integer dtype ([GH 47294](https://github.com/pandas-dev/pandas/issues/47294)) +* Bug in [`DataFrame.eval()`](../reference/api/pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval") when pandas objects (e.g. `'Timestamp'`) were column names ([GH 44603](https://github.com/pandas-dev/pandas/issues/44603)) + +### Strings[#](#strings "Link to this heading") + +* Bug in [`str.startswith()`](https://docs.python.org/3/library/stdtypes.html#str.startswith "(in Python v3.13)") and [`str.endswith()`](https://docs.python.org/3/library/stdtypes.html#str.endswith "(in Python v3.13)") when using other series as parameter \_pat\_. Now raises `TypeError` ([GH 3485](https://github.com/pandas-dev/pandas/issues/3485)) +* Bug in [`Series.str.zfill()`](../reference/api/pandas.Series.str.zfill.html#pandas.Series.str.zfill "pandas.Series.str.zfill") when strings contain leading signs, padding ‘0’ before the sign character rather than after as `str.zfill` from standard library ([GH 20868](https://github.com/pandas-dev/pandas/issues/20868)) + +### Interval[#](#interval "Link to this heading") + +* Bug in `IntervalArray.__setitem__()` when setting `np.nan` into an integer-backed array raising `ValueError` instead of `TypeError` ([GH 45484](https://github.com/pandas-dev/pandas/issues/45484)) +* Bug in [`IntervalDtype`](../reference/api/pandas.IntervalDtype.html#pandas.IntervalDtype "pandas.IntervalDtype") when using datetime64[ns, tz] as a dtype string ([GH 46999](https://github.com/pandas-dev/pandas/issues/46999)) + +### Indexing[#](#indexing "Link to this heading") + +* Bug in [`DataFrame.iloc()`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") where indexing a single row on a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a single ExtensionDtype column gave a copy instead of a view on the underlying data ([GH 45241](https://github.com/pandas-dev/pandas/issues/45241)) +* Bug in `DataFrame.__getitem__()` returning copy when [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") has duplicated columns even if a unique column is selected ([GH 45316](https://github.com/pandas-dev/pandas/issues/45316), [GH 41062](https://github.com/pandas-dev/pandas/issues/41062)) +* Bug in [`Series.align()`](../reference/api/pandas.Series.align.html#pandas.Series.align "pandas.Series.align") does not create [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") with union of levels when both MultiIndexes intersections are identical ([GH 45224](https://github.com/pandas-dev/pandas/issues/45224)) +* Bug in setting a NA value (`None` or `np.nan`) into a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with int-based [`IntervalDtype`](../reference/api/pandas.IntervalDtype.html#pandas.IntervalDtype "pandas.IntervalDtype") incorrectly casting to object dtype instead of a float-based [`IntervalDtype`](../reference/api/pandas.IntervalDtype.html#pandas.IntervalDtype "pandas.IntervalDtype") ([GH 45568](https://github.com/pandas-dev/pandas/issues/45568)) +* Bug in indexing setting values into an `ExtensionDtype` column with `df.iloc[:, i] = values` with `values` having the same dtype as `df.iloc[:, i]` incorrectly inserting a new array instead of setting in-place ([GH 33457](https://github.com/pandas-dev/pandas/issues/33457)) +* Bug in `Series.__setitem__()` with a non-integer [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") when using an integer key to set a value that cannot be set inplace where a `ValueError` was raised instead of casting to a common dtype ([GH 45070](https://github.com/pandas-dev/pandas/issues/45070)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") not casting `None` to `NA` when setting value as a list into [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 47987](https://github.com/pandas-dev/pandas/issues/47987)) +* Bug in `Series.__setitem__()` when setting incompatible values into a `PeriodDtype` or `IntervalDtype` [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") raising when indexing with a boolean mask but coercing when indexing with otherwise-equivalent indexers; these now consistently coerce, along with [`Series.mask()`](../reference/api/pandas.Series.mask.html#pandas.Series.mask "pandas.Series.mask") and [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where") ([GH 45768](https://github.com/pandas-dev/pandas/issues/45768)) +* Bug in [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where") with multiple columns with datetime-like dtypes failing to downcast results consistent with other dtypes ([GH 45837](https://github.com/pandas-dev/pandas/issues/45837)) +* Bug in `isin()` upcasting to `float64` with unsigned integer dtype and list-like argument without a dtype ([GH 46485](https://github.com/pandas-dev/pandas/issues/46485)) +* Bug in `Series.loc.__setitem__()` and `Series.loc.__getitem__()` not raising when using multiple keys without using a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 13831](https://github.com/pandas-dev/pandas/issues/13831)) +* Bug in [`Index.reindex()`](../reference/api/pandas.Index.reindex.html#pandas.Index.reindex "pandas.Index.reindex") raising `AssertionError` when `level` was specified but no [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") was given; level is ignored now ([GH 35132](https://github.com/pandas-dev/pandas/issues/35132)) +* Bug when setting a value too large for a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") dtype failing to coerce to a common type ([GH 26049](https://github.com/pandas-dev/pandas/issues/26049), [GH 32878](https://github.com/pandas-dev/pandas/issues/32878)) +* Bug in `loc.__setitem__()` treating `range` keys as positional instead of label-based ([GH 45479](https://github.com/pandas-dev/pandas/issues/45479)) +* Bug in `DataFrame.__setitem__()` casting extension array dtypes to object when setting with a scalar key and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") as value ([GH 46896](https://github.com/pandas-dev/pandas/issues/46896)) +* Bug in `Series.__setitem__()` when setting a scalar to a nullable pandas dtype would not raise a `TypeError` if the scalar could not be cast (losslessly) to the nullable type ([GH 45404](https://github.com/pandas-dev/pandas/issues/45404)) +* Bug in `Series.__setitem__()` when setting `boolean` dtype values containing `NA` incorrectly raising instead of casting to `boolean` dtype ([GH 45462](https://github.com/pandas-dev/pandas/issues/45462)) +* Bug in [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") raising with boolean indexer containing `NA` when [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") did not match ([GH 46551](https://github.com/pandas-dev/pandas/issues/46551)) +* Bug in `Series.__setitem__()` where setting [`NA`](../reference/api/pandas.NA.html#pandas.NA "pandas.NA") into a numeric-dtype [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") would incorrectly upcast to object-dtype rather than treating the value as `np.nan` ([GH 44199](https://github.com/pandas-dev/pandas/issues/44199)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") when setting values to a column and right hand side is a dictionary ([GH 47216](https://github.com/pandas-dev/pandas/issues/47216)) +* Bug in `Series.__setitem__()` with `datetime64[ns]` dtype, an all-`False` boolean mask, and an incompatible value incorrectly casting to `object` instead of retaining `datetime64[ns]` dtype ([GH 45967](https://github.com/pandas-dev/pandas/issues/45967)) +* Bug in `Index.__getitem__()` raising `ValueError` when indexer is from boolean dtype with `NA` ([GH 45806](https://github.com/pandas-dev/pandas/issues/45806)) +* Bug in `Series.__setitem__()` losing precision when enlarging [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with scalar ([GH 32346](https://github.com/pandas-dev/pandas/issues/32346)) +* Bug in [`Series.mask()`](../reference/api/pandas.Series.mask.html#pandas.Series.mask "pandas.Series.mask") with `inplace=True` or setting values with a boolean mask with small integer dtypes incorrectly raising ([GH 45750](https://github.com/pandas-dev/pandas/issues/45750)) +* Bug in [`DataFrame.mask()`](../reference/api/pandas.DataFrame.mask.html#pandas.DataFrame.mask "pandas.DataFrame.mask") with `inplace=True` and `ExtensionDtype` columns incorrectly raising ([GH 45577](https://github.com/pandas-dev/pandas/issues/45577)) +* Bug in getting a column from a DataFrame with an object-dtype row index with datetime-like values: the resulting Series now preserves the exact object-dtype Index from the parent DataFrame ([GH 42950](https://github.com/pandas-dev/pandas/issues/42950)) +* Bug in `DataFrame.__getattribute__()` raising `AttributeError` if columns have `"string"` dtype ([GH 46185](https://github.com/pandas-dev/pandas/issues/46185)) +* Bug in [`DataFrame.compare()`](../reference/api/pandas.DataFrame.compare.html#pandas.DataFrame.compare "pandas.DataFrame.compare") returning all `NaN` column when comparing extension array dtype and numpy dtype ([GH 44014](https://github.com/pandas-dev/pandas/issues/44014)) +* Bug in [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where") setting wrong values with `"boolean"` mask for numpy dtype ([GH 44014](https://github.com/pandas-dev/pandas/issues/44014)) +* Bug in indexing on a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with a `np.str_` key incorrectly raising ([GH 45580](https://github.com/pandas-dev/pandas/issues/45580)) +* Bug in `CategoricalIndex.get_indexer()` when index contains `NaN` values, resulting in elements that are in target but not present in the index to be mapped to the index of the NaN element, instead of -1 ([GH 45361](https://github.com/pandas-dev/pandas/issues/45361)) +* Bug in setting large integer values into [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `float32` or `float16` dtype incorrectly altering these values instead of coercing to `float64` dtype ([GH 45844](https://github.com/pandas-dev/pandas/issues/45844)) +* Bug in [`Series.asof()`](../reference/api/pandas.Series.asof.html#pandas.Series.asof "pandas.Series.asof") and [`DataFrame.asof()`](../reference/api/pandas.DataFrame.asof.html#pandas.DataFrame.asof "pandas.DataFrame.asof") incorrectly casting bool-dtype results to `float64` dtype ([GH 16063](https://github.com/pandas-dev/pandas/issues/16063)) +* Bug in `NDFrame.xs()`, [`DataFrame.iterrows()`](../reference/api/pandas.DataFrame.iterrows.html#pandas.DataFrame.iterrows "pandas.DataFrame.iterrows"), [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") and [`DataFrame.iloc()`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") not always propagating metadata ([GH 28283](https://github.com/pandas-dev/pandas/issues/28283)) +* Bug in [`DataFrame.sum()`](../reference/api/pandas.DataFrame.sum.html#pandas.DataFrame.sum "pandas.DataFrame.sum") min\_count changes dtype if input contains NaNs ([GH 46947](https://github.com/pandas-dev/pandas/issues/46947)) +* Bug in `IntervalTree` that lead to an infinite recursion. ([GH 46658](https://github.com/pandas-dev/pandas/issues/46658)) +* Bug in [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") raising `AttributeError` when indexing on `NA`, rather than putting `NaT` in its place. ([GH 46673](https://github.com/pandas-dev/pandas/issues/46673)) +* Bug in [`DataFrame.at()`](../reference/api/pandas.DataFrame.at.html#pandas.DataFrame.at "pandas.DataFrame.at") would allow the modification of multiple columns ([GH 48296](https://github.com/pandas-dev/pandas/issues/48296)) + +### Missing[#](#missing "Link to this heading") + +* Bug in [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") and [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") with `downcast` keyword not being respected in some cases where there are no NA values present ([GH 45423](https://github.com/pandas-dev/pandas/issues/45423)) +* Bug in [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") and [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") with [`IntervalDtype`](../reference/api/pandas.IntervalDtype.html#pandas.IntervalDtype "pandas.IntervalDtype") and incompatible value raising instead of casting to a common (usually object) dtype ([GH 45796](https://github.com/pandas-dev/pandas/issues/45796)) +* Bug in [`Series.map()`](../reference/api/pandas.Series.map.html#pandas.Series.map "pandas.Series.map") not respecting `na_action` argument if mapper is a `dict` or [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") ([GH 47527](https://github.com/pandas-dev/pandas/issues/47527)) +* Bug in [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") with object-dtype column not returning a copy with `inplace=False` ([GH 45791](https://github.com/pandas-dev/pandas/issues/45791)) +* Bug in [`DataFrame.dropna()`](../reference/api/pandas.DataFrame.dropna.html#pandas.DataFrame.dropna "pandas.DataFrame.dropna") allows to set both `how` and `thresh` incompatible arguments ([GH 46575](https://github.com/pandas-dev/pandas/issues/46575)) +* Bug in [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") ignored `axis` when [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") is single block ([GH 47713](https://github.com/pandas-dev/pandas/issues/47713)) + +### MultiIndex[#](#multiindex "Link to this heading") + +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") returning empty result when slicing a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") with a negative step size and non-null start/stop values ([GH 46156](https://github.com/pandas-dev/pandas/issues/46156)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") raising when slicing a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") with a negative step size other than -1 ([GH 46156](https://github.com/pandas-dev/pandas/issues/46156)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") raising when slicing a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") with a negative step size and slicing a non-int labeled index level ([GH 46156](https://github.com/pandas-dev/pandas/issues/46156)) +* Bug in [`Series.to_numpy()`](../reference/api/pandas.Series.to_numpy.html#pandas.Series.to_numpy "pandas.Series.to_numpy") where multiindexed Series could not be converted to numpy arrays when an `na_value` was supplied ([GH 45774](https://github.com/pandas-dev/pandas/issues/45774)) +* Bug in `MultiIndex.equals` not commutative when only one side has extension array dtype ([GH 46026](https://github.com/pandas-dev/pandas/issues/46026)) +* Bug in [`MultiIndex.from_tuples()`](../reference/api/pandas.MultiIndex.from_tuples.html#pandas.MultiIndex.from_tuples "pandas.MultiIndex.from_tuples") cannot construct Index of empty tuples ([GH 45608](https://github.com/pandas-dev/pandas/issues/45608)) + +### I/O[#](#i-o "Link to this heading") + +* Bug in [`DataFrame.to_stata()`](../reference/api/pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata") where no error is raised if the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") contains `-np.inf` ([GH 45350](https://github.com/pandas-dev/pandas/issues/45350)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") results in an infinite loop with certain `skiprows` callables ([GH 45585](https://github.com/pandas-dev/pandas/issues/45585)) +* Bug in [`DataFrame.info()`](../reference/api/pandas.DataFrame.info.html#pandas.DataFrame.info "pandas.DataFrame.info") where a new line at the end of the output is omitted when called on an empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 45494](https://github.com/pandas-dev/pandas/issues/45494)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") not recognizing line break for `on_bad_lines="warn"` for `engine="c"` ([GH 41710](https://github.com/pandas-dev/pandas/issues/41710)) +* Bug in [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") not respecting `float_format` for `Float64` dtype ([GH 45991](https://github.com/pandas-dev/pandas/issues/45991)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") not respecting a specified converter to index columns in all cases ([GH 40589](https://github.com/pandas-dev/pandas/issues/40589)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") interpreting second row as [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") names even when `index_col=False` ([GH 46569](https://github.com/pandas-dev/pandas/issues/46569)) +* Bug in [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") when `engine="pyarrow"` which caused partial write to disk when column of unsupported datatype was passed ([GH 44914](https://github.com/pandas-dev/pandas/issues/44914)) +* Bug in [`DataFrame.to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel") and [`ExcelWriter`](../reference/api/pandas.ExcelWriter.html#pandas.ExcelWriter "pandas.ExcelWriter") would raise when writing an empty DataFrame to a `.ods` file ([GH 45793](https://github.com/pandas-dev/pandas/issues/45793)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") ignoring non-existing header row for `engine="python"` ([GH 47400](https://github.com/pandas-dev/pandas/issues/47400)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") raising uncontrolled `IndexError` when `header` references non-existing rows ([GH 43143](https://github.com/pandas-dev/pandas/issues/43143)) +* Bug in [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") where elements surrounding `
` were joined without a space between them ([GH 29528](https://github.com/pandas-dev/pandas/issues/29528)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") when data is longer than header leading to issues with callables in `usecols` expecting strings ([GH 46997](https://github.com/pandas-dev/pandas/issues/46997)) +* Bug in Parquet roundtrip for Interval dtype with `datetime64[ns]` subtype ([GH 45881](https://github.com/pandas-dev/pandas/issues/45881)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") when reading a `.ods` file with newlines between xml elements ([GH 45598](https://github.com/pandas-dev/pandas/issues/45598)) +* Bug in [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") when `engine="fastparquet"` where the file was not closed on error ([GH 46555](https://github.com/pandas-dev/pandas/issues/46555)) +* [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") now excludes the `border` attribute from `` elements when `border` keyword is set to `False`. +* Bug in [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") with certain types of compressed SAS7BDAT files ([GH 35545](https://github.com/pandas-dev/pandas/issues/35545)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") not forward filling [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") when no names were given ([GH 47487](https://github.com/pandas-dev/pandas/issues/47487)) +* Bug in [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") returned `None` rather than an empty DataFrame for SAS7BDAT files with zero rows ([GH 18198](https://github.com/pandas-dev/pandas/issues/18198)) +* Bug in [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string") using wrong missing value with extension arrays in [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 47986](https://github.com/pandas-dev/pandas/issues/47986)) +* Bug in `StataWriter` where value labels were always written with default encoding ([GH 46750](https://github.com/pandas-dev/pandas/issues/46750)) +* Bug in `StataWriterUTF8` where some valid characters were removed from variable names ([GH 47276](https://github.com/pandas-dev/pandas/issues/47276)) +* Bug in [`DataFrame.to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel") when writing an empty dataframe with [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 19543](https://github.com/pandas-dev/pandas/issues/19543)) +* Bug in [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") with RLE-compressed SAS7BDAT files that contain 0x40 control bytes ([GH 31243](https://github.com/pandas-dev/pandas/issues/31243)) +* Bug in [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") that scrambled column names ([GH 31243](https://github.com/pandas-dev/pandas/issues/31243)) +* Bug in [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") with RLE-compressed SAS7BDAT files that contain 0x00 control bytes ([GH 47099](https://github.com/pandas-dev/pandas/issues/47099)) +* Bug in [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") with `use_nullable_dtypes=True` where `float64` dtype was returned instead of nullable `Float64` dtype ([GH 45694](https://github.com/pandas-dev/pandas/issues/45694)) +* Bug in [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") where `PeriodDtype` would not make the serialization roundtrip when read back with [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") ([GH 44720](https://github.com/pandas-dev/pandas/issues/44720)) +* Bug in [`read_xml()`](../reference/api/pandas.read_xml.html#pandas.read_xml "pandas.read_xml") when reading XML files with Chinese character tags and would raise `XMLSyntaxError` ([GH 47902](https://github.com/pandas-dev/pandas/issues/47902)) + +### Period[#](#period "Link to this heading") + +* Bug in subtraction of [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") from [`PeriodArray`](../reference/api/pandas.arrays.PeriodArray.html#pandas.arrays.PeriodArray "pandas.arrays.PeriodArray") returning wrong results ([GH 45999](https://github.com/pandas-dev/pandas/issues/45999)) +* Bug in [`Period.strftime()`](../reference/api/pandas.Period.strftime.html#pandas.Period.strftime "pandas.Period.strftime") and [`PeriodIndex.strftime()`](../reference/api/pandas.PeriodIndex.strftime.html#pandas.PeriodIndex.strftime "pandas.PeriodIndex.strftime"), directives `%l` and `%u` were giving wrong results ([GH 46252](https://github.com/pandas-dev/pandas/issues/46252)) +* Bug in inferring an incorrect `freq` when passing a string to [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") microseconds that are a multiple of 1000 ([GH 46811](https://github.com/pandas-dev/pandas/issues/46811)) +* Bug in constructing a [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") from a [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") or `np.datetime64` object with non-zero nanoseconds and `freq="ns"` incorrectly truncating the nanoseconds ([GH 46811](https://github.com/pandas-dev/pandas/issues/46811)) +* Bug in adding `np.timedelta64("NaT", "ns")` to a [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") with a timedelta-like freq incorrectly raising `IncompatibleFrequency` instead of returning `NaT` ([GH 47196](https://github.com/pandas-dev/pandas/issues/47196)) +* Bug in adding an array of integers to an array with [`PeriodDtype`](../reference/api/pandas.PeriodDtype.html#pandas.PeriodDtype "pandas.PeriodDtype") giving incorrect results when `dtype.freq.n > 1` ([GH 47209](https://github.com/pandas-dev/pandas/issues/47209)) +* Bug in subtracting a [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") from an array with [`PeriodDtype`](../reference/api/pandas.PeriodDtype.html#pandas.PeriodDtype "pandas.PeriodDtype") returning incorrect results instead of raising `OverflowError` when the operation overflows ([GH 47538](https://github.com/pandas-dev/pandas/issues/47538)) + +### Plotting[#](#plotting "Link to this heading") + +* Bug in [`DataFrame.plot.barh()`](../reference/api/pandas.DataFrame.plot.barh.html#pandas.DataFrame.plot.barh "pandas.DataFrame.plot.barh") that prevented labeling the x-axis and `xlabel` updating the y-axis label ([GH 45144](https://github.com/pandas-dev/pandas/issues/45144)) +* Bug in [`DataFrame.plot.box()`](../reference/api/pandas.DataFrame.plot.box.html#pandas.DataFrame.plot.box "pandas.DataFrame.plot.box") that prevented labeling the x-axis ([GH 45463](https://github.com/pandas-dev/pandas/issues/45463)) +* Bug in [`DataFrame.boxplot()`](../reference/api/pandas.DataFrame.boxplot.html#pandas.DataFrame.boxplot "pandas.DataFrame.boxplot") that prevented passing in `xlabel` and `ylabel` ([GH 45463](https://github.com/pandas-dev/pandas/issues/45463)) +* Bug in [`DataFrame.boxplot()`](../reference/api/pandas.DataFrame.boxplot.html#pandas.DataFrame.boxplot "pandas.DataFrame.boxplot") that prevented specifying `vert=False` ([GH 36918](https://github.com/pandas-dev/pandas/issues/36918)) +* Bug in [`DataFrame.plot.scatter()`](../reference/api/pandas.DataFrame.plot.scatter.html#pandas.DataFrame.plot.scatter "pandas.DataFrame.plot.scatter") that prevented specifying `norm` ([GH 45809](https://github.com/pandas-dev/pandas/issues/45809)) +* Fix showing “None” as ylabel in [`Series.plot()`](../reference/api/pandas.Series.plot.html#pandas.Series.plot "pandas.Series.plot") when not setting ylabel ([GH 46129](https://github.com/pandas-dev/pandas/issues/46129)) +* Bug in [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") that led to xticks and vertical grids being improperly placed when plotting a quarterly series ([GH 47602](https://github.com/pandas-dev/pandas/issues/47602)) +* Bug in [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") that prevented setting y-axis label, limits and ticks for a secondary y-axis ([GH 47753](https://github.com/pandas-dev/pandas/issues/47753)) + +### Groupby/resample/rolling[#](#groupby-resample-rolling "Link to this heading") + +* Bug in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") ignoring `closed="right"` on [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") ([GH 45414](https://github.com/pandas-dev/pandas/issues/45414)) +* Bug in [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") fails when `func="size"` and the input DataFrame has multiple columns ([GH 27469](https://github.com/pandas-dev/pandas/issues/27469)) +* Bug in [`DataFrameGroupBy.size()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.size.html#pandas.core.groupby.DataFrameGroupBy.size "pandas.core.groupby.DataFrameGroupBy.size") and [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") with `func="size"` produced incorrect results when `axis=1` ([GH 45715](https://github.com/pandas-dev/pandas/issues/45715)) +* Bug in [`ExponentialMovingWindow.mean()`](../reference/api/pandas.core.window.ewm.ExponentialMovingWindow.mean.html#pandas.core.window.ewm.ExponentialMovingWindow.mean "pandas.core.window.ewm.ExponentialMovingWindow.mean") with `axis=1` and `engine='numba'` when the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") has more columns than rows ([GH 46086](https://github.com/pandas-dev/pandas/issues/46086)) +* Bug when using `engine="numba"` would return the same jitted function when modifying `engine_kwargs` ([GH 46086](https://github.com/pandas-dev/pandas/issues/46086)) +* Bug in [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") fails when `axis=1` and `func` is `"first"` or `"last"` ([GH 45986](https://github.com/pandas-dev/pandas/issues/45986)) +* Bug in [`DataFrameGroupBy.cumsum()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cumsum.html#pandas.core.groupby.DataFrameGroupBy.cumsum "pandas.core.groupby.DataFrameGroupBy.cumsum") with `skipna=False` giving incorrect results ([GH 46216](https://github.com/pandas-dev/pandas/issues/46216)) +* Bug in [`DataFrameGroupBy.sum()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.sum.html#pandas.core.groupby.DataFrameGroupBy.sum "pandas.core.groupby.DataFrameGroupBy.sum"), [`SeriesGroupBy.sum()`](../reference/api/pandas.core.groupby.SeriesGroupBy.sum.html#pandas.core.groupby.SeriesGroupBy.sum "pandas.core.groupby.SeriesGroupBy.sum"), [`DataFrameGroupBy.prod()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.prod.html#pandas.core.groupby.DataFrameGroupBy.prod "pandas.core.groupby.DataFrameGroupBy.prod"), `SeriesGroupBy.prod, :meth:()`.DataFrameGroupBy.cumsum`, and [`SeriesGroupBy.cumsum()`](../reference/api/pandas.core.groupby.SeriesGroupBy.cumsum.html#pandas.core.groupby.SeriesGroupBy.cumsum "pandas.core.groupby.SeriesGroupBy.cumsum") with integer dtypes losing precision ([GH 37493](https://github.com/pandas-dev/pandas/issues/37493)) +* Bug in [`DataFrameGroupBy.cumsum()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cumsum.html#pandas.core.groupby.DataFrameGroupBy.cumsum "pandas.core.groupby.DataFrameGroupBy.cumsum") and [`SeriesGroupBy.cumsum()`](../reference/api/pandas.core.groupby.SeriesGroupBy.cumsum.html#pandas.core.groupby.SeriesGroupBy.cumsum "pandas.core.groupby.SeriesGroupBy.cumsum") with `timedelta64[ns]` dtype failing to recognize `NaT` as a null value ([GH 46216](https://github.com/pandas-dev/pandas/issues/46216)) +* Bug in [`DataFrameGroupBy.cumsum()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cumsum.html#pandas.core.groupby.DataFrameGroupBy.cumsum "pandas.core.groupby.DataFrameGroupBy.cumsum") and [`SeriesGroupBy.cumsum()`](../reference/api/pandas.core.groupby.SeriesGroupBy.cumsum.html#pandas.core.groupby.SeriesGroupBy.cumsum "pandas.core.groupby.SeriesGroupBy.cumsum") with integer dtypes causing overflows when sum was bigger than maximum of dtype ([GH 37493](https://github.com/pandas-dev/pandas/issues/37493)) +* Bug in [`DataFrameGroupBy.cummin()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cummin.html#pandas.core.groupby.DataFrameGroupBy.cummin "pandas.core.groupby.DataFrameGroupBy.cummin"), [`SeriesGroupBy.cummin()`](../reference/api/pandas.core.groupby.SeriesGroupBy.cummin.html#pandas.core.groupby.SeriesGroupBy.cummin "pandas.core.groupby.SeriesGroupBy.cummin"), [`DataFrameGroupBy.cummax()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cummax.html#pandas.core.groupby.DataFrameGroupBy.cummax "pandas.core.groupby.DataFrameGroupBy.cummax") and [`SeriesGroupBy.cummax()`](../reference/api/pandas.core.groupby.SeriesGroupBy.cummax.html#pandas.core.groupby.SeriesGroupBy.cummax "pandas.core.groupby.SeriesGroupBy.cummax") with nullable dtypes incorrectly altering the original data in place ([GH 46220](https://github.com/pandas-dev/pandas/issues/46220)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") raising error when `None` is in first level of [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 47348](https://github.com/pandas-dev/pandas/issues/47348)) +* Bug in [`DataFrameGroupBy.cummax()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cummax.html#pandas.core.groupby.DataFrameGroupBy.cummax "pandas.core.groupby.DataFrameGroupBy.cummax") and [`SeriesGroupBy.cummax()`](../reference/api/pandas.core.groupby.SeriesGroupBy.cummax.html#pandas.core.groupby.SeriesGroupBy.cummax "pandas.core.groupby.SeriesGroupBy.cummax") with `int64` dtype with leading value being the smallest possible int64 ([GH 46382](https://github.com/pandas-dev/pandas/issues/46382)) +* Bug in [`DataFrameGroupBy.cumprod()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cumprod.html#pandas.core.groupby.DataFrameGroupBy.cumprod "pandas.core.groupby.DataFrameGroupBy.cumprod") and [`SeriesGroupBy.cumprod()`](../reference/api/pandas.core.groupby.SeriesGroupBy.cumprod.html#pandas.core.groupby.SeriesGroupBy.cumprod "pandas.core.groupby.SeriesGroupBy.cumprod") `NaN` influences calculation in different columns with `skipna=False` ([GH 48064](https://github.com/pandas-dev/pandas/issues/48064)) +* Bug in [`DataFrameGroupBy.max()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.max.html#pandas.core.groupby.DataFrameGroupBy.max "pandas.core.groupby.DataFrameGroupBy.max") and [`SeriesGroupBy.max()`](../reference/api/pandas.core.groupby.SeriesGroupBy.max.html#pandas.core.groupby.SeriesGroupBy.max "pandas.core.groupby.SeriesGroupBy.max") with empty groups and `uint64` dtype incorrectly raising `RuntimeError` ([GH 46408](https://github.com/pandas-dev/pandas/issues/46408)) +* Bug in [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") and [`SeriesGroupBy.apply()`](../reference/api/pandas.core.groupby.SeriesGroupBy.apply.html#pandas.core.groupby.SeriesGroupBy.apply "pandas.core.groupby.SeriesGroupBy.apply") would fail when `func` was a string and args or kwargs were supplied ([GH 46479](https://github.com/pandas-dev/pandas/issues/46479)) +* Bug in `SeriesGroupBy.apply()` would incorrectly name its result when there was a unique group ([GH 46369](https://github.com/pandas-dev/pandas/issues/46369)) +* Bug in [`Rolling.sum()`](../reference/api/pandas.core.window.rolling.Rolling.sum.html#pandas.core.window.rolling.Rolling.sum "pandas.core.window.rolling.Rolling.sum") and [`Rolling.mean()`](../reference/api/pandas.core.window.rolling.Rolling.mean.html#pandas.core.window.rolling.Rolling.mean "pandas.core.window.rolling.Rolling.mean") would give incorrect result with window of same values ([GH 42064](https://github.com/pandas-dev/pandas/issues/42064), [GH 46431](https://github.com/pandas-dev/pandas/issues/46431)) +* Bug in [`Rolling.var()`](../reference/api/pandas.core.window.rolling.Rolling.var.html#pandas.core.window.rolling.Rolling.var "pandas.core.window.rolling.Rolling.var") and [`Rolling.std()`](../reference/api/pandas.core.window.rolling.Rolling.std.html#pandas.core.window.rolling.Rolling.std "pandas.core.window.rolling.Rolling.std") would give non-zero result with window of same values ([GH 42064](https://github.com/pandas-dev/pandas/issues/42064)) +* Bug in [`Rolling.skew()`](../reference/api/pandas.core.window.rolling.Rolling.skew.html#pandas.core.window.rolling.Rolling.skew "pandas.core.window.rolling.Rolling.skew") and [`Rolling.kurt()`](../reference/api/pandas.core.window.rolling.Rolling.kurt.html#pandas.core.window.rolling.Rolling.kurt "pandas.core.window.rolling.Rolling.kurt") would give NaN with window of same values ([GH 30993](https://github.com/pandas-dev/pandas/issues/30993)) +* Bug in [`Rolling.var()`](../reference/api/pandas.core.window.rolling.Rolling.var.html#pandas.core.window.rolling.Rolling.var "pandas.core.window.rolling.Rolling.var") would segfault calculating weighted variance when window size was larger than data size ([GH 46760](https://github.com/pandas-dev/pandas/issues/46760)) +* Bug in `Grouper.__repr__()` where `dropna` was not included. Now it is ([GH 46754](https://github.com/pandas-dev/pandas/issues/46754)) +* Bug in [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") gives ValueError when center=True, axis=1 and win\_type is specified ([GH 46135](https://github.com/pandas-dev/pandas/issues/46135)) +* Bug in [`DataFrameGroupBy.describe()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.describe.html#pandas.core.groupby.DataFrameGroupBy.describe "pandas.core.groupby.DataFrameGroupBy.describe") and [`SeriesGroupBy.describe()`](../reference/api/pandas.core.groupby.SeriesGroupBy.describe.html#pandas.core.groupby.SeriesGroupBy.describe "pandas.core.groupby.SeriesGroupBy.describe") produces inconsistent results for empty datasets ([GH 41575](https://github.com/pandas-dev/pandas/issues/41575)) +* Bug in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") reduction methods when used with `on` would attempt to aggregate the provided column ([GH 47079](https://github.com/pandas-dev/pandas/issues/47079)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") and [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") would not respect `dropna=False` when the input DataFrame/Series had a NaN values in a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 46783](https://github.com/pandas-dev/pandas/issues/46783)) +* Bug in `DataFrameGroupBy.resample()` raises `KeyError` when getting the result from a key list which misses the resample key ([GH 47362](https://github.com/pandas-dev/pandas/issues/47362)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") would lose index columns when the DataFrame is empty for transforms, like fillna ([GH 47787](https://github.com/pandas-dev/pandas/issues/47787)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") and [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") with `dropna=False` and `sort=False` would put any null groups at the end instead the order that they are encountered ([GH 46584](https://github.com/pandas-dev/pandas/issues/46584)) + +### Reshaping[#](#reshaping "Link to this heading") + +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") between a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with integer dtype and another with [`CategoricalDtype`](../reference/api/pandas.CategoricalDtype.html#pandas.CategoricalDtype "pandas.CategoricalDtype") with integer categories and containing `NaN` values casting to object dtype instead of `float64` ([GH 45359](https://github.com/pandas-dev/pandas/issues/45359)) +* Bug in [`get_dummies()`](../reference/api/pandas.get_dummies.html#pandas.get_dummies "pandas.get_dummies") that selected object and categorical dtypes but not string ([GH 44965](https://github.com/pandas-dev/pandas/issues/44965)) +* Bug in [`DataFrame.align()`](../reference/api/pandas.DataFrame.align.html#pandas.DataFrame.align "pandas.DataFrame.align") when aligning a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") to a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with another [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 46001](https://github.com/pandas-dev/pandas/issues/46001)) +* Bug in concatenation with `IntegerDtype`, or `FloatingDtype` arrays where the resulting dtype did not mirror the behavior of the non-nullable dtypes ([GH 46379](https://github.com/pandas-dev/pandas/issues/46379)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") losing dtype of columns when `join="outer"` and `sort=True` ([GH 47329](https://github.com/pandas-dev/pandas/issues/47329)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") not sorting the column names when `None` is included ([GH 47331](https://github.com/pandas-dev/pandas/issues/47331)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") with identical key leads to error when indexing [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 46519](https://github.com/pandas-dev/pandas/issues/46519)) +* Bug in [`pivot_table()`](../reference/api/pandas.pivot_table.html#pandas.pivot_table "pandas.pivot_table") raising `TypeError` when `dropna=True` and aggregation column has extension array dtype ([GH 47477](https://github.com/pandas-dev/pandas/issues/47477)) +* Bug in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") raising error for `how="cross"` when using `FIPS` mode in ssl library ([GH 48024](https://github.com/pandas-dev/pandas/issues/48024)) +* Bug in [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") with a list when using suffixes to join DataFrames with duplicate column names ([GH 46396](https://github.com/pandas-dev/pandas/issues/46396)) +* Bug in [`DataFrame.pivot_table()`](../reference/api/pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table") with `sort=False` results in sorted index ([GH 17041](https://github.com/pandas-dev/pandas/issues/17041)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") when `axis=1` and `sort=False` where the resulting Index was a `Int64Index` instead of a [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") ([GH 46675](https://github.com/pandas-dev/pandas/issues/46675)) +* Bug in [`wide_to_long()`](../reference/api/pandas.wide_to_long.html#pandas.wide_to_long "pandas.wide_to_long") raises when `stubnames` is missing in columns and `i` contains string dtype column ([GH 46044](https://github.com/pandas-dev/pandas/issues/46044)) +* Bug in [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") with categorical index results in unexpected reordering ([GH 47812](https://github.com/pandas-dev/pandas/issues/47812)) + +### Sparse[#](#sparse "Link to this heading") + +* Bug in [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where") and [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where") with `SparseDtype` failing to retain the array’s `fill_value` ([GH 45691](https://github.com/pandas-dev/pandas/issues/45691)) +* Bug in `SparseArray.unique()` fails to keep original elements order ([GH 47809](https://github.com/pandas-dev/pandas/issues/47809)) + +### ExtensionArray[#](#extensionarray "Link to this heading") + +* Bug in `IntegerArray.searchsorted()` and `FloatingArray.searchsorted()` returning inconsistent results when acting on `np.nan` ([GH 45255](https://github.com/pandas-dev/pandas/issues/45255)) + +### Styler[#](#id1 "Link to this heading") + +* Bug when attempting to apply styling functions to an empty DataFrame subset ([GH 45313](https://github.com/pandas-dev/pandas/issues/45313)) +* Bug in `CSSToExcelConverter` leading to `TypeError` when border color provided without border style for `xlsxwriter` engine ([GH 42276](https://github.com/pandas-dev/pandas/issues/42276)) +* Bug in `Styler.set_sticky()` leading to white text on white background in dark mode ([GH 46984](https://github.com/pandas-dev/pandas/issues/46984)) +* Bug in `Styler.to_latex()` causing `UnboundLocalError` when `clines="all;data"` and the `DataFrame` has no rows. ([GH 47203](https://github.com/pandas-dev/pandas/issues/47203)) +* Bug in `Styler.to_excel()` when using `vertical-align: middle;` with `xlsxwriter` engine ([GH 30107](https://github.com/pandas-dev/pandas/issues/30107)) +* Bug when applying styles to a DataFrame with boolean column labels ([GH 47838](https://github.com/pandas-dev/pandas/issues/47838)) + +### Metadata[#](#metadata "Link to this heading") + +* Fixed metadata propagation in [`DataFrame.melt()`](../reference/api/pandas.DataFrame.melt.html#pandas.DataFrame.melt "pandas.DataFrame.melt") ([GH 28283](https://github.com/pandas-dev/pandas/issues/28283)) +* Fixed metadata propagation in [`DataFrame.explode()`](../reference/api/pandas.DataFrame.explode.html#pandas.DataFrame.explode "pandas.DataFrame.explode") ([GH 28283](https://github.com/pandas-dev/pandas/issues/28283)) + +### Other[#](#other "Link to this heading") + +* Bug in [`assert_index_equal()`](../reference/api/pandas.testing.assert_index_equal.html#pandas.testing.assert_index_equal "pandas.testing.assert_index_equal") with `names=True` and `check_order=False` not checking names ([GH 47328](https://github.com/pandas-dev/pandas/issues/47328)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 271 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Aadharsh Acharya + +* Aadharsh-Acharya + +* Aadhi Manivannan + +* Adam Bowden +* Aditya Agarwal + +* Ahmed Ibrahim + +* Alastair Porter + +* Alex Povel + +* Alex-Blade +* Alexandra Sciocchetti + +* AlonMenczer + +* Andras Deak + +* Andrew Hawyrluk +* Andy Grigg + +* Aneta Kahleová + +* Anthony Givans + +* Anton Shevtsov + +* B. J. Potter + +* BarkotBeyene + +* Ben Beasley + +* Ben Wozniak + +* Bernhard Wagner + +* Boris Rumyantsev +* Brian Gollop + +* CCXXXI + +* Chandrasekaran Anirudh Bhardwaj + +* Charles Blackmon-Luca + +* Chris Moradi + +* ChrisAlbertsen + +* Compro Prasad + +* DaPy15 +* Damian Barabonkov + +* Daniel I + +* Daniel Isaac + +* Daniel Schmidt +* Danil Iashchenko + +* Dare Adewumi +* Dennis Chukwunta + +* Dennis J. Gray + +* Derek Sharp + +* Dhruv Samdani + +* Dimitra Karadima + +* Dmitry Savostyanov + +* Dmytro Litvinov + +* Do Young Kim + +* Dries Schaumont + +* Edward Huang + +* Eirik + +* Ekaterina + +* Eli Dourado + +* Ezra Brauner + +* Fabian Gabel + +* FactorizeD + +* Fangchen Li +* Francesco Romandini + +* Greg Gandenberger + +* Guo Ci + +* Hiroaki Ogasawara +* Hood Chatham + +* Ian Alexander Joiner + +* Irv Lustig +* Ivan Ng + +* JHM Darbyshire +* JHM Darbyshire (MBP) +* JHM Darbyshire (iMac) +* JMBurley +* Jack Goldsmith + +* James Freeman + +* James Lamb +* James Moro + +* Janosh Riebesell +* Jarrod Millman +* Jason Jia + +* Jeff Reback +* Jeremy Tuloup + +* Johannes Mueller +* John Bencina + +* John Mantios + +* John Zangwill +* Jon Bramley + +* Jonas Haag +* Jordan Hicks +* Joris Van den Bossche +* Jose Ortiz + +* JosephParampathu + +* José Duarte +* Julian Steger + +* Kai Priester + +* Kapil E. Iyer + +* Karthik Velayutham + +* Kashif Khan +* Kazuki Igeta + +* Kevin Jan Anker + +* Kevin Sheppard +* Khor Chean Wei +* Kian Eliasi +* Kian S + +* Kim, KwonHyun + +* Kinza-Raza + +* Konjeti Maruthi + +* Leonardus Chen +* Linxiao Francis Cong + +* Loïc Estève +* LucasG0 + +* Lucy Jiménez + +* Luis Pinto +* Luke Manley +* Marc Garcia +* Marco Edward Gorelli +* Marco Gorelli +* MarcoGorelli +* Margarete Dippel + +* Mariam-ke + +* Martin Fleischmann +* Marvin John Walter + +* Marvin Walter + +* Mateusz +* Matilda M + +* Matthew Roeschke +* Matthias Bussonnier +* MeeseeksMachine +* Mehgarg + +* Melissa Weber Mendonça + +* Michael Milton + +* Michael Wang +* Mike McCarty + +* Miloni Atal + +* Mitlasóczki Bence + +* Moritz Schreiber + +* Morten Canth Hels + +* Nick Crews + +* NickFillot + +* Nicolas Hug + +* Nima Sarang +* Noa Tamir + +* Pandas Development Team +* Parfait Gasana +* Parthi + +* Partho + +* Patrick Hoefler +* Peter +* Peter Hawkins + +* Philipp A +* Philipp Schaefer + +* Pierrot + +* Pratik Patel + +* Prithvijit +* Purna Chandra Mansingh + +* Radoslaw Lemiec + +* RaphSku + +* Reinert Huseby Karlsen + +* Richard Shadrach +* Richard Shadrach + + +* Robbie Palmer +* Robert de Vries +* Roger + +* Roger Murray + +* Ruizhe Deng + +* SELEE + +* Sachin Yadav + +* Saiwing Yeung + +* Sam Rao + +* Sandro Casagrande + +* Sebastiaan Vermeulen + +* Shaghayegh + +* Shantanu + +* Shashank Shet + +* Shawn Zhong + +* Shuangchi He + +* Simon Hawkins +* Simon Knott + +* Solomon Song + +* Somtochi Umeh + +* Stefan Krawczyk + +* Stefanie Molin +* Steffen Rehberg +* Steven Bamford + +* Steven Rotondo + +* Steven Schaerer +* Sylvain MARIE + +* Sylvain Marié +* Tarun Raghunandan Kaushik + +* Taylor Packard + +* Terji Petersen +* Thierry Moisan +* Thomas Grainger +* Thomas Hunter + +* Thomas Li +* Tim McFarland + +* Tim Swast +* Tim Yang + +* Tobias Pitters +* Tom Aarsen + +* Tom Augspurger +* Torsten Wörtwein +* TraverseTowner + +* Tyler Reddy +* Valentin Iovene +* Varun Sharma + +* Vasily Litvinov +* Venaturum +* Vinicius Akira Imaizumi + +* Vladimir Fokow + +* Wenjun Si +* Will Lachance + +* William Andrea +* Wolfgang F. Riedl + +* Xingrong Chen +* Yago González +* Yikun Jiang + +* Yuanhao Geng +* Yuval + +* Zero +* Zhengfei Wang + +* abmyii +* alexondor + +* alm +* andjhall + +* anilbey + +* arnaudlegout + +* asv-bot + +* ateki + +* auderson + +* bherwerth + +* bicarlsen + +* carbonleakage + +* charles + +* charlogazzo + +* code-review-doctor + +* dataxerik + +* deponovo +* dimitra-karadima + +* dospix + +* ehallam + +* ehsan shirvanian + +* ember91 + +* eshirvana +* fractionalhare + +* gaotian98 + +* gesoos +* github-actions[bot] +* gunghub + +* hasan-yaman +* iansheng + +* iasoon + +* jbrockmendel +* joshuabello2550 + +* jyuv + +* kouya takahashi + +* mariana-LJ + +* matt + +* mattB1989 + +* nealxm + +* partev +* poloso + +* realead +* roib20 + +* rtpsw +* ryangilmour + +* shourya5 + +* srotondo + +* stanleycai95 + +* staticdev + +* tehunter + +* theidexisted + +* tobias.pitters + +* uncjackg + +* vernetya +* wany-oh + +* wfr + +* z3c0 + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.5.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.5.1.md new file mode 100644 index 0000000000000000000000000000000000000000..8c25c94bb2ac4bb5cff4be6fee3dec7e10bb94ed --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.5.1.md @@ -0,0 +1,136 @@ +# What's new in pandas 1.5.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.5.1.html + +# What’s new in 1.5.1 (October 19, 2022)[#](#what-s-new-in-1-5-1-october-19-2022 "Link to this heading") + +These are the changes in pandas 1.5.1. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Behavior of `groupby` with categorical groupers ([GH 48645](https://github.com/pandas-dev/pandas/issues/48645))[#](#behavior-of-groupby-with-categorical-groupers-gh-48645 "Link to this heading") + +In versions of pandas prior to 1.5, `groupby` with `dropna=False` would still drop +NA values when the grouper was a categorical dtype. A fix for this was attempted in +1.5, however it introduced a regression where passing `observed=False` and +`dropna=False` to `groupby` would result in only observed categories. It was found +that the patch fixing the `dropna=False` bug is incompatible with `observed=False`, +and decided that the best resolution is to restore the correct `observed=False` +behavior at the cost of reintroducing the `dropna=False` bug. + +```None +In [1]: df = pd.DataFrame( + ...: { + ...: "x": pd.Categorical([1, None], categories=[1, 2, 3]), + ...: "y": [3, 4], + ...: } + ...: ) + ...: + +In [2]: df +Out[2]: + x y +0 1 3 +1 NaN 4 +``` + +*1.5.0 behavior*: + +```None +In [3]: # Correct behavior, NA values are not dropped + df.groupby("x", observed=True, dropna=False).sum() +Out[3]: + y +x +1 3 +NaN 4 + + +In [4]: # Incorrect behavior, only observed categories present + df.groupby("x", observed=False, dropna=False).sum() +Out[4]: + y +x +1 3 +NaN 4 +``` + +*1.5.1 behavior*: + +```None +# Incorrect behavior, NA values are dropped +In [3]: df.groupby("x", observed=True, dropna=False).sum() +Out[3]: + y +x +1 3 +NaN 4 + +# Correct behavior, unobserved categories present (NA values still dropped) +In [4]: df.groupby("x", observed=False, dropna=False).sum() +Out[4]: + y +x +1 3 +2 0 +3 0 +NaN 4 +``` + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed Regression in `Series.__setitem__()` casting `None` to `NaN` for object dtype ([GH 48665](https://github.com/pandas-dev/pandas/issues/48665)) +* Fixed Regression in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") when setting values as a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with all `True` indexer ([GH 48701](https://github.com/pandas-dev/pandas/issues/48701)) +* Regression in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") causing an `EmptyDataError` when using an UTF-8 file handle that was already read from ([GH 48646](https://github.com/pandas-dev/pandas/issues/48646)) +* Regression in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") when `utc=True` and `arg` contained timezone naive and aware arguments raised a `ValueError` ([GH 48678](https://github.com/pandas-dev/pandas/issues/48678)) +* Fixed regression in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") raising `FutureWarning` when setting an empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 48480](https://github.com/pandas-dev/pandas/issues/48480)) +* Fixed regression in [`DataFrame.describe()`](../reference/api/pandas.DataFrame.describe.html#pandas.DataFrame.describe "pandas.DataFrame.describe") raising `TypeError` when result contains `NA` ([GH 48778](https://github.com/pandas-dev/pandas/issues/48778)) +* Fixed regression in [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") ignoring invalid `colormap` for `kind="scatter"` ([GH 48726](https://github.com/pandas-dev/pandas/issues/48726)) +* Fixed regression in `MultiIndex.values()` resetting `freq` attribute of underlying [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") object ([GH 49054](https://github.com/pandas-dev/pandas/issues/49054)) +* Fixed performance regression in [`factorize()`](../reference/api/pandas.factorize.html#pandas.factorize "pandas.factorize") when `na_sentinel` is not `None` and `sort=False` ([GH 48620](https://github.com/pandas-dev/pandas/issues/48620)) +* Fixed regression causing an `AttributeError` during warning emitted if the provided table name in [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") and the table name actually used in the database do not match ([GH 48733](https://github.com/pandas-dev/pandas/issues/48733)) +* Fixed regression in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") when `arg` was a date string with nanosecond and `format` contained `%f` would raise a `ValueError` ([GH 48767](https://github.com/pandas-dev/pandas/issues/48767)) +* Fixed regression in [`testing.assert_frame_equal()`](../reference/api/pandas.testing.assert_frame_equal.html#pandas.testing.assert_frame_equal "pandas.testing.assert_frame_equal") raising for [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") with [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") and `check_like=True` ([GH 48975](https://github.com/pandas-dev/pandas/issues/48975)) +* Fixed regression in [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") replacing wrong values for `datetime64[ns]` dtype and `inplace=True` ([GH 48863](https://github.com/pandas-dev/pandas/issues/48863)) +* Fixed [`DataFrameGroupBy.size()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.size.html#pandas.core.groupby.DataFrameGroupBy.size "pandas.core.groupby.DataFrameGroupBy.size") not returning a Series when `axis=1` ([GH 48738](https://github.com/pandas-dev/pandas/issues/48738)) +* Fixed Regression in [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") when user defined function is called on an empty dataframe ([GH 47985](https://github.com/pandas-dev/pandas/issues/47985)) +* Fixed regression in [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") when passing non-zero `axis` via keyword argument ([GH 48656](https://github.com/pandas-dev/pandas/issues/48656)) +* Fixed regression in [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") and [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") when the grouper is a nullable data type (e.g. `Int64`) or a PyArrow-backed string array, contains null values, and `dropna=False` ([GH 48794](https://github.com/pandas-dev/pandas/issues/48794)) +* Fixed performance regression in [`Series.isin()`](../reference/api/pandas.Series.isin.html#pandas.Series.isin "pandas.Series.isin") with mismatching dtypes ([GH 49162](https://github.com/pandas-dev/pandas/issues/49162)) +* Fixed regression in [`DataFrame.to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") raising when file name was specified as `bytes` ([GH 48944](https://github.com/pandas-dev/pandas/issues/48944)) +* Fixed regression in [`ExcelWriter`](../reference/api/pandas.ExcelWriter.html#pandas.ExcelWriter "pandas.ExcelWriter") where the `book` attribute could no longer be set; however setting this attribute is now deprecated and this ability will be removed in a future version of pandas ([GH 48780](https://github.com/pandas-dev/pandas/issues/48780)) +* Fixed regression in [`DataFrame.corrwith()`](../reference/api/pandas.DataFrame.corrwith.html#pandas.DataFrame.corrwith "pandas.DataFrame.corrwith") when computing correlation on tied data with `method="spearman"` ([GH 48826](https://github.com/pandas-dev/pandas/issues/48826)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in `Series.__getitem__()` not falling back to positional for integer keys and boolean [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") ([GH 48653](https://github.com/pandas-dev/pandas/issues/48653)) +* Bug in [`DataFrame.to_hdf()`](../reference/api/pandas.DataFrame.to_hdf.html#pandas.DataFrame.to_hdf "pandas.DataFrame.to_hdf") raising `AssertionError` with boolean index ([GH 48667](https://github.com/pandas-dev/pandas/issues/48667)) +* Bug in [`testing.assert_index_equal()`](../reference/api/pandas.testing.assert_index_equal.html#pandas.testing.assert_index_equal "pandas.testing.assert_index_equal") for extension arrays with non matching `NA` raising `ValueError` ([GH 48608](https://github.com/pandas-dev/pandas/issues/48608)) +* Bug in [`DataFrame.pivot_table()`](../reference/api/pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table") raising unexpected `FutureWarning` when setting datetime column as index ([GH 48683](https://github.com/pandas-dev/pandas/issues/48683)) +* Bug in [`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values") emitting unnecessary `FutureWarning` when called on [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with boolean sparse columns ([GH 48784](https://github.com/pandas-dev/pandas/issues/48784)) +* Bug in [`arrays.ArrowExtensionArray`](../reference/api/pandas.arrays.ArrowExtensionArray.html#pandas.arrays.ArrowExtensionArray "pandas.arrays.ArrowExtensionArray") with a comparison operator to an invalid object would not raise a `NotImplementedError` ([GH 48833](https://github.com/pandas-dev/pandas/issues/48833)) + +## Other[#](#other "Link to this heading") + +* Avoid showing deprecated signatures when introspecting functions with warnings about arguments becoming keyword-only ([GH 48692](https://github.com/pandas-dev/pandas/issues/48692)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 16 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Amay Patel + +* Deepak Sirohiwal + +* Dennis Chukwunta +* Gaurav Sheni +* Himanshu Wagh + +* Lorenzo Vainigli + +* Marc Garcia +* Marco Edward Gorelli +* Matthew Roeschke +* MeeseeksMachine +* Noa Tamir +* Pandas Development Team +* Patrick Hoefler +* Richard Shadrach +* Shantanu +* Torsten Wörtwein diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.5.2.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.5.2.md new file mode 100644 index 0000000000000000000000000000000000000000..ddb5afbead1e1b6043eee6ff0d4745734bd6bcf4 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.5.2.md @@ -0,0 +1,54 @@ +# What's new in pandas 1.5.2 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.5.2.html + +# What’s new in 1.5.2 (November 21, 2022)[#](#what-s-new-in-1-5-2-november-21-2022 "Link to this heading") + +These are the changes in pandas 1.5.2. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in `MultiIndex.join()` for extension array dtypes ([GH 49277](https://github.com/pandas-dev/pandas/issues/49277)) +* Fixed regression in [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") raising `RecursionError` with numeric dtype and when specifying `value=None` ([GH 45725](https://github.com/pandas-dev/pandas/issues/45725)) +* Fixed regression in arithmetic operations for [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") columns with different dtypes ([GH 49769](https://github.com/pandas-dev/pandas/issues/49769)) +* Fixed regression in [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") preventing [`Colormap`](https://matplotlib.org/stable/api/_as_gen/matplotlib.colors.Colormap.html#matplotlib.colors.Colormap "(in Matplotlib v3.10.6)") instance + from being passed using the `colormap` argument if Matplotlib 3.6+ is used ([GH 49374](https://github.com/pandas-dev/pandas/issues/49374)) +* Fixed regression in [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range") returning an invalid set of periods for `CustomBusinessDay` frequency and `start` date with timezone ([GH 49441](https://github.com/pandas-dev/pandas/issues/49441)) +* Fixed performance regression in groupby operations ([GH 49676](https://github.com/pandas-dev/pandas/issues/49676)) +* Fixed regression in [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") constructor returning object of wrong type when subclassing `Timedelta` ([GH 49579](https://github.com/pandas-dev/pandas/issues/49579)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in the Copy-on-Write implementation losing track of views in certain chained indexing cases ([GH 48996](https://github.com/pandas-dev/pandas/issues/48996)) +* Fixed memory leak in [`Styler.to_excel()`](../reference/api/pandas.io.formats.style.Styler.to_excel.html#pandas.io.formats.style.Styler.to_excel "pandas.io.formats.style.Styler.to_excel") ([GH 49751](https://github.com/pandas-dev/pandas/issues/49751)) + +## Other[#](#other "Link to this heading") + +* Reverted `color` as an alias for `c` and `size` as an alias for `s` in function [`DataFrame.plot.scatter()`](../reference/api/pandas.DataFrame.plot.scatter.html#pandas.DataFrame.plot.scatter "pandas.DataFrame.plot.scatter") ([GH 49732](https://github.com/pandas-dev/pandas/issues/49732)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 20 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Ambuj Pawar + +* Dennis Chukwunta +* Douglas Lohmann + +* Hatim Zahid + +* Joris Van den Bossche +* KotlinIsland + +* Marc Garcia +* Marco Edward Gorelli +* MarcoGorelli +* Matthew Roeschke +* MeeseeksMachine +* Natalia Mokeeva + +* Noa Tamir +* Pandas Development Team +* Patrick Hoefler +* Richard Shadrach +* Xnot + +* Zachary Moon + +* jbrockmendel +* krasch + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_1.5.3.md b/corpus/changelog/pandas_whatsnew/whatsnew_1.5.3.md new file mode 100644 index 0000000000000000000000000000000000000000..f94fda1f04b6cd125f964632047821c7b0ca2cca --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_1.5.3.md @@ -0,0 +1,64 @@ +# What's new in pandas 1.5.3 + +Source: https://pandas.pydata.org/docs/whatsnew/v1.5.3.html + +# What’s new in 1.5.3 (January 18, 2023)[#](#what-s-new-in-1-5-3-january-18-2023 "Link to this heading") + +These are the changes in pandas 1.5.3. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed performance regression in [`Series.isin()`](../reference/api/pandas.Series.isin.html#pandas.Series.isin "pandas.Series.isin") when `values` is empty ([GH 49839](https://github.com/pandas-dev/pandas/issues/49839)) +* Fixed regression in [`DataFrame.memory_usage()`](../reference/api/pandas.DataFrame.memory_usage.html#pandas.DataFrame.memory_usage "pandas.DataFrame.memory_usage") showing unnecessary `FutureWarning` when [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") is empty ([GH 50066](https://github.com/pandas-dev/pandas/issues/50066)) +* Fixed regression in [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") when used with `as_index=False` ([GH 49834](https://github.com/pandas-dev/pandas/issues/49834)) +* Enforced reversion of `color` as an alias for `c` and `size` as an alias for `s` in function [`DataFrame.plot.scatter()`](../reference/api/pandas.DataFrame.plot.scatter.html#pandas.DataFrame.plot.scatter "pandas.DataFrame.plot.scatter") ([GH 49732](https://github.com/pandas-dev/pandas/issues/49732)) +* Fixed regression in [`SeriesGroupBy.apply()`](../reference/api/pandas.core.groupby.SeriesGroupBy.apply.html#pandas.core.groupby.SeriesGroupBy.apply "pandas.core.groupby.SeriesGroupBy.apply") setting a `name` attribute on the result if the result was a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 49907](https://github.com/pandas-dev/pandas/issues/49907)) +* Fixed performance regression in setting with the [`at()`](../reference/api/pandas.DataFrame.at.html#pandas.DataFrame.at "pandas.DataFrame.at") indexer ([GH 49771](https://github.com/pandas-dev/pandas/issues/49771)) +* Fixed regression in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") raising `ValueError` when parsing array of `float` containing `np.nan` ([GH 50237](https://github.com/pandas-dev/pandas/issues/50237)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in the Copy-on-Write implementation losing track of views when indexing a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with another [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 50630](https://github.com/pandas-dev/pandas/issues/50630)) +* Bug in [`Styler.to_excel()`](../reference/api/pandas.io.formats.style.Styler.to_excel.html#pandas.io.formats.style.Styler.to_excel "pandas.io.formats.style.Styler.to_excel") leading to error when unrecognized `border-style` (e.g. `"hair"`) provided to Excel writers ([GH 48649](https://github.com/pandas-dev/pandas/issues/48649)) +* Bug in [`Series.quantile()`](../reference/api/pandas.Series.quantile.html#pandas.Series.quantile "pandas.Series.quantile") emitting warning from NumPy when [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") has only `NA` values ([GH 50681](https://github.com/pandas-dev/pandas/issues/50681)) +* Bug when chaining several [`Styler.concat()`](../reference/api/pandas.io.formats.style.Styler.concat.html#pandas.io.formats.style.Styler.concat "pandas.io.formats.style.Styler.concat") calls, only the last styler was concatenated ([GH 49207](https://github.com/pandas-dev/pandas/issues/49207)) +* Fixed bug when instantiating a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") subclass inheriting from `typing.Generic` that triggered a `UserWarning` on python 3.11 ([GH 49649](https://github.com/pandas-dev/pandas/issues/49649)) +* Bug in [`pivot_table()`](../reference/api/pandas.pivot_table.html#pandas.pivot_table "pandas.pivot_table") with NumPy 1.24 or greater when the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") columns has nested elements ([GH 50342](https://github.com/pandas-dev/pandas/issues/50342)) +* Bug in [`pandas.testing.assert_series_equal()`](../reference/api/pandas.testing.assert_series_equal.html#pandas.testing.assert_series_equal "pandas.testing.assert_series_equal") (and equivalent `assert_` functions) when having nested data and using numpy >= 1.25 ([GH 50360](https://github.com/pandas-dev/pandas/issues/50360)) + +## Other[#](#other "Link to this heading") + +Note + +If you are using [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql"), [`read_sql()`](../reference/api/pandas.read_sql.html#pandas.read_sql "pandas.read_sql"), [`read_sql_table()`](../reference/api/pandas.read_sql_table.html#pandas.read_sql_table "pandas.read_sql_table"), or [`read_sql_query()`](../reference/api/pandas.read_sql_query.html#pandas.read_sql_query "pandas.read_sql_query") with SQLAlchemy 1.4.46 or greater, +you may see a `sqlalchemy.exc.RemovedIn20Warning`. These warnings can be safely ignored for the SQLAlchemy 1.4.x releases +as pandas works toward compatibility with SQLAlchemy 2.0. + +* Reverted deprecation ([GH 45324](https://github.com/pandas-dev/pandas/issues/45324)) of behavior of `Series.__getitem__()` and `Series.__setitem__()` slicing with an integer [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"); this will remain positional ([GH 49612](https://github.com/pandas-dev/pandas/issues/49612)) +* A `FutureWarning` raised when attempting to set values inplace with [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") or [`DataFrame.iloc()`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") has been changed to a `DeprecationWarning` ([GH 48673](https://github.com/pandas-dev/pandas/issues/48673)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 19 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Emma Carballal Haire + +* Irv Lustig +* JHM Darbyshire +* Joris Van den Bossche +* Marc Garcia +* Marco Edward Gorelli +* MarcoGorelli +* Matthew Roeschke +* MeeseeksMachine +* Natalia Mokeeva +* Pandas Development Team +* Patrick Hoefler +* Richard Shadrach +* Tsvika Shapira + +* William Ayd +* aneesh98 +* jakirkham + +* jbrockmendel +* silviaovo + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_2.0.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_2.0.0.md new file mode 100644 index 0000000000000000000000000000000000000000..efeb29a8831900e990cd7f2ccd7d51b63713e33b --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_2.0.0.md @@ -0,0 +1,1891 @@ +# What's new in pandas 2.0.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v2.0.0.html + +# What’s new in 2.0.0 (April 3, 2023)[#](#what-s-new-in-2-0-0-april-3-2023 "Link to this heading") + +These are the changes in pandas 2.0.0. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Enhancements[#](#enhancements "Link to this heading") + +### Installing optional dependencies with pip extras[#](#installing-optional-dependencies-with-pip-extras "Link to this heading") + +When installing pandas using pip, sets of optional dependencies can also be installed by specifying extras. + +```None +pip install "pandas[performance, aws]>=2.0.0" +``` + +The available extras, found in the [installation guide](../getting_started/install.html#install-dependencies), are +`[all, performance, computation, fss, aws, gcp, excel, parquet, feather, hdf5, spss, postgresql, mysql, +sql-other, html, xml, plot, output_formatting, clipboard, compression, test]` ([GH 39164](https://github.com/pandas-dev/pandas/issues/39164)). + +### [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") can now hold numpy numeric dtypes[#](#index-can-now-hold-numpy-numeric-dtypes "Link to this heading") + +It is now possible to use any numpy numeric dtype in a [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") ([GH 42717](https://github.com/pandas-dev/pandas/issues/42717)). + +Previously it was only possible to use `int64`, `uint64` & `float64` dtypes: + +```None +In [1]: pd.Index([1, 2, 3], dtype=np.int8) +Out[1]: Int64Index([1, 2, 3], dtype="int64") +In [2]: pd.Index([1, 2, 3], dtype=np.uint16) +Out[2]: UInt64Index([1, 2, 3], dtype="uint64") +In [3]: pd.Index([1, 2, 3], dtype=np.float32) +Out[3]: Float64Index([1.0, 2.0, 3.0], dtype="float64") +``` + +`Int64Index`, `UInt64Index` & `Float64Index` were deprecated in pandas +version 1.4 and have now been removed. Instead [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") should be used directly, and +can it now take all numpy numeric dtypes, i.e. +`int8`/ `int16`/`int32`/`int64`/`uint8`/`uint16`/`uint32`/`uint64`/`float32`/`float64` dtypes: + +```None +In [1]: pd.Index([1, 2, 3], dtype=np.int8) +Out[1]: Index([1, 2, 3], dtype='int8') + +In [2]: pd.Index([1, 2, 3], dtype=np.uint16) +Out[2]: Index([1, 2, 3], dtype='uint16') + +In [3]: pd.Index([1, 2, 3], dtype=np.float32) +Out[3]: Index([1.0, 2.0, 3.0], dtype='float32') +``` + +The ability for [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") to hold the numpy numeric dtypes has meant some changes in Pandas +functionality. In particular, operations that previously were forced to create 64-bit indexes, +can now create indexes with lower bit sizes, e.g. 32-bit indexes. + +Below is a possibly non-exhaustive list of changes: + +1. Instantiating using a numpy numeric array now follows the dtype of the numpy array. + Previously, all indexes created from numpy numeric arrays were forced to 64-bit. Now, + for example, `Index(np.array([1, 2, 3]))` will be `int32` on 32-bit systems, where + it previously would have been `int64` even on 32-bit systems. + Instantiating [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") using a list of numbers will still return 64bit dtypes, + e.g. `Index([1, 2, 3])` will have a `int64` dtype, which is the same as previously. +2. The various numeric datetime attributes of [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") ([`day`](../reference/api/pandas.DatetimeIndex.day.html#pandas.DatetimeIndex.day "pandas.DatetimeIndex.day"), + [`month`](../reference/api/pandas.DatetimeIndex.month.html#pandas.DatetimeIndex.month "pandas.DatetimeIndex.month"), [`year`](../reference/api/pandas.DatetimeIndex.year.html#pandas.DatetimeIndex.year "pandas.DatetimeIndex.year") etc.) were previously in of + dtype `int64`, while they were `int32` for [`arrays.DatetimeArray`](../reference/api/pandas.arrays.DatetimeArray.html#pandas.arrays.DatetimeArray "pandas.arrays.DatetimeArray"). They are now + `int32` on [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") also: + + ```None + In [4]: idx = pd.date_range(start='1/1/2018', periods=3, freq='ME') + + In [5]: idx.array.year + Out[5]: array([2018, 2018, 2018], dtype=int32) + + In [6]: idx.year + Out[6]: Index([2018, 2018, 2018], dtype='int32') + ``` +3. Level dtypes on Indexes from [`Series.sparse.from_coo()`](../reference/api/pandas.Series.sparse.from_coo.html#pandas.Series.sparse.from_coo "pandas.Series.sparse.from_coo") are now of dtype `int32`, + the same as they are on the `rows`/`cols` on a scipy sparse matrix. Previously they + were of dtype `int64`. + + ```None + In [7]: from scipy import sparse + + In [8]: A = sparse.coo_matrix( + ...: ([3.0, 1.0, 2.0], ([1, 0, 0], [0, 2, 3])), shape=(3, 4) + ...: ) + ...: + + In [9]: ser = pd.Series.sparse.from_coo(A) + + In [10]: ser.index.dtypes + Out[10]: + level_0 int32 + level_1 int32 + dtype: object + ``` +4. [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") cannot be instantiated using a float16 dtype. Previously instantiating + an [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") using dtype `float16` resulted in a `Float64Index` with a + `float64` dtype. It now raises a `NotImplementedError`: + + ```None + In [11]: pd.Index([1, 2, 3], dtype=np.float16) + --------------------------------------------------------------------------- + NotImplementedError Traceback (most recent call last) + Cell In[11], line 1 + ----> 1 pd.Index([1, 2, 3], dtype=np.float16) + + File ~/work/pandas/pandas/pandas/core/indexes/base.py:577, in Index.__new__(cls, data, dtype, copy, name, tupleize_cols) + 573 arr = ensure_wrapped_if_datetimelike(arr) + 575 klass = cls._dtype_to_subclass(arr.dtype) + --> 577 arr = klass._ensure_array(arr, arr.dtype, copy=False) + 578 result = klass._simple_new(arr, name, refs=refs) + 579 if dtype is None and is_pandas_object and data_dtype == np.object_: + + File ~/work/pandas/pandas/pandas/core/indexes/base.py:602, in Index._ensure_array(cls, data, dtype, copy) + 599 raise ValueError("Index data must be 1-dimensional") + 600 elif dtype == np.float16: + 601 # float16 not supported (no indexing engine) + --> 602 raise NotImplementedError("float16 indexes are not supported") + 604 if copy: + 605 # asarray_tuplesafe does not always copy underlying data, + 606 # so need to make sure that this happens + 607 data = data.copy() + + NotImplementedError: float16 indexes are not supported + ``` + +### Argument `dtype_backend`, to return pyarrow-backed or numpy-backed nullable dtypes[#](#argument-dtype-backend-to-return-pyarrow-backed-or-numpy-backed-nullable-dtypes "Link to this heading") + +The following functions gained a new keyword `dtype_backend` ([GH 36712](https://github.com/pandas-dev/pandas/issues/36712)) + +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") +* [`read_clipboard()`](../reference/api/pandas.read_clipboard.html#pandas.read_clipboard "pandas.read_clipboard") +* [`read_fwf()`](../reference/api/pandas.read_fwf.html#pandas.read_fwf "pandas.read_fwf") +* [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") +* [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") +* [`read_xml()`](../reference/api/pandas.read_xml.html#pandas.read_xml "pandas.read_xml") +* [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") +* [`read_sql()`](../reference/api/pandas.read_sql.html#pandas.read_sql "pandas.read_sql") +* [`read_sql_query()`](../reference/api/pandas.read_sql_query.html#pandas.read_sql_query "pandas.read_sql_query") +* [`read_sql_table()`](../reference/api/pandas.read_sql_table.html#pandas.read_sql_table "pandas.read_sql_table") +* [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") +* [`read_orc()`](../reference/api/pandas.read_orc.html#pandas.read_orc "pandas.read_orc") +* [`read_feather()`](../reference/api/pandas.read_feather.html#pandas.read_feather "pandas.read_feather") +* [`read_spss()`](../reference/api/pandas.read_spss.html#pandas.read_spss "pandas.read_spss") +* [`to_numeric()`](../reference/api/pandas.to_numeric.html#pandas.to_numeric "pandas.to_numeric") +* [`DataFrame.convert_dtypes()`](../reference/api/pandas.DataFrame.convert_dtypes.html#pandas.DataFrame.convert_dtypes "pandas.DataFrame.convert_dtypes") +* [`Series.convert_dtypes()`](../reference/api/pandas.Series.convert_dtypes.html#pandas.Series.convert_dtypes "pandas.Series.convert_dtypes") + +When this option is set to `"numpy_nullable"` it will return a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") that is +backed by nullable dtypes. + +When this keyword is set to `"pyarrow"`, then these functions will return pyarrow-backed nullable [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") DataFrames ([GH 48957](https://github.com/pandas-dev/pandas/issues/48957), [GH 49997](https://github.com/pandas-dev/pandas/issues/49997)): + +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") +* [`read_clipboard()`](../reference/api/pandas.read_clipboard.html#pandas.read_clipboard "pandas.read_clipboard") +* [`read_fwf()`](../reference/api/pandas.read_fwf.html#pandas.read_fwf "pandas.read_fwf") +* [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") +* [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") +* [`read_xml()`](../reference/api/pandas.read_xml.html#pandas.read_xml "pandas.read_xml") +* [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") +* [`read_sql()`](../reference/api/pandas.read_sql.html#pandas.read_sql "pandas.read_sql") +* [`read_sql_query()`](../reference/api/pandas.read_sql_query.html#pandas.read_sql_query "pandas.read_sql_query") +* [`read_sql_table()`](../reference/api/pandas.read_sql_table.html#pandas.read_sql_table "pandas.read_sql_table") +* [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") +* [`read_orc()`](../reference/api/pandas.read_orc.html#pandas.read_orc "pandas.read_orc") +* [`read_feather()`](../reference/api/pandas.read_feather.html#pandas.read_feather "pandas.read_feather") +* [`read_spss()`](../reference/api/pandas.read_spss.html#pandas.read_spss "pandas.read_spss") +* [`to_numeric()`](../reference/api/pandas.to_numeric.html#pandas.to_numeric "pandas.to_numeric") +* [`DataFrame.convert_dtypes()`](../reference/api/pandas.DataFrame.convert_dtypes.html#pandas.DataFrame.convert_dtypes "pandas.DataFrame.convert_dtypes") +* [`Series.convert_dtypes()`](../reference/api/pandas.Series.convert_dtypes.html#pandas.Series.convert_dtypes "pandas.Series.convert_dtypes") + +```None +In [12]: import io + +In [13]: data = io.StringIO("""a,b,c,d,e,f,g,h,i + ....: 1,2.5,True,a,,,,, + ....: 3,4.5,False,b,6,7.5,True,a, + ....: """) + ....: + +In [14]: df = pd.read_csv(data, dtype_backend="pyarrow") + +In [15]: df.dtypes +Out[15]: +a int64[pyarrow] +b double[pyarrow] +c bool[pyarrow] +d string[pyarrow] +e int64[pyarrow] +f double[pyarrow] +g bool[pyarrow] +h string[pyarrow] +i null[pyarrow] +dtype: object + +In [16]: data.seek(0) +Out[16]: 0 + +In [17]: df_pyarrow = pd.read_csv(data, dtype_backend="pyarrow", engine="pyarrow") + +In [18]: df_pyarrow.dtypes +Out[18]: +a int64[pyarrow] +b double[pyarrow] +c bool[pyarrow] +d string[pyarrow] +e int64[pyarrow] +f double[pyarrow] +g bool[pyarrow] +h string[pyarrow] +i null[pyarrow] +dtype: object +``` + +### Copy-on-Write improvements[#](#copy-on-write-improvements "Link to this heading") + +* A new lazy copy mechanism that defers the copy until the object in question is modified + was added to the methods listed in + [Copy-on-Write optimizations](../user_guide/copy_on_write.html#copy-on-write-optimizations). + These methods return views when Copy-on-Write is enabled, which provides a significant + performance improvement compared to the regular execution ([GH 49473](https://github.com/pandas-dev/pandas/issues/49473)). +* Accessing a single column of a DataFrame as a Series (e.g. `df["col"]`) now always + returns a new object every time it is constructed when Copy-on-Write is enabled (not + returning multiple times an identical, cached Series object). This ensures that those + Series objects correctly follow the Copy-on-Write rules ([GH 49450](https://github.com/pandas-dev/pandas/issues/49450)) +* The [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructor will now create a lazy copy (deferring the copy until + a modification to the data happens) when constructing a Series from an existing + Series with the default of `copy=False` ([GH 50471](https://github.com/pandas-dev/pandas/issues/50471)) +* The [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor will now create a lazy copy (deferring the copy until + a modification to the data happens) when constructing from an existing + [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with the default of `copy=False` ([GH 51239](https://github.com/pandas-dev/pandas/issues/51239)) +* The [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor, when constructing a DataFrame from a dictionary + of Series objects and specifying `copy=False`, will now use a lazy copy + of those Series objects for the columns of the DataFrame ([GH 50777](https://github.com/pandas-dev/pandas/issues/50777)) +* The [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor, when constructing a DataFrame from a + [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") and specifying `copy=False`, will + now respect Copy-on-Write. +* The [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructors, when constructing from + a NumPy array, will now copy the array by default to avoid mutating + the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") / [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") + when mutating the array. Specify `copy=False` to get the old behavior. + When setting `copy=False` pandas does not guarantee correct Copy-on-Write + behavior when the NumPy array is modified after creation of the + [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") / [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"). +* The [`DataFrame.from_records()`](../reference/api/pandas.DataFrame.from_records.html#pandas.DataFrame.from_records "pandas.DataFrame.from_records") will now respect Copy-on-Write when called + with a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame"). +* Trying to set values using chained assignment (for example, `df["a"][1:3] = 0`) + will now always raise a warning when Copy-on-Write is enabled. In this mode, + chained assignment can never work because we are always setting into a temporary + object that is the result of an indexing operation (getitem), which under + Copy-on-Write always behaves as a copy. Thus, assigning through a chain + can never update the original Series or DataFrame. Therefore, an informative + warning is raised to the user to avoid silently doing nothing ([GH 49467](https://github.com/pandas-dev/pandas/issues/49467)) +* [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") will now respect the Copy-on-Write mechanism + when `inplace=True`. +* [`DataFrame.transpose()`](../reference/api/pandas.DataFrame.transpose.html#pandas.DataFrame.transpose "pandas.DataFrame.transpose") will now respect the Copy-on-Write mechanism. +* Arithmetic operations that can be inplace, e.g. `ser *= 2` will now respect the + Copy-on-Write mechanism. +* `DataFrame.__getitem__()` will now respect the Copy-on-Write mechanism when the + [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") has [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") columns. +* `Series.__getitem__()` will now respect the Copy-on-Write mechanism when the + : [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") has a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex"). +* [`Series.view()`](../reference/api/pandas.Series.view.html#pandas.Series.view "pandas.Series.view") will now respect the Copy-on-Write mechanism. + +Copy-on-Write can be enabled through one of + +```None +pd.set_option("mode.copy_on_write", True) +``` + +```None +pd.options.mode.copy_on_write = True +``` + +Alternatively, copy on write can be enabled locally through: + +```None +with pd.option_context("mode.copy_on_write", True): + ... +``` + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* Added support for `str` accessor methods when using [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with a `pyarrow.string` type ([GH 50325](https://github.com/pandas-dev/pandas/issues/50325)) +* Added support for `dt` accessor methods when using [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with a `pyarrow.timestamp` type ([GH 50954](https://github.com/pandas-dev/pandas/issues/50954)) +* [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") now supports using `encoding='infer'` to correctly read and use the encoding specified by the sas file. ([GH 48048](https://github.com/pandas-dev/pandas/issues/48048)) +* [`DataFrameGroupBy.quantile()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.quantile.html#pandas.core.groupby.DataFrameGroupBy.quantile "pandas.core.groupby.DataFrameGroupBy.quantile"), [`SeriesGroupBy.quantile()`](../reference/api/pandas.core.groupby.SeriesGroupBy.quantile.html#pandas.core.groupby.SeriesGroupBy.quantile "pandas.core.groupby.SeriesGroupBy.quantile") and [`DataFrameGroupBy.std()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.std.html#pandas.core.groupby.DataFrameGroupBy.std "pandas.core.groupby.DataFrameGroupBy.std") now preserve nullable dtypes instead of casting to numpy dtypes ([GH 37493](https://github.com/pandas-dev/pandas/issues/37493)) +* [`DataFrameGroupBy.std()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.std.html#pandas.core.groupby.DataFrameGroupBy.std "pandas.core.groupby.DataFrameGroupBy.std"), [`SeriesGroupBy.std()`](../reference/api/pandas.core.groupby.SeriesGroupBy.std.html#pandas.core.groupby.SeriesGroupBy.std "pandas.core.groupby.SeriesGroupBy.std") now support datetime64, timedelta64, and [`DatetimeTZDtype`](../reference/api/pandas.DatetimeTZDtype.html#pandas.DatetimeTZDtype "pandas.DatetimeTZDtype") dtypes ([GH 48481](https://github.com/pandas-dev/pandas/issues/48481)) +* [`Series.add_suffix()`](../reference/api/pandas.Series.add_suffix.html#pandas.Series.add_suffix "pandas.Series.add_suffix"), [`DataFrame.add_suffix()`](../reference/api/pandas.DataFrame.add_suffix.html#pandas.DataFrame.add_suffix "pandas.DataFrame.add_suffix"), [`Series.add_prefix()`](../reference/api/pandas.Series.add_prefix.html#pandas.Series.add_prefix "pandas.Series.add_prefix") and [`DataFrame.add_prefix()`](../reference/api/pandas.DataFrame.add_prefix.html#pandas.DataFrame.add_prefix "pandas.DataFrame.add_prefix") support an `axis` argument. If `axis` is set, the default behaviour of which axis to consider can be overwritten ([GH 47819](https://github.com/pandas-dev/pandas/issues/47819)) +* [`testing.assert_frame_equal()`](../reference/api/pandas.testing.assert_frame_equal.html#pandas.testing.assert_frame_equal "pandas.testing.assert_frame_equal") now shows the first element where the DataFrames differ, analogously to `pytest`’s output ([GH 47910](https://github.com/pandas-dev/pandas/issues/47910)) +* Added `index` parameter to [`DataFrame.to_dict()`](../reference/api/pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict") ([GH 46398](https://github.com/pandas-dev/pandas/issues/46398)) +* Added support for extension array dtypes in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") ([GH 44240](https://github.com/pandas-dev/pandas/issues/44240)) +* Added metadata propagation for binary operators on [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 28283](https://github.com/pandas-dev/pandas/issues/28283)) +* Added `cumsum`, `cumprod`, `cummin` and `cummax` to the `ExtensionArray` interface via `_accumulate` ([GH 28385](https://github.com/pandas-dev/pandas/issues/28385)) +* [`CategoricalConversionWarning`](../reference/api/pandas.errors.CategoricalConversionWarning.html#pandas.errors.CategoricalConversionWarning "pandas.errors.CategoricalConversionWarning"), [`InvalidComparison`](../reference/api/pandas.errors.InvalidComparison.html#pandas.errors.InvalidComparison "pandas.errors.InvalidComparison"), [`InvalidVersion`](../reference/api/pandas.errors.InvalidVersion.html#pandas.errors.InvalidVersion "pandas.errors.InvalidVersion"), [`LossySetitemError`](../reference/api/pandas.errors.LossySetitemError.html#pandas.errors.LossySetitemError "pandas.errors.LossySetitemError"), and [`NoBufferPresent`](../reference/api/pandas.errors.NoBufferPresent.html#pandas.errors.NoBufferPresent "pandas.errors.NoBufferPresent") are now exposed in `pandas.errors` ([GH 27656](https://github.com/pandas-dev/pandas/issues/27656)) +* Fix `test` optional\_extra by adding missing test package `pytest-asyncio` ([GH 48361](https://github.com/pandas-dev/pandas/issues/48361)) +* [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") exception message thrown improved to include column name when type conversion is not possible. ([GH 47571](https://github.com/pandas-dev/pandas/issues/47571)) +* [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range") now supports a `unit` keyword (“s”, “ms”, “us”, or “ns”) to specify the desired resolution of the output index ([GH 49106](https://github.com/pandas-dev/pandas/issues/49106)) +* [`timedelta_range()`](../reference/api/pandas.timedelta_range.html#pandas.timedelta_range "pandas.timedelta_range") now supports a `unit` keyword (“s”, “ms”, “us”, or “ns”) to specify the desired resolution of the output index ([GH 49824](https://github.com/pandas-dev/pandas/issues/49824)) +* [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") now supports a `mode` keyword with supported inputs ‘w’ and ‘a’. Defaulting to ‘w’, ‘a’ can be used when lines=True and orient=’records’ to append record oriented json lines to an existing json file. ([GH 35849](https://github.com/pandas-dev/pandas/issues/35849)) +* Added `name` parameter to [`IntervalIndex.from_breaks()`](../reference/api/pandas.IntervalIndex.from_breaks.html#pandas.IntervalIndex.from_breaks "pandas.IntervalIndex.from_breaks"), [`IntervalIndex.from_arrays()`](../reference/api/pandas.IntervalIndex.from_arrays.html#pandas.IntervalIndex.from_arrays "pandas.IntervalIndex.from_arrays") and [`IntervalIndex.from_tuples()`](../reference/api/pandas.IntervalIndex.from_tuples.html#pandas.IntervalIndex.from_tuples "pandas.IntervalIndex.from_tuples") ([GH 48911](https://github.com/pandas-dev/pandas/issues/48911)) +* Improve exception message when using [`testing.assert_frame_equal()`](../reference/api/pandas.testing.assert_frame_equal.html#pandas.testing.assert_frame_equal "pandas.testing.assert_frame_equal") on a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") to include the column that is compared ([GH 50323](https://github.com/pandas-dev/pandas/issues/50323)) +* Improved error message for [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") when join-columns were duplicated ([GH 50102](https://github.com/pandas-dev/pandas/issues/50102)) +* Added support for extension array dtypes to [`get_dummies()`](../reference/api/pandas.get_dummies.html#pandas.get_dummies "pandas.get_dummies") ([GH 32430](https://github.com/pandas-dev/pandas/issues/32430)) +* Added `Index.infer_objects()` analogous to [`Series.infer_objects()`](../reference/api/pandas.Series.infer_objects.html#pandas.Series.infer_objects "pandas.Series.infer_objects") ([GH 50034](https://github.com/pandas-dev/pandas/issues/50034)) +* Added `copy` parameter to [`Series.infer_objects()`](../reference/api/pandas.Series.infer_objects.html#pandas.Series.infer_objects "pandas.Series.infer_objects") and [`DataFrame.infer_objects()`](../reference/api/pandas.DataFrame.infer_objects.html#pandas.DataFrame.infer_objects "pandas.DataFrame.infer_objects"), passing `False` will avoid making copies for series or columns that are already non-object or where no better dtype can be inferred ([GH 50096](https://github.com/pandas-dev/pandas/issues/50096)) +* [`DataFrame.plot.hist()`](../reference/api/pandas.DataFrame.plot.hist.html#pandas.DataFrame.plot.hist "pandas.DataFrame.plot.hist") now recognizes `xlabel` and `ylabel` arguments ([GH 49793](https://github.com/pandas-dev/pandas/issues/49793)) +* [`Series.drop_duplicates()`](../reference/api/pandas.Series.drop_duplicates.html#pandas.Series.drop_duplicates "pandas.Series.drop_duplicates") has gained `ignore_index` keyword to reset index ([GH 48304](https://github.com/pandas-dev/pandas/issues/48304)) +* [`Series.dropna()`](../reference/api/pandas.Series.dropna.html#pandas.Series.dropna "pandas.Series.dropna") and [`DataFrame.dropna()`](../reference/api/pandas.DataFrame.dropna.html#pandas.DataFrame.dropna "pandas.DataFrame.dropna") has gained `ignore_index` keyword to reset index ([GH 31725](https://github.com/pandas-dev/pandas/issues/31725)) +* Improved error message in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") for non-ISO8601 formats, informing users about the position of the first error ([GH 50361](https://github.com/pandas-dev/pandas/issues/50361)) +* Improved error message when trying to align [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") objects (for example, in [`DataFrame.compare()`](../reference/api/pandas.DataFrame.compare.html#pandas.DataFrame.compare "pandas.DataFrame.compare")) to clarify that “identically labelled” refers to both index and columns ([GH 50083](https://github.com/pandas-dev/pandas/issues/50083)) +* Added support for [`Index.min()`](../reference/api/pandas.Index.min.html#pandas.Index.min "pandas.Index.min") and [`Index.max()`](../reference/api/pandas.Index.max.html#pandas.Index.max "pandas.Index.max") for pyarrow string dtypes ([GH 51397](https://github.com/pandas-dev/pandas/issues/51397)) +* Added [`DatetimeIndex.as_unit()`](../reference/api/pandas.DatetimeIndex.as_unit.html#pandas.DatetimeIndex.as_unit "pandas.DatetimeIndex.as_unit") and [`TimedeltaIndex.as_unit()`](../reference/api/pandas.TimedeltaIndex.as_unit.html#pandas.TimedeltaIndex.as_unit "pandas.TimedeltaIndex.as_unit") to convert to different resolutions; supported resolutions are “s”, “ms”, “us”, and “ns” ([GH 50616](https://github.com/pandas-dev/pandas/issues/50616)) +* Added [`Series.dt.unit()`](../reference/api/pandas.Series.dt.unit.html#pandas.Series.dt.unit "pandas.Series.dt.unit") and [`Series.dt.as_unit()`](../reference/api/pandas.Series.dt.as_unit.html#pandas.Series.dt.as_unit "pandas.Series.dt.as_unit") to convert to different resolutions; supported resolutions are “s”, “ms”, “us”, and “ns” ([GH 51223](https://github.com/pandas-dev/pandas/issues/51223)) +* Added new argument `dtype` to [`read_sql()`](../reference/api/pandas.read_sql.html#pandas.read_sql "pandas.read_sql") to be consistent with [`read_sql_query()`](../reference/api/pandas.read_sql_query.html#pandas.read_sql_query "pandas.read_sql_query") ([GH 50797](https://github.com/pandas-dev/pandas/issues/50797)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv"), [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table"), [`read_fwf()`](../reference/api/pandas.read_fwf.html#pandas.read_fwf "pandas.read_fwf") and [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") now accept `date_format` ([GH 50601](https://github.com/pandas-dev/pandas/issues/50601)) +* [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") now accepts `"ISO8601"` as an argument to `format`, which will match any ISO8601 string (but possibly not identically-formatted) ([GH 50411](https://github.com/pandas-dev/pandas/issues/50411)) +* [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") now accepts `"mixed"` as an argument to `format`, which will infer the format for each element individually ([GH 50972](https://github.com/pandas-dev/pandas/issues/50972)) +* Added new argument `engine` to [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") to support parsing JSON with pyarrow by specifying `engine="pyarrow"` ([GH 48893](https://github.com/pandas-dev/pandas/issues/48893)) +* Added support for SQLAlchemy 2.0 ([GH 40686](https://github.com/pandas-dev/pandas/issues/40686)) +* Added support for `decimal` parameter when `engine="pyarrow"` in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") ([GH 51302](https://github.com/pandas-dev/pandas/issues/51302)) +* [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") set operations [`Index.union()`](../reference/api/pandas.Index.union.html#pandas.Index.union "pandas.Index.union"), [`Index.intersection()`](../reference/api/pandas.Index.intersection.html#pandas.Index.intersection "pandas.Index.intersection"), [`Index.difference()`](../reference/api/pandas.Index.difference.html#pandas.Index.difference "pandas.Index.difference"), and [`Index.symmetric_difference()`](../reference/api/pandas.Index.symmetric_difference.html#pandas.Index.symmetric_difference "pandas.Index.symmetric_difference") now support `sort=True`, which will always return a sorted result, unlike the default `sort=None` which does not sort in some cases ([GH 25151](https://github.com/pandas-dev/pandas/issues/25151)) +* Added new escape mode “latex-math” to avoid escaping “$” in formatter ([GH 50040](https://github.com/pandas-dev/pandas/issues/50040)) + +## Notable bug fixes[#](#notable-bug-fixes "Link to this heading") + +These are bug fixes that might have notable behavior changes. + +### [`DataFrameGroupBy.cumsum()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cumsum.html#pandas.core.groupby.DataFrameGroupBy.cumsum "pandas.core.groupby.DataFrameGroupBy.cumsum") and [`DataFrameGroupBy.cumprod()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cumprod.html#pandas.core.groupby.DataFrameGroupBy.cumprod "pandas.core.groupby.DataFrameGroupBy.cumprod") overflow instead of lossy casting to float[#](#dataframegroupby-cumsum-and-dataframegroupby-cumprod-overflow-instead-of-lossy-casting-to-float "Link to this heading") + +In previous versions we cast to float when applying `cumsum` and `cumprod` which +lead to incorrect results even if the result could be hold by `int64` dtype. +Additionally, the aggregation overflows consistent with numpy and the regular +[`DataFrame.cumprod()`](../reference/api/pandas.DataFrame.cumprod.html#pandas.DataFrame.cumprod "pandas.DataFrame.cumprod") and [`DataFrame.cumsum()`](../reference/api/pandas.DataFrame.cumsum.html#pandas.DataFrame.cumsum "pandas.DataFrame.cumsum") methods when the limit of +`int64` is reached ([GH 37493](https://github.com/pandas-dev/pandas/issues/37493)). + +*Old Behavior* + +```None +In [1]: df = pd.DataFrame({"key": ["b"] * 7, "value": 625}) +In [2]: df.groupby("key")["value"].cumprod()[5] +Out[2]: 5.960464477539062e+16 +``` + +We return incorrect results with the 6th value. + +*New Behavior* + +```None +In [19]: df = pd.DataFrame({"key": ["b"] * 7, "value": 625}) + +In [20]: df.groupby("key")["value"].cumprod() +Out[20]: +0 625 +1 390625 +2 244140625 +3 152587890625 +4 95367431640625 +5 59604644775390625 +6 359414837200037393 +Name: value, dtype: int64 +``` + +We overflow with the 7th value, but the 6th value is still correct. + +### [`DataFrameGroupBy.nth()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.nth.html#pandas.core.groupby.DataFrameGroupBy.nth "pandas.core.groupby.DataFrameGroupBy.nth") and [`SeriesGroupBy.nth()`](../reference/api/pandas.core.groupby.SeriesGroupBy.nth.html#pandas.core.groupby.SeriesGroupBy.nth "pandas.core.groupby.SeriesGroupBy.nth") now behave as filtrations[#](#dataframegroupby-nth-and-seriesgroupby-nth-now-behave-as-filtrations "Link to this heading") + +In previous versions of pandas, [`DataFrameGroupBy.nth()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.nth.html#pandas.core.groupby.DataFrameGroupBy.nth "pandas.core.groupby.DataFrameGroupBy.nth") and +[`SeriesGroupBy.nth()`](../reference/api/pandas.core.groupby.SeriesGroupBy.nth.html#pandas.core.groupby.SeriesGroupBy.nth "pandas.core.groupby.SeriesGroupBy.nth") acted as if they were aggregations. However, for most +inputs `n`, they may return either zero or multiple rows per group. This means +that they are filtrations, similar to e.g. [`DataFrameGroupBy.head()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.head.html#pandas.core.groupby.DataFrameGroupBy.head "pandas.core.groupby.DataFrameGroupBy.head"). pandas +now treats them as filtrations ([GH 13666](https://github.com/pandas-dev/pandas/issues/13666)). + +```None +In [21]: df = pd.DataFrame({"a": [1, 1, 2, 1, 2], "b": [np.nan, 2.0, 3.0, 4.0, 5.0]}) + +In [22]: gb = df.groupby("a") +``` + +*Old Behavior* + +```None +In [5]: gb.nth(n=1) +Out[5]: + A B +1 1 2.0 +4 2 5.0 +``` + +*New Behavior* + +```None +In [23]: gb.nth(n=1) +Out[23]: + a b +1 1 2.0 +4 2 5.0 +``` + +In particular, the index of the result is derived from the input by selecting +the appropriate rows. Also, when `n` is larger than the group, no rows instead of +`NaN` is returned. + +*Old Behavior* + +```None +In [5]: gb.nth(n=3, dropna="any") +Out[5]: + B +A +1 NaN +2 NaN +``` + +*New Behavior* + +```None +In [24]: gb.nth(n=3, dropna="any") +Out[24]: +Empty DataFrame +Columns: [a, b] +Index: [] +``` + +## Backwards incompatible API changes[#](#backwards-incompatible-api-changes "Link to this heading") + +### Construction with datetime64 or timedelta64 dtype with unsupported resolution[#](#construction-with-datetime64-or-timedelta64-dtype-with-unsupported-resolution "Link to this heading") + +In past versions, when constructing a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and +passing a “datetime64” or “timedelta64” dtype with unsupported resolution +(i.e. anything other than “ns”), pandas would silently replace the given dtype +with its nanosecond analogue: + +*Previous behavior*: + +```None +In [5]: pd.Series(["2016-01-01"], dtype="datetime64[s]") +Out[5]: +0 2016-01-01 +dtype: datetime64[ns] + +In [6] pd.Series(["2016-01-01"], dtype="datetime64[D]") +Out[6]: +0 2016-01-01 +dtype: datetime64[ns] +``` + +In pandas 2.0 we support resolutions “s”, “ms”, “us”, and “ns”. When passing +a supported dtype (e.g. “datetime64[s]”), the result now has exactly +the requested dtype: + +*New behavior*: + +```None +In [25]: pd.Series(["2016-01-01"], dtype="datetime64[s]") +Out[25]: +0 2016-01-01 +dtype: datetime64[s] +``` + +With an un-supported dtype, pandas now raises instead of silently swapping in +a supported dtype: + +*New behavior*: + +```None +In [26]: pd.Series(["2016-01-01"], dtype="datetime64[D]") +--------------------------------------------------------------------------- +TypeError Traceback (most recent call last) +Cell In[26], line 1 +----> 1 pd.Series(["2016-01-01"], dtype="datetime64[D]") + +File ~/work/pandas/pandas/pandas/core/series.py:587, in Series.__init__(self, data, index, dtype, name, copy, fastpath) + 585 data = data.copy() + 586 else: +--> 587 data = sanitize_array(data, index, dtype, copy) + 589 manager = _get_option("mode.data_manager", silent=True) + 590 if manager == "block": + +File ~/work/pandas/pandas/pandas/core/construction.py:648, in sanitize_array(data, index, dtype, copy, allow_2d) + 645 subarr = np.array([], dtype=np.float64) + 647 elif dtype is not None: +--> 648 subarr = _try_cast(data, dtype, copy) + 650 else: + 651 subarr = maybe_convert_platform(data) + +File ~/work/pandas/pandas/pandas/core/construction.py:808, in _try_cast(arr, dtype, copy) + 803 return lib.ensure_string_array(arr, convert_na_value=False, copy=copy).reshape( + 804 shape + 805 ) + 807 elif dtype.kind in "mM": +--> 808 return maybe_cast_to_datetime(arr, dtype) + 810 # GH#15832: Check if we are requesting a numeric dtype and + 811 # that we can convert the data to the requested dtype. + 812 elif dtype.kind in "iu": + 813 # this will raise if we have e.g. floats + +File ~/work/pandas/pandas/pandas/core/dtypes/cast.py:1230, in maybe_cast_to_datetime(value, dtype) + 1226 raise TypeError("value must be listlike") + 1228 # TODO: _from_sequence would raise ValueError in cases where + 1229 # _ensure_nanosecond_dtype raises TypeError +-> 1230 _ensure_nanosecond_dtype(dtype) + 1232 if lib.is_np_dtype(dtype, "m"): + 1233 res = TimedeltaArray._from_sequence(value, dtype=dtype) + +File ~/work/pandas/pandas/pandas/core/dtypes/cast.py:1287, in _ensure_nanosecond_dtype(dtype) + 1284 raise ValueError(msg) + 1285 # TODO: ValueError or TypeError? existing test + 1286 # test_constructor_generic_timestamp_bad_frequency expects TypeError +-> 1287 raise TypeError( + 1288 f"dtype={dtype} is not supported. Supported resolutions are 's', " + 1289 "'ms', 'us', and 'ns'" + 1290 ) + +TypeError: dtype=datetime64[D] is not supported. Supported resolutions are 's', 'ms', 'us', and 'ns' +``` + +### Value counts sets the resulting name to `count`[#](#value-counts-sets-the-resulting-name-to-count "Link to this heading") + +In past versions, when running [`Series.value_counts()`](../reference/api/pandas.Series.value_counts.html#pandas.Series.value_counts "pandas.Series.value_counts"), the result would inherit +the original object’s name, and the result index would be nameless. This would cause +confusion when resetting the index, and the column names would not correspond with the +column values. +Now, the result name will be `'count'` (or `'proportion'` if `normalize=True` was passed), +and the index will be named after the original object ([GH 49497](https://github.com/pandas-dev/pandas/issues/49497)). + +*Previous behavior*: + +```None +In [8]: pd.Series(['quetzal', 'quetzal', 'elk'], name='animal').value_counts() + +Out[2]: +quetzal 2 +elk 1 +Name: animal, dtype: int64 +``` + +*New behavior*: + +```None +In [27]: pd.Series(['quetzal', 'quetzal', 'elk'], name='animal').value_counts() +Out[27]: +animal +quetzal 2 +elk 1 +Name: count, dtype: int64 +``` + +Likewise for other `value_counts` methods (for example, [`DataFrame.value_counts()`](../reference/api/pandas.DataFrame.value_counts.html#pandas.DataFrame.value_counts "pandas.DataFrame.value_counts")). + +### Disallow astype conversion to non-supported datetime64/timedelta64 dtypes[#](#disallow-astype-conversion-to-non-supported-datetime64-timedelta64-dtypes "Link to this heading") + +In previous versions, converting a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") +from `datetime64[ns]` to a different `datetime64[X]` dtype would return +with `datetime64[ns]` dtype instead of the requested dtype. In pandas 2.0, +support is added for “datetime64[s]”, “datetime64[ms]”, and “datetime64[us]” dtypes, +so converting to those dtypes gives exactly the requested dtype: + +*Previous behavior*: + +```None +In [28]: idx = pd.date_range("2016-01-01", periods=3) + +In [29]: ser = pd.Series(idx) +``` + +*Previous behavior*: + +```None +In [4]: ser.astype("datetime64[s]") +Out[4]: +0 2016-01-01 +1 2016-01-02 +2 2016-01-03 +dtype: datetime64[ns] +``` + +With the new behavior, we get exactly the requested dtype: + +*New behavior*: + +```None +In [30]: ser.astype("datetime64[s]") +Out[30]: +0 2016-01-01 +1 2016-01-02 +2 2016-01-03 +dtype: datetime64[s] +``` + +For non-supported resolutions e.g. “datetime64[D]”, we raise instead of silently +ignoring the requested dtype: + +*New behavior*: + +```None +In [31]: ser.astype("datetime64[D]") +--------------------------------------------------------------------------- +TypeError Traceback (most recent call last) +Cell In[31], line 1 +----> 1 ser.astype("datetime64[D]") + +File ~/work/pandas/pandas/pandas/core/generic.py:6665, in NDFrame.astype(self, dtype, copy, errors) + 6659 results = [ + 6660 ser.astype(dtype, copy=copy, errors=errors) for _, ser in self.items() + 6661 ] + 6663 else: + 6664 # else, only a single dtype is given +-> 6665 new_data = self._mgr.astype(dtype=dtype, copy=copy, errors=errors) + 6666 res = self._constructor_from_mgr(new_data, axes=new_data.axes) + 6667 return res.__finalize__(self, method="astype") + +File ~/work/pandas/pandas/pandas/core/internals/managers.py:449, in BaseBlockManager.astype(self, dtype, copy, errors) + 446 elif using_copy_on_write(): + 447 copy = False +--> 449 return self.apply( + 450 "astype", + 451 dtype=dtype, + 452 copy=copy, + 453 errors=errors, + 454 using_cow=using_copy_on_write(), + 455 ) + +File ~/work/pandas/pandas/pandas/core/internals/managers.py:363, in BaseBlockManager.apply(self, f, align_keys, **kwargs) + 361 applied = b.apply(f, **kwargs) + 362 else: +--> 363 applied = getattr(b, f)(**kwargs) + 364 result_blocks = extend_blocks(applied, result_blocks) + 366 out = type(self).from_blocks(result_blocks, self.axes) + +File ~/work/pandas/pandas/pandas/core/internals/blocks.py:784, in Block.astype(self, dtype, copy, errors, using_cow, squeeze) + 781 raise ValueError("Can not squeeze with more than one column.") + 782 values = values[0, :] # type: ignore[call-overload] +--> 784 new_values = astype_array_safe(values, dtype, copy=copy, errors=errors) + 786 new_values = maybe_coerce_values(new_values) + 788 refs = None + +File ~/work/pandas/pandas/pandas/core/dtypes/astype.py:237, in astype_array_safe(values, dtype, copy, errors) + 234 dtype = dtype.numpy_dtype + 236 try: +--> 237 new_values = astype_array(values, dtype, copy=copy) + 238 except (ValueError, TypeError): + 239 # e.g. _astype_nansafe can fail on object-dtype of strings + 240 # trying to convert to float + 241 if errors == "ignore": + +File ~/work/pandas/pandas/pandas/core/dtypes/astype.py:179, in astype_array(values, dtype, copy) + 175 return values + 177 if not isinstance(values, np.ndarray): + 178 # i.e. ExtensionArray +--> 179 values = values.astype(dtype, copy=copy) + 181 else: + 182 values = _astype_nansafe(values, dtype, copy=copy) + +File ~/work/pandas/pandas/pandas/core/arrays/datetimes.py:741, in DatetimeArray.astype(self, dtype, copy) + 739 elif isinstance(dtype, PeriodDtype): + 740 return self.to_period(freq=dtype.freq) +--> 741 return dtl.DatetimeLikeArrayMixin.astype(self, dtype, copy) + +File ~/work/pandas/pandas/pandas/core/arrays/datetimelike.py:517, in DatetimeLikeArrayMixin.astype(self, dtype, copy) + 513 elif (dtype.kind in "mM" and self.dtype != dtype) or dtype.kind == "f": + 514 # disallow conversion between datetime/timedelta, + 515 # and conversions for any datetimelike to float + 516 msg = f"Cannot cast {type(self).__name__} to dtype {dtype}" +--> 517 raise TypeError(msg) + 518 else: + 519 return np.asarray(self, dtype=dtype) + +TypeError: Cannot cast DatetimeArray to dtype datetime64[D] +``` + +For conversion from `timedelta64[ns]` dtypes, the old behavior converted +to a floating point format. + +*Previous behavior*: + +```None +In [32]: idx = pd.timedelta_range("1 Day", periods=3) + +In [33]: ser = pd.Series(idx) +``` + +*Previous behavior*: + +```None +In [7]: ser.astype("timedelta64[s]") +Out[7]: +0 86400.0 +1 172800.0 +2 259200.0 +dtype: float64 + +In [8]: ser.astype("timedelta64[D]") +Out[8]: +0 1.0 +1 2.0 +2 3.0 +dtype: float64 +``` + +The new behavior, as for datetime64, either gives exactly the requested dtype or raises: + +*New behavior*: + +```None +In [34]: ser.astype("timedelta64[s]") +Out[34]: +0 1 days +1 2 days +2 3 days +dtype: timedelta64[s] + +In [35]: ser.astype("timedelta64[D]") +--------------------------------------------------------------------------- +ValueError Traceback (most recent call last) +Cell In[35], line 1 +----> 1 ser.astype("timedelta64[D]") + +File ~/work/pandas/pandas/pandas/core/generic.py:6665, in NDFrame.astype(self, dtype, copy, errors) + 6659 results = [ + 6660 ser.astype(dtype, copy=copy, errors=errors) for _, ser in self.items() + 6661 ] + 6663 else: + 6664 # else, only a single dtype is given +-> 6665 new_data = self._mgr.astype(dtype=dtype, copy=copy, errors=errors) + 6666 res = self._constructor_from_mgr(new_data, axes=new_data.axes) + 6667 return res.__finalize__(self, method="astype") + +File ~/work/pandas/pandas/pandas/core/internals/managers.py:449, in BaseBlockManager.astype(self, dtype, copy, errors) + 446 elif using_copy_on_write(): + 447 copy = False +--> 449 return self.apply( + 450 "astype", + 451 dtype=dtype, + 452 copy=copy, + 453 errors=errors, + 454 using_cow=using_copy_on_write(), + 455 ) + +File ~/work/pandas/pandas/pandas/core/internals/managers.py:363, in BaseBlockManager.apply(self, f, align_keys, **kwargs) + 361 applied = b.apply(f, **kwargs) + 362 else: +--> 363 applied = getattr(b, f)(**kwargs) + 364 result_blocks = extend_blocks(applied, result_blocks) + 366 out = type(self).from_blocks(result_blocks, self.axes) + +File ~/work/pandas/pandas/pandas/core/internals/blocks.py:784, in Block.astype(self, dtype, copy, errors, using_cow, squeeze) + 781 raise ValueError("Can not squeeze with more than one column.") + 782 values = values[0, :] # type: ignore[call-overload] +--> 784 new_values = astype_array_safe(values, dtype, copy=copy, errors=errors) + 786 new_values = maybe_coerce_values(new_values) + 788 refs = None + +File ~/work/pandas/pandas/pandas/core/dtypes/astype.py:237, in astype_array_safe(values, dtype, copy, errors) + 234 dtype = dtype.numpy_dtype + 236 try: +--> 237 new_values = astype_array(values, dtype, copy=copy) + 238 except (ValueError, TypeError): + 239 # e.g. _astype_nansafe can fail on object-dtype of strings + 240 # trying to convert to float + 241 if errors == "ignore": + +File ~/work/pandas/pandas/pandas/core/dtypes/astype.py:179, in astype_array(values, dtype, copy) + 175 return values + 177 if not isinstance(values, np.ndarray): + 178 # i.e. ExtensionArray +--> 179 values = values.astype(dtype, copy=copy) + 181 else: + 182 values = _astype_nansafe(values, dtype, copy=copy) + +File ~/work/pandas/pandas/pandas/core/arrays/timedeltas.py:358, in TimedeltaArray.astype(self, dtype, copy) + 354 return type(self)._simple_new( + 355 res_values, dtype=res_values.dtype, freq=self.freq + 356 ) + 357 else: +--> 358 raise ValueError( + 359 f"Cannot convert from {self.dtype} to {dtype}. " + 360 "Supported resolutions are 's', 'ms', 'us', 'ns'" + 361 ) + 363 return dtl.DatetimeLikeArrayMixin.astype(self, dtype, copy=copy) + +ValueError: Cannot convert from timedelta64[ns] to timedelta64[D]. Supported resolutions are 's', 'ms', 'us', 'ns' +``` + +### UTC and fixed-offset timezones default to standard-library tzinfo objects[#](#utc-and-fixed-offset-timezones-default-to-standard-library-tzinfo-objects "Link to this heading") + +In previous versions, the default `tzinfo` object used to represent UTC +was `pytz.UTC`. In pandas 2.0, we default to `datetime.timezone.utc` instead. +Similarly, for timezones represent fixed UTC offsets, we use `datetime.timezone` +objects instead of `pytz.FixedOffset` objects. See ([GH 34916](https://github.com/pandas-dev/pandas/issues/34916)) + +*Previous behavior*: + +```None +In [2]: ts = pd.Timestamp("2016-01-01", tz="UTC") +In [3]: type(ts.tzinfo) +Out[3]: pytz.UTC + +In [4]: ts2 = pd.Timestamp("2016-01-01 04:05:06-07:00") +In [3]: type(ts2.tzinfo) +Out[5]: pytz._FixedOffset +``` + +*New behavior*: + +```None +In [36]: ts = pd.Timestamp("2016-01-01", tz="UTC") + +In [37]: type(ts.tzinfo) +Out[37]: datetime.timezone + +In [38]: ts2 = pd.Timestamp("2016-01-01 04:05:06-07:00") + +In [39]: type(ts2.tzinfo) +Out[39]: datetime.timezone +``` + +For timezones that are neither UTC nor fixed offsets, e.g. “US/Pacific”, we +continue to default to `pytz` objects. + +### Empty DataFrames/Series will now default to have a `RangeIndex`[#](#empty-dataframes-series-will-now-default-to-have-a-rangeindex "Link to this heading") + +Before, constructing an empty (where `data` is `None` or an empty list-like argument) [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") without +specifying the axes (`index=None`, `columns=None`) would return the axes as empty [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with object dtype. + +Now, the axes return an empty [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") ([GH 49572](https://github.com/pandas-dev/pandas/issues/49572)). + +*Previous behavior*: + +```None +In [8]: pd.Series().index +Out[8]: +Index([], dtype='object') + +In [9] pd.DataFrame().axes +Out[9]: +[Index([], dtype='object'), Index([], dtype='object')] +``` + +*New behavior*: + +```None +In [40]: pd.Series().index +Out[40]: RangeIndex(start=0, stop=0, step=1) + +In [41]: pd.DataFrame().axes +Out[41]: [RangeIndex(start=0, stop=0, step=1), RangeIndex(start=0, stop=0, step=1)] +``` + +### DataFrame to LaTeX has a new render engine[#](#dataframe-to-latex-has-a-new-render-engine "Link to this heading") + +The existing [`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex") has been restructured to utilise the +extended implementation previously available under [`Styler.to_latex()`](../reference/api/pandas.io.formats.style.Styler.to_latex.html#pandas.io.formats.style.Styler.to_latex "pandas.io.formats.style.Styler.to_latex"). +The arguments signature is similar, albeit `col_space` has been removed since +it is ignored by LaTeX engines. This render engine also requires `jinja2` as a +dependency which needs to be installed, since rendering is based upon jinja2 templates. + +The pandas latex options below are no longer used and have been removed. The generic +max rows and columns arguments remain but for this functionality should be replaced +by the Styler equivalents. +The alternative options giving similar functionality are indicated below: + +* `display.latex.escape`: replaced with `styler.format.escape`, +* `display.latex.longtable`: replaced with `styler.latex.environment`, +* `display.latex.multicolumn`, `display.latex.multicolumn_format` and + `display.latex.multirow`: replaced with `styler.sparse.rows`, + `styler.sparse.columns`, `styler.latex.multirow_align` and + `styler.latex.multicol_align`, +* `display.latex.repr`: replaced with `styler.render.repr`, +* `display.max_rows` and `display.max_columns`: replace with + `styler.render.max_rows`, `styler.render.max_columns` and + `styler.render.max_elements`. + +Note that due to this change some defaults have also changed: + +* `multirow` now defaults to *True*. +* `multirow_align` defaults to *“r”* instead of *“l”*. +* `multicol_align` defaults to *“r”* instead of *“l”*. +* `escape` now defaults to *False*. + +Note that the behaviour of `_repr_latex_` is also changed. Previously +setting `display.latex.repr` would generate LaTeX only when using nbconvert for a +JupyterNotebook, and not when the user is running the notebook. Now the +`styler.render.repr` option allows control of the specific output +within JupyterNotebooks for operations (not just on nbconvert). See [GH 39911](https://github.com/pandas-dev/pandas/issues/39911). + +### Increased minimum versions for dependencies[#](#increased-minimum-versions-for-dependencies "Link to this heading") + +Some minimum supported versions of dependencies were updated. +If installed, we now require: + +| Package | Minimum Version | Required | Changed | +| --- | --- | --- | --- | +| mypy (dev) | 1.0 | | X | +| pytest (dev) | 7.0.0 | | X | +| pytest-xdist (dev) | 2.2.0 | | X | +| hypothesis (dev) | 6.34.2 | | X | +| python-dateutil | 2.8.2 | X | X | +| tzdata | 2022.1 | X | X | + +For [optional libraries](https://pandas.pydata.org/docs/getting_started/install.html) the general recommendation is to use the latest version. +The following table lists the lowest version per library that is currently being tested throughout the development of pandas. +Optional libraries below the lowest tested version may still work, but are not considered supported. + +| Package | Minimum Version | Changed | +| --- | --- | --- | +| pyarrow | 7.0.0 | X | +| matplotlib | 3.6.1 | X | +| fastparquet | 0.6.3 | X | +| xarray | 0.21.0 | X | + +See [Dependencies](../getting_started/install.html#install-dependencies) and [Optional dependencies](../getting_started/install.html#install-optional-dependencies) for more. + +### Datetimes are now parsed with a consistent format[#](#datetimes-are-now-parsed-with-a-consistent-format "Link to this heading") + +In the past, [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") guessed the format for each element independently. This was appropriate for some cases where elements had mixed date formats - however, it would regularly cause problems when users expected a consistent format but the function would switch formats between elements. As of version 2.0.0, parsing will use a consistent format, determined by the first non-NA value (unless the user specifies a format, in which case that is used). + +*Old behavior*: + +```None +In [1]: ser = pd.Series(['13-01-2000', '12-01-2000']) +In [2]: pd.to_datetime(ser) +Out[2]: +0 2000-01-13 +1 2000-12-01 +dtype: datetime64[ns] +``` + +*New behavior*: + +```None +In [42]: ser = pd.Series(['13-01-2000', '12-01-2000']) + +In [43]: pd.to_datetime(ser) +Out[43]: +0 2000-01-13 +1 2000-01-12 +dtype: datetime64[ns] +``` + +Note that this affects [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") as well. + +If you still need to parse dates with inconsistent formats, you can use +`format='mixed'` (possibly alongside `dayfirst`) + +```None +ser = pd.Series(['13-01-2000', '12 January 2000']) +pd.to_datetime(ser, format='mixed', dayfirst=True) +``` + +or, if your formats are all ISO8601 (but possibly not identically-formatted) + +```None +ser = pd.Series(['2020-01-01', '2020-01-01 03:00']) +pd.to_datetime(ser, format='ISO8601') +``` + +### Other API changes[#](#other-api-changes "Link to this heading") + +* The `freq`, `tz`, `nanosecond`, and `unit` keywords in the [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") constructor are now keyword-only ([GH 45307](https://github.com/pandas-dev/pandas/issues/45307), [GH 32526](https://github.com/pandas-dev/pandas/issues/32526)) +* Passing `nanoseconds` greater than 999 or less than 0 in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") now raises a `ValueError` ([GH 48538](https://github.com/pandas-dev/pandas/issues/48538), [GH 48255](https://github.com/pandas-dev/pandas/issues/48255)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv"): specifying an incorrect number of columns with `index_col` of now raises `ParserError` instead of `IndexError` when using the c parser. +* Default value of `dtype` in [`get_dummies()`](../reference/api/pandas.get_dummies.html#pandas.get_dummies "pandas.get_dummies") is changed to `bool` from `uint8` ([GH 45848](https://github.com/pandas-dev/pandas/issues/45848)) +* [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype"), [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype"), and `DatetimeIndex.astype()` casting datetime64 data to any of “datetime64[s]”, “datetime64[ms]”, “datetime64[us]” will return an object with the given resolution instead of coercing back to “datetime64[ns]” ([GH 48928](https://github.com/pandas-dev/pandas/issues/48928)) +* [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype"), [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype"), and `DatetimeIndex.astype()` casting timedelta64 data to any of “timedelta64[s]”, “timedelta64[ms]”, “timedelta64[us]” will return an object with the given resolution instead of coercing to “float64” dtype ([GH 48963](https://github.com/pandas-dev/pandas/issues/48963)) +* `DatetimeIndex.astype()`, `TimedeltaIndex.astype()`, `PeriodIndex.astype()` [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype"), [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") with `datetime64`, `timedelta64` or [`PeriodDtype`](../reference/api/pandas.PeriodDtype.html#pandas.PeriodDtype "pandas.PeriodDtype") dtypes no longer allow converting to integer dtypes other than “int64”, do `obj.astype('int64', copy=False).astype(dtype)` instead ([GH 49715](https://github.com/pandas-dev/pandas/issues/49715)) +* [`Index.astype()`](../reference/api/pandas.Index.astype.html#pandas.Index.astype "pandas.Index.astype") now allows casting from `float64` dtype to datetime-like dtypes, matching [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") behavior ([GH 49660](https://github.com/pandas-dev/pandas/issues/49660)) +* Passing data with dtype of “timedelta64[s]”, “timedelta64[ms]”, or “timedelta64[us]” to [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex"), [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructors will now retain that dtype instead of casting to “timedelta64[ns]”; timedelta64 data with lower resolution will be cast to the lowest supported resolution “timedelta64[s]” ([GH 49014](https://github.com/pandas-dev/pandas/issues/49014)) +* Passing `dtype` of “timedelta64[s]”, “timedelta64[ms]”, or “timedelta64[us]” to [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex"), [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructors will now retain that dtype instead of casting to “timedelta64[ns]”; passing a dtype with lower resolution for [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") will be cast to the lowest supported resolution “timedelta64[s]” ([GH 49014](https://github.com/pandas-dev/pandas/issues/49014)) +* Passing a `np.datetime64` object with non-nanosecond resolution to [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") will retain the input resolution if it is “s”, “ms”, “us”, or “ns”; otherwise it will be cast to the closest supported resolution ([GH 49008](https://github.com/pandas-dev/pandas/issues/49008)) +* Passing `datetime64` values with resolution other than nanosecond to [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") will retain the input resolution if it is “s”, “ms”, “us”, or “ns”; otherwise it will be cast to the closest supported resolution ([GH 50369](https://github.com/pandas-dev/pandas/issues/50369)) +* Passing integer values and a non-nanosecond datetime64 dtype (e.g. “datetime64[s]”) [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame"), [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), or [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") will treat the values as multiples of the dtype’s unit, matching the behavior of e.g. `Series(np.array(values, dtype="M8[s]"))` ([GH 51092](https://github.com/pandas-dev/pandas/issues/51092)) +* Passing a string in ISO-8601 format to [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") will retain the resolution of the parsed input if it is “s”, “ms”, “us”, or “ns”; otherwise it will be cast to the closest supported resolution ([GH 49737](https://github.com/pandas-dev/pandas/issues/49737)) +* The `other` argument in [`DataFrame.mask()`](../reference/api/pandas.DataFrame.mask.html#pandas.DataFrame.mask "pandas.DataFrame.mask") and [`Series.mask()`](../reference/api/pandas.Series.mask.html#pandas.Series.mask "pandas.Series.mask") now defaults to `no_default` instead of `np.nan` consistent with [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where") and [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where"). Entries will be filled with the corresponding NULL value (`np.nan` for numpy dtypes, `pd.NA` for extension dtypes). ([GH 49111](https://github.com/pandas-dev/pandas/issues/49111)) +* Changed behavior of [`Series.quantile()`](../reference/api/pandas.Series.quantile.html#pandas.Series.quantile "pandas.Series.quantile") and [`DataFrame.quantile()`](../reference/api/pandas.DataFrame.quantile.html#pandas.DataFrame.quantile "pandas.DataFrame.quantile") with [`SparseDtype`](../reference/api/pandas.SparseDtype.html#pandas.SparseDtype "pandas.SparseDtype") to retain sparse dtype ([GH 49583](https://github.com/pandas-dev/pandas/issues/49583)) +* When creating a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with a object-dtype [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") of datetime objects, pandas no longer silently converts the index to a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") ([GH 39307](https://github.com/pandas-dev/pandas/issues/39307), [GH 23598](https://github.com/pandas-dev/pandas/issues/23598)) +* [`pandas.testing.assert_index_equal()`](../reference/api/pandas.testing.assert_index_equal.html#pandas.testing.assert_index_equal "pandas.testing.assert_index_equal") with parameter `exact="equiv"` now considers two indexes equal when both are either a [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") or [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with an `int64` dtype. Previously it meant either a [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") or a `Int64Index` ([GH 51098](https://github.com/pandas-dev/pandas/issues/51098)) +* [`Series.unique()`](../reference/api/pandas.Series.unique.html#pandas.Series.unique "pandas.Series.unique") with dtype “timedelta64[ns]” or “datetime64[ns]” now returns `TimedeltaArray` or `DatetimeArray` instead of `numpy.ndarray` ([GH 49176](https://github.com/pandas-dev/pandas/issues/49176)) +* [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") and [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") now allow sequences containing both `datetime` objects and numeric entries, matching [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") behavior ([GH 49037](https://github.com/pandas-dev/pandas/issues/49037), [GH 50453](https://github.com/pandas-dev/pandas/issues/50453)) +* [`pandas.api.types.is_string_dtype()`](../reference/api/pandas.api.types.is_string_dtype.html#pandas.api.types.is_string_dtype "pandas.api.types.is_string_dtype") now only returns `True` for array-likes with `dtype=object` when the elements are inferred to be strings ([GH 15585](https://github.com/pandas-dev/pandas/issues/15585)) +* Passing a sequence containing `datetime` objects and `date` objects to [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructor will return with `object` dtype instead of `datetime64[ns]` dtype, consistent with [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") behavior ([GH 49341](https://github.com/pandas-dev/pandas/issues/49341)) +* Passing strings that cannot be parsed as datetimes to [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with `dtype="datetime64[ns]"` will raise instead of silently ignoring the keyword and returning `object` dtype ([GH 24435](https://github.com/pandas-dev/pandas/issues/24435)) +* Passing a sequence containing a type that cannot be converted to [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") to [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta") or to the [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor with `dtype="timedelta64[ns]"` or to [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") now raises `TypeError` instead of `ValueError` ([GH 49525](https://github.com/pandas-dev/pandas/issues/49525)) +* Changed behavior of [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") constructor with sequence containing at least one `NaT` and everything else either `None` or `NaN` to infer `datetime64[ns]` dtype instead of `object`, matching [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") behavior ([GH 49340](https://github.com/pandas-dev/pandas/issues/49340)) +* [`read_stata()`](../reference/api/pandas.read_stata.html#pandas.read_stata "pandas.read_stata") with parameter `index_col` set to `None` (the default) will now set the index on the returned [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") to a [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") instead of a `Int64Index` ([GH 49745](https://github.com/pandas-dev/pandas/issues/49745)) +* Changed behavior of [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") arithmetic methods when working with object-dtypes, the results no longer do type inference on the result of the array operations, use `result.infer_objects(copy=False)` to do type inference on the result ([GH 49999](https://github.com/pandas-dev/pandas/issues/49999), [GH 49714](https://github.com/pandas-dev/pandas/issues/49714)) +* Changed behavior of [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") constructor with an object-dtype `numpy.ndarray` containing all-`bool` values or all-complex values, this will now retain object dtype, consistent with the [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") behavior ([GH 49594](https://github.com/pandas-dev/pandas/issues/49594)) +* Changed behavior of [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") from object-dtype containing `bytes` objects to string dtypes; this now does `val.decode()` on bytes objects instead of `str(val)`, matching [`Index.astype()`](../reference/api/pandas.Index.astype.html#pandas.Index.astype "pandas.Index.astype") behavior ([GH 45326](https://github.com/pandas-dev/pandas/issues/45326)) +* Added `"None"` to default `na_values` in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") ([GH 50286](https://github.com/pandas-dev/pandas/issues/50286)) +* Changed behavior of [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructors when given an integer dtype and floating-point data that is not round numbers, this now raises `ValueError` instead of silently retaining the float dtype; do `Series(data)` or `DataFrame(data)` to get the old behavior, and `Series(data).astype(dtype)` or `DataFrame(data).astype(dtype)` to get the specified dtype ([GH 49599](https://github.com/pandas-dev/pandas/issues/49599)) +* Changed behavior of [`DataFrame.shift()`](../reference/api/pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift") with `axis=1`, an integer `fill_value`, and homogeneous datetime-like dtype, this now fills new columns with integer dtypes instead of casting to datetimelike ([GH 49842](https://github.com/pandas-dev/pandas/issues/49842)) +* Files are now closed when encountering an exception in [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") ([GH 49921](https://github.com/pandas-dev/pandas/issues/49921)) +* Changed behavior of [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv"), [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") & [`read_fwf()`](../reference/api/pandas.read_fwf.html#pandas.read_fwf "pandas.read_fwf"), where the index will now always be a [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex"), when no index is specified. Previously the index would be a [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with dtype `object` if the new DataFrame/Series has length 0 ([GH 49572](https://github.com/pandas-dev/pandas/issues/49572)) +* [`DataFrame.values()`](../reference/api/pandas.DataFrame.values.html#pandas.DataFrame.values "pandas.DataFrame.values"), [`DataFrame.to_numpy()`](../reference/api/pandas.DataFrame.to_numpy.html#pandas.DataFrame.to_numpy "pandas.DataFrame.to_numpy"), [`DataFrame.xs()`](../reference/api/pandas.DataFrame.xs.html#pandas.DataFrame.xs "pandas.DataFrame.xs"), [`DataFrame.reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex"), [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna"), and [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") no longer silently consolidate the underlying arrays; do `df = df.copy()` to ensure consolidation ([GH 49356](https://github.com/pandas-dev/pandas/issues/49356)) +* Creating a new DataFrame using a full slice on both axes with [`loc`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") + or [`iloc`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") (thus, `df.loc[:, :]` or `df.iloc[:, :]`) now returns a + new DataFrame (shallow copy) instead of the original DataFrame, consistent with other + methods to get a full slice (for example `df.loc[:]` or `df[:]`) ([GH 49469](https://github.com/pandas-dev/pandas/issues/49469)) +* The [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructors will now return a shallow copy + (i.e. share data, but not attributes) when passed a Series and DataFrame, + respectively, and with the default of `copy=False` (and if no other keyword triggers + a copy). Previously, the new Series or DataFrame would share the index attribute (e.g. + `df.index = ...` would also update the index of the parent or child) ([GH 49523](https://github.com/pandas-dev/pandas/issues/49523)) +* Disallow computing `cumprod` for [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") object; previously this returned incorrect values ([GH 50246](https://github.com/pandas-dev/pandas/issues/50246)) +* [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") objects read from a `HDFStore` file without an index now have a [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") instead of an `int64` index ([GH 51076](https://github.com/pandas-dev/pandas/issues/51076)) +* Instantiating an [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with an numeric numpy dtype with data containing [`NA`](../reference/api/pandas.NA.html#pandas.NA "pandas.NA") and/or [`NaT`](../reference/api/pandas.NaT.html#pandas.NaT "pandas.NaT") now raises a `ValueError`. Previously a `TypeError` was raised ([GH 51050](https://github.com/pandas-dev/pandas/issues/51050)) +* Loading a JSON file with duplicate columns using `read_json(orient='split')` renames columns to avoid duplicates, as [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") and the other readers do ([GH 50370](https://github.com/pandas-dev/pandas/issues/50370)) +* The levels of the index of the [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") returned from `Series.sparse.from_coo` now always have dtype `int32`. Previously they had dtype `int64` ([GH 50926](https://github.com/pandas-dev/pandas/issues/50926)) +* [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with `unit` of either “Y” or “M” will now raise if a sequence contains a non-round `float` value, matching the `Timestamp` behavior ([GH 50301](https://github.com/pandas-dev/pandas/issues/50301)) +* The methods [`Series.round()`](../reference/api/pandas.Series.round.html#pandas.Series.round "pandas.Series.round"), `DataFrame.__invert__()`, `Series.__invert__()`, [`DataFrame.swapaxes()`](../reference/api/pandas.DataFrame.swapaxes.html#pandas.DataFrame.swapaxes "pandas.DataFrame.swapaxes"), [`DataFrame.first()`](../reference/api/pandas.DataFrame.first.html#pandas.DataFrame.first "pandas.DataFrame.first"), [`DataFrame.last()`](../reference/api/pandas.DataFrame.last.html#pandas.DataFrame.last "pandas.DataFrame.last"), [`Series.first()`](../reference/api/pandas.Series.first.html#pandas.Series.first "pandas.Series.first"), [`Series.last()`](../reference/api/pandas.Series.last.html#pandas.Series.last "pandas.Series.last") and [`DataFrame.align()`](../reference/api/pandas.DataFrame.align.html#pandas.DataFrame.align "pandas.DataFrame.align") will now always return new objects ([GH 51032](https://github.com/pandas-dev/pandas/issues/51032)) +* [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and `DataFrameGroupBy` aggregations (e.g. “sum”) with object-dtype columns no longer infer non-object dtypes for their results, explicitly call `result.infer_objects(copy=False)` on the result to obtain the old behavior ([GH 51205](https://github.com/pandas-dev/pandas/issues/51205), [GH 49603](https://github.com/pandas-dev/pandas/issues/49603)) +* Division by zero with [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") dtypes returns `-inf`, `nan`, or `inf` depending on the numerator, instead of raising ([GH 51541](https://github.com/pandas-dev/pandas/issues/51541)) +* Added [`pandas.api.types.is_any_real_numeric_dtype()`](../reference/api/pandas.api.types.is_any_real_numeric_dtype.html#pandas.api.types.is_any_real_numeric_dtype "pandas.api.types.is_any_real_numeric_dtype") to check for real numeric dtypes ([GH 51152](https://github.com/pandas-dev/pandas/issues/51152)) +* `value_counts()` now returns data with [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with `pyarrow.int64` type instead of `"Int64"` type ([GH 51462](https://github.com/pandas-dev/pandas/issues/51462)) +* [`factorize()`](../reference/api/pandas.factorize.html#pandas.factorize "pandas.factorize") and [`unique()`](../reference/api/pandas.unique.html#pandas.unique "pandas.unique") preserve the original dtype when passed numpy timedelta64 or datetime64 with non-nanosecond resolution ([GH 48670](https://github.com/pandas-dev/pandas/issues/48670)) + +Note + +A current PDEP proposes the deprecation and removal of the keywords `inplace` and `copy` +for all but a small subset of methods from the pandas API. The current discussion takes place +at [here](https://github.com/pandas-dev/pandas/pull/51466). The keywords won’t be necessary +anymore in the context of Copy-on-Write. If this proposal is accepted, both +keywords would be deprecated in the next release of pandas and removed in pandas 3.0. + +## Deprecations[#](#deprecations "Link to this heading") + +* Deprecated parsing datetime strings with system-local timezone to `tzlocal`, pass a `tz` keyword or explicitly call `tz_localize` instead ([GH 50791](https://github.com/pandas-dev/pandas/issues/50791)) +* Deprecated argument `infer_datetime_format` in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") and [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv"), as a strict version of it is now the default ([GH 48621](https://github.com/pandas-dev/pandas/issues/48621)) +* Deprecated behavior of [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with `unit` when parsing strings, in a future version these will be parsed as datetimes (matching unit-less behavior) instead of cast to floats. To retain the old behavior, cast strings to numeric types before calling [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") ([GH 50735](https://github.com/pandas-dev/pandas/issues/50735)) +* Deprecated `pandas.io.sql.execute()` ([GH 50185](https://github.com/pandas-dev/pandas/issues/50185)) +* [`Index.is_boolean()`](../reference/api/pandas.Index.is_boolean.html#pandas.Index.is_boolean "pandas.Index.is_boolean") has been deprecated. Use [`pandas.api.types.is_bool_dtype()`](../reference/api/pandas.api.types.is_bool_dtype.html#pandas.api.types.is_bool_dtype "pandas.api.types.is_bool_dtype") instead ([GH 50042](https://github.com/pandas-dev/pandas/issues/50042)) +* [`Index.is_integer()`](../reference/api/pandas.Index.is_integer.html#pandas.Index.is_integer "pandas.Index.is_integer") has been deprecated. Use [`pandas.api.types.is_integer_dtype()`](../reference/api/pandas.api.types.is_integer_dtype.html#pandas.api.types.is_integer_dtype "pandas.api.types.is_integer_dtype") instead ([GH 50042](https://github.com/pandas-dev/pandas/issues/50042)) +* [`Index.is_floating()`](../reference/api/pandas.Index.is_floating.html#pandas.Index.is_floating "pandas.Index.is_floating") has been deprecated. Use [`pandas.api.types.is_float_dtype()`](../reference/api/pandas.api.types.is_float_dtype.html#pandas.api.types.is_float_dtype "pandas.api.types.is_float_dtype") instead ([GH 50042](https://github.com/pandas-dev/pandas/issues/50042)) +* `Index.holds_integer()` has been deprecated. Use [`pandas.api.types.infer_dtype()`](../reference/api/pandas.api.types.infer_dtype.html#pandas.api.types.infer_dtype "pandas.api.types.infer_dtype") instead ([GH 50243](https://github.com/pandas-dev/pandas/issues/50243)) +* [`Index.is_numeric()`](../reference/api/pandas.Index.is_numeric.html#pandas.Index.is_numeric "pandas.Index.is_numeric") has been deprecated. Use [`pandas.api.types.is_any_real_numeric_dtype()`](../reference/api/pandas.api.types.is_any_real_numeric_dtype.html#pandas.api.types.is_any_real_numeric_dtype "pandas.api.types.is_any_real_numeric_dtype") instead ([GH 50042](https://github.com/pandas-dev/pandas/issues/50042),:issue:51152) +* [`Index.is_categorical()`](../reference/api/pandas.Index.is_categorical.html#pandas.Index.is_categorical "pandas.Index.is_categorical") has been deprecated. Use [`pandas.api.types.is_categorical_dtype()`](../reference/api/pandas.api.types.is_categorical_dtype.html#pandas.api.types.is_categorical_dtype "pandas.api.types.is_categorical_dtype") instead ([GH 50042](https://github.com/pandas-dev/pandas/issues/50042)) +* [`Index.is_object()`](../reference/api/pandas.Index.is_object.html#pandas.Index.is_object "pandas.Index.is_object") has been deprecated. Use [`pandas.api.types.is_object_dtype()`](../reference/api/pandas.api.types.is_object_dtype.html#pandas.api.types.is_object_dtype "pandas.api.types.is_object_dtype") instead ([GH 50042](https://github.com/pandas-dev/pandas/issues/50042)) +* [`Index.is_interval()`](../reference/api/pandas.Index.is_interval.html#pandas.Index.is_interval "pandas.Index.is_interval") has been deprecated. Use [`pandas.api.types.is_interval_dtype()`](../reference/api/pandas.api.types.is_interval_dtype.html#pandas.api.types.is_interval_dtype "pandas.api.types.is_interval_dtype") instead ([GH 50042](https://github.com/pandas-dev/pandas/issues/50042)) +* Deprecated argument `date_parser` in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv"), [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table"), [`read_fwf()`](../reference/api/pandas.read_fwf.html#pandas.read_fwf "pandas.read_fwf"), and [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") in favour of `date_format` ([GH 50601](https://github.com/pandas-dev/pandas/issues/50601)) +* Deprecated `all` and `any` reductions with `datetime64` and [`DatetimeTZDtype`](../reference/api/pandas.DatetimeTZDtype.html#pandas.DatetimeTZDtype "pandas.DatetimeTZDtype") dtypes, use e.g. `(obj != pd.Timestamp(0), tz=obj.tz).all()` instead ([GH 34479](https://github.com/pandas-dev/pandas/issues/34479)) +* Deprecated unused arguments `*args` and `**kwargs` in `Resampler` ([GH 50977](https://github.com/pandas-dev/pandas/issues/50977)) +* Deprecated calling `float` or `int` on a single element [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") to return a `float` or `int` respectively. Extract the element before calling `float` or `int` instead ([GH 51101](https://github.com/pandas-dev/pandas/issues/51101)) +* Deprecated `Grouper.groups()`, use `Groupby.groups()` instead ([GH 51182](https://github.com/pandas-dev/pandas/issues/51182)) +* Deprecated `Grouper.grouper()`, use `Groupby.grouper()` instead ([GH 51182](https://github.com/pandas-dev/pandas/issues/51182)) +* Deprecated `Grouper.obj()`, use `Groupby.obj()` instead ([GH 51206](https://github.com/pandas-dev/pandas/issues/51206)) +* Deprecated `Grouper.indexer()`, use `Resampler.indexer()` instead ([GH 51206](https://github.com/pandas-dev/pandas/issues/51206)) +* Deprecated `Grouper.ax()`, use `Resampler.ax()` instead ([GH 51206](https://github.com/pandas-dev/pandas/issues/51206)) +* Deprecated keyword `use_nullable_dtypes` in [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet"), use `dtype_backend` instead ([GH 51853](https://github.com/pandas-dev/pandas/issues/51853)) +* Deprecated [`Series.pad()`](../reference/api/pandas.Series.pad.html#pandas.Series.pad "pandas.Series.pad") in favor of [`Series.ffill()`](../reference/api/pandas.Series.ffill.html#pandas.Series.ffill "pandas.Series.ffill") ([GH 33396](https://github.com/pandas-dev/pandas/issues/33396)) +* Deprecated [`Series.backfill()`](../reference/api/pandas.Series.backfill.html#pandas.Series.backfill "pandas.Series.backfill") in favor of [`Series.bfill()`](../reference/api/pandas.Series.bfill.html#pandas.Series.bfill "pandas.Series.bfill") ([GH 33396](https://github.com/pandas-dev/pandas/issues/33396)) +* Deprecated [`DataFrame.pad()`](../reference/api/pandas.DataFrame.pad.html#pandas.DataFrame.pad "pandas.DataFrame.pad") in favor of [`DataFrame.ffill()`](../reference/api/pandas.DataFrame.ffill.html#pandas.DataFrame.ffill "pandas.DataFrame.ffill") ([GH 33396](https://github.com/pandas-dev/pandas/issues/33396)) +* Deprecated [`DataFrame.backfill()`](../reference/api/pandas.DataFrame.backfill.html#pandas.DataFrame.backfill "pandas.DataFrame.backfill") in favor of [`DataFrame.bfill()`](../reference/api/pandas.DataFrame.bfill.html#pandas.DataFrame.bfill "pandas.DataFrame.bfill") ([GH 33396](https://github.com/pandas-dev/pandas/issues/33396)) +* Deprecated `close()`. Use `StataReader` as a context manager instead ([GH 49228](https://github.com/pandas-dev/pandas/issues/49228)) +* Deprecated producing a scalar when iterating over a `DataFrameGroupBy` or a `SeriesGroupBy` that has been grouped by a `level` parameter that is a list of length 1; a tuple of length one will be returned instead ([GH 51583](https://github.com/pandas-dev/pandas/issues/51583)) + +## Removal of prior version deprecations/changes[#](#removal-of-prior-version-deprecations-changes "Link to this heading") + +* Removed `Int64Index`, `UInt64Index` and `Float64Index`. See also [here](#whatsnew-200-enhancements-index-can-hold-numpy-numeric-dtypes) for more information ([GH 42717](https://github.com/pandas-dev/pandas/issues/42717)) +* Removed deprecated `Timestamp.freq`, `Timestamp.freqstr` and argument `freq` from the [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") constructor and [`Timestamp.fromordinal()`](../reference/api/pandas.Timestamp.fromordinal.html#pandas.Timestamp.fromordinal "pandas.Timestamp.fromordinal") ([GH 14146](https://github.com/pandas-dev/pandas/issues/14146)) +* Removed deprecated `CategoricalBlock`, `Block.is_categorical()`, require datetime64 and timedelta64 values to be wrapped in `DatetimeArray` or `TimedeltaArray` before passing to `Block.make_block_same_class()`, require `DatetimeTZBlock.values` to have the correct ndim when passing to the `BlockManager` constructor, and removed the “fastpath” keyword from the `SingleBlockManager` constructor ([GH 40226](https://github.com/pandas-dev/pandas/issues/40226), [GH 40571](https://github.com/pandas-dev/pandas/issues/40571)) +* Removed deprecated global option `use_inf_as_null` in favor of `use_inf_as_na` ([GH 17126](https://github.com/pandas-dev/pandas/issues/17126)) +* Removed deprecated module `pandas.core.index` ([GH 30193](https://github.com/pandas-dev/pandas/issues/30193)) +* Removed deprecated alias `pandas.core.tools.datetimes.to_time`, import the function directly from `pandas.core.tools.times` instead ([GH 34145](https://github.com/pandas-dev/pandas/issues/34145)) +* Removed deprecated alias `pandas.io.json.json_normalize`, import the function directly from `pandas.json_normalize` instead ([GH 27615](https://github.com/pandas-dev/pandas/issues/27615)) +* Removed deprecated `Categorical.to_dense()`, use `np.asarray(cat)` instead ([GH 32639](https://github.com/pandas-dev/pandas/issues/32639)) +* Removed deprecated `Categorical.take_nd()` ([GH 27745](https://github.com/pandas-dev/pandas/issues/27745)) +* Removed deprecated `Categorical.mode()`, use `Series(cat).mode()` instead ([GH 45033](https://github.com/pandas-dev/pandas/issues/45033)) +* Removed deprecated `Categorical.is_dtype_equal()` and `CategoricalIndex.is_dtype_equal()` ([GH 37545](https://github.com/pandas-dev/pandas/issues/37545)) +* Removed deprecated `CategoricalIndex.take_nd()` ([GH 30702](https://github.com/pandas-dev/pandas/issues/30702)) +* Removed deprecated `Index.is_type_compatible()` ([GH 42113](https://github.com/pandas-dev/pandas/issues/42113)) +* Removed deprecated `Index.is_mixed()`, check `index.inferred_type` directly instead ([GH 32922](https://github.com/pandas-dev/pandas/issues/32922)) +* Removed deprecated `pandas.api.types.is_categorical()`; use [`pandas.api.types.is_categorical_dtype()`](../reference/api/pandas.api.types.is_categorical_dtype.html#pandas.api.types.is_categorical_dtype "pandas.api.types.is_categorical_dtype") instead ([GH 33385](https://github.com/pandas-dev/pandas/issues/33385)) +* Removed deprecated `Index.asi8()` ([GH 37877](https://github.com/pandas-dev/pandas/issues/37877)) +* Enforced deprecation changing behavior when passing `datetime64[ns]` dtype data and timezone-aware dtype to [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), interpreting the values as wall-times instead of UTC times, matching [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") behavior ([GH 41662](https://github.com/pandas-dev/pandas/issues/41662)) +* Enforced deprecation changing behavior when applying a numpy ufunc on multiple non-aligned (on the index or columns) [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") that will now align the inputs first ([GH 39239](https://github.com/pandas-dev/pandas/issues/39239)) +* Removed deprecated `DataFrame._AXIS_NUMBERS()`, `DataFrame._AXIS_NAMES()`, `Series._AXIS_NUMBERS()`, `Series._AXIS_NAMES()` ([GH 33637](https://github.com/pandas-dev/pandas/issues/33637)) +* Removed deprecated `Index.to_native_types()`, use `obj.astype(str)` instead ([GH 36418](https://github.com/pandas-dev/pandas/issues/36418)) +* Removed deprecated `Series.iteritems()`, `DataFrame.iteritems()`, use `obj.items` instead ([GH 45321](https://github.com/pandas-dev/pandas/issues/45321)) +* Removed deprecated `DataFrame.lookup()` ([GH 35224](https://github.com/pandas-dev/pandas/issues/35224)) +* Removed deprecated `Series.append()`, `DataFrame.append()`, use [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") instead ([GH 35407](https://github.com/pandas-dev/pandas/issues/35407)) +* Removed deprecated `Series.iteritems()`, `DataFrame.iteritems()` and `HDFStore.iteritems()` use `obj.items` instead ([GH 45321](https://github.com/pandas-dev/pandas/issues/45321)) +* Removed deprecated `DatetimeIndex.union_many()` ([GH 45018](https://github.com/pandas-dev/pandas/issues/45018)) +* Removed deprecated `weekofyear` and `week` attributes of `DatetimeArray`, [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") and `dt` accessor in favor of `isocalendar().week` ([GH 33595](https://github.com/pandas-dev/pandas/issues/33595)) +* Removed deprecated `RangeIndex._start()`, `RangeIndex._stop()`, `RangeIndex._step()`, use `start`, `stop`, `step` instead ([GH 30482](https://github.com/pandas-dev/pandas/issues/30482)) +* Removed deprecated `DatetimeIndex.to_perioddelta()`, Use `dtindex - dtindex.to_period(freq).to_timestamp()` instead ([GH 34853](https://github.com/pandas-dev/pandas/issues/34853)) +* Removed deprecated `Styler.hide_index()` and `Styler.hide_columns()` ([GH 49397](https://github.com/pandas-dev/pandas/issues/49397)) +* Removed deprecated `Styler.set_na_rep()` and `Styler.set_precision()` ([GH 49397](https://github.com/pandas-dev/pandas/issues/49397)) +* Removed deprecated `Styler.where()` ([GH 49397](https://github.com/pandas-dev/pandas/issues/49397)) +* Removed deprecated `Styler.render()` ([GH 49397](https://github.com/pandas-dev/pandas/issues/49397)) +* Removed deprecated argument `col_space` in [`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex") ([GH 47970](https://github.com/pandas-dev/pandas/issues/47970)) +* Removed deprecated argument `null_color` in [`Styler.highlight_null()`](../reference/api/pandas.io.formats.style.Styler.highlight_null.html#pandas.io.formats.style.Styler.highlight_null "pandas.io.formats.style.Styler.highlight_null") ([GH 49397](https://github.com/pandas-dev/pandas/issues/49397)) +* Removed deprecated argument `check_less_precise` in `testing.assert_frame_equal()`, `testing.assert_extension_array_equal()`, `testing.assert_series_equal()`, `testing.assert_index_equal()` ([GH 30562](https://github.com/pandas-dev/pandas/issues/30562)) +* Removed deprecated `null_counts` argument in [`DataFrame.info()`](../reference/api/pandas.DataFrame.info.html#pandas.DataFrame.info "pandas.DataFrame.info"). Use `show_counts` instead ([GH 37999](https://github.com/pandas-dev/pandas/issues/37999)) +* Removed deprecated `Index.is_monotonic()`, and `Series.is_monotonic()`; use `obj.is_monotonic_increasing` instead ([GH 45422](https://github.com/pandas-dev/pandas/issues/45422)) +* Removed deprecated `Index.is_all_dates()` ([GH 36697](https://github.com/pandas-dev/pandas/issues/36697)) +* Enforced deprecation disallowing passing a timezone-aware [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") and `dtype="datetime64[ns]"` to [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructors ([GH 41555](https://github.com/pandas-dev/pandas/issues/41555)) +* Enforced deprecation disallowing passing a sequence of timezone-aware values and `dtype="datetime64[ns]"` to to [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructors ([GH 41555](https://github.com/pandas-dev/pandas/issues/41555)) +* Enforced deprecation disallowing `numpy.ma.mrecords.MaskedRecords` in the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor; pass `"{name: data[name] for name in data.dtype.names}` instead ([GH 40363](https://github.com/pandas-dev/pandas/issues/40363)) +* Enforced deprecation disallowing unit-less “datetime64” dtype in [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") and [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") ([GH 47844](https://github.com/pandas-dev/pandas/issues/47844)) +* Enforced deprecation disallowing using `.astype` to convert a `datetime64[ns]` [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame"), or [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") to timezone-aware dtype, use `obj.tz_localize` or `ser.dt.tz_localize` instead ([GH 39258](https://github.com/pandas-dev/pandas/issues/39258)) +* Enforced deprecation disallowing using `.astype` to convert a timezone-aware [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame"), or [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") to timezone-naive `datetime64[ns]` dtype, use `obj.tz_localize(None)` or `obj.tz_convert("UTC").tz_localize(None)` instead ([GH 39258](https://github.com/pandas-dev/pandas/issues/39258)) +* Enforced deprecation disallowing passing non boolean argument to sort in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") ([GH 44629](https://github.com/pandas-dev/pandas/issues/44629)) +* Removed Date parser functions `parse_date_time()`, + `parse_date_fields()`, `parse_all_fields()` + and `generic_parser()` ([GH 24518](https://github.com/pandas-dev/pandas/issues/24518)) +* Removed argument `index` from the `core.arrays.SparseArray` constructor ([GH 43523](https://github.com/pandas-dev/pandas/issues/43523)) +* Remove argument `squeeze` from [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") and [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") ([GH 32380](https://github.com/pandas-dev/pandas/issues/32380)) +* Removed deprecated `apply`, `apply_index`, `__call__`, `onOffset`, and `isAnchored` attributes from `DateOffset` ([GH 34171](https://github.com/pandas-dev/pandas/issues/34171)) +* Removed `keep_tz` argument in [`DatetimeIndex.to_series()`](../reference/api/pandas.DatetimeIndex.to_series.html#pandas.DatetimeIndex.to_series "pandas.DatetimeIndex.to_series") ([GH 29731](https://github.com/pandas-dev/pandas/issues/29731)) +* Remove arguments `names` and `dtype` from [`Index.copy()`](../reference/api/pandas.Index.copy.html#pandas.Index.copy "pandas.Index.copy") and `levels` and `codes` from [`MultiIndex.copy()`](../reference/api/pandas.MultiIndex.copy.html#pandas.MultiIndex.copy "pandas.MultiIndex.copy") ([GH 35853](https://github.com/pandas-dev/pandas/issues/35853), [GH 36685](https://github.com/pandas-dev/pandas/issues/36685)) +* Remove argument `inplace` from [`MultiIndex.set_levels()`](../reference/api/pandas.MultiIndex.set_levels.html#pandas.MultiIndex.set_levels "pandas.MultiIndex.set_levels") and [`MultiIndex.set_codes()`](../reference/api/pandas.MultiIndex.set_codes.html#pandas.MultiIndex.set_codes "pandas.MultiIndex.set_codes") ([GH 35626](https://github.com/pandas-dev/pandas/issues/35626)) +* Removed arguments `verbose` and `encoding` from [`DataFrame.to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel") and [`Series.to_excel()`](../reference/api/pandas.Series.to_excel.html#pandas.Series.to_excel "pandas.Series.to_excel") ([GH 47912](https://github.com/pandas-dev/pandas/issues/47912)) +* Removed argument `line_terminator` from [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") and [`Series.to_csv()`](../reference/api/pandas.Series.to_csv.html#pandas.Series.to_csv "pandas.Series.to_csv"), use `lineterminator` instead ([GH 45302](https://github.com/pandas-dev/pandas/issues/45302)) +* Removed argument `inplace` from [`DataFrame.set_axis()`](../reference/api/pandas.DataFrame.set_axis.html#pandas.DataFrame.set_axis "pandas.DataFrame.set_axis") and [`Series.set_axis()`](../reference/api/pandas.Series.set_axis.html#pandas.Series.set_axis "pandas.Series.set_axis"), use `obj = obj.set_axis(..., copy=False)` instead ([GH 48130](https://github.com/pandas-dev/pandas/issues/48130)) +* Disallow passing positional arguments to [`MultiIndex.set_levels()`](../reference/api/pandas.MultiIndex.set_levels.html#pandas.MultiIndex.set_levels "pandas.MultiIndex.set_levels") and [`MultiIndex.set_codes()`](../reference/api/pandas.MultiIndex.set_codes.html#pandas.MultiIndex.set_codes "pandas.MultiIndex.set_codes") ([GH 41485](https://github.com/pandas-dev/pandas/issues/41485)) +* Disallow parsing to Timedelta strings with components with units “Y”, “y”, or “M”, as these do not represent unambiguous durations ([GH 36838](https://github.com/pandas-dev/pandas/issues/36838)) +* Removed `MultiIndex.is_lexsorted()` and `MultiIndex.lexsort_depth()` ([GH 38701](https://github.com/pandas-dev/pandas/issues/38701)) +* Removed argument `how` from `PeriodIndex.astype()`, use [`PeriodIndex.to_timestamp()`](../reference/api/pandas.PeriodIndex.to_timestamp.html#pandas.PeriodIndex.to_timestamp "pandas.PeriodIndex.to_timestamp") instead ([GH 37982](https://github.com/pandas-dev/pandas/issues/37982)) +* Removed argument `try_cast` from [`DataFrame.mask()`](../reference/api/pandas.DataFrame.mask.html#pandas.DataFrame.mask "pandas.DataFrame.mask"), [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where"), [`Series.mask()`](../reference/api/pandas.Series.mask.html#pandas.Series.mask "pandas.Series.mask") and [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where") ([GH 38836](https://github.com/pandas-dev/pandas/issues/38836)) +* Removed argument `tz` from [`Period.to_timestamp()`](../reference/api/pandas.Period.to_timestamp.html#pandas.Period.to_timestamp "pandas.Period.to_timestamp"), use `obj.to_timestamp(...).tz_localize(tz)` instead ([GH 34522](https://github.com/pandas-dev/pandas/issues/34522)) +* Removed argument `sort_columns` in [`DataFrame.plot()`](../reference/api/pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") and [`Series.plot()`](../reference/api/pandas.Series.plot.html#pandas.Series.plot "pandas.Series.plot") ([GH 47563](https://github.com/pandas-dev/pandas/issues/47563)) +* Removed argument `is_copy` from [`DataFrame.take()`](../reference/api/pandas.DataFrame.take.html#pandas.DataFrame.take "pandas.DataFrame.take") and [`Series.take()`](../reference/api/pandas.Series.take.html#pandas.Series.take "pandas.Series.take") ([GH 30615](https://github.com/pandas-dev/pandas/issues/30615)) +* Removed argument `kind` from [`Index.get_slice_bound()`](../reference/api/pandas.Index.get_slice_bound.html#pandas.Index.get_slice_bound "pandas.Index.get_slice_bound"), [`Index.slice_indexer()`](../reference/api/pandas.Index.slice_indexer.html#pandas.Index.slice_indexer "pandas.Index.slice_indexer") and [`Index.slice_locs()`](../reference/api/pandas.Index.slice_locs.html#pandas.Index.slice_locs "pandas.Index.slice_locs") ([GH 41378](https://github.com/pandas-dev/pandas/issues/41378)) +* Removed arguments `prefix`, `squeeze`, `error_bad_lines` and `warn_bad_lines` from [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") ([GH 40413](https://github.com/pandas-dev/pandas/issues/40413), [GH 43427](https://github.com/pandas-dev/pandas/issues/43427)) +* Removed arguments `squeeze` from [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") ([GH 43427](https://github.com/pandas-dev/pandas/issues/43427)) +* Removed argument `datetime_is_numeric` from [`DataFrame.describe()`](../reference/api/pandas.DataFrame.describe.html#pandas.DataFrame.describe "pandas.DataFrame.describe") and [`Series.describe()`](../reference/api/pandas.Series.describe.html#pandas.Series.describe "pandas.Series.describe") as datetime data will always be summarized as numeric data ([GH 34798](https://github.com/pandas-dev/pandas/issues/34798)) +* Disallow passing list `key` to [`Series.xs()`](../reference/api/pandas.Series.xs.html#pandas.Series.xs "pandas.Series.xs") and [`DataFrame.xs()`](../reference/api/pandas.DataFrame.xs.html#pandas.DataFrame.xs "pandas.DataFrame.xs"), pass a tuple instead ([GH 41789](https://github.com/pandas-dev/pandas/issues/41789)) +* Disallow subclass-specific keywords (e.g. “freq”, “tz”, “names”, “closed”) in the [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") constructor ([GH 38597](https://github.com/pandas-dev/pandas/issues/38597)) +* Removed argument `inplace` from `Categorical.remove_unused_categories()` ([GH 37918](https://github.com/pandas-dev/pandas/issues/37918)) +* Disallow passing non-round floats to [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") with `unit="M"` or `unit="Y"` ([GH 47266](https://github.com/pandas-dev/pandas/issues/47266)) +* Remove keywords `convert_float` and `mangle_dupe_cols` from [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") ([GH 41176](https://github.com/pandas-dev/pandas/issues/41176)) +* Remove keyword `mangle_dupe_cols` from [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") and [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") ([GH 48137](https://github.com/pandas-dev/pandas/issues/48137)) +* Removed `errors` keyword from [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where"), [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where"), [`DataFrame.mask()`](../reference/api/pandas.DataFrame.mask.html#pandas.DataFrame.mask "pandas.DataFrame.mask") and [`Series.mask()`](../reference/api/pandas.Series.mask.html#pandas.Series.mask "pandas.Series.mask") ([GH 47728](https://github.com/pandas-dev/pandas/issues/47728)) +* Disallow passing non-keyword arguments to [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") except `io` and `sheet_name` ([GH 34418](https://github.com/pandas-dev/pandas/issues/34418)) +* Disallow passing non-keyword arguments to [`DataFrame.drop()`](../reference/api/pandas.DataFrame.drop.html#pandas.DataFrame.drop "pandas.DataFrame.drop") and [`Series.drop()`](../reference/api/pandas.Series.drop.html#pandas.Series.drop "pandas.Series.drop") except `labels` ([GH 41486](https://github.com/pandas-dev/pandas/issues/41486)) +* Disallow passing non-keyword arguments to [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") and [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") except `value` ([GH 41485](https://github.com/pandas-dev/pandas/issues/41485)) +* Disallow passing non-keyword arguments to `StringMethods.split()` and `StringMethods.rsplit()` except for `pat` ([GH 47448](https://github.com/pandas-dev/pandas/issues/47448)) +* Disallow passing non-keyword arguments to [`DataFrame.set_index()`](../reference/api/pandas.DataFrame.set_index.html#pandas.DataFrame.set_index "pandas.DataFrame.set_index") except `keys` ([GH 41495](https://github.com/pandas-dev/pandas/issues/41495)) +* Disallow passing non-keyword arguments to `Resampler.interpolate()` except `method` ([GH 41699](https://github.com/pandas-dev/pandas/issues/41699)) +* Disallow passing non-keyword arguments to [`DataFrame.reset_index()`](../reference/api/pandas.DataFrame.reset_index.html#pandas.DataFrame.reset_index "pandas.DataFrame.reset_index") and [`Series.reset_index()`](../reference/api/pandas.Series.reset_index.html#pandas.Series.reset_index "pandas.Series.reset_index") except `level` ([GH 41496](https://github.com/pandas-dev/pandas/issues/41496)) +* Disallow passing non-keyword arguments to [`DataFrame.dropna()`](../reference/api/pandas.DataFrame.dropna.html#pandas.DataFrame.dropna "pandas.DataFrame.dropna") and [`Series.dropna()`](../reference/api/pandas.Series.dropna.html#pandas.Series.dropna "pandas.Series.dropna") ([GH 41504](https://github.com/pandas-dev/pandas/issues/41504)) +* Disallow passing non-keyword arguments to `ExtensionArray.argsort()` ([GH 46134](https://github.com/pandas-dev/pandas/issues/46134)) +* Disallow passing non-keyword arguments to `Categorical.sort_values()` ([GH 47618](https://github.com/pandas-dev/pandas/issues/47618)) +* Disallow passing non-keyword arguments to [`Index.drop_duplicates()`](../reference/api/pandas.Index.drop_duplicates.html#pandas.Index.drop_duplicates "pandas.Index.drop_duplicates") and [`Series.drop_duplicates()`](../reference/api/pandas.Series.drop_duplicates.html#pandas.Series.drop_duplicates "pandas.Series.drop_duplicates") ([GH 41485](https://github.com/pandas-dev/pandas/issues/41485)) +* Disallow passing non-keyword arguments to [`DataFrame.drop_duplicates()`](../reference/api/pandas.DataFrame.drop_duplicates.html#pandas.DataFrame.drop_duplicates "pandas.DataFrame.drop_duplicates") except for `subset` ([GH 41485](https://github.com/pandas-dev/pandas/issues/41485)) +* Disallow passing non-keyword arguments to [`DataFrame.sort_index()`](../reference/api/pandas.DataFrame.sort_index.html#pandas.DataFrame.sort_index "pandas.DataFrame.sort_index") and [`Series.sort_index()`](../reference/api/pandas.Series.sort_index.html#pandas.Series.sort_index "pandas.Series.sort_index") ([GH 41506](https://github.com/pandas-dev/pandas/issues/41506)) +* Disallow passing non-keyword arguments to [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") and [`Series.interpolate()`](../reference/api/pandas.Series.interpolate.html#pandas.Series.interpolate "pandas.Series.interpolate") except for `method` ([GH 41510](https://github.com/pandas-dev/pandas/issues/41510)) +* Disallow passing non-keyword arguments to [`DataFrame.any()`](../reference/api/pandas.DataFrame.any.html#pandas.DataFrame.any "pandas.DataFrame.any") and [`Series.any()`](../reference/api/pandas.Series.any.html#pandas.Series.any "pandas.Series.any") ([GH 44896](https://github.com/pandas-dev/pandas/issues/44896)) +* Disallow passing non-keyword arguments to [`Index.set_names()`](../reference/api/pandas.Index.set_names.html#pandas.Index.set_names "pandas.Index.set_names") except for `names` ([GH 41551](https://github.com/pandas-dev/pandas/issues/41551)) +* Disallow passing non-keyword arguments to [`Index.join()`](../reference/api/pandas.Index.join.html#pandas.Index.join "pandas.Index.join") except for `other` ([GH 46518](https://github.com/pandas-dev/pandas/issues/46518)) +* Disallow passing non-keyword arguments to [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") except for `objs` ([GH 41485](https://github.com/pandas-dev/pandas/issues/41485)) +* Disallow passing non-keyword arguments to [`pivot()`](../reference/api/pandas.pivot.html#pandas.pivot "pandas.pivot") except for `data` ([GH 48301](https://github.com/pandas-dev/pandas/issues/48301)) +* Disallow passing non-keyword arguments to [`DataFrame.pivot()`](../reference/api/pandas.DataFrame.pivot.html#pandas.DataFrame.pivot "pandas.DataFrame.pivot") ([GH 48301](https://github.com/pandas-dev/pandas/issues/48301)) +* Disallow passing non-keyword arguments to [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") except for `io` ([GH 27573](https://github.com/pandas-dev/pandas/issues/27573)) +* Disallow passing non-keyword arguments to [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") except for `path_or_buf` ([GH 27573](https://github.com/pandas-dev/pandas/issues/27573)) +* Disallow passing non-keyword arguments to [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") except for `filepath_or_buffer` ([GH 47154](https://github.com/pandas-dev/pandas/issues/47154)) +* Disallow passing non-keyword arguments to [`read_stata()`](../reference/api/pandas.read_stata.html#pandas.read_stata "pandas.read_stata") except for `filepath_or_buffer` ([GH 48128](https://github.com/pandas-dev/pandas/issues/48128)) +* Disallow passing non-keyword arguments to [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") except `filepath_or_buffer` ([GH 41485](https://github.com/pandas-dev/pandas/issues/41485)) +* Disallow passing non-keyword arguments to [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") except `filepath_or_buffer` ([GH 41485](https://github.com/pandas-dev/pandas/issues/41485)) +* Disallow passing non-keyword arguments to [`read_fwf()`](../reference/api/pandas.read_fwf.html#pandas.read_fwf "pandas.read_fwf") except `filepath_or_buffer` ([GH 44710](https://github.com/pandas-dev/pandas/issues/44710)) +* Disallow passing non-keyword arguments to [`read_xml()`](../reference/api/pandas.read_xml.html#pandas.read_xml "pandas.read_xml") except for `path_or_buffer` ([GH 45133](https://github.com/pandas-dev/pandas/issues/45133)) +* Disallow passing non-keyword arguments to [`Series.mask()`](../reference/api/pandas.Series.mask.html#pandas.Series.mask "pandas.Series.mask") and [`DataFrame.mask()`](../reference/api/pandas.DataFrame.mask.html#pandas.DataFrame.mask "pandas.DataFrame.mask") except `cond` and `other` ([GH 41580](https://github.com/pandas-dev/pandas/issues/41580)) +* Disallow passing non-keyword arguments to [`DataFrame.to_stata()`](../reference/api/pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata") except for `path` ([GH 48128](https://github.com/pandas-dev/pandas/issues/48128)) +* Disallow passing non-keyword arguments to [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where") and [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where") except for `cond` and `other` ([GH 41523](https://github.com/pandas-dev/pandas/issues/41523)) +* Disallow passing non-keyword arguments to [`Series.set_axis()`](../reference/api/pandas.Series.set_axis.html#pandas.Series.set_axis "pandas.Series.set_axis") and [`DataFrame.set_axis()`](../reference/api/pandas.DataFrame.set_axis.html#pandas.DataFrame.set_axis "pandas.DataFrame.set_axis") except for `labels` ([GH 41491](https://github.com/pandas-dev/pandas/issues/41491)) +* Disallow passing non-keyword arguments to [`Series.rename_axis()`](../reference/api/pandas.Series.rename_axis.html#pandas.Series.rename_axis "pandas.Series.rename_axis") and [`DataFrame.rename_axis()`](../reference/api/pandas.DataFrame.rename_axis.html#pandas.DataFrame.rename_axis "pandas.DataFrame.rename_axis") except for `mapper` ([GH 47587](https://github.com/pandas-dev/pandas/issues/47587)) +* Disallow passing non-keyword arguments to [`Series.clip()`](../reference/api/pandas.Series.clip.html#pandas.Series.clip "pandas.Series.clip") and [`DataFrame.clip()`](../reference/api/pandas.DataFrame.clip.html#pandas.DataFrame.clip "pandas.DataFrame.clip") except `lower` and `upper` ([GH 41511](https://github.com/pandas-dev/pandas/issues/41511)) +* Disallow passing non-keyword arguments to [`Series.bfill()`](../reference/api/pandas.Series.bfill.html#pandas.Series.bfill "pandas.Series.bfill"), [`Series.ffill()`](../reference/api/pandas.Series.ffill.html#pandas.Series.ffill "pandas.Series.ffill"), [`DataFrame.bfill()`](../reference/api/pandas.DataFrame.bfill.html#pandas.DataFrame.bfill "pandas.DataFrame.bfill") and [`DataFrame.ffill()`](../reference/api/pandas.DataFrame.ffill.html#pandas.DataFrame.ffill "pandas.DataFrame.ffill") ([GH 41508](https://github.com/pandas-dev/pandas/issues/41508)) +* Disallow passing non-keyword arguments to [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace"), [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") except for `to_replace` and `value` ([GH 47587](https://github.com/pandas-dev/pandas/issues/47587)) +* Disallow passing non-keyword arguments to [`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values") except for `by` ([GH 41505](https://github.com/pandas-dev/pandas/issues/41505)) +* Disallow passing non-keyword arguments to [`Series.sort_values()`](../reference/api/pandas.Series.sort_values.html#pandas.Series.sort_values "pandas.Series.sort_values") ([GH 41505](https://github.com/pandas-dev/pandas/issues/41505)) +* Disallow passing non-keyword arguments to [`DataFrame.reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex") except for `labels` ([GH 17966](https://github.com/pandas-dev/pandas/issues/17966)) +* Disallow [`Index.reindex()`](../reference/api/pandas.Index.reindex.html#pandas.Index.reindex "pandas.Index.reindex") with non-unique [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") objects ([GH 42568](https://github.com/pandas-dev/pandas/issues/42568)) +* Disallowed constructing [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") with scalar `data` ([GH 38433](https://github.com/pandas-dev/pandas/issues/38433)) +* Disallowed constructing [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") without passing `data` ([GH 38944](https://github.com/pandas-dev/pandas/issues/38944)) +* Removed `Rolling.validate()`, `Expanding.validate()`, and `ExponentialMovingWindow.validate()` ([GH 43665](https://github.com/pandas-dev/pandas/issues/43665)) +* Removed `Rolling.win_type` returning `"freq"` ([GH 38963](https://github.com/pandas-dev/pandas/issues/38963)) +* Removed `Rolling.is_datetimelike` ([GH 38963](https://github.com/pandas-dev/pandas/issues/38963)) +* Removed the `level` keyword in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") aggregations; use `groupby` instead ([GH 39983](https://github.com/pandas-dev/pandas/issues/39983)) +* Removed deprecated `Timedelta.delta()`, `Timedelta.is_populated()`, and `Timedelta.freq` ([GH 46430](https://github.com/pandas-dev/pandas/issues/46430), [GH 46476](https://github.com/pandas-dev/pandas/issues/46476)) +* Removed deprecated `NaT.freq` ([GH 45071](https://github.com/pandas-dev/pandas/issues/45071)) +* Removed deprecated `Categorical.replace()`, use [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") instead ([GH 44929](https://github.com/pandas-dev/pandas/issues/44929)) +* Removed the `numeric_only` keyword from `Categorical.min()` and `Categorical.max()` in favor of `skipna` ([GH 48821](https://github.com/pandas-dev/pandas/issues/48821)) +* Changed behavior of [`DataFrame.median()`](../reference/api/pandas.DataFrame.median.html#pandas.DataFrame.median "pandas.DataFrame.median") and [`DataFrame.mean()`](../reference/api/pandas.DataFrame.mean.html#pandas.DataFrame.mean "pandas.DataFrame.mean") with `numeric_only=None` to not exclude datetime-like columns THIS NOTE WILL BE IRRELEVANT ONCE `numeric_only=None` DEPRECATION IS ENFORCED ([GH 29941](https://github.com/pandas-dev/pandas/issues/29941)) +* Removed `is_extension_type()` in favor of `is_extension_array_dtype()` ([GH 29457](https://github.com/pandas-dev/pandas/issues/29457)) +* Removed `.ExponentialMovingWindow.vol` ([GH 39220](https://github.com/pandas-dev/pandas/issues/39220)) +* Removed `Index.get_value()` and `Index.set_value()` ([GH 33907](https://github.com/pandas-dev/pandas/issues/33907), [GH 28621](https://github.com/pandas-dev/pandas/issues/28621)) +* Removed `Series.slice_shift()` and `DataFrame.slice_shift()` ([GH 37601](https://github.com/pandas-dev/pandas/issues/37601)) +* Remove `DataFrameGroupBy.pad()` and `DataFrameGroupBy.backfill()` ([GH 45076](https://github.com/pandas-dev/pandas/issues/45076)) +* Remove `numpy` argument from [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") ([GH 30636](https://github.com/pandas-dev/pandas/issues/30636)) +* Disallow passing abbreviations for `orient` in [`DataFrame.to_dict()`](../reference/api/pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict") ([GH 32516](https://github.com/pandas-dev/pandas/issues/32516)) +* Disallow partial slicing on an non-monotonic [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with keys which are not in Index. This now raises a `KeyError` ([GH 18531](https://github.com/pandas-dev/pandas/issues/18531)) +* Removed `get_offset` in favor of `to_offset()` ([GH 30340](https://github.com/pandas-dev/pandas/issues/30340)) +* Removed the `warn` keyword in [`infer_freq()`](../reference/api/pandas.infer_freq.html#pandas.infer_freq "pandas.infer_freq") ([GH 45947](https://github.com/pandas-dev/pandas/issues/45947)) +* Removed the `include_start` and `include_end` arguments in [`DataFrame.between_time()`](../reference/api/pandas.DataFrame.between_time.html#pandas.DataFrame.between_time "pandas.DataFrame.between_time") in favor of `inclusive` ([GH 43248](https://github.com/pandas-dev/pandas/issues/43248)) +* Removed the `closed` argument in [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range") and [`bdate_range()`](../reference/api/pandas.bdate_range.html#pandas.bdate_range "pandas.bdate_range") in favor of `inclusive` argument ([GH 40245](https://github.com/pandas-dev/pandas/issues/40245)) +* Removed the `center` keyword in [`DataFrame.expanding()`](../reference/api/pandas.DataFrame.expanding.html#pandas.DataFrame.expanding "pandas.DataFrame.expanding") ([GH 20647](https://github.com/pandas-dev/pandas/issues/20647)) +* Removed the `truediv` keyword from [`eval()`](../reference/api/pandas.eval.html#pandas.eval "pandas.eval") ([GH 29812](https://github.com/pandas-dev/pandas/issues/29812)) +* Removed the `method` and `tolerance` arguments in [`Index.get_loc()`](../reference/api/pandas.Index.get_loc.html#pandas.Index.get_loc "pandas.Index.get_loc"). Use `index.get_indexer([label], method=..., tolerance=...)` instead ([GH 42269](https://github.com/pandas-dev/pandas/issues/42269)) +* Removed the `pandas.datetime` submodule ([GH 30489](https://github.com/pandas-dev/pandas/issues/30489)) +* Removed the `pandas.np` submodule ([GH 30296](https://github.com/pandas-dev/pandas/issues/30296)) +* Removed `pandas.util.testing` in favor of `pandas.testing` ([GH 30745](https://github.com/pandas-dev/pandas/issues/30745)) +* Removed `Series.str.__iter__()` ([GH 28277](https://github.com/pandas-dev/pandas/issues/28277)) +* Removed `pandas.SparseArray` in favor of [`arrays.SparseArray`](../reference/api/pandas.arrays.SparseArray.html#pandas.arrays.SparseArray "pandas.arrays.SparseArray") ([GH 30642](https://github.com/pandas-dev/pandas/issues/30642)) +* Removed `pandas.SparseSeries` and `pandas.SparseDataFrame`, including pickle support. ([GH 30642](https://github.com/pandas-dev/pandas/issues/30642)) +* Enforced disallowing passing an integer `fill_value` to [`DataFrame.shift()`](../reference/api/pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift") and `` Series.shift`() `` with datetime64, timedelta64, or period dtypes ([GH 32591](https://github.com/pandas-dev/pandas/issues/32591)) +* Enforced disallowing a string column label into `times` in [`DataFrame.ewm()`](../reference/api/pandas.DataFrame.ewm.html#pandas.DataFrame.ewm "pandas.DataFrame.ewm") ([GH 43265](https://github.com/pandas-dev/pandas/issues/43265)) +* Enforced disallowing passing `True` and `False` into `inclusive` in [`Series.between()`](../reference/api/pandas.Series.between.html#pandas.Series.between "pandas.Series.between") in favor of `"both"` and `"neither"` respectively ([GH 40628](https://github.com/pandas-dev/pandas/issues/40628)) +* Enforced disallowing using `usecols` with out of bounds indices for `read_csv` with `engine="c"` ([GH 25623](https://github.com/pandas-dev/pandas/issues/25623)) +* Enforced disallowing the use of `**kwargs` in [`ExcelWriter`](../reference/api/pandas.ExcelWriter.html#pandas.ExcelWriter "pandas.ExcelWriter"); use the keyword argument `engine_kwargs` instead ([GH 40430](https://github.com/pandas-dev/pandas/issues/40430)) +* Enforced disallowing a tuple of column labels into `DataFrameGroupBy.__getitem__()` ([GH 30546](https://github.com/pandas-dev/pandas/issues/30546)) +* Enforced disallowing missing labels when indexing with a sequence of labels on a level of a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex"). This now raises a `KeyError` ([GH 42351](https://github.com/pandas-dev/pandas/issues/42351)) +* Enforced disallowing setting values with `.loc` using a positional slice. Use `.loc` with labels or `.iloc` with positions instead ([GH 31840](https://github.com/pandas-dev/pandas/issues/31840)) +* Enforced disallowing positional indexing with a `float` key even if that key is a round number, manually cast to integer instead ([GH 34193](https://github.com/pandas-dev/pandas/issues/34193)) +* Enforced disallowing using a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") indexer with `.iloc`, use `.loc` instead for automatic alignment ([GH 39022](https://github.com/pandas-dev/pandas/issues/39022)) +* Enforced disallowing `set` or `dict` indexers in `__getitem__` and `__setitem__` methods ([GH 42825](https://github.com/pandas-dev/pandas/issues/42825)) +* Enforced disallowing indexing on a [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") or positional indexing on a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") producing multi-dimensional objects e.g. `obj[:, None]`, convert to numpy before indexing instead ([GH 35141](https://github.com/pandas-dev/pandas/issues/35141)) +* Enforced disallowing `dict` or `set` objects in `suffixes` in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") ([GH 34810](https://github.com/pandas-dev/pandas/issues/34810)) +* Enforced disallowing [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") to produce duplicated columns through the `suffixes` keyword and already existing columns ([GH 22818](https://github.com/pandas-dev/pandas/issues/22818)) +* Enforced disallowing using [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") or `join()` on a different number of levels ([GH 34862](https://github.com/pandas-dev/pandas/issues/34862)) +* Enforced disallowing `value_name` argument in [`DataFrame.melt()`](../reference/api/pandas.DataFrame.melt.html#pandas.DataFrame.melt "pandas.DataFrame.melt") to match an element in the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") columns ([GH 35003](https://github.com/pandas-dev/pandas/issues/35003)) +* Enforced disallowing passing `showindex` into `**kwargs` in [`DataFrame.to_markdown()`](../reference/api/pandas.DataFrame.to_markdown.html#pandas.DataFrame.to_markdown "pandas.DataFrame.to_markdown") and [`Series.to_markdown()`](../reference/api/pandas.Series.to_markdown.html#pandas.Series.to_markdown "pandas.Series.to_markdown") in favor of `index` ([GH 33091](https://github.com/pandas-dev/pandas/issues/33091)) +* Removed setting Categorical.\_codes directly ([GH 41429](https://github.com/pandas-dev/pandas/issues/41429)) +* Removed setting Categorical.categories directly ([GH 47834](https://github.com/pandas-dev/pandas/issues/47834)) +* Removed argument `inplace` from `Categorical.add_categories()`, `Categorical.remove_categories()`, `Categorical.set_categories()`, `Categorical.rename_categories()`, `Categorical.reorder_categories()`, `Categorical.set_ordered()`, `Categorical.as_ordered()`, `Categorical.as_unordered()` ([GH 37981](https://github.com/pandas-dev/pandas/issues/37981), [GH 41118](https://github.com/pandas-dev/pandas/issues/41118), [GH 41133](https://github.com/pandas-dev/pandas/issues/41133), [GH 47834](https://github.com/pandas-dev/pandas/issues/47834)) +* Enforced `Rolling.count()` with `min_periods=None` to default to the size of the window ([GH 31302](https://github.com/pandas-dev/pandas/issues/31302)) +* Renamed `fname` to `path` in [`DataFrame.to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet"), [`DataFrame.to_stata()`](../reference/api/pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata") and [`DataFrame.to_feather()`](../reference/api/pandas.DataFrame.to_feather.html#pandas.DataFrame.to_feather "pandas.DataFrame.to_feather") ([GH 30338](https://github.com/pandas-dev/pandas/issues/30338)) +* Enforced disallowing indexing a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with a single item list with a slice (e.g. `ser[[slice(0, 2)]]`). Either convert the list to tuple, or pass the slice directly instead ([GH 31333](https://github.com/pandas-dev/pandas/issues/31333)) +* Changed behavior indexing on a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") index using a string indexer, previously this operated as a slice on rows, now it operates like any other column key; use `frame.loc[key]` for the old behavior ([GH 36179](https://github.com/pandas-dev/pandas/issues/36179)) +* Enforced the `display.max_colwidth` option to not accept negative integers ([GH 31569](https://github.com/pandas-dev/pandas/issues/31569)) +* Removed the `display.column_space` option in favor of `df.to_string(col_space=...)` ([GH 47280](https://github.com/pandas-dev/pandas/issues/47280)) +* Removed the deprecated method `mad` from pandas classes ([GH 11787](https://github.com/pandas-dev/pandas/issues/11787)) +* Removed the deprecated method `tshift` from pandas classes ([GH 11631](https://github.com/pandas-dev/pandas/issues/11631)) +* Changed behavior of empty data passed into [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"); the default dtype will be `object` instead of `float64` ([GH 29405](https://github.com/pandas-dev/pandas/issues/29405)) +* Changed the behavior of `DatetimeIndex.union()`, `DatetimeIndex.intersection()`, and `DatetimeIndex.symmetric_difference()` with mismatched timezones to convert to UTC instead of casting to object dtype ([GH 39328](https://github.com/pandas-dev/pandas/issues/39328)) +* Changed the behavior of [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with argument “now” with `utc=False` to match `Timestamp("now")` ([GH 18705](https://github.com/pandas-dev/pandas/issues/18705)) +* Changed the behavior of indexing on a timezone-aware [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with a timezone-naive `datetime` object or vice-versa; these now behave like any other non-comparable type by raising `KeyError` ([GH 36148](https://github.com/pandas-dev/pandas/issues/36148)) +* Changed the behavior of [`Index.reindex()`](../reference/api/pandas.Index.reindex.html#pandas.Index.reindex "pandas.Index.reindex"), [`Series.reindex()`](../reference/api/pandas.Series.reindex.html#pandas.Series.reindex "pandas.Series.reindex"), and [`DataFrame.reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex") with a `datetime64` dtype and a `datetime.date` object for `fill_value`; these are no longer considered equivalent to `datetime.datetime` objects so the reindex casts to object dtype ([GH 39767](https://github.com/pandas-dev/pandas/issues/39767)) +* Changed behavior of `SparseArray.astype()` when given a dtype that is not explicitly `SparseDtype`, cast to the exact requested dtype rather than silently using a `SparseDtype` instead ([GH 34457](https://github.com/pandas-dev/pandas/issues/34457)) +* Changed behavior of [`Index.ravel()`](../reference/api/pandas.Index.ravel.html#pandas.Index.ravel "pandas.Index.ravel") to return a view on the original [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") instead of a `np.ndarray` ([GH 36900](https://github.com/pandas-dev/pandas/issues/36900)) +* Changed behavior of [`Series.to_frame()`](../reference/api/pandas.Series.to_frame.html#pandas.Series.to_frame "pandas.Series.to_frame") and [`Index.to_frame()`](../reference/api/pandas.Index.to_frame.html#pandas.Index.to_frame "pandas.Index.to_frame") with explicit `name=None` to use `None` for the column name instead of the index’s name or default `0` ([GH 45523](https://github.com/pandas-dev/pandas/issues/45523)) +* Changed behavior of [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") with one array of `bool`-dtype and another of integer dtype, this now returns `object` dtype instead of integer dtype; explicitly cast the bool object to integer before concatenating to get the old behavior ([GH 45101](https://github.com/pandas-dev/pandas/issues/45101)) +* Changed behavior of [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor given floating-point `data` and an integer `dtype`, when the data cannot be cast losslessly, the floating point dtype is retained, matching [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") behavior ([GH 41170](https://github.com/pandas-dev/pandas/issues/41170)) +* Changed behavior of [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") constructor when given a `np.ndarray` with object-dtype containing numeric entries; this now retains object dtype rather than inferring a numeric dtype, consistent with [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") behavior ([GH 42870](https://github.com/pandas-dev/pandas/issues/42870)) +* Changed behavior of `Index.__and__()`, `Index.__or__()` and `Index.__xor__()` to behave as logical operations (matching [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") behavior) instead of aliases for set operations ([GH 37374](https://github.com/pandas-dev/pandas/issues/37374)) +* Changed behavior of [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor when passed a list whose first element is a [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical"), this now treats the elements as rows casting to `object` dtype, consistent with behavior for other types ([GH 38845](https://github.com/pandas-dev/pandas/issues/38845)) +* Changed behavior of [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor when passed a `dtype` (other than int) that the data cannot be cast to; it now raises instead of silently ignoring the dtype ([GH 41733](https://github.com/pandas-dev/pandas/issues/41733)) +* Changed the behavior of [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructor, it will no longer infer a datetime64 or timedelta64 dtype from string entries ([GH 41731](https://github.com/pandas-dev/pandas/issues/41731)) +* Changed behavior of [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") constructor with a `np.datetime64` object and a `tz` passed to interpret the input as a wall-time as opposed to a UTC time ([GH 42288](https://github.com/pandas-dev/pandas/issues/42288)) +* Changed behavior of [`Timestamp.utcfromtimestamp()`](../reference/api/pandas.Timestamp.utcfromtimestamp.html#pandas.Timestamp.utcfromtimestamp "pandas.Timestamp.utcfromtimestamp") to return a timezone-aware object satisfying `Timestamp.utcfromtimestamp(val).timestamp() == val` ([GH 45083](https://github.com/pandas-dev/pandas/issues/45083)) +* Changed behavior of [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") constructor when passed a `SparseArray` or `SparseDtype` to retain that dtype instead of casting to `numpy.ndarray` ([GH 43930](https://github.com/pandas-dev/pandas/issues/43930)) +* Changed behavior of setitem-like operations (`__setitem__`, `fillna`, `where`, `mask`, `replace`, `insert`, fill\_value for `shift`) on an object with [`DatetimeTZDtype`](../reference/api/pandas.DatetimeTZDtype.html#pandas.DatetimeTZDtype "pandas.DatetimeTZDtype") when using a value with a non-matching timezone, the value will be cast to the object’s timezone instead of casting both to object-dtype ([GH 44243](https://github.com/pandas-dev/pandas/issues/44243)) +* Changed behavior of [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructors with floating-dtype data and a [`DatetimeTZDtype`](../reference/api/pandas.DatetimeTZDtype.html#pandas.DatetimeTZDtype "pandas.DatetimeTZDtype"), the data are now interpreted as UTC-times instead of wall-times, consistent with how integer-dtype data are treated ([GH 45573](https://github.com/pandas-dev/pandas/issues/45573)) +* Changed behavior of [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructors with integer dtype and floating-point data containing `NaN`, this now raises `IntCastingNaNError` ([GH 40110](https://github.com/pandas-dev/pandas/issues/40110)) +* Changed behavior of [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructors with an integer `dtype` and values that are too large to losslessly cast to this dtype, this now raises `ValueError` ([GH 41734](https://github.com/pandas-dev/pandas/issues/41734)) +* Changed behavior of [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructors with an integer `dtype` and values having either `datetime64` or `timedelta64` dtypes, this now raises `TypeError`, use `values.view("int64")` instead ([GH 41770](https://github.com/pandas-dev/pandas/issues/41770)) +* Removed the deprecated `base` and `loffset` arguments from [`pandas.DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample"), [`pandas.Series.resample()`](../reference/api/pandas.Series.resample.html#pandas.Series.resample "pandas.Series.resample") and [`pandas.Grouper`](../reference/api/pandas.Grouper.html#pandas.Grouper "pandas.Grouper"). Use `offset` or `origin` instead ([GH 31809](https://github.com/pandas-dev/pandas/issues/31809)) +* Changed behavior of [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") and [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") with `timedelta64[ns]` dtype and an incompatible `fill_value`; this now casts to `object` dtype instead of raising, consistent with the behavior with other dtypes ([GH 45746](https://github.com/pandas-dev/pandas/issues/45746)) +* Change the default argument of `regex` for [`Series.str.replace()`](../reference/api/pandas.Series.str.replace.html#pandas.Series.str.replace "pandas.Series.str.replace") from `True` to `False`. Additionally, a single character `pat` with `regex=True` is now treated as a regular expression instead of a string literal. ([GH 36695](https://github.com/pandas-dev/pandas/issues/36695), [GH 24804](https://github.com/pandas-dev/pandas/issues/24804)) +* Changed behavior of [`DataFrame.any()`](../reference/api/pandas.DataFrame.any.html#pandas.DataFrame.any "pandas.DataFrame.any") and [`DataFrame.all()`](../reference/api/pandas.DataFrame.all.html#pandas.DataFrame.all "pandas.DataFrame.all") with `bool_only=True`; object-dtype columns with all-bool values will no longer be included, manually cast to `bool` dtype first ([GH 46188](https://github.com/pandas-dev/pandas/issues/46188)) +* Changed behavior of [`DataFrame.max()`](../reference/api/pandas.DataFrame.max.html#pandas.DataFrame.max "pandas.DataFrame.max"), [`DataFrame.min`](../reference/api/pandas.DataFrame.min.html#pandas.DataFrame.min "pandas.DataFrame.min"), [`DataFrame.mean`](../reference/api/pandas.DataFrame.mean.html#pandas.DataFrame.mean "pandas.DataFrame.mean"), [`DataFrame.median`](../reference/api/pandas.DataFrame.median.html#pandas.DataFrame.median "pandas.DataFrame.median"), [`DataFrame.skew`](../reference/api/pandas.DataFrame.skew.html#pandas.DataFrame.skew "pandas.DataFrame.skew"), [`DataFrame.kurt`](../reference/api/pandas.DataFrame.kurt.html#pandas.DataFrame.kurt "pandas.DataFrame.kurt") with `axis=None` to return a scalar applying the aggregation across both axes ([GH 45072](https://github.com/pandas-dev/pandas/issues/45072)) +* Changed behavior of comparison of a [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") with a `datetime.date` object; these now compare as un-equal and raise on inequality comparisons, matching the `datetime.datetime` behavior ([GH 36131](https://github.com/pandas-dev/pandas/issues/36131)) +* Changed behavior of comparison of `NaT` with a `datetime.date` object; these now raise on inequality comparisons ([GH 39196](https://github.com/pandas-dev/pandas/issues/39196)) +* Enforced deprecation of silently dropping columns that raised a `TypeError` in [`Series.transform`](../reference/api/pandas.Series.transform.html#pandas.Series.transform "pandas.Series.transform") and [`DataFrame.transform`](../reference/api/pandas.DataFrame.transform.html#pandas.DataFrame.transform "pandas.DataFrame.transform") when used with a list or dictionary ([GH 43740](https://github.com/pandas-dev/pandas/issues/43740)) +* Changed behavior of [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") with list-like so that any partial failure will raise an error ([GH 43740](https://github.com/pandas-dev/pandas/issues/43740)) +* Changed behaviour of [`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex") to now use the Styler implementation via [`Styler.to_latex()`](../reference/api/pandas.io.formats.style.Styler.to_latex.html#pandas.io.formats.style.Styler.to_latex "pandas.io.formats.style.Styler.to_latex") ([GH 47970](https://github.com/pandas-dev/pandas/issues/47970)) +* Changed behavior of `Series.__setitem__()` with an integer key and a `Float64Index` when the key is not present in the index; previously we treated the key as positional (behaving like `series.iloc[key] = val`), now we treat it is a label (behaving like `series.loc[key] = val`), consistent with `` Series.__getitem__`() `` behavior ([GH 33469](https://github.com/pandas-dev/pandas/issues/33469)) +* Removed `na_sentinel` argument from [`factorize()`](../reference/api/pandas.factorize.html#pandas.factorize "pandas.factorize"), [`Index.factorize()`](../reference/api/pandas.Index.factorize.html#pandas.Index.factorize "pandas.Index.factorize"), and [`ExtensionArray.factorize()`](../reference/api/pandas.api.extensions.ExtensionArray.factorize.html#pandas.api.extensions.ExtensionArray.factorize "pandas.api.extensions.ExtensionArray.factorize") ([GH 47157](https://github.com/pandas-dev/pandas/issues/47157)) +* Changed behavior of [`Series.diff()`](../reference/api/pandas.Series.diff.html#pandas.Series.diff "pandas.Series.diff") and [`DataFrame.diff()`](../reference/api/pandas.DataFrame.diff.html#pandas.DataFrame.diff "pandas.DataFrame.diff") with `ExtensionDtype` dtypes whose arrays do not implement `diff`, these now raise `TypeError` rather than casting to numpy ([GH 31025](https://github.com/pandas-dev/pandas/issues/31025)) +* Enforced deprecation of calling numpy “ufunc”s on [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with `method="outer"`; this now raises `NotImplementedError` ([GH 36955](https://github.com/pandas-dev/pandas/issues/36955)) +* Enforced deprecation disallowing passing `numeric_only=True` to [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") reductions (`rank`, `any`, `all`, …) with non-numeric dtype ([GH 47500](https://github.com/pandas-dev/pandas/issues/47500)) +* Changed behavior of [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") and [`SeriesGroupBy.apply()`](../reference/api/pandas.core.groupby.SeriesGroupBy.apply.html#pandas.core.groupby.SeriesGroupBy.apply "pandas.core.groupby.SeriesGroupBy.apply") so that `group_keys` is respected even if a transformer is detected ([GH 34998](https://github.com/pandas-dev/pandas/issues/34998)) +* Comparisons between a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") where the frame’s columns do not match the series’s index raise `ValueError` instead of automatically aligning, do `left, right = left.align(right, axis=1, copy=False)` before comparing ([GH 36795](https://github.com/pandas-dev/pandas/issues/36795)) +* Enforced deprecation `numeric_only=None` (the default) in DataFrame reductions that would silently drop columns that raised; `numeric_only` now defaults to `False` ([GH 41480](https://github.com/pandas-dev/pandas/issues/41480)) +* Changed default of `numeric_only` to `False` in all DataFrame methods with that argument ([GH 46096](https://github.com/pandas-dev/pandas/issues/46096), [GH 46906](https://github.com/pandas-dev/pandas/issues/46906)) +* Changed default of `numeric_only` to `False` in [`Series.rank()`](../reference/api/pandas.Series.rank.html#pandas.Series.rank "pandas.Series.rank") ([GH 47561](https://github.com/pandas-dev/pandas/issues/47561)) +* Enforced deprecation of silently dropping nuisance columns in groupby and resample operations when `numeric_only=False` ([GH 41475](https://github.com/pandas-dev/pandas/issues/41475)) +* Enforced deprecation of silently dropping nuisance columns in `Rolling`, `Expanding`, and `ExponentialMovingWindow` ops. This will now raise a [`errors.DataError`](../reference/api/pandas.errors.DataError.html#pandas.errors.DataError "pandas.errors.DataError") ([GH 42834](https://github.com/pandas-dev/pandas/issues/42834)) +* Changed behavior in setting values with `df.loc[:, foo] = bar` or `df.iloc[:, foo] = bar`, these now always attempt to set values inplace before falling back to casting ([GH 45333](https://github.com/pandas-dev/pandas/issues/45333)) +* Changed default of `numeric_only` in various `DataFrameGroupBy` methods; all methods now default to `numeric_only=False` ([GH 46072](https://github.com/pandas-dev/pandas/issues/46072)) +* Changed default of `numeric_only` to `False` in `Resampler` methods ([GH 47177](https://github.com/pandas-dev/pandas/issues/47177)) +* Using the method [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") with a callable that returns DataFrames will align to the input’s index ([GH 47244](https://github.com/pandas-dev/pandas/issues/47244)) +* When providing a list of columns of length one to [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby"), the keys that are returned by iterating over the resulting `DataFrameGroupBy` object will now be tuples of length one ([GH 47761](https://github.com/pandas-dev/pandas/issues/47761)) +* Removed deprecated methods `ExcelWriter.write_cells()`, `ExcelWriter.save()`, `ExcelWriter.cur_sheet()`, `ExcelWriter.handles()`, `ExcelWriter.path()` ([GH 45795](https://github.com/pandas-dev/pandas/issues/45795)) +* The [`ExcelWriter`](../reference/api/pandas.ExcelWriter.html#pandas.ExcelWriter "pandas.ExcelWriter") attribute `book` can no longer be set; it is still available to be accessed and mutated ([GH 48943](https://github.com/pandas-dev/pandas/issues/48943)) +* Removed unused `*args` and `**kwargs` in `Rolling`, `Expanding`, and `ExponentialMovingWindow` ops ([GH 47851](https://github.com/pandas-dev/pandas/issues/47851)) +* Removed the deprecated argument `line_terminator` from [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") ([GH 45302](https://github.com/pandas-dev/pandas/issues/45302)) +* Removed the deprecated argument `label` from [`lreshape()`](../reference/api/pandas.lreshape.html#pandas.lreshape "pandas.lreshape") ([GH 30219](https://github.com/pandas-dev/pandas/issues/30219)) +* Arguments after `expr` in [`DataFrame.eval()`](../reference/api/pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval") and [`DataFrame.query()`](../reference/api/pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") are keyword-only ([GH 47587](https://github.com/pandas-dev/pandas/issues/47587)) +* Removed `Index._get_attributes_dict()` ([GH 50648](https://github.com/pandas-dev/pandas/issues/50648)) +* Removed `Series.__array_wrap__()` ([GH 50648](https://github.com/pandas-dev/pandas/issues/50648)) +* Changed behavior of [`DataFrame.value_counts()`](../reference/api/pandas.DataFrame.value_counts.html#pandas.DataFrame.value_counts "pandas.DataFrame.value_counts") to return a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") for any list-like(one element or not) but an [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") for a single label ([GH 50829](https://github.com/pandas-dev/pandas/issues/50829)) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Performance improvement in [`DataFrameGroupBy.median()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.median.html#pandas.core.groupby.DataFrameGroupBy.median "pandas.core.groupby.DataFrameGroupBy.median") and [`SeriesGroupBy.median()`](../reference/api/pandas.core.groupby.SeriesGroupBy.median.html#pandas.core.groupby.SeriesGroupBy.median "pandas.core.groupby.SeriesGroupBy.median") and [`DataFrameGroupBy.cumprod()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cumprod.html#pandas.core.groupby.DataFrameGroupBy.cumprod "pandas.core.groupby.DataFrameGroupBy.cumprod") for nullable dtypes ([GH 37493](https://github.com/pandas-dev/pandas/issues/37493)) +* Performance improvement in [`DataFrameGroupBy.all()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.all.html#pandas.core.groupby.DataFrameGroupBy.all "pandas.core.groupby.DataFrameGroupBy.all"), [`DataFrameGroupBy.any()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.any.html#pandas.core.groupby.DataFrameGroupBy.any "pandas.core.groupby.DataFrameGroupBy.any"), [`SeriesGroupBy.all()`](../reference/api/pandas.core.groupby.SeriesGroupBy.all.html#pandas.core.groupby.SeriesGroupBy.all "pandas.core.groupby.SeriesGroupBy.all"), and [`SeriesGroupBy.any()`](../reference/api/pandas.core.groupby.SeriesGroupBy.any.html#pandas.core.groupby.SeriesGroupBy.any "pandas.core.groupby.SeriesGroupBy.any") for object dtype ([GH 50623](https://github.com/pandas-dev/pandas/issues/50623)) +* Performance improvement in `MultiIndex.argsort()` and `MultiIndex.sort_values()` ([GH 48406](https://github.com/pandas-dev/pandas/issues/48406)) +* Performance improvement in `MultiIndex.size()` ([GH 48723](https://github.com/pandas-dev/pandas/issues/48723)) +* Performance improvement in `MultiIndex.union()` without missing values and without duplicates ([GH 48505](https://github.com/pandas-dev/pandas/issues/48505), [GH 48752](https://github.com/pandas-dev/pandas/issues/48752)) +* Performance improvement in `MultiIndex.difference()` ([GH 48606](https://github.com/pandas-dev/pandas/issues/48606)) +* Performance improvement in [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") set operations with sort=None ([GH 49010](https://github.com/pandas-dev/pandas/issues/49010)) +* Performance improvement in [`DataFrameGroupBy.mean()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.mean.html#pandas.core.groupby.DataFrameGroupBy.mean "pandas.core.groupby.DataFrameGroupBy.mean"), [`SeriesGroupBy.mean()`](../reference/api/pandas.core.groupby.SeriesGroupBy.mean.html#pandas.core.groupby.SeriesGroupBy.mean "pandas.core.groupby.SeriesGroupBy.mean"), [`DataFrameGroupBy.var()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.var.html#pandas.core.groupby.DataFrameGroupBy.var "pandas.core.groupby.DataFrameGroupBy.var"), and [`SeriesGroupBy.var()`](../reference/api/pandas.core.groupby.SeriesGroupBy.var.html#pandas.core.groupby.SeriesGroupBy.var "pandas.core.groupby.SeriesGroupBy.var") for extension array dtypes ([GH 37493](https://github.com/pandas-dev/pandas/issues/37493)) +* Performance improvement in `MultiIndex.isin()` when `level=None` ([GH 48622](https://github.com/pandas-dev/pandas/issues/48622), [GH 49577](https://github.com/pandas-dev/pandas/issues/49577)) +* Performance improvement in `MultiIndex.putmask()` ([GH 49830](https://github.com/pandas-dev/pandas/issues/49830)) +* Performance improvement in [`Index.union()`](../reference/api/pandas.Index.union.html#pandas.Index.union "pandas.Index.union") and `MultiIndex.union()` when index contains duplicates ([GH 48900](https://github.com/pandas-dev/pandas/issues/48900)) +* Performance improvement in [`Series.rank()`](../reference/api/pandas.Series.rank.html#pandas.Series.rank "pandas.Series.rank") for pyarrow-backed dtypes ([GH 50264](https://github.com/pandas-dev/pandas/issues/50264)) +* Performance improvement in [`Series.searchsorted()`](../reference/api/pandas.Series.searchsorted.html#pandas.Series.searchsorted "pandas.Series.searchsorted") for pyarrow-backed dtypes ([GH 50447](https://github.com/pandas-dev/pandas/issues/50447)) +* Performance improvement in [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") for extension array dtypes ([GH 49722](https://github.com/pandas-dev/pandas/issues/49722), [GH 50078](https://github.com/pandas-dev/pandas/issues/50078)) +* Performance improvement in [`Index.join()`](../reference/api/pandas.Index.join.html#pandas.Index.join "pandas.Index.join"), [`Index.intersection()`](../reference/api/pandas.Index.intersection.html#pandas.Index.intersection "pandas.Index.intersection") and [`Index.union()`](../reference/api/pandas.Index.union.html#pandas.Index.union "pandas.Index.union") for masked and arrow dtypes when [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") is monotonic ([GH 50310](https://github.com/pandas-dev/pandas/issues/50310), [GH 51365](https://github.com/pandas-dev/pandas/issues/51365)) +* Performance improvement for [`Series.value_counts()`](../reference/api/pandas.Series.value_counts.html#pandas.Series.value_counts "pandas.Series.value_counts") with nullable dtype ([GH 48338](https://github.com/pandas-dev/pandas/issues/48338)) +* Performance improvement for [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructor passing integer numpy array with nullable dtype ([GH 48338](https://github.com/pandas-dev/pandas/issues/48338)) +* Performance improvement for [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") constructor passing a list ([GH 48609](https://github.com/pandas-dev/pandas/issues/48609)) +* Performance improvement in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") and [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") when joining on a sorted [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 48504](https://github.com/pandas-dev/pandas/issues/48504)) +* Performance improvement in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") when parsing strings with timezone offsets ([GH 50107](https://github.com/pandas-dev/pandas/issues/50107)) +* Performance improvement in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") and [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") for tuple-based indexing of a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 48384](https://github.com/pandas-dev/pandas/issues/48384)) +* Performance improvement for [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") with categorical dtype ([GH 49404](https://github.com/pandas-dev/pandas/issues/49404)) +* Performance improvement for `MultiIndex.unique()` ([GH 48335](https://github.com/pandas-dev/pandas/issues/48335)) +* Performance improvement for indexing operations with nullable and arrow dtypes ([GH 49420](https://github.com/pandas-dev/pandas/issues/49420), [GH 51316](https://github.com/pandas-dev/pandas/issues/51316)) +* Performance improvement for [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") with extension array backed indexes ([GH 49128](https://github.com/pandas-dev/pandas/issues/49128), [GH 49178](https://github.com/pandas-dev/pandas/issues/49178)) +* Performance improvement for [`api.types.infer_dtype()`](../reference/api/pandas.api.types.infer_dtype.html#pandas.api.types.infer_dtype "pandas.api.types.infer_dtype") ([GH 51054](https://github.com/pandas-dev/pandas/issues/51054)) +* Reduce memory usage of [`DataFrame.to_pickle()`](../reference/api/pandas.DataFrame.to_pickle.html#pandas.DataFrame.to_pickle "pandas.DataFrame.to_pickle")/[`Series.to_pickle()`](../reference/api/pandas.Series.to_pickle.html#pandas.Series.to_pickle "pandas.Series.to_pickle") when using BZ2 or LZMA ([GH 49068](https://github.com/pandas-dev/pandas/issues/49068)) +* Performance improvement for [`StringArray`](../reference/api/pandas.arrays.StringArray.html#pandas.arrays.StringArray "pandas.arrays.StringArray") constructor passing a numpy array with type `np.str_` ([GH 49109](https://github.com/pandas-dev/pandas/issues/49109)) +* Performance improvement in [`from_tuples()`](../reference/api/pandas.arrays.IntervalArray.from_tuples.html#pandas.arrays.IntervalArray.from_tuples "pandas.arrays.IntervalArray.from_tuples") ([GH 50620](https://github.com/pandas-dev/pandas/issues/50620)) +* Performance improvement in `factorize()` ([GH 49177](https://github.com/pandas-dev/pandas/issues/49177)) +* Performance improvement in `__setitem__()` ([GH 50248](https://github.com/pandas-dev/pandas/issues/50248), [GH 50632](https://github.com/pandas-dev/pandas/issues/50632)) +* Performance improvement in [`ArrowExtensionArray`](../reference/api/pandas.arrays.ArrowExtensionArray.html#pandas.arrays.ArrowExtensionArray "pandas.arrays.ArrowExtensionArray") comparison methods when array contains NA ([GH 50524](https://github.com/pandas-dev/pandas/issues/50524)) +* Performance improvement in `to_numpy()` ([GH 49973](https://github.com/pandas-dev/pandas/issues/49973), [GH 51227](https://github.com/pandas-dev/pandas/issues/51227)) +* Performance improvement when parsing strings to [`BooleanDtype`](../reference/api/pandas.BooleanDtype.html#pandas.BooleanDtype "pandas.BooleanDtype") ([GH 50613](https://github.com/pandas-dev/pandas/issues/50613)) +* Performance improvement in [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") when joining on a subset of a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 48611](https://github.com/pandas-dev/pandas/issues/48611)) +* Performance improvement for `MultiIndex.intersection()` ([GH 48604](https://github.com/pandas-dev/pandas/issues/48604)) +* Performance improvement in `DataFrame.__setitem__()` ([GH 46267](https://github.com/pandas-dev/pandas/issues/46267)) +* Performance improvement in `var` and `std` for nullable dtypes ([GH 48379](https://github.com/pandas-dev/pandas/issues/48379)). +* Performance improvement when iterating over pyarrow and nullable dtypes ([GH 49825](https://github.com/pandas-dev/pandas/issues/49825), [GH 49851](https://github.com/pandas-dev/pandas/issues/49851)) +* Performance improvements to [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") ([GH 47403](https://github.com/pandas-dev/pandas/issues/47403), [GH 47405](https://github.com/pandas-dev/pandas/issues/47405), [GH 47656](https://github.com/pandas-dev/pandas/issues/47656), [GH 48502](https://github.com/pandas-dev/pandas/issues/48502)) +* Memory improvement in `RangeIndex.sort_values()` ([GH 48801](https://github.com/pandas-dev/pandas/issues/48801)) +* Performance improvement in [`Series.to_numpy()`](../reference/api/pandas.Series.to_numpy.html#pandas.Series.to_numpy "pandas.Series.to_numpy") if `copy=True` by avoiding copying twice ([GH 24345](https://github.com/pandas-dev/pandas/issues/24345)) +* Performance improvement in [`Series.rename()`](../reference/api/pandas.Series.rename.html#pandas.Series.rename "pandas.Series.rename") with [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 21055](https://github.com/pandas-dev/pandas/issues/21055)) +* Performance improvement in `DataFrameGroupBy` and `SeriesGroupBy` when `by` is a categorical type and `sort=False` ([GH 48976](https://github.com/pandas-dev/pandas/issues/48976)) +* Performance improvement in `DataFrameGroupBy` and `SeriesGroupBy` when `by` is a categorical type and `observed=False` ([GH 49596](https://github.com/pandas-dev/pandas/issues/49596)) +* Performance improvement in [`read_stata()`](../reference/api/pandas.read_stata.html#pandas.read_stata "pandas.read_stata") with parameter `index_col` set to `None` (the default). Now the index will be a [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") instead of `Int64Index` ([GH 49745](https://github.com/pandas-dev/pandas/issues/49745)) +* Performance improvement in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") when not merging on the index - the new index will now be [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") instead of `Int64Index` ([GH 49478](https://github.com/pandas-dev/pandas/issues/49478)) +* Performance improvement in [`DataFrame.to_dict()`](../reference/api/pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict") and [`Series.to_dict()`](../reference/api/pandas.Series.to_dict.html#pandas.Series.to_dict "pandas.Series.to_dict") when using any non-object dtypes ([GH 46470](https://github.com/pandas-dev/pandas/issues/46470)) +* Performance improvement in [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") when there are multiple tables ([GH 49929](https://github.com/pandas-dev/pandas/issues/49929)) +* Performance improvement in [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") constructor when constructing from a string or integer ([GH 38312](https://github.com/pandas-dev/pandas/issues/38312)) +* Performance improvement in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") when using `'%Y%m%d'` format ([GH 17410](https://github.com/pandas-dev/pandas/issues/17410)) +* Performance improvement in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") when format is given or can be inferred ([GH 50465](https://github.com/pandas-dev/pandas/issues/50465)) +* Performance improvement in [`Series.median()`](../reference/api/pandas.Series.median.html#pandas.Series.median "pandas.Series.median") for nullable dtypes ([GH 50838](https://github.com/pandas-dev/pandas/issues/50838)) +* Performance improvement in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") when passing [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") lambda-function to `date_parser` and inputs have mixed timezone offsetes ([GH 35296](https://github.com/pandas-dev/pandas/issues/35296)) +* Performance improvement in [`isna()`](../reference/api/pandas.isna.html#pandas.isna "pandas.isna") and [`isnull()`](../reference/api/pandas.isnull.html#pandas.isnull "pandas.isnull") ([GH 50658](https://github.com/pandas-dev/pandas/issues/50658)) +* Performance improvement in [`SeriesGroupBy.value_counts()`](../reference/api/pandas.core.groupby.SeriesGroupBy.value_counts.html#pandas.core.groupby.SeriesGroupBy.value_counts "pandas.core.groupby.SeriesGroupBy.value_counts") with categorical dtype ([GH 46202](https://github.com/pandas-dev/pandas/issues/46202)) +* Fixed a reference leak in [`read_hdf()`](../reference/api/pandas.read_hdf.html#pandas.read_hdf "pandas.read_hdf") ([GH 37441](https://github.com/pandas-dev/pandas/issues/37441)) +* Fixed a memory leak in [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") and [`Series.to_json()`](../reference/api/pandas.Series.to_json.html#pandas.Series.to_json "pandas.Series.to_json") when serializing datetimes and timedeltas ([GH 40443](https://github.com/pandas-dev/pandas/issues/40443)) +* Decreased memory usage in many `DataFrameGroupBy` methods ([GH 51090](https://github.com/pandas-dev/pandas/issues/51090)) +* Performance improvement in [`DataFrame.round()`](../reference/api/pandas.DataFrame.round.html#pandas.DataFrame.round "pandas.DataFrame.round") for an integer `decimal` parameter ([GH 17254](https://github.com/pandas-dev/pandas/issues/17254)) +* Performance improvement in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") and [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") when using a large dict for `to_replace` ([GH 6697](https://github.com/pandas-dev/pandas/issues/6697)) +* Memory improvement in `StataReader` when reading seekable files ([GH 48922](https://github.com/pandas-dev/pandas/issues/48922)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +### Categorical[#](#categorical "Link to this heading") + +* Bug in `Categorical.set_categories()` losing dtype information ([GH 48812](https://github.com/pandas-dev/pandas/issues/48812)) +* Bug in [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") with categorical dtype when `to_replace` values overlap with new values ([GH 49404](https://github.com/pandas-dev/pandas/issues/49404)) +* Bug in [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") with categorical dtype losing nullable dtypes of underlying categories ([GH 49404](https://github.com/pandas-dev/pandas/issues/49404)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") and [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") would reorder categories when used as a grouper ([GH 48749](https://github.com/pandas-dev/pandas/issues/48749)) +* Bug in [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") constructor when constructing from a [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") object and `dtype="category"` losing ordered-ness ([GH 49309](https://github.com/pandas-dev/pandas/issues/49309)) +* Bug in [`SeriesGroupBy.min()`](../reference/api/pandas.core.groupby.SeriesGroupBy.min.html#pandas.core.groupby.SeriesGroupBy.min "pandas.core.groupby.SeriesGroupBy.min"), [`SeriesGroupBy.max()`](../reference/api/pandas.core.groupby.SeriesGroupBy.max.html#pandas.core.groupby.SeriesGroupBy.max "pandas.core.groupby.SeriesGroupBy.max"), [`DataFrameGroupBy.min()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.min.html#pandas.core.groupby.DataFrameGroupBy.min "pandas.core.groupby.DataFrameGroupBy.min"), and [`DataFrameGroupBy.max()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.max.html#pandas.core.groupby.DataFrameGroupBy.max "pandas.core.groupby.DataFrameGroupBy.max") with unordered [`CategoricalDtype`](../reference/api/pandas.CategoricalDtype.html#pandas.CategoricalDtype "pandas.CategoricalDtype") with no groups failing to raise `TypeError` ([GH 51034](https://github.com/pandas-dev/pandas/issues/51034)) + +### Datetimelike[#](#datetimelike "Link to this heading") + +* Bug in [`pandas.infer_freq()`](../reference/api/pandas.infer_freq.html#pandas.infer_freq "pandas.infer_freq"), raising `TypeError` when inferred on [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") ([GH 47084](https://github.com/pandas-dev/pandas/issues/47084)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") incorrectly raising `OverflowError` with string arguments corresponding to large integers ([GH 50533](https://github.com/pandas-dev/pandas/issues/50533)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") was raising on invalid offsets with `errors='coerce'` and `infer_datetime_format=True` ([GH 48633](https://github.com/pandas-dev/pandas/issues/48633)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") constructor failing to raise when `tz=None` is explicitly specified in conjunction with timezone-aware `dtype` or data ([GH 48659](https://github.com/pandas-dev/pandas/issues/48659)) +* Bug in subtracting a `datetime` scalar from [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") failing to retain the original `freq` attribute ([GH 48818](https://github.com/pandas-dev/pandas/issues/48818)) +* Bug in `pandas.tseries.holiday.Holiday` where a half-open date interval causes inconsistent return types from `USFederalHolidayCalendar.holidays()` ([GH 49075](https://github.com/pandas-dev/pandas/issues/49075)) +* Bug in rendering [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with timezone-aware dtypes with `dateutil` or `zoneinfo` timezones near daylight-savings transitions ([GH 49684](https://github.com/pandas-dev/pandas/issues/49684)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") was raising `ValueError` when parsing [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp"), `datetime.datetime`, `datetime.date`, or `np.datetime64` objects when non-ISO8601 `format` was passed ([GH 49298](https://github.com/pandas-dev/pandas/issues/49298), [GH 50036](https://github.com/pandas-dev/pandas/issues/50036)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") was raising `ValueError` when parsing empty string and non-ISO8601 format was passed. Now, empty strings will be parsed as [`NaT`](../reference/api/pandas.NaT.html#pandas.NaT "pandas.NaT"), for compatibility with how is done for ISO8601 formats ([GH 50251](https://github.com/pandas-dev/pandas/issues/50251)) +* Bug in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") was showing `UserWarning`, which was not actionable by users, when parsing non-ISO8601 delimited date strings ([GH 50232](https://github.com/pandas-dev/pandas/issues/50232)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") was showing misleading `ValueError` when parsing dates with format containing ISO week directive and ISO weekday directive ([GH 50308](https://github.com/pandas-dev/pandas/issues/50308)) +* Bug in [`Timestamp.round()`](../reference/api/pandas.Timestamp.round.html#pandas.Timestamp.round "pandas.Timestamp.round") when the `freq` argument has zero-duration (e.g. “0ns”) returning incorrect results instead of raising ([GH 49737](https://github.com/pandas-dev/pandas/issues/49737)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") was not raising `ValueError` when invalid format was passed and `errors` was `'ignore'` or `'coerce'` ([GH 50266](https://github.com/pandas-dev/pandas/issues/50266)) +* Bug in `DateOffset` was throwing `TypeError` when constructing with milliseconds and another super-daily argument ([GH 49897](https://github.com/pandas-dev/pandas/issues/49897)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") was not raising `ValueError` when parsing string with decimal date with format `'%Y%m%d'` ([GH 50051](https://github.com/pandas-dev/pandas/issues/50051)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") was not converting `None` to `NaT` when parsing mixed-offset date strings with ISO8601 format ([GH 50071](https://github.com/pandas-dev/pandas/issues/50071)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") was not returning input when parsing out-of-bounds date string with `errors='ignore'` and `format='%Y%m%d'` ([GH 14487](https://github.com/pandas-dev/pandas/issues/14487)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") was converting timezone-naive `datetime.datetime` to timezone-aware when parsing with timezone-aware strings, ISO8601 format, and `utc=False` ([GH 50254](https://github.com/pandas-dev/pandas/issues/50254)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") was throwing `ValueError` when parsing dates with ISO8601 format where some values were not zero-padded ([GH 21422](https://github.com/pandas-dev/pandas/issues/21422)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") was giving incorrect results when using `format='%Y%m%d'` and `errors='ignore'` ([GH 26493](https://github.com/pandas-dev/pandas/issues/26493)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") was failing to parse date strings `'today'` and `'now'` if `format` was not ISO8601 ([GH 50359](https://github.com/pandas-dev/pandas/issues/50359)) +* Bug in [`Timestamp.utctimetuple()`](../reference/api/pandas.Timestamp.utctimetuple.html#pandas.Timestamp.utctimetuple "pandas.Timestamp.utctimetuple") raising a `TypeError` ([GH 32174](https://github.com/pandas-dev/pandas/issues/32174)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") was raising `ValueError` when parsing mixed-offset [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") with `errors='ignore'` ([GH 50585](https://github.com/pandas-dev/pandas/issues/50585)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") was incorrectly handling floating-point inputs within 1 `unit` of the overflow boundaries ([GH 50183](https://github.com/pandas-dev/pandas/issues/50183)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with unit of “Y” or “M” giving incorrect results, not matching pointwise [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") results ([GH 50870](https://github.com/pandas-dev/pandas/issues/50870)) +* Bug in [`Series.interpolate()`](../reference/api/pandas.Series.interpolate.html#pandas.Series.interpolate "pandas.Series.interpolate") and [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") with datetime or timedelta dtypes incorrectly raising `ValueError` ([GH 11312](https://github.com/pandas-dev/pandas/issues/11312)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") was not returning input with `errors='ignore'` when input was out-of-bounds ([GH 50587](https://github.com/pandas-dev/pandas/issues/50587)) +* Bug in [`DataFrame.from_records()`](../reference/api/pandas.DataFrame.from_records.html#pandas.DataFrame.from_records "pandas.DataFrame.from_records") when given a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") input with timezone-aware datetime64 columns incorrectly dropping the timezone-awareness ([GH 51162](https://github.com/pandas-dev/pandas/issues/51162)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") was raising `decimal.InvalidOperation` when parsing date strings with `errors='coerce'` ([GH 51084](https://github.com/pandas-dev/pandas/issues/51084)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with both `unit` and `origin` specified returning incorrect results ([GH 42624](https://github.com/pandas-dev/pandas/issues/42624)) +* Bug in [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") and [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") when converting an object-dtype object containing timezone-aware datetimes or strings to `datetime64[ns]` incorrectly localizing as UTC instead of raising `TypeError` ([GH 50140](https://github.com/pandas-dev/pandas/issues/50140)) +* Bug in [`DataFrameGroupBy.quantile()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.quantile.html#pandas.core.groupby.DataFrameGroupBy.quantile "pandas.core.groupby.DataFrameGroupBy.quantile") and [`SeriesGroupBy.quantile()`](../reference/api/pandas.core.groupby.SeriesGroupBy.quantile.html#pandas.core.groupby.SeriesGroupBy.quantile "pandas.core.groupby.SeriesGroupBy.quantile") with datetime or timedelta dtypes giving incorrect results for groups containing `NaT` ([GH 51373](https://github.com/pandas-dev/pandas/issues/51373)) +* Bug in [`DataFrameGroupBy.quantile()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.quantile.html#pandas.core.groupby.DataFrameGroupBy.quantile "pandas.core.groupby.DataFrameGroupBy.quantile") and [`SeriesGroupBy.quantile()`](../reference/api/pandas.core.groupby.SeriesGroupBy.quantile.html#pandas.core.groupby.SeriesGroupBy.quantile "pandas.core.groupby.SeriesGroupBy.quantile") incorrectly raising with [`PeriodDtype`](../reference/api/pandas.PeriodDtype.html#pandas.PeriodDtype "pandas.PeriodDtype") or [`DatetimeTZDtype`](../reference/api/pandas.DatetimeTZDtype.html#pandas.DatetimeTZDtype "pandas.DatetimeTZDtype") ([GH 51373](https://github.com/pandas-dev/pandas/issues/51373)) + +### Timedelta[#](#timedelta "Link to this heading") + +* Bug in [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta") raising error when input has nullable dtype `Float64` ([GH 48796](https://github.com/pandas-dev/pandas/issues/48796)) +* Bug in [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") constructor incorrectly raising instead of returning `NaT` when given a `np.timedelta64("nat")` ([GH 48898](https://github.com/pandas-dev/pandas/issues/48898)) +* Bug in [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") constructor failing to raise when passed both a [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") object and keywords (e.g. days, seconds) ([GH 48898](https://github.com/pandas-dev/pandas/issues/48898)) +* Bug in [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") comparisons with very large `datetime.timedelta` objects incorrect raising `OutOfBoundsTimedelta` ([GH 49021](https://github.com/pandas-dev/pandas/issues/49021)) + +### Timezones[#](#timezones "Link to this heading") + +* Bug in [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") and [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") with object-dtype containing multiple timezone-aware `datetime` objects with heterogeneous timezones to a [`DatetimeTZDtype`](../reference/api/pandas.DatetimeTZDtype.html#pandas.DatetimeTZDtype "pandas.DatetimeTZDtype") incorrectly raising ([GH 32581](https://github.com/pandas-dev/pandas/issues/32581)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") was failing to parse date strings with timezone name when `format` was specified with `%Z` ([GH 49748](https://github.com/pandas-dev/pandas/issues/49748)) +* Better error message when passing invalid values to `ambiguous` parameter in [`Timestamp.tz_localize()`](../reference/api/pandas.Timestamp.tz_localize.html#pandas.Timestamp.tz_localize "pandas.Timestamp.tz_localize") ([GH 49565](https://github.com/pandas-dev/pandas/issues/49565)) +* Bug in string parsing incorrectly allowing a [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") to be constructed with an invalid timezone, which would raise when trying to print ([GH 50668](https://github.com/pandas-dev/pandas/issues/50668)) +* Corrected TypeError message in `objects_to_datetime64ns()` to inform that DatetimeIndex has mixed timezones ([GH 50974](https://github.com/pandas-dev/pandas/issues/50974)) + +### Numeric[#](#numeric "Link to this heading") + +* Bug in [`DataFrame.add()`](../reference/api/pandas.DataFrame.add.html#pandas.DataFrame.add "pandas.DataFrame.add") cannot apply ufunc when inputs contain mixed DataFrame type and Series type ([GH 39853](https://github.com/pandas-dev/pandas/issues/39853)) +* Bug in arithmetic operations on [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") not propagating mask when combining masked dtypes and numpy dtypes ([GH 45810](https://github.com/pandas-dev/pandas/issues/45810), [GH 42630](https://github.com/pandas-dev/pandas/issues/42630)) +* Bug in [`DataFrame.sem()`](../reference/api/pandas.DataFrame.sem.html#pandas.DataFrame.sem "pandas.DataFrame.sem") and [`Series.sem()`](../reference/api/pandas.Series.sem.html#pandas.Series.sem "pandas.Series.sem") where an erroneous `TypeError` would always raise when using data backed by an [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") ([GH 49759](https://github.com/pandas-dev/pandas/issues/49759)) +* Bug in `Series.__add__()` casting to object for list and masked [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") ([GH 22962](https://github.com/pandas-dev/pandas/issues/22962)) +* Bug in `mode()` where `dropna=False` was not respected when there was `NA` values ([GH 50982](https://github.com/pandas-dev/pandas/issues/50982)) +* Bug in [`DataFrame.query()`](../reference/api/pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") with `engine="numexpr"` and column names are `min` or `max` would raise a `TypeError` ([GH 50937](https://github.com/pandas-dev/pandas/issues/50937)) +* Bug in [`DataFrame.min()`](../reference/api/pandas.DataFrame.min.html#pandas.DataFrame.min "pandas.DataFrame.min") and [`DataFrame.max()`](../reference/api/pandas.DataFrame.max.html#pandas.DataFrame.max "pandas.DataFrame.max") with tz-aware data containing `pd.NaT` and `axis=1` would return incorrect results ([GH 51242](https://github.com/pandas-dev/pandas/issues/51242)) + +### Conversion[#](#conversion "Link to this heading") + +* Bug in constructing [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `int64` dtype from a string list raising instead of casting ([GH 44923](https://github.com/pandas-dev/pandas/issues/44923)) +* Bug in constructing [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with masked dtype and boolean values with `NA` raising ([GH 42137](https://github.com/pandas-dev/pandas/issues/42137)) +* Bug in [`DataFrame.eval()`](../reference/api/pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval") incorrectly raising an `AttributeError` when there are negative values in function call ([GH 46471](https://github.com/pandas-dev/pandas/issues/46471)) +* Bug in [`Series.convert_dtypes()`](../reference/api/pandas.Series.convert_dtypes.html#pandas.Series.convert_dtypes "pandas.Series.convert_dtypes") not converting dtype to nullable dtype when [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") contains `NA` and has dtype `object` ([GH 48791](https://github.com/pandas-dev/pandas/issues/48791)) +* Bug where any `ExtensionDtype` subclass with `kind="M"` would be interpreted as a timezone type ([GH 34986](https://github.com/pandas-dev/pandas/issues/34986)) +* Bug in [`arrays.ArrowExtensionArray`](../reference/api/pandas.arrays.ArrowExtensionArray.html#pandas.arrays.ArrowExtensionArray "pandas.arrays.ArrowExtensionArray") that would raise `NotImplementedError` when passed a sequence of strings or binary ([GH 49172](https://github.com/pandas-dev/pandas/issues/49172)) +* Bug in [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") raising `pyarrow.ArrowInvalid` when converting from a non-pyarrow string dtype to a pyarrow numeric type ([GH 50430](https://github.com/pandas-dev/pandas/issues/50430)) +* Bug in [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") modifying input array inplace when converting to `string` and `copy=False` ([GH 51073](https://github.com/pandas-dev/pandas/issues/51073)) +* Bug in [`Series.to_numpy()`](../reference/api/pandas.Series.to_numpy.html#pandas.Series.to_numpy "pandas.Series.to_numpy") converting to NumPy array before applying `na_value` ([GH 48951](https://github.com/pandas-dev/pandas/issues/48951)) +* Bug in [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") not copying data when converting to pyarrow dtype ([GH 50984](https://github.com/pandas-dev/pandas/issues/50984)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") was not respecting `exact` argument when `format` was an ISO8601 format ([GH 12649](https://github.com/pandas-dev/pandas/issues/12649)) +* Bug in `TimedeltaArray.astype()` raising `TypeError` when converting to a pyarrow duration type ([GH 49795](https://github.com/pandas-dev/pandas/issues/49795)) +* Bug in [`DataFrame.eval()`](../reference/api/pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval") and [`DataFrame.query()`](../reference/api/pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") raising for extension array dtypes ([GH 29618](https://github.com/pandas-dev/pandas/issues/29618), [GH 50261](https://github.com/pandas-dev/pandas/issues/50261), [GH 31913](https://github.com/pandas-dev/pandas/issues/31913)) +* Bug in [`Series()`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") not copying data when created from [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") and `dtype` is equal to `dtype` from [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") ([GH 52008](https://github.com/pandas-dev/pandas/issues/52008)) + +### Strings[#](#strings "Link to this heading") + +* Bug in [`pandas.api.types.is_string_dtype()`](../reference/api/pandas.api.types.is_string_dtype.html#pandas.api.types.is_string_dtype "pandas.api.types.is_string_dtype") that would not return `True` for [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") or [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with `pyarrow.string()` ([GH 15585](https://github.com/pandas-dev/pandas/issues/15585)) +* Bug in converting string dtypes to “datetime64[ns]” or “timedelta64[ns]” incorrectly raising `TypeError` ([GH 36153](https://github.com/pandas-dev/pandas/issues/36153)) +* Bug in setting values in a string-dtype column with an array, mutating the array as side effect when it contains missing values ([GH 51299](https://github.com/pandas-dev/pandas/issues/51299)) + +### Interval[#](#interval "Link to this heading") + +* Bug in [`IntervalIndex.is_overlapping()`](../reference/api/pandas.IntervalIndex.is_overlapping.html#pandas.IntervalIndex.is_overlapping "pandas.IntervalIndex.is_overlapping") incorrect output if interval has duplicate left boundaries ([GH 49581](https://github.com/pandas-dev/pandas/issues/49581)) +* Bug in [`Series.infer_objects()`](../reference/api/pandas.Series.infer_objects.html#pandas.Series.infer_objects "pandas.Series.infer_objects") failing to infer [`IntervalDtype`](../reference/api/pandas.IntervalDtype.html#pandas.IntervalDtype "pandas.IntervalDtype") for an object series of [`Interval`](../reference/api/pandas.Interval.html#pandas.Interval "pandas.Interval") objects ([GH 50090](https://github.com/pandas-dev/pandas/issues/50090)) +* Bug in [`Series.shift()`](../reference/api/pandas.Series.shift.html#pandas.Series.shift "pandas.Series.shift") with [`IntervalDtype`](../reference/api/pandas.IntervalDtype.html#pandas.IntervalDtype "pandas.IntervalDtype") and invalid null `fill_value` failing to raise `TypeError` ([GH 51258](https://github.com/pandas-dev/pandas/issues/51258)) + +### Indexing[#](#indexing "Link to this heading") + +* Bug in `DataFrame.__setitem__()` raising when indexer is a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with `boolean` dtype ([GH 47125](https://github.com/pandas-dev/pandas/issues/47125)) +* Bug in [`DataFrame.reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex") filling with wrong values when indexing columns and index for `uint` dtypes ([GH 48184](https://github.com/pandas-dev/pandas/issues/48184)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") when setting [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with different dtypes coercing values to single dtype ([GH 50467](https://github.com/pandas-dev/pandas/issues/50467)) +* Bug in [`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values") where `None` was not returned when `by` is empty list and `inplace=True` ([GH 50643](https://github.com/pandas-dev/pandas/issues/50643)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") coercing dtypes when setting values with a list indexer ([GH 49159](https://github.com/pandas-dev/pandas/issues/49159)) +* Bug in [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") raising error for out of bounds end of slice indexer ([GH 50161](https://github.com/pandas-dev/pandas/issues/50161)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") raising `ValueError` with all `False` `bool` indexer and empty object ([GH 51450](https://github.com/pandas-dev/pandas/issues/51450)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") raising `ValueError` with `bool` indexer and [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 47687](https://github.com/pandas-dev/pandas/issues/47687)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") raising `IndexError` when setting values for a pyarrow-backed column with a non-scalar indexer ([GH 50085](https://github.com/pandas-dev/pandas/issues/50085)) +* Bug in `DataFrame.__getitem__()`, `Series.__getitem__()`, `DataFrame.__setitem__()` and `Series.__setitem__()` + when indexing on indexes with extension float dtypes (`Float64` & `Float64`) or complex dtypes using integers ([GH 51053](https://github.com/pandas-dev/pandas/issues/51053)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") modifying object when setting incompatible value with an empty indexer ([GH 45981](https://github.com/pandas-dev/pandas/issues/45981)) +* Bug in `DataFrame.__setitem__()` raising `ValueError` when right hand side is [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") columns ([GH 49121](https://github.com/pandas-dev/pandas/issues/49121)) +* Bug in [`DataFrame.reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex") casting dtype to `object` when [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") has single extension array column when re-indexing `columns` and `index` ([GH 48190](https://github.com/pandas-dev/pandas/issues/48190)) +* Bug in [`DataFrame.iloc()`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") raising `IndexError` when indexer is a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with numeric extension array dtype ([GH 49521](https://github.com/pandas-dev/pandas/issues/49521)) +* Bug in [`describe()`](../reference/api/pandas.DataFrame.describe.html#pandas.DataFrame.describe "pandas.DataFrame.describe") when formatting percentiles in the resulting index showed more decimals than needed ([GH 46362](https://github.com/pandas-dev/pandas/issues/46362)) +* Bug in [`DataFrame.compare()`](../reference/api/pandas.DataFrame.compare.html#pandas.DataFrame.compare "pandas.DataFrame.compare") does not recognize differences when comparing `NA` with value in nullable dtypes ([GH 48939](https://github.com/pandas-dev/pandas/issues/48939)) +* Bug in [`Series.rename()`](../reference/api/pandas.Series.rename.html#pandas.Series.rename "pandas.Series.rename") with [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") losing extension array dtypes ([GH 21055](https://github.com/pandas-dev/pandas/issues/21055)) +* Bug in `DataFrame.isetitem()` coercing extension array dtypes in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") to object ([GH 49922](https://github.com/pandas-dev/pandas/issues/49922)) +* Bug in `Series.__getitem__()` returning corrupt object when selecting from an empty pyarrow backed object ([GH 51734](https://github.com/pandas-dev/pandas/issues/51734)) +* Bug in `BusinessHour` would cause creation of [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") to fail when no opening hour was included in the index ([GH 49835](https://github.com/pandas-dev/pandas/issues/49835)) + +### Missing[#](#missing "Link to this heading") + +* Bug in [`Index.equals()`](../reference/api/pandas.Index.equals.html#pandas.Index.equals "pandas.Index.equals") raising `TypeError` when [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") consists of tuples that contain `NA` ([GH 48446](https://github.com/pandas-dev/pandas/issues/48446)) +* Bug in [`Series.map()`](../reference/api/pandas.Series.map.html#pandas.Series.map "pandas.Series.map") caused incorrect result when data has NaNs and defaultdict mapping was used ([GH 48813](https://github.com/pandas-dev/pandas/issues/48813)) +* Bug in [`NA`](../reference/api/pandas.NA.html#pandas.NA "pandas.NA") raising a `TypeError` instead of return [`NA`](../reference/api/pandas.NA.html#pandas.NA "pandas.NA") when performing a binary operation with a `bytes` object ([GH 49108](https://github.com/pandas-dev/pandas/issues/49108)) +* Bug in [`DataFrame.update()`](../reference/api/pandas.DataFrame.update.html#pandas.DataFrame.update "pandas.DataFrame.update") with `overwrite=False` raising `TypeError` when `self` has column with `NaT` values and column not present in `other` ([GH 16713](https://github.com/pandas-dev/pandas/issues/16713)) +* Bug in [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") raising `RecursionError` when replacing value in object-dtype [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") containing `NA` ([GH 47480](https://github.com/pandas-dev/pandas/issues/47480)) +* Bug in [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") raising `RecursionError` when replacing value in numeric [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `NA` ([GH 50758](https://github.com/pandas-dev/pandas/issues/50758)) + +### MultiIndex[#](#multiindex "Link to this heading") + +* Bug in [`MultiIndex.get_indexer()`](../reference/api/pandas.MultiIndex.get_indexer.html#pandas.MultiIndex.get_indexer "pandas.MultiIndex.get_indexer") not matching `NaN` values ([GH 29252](https://github.com/pandas-dev/pandas/issues/29252), [GH 37222](https://github.com/pandas-dev/pandas/issues/37222), [GH 38623](https://github.com/pandas-dev/pandas/issues/38623), [GH 42883](https://github.com/pandas-dev/pandas/issues/42883), [GH 43222](https://github.com/pandas-dev/pandas/issues/43222), [GH 46173](https://github.com/pandas-dev/pandas/issues/46173), [GH 48905](https://github.com/pandas-dev/pandas/issues/48905)) +* Bug in `MultiIndex.argsort()` raising `TypeError` when index contains [`NA`](../reference/api/pandas.NA.html#pandas.NA "pandas.NA") ([GH 48495](https://github.com/pandas-dev/pandas/issues/48495)) +* Bug in `MultiIndex.difference()` losing extension array dtype ([GH 48606](https://github.com/pandas-dev/pandas/issues/48606)) +* Bug in [`MultiIndex.set_levels`](../reference/api/pandas.MultiIndex.set_levels.html#pandas.MultiIndex.set_levels "pandas.MultiIndex.set_levels") raising `IndexError` when setting empty level ([GH 48636](https://github.com/pandas-dev/pandas/issues/48636)) +* Bug in `MultiIndex.unique()` losing extension array dtype ([GH 48335](https://github.com/pandas-dev/pandas/issues/48335)) +* Bug in `MultiIndex.intersection()` losing extension array ([GH 48604](https://github.com/pandas-dev/pandas/issues/48604)) +* Bug in `MultiIndex.union()` losing extension array ([GH 48498](https://github.com/pandas-dev/pandas/issues/48498), [GH 48505](https://github.com/pandas-dev/pandas/issues/48505), [GH 48900](https://github.com/pandas-dev/pandas/issues/48900)) +* Bug in `MultiIndex.union()` not sorting when sort=None and index contains missing values ([GH 49010](https://github.com/pandas-dev/pandas/issues/49010)) +* Bug in [`MultiIndex.append()`](../reference/api/pandas.MultiIndex.append.html#pandas.MultiIndex.append "pandas.MultiIndex.append") not checking names for equality ([GH 48288](https://github.com/pandas-dev/pandas/issues/48288)) +* Bug in `MultiIndex.symmetric_difference()` losing extension array ([GH 48607](https://github.com/pandas-dev/pandas/issues/48607)) +* Bug in `MultiIndex.join()` losing dtypes when [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") has duplicates ([GH 49830](https://github.com/pandas-dev/pandas/issues/49830)) +* Bug in `MultiIndex.putmask()` losing extension array ([GH 49830](https://github.com/pandas-dev/pandas/issues/49830)) +* Bug in `MultiIndex.value_counts()` returning a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") indexed by flat index of tuples instead of a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 49558](https://github.com/pandas-dev/pandas/issues/49558)) + +### I/O[#](#i-o "Link to this heading") + +* Bug in [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") caused fragmentation of [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and raised [`errors.PerformanceWarning`](../reference/api/pandas.errors.PerformanceWarning.html#pandas.errors.PerformanceWarning "pandas.errors.PerformanceWarning") ([GH 48595](https://github.com/pandas-dev/pandas/issues/48595)) +* Improved error message in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") by including the offending sheet name when an exception is raised while reading a file ([GH 48706](https://github.com/pandas-dev/pandas/issues/48706)) +* Bug when a pickling a subset PyArrow-backed data that would serialize the entire data instead of the subset ([GH 42600](https://github.com/pandas-dev/pandas/issues/42600)) +* Bug in [`read_sql_query()`](../reference/api/pandas.read_sql_query.html#pandas.read_sql_query "pandas.read_sql_query") ignoring `dtype` argument when `chunksize` is specified and result is empty ([GH 50245](https://github.com/pandas-dev/pandas/issues/50245)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") for a single-line csv with fewer columns than `names` raised [`errors.ParserError`](../reference/api/pandas.errors.ParserError.html#pandas.errors.ParserError "pandas.errors.ParserError") with `engine="c"` ([GH 47566](https://github.com/pandas-dev/pandas/issues/47566)) +* Bug in [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") raising with `orient="table"` and `NA` value ([GH 40255](https://github.com/pandas-dev/pandas/issues/40255)) +* Bug in displaying `string` dtypes not showing storage option ([GH 50099](https://github.com/pandas-dev/pandas/issues/50099)) +* Bug in [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string") with `header=False` that printed the index name on the same line as the first row of the data ([GH 49230](https://github.com/pandas-dev/pandas/issues/49230)) +* Bug in [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string") ignoring float formatter for extension arrays ([GH 39336](https://github.com/pandas-dev/pandas/issues/39336)) +* Fixed memory leak which stemmed from the initialization of the internal JSON module ([GH 49222](https://github.com/pandas-dev/pandas/issues/49222)) +* Fixed issue where [`json_normalize()`](../reference/api/pandas.json_normalize.html#pandas.json_normalize "pandas.json_normalize") would incorrectly remove leading characters from column names that matched the `sep` argument ([GH 49861](https://github.com/pandas-dev/pandas/issues/49861)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") unnecessarily overflowing for extension array dtype when containing `NA` ([GH 32134](https://github.com/pandas-dev/pandas/issues/32134)) +* Bug in [`DataFrame.to_dict()`](../reference/api/pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict") not converting `NA` to `None` ([GH 50795](https://github.com/pandas-dev/pandas/issues/50795)) +* Bug in [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") where it would segfault when failing to encode a string ([GH 50307](https://github.com/pandas-dev/pandas/issues/50307)) +* Bug in [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") with `na_rep` set when the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") contains non-scalar data ([GH 47103](https://github.com/pandas-dev/pandas/issues/47103)) +* Bug in [`read_xml()`](../reference/api/pandas.read_xml.html#pandas.read_xml "pandas.read_xml") where file-like objects failed when iterparse is used ([GH 50641](https://github.com/pandas-dev/pandas/issues/50641)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") when `engine="pyarrow"` where `encoding` parameter was not handled correctly ([GH 51302](https://github.com/pandas-dev/pandas/issues/51302)) +* Bug in [`read_xml()`](../reference/api/pandas.read_xml.html#pandas.read_xml "pandas.read_xml") ignored repeated elements when iterparse is used ([GH 51183](https://github.com/pandas-dev/pandas/issues/51183)) +* Bug in [`ExcelWriter`](../reference/api/pandas.ExcelWriter.html#pandas.ExcelWriter "pandas.ExcelWriter") leaving file handles open if an exception occurred during instantiation ([GH 51443](https://github.com/pandas-dev/pandas/issues/51443)) +* Bug in [`DataFrame.to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") where non-string index or columns were raising a `ValueError` when `engine="pyarrow"` ([GH 52036](https://github.com/pandas-dev/pandas/issues/52036)) + +### Period[#](#period "Link to this heading") + +* Bug in [`Period.strftime()`](../reference/api/pandas.Period.strftime.html#pandas.Period.strftime "pandas.Period.strftime") and [`PeriodIndex.strftime()`](../reference/api/pandas.PeriodIndex.strftime.html#pandas.PeriodIndex.strftime "pandas.PeriodIndex.strftime"), raising `UnicodeDecodeError` when a locale-specific directive was passed ([GH 46319](https://github.com/pandas-dev/pandas/issues/46319)) +* Bug in adding a [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") object to an array of `DateOffset` objects incorrectly raising `TypeError` ([GH 50162](https://github.com/pandas-dev/pandas/issues/50162)) +* Bug in [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") where passing a string with finer resolution than nanosecond would result in a `KeyError` instead of dropping the extra precision ([GH 50417](https://github.com/pandas-dev/pandas/issues/50417)) +* Bug in parsing strings representing Week-periods e.g. “2017-01-23/2017-01-29” as minute-frequency instead of week-frequency ([GH 50803](https://github.com/pandas-dev/pandas/issues/50803)) +* Bug in [`DataFrameGroupBy.sum()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.sum.html#pandas.core.groupby.DataFrameGroupBy.sum "pandas.core.groupby.DataFrameGroupBy.sum"), `DataFrameGroupByGroupBy.cumsum()`, `DataFrameGroupByGroupBy.prod()`, `DataFrameGroupByGroupBy.cumprod()` with [`PeriodDtype`](../reference/api/pandas.PeriodDtype.html#pandas.PeriodDtype "pandas.PeriodDtype") failing to raise `TypeError` ([GH 51040](https://github.com/pandas-dev/pandas/issues/51040)) +* Bug in parsing empty string with [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") incorrectly raising `ValueError` instead of returning `NaT` ([GH 51349](https://github.com/pandas-dev/pandas/issues/51349)) + +### Plotting[#](#plotting "Link to this heading") + +* Bug in [`DataFrame.plot.hist()`](../reference/api/pandas.DataFrame.plot.hist.html#pandas.DataFrame.plot.hist "pandas.DataFrame.plot.hist"), not dropping elements of `weights` corresponding to `NaN` values in `data` ([GH 48884](https://github.com/pandas-dev/pandas/issues/48884)) +* `ax.set_xlim` was sometimes raising `UserWarning` which users couldn’t address due to `set_xlim` not accepting parsing arguments - the converter now uses [`Timestamp()`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") instead ([GH 49148](https://github.com/pandas-dev/pandas/issues/49148)) + +### Groupby/resample/rolling[#](#groupby-resample-rolling "Link to this heading") + +* Bug in `ExponentialMovingWindow` with `online` not raising a `NotImplementedError` for unsupported operations ([GH 48834](https://github.com/pandas-dev/pandas/issues/48834)) +* Bug in [`DataFrameGroupBy.sample()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.sample.html#pandas.core.groupby.DataFrameGroupBy.sample "pandas.core.groupby.DataFrameGroupBy.sample") raises `ValueError` when the object is empty ([GH 48459](https://github.com/pandas-dev/pandas/issues/48459)) +* Bug in [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") raises `ValueError` when an entry of the index is equal to the name of the index ([GH 48567](https://github.com/pandas-dev/pandas/issues/48567)) +* Bug in [`DataFrameGroupBy.resample()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.resample.html#pandas.core.groupby.DataFrameGroupBy.resample "pandas.core.groupby.DataFrameGroupBy.resample") produces inconsistent results when passing empty DataFrame ([GH 47705](https://github.com/pandas-dev/pandas/issues/47705)) +* Bug in `DataFrameGroupBy` and `SeriesGroupBy` would not include unobserved categories in result when grouping by categorical indexes ([GH 49354](https://github.com/pandas-dev/pandas/issues/49354)) +* Bug in `DataFrameGroupBy` and `SeriesGroupBy` would change result order depending on the input index when grouping by categoricals ([GH 49223](https://github.com/pandas-dev/pandas/issues/49223)) +* Bug in `DataFrameGroupBy` and `SeriesGroupBy` when grouping on categorical data would sort result values even when used with `sort=False` ([GH 42482](https://github.com/pandas-dev/pandas/issues/42482)) +* Bug in [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") and `SeriesGroupBy.apply` with `as_index=False` would not attempt the computation without using the grouping keys when using them failed with a `TypeError` ([GH 49256](https://github.com/pandas-dev/pandas/issues/49256)) +* Bug in [`DataFrameGroupBy.describe()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.describe.html#pandas.core.groupby.DataFrameGroupBy.describe "pandas.core.groupby.DataFrameGroupBy.describe") would describe the group keys ([GH 49256](https://github.com/pandas-dev/pandas/issues/49256)) +* Bug in [`SeriesGroupBy.describe()`](../reference/api/pandas.core.groupby.SeriesGroupBy.describe.html#pandas.core.groupby.SeriesGroupBy.describe "pandas.core.groupby.SeriesGroupBy.describe") with `as_index=False` would have the incorrect shape ([GH 49256](https://github.com/pandas-dev/pandas/issues/49256)) +* Bug in `DataFrameGroupBy` and `SeriesGroupBy` with `dropna=False` would drop NA values when the grouper was categorical ([GH 36327](https://github.com/pandas-dev/pandas/issues/36327)) +* Bug in [`SeriesGroupBy.nunique()`](../reference/api/pandas.core.groupby.SeriesGroupBy.nunique.html#pandas.core.groupby.SeriesGroupBy.nunique "pandas.core.groupby.SeriesGroupBy.nunique") would incorrectly raise when the grouper was an empty categorical and `observed=True` ([GH 21334](https://github.com/pandas-dev/pandas/issues/21334)) +* Bug in [`SeriesGroupBy.nth()`](../reference/api/pandas.core.groupby.SeriesGroupBy.nth.html#pandas.core.groupby.SeriesGroupBy.nth "pandas.core.groupby.SeriesGroupBy.nth") would raise when grouper contained NA values after subsetting from a `DataFrameGroupBy` ([GH 26454](https://github.com/pandas-dev/pandas/issues/26454)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") would not include a [`Grouper`](../reference/api/pandas.Grouper.html#pandas.Grouper "pandas.Grouper") specified by `key` in the result when `as_index=False` ([GH 50413](https://github.com/pandas-dev/pandas/issues/50413)) +* Bug in [`DataFrameGroupBy.value_counts()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.value_counts.html#pandas.core.groupby.DataFrameGroupBy.value_counts "pandas.core.groupby.DataFrameGroupBy.value_counts") would raise when used with a `TimeGrouper` ([GH 50486](https://github.com/pandas-dev/pandas/issues/50486)) +* Bug in [`Resampler.size()`](../reference/api/pandas.core.resample.Resampler.size.html#pandas.core.resample.Resampler.size "pandas.core.resample.Resampler.size") caused a wide [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") to be returned instead of a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 46826](https://github.com/pandas-dev/pandas/issues/46826)) +* Bug in [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") and [`SeriesGroupBy.transform()`](../reference/api/pandas.core.groupby.SeriesGroupBy.transform.html#pandas.core.groupby.SeriesGroupBy.transform "pandas.core.groupby.SeriesGroupBy.transform") would raise incorrectly when grouper had `axis=1` for `"idxmin"` and `"idxmax"` arguments ([GH 45986](https://github.com/pandas-dev/pandas/issues/45986)) +* Bug in `DataFrameGroupBy` would raise when used with an empty DataFrame, categorical grouper, and `dropna=False` ([GH 50634](https://github.com/pandas-dev/pandas/issues/50634)) +* Bug in [`SeriesGroupBy.value_counts()`](../reference/api/pandas.core.groupby.SeriesGroupBy.value_counts.html#pandas.core.groupby.SeriesGroupBy.value_counts "pandas.core.groupby.SeriesGroupBy.value_counts") did not respect `sort=False` ([GH 50482](https://github.com/pandas-dev/pandas/issues/50482)) +* Bug in [`DataFrameGroupBy.resample()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.resample.html#pandas.core.groupby.DataFrameGroupBy.resample "pandas.core.groupby.DataFrameGroupBy.resample") raises `KeyError` when getting the result from a key list when resampling on time index ([GH 50840](https://github.com/pandas-dev/pandas/issues/50840)) +* Bug in [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") and [`SeriesGroupBy.transform()`](../reference/api/pandas.core.groupby.SeriesGroupBy.transform.html#pandas.core.groupby.SeriesGroupBy.transform "pandas.core.groupby.SeriesGroupBy.transform") would raise incorrectly when grouper had `axis=1` for `"ngroup"` argument ([GH 45986](https://github.com/pandas-dev/pandas/issues/45986)) +* Bug in [`DataFrameGroupBy.describe()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.describe.html#pandas.core.groupby.DataFrameGroupBy.describe "pandas.core.groupby.DataFrameGroupBy.describe") produced incorrect results when data had duplicate columns ([GH 50806](https://github.com/pandas-dev/pandas/issues/50806)) +* Bug in [`DataFrameGroupBy.agg()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg") with `engine="numba"` failing to respect `as_index=False` ([GH 51228](https://github.com/pandas-dev/pandas/issues/51228)) +* Bug in [`DataFrameGroupBy.agg()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg"), [`SeriesGroupBy.agg()`](../reference/api/pandas.core.groupby.SeriesGroupBy.agg.html#pandas.core.groupby.SeriesGroupBy.agg "pandas.core.groupby.SeriesGroupBy.agg"), and `Resampler.agg()` would ignore arguments when passed a list of functions ([GH 50863](https://github.com/pandas-dev/pandas/issues/50863)) +* Bug in [`DataFrameGroupBy.ohlc()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.ohlc.html#pandas.core.groupby.DataFrameGroupBy.ohlc "pandas.core.groupby.DataFrameGroupBy.ohlc") ignoring `as_index=False` ([GH 51413](https://github.com/pandas-dev/pandas/issues/51413)) +* Bug in `DataFrameGroupBy.agg()` after subsetting columns (e.g. `.groupby(...)[["a", "b"]]`) would not include groupings in the result ([GH 51186](https://github.com/pandas-dev/pandas/issues/51186)) + +### Reshaping[#](#reshaping "Link to this heading") + +* Bug in [`DataFrame.pivot_table()`](../reference/api/pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table") raising `TypeError` for nullable dtype and `margins=True` ([GH 48681](https://github.com/pandas-dev/pandas/issues/48681)) +* Bug in [`DataFrame.unstack()`](../reference/api/pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack") and [`Series.unstack()`](../reference/api/pandas.Series.unstack.html#pandas.Series.unstack "pandas.Series.unstack") unstacking wrong level of [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") when [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") has mixed names ([GH 48763](https://github.com/pandas-dev/pandas/issues/48763)) +* Bug in [`DataFrame.melt()`](../reference/api/pandas.DataFrame.melt.html#pandas.DataFrame.melt "pandas.DataFrame.melt") losing extension array dtype ([GH 41570](https://github.com/pandas-dev/pandas/issues/41570)) +* Bug in [`DataFrame.pivot()`](../reference/api/pandas.DataFrame.pivot.html#pandas.DataFrame.pivot "pandas.DataFrame.pivot") not respecting `None` as column name ([GH 48293](https://github.com/pandas-dev/pandas/issues/48293)) +* Bug in [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") when `left_on` or `right_on` is or includes a [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") incorrectly raising `AttributeError` ([GH 48464](https://github.com/pandas-dev/pandas/issues/48464)) +* Bug in [`DataFrame.pivot_table()`](../reference/api/pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table") raising `ValueError` with parameter `margins=True` when result is an empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 49240](https://github.com/pandas-dev/pandas/issues/49240)) +* Clarified error message in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") when passing invalid `validate` option ([GH 49417](https://github.com/pandas-dev/pandas/issues/49417)) +* Bug in [`DataFrame.explode()`](../reference/api/pandas.DataFrame.explode.html#pandas.DataFrame.explode "pandas.DataFrame.explode") raising `ValueError` on multiple columns with `NaN` values or empty lists ([GH 46084](https://github.com/pandas-dev/pandas/issues/46084)) +* Bug in [`DataFrame.transpose()`](../reference/api/pandas.DataFrame.transpose.html#pandas.DataFrame.transpose "pandas.DataFrame.transpose") with `IntervalDtype` column with `timedelta64[ns]` endpoints ([GH 44917](https://github.com/pandas-dev/pandas/issues/44917)) +* Bug in [`DataFrame.agg()`](../reference/api/pandas.DataFrame.agg.html#pandas.DataFrame.agg "pandas.DataFrame.agg") and [`Series.agg()`](../reference/api/pandas.Series.agg.html#pandas.Series.agg "pandas.Series.agg") would ignore arguments when passed a list of functions ([GH 50863](https://github.com/pandas-dev/pandas/issues/50863)) + +### Sparse[#](#sparse "Link to this heading") + +* Bug in [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") when converting a `SparseDtype` with `datetime64[ns]` subtype to `int64` dtype raising, inconsistent with the non-sparse behavior ([GH 49631](https://github.com/pandas-dev/pandas/issues/49631),:issue:50087) +* Bug in [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") when converting a from `datetime64[ns]` to `Sparse[datetime64[ns]]` incorrectly raising ([GH 50082](https://github.com/pandas-dev/pandas/issues/50082)) +* Bug in [`Series.sparse.to_coo()`](../reference/api/pandas.Series.sparse.to_coo.html#pandas.Series.sparse.to_coo "pandas.Series.sparse.to_coo") raising `SystemError` when [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") contains a `ExtensionArray` ([GH 50996](https://github.com/pandas-dev/pandas/issues/50996)) + +### ExtensionArray[#](#extensionarray "Link to this heading") + +* Bug in [`Series.mean()`](../reference/api/pandas.Series.mean.html#pandas.Series.mean "pandas.Series.mean") overflowing unnecessarily with nullable integers ([GH 48378](https://github.com/pandas-dev/pandas/issues/48378)) +* Bug in `Series.tolist()` for nullable dtypes returning numpy scalars instead of python scalars ([GH 49890](https://github.com/pandas-dev/pandas/issues/49890)) +* Bug in [`Series.round()`](../reference/api/pandas.Series.round.html#pandas.Series.round "pandas.Series.round") for pyarrow-backed dtypes raising `AttributeError` ([GH 50437](https://github.com/pandas-dev/pandas/issues/50437)) +* Bug when concatenating an empty DataFrame with an ExtensionDtype to another DataFrame with the same ExtensionDtype, the resulting dtype turned into object ([GH 48510](https://github.com/pandas-dev/pandas/issues/48510)) +* Bug in `array.PandasArray.to_numpy()` raising with `NA` value when `na_value` is specified ([GH 40638](https://github.com/pandas-dev/pandas/issues/40638)) +* Bug in [`api.types.is_numeric_dtype()`](../reference/api/pandas.api.types.is_numeric_dtype.html#pandas.api.types.is_numeric_dtype "pandas.api.types.is_numeric_dtype") where a custom `ExtensionDtype` would not return `True` if `_is_numeric` returned `True` ([GH 50563](https://github.com/pandas-dev/pandas/issues/50563)) +* Bug in [`api.types.is_integer_dtype()`](../reference/api/pandas.api.types.is_integer_dtype.html#pandas.api.types.is_integer_dtype "pandas.api.types.is_integer_dtype"), [`api.types.is_unsigned_integer_dtype()`](../reference/api/pandas.api.types.is_unsigned_integer_dtype.html#pandas.api.types.is_unsigned_integer_dtype "pandas.api.types.is_unsigned_integer_dtype"), [`api.types.is_signed_integer_dtype()`](../reference/api/pandas.api.types.is_signed_integer_dtype.html#pandas.api.types.is_signed_integer_dtype "pandas.api.types.is_signed_integer_dtype"), [`api.types.is_float_dtype()`](../reference/api/pandas.api.types.is_float_dtype.html#pandas.api.types.is_float_dtype "pandas.api.types.is_float_dtype") where a custom `ExtensionDtype` would not return `True` if `kind` returned the corresponding NumPy type ([GH 50667](https://github.com/pandas-dev/pandas/issues/50667)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructor unnecessarily overflowing for nullable unsigned integer dtypes ([GH 38798](https://github.com/pandas-dev/pandas/issues/38798), [GH 25880](https://github.com/pandas-dev/pandas/issues/25880)) +* Bug in setting non-string value into `StringArray` raising `ValueError` instead of `TypeError` ([GH 49632](https://github.com/pandas-dev/pandas/issues/49632)) +* Bug in [`DataFrame.reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex") not honoring the default `copy=True` keyword in case of columns with ExtensionDtype (and as a result also selecting multiple columns with getitem (`[]`) didn’t correctly result in a copy) ([GH 51197](https://github.com/pandas-dev/pandas/issues/51197)) +* Bug in [`ArrowExtensionArray`](../reference/api/pandas.arrays.ArrowExtensionArray.html#pandas.arrays.ArrowExtensionArray "pandas.arrays.ArrowExtensionArray") logical operations `&` and `|` raising `KeyError` ([GH 51688](https://github.com/pandas-dev/pandas/issues/51688)) + +### Styler[#](#styler "Link to this heading") + +* Fix [`background_gradient()`](../reference/api/pandas.io.formats.style.Styler.background_gradient.html#pandas.io.formats.style.Styler.background_gradient "pandas.io.formats.style.Styler.background_gradient") for nullable dtype [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `NA` values ([GH 50712](https://github.com/pandas-dev/pandas/issues/50712)) + +### Metadata[#](#metadata "Link to this heading") + +* Fixed metadata propagation in [`DataFrame.corr()`](../reference/api/pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr") and [`DataFrame.cov()`](../reference/api/pandas.DataFrame.cov.html#pandas.DataFrame.cov "pandas.DataFrame.cov") ([GH 28283](https://github.com/pandas-dev/pandas/issues/28283)) + +### Other[#](#other "Link to this heading") + +* Bug in incorrectly accepting dtype strings containing “[pyarrow]” more than once ([GH 51548](https://github.com/pandas-dev/pandas/issues/51548)) +* Bug in [`Series.searchsorted()`](../reference/api/pandas.Series.searchsorted.html#pandas.Series.searchsorted "pandas.Series.searchsorted") inconsistent behavior when accepting [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") as parameter `value` ([GH 49620](https://github.com/pandas-dev/pandas/issues/49620)) +* Bug in [`array()`](../reference/api/pandas.array.html#pandas.array "pandas.array") failing to raise on [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") inputs ([GH 51167](https://github.com/pandas-dev/pandas/issues/51167)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 260 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* 5j9 + +* ABCPAN-rank + +* Aarni Koskela + +* Aashish KC + +* Abubeker Mohammed + +* Adam Mróz + +* Adam Ormondroyd + +* Aditya Anulekh + +* Ahmed Ibrahim +* Akshay Babbar + +* Aleksa Radojicic + +* Alex + +* Alex Buzenet + +* Alex Kirko +* Allison Kwan + +* Amay Patel + +* Ambuj Pawar + +* Amotz + +* Andreas Schwab + +* Andrew Chen + +* Anton Shevtsov +* Antonio Ossa Guerra + +* Antonio Ossa-Guerra + +* Anushka Bishnoi + +* Arda Kosar +* Armin Berres +* Asadullah Naeem + +* Asish Mahapatra +* Bailey Lissington + +* BarkotBeyene +* Ben Beasley +* Bhavesh Rajendra Patil + +* Bibek Jha + +* Bill + +* Bishwas + +* CarlosGDCJ + +* Carlotta Fabian + +* Chris Roth + +* Chuck Cadman + +* Corralien + +* DG + +* Dan Hendry + +* Daniel Isaac +* David Kleindienst + +* David Poznik + +* David Rudel + +* DavidKleindienst + +* Dea María Léon + +* Deepak Sirohiwal + +* Dennis Chukwunta +* Douglas Lohmann + +* Dries Schaumont +* Dustin K + +* Edoardo Abati + +* Eduardo Chaves + +* Ege Özgüroğlu + +* Ekaterina Borovikova + +* Eli Schwartz + +* Elvis Lim + +* Emily Taylor + +* Emma Carballal Haire + +* Erik Welch + +* Fangchen Li +* Florian Hofstetter + +* Flynn Owen + +* Fredrik Erlandsson + +* Gaurav Sheni +* Georeth Chow + +* George Munyoro + +* Guilherme Beltramini +* Gulnur Baimukhambetova + +* H L + +* Hans +* Hatim Zahid + +* HighYoda + +* Hiki + +* Himanshu Wagh + +* Hugo van Kemenade + +* Idil Ismiguzel + +* Irv Lustig +* Isaac Chung +* Isaac Virshup +* JHM Darbyshire +* JHM Darbyshire (iMac) +* JMBurley +* Jaime Di Cristina +* Jan Koch +* JanVHII + +* Janosh Riebesell +* JasmandeepKaur + +* Jeremy Tuloup +* Jessica M + +* Jonas Haag +* Joris Van den Bossche +* João Meirelles + +* Julia Aoun + +* Justus Magin + +* Kang Su Min + +* Kevin Sheppard +* Khor Chean Wei +* Kian Eliasi +* Kostya Farber + +* KotlinIsland + +* Lakmal Pinnaduwage + +* Lakshya A Agrawal + +* Lawrence Mitchell + +* Levi Ob + +* Loic Diridollou +* Lorenzo Vainigli + +* Luca Pizzini + +* Lucas Damo + +* Luke Manley +* Madhuri Patil + +* Marc Garcia +* Marco Edward Gorelli +* Marco Gorelli +* MarcoGorelli +* Maren Westermann + +* Maria Stazherova + +* Marie K + +* Marielle + +* Mark Harfouche + +* Marko Pacak + +* Martin + +* Matheus Cerqueira + +* Matheus Pedroni + +* Matteo Raso + +* Matthew Roeschke +* MeeseeksMachine + +* Mehdi Mohammadi + +* Michael Harris + +* Michael Mior + +* Natalia Mokeeva + +* Neal Muppidi + +* Nick Crews +* Nishu Choudhary + +* Noa Tamir +* Noritada Kobayashi +* Omkar Yadav + +* P. Talley + +* Pablo + +* Pandas Development Team +* Parfait Gasana +* Patrick Hoefler +* Pedro Nacht + +* Philip + +* Pietro Battiston +* Pooja Subramaniam + +* Pranav Saibhushan Ravuri + +* Pranav. P. A + +* Ralf Gommers + +* RaphSku + +* Richard Shadrach +* Robsdedude + +* Roger +* Roger Thomas +* RogerThomas + +* SFuller4 + +* Salahuddin + +* Sam Rao +* Sean Patrick Malloy + +* Sebastian Roll + +* Shantanu +* Shashwat + +* Shashwat Agrawal + +* Shiko Wamwea + +* Shoham Debnath +* Shubhankar Lohani + +* Siddhartha Gandhi + +* Simon Hawkins +* Soumik Dutta + +* Sowrov Talukder + +* Stefanie Molin +* Stefanie Senger + +* Stepfen Shawn + +* Steven Rotondo +* Stijn Van Hoey +* Sudhansu + +* Sven +* Sylvain MARIE +* Sylvain Marié +* Tabea Kossen + +* Taylor Packard +* Terji Petersen +* Thierry Moisan +* Thomas H + +* Thomas Li +* Torsten Wörtwein +* Tsvika S + +* Tsvika Shapira + +* Vamsi Verma + +* Vinicius Akira + +* William Andrea +* William Ayd +* William Blum + +* Wilson Xing + +* Xiao Yuan + +* Xnot + +* Yasin Tatar + +* Yuanhao Geng +* Yvan Cywan + +* Zachary Moon + +* Zhengbo Wang + +* abonte + +* adrienpacifico + +* alm +* amotzop + +* andyjessen + +* anonmouse1 + +* bang128 + +* bishwas jha + +* calhockemeyer + +* carla-alves-24 + +* carlotta + +* casadipietra + +* catmar22 + +* cfabian + +* codamuse + +* dataxerik +* davidleon123 + +* dependabot[bot] + +* fdrocha + +* github-actions[bot] +* himanshu\_wagh + +* iofall + +* jakirkham + +* jbrockmendel +* jnclt + +* joelchen + +* joelsonoda + +* joshuabello2550 +* joycewamwea + +* kathleenhang + +* krasch + +* ltoniazzi + +* luke396 + +* milosz-martynow + +* minat-hub + +* mliu08 + +* monosans + +* nealxm +* nikitaved + +* paradox-lab + +* partev +* raisadz + +* ram vikram singh + +* rebecca-palmer +* sarvaSanjay + +* seljaks + +* silviaovo + +* smij720 + +* soumilbaldota + +* stellalin7 + +* strawberry beach sandals + +* tmoschou + +* uzzell + +* yqyqyq-W + +* yun + +* Ádám Lippai +* 김동현 (Daniel Donghyun Kim) + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_2.0.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_2.0.1.md new file mode 100644 index 0000000000000000000000000000000000000000..ed3f8a9c44e0c57da3545d8c9262d5d032a8f060 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_2.0.1.md @@ -0,0 +1,76 @@ +# What's new in pandas 2.0.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v2.0.1.html + +# What’s new in 2.0.1 (April 24, 2023)[#](#what-s-new-in-2-0-1-april-24-2023 "Link to this heading") + +These are the changes in pandas 2.0.1. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression for subclassed Series when constructing from a dictionary ([GH 52445](https://github.com/pandas-dev/pandas/issues/52445)) +* Fixed regression in [`SeriesGroupBy.agg()`](../reference/api/pandas.core.groupby.SeriesGroupBy.agg.html#pandas.core.groupby.SeriesGroupBy.agg "pandas.core.groupby.SeriesGroupBy.agg") failing when grouping with categorical data, multiple groupings, `as_index=False`, and a list of aggregations ([GH 52760](https://github.com/pandas-dev/pandas/issues/52760)) +* Fixed regression in [`DataFrame.pivot()`](../reference/api/pandas.DataFrame.pivot.html#pandas.DataFrame.pivot "pandas.DataFrame.pivot") changing [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") name of input object ([GH 52629](https://github.com/pandas-dev/pandas/issues/52629)) +* Fixed regression in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") raising on a DataFrame with no columns ([GH 52484](https://github.com/pandas-dev/pandas/issues/52484)) +* Fixed regression in [`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values") not resetting index when [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") is already sorted and `ignore_index=True` ([GH 52553](https://github.com/pandas-dev/pandas/issues/52553)) +* Fixed regression in `MultiIndex.isin()` raising `TypeError` for `Generator` ([GH 52568](https://github.com/pandas-dev/pandas/issues/52568)) +* Fixed regression in [`Series.describe()`](../reference/api/pandas.Series.describe.html#pandas.Series.describe "pandas.Series.describe") showing `RuntimeWarning` for extension dtype [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with one element ([GH 52515](https://github.com/pandas-dev/pandas/issues/52515)) +* Fixed regression when adding a new column to a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") when the [`DataFrame.columns`](../reference/api/pandas.DataFrame.columns.html#pandas.DataFrame.columns "pandas.DataFrame.columns") was a [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") and the new key was hashable but not a scalar ([GH 52652](https://github.com/pandas-dev/pandas/issues/52652)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in [`Series.dt.days`](../reference/api/pandas.Series.dt.days.html#pandas.Series.dt.days "pandas.Series.dt.days") that would overflow `int32` number of days ([GH 52391](https://github.com/pandas-dev/pandas/issues/52391)) +* Bug in [`arrays.DatetimeArray`](../reference/api/pandas.arrays.DatetimeArray.html#pandas.arrays.DatetimeArray "pandas.arrays.DatetimeArray") constructor returning an incorrect unit when passed a non-nanosecond numpy datetime array ([GH 52555](https://github.com/pandas-dev/pandas/issues/52555)) +* Bug in [`ArrowExtensionArray`](../reference/api/pandas.arrays.ArrowExtensionArray.html#pandas.arrays.ArrowExtensionArray "pandas.arrays.ArrowExtensionArray") with duration dtype overflowing when constructed from data containing numpy `NaT` ([GH 52843](https://github.com/pandas-dev/pandas/issues/52843)) +* Bug in [`Series.dt.round()`](../reference/api/pandas.Series.dt.round.html#pandas.Series.dt.round "pandas.Series.dt.round") when passing a `freq` of equal or higher resolution compared to the [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") would raise a `ZeroDivisionError` ([GH 52761](https://github.com/pandas-dev/pandas/issues/52761)) +* Bug in [`Series.median()`](../reference/api/pandas.Series.median.html#pandas.Series.median "pandas.Series.median") with [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") returning an approximate median ([GH 52679](https://github.com/pandas-dev/pandas/issues/52679)) +* Bug in [`api.interchange.from_dataframe()`](../reference/api/pandas.api.interchange.from_dataframe.html#pandas.api.interchange.from_dataframe "pandas.api.interchange.from_dataframe") was unnecessarily raising on categorical dtypes ([GH 49889](https://github.com/pandas-dev/pandas/issues/49889)) +* Bug in [`api.interchange.from_dataframe()`](../reference/api/pandas.api.interchange.from_dataframe.html#pandas.api.interchange.from_dataframe "pandas.api.interchange.from_dataframe") was unnecessarily raising on large string dtypes ([GH 52795](https://github.com/pandas-dev/pandas/issues/52795)) +* Bug in [`pandas.testing.assert_series_equal()`](../reference/api/pandas.testing.assert_series_equal.html#pandas.testing.assert_series_equal "pandas.testing.assert_series_equal") where `check_dtype=False` would still raise for datetime or timedelta types with different resolutions ([GH 52449](https://github.com/pandas-dev/pandas/issues/52449)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") casting PyArrow datetimes to NumPy when `dtype_backend="pyarrow"` and `parse_dates` is set causing a performance bottleneck in the process ([GH 52546](https://github.com/pandas-dev/pandas/issues/52546)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") and [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta") when trying to convert numeric data with a [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") ([GH 52425](https://github.com/pandas-dev/pandas/issues/52425)) +* Bug in [`to_numeric()`](../reference/api/pandas.to_numeric.html#pandas.to_numeric "pandas.to_numeric") with `errors='coerce'` and `dtype_backend='pyarrow'` with [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") data ([GH 52588](https://github.com/pandas-dev/pandas/issues/52588)) +* Bug in `ArrowDtype.__from_arrow__()` not respecting if dtype is explicitly given ([GH 52533](https://github.com/pandas-dev/pandas/issues/52533)) +* Bug in [`DataFrame.describe()`](../reference/api/pandas.DataFrame.describe.html#pandas.DataFrame.describe "pandas.DataFrame.describe") not respecting `ArrowDtype` in `include` and `exclude` ([GH 52570](https://github.com/pandas-dev/pandas/issues/52570)) +* Bug in [`DataFrame.max()`](../reference/api/pandas.DataFrame.max.html#pandas.DataFrame.max "pandas.DataFrame.max") and related casting different [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") resolutions always to nanoseconds ([GH 52524](https://github.com/pandas-dev/pandas/issues/52524)) +* Bug in [`Series.describe()`](../reference/api/pandas.Series.describe.html#pandas.Series.describe "pandas.Series.describe") not returning [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with `pyarrow.float64` type with numeric data ([GH 52427](https://github.com/pandas-dev/pandas/issues/52427)) +* Bug in [`Series.dt.tz_localize()`](../reference/api/pandas.Series.dt.tz_localize.html#pandas.Series.dt.tz_localize "pandas.Series.dt.tz_localize") incorrectly localizing timestamps with [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") ([GH 52677](https://github.com/pandas-dev/pandas/issues/52677)) +* Bug in arithmetic between `np.datetime64` and `np.timedelta64` `NaT` scalars with units always returning nanosecond resolution ([GH 52295](https://github.com/pandas-dev/pandas/issues/52295)) +* Bug in logical and comparison operations between [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") and numpy masked types (e.g. `"boolean"`) ([GH 52625](https://github.com/pandas-dev/pandas/issues/52625)) +* Fixed bug in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") when merging with `ArrowDtype` one one and a NumPy dtype on the other side ([GH 52406](https://github.com/pandas-dev/pandas/issues/52406)) +* Fixed segfault in [`Series.to_numpy()`](../reference/api/pandas.Series.to_numpy.html#pandas.Series.to_numpy "pandas.Series.to_numpy") with `null[pyarrow]` dtype ([GH 52443](https://github.com/pandas-dev/pandas/issues/52443)) + +## Other[#](#other "Link to this heading") + +* [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") created from empty dicts had [`columns`](../reference/api/pandas.DataFrame.columns.html#pandas.DataFrame.columns "pandas.DataFrame.columns") of dtype `object`. It is now a [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") ([GH 52404](https://github.com/pandas-dev/pandas/issues/52404)) +* [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") created from empty dicts had [`index`](../reference/api/pandas.Series.index.html#pandas.Series.index "pandas.Series.index") of dtype `object`. It is now a [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") ([GH 52404](https://github.com/pandas-dev/pandas/issues/52404)) +* Implemented [`Series.str.split()`](../reference/api/pandas.Series.str.split.html#pandas.Series.str.split "pandas.Series.str.split") and [`Series.str.rsplit()`](../reference/api/pandas.Series.str.rsplit.html#pandas.Series.str.rsplit "pandas.Series.str.rsplit") for [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with `pyarrow.string` ([GH 52401](https://github.com/pandas-dev/pandas/issues/52401)) +* Implemented most `str` accessor methods for [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with `pyarrow.string` ([GH 52401](https://github.com/pandas-dev/pandas/issues/52401)) +* Supplying a non-integer hashable key that tests `False` in [`api.types.is_scalar()`](../reference/api/pandas.api.types.is_scalar.html#pandas.api.types.is_scalar "pandas.api.types.is_scalar") now raises a `KeyError` for `RangeIndex.get_loc()`, like it does for [`Index.get_loc()`](../reference/api/pandas.Index.get_loc.html#pandas.Index.get_loc "pandas.Index.get_loc"). Previously it raised an `InvalidIndexError` ([GH 52652](https://github.com/pandas-dev/pandas/issues/52652)). + +## Contributors[#](#contributors "Link to this heading") + +A total of 20 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Alex Malins + +* Chris Carini + +* Dea María Léon +* Joris Van den Bossche +* Luke Manley +* Marc Garcia +* Marco Edward Gorelli +* MarcoGorelli +* Matthew Roeschke +* MeeseeksMachine +* Natalia Mokeeva +* Nirav + +* Pandas Development Team +* Patrick Hoefler +* Richard Shadrach +* Stefanie Molin +* Terji Petersen +* Thomas + +* Thomas Li +* yonashub diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_2.0.2.md b/corpus/changelog/pandas_whatsnew/whatsnew_2.0.2.md new file mode 100644 index 0000000000000000000000000000000000000000..ac67d79b1be4097873da4d89c6b191aa3375af57 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_2.0.2.md @@ -0,0 +1,63 @@ +# What's new in pandas 2.0.2 + +Source: https://pandas.pydata.org/docs/whatsnew/v2.0.2.html + +# What’s new in 2.0.2 (May 29, 2023)[#](#what-s-new-in-2-0-2-may-29-2023 "Link to this heading") + +These are the changes in pandas 2.0.2. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed performance regression in `GroupBy.apply()` ([GH 53195](https://github.com/pandas-dev/pandas/issues/53195)) +* Fixed regression in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") on Windows when dtype is `np.intc` ([GH 52451](https://github.com/pandas-dev/pandas/issues/52451)) +* Fixed regression in [`read_sql()`](../reference/api/pandas.read_sql.html#pandas.read_sql "pandas.read_sql") dropping columns with duplicated column names ([GH 53117](https://github.com/pandas-dev/pandas/issues/53117)) +* Fixed regression in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") losing [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") name when enlarging object ([GH 53053](https://github.com/pandas-dev/pandas/issues/53053)) +* Fixed regression in [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string") printing a backslash at the end of the first row of data, instead of headers, when the DataFrame doesn’t fit the line width ([GH 53054](https://github.com/pandas-dev/pandas/issues/53054)) +* Fixed regression in `MultiIndex.join()` returning levels in wrong order ([GH 53093](https://github.com/pandas-dev/pandas/issues/53093)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in [`arrays.ArrowExtensionArray`](../reference/api/pandas.arrays.ArrowExtensionArray.html#pandas.arrays.ArrowExtensionArray "pandas.arrays.ArrowExtensionArray") incorrectly assigning `dict` instead of `list` for `.type` with `pyarrow.map_` and raising a `NotImplementedError` with `pyarrow.struct` ([GH 53328](https://github.com/pandas-dev/pandas/issues/53328)) +* Bug in [`api.interchange.from_dataframe()`](../reference/api/pandas.api.interchange.from_dataframe.html#pandas.api.interchange.from_dataframe "pandas.api.interchange.from_dataframe") was raising `IndexError` on empty categorical data ([GH 53077](https://github.com/pandas-dev/pandas/issues/53077)) +* Bug in [`api.interchange.from_dataframe()`](../reference/api/pandas.api.interchange.from_dataframe.html#pandas.api.interchange.from_dataframe "pandas.api.interchange.from_dataframe") was returning [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame")’s of incorrect sizes when called on slices ([GH 52824](https://github.com/pandas-dev/pandas/issues/52824)) +* Bug in [`api.interchange.from_dataframe()`](../reference/api/pandas.api.interchange.from_dataframe.html#pandas.api.interchange.from_dataframe "pandas.api.interchange.from_dataframe") was unnecessarily raising on bitmasks ([GH 49888](https://github.com/pandas-dev/pandas/issues/49888)) +* Bug in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") when merging on datetime columns on different resolutions ([GH 53200](https://github.com/pandas-dev/pandas/issues/53200)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") raising `OverflowError` for `engine="pyarrow"` and `parse_dates` set ([GH 53295](https://github.com/pandas-dev/pandas/issues/53295)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") was inferring format to contain `"%H"` instead of `"%I"` if date contained “AM” / “PM” tokens ([GH 53147](https://github.com/pandas-dev/pandas/issues/53147)) +* Bug in [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta") was raising `ValueError` with `pandas.NA` ([GH 52909](https://github.com/pandas-dev/pandas/issues/52909)) +* Bug in `DataFrame.__getitem__()` not preserving dtypes for [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") partial keys ([GH 51895](https://github.com/pandas-dev/pandas/issues/51895)) +* Bug in [`DataFrame.convert_dtypes()`](../reference/api/pandas.DataFrame.convert_dtypes.html#pandas.DataFrame.convert_dtypes "pandas.DataFrame.convert_dtypes") ignores `convert_*` keywords when set to False `dtype_backend="pyarrow"` ([GH 52872](https://github.com/pandas-dev/pandas/issues/52872)) +* Bug in [`DataFrame.convert_dtypes()`](../reference/api/pandas.DataFrame.convert_dtypes.html#pandas.DataFrame.convert_dtypes "pandas.DataFrame.convert_dtypes") losing timezone for tz-aware dtypes and `dtype_backend="pyarrow"` ([GH 53382](https://github.com/pandas-dev/pandas/issues/53382)) +* Bug in [`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values") raising for PyArrow `dictionary` dtype ([GH 53232](https://github.com/pandas-dev/pandas/issues/53232)) +* Bug in [`Series.describe()`](../reference/api/pandas.Series.describe.html#pandas.Series.describe "pandas.Series.describe") treating pyarrow-backed timestamps and timedeltas as categorical data ([GH 53001](https://github.com/pandas-dev/pandas/issues/53001)) +* Bug in [`Series.rename()`](../reference/api/pandas.Series.rename.html#pandas.Series.rename "pandas.Series.rename") not making a lazy copy when Copy-on-Write is enabled when a scalar is passed to it ([GH 52450](https://github.com/pandas-dev/pandas/issues/52450)) +* Bug in `pd.array()` raising for `NumPy` array and `pa.large_string` or `pa.large_binary` ([GH 52590](https://github.com/pandas-dev/pandas/issues/52590)) + +## Other[#](#other "Link to this heading") + +* Raised a better error message when calling [`Series.dt.to_pydatetime()`](../reference/api/pandas.Series.dt.to_pydatetime.html#pandas.Series.dt.to_pydatetime "pandas.Series.dt.to_pydatetime") with [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with `pyarrow.date32` or `pyarrow.date64` type ([GH 52812](https://github.com/pandas-dev/pandas/issues/52812)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 18 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Gianluca Ficarelli + +* Guillaume Lemaitre +* Joris Van den Bossche +* Julian Badillo + +* Luke Manley +* Lumberbot (aka Jack) + +* Marc Garcia +* Marco Edward Gorelli +* MarcoGorelli +* Matt Richards +* Matthew Roeschke +* MeeseeksMachine +* Pandas Development Team +* Patrick Hoefler +* Simon Høxbro Hansen + +* Thomas Li +* Yao Xiao + +* dependabot[bot] diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_2.0.3.md b/corpus/changelog/pandas_whatsnew/whatsnew_2.0.3.md new file mode 100644 index 0000000000000000000000000000000000000000..6de1c5125424fd0afc51da93521f43f8f4c45263 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_2.0.3.md @@ -0,0 +1,46 @@ +# What's new in pandas 2.0.3 + +Source: https://pandas.pydata.org/docs/whatsnew/v2.0.3.html + +# What’s new in 2.0.3 (June 28, 2023)[#](#what-s-new-in-2-0-3-june-28-2023 "Link to this heading") + +These are the changes in pandas 2.0.3. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Bug in `` Timestamp.weekday`() `` was returning incorrect results before `'0000-02-29'` ([GH 53738](https://github.com/pandas-dev/pandas/issues/53738)) +* Fixed performance regression in merging on datetime-like columns ([GH 53231](https://github.com/pandas-dev/pandas/issues/53231)) +* Fixed regression when [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string") creates extra space for string dtypes ([GH 52690](https://github.com/pandas-dev/pandas/issues/52690)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in `DataFrame.convert_dtype()` and `Series.convert_dtype()` when trying to convert [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with `dtype_backend="nullable_numpy"` ([GH 53648](https://github.com/pandas-dev/pandas/issues/53648)) +* Bug in `RangeIndex.union()` when using `sort=True` with another [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") ([GH 53490](https://github.com/pandas-dev/pandas/issues/53490)) +* Bug in [`Series.reindex()`](../reference/api/pandas.Series.reindex.html#pandas.Series.reindex "pandas.Series.reindex") when expanding a non-nanosecond datetime or timedelta [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") would not fill with `NaT` correctly ([GH 53497](https://github.com/pandas-dev/pandas/issues/53497)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") when defining `dtype` with `bool[pyarrow]` for the `"c"` and `"python"` engines ([GH 53390](https://github.com/pandas-dev/pandas/issues/53390)) +* Bug in [`Series.str.split()`](../reference/api/pandas.Series.str.split.html#pandas.Series.str.split "pandas.Series.str.split") and [`Series.str.rsplit()`](../reference/api/pandas.Series.str.rsplit.html#pandas.Series.str.rsplit "pandas.Series.str.rsplit") with `expand=True` for [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with `pyarrow.string` ([GH 53532](https://github.com/pandas-dev/pandas/issues/53532)) +* Bug in indexing methods (e.g. `DataFrame.__getitem__()`) where taking the entire [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame")/[`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") would raise an `OverflowError` when Copy on Write was enabled and the length of the array was over the maximum size a 32-bit integer can hold ([GH 53616](https://github.com/pandas-dev/pandas/issues/53616)) +* Bug when constructing a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with columns of an [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with a `pyarrow.dictionary` type that reindexes the data ([GH 53617](https://github.com/pandas-dev/pandas/issues/53617)) +* Bug when indexing a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") or [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with an [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with a timestamp [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") would raise an `AttributeError` ([GH 53644](https://github.com/pandas-dev/pandas/issues/53644)) + +## Other[#](#other "Link to this heading") + +## Contributors[#](#contributors "Link to this heading") + +A total of 13 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Conrad Mcgee Stocks + +* Dominik Berger + +* Joris Van den Bossche +* Luke Manley +* Lumberbot (aka Jack) +* Marc Garcia +* Marco Edward Gorelli +* Matthew Roeschke +* Pandas Development Team +* Thomas A Caswell +* Thomas Li +* Xiao Yuan +* dependabot[bot] diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_2.1.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_2.1.0.md new file mode 100644 index 0000000000000000000000000000000000000000..ae718ee42d15d64fd632731413d523ba3340b499 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_2.1.0.md @@ -0,0 +1,1178 @@ +# What's new in pandas 2.1.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v2.1.0.html + +# What’s new in 2.1.0 (Aug 30, 2023)[#](#what-s-new-in-2-1-0-aug-30-2023 "Link to this heading") + +These are the changes in pandas 2.1.0. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Enhancements[#](#enhancements "Link to this heading") + +### PyArrow will become a required dependency with pandas 3.0[#](#pyarrow-will-become-a-required-dependency-with-pandas-3-0 "Link to this heading") + +[PyArrow](https://arrow.apache.org/docs/python/index.html) will become a required +dependency of pandas starting with pandas 3.0. This decision was made based on +[PDEP 10](https://pandas.pydata.org/pdeps/0010-required-pyarrow-dependency.html). + +This will enable more changes that are hugely beneficial to pandas users, including +but not limited to: + +* inferring strings as PyArrow backed strings by default enabling a significant + reduction of the memory footprint and huge performance improvements. +* inferring more complex dtypes with PyArrow by default, like `Decimal`, `lists`, + `bytes`, `structured data` and more. +* Better interoperability with other libraries that depend on Apache Arrow. + +We are collecting feedback on this decision [here](https://github.com/pandas-dev/pandas/issues/54466). + +### Avoid NumPy object dtype for strings by default[#](#avoid-numpy-object-dtype-for-strings-by-default "Link to this heading") + +Previously, all strings were stored in columns with NumPy object dtype by default. +This release introduces an option `future.infer_string` that infers all +strings as PyArrow backed strings with dtype `"string[pyarrow_numpy]"` instead. +This is a new string dtype implementation that follows NumPy semantics in comparison +operations and will return `np.nan` as the missing value indicator. +Setting the option will also infer the dtype `"string"` as a [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") with +storage set to `"pyarrow_numpy"`, ignoring the value behind the option +`mode.string_storage`. + +This option only works if PyArrow is installed. PyArrow backed strings have a +significantly reduced memory footprint and provide a big performance improvement +compared to NumPy object ([GH 54430](https://github.com/pandas-dev/pandas/issues/54430)). + +The option can be enabled with: + +```None +pd.options.future.infer_string = True +``` + +This behavior will become the default with pandas 3.0. + +### DataFrame reductions preserve extension dtypes[#](#dataframe-reductions-preserve-extension-dtypes "Link to this heading") + +In previous versions of pandas, the results of DataFrame reductions +([`DataFrame.sum()`](../reference/api/pandas.DataFrame.sum.html#pandas.DataFrame.sum "pandas.DataFrame.sum") [`DataFrame.mean()`](../reference/api/pandas.DataFrame.mean.html#pandas.DataFrame.mean "pandas.DataFrame.mean") etc.) had NumPy dtypes, even when the DataFrames +were of extension dtypes. Pandas can now keep the dtypes when doing reductions over DataFrame +columns with a common dtype ([GH 52788](https://github.com/pandas-dev/pandas/issues/52788)). + +*Old Behavior* + +```None +In [1]: df = pd.DataFrame({"a": [1, 1, 2, 1], "b": [np.nan, 2.0, 3.0, 4.0]}, dtype="Int64") +In [2]: df.sum() +Out[2]: +a 5 +b 9 +dtype: int64 +In [3]: df = df.astype("int64[pyarrow]") +In [4]: df.sum() +Out[4]: +a 5 +b 9 +dtype: int64 +``` + +*New Behavior* + +```None +In [1]: df = pd.DataFrame({"a": [1, 1, 2, 1], "b": [np.nan, 2.0, 3.0, 4.0]}, dtype="Int64") + +In [2]: df.sum() +Out[2]: +a 5 +b 9 +dtype: Int64 + +In [3]: df = df.astype("int64[pyarrow]") + +In [4]: df.sum() +Out[4]: +a 5 +b 9 +dtype: int64[pyarrow] +``` + +Notice that the dtype is now a masked dtype and PyArrow dtype, respectively, while previously it was a NumPy integer dtype. + +To allow DataFrame reductions to preserve extension dtypes, [`ExtensionArray._reduce()`](../reference/api/pandas.api.extensions.ExtensionArray._reduce.html#pandas.api.extensions.ExtensionArray._reduce "pandas.api.extensions.ExtensionArray._reduce") has gotten a new keyword parameter `keepdims`. Calling [`ExtensionArray._reduce()`](../reference/api/pandas.api.extensions.ExtensionArray._reduce.html#pandas.api.extensions.ExtensionArray._reduce "pandas.api.extensions.ExtensionArray._reduce") with `keepdims=True` should return an array of length 1 along the reduction axis. In order to maintain backward compatibility, the parameter is not required, but will it become required in the future. If the parameter is not found in the signature, DataFrame reductions can not preserve extension dtypes. Also, if the parameter is not found, a `FutureWarning` will be emitted and type checkers like mypy may complain about the signature not being compatible with [`ExtensionArray._reduce()`](../reference/api/pandas.api.extensions.ExtensionArray._reduce.html#pandas.api.extensions.ExtensionArray._reduce "pandas.api.extensions.ExtensionArray._reduce"). + +### Copy-on-Write improvements[#](#copy-on-write-improvements "Link to this heading") + +* [`Series.transform()`](../reference/api/pandas.Series.transform.html#pandas.Series.transform "pandas.Series.transform") not respecting Copy-on-Write when `func` modifies [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") inplace ([GH 53747](https://github.com/pandas-dev/pandas/issues/53747)) +* Calling [`Index.values()`](../reference/api/pandas.Index.values.html#pandas.Index.values "pandas.Index.values") will now return a read-only NumPy array ([GH 53704](https://github.com/pandas-dev/pandas/issues/53704)) +* Setting a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") into a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") now creates a lazy instead of a deep copy ([GH 53142](https://github.com/pandas-dev/pandas/issues/53142)) +* The [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor, when constructing a DataFrame from a dictionary + of Index objects and specifying `copy=False`, will now use a lazy copy + of those Index objects for the columns of the DataFrame ([GH 52947](https://github.com/pandas-dev/pandas/issues/52947)) +* A shallow copy of a Series or DataFrame (`df.copy(deep=False)`) will now also return + a shallow copy of the rows/columns [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") objects instead of only a shallow copy of + the data, i.e. the index of the result is no longer identical + (`df.copy(deep=False).index is df.index` is no longer True) ([GH 53721](https://github.com/pandas-dev/pandas/issues/53721)) +* [`DataFrame.head()`](../reference/api/pandas.DataFrame.head.html#pandas.DataFrame.head "pandas.DataFrame.head") and [`DataFrame.tail()`](../reference/api/pandas.DataFrame.tail.html#pandas.DataFrame.tail "pandas.DataFrame.tail") will now return deep copies ([GH 54011](https://github.com/pandas-dev/pandas/issues/54011)) +* Add lazy copy mechanism to [`DataFrame.eval()`](../reference/api/pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval") ([GH 53746](https://github.com/pandas-dev/pandas/issues/53746)) +* Trying to operate inplace on a temporary column selection + (for example, `df["a"].fillna(100, inplace=True)`) + will now always raise a warning when Copy-on-Write is enabled. In this mode, + operating inplace like this will never work, since the selection behaves + as a temporary copy. This holds true for: + + + DataFrame.update / Series.update + + DataFrame.fillna / Series.fillna + + DataFrame.replace / Series.replace + + DataFrame.clip / Series.clip + + DataFrame.where / Series.where + + DataFrame.mask / Series.mask + + DataFrame.interpolate / Series.interpolate + + DataFrame.ffill / Series.ffill + + DataFrame.bfill / Series.bfill + +### New [`DataFrame.map()`](../reference/api/pandas.DataFrame.map.html#pandas.DataFrame.map "pandas.DataFrame.map") method and support for ExtensionArrays[#](#new-dataframe-map-method-and-support-for-extensionarrays "Link to this heading") + +The [`DataFrame.map()`](../reference/api/pandas.DataFrame.map.html#pandas.DataFrame.map "pandas.DataFrame.map") been added and [`DataFrame.applymap()`](../reference/api/pandas.DataFrame.applymap.html#pandas.DataFrame.applymap "pandas.DataFrame.applymap") has been deprecated. [`DataFrame.map()`](../reference/api/pandas.DataFrame.map.html#pandas.DataFrame.map "pandas.DataFrame.map") has the same functionality as [`DataFrame.applymap()`](../reference/api/pandas.DataFrame.applymap.html#pandas.DataFrame.applymap "pandas.DataFrame.applymap"), but the new name better communicates that this is the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") version of [`Series.map()`](../reference/api/pandas.Series.map.html#pandas.Series.map "pandas.Series.map") ([GH 52353](https://github.com/pandas-dev/pandas/issues/52353)). + +When given a callable, [`Series.map()`](../reference/api/pandas.Series.map.html#pandas.Series.map "pandas.Series.map") applies the callable to all elements of the [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"). +Similarly, [`DataFrame.map()`](../reference/api/pandas.DataFrame.map.html#pandas.DataFrame.map "pandas.DataFrame.map") applies the callable to all elements of the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame"), +while [`Index.map()`](../reference/api/pandas.Index.map.html#pandas.Index.map "pandas.Index.map") applies the callable to all elements of the [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"). + +Frequently, it is not desirable to apply the callable to nan-like values of the array and to avoid doing +that, the `map` method could be called with `na_action="ignore"`, i.e. `ser.map(func, na_action="ignore")`. +However, `na_action="ignore"` was not implemented for many [`ExtensionArray`](../reference/api/pandas.api.extensions.ExtensionArray.html#pandas.api.extensions.ExtensionArray "pandas.api.extensions.ExtensionArray") and `Index` types +and `na_action="ignore"` did not work correctly for any [`ExtensionArray`](../reference/api/pandas.api.extensions.ExtensionArray.html#pandas.api.extensions.ExtensionArray "pandas.api.extensions.ExtensionArray") subclass except the nullable numeric ones (i.e. with dtype `Int64` etc.). + +`na_action="ignore"` now works for all array types ([GH 52219](https://github.com/pandas-dev/pandas/issues/52219), [GH 51645](https://github.com/pandas-dev/pandas/issues/51645), [GH 51809](https://github.com/pandas-dev/pandas/issues/51809), [GH 51936](https://github.com/pandas-dev/pandas/issues/51936), [GH 52033](https://github.com/pandas-dev/pandas/issues/52033); [GH 52096](https://github.com/pandas-dev/pandas/issues/52096)). + +*Previous behavior*: + +```None +In [1]: ser = pd.Series(["a", "b", np.nan], dtype="category") +In [2]: ser.map(str.upper, na_action="ignore") +NotImplementedError +In [3]: df = pd.DataFrame(ser) +In [4]: df.applymap(str.upper, na_action="ignore") # worked for DataFrame + 0 +0 A +1 B +2 NaN +In [5]: idx = pd.Index(ser) +In [6]: idx.map(str.upper, na_action="ignore") +TypeError: CategoricalIndex.map() got an unexpected keyword argument 'na_action' +``` + +*New behavior*: + +```None +In [5]: ser = pd.Series(["a", "b", np.nan], dtype="category") + +In [6]: ser.map(str.upper, na_action="ignore") +Out[6]: +0 A +1 B +2 NaN +dtype: category +Categories (2, object): ['A', 'B'] + +In [7]: df = pd.DataFrame(ser) + +In [8]: df.map(str.upper, na_action="ignore") +Out[8]: + 0 +0 A +1 B +2 NaN + +In [9]: idx = pd.Index(ser) + +In [10]: idx.map(str.upper, na_action="ignore") +Out[10]: CategoricalIndex(['A', 'B', nan], categories=['A', 'B'], ordered=False, dtype='category') +``` + +Also, note that `Categorical.map()` implicitly has had its `na_action` set to `"ignore"` by default. +This has been deprecated and the default for `Categorical.map()` will change +to `na_action=None`, consistent with all the other array types. + +### New implementation of [`DataFrame.stack()`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack")[#](#new-implementation-of-dataframe-stack "Link to this heading") + +pandas has reimplemented [`DataFrame.stack()`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack"). To use the new implementation, pass the argument `future_stack=True`. This will become the only option in pandas 3.0. + +The previous implementation had two main behavioral downsides. + +1. The previous implementation would unnecessarily introduce NA values into the result. The user could have NA values automatically removed by passing `dropna=True` (the default), but doing this could also remove NA values from the result that existed in the input. See the examples below. +2. The previous implementation with `sort=True` (the default) would sometimes sort part of the resulting index, and sometimes not. If the input’s columns are *not* a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex"), then the resulting index would never be sorted. If the columns are a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex"), then in most cases the level(s) in the resulting index that come from stacking the column level(s) would be sorted. In rare cases such level(s) would be sorted in a non-standard order, depending on how the columns were created. + +The new implementation (`future_stack=True`) will no longer unnecessarily introduce NA values when stacking multiple levels and will never sort. As such, the arguments `dropna` and `sort` are not utilized and must remain unspecified when using `future_stack=True`. These arguments will be removed in the next major release. + +```None +In [11]: columns = pd.MultiIndex.from_tuples([("B", "d"), ("A", "c")]) + +In [12]: df = pd.DataFrame([[0, 2], [1, 3]], index=["z", "y"], columns=columns) + +In [13]: df +Out[13]: + B A + d c +z 0 2 +y 1 3 +``` + +In the previous version (`future_stack=False`), the default of `dropna=True` would remove unnecessarily introduced NA values but still coerce the dtype to `float64` in the process. In the new version, no NAs are introduced and so there is no coercion of the dtype. + +```None +In [14]: df.stack([0, 1], future_stack=False, dropna=True) +Out[14]: +z A c 2.0 + B d 0.0 +y A c 3.0 + B d 1.0 +dtype: float64 + +In [15]: df.stack([0, 1], future_stack=True) +Out[15]: +z B d 0 + A c 2 +y B d 1 + A c 3 +dtype: int64 +``` + +If the input contains NA values, the previous version would drop those as well with `dropna=True` or introduce new NA values with `dropna=False`. The new version persists all values from the input. + +```None +In [16]: df = pd.DataFrame([[0, 2], [np.nan, np.nan]], columns=columns) + +In [17]: df +Out[17]: + B A + d c +0 0.0 2.0 +1 NaN NaN + +In [18]: df.stack([0, 1], future_stack=False, dropna=True) +Out[18]: +0 A c 2.0 + B d 0.0 +dtype: float64 + +In [19]: df.stack([0, 1], future_stack=False, dropna=False) +Out[19]: +0 A d NaN + c 2.0 + B d 0.0 + c NaN +1 A d NaN + c NaN + B d NaN + c NaN +dtype: float64 + +In [20]: df.stack([0, 1], future_stack=True) +Out[20]: +0 B d 0.0 + A c 2.0 +1 B d NaN + A c NaN +dtype: float64 +``` + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* [`Series.ffill()`](../reference/api/pandas.Series.ffill.html#pandas.Series.ffill "pandas.Series.ffill") and [`Series.bfill()`](../reference/api/pandas.Series.bfill.html#pandas.Series.bfill "pandas.Series.bfill") are now supported for objects with [`IntervalDtype`](../reference/api/pandas.IntervalDtype.html#pandas.IntervalDtype "pandas.IntervalDtype") ([GH 54247](https://github.com/pandas-dev/pandas/issues/54247)) +* Added `filters` parameter to [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") to filter out data, compatible with both `engines` ([GH 53212](https://github.com/pandas-dev/pandas/issues/53212)) +* `Categorical.map()` and [`CategoricalIndex.map()`](../reference/api/pandas.CategoricalIndex.map.html#pandas.CategoricalIndex.map "pandas.CategoricalIndex.map") now have a `na_action` parameter. + `Categorical.map()` implicitly had a default value of `"ignore"` for `na_action`. This has formally been deprecated and will be changed to `None` in the future. + Also notice that [`Series.map()`](../reference/api/pandas.Series.map.html#pandas.Series.map "pandas.Series.map") has default `na_action=None` and calls to series with categorical data will now use `na_action=None` unless explicitly set otherwise ([GH 44279](https://github.com/pandas-dev/pandas/issues/44279)) +* [`api.extensions.ExtensionArray`](../reference/api/pandas.api.extensions.ExtensionArray.html#pandas.api.extensions.ExtensionArray "pandas.api.extensions.ExtensionArray") now has a `map()` method ([GH 51809](https://github.com/pandas-dev/pandas/issues/51809)) +* [`DataFrame.applymap()`](../reference/api/pandas.DataFrame.applymap.html#pandas.DataFrame.applymap "pandas.DataFrame.applymap") now uses the `map()` method of underlying [`api.extensions.ExtensionArray`](../reference/api/pandas.api.extensions.ExtensionArray.html#pandas.api.extensions.ExtensionArray "pandas.api.extensions.ExtensionArray") instances ([GH 52219](https://github.com/pandas-dev/pandas/issues/52219)) +* `MultiIndex.sort_values()` now supports `na_position` ([GH 51612](https://github.com/pandas-dev/pandas/issues/51612)) +* [`MultiIndex.sortlevel()`](../reference/api/pandas.MultiIndex.sortlevel.html#pandas.MultiIndex.sortlevel "pandas.MultiIndex.sortlevel") and `Index.sortlevel()` gained a new keyword `na_position` ([GH 51612](https://github.com/pandas-dev/pandas/issues/51612)) +* `arrays.DatetimeArray.map()`, `arrays.TimedeltaArray.map()` and `arrays.PeriodArray.map()` can now take a `na_action` argument ([GH 51644](https://github.com/pandas-dev/pandas/issues/51644)) +* `arrays.SparseArray.map()` now supports `na_action` ([GH 52096](https://github.com/pandas-dev/pandas/issues/52096)). +* [`pandas.read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") now supports the `storage_options` keyword when used with a URL, allowing users to add headers to the outbound HTTP request ([GH 49944](https://github.com/pandas-dev/pandas/issues/49944)) +* Add `Index.diff()` and `Index.round()` ([GH 19708](https://github.com/pandas-dev/pandas/issues/19708)) +* Add `"latex-math"` as an option to the `escape` argument of [`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") which will not escape all characters between `"\("` and `"\)"` during formatting ([GH 51903](https://github.com/pandas-dev/pandas/issues/51903)) +* Add dtype of categories to `repr` information of [`CategoricalDtype`](../reference/api/pandas.CategoricalDtype.html#pandas.CategoricalDtype "pandas.CategoricalDtype") ([GH 52179](https://github.com/pandas-dev/pandas/issues/52179)) +* Adding `engine_kwargs` parameter to [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") ([GH 52214](https://github.com/pandas-dev/pandas/issues/52214)) +* Classes that are useful for type-hinting have been added to the public API in the new submodule `pandas.api.typing` ([GH 48577](https://github.com/pandas-dev/pandas/issues/48577)) +* Implemented [`Series.dt.is_month_start`](../reference/api/pandas.Series.dt.is_month_start.html#pandas.Series.dt.is_month_start "pandas.Series.dt.is_month_start"), [`Series.dt.is_month_end`](../reference/api/pandas.Series.dt.is_month_end.html#pandas.Series.dt.is_month_end "pandas.Series.dt.is_month_end"), [`Series.dt.is_year_start`](../reference/api/pandas.Series.dt.is_year_start.html#pandas.Series.dt.is_year_start "pandas.Series.dt.is_year_start"), [`Series.dt.is_year_end`](../reference/api/pandas.Series.dt.is_year_end.html#pandas.Series.dt.is_year_end "pandas.Series.dt.is_year_end"), [`Series.dt.is_quarter_start`](../reference/api/pandas.Series.dt.is_quarter_start.html#pandas.Series.dt.is_quarter_start "pandas.Series.dt.is_quarter_start"), [`Series.dt.is_quarter_end`](../reference/api/pandas.Series.dt.is_quarter_end.html#pandas.Series.dt.is_quarter_end "pandas.Series.dt.is_quarter_end"), [`Series.dt.days_in_month`](../reference/api/pandas.Series.dt.days_in_month.html#pandas.Series.dt.days_in_month "pandas.Series.dt.days_in_month"), [`Series.dt.unit`](../reference/api/pandas.Series.dt.unit.html#pandas.Series.dt.unit "pandas.Series.dt.unit"), [`Series.dt.normalize`](../reference/api/pandas.Series.dt.normalize.html#pandas.Series.dt.normalize "pandas.Series.dt.normalize"), [`Series.dt.day_name()`](../reference/api/pandas.Series.dt.day_name.html#pandas.Series.dt.day_name "pandas.Series.dt.day_name"), [`Series.dt.month_name()`](../reference/api/pandas.Series.dt.month_name.html#pandas.Series.dt.month_name "pandas.Series.dt.month_name"), [`Series.dt.tz_convert()`](../reference/api/pandas.Series.dt.tz_convert.html#pandas.Series.dt.tz_convert "pandas.Series.dt.tz_convert") for [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with `pyarrow.timestamp` ([GH 52388](https://github.com/pandas-dev/pandas/issues/52388), [GH 51718](https://github.com/pandas-dev/pandas/issues/51718)) +* [`DataFrameGroupBy.agg()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg") and [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") now support grouping by multiple keys when the index is not a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") for `engine="numba"` ([GH 53486](https://github.com/pandas-dev/pandas/issues/53486)) +* [`SeriesGroupBy.agg()`](../reference/api/pandas.core.groupby.SeriesGroupBy.agg.html#pandas.core.groupby.SeriesGroupBy.agg "pandas.core.groupby.SeriesGroupBy.agg") and [`DataFrameGroupBy.agg()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg") now support passing in multiple functions for `engine="numba"` ([GH 53486](https://github.com/pandas-dev/pandas/issues/53486)) +* [`SeriesGroupBy.transform()`](../reference/api/pandas.core.groupby.SeriesGroupBy.transform.html#pandas.core.groupby.SeriesGroupBy.transform "pandas.core.groupby.SeriesGroupBy.transform") and [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") now support passing in a string as the function for `engine="numba"` ([GH 53579](https://github.com/pandas-dev/pandas/issues/53579)) +* [`DataFrame.stack()`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack") gained the `sort` keyword to dictate whether the resulting [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") levels are sorted ([GH 15105](https://github.com/pandas-dev/pandas/issues/15105)) +* [`DataFrame.unstack()`](../reference/api/pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack") gained the `sort` keyword to dictate whether the resulting [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") levels are sorted ([GH 15105](https://github.com/pandas-dev/pandas/issues/15105)) +* [`Series.explode()`](../reference/api/pandas.Series.explode.html#pandas.Series.explode "pandas.Series.explode") now supports PyArrow-backed list types ([GH 53602](https://github.com/pandas-dev/pandas/issues/53602)) +* [`Series.str.join()`](../reference/api/pandas.Series.str.join.html#pandas.Series.str.join "pandas.Series.str.join") now supports `ArrowDtype(pa.string())` ([GH 53646](https://github.com/pandas-dev/pandas/issues/53646)) +* Add `validate` parameter to [`Categorical.from_codes()`](../reference/api/pandas.Categorical.from_codes.html#pandas.Categorical.from_codes "pandas.Categorical.from_codes") ([GH 50975](https://github.com/pandas-dev/pandas/issues/50975)) +* Added [`ExtensionArray.interpolate()`](../reference/api/pandas.api.extensions.ExtensionArray.interpolate.html#pandas.api.extensions.ExtensionArray.interpolate "pandas.api.extensions.ExtensionArray.interpolate") used by [`Series.interpolate()`](../reference/api/pandas.Series.interpolate.html#pandas.Series.interpolate "pandas.Series.interpolate") and [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") ([GH 53659](https://github.com/pandas-dev/pandas/issues/53659)) +* Added `engine_kwargs` parameter to [`DataFrame.to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel") ([GH 53220](https://github.com/pandas-dev/pandas/issues/53220)) +* Implemented [`api.interchange.from_dataframe()`](../reference/api/pandas.api.interchange.from_dataframe.html#pandas.api.interchange.from_dataframe "pandas.api.interchange.from_dataframe") for [`DatetimeTZDtype`](../reference/api/pandas.DatetimeTZDtype.html#pandas.DatetimeTZDtype "pandas.DatetimeTZDtype") ([GH 54239](https://github.com/pandas-dev/pandas/issues/54239)) +* Implemented `__from_arrow__` on [`DatetimeTZDtype`](../reference/api/pandas.DatetimeTZDtype.html#pandas.DatetimeTZDtype "pandas.DatetimeTZDtype") ([GH 52201](https://github.com/pandas-dev/pandas/issues/52201)) +* Implemented `__pandas_priority__` to allow custom types to take precedence over [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame"), [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), or [`ExtensionArray`](../reference/api/pandas.api.extensions.ExtensionArray.html#pandas.api.extensions.ExtensionArray "pandas.api.extensions.ExtensionArray") for arithmetic operations, [see the developer guide](../development/extending.html#extending-pandas-priority) ([GH 48347](https://github.com/pandas-dev/pandas/issues/48347)) +* Improve error message when having incompatible columns using [`DataFrame.merge()`](../reference/api/pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge") ([GH 51861](https://github.com/pandas-dev/pandas/issues/51861)) +* Improve error message when setting [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with wrong number of columns through `DataFrame.isetitem()` ([GH 51701](https://github.com/pandas-dev/pandas/issues/51701)) +* Improved error handling when using [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") with incompatible `index` and `orient` arguments ([GH 52143](https://github.com/pandas-dev/pandas/issues/52143)) +* Improved error message when creating a DataFrame with empty data (0 rows), no index and an incorrect number of columns ([GH 52084](https://github.com/pandas-dev/pandas/issues/52084)) +* Improved error message when providing an invalid `index` or `offset` argument to [`VariableOffsetWindowIndexer`](../reference/api/pandas.api.indexers.VariableOffsetWindowIndexer.html#pandas.api.indexers.VariableOffsetWindowIndexer "pandas.api.indexers.VariableOffsetWindowIndexer") ([GH 54379](https://github.com/pandas-dev/pandas/issues/54379)) +* Let [`DataFrame.to_feather()`](../reference/api/pandas.DataFrame.to_feather.html#pandas.DataFrame.to_feather "pandas.DataFrame.to_feather") accept a non-default [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") and non-string column names ([GH 51787](https://github.com/pandas-dev/pandas/issues/51787)) +* Added a new parameter `by_row` to [`Series.apply()`](../reference/api/pandas.Series.apply.html#pandas.Series.apply "pandas.Series.apply") and [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply"). When set to `False` the supplied callables will always operate on the whole Series or DataFrame ([GH 53400](https://github.com/pandas-dev/pandas/issues/53400), [GH 53601](https://github.com/pandas-dev/pandas/issues/53601)). +* [`DataFrame.shift()`](../reference/api/pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift") and [`Series.shift()`](../reference/api/pandas.Series.shift.html#pandas.Series.shift "pandas.Series.shift") now allow shifting by multiple periods by supplying a list of periods ([GH 44424](https://github.com/pandas-dev/pandas/issues/44424)) +* Groupby aggregations with `numba` (such as [`DataFrameGroupBy.sum()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.sum.html#pandas.core.groupby.DataFrameGroupBy.sum "pandas.core.groupby.DataFrameGroupBy.sum")) now can preserve the dtype of the input instead of casting to `float64` ([GH 44952](https://github.com/pandas-dev/pandas/issues/44952)) +* Improved error message when [`DataFrameGroupBy.agg()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg") failed ([GH 52930](https://github.com/pandas-dev/pandas/issues/52930)) +* Many read/to\_\* functions, such as [`DataFrame.to_pickle()`](../reference/api/pandas.DataFrame.to_pickle.html#pandas.DataFrame.to_pickle "pandas.DataFrame.to_pickle") and [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv"), support forwarding compression arguments to `lzma.LZMAFile` ([GH 52979](https://github.com/pandas-dev/pandas/issues/52979)) +* Reductions [`Series.argmax()`](../reference/api/pandas.Series.argmax.html#pandas.Series.argmax "pandas.Series.argmax"), [`Series.argmin()`](../reference/api/pandas.Series.argmin.html#pandas.Series.argmin "pandas.Series.argmin"), [`Series.idxmax()`](../reference/api/pandas.Series.idxmax.html#pandas.Series.idxmax "pandas.Series.idxmax"), [`Series.idxmin()`](../reference/api/pandas.Series.idxmin.html#pandas.Series.idxmin "pandas.Series.idxmin"), [`Index.argmax()`](../reference/api/pandas.Index.argmax.html#pandas.Index.argmax "pandas.Index.argmax"), [`Index.argmin()`](../reference/api/pandas.Index.argmin.html#pandas.Index.argmin "pandas.Index.argmin"), [`DataFrame.idxmax()`](../reference/api/pandas.DataFrame.idxmax.html#pandas.DataFrame.idxmax "pandas.DataFrame.idxmax"), [`DataFrame.idxmin()`](../reference/api/pandas.DataFrame.idxmin.html#pandas.DataFrame.idxmin "pandas.DataFrame.idxmin") are now supported for object-dtype ([GH 4279](https://github.com/pandas-dev/pandas/issues/4279), [GH 18021](https://github.com/pandas-dev/pandas/issues/18021), [GH 40685](https://github.com/pandas-dev/pandas/issues/40685), [GH 43697](https://github.com/pandas-dev/pandas/issues/43697)) +* [`DataFrame.to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") and [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") will now write and read `attrs` respectively ([GH 54346](https://github.com/pandas-dev/pandas/issues/54346)) +* [`Index.all()`](../reference/api/pandas.Index.all.html#pandas.Index.all "pandas.Index.all") and [`Index.any()`](../reference/api/pandas.Index.any.html#pandas.Index.any "pandas.Index.any") with floating dtypes and timedelta64 dtypes no longer raise `TypeError`, matching the [`Series.all()`](../reference/api/pandas.Series.all.html#pandas.Series.all "pandas.Series.all") and [`Series.any()`](../reference/api/pandas.Series.any.html#pandas.Series.any "pandas.Series.any") behavior ([GH 54566](https://github.com/pandas-dev/pandas/issues/54566)) +* [`Series.cummax()`](../reference/api/pandas.Series.cummax.html#pandas.Series.cummax "pandas.Series.cummax"), [`Series.cummin()`](../reference/api/pandas.Series.cummin.html#pandas.Series.cummin "pandas.Series.cummin") and [`Series.cumprod()`](../reference/api/pandas.Series.cumprod.html#pandas.Series.cumprod "pandas.Series.cumprod") are now supported for pyarrow dtypes with pyarrow version 13.0 and above ([GH 52085](https://github.com/pandas-dev/pandas/issues/52085)) +* Added support for the DataFrame Consortium Standard ([GH 54383](https://github.com/pandas-dev/pandas/issues/54383)) +* Performance improvement in [`DataFrameGroupBy.quantile()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.quantile.html#pandas.core.groupby.DataFrameGroupBy.quantile "pandas.core.groupby.DataFrameGroupBy.quantile") and [`SeriesGroupBy.quantile()`](../reference/api/pandas.core.groupby.SeriesGroupBy.quantile.html#pandas.core.groupby.SeriesGroupBy.quantile "pandas.core.groupby.SeriesGroupBy.quantile") ([GH 51722](https://github.com/pandas-dev/pandas/issues/51722)) +* PyArrow-backed integer dtypes now support bitwise operations ([GH 54495](https://github.com/pandas-dev/pandas/issues/54495)) + +## Backwards incompatible API changes[#](#backwards-incompatible-api-changes "Link to this heading") + +### Increased minimum version for Python[#](#increased-minimum-version-for-python "Link to this heading") + +pandas 2.1.0 supports Python 3.9 and higher. + +### Increased minimum versions for dependencies[#](#increased-minimum-versions-for-dependencies "Link to this heading") + +Some minimum supported versions of dependencies were updated. +If installed, we now require: + +| Package | Minimum Version | Required | Changed | +| --- | --- | --- | --- | +| numpy | 1.22.4 | X | X | +| mypy (dev) | 1.4.1 | | X | +| beautifulsoup4 | 4.11.1 | | X | +| bottleneck | 1.3.4 | | X | +| dataframe-api-compat | 0.1.7 | | X | +| fastparquet | 0.8.1 | | X | +| fsspec | 2022.05.0 | | X | +| hypothesis | 6.46.1 | | X | +| gcsfs | 2022.05.0 | | X | +| jinja2 | 3.1.2 | | X | +| lxml | 4.8.0 | | X | +| numba | 0.55.2 | | X | +| numexpr | 2.8.0 | | X | +| openpyxl | 3.0.10 | | X | +| pandas-gbq | 0.17.5 | | X | +| psycopg2 | 2.9.3 | | X | +| pyreadstat | 1.1.5 | | X | +| pyqt5 | 5.15.6 | | X | +| pytables | 3.7.0 | | X | +| pytest | 7.3.2 | | X | +| python-snappy | 0.6.1 | | X | +| pyxlsb | 1.0.9 | | X | +| s3fs | 2022.05.0 | | X | +| scipy | 1.8.1 | | X | +| sqlalchemy | 1.4.36 | | X | +| tabulate | 0.8.10 | | X | +| xarray | 2022.03.0 | | X | +| xlsxwriter | 3.0.3 | | X | +| zstandard | 0.17.0 | | X | + +For [optional libraries](https://pandas.pydata.org/docs/getting_started/install.html) the general recommendation is to use the latest version. + +See [Dependencies](../getting_started/install.html#install-dependencies) and [Optional dependencies](../getting_started/install.html#install-optional-dependencies) for more. + +### Other API changes[#](#other-api-changes "Link to this heading") + +* `arrays.PandasArray` has been renamed [`NumpyExtensionArray`](../reference/api/pandas.arrays.NumpyExtensionArray.html#pandas.arrays.NumpyExtensionArray "pandas.arrays.NumpyExtensionArray") and the attached dtype name changed from `PandasDtype` to `NumpyEADtype`; importing `PandasArray` still works until the next major version ([GH 53694](https://github.com/pandas-dev/pandas/issues/53694)) + +## Deprecations[#](#deprecations "Link to this heading") + +### Deprecated silent upcasting in setitem-like Series operations[#](#deprecated-silent-upcasting-in-setitem-like-series-operations "Link to this heading") + +PDEP-6: + +Setitem-like operations on Series (or DataFrame columns) which silently upcast the dtype are +deprecated and show a warning. Examples of affected operations are: + +* `ser.fillna('foo', inplace=True)` +* `ser.where(ser.isna(), 'foo', inplace=True)` +* `ser.iloc[indexer] = 'foo'` +* `ser.loc[indexer] = 'foo'` +* `df.iloc[indexer, 0] = 'foo'` +* `df.loc[indexer, 'a'] = 'foo'` +* `ser[indexer] = 'foo'` + +where `ser` is a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), `df` is a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame"), and `indexer` +could be a slice, a mask, a single value, a list or array of values, or any other +allowed indexer. + +In a future version, these will raise an error and you should cast to a common dtype first. + +*Previous behavior*: + +```None +In [1]: ser = pd.Series([1, 2, 3]) + +In [2]: ser +Out[2]: +0 1 +1 2 +2 3 +dtype: int64 + +In [3]: ser[0] = 'not an int64' + +In [4]: ser +Out[4]: +0 not an int64 +1 2 +2 3 +dtype: object +``` + +*New behavior*: + +```None +In [1]: ser = pd.Series([1, 2, 3]) + +In [2]: ser +Out[2]: +0 1 +1 2 +2 3 +dtype: int64 + +In [3]: ser[0] = 'not an int64' +FutureWarning: + Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. + Value 'not an int64' has dtype incompatible with int64, please explicitly cast to a compatible dtype first. + +In [4]: ser +Out[4]: +0 not an int64 +1 2 +2 3 +dtype: object +``` + +To retain the current behaviour, in the case above you could cast `ser` to `object` dtype first: + +```None +In [21]: ser = pd.Series([1, 2, 3]) + +In [22]: ser = ser.astype('object') + +In [23]: ser[0] = 'not an int64' + +In [24]: ser +Out[24]: +0 not an int64 +1 2 +2 3 +dtype: object +``` + +Depending on the use-case, it might be more appropriate to cast to a different dtype. +In the following, for example, we cast to `float64`: + +```None +In [25]: ser = pd.Series([1, 2, 3]) + +In [26]: ser = ser.astype('float64') + +In [27]: ser[0] = 1.1 + +In [28]: ser +Out[28]: +0 1.1 +1 2.0 +2 3.0 +dtype: float64 +``` + +For further reading, please see . + +### Deprecated parsing datetimes with mixed time zones[#](#deprecated-parsing-datetimes-with-mixed-time-zones "Link to this heading") + +Parsing datetimes with mixed time zones is deprecated and shows a warning unless user passes `utc=True` to [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") ([GH 50887](https://github.com/pandas-dev/pandas/issues/50887)) + +*Previous behavior*: + +```None +In [7]: data = ["2020-01-01 00:00:00+06:00", "2020-01-01 00:00:00+01:00"] + +In [8]: pd.to_datetime(data, utc=False) +Out[8]: +Index([2020-01-01 00:00:00+06:00, 2020-01-01 00:00:00+01:00], dtype='object') +``` + +*New behavior*: + +```None +In [9]: pd.to_datetime(data, utc=False) +FutureWarning: + In a future version of pandas, parsing datetimes with mixed time zones will raise + a warning unless `utc=True`. Please specify `utc=True` to opt in to the new behaviour + and silence this warning. To create a `Series` with mixed offsets and `object` dtype, + please use `apply` and `datetime.datetime.strptime`. +Index([2020-01-01 00:00:00+06:00, 2020-01-01 00:00:00+01:00], dtype='object') +``` + +In order to silence this warning and avoid an error in a future version of pandas, +please specify `utc=True`: + +```None +In [29]: data = ["2020-01-01 00:00:00+06:00", "2020-01-01 00:00:00+01:00"] + +In [30]: pd.to_datetime(data, utc=True) +Out[30]: DatetimeIndex(['2019-12-31 18:00:00+00:00', '2019-12-31 23:00:00+00:00'], dtype='datetime64[ns, UTC]', freq=None) +``` + +To create a `Series` with mixed offsets and `object` dtype, please use `apply` +and `datetime.datetime.strptime`: + +```None +In [31]: import datetime as dt + +In [32]: data = ["2020-01-01 00:00:00+06:00", "2020-01-01 00:00:00+01:00"] + +In [33]: pd.Series(data).apply(lambda x: dt.datetime.strptime(x, '%Y-%m-%d %H:%M:%S%z')) +Out[33]: +0 2020-01-01 00:00:00+06:00 +1 2020-01-01 00:00:00+01:00 +dtype: object +``` + +### Other Deprecations[#](#other-deprecations "Link to this heading") + +* Deprecated `DataFrameGroupBy.dtypes`, check `dtypes` on the underlying object instead ([GH 51045](https://github.com/pandas-dev/pandas/issues/51045)) +* Deprecated `DataFrame._data` and `Series._data`, use public APIs instead ([GH 33333](https://github.com/pandas-dev/pandas/issues/33333)) +* Deprecated [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") behavior when any of the objects being concatenated have length 0; in the past the dtypes of empty objects were ignored when determining the resulting dtype, in a future version they will not ([GH 39122](https://github.com/pandas-dev/pandas/issues/39122)) +* Deprecated `Categorical.to_list()`, use `obj.tolist()` instead ([GH 51254](https://github.com/pandas-dev/pandas/issues/51254)) +* Deprecated [`DataFrameGroupBy.all()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.all.html#pandas.core.groupby.DataFrameGroupBy.all "pandas.core.groupby.DataFrameGroupBy.all") and [`DataFrameGroupBy.any()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.any.html#pandas.core.groupby.DataFrameGroupBy.any "pandas.core.groupby.DataFrameGroupBy.any") with datetime64 or [`PeriodDtype`](../reference/api/pandas.PeriodDtype.html#pandas.PeriodDtype "pandas.PeriodDtype") values, matching the [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") deprecations ([GH 34479](https://github.com/pandas-dev/pandas/issues/34479)) +* Deprecated `axis=1` in [`DataFrame.ewm()`](../reference/api/pandas.DataFrame.ewm.html#pandas.DataFrame.ewm "pandas.DataFrame.ewm"), [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling"), [`DataFrame.expanding()`](../reference/api/pandas.DataFrame.expanding.html#pandas.DataFrame.expanding "pandas.DataFrame.expanding"), transpose before calling the method instead ([GH 51778](https://github.com/pandas-dev/pandas/issues/51778)) +* Deprecated `axis=1` in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") and in [`Grouper`](../reference/api/pandas.Grouper.html#pandas.Grouper "pandas.Grouper") constructor, do `frame.T.groupby(...)` instead ([GH 51203](https://github.com/pandas-dev/pandas/issues/51203)) +* Deprecated `broadcast_axis` keyword in [`Series.align()`](../reference/api/pandas.Series.align.html#pandas.Series.align "pandas.Series.align") and [`DataFrame.align()`](../reference/api/pandas.DataFrame.align.html#pandas.DataFrame.align "pandas.DataFrame.align"), upcast before calling `align` with `left = DataFrame({col: left for col in right.columns}, index=right.index)` ([GH 51856](https://github.com/pandas-dev/pandas/issues/51856)) +* Deprecated `downcast` keyword in [`Index.fillna()`](../reference/api/pandas.Index.fillna.html#pandas.Index.fillna "pandas.Index.fillna") ([GH 53956](https://github.com/pandas-dev/pandas/issues/53956)) +* Deprecated `fill_method` and `limit` keywords in [`DataFrame.pct_change()`](../reference/api/pandas.DataFrame.pct_change.html#pandas.DataFrame.pct_change "pandas.DataFrame.pct_change"), [`Series.pct_change()`](../reference/api/pandas.Series.pct_change.html#pandas.Series.pct_change "pandas.Series.pct_change"), [`DataFrameGroupBy.pct_change()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.pct_change.html#pandas.core.groupby.DataFrameGroupBy.pct_change "pandas.core.groupby.DataFrameGroupBy.pct_change"), and [`SeriesGroupBy.pct_change()`](../reference/api/pandas.core.groupby.SeriesGroupBy.pct_change.html#pandas.core.groupby.SeriesGroupBy.pct_change "pandas.core.groupby.SeriesGroupBy.pct_change"), explicitly call e.g. [`DataFrame.ffill()`](../reference/api/pandas.DataFrame.ffill.html#pandas.DataFrame.ffill "pandas.DataFrame.ffill") or [`DataFrame.bfill()`](../reference/api/pandas.DataFrame.bfill.html#pandas.DataFrame.bfill "pandas.DataFrame.bfill") before calling `pct_change` instead ([GH 53491](https://github.com/pandas-dev/pandas/issues/53491)) +* Deprecated `method`, `limit`, and `fill_axis` keywords in [`DataFrame.align()`](../reference/api/pandas.DataFrame.align.html#pandas.DataFrame.align "pandas.DataFrame.align") and [`Series.align()`](../reference/api/pandas.Series.align.html#pandas.Series.align "pandas.Series.align"), explicitly call [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") or [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") on the alignment results instead ([GH 51856](https://github.com/pandas-dev/pandas/issues/51856)) +* Deprecated `quantile` keyword in [`Rolling.quantile()`](../reference/api/pandas.core.window.rolling.Rolling.quantile.html#pandas.core.window.rolling.Rolling.quantile "pandas.core.window.rolling.Rolling.quantile") and [`Expanding.quantile()`](../reference/api/pandas.core.window.expanding.Expanding.quantile.html#pandas.core.window.expanding.Expanding.quantile "pandas.core.window.expanding.Expanding.quantile"), renamed to `q` instead ([GH 52550](https://github.com/pandas-dev/pandas/issues/52550)) +* Deprecated accepting slices in [`DataFrame.take()`](../reference/api/pandas.DataFrame.take.html#pandas.DataFrame.take "pandas.DataFrame.take"), call `obj[slicer]` or pass a sequence of integers instead ([GH 51539](https://github.com/pandas-dev/pandas/issues/51539)) +* Deprecated behavior of [`DataFrame.idxmax()`](../reference/api/pandas.DataFrame.idxmax.html#pandas.DataFrame.idxmax "pandas.DataFrame.idxmax"), [`DataFrame.idxmin()`](../reference/api/pandas.DataFrame.idxmin.html#pandas.DataFrame.idxmin "pandas.DataFrame.idxmin"), [`Series.idxmax()`](../reference/api/pandas.Series.idxmax.html#pandas.Series.idxmax "pandas.Series.idxmax"), [`Series.idxmin()`](../reference/api/pandas.Series.idxmin.html#pandas.Series.idxmin "pandas.Series.idxmin") in with all-NA entries or any-NA and `skipna=False`; in a future version these will raise `ValueError` ([GH 51276](https://github.com/pandas-dev/pandas/issues/51276)) +* Deprecated explicit support for subclassing [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") ([GH 45289](https://github.com/pandas-dev/pandas/issues/45289)) +* Deprecated making functions given to [`Series.agg()`](../reference/api/pandas.Series.agg.html#pandas.Series.agg "pandas.Series.agg") attempt to operate on each element in the [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and only operate on the whole [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") if the elementwise operations failed. In the future, functions given to [`Series.agg()`](../reference/api/pandas.Series.agg.html#pandas.Series.agg "pandas.Series.agg") will always operate on the whole [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") only. To keep the current behavior, use [`Series.transform()`](../reference/api/pandas.Series.transform.html#pandas.Series.transform "pandas.Series.transform") instead ([GH 53325](https://github.com/pandas-dev/pandas/issues/53325)) +* Deprecated making the functions in a list of functions given to [`DataFrame.agg()`](../reference/api/pandas.DataFrame.agg.html#pandas.DataFrame.agg "pandas.DataFrame.agg") attempt to operate on each element in the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and only operate on the columns of the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") if the elementwise operations failed. To keep the current behavior, use [`DataFrame.transform()`](../reference/api/pandas.DataFrame.transform.html#pandas.DataFrame.transform "pandas.DataFrame.transform") instead ([GH 53325](https://github.com/pandas-dev/pandas/issues/53325)) +* Deprecated passing a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") to [`DataFrame.from_records()`](../reference/api/pandas.DataFrame.from_records.html#pandas.DataFrame.from_records "pandas.DataFrame.from_records"), use [`DataFrame.set_index()`](../reference/api/pandas.DataFrame.set_index.html#pandas.DataFrame.set_index "pandas.DataFrame.set_index") or [`DataFrame.drop()`](../reference/api/pandas.DataFrame.drop.html#pandas.DataFrame.drop "pandas.DataFrame.drop") instead ([GH 51353](https://github.com/pandas-dev/pandas/issues/51353)) +* Deprecated silently dropping unrecognized timezones when parsing strings to datetimes ([GH 18702](https://github.com/pandas-dev/pandas/issues/18702)) +* Deprecated the `axis` keyword in [`DataFrame.ewm()`](../reference/api/pandas.DataFrame.ewm.html#pandas.DataFrame.ewm "pandas.DataFrame.ewm"), [`Series.ewm()`](../reference/api/pandas.Series.ewm.html#pandas.Series.ewm "pandas.Series.ewm"), [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling"), [`Series.rolling()`](../reference/api/pandas.Series.rolling.html#pandas.Series.rolling "pandas.Series.rolling"), [`DataFrame.expanding()`](../reference/api/pandas.DataFrame.expanding.html#pandas.DataFrame.expanding "pandas.DataFrame.expanding"), [`Series.expanding()`](../reference/api/pandas.Series.expanding.html#pandas.Series.expanding "pandas.Series.expanding") ([GH 51778](https://github.com/pandas-dev/pandas/issues/51778)) +* Deprecated the `axis` keyword in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample"), [`Series.resample()`](../reference/api/pandas.Series.resample.html#pandas.Series.resample "pandas.Series.resample") ([GH 51778](https://github.com/pandas-dev/pandas/issues/51778)) +* Deprecated the `downcast` keyword in [`Series.interpolate()`](../reference/api/pandas.Series.interpolate.html#pandas.Series.interpolate "pandas.Series.interpolate"), [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate"), [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna"), [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna"), [`Series.ffill()`](../reference/api/pandas.Series.ffill.html#pandas.Series.ffill "pandas.Series.ffill"), [`DataFrame.ffill()`](../reference/api/pandas.DataFrame.ffill.html#pandas.DataFrame.ffill "pandas.DataFrame.ffill"), [`Series.bfill()`](../reference/api/pandas.Series.bfill.html#pandas.Series.bfill "pandas.Series.bfill"), [`DataFrame.bfill()`](../reference/api/pandas.DataFrame.bfill.html#pandas.DataFrame.bfill "pandas.DataFrame.bfill") ([GH 40988](https://github.com/pandas-dev/pandas/issues/40988)) +* Deprecated the behavior of [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") with both `len(keys) != len(objs)`, in a future version this will raise instead of truncating to the shorter of the two sequences ([GH 43485](https://github.com/pandas-dev/pandas/issues/43485)) +* Deprecated the behavior of [`Series.argsort()`](../reference/api/pandas.Series.argsort.html#pandas.Series.argsort "pandas.Series.argsort") in the presence of NA values; in a future version these will be sorted at the end instead of giving -1 ([GH 54219](https://github.com/pandas-dev/pandas/issues/54219)) +* Deprecated the default of `observed=False` in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") and [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby"); this will default to `True` in a future version ([GH 43999](https://github.com/pandas-dev/pandas/issues/43999)) +* Deprecating pinning `group.name` to each group in [`SeriesGroupBy.aggregate()`](../reference/api/pandas.core.groupby.SeriesGroupBy.aggregate.html#pandas.core.groupby.SeriesGroupBy.aggregate "pandas.core.groupby.SeriesGroupBy.aggregate") aggregations; if your operation requires utilizing the groupby keys, iterate over the groupby object instead ([GH 41090](https://github.com/pandas-dev/pandas/issues/41090)) +* Deprecated the `axis` keyword in [`DataFrameGroupBy.idxmax()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.idxmax.html#pandas.core.groupby.DataFrameGroupBy.idxmax "pandas.core.groupby.DataFrameGroupBy.idxmax"), [`DataFrameGroupBy.idxmin()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.idxmin.html#pandas.core.groupby.DataFrameGroupBy.idxmin "pandas.core.groupby.DataFrameGroupBy.idxmin"), [`DataFrameGroupBy.fillna()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.fillna.html#pandas.core.groupby.DataFrameGroupBy.fillna "pandas.core.groupby.DataFrameGroupBy.fillna"), [`DataFrameGroupBy.take()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.take.html#pandas.core.groupby.DataFrameGroupBy.take "pandas.core.groupby.DataFrameGroupBy.take"), [`DataFrameGroupBy.skew()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.skew.html#pandas.core.groupby.DataFrameGroupBy.skew "pandas.core.groupby.DataFrameGroupBy.skew"), [`DataFrameGroupBy.rank()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.rank.html#pandas.core.groupby.DataFrameGroupBy.rank "pandas.core.groupby.DataFrameGroupBy.rank"), [`DataFrameGroupBy.cumprod()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cumprod.html#pandas.core.groupby.DataFrameGroupBy.cumprod "pandas.core.groupby.DataFrameGroupBy.cumprod"), [`DataFrameGroupBy.cumsum()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cumsum.html#pandas.core.groupby.DataFrameGroupBy.cumsum "pandas.core.groupby.DataFrameGroupBy.cumsum"), [`DataFrameGroupBy.cummax()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cummax.html#pandas.core.groupby.DataFrameGroupBy.cummax "pandas.core.groupby.DataFrameGroupBy.cummax"), [`DataFrameGroupBy.cummin()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.cummin.html#pandas.core.groupby.DataFrameGroupBy.cummin "pandas.core.groupby.DataFrameGroupBy.cummin"), [`DataFrameGroupBy.pct_change()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.pct_change.html#pandas.core.groupby.DataFrameGroupBy.pct_change "pandas.core.groupby.DataFrameGroupBy.pct_change"), [`DataFrameGroupBy.diff()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.diff.html#pandas.core.groupby.DataFrameGroupBy.diff "pandas.core.groupby.DataFrameGroupBy.diff"), [`DataFrameGroupBy.shift()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.shift.html#pandas.core.groupby.DataFrameGroupBy.shift "pandas.core.groupby.DataFrameGroupBy.shift"), and [`DataFrameGroupBy.corrwith()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.corrwith.html#pandas.core.groupby.DataFrameGroupBy.corrwith "pandas.core.groupby.DataFrameGroupBy.corrwith"); for `axis=1` operate on the underlying [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") instead ([GH 50405](https://github.com/pandas-dev/pandas/issues/50405), [GH 51046](https://github.com/pandas-dev/pandas/issues/51046)) +* Deprecated `DataFrameGroupBy` with `as_index=False` not including groupings in the result when they are not columns of the DataFrame ([GH 49519](https://github.com/pandas-dev/pandas/issues/49519)) +* Deprecated `is_categorical_dtype()`, use `isinstance(obj.dtype, pd.CategoricalDtype)` instead ([GH 52527](https://github.com/pandas-dev/pandas/issues/52527)) +* Deprecated `is_datetime64tz_dtype()`, check `isinstance(dtype, pd.DatetimeTZDtype)` instead ([GH 52607](https://github.com/pandas-dev/pandas/issues/52607)) +* Deprecated `is_int64_dtype()`, check `dtype == np.dtype(np.int64)` instead ([GH 52564](https://github.com/pandas-dev/pandas/issues/52564)) +* Deprecated `is_interval_dtype()`, check `isinstance(dtype, pd.IntervalDtype)` instead ([GH 52607](https://github.com/pandas-dev/pandas/issues/52607)) +* Deprecated `is_period_dtype()`, check `isinstance(dtype, pd.PeriodDtype)` instead ([GH 52642](https://github.com/pandas-dev/pandas/issues/52642)) +* Deprecated `is_sparse()`, check `isinstance(dtype, pd.SparseDtype)` instead ([GH 52642](https://github.com/pandas-dev/pandas/issues/52642)) +* Deprecated `Styler.applymap_index()`. Use the new [`Styler.map_index()`](../reference/api/pandas.io.formats.style.Styler.map_index.html#pandas.io.formats.style.Styler.map_index "pandas.io.formats.style.Styler.map_index") method instead ([GH 52708](https://github.com/pandas-dev/pandas/issues/52708)) +* Deprecated `Styler.applymap()`. Use the new [`Styler.map()`](../reference/api/pandas.io.formats.style.Styler.map.html#pandas.io.formats.style.Styler.map "pandas.io.formats.style.Styler.map") method instead ([GH 52708](https://github.com/pandas-dev/pandas/issues/52708)) +* Deprecated [`DataFrame.applymap()`](../reference/api/pandas.DataFrame.applymap.html#pandas.DataFrame.applymap "pandas.DataFrame.applymap"). Use the new [`DataFrame.map()`](../reference/api/pandas.DataFrame.map.html#pandas.DataFrame.map "pandas.DataFrame.map") method instead ([GH 52353](https://github.com/pandas-dev/pandas/issues/52353)) +* Deprecated [`DataFrame.swapaxes()`](../reference/api/pandas.DataFrame.swapaxes.html#pandas.DataFrame.swapaxes "pandas.DataFrame.swapaxes") and `Series.swapaxes()`, use [`DataFrame.transpose()`](../reference/api/pandas.DataFrame.transpose.html#pandas.DataFrame.transpose "pandas.DataFrame.transpose") or `Series.transpose()` instead ([GH 51946](https://github.com/pandas-dev/pandas/issues/51946)) +* Deprecated `freq` parameter in [`PeriodArray`](../reference/api/pandas.arrays.PeriodArray.html#pandas.arrays.PeriodArray "pandas.arrays.PeriodArray") constructor, pass `dtype` instead ([GH 52462](https://github.com/pandas-dev/pandas/issues/52462)) +* Deprecated allowing non-standard inputs in `take()`, pass either a `numpy.ndarray`, [`ExtensionArray`](../reference/api/pandas.api.extensions.ExtensionArray.html#pandas.api.extensions.ExtensionArray "pandas.api.extensions.ExtensionArray"), [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), or [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") ([GH 52981](https://github.com/pandas-dev/pandas/issues/52981)) +* Deprecated allowing non-standard sequences for `isin()`, `value_counts()`, [`unique()`](../reference/api/pandas.unique.html#pandas.unique "pandas.unique"), [`factorize()`](../reference/api/pandas.factorize.html#pandas.factorize "pandas.factorize"), case to one of `numpy.ndarray`, [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), [`ExtensionArray`](../reference/api/pandas.api.extensions.ExtensionArray.html#pandas.api.extensions.ExtensionArray "pandas.api.extensions.ExtensionArray"), or [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") before calling ([GH 52986](https://github.com/pandas-dev/pandas/issues/52986)) +* Deprecated behavior of [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") reductions `sum`, `prod`, `std`, `var`, `sem` with `axis=None`, in a future version this will operate over both axes returning a scalar instead of behaving like `axis=0`; note this also affects numpy functions e.g. `np.sum(df)` ([GH 21597](https://github.com/pandas-dev/pandas/issues/21597)) +* Deprecated behavior of [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") when [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") has columns that are all-NA, in a future version these will not be discarded when determining the resulting dtype ([GH 40893](https://github.com/pandas-dev/pandas/issues/40893)) +* Deprecated behavior of [`Series.dt.to_pydatetime()`](../reference/api/pandas.Series.dt.to_pydatetime.html#pandas.Series.dt.to_pydatetime "pandas.Series.dt.to_pydatetime"), in a future version this will return a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") containing python `datetime` objects instead of an `ndarray` of datetimes; this matches the behavior of other [`Series.dt`](../reference/api/pandas.Series.dt.html#pandas.Series.dt "pandas.Series.dt") properties ([GH 20306](https://github.com/pandas-dev/pandas/issues/20306)) +* Deprecated logical operations (`|`, `&`, `^`) between pandas objects and dtype-less sequences (e.g. `list`, `tuple`), wrap a sequence in a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or NumPy array before operating instead ([GH 51521](https://github.com/pandas-dev/pandas/issues/51521)) +* Deprecated parameter `convert_type` in [`Series.apply()`](../reference/api/pandas.Series.apply.html#pandas.Series.apply "pandas.Series.apply") ([GH 52140](https://github.com/pandas-dev/pandas/issues/52140)) +* Deprecated passing a dictionary to [`SeriesGroupBy.agg()`](../reference/api/pandas.core.groupby.SeriesGroupBy.agg.html#pandas.core.groupby.SeriesGroupBy.agg "pandas.core.groupby.SeriesGroupBy.agg"); pass a list of aggregations instead ([GH 50684](https://github.com/pandas-dev/pandas/issues/50684)) +* Deprecated the `fastpath` keyword in [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") constructor, use [`Categorical.from_codes()`](../reference/api/pandas.Categorical.from_codes.html#pandas.Categorical.from_codes "pandas.Categorical.from_codes") instead ([GH 20110](https://github.com/pandas-dev/pandas/issues/20110)) +* Deprecated the behavior of `is_bool_dtype()` returning `True` for object-dtype [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") of bool objects ([GH 52680](https://github.com/pandas-dev/pandas/issues/52680)) +* Deprecated the methods [`Series.bool()`](../reference/api/pandas.Series.bool.html#pandas.Series.bool "pandas.Series.bool") and [`DataFrame.bool()`](../reference/api/pandas.DataFrame.bool.html#pandas.DataFrame.bool "pandas.DataFrame.bool") ([GH 51749](https://github.com/pandas-dev/pandas/issues/51749)) +* Deprecated unused `closed` and `normalize` keywords in the [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") constructor ([GH 52628](https://github.com/pandas-dev/pandas/issues/52628)) +* Deprecated unused `closed` keyword in the [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") constructor ([GH 52628](https://github.com/pandas-dev/pandas/issues/52628)) +* Deprecated logical operation between two non boolean [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with different indexes always coercing the result to bool dtype. In a future version, this will maintain the return type of the inputs ([GH 52500](https://github.com/pandas-dev/pandas/issues/52500), [GH 52538](https://github.com/pandas-dev/pandas/issues/52538)) +* Deprecated [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") and [`PeriodDtype`](../reference/api/pandas.PeriodDtype.html#pandas.PeriodDtype "pandas.PeriodDtype") with `BDay` freq, use a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with `BDay` freq instead ([GH 53446](https://github.com/pandas-dev/pandas/issues/53446)) +* Deprecated `value_counts()`, use `pd.Series(obj).value_counts()` instead ([GH 47862](https://github.com/pandas-dev/pandas/issues/47862)) +* Deprecated [`Series.first()`](../reference/api/pandas.Series.first.html#pandas.Series.first "pandas.Series.first") and [`DataFrame.first()`](../reference/api/pandas.DataFrame.first.html#pandas.DataFrame.first "pandas.DataFrame.first"); create a mask and filter using `.loc` instead ([GH 45908](https://github.com/pandas-dev/pandas/issues/45908)) +* Deprecated [`Series.interpolate()`](../reference/api/pandas.Series.interpolate.html#pandas.Series.interpolate "pandas.Series.interpolate") and [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") for object-dtype ([GH 53631](https://github.com/pandas-dev/pandas/issues/53631)) +* Deprecated [`Series.last()`](../reference/api/pandas.Series.last.html#pandas.Series.last "pandas.Series.last") and [`DataFrame.last()`](../reference/api/pandas.DataFrame.last.html#pandas.DataFrame.last "pandas.DataFrame.last"); create a mask and filter using `.loc` instead ([GH 53692](https://github.com/pandas-dev/pandas/issues/53692)) +* Deprecated allowing arbitrary `fill_value` in [`SparseDtype`](../reference/api/pandas.SparseDtype.html#pandas.SparseDtype "pandas.SparseDtype"), in a future version the `fill_value` will need to be compatible with the `dtype.subtype`, either a scalar that can be held by that subtype or `NaN` for integer or bool subtypes ([GH 23124](https://github.com/pandas-dev/pandas/issues/23124)) +* Deprecated allowing bool dtype in [`DataFrameGroupBy.quantile()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.quantile.html#pandas.core.groupby.DataFrameGroupBy.quantile "pandas.core.groupby.DataFrameGroupBy.quantile") and [`SeriesGroupBy.quantile()`](../reference/api/pandas.core.groupby.SeriesGroupBy.quantile.html#pandas.core.groupby.SeriesGroupBy.quantile "pandas.core.groupby.SeriesGroupBy.quantile"), consistent with the [`Series.quantile()`](../reference/api/pandas.Series.quantile.html#pandas.Series.quantile "pandas.Series.quantile") and [`DataFrame.quantile()`](../reference/api/pandas.DataFrame.quantile.html#pandas.DataFrame.quantile "pandas.DataFrame.quantile") behavior ([GH 51424](https://github.com/pandas-dev/pandas/issues/51424)) +* Deprecated behavior of [`testing.assert_series_equal()`](../reference/api/pandas.testing.assert_series_equal.html#pandas.testing.assert_series_equal "pandas.testing.assert_series_equal") and [`testing.assert_frame_equal()`](../reference/api/pandas.testing.assert_frame_equal.html#pandas.testing.assert_frame_equal "pandas.testing.assert_frame_equal") considering NA-like values (e.g. `NaN` vs `None` as equivalent) ([GH 52081](https://github.com/pandas-dev/pandas/issues/52081)) +* Deprecated bytes input to [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel"). To read a file path, use a string or path-like object ([GH 53767](https://github.com/pandas-dev/pandas/issues/53767)) +* Deprecated constructing [`SparseArray`](../reference/api/pandas.arrays.SparseArray.html#pandas.arrays.SparseArray "pandas.arrays.SparseArray") from scalar data, pass a sequence instead ([GH 53039](https://github.com/pandas-dev/pandas/issues/53039)) +* Deprecated falling back to filling when `value` is not specified in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") and [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") with non-dict-like `to_replace` ([GH 33302](https://github.com/pandas-dev/pandas/issues/33302)) +* Deprecated literal json input to [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json"). Wrap literal json string input in `io.StringIO` instead ([GH 53409](https://github.com/pandas-dev/pandas/issues/53409)) +* Deprecated literal string input to [`read_xml()`](../reference/api/pandas.read_xml.html#pandas.read_xml "pandas.read_xml"). Wrap literal string/bytes input in `io.StringIO` / `io.BytesIO` instead ([GH 53767](https://github.com/pandas-dev/pandas/issues/53767)) +* Deprecated literal string/bytes input to [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html"). Wrap literal string/bytes input in `io.StringIO` / `io.BytesIO` instead ([GH 53767](https://github.com/pandas-dev/pandas/issues/53767)) +* Deprecated option `mode.use_inf_as_na`, convert inf entries to `NaN` before instead ([GH 51684](https://github.com/pandas-dev/pandas/issues/51684)) +* Deprecated parameter `obj` in [`DataFrameGroupBy.get_group()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.get_group.html#pandas.core.groupby.DataFrameGroupBy.get_group "pandas.core.groupby.DataFrameGroupBy.get_group") ([GH 53545](https://github.com/pandas-dev/pandas/issues/53545)) +* Deprecated positional indexing on [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `Series.__getitem__()` and `Series.__setitem__()`, in a future version `ser[item]` will *always* interpret `item` as a label, not a position ([GH 50617](https://github.com/pandas-dev/pandas/issues/50617)) +* Deprecated replacing builtin and NumPy functions in `.agg`, `.apply`, and `.transform`; use the corresponding string alias (e.g. `"sum"` for `sum` or `np.sum`) instead ([GH 53425](https://github.com/pandas-dev/pandas/issues/53425)) +* Deprecated strings `T`, `t`, `L` and `l` denoting units in [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta") ([GH 52536](https://github.com/pandas-dev/pandas/issues/52536)) +* Deprecated the “method” and “limit” keywords in `.ExtensionArray.fillna`, implement `_pad_or_backfill` instead ([GH 53621](https://github.com/pandas-dev/pandas/issues/53621)) +* Deprecated the `method` and `limit` keywords in [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") and [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") ([GH 33302](https://github.com/pandas-dev/pandas/issues/33302)) +* Deprecated the `method` and `limit` keywords on [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna"), [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna"), [`SeriesGroupBy.fillna()`](../reference/api/pandas.core.groupby.SeriesGroupBy.fillna.html#pandas.core.groupby.SeriesGroupBy.fillna "pandas.core.groupby.SeriesGroupBy.fillna"), [`DataFrameGroupBy.fillna()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.fillna.html#pandas.core.groupby.DataFrameGroupBy.fillna "pandas.core.groupby.DataFrameGroupBy.fillna"), and [`Resampler.fillna()`](../reference/api/pandas.core.resample.Resampler.fillna.html#pandas.core.resample.Resampler.fillna "pandas.core.resample.Resampler.fillna"), use `obj.bfill()` or `obj.ffill()` instead ([GH 53394](https://github.com/pandas-dev/pandas/issues/53394)) +* Deprecated the behavior of `Series.__getitem__()`, `Series.__setitem__()`, `DataFrame.__getitem__()`, `DataFrame.__setitem__()` with an integer slice on objects with a floating-dtype index, in a future version this will be treated as *positional* indexing ([GH 49612](https://github.com/pandas-dev/pandas/issues/49612)) +* Deprecated the use of non-supported datetime64 and timedelta64 resolutions with [`pandas.array()`](../reference/api/pandas.array.html#pandas.array "pandas.array"). Supported resolutions are: “s”, “ms”, “us”, “ns” resolutions ([GH 53058](https://github.com/pandas-dev/pandas/issues/53058)) +* Deprecated values `"pad"`, `"ffill"`, `"bfill"`, `"backfill"` for [`Series.interpolate()`](../reference/api/pandas.Series.interpolate.html#pandas.Series.interpolate "pandas.Series.interpolate") and [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate"), use `obj.ffill()` or `obj.bfill()` instead ([GH 53581](https://github.com/pandas-dev/pandas/issues/53581)) +* Deprecated the behavior of [`Index.argmax()`](../reference/api/pandas.Index.argmax.html#pandas.Index.argmax "pandas.Index.argmax"), [`Index.argmin()`](../reference/api/pandas.Index.argmin.html#pandas.Index.argmin "pandas.Index.argmin"), [`Series.argmax()`](../reference/api/pandas.Series.argmax.html#pandas.Series.argmax "pandas.Series.argmax"), [`Series.argmin()`](../reference/api/pandas.Series.argmin.html#pandas.Series.argmin "pandas.Series.argmin") with either all-NAs and `skipna=True` or any-NAs and `skipna=False` returning -1; in a future version this will raise `ValueError` ([GH 33941](https://github.com/pandas-dev/pandas/issues/33941), [GH 33942](https://github.com/pandas-dev/pandas/issues/33942)) +* Deprecated allowing non-keyword arguments in [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") except `name` and `con` ([GH 54229](https://github.com/pandas-dev/pandas/issues/54229)) +* Deprecated silently ignoring `fill_value` when passing both `freq` and `fill_value` to [`DataFrame.shift()`](../reference/api/pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift"), [`Series.shift()`](../reference/api/pandas.Series.shift.html#pandas.Series.shift "pandas.Series.shift") and [`DataFrameGroupBy.shift()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.shift.html#pandas.core.groupby.DataFrameGroupBy.shift "pandas.core.groupby.DataFrameGroupBy.shift"); in a future version this will raise `ValueError` ([GH 53832](https://github.com/pandas-dev/pandas/issues/53832)) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Performance improvement in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") with homogeneous `np.float64` or `np.float32` dtypes ([GH 52685](https://github.com/pandas-dev/pandas/issues/52685)) +* Performance improvement in [`factorize()`](../reference/api/pandas.factorize.html#pandas.factorize "pandas.factorize") for object columns not containing strings ([GH 51921](https://github.com/pandas-dev/pandas/issues/51921)) +* Performance improvement in [`read_orc()`](../reference/api/pandas.read_orc.html#pandas.read_orc "pandas.read_orc") when reading a remote URI file path ([GH 51609](https://github.com/pandas-dev/pandas/issues/51609)) +* Performance improvement in [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") and [`DataFrame.to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") when reading a remote file with `engine="pyarrow"` ([GH 51609](https://github.com/pandas-dev/pandas/issues/51609)) +* Performance improvement in [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") on string columns when using `use_nullable_dtypes=True` ([GH 47345](https://github.com/pandas-dev/pandas/issues/47345)) +* Performance improvement in [`DataFrame.clip()`](../reference/api/pandas.DataFrame.clip.html#pandas.DataFrame.clip "pandas.DataFrame.clip") and [`Series.clip()`](../reference/api/pandas.Series.clip.html#pandas.Series.clip "pandas.Series.clip") ([GH 51472](https://github.com/pandas-dev/pandas/issues/51472)) +* Performance improvement in [`DataFrame.filter()`](../reference/api/pandas.DataFrame.filter.html#pandas.DataFrame.filter "pandas.DataFrame.filter") when `items` is given ([GH 52941](https://github.com/pandas-dev/pandas/issues/52941)) +* Performance improvement in [`DataFrame.first_valid_index()`](../reference/api/pandas.DataFrame.first_valid_index.html#pandas.DataFrame.first_valid_index "pandas.DataFrame.first_valid_index") and [`DataFrame.last_valid_index()`](../reference/api/pandas.DataFrame.last_valid_index.html#pandas.DataFrame.last_valid_index "pandas.DataFrame.last_valid_index") for extension array dtypes ([GH 51549](https://github.com/pandas-dev/pandas/issues/51549)) +* Performance improvement in [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where") when `cond` is backed by an extension dtype ([GH 51574](https://github.com/pandas-dev/pandas/issues/51574)) +* Performance improvement in [`MultiIndex.set_levels()`](../reference/api/pandas.MultiIndex.set_levels.html#pandas.MultiIndex.set_levels "pandas.MultiIndex.set_levels") and [`MultiIndex.set_codes()`](../reference/api/pandas.MultiIndex.set_codes.html#pandas.MultiIndex.set_codes "pandas.MultiIndex.set_codes") when `verify_integrity=True` ([GH 51873](https://github.com/pandas-dev/pandas/issues/51873)) +* Performance improvement in [`MultiIndex.sortlevel()`](../reference/api/pandas.MultiIndex.sortlevel.html#pandas.MultiIndex.sortlevel "pandas.MultiIndex.sortlevel") when `ascending` is a list ([GH 51612](https://github.com/pandas-dev/pandas/issues/51612)) +* Performance improvement in [`Series.combine_first()`](../reference/api/pandas.Series.combine_first.html#pandas.Series.combine_first "pandas.Series.combine_first") ([GH 51777](https://github.com/pandas-dev/pandas/issues/51777)) +* Performance improvement in `fillna()` when array does not contain nulls ([GH 51635](https://github.com/pandas-dev/pandas/issues/51635)) +* Performance improvement in `isna()` when array has zero nulls or is all nulls ([GH 51630](https://github.com/pandas-dev/pandas/issues/51630)) +* Performance improvement when parsing strings to `boolean[pyarrow]` dtype ([GH 51730](https://github.com/pandas-dev/pandas/issues/51730)) +* Performance improvement when searching an [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") sliced from other indexes ([GH 51738](https://github.com/pandas-dev/pandas/issues/51738)) +* Performance improvement in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") ([GH 52291](https://github.com/pandas-dev/pandas/issues/52291), [GH 52290](https://github.com/pandas-dev/pandas/issues/52290)) +* [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period")’s default formatter (`period_format`) is now significantly (~twice) faster. This improves performance of `str(Period)`, `repr(Period)`, and `Period.strftime(fmt=None)()`, as well as `.PeriodArray.strftime(fmt=None)`, `.PeriodIndex.strftime(fmt=None)` and `.PeriodIndex.format(fmt=None)`. `to_csv` operations involving [`PeriodArray`](../reference/api/pandas.arrays.PeriodArray.html#pandas.arrays.PeriodArray "pandas.arrays.PeriodArray") or [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") with default `date_format` are also significantly accelerated ([GH 51459](https://github.com/pandas-dev/pandas/issues/51459)) +* Performance improvement accessing `arrays.IntegerArrays.dtype` & `arrays.FloatingArray.dtype` ([GH 52998](https://github.com/pandas-dev/pandas/issues/52998)) +* Performance improvement for `DataFrameGroupBy`/`SeriesGroupBy` aggregations (e.g. [`DataFrameGroupBy.sum()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.sum.html#pandas.core.groupby.DataFrameGroupBy.sum "pandas.core.groupby.DataFrameGroupBy.sum")) with `engine="numba"` ([GH 53731](https://github.com/pandas-dev/pandas/issues/53731)) +* Performance improvement in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") reductions with `axis=1` and extension dtypes ([GH 54341](https://github.com/pandas-dev/pandas/issues/54341)) +* Performance improvement in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") reductions with `axis=None` and extension dtypes ([GH 54308](https://github.com/pandas-dev/pandas/issues/54308)) +* Performance improvement in [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") and multi-column operations (e.g. [`DataFrame.sort_values()`](../reference/api/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values"), [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby"), [`Series.unstack()`](../reference/api/pandas.Series.unstack.html#pandas.Series.unstack "pandas.Series.unstack")) when index/column values are already sorted ([GH 53806](https://github.com/pandas-dev/pandas/issues/53806)) +* Performance improvement in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") reductions ([GH 52341](https://github.com/pandas-dev/pandas/issues/52341)) +* Performance improvement in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") when `axis=1` and objects have different indexes ([GH 52541](https://github.com/pandas-dev/pandas/issues/52541)) +* Performance improvement in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") when the concatenation axis is a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 53574](https://github.com/pandas-dev/pandas/issues/53574)) +* Performance improvement in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") for PyArrow backed strings ([GH 54443](https://github.com/pandas-dev/pandas/issues/54443)) +* Performance improvement in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") with `engine="c"` ([GH 52632](https://github.com/pandas-dev/pandas/issues/52632)) +* Performance improvement in `ArrowExtensionArray.to_numpy()` ([GH 52525](https://github.com/pandas-dev/pandas/issues/52525)) +* Performance improvement in [`DataFrameGroupBy.groups()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.groups.html#pandas.core.groupby.DataFrameGroupBy.groups "pandas.core.groupby.DataFrameGroupBy.groups") ([GH 53088](https://github.com/pandas-dev/pandas/issues/53088)) +* Performance improvement in [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") when `dtype` is an extension dtype ([GH 54299](https://github.com/pandas-dev/pandas/issues/54299)) +* Performance improvement in [`DataFrame.iloc()`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") when input is an single integer and dataframe is backed by extension dtypes ([GH 54508](https://github.com/pandas-dev/pandas/issues/54508)) +* Performance improvement in [`DataFrame.isin()`](../reference/api/pandas.DataFrame.isin.html#pandas.DataFrame.isin "pandas.DataFrame.isin") for extension dtypes ([GH 53514](https://github.com/pandas-dev/pandas/issues/53514)) +* Performance improvement in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") when selecting rows and columns ([GH 53014](https://github.com/pandas-dev/pandas/issues/53014)) +* Performance improvement in [`DataFrame.transpose()`](../reference/api/pandas.DataFrame.transpose.html#pandas.DataFrame.transpose "pandas.DataFrame.transpose") when transposing a DataFrame with a single PyArrow dtype ([GH 54224](https://github.com/pandas-dev/pandas/issues/54224)) +* Performance improvement in [`DataFrame.transpose()`](../reference/api/pandas.DataFrame.transpose.html#pandas.DataFrame.transpose "pandas.DataFrame.transpose") when transposing a DataFrame with a single masked dtype, e.g. `Int64` ([GH 52836](https://github.com/pandas-dev/pandas/issues/52836)) +* Performance improvement in [`Series.add()`](../reference/api/pandas.Series.add.html#pandas.Series.add "pandas.Series.add") for PyArrow string and binary dtypes ([GH 53150](https://github.com/pandas-dev/pandas/issues/53150)) +* Performance improvement in [`Series.corr()`](../reference/api/pandas.Series.corr.html#pandas.Series.corr "pandas.Series.corr") and [`Series.cov()`](../reference/api/pandas.Series.cov.html#pandas.Series.cov "pandas.Series.cov") for extension dtypes ([GH 52502](https://github.com/pandas-dev/pandas/issues/52502)) +* Performance improvement in [`Series.drop_duplicates()`](../reference/api/pandas.Series.drop_duplicates.html#pandas.Series.drop_duplicates "pandas.Series.drop_duplicates") for `ArrowDtype` ([GH 54667](https://github.com/pandas-dev/pandas/issues/54667)). +* Performance improvement in [`Series.ffill()`](../reference/api/pandas.Series.ffill.html#pandas.Series.ffill "pandas.Series.ffill"), [`Series.bfill()`](../reference/api/pandas.Series.bfill.html#pandas.Series.bfill "pandas.Series.bfill"), [`DataFrame.ffill()`](../reference/api/pandas.DataFrame.ffill.html#pandas.DataFrame.ffill "pandas.DataFrame.ffill"), [`DataFrame.bfill()`](../reference/api/pandas.DataFrame.bfill.html#pandas.DataFrame.bfill "pandas.DataFrame.bfill") with PyArrow dtypes ([GH 53950](https://github.com/pandas-dev/pandas/issues/53950)) +* Performance improvement in [`Series.str.get_dummies()`](../reference/api/pandas.Series.str.get_dummies.html#pandas.Series.str.get_dummies "pandas.Series.str.get_dummies") for PyArrow-backed strings ([GH 53655](https://github.com/pandas-dev/pandas/issues/53655)) +* Performance improvement in [`Series.str.get()`](../reference/api/pandas.Series.str.get.html#pandas.Series.str.get "pandas.Series.str.get") for PyArrow-backed strings ([GH 53152](https://github.com/pandas-dev/pandas/issues/53152)) +* Performance improvement in [`Series.str.split()`](../reference/api/pandas.Series.str.split.html#pandas.Series.str.split "pandas.Series.str.split") with `expand=True` for PyArrow-backed strings ([GH 53585](https://github.com/pandas-dev/pandas/issues/53585)) +* Performance improvement in [`Series.to_numpy()`](../reference/api/pandas.Series.to_numpy.html#pandas.Series.to_numpy "pandas.Series.to_numpy") when dtype is a NumPy float dtype and `na_value` is `np.nan` ([GH 52430](https://github.com/pandas-dev/pandas/issues/52430)) +* Performance improvement in `astype()` when converting from a PyArrow timestamp or duration dtype to NumPy ([GH 53326](https://github.com/pandas-dev/pandas/issues/53326)) +* Performance improvement in various [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") set and indexing operations ([GH 53955](https://github.com/pandas-dev/pandas/issues/53955)) +* Performance improvement when doing various reshaping operations on [`arrays.IntegerArray`](../reference/api/pandas.arrays.IntegerArray.html#pandas.arrays.IntegerArray "pandas.arrays.IntegerArray") & [`arrays.FloatingArray`](../reference/api/pandas.arrays.FloatingArray.html#pandas.arrays.FloatingArray "pandas.arrays.FloatingArray") by avoiding doing unnecessary validation ([GH 53013](https://github.com/pandas-dev/pandas/issues/53013)) +* Performance improvement when indexing with PyArrow timestamp and duration dtypes ([GH 53368](https://github.com/pandas-dev/pandas/issues/53368)) +* Performance improvement when passing an array to `RangeIndex.take()`, [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc"), or [`DataFrame.iloc()`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") and the DataFrame is using a RangeIndex ([GH 53387](https://github.com/pandas-dev/pandas/issues/53387)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +### Categorical[#](#categorical "Link to this heading") + +* Bug in [`CategoricalIndex.remove_categories()`](../reference/api/pandas.CategoricalIndex.remove_categories.html#pandas.CategoricalIndex.remove_categories "pandas.CategoricalIndex.remove_categories") where ordered categories would not be maintained ([GH 53935](https://github.com/pandas-dev/pandas/issues/53935)). +* Bug in [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") with `dtype="category"` for nullable arrays with read-only null value masks ([GH 53658](https://github.com/pandas-dev/pandas/issues/53658)) +* Bug in [`Series.map()`](../reference/api/pandas.Series.map.html#pandas.Series.map "pandas.Series.map") , where the value of the `na_action` parameter was not used if the series held a [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") ([GH 22527](https://github.com/pandas-dev/pandas/issues/22527)). + +### Datetimelike[#](#datetimelike "Link to this heading") + +* `DatetimeIndex.map()` with `na_action="ignore"` now works as expected ([GH 51644](https://github.com/pandas-dev/pandas/issues/51644)) +* `DatetimeIndex.slice_indexer()` now raises `KeyError` for non-monotonic indexes if either of the slice bounds is not in the index; this behaviour was previously deprecated but inconsistently handled ([GH 53983](https://github.com/pandas-dev/pandas/issues/53983)) +* Bug in `DateOffset` which had inconsistent behavior when multiplying a `DateOffset` object by a constant ([GH 47953](https://github.com/pandas-dev/pandas/issues/47953)) +* Bug in [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range") when `freq` was a `DateOffset` with `nanoseconds` ([GH 46877](https://github.com/pandas-dev/pandas/issues/46877)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") converting [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") containing [`arrays.ArrowExtensionArray`](../reference/api/pandas.arrays.ArrowExtensionArray.html#pandas.arrays.ArrowExtensionArray "pandas.arrays.ArrowExtensionArray") of PyArrow timestamps to numpy datetimes ([GH 52545](https://github.com/pandas-dev/pandas/issues/52545)) +* Bug in `DatetimeArray.map()` and `DatetimeIndex.map()`, where the supplied callable operated array-wise instead of element-wise ([GH 51977](https://github.com/pandas-dev/pandas/issues/51977)) +* Bug in [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") raising `ValueError` for PyArrow-backed date like dtypes ([GH 53854](https://github.com/pandas-dev/pandas/issues/53854)) +* Bug in [`Timestamp.date()`](../reference/api/pandas.Timestamp.date.html#pandas.Timestamp.date "pandas.Timestamp.date"), [`Timestamp.isocalendar()`](../reference/api/pandas.Timestamp.isocalendar.html#pandas.Timestamp.isocalendar "pandas.Timestamp.isocalendar"), [`Timestamp.timetuple()`](../reference/api/pandas.Timestamp.timetuple.html#pandas.Timestamp.timetuple "pandas.Timestamp.timetuple"), and [`Timestamp.toordinal()`](../reference/api/pandas.Timestamp.toordinal.html#pandas.Timestamp.toordinal "pandas.Timestamp.toordinal") were returning incorrect results for inputs outside those supported by the Python standard library’s datetime module ([GH 53668](https://github.com/pandas-dev/pandas/issues/53668)) +* Bug in [`Timestamp.round()`](../reference/api/pandas.Timestamp.round.html#pandas.Timestamp.round "pandas.Timestamp.round") with values close to the implementation bounds returning incorrect results instead of raising `OutOfBoundsDatetime` ([GH 51494](https://github.com/pandas-dev/pandas/issues/51494)) +* Bug in constructing a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") from a datetime or timedelta scalar always inferring nanosecond resolution instead of inferring from the input ([GH 52212](https://github.com/pandas-dev/pandas/issues/52212)) +* Bug in constructing a [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") from a string representing a time without a date inferring an incorrect unit ([GH 54097](https://github.com/pandas-dev/pandas/issues/54097)) +* Bug in constructing a [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") with `ts_input=pd.NA` raising `TypeError` ([GH 45481](https://github.com/pandas-dev/pandas/issues/45481)) +* Bug in parsing datetime strings with weekday but no day e.g. “2023 Sept Thu” incorrectly raising `AttributeError` instead of `ValueError` ([GH 52659](https://github.com/pandas-dev/pandas/issues/52659)) +* Bug in the repr for [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") when dtype is a timezone aware datetime with non-nanosecond resolution raising `OutOfBoundsDatetime` ([GH 54623](https://github.com/pandas-dev/pandas/issues/54623)) + +### Timedelta[#](#timedelta "Link to this heading") + +* Bug in [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") division or multiplication leading to `.freq` of “0 Days” instead of `None` ([GH 51575](https://github.com/pandas-dev/pandas/issues/51575)) +* Bug in [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") with NumPy `timedelta64` objects not properly raising `ValueError` ([GH 52806](https://github.com/pandas-dev/pandas/issues/52806)) +* Bug in [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta") converting [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") containing [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") of `pyarrow.duration` to NumPy `timedelta64` ([GH 54298](https://github.com/pandas-dev/pandas/issues/54298)) +* Bug in `Timedelta.__hash__()`, raising an `OutOfBoundsTimedelta` on certain large values of second resolution ([GH 54037](https://github.com/pandas-dev/pandas/issues/54037)) +* Bug in [`Timedelta.round()`](../reference/api/pandas.Timedelta.round.html#pandas.Timedelta.round "pandas.Timedelta.round") with values close to the implementation bounds returning incorrect results instead of raising `OutOfBoundsTimedelta` ([GH 51494](https://github.com/pandas-dev/pandas/issues/51494)) +* Bug in `TimedeltaIndex.map()` with `na_action="ignore"` ([GH 51644](https://github.com/pandas-dev/pandas/issues/51644)) +* Bug in `arrays.TimedeltaArray.map()` and `TimedeltaIndex.map()`, where the supplied callable operated array-wise instead of element-wise ([GH 51977](https://github.com/pandas-dev/pandas/issues/51977)) + +### Timezones[#](#timezones "Link to this heading") + +* Bug in [`infer_freq()`](../reference/api/pandas.infer_freq.html#pandas.infer_freq "pandas.infer_freq") that raises `TypeError` for `Series` of timezone-aware timestamps ([GH 52456](https://github.com/pandas-dev/pandas/issues/52456)) +* Bug in `DatetimeTZDtype.base()` that always returns a NumPy dtype with nanosecond resolution ([GH 52705](https://github.com/pandas-dev/pandas/issues/52705)) + +### Numeric[#](#numeric "Link to this heading") + +* Bug in [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") setting `step` incorrectly when being the subtrahend with minuend a numeric value ([GH 53255](https://github.com/pandas-dev/pandas/issues/53255)) +* Bug in [`Series.corr()`](../reference/api/pandas.Series.corr.html#pandas.Series.corr "pandas.Series.corr") and [`Series.cov()`](../reference/api/pandas.Series.cov.html#pandas.Series.cov "pandas.Series.cov") raising `AttributeError` for masked dtypes ([GH 51422](https://github.com/pandas-dev/pandas/issues/51422)) +* Bug when calling [`Series.kurt()`](../reference/api/pandas.Series.kurt.html#pandas.Series.kurt "pandas.Series.kurt") and [`Series.skew()`](../reference/api/pandas.Series.skew.html#pandas.Series.skew "pandas.Series.skew") on NumPy data of all zero returning a Python type instead of a NumPy type ([GH 53482](https://github.com/pandas-dev/pandas/issues/53482)) +* Bug in [`Series.mean()`](../reference/api/pandas.Series.mean.html#pandas.Series.mean "pandas.Series.mean"), [`DataFrame.mean()`](../reference/api/pandas.DataFrame.mean.html#pandas.DataFrame.mean "pandas.DataFrame.mean") with object-dtype values containing strings that can be converted to numbers (e.g. “2”) returning incorrect numeric results; these now raise `TypeError` ([GH 36703](https://github.com/pandas-dev/pandas/issues/36703), [GH 44008](https://github.com/pandas-dev/pandas/issues/44008)) +* Bug in [`DataFrame.corrwith()`](../reference/api/pandas.DataFrame.corrwith.html#pandas.DataFrame.corrwith "pandas.DataFrame.corrwith") raising `NotImplementedError` for PyArrow-backed dtypes ([GH 52314](https://github.com/pandas-dev/pandas/issues/52314)) +* Bug in [`DataFrame.size()`](../reference/api/pandas.DataFrame.size.html#pandas.DataFrame.size "pandas.DataFrame.size") and [`Series.size()`](../reference/api/pandas.Series.size.html#pandas.Series.size "pandas.Series.size") returning 64-bit integer instead of a Python int ([GH 52897](https://github.com/pandas-dev/pandas/issues/52897)) +* Bug in `DateFrame.dot()` returning `object` dtype for [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") data ([GH 53979](https://github.com/pandas-dev/pandas/issues/53979)) +* Bug in [`Series.any()`](../reference/api/pandas.Series.any.html#pandas.Series.any "pandas.Series.any"), [`Series.all()`](../reference/api/pandas.Series.all.html#pandas.Series.all "pandas.Series.all"), [`DataFrame.any()`](../reference/api/pandas.DataFrame.any.html#pandas.DataFrame.any "pandas.DataFrame.any"), and [`DataFrame.all()`](../reference/api/pandas.DataFrame.all.html#pandas.DataFrame.all "pandas.DataFrame.all") had the default value of `bool_only` set to `None` instead of `False`; this change should have no impact on users ([GH 53258](https://github.com/pandas-dev/pandas/issues/53258)) +* Bug in [`Series.corr()`](../reference/api/pandas.Series.corr.html#pandas.Series.corr "pandas.Series.corr") and [`Series.cov()`](../reference/api/pandas.Series.cov.html#pandas.Series.cov "pandas.Series.cov") raising `AttributeError` for masked dtypes ([GH 51422](https://github.com/pandas-dev/pandas/issues/51422)) +* Bug in [`Series.median()`](../reference/api/pandas.Series.median.html#pandas.Series.median "pandas.Series.median") and [`DataFrame.median()`](../reference/api/pandas.DataFrame.median.html#pandas.DataFrame.median "pandas.DataFrame.median") with object-dtype values containing strings that can be converted to numbers (e.g. “2”) returning incorrect numeric results; these now raise `TypeError` ([GH 34671](https://github.com/pandas-dev/pandas/issues/34671)) +* Bug in [`Series.sum()`](../reference/api/pandas.Series.sum.html#pandas.Series.sum "pandas.Series.sum") converting dtype `uint64` to `int64` ([GH 53401](https://github.com/pandas-dev/pandas/issues/53401)) + +### Conversion[#](#conversion "Link to this heading") + +* Bug in `DataFrame.style.to_latex()` and `DataFrame.style.to_html()` if the DataFrame contains integers with more digits than can be represented by floating point double precision ([GH 52272](https://github.com/pandas-dev/pandas/issues/52272)) +* Bug in [`array()`](../reference/api/pandas.array.html#pandas.array "pandas.array") when given a `datetime64` or `timedelta64` dtype with unit of “s”, “us”, or “ms” returning [`NumpyExtensionArray`](../reference/api/pandas.arrays.NumpyExtensionArray.html#pandas.arrays.NumpyExtensionArray "pandas.arrays.NumpyExtensionArray") instead of [`DatetimeArray`](../reference/api/pandas.arrays.DatetimeArray.html#pandas.arrays.DatetimeArray "pandas.arrays.DatetimeArray") or [`TimedeltaArray`](../reference/api/pandas.arrays.TimedeltaArray.html#pandas.arrays.TimedeltaArray "pandas.arrays.TimedeltaArray") ([GH 52859](https://github.com/pandas-dev/pandas/issues/52859)) +* Bug in [`array()`](../reference/api/pandas.array.html#pandas.array "pandas.array") when given an empty list and no dtype returning [`NumpyExtensionArray`](../reference/api/pandas.arrays.NumpyExtensionArray.html#pandas.arrays.NumpyExtensionArray "pandas.arrays.NumpyExtensionArray") instead of [`FloatingArray`](../reference/api/pandas.arrays.FloatingArray.html#pandas.arrays.FloatingArray "pandas.arrays.FloatingArray") ([GH 54371](https://github.com/pandas-dev/pandas/issues/54371)) +* Bug in `ArrowDtype.numpy_dtype()` returning nanosecond units for non-nanosecond `pyarrow.timestamp` and `pyarrow.duration` types ([GH 51800](https://github.com/pandas-dev/pandas/issues/51800)) +* Bug in `DataFrame.__repr__()` incorrectly raising a `TypeError` when the dtype of a column is `np.record` ([GH 48526](https://github.com/pandas-dev/pandas/issues/48526)) +* Bug in [`DataFrame.info()`](../reference/api/pandas.DataFrame.info.html#pandas.DataFrame.info "pandas.DataFrame.info") raising `ValueError` when `use_numba` is set ([GH 51922](https://github.com/pandas-dev/pandas/issues/51922)) +* Bug in [`DataFrame.insert()`](../reference/api/pandas.DataFrame.insert.html#pandas.DataFrame.insert "pandas.DataFrame.insert") raising `TypeError` if `loc` is `np.int64` ([GH 53193](https://github.com/pandas-dev/pandas/issues/53193)) +* Bug in [`HDFStore.select()`](../reference/api/pandas.HDFStore.select.html#pandas.HDFStore.select "pandas.HDFStore.select") loses precision of large int when stored and retrieved ([GH 54186](https://github.com/pandas-dev/pandas/issues/54186)) +* Bug in [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") not supporting `object_` ([GH 54251](https://github.com/pandas-dev/pandas/issues/54251)) + +### Strings[#](#strings "Link to this heading") + +* Bug in [`Series.str()`](../reference/api/pandas.Series.str.html#pandas.Series.str "pandas.Series.str") that did not raise a `TypeError` when iterated ([GH 54173](https://github.com/pandas-dev/pandas/issues/54173)) +* Bug in `repr` for `` DataFrame` `` with string-dtype columns ([GH 54797](https://github.com/pandas-dev/pandas/issues/54797)) + +### Interval[#](#interval "Link to this heading") + +* [`IntervalIndex.get_indexer()`](../reference/api/pandas.IntervalIndex.get_indexer.html#pandas.IntervalIndex.get_indexer "pandas.IntervalIndex.get_indexer") and `IntervalIndex.get_indexer_nonunique()` raising if `target` is read-only array ([GH 53703](https://github.com/pandas-dev/pandas/issues/53703)) +* Bug in [`IntervalDtype`](../reference/api/pandas.IntervalDtype.html#pandas.IntervalDtype "pandas.IntervalDtype") where the object could be kept alive when deleted ([GH 54184](https://github.com/pandas-dev/pandas/issues/54184)) +* Bug in [`interval_range()`](../reference/api/pandas.interval_range.html#pandas.interval_range "pandas.interval_range") where a float `step` would produce incorrect intervals from floating point artifacts ([GH 54477](https://github.com/pandas-dev/pandas/issues/54477)) + +### Indexing[#](#indexing "Link to this heading") + +* Bug in `DataFrame.__setitem__()` losing dtype when setting a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") into duplicated columns ([GH 53143](https://github.com/pandas-dev/pandas/issues/53143)) +* Bug in `DataFrame.__setitem__()` with a boolean mask and `DataFrame.putmask()` with mixed non-numeric dtypes and a value other than `NaN` incorrectly raising `TypeError` ([GH 53291](https://github.com/pandas-dev/pandas/issues/53291)) +* Bug in [`DataFrame.iloc()`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") when using `nan` as the only element ([GH 52234](https://github.com/pandas-dev/pandas/issues/52234)) +* Bug in [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") casting [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") to `np.dnarray` when assigning [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") at predefined index of `object` dtype [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") ([GH 48933](https://github.com/pandas-dev/pandas/issues/48933)) + +### Missing[#](#missing "Link to this heading") + +* Bug in [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") failing to fill across data when `method` is `"pad"`, `"ffill"`, `"bfill"`, or `"backfill"` ([GH 53898](https://github.com/pandas-dev/pandas/issues/53898)) +* Bug in [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") ignoring `inplace` when [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") is empty ([GH 53199](https://github.com/pandas-dev/pandas/issues/53199)) +* Bug in [`Series.idxmin()`](../reference/api/pandas.Series.idxmin.html#pandas.Series.idxmin "pandas.Series.idxmin"), [`Series.idxmax()`](../reference/api/pandas.Series.idxmax.html#pandas.Series.idxmax "pandas.Series.idxmax"), [`DataFrame.idxmin()`](../reference/api/pandas.DataFrame.idxmin.html#pandas.DataFrame.idxmin "pandas.DataFrame.idxmin"), [`DataFrame.idxmax()`](../reference/api/pandas.DataFrame.idxmax.html#pandas.DataFrame.idxmax "pandas.DataFrame.idxmax") with a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") index containing `NaT` incorrectly returning `NaN` instead of `NaT` ([GH 43587](https://github.com/pandas-dev/pandas/issues/43587)) +* Bug in [`Series.interpolate()`](../reference/api/pandas.Series.interpolate.html#pandas.Series.interpolate "pandas.Series.interpolate") and [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") failing to raise on invalid `downcast` keyword, which can be only `None` or `"infer"` ([GH 53103](https://github.com/pandas-dev/pandas/issues/53103)) +* Bug in [`Series.interpolate()`](../reference/api/pandas.Series.interpolate.html#pandas.Series.interpolate "pandas.Series.interpolate") and [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") with complex dtype incorrectly failing to fill `NaN` entries ([GH 53635](https://github.com/pandas-dev/pandas/issues/53635)) + +### MultiIndex[#](#multiindex "Link to this heading") + +* Bug in [`MultiIndex.set_levels()`](../reference/api/pandas.MultiIndex.set_levels.html#pandas.MultiIndex.set_levels "pandas.MultiIndex.set_levels") not preserving dtypes for [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") ([GH 52125](https://github.com/pandas-dev/pandas/issues/52125)) +* Bug in displaying a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") with a long element ([GH 52960](https://github.com/pandas-dev/pandas/issues/52960)) + +### I/O[#](#i-o "Link to this heading") + +* [`DataFrame.to_orc()`](../reference/api/pandas.DataFrame.to_orc.html#pandas.DataFrame.to_orc "pandas.DataFrame.to_orc") now raising `ValueError` when non-default [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") is given ([GH 51828](https://github.com/pandas-dev/pandas/issues/51828)) +* [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") now raising `ValueError` when the name param is left empty while using SQLAlchemy to connect ([GH 52675](https://github.com/pandas-dev/pandas/issues/52675)) +* Bug in [`json_normalize()`](../reference/api/pandas.json_normalize.html#pandas.json_normalize "pandas.json_normalize") could not parse metadata fields list type ([GH 37782](https://github.com/pandas-dev/pandas/issues/37782)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") where it would error when `parse_dates` was set to a list or dictionary with `engine="pyarrow"` ([GH 47961](https://github.com/pandas-dev/pandas/issues/47961)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") with `engine="pyarrow"` raising when specifying a `dtype` with `index_col` ([GH 53229](https://github.com/pandas-dev/pandas/issues/53229)) +* Bug in [`read_hdf()`](../reference/api/pandas.read_hdf.html#pandas.read_hdf "pandas.read_hdf") not properly closing store after an `IndexError` is raised ([GH 52781](https://github.com/pandas-dev/pandas/issues/52781)) +* Bug in [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") where style elements were read into DataFrames ([GH 52197](https://github.com/pandas-dev/pandas/issues/52197)) +* Bug in [`read_html()`](../reference/api/pandas.read_html.html#pandas.read_html "pandas.read_html") where tail texts were removed together with elements containing `display:none` style ([GH 51629](https://github.com/pandas-dev/pandas/issues/51629)) +* Bug in [`read_sql_table()`](../reference/api/pandas.read_sql_table.html#pandas.read_sql_table "pandas.read_sql_table") raising an exception when reading a view ([GH 52969](https://github.com/pandas-dev/pandas/issues/52969)) +* Bug in [`read_sql()`](../reference/api/pandas.read_sql.html#pandas.read_sql "pandas.read_sql") when reading multiple timezone aware columns with the same column name ([GH 44421](https://github.com/pandas-dev/pandas/issues/44421)) +* Bug in [`read_xml()`](../reference/api/pandas.read_xml.html#pandas.read_xml "pandas.read_xml") stripping whitespace in string data ([GH 53811](https://github.com/pandas-dev/pandas/issues/53811)) +* Bug in [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") where `colspace` was incorrectly applied in case of multi index columns ([GH 53885](https://github.com/pandas-dev/pandas/issues/53885)) +* Bug in [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") where conversion for an empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with complex dtype raised a `ValueError` ([GH 54167](https://github.com/pandas-dev/pandas/issues/54167)) +* Bug in [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") where `DateTimeArray`/`DateTimeIndex` with non nanosecond precision could not be serialized correctly ([GH 53686](https://github.com/pandas-dev/pandas/issues/53686)) +* Bug when writing and reading empty Stata dta files where dtype information was lost ([GH 46240](https://github.com/pandas-dev/pandas/issues/46240)) +* Bug where `bz2` was treated as a hard requirement ([GH 53857](https://github.com/pandas-dev/pandas/issues/53857)) + +### Period[#](#period "Link to this heading") + +* Bug in [`PeriodDtype`](../reference/api/pandas.PeriodDtype.html#pandas.PeriodDtype "pandas.PeriodDtype") constructor failing to raise `TypeError` when no argument is passed or when `None` is passed ([GH 27388](https://github.com/pandas-dev/pandas/issues/27388)) +* Bug in [`PeriodDtype`](../reference/api/pandas.PeriodDtype.html#pandas.PeriodDtype "pandas.PeriodDtype") constructor incorrectly returning the same `normalize` for different `DateOffset` `freq` inputs ([GH 24121](https://github.com/pandas-dev/pandas/issues/24121)) +* Bug in [`PeriodDtype`](../reference/api/pandas.PeriodDtype.html#pandas.PeriodDtype "pandas.PeriodDtype") constructor raising `ValueError` instead of `TypeError` when an invalid type is passed ([GH 51790](https://github.com/pandas-dev/pandas/issues/51790)) +* Bug in [`PeriodDtype`](../reference/api/pandas.PeriodDtype.html#pandas.PeriodDtype "pandas.PeriodDtype") where the object could be kept alive when deleted ([GH 54184](https://github.com/pandas-dev/pandas/issues/54184)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") not processing empty strings as a null value, with `engine="pyarrow"` ([GH 52087](https://github.com/pandas-dev/pandas/issues/52087)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") returning `object` dtype columns instead of `float64` dtype columns with `engine="pyarrow"` for columns that are all null with `engine="pyarrow"` ([GH 52087](https://github.com/pandas-dev/pandas/issues/52087)) +* Bug in [`Period.now()`](../reference/api/pandas.Period.now.html#pandas.Period.now "pandas.Period.now") not accepting the `freq` parameter as a keyword argument ([GH 53369](https://github.com/pandas-dev/pandas/issues/53369)) +* Bug in `PeriodIndex.map()` with `na_action="ignore"` ([GH 51644](https://github.com/pandas-dev/pandas/issues/51644)) +* Bug in `arrays.PeriodArray.map()` and `PeriodIndex.map()`, where the supplied callable operated array-wise instead of element-wise ([GH 51977](https://github.com/pandas-dev/pandas/issues/51977)) +* Bug in incorrectly allowing construction of [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") or [`PeriodDtype`](../reference/api/pandas.PeriodDtype.html#pandas.PeriodDtype "pandas.PeriodDtype") with `CustomBusinessDay` freq; use `BusinessDay` instead ([GH 52534](https://github.com/pandas-dev/pandas/issues/52534)) + +### Plotting[#](#plotting "Link to this heading") + +* Bug in [`Series.plot()`](../reference/api/pandas.Series.plot.html#pandas.Series.plot "pandas.Series.plot") when invoked with `color=None` ([GH 51953](https://github.com/pandas-dev/pandas/issues/51953)) +* Fixed UserWarning in [`DataFrame.plot.scatter()`](../reference/api/pandas.DataFrame.plot.scatter.html#pandas.DataFrame.plot.scatter "pandas.DataFrame.plot.scatter") when invoked with `c="b"` ([GH 53908](https://github.com/pandas-dev/pandas/issues/53908)) + +### Groupby/resample/rolling[#](#groupby-resample-rolling "Link to this heading") + +* Bug in [`DataFrameGroupBy.idxmin()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.idxmin.html#pandas.core.groupby.DataFrameGroupBy.idxmin "pandas.core.groupby.DataFrameGroupBy.idxmin"), [`SeriesGroupBy.idxmin()`](../reference/api/pandas.core.groupby.SeriesGroupBy.idxmin.html#pandas.core.groupby.SeriesGroupBy.idxmin "pandas.core.groupby.SeriesGroupBy.idxmin"), [`DataFrameGroupBy.idxmax()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.idxmax.html#pandas.core.groupby.DataFrameGroupBy.idxmax "pandas.core.groupby.DataFrameGroupBy.idxmax"), [`SeriesGroupBy.idxmax()`](../reference/api/pandas.core.groupby.SeriesGroupBy.idxmax.html#pandas.core.groupby.SeriesGroupBy.idxmax "pandas.core.groupby.SeriesGroupBy.idxmax") returns wrong dtype when used on an empty DataFrameGroupBy or SeriesGroupBy ([GH 51423](https://github.com/pandas-dev/pandas/issues/51423)) +* Bug in `DataFrame.groupby.rank()` on nullable datatypes when passing `na_option="bottom"` or `na_option="top"` ([GH 54206](https://github.com/pandas-dev/pandas/issues/54206)) +* Bug in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") and [`Series.resample()`](../reference/api/pandas.Series.resample.html#pandas.Series.resample "pandas.Series.resample") in incorrectly allowing non-fixed `freq` when resampling on a [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") ([GH 51896](https://github.com/pandas-dev/pandas/issues/51896)) +* Bug in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") and [`Series.resample()`](../reference/api/pandas.Series.resample.html#pandas.Series.resample "pandas.Series.resample") losing time zone when resampling empty data ([GH 53664](https://github.com/pandas-dev/pandas/issues/53664)) +* Bug in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") and [`Series.resample()`](../reference/api/pandas.Series.resample.html#pandas.Series.resample "pandas.Series.resample") where `origin` has no effect in resample when values are outside of axis ([GH 53662](https://github.com/pandas-dev/pandas/issues/53662)) +* Bug in weighted rolling aggregations when specifying `min_periods=0` ([GH 51449](https://github.com/pandas-dev/pandas/issues/51449)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") and [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") where, when the index of the + grouped [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") was a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex"), [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") + or [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex"), and the `groupby` method was given a function as its first argument, + the function operated on the whole index rather than each element of the index ([GH 51979](https://github.com/pandas-dev/pandas/issues/51979)) +* Bug in [`DataFrameGroupBy.agg()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg") with lists not respecting `as_index=False` ([GH 52849](https://github.com/pandas-dev/pandas/issues/52849)) +* Bug in [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") causing an error to be raised when the input [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") was subset as a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") after groupby (`[['a']]` and not `['a']`) and the given callable returned [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") that were not all indexed the same ([GH 52444](https://github.com/pandas-dev/pandas/issues/52444)) +* Bug in [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") raising a `TypeError` when selecting multiple columns and providing a function that returns `np.ndarray` results ([GH 18930](https://github.com/pandas-dev/pandas/issues/18930)) +* Bug in [`DataFrameGroupBy.groups()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.groups.html#pandas.core.groupby.DataFrameGroupBy.groups "pandas.core.groupby.DataFrameGroupBy.groups") and [`SeriesGroupBy.groups()`](../reference/api/pandas.core.groupby.SeriesGroupBy.groups.html#pandas.core.groupby.SeriesGroupBy.groups "pandas.core.groupby.SeriesGroupBy.groups") with a datetime key in conjunction with another key produced an incorrect number of group keys ([GH 51158](https://github.com/pandas-dev/pandas/issues/51158)) +* Bug in [`DataFrameGroupBy.quantile()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.quantile.html#pandas.core.groupby.DataFrameGroupBy.quantile "pandas.core.groupby.DataFrameGroupBy.quantile") and [`SeriesGroupBy.quantile()`](../reference/api/pandas.core.groupby.SeriesGroupBy.quantile.html#pandas.core.groupby.SeriesGroupBy.quantile "pandas.core.groupby.SeriesGroupBy.quantile") may implicitly sort the result index with `sort=False` ([GH 53009](https://github.com/pandas-dev/pandas/issues/53009)) +* Bug in [`SeriesGroupBy.size()`](../reference/api/pandas.core.groupby.SeriesGroupBy.size.html#pandas.core.groupby.SeriesGroupBy.size "pandas.core.groupby.SeriesGroupBy.size") where the dtype would be `np.int64` for data with [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") or masked dtypes (e.g. `Int64`) ([GH 53831](https://github.com/pandas-dev/pandas/issues/53831)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") with column selection on the resulting groupby object not returning names as tuples when grouping by a list consisting of a single element ([GH 53500](https://github.com/pandas-dev/pandas/issues/53500)) +* Bug in [`DataFrameGroupBy.var()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.var.html#pandas.core.groupby.DataFrameGroupBy.var "pandas.core.groupby.DataFrameGroupBy.var") and [`SeriesGroupBy.var()`](../reference/api/pandas.core.groupby.SeriesGroupBy.var.html#pandas.core.groupby.SeriesGroupBy.var "pandas.core.groupby.SeriesGroupBy.var") failing to raise `TypeError` when called with datetime64, timedelta64 or [`PeriodDtype`](../reference/api/pandas.PeriodDtype.html#pandas.PeriodDtype "pandas.PeriodDtype") values ([GH 52128](https://github.com/pandas-dev/pandas/issues/52128), [GH 53045](https://github.com/pandas-dev/pandas/issues/53045)) +* Bug in [`DataFrameGroupBy.resample()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.resample.html#pandas.core.groupby.DataFrameGroupBy.resample "pandas.core.groupby.DataFrameGroupBy.resample") with `kind="period"` raising `AttributeError` ([GH 24103](https://github.com/pandas-dev/pandas/issues/24103)) +* Bug in [`Resampler.ohlc()`](../reference/api/pandas.core.resample.Resampler.ohlc.html#pandas.core.resample.Resampler.ohlc "pandas.core.resample.Resampler.ohlc") with empty object returning a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") instead of empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 42902](https://github.com/pandas-dev/pandas/issues/42902)) +* Bug in [`SeriesGroupBy.count()`](../reference/api/pandas.core.groupby.SeriesGroupBy.count.html#pandas.core.groupby.SeriesGroupBy.count "pandas.core.groupby.SeriesGroupBy.count") and [`DataFrameGroupBy.count()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.count.html#pandas.core.groupby.DataFrameGroupBy.count "pandas.core.groupby.DataFrameGroupBy.count") where the dtype would be `np.int64` for data with [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") or masked dtypes (e.g. `Int64`) ([GH 53831](https://github.com/pandas-dev/pandas/issues/53831)) +* Bug in [`SeriesGroupBy.nth()`](../reference/api/pandas.core.groupby.SeriesGroupBy.nth.html#pandas.core.groupby.SeriesGroupBy.nth "pandas.core.groupby.SeriesGroupBy.nth") and [`DataFrameGroupBy.nth()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.nth.html#pandas.core.groupby.DataFrameGroupBy.nth "pandas.core.groupby.DataFrameGroupBy.nth") after performing column selection when using `dropna="any"` or `dropna="all"` would not subset columns ([GH 53518](https://github.com/pandas-dev/pandas/issues/53518)) +* Bug in [`SeriesGroupBy.nth()`](../reference/api/pandas.core.groupby.SeriesGroupBy.nth.html#pandas.core.groupby.SeriesGroupBy.nth "pandas.core.groupby.SeriesGroupBy.nth") and [`DataFrameGroupBy.nth()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.nth.html#pandas.core.groupby.DataFrameGroupBy.nth "pandas.core.groupby.DataFrameGroupBy.nth") raised after performing column selection when using `dropna="any"` or `dropna="all"` resulted in rows being dropped ([GH 53518](https://github.com/pandas-dev/pandas/issues/53518)) +* Bug in [`SeriesGroupBy.sum()`](../reference/api/pandas.core.groupby.SeriesGroupBy.sum.html#pandas.core.groupby.SeriesGroupBy.sum "pandas.core.groupby.SeriesGroupBy.sum") and [`DataFrameGroupBy.sum()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.sum.html#pandas.core.groupby.DataFrameGroupBy.sum "pandas.core.groupby.DataFrameGroupBy.sum") summing `np.inf + np.inf` and `(-np.inf) + (-np.inf)` to `np.nan` instead of `np.inf` and `-np.inf` respectively ([GH 53606](https://github.com/pandas-dev/pandas/issues/53606)) +* Bug in [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") raising an error when grouped [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") has a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") index and a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with a name that is a month is given to the `by` argument ([GH 48509](https://github.com/pandas-dev/pandas/issues/48509)) + +### Reshaping[#](#reshaping "Link to this heading") + +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") coercing to `object` dtype when one column has `pa.null()` dtype ([GH 53702](https://github.com/pandas-dev/pandas/issues/53702)) +* Bug in [`crosstab()`](../reference/api/pandas.crosstab.html#pandas.crosstab "pandas.crosstab") when `dropna=False` would not keep `np.nan` in the result ([GH 10772](https://github.com/pandas-dev/pandas/issues/10772)) +* Bug in [`melt()`](../reference/api/pandas.melt.html#pandas.melt "pandas.melt") where the `variable` column would lose extension dtypes ([GH 54297](https://github.com/pandas-dev/pandas/issues/54297)) +* Bug in [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") raising `KeyError` for extension dtypes ([GH 52904](https://github.com/pandas-dev/pandas/issues/52904)) +* Bug in [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") raising `ValueError` for data backed by read-only ndarrays ([GH 53513](https://github.com/pandas-dev/pandas/issues/53513)) +* Bug in [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") with `left_index=True` or `right_index=True` with mismatched index dtypes giving incorrect results in some cases instead of raising `MergeError` ([GH 53870](https://github.com/pandas-dev/pandas/issues/53870)) +* Bug in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") when merging on integer `ExtensionDtype` and float NumPy dtype raising `TypeError` ([GH 46178](https://github.com/pandas-dev/pandas/issues/46178)) +* Bug in [`DataFrame.agg()`](../reference/api/pandas.DataFrame.agg.html#pandas.DataFrame.agg "pandas.DataFrame.agg") and [`Series.agg()`](../reference/api/pandas.Series.agg.html#pandas.Series.agg "pandas.Series.agg") on non-unique columns would return incorrect type when dist-like argument passed in ([GH 51099](https://github.com/pandas-dev/pandas/issues/51099)) +* Bug in [`DataFrame.combine_first()`](../reference/api/pandas.DataFrame.combine_first.html#pandas.DataFrame.combine_first "pandas.DataFrame.combine_first") ignoring other’s columns if `other` is empty ([GH 53792](https://github.com/pandas-dev/pandas/issues/53792)) +* Bug in [`DataFrame.idxmin()`](../reference/api/pandas.DataFrame.idxmin.html#pandas.DataFrame.idxmin "pandas.DataFrame.idxmin") and [`DataFrame.idxmax()`](../reference/api/pandas.DataFrame.idxmax.html#pandas.DataFrame.idxmax "pandas.DataFrame.idxmax"), where the axis dtype would be lost for empty frames ([GH 53265](https://github.com/pandas-dev/pandas/issues/53265)) +* Bug in [`DataFrame.merge()`](../reference/api/pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge") not merging correctly when having `MultiIndex` with single level ([GH 52331](https://github.com/pandas-dev/pandas/issues/52331)) +* Bug in [`DataFrame.stack()`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack") losing extension dtypes when columns is a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") and frame contains mixed dtypes ([GH 45740](https://github.com/pandas-dev/pandas/issues/45740)) +* Bug in [`DataFrame.stack()`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack") sorting columns lexicographically ([GH 53786](https://github.com/pandas-dev/pandas/issues/53786)) +* Bug in [`DataFrame.transpose()`](../reference/api/pandas.DataFrame.transpose.html#pandas.DataFrame.transpose "pandas.DataFrame.transpose") inferring dtype for object column ([GH 51546](https://github.com/pandas-dev/pandas/issues/51546)) +* Bug in [`Series.combine_first()`](../reference/api/pandas.Series.combine_first.html#pandas.Series.combine_first "pandas.Series.combine_first") converting `int64` dtype to `float64` and losing precision on very large integers ([GH 51764](https://github.com/pandas-dev/pandas/issues/51764)) +* Bug when joining empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") objects, where the joined index would be a [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") instead of the joined index type ([GH 52777](https://github.com/pandas-dev/pandas/issues/52777)) + +### Sparse[#](#sparse "Link to this heading") + +* Bug in [`SparseDtype`](../reference/api/pandas.SparseDtype.html#pandas.SparseDtype "pandas.SparseDtype") constructor failing to raise `TypeError` when given an incompatible `dtype` for its subtype, which must be a NumPy dtype ([GH 53160](https://github.com/pandas-dev/pandas/issues/53160)) +* Bug in `arrays.SparseArray.map()` allowed the fill value to be included in the sparse values ([GH 52095](https://github.com/pandas-dev/pandas/issues/52095)) + +### ExtensionArray[#](#extensionarray "Link to this heading") + +* Bug in [`ArrowStringArray`](../reference/api/pandas.arrays.ArrowStringArray.html#pandas.arrays.ArrowStringArray "pandas.arrays.ArrowStringArray") constructor raises `ValueError` with dictionary types of strings ([GH 54074](https://github.com/pandas-dev/pandas/issues/54074)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructor not copying [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with extension dtype when given in dict ([GH 53744](https://github.com/pandas-dev/pandas/issues/53744)) +* Bug in [`ArrowExtensionArray`](../reference/api/pandas.arrays.ArrowExtensionArray.html#pandas.arrays.ArrowExtensionArray "pandas.arrays.ArrowExtensionArray") converting pandas non-nanosecond temporal objects from non-zero values to zero values ([GH 53171](https://github.com/pandas-dev/pandas/issues/53171)) +* Bug in [`Series.quantile()`](../reference/api/pandas.Series.quantile.html#pandas.Series.quantile "pandas.Series.quantile") for PyArrow temporal types raising `ArrowInvalid` ([GH 52678](https://github.com/pandas-dev/pandas/issues/52678)) +* Bug in [`Series.rank()`](../reference/api/pandas.Series.rank.html#pandas.Series.rank "pandas.Series.rank") returning wrong order for small values with `Float64` dtype ([GH 52471](https://github.com/pandas-dev/pandas/issues/52471)) +* Bug in [`Series.unique()`](../reference/api/pandas.Series.unique.html#pandas.Series.unique "pandas.Series.unique") for boolean `ArrowDtype` with `NA` values ([GH 54667](https://github.com/pandas-dev/pandas/issues/54667)) +* Bug in `__iter__()` and `__getitem__()` returning python datetime and timedelta objects for non-nano dtypes ([GH 53326](https://github.com/pandas-dev/pandas/issues/53326)) +* Bug in `factorize()` returning incorrect uniques for a `pyarrow.dictionary` type `pyarrow.chunked_array` with more than one chunk ([GH 54844](https://github.com/pandas-dev/pandas/issues/54844)) +* Bug when passing an `ExtensionArray` subclass to `dtype` keywords. This will now raise a `UserWarning` to encourage passing an instance instead ([GH 31356](https://github.com/pandas-dev/pandas/issues/31356), [GH 54592](https://github.com/pandas-dev/pandas/issues/54592)) +* Bug where the [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") repr would not work when a column had an [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with a `pyarrow.ExtensionDtype` ([GH 54063](https://github.com/pandas-dev/pandas/issues/54063)) +* Bug where the `__from_arrow__` method of masked ExtensionDtypes (e.g. [`Float64Dtype`](../reference/api/pandas.Float64Dtype.html#pandas.Float64Dtype "pandas.Float64Dtype"), [`BooleanDtype`](../reference/api/pandas.BooleanDtype.html#pandas.BooleanDtype "pandas.BooleanDtype")) would not accept PyArrow arrays of type `pyarrow.null()` ([GH 52223](https://github.com/pandas-dev/pandas/issues/52223)) + +### Styler[#](#styler "Link to this heading") + +* Bug in `Styler._copy()` calling overridden methods in subclasses of [`Styler`](../reference/api/pandas.io.formats.style.Styler.html#pandas.io.formats.style.Styler "pandas.io.formats.style.Styler") ([GH 52728](https://github.com/pandas-dev/pandas/issues/52728)) + +### Metadata[#](#metadata "Link to this heading") + +* Fixed metadata propagation in [`DataFrame.max()`](../reference/api/pandas.DataFrame.max.html#pandas.DataFrame.max "pandas.DataFrame.max"), [`DataFrame.min()`](../reference/api/pandas.DataFrame.min.html#pandas.DataFrame.min "pandas.DataFrame.min"), [`DataFrame.prod()`](../reference/api/pandas.DataFrame.prod.html#pandas.DataFrame.prod "pandas.DataFrame.prod"), [`DataFrame.mean()`](../reference/api/pandas.DataFrame.mean.html#pandas.DataFrame.mean "pandas.DataFrame.mean"), [`Series.mode()`](../reference/api/pandas.Series.mode.html#pandas.Series.mode "pandas.Series.mode"), [`DataFrame.median()`](../reference/api/pandas.DataFrame.median.html#pandas.DataFrame.median "pandas.DataFrame.median"), [`DataFrame.sem()`](../reference/api/pandas.DataFrame.sem.html#pandas.DataFrame.sem "pandas.DataFrame.sem"), [`DataFrame.skew()`](../reference/api/pandas.DataFrame.skew.html#pandas.DataFrame.skew "pandas.DataFrame.skew"), [`DataFrame.kurt()`](../reference/api/pandas.DataFrame.kurt.html#pandas.DataFrame.kurt "pandas.DataFrame.kurt") ([GH 28283](https://github.com/pandas-dev/pandas/issues/28283)) +* Fixed metadata propagation in [`DataFrame.squeeze()`](../reference/api/pandas.DataFrame.squeeze.html#pandas.DataFrame.squeeze "pandas.DataFrame.squeeze"), and [`DataFrame.describe()`](../reference/api/pandas.DataFrame.describe.html#pandas.DataFrame.describe "pandas.DataFrame.describe") ([GH 28283](https://github.com/pandas-dev/pandas/issues/28283)) +* Fixed metadata propagation in [`DataFrame.std()`](../reference/api/pandas.DataFrame.std.html#pandas.DataFrame.std "pandas.DataFrame.std") ([GH 28283](https://github.com/pandas-dev/pandas/issues/28283)) + +### Other[#](#other "Link to this heading") + +* Bug in `FloatingArray.__contains__` with `NaN` item incorrectly returning `False` when `NaN` values are present ([GH 52840](https://github.com/pandas-dev/pandas/issues/52840)) +* Bug in [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") raising for data of complex dtype when `NaN` values are present ([GH 53627](https://github.com/pandas-dev/pandas/issues/53627)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") where `repr` of index passed with time does not print time is midnight and non-day based freq([GH 53470](https://github.com/pandas-dev/pandas/issues/53470)) +* Bug in [`testing.assert_frame_equal()`](../reference/api/pandas.testing.assert_frame_equal.html#pandas.testing.assert_frame_equal "pandas.testing.assert_frame_equal") and [`testing.assert_series_equal()`](../reference/api/pandas.testing.assert_series_equal.html#pandas.testing.assert_series_equal "pandas.testing.assert_series_equal") now throw assertion error for two unequal sets ([GH 51727](https://github.com/pandas-dev/pandas/issues/51727)) +* Bug in [`testing.assert_frame_equal()`](../reference/api/pandas.testing.assert_frame_equal.html#pandas.testing.assert_frame_equal "pandas.testing.assert_frame_equal") checks category dtypes even when asked not to check index type ([GH 52126](https://github.com/pandas-dev/pandas/issues/52126)) +* Bug in [`api.interchange.from_dataframe()`](../reference/api/pandas.api.interchange.from_dataframe.html#pandas.api.interchange.from_dataframe "pandas.api.interchange.from_dataframe") was not respecting `allow_copy` argument ([GH 54322](https://github.com/pandas-dev/pandas/issues/54322)) +* Bug in [`api.interchange.from_dataframe()`](../reference/api/pandas.api.interchange.from_dataframe.html#pandas.api.interchange.from_dataframe "pandas.api.interchange.from_dataframe") was raising during interchanging from non-pandas tz-aware data containing null values ([GH 54287](https://github.com/pandas-dev/pandas/issues/54287)) +* Bug in [`api.interchange.from_dataframe()`](../reference/api/pandas.api.interchange.from_dataframe.html#pandas.api.interchange.from_dataframe "pandas.api.interchange.from_dataframe") when converting an empty DataFrame object ([GH 53155](https://github.com/pandas-dev/pandas/issues/53155)) +* Bug in [`from_dummies()`](../reference/api/pandas.from_dummies.html#pandas.from_dummies "pandas.from_dummies") where the resulting [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") did not match the original [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") ([GH 54300](https://github.com/pandas-dev/pandas/issues/54300)) +* Bug in [`from_dummies()`](../reference/api/pandas.from_dummies.html#pandas.from_dummies "pandas.from_dummies") where the resulting data would always be `object` dtype instead of the dtype of the columns ([GH 54300](https://github.com/pandas-dev/pandas/issues/54300)) +* Bug in [`DataFrameGroupBy.first()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.first.html#pandas.core.groupby.DataFrameGroupBy.first "pandas.core.groupby.DataFrameGroupBy.first"), [`DataFrameGroupBy.last()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.last.html#pandas.core.groupby.DataFrameGroupBy.last "pandas.core.groupby.DataFrameGroupBy.last"), [`SeriesGroupBy.first()`](../reference/api/pandas.core.groupby.SeriesGroupBy.first.html#pandas.core.groupby.SeriesGroupBy.first "pandas.core.groupby.SeriesGroupBy.first"), and [`SeriesGroupBy.last()`](../reference/api/pandas.core.groupby.SeriesGroupBy.last.html#pandas.core.groupby.SeriesGroupBy.last "pandas.core.groupby.SeriesGroupBy.last") where an empty group would return `np.nan` instead of the corresponding [`ExtensionArray`](../reference/api/pandas.api.extensions.ExtensionArray.html#pandas.api.extensions.ExtensionArray "pandas.api.extensions.ExtensionArray") NA value ([GH 39098](https://github.com/pandas-dev/pandas/issues/39098)) +* Bug in [`DataFrame.pivot_table()`](../reference/api/pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table") with casting the mean of ints back to an int ([GH 16676](https://github.com/pandas-dev/pandas/issues/16676)) +* Bug in [`DataFrame.reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex") with a `fill_value` that should be inferred with a `ExtensionDtype` incorrectly inferring `object` dtype ([GH 52586](https://github.com/pandas-dev/pandas/issues/52586)) +* Bug in [`DataFrame.shift()`](../reference/api/pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift") with `axis=1` on a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a single `ExtensionDtype` column giving incorrect results ([GH 53832](https://github.com/pandas-dev/pandas/issues/53832)) +* Bug in [`Index.sort_values()`](../reference/api/pandas.Index.sort_values.html#pandas.Index.sort_values "pandas.Index.sort_values") when a `key` is passed ([GH 52764](https://github.com/pandas-dev/pandas/issues/52764)) +* Bug in [`Series.align()`](../reference/api/pandas.Series.align.html#pandas.Series.align "pandas.Series.align"), [`DataFrame.align()`](../reference/api/pandas.DataFrame.align.html#pandas.DataFrame.align "pandas.DataFrame.align"), [`Series.reindex()`](../reference/api/pandas.Series.reindex.html#pandas.Series.reindex "pandas.Series.reindex"), [`DataFrame.reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex"), [`Series.interpolate()`](../reference/api/pandas.Series.interpolate.html#pandas.Series.interpolate "pandas.Series.interpolate"), [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate"), incorrectly failing to raise with method=”asfreq” ([GH 53620](https://github.com/pandas-dev/pandas/issues/53620)) +* Bug in [`Series.argsort()`](../reference/api/pandas.Series.argsort.html#pandas.Series.argsort "pandas.Series.argsort") failing to raise when an invalid `axis` is passed ([GH 54257](https://github.com/pandas-dev/pandas/issues/54257)) +* Bug in [`Series.map()`](../reference/api/pandas.Series.map.html#pandas.Series.map "pandas.Series.map") when giving a callable to an empty series, the returned series had `object` dtype. It now keeps the original dtype ([GH 52384](https://github.com/pandas-dev/pandas/issues/52384)) +* Bug in [`Series.memory_usage()`](../reference/api/pandas.Series.memory_usage.html#pandas.Series.memory_usage "pandas.Series.memory_usage") when `deep=True` throw an error with Series of objects and the returned value is incorrect, as it does not take into account GC corrections ([GH 51858](https://github.com/pandas-dev/pandas/issues/51858)) +* Bug in [`period_range()`](../reference/api/pandas.period_range.html#pandas.period_range "pandas.period_range") the default behavior when freq was not passed as an argument was incorrect([GH 53687](https://github.com/pandas-dev/pandas/issues/53687)) +* Fixed incorrect `__name__` attribute of `pandas._libs.json` ([GH 52898](https://github.com/pandas-dev/pandas/issues/52898)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 266 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* AG + +* Aarni Koskela +* Adrian D’Alessandro + +* Adrien RUAULT + +* Ahmad + +* Aidos Kanapyanov + +* Alex Malins +* Alexander Seiler + +* Ali Asgar + +* Allison Kwan +* Amanda Bizzinotto + +* Andres Algaba + +* Angela Seo + +* Anirudh Hegde + +* Antony Evmorfopoulos + +* Anushka Bishnoi +* ArnaudChanoine + +* Artem Vorobyev + +* Arya Sarkar + +* Ashwin Srinath +* Austin Au-Yeung + +* Austin Burnett + +* Bear + +* Ben Mangold + +* Bernardo Gameiro + +* Boyd Kane + +* Brayan Alexander Muñoz B + +* Brock +* Chetan0402 + +* Chris Carini +* ChristofKaufmann +* Clark-W + +* Conrad Mcgee Stocks +* Corrie Bartelheimer + +* Coulton Theuer + +* D067751 + +* Daniel Isaac +* Daniele Nicolodi + +* David Samuel + +* David Seifert + +* Dea Leon + +* Dea María Léon +* Deepyaman Datta +* Denis Sapozhnikov + +* Dharani Akurathi + +* DimiGrammatikakis + +* Dirk Ulbricht + +* Dmitry Shemetov + +* Dominik Berger +* Efkan S. Goktepe + +* Ege Özgüroğlu +* Eli Schwartz +* Erdi + +* Fabrizio Primerano + +* Facundo Batista + +* Fangchen Li +* Felipe Maion + +* Francis + +* Future Programmer + +* Gabriel Kabbe + +* Gaétan Ramet + +* Gianluca Ficarelli +* Godwill Agbehonou + +* Guillaume Lemaitre +* Guo Ci +* Gustavo Vargas + +* Hamidreza Sanaee + +* HappyHorse + +* Harald Husum + +* Hugo van Kemenade +* Ido Ronen + +* Irv Lustig +* JHM Darbyshire +* JHM Darbyshire (iMac) +* JJ + +* Jarrod Millman +* Jay + +* Jeff Reback +* Jessica Greene + +* Jiawei Zhang + +* Jinli Xiao + +* Joanna Ge + +* Jona Sassenhagen + +* Jonas Haag +* Joris Van den Bossche +* Joshua Shew + +* Julian Badillo +* Julian Ortiz + +* Julien Palard + +* Justin Tyson + +* Justus Magin +* Kabiir Krishna + +* Kang Su Min +* Ketu Patel + +* Kevin + +* Kevin Anderson +* Kevin Jan Anker +* Kevin Klein + +* Kevin Sheppard +* Kostya Farber +* LM + +* Lars Lien Ankile + +* Lawrence Mitchell +* Liwei Cai + +* Loic Diridollou +* Luciana Solorzano + +* Luke Manley +* Lumberbot (aka Jack) +* Marat Kopytjuk + +* Marc Garcia +* Marco Edward Gorelli +* MarcoGorelli +* Maria Telenczuk + +* MarvinGravert + +* Mateusz Sokół + +* Matt Richards +* Matthew Barber + +* Matthew Roeschke +* Matus Valo + +* Mia Reimer + +* Michael Terry + +* Michael Tiemann + +* Milad Maani Jou + +* Miles Cranmer + +* MirijaH + +* Miyuu + +* Natalia Mokeeva +* Nathan Goldbaum + +* Nicklaus Roach + +* Nicolas Camenisch + +* Nikolay Boev + +* Nirav +* Nishu Choudhary +* Noa Tamir +* Noy Hanan + +* Numan + +* Numan Ijaz + +* Omar Elbaz + +* Pandas Development Team +* Parfait Gasana +* Parthi +* Patrick Hoefler +* Patrick Schleiter + +* Pawel Kranzberg + +* Philip +* Philip Meier + +* Pranav Saibhushan Ravuri +* PrathumP + +* Rahul Siloniya + +* Rajasvi Vinayak + +* Rajat Subhra Mukherjee + +* Ralf Gommers +* RaphSku +* Rebecca Chen + +* Renato Cotrim Maciel + +* Reza (Milad) Maanijou + +* Richard Shadrach +* Rithik Reddy + +* Robert Luce + +* Ronalido + +* Rylie Wei + +* SOUMYADIP MAL + +* Sanjith Chockan + +* Sayed Qaiser Ali + +* Scott Harp + +* Se + +* Shashwat Agrawal +* Simar Bassi + +* Simon Brugman + +* Simon Hawkins +* Simon Høxbro Hansen +* Snorf Yang + +* Sortofamudkip + +* Stefan Krawczyk +* Stefanie Molin +* Stefanie Senger +* Stelios Petrakis + +* Stijn Van Hoey +* Sven +* Sylvain MARIE +* Sylvain Marié +* Terji Petersen +* Thierry Moisan +* Thomas +* Thomas A Caswell +* Thomas Grainger +* Thomas Li +* Thomas Vranken + +* Tianye Song + +* Tim Hoffmann +* Tim Loderhose + +* Tim Swast +* Timon Jurschitsch + +* Tolker-KU + +* Tomas Pavlik + +* Toroi + +* Torsten Wörtwein +* Travis Gibbs + +* Umberto Fasci + +* Valerii + +* VanMyHu + +* Victor Momodu + +* Vijay Vaidyanathan + +* VomV + +* William Andrea +* William Ayd +* Wolf Behrenhoff + +* Xiao Yuan +* Yao Xiao +* Yasin Tatar +* Yaxin Li + +* Yi Wei + +* Yulia + +* Yusharth Singh + +* Zach Breger + +* Zhengbo Wang +* abokey1 + +* ahmad2901 + +* assafam + +* auderson +* august-tengland + +* bunardsheng + +* cmmck + +* cnguyen-03 + +* coco + +* dependabot[bot] +* giplessis + +* github-actions[bot] +* gmaiwald + +* gmollard + +* jbrockmendel +* kathleenhang +* kevx82 + +* lia2710 + +* liang3zy22 + +* ltartaro + +* lusolorz + +* m-ganko + +* mKlepsch + +* mattkeanny + +* mrastgoo + +* nabdoni + +* omar-elbaz + +* paulreece + +* penelopeysm + +* potap75 + +* pre-commit-ci[bot] + +* raanasn + +* raj-thapa + +* ramvikrams + +* rebecca-palmer +* reddyrg1 + +* rmhowe425 + +* segatrade + +* shteken + +* sweisss + +* taytzehao +* tntmatthews + +* tpaxman + +* tzehaoo + +* v-mcoutinho + +* wcgonzal + +* yonashub +* yusharth + +* Ádám Lippai +* Štěpán Műller + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_2.1.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_2.1.1.md new file mode 100644 index 0000000000000000000000000000000000000000..2e52db81fb22b7089a6eaf6603e6ac45d4bf448d --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_2.1.1.md @@ -0,0 +1,56 @@ +# What's new in pandas 2.1.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v2.1.1.html + +# What’s new in 2.1.1 (September 20, 2023)[#](#what-s-new-in-2-1-1-september-20-2023 "Link to this heading") + +These are the changes in pandas 2.1.1. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") when [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ‘s have two different extension dtypes ([GH 54848](https://github.com/pandas-dev/pandas/issues/54848)) +* Fixed regression in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") when merging over a PyArrow string index ([GH 54894](https://github.com/pandas-dev/pandas/issues/54894)) +* Fixed regression in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") when `usecols` is given and `dtypes` is a dict for `engine="python"` ([GH 54868](https://github.com/pandas-dev/pandas/issues/54868)) +* Fixed regression in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") when `delim_whitespace` is True ([GH 54918](https://github.com/pandas-dev/pandas/issues/54918), [GH 54931](https://github.com/pandas-dev/pandas/issues/54931)) +* Fixed regression in `GroupBy.get_group()` raising for `axis=1` ([GH 54858](https://github.com/pandas-dev/pandas/issues/54858)) +* Fixed regression in `DataFrame.__setitem__()` raising `AssertionError` when setting a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with a partial [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 54875](https://github.com/pandas-dev/pandas/issues/54875)) +* Fixed regression in [`DataFrame.filter()`](../reference/api/pandas.DataFrame.filter.html#pandas.DataFrame.filter "pandas.DataFrame.filter") not respecting the order of elements for `filter` ([GH 54980](https://github.com/pandas-dev/pandas/issues/54980)) +* Fixed regression in [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") not roundtripping datetime columns correctly for sqlite ([GH 54877](https://github.com/pandas-dev/pandas/issues/54877)) +* Fixed regression in `DataFrameGroupBy.agg()` when aggregating a DataFrame with duplicate column names using a dictionary ([GH 55006](https://github.com/pandas-dev/pandas/issues/55006)) +* Fixed regression in [`MultiIndex.append()`](../reference/api/pandas.MultiIndex.append.html#pandas.MultiIndex.append "pandas.MultiIndex.append") raising when appending overlapping [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") levels ([GH 54934](https://github.com/pandas-dev/pandas/issues/54934)) +* Fixed regression in [`Series.drop_duplicates()`](../reference/api/pandas.Series.drop_duplicates.html#pandas.Series.drop_duplicates "pandas.Series.drop_duplicates") for PyArrow strings ([GH 54904](https://github.com/pandas-dev/pandas/issues/54904)) +* Fixed regression in [`Series.interpolate()`](../reference/api/pandas.Series.interpolate.html#pandas.Series.interpolate "pandas.Series.interpolate") raising when `fill_value` was given ([GH 54920](https://github.com/pandas-dev/pandas/issues/54920)) +* Fixed regression in [`Series.value_counts()`](../reference/api/pandas.Series.value_counts.html#pandas.Series.value_counts "pandas.Series.value_counts") raising for numeric data if `bins` was specified ([GH 54857](https://github.com/pandas-dev/pandas/issues/54857)) +* Fixed regression in comparison operations for PyArrow backed columns not propagating exceptions correctly ([GH 54944](https://github.com/pandas-dev/pandas/issues/54944)) +* Fixed regression when comparing a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with `datetime64` dtype with `None` ([GH 54870](https://github.com/pandas-dev/pandas/issues/54870)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Fixed bug for [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") raising `NotImplementedError` for fixed-size list ([GH 55000](https://github.com/pandas-dev/pandas/issues/55000)) +* Fixed bug in [`DataFrame.stack()`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack") with `future_stack=True` and columns a non-[`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") consisting of tuples ([GH 54948](https://github.com/pandas-dev/pandas/issues/54948)) +* Fixed bug in [`Series.dt.tz()`](../reference/api/pandas.Series.dt.tz.html#pandas.Series.dt.tz "pandas.Series.dt.tz") with [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") where a string was returned instead of a `tzinfo` object ([GH 55003](https://github.com/pandas-dev/pandas/issues/55003)) +* Fixed bug in [`Series.pct_change()`](../reference/api/pandas.Series.pct_change.html#pandas.Series.pct_change "pandas.Series.pct_change") and [`DataFrame.pct_change()`](../reference/api/pandas.DataFrame.pct_change.html#pandas.DataFrame.pct_change "pandas.DataFrame.pct_change") showing unnecessary `FutureWarning` ([GH 54981](https://github.com/pandas-dev/pandas/issues/54981)) + +## Other[#](#other "Link to this heading") + +* Reverted the deprecation that disallowed [`Series.apply()`](../reference/api/pandas.Series.apply.html#pandas.Series.apply "pandas.Series.apply") returning a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") when the passed-in callable returns a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") object ([GH 52116](https://github.com/pandas-dev/pandas/issues/52116)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 13 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Ben Greiner + +* Joris Van den Bossche +* Kai Mühlbauer + +* Luke Manley +* Lumberbot (aka Jack) +* Mateusz Sokół +* Matthew Roeschke +* Pandas Development Team +* Patrick Hoefler +* Rajat Subhra Mukherjee +* Ralf Gommers +* Richard Shadrach +* Thomas Li diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_2.1.2.md b/corpus/changelog/pandas_whatsnew/whatsnew_2.1.2.md new file mode 100644 index 0000000000000000000000000000000000000000..ccf21fa2c08f43fbac71d10005d198249531632f --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_2.1.2.md @@ -0,0 +1,73 @@ +# What's new in pandas 2.1.2 + +Source: https://pandas.pydata.org/docs/whatsnew/v2.1.2.html + +# What’s new in 2.1.2 (October 26, 2023)[#](#what-s-new-in-2-1-2-october-26-2023 "Link to this heading") + +These are the changes in pandas 2.1.2. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Deprecations[#](#deprecations "Link to this heading") + +* Reverted deprecation of `fill_method=None` in [`DataFrame.pct_change()`](../reference/api/pandas.DataFrame.pct_change.html#pandas.DataFrame.pct_change "pandas.DataFrame.pct_change"), [`Series.pct_change()`](../reference/api/pandas.Series.pct_change.html#pandas.Series.pct_change "pandas.Series.pct_change"), `DataFrameGroupBy.pct_change()`, and `SeriesGroupBy.pct_change()`; the values `'backfill'`, `'bfill'`, `'pad'`, and `'ffill'` are still deprecated ([GH 53491](https://github.com/pandas-dev/pandas/issues/53491)) + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression in [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") where result has missing values and dtype is arrow backed string ([GH 55348](https://github.com/pandas-dev/pandas/issues/55348)) +* Fixed regression in [`rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") where non-nanosecond index or `on` column would produce incorrect results ([GH 55026](https://github.com/pandas-dev/pandas/issues/55026), [GH 55106](https://github.com/pandas-dev/pandas/issues/55106), [GH 55299](https://github.com/pandas-dev/pandas/issues/55299)) +* Fixed regression in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") which was extrapolating back to `origin` when `origin` was outside its bounds ([GH 55064](https://github.com/pandas-dev/pandas/issues/55064)) +* Fixed regression in [`DataFrame.sort_index()`](../reference/api/pandas.DataFrame.sort_index.html#pandas.DataFrame.sort_index "pandas.DataFrame.sort_index") which was not sorting correctly when the index was a sliced [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 55379](https://github.com/pandas-dev/pandas/issues/55379)) +* Fixed regression in `DataFrameGroupBy.agg()` and `SeriesGroupBy.agg()` where if the option `compute.use_numba` was set to True, groupby methods not supported by the numba engine would raise a `TypeError` ([GH 55520](https://github.com/pandas-dev/pandas/issues/55520)) +* Fixed performance regression with wide DataFrames, typically involving methods where all columns were accessed individually ([GH 55256](https://github.com/pandas-dev/pandas/issues/55256), [GH 55245](https://github.com/pandas-dev/pandas/issues/55245)) +* Fixed regression in [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") raising `TypeError` for `by` with datetime and timedelta dtypes ([GH 55453](https://github.com/pandas-dev/pandas/issues/55453)) +* Fixed regression in [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") when reading a file with a string column consisting of more than 2 GB of string data and using the `"string"` dtype ([GH 55606](https://github.com/pandas-dev/pandas/issues/55606)) +* Fixed regression in [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") not roundtripping datetime columns correctly for sqlite when using `detect_types` ([GH 55554](https://github.com/pandas-dev/pandas/issues/55554)) +* Fixed regression in construction of certain DataFrame or Series subclasses ([GH 54922](https://github.com/pandas-dev/pandas/issues/54922)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Fixed bug in `DataFrameGroupBy` reductions not preserving object dtype when `infer_string` is set ([GH 55620](https://github.com/pandas-dev/pandas/issues/55620)) +* Fixed bug in [`SeriesGroupBy.value_counts()`](../reference/api/pandas.core.groupby.SeriesGroupBy.value_counts.html#pandas.core.groupby.SeriesGroupBy.value_counts "pandas.core.groupby.SeriesGroupBy.value_counts") returning incorrect dtype for string columns ([GH 55627](https://github.com/pandas-dev/pandas/issues/55627)) +* Fixed bug in `Categorical.equals()` if other has arrow backed string dtype ([GH 55364](https://github.com/pandas-dev/pandas/issues/55364)) +* Fixed bug in `DataFrame.__setitem__()` not inferring string dtype for zero-dimensional array with `infer_string=True` ([GH 55366](https://github.com/pandas-dev/pandas/issues/55366)) +* Fixed bug in [`DataFrame.idxmin()`](../reference/api/pandas.DataFrame.idxmin.html#pandas.DataFrame.idxmin "pandas.DataFrame.idxmin") and [`DataFrame.idxmax()`](../reference/api/pandas.DataFrame.idxmax.html#pandas.DataFrame.idxmax "pandas.DataFrame.idxmax") raising for arrow dtypes ([GH 55368](https://github.com/pandas-dev/pandas/issues/55368)) +* Fixed bug in [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") raising incorrect error message ([GH 55347](https://github.com/pandas-dev/pandas/issues/55347)) +* Fixed bug in [`Index.insert()`](../reference/api/pandas.Index.insert.html#pandas.Index.insert "pandas.Index.insert") raising when inserting `None` into [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with `dtype="string[pyarrow_numpy]"` ([GH 55365](https://github.com/pandas-dev/pandas/issues/55365)) +* Fixed bug in [`Series.all()`](../reference/api/pandas.Series.all.html#pandas.Series.all "pandas.Series.all") and [`Series.any()`](../reference/api/pandas.Series.any.html#pandas.Series.any "pandas.Series.any") not treating missing values correctly for `dtype="string[pyarrow_numpy]"` ([GH 55367](https://github.com/pandas-dev/pandas/issues/55367)) +* Fixed bug in [`Series.floordiv()`](../reference/api/pandas.Series.floordiv.html#pandas.Series.floordiv "pandas.Series.floordiv") for [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") ([GH 55561](https://github.com/pandas-dev/pandas/issues/55561)) +* Fixed bug in [`Series.mode()`](../reference/api/pandas.Series.mode.html#pandas.Series.mode "pandas.Series.mode") not sorting values for arrow backed string dtype ([GH 55621](https://github.com/pandas-dev/pandas/issues/55621)) +* Fixed bug in [`Series.rank()`](../reference/api/pandas.Series.rank.html#pandas.Series.rank "pandas.Series.rank") for `string[pyarrow_numpy]` dtype ([GH 55362](https://github.com/pandas-dev/pandas/issues/55362)) +* Fixed bug in [`Series.str.extractall()`](../reference/api/pandas.Series.str.extractall.html#pandas.Series.str.extractall "pandas.Series.str.extractall") for [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") dtype being converted to object ([GH 53846](https://github.com/pandas-dev/pandas/issues/53846)) +* Fixed bug where PDEP-6 warning about setting an item of an incompatible dtype was being shown when creating a new conditional column ([GH 55025](https://github.com/pandas-dev/pandas/issues/55025)) +* Silence `Period[B]` warnings introduced by [GH 53446](https://github.com/pandas-dev/pandas/issues/53446) during normal plotting activity ([GH 55138](https://github.com/pandas-dev/pandas/issues/55138)) +* Fixed bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructor not inferring string dtype when `NA` is the first value and `infer_string` is set (:issue:` 55655`) + +## Other[#](#other "Link to this heading") + +* Fixed non-working installation of optional dependency group `output_formatting`. Replacing underscore `_` with a dash `-` fixes broken dependency resolution. A correct way to use now is `pip install pandas[output-formatting]`. + +## Contributors[#](#contributors "Link to this heading") + +A total of 20 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Amanda Bizzinotto +* Artur Barseghyan + +* Hadi Abdi Khojasteh + +* Joris Van den Bossche +* Luke Manley +* Lumberbot (aka Jack) +* Marc Garcia +* Marco Edward Gorelli +* MarcoGorelli +* Mateusz Sokół +* Matthew Roeschke +* Natalia Mokeeva +* Pandas Development Team +* Patrick Hoefler +* Richard Shadrach +* Thomas Li +* Yao Xiao +* dependabot[bot] +* rohanjain101 + +* torext + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_2.1.3.md b/corpus/changelog/pandas_whatsnew/whatsnew_2.1.3.md new file mode 100644 index 0000000000000000000000000000000000000000..c0f6a85ae71498c1633376af5c57d319a8309753 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_2.1.3.md @@ -0,0 +1,35 @@ +# What's new in pandas 2.1.3 + +Source: https://pandas.pydata.org/docs/whatsnew/v2.1.3.html + +# What’s new in 2.1.3 (November 10, 2023)[#](#what-s-new-in-2-1-3-november-10-2023 "Link to this heading") + +These are the changes in pandas 2.1.3. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed infinite recursion from operations that return a new object on some DataFrame subclasses ([GH 55763](https://github.com/pandas-dev/pandas/issues/55763)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in `DatetimeIndex.diff()` raising `TypeError` ([GH 55080](https://github.com/pandas-dev/pandas/issues/55080)) +* Bug in [`Index.isin()`](../reference/api/pandas.Index.isin.html#pandas.Index.isin "pandas.Index.isin") raising for Arrow backed string and `None` value ([GH 55821](https://github.com/pandas-dev/pandas/issues/55821)) +* Fix [`read_parquet()`](../reference/api/pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") and [`read_feather()`](../reference/api/pandas.read_feather.html#pandas.read_feather "pandas.read_feather") for [CVE-2023-47248](https://www.cve.org/CVERecord?id=CVE-2023-47248) ([GH 55894](https://github.com/pandas-dev/pandas/issues/55894)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 11 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Isaac Virshup +* Joris Van den Bossche +* Luke Manley +* Lumberbot (aka Jack) +* Marco Edward Gorelli +* MarcoGorelli +* Matthew Roeschke +* Pandas Development Team +* Thomas Li +* William Ayd +* cobalt + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_2.1.4.md b/corpus/changelog/pandas_whatsnew/whatsnew_2.1.4.md new file mode 100644 index 0000000000000000000000000000000000000000..783ce261f9a5fddd4057f6cf9263234b7b9de6a9 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_2.1.4.md @@ -0,0 +1,48 @@ +# What's new in pandas 2.1.4 + +Source: https://pandas.pydata.org/docs/whatsnew/v2.1.4.html + +# What’s new in 2.1.4 (December 8, 2023)[#](#what-s-new-in-2-1-4-december-8-2023 "Link to this heading") + +These are the changes in pandas 2.1.4. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed regression when trying to read a pickled pandas [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") from pandas 1.3 ([GH 55137](https://github.com/pandas-dev/pandas/issues/55137)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructor raising DeprecationWarning when `index` is a list of [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") ([GH 55228](https://github.com/pandas-dev/pandas/issues/55228)) +* Bug in [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") when trying to cast date-like string inputs to [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") of `pyarrow.timestamp` ([GH 56266](https://github.com/pandas-dev/pandas/issues/56266)) +* Bug in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") construction with `ts_input="now"` or `ts_input="today"` giving a different unit from [`Timestamp.now()`](../reference/api/pandas.Timestamp.now.html#pandas.Timestamp.now "pandas.Timestamp.now") or [`Timestamp.today()`](../reference/api/pandas.Timestamp.today.html#pandas.Timestamp.today "pandas.Timestamp.today") ([GH 55879](https://github.com/pandas-dev/pandas/issues/55879)) +* Bug in `Index.__getitem__()` returning wrong result for Arrow dtypes and negative stepsize ([GH 55832](https://github.com/pandas-dev/pandas/issues/55832)) +* Fixed bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") not respecting object dtype when `infer_string` option is set ([GH 56047](https://github.com/pandas-dev/pandas/issues/56047)) +* Fixed bug in [`to_numeric()`](../reference/api/pandas.to_numeric.html#pandas.to_numeric "pandas.to_numeric") converting to extension dtype for `string[pyarrow_numpy]` dtype ([GH 56179](https://github.com/pandas-dev/pandas/issues/56179)) +* Fixed bug in [`DataFrameGroupBy.min()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.min.html#pandas.core.groupby.DataFrameGroupBy.min "pandas.core.groupby.DataFrameGroupBy.min") and [`DataFrameGroupBy.max()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.max.html#pandas.core.groupby.DataFrameGroupBy.max "pandas.core.groupby.DataFrameGroupBy.max") not preserving extension dtype for empty object ([GH 55619](https://github.com/pandas-dev/pandas/issues/55619)) +* Fixed bug in `DataFrame.__setitem__()` casting [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with object-dtype to PyArrow backed strings when `infer_string` option is set ([GH 55638](https://github.com/pandas-dev/pandas/issues/55638)) +* Fixed bug in [`DataFrame.to_hdf()`](../reference/api/pandas.DataFrame.to_hdf.html#pandas.DataFrame.to_hdf "pandas.DataFrame.to_hdf") raising when columns have `StringDtype` ([GH 55088](https://github.com/pandas-dev/pandas/issues/55088)) +* Fixed bug in [`Index.insert()`](../reference/api/pandas.Index.insert.html#pandas.Index.insert "pandas.Index.insert") casting object-dtype to PyArrow backed strings when `infer_string` option is set ([GH 55638](https://github.com/pandas-dev/pandas/issues/55638)) +* Fixed bug in `Series.__ne__()` resulting in False for comparison between `NA` and string value for `dtype="string[pyarrow_numpy]"` ([GH 56122](https://github.com/pandas-dev/pandas/issues/56122)) +* Fixed bug in [`Series.mode()`](../reference/api/pandas.Series.mode.html#pandas.Series.mode "pandas.Series.mode") not keeping object dtype when `infer_string` is set ([GH 56183](https://github.com/pandas-dev/pandas/issues/56183)) +* Fixed bug in [`Series.reset_index()`](../reference/api/pandas.Series.reset_index.html#pandas.Series.reset_index "pandas.Series.reset_index") not preserving object dtype when `infer_string` is set ([GH 56160](https://github.com/pandas-dev/pandas/issues/56160)) +* Fixed bug in [`Series.str.split()`](../reference/api/pandas.Series.str.split.html#pandas.Series.str.split "pandas.Series.str.split") and [`Series.str.rsplit()`](../reference/api/pandas.Series.str.rsplit.html#pandas.Series.str.rsplit "pandas.Series.str.rsplit") when `pat=None` for [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with `pyarrow.string` ([GH 56271](https://github.com/pandas-dev/pandas/issues/56271)) +* Fixed bug in [`Series.str.translate()`](../reference/api/pandas.Series.str.translate.html#pandas.Series.str.translate "pandas.Series.str.translate") losing object dtype when string option is set ([GH 56152](https://github.com/pandas-dev/pandas/issues/56152)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 12 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Daniel Isaac +* Joris Van den Bossche +* Luke Manley +* Lumberbot (aka Jack) +* Marco Edward Gorelli +* Matthew Roeschke +* Pandas Development Team +* Patrick Hoefler +* Thomas Li +* William Ayd +* Yao Xiao +* pre-commit-ci[bot] diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_2.2.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_2.2.0.md new file mode 100644 index 0000000000000000000000000000000000000000..b84329f5f150828ea0699a68ca021bbe92ce4d7e --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_2.2.0.md @@ -0,0 +1,1056 @@ +# What's new in pandas 2.2.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v2.2.0.html + +# What’s new in 2.2.0 (January 19, 2024)[#](#what-s-new-in-2-2-0-january-19-2024 "Link to this heading") + +These are the changes in pandas 2.2.0. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Upcoming changes in pandas 3.0[#](#upcoming-changes-in-pandas-3-0 "Link to this heading") + +pandas 3.0 will bring two bigger changes to the default behavior of pandas. + +### Copy-on-Write[#](#copy-on-write "Link to this heading") + +The currently optional mode Copy-on-Write will be enabled by default in pandas 3.0. There +won’t be an option to keep the current behavior enabled. The new behavioral semantics are +explained in the [user guide about Copy-on-Write](../user_guide/copy_on_write.html#copy-on-write). + +The new behavior can be enabled since pandas 2.0 with the following option: + +```None +pd.options.mode.copy_on_write = True +``` + +This change brings different changes in behavior in how pandas operates with respect to +copies and views. Some of these changes allow a clear deprecation, like the changes in +chained assignment. Other changes are more subtle and thus, the warnings are hidden behind +an option that can be enabled in pandas 2.2. + +```None +pd.options.mode.copy_on_write = "warn" +``` + +This mode will warn in many different scenarios that aren’t actually relevant to +most queries. We recommend exploring this mode, but it is not necessary to get rid +of all of these warnings. The [migration guide](../user_guide/copy_on_write.html#copy-on-write-migration-guide) +explains the upgrade process in more detail. + +### Dedicated string data type (backed by Arrow) by default[#](#dedicated-string-data-type-backed-by-arrow-by-default "Link to this heading") + +Historically, pandas represented string columns with NumPy object data type. This +representation has numerous problems, including slow performance and a large memory +footprint. This will change in pandas 3.0. pandas will start inferring string columns +as a new `string` data type, backed by Arrow, which represents strings contiguous in memory. This brings +a huge performance and memory improvement. + +Old behavior: + +```None +In [1]: ser = pd.Series(["a", "b"]) +Out[1]: +0 a +1 b +dtype: object +``` + +New behavior: + +```None +In [1]: ser = pd.Series(["a", "b"]) +Out[1]: +0 a +1 b +dtype: string +``` + +The string data type that is used in these scenarios will mostly behave as NumPy +object would, including missing value semantics and general operations on these +columns. + +This change includes a few additional changes across the API: + +* Currently, specifying `dtype="string"` creates a dtype that is backed by Python strings + which are stored in a NumPy array. This will change in pandas 3.0, this dtype + will create an Arrow backed string column. +* The column names and the Index will also be backed by Arrow strings. +* PyArrow will become a required dependency with pandas 3.0 to accommodate this change. + +This future dtype inference logic can be enabled with: + +```None +pd.options.future.infer_string = True +``` + +## Enhancements[#](#enhancements "Link to this heading") + +### ADBC Driver support in to\_sql and read\_sql[#](#adbc-driver-support-in-to-sql-and-read-sql "Link to this heading") + +[`read_sql()`](../reference/api/pandas.read_sql.html#pandas.read_sql "pandas.read_sql") and [`to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") now work with [Apache Arrow ADBC](https://arrow.apache.org/adbc/current/index.html) drivers. Compared to +traditional drivers used via SQLAlchemy, ADBC drivers should provide +significant performance improvements, better type support and cleaner +nullability handling. + +```None +import adbc_driver_postgresql.dbapi as pg_dbapi + +df = pd.DataFrame( + [ + [1, 2, 3], + [4, 5, 6], + ], + columns=['a', 'b', 'c'] +) +uri = "postgresql://postgres:postgres@localhost/postgres" +with pg_dbapi.connect(uri) as conn: + df.to_sql("pandas_table", conn, index=False) + +# for round-tripping +with pg_dbapi.connect(uri) as conn: + df2 = pd.read_sql("pandas_table", conn) +``` + +The Arrow type system offers a wider array of types that can more closely match +what databases like PostgreSQL can offer. To illustrate, note this (non-exhaustive) +listing of types available in different databases and pandas backends: + +| numpy/pandas | arrow | postgres | sqlite | +| --- | --- | --- | --- | +| int16/Int16 | int16 | SMALLINT | INTEGER | +| int32/Int32 | int32 | INTEGER | INTEGER | +| int64/Int64 | int64 | BIGINT | INTEGER | +| float32 | float32 | REAL | REAL | +| float64 | float64 | DOUBLE PRECISION | REAL | +| object | string | TEXT | TEXT | +| bool | `bool_` | BOOLEAN | | +| datetime64[ns] | timestamp(us) | TIMESTAMP | | +| datetime64[ns,tz] | timestamp(us,tz) | TIMESTAMPTZ | | +| | date32 | DATE | | +| | month\_day\_nano\_interval | INTERVAL | | +| | binary | BINARY | BLOB | +| | decimal128 | DECIMAL [[1]](#f1) | | +| | list | ARRAY [[1]](#f1) | | +| | struct | COMPOSITE TYPE [[1]](#f1) | | + +Footnotes + +[1] +([1](#id1),[2](#id2),[3](#id3)) + +Not implemented as of writing, but theoretically possible + +If you are interested in preserving database types as best as possible +throughout the lifecycle of your DataFrame, users are encouraged to +leverage the `dtype_backend="pyarrow"` argument of [`read_sql()`](../reference/api/pandas.read_sql.html#pandas.read_sql "pandas.read_sql") + +```None +# for round-tripping +with pg_dbapi.connect(uri) as conn: + df2 = pd.read_sql("pandas_table", conn, dtype_backend="pyarrow") +``` + +This will prevent your data from being converted to the traditional pandas/NumPy +type system, which often converts SQL types in ways that make them impossible to +round-trip. + +For a full list of ADBC drivers and their development status, see the [ADBC Driver +Implementation Status](https://arrow.apache.org/adbc/current/driver/status.html) +documentation. + +### Create a pandas Series based on one or more conditions[#](#create-a-pandas-series-based-on-one-or-more-conditions "Link to this heading") + +The [`Series.case_when()`](../reference/api/pandas.Series.case_when.html#pandas.Series.case_when "pandas.Series.case_when") function has been added to create a Series object based on one or more conditions. ([GH 39154](https://github.com/pandas-dev/pandas/issues/39154)) + +```None +In [1]: import pandas as pd + +In [2]: df = pd.DataFrame(dict(a=[1, 2, 3], b=[4, 5, 6])) + +In [3]: default=pd.Series('default', index=df.index) + +In [4]: default.case_when( + ...: caselist=[ + ...: (df.a == 1, 'first'), # condition, replacement + ...: (df.a.gt(1) & df.b.eq(5), 'second'), # condition, replacement + ...: ], + ...: ) + ...: +Out[4]: +0 first +1 second +2 default +dtype: object +``` + +### `to_numpy` for NumPy nullable and Arrow types converts to suitable NumPy dtype[#](#to-numpy-for-numpy-nullable-and-arrow-types-converts-to-suitable-numpy-dtype "Link to this heading") + +`to_numpy` for NumPy nullable and Arrow types will now convert to a +suitable NumPy dtype instead of `object` dtype for nullable and PyArrow backed extension dtypes. + +*Old behavior:* + +```None +In [1]: ser = pd.Series([1, 2, 3], dtype="Int64") +In [2]: ser.to_numpy() +Out[2]: array([1, 2, 3], dtype=object) +``` + +*New behavior:* + +```None +In [5]: ser = pd.Series([1, 2, 3], dtype="Int64") + +In [6]: ser.to_numpy() +Out[6]: array([1, 2, 3]) + +In [7]: ser = pd.Series([1, 2, 3], dtype="timestamp[ns][pyarrow]") + +In [8]: ser.to_numpy() +Out[8]: +array(['1970-01-01T00:00:00.000000001', '1970-01-01T00:00:00.000000002', + '1970-01-01T00:00:00.000000003'], dtype='datetime64[ns]') +``` + +The default NumPy dtype (without any arguments) is determined as follows: + +* float dtypes are cast to NumPy floats +* integer dtypes without missing values are cast to NumPy integer dtypes +* integer dtypes with missing values are cast to NumPy float dtypes and `NaN` is used as missing value indicator +* boolean dtypes without missing values are cast to NumPy bool dtype +* boolean dtypes with missing values keep object dtype +* datetime and timedelta types are cast to Numpy datetime64 and timedelta64 types respectively and `NaT` is used as missing value indicator + +### Series.struct accessor for PyArrow structured data[#](#series-struct-accessor-for-pyarrow-structured-data "Link to this heading") + +The `Series.struct` accessor provides attributes and methods for processing +data with `struct[pyarrow]` dtype Series. For example, +[`Series.struct.explode()`](../reference/api/pandas.Series.struct.explode.html#pandas.Series.struct.explode "pandas.Series.struct.explode") converts PyArrow structured data to a pandas +DataFrame. ([GH 54938](https://github.com/pandas-dev/pandas/issues/54938)) + +```None +In [9]: import pyarrow as pa + +In [10]: series = pd.Series( + ....: [ + ....: {"project": "pandas", "version": "2.2.0"}, + ....: {"project": "numpy", "version": "1.25.2"}, + ....: {"project": "pyarrow", "version": "13.0.0"}, + ....: ], + ....: dtype=pd.ArrowDtype( + ....: pa.struct([ + ....: ("project", pa.string()), + ....: ("version", pa.string()), + ....: ]) + ....: ), + ....: ) + ....: + +In [11]: series.struct.explode() +Out[11]: + project version +0 pandas 2.2.0 +1 numpy 1.25.2 +2 pyarrow 13.0.0 +``` + +Use [`Series.struct.field()`](../reference/api/pandas.Series.struct.field.html#pandas.Series.struct.field "pandas.Series.struct.field") to index into a (possible nested) +struct field. + +```None +In [12]: series.struct.field("project") +Out[12]: +0 pandas +1 numpy +2 pyarrow +Name: project, dtype: string[pyarrow] +``` + +### Series.list accessor for PyArrow list data[#](#series-list-accessor-for-pyarrow-list-data "Link to this heading") + +The `Series.list` accessor provides attributes and methods for processing +data with `list[pyarrow]` dtype Series. For example, +[`Series.list.__getitem__()`](../reference/api/pandas.Series.list.__getitem__.html#pandas.Series.list.__getitem__ "pandas.Series.list.__getitem__") allows indexing pyarrow lists in +a Series. ([GH 55323](https://github.com/pandas-dev/pandas/issues/55323)) + +```None +In [13]: import pyarrow as pa + +In [14]: series = pd.Series( + ....: [ + ....: [1, 2, 3], + ....: [4, 5], + ....: [6], + ....: ], + ....: dtype=pd.ArrowDtype( + ....: pa.list_(pa.int64()) + ....: ), + ....: ) + ....: + +In [15]: series.list[0] +Out[15]: +0 1 +1 4 +2 6 +dtype: int64[pyarrow] +``` + +### Calamine engine for [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel")[#](#calamine-engine-for-read-excel "Link to this heading") + +The `calamine` engine was added to [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel"). +It uses `python-calamine`, which provides Python bindings for the Rust library [calamine](https://crates.io/crates/calamine). +This engine supports Excel files (`.xlsx`, `.xlsm`, `.xls`, `.xlsb`) and OpenDocument spreadsheets (`.ods`) ([GH 50395](https://github.com/pandas-dev/pandas/issues/50395)). + +There are two advantages of this engine: + +1. Calamine is often faster than other engines, some benchmarks show results up to 5x faster than ‘openpyxl’, 20x - ‘odf’, 4x - ‘pyxlsb’, and 1.5x - ‘xlrd’. + But, ‘openpyxl’ and ‘pyxlsb’ are faster in reading a few rows from large files because of lazy iteration over rows. +2. Calamine supports the recognition of datetime in `.xlsb` files, unlike ‘pyxlsb’ which is the only other engine in pandas that can read `.xlsb` files. + +```None +pd.read_excel("path_to_file.xlsb", engine="calamine") +``` + +For more, see [Calamine (Excel and ODS files)](../user_guide/io.html#io-calamine) in the user guide on IO tools. + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* [`to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") with method parameter set to `multi` works with Oracle on the backend +* [`Series.attrs`](../reference/api/pandas.Series.attrs.html#pandas.Series.attrs "pandas.Series.attrs") / [`DataFrame.attrs`](../reference/api/pandas.DataFrame.attrs.html#pandas.DataFrame.attrs "pandas.DataFrame.attrs") now uses a deepcopy for propagating `attrs` ([GH 54134](https://github.com/pandas-dev/pandas/issues/54134)). +* [`get_dummies()`](../reference/api/pandas.get_dummies.html#pandas.get_dummies "pandas.get_dummies") now returning extension dtypes `boolean` or `bool[pyarrow]` that are compatible with the input dtype ([GH 56273](https://github.com/pandas-dev/pandas/issues/56273)) +* [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") now supports `on_bad_lines` parameter with `engine="pyarrow"` ([GH 54480](https://github.com/pandas-dev/pandas/issues/54480)) +* [`read_sas()`](../reference/api/pandas.read_sas.html#pandas.read_sas "pandas.read_sas") returns `datetime64` dtypes with resolutions better matching those stored natively in SAS, and avoids returning object-dtype in cases that cannot be stored with `datetime64[ns]` dtype ([GH 56127](https://github.com/pandas-dev/pandas/issues/56127)) +* [`read_spss()`](../reference/api/pandas.read_spss.html#pandas.read_spss "pandas.read_spss") now returns a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") that stores the metadata in [`DataFrame.attrs`](../reference/api/pandas.DataFrame.attrs.html#pandas.DataFrame.attrs "pandas.DataFrame.attrs") ([GH 54264](https://github.com/pandas-dev/pandas/issues/54264)) +* [`tseries.api.guess_datetime_format()`](../reference/api/pandas.tseries.api.guess_datetime_format.html#pandas.tseries.api.guess_datetime_format "pandas.tseries.api.guess_datetime_format") is now part of the public API ([GH 54727](https://github.com/pandas-dev/pandas/issues/54727)) +* [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") now allows the usage of numba (via `engine="numba"`) to JIT compile the passed function, allowing for potential speedups ([GH 54666](https://github.com/pandas-dev/pandas/issues/54666)) +* `ExtensionArray._explode()` interface method added to allow extension type implementations of the `explode` method ([GH 54833](https://github.com/pandas-dev/pandas/issues/54833)) +* `ExtensionArray.duplicated()` added to allow extension type implementations of the `duplicated` method ([GH 55255](https://github.com/pandas-dev/pandas/issues/55255)) +* [`Series.ffill()`](../reference/api/pandas.Series.ffill.html#pandas.Series.ffill "pandas.Series.ffill"), [`Series.bfill()`](../reference/api/pandas.Series.bfill.html#pandas.Series.bfill "pandas.Series.bfill"), [`DataFrame.ffill()`](../reference/api/pandas.DataFrame.ffill.html#pandas.DataFrame.ffill "pandas.DataFrame.ffill"), and [`DataFrame.bfill()`](../reference/api/pandas.DataFrame.bfill.html#pandas.DataFrame.bfill "pandas.DataFrame.bfill") have gained the argument `limit_area`; 3rd party [`ExtensionArray`](../reference/api/pandas.api.extensions.ExtensionArray.html#pandas.api.extensions.ExtensionArray "pandas.api.extensions.ExtensionArray") authors need to add this argument to the method `_pad_or_backfill` ([GH 56492](https://github.com/pandas-dev/pandas/issues/56492)) +* Allow passing `read_only`, `data_only` and `keep_links` arguments to openpyxl using `engine_kwargs` of [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") ([GH 55027](https://github.com/pandas-dev/pandas/issues/55027)) +* Implement [`Series.interpolate()`](../reference/api/pandas.Series.interpolate.html#pandas.Series.interpolate "pandas.Series.interpolate") and [`DataFrame.interpolate()`](../reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate") for [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") and masked dtypes ([GH 56267](https://github.com/pandas-dev/pandas/issues/56267)) +* Implement masked algorithms for [`Series.value_counts()`](../reference/api/pandas.Series.value_counts.html#pandas.Series.value_counts "pandas.Series.value_counts") ([GH 54984](https://github.com/pandas-dev/pandas/issues/54984)) +* Implemented [`Series.dt()`](../reference/api/pandas.Series.dt.html#pandas.Series.dt "pandas.Series.dt") methods and attributes for [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with `pyarrow.duration` type ([GH 52284](https://github.com/pandas-dev/pandas/issues/52284)) +* Implemented [`Series.str.extract()`](../reference/api/pandas.Series.str.extract.html#pandas.Series.str.extract "pandas.Series.str.extract") for [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") ([GH 56268](https://github.com/pandas-dev/pandas/issues/56268)) +* Improved error message that appears in [`DatetimeIndex.to_period()`](../reference/api/pandas.DatetimeIndex.to_period.html#pandas.DatetimeIndex.to_period "pandas.DatetimeIndex.to_period") with frequencies which are not supported as period frequencies, such as `"BMS"` ([GH 56243](https://github.com/pandas-dev/pandas/issues/56243)) +* Improved error message when constructing [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") with invalid offsets such as `"QS"` ([GH 55785](https://github.com/pandas-dev/pandas/issues/55785)) +* The dtypes `string[pyarrow]` and `string[pyarrow_numpy]` now both utilize the `large_string` type from PyArrow to avoid overflow for long columns ([GH 56259](https://github.com/pandas-dev/pandas/issues/56259)) + +## Notable bug fixes[#](#notable-bug-fixes "Link to this heading") + +These are bug fixes that might have notable behavior changes. + +### [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") and [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") now consistently follow documented sort behavior[#](#merge-and-dataframe-join-now-consistently-follow-documented-sort-behavior "Link to this heading") + +In previous versions of pandas, [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") and [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") did not +always return a result that followed the documented sort behavior. pandas now +follows the documented sort behavior in merge and join operations ([GH 54611](https://github.com/pandas-dev/pandas/issues/54611), [GH 56426](https://github.com/pandas-dev/pandas/issues/56426), [GH 56443](https://github.com/pandas-dev/pandas/issues/56443)). + +As documented, `sort=True` sorts the join keys lexicographically in the resulting +[`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame"). With `sort=False`, the order of the join keys depends on the +join type (`how` keyword): + +* `how="left"`: preserve the order of the left keys +* `how="right"`: preserve the order of the right keys +* `how="inner"`: preserve the order of the left keys +* `how="outer"`: sort keys lexicographically + +One example with changing behavior is inner joins with non-unique left join keys +and `sort=False`: + +```None +In [16]: left = pd.DataFrame({"a": [1, 2, 1]}) + +In [17]: right = pd.DataFrame({"a": [1, 2]}) + +In [18]: result = pd.merge(left, right, how="inner", on="a", sort=False) +``` + +*Old Behavior* + +```None +In [5]: result +Out[5]: + a +0 1 +1 1 +2 2 +``` + +*New Behavior* + +```None +In [19]: result +Out[19]: + a +0 1 +1 2 +2 1 +``` + +### [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") and [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") no longer reorder levels when levels differ[#](#merge-and-dataframe-join-no-longer-reorder-levels-when-levels-differ "Link to this heading") + +In previous versions of pandas, [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") and [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") would reorder +index levels when joining on two indexes with different levels ([GH 34133](https://github.com/pandas-dev/pandas/issues/34133)). + +```None +In [20]: left = pd.DataFrame({"left": 1}, index=pd.MultiIndex.from_tuples([("x", 1), ("x", 2)], names=["A", "B"])) + +In [21]: right = pd.DataFrame({"right": 2}, index=pd.MultiIndex.from_tuples([(1, 1), (2, 2)], names=["B", "C"])) + +In [22]: left +Out[22]: + left +A B +x 1 1 + 2 1 + +In [23]: right +Out[23]: + right +B C +1 1 2 +2 2 2 + +In [24]: result = left.join(right) +``` + +*Old Behavior* + +```None +In [5]: result +Out[5]: + left right +B A C +1 x 1 1 2 +2 x 2 1 2 +``` + +*New Behavior* + +```None +In [25]: result +Out[25]: + left right +A B C +x 1 1 1 2 + 2 2 1 2 +``` + +### Increased minimum versions for dependencies[#](#increased-minimum-versions-for-dependencies "Link to this heading") + +For [optional dependencies](https://pandas.pydata.org/docs/getting_started/install.html) the general recommendation is to use the latest version. +Optional dependencies below the lowest tested version may still work but are not considered supported. +The following table lists the optional dependencies that have had their minimum tested version increased. + +| Package | New Minimum Version | +| --- | --- | +| beautifulsoup4 | 4.11.2 | +| blosc | 1.21.3 | +| bottleneck | 1.3.6 | +| fastparquet | 2022.12.0 | +| fsspec | 2022.11.0 | +| gcsfs | 2022.11.0 | +| lxml | 4.9.2 | +| matplotlib | 3.6.3 | +| numba | 0.56.4 | +| numexpr | 2.8.4 | +| qtpy | 2.3.0 | +| openpyxl | 3.1.0 | +| psycopg2 | 2.9.6 | +| pyreadstat | 1.2.0 | +| pytables | 3.8.0 | +| pyxlsb | 1.0.10 | +| s3fs | 2022.11.0 | +| scipy | 1.10.0 | +| sqlalchemy | 2.0.0 | +| tabulate | 0.9.0 | +| xarray | 2022.12.0 | +| xlsxwriter | 3.0.5 | +| zstandard | 0.19.0 | +| pyqt5 | 5.15.8 | +| tzdata | 2022.7 | + +See [Dependencies](../getting_started/install.html#install-dependencies) and [Optional dependencies](../getting_started/install.html#install-optional-dependencies) for more. + +### Other API changes[#](#other-api-changes "Link to this heading") + +* The hash values of nullable extension dtypes changed to improve the performance of the hashing operation ([GH 56507](https://github.com/pandas-dev/pandas/issues/56507)) +* `check_exact` now only takes effect for floating-point dtypes in [`testing.assert_frame_equal()`](../reference/api/pandas.testing.assert_frame_equal.html#pandas.testing.assert_frame_equal "pandas.testing.assert_frame_equal") and [`testing.assert_series_equal()`](../reference/api/pandas.testing.assert_series_equal.html#pandas.testing.assert_series_equal "pandas.testing.assert_series_equal"). In particular, integer dtypes are always checked exactly ([GH 55882](https://github.com/pandas-dev/pandas/issues/55882)) + +## Deprecations[#](#deprecations "Link to this heading") + +### Chained assignment[#](#chained-assignment "Link to this heading") + +In preparation of larger upcoming changes to the copy / view behaviour in pandas 3.0 +([Copy-on-Write (CoW)](../user_guide/copy_on_write.html#copy-on-write), PDEP-7), we started deprecating *chained assignment*. + +Chained assignment occurs when you try to update a pandas DataFrame or Series through +two subsequent indexing operations. Depending on the type and order of those operations +this currently does or does not work. + +A typical example is as follows: + +```None +df = pd.DataFrame({"foo": [1, 2, 3], "bar": [4, 5, 6]}) + +# first selecting rows with a mask, then assigning values to a column +# -> this has never worked and raises a SettingWithCopyWarning +df[df["bar"] > 5]["foo"] = 100 + +# first selecting the column, and then assigning to a subset of that column +# -> this currently works +df["foo"][df["bar"] > 5] = 100 +``` + +This second example of chained assignment currently works to update the original `df`. +This will no longer work in pandas 3.0, and therefore we started deprecating this: + +```None +>>> df["foo"][df["bar"] > 5] = 100 +FutureWarning: ChainedAssignmentError: behaviour will change in pandas 3.0! +You are setting values through chained assignment. Currently this works in certain cases, but when using Copy-on-Write (which will become the default behaviour in pandas 3.0) this will never work to update the original DataFrame or Series, because the intermediate object on which we are setting values will behave as a copy. +A typical example is when you are setting values in a column of a DataFrame, like: + +df["col"][row_indexer] = value + +Use `df.loc[row_indexer, "col"] = values` instead, to perform the assignment in a single step and ensure this keeps updating the original `df`. + +See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy +``` + +You can fix this warning and ensure your code is ready for pandas 3.0 by removing +the usage of chained assignment. Typically, this can be done by doing the assignment +in a single step using for example `.loc`. For the example above, we can do: + +```None +df.loc[df["bar"] > 5, "foo"] = 100 +``` + +The same deprecation applies to inplace methods that are done in a chained manner, such as: + +```None +>>> df["foo"].fillna(0, inplace=True) +FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method. +The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy. + +For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object. +``` + +When the goal is to update the column in the DataFrame `df`, the alternative here is +to call the method on `df` itself, such as `df.fillna({"foo": 0}, inplace=True)`. + +See more details in the [migration guide](../user_guide/copy_on_write.html#copy-on-write-migration-guide). + +### Deprecate aliases `M`, `Q`, `Y`, etc. in favour of `ME`, `QE`, `YE`, etc. for offsets[#](#deprecate-aliases-m-q-y-etc-in-favour-of-me-qe-ye-etc-for-offsets "Link to this heading") + +Deprecated the following frequency aliases ([GH 9586](https://github.com/pandas-dev/pandas/issues/9586)): + +| offsets | deprecated aliases | new aliases | +| --- | --- | --- | +| `MonthEnd` | `M` | `ME` | +| `BusinessMonthEnd` | `BM` | `BME` | +| `SemiMonthEnd` | `SM` | `SME` | +| `CustomBusinessMonthEnd` | `CBM` | `CBME` | +| `QuarterEnd` | `Q` | `QE` | +| `BQuarterEnd` | `BQ` | `BQE` | +| `YearEnd` | `Y` | `YE` | +| `BYearEnd` | `BY` | `BYE` | + +For example: + +*Previous behavior*: + +```None +In [8]: pd.date_range('2020-01-01', periods=3, freq='Q-NOV') +Out[8]: +DatetimeIndex(['2020-02-29', '2020-05-31', '2020-08-31'], + dtype='datetime64[ns]', freq='Q-NOV') +``` + +*Future behavior*: + +```None +In [26]: pd.date_range('2020-01-01', periods=3, freq='QE-NOV') +Out[26]: DatetimeIndex(['2020-02-29', '2020-05-31', '2020-08-31'], dtype='datetime64[ns]', freq='QE-NOV') +``` + +### Deprecated automatic downcasting[#](#deprecated-automatic-downcasting "Link to this heading") + +Deprecated the automatic downcasting of object dtype results in a number of +methods. These would silently change the dtype in a hard to predict manner since the +behavior was value dependent. Additionally, pandas is moving away from silent dtype +changes ([GH 54710](https://github.com/pandas-dev/pandas/issues/54710), [GH 54261](https://github.com/pandas-dev/pandas/issues/54261)). + +These methods are: + +* [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") and [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") +* [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna"), [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") +* [`DataFrame.ffill()`](../reference/api/pandas.DataFrame.ffill.html#pandas.DataFrame.ffill "pandas.DataFrame.ffill"), [`Series.ffill()`](../reference/api/pandas.Series.ffill.html#pandas.Series.ffill "pandas.Series.ffill") +* [`DataFrame.bfill()`](../reference/api/pandas.DataFrame.bfill.html#pandas.DataFrame.bfill "pandas.DataFrame.bfill"), [`Series.bfill()`](../reference/api/pandas.Series.bfill.html#pandas.Series.bfill "pandas.Series.bfill") +* [`DataFrame.mask()`](../reference/api/pandas.DataFrame.mask.html#pandas.DataFrame.mask "pandas.DataFrame.mask"), [`Series.mask()`](../reference/api/pandas.Series.mask.html#pandas.Series.mask "pandas.Series.mask") +* [`DataFrame.where()`](../reference/api/pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where"), [`Series.where()`](../reference/api/pandas.Series.where.html#pandas.Series.where "pandas.Series.where") +* [`DataFrame.clip()`](../reference/api/pandas.DataFrame.clip.html#pandas.DataFrame.clip "pandas.DataFrame.clip"), [`Series.clip()`](../reference/api/pandas.Series.clip.html#pandas.Series.clip "pandas.Series.clip") + +Explicitly call [`DataFrame.infer_objects()`](../reference/api/pandas.DataFrame.infer_objects.html#pandas.DataFrame.infer_objects "pandas.DataFrame.infer_objects") to replicate the current behavior in the future. + +```None +result = result.infer_objects(copy=False) +``` + +Or explicitly cast all-round floats to ints using `astype`. + +Set the following option to opt into the future behavior: + +```None +In [9]: pd.set_option("future.no_silent_downcasting", True) +``` + +### Other Deprecations[#](#other-deprecations "Link to this heading") + +* Changed `Timedelta.resolution_string()` to return `h`, `min`, `s`, `ms`, `us`, and `ns` instead of `H`, `T`, `S`, `L`, `U`, and `N`, for compatibility with respective deprecations in frequency aliases ([GH 52536](https://github.com/pandas-dev/pandas/issues/52536)) +* Deprecated `offsets.Day.delta`, `offsets.Hour.delta`, `offsets.Minute.delta`, `offsets.Second.delta`, `offsets.Milli.delta`, `offsets.Micro.delta`, `offsets.Nano.delta`, use `pd.Timedelta(obj)` instead ([GH 55498](https://github.com/pandas-dev/pandas/issues/55498)) +* Deprecated [`pandas.api.types.is_interval()`](../reference/api/pandas.api.types.is_interval.html#pandas.api.types.is_interval "pandas.api.types.is_interval") and `pandas.api.types.is_period()`, use `isinstance(obj, pd.Interval)` and `isinstance(obj, pd.Period)` instead ([GH 55264](https://github.com/pandas-dev/pandas/issues/55264)) +* Deprecated [`read_gbq()`](../reference/api/pandas.read_gbq.html#pandas.read_gbq "pandas.read_gbq") and [`DataFrame.to_gbq()`](../reference/api/pandas.DataFrame.to_gbq.html#pandas.DataFrame.to_gbq "pandas.DataFrame.to_gbq"). Use `pandas_gbq.read_gbq` and `pandas_gbq.to_gbq` instead ([GH 55525](https://github.com/pandas-dev/pandas/issues/55525)) +* Deprecated [`DataFrameGroupBy.fillna()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.fillna.html#pandas.core.groupby.DataFrameGroupBy.fillna "pandas.core.groupby.DataFrameGroupBy.fillna") and [`SeriesGroupBy.fillna()`](../reference/api/pandas.core.groupby.SeriesGroupBy.fillna.html#pandas.core.groupby.SeriesGroupBy.fillna "pandas.core.groupby.SeriesGroupBy.fillna"); use [`DataFrameGroupBy.ffill()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.ffill.html#pandas.core.groupby.DataFrameGroupBy.ffill "pandas.core.groupby.DataFrameGroupBy.ffill"), [`DataFrameGroupBy.bfill()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.bfill.html#pandas.core.groupby.DataFrameGroupBy.bfill "pandas.core.groupby.DataFrameGroupBy.bfill") for forward and backward filling or [`DataFrame.fillna()`](../reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") to fill with a single value (or the Series equivalents) ([GH 55718](https://github.com/pandas-dev/pandas/issues/55718)) +* Deprecated `DateOffset.is_anchored()`, use `obj.n == 1` for non-Tick subclasses (for Tick this was always False) ([GH 55388](https://github.com/pandas-dev/pandas/issues/55388)) +* Deprecated `DatetimeArray.__init__()` and `TimedeltaArray.__init__()`, use [`array()`](../reference/api/pandas.array.html#pandas.array "pandas.array") instead ([GH 55623](https://github.com/pandas-dev/pandas/issues/55623)) +* Deprecated `Index.format()`, use `index.astype(str)` or `index.map(formatter)` instead ([GH 55413](https://github.com/pandas-dev/pandas/issues/55413)) +* Deprecated [`Series.ravel()`](../reference/api/pandas.Series.ravel.html#pandas.Series.ravel "pandas.Series.ravel"), the underlying array is already 1D, so ravel is not necessary ([GH 52511](https://github.com/pandas-dev/pandas/issues/52511)) +* Deprecated [`Series.resample()`](../reference/api/pandas.Series.resample.html#pandas.Series.resample "pandas.Series.resample") and [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") with a [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") (and the ‘convention’ keyword), convert to [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") (with `.to_timestamp()`) before resampling instead ([GH 53481](https://github.com/pandas-dev/pandas/issues/53481)). Note: this deprecation was later undone in pandas 2.3.3 ([GH 57033](https://github.com/pandas-dev/pandas/issues/57033)) +* Deprecated [`Series.view()`](../reference/api/pandas.Series.view.html#pandas.Series.view "pandas.Series.view"), use [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") instead to change the dtype ([GH 20251](https://github.com/pandas-dev/pandas/issues/20251)) +* Deprecated `offsets.Tick.is_anchored()`, use `False` instead ([GH 55388](https://github.com/pandas-dev/pandas/issues/55388)) +* Deprecated `core.internals` members `Block`, `ExtensionBlock`, and `DatetimeTZBlock`, use public APIs instead ([GH 55139](https://github.com/pandas-dev/pandas/issues/55139)) +* Deprecated `year`, `month`, `quarter`, `day`, `hour`, `minute`, and `second` keywords in the [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") constructor, use [`PeriodIndex.from_fields()`](../reference/api/pandas.PeriodIndex.from_fields.html#pandas.PeriodIndex.from_fields "pandas.PeriodIndex.from_fields") instead ([GH 55960](https://github.com/pandas-dev/pandas/issues/55960)) +* Deprecated accepting a type as an argument in [`Index.view()`](../reference/api/pandas.Index.view.html#pandas.Index.view "pandas.Index.view"), call without any arguments instead ([GH 55709](https://github.com/pandas-dev/pandas/issues/55709)) +* Deprecated allowing non-integer `periods` argument in [`date_range()`](../reference/api/pandas.date_range.html#pandas.date_range "pandas.date_range"), [`timedelta_range()`](../reference/api/pandas.timedelta_range.html#pandas.timedelta_range "pandas.timedelta_range"), [`period_range()`](../reference/api/pandas.period_range.html#pandas.period_range "pandas.period_range"), and [`interval_range()`](../reference/api/pandas.interval_range.html#pandas.interval_range "pandas.interval_range") ([GH 56036](https://github.com/pandas-dev/pandas/issues/56036)) +* Deprecated allowing non-keyword arguments in [`DataFrame.to_clipboard()`](../reference/api/pandas.DataFrame.to_clipboard.html#pandas.DataFrame.to_clipboard "pandas.DataFrame.to_clipboard") ([GH 54229](https://github.com/pandas-dev/pandas/issues/54229)) +* Deprecated allowing non-keyword arguments in [`DataFrame.to_csv()`](../reference/api/pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") except `path_or_buf` ([GH 54229](https://github.com/pandas-dev/pandas/issues/54229)) +* Deprecated allowing non-keyword arguments in [`DataFrame.to_dict()`](../reference/api/pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict") ([GH 54229](https://github.com/pandas-dev/pandas/issues/54229)) +* Deprecated allowing non-keyword arguments in [`DataFrame.to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel") except `excel_writer` ([GH 54229](https://github.com/pandas-dev/pandas/issues/54229)) +* Deprecated allowing non-keyword arguments in [`DataFrame.to_gbq()`](../reference/api/pandas.DataFrame.to_gbq.html#pandas.DataFrame.to_gbq "pandas.DataFrame.to_gbq") except `destination_table` ([GH 54229](https://github.com/pandas-dev/pandas/issues/54229)) +* Deprecated allowing non-keyword arguments in [`DataFrame.to_hdf()`](../reference/api/pandas.DataFrame.to_hdf.html#pandas.DataFrame.to_hdf "pandas.DataFrame.to_hdf") except `path_or_buf` ([GH 54229](https://github.com/pandas-dev/pandas/issues/54229)) +* Deprecated allowing non-keyword arguments in [`DataFrame.to_html()`](../reference/api/pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html") except `buf` ([GH 54229](https://github.com/pandas-dev/pandas/issues/54229)) +* Deprecated allowing non-keyword arguments in [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") except `path_or_buf` ([GH 54229](https://github.com/pandas-dev/pandas/issues/54229)) +* Deprecated allowing non-keyword arguments in [`DataFrame.to_latex()`](../reference/api/pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex") except `buf` ([GH 54229](https://github.com/pandas-dev/pandas/issues/54229)) +* Deprecated allowing non-keyword arguments in [`DataFrame.to_markdown()`](../reference/api/pandas.DataFrame.to_markdown.html#pandas.DataFrame.to_markdown "pandas.DataFrame.to_markdown") except `buf` ([GH 54229](https://github.com/pandas-dev/pandas/issues/54229)) +* Deprecated allowing non-keyword arguments in [`DataFrame.to_parquet()`](../reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet") except `path` ([GH 54229](https://github.com/pandas-dev/pandas/issues/54229)) +* Deprecated allowing non-keyword arguments in [`DataFrame.to_pickle()`](../reference/api/pandas.DataFrame.to_pickle.html#pandas.DataFrame.to_pickle "pandas.DataFrame.to_pickle") except `path` ([GH 54229](https://github.com/pandas-dev/pandas/issues/54229)) +* Deprecated allowing non-keyword arguments in [`DataFrame.to_string()`](../reference/api/pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string") except `buf` ([GH 54229](https://github.com/pandas-dev/pandas/issues/54229)) +* Deprecated allowing non-keyword arguments in [`DataFrame.to_xml()`](../reference/api/pandas.DataFrame.to_xml.html#pandas.DataFrame.to_xml "pandas.DataFrame.to_xml") except `path_or_buffer` ([GH 54229](https://github.com/pandas-dev/pandas/issues/54229)) +* Deprecated allowing passing `BlockManager` objects to [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") or `SingleBlockManager` objects to [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") ([GH 52419](https://github.com/pandas-dev/pandas/issues/52419)) +* Deprecated behavior of [`Index.insert()`](../reference/api/pandas.Index.insert.html#pandas.Index.insert "pandas.Index.insert") with an object-dtype index silently performing type inference on the result, explicitly call `result.infer_objects(copy=False)` for the old behavior instead ([GH 51363](https://github.com/pandas-dev/pandas/issues/51363)) +* Deprecated casting non-datetimelike values (mainly strings) in [`Series.isin()`](../reference/api/pandas.Series.isin.html#pandas.Series.isin "pandas.Series.isin") and [`Index.isin()`](../reference/api/pandas.Index.isin.html#pandas.Index.isin "pandas.Index.isin") with `datetime64`, `timedelta64`, and [`PeriodDtype`](../reference/api/pandas.PeriodDtype.html#pandas.PeriodDtype "pandas.PeriodDtype") dtypes ([GH 53111](https://github.com/pandas-dev/pandas/issues/53111)) +* Deprecated dtype inference in [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") and [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") constructors when giving a pandas input, call `.infer_objects` on the input to keep the current behavior ([GH 56012](https://github.com/pandas-dev/pandas/issues/56012)) +* Deprecated dtype inference when setting a [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") into a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame"), cast explicitly instead ([GH 56102](https://github.com/pandas-dev/pandas/issues/56102)) +* Deprecated including the groups in computations when using [`DataFrameGroupBy.apply()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply") and [`DataFrameGroupBy.resample()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.resample.html#pandas.core.groupby.DataFrameGroupBy.resample "pandas.core.groupby.DataFrameGroupBy.resample"); pass `include_groups=False` to exclude the groups ([GH 7155](https://github.com/pandas-dev/pandas/issues/7155)) +* Deprecated indexing an [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with a boolean indexer of length zero ([GH 55820](https://github.com/pandas-dev/pandas/issues/55820)) +* Deprecated not passing a tuple to `DataFrameGroupBy.get_group` or `SeriesGroupBy.get_group` when grouping by a length-1 list-like ([GH 25971](https://github.com/pandas-dev/pandas/issues/25971)) +* Deprecated string `AS` denoting frequency in `YearBegin` and strings `AS-DEC`, `AS-JAN`, etc. denoting annual frequencies with various fiscal year starts ([GH 54275](https://github.com/pandas-dev/pandas/issues/54275)) +* Deprecated string `A` denoting frequency in `YearEnd` and strings `A-DEC`, `A-JAN`, etc. denoting annual frequencies with various fiscal year ends ([GH 54275](https://github.com/pandas-dev/pandas/issues/54275)) +* Deprecated string `BAS` denoting frequency in `BYearBegin` and strings `BAS-DEC`, `BAS-JAN`, etc. denoting annual frequencies with various fiscal year starts ([GH 54275](https://github.com/pandas-dev/pandas/issues/54275)) +* Deprecated string `BA` denoting frequency in `BYearEnd` and strings `BA-DEC`, `BA-JAN`, etc. denoting annual frequencies with various fiscal year ends ([GH 54275](https://github.com/pandas-dev/pandas/issues/54275)) +* Deprecated strings `H`, `BH`, and `CBH` denoting frequencies in `Hour`, `BusinessHour`, `CustomBusinessHour` ([GH 52536](https://github.com/pandas-dev/pandas/issues/52536)) +* Deprecated strings `H`, `S`, `U`, and `N` denoting units in [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta") ([GH 52536](https://github.com/pandas-dev/pandas/issues/52536)) +* Deprecated strings `H`, `T`, `S`, `L`, `U`, and `N` denoting units in [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") ([GH 52536](https://github.com/pandas-dev/pandas/issues/52536)) +* Deprecated strings `T`, `S`, `L`, `U`, and `N` denoting frequencies in `Minute`, `Second`, `Milli`, `Micro`, `Nano` ([GH 52536](https://github.com/pandas-dev/pandas/issues/52536)) +* Deprecated support for combining parsed datetime columns in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") along with the `keep_date_col` keyword ([GH 55569](https://github.com/pandas-dev/pandas/issues/55569)) +* Deprecated the `DataFrameGroupBy.grouper` and `SeriesGroupBy.grouper`; these attributes will be removed in a future version of pandas ([GH 56521](https://github.com/pandas-dev/pandas/issues/56521)) +* Deprecated the `Grouping` attributes `group_index`, `result_index`, and `group_arraylike`; these will be removed in a future version of pandas ([GH 56148](https://github.com/pandas-dev/pandas/issues/56148)) +* Deprecated the `delim_whitespace` keyword in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") and [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table"), use `sep="\\s+"` instead ([GH 55569](https://github.com/pandas-dev/pandas/issues/55569)) +* Deprecated the `errors="ignore"` option in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime"), [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta"), and [`to_numeric()`](../reference/api/pandas.to_numeric.html#pandas.to_numeric "pandas.to_numeric"); explicitly catch exceptions instead ([GH 54467](https://github.com/pandas-dev/pandas/issues/54467)) +* Deprecated the `fastpath` keyword in the [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") constructor ([GH 20110](https://github.com/pandas-dev/pandas/issues/20110)) +* Deprecated the `kind` keyword in [`Series.resample()`](../reference/api/pandas.Series.resample.html#pandas.Series.resample "pandas.Series.resample") and [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample"), explicitly cast the object’s `index` instead ([GH 55895](https://github.com/pandas-dev/pandas/issues/55895)) +* Deprecated the `ordinal` keyword in [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex"), use [`PeriodIndex.from_ordinals()`](../reference/api/pandas.PeriodIndex.from_ordinals.html#pandas.PeriodIndex.from_ordinals "pandas.PeriodIndex.from_ordinals") instead ([GH 55960](https://github.com/pandas-dev/pandas/issues/55960)) +* Deprecated the `unit` keyword in [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") construction, use [`to_timedelta()`](../reference/api/pandas.to_timedelta.html#pandas.to_timedelta "pandas.to_timedelta") instead ([GH 55499](https://github.com/pandas-dev/pandas/issues/55499)) +* Deprecated the `verbose` keyword in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") and [`read_table()`](../reference/api/pandas.read_table.html#pandas.read_table "pandas.read_table") ([GH 55569](https://github.com/pandas-dev/pandas/issues/55569)) +* Deprecated the behavior of [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") and [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") with [`CategoricalDtype`](../reference/api/pandas.CategoricalDtype.html#pandas.CategoricalDtype "pandas.CategoricalDtype"); in a future version replace will change the values while preserving the categories. To change the categories, use `ser.cat.rename_categories` instead ([GH 55147](https://github.com/pandas-dev/pandas/issues/55147)) +* Deprecated the behavior of [`Series.value_counts()`](../reference/api/pandas.Series.value_counts.html#pandas.Series.value_counts "pandas.Series.value_counts") and [`Index.value_counts()`](../reference/api/pandas.Index.value_counts.html#pandas.Index.value_counts "pandas.Index.value_counts") with object dtype; in a future version these will not perform dtype inference on the resulting [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), do `result.index = result.index.infer_objects()` to retain the old behavior ([GH 56161](https://github.com/pandas-dev/pandas/issues/56161)) +* Deprecated the default of `observed=False` in [`DataFrame.pivot_table()`](../reference/api/pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table"); will be `True` in a future version ([GH 56236](https://github.com/pandas-dev/pandas/issues/56236)) +* Deprecated the extension test classes `BaseNoReduceTests`, `BaseBooleanReduceTests`, and `BaseNumericReduceTests`, use `BaseReduceTests` instead ([GH 54663](https://github.com/pandas-dev/pandas/issues/54663)) +* Deprecated the option `mode.data_manager` and the `ArrayManager`; only the `BlockManager` will be available in future versions ([GH 55043](https://github.com/pandas-dev/pandas/issues/55043)) +* Deprecated the previous implementation of [`DataFrame.stack`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack"); specify `future_stack=True` to adopt the future version ([GH 53515](https://github.com/pandas-dev/pandas/issues/53515)) + +## Performance improvements[#](#performance-improvements "Link to this heading") + +* Performance improvement in [`testing.assert_frame_equal()`](../reference/api/pandas.testing.assert_frame_equal.html#pandas.testing.assert_frame_equal "pandas.testing.assert_frame_equal") and [`testing.assert_series_equal()`](../reference/api/pandas.testing.assert_series_equal.html#pandas.testing.assert_series_equal "pandas.testing.assert_series_equal") ([GH 55949](https://github.com/pandas-dev/pandas/issues/55949), [GH 55971](https://github.com/pandas-dev/pandas/issues/55971)) +* Performance improvement in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") with `axis=1` and objects with unaligned indexes ([GH 55084](https://github.com/pandas-dev/pandas/issues/55084)) +* Performance improvement in [`get_dummies()`](../reference/api/pandas.get_dummies.html#pandas.get_dummies "pandas.get_dummies") ([GH 56089](https://github.com/pandas-dev/pandas/issues/56089)) +* Performance improvement in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") and [`merge_ordered()`](../reference/api/pandas.merge_ordered.html#pandas.merge_ordered "pandas.merge_ordered") when joining on sorted ascending keys ([GH 56115](https://github.com/pandas-dev/pandas/issues/56115)) +* Performance improvement in [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") when `by` is not `None` ([GH 55580](https://github.com/pandas-dev/pandas/issues/55580), [GH 55678](https://github.com/pandas-dev/pandas/issues/55678)) +* Performance improvement in [`read_stata()`](../reference/api/pandas.read_stata.html#pandas.read_stata "pandas.read_stata") for files with many variables ([GH 55515](https://github.com/pandas-dev/pandas/issues/55515)) +* Performance improvement in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") when aggregating pyarrow timestamp and duration dtypes ([GH 55031](https://github.com/pandas-dev/pandas/issues/55031)) +* Performance improvement in [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") when joining on unordered categorical indexes ([GH 56345](https://github.com/pandas-dev/pandas/issues/56345)) +* Performance improvement in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") and [`Series.loc()`](../reference/api/pandas.Series.loc.html#pandas.Series.loc "pandas.Series.loc") when indexing with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 56062](https://github.com/pandas-dev/pandas/issues/56062)) +* Performance improvement in [`DataFrame.sort_index()`](../reference/api/pandas.DataFrame.sort_index.html#pandas.DataFrame.sort_index "pandas.DataFrame.sort_index") and [`Series.sort_index()`](../reference/api/pandas.Series.sort_index.html#pandas.Series.sort_index "pandas.Series.sort_index") when indexed by a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 54835](https://github.com/pandas-dev/pandas/issues/54835)) +* Performance improvement in [`DataFrame.to_dict()`](../reference/api/pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict") on converting DataFrame to dictionary ([GH 50990](https://github.com/pandas-dev/pandas/issues/50990)) +* Performance improvement in [`Index.difference()`](../reference/api/pandas.Index.difference.html#pandas.Index.difference "pandas.Index.difference") ([GH 55108](https://github.com/pandas-dev/pandas/issues/55108)) +* Performance improvement in [`Index.sort_values()`](../reference/api/pandas.Index.sort_values.html#pandas.Index.sort_values "pandas.Index.sort_values") when index is already sorted ([GH 56128](https://github.com/pandas-dev/pandas/issues/56128)) +* Performance improvement in [`MultiIndex.get_indexer()`](../reference/api/pandas.MultiIndex.get_indexer.html#pandas.MultiIndex.get_indexer "pandas.MultiIndex.get_indexer") when `method` is not `None` ([GH 55839](https://github.com/pandas-dev/pandas/issues/55839)) +* Performance improvement in [`Series.duplicated()`](../reference/api/pandas.Series.duplicated.html#pandas.Series.duplicated "pandas.Series.duplicated") for pyarrow dtypes ([GH 55255](https://github.com/pandas-dev/pandas/issues/55255)) +* Performance improvement in [`Series.str.get_dummies()`](../reference/api/pandas.Series.str.get_dummies.html#pandas.Series.str.get_dummies "pandas.Series.str.get_dummies") when dtype is `"string[pyarrow]"` or `"string[pyarrow_numpy]"` ([GH 56110](https://github.com/pandas-dev/pandas/issues/56110)) +* Performance improvement in [`Series.str()`](../reference/api/pandas.Series.str.html#pandas.Series.str "pandas.Series.str") methods ([GH 55736](https://github.com/pandas-dev/pandas/issues/55736)) +* Performance improvement in [`Series.value_counts()`](../reference/api/pandas.Series.value_counts.html#pandas.Series.value_counts "pandas.Series.value_counts") and [`Series.mode()`](../reference/api/pandas.Series.mode.html#pandas.Series.mode "pandas.Series.mode") for masked dtypes ([GH 54984](https://github.com/pandas-dev/pandas/issues/54984), [GH 55340](https://github.com/pandas-dev/pandas/issues/55340)) +* Performance improvement in [`DataFrameGroupBy.nunique()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.nunique.html#pandas.core.groupby.DataFrameGroupBy.nunique "pandas.core.groupby.DataFrameGroupBy.nunique") and [`SeriesGroupBy.nunique()`](../reference/api/pandas.core.groupby.SeriesGroupBy.nunique.html#pandas.core.groupby.SeriesGroupBy.nunique "pandas.core.groupby.SeriesGroupBy.nunique") ([GH 55972](https://github.com/pandas-dev/pandas/issues/55972)) +* Performance improvement in [`SeriesGroupBy.idxmax()`](../reference/api/pandas.core.groupby.SeriesGroupBy.idxmax.html#pandas.core.groupby.SeriesGroupBy.idxmax "pandas.core.groupby.SeriesGroupBy.idxmax"), [`SeriesGroupBy.idxmin()`](../reference/api/pandas.core.groupby.SeriesGroupBy.idxmin.html#pandas.core.groupby.SeriesGroupBy.idxmin "pandas.core.groupby.SeriesGroupBy.idxmin"), [`DataFrameGroupBy.idxmax()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.idxmax.html#pandas.core.groupby.DataFrameGroupBy.idxmax "pandas.core.groupby.DataFrameGroupBy.idxmax"), [`DataFrameGroupBy.idxmin()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.idxmin.html#pandas.core.groupby.DataFrameGroupBy.idxmin "pandas.core.groupby.DataFrameGroupBy.idxmin") ([GH 54234](https://github.com/pandas-dev/pandas/issues/54234)) +* Performance improvement when hashing a nullable extension array ([GH 56507](https://github.com/pandas-dev/pandas/issues/56507)) +* Performance improvement when indexing into a non-unique index ([GH 55816](https://github.com/pandas-dev/pandas/issues/55816)) +* Performance improvement when indexing with more than 4 keys ([GH 54550](https://github.com/pandas-dev/pandas/issues/54550)) +* Performance improvement when localizing time to UTC ([GH 55241](https://github.com/pandas-dev/pandas/issues/55241)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +### Categorical[#](#categorical "Link to this heading") + +* `Categorical.isin()` raising `InvalidIndexError` for categorical containing overlapping [`Interval`](../reference/api/pandas.Interval.html#pandas.Interval "pandas.Interval") values ([GH 34974](https://github.com/pandas-dev/pandas/issues/34974)) +* Bug in `CategoricalDtype.__eq__()` returning `False` for unordered categorical data with mixed types ([GH 55468](https://github.com/pandas-dev/pandas/issues/55468)) +* Bug when casting `pa.dictionary` to [`CategoricalDtype`](../reference/api/pandas.CategoricalDtype.html#pandas.CategoricalDtype "pandas.CategoricalDtype") using a `pa.DictionaryArray` as categories ([GH 56672](https://github.com/pandas-dev/pandas/issues/56672)) + +### Datetimelike[#](#datetimelike "Link to this heading") + +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") construction when passing both a `tz` and either `dayfirst` or `yearfirst` ignoring dayfirst/yearfirst ([GH 55813](https://github.com/pandas-dev/pandas/issues/55813)) +* Bug in [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") when passing an object-dtype ndarray of float objects and a `tz` incorrectly localizing the result ([GH 55780](https://github.com/pandas-dev/pandas/issues/55780)) +* Bug in [`Series.isin()`](../reference/api/pandas.Series.isin.html#pandas.Series.isin "pandas.Series.isin") with [`DatetimeTZDtype`](../reference/api/pandas.DatetimeTZDtype.html#pandas.DatetimeTZDtype "pandas.DatetimeTZDtype") dtype and comparison values that are all `NaT` incorrectly returning all-`False` even if the series contains `NaT` entries ([GH 56427](https://github.com/pandas-dev/pandas/issues/56427)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") raising `AttributeError` when concatenating all-NA DataFrame with [`DatetimeTZDtype`](../reference/api/pandas.DatetimeTZDtype.html#pandas.DatetimeTZDtype "pandas.DatetimeTZDtype") dtype DataFrame ([GH 52093](https://github.com/pandas-dev/pandas/issues/52093)) +* Bug in [`testing.assert_extension_array_equal()`](../reference/api/pandas.testing.assert_extension_array_equal.html#pandas.testing.assert_extension_array_equal "pandas.testing.assert_extension_array_equal") that could use the wrong unit when comparing resolutions ([GH 55730](https://github.com/pandas-dev/pandas/issues/55730)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") and [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") when passing a list of mixed-string-and-numeric types incorrectly raising ([GH 55780](https://github.com/pandas-dev/pandas/issues/55780)) +* Bug in [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") and [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") when passing mixed-type objects with a mix of timezones or mix of timezone-awareness failing to raise `ValueError` ([GH 55693](https://github.com/pandas-dev/pandas/issues/55693)) +* Bug in `Tick.delta()` with very large ticks raising `OverflowError` instead of `OutOfBoundsTimedelta` ([GH 55503](https://github.com/pandas-dev/pandas/issues/55503)) +* Bug in `DatetimeIndex.shift()` with non-nanosecond resolution incorrectly returning with nanosecond resolution ([GH 56117](https://github.com/pandas-dev/pandas/issues/56117)) +* Bug in `DatetimeIndex.union()` returning object dtype for tz-aware indexes with the same timezone but different units ([GH 55238](https://github.com/pandas-dev/pandas/issues/55238)) +* Bug in [`Index.is_monotonic_increasing()`](../reference/api/pandas.Index.is_monotonic_increasing.html#pandas.Index.is_monotonic_increasing "pandas.Index.is_monotonic_increasing") and [`Index.is_monotonic_decreasing()`](../reference/api/pandas.Index.is_monotonic_decreasing.html#pandas.Index.is_monotonic_decreasing "pandas.Index.is_monotonic_decreasing") always caching [`Index.is_unique()`](../reference/api/pandas.Index.is_unique.html#pandas.Index.is_unique "pandas.Index.is_unique") as `True` when first value in index is `NaT` ([GH 55755](https://github.com/pandas-dev/pandas/issues/55755)) +* Bug in [`Index.view()`](../reference/api/pandas.Index.view.html#pandas.Index.view "pandas.Index.view") to a datetime64 dtype with non-supported resolution incorrectly raising ([GH 55710](https://github.com/pandas-dev/pandas/issues/55710)) +* Bug in [`Series.dt.round()`](../reference/api/pandas.Series.dt.round.html#pandas.Series.dt.round "pandas.Series.dt.round") with non-nanosecond resolution and `NaT` entries incorrectly raising `OverflowError` ([GH 56158](https://github.com/pandas-dev/pandas/issues/56158)) +* Bug in [`Series.fillna()`](../reference/api/pandas.Series.fillna.html#pandas.Series.fillna "pandas.Series.fillna") with non-nanosecond resolution dtypes and higher-resolution vector values returning incorrect (internally-corrupted) results ([GH 56410](https://github.com/pandas-dev/pandas/issues/56410)) +* Bug in [`Timestamp.unit()`](../reference/api/pandas.Timestamp.unit.html#pandas.Timestamp.unit "pandas.Timestamp.unit") being inferred incorrectly from an ISO8601 format string with minute or hour resolution and a timezone offset ([GH 56208](https://github.com/pandas-dev/pandas/issues/56208)) +* Bug in `.astype` converting from a higher-resolution `datetime64` dtype to a lower-resolution `datetime64` dtype (e.g. `datetime64[us]->datetime64[ms]`) silently overflowing with values near the lower implementation bound ([GH 55979](https://github.com/pandas-dev/pandas/issues/55979)) +* Bug in adding or subtracting a `Week` offset to a `datetime64` [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") column with non-nanosecond resolution returning incorrect results ([GH 55583](https://github.com/pandas-dev/pandas/issues/55583)) +* Bug in addition or subtraction of `BusinessDay` offset with `offset` attribute to non-nanosecond [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") column giving incorrect results ([GH 55608](https://github.com/pandas-dev/pandas/issues/55608)) +* Bug in addition or subtraction of `DateOffset` objects with microsecond components to `datetime64` [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") columns with non-nanosecond resolution ([GH 55595](https://github.com/pandas-dev/pandas/issues/55595)) +* Bug in addition or subtraction of very large [`Tick`](../reference/api/pandas.tseries.offsets.Tick.html#pandas.tseries.offsets.Tick "pandas.tseries.offsets.Tick") objects with [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") or [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") objects raising `OverflowError` instead of `OutOfBoundsTimedelta` ([GH 55503](https://github.com/pandas-dev/pandas/issues/55503)) +* Bug in creating a [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a non-nanosecond [`DatetimeTZDtype`](../reference/api/pandas.DatetimeTZDtype.html#pandas.DatetimeTZDtype "pandas.DatetimeTZDtype") and inputs that would be out of bounds with nanosecond resolution incorrectly raising `OutOfBoundsDatetime` ([GH 54620](https://github.com/pandas-dev/pandas/issues/54620)) +* Bug in creating a [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a non-nanosecond `datetime64` (or [`DatetimeTZDtype`](../reference/api/pandas.DatetimeTZDtype.html#pandas.DatetimeTZDtype "pandas.DatetimeTZDtype")) from mixed-numeric inputs treating those as nanoseconds instead of as multiples of the dtype’s unit (which would happen with non-mixed numeric inputs) ([GH 56004](https://github.com/pandas-dev/pandas/issues/56004)) +* Bug in creating a [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with a non-nanosecond `datetime64` dtype and inputs that would be out of bounds for a `datetime64[ns]` incorrectly raising `OutOfBoundsDatetime` ([GH 55756](https://github.com/pandas-dev/pandas/issues/55756)) +* Bug in parsing datetime strings with nanosecond resolution with non-ISO8601 formats incorrectly truncating sub-microsecond components ([GH 56051](https://github.com/pandas-dev/pandas/issues/56051)) +* Bug in parsing datetime strings with sub-second resolution and trailing zeros incorrectly inferring second or millisecond resolution ([GH 55737](https://github.com/pandas-dev/pandas/issues/55737)) +* Bug in the results of [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with an floating-dtype argument with `unit` not matching the pointwise results of [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") ([GH 56037](https://github.com/pandas-dev/pandas/issues/56037)) +* Fixed regression where [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") would raise an error when concatenating `datetime64` columns with differing resolutions ([GH 53641](https://github.com/pandas-dev/pandas/issues/53641)) + +### Timedelta[#](#timedelta "Link to this heading") + +* Bug in [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") construction raising `OverflowError` instead of `OutOfBoundsTimedelta` ([GH 55503](https://github.com/pandas-dev/pandas/issues/55503)) +* Bug in rendering (`__repr__`) of [`TimedeltaIndex`](../reference/api/pandas.TimedeltaIndex.html#pandas.TimedeltaIndex "pandas.TimedeltaIndex") and [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with timedelta64 values with non-nanosecond resolution entries that are all multiples of 24 hours failing to use the compact representation used in the nanosecond cases ([GH 55405](https://github.com/pandas-dev/pandas/issues/55405)) + +### Timezones[#](#timezones "Link to this heading") + +* Bug in `AbstractHolidayCalendar` where timezone data was not propagated when computing holiday observances ([GH 54580](https://github.com/pandas-dev/pandas/issues/54580)) +* Bug in [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") construction with an ambiguous value and a `pytz` timezone failing to raise `pytz.AmbiguousTimeError` ([GH 55657](https://github.com/pandas-dev/pandas/issues/55657)) +* Bug in [`Timestamp.tz_localize()`](../reference/api/pandas.Timestamp.tz_localize.html#pandas.Timestamp.tz_localize "pandas.Timestamp.tz_localize") with `nonexistent="shift_forward` around UTC+0 during DST ([GH 51501](https://github.com/pandas-dev/pandas/issues/51501)) + +### Numeric[#](#numeric "Link to this heading") + +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") with `engine="pyarrow"` causing rounding errors for large integers ([GH 52505](https://github.com/pandas-dev/pandas/issues/52505)) +* Bug in `Series.__floordiv__()` and `Series.__truediv__()` for [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with integral dtypes raising for large divisors ([GH 56706](https://github.com/pandas-dev/pandas/issues/56706)) +* Bug in `Series.__floordiv__()` for [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with integral dtypes raising for large values ([GH 56645](https://github.com/pandas-dev/pandas/issues/56645)) +* Bug in [`Series.pow()`](../reference/api/pandas.Series.pow.html#pandas.Series.pow "pandas.Series.pow") not filling missing values correctly ([GH 55512](https://github.com/pandas-dev/pandas/issues/55512)) +* Bug in [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") and [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") matching float `0.0` with `False` and vice versa ([GH 55398](https://github.com/pandas-dev/pandas/issues/55398)) +* Bug in [`Series.round()`](../reference/api/pandas.Series.round.html#pandas.Series.round "pandas.Series.round") raising for nullable boolean dtype ([GH 55936](https://github.com/pandas-dev/pandas/issues/55936)) + +### Conversion[#](#conversion "Link to this heading") + +* Bug in [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") when called with `str` on unpickled array - the array might change in-place ([GH 54654](https://github.com/pandas-dev/pandas/issues/54654)) +* Bug in [`DataFrame.astype()`](../reference/api/pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype") where `errors="ignore"` had no effect for extension types ([GH 54654](https://github.com/pandas-dev/pandas/issues/54654)) +* Bug in [`Series.convert_dtypes()`](../reference/api/pandas.Series.convert_dtypes.html#pandas.Series.convert_dtypes "pandas.Series.convert_dtypes") not converting all NA column to `null[pyarrow]` ([GH 55346](https://github.com/pandas-dev/pandas/issues/55346)) +* Bug in :meth:`DataFrame.loc` was not throwing “incompatible dtype warning” (see [PDEP6](https://pandas.pydata.org/pdeps/0006-ban-upcasting.html)) when assigning a `Series` with a different dtype using a full column setter (e.g. `df.loc[:, 'a'] = incompatible_value`) ([GH 39584](https://github.com/pandas-dev/pandas/issues/39584)) + +### Strings[#](#strings "Link to this heading") + +* Bug in [`pandas.api.types.is_string_dtype()`](../reference/api/pandas.api.types.is_string_dtype.html#pandas.api.types.is_string_dtype "pandas.api.types.is_string_dtype") while checking object array with no elements is of the string dtype ([GH 54661](https://github.com/pandas-dev/pandas/issues/54661)) +* Bug in [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") failing when `engine="numba"` and columns or index have `StringDtype` ([GH 56189](https://github.com/pandas-dev/pandas/issues/56189)) +* Bug in [`DataFrame.reindex()`](../reference/api/pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex") not matching [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with `string[pyarrow_numpy]` dtype ([GH 56106](https://github.com/pandas-dev/pandas/issues/56106)) +* Bug in `Index.str.cat()` always casting result to object dtype ([GH 56157](https://github.com/pandas-dev/pandas/issues/56157)) +* Bug in `Series.__mul__()` for [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with `pyarrow.string` dtype and `string[pyarrow]` for the pyarrow backend ([GH 51970](https://github.com/pandas-dev/pandas/issues/51970)) +* Bug in [`Series.str.find()`](../reference/api/pandas.Series.str.find.html#pandas.Series.str.find "pandas.Series.str.find") when `start < 0` for [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with `pyarrow.string` ([GH 56411](https://github.com/pandas-dev/pandas/issues/56411)) +* Bug in [`Series.str.fullmatch()`](../reference/api/pandas.Series.str.fullmatch.html#pandas.Series.str.fullmatch "pandas.Series.str.fullmatch") when `dtype=pandas.ArrowDtype(pyarrow.string()))` allows partial matches when regex ends in literal //$ ([GH 56652](https://github.com/pandas-dev/pandas/issues/56652)) +* Bug in [`Series.str.replace()`](../reference/api/pandas.Series.str.replace.html#pandas.Series.str.replace "pandas.Series.str.replace") when `n < 0` for [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with `pyarrow.string` ([GH 56404](https://github.com/pandas-dev/pandas/issues/56404)) +* Bug in [`Series.str.startswith()`](../reference/api/pandas.Series.str.startswith.html#pandas.Series.str.startswith "pandas.Series.str.startswith") and [`Series.str.endswith()`](../reference/api/pandas.Series.str.endswith.html#pandas.Series.str.endswith "pandas.Series.str.endswith") with arguments of type `tuple[str, ...]` for [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with `pyarrow.string` dtype ([GH 56579](https://github.com/pandas-dev/pandas/issues/56579)) +* Bug in [`Series.str.startswith()`](../reference/api/pandas.Series.str.startswith.html#pandas.Series.str.startswith "pandas.Series.str.startswith") and [`Series.str.endswith()`](../reference/api/pandas.Series.str.endswith.html#pandas.Series.str.endswith "pandas.Series.str.endswith") with arguments of type `tuple[str, ...]` for `string[pyarrow]` ([GH 54942](https://github.com/pandas-dev/pandas/issues/54942)) +* Bug in comparison operations for `dtype="string[pyarrow_numpy]"` raising if dtypes can’t be compared ([GH 56008](https://github.com/pandas-dev/pandas/issues/56008)) + +### Interval[#](#interval "Link to this heading") + +* Bug in [`Interval`](../reference/api/pandas.Interval.html#pandas.Interval "pandas.Interval") `__repr__` not displaying UTC offsets for [`Timestamp`](../reference/api/pandas.Timestamp.html#pandas.Timestamp "pandas.Timestamp") bounds. Additionally the hour, minute and second components will now be shown ([GH 55015](https://github.com/pandas-dev/pandas/issues/55015)) +* Bug in `IntervalIndex.factorize()` and [`Series.factorize()`](../reference/api/pandas.Series.factorize.html#pandas.Series.factorize "pandas.Series.factorize") with [`IntervalDtype`](../reference/api/pandas.IntervalDtype.html#pandas.IntervalDtype "pandas.IntervalDtype") with datetime64 or timedelta64 intervals not preserving non-nanosecond units ([GH 56099](https://github.com/pandas-dev/pandas/issues/56099)) +* Bug in [`IntervalIndex.from_arrays()`](../reference/api/pandas.IntervalIndex.from_arrays.html#pandas.IntervalIndex.from_arrays "pandas.IntervalIndex.from_arrays") when passed `datetime64` or `timedelta64` arrays with mismatched resolutions constructing an invalid `IntervalArray` object ([GH 55714](https://github.com/pandas-dev/pandas/issues/55714)) +* Bug in [`IntervalIndex.from_tuples()`](../reference/api/pandas.IntervalIndex.from_tuples.html#pandas.IntervalIndex.from_tuples "pandas.IntervalIndex.from_tuples") raising if subtype is a nullable extension dtype ([GH 56765](https://github.com/pandas-dev/pandas/issues/56765)) +* Bug in [`IntervalIndex.get_indexer()`](../reference/api/pandas.IntervalIndex.get_indexer.html#pandas.IntervalIndex.get_indexer "pandas.IntervalIndex.get_indexer") with datetime or timedelta intervals incorrectly matching on integer targets ([GH 47772](https://github.com/pandas-dev/pandas/issues/47772)) +* Bug in [`IntervalIndex.get_indexer()`](../reference/api/pandas.IntervalIndex.get_indexer.html#pandas.IntervalIndex.get_indexer "pandas.IntervalIndex.get_indexer") with timezone-aware datetime intervals incorrectly matching on a sequence of timezone-naive targets ([GH 47772](https://github.com/pandas-dev/pandas/issues/47772)) +* Bug in setting values on a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with an [`IntervalIndex`](../reference/api/pandas.IntervalIndex.html#pandas.IntervalIndex "pandas.IntervalIndex") using a slice incorrectly raising ([GH 54722](https://github.com/pandas-dev/pandas/issues/54722)) + +### Indexing[#](#indexing "Link to this heading") + +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") mutating a boolean indexer when [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") has a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") ([GH 56635](https://github.com/pandas-dev/pandas/issues/56635)) +* Bug in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") when setting [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with extension dtype into NumPy dtype ([GH 55604](https://github.com/pandas-dev/pandas/issues/55604)) +* Bug in [`Index.difference()`](../reference/api/pandas.Index.difference.html#pandas.Index.difference "pandas.Index.difference") not returning a unique set of values when `other` is empty or `other` is considered non-comparable ([GH 55113](https://github.com/pandas-dev/pandas/issues/55113)) +* Bug in setting [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") values into a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with numpy dtypes raising `RecursionError` ([GH 52927](https://github.com/pandas-dev/pandas/issues/52927)) +* Fixed bug when creating new column with missing values when setting a single string value ([GH 56204](https://github.com/pandas-dev/pandas/issues/56204)) + +### Missing[#](#missing "Link to this heading") + +* Bug in [`DataFrame.update()`](../reference/api/pandas.DataFrame.update.html#pandas.DataFrame.update "pandas.DataFrame.update") wasn’t updating in-place for tz-aware datetime64 dtypes ([GH 56227](https://github.com/pandas-dev/pandas/issues/56227)) + +### MultiIndex[#](#multiindex "Link to this heading") + +* Bug in [`MultiIndex.get_indexer()`](../reference/api/pandas.MultiIndex.get_indexer.html#pandas.MultiIndex.get_indexer "pandas.MultiIndex.get_indexer") not raising `ValueError` when `method` provided and index is non-monotonic ([GH 53452](https://github.com/pandas-dev/pandas/issues/53452)) + +### I/O[#](#i-o "Link to this heading") + +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") where `engine="python"` did not respect `chunksize` arg when `skiprows` was specified ([GH 56323](https://github.com/pandas-dev/pandas/issues/56323)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") where `engine="python"` was causing a `TypeError` when a callable `skiprows` and a chunk size was specified ([GH 55677](https://github.com/pandas-dev/pandas/issues/55677)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") where `on_bad_lines="warn"` would write to `stderr` instead of raising a Python warning; this now yields a [`errors.ParserWarning`](../reference/api/pandas.errors.ParserWarning.html#pandas.errors.ParserWarning "pandas.errors.ParserWarning") ([GH 54296](https://github.com/pandas-dev/pandas/issues/54296)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") with `engine="pyarrow"` where `quotechar` was ignored ([GH 52266](https://github.com/pandas-dev/pandas/issues/52266)) +* Bug in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") with `engine="pyarrow"` where `usecols` wasn’t working with a CSV with no headers ([GH 54459](https://github.com/pandas-dev/pandas/issues/54459)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel"), with `engine="xlrd"` (`xls` files) erroring when the file contains `NaN` or `Inf` ([GH 54564](https://github.com/pandas-dev/pandas/issues/54564)) +* Bug in [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") not handling dtype conversion properly if `infer_string` is set ([GH 56195](https://github.com/pandas-dev/pandas/issues/56195)) +* Bug in [`DataFrame.to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel"), with `OdsWriter` (`ods` files) writing Boolean/string value ([GH 54994](https://github.com/pandas-dev/pandas/issues/54994)) +* Bug in [`DataFrame.to_hdf()`](../reference/api/pandas.DataFrame.to_hdf.html#pandas.DataFrame.to_hdf "pandas.DataFrame.to_hdf") and [`read_hdf()`](../reference/api/pandas.read_hdf.html#pandas.read_hdf "pandas.read_hdf") with `datetime64` dtypes with non-nanosecond resolution failing to round-trip correctly ([GH 55622](https://github.com/pandas-dev/pandas/issues/55622)) +* Bug in [`DataFrame.to_stata()`](../reference/api/pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata") raising for extension dtypes ([GH 54671](https://github.com/pandas-dev/pandas/issues/54671)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") with `engine="odf"` (`ods` files) when a string cell contains an annotation ([GH 55200](https://github.com/pandas-dev/pandas/issues/55200)) +* Bug in [`read_excel()`](../reference/api/pandas.read_excel.html#pandas.read_excel "pandas.read_excel") with an ODS file without cached formatted cell for float values ([GH 55219](https://github.com/pandas-dev/pandas/issues/55219)) +* Bug where [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") would raise an `OverflowError` instead of a `TypeError` with unsupported NumPy types ([GH 55403](https://github.com/pandas-dev/pandas/issues/55403)) + +### Period[#](#period "Link to this heading") + +* Bug in [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") construction when more than one of `data`, `ordinal` and `**fields` are passed failing to raise `ValueError` ([GH 55961](https://github.com/pandas-dev/pandas/issues/55961)) +* Bug in [`Period`](../reference/api/pandas.Period.html#pandas.Period "pandas.Period") addition silently wrapping around instead of raising `OverflowError` ([GH 55503](https://github.com/pandas-dev/pandas/issues/55503)) +* Bug in casting from [`PeriodDtype`](../reference/api/pandas.PeriodDtype.html#pandas.PeriodDtype "pandas.PeriodDtype") with `astype` to `datetime64` or [`DatetimeTZDtype`](../reference/api/pandas.DatetimeTZDtype.html#pandas.DatetimeTZDtype "pandas.DatetimeTZDtype") with non-nanosecond unit incorrectly returning with nanosecond unit ([GH 55958](https://github.com/pandas-dev/pandas/issues/55958)) + +### Plotting[#](#plotting "Link to this heading") + +* Bug in [`DataFrame.plot.box()`](../reference/api/pandas.DataFrame.plot.box.html#pandas.DataFrame.plot.box "pandas.DataFrame.plot.box") with `vert=False` and a Matplotlib `Axes` created with `sharey=True` ([GH 54941](https://github.com/pandas-dev/pandas/issues/54941)) +* Bug in [`DataFrame.plot.scatter()`](../reference/api/pandas.DataFrame.plot.scatter.html#pandas.DataFrame.plot.scatter "pandas.DataFrame.plot.scatter") discarding string columns ([GH 56142](https://github.com/pandas-dev/pandas/issues/56142)) +* Bug in [`Series.plot()`](../reference/api/pandas.Series.plot.html#pandas.Series.plot "pandas.Series.plot") when reusing an `ax` object failing to raise when a `how` keyword is passed ([GH 55953](https://github.com/pandas-dev/pandas/issues/55953)) + +### Groupby/resample/rolling[#](#groupby-resample-rolling "Link to this heading") + +* Bug in [`DataFrameGroupBy.idxmin()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.idxmin.html#pandas.core.groupby.DataFrameGroupBy.idxmin "pandas.core.groupby.DataFrameGroupBy.idxmin"), [`DataFrameGroupBy.idxmax()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.idxmax.html#pandas.core.groupby.DataFrameGroupBy.idxmax "pandas.core.groupby.DataFrameGroupBy.idxmax"), [`SeriesGroupBy.idxmin()`](../reference/api/pandas.core.groupby.SeriesGroupBy.idxmin.html#pandas.core.groupby.SeriesGroupBy.idxmin "pandas.core.groupby.SeriesGroupBy.idxmin"), and [`SeriesGroupBy.idxmax()`](../reference/api/pandas.core.groupby.SeriesGroupBy.idxmax.html#pandas.core.groupby.SeriesGroupBy.idxmax "pandas.core.groupby.SeriesGroupBy.idxmax") would not retain [`Categorical`](../reference/api/pandas.Categorical.html#pandas.Categorical "pandas.Categorical") dtype when the index was a [`CategoricalIndex`](../reference/api/pandas.CategoricalIndex.html#pandas.CategoricalIndex "pandas.CategoricalIndex") that contained NA values ([GH 54234](https://github.com/pandas-dev/pandas/issues/54234)) +* Bug in [`DataFrameGroupBy.transform()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform") and [`SeriesGroupBy.transform()`](../reference/api/pandas.core.groupby.SeriesGroupBy.transform.html#pandas.core.groupby.SeriesGroupBy.transform "pandas.core.groupby.SeriesGroupBy.transform") when `observed=False` and `f="idxmin"` or `f="idxmax"` would incorrectly raise on unobserved categories ([GH 54234](https://github.com/pandas-dev/pandas/issues/54234)) +* Bug in [`DataFrameGroupBy.value_counts()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.value_counts.html#pandas.core.groupby.DataFrameGroupBy.value_counts "pandas.core.groupby.DataFrameGroupBy.value_counts") and [`SeriesGroupBy.value_counts()`](../reference/api/pandas.core.groupby.SeriesGroupBy.value_counts.html#pandas.core.groupby.SeriesGroupBy.value_counts "pandas.core.groupby.SeriesGroupBy.value_counts") could result in incorrect sorting if the columns of the DataFrame or name of the Series are integers ([GH 55951](https://github.com/pandas-dev/pandas/issues/55951)) +* Bug in [`DataFrameGroupBy.value_counts()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.value_counts.html#pandas.core.groupby.DataFrameGroupBy.value_counts "pandas.core.groupby.DataFrameGroupBy.value_counts") and [`SeriesGroupBy.value_counts()`](../reference/api/pandas.core.groupby.SeriesGroupBy.value_counts.html#pandas.core.groupby.SeriesGroupBy.value_counts "pandas.core.groupby.SeriesGroupBy.value_counts") would not respect `sort=False` in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") and [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") ([GH 55951](https://github.com/pandas-dev/pandas/issues/55951)) +* Bug in [`DataFrameGroupBy.value_counts()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.value_counts.html#pandas.core.groupby.DataFrameGroupBy.value_counts "pandas.core.groupby.DataFrameGroupBy.value_counts") and [`SeriesGroupBy.value_counts()`](../reference/api/pandas.core.groupby.SeriesGroupBy.value_counts.html#pandas.core.groupby.SeriesGroupBy.value_counts "pandas.core.groupby.SeriesGroupBy.value_counts") would sort by proportions rather than frequencies when `sort=True` and `normalize=True` ([GH 55951](https://github.com/pandas-dev/pandas/issues/55951)) +* Bug in [`DataFrame.asfreq()`](../reference/api/pandas.DataFrame.asfreq.html#pandas.DataFrame.asfreq "pandas.DataFrame.asfreq") and [`Series.asfreq()`](../reference/api/pandas.Series.asfreq.html#pandas.Series.asfreq "pandas.Series.asfreq") with a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") with non-nanosecond resolution incorrectly converting to nanosecond resolution ([GH 55958](https://github.com/pandas-dev/pandas/issues/55958)) +* Bug in [`DataFrame.ewm()`](../reference/api/pandas.DataFrame.ewm.html#pandas.DataFrame.ewm "pandas.DataFrame.ewm") when passed `times` with non-nanosecond `datetime64` or [`DatetimeTZDtype`](../reference/api/pandas.DatetimeTZDtype.html#pandas.DatetimeTZDtype "pandas.DatetimeTZDtype") dtype ([GH 56262](https://github.com/pandas-dev/pandas/issues/56262)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") and [`Series.groupby()`](../reference/api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") where grouping by a combination of `Decimal` and NA values would fail when `sort=True` ([GH 54847](https://github.com/pandas-dev/pandas/issues/54847)) +* Bug in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") for DataFrame subclasses when selecting a subset of columns to apply the function to ([GH 56761](https://github.com/pandas-dev/pandas/issues/56761)) +* Bug in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") not respecting `closed` and `label` arguments for [`BusinessDay`](../reference/api/pandas.tseries.offsets.BusinessDay.html#pandas.tseries.offsets.BusinessDay "pandas.tseries.offsets.BusinessDay") ([GH 55282](https://github.com/pandas-dev/pandas/issues/55282)) +* Bug in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") when resampling on a [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") of `pyarrow.timestamp` or `pyarrow.duration` type ([GH 55989](https://github.com/pandas-dev/pandas/issues/55989)) +* Bug in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") where bin edges were not correct for [`BusinessDay`](../reference/api/pandas.tseries.offsets.BusinessDay.html#pandas.tseries.offsets.BusinessDay "pandas.tseries.offsets.BusinessDay") ([GH 55281](https://github.com/pandas-dev/pandas/issues/55281)) +* Bug in [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") where bin edges were not correct for [`MonthBegin`](../reference/api/pandas.tseries.offsets.MonthBegin.html#pandas.tseries.offsets.MonthBegin "pandas.tseries.offsets.MonthBegin") ([GH 55271](https://github.com/pandas-dev/pandas/issues/55271)) +* Bug in [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") and [`Series.rolling()`](../reference/api/pandas.Series.rolling.html#pandas.Series.rolling "pandas.Series.rolling") where duplicate datetimelike indexes are treated as consecutive rather than equal with `closed='left'` and `closed='neither'` ([GH 20712](https://github.com/pandas-dev/pandas/issues/20712)) +* Bug in [`DataFrame.rolling()`](../reference/api/pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling") and [`Series.rolling()`](../reference/api/pandas.Series.rolling.html#pandas.Series.rolling "pandas.Series.rolling") where either the `index` or `on` column was [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with `pyarrow.timestamp` type ([GH 55849](https://github.com/pandas-dev/pandas/issues/55849)) + +### Reshaping[#](#reshaping "Link to this heading") + +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") ignoring `sort` parameter when passed [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") indexes ([GH 54769](https://github.com/pandas-dev/pandas/issues/54769)) +* Bug in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") renaming [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") when `ignore_index=False` ([GH 15047](https://github.com/pandas-dev/pandas/issues/15047)) +* Bug in [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") raising `TypeError` when `by` dtype is not `object`, `int64`, or `uint64` ([GH 22794](https://github.com/pandas-dev/pandas/issues/22794)) +* Bug in [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") raising incorrect error for string dtype ([GH 56444](https://github.com/pandas-dev/pandas/issues/56444)) +* Bug in [`merge_asof()`](../reference/api/pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") when using a [`Timedelta`](../reference/api/pandas.Timedelta.html#pandas.Timedelta "pandas.Timedelta") tolerance on a [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") column ([GH 56486](https://github.com/pandas-dev/pandas/issues/56486)) +* Bug in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") not raising when merging datetime columns with timedelta columns ([GH 56455](https://github.com/pandas-dev/pandas/issues/56455)) +* Bug in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") not raising when merging string columns with numeric columns ([GH 56441](https://github.com/pandas-dev/pandas/issues/56441)) +* Bug in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") not sorting for new string dtype ([GH 56442](https://github.com/pandas-dev/pandas/issues/56442)) +* Bug in [`merge()`](../reference/api/pandas.merge.html#pandas.merge "pandas.merge") returning columns in incorrect order when left and/or right is empty ([GH 51929](https://github.com/pandas-dev/pandas/issues/51929)) +* Bug in [`DataFrame.melt()`](../reference/api/pandas.DataFrame.melt.html#pandas.DataFrame.melt "pandas.DataFrame.melt") where an exception was raised if `var_name` was not a string ([GH 55948](https://github.com/pandas-dev/pandas/issues/55948)) +* Bug in [`DataFrame.melt()`](../reference/api/pandas.DataFrame.melt.html#pandas.DataFrame.melt "pandas.DataFrame.melt") where it would not preserve the datetime ([GH 55254](https://github.com/pandas-dev/pandas/issues/55254)) +* Bug in [`DataFrame.pivot_table()`](../reference/api/pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table") where the row margin is incorrect when the columns have numeric names ([GH 26568](https://github.com/pandas-dev/pandas/issues/26568)) +* Bug in [`DataFrame.pivot()`](../reference/api/pandas.DataFrame.pivot.html#pandas.DataFrame.pivot "pandas.DataFrame.pivot") with numeric columns and extension dtype for data ([GH 56528](https://github.com/pandas-dev/pandas/issues/56528)) +* Bug in [`DataFrame.stack()`](../reference/api/pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack") with `future_stack=True` would not preserve NA values in the index ([GH 56573](https://github.com/pandas-dev/pandas/issues/56573)) + +### Sparse[#](#sparse "Link to this heading") + +* Bug in `arrays.SparseArray.take()` when using a different fill value than the array’s fill value ([GH 55181](https://github.com/pandas-dev/pandas/issues/55181)) + +### Other[#](#other "Link to this heading") + +* [`DataFrame.__dataframe__()`](../reference/api/pandas.DataFrame.__dataframe__.html#pandas.DataFrame.__dataframe__ "pandas.DataFrame.__dataframe__") did not support pyarrow large strings ([GH 56702](https://github.com/pandas-dev/pandas/issues/56702)) +* Bug in [`DataFrame.describe()`](../reference/api/pandas.DataFrame.describe.html#pandas.DataFrame.describe "pandas.DataFrame.describe") when formatting percentiles in the resulting percentile 99.999% is rounded to 100% ([GH 55765](https://github.com/pandas-dev/pandas/issues/55765)) +* Bug in [`api.interchange.from_dataframe()`](../reference/api/pandas.api.interchange.from_dataframe.html#pandas.api.interchange.from_dataframe "pandas.api.interchange.from_dataframe") where it raised `NotImplementedError` when handling empty string columns ([GH 56703](https://github.com/pandas-dev/pandas/issues/56703)) +* Bug in [`cut()`](../reference/api/pandas.cut.html#pandas.cut "pandas.cut") and [`qcut()`](../reference/api/pandas.qcut.html#pandas.qcut "pandas.qcut") with `datetime64` dtype values with non-nanosecond units incorrectly returning nanosecond-unit bins ([GH 56101](https://github.com/pandas-dev/pandas/issues/56101)) +* Bug in [`cut()`](../reference/api/pandas.cut.html#pandas.cut "pandas.cut") incorrectly allowing cutting of timezone-aware datetimes with timezone-naive bins ([GH 54964](https://github.com/pandas-dev/pandas/issues/54964)) +* Bug in [`infer_freq()`](../reference/api/pandas.infer_freq.html#pandas.infer_freq "pandas.infer_freq") and [`DatetimeIndex.inferred_freq()`](../reference/api/pandas.DatetimeIndex.inferred_freq.html#pandas.DatetimeIndex.inferred_freq "pandas.DatetimeIndex.inferred_freq") with weekly frequencies and non-nanosecond resolutions ([GH 55609](https://github.com/pandas-dev/pandas/issues/55609)) +* Bug in [`DataFrame.apply()`](../reference/api/pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply") where passing `raw=True` ignored `args` passed to the applied function ([GH 55009](https://github.com/pandas-dev/pandas/issues/55009)) +* Bug in [`DataFrame.from_dict()`](../reference/api/pandas.DataFrame.from_dict.html#pandas.DataFrame.from_dict "pandas.DataFrame.from_dict") which would always sort the rows of the created [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame"). ([GH 55683](https://github.com/pandas-dev/pandas/issues/55683)) +* Bug in [`DataFrame.sort_index()`](../reference/api/pandas.DataFrame.sort_index.html#pandas.DataFrame.sort_index "pandas.DataFrame.sort_index") when passing `axis="columns"` and `ignore_index=True` raising a `ValueError` ([GH 56478](https://github.com/pandas-dev/pandas/issues/56478)) +* Bug in rendering `inf` values inside a [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with the `use_inf_as_na` option enabled ([GH 55483](https://github.com/pandas-dev/pandas/issues/55483)) +* Bug in rendering a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") with a [`MultiIndex`](../reference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") when one of the index level’s names is 0 not having that name displayed ([GH 55415](https://github.com/pandas-dev/pandas/issues/55415)) +* Bug in the error message when assigning an empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") to a column ([GH 55956](https://github.com/pandas-dev/pandas/issues/55956)) +* Bug when time-like strings were being cast to [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") with `pyarrow.time64` type ([GH 56463](https://github.com/pandas-dev/pandas/issues/56463)) +* Fixed a spurious deprecation warning from `numba` >= 0.58.0 when passing a numpy ufunc in `core.window.Rolling.apply` with `engine="numba"` ([GH 55247](https://github.com/pandas-dev/pandas/issues/55247)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 162 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* AG +* Aaron Rahman + +* Abdullah Ihsan Secer + +* Abhijit Deo + +* Adrian D’Alessandro +* Ahmad Mustafa Anis + +* Amanda Bizzinotto +* Amith KK + +* Aniket Patil + +* Antonio Fonseca + +* Artur Barseghyan +* Ben Greiner +* Bill Blum + +* Boyd Kane +* Damian Kula +* Dan King + +* Daniel Weindl + +* Daniele Nicolodi +* David Poznik +* David Toneian + +* Dea María Léon +* Deepak George + +* Dmitriy + +* Dominique Garmier + +* Donald Thevalingam + +* Doug Davis + +* Dukastlik + +* Elahe Sharifi + +* Eric Han + +* Fangchen Li +* Francisco Alfaro + +* Gadea Autric + +* Guillaume Lemaitre +* Hadi Abdi Khojasteh +* Hedeer El Showk + +* Huanghz2001 + +* Isaac Virshup +* Issam + +* Itay Azolay + +* Itayazolay + +* Jaca + +* Jack McIvor + +* JackCollins91 + +* James Spencer + +* Jay +* Jessica Greene +* Jirka Borovec + +* JohannaTrost + +* John C + +* Joris Van den Bossche +* José Lucas Mayer + +* José Lucas Silva Mayer + +* João Andrade + +* Kai Mühlbauer +* Katharina Tielking, MD + +* Kazuto Haruguchi + +* Kevin +* Lawrence Mitchell +* Linus + +* Linus Sommer + +* Louis-Émile Robitaille + +* Luke Manley +* Lumberbot (aka Jack) +* Maggie Liu + +* MainHanzo + +* Marc Garcia +* Marco Edward Gorelli +* MarcoGorelli +* Martin Šícho + +* Mateusz Sokół +* Matheus Felipe + +* Matthew Roeschke +* Matthias Bussonnier +* Maxwell Bileschi + +* Michael Tiemann +* Michał Górny +* Molly Bowers + +* Moritz Schubert + +* NNLNR + +* Natalia Mokeeva +* Nils Müller-Wendt + +* Omar Elbaz +* Pandas Development Team +* Paras Gupta + +* Parthi +* Patrick Hoefler +* Paul Pellissier + +* Paul Uhlenbruck + +* Philip Meier +* Philippe THOMY + +* Quang Nguyễn +* Raghav +* Rajat Subhra Mukherjee +* Ralf Gommers +* Randolf Scholz + +* Richard Shadrach +* Rob + +* Rohan Jain + +* Ryan Gibson + +* Sai-Suraj-27 + +* Samuel Oranyeli + +* Sara Bonati + +* Sebastian Berg +* Sergey Zakharov + +* Shyamala Venkatakrishnan + +* StEmGeo + +* Stefanie Molin +* Stijn de Gooijer + +* Thiago Gariani + +* Thomas A Caswell +* Thomas Baumann + +* Thomas Guillet + +* Thomas Lazarus + +* Thomas Li +* Tim Hoffmann +* Tim Swast +* Tom Augspurger +* Toro + +* Torsten Wörtwein +* Ville Aikas + +* Vinita Parasrampuria + +* Vyas Ramasubramani + +* William Andrea +* William Ayd +* Willian Wang + +* Xiao Yuan +* Yao Xiao +* Yves Delley +* Zemux1613 + +* Ziad Kermadi + +* aaron-robeson-8451 + +* aram-cinnamon + +* caneff + +* ccccjone + +* chris-caballero + +* cobalt +* color455nm + +* denisrei + +* dependabot[bot] +* jbrockmendel +* jfadia + +* johanna.trost + +* kgmuzungu + +* mecopur + +* mhb143 + +* morotti + +* mvirts + +* omar-elbaz +* paulreece +* pre-commit-ci[bot] +* raj-thapa +* rebecca-palmer +* rmhowe425 +* rohanjain101 +* shiersansi + +* smij720 +* srkds + +* taytzehao +* torext +* vboxuser + +* xzmeng + +* yashb + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_2.2.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_2.2.1.md new file mode 100644 index 0000000000000000000000000000000000000000..4cf6b7c70c189214da2d91dd45946c5c30d0dd5f --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_2.2.1.md @@ -0,0 +1,89 @@ +# What's new in pandas 2.2.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v2.2.1.html + +# What’s new in 2.2.1 (February 22, 2024)[#](#what-s-new-in-2-2-1-february-22-2024 "Link to this heading") + +These are the changes in pandas 2.2.1. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Enhancements[#](#enhancements "Link to this heading") + +* Added `pyarrow` pip extra so users can install pandas and pyarrow with pip with `pip install pandas[pyarrow]` ([GH 54466](https://github.com/pandas-dev/pandas/issues/54466)) + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* Fixed memory leak in [`read_csv()`](../reference/api/pandas.read_csv.html#pandas.read_csv "pandas.read_csv") ([GH 57039](https://github.com/pandas-dev/pandas/issues/57039)) +* Fixed performance regression in [`Series.combine_first()`](../reference/api/pandas.Series.combine_first.html#pandas.Series.combine_first "pandas.Series.combine_first") ([GH 55845](https://github.com/pandas-dev/pandas/issues/55845)) +* Fixed regression causing overflow for near-minimum timestamps ([GH 57150](https://github.com/pandas-dev/pandas/issues/57150)) +* Fixed regression in [`concat()`](../reference/api/pandas.concat.html#pandas.concat "pandas.concat") changing long-standing behavior that always sorted the non-concatenation axis when the axis was a [`DatetimeIndex`](../reference/api/pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex") ([GH 57006](https://github.com/pandas-dev/pandas/issues/57006)) +* Fixed regression in [`merge_ordered()`](../reference/api/pandas.merge_ordered.html#pandas.merge_ordered "pandas.merge_ordered") raising `TypeError` for `fill_method="ffill"` and `how="left"` ([GH 57010](https://github.com/pandas-dev/pandas/issues/57010)) +* Fixed regression in [`pandas.testing.assert_series_equal()`](../reference/api/pandas.testing.assert_series_equal.html#pandas.testing.assert_series_equal "pandas.testing.assert_series_equal") defaulting to `check_exact=True` when checking the [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") ([GH 57067](https://github.com/pandas-dev/pandas/issues/57067)) +* Fixed regression in [`read_json()`](../reference/api/pandas.read_json.html#pandas.read_json "pandas.read_json") where an [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") would be returned instead of a [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") ([GH 57429](https://github.com/pandas-dev/pandas/issues/57429)) +* Fixed regression in [`wide_to_long()`](../reference/api/pandas.wide_to_long.html#pandas.wide_to_long "pandas.wide_to_long") raising an `AttributeError` for string columns ([GH 57066](https://github.com/pandas-dev/pandas/issues/57066)) +* Fixed regression in [`DataFrameGroupBy.idxmin()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.idxmin.html#pandas.core.groupby.DataFrameGroupBy.idxmin "pandas.core.groupby.DataFrameGroupBy.idxmin"), [`DataFrameGroupBy.idxmax()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.idxmax.html#pandas.core.groupby.DataFrameGroupBy.idxmax "pandas.core.groupby.DataFrameGroupBy.idxmax"), [`SeriesGroupBy.idxmin()`](../reference/api/pandas.core.groupby.SeriesGroupBy.idxmin.html#pandas.core.groupby.SeriesGroupBy.idxmin "pandas.core.groupby.SeriesGroupBy.idxmin"), [`SeriesGroupBy.idxmax()`](../reference/api/pandas.core.groupby.SeriesGroupBy.idxmax.html#pandas.core.groupby.SeriesGroupBy.idxmax "pandas.core.groupby.SeriesGroupBy.idxmax") ignoring the `skipna` argument ([GH 57040](https://github.com/pandas-dev/pandas/issues/57040)) +* Fixed regression in [`DataFrameGroupBy.idxmin()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.idxmin.html#pandas.core.groupby.DataFrameGroupBy.idxmin "pandas.core.groupby.DataFrameGroupBy.idxmin"), [`DataFrameGroupBy.idxmax()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.idxmax.html#pandas.core.groupby.DataFrameGroupBy.idxmax "pandas.core.groupby.DataFrameGroupBy.idxmax"), [`SeriesGroupBy.idxmin()`](../reference/api/pandas.core.groupby.SeriesGroupBy.idxmin.html#pandas.core.groupby.SeriesGroupBy.idxmin "pandas.core.groupby.SeriesGroupBy.idxmin"), [`SeriesGroupBy.idxmax()`](../reference/api/pandas.core.groupby.SeriesGroupBy.idxmax.html#pandas.core.groupby.SeriesGroupBy.idxmax "pandas.core.groupby.SeriesGroupBy.idxmax") where values containing the minimum or maximum value for the dtype could produce incorrect results ([GH 57040](https://github.com/pandas-dev/pandas/issues/57040)) +* Fixed regression in `CategoricalIndex.difference()` raising `KeyError` when other contains null values other than NaN ([GH 57318](https://github.com/pandas-dev/pandas/issues/57318)) +* Fixed regression in [`DataFrame.groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") raising `ValueError` when grouping by a [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") in some cases ([GH 57276](https://github.com/pandas-dev/pandas/issues/57276)) +* Fixed regression in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") raising `IndexError` for non-unique, masked dtype indexes where result has more than 10,000 rows ([GH 57027](https://github.com/pandas-dev/pandas/issues/57027)) +* Fixed regression in [`DataFrame.loc()`](../reference/api/pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") which was unnecessarily throwing “incompatible dtype warning” when expanding with partial row indexer and multiple columns (see [PDEP6](https://pandas.pydata.org/pdeps/0006-ban-upcasting.html)) ([GH 56503](https://github.com/pandas-dev/pandas/issues/56503)) +* Fixed regression in [`DataFrame.map()`](../reference/api/pandas.DataFrame.map.html#pandas.DataFrame.map "pandas.DataFrame.map") with `na_action="ignore"` not being respected for NumPy nullable and `ArrowDtypes` ([GH 57316](https://github.com/pandas-dev/pandas/issues/57316)) +* Fixed regression in [`DataFrame.merge()`](../reference/api/pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge") raising `ValueError` for certain types of 3rd-party extension arrays ([GH 57316](https://github.com/pandas-dev/pandas/issues/57316)) +* Fixed regression in [`DataFrame.query()`](../reference/api/pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") with all `NaT` column with object dtype ([GH 57068](https://github.com/pandas-dev/pandas/issues/57068)) +* Fixed regression in [`DataFrame.shift()`](../reference/api/pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift") raising `AssertionError` for `axis=1` and empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 57301](https://github.com/pandas-dev/pandas/issues/57301)) +* Fixed regression in [`DataFrame.sort_index()`](../reference/api/pandas.DataFrame.sort_index.html#pandas.DataFrame.sort_index "pandas.DataFrame.sort_index") not producing a stable sort for a index with duplicates ([GH 57151](https://github.com/pandas-dev/pandas/issues/57151)) +* Fixed regression in [`DataFrame.to_dict()`](../reference/api/pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict") with `orient='list'` and datetime or timedelta types returning integers ([GH 54824](https://github.com/pandas-dev/pandas/issues/54824)) +* Fixed regression in [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") converting nullable integers to floats ([GH 57224](https://github.com/pandas-dev/pandas/issues/57224)) +* Fixed regression in [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") when `method="multi"` is passed and the dialect type is not Oracle ([GH 57310](https://github.com/pandas-dev/pandas/issues/57310)) +* Fixed regression in [`DataFrame.transpose()`](../reference/api/pandas.DataFrame.transpose.html#pandas.DataFrame.transpose "pandas.DataFrame.transpose") with nullable extension dtypes not having F-contiguous data potentially causing exceptions when used ([GH 57315](https://github.com/pandas-dev/pandas/issues/57315)) +* Fixed regression in [`DataFrame.update()`](../reference/api/pandas.DataFrame.update.html#pandas.DataFrame.update "pandas.DataFrame.update") emitting incorrect warnings about downcasting ([GH 57124](https://github.com/pandas-dev/pandas/issues/57124)) +* Fixed regression in `DataFrameGroupBy.idxmin()`, `DataFrameGroupBy.idxmax()`, `SeriesGroupBy.idxmin()`, `SeriesGroupBy.idxmax()` ignoring the `skipna` argument ([GH 57040](https://github.com/pandas-dev/pandas/issues/57040)) +* Fixed regression in `DataFrameGroupBy.idxmin()`, `DataFrameGroupBy.idxmax()`, `SeriesGroupBy.idxmin()`, `SeriesGroupBy.idxmax()` where values containing the minimum or maximum value for the dtype could produce incorrect results ([GH 57040](https://github.com/pandas-dev/pandas/issues/57040)) +* Fixed regression in `ExtensionArray.to_numpy()` raising for non-numeric masked dtypes ([GH 56991](https://github.com/pandas-dev/pandas/issues/56991)) +* Fixed regression in [`Index.join()`](../reference/api/pandas.Index.join.html#pandas.Index.join "pandas.Index.join") raising `TypeError` when joining an empty index to a non-empty index containing mixed dtype values ([GH 57048](https://github.com/pandas-dev/pandas/issues/57048)) +* Fixed regression in [`Series.astype()`](../reference/api/pandas.Series.astype.html#pandas.Series.astype "pandas.Series.astype") introducing decimals when converting from integer with missing values to string dtype ([GH 57418](https://github.com/pandas-dev/pandas/issues/57418)) +* Fixed regression in [`Series.pct_change()`](../reference/api/pandas.Series.pct_change.html#pandas.Series.pct_change "pandas.Series.pct_change") raising a `ValueError` for an empty [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") ([GH 57056](https://github.com/pandas-dev/pandas/issues/57056)) +* Fixed regression in [`Series.to_numpy()`](../reference/api/pandas.Series.to_numpy.html#pandas.Series.to_numpy "pandas.Series.to_numpy") when dtype is given as float and the data contains NaNs ([GH 57121](https://github.com/pandas-dev/pandas/issues/57121)) +* Fixed regression in addition or subtraction of `DateOffset` objects with millisecond components to `datetime64` [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index"), [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series"), or [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") ([GH 57529](https://github.com/pandas-dev/pandas/issues/57529)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Fixed bug in [`pandas.api.interchange.from_dataframe()`](../reference/api/pandas.api.interchange.from_dataframe.html#pandas.api.interchange.from_dataframe "pandas.api.interchange.from_dataframe") which was raising for Nullable integers ([GH 55069](https://github.com/pandas-dev/pandas/issues/55069)) +* Fixed bug in [`pandas.api.interchange.from_dataframe()`](../reference/api/pandas.api.interchange.from_dataframe.html#pandas.api.interchange.from_dataframe "pandas.api.interchange.from_dataframe") which was raising for empty inputs ([GH 56700](https://github.com/pandas-dev/pandas/issues/56700)) +* Fixed bug in [`pandas.api.interchange.from_dataframe()`](../reference/api/pandas.api.interchange.from_dataframe.html#pandas.api.interchange.from_dataframe "pandas.api.interchange.from_dataframe") which wasn’t converting columns names to strings ([GH 55069](https://github.com/pandas-dev/pandas/issues/55069)) +* Fixed bug in `DataFrame.__getitem__()` for empty [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") with Copy-on-Write enabled ([GH 57130](https://github.com/pandas-dev/pandas/issues/57130)) +* Fixed bug in [`PeriodIndex.asfreq()`](../reference/api/pandas.PeriodIndex.asfreq.html#pandas.PeriodIndex.asfreq "pandas.PeriodIndex.asfreq") which was silently converting frequencies which are not supported as period frequencies instead of raising an error ([GH 56945](https://github.com/pandas-dev/pandas/issues/56945)) + +## Other[#](#other "Link to this heading") + +Note + +The `DeprecationWarning` that was raised when pandas was imported without PyArrow being +installed has been removed. This decision was made because the warning was too noisy for too +many users and a lot of feedback was collected about the decision to make PyArrow a required +dependency. Pandas is currently considering the decision whether or not PyArrow should be added +as a hard dependency in 3.0. Interested users can follow the discussion +[here](https://github.com/pandas-dev/pandas/issues/57073). + +* Added the argument `skipna` to `DataFrameGroupBy.first()`, `DataFrameGroupBy.last()`, `SeriesGroupBy.first()`, and `SeriesGroupBy.last()`; achieving `skipna=False` used to be available via `DataFrameGroupBy.nth()`, but the behavior was changed in pandas 2.0.0 ([GH 57019](https://github.com/pandas-dev/pandas/issues/57019)) +* Added the argument `skipna` to `Resampler.first()`, `Resampler.last()` ([GH 57019](https://github.com/pandas-dev/pandas/issues/57019)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 14 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Albert Villanova del Moral +* Luke Manley +* Lumberbot (aka Jack) +* Marco Edward Gorelli +* Matthew Roeschke +* Natalia Mokeeva +* Pandas Development Team +* Patrick Hoefler +* Richard Shadrach +* Robert Schmidtke + +* Samuel Chai + +* Thomas Li +* William Ayd +* dependabot[bot] diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_2.2.2.md b/corpus/changelog/pandas_whatsnew/whatsnew_2.2.2.md new file mode 100644 index 0000000000000000000000000000000000000000..f3c819b45251d9b25ea015058580a557c4bf6e21 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_2.2.2.md @@ -0,0 +1,61 @@ +# What's new in pandas 2.2.2 + +Source: https://pandas.pydata.org/docs/whatsnew/v2.2.2.html + +# What’s new in 2.2.2 (April 10, 2024)[#](#what-s-new-in-2-2-2-april-10-2024 "Link to this heading") + +These are the changes in pandas 2.2.2. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Pandas 2.2.2 is now compatible with numpy 2.0[#](#pandas-2-2-2-is-now-compatible-with-numpy-2-0 "Link to this heading") + +Pandas 2.2.2 is the first version of pandas that is generally compatible with the upcoming +numpy 2.0 release, and wheels for pandas 2.2.2 will work with both numpy 1.x and 2.x. + +One major caveat is that arrays created with numpy 2.0’s new `StringDtype` will convert +to `object` dtyped arrays upon [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series")/[`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") creation. +Full support for numpy 2.0’s StringDtype is expected to land in pandas 3.0. + +As usual please report any bugs discovered to our [issue tracker](https://github.com/pandas-dev/pandas/issues/new/choose) + +## Fixed regressions[#](#fixed-regressions "Link to this heading") + +* [`DataFrame.__dataframe__()`](../reference/api/pandas.DataFrame.__dataframe__.html#pandas.DataFrame.__dataframe__ "pandas.DataFrame.__dataframe__") was producing incorrect data buffers when the a column’s type was a pandas nullable on with missing values ([GH 56702](https://github.com/pandas-dev/pandas/issues/56702)) +* [`DataFrame.__dataframe__()`](../reference/api/pandas.DataFrame.__dataframe__.html#pandas.DataFrame.__dataframe__ "pandas.DataFrame.__dataframe__") was producing incorrect data buffers when the a column’s type was a pyarrow nullable on with missing values ([GH 57664](https://github.com/pandas-dev/pandas/issues/57664)) +* Avoid issuing a spurious `DeprecationWarning` when a custom [`DataFrame`](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") or [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") subclass method is called ([GH 57553](https://github.com/pandas-dev/pandas/issues/57553)) +* Fixed regression in precision of [`to_datetime()`](../reference/api/pandas.to_datetime.html#pandas.to_datetime "pandas.to_datetime") with string and `unit` input ([GH 57051](https://github.com/pandas-dev/pandas/issues/57051)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* [`DataFrame.__dataframe__()`](../reference/api/pandas.DataFrame.__dataframe__.html#pandas.DataFrame.__dataframe__ "pandas.DataFrame.__dataframe__") was producing incorrect data buffers when the column’s type was nullable boolean ([GH 55332](https://github.com/pandas-dev/pandas/issues/55332)) +* [`DataFrame.__dataframe__()`](../reference/api/pandas.DataFrame.__dataframe__.html#pandas.DataFrame.__dataframe__ "pandas.DataFrame.__dataframe__") was showing bytemask instead of bitmask for `'string[pyarrow]'` validity buffer ([GH 57762](https://github.com/pandas-dev/pandas/issues/57762)) +* [`DataFrame.__dataframe__()`](../reference/api/pandas.DataFrame.__dataframe__.html#pandas.DataFrame.__dataframe__ "pandas.DataFrame.__dataframe__") was showing non-null validity buffer (instead of `None`) `'string[pyarrow]'` without missing values ([GH 57761](https://github.com/pandas-dev/pandas/issues/57761)) +* [`DataFrame.to_sql()`](../reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") was failing to find the right table when using the schema argument ([GH 57539](https://github.com/pandas-dev/pandas/issues/57539)) + +## Other[#](#other "Link to this heading") + +## Contributors[#](#contributors "Link to this heading") + +A total of 20 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Clément Robert +* Elliott Sales de Andrade +* Lumberbot (aka Jack) +* Marc Garcia +* Marco Edward Gorelli +* Marco Gorelli +* Mateusz Sokół +* Matthew Roeschke +* Natalia Mokeeva +* Pandas Development Team +* Sebastian Berg +* Shabab Karim + +* Thomas Baumann +* Thomas Li +* Trinh Quoc Anh + +* William Ayd +* Yuki Kitayama + +* Zhengbo Wang +* dependabot[bot] +* jbrockmendel diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_2.2.3.md b/corpus/changelog/pandas_whatsnew/whatsnew_2.2.3.md new file mode 100644 index 0000000000000000000000000000000000000000..b6510be5e88f7ce66e4399b992fbdd6747b70cc0 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_2.2.3.md @@ -0,0 +1,46 @@ +# What's new in pandas 2.2.3 + +Source: https://pandas.pydata.org/docs/whatsnew/v2.2.3.html + +# What’s new in 2.2.3 (September 20, 2024)[#](#what-s-new-in-2-2-3-september-20-2024 "Link to this heading") + +These are the changes in pandas 2.2.3. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Pandas 2.2.3 is now compatible with Python 3.13[#](#pandas-2-2-3-is-now-compatible-with-python-3-13 "Link to this heading") + +Pandas 2.2.3 is the first version of pandas that is generally compatible with the upcoming +Python 3.13, and both wheels for free-threaded and normal Python 3.13 will be uploaded for +this release. + +As usual please report any bugs discovered to our [issue tracker](https://github.com/pandas-dev/pandas/issues/new/choose) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in [`eval()`](../reference/api/pandas.eval.html#pandas.eval "pandas.eval") on [`complex`](https://docs.python.org/3/library/functions.html#complex "(in Python v3.13)") including division `/` discards imaginary part. ([GH 21374](https://github.com/pandas-dev/pandas/issues/21374)) +* Minor fixes for numpy 2.1 compatibility. ([GH 59444](https://github.com/pandas-dev/pandas/issues/59444)) + +## Other[#](#other "Link to this heading") + +* Missing licenses for 3rd party dependencies were added back into the wheels. ([GH 58632](https://github.com/pandas-dev/pandas/issues/58632)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 15 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Abdulaziz Aloqeely + +* Ben Greiner +* Elliott Sales de Andrade +* Ewout ter Hoeven +* Joris Van den Bossche +* Laurent Mutricy + +* Lumberbot (aka Jack) +* Lysandros Nikolaou + +* Matthew Roeschke +* Mohammad Ahmadi + +* Pandas Development Team +* Patrick Hoefler +* Thomas Li +* dependabot[bot] +* pre-commit-ci[bot] diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_2.3.0.md b/corpus/changelog/pandas_whatsnew/whatsnew_2.3.0.md new file mode 100644 index 0000000000000000000000000000000000000000..bbf22337d492cd05fe5134ce4ab2476717a93815 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_2.3.0.md @@ -0,0 +1,180 @@ +# What's new in pandas 2.3.0 + +Source: https://pandas.pydata.org/docs/whatsnew/v2.3.0.html + +# What’s new in 2.3.0 (June 4, 2025)[#](#what-s-new-in-2-3-0-june-4-2025 "Link to this heading") + +These are the changes in pandas 2.3.0. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Upcoming changes in pandas 3.0[#](#upcoming-changes-in-pandas-3-0 "Link to this heading") + +pandas 3.0 will bring two bigger changes to the default behavior of pandas. + +### Dedicated string data type by default[#](#dedicated-string-data-type-by-default "Link to this heading") + +Historically, pandas represented string columns with NumPy `object` data type. +This representation has numerous problems: it is not specific to strings (any +Python object can be stored in an `object`-dtype array, not just strings) and +it is often not very efficient (both performance wise and for memory usage). + +Starting with the upcoming pandas 3.0 release, a dedicated string data type will +be enabled by default (backed by PyArrow under the hood, if installed, otherwise +falling back to NumPy). This means that pandas will start inferring columns +containing string data as the new `str` data type when creating pandas +objects, such as in constructors or IO functions. + +Old behavior: + +```None +>>> ser = pd.Series(["a", "b"]) +0 a +1 b +dtype: object +``` + +New behavior: + +```None +>>> ser = pd.Series(["a", "b"]) +0 a +1 b +dtype: str +``` + +The string data type that is used in these scenarios will mostly behave as NumPy +object would, including missing value semantics and general operations on these +columns. + +However, the introduction of a new default dtype will also have some breaking +consequences to your code (for example when checking for the `.dtype` being +object dtype). To allow testing it in advance of the pandas 3.0 release, this +future dtype inference logic can be enabled in pandas 2.3 with: + +```None +pd.options.future.infer_string = True +``` + +See the [Migration guide for the new string data type (pandas 3.0)](../user_guide/migration-3-strings.html#string-migration-guide) for more details on the behaviour changes +and how to adapt your code to the new default. + +### Copy-on-Write[#](#copy-on-write "Link to this heading") + +The currently optional mode Copy-on-Write will be enabled by default in pandas 3.0. There +won’t be an option to retain the legacy behavior. + +In summary, the new “copy-on-write” behaviour will bring changes in behavior in +how pandas operates with respect to copies and views. + +1. The result of *any* indexing operation (subsetting a DataFrame or Series in any way, + i.e. including accessing a DataFrame column as a Series) or any method returning a + new DataFrame or Series, always *behaves as if* it were a copy in terms of user + API. +2. As a consequence, if you want to modify an object (DataFrame or Series), the only way + to do this is to directly modify that object itself. + +Because every single indexing step now behaves as a copy, this also means that +“chained assignment” (updating a DataFrame with multiple setitem steps) will +stop working. Because this now consistently never works, the +`SettingWithCopyWarning` will be removed. + +The new behavioral semantics are explained in more detail in the +[user guide about Copy-on-Write](../user_guide/copy_on_write.html#copy-on-write). + +The new behavior can be enabled since pandas 2.0 with the following option: + +```None +pd.options.mode.copy_on_write = True +``` + +Some of the behaviour changes allow a clear deprecation, like the changes in +chained assignment. Other changes are more subtle and thus, the warnings are +hidden behind an option that can be enabled since pandas 2.2: + +```None +pd.options.mode.copy_on_write = "warn" +``` + +This mode will warn in many different scenarios that aren’t actually relevant to +most queries. We recommend exploring this mode, but it is not necessary to get rid +of all of these warnings. The [migration guide](../user_guide/copy_on_write.html#copy-on-write-migration-guide) +explains the upgrade process in more detail. + +## Enhancements[#](#enhancements "Link to this heading") + +### Other enhancements[#](#other-enhancements "Link to this heading") + +* The semantics for the `copy` keyword in `__array__` methods (i.e. called + when using `np.array()` or `np.asarray()` on pandas objects) has been + updated to work correctly with NumPy >= 2 ([GH 57739](https://github.com/pandas-dev/pandas/issues/57739)) +* [`Series.str.decode()`](../reference/api/pandas.Series.str.decode.html#pandas.Series.str.decode "pandas.Series.str.decode") result now has [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") when `future.infer_string` is True ([GH 60709](https://github.com/pandas-dev/pandas/issues/60709)) +* [`to_hdf()`](../reference/api/pandas.Series.to_hdf.html#pandas.Series.to_hdf "pandas.Series.to_hdf") and [`to_hdf()`](../reference/api/pandas.DataFrame.to_hdf.html#pandas.DataFrame.to_hdf "pandas.DataFrame.to_hdf") now round-trip with [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") ([GH 60663](https://github.com/pandas-dev/pandas/issues/60663)) +* Improved `repr` of [`NumpyExtensionArray`](../reference/api/pandas.arrays.NumpyExtensionArray.html#pandas.arrays.NumpyExtensionArray "pandas.arrays.NumpyExtensionArray") to account for NEP51 ([GH 61085](https://github.com/pandas-dev/pandas/issues/61085)) +* The [`Series.str.decode()`](../reference/api/pandas.Series.str.decode.html#pandas.Series.str.decode "pandas.Series.str.decode") has gained the argument `dtype` to control the dtype of the result ([GH 60940](https://github.com/pandas-dev/pandas/issues/60940)) +* The [`cumsum()`](../reference/api/pandas.Series.cumsum.html#pandas.Series.cumsum "pandas.Series.cumsum"), [`cummin()`](../reference/api/pandas.Series.cummin.html#pandas.Series.cummin "pandas.Series.cummin"), and [`cummax()`](../reference/api/pandas.Series.cummax.html#pandas.Series.cummax "pandas.Series.cummax") reductions are now implemented for [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") columns ([GH 60633](https://github.com/pandas-dev/pandas/issues/60633)) +* The [`sum()`](../reference/api/pandas.Series.sum.html#pandas.Series.sum "pandas.Series.sum") reduction is now implemented for [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") columns ([GH 59853](https://github.com/pandas-dev/pandas/issues/59853)) + +## Deprecations[#](#deprecations "Link to this heading") + +* Deprecated allowing non-`bool` values for `na` in [`str.contains()`](../reference/api/pandas.Series.str.contains.html#pandas.Series.str.contains "pandas.Series.str.contains"), [`str.startswith()`](../reference/api/pandas.Series.str.startswith.html#pandas.Series.str.startswith "pandas.Series.str.startswith"), and [`str.endswith()`](../reference/api/pandas.Series.str.endswith.html#pandas.Series.str.endswith "pandas.Series.str.endswith") for dtypes that do not already disallow these ([GH 59615](https://github.com/pandas-dev/pandas/issues/59615)) +* Deprecated the `"pyarrow_numpy"` storage option for [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") ([GH 60152](https://github.com/pandas-dev/pandas/issues/60152)) +* The deprecation of setting the argument `include_groups` to `True` in `DataFrameGroupBy.apply()` has been promoted from a `DeprecationWarning` to `FutureWarning`; only `False` will be allowed ([GH 7155](https://github.com/pandas-dev/pandas/issues/7155)) + +## Bug fixes[#](#bug-fixes "Link to this heading") + +### Numeric[#](#numeric "Link to this heading") + +* Bug in [`Series.mode()`](../reference/api/pandas.Series.mode.html#pandas.Series.mode "pandas.Series.mode") and [`DataFrame.mode()`](../reference/api/pandas.DataFrame.mode.html#pandas.DataFrame.mode "pandas.DataFrame.mode") with `dropna=False` where not all dtypes would sort in the presence of `NA` values ([GH 60702](https://github.com/pandas-dev/pandas/issues/60702)) +* Bug in [`Series.round()`](../reference/api/pandas.Series.round.html#pandas.Series.round "pandas.Series.round") where a `TypeError` would always raise with `object` dtype ([GH 61206](https://github.com/pandas-dev/pandas/issues/61206)) + +### Strings[#](#strings "Link to this heading") + +* Bug in `Series.__pos__()` and `DataFrame.__pos__()` where an `Exception` was not raised for [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") with `storage="pyarrow"` ([GH 60710](https://github.com/pandas-dev/pandas/issues/60710)) +* Bug in [`Series.rank()`](../reference/api/pandas.Series.rank.html#pandas.Series.rank "pandas.Series.rank") for [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") with `storage="pyarrow"` that incorrectly returned integer results with `method="average"` and raised an error if it would truncate results ([GH 59768](https://github.com/pandas-dev/pandas/issues/59768)) +* Bug in [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") with [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") when replacing with a non-string value was not upcasting to `object` dtype ([GH 60282](https://github.com/pandas-dev/pandas/issues/60282)) +* Bug in [`Series.str.center()`](../reference/api/pandas.Series.str.center.html#pandas.Series.str.center "pandas.Series.str.center") with [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") with `storage="pyarrow"` not matching the python behavior in corner cases with an odd number of fill characters ([GH 54792](https://github.com/pandas-dev/pandas/issues/54792)) +* Bug in [`Series.str.replace()`](../reference/api/pandas.Series.str.replace.html#pandas.Series.str.replace "pandas.Series.str.replace") when `n < 0` for [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") with `storage="pyarrow"` ([GH 59628](https://github.com/pandas-dev/pandas/issues/59628)) +* Bug in [`Series.str.slice()`](../reference/api/pandas.Series.str.slice.html#pandas.Series.str.slice "pandas.Series.str.slice") with negative `step` with [`ArrowDtype`](../reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype "pandas.ArrowDtype") and [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") with `storage="pyarrow"` giving incorrect results ([GH 59710](https://github.com/pandas-dev/pandas/issues/59710)) + +### Indexing[#](#indexing "Link to this heading") + +* Bug in [`Index.get_indexer()`](../reference/api/pandas.Index.get_indexer.html#pandas.Index.get_indexer "pandas.Index.get_indexer") round-tripping through string dtype when `infer_string` is enabled ([GH 55834](https://github.com/pandas-dev/pandas/issues/55834)) + +### I/O[#](#i-o "Link to this heading") + +* Bug in [`DataFrame.to_excel()`](../reference/api/pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel") which stored decimals as strings instead of numbers ([GH 49598](https://github.com/pandas-dev/pandas/issues/49598)) + +### Other[#](#other "Link to this heading") + +* Fixed usage of `inspect` when the optional dependencies `pyarrow` or `jinja2` + are not installed ([GH 60196](https://github.com/pandas-dev/pandas/issues/60196)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 24 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* ChiLin Chiu + +* Irv Lustig +* Isuru Fernando + +* Jake Thomas Trevallion + +* Joris Van den Bossche +* Kevin Amparado + +* LOCHAN PAUDEL + +* Lumberbot (aka Jack) +* Marc Mueller + +* Marco Edward Gorelli +* Matthew Roeschke +* Pandas Development Team +* Patrick Hoefler +* Richard Shadrach +* SALCAN + +* Sebastian Berg +* Simon Hawkins +* Thomas Li +* Will Ayd +* William Andrea +* William Ayd +* dependabot[bot] +* jbrockmendel +* tasfia8 + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_2.3.1.md b/corpus/changelog/pandas_whatsnew/whatsnew_2.3.1.md new file mode 100644 index 0000000000000000000000000000000000000000..b7bafd400ed05ea122039b053ba47ab27b59bd3d --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_2.3.1.md @@ -0,0 +1,70 @@ +# What's new in pandas 2.3.1 + +Source: https://pandas.pydata.org/docs/whatsnew/v2.3.1.html + +# What’s new in 2.3.1 (July 7, 2025)[#](#what-s-new-in-2-3-1-july-7-2025 "Link to this heading") + +These are the changes in pandas 2.3.1. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Improvements and fixes for the StringDtype[#](#improvements-and-fixes-for-the-stringdtype "Link to this heading") + +Most changes in this release are related to [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") which will +become the default string dtype in pandas 3.0. See +[Upcoming changes in pandas 3.0](v2.3.0.html#whatsnew-230-upcoming-changes) for more details. + +### Comparisons between different string dtypes[#](#comparisons-between-different-string-dtypes "Link to this heading") + +In previous versions, comparing [`Series`](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") of different string dtypes (e.g. `pd.StringDtype("pyarrow", na_value=pd.NA)` against `pd.StringDtype("python", na_value=np.nan)`) would result in inconsistent resulting dtype or incorrectly raise ([GH 60639](https://github.com/pandas-dev/pandas/issues/60639)). pandas will now use the hierarchy + +> object < (python, NaN) < (pyarrow, NaN) < (python, NA) < (pyarrow, NA) + +in determining the result dtype when there are different string dtypes compared. Some examples: + +* When `pd.StringDtype("pyarrow", na_value=pd.NA)` is compared against any other string dtype, the result will always be `boolean[pyarrow]`. +* When `pd.StringDtype("python", na_value=pd.NA)` is compared against `pd.StringDtype("pyarrow", na_value=np.nan)`, the result will be `boolean`, the NumPy-backed nullable extension array. +* When `pd.StringDtype("python", na_value=pd.NA)` is compared against `pd.StringDtype("python", na_value=np.nan)`, the result will be `boolean`, the NumPy-backed nullable extension array. + +### Index set operations ignore empty RangeIndex and object dtype Index[#](#index-set-operations-ignore-empty-rangeindex-and-object-dtype-index "Link to this heading") + +When enabling the `future.infer_string` option, [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") set operations (like +union or intersection) will now ignore the dtype of an empty [`RangeIndex`](../reference/api/pandas.RangeIndex.html#pandas.RangeIndex "pandas.RangeIndex") or +empty [`Index`](../reference/api/pandas.Index.html#pandas.Index "pandas.Index") with `object` dtype when determining the dtype of the resulting +Index ([GH 60797](https://github.com/pandas-dev/pandas/issues/60797)). + +This ensures that combining such empty Index with strings will infer the string dtype +correctly, rather than defaulting to `object` dtype. For example: + +```None +>>> pd.options.future.infer_string = True +>>> df = pd.DataFrame() +>>> df.columns.dtype +dtype('int64') # default RangeIndex for empty columns +>>> df["a"] = [1, 2, 3] +>>> df.columns.dtype + # new columns use string dtype instead of object dtype +``` + +### Bug fixes[#](#bug-fixes "Link to this heading") + +* Bug in [`DataFrameGroupBy.min()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.min.html#pandas.core.groupby.DataFrameGroupBy.min "pandas.core.groupby.DataFrameGroupBy.min"), [`DataFrameGroupBy.max()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.max.html#pandas.core.groupby.DataFrameGroupBy.max "pandas.core.groupby.DataFrameGroupBy.max"), [`Resampler.min()`](../reference/api/pandas.core.resample.Resampler.min.html#pandas.core.resample.Resampler.min "pandas.core.resample.Resampler.min"), [`Resampler.max()`](../reference/api/pandas.core.resample.Resampler.max.html#pandas.core.resample.Resampler.max "pandas.core.resample.Resampler.max") where all NA values of string dtype would return float instead of string dtype ([GH 60810](https://github.com/pandas-dev/pandas/issues/60810)) +* Bug in [`DataFrame.join()`](../reference/api/pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") incorrectly downcasting object-dtype indexes ([GH 61771](https://github.com/pandas-dev/pandas/issues/61771)) +* Bug in [`DataFrame.sum()`](../reference/api/pandas.DataFrame.sum.html#pandas.DataFrame.sum "pandas.DataFrame.sum") with `axis=1`, [`DataFrameGroupBy.sum()`](../reference/api/pandas.core.groupby.DataFrameGroupBy.sum.html#pandas.core.groupby.DataFrameGroupBy.sum "pandas.core.groupby.DataFrameGroupBy.sum") or [`SeriesGroupBy.sum()`](../reference/api/pandas.core.groupby.SeriesGroupBy.sum.html#pandas.core.groupby.SeriesGroupBy.sum "pandas.core.groupby.SeriesGroupBy.sum") with `skipna=True`, and [`Resampler.sum()`](../reference/api/pandas.core.resample.Resampler.sum.html#pandas.core.resample.Resampler.sum "pandas.core.resample.Resampler.sum") with all NA values of [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") resulted in `0` instead of the empty string `""` ([GH 60229](https://github.com/pandas-dev/pandas/issues/60229)) +* Fixed bug in [`DataFrame.explode()`](../reference/api/pandas.DataFrame.explode.html#pandas.DataFrame.explode "pandas.DataFrame.explode") and [`Series.explode()`](../reference/api/pandas.Series.explode.html#pandas.Series.explode "pandas.Series.explode") where methods would fail with `dtype="str"` ([GH 61623](https://github.com/pandas-dev/pandas/issues/61623)) +* Fixed bug in unpickling objects pickled in pandas versions pre-2.3.0 that used [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") ([GH 61763](https://github.com/pandas-dev/pandas/issues/61763)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 10 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* David Krych +* Irv Lustig +* Joris Van den Bossche +* Lumberbot (aka Jack) +* Marc Garcia +* Matthew Roeschke +* Pandas Development Team +* Ralf Gommers +* Richard Shadrach +* jbrockmendel diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_2.3.2.md b/corpus/changelog/pandas_whatsnew/whatsnew_2.3.2.md new file mode 100644 index 0000000000000000000000000000000000000000..c0372eaa3d5c1a579569ef7afb09abf6f2f8b670 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_2.3.2.md @@ -0,0 +1,41 @@ +# What's new in pandas 2.3.2 + +Source: https://pandas.pydata.org/docs/whatsnew/v2.3.2.html + +# What’s new in 2.3.2 (August 21, 2025)[#](#what-s-new-in-2-3-2-august-21-2025 "Link to this heading") + +These are the changes in pandas 2.3.2. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Improvements and fixes for the StringDtype[#](#improvements-and-fixes-for-the-stringdtype "Link to this heading") + +Most changes in this release are related to [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") which will +become the default string dtype in pandas 3.0. See +[Upcoming changes in pandas 3.0](v2.3.0.html#whatsnew-230-upcoming-changes) for more details. + +### Bug fixes[#](#bug-fixes "Link to this heading") + +* Fix [`to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") with `orient="table"` to correctly use the + “string” type in the JSON Table Schema for [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") columns + ([GH 61889](https://github.com/pandas-dev/pandas/issues/61889)) +* Boolean operations (`|`, `&`, `^`) with bool-dtype objects on the left and [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") objects on the right now cast the string to bool, with a deprecation warning ([GH 60234](https://github.com/pandas-dev/pandas/issues/60234)) +* Fixed [`match()`](../reference/api/pandas.Series.str.match.html#pandas.Series.str.match "pandas.Series.str.match"), [`fullmatch()`](../reference/api/pandas.Series.str.fullmatch.html#pandas.Series.str.fullmatch "pandas.Series.str.fullmatch") and [`contains()`](../reference/api/pandas.Series.str.contains.html#pandas.Series.str.contains "pandas.Series.str.contains") + string methods with compiled regex for the Arrow-backed string dtype ([GH 61964](https://github.com/pandas-dev/pandas/issues/61964), [GH 61942](https://github.com/pandas-dev/pandas/issues/61942)) +* Bug in [`Series.replace()`](../reference/api/pandas.Series.replace.html#pandas.Series.replace "pandas.Series.replace") and [`DataFrame.replace()`](../reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace") inconsistently + replacing matching values when missing values are present for string dtypes ([GH 56599](https://github.com/pandas-dev/pandas/issues/56599)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 10 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* Aniket + +* Asish Mahapatra +* Irv Lustig +* Joris Van den Bossche +* Khemkaran + +* Khemkaran Sevta + +* Lumberbot (aka Jack) +* Richard Shadrach +* jbrockmendel +* pandas Development Team + diff --git a/corpus/changelog/pandas_whatsnew/whatsnew_2.3.3.md b/corpus/changelog/pandas_whatsnew/whatsnew_2.3.3.md new file mode 100644 index 0000000000000000000000000000000000000000..4e943780692409e19b596f229ea6e4be75270d27 --- /dev/null +++ b/corpus/changelog/pandas_whatsnew/whatsnew_2.3.3.md @@ -0,0 +1,77 @@ +# What's new in pandas 2.3.3 + +Source: https://pandas.pydata.org/docs/whatsnew/v2.3.3.html + +# What’s new in 2.3.3 (September 29, 2025)[#](#what-s-new-in-2-3-3-september-29-2025 "Link to this heading") + +These are the changes in pandas 2.3.3. See [Release notes](index.html#release) for a full changelog +including other versions of pandas. + +## Pandas 2.3.3 is now compatible with Python 3.14[#](#pandas-2-3-3-is-now-compatible-with-python-3-14 "Link to this heading") + +Pandas 2.3.3 is the first version of pandas that is generally compatible with the upcoming +Python 3.14, and both wheels for free-threaded and normal Python 3.14 will be uploaded for +this release. + +As usual please report any bugs discovered to our [issue tracker](https://github.com/pandas-dev/pandas/issues/new/choose) + +## Improvements and fixes for the StringDtype[#](#improvements-and-fixes-for-the-stringdtype "Link to this heading") + +Most changes in this release are related to [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") which will +become the default string dtype in pandas 3.0. See +[Upcoming changes in pandas 3.0](v2.3.0.html#whatsnew-230-upcoming-changes) for more details. + +### Improvements[#](#improvements "Link to this heading") + +* Update [`DataFrame.select_dtypes()`](../reference/api/pandas.DataFrame.select_dtypes.html#pandas.DataFrame.select_dtypes "pandas.DataFrame.select_dtypes") to keep selecting `str` columns when + specifying `include=["object"]` for backwards compatibility. In a future + release, this will be deprecated and code for pandas 3+ should be updated to + do `include=["str"]` ([GH 61916](https://github.com/pandas-dev/pandas/issues/61916)) +* Support the `/` operation between a `pathlib.Path` object and a [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") + Series, similarly as it works for object-dtype Series ([GH 61940](https://github.com/pandas-dev/pandas/issues/61940)) + +### Bug fixes[#](#bug-fixes "Link to this heading") + +* Fix bug in [`Series.str.replace()`](../reference/api/pandas.Series.str.replace.html#pandas.Series.str.replace "pandas.Series.str.replace") using named capture groups (e.g., `\g`) with the Arrow-backed dtype would raise an error ([GH 57636](https://github.com/pandas-dev/pandas/issues/57636)) +* Fix regression in [`Series.str.contains()`](../reference/api/pandas.Series.str.contains.html#pandas.Series.str.contains "pandas.Series.str.contains"), [`match()`](../reference/api/pandas.Series.str.match.html#pandas.Series.str.match "pandas.Series.str.match") and [`fullmatch()`](../reference/api/pandas.Series.str.fullmatch.html#pandas.Series.str.fullmatch "pandas.Series.str.fullmatch") + with a compiled regex and custom flags ([GH 62240](https://github.com/pandas-dev/pandas/issues/62240)) +* Fix [`Series.str.match()`](../reference/api/pandas.Series.str.match.html#pandas.Series.str.match "pandas.Series.str.match") and [`fullmatch()`](../reference/api/pandas.Series.str.fullmatch.html#pandas.Series.str.fullmatch "pandas.Series.str.fullmatch") not matching patterns with groups correctly for the Arrow-backed string dtype ([GH 61072](https://github.com/pandas-dev/pandas/issues/61072)) +* Fix bug in [`groupby()`](../reference/api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") with `sum()` and unobserved categories resulting in `0` instead of the empty string `""` ([GH 61909](https://github.com/pandas-dev/pandas/issues/61909)) +* Fix [`Series.str.isdigit()`](../reference/api/pandas.Series.str.isdigit.html#pandas.Series.str.isdigit "pandas.Series.str.isdigit") to correctly recognize unicode superscript + characters as digits for [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") backed by PyArrow ([GH 61466](https://github.com/pandas-dev/pandas/issues/61466)) +* Fix comparing a [`StringDtype`](../reference/api/pandas.StringDtype.html#pandas.StringDtype "pandas.StringDtype") Series with mixed objects raising an error ([GH 60228](https://github.com/pandas-dev/pandas/issues/60228)) +* Fix error being raised when using a numpy ufunc with a Python-backed string array ([GH 40800](https://github.com/pandas-dev/pandas/issues/40800)) + +## Other changes[#](#other-changes "Link to this heading") + +* The deprecation of using [`Series.resample()`](../reference/api/pandas.Series.resample.html#pandas.Series.resample "pandas.Series.resample") and [`DataFrame.resample()`](../reference/api/pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample") + with a [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") (and the ‘convention’ keyword) has been undone. + Resampling with a [`PeriodIndex`](../reference/api/pandas.PeriodIndex.html#pandas.PeriodIndex "pandas.PeriodIndex") is supported again, but a subset of + methods that return incorrect results will raise an error in pandas 3.0 ([GH 57033](https://github.com/pandas-dev/pandas/issues/57033)) + +## Other bug fixes[#](#other-bug-fixes "Link to this heading") + +* Fix memory leak in [`DataFrame.to_json()`](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") with datetime columns ([GH 62204](https://github.com/pandas-dev/pandas/issues/62204)) +* Fixed regression in [`DataFrame.from_records()`](../reference/api/pandas.DataFrame.from_records.html#pandas.DataFrame.from_records "pandas.DataFrame.from_records") not initializing subclasses properly ([GH 57008](https://github.com/pandas-dev/pandas/issues/57008)) +* The [`DataFrame.iloc()`](../reference/api/pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") now works correctly with `copy_on_write` option when assigning values after subsetting the columns of a homogeneous DataFrame ([GH 60309](https://github.com/pandas-dev/pandas/issues/60309)) + +## Contributors[#](#contributors "Link to this heading") + +A total of 15 people contributed patches to this release. People with a +“+” by their names contributed a patch for the first time. + +* ChiLin Chiu +* Evgenii Mosikhin + +* Ian Hunt-Isaak + +* Joris Van den Bossche +* Laurie O + +* Lumberbot (aka Jack) +* Matthew Roeschke +* Nathan Goldbaum +* Patrick Hoefler +* Richard Shadrach +* Scott Talbert +* jbrockmendel +* pandas Development Team +* ptth222 + +* Álvaro Kothe + diff --git a/corpus/changelog/postgresql_releases/postgresql_130.md b/corpus/changelog/postgresql_releases/postgresql_130.md new file mode 100644 index 0000000000000000000000000000000000000000..975f4b3b80bbccdbe173925ffb9cc532a6c4ba90 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_130.md @@ -0,0 +1,874 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.0/ +Version: 13.0 + +## PostgreSQL 13.0 + +| E.24. Release 13 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-1.html "E.23. Release 13.1") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-prior.html "E.25. Prior Releases") | + +--- + +## E.24. Release 13 + +[E.24.1. Overview](release-13.html#id-1.11.6.29.3) + +[E.24.2. Migration to Version 13](release-13.html#id-1.11.6.29.4) + +[E.24.3. Changes](release-13.html#id-1.11.6.29.5) + +[E.24.4. Acknowledgments](release-13.html#RELEASE-13-ACKNOWLEDGEMENTS) + +**Release date:**2020-09-24 + +### E.24.1. Overview + +PostgreSQL 13 contains many new features and enhancements, including: + +* Space savings and performance gains from de-duplication of B-tree index entries +* Improved performance for queries that use aggregates or partitioned tables +* Better query planning when using extended statistics +* Parallelized vacuuming of indexes +* Incremental sorting + +The above items and other new features of PostgreSQL 13 are explained in more detail in the sections below. + +### E.24.2. Migration to Version 13 + +A dump/restore using [pg\_dumpall](app-pg-dumpall.html "pg_dumpall") or use of [pg\_upgrade](pgupgrade.html "pg_upgrade") or logical replication is required for those wishing to migrate data from any previous release. See [Section 18.6](upgrading.html "18.6. Upgrading a PostgreSQL Cluster") for general information on migrating to new major releases. + +Version 13 contains a number of changes that may affect compatibility with previous releases. Observe the following incompatibilities: + +* Change [`SIMILAR TO ... ESCAPE NULL`](functions-matching.html#FUNCTIONS-SIMILARTO-REGEXP "9.7.2. SIMILAR TO Regular Expressions") to return `NULL` (Tom Lane) [§](https://postgr.es/c/ca70bdaef) + + This new behavior matches the SQL specification. Previously a null `ESCAPE` value was taken to mean using the default escape string (a backslash character). This also applies to `substring(text FROM pattern ESCAPE text)`. The previous behavior has been retained in old views by keeping the original function unchanged. +* Make [`json[b]_to_tsvector()`](functions-textsearch.html#TEXTSEARCH-FUNCTIONS-TABLE "Table 9.42. Text Search Functions") fully check the spelling of its `string` option (Dominik Czarnota) [§](https://postgr.es/c/870ad6a59) +* Change the way non-default [effective\_io\_concurrency](runtime-config-resource.html#GUC-EFFECTIVE-IO-CONCURRENCY) values affect concurrency (Thomas Munro) [§](https://postgr.es/c/b09ff5366) + + Previously, this value was adjusted before setting the number of concurrent requests. The value is now used directly. Conversion of old values to new ones can be done using: + + ```None + SELECT round(sum(OLDVALUE / n::float)) AS newvalue FROM generate_series(1, OLDVALUE) s(n); + ``` +* Prevent display of auxiliary processes in [pg\_stat\_ssl](monitoring-stats.html#PG-STAT-SSL-VIEW "Table 27.17. pg_stat_ssl View") and [pg\_stat\_gssapi](monitoring-stats.html#PG-STAT-GSSAPI-VIEW "Table 27.18. pg_stat_gssapi View") system views (Euler Taveira) [§](https://postgr.es/c/5c46e7d82) + + Queries that join these views to [pg\_stat\_activity](monitoring-stats.html#PG-STAT-ACTIVITY-VIEW "Table 27.3. pg_stat_activity View") and wish to see auxiliary processes will need to use left joins. +* Rename various [wait events](monitoring-stats.html#WAIT-EVENT-TABLE "Table 27.4. Wait Event Types") to improve consistency (Fujii Masao, Tom Lane) [§](https://postgr.es/c/1d253bae5) [§](https://postgr.es/c/36ac359d3) [§](https://postgr.es/c/474e7da64) [§](https://postgr.es/c/14a910109) [§](https://postgr.es/c/3048898e7) +* Fix [`ALTER FOREIGN TABLE ... RENAME COLUMN`](sql-alterforeigntable.html "ALTER FOREIGN TABLE") to return a more appropriate command tag (Fujii Masao) [§](https://postgr.es/c/979766c0a) + + Previously it returned `ALTER TABLE`; now it returns `ALTER FOREIGN TABLE`. +* Fix [`ALTER MATERIALIZED VIEW ... RENAME COLUMN`](sql-altermaterializedview.html "ALTER MATERIALIZED VIEW") to return a more appropriate command tag (Fujii Masao) [§](https://postgr.es/c/979766c0a) + + Previously it returned `ALTER TABLE`; now it returns `ALTER MATERIALIZED VIEW`. +* Rename configuration parameter `wal_keep_segments` to [wal\_keep\_size](runtime-config-replication.html#GUC-WAL-KEEP-SIZE) (Fujii Masao) [§](https://postgr.es/c/f5dff45962) + + This determines how much WAL to retain for standby servers. It is specified in megabytes, rather than number of files as with the old parameter. If you previously used `wal_keep_segments`, the following formula will give you an approximately equivalent setting: + + ```None + wal_keep_size = wal_keep_segments * wal_segment_size (typically 16MB) + ``` +* Remove support for defining [operator classes](sql-createopclass.html "CREATE OPERATOR CLASS") using pre-PostgreSQL 8.0 syntax (Daniel Gustafsson) [§](https://postgr.es/c/84eca14bc) +* Remove support for defining [foreign key constraints](sql-altertable.html "ALTER TABLE") using pre-PostgreSQL 7.3 syntax (Daniel Gustafsson) [§](https://postgr.es/c/e58a59975) +* Remove support for "opaque" [pseudo-types](sql-createtype.html "CREATE TYPE") used by pre-PostgreSQL 7.3 servers (Daniel Gustafsson) [§](https://postgr.es/c/bb03010b9) +* Remove support for upgrading unpackaged (pre-9.1) extensions (Tom Lane) [§](https://postgr.es/c/70a773200) + + The `FROM` option of [`CREATE EXTENSION`](sql-createextension.html "CREATE EXTENSION") is no longer supported. Any installations still using unpackaged extensions should upgrade them to a packaged version before updating to PostgreSQL 13. +* Remove support for `posixrules` files in the timezone database (Tom Lane) [§](https://postgr.es/c/21aac2ff9) + + IANA's timezone group has deprecated this feature, meaning that it will gradually disappear from systems' timezone databases over the next few years. Rather than have a behavioral change appear unexpectedly with a timezone data update, we have removed PostgreSQL's support for this feature as of version 13. This affects only the behavior of [POSIX-style time zone specifications](datetime-posix-timezone-specs.html "B.5. POSIX Time Zone Specifications") that lack an explicit daylight savings transition rule; formerly the transition rule could be determined by installing a custom `posixrules` file, but now it is hard-wired. The recommended fix for any affected installations is to start using a geographical time zone name. +* In [ltree](ltree.html "F.21. ltree"), when an `lquery` pattern contains adjacent asterisks with braces, e.g., `*{2}.*{3}`, properly interpret that as `*{5}` (Nikita Glukhov) [§](https://postgr.es/c/9950c8aad) +* Fix [pageinspect](pageinspect.html "F.22. pageinspect")'s `bt_metap()` to return more appropriate data types that are less likely to overflow (Peter Geoghegan) [§](https://postgr.es/c/691e8b2e1) + +### E.24.3. Changes + +Below you will find a detailed account of the changes between PostgreSQL 13 and the previous major release. + +#### E.24.3.1. Server + +##### E.24.3.1.1. [Partitioning](ddl-partitioning.html "5.11. Table Partitioning") + +* Allow [pruning](ddl-partitioning.html#DDL-PARTITION-PRUNING "5.11.4. Partition Pruning") of partitions to happen in more cases (Yuzuko Hosoya, Amit Langote, Álvaro Herrera) [§](https://postgr.es/c/4e85642d9) [§](https://postgr.es/c/815ef2f56) +* Allow [partitionwise joins](runtime-config-query.html#GUC-ENABLE-PARTITIONWISE-JOIN) to happen in more cases (Ashutosh Bapat, Etsuro Fujita, Amit Langote, Tom Lane) [§](https://postgr.es/c/c8434d64c) [§](https://postgr.es/c/981643dcd) + + For example, partitionwise joins can now happen between partitioned tables even when their partition bounds do not match exactly. +* Support row-level `BEFORE` [triggers](triggers.html "Chapter 38. Triggers") on partitioned tables (Álvaro Herrera) [§](https://postgr.es/c/487e9861d) + + However, such a trigger is not allowed to change which partition is the destination. +* Allow partitioned tables to be logically replicated via [publications](sql-createpublication.html "CREATE PUBLICATION") (Amit Langote) [§](https://postgr.es/c/17b9e7f9f) [§](https://postgr.es/c/83fd4532a) + + Previously, partitions had to be replicated individually. Now a partitioned table can be published explicitly, causing all its partitions to be published automatically. Addition/removal of a partition causes it to be likewise added to or removed from the publication. The [`CREATE PUBLICATION`](sql-createpublication.html "CREATE PUBLICATION") option `publish_via_partition_root` controls whether changes to partitions are published as their own changes or their parent's. +* Allow logical replication into partitioned tables on subscribers (Amit Langote) [§](https://postgr.es/c/f1ac27bfd) + + Previously, subscribers could only receive rows into non-partitioned tables. +* Allow whole-row variables (that is, *`table`*`.*`) to be used in partitioning expressions (Amit Langote) [§](https://postgr.es/c/bb4114a4e) + +##### E.24.3.1.2. Indexes + +* More efficiently store [duplicates](btree-implementation.html#BTREE-DEDUPLICATION "63.4.2. Deduplication") in B-tree indexes (Anastasia Lubennikova, Peter Geoghegan) [§](https://postgr.es/c/0d861bbb7) + + This allows efficient B-tree indexing of low-cardinality columns by storing duplicate keys only once. Users upgrading with [pg\_upgrade](pgupgrade.html "pg_upgrade") will need to use [`REINDEX`](sql-reindex.html "REINDEX") to make an existing index use this feature. +* Allow [GiST](gist.html "Chapter 64. GiST Indexes") and [SP-GiST](spgist.html "Chapter 65. SP-GiST Indexes") indexes on `box` columns to support `ORDER BY box <-> point` queries (Nikita Glukhov) [§](https://postgr.es/c/c085e1c1c) [§](https://postgr.es/c/075f0a880) +* Allow [GIN](gin.html "Chapter 66. GIN Indexes") indexes to more efficiently handle `!` (NOT) clauses in `tsquery` searches (Nikita Glukhov, Alexander Korotkov, Tom Lane, Julien Rouhaud) [§](https://postgr.es/c/4b754d6c1) +* Allow [index operator classes](sql-createindex.html "CREATE INDEX") to take parameters (Nikita Glukhov) [§](https://postgr.es/c/911e70207) +* Allow `CREATE INDEX` to specify the GiST signature length and maximum number of integer ranges (Nikita Glukhov) [§](https://postgr.es/c/911e70207) + + Indexes created on four and eight-byte [integer array](intarray.html "F.18. intarray"), [tsvector](textsearch.html "Chapter 12. Full Text Search"), [pg\_trgm](pgtrgm.html "F.31. pg_trgm"), [ltree](ltree.html "F.21. ltree"), and [hstore](hstore.html "F.16. hstore") columns can now control these GiST index parameters, rather than using the defaults. +* Prevent indexes that use non-default collations from being [added](sql-altertable.html "ALTER TABLE") as a table's unique or primary key constraint (Tom Lane) [§](https://postgr.es/c/fbbf68094) + + The index's collation must match that of the underlying column, but `ALTER TABLE` previously failed to check this. + +##### E.24.3.1.3. Optimizer + +* Improve the optimizer's [selectivity](planner-stats-details.html "Chapter 71. How the Planner Uses Statistics") estimation for containment/match operators (Tom Lane) [§](https://postgr.es/c/a80818605) +* Allow setting the [statistics target](sql-altertable.html "ALTER TABLE") for [extended statistics](sql-createstatistics.html "CREATE STATISTICS") (Tomas Vondra) [§](https://postgr.es/c/d06215d03) + + This is controlled with the new command option `ALTER STATISTICS ... SET STATISTICS`. Previously this was computed based on more general statistics target settings. +* Allow use of multiple extended statistics objects in a single query (Tomas Vondra) [§](https://postgr.es/c/aaa676187) [§](https://postgr.es/c/eae056c19) +* Allow use of extended statistics objects for OR clauses and [IN](functions-subquery.html "9.23. Subquery Expressions")/`ANY` constant lists (Pierre Ducroquet, Tomas Vondra) [§](https://postgr.es/c/8f321bd16) [§](https://postgr.es/c/e83daa7e3) [§](https://postgr.es/c/ccaa3569f) +* Allow functions in `FROM` clauses to be pulled up (inlined) if they evaluate to constants (Alexander Kuzmenkov, Aleksandr Parfenov) [§](https://postgr.es/c/7266d0997) [§](https://postgr.es/c/a9ae99d01) + +##### E.24.3.1.4. General Performance + +* Implement [incremental sorting](runtime-config-query.html#GUC-ENABLE-INCREMENTAL-SORT) (James Coleman, Alexander Korotkov, Tomas Vondra) [§](https://postgr.es/c/d2d8a229b) [§](https://postgr.es/c/94e454cdd) + + If an intermediate query result is known to be sorted by one or more leading keys of a required sort ordering, the additional sorting can be done considering only the remaining keys, if the rows are sorted in batches that have equal leading keys. + + If necessary, this can be controlled using [enable\_incremental\_sort](runtime-config-query.html#GUC-ENABLE-INCREMENTAL-SORT). +* Improve the performance of sorting [inet](datatype-net-types.html#DATATYPE-INET "8.9.1. inet") values (Brandur Leach) [§](https://postgr.es/c/71dcd7438) +* Allow [hash aggregation](runtime-config-query.html#GUC-ENABLE-HASHAGG) to use disk storage for large aggregation result sets (Jeff Davis) [§](https://postgr.es/c/1f39bce02) [§](https://postgr.es/c/dd8e19132) [§](https://postgr.es/c/78530c8e7) + + Previously, hash aggregation was avoided if it was expected to use more than [work\_mem](runtime-config-resource.html#GUC-WORK-MEM) memory. Now, a hash aggregation plan can be chosen despite that. The hash table will be spilled to disk if it exceeds `work_mem` times [hash\_mem\_multiplier](runtime-config-resource.html#GUC-HASH-MEM-MULTIPLIER). + + This behavior is normally preferable to the old behavior, in which once hash aggregation had been chosen, the hash table would be kept in memory no matter how large it got — which could be very large if the planner had misestimated. If necessary, behavior similar to that can be obtained by increasing `hash_mem_multiplier`. +* Allow inserts, not only updates and deletes, to trigger vacuuming activity in [autovacuum](routine-vacuuming.html#AUTOVACUUM "24.1.6. The Autovacuum Daemon") (Laurenz Albe, Darafei Praliaskouski) [§](https://postgr.es/c/b07642dbc) + + Previously, insert-only activity would trigger auto-analyze but not auto-vacuum, on the grounds that there could not be any dead tuples to remove. However, a vacuum scan has other useful side-effects such as setting page-all-visible bits, which improves the efficiency of index-only scans. Also, allowing an insert-only table to receive periodic vacuuming helps to spread out the work of “freezing” old tuples, so that there is not suddenly a large amount of freezing work to do when the entire table reaches the anti-wraparound threshold all at once. + + If necessary, this behavior can be adjusted with the new parameters [autovacuum\_vacuum\_insert\_threshold](runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-INSERT-THRESHOLD) and [autovacuum\_vacuum\_insert\_scale\_factor](runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-INSERT-SCALE-FACTOR), or the equivalent table storage options. +* Add [maintenance\_io\_concurrency](runtime-config-resource.html#GUC-MAINTENANCE-IO-CONCURRENCY) parameter to control I/O concurrency for maintenance operations (Thomas Munro) [§](https://postgr.es/c/fc34b0d9d) +* Allow WAL writes to be skipped during a transaction that creates or rewrites a relation, if [wal\_level](runtime-config-wal.html#GUC-WAL-LEVEL) is `minimal` (Kyotaro Horiguchi) [§](https://postgr.es/c/c6b92041d) + + Relations larger than [wal\_skip\_threshold](runtime-config-wal.html#GUC-WAL-SKIP-THRESHOLD) will have their files fsync'ed rather than generating WAL. Previously this was done only for `COPY` operations, but the implementation had a bug that could cause data loss during crash recovery. +* Improve performance when replaying [`DROP DATABASE`](sql-dropdatabase.html "DROP DATABASE") commands when many tablespaces are in use (Fujii Masao) [§](https://postgr.es/c/e6d806952) +* Improve performance for [truncation](sql-truncate.html "TRUNCATE") of very large relations (Kirk Jamison) [§](https://postgr.es/c/6d05086c0) +* Improve retrieval of the leading bytes of [TOAST](storage-toast.html "69.2. TOAST")'ed values (Binguo Bao, Andrey Borodin) [§](https://postgr.es/c/11a078cf8) + + Previously, compressed out-of-line TOAST values were fully fetched even when it's known that only some leading bytes are needed. Now, only enough data to produce the result is fetched. +* Improve performance of [`LISTEN`](sql-listen.html "LISTEN")/`NOTIFY` (Martijn van Oosterhout, Tom Lane) [§](https://postgr.es/c/bca6e6435) [§](https://postgr.es/c/51004c717) [§](https://postgr.es/c/bb5ae8f6c) +* Speed up conversions of integers to text (David Fetter) [§](https://postgr.es/c/1fd687a03) +* Reduce memory usage for query strings and extension scripts that contain many SQL statements (Amit Langote) [§](https://postgr.es/c/b5810de3f) + +##### E.24.3.1.5. Monitoring + +* Allow [`EXPLAIN`](sql-explain.html "EXPLAIN"), [auto\_explain](auto-explain.html "F.4. auto_explain"), [autovacuum](routine-vacuuming.html#AUTOVACUUM "24.1.6. The Autovacuum Daemon"), and [pg\_stat\_statements](pgstatstatements.html "F.29. pg_stat_statements") to track WAL usage statistics (Kirill Bychik, Julien Rouhaud) [§](https://postgr.es/c/6b466bf5f) [§](https://postgr.es/c/33e05f89c) [§](https://postgr.es/c/b7ce6de93) +* Allow a sample of SQL statements, rather than all statements, to be logged (Adrien Nayrat) [§](https://postgr.es/c/6e3e6cc0e) + + A [log\_statement\_sample\_rate](runtime-config-logging.html#GUC-LOG-STATEMENT-SAMPLE-RATE) fraction of those statements taking more than [log\_min\_duration\_sample](runtime-config-logging.html#GUC-LOG-MIN-DURATION-SAMPLE) duration will be logged. +* Add the backend type to [csvlog](runtime-config-logging.html "19.8. Error Reporting and Logging") and optionally [log\_line\_prefix](runtime-config-logging.html#GUC-LOG-LINE-PREFIX) log output (Peter Eisentraut) [§](https://postgr.es/c/70a7b4776) +* Improve control of prepared statement parameter logging (Alexey Bashtanov, Álvaro Herrera) [§](https://postgr.es/c/ba79cb5dc) [§](https://postgr.es/c/0b34e7d30) + + The GUC setting [log\_parameter\_max\_length](runtime-config-logging.html#GUC-LOG-PARAMETER-MAX-LENGTH) controls the maximum length of parameter values output during logging of non-error statements, while [log\_parameter\_max\_length\_on\_error](runtime-config-logging.html#GUC-LOG-PARAMETER-MAX-LENGTH-ON-ERROR) does the same for logging of statements with errors. Previously, prepared statement parameters were never logged during errors. +* Allow function call backtraces to be logged after errors (Peter Eisentraut, Álvaro Herrera) [§](https://postgr.es/c/71a8a4f6e) [§](https://postgr.es/c/8ff4d1277) + + The new parameter [backtrace\_functions](runtime-config-developer.html#GUC-BACKTRACE-FUNCTIONS) specifies which C functions should generate backtraces on error. +* Make [vacuum](sql-vacuum.html "VACUUM") buffer counters 64-bits wide to avoid overflow (Álvaro Herrera) [§](https://postgr.es/c/15d13e829) + +##### E.24.3.1.6. System Views + +* Add `leader_pid` to [pg\_stat\_activity](monitoring-stats.html#PG-STAT-ACTIVITY-VIEW "Table 27.3. pg_stat_activity View") to report a parallel worker's leader process (Julien Rouhaud) [§](https://postgr.es/c/b025f32e0) +* Add system view [`pg_stat_progress_basebackup`](progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING "27.4.5. Base Backup Progress Reporting") to report the progress of streaming base backups (Fujii Masao) [§](https://postgr.es/c/e65497df8) +* Add system view [`pg_stat_progress_analyze`](monitoring-stats.html#MONITORING-STATS-DYNAMIC-VIEWS-TABLE "Table 27.1. Dynamic Statistics Views") to report [ANALYZE](sql-analyze.html "ANALYZE") progress (Álvaro Herrera, Tatsuro Yamada, Vinayak Pokale) [§](https://postgr.es/c/a166d408e) +* Add system view [`pg_shmem_allocations`](view-pg-shmem-allocations.html "51.87. pg_shmem_allocations") to display shared memory usage (Andres Freund, Robert Haas) [§](https://postgr.es/c/ed10f32e3) +* Add system view [`pg_stat_slru`](monitoring-stats.html#MONITORING-STATS-VIEWS-TABLE "Table 27.2. Collected Statistics Views") to monitor internal SLRU caches (Tomas Vondra) [§](https://postgr.es/c/28cac71bd) +* Allow [track\_activity\_query\_size](runtime-config-statistics.html#GUC-TRACK-ACTIVITY-QUERY-SIZE) to be set as high as 1MB (Vyacheslav Makarov) [§](https://postgr.es/c/814727858) + + The previous maximum was 100kB. + +##### E.24.3.1.7. [Wait Events](monitoring-stats.html#WAIT-EVENT-TABLE "Table 27.4. Wait Event Types") + +* Report a wait event while creating a DSM segment with `posix_fallocate()` (Thomas Munro) [§](https://postgr.es/c/ef02fb15a) +* Add wait event VacuumDelay to report on cost-based vacuum delay (Justin Pryzby) [§](https://postgr.es/c/cedffbdb8) +* Add wait events for WAL archive and recovery pause (Fujii Masao) [§](https://postgr.es/c/b8e20d6da) + + The new events are BackupWaitWalArchive and RecoveryPause. +* Add wait events RecoveryConflictSnapshot and RecoveryConflictTablespace to monitor recovery conflicts (Masahiko Sawada) [§](https://postgr.es/c/18808f8c8) +* Improve performance of wait events on BSD-based systems (Thomas Munro) [§](https://postgr.es/c/815c2f097) + +##### E.24.3.1.8. Authentication + +* Allow only superusers to view the [ssl\_passphrase\_command](runtime-config-connection.html#GUC-SSL-PASSPHRASE-COMMAND) setting (Insung Moon) [§](https://postgr.es/c/d9249441e) + + This was changed as a security precaution. +* Change the server's default minimum TLS version for encrypted connections from 1.0 to 1.2 (Peter Eisentraut) [§](https://postgr.es/c/b1abfec82) + + This choice can be controlled by [ssl\_min\_protocol\_version](runtime-config-connection.html#GUC-SSL-MIN-PROTOCOL-VERSION). + +##### E.24.3.1.9. Server Configuration + +* Tighten rules on which utility commands are allowed in read-only transaction mode (Robert Haas) [§](https://postgr.es/c/2eb34ac36) + + This change also increases the number of utility commands that can run in parallel queries. +* Allow [allow\_system\_table\_mods](runtime-config-developer.html#GUC-ALLOW-SYSTEM-TABLE-MODS) to be changed after server start (Peter Eisentraut) [§](https://postgr.es/c/c4a7a392e) +* Disallow non-superusers from modifying system tables when [allow\_system\_table\_mods](runtime-config-developer.html#GUC-ALLOW-SYSTEM-TABLE-MODS) is set (Peter Eisentraut) [§](https://postgr.es/c/508bf95b7) + + Previously, if [allow\_system\_table\_mods](runtime-config-developer.html#GUC-ALLOW-SYSTEM-TABLE-MODS) was set at server start, non-superusers could issue `INSERT`/`UPDATE`/`DELETE` commands on system tables. +* Enable support for [Unix-domain sockets](runtime-config-connection.html#RUNTIME-CONFIG-CONNECTION-SETTINGS "19.3.1. Connection Settings") on Windows (Peter Eisentraut) [§](https://postgr.es/c/8f3ec75de) + +#### E.24.3.2. Streaming Replication and Recovery + +* Allow streaming replication configuration settings to be changed by reload (Sergei Kornilov) [§](https://postgr.es/c/1e6148032) + + Previously, a server restart was required to change [primary\_conninfo](runtime-config-replication.html#GUC-PRIMARY-CONNINFO) and [primary\_slot\_name](runtime-config-replication.html#GUC-PRIMARY-SLOT-NAME). +* Allow WAL receivers to use a temporary replication slot when a permanent one is not specified (Peter Eisentraut, Sergei Kornilov) [§](https://postgr.es/c/329730827) [§](https://postgr.es/c/092c6936d) + + This behavior can be enabled using [wal\_receiver\_create\_temp\_slot](runtime-config-replication.html#GUC-WAL-RECEIVER-CREATE-TEMP-SLOT). +* Allow WAL storage for replication slots to be limited by [max\_slot\_wal\_keep\_size](runtime-config-replication.html#GUC-MAX-SLOT-WAL-KEEP-SIZE) (Kyotaro Horiguchi) [§](https://postgr.es/c/c65507763) + + Replication slots that would require exceeding this value are marked invalid. +* Allow [standby promotion](runtime-config-replication.html#GUC-PROMOTE-TRIGGER-FILE) to cancel any requested pause (Fujii Masao) [§](https://postgr.es/c/496ee647e) + + Previously, promotion could not happen while the standby was in paused state. +* Generate an error if recovery does not reach the specified [recovery target](runtime-config-wal.html#RUNTIME-CONFIG-WAL-RECOVERY-TARGET "19.5.5. Recovery Target") (Leif Gunnar Erlandsen, Peter Eisentraut) [§](https://postgr.es/c/dc788668b) + + Previously, a standby would promote itself upon reaching the end of WAL, even if the target was not reached. +* Allow control over how much memory is used by logical decoding before it is spilled to disk (Tomas Vondra, Dilip Kumar, Amit Kapila) [§](https://postgr.es/c/cec2edfa7) + + This is controlled by [logical\_decoding\_work\_mem](runtime-config-resource.html#GUC-LOGICAL-DECODING-WORK-MEM). +* Allow recovery to continue even if invalid pages are referenced by WAL (Fujii Masao) [§](https://postgr.es/c/41c184bc6) + + This is enabled using [ignore\_invalid\_pages](runtime-config-developer.html#GUC-IGNORE-INVALID-PAGES). + +#### E.24.3.3. Utility Commands + +* Allow [`VACUUM`](sql-vacuum.html "VACUUM") to process a table's indexes in parallel (Masahiko Sawada, Amit Kapila) [§](https://postgr.es/c/40d964ec9) + + The new `PARALLEL` option controls this. +* Allow [`FETCH FIRST`](sql-select.html#SQL-LIMIT "LIMIT Clause") to use `WITH TIES` to return any additional rows that match the last result row (Surafel Temesgen) [§](https://postgr.es/c/357889eb1) +* Report planning-time buffer usage in [`EXPLAIN`](sql-explain.html "EXPLAIN")'s `BUFFER` output (Julien Rouhaud) [§](https://postgr.es/c/ce77abe63) +* Make [`CREATE TABLE LIKE`](sql-createtable.html "CREATE TABLE") propagate a `CHECK` constraint's `NO INHERIT` property to the created table (Ildar Musin, Chris Travers) [§](https://postgr.es/c/cacef1722) +* When using [`LOCK TABLE`](sql-lock.html "LOCK") on a partitioned table, do not check permissions on the child tables (Amit Langote) [§](https://postgr.es/c/b7e51b350) +* Allow [`OVERRIDING USER VALUE`](sql-insert.html "INSERT") on inserts into identity columns (Dean Rasheed) [§](https://postgr.es/c/de3bbfcc9) +* Add [`ALTER TABLE ... DROP EXPRESSION`](sql-altertable.html "ALTER TABLE") to allow removing the `GENERATED` property from a column (Peter Eisentraut) [§](https://postgr.es/c/f595117e2) +* Fix bugs in multi-step `ALTER TABLE` commands (Tom Lane) [§](https://postgr.es/c/1281a5c90) + + `IF NOT EXISTS` clauses now work as expected, in that derived actions (such as index creation) do not execute if the column already exists. Also, certain cases of combining related actions into one `ALTER TABLE` now work when they did not before. +* Add [`ALTER VIEW`](sql-alterview.html "ALTER VIEW") syntax to rename view columns (Fujii Masao) [§](https://postgr.es/c/30840c92a) + + Renaming view columns was already possible, but one had to write `ALTER TABLE RENAME COLUMN`, which is confusing. +* Add [`ALTER TYPE`](sql-altertype.html "ALTER TYPE") options to modify a base type's TOAST properties and support functions (Tomas Vondra, Tom Lane) [§](https://postgr.es/c/fe30e7ebf) +* Add [`CREATE DATABASE`](sql-createdatabase.html "CREATE DATABASE") `LOCALE` option (Peter Eisentraut) [§](https://postgr.es/c/06140c201) + + This combines the existing options `LC_COLLATE` and `LC_CTYPE` into a single option. +* Allow [`DROP DATABASE`](sql-dropdatabase.html "DROP DATABASE") to disconnect sessions using the target database, allowing the drop to succeed (Pavel Stehule, Amit Kapila) [§](https://postgr.es/c/1379fd537) + + This is enabled by the `FORCE` option. +* Add structure member [`tg_updatedcols`](trigger-interface.html "38.3. Writing Trigger Functions in C") to allow C-language update triggers to know which column(s) were updated (Peter Eisentraut) [§](https://postgr.es/c/71d60e2aa) + +#### E.24.3.4. Data Types + +* Add polymorphic data types for use by functions requiring compatible arguments (Pavel Stehule) [§](https://postgr.es/c/24e2885ee) + + The new data types are [`anycompatible`](datatype-pseudo.html#DATATYPE-PSEUDOTYPES-TABLE "Table 8.27. Pseudo-Types"), `anycompatiblearray`, `anycompatiblenonarray`, and `anycompatiblerange`. +* Add SQL data type [`xid8`](datatype-oid.html "8.19. Object Identifier Types") to expose FullTransactionId (Thomas Munro) [§](https://postgr.es/c/aeec457de) + + The existing `xid` data type is only four bytes so it does not provide the transaction epoch. +* Add data type [`regcollation`](datatype-oid.html "8.19. Object Identifier Types") and associated functions, to represent OIDs of collation objects (Julien Rouhaud) [§](https://postgr.es/c/a2b1faa0f) +* Use the glibc version in some cases as a [collation](collation.html "23.2. Collation Support") version identifier (Thomas Munro) [§](https://postgr.es/c/d5ac14f9c) + + If the glibc version changes, a warning will be issued about possible corruption of collation-dependent indexes. +* Add support for collation versions on Windows (Thomas Munro) [§](https://postgr.es/c/352f6f2df) +* Allow [`ROW` expressions](sql-expressions.html#SQL-SYNTAX-ROW-CONSTRUCTORS "4.2.13. Row Constructors") to have their members extracted with suffix notation (Tom Lane) [§](https://postgr.es/c/8b7a0f1d1) + + For example, `(ROW(4, 5.0)).f1` now returns 4. + +#### E.24.3.5. Functions + +* Add alternate version of [`jsonb_set()`](functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE "Table 9.47. JSON Processing Functions") with improved `NULL` handling (Andrew Dunstan) [§](https://postgr.es/c/a83586b55) + + The new function, `jsonb_set_lax()`, handles a `NULL` new value by either setting the specified key to a JSON null, deleting the key, raising an exception, or returning the `jsonb` value unmodified, as requested. +* Add jsonpath [.`datetime()`](functions-json.html#FUNCTIONS-SQLJSON-PATH-OPERATORS "9.16.2.2. SQL/JSON Path Operators and Methods") method (Nikita Glukhov, Teodor Sigaev, Oleg Bartunov, Alexander Korotkov) [§](https://postgr.es/c/bffe1bd68) + + This function allows JSON values to be converted to timestamps, which can then be processed in `jsonpath` expressions. This change also adds `jsonpath` functions that support time-zone-aware output. +* Add SQL functions [`NORMALIZE`()](functions-string.html#FUNCTIONS-STRING-SQL "Table 9.9. SQL String Functions and Operators") to normalize Unicode strings, and [`IS NORMALIZED`](collation.html#COLLATION-NONDETERMINISTIC "23.2.2.4. Nondeterministic Collations") to check for normalization (Peter Eisentraut) [§](https://postgr.es/c/2991ac5fc) +* Add `min()` and `max()` aggregates for [`pg_lsn`](datatype-pg-lsn.html "8.20. pg_lsn Type") (Fabrízio de Royes Mello) [§](https://postgr.es/c/313f87a17) + + These are particularly useful in monitoring queries. +* Allow [Unicode escapes](sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-UESCAPE "4.1.2.3. String Constants with Unicode Escapes"), e.g., `E'\unnnn'` or `U&'\nnnn'`, to specify any character available in the database encoding, even when the database encoding is not UTF-8 (Tom Lane) [§](https://postgr.es/c/a6525588b) +* Allow [`to_date()`](functions-formatting.html "9.8. Data Type Formatting Functions") and `to_timestamp()` to recognize non-English month/day names (Juan José Santamaría Flecha, Tom Lane) [§](https://postgr.es/c/d67755049) + + The names recognized are the same as those output by [`to_char()`](functions-formatting.html "9.8. Data Type Formatting Functions") with the same format patterns. +* Add datetime format patterns `FF1` – `FF6` to specify input or output of 1 to 6 fractional-second digits (Alexander Korotkov, Nikita Glukhov, Teodor Sigaev, Oleg Bartunov) [§](https://postgr.es/c/d589f9446) + + These patterns can be used by `to_char()`, `to_timestamp()`, and jsonpath's .`datetime()`. +* Add `SSSSS` datetime format pattern as an SQL-standard alias for `SSSS` (Nikita Glukhov, Alexander Korotkov) [§](https://postgr.es/c/b64b857f5) +* Add function [`gen_random_uuid()`](functions-uuid.html "9.14. UUID Functions") to generate version-4 UUIDs (Peter Eisentraut) [§](https://postgr.es/c/5925e5549) + + Previously UUID generation functions were only available in the external modules [uuid-ossp](uuid-ossp.html "F.44. uuid-ossp") and [pgcrypto](pgcrypto.html "F.25. pgcrypto"). +* Add greatest-common-denominator ([`gcd`](functions-math.html#FUNCTIONS-MATH-FUNC-TABLE "Table 9.5. Mathematical Functions")) and least-common-multiple (`lcm`) functions (Vik Fearing) [§](https://postgr.es/c/13661ddd7) +* Improve the performance and accuracy of the `numeric` type's [square root](functions-math.html#FUNCTIONS-MATH-FUNC-TABLE "Table 9.5. Mathematical Functions") (`sqrt`) and natural log (`ln`) functions (Dean Rasheed) [§](https://postgr.es/c/43a899f41) [§](https://postgr.es/c/4083f445c) +* Add function [`min_scale()`](functions-math.html#FUNCTIONS-MATH-FUNC-TABLE "Table 9.5. Mathematical Functions") that returns the number of digits to the right of the decimal point that are required to represent a `numeric` value with full accuracy (Pavel Stehule) [§](https://postgr.es/c/20d6225d1) +* Add function [`trim_scale()`](functions-math.html#FUNCTIONS-MATH-FUNC-TABLE "Table 9.5. Mathematical Functions") to reduce the scale of a `numeric` value by removing trailing zeros (Pavel Stehule) [§](https://postgr.es/c/20d6225d1) +* Add commutators of [distance operators](functions-geometry.html#FUNCTIONS-GEOMETRY-OP-TABLE "Table 9.35. Geometric Operators") (Nikita Glukhov) [§](https://postgr.es/c/6254c55f8) + + For example, previously only `point` `<->` `line` was supported, now `line` `<->` `point` works too. +* Create `xid8` versions of all [transaction ID functions](functions-info.html#FUNCTIONS-PG-SNAPSHOT "Table 9.74. Transaction ID and Snapshot Information Functions") (Thomas Munro) [§](https://postgr.es/c/4c04be9b0) + + The old `xid`-based functions still exist, for backward compatibility. +* Allow [`get_bit()`](functions-binarystring.html#FUNCTIONS-BINARYSTRING-OTHER "Table 9.12. Other Binary String Functions") and `set_bit()` to set bits beyond the first 256MB of a `bytea` value (Movead Li) [§](https://postgr.es/c/26a944cf2) +* Allow [advisory-lock functions](functions-admin.html#FUNCTIONS-ADVISORY-LOCKS "9.27.10. Advisory Lock Functions") to be used in some parallel operations (Tom Lane) [§](https://postgr.es/c/4886da832) +* Add the ability to remove an object's dependency on an extension (Álvaro Herrera) [§](https://postgr.es/c/5fc703946) + + The object can be a function, materialized view, index, or trigger. The syntax is `ALTER .. NO DEPENDS ON`. + +#### E.24.3.6. [PL/pgSQL](plpgsql.html "Chapter 42. PL/pgSQL — SQL Procedural Language") + +* Improve performance of simple PL/pgSQL expressions (Tom Lane, Amit Langote) [§](https://postgr.es/c/8f59f6b9c) +* Improve performance of PL/pgSQL functions that use immutable expressions (Konstantin Knizhnik) [§](https://postgr.es/c/73b06cf89) + +#### E.24.3.7. Client Interfaces + +* Allow libpq clients to require channel binding for encrypted connections (Jeff Davis) [§](https://postgr.es/c/d6e612f83) + + Using the libpq connection parameter [`channel_binding`](libpq-connect.html#LIBPQ-CONNECT-CHANNEL-BINDING) forces the other end of the TLS connection to prove it knows the user's password. This prevents man-in-the-middle attacks. +* Add libpq connection parameters to control the minimum and maximum TLS version allowed for an encrypted connection (Daniel Gustafsson) [§](https://postgr.es/c/ff8ca5fad) [§](https://postgr.es/c/401aad670) [§](https://postgr.es/c/16412c784) + + The settings are [ssl\_min\_protocol\_version](libpq-connect.html#LIBPQ-CONNECT-SSL-MIN-PROTOCOL-VERSION) and [ssl\_max\_protocol\_version](libpq-connect.html#LIBPQ-CONNECT-SSL-MAX-PROTOCOL-VERSION). By default, the minimum TLS version is 1.2 (this represents a behavioral change from previous releases). +* Allow use of passwords to unlock client certificates (Craig Ringer, Andrew Dunstan) [§](https://postgr.es/c/4dc635521) + + This is enabled by libpq's [sslpassword](libpq-connect.html#LIBPQ-CONNECT-SSLPASSWORD) connection parameter. +* Allow libpq to use DER-encoded client certificates (Craig Ringer, Andrew Dunstan) [§](https://postgr.es/c/4dc635521) +* Fix ecpg's `EXEC SQL elif` directive to work correctly (Tom Lane) [§](https://postgr.es/c/44cd434ec) + + Previously it behaved the same as `endif` followed by `ifdef`, so that a successful previous branch of the same `if` construct did not prevent expansion of the `elif` branch or following branches. + +#### E.24.3.8. Client Applications + +##### E.24.3.8.1. [psql](app-psql.html "psql") + +* Add transaction status (`%x`) to psql's default [prompts](app-psql.html#APP-PSQL-PROMPTING "Prompting") (Vik Fearing) [§](https://postgr.es/c/dcdbb5a5d) +* Allow the secondary psql prompt to be blank but the same width as the primary prompt (Thomas Munro) [§](https://postgr.es/c/7f338369c) + + This is accomplished by setting `PROMPT2` to `%w`. +* Allow psql's [`\g`](app-psql.html#APP-PSQL-META-COMMANDS "Meta-Commands") and `\gx` commands to change [\pset](app-psql.html#APP-PSQL-META-COMMANDS "Meta-Commands") output options for the duration of that single command (Tom Lane) [§](https://postgr.es/c/b63c293bc) + + This feature allows syntax like `\g (expand=on)`, which is equivalent to `\gx`. +* Add psql commands to display operator classes and operator families (Sergey Cherkashin, Nikita Glukhov, Alexander Korotkov) [§](https://postgr.es/c/b0b5e20cd) + + The new commands are [`\dAc`](app-psql.html#APP-PSQL-META-COMMANDS "Meta-Commands"), `\dAf`, `\dAo`, and `\dAp`. +* Show table persistence in psql's [`\dt+`](app-psql.html#APP-PSQL-META-COMMANDS "Meta-Commands") and related commands (David Fetter) [§](https://postgr.es/c/9a2ea6183) + + In verbose mode, the table/index/view shows if the object is permanent, temporary, or unlogged. +* Improve output of psql's [`\d`](app-psql.html#APP-PSQL-META-COMMANDS "Meta-Commands") for TOAST tables (Justin Pryzby) [§](https://postgr.es/c/eb5472da9) +* Fix redisplay after psql's [`\e`](app-psql.html#APP-PSQL-META-COMMANDS "Meta-Commands") command (Tom Lane) [§](https://postgr.es/c/d1c866e57) + + When exiting the editor, if the query doesn't end with a semicolon or `\g`, the query buffer contents will now be displayed. +* Add [`\warn`](app-psql.html#APP-PSQL-META-COMMANDS "Meta-Commands") command to psql (David Fetter) [§](https://postgr.es/c/02e95a504) + + This is like `\echo` except that the text is sent to stderr instead of stdout. +* Add the PostgreSQL home page to command-line `--help` output (Peter Eisentraut) [§](https://postgr.es/c/1933ae629) + +##### E.24.3.8.2. [pgbench](pgbench.html "pgbench") + +* Allow pgbench to partition its “accounts” table (Fabien Coelho) [§](https://postgr.es/c/b1c1aa531) + + This allows performance testing of partitioning. +* Add pgbench command `\aset`, which behaves like `\gset`, but for multiple queries (Fabien Coelho) [§](https://postgr.es/c/9d8ef9880) +* Allow pgbench to generate its initial data server-side, rather than client-side (Fabien Coelho) [§](https://postgr.es/c/a386942bd) +* Allow pgbench to show script contents using option `--show-script` (Fabien Coelho) [§](https://postgr.es/c/5823677ac) + +#### E.24.3.9. Server Applications + +* Generate backup manifests for base backups, and verify them (Robert Haas) [§](https://postgr.es/c/0d8c9c121) [§](https://postgr.es/c/dbc60c559) + + A new tool [pg\_verifybackup](app-pgverifybackup.html "pg_verifybackup") can verify backups. +* Have [pg\_basebackup](app-pgbasebackup.html "pg_basebackup") estimate the total backup size by default (Fujii Masao) [§](https://postgr.es/c/fab13dc50) + + This computation allows [`pg_stat_progress_basebackup`](monitoring-stats.html#MONITORING-STATS-DYNAMIC-VIEWS-TABLE "Table 27.1. Dynamic Statistics Views") to show progress. If that is not needed, it can be disabled by using the `--no-estimate-size` option. Previously, this computation happened only if the `--progress` option was used. +* Add an option to [pg\_rewind](app-pgrewind.html "pg_rewind") to configure standbys (Paul Guo, Jimmy Yih, Ashwin Agrawal) [§](https://postgr.es/c/927474ce1) + + This matches [pg\_basebackup](app-pgbasebackup.html "pg_basebackup")'s `--write-recovery-conf` option. +* Allow pg\_rewind to use the target cluster's [restore\_command](runtime-config-wal.html#GUC-RESTORE-COMMAND) to retrieve needed WAL (Alexey Kondratov) [§](https://postgr.es/c/a7e8ece41) + + This is enabled using the `-c`/`--restore-target-wal` option. +* Have pg\_rewind automatically run crash recovery before rewinding (Paul Guo, Jimmy Yih, Ashwin Agrawal) [§](https://postgr.es/c/5adafaf17) + + This can be disabled by using `--no-ensure-shutdown`. +* Increase the [`PREPARE TRANSACTION`](sql-prepare-transaction.html "PREPARE TRANSACTION")-related information reported by pg\_waldump (Fujii Masao) [§](https://postgr.es/c/7b8a899bd) +* Add [pg\_waldump](pgwaldump.html "pg_waldump") option `--quiet` to suppress non-error output (Andres Freund, Robert Haas) [§](https://postgr.es/c/ac44367ef) +* Add [pg\_dump](app-pgdump.html "pg_dump") option `--include-foreign-data` to dump data from foreign servers (Luis Carril) [§](https://postgr.es/c/2f9eb3132) +* Allow vacuum commands run by [vacuumdb](app-vacuumdb.html "vacuumdb") to operate in parallel mode (Masahiko Sawada) [§](https://postgr.es/c/47bc9ced0) + + This is enabled with the new `--parallel` option. +* Allow [reindexdb](app-reindexdb.html "reindexdb") to operate in parallel (Julien Rouhaud) [§](https://postgr.es/c/5ab892c39) + + Parallel mode is enabled with the new `--jobs` option. +* Allow [dropdb](app-dropdb.html "dropdb") to disconnect sessions using the target database, allowing the drop to succeed (Pavel Stehule) [§](https://postgr.es/c/80e05a088) + + This is enabled with the `-f` option. +* Remove `--adduser` and `--no-adduser` from [createuser](app-createuser.html "createuser") (Alexander Lakhin) [§](https://postgr.es/c/4fa5edcd1) + + The long-supported preferred options for this are called `--superuser` and `--no-superuser`. +* Use the directory of the [pg\_upgrade](pgupgrade.html "pg_upgrade") program as the default `--new-bindir` setting when running pg\_upgrade (Daniel Gustafsson) [§](https://postgr.es/c/959f6d6a1) + +#### E.24.3.10. Documentation + +* Add a [glossary](glossary.html "Appendix M. Glossary") to the documentation (Corey Huinker, Jürgen Purtz, Roger Harkavy, Álvaro Herrera) [§](https://postgr.es/c/347d2b07f) +* Reformat tables containing [function and operator information](functions.html "Chapter 9. Functions and Operators") for better clarity (Tom Lane) [§](https://postgr.es/c/e894c6183) +* Upgrade to use [DocBook 4.5](docguide-docbook.html "J.1. DocBook") (Peter Eisentraut) [§](https://postgr.es/c/416c75cf3) + +#### E.24.3.11. Source Code + +* Add support for building on Visual Studio 2019 (Haribabu Kommi) [§](https://postgr.es/c/2b1394fc2) +* Add build support for MSYS2 (Peter Eisentraut) [§](https://postgr.es/c/e975c1a60) +* Add compare\_exchange and fetch\_add assembly language code for Power PC compilers (Noah Misch) [§](https://postgr.es/c/30ee5d17c) +* Update [Snowball stemmer](textsearch-dictionaries.html#TEXTSEARCH-SNOWBALL-DICTIONARY "12.6.6. Snowball Dictionary") dictionaries used by full text search (Panagiotis Mavrogiorgos) [§](https://postgr.es/c/7b925e127) + + This adds Greek stemming and improves Danish and French stemming. +* Remove support for Windows 2000 (Michael Paquier) [§](https://postgr.es/c/e2e02191e) +* Remove support for non-ELF BSD systems (Peter Eisentraut) [§](https://postgr.es/c/c72f9b950) +* Remove [support](plpython.html "Chapter 45. PL/Python — Python Procedural Language") for Python versions 2.5.X and earlier (Peter Eisentraut) [§](https://postgr.es/c/37f21ed13) +* Remove [support](install-short.html "16.1. Short Version") for OpenSSL 0.9.8 and 1.0.0 (Michael Paquier) [§](https://postgr.es/c/7b283d0e1) +* Remove [configure](install-short.html "16.1. Short Version") options `--disable-float8-byval` and `--disable-float4-byval` (Peter Eisentraut) [§](https://postgr.es/c/4513d8b07) [§](https://postgr.es/c/2e4db241b) + + These were needed for compatibility with some version-zero C functions, but those are no longer supported. +* Pass the query string to planner hook functions (Pascal Legrand, Julien Rouhaud) [§](https://postgr.es/c/6aba63ef3) +* Add [`TRUNCATE`](sql-truncate.html "TRUNCATE") command hook (Yuli Khodorkovskiy) [§](https://postgr.es/c/f7a2002e8) +* Add TLS init hook (Andrew Dunstan) [§](https://postgr.es/c/896fcdb23) +* Allow building with no predefined Unix-domain socket directory (Peter Eisentraut) [§](https://postgr.es/c/a9cff89f7) +* Reduce the probability of SysV resource key collision on Unix platforms (Tom Lane) [§](https://postgr.es/c/7de19fbc0) +* Use operating system functions to reliably erase memory that contains sensitive information (Peter Eisentraut) [§](https://postgr.es/c/74a308cf5) + + For example, this is used for clearing passwords stored in memory. +* Add `headerscheck` script to test C header-file compatibility (Tom Lane) [§](https://postgr.es/c/55ea10918) +* Implement internal lists as arrays, rather than a chain of cells (Tom Lane) [§](https://postgr.es/c/1cff1b95a) + + This improves performance for queries that access many objects. +* Change the API for `TS_execute()` (Tom Lane, Pavel Borisov) [§](https://postgr.es/c/92fe6895d) [§](https://postgr.es/c/70eca6a9a) + + `TS_execute` callbacks must now provide ternary (yes/no/maybe) logic. Calculating NOT queries accurately is now the default. + +#### E.24.3.12. Additional Modules + +* Allow [extensions](sql-createextension.html "CREATE EXTENSION") to be specified as trusted (Tom Lane) [§](https://postgr.es/c/50fc694e4) + + Such extensions can be installed in a database by users with database-level `CREATE` privileges, even if they are not superusers. This change also removes the `pg_pltemplate` system catalog. +* Allow non-superusers to connect to [postgres\_fdw](postgres-fdw.html "F.33. postgres_fdw") foreign servers without using a password (Craig Ringer) [§](https://postgr.es/c/6136e94dc) + + Specifically, allow a superuser to set `password_required` to false for a [user mapping](sql-alterusermapping.html "ALTER USER MAPPING"). Care must still be taken to prevent non-superusers from using superuser credentials to connect to the foreign server. +* Allow postgres\_fdw to use certificate authentication (Craig Ringer) [§](https://postgr.es/c/f5fd995a1) + + Different users can use different certificates. +* Allow [sepgsql](sepgsql.html "F.35. sepgsql") to control access to the `TRUNCATE` command (Yuli Khodorkovskiy) [§](https://postgr.es/c/4f66c93f6) +* Add extension [bool\_plperl](plperl.html "Chapter 44. PL/Perl — Perl Procedural Language") which transforms SQL booleans to/from PL/Perl booleans (Ivan Panchenko) [§](https://postgr.es/c/36058a3c5) +* Have [pg\_stat\_statements](pgstatstatements.html "F.29. pg_stat_statements") treat `SELECT ... FOR UPDATE` commands as distinct from those without `FOR UPDATE` (Andrew Gierth, Vik Fearing) [§](https://postgr.es/c/6e74c64bc) +* Allow pg\_stat\_statements to optionally track the planning time of statements (Julien Rouhaud, Pascal Legrand, Thomas Munro, Fujii Masao) [§](https://postgr.es/c/17e032822) [§](https://postgr.es/c/8d459762b) + + Previously only execution time was tracked. +* Overhaul [ltree](ltree.html "F.21. ltree")'s lquery syntax to treat `NOT` (!) more logically (Filip Rembialkowski, Tom Lane, Nikita Glukhov) [§](https://postgr.es/c/70dc4c509) [§](https://postgr.es/c/17ca06799) + + Also allow non-\* queries to use a numeric range ({}) of matches. +* Add support for binary I/O of [ltree](ltree.html "F.21. ltree"), lquery, and ltxtquery types (Nino Floris) [§](https://postgr.es/c/949a9f043) +* Add an option to [dict\_int](dict-int.html "F.11. dict_int") to ignore the sign of integers (Jeff Janes) [§](https://postgr.es/c/806eb92c0) +* Add [adminpack](adminpack.html "F.1. adminpack") function `pg_file_sync()` to allow fsync'ing a file (Fujii Masao) [§](https://postgr.es/c/d694e0bb7) +* Add [pageinspect](pageinspect.html "F.22. pageinspect") functions to output `t_infomask`/`t_infomask2` values in human-readable format (Craig Ringer, Sawada Masahiko, Michael Paquier) [§](https://postgr.es/c/ddbd5d873) [§](https://postgr.es/c/58b4cb30a) +* Add B-tree index de-duplication processing columns to pageinspect output (Peter Geoghegan) [§](https://postgr.es/c/93ee38ead) + +### E.24.4. Acknowledgments + +The following individuals (in alphabetical order) have contributed to this release as patch authors, committers, reviewers, testers, or reporters of issues. + +| | +| --- | +| Abhijit Menon-Sen | +| Adam Lee | +| Adam Scott | +| Adé Heyward | +| Adrien Nayrat | +| Ahsan Hadi | +| Alastair McKinley | +| Aleksandr Parfenov | +| Alex Aktsipetrov | +| Alex Macy | +| Alex Shulgin | +| Alexander Korotkov | +| Alexander Kukushkin | +| Alexander Kuzmenkov | +| Alexander Lakhin | +| Alexey Bashtanov | +| Alexey Kondratov | +| Álvaro Herrera | +| Amit Kapila | +| Amit Khandekar | +| Amit Langote | +| Amul Sul | +| Anastasia Lubennikova | +| Andreas Joseph Krogh | +| Andreas Karlsson | +| Andreas Kunert | +| Andreas Seltenreich | +| Andrei Zubkov | +| Andres Freund | +| Andrew Bille | +| Andrew Dunstan | +| Andrew Gierth | +| Andrey Borodin | +| Andrey Klychkov | +| Andrey Lepikhov | +| Anna Akenteva | +| Anna Endo | +| Anthony Nowocien | +| Anton Vlasov | +| Antonin Houska | +| Ants Aasma | +| Arne Roland | +| Arnold Müller | +| Arseny Sher | +| Arthur Nascimento | +| Arthur Zakirov | +| Ashutosh Bapat | +| Ashutosh Sharma | +| Ashwin Agrawal | +| Asif Rehman | +| Asim Praveen | +| Atsushi Torikoshi | +| Augustinas Jokubauskas | +| Austin Drenski | +| Basil Bourque | +| Beena Emerson | +| Ben Cornett | +| Benjie Gillam | +| Benoît Lobréau | +| Bernd Helmle | +| Bharath Rupireddy | +| Bhargav Kamineni | +| Binguo Bao | +| Brad DeJong | +| Brandur Leach | +| Brent Bates | +| Brian Williams | +| Bruce Momjian | +| Cameron Ezell | +| Cary Huang | +| Chapman Flack | +| Charles Offenbacher | +| Chen Huajun | +| Chenyang Lu | +| Chris Bandy | +| Chris Travers | +| Christoph Berg | +| Christophe Courtois | +| Corey Huinker | +| Craig Ringer | +| Cuiping Lin | +| Dagfinn Ilmari Mannsåker | +| Daniel Fiori | +| Daniel Gustafsson | +| Daniel Vérité | +| Daniel Westermann | +| Darafei Praliaskouski | +| Daryl Waycott | +| Dave Cramer | +| David Christensen | +| David Fetter | +| David G. Johnston | +| David Gilman | +| David Harper | +| David Rowley | +| David Steele | +| David Zhang | +| Davinder Singh | +| Dean Rasheed | +| Denis Stuchalin | +| Dent John | +| Didier Gautheron | +| Dilip Kumar | +| Dmitry Belyavsky | +| Dmitry Dolgov | +| Dmitry Ivanov | +| Dmitry Telpt | +| Dmitry Uspenskiy | +| Dominik Czarnota | +| Dongming Liu | +| Ed Morley | +| Edmund Horner | +| Emre Hasegeli | +| Eric Gillum | +| Erik Rijkers | +| Erwin Brandstetter | +| Ethan Waldo | +| Etsuro Fujita | +| Eugen Konkov | +| Euler Taveira | +| Fabien Coelho | +| Fabrízio de Royes Mello | +| Felix Lechner | +| Filip Janus | +| Filip Rembialkowski | +| Frank Gagnepain | +| Georgios Kokolatos | +| Gilles Darold | +| Greg Nancarrow | +| Grigory Smolkin | +| Guancheng Luo | +| Guillaume Lelarge | +| Hadi Moshayedi | +| Haiying Tang | +| Hamid Akhtar | +| Hans Buschmann | +| Hao Wu | +| Haribabu Kommi | +| Haruka Takatsuka | +| Heath Lord | +| Heikki Linnakangas | +| Himanshu Upadhyaya | +| Hironobu Suzuki | +| Hugh McMaster | +| Hugh Ranalli | +| Hugh Wang | +| Ian Barwick | +| Ibrar Ahmed | +| Ildar Musin | +| Insung Moon | +| Ireneusz Pluta | +| Isaac Morland | +| Ivan Kartyshov | +| Ivan Panchenko | +| Ivan Sergio Borgonovo | +| Jaime Casanova | +| James Coleman | +| James Gray | +| James Hunter | +| James Inform | +| James Lucas | +| Jan Mussler | +| Jaroslav Sivy | +| Jeevan Chalke | +| Jeevan Ladhe | +| Jeff Davis | +| Jeff Janes | +| Jehan-Guillaume de Rorthais | +| Jeremy Evans | +| Jeremy Schneider | +| Jeremy Smith | +| Jerry Sievers | +| Jesper Pedersen | +| Jesse Kinkead | +| Jesse Zhang | +| Jian Zhang | +| Jie Zhang | +| Jim Nasby | +| Jimmy Yih | +| Jobin Augustine | +| Joe Conway | +| John Hsu | +| John Naylor | +| Jon Jensen | +| Jonathan Katz | +| Jorge Gustavo Rocha | +| Josef Šimánek | +| Joseph Nahmias | +| Juan José Santamaría Flecha | +| Julian Backes | +| Julien Rouhaud | +| Jürgen Purtz | +| Justin King | +| Justin Pryzby | +| Karl O. Pinc | +| Keisuke Kuroda | +| Keith Fiske | +| Kelly Min | +| Ken Tanzer | +| Kirill Bychik | +| Kirk Jamison | +| Konstantin Knizhnik | +| Kuntal Ghosh | +| Kyle Kingsbury | +| Kyotaro Horiguchi | +| Lars Kanis | +| Laurenz Albe | +| Leif Gunnar Erlandsen | +| Li Japin | +| Liudmila Mantrova | +| Lucas Viecelli | +| Luis M. Carril | +| Lukáš Sobotka | +| Maciek Sakrejda | +| Magnus Hagander | +| Mahadevan Ramachandran | +| Mahendra Singh Thalor | +| Manuel Rigger | +| Marc Munro | +| Marcos David | +| Marina Polyakova | +| Mark Dilger | +| Mark Wong | +| Marko Tiikkaja | +| Markus Winand | +| Marti Raudsepp | +| Martijn van Oosterhout | +| Masahiko Sawada | +| Masahiro Ikeda | +| Masao Fujii | +| Mateusz Guzik | +| Matt Jibson | +| Matteo Beccati | +| Maxence Ahlouche | +| Melanie Plageman | +| Michael Banck | +| Michael Luo | +| Michael Meskes | +| Michael Paquier | +| Michail Nikolaev | +| Mike Palmiotto | +| Mithun Cy | +| Movead Li | +| Nathan Bossart | +| Nazli Ugur Koyluoglu | +| Neha Sharma | +| Nicola Contu | +| Nicolás Alvarez | +| Nikhil Sontakke | +| Nikita Glukhov | +| Nikolay Shaplov | +| Nino Floris | +| Noah Misch | +| Noriyoshi Shinoda | +| Oleg Bartunov | +| Oleg Samoilov | +| Oleksii Kliukin | +| Ondrej Jirman | +| Panagiotis Mavrogiorgos | +| Pascal Legrand | +| Patrick McHardy | +| Paul Guo | +| Paul Jungwirth | +| Paul Ramsey | +| Paul Sivash | +| Paul Spencer | +| Pavan Deolasee | +| Pavel Borisov | +| Pavel Luzanov | +| Pavel Stehule | +| Pavel Suderevsky | +| Peifeng Qiu | +| Pengzhou Tang | +| Peter Billen | +| Peter Eisentraut | +| Peter Geoghegan | +| Peter Smith | +| Petr Fedorov | +| Petr Jelínek | +| Phil Bayer | +| Philip Semanchuk | +| Philippe Beaudoin | +| Pierre Ducroquet | +| Pierre Giraud | +| Piotr Gabriel Kosinski | +| Piotr Wlodarczyk | +| Prabhat Sahu | +| Quan Zongliang | +| Quentin Rameau | +| Rafael Castro | +| Rafia Sabih | +| Raj Mohite | +| Rajkumar Raghuwanshi | +| Ramanarayana M | +| Ranier Vilela | +| Rares Salcudean | +| Raúl Marín Rodríguez | +| Raymond Martin | +| Reijo Suhonen | +| Richard Guo | +| Robert Ford | +| Robert Haas | +| Robert Kahlert | +| Robert Treat | +| Robin Abbi | +| Robins Tharakan | +| Roger Harkavy | +| Roman Peshkurov | +| Rui DeSousa | +| Rui Hai Jiang | +| Rushabh Lathia | +| Ryan Lambert | +| Ryohei Takahashi | +| Scott Ribe | +| Sean Farrell | +| Sehrope Sarkuni | +| Sergei Agalakov | +| Sergei Kornilov | +| Sergey Cherkashin | +| Shawn Debnath | +| Shawn Wang | +| Shay Rojansky | +| Shenhao Wang | +| Simon Riggs | +| Slawomir Chodnicki | +| Soumyadeep Chakraborty | +| Stéphane Lorek | +| Stephen Frost | +| Steve Rogerson | +| Steven Winfield | +| Surafel Temesgen | +| Suraj Kharage | +| Takanori Asaba | +| Takao Fujii | +| Takayuki Tsunakawa | +| Takuma Hoshiai | +| Tatsuhito Kasahara | +| Tatsuo Ishii | +| Tatsuro Yamada | +| Taylor Vesely | +| Teodor Sigaev | +| Tham Nguyen | +| Thibaut Madelaine | +| Thom Brown | +| Thomas Kellerer | +| Thomas Munro | +| Tiago Anastacio | +| Tim Clarke | +| Tim Möhlmann | +| Tom Ellis | +| Tom Gottfried | +| Tom Lane | +| Tomas Vondra | +| Tuomas Leikola | +| Tushar Ahuja | +| Victor Wagner | +| Victor Yegorov | +| Vignesh C | +| Vik Fearing | +| Vinay Banakar | +| Vladimir Leskov | +| Vladimir Sitnikov | +| Vyacheslav Makarov | +| Vyacheslav Shablistyy | +| Will Leinweber | +| William Crowell | +| Wyatt Alt | +| Yang Xiao | +| Yaroslav Schekin | +| Yi Huang | +| Yigong Hu | +| Yoann La Cancellera | +| Yoshikazu Imai | +| Yu Kimura | +| Yugo Nagata | +| Yuli Khodorkovskiy | +| Yusuke Egashira | +| Yuya Watari | +| Yuzuko Hosoya | +| ZhenHua Cai | + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-1.html "E.23. Release 13.1") | [Up](release.html "Appendix E. Release Notes") | [Next](release-prior.html "E.25. Prior Releases") | +| E.23. Release 13.1 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.25. Prior Releases | + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.1/) diff --git a/corpus/changelog/postgresql_releases/postgresql_131.md b/corpus/changelog/postgresql_releases/postgresql_131.md new file mode 100644 index 0000000000000000000000000000000000000000..007e028f0c4f12d73ab4f4e2b3a7ae41d2003a00 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_131.md @@ -0,0 +1,149 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.1/ +Version: 13.1 + +## PostgreSQL 13.1 + +| E.23. Release 13.1 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-2.html "E.22. Release 13.2") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13.html "E.24. Release 13") | + +--- + +## E.23. Release 13.1 + +[E.23.1. Migration to Version 13.1](release-13-1.html#id-1.11.6.28.4) + +[E.23.2. Changes](release-13-1.html#id-1.11.6.28.5) + +**Release date:**2020-11-12 + +This release contains a variety of fixes from 13.0. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +### E.23.1. Migration to Version 13.1 + +A dump/restore is not required for those running 13.X. + +### E.23.2. Changes + +* Block `DECLARE CURSOR ... WITH HOLD` and firing of deferred triggers within index expressions and materialized view queries (Noah Misch) [§](https://postgr.es/c/c90c84b3f) + + This is essentially a leak in the “security restricted operation” sandbox mechanism. An attacker having permission to create non-temporary SQL objects could parlay this leak to execute arbitrary SQL code as a superuser. + + The PostgreSQL Project thanks Etienne Stalmans for reporting this problem. (CVE-2020-25695) +* Fix usage of complex connection-string parameters in pg\_dump, pg\_restore, clusterdb, reindexdb, and vacuumdb (Tom Lane) [§](https://postgr.es/c/cb8885ac4) [§](https://postgr.es/c/1814f915b) + + The `-d` parameter of pg\_dump and pg\_restore, or the `--maintenance-db` parameter of the other programs mentioned, can be a “connection string” containing multiple connection parameters rather than just a database name. In cases where these programs need to initiate additional connections, such as parallel processing or processing of multiple databases, the connection string was forgotten and just the basic connection parameters (database name, host, port, and username) were used for the additional connections. This could lead to connection failures if the connection string included any other essential information, such as non-default SSL or GSS parameters. Worse, the connection might succeed but not be encrypted as intended, or be vulnerable to man-in-the-middle attacks that the intended connection parameters would have prevented. (CVE-2020-25694) +* When psql's `\connect` command re-uses connection parameters, ensure that all non-overridden parameters from a previous connection string are re-used (Tom Lane) [§](https://postgr.es/c/2e4af4110) + + This avoids cases where reconnection might fail due to omission of relevant parameters, such as non-default SSL or GSS options. Worse, the reconnection might succeed but not be encrypted as intended, or be vulnerable to man-in-the-middle attacks that the intended connection parameters would have prevented. This is largely the same problem as just cited for pg\_dump et al, although psql's behavior is more complex since the user may intentionally override some connection parameters. (CVE-2020-25694) +* Prevent psql's `\gset` command from modifying specially-treated variables (Noah Misch) [§](https://postgr.es/c/67029845b) + + `\gset` without a prefix would overwrite whatever variables the server told it to. Thus, a compromised server could set specially-treated variables such as `PROMPT1`, giving the ability to execute arbitrary shell code in the user's session. + + The PostgreSQL Project thanks Nick Cleaton for reporting this problem. (CVE-2020-25696) +* Fix unintended breakage of the replication protocol (Álvaro Herrera) [§](https://postgr.es/c/72e43fc31) [§](https://postgr.es/c/9f783aea6) + + A walsender reports two command-completion events for `START_REPLICATION`. This was undocumented and apparently unintentional; so we failed to notice that a late 13.0 change removed the duplicate event. However it turns out that walreceivers require the extra event in some code paths. The most practical fix is to decree that the extra event is part of the protocol and resume generating it. +* Ensure that SLRU directories are properly fsync'd during checkpoints (Thomas Munro) [§](https://postgr.es/c/052014a20) + + This prevents possible data loss in a subsequent operating system crash. +* Fix `ALTER ROLE` for users with the `BYPASSRLS` attribute (Tom Lane, Stephen Frost) [§](https://postgr.es/c/768dbef0d) + + The `BYPASSRLS` attribute is only allowed to be changed by superusers, but other `ALTER ROLE` operations, such as password changes, should be allowed with only ordinary permission checks. The previous coding erroneously restricted all changes on such a role to superusers. +* Disallow `ALTER TABLE ONLY ... DROP EXPRESSION` when there are child tables (Peter Eisentraut) [§](https://postgr.es/c/539775981) + + The current implementation cannot handle this case correctly, so just forbid it for now. +* Ensure that `ALTER TABLE ONLY ... ENABLE/DISABLE TRIGGER` does not recurse to child tables (Álvaro Herrera) [§](https://postgr.es/c/5f6463a20) + + Previously the `ONLY` flag was ignored. +* Allow `LOCK TABLE` to succeed on a self-referential view (Tom Lane) [§](https://postgr.es/c/44b973b91) + + It previously threw an error complaining about infinite recursion, but there seems no need to disallow the case. +* Retain statistics about an index across `REINDEX CONCURRENTLY` (Michael Paquier, Fabrízio de Royes Mello) [§](https://postgr.es/c/bb62df46b) + + Non-concurrent reindexing has always preserved such statistics. +* Fix incorrect progress reporting from `REINDEX CONCURRENTLY` (Matthias van de Meent, Michael Paquier) [§](https://postgr.es/c/1aedaba78) +* Ensure that `GENERATED` columns are updated when the column(s) they depend on are updated via a rule or an updatable view (Tom Lane) [§](https://postgr.es/c/70492195b) + + This fix also takes care of possible failure to fire a column-specific trigger in such cases. +* Fix failures with collation-dependent partition bound expressions (Tom Lane) [§](https://postgr.es/c/61a78c71a) +* Support hashing of text arrays (Peter Eisentraut) [§](https://postgr.es/c/82d4a2a7d) + + Array hashing failed if the array element type is collatable. Notably, this prevented using hash partitioning with a text array column as partition key. +* Prevent internal overflows in cross-type datetime comparisons (Nikita Glukhov, Alexander Korotkov, Tom Lane) [§](https://postgr.es/c/5ed20a689) + + Previously, comparing a date to a timestamp would fail if the date is past the valid range for timestamps. There were also corner cases involving overflow of close-to-the-limit timestamp values during timezone rotation. +* Fix off-by-one conversion of negative years to BC dates in `to_date()` and `to_timestamp()` (Dar Alathar-Yemen, Tom Lane) [§](https://postgr.es/c/99fd38c02) + + Also, arrange for the combination of a negative year and an explicit “BC” marker to cancel out and produce AD. +* Allow the `jsonpath` `.datetime()` method to accept ISO 8601-format timestamps (Nikita Glukhov) [§](https://postgr.es/c/abcc0ab16) [§](https://postgr.es/c/651bdbc81) + + This is not required by SQL, but it seems appropriate since our `to_json()` functions generate that timestamp format for Javascript compatibility. +* Ensure that standby servers will archive WAL timeline history files when `archive_mode` is set to `always` (Grigory Smolkin, Fujii Masao) [§](https://postgr.es/c/059caf36c) + + This oversight could lead to failure of subsequent PITR recovery attempts. +* Fix edge cases in detecting premature death of the postmaster on platforms that use `kqueue()` (Thomas Munro) [§](https://postgr.es/c/e0950135a) [§](https://postgr.es/c/47522ee00) +* Avoid generating an incorrect incremental-sort plan when the sort key is a volatile expression (James Coleman) [§](https://postgr.es/c/2d26c4ac7) +* Fix possible crash when considering partition-wise joins during GEQO planning (Tom Lane) [§](https://postgr.es/c/b7f166efa) +* Fix possible infinite loop or corrupted output data in TOAST decompression (Tom Lane) [§](https://postgr.es/c/2330f4d3a) [§](https://postgr.es/c/7957e75c5) +* Fix counting of the number of entries in B-tree indexes during cleanup-only `VACUUM`s (Peter Geoghegan) [§](https://postgr.es/c/02c9386ca) +* Ensure that data is detoasted before being inserted into a BRIN index (Tomas Vondra) [§](https://postgr.es/c/6a7b55f37) + + Index entries are not supposed to contain out-of-line TOAST pointers, but BRIN didn't get that memo. This could lead to errors like “missing chunk number 0 for toast value NNN”. (If you are faced with such an error from an existing index, `REINDEX` should be enough to fix it.) +* Fix buffered GiST index builds to work when the index has included columns (Pavel Borisov) [§](https://postgr.es/c/962ab473e) +* Fix unportable use of `getnameinfo()` in `pg_hba_file_rules` view (Tom Lane) [§](https://postgr.es/c/a58a631b4) + + On FreeBSD 11, and possibly other platforms, the view's `address` and `netmask` columns were always null due to this error. +* Avoid crash if `debug_query_string` is NULL when starting a parallel worker (Noah Misch) [§](https://postgr.es/c/ab2e2ce46) +* Avoid failures when a `BEFORE ROW UPDATE` trigger returns the “old” row of a table having dropped or “missing” columns (Amit Langote, Tom Lane) [§](https://postgr.es/c/d88d8ad28) [§](https://postgr.es/c/7aeb6404f) + + This method of suppressing an update could result in crashes, unexpected `CHECK` constraint failures, or incorrect `RETURNING` output, because “missing” columns would read as NULLs for those purposes. (A column is “missing” for this purpose if it was added by `ALTER TABLE ADD COLUMN` with a non-NULL, but constant, default value.) Dropped columns could cause trouble as well. +* Fix `EXPLAIN`'s output for incremental sort plans to have correct tag nesting in XML output mode (Daniel Gustafsson) [§](https://postgr.es/c/e4538708d) +* Avoid unnecessary failure when transferring very large payloads through shared memory queues (Markus Wanner) [§](https://postgr.es/c/1f53d0b9f) +* Fix omission of result data type coercion in some cases in SQL-language functions (Tom Lane) [§](https://postgr.es/c/25378db74) + + This could lead to wrong results or crashes, depending on the data types involved. +* Fix incorrect handling of template function attributes in JIT code generation (Andres Freund) [§](https://postgr.es/c/ae3e75aba) [§](https://postgr.es/c/efc9a8e98) + + This has been shown to cause crashes on `s390x`, and very possibly there are other cases on other platforms. +* Improve code generated for compare\_exchange and fetch\_add operations on PPC (Noah Misch) [§](https://postgr.es/c/d41cb63ff) [§](https://postgr.es/c/5efa788e1) +* Fix relation cache memory leaks with RLS policies (Tom Lane) [§](https://postgr.es/c/f7873900f) +* Fix edge-case memory leak in `index_get_partition()` (Justin Pryzby) [§](https://postgr.es/c/d94d37f8c) +* Fix small memory leak when SIGHUP processing decides that a new GUC variable value cannot be applied without a restart (Tom Lane) [§](https://postgr.es/c/9343bfefa) +* Fix memory leaks in PL/pgsql's `CALL` processing (Pavel Stehule, Tom Lane) [§](https://postgr.es/c/f0e4ec74e) +* In libpq for Windows, call `WSAStartup()` once per process and `WSACleanup()` not at all (Tom Lane, Alexander Lakhin) [§](https://postgr.es/c/d2074daeb) + + Previously, libpq invoked `WSAStartup()` at connection start and `WSACleanup()` at connection cleanup. However, it appears that calling `WSACleanup()` can interfere with other program operations; notably, we have observed rare failures to emit expected output to stdout. There appear to be no ill effects from omitting the call, so do that. (This also eliminates a performance issue from repeated DLL loads and unloads when a program performs a series of database connections.) +* Fix ecpg library's per-thread initialization logic for Windows (Tom Lane, Alexander Lakhin) [§](https://postgr.es/c/fd048e0cb) + + Multi-threaded ecpg applications could suffer rare misbehavior due to incorrect locking. +* Fix ecpg's mis-processing of `B'...'` and `X'...'` literals (Shenhao Wang) [§](https://postgr.es/c/1bccb159a) [§](https://postgr.es/c/3459f4169) +* On Windows, make psql read the output of a backtick command in text mode, not binary mode (Tom Lane) [§](https://postgr.es/c/ba4f5413e) + + This ensures proper handling of newlines. +* Ensure that pg\_dump collects per-column information about extension configuration tables (Fabrízio de Royes Mello, Tom Lane) [§](https://postgr.es/c/72857482c) [§](https://postgr.es/c/2ea624b4b) + + Failure to do this led to crashes when specifying `--inserts`, or underspecified (though usually correct) `COPY` commands when using `COPY` to reload the tables' data. +* Make pg\_upgrade check for pre-existence of tablespace directories in the target cluster (Bruce Momjian) [§](https://postgr.es/c/59cfff65b) [§](https://postgr.es/c/79fe23465) +* Fix potential memory leak in `contrib/pgcrypto` (Michael Paquier) [§](https://postgr.es/c/1bd9b2b23) +* Add check for an unlikely failure case in `contrib/pgcrypto` (Daniel Gustafsson) [§](https://postgr.es/c/3d338a46a) +* Fix recently-added `timetz` test case so it works when the USA is not observing daylight savings time (Tom Lane) [§](https://postgr.es/c/ee03baad2) +* Update time zone data files to tzdata release 2020d for DST law changes in Fiji, Morocco, Palestine, the Canadian Yukon, Macquarie Island, and Casey Station (Antarctica); plus historical corrections for France, Hungary, Monaco, and Palestine. (Tom Lane) [§](https://postgr.es/c/3f26dca76) [§](https://postgr.es/c/96ed2ae93) +* Sync our copy of the timezone library with IANA tzcode release 2020d (Tom Lane) [§](https://postgr.es/c/e0cf5e9b2) [§](https://postgr.es/c/0e551533b) + + This absorbs upstream's change of zic's default output option from “fat” to “slim”. That's just cosmetic for our purposes, as we continue to select the “fat” mode in pre-v13 branches. This change also ensures that `strftime()` does not change `errno` unless it fails. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-2.html "E.22. Release 13.2") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13.html "E.24. Release 13") | +| E.22. Release 13.2 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.24. Release 13 | + +[Previous](/docs/release/13.0/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.2/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1310.md b/corpus/changelog/postgresql_releases/postgresql_1310.md new file mode 100644 index 0000000000000000000000000000000000000000..ac022d9fcb38ff35d52e7c8456dfee9458bc7167 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1310.md @@ -0,0 +1,140 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.10/ +Version: 13.10 + +## PostgreSQL 13.10 + +| E.14. Release 13.10 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-11.html "E.13. Release 13.11") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-9.html "E.15. Release 13.9") | + +--- + +## E.14. Release 13.10 + +[E.14.1. Migration to Version 13.10](release-13-10.html#id-1.11.6.19.4) + +[E.14.2. Changes](release-13-10.html#id-1.11.6.19.5) + +**Release date:**2023-02-09 + +This release contains a variety of fixes from 13.9. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +### E.14.1. Migration to Version 13.10 + +A dump/restore is not required for those running 13.X. + +However, if you are upgrading from a version earlier than 13.7, see [Section E.17](release-13-7.html "E.17. Release 13.7"). + +### E.14.2. Changes + +* libpq can leak memory contents after GSSAPI transport encryption initiation fails (Jacob Champion) [§](https://postgr.es/c/45a945ee9) + + A modified server, or an unauthenticated man-in-the-middle, can send a not-zero-terminated error message during setup of GSSAPI (Kerberos) transport encryption. libpq will then copy that string, as well as following bytes in application memory up to the next zero byte, to its error report. Depending on what the calling application does with the error report, this could result in disclosure of application memory contents. There is also a small probability of a crash due to reading beyond the end of memory. Fix by properly zero-terminating the server message. (CVE-2022-41862) +* Fix calculation of which `GENERATED` columns need to be updated in child tables during an `UPDATE` on a partitioned table or inheritance tree (Amit Langote, Tom Lane) [§](https://postgr.es/c/ad38e2f89) [§](https://postgr.es/c/787db4be9) + + This fixes failure to update `GENERATED` columns that do not exist in the parent table, or that have different dependencies than are in the parent column's generation expression. +* Allow `REPLICA IDENTITY` to be set on an index that's not (yet) valid (Tom Lane) [§](https://postgr.es/c/72d611109) + + When pg\_dump dumps a partitioned index that's marked `REPLICA IDENTITY`, it generates a command sequence that applies `REPLICA IDENTITY` before the partitioned index has been marked valid, causing restore to fail. There seems no very good reason to prohibit doing it in that order, so allow it. The marking will have no effect anyway until the index becomes valid. +* Fix handling of `DEFAULT` markers in rules that perform an `INSERT` from a multi-row `VALUES` list (Dean Rasheed) [§](https://postgr.es/c/3bed88123) + + In some cases a `DEFAULT` marker would not get replaced with the proper default-value expression, leading to an “unrecognized node type” error. +* Reject uses of undefined variables in `jsonpath` existence checks (Alexander Korotkov, David G. Johnston) [§](https://postgr.es/c/2ff3ac3b5) + + While `jsonpath` match operators threw an error for an undefined variable in the path pattern, the existence operators silently treated it as a match. +* Fix edge-case data corruption in parallel hash joins (Dmitry Astapov) [§](https://postgr.es/c/1a5afe007) + + If the final chunk of a large tuple being written out to a temporary file was exactly 32760 bytes, it would be corrupted due to a fencepost bug. The query would typically fail later with corrupted-data symptoms. +* Honor non-default settings of `checkpoint_completion_target` (Bharath Rupireddy) [§](https://postgr.es/c/fed4e92f3) + + Internal state was not updated after a change in `checkpoint_completion_target`, possibly resulting in performing checkpoint I/O faster or slower than desired, especially if that setting was changed on-the-fly. +* Log the correct ending timestamp in `recovery_target_xid` mode (Tom Lane) [§](https://postgr.es/c/1b9a0b96a) + + When ending recovery based on the `recovery_target_xid` setting with `recovery_target_inclusive` = `off`, we printed an incorrect timestamp (always 2000-01-01) in the “recovery stopping before ... transaction” log message. +* Improve error reporting for some buffered file read failures (Peter Eisentraut) [§](https://postgr.es/c/cf74b6ead) + + Correctly report a short read, giving the numbers of bytes desired and actually read, instead of reporting an irrelevant error code. Most places got this right already, but some recently-written replication logic did not. +* Prevent “wrong tuple length” failure at the end of `VACUUM` (Ashwin Agrawal, Junfeng Yang) [§](https://postgr.es/c/72b6098be) + + This occurred if `VACUUM` needed to update the current database's `datfrozenxid` value and the database has so many granted privileges that its `datacl` value has been pushed out-of-line. +* In extended query protocol, avoid an immediate commit after `ANALYZE` if we're running a pipeline (Tom Lane) [§](https://postgr.es/c/942cc240f) + + If there's not been an explicit `BEGIN TRANSACTION`, `ANALYZE` would take it on itself to commit, which should not happen within a pipelined series of commands. +* Reject cancel request packets having the wrong length (Andrey Borodin) [§](https://postgr.es/c/a9bccffe5) + + The server would process a cancel request even if its length word was too small. This led to reading beyond the end of the allocated buffer. In theory that could cause a segfault, but it seems quite unlikely to happen in practice, since the buffer would have to be very close to the end of memory. The more likely outcome was a bogus log message about wrong backend PID or cancel code. Complain about the wrong length, instead. +* Add recursion and looping defenses in subquery pullup (Tom Lane) [§](https://postgr.es/c/4fceb454f) + + A contrived query can result in deep recursion and unreasonable amounts of time spent trying to flatten subqueries. A proper fix for that seems unduly invasive for a back-patch, but we can at least add stack depth checks and an interrupt check to allow the query to be cancelled. +* Fix partitionwise-join code to tolerate failure to produce a plan for each partition (Tom Lane) [§](https://postgr.es/c/4ebca555c) + + This could result in “could not devise a query plan for the given query” errors. +* Limit the amount of cleanup work done by `get_actual_variable_range` (Simon Riggs) [§](https://postgr.es/c/6e639267a) + + Planner runs occurring just after deletion of a large number of tuples appearing at the end of an index could expend significant amounts of work setting the “killed” bits for those index entries. Limit the amount of work done in any one query by giving up on this process after examining 100 heap pages. All the cleanup will still happen eventually, but without so large a performance hiccup. +* Ensure that execution of full-text-search queries can be cancelled while they are performing phrase matches (Tom Lane) [§](https://postgr.es/c/74670688f) +* Fix memory leak in hashing strings with nondeterministic collations (Jeff Davis) [§](https://postgr.es/c/a844052b5) +* Clean up the libpq connection object after a failed replication connection attempt (Andres Freund) [§](https://postgr.es/c/c5864805b) + + The previous coding leaked the connection object. In background code paths that's pretty harmless because the calling process will give up and exit. But in commands such as `CREATE SUBSCRIPTION`, such a failure resulted in a small session-lifespan memory leak. +* In hot-standby servers, reduce processing effort for tracking XIDs known to be active on the primary (Simon Riggs, Michail Nikolaev) [§](https://postgr.es/c/6e8ad1152) + + Insufficiently-aggressive cleanup of the KnownAssignedXids array could lead to poor performance, particularly when `max_connections` is set to a large value on the standby. +* Ignore invalidated logical-replication slots while determining oldest catalog xmin (Sirisha Chamarthi) [§](https://postgr.es/c/36eeb37cd) + + A replication slot could prevent cleanup of dead tuples in the system catalogs even after it becomes invalidated due to exceeding `max_slot_wal_keep_size`. Thus, failure of a replication consumer could lead to indefinitely-large catalog bloat. +* Fix uninitialized-memory usage in logical decoding (Masahiko Sawada) [§](https://postgr.es/c/4ec157c15) + + In certain cases, resumption of logical decoding could try to re-use XID data that had already been freed, leading to unpredictable behavior. +* Avoid rare “failed to acquire cleanup lock” panic during WAL replay of hash-index page split operations (Robert Haas) [§](https://postgr.es/c/20c223336) +* Advance a heap page's LSN when setting its all-visible bit during WAL replay (Jeff Davis) [§](https://postgr.es/c/58a45bb1d) + + Failure to do this left the page possibly different on standby servers than the primary, and violated some other expectations about when the LSN changes. This seems only a theoretical hazard so far as PostgreSQL itself is concerned, but it could upset third-party tools. +* Prevent unsafe usage of a relation cache entry's `rd_smgr` pointer (Amul Sul) [§](https://postgr.es/c/9a299cf7c) + + Remove various assumptions that `rd_smgr` would stay valid over a series of operations, by wrapping all uses of it in a function that will recompute it if needed. This prevents bugs occurring when an unexpected cache flush occurs partway through such a series. +* Fix latent buffer-overrun problem in `WaitEventSet` logic (Thomas Munro) [§](https://postgr.es/c/c159b0383) + + The `epoll`-based and `kqueue`-based implementations could ask the kernel for too many events if the size of their internal buffer was different from the size of the caller's output buffer. That case is not known to occur in released PostgreSQL versions, but this error is a hazard for external modules and future bug fixes. +* Avoid nominally-undefined behavior when accessing shared memory in 32-bit builds (Andres Freund) [§](https://postgr.es/c/c13667b51) + + clang's undefined-behavior sanitizer complained about use of a pointer that was less aligned than it should be. It's very unlikely that this would cause a problem in non-debug builds, but it's worth fixing for testing purposes. +* Remove faulty assertion in useless-RESULT-RTE optimization logic (Tom Lane) [§](https://postgr.es/c/aca695fb6) +* Fix copy-and-paste errors in cache-lookup-failure messages for ACL checks (Justin Pryzby) [§](https://postgr.es/c/4dbe72d61) + + In principle these errors should never be reached. But if they are, some of them reported the wrong type of object. +* In pg\_dump, avoid calling unsafe server functions before we have locks on the tables to be examined (Tom Lane, Gilles Darold) [§](https://postgr.es/c/e46e986ba) [§](https://postgr.es/c/a5b26aaaf) + + pg\_dump uses certain server functions that can fail if examining a table that gets dropped concurrently. Avoid this type of failure by ensuring that we obtain access share lock before inquiring too deeply into a table's properties, and that we don't apply such functions to tables we don't intend to dump at all. +* Fix tab completion of `ALTER FUNCTION/PROCEDURE/ROUTINE` ... `SET SCHEMA` (Dean Rasheed) [§](https://postgr.es/c/2ad4abedf) +* Fix `contrib/seg` to not crash or print garbage if an input number has more than 127 digits (Tom Lane) [§](https://postgr.es/c/d35f1d485) +* In `contrib/sepgsql`, avoid deprecation warnings with recent libselinux (Michael Paquier) [§](https://postgr.es/c/c304c069d) +* Fix build on Microsoft Visual Studio 2013 (Tom Lane) [§](https://postgr.es/c/0942acb73) + + A previous patch supposed that all platforms of interest have `snprintf()`, but MSVC 2013 isn't quite there yet. Revert to using `sprintf()` on that platform. +* Fix compile failure in building PL/Perl with MSVC when using Strawberry Perl (Andrew Dunstan) [§](https://postgr.es/c/9fe5cff14) +* Fix mismatch of PL/Perl built with MSVC versus a Perl library built with gcc (Andrew Dunstan) [§](https://postgr.es/c/68d89d80c) + + Such combinations could previously fail with “loadable library and perl binaries are mismatched” errors. +* Suppress compiler warnings from Perl's header files (Andres Freund) [§](https://postgr.es/c/ce073d014) + + Our preferred compiler options provoke warnings about constructs appearing in recent versions of Perl's header files. When using gcc, we can suppress these warnings with a pragma. +* Fix pg\_waldump to build on compilers that don't discard unused static-inline functions (Tom Lane) [§](https://postgr.es/c/c78f109b8) +* Update time zone data files to tzdata release 2022g for DST law changes in Greenland and Mexico, plus historical corrections for northern Canada, Colombia, and Singapore. (Tom Lane) [§](https://postgr.es/c/20d9da107) + + Notably, a new timezone America/Ciudad\_Juarez has been split off from America/Ojinaga. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-11.html "E.13. Release 13.11") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-9.html "E.15. Release 13.9") | +| E.13. Release 13.11 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.15. Release 13.9 | + +[Previous](/docs/release/13.9/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.11/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1311.md b/corpus/changelog/postgresql_releases/postgresql_1311.md new file mode 100644 index 0000000000000000000000000000000000000000..3737ca1168d9176e8203a88d42cb488429c152e6 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1311.md @@ -0,0 +1,201 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.11/ +Version: 13.11 + +## PostgreSQL 13.11 + +| E.13. Release 13.11 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-12.html "E.12. Release 13.12") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-10.html "E.14. Release 13.10") | + +--- + +## E.13. Release 13.11 + +[E.13.1. Migration to Version 13.11](release-13-11.html#id-1.11.6.18.4) + +[E.13.2. Changes](release-13-11.html#id-1.11.6.18.5) + +**Release date:**2023-05-11 + +This release contains a variety of fixes from 13.10. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +### E.13.1. Migration to Version 13.11 + +A dump/restore is not required for those running 13.X. + +However, if you are upgrading from a version earlier than 13.7, see [Section E.17](release-13-7.html "E.17. Release 13.7"). + +### E.13.2. Changes + +* Prevent `CREATE SCHEMA` from defeating changes in `search_path` (Alexander Lakhin) [§](https://postgr.es/c/2212f7db8) [§](https://postgr.es/c/feb9e7fbb) + + Within a `CREATE SCHEMA` command, objects in the prevailing `search_path`, as well as those in the newly-created schema, would be visible even within a called function or script that attempted to set a secure `search_path`. This could allow any user having permission to create a schema to hijack the privileges of a security definer function or extension script. + + The PostgreSQL Project thanks Alexander Lakhin for reporting this problem. (CVE-2023-2454) +* Enforce row-level security policies correctly after inlining a set-returning function (Stephen Frost, Tom Lane) [§](https://postgr.es/c/b8e28f04f) + + If a set-returning SQL-language function refers to a table having row-level security policies, and it can be inlined into a calling query, those RLS policies would not get enforced properly in some cases involving re-using a cached plan under a different role. This could allow a user to see or modify rows that should have been invisible. + + The PostgreSQL Project thanks Wolfgang Walther for reporting this problem. (CVE-2023-2455) +* Avoid crash when the new schema name is omitted in `CREATE SCHEMA` (Michael Paquier) [§](https://postgr.es/c/7e95a33b4) + + The SQL standard allows writing `CREATE SCHEMA AUTHORIZATION owner_name`, with the schema name defaulting to *`owner_name`*. However some code paths expected the schema name to be present and would fail. +* Fix enabling/disabling of cloned triggers in partitioned tables (Tom Lane) [§](https://postgr.es/c/b02bf1e46) + + `ALTER TABLE ... ENABLE/DISABLE TRIGGER USER` skipped cloned triggers, mistaking them for system triggers. Other variants of `ENABLE/DISABLE TRIGGER` would process them, but only after improperly enforcing a superuserness check. +* Disallow altering composite types that are stored in indexes (Tom Lane) [§](https://postgr.es/c/29a20ff06) + + `ALTER TYPE` disallows non-binary-compatible modifications of composite types if they are stored in any table columns. (Perhaps that will be allowed someday, but it hasn't happened yet; the locking implications of rewriting many tables are daunting.) We overlooked the possibility that an index might contain a composite type that doesn't also appear in its table. +* Disallow system columns as elements of foreign keys (Tom Lane) [§](https://postgr.es/c/bfb993b1b) + + Since the removal of OID as a system column, there is no plausible use-case for this, and various bits of code no longer support it. Disallow it rather than trying to fix all the cases. +* Ensure that `COPY TO` from an RLS-enabled parent table does not copy any rows from child tables (Antonin Houska) [§](https://postgr.es/c/866fd004d) + + The documentation is quite clear that `COPY TO` copies rows from only the named table, not any inheritance children it may have. However, if row-level security was enabled on the table then this stopped being true. +* Avoid possible crash when `array_position()` or `array_positions()` is passed an empty array (Tom Lane) [§](https://postgr.es/c/9a72f499a) +* Fix possible out-of-bounds fetch in `to_char()` (Tom Lane) [§](https://postgr.es/c/386a26023) + + With bad luck this could have resulted in a server crash. +* Avoid buffer overread in `translate()` function (Daniil Anisimov) [§](https://postgr.es/c/3b37e8442) + + When using the deletion feature, the function might fetch the byte just after the input string, creating a small risk of crash. +* Fix error cursor setting for parse errors in JSON string literals (Tom Lane) [§](https://postgr.es/c/52e9a7816) + + Most cases in which a syntax error is detected in a string literal within a JSON value failed to set the error cursor appropriately. This led at least to an unhelpful error message (pointing to the token before the string, rather than the actual trouble spot), and could even result in a crash in v14 and later. +* Fix data corruption due to `vacuum_defer_cleanup_age` being larger than the current 64-bit xid (Andres Freund) [§](https://postgr.es/c/e6d77f22c) + + In v14 and later with non-default settings of `vacuum_defer_cleanup_age`, it was possible to compute a very large vacuum cleanup horizon xid, leading to vacuum removing rows that are still live. v12 and v13 have a lesser form of the same problem affecting only GiST indexes, which could lead to index pages getting recycled too early. +* Fix parser's failure to detect some cases of improperly-nested aggregates (Tom Lane) [§](https://postgr.es/c/bc0bcce2e) + + This oversight could lead to executor failures for queries that should have been rejected as invalid. +* Fix data structure corruption during parsing of serial `SEQUENCE NAME` options (David Rowley) [§](https://postgr.es/c/8d684c445) + + This can lead to trouble if an event trigger captures the corrupted parse tree. +* Correctly update plan nodes' parallel-safety markings when moving initplans from one node to another (Tom Lane) [§](https://postgr.es/c/96c698e3f) + + This planner oversight could lead to “subplan was not initialized” errors at runtime. +* Disable the inverse-transition optimization for window aggregates when the call contains sub-SELECTs (David Rowley) [§](https://postgr.es/c/301eb3ee4) + + This optimization requires that the aggregate's argument expressions have repeatable results, which might not hold for a sub-SELECT. +* Fix oversights in execution of nested `ARRAY[]` constructs (Alexander Lakhin, Tom Lane) [§](https://postgr.es/c/1bbbe1460) + + Correctly detect overflow of the total space needed for the result array, avoiding a possible crash due to undersized output allocation. Also ensure that any trailing padding space in the result array is zeroed; while leaving garbage there is harmless for most purposes, it can result in odd behavior later. +* Prevent crash when updating a field within an array-of-domain-over-composite-type column (Dmitry Dolgov) [§](https://postgr.es/c/7428aecdd) +* Fix partition pruning logic for partitioning on boolean columns (David Rowley) [§](https://postgr.es/c/6848f0c67) + + Pruning with a condition like `boolcol IS NOT TRUE` was done incorrectly, leading to possibly not returning rows in which `boolcol` is NULL. Also, the rather unlikely case of partitioning on `NOT boolcol` was handled incorrectly. +* Fix race condition in per-batch cleanup during parallel hash join (Thomas Munro, Melanie Plageman) [§](https://postgr.es/c/6e94d62e3) + + A crash was possible given unlucky timing and `parallel_leader_participation` = `off` (which is not the default). +* Recalculate `GENERATED` columns after an EvalPlanQual check (Tom Lane) [§](https://postgr.es/c/4a94cbd02) + + In `READ COMMITTED` isolation mode, the effects of a row update might need to get reapplied to a newer version of the row than the query found originally. If so, we need to recompute any `GENERATED` columns, in case they depend on columns that were changed by the concurrent update. +* Don't balance vacuum cost delay when a table has a per-relation `vacuum_cost_delay` setting of zero (Masahiko Sawada) [§](https://postgr.es/c/b95f36f86) + + Delay balancing is supposed to be disabled whenever autovacuum is processing a table with a per-relation `vacuum_cost_delay` setting, but this was done only for positive settings, not zero. +* Fix corner-case crashes when columns have been added to the end of a view (Tom Lane) [§](https://postgr.es/c/695b34ab3) +* Repair rare failure of MULTIEXPR\_SUBLINK subplans in partitioned updates (Andres Freund, Tom Lane) [§](https://postgr.es/c/1e199c259) + + Use of the syntax `INSERT ... ON CONFLICT DO UPDATE SET (c1, ...) = (SELECT ...)` with a partitioned target table could result in failure if any child table is dissimilar from the parent (for example, different physical column order). This typically manifested as failure of consistency checks in the executor; but a crash or incorrect data updates are also possible. +* Fix handling of `DEFAULT` markers within a multi-row `INSERT ... VALUES` query on a view that has a `DO ALSO INSERT ... SELECT` rule (Dean Rasheed) [§](https://postgr.es/c/226da3d47) + + Such cases typically failed with “unrecognized node type” errors or assertion failures. +* Support references to `OLD` and `NEW` within subqueries in rule actions (Dean Rasheed, Tom Lane) [§](https://postgr.es/c/39ad791e8) + + Such references are really lateral references, but the server could crash if the subquery wasn't explicitly marked with `LATERAL`. Arrange to do that implicitly when necessary. +* When decompiling a rule or SQL function body containing `INSERT`/`UPDATE`/`DELETE` within `WITH`, take care to print the correct alias for the target table (Tom Lane) [§](https://postgr.es/c/4efb4f0d4) +* Fix glitches in `SERIALIZABLE READ ONLY` optimization (Thomas Munro) [§](https://postgr.es/c/a0f55fc86) [§](https://postgr.es/c/ae632f7a3) + + Transactions already marked as “doomed” confused the safe-snapshot optimization for `SERIALIZABLE READ ONLY` transactions. The optimization was unnecessarily skipped in some cases. In other cases an assertion failure occurred (but there was no problem in non-assert builds). +* Avoid leaking cache callback slots in the `pgoutput` logical decoding plugin (Shi Yu) [§](https://postgr.es/c/861e9e486) + + Multiple cycles of starting up and shutting down the plugin within a single session would eventually lead to an “out of relcache\_callback\_list slots” error. +* Avoid unnecessary calls to custom validators for index operator class options (Alexander Korotkov) [§](https://postgr.es/c/02191136c) + + This change fixes some cases where an unexpected error was thrown. +* Fix dereference of dangling pointer during buffering build of a GiST index (Alexander Lakhin) [§](https://postgr.es/c/2adb6adad) + + This error seems to usually be harmless in production builds, as the fetched value is noncritical; but in principle it could cause a server crash. +* Ignore dropped columns and generated columns during logical replication of an update or delete action (Onder Kalaci, Shi Yu) [§](https://postgr.es/c/be52fff91) [§](https://postgr.es/c/751d6676d) + + Replication with the `REPLICA IDENTITY FULL` option failed if the table contained such columns. +* Correct the name of the wait event for SLRU buffer I/O for commit timestamps (Alexander Lakhin) [§](https://postgr.es/c/cedcc4191) + + This wait event is named `CommitTsBuffer` according to the documentation, but the code had it as `CommitTSBuffer`. Change the code to match the documentation, as that way is more consistent with the naming of related wait events. +* Avoid possible underflow when calculating how many WAL segments to keep (Kyotaro Horiguchi) [§](https://postgr.es/c/be40dd63e) + + This could result in not honoring `wal_keep_size` accurately. +* Support RSA-PSS certificates with SCRAM-SHA-256 channel binding (Jacob Champion, Heikki Linnakangas) [§](https://postgr.es/c/2eb8e54cc) + + This feature requires building with OpenSSL 1.1.1 or newer. Both the server and libpq are affected. +* Avoid race condition with process ID tracking on Windows (Thomas Munro) [§](https://postgr.es/c/9f1c64018) [§](https://postgr.es/c/798dae9f6) [§](https://postgr.es/c/77a8133c9) + + The operating system could recycle a PID before the postmaster observed that that child process was gone. This could lead to tracking more than one child with the same PID, resulting in confusion. +* Add missing cases to `SPI_result_code_string()` (Dean Rasheed) [§](https://postgr.es/c/906356cf6) +* Fix erroneous Valgrind markings in `AllocSetRealloc()` (Karina Litskevich) [§](https://postgr.es/c/99e74cd23) + + In the unusual case where the size of a large (>8kB) palloc chunk is decreased, a Valgrind-aware build would mismark the defined-ness state of the memory released from the chunk, possibly causing incorrect results during Valgrind testing. +* Avoid assertion failure when decoding a transactional logical replication message (Tomas Vondra) [§](https://postgr.es/c/4df581fa0) +* Avoid locale sensitivity when processing regular expression escapes (Jeff Davis) [§](https://postgr.es/c/79a66c617) + + A backslash followed by a non-ASCII character could sometimes cause an assertion failure, depending on the prevailing locale. +* Avoid trying to write an empty WAL record in `log_newpage_range()` when the last few pages in the specified range are empty (Matthias van de Meent) [§](https://postgr.es/c/86874a6df) + + It is not entirely clear whether this case is reachable in released branches, but if it is then an assertion failure could occur. +* Fix session-lifespan memory leakage in plpgsql `DO` blocks that use cast expressions (Ajit Awekar, Tom Lane) [§](https://postgr.es/c/bfa691087) +* Tighten array dimensionality checks when converting Perl list structures to multi-dimensional SQL arrays (Tom Lane) [§](https://postgr.es/c/ee24b5e79) + + plperl could misbehave when the nesting of sub-lists is inconsistent so that the data does not represent a rectangular array of values. Such cases now produce errors, but previously they could result in a crash or garbage output. +* Tighten array dimensionality checks when converting Python list structures to multi-dimensional SQL arrays (Tom Lane) [§](https://postgr.es/c/0e6354ed9) [§](https://postgr.es/c/7dcd9998c) + + plpython could misbehave when dealing with empty sub-lists, or when the nesting of sub-lists is inconsistent so that the data does not represent a rectangular array of values. The former should result in an empty output array, and the latter in an error. But some cases resulted in a crash, and others in unexpected output. +* Fix unwinding of exception stack in plpython (Xing Guo) [§](https://postgr.es/c/800531846) + + Some rare failure cases could return without cleaning up the PG\_TRY exception stack, risking a crash if another error was raised before the next stack level was unwound. +* Fix inconsistent GSS-encryption error handling in libpq's `PQconnectPoll()` (Michael Paquier) [§](https://postgr.es/c/96bef4374) + + With `gssencmode` set to `require`, the connection was not marked dead after a GSS initialization failure. Make it fail immediately, as the equivalent case for TLS encryption has long done. +* Fix possible data corruption in ecpg programs built with the `-C ORACLE` option (Kyotaro Horiguchi) [§](https://postgr.es/c/e9e457d22) + + When `ecpg_get_data()` is called with `varcharsize` set to zero, it could write a terminating zero character into the last byte of the preceding field, truncating the data in that field. +* Fix pg\_dump so that partitioned tables that are hash-partitioned on an enum-type column can be restored successfully (Tom Lane) [§](https://postgr.es/c/7e7c5b683) + + Since the hash codes for enum values depend on the OIDs assigned to the enum, they are typically different after a dump and restore, meaning that rows often need to go into a different partition than they were in originally. Users can work around that by specifying the `--load-via-partition-root` option; but since there is very little chance of success without that, teach pg\_dump to apply it automatically to such tables. + + Also, fix pg\_restore to not try to `TRUNCATE` target tables before restoring into them when `--load-via-partition-root` mode is used. This avoids a hazard of deadlocks and lost data. +* In `contrib/hstore_plpython`, avoid crashing if the Python value to be transformed isn't a mapping (Dmitry Dolgov, Tom Lane) [§](https://postgr.es/c/de2dfa053) + + This should give an error, but Python 3 changed some APIs in a way that caused the check to misbehave, allowing a crash to ensue. +* Require the `siglen` option of a GiST index on an `ltree` column, if specified, to be a multiple of 4 (Alexander Korotkov) [§](https://postgr.es/c/48c6825d0) + + Other values result in misaligned accesses to index content, which is harmless on Intel-compatible hardware but can cause a crash on some other architectures. +* Fix misbehavior in `contrib/pg_trgm` with an unsatisfiable regular expression (Tom Lane) [§](https://postgr.es/c/bc436e4a9) + + A regex such as `$foo` is legal but unsatisfiable; the regex compiler recognizes that and produces an empty NFA graph. Attempting to optimize such a graph into a pg\_trgm GIN or GiST index qualification resulted in accessing off the end of a work array, possibly leading to crashes. +* Use the `--strip-unneeded` option when stripping static libraries with GNU-compatible strip (Tom Lane) [§](https://postgr.es/c/6dce37203) + + Previously, `make install-strip` used the `-x` option in this case. This change avoids misbehavior of llvm-strip, and gives slightly smaller output as well. +* Stop recommending auto-download of DTD files for building the documentation, and indeed disable it (Aleksander Alekseev, Peter Eisentraut, Tom Lane) [§](https://postgr.es/c/c7b608600) + + It appears no longer possible to build the SGML documentation without a local installation of the DocBook DTD files. Formerly xsltproc could download those files on-the-fly from sourceforge.net; but sourceforge.net now permits only HTTPS access, and no common version of xsltproc supports that. Hence, remove the bits of our documentation suggesting that that's possible or useful, and instead add xsltproc's `--nonet` option to the build recipes. +* When running TAP tests in PGXS builds, use a saner location for the temporary `portlock` directory (Peter Eisentraut) [§](https://postgr.es/c/670494477) + + Place it under `tmp_check` in the build directory. With the previous coding, a PGXS build would try to place it in the installation directory, which is not necessarily writable. +* Update time zone data files to tzdata release 2023c for DST law changes in Egypt, Greenland, Morocco, and Palestine. (Tom Lane) [§](https://postgr.es/c/87d8ec3e4) + + When observing Moscow time, Europe/Kirov and Europe/Volgograd now use the abbreviations MSK/MSD instead of numeric abbreviations, for consistency with other timezones observing Moscow time. Also, America/Yellowknife is no longer distinct from America/Edmonton; this affects some pre-1948 timestamps in that area. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-12.html "E.12. Release 13.12") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-10.html "E.14. Release 13.10") | +| E.12. Release 13.12 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.14. Release 13.10 | + +[Previous](/docs/release/13.10/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.12/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1312.md b/corpus/changelog/postgresql_releases/postgresql_1312.md new file mode 100644 index 0000000000000000000000000000000000000000..48fb6b3ba9bfa5a14089869ee7e25dff62dacdce --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1312.md @@ -0,0 +1,140 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.12/ +Version: 13.12 + +## PostgreSQL 13.12 + +| E.12. Release 13.12 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-13.html "E.11. Release 13.13") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-11.html "E.13. Release 13.11") | + +--- + +## E.12. Release 13.12 + +[E.12.1. Migration to Version 13.12](release-13-12.html#id-1.11.6.17.4) + +[E.12.2. Changes](release-13-12.html#id-1.11.6.17.5) + +**Release date:**2023-08-10 + +This release contains a variety of fixes from 13.11. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +### E.12.1. Migration to Version 13.12 + +A dump/restore is not required for those running 13.X. + +However, if you use BRIN indexes, it may be advisable to reindex them; see the second changelog entry below. + +Also, if you are upgrading from a version earlier than 13.7, see [Section E.17](release-13-7.html "E.17. Release 13.7"). + +### E.12.2. Changes + +* Disallow substituting a schema or owner name into an extension script if the name contains a quote, backslash, or dollar sign (Noah Misch) [§](https://postgr.es/c/b1b585e0f) + + This restriction guards against SQL-injection hazards for trusted extensions. + + The PostgreSQL Project thanks Micah Gates, Valerie Woolard, Tim Carey-Smith, and Christoph Berg for reporting this problem. (CVE-2023-39417) +* Fix confusion between empty (no rows) ranges and all-NULL ranges in BRIN indexes, as well as incorrect merging of all-NULL summaries (Tomas Vondra) [§](https://postgr.es/c/6c512fc6e) [§](https://postgr.es/c/2b1ab28b9) + + Each of these oversights could result in forgetting that a BRIN index range contains any NULL values, potentially allowing subsequent queries that should return NULL values to miss doing so. + + This fix will not in itself correct faulty BRIN entries. It's recommended to `REINDEX` any BRIN indexes that may be used to search for nulls. +* Avoid leaving a corrupted database behind when `DROP DATABASE` is interrupted (Andres Freund) [§](https://postgr.es/c/81ce00006) + + If `DROP DATABASE` was interrupted after it had already begun taking irreversible steps, the target database remained accessible (because the removal of its `pg_database` row would roll back), but it would have corrupt contents. Fix by marking the database as inaccessible before we begin to perform irreversible operations. A failure after that will leave the database still partially present, but nothing can be done with it except to issue another `DROP DATABASE`. +* Ensure that partitioned indexes are correctly marked as valid or not at creation (Michael Paquier) [§](https://postgr.es/c/537b70b82) + + If a new partitioned index matches an existing but invalid index on one of the partitions, the partitioned index could end up being marked valid prematurely. This could lead to misbehavior or assertion failures in subsequent queries on the partitioned table. +* Ignore invalid child indexes when matching partitioned indexes to child indexes during `ALTER TABLE ATTACH PARTITION` (Michael Paquier) [§](https://postgr.es/c/f42844069) + + Such an index will now be ignored, and a new child index created instead. +* Fix possible failure when marking a partitioned index valid after all of its partitions have been attached (Michael Paquier) [§](https://postgr.es/c/c89d74c18) + + The update of the index's `pg_index` entry could use stale data for other columns. One reported symptom is an “attempted to update invisible tuple” error. +* Fix `ALTER EXTENSION SET SCHEMA` to complain if the extension contains any objects outside the extension's schema (Michael Paquier, Heikki Linnakangas) [§](https://postgr.es/c/f5b075adc) + + Erroring out if the extension contains objects in multiple schemas was always intended; but the check was mis-coded so that it would fail to detect some cases, leading to surprising behavior. +* Don't use partial unique indexes for uniqueness proofs in the planner (David Rowley) [§](https://postgr.es/c/06286f8a2) + + This could give rise to incorrect plans, since the presumed uniqueness of rows read from a table might not hold if the index in question isn't used to scan the table. +* Avoid producing incorrect plans for foreign joins with pseudoconstant join clauses (Etsuro Fujita) [§](https://postgr.es/c/730f983ef) + + The planner currently lacks support for attaching pseudoconstant join clauses to a pushed-down remote join, so disable generation of remote joins in such cases. (A better solution will require ABI-breaking changes of planner data structures, so it will have to wait for a future major release.) +* Correctly handle sub-SELECTs in RLS policy expressions and security-barrier views when expanding rule actions (Tom Lane) [§](https://postgr.es/c/a36d0014f) +* Fix race conditions in conflict detection for `SERIALIZABLE` isolation mode (Thomas Munro) [§](https://postgr.es/c/fc1547384) [§](https://postgr.es/c/8976ac5c5) [§](https://postgr.es/c/8f705d7b9) + + Conflicts could be missed when using bitmap heap scans, when using GIN indexes, and when examining an initially-empty btree index. All these cases could lead to serializability failures due to improperly allowing conflicting transactions to commit. +* Fix hash join with an inner-side hash key that contains Params coming from an outer nested loop (Tom Lane) [§](https://postgr.es/c/2f97105e9) + + When rescanning the join after the values of such Params have changed, we must rebuild the hash table, but neglected to do so. This could result in missing join output rows. +* Fix intermittent failures when trying to update a field of a composite column (Tom Lane) [§](https://postgr.es/c/d0ab203bc) + + If the overall value of the composite column is wide enough to require out-of-line toasting, then an unluckily-timed cache flush could cause errors or server crashes. +* Prevent query-lifespan memory leaks in some `UPDATE` queries with triggers (Tomas Vondra) [§](https://postgr.es/c/c504aa857) [§](https://postgr.es/c/984c23f6f) +* Prevent query-lifespan memory leaks when an Incremental Sort plan node is rescanned (James Coleman, Laurenz Albe, Tom Lane) [§](https://postgr.es/c/3ce761d5c) +* Accept fractional seconds in the input to `jsonpath`'s `datetime()` method (Tom Lane) [§](https://postgr.es/c/6f23b5f74) +* Prevent stack-overflow crashes with very complex text search patterns (Tom Lane) [§](https://postgr.es/c/b6ab18a99) +* Allow tokens up to 10240 bytes long in `pg_hba.conf` and `pg_ident.conf` (Tom Lane) [§](https://postgr.es/c/288b4288c) + + The previous limit of 256 bytes has been found insufficient for some use-cases. +* Fix mishandling of C++ out-of-memory conditions (Heikki Linnakangas) [§](https://postgr.es/c/59c2a6fe9) + + If JIT is in use, running out of memory in a C++ `new` call would lead to a PostgreSQL FATAL error, instead of the expected C++ exception. +* Fix rare null-pointer crash in `plancache.c` (Tom Lane) [§](https://postgr.es/c/291c02540) +* Avoid losing track of possibly-useful shared memory segments when a page free results in coalescing ranges of free space (Dongming Liu) [§](https://postgr.es/c/a0003572f) + + Ensure that the segment is moved into the appropriate “bin” for its new amount of free space, so that it will be found by subsequent searches. +* Allow `VACUUM` to continue after detecting certain types of b-tree index corruption (Peter Geoghegan) [§](https://postgr.es/c/b6311824f) [§](https://postgr.es/c/8f876d15c) + + If an invalid sibling-page link is detected, log the issue and press on, rather than throwing an error as before. Nothing short of `REINDEX` will fix the broken index, but preventing `VACUUM` from completing until that is done risks making matters far worse. +* Ensure that `WrapLimitsVacuumLock` is released after `VACUUM` detects invalid data in `pg_database`.`datfrozenxid` or `pg_database`.`datminmxid` (Andres Freund) [§](https://postgr.es/c/53336e8f6) + + Failure to release this lock could lead to a deadlock later, although the lock would be cleaned up if the session exits or encounters some other error. +* Avoid double replay of prepared transactions during crash recovery (suyu.cmj, Michael Paquier) [§](https://postgr.es/c/db59108a2) [§](https://postgr.es/c/b3ca4f0a5) + + After a crash partway through a checkpoint with some two-phase transaction state data already flushed to disk by this checkpoint, crash recovery could attempt to replay the prepared transaction(s) twice, leading to a fatal error such as “lock is already held” in the startup process. +* Fix possible failure while promoting a standby server, if archiving is enabled and two-phase transactions need to be recovered (Julian Markwort) [§](https://postgr.es/c/896012b88) + + If any required two-phase transactions were logged in the most recent (partial) log segment, promotion would fail with an incorrect complaint about “requested WAL segment has already been removed”. +* Ensure that a newly created, but still empty table is `fsync`'ed at the next checkpoint (Heikki Linnakangas) [§](https://postgr.es/c/acc8cdff4) + + Without this, if there is an operating system crash causing the empty file to disappear, subsequent operations on the table might fail with “could not open file” errors. +* Ensure that creation of the init fork of an unlogged index is WAL-logged (Heikki Linnakangas) [§](https://postgr.es/c/c50b869ed) + + While an unlogged index's main data fork is not WAL-logged, its init fork should be, to ensure that we have a consistent state to restore the index to after a crash. This step was missed if the init fork contains no data, which is a case not used by any standard index AM; but perhaps some extension behaves that way. +* Fix missing reinitializations of delay-checkpoint-end flags (suyu.cmj) [§](https://postgr.es/c/37236ca06) + + This could result in unnecessary delays of checkpoints, or in assertion failures in assert-enabled builds. +* Fix overly strict assertion in `jsonpath` code (David Rowley) [§](https://postgr.es/c/74a5bf1b6) + + This assertion failed if a query applied the `.type()` operator to a `like_regex` result. There was no bug in non-assert builds. +* Avoid assertion failure when processing an empty statement via the extended query protocol in an already-aborted transaction (Tom Lane) [§](https://postgr.es/c/d1fc0f382) +* Fix `contrib/fuzzystrmatch`'s Soundex `difference()` function to handle empty input sanely (Alexander Lakhin, Tom Lane) [§](https://postgr.es/c/0409c7fc7) + + An input string containing no alphabetic characters resulted in unpredictable output. +* Tighten whitespace checks in `contrib/hstore` input (Evan Jones) [§](https://postgr.es/c/78bf0a256) + + In some cases, characters would be falsely recognized as whitespace and hence discarded. +* Disallow oversize input arrays with `contrib/intarray`'s `gist__int_ops` index opclass (Ankit Kumar Pandey, Alexander Lakhin) [§](https://postgr.es/c/ae9aac64a) + + Previously this code would report a `NOTICE` but press on anyway, creating an invalid index entry that presents a risk of crashes when the index is read. +* Avoid useless double decompression of GiST index entries in `contrib/intarray` (Konstantin Knizhnik, Matthias van de Meent, Tom Lane) [§](https://postgr.es/c/7fffcc2ee) +* Ensure that `pg_index`.`indisreplident` is kept up-to-date in relation cache entries (Shruthi Gowda) [§](https://postgr.es/c/bdaaf1bf1) + + This value could be stale in some cases. There is no core code that relies on the relation cache's copy, so this is only a latent bug as far as Postgres itself is concerned; but there may be extensions for which it is a live bug. +* Silence deprecation warnings when compiling with OpenSSL 3.0.0 or later (Peter Eisentraut) [§](https://postgr.es/c/8aa9a2623) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-13.html "E.11. Release 13.13") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-11.html "E.13. Release 13.11") | +| E.11. Release 13.13 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.13. Release 13.11 | + +[Previous](/docs/release/13.11/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.13/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1313.md b/corpus/changelog/postgresql_releases/postgresql_1313.md new file mode 100644 index 0000000000000000000000000000000000000000..708d8d8fbec6557765c284640eafe76de3531f52 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1313.md @@ -0,0 +1,172 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.13/ +Version: 13.13 + +## PostgreSQL 13.13 + +| E.11. Release 13.13 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-14.html "E.10. Release 13.14") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-12.html "E.12. Release 13.12") | + +--- + +## E.11. Release 13.13 + +[E.11.1. Migration to Version 13.13](release-13-13.html#id-1.11.6.16.4) + +[E.11.2. Changes](release-13-13.html#id-1.11.6.16.5) + +**Release date:**2023-11-09 + +This release contains a variety of fixes from 13.12. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +### E.11.1. Migration to Version 13.13 + +A dump/restore is not required for those running 13.X. + +However, several mistakes have been discovered that could lead to certain types of indexes yielding wrong search results. It is advisable to `REINDEX` potentially-affected indexes after installing this update. See the fourth and fifth changelog entries below. + +Also, if you are upgrading from a version earlier than 13.12, see [Section E.12](release-13-12.html "E.12. Release 13.12"). + +### E.11.2. Changes + +* Fix handling of unknown-type arguments in `DISTINCT` `"any"` aggregate functions (Tom Lane) [§](https://postgr.es/c/d3de70fdb) + + This error led to a `text`-type value being interpreted as an `unknown`-type value (that is, a zero-terminated string) at runtime. This could result in disclosure of server memory following the `text` value. + + The PostgreSQL Project thanks Jingzhou Fu for reporting this problem. (CVE-2023-5868) +* Detect integer overflow while computing new array dimensions (Tom Lane) [§](https://postgr.es/c/26c599beb) + + When assigning new elements to array subscripts that are outside the current array bounds, an undetected integer overflow could occur in edge cases. Memory stomps that are potentially exploitable for arbitrary code execution are possible, and so is disclosure of server memory. + + The PostgreSQL Project thanks Pedro Gallegos for reporting this problem. (CVE-2023-5869) +* Prevent the `pg_signal_backend` role from signalling background workers and autovacuum processes (Noah Misch, Jelte Fennema-Nio) [§](https://postgr.es/c/28b609550) [§](https://postgr.es/c/2c7a2a00a) + + The documentation says that `pg_signal_backend` cannot issue signals to superuser-owned processes. It was able to signal these background processes, though, because they advertise a role OID of zero. Treat that as indicating superuser ownership. The security implications of cancelling one of these process types are fairly small so far as the core code goes (we'll just start another one), but extensions might add background workers that are more vulnerable. + + Also ensure that the `is_superuser` parameter is set correctly in such processes. No specific security consequences are known for that oversight, but it might be significant for some extensions. + + The PostgreSQL Project thanks Hemanth Sandrana and Mahendrakar Srinivasarao for reporting this problem. (CVE-2023-5870) +* Fix misbehavior during recursive page split in GiST index build (Heikki Linnakangas) [§](https://postgr.es/c/db7394d4d) + + Fix a case where the location of a page downlink was incorrectly tracked, and introduce some logic to allow recovering from such situations rather than silently doing the wrong thing. This error could result in incorrect answers from subsequent index searches. It may be advisable to reindex all GiST indexes after installing this update. +* Prevent de-duplication of btree index entries for `interval` columns (Noah Misch) [§](https://postgr.es/c/6fd1dbdb2) + + There are `interval` values that are distinguishable but compare equal, for example `24:00:00` and `1 day`. This breaks assumptions made by btree de-duplication, so `interval` columns need to be excluded from de-duplication. This oversight can cause incorrect results from index-only scans. Moreover, after updating amcheck will report an error for almost all such indexes. Users should reindex any btree indexes on `interval` columns. +* Fix partition step generation and runtime partition pruning for hash-partitioned tables with multiple partition keys (David Rowley) [§](https://postgr.es/c/890a73ba3) [§](https://postgr.es/c/45c4b2a3a) + + Some cases involving an `IS NULL` condition on one of the partition keys could result in a crash. +* Fix edge case in btree mark/restore processing of ScalarArrayOpExpr clauses (Peter Geoghegan) [§](https://postgr.es/c/d4724e94a) + + When restoring an indexscan to a previously marked position, the code could miss required setup steps if the scan had advanced exactly to the end of the matches for a ScalarArrayOpExpr (that is, an `indexcol = ANY(ARRAY[])`) clause. This could result in missing some rows that should have been fetched. +* Fix intra-query memory leak when a set-returning function repeatedly returns zero rows (Tom Lane) [§](https://postgr.es/c/b7684473d) +* Don't crash if `cursor_to_xmlschema()` is applied to a non-data-returning Portal (Boyu Yang) [§](https://postgr.es/c/e6e50ada0) +* Throw the intended error if `pgrowlocks()` is applied to a partitioned table (David Rowley) [§](https://postgr.es/c/b3c8d1d0e) + + Previously, a not-on-point complaint “only heap AM is supported” would be raised. +* Handle invalid indexes more cleanly in assorted SQL functions (Noah Misch) [§](https://postgr.es/c/123b0d111) + + Report an error if `pgstatindex()`, `pgstatginindex()`, `pgstathashindex()`, or `pgstattuple()` is applied to an invalid index. If `brin_desummarize_range()`, `brin_summarize_new_values()`, `brin_summarize_range()`, or `gin_clean_pending_list()` is applied to an invalid index, do nothing except to report a debug-level message. Formerly these functions attempted to process the index, and might fail in strange ways depending on what the failed `CREATE INDEX` had left behind. +* Avoid premature memory allocation failure with long inputs to `to_tsvector()` (Tom Lane) [§](https://postgr.es/c/52a676ef4) +* Fix over-allocation of the constructed `tsvector` in `tsvectorrecv()` (Denis Erokhin) [§](https://postgr.es/c/9da153846) + + If the incoming vector includes position data, the binary receive function left wasted space (roughly equal to the size of the position data) in the finished `tsvector`. In extreme cases this could lead to “maximum total lexeme length exceeded” failures for vectors that were under the length limit when emitted. In any case it could lead to wasted space on-disk. +* Fix incorrect coding in `gtsvector_picksplit()` (Alexander Lakhin) [§](https://postgr.es/c/82fa8ae5f) + + This could lead to poor page-split decisions in GiST indexes on `tsvector` columns. +* Improve checks for corrupt PGLZ compressed data (Flavien Guedez) [§](https://postgr.es/c/817669ea2) +* Fix `COMMIT AND CHAIN`/`ROLLBACK AND CHAIN` to work properly when there is an unreleased savepoint (Liu Xiang, Tom Lane) [§](https://postgr.es/c/555a8d9d3) + + Instead of propagating the current transaction's properties to the new transaction, they propagated some previous transaction's properties. +* Avoid crash in `EXPLAIN` if a parameter marked to be displayed by `EXPLAIN` has a NULL boot-time value (Xing Guo, Aleksander Alekseev, Tom Lane) [§](https://postgr.es/c/137227c6d) + + No built-in parameter fits this description, but an extension could define such a parameter. +* Ensure we have a snapshot while dropping `ON COMMIT DROP` temp tables (Tom Lane) [§](https://postgr.es/c/1e678175c) + + This prevents possible misbehavior if any catalog entries for the temp tables have fields wide enough to require toasting (such as a very complex `CHECK` condition). +* Avoid improper response to shutdown signals in child processes just forked by `system()` (Nathan Bossart) [§](https://postgr.es/c/ac1dfc303) [§](https://postgr.es/c/ebc093fa6) + + This fix avoids a race condition in which a child process that has been forked off by `system()`, but hasn't yet exec'd the intended child program, might receive and act on a signal intended for the parent server process. That would lead to duplicate cleanup actions being performed, which will not end well. +* Cope with torn reads of `pg_control` in frontend programs (Thomas Munro) [§](https://postgr.es/c/67060be3d) + + On some file systems, reading `pg_control` may not be an atomic action when the server concurrently writes that file. This is detectable via a bad CRC. Retry a few times to see if the file becomes valid before we report error. +* Avoid torn reads of `pg_control` in relevant SQL functions (Thomas Munro) [§](https://postgr.es/c/ae9da357b) + + Acquire the appropriate lock before reading `pg_control`, to ensure we get a consistent view of that file. +* Avoid integer overflow when computing size of backend activity string array (Jakub Wartak) [§](https://postgr.es/c/a0b013625) + + On 64-bit machines we will allow values of `track_activity_query_size` large enough to cause 32-bit overflow when multiplied by the allowed number of connections. The code actually allocating the per-backend local array was careless about this though, and allocated the array incorrectly. +* Fix briefly showing inconsistent progress statistics for `ANALYZE` on inherited tables (Heikki Linnakangas) [§](https://postgr.es/c/ed9247cd7) + + The block-level counters should be reset to zero at the same time we update the current-relation field. +* Track the dependencies of cached `CALL` statements, and re-plan them when needed (Tom Lane) [§](https://postgr.es/c/8cfc3e80b) + + DDL commands, such as replacement of a function that has been inlined into a `CALL` argument, can create the need to re-plan a `CALL` that has been cached by PL/pgSQL. That was not happening, leading to misbehavior or strange errors such as “cache lookup failed”. +* Track nesting depth correctly when inspecting `RECORD`-type Vars from outer query levels (Richard Guo) [§](https://postgr.es/c/c5b7f791d) + + This oversight could lead to assertion failures, core dumps, or “bogus varno” errors. +* Avoid “record type has not been registered” failure when deparsing a view that contains references to fields of composite constants (Tom Lane) [§](https://postgr.es/c/59bc0dfe4) +* Fix error-handling bug in `RECORD` type cache management (Thomas Munro) [§](https://postgr.es/c/189097db8) + + An out-of-memory error occurring at just the wrong point could leave behind inconsistent state that would lead to an infinite loop. +* Fix assertion failure when logical decoding is retried in the same session after an error (Hou Zhijie) [§](https://postgr.es/c/c570bb4d6) +* Treat out-of-memory failures as fatal while reading WAL (Michael Paquier) [§](https://postgr.es/c/6103d2cca) + + Previously this would be treated as a bogus-data condition, leading to the conclusion that we'd reached the end of WAL, which is incorrect and could lead to inconsistent WAL replay. +* Fix possible recovery failure due to trying to allocate memory based on a bogus WAL record length field (Thomas Munro, Michael Paquier) [§](https://postgr.es/c/6606c5716) [§](https://postgr.es/c/45d1fe8b5) +* Ensure that standby-mode WAL recovery reports an error when an invalid page header is found (Yugo Nagata, Kyotaro Horiguchi) [§](https://postgr.es/c/5dc093eac) +* Fix datatype size confusion in logical tape management (Ranier Vilela) [§](https://postgr.es/c/420c8dc7e) + + Integer overflow was possible on platforms where long is wider than int, although it would take a multiple-terabyte temporary file to cause a problem. +* Avoid unintended close of syslogger process's stdin (Heikki Linnakangas) [§](https://postgr.es/c/a01e479e8) +* Avoid doing plan cache revalidation of utility statements that do not receive interesting processing during parse analysis (Tom Lane) [§](https://postgr.es/c/27566bcf3) + + Aside from saving a few cycles, this prevents failure after a cache invalidation for statements that must not set a snapshot, such as `SET TRANSACTION ISOLATION LEVEL`. +* Keep by-reference `attmissingval` values in a long-lived context while they are being used (Andrew Dunstan) [§](https://postgr.es/c/1bb619d4d) + + This avoids possible use of dangling pointers when a tuple slot outlives the tuple descriptor with which its value was constructed. +* Recalculate the effective value of `search_path` after `ALTER ROLE` (Jeff Davis) [§](https://postgr.es/c/90cadfd49) [§](https://postgr.es/c/4caa9e33e) + + This ensures that after renaming a role, the meaning of the special string `$user` is re-determined. +* Fix order of operations in `GenericXLogFinish` (Jeff Davis) [§](https://postgr.es/c/469d367be) + + This code violated the conditions required for crash safety by writing WAL before marking changed buffers dirty. No core code uses this function, but extensions do (`contrib/bloom` does, for example). +* Remove incorrect assertion in PL/Python exception handling (Alexander Lakhin) [§](https://postgr.es/c/35e8ba3e5) +* Fix pg\_restore so that selective restores will include both table-level and column-level ACLs for selected tables (Euler Taveira, Tom Lane) [§](https://postgr.es/c/295953f8b) + + Formerly, only the table-level ACL would get restored if both types were present. +* Add logic to pg\_upgrade to check for use of `abstime`, `reltime`, and `tinterval` data types (Álvaro Herrera) [§](https://postgr.es/c/d3946c4f6) [§](https://postgr.es/c/2f1f49975) + + These obsolete data types were removed in PostgreSQL version 12, so check to make sure they aren't present in an older database before claiming it can be upgraded. +* Avoid generating invalid temporary slot names in pg\_basebackup (Jelte Fennema) [§](https://postgr.es/c/6cdd7b805) + + This has only been seen to occur when the server connection runs through pgbouncer. +* Avoid false “too many client connections” errors in pgbench on Windows (Noah Misch) [§](https://postgr.es/c/3895e9153) +* In `contrib/amcheck`, do not report interrupted page deletion as corruption (Noah Misch) [§](https://postgr.es/c/f31ccb575) + + This fix prevents false-positive reports of “the first child of leftmost target page is not leftmost of its level”, “block NNNN is not leftmost” or “left link/right link pair in index XXXX not in agreement”. They appeared if amcheck ran after an unfinished btree index page deletion and before `VACUUM` had cleaned things up. +* Fix failure of `contrib/btree_gin` indexes on `interval` columns, when an indexscan using the `<` or `<=` operator is performed (Dean Rasheed) [§](https://postgr.es/c/35e6a5c20) + + Such an indexscan failed to return all the entries it should. +* Add support for LLVM 16 and 17 (Thomas Munro, Dmitry Dolgov) [§](https://postgr.es/c/53c4dabe1) [§](https://postgr.es/c/f28956b23) [§](https://postgr.es/c/981292c19) [§](https://postgr.es/c/7c070e224) +* Suppress assorted build-time warnings on recent macOS (Tom Lane) [§](https://postgr.es/c/1b64e374c) [§](https://postgr.es/c/53cc19bfa) + + Xcode 15 (released with macOS Sonoma) changed the linker's behavior in a way that causes many duplicate-library warnings while building PostgreSQL. These were harmless, but they're annoying so avoid citing the same libraries twice. Also remove use of the `-multiply_defined suppress` linker switch, which apparently has been a no-op for a long time, and is now actively complained of. +* When building `contrib/unaccent`'s rules file, fall back to using `python` if `--with-python` was not given and make variable `PYTHON` was not set (Japin Li) [§](https://postgr.es/c/a64b8b035) +* Remove `PHOT` (Phoenix Islands Time) from the default timezone abbreviations list (Tom Lane) [§](https://postgr.es/c/d94612873) + + Presence of this abbreviation in the default list can cause failures on recent Debian and Ubuntu releases, as they no longer install the underlying tzdb entry by default. Since this is a made-up abbreviation for a zone with a total human population of about two dozen, it seems unlikely that anyone will miss it. If someone does, they can put it back via a custom abbreviations file. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-14.html "E.10. Release 13.14") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-12.html "E.12. Release 13.12") | +| E.10. Release 13.14 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.12. Release 13.12 | + +[Previous](/docs/release/13.12/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.14/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1314.md b/corpus/changelog/postgresql_releases/postgresql_1314.md new file mode 100644 index 0000000000000000000000000000000000000000..f519163925a6023df91c320d4d0051bcfdbb5945 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1314.md @@ -0,0 +1,150 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.14/ +Version: 13.14 + +## PostgreSQL 13.14 + +| E.10. Release 13.14 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-15.html "E.9. Release 13.15") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-13.html "E.11. Release 13.13") | + +--- + +## E.10. Release 13.14 + +[E.10.1. Migration to Version 13.14](release-13-14.html#id-1.11.6.15.4) + +[E.10.2. Changes](release-13-14.html#id-1.11.6.15.5) + +**Release date:**2024-02-08 + +This release contains a variety of fixes from 13.13. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +### E.10.1. Migration to Version 13.14 + +A dump/restore is not required for those running 13.X. + +However, one bug was fixed that could have resulted in corruption of GIN indexes during concurrent updates. If you suspect such corruption, reindex affected indexes after installing this update. + +Also, if you are upgrading from a version earlier than 13.13, see [Section E.11](release-13-13.html "E.11. Release 13.13"). + +### E.10.2. Changes + +* Tighten security restrictions within `REFRESH MATERIALIZED VIEW CONCURRENTLY` (Heikki Linnakangas) [§](https://postgr.es/c/d541ce3b6) [§](https://postgr.es/c/b73d21648) + + One step of a concurrent refresh command was run under weak security restrictions. If a materialized view's owner could persuade a superuser or other high-privileged user to perform a concurrent refresh on that view, the view's owner could control code executed with the privileges of the user running `REFRESH`. Fix things so that all user-determined code is run as the view's owner, as expected. + + The only known exploit for this error does not work in PostgreSQL 16.0 and later, so it may be that v16 is not vulnerable in practice. + + The PostgreSQL Project thanks Pedro Gallegos for reporting this problem. (CVE-2024-0985) +* Fix memory leak when performing JIT inlining (Andres Freund, Daniel Gustafsson) [§](https://postgr.es/c/10912f7d4) + + There have been multiple reports of backend processes suffering out-of-memory conditions after sufficiently many JIT compilations. This fix should resolve that. +* When dequeueing from an LWLock, avoid needing to search the list of waiting processes (Andres Freund) [§](https://postgr.es/c/dc9d424cf) + + This fixes O(N^2) behavior when the list of waiters is long. In some use-cases this results in substantial throughput improvements. +* Avoid generating incorrect partitioned-join plans (Richard Guo) [§](https://postgr.es/c/7af96a66f) + + Some uncommon situations involving lateral references could create incorrect plans. Affected queries could produce wrong answers, or odd failures such as “variable not found in subplan target list”, or executor crashes. +* Fix incorrect wrapping of subquery output expressions in PlaceHolderVars (Tom Lane) [§](https://postgr.es/c/bfd28bb07) + + This fixes incorrect results when a subquery is underneath an outer join and has an output column that laterally references something outside the outer join's scope. The output column might not appear as NULL when it should do so due to the action of the outer join. +* Avoid requesting an oversize shared-memory area in parallel hash join (Thomas Munro, Andrei Lepikhov, Alexander Korotkov) [§](https://postgr.es/c/60de25c6e) [§](https://postgr.es/c/17b6f39f1) + + The limiting value was too large, allowing “invalid DSA memory alloc request size” errors to occur with sufficiently large expected hash table sizes. +* Avoid assertion failures in `heap_update()` and `heap_delete()` when a tuple to be updated by a foreign-key enforcement trigger fails the extra visibility crosscheck (Alexander Lakhin) [§](https://postgr.es/c/e434d3620) + + This error had no impact in non-assert builds. +* Fix possible failure during `ALTER TABLE ADD COLUMN` on a complex inheritance tree (Tender Wang) [§](https://postgr.es/c/bfec14d06) + + If a grandchild table would inherit the new column via multiple intermediate parents, the command failed with “tuple already updated by self”. +* Fix problems with duplicate token names in `ALTER TEXT SEARCH CONFIGURATION ... MAPPING` commands (Tender Wang, Michael Paquier) [§](https://postgr.es/c/4d0e8a008) +* Properly lock the associated table during `DROP STATISTICS` (Tomas Vondra) [§](https://postgr.es/c/1e468ea4e) + + Failure to acquire the lock could result in “tuple concurrently deleted” errors if the `DROP` executes concurrently with `ANALYZE`. +* Fix function volatility checking for `GENERATED` and `DEFAULT` expressions (Tom Lane) [§](https://postgr.es/c/5c11104c7) + + These places could fail to detect insertion of a volatile function default-argument expression, or decide that a polymorphic function is volatile although it is actually immutable on the datatype of interest. This could lead to improperly rejecting or accepting a `GENERATED` clause, or to mistakenly applying the constant-default-value optimization in `ALTER TABLE ADD COLUMN`. +* Detect that a new catalog cache entry became stale while detoasting its fields (Tom Lane) [§](https://postgr.es/c/98e03f957) [§](https://postgr.es/c/475b3ea3c) + + We expand any out-of-line fields in a catalog tuple before inserting it into the catalog caches. That involves database access which might cause invalidation of catalog cache entries — but the new entry isn't in the cache yet, so we would miss noticing that it should get invalidated. The result is a race condition in which an already-stale cache entry could get made, and then persist indefinitely. This would lead to hard-to-predict misbehavior. Fix by rechecking the tuple's visibility after detoasting. +* Fix edge-case integer overflow detection bug on some platforms (Dean Rasheed) [§](https://postgr.es/c/4f4a0010a) + + Computing `0 - INT64_MIN` should result in an overflow error, and did on most platforms. However, platforms with neither integer overflow builtins nor 128-bit integers would fail to spot the overflow, instead returning `INT64_MIN`. +* Detect Julian-date overflow when adding or subtracting an `interval` to/from a `timestamp` (Tom Lane) [§](https://postgr.es/c/425127bed) + + Some cases that should cause an out-of-range error produced an incorrect result instead. +* Add more checks for overflow in `interval_mul()` and `interval_div()` (Dean Rasheed) [§](https://postgr.es/c/428770aad) + + Some cases that should cause an out-of-range error produced an incorrect result instead. +* Make the `pg_file_settings` view check validity of unapplied values for settings with `backend` or `superuser-backend` context (Tom Lane) [§](https://postgr.es/c/cb88f44ec) + + Invalid values were not noted in the view as intended. This escaped detection because there are very few settings in these groups. +* Match collation too when matching an existing index to a new partitioned index (Peter Eisentraut) [§](https://postgr.es/c/3c49fa2af) + + Previously we could accept an index that has a different collation from the corresponding element of the partition key, possibly leading to misbehavior. +* Fix insufficient locking when cleaning up an incomplete split of a GIN index's internal page (Fei Changhong, Heikki Linnakangas) [§](https://postgr.es/c/e74c91665) + + The code tried to do this with shared rather than exclusive lock on the buffer. This could lead to index corruption if two processes attempted the cleanup concurrently. +* Avoid premature release of buffer pin in GIN index insertion (Tom Lane) [§](https://postgr.es/c/c859d688b) + + If an index root page split occurs concurrently with our own insertion, the code could fail with “buffer NNNN is not owned by resource owner”. +* Avoid failure with partitioned SP-GiST indexes (Tom Lane) [§](https://postgr.es/c/cc3865150) + + Trying to use an index of this kind could lead to “No such file or directory” errors. +* Fix ownership change reporting for large objects (Tom Lane) [§](https://postgr.es/c/55b5c67da) + + A no-op `ALTER LARGE OBJECT OWNER` command (that is, one selecting the existing owner) passed the wrong class ID to the `PostAlterHook`, probably confusing any extension using that hook. +* Prevent standby servers from incorrectly processing dead index tuples during subtransactions (Fei Changhong) [§](https://postgr.es/c/d99294e77) + + The `startedInRecovery` flag was not correctly set for a subtransaction. This affects only processing of dead index tuples. It could allow a query in a subtransaction to ignore index entries that it should return (if they are already dead on the primary server, but not dead to the standby transaction), or to prematurely mark index entries as dead that are not yet dead on the primary. It is not clear that the latter case has any serious consequences, but it's not the intended behavior. +* Fix deadlock between a logical replication apply worker, its tablesync worker, and a session process trying to alter the subscription (Shlok Kyal) [§](https://postgr.es/c/b47ea4f3d) + + One edge of the deadlock loop did not involve a lock wait, so the deadlock went undetected and would persist until manual intervention. +* Return the correct status code when a new client disconnects without responding to the server's password challenge (Liu Lang, Tom Lane) [§](https://postgr.es/c/5810888c5) + + In some cases we'd treat this as a loggable error, which was not the intention and tends to create log spam, since common clients like psql frequently do this. It may also confuse extensions that use `ClientAuthentication_hook`. +* Fix incompatibility with OpenSSL 3.2 (Tristan Partin, Bo Andreson) [§](https://postgr.es/c/efb804682) + + Use the BIO “app\_data” field for our private storage, instead of assuming it's okay to use the “data” field. This mistake didn't cause problems before, but with 3.2 it leads to crashes and complaints about double frees. +* Be more wary about OpenSSL not setting `errno` on error (Tom Lane) [§](https://postgr.es/c/87b46ad90) + + If `errno` isn't set, assume the cause of the reported failure is read EOF. This fixes rare cases of strange error reports like “could not accept SSL connection: Success”. +* Report ENOMEM errors from file-related system calls as `ERRCODE_OUT_OF_MEMORY`, not `ERRCODE_INTERNAL_ERROR` (Alexander Kuzmenkov) [§](https://postgr.es/c/29df29dad) +* Avoid race condition when libpq initializes OpenSSL support concurrently in two different threads (Willi Mann, Michael Paquier) [§](https://postgr.es/c/09f680d11) +* Fix timing-dependent failure in GSSAPI data transmission (Tom Lane) [§](https://postgr.es/c/5abdfd88f) + + When using GSSAPI encryption in non-blocking mode, libpq sometimes failed with “GSSAPI caller failed to retransmit all data needing to be retried”. +* In pg\_dump, don't dump RLS policies or security labels for extension member objects (Tom Lane, Jacob Champion) [§](https://postgr.es/c/9e08789d4) [§](https://postgr.es/c/7836f6838) + + Previously, commands would be included in the dump to set these properties, which is really incorrect since they should be considered as internal affairs of the extension. Moreover, the restoring user might not have adequate privilege to set them, and indeed the dumping user might not have enough privilege to dump them (since dumping RLS policies requires acquiring lock on their table). +* In pg\_dump, don't dump an extended statistics object if its underlying table isn't being dumped (Rian McGuire, Tom Lane) [§](https://postgr.es/c/8d4e8b746) + + This conforms to the behavior for other dependent objects such as indexes. +* Fix crash in `contrib/intarray` if an array with an element equal to `INT_MAX` is inserted into a `gist__int_ops` index (Alexander Lakhin, Tom Lane) [§](https://postgr.es/c/9e7432faf) +* Report a better error when `contrib/pageinspect`'s `hash_bitmap_info()` function is applied to a partitioned hash index (Alexander Lakhin, Michael Paquier) [§](https://postgr.es/c/586c6a091) +* Report a better error when `contrib/pgstattuple`'s `pgstathashindex()` function is applied to a partitioned hash index (Alexander Lakhin) [§](https://postgr.es/c/b4c1d255c) +* On Windows, suppress autorun options when launching subprocesses in pg\_ctl and pg\_regress (Kyotaro Horiguchi) [§](https://postgr.es/c/c8aab699e) [§](https://postgr.es/c/2a0eb80ae) + + When launching a child process via `cmd.exe`, pass the `/D` flag to prevent executing any autorun commands specified in the registry. This avoids possibly-surprising side effects. +* Fix compilation failures with libxml2 version 2.12.0 and later (Tom Lane) [§](https://postgr.es/c/7c53b1977) +* Fix compilation failure of `WAL_DEBUG` code on Windows (Bharath Rupireddy) [§](https://postgr.es/c/7d5a74033) +* Suppress compiler warnings from Python's header files (Peter Eisentraut, Tom Lane) [§](https://postgr.es/c/48e797164) + + Our preferred compiler options provoke warnings about constructs appearing in recent versions of Python's header files. When using gcc, we can suppress these warnings with a pragma. +* Avoid deprecation warning when compiling with LLVM 18 (Thomas Munro) [§](https://postgr.es/c/70a82f40a) +* Update time zone data files to tzdata release 2024a for DST law changes in Greenland, Kazakhstan, and Palestine, plus corrections for the Antarctic stations Casey and Vostok. Also historical corrections for Vietnam, Toronto, and Miquelon. (Tom Lane) [§](https://postgr.es/c/ac3afc3f7) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-15.html "E.9. Release 13.15") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-13.html "E.11. Release 13.13") | +| E.9. Release 13.15 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.11. Release 13.13 | + +[Previous](/docs/release/13.13/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.15/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1315.md b/corpus/changelog/postgresql_releases/postgresql_1315.md new file mode 100644 index 0000000000000000000000000000000000000000..4ae36ca693597ef59ba3dbc3301bd487ce4cec68 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1315.md @@ -0,0 +1,127 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.15/ +Version: 13.15 + +## PostgreSQL 13.15 + +| E.9. Release 13.15 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-16.html "E.8. Release 13.16") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-14.html "E.10. Release 13.14") | + +--- + +## E.9. Release 13.15 + +[E.9.1. Migration to Version 13.15](release-13-15.html#id-1.11.6.14.4) + +[E.9.2. Changes](release-13-15.html#id-1.11.6.14.5) + +**Release date:**2024-05-09 + +This release contains a variety of fixes from 13.14. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +### E.9.1. Migration to Version 13.15 + +A dump/restore is not required for those running 13.X. + +However, if you are upgrading from a version earlier than 13.14, see [Section E.10](release-13-14.html "E.10. Release 13.14"). + +### E.9.2. Changes + +* Fix `INSERT` from multiple `VALUES` rows into a target column that is a domain over an array or composite type (Tom Lane) [§](https://postgr.es/c/0200398dd) + + Such cases would either fail with surprising complaints about mismatched datatypes, or insert unexpected coercions that could lead to odd results. +* Fix incorrect pruning of NULL partition when a table is partitioned on a boolean column and the query has a boolean `IS NOT` clause (David Rowley) [§](https://postgr.es/c/3850fcca6) + + A NULL value satisfies a clause such as `boolcol IS NOT FALSE`, so pruning away a partition containing NULLs yielded incorrect answers. +* Make `ALTER FOREIGN TABLE SET SCHEMA` move any owned sequences into the new schema (Tom Lane) [§](https://postgr.es/c/97de2a159) + + Moving a regular table to a new schema causes any sequences owned by the table to be moved to that schema too (along with indexes and constraints). This was overlooked for foreign tables, however. +* Fix `EXPLAIN`'s counting of heap pages accessed by a bitmap heap scan (Melanie Plageman) [§](https://postgr.es/c/992189a3e) + + Previously, heap pages that contain no visible tuples were not counted; but it seems more consistent to count all pages returned by the bitmap index scan. +* Avoid deadlock during removal of orphaned temporary tables (Mikhail Zhilin) [§](https://postgr.es/c/4afc2c219) + + If the session that creates a temporary table crashes without removing the table, autovacuum will eventually try to remove the orphaned table. However, an incoming session that's been assigned the same temporary namespace will do that too. If a temporary table has a dependency (such as an owned sequence) then a deadlock could result between these two cleanup attempts. +* Avoid race condition while examining per-relation frozen-XID values (Noah Misch) [§](https://postgr.es/c/70cadfba0) + + `VACUUM`'s computation of per-database frozen-XID values from per-relation values could get confused by a concurrent update of those values by another `VACUUM`. +* Disallow converting a table to a view within an outer SQL command that is using that table (Tom Lane) [§](https://postgr.es/c/1ee22d1e8) + + This avoids possible crashes. +* Ensure that join conditions generated from equivalence classes are applied at the correct plan level (Tom Lane) [§](https://postgr.es/c/d9e4ee74f) + + In versions before PostgreSQL 16, it was possible for generated conditions to be evaluated below outer joins when they should be evaluated above (after) the outer join, leading to incorrect query results. All versions have a similar hazard when considering joins to `UNION ALL` trees that have constant outputs for the join column in some `SELECT` arms. +* Avoid unnecessary use of moving-aggregate mode with a non-moving window frame (Vallimaharajan G) [§](https://postgr.es/c/de3c5b187) + + When a plain aggregate is used as a window function, and the window frame start is specified as `UNBOUNDED PRECEDING`, the frame's head cannot move so we do not need to use the special (and more expensive) moving-aggregate mode. This optimization was intended all along, but due to a coding error it never triggered. +* Avoid use of already-freed data while planning partition-wise joins under GEQO (Tom Lane) [§](https://postgr.es/c/9061fd23c) + + This would typically end in a crash or unexpected error message. +* Fix incorrectly-reported statistics kind codes in “requested statistics kind *`X`* is not yet built” error messages (David Rowley) [§](https://postgr.es/c/421dfb41a) +* Be more careful with `RECORD`-returning functions in `FROM` (Tom Lane) [§](https://postgr.es/c/b6e21cef7) [§](https://postgr.es/c/d769f9d97) + + The output columns of such a function call must be defined by an `AS` clause that specifies the column names and data types. If the actual function output value doesn't match that, an error is supposed to be thrown at runtime. However, some code paths would examine the actual value prematurely, and potentially issue strange errors or suffer assertion failures if it doesn't match expectations. +* Fix confusion about the return rowtype of SQL-language procedures (Tom Lane) [§](https://postgr.es/c/28184f039) + + A procedure implemented in SQL language that returns a single composite-type column would cause an assertion failure or core dump. +* Add protective stack depth checks to some recursive functions (Egor Chindyaskin) [§](https://postgr.es/c/445c7e38f) +* Detect integer overflow when adding or subtracting an `interval` to/from a `timestamp` (Joseph Koshakow) [§](https://postgr.es/c/440b6251b) + + Some cases that should cause an out-of-range error produced an incorrect result instead. +* Avoid race condition in `pg_get_expr()` (Tom Lane) [§](https://postgr.es/c/ceb224b62) + + If the relation referenced by the argument is dropped concurrently, the function's intention is to return NULL, but sometimes it failed instead. +* Fix detection of old transaction IDs in XID status functions (Karina Litskevich) [§](https://postgr.es/c/4efaf4b09) + + Transaction IDs more than 231 transactions in the past could be misidentified as recent, leading to misbehavior of `pg_xact_status()` or `txid_status()`. +* Fix file descriptor leakage when an error is thrown while waiting in `WaitEventSetWait` (Etsuro Fujita) [§](https://postgr.es/c/01b01a77f) +* Throw an error if an index is accessed while it is being reindexed (Tom Lane) [§](https://postgr.es/c/43cca9de9) + + Previously this was just an assertion check, but promote it into a regular runtime error. This will provide a more on-point error message when reindexing a user-defined index expression that attempts to access its own table. +* Ensure that index-only scans on `name` columns return a fully-padded value (David Rowley) [§](https://postgr.es/c/0a34bcd0c) + + The value physically stored in the index is truncated, and previously a pointer to that value was returned to callers. This provoked complaints when testing under valgrind. In theory it could result in crashes, though none have been reported. +* Fix crash with DSM allocations larger than 4GB (Heikki Linnakangas) [§](https://postgr.es/c/e92375692) +* Disconnect if a new server session's client socket cannot be put into non-blocking mode (Heikki Linnakangas) [§](https://postgr.es/c/ad5cd55e6) + + It was once theoretically possible for us to operate with a socket that's in blocking mode; but that hasn't worked fully in a long time, so fail at connection start rather than misbehave later. +* Fix inadequate error reporting with OpenSSL 3.0.0 and later (Heikki Linnakangas, Tom Lane) [§](https://postgr.es/c/9fbe07275) + + System-reported errors passed through by OpenSSL were reported with a numeric error code rather than anything readable. +* Avoid concurrent calls to `bindtextdomain()` in libpq and ecpglib (Tom Lane) [§](https://postgr.es/c/8c5da20db) [§](https://postgr.es/c/67f8cf0f0) + + Although GNU gettext's implementation seems to be fine with concurrent calls, the version available on Windows is not. +* Fix crash in ecpg's preprocessor if the program tries to redefine a macro that was defined on the preprocessor command line (Tom Lane) [§](https://postgr.es/c/02531e8ca) [§](https://postgr.es/c/481597fc6) [§](https://postgr.es/c/c6bfeab42) +* In ecpg, avoid issuing false “unsupported feature will be passed to server” warnings (Tom Lane) [§](https://postgr.es/c/5ba29e945) +* Ensure that the string result of ecpg's `intoasc()` function is correctly zero-terminated (Oleg Tselebrovskiy) [§](https://postgr.es/c/c031ce97b) +* Fix pg\_dumpall so that role comments, if present, will be dumped regardless of the setting of `--no-role-passwords` (Daniel Gustafsson, Álvaro Herrera) [§](https://postgr.es/c/affc46b76) [§](https://postgr.es/c/d5c6affb8) +* Fix PL/pgSQL's parsing of single-line comments (`--`-style comments) following expressions (Erik Wienhold, Tom Lane) [§](https://postgr.es/c/f5cee411a) + + This mistake caused parse errors if such a comment followed a `WHEN` expression in a PL/pgSQL `CASE` statement. +* In `contrib/amcheck`, don't report false match failures due to short- versus long-header values (Andrey Borodin, Michael Zhilin) [§](https://postgr.es/c/5cc1f2626) [§](https://postgr.es/c/e2c241416) + + A variable-length datum in a heap tuple or index tuple could have either a short or a long header, depending on compression parameters that applied when it was made. Treat these cases as equivalent rather than complaining if there's a difference. +* In `contrib/postgres_fdw`, avoid emitting requests to sort by a constant (David Rowley) [§](https://postgr.es/c/20b85b3da) + + This could occur in cases involving `UNION ALL` with constant-emitting subqueries. Sorting by a constant is useless of course, but it also risks being misinterpreted by the remote server, leading to “ORDER BY position *`N`* is not in select list” errors. +* Make `contrib/postgres_fdw` set the remote session's time zone to `GMT` not `UTC` (Tom Lane) [§](https://postgr.es/c/0e56b2b94) + + This should have the same results for practical purposes. However, `GMT` is recognized by hard-wired code in the server, while `UTC` is looked up in the timezone database. So the old code could fail in the unlikely event that the remote server's timezone database is missing entries. +* In `contrib/xml2`, avoid use of library functions that have been deprecated in recent versions of libxml2 (Dmitry Koval) [§](https://postgr.es/c/bb418aeee) +* Fix incompatibility with LLVM 18 (Thomas Munro, Dmitry Dolgov) [§](https://postgr.es/c/4f90750b5) +* Allow `make check` to work with the musl C library (Thomas Munro, Bruce Momjian, Tom Lane) [§](https://postgr.es/c/243e99532) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-16.html "E.8. Release 13.16") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-14.html "E.10. Release 13.14") | +| E.8. Release 13.16 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.10. Release 13.14 | + +[Previous](/docs/release/13.14/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.16/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1316.md b/corpus/changelog/postgresql_releases/postgresql_1316.md new file mode 100644 index 0000000000000000000000000000000000000000..627d34d9f5f1d803781270feba277106aee15933 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1316.md @@ -0,0 +1,148 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.16/ +Version: 13.16 + +## PostgreSQL 13.16 + +| E.8. Release 13.16 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-17.html "E.7. Release 13.17") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-15.html "E.9. Release 13.15") | + +--- + +## E.8. Release 13.16 + +[E.8.1. Migration to Version 13.16](release-13-16.html#id-1.11.6.13.4) + +[E.8.2. Changes](release-13-16.html#id-1.11.6.13.5) + +**Release date:**2024-08-08 + +This release contains a variety of fixes from 13.15. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +### E.8.1. Migration to Version 13.16 + +A dump/restore is not required for those running 13.X. + +However, if you are upgrading from a version earlier than 13.14, see [Section E.10](release-13-14.html "E.10. Release 13.14"). + +### E.8.2. Changes + +* Prevent unauthorized code execution during pg\_dump (Masahiko Sawada) [§](https://postgr.es/c/bbc94abf6) + + An attacker able to create and drop non-temporary objects could inject SQL code that would be executed by a concurrent pg\_dump session with the privileges of the role running pg\_dump (which is often a superuser). The attack involves replacing a sequence or similar object with a view or foreign table that will execute malicious code. To prevent this, introduce a new server parameter `restrict_nonsystem_relation_kind` that can disable expansion of non-builtin views as well as access to foreign tables, and teach pg\_dump to set it when available. Note that the attack is prevented only if both pg\_dump and the server it is dumping from are new enough to have this fix. + + The PostgreSQL Project thanks Noah Misch for reporting this problem. (CVE-2024-7348) +* Fix failure after attaching a table as a partition, if the table had previously had inheritance children (Álvaro Herrera) [§](https://postgr.es/c/ed7430975) +* Fix `ALTER TABLE DETACH PARTITION` for cases involving inconsistent index-based constraints (Álvaro Herrera, Tender Wang) [§](https://postgr.es/c/057482569) [§](https://postgr.es/c/7898a494f) + + When a partitioned table has an index that is not associated with a constraint, but a partition has an equivalent index that is, then detaching the partition would misbehave, leaving the ex-partition's constraint with an incorrect `coninhcount` value. This would cause trouble during any further manipulations of that constraint. +* Fix handling of polymorphic output arguments for procedures (Tom Lane) [§](https://postgr.es/c/e85f641b2) [§](https://postgr.es/c/9de0ff91a) + + The SQL `CALL` statement did not resolve the correct data types for such arguments, leading to errors such as “cannot display a value of type anyelement”, or even outright crashes. (But `CALL` in PL/pgSQL worked correctly.) +* Fix behavior of stable functions called from a `CALL` statement's argument list (Tom Lane) [§](https://postgr.es/c/1d4ea1376) + + If the `CALL` is within an atomic context (e.g. there's an outer transaction block), such functions were passed the wrong snapshot, causing them to see stale values of rows modified since the start of the outer transaction. +* Detect integer overflow in `money` calculations (Joseph Koshakow) [§](https://postgr.es/c/c5321e965) + + None of the arithmetic functions for the `money` type checked for overflow before, so they would silently give wrong answers for overflowing cases. +* Fix over-aggressive clamping of the scale argument in `round(numeric)` and `trunc(numeric)` (Dean Rasheed) [§](https://postgr.es/c/ece296926) + + These functions clamped their scale argument to +/-2000, but there are valid use-cases for it to be larger; the functions returned incorrect results in such cases. Instead clamp to the actual allowed range of type `numeric`. +* Prevent `pg_sequence_last_value()` from failing on unlogged sequences on standby servers and on temporary sequences of other sessions (Nathan Bossart) [§](https://postgr.es/c/09ec5d455) + + Make it return NULL in these cases instead of throwing an error. +* Fix parsing of ignored operators in `websearch_to_tsquery()` (Tom Lane) [§](https://postgr.es/c/c7de5a654) + + Per the manual, punctuation in the input of `websearch_to_tsquery()` is ignored except for the special cases of dashes and quotes. However, parentheses and a few other characters appearing immediately before an `or` could cause `or` to be treated as a data word, rather than as an `OR` operator as expected. +* Detect another integer overflow case while computing new array dimensions (Joseph Koshakow) [§](https://postgr.es/c/6c1b71bc6) + + Reject applying array dimensions `[-2147483648:2147483647]` to an empty array. This is closely related to CVE-2023-5869, but appears harmless since the array still ends up empty. +* Detect another case of a new catalog cache entry becoming stale while detoasting its fields (Noah Misch) [§](https://postgr.es/c/7a21306ae) + + An in-place update occurring while we expand out-of-line fields in a catalog tuple could be missed, leading to a catalog cache entry that lacks the in-place change but is not known to be stale. This is only possible in the `pg_database` catalog, so the effects are narrow, but misbehavior is possible. +* Correctly check updatability of view columns targeted by `INSERT` ... `DEFAULT` (Tom Lane) [§](https://postgr.es/c/461f47948) + + If such a column is non-updatable, we should give an error reporting that. But the check was missed and then later code would report an unhelpful error such as “attribute number *`N`* not found in view targetlist”. +* Avoid reporting an unhelpful internal error for incorrect recursive queries (Tom Lane) [§](https://postgr.es/c/b020a866a) + + Rearrange the order of error checks so that we throw an on-point error when a `WITH RECURSIVE` query does not have a self-reference within the second arm of the `UNION`, but does have one self-reference in some other place such as `ORDER BY`. +* Don't throw an error if a queued `AFTER` trigger no longer exists (Tom Lane) [§](https://postgr.es/c/9ce8ee9d3) + + It's possible for a transaction to execute an operation that queues a deferred `AFTER` trigger for later execution, and then to drop the trigger before that happens. Formerly this led to weird errors such as “could not find trigger *`NNNN`*”. It seems better to silently do nothing if the trigger no longer exists at the time when it would have been executed. +* Fix failure to remove `pg_init_privs` entries for column-level privileges when their table is dropped (Tom Lane) [§](https://postgr.es/c/198de7961) + + If an extension grants some column-level privileges on a table it creates, relevant catalog entries would remain behind after the extension is dropped. This was harmless until/unless the table's OID was re-used for another relation, when it could interfere with what pg\_dump dumps for that relation. +* Fix selection of an arbiter index for `ON CONFLICT` when the desired index has expressions or predicates (Tom Lane) [§](https://postgr.es/c/5e8aa32a9) + + If a query using `ON CONFLICT` accesses the target table through an updatable view, it could fail with “there is no unique or exclusion constraint matching the ON CONFLICT specification”, even though a matching index does exist. +* Refuse to modify a temporary table of another session with `ALTER TABLE` (Tom Lane) [§](https://postgr.es/c/7c4ac652e) + + Permissions checks normally would prevent this case from arising, but it is possible to reach it by altering a parent table whose child is another session's temporary table. Throw an error if we discover that such a child table belongs to another session. +* Fix failure to recalculate sub-queries generated from `MIN()` or `MAX()` aggregates (Tom Lane) [§](https://postgr.es/c/7f90a5dc3) + + In some cases the aggregate result computed at one row of the outer query could be re-used for later rows when it should not be. This has only been seen to happen when the outer query uses `DISTINCT` that is implemented with hash aggregation, but other cases may exist. +* Avoid crashing when a JIT-inlined backend function throws an error (Tom Lane) [§](https://postgr.es/c/86fac88ee) + + The error state can include pointers into the dynamically loaded module holding the JIT-compiled code (for error location strings). In some code paths the module could get unloaded before the error report is processed, leading to SIGSEGV when the location strings are accessed. +* Cope with behavioral changes in libxml2 version 2.13.x (Erik Wienhold, Tom Lane) [§](https://postgr.es/c/48132587d) + + Notably, we now suppress “chunk is not well balanced” errors from libxml2, unless that is the only reported error. This is to make error reports consistent between 2.13.x and earlier libxml2 versions. In earlier versions, that message was almost always redundant or outright incorrect, so 2.13.x substantially reduced the number of cases in which it's reported. +* Fix handling of subtransactions of prepared transactions when starting a hot standby server (Heikki Linnakangas) [§](https://postgr.es/c/e9c8747ee) + + When starting a standby's replay at a shutdown checkpoint WAL record, transactions that had been prepared but not yet committed on the primary are correctly understood as being still in progress. But subtransactions of a prepared transaction (created by savepoints or PL/pgSQL exception blocks) were not accounted for and would be treated as aborted. That led to inconsistency if the prepared transaction was later committed. +* Prevent incorrect initialization of logical replication slots (Masahiko Sawada) [§](https://postgr.es/c/cf2c69ec5) + + In some cases a replication slot's start point within the WAL stream could be set to a point within a transaction, leading to assertion failures or incorrect decoding results. +* Avoid memory leakage after servicing a notify or sinval interrupt (Tom Lane) [§](https://postgr.es/c/5f86cd70d) + + The processing functions for these events could switch the current memory context to TopMemoryContext, resulting in session-lifespan leakage of any data allocated before the incorrect setting gets replaced. There were observable leaks associated with (at least) encoding conversion of incoming queries and parameters attached to Bind messages. +* Avoid possibly missing end-of-input events on Windows sockets (Thomas Munro) [§](https://postgr.es/c/3554d841d) + + Windows reports an FD\_CLOSE event only once after the remote end of the connection disconnects. With unlucky timing, we could miss that report and wait indefinitely, or at least until a timeout elapsed, expecting more input. +* Fix buffer overread in JSON parse error reports for incomplete byte sequences (Jacob Champion) [§](https://postgr.es/c/377c25d32) + + It was possible to walk off the end of the input buffer by a few bytes when the last bytes comprise an incomplete multi-byte character. While usually harmless, in principle this could cause a crash. +* Disable creation of stateful TLS session tickets by OpenSSL (Daniel Gustafsson) [§](https://postgr.es/c/1f476bc75) [§](https://postgr.es/c/40e8ea949) [§](https://postgr.es/c/634710dfb) + + This avoids possible failures with clients that think receipt of a session ticket means that TLS session resumption is supported. +* When replanning a PL/pgSQL “simple expression”, check it's still simple (Tom Lane) [§](https://postgr.es/c/1fa46dba5) + + Certain fairly-artificial cases, such as dropping a referenced function and recreating it as an aggregate, could lead to surprising failures such as “unexpected plan node type”. +* Fix incompatibility between PL/Perl and Perl 5.40 (Andrew Dunstan) [§](https://postgr.es/c/b7374f15b) +* Fix recursive `RECORD`-returning PL/Python functions (Tom Lane) [§](https://postgr.es/c/272867792) + + If we recurse to a new call of the same function that passes a different column definition list (`AS` clause), it would fail because the inner call would overwrite the outer call's idea of what rowtype to return. +* Don't corrupt PL/Python's `TD` dictionary during a recursive trigger call (Tom Lane) [§](https://postgr.es/c/abe60b6a0) + + If a PL/Python-language trigger caused another one to be invoked, the `TD` dictionary created for the inner one would overwrite the outer one's `TD` dictionary. +* Fix PL/Tcl's reporting of invalid list syntax in the result of a function returning tuple (Erik Wienhold, Tom Lane) [§](https://postgr.es/c/dda633a03) + + Such a case could result in a crash, or in emission of misleading context information that actually refers to the previous Tcl error. +* Avoid non-thread-safe usage of `strerror()` in libpq (Peter Eisentraut) [§](https://postgr.es/c/da5d7a771) + + Certain error messages returned by OpenSSL could become garbled in multi-threaded applications. +* Ensure that `pg_restore` `-l` reports dependent TOC entries correctly (Tom Lane) [§](https://postgr.es/c/b99dc6694) + + If `-l` was specified together with selective-restore options such as `-n` or `-N`, dependent TOC entries such as comments would be omitted from the listing, even when an actual restore would have selected them. +* In `contrib/postgres_fdw`, do not send `FETCH FIRST WITH TIES` clauses to the remote server (Japin Li) [§](https://postgr.es/c/2b461efc5) + + The remote server might not implement this clause, or might interpret it differently than we would locally, so don't risk attempting remote execution. +* Avoid clashing with system-provided `` headers (Thomas Munro) [§](https://postgr.es/c/440aedc0f) + + This fixes a compilation failure on macOS version 15 and up. +* Fix otherwise-harmless assertion failures in `REINDEX CONCURRENTLY` applied to an SP-GiST index (Tom Lane) [§](https://postgr.es/c/507a900ad) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-17.html "E.7. Release 13.17") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-15.html "E.9. Release 13.15") | +| E.7. Release 13.17 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.9. Release 13.15 | + +[Previous](/docs/release/13.15/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.17/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1317.md b/corpus/changelog/postgresql_releases/postgresql_1317.md new file mode 100644 index 0000000000000000000000000000000000000000..a0652a82093eb96cc9280e3c1958f10852995612 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1317.md @@ -0,0 +1,187 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.17/ +Version: 13.17 + +## PostgreSQL 13.17 + +| E.7. Release 13.17 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-18.html "E.6. Release 13.18") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-16.html "E.8. Release 13.16") | + +--- + +## E.7. Release 13.17 + +[E.7.1. Migration to Version 13.17](release-13-17.html#id-1.11.6.12.4) + +[E.7.2. Changes](release-13-17.html#id-1.11.6.12.5) + +**Release date:**2024-11-14 + +This release contains a variety of fixes from 13.16. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +### E.7.1. Migration to Version 13.17 + +A dump/restore is not required for those running 13.X. + +However, if you have ever detached a partition from a partitioned table that has a foreign-key reference to another partitioned table, and not dropped the former partition, then you may have catalog and/or data corruption to repair, as detailed in the fifth changelog entry below. + +Also, if you are upgrading from a version earlier than 13.14, see [Section E.10](release-13-14.html "E.10. Release 13.14"). + +### E.7.2. Changes + +* Ensure cached plans are marked as dependent on the calling role when RLS applies to a non-top-level table reference (Nathan Bossart) [§](https://postgr.es/c/952ff31e2) + + If a CTE, subquery, sublink, security invoker view, or coercion projection in a query references a table with row-level security policies, we neglected to mark the resulting plan as potentially dependent on which role is executing it. This could lead to later query executions in the same session using the wrong plan, and then returning or hiding rows that should have been hidden or returned instead. + + The PostgreSQL Project thanks Wolfgang Walther for reporting this problem. (CVE-2024-10976) +* Make libpq discard error messages received during SSL or GSS protocol negotiation (Jacob Champion) [§](https://postgr.es/c/7b49707b7) + + An error message received before encryption negotiation is completed might have been injected by a man-in-the-middle, rather than being real server output. Reporting it opens the door to various security hazards; for example, the message might spoof a query result that a careless user could mistake for correct output. The best answer seems to be to discard such data and rely only on libpq's own report of the connection failure. + + The PostgreSQL Project thanks Jacob Champion for reporting this problem. (CVE-2024-10977) +* Fix unintended interactions between `SET SESSION AUTHORIZATION` and `SET ROLE` (Tom Lane) [§](https://postgr.es/c/76123ded6) [§](https://postgr.es/c/dc7378793) + + The SQL standard mandates that `SET SESSION AUTHORIZATION` have a side-effect of doing `SET ROLE NONE`. Our implementation of that was flawed, creating more interaction between the two settings than intended. Notably, rolling back a transaction that had done `SET SESSION AUTHORIZATION` would revert `ROLE` to `NONE` even if that had not been the previous state, so that the effective user ID might now be different from what it had been before the transaction. Transiently setting `session_authorization` in a function `SET` clause had a similar effect. A related bug was that if a parallel worker inspected `current_setting('role')`, it saw `none` even when it should see something else. + + The PostgreSQL Project thanks Tom Lane for reporting this problem. (CVE-2024-10978) +* Prevent trusted PL/Perl code from changing environment variables (Andrew Dunstan, Noah Misch) [§](https://postgr.es/c/e428cd058) [§](https://postgr.es/c/6bccd7b03) [§](https://postgr.es/c/9f97c31c2) [§](https://postgr.es/c/0bd9560d9) + + The ability to manipulate process environment variables such as `PATH` gives an attacker opportunities to execute arbitrary code. Therefore, “trusted” PLs must not offer the ability to do that. To fix `plperl`, replace `%ENV` with a tied hash that rejects any modification attempt with a warning. Untrusted `plperlu` retains the ability to change the environment. + + The PostgreSQL Project thanks Coby Abrams for reporting this problem. (CVE-2024-10979) +* Fix updates of catalog state for foreign-key constraints when attaching or detaching table partitions (Jehan-Guillaume de Rorthais, Tender Wang, Álvaro Herrera) [§](https://postgr.es/c/d20194cea) + + If the referenced table is partitioned, then different catalog entries are needed for a referencing table that is stand-alone versus one that is a partition. `ATTACH/DETACH PARTITION` commands failed to perform this conversion correctly. In particular, after `DETACH` the now stand-alone table would be missing foreign-key enforcement triggers, which could result in the table later containing rows that fail the foreign-key constraint. A subsequent re-`ATTACH` could fail with surprising errors, too. + + The way to fix this is to do `ALTER TABLE DROP CONSTRAINT` on the now stand-alone table for each faulty constraint, and then re-add the constraint. If re-adding the constraint fails, then some erroneous data has crept in. You will need to manually re-establish consistency between the referencing and referenced tables, then re-add the constraint. + + This query can be used to identify broken constraints and construct the commands needed to recreate them: + + ```None + SELECT conrelid::pg_catalog.regclass AS "constrained table", + conname AS constraint, + confrelid::pg_catalog.regclass AS "references", + pg_catalog.format('ALTER TABLE %s DROP CONSTRAINT %I;', + conrelid::pg_catalog.regclass, conname) AS "drop", + pg_catalog.format('ALTER TABLE %s ADD CONSTRAINT %I %s;', + conrelid::pg_catalog.regclass, conname, + pg_catalog.pg_get_constraintdef(oid)) AS "add" + FROM pg_catalog.pg_constraint c + WHERE contype = 'f' AND conparentid = 0 AND + (SELECT count(*) FROM pg_catalog.pg_constraint c2 + WHERE c2.conparentid = c.oid) <> + ((SELECT count(*) FROM pg_catalog.pg_inherits i + WHERE (i.inhparent = c.conrelid OR i.inhparent = c.confrelid) AND + EXISTS (SELECT 1 FROM pg_catalog.pg_partitioned_table + WHERE partrelid = i.inhparent)) + + CASE WHEN pg_catalog.pg_partition_root(conrelid) = confrelid THEN + (SELECT count(*) FROM pg_catalog.pg_partition_tree(confrelid) + WHERE level = 1) + ELSE 0 END); + ``` + + Since it is possible that one or more of the `ADD CONSTRAINT` steps will fail, you should save the query's output in a file and then attempt to perform each step. +* Disallow `ALTER TABLE ATTACH PARTITION` if the table to be attached has a foreign key referencing the partitioned table (Álvaro Herrera) [§](https://postgr.es/c/2ee02c98d) [§](https://postgr.es/c/ebbfa2ae3) + + This arrangement is not supported, and other ways of creating it already fail. +* Don't use partitionwise joins or grouping if the query's collation for the key column doesn't match the partition key's collation (Jian He, Webbo Han) [§](https://postgr.es/c/054701a2b) [§](https://postgr.es/c/ff65f695c) + + Such plans could produce incorrect results. +* Fix possible “could not find pathkey item to sort” error when the output of a `UNION ALL` member query needs to be sorted, and the sort column is an expression (Andrei Lepikhov, Tom Lane) [§](https://postgr.es/c/76de4b182) +* Allow cancellation of the second stage of index build for large hash indexes (Pavel Borisov) [§](https://postgr.es/c/b27215dbb) +* Fix assertion failure or confusing error message for `COPY (query) TO ...`, when the *`query`* is rewritten by a `DO INSTEAD NOTIFY` rule (Tender Wang, Tom Lane) [§](https://postgr.es/c/beab395a4) +* Fix detection of skewed data during parallel hash join (Thomas Munro) [§](https://postgr.es/c/45329466f) + + After repartitioning the inner side of a hash join because one partition has accumulated too many tuples, we check to see if all the partition's tuples went into the same child partition, which suggests that they all have the same hash value and further repartitioning cannot improve matters. This check malfunctioned in some cases, allowing repeated futile repartitioning which would eventually end in a resource-exhaustion error. +* Fix race condition in committing a serializable transaction (Heikki Linnakangas) [§](https://postgr.es/c/8e607a5a4) + + Mis-processing of a recently committed transaction could lead to an assertion failure or a “could not access status of transaction” error. +* Fix race condition in `COMMIT PREPARED` that resulted in orphaned 2PC files (wuchengwen) [§](https://postgr.es/c/7bfaa4671) + + A concurrent `PREPARE TRANSACTION` could cause `COMMIT PREPARED` to not remove the on-disk two-phase state file for the completed transaction. There was no immediate ill effect, but a subsequent crash-and-recovery could fail with “could not access status of transaction”, requiring manual removal of the orphaned file to restore service. +* Avoid invalid memory accesses after skipping an invalid toast index during `VACUUM FULL` (Tender Wang) [§](https://postgr.es/c/911eda9f3) + + A list tracking yet-to-be-rebuilt indexes was not properly updated in this code path, risking assertion failures or crashes later on. +* Fix ways in which an “in place” catalog update could be lost (Noah Misch) [§](https://postgr.es/c/a8ad1929d) [§](https://postgr.es/c/14c57cb63) [§](https://postgr.es/c/db1992455) [§](https://postgr.es/c/3e5ea478d) [§](https://postgr.es/c/2a912bc1a) [§](https://postgr.es/c/6b01cac0b) [§](https://postgr.es/c/4dc0c933f) + + Normal row updates write a new version of the row to preserve rollback-ability of the transaction. However, certain system catalog updates are intentionally non-transactional and are done with an in-place update of the row. These patches fix race conditions that could cause the effects of an in-place update to be lost. As an example, it was possible to forget having set `pg_class`.`relhasindex` to true, preventing updates of the new index and thus causing index corruption. +* Reset catalog caches at end of recovery (Noah Misch) [§](https://postgr.es/c/67f30c79a) + + This prevents scenarios wherein an in-place catalog update could be lost due to using stale data from a catalog cache. +* Avoid using parallel query while holding off interrupts (Francesco Degrassi, Noah Misch, Tom Lane) [§](https://postgr.es/c/916b8ae47) [§](https://postgr.es/c/62685876f) + + This situation cannot arise normally, but it can be reached with test scenarios such as using a SQL-language function as B-tree support (which would be far too slow for production usage). If it did occur it would result in an indefinite wait. +* Guard against stack overflow in libxml2 with too-deeply-nested XML input (Tom Lane, with hat tip to Nick Wellnhofer) [§](https://postgr.es/c/4310dfa25) + + Use `xmlXPathCtxtCompile()` rather than `xmlXPathCompile()`, because the latter fails to protect itself against recursion-to-stack-overflow in libxml2 releases before 2.13.4. +* Fix “failed to find plan for subquery/CTE” errors in `EXPLAIN` (Richard Guo, Tom Lane) [§](https://postgr.es/c/016f44364) [§](https://postgr.es/c/3ad35d502) + + This case arose while trying to print references to fields of a RECORD-type output of a subquery when the subquery has been optimized out of the plan altogether (which is possible at least in the case that it has a constant-false `WHERE` condition). Nothing remains in the plan to identify the original field names, so fall back to printing `fN` for the *`N`*'th record column. (That's actually the right thing anyway, if the record output arose from a `ROW()` constructor.) +* Disallow a `USING` clause when altering the type of a generated column (Peter Eisentraut) [§](https://postgr.es/c/7589d5c5b) + + A generated column already has an expression specifying the column contents, so including `USING` doesn't make sense. +* Ignore not-yet-defined Portals in the `pg_cursors` view (Tom Lane) [§](https://postgr.es/c/4a17acd0d) + + It is possible for user-defined code that inspects this view to be called while a new cursor is being set up, and if that happens a null pointer dereference would ensue. Avoid the problem by defining the view to exclude incompletely-set-up cursors. +* Reduce memory consumption of logical decoding (Masahiko Sawada) [§](https://postgr.es/c/cb988b04d) + + Use a smaller default block size to store tuple data received during logical replication. This reduces memory wastage, which has been reported to be severe while processing long-running transactions, even leading to out-of-memory failures. +* Re-disable sending of stateless (TLSv1.2) session tickets (Daniel Gustafsson) [§](https://postgr.es/c/f925b7f65) + + A previous change to prevent sending of stateful (TLSv1.3) session tickets accidentally re-enabled sending of stateless ones. Thus, while we intended to prevent clients from thinking that TLS session resumption is supported, some still did. +* Avoid “wrong tuple length” failure when dropping a database with many ACL (permission) entries (Ayush Tiwari) [§](https://postgr.es/c/33c615f76) [§](https://postgr.es/c/4e7531fda) +* Allow adjusting the `session_authorization` and `role` settings in parallel workers (Tom Lane) [§](https://postgr.es/c/adf9808fa) + + Our code intends to allow modifiable server settings to be set by function `SET` clauses, but not otherwise within a parallel worker. `SET` clauses failed for these two settings, though. +* Fix behavior of stable functions called from a `CALL` statement's argument list, when the `CALL` is within a PL/pgSQL `EXCEPTION` block (Tom Lane) [§](https://postgr.es/c/0d83ced3c) + + As with a similar fix in our previous quarterly releases, this case allowed such functions to be passed the wrong snapshot, causing them to see stale values of rows modified since the start of the outer transaction. +* Parse libpq's `keepalives` connection option in the same way as other integer-valued options (Yuto Sasaki) [§](https://postgr.es/c/2120eda94) + + The coding used here rejected trailing whitespace in the option value, unlike other cases. This turns out to be problematic in ecpg's usage, for example. +* Avoid use of `pnstrdup()` in ecpglib (Jacob Champion) [§](https://postgr.es/c/f0096ef13) + + That function will call `exit()` on out-of-memory, which is undesirable in a library. The calling code already handles allocation failures properly. +* In ecpglib, fix out-of-bounds read when parsing incorrect datetime input (Bruce Momjian, Pavel Nekrasov) [§](https://postgr.es/c/fcafbaadf) + + It was possible to try to read the location just before the start of a constant array. Real-world consequences seem minimal, though. +* Include the source timeline history in pg\_rewind's debug output (Heikki Linnakangas) [§](https://postgr.es/c/c943e2aae) + + This was the intention to begin with, but a coding error caused the source history to always print as empty. +* Fix misbehavior with junction points on Windows, particularly in pg\_rewind (Alexandra Wang) [§](https://postgr.es/c/fa56aa23f) [§](https://postgr.es/c/bb509a464) [§](https://postgr.es/c/ee219102d) [§](https://postgr.es/c/5c0b7581b) [§](https://postgr.es/c/56b39cce7) [§](https://postgr.es/c/b4363fc66) [§](https://postgr.es/c/a5abacecb) [§](https://postgr.es/c/f1cf64167) [§](https://postgr.es/c/a9beed676) + + This entailed back-patching previous fixes by Thomas Munro, Peter Eisentraut, Alexander Lakhin, and Juan José Santamaría Flecha. Those changes were originally not back-patched out of caution, but they have been in use in later branches for long enough to deem them safe. +* Avoid trying to reindex temporary tables and indexes in vacuumdb and in parallel reindexdb (VaibhaveS, Michael Paquier, Fujii Masao, Nathan Bossart) [§](https://postgr.es/c/9db4598c9) [§](https://postgr.es/c/9410f7cbf) [§](https://postgr.es/c/d4ade0baf) + + Reindexing other sessions' temporary tables cannot work, but the check to skip them was missing in some code paths, leading to unwanted failures. +* Allow inspection of sequence relations in relevant functions of `contrib/pageinspect` and `contrib/pgstattuple` (Nathan Bossart, Ayush Vatsa) [§](https://postgr.es/c/ca902529c) [§](https://postgr.es/c/ef46a73f6) + + This had been allowed in the past, but it got broken during the introduction of non-default access methods for tables. +* Fix incorrect LLVM-generated code on ARM64 platforms (Thomas Munro, Anthonin Bonnefoy) [§](https://postgr.es/c/e88d824a4) + + When using JIT compilation on ARM platforms, the generated code could not support relocation distances exceeding 32 bits, allowing unlucky placement of generated code to cause server crashes on large-memory systems. +* Fix a few places that assumed that process start time (represented as a `time_t`) will fit into a `long` value (Max Johnson, Nathan Bossart) [§](https://postgr.es/c/b255493ae) + + On platforms where `long` is 32 bits (notably Windows), this coding would fail after Y2038. Most of the failures appear only cosmetic, but notably `pg_ctl start` would hang. +* Prevent “nothing provides perl(PostgreSQL::Test::Utils)” failures while building RPM packages of PostgreSQL (Noah Misch) [§](https://postgr.es/c/382909b63) +* Fix building with Strawberry Perl on Windows (Andrew Dunstan) [§](https://postgr.es/c/f40d9e9f1) +* Update time zone data files to tzdata release 2024b (Tom Lane) [§](https://postgr.es/c/8a8486175) [§](https://postgr.es/c/b28b9b19b) + + This tzdata release changes the old System-V-compatibility zone names to duplicate the corresponding geographic zones; for example `PST8PDT` is now an alias for `America/Los_Angeles`. The main visible consequence is that for timestamps before the introduction of standardized time zones, the zone is considered to represent local mean solar time for the named location. For example, in `PST8PDT`, `timestamptz` input such as `1801-01-01 00:00` would previously have been rendered as `1801-01-01 00:00:00-08`, but now it is rendered as `1801-01-01 00:00:00-07:52:58`. + + Also, historical corrections for Mexico, Mongolia, and Portugal. Notably, `Asia/Choibalsan` is now an alias for `Asia/Ulaanbaatar` rather than being a separate zone, mainly because the differences between those zones were found to be based on untrustworthy data. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-18.html "E.6. Release 13.18") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-16.html "E.8. Release 13.16") | +| E.6. Release 13.18 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.8. Release 13.16 | + +[Previous](/docs/release/13.16/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.18/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1318.md b/corpus/changelog/postgresql_releases/postgresql_1318.md new file mode 100644 index 0000000000000000000000000000000000000000..6d1d9c6b231df3c040606e30bd663fce7c922408 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1318.md @@ -0,0 +1,54 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.18/ +Version: 13.18 + +## PostgreSQL 13.18 + +| E.6. Release 13.18 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-19.html "E.5. Release 13.19") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-17.html "E.7. Release 13.17") | + +--- + +## E.6. Release 13.18 + +[E.6.1. Migration to Version 13.18](release-13-18.html#id-1.11.6.11.4) + +[E.6.2. Changes](release-13-18.html#id-1.11.6.11.5) + +**Release date:**2024-11-21 + +This release contains a few fixes from 13.17. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +### E.6.1. Migration to Version 13.18 + +A dump/restore is not required for those running 13.X. + +However, if you are upgrading from a version earlier than 13.17, see [Section E.7](release-13-17.html "E.7. Release 13.17"). + +### E.6.2. Changes + +* Restore functionality of `ALTER {ROLE|DATABASE} SET role` (Tom Lane, Noah Misch) [§](https://postgr.es/c/07c6e0f61) + + The fix for CVE-2024-10978 accidentally caused settings for `role` to not be applied if they come from non-interactive sources, including previous `ALTER {ROLE|DATABASE}` commands and the `PGOPTIONS` environment variable. +* Fix cases where a logical replication slot's `restart_lsn` could go backwards (Masahiko Sawada) [§](https://postgr.es/c/15dc1abb1) + + Previously, restarting logical replication could sometimes cause the slot's restart point to be recomputed as an older value than had previously been advertised in `pg_replication_slots`. This is bad, since for example WAL files might have been removed on the basis of the later `restart_lsn` value, in which case replication would fail to restart. +* Count index scans in `contrib/bloom` indexes in the statistics views, such as the `pg_stat_user_indexes`.`idx_scan` counter (Masahiro Ikeda) [§](https://postgr.es/c/e493ea866) +* Fix crash when checking to see if an index's opclass options have changed (Alexander Korotkov) [§](https://postgr.es/c/5411e8213) + + Some forms of `ALTER TABLE` would fail if the table has an index with non-default operator class options. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-19.html "E.5. Release 13.19") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-17.html "E.7. Release 13.17") | +| E.5. Release 13.19 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.7. Release 13.17 | + +[Previous](/docs/release/13.17/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.19/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1319.md b/corpus/changelog/postgresql_releases/postgresql_1319.md new file mode 100644 index 0000000000000000000000000000000000000000..41a8529f3ccac1f2037b8c4beb59c3b3f95eaefa --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1319.md @@ -0,0 +1,159 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.19/ +Version: 13.19 + +## PostgreSQL 13.19 + +| E.5. Release 13.19 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-20.html "E.4. Release 13.20") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-18.html "E.6. Release 13.18") | + +--- + +## E.5. Release 13.19 + +[E.5.1. Migration to Version 13.19](release-13-19.html#id-1.11.6.10.5) + +[E.5.2. Changes](release-13-19.html#id-1.11.6.10.6) + +**Release date:**2025-02-13 + +This release contains a variety of fixes from 13.18. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +The PostgreSQL community will stop releasing updates for the 13.X release series in November 2025. Users are encouraged to update to a newer release branch soon. + +### E.5.1. Migration to Version 13.19 + +A dump/restore is not required for those running 13.X. + +However, if you are upgrading from a version earlier than 13.17, see [Section E.7](release-13-17.html "E.7. Release 13.17"). + +### E.5.2. Changes + +* Harden `PQescapeString` and allied functions against invalidly-encoded input strings (Andres Freund, Noah Misch) [§](https://postgr.es/c/c906bfe1b) [§](https://postgr.es/c/db3eb0e82) [§](https://postgr.es/c/5df4e1632) [§](https://postgr.es/c/4ea3f5ef3) [§](https://postgr.es/c/7beb2af5e) [§](https://postgr.es/c/00f1a1f66) [§](https://postgr.es/c/f9fceef6e) + + Data-quoting functions supplied by libpq now fully check the encoding validity of their input. If invalid characters are detected, they report an error if possible. For the ones that lack an error return convention, the output string is adjusted to ensure that the server will report invalid encoding and no intervening processing will be fooled by bytes that might happen to match single quote, backslash, etc. + + The purpose of this change is to guard against SQL-injection attacks that are possible if one of these functions is used to quote crafted input. There is no hazard when the resulting string is sent directly to a PostgreSQL server (which would check its encoding anyway), but there is a risk when it is passed through psql or other client-side code. Historically such code has not carefully vetted encoding, and in many cases it's not clear what it should do if it did detect such a problem. + + This fix is effective only if the data-quoting function, the server, and any intermediate processing agree on the character encoding that's being used. Applications that insert untrusted input into SQL commands should take special care to ensure that that's true. + + Applications and drivers that quote untrusted input without using these libpq functions may be at risk of similar problems. They should first confirm the data is valid in the encoding expected by the server. + + The PostgreSQL Project thanks Stephen Fewer for reporting this problem. (CVE-2025-1094) +* Exclude parallel workers from connection privilege checks and limits (Tom Lane) [§](https://postgr.es/c/70d067cec) + + Do not check `datallowconn`, `rolcanlogin`, and `ACL_CONNECT` privileges when starting a parallel worker, instead assuming that it's enough for the leader process to have passed similar checks originally. This avoids, for example, unexpected failures of parallelized queries when the leader is running as a role that lacks login privilege. In the same vein, enforce `ReservedConnections`, `datconnlimit`, and `rolconnlimit` limits only against regular backends, and count only regular backends while checking if the limits were already reached. Those limits are meant to prevent excessive consumption of process slots for regular backends --- but parallel workers and other special processes have their own pools of process slots with their own limit checks. +* Keep `TransactionXmin` in sync with `MyProc->xmin` (Heikki Linnakangas) [§](https://postgr.es/c/9c1afd344) + + This oversight could permit a process to try to access data that had already been vacuumed away. One known consequence is transient “could not access status of transaction” errors. +* Fix race condition that could cause failure to add a newly-inserted catalog entry to a catalog cache list (Heikki Linnakangas) [§](https://postgr.es/c/f217c4105) + + This could result, for example, in failure to use a newly-created function within an existing session. +* Prevent possible catalog corruption when a system catalog is vacuumed concurrently with an update (Noah Misch) [§](https://postgr.es/c/8bfd2ceba) +* Fix data corruption when relation truncation fails (Thomas Munro) [§](https://postgr.es/c/228091216) [§](https://postgr.es/c/a1d17a894) [§](https://postgr.es/c/417d41c65) + + The filesystem calls needed to perform relation truncation could fail, leaving inconsistent state on disk (for example, effectively reviving deleted data). We can't really prevent that, but we can recover by dint of making such failures into PANICs, so that consistency is restored by replaying from WAL up to just before the attempted truncation. This isn't a hugely desirable behavior, but such failures are rare enough that it seems an acceptable solution. +* Prevent checkpoints from starting during relation truncation (Robert Haas) [§](https://postgr.es/c/1168acbca) + + This avoids a race condition wherein the modified file might not get fsync'd before completing the checkpoint, creating a risk of data corruption if the operating system crashes soon after. +* Use `rename()` not `link()`/`unlink()` to rename files (Nathan Bossart) [§](https://postgr.es/c/26a79cbbd) + + The previous coding was intended to assure that the operation could not accidentally overwrite an existing file. However a failure could leave two links to the same file in existence, confusing subsequent operations and creating a risk of data corruption. In practice we do not use this functionality in places where the target filename could already exist, so it seems better to give up the no-overwrite guarantee to remove the multiple-link hazard. +* Avoid possibly losing an update of `pg_database`.`datfrozenxid` when `VACUUM` runs concurrently with a `REASSIGN OWNED` that changes that database's owner (Kirill Reshke) [§](https://postgr.es/c/102546322) +* Fix incorrect `tg_updatedcols` values passed to `AFTER UPDATE` triggers (Tom Lane) [§](https://postgr.es/c/001c09d8b) + + In some cases the `tg_updatedcols` bitmap could describe the set of columns updated by an earlier command in the same transaction, fooling the trigger into doing the wrong thing. + + Also, prevent memory bloat caused by making too many copies of the `tg_updatedcols` bitmap. +* Fix mis-processing of `to_timestamp`'s `FFn` format codes (Tom Lane) [§](https://postgr.es/c/f2eba400b) + + An integer format code immediately preceding `FFn` would consume all available digits, leaving none for `FFn`. +* When deparsing an `XMLTABLE()` expression, ensure that XML namespace names are double-quoted when necessary (Dean Rasheed) [§](https://postgr.es/c/8f137f038) +* Include the `ldapscheme` option in `pg_hba_file_rules()` output (Laurenz Albe) [§](https://postgr.es/c/84b8f6d9f) [§](https://postgr.es/c/7b1f50d8c) +* Don't merge `UNION` operations if their column collations aren't consistent (Tom Lane) [§](https://postgr.es/c/6b66dba3f) + + Previously we ignored collations when deciding if it's safe to merge `UNION` steps into a single N-way `UNION` operation. This was arguably valid before the introduction of nondeterministic collations, but it's not anymore, since the collation in use can affect the definition of uniqueness. +* Fix missed expression processing for partition pruning steps (Tom Lane) [§](https://postgr.es/c/45004f527) + + This oversight could lead to “unrecognized node type” errors, and perhaps other problems, in queries accessing partitioned tables. +* Allow dshash tables to grow past 1GB (Matthias van de Meent) [§](https://postgr.es/c/853cef097) + + This avoids errors like “invalid DSA memory alloc request size”. The case can occur for example in transactions that process several million tables. +* Avoid possible integer overflow in `bringetbitmap()` (James Hunter, Evgeniy Gorbanyov) [§](https://postgr.es/c/332023e2d) + + Since the result is only used for statistical purposes, the effects of this error were mostly cosmetic. +* Prevent streaming standby servers from looping infinitely when reading a WAL record that crosses pages (Kyotaro Horiguchi, Alexander Kukushkin) [§](https://postgr.es/c/0f0431e91) + + This would happen when the record's continuation is on a page that needs to be read from a different WAL source. +* Fix unintended promotion of FATAL errors to PANIC during early process startup (Noah Misch) [§](https://postgr.es/c/6151769f6) + + This fixes some unlikely cases that would result in “PANIC: proc\_exit() called in child process”. +* Fix cases where an operator family member operator or support procedure could become a dangling reference (Tom Lane) [§](https://postgr.es/c/725d98102) [§](https://postgr.es/c/531cbd8b7) + + In some cases a data type could be dropped while references to its OID still remain in `pg_amop` or `pg_amproc`. While that caused no immediate issues, an attempt to drop the owning operator family would fail, and pg\_dump would produce bogus output when dumping the operator family. This fix causes creation and modification of operator families/classes to add needed dependency entries so that dropping a data type will also drop any dependent operator family elements. That does not help vulnerable pre-existing operator families, though, so a band-aid has also been added to `DROP OPERATOR FAMILY` to prevent failure when dropping a family that has dangling members. +* Fix multiple memory leaks in logical decoding output (Vignesh C, Masahiko Sawada, Boyu Yang) [§](https://postgr.es/c/a786cf04d) [§](https://postgr.es/c/ba230ce40) +* Avoid low-probability crash on out-of-memory, due to missing check for failure return from `malloc()` (Karina Litskevich) [§](https://postgr.es/c/cd1c8b992) +* Avoid integer overflow while testing `wal_skip_threshold` condition (Tom Lane) [§](https://postgr.es/c/49a38238e) + + A transaction that created a very large relation could mistakenly decide to ensure durability by copying the relation into WAL instead of fsync'ing it, thereby negating the point of `wal_skip_threshold`. (This only matters when `wal_level` is set to `minimal`, else a WAL copy is required anyway.) +* Fix unsafe order of operations during cache lookups (Noah Misch) [§](https://postgr.es/c/01745fb04) + + The only known consequence was a usually-harmless “you don't own a lock of type ExclusiveLock” warning during `GRANT TABLESPACE`. +* Fix possible “failed to resolve name” failures when using JIT on older ARM platforms (Thomas Munro) [§](https://postgr.es/c/8aefd8b6f) + + This could occur as a consequence of inconsistency about the default setting of `-moutline-atomics` between gcc and clang. At least Debian and Ubuntu are known to ship gcc and clang compilers that target armv8-a but differ on the use of outline atomics by default. +* Fix handling of Windows junction points that are not of PostgreSQL origin (Thomas Munro) [§](https://postgr.es/c/2c4a532c9) [§](https://postgr.es/c/fbf8efbda) + + Previously, initdb would fail if the path to the data directory included junction points whose expansion isn't in “drive absolute” format, or whose expansion points to another junction point. +* Fix assertion failure in `WITH RECURSIVE ... UNION` queries (David Rowley) [§](https://postgr.es/c/2c7887c9d) +* Avoid assertion failure in rule deparsing if a set operation leaf query contains set operations (Man Zeng, Tom Lane) [§](https://postgr.es/c/630520c22) +* Avoid edge-case assertion failure in parallel query startup (Tom Lane) [§](https://postgr.es/c/4d20bad5e) +* Avoid rare assertion failure during relation truncation (Heikki Linnakangas) [§](https://postgr.es/c/a722252ef) +* In `NULLIF()`, avoid passing a read-write expanded object pointer to the data type's equality function (Tom Lane) [§](https://postgr.es/c/48a6cd1ae) + + The equality function could modify or delete the object if it's given a read-write pointer, which would be bad if we decide to return it as the `NULLIF()` result. There is probably no problem with any built-in equality function, but it's easy to demonstrate a failure with one coded in PL/pgSQL. +* Repair memory leaks in PL/Python (Mat Arye, Tom Lane) [§](https://postgr.es/c/02a38bc84) + + Repeated use of `PLyPlan.execute` or `plpy.cursor` resulted in memory leakage for the duration of the calling PL/Python function. +* Fix PL/Tcl to compile with Tcl 9 (Peter Eisentraut) [§](https://postgr.es/c/f230e27a2) +* In the ecpg preprocessor, fix possible misprocessing of cursors that reference out-of-scope variables (Tom Lane) [§](https://postgr.es/c/e359cbb84) +* In ecpg, fix compile-time warnings about unsupported use of `COPY ... FROM STDIN` (Ryo Kanbayashi) [§](https://postgr.es/c/226c9048d) + + Previously, the intended warning was not issued due to a typo. +* Fix psql to safely handle file path names that are encoded in SJIS (Tom Lane) [§](https://postgr.es/c/98df8bace) + + Some two-byte characters in SJIS have a second byte that is equal to ASCII backslash (`\`). These characters were corrupted by path name normalization, preventing access to files whose names include such characters. +* Fix use of wrong version of `pqsignal()` in pgbench and psql (Fujii Masao, Tom Lane) [§](https://postgr.es/c/cfd7aadeb) + + This error could lead to misbehavior when using the `-T` option in pgbench or the `\watch` command in psql, due to interrupted system calls not being resumed as expected. +* Fix misexecution of some nested `\if` constructs in pgbench (Michail Nikolaev) [§](https://postgr.es/c/ec0dc2c59) + + An `\if` command appearing within a false (not-being-executed) `\if` branch was incorrectly treated the same as `\elif`. +* In pgbench, fix possible misdisplay of progress messages during table initialization (Yushi Ogiwara, Tatsuo Ishii, Fujii Masao) [§](https://postgr.es/c/f1cb5e51f) [§](https://postgr.es/c/b6decfc1d) +* Make pg\_controldata more robust against corrupted `pg_control` files (Ilyasov Ian, Anton Voloshin) [§](https://postgr.es/c/c24311c1f) + + Since pg\_controldata will attempt to print the contents of `pg_control` even if the CRC check fails, it must take care not to misbehave for invalid field values. This patch fixes some issues triggered by invalid timestamps and apparently-negative WAL segment sizes. +* Fix possible crash in pg\_dump with identity sequences attached to tables that are extension members (Tom Lane) [§](https://postgr.es/c/b6df2d6e5) +* Fix pg\_basebackup to correctly handle `pg_wal.tar` files exceeding 2GB on Windows (Davinder Singh, Thomas Munro) [§](https://postgr.es/c/bd0564f61) [§](https://postgr.es/c/d02486cc8) +* Update configuration probes that determine the compiler switches needed to access ARM CRC instructions (Tom Lane) [§](https://postgr.es/c/32057a0f7) + + On ARM platforms where the baseline CPU target lacks CRC instructions, we need to supply a `-march` switch to persuade the compiler to compile such instructions. Recent versions of gcc reject the value we were trying, leading to silently falling back to software CRC. +* During configure, if a C23 compiler is detected, try asking for C17 (Thomas Munro) [§](https://postgr.es/c/59ea17c43) + + PostgreSQL versions before v16 will not compile under C23 rules. If the chosen compiler defaults to C23 or later, try adding a `-std=gnu17` switch to change that. (If this won't work for your compiler, manually specify `CFLAGS` with a suitable switch.) +* Update time zone data files to tzdata release 2025a for DST law changes in Paraguay, plus historical corrections for the Philippines (Tom Lane) [§](https://postgr.es/c/6397819c8) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-20.html "E.4. Release 13.20") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-18.html "E.6. Release 13.18") | +| E.4. Release 13.20 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.6. Release 13.18 | + +[Previous](/docs/release/13.18/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.20/) diff --git a/corpus/changelog/postgresql_releases/postgresql_132.md b/corpus/changelog/postgresql_releases/postgresql_132.md new file mode 100644 index 0000000000000000000000000000000000000000..94bc44456dbe3383028172a6a03c8eebc0d35d2b --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_132.md @@ -0,0 +1,252 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.2/ +Version: 13.2 + +## PostgreSQL 13.2 + +| E.22. Release 13.2 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-3.html "E.21. Release 13.3") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-1.html "E.23. Release 13.1") | + +--- + +## E.22. Release 13.2 + +[E.22.1. Migration to Version 13.2](release-13-2.html#id-1.11.6.27.4) + +[E.22.2. Changes](release-13-2.html#id-1.11.6.27.5) + +**Release date:**2021-02-11 + +This release contains a variety of fixes from 13.1. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +### E.22.1. Migration to Version 13.2 + +A dump/restore is not required for those running 13.X. + +However, see the first changelog item below concerning a possible need to update stored views. Also see the third and fourth changelog items, which describe cases in which reindexing indexes after the upgrade may be advisable. + +### E.22.2. Changes + +* Fix failure to check per-column `SELECT` privileges in some join queries (Tom Lane) [§](https://postgr.es/c/d525fbcfd) + + In some cases involving joins, the parser failed to record all the columns read by a query in the column-usage bitmaps that are used for permissions checking. Although the executor would still insist on some sort of `SELECT` privilege to run the query, this meant that a user having `SELECT` privilege on only one column of a table could nonetheless read all its columns through a suitably crafted query. + + A stored view that is subject to this problem will have incomplete column-usage bitmaps, and thus permissions will still not be enforced properly on the view after updating. In installations that depend on column-level permissions for security, it is recommended to `CREATE OR REPLACE` all user-defined views to cause them to be re-parsed. + + The PostgreSQL Project thanks Sven Klemm for reporting this problem. (CVE-2021-20229) +* Fix information leakage in constraint-violation error messages (Heikki Linnakangas) [§](https://postgr.es/c/8e56684d5) + + If an `UPDATE` command attempts to move a row to a different partition but finds that it violates some constraint on the new partition, and the columns in that partition are in different physical positions than in the parent table, the error message could reveal the contents of columns that the user does not have `SELECT` privilege on. (CVE-2021-3393) +* Fix incorrect detection of concurrent page splits while inserting into a GiST index (Heikki Linnakangas) [§](https://postgr.es/c/b8403d140) + + Concurrent insertions could lead to a corrupt index with entries placed in the wrong pages. It's recommended to reindex any GiST index that's been subject to concurrent insertions. +* Fix `CREATE INDEX CONCURRENTLY` to wait for concurrent prepared transactions (Andrey Borodin) [§](https://postgr.es/c/86a5b309c) + + At the point where `CREATE INDEX CONCURRENTLY` waits for all concurrent transactions to complete so that it can see rows they inserted, it must also wait for all prepared transactions to complete, for the same reason. Its failure to do so meant that rows inserted by prepared transactions might be omitted from the new index, causing queries relying on the index to miss such rows. In installations that have enabled prepared transactions (`max_prepared_transactions` > 0), it's recommended to reindex any concurrently-built indexes in case this problem occurred when they were built. +* Avoid crash when trying to rescan an aggregation plan node that has both hashed and sorted grouping sets (Jeff Davis) [§](https://postgr.es/c/7b8692eaf) [§](https://postgr.es/c/6669cc769) [§](https://postgr.es/c/cd7d8cde7) +* Fix possible incorrect query results when a hash aggregation node spills some tuples to disk (Tom Lane) [§](https://postgr.es/c/6467661b6) + + It was possible for aggregation grouping values to be replaced by nulls when the tuples are read back in, leading to wrong answers. +* Fix edge case in incremental sort (Neil Chen) [§](https://postgr.es/c/10fcb83da) + + If the last tuple of a sort batch chanced to be the first tuple of the next group of already-sorted tuples, the code did the wrong thing. This could lead to “retrieved too many tuples in a bounded sort” error messages, or to silently-wrong sorting results. +* Avoid crash when a `CALL` or `DO` statement that performs a transaction rollback is executed via extended query protocol (Thomas Munro, Tom Lane) [§](https://postgr.es/c/57868d957) + + In PostgreSQL 13, this case reliably caused a null-pointer dereference. In earlier versions the bug seems to have no visible symptoms, but it's not quite clear that it could never cause a problem. +* Avoid unnecessary errors with `BEFORE UPDATE` triggers on partitioned tables (Álvaro Herrera) [§](https://postgr.es/c/16f69062e) + + A `BEFORE UPDATE FOR EACH ROW` trigger that modified the row in any way prevented `UPDATE` from moving the row to another partition when needed; but there is no longer any reason for this restriction. +* Fix partition pruning logic to handle asymmetric hash partition sets (Tom Lane) [§](https://postgr.es/c/7f1921cb9) + + If a hash-partitioned table has unequally-sized partitions (that is, varying modulus values), or it lacks partitions for some remainder values, then the planner's pruning logic could mistakenly conclude that some partitions don't need to be scanned, leading to failure to find rows that the query should find. +* Avoid incorrect results when `WHERE CURRENT OF` is applied to a cursor whose plan contains a MergeAppend node (Tom Lane) [§](https://postgr.es/c/188cd4f44) + + This case is unsupported (in general, a cursor using `ORDER BY` is not guaranteed to be simply updatable); but the code previously did not reject it, and could silently give false matches. +* Fix crash when `WHERE CURRENT OF` is applied to a cursor whose plan contains a custom scan node (David Geier) [§](https://postgr.es/c/f0f53195b) +* Fix planner's mishandling of placeholders whose evaluation should be delayed by an outer join (Tom Lane) [§](https://postgr.es/c/73fc2e5ba) + + This occurs in particular with trivial subqueries containing lateral references to outer-join outputs. The mistake could result in a malformed plan. The known cases trigger a “failed to assign all NestLoopParams to plan nodes” error, but other symptoms may be possible. +* Fix planner's handling of placeholders during removal of useless RESULT RTEs (Tom Lane) [§](https://postgr.es/c/7d43b76f6) + + This oversight could lead to “no relation entry for relid *`N`*” planner errors. +* Fix planner's handling of a placeholder that is computed at some join level and used only at that same level (Tom Lane) [§](https://postgr.es/c/666a4de93) + + This oversight could lead to “failed to build any *`N`*-way joins” planner errors. +* Consider unsorted subpaths when planning a Gather Merge operation (James Coleman) [§](https://postgr.es/c/ea190ed14) + + It's possible to use such a path by adding an explicit Sort node, and in some cases that gives rise to a superior plan. +* Do not consider `ORDER BY` expressions involving parallel-restricted functions or set-returning functions when trying to parallelize sorts (James Coleman) [§](https://postgr.es/c/be9c3cd18) [§](https://postgr.es/c/d0167631e) + + Such cases cannot safely be pushed into worker processes, but the incremental sort feature accidentally made us consider them. +* Be more careful about whether index AMs support mark/restore (Andrew Gierth) [§](https://postgr.es/c/6dda05704) + + This prevents errors about missing support functions in rare edge cases. +* Fix overestimate of the amount of shared memory needed for parallel queries (Takayuki Tsunakawa) [§](https://postgr.es/c/60369db86) +* Fix `ALTER DEFAULT PRIVILEGES` to handle duplicated arguments safely (Michael Paquier) [§](https://postgr.es/c/31e0f9d76) + + Duplicate role or schema names within the same command could lead to “tuple already updated by self” errors or unique-constraint violations. +* Flush ACL-related caches when `pg_authid` changes (Noah Misch) [§](https://postgr.es/c/9f8a48bb2) + + This change ensures that permissions-related decisions will promptly reflect the results of `ALTER ROLE ... [NO] INHERIT`. +* Fix failure to detect “snapshot too old” conditions in tables rewritten in the current transaction (Kyotaro Horiguchi, Noah Misch) [§](https://postgr.es/c/d798ea750) + + This is only a hazard when `wal_level` is set to `minimal` and the rewrite is performed by `ALTER TABLE SET TABLESPACE`. +* Fix spurious failure of `CREATE PUBLICATION` when applied to a table created or rewritten in the current transaction (Kyotaro Horiguchi) [§](https://postgr.es/c/e8e3e6749) + + This is only a hazard when `wal_level` is set to `minimal`. +* Prevent misprocessing of ambiguous `CREATE TABLE LIKE` clauses (Tom Lane) [§](https://postgr.es/c/dffc82a5b) + + A `LIKE` clause is re-examined after initial creation of the new table, to handle importation of indexes and such. It was possible for this re-examination to find a different table of the same name, causing unexpected behavior; one example is where the new table is a temporary table of the same name as the `LIKE` target. +* Rearrange order of operations in `CREATE TABLE LIKE` so that indexes are cloned before building foreign key constraints (Tom Lane) [§](https://postgr.es/c/98f3f1d5c) + + This fixes the case where a self-referential foreign key constraint declared in the outer `CREATE TABLE` depends on an index that's coming from the `LIKE` clause. +* Disallow `CREATE STATISTICS` on system catalogs (Tomas Vondra) [§](https://postgr.es/c/d26d4c717) +* Disallow converting an inheritance child table to a view (Tom Lane) [§](https://postgr.es/c/4353bc878) +* Ensure that disk space allocated for a dropped relation is released promptly at commit (Thomas Munro) [§](https://postgr.es/c/fd3a75d82) + + Previously, if the dropped relation spanned multiple 1GB segments, only the first segment was truncated immediately. Other segments were simply unlinked, which doesn't authorize the kernel to release the storage so long as any other backends still have the files open. +* Prevent dropping a tablespace that is referenced by a partitioned relation, but is not used for any actual storage (Álvaro Herrera) [§](https://postgr.es/c/5b01a6f13) + + Previously this was allowed, but subsequent operations on the partitioned relation would fail. +* Fix progress reporting for `CLUSTER` (Matthias van de Meent) [§](https://postgr.es/c/dcc20946a) +* Fix handling of backslash-escaped multibyte characters in `COPY FROM` (Heikki Linnakangas) [§](https://postgr.es/c/c87cbd51e) + + A backslash followed by a multibyte character was not handled correctly. In some client character encodings, this could lead to misinterpreting part of a multibyte character as a field separator or end-of-copy-data marker. +* Avoid preallocating executor hash tables in `EXPLAIN` without `ANALYZE` (Alexey Bashtanov) [§](https://postgr.es/c/340ae3cfb) +* Fix recently-introduced race condition in `LISTEN`/`NOTIFY` queue handling (Tom Lane) [§](https://postgr.es/c/f5de090cc) + + A newly-listening backend could attempt to read SLRU pages that were in process of being truncated, possibly causing an error. +* Allow the `jsonb` concatenation operator to handle all combinations of JSON data types (Tom Lane) [§](https://postgr.es/c/38d30a14b) + + We can concatenate two JSON objects or two JSON arrays. Handle other cases by wrapping non-array inputs in one-element arrays, then performing an array concatenation. Previously, some combinations of inputs followed this rule but others arbitrarily threw an error. +* Fix use of uninitialized value while parsing a `*` quantifier in a BRE-mode regular expression (Tom Lane) [§](https://postgr.es/c/49c928c0c) + + This error could cause the quantifier to act non-greedy, that is behave like a `*?` quantifier would do in full regular expressions. +* Fix numeric `power()` for the case where the exponent is exactly `INT_MIN` (-2147483648) (Dean Rasheed) [§](https://postgr.es/c/e15c384d7) [§](https://postgr.es/c/5777b6ea2) + + Previously, a result with no significant digits was produced. +* Fix integer-overflow cases in `substring()` functions (Tom Lane, Pavel Stehule) [§](https://postgr.es/c/9e7d87ca8) + + If the specified starting index and length overflow an integer when added together, `substring()` misbehaved, either throwing a bogus “negative substring length” error for a case that should succeed, or failing to complain that a negative length is negative (and instead returning the whole string, in most cases). +* Prevent possible data loss from incorrect detection of the wraparound point of an SLRU log (Noah Misch) [§](https://postgr.es/c/6eb3fc7fc) + + The wraparound point typically falls in the middle of a page, which must be rounded off to a page boundary, and that was not done correctly. No issue could arise unless an installation had gotten to within one page of SLRU overflow, which is unlikely in a properly-functioning system. If this did happen, it would manifest in later “apparent wraparound” or “could not access status of transaction” errors. +* Fix WAL-reading logic to handle timeline switches correctly (Kyotaro Horiguchi, Fujii Masao) [§](https://postgr.es/c/94f52929a) [§](https://postgr.es/c/8523a0971) + + Previously, if WAL archiving is enabled, a standby could fail to follow a primary running on a newer timeline, with errors like “requested WAL segment has already been removed”. +* Fix memory leak in walsender processes while sending new snapshots for logical decoding (Amit Kapila) [§](https://postgr.es/c/0685c5c1b) +* Fix relation cache leak in walsender processes while sending row changes via the root of a partitioned relation during logical replication (Amit Langote, Mark Zhao) [§](https://postgr.es/c/decf3fe61) +* Fix walsender to accept additional commands after terminating replication (Jeff Davis) [§](https://postgr.es/c/fde5f130c) +* Ensure detection of deadlocks between hot standby backends and the startup (WAL-application) process (Fujii Masao) [§](https://postgr.es/c/0f8977b3f) + + The startup process did not run the deadlock detection code, so that in situations where the startup process is last to join a circular wait situation, the deadlock might never be recognized. +* Fix possible failure to detect recovery conflicts while deleting an index entry that references a HOT chain (Peter Geoghegan) [§](https://postgr.es/c/7a57960ba) [§](https://postgr.es/c/55e535226) + + The code failed to traverse the HOT chain and might thus compute a too-old XID horizon, which could lead to incorrect conflict processing in hot standby. The practical impact of this bug is limited; in most cases the correct XID horizon would be found anyway from nearby operations. +* Ensure that a nonempty value of `krb_server_keyfile` always overrides any setting of `KRB5_KTNAME` in the server's environment (Tom Lane) [§](https://postgr.es/c/861e96717) + + Previously, which setting took precedence depended on whether the client requests GSS encryption. +* In server log messages about failing to match connections to `pg_hba.conf` entries, include details about whether GSS encryption has been activated (Kyotaro Horiguchi, Tom Lane) [§](https://postgr.es/c/d05e14d78) + + This is relevant data if `hostgssenc` or `hostnogssenc` entries exist. +* Fix assorted issues in server's support for GSS encryption (Tom Lane) [§](https://postgr.es/c/c1c88bf03) + + Remove pointless restriction that only GSS authentication can be used on a GSS-encrypted connection. Add GSS encryption information to connection-authorized log messages. Include GSS-related space when computing the required size of shared memory (this omission could have caused problems with very high `max_connections` settings). Avoid possible infinite recursion when reporting an unrecoverable GSS encryption error. +* Ensure that unserviced requests for background workers are cleaned up when the postmaster begins a “smart” or “fast” shutdown sequence (Tom Lane) [§](https://postgr.es/c/0217ad806) + + Previously, there was a race condition whereby a child process that had requested a background worker just before shutdown could wait indefinitely, preventing shutdown from completing. +* Fix portability problem in parsing of `recovery_target_xid` values (Michael Paquier) [§](https://postgr.es/c/1e54664ee) + + The target XID is potentially 64 bits wide, but it was parsed with `strtoul()`, causing misbehavior on platforms where `long` is 32 bits (such as Windows). +* Avoid trying to use parallel index build in a standalone backend (Yulin Pei) [§](https://postgr.es/c/fac31b2cd) +* Allow index AMs to support included columns without necessarily supporting multiple key columns (Tom Lane) [§](https://postgr.es/c/7c89246d0) +* While taking a base backup, avoid executing any SHA256 code if a backup manifest is not needed (Michael Paquier) [§](https://postgr.es/c/9a94b9253) + + When using OpenSSL operating in FIPS mode, SHA256 hashing is rejected, leading to an error. This change makes it possible to take a base backup on such a platform, so long as `--no-manifest` is specified. +* Avoid assertion failure during parallel aggregation of an aggregate with a non-strict deserialization function (Andrew Gierth) [§](https://postgr.es/c/75e3cca42) + + No such aggregate functions exist in core PostgreSQL, but some extensions such as PostGIS provide some. The mistake is harmless anyway in a non-assert build. +* Avoid assertion failure in `pg_get_functiondef()` when examining a function with a `TRANSFORM` option (Tom Lane) [§](https://postgr.es/c/a26194f22) +* Fix data structure misallocation in PL/pgSQL's `CALL` statement (Tom Lane) [§](https://postgr.es/c/0ea25ed10) [§](https://postgr.es/c/63d78d106) + + A `CALL` in a PL/pgSQL procedure, to another procedure that has OUT parameters, would fail if the called procedure did a `COMMIT` or `ROLLBACK`. +* In libpq, do not skip trying SSL after GSS encryption (Tom Lane) [§](https://postgr.es/c/06b844c2b) + + If we successfully made a GSS-encrypted connection, but then failed during authentication, we would fall back to an unencrypted connection rather than next trying an SSL-encrypted connection. This could lead to unexpected connection failure, or to silently getting an unencrypted connection where an encrypted one is expected. Fortunately, GSS encryption could only succeed if both client and server hold valid tickets in the same Kerberos infrastructure. It seems unlikely for that to be true in an environment that requires SSL encryption instead. +* Make libpq's `PQconndefaults()` function report the correct default value for `channel_binding` (Daniele Varrazzo) [§](https://postgr.es/c/31d2b11b9) +* In psql, re-allow including a password in a *`connection_string`* argument of a `\connect` command (Tom Lane) [§](https://postgr.es/c/72b930f50) + + This used to work, but a recent bug fix caused the password to be ignored (resulting in prompting for a password). +* In psql's `\d` commands, don't truncate the display of column default values (Tom Lane) [§](https://postgr.es/c/a0ef08172) + + Formerly, they were arbitrarily truncated at 128 characters. +* Fix assorted bugs in psql's `\help` command (Kyotaro Horiguchi, Tom Lane) [§](https://postgr.es/c/64bdb6e5f) + + `\help` with two argument words failed to find a command description using only the first word, for example `\help reset all` should show the help for `RESET` but did not. Also, `\help` often failed to invoke the pager when it should. It also leaked memory. +* Fix pg\_dump's dumping of inherited generated columns (Peter Eisentraut) [§](https://postgr.es/c/1d3ce0223) + + The previous behavior resulted in (harmless) errors during restore. +* In pg\_dump, ensure that the restore script runs `ALTER PUBLICATION ADD TABLE` commands as the owner of the publication, and similarly runs `ALTER INDEX ATTACH PARTITION` commands as the owner of the partitioned index (Tom Lane) [§](https://postgr.es/c/0011c5a0f) [§](https://postgr.es/c/79d3ac72f) + + Previously, these commands would be run by the role that started the restore script; which will usually work, but in corner cases that role might not have adequate permissions. +* Fix pg\_dump to handle `WITH GRANT OPTION` in an extension's initial privileges (Noah Misch) [§](https://postgr.es/c/b8daf894f) + + If an extension's script creates an object and grants privileges on it with grant option, then later the user revokes such privileges, pg\_dump would generate incorrect SQL for reproducing the situation. (Few if any extensions do this today.) +* In pg\_rewind, ensure that all WAL is accounted for when rewinding a standby server (Ian Barwick, Heikki Linnakangas) [§](https://postgr.es/c/abd0abfb7) [§](https://postgr.es/c/e41a2efbc) [§](https://postgr.es/c/e6dc04d43) +* In pgbench, disallow a digit as the first character of a variable name (Fabien Coelho) [§](https://postgr.es/c/6b045ca6c) + + This prevents trying to substitute variables into timestamp literal values, which may contain strings like `12:34`. +* Report the correct database name in connection failure error messages from some client programs (Álvaro Herrera) [§](https://postgr.es/c/f17e8f33f) + + If the database name was defaulted rather than given on the command line, pg\_dumpall, pgbench, oid2name, and vacuumlo would produce misleading error messages after a connection failure. +* Fix memory leak in `contrib/auto_explain` (Japin Li) [§](https://postgr.es/c/586891394) + + Memory consumed while producing the `EXPLAIN` output was not freed until the end of the current transaction (for a top-level statement) or the end of the surrounding statement (for a nested statement). This was particularly a problem with `log_nested_statements` enabled. +* In `contrib/postgres_fdw`, avoid leaking open connections to remote servers when a user mapping or foreign server object is dropped (Bharath Rupireddy) [§](https://postgr.es/c/546f14374) + + Open connections that depend on a dropped user mapping or foreign server can no longer be referenced, but formerly they were kept around anyway for the duration of the local session. +* Fix faulty assertion in `contrib/postgres_fdw` (Etsuro Fujita) [§](https://postgr.es/c/984384129) +* In `contrib/pgcrypto`, check for error returns from OpenSSL's EVP functions (Michael Paquier) [§](https://postgr.es/c/dfd8bf2b9) + + We do not really expect errors here, but this change silences warnings from static analysis tools. +* Make `contrib/pg_prewarm` more robust when the cluster is shut down before prewarming is complete (Tom Lane) [§](https://postgr.es/c/4b0292253) + + Previously, autoprewarm would rewrite its status file with only the block numbers that it had managed to load so far, thus perhaps largely disabling the prewarm functionality in the next startup. Instead, suppress status file updates until the initial loading pass is complete. +* In `contrib/pg_trgm`'s GiST index support, avoid crash in the rare case that picksplit is called on exactly two index items (Andrew Gierth, Alexander Korotkov) [§](https://postgr.es/c/48ab1fa30) +* Fix miscalculation of timeouts in `contrib/pg_prewarm` and `contrib/postgres_fdw` (Alexey Kondratov, Tom Lane) [§](https://postgr.es/c/afce7908d) + + The main loop in `contrib/pg_prewarm`'s autoprewarm parent process underestimated its desired sleep time by a factor of 1000, causing it to consume much more CPU than intended. When waiting for a result from a remote server, `contrib/postgres_fdw` overestimated the desired timeout by a factor of 1000 (though this error had been mitigated by imposing a clamp to 60 seconds). + + Both of these errors stemmed from incorrectly converting seconds-and-microseconds to milliseconds. Introduce a new API `TimestampDifferenceMilliseconds()` to make it easier to get this right in the future. +* Improve configure's heuristics for selecting `PG_SYSROOT` on macOS (Tom Lane) [§](https://postgr.es/c/f44ae4db5) [§](https://postgr.es/c/6671e8194) + + The new method is more likely to produce desirable results when Xcode is newer than the underlying operating system. Choosing a sysroot that does not match the OS version may result in nonfunctional executables. +* While building on macOS, specify `-isysroot` in link steps as well as compile steps (James Hilliard) [§](https://postgr.es/c/9e9a31bd0) + + This likewise improves the results when Xcode is out of sync with the operating system. +* Fix JIT compilation to be compatible with LLVM 11 and LLVM 12 (Andres Freund) [§](https://postgr.es/c/4f64daf73) [§](https://postgr.es/c/6a192c77d) +* Fix potential mishandling of references to boolean variables in JIT expression compilation (Andres Freund) [§](https://postgr.es/c/01c6370a3) + + No field reports attributable to this have been seen, but it seems likely that it could cause problems on some architectures. +* Fix compile failure with ICU 68 and later (Tom Lane) [§](https://postgr.es/c/53c7b4f62) +* Avoid `memcpy()` with a NULL source pointer and zero count during partitioned index creation (Álvaro Herrera) [§](https://postgr.es/c/5a1d1b954) + + While such a call is not known to cause problems in itself, some compilers assume that the arguments of `memcpy()` are never NULL, which could result in incorrect optimization of nearby code. +* Update time zone data files to tzdata release 2021a for DST law changes in Russia (Volgograd zone) and South Sudan, plus historical corrections for Australia, Bahamas, Belize, Bermuda, Ghana, Israel, Kenya, Nigeria, Palestine, Seychelles, and Vanuatu. (Tom Lane) [§](https://postgr.es/c/58a545344) + + Notably, the Australia/Currie zone has been corrected to the point where it is identical to Australia/Hobart. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-3.html "E.21. Release 13.3") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-1.html "E.23. Release 13.1") | +| E.21. Release 13.3 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.23. Release 13.1 | + +[Previous](/docs/release/13.1/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.3/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1320.md b/corpus/changelog/postgresql_releases/postgresql_1320.md new file mode 100644 index 0000000000000000000000000000000000000000..59299c7f33e5ecf8a8ee3d41e80ba232a2b20be3 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1320.md @@ -0,0 +1,54 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.20/ +Version: 13.20 + +## PostgreSQL 13.20 + +| E.4. Release 13.20 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-21.html "E.3. Release 13.21") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-19.html "E.5. Release 13.19") | + +--- + +## E.4. Release 13.20 + +[E.4.1. Migration to Version 13.20](release-13-20.html#id-1.11.6.9.5) + +[E.4.2. Changes](release-13-20.html#id-1.11.6.9.6) + +**Release date:**2025-02-20 + +This release contains a few fixes from 13.19. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +The PostgreSQL community will stop releasing updates for the 13.X release series in November 2025. Users are encouraged to update to a newer release branch soon. + +### E.4.1. Migration to Version 13.20 + +A dump/restore is not required for those running 13.X. + +However, if you are upgrading from a version earlier than 13.17, see [Section E.7](release-13-17.html "E.7. Release 13.17"). + +### E.4.2. Changes + +* Improve behavior of libpq's quoting functions (Andres Freund, Tom Lane) [§](https://postgr.es/c/1f7a05324) [§](https://postgr.es/c/d6d29b213) [§](https://postgr.es/c/9f052613e) + + The changes made for CVE-2025-1094 had one serious oversight: `PQescapeLiteral()` and `PQescapeIdentifier()` failed to honor their string length parameter, instead always reading to the input string's trailing null. This resulted in including unwanted text in the output, if the caller intended to truncate the string via the length parameter. With very bad luck it could cause a crash due to reading off the end of memory. + + In addition, modify all these quoting functions so that when invalid encoding is detected, an invalid sequence is substituted for just the first byte of the presumed character, not all of it. This reduces the risk of problems if a calling application performs additional processing on the quoted string. +* Fix crash involving triggers on partitioned tables that make use of transition tables (Kyotaro Horiguchi) [§](https://postgr.es/c/520905824) + + If there are both `AFTER UPDATE` and `AFTER DELETE` triggers, the need for transition tables was determined incorrectly, leading to a crash during cross-partition updates. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-21.html "E.3. Release 13.21") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-19.html "E.5. Release 13.19") | +| E.3. Release 13.21 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.5. Release 13.19 | + +[Previous](/docs/release/13.19/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.21/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1321.md b/corpus/changelog/postgresql_releases/postgresql_1321.md new file mode 100644 index 0000000000000000000000000000000000000000..eeff7eef2a6879532f2019f4cf35e5f6fd9a2739 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1321.md @@ -0,0 +1,112 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.21/ +Version: 13.21 + +## PostgreSQL 13.21 + +| E.3. Release 13.21 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-22.html "E.2. Release 13.22") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-20.html "E.4. Release 13.20") | + +--- + +## E.3. Release 13.21 + +[E.3.1. Migration to Version 13.21](release-13-21.html#id-1.11.6.8.5) + +[E.3.2. Changes](release-13-21.html#id-1.11.6.8.6) + +**Release date:**2025-05-08 + +This release contains a variety of fixes from 13.20. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +The PostgreSQL community will stop releasing updates for the 13.X release series in November 2025. Users are encouraged to update to a newer release branch soon. + +### E.3.1. Migration to Version 13.21 + +A dump/restore is not required for those running 13.X. + +However, if you have any self-referential foreign key constraints on partitioned tables, it may be necessary to recreate those constraints to ensure that they are being enforced correctly. See the second changelog entry below. + +Also, if you are upgrading from a version earlier than 13.17, see [Section E.7](release-13-17.html "E.7. Release 13.17"). + +### E.3.2. Changes + +* Avoid one-byte buffer overread when examining invalidly-encoded strings that are claimed to be in GB18030 encoding (Noah Misch, Andres Freund) [§](https://postgr.es/c/cbadeaca9) [§](https://postgr.es/c/7279e5820) + + While unlikely, a SIGSEGV crash could occur if an incomplete multibyte character appeared at the end of memory. This was possible both in the server and in libpq-using applications. (CVE-2025-4207) +* Handle self-referential foreign keys on partitioned tables correctly (Álvaro Herrera) [§](https://postgr.es/c/b3a9c536d) + + Creating or attaching partitions failed to make the required catalog entries for a foreign-key constraint, if the table referenced by the constraint was the same partitioned table. This resulted in failure to enforce the constraint fully. + + To fix this, you should drop and recreate any self-referential foreign keys on partitioned tables, if partitions have been created or attached since the constraint was created. Bear in mind that violating rows might already be present, in which case recreating the constraint will fail, and you'll need to fix up those rows before trying again. +* Fix unexpected “attribute has wrong type” errors in `UPDATE`, `DELETE`, and `MERGE` queries that use whole-row table references to views or functions in `FROM` (Tom Lane) [§](https://postgr.es/c/39af32f78) [§](https://postgr.es/c/28a7e31d0) [§](https://postgr.es/c/b200180de) +* Correctly process references to outer CTE names that appear within a `WITH` clause attached to an `INSERT`/`UPDATE`/`DELETE`/`MERGE` command that's inside `WITH` (Tom Lane) [§](https://postgr.es/c/e276b5829) + + The parser failed to detect disallowed recursion cases, nor did it account for such references when sorting CTEs into a usable order. +* Fix `ARRAY(subquery)` and `ARRAY[expression, ...]` constructs to produce sane results when the input is of type `int2vector` or `oidvector` (Tom Lane) [§](https://postgr.es/c/474aee3df) + + This patch restores the behavior that existed before PostgreSQL 9.5: the result is of type `int2vector[]` or `oidvector[]`. +* Fix possible erroneous reports of invalid affixes while parsing Ispell dictionaries (Jacob Brazeal) [§](https://postgr.es/c/f1c1bafcd) +* Fix `ALTER TABLE ADD COLUMN` to correctly handle the case of a domain type that has a default (Jian He, Tom Lane, Tender Wang) [§](https://postgr.es/c/aac07b562) [§](https://postgr.es/c/dd34cbfce) + + If a domain type has a default, adding a column of that type (without any explicit `DEFAULT` clause) failed to install the domain's default value in existing rows, instead leaving the new column null. +* Improve the error message for disallowed attempts to alter the properties of a foreign key constraint (Álvaro Herrera) [§](https://postgr.es/c/0f354e080) +* Avoid error when resetting the `relhassubclass` flag of a temporary table that's marked `ON COMMIT DELETE ROWS` (Noah Misch) [§](https://postgr.es/c/d34b671a6) +* Disable “skip fetch” optimization in bitmap heap scan (Matthias van de Meent) [§](https://postgr.es/c/b9ec8125d) + + It turns out that this optimization can result in returning dead tuples when a concurrent vacuum marks a page all-visible. +* Fix performance issues in GIN index search startup when there are many search keys (Tom Lane, Vinod Sridharan) [§](https://postgr.es/c/308d0d443) [§](https://postgr.es/c/c7597a1d3) + + An indexable clause with many keys (for example, `jsonbcol ?| array[...]` with tens of thousands of array elements) took O(N2) time to start up, and was uncancelable for that interval too. +* Detect missing support procedures in a BRIN index operator class, and report an error instead of crashing (Álvaro Herrera) [§](https://postgr.es/c/f5b4a0b49) +* Fix race condition in handling of `synchronous_standby_names` immediately after startup (Melnikov Maksim, Michael Paquier) [§](https://postgr.es/c/e2f42f812) + + For a short period after system startup, backends might fail to wait for synchronous commit even though `synchronous_standby_names` is enabled. +* Fix `pg_strtof()` to not crash with null endptr (Alexander Lakhin, Tom Lane) [§](https://postgr.es/c/ebe919e95) +* Avoid crash when a Snowball stemmer encounters an out-of-memory condition (Maksim Korotkov) [§](https://postgr.es/c/197427fb3) +* Skip WAL recycling and preallocation during archive recovery, to avoid corruption of WAL files that were restored from the archive (Noah Misch, Arun Thirupathi) [§](https://postgr.es/c/69a498eb6) [§](https://postgr.es/c/a5b0c06da) [§](https://postgr.es/c/cbed472a9) [§](https://postgr.es/c/d0b6acaf0) [§](https://postgr.es/c/20e5ef3ca) [§](https://postgr.es/c/df8ec9634) [§](https://postgr.es/c/e77d9cd4f) + + This change back-patches v15-era fixes that were considered largely cosmetic at the time, but turn out to prevent data corruption in the wake of subsequent fixes. +* Prevent over-advancement of catalog xmin in “fast forward” mode of logical decoding (Zhijie Hou) [§](https://postgr.es/c/d65485b02) + + This mistake could allow deleted catalog entries to be vacuumed away even though they were still potentially needed by the WAL-reading process. +* Avoid data loss when DDL operations that don't take a strong lock affect tables that are being logically replicated (Shlok Kyal, Hayato Kuroda) [§](https://postgr.es/c/247ee9415) [§](https://postgr.es/c/4164d6976) + + The catalog changes caused by the DDL command were not reflected into WAL-decoding processes, allowing them to decode subsequent changes using stale catalog data, probably resulting in data corruption. +* Avoid duplicate snapshot creation in logical replication index lookups (Heikki Linnakangas) [§](https://postgr.es/c/9b3914f18) [§](https://postgr.es/c/6c1e79589) +* Fix overly-strict assertion in `gistFindCorrectParent()` (Heikki Linnakangas) [§](https://postgr.es/c/b92482dc3) +* In PL/pgSQL, avoid “unexpected plan node type” error when a scrollable cursor is defined on a simple `SELECT expression` query (Andrei Lepikhov) [§](https://postgr.es/c/0f60e1fba) +* Don't try to drop individual index partitions in pg\_dump's `--clean` mode (Jian He) [§](https://postgr.es/c/6a3e57865) + + The server rejects such `DROP` commands. That has no real consequences, since the partitions will go away anyway in the subsequent `DROP`s of either their parent tables or their partitioned index. However, the error reported for the attempted drop causes problems when restoring in `--single-transaction` mode. +* In pg\_dumpall, avoid emitting invalid role `GRANT` commands if `pg_auth_members` contains invalid role OIDs (Tom Lane) [§](https://postgr.es/c/5302ff95c) + + Instead, print a warning and skip the entry. This copes better with catalog corruption that has been seen to occur in back branches as a result of race conditions between `GRANT` and `DROP ROLE`. +* Allow `contrib/dblink` queries to be interrupted by query cancel (Noah Misch) [§](https://postgr.es/c/186c586c3) [§](https://postgr.es/c/5a3d5c083) + + This change back-patches a v17-era fix. It prevents possible hangs in `CREATE DATABASE` and `DROP DATABASE` due to failure to detect deadlocks. +* Avoid crashing with corrupt input data in `contrib/pageinspect`'s `heap_page_items()` (Dmitry Kovalenko) [§](https://postgr.es/c/3f9132ed2) +* Prevent assertion failure in `contrib/pg_freespacemap`'s `pg_freespacemap()` (Tender Wang) [§](https://postgr.es/c/db8238da4) + + Applying `pg_freespacemap()` to a relation lacking storage (such as a view) caused an assertion failure, although there was no ill effect in non-assert builds. Add an error check to reject that case. +* Fix build failure on macOS 15.4 (Tom Lane, Peter Eisentraut) [§](https://postgr.es/c/e4440a73c) + + This macOS update broke our configuration probe for `strchrnul()`. +* Update time zone data files to tzdata release 2025b for DST law changes in Chile, plus historical corrections for Iran (Tom Lane) [§](https://postgr.es/c/9da548df3) + + There is a new time zone America/Coyhaique for Chile's Aysén Region, to account for it changing to UTC-03 year-round and thus diverging from America/Santiago. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-22.html "E.2. Release 13.22") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-20.html "E.4. Release 13.20") | +| E.2. Release 13.22 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.4. Release 13.20 | + +[Previous](/docs/release/13.20/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.22/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1322.md b/corpus/changelog/postgresql_releases/postgresql_1322.md new file mode 100644 index 0000000000000000000000000000000000000000..e19c3d290e43a17012ca2e03d53778dd214b4d90 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1322.md @@ -0,0 +1,176 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.22/ +Version: 13.22 + +## PostgreSQL 13.22 + +| E.2. Release 13.22 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-23.html "E.1. Release 13.23") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-21.html "E.3. Release 13.21") | + +--- + +## E.2. Release 13.22 + +[E.2.1. Migration to Version 13.22](release-13-22.html#id-1.11.6.7.5) + +[E.2.2. Changes](release-13-22.html#id-1.11.6.7.6) + +**Release date:**2025-08-14 + +This release contains a variety of fixes from 13.21. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +The PostgreSQL community will stop releasing updates for the 13.X release series in November 2025. Users are encouraged to update to a newer release branch soon. + +### E.2.1. Migration to Version 13.22 + +A dump/restore is not required for those running 13.X. + +However, if you are upgrading from a version earlier than 13.21, see [Section E.3](release-13-21.html "E.3. Release 13.21"). + +### E.2.2. Changes + +* Tighten security checks in planner estimation functions (Dean Rasheed) [§](https://postgr.es/c/533211ded) + + The fix for CVE-2017-7484, plus followup fixes, intended to prevent leaky functions from being applied to statistics data for columns that the calling user does not have permission to read. Two gaps in that protection have been found. One gap applies to partitioning and inheritance hierarchies where RLS policies on the tables should restrict access to statistics data, but did not. + + The other gap applies to cases where the query accesses a table via a view, and the view owner has permissions to read the underlying table but the calling user does not have permissions on the view. The view owner's permissions satisfied the security checks, and the leaky function would get applied to the underlying table's statistics before we check the calling user's permissions on the view. This has been fixed by making security checks on views occur at the start of planning. That might cause permissions failures to occur earlier than before. + + The PostgreSQL Project thanks Dean Rasheed for reporting this problem. (CVE-2025-8713) +* Prevent pg\_dump scripts from being used to attack the user running the restore (Nathan Bossart) [§](https://postgr.es/c/c204bd39f) [§](https://postgr.es/c/27d3dee68) + + Since dump/restore operations typically involve running SQL commands as superuser, the target database installation must trust the source server. However, it does not follow that the operating system user who executes psql to perform the restore should have to trust the source server. The risk here is that an attacker who has gained superuser-level control over the source server might be able to cause it to emit text that would be interpreted as psql meta-commands. That would provide shell-level access to the restoring user's own account, independently of access to the target database. + + To provide a positive guarantee that this can't happen, extend psql with a `\restrict` command that prevents execution of further meta-commands, and teach pg\_dump to issue that before any data coming from the source server. + + The PostgreSQL Project thanks Martin Rakhmanov, Matthieu Denais, and RyotaK for reporting this problem. (CVE-2025-8714) +* Convert newlines to spaces in names included in comments in pg\_dump output (Noah Misch) [§](https://postgr.es/c/2179e6005) + + Object names containing newlines offered the ability to inject arbitrary SQL commands into the output script. (Without the preceding fix, injection of psql meta-commands would also be possible this way.) CVE-2012-0868 fixed this class of problem at the time, but later work reintroduced several cases. + + The PostgreSQL Project thanks Noah Misch for reporting this problem. (CVE-2025-8715) +* Avoid regression in the size of XML input that we will accept (Michael Paquier, Erik Wienhold) [§](https://postgr.es/c/589d6e640) [§](https://postgr.es/c/0ae824704) + + Our workaround for a bug in early 2.13.x releases of libxml2 made use of a code path that rejects text chunks exceeding 10MB, whereas the previous coding did not. Those early releases are presumably extinct in the wild by now, so revert to the previous coding. +* Allow tables with statement-level triggers to become partitions or inheritance children (Etsuro Fujita) [§](https://postgr.es/c/afdb4cde1) + + We do not allow partitions or inheritance child tables to have row-level triggers with transition tables, because an operation on the whole inheritance tree would need to maintain a separate transition table for each such child table. But that problem does not apply for statement-level triggers, because only the parent's statement-level triggers will be fired. The code that checks whether an existing table can become a partition or inheritance child nonetheless rejected both kinds of trigger. +* Disallow collecting transition tuples from child foreign tables (Etsuro Fujita) [§](https://postgr.es/c/b6641f7b0) + + We do not support triggers with transition tables on foreign tables. However, the case of a partition or inheritance child that is a foreign table was overlooked. If the parent has such a trigger, incorrect transition tuples were collected from the foreign child. Instead throw an error, reporting that the case is not supported. +* Shorten the race condition window for creating indexes with conflicting names (Tom Lane) [§](https://postgr.es/c/4b66cb188) + + When choosing an auto-generated name for an index, avoid conflicting with not-yet-committed `pg_class` rows as well as fully-valid ones. This avoids possibly choosing the same name as some concurrent `CREATE INDEX` did, when that command is still in process of filling its index, or is done but is part of a not-yet-committed transaction. There's still a window for trouble, but it's only as long as the time needed to validate a new index's parameters and insert its `pg_class` row. +* Prevent usage of incorrect `VACUUM` options in some cases where multiple tables are vacuumed in a single command (Nathan Bossart, Michael Paquier) [§](https://postgr.es/c/65c3223f9) + + The `TRUNCATE` and `INDEX_CLEANUP` options of one table could be applied to others. +* Fix processing of character classes within `SIMILAR TO` regular expressions (Laurenz Albe) [§](https://postgr.es/c/9481d1614) [§](https://postgr.es/c/31ee5ec69) + + The code that translates `SIMILAR TO` pattern matching expressions to POSIX-style regular expressions did not consider that square brackets can be nested. For example, in a pattern like `[[:alpha:]%_]`, the code treated the `%` and `_` characters as metacharacters when they should be literals. +* When deparsing queries, always add parentheses around the expression in `FETCH FIRST expression ROWS WITH TIES` clauses (Heikki Linnakangas) [§](https://postgr.es/c/7ee00918f) + + This avoids some cases where the deparsed result wasn't syntactically valid. +* Limit the checkpointer process's fsync request queue size (Alexander Korotkov, Xuneng Zhou) [§](https://postgr.es/c/f32a47161) [§](https://postgr.es/c/7f872ae70) + + With very large `shared_buffers` settings, it was possible for the checkpointer to attempt to allocate more than 1GB for fsync requests, leading to failure and an infinite loop. Clamp the queue size to prevent this scenario. +* Avoid infinite wait in logical decoding when reading a partially-written WAL record (Vignesh C) [§](https://postgr.es/c/762f352ca) + + If the server crashes after writing the first part of a WAL record that would span multiple pages, subsequent logical decoding of the WAL stream would wait for data to arrive on the next WAL page. That might never happen if the server is now idle. +* Fix inconsistent quoting of role names in ACL strings (Tom Lane) [§](https://postgr.es/c/093d3d745) + + The previous quoting rule was locale-sensitive, which could lead to portability problems when transferring `aclitem` values across installations. (pg\_dump does not do that, but other tools might.) To ensure consistency, always quote non-ASCII characters in `aclitem` output; but to preserve backward compatibility, never require that they be quoted during `aclitem` input. +* Reject equal signs (`=`) in the names of relation options and foreign-data options (Tom Lane) [§](https://postgr.es/c/cd31eaaeb) + + There's no evident use-case for option names like this, and allowing them creates ambiguity in the stored representation. +* Avoid a rare scenario where a btree index scan could mark the wrong index entries as dead (Peter Geoghegan) [§](https://postgr.es/c/38c8d2987) +* Avoid re-distributing cache invalidation messages from other transactions during logical replication (vignesh C) [§](https://postgr.es/c/1230be12f) [§](https://postgr.es/c/87819f766) + + Our previous round of minor releases included a bug fix to ensure that replication receiver processes would respond to cross-process cache invalidation messages, preventing them from using stale catalog data while performing replication updates. However, the fix unintentionally made them also redistribute those messages again, leading to an exponential increase in the number of invalidation messages, which would often end in a memory allocation failure. Fix by not redistributing received messages. +* Avoid premature removal of old WAL during checkpoints (Vitaly Davydov) [§](https://postgr.es/c/dd3df0b85) + + If a replication slot's restart point is advanced while a checkpoint is in progress, no-longer-needed WAL segments could get removed too soon, leading to recovery failure if the database crashes immediately afterwards. Fix by keeping them for one additional checkpoint cycle. +* Never move a replication slot's confirmed-flush position backwards (Shveta Malik) [§](https://postgr.es/c/e323d9df0) + + In some cases a replication client could acknowledge an LSN that's past what it has stored persistently, and then perhaps send an older LSN after a restart. We consider this not-a-bug so long as the client did not have anything it needed to do for the WAL between the two points. However, we should not re-send that WAL for fear of data duplication, so make sure we always believe the latest confirmed LSN for a given slot. +* Allow waiting for a transaction on a standby server to be interrupted (Kevin K Biju) [§](https://postgr.es/c/706344f06) + + Creation of a replication slot on a standby server may require waiting for some active transaction(s) to finish on the primary and then be replayed on the standby. Since that could be an indefinite wait, it's desirable to allow the operation to be cancelled, but there was no check for query cancel in the loop. +* Fix some places that might try to fetch toasted fields of system catalogs without any snapshot (Nathan Bossart) [§](https://postgr.es/c/b7ba2c030) + + This could result in an assertion failure or “cannot fetch toast data without an active snapshot” error. +* Avoid assertion failure during cross-table constraint updates (Tom Lane, Jian He) [§](https://postgr.es/c/13f1e9f26) [§](https://postgr.es/c/f9ba071cc) +* Remove faulty assertion that a command tag must have been determined by the end of `PortalRunMulti()` (Álvaro Herrera) [§](https://postgr.es/c/43cd85962) + + This failed in edge cases such as an empty prepared statement. +* Restore the ability to run PL/pgSQL expressions in parallel (Dipesh Dhameliya) [§](https://postgr.es/c/ae693c0bf) + + PL/pgSQL's notion of an “expression” is very broad, encompassing any SQL `SELECT` query that returns a single column and no more than one row. So there are cases, for example evaluation of an aggregate function, where the query involves significant work and it'd be useful to run it with parallel workers. This used to be possible, but a previous bug fix unintentionally disabled it. +* Fix edge-case resource leaks in PL/Python error reporting (Tom Lane) [§](https://postgr.es/c/1c78d5553) [§](https://postgr.es/c/93aca1246) + + An out-of-memory failure while reporting an error from Python could result in failure to drop reference counts on Python objects, leading to session-lifespan memory leakage. +* Fix libpq's `PQport()` function to never return NULL unless the passed connection is NULL (Daniele Varrazzo) [§](https://postgr.es/c/9dcd1aa81) + + This is the documented behavior, but recent libpq versions would return NULL in some cases where the user had not provided a port specification. Revert to our historical behavior of returning an empty string in such cases. (v18 and later will return the compiled-in default port number, typically `"5432"`, instead.) +* Avoid failure when GSSAPI authentication requires packets larger than 16kB (Jacob Champion, Tom Lane) [§](https://postgr.es/c/c81cdffa1) + + Larger authentication packets are needed for Active Directory users who belong to many AD groups. This limitation manifested in connection failures with unintelligible error messages, typically “GSSAPI context establishment error: The routine must be called again to complete its function: Unknown error”. +* Fix timing-dependent failures in SSL and GSSAPI data transmission (Tom Lane) [§](https://postgr.es/c/f09fea386) + + When using SSL or GSSAPI encryption in non-blocking mode, libpq sometimes failed with “SSL error: bad length” or “GSSAPI caller failed to retransmit all data needing to be retried”. +* Avoid null-pointer dereference during connection lookup in ecpg applications (Aleksander Alekseev) [§](https://postgr.es/c/c934d5673) + + The case could occur only if the application has some connections that are named and some that are not. +* Ensure that pg\_dump dumps comments on domain constraints in a valid order (Jian He) [§](https://postgr.es/c/57949cea5) + + In some cases the comment command could appear before creation of the constraint. +* Ensure stable sort ordering in pg\_dump for all types of database objects (Noah Misch, Andreas Karlsson) [§](https://postgr.es/c/04bc2c42f) [§](https://postgr.es/c/cc9a62c51) [§](https://postgr.es/c/bc05590c7) + + pg\_dump sorts objects by their logical names before performing dependency-driven reordering. This sort did not account for the full unique key identifying certain object types such as rules and constraints, and thus it could produce dissimilar sort orders for logically-identical databases. That made it difficult to compare databases by diff'ing pg\_dump output, so improve the logic to ensure stable sort ordering in all cases. +* In pg\_upgrade, check for inconsistent inherited not-null constraints (Ali Akbar) [§](https://postgr.es/c/b0f0e2221) [§](https://postgr.es/c/708469281) [§](https://postgr.es/c/160131033) [§](https://postgr.es/c/7406a7d82) [§](https://postgr.es/c/de7fd83cd) [§](https://postgr.es/c/095e83d09) + + PostgreSQL versions before 18 allow an inherited column not-null constraint to be dropped. However, this results in a schema that cannot be restored, leading to failure in pg\_upgrade. Detect such cases during pg\_upgrade's preflight checks to allow users to fix them before initiating the upgrade. +* Avoid assertion failure if `track_commit_timestamp` is enabled during initdb (Hayato Kuroda, Andy Fan) [§](https://postgr.es/c/8bca4476f) +* Avoid possible leak of the open connection during `contrib/dblink` connection establishment (Tom Lane) [§](https://postgr.es/c/e7d3d4ed4) + + In the rare scenario where we hit out-of-memory while inserting the new connection object into dblink's hashtable, the open connection would be leaked until end of session, leaving an idle session sitting on the remote server. +* Make `contrib/pg_prewarm` cope with very large `shared_buffers` settings (Daria Shanina) [§](https://postgr.es/c/4adbaa36c) + + Autoprewarm failed with a memory allocation error if `shared_buffers` was larger than about 50 million buffers (400GB). +* In `contrib/pg_stat_statements`, avoid leaving gaps in the set of parameter numbers used in a normalized query (Sami Imseih) [§](https://postgr.es/c/3c03b8cd7) +* Fix memory leakage in `contrib/postgres_fdw`'s DirectModify methods (Tom Lane) [§](https://postgr.es/c/271cb7eaa) + + The `PGresult` holding the results of the remote modify command would be leaked for the rest of the session if the query fails between invocations of the DirectModify methods, which could happen when there's `RETURNING` data to process. +* Ensure that directories listed in configure's `--with-includes` and `--with-libraries` options are searched before system-supplied directories (Tom Lane) [§](https://postgr.es/c/c5bd803e5) + + A common reason for using these options is to allow a user-built version of some library to override the system-supplied version. However, that failed to work in some environments because of careless ordering of switches in the commands issued by the makefiles. +* Fix configure's checks for `__cpuid()` and `__cpuidex()` (Lukas Fittl, Michael Paquier) [§](https://postgr.es/c/612f5b806) + + configure failed to detect these Windows-specific functions, so that they would not be used, leading to slower-than-necessary CRC computations since the availability of hardware instructions could not be verified. The practical impact of this error was limited, because production builds for Windows typically do not use the Autoconf toolchain. +* Fix build failure with `--with-pam` option on Solaris-based platforms (Tom Lane) [§](https://postgr.es/c/1ccb3851d) + + Solaris is inconsistent with other Unix platforms about the API for PAM authentication. This manifested as an “inconsistent pointer” compiler warning, which we never did anything about. But as of GCC 14 it's an error not warning by default, so fix it. +* Make our code portable to GNU Hurd (Michael Banck, Christoph Berg, Samuel Thibault) [§](https://postgr.es/c/d0a695cf4) + + Fix assumptions about `IOV_MAX` and `O_RDONLY` that don't hold on Hurd. +* Make our usage of `memset_s()` conform strictly to the C11 standard (Tom Lane) [§](https://postgr.es/c/9bc2d37cc) + + This avoids compile failures on some platforms. +* Prevent uninitialized-value compiler warnings in JSONB comparison code (Tom Lane) [§](https://postgr.es/c/6c93bf735) +* Avoid deprecation warnings when building with libxml2 2.14 and later (Michael Paquier) [§](https://postgr.es/c/e688cfc2b) +* Avoid problems when compiling `pg_locale.h` under C++ (John Naylor) [§](https://postgr.es/c/9560c1ec1) + + PostgreSQL header files generally need to be wrapped in `extern "C" { ... }` in order to be included in extensions written in C++. This failed for `pg_locale.h` because of its use of libicu headers, but we can work around that by suppressing C++-only declarations in those headers. C++ extensions that want to use libicu's C++ APIs can do so by including the libicu headers ahead of `pg_locale.h`. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-23.html "E.1. Release 13.23") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-21.html "E.3. Release 13.21") | +| E.1. Release 13.23 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.3. Release 13.21 | + +[Previous](/docs/release/13.21/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.23/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1323.md b/corpus/changelog/postgresql_releases/postgresql_1323.md new file mode 100644 index 0000000000000000000000000000000000000000..9270ef86a50711aea54e30d8a79b4fe14d6f0041 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1323.md @@ -0,0 +1,161 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.23/ +Version: 13.23 + +## PostgreSQL 13.23 + +| E.1. Release 13.23 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release.html "Appendix E. Release Notes") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-22.html "E.2. Release 13.22") | + +--- + +## E.1. Release 13.23 + +[E.1.1. Migration to Version 13.23](release-13-23.html#id-1.11.6.6.5) + +[E.1.2. Changes](release-13-23.html#id-1.11.6.6.6) + +**Release date:**2025-11-13 + +This release contains a variety of fixes from 13.22. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +This is expected to be the last PostgreSQL release in the 13.X series. Users are encouraged to update to a newer release branch soon. + +### E.1.1. Migration to Version 13.23 + +A dump/restore is not required for those running 13.X. + +However, if you are upgrading from a version earlier than 13.21, see [Section E.3](release-13-21.html "E.3. Release 13.21"). + +### E.1.2. Changes + +* Check for `CREATE` privileges on the schema in `CREATE STATISTICS` (Jelte Fennema-Nio) [§](https://postgr.es/c/8a2530ebc) + + This omission allowed table owners to create statistics in any schema, potentially leading to unexpected naming conflicts. + + The PostgreSQL Project thanks Jelte Fennema-Nio for reporting this problem. (CVE-2025-12817) +* Avoid integer overflow in allocation-size calculations within libpq (Jacob Champion) [§](https://postgr.es/c/d6f0c0d6d) + + Several places in libpq were not sufficiently careful about computing the required size of a memory allocation. Sufficiently large inputs could cause integer overflow, resulting in an undersized buffer, which would then lead to writing past the end of the buffer. + + The PostgreSQL Project thanks Aleksey Solovev of Positive Technologies for reporting this problem. (CVE-2025-12818) +* Further fix processing of character classes within `SIMILAR TO` regular expressions (Laurenz Albe) [§](https://postgr.es/c/308773617) + + The previous fix for translating `SIMILAR TO` pattern matching expressions to POSIX-style regular expressions broke a corner case that formerly worked: if there is an escape character right after the opening bracket and then a closing bracket right after the escape sequence (for example `[\w]`), the closing bracket was no longer seen as terminating the character class. +* Fix parsing of aggregate functions whose arguments contain a sub-select with a `FROM` reference to a CTE outside the aggregate function (Tom Lane) [§](https://postgr.es/c/b649ef244) + + Such a CTE reference must act like a outer-level column reference when determining the aggregate's semantic level; but it was not being accounted for, leading to obscure planner or executor errors. +* Fix “no relation entry for relid” errors in corner cases while estimating SubPlan costs (Richard Guo) [§](https://postgr.es/c/8c02d92c6) +* Remove faulty assertion in btree index cleanup (Peter Geoghegan) [§](https://postgr.es/c/af302ff6b) +* Fix possible infinite loop in GIN index scans with multiple scan conditions (Tom Lane) [§](https://postgr.es/c/3e0f5f00b) + + GIN can handle scan conditions that can reject non-matching entries but are not useful for searching for relevant entries, for example a `tsquery` clause like `!term`. But such a condition must not be first in the array of scan conditions. The code failed to ensure that in all cases, with the result that a query having a mix of such conditions with normal conditions might work or not depending on the order in which the conditions were given in the query. +* Ensure that GIN index scans can be canceled (Tom Lane) [§](https://postgr.es/c/b2d71c455) + + Some code paths were capable of running for a long time without checking for interrupts. +* Ensure that BRIN autosummarization provides a snapshot for index expressions that need one (Álvaro Herrera) [§](https://postgr.es/c/3c7b47974) [§](https://postgr.es/c/ef81697fe) + + Previously, autosummarization would fail for such indexes, and then leave placeholder index tuples behind, causing the index to bloat over time. +* Fix integer-overflow hazard in BRIN index scans when the table contains close to 232 pages (Sunil S) [§](https://postgr.es/c/c28f8ca29) + + This oversight could result in an infinite loop or scanning of unneeded table pages. +* Fix incorrect zero-extension of stored values in JIT-generated tuple deforming code (David Rowley) [§](https://postgr.es/c/4afab175b) + + When not using JIT, the equivalent code does sign-extension not zero-extension, leading to a different Datum representation of small integer data types. This inconsistency was masked in most cases, but it is known to lead to “could not find memoization table entry” errors when using Memoize plan nodes, and there might be other symptoms. +* Add missing EvalPlanQual rechecks for TID Scan and TID Range Scan plan nodes (Sophie Alpert, David Rowley) [§](https://postgr.es/c/940f3cd5d) + + This omission led to possibly not rechecking a condition on `ctid` during concurrent-update situations, causing the update's behavior to vary depending on which plan type had been selected. +* Fix EvalPlanQual handling of foreign or custom joins that do not have an alternative local-join plan prepared for EPQ (Masahiko Sawada, Etsuro Fujita) [§](https://postgr.es/c/12b0c0e51) + + In such cases the foreign or custom access method should be invoked normally, but that did not happen, typically leading to a crash. +* Disallow generated columns in partition keys (Jian He, Ashutosh Bapat) [§](https://postgr.es/c/7f239c72a) + + This was already not allowed, but the check missed some cases, such as where the column reference is implicit in a whole-row reference. +* Disallow generated columns in `COPY ... FROM ... WHERE` clauses (Peter Eisentraut, Jian He) [§](https://postgr.es/c/3717849e6) + + Previously, incorrect behavior or an obscure error message resulted from attempting to reference such a column, since generated columns have not yet been computed at the point where `WHERE` filtering is done. +* Fix visibility checking for statistics objects in `pg_temp` (Noah Misch) [§](https://postgr.es/c/afb2cce74) + + A statistics object located in a temporary schema cannot be named without schema qualification, but `pg_statistics_obj_is_visible()` missed that memo and could return “true” regardless. In turn, functions such as `pg_describe_object()` could fail to schema-qualify the object's name as expected. +* Fix memory leakage in hashed subplans (Haiyang Li) [§](https://postgr.es/c/8b6c29afd) + + Any memory consumed by the hash functions used for hashing tuples constituted a query-lifespan memory leak. One way that could happen is if the values being hashed require de-toasting. +* Add missing replica identity checks in `MERGE` and `INSERT ... ON CONFLICT DO UPDATE` (Zhijie Hou) [§](https://postgr.es/c/0610b843c) [§](https://postgr.es/c/dbef9cbaa) + + If `MERGE` may require update or delete actions, and the target table publishes updates or deletes, insist that it have a `REPLICA IDENTITY` defined. Failing to require this can silently break replication. Likewise, `INSERT` with an `UPDATE` option must require `REPLICA IDENTITY` if the target table publishes either inserts or updates. +* Avoid deadlock during `DROP SUBSCRIPTION` when publisher is on the same server as subscriber (Dilip Kumar) [§](https://postgr.es/c/0a98f24a6) +* Fix incorrect reporting of replication lag in `pg_stat_replication` view (Fujii Masao) [§](https://postgr.es/c/7d7ebdb80) + + If any standby server's replay LSN stopped advancing, the `write_lag` and `flush_lag` columns would eventually stop updating. +* Avoid duplicative log messages about invalid `primary_slot_name` settings (Fujii Masao) [§](https://postgr.es/c/b00a16bae) +* Remove the unfinished slot state file after failing to write a replication slot's state to disk (Michael Paquier) [§](https://postgr.es/c/c878d9808) + + Previously, a failure such as out-of-disk-space resulted in leaving a temporary `state.tmp` file behind. That's problematic because it would block all subsequent attempts to write the state, requiring manual intervention to clean up. +* Avoid unwanted WAL receiver shutdown when switching from streaming to archive WAL source (Xuneng Zhou) [§](https://postgr.es/c/25b484080) + + During a timeline change, a standby server's WAL receiver should remain alive, waiting for a new WAL streaming start point. Instead it was repeatedly shutting down and immediately getting restarted, which could confuse status monitoring code. +* Avoid failures in logical replication due to chance collisions of file numbers between regular and temporary tables (Vignesh C) [§](https://postgr.es/c/30b32b08c) + + This low-probability problem manifested as transient errors like “unexpected duplicate for tablespace *`X`*, relfilenode *`Y`*”. `contrib/autoprewarm` was also affected. A side-effect of the fix is that the SQL function `pg_filenode_relation()` will now ignore temporary tables. +* Avoid assertion failure when trying to release a replication slot in single-user mode (Hayato Kuroda) [§](https://postgr.es/c/8ed079cad) +* Fix incorrect printing of messages about failures in checking whether the user has Windows administrator privilege (Bryan Green) [§](https://postgr.es/c/75a555d61) + + This code would have crashed or at least printed garbage. No such cases have been reported though, indicating that failure of these system calls is extremely rare. +* Avoid startup failure on macOS and BSD platforms when there is a collision with a pre-existing semaphore set (Tom Lane) [§](https://postgr.es/c/e3b3fa863) + + If the pre-existing set has fewer semaphores than we asked for, these platforms return EINVAL not EEXIST as our code expected, resulting in failure to start the database. +* Fix false memory-context-checking warnings in debug builds on 64-bit Windows (David Rowley) [§](https://postgr.es/c/7b955c227) +* Avoid leaking memory when handling a SQL error within PL/Python (Tom Lane) [§](https://postgr.es/c/d90c92d1c) + + This fixes a session-lifespan memory leak introduced in our previous minor releases. +* Fix libpq's handling of socket-related errors on Windows within its GSSAPI logic (Ning Wu, Tom Lane) [§](https://postgr.es/c/fc287cf3c) + + The code for encrypting/decrypting transmitted data using GSSAPI did not correctly recognize error conditions on the connection socket, since Windows reports those differently than other platforms. This led to failure to make such connections on Windows. +* In pg\_dump, dump security labels on subscriptions and event triggers (Jian He, Fujii Masao) [§](https://postgr.es/c/dff7591a7) + + Labels on these types of objects were previously missed. +* Fix pg\_dump's sorting of default ACLs and foreign key constraints (Kirill Reshke, Álvaro Herrera) [§](https://postgr.es/c/05341b2e9) [§](https://postgr.es/c/fb75e1ef7) [§](https://postgr.es/c/d20df9590) + + Ensure consistent ordering of these database object types, as was already done for other object types. +* In pg\_dump, label comments for separately-dumped domain constraints with the proper dependency (Noah Misch) [§](https://postgr.es/c/a685c057a) + + This error could lead to parallel pg\_restore attempting to create the comment before the constraint itself has been restored. +* In pg\_restore, skip comments and security labels for publications and subscriptions that are not being restored (Jian He, Fujii Masao) [§](https://postgr.es/c/8fbd1f8ea) [§](https://postgr.es/c/a4dbb11bb) + + Do not emit `COMMENT` or `SECURITY LABEL` commands for these objects when `--no-publications` or `--no-subscriptions` is specified. +* Fix assorted errors in the data compression logic in pg\_dump and pg\_restore (Daniel Gustafsson, Tom Lane) [§](https://postgr.es/c/33276cd02) + + Error checking was missing or incorrect in several places, and there were also portability issues that would manifest on big-endian hardware. These problems had been missed because this code is only used to read compressed TOC files within directory-format dumps. pg\_dump never produces such a dump; the case can be reached only by manually compressing the TOC file after the fact, which is a supported thing to do but very uncommon. +* Fix pgbench to error out cleanly if a `COPY` operation is started (Anthonin Bonnefoy) [§](https://postgr.es/c/f1a2f3a0c) + + pgbench doesn't intend to support this case, but previously it went into an infinite loop. +* Fix pgbench's reporting of multiple errors (Yugo Nagata) [§](https://postgr.es/c/7d7e81d1e) + + In cases where two successive `PQgetResult` calls both fail, pgbench might report the wrong error message. +* Ensure that `contrib/pg_buffercache` functions can be canceled (Satyanarayana Narlapuram, Yuhang Qiu) [§](https://postgr.es/c/7d8d36289) + + Some code paths were capable of running for a long time without checking for interrupts. +* Fix `contrib/pg_prewarm`'s privilege checks for indexes (Ayush Vatsa, Nathan Bossart) [§](https://postgr.es/c/19a64f567) + + `pg_prewarm()` requires `SELECT` privilege on relations to be prewarmed. However, since indexes have no SQL privileges of their own, this resulted in non-superusers being unable to prewarm indexes. Instead, check for `SELECT` privilege on the index's table. +* Make `contrib/pgstattuple` more robust about empty or invalid index pages (Nitin Motiani) [§](https://postgr.es/c/c207bf473) + + Count all-zero pages as free space, and ignore pages that are invalid according to a check of the page's special-space size. The code for btree indexes already counted all-zero pages as free, but the hash and gist code would error out, which has been found to be much less user-friendly. Similarly, make all three cases agree on ignoring corrupted pages rather than throwing errors. +* Harden our read and write barrier macros to satisfy Clang (Thomas Munro) [§](https://postgr.es/c/77b5b2c6f) + + We supposed that `__atomic_thread_fence()` is a sufficient barrier to prevent the C compiler from re-ordering memory accesses around it, but it appears that that's not true for Clang, allowing it to generate incorrect code for at least RISC-V, MIPS, and LoongArch machines. Add explicit compiler barriers to fix that. +* Fix building with LLVM version 21 and later (Holger Hoffstätte) [§](https://postgr.es/c/59d6e843e) +* Fix PGXS build infrastructure to support building NLS `po` files for extensions (Ryo Matsumura) [§](https://postgr.es/c/f768f5a7d) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release.html "Appendix E. Release Notes") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-22.html "E.2. Release 13.22") | +| Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | E.2. Release 13.22 | + +[Previous](/docs/release/13.22/) + +[Return to the Release Notes Archive](/docs/release/) diff --git a/corpus/changelog/postgresql_releases/postgresql_133.md b/corpus/changelog/postgresql_releases/postgresql_133.md new file mode 100644 index 0000000000000000000000000000000000000000..7b2718cfc1f6f99a1b7361ec9a1b53b67417b605 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_133.md @@ -0,0 +1,162 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.3/ +Version: 13.3 + +## PostgreSQL 13.3 + +| E.21. Release 13.3 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-4.html "E.20. Release 13.4") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-2.html "E.22. Release 13.2") | + +--- + +## E.21. Release 13.3 + +[E.21.1. Migration to Version 13.3](release-13-3.html#id-1.11.6.26.4) + +[E.21.2. Changes](release-13-3.html#id-1.11.6.26.5) + +**Release date:**2021-05-13 + +This release contains a variety of fixes from 13.2. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +### E.21.1. Migration to Version 13.3 + +A dump/restore is not required for those running 13.X. + +However, if you are upgrading from a version earlier than 13.2, see [Section E.22](release-13-2.html "E.22. Release 13.2"). + +### E.21.2. Changes + +* Prevent integer overflows in array subscripting calculations (Tom Lane) [§](https://postgr.es/c/467395bfd) + + The array code previously did not complain about cases where an array's lower bound plus length overflows an integer. This resulted in later entries in the array becoming inaccessible (since their subscripts could not be written as integers), but more importantly it confused subsequent assignment operations. This could lead to memory overwrites, with ensuing crashes or unwanted data modifications. (CVE-2021-32027) +* Fix mishandling of “junk” columns in `INSERT ... ON CONFLICT ... UPDATE` target lists (Tom Lane) [§](https://postgr.es/c/4a8656a7e) + + If the `UPDATE` list contains any multi-column sub-selects (which give rise to junk columns in addition to the results proper), the `UPDATE` path would end up storing tuples that include the values of the extra junk columns. That's fairly harmless in the short run, but if new columns are added to the table then the values would become accessible, possibly leading to malfunctions if they don't match the datatypes of the added columns. + + In addition, in versions supporting cross-partition updates, a cross-partition update triggered by such a case had the reverse problem: the junk columns were removed from the target list, typically causing an immediate crash due to malfunction of the multi-column sub-select mechanism. (CVE-2021-32028) +* Fix possibly-incorrect computation of `UPDATE ... RETURNING` outputs for joined cross-partition updates (Amit Langote, Etsuro Fujita) [§](https://postgr.es/c/a71cfc56b) [§](https://postgr.es/c/2602ee468) + + If an `UPDATE` for a partitioned table caused a row to be moved to another partition with a physically different row type (for example, one with a different set of dropped columns), computation of `RETURNING` results for that row could produce errors or wrong answers. No error is observed unless the `UPDATE` involves other tables being joined to the target table. (CVE-2021-32029) +* Fix adjustment of constraint deferrability properties in partitioned tables (Álvaro Herrera) [§](https://postgr.es/c/923c13520) + + When applied to a foreign-key constraint of a partitioned table, `ALTER TABLE ... ALTER CONSTRAINT` failed to adjust the `DEFERRABLE` and/or `INITIALLY DEFERRED` markings of the constraints and triggers of leaf partitions. This led to unexpected behavior of such constraints. After updating to this version, any misbehaving partitioned tables can be fixed by executing a new `ALTER` command to set the desired properties. + + This change also disallows applying such an `ALTER` directly to the constraints of leaf partitions. The only supported case is for the whole partitioning hierarchy to have identical constraint properties, so such `ALTER`s must be applied at the partition root. +* When attaching a child table with `ALTER TABLE ... INHERIT`, insist that any generated columns in the parent be generated the same way in the child (Peter Eisentraut) [§](https://postgr.es/c/64190d65f) +* Forbid marking an identity column as nullable (Vik Fearing) [§](https://postgr.es/c/8a2297776) + + `GENERATED ... AS IDENTITY` implies `NOT NULL`, so don't allow it to be combined with an explicit `NULL` specification. +* Allow `ALTER ROLE/DATABASE ... SET` to set the `role`, `session_authorization`, and `temp_buffers` parameters (Tom Lane) [§](https://postgr.es/c/c39aa1e87) + + Previously, over-eager validity checks might reject these commands, even if the values would have worked when used later. This created a command ordering hazard for dump/reload and upgrade scenarios. +* Ensure that `REINDEX CONCURRENTLY` preserves any statistics target that's been set for the index (Michael Paquier) [§](https://postgr.es/c/849383138) [§](https://postgr.es/c/c6cd20d91) +* Fix `COMMIT AND CHAIN` to work correctly when the current transaction has live savepoints (Fujii Masao) [§](https://postgr.es/c/422012c98) +* Fix list-manipulation bug in `WITH RECURSIVE` processing (Michael Paquier, Tom Lane) [§](https://postgr.es/c/49076fd3b) + + Sufficiently deep nesting of `WITH` constructs (at least seven levels) triggered core dumps or incorrect complaints of faulty `WITH` nesting. +* Fix bug with coercing the result of a `COLLATE` expression to a non-collatable type (Tom Lane) [§](https://postgr.es/c/8a7bd1e6c) + + This led to a parse tree in which the `COLLATE` appears to be applied to a non-collatable value. While that normally has no real impact (since `COLLATE` has no effect at runtime), it was possible to construct views that would be rejected during dump/reload. +* Fix use-after-free bug in saving tuples for `AFTER` triggers (Amit Langote) [§](https://postgr.es/c/2688852a4) + + This could cause crashes in some situations. +* Disallow calling window functions and procedures via the “fast path” wire protocol message (Tom Lane) [§](https://postgr.es/c/4d225ba0e) + + Only plain functions are supported here. While trying to call an aggregate function failed already, calling a window function would crash, and calling a procedure would work only if the procedure did no transaction control. +* Extend `pg_identify_object_as_address()` to support event triggers (Joel Jacobson) [§](https://postgr.es/c/f3c453787) [§](https://postgr.es/c/a928297bc) +* Fix `to_char()`'s handling of Roman-numeral month format codes with negative intervals (Julien Rouhaud) [§](https://postgr.es/c/be79debd9) + + Previously, such cases would usually cause a crash. +* Check that the argument of `pg_import_system_collations()` is a valid schema OID (Tom Lane) [§](https://postgr.es/c/fe2b5386b) +* Fix use of uninitialized value while parsing an `\{m,n\}` quantifier in a BRE-mode regular expression (Tom Lane) [§](https://postgr.es/c/bf9d3a5f8) + + This error could cause the quantifier to act non-greedy, that is behave like an `{m,n}?` quantifier would do in full regular expressions. +* Fix “could not find pathkey item to sort” planner errors in some situations where the sort key involves an aggregate or window function (James Coleman, Tom Lane) [§](https://postgr.es/c/7bfba4f19) +* Don't ignore system columns when estimating the number of groups using extended statistics (Tomas Vondra) [§](https://postgr.es/c/67251c82a) + + This led to strange estimates for queries such as `SELECT ... GROUP BY a, b, ctid`. +* Avoid divide-by-zero when estimating selectivity of a regular expression with a very long fixed prefix (Tom Lane) [§](https://postgr.es/c/3a02d68a9) + + This typically led to a `NaN` selectivity value, causing assertion failures or strange planner behavior. +* Fix access-off-the-end-of-the-table error in BRIN index bitmap scans (Tomas Vondra) [§](https://postgr.es/c/1aad1d181) + + If the page range size used by a BRIN index isn't a power of two, there were corner cases in which a bitmap scan could try to fetch pages past the actual end of the table, leading to “could not open file” errors. +* Fix potentially wrong answers from GIN `tsvector` index searches, when there are many matching tuples (Tom Lane) [§](https://postgr.es/c/0d779d22a) + + If the number of index matches became large enough to make the bitmap holding them become lossy (a threshold that depends on `work_mem`), the code could get confused about whether rechecks are required, allowing rows to be returned that don't actually match the query. +* Fix concurrency issues with WAL segment recycling on Windows (Michael Paquier) [§](https://postgr.es/c/78c24e97d) + + This reverts a change that caused intermittent “could not rename file ...: Permission denied” log messages. While there were not serious consequences, the log spam was annoying. +* Avoid incorrect timeline change while recovering uncommitted two-phase transactions from WAL (Soumyadeep Chakraborty, Jimmy Yih, Kevin Yeap) [§](https://postgr.es/c/6e5ce888a) + + This error could lead to subsequent WAL records being written under the wrong timeline ID, leading to consistency problems, or even complete failure to be able to restart the server, later on. +* Ensure that locks are released while shutting down a standby server's startup process (Fujii Masao) [§](https://postgr.es/c/e7bcfd717) + + When a standby server is shut down while still in recovery, some locks might be left held. This causes assertion failures in debug builds; it's unclear whether any serious consequence could occur in production builds. +* Fix crash when a logical replication worker does `ALTER SUBSCRIPTION REFRESH` (Peter Smith) [§](https://postgr.es/c/ef70b6f8e) + + The core code won't do this, but a replica trigger could. +* Ensure we default to `wal_sync_method` = `fdatasync` on recent FreeBSD (Thomas Munro) [§](https://postgr.es/c/6c23e5ae9) + + FreeBSD 13 supports `open_datasync`, which would normally become the default choice. However, it's unclear whether that is actually an improvement for Postgres, so preserve the existing default for now. +* Disable the `vacuum_cleanup_index_scale_factor` parameter and storage option (Peter Geoghegan) [§](https://postgr.es/c/9663d1244) [§](https://postgr.es/c/1fc5a5738) + + The notion of tracking “stale” index statistics proved to interact badly with the `autovacuum_vacuum_insert_threshold` parameter, resulting in unnecessary full-index scans and consequent degradation of autovacuum performance. The latter mechanism seems superior, so remove the stale-statistics logic. The control parameter for that, `vacuum_cleanup_index_scale_factor`, will be removed entirely in v14. In v13, it remains present to avoid breaking existing configuration files, but it no longer does anything. +* Pass the correct trigger OID to object post-alter hooks during `ALTER CONSTRAINT` (Álvaro Herrera) [§](https://postgr.es/c/91a6b3862) + + When updating trigger properties during `ALTER CONSTRAINT`, the post-alter hook was told that we are updating a trigger, but the constraint's OID was passed instead of the trigger's. +* Ensure we finish cleaning up when interrupted while detaching a DSM segment (Thomas Munro) [§](https://postgr.es/c/9fe40913c) + + This error could result in temporary files not being cleaned up promptly after a parallel query. +* Fix assorted minor memory leaks in the server (Tom Lane, Andres Freund) [§](https://postgr.es/c/4b41f6923) [§](https://postgr.es/c/12354839e) [§](https://postgr.es/c/642b0b69b) [§](https://postgr.es/c/eba939551) [§](https://postgr.es/c/ea3989f34) [§](https://postgr.es/c/536836970) [§](https://postgr.es/c/4d072bf2a) +* Fix uninitialized variable in walreceiver's statistics in shared memory (Fujii Masao) [§](https://postgr.es/c/d4b667e93) + + This error was harmless on most platforms, but could cause issues on platforms lacking atomic variables and/or spinlock support. +* Reduce the overhead of dtrace probes for LWLock operations, when dtrace support is compiled in but not active (Peter Eisentraut) [§](https://postgr.es/c/e48ce7ef0) [§](https://postgr.es/c/0d204a4b0) +* Fix failure when a PL/pgSQL `DO` block makes use of both composite-type variables and transaction control (Tom Lane) [§](https://postgr.es/c/97b7ad468) + + Previously, such cases led to errors about leaked tuple descriptors. +* Prevent infinite loop in libpq if a ParameterDescription message with a corrupt length is received (Tom Lane) [§](https://postgr.es/c/3580b4a0c) +* When initdb prints instructions about how to start the server, make the path shown for pg\_ctl use backslash separators on Windows (Nitin Jadhav) [§](https://postgr.es/c/b52fd1e7c) +* Fix psql to restore the previous behavior of `\connect service=something` (Tom Lane) [§](https://postgr.es/c/c6eac71a8) + + A previous bug fix caused environment variables (such as `PGPORT`) to override entries in the service file in this context. Restore the previous behavior, in which the priority is the other way around. +* Fix psql's `ON_ERROR_ROLLBACK` feature to handle `COMMIT AND CHAIN` commands correctly (Arthur Nascimento) [§](https://postgr.es/c/be7485a1e) + + Previously, this case failed with “savepoint "pg\_psql\_temporary\_savepoint" does not exist”. +* In psql, avoid repeated “could not print result table” failures after the first such error (Álvaro Herrera) [§](https://postgr.es/c/f50dc2c72) +* Fix race condition in detection of file modification by psql's `\e` and related commands (Laurenz Albe) [§](https://postgr.es/c/6ed059933) + + A very fast typist could fool the code's file-timestamp-based detection of whether the temporary edit file was changed. +* Fix pg\_dump's dumping of generated columns in partitioned tables (Peter Eisentraut) [§](https://postgr.es/c/a6a3a274a) + + A fix introduced in the previous minor release should not be applied to partitioned tables, only traditionally-inherited tables. +* Fix missed file version check in pg\_restore (Tom Lane) [§](https://postgr.es/c/35421a470) + + When reading a custom-format archive from a non-seekable source, pg\_restore neglected to check the archive version. If it was fed a newer archive version than it can support, it would fail messily later on. +* Add some more checks to pg\_upgrade for user tables containing non-upgradable data types (Tom Lane) [§](https://postgr.es/c/bbcfee0e5) + + Fix detection of some cases where a non-upgradable data type is embedded within a container type (such as an array or range). Also disallow upgrading when user tables contain columns of system-defined composite types, since those types' OIDs are not stable across versions. +* Fix incorrect progress-reporting calculation in pg\_checksums (Shinya Kato) [§](https://postgr.es/c/104164361) +* Fix pg\_waldump to count `XACT` records correctly when generating per-record statistics (Kyotaro Horiguchi) [§](https://postgr.es/c/34279fd4f) +* Fix `contrib/amcheck` to not complain about the tuple flags `HEAP_XMAX_LOCK_ONLY` and `HEAP_KEYS_UPDATED` both being set (Julien Rouhaud) [§](https://postgr.es/c/28f4b6108) + + This is a valid state after `SELECT FOR UPDATE`. +* Adjust VPATH build rules to support recent Oracle Developer Studio compiler versions (Noah Misch) [§](https://postgr.es/c/13881199e) +* Fix testing of PL/Python for Python 3 on Solaris (Noah Misch) [§](https://postgr.es/c/766c8fce5) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-4.html "E.20. Release 13.4") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-2.html "E.22. Release 13.2") | +| E.20. Release 13.4 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.22. Release 13.2 | + +[Previous](/docs/release/13.2/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.4/) diff --git a/corpus/changelog/postgresql_releases/postgresql_134.md b/corpus/changelog/postgresql_releases/postgresql_134.md new file mode 100644 index 0000000000000000000000000000000000000000..68313c32598f856267bac0e9f77e67c6c0753a55 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_134.md @@ -0,0 +1,209 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.4/ +Version: 13.4 + +## PostgreSQL 13.4 + +| E.20. Release 13.4 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-5.html "E.19. Release 13.5") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-3.html "E.21. Release 13.3") | + +--- + +## E.20. Release 13.4 + +[E.20.1. Migration to Version 13.4](release-13-4.html#id-1.11.6.25.4) + +[E.20.2. Changes](release-13-4.html#id-1.11.6.25.5) + +**Release date:**2021-08-12 + +This release contains a variety of fixes from 13.3. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +### E.20.1. Migration to Version 13.4 + +A dump/restore is not required for those running 13.X. + +However, if you are upgrading from a version earlier than 13.2, see [Section E.22](release-13-2.html "E.22. Release 13.2"). + +### E.20.2. Changes + +* Fix mis-planning of repeated application of a projection step (Tom Lane) [§](https://postgr.es/c/fe6f63286) + + The planner could create an incorrect plan in cases where two ProjectionPaths were stacked on top of each other. The only known way to trigger that situation involves parallel sort operations, but there may be other instances. The result would be crashes or incorrect query results. Disclosure of server memory contents is also possible. (CVE-2021-3677) +* Disallow SSL renegotiation more completely (Michael Paquier) [§](https://postgr.es/c/a23c0b00f) + + SSL renegotiation has been disabled for some time, but the server would still cooperate with a client-initiated renegotiation request. A maliciously crafted renegotiation request could result in a server crash (see OpenSSL issue CVE-2021-3449). Disable the feature altogether on OpenSSL versions that permit doing so, which are 1.1.0h and newer. +* Restore the Portal-level snapshot after `COMMIT` or `ROLLBACK` within a procedure (Tom Lane) [§](https://postgr.es/c/d18ee6f92) [§](https://postgr.es/c/6e43f1c2d) [§](https://postgr.es/c/6f1321d5a) [§](https://postgr.es/c/93f99693f) [§](https://postgr.es/c/c64183f23) + + This change fixes cases where an attempt to fetch a toasted value immediately after `COMMIT`/`ROLLBACK` would fail with errors like “no known snapshots” or “missing chunk number 0 for toast value”. + + Some extensions may attempt to execute SQL code outside of any Portal. They are responsible for ensuring that an outer snapshot exists before doing so. Previously, not providing a snapshot might work or it might not; now it will consistently fail with “cannot execute SQL without an outer snapshot or portal”. +* Avoid misbehavior when persisting the output of a cursor that's reading a non-stable query (Tom Lane) [§](https://postgr.es/c/c1fd756fd) [§](https://postgr.es/c/c5b281841) + + Previously, we'd always rewind and re-read the whole query result, possibly getting results different from the earlier execution, causing great confusion later. For a NO SCROLL cursor, we can fix this by only storing the not-yet-read portion of the query output, which is sufficient since a NO SCROLL cursor can't be backed up. Cursors with the SCROLL option remain at hazard, but that was already documented to be an unsafe option to use with a non-stable query. Make those documentation warnings stronger. + + Also force NO SCROLL mode for the implicit cursor used by a PL/pgSQL FOR-over-query loop, to avoid this type of problem when persisting such a cursor during an intra-procedure commit. +* Reject `SELECT ... GROUP BY GROUPING SETS (()) FOR UPDATE` (Tom Lane) [§](https://postgr.es/c/e5b0fffa1) + + This should be disallowed, just as `FOR UPDATE` with a plain `GROUP BY` is disallowed, but the test for that failed to handle empty grouping sets correctly. The end result would be a null-pointer dereference in the executor. +* Reject cases where a query in `WITH` rewrites to just `NOTIFY` (Tom Lane) [§](https://postgr.es/c/6edccac16) + + Such cases previously crashed. +* In `numeric` multiplication, round the result rather than failing if it would have more than 16383 digits after the decimal point (Dean Rasheed) [§](https://postgr.es/c/f23a9b8a4) +* Fix corner-case errors and loss of precision when raising `numeric` values to very large powers (Dean Rasheed) [§](https://postgr.es/c/053ec4e0c) [§](https://postgr.es/c/da188b993) +* Fix division-by-zero failure in `to_char()` with `EEEE` format and a `numeric` input value less than 10^(-1001) (Dean Rasheed) [§](https://postgr.es/c/a72ad6315) +* Fix `pg_size_pretty(bigint)` to round negative values consistently with the way it rounds positive ones (and consistently with the `numeric` version) (Dean Rasheed, David Rowley) [§](https://postgr.es/c/6f88b68ff) [§](https://postgr.es/c/87103002c) +* Make `pg_filenode_relation(0, 0)` return NULL rather than failing (Justin Pryzby) [§](https://postgr.es/c/f479ea94b) +* Make `ALTER EXTENSION` lock the extension when adding or removing a member object (Tom Lane) [§](https://postgr.es/c/1c612bc98) + + The previous coding allowed `ALTER EXTENSION ADD/DROP` to occur concurrently with `DROP EXTENSION`, leading to a crash or corrupt catalog entries. +* Fix `ALTER SUBSCRIPTION` to reject an empty slot name (Japin Li) [§](https://postgr.es/c/bfa2a926d) +* When cloning a partitioned table's triggers to a new partition, ensure that their enabled status is copied (Álvaro Herrera) [§](https://postgr.es/c/c31516ae5) +* Avoid alias conflicts in queries generated for `REFRESH MATERIALIZED VIEW CONCURRENTLY` (Tom Lane, Bharath Rupireddy) [§](https://postgr.es/c/ba9f665a4) [§](https://postgr.es/c/75d66d10e) + + This command failed on materialized views containing columns with certain names, notably `mv` and `newdata`. +* Fix `PREPARE TRANSACTION` to check correctly for conflicting session-lifespan and transaction-lifespan locks (Tom Lane) [§](https://postgr.es/c/f47408cdc) + + A transaction cannot be prepared if it has both session-lifespan and transaction-lifespan locks on the same advisory-lock ID value. This restriction was not fully checked, which could lead to a PANIC during `PREPARE TRANSACTION`. +* Fix misbehavior of `DROP OWNED BY` when the target role is listed more than once in an RLS policy (Tom Lane) [§](https://postgr.es/c/33af10c59) +* Skip unnecessary error tests when removing a role from an RLS policy during `DROP OWNED BY` (Tom Lane) [§](https://postgr.es/c/ba815f00a) + + Notably, this fixes some cases where it was necessary to be a superuser to use `DROP OWNED BY`. +* Re-allow old-style Windows locale names in `CREATE COLLATION` commands (Thomas Munro) [§](https://postgr.es/c/6dcb185bf) + + Previously we were failing because the operating system can't provide version information for such locales. At some point we may decide to require version information, but no such policy exists yet, so re-allow the case for now. +* Disallow whole-row variables in `GENERATED` expressions (Tom Lane) [§](https://postgr.es/c/849c7971d) + + Use of a whole-row variable clearly violates the rule that a generated column cannot depend on itself, so such cases have no well-defined behavior. The actual behavior frequently included a crash. +* Fix usage of `tableoid` in `GENERATED` expressions (Tom Lane) [§](https://postgr.es/c/77e3204ec) + + Some code paths failed to provide a valid value for this system column while evaluating a `GENERATED` expression. +* Don't store a “fast default” when adding a column to a foreign table (Andrew Dunstan) [§](https://postgr.es/c/5b6b5e5ee) + + The fast default is useless since no local heap storage exists for such a table, but it confused subsequent operations. In addition to suppressing creation of such catalog entries in `ALTER TABLE` commands, adjust the downstream code to cope when one is incorrectly present. +* Allow index state flags to be updated transactionally (Michael Paquier, Andrey Lepikhov) [§](https://postgr.es/c/acb60edf0) [§](https://postgr.es/c/fd7bc10ab) + + This avoids failures when dealing with index predicates that aren't really immutable. While that's not considered a supported case, the original reason for using a non-transactional update here is long gone, so we may as well change it. +* Avoid corrupting the plan cache entry when `CREATE DOMAIN` or `ALTER DOMAIN` appears in a cached plan (Tom Lane) [§](https://postgr.es/c/102f31a20) +* Make walsenders show their latest replication commands in `pg_stat_activity` (Tom Lane) [§](https://postgr.es/c/4a20de9d9) + + Previously, a walsender would show its latest SQL command, which was confusing if it's now doing some replication operation instead. Now we show replication-protocol commands on the same footing as SQL commands. +* Make `pg_settings`.`pending_restart` show as true when the pertinent entry in `postgresql.conf` has been removed (Álvaro Herrera) [§](https://postgr.es/c/b8f91d7f9) + + `pending_restart` correctly showed the case where an entry that cannot be changed without a postmaster restart has been modified, but not where the entry had been removed altogether. +* On 64-bit Windows, allow the effective value of `work_mem` times `hash_mem_multiplier` to exceed 2GB (Tom Lane) [§](https://postgr.es/c/2b8f3f5a7) + + This allows `hash_mem_multiplier` to be used for its intended purpose of preventing large hash aggregations from spilling to disk, even when “large” means multiple gigabytes. +* Fix mis-planning of queries involving regular tables that are inheritance children of foreign tables (Amit Langote) [§](https://postgr.es/c/6753a5b7e) + + `SELECT FOR UPDATE` and related commands would fail with assertion failures or “could not find junk column” errors in such cases. +* Fix pullup of constant function-in-FROM results when the FROM item is marked `LATERAL` (Tom Lane) [§](https://postgr.es/c/9807b9aed) +* Fix corner-case failure of a new standby to follow a new primary (Dilip Kumar, Robert Haas) [§](https://postgr.es/c/082656429) [§](https://postgr.es/c/3465328aa) [§](https://postgr.es/c/99a0a2ada) [§](https://postgr.es/c/45322bd9b) [§](https://postgr.es/c/47d5781cb) [§](https://postgr.es/c/d906d106f) + + Under a narrow combination of conditions, the standby could wind up trying to follow the wrong WAL timeline. +* Update minimum recovery point when WAL replay of a transaction abort record causes file truncation (Fujii Masao) [§](https://postgr.es/c/a66b05b42) + + File truncation is irreversible, so it's no longer safe to stop recovery at a point earlier than that record. The corresponding case for transaction commit was fixed years ago, but this one was overlooked. +* Advance oldest-required-WAL-segment horizon properly after a replication slot is invalidated (Kyotaro Horiguchi) [§](https://postgr.es/c/866237a6f) [§](https://postgr.es/c/7099ba058) [§](https://postgr.es/c/ce413eba4) [§](https://postgr.es/c/41d27ee7b) + + If all slots were invalidated, the horizon would not move again, eventually allowing the server's WAL storage to run out of space. +* In walreceivers, avoid attempting catalog lookups after an error (Masahiko Sawada, Bharath Rupireddy) [§](https://postgr.es/c/7fc97752d) +* Ensure that a standby server's startup process will respond to a shutdown signal promptly while waiting for WAL to arrive (Fujii Masao, Soumyadeep Chakraborty) [§](https://postgr.es/c/8d091922f) +* Correctly clear shared state after failing to become a member of a transaction commit group (Amit Kapila) [§](https://postgr.es/c/741deb260) + + Given the right timing, this could cause an assertion failure when some later session re-uses the same PGPROC object. +* Add locking to avoid reading incorrect relmapper data in the face of a concurrent write from another process (Heikki Linnakangas) [§](https://postgr.es/c/2a0ab13f8) [§](https://postgr.es/c/6fb377e5f) +* Improve progress reporting for the sort phase of a parallel btree index build (Matthias van de Meent) [§](https://postgr.es/c/065ce069a) +* Improve checks for violations of replication protocol (Tom Lane) [§](https://postgr.es/c/8b5055812) + + Logical replication workers frequently used Asserts to check for cases that could be triggered by invalid or out-of-order replication commands. This seems unwise, so promote these tests to regular error checks. +* Fix assorted crash cases in logical replication of partitioned-table updates (Amit Langote, Tom Lane) [§](https://postgr.es/c/b270713fd) [§](https://postgr.es/c/fad9c8e93) +* Fix potential crash when firing AFTER triggers of partitioned tables in logical replication workers (Tom Lane) [§](https://postgr.es/c/5b4791b45) +* Fix deadlock when multiple logical replication workers try to truncate the same table (Peter Smith, Haiying Tang) [§](https://postgr.es/c/c83c0257e) +* Fix error cases and memory leaks in logical decoding of speculative insertions (Dilip Kumar) [§](https://postgr.es/c/602a32a68) [§](https://postgr.es/c/56e366f67) +* Fix memory leak in logical replication output (Amit Langote) [§](https://postgr.es/c/d25056812) [§](https://postgr.es/c/357cb8f07) +* Avoid leaving an invalid record-type hash table entry behind after an error (Sait Talha Nisanci) [§](https://postgr.es/c/edd9a2bf7) + + This could lead to later crashes or memory leakage. +* Fix plan cache reference leaks in some error cases in `CREATE TABLE ... AS EXECUTE` (Tom Lane) [§](https://postgr.es/c/d03a41d1c) +* Fix race condition in code for sharing tuple descriptors across parallel workers (Thomas Munro) [§](https://postgr.es/c/d41fda6aa) + + Given the right timing, a crash could result. +* Fix race condition when invalidating an obsolete replication slot concurrently with an attempt to drop or update it (Andres Freund, Álvaro Herrera) [§](https://postgr.es/c/218b10100) +* Fix possible race condition when releasing BackgroundWorkerSlots (Tom Lane) [§](https://postgr.es/c/c3cc73e14) + + It's likely that this doesn't fix any observable bug on Intel hardware, but machines with weaker memory ordering rules could have problems. +* Fix latent crash in sorting code (Ronan Dunklau) [§](https://postgr.es/c/204f646a2) [§](https://postgr.es/c/2fde8e49a) + + One code path could attempt to free a null pointer. The case appears unreachable in the core server's use of sorting, but perhaps it could be triggered by extensions. +* Harden B-tree posting list split code against corrupt data (Peter Geoghegan) [§](https://postgr.es/c/fa675af59) + + Throw an error, rather than crashing, for an attempt to insert an item with a TID identical to an existing entry. While that shouldn't ever happen, it has been reported to happen when the index is inconsistent with its table. +* Prevent infinite loops in SP-GiST index insertion (Tom Lane) [§](https://postgr.es/c/dc714c120) + + In the event that INCLUDE columns take up enough space to prevent a leaf index tuple from ever fitting on a page, the text\_ops operator class would get into an infinite loop vainly trying to make the tuple fit. While pre-v11 versions don't have INCLUDE columns, back-patch this anti-looping fix to them anyway, as it seems like a good defense against bugs in operator classes. +* Ensure that SP-GiST index insertion can be terminated by a query cancel request (Tom Lane, Álvaro Herrera) [§](https://postgr.es/c/c1b72bf04) [§](https://postgr.es/c/63831c162) +* Fix uninitialized-variable bug that could cause PL/pgSQL to act as though an `INTO` clause specified `STRICT`, even though it didn't (Tom Lane) [§](https://postgr.es/c/0fce76b99) +* Don't abort the process for an out-of-memory failure in libpq's printing functions (Tom Lane) [§](https://postgr.es/c/1603deca3) +* In ecpg, allow the `numeric` value INT\_MIN (usually -2147483648) to be converted to integer (John Naylor) [§](https://postgr.es/c/171bf1cea) +* In psql and other client programs, avoid overrunning the ends of strings when dealing with invalidly-encoded data (Tom Lane) [§](https://postgr.es/c/5b6436874) + + An incorrectly-encoded multibyte character near the end of a string could cause various processing loops to run past the string's terminating NUL, with results ranging from no detectable issue to a program crash, depending on what happens to be in the following memory. This is reminiscent of CVE-2006-2313, although these particular cases do not appear to have interesting security consequences. +* Fix pg\_dump to correctly handle triggers on partitioned tables whose enabled status is different from their parent triggers' status (Justin Pryzby, Álvaro Herrera) [§](https://postgr.es/c/cc340af33) +* Avoid “invalid creation date in header” warnings observed when running pg\_restore on an archive file created in a different time zone (Tom Lane) [§](https://postgr.es/c/bc7885b7f) +* Make pg\_upgrade carry forward the old installation's `oldestXID` value (Bertrand Drouvot) [§](https://postgr.es/c/0a5e708e2) + + Previously, the new installation's `oldestXID` was set to a value old enough to (usually) force immediate anti-wraparound autovacuuming. That's not desirable from a performance standpoint; what's worse, installations using large values of `autovacuum_freeze_max_age` could suffer unwanted forced shutdowns soon after an upgrade. +* Extend pg\_upgrade to detect and warn about extensions that should be upgraded (Bruce Momjian) [§](https://postgr.es/c/a81c71e3a) [§](https://postgr.es/c/47a573d91) + + A script file is now produced containing the `ALTER EXTENSION UPDATE` commands needed to bring extensions up to the versions that are considered default in the new installation. +* Avoid problems when switching pg\_receivewal between compressed and non-compressed WAL storage (Michael Paquier) [§](https://postgr.es/c/fb2b86015) [§](https://postgr.es/c/2c7395aad) +* Fix `contrib/postgres_fdw` to work usefully with generated columns (Etsuro Fujita) [§](https://postgr.es/c/388a81bf4) + + `postgres_fdw` will now behave reasonably with generated columns, so long as a generated column in a foreign table represents a generated column in the remote table. `IMPORT FOREIGN SCHEMA` will now import generated columns that way by default. +* In `contrib/postgres_fdw`, avoid attempting catalog lookups after an error (Tom Lane) [§](https://postgr.es/c/bee18616a) + + While this usually worked, it's not very safe since the error might have been one that made catalog access nonfunctional. A side effect of the fix is that messages about data conversion errors will now mention the query's table and column aliases (if used) rather than the true underlying name of a foreign table or column. +* Improve the isolation-test infrastructure (Tom Lane, Michael Paquier) [§](https://postgr.es/c/e2cde85ef) [§](https://postgr.es/c/b961bdfe1) [§](https://postgr.es/c/5179a1ab7) [§](https://postgr.es/c/989d23b04) [§](https://postgr.es/c/06fdc4e4d) [§](https://postgr.es/c/9903338b5) [§](https://postgr.es/c/2d0944865) + + Allow isolation test steps to be annotated to show the expected completion order. This allows getting stable results from otherwise-racy test cases, without the long delays that we previously used (not entirely successfully) to fend off race conditions. Allow non-quoted identifiers as isolation test session/step names (formerly, all such names had to be double-quoted). Detect and warn about unused steps in isolation tests. Improve display of query results in isolation tests. Remove isolationtester's “dry-run” mode. Remove memory leaks in isolationtester itself. +* Reduce overhead of cache-clobber testing (Tom Lane) [§](https://postgr.es/c/2f487116e) [§](https://postgr.es/c/834d9284b) +* Fix PL/Python's regression tests to pass with Python 3.10 (Honza Horak) [§](https://postgr.es/c/3989f8fb9) +* Make `printf("%s", NULL)` print `(null)` instead of crashing (Tom Lane) [§](https://postgr.es/c/c0a6f83de) + + This should improve server robustness in corner cases, and it syncs our `printf` implementation with common libraries. +* Fix incorrect log message when point-in-time recovery stops at a `ROLLBACK PREPARED` record (Simon Riggs) [§](https://postgr.es/c/41edb2db1) +* Improve `ALTER TABLE`'s messages for wrong-relation-kind errors (Kyotaro Horiguchi) [§](https://postgr.es/c/522624345) +* Clarify error messages referring to “non-negative” values (Bharath Rupireddy) [§](https://postgr.es/c/92913fc29) +* Fix configure to work with OpenLDAP 2.5, which no longer has a separate `libldap_r` library (Adrian Ho, Tom Lane) [§](https://postgr.es/c/55cccdfdf) [§](https://postgr.es/c/cbcf5ffb1) [§](https://postgr.es/c/32d0bdbfc) [§](https://postgr.es/c/9fca23c1d) + + If there is no `libldap_r` library, we now silently assume that `libldap` is thread-safe. +* Add new make targets `world-bin` and `install-world-bin` (Andrew Dunstan) [§](https://postgr.es/c/bd0be7f7a) [§](https://postgr.es/c/8d2be1402) + + These are the same as `world` and `install-world` respectively, except that they do not build or install the documentation. +* Fix make rule for TAP tests (`prove_installcheck`) to work in PGXS usage (Andrew Dunstan) [§](https://postgr.es/c/a8b564b0c) +* Adjust JIT code to prepare for forthcoming LLVM API change (Thomas Munro, Andres Freund) [§](https://postgr.es/c/d9c05a9ec) + + LLVM 13 has made an incompatible API change that will cause crashing of our previous JIT compiler. +* Avoid assuming that strings returned by GSSAPI libraries are null-terminated (Tom Lane) [§](https://postgr.es/c/13f365568) + + The GSSAPI spec provides for a string pointer and length. It seems that in practice the next byte after the string is usually zero, so that our previous coding didn't actually fail; but we do have a report of AddressSanitizer complaints. +* Enable building with GSSAPI on MSVC (Michael Paquier) [§](https://postgr.es/c/ab81d004e) [§](https://postgr.es/c/e2f21ff60) [§](https://postgr.es/c/949e32ee5) + + Fix various incompatibilities with modern Kerberos builds. +* In MSVC builds, include `--with-pgport` in the set of configure options reported by pg\_config, if it had been specified (Andrew Dunstan) [§](https://postgr.es/c/c828a7246) [§](https://postgr.es/c/bb18bc224) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-5.html "E.19. Release 13.5") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-3.html "E.21. Release 13.3") | +| E.19. Release 13.5 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.21. Release 13.3 | + +[Previous](/docs/release/13.3/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.5/) diff --git a/corpus/changelog/postgresql_releases/postgresql_135.md b/corpus/changelog/postgresql_releases/postgresql_135.md new file mode 100644 index 0000000000000000000000000000000000000000..c55b95185d71747312802ec6f7d89e3b690f7714 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_135.md @@ -0,0 +1,251 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.5/ +Version: 13.5 + +## PostgreSQL 13.5 + +| E.19. Release 13.5 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-6.html "E.18. Release 13.6") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-4.html "E.20. Release 13.4") | + +--- + +## E.19. Release 13.5 + +[E.19.1. Migration to Version 13.5](release-13-5.html#id-1.11.6.24.4) + +[E.19.2. Changes](release-13-5.html#id-1.11.6.24.5) + +**Release date:**2021-11-11 + +This release contains a variety of fixes from 13.4. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +### E.19.1. Migration to Version 13.5 + +A dump/restore is not required for those running 13.X. + +However, note that installations using physical replication should update standby servers before the primary server, as explained in the third changelog entry below. + +Also, several bugs have been found that may have resulted in corrupted indexes, as explained in the next several changelog entries. If any of those cases apply to you, it's recommended to reindex possibly-affected indexes after updating. + +Also, if you are upgrading from a version earlier than 13.2, see [Section E.22](release-13-2.html "E.22. Release 13.2"). + +### E.19.2. Changes + +* Make the server reject extraneous data after an SSL or GSS encryption handshake (Tom Lane) [§](https://postgr.es/c/e92ed93e8) + + A man-in-the-middle with the ability to inject data into the TCP connection could stuff some cleartext data into the start of a supposedly encryption-protected database session. This could be abused to send faked SQL commands to the server, although that would only work if the server did not demand any authentication data. (However, a server relying on SSL certificate authentication might well not do so.) + + The PostgreSQL Project thanks Jacob Champion for reporting this problem. (CVE-2021-23214) +* Make libpq reject extraneous data after an SSL or GSS encryption handshake (Tom Lane) [§](https://postgr.es/c/844b31692) + + A man-in-the-middle with the ability to inject data into the TCP connection could stuff some cleartext data into the start of a supposedly encryption-protected database session. This could probably be abused to inject faked responses to the client's first few queries, although other details of libpq's behavior make that harder than it sounds. A different line of attack is to exfiltrate the client's password, or other sensitive data that might be sent early in the session. That has been shown to be possible with a server vulnerable to CVE-2021-23214. + + The PostgreSQL Project thanks Jacob Champion for reporting this problem. (CVE-2021-23222) +* Fix physical replication for cases where the primary crashes after shipping a WAL segment that ends with a partial WAL record (Álvaro Herrera) [§](https://postgr.es/c/1d97d3d08) [§](https://postgr.es/c/2cdf97fd1) [§](https://postgr.es/c/17227825c) + + If the primary did not survive long enough to finish writing the rest of the incomplete WAL record, then the previous crash-recovery logic had it back up and overwrite WAL starting from the beginning of the incomplete WAL record. This is problematic since standby servers may already have copies of that WAL segment. They will then see an inconsistent next segment, and will not be able to recover without manual intervention. To fix, do not back up over a WAL segment boundary when restarting after a crash. Instead write a new type of WAL record at the start of the next WAL segment, informing readers that the incomplete WAL record will never be finished and must be disregarded. + + When applying this update, it's best to update standby servers before the primary, so that they will be ready to handle this new WAL record type if the primary happens to crash. +* Fix `CREATE INDEX CONCURRENTLY` to wait for the latest prepared transactions (Andrey Borodin) [§](https://postgr.es/c/a9d0a5409) + + Rows inserted by just-prepared transactions might be omitted from the new index, causing queries relying on the index to miss such rows. The previous fix for this type of problem failed to account for `PREPARE TRANSACTION` commands that were still in progress when `CREATE INDEX CONCURRENTLY` checked for them. As before, in installations that have enabled prepared transactions (`max_prepared_transactions` > 0), it's recommended to reindex any concurrently-built indexes in case this problem occurred when they were built. +* Avoid race condition that can cause backends to fail to add entries for new rows to an index being built concurrently (Noah Misch, Andrey Borodin) [§](https://postgr.es/c/2e33b4359) + + While it's apparently rare in the field, this case could potentially affect any index built or reindexed with the `CONCURRENTLY` option. It is recommended to reindex any such indexes to make sure they are correct. +* Fix `float4` and `float8` hash functions to produce uniform results for NaNs (Tom Lane) [§](https://postgr.es/c/be2beadaf) [§](https://postgr.es/c/9089f1543) [§](https://postgr.es/c/2c0dd669c) + + Since PostgreSQL's floating-point types deem all NaNs to be equal, it's important for the hash functions to produce the same hash code for all bit-patterns that are NaNs according to the IEEE 754 standard. This failed to happen before, meaning that hash indexes and hash-based query plans might produce incorrect results for non-canonical NaN values. (`'-NaN'::float8` is one way to produce such a value on most machines.) It is advisable to reindex hash indexes on floating-point columns, if there is any possibility that they might contain such values. +* Fix `REINDEX CONCURRENTLY` to preserve operator class parameters that were attached to the target index (Michael Paquier) [§](https://postgr.es/c/77f7909a4) +* Prevent data loss during crash recovery of `CREATE TABLESPACE`, when `wal_level` = `minimal` (Noah Misch) [§](https://postgr.es/c/b18669f5e) + + If the server crashed between `CREATE TABLESPACE` and the next checkpoint, replay would fully remove the contents of the new tablespace's directory, relying on subsequent WAL replay to restore everything within that directory. This interacts badly with optimizations that skip writing WAL (one example is `COPY` into a just-created table). Such optimizations are applied only when `wal_level` is `minimal`, which is not the default in v10 and later. +* Ensure that the relation cache is invalidated for a table being attached to or detached from a partitioned table (Amit Langote, Álvaro Herrera) [§](https://postgr.es/c/fe35528a5) + + This oversight could allow misbehavior of subsequent inserts/updates addressed directly to the partition, but only in currently-existing sessions. +* Ensure that the relation cache is invalidated for all partitions of a partitioned table that is being added to or removed from a publication (Hou Zhijie, Vignesh C) [§](https://postgr.es/c/f09a81f1c) + + This oversight could lead to improper replication behavior until all currently-existing sessions have exited. +* Ensure that the relation cache is invalidated when creating or dropping a `FOR ALL TABLES` publication (Hou Zhijie, Vignesh C) [§](https://postgr.es/c/ddfc7299d) + + This oversight could lead to improper replication behavior until all currently-existing sessions have exited. +* Don't discard a cast to the same type with unspecified type modifier (Tom Lane) [§](https://postgr.es/c/dede14399) + + For example, if column `f1` is of type `numeric(18,3)`, the parser used to simply discard a cast like `f1::numeric`, on the grounds that it would have no run-time effect. That's true, but the exposed type of the expression should still be considered to be plain `numeric`, not `numeric(18,3)`. This is important for correctly resolving the type of larger constructs, such as recursive `UNION`s. +* Fix updates of element fields in arrays of domain over composite (Tom Lane) [§](https://postgr.es/c/30e61a8cd) + + A command such as `UPDATE tab SET fld[1].subfld = val` failed if the array's elements were domains rather than plain composites. +* Disallow the combination of `FETCH FIRST WITH TIES` and `FOR UPDATE SKIP LOCKED` (David Christensen) [§](https://postgr.es/c/170206e45) + + `FETCH FIRST WITH TIES` necessarily fetches one more row than requested, since it cannot stop until it finds a row that is not a tie. In our current implementation, if `FOR UPDATE` is used then that row will also get locked even though it is not returned. That results in undesirable behavior if the `SKIP LOCKED` option is specified. It's difficult to change this without introducing a different set of undesirable behaviors, so for now, forbid the combination. +* Disallow creating an ICU collation if the current database's encoding won't support it (Tom Lane) [§](https://postgr.es/c/132be6000) + + Previously this was allowed, but then the collation could not be referenced because of the way collation lookup works; you could not use the collation, nor even drop it. +* Disallow `ALTER INDEX index ALTER COLUMN col SET (options)` (Nathan Bossart, Michael Paquier) [§](https://postgr.es/c/85dc4292a) + + While the parser accepted this, it's undocumented and doesn't actually work. +* Fix corner-case loss of precision in numeric `power()` (Dean Rasheed) [§](https://postgr.es/c/9ab94ccb1) + + The result could be inaccurate when the first argument is very close to 1. +* Avoid regular expression errors with capturing parentheses inside `{0}` (Tom Lane) [§](https://postgr.es/c/071146184) + + Regular expressions like `(.){0}...\1` drew “invalid backreference number”. Other regexp engines such as Perl don't complain, though, and for that matter ours doesn't either in some closely related cases. Worse, it could throw an assertion failure instead. Fix it so that no error is thrown and instead the back-reference is silently deemed to never match. +* Prevent regular expression back-references from sometimes matching when they shouldn't (Tom Lane) [§](https://postgr.es/c/9a327179c) + + The regexp engine was careless about clearing match data for capturing parentheses after rejecting a partial match. This could allow a later back-reference to match in places where it should fail for lack of a defined referent. +* Fix regular expression performance bug with back-references inside iteration nodes (Tom Lane) [§](https://postgr.es/c/b30f7f399) + + Incorrect back-tracking logic could result in exponential time spent looking for a match. Fortunately the problem is masked in most cases by other optimizations. +* Fix incorrect results from `AT TIME ZONE` applied to a `time with time zone` value (Tom Lane) [§](https://postgr.es/c/d8a266c5e) + + The results were incorrect if the target time zone was specified by a dynamic timezone abbreviation (that is, one that is defined as equivalent to a full time zone name, rather than a fixed UTC offset). +* Fix planner error with pulling up subquery expressions into function rangetable entries (Tom Lane) [§](https://postgr.es/c/fdd6a4d8d) + + If a function in `FROM` laterally references the output of some sub-`SELECT` earlier in the `FROM` clause, and we are able to flatten that sub-`SELECT` into the outer query, the expression(s) copied into the function expression were not fully processed. This could lead to crashes at execution. +* Fix mistranslation of PlaceHolderVars to inheritance child relations (Tom Lane) [§](https://postgr.es/c/e0b0d1eab) + + This error could result in assertion failures, or in mis-planning of queries having partitioned or inherited tables on the nullable side of an outer join. +* Avoid using MCV-only statistics to estimate the range of a column (Tom Lane) [§](https://postgr.es/c/7adbe186f) + + There are corner cases in which `ANALYZE` will build a most-common-values (MCV) list but not a histogram, even though the MCV list does not account for all the observed values. In such cases, keep the planner from using the MCV list alone to estimate the range of column values. +* Fix restoration of a Portal's snapshot inside a subtransaction (Bertrand Drouvot) [§](https://postgr.es/c/04ef2021e) + + If a procedure commits or rolls back a transaction, and then its next significant action is inside a new subtransaction, snapshot management went wrong, leading to a dangling pointer and probable crash. A typical example in PL/pgSQL is a `COMMIT` immediately followed by a `BEGIN ... EXCEPTION` block that performs a query. +* Clean up correctly if a transaction fails after exporting its snapshot (Dilip Kumar) [§](https://postgr.es/c/8f4fe8d7f) + + This oversight would only cause a problem if the same session attempted to export a snapshot again. The most likely scenario for that is creation of a replication slot (followed by rollback) and then creation of another replication slot. +* Prevent wraparound of overflowed-subtransaction tracking on standby servers (Kyotaro Horiguchi, Alexander Korotkov) [§](https://postgr.es/c/e1fee28a0) + + This oversight could cause significant performance degradation (manifesting as excessive SubtransSLRU traffic) on standby servers. +* Ensure that prepared transactions are properly accounted for during promotion of a standby server (Michael Paquier, Andres Freund) [§](https://postgr.es/c/194e535a0) + + There was a narrow window where a prepared transaction could be omitted from a snapshot taken by a concurrently-running session. If that session then used the snapshot to perform data updates, erroneous results or data corruption could occur. +* Disallow `LISTEN` in background workers (Tom Lane) [§](https://postgr.es/c/e06cc024b) + + There's no infrastructure to support this, so if someone did it, it would only result in preventing cleanup of the `NOTIFY` queue. +* Send `NOTIFY` signals to other backends during transaction commit, not in the server's idle loop (Artur Zakirov, Tom Lane) [§](https://postgr.es/c/63f28776c) + + This change allows notifications to be delivered immediately after an intra-procedure `COMMIT`. It also allows logical replication workers to send notifications. +* Refuse to rewind a cursor marked `NO SCROLL` if it has been held over from a previous transaction due to the `WITH HOLD` option (Tom Lane) [§](https://postgr.es/c/fa5d0415f) + + We have long forbidden fetching backwards from a `NO SCROLL` cursor, but for historical reasons the prohibition didn't extend to cases in which we rewind the query altogether and then re-fetch forwards. That exception leads to inconsistencies, particularly for held-over cursors which may not have stored all the data necessary to rewind. Disallow rewinding for non-scrollable held-over cursors to block the worst inconsistencies. (v15 will remove the exception altogether.) +* Fix possible failure while saving a `WITH HOLD` cursor at transaction end, if it had already been read to completion (Tom Lane) [§](https://postgr.es/c/d8d93bc8b) +* Fix detection of a relation that has grown to the maximum allowed length (Tom Lane) [§](https://postgr.es/c/04118de78) + + An attempt to extend a table or index past the limit of 2^32-1 blocks was rejected, but not soon enough to prevent inconsistent internal state from being created. +* Correctly track the presence of data-modifying CTEs when expanding a `DO INSTEAD` rule (Greg Nancarrow, Tom Lane) [§](https://postgr.es/c/cbba6ba3a) + + The previous failure to do this could lead to problems such as unsafely choosing a parallel plan. +* Fix incorrect reporting of permissions failures on extended statistics objects (Tomas Vondra) [§](https://postgr.es/c/1fe1a04af) [§](https://postgr.es/c/c8213aa94) + + The code typically produced “cache lookup error” rather than the intended message. +* Fix incorrect snapshot handling in parallel workers (Greg Nancarrow) [§](https://postgr.es/c/bc062cb93) + + This oversight could lead to misbehavior in parallel queries if the transaction isolation level is less than `REPEATABLE READ`. +* Fix logical decoding to correctly ignore toast-table changes for transient tables (Bertrand Drouvot) [§](https://postgr.es/c/794025eff) + + Logical decoding normally ignores changes in transient tables such as those created during an `ALTER TABLE` heap rewrite. But that filtering wasn't applied to the associated toast table if any, leading to possible errors when rewriting a table that's being published. +* Fix logical decoding's memory usage accounting to handle TOAST data correctly (Bertrand Drouvot) [§](https://postgr.es/c/58cf794ca) +* Ensure that walreceiver processes create all required archive notification files before exiting (Fujii Masao) [§](https://postgr.es/c/dd9b3fced) + + If a walreceiver exited exactly at a WAL segment boundary, it failed to make a notification file for the last-received segment, thus delaying archiving of that segment on the standby. +* Fix computation of the WAL range to include in a backup manifest when a timeline change is involved (Kyotaro Horiguchi) [§](https://postgr.es/c/29f942325) [§](https://postgr.es/c/d6d68e223) +* Avoid trying to lock the `OLD` and `NEW` pseudo-relations in a rule that uses `SELECT FOR UPDATE` (Masahiko Sawada, Tom Lane) [§](https://postgr.es/c/7fa367d96) +* Fix parser's processing of aggregate `FILTER` clauses (Tom Lane) [§](https://postgr.es/c/ecd4dd9f1) + + If the `FILTER` expression is a plain boolean column, the semantic level of the aggregate could be mis-determined, leading to not-per-spec behavior. If the `FILTER` expression is itself a boolean-returning aggregate, an error should be thrown but was not, likely resulting in a crash at execution. +* Ensure that the correct lock level is used when renaming a table (Nathan Bossart, Álvaro Herrera) [§](https://postgr.es/c/842fe6123) [§](https://postgr.es/c/a73a3671d) + + For historical reasons, `ALTER INDEX ... RENAME` can be applied to any sort of relation. The lock level required to rename an index is lower than that required to rename a table or other kind of relation, but the code got this wrong and would use the weaker lock level whenever the command is spelled `ALTER INDEX`. +* Prevent `ALTER TYPE/DOMAIN/OPERATOR ... SET` from changing extension membership (Tom Lane) [§](https://postgr.es/c/7b01246e1) + + `ALTER ... SET` executed by an extension script would cause the target object to become a member of the extension if it was not already. In itself this isn't too troubling, since there's little reason for an extension script to touch an object not belonging to the extension. But `ALTER TYPE SET` will recurse to dependent domains, thus causing them to also become extension members. This causes unwanted side-effects from extension upgrade scripts that use that command to adjust the properties of a base type belonging to the extension. Fix by redefining these `ALTER` cases to never change extension membership. +* Avoid trying to clean up LLVM state after an error within LLVM (Andres Freund, Justin Pryzby) [§](https://postgr.es/c/c49e6f9d9) + + This prevents a likely crash during backend exit after a fatal LLVM error. +* Avoid null-pointer-dereference crash when dropping a role that owns objects being dropped concurrently (Álvaro Herrera) [§](https://postgr.es/c/bf5cdcfd5) +* Prevent “snapshot reference leak” warning when `lo_export()` or a related function fails (Heikki Linnakangas) [§](https://postgr.es/c/07070c008) [§](https://postgr.es/c/b7299b664) +* Ensure that scans of SP-GiST indexes are counted in the statistics views (Tom Lane) [§](https://postgr.es/c/dbb239d51) + + Incrementing the number-of-index-scans counter was overlooked in the SP-GiST code, although per-tuple counters were advanced correctly. +* Fix inefficient code generation for CoerceToDomain expression nodes (Ranier Vilela) [§](https://postgr.es/c/ada667b45) +* Recalculate relevant wait intervals if `recovery_min_apply_delay` is changed during recovery (Soumyadeep Chakraborty, Ashwin Agrawal) [§](https://postgr.es/c/7f0873f32) +* Fix infinite loop if a `simplehash.h` hash table reaches 2^32 elements (Yura Sokolov) [§](https://postgr.es/c/4873da79d) + + It seems unlikely that this bug has been hit in practice, as it would require `work_mem` settings of hundreds of gigabytes for existing uses of `simplehash.h`. +* Avoid O(N^2) behavior in some list-manipulation operations (Nathan Bossart, Tom Lane) [§](https://postgr.es/c/df238aed1) [§](https://postgr.es/c/e477642a1) [§](https://postgr.es/c/0151af40c) + + These changes fix slow processing in several scenarios, including: when a standby replays a transaction that held many exclusive locks on the primary; when many files are due to be unlinked after a checkpoint; when hash aggregation involves many batches; and when `pg_trgm` extracts indexable conditions from a complex regular expression. Only the first of these scenarios has actually been reported from the field, but they all seem like plausible consequences of inefficient list deletions. +* Reduce memory consumption during calculation of extended statistics (Justin Pryzby, Tomas Vondra) [§](https://postgr.es/c/b564eb018) [§](https://postgr.es/c/c0386f403) +* Add more defensive checks around B-tree posting list splits (Peter Geoghegan) [§](https://postgr.es/c/f8cce4a3d) [§](https://postgr.es/c/d5a2ffbce) + + This change should help detect index corruption involving duplicate table TIDs. +* Disallow setting `huge_pages` to `on` when `shared_memory_type` is `sysv` (Thomas Munro) [§](https://postgr.es/c/24b7cf8a5) + + Previously, this setting was accepted, but it did nothing for lack of any implementation. +* Fix missing libpq functions on AIX (Tony Reix) [§](https://postgr.es/c/aae398a87) + + Code reorganization led to the following documented functions not being exported from libpq on AIX: `pg_encoding_to_char()`, `pg_utf_mblen()`, `pg_char_to_encoding()`, `pg_valid_server_encoding()`, and `pg_valid_server_encoding_id()`. Restore them to visibility. +* Fix ecpg to recover correctly after `malloc()` failure while establishing a connection (Michael Paquier) [§](https://postgr.es/c/b589d212f) +* Fix misevaluation of stable functions called in the arguments of a PL/pgSQL `CALL` statement (Tom Lane) [§](https://postgr.es/c/5f0a073cb) + + They were being called with an out-of-date snapshot, so that they would not see any database changes made since the start of the session's top-level command. +* Allow `EXIT` out of the outermost block in a PL/pgSQL routine (Tom Lane) [§](https://postgr.es/c/745abdd95) + + If the routine does not require an explicit `RETURN`, this usage should be valid, but it was rejected. +* Remove pg\_ctl's hard-coded limits on the total length of generated commands (Phil Krylov) [§](https://postgr.es/c/742b30cae) + + For example, this removes a restriction on how many command-line options can be passed through to the postmaster. Individual path names that pg\_ctl deals with, such as the postmaster executable's name or the data directory name, are still limited to `MAXPGPATH` bytes in most cases. +* Fix pg\_dump to dump non-global default privileges correctly (Neil Chen, Masahiko Sawada) [§](https://postgr.es/c/476006023) + + If a global (unrestricted) `ALTER DEFAULT PRIVILEGES` command revoked some present-by-default privilege, for example `EXECUTE` for functions, and then a restricted `ALTER DEFAULT PRIVILEGES` command granted that privilege again for a selected role or schema, pg\_dump failed to dump the restricted privilege grant correctly. +* Make pg\_dump acquire shared lock on partitioned tables that are to be dumped (Tom Lane) [§](https://postgr.es/c/6a262ba8c) + + This oversight was usually pretty harmless, since once pg\_dump has locked any of the leaf partitions, that would suffice to prevent significant DDL on the partitioned table itself. However problems could ensue when dumping a childless partitioned table, since no relevant lock would be held. +* Improve pg\_dump's performance by avoiding making per-table queries for RLS policies, and by avoiding repetitive calls to `format_type()` (Tom Lane) [§](https://postgr.es/c/db11b4a3d) [§](https://postgr.es/c/904ce45bf) + + These changes provide only marginal improvement when dumping from a local server, but a dump from a remote server can benefit substantially due to fewer network round-trips. +* Fix crash in pg\_dump when attempting to dump trigger definitions from a pre-8.3 server (Tom Lane) [§](https://postgr.es/c/0b5f557b7) +* Fix incorrect filename in pg\_restore's error message about an invalid large object TOC file (Daniel Gustafsson) [§](https://postgr.es/c/687fe8a9d) +* Ensure that pgbench exits with non-zero status after a socket-level failure (Yugo Nagata, Fabien Coelho) [§](https://postgr.es/c/3cc85d7d5) [§](https://postgr.es/c/8cf4f7118) + + The desired behavior is to finish out the run but then exit with status 2. Also, fix the reporting of such errors. +* Fix failure of `contrib/btree_gin` indexes on `"char"` (not `char(n)`) columns, when an indexscan using the `<` or `<=` operator is performed (Tom Lane) [§](https://postgr.es/c/7ba487cf9) + + Such an indexscan failed to return all the entries it should. +* Change `contrib/pg_stat_statements` to read its “query texts” file in units of at most 1GB (Tom Lane) [§](https://postgr.es/c/3a5b313ce) + + Such large query text files are very unusual, but if they do occur, the previous coding would fail on Windows 64 (which rejects individual read requests of more than 2GB). +* Fix null-pointer crash when `contrib/postgres_fdw` tries to report a data conversion error (Tom Lane) [§](https://postgr.es/c/aee83f39a) +* Add spinlock support for the RISC-V architecture (Marek Szuba) [§](https://postgr.es/c/48695decc) + + This is essential for reasonable performance on that platform. +* Support OpenSSL 3.0.0 (Peter Eisentraut, Daniel Gustafsson, Michael Paquier) [§](https://postgr.es/c/a69e1506f) [§](https://postgr.es/c/135d8687a) [§](https://postgr.es/c/8e7199453) [§](https://postgr.es/c/abb9ee92c) +* Set correct type identifier on OpenSSL BIO (I/O abstraction) objects created by PostgreSQL (Itamar Gafni) [§](https://postgr.es/c/e15f32f0e) + + This oversight probably only matters for code that is doing tasks like auditing the OpenSSL installation. But it's nominally a violation of the OpenSSL API, so fix it. +* Fix our `pkg-config` files to again support static linking of libpq (Peter Eisentraut) [§](https://postgr.es/c/9f9ae019d) +* Make `pg_regexec()` robust against an out-of-range *`search_start`* parameter (Tom Lane) [§](https://postgr.es/c/7e420072e) + + Return `REG_NOMATCH`, instead of possibly crashing, when *`search_start`* is past the end of the string. This case is probably unreachable within core PostgreSQL, but extensions might be more careless about the parameter value. +* Ensure that `GetSharedSecurityLabel()` can be used in a newly-started session that has not yet built its critical relation cache entries (Jeff Davis) [§](https://postgr.es/c/20f785732) +* Use the CLDR project's data to map Windows time zone names to IANA time zones (Tom Lane) [§](https://postgr.es/c/9c76689de) [§](https://postgr.es/c/7ba8eb81f) [§](https://postgr.es/c/c53ff69e1) + + When running on Windows, initdb attempts to set the new cluster's `timezone` parameter to the IANA time zone matching the system's prevailing time zone. We were using a mapping table that we'd generated years ago and updated only fitfully; unsurprisingly, it contained a number of errors as well as omissions of recently-added zones. It turns out that CLDR has been tracking the most appropriate mappings, so start using their data. This change will not affect any existing installation, only newly-initialized clusters. +* Update time zone data files to tzdata release 2021e for DST law changes in Fiji, Jordan, Palestine, and Samoa, plus historical corrections for Barbados, Cook Islands, Guyana, Niue, Portugal, and Tonga. (Tom Lane) [§](https://postgr.es/c/4cd72add0) + + Also, the Pacific/Enderbury zone has been renamed to Pacific/Kanton. Also, the following zones have been merged into nearby, more-populous zones whose clocks have agreed with them since 1970: Africa/Accra, America/Atikokan, America/Blanc-Sablon, America/Creston, America/Curacao, America/Nassau, America/Port\_of\_Spain, Antarctica/DumontDUrville, and Antarctica/Syowa. In all these cases, the previous zone name remains as an alias. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-6.html "E.18. Release 13.6") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-4.html "E.20. Release 13.4") | +| E.18. Release 13.6 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.20. Release 13.4 | + +[Previous](/docs/release/13.4/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.6/) diff --git a/corpus/changelog/postgresql_releases/postgresql_136.md b/corpus/changelog/postgresql_releases/postgresql_136.md new file mode 100644 index 0000000000000000000000000000000000000000..9911f4a0c08e584a8362998fdf68c86f10a14980 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_136.md @@ -0,0 +1,145 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.6/ +Version: 13.6 + +## PostgreSQL 13.6 + +| E.18. Release 13.6 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-7.html "E.17. Release 13.7") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-5.html "E.19. Release 13.5") | + +--- + +## E.18. Release 13.6 + +[E.18.1. Migration to Version 13.6](release-13-6.html#id-1.11.6.23.4) + +[E.18.2. Changes](release-13-6.html#id-1.11.6.23.5) + +**Release date:**2022-02-10 + +This release contains a variety of fixes from 13.5. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +### E.18.1. Migration to Version 13.6 + +A dump/restore is not required for those running 13.X. + +However, if you have applied `REINDEX CONCURRENTLY` to a TOAST table's index, or observe failures to access TOAST datums, see the first changelog entry below. + +Also, if you are upgrading from a version earlier than 13.5, see [Section E.19](release-13-5.html "E.19. Release 13.5"). + +### E.18.2. Changes + +* Enforce standard locking protocol for TOAST table updates, to prevent problems with `REINDEX CONCURRENTLY` (Michael Paquier) [§](https://postgr.es/c/9acea52ea) + + If applied to a TOAST table or TOAST table's index, `REINDEX CONCURRENTLY` tended to produce a corrupted index. This happened because sessions updating TOAST entries released their `ROW EXCLUSIVE` locks immediately, rather than holding them until transaction commit as all other updates do. The fix is to make TOAST updates hold the table lock according to the normal rule. Any existing corrupted indexes can be repaired by reindexing again. +* Avoid null-pointer crash in `ALTER STATISTICS` when the statistics object is dropped concurrently (Tomas Vondra) [§](https://postgr.es/c/267ccc38b) +* Fix incorrect plan creation for parallel single-child Append nodes (David Rowley) [§](https://postgr.es/c/f8807e774) + + In some cases the Append would be simplified away when it should not be, leading to wrong query results (duplicated rows). +* Fix index-only scan plans for cases where not all index columns can be returned (Tom Lane) [§](https://postgr.es/c/45ae42714) [§](https://postgr.es/c/20d08b2c6) + + If an index has both returnable and non-returnable columns, and one of the non-returnable columns is an expression using a table column that appears in a returnable index column, then a query using that expression could result in an index-only scan plan that attempts to read the non-returnable column, instead of recomputing the expression from the returnable column as intended. The non-returnable column would read as NULL, resulting in wrong query results. +* Ensure that casting to an unspecified typmod generates a RelabelType node rather than a length-coercion function call (Tom Lane) [§](https://postgr.es/c/da0d8a454) + + While the coercion function should do the right thing (nothing), this translation is undesirably inefficient. +* Fix checking of `anycompatible`-family data type matches (Tom Lane) [§](https://postgr.es/c/5ad70564f) + + In some cases the parser would think that a function or operator with `anycompatible`-family polymorphic parameters matches a set of arguments that it really shouldn't match. In reported cases, that led to matching more than one operator to a call, leading to ambiguous-operator errors; but a failure later on is also possible. +* Fix WAL replay failure when database consistency is reached exactly at a WAL page boundary (Álvaro Herrera) [§](https://postgr.es/c/ef41c3fd6) +* Fix startup of a physical replica to tolerate transaction ID wraparound (Abhijit Menon-Sen, Tomas Vondra) [§](https://postgr.es/c/e90f258ac) + + If a replica server is started while the set of active transactions on the primary crosses a wraparound boundary (so that there are some newer transactions with smaller XIDs than older ones), the replica would fail with “out-of-order XID insertion in KnownAssignedXids”. The replica would retry, but could never get past that error. +* In logical replication, avoid double transmission of a child table's data (Hou Zhijie) [§](https://postgr.es/c/3f06c00cf) + + If a publication includes both child and parent tables, and has the `publish_via_partition_root` option set, subscribers uselessly initiated synchronization on both child and parent tables. Ensure that only the parent table is synchronized in such cases. +* Remove lexical limitations for SQL commands issued on a logical replication connection (Tom Lane) [§](https://postgr.es/c/d67354d87) [§](https://postgr.es/c/c94c6612d) + + The walsender process would fail for a SQL command containing an unquoted semicolon, or with dollar-quoted literals containing odd numbers of single or double quote marks, or when the SQL command starts with a comment. Moreover, faulty error recovery could lead to unexpected errors in later commands too. +* Fix possible loss of the commit timestamp for the last subtransaction of a transaction (Alex Kingsborough, Kyotaro Horiguchi) [§](https://postgr.es/c/b5f634116) +* Be sure to `fsync` the `pg_logical/mappings` subdirectory during checkpoints (Nathan Bossart) [§](https://postgr.es/c/fd48e5f5d) + + On some filesystems this oversight could lead to losing logical rewrite status files after a system crash. +* Build extended statistics for partitioned tables (Justin Pryzby) [§](https://postgr.es/c/d6817032d) + + A previous bug fix disabled building of extended statistics for old-style inheritance trees, but it also prevented building them for partitioned tables, which was an unnecessary restriction. This change allows `ANALYZE` to compute values for statistics objects for partitioned tables. (But note that autovacuum does not process partitioned tables as such, so you must periodically issue manual `ANALYZE` on the partitioned table if you want to maintain such statistics.) +* Ignore extended statistics for inheritance trees (Justin Pryzby) [§](https://postgr.es/c/acfde7c58) + + Currently, extended statistics values are only computed locally for each table, not for entire inheritance trees. However the values were mistakenly consulted when planning queries across inheritance trees, possibly resulting in worse-than-default estimates. +* Disallow altering data type of a partitioned table's columns when the partitioned table's row type is used as a composite type elsewhere (Tom Lane) [§](https://postgr.es/c/86d4bbb56) + + This restriction has long existed for regular tables, but through an oversight it was not checked for partitioned tables. +* Disallow `ALTER TABLE ... DROP NOT NULL` for a column that is part of a replica identity index (Haiying Tang, Hou Zhijie) [§](https://postgr.es/c/37827de43) + + The same prohibition already existed for primary key indexes. +* Correctly update cached table state during `ALTER TABLE ADD PRIMARY KEY USING INDEX` (Hou Zhijie) [§](https://postgr.es/c/31b7b4d26) + + Concurrent sessions failed to update their opinion of whether the table has a primary key, possibly causing incorrect logical replication behavior. +* Correctly update cached table state when switching `REPLICA IDENTITY` index (Tang Haiying, Hou Zhijie) [§](https://postgr.es/c/63c3eeddc) + + Concurrent sessions failed to update their opinion of which index is the replica identity one, possibly causing incorrect logical replication behavior. +* Allow parallel vacuuming and concurrent index building to be ignored while computing oldest xmin (Masahiko Sawada) [§](https://postgr.es/c/33b6dd83e) + + Non-parallelized instances of these operations were already ignored, but the logic did not work for parallelized cases. Holding back the xmin horizon has undesirable effects such as delaying vacuum cleanup. +* Avoid leaking memory during `REASSIGN OWNED BY` operations that reassign ownership of many objects (Justin Pryzby) [§](https://postgr.es/c/7413caabe) +* Improve performance of walsenders sending logical changes by avoiding unnecessary cache accesses (Hou Zhijie) [§](https://postgr.es/c/3f8062bcf) +* Fix display of `cert` authentication method's options in `pg_hba_file_rules` view (Magnus Hagander) [§](https://postgr.es/c/81596645c) + + The `cert` authentication method implies `clientcert=verify-full`, but the `pg_hba_file_rules` view incorrectly reported `clientcert=verify-ca`. +* Fix display of whole-row variables appearing in `INSERT ... VALUES` rules (Tom Lane) [§](https://postgr.es/c/ca14c4184) + + A whole-row variable would be printed as “var.\*”, but that allows it to be expanded to individual columns when the rule is reloaded, resulting in different semantics. Attach an explicit cast to prevent that, as we do elsewhere. +* Fix one-byte buffer overrun when applying Unicode string normalization to an empty string (Michael Paquier) [§](https://postgr.es/c/13c8adf90) + + The practical impact of this is limited thanks to alignment considerations; but in debug builds, a warning was raised. +* Fix or remove some incorrect assertions (Simon Riggs, Michael Paquier, Alexander Lakhin) [§](https://postgr.es/c/29f9fb8fe) [§](https://postgr.es/c/33fdd9f85) [§](https://postgr.es/c/3f710fc2b) + + These errors should affect only debug builds, not production. +* Fix race condition that could lead to failure to localize error messages that are reported early in multi-threaded use of libpq or ecpglib (Tom Lane) [§](https://postgr.es/c/64ebb43df) +* Avoid calling `strerror` from libpq's `PQcancel` function (Tom Lane) [§](https://postgr.es/c/f27af7b88) + + `PQcancel` is supposed to be safe to call from a signal handler, but `strerror` is not safe. The faulty usage only occurred in the unlikely event of failure to send the cancel message to the server, perhaps explaining the lack of reports. +* Make psql's `\password` command default to setting the password for `CURRENT_USER`, not the connection's original user name (Tom Lane) [§](https://postgr.es/c/843925fad) + + This agrees with the documented behavior, and avoids probable permissions failure if `SET ROLE` or `SET SESSION AUTHORIZATION` has been done since the session began. To prevent confusion, the role name to be acted on is now included in the password prompt. +* Fix psql `\d` command's query for identifying parent triggers (Justin Pryzby) [§](https://postgr.es/c/90e0f9fd8) + + The previous coding failed with “more than one row returned by a subquery used as an expression” if a partition had triggers and there were unrelated statement-level triggers of the same name on some parent partitioned table. +* Fix psql's tab-completion of label values for enum types (Tom Lane) [§](https://postgr.es/c/90a847e6d) +* In psql and some other client programs, avoid trying to invoke `gettext()` from a control-C signal handler (Tom Lane) [§](https://postgr.es/c/d18ec312f) + + While no reported failures have been traced to this mistake, it seems highly unlikely to be a safe thing to do. +* Allow canceling the initial password prompt in pg\_receivewal and pg\_recvlogical (Tom Lane, Nathan Bossart) [§](https://postgr.es/c/33edf4a3c) + + Previously it was impossible to terminate these programs via control-C while they were prompting for a password. +* Fix pg\_dump's dump ordering for user-defined casts (Tom Lane) [§](https://postgr.es/c/d4f6a36d8) + + In rare cases, the output script might refer to a user-defined cast before it had been created. +* Fix pg\_dump's `--inserts` and `--column-inserts` modes to handle tables containing both generated columns and dropped columns (Tom Lane) [§](https://postgr.es/c/6fc8b145e) [§](https://postgr.es/c/b542e4596) +* Fix possible mis-reporting of errors in pg\_dump and pg\_basebackup (Tom Lane) [§](https://postgr.es/c/c8b5221b5) [§](https://postgr.es/c/bbda88c33) + + The previous code failed to check for errors from some kernel calls, and could report the wrong errno values in other cases. +* Fix results of index-only scans on `contrib/btree_gist` indexes on `char(N)` columns (Tom Lane) [§](https://postgr.es/c/823d4c7e2) + + Index-only scans returned column values with trailing spaces removed, which is not the expected behavior. That happened because that's how the data was stored in the index. This fix changes the code to store `char(N)` values with the expected amount of space padding. The behavior of such an index will not change immediately unless you `REINDEX` it; otherwise space-stripped values will be gradually replaced over time during updates. Queries that do not use index-only scan plans will be unaffected in any case. +* Change configure to use Python's sysconfig module, rather than the deprecated distutils module, to determine how to build PL/Python (Peter Eisentraut, Tom Lane, Andres Freund) [§](https://postgr.es/c/4d7d196ff) + + With Python 3.10, this avoids configure-time warnings about distutils being deprecated and scheduled for removal in Python 3.12. Presumably, once 3.12 is out, `configure --with-python` would fail altogether. This future-proofing does come at a cost: sysconfig did not exist before Python 2.7, nor before 3.2 in the Python 3 branch, so it is no longer possible to build PL/Python against long-dead Python versions. +* Fix PL/Perl compile failure on Windows with Perl 5.28 and later (Victor Wagner) [§](https://postgr.es/c/0dc0fe7b6) +* Fix PL/Python compile failure with Python 3.11 and later (Peter Eisentraut) [§](https://postgr.es/c/04875ae92) +* Add support for building with Visual Studio 2022 (Hans Buschmann) [§](https://postgr.es/c/baef657d3) +* Allow the `.bat` wrapper scripts in our MSVC build system to be called without first changing into their directory (Anton Voloshin, Andrew Dunstan) [§](https://postgr.es/c/f3ded9c46) [§](https://postgr.es/c/31680730e) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-7.html "E.17. Release 13.7") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-5.html "E.19. Release 13.5") | +| E.17. Release 13.7 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.19. Release 13.5 | + +[Previous](/docs/release/13.5/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.7/) diff --git a/corpus/changelog/postgresql_releases/postgresql_137.md b/corpus/changelog/postgresql_releases/postgresql_137.md new file mode 100644 index 0000000000000000000000000000000000000000..3c53efb575a197a72381bcf8af97aa0987eac94c --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_137.md @@ -0,0 +1,148 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.7/ +Version: 13.7 + +## PostgreSQL 13.7 + +| E.17. Release 13.7 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-8.html "E.16. Release 13.8") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-6.html "E.18. Release 13.6") | + +--- + +## E.17. Release 13.7 + +[E.17.1. Migration to Version 13.7](release-13-7.html#id-1.11.6.22.4) + +[E.17.2. Changes](release-13-7.html#id-1.11.6.22.5) + +**Release date:**2022-05-12 + +This release contains a variety of fixes from 13.6. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +### E.17.1. Migration to Version 13.7 + +A dump/restore is not required for those running 13.X. + +However, if you have any GiST indexes on columns of type `ltree` (supplied by the `contrib/ltree` extension), you should re-index them after updating. See the second changelog entry below. + +Also, if you are upgrading from a version earlier than 13.6, see [Section E.18](release-13-6.html "E.18. Release 13.6"). + +### E.17.2. Changes + +* Confine additional operations within “security restricted operation” sandboxes (Sergey Shinderuk, Noah Misch) [§](https://postgr.es/c/35edcc0ce) [§](https://postgr.es/c/88743d581) + + Autovacuum, `CLUSTER`, `CREATE INDEX`, `REINDEX`, `REFRESH MATERIALIZED VIEW`, and pg\_amcheck activated the “security restricted operation” protection mechanism too late, or even not at all in some code paths. A user having permission to create non-temporary objects within a database could define an object that would execute arbitrary SQL code with superuser permissions the next time that autovacuum processed the object, or that some superuser ran one of the affected commands against it. + + The PostgreSQL Project thanks Alexander Lakhin for reporting this problem. (CVE-2022-1552) +* Fix default signature length for `gist_ltree_ops` indexes (Tomas Vondra, Alexander Korotkov) [§](https://postgr.es/c/bad202c61) + + The default signature length (hash size) for GiST indexes on `ltree` columns was accidentally changed while upgrading that operator class to support operator class parameters. If any operations had been done on such an index without first upgrading the `ltree` extension to version 1.2, they were done assuming that the signature length was 28 bytes rather than the intended 8. This means it is very likely that such indexes are now corrupt. For safety we recommend re-indexing all GiST indexes on `ltree` columns after installing this update. (Note that GiST indexes on `ltree[]` columns, that is arrays of `ltree`, are not affected.) +* Stop using query-provided column aliases for the columns of whole-row variables that refer to plain tables (Tom Lane) [§](https://postgr.es/c/5e144cc89) + + The column names in tuples produced by a whole-row variable (such as `tbl.*` in contexts other than the top level of a `SELECT` list) are now always those of the associated named composite type, if there is one. We'd previously attempted to make them track any column aliases that had been applied to the `FROM` entry the variable refers to. But that's semantically dubious, because really then the output of the variable is not at all of the composite type it claims to be. Previous attempts to deal with that inconsistency had bad results up to and including storing unreadable data on disk, so just give up on the whole idea. + + In cases where it's important to be able to relabel such columns, a workaround is to introduce an extra level of sub-`SELECT`, so that the whole-row variable is referring to the sub-`SELECT`'s output and not to a plain table. Then the variable is of type `record` to begin with and there's no issue. +* Fix incorrect output for types `timestamptz` and `timetz` in `table_to_xmlschema()` and allied functions (Renan Soares Lopes) [§](https://postgr.es/c/88ae77588) + + The xmlschema output for these types included a malformed regular expression. +* Avoid core dump in parser for a `VALUES` clause with zero columns (Tom Lane) [§](https://postgr.es/c/91a3a74c6) +* Fix planner errors for `GROUPING()` constructs that reference outer query levels (Richard Guo, Tom Lane) [§](https://postgr.es/c/dfefe38fb) +* Fix plan generation for index-only scans on indexes with both returnable and non-returnable columns (Tom Lane) [§](https://postgr.es/c/0778b24ce) + + The previous coding could try to read non-returnable columns in addition to the returnable ones. This was fairly harmless because it didn't actually do anything with the bogus values, but it fell foul of a recently-added error check that rejected such a plan. +* Avoid accessing a no-longer-pinned shared buffer while attempting to lock an outdated tuple during EvalPlanQual (Tom Lane) [§](https://postgr.es/c/44096c31e) + + The code would touch the buffer a couple more times after releasing its pin. In theory another process could recycle the buffer (or more likely, try to defragment its free space) as soon as the pin is gone, probably leading to failure to find the newer version of the tuple. +* Fix query-lifespan memory leak in an IndexScan node that is performing reordering (Aliaksandr Kalenik) [§](https://postgr.es/c/ac2303aa0) +* Fix `ALTER FUNCTION` to support changing a function's parallelism property and its `SET`-variable list in the same command (Tom Lane) [§](https://postgr.es/c/f583633bc) + + The parallelism property change was lost if the same command also updated the function's `SET` clause. +* Fix bogus errors from attempts to alter system columns of tables (Tom Lane) [§](https://postgr.es/c/69cefb3fb) + + The system should just tell you that you can't do it, but sometimes it would report “no owned sequence found” instead. +* Fix mis-sorting of table rows when `CLUSTER`ing using an index whose leading key is an expression (Peter Geoghegan, Thomas Munro) [§](https://postgr.es/c/1272630a2) + + The table would be rebuilt with the correct data, but in an order having little to do with the index order. +* Fix risk of deadlock failures while dropping a partitioned index (Jimmy Yih, Gaurab Dey, Tom Lane) [§](https://postgr.es/c/2241e5ced) + + Ensure that the required table and index locks are taken in the standard order (parents before children, tables before indexes). The previous coding for `DROP INDEX` did it differently, and so could deadlock against concurrent queries taking these locks in the standard order. +* Fix race condition between `DROP TABLESPACE` and checkpointing (Nathan Bossart) [§](https://postgr.es/c/51e760e5a) + + The checkpoint forced by `DROP TABLESPACE` could sometimes fail to remove all dead files from the tablespace's directory, leading to a bogus “tablespace is not empty” error. +* Fix possible trouble in crash recovery after a `TRUNCATE` command that overlaps a checkpoint (Kyotaro Horiguchi, Heikki Linnakangas, Robert Haas) [§](https://postgr.es/c/1ce14b6b2) [§](https://postgr.es/c/d18c913b7) + + `TRUNCATE` must ensure that the table's disk file is truncated before the checkpoint is allowed to complete. Otherwise, replay starting from that checkpoint might find unexpected data in the supposedly-removed pages, possibly causing replay failure. +* Fix unsafe toast-data accesses during temporary object cleanup (Andres Freund) [§](https://postgr.es/c/c2551483e) + + Temporary-object deletion during server process exit could fail with “FATAL: cannot fetch toast data without an active snapshot”. This was usually harmless since the next use of that temporary schema would clean up successfully. +* Improve wait logic in RegisterSyncRequest (Thomas Munro) [§](https://postgr.es/c/cfdb303be) + + If we run out of space in the checkpointer sync request queue (which is hopefully rare on real systems, but is common when testing with a very small buffer pool), we wait for it to drain. While waiting, we should report that as a wait event so that users know what is going on, and also watch for postmaster death, since otherwise the loop might never terminate if the checkpointer has already exited. +* Fix “PANIC: xlog flush request is not satisfied” failure during standby promotion when there is a missing WAL continuation record (Sami Imseih) [§](https://postgr.es/c/98eb3e06c) +* Fix possibility of self-deadlock in hot standby conflict handling (Andres Freund) [§](https://postgr.es/c/57c5ad168) [§](https://postgr.es/c/0446d3bf3) [§](https://postgr.es/c/90abe1e17) + + With unlucky timing, the WAL-applying process could get stuck while waiting for some other process to release a buffer lock. +* Fix possible mis-identification of the correct ancestor relation to publish logical replication changes through (Tomas Vondra, Hou zj, Amit Kapila) [§](https://postgr.es/c/27fafee72) + + If `publish_via_partition_root` is enabled, and there are multiple publications naming different ancestors of the currently-modified relation, the wrong ancestor might be chosen for reporting the change. +* Ensure that logical replication apply workers can be restarted even when we're up against the `max_sync_workers_per_subscription` limit (Amit Kapila) [§](https://postgr.es/c/82d4a17a1) + + Faulty coding of the limit check caused a restarted worker to exit immediately, leaving fewer workers than there should be. +* Include unchanged replica identity key columns in the WAL log for an update, if they are stored out-of-line (Dilip Kumar, Amit Kapila) [§](https://postgr.es/c/caa231be9) + + Otherwise subscribers cannot see the values and will fail to replicate the update. +* Cope correctly with platforms that have no support for altering the server process's display in ps(1) (Andrew Dunstan) [§](https://postgr.es/c/9016a2a3d) + + Few platforms are like this (the only supported one is Cygwin), so we'd managed not to notice that refactoring introduced a potential memory clobber. +* Disallow execution of SPI functions during PL/Perl function compilation (Tom Lane) [§](https://postgr.es/c/9b2d762a2) + + Perl can be convinced to execute user-defined code during compilation of a PL/Perl function. However, it's not okay for such code to try to invoke SQL operations via SPI. That results in a crash, and if it didn't crash it would be a security hazard, because we really don't want code execution during function validation. Put in a check to give a friendlier error message instead. +* Make libpq accept root-owned SSL private key files (David Steele) [§](https://postgr.es/c/6599d8f12) [§](https://postgr.es/c/fb1d7f451) + + This change synchronizes libpq's rules for safe ownership and permissions of SSL key files with the rules the server has used since release 9.6. Namely, in addition to the current rules, allow the case where the key file is owned by root and has permissions `rw-r-----` or less. This is helpful for system-wide management of key files. +* Fix behavior of libpq's `PQisBusy()` function after a connection failure (Tom Lane) [§](https://postgr.es/c/51ee561f5) + + If we'd detected a write failure, `PQisBusy()` would always return true, which is the wrong thing: we want input processing to carry on normally until we've read whatever is available from the server. The practical effect of this error is that applications using libpq's async-query API would typically detect connection loss only when `PQconsumeInput()` returns a hard failure. With this fix, a connection loss will normally be reported via an error `PGresult` object, which is a much cleaner behavior for most applications. +* Make pg\_ctl recheck postmaster aliveness while waiting for stop/restart/promote actions (Tom Lane) [§](https://postgr.es/c/d0e1fd958) + + pg\_ctl would verify that the postmaster is alive as a side-effect of sending the stop or promote signal, but then it just naively waited to see the on-disk state change. If the postmaster died uncleanly without having removed its PID file or updated the control file, pg\_ctl would wait until timeout. Instead make it recheck every so often that the postmaster process is still there. +* Fix error handling in pg\_waldump (Kyotaro Horiguchi, Andres Freund) [§](https://postgr.es/c/0b1020a96) [§](https://postgr.es/c/344d89abf) + + While trying to read a WAL file to determine the WAL segment size, pg\_waldump would report an incorrect error for the case of a too-short file. In addition, the file name reported in this and related error messages could be garbage. +* Ensure that `contrib/pageinspect` functions cope with all-zero pages (Michael Paquier) [§](https://postgr.es/c/2275d044d) + + This is a legitimate edge case, but the module was mostly unprepared for it. Arrange to return nulls, or no rows, as appropriate; that seems more useful than raising an error. +* In `contrib/pageinspect`, add defenses against incorrect page “special space” contents, tighten checks for correct page size, and add some missing checks that an index is of the expected type (Michael Paquier, Justin Pryzby, Julien Rouhaud) [§](https://postgr.es/c/3d4d6dee0) [§](https://postgr.es/c/d3a9b83c3) [§](https://postgr.es/c/028a3c6b1) + + These changes make it less likely that the module will crash on bad data. +* In `contrib/postgres_fdw`, verify that `ORDER BY` clauses are safe to ship before requesting a remotely-ordered query, and include a `USING` clause if necessary (Ronan Dunklau) [§](https://postgr.es/c/79df1d20c) + + This fix prevents situations where the remote server might sort in a different order than we intend. While sometimes that would be only cosmetic, it could produce thoroughly wrong results if the remote data is used as input for a locally-performed merge join. +* Update JIT code to work with LLVM 14 (Thomas Munro) [§](https://postgr.es/c/5610411ac) +* Clean up assorted failures under clang's `-fsanitize=undefined` checks (Tom Lane, Andres Freund, Zhihong Yu) [§](https://postgr.es/c/1a027e6b7) [§](https://postgr.es/c/97031f440) [§](https://postgr.es/c/c0f99bb52) [§](https://postgr.es/c/8014c61eb) [§](https://postgr.es/c/7c163aa93) + + Most of these changes are just for pro-forma compliance with the letter of the C and POSIX standards, and are unlikely to have any effect on production builds. +* Fix PL/Perl so it builds on C compilers that don't support statements nested within expressions (Tom Lane) [§](https://postgr.es/c/5ea3b99de) +* Fix possible build failure of pg\_dumpall on Windows, when not using MSVC to build (Andres Freund) [§](https://postgr.es/c/f183e23cc) +* In Windows builds, use gendef instead of pexports to build DEF files (Andrew Dunstan) [§](https://postgr.es/c/eec7c640f) + + This adapts the build process to work on recent MSys tool chains. +* Prevent extra expansion of shell wildcard patterns in programs built under MinGW (Andrew Dunstan) [§](https://postgr.es/c/d9cede2c3) + + For some reason the C library provided by MinGW will expand shell wildcard characters in a program's command-line arguments by default. This is confusing, not least because it doesn't happen under MSVC, so turn it off. +* Update time zone data files to tzdata release 2022a for DST law changes in Palestine, plus historical corrections for Chile and Ukraine. (Tom Lane) [§](https://postgr.es/c/e9735d1af) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-8.html "E.16. Release 13.8") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-6.html "E.18. Release 13.6") | +| E.16. Release 13.8 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.18. Release 13.6 | + +[Previous](/docs/release/13.6/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.8/) diff --git a/corpus/changelog/postgresql_releases/postgresql_138.md b/corpus/changelog/postgresql_releases/postgresql_138.md new file mode 100644 index 0000000000000000000000000000000000000000..e83dc77c4d234d5a2421e55bb7a41805693d12da --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_138.md @@ -0,0 +1,143 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.8/ +Version: 13.8 + +## PostgreSQL 13.8 + +| E.16. Release 13.8 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-9.html "E.15. Release 13.9") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-7.html "E.17. Release 13.7") | + +--- + +## E.16. Release 13.8 + +[E.16.1. Migration to Version 13.8](release-13-8.html#id-1.11.6.21.4) + +[E.16.2. Changes](release-13-8.html#id-1.11.6.21.5) + +**Release date:**2022-08-11 + +This release contains a variety of fixes from 13.7. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +### E.16.1. Migration to Version 13.8 + +A dump/restore is not required for those running 13.X. + +However, if you are upgrading from a version earlier than 13.7, see [Section E.17](release-13-7.html "E.17. Release 13.7"). + +### E.16.2. Changes + +* Do not let extension scripts replace objects not already belonging to the extension (Tom Lane) [§](https://postgr.es/c/7e92f78ab) + + This change prevents extension scripts from doing `CREATE OR REPLACE` if there is an existing object that does not belong to the extension. It also prevents `CREATE IF NOT EXISTS` in the same situation. This prevents a form of trojan-horse attack in which a hostile database user could become the owner of an extension object and then modify it to compromise future uses of the object by other users. As a side benefit, it also reduces the risk of accidentally replacing objects one did not mean to. + + The PostgreSQL Project thanks Sven Klemm for reporting this problem. (CVE-2022-2625) +* Fix replay of `CREATE DATABASE` WAL records on standby servers (Kyotaro Horiguchi, Asim R Praveen, Paul Guo) [§](https://postgr.es/c/9a7e26b9c) [§](https://postgr.es/c/7cfe688de) [§](https://postgr.es/c/b76e136ce) [§](https://postgr.es/c/8c5d9ccca) + + Standby servers may encounter missing tablespace directories when replaying database-creation WAL records. Prior to this patch, a standby would fail to recover in such a case; however, such directories could be legitimately missing. Create the tablespace (as a plain directory), then check that it has been dropped again once replay reaches a consistent state. +* Support “in place” tablespaces (Thomas Munro, Michael Paquier, Álvaro Herrera) [§](https://postgr.es/c/16e7a8fd8) + + Normally a Postgres tablespace is a symbolic link to a directory on some other filesystem. This change allows it to just be a plain directory. While this has no use for separating tables onto different filesystems, it is a convenient setup for testing. Moreover, it is necessary to support the `CREATE DATABASE` replay fix, which transiently creates a missing tablespace as an “in place” tablespace. +* Fix permissions checks in `CREATE INDEX` (Nathan Bossart, Noah Misch) [§](https://postgr.es/c/8782ce49e) + + The fix for CVE-2022-1552 caused `CREATE INDEX` to apply the table owner's permissions while performing lookups of operator classes and other objects, where formerly the calling user's permissions were used. This broke dump/restore scenarios, because pg\_dump issues `CREATE INDEX` before re-granting permissions. +* In extended query protocol, force an immediate commit after `CREATE DATABASE` and other commands that can't run in a transaction block (Tom Lane) [§](https://postgr.es/c/6c193c2ac) + + If the client does not send a Sync message immediately after such a command, but instead sends another command, any failure in that command would lead to rolling back the preceding command, typically leaving inconsistent state on-disk (such as a missing or extra database directory). The mechanisms intended to prevent that situation turn out to work for multiple commands in a simple-Query message, but not for a series of extended-protocol messages. To prevent inconsistency without breaking use-cases that work today, force an implicit commit after such commands. +* Fix race condition when checking transaction visibility (Simon Riggs) [§](https://postgr.es/c/7ba325fd7) + + `TransactionIdIsInProgress` could report `false` before the subject transaction is considered visible, leading to various misbehaviors. The race condition window is normally very narrow, but use of synchronous replication makes it much wider, because the wait for a synchronous replica happens in that window. +* Fix queries in which a “whole-row variable” references the result of a function that returns a domain over composite type (Tom Lane) [§](https://postgr.es/c/254cd7f31) +* Fix “variable not found in subplan target list” planner error when pulling up a sub-`SELECT` that's referenced in a `GROUPING` function (Richard Guo) [§](https://postgr.es/c/b7579b25c) +* Fix incorrect plans when sorting by an expression that contains a non-top-level set-returning function (Richard Guo, Tom Lane) [§](https://postgr.es/c/da4ed7588) [§](https://postgr.es/c/8d38ccafc) +* Avoid planner core dump with `constant = ANY(array)` clauses when there are MCV-type extended statistics on the *`array`* variable (Tom Lane) [§](https://postgr.es/c/c102d1106) [§](https://postgr.es/c/476f9d533) +* Fix `ALTER TABLE ... ENABLE/DISABLE TRIGGER` to handle recursion correctly for triggers on partitioned tables (Álvaro Herrera, Amit Langote) [§](https://postgr.es/c/ab8556630) [§](https://postgr.es/c/d2a74621e) + + In certain cases, a “trigger does not exist” failure would occur because the command would try to adjust the trigger on a child partition that doesn't have it. +* Improve syntax error messages for type `jsonpath` (Andrew Dunstan) [§](https://postgr.es/c/03cefe814) +* Prevent `pg_stat_get_subscription()` from possibly returning an extra row containing garbage values (Kuntal Ghosh) [§](https://postgr.es/c/a36196972) +* Ensure that `pg_stop_backup()` cleans up session state properly (Fujii Masao) [§](https://postgr.es/c/162ade612) + + This omission could lead to assertion failures or crashes later in the session. +* Fix join alias matching in `FOR [KEY] UPDATE/SHARE` clauses (Dean Rasheed) [§](https://postgr.es/c/f890223bc) + + In corner cases, a misleading error could be reported. +* Avoid crashing if too many column aliases are attached to an `XMLTABLE` or `JSON_TABLE` construct (Álvaro Herrera) [§](https://postgr.es/c/80656f00f) [§](https://postgr.es/c/5139db556) +* Reject `ROW()` expressions and functions in `FROM` that have too many columns (Tom Lane) [§](https://postgr.es/c/ba2002d02) [§](https://postgr.es/c/331f8b851) + + Cases with more than about 1600 columns are unsupported, and have always failed at execution. However, it emerges that some earlier code could be driven to assertion failures or crashes by queries with more than 32K columns. Add a parse-time check to prevent that. +* When decompiling a view or rule, show a `SELECT` output column's `AS "?column?"` alias clause if it could be referenced elsewhere (Tom Lane) [§](https://postgr.es/c/fefd54631) + + Previously, this auto-generated alias was always hidden; but there are corner cases where doing so results in a non-restorable view or rule definition. +* Fix dumping of a view using a function in `FROM` that returns a composite type, when column(s) of the composite type have been dropped since the view was made (Tom Lane) [§](https://postgr.es/c/5b5d43513) + + This oversight could lead to dump/reload or pg\_upgrade failures, as the dumped view would have too many column aliases for the function. +* Report implicitly-created operator families to event triggers (Masahiko Sawada) [§](https://postgr.es/c/3753a169e) + + If `CREATE OPERATOR CLASS` results in the implicit creation of an operator family, that object was not reported to event triggers that should capture such events. +* Fix control file updates made when a restartpoint is running during promotion of a standby server (Kyotaro Horiguchi) [§](https://postgr.es/c/2e9559b30) + + Previously, when the restartpoint completed it could incorrectly update the last-checkpoint fields of the control file, potentially leading to PANIC and failure to restart if the server crashes before the next normal checkpoint completes. +* Prevent triggering of standby's `wal_receiver_timeout` during logical replication of large transactions (Wang Wei, Amit Kapila) [§](https://postgr.es/c/55558df23) + + If a large transaction on the primary server sends no data to the standby (perhaps because no table it changes is published), it was possible for the standby to timeout. Fix that by ensuring we send keepalive messages periodically in such situations. +* Disallow nested backup operations in logical replication walsenders (Fujii Masao) [§](https://postgr.es/c/5630f39b3) +* Fix memory leak in logical replication subscribers (Hou Zhijie) [§](https://postgr.es/c/3a6ef0cdf) +* Fix logical replication's checking of replica identity when the target table is partitioned (Shi Yu, Hou Zhijie) [§](https://postgr.es/c/5f113d60e) [§](https://postgr.es/c/419c72715) + + The replica identity columns have to be re-identified for the child partition. +* Fix failures to update cached schema data in a logical replication subscriber after a schema change on the publisher (Shi Yu, Hou Zhijie) [§](https://postgr.es/c/1f9a7738e) [§](https://postgr.es/c/16f5a8da7) +* Prevent open-file leak when reading an invalid timezone abbreviation file (Kyotaro Horiguchi) [§](https://postgr.es/c/c73748b68) + + Such cases could result in harmless warning messages. +* Allow custom server parameters to have short descriptions that are NULL (Steve Chavez) [§](https://postgr.es/c/1e6802990) + + Previously, although extensions could choose to create such settings, some code paths would crash while processing them. +* Fix WAL consistency checking logic to correctly handle `BRIN_EVACUATE_PAGE` flags (Haiyang Wang) [§](https://postgr.es/c/de31e6f81) [§](https://postgr.es/c/1626590f2) +* Fix erroneous assertion checks in shared hashtable management (Thomas Munro) [§](https://postgr.es/c/7cdd0c2d7) +* Arrange to clean up after commit-time errors within `SPI_commit()`, rather than expecting callers to do that (Peter Eisentraut, Tom Lane) [§](https://postgr.es/c/cfc86f987) [§](https://postgr.es/c/b2c8d5661) + + Proper cleanup is complicated and requires use of low-level facilities, so it's not surprising that no known caller got it right. This led to misbehaviors when a PL procedure issued `COMMIT` but a failure occurred (such as a deferred constraint check). To improve matters, redefine `SPI_commit()` as starting a new transaction, so that it becomes equivalent to `SPI_commit_and_chain()` except that you get default transaction characteristics instead of preserving the prior transaction's characteristics. To make this somewhat transparent API-wise, redefine `SPI_start_transaction()` as a no-op. All known callers of `SPI_commit()` immediately call `SPI_start_transaction()`, so they will not notice any change. Similar remarks apply to `SPI_rollback()`. + + Also fix PL/Python, which omitted any handling of such errors at all, resulting in jumping out of the Python interpreter. This is reported to crash Python 3.11. Older Python releases leak some memory but seem okay with it otherwise. +* Remove misguided SSL key file ownership check in libpq (Tom Lane) [§](https://postgr.es/c/9e3dbc6fd) + + In the previous minor releases, we copied the server's permission checking rules for SSL private key files into libpq. But we should not have also copied the server's file-ownership check. While that works in normal use-cases, it can result in an unexpected failure for clients running as root, and perhaps in other cases. +* Ensure ecpg reports server connection loss sanely (Tom Lane) [§](https://postgr.es/c/16d68007c) + + Misprocessing of a libpq-generated error result, such as a report of lost connection, would lead to printing “(null)” instead of a useful error message; or in older releases it would lead to a crash. +* Avoid core dump in ecpglib with unexpected orders of operations (Tom Lane) [§](https://postgr.es/c/12b8fb34a) + + Certain operations such as `EXEC SQL PREPARE` would crash (rather than reporting an error as expected) if called before establishing any database connection. +* In ecpglib, avoid redundant `newlocale()` calls (Noah Misch) [§](https://postgr.es/c/b4d7e92bd) [§](https://postgr.es/c/97b005f3f) + + Allocate a C locale object once per process when first connecting, rather than creating and freeing locale objects once per query. This mitigates a libc memory leak on AIX, and may offer some performance benefit everywhere. +* In psql's `\watch` command, echo a newline after cancellation with control-C (Pavel Stehule) [§](https://postgr.es/c/e5b5b4448) + + This prevents libedit (and possibly also libreadline) from becoming confused about which column the cursor is in. +* Fix possible report of wrong error condition after `clone()` failure in pg\_upgrade with `--clone` option (Justin Pryzby) [§](https://postgr.es/c/aadaaeff4) +* Fix `contrib/pg_stat_statements` to avoid problems with very large query-text files on 32-bit platforms (Tom Lane) [§](https://postgr.es/c/6b67db10c) +* Ensure that `contrib/postgres_fdw` sends constants of `regconfig` and other `reg*` types with proper schema qualification (Tom Lane) [§](https://postgr.es/c/6230bd7df) +* Block signals while allocating dynamic shared memory on Linux (Thomas Munro) [§](https://postgr.es/c/e73fe6e82) [§](https://postgr.es/c/17aa39da5) [§](https://postgr.es/c/c75b6b454) + + This avoids problems when a signal interrupts `posix_fallocate()`. +* Detect unexpected `EEXIST` error from `shm_open()` (Thomas Munro) [§](https://postgr.es/c/b436047dc) + + This avoids a possible crash on Solaris. +* Adjust PL/Perl test case so it will work under Perl 5.36 (Dagfinn Ilmari Mannsåker) [§](https://postgr.es/c/eeac7dd9f) +* Avoid incorrectly using an out-of-date libldap\_r library when multiple OpenLDAP installations are present while building PostgreSQL (Tom Lane) [§](https://postgr.es/c/af9b96767) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-9.html "E.15. Release 13.9") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-7.html "E.17. Release 13.7") | +| E.15. Release 13.9 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.17. Release 13.7 | + +[Previous](/docs/release/13.7/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.9/) diff --git a/corpus/changelog/postgresql_releases/postgresql_139.md b/corpus/changelog/postgresql_releases/postgresql_139.md new file mode 100644 index 0000000000000000000000000000000000000000..4f299e4d75abc85d3191a2381525aa5a6da353f2 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_139.md @@ -0,0 +1,161 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/13.9/ +Version: 13.9 + +## PostgreSQL 13.9 + +| E.15. Release 13.9 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-13-10.html "E.14. Release 13.10") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 13.23 Documentation") | [Next](release-13-8.html "E.16. Release 13.8") | + +--- + +## E.15. Release 13.9 + +[E.15.1. Migration to Version 13.9](release-13-9.html#id-1.11.6.20.4) + +[E.15.2. Changes](release-13-9.html#id-1.11.6.20.5) + +**Release date:**2022-11-10 + +This release contains a variety of fixes from 13.8. For information about new features in major release 13, see [Section E.24](release-13.html "E.24. Release 13"). + +### E.15.1. Migration to Version 13.9 + +A dump/restore is not required for those running 13.X. + +However, if you are upgrading from a version earlier than 13.7, see [Section E.17](release-13-7.html "E.17. Release 13.7"). + +### E.15.2. Changes + +* Avoid rare PANIC during updates occurring concurrently with `VACUUM` (Tom Lane, Jeff Davis) [§](https://postgr.es/c/92941f264) [§](https://postgr.es/c/410c422b7) + + If a concurrent `VACUUM` sets the all-visible flag bit in a page that `UPDATE` or `DELETE` is in process of modifying, the updating command needs to clear that bit again; but some code paths failed to do so, ending in a PANIC exit and database restart. + + This is known to be possible in versions 14 and 15. It may be only latent in previous branches. +* Fix `VACUUM` to press on if an attempted page deletion in a btree index fails to find the page's parent downlink (Peter Geoghegan) [§](https://postgr.es/c/43e409cea) + + Rather than throwing an error, just log the issue and continue without deleting the empty page. Previously, a buggy operator class or corrupted index could indefinitely prevent completion of vacuuming of the index, eventually leading to transaction wraparound problems. +* Fix handling of `DEFAULT` tokens that appear in a multi-row `VALUES` clause of an `INSERT` on an updatable view (Tom Lane) [§](https://postgr.es/c/21e042b0b) + + This oversight could lead to “cache lookup failed for type” errors, or in older branches even to crashes. +* Disallow rules named `_RETURN` that are not `ON SELECT` (Tom Lane) [§](https://postgr.es/c/b21615d1e) + + This avoids confusion between a view's `ON SELECT` rule and any other rules it may have. +* Fix resource management bug in saving tuples for `AFTER` triggers (Tom Lane) [§](https://postgr.es/c/8c17c8615) + + Given the right circumstances, this manifested as a “tupdesc reference *`NNNN`* is not owned by resource owner” error followed by a PANIC exit. +* Repair rare failure of MULTIEXPR\_SUBLINK subplans in inherited updates (Tom Lane) [§](https://postgr.es/c/3f7323cbb) [§](https://postgr.es/c/18f51083c) [§](https://postgr.es/c/ccbb54c72) + + Use of the syntax `UPDATE tab SET (c1, ...) = (SELECT ...)` with an inherited or partitioned target table could result in failure if the child tables are sufficiently dissimilar. This typically manifested as failure of consistency checks in the executor; but a crash or incorrect data updates are also possible. +* Fix construction of per-partition foreign key constraints while doing `ALTER TABLE ATTACH PARTITION` (Jehan-Guillaume de Rorthais, Álvaro Herrera) [§](https://postgr.es/c/41b6e7c9a) [§](https://postgr.es/c/7d520e68e) + + Previously, incorrect or duplicate constraints could be constructed for the newly-added partition. +* Fix generation of constraint names for per-partition foreign key constraints (Jehan-Guillaume de Rorthais) [§](https://postgr.es/c/80ef25b1a) + + If the initially-given name is already in use for some constraint of the partition, a new one is selected; but it wasn't being spelled as intended. +* Fix incorrect matching of index expressions and predicates when creating a partitioned index (Richard Guo, Tom Lane) [§](https://postgr.es/c/9f0073ef7) + + While creating a partitioned index, we try to identify any existing indexes on the partitions that match the partitioned index, so that we can absorb those as child indexes instead of building new ones. Matching of expressions was not done right, so that a usable child index might be ignored, leading to creation of a duplicative index. +* Prevent WAL corruption after a standby promotion (Dilip Kumar, Robert Haas) [§](https://postgr.es/c/3f2701cda) + + When a PostgreSQL instance performing archive recovery (but not using standby mode) is promoted, and the last WAL segment that it attempted to read ended in a partial record, the instance would write an invalid WAL segment on the new timeline. +* Fix mis-ordering of WAL operations in fast insert path for GIN indexes (Matthias van de Meent, Zhang Mingli) [§](https://postgr.es/c/594b97509) + + This mistake is not known to have any negative consequences within core PostgreSQL, but it did cause issues for some extensions. +* Fix bugs in logical decoding when replay starts from a point between the beginning of a transaction and the beginning of its subtransaction (Masahiko Sawada, Kuroda Hayato) [§](https://postgr.es/c/25f7be1ca) [§](https://postgr.es/c/38dbaaf27) + + These errors could lead to assertion failures in debug builds, and otherwise to memory leaks. +* Prevent examining system catalogs with the wrong snapshot during logical decoding (Masahiko Sawada) [§](https://postgr.es/c/547b96368) + + If decoding begins partway through a transaction that modifies system catalogs, the decoder may not recognize that, causing it to fail to treat that transaction as in-progress for catalog lookups. +* Accept interrupts in more places during logical decoding (Amit Kapila, Masahiko Sawada) [§](https://postgr.es/c/1eed947f9) [§](https://postgr.es/c/4985a4591) + + This ameliorates problems with slow shutdown of replication workers. +* Prevent attempts to replicate into a foreign-table partition in replication workers (Shi Yu, Tom Lane) [§](https://postgr.es/c/4d3f7e75c) + + Although partitioned tables can have foreign tables as partitions, replicating into such a partition isn't currently supported. The logical replication worker process would crash if it was attempted. Now, an error is thrown. +* Remove pointless check on replica identity setting of partitioned tables (Hou Zhijie) [§](https://postgr.es/c/1df86aac5) + + What matters is the replica identity setting of the leaf partitions, so there's no need to throw error if it's not set on the parent. +* Avoid crash after function syntax error in replication workers (Maxim Orlov, Anton Melnikov, Masahiko Sawada, Tom Lane) [§](https://postgr.es/c/b00f342ea) + + If a syntax error occurred in a SQL-language or PL/pgSQL-language `CREATE FUNCTION` or `DO` command executed in a logical replication worker, the worker process would crash with a null pointer dereference or assertion failure. +* Fix handling of read-write expanded datums that are passed to SQL functions (Tom Lane) [§](https://postgr.es/c/71caf3c4d) + + If a non-inlined SQL function uses a parameter in more than one place, and one of those functions expects to be able to modify read-write datums in place, then later uses of the parameter would observe the wrong value. (Within core PostgreSQL, the expanded-datum mechanism is only used for array and composite-type values; but extensions might use it for other structured types.) +* Fix type `circle`'s equality comparator to handle NaNs properly (Ranier Vilela) [§](https://postgr.es/c/eb8b84807) + + If the left-hand circle had a floating-point NaN for its radius, it would be considered equal to a circle with the same center and any radius. +* In Snowball dictionaries, don't try to stem excessively-long words (Olly Betts, Tom Lane) [§](https://postgr.es/c/f204ad3a2) + + If the input word exceeds 1000 bytes, return it as-is after case folding, rather than trying to run it through the Snowball code. This restriction protects against a known recursion-to-stack-overflow problem in the Turkish stemmer, and it seems like good insurance against any other safety or performance issues that may exist in the Snowball stemmers. Such a long string is surely not a word in any human language, so it's doubtful that the stemmer would have done anything desirable with it anyway. +* Fix use-after-free hazard in string comparisons (Tom Lane) [§](https://postgr.es/c/9fe285f85) + + Improper memory management in the string comparison functions could result in scribbling on no-longer-allocated buffers, potentially breaking things for whatever is using that memory now. This would only happen with fairly long strings (more than 1kB), and only if an ICU collation is in use. +* Add plan-time check for attempted access to a table that has no table access method (Tom Lane) [§](https://postgr.es/c/62b263bf7) + + This prevents a crash in some catalog-corruption scenarios, for example use of a view whose `ON SELECT` rule is missing. +* Prevent postmaster crash when shared-memory state is corrupted (Tom Lane) [§](https://postgr.es/c/744270137) + + The postmaster process is supposed to survive and initiate a database restart if shared memory becomes corrupted, but one bit of code was being insufficiently cautious about that. +* Add some more defenses against recursion till stack overrun (Richard Guo, Tom Lane) [§](https://postgr.es/c/2d1f1523c) [§](https://postgr.es/c/60f876317) +* Avoid misbehavior when choosing hash table size with very small `work_mem` and large tuples (Zhang Mingli) [§](https://postgr.es/c/4878ea717) +* Avoid long-term memory leakage in the autovacuum launcher process (Reid Thompson) [§](https://postgr.es/c/45f7152b9) + + The lack of field reports suggests that this problem is only latent in pre-v15 branches; but it's not very clear why, so back-patch the fix anyway. +* Improve PL/pgSQL's ability to handle parameters declared as `RECORD` (Tom Lane) [§](https://postgr.es/c/c18d946e2) + + Build a separate function cache entry for each concrete type passed to the `RECORD` parameter during a session, much as we do for polymorphic parameters. This allows some usages to work that previously failed with errors such as “type of parameter does not match that when preparing the plan”. +* Add missing guards for `NULL` connection pointer in libpq (Daniele Varrazzo, Tom Lane) [§](https://postgr.es/c/e37e9a655) + + There's a convention that libpq functions should check for a NULL PGconn argument, and fail gracefully instead of crashing. `PQflush()` and `PQisnonblocking()` didn't get that memo, so fix them. +* In ecpg, fix omission of variable storage classes when multiple `varchar` or `bytea` variables are declared in the same declaration (Andrey Sokolov) [§](https://postgr.es/c/a6618842f) + + For example, ecpg translated `static varchar str1[10], str2[20], str3[30];` in such a way that only `str1` was marked `static`. +* Allow cross-platform tablespace relocation in pg\_basebackup (Robert Haas) [§](https://postgr.es/c/0bf2cd160) + + Allow the remote path in `--tablespace-mapping` to be either a Unix-style or Windows-style absolute path, since the source server could be on a different OS than the local system. +* In pg\_stat\_statements, fix access to already-freed memory (zhaoqigui) [§](https://postgr.es/c/a9fdb48b7) + + This occurred if pg\_stat\_statements tracked a `ROLLBACK` command issued via extended query protocol. In debug builds it consistently led to an assertion failure. In production builds there would often be no visible ill effect; but if the freed memory had already been reused, the likely result would be to store garbage for the query string. +* In postgres\_fdw, ensure that target lists constructed for EvalPlanQual plans will have all required columns (Richard Guo, Etsuro Fujita) [§](https://postgr.es/c/6749d4e8c) + + This avoids “variable not found in subplan target list” errors in rare cases. +* Reject unwanted output from the platform's `uuid_create()` function (Nazir Bilal Yavuz) [§](https://postgr.es/c/a61095aa7) + + The uuid-ossp module expects libc's `uuid_create()` to produce a version-1 UUID, but recent NetBSD releases produce a version-4 (random) UUID instead. Check for that, and complain if so. Drop the documentation's claim that the NetBSD implementation is usable for uuid-ossp. (If a version-4 UUID is okay for your purposes, you don't need uuid-ossp at all; just use `gen_random_uuid()`.) +* Include new Perl test modules in standard installations (Álvaro Herrera) [§](https://postgr.es/c/33d979aee) + + Add `PostgreSQL/Test/Cluster.pm` and `PostgreSQL/Test/Utils.pm` to the standard installation file set in pre-version-15 branches. This is for the benefit of extensions that want to use newly-written test code in older branches. +* On NetBSD, force dynamic symbol resolution at postmaster start (Andres Freund, Tom Lane) [§](https://postgr.es/c/a94b019d4) + + This avoids a risk of deadlock in the dynamic linker on NetBSD 10. +* Fix incompatibilities with LLVM 15 (Thomas Munro, Andres Freund) [§](https://postgr.es/c/cf94cb586) +* Allow use of `__sync_lock_test_and_set()` for spinlocks on any machine (Tom Lane) [§](https://postgr.es/c/c479492c0) + + This eases porting to new machine architectures, at least if you're using a compiler that supports this GCC builtin function. +* Rename symbol `REF` to `REF_P` to avoid compile failure on recent macOS (Tom Lane) [§](https://postgr.es/c/bc7a40b42) +* Avoid using `sprintf`, to avoid compile-time deprecation warnings (Tom Lane) [§](https://postgr.es/c/a2acafc7b) +* Silence assorted compiler warnings from clang 15 and later (Tom Lane) [§](https://postgr.es/c/43f72e0f7) [§](https://postgr.es/c/ca3b730ba) [§](https://postgr.es/c/db8e36682) +* Update time zone data files to tzdata release 2022f for DST law changes in Chile, Fiji, Iran, Jordan, Mexico, Palestine, and Syria, plus historical corrections for Chile, Crimea, Iran, and Mexico. (Tom Lane) [§](https://postgr.es/c/ebf48810b) + + Also, the Europe/Kiev zone has been renamed to Europe/Kyiv. Also, the following zones have been merged into nearby, more-populous zones whose clocks have agreed with them since 1970: Antarctica/Vostok, Asia/Brunei, Asia/Kuala\_Lumpur, Atlantic/Reykjavik, Europe/Amsterdam, Europe/Copenhagen, Europe/Luxembourg, Europe/Monaco, Europe/Oslo, Europe/Stockholm, Indian/Christmas, Indian/Cocos, Indian/Kerguelen, Indian/Mahe, Indian/Reunion, Pacific/Chuuk, Pacific/Funafuti, Pacific/Majuro, Pacific/Pohnpei, Pacific/Wake and Pacific/Wallis. (This indirectly affects zones that were already links to one of these: Arctic/Longyearbyen, Atlantic/Jan\_Mayen, Iceland, Pacific/Ponape, Pacific/Truk, and Pacific/Yap.) America/Nipigon, America/Rainy\_River, America/Thunder\_Bay, Europe/Uzhgorod, and Europe/Zaporozhye were also merged into nearby zones after discovering that their claimed post-1970 differences from those zones seem to have been errors. In all these cases, the previous zone name remains as an alias; but the actual data is that of the zone that was merged into. + + These zone mergers result in loss of pre-1970 timezone history for the merged zones, which may be troublesome for applications expecting consistency of `timestamptz` display. As an example, the stored value `1944-06-01 12:00 UTC` would previously display as `1944-06-01 13:00:00+01` if the Europe/Stockholm zone is selected, but now it will read out as `1944-06-01 14:00:00+02`. + + It is possible to build the time zone data files with options that will restore the older zone data, but that choice also inserts a lot of other old (and typically poorly-attested) zone data, resulting in more total changes from the previous release than accepting these upstream changes does. PostgreSQL has chosen to ship the tzdb data as-recommended, and so far as we are aware most major operating system distributions are doing likewise. However, if these changes cause significant problems for your application, a possible solution is to install a local build of the time zone data files using tzdb's backwards-compatibility options (see their `PACKRATDATA` and `PACKRATLIST` options). + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-13-10.html "E.14. Release 13.10") | [Up](release.html "Appendix E. Release Notes") | [Next](release-13-8.html "E.16. Release 13.8") | +| E.14. Release 13.10 | [Home](index.html "PostgreSQL 13.23 Documentation") | E.16. Release 13.8 | + +[Previous](/docs/release/13.8/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/13.10/) diff --git a/corpus/changelog/postgresql_releases/postgresql_140.md b/corpus/changelog/postgresql_releases/postgresql_140.md new file mode 100644 index 0000000000000000000000000000000000000000..9914d23919026001246c455559ed02ee8bf0e128 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_140.md @@ -0,0 +1,1058 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.0/ +Version: 14.0 + +## PostgreSQL 14.0 + +| E.21. Release 14 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-14-1.html "E.20. Release 14.1") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-prior.html "E.22. Prior Releases") | + +--- + +## E.21. Release 14 + +[E.21.1. Overview](release-14.html#id-1.11.6.26.3) + +[E.21.2. Migration to Version 14](release-14.html#id-1.11.6.26.4) + +[E.21.3. Changes](release-14.html#id-1.11.6.26.5) + +[E.21.4. Acknowledgments](release-14.html#RELEASE-14-ACKNOWLEDGEMENTS) + +**Release date:**2021-09-30 + +### E.21.1. Overview + +PostgreSQL 14 contains many new features and enhancements, including: + +* Stored procedures can now return data via `OUT` parameters. +* The SQL-standard `SEARCH` and `CYCLE` options for common table expressions have been implemented. +* Subscripting can now be applied to any data type for which it is a useful notation, not only arrays. In this release, the `jsonb` and `hstore` types have gained subscripting operators. +* Range types have been extended by adding multiranges, allowing representation of noncontiguous data ranges. +* Numerous performance improvements have been made for parallel queries, heavily-concurrent workloads, partitioned tables, logical replication, and vacuuming. +* B-tree index updates are managed more efficiently, reducing index bloat. +* `VACUUM` automatically becomes more aggressive, and skips inessential cleanup, if the database starts to approach a transaction ID wraparound condition. +* Extended statistics can now be collected on expressions, allowing better planning results for complex queries. +* libpq now has the ability to pipeline multiple queries, which can boost throughput over high-latency connections. + +The above items and other new features of PostgreSQL 14 are explained in more detail in the sections below. + +### E.21.2. Migration to Version 14 + +A dump/restore using [pg\_dumpall](app-pg-dumpall.html "pg_dumpall") or use of [pg\_upgrade](pgupgrade.html "pg_upgrade") or logical replication is required for those wishing to migrate data from any previous release. See [Section 19.6](upgrading.html "19.6. Upgrading a PostgreSQL Cluster") for general information on migrating to new major releases. + +Version 14 contains a number of changes that may affect compatibility with previous releases. Observe the following incompatibilities: + +* User-defined objects that reference certain built-in array functions along with their argument types must be recreated (Tom Lane) [§](https://postgr.es/c/9e38c2bb5) + + Specifically, [`array_append()`](functions-array.html "9.19. Array Functions and Operators"), `array_prepend()`, `array_cat()`, `array_position()`, `array_positions()`, `array_remove()`, `array_replace()`, and [`width_bucket()`](functions-math.html "9.3. Mathematical Functions and Operators") used to take `anyarray` arguments but now take `anycompatiblearray`. Therefore, user-defined objects like aggregates and operators that reference those array function signatures must be dropped before upgrading, and recreated once the upgrade completes. +* Remove deprecated containment operators `@` and `~` for built-in [geometric data types](functions-geometry.html "9.11. Geometric Functions and Operators") and contrib modules [cube](cube.html "F.9. cube"), [hstore](hstore.html "F.16. hstore"), [intarray](intarray.html "F.18. intarray"), and [seg](seg.html "F.36. seg") (Justin Pryzby) [§](https://postgr.es/c/2f70fdb06) [§](https://postgr.es/c/112d411fb) + + The more consistently named `<@` and `@>` have been recommended for many years. +* Fix [`to_tsquery()`](functions-textsearch.html "9.13. Text Search Functions and Operators") and `websearch_to_tsquery()` to properly parse query text containing discarded tokens (Alexander Korotkov) [§](https://postgr.es/c/0c4f355c6) + + Certain discarded tokens, like underscore, caused the output of these functions to produce incorrect tsquery output, e.g., both `websearch_to_tsquery('"pg_class pg"')` and `to_tsquery('pg_class <-> pg')` used to output `( 'pg' & 'class' ) <-> 'pg'`, but now both output `'pg' <-> 'class' <-> 'pg'`. +* Fix [`websearch_to_tsquery()`](functions-textsearch.html "9.13. Text Search Functions and Operators") to properly parse multiple adjacent discarded tokens in quotes (Alexander Korotkov) [§](https://postgr.es/c/eb086056f) + + Previously, quoted text that contained multiple adjacent discarded tokens was treated as multiple tokens, causing incorrect tsquery output, e.g., `websearch_to_tsquery('"aaa: bbb"')` used to output `'aaa' <2> 'bbb'`, but now outputs `'aaa' <-> 'bbb'`. +* Change [`EXTRACT()`](functions-datetime.html "9.9. Date/Time Functions and Operators") to return type `numeric` instead of `float8` (Peter Eisentraut) [§](https://postgr.es/c/a2da77cdb) + + This avoids loss-of-precision issues in some usages. The old behavior can still be obtained by using the old underlying function `date_part()`. + + Also, `EXTRACT(date)` now throws an error for units that are not part of the `date` data type. +* Change [`var_samp()`](functions-aggregate.html "9.21. Aggregate Functions") and `stddev_samp()` with numeric parameters to return NULL when the input is a single NaN value (Tom Lane) [§](https://postgr.es/c/23cbeda50) + + Previously `NaN` was returned. +* Return false for [`has_column_privilege()`](functions-info.html "9.26. System Information Functions and Operators") checks on non-existent or dropped columns when using attribute numbers (Joe Conway) [§](https://postgr.es/c/b12bd4869) + + Previously such attribute numbers returned an invalid-column error. +* Fix handling of infinite [window function](sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS "4.2.8. Window Function Calls") ranges (Tom Lane) [§](https://postgr.es/c/a4faef8f8) + + Previously window frame clauses like `'inf' PRECEDING AND 'inf' FOLLOWING` returned incorrect results. +* Remove factorial operators `!` and `!!`, as well as function `numeric_fac()` (Mark Dilger) [§](https://postgr.es/c/76f412ab3) + + The [`factorial()`](functions-math.html "9.3. Mathematical Functions and Operators") function is still supported. +* Disallow `factorial()` of negative numbers (Peter Eisentraut) [§](https://postgr.es/c/0a40563ea) + + Previously such cases returned 1. +* Remove support for [postfix](sql-createoperator.html "CREATE OPERATOR") (right-unary) operators (Mark Dilger) [§](https://postgr.es/c/1ed6b8956) + + pg\_dump and pg\_upgrade will warn if postfix operators are being dumped. +* Allow `\D` and `\W` shorthands to match newlines in [regular expression](functions-matching.html#FUNCTIONS-POSIX-REGEXP "9.7.3. POSIX Regular Expressions") newline-sensitive mode (Tom Lane) [§](https://postgr.es/c/7dc13a0f0) + + Previously they did not match newlines in this mode, but that disagrees with the behavior of other common regular expression engines. `[^[:digit:]]` or `[^[:word:]]` can be used to get the old behavior. +* Disregard constraints when matching regular expression [back-references](functions-matching.html#POSIX-ESCAPE-SEQUENCES "9.7.3.3. Regular Expression Escapes") (Tom Lane) [§](https://postgr.es/c/4aea704a5) + + For example, in `(^\d+).*\1`, the `^` constraint should be applied at the start of the string, but not when matching `\1`. +* Disallow `\w` as a range start or end in regular expression character classes (Tom Lane) [§](https://postgr.es/c/2a0af7fe4) + + This previously was allowed but produced unexpected results. +* Require [custom server parameter](runtime-config-custom.html "20.16. Customized Options") names to use only characters that are valid in unquoted SQL identifiers (Tom Lane) [§](https://postgr.es/c/3db826bd5) [§](https://postgr.es/c/3db826bd5) +* Change the default of the [password\_encryption](runtime-config-connection.html#GUC-PASSWORD-ENCRYPTION) server parameter to `scram-sha-256` (Peter Eisentraut) [§](https://postgr.es/c/c7eab0e97) + + Previously it was `md5`. All new passwords will be stored as SHA256 unless this server setting is changed or the password is specified in MD5 format. Also, the legacy (and undocumented) Boolean-like values which were previously synonyms for `md5` are no longer accepted. +* Remove server parameter `vacuum_cleanup_index_scale_factor` (Peter Geoghegan) [§](https://postgr.es/c/9f3665fbf) [§](https://postgr.es/c/effdd3f3b) + + This setting was ignored starting in PostgreSQL version 13.3. +* Remove server parameter `operator_precedence_warning` (Tom Lane) [§](https://postgr.es/c/a676386b5) + + This setting was used for warning applications about PostgreSQL 9.5 changes. +* Overhaul the specification of `clientcert` in [`pg_hba.conf`](auth-pg-hba-conf.html "21.1. The pg_hba.conf File") (Kyotaro Horiguchi) [§](https://postgr.es/c/253f1025d) + + Values `1`/`0`/`no-verify` are no longer supported; only the strings `verify-ca` and `verify-full` can be used. Also, disallow `verify-ca` if cert authentication is enabled since cert requires `verify-full` checking. +* Remove support for [SSL](runtime-config-connection.html#RUNTIME-CONFIG-CONNECTION-SSL "20.3.3. SSL") compression (Daniel Gustafsson, Michael Paquier) [§](https://postgr.es/c/f9264d152) [§](https://postgr.es/c/0ba71107e) + + This was already disabled by default in previous PostgreSQL releases, and most modern OpenSSL and TLS versions no longer support it. +* Remove server and [libpq](libpq.html "Chapter 34. libpq — C Library") support for the version 2 [wire protocol](protocol.html "Chapter 53. Frontend/Backend Protocol") (Heikki Linnakangas) [§](https://postgr.es/c/3174d69fb) + + This was last used as the default in PostgreSQL 7.3 (released in 2002). +* Disallow single-quoting of the language name in the [`CREATE/DROP LANGUAGE`](sql-createlanguage.html "CREATE LANGUAGE") command (Peter Eisentraut) [§](https://postgr.es/c/5333e014a) +* Remove the [composite types](xfunc-sql.html#XFUNC-SQL-COMPOSITE-FUNCTIONS "38.5.3. SQL Functions on Composite Types") that were formerly created for sequences and toast tables (Tom Lane) [§](https://postgr.es/c/f3faf35f3) +* Process doubled quote marks in [ecpg](ecpg.html "Chapter 36. ECPG — Embedded SQL in C") SQL command strings correctly (Tom Lane) [§](https://postgr.es/c/3dfb1942d) [§](https://postgr.es/c/c16a1bbcf) + + Previously `'abc''def'` was passed to the server as `'abc'def'`, and `"abc""def"` was passed as `"abc"def"`, causing syntax errors. +* Prevent the containment operators (`<@` and `@>`) for [intarray](intarray.html "F.18. intarray") from using GiST indexes (Tom Lane) [§](https://postgr.es/c/20e7e1fe3) + + Previously a full GiST index scan was required, so just avoid that and scan the heap, which is faster. Indexes created for this purpose should be removed. +* Remove contrib program pg\_standby (Justin Pryzby) [§](https://postgr.es/c/514b411a2) +* Prevent [tablefunc](tablefunc.html "F.40. tablefunc")'s function `normal_rand()` from accepting negative values (Ashutosh Bapat) [§](https://postgr.es/c/f73999262) + + Negative values produced undesirable results. + +### E.21.3. Changes + +Below you will find a detailed account of the changes between PostgreSQL 14 and the previous major release. + +#### E.21.3.1. Server + +* Add predefined roles [`pg_read_all_data`](predefined-roles.html "22.5. Predefined Roles") and `pg_write_all_data` (Stephen Frost) [§](https://postgr.es/c/6c3ffd697) + + These non-login roles can be used to give read or write permission to all tables, views, and sequences. +* Add predefined role [`pg_database_owner`](predefined-roles.html "22.5. Predefined Roles") that contains only the current database's owner (Noah Misch) [§](https://postgr.es/c/a14a0118a) + + This is especially useful in template databases. +* Remove temporary files after backend crashes (Euler Taveira) [§](https://postgr.es/c/cd91de0d1) + + Previously, such files were retained for debugging purposes. If necessary, deletion can be disabled with the new server parameter [remove\_temp\_files\_after\_crash](runtime-config-developer.html#GUC-REMOVE-TEMP-FILES-AFTER-CRASH). +* Allow long-running queries to be canceled if the client disconnects (Sergey Cherkashin, Thomas Munro) [§](https://postgr.es/c/c30f54ad7) + + The server parameter [client\_connection\_check\_interval](runtime-config-connection.html#GUC-CLIENT-CONNECTION-CHECK-INTERVAL) allows control over whether loss of connection is checked for intra-query. (This is supported on Linux and a few other operating systems.) +* Add an optional timeout parameter to [`pg_terminate_backend()`](functions-admin.html#FUNCTIONS-ADMIN-SIGNAL "9.27.2. Server Signaling Functions") (Magnus Hagander) [§](https://postgr.es/c/aaf043257) +* Allow wide tuples to be always added to almost-empty heap pages (John Naylor, Floris van Nee) [§](https://postgr.es/c/0ff8bbdee) + + Previously tuples whose insertion would have exceeded the page's [fill factor](sql-createtable.html "CREATE TABLE") were instead added to new pages. +* Add Server Name Indication (SNI) in SSL connection packets (Peter Eisentraut) [§](https://postgr.es/c/5c55dc8b4) + + This can be disabled by turning off client connection option [`sslsni`](libpq-connect.html#LIBPQ-PARAMKEYWORDS "34.1.2. Parameter Key Words"). + +##### E.21.3.1.1. [Vacuuming](routine-vacuuming.html "25.1. Routine Vacuuming") + +* Allow vacuum to skip index vacuuming when the number of removable index entries is insignificant (Masahiko Sawada, Peter Geoghegan) [§](https://postgr.es/c/5100010ee) [§](https://postgr.es/c/3499df0de) + + The vacuum parameter [`INDEX_CLEANUP`](sql-vacuum.html "VACUUM") has a new default of `auto` that enables this optimization. +* Allow vacuum to more eagerly add deleted btree pages to the free space map (Peter Geoghegan) [§](https://postgr.es/c/9dd963ae2) + + Previously vacuum could only add pages to the free space map that were marked as deleted by previous vacuums. +* Allow vacuum to reclaim space used by unused trailing heap line pointers (Matthias van de Meent, Peter Geoghegan) [§](https://postgr.es/c/3c3b8a4b2) +* Allow vacuum to be more aggressive in removing dead rows during minimal-locking index operations (Álvaro Herrera) [§](https://postgr.es/c/c98763bf5) [§](https://postgr.es/c/f9900df5f) [§](https://postgr.es/c/d9d076222) + + Specifically, `CREATE INDEX CONCURRENTLY` and `REINDEX CONCURRENTLY` no longer limit the dead row removal of other relations. +* Speed up vacuuming of databases with many relations (Tatsuhito Kasahara) [§](https://postgr.es/c/e2ac3fed3) +* Reduce the default value of [vacuum\_cost\_page\_miss](runtime-config-resource.html#GUC-VACUUM-COST-PAGE-MISS) to better reflect current hardware capabilities (Peter Geoghegan) [§](https://postgr.es/c/e19594c5c) +* Add ability to skip vacuuming of TOAST tables (Nathan Bossart) [§](https://postgr.es/c/7cb3048f3) + + [`VACUUM`](sql-vacuum.html "VACUUM") now has a `PROCESS_TOAST` option which can be set to false to disable TOAST processing, and [vacuumdb](app-vacuumdb.html "vacuumdb") has a `--no-process-toast` option. +* Have [`COPY FREEZE`](sql-copy.html "COPY") appropriately update page visibility bits (Anastasia Lubennikova, Pavan Deolasee, Jeff Janes) [§](https://postgr.es/c/7db0cd214) +* Cause vacuum operations to be more aggressive if the table is near xid or multixact wraparound (Masahiko Sawada, Peter Geoghegan) [§](https://postgr.es/c/1e55e7d17) + + This is controlled by [vacuum\_failsafe\_age](runtime-config-client.html#GUC-VACUUM-FAILSAFE-AGE) and [vacuum\_multixact\_failsafe\_age](runtime-config-client.html#GUC-VACUUM-MULTIXACT-FAILSAFE-AGE). +* Increase warning time and hard limit before transaction id and multi-transaction wraparound (Noah Misch) [§](https://postgr.es/c/cd5e82256) + + This should reduce the possibility of failures that occur without having issued warnings about wraparound. +* Add per-index information to [autovacuum logging output](runtime-config-logging.html#GUC-LOG-AUTOVACUUM-MIN-DURATION) (Masahiko Sawada) [§](https://postgr.es/c/5aed6a1fc) + +##### E.21.3.1.2. [Partitioning](ddl-partitioning.html "5.11. Table Partitioning") + +* Improve the performance of updates and deletes on partitioned tables with many partitions (Amit Langote, Tom Lane) [§](https://postgr.es/c/86dc90056) [§](https://postgr.es/c/a1115fa07) [§](https://postgr.es/c/c5b7ba4e6) + + This change greatly reduces the planner's overhead for such cases, and also allows updates/deletes on partitioned tables to use execution-time partition pruning. +* Allow partitions to be [detached](sql-altertable.html "ALTER TABLE") in a non-blocking manner (Álvaro Herrera) [§](https://postgr.es/c/71f4c8c6f) + + The syntax is `ALTER TABLE ... DETACH PARTITION ... CONCURRENTLY`, and `FINALIZE`. +* Ignore `COLLATE` clauses in partition boundary values (Tom Lane) [§](https://postgr.es/c/2dfa3fea8) + + Previously any such clause had to match the collation of the partition key; but it's more consistent to consider that it's automatically coerced to the collation of the partition key. + +##### E.21.3.1.3. Indexes + +* Allow btree index additions to [remove expired index entries](btree-implementation.html#BTREE-DELETION "64.4.2. Bottom-up Index Deletion") to prevent page splits (Peter Geoghegan) [§](https://postgr.es/c/9dc718bdf) [§](https://postgr.es/c/d168b6668) + + This is particularly helpful for reducing index bloat on tables whose indexed columns are frequently updated. +* Allow [BRIN](brin.html "Chapter 68. BRIN Indexes") indexes to record multiple min/max values per range (Tomas Vondra) [§](https://postgr.es/c/ab596105b) + + This is useful if there are groups of values in each page range. +* Allow BRIN indexes to use bloom filters (Tomas Vondra) [§](https://postgr.es/c/77b88cd1b) + + This allows BRIN indexes to be used effectively with data that is not well-localized in the heap. +* Allow some [GiST](gist.html "Chapter 65. GiST Indexes") indexes to be built by presorting the data (Andrey Borodin) [§](https://postgr.es/c/16fa9b2b3) + + Presorting happens automatically and allows for faster index creation and smaller indexes. +* Allow [SP-GiST](spgist.html "Chapter 66. SP-GiST Indexes") indexes to contain `INCLUDE`'d columns (Pavel Borisov) [§](https://postgr.es/c/09c1c6ab4) + +##### E.21.3.1.4. Optimizer + +* Allow hash lookup for `IN` clauses with many constants (James Coleman, David Rowley) [§](https://postgr.es/c/50e17ad28) + + Previously the code always sequentially scanned the list of values. +* Increase the number of places [extended statistics](planner-stats.html#PLANNER-STATS-EXTENDED "14.2.2. Extended Statistics") can be used for `OR` clause estimation (Tomas Vondra, Dean Rasheed) [§](https://postgr.es/c/25a9e54d2) [§](https://postgr.es/c/88b0898fe) [§](https://postgr.es/c/4f5760d4a) +* Allow extended statistics on expressions (Tomas Vondra) [§](https://postgr.es/c/a4d75c86b) + + This allows statistics on a group of expressions and columns, rather than only columns like previously. System view [`pg_stats_ext_exprs`](view-pg-stats-ext-exprs.html "52.91. pg_stats_ext_exprs") reports such statistics. +* Allow efficient heap scanning of a range of [`TIDs`](datatype-oid.html#DATATYPE-OID-TABLE "Table 8.26. Object Identifier Types") (Edmund Horner, David Rowley) [§](https://postgr.es/c/bb437f995) + + Previously a sequential scan was required for non-equality `TID` specifications. +* Fix [`EXPLAIN CREATE TABLE AS`](sql-explain.html "EXPLAIN") and `EXPLAIN CREATE MATERIALIZED VIEW` to honor `IF NOT EXISTS` (Bharath Rupireddy) [§](https://postgr.es/c/e665769e6) + + Previously, if the object already existed, `EXPLAIN` would fail. + +##### E.21.3.1.5. General Performance + +* Improve the speed of computing MVCC [visibility snapshots](mvcc.html "Chapter 13. Concurrency Control") on systems with many CPUs and high session counts (Andres Freund) [§](https://postgr.es/c/dc7420c2c) [§](https://postgr.es/c/1f51c17c6) [§](https://postgr.es/c/941697c3c) [§](https://postgr.es/c/5788e258b) [§](https://postgr.es/c/73487a60f) [§](https://postgr.es/c/623a9ba79) + + This also improves performance when there are many idle sessions. +* Add executor method to memoize results from the inner side of a nested-loop join (David Rowley) [§](https://postgr.es/c/9eacee2e6) + + This is useful if only a small percentage of rows is checked on the inner side. It can be disabled via server parameter [enable\_memoize](runtime-config-query.html#GUC-ENABLE-MEMOIZE). +* Allow [window functions](functions-window.html "9.22. Window Functions") to perform incremental sorts (David Rowley) [§](https://postgr.es/c/62e221e1c) +* Improve the I/O performance of parallel sequential scans (Thomas Munro, David Rowley) [§](https://postgr.es/c/56788d215) + + This was done by allocating blocks in groups to [parallel workers](runtime-config-resource.html#GUC-MAX-PARALLEL-WORKERS). +* Allow a query referencing multiple [foreign tables](sql-createforeigntable.html "CREATE FOREIGN TABLE") to perform foreign table scans in parallel (Robert Haas, Kyotaro Horiguchi, Thomas Munro, Etsuro Fujita) [§](https://postgr.es/c/27e1f1456) + + [postgres\_fdw](postgres-fdw.html "F.35. postgres_fdw") supports this type of scan if `async_capable` is set. +* Allow [analyze](routine-vacuuming.html#VACUUM-FOR-STATISTICS "25.1.3. Updating Planner Statistics") to do page prefetching (Stephen Frost) [§](https://postgr.es/c/c6fc50cb4) + + This is controlled by [maintenance\_io\_concurrency](runtime-config-resource.html#GUC-MAINTENANCE-IO-CONCURRENCY). +* Improve performance of [regular expression](functions-matching.html#FUNCTIONS-POSIX-REGEXP "9.7.3. POSIX Regular Expressions") searches (Tom Lane) [§](https://postgr.es/c/08c0d6ad6) [§](https://postgr.es/c/824bf7190) [§](https://postgr.es/c/cebc1d34e) [§](https://postgr.es/c/581043089) [§](https://postgr.es/c/ea1268f63) [§](https://postgr.es/c/190c79884) [§](https://postgr.es/c/0fc1af174) [§](https://postgr.es/c/0c3405cf1) [§](https://postgr.es/c/4604f83fd) [§](https://postgr.es/c/6c20bdb2a) [§](https://postgr.es/c/f68970e33) +* Dramatically improve Unicode normalization performance (John Naylor) [§](https://postgr.es/c/80f8eb79e) [§](https://postgr.es/c/783f0cc64) + + This speeds [`normalize()`](functions-string.html "9.4. String Functions and Operators") and `IS NORMALIZED`. +* Add ability to use [LZ4 compression](sql-createtable.html "CREATE TABLE") on TOAST data (Dilip Kumar) [§](https://postgr.es/c/bbe0a81db) + + This can be set at the column level, or set as a default via server parameter [default\_toast\_compression](runtime-config-client.html#GUC-DEFAULT-TOAST-COMPRESSION). The server must be compiled with [`--with-lz4`](install-procedure.html#CONFIGURE-OPTIONS-FEATURES "17.4.1.2. PostgreSQL Features") to support this feature. The default setting is still pglz. + +##### E.21.3.1.6. Monitoring + +* If server parameter [compute\_query\_id](runtime-config-statistics.html#GUC-COMPUTE-QUERY-ID) is enabled, display the query id in [`pg_stat_activity`](monitoring-stats.html#MONITORING-PG-STAT-ACTIVITY-VIEW "28.2.3. pg_stat_activity"), [`EXPLAIN VERBOSE`](sql-explain.html "EXPLAIN"), [csvlog](runtime-config-logging.html "20.8. Error Reporting and Logging"), and optionally in [log\_line\_prefix](runtime-config-logging.html#GUC-LOG-LINE-PREFIX) (Julien Rouhaud) [§](https://postgr.es/c/4f0b0966c) [§](https://postgr.es/c/f57a2f5e0) [§](https://postgr.es/c/9660834dd) [§](https://postgr.es/c/f7a97b6ec) [§](https://postgr.es/c/cafde58b3) + + A query id computed by an extension will also be displayed. +* Improve logging of [auto-vacuum](routine-vacuuming.html#AUTOVACUUM "25.1.6. The Autovacuum Daemon") and auto-analyze (Stephen Frost, Jakub Wartak) [§](https://postgr.es/c/94d13d474) + + This reports I/O timings for auto-vacuum and auto-analyze if [track\_io\_timing](runtime-config-statistics.html#GUC-TRACK-IO-TIMING) is enabled. Also, report buffer read and dirty rates for auto-analyze. +* Add information about the original user name supplied by the client to the output of [log\_connections](runtime-config-logging.html#GUC-LOG-CONNECTIONS) (Jacob Champion) [§](https://postgr.es/c/9afffcb83) + +##### E.21.3.1.7. System Views + +* Add system view [`pg_stat_progress_copy`](progress-reporting.html#COPY-PROGRESS-REPORTING "28.4.6. COPY Progress Reporting") to report `COPY` progress (Josef Šimánek, Matthias van de Meent) [§](https://postgr.es/c/8a4f618e7) [§](https://postgr.es/c/9d2d45700) +* Add system view [`pg_stat_wal`](monitoring-stats.html#MONITORING-PG-STAT-WAL-VIEW "28.2.12. pg_stat_wal") to report WAL activity (Masahiro Ikeda) [§](https://postgr.es/c/8d9a93596) [§](https://postgr.es/c/01469241b) [§](https://postgr.es/c/ff99918c6) +* Add system view [`pg_stat_replication_slots`](monitoring-stats.html#MONITORING-PG-STAT-REPLICATION-SLOTS-VIEW "28.2.5. pg_stat_replication_slots") to report replication slot activity (Masahiko Sawada, Amit Kapila, Vignesh C) [§](https://postgr.es/c/986816750) [§](https://postgr.es/c/03d51b776) [§](https://postgr.es/c/8e90ec558) [§](https://postgr.es/c/f5fc2f5b2) + + The function [`pg_stat_reset_replication_slot()`](monitoring-stats.html#MONITORING-STATS-FUNCTIONS "28.2.22. Statistics Functions") resets slot statistics. +* Add system view [`pg_backend_memory_contexts`](view-pg-backend-memory-contexts.html "52.67. pg_backend_memory_contexts") to report session memory usage (Atsushi Torikoshi, Fujii Masao) [§](https://postgr.es/c/3e98c0baf) [§](https://postgr.es/c/29dd6d8bc) +* Add function [`pg_log_backend_memory_contexts()`](functions-admin.html#FUNCTIONS-ADMIN-SIGNAL "9.27.2. Server Signaling Functions") to output the memory contexts of arbitrary backends (Atsushi Torikoshi) [§](https://postgr.es/c/43620e328) +* Add session statistics to the [`pg_stat_database`](monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW "28.2.13. pg_stat_database") system view (Laurenz Albe) [§](https://postgr.es/c/960869da0) +* Add columns to [`pg_prepared_statements`](view-pg-prepared-statements.html "52.77. pg_prepared_statements") to report generic and custom plan counts (Atsushi Torikoshi, Kyotaro Horiguchi) [§](https://postgr.es/c/d05b172a7) +* Add lock wait start time to [`pg_locks`](view-pg-locks.html "52.74. pg_locks") (Atsushi Torikoshi) [§](https://postgr.es/c/46d6e5f56) +* Make the archiver process visible in `pg_stat_activity` (Kyotaro Horiguchi) [§](https://postgr.es/c/d75288fb2) +* Add wait event [`WalReceiverExit`](monitoring-stats.html#MONITORING-PG-STAT-ACTIVITY-VIEW "28.2.3. pg_stat_activity") to report WAL receiver exit wait time (Fujii Masao) [§](https://postgr.es/c/84007043f) +* Implement information schema view [`routine_column_usage`](infoschema-routine-column-usage.html "37.40. routine_column_usage") to track columns referenced by function and procedure default expressions (Peter Eisentraut) [§](https://postgr.es/c/f40c6969d) + +##### E.21.3.1.8. Authentication + +* Allow an SSL certificate's distinguished name (DN) to be matched for client certificate authentication (Andrew Dunstan) [§](https://postgr.es/c/6d7a6feac) + + The new [`pg_hba.conf`](auth-pg-hba-conf.html "21.1. The pg_hba.conf File") option `clientname=DN` allows comparison with certificate attributes beyond the `CN` and can be combined with ident maps. +* Allow `pg_hba.conf` and [`pg_ident.conf`](auth-username-maps.html "21.2. User Name Maps") records to span multiple lines (Fabien Coelho) [§](https://postgr.es/c/8f8154a50) + + A backslash at the end of a line allows record contents to be continued on the next line. +* Allow the specification of a certificate revocation list (CRL) directory (Kyotaro Horiguchi) [§](https://postgr.es/c/f5465fade) + + This is controlled by server parameter [ssl\_crl\_dir](runtime-config-connection.html#GUC-SSL-CRL-DIR) and libpq connection option [sslcrldir](libpq-connect.html#LIBPQ-CONNECT-SSLCRLDIR). Previously only single CRL files could be specified. +* Allow passwords of an arbitrary length (Tom Lane, Nathan Bossart) [§](https://postgr.es/c/67a472d71) + +##### E.21.3.1.9. Server Configuration + +* Add server parameter [idle\_session\_timeout](runtime-config-client.html#GUC-IDLE-SESSION-TIMEOUT) to close idle sessions (Li Japin) [§](https://postgr.es/c/9877374be) + + This is similar to [idle\_in\_transaction\_session\_timeout](runtime-config-client.html#GUC-IDLE-IN-TRANSACTION-SESSION-TIMEOUT). +* Change [checkpoint\_completion\_target](runtime-config-wal.html#GUC-CHECKPOINT-COMPLETION-TARGET) default to 0.9 (Stephen Frost) [§](https://postgr.es/c/bbcc4eb2e) + + The previous default was 0.5. +* Allow `%P` in [log\_line\_prefix](runtime-config-logging.html#GUC-LOG-LINE-PREFIX) to report the parallel group leader's PID for a parallel worker (Justin Pryzby) [§](https://postgr.es/c/b8fdee7d0) +* Allow [unix\_socket\_directories](runtime-config-connection.html#GUC-UNIX-SOCKET-DIRECTORIES) to specify paths as individual, comma-separated quoted strings (Ian Lawrence Barwick) [§](https://postgr.es/c/a05dbf477) + + Previously all the paths had to be in a single quoted string. +* Allow startup allocation of dynamic shared memory (Thomas Munro) [§](https://postgr.es/c/84b1c63ad) + + This is controlled by [min\_dynamic\_shared\_memory](runtime-config-resource.html#GUC-MIN-DYNAMIC-SHARED-MEMORY). This allows more use of huge pages. +* Add server parameter [huge\_page\_size](runtime-config-resource.html#GUC-HUGE-PAGE-SIZE) to control the size of huge pages used on Linux (Odin Ugedal) [§](https://postgr.es/c/d2bddc250) + +#### E.21.3.2. Streaming Replication and Recovery + +* Allow standby servers to be rewound via [pg\_rewind](app-pgrewind.html "pg_rewind") (Heikki Linnakangas) [§](https://postgr.es/c/9c4f5192f) +* Allow the [restore\_command](runtime-config-wal.html#GUC-RESTORE-COMMAND) setting to be changed during a server reload (Sergei Kornilov) [§](https://postgr.es/c/942305a36) + + You can also set `restore_command` to an empty string and reload to force recovery to only read from the [`pg_wal`](storage-file-layout.html "70.1. Database File Layout") directory. +* Add server parameter [log\_recovery\_conflict\_waits](runtime-config-logging.html#GUC-LOG-RECOVERY-CONFLICT-WAITS) to report long recovery conflict wait times (Bertrand Drouvot, Masahiko Sawada) [§](https://postgr.es/c/0650ff230) [§](https://postgr.es/c/39b03690b) +* Pause recovery on a hot standby server if the primary changes its parameters in a way that prevents replay on the standby (Peter Eisentraut) [§](https://postgr.es/c/15251c0a6) + + Previously the standby would shut down immediately. +* Add function [`pg_get_wal_replay_pause_state()`](functions-admin.html#FUNCTIONS-RECOVERY-CONTROL "9.27.4. Recovery Control Functions") to report the recovery state (Dilip Kumar) [§](https://postgr.es/c/32fd2b57d) + + It gives more detailed information than [`pg_is_wal_replay_paused()`](functions-admin.html#FUNCTIONS-RECOVERY-CONTROL "9.27.4. Recovery Control Functions"), which still exists. +* Add new read-only server parameter [in\_hot\_standby](runtime-config-preset.html#GUC-IN-HOT-STANDBY) (Haribabu Kommi, Greg Nancarrow, Tom Lane) [§](https://postgr.es/c/bf8a662c9) + + This allows clients to easily detect whether they are connected to a hot standby server. +* Speed truncation of small tables during recovery on clusters with a large number of shared buffers (Kirk Jamison) [§](https://postgr.es/c/d6ad34f34) +* Allow file system sync at the start of crash recovery on Linux (Thomas Munro) [§](https://postgr.es/c/61752afb2) + + By default, PostgreSQL opens and fsyncs each data file in the database cluster at the start of crash recovery. A new setting, [recovery\_init\_sync\_method](runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD)`=syncfs`, instead syncs each filesystem used by the cluster. This allows for faster recovery on systems with many database files. +* Add function [`pg_xact_commit_timestamp_origin()`](functions-info.html "9.26. System Information Functions and Operators") to return the commit timestamp and replication origin of the specified transaction (Movead Li) [§](https://postgr.es/c/b1e48bbe6) +* Add the replication origin to the record returned by [`pg_last_committed_xact()`](functions-info.html "9.26. System Information Functions and Operators") (Movead Li) [§](https://postgr.es/c/b1e48bbe6) +* Allow replication [origin functions](functions-admin.html#FUNCTIONS-REPLICATION "9.27.6. Replication Management Functions") to be controlled using standard function permission controls (Martín Marqués) [§](https://postgr.es/c/cc072641d) + + Previously these functions could only be executed by superusers, and this is still the default. + +##### E.21.3.2.1. [Logical Replication](logical-replication.html "Chapter 31. Logical Replication") + +* Allow logical replication to stream long in-progress transactions to subscribers (Dilip Kumar, Amit Kapila, Ajin Cherian, Tomas Vondra, Nikhil Sontakke, Stas Kelvich) [§](https://postgr.es/c/464824323) [§](https://postgr.es/c/0aa8a01d0) [§](https://postgr.es/c/a271a1b50) [§](https://postgr.es/c/7259736a6) + + Previously transactions that exceeded [logical\_decoding\_work\_mem](runtime-config-resource.html#GUC-LOGICAL-DECODING-WORK-MEM) were written to disk until the transaction completed. +* Enhance the logical replication API to allow streaming large in-progress transactions (Tomas Vondra, Dilip Kumar, Amit Kapila) [§](https://postgr.es/c/45fdc9738) + + The output functions begin with [`stream`](logicaldecoding-output-plugin.html#LOGICALDECODING-OUTPUT-PLUGIN-STREAM-START "49.6.4.14. Stream Start Callback"). test\_decoding also supports these. +* Allow multiple transactions during table sync in logical replication (Peter Smith, Amit Kapila, Takamichi Osumi) [§](https://postgr.es/c/ce0fdbfe9) +* Immediately WAL-log subtransaction and top-level `XID` association (Tomas Vondra, Dilip Kumar, Amit Kapila) [§](https://postgr.es/c/0bead9af4) + + This is useful for logical decoding. +* Enhance logical decoding APIs to handle two-phase commits (Ajin Cherian, Amit Kapila, Nikhil Sontakke, Stas Kelvich) [§](https://postgr.es/c/0aa8a01d0) [§](https://postgr.es/c/a271a1b50) [§](https://postgr.es/c/19890a064) + + This is controlled via [`pg_create_logical_replication_slot()`](functions-admin.html#FUNCTIONS-REPLICATION "9.27.6. Replication Management Functions"). +* Add cache invalidation messages to the WAL during command completion when using logical replication (Dilip Kumar, Tomas Vondra, Amit Kapila) [§](https://postgr.es/c/c55040ccd) + + This allows logical streaming of in-progress transactions. When logical replication is disabled, invalidation messages are generated only at transaction completion. +* Allow logical decoding to more efficiently process cache invalidation messages (Dilip Kumar) [§](https://postgr.es/c/d7eb52d71) + + This allows [logical decoding](logicaldecoding.html "Chapter 49. Logical Decoding") to work efficiently in presence of a large amount of DDL. +* Allow control over whether logical decoding messages are sent to the replication stream (David Pirotte, Euler Taveira) [§](https://postgr.es/c/ac4645c01) +* Allow logical replication subscriptions to use binary transfer mode (Dave Cramer) [§](https://postgr.es/c/9de77b545) + + This is faster than text mode, but slightly less robust. +* Allow logical decoding to be filtered by xid (Markus Wanner) [§](https://postgr.es/c/f64ea6dc5) + +#### E.21.3.3. [`SELECT`](sql-select.html "SELECT"), [`INSERT`](sql-insert.html "INSERT") + +* Reduce the number of keywords that can't be used as column labels without `AS` (Mark Dilger) [§](https://postgr.es/c/06a7c3154) + + There are now 90% fewer restricted keywords. +* Allow an alias to be specified for `JOIN`'s `USING` clause (Peter Eisentraut) [§](https://postgr.es/c/055fee7eb) + + The alias is created by writing `AS` after the `USING` clause. It can be used as a table qualification for the merged `USING` columns. +* Allow `DISTINCT` to be added to `GROUP BY` to remove duplicate `GROUPING SET` combinations (Vik Fearing) [§](https://postgr.es/c/be45be9c3) + + For example, `GROUP BY CUBE (a,b), CUBE (b,c)` will generate duplicate grouping combinations without `DISTINCT`. +* Properly handle `DEFAULT` entries in multi-row `VALUES` lists in `INSERT` (Dean Rasheed) [§](https://postgr.es/c/17958972f) + + Such cases used to throw an error. +* Add SQL-standard `SEARCH` and `CYCLE` clauses for [common table expressions](queries-with.html "7.8. WITH Queries (Common Table Expressions)") (Peter Eisentraut) [§](https://postgr.es/c/3696a600e) [§](https://postgr.es/c/f4adc41c4) + + The same results could be accomplished using existing syntax, but much less conveniently. +* Allow column names in the `WHERE` clause of `ON CONFLICT` to be table-qualified (Tom Lane) [§](https://postgr.es/c/6c0373ab7) + + Only the target table can be referenced, however. + +#### E.21.3.4. Utility Commands + +* Allow [`REFRESH MATERIALIZED VIEW`](sql-refreshmaterializedview.html "REFRESH MATERIALIZED VIEW") to use parallelism (Bharath Rupireddy) [§](https://postgr.es/c/9e7ccd9ef) +* Allow [`REINDEX`](sql-reindex.html "REINDEX") to change the tablespace of the new index (Alexey Kondratov, Michael Paquier, Justin Pryzby) [§](https://postgr.es/c/c5b286047) [§](https://postgr.es/c/57e6db706) + + This is done by specifying a `TABLESPACE` clause. A `--tablespace` option was also added to [reindexdb](app-reindexdb.html "reindexdb") to control this. +* Allow `REINDEX` to process all child tables or indexes of a partitioned relation (Justin Pryzby, Michael Paquier) [§](https://postgr.es/c/a6642b3ae) +* Allow index commands using `CONCURRENTLY` to avoid waiting for the completion of other operations using `CONCURRENTLY` (Álvaro Herrera) [§](https://postgr.es/c/c98763bf5) [§](https://postgr.es/c/f9900df5f) [§](https://postgr.es/c/d9d076222) +* Improve the performance of [`COPY FROM`](sql-copy.html "COPY") in binary mode (Bharath Rupireddy, Amit Langote) [§](https://postgr.es/c/0a0727ccf) +* Preserve SQL standard syntax for SQL-defined functions in [view definitions](sql-createview.html "CREATE VIEW") (Tom Lane) [§](https://postgr.es/c/40c24bfef) + + Previously, calls to SQL-standard functions such as [`EXTRACT()`](functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT "9.9.1. EXTRACT, date_part") were shown in plain function-call syntax. The original syntax is now preserved when displaying a view or rule. +* Add the SQL-standard clause `GRANTED BY` to [`GRANT`](sql-grant.html "GRANT") and [`REVOKE`](sql-revoke.html "REVOKE") (Peter Eisentraut) [§](https://postgr.es/c/6aaaa76bb) +* Add `OR REPLACE` option for [`CREATE TRIGGER`](sql-createtrigger.html "CREATE TRIGGER") (Takamichi Osumi) [§](https://postgr.es/c/92bf7e2d0) + + This allows pre-existing triggers to be conditionally replaced. +* Allow [`TRUNCATE`](sql-truncate.html "TRUNCATE") to operate on foreign tables (Kazutaka Onishi, Kohei KaiGai) [§](https://postgr.es/c/8ff1c9464) + + The [postgres\_fdw](postgres-fdw.html "F.35. postgres_fdw") module also now supports this. +* Allow publications to be more easily added to and removed from a subscription (Japin Li) [§](https://postgr.es/c/82ed7748b) + + The new syntax is [`ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION`](sql-altersubscription.html "ALTER SUBSCRIPTION"). This avoids having to specify all publications to add/remove entries. +* Add primary keys, unique constraints, and foreign keys to [system catalogs](catalogs.html "Chapter 52. System Catalogs") (Peter Eisentraut) [§](https://postgr.es/c/dfb75e478) [§](https://postgr.es/c/62f34097c) + + These changes help GUI tools analyze the system catalogs. The existing unique indexes of catalogs now have associated `UNIQUE` or `PRIMARY KEY` constraints. Foreign key relationships are not actually stored or implemented as constraints, but can be obtained for display from the function [pg\_get\_catalog\_foreign\_keys()](functions-info.html#FUNCTIONS-INFO-CATALOG-TABLE "Table 9.70. System Catalog Information Functions"). +* Allow [`CURRENT_ROLE`](functions-info.html "9.26. System Information Functions and Operators") every place `CURRENT_USER` is accepted (Peter Eisentraut) [§](https://postgr.es/c/45b980570) + +#### E.21.3.5. Data Types + +* Allow extensions and built-in data types to implement [subscripting](sql-altertype.html "ALTER TYPE") (Dmitry Dolgov) [§](https://postgr.es/c/c7aba7c14) + + Previously subscript handling was hard-coded into the server, so that subscripting could only be applied to array types. This change allows subscript notation to be used to extract or assign portions of a value of any type for which the concept makes sense. +* Allow subscripting of [`JSONB`](datatype-json.html "8.14. JSON Types") (Dmitry Dolgov) [§](https://postgr.es/c/676887a3b) [§](https://postgr.es/c/81fcc72e6) [§](https://postgr.es/c/aa6e46daf) + + `JSONB` subscripting can be used to extract and assign to portions of `JSONB` documents. +* Add support for [multirange data types](rangetypes.html "8.17. Range Types") (Paul Jungwirth, Alexander Korotkov) [§](https://postgr.es/c/6df7a9698) [§](https://postgr.es/c/db6335b5b) [§](https://postgr.es/c/62097a4cc) [§](https://postgr.es/c/244ad5415) + + These are like range data types, but they allow the specification of multiple, ordered, non-overlapping ranges. An associated multirange type is automatically created for every range type. +* Add support for the [stemming](textsearch-dictionaries.html#TEXTSEARCH-SNOWBALL-DICTIONARY "12.6.6. Snowball Dictionary") of languages Armenian, Basque, Catalan, Hindi, Serbian, and Yiddish (Peter Eisentraut) [§](https://postgr.es/c/cbcc8726b) [§](https://postgr.es/c/c2e71cb35) [§](https://postgr.es/c/678d0e239) +* Allow [tsearch data files](textsearch-intro.html#TEXTSEARCH-INTRO-CONFIGURATIONS "12.1.3. Configurations") to have unlimited line lengths (Tom Lane) [§](https://postgr.es/c/83b61319a) + + The previous limit was 4K bytes. Also remove function `t_readline()`. +* Add support for `Infinity` and `-Infinity` values in the [numeric data type](datatype-numeric.html "8.1. Numeric Types") (Tom Lane) [§](https://postgr.es/c/a57d312a7) + + Floating-point data types already supported these. +* Add [point operators](functions-geometry.html "9.11. Geometric Functions and Operators") `<<|` and `|>>` representing strictly above/below tests (Emre Hasegeli) [§](https://postgr.es/c/0cc993278) + + Previously these were called `>^` and `<^`, but that naming is inconsistent with other geometric data types. The old names remain available, but may someday be removed. +* Add operators to add and subtract [`LSN`](datatype-pg-lsn.html "8.20. pg_lsn Type") and numeric (byte) values (Fujii Masao) [§](https://postgr.es/c/9bae7e4cd) +* Allow [binary data transfer](protocol-overview.html#PROTOCOL-FORMAT-CODES "53.1.3. Formats and Format Codes") to be more forgiving of array and record `OID` mismatches (Tom Lane) [§](https://postgr.es/c/670c0a1d4) +* Create composite array types for system catalogs (Wenjing Zeng) [§](https://postgr.es/c/f7f70d5e2) + + User-defined relations have long had composite types associated with them, and also array types over those composite types. System catalogs now do as well. This change also fixes an inconsistency that creating a user-defined table in single-user mode would fail to create a composite array type. + +#### E.21.3.6. Functions + +* Allow SQL-language [functions](sql-createfunction.html "CREATE FUNCTION") and [procedures](sql-createprocedure.html "CREATE PROCEDURE") to use SQL-standard function bodies (Peter Eisentraut) [§](https://postgr.es/c/e717a9a18) + + Previously only string-literal function bodies were supported. When writing a function or procedure in SQL-standard syntax, the body is parsed immediately and stored as a parse tree. This allows better tracking of function dependencies, and can have security benefits. +* Allow [procedures](sql-createprocedure.html "CREATE PROCEDURE") to have `OUT` parameters (Peter Eisentraut) [§](https://postgr.es/c/2453ea142) [§](https://postgr.es/c/9213462c5) +* Allow some array functions to operate on a mix of compatible data types (Tom Lane) [§](https://postgr.es/c/9e38c2bb5) + + The functions [`array_append()`](functions-array.html "9.19. Array Functions and Operators"), `array_prepend()`, `array_cat()`, `array_position()`, `array_positions()`, `array_remove()`, `array_replace()`, and [`width_bucket()`](functions-math.html "9.3. Mathematical Functions and Operators") now take `anycompatiblearray` instead of `anyarray` arguments. This makes them less fussy about exact matches of argument types. +* Add SQL-standard [`trim_array()`](functions-array.html "9.19. Array Functions and Operators") function (Vik Fearing) [§](https://postgr.es/c/0a687c8f1) + + This could already be done with array slices, but less easily. +* Add `bytea` equivalents of [`ltrim()`](functions-binarystring.html "9.5. Binary String Functions and Operators") and `rtrim()` (Joel Jacobson) [§](https://postgr.es/c/a6cf3df4e) +* Support negative indexes in [`split_part()`](functions-string.html "9.4. String Functions and Operators") (Nikhil Benesch) [§](https://postgr.es/c/ec0294fb2) + + Negative values start from the last field and count backward. +* Add [`string_to_table()`](functions-string.html "9.4. String Functions and Operators") function to split a string on delimiters (Pavel Stehule) [§](https://postgr.es/c/66f163068) + + This is similar to the [`regexp_split_to_table()`](functions-string.html "9.4. String Functions and Operators") function. +* Add [`unistr()`](functions-string.html "9.4. String Functions and Operators") function to allow Unicode characters to be specified as backslash-hex escapes in strings (Pavel Stehule) [§](https://postgr.es/c/f37fec837) + + This is similar to how Unicode can be specified in literal strings. +* Add [`bit_xor()`](functions-aggregate.html "9.21. Aggregate Functions") XOR aggregate function (Alexey Bashtanov) [§](https://postgr.es/c/f9a0392e1) +* Add function [`bit_count()`](functions-binarystring.html "9.5. Binary String Functions and Operators") to return the number of bits set in a bit or byte string (David Fetter) [§](https://postgr.es/c/a6715af1e) +* Add [`date_bin()`](functions-datetime.html#FUNCTIONS-DATETIME-BIN "9.9.3. date_bin") function (John Naylor) [§](https://postgr.es/c/49ab61f0b) [§](https://postgr.es/c/496e58bb0) + + This function “bins” input timestamps, grouping them into intervals of a uniform length aligned with a specified origin. +* Allow [`make_timestamp()`](functions-datetime.html "9.9. Date/Time Functions and Operators")/`make_timestamptz()` to accept negative years (Peter Eisentraut) [§](https://postgr.es/c/a094c8ff5) + + Negative values are interpreted as `BC` years. +* Add newer regular expression [`substring()`](functions-string.html "9.4. String Functions and Operators") syntax (Peter Eisentraut) [§](https://postgr.es/c/78c887679) + + The new SQL-standard syntax is `SUBSTRING(text SIMILAR pattern ESCAPE escapechar)`. The previous standard syntax was `SUBSTRING(text FROM pattern FOR escapechar)`, which is still accepted by PostgreSQL. +* Allow complemented character class escapes [\D](functions-matching.html#POSIX-ESCAPE-SEQUENCES "9.7.3.3. Regular Expression Escapes"), `\S`, and `\W` within regular expression brackets (Tom Lane) [§](https://postgr.es/c/2a0af7fe4) +* Add [`[[:word:]]`](functions-matching.html#POSIX-BRACKET-EXPRESSIONS "9.7.3.2. Bracket Expressions") as a regular expression character class, equivalent to `\w` (Tom Lane) [§](https://postgr.es/c/2a0af7fe4) +* Allow more flexible data types for default values of [`lead()`](functions-window.html "9.22. Window Functions") and `lag()` window functions (Vik Fearing) [§](https://postgr.es/c/5c292e6b9) +* Make non-zero [floating-point values](datatype-numeric.html#DATATYPE-FLOAT "8.1.3. Floating-Point Types") divided by infinity return zero (Kyotaro Horiguchi) [§](https://postgr.es/c/fac83dbd6) + + Previously such operations produced underflow errors. +* Make floating-point division of NaN by zero return NaN (Tom Lane) [§](https://postgr.es/c/4fb6aeb4f) + + Previously this returned an error. +* Cause [`exp()`](functions-math.html "9.3. Mathematical Functions and Operators") and `power()` for negative-infinity exponents to return zero (Tom Lane) [§](https://postgr.es/c/decbe2bfb) [§](https://postgr.es/c/e532b1d57) [§](https://postgr.es/c/5674eb987) + + Previously they often returned underflow errors. +* Improve the accuracy of geometric computations involving infinity (Tom Lane) [§](https://postgr.es/c/8597a48d0) +* Mark built-in type coercion functions as leakproof where possible (Tom Lane) [§](https://postgr.es/c/8a37951ee) + + This allows more use of functions that require type conversion in security-sensitive situations. +* Change [`pg_describe_object()`](functions-info.html "9.26. System Information Functions and Operators"), `pg_identify_object()`, and `pg_identify_object_as_address()` to always report helpful error messages for non-existent objects (Michael Paquier) [§](https://postgr.es/c/2a10fdc43) + +#### E.21.3.7. [PL/pgSQL](plpgsql.html "Chapter 43. PL/pgSQL — SQL Procedural Language") + +* Improve PL/pgSQL's [expression](plpgsql-expressions.html "43.4. Expressions") and [assignment](plpgsql-statements.html#PLPGSQL-STATEMENTS-ASSIGNMENT "43.5.1. Assignment") parsing (Tom Lane) [§](https://postgr.es/c/c9d529848) + + This change allows assignment to array slices and nested record fields. +* Allow plpgsql's [`RETURN QUERY`](plpgsql-control-structures.html "43.6. Control Structures") to execute its query using parallelism (Tom Lane) [§](https://postgr.es/c/2f48ede08) +* Improve performance of repeated [CALL](plpgsql-transactions.html "43.8. Transaction Management")s within plpgsql procedures (Pavel Stehule, Tom Lane) [§](https://postgr.es/c/ee895a655) + +#### E.21.3.8. Client Interfaces + +* Add [pipeline](libpq-pipeline-mode.html#LIBPQ-PIPELINE-SENDING "34.5.1.1. Issuing Queries") mode to libpq (Craig Ringer, Matthieu Garrigues, Álvaro Herrera) [§](https://postgr.es/c/acb7e4eb6) + + This allows multiple queries to be sent, only waiting for completion when a specific synchronization message is sent. +* Enhance libpq's [`target_session_attrs`](libpq-connect.html#LIBPQ-PARAMKEYWORDS "34.1.2. Parameter Key Words") parameter options (Haribabu Kommi, Greg Nancarrow, Vignesh C, Tom Lane) [§](https://postgr.es/c/d16f8c8e4) [§](https://postgr.es/c/ee28cacf6) + + The new options are `read-only`, `primary`, `standby`, and `prefer-standby`. +* Improve the output format of libpq's [`PQtrace()`](libpq-control.html "34.11. Control Functions") (Aya Iwata, Álvaro Herrera) [§](https://postgr.es/c/198b3716d) +* Allow an ECPG SQL identifier to be linked to a specific connection (Hayato Kuroda) [§](https://postgr.es/c/ad8305a43) + + This is done via [`DECLARE ... STATEMENT`](ecpg-sql-declare-statement.html "DECLARE STATEMENT"). + +#### E.21.3.9. Client Applications + +* Allow [vacuumdb](app-vacuumdb.html "vacuumdb") to skip index cleanup and truncation (Nathan Bossart) [§](https://postgr.es/c/9550ea302) + + The options are `--no-index-cleanup` and `--no-truncate`. +* Allow [pg\_dump](app-pgdump.html "pg_dump") to dump only certain extensions (Guillaume Lelarge) [§](https://postgr.es/c/6568cef26) + + This is controlled by option `--extension`. +* Add [pgbench](pgbench.html "pgbench") `permute()` function to randomly shuffle values (Fabien Coelho, Hironobu Suzuki, Dean Rasheed) [§](https://postgr.es/c/6b258e3d6) +* Include disconnection times in the reconnection overhead measured by pgbench with `-C` (Yugo Nagata) [§](https://postgr.es/c/d760d942c) +* Allow multiple verbose option specifications (`-v`) to increase the logging verbosity (Tom Lane) [§](https://postgr.es/c/99175141c) + + This behavior is supported by [pg\_dump](app-pgdump.html "pg_dump"), [pg\_dumpall](app-pg-dumpall.html "pg_dumpall"), and [pg\_restore](app-pgrestore.html "pg_restore"). + +##### E.21.3.9.1. [psql](app-psql.html "psql") + +* Allow psql's `\df` and `\do` commands to specify function and operator argument types (Greg Sabino Mullane, Tom Lane) [§](https://postgr.es/c/a3027e1e7) + + This helps reduce the number of matches printed for overloaded names. +* Add an access method column to psql's `\d[i|m|t]+` output (Georgios Kokolatos) [§](https://postgr.es/c/07f386ede) +* Allow psql's `\dt` and `\di` to show TOAST tables and their indexes (Justin Pryzby) [§](https://postgr.es/c/7d80441d2) +* Add psql command `\dX` to list extended statistics objects (Tatsuro Yamada) [§](https://postgr.es/c/ad600bba0) +* Fix psql's `\dT` to understand array syntax and backend grammar aliases, like `int` for `integer` (Greg Sabino Mullane, Tom Lane) [§](https://postgr.es/c/a3027e1e7) +* When editing the previous query or a file with psql's `\e`, or using `\ef` and `\ev`, ignore the results if the editor exits without saving (Laurenz Albe) [§](https://postgr.es/c/55873a00e) + + Previously, such edits would load the previous query into the query buffer, and typically execute it immediately. This was deemed to be probably not what the user wants. +* Improve tab completion (Vignesh C, Michael Paquier, Justin Pryzby, Georgios Kokolatos, Julien Rouhaud) [§](https://postgr.es/c/c273d9d8c) [§](https://postgr.es/c/f1af75c5f) [§](https://postgr.es/c/1f75b4541) [§](https://postgr.es/c/7307df16a) [§](https://postgr.es/c/0baf82fa0) [§](https://postgr.es/c/0b46e82c0) [§](https://postgr.es/c/bf0aa7c4b) [§](https://postgr.es/c/3f238b882) [§](https://postgr.es/c/e1c02d92a) [§](https://postgr.es/c/e6b8e83b9) [§](https://postgr.es/c/5bc09a747) [§](https://postgr.es/c/6b40d9bdb) [§](https://postgr.es/c/5b2266e33) [§](https://postgr.es/c/d1fcbde57) [§](https://postgr.es/c/81e094bdf) [§](https://postgr.es/c/22b2dec31) [§](https://postgr.es/c/6dd1042ed) [§](https://postgr.es/c/1906cc07d) + +#### E.21.3.10. Server Applications + +* Add command-line utility [pg\_amcheck](app-pgamcheck.html "pg_amcheck") to simplify running `contrib/amcheck` tests on many relations (Mark Dilger) [§](https://postgr.es/c/970609283) +* Add `--no-instructions` option to [initdb](app-initdb.html "initdb") (Magnus Hagander) [§](https://postgr.es/c/e09155bd6) + + This suppresses the server startup instructions that are normally printed. +* Stop [pg\_upgrade](pgupgrade.html "pg_upgrade") from creating `analyze_new_cluster` script (Magnus Hagander) [§](https://postgr.es/c/8f113698b) + + Instead, give comparable [vacuumdb](app-vacuumdb.html "vacuumdb") instructions. +* Remove support for the [postmaster](app-postgres.html "postgres") `-o` option (Magnus Hagander) [§](https://postgr.es/c/d2e4bf688) + + This option was unnecessary since all passed options could already be specified directly. + +#### E.21.3.11. Documentation + +* Rename "Default Roles" to ["Predefined Roles"](predefined-roles.html "22.5. Predefined Roles") (Bruce Momjian, Stephen Frost) [§](https://postgr.es/c/c9c41c7a3) +* Add documentation for the [`factorial()`](functions-math.html#FUNCTION-FACTORIAL) function (Peter Eisentraut) [§](https://postgr.es/c/4c5cf5431) + + With the removal of the ! operator in this release, `factorial()` is the only built-in way to compute a factorial. + +#### E.21.3.12. Source Code + +* Add configure option [`--with-ssl={openssl}`](install-procedure.html#CONFIGURE-OPTIONS-FEATURES "17.4.1.2. PostgreSQL Features") to allow future choice of the SSL library to use (Daniel Gustafsson, Michael Paquier) [§](https://postgr.es/c/fe61df7f8) + + The spelling `--with-openssl` is kept for compatibility. +* Add support for [abstract Unix-domain sockets](runtime-config-connection.html#GUC-UNIX-SOCKET-DIRECTORIES) (Peter Eisentraut) [§](https://postgr.es/c/c9f0624bc) + + This is currently supported on Linux and Windows. +* Allow Windows to properly handle files larger than four gigabytes (Juan José Santamaría Flecha) [§](https://postgr.es/c/bed90759f) + + For example this allows [`COPY,`](sql-copy.html "COPY") [WAL](install-procedure.html#CONFIGURE-OPTIONS-MISC "17.4.1.5. Miscellaneous") files, and relation segment files to be larger than four gigabytes. +* Add server parameter [debug\_discard\_caches](runtime-config-developer.html#GUC-DEBUG-DISCARD-CACHES) to control cache flushing for test purposes (Craig Ringer) [§](https://postgr.es/c/4656e3d66) [§](https://postgr.es/c/d04770801) [§](https://postgr.es/c/6201fa3c1) + + Previously this behavior could only be set at compile time. To invoke it during initdb, use the new option `--discard-caches`. +* Various improvements in valgrind error detection ability (Álvaro Herrera, Peter Geoghegan) [§](https://postgr.es/c/1e0dfd166) [§](https://postgr.es/c/46ef520b9) [§](https://postgr.es/c/a766d6ca2) +* Add a test module for the regular expression package (Tom Lane) [§](https://postgr.es/c/ca8217c10) +* Add support for LLVM version 12 (Andres Freund) [§](https://postgr.es/c/6c57f2ed1) +* Change SHA1, SHA2, and MD5 hash computations to use the OpenSSL EVP API (Michael Paquier) [§](https://postgr.es/c/4f48a6fbe) [§](https://postgr.es/c/b67b57a96) [§](https://postgr.es/c/a8ed6bb8f) [§](https://postgr.es/c/e6bdfd970) + + This is more modern and supports FIPS mode. +* Remove separate build-time control over the choice of random number generator (Daniel Gustafsson) [§](https://postgr.es/c/16f96c74d) + + This is now always determined by the choice of SSL library. +* Add direct conversion routines between EUC\_TW and Big5 encodings (Heikki Linnakangas) [§](https://postgr.es/c/6c5576075) +* Add collation version support for FreeBSD (Thomas Munro) [§](https://postgr.es/c/ca051d8b1) +* Add [`amadjustmembers`](index-api.html "62.1. Basic API Structure for Indexes") to the index access method API (Tom Lane) [§](https://postgr.es/c/9f9682783) + + This allows an index access method to provide validity checking during creation of a new operator class or family. +* Provide feature-test macros in `libpq-fe.h` for recently-added libpq features (Tom Lane, Álvaro Herrera) [§](https://postgr.es/c/6991e774e) + + Historically, applications have usually used compile-time checks of `PG_VERSION_NUM` to test whether a feature is available. But that's normally the server version, which might not be a good guide to libpq's version. `libpq-fe.h` now offers `#define` symbols denoting application-visible features added in v14; the intent is to keep adding symbols for such features in future versions. + +#### E.21.3.13. Additional Modules + +* Allow subscripting of [hstore](hstore.html "F.16. hstore") values (Tom Lane, Dmitry Dolgov) [§](https://postgr.es/c/0ec5f7e78) +* Allow GiST/GIN [pg\_trgm](pgtrgm.html "F.33. pg_trgm") indexes to do equality lookups (Julien Rouhaud) [§](https://postgr.es/c/935f66665) + + This is similar to `LIKE` except no wildcards are honored. +* Allow the [cube](cube.html "F.9. cube") data type to be transferred in binary mode (KaiGai Kohei) [§](https://postgr.es/c/1265a9c8f) +* Allow [`pgstattuple_approx()`](pgstattuple.html "F.31. pgstattuple") to report on TOAST tables (Peter Eisentraut) [§](https://postgr.es/c/ee0202d55) +* Add contrib module [pg\_surgery](pgsurgery.html "F.32. pg_surgery") which allows changes to row visibility (Ashutosh Sharma) [§](https://postgr.es/c/34a947ca1) + + This is useful for correcting database corruption. +* Add contrib module [old\_snapshot](oldsnapshot.html "F.22. old_snapshot") to report the `XID`/time mapping used by an active [old\_snapshot\_threshold](runtime-config-resource.html#GUC-OLD-SNAPSHOT-THRESHOLD) (Robert Haas) [§](https://postgr.es/c/aecf5ee2b) +* Allow [amcheck](amcheck.html "F.2. amcheck") to also check heap pages (Mark Dilger) [§](https://postgr.es/c/866e24d47) + + Previously it only checked B-Tree index pages. +* Allow [pageinspect](pageinspect.html "F.23. pageinspect") to inspect GiST indexes (Andrey Borodin, Heikki Linnakangas) [§](https://postgr.es/c/756ab2912) [§](https://postgr.es/c/9e596b65f) +* Change pageinspect block numbers to be [`bigints`](datatype-numeric.html#DATATYPE-INT "8.1.1. Integer Types") (Peter Eisentraut) [§](https://postgr.es/c/f18aa1b20) +* Mark [btree\_gist](btree-gist.html "F.7. btree_gist") functions as parallel safe (Steven Winfield) [§](https://postgr.es/c/d98c08cdc) + +##### E.21.3.13.1. [pg\_stat\_statements](pgstatstatements.html "F.30. pg_stat_statements") + +* Move query hash computation from pg\_stat\_statements to the core server (Julien Rouhaud) [§](https://postgr.es/c/5fd9dfa5f) + + The new server parameter [compute\_query\_id](runtime-config-statistics.html#GUC-COMPUTE-QUERY-ID)'s default of `auto` will automatically enable query id computation when this extension is loaded. +* Cause pg\_stat\_statements to track top and nested statements separately (Julien Rohaud) [§](https://postgr.es/c/6b4d23fee) + + Previously, when tracking all statements, identical top and nested statements were tracked as a single entry; but it seems more useful to separate such usages. +* Add row counts for utility commands to pg\_stat\_statements (Fujii Masao, Katsuragi Yuta, Seino Yuki) [§](https://postgr.es/c/6023b7ea7) [§](https://postgr.es/c/b62e6056a) +* Add `pg_stat_statements_info` system view to show pg\_stat\_statements activity (Katsuragi Yuta, Yuki Seino, Naoki Nakamichi) [§](https://postgr.es/c/9fbc3f318) [§](https://postgr.es/c/2e0fedf03) + +##### E.21.3.13.2. [postgres\_fdw](postgres-fdw.html "F.35. postgres_fdw") + +* Allow postgres\_fdw to `INSERT` rows in bulk (Takayuki Tsunakawa, Tomas Vondra, Amit Langote) [§](https://postgr.es/c/b663a4136) [§](https://postgr.es/c/927f453a9) +* Allow postgres\_fdw to import table partitions if specified by [`IMPORT FOREIGN SCHEMA ... LIMIT TO`](sql-importforeignschema.html "IMPORT FOREIGN SCHEMA") (Matthias van de Meent) [§](https://postgr.es/c/a3740c48e) + + By default, only the root of a partitioned table is imported. +* Add postgres\_fdw function `postgres_fdw_get_connections()` to report open foreign server connections (Bharath Rupireddy) [§](https://postgr.es/c/708d165dd) +* Allow control over whether foreign servers keep connections open after transaction completion (Bharath Rupireddy) [§](https://postgr.es/c/b1be3074a) + + This is controlled by `keep_connections` and defaults to on. +* Allow postgres\_fdw to reestablish foreign server connections if necessary (Bharath Rupireddy) [§](https://postgr.es/c/32a9c0bdf) [§](https://postgr.es/c/7fc1a81e4) + + Previously foreign server restarts could cause foreign table access errors. +* Add postgres\_fdw functions to discard cached connections (Bharath Rupireddy) [§](https://postgr.es/c/411ae6499) + +### E.21.4. Acknowledgments + +The following individuals (in alphabetical order) have contributed to this release as patch authors, committers, reviewers, testers, or reporters of issues. + +| | +| --- | +| Abhijit Menon-Sen | +| Ádám Balogh | +| Adrian Ho | +| Ahsan Hadi | +| Ajin Cherian | +| Aleksander Alekseev | +| Alessandro Gherardi | +| Alex Kozhemyakin | +| Alexander Korotkov | +| Alexander Lakhin | +| Alexander Nawratil | +| Alexander Pyhalov | +| Alexandra Wang | +| Alexey Bashtanov | +| Alexey Bulgakov | +| Alexey Kondratov | +| Álvaro Herrera | +| Amit Kapila | +| Amit Khandekar | +| Amit Langote | +| Amul Sul | +| Anastasia Lubennikova | +| Andreas Grob | +| Andreas Kretschmer | +| Andreas Seltenreich | +| Andreas Wicht | +| Andres Freund | +| Andrew Bille | +| Andrew Dunstan | +| Andrew Gierth | +| Andrey Borodin | +| Andrey Lepikhov | +| Andy Fan | +| Anton Voloshin | +| Antonin Houska | +| Arne Roland | +| Arseny Sher | +| Arthur Nascimento | +| Arthur Zakirov | +| Ashutosh Bapat | +| Ashutosh Sharma | +| Ashwin Agrawal | +| Asif Rehman | +| Asim Praveen | +| Atsushi Torikoshi | +| Aya Iwata | +| Barry Pederson | +| Bas Poot | +| Bauyrzhan Sakhariyev | +| Beena Emerson | +| Benoît Lobréau | +| Bernd Helmle | +| Bernhard M. Wiedemann | +| Bertrand Drouvot | +| Bharath Rupireddy | +| Boris Kolpackov | +| Brar Piening | +| Brian Ye | +| Bruce Momjian | +| Bryn Llewellyn | +| Cameron Daniel | +| Chapman Flack | +| Charles Samborski | +| Charlie Hornsby | +| Chen Jiaoqian | +| Chris Wilson | +| Christian Quest | +| Christoph Berg | +| Christophe Courtois | +| Corey Huinker | +| Craig Ringer | +| Dagfinn Ilmari Mannsåker | +| Dana Burd | +| Daniel Cherniy | +| Daniel Gustafsson | +| Daniel Vérité | +| Daniel Westermann | +| Daniele Varrazzo | +| Dar Alathar-Yemen | +| Darafei Praliaskouski | +| Dave Cramer | +| David Christensen | +| David Fetter | +| David G. Johnston | +| David Geier | +| David Gilman | +| David Pirotte | +| David Rowley | +| David Steele | +| David Turon | +| David Zhang | +| Dean Rasheed | +| Denis Patron | +| Dian Fay | +| Dilip Kumar | +| Dimitri Nüscheler | +| Dmitriy Kuzmin | +| Dmitry Dolgov | +| Dmitry Marakasov | +| Domagoj Smoljanovic | +| Dong Wook | +| Douglas Doole | +| Duncan Sands | +| Edmund Horner | +| Edson Richter | +| Egor Rogov | +| Ekaterina Kiryanova | +| Elena Indrupskaya | +| Emil Iggland | +| Emre Hasegeli | +| Eric Thinnes | +| Erik Rijkers | +| Erwin Brandstetter | +| Etienne Stalmans | +| Etsuro Fujita | +| Eugen Konkov | +| Euler Taveira | +| Fabien Coelho | +| Fabrízio de Royes Mello | +| Federico Caselli | +| Felix Lechner | +| Filip Gospodinov | +| Floris Van Nee | +| Frank Gagnepain | +| Frits Jalvingh | +| Georgios Kokolatos | +| Greg Nancarrow | +| Greg Rychlewski | +| Greg Sabino Mullane | +| Gregory Smith | +| Grigory Smolkin | +| Guillaume Lelarge | +| Guy Burgess | +| Guyren Howe | +| Haiying Tang | +| Hamid Akhtar | +| Hans Buschmann | +| Hao Wu | +| Haribabu Kommi | +| Harisai Hari | +| Hayato Kuroda | +| Heath Lord | +| Heikki Linnakangas | +| Henry Hinze | +| Herwig Goemans | +| Himanshu Upadhyaya | +| Hironobu Suzuki | +| Hiroshi Inoue | +| Hisanori Kobayashi | +| Honza Horak | +| Hou Zhijie | +| Hubert Lubaczewski | +| Hubert Zhang | +| Ian Barwick | +| Ibrar Ahmed | +| Ildus Kurbangaliev | +| Isaac Morland | +| Israel Barth | +| Itamar Gafni | +| Jacob Champion | +| Jaime Casanova | +| Jaime Soler | +| Jakub Wartak | +| James Coleman | +| James Hilliard | +| James Hunter | +| James Inform | +| Jan Mussler | +| Japin Li | +| Jasen Betts | +| Jason Harvey | +| Jason Kim | +| Jeevan Ladhe | +| Jeff Davis | +| Jeff Janes | +| Jelte Fennema | +| Jeremy Evans | +| Jeremy Finzel | +| Jeremy Smith | +| Jesse Kinkead | +| Jesse Zhang | +| Jie Zhang | +| Jim Doty | +| Jim Nasby | +| Jimmy Angelakos | +| Jimmy Yih | +| Jiri Fejfar | +| Joe Conway | +| Joel Jacobson | +| John Naylor | +| John Thompson | +| Jonathan Katz | +| Josef Šimánek | +| Joseph Nahmias | +| Josh Berkus | +| Juan José Santamaría Flecha | +| Julien Rouhaud | +| Junfeng Yang | +| Jürgen Purtz | +| Justin Pryzby | +| Kazutaka Onishi | +| Keisuke Kuroda | +| Kelly Min | +| Kensuke Okamura | +| Kevin Sweet | +| Kevin Yeap | +| Kirk Jamison | +| Kohei KaiGai | +| Konstantin Knizhnik | +| Kota Miyake | +| Krzysztof Gradek | +| Kuntal Ghosh | +| Kyle Kingsbury | +| Kyotaro Horiguchi | +| Laurent Hasson | +| Laurenz Albe | +| Lee Dong Wook | +| Li Japin | +| Liu Huailing | +| Luc Vlaming | +| Ludovic Kuty | +| Luis Roberto | +| Lukas Eder | +| Ma Liangzhu | +| Maciek Sakrejda | +| Madan Kumar | +| Magnus Hagander | +| Mahendra Singh Thalor | +| Maksim Milyutin | +| Marc Boeren | +| Marcin Krupowicz | +| Marco Atzeri | +| Marek Szuba | +| Marina Polyakova | +| Mario Emmenlauer | +| Mark Dilger | +| Mark Wong | +| Mark Zhao | +| Markus Wanner | +| Martín Marqués | +| Martin Visser | +| Masahiko Sawada | +| Masahiro Ikeda | +| Masao Fujii | +| Mathis Rudolf | +| Matthias van de Meent | +| Matthieu Garrigues | +| Matthijs van der Vleuten | +| Maxim Orlov | +| Melanie Plageman | +| Merlin Moncure | +| Michael Banck | +| Michael Brown | +| Michael Meskes | +| Michael Paquier | +| Michael Paul Killian | +| Michael Powers | +| Michael Vastola | +| Michail Nikolaev | +| Michal Albrycht | +| Mikael Gustavsson | +| Movead Li | +| Muhammad Usama | +| Nagaraj Raj | +| Naoki Nakamichi | +| Nathan Bossart | +| Nathan Long | +| Nazli Ugur Koyluoglu | +| Neha Sharma | +| Neil Chen | +| Nick Cleaton | +| Nico Williams | +| Nikhil Benesch | +| Nikhil Sontakke | +| Nikita Glukhov | +| Nikita Konev | +| Nikolai Berkoff | +| Nikolay Samokhvalov | +| Nikolay Shaplov | +| Nitin Jadhav | +| Noah Misch | +| Noriyoshi Shinoda | +| Odin Ugedal | +| Oleg Bartunov | +| Oleg Samoilov | +| Önder Kalaci | +| Pascal Legrand | +| Paul Förster | +| Paul Guo | +| Paul Jungwirth | +| Paul Martinez | +| Paul Sivash | +| Pavan Deolasee | +| Pavel Boev | +| Pavel Borisov | +| Pavel Luzanov | +| Pavel Stehule | +| Pengcheng Liu | +| Peter Eisentraut | +| Peter Geoghegan | +| Peter Smith | +| Peter Vandivier | +| Petr Fedorov | +| Petr Jelínek | +| Phil Krylov | +| Philipp Gramzow | +| Philippe Beaudoin | +| Phillip Menke | +| Pierre Giraud | +| Prabhat Sahu | +| Quan Zongliang | +| Rafi Shamim | +| Rahila Syed | +| Rajkumar Raghuwanshi | +| Ranier Vilela | +| Regina Obe | +| Rémi Lapeyre | +| Robert Foggia | +| Robert Grange | +| Robert Haas | +| Robert Kahlert | +| Robert Sosinski | +| Robert Treat | +| Robin Abbi | +| Robins Tharakan | +| Roger Mason | +| Rohit Bhogate | +| Roman Zharkov | +| Ron L. Johnson | +| Ronan Dunklau | +| Ryan Lambert | +| Ryo Matsumura | +| Saeed Hubaishan | +| Sait Talha Nisanci | +| Sandro Mani | +| Santosh Udupi | +| Scott Ribe | +| Sehrope Sarkuni | +| Sergei Kornilov | +| Sergey Bernikov | +| Sergey Cherkashin | +| Sergey Koposov | +| Sergey Shinderuk | +| Sergey Zubkovsky | +| Shawn Wang | +| Shay Rojansky | +| Shi Yu | +| Shinya Kato | +| Shinya Okano | +| Sigrid Ehrenreich | +| Simon Norris | +| Simon Riggs | +| Sofoklis Papasofokli | +| Soumyadeep Chakraborty | +| Stas Kelvich | +| Stephan Springl | +| Stéphane Lorek | +| Stephen Frost | +| Steven Winfield | +| Surafel Temesgen | +| Suraj Kharage | +| Sven Klemm | +| Takamichi Osumi | +| Takashi Menjo | +| Takayuki Tsunakawa | +| Tang Haiying | +| Tatsuhito Kasahara | +| Tatsuo Ishii | +| Tatsuro Yamada | +| Theodor Arsenij Larionov-Trichkin | +| Thomas Kellerer | +| Thomas Munro | +| Thomas Trenz | +| Tijs van Dam | +| Tom Ellis | +| Tom Gottfried | +| Tom Lane | +| Tom Vijlbrief | +| Tomas Barton | +| Tomas Vondra | +| Tomohiro Hiramitsu | +| Tony Reix | +| Vaishnavi Prabakaran | +| Valentin Gatien-Baron | +| Victor Wagner | +| Victor Yegorov | +| Vignesh C | +| Vik Fearing | +| Vitaly Ustinov | +| Vladimir Sitnikov | +| Vyacheslav Shablistyy | +| Wang Shenhao | +| Wei Wang | +| Wells Oliver | +| Wenjing Zeng | +| Wolfgang Walther | +| Yang Lin | +| Yanliang Lei | +| Yaoguang Chen | +| Yaroslav Pashinsky | +| Yaroslav Schekin | +| Yasushi Yamashita | +| Yoran Heling | +| YoungHwan Joo | +| Yugo Nagata | +| Yuki Seino | +| Yukun Wang | +| Yulin Pei | +| Yura Sokolov | +| Yuta Katsuragi | +| Yuta Kondo | +| Yuzuko Hosoya | +| Zhihong Yu | +| Zhiyong Wu | +| Zsolt Ero | + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-14-1.html "E.20. Release 14.1") | [Up](release.html "Appendix E. Release Notes") | [Next](release-prior.html "E.22. Prior Releases") | +| E.20. Release 14.1 | [Home](index.html "PostgreSQL 14.20 Documentation") | E.22. Prior Releases | + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/14.1/) diff --git a/corpus/changelog/postgresql_releases/postgresql_141.md b/corpus/changelog/postgresql_releases/postgresql_141.md new file mode 100644 index 0000000000000000000000000000000000000000..7e54e656634b64c23591ec26a4c62958f422b633 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_141.md @@ -0,0 +1,168 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.1/ +Version: 14.1 + +## PostgreSQL 14.1 + +| E.20. Release 14.1 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-14-2.html "E.19. Release 14.2") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-14.html "E.21. Release 14") | + +--- + +## E.20. Release 14.1 + +[E.20.1. Migration to Version 14.1](release-14-1.html#id-1.11.6.25.4) + +[E.20.2. Changes](release-14-1.html#id-1.11.6.25.5) + +**Release date:**2021-11-11 + +This release contains a variety of fixes from 14.0. For information about new features in major release 14, see [Section E.21](release-14.html "E.21. Release 14"). + +### E.20.1. Migration to Version 14.1 + +A dump/restore is not required for those running 14.X. + +However, note that installations using physical replication should update standby servers before the primary server, as explained in the third changelog entry below. + +Also, several bugs have been found that may have resulted in corrupted indexes, as explained in the next several changelog entries. If any of those cases apply to you, it's recommended to reindex possibly-affected indexes after updating. + +### E.20.2. Changes + +* Make the server reject extraneous data after an SSL or GSS encryption handshake (Tom Lane) [§](https://postgr.es/c/9d5a76b8d) + + A man-in-the-middle with the ability to inject data into the TCP connection could stuff some cleartext data into the start of a supposedly encryption-protected database session. This could be abused to send faked SQL commands to the server, although that would only work if the server did not demand any authentication data. (However, a server relying on SSL certificate authentication might well not do so.) + + The PostgreSQL Project thanks Jacob Champion for reporting this problem. (CVE-2021-23214) +* Make libpq reject extraneous data after an SSL or GSS encryption handshake (Tom Lane) [§](https://postgr.es/c/30547d791) + + A man-in-the-middle with the ability to inject data into the TCP connection could stuff some cleartext data into the start of a supposedly encryption-protected database session. This could probably be abused to inject faked responses to the client's first few queries, although other details of libpq's behavior make that harder than it sounds. A different line of attack is to exfiltrate the client's password, or other sensitive data that might be sent early in the session. That has been shown to be possible with a server vulnerable to CVE-2021-23214. + + The PostgreSQL Project thanks Jacob Champion for reporting this problem. (CVE-2021-23222) +* Fix physical replication for cases where the primary crashes after shipping a WAL segment that ends with a partial WAL record (Álvaro Herrera) [§](https://postgr.es/c/64a8687a6) [§](https://postgr.es/c/e3731bac5) [§](https://postgr.es/c/0ce67bce0) [§](https://postgr.es/c/79c7fe1af) [§](https://postgr.es/c/494ec0037) + + If the primary did not survive long enough to finish writing the rest of the incomplete WAL record, then the previous crash-recovery logic had it back up and overwrite WAL starting from the beginning of the incomplete WAL record. This is problematic since standby servers may already have copies of that WAL segment. They will then see an inconsistent next segment, and will not be able to recover without manual intervention. To fix, do not back up over a WAL segment boundary when restarting after a crash. Instead write a new type of WAL record at the start of the next WAL segment, informing readers that the incomplete WAL record will never be finished and must be disregarded. + + When applying this update, it's best to update standby servers before the primary, so that they will be ready to handle this new WAL record type if the primary happens to crash. +* Ensure that parallel `VACUUM` doesn't miss any indexes (Peter Geoghegan, Masahiko Sawada) [§](https://postgr.es/c/61a86ed55) + + A parallel `VACUUM` would fail to process indexes that are below the `min_parallel_index_scan_size` cutoff, if the table also has at least two indexes that are above that size. This could result in those indexes becoming corrupt, since they'd still contain references to any heap entries removed by the `VACUUM`; subsequent queries using such indexes would be likely to return rows they shouldn't. This problem does not affect autovacuum, since it doesn't use parallel vacuuming. However, it is advisable to reindex any manually-vacuumed tables that have the right mix of index sizes. +* Fix `CREATE INDEX CONCURRENTLY` to wait for the latest prepared transactions (Andrey Borodin) [§](https://postgr.es/c/a5b9a0000) + + Rows inserted by just-prepared transactions might be omitted from the new index, causing queries relying on the index to miss such rows. The previous fix for this type of problem failed to account for `PREPARE TRANSACTION` commands that were still in progress when `CREATE INDEX CONCURRENTLY` checked for them. As before, in installations that have enabled prepared transactions (`max_prepared_transactions` > 0), it's recommended to reindex any concurrently-built indexes in case this problem occurred when they were built. +* Avoid race condition that can cause backends to fail to add entries for new rows to an index being built concurrently (Noah Misch, Andrey Borodin) [§](https://postgr.es/c/dde966efb) + + While it's apparently rare in the field, this case could potentially affect any index built or reindexed with the `CONCURRENTLY` option. It is recommended to reindex any such indexes to make sure they are correct. +* Fix `REINDEX CONCURRENTLY` to preserve operator class parameters that were attached to the target index (Michael Paquier) [§](https://postgr.es/c/f255de9a4) +* Fix incorrect creation of shared dependencies when cloning a database that contains non-builtin objects (Aleksander Alekseev) [§](https://postgr.es/c/5040c9641) + + The effects of this error are probably limited in practice. In principle, it could allow a role to be dropped while it still owns objects; but most installations would never want to drop a role that had been used for objects they'd added to `template1`. +* Ensure that the relation cache is invalidated for a table being attached to or detached from a partitioned table (Amit Langote, Álvaro Herrera) [§](https://postgr.es/c/72d064217) + + This oversight could allow misbehavior of subsequent inserts/updates addressed directly to the partition, but only in currently-existing sessions. +* Fix corruption of parse tree while creating a range type (Alex Kozhemyakin, Sergey Shinderuk) [§](https://postgr.es/c/922e15c47) + + `CREATE TYPE` incorrectly freed an element of the parse tree, which could cause problems for a later event trigger, or if the `CREATE TYPE` command was stored in the plan cache and used again later. +* Fix updates of element fields in arrays of domain over composite (Tom Lane) [§](https://postgr.es/c/04dae19f4) + + A command such as `UPDATE tab SET fld[1].subfld = val` failed if the array's elements were domains rather than plain composites. +* Disallow the combination of `FETCH FIRST WITH TIES` and `FOR UPDATE SKIP LOCKED` (David Christensen) [§](https://postgr.es/c/20047609d) + + `FETCH FIRST WITH TIES` necessarily fetches one more row than requested, since it cannot stop until it finds a row that is not a tie. In our current implementation, if `FOR UPDATE` is used then that row will also get locked even though it is not returned. That results in undesirable behavior if the `SKIP LOCKED` option is specified. It's difficult to change this without introducing a different set of undesirable behaviors, so for now, forbid the combination. +* Disallow `ALTER INDEX index ALTER COLUMN col SET (options)` (Nathan Bossart, Michael Paquier) [§](https://postgr.es/c/b1b797ec7) + + While the parser accepted this, it's undocumented and doesn't actually work. +* Fix corner-case loss of precision in numeric `power()` (Dean Rasheed) [§](https://postgr.es/c/8e26b868d) + + The result could be inaccurate when the first argument is very close to 1. +* Avoid choosing the wrong hash equality operator for Memoize plans (David Rowley) [§](https://postgr.es/c/1f194ed6c) + + This error could result in crashes or incorrect query results. +* Fix planner error with pulling up subquery expressions into function rangetable entries (Tom Lane) [§](https://postgr.es/c/fd059ac2e) + + If a function in `FROM` laterally references the output of some sub-`SELECT` earlier in the `FROM` clause, and we are able to flatten that sub-`SELECT` into the outer query, the expression(s) copied into the function expression were not fully processed. This could lead to crashes at execution. +* Avoid using MCV-only statistics to estimate the range of a column (Tom Lane) [§](https://postgr.es/c/a54509bfd) + + There are corner cases in which `ANALYZE` will build a most-common-values (MCV) list but not a histogram, even though the MCV list does not account for all the observed values. In such cases, keep the planner from using the MCV list alone to estimate the range of column values. +* Fix restoration of a Portal's snapshot inside a subtransaction (Bertrand Drouvot) [§](https://postgr.es/c/e6adaa179) + + If a procedure commits or rolls back a transaction, and then its next significant action is inside a new subtransaction, snapshot management went wrong, leading to a dangling pointer and probable crash. A typical example in PL/pgSQL is a `COMMIT` immediately followed by a `BEGIN ... EXCEPTION` block that performs a query. +* Clean up correctly if a transaction fails after exporting its snapshot (Dilip Kumar) [§](https://postgr.es/c/5b353aaff) + + This oversight would only cause a problem if the same session attempted to export a snapshot again. The most likely scenario for that is creation of a replication slot (followed by rollback) and then creation of another replication slot. +* Prevent wraparound of overflowed-subtransaction tracking on standby servers (Kyotaro Horiguchi, Alexander Korotkov) [§](https://postgr.es/c/b0f6bd48f) + + This oversight could cause significant performance degradation (manifesting as excessive SubtransSLRU traffic) on standby servers. +* Ensure that prepared transactions are properly accounted for during promotion of a standby server (Michael Paquier, Andres Freund) [§](https://postgr.es/c/828f7f000) + + There was a narrow window where a prepared transaction could be omitted from a snapshot taken by a concurrently-running session. If that session then used the snapshot to perform data updates, erroneous results or data corruption could occur. +* Fix “could not find RecursiveUnion” error when `EXPLAIN` tries to print a filter condition attached to a WorkTableScan node (Tom Lane) [§](https://postgr.es/c/2c25db32e) +* Ensure that the correct lock level is used when renaming a table (Nathan Bossart, Álvaro Herrera) [§](https://postgr.es/c/3ce3fb2f7) [§](https://postgr.es/c/718278855) + + For historical reasons, `ALTER INDEX ... RENAME` can be applied to any sort of relation. The lock level required to rename an index is lower than that required to rename a table or other kind of relation, but the code got this wrong and would use the weaker lock level whenever the command is spelled `ALTER INDEX`. +* Avoid null-pointer-dereference crash when dropping a role that owns objects being dropped concurrently (Álvaro Herrera) [§](https://postgr.es/c/02e20bb2d) +* Prevent “snapshot reference leak” warning when `lo_export()` or a related function fails (Heikki Linnakangas) [§](https://postgr.es/c/4ebd740cd) [§](https://postgr.es/c/f4e3b6271) +* Fix inefficient code generation for CoerceToDomain expression nodes (Ranier Vilela) [§](https://postgr.es/c/16a56774f) +* Avoid O(N^2) behavior in some list-manipulation operations (Nathan Bossart, Tom Lane) [§](https://postgr.es/c/8424dfced) [§](https://postgr.es/c/ad87bf355) [§](https://postgr.es/c/08cfa5981) + + These changes fix slow processing in several scenarios, including: when a standby replays a transaction that held many exclusive locks on the primary; when many files are due to be unlinked after a checkpoint; when hash aggregation involves many batches; and when `pg_trgm` extracts indexable conditions from a complex regular expression. Only the first of these scenarios has actually been reported from the field, but they all seem like plausible consequences of inefficient list deletions. +* Add more defensive checks around B-tree posting list splits (Peter Geoghegan) [§](https://postgr.es/c/d078fe83d) [§](https://postgr.es/c/6cac34339) + + This change should help detect index corruption involving duplicate table TIDs. +* Avoid assertion failure when inserting NaN into a BRIN float8 or float4 minmax\_multi\_ops index (Tomas Vondra) [§](https://postgr.es/c/f7829feb7) + + In production builds, such cases would result in a somewhat inefficient, but not actually incorrect, index. +* Allow the autovacuum launcher process to respond to `pg_log_backend_memory_contexts()` requests more quickly (Koyu Tanigawa) [§](https://postgr.es/c/62e821ad2) +* Fix memory leak in HMAC hash calculations (Sergey Shinderuk) [§](https://postgr.es/c/a5e83ad79) +* Disallow setting `huge_pages` to `on` when `shared_memory_type` is `sysv` (Thomas Munro) [§](https://postgr.es/c/181361a0c) + + Previously, this setting was accepted, but it did nothing for lack of any implementation. +* Fix checking of query type in PL/pgSQL's `RETURN QUERY` statement (Tom Lane) [§](https://postgr.es/c/e0eba586b) + + `RETURN QUERY` should accept any query that can return tuples, e.g. `UPDATE RETURNING`. v14 accidentally disallowed anything but `SELECT`; moreover, the `RETURN QUERY EXECUTE` variant failed to apply any query-type check at all. +* Fix pg\_dump to dump non-global default privileges correctly (Neil Chen, Masahiko Sawada) [§](https://postgr.es/c/3ad2c2455) + + If a global (unrestricted) `ALTER DEFAULT PRIVILEGES` command revoked some present-by-default privilege, for example `EXECUTE` for functions, and then a restricted `ALTER DEFAULT PRIVILEGES` command granted that privilege again for a selected role or schema, pg\_dump failed to dump the restricted privilege grant correctly. +* Make pg\_dump acquire shared lock on partitioned tables that are to be dumped (Tom Lane) [§](https://postgr.es/c/b5152e3ba) + + This oversight was usually pretty harmless, since once pg\_dump has locked any of the leaf partitions, that would suffice to prevent significant DDL on the partitioned table itself. However problems could ensue when dumping a childless partitioned table, since no relevant lock would be held. +* Fix crash in pg\_dump when attempting to dump trigger definitions from a pre-8.3 server (Tom Lane) [§](https://postgr.es/c/3e4c8db93) +* Fix incorrect filename in pg\_restore's error message about an invalid large object TOC file (Daniel Gustafsson) [§](https://postgr.es/c/3e2f32b01) +* Ensure that pgbench exits with non-zero status after a socket-level failure (Yugo Nagata, Fabien Coelho) [§](https://postgr.es/c/8021334d3) [§](https://postgr.es/c/8231c500e) + + The desired behavior is to finish out the run but then exit with status 2. Also, fix the reporting of such errors. +* Prevent pg\_amcheck from checking temporary relations, as well as indexes that are invalid or not ready (Mark Dilger) [§](https://postgr.es/c/dd58194cf) [§](https://postgr.es/c/5863115e4) + + This avoids unhelpful checks of relations that will almost certainly appear inconsistent. +* Make `contrib/amcheck` skip unlogged tables when running on a standby server (Mark Dilger) [§](https://postgr.es/c/e7712155e) + + It's appropriate to do this since such tables will be empty, and unlogged indexes were already handled similarly. +* Change `contrib/pg_stat_statements` to read its “query texts” file in units of at most 1GB (Tom Lane) [§](https://postgr.es/c/7104e0b24) + + Such large query text files are very unusual, but if they do occur, the previous coding would fail on Windows 64 (which rejects individual read requests of more than 2GB). +* Fix null-pointer crash when `contrib/postgres_fdw` tries to report a data conversion error (Tom Lane) [§](https://postgr.es/c/12ff678e1) +* Ensure that `GetSharedSecurityLabel()` can be used in a newly-started session that has not yet built its critical relation cache entries (Jeff Davis) [§](https://postgr.es/c/0b90f1c4c) +* When running a TAP test, include the module's own directory in `PATH` (Andrew Dunstan) [§](https://postgr.es/c/52c0c1136) + + This allows tests to find built programs that are not installed, such as custom test drivers. +* Use the CLDR project's data to map Windows time zone names to IANA time zones (Tom Lane) [§](https://postgr.es/c/fa8db4879) [§](https://postgr.es/c/81464999b) [§](https://postgr.es/c/919c08d90) + + When running on Windows, initdb attempts to set the new cluster's `timezone` parameter to the IANA time zone matching the system's prevailing time zone. We were using a mapping table that we'd generated years ago and updated only fitfully; unsurprisingly, it contained a number of errors as well as omissions of recently-added zones. It turns out that CLDR has been tracking the most appropriate mappings, so start using their data. This change will not affect any existing installation, only newly-initialized clusters. +* Update time zone data files to tzdata release 2021e for DST law changes in Fiji, Jordan, Palestine, and Samoa, plus historical corrections for Barbados, Cook Islands, Guyana, Niue, Portugal, and Tonga. (Tom Lane) [§](https://postgr.es/c/0c8a40b39) + + Also, the Pacific/Enderbury zone has been renamed to Pacific/Kanton. Also, the following zones have been merged into nearby, more-populous zones whose clocks have agreed with them since 1970: Africa/Accra, America/Atikokan, America/Blanc-Sablon, America/Creston, America/Curacao, America/Nassau, America/Port\_of\_Spain, Antarctica/DumontDUrville, and Antarctica/Syowa. In all these cases, the previous zone name remains as an alias. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-14-2.html "E.19. Release 14.2") | [Up](release.html "Appendix E. Release Notes") | [Next](release-14.html "E.21. Release 14") | +| E.19. Release 14.2 | [Home](index.html "PostgreSQL 14.20 Documentation") | E.21. Release 14 | + +[Previous](/docs/release/14.0/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/14.2/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1410.md b/corpus/changelog/postgresql_releases/postgresql_1410.md new file mode 100644 index 0000000000000000000000000000000000000000..ff58e1710d23379c68a7b89dda0fdd6c568daf34 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1410.md @@ -0,0 +1,192 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.10/ +Version: 14.10 + +## PostgreSQL 14.10 + +| E.11. Release 14.10 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-14-11.html "E.10. Release 14.11") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-14-9.html "E.12. Release 14.9") | + +--- + +## E.11. Release 14.10 + +[E.11.1. Migration to Version 14.10](release-14-10.html#id-1.11.6.16.4) + +[E.11.2. Changes](release-14-10.html#id-1.11.6.16.5) + +**Release date:**2023-11-09 + +This release contains a variety of fixes from 14.9. For information about new features in major release 14, see [Section E.21](release-14.html "E.21. Release 14"). + +### E.11.1. Migration to Version 14.10 + +A dump/restore is not required for those running 14.X. + +However, several mistakes have been discovered that could lead to certain types of indexes yielding wrong search results or being unnecessarily inefficient. It is advisable to `REINDEX` potentially-affected indexes after installing this update. See the fourth through seventh changelog entries below. + +Also, if you are upgrading from a version earlier than 14.9, see [Section E.12](release-14-9.html "E.12. Release 14.9"). + +### E.11.2. Changes + +* Fix handling of unknown-type arguments in `DISTINCT` `"any"` aggregate functions (Tom Lane) [§](https://postgr.es/c/9146d0d65) + + This error led to a `text`-type value being interpreted as an `unknown`-type value (that is, a zero-terminated string) at runtime. This could result in disclosure of server memory following the `text` value. + + The PostgreSQL Project thanks Jingzhou Fu for reporting this problem. (CVE-2023-5868) +* Detect integer overflow while computing new array dimensions (Tom Lane) [§](https://postgr.es/c/edc0a8d82) + + When assigning new elements to array subscripts that are outside the current array bounds, an undetected integer overflow could occur in edge cases. Memory stomps that are potentially exploitable for arbitrary code execution are possible, and so is disclosure of server memory. + + The PostgreSQL Project thanks Pedro Gallegos for reporting this problem. (CVE-2023-5869) +* Prevent the `pg_signal_backend` role from signalling background workers and autovacuum processes (Noah Misch, Jelte Fennema-Nio) [§](https://postgr.es/c/508acb901) [§](https://postgr.es/c/ecd5d240c) + + The documentation says that `pg_signal_backend` cannot issue signals to superuser-owned processes. It was able to signal these background processes, though, because they advertise a role OID of zero. Treat that as indicating superuser ownership. The security implications of cancelling one of these process types are fairly small so far as the core code goes (we'll just start another one), but extensions might add background workers that are more vulnerable. + + Also ensure that the `is_superuser` parameter is set correctly in such processes. No specific security consequences are known for that oversight, but it might be significant for some extensions. + + The PostgreSQL Project thanks Hemanth Sandrana and Mahendrakar Srinivasarao for reporting this problem. (CVE-2023-5870) +* Fix misbehavior during recursive page split in GiST index build (Heikki Linnakangas) [§](https://postgr.es/c/747cef5a5) + + Fix a case where the location of a page downlink was incorrectly tracked, and introduce some logic to allow recovering from such situations rather than silently doing the wrong thing. This error could result in incorrect answers from subsequent index searches. It may be advisable to reindex all GiST indexes after installing this update. +* Prevent de-duplication of btree index entries for `interval` columns (Noah Misch) [§](https://postgr.es/c/0834df909) + + There are `interval` values that are distinguishable but compare equal, for example `24:00:00` and `1 day`. This breaks assumptions made by btree de-duplication, so `interval` columns need to be excluded from de-duplication. This oversight can cause incorrect results from index-only scans. Moreover, after updating amcheck will report an error for almost all such indexes. Users should reindex any btree indexes on `interval` columns. +* Process `date` values more sanely in BRIN `datetime_minmax_multi_ops` indexes (Tomas Vondra) [§](https://postgr.es/c/d1740e169) + + The distance calculation for dates was backward, causing poor decisions about which entries to merge. The index still produces correct results, but is much less efficient than it should be. Reindexing BRIN `minmax_multi` indexes on `date` columns is advisable. +* Process large `timestamp` and `timestamptz` values more sanely in BRIN `datetime_minmax_multi_ops` indexes (Tomas Vondra) [§](https://postgr.es/c/52c934cc1) [§](https://postgr.es/c/90c4da6d4) + + Infinities were mistakenly treated as having distance zero rather than a large distance from other values, causing poor decisions about which entries to merge. Also, finite-but-very-large values (near the endpoints of the representable timestamp range) could result in internal overflows, again causing poor decisions. The index still produces correct results, but is much less efficient than it should be. Reindexing BRIN `minmax_multi` indexes on `timestamp` and `timestamptz` columns is advisable if the column contains, or has contained, infinities or large finite values. +* Avoid calculation overflows in BRIN `interval_minmax_multi_ops` indexes with extreme interval values (Tomas Vondra) [§](https://postgr.es/c/0fa73c5cd) + + This bug might have caused unexpected failures while trying to insert large interval values into such an index. +* Fix partition step generation and runtime partition pruning for hash-partitioned tables with multiple partition keys (David Rowley) [§](https://postgr.es/c/d26f33c32) [§](https://postgr.es/c/cd15bff48) + + Some cases involving an `IS NULL` condition on one of the partition keys could result in a crash. +* Correctly identify the target table in an inherited `UPDATE`/`DELETE`/`MERGE` even when the parent table is excluded by constraints (Amit Langote, Tom Lane) [§](https://postgr.es/c/8f4a6b9e4) + + If the initially-named table is excluded by constraints, but not all its inheritance descendants are, the first non-excluded descendant was identified as the primary target table. This would lead to firing statement-level triggers associated with that table, rather than the initially-named table as should happen. In v16, the same oversight could also lead to “invalid perminfoindex 0 in RTE with relid NNNN” errors. +* Fix edge case in btree mark/restore processing of ScalarArrayOpExpr clauses (Peter Geoghegan) [§](https://postgr.es/c/41486c4aa) + + When restoring an indexscan to a previously marked position, the code could miss required setup steps if the scan had advanced exactly to the end of the matches for a ScalarArrayOpExpr (that is, an `indexcol = ANY(ARRAY[])`) clause. This could result in missing some rows that should have been fetched. +* Fix intra-query memory leak in Memoize execution (Orlov Aleksej, David Rowley) [§](https://postgr.es/c/e4b95b9b0) +* Fix intra-query memory leak when a set-returning function repeatedly returns zero rows (Tom Lane) [§](https://postgr.es/c/5d7515d7d) +* Don't crash if `cursor_to_xmlschema()` is applied to a non-data-returning Portal (Boyu Yang) [§](https://postgr.es/c/9baabfa38) +* Throw the intended error if `pgrowlocks()` is applied to a partitioned table (David Rowley) [§](https://postgr.es/c/c5988e69f) + + Previously, a not-on-point complaint “only heap AM is supported” would be raised. +* Handle invalid indexes more cleanly in assorted SQL functions (Noah Misch) [§](https://postgr.es/c/0a7b183fd) + + Report an error if `pgstatindex()`, `pgstatginindex()`, `pgstathashindex()`, or `pgstattuple()` is applied to an invalid index. If `brin_desummarize_range()`, `brin_summarize_new_values()`, `brin_summarize_range()`, or `gin_clean_pending_list()` is applied to an invalid index, do nothing except to report a debug-level message. Formerly these functions attempted to process the index, and might fail in strange ways depending on what the failed `CREATE INDEX` had left behind. +* Avoid premature memory allocation failure with long inputs to `to_tsvector()` (Tom Lane) [§](https://postgr.es/c/a2799f53d) +* Fix over-allocation of the constructed `tsvector` in `tsvectorrecv()` (Denis Erokhin) [§](https://postgr.es/c/cf12c4fd2) + + If the incoming vector includes position data, the binary receive function left wasted space (roughly equal to the size of the position data) in the finished `tsvector`. In extreme cases this could lead to “maximum total lexeme length exceeded” failures for vectors that were under the length limit when emitted. In any case it could lead to wasted space on-disk. +* Fix incorrect coding in `gtsvector_picksplit()` (Alexander Lakhin) [§](https://postgr.es/c/df11421d8) + + This could lead to poor page-split decisions in GiST indexes on `tsvector` columns. +* Improve checks for corrupt PGLZ compressed data (Flavien Guedez) [§](https://postgr.es/c/2c63dc035) +* Fix `COMMIT AND CHAIN`/`ROLLBACK AND CHAIN` to work properly when there is an unreleased savepoint (Liu Xiang, Tom Lane) [§](https://postgr.es/c/10323f140) + + Instead of propagating the current transaction's properties to the new transaction, they propagated some previous transaction's properties. +* In `COPY FROM`, fail cleanly when an unsupported encoding conversion is needed (Tom Lane) [§](https://postgr.es/c/a715c0212) + + Recent refactoring accidentally removed the intended error check for this, such that it ended in “cache lookup failed for function 0” instead of a useful error message. +* Avoid crash in `EXPLAIN` if a parameter marked to be displayed by `EXPLAIN` has a NULL boot-time value (Xing Guo, Aleksander Alekseev, Tom Lane) [§](https://postgr.es/c/47c0f00cf) + + No built-in parameter fits this description, but an extension could define such a parameter. +* Ensure we have a snapshot while dropping `ON COMMIT DROP` temp tables (Tom Lane) [§](https://postgr.es/c/f6e1ee3cf) + + This prevents possible misbehavior if any catalog entries for the temp tables have fields wide enough to require toasting (such as a very complex `CHECK` condition). +* Avoid improper response to shutdown signals in child processes just forked by `system()` (Nathan Bossart) [§](https://postgr.es/c/54fc9dca5) [§](https://postgr.es/c/555bc89c9) + + This fix avoids a race condition in which a child process that has been forked off by `system()`, but hasn't yet exec'd the intended child program, might receive and act on a signal intended for the parent server process. That would lead to duplicate cleanup actions being performed, which will not end well. +* Cope with torn reads of `pg_control` in frontend programs (Thomas Munro) [§](https://postgr.es/c/dc75748a9) + + On some file systems, reading `pg_control` may not be an atomic action when the server concurrently writes that file. This is detectable via a bad CRC. Retry a few times to see if the file becomes valid before we report error. +* Avoid torn reads of `pg_control` in relevant SQL functions (Thomas Munro) [§](https://postgr.es/c/a56fe5cf0) + + Acquire the appropriate lock before reading `pg_control`, to ensure we get a consistent view of that file. +* Avoid integer overflow when computing size of backend activity string array (Jakub Wartak) [§](https://postgr.es/c/f91c87b31) + + On 64-bit machines we will allow values of `track_activity_query_size` large enough to cause 32-bit overflow when multiplied by the allowed number of connections. The code actually allocating the per-backend local array was careless about this though, and allocated the array incorrectly. +* Fix briefly showing inconsistent progress statistics for `ANALYZE` on inherited tables (Heikki Linnakangas) [§](https://postgr.es/c/2d4f99bc6) + + The block-level counters should be reset to zero at the same time we update the current-relation field. +* Fix the background writer to report any WAL writes it makes to the statistics counters (Nazir Bilal Yavuz) [§](https://postgr.es/c/594001864) +* Track the dependencies of cached `CALL` statements, and re-plan them when needed (Tom Lane) [§](https://postgr.es/c/5cff431bc) + + DDL commands, such as replacement of a function that has been inlined into a `CALL` argument, can create the need to re-plan a `CALL` that has been cached by PL/pgSQL. That was not happening, leading to misbehavior or strange errors such as “cache lookup failed”. +* Track nesting depth correctly when inspecting `RECORD`-type Vars from outer query levels (Richard Guo) [§](https://postgr.es/c/ae13f8166) + + This oversight could lead to assertion failures, core dumps, or “bogus varno” errors. +* Track hash function and negator function dependencies of ScalarArrayOpExpr plan nodes (David Rowley) [§](https://postgr.es/c/6341cb0b0) + + In most cases this oversight was harmless, since these functions would be unlikely to disappear while the node's original operator remains present. +* Fix error-handling bug in `RECORD` type cache management (Thomas Munro) [§](https://postgr.es/c/e2452c2a6) + + An out-of-memory error occurring at just the wrong point could leave behind inconsistent state that would lead to an infinite loop. +* Fix assertion failure when logical decoding is retried in the same session after an error (Hou Zhijie) [§](https://postgr.es/c/f7d25117b) +* Treat out-of-memory failures as fatal while reading WAL (Michael Paquier) [§](https://postgr.es/c/baeb8542c) + + Previously this would be treated as a bogus-data condition, leading to the conclusion that we'd reached the end of WAL, which is incorrect and could lead to inconsistent WAL replay. +* Fix possible recovery failure due to trying to allocate memory based on a bogus WAL record length field (Thomas Munro, Michael Paquier) [§](https://postgr.es/c/3ce3b53d7) [§](https://postgr.es/c/3d413c5a7) +* Ensure that standby-mode WAL recovery reports an error when an invalid page header is found (Yugo Nagata, Kyotaro Horiguchi) [§](https://postgr.es/c/2f13e8d9e) +* Fix datatype size confusion in logical tape management (Ranier Vilela) [§](https://postgr.es/c/d2bd4ba30) + + Integer overflow was possible on platforms where long is wider than int, although it would take a multiple-terabyte temporary file to cause a problem. +* Avoid unintended close of syslogger process's stdin (Heikki Linnakangas) [§](https://postgr.es/c/3d895f95a) +* Avoid doing plan cache revalidation of utility statements that do not receive interesting processing during parse analysis (Tom Lane) [§](https://postgr.es/c/9b2a41db1) + + Aside from saving a few cycles, this prevents failure after a cache invalidation for statements that must not set a snapshot, such as `SET TRANSACTION ISOLATION LEVEL`. +* Keep by-reference `attmissingval` values in a long-lived context while they are being used (Andrew Dunstan) [§](https://postgr.es/c/7f4515a58) + + This avoids possible use of dangling pointers when a tuple slot outlives the tuple descriptor with which its value was constructed. +* Recalculate the effective value of `search_path` after `ALTER ROLE` (Jeff Davis) [§](https://postgr.es/c/00953f1e2) [§](https://postgr.es/c/5a32af3f2) + + This ensures that after renaming a role, the meaning of the special string `$user` is re-determined. +* Fix “could not duplicate handle” error occurring on Windows when `min_dynamic_shared_memory` is set above zero (Thomas Munro) [§](https://postgr.es/c/fb9a16a1a) +* Fix order of operations in `GenericXLogFinish` (Jeff Davis) [§](https://postgr.es/c/6615bb95a) + + This code violated the conditions required for crash safety by writing WAL before marking changed buffers dirty. No core code uses this function, but extensions do (`contrib/bloom` does, for example). +* Remove incorrect assertion in PL/Python exception handling (Alexander Lakhin) [§](https://postgr.es/c/bb65f3c1b) +* Fix pg\_restore so that selective restores will include both table-level and column-level ACLs for selected tables (Euler Taveira, Tom Lane) [§](https://postgr.es/c/829d91cc6) + + Formerly, only the table-level ACL would get restored if both types were present. +* Add logic to pg\_upgrade to check for use of `abstime`, `reltime`, and `tinterval` data types (Álvaro Herrera) [§](https://postgr.es/c/26c291a15) [§](https://postgr.es/c/f9280e77e) + + These obsolete data types were removed in PostgreSQL version 12, so check to make sure they aren't present in an older database before claiming it can be upgraded. +* Avoid generating invalid temporary slot names in pg\_basebackup (Jelte Fennema) [§](https://postgr.es/c/9de74ca70) + + This has only been seen to occur when the server connection runs through pgbouncer. +* Avoid false “too many client connections” errors in pgbench on Windows (Noah Misch) [§](https://postgr.es/c/0df88a686) +* In `contrib/amcheck`, do not report interrupted page deletion as corruption (Noah Misch) [§](https://postgr.es/c/42496cba6) + + This fix prevents false-positive reports of “the first child of leftmost target page is not leftmost of its level”, “block NNNN is not leftmost” or “left link/right link pair in index XXXX not in agreement”. They appeared if amcheck ran after an unfinished btree index page deletion and before `VACUUM` had cleaned things up. +* Fix failure of `contrib/btree_gin` indexes on `interval` columns, when an indexscan using the `<` or `<=` operator is performed (Dean Rasheed) [§](https://postgr.es/c/162b38a06) + + Such an indexscan failed to return all the entries it should. +* Add support for LLVM 16 and 17 (Thomas Munro, Dmitry Dolgov) [§](https://postgr.es/c/0a8b7d5c1) [§](https://postgr.es/c/82d9a782a) [§](https://postgr.es/c/ee3e4c41f) +* Suppress assorted build-time warnings on recent macOS (Tom Lane) [§](https://postgr.es/c/e9d1560d3) [§](https://postgr.es/c/5d60e8ed3) + + Xcode 15 (released with macOS Sonoma) changed the linker's behavior in a way that causes many duplicate-library warnings while building PostgreSQL. These were harmless, but they're annoying so avoid citing the same libraries twice. Also remove use of the `-multiply_defined suppress` linker switch, which apparently has been a no-op for a long time, and is now actively complained of. +* When building `contrib/unaccent`'s rules file, fall back to using `python` if `--with-python` was not given and make variable `PYTHON` was not set (Japin Li) [§](https://postgr.es/c/e4d7ad30f) +* Remove `PHOT` (Phoenix Islands Time) from the default timezone abbreviations list (Tom Lane) [§](https://postgr.es/c/877e7b4b9) + + Presence of this abbreviation in the default list can cause failures on recent Debian and Ubuntu releases, as they no longer install the underlying tzdb entry by default. Since this is a made-up abbreviation for a zone with a total human population of about two dozen, it seems unlikely that anyone will miss it. If someone does, they can put it back via a custom abbreviations file. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-14-11.html "E.10. Release 14.11") | [Up](release.html "Appendix E. Release Notes") | [Next](release-14-9.html "E.12. Release 14.9") | +| E.10. Release 14.11 | [Home](index.html "PostgreSQL 14.20 Documentation") | E.12. Release 14.9 | + +[Previous](/docs/release/14.9/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/14.11/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1411.md b/corpus/changelog/postgresql_releases/postgresql_1411.md new file mode 100644 index 0000000000000000000000000000000000000000..600fe9e91534857ba9fcdd424e3ea294d95317d7 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1411.md @@ -0,0 +1,173 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.11/ +Version: 14.11 + +## PostgreSQL 14.11 + +| E.10. Release 14.11 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-14-12.html "E.9. Release 14.12") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-14-10.html "E.11. Release 14.10") | + +--- + +## E.10. Release 14.11 + +[E.10.1. Migration to Version 14.11](release-14-11.html#id-1.11.6.15.4) + +[E.10.2. Changes](release-14-11.html#id-1.11.6.15.5) + +**Release date:**2024-02-08 + +This release contains a variety of fixes from 14.10. For information about new features in major release 14, see [Section E.21](release-14.html "E.21. Release 14"). + +### E.10.1. Migration to Version 14.11 + +A dump/restore is not required for those running 14.X. + +However, one bug was fixed that could have resulted in corruption of GIN indexes during concurrent updates. If you suspect such corruption, reindex affected indexes after installing this update. + +Also, if you are upgrading from a version earlier than 14.10, see [Section E.11](release-14-10.html "E.11. Release 14.10"). + +### E.10.2. Changes + +* Tighten security restrictions within `REFRESH MATERIALIZED VIEW CONCURRENTLY` (Heikki Linnakangas) [§](https://postgr.es/c/f4f288352) [§](https://postgr.es/c/a45c950ae) + + One step of a concurrent refresh command was run under weak security restrictions. If a materialized view's owner could persuade a superuser or other high-privileged user to perform a concurrent refresh on that view, the view's owner could control code executed with the privileges of the user running `REFRESH`. Fix things so that all user-determined code is run as the view's owner, as expected. + + The only known exploit for this error does not work in PostgreSQL 16.0 and later, so it may be that v16 is not vulnerable in practice. + + The PostgreSQL Project thanks Pedro Gallegos for reporting this problem. (CVE-2024-0985) +* Fix memory leak when performing JIT inlining (Andres Freund, Daniel Gustafsson) [§](https://postgr.es/c/75a20a4b4) + + There have been multiple reports of backend processes suffering out-of-memory conditions after sufficiently many JIT compilations. This fix should resolve that. +* When dequeueing from an LWLock, avoid needing to search the list of waiting processes (Andres Freund) [§](https://postgr.es/c/5f6ec27a6) + + This fixes O(N^2) behavior when the list of waiters is long. In some use-cases this results in substantial throughput improvements. +* Avoid generating incorrect partitioned-join plans (Richard Guo) [§](https://postgr.es/c/e031995d5) + + Some uncommon situations involving lateral references could create incorrect plans. Affected queries could produce wrong answers, or odd failures such as “variable not found in subplan target list”, or executor crashes. +* Fix incorrect wrapping of subquery output expressions in PlaceHolderVars (Tom Lane) [§](https://postgr.es/c/ea1d54288) + + This fixes incorrect results when a subquery is underneath an outer join and has an output column that laterally references something outside the outer join's scope. The output column might not appear as NULL when it should do so due to the action of the outer join. +* Prevent access to a no-longer-pinned buffer in `BEFORE ROW UPDATE` triggers (Alexander Lakhin, Tom Lane) [§](https://postgr.es/c/c7edaeec5) + + If the tuple being updated had just been updated and moved to another page by another session, there was a narrow window where we would attempt to fetch data from the new tuple version without any pin on its buffer. In principle this could result in garbage data appearing in non-updated columns of the proposed new tuple. The odds of problems in practice seem rather low, however. +* Avoid requesting an oversize shared-memory area in parallel hash join (Thomas Munro, Andrei Lepikhov, Alexander Korotkov) [§](https://postgr.es/c/3bdaa8fc6) [§](https://postgr.es/c/97e64911d) + + The limiting value was too large, allowing “invalid DSA memory alloc request size” errors to occur with sufficiently large expected hash table sizes. +* Avoid assertion failures in `heap_update()` and `heap_delete()` when a tuple to be updated by a foreign-key enforcement trigger fails the extra visibility crosscheck (Alexander Lakhin) [§](https://postgr.es/c/59c62a21f) + + This error had no impact in non-assert builds. +* Fix overly tight assertion about `false_positive_rate` parameter of BRIN bloom operator classes (Alexander Lakhin) [§](https://postgr.es/c/59fc39c0d) + + This error had no impact in non-assert builds, either. +* Fix possible failure during `ALTER TABLE ADD COLUMN` on a complex inheritance tree (Tender Wang) [§](https://postgr.es/c/5a7833f49) + + If a grandchild table would inherit the new column via multiple intermediate parents, the command failed with “tuple already updated by self”. +* Fix problems with duplicate token names in `ALTER TEXT SEARCH CONFIGURATION ... MAPPING` commands (Tender Wang, Michael Paquier) [§](https://postgr.es/c/dde5b01c3) +* Properly lock the associated table during `DROP STATISTICS` (Tomas Vondra) [§](https://postgr.es/c/9dd50e92e) + + Failure to acquire the lock could result in “tuple concurrently deleted” errors if the `DROP` executes concurrently with `ANALYZE`. +* Fix function volatility checking for `GENERATED` and `DEFAULT` expressions (Tom Lane) [§](https://postgr.es/c/9bd0f74ea) + + These places could fail to detect insertion of a volatile function default-argument expression, or decide that a polymorphic function is volatile although it is actually immutable on the datatype of interest. This could lead to improperly rejecting or accepting a `GENERATED` clause, or to mistakenly applying the constant-default-value optimization in `ALTER TABLE ADD COLUMN`. +* Detect that a new catalog cache entry became stale while detoasting its fields (Tom Lane) [§](https://postgr.es/c/db122d426) [§](https://postgr.es/c/7ceeb57ba) + + We expand any out-of-line fields in a catalog tuple before inserting it into the catalog caches. That involves database access which might cause invalidation of catalog cache entries — but the new entry isn't in the cache yet, so we would miss noticing that it should get invalidated. The result is a race condition in which an already-stale cache entry could get made, and then persist indefinitely. This would lead to hard-to-predict misbehavior. Fix by rechecking the tuple's visibility after detoasting. +* Fix edge-case integer overflow detection bug on some platforms (Dean Rasheed) [§](https://postgr.es/c/dea12b40d) + + Computing `0 - INT64_MIN` should result in an overflow error, and did on most platforms. However, platforms with neither integer overflow builtins nor 128-bit integers would fail to spot the overflow, instead returning `INT64_MIN`. +* Detect Julian-date overflow when adding or subtracting an `interval` to/from a `timestamp` (Tom Lane) [§](https://postgr.es/c/3eb8a87f6) + + Some cases that should cause an out-of-range error produced an incorrect result instead. +* Add more checks for overflow in `interval_mul()` and `interval_div()` (Dean Rasheed) [§](https://postgr.es/c/2ffcebdba) + + Some cases that should cause an out-of-range error produced an incorrect result instead. +* Make the `pg_file_settings` view check validity of unapplied values for settings with `backend` or `superuser-backend` context (Tom Lane) [§](https://postgr.es/c/bf4f30a0f) + + Invalid values were not noted in the view as intended. This escaped detection because there are very few settings in these groups. +* Match collation too when matching an existing index to a new partitioned index (Peter Eisentraut) [§](https://postgr.es/c/e846fc491) + + Previously we could accept an index that has a different collation from the corresponding element of the partition key, possibly leading to misbehavior. +* Avoid failure if a child index is dropped concurrently with `REINDEX INDEX` on a partitioned index (Fei Changhong) [§](https://postgr.es/c/b6f2e019d) [§](https://postgr.es/c/b685b41cf) +* Fix insufficient locking when cleaning up an incomplete split of a GIN index's internal page (Fei Changhong, Heikki Linnakangas) [§](https://postgr.es/c/f120c0872) + + The code tried to do this with shared rather than exclusive lock on the buffer. This could lead to index corruption if two processes attempted the cleanup concurrently. +* Avoid premature release of buffer pin in GIN index insertion (Tom Lane) [§](https://postgr.es/c/d900e74e0) + + If an index root page split occurs concurrently with our own insertion, the code could fail with “buffer NNNN is not owned by resource owner”. +* Avoid failure with partitioned SP-GiST indexes (Tom Lane) [§](https://postgr.es/c/375f441bd) + + Trying to use an index of this kind could lead to “No such file or directory” errors. +* Fix ownership change reporting for large objects (Tom Lane) [§](https://postgr.es/c/f552f2be2) + + A no-op `ALTER LARGE OBJECT OWNER` command (that is, one selecting the existing owner) passed the wrong class ID to the `PostAlterHook`, probably confusing any extension using that hook. +* Prevent standby servers from incorrectly processing dead index tuples during subtransactions (Fei Changhong) [§](https://postgr.es/c/0cfd3ddfe) + + The `startedInRecovery` flag was not correctly set for a subtransaction. This affects only processing of dead index tuples. It could allow a query in a subtransaction to ignore index entries that it should return (if they are already dead on the primary server, but not dead to the standby transaction), or to prematurely mark index entries as dead that are not yet dead on the primary. It is not clear that the latter case has any serious consequences, but it's not the intended behavior. +* Fix deadlock between a logical replication apply worker, its tablesync worker, and a session process trying to alter the subscription (Shlok Kyal) [§](https://postgr.es/c/3f86867d5) + + One edge of the deadlock loop did not involve a lock wait, so the deadlock went undetected and would persist until manual intervention. +* Prevent examining system catalogs with the wrong snapshot during logical decoding (Fei Changhong) [§](https://postgr.es/c/6b77048e5) + + If decoding begins partway through a transaction that modifies system catalogs, the decoder may not recognize that, causing it to fail to treat that transaction as in-progress for catalog lookups. This fix deals with the case that a top-level transaction is already marked as containing catalog changes, but its subtransaction(s) are not. +* Return the correct status code when a new client disconnects without responding to the server's password challenge (Liu Lang, Tom Lane) [§](https://postgr.es/c/9b042e27e) + + In some cases we'd treat this as a loggable error, which was not the intention and tends to create log spam, since common clients like psql frequently do this. It may also confuse extensions that use `ClientAuthentication_hook`. +* Fix incompatibility with OpenSSL 3.2 (Tristan Partin, Bo Andreson) [§](https://postgr.es/c/b2b1f1288) + + Use the BIO “app\_data” field for our private storage, instead of assuming it's okay to use the “data” field. This mistake didn't cause problems before, but with 3.2 it leads to crashes and complaints about double frees. +* Be more wary about OpenSSL not setting `errno` on error (Tom Lane) [§](https://postgr.es/c/07ce24326) + + If `errno` isn't set, assume the cause of the reported failure is read EOF. This fixes rare cases of strange error reports like “could not accept SSL connection: Success”. +* Fix file descriptor leakage when a foreign data wrapper's `ForeignAsyncRequest` function fails (Heikki Linnakangas) [§](https://postgr.es/c/555276f85) +* Report ENOMEM errors from file-related system calls as `ERRCODE_OUT_OF_MEMORY`, not `ERRCODE_INTERNAL_ERROR` (Alexander Kuzmenkov) [§](https://postgr.es/c/329b96882) +* In PL/pgSQL, support SQL commands that are `CREATE FUNCTION`/`CREATE PROCEDURE` with SQL-standard bodies (Tom Lane) [§](https://postgr.es/c/b7e8f27d1) + + Previously, such cases failed with parsing errors due to the semicolon(s) appearing in the function body. +* Fix libpq's handling of errors in pipelines (Álvaro Herrera) [§](https://postgr.es/c/f89681816) [§](https://postgr.es/c/7a7c8c98a) + + The pipeline state could get out of sync if an error is returned for reasons other than a query problem (for example, if the connection is lost). Potentially this would lead to a busy-loop in the calling application. +* Make libpq's `PQsendFlushRequest()` function flush the client output buffer under the same rules as other `PQsend` functions (Jelte Fennema-Nio) [§](https://postgr.es/c/99fa98766) + + In pipeline mode, it may still be necessary to call `PQflush()` as well; but this change removes some inconsistency. +* Avoid race condition when libpq initializes OpenSSL support concurrently in two different threads (Willi Mann, Michael Paquier) [§](https://postgr.es/c/c3b79223f) +* Fix timing-dependent failure in GSSAPI data transmission (Tom Lane) [§](https://postgr.es/c/8f23e6a45) + + When using GSSAPI encryption in non-blocking mode, libpq sometimes failed with “GSSAPI caller failed to retransmit all data needing to be retried”. +* In pg\_dump, don't dump RLS policies or security labels for extension member objects (Tom Lane, Jacob Champion) [§](https://postgr.es/c/15439205d) [§](https://postgr.es/c/c532be99d) + + Previously, commands would be included in the dump to set these properties, which is really incorrect since they should be considered as internal affairs of the extension. Moreover, the restoring user might not have adequate privilege to set them, and indeed the dumping user might not have enough privilege to dump them (since dumping RLS policies requires acquiring lock on their table). +* In pg\_dump, don't dump an extended statistics object if its underlying table isn't being dumped (Rian McGuire, Tom Lane) [§](https://postgr.es/c/aa2e323ee) + + This conforms to the behavior for other dependent objects such as indexes. +* Make it an error for a pgbench script to end with an open pipeline (Anthonin Bonnefoy) [§](https://postgr.es/c/85ecff891) + + Previously, pgbench would behave oddly if a `\startpipeline` command lacked a matching `\endpipeline`. This seems like a scripting mistake rather than a case that pgbench needs to handle nicely, so throw an error. +* Fix crash in `contrib/intarray` if an array with an element equal to `INT_MAX` is inserted into a `gist__int_ops` index (Alexander Lakhin, Tom Lane) [§](https://postgr.es/c/90e8b86fc) +* Report a better error when `contrib/pageinspect`'s `hash_bitmap_info()` function is applied to a partitioned hash index (Alexander Lakhin, Michael Paquier) [§](https://postgr.es/c/bfbe4a146) +* Report a better error when `contrib/pgstattuple`'s `pgstathashindex()` function is applied to a partitioned hash index (Alexander Lakhin) [§](https://postgr.es/c/f729fdab4) +* On Windows, suppress autorun options when launching subprocesses in pg\_ctl and pg\_regress (Kyotaro Horiguchi) [§](https://postgr.es/c/4c6944223) [§](https://postgr.es/c/4a7475e9a) + + When launching a child process via `cmd.exe`, pass the `/D` flag to prevent executing any autorun commands specified in the registry. This avoids possibly-surprising side effects. +* Fix compilation failures with libxml2 version 2.12.0 and later (Tom Lane) [§](https://postgr.es/c/29e25a6b1) +* Fix compilation failure of `WAL_DEBUG` code on Windows (Bharath Rupireddy) [§](https://postgr.es/c/c49b6cab1) +* Suppress compiler warnings from Python's header files (Peter Eisentraut, Tom Lane) [§](https://postgr.es/c/7978eee02) + + Our preferred compiler options provoke warnings about constructs appearing in recent versions of Python's header files. When using gcc, we can suppress these warnings with a pragma. +* Avoid deprecation warning when compiling with LLVM 18 (Thomas Munro) [§](https://postgr.es/c/364283c92) +* Update time zone data files to tzdata release 2024a for DST law changes in Greenland, Kazakhstan, and Palestine, plus corrections for the Antarctic stations Casey and Vostok. Also historical corrections for Vietnam, Toronto, and Miquelon. (Tom Lane) [§](https://postgr.es/c/35b8b2c4a) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-14-12.html "E.9. Release 14.12") | [Up](release.html "Appendix E. Release Notes") | [Next](release-14-10.html "E.11. Release 14.10") | +| E.9. Release 14.12 | [Home](index.html "PostgreSQL 14.20 Documentation") | E.11. Release 14.10 | + +[Previous](/docs/release/14.10/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/14.12/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1412.md b/corpus/changelog/postgresql_releases/postgresql_1412.md new file mode 100644 index 0000000000000000000000000000000000000000..d268df1c5fbf17b8d2eab6965e56b0338c446218 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1412.md @@ -0,0 +1,170 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.12/ +Version: 14.12 + +## PostgreSQL 14.12 + +| E.9. Release 14.12 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-14-13.html "E.8. Release 14.13") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-14-11.html "E.10. Release 14.11") | + +--- + +## E.9. Release 14.12 + +[E.9.1. Migration to Version 14.12](release-14-12.html#id-1.11.6.14.4) + +[E.9.2. Changes](release-14-12.html#id-1.11.6.14.5) + +**Release date:**2024-05-09 + +This release contains a variety of fixes from 14.11. For information about new features in major release 14, see [Section E.21](release-14.html "E.21. Release 14"). + +### E.9.1. Migration to Version 14.12 + +A dump/restore is not required for those running 14.X. + +However, a security vulnerability was found in the system views `pg_stats_ext` and `pg_stats_ext_exprs`, potentially allowing authenticated database users to see data they shouldn't. If this is of concern in your installation, follow the steps in the first changelog entry below to rectify it. + +Also, if you are upgrading from a version earlier than 14.11, see [Section E.10](release-14-11.html "E.10. Release 14.11"). + +### E.9.2. Changes + +* Restrict visibility of `pg_stats_ext` and `pg_stats_ext_exprs` entries to the table owner (Nathan Bossart) [§](https://postgr.es/c/c3425383b) + + These views failed to hide statistics for expressions that involve columns the accessing user does not have permission to read. View columns such as `most_common_vals` might expose security-relevant data. The potential interactions here are not fully clear, so in the interest of erring on the side of safety, make rows in these views visible only to the owner of the associated table. + + The PostgreSQL Project thanks Lukas Fittl for reporting this problem. (CVE-2024-4317) + + By itself, this fix will only fix the behavior in newly initdb'd database clusters. If you wish to apply this change in an existing cluster, you will need to do the following: + + 1. Find the SQL script `fix-CVE-2024-4317.sql` in the *`share`* directory of the PostgreSQL installation (typically located someplace like `/usr/share/postgresql/`). Be sure to use the script appropriate to your PostgreSQL major version. If you do not see this file, either your version is not vulnerable (only v14–v16 are affected) or your minor version is too old to have the fix. + 2. In *each* database of the cluster, run the `fix-CVE-2024-4317.sql` script as superuser. In psql this would look like + + ```None + \i /usr/share/postgresql/fix-CVE-2024-4317.sql + ``` + + (adjust the file path as appropriate). Any error probably indicates that you've used the wrong script version. It will not hurt to run the script more than once. + 3. Do not forget to include the `template0` and `template1` databases, or the vulnerability will still exist in databases you create later. To fix `template0`, you'll need to temporarily make it accept connections. Do that with + + ```None + ALTER DATABASE template0 WITH ALLOW_CONNECTIONS true; + ``` + + and then after fixing `template0`, undo it with + + ```None + ALTER DATABASE template0 WITH ALLOW_CONNECTIONS false; + ``` +* Fix `INSERT` from multiple `VALUES` rows into a target column that is a domain over an array or composite type (Tom Lane) [§](https://postgr.es/c/3621ffd9f) + + Such cases would either fail with surprising complaints about mismatched datatypes, or insert unexpected coercions that could lead to odd results. +* Fix incorrect pruning of NULL partition when a table is partitioned on a boolean column and the query has a boolean `IS NOT` clause (David Rowley) [§](https://postgr.es/c/f9c8f7ccd) + + A NULL value satisfies a clause such as `boolcol IS NOT FALSE`, so pruning away a partition containing NULLs yielded incorrect answers. +* Make `ALTER FOREIGN TABLE SET SCHEMA` move any owned sequences into the new schema (Tom Lane) [§](https://postgr.es/c/66bbad581) + + Moving a regular table to a new schema causes any sequences owned by the table to be moved to that schema too (along with indexes and constraints). This was overlooked for foreign tables, however. +* Improve `ALTER TABLE ... ALTER COLUMN TYPE`'s error message when there is a dependent function or publication (Tom Lane) [§](https://postgr.es/c/617a23927) +* Fix `EXPLAIN`'s counting of heap pages accessed by a bitmap heap scan (Melanie Plageman) [§](https://postgr.es/c/262757b73) + + Previously, heap pages that contain no visible tuples were not counted; but it seems more consistent to count all pages returned by the bitmap index scan. +* Avoid deadlock during removal of orphaned temporary tables (Mikhail Zhilin) [§](https://postgr.es/c/ca392df8d) + + If the session that creates a temporary table crashes without removing the table, autovacuum will eventually try to remove the orphaned table. However, an incoming session that's been assigned the same temporary namespace will do that too. If a temporary table has a dependency (such as an owned sequence) then a deadlock could result between these two cleanup attempts. +* Avoid race condition while examining per-relation frozen-XID values (Noah Misch) [§](https://postgr.es/c/2ca19aa81) + + `VACUUM`'s computation of per-database frozen-XID values from per-relation values could get confused by a concurrent update of those values by another `VACUUM`. +* Disallow converting a table to a view within an outer SQL command that is using that table (Tom Lane) [§](https://postgr.es/c/51189f98a) + + This avoids possible crashes. +* Ensure that join conditions generated from equivalence classes are applied at the correct plan level (Tom Lane) [§](https://postgr.es/c/ab2402268) + + In versions before PostgreSQL 16, it was possible for generated conditions to be evaluated below outer joins when they should be evaluated above (after) the outer join, leading to incorrect query results. All versions have a similar hazard when considering joins to `UNION ALL` trees that have constant outputs for the join column in some `SELECT` arms. +* Avoid unnecessary use of moving-aggregate mode with a non-moving window frame (Vallimaharajan G) [§](https://postgr.es/c/0d30e48c2) + + When a plain aggregate is used as a window function, and the window frame start is specified as `UNBOUNDED PRECEDING`, the frame's head cannot move so we do not need to use the special (and more expensive) moving-aggregate mode. This optimization was intended all along, but due to a coding error it never triggered. +* Avoid use of already-freed data while planning partition-wise joins under GEQO (Tom Lane) [§](https://postgr.es/c/cbeb45527) + + This would typically end in a crash or unexpected error message. +* Avoid freeing still-in-use data in Memoize (Tender Wang, Andrei Lepikhov) [§](https://postgr.es/c/72b8507db) + + In production builds this error frequently didn't cause any problems, as the freed data would most likely not get overwritten before it was used. +* Fix incorrectly-reported statistics kind codes in “requested statistics kind *`X`* is not yet built” error messages (David Rowley) [§](https://postgr.es/c/0c2dda109) +* Be more careful with `RECORD`-returning functions in `FROM` (Tom Lane) [§](https://postgr.es/c/78e81e14d) [§](https://postgr.es/c/a595c3075) + + The output columns of such a function call must be defined by an `AS` clause that specifies the column names and data types. If the actual function output value doesn't match that, an error is supposed to be thrown at runtime. However, some code paths would examine the actual value prematurely, and potentially issue strange errors or suffer assertion failures if it doesn't match expectations. +* Fix confusion about the return rowtype of SQL-language procedures (Tom Lane) [§](https://postgr.es/c/649bbba11) + + A procedure implemented in SQL language that returns a single composite-type column would cause an assertion failure or core dump. +* Add protective stack depth checks to some recursive functions (Egor Chindyaskin) [§](https://postgr.es/c/84cc1a552) +* Fix mis-rounding and overflow hazards in `date_bin()` (Moaaz Assali) [§](https://postgr.es/c/fe3b1b575) + + In the case where the source timestamp is before the origin timestamp and their difference is already an exact multiple of the stride, the code incorrectly subtracted the stride anyway. Also, detect some integer-overflow cases that would have produced incorrect results. +* Detect integer overflow when adding or subtracting an `interval` to/from a `timestamp` (Joseph Koshakow) [§](https://postgr.es/c/1748379b6) + + Some cases that should cause an out-of-range error produced an incorrect result instead. +* Avoid race condition in `pg_get_expr()` (Tom Lane) [§](https://postgr.es/c/d21690edb) + + If the relation referenced by the argument is dropped concurrently, the function's intention is to return NULL, but sometimes it failed instead. +* Fix detection of old transaction IDs in XID status functions (Karina Litskevich) [§](https://postgr.es/c/18388291a) + + Transaction IDs more than 231 transactions in the past could be misidentified as recent, leading to misbehavior of `pg_xact_status()` or `txid_status()`. +* Ensure that a table's freespace map won't return a page that's past the end of the table (Ronan Dunklau) [§](https://postgr.es/c/08059fc04) + + Because the freespace map isn't WAL-logged, this was possible in edge cases involving an OS crash, a replica promote, or a PITR restore. The result would be a “could not read block” error. +* Fix file descriptor leakage when an error is thrown while waiting in `WaitEventSetWait` (Etsuro Fujita) [§](https://postgr.es/c/b714bc40c) +* Avoid corrupting exception stack if an FDW implements async append but doesn't configure any wait conditions for the Append plan node to wait for (Alexander Pyhalov) [§](https://postgr.es/c/e10ca95ff) +* Throw an error if an index is accessed while it is being reindexed (Tom Lane) [§](https://postgr.es/c/09f09884c) + + Previously this was just an assertion check, but promote it into a regular runtime error. This will provide a more on-point error message when reindexing a user-defined index expression that attempts to access its own table. +* Ensure that index-only scans on `name` columns return a fully-padded value (David Rowley) [§](https://postgr.es/c/e6b0efc65) + + The value physically stored in the index is truncated, and previously a pointer to that value was returned to callers. This provoked complaints when testing under valgrind. In theory it could result in crashes, though none have been reported. +* Fix crash with DSM allocations larger than 4GB (Heikki Linnakangas) [§](https://postgr.es/c/9b8550fbd) +* Disconnect if a new server session's client socket cannot be put into non-blocking mode (Heikki Linnakangas) [§](https://postgr.es/c/bf1f593e8) + + It was once theoretically possible for us to operate with a socket that's in blocking mode; but that hasn't worked fully in a long time, so fail at connection start rather than misbehave later. +* Fix inadequate error reporting with OpenSSL 3.0.0 and later (Heikki Linnakangas, Tom Lane) [§](https://postgr.es/c/473babd42) + + System-reported errors passed through by OpenSSL were reported with a numeric error code rather than anything readable. +* Avoid concurrent calls to `bindtextdomain()` in libpq and ecpglib (Tom Lane) [§](https://postgr.es/c/8ead39e38) [§](https://postgr.es/c/7d7cc7fd6) + + Although GNU gettext's implementation seems to be fine with concurrent calls, the version available on Windows is not. +* Fix crash in ecpg's preprocessor if the program tries to redefine a macro that was defined on the preprocessor command line (Tom Lane) [§](https://postgr.es/c/463164639) [§](https://postgr.es/c/df66319f7) [§](https://postgr.es/c/de84608e2) +* In ecpg, avoid issuing false “unsupported feature will be passed to server” warnings (Tom Lane) [§](https://postgr.es/c/d3167ed3f) +* Ensure that the string result of ecpg's `intoasc()` function is correctly zero-terminated (Oleg Tselebrovskiy) [§](https://postgr.es/c/a05bb9add) +* Fix pg\_dumpall so that role comments, if present, will be dumped regardless of the setting of `--no-role-passwords` (Daniel Gustafsson, Álvaro Herrera) [§](https://postgr.es/c/be01c8c34) [§](https://postgr.es/c/6ebd43725) +* Fix PL/pgSQL's parsing of single-line comments (`--`-style comments) following expressions (Erik Wienhold, Tom Lane) [§](https://postgr.es/c/dc5824a06) + + This mistake caused parse errors if such a comment followed a `WHEN` expression in a PL/pgSQL `CASE` statement. +* In `contrib/amcheck`, don't report false match failures due to short- versus long-header values (Andrey Borodin, Michael Zhilin) [§](https://postgr.es/c/4e8529da4) [§](https://postgr.es/c/5df5d9cd7) + + A variable-length datum in a heap tuple or index tuple could have either a short or a long header, depending on compression parameters that applied when it was made. Treat these cases as equivalent rather than complaining if there's a difference. +* Fix bugs in BRIN output functions (Tomas Vondra) [§](https://postgr.es/c/ad23af83d) + + These output functions are only used for displaying index entries in `contrib/pageinspect`, so the errors are of limited practical concern. +* In `contrib/postgres_fdw`, avoid emitting requests to sort by a constant (David Rowley) [§](https://postgr.es/c/628c3f2e1) + + This could occur in cases involving `UNION ALL` with constant-emitting subqueries. Sorting by a constant is useless of course, but it also risks being misinterpreted by the remote server, leading to “ORDER BY position *`N`* is not in select list” errors. +* Make `contrib/postgres_fdw` set the remote session's time zone to `GMT` not `UTC` (Tom Lane) [§](https://postgr.es/c/3ed6e1698) + + This should have the same results for practical purposes. However, `GMT` is recognized by hard-wired code in the server, while `UTC` is looked up in the timezone database. So the old code could fail in the unlikely event that the remote server's timezone database is missing entries. +* In `contrib/xml2`, avoid use of library functions that have been deprecated in recent versions of libxml2 (Dmitry Koval) [§](https://postgr.es/c/6fa5e67e8) +* Fix incompatibility with LLVM 18 (Thomas Munro, Dmitry Dolgov) [§](https://postgr.es/c/7fe32eaa4) +* Allow `make check` to work with the musl C library (Thomas Munro, Bruce Momjian, Tom Lane) [§](https://postgr.es/c/d82605bcd) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-14-13.html "E.8. Release 14.13") | [Up](release.html "Appendix E. Release Notes") | [Next](release-14-11.html "E.10. Release 14.11") | +| E.8. Release 14.13 | [Home](index.html "PostgreSQL 14.20 Documentation") | E.10. Release 14.11 | + +[Previous](/docs/release/14.11/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/14.13/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1413.md b/corpus/changelog/postgresql_releases/postgresql_1413.md new file mode 100644 index 0000000000000000000000000000000000000000..629ba015f16b3d46336bc68593c78761c7b76590 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1413.md @@ -0,0 +1,164 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.13/ +Version: 14.13 + +## PostgreSQL 14.13 + +| E.8. Release 14.13 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-14-14.html "E.7. Release 14.14") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-14-12.html "E.9. Release 14.12") | + +--- + +## E.8. Release 14.13 + +[E.8.1. Migration to Version 14.13](release-14-13.html#id-1.11.6.13.4) + +[E.8.2. Changes](release-14-13.html#id-1.11.6.13.5) + +**Release date:**2024-08-08 + +This release contains a variety of fixes from 14.12. For information about new features in major release 14, see [Section E.21](release-14.html "E.21. Release 14"). + +### E.8.1. Migration to Version 14.13 + +A dump/restore is not required for those running 14.X. + +However, if you are upgrading from a version earlier than 14.12, see [Section E.9](release-14-12.html "E.9. Release 14.12"). + +### E.8.2. Changes + +* Prevent unauthorized code execution during pg\_dump (Masahiko Sawada) [§](https://postgr.es/c/72ef1675e) + + An attacker able to create and drop non-temporary objects could inject SQL code that would be executed by a concurrent pg\_dump session with the privileges of the role running pg\_dump (which is often a superuser). The attack involves replacing a sequence or similar object with a view or foreign table that will execute malicious code. To prevent this, introduce a new server parameter `restrict_nonsystem_relation_kind` that can disable expansion of non-builtin views as well as access to foreign tables, and teach pg\_dump to set it when available. Note that the attack is prevented only if both pg\_dump and the server it is dumping from are new enough to have this fix. + + The PostgreSQL Project thanks Noah Misch for reporting this problem. (CVE-2024-7348) +* Prevent infinite loop in `VACUUM` (Melanie Plageman) [§](https://postgr.es/c/45ce054c0) + + After a disconnected standby server with an old running transaction reconnected to the primary, it was possible for `VACUUM` on the primary to get confused about which tuples are removable, resulting in an infinite loop. +* Fix failure after attaching a table as a partition, if the table had previously had inheritance children (Álvaro Herrera) [§](https://postgr.es/c/fe1d16f66) +* Fix `ALTER TABLE DETACH PARTITION` for cases involving inconsistent index-based constraints (Álvaro Herrera, Tender Wang) [§](https://postgr.es/c/66aaa7a71) [§](https://postgr.es/c/2f5007459) + + When a partitioned table has an index that is not associated with a constraint, but a partition has an equivalent index that is, then detaching the partition would misbehave, leaving the ex-partition's constraint with an incorrect `coninhcount` value. This would cause trouble during any further manipulations of that constraint. +* Fix partition pruning setup during `ALTER TABLE DETACH PARTITION CONCURRENTLY` (Álvaro Herrera) [§](https://postgr.es/c/66e569f50) [§](https://postgr.es/c/5dcaefc6a) + + The executor assumed that no partition could be detached between planning and execution of a query on a partitioned table. This is no longer true since the introduction of `DETACH PARTITION`'s `CONCURRENTLY` option, making it possible for query execution to fail transiently when that is used. +* Correctly update a partitioned table's `pg_class`.`reltuples` field to zero after its last child partition is dropped (Noah Misch) [§](https://postgr.es/c/2b415e95a) + + The first `ANALYZE` on such a partitioned table must update `relhassubclass` as well, and that caused the `reltuples` update to be lost. +* Fix handling of polymorphic output arguments for procedures (Tom Lane) [§](https://postgr.es/c/525bd1620) [§](https://postgr.es/c/d88dcdf0f) + + The SQL `CALL` statement did not resolve the correct data types for such arguments, leading to errors such as “cannot display a value of type anyelement”, or even outright crashes. (But `CALL` in PL/pgSQL worked correctly.) +* Fix behavior of stable functions called from a `CALL` statement's argument list (Tom Lane) [§](https://postgr.es/c/0f7d1338c) + + If the `CALL` is within an atomic context (e.g. there's an outer transaction block), such functions were passed the wrong snapshot, causing them to see stale values of rows modified since the start of the outer transaction. +* Detect integer overflow in `money` calculations (Joseph Koshakow) [§](https://postgr.es/c/e8dfe0430) + + None of the arithmetic functions for the `money` type checked for overflow before, so they would silently give wrong answers for overflowing cases. +* Fix over-aggressive clamping of the scale argument in `round(numeric)` and `trunc(numeric)` (Dean Rasheed) [§](https://postgr.es/c/a3c0124f6) + + These functions clamped their scale argument to +/-2000, but there are valid use-cases for it to be larger; the functions returned incorrect results in such cases. Instead clamp to the actual allowed range of type `numeric`. +* Prevent `pg_sequence_last_value()` from failing on unlogged sequences on standby servers and on temporary sequences of other sessions (Nathan Bossart) [§](https://postgr.es/c/c8714230a) + + Make it return NULL in these cases instead of throwing an error. +* Fix parsing of ignored operators in `websearch_to_tsquery()` (Tom Lane) [§](https://postgr.es/c/5912bf77c) + + Per the manual, punctuation in the input of `websearch_to_tsquery()` is ignored except for the special cases of dashes and quotes. However, parentheses and a few other characters appearing immediately before an `or` could cause `or` to be treated as a data word, rather than as an `OR` operator as expected. +* Detect another integer overflow case while computing new array dimensions (Joseph Koshakow) [§](https://postgr.es/c/670fb9f18) + + Reject applying array dimensions `[-2147483648:2147483647]` to an empty array. This is closely related to CVE-2023-5869, but appears harmless since the array still ends up empty. +* Detect another case of a new catalog cache entry becoming stale while detoasting its fields (Noah Misch) [§](https://postgr.es/c/af73e37fa) + + An in-place update occurring while we expand out-of-line fields in a catalog tuple could be missed, leading to a catalog cache entry that lacks the in-place change but is not known to be stale. This is only possible in the `pg_database` catalog, so the effects are narrow, but misbehavior is possible. +* Correctly check updatability of view columns targeted by `INSERT` ... `DEFAULT` (Tom Lane) [§](https://postgr.es/c/0d712ec12) + + If such a column is non-updatable, we should give an error reporting that. But the check was missed and then later code would report an unhelpful error such as “attribute number *`N`* not found in view targetlist”. +* Avoid reporting an unhelpful internal error for incorrect recursive queries (Tom Lane) [§](https://postgr.es/c/02b4f5e1f) + + Rearrange the order of error checks so that we throw an on-point error when a `WITH RECURSIVE` query does not have a self-reference within the second arm of the `UNION`, but does have one self-reference in some other place such as `ORDER BY`. +* Don't throw an error if a queued `AFTER` trigger no longer exists (Tom Lane) [§](https://postgr.es/c/88f3baa06) + + It's possible for a transaction to execute an operation that queues a deferred `AFTER` trigger for later execution, and then to drop the trigger before that happens. Formerly this led to weird errors such as “could not find trigger *`NNNN`*”. It seems better to silently do nothing if the trigger no longer exists at the time when it would have been executed. +* Fix failure to remove `pg_init_privs` entries for column-level privileges when their table is dropped (Tom Lane) [§](https://postgr.es/c/f3f6a14ce) + + If an extension grants some column-level privileges on a table it creates, relevant catalog entries would remain behind after the extension is dropped. This was harmless until/unless the table's OID was re-used for another relation, when it could interfere with what pg\_dump dumps for that relation. +* Fix selection of an arbiter index for `ON CONFLICT` when the desired index has expressions or predicates (Tom Lane) [§](https://postgr.es/c/096f2132c) + + If a query using `ON CONFLICT` accesses the target table through an updatable view, it could fail with “there is no unique or exclusion constraint matching the ON CONFLICT specification”, even though a matching index does exist. +* Refuse to modify a temporary table of another session with `ALTER TABLE` (Tom Lane) [§](https://postgr.es/c/2dad0f433) + + Permissions checks normally would prevent this case from arising, but it is possible to reach it by altering a parent table whose child is another session's temporary table. Throw an error if we discover that such a child table belongs to another session. +* Fix handling of extended statistics on expressions in `CREATE TABLE LIKE STATISTICS` (Tom Lane) [§](https://postgr.es/c/1015162c3) + + The `CREATE` command failed to adjust column references in statistics expressions to the possibly-different column numbering of the new table. This resulted in invalid statistics objects that would cause problems later. A typical scenario where renumbering columns is needed is when the source table contains some dropped columns. +* Fix failure to recalculate sub-queries generated from `MIN()` or `MAX()` aggregates (Tom Lane) [§](https://postgr.es/c/5ac340602) + + In some cases the aggregate result computed at one row of the outer query could be re-used for later rows when it should not be. This has only been seen to happen when the outer query uses `DISTINCT` that is implemented with hash aggregation, but other cases may exist. +* Avoid crashing when a JIT-inlined backend function throws an error (Tom Lane) [§](https://postgr.es/c/13abc1f66) + + The error state can include pointers into the dynamically loaded module holding the JIT-compiled code (for error location strings). In some code paths the module could get unloaded before the error report is processed, leading to SIGSEGV when the location strings are accessed. +* Cope with behavioral changes in libxml2 version 2.13.x (Erik Wienhold, Tom Lane) [§](https://postgr.es/c/475e1807c) + + Notably, we now suppress “chunk is not well balanced” errors from libxml2, unless that is the only reported error. This is to make error reports consistent between 2.13.x and earlier libxml2 versions. In earlier versions, that message was almost always redundant or outright incorrect, so 2.13.x substantially reduced the number of cases in which it's reported. +* Fix handling of subtransactions of prepared transactions when starting a hot standby server (Heikki Linnakangas) [§](https://postgr.es/c/9dbf8ab48) + + When starting a standby's replay at a shutdown checkpoint WAL record, transactions that had been prepared but not yet committed on the primary are correctly understood as being still in progress. But subtransactions of a prepared transaction (created by savepoints or PL/pgSQL exception blocks) were not accounted for and would be treated as aborted. That led to inconsistency if the prepared transaction was later committed. +* Prevent incorrect initialization of logical replication slots (Masahiko Sawada) [§](https://postgr.es/c/f7d3caf9d) + + In some cases a replication slot's start point within the WAL stream could be set to a point within a transaction, leading to assertion failures or incorrect decoding results. +* Avoid memory leakage after servicing a notify or sinval interrupt (Tom Lane) [§](https://postgr.es/c/1608902fc) + + The processing functions for these events could switch the current memory context to TopMemoryContext, resulting in session-lifespan leakage of any data allocated before the incorrect setting gets replaced. There were observable leaks associated with (at least) encoding conversion of incoming queries and parameters attached to Bind messages. +* Prevent deadlocks and assertion failures during truncation of the multixact SLRU log (Heikki Linnakangas) [§](https://postgr.es/c/4c8e00ae9) + + A process trying to delete SLRU segments could deadlock with the checkpointer process. +* Avoid possibly missing end-of-input events on Windows sockets (Thomas Munro) [§](https://postgr.es/c/894b497ac) + + Windows reports an FD\_CLOSE event only once after the remote end of the connection disconnects. With unlucky timing, we could miss that report and wait indefinitely, or at least until a timeout elapsed, expecting more input. +* Fix buffer overread in JSON parse error reports for incomplete byte sequences (Jacob Champion) [§](https://postgr.es/c/41adf9d96) + + It was possible to walk off the end of the input buffer by a few bytes when the last bytes comprise an incomplete multi-byte character. While usually harmless, in principle this could cause a crash. +* Disable creation of stateful TLS session tickets by OpenSSL (Daniel Gustafsson) [§](https://postgr.es/c/ecbb1cd9b) [§](https://postgr.es/c/51c1b4fd1) [§](https://postgr.es/c/ddd66a629) + + This avoids possible failures with clients that think receipt of a session ticket means that TLS session resumption is supported. +* When replanning a PL/pgSQL “simple expression”, check it's still simple (Tom Lane) [§](https://postgr.es/c/1450db793) + + Certain fairly-artificial cases, such as dropping a referenced function and recreating it as an aggregate, could lead to surprising failures such as “unexpected plan node type”. +* Fix incompatibility between PL/Perl and Perl 5.40 (Andrew Dunstan) [§](https://postgr.es/c/20f22e6a6) +* Fix recursive `RECORD`-returning PL/Python functions (Tom Lane) [§](https://postgr.es/c/d39337021) + + If we recurse to a new call of the same function that passes a different column definition list (`AS` clause), it would fail because the inner call would overwrite the outer call's idea of what rowtype to return. +* Don't corrupt PL/Python's `TD` dictionary during a recursive trigger call (Tom Lane) [§](https://postgr.es/c/90d39929a) + + If a PL/Python-language trigger caused another one to be invoked, the `TD` dictionary created for the inner one would overwrite the outer one's `TD` dictionary. +* Fix PL/Tcl's reporting of invalid list syntax in the result of a function returning tuple (Erik Wienhold, Tom Lane) [§](https://postgr.es/c/1488dee08) + + Such a case could result in a crash, or in emission of misleading context information that actually refers to the previous Tcl error. +* Avoid non-thread-safe usage of `strerror()` in libpq (Peter Eisentraut) [§](https://postgr.es/c/95e805e9c) + + Certain error messages returned by OpenSSL could become garbled in multi-threaded applications. +* Ensure that `pg_restore` `-l` reports dependent TOC entries correctly (Tom Lane) [§](https://postgr.es/c/52b23b4e1) + + If `-l` was specified together with selective-restore options such as `-n` or `-N`, dependent TOC entries such as comments would be omitted from the listing, even when an actual restore would have selected them. +* In `contrib/postgres_fdw`, do not send `FETCH FIRST WITH TIES` clauses to the remote server (Japin Li) [§](https://postgr.es/c/269e2c391) + + The remote server might not implement this clause, or might interpret it differently than we would locally, so don't risk attempting remote execution. +* Avoid clashing with system-provided `` headers (Thomas Munro) [§](https://postgr.es/c/c2342a925) + + This fixes a compilation failure on macOS version 15 and up. +* Fix otherwise-harmless assertion failure in Memoize cost estimation (David Rowley) [§](https://postgr.es/c/dae9f16aa) +* Fix otherwise-harmless assertion failures in `REINDEX CONCURRENTLY` applied to an SP-GiST index (Tom Lane) [§](https://postgr.es/c/e4a55378f) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-14-14.html "E.7. Release 14.14") | [Up](release.html "Appendix E. Release Notes") | [Next](release-14-12.html "E.9. Release 14.12") | +| E.7. Release 14.14 | [Home](index.html "PostgreSQL 14.20 Documentation") | E.9. Release 14.12 | + +[Previous](/docs/release/14.12/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/14.14/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1414.md b/corpus/changelog/postgresql_releases/postgresql_1414.md new file mode 100644 index 0000000000000000000000000000000000000000..64c7e9b7bed52fd119189ef2253dfc0ad2254ef2 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1414.md @@ -0,0 +1,199 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.14/ +Version: 14.14 + +## PostgreSQL 14.14 + +| E.7. Release 14.14 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-14-15.html "E.6. Release 14.15") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-14-13.html "E.8. Release 14.13") | + +--- + +## E.7. Release 14.14 + +[E.7.1. Migration to Version 14.14](release-14-14.html#id-1.11.6.12.4) + +[E.7.2. Changes](release-14-14.html#id-1.11.6.12.5) + +**Release date:**2024-11-14 + +This release contains a variety of fixes from 14.13. For information about new features in major release 14, see [Section E.21](release-14.html "E.21. Release 14"). + +### E.7.1. Migration to Version 14.14 + +A dump/restore is not required for those running 14.X. + +However, if you have ever detached a partition from a partitioned table that has a foreign-key reference to another partitioned table, and not dropped the former partition, then you may have catalog and/or data corruption to repair, as detailed in the fifth changelog entry below. + +Also, if you are upgrading from a version earlier than 14.12, see [Section E.9](release-14-12.html "E.9. Release 14.12"). + +### E.7.2. Changes + +* Ensure cached plans are marked as dependent on the calling role when RLS applies to a non-top-level table reference (Nathan Bossart) [§](https://postgr.es/c/4e51030af) + + If a CTE, subquery, sublink, security invoker view, or coercion projection in a query references a table with row-level security policies, we neglected to mark the resulting plan as potentially dependent on which role is executing it. This could lead to later query executions in the same session using the wrong plan, and then returning or hiding rows that should have been hidden or returned instead. + + The PostgreSQL Project thanks Wolfgang Walther for reporting this problem. (CVE-2024-10976) +* Make libpq discard error messages received during SSL or GSS protocol negotiation (Jacob Champion) [§](https://postgr.es/c/e6c945476) + + An error message received before encryption negotiation is completed might have been injected by a man-in-the-middle, rather than being real server output. Reporting it opens the door to various security hazards; for example, the message might spoof a query result that a careless user could mistake for correct output. The best answer seems to be to discard such data and rely only on libpq's own report of the connection failure. + + The PostgreSQL Project thanks Jacob Champion for reporting this problem. (CVE-2024-10977) +* Fix unintended interactions between `SET SESSION AUTHORIZATION` and `SET ROLE` (Tom Lane) [§](https://postgr.es/c/2a68808e2) [§](https://postgr.es/c/00b94e8e2) + + The SQL standard mandates that `SET SESSION AUTHORIZATION` have a side-effect of doing `SET ROLE NONE`. Our implementation of that was flawed, creating more interaction between the two settings than intended. Notably, rolling back a transaction that had done `SET SESSION AUTHORIZATION` would revert `ROLE` to `NONE` even if that had not been the previous state, so that the effective user ID might now be different from what it had been before the transaction. Transiently setting `session_authorization` in a function `SET` clause had a similar effect. A related bug was that if a parallel worker inspected `current_setting('role')`, it saw `none` even when it should see something else. + + The PostgreSQL Project thanks Tom Lane for reporting this problem. (CVE-2024-10978) +* Prevent trusted PL/Perl code from changing environment variables (Andrew Dunstan, Noah Misch) [§](https://postgr.es/c/d15ec27c9) [§](https://postgr.es/c/f89bd92c9) [§](https://postgr.es/c/c1fff7b1b) [§](https://postgr.es/c/256e34653) + + The ability to manipulate process environment variables such as `PATH` gives an attacker opportunities to execute arbitrary code. Therefore, “trusted” PLs must not offer the ability to do that. To fix `plperl`, replace `%ENV` with a tied hash that rejects any modification attempt with a warning. Untrusted `plperlu` retains the ability to change the environment. + + The PostgreSQL Project thanks Coby Abrams for reporting this problem. (CVE-2024-10979) +* Fix updates of catalog state for foreign-key constraints when attaching or detaching table partitions (Jehan-Guillaume de Rorthais, Tender Wang, Álvaro Herrera) [§](https://postgr.es/c/46a8c27a7) + + If the referenced table is partitioned, then different catalog entries are needed for a referencing table that is stand-alone versus one that is a partition. `ATTACH/DETACH PARTITION` commands failed to perform this conversion correctly. In particular, after `DETACH` the now stand-alone table would be missing foreign-key enforcement triggers, which could result in the table later containing rows that fail the foreign-key constraint. A subsequent re-`ATTACH` could fail with surprising errors, too. + + The way to fix this is to do `ALTER TABLE DROP CONSTRAINT` on the now stand-alone table for each faulty constraint, and then re-add the constraint. If re-adding the constraint fails, then some erroneous data has crept in. You will need to manually re-establish consistency between the referencing and referenced tables, then re-add the constraint. + + This query can be used to identify broken constraints and construct the commands needed to recreate them: + + ```None + SELECT conrelid::pg_catalog.regclass AS "constrained table", + conname AS constraint, + confrelid::pg_catalog.regclass AS "references", + pg_catalog.format('ALTER TABLE %s DROP CONSTRAINT %I;', + conrelid::pg_catalog.regclass, conname) AS "drop", + pg_catalog.format('ALTER TABLE %s ADD CONSTRAINT %I %s;', + conrelid::pg_catalog.regclass, conname, + pg_catalog.pg_get_constraintdef(oid)) AS "add" + FROM pg_catalog.pg_constraint c + WHERE contype = 'f' AND conparentid = 0 AND + (SELECT count(*) FROM pg_catalog.pg_constraint c2 + WHERE c2.conparentid = c.oid) <> + ((SELECT count(*) FROM pg_catalog.pg_inherits i + WHERE (i.inhparent = c.conrelid OR i.inhparent = c.confrelid) AND + EXISTS (SELECT 1 FROM pg_catalog.pg_partitioned_table + WHERE partrelid = i.inhparent)) + + CASE WHEN pg_catalog.pg_partition_root(conrelid) = confrelid THEN + (SELECT count(*) FROM pg_catalog.pg_partition_tree(confrelid) + WHERE level = 1) + ELSE 0 END); + ``` + + Since it is possible that one or more of the `ADD CONSTRAINT` steps will fail, you should save the query's output in a file and then attempt to perform each step. +* Avoid possible crashes and “could not open relation” errors in queries on a partitioned table occurring concurrently with a `DETACH CONCURRENTLY` and immediate drop of a partition (Álvaro Herrera, Kuntal Gosh) [§](https://postgr.es/c/3ad4c8615) [§](https://postgr.es/c/1b4bdf915) +* Disallow `ALTER TABLE ATTACH PARTITION` if the table to be attached has a foreign key referencing the partitioned table (Álvaro Herrera) [§](https://postgr.es/c/e97121d90) [§](https://postgr.es/c/a54a5c426) + + This arrangement is not supported, and other ways of creating it already fail. +* Don't use partitionwise joins or grouping if the query's collation for the key column doesn't match the partition key's collation (Jian He, Webbo Han) [§](https://postgr.es/c/62df5484f) [§](https://postgr.es/c/96f9b29a3) + + Such plans could produce incorrect results. +* Fix possible “could not find pathkey item to sort” error when the output of a `UNION ALL` member query needs to be sorted, and the sort column is an expression (Andrei Lepikhov, Tom Lane) [§](https://postgr.es/c/4ca708eb3) +* Allow cancellation of the second stage of index build for large hash indexes (Pavel Borisov) [§](https://postgr.es/c/b49013f2e) +* Fix assertion failure or confusing error message for `COPY (query) TO ...`, when the *`query`* is rewritten by a `DO INSTEAD NOTIFY` rule (Tender Wang, Tom Lane) [§](https://postgr.es/c/5e94f616c) +* Fix detection of skewed data during parallel hash join (Thomas Munro) [§](https://postgr.es/c/20d948994) + + After repartitioning the inner side of a hash join because one partition has accumulated too many tuples, we check to see if all the partition's tuples went into the same child partition, which suggests that they all have the same hash value and further repartitioning cannot improve matters. This check malfunctioned in some cases, allowing repeated futile repartitioning which would eventually end in a resource-exhaustion error. +* Fix race condition in committing a serializable transaction (Heikki Linnakangas) [§](https://postgr.es/c/520ec2474) + + Mis-processing of a recently committed transaction could lead to an assertion failure or a “could not access status of transaction” error. +* Fix race condition in `COMMIT PREPARED` that resulted in orphaned 2PC files (wuchengwen) [§](https://postgr.es/c/5f1510787) + + A concurrent `PREPARE TRANSACTION` could cause `COMMIT PREPARED` to not remove the on-disk two-phase state file for the completed transaction. There was no immediate ill effect, but a subsequent crash-and-recovery could fail with “could not access status of transaction”, requiring manual removal of the orphaned file to restore service. +* Avoid invalid memory accesses after skipping an invalid toast index during `VACUUM FULL` (Tender Wang) [§](https://postgr.es/c/6530b869c) + + A list tracking yet-to-be-rebuilt indexes was not properly updated in this code path, risking assertion failures or crashes later on. +* Fix ways in which an “in place” catalog update could be lost (Noah Misch) [§](https://postgr.es/c/82c2d9e02) [§](https://postgr.es/c/f51b34b3e) [§](https://postgr.es/c/b9ee1339b) [§](https://postgr.es/c/ad24b7565) [§](https://postgr.es/c/11e3f288f) [§](https://postgr.es/c/bb3054297) [§](https://postgr.es/c/803655e66) + + Normal row updates write a new version of the row to preserve rollback-ability of the transaction. However, certain system catalog updates are intentionally non-transactional and are done with an in-place update of the row. These patches fix race conditions that could cause the effects of an in-place update to be lost. As an example, it was possible to forget having set `pg_class`.`relhasindex` to true, preventing updates of the new index and thus causing index corruption. +* Reset catalog caches at end of recovery (Noah Misch) [§](https://postgr.es/c/dca68242a) + + This prevents scenarios wherein an in-place catalog update could be lost due to using stale data from a catalog cache. +* Avoid using parallel query while holding off interrupts (Francesco Degrassi, Noah Misch, Tom Lane) [§](https://postgr.es/c/5c698e898) [§](https://postgr.es/c/989ccd26c) + + This situation cannot arise normally, but it can be reached with test scenarios such as using a SQL-language function as B-tree support (which would be far too slow for production usage). If it did occur it would result in an indefinite wait. +* Report the active query ID for statistics purposes at the start of processing of Bind and Execute protocol messages (Sami Imseih) [§](https://postgr.es/c/b36ee879c) + + This allows more of the work done in extended query protocol to be attributed to the correct query. +* Guard against stack overflow in libxml2 with too-deeply-nested XML input (Tom Lane, with hat tip to Nick Wellnhofer) [§](https://postgr.es/c/7721fff06) + + Use `xmlXPathCtxtCompile()` rather than `xmlXPathCompile()`, because the latter fails to protect itself against recursion-to-stack-overflow in libxml2 releases before 2.13.4. +* Do not ignore a concurrent `REINDEX CONCURRENTLY` that is working on an index with predicates or expressions (Michail Nikolaev) [§](https://postgr.es/c/902151548) + + Normally, `REINDEX CONCURRENTLY` does not need to wait for other `REINDEX CONCURRENTLY` operations on other tables. However, this optimization is not applied if the other `REINDEX CONCURRENTLY` is processing an index with predicates or expressions, on the chance that such expressions contain user-defined code that accesses other tables. Careless coding created a race condition such that that rule was not applied uniformly, possibly allowing inconsistent behavior. +* Fix “failed to find plan for subquery/CTE” errors in `EXPLAIN` (Richard Guo, Tom Lane) [§](https://postgr.es/c/bc5446a21) [§](https://postgr.es/c/120dd0337) + + This case arose while trying to print references to fields of a RECORD-type output of a subquery when the subquery has been optimized out of the plan altogether (which is possible at least in the case that it has a constant-false `WHERE` condition). Nothing remains in the plan to identify the original field names, so fall back to printing `fN` for the *`N`*'th record column. (That's actually the right thing anyway, if the record output arose from a `ROW()` constructor.) +* Disallow a `USING` clause when altering the type of a generated column (Peter Eisentraut) [§](https://postgr.es/c/ecd19a3cc) + + A generated column already has an expression specifying the column contents, so including `USING` doesn't make sense. +* Ignore not-yet-defined Portals in the `pg_cursors` view (Tom Lane) [§](https://postgr.es/c/3922c9e9f) + + It is possible for user-defined code that inspects this view to be called while a new cursor is being set up, and if that happens a null pointer dereference would ensue. Avoid the problem by defining the view to exclude incompletely-set-up cursors. +* Avoid “unexpected table\_index\_fetch\_tuple call during logical decoding” error while decoding a transaction involving insertion of a column default value (Takeshi Ideriha, Hou Zhijie) [§](https://postgr.es/c/efe706e27) [§](https://postgr.es/c/581092c90) +* Reduce memory consumption of logical decoding (Masahiko Sawada) [§](https://postgr.es/c/5c1ed0a51) + + Use a smaller default block size to store tuple data received during logical replication. This reduces memory wastage, which has been reported to be severe while processing long-running transactions, even leading to out-of-memory failures. +* Re-disable sending of stateless (TLSv1.2) session tickets (Daniel Gustafsson) [§](https://postgr.es/c/8cea8c023) + + A previous change to prevent sending of stateful (TLSv1.3) session tickets accidentally re-enabled sending of stateless ones. Thus, while we intended to prevent clients from thinking that TLS session resumption is supported, some still did. +* Avoid “wrong tuple length” failure when dropping a database with many ACL (permission) entries (Ayush Tiwari) [§](https://postgr.es/c/b3bb1e24b) [§](https://postgr.es/c/3acbe198e) +* Allow adjusting the `session_authorization` and `role` settings in parallel workers (Tom Lane) [§](https://postgr.es/c/546a26b3d) + + Our code intends to allow modifiable server settings to be set by function `SET` clauses, but not otherwise within a parallel worker. `SET` clauses failed for these two settings, though. +* Fix behavior of stable functions called from a `CALL` statement's argument list, when the `CALL` is within a PL/pgSQL `EXCEPTION` block (Tom Lane) [§](https://postgr.es/c/ab13c46ff) + + As with a similar fix in our previous quarterly releases, this case allowed such functions to be passed the wrong snapshot, causing them to see stale values of rows modified since the start of the outer transaction. +* Fix “cache lookup failed for function” errors in edge cases in PL/pgSQL's `CALL` (Tom Lane) [§](https://postgr.es/c/7f875fb5b) +* Fix thread safety of our fallback (non-OpenSSL) MD5 implementation on big-endian hardware (Heikki Linnakangas) [§](https://postgr.es/c/7696b2ea5) + + Thread safety is not currently a concern in the server, but it is for libpq. +* Parse libpq's `keepalives` connection option in the same way as other integer-valued options (Yuto Sasaki) [§](https://postgr.es/c/e7af9b52f) + + The coding used here rejected trailing whitespace in the option value, unlike other cases. This turns out to be problematic in ecpg's usage, for example. +* Avoid use of `pnstrdup()` in ecpglib (Jacob Champion) [§](https://postgr.es/c/355718553) + + That function will call `exit()` on out-of-memory, which is undesirable in a library. The calling code already handles allocation failures properly. +* In ecpglib, fix out-of-bounds read when parsing incorrect datetime input (Bruce Momjian, Pavel Nekrasov) [§](https://postgr.es/c/9a51d4af1) + + It was possible to try to read the location just before the start of a constant array. Real-world consequences seem minimal, though. +* Include the source timeline history in pg\_rewind's debug output (Heikki Linnakangas) [§](https://postgr.es/c/bb5592cac) + + This was the intention to begin with, but a coding error caused the source history to always print as empty. +* Fix misbehavior with junction points on Windows, particularly in pg\_rewind (Alexandra Wang) [§](https://postgr.es/c/02a4ec478) [§](https://postgr.es/c/ca9921936) [§](https://postgr.es/c/8a5e4982f) [§](https://postgr.es/c/895f23d9e) [§](https://postgr.es/c/ce14dbbca) [§](https://postgr.es/c/1bf47d897) + + This entailed back-patching previous fixes by Thomas Munro, Peter Eisentraut, Alexander Lakhin, and Juan José Santamaría Flecha. Those changes were originally not back-patched out of caution, but they have been in use in later branches for long enough to deem them safe. +* Avoid trying to reindex temporary tables and indexes in vacuumdb and in parallel reindexdb (VaibhaveS, Michael Paquier, Fujii Masao, Nathan Bossart) [§](https://postgr.es/c/60c618216) [§](https://postgr.es/c/88e1153cb) [§](https://postgr.es/c/ce6f27857) + + Reindexing other sessions' temporary tables cannot work, but the check to skip them was missing in some code paths, leading to unwanted failures. +* Allow inspection of sequence relations in relevant functions of `contrib/pageinspect` and `contrib/pgstattuple` (Nathan Bossart, Ayush Vatsa) [§](https://postgr.es/c/8a94af8a2) [§](https://postgr.es/c/0970889e3) + + This had been allowed in the past, but it got broken during the introduction of non-default access methods for tables. +* Fix incorrect LLVM-generated code on ARM64 platforms (Thomas Munro, Anthonin Bonnefoy) [§](https://postgr.es/c/0b022ddf3) + + When using JIT compilation on ARM platforms, the generated code could not support relocation distances exceeding 32 bits, allowing unlucky placement of generated code to cause server crashes on large-memory systems. +* Fix a few places that assumed that process start time (represented as a `time_t`) will fit into a `long` value (Max Johnson, Nathan Bossart) [§](https://postgr.es/c/5cea7168d) + + On platforms where `long` is 32 bits (notably Windows), this coding would fail after Y2038. Most of the failures appear only cosmetic, but notably `pg_ctl start` would hang. +* Prevent “nothing provides perl(PostgreSQL::Test::Utils)” failures while building RPM packages of PostgreSQL (Noah Misch) [§](https://postgr.es/c/ecf7c4846) +* Fix building with Strawberry Perl on Windows (Andrew Dunstan) [§](https://postgr.es/c/9f7749464) +* Update time zone data files to tzdata release 2024b (Tom Lane) [§](https://postgr.es/c/dedced73e) [§](https://postgr.es/c/b27622c90) + + This tzdata release changes the old System-V-compatibility zone names to duplicate the corresponding geographic zones; for example `PST8PDT` is now an alias for `America/Los_Angeles`. The main visible consequence is that for timestamps before the introduction of standardized time zones, the zone is considered to represent local mean solar time for the named location. For example, in `PST8PDT`, `timestamptz` input such as `1801-01-01 00:00` would previously have been rendered as `1801-01-01 00:00:00-08`, but now it is rendered as `1801-01-01 00:00:00-07:52:58`. + + Also, historical corrections for Mexico, Mongolia, and Portugal. Notably, `Asia/Choibalsan` is now an alias for `Asia/Ulaanbaatar` rather than being a separate zone, mainly because the differences between those zones were found to be based on untrustworthy data. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-14-15.html "E.6. Release 14.15") | [Up](release.html "Appendix E. Release Notes") | [Next](release-14-13.html "E.8. Release 14.13") | +| E.6. Release 14.15 | [Home](index.html "PostgreSQL 14.20 Documentation") | E.8. Release 14.13 | + +[Previous](/docs/release/14.13/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/14.15/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1415.md b/corpus/changelog/postgresql_releases/postgresql_1415.md new file mode 100644 index 0000000000000000000000000000000000000000..eb8a041e55d5d4c92414342bc29940d3bc31508d --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1415.md @@ -0,0 +1,63 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.15/ +Version: 14.15 + +## PostgreSQL 14.15 + +| E.6. Release 14.15 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-14-16.html "E.5. Release 14.16") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-14-14.html "E.7. Release 14.14") | + +--- + +## E.6. Release 14.15 + +[E.6.1. Migration to Version 14.15](release-14-15.html#id-1.11.6.11.4) + +[E.6.2. Changes](release-14-15.html#id-1.11.6.11.5) + +**Release date:**2024-11-21 + +This release contains a few fixes from 14.14. For information about new features in major release 14, see [Section E.21](release-14.html "E.21. Release 14"). + +### E.6.1. Migration to Version 14.15 + +A dump/restore is not required for those running 14.X. + +However, if you are upgrading from a version earlier than 14.14, see [Section E.7](release-14-14.html "E.7. Release 14.14"). + +### E.6.2. Changes + +* Repair ABI break for extensions that work with struct `ResultRelInfo` (Tom Lane) [§](https://postgr.es/c/099e711b7) + + Last week's minor releases unintentionally broke binary compatibility with timescaledb and several other extensions. Restore the affected structure to its previous size, so that such extensions need not be rebuilt. +* Restore functionality of `ALTER {ROLE|DATABASE} SET role` (Tom Lane, Noah Misch) [§](https://postgr.es/c/be062bfa5) + + The fix for CVE-2024-10978 accidentally caused settings for `role` to not be applied if they come from non-interactive sources, including previous `ALTER {ROLE|DATABASE}` commands and the `PGOPTIONS` environment variable. +* Fix cases where a logical replication slot's `restart_lsn` could go backwards (Masahiko Sawada) [§](https://postgr.es/c/26c4e8968) + + Previously, restarting logical replication could sometimes cause the slot's restart point to be recomputed as an older value than had previously been advertised in `pg_replication_slots`. This is bad, since for example WAL files might have been removed on the basis of the later `restart_lsn` value, in which case replication would fail to restart. +* Avoid deleting still-needed WAL files during pg\_rewind (Polina Bungina, Alexander Kukushkin) [§](https://postgr.es/c/ba2535841) + + Previously, in unlucky cases, it was possible for pg\_rewind to remove important WAL files from the rewound demoted primary. In particular this happens if those files have been marked for archival (i.e., their `.ready` files were created) but not yet archived. Then the newly promoted node no longer has such files because of them having been recycled, but likely they are needed for recovery in the demoted node. If pg\_rewind removes them, recovery is not possible anymore. +* Count index scans in `contrib/bloom` indexes in the statistics views, such as the `pg_stat_user_indexes`.`idx_scan` counter (Masahiro Ikeda) [§](https://postgr.es/c/2a30b6836) +* Fix crash when checking to see if an index's opclass options have changed (Alexander Korotkov) [§](https://postgr.es/c/247e7647f) + + Some forms of `ALTER TABLE` would fail if the table has an index with non-default operator class options. +* Avoid assertion failure caused by disconnected NFA sub-graphs in regular expression parsing (Tom Lane) [§](https://postgr.es/c/2bdd3b248) + + This bug does not appear to have any visible consequences in non-assert builds. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-14-16.html "E.5. Release 14.16") | [Up](release.html "Appendix E. Release Notes") | [Next](release-14-14.html "E.7. Release 14.14") | +| E.5. Release 14.16 | [Home](index.html "PostgreSQL 14.20 Documentation") | E.7. Release 14.14 | + +[Previous](/docs/release/14.14/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/14.16/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1416.md b/corpus/changelog/postgresql_releases/postgresql_1416.md new file mode 100644 index 0000000000000000000000000000000000000000..002f451b5ef383bfc8ccde32ca37e2f6bd181167 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1416.md @@ -0,0 +1,162 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.16/ +Version: 14.16 + +## PostgreSQL 14.16 + +| E.5. Release 14.16 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-14-17.html "E.4. Release 14.17") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-14-15.html "E.6. Release 14.15") | + +--- + +## E.5. Release 14.16 + +[E.5.1. Migration to Version 14.16](release-14-16.html#id-1.11.6.10.4) + +[E.5.2. Changes](release-14-16.html#id-1.11.6.10.5) + +**Release date:**2025-02-13 + +This release contains a variety of fixes from 14.15. For information about new features in major release 14, see [Section E.21](release-14.html "E.21. Release 14"). + +### E.5.1. Migration to Version 14.16 + +A dump/restore is not required for those running 14.X. + +However, if you are upgrading from a version earlier than 14.14, see [Section E.7](release-14-14.html "E.7. Release 14.14"). + +### E.5.2. Changes + +* Harden `PQescapeString` and allied functions against invalidly-encoded input strings (Andres Freund, Noah Misch) [§](https://postgr.es/c/e0ef3d776) [§](https://postgr.es/c/5bc33cbea) [§](https://postgr.es/c/2ae54ae17) [§](https://postgr.es/c/46ddf98df) [§](https://postgr.es/c/4a6825c76) [§](https://postgr.es/c/e1f1b030d) + + Data-quoting functions supplied by libpq now fully check the encoding validity of their input. If invalid characters are detected, they report an error if possible. For the ones that lack an error return convention, the output string is adjusted to ensure that the server will report invalid encoding and no intervening processing will be fooled by bytes that might happen to match single quote, backslash, etc. + + The purpose of this change is to guard against SQL-injection attacks that are possible if one of these functions is used to quote crafted input. There is no hazard when the resulting string is sent directly to a PostgreSQL server (which would check its encoding anyway), but there is a risk when it is passed through psql or other client-side code. Historically such code has not carefully vetted encoding, and in many cases it's not clear what it should do if it did detect such a problem. + + This fix is effective only if the data-quoting function, the server, and any intermediate processing agree on the character encoding that's being used. Applications that insert untrusted input into SQL commands should take special care to ensure that that's true. + + Applications and drivers that quote untrusted input without using these libpq functions may be at risk of similar problems. They should first confirm the data is valid in the encoding expected by the server. + + The PostgreSQL Project thanks Stephen Fewer for reporting this problem. (CVE-2025-1094) +* Exclude parallel workers from connection privilege checks and limits (Tom Lane) [§](https://postgr.es/c/c58b0c43d) + + Do not check `datallowconn`, `rolcanlogin`, and `ACL_CONNECT` privileges when starting a parallel worker, instead assuming that it's enough for the leader process to have passed similar checks originally. This avoids, for example, unexpected failures of parallelized queries when the leader is running as a role that lacks login privilege. In the same vein, enforce `ReservedConnections`, `datconnlimit`, and `rolconnlimit` limits only against regular backends, and count only regular backends while checking if the limits were already reached. Those limits are meant to prevent excessive consumption of process slots for regular backends --- but parallel workers and other special processes have their own pools of process slots with their own limit checks. +* Keep `TransactionXmin` in sync with `MyProc->xmin` (Heikki Linnakangas) [§](https://postgr.es/c/41eafbb49) + + This oversight could permit a process to try to access data that had already been vacuumed away. One known consequence is transient “could not access status of transaction” errors. +* Fix race condition that could cause failure to add a newly-inserted catalog entry to a catalog cache list (Heikki Linnakangas) [§](https://postgr.es/c/fce17c3a5) + + This could result, for example, in failure to use a newly-created function within an existing session. +* Prevent possible catalog corruption when a system catalog is vacuumed concurrently with an update (Noah Misch) [§](https://postgr.es/c/25e99483c) +* Fix data corruption when relation truncation fails (Thomas Munro) [§](https://postgr.es/c/23c743b64) [§](https://postgr.es/c/f154f028d) [§](https://postgr.es/c/049c8cb9a) + + The filesystem calls needed to perform relation truncation could fail, leaving inconsistent state on disk (for example, effectively reviving deleted data). We can't really prevent that, but we can recover by dint of making such failures into PANICs, so that consistency is restored by replaying from WAL up to just before the attempted truncation. This isn't a hugely desirable behavior, but such failures are rare enough that it seems an acceptable solution. +* Prevent checkpoints from starting during relation truncation (Robert Haas) [§](https://postgr.es/c/7d0b91a28) + + This avoids a race condition wherein the modified file might not get fsync'd before completing the checkpoint, creating a risk of data corruption if the operating system crashes soon after. +* Use `rename()` not `link()`/`unlink()` to rename files (Nathan Bossart) [§](https://postgr.es/c/1f95181b4) + + The previous coding was intended to assure that the operation could not accidentally overwrite an existing file. However a failure could leave two links to the same file in existence, confusing subsequent operations and creating a risk of data corruption. In practice we do not use this functionality in places where the target filename could already exist, so it seems better to give up the no-overwrite guarantee to remove the multiple-link hazard. +* Avoid possibly losing an update of `pg_database`.`datfrozenxid` when `VACUUM` runs concurrently with a `REASSIGN OWNED` that changes that database's owner (Kirill Reshke) [§](https://postgr.es/c/536acda0b) +* Fix incorrect `tg_updatedcols` values passed to `AFTER UPDATE` triggers (Tom Lane) [§](https://postgr.es/c/308599305) + + In some cases the `tg_updatedcols` bitmap could describe the set of columns updated by an earlier command in the same transaction, fooling the trigger into doing the wrong thing. + + Also, prevent memory bloat caused by making too many copies of the `tg_updatedcols` bitmap. +* Fix mis-processing of `to_timestamp`'s `FFn` format codes (Tom Lane) [§](https://postgr.es/c/5882a4ba0) + + An integer format code immediately preceding `FFn` would consume all available digits, leaving none for `FFn`. +* When deparsing an `XMLTABLE()` expression, ensure that XML namespace names are double-quoted when necessary (Dean Rasheed) [§](https://postgr.es/c/dc8cd9cd0) +* Include the `ldapscheme` option in `pg_hba_file_rules()` output (Laurenz Albe) [§](https://postgr.es/c/83ffb9f20) [§](https://postgr.es/c/9e596a099) +* Don't merge `UNION` operations if their column collations aren't consistent (Tom Lane) [§](https://postgr.es/c/44a4a521d) + + Previously we ignored collations when deciding if it's safe to merge `UNION` steps into a single N-way `UNION` operation. This was arguably valid before the introduction of nondeterministic collations, but it's not anymore, since the collation in use can affect the definition of uniqueness. +* Fix missed expression processing for partition pruning steps (Tom Lane) [§](https://postgr.es/c/5f725648f) + + This oversight could lead to “unrecognized node type” errors, and perhaps other problems, in queries accessing partitioned tables. +* Allow dshash tables to grow past 1GB (Matthias van de Meent) [§](https://postgr.es/c/84dc1303c) + + This avoids errors like “invalid DSA memory alloc request size”. The case can occur for example in transactions that process several million tables. +* Avoid possible integer overflow in `bringetbitmap()` (James Hunter, Evgeniy Gorbanyov) [§](https://postgr.es/c/e35ff6520) + + Since the result is only used for statistical purposes, the effects of this error were mostly cosmetic. +* Prevent streaming standby servers from looping infinitely when reading a WAL record that crosses pages (Kyotaro Horiguchi, Alexander Kukushkin) [§](https://postgr.es/c/a2d4f806c) + + This would happen when the record's continuation is on a page that needs to be read from a different WAL source. +* Improve performance of archiver process with many status files (Nathan Bossart) [§](https://postgr.es/c/4abf615cc) + + This change back-patches a fix originally made in v15, in response to reports of extremely poor archiving performance leading to downtime or loss of replicas. +* Fix unintended promotion of FATAL errors to PANIC during early process startup (Noah Misch) [§](https://postgr.es/c/315264d70) + + This fixes some unlikely cases that would result in “PANIC: proc\_exit() called in child process”. +* Fix cases where an operator family member operator or support procedure could become a dangling reference (Tom Lane) [§](https://postgr.es/c/1a34cf0f4) [§](https://postgr.es/c/d9d5e1b48) + + In some cases a data type could be dropped while references to its OID still remain in `pg_amop` or `pg_amproc`. While that caused no immediate issues, an attempt to drop the owning operator family would fail, and pg\_dump would produce bogus output when dumping the operator family. This fix causes creation and modification of operator families/classes to add needed dependency entries so that dropping a data type will also drop any dependent operator family elements. That does not help vulnerable pre-existing operator families, though, so a band-aid has also been added to `DROP OPERATOR FAMILY` to prevent failure when dropping a family that has dangling members. +* Fix multiple memory leaks in logical decoding output (Vignesh C, Masahiko Sawada, Boyu Yang) [§](https://postgr.es/c/c53d90bb4) [§](https://postgr.es/c/cfd6cbcf9) +* Avoid low-probability crash on out-of-memory, due to missing check for failure return from `malloc()` (Karina Litskevich) [§](https://postgr.es/c/d24eb0e91) +* Avoid integer overflow while testing `wal_skip_threshold` condition (Tom Lane) [§](https://postgr.es/c/6a33bb35c) + + A transaction that created a very large relation could mistakenly decide to ensure durability by copying the relation into WAL instead of fsync'ing it, thereby negating the point of `wal_skip_threshold`. (This only matters when `wal_level` is set to `minimal`, else a WAL copy is required anyway.) +* Fix unsafe order of operations during cache lookups (Noah Misch) [§](https://postgr.es/c/2690a4f5d) + + The only known consequence was a usually-harmless “you don't own a lock of type ExclusiveLock” warning during `GRANT TABLESPACE`. +* Fix possible “failed to resolve name” failures when using JIT on older ARM platforms (Thomas Munro) [§](https://postgr.es/c/7ca388fd0) + + This could occur as a consequence of inconsistency about the default setting of `-moutline-atomics` between gcc and clang. At least Debian and Ubuntu are known to ship gcc and clang compilers that target armv8-a but differ on the use of outline atomics by default. +* Fix handling of Windows junction points that are not of PostgreSQL origin (Thomas Munro) [§](https://postgr.es/c/f4fd5325c) [§](https://postgr.es/c/9f1c67488) + + Previously, initdb would fail if the path to the data directory included junction points whose expansion isn't in “drive absolute” format, or whose expansion points to another junction point. +* Fix assertion failure in `WITH RECURSIVE ... UNION` queries (David Rowley) [§](https://postgr.es/c/bdb07d241) +* Avoid assertion failure in rule deparsing if a set operation leaf query contains set operations (Man Zeng, Tom Lane) [§](https://postgr.es/c/3eb26524c) +* Avoid edge-case assertion failure in parallel query startup (Tom Lane) [§](https://postgr.es/c/8a95ad3b2) +* In `NULLIF()`, avoid passing a read-write expanded object pointer to the data type's equality function (Tom Lane) [§](https://postgr.es/c/a1168855e) + + The equality function could modify or delete the object if it's given a read-write pointer, which would be bad if we decide to return it as the `NULLIF()` result. There is probably no problem with any built-in equality function, but it's easy to demonstrate a failure with one coded in PL/pgSQL. +* Ensure that expression preprocessing is applied to a default null value in `INSERT` (Tom Lane) [§](https://postgr.es/c/c05268e6e) + + If the target column is of a domain type, the planner must insert a coerce-to-domain step not just a null constant, and this expression missed going through some required processing steps. There is no known consequence with domains based on core data types, but in theory an error could occur with domains based on extension types. +* Repair memory leaks in PL/Python (Mat Arye, Tom Lane) [§](https://postgr.es/c/bcb4db0d3) + + Repeated use of `PLyPlan.execute` or `plpy.cursor` resulted in memory leakage for the duration of the calling PL/Python function. +* Fix PL/Tcl to compile with Tcl 9 (Peter Eisentraut) [§](https://postgr.es/c/17d081a6f) +* In the ecpg preprocessor, fix possible misprocessing of cursors that reference out-of-scope variables (Tom Lane) [§](https://postgr.es/c/52c7a44e9) +* In ecpg, fix compile-time warnings about unsupported use of `COPY ... FROM STDIN` (Ryo Kanbayashi) [§](https://postgr.es/c/d06ab3c0c) + + Previously, the intended warning was not issued due to a typo. +* Fix psql to safely handle file path names that are encoded in SJIS (Tom Lane) [§](https://postgr.es/c/54f9afea7) + + Some two-byte characters in SJIS have a second byte that is equal to ASCII backslash (`\`). These characters were corrupted by path name normalization, preventing access to files whose names include such characters. +* Fix use of wrong version of `pqsignal()` in pgbench and psql (Fujii Masao, Tom Lane) [§](https://postgr.es/c/02e69313a) + + This error could lead to misbehavior when using the `-T` option in pgbench or the `\watch` command in psql, due to interrupted system calls not being resumed as expected. +* Fix misexecution of some nested `\if` constructs in pgbench (Michail Nikolaev) [§](https://postgr.es/c/2a23dbcf3) + + An `\if` command appearing within a false (not-being-executed) `\if` branch was incorrectly treated the same as `\elif`. +* In pgbench, fix possible misdisplay of progress messages during table initialization (Yushi Ogiwara, Tatsuo Ishii, Fujii Masao) [§](https://postgr.es/c/0f13e1a78) [§](https://postgr.es/c/5addea71c) +* Make pg\_controldata more robust against corrupted `pg_control` files (Ilyasov Ian, Anton Voloshin) [§](https://postgr.es/c/f2205448b) + + Since pg\_controldata will attempt to print the contents of `pg_control` even if the CRC check fails, it must take care not to misbehave for invalid field values. This patch fixes some issues triggered by invalid timestamps and apparently-negative WAL segment sizes. +* Fix possible crash in pg\_dump with identity sequences attached to tables that are extension members (Tom Lane) [§](https://postgr.es/c/c7f3c414f) +* Fix pg\_basebackup to correctly handle `pg_wal.tar` files exceeding 2GB on Windows (Davinder Singh, Thomas Munro) [§](https://postgr.es/c/8f40d4612) [§](https://postgr.es/c/1636c5e56) +* Update configuration probes that determine the compiler switches needed to access ARM CRC instructions (Tom Lane) [§](https://postgr.es/c/2fc0199a5) + + On ARM platforms where the baseline CPU target lacks CRC instructions, we need to supply a `-march` switch to persuade the compiler to compile such instructions. Recent versions of gcc reject the value we were trying, leading to silently falling back to software CRC. +* During configure, if a C23 compiler is detected, try asking for C17 (Thomas Munro) [§](https://postgr.es/c/1fd57e5bb) + + PostgreSQL versions before v16 will not compile under C23 rules. If the chosen compiler defaults to C23 or later, try adding a `-std=gnu17` switch to change that. (If this won't work for your compiler, manually specify `CFLAGS` with a suitable switch.) +* Update time zone data files to tzdata release 2025a for DST law changes in Paraguay, plus historical corrections for the Philippines (Tom Lane) [§](https://postgr.es/c/20b4819d0) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-14-17.html "E.4. Release 14.17") | [Up](release.html "Appendix E. Release Notes") | [Next](release-14-15.html "E.6. Release 14.15") | +| E.4. Release 14.17 | [Home](index.html "PostgreSQL 14.20 Documentation") | E.6. Release 14.15 | + +[Previous](/docs/release/14.15/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/14.17/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1417.md b/corpus/changelog/postgresql_releases/postgresql_1417.md new file mode 100644 index 0000000000000000000000000000000000000000..9e7d8efd583185a0a99821a9840c005719083b63 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1417.md @@ -0,0 +1,52 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.17/ +Version: 14.17 + +## PostgreSQL 14.17 + +| E.4. Release 14.17 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-14-18.html "E.3. Release 14.18") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-14-16.html "E.5. Release 14.16") | + +--- + +## E.4. Release 14.17 + +[E.4.1. Migration to Version 14.17](release-14-17.html#id-1.11.6.9.4) + +[E.4.2. Changes](release-14-17.html#id-1.11.6.9.5) + +**Release date:**2025-02-20 + +This release contains a few fixes from 14.16. For information about new features in major release 14, see [Section E.21](release-14.html "E.21. Release 14"). + +### E.4.1. Migration to Version 14.17 + +A dump/restore is not required for those running 14.X. + +However, if you are upgrading from a version earlier than 14.14, see [Section E.7](release-14-14.html "E.7. Release 14.14"). + +### E.4.2. Changes + +* Improve behavior of libpq's quoting functions (Andres Freund, Tom Lane) [§](https://postgr.es/c/985908df1) [§](https://postgr.es/c/c08309584) [§](https://postgr.es/c/f864a4cdf) + + The changes made for CVE-2025-1094 had one serious oversight: `PQescapeLiteral()` and `PQescapeIdentifier()` failed to honor their string length parameter, instead always reading to the input string's trailing null. This resulted in including unwanted text in the output, if the caller intended to truncate the string via the length parameter. With very bad luck it could cause a crash due to reading off the end of memory. + + In addition, modify all these quoting functions so that when invalid encoding is detected, an invalid sequence is substituted for just the first byte of the presumed character, not all of it. This reduces the risk of problems if a calling application performs additional processing on the quoted string. +* Fix crash involving triggers on partitioned tables that make use of transition tables (Kyotaro Horiguchi) [§](https://postgr.es/c/8e58f8024) + + If there are both `AFTER UPDATE` and `AFTER DELETE` triggers, the need for transition tables was determined incorrectly, leading to a crash during cross-partition updates. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-14-18.html "E.3. Release 14.18") | [Up](release.html "Appendix E. Release Notes") | [Next](release-14-16.html "E.5. Release 14.16") | +| E.3. Release 14.18 | [Home](index.html "PostgreSQL 14.20 Documentation") | E.5. Release 14.16 | + +[Previous](/docs/release/14.16/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/14.18/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1418.md b/corpus/changelog/postgresql_releases/postgresql_1418.md new file mode 100644 index 0000000000000000000000000000000000000000..a40f488e670e6b788be87fc9819824b001adb67a --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1418.md @@ -0,0 +1,131 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.18/ +Version: 14.18 + +## PostgreSQL 14.18 + +| E.3. Release 14.18 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-14-19.html "E.2. Release 14.19") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-14-17.html "E.4. Release 14.17") | + +--- + +## E.3. Release 14.18 + +[E.3.1. Migration to Version 14.18](release-14-18.html#id-1.11.6.8.4) + +[E.3.2. Changes](release-14-18.html#id-1.11.6.8.5) + +**Release date:**2025-05-08 + +This release contains a variety of fixes from 14.17. For information about new features in major release 14, see [Section E.21](release-14.html "E.21. Release 14"). + +### E.3.1. Migration to Version 14.18 + +A dump/restore is not required for those running 14.X. + +However, if you have any self-referential foreign key constraints on partitioned tables, it may be necessary to recreate those constraints to ensure that they are being enforced correctly. See the second changelog entry below. + +Also, if you have any BRIN bloom indexes, it may be advisable to reindex them after updating. See the third changelog entry below. + +Also, if you are upgrading from a version earlier than 14.14, see [Section E.7](release-14-14.html "E.7. Release 14.14"). + +### E.3.2. Changes + +* Avoid one-byte buffer overread when examining invalidly-encoded strings that are claimed to be in GB18030 encoding (Noah Misch, Andres Freund) [§](https://postgr.es/c/3f2ab7393) [§](https://postgr.es/c/258cde839) + + While unlikely, a SIGSEGV crash could occur if an incomplete multibyte character appeared at the end of memory. This was possible both in the server and in libpq-using applications. (CVE-2025-4207) +* Handle self-referential foreign keys on partitioned tables correctly (Álvaro Herrera) [§](https://postgr.es/c/1649d153a) + + Creating or attaching partitions failed to make the required catalog entries for a foreign-key constraint, if the table referenced by the constraint was the same partitioned table. This resulted in failure to enforce the constraint fully. + + To fix this, you should drop and recreate any self-referential foreign keys on partitioned tables, if partitions have been created or attached since the constraint was created. Bear in mind that violating rows might already be present, in which case recreating the constraint will fail, and you'll need to fix up those rows before trying again. +* Avoid data loss when merging compressed BRIN summaries in `brin_bloom_union()` (Tomas Vondra) [§](https://postgr.es/c/6be02bbc8) + + The code failed to account for decompression results not being identical to the input objects, which would result in failure to add some of the data to the merged summary, leading to missed rows in index searches. + + This mistake was present back to v14 where BRIN bloom indexes were introduced, but this code path was only rarely reached then. It's substantially more likely to be hit in v17 because parallel index builds now use the code. +* Fix unexpected “attribute has wrong type” errors in `UPDATE`, `DELETE`, and `MERGE` queries that use whole-row table references to views or functions in `FROM` (Tom Lane) [§](https://postgr.es/c/d3a29ae6a) [§](https://postgr.es/c/584f17a90) [§](https://postgr.es/c/1a20bc946) +* Prevent failure in `INSERT` commands when the table has a `GENERATED` column of a domain data type and the domain's constraints disallow null values (Jian He) [§](https://postgr.es/c/4604928ed) + + Constraint failure was reported even if the generation expression produced a perfectly okay result. +* Correctly process references to outer CTE names that appear within a `WITH` clause attached to an `INSERT`/`UPDATE`/`DELETE`/`MERGE` command that's inside `WITH` (Tom Lane) [§](https://postgr.es/c/754a3d82d) + + The parser failed to detect disallowed recursion cases, nor did it account for such references when sorting CTEs into a usable order. +* Fix `ARRAY(subquery)` and `ARRAY[expression, ...]` constructs to produce sane results when the input is of type `int2vector` or `oidvector` (Tom Lane) [§](https://postgr.es/c/f7ae51312) + + This patch restores the behavior that existed before PostgreSQL 9.5: the result is of type `int2vector[]` or `oidvector[]`. +* Fix possible erroneous reports of invalid affixes while parsing Ispell dictionaries (Jacob Brazeal) [§](https://postgr.es/c/da85544ae) +* Fix `ALTER TABLE ADD COLUMN` to correctly handle the case of a domain type that has a default (Jian He, Tom Lane, Tender Wang) [§](https://postgr.es/c/c75c830e2) [§](https://postgr.es/c/d31d39cfe) + + If a domain type has a default, adding a column of that type (without any explicit `DEFAULT` clause) failed to install the domain's default value in existing rows, instead leaving the new column null. +* Improve the error message for disallowed attempts to alter the properties of a foreign key constraint (Álvaro Herrera) [§](https://postgr.es/c/931a1c023) +* Avoid error when resetting the `relhassubclass` flag of a temporary table that's marked `ON COMMIT DELETE ROWS` (Noah Misch) [§](https://postgr.es/c/a61b67cd0) +* Fix planner's failure to identify more than one hashable ScalarArrayOpExpr subexpression within a top-level expression (David Geier) [§](https://postgr.es/c/b68f664bb) + + This resulted in unnecessarily-inefficient execution of any additional subexpressions that could have been processed with a hash table (that is, `IN`, `NOT IN`, or `= ANY` clauses with all-constant right-hand sides). +* Disable “skip fetch” optimization in bitmap heap scan (Matthias van de Meent) [§](https://postgr.es/c/4934d3875) + + It turns out that this optimization can result in returning dead tuples when a concurrent vacuum marks a page all-visible. +* Fix performance issues in GIN index search startup when there are many search keys (Tom Lane, Vinod Sridharan) [§](https://postgr.es/c/e2a6934a8) [§](https://postgr.es/c/1b47a112a) + + An indexable clause with many keys (for example, `jsonbcol ?| array[...]` with tens of thousands of array elements) took O(N2) time to start up, and was uncancelable for that interval too. +* Detect missing support procedures in a BRIN index operator class, and report an error instead of crashing (Álvaro Herrera) [§](https://postgr.es/c/5144e1f8f) +* Respond to interrupts (such as query cancel) while waiting for asynchronous subplans of an Append plan node (Heikki Linnakangas) [§](https://postgr.es/c/d2fb076be) + + Previously, nothing would happen until one of the subplans becomes ready. +* Fix race condition in handling of `synchronous_standby_names` immediately after startup (Melnikov Maksim, Michael Paquier) [§](https://postgr.es/c/873aff945) + + For a short period after system startup, backends might fail to wait for synchronous commit even though `synchronous_standby_names` is enabled. +* Fix `pg_strtof()` to not crash with null endptr (Alexander Lakhin, Tom Lane) [§](https://postgr.es/c/76fbb38ef) +* Avoid crash when a Snowball stemmer encounters an out-of-memory condition (Maksim Korotkov) [§](https://postgr.es/c/8388cae55) +* Skip WAL recycling and preallocation during archive recovery, to avoid corruption of WAL files that were restored from the archive (Noah Misch, Arun Thirupathi) [§](https://postgr.es/c/3635a0a35) [§](https://postgr.es/c/014a50800) [§](https://postgr.es/c/675b771ca) [§](https://postgr.es/c/b494640e8) [§](https://postgr.es/c/8967dddf0) [§](https://postgr.es/c/6b168c129) [§](https://postgr.es/c/47d2d2982) + + This change back-patches v15-era fixes that were considered largely cosmetic at the time, but turn out to prevent data corruption in the wake of subsequent fixes. +* Prevent over-advancement of catalog xmin in “fast forward” mode of logical decoding (Zhijie Hou) [§](https://postgr.es/c/1f63b3626) + + This mistake could allow deleted catalog entries to be vacuumed away even though they were still potentially needed by the WAL-reading process. +* Avoid data loss when DDL operations that don't take a strong lock affect tables that are being logically replicated (Shlok Kyal, Hayato Kuroda) [§](https://postgr.es/c/0434033e8) [§](https://postgr.es/c/bb1bc9fa9) + + The catalog changes caused by the DDL command were not reflected into WAL-decoding processes, allowing them to decode subsequent changes using stale catalog data, probably resulting in data corruption. +* Avoid duplicate snapshot creation in logical replication index lookups (Heikki Linnakangas) [§](https://postgr.es/c/2ef048855) [§](https://postgr.es/c/136e68b46) +* Fix assertion failure in snapshot building (Masahiko Sawada) [§](https://postgr.es/c/7be51eb4e) +* Fix overly-strict assertion in `gistFindCorrectParent()` (Heikki Linnakangas) [§](https://postgr.es/c/a749c6f18) +* Fix rare assertion failure in standby servers when the primary is restarted (Heikki Linnakangas) [§](https://postgr.es/c/66235baab) +* In PL/pgSQL, avoid “unexpected plan node type” error when a scrollable cursor is defined on a simple `SELECT expression` query (Andrei Lepikhov) [§](https://postgr.es/c/c196c610b) +* Don't try to drop individual index partitions in pg\_dump's `--clean` mode (Jian He) [§](https://postgr.es/c/148cc0105) + + The server rejects such `DROP` commands. That has no real consequences, since the partitions will go away anyway in the subsequent `DROP`s of either their parent tables or their partitioned index. However, the error reported for the attempted drop causes problems when restoring in `--single-transaction` mode. +* In pg\_dumpall, avoid emitting invalid role `GRANT` commands if `pg_auth_members` contains invalid role OIDs (Tom Lane) [§](https://postgr.es/c/ce1475acd) + + Instead, print a warning and skip the entry. This copes better with catalog corruption that has been seen to occur in back branches as a result of race conditions between `GRANT` and `DROP ROLE`. +* In pg\_amcheck and pg\_upgrade, use the correct function to free allocations made by libpq (Michael Paquier, Ranier Vilela) [§](https://postgr.es/c/35a591a04) + + These oversights could result in crashes in certain Windows build configurations, such as a debug build of libpq used by a non-debug build of the calling application. +* Allow `contrib/dblink` queries to be interrupted by query cancel (Noah Misch) [§](https://postgr.es/c/a8a918937) [§](https://postgr.es/c/aa435d7c4) + + This change back-patches a v17-era fix. It prevents possible hangs in `CREATE DATABASE` and `DROP DATABASE` due to failure to detect deadlocks. +* Avoid crashing with corrupt input data in `contrib/pageinspect`'s `heap_page_items()` (Dmitry Kovalenko) [§](https://postgr.es/c/3c2ea65bd) +* Prevent assertion failure in `contrib/pg_freespacemap`'s `pg_freespacemap()` (Tender Wang) [§](https://postgr.es/c/5ff827389) + + Applying `pg_freespacemap()` to a relation lacking storage (such as a view) caused an assertion failure, although there was no ill effect in non-assert builds. Add an error check to reject that case. +* Fix build failure on macOS 15.4 (Tom Lane, Peter Eisentraut) [§](https://postgr.es/c/71790aef1) + + This macOS update broke our configuration probe for `strchrnul()`. +* Update time zone data files to tzdata release 2025b for DST law changes in Chile, plus historical corrections for Iran (Tom Lane) [§](https://postgr.es/c/fa4244a43) + + There is a new time zone America/Coyhaique for Chile's Aysén Region, to account for it changing to UTC-03 year-round and thus diverging from America/Santiago. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-14-19.html "E.2. Release 14.19") | [Up](release.html "Appendix E. Release Notes") | [Next](release-14-17.html "E.4. Release 14.17") | +| E.2. Release 14.19 | [Home](index.html "PostgreSQL 14.20 Documentation") | E.4. Release 14.17 | + +[Previous](/docs/release/14.17/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/14.19/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1419.md b/corpus/changelog/postgresql_releases/postgresql_1419.md new file mode 100644 index 0000000000000000000000000000000000000000..4b9afc37012bc629c4a8669489b10ffc01468537 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1419.md @@ -0,0 +1,185 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.19/ +Version: 14.19 + +## PostgreSQL 14.19 + +| E.2. Release 14.19 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-14-20.html "E.1. Release 14.20") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-14-18.html "E.3. Release 14.18") | + +--- + +## E.2. Release 14.19 + +[E.2.1. Migration to Version 14.19](release-14-19.html#id-1.11.6.7.4) + +[E.2.2. Changes](release-14-19.html#id-1.11.6.7.5) + +**Release date:**2025-08-14 + +This release contains a variety of fixes from 14.18. For information about new features in major release 14, see [Section E.21](release-14.html "E.21. Release 14"). + +### E.2.1. Migration to Version 14.19 + +A dump/restore is not required for those running 14.X. + +However, if you have any BRIN `numeric_minmax_multi_ops` indexes, it is advisable to reindex them after updating. See the fourth changelog entry below. + +Also, if you are upgrading from a version earlier than 14.18, see [Section E.3](release-14-18.html "E.3. Release 14.18"). + +### E.2.2. Changes + +* Tighten security checks in planner estimation functions (Dean Rasheed) [§](https://postgr.es/c/afe38fb6a) + + The fix for CVE-2017-7484, plus followup fixes, intended to prevent leaky functions from being applied to statistics data for columns that the calling user does not have permission to read. Two gaps in that protection have been found. One gap applies to partitioning and inheritance hierarchies where RLS policies on the tables should restrict access to statistics data, but did not. + + The other gap applies to cases where the query accesses a table via a view, and the view owner has permissions to read the underlying table but the calling user does not have permissions on the view. The view owner's permissions satisfied the security checks, and the leaky function would get applied to the underlying table's statistics before we check the calling user's permissions on the view. This has been fixed by making security checks on views occur at the start of planning. That might cause permissions failures to occur earlier than before. + + The PostgreSQL Project thanks Dean Rasheed for reporting this problem. (CVE-2025-8713) +* Prevent pg\_dump scripts from being used to attack the user running the restore (Nathan Bossart) [§](https://postgr.es/c/e4998d089) [§](https://postgr.es/c/8967c33c6) + + Since dump/restore operations typically involve running SQL commands as superuser, the target database installation must trust the source server. However, it does not follow that the operating system user who executes psql to perform the restore should have to trust the source server. The risk here is that an attacker who has gained superuser-level control over the source server might be able to cause it to emit text that would be interpreted as psql meta-commands. That would provide shell-level access to the restoring user's own account, independently of access to the target database. + + To provide a positive guarantee that this can't happen, extend psql with a `\restrict` command that prevents execution of further meta-commands, and teach pg\_dump to issue that before any data coming from the source server. + + The PostgreSQL Project thanks Martin Rakhmanov, Matthieu Denais, and RyotaK for reporting this problem. (CVE-2025-8714) +* Convert newlines to spaces in names included in comments in pg\_dump output (Noah Misch) [§](https://postgr.es/c/0f5838438) + + Object names containing newlines offered the ability to inject arbitrary SQL commands into the output script. (Without the preceding fix, injection of psql meta-commands would also be possible this way.) CVE-2012-0868 fixed this class of problem at the time, but later work reintroduced several cases. + + The PostgreSQL Project thanks Noah Misch for reporting this problem. (CVE-2025-8715) +* Fix incorrect distance calculation in BRIN `numeric_minmax_multi_ops` support function (Peter Eisentraut, Tom Lane) [§](https://postgr.es/c/5b0c8e328) + + The results were sometimes wrong on 64-bit platforms, and wildly wrong on 32-bit platforms. This did not produce obvious failures because the logic is only used to choose how to merge values into ranges; at worst the index would become inefficient and bloated. Nonetheless it's recommended to reindex any BRIN indexes that use the `numeric_minmax_multi_ops` operator class. +* Avoid regression in the size of XML input that we will accept (Michael Paquier, Erik Wienhold) [§](https://postgr.es/c/0395464af) [§](https://postgr.es/c/cdcdabce5) + + Our workaround for a bug in early 2.13.x releases of libxml2 made use of a code path that rejects text chunks exceeding 10MB, whereas the previous coding did not. Those early releases are presumably extinct in the wild by now, so revert to the previous coding. +* Allow tables with statement-level triggers to become partitions or inheritance children (Etsuro Fujita) [§](https://postgr.es/c/73eb6afa1) + + We do not allow partitions or inheritance child tables to have row-level triggers with transition tables, because an operation on the whole inheritance tree would need to maintain a separate transition table for each such child table. But that problem does not apply for statement-level triggers, because only the parent's statement-level triggers will be fired. The code that checks whether an existing table can become a partition or inheritance child nonetheless rejected both kinds of trigger. +* Disallow collecting transition tuples from child foreign tables (Etsuro Fujita) [§](https://postgr.es/c/e94fc1a8a) + + We do not support triggers with transition tables on foreign tables. However, the case of a partition or inheritance child that is a foreign table was overlooked. If the parent has such a trigger, incorrect transition tuples were collected from the foreign child. Instead throw an error, reporting that the case is not supported. +* Fix a potential deadlock during `ALTER SUBSCRIPTION ... DROP PUBLICATION` (Ajin Cherian) [§](https://postgr.es/c/41fb3f51c) + + Ensure that server processes acquire catalog locks in a consistent order during replication origin drops. +* Shorten the race condition window for creating indexes with conflicting names (Tom Lane) [§](https://postgr.es/c/27af8b9be) + + When choosing an auto-generated name for an index, avoid conflicting with not-yet-committed `pg_class` rows as well as fully-valid ones. This avoids possibly choosing the same name as some concurrent `CREATE INDEX` did, when that command is still in process of filling its index, or is done but is part of a not-yet-committed transaction. There's still a window for trouble, but it's only as long as the time needed to validate a new index's parameters and insert its `pg_class` row. +* Prevent usage of incorrect `VACUUM` options in some cases where multiple tables are vacuumed in a single command (Nathan Bossart, Michael Paquier) [§](https://postgr.es/c/c079ba3fc) + + The `TRUNCATE` and `INDEX_CLEANUP` options of one table could be applied to others. +* Fix processing of character classes within `SIMILAR TO` regular expressions (Laurenz Albe) [§](https://postgr.es/c/1fe15d25e) [§](https://postgr.es/c/0c09922c0) + + The code that translates `SIMILAR TO` pattern matching expressions to POSIX-style regular expressions did not consider that square brackets can be nested. For example, in a pattern like `[[:alpha:]%_]`, the code treated the `%` and `_` characters as metacharacters when they should be literals. +* When deparsing queries, always add parentheses around the expression in `FETCH FIRST expression ROWS WITH TIES` clauses (Heikki Linnakangas) [§](https://postgr.es/c/0420b24fe) + + This avoids some cases where the deparsed result wasn't syntactically valid. +* Limit the checkpointer process's fsync request queue size (Alexander Korotkov, Xuneng Zhou) [§](https://postgr.es/c/50026136c) [§](https://postgr.es/c/c5d66fc12) + + With very large `shared_buffers` settings, it was possible for the checkpointer to attempt to allocate more than 1GB for fsync requests, leading to failure and an infinite loop. Clamp the queue size to prevent this scenario. +* Avoid infinite wait in logical decoding when reading a partially-written WAL record (Vignesh C) [§](https://postgr.es/c/bedfdb85b) + + If the server crashes after writing the first part of a WAL record that would span multiple pages, subsequent logical decoding of the WAL stream would wait for data to arrive on the next WAL page. That might never happen if the server is now idle. +* Fix inconsistent quoting of role names in ACL strings (Tom Lane) [§](https://postgr.es/c/ac8cdb249) + + The previous quoting rule was locale-sensitive, which could lead to portability problems when transferring `aclitem` values across installations. (pg\_dump does not do that, but other tools might.) To ensure consistency, always quote non-ASCII characters in `aclitem` output; but to preserve backward compatibility, never require that they be quoted during `aclitem` input. +* Reject equal signs (`=`) in the names of relation options and foreign-data options (Tom Lane) [§](https://postgr.es/c/eb4234647) + + There's no evident use-case for option names like this, and allowing them creates ambiguity in the stored representation. +* Avoid a rare scenario where a btree index scan could mark the wrong index entries as dead (Peter Geoghegan) [§](https://postgr.es/c/7c7c0a77d) +* Avoid re-distributing cache invalidation messages from other transactions during logical replication (vignesh C) [§](https://postgr.es/c/983b36362) + + Our previous round of minor releases included a bug fix to ensure that replication receiver processes would respond to cross-process cache invalidation messages, preventing them from using stale catalog data while performing replication updates. However, the fix unintentionally made them also redistribute those messages again, leading to an exponential increase in the number of invalidation messages, which would often end in a memory allocation failure. Fix by not redistributing received messages. +* Avoid premature removal of old WAL during checkpoints (Vitaly Davydov) [§](https://postgr.es/c/e2832bd96) + + If a replication slot's restart point is advanced while a checkpoint is in progress, no-longer-needed WAL segments could get removed too soon, leading to recovery failure if the database crashes immediately afterwards. Fix by keeping them for one additional checkpoint cycle. +* Never move a replication slot's confirmed-flush position backwards (Shveta Malik) [§](https://postgr.es/c/e68459489) + + In some cases a replication client could acknowledge an LSN that's past what it has stored persistently, and then perhaps send an older LSN after a restart. We consider this not-a-bug so long as the client did not have anything it needed to do for the WAL between the two points. However, we should not re-send that WAL for fear of data duplication, so make sure we always believe the latest confirmed LSN for a given slot. +* Allow waiting for a transaction on a standby server to be interrupted (Kevin K Biju) [§](https://postgr.es/c/9130d8eee) + + Creation of a replication slot on a standby server may require waiting for some active transaction(s) to finish on the primary and then be replayed on the standby. Since that could be an indefinite wait, it's desirable to allow the operation to be cancelled, but there was no check for query cancel in the loop. +* Fix some places that might try to fetch toasted fields of system catalogs without any snapshot (Nathan Bossart) [§](https://postgr.es/c/b65be6ef0) + + This could result in an assertion failure or “cannot fetch toast data without an active snapshot” error. +* Avoid assertion failure during cross-table constraint updates (Tom Lane, Jian He) [§](https://postgr.es/c/25cab4473) [§](https://postgr.es/c/e902f8181) +* Remove faulty assertion that a command tag must have been determined by the end of `PortalRunMulti()` (Álvaro Herrera) [§](https://postgr.es/c/b9a896828) + + This failed in edge cases such as an empty prepared statement. +* Restore the ability to run PL/pgSQL expressions in parallel (Dipesh Dhameliya) [§](https://postgr.es/c/602c91cf2) + + PL/pgSQL's notion of an “expression” is very broad, encompassing any SQL `SELECT` query that returns a single column and no more than one row. So there are cases, for example evaluation of an aggregate function, where the query involves significant work and it'd be useful to run it with parallel workers. This used to be possible, but a previous bug fix unintentionally disabled it. +* Fix edge-case resource leaks in PL/Python error reporting (Tom Lane) [§](https://postgr.es/c/31a3a15fa) [§](https://postgr.es/c/d4556f592) + + An out-of-memory failure while reporting an error from Python could result in failure to drop reference counts on Python objects, leading to session-lifespan memory leakage. +* Fix libpq's `PQport()` function to never return NULL unless the passed connection is NULL (Daniele Varrazzo) [§](https://postgr.es/c/d5cba7746) + + This is the documented behavior, but recent libpq versions would return NULL in some cases where the user had not provided a port specification. Revert to our historical behavior of returning an empty string in such cases. (v18 and later will return the compiled-in default port number, typically `"5432"`, instead.) +* Avoid failure when GSSAPI authentication requires packets larger than 16kB (Jacob Champion, Tom Lane) [§](https://postgr.es/c/a7da7914c) + + Larger authentication packets are needed for Active Directory users who belong to many AD groups. This limitation manifested in connection failures with unintelligible error messages, typically “GSSAPI context establishment error: The routine must be called again to complete its function: Unknown error”. +* Fix timing-dependent failures in SSL and GSSAPI data transmission (Tom Lane) [§](https://postgr.es/c/0703c9385) + + When using SSL or GSSAPI encryption in non-blocking mode, libpq sometimes failed with “SSL error: bad length” or “GSSAPI caller failed to retransmit all data needing to be retried”. +* Avoid null-pointer dereference during connection lookup in ecpg applications (Aleksander Alekseev) [§](https://postgr.es/c/408fe659a) + + The case could occur only if the application has some connections that are named and some that are not. +* Improve psql's tab completion for `COPY` and `\copy` options (Atsushi Torikoshi) [§](https://postgr.es/c/0514616f0) + + The same completions were offered for both `COPY FROM` and `COPY TO`, although some options are only valid for one case or the other. Distinguish these cases to provide more accurate suggestions. +* Ensure that pg\_dump dumps comments on domain constraints in a valid order (Jian He) [§](https://postgr.es/c/e04aca1c4) + + In some cases the comment command could appear before creation of the constraint. +* Ensure stable sort ordering in pg\_dump for all types of database objects (Noah Misch, Andreas Karlsson) [§](https://postgr.es/c/7ee7c1cd3) [§](https://postgr.es/c/25388fb2c) [§](https://postgr.es/c/7846f4709) + + pg\_dump sorts objects by their logical names before performing dependency-driven reordering. This sort did not account for the full unique key identifying certain object types such as rules and constraints, and thus it could produce dissimilar sort orders for logically-identical databases. That made it difficult to compare databases by diff'ing pg\_dump output, so improve the logic to ensure stable sort ordering in all cases. +* In pg\_upgrade, check for inconsistent inherited not-null constraints (Ali Akbar) [§](https://postgr.es/c/ea3386cc7) [§](https://postgr.es/c/94dc2b37b) [§](https://postgr.es/c/a00eb374c) [§](https://postgr.es/c/f9f6595e3) [§](https://postgr.es/c/ed2bb0cdd) [§](https://postgr.es/c/bef2c2a4e) + + PostgreSQL versions before 18 allow an inherited column not-null constraint to be dropped. However, this results in a schema that cannot be restored, leading to failure in pg\_upgrade. Detect such cases during pg\_upgrade's preflight checks to allow users to fix them before initiating the upgrade. +* Avoid assertion failure if `track_commit_timestamp` is enabled during initdb (Hayato Kuroda, Andy Fan) [§](https://postgr.es/c/b61ddcaf4) +* Avoid possible leak of the open connection during `contrib/dblink` connection establishment (Tom Lane) [§](https://postgr.es/c/2cd2222ca) + + In the rare scenario where we hit out-of-memory while inserting the new connection object into dblink's hashtable, the open connection would be leaked until end of session, leaving an idle session sitting on the remote server. +* Make `contrib/pg_prewarm` cope with very large `shared_buffers` settings (Daria Shanina) [§](https://postgr.es/c/a4b9707c4) + + Autoprewarm failed with a memory allocation error if `shared_buffers` was larger than about 50 million buffers (400GB). +* In `contrib/pg_stat_statements`, avoid leaving gaps in the set of parameter numbers used in a normalized query (Sami Imseih) [§](https://postgr.es/c/8a1459f62) +* Fix memory leakage in `contrib/postgres_fdw`'s DirectModify methods (Tom Lane) [§](https://postgr.es/c/4a07c0961) + + The `PGresult` holding the results of the remote modify command would be leaked for the rest of the session if the query fails between invocations of the DirectModify methods, which could happen when there's `RETURNING` data to process. +* Ensure that directories listed in configure's `--with-includes` and `--with-libraries` options are searched before system-supplied directories (Tom Lane) [§](https://postgr.es/c/2dee95bd0) + + A common reason for using these options is to allow a user-built version of some library to override the system-supplied version. However, that failed to work in some environments because of careless ordering of switches in the commands issued by the makefiles. +* Fix configure's checks for `__cpuid()` and `__cpuidex()` (Lukas Fittl, Michael Paquier) [§](https://postgr.es/c/60953d4cb) + + configure failed to detect these Windows-specific functions, so that they would not be used, leading to slower-than-necessary CRC computations since the availability of hardware instructions could not be verified. The practical impact of this error was limited, because production builds for Windows typically do not use the Autoconf toolchain. +* Fix build failure with `--with-pam` option on Solaris-based platforms (Tom Lane) [§](https://postgr.es/c/868b39a54) + + Solaris is inconsistent with other Unix platforms about the API for PAM authentication. This manifested as an “inconsistent pointer” compiler warning, which we never did anything about. But as of GCC 14 it's an error not warning by default, so fix it. +* Make our code portable to GNU Hurd (Michael Banck, Christoph Berg, Samuel Thibault) [§](https://postgr.es/c/71d71ac4d) + + Fix assumptions about `IOV_MAX` and `O_RDONLY` that don't hold on Hurd. +* Make our usage of `memset_s()` conform strictly to the C11 standard (Tom Lane) [§](https://postgr.es/c/a1e0e7076) + + This avoids compile failures on some platforms. +* Prevent uninitialized-value compiler warnings in JSONB comparison code (Tom Lane) [§](https://postgr.es/c/8254b7e33) +* Avoid deprecation warnings when building with libxml2 2.14 and later (Michael Paquier) [§](https://postgr.es/c/ac166b19a) +* Avoid problems when compiling `pg_locale.h` under C++ (John Naylor) [§](https://postgr.es/c/a4f891b96) + + PostgreSQL header files generally need to be wrapped in `extern "C" { ... }` in order to be included in extensions written in C++. This failed for `pg_locale.h` because of its use of libicu headers, but we can work around that by suppressing C++-only declarations in those headers. C++ extensions that want to use libicu's C++ APIs can do so by including the libicu headers ahead of `pg_locale.h`. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-14-20.html "E.1. Release 14.20") | [Up](release.html "Appendix E. Release Notes") | [Next](release-14-18.html "E.3. Release 14.18") | +| E.1. Release 14.20 | [Home](index.html "PostgreSQL 14.20 Documentation") | E.3. Release 14.18 | + +[Previous](/docs/release/14.18/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/14.20/) diff --git a/corpus/changelog/postgresql_releases/postgresql_142.md b/corpus/changelog/postgresql_releases/postgresql_142.md new file mode 100644 index 0000000000000000000000000000000000000000..458130046cbf12b9a91424acc55d68275e3a3eaf --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_142.md @@ -0,0 +1,183 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.2/ +Version: 14.2 + +## PostgreSQL 14.2 + +| E.19. Release 14.2 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-14-3.html "E.18. Release 14.3") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-14-1.html "E.20. Release 14.1") | + +--- + +## E.19. Release 14.2 + +[E.19.1. Migration to Version 14.2](release-14-2.html#id-1.11.6.24.4) + +[E.19.2. Changes](release-14-2.html#id-1.11.6.24.5) + +**Release date:**2022-02-10 + +This release contains a variety of fixes from 14.1. For information about new features in major release 14, see [Section E.21](release-14.html "E.21. Release 14"). + +### E.19.1. Migration to Version 14.2 + +A dump/restore is not required for those running 14.X. + +However, some bugs have been found that may have resulted in corrupted indexes, as explained in the first two changelog entries. If any of those cases apply to you, it's recommended to reindex possibly-affected indexes after updating. + +Also, if you are upgrading from a version earlier than 14.1, see [Section E.20](release-14-1.html "E.20. Release 14.1"). + +### E.19.2. Changes + +* Enforce standard locking protocol for TOAST table updates, to prevent problems with `REINDEX CONCURRENTLY` (Michael Paquier) [§](https://postgr.es/c/64ab21f0e) + + If applied to a TOAST table or TOAST table's index, `REINDEX CONCURRENTLY` tended to produce a corrupted index. This happened because sessions updating TOAST entries released their `ROW EXCLUSIVE` locks immediately, rather than holding them until transaction commit as all other updates do. The fix is to make TOAST updates hold the table lock according to the normal rule. Any existing corrupted indexes can be repaired by reindexing again. +* Fix corruption of HOT chains when a RECENTLY\_DEAD tuple changes state to fully DEAD during page pruning (Andres Freund) [§](https://postgr.es/c/dad1539ae) + + It was possible for `VACUUM` to remove a recently-dead tuple while leaving behind a redirect item that pointed to it. When the tuple's item slot is later re-used by some new tuple, that tuple would be seen as part of the pre-existing HOT chain, creating a form of index corruption. If this has happened, reindexing the table should repair the damage. However, this is an extremely low-probability scenario, so we do not recommend reindexing just on the chance that it might have happened. +* Fix crash in EvalPlanQual rechecks for tables with a mix of local and foreign partitions (Etsuro Fujita) [§](https://postgr.es/c/7b0cec2fa) [§](https://postgr.es/c/2a3958e4d) +* Fix dangling pointer in `COPY TO` (Bharath Rupireddy) [§](https://postgr.es/c/b30282fcc) + + This oversight could cause an incorrect error message or a crash after an error in `COPY`. +* Avoid null-pointer crash in `ALTER STATISTICS` when the statistics object is dropped concurrently (Tomas Vondra) [§](https://postgr.es/c/a192243c7) +* Correctly handle alignment padding when extracting a range from a multirange (Alexander Korotkov) [§](https://postgr.es/c/7615edd1d) + + This error could cause crashes when handling multiranges over variable-length data types. +* Fix over-optimistic use of hashing for anonymous `RECORD` data types (Tom Lane) [§](https://postgr.es/c/17da9d4c2) + + This prevents some cases of “could not identify a hash function for type record” errors. +* Fix incorrect plan creation for parallel single-child Append nodes (David Rowley) [§](https://postgr.es/c/357ff6615) + + In some cases the Append would be simplified away when it should not be, leading to wrong query results (duplicated rows). +* Fix index-only scan plans for cases where not all index columns can be returned (Tom Lane) [§](https://postgr.es/c/cabea571d) [§](https://postgr.es/c/d228af79d) + + If an index has both returnable and non-returnable columns, and one of the non-returnable columns is an expression using a table column that appears in a returnable index column, then a query using that expression could result in an index-only scan plan that attempts to read the non-returnable column, instead of recomputing the expression from the returnable column as intended. The non-returnable column would read as NULL, resulting in wrong query results. +* Fix Memoize plan nodes to handle subplans that use parameters coming from above the Memoize (David Rowley) [§](https://postgr.es/c/c2dc7b9e1) +* Fix Memoize plan nodes to work correctly with non-hashable join operators (David Rowley) [§](https://postgr.es/c/6c32c0977) +* Ensure that casting to an unspecified typmod generates a RelabelType node rather than a length-coercion function call (Tom Lane) [§](https://postgr.es/c/f9a8bc9f2) + + While the coercion function should do the right thing (nothing), this translation is undesirably inefficient. +* Fix checking of `anycompatible`-family data type matches (Tom Lane) [§](https://postgr.es/c/c025067f6) + + In some cases the parser would think that a function or operator with `anycompatible`-family polymorphic parameters matches a set of arguments that it really shouldn't match. In reported cases, that led to matching more than one operator to a call, leading to ambiguous-operator errors; but a failure later on is also possible. +* Fix WAL replay failure when database consistency is reached exactly at a WAL page boundary (Álvaro Herrera) [§](https://postgr.es/c/d24dac954) +* Fix startup of a physical replica to tolerate transaction ID wraparound (Abhijit Menon-Sen, Tomas Vondra) [§](https://postgr.es/c/fb2f8e534) + + If a replica server is started while the set of active transactions on the primary crosses a wraparound boundary (so that there are some newer transactions with smaller XIDs than older ones), the replica would fail with “out-of-order XID insertion in KnownAssignedXids”. The replica would retry, but could never get past that error. +* In logical replication, avoid double transmission of a child table's data (Hou Zhijie) [§](https://postgr.es/c/614b77d65) + + If a publication includes both child and parent tables, and has the `publish_via_partition_root` option set, subscribers uselessly initiated synchronization on both child and parent tables. Ensure that only the parent table is synchronized in such cases. +* Remove lexical limitations for SQL commands issued on a logical replication connection (Tom Lane) [§](https://postgr.es/c/1efcc5946) [§](https://postgr.es/c/ef9706bbc) + + The walsender process would fail for a SQL command containing an unquoted semicolon, or with dollar-quoted literals containing odd numbers of single or double quote marks, or when the SQL command starts with a comment. Moreover, faulty error recovery could lead to unexpected errors in later commands too. +* Ensure that replication origin timestamp is set while replicating a `ROLLBACK PREPARED` operation (Masahiko Sawada) [§](https://postgr.es/c/f2e1730ee) +* Fix possible loss of the commit timestamp for the last subtransaction of a transaction (Alex Kingsborough, Kyotaro Horiguchi) [§](https://postgr.es/c/84db5169d) +* Be sure to `fsync` the `pg_logical/mappings` subdirectory during checkpoints (Nathan Bossart) [§](https://postgr.es/c/2b7dbe4bd) + + On some filesystems this oversight could lead to losing logical rewrite status files after a system crash. +* Build extended statistics for partitioned tables (Justin Pryzby) [§](https://postgr.es/c/ea212bd95) + + A previous bug fix disabled building of extended statistics for old-style inheritance trees, but it also prevented building them for partitioned tables, which was an unnecessary restriction. This change allows `ANALYZE` to compute values for statistics objects for partitioned tables. (But note that autovacuum does not process partitioned tables as such, so you must periodically issue manual `ANALYZE` on the partitioned table if you want to maintain such statistics.) +* Ignore extended statistics for inheritance trees (Justin Pryzby) [§](https://postgr.es/c/2cc007fd0) + + Currently, extended statistics values are only computed locally for each table, not for entire inheritance trees. However the values were mistakenly consulted when planning queries across inheritance trees, possibly resulting in worse-than-default estimates. +* Disallow altering data type of a partitioned table's columns when the partitioned table's row type is used as a composite type elsewhere (Tom Lane) [§](https://postgr.es/c/f285d9583) + + This restriction has long existed for regular tables, but through an oversight it was not checked for partitioned tables. +* Disallow `ALTER TABLE ... DROP NOT NULL` for a column that is part of a replica identity index (Haiying Tang, Hou Zhijie) [§](https://postgr.es/c/e415916e2) + + The same prohibition already existed for primary key indexes. +* Correctly update cached table state during `ALTER TABLE ADD PRIMARY KEY USING INDEX` (Hou Zhijie) [§](https://postgr.es/c/3839e29c5) + + Concurrent sessions failed to update their opinion of whether the table has a primary key, possibly causing incorrect logical replication behavior. +* Correctly update cached table state when switching `REPLICA IDENTITY` index (Tang Haiying, Hou Zhijie) [§](https://postgr.es/c/232fd72a5) + + Concurrent sessions failed to update their opinion of which index is the replica identity one, possibly causing incorrect logical replication behavior. +* Fix failure of SP-GiST indexes when the indexed column's data type is binary-compatible with the declared input type of the operator class (Tom Lane) [§](https://postgr.es/c/6d07cbc50) + + Such cases should work, but failed with “compress method must be defined when leaf type is different from input type”. +* Allow parallel vacuuming and concurrent index building to be ignored while computing oldest xmin (Masahiko Sawada) [§](https://postgr.es/c/ead49ebc0) + + Non-parallelized instances of these operations were already ignored, but the logic did not work for parallelized cases. Holding back the xmin horizon has undesirable effects such as delaying vacuum cleanup. +* Fix memory leak when updating expression indexes (Peter Geoghegan) [§](https://postgr.es/c/41ee68a91) + + An `UPDATE` affecting many rows could consume significant amounts of memory. +* Avoid leaking memory during `REASSIGN OWNED BY` operations that reassign ownership of many objects (Justin Pryzby) [§](https://postgr.es/c/8f4b0200e) +* Improve performance of walsenders sending logical changes by avoiding unnecessary cache accesses (Hou Zhijie) [§](https://postgr.es/c/5ddfebded) +* Fix display of `cert` authentication method's options in `pg_hba_file_rules` view (Magnus Hagander) [§](https://postgr.es/c/4afae689e) + + The `cert` authentication method implies `clientcert=verify-full`, but the `pg_hba_file_rules` view incorrectly reported `clientcert=verify-ca`. +* Ensure that the session targeted by `pg_log_backend_memory_contexts()` sends its results only to the server's log (Fujii Masao) [§](https://postgr.es/c/6e7ee55e7) + + Previously, a sufficiently high setting of `client_min_messages` could result in the log message also being sent to the connected client. Since that client hadn't requested it, that would be surprising (and possibly a wire protocol violation). +* Fix display of whole-row variables appearing in `INSERT ... VALUES` rules (Tom Lane) [§](https://postgr.es/c/4aee39ddb) + + A whole-row variable would be printed as “var.\*”, but that allows it to be expanded to individual columns when the rule is reloaded, resulting in different semantics. Attach an explicit cast to prevent that, as we do elsewhere. +* When reverse-listing a SQL-standard function body, display function parameters appropriately within `INSERT ... SELECT` (Tom Lane) [§](https://postgr.es/c/5d5779aea) + + Previously, they'd come out as `$N` even when the parameter had a name. +* Fix one-byte buffer overrun when applying Unicode string normalization to an empty string (Michael Paquier) [§](https://postgr.es/c/b609db715) + + The practical impact of this is limited thanks to alignment considerations; but in debug builds, a warning was raised. +* Fix or remove some incorrect assertions (Simon Riggs, Michael Paquier, Alexander Lakhin) [§](https://postgr.es/c/f185f35a8) [§](https://postgr.es/c/f9db153c2) [§](https://postgr.es/c/8a22a40b2) [§](https://postgr.es/c/4be3e005e) + + These errors should affect only debug builds, not production. +* Fix race condition that could lead to failure to localize error messages that are reported early in multi-threaded use of libpq or ecpglib (Tom Lane) [§](https://postgr.es/c/f4ebf0dbe) +* Avoid calling `strerror` from libpq's `PQcancel` function (Tom Lane) [§](https://postgr.es/c/050949877) + + `PQcancel` is supposed to be safe to call from a signal handler, but `strerror` is not safe. The faulty usage only occurred in the unlikely event of failure to send the cancel message to the server, perhaps explaining the lack of reports. +* Make psql's `\password` command default to setting the password for `CURRENT_USER`, not the connection's original user name (Tom Lane) [§](https://postgr.es/c/99389cb66) + + This agrees with the documented behavior, and avoids probable permissions failure if `SET ROLE` or `SET SESSION AUTHORIZATION` has been done since the session began. To prevent confusion, the role name to be acted on is now included in the password prompt. +* Fix psql `\d` command's query for identifying parent triggers (Justin Pryzby) [§](https://postgr.es/c/3886785b4) + + The previous coding failed with “more than one row returned by a subquery used as an expression” if a partition had triggers and there were unrelated statement-level triggers of the same name on some parent partitioned table. +* Make psql's `\d` command sort a table's extended statistics objects by name not OID (Justin Pryzby) [§](https://postgr.es/c/f5bea8360) +* Fix psql's tab-completion of label values for enum types (Tom Lane) [§](https://postgr.es/c/d91d4338e) +* Fix failures on Windows when using the terminal as data source or destination (Dmitry Koval, Juan José Santamaría Flecha, Michael Paquier) [§](https://postgr.es/c/d2198b459) [§](https://postgr.es/c/5550a9c38) + + This affects psql's `\copy` command, as well as pg\_recvlogical with `-f -`. +* In psql and some other client programs, avoid trying to invoke `gettext()` from a control-C signal handler (Tom Lane) [§](https://postgr.es/c/4e8726566) + + While no reported failures have been traced to this mistake, it seems highly unlikely to be a safe thing to do. +* Allow canceling the initial password prompt in pg\_receivewal and pg\_recvlogical (Tom Lane, Nathan Bossart) [§](https://postgr.es/c/3bd7556bb) + + Previously it was impossible to terminate these programs via control-C while they were prompting for a password. +* Fix pg\_dump's dump ordering for user-defined casts (Tom Lane) [§](https://postgr.es/c/0fdf67476) + + In rare cases, the output script might refer to a user-defined cast before it had been created. +* Fix pg\_dump's `--inserts` and `--column-inserts` modes to handle tables containing both generated columns and dropped columns (Tom Lane) [§](https://postgr.es/c/aedc4600d) [§](https://postgr.es/c/72842a575) +* Fix possible mis-reporting of errors in pg\_dump and pg\_basebackup (Tom Lane) [§](https://postgr.es/c/53c4a580e) [§](https://postgr.es/c/6b413b41b) + + The previous code failed to check for errors from some kernel calls, and could report the wrong errno values in other cases. +* Fix results of index-only scans on `contrib/btree_gist` indexes on `char(N)` columns (Tom Lane) [§](https://postgr.es/c/043c1e1a7) + + Index-only scans returned column values with trailing spaces removed, which is not the expected behavior. That happened because that's how the data was stored in the index. This fix changes the code to store `char(N)` values with the expected amount of space padding. The behavior of such an index will not change immediately unless you `REINDEX` it; otherwise space-stripped values will be gradually replaced over time during updates. Queries that do not use index-only scan plans will be unaffected in any case. +* Fix edge cases in `postgres_fdw`'s handling of asynchronous queries (Etsuro Fujita) [§](https://postgr.es/c/d1cca9441) [§](https://postgr.es/c/700e8fe6d) + + These errors could lead to crashes or incorrect results when attempting to parallelize scans of foreign tables. +* Change configure to use Python's sysconfig module, rather than the deprecated distutils module, to determine how to build PL/Python (Peter Eisentraut, Tom Lane, Andres Freund) [§](https://postgr.es/c/803f0b173) + + With Python 3.10, this avoids configure-time warnings about distutils being deprecated and scheduled for removal in Python 3.12. Presumably, once 3.12 is out, `configure --with-python` would fail altogether. This future-proofing does come at a cost: sysconfig did not exist before Python 2.7, nor before 3.2 in the Python 3 branch, so it is no longer possible to build PL/Python against long-dead Python versions. +* Re-allow cross-compilation without OpenSSL (Tom Lane) [§](https://postgr.es/c/175edafd1) + + configure should assume that `/dev/urandom` will be available on the target system, but it failed instead. +* Fix PL/Perl compile failure on Windows with Perl 5.28 and later (Victor Wagner) [§](https://postgr.es/c/8484e3812) +* Fix PL/Python compile failure with Python 3.11 and later (Peter Eisentraut) [§](https://postgr.es/c/1cc13b83e) +* Add support for building with Visual Studio 2022 (Hans Buschmann) [§](https://postgr.es/c/0e681fa45) +* Allow the `.bat` wrapper scripts in our MSVC build system to be called without first changing into their directory (Anton Voloshin, Andrew Dunstan) [§](https://postgr.es/c/a7772e874) [§](https://postgr.es/c/156a846d9) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-14-3.html "E.18. Release 14.3") | [Up](release.html "Appendix E. Release Notes") | [Next](release-14-1.html "E.20. Release 14.1") | +| E.18. Release 14.3 | [Home](index.html "PostgreSQL 14.20 Documentation") | E.20. Release 14.1 | + +[Previous](/docs/release/14.1/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/14.3/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1420.md b/corpus/changelog/postgresql_releases/postgresql_1420.md new file mode 100644 index 0000000000000000000000000000000000000000..c536c1ee956767cb492ffbdf03853aa6b6beeb29 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1420.md @@ -0,0 +1,168 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.20/ +Version: 14.20 + +## PostgreSQL 14.20 + +| E.1. Release 14.20 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release.html "Appendix E. Release Notes") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-14-19.html "E.2. Release 14.19") | + +--- + +## E.1. Release 14.20 + +[E.1.1. Migration to Version 14.20](release-14-20.html#id-1.11.6.6.4) + +[E.1.2. Changes](release-14-20.html#id-1.11.6.6.5) + +**Release date:**2025-11-13 + +This release contains a variety of fixes from 14.19. For information about new features in major release 14, see [Section E.21](release-14.html "E.21. Release 14"). + +### E.1.1. Migration to Version 14.20 + +A dump/restore is not required for those running 14.X. + +However, if you are upgrading from a version earlier than 14.19, see [Section E.2](release-14-19.html "E.2. Release 14.19"). + +### E.1.2. Changes + +* Check for `CREATE` privileges on the schema in `CREATE STATISTICS` (Jelte Fennema-Nio) [§](https://postgr.es/c/95cce5669) + + This omission allowed table owners to create statistics in any schema, potentially leading to unexpected naming conflicts. + + The PostgreSQL Project thanks Jelte Fennema-Nio for reporting this problem. (CVE-2025-12817) +* Avoid integer overflow in allocation-size calculations within libpq (Jacob Champion) [§](https://postgr.es/c/96d2c7e96) + + Several places in libpq were not sufficiently careful about computing the required size of a memory allocation. Sufficiently large inputs could cause integer overflow, resulting in an undersized buffer, which would then lead to writing past the end of the buffer. + + The PostgreSQL Project thanks Aleksey Solovev of Positive Technologies for reporting this problem. (CVE-2025-12818) +* Further fix processing of character classes within `SIMILAR TO` regular expressions (Laurenz Albe) [§](https://postgr.es/c/f75ff1b14) + + The previous fix for translating `SIMILAR TO` pattern matching expressions to POSIX-style regular expressions broke a corner case that formerly worked: if there is an escape character right after the opening bracket and then a closing bracket right after the escape sequence (for example `[\w]`), the closing bracket was no longer seen as terminating the character class. +* Fix parsing of aggregate functions whose arguments contain a sub-select with a `FROM` reference to a CTE outside the aggregate function (Tom Lane) [§](https://postgr.es/c/31bf09632) + + Such a CTE reference must act like a outer-level column reference when determining the aggregate's semantic level; but it was not being accounted for, leading to obscure planner or executor errors. +* Fix “no relation entry for relid” errors in corner cases while estimating SubPlan costs (Richard Guo) [§](https://postgr.es/c/160ef51c8) +* Remove faulty assertion in btree index cleanup (Peter Geoghegan) [§](https://postgr.es/c/314004021) +* Fix possible infinite loop in GIN index scans with multiple scan conditions (Tom Lane) [§](https://postgr.es/c/4a593043e) + + GIN can handle scan conditions that can reject non-matching entries but are not useful for searching for relevant entries, for example a `tsquery` clause like `!term`. But such a condition must not be first in the array of scan conditions. The code failed to ensure that in all cases, with the result that a query having a mix of such conditions with normal conditions might work or not depending on the order in which the conditions were given in the query. +* Ensure that GIN index scans can be canceled (Tom Lane) [§](https://postgr.es/c/a7da746c1) + + Some code paths were capable of running for a long time without checking for interrupts. +* Ensure that BRIN autosummarization provides a snapshot for index expressions that need one (Álvaro Herrera) [§](https://postgr.es/c/f0ad41716) [§](https://postgr.es/c/65b0d1f74) + + Previously, autosummarization would fail for such indexes, and then leave placeholder index tuples behind, causing the index to bloat over time. +* Fix integer-overflow hazard in BRIN index scans when the table contains close to 232 pages (Sunil S) [§](https://postgr.es/c/eea24eb0a) + + This oversight could result in an infinite loop or scanning of unneeded table pages. +* Fix incorrect zero-extension of stored values in JIT-generated tuple deforming code (David Rowley) [§](https://postgr.es/c/e4316ec4d) + + When not using JIT, the equivalent code does sign-extension not zero-extension, leading to a different Datum representation of small integer data types. This inconsistency was masked in most cases, but it is known to lead to “could not find memoization table entry” errors when using Memoize plan nodes, and there might be other symptoms. +* Add missing EvalPlanQual rechecks for TID Scan and TID Range Scan plan nodes (Sophie Alpert, David Rowley) [§](https://postgr.es/c/f78a69034) [§](https://postgr.es/c/2eb7ea97d) + + This omission led to possibly not rechecking a condition on `ctid` during concurrent-update situations, causing the update's behavior to vary depending on which plan type had been selected. +* Fix EvalPlanQual handling of foreign or custom joins that do not have an alternative local-join plan prepared for EPQ (Masahiko Sawada, Etsuro Fujita) [§](https://postgr.es/c/24e74b962) + + In such cases the foreign or custom access method should be invoked normally, but that did not happen, typically leading to a crash. +* Avoid duplicating hash partition constraints during `DETACH CONCURRENTLY` (Haiyang Li) [§](https://postgr.es/c/b753be38a) + + `ALTER TABLE DETACH PARTITION CONCURRENTLY` was written to add a copy of the partitioning constraint to the now-detached partition. This was misguided, partially because non-concurrent `DETACH` doesn't do that, but mostly because in the case of hash partitioning the constraint expression contains references to the parent table's OID. That causes problems during dump/restore, or if the parent table is dropped after `DETACH`. In v19 and later, we'll no longer create any such copied constraints at all. In released branches, to minimize the risk of unforeseen consequences, only skip adding a copied constraint if it is for hash partitioning. +* Disallow generated columns in partition keys (Jian He, Ashutosh Bapat) [§](https://postgr.es/c/04345d7a4) + + This was already not allowed, but the check missed some cases, such as where the column reference is implicit in a whole-row reference. +* Disallow generated columns in `COPY ... FROM ... WHERE` clauses (Peter Eisentraut, Jian He) [§](https://postgr.es/c/ccfe28eb4) + + Previously, incorrect behavior or an obscure error message resulted from attempting to reference such a column, since generated columns have not yet been computed at the point where `WHERE` filtering is done. +* Fix visibility checking for statistics objects in `pg_temp` (Noah Misch) [§](https://postgr.es/c/5816baa9b) + + A statistics object located in a temporary schema cannot be named without schema qualification, but `pg_statistics_obj_is_visible()` missed that memo and could return “true” regardless. In turn, functions such as `pg_describe_object()` could fail to schema-qualify the object's name as expected. +* Fix memory leakage in hashed subplans (Haiyang Li) [§](https://postgr.es/c/5eab9b0a4) + + Any memory consumed by the hash functions used for hashing tuples constituted a query-lifespan memory leak. One way that could happen is if the values being hashed require de-toasting. +* Add missing replica identity checks in `MERGE` and `INSERT ... ON CONFLICT DO UPDATE` (Zhijie Hou) [§](https://postgr.es/c/5fd569ef2) [§](https://postgr.es/c/ea65c8823) + + If `MERGE` may require update or delete actions, and the target table publishes updates or deletes, insist that it have a `REPLICA IDENTITY` defined. Failing to require this can silently break replication. Likewise, `INSERT` with an `UPDATE` option must require `REPLICA IDENTITY` if the target table publishes either inserts or updates. +* Avoid deadlock during `DROP SUBSCRIPTION` when publisher is on the same server as subscriber (Dilip Kumar) [§](https://postgr.es/c/ef7750274) +* Fix incorrect reporting of replication lag in `pg_stat_replication` view (Fujii Masao) [§](https://postgr.es/c/a7ab6ce6a) + + If any standby server's replay LSN stopped advancing, the `write_lag` and `flush_lag` columns would eventually stop updating. +* Avoid duplicative log messages about invalid `primary_slot_name` settings (Fujii Masao) [§](https://postgr.es/c/f106f53df) +* Remove the unfinished slot state file after failing to write a replication slot's state to disk (Michael Paquier) [§](https://postgr.es/c/f57f2760e) + + Previously, a failure such as out-of-disk-space resulted in leaving a temporary `state.tmp` file behind. That's problematic because it would block all subsequent attempts to write the state, requiring manual intervention to clean up. +* Avoid unwanted WAL receiver shutdown when switching from streaming to archive WAL source (Xuneng Zhou) [§](https://postgr.es/c/a1b8b3b2e) + + During a timeline change, a standby server's WAL receiver should remain alive, waiting for a new WAL streaming start point. Instead it was repeatedly shutting down and immediately getting restarted, which could confuse status monitoring code. +* Avoid failures in logical replication due to chance collisions of file numbers between regular and temporary tables (Vignesh C) [§](https://postgr.es/c/222130edd) + + This low-probability problem manifested as transient errors like “unexpected duplicate for tablespace *`X`*, relfilenode *`Y`*”. `contrib/autoprewarm` was also affected. A side-effect of the fix is that the SQL function `pg_filenode_relation()` will now ignore temporary tables. +* Avoid assertion failure when trying to release a replication slot in single-user mode (Hayato Kuroda) [§](https://postgr.es/c/32d388d00) +* Fix incorrect printing of messages about failures in checking whether the user has Windows administrator privilege (Bryan Green) [§](https://postgr.es/c/e91eb4ad6) + + This code would have crashed or at least printed garbage. No such cases have been reported though, indicating that failure of these system calls is extremely rare. +* Avoid startup failure on macOS and BSD platforms when there is a collision with a pre-existing semaphore set (Tom Lane) [§](https://postgr.es/c/b3d6e8b63) + + If the pre-existing set has fewer semaphores than we asked for, these platforms return EINVAL not EEXIST as our code expected, resulting in failure to start the database. +* Fix false memory-context-checking warnings in debug builds on 64-bit Windows (David Rowley) [§](https://postgr.es/c/86bd9497f) +* Correctly handle `GROUP BY DISTINCT` in PL/pgSQL assignment statements (Tom Lane) [§](https://postgr.es/c/0be39b4b1) + + The parser failed to record the `DISTINCT` option in this context, so that the command would act as if it were plain `GROUP BY`. +* Avoid leaking memory when handling a SQL error within PL/Python (Tom Lane) [§](https://postgr.es/c/7fb8c9240) + + This fixes a session-lifespan memory leak introduced in our previous minor releases. +* Fix libpq's trace output of characters with the high bit set (Ran Benita) [§](https://postgr.es/c/0cc540f0d) + + On platforms where `char` is considered signed, the output included unsightly `\xffffff` decoration. +* Fix libpq's handling of socket-related errors on Windows within its GSSAPI logic (Ning Wu, Tom Lane) [§](https://postgr.es/c/f46d77377) + + The code for encrypting/decrypting transmitted data using GSSAPI did not correctly recognize error conditions on the connection socket, since Windows reports those differently than other platforms. This led to failure to make such connections on Windows. +* In pg\_dump, dump security labels on subscriptions and event triggers (Jian He, Fujii Masao) [§](https://postgr.es/c/295c0a644) + + Labels on these types of objects were previously missed. +* Fix pg\_dump's sorting of default ACLs and foreign key constraints (Kirill Reshke, Álvaro Herrera) [§](https://postgr.es/c/4948bb9df) [§](https://postgr.es/c/22c6a44f0) [§](https://postgr.es/c/6062c3db3) + + Ensure consistent ordering of these database object types, as was already done for other object types. +* In pg\_dump, label comments for separately-dumped domain constraints with the proper dependency (Noah Misch) [§](https://postgr.es/c/85d6ed31f) + + This error could lead to parallel pg\_restore attempting to create the comment before the constraint itself has been restored. +* In pg\_restore, skip comments and security labels for publications and subscriptions that are not being restored (Jian He, Fujii Masao) [§](https://postgr.es/c/db900ec35) [§](https://postgr.es/c/bc476f8b8) + + Do not emit `COMMENT` or `SECURITY LABEL` commands for these objects when `--no-publications` or `--no-subscriptions` is specified. +* Fix assorted errors in the data compression logic in pg\_dump and pg\_restore (Daniel Gustafsson, Tom Lane) [§](https://postgr.es/c/40dc710a6) + + Error checking was missing or incorrect in several places, and there were also portability issues that would manifest on big-endian hardware. These problems had been missed because this code is only used to read compressed TOC files within directory-format dumps. pg\_dump never produces such a dump; the case can be reached only by manually compressing the TOC file after the fact, which is a supported thing to do but very uncommon. +* Fix pgbench to error out cleanly if a `COPY` operation is started (Anthonin Bonnefoy) [§](https://postgr.es/c/9b3beb7c6) + + pgbench doesn't intend to support this case, but previously it went into an infinite loop. +* Fix pgbench's reporting of multiple errors (Yugo Nagata) [§](https://postgr.es/c/cb21e1f92) + + In cases where two successive `PQgetResult` calls both fail, pgbench might report the wrong error message. +* Ensure that `contrib/pg_buffercache` functions can be canceled (Satyanarayana Narlapuram, Yuhang Qiu) [§](https://postgr.es/c/79643105a) + + Some code paths were capable of running for a long time without checking for interrupts. +* Fix `contrib/pg_prewarm`'s privilege checks for indexes (Ayush Vatsa, Nathan Bossart) [§](https://postgr.es/c/f146eb45c) + + `pg_prewarm()` requires `SELECT` privilege on relations to be prewarmed. However, since indexes have no SQL privileges of their own, this resulted in non-superusers being unable to prewarm indexes. Instead, check for `SELECT` privilege on the index's table. +* Make `contrib/pgstattuple` more robust about empty or invalid index pages (Nitin Motiani) [§](https://postgr.es/c/ee2dbcad0) + + Count all-zero pages as free space, and ignore pages that are invalid according to a check of the page's special-space size. The code for btree indexes already counted all-zero pages as free, but the hash and gist code would error out, which has been found to be much less user-friendly. Similarly, make all three cases agree on ignoring corrupted pages rather than throwing errors. +* Harden our read and write barrier macros to satisfy Clang (Thomas Munro) [§](https://postgr.es/c/d8ba910b0) + + We supposed that `__atomic_thread_fence()` is a sufficient barrier to prevent the C compiler from re-ordering memory accesses around it, but it appears that that's not true for Clang, allowing it to generate incorrect code for at least RISC-V, MIPS, and LoongArch machines. Add explicit compiler barriers to fix that. +* Fix building with LLVM version 21 and later (Holger Hoffstätte) [§](https://postgr.es/c/fbfc36e94) +* Fix PGXS build infrastructure to support building NLS `po` files for extensions (Ryo Matsumura) [§](https://postgr.es/c/56cd332f8) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release.html "Appendix E. Release Notes") | [Up](release.html "Appendix E. Release Notes") | [Next](release-14-19.html "E.2. Release 14.19") | +| Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | E.2. Release 14.19 | + +[Previous](/docs/release/14.19/) + +[Return to the Release Notes Archive](/docs/release/) diff --git a/corpus/changelog/postgresql_releases/postgresql_143.md b/corpus/changelog/postgresql_releases/postgresql_143.md new file mode 100644 index 0000000000000000000000000000000000000000..e0a4832a42b16ca2564b423715c2a64d1940454b --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_143.md @@ -0,0 +1,186 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.3/ +Version: 14.3 + +## PostgreSQL 14.3 + +| E.18. Release 14.3 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-14-4.html "E.17. Release 14.4") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-14-2.html "E.19. Release 14.2") | + +--- + +## E.18. Release 14.3 + +[E.18.1. Migration to Version 14.3](release-14-3.html#id-1.11.6.23.4) + +[E.18.2. Changes](release-14-3.html#id-1.11.6.23.5) + +**Release date:**2022-05-12 + +This release contains a variety of fixes from 14.2. For information about new features in major release 14, see [Section E.21](release-14.html "E.21. Release 14"). + +### E.18.1. Migration to Version 14.3 + +A dump/restore is not required for those running 14.X. + +However, if you have any GiST indexes on columns of type `ltree` (supplied by the `contrib/ltree` extension), you should re-index them after updating. See the second changelog entry below. + +Also, if you are upgrading from a version earlier than 14.2, see [Section E.19](release-14-2.html "E.19. Release 14.2"). + +### E.18.2. Changes + +* Confine additional operations within “security restricted operation” sandboxes (Sergey Shinderuk, Noah Misch) [§](https://postgr.es/c/ab49ce7c3) [§](https://postgr.es/c/677a49478) + + Autovacuum, `CLUSTER`, `CREATE INDEX`, `REINDEX`, `REFRESH MATERIALIZED VIEW`, and pg\_amcheck activated the “security restricted operation” protection mechanism too late, or even not at all in some code paths. A user having permission to create non-temporary objects within a database could define an object that would execute arbitrary SQL code with superuser permissions the next time that autovacuum processed the object, or that some superuser ran one of the affected commands against it. + + The PostgreSQL Project thanks Alexander Lakhin for reporting this problem. (CVE-2022-1552) +* Fix default signature length for `gist_ltree_ops` indexes (Tomas Vondra, Alexander Korotkov) [§](https://postgr.es/c/7d30f59da) + + The default signature length (hash size) for GiST indexes on `ltree` columns was accidentally changed while upgrading that operator class to support operator class parameters. If any operations had been done on such an index without first upgrading the `ltree` extension to version 1.2, they were done assuming that the signature length was 28 bytes rather than the intended 8. This means it is very likely that such indexes are now corrupt. For safety we recommend re-indexing all GiST indexes on `ltree` columns after installing this update. (Note that GiST indexes on `ltree[]` columns, that is arrays of `ltree`, are not affected.) +* Stop using query-provided column aliases for the columns of whole-row variables that refer to plain tables (Tom Lane) [§](https://postgr.es/c/1d072bd20) + + The column names in tuples produced by a whole-row variable (such as `tbl.*` in contexts other than the top level of a `SELECT` list) are now always those of the associated named composite type, if there is one. We'd previously attempted to make them track any column aliases that had been applied to the `FROM` entry the variable refers to. But that's semantically dubious, because really then the output of the variable is not at all of the composite type it claims to be. Previous attempts to deal with that inconsistency had bad results up to and including storing unreadable data on disk, so just give up on the whole idea. + + In cases where it's important to be able to relabel such columns, a workaround is to introduce an extra level of sub-`SELECT`, so that the whole-row variable is referring to the sub-`SELECT`'s output and not to a plain table. Then the variable is of type `record` to begin with and there's no issue. +* Fix incorrect roundoff when extracting epoch values from intervals (Peter Eisentraut) [§](https://postgr.es/c/7a8d8219c) + + The new `numeric`-based code for `EXTRACT()` failed to yield results equivalent to the old `float`-based code, as a result of accidentally truncating the `DAYS_PER_YEAR` value to an integer. +* Defend against `pg_stat_get_replication_slot(NULL)` (Andres Freund) [§](https://postgr.es/c/c1a0d7d1c) + + This function should be marked strict in the catalog data, but it was not in v14, so add a run-time check instead. +* Fix incorrect output for types `timestamptz` and `timetz` in `table_to_xmlschema()` and allied functions (Renan Soares Lopes) [§](https://postgr.es/c/ae8ec7feb) + + The xmlschema output for these types included a malformed regular expression. +* Avoid core dump in parser for a `VALUES` clause with zero columns (Tom Lane) [§](https://postgr.es/c/ab2f78392) +* Fix planner failure when a Result plan node appears immediately underneath an Append node (Etsuro Fujita) [§](https://postgr.es/c/ebb790241) + + Recently-added code to support asynchronous remote queries failed to handle this case, leading to crashes or errors about unrecognized node types. +* Fix planner failure if a query using `SEARCH` or `CYCLE` features contains a duplicate CTE name (Tom Lane, Kyotaro Horiguchi) [§](https://postgr.es/c/dff6c77fa) + + When the name of the recursive `WITH` query is re-used within itself, the planner could crash or report odd errors such as “could not find attribute 2 in subquery targetlist”. +* Fix planner errors for `GROUPING()` constructs that reference outer query levels (Richard Guo, Tom Lane) [§](https://postgr.es/c/48b6035f0) +* Fix plan generation for index-only scans on indexes with both returnable and non-returnable columns (Tom Lane) [§](https://postgr.es/c/277e744ae) + + The previous coding could try to read non-returnable columns in addition to the returnable ones. This was fairly harmless because it didn't actually do anything with the bogus values, but it fell foul of a recently-added error check that rejected such a plan. +* Avoid accessing a no-longer-pinned shared buffer while attempting to lock an outdated tuple during EvalPlanQual (Tom Lane) [§](https://postgr.es/c/c590e514a) + + The code would touch the buffer a couple more times after releasing its pin. In theory another process could recycle the buffer (or more likely, try to defragment its free space) as soon as the pin is gone, probably leading to failure to find the newer version of the tuple. +* Fix query-lifespan memory leak in an IndexScan node that is performing reordering (Aliaksandr Kalenik) [§](https://postgr.es/c/c76665edc) +* Fix `ALTER FUNCTION` to support changing a function's parallelism property and its `SET`-variable list in the same command (Tom Lane) [§](https://postgr.es/c/08a9e7a8c) + + The parallelism property change was lost if the same command also updated the function's `SET` clause. +* Tighten lookup of the index “owned by” a constraint (Tom Lane, Japin Li) [§](https://postgr.es/c/8dcd1c356) + + Some code paths mistook the index depended on by a foreign key constraint for one owned by a unique or primary key constraint, resulting in odd errors during certain `ALTER TABLE` operations on tables having foreign key constraints. +* Fix bogus errors from attempts to alter system columns of tables (Tom Lane) [§](https://postgr.es/c/e805735a8) + + The system should just tell you that you can't do it, but sometimes it would report “no owned sequence found” instead. +* Fix mis-sorting of table rows when `CLUSTER`ing using an index whose leading key is an expression (Peter Geoghegan, Thomas Munro) [§](https://postgr.es/c/e4521841a) + + The table would be rebuilt with the correct data, but in an order having little to do with the index order. +* Prevent data loss if a system crash occurs shortly after a sorted GiST index build (Heikki Linnakangas) [§](https://postgr.es/c/7d80e93fb) + + The code path for building GiST indexes using sorting neglected to `fsync` the file upon completion. This could result in a corrupted index if the operating system crashed shortly later. +* Fix risk of deadlock failures while dropping a partitioned index (Jimmy Yih, Gaurab Dey, Tom Lane) [§](https://postgr.es/c/05ccf974c) + + Ensure that the required table and index locks are taken in the standard order (parents before children, tables before indexes). The previous coding for `DROP INDEX` did it differently, and so could deadlock against concurrent queries taking these locks in the standard order. +* Fix race condition between `DROP TABLESPACE` and checkpointing (Nathan Bossart) [§](https://postgr.es/c/26e007939) + + The checkpoint forced by `DROP TABLESPACE` could sometimes fail to remove all dead files from the tablespace's directory, leading to a bogus “tablespace is not empty” error. +* Fix possible trouble in crash recovery after a `TRUNCATE` command that overlaps a checkpoint (Kyotaro Horiguchi, Heikki Linnakangas, Robert Haas) [§](https://postgr.es/c/bbace5697) [§](https://postgr.es/c/10520f434) + + `TRUNCATE` must ensure that the table's disk file is truncated before the checkpoint is allowed to complete. Otherwise, replay starting from that checkpoint might find unexpected data in the supposedly-removed pages, possibly causing replay failure. +* Fix unsafe toast-data accesses during temporary object cleanup (Andres Freund) [§](https://postgr.es/c/7bbfe5994) + + Temporary-object deletion during server process exit could fail with “FATAL: cannot fetch toast data without an active snapshot”. This was usually harmless since the next use of that temporary schema would clean up successfully. +* Re-allow underscore as the first character in a custom parameter name (Japin Li) [§](https://postgr.es/c/dd7c05979) + + Such names were unintentionally disallowed in v14. +* Add `regress` option for the `compute_query_id` parameter (Michael Paquier) [§](https://postgr.es/c/627c79a1e) + + This is intended to facilitate testing, by allowing query IDs to be computed but not shown in `EXPLAIN` output. +* Improve wait logic in RegisterSyncRequest (Thomas Munro) [§](https://postgr.es/c/1396b5c6e) + + If we run out of space in the checkpointer sync request queue (which is hopefully rare on real systems, but is common when testing with a very small buffer pool), we wait for it to drain. While waiting, we should report that as a wait event so that users know what is going on, and also watch for postmaster death, since otherwise the loop might never terminate if the checkpointer has already exited. +* Wake up for latch events when the checkpointer is waiting between writes (Thomas Munro) [§](https://postgr.es/c/78c0f85e4) [§](https://postgr.es/c/ea70f6945) + + This improves responsiveness to backends sending sync requests. The change also creates a proper wait event class for these waits. +* Fix “PANIC: xlog flush request is not satisfied” failure during standby promotion when there is a missing WAL continuation record (Sami Imseih) [§](https://postgr.es/c/caaeb88ff) +* Fix possibility of self-deadlock in hot standby conflict handling (Andres Freund) [§](https://postgr.es/c/9ab3b2bdb) [§](https://postgr.es/c/f74496dd6) [§](https://postgr.es/c/5ab8e8014) + + With unlucky timing, the WAL-applying process could get stuck while waiting for some other process to release a buffer lock. +* Fix possible mis-identification of the correct ancestor relation to publish logical replication changes through (Tomas Vondra, Hou zj, Amit Kapila) [§](https://postgr.es/c/677a1dc0c) + + If `publish_via_partition_root` is enabled, and there are multiple publications naming different ancestors of the currently-modified relation, the wrong ancestor might be chosen for reporting the change. +* Ensure that logical replication apply workers can be restarted even when we're up against the `max_sync_workers_per_subscription` limit (Amit Kapila) [§](https://postgr.es/c/c9dea58e2) + + Faulty coding of the limit check caused a restarted worker to exit immediately, leaving fewer workers than there should be. +* Include unchanged replica identity key columns in the WAL log for an update, if they are stored out-of-line (Dilip Kumar, Amit Kapila) [§](https://postgr.es/c/04645bbca) + + Otherwise subscribers cannot see the values and will fail to replicate the update. +* Cope correctly with platforms that have no support for altering the server process's display in ps(1) (Andrew Dunstan) [§](https://postgr.es/c/3f7a59c59) + + Few platforms are like this (the only supported one is Cygwin), so we'd managed not to notice that refactoring introduced a potential memory clobber. +* Make the server more robust against missed timer interrupts (Michael Harris, Tom Lane) [§](https://postgr.es/c/2e211c166) + + An optimization added in v14 meant that if a server process somehow missed a timer interrupt, it would never again ask the kernel for another one, thus breaking timeout detection for the remainder of the session. This seems unduly fragile, so add a recovery path. +* Disallow execution of SPI functions during PL/Perl function compilation (Tom Lane) [§](https://postgr.es/c/ac910bb23) + + Perl can be convinced to execute user-defined code during compilation of a PL/Perl function. However, it's not okay for such code to try to invoke SQL operations via SPI. That results in a crash, and if it didn't crash it would be a security hazard, because we really don't want code execution during function validation. Put in a check to give a friendlier error message instead. +* Make libpq accept root-owned SSL private key files (David Steele) [§](https://postgr.es/c/2a1f84636) [§](https://postgr.es/c/402279afe) + + This change synchronizes libpq's rules for safe ownership and permissions of SSL key files with the rules the server has used since release 9.6. Namely, in addition to the current rules, allow the case where the key file is owned by root and has permissions `rw-r-----` or less. This is helpful for system-wide management of key files. +* Fix behavior of libpq's `PQisBusy()` function after a connection failure (Tom Lane) [§](https://postgr.es/c/ae27b1acc) + + If we'd detected a write failure, `PQisBusy()` would always return true, which is the wrong thing: we want input processing to carry on normally until we've read whatever is available from the server. The practical effect of this error is that applications using libpq's async-query API would typically detect connection loss only when `PQconsumeInput()` returns a hard failure. With this fix, a connection loss will normally be reported via an error `PGresult` object, which is a much cleaner behavior for most applications. +* Re-allow *`database`*.*`schema`*.*`table`* patterns in psql, pg\_dump, and pg\_amcheck (Mark Dilger) [§](https://postgr.es/c/4a66300ac) [§](https://postgr.es/c/75a006bee) + + Versions before v14 silently ignored all but the *`schema`* and *`table`* fragments of a pattern containing more than one dot. Refactoring in v14 accidentally broke that use-case. Reinstate it, but now complain if the first fragment is not the name of the current database. +* Make pg\_ctl recheck postmaster aliveness while waiting for stop/restart/promote actions (Tom Lane) [§](https://postgr.es/c/1e8c5cf7c) + + pg\_ctl would verify that the postmaster is alive as a side-effect of sending the stop or promote signal, but then it just naively waited to see the on-disk state change. If the postmaster died uncleanly without having removed its PID file or updated the control file, pg\_ctl would wait until timeout. Instead make it recheck every so often that the postmaster process is still there. +* Fix error handling in pg\_waldump (Kyotaro Horiguchi, Andres Freund) [§](https://postgr.es/c/9ff7fd906) [§](https://postgr.es/c/6839aa7a6) + + While trying to read a WAL file to determine the WAL segment size, pg\_waldump would report an incorrect error for the case of a too-short file. In addition, the file name reported in this and related error messages could be garbage. +* Ensure that `contrib/pageinspect` functions cope with all-zero pages (Michael Paquier) [§](https://postgr.es/c/df6bbe73b) + + This is a legitimate edge case, but the module was mostly unprepared for it. Arrange to return nulls, or no rows, as appropriate; that seems more useful than raising an error. +* In `contrib/pageinspect`, add defenses against incorrect page “special space” contents, tighten checks for correct page size, and add some missing checks that an index is of the expected type (Michael Paquier, Justin Pryzby, Julien Rouhaud) [§](https://postgr.es/c/27d384441) [§](https://postgr.es/c/b61e6214c) [§](https://postgr.es/c/dc5b3bdae) + + These changes make it less likely that the module will crash on bad data. +* In `contrib/postgres_fdw`, disable batch insertion when `BEFORE INSERT ... FOR EACH ROW` triggers exist on the foreign table (Etsuro Fujita) [§](https://postgr.es/c/89d349b0a) + + Such a trigger might query the table it's on and expect to see previously-inserted rows. With batch insertion, those rows might not be visible yet, so disable the feature to avoid unexpected behavior. +* In `contrib/postgres_fdw`, verify that `ORDER BY` clauses are safe to ship before requesting a remotely-ordered query, and include a `USING` clause if necessary (Ronan Dunklau) [§](https://postgr.es/c/9f9489aa2) + + This fix prevents situations where the remote server might sort in a different order than we intend. While sometimes that would be only cosmetic, it could produce thoroughly wrong results if the remote data is used as input for a locally-performed merge join. +* Fix configure to handle platforms that have `sys/epoll.h` but not `sys/signalfd.h` (Tom Lane) [§](https://postgr.es/c/c23461a22) +* Update JIT code to work with LLVM 14 (Thomas Munro) [§](https://postgr.es/c/d9f7ad54e) +* Clean up assorted failures under clang's `-fsanitize=undefined` checks (Tom Lane, Andres Freund, Zhihong Yu) [§](https://postgr.es/c/b0bc196e5) [§](https://postgr.es/c/5c9d17e94) [§](https://postgr.es/c/81045e1e1) [§](https://postgr.es/c/89a94c24a) [§](https://postgr.es/c/e52e9bd57) + + Most of these changes are just for pro-forma compliance with the letter of the C and POSIX standards, and are unlikely to have any effect on production builds. +* Do not add OpenSSL dependencies to libpq's `pkg-config` file when building without OpenSSL (Fabrice Fontaine) [§](https://postgr.es/c/7a2789275) +* Fix PL/Perl so it builds on C compilers that don't support statements nested within expressions (Tom Lane) [§](https://postgr.es/c/e327291e4) +* Fix possible build failure of pg\_dumpall on Windows, when not using MSVC to build (Andres Freund) [§](https://postgr.es/c/2d608c960) +* In Windows builds, use gendef instead of pexports to build DEF files (Andrew Dunstan) [§](https://postgr.es/c/92f60f536) + + This adapts the build process to work on recent MSys tool chains. +* Prevent extra expansion of shell wildcard patterns in programs built under MinGW (Andrew Dunstan) [§](https://postgr.es/c/71f394667) + + For some reason the C library provided by MinGW will expand shell wildcard characters in a program's command-line arguments by default. This is confusing, not least because it doesn't happen under MSVC, so turn it off. +* Update time zone data files to tzdata release 2022a for DST law changes in Palestine, plus historical corrections for Chile and Ukraine. (Tom Lane) [§](https://postgr.es/c/77ee14ed9) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-14-4.html "E.17. Release 14.4") | [Up](release.html "Appendix E. Release Notes") | [Next](release-14-2.html "E.19. Release 14.2") | +| E.17. Release 14.4 | [Home](index.html "PostgreSQL 14.20 Documentation") | E.19. Release 14.2 | + +[Previous](/docs/release/14.2/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/14.4/) diff --git a/corpus/changelog/postgresql_releases/postgresql_144.md b/corpus/changelog/postgresql_releases/postgresql_144.md new file mode 100644 index 0000000000000000000000000000000000000000..626e96935d7dcd380bed932df1a636ab3117750f --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_144.md @@ -0,0 +1,91 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.4/ +Version: 14.4 + +## PostgreSQL 14.4 + +| E.17. Release 14.4 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-14-5.html "E.16. Release 14.5") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-14-3.html "E.18. Release 14.3") | + +--- + +## E.17. Release 14.4 + +[E.17.1. Migration to Version 14.4](release-14-4.html#id-1.11.6.22.4) + +[E.17.2. Changes](release-14-4.html#id-1.11.6.22.5) + +**Release date:**2022-06-16 + +This release contains a variety of fixes from 14.3. For information about new features in major release 14, see [Section E.21](release-14.html "E.21. Release 14"). + +### E.17.1. Migration to Version 14.4 + +A dump/restore is not required for those running 14.X. + +However, if you have any indexes that were created using the `CONCURRENTLY` option under 14.X, you should re-index them after updating. See the first changelog entry below. + +Also, if you are upgrading from a version earlier than 14.3, see [Section E.18](release-14-3.html "E.18. Release 14.3"). + +### E.17.2. Changes + +* Prevent possible corruption of indexes created or rebuilt with the `CONCURRENTLY` option (Álvaro Herrera) [§](https://postgr.es/c/042b584c7) + + An optimization added in v14 caused `CREATE INDEX ... CONCURRENTLY` and `REINDEX ... CONCURRENTLY` to sometimes miss indexing rows that were updated during the index build. Revert that optimization. It is recommended that any indexes made with the `CONCURRENTLY` option be rebuilt after installing this update. (Alternatively, rebuild them without `CONCURRENTLY`.) +* Harden Memoize plan node against non-deterministic equality functions (David Rowley) [§](https://postgr.es/c/cbcea3b91) + + Memoize could crash if a data type's equality or hash functions gave inconsistent results across different calls. Throw a runtime error instead. +* Fix incorrect cost estimates for Memoize plans (David Rowley) [§](https://postgr.es/c/23c2b76a8) + + This mistake could lead to Memoize being used when it isn't really the best plan, or to very long executor startup times due to initializing an overly-large hash table for a Memoize node. +* Fix queries in which a “whole-row variable” references the result of a function that returns a domain over composite type (Tom Lane) [§](https://postgr.es/c/77c1d92cb) +* Fix “variable not found in subplan target list” planner error when pulling up a sub-`SELECT` that's referenced in a `GROUPING` function (Richard Guo) [§](https://postgr.es/c/ac51c9fba) +* Prevent `pg_stat_get_subscription()` from possibly returning an extra row containing garbage values (Kuntal Ghosh) [§](https://postgr.es/c/5c3b5f7db) +* Fix `COPY FROM`'s error checking in the case where the database encoding is `SQL_ASCII` while the client's encoding is a multi-byte encoding (Heikki Linnakangas) [§](https://postgr.es/c/f82595ac9) + + This mistake could lead to false complaints of invalidly-encoded input data. +* Avoid crashing if too many column aliases are attached to an `XMLTABLE` or `JSON_TABLE` construct (Álvaro Herrera) [§](https://postgr.es/c/94edb85d2) [§](https://postgr.es/c/e8b93c6e2) +* When decompiling a view or rule, show a `SELECT` output column's `AS "?column?"` alias clause if it could be referenced elsewhere (Tom Lane) [§](https://postgr.es/c/6f7eec119) + + Previously, this auto-generated alias was always hidden; but there are corner cases where doing so results in a non-restorable view or rule definition. +* Report implicitly-created operator families to event triggers (Masahiko Sawada) [§](https://postgr.es/c/58b088a9b) + + If `CREATE OPERATOR CLASS` results in the implicit creation of an operator family, that object was not reported to event triggers that should capture such events. +* Fix control file updates made when a restartpoint is running during promotion of a standby server (Kyotaro Horiguchi) [§](https://postgr.es/c/6dced63b4) + + Previously, when the restartpoint completed it could incorrectly update the last-checkpoint fields of the control file, potentially leading to PANIC and failure to restart if the server crashes before the next normal checkpoint completes. +* Prevent triggering of standby's `wal_receiver_timeout` during logical replication of large transactions (Wang Wei, Amit Kapila) [§](https://postgr.es/c/d6da71fa8) + + If a large transaction on the primary server sends no data to the standby (perhaps because no table it changes is published), it was possible for the standby to timeout. Fix that by ensuring we send keepalive messages periodically in such situations. +* Prevent open-file leak when reading an invalid timezone abbreviation file (Kyotaro Horiguchi) [§](https://postgr.es/c/c47a55852) + + Such cases could result in harmless warning messages. +* Allow custom server parameters to have short descriptions that are NULL (Steve Chavez) [§](https://postgr.es/c/fe441a031) + + Previously, although extensions could choose to create such settings, some code paths would crash while processing them. +* Remove misguided SSL key file ownership check in libpq (Tom Lane) [§](https://postgr.es/c/b4be4a082) + + In the previous minor releases, we copied the server's permission checking rules for SSL private key files into libpq. But we should not have also copied the server's file-ownership check. While that works in normal use-cases, it can result in an unexpected failure for clients running as root, and perhaps in other cases. +* Ensure ecpg reports server connection loss sanely (Tom Lane) [§](https://postgr.es/c/a5dbca460) + + Misprocessing of a libpq-generated error result, such as a report of lost connection, would lead to printing “(null)” instead of a useful error message; or in older releases it would lead to a crash. +* Prevent crash after server connection loss in pg\_amcheck (Tom Lane) [§](https://postgr.es/c/32a85ee46) + + Misprocessing of a libpq-generated error result, such as a report of lost connection, would lead to a crash. +* Adjust PL/Perl test case so it will work under Perl 5.36 (Dagfinn Ilmari Mannsåker) [§](https://postgr.es/c/1072e4c45) +* Avoid incorrectly using an out-of-date libldap\_r library when multiple OpenLDAP installations are present while building PostgreSQL (Tom Lane) [§](https://postgr.es/c/12736e7dc) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-14-5.html "E.16. Release 14.5") | [Up](release.html "Appendix E. Release Notes") | [Next](release-14-3.html "E.18. Release 14.3") | +| E.16. Release 14.5 | [Home](index.html "PostgreSQL 14.20 Documentation") | E.18. Release 14.3 | + +[Previous](/docs/release/14.3/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/14.5/) diff --git a/corpus/changelog/postgresql_releases/postgresql_145.md b/corpus/changelog/postgresql_releases/postgresql_145.md new file mode 100644 index 0000000000000000000000000000000000000000..d927af1e75fca234b6c7527e3aa1cab2ea756252 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_145.md @@ -0,0 +1,137 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.5/ +Version: 14.5 + +## PostgreSQL 14.5 + +| E.16. Release 14.5 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-14-6.html "E.15. Release 14.6") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-14-4.html "E.17. Release 14.4") | + +--- + +## E.16. Release 14.5 + +[E.16.1. Migration to Version 14.5](release-14-5.html#id-1.11.6.21.4) + +[E.16.2. Changes](release-14-5.html#id-1.11.6.21.5) + +**Release date:**2022-08-11 + +This release contains a variety of fixes from 14.4. For information about new features in major release 14, see [Section E.21](release-14.html "E.21. Release 14"). + +### E.16.1. Migration to Version 14.5 + +A dump/restore is not required for those running 14.X. + +However, if you are upgrading from a version earlier than 14.4, see [Section E.17](release-14-4.html "E.17. Release 14.4"). + +### E.16.2. Changes + +* Do not let extension scripts replace objects not already belonging to the extension (Tom Lane) [§](https://postgr.es/c/5721da7e4) + + This change prevents extension scripts from doing `CREATE OR REPLACE` if there is an existing object that does not belong to the extension. It also prevents `CREATE IF NOT EXISTS` in the same situation. This prevents a form of trojan-horse attack in which a hostile database user could become the owner of an extension object and then modify it to compromise future uses of the object by other users. As a side benefit, it also reduces the risk of accidentally replacing objects one did not mean to. + + The PostgreSQL Project thanks Sven Klemm for reporting this problem. (CVE-2022-2625) +* Fix replay of `CREATE DATABASE` WAL records on standby servers (Kyotaro Horiguchi, Asim R Praveen, Paul Guo) [§](https://postgr.es/c/a3aacb7cb) [§](https://postgr.es/c/4d8d85740) [§](https://postgr.es/c/e90c4fc88) [§](https://postgr.es/c/9d5c96d9b) + + Standby servers may encounter missing tablespace directories when replaying database-creation WAL records. Prior to this patch, a standby would fail to recover in such a case; however, such directories could be legitimately missing. Create the tablespace (as a plain directory), then check that it has been dropped again once replay reaches a consistent state. +* Support “in place” tablespaces (Thomas Munro, Michael Paquier, Álvaro Herrera) [§](https://postgr.es/c/961cab0a5) [§](https://postgr.es/c/fee0165fc) [§](https://postgr.es/c/5ad478c9d) + + Normally a Postgres tablespace is a symbolic link to a directory on some other filesystem. This change allows it to just be a plain directory. While this has no use for separating tables onto different filesystems, it is a convenient setup for testing. Moreover, it is necessary to support the `CREATE DATABASE` replay fix, which transiently creates a missing tablespace as an “in place” tablespace. +* Fix permissions checks in `CREATE INDEX` (Nathan Bossart, Noah Misch) [§](https://postgr.es/c/ace997386) + + The fix for CVE-2022-1552 caused `CREATE INDEX` to apply the table owner's permissions while performing lookups of operator classes and other objects, where formerly the calling user's permissions were used. This broke dump/restore scenarios, because pg\_dump issues `CREATE INDEX` before re-granting permissions. +* In extended query protocol, force an immediate commit after `CREATE DATABASE` and other commands that can't run in a transaction block (Tom Lane) [§](https://postgr.es/c/3e1297a63) + + If the client does not send a Sync message immediately after such a command, but instead sends another command, any failure in that command would lead to rolling back the preceding command, typically leaving inconsistent state on-disk (such as a missing or extra database directory). The mechanisms intended to prevent that situation turn out to work for multiple commands in a simple-Query message, but not for a series of extended-protocol messages. To prevent inconsistency without breaking use-cases that work today, force an implicit commit after such commands. +* Fix race condition when checking transaction visibility (Simon Riggs) [§](https://postgr.es/c/e24615a00) + + `TransactionIdIsInProgress` could report `false` before the subject transaction is considered visible, leading to various misbehaviors. The race condition window is normally very narrow, but use of synchronous replication makes it much wider, because the wait for a synchronous replica happens in that window. +* Fix incorrect plans when sorting by an expression that contains a non-top-level set-returning function (Richard Guo, Tom Lane) [§](https://postgr.es/c/445b9020c) [§](https://postgr.es/c/1a9ac8492) +* Fix incorrect permissions-checking code for extended statistics (Richard Guo) [§](https://postgr.es/c/7c6ce0475) + + If there are extended statistics on a table that the user has only partial `SELECT` permissions on, some queries would fail with “unrecognized node type” errors. +* Fix extended statistics machinery to handle MCV-type statistics on boolean-valued expressions (Tom Lane) [§](https://postgr.es/c/3fe2fc6bb) + + Statistics collection worked fine, but a query containing such an expression in `WHERE` would fail with “unknown clause type”. +* Avoid planner core dump with `constant = ANY(array)` clauses when there are MCV-type extended statistics on the *`array`* variable (Tom Lane) [§](https://postgr.es/c/ea6c91696) [§](https://postgr.es/c/b9243cada) +* Fix `ALTER TABLE ... ENABLE/DISABLE TRIGGER` to handle recursion correctly for triggers on partitioned tables (Álvaro Herrera, Amit Langote) [§](https://postgr.es/c/731d514ae) [§](https://postgr.es/c/6d9481cd0) + + In certain cases, a “trigger does not exist” failure would occur because the command would try to adjust the trigger on a child partition that doesn't have it. +* Allow cancellation of `ANALYZE` while it is computing extended statistics (Tom Lane, Justin Pryzby) [§](https://postgr.es/c/af72b0889) + + In some scenarios with high statistics targets, it was possible to spend many seconds in an un-cancellable sort operation. +* Improve syntax error messages for type `jsonpath` (Andrew Dunstan) [§](https://postgr.es/c/7fd43684f) +* Ensure that `pg_stop_backup()` cleans up session state properly (Fujii Masao) [§](https://postgr.es/c/be2e842c8) + + This omission could lead to assertion failures or crashes later in the session. +* Fix `trim_array()` to handle a zero-dimensional array argument sanely (Martin Kalcher) [§](https://postgr.es/c/e71d4254f) +* Fix join alias matching in `FOR [KEY] UPDATE/SHARE` clauses (Dean Rasheed) [§](https://postgr.es/c/8d8464445) + + In corner cases, a misleading error could be reported. +* Reject `ROW()` expressions and functions in `FROM` that have too many columns (Tom Lane) [§](https://postgr.es/c/8df167baa) [§](https://postgr.es/c/d947a8bd5) + + Cases with more than about 1600 columns are unsupported, and have always failed at execution. However, it emerges that some earlier code could be driven to assertion failures or crashes by queries with more than 32K columns. Add a parse-time check to prevent that. +* Fix dumping of a view using a function in `FROM` that returns a composite type, when column(s) of the composite type have been dropped since the view was made (Tom Lane) [§](https://postgr.es/c/da9a28fd5) + + This oversight could lead to dump/reload or pg\_upgrade failures, as the dumped view would have too many column aliases for the function. +* Disallow nested backup operations in logical replication walsenders (Fujii Masao) [§](https://postgr.es/c/2aedf25eb) +* Fix memory leak in logical replication subscribers (Hou Zhijie) [§](https://postgr.es/c/3238b5c33) +* Fix logical replication's checking of replica identity when the target table is partitioned (Shi Yu, Hou Zhijie) [§](https://postgr.es/c/52d5ea9ad) [§](https://postgr.es/c/f0022a77d) + + The replica identity columns have to be re-identified for the child partition. +* Fix failures to update cached schema data in a logical replication subscriber after a schema change on the publisher (Shi Yu, Hou Zhijie) [§](https://postgr.es/c/0980adfd4) [§](https://postgr.es/c/d457cb4e8) +* Fix WAL consistency checking logic to correctly handle `BRIN_EVACUATE_PAGE` flags (Haiyang Wang) [§](https://postgr.es/c/541f41d4f) [§](https://postgr.es/c/f4beef1c2) +* Fix erroneous assertion checks in shared hashtable management (Thomas Munro) [§](https://postgr.es/c/5e7608e81) +* Avoid assertion failure when `min_dynamic_shared_memory` is set to a non-default value (Thomas Munro) [§](https://postgr.es/c/99504ff82) +* Arrange to clean up after commit-time errors within `SPI_commit()`, rather than expecting callers to do that (Peter Eisentraut, Tom Lane) [§](https://postgr.es/c/604651880) [§](https://postgr.es/c/8657946d3) + + Proper cleanup is complicated and requires use of low-level facilities, so it's not surprising that no known caller got it right. This led to misbehaviors when a PL procedure issued `COMMIT` but a failure occurred (such as a deferred constraint check). To improve matters, redefine `SPI_commit()` as starting a new transaction, so that it becomes equivalent to `SPI_commit_and_chain()` except that you get default transaction characteristics instead of preserving the prior transaction's characteristics. To make this somewhat transparent API-wise, redefine `SPI_start_transaction()` as a no-op. All known callers of `SPI_commit()` immediately call `SPI_start_transaction()`, so they will not notice any change. Similar remarks apply to `SPI_rollback()`. + + Also fix PL/Python, which omitted any handling of such errors at all, resulting in jumping out of the Python interpreter. This is reported to crash Python 3.11. Older Python releases leak some memory but seem okay with it otherwise. +* Improve libpq's handling of idle states in pipeline mode (Álvaro Herrera, Kyotaro Horiguchi) [§](https://postgr.es/c/7c1f42612) [§](https://postgr.es/c/9e038d690) + + This fixes “message type 0x33 arrived from server while idle” warnings, as well as possible loss of end-of-query NULL results from `PQgetResult()`. +* Avoid core dump in ecpglib with unexpected orders of operations (Tom Lane) [§](https://postgr.es/c/7bc21ed8c) + + Certain operations such as `EXEC SQL PREPARE` would crash (rather than reporting an error as expected) if called before establishing any database connection. +* In ecpglib, avoid redundant `newlocale()` calls (Noah Misch) [§](https://postgr.es/c/5b94e2bd4) [§](https://postgr.es/c/463a841d7) + + Allocate a C locale object once per process when first connecting, rather than creating and freeing locale objects once per query. This mitigates a libc memory leak on AIX, and may offer some performance benefit everywhere. +* In psql's `\watch` command, echo a newline after cancellation with control-C (Pavel Stehule) [§](https://postgr.es/c/ab7fef0ac) + + This prevents libedit (and possibly also libreadline) from becoming confused about which column the cursor is in. +* Fix pg\_upgrade to detect non-upgradable usages of functions taking `anyarray` (Justin Pryzby) [§](https://postgr.es/c/175e60a5e) [§](https://postgr.es/c/9783413cb) + + Version 14 changed some built-in functions to take type `anycompatiblearray` instead of `anyarray`. While this is mostly transparent, user-defined aggregates and operators built atop these functions have to be declared with exactly matching types. The presence of an object referencing the old signature will cause pg\_upgrade to fail, so change it to detect and report such cases before beginning the upgrade. +* Fix possible report of wrong error condition after `clone()` failure in pg\_upgrade with `--clone` option (Justin Pryzby) [§](https://postgr.es/c/523926dea) +* Fix `contrib/pg_stat_statements` to avoid problems with very large query-text files on 32-bit platforms (Tom Lane) [§](https://postgr.es/c/17fd203b4) +* In `contrib/postgres_fdw`, prevent batch insertion when there are `WITH CHECK OPTION` constraints (Etsuro Fujita) [§](https://postgr.es/c/4a9bc2e0f) + + Such constraints cannot be checked properly if more than one row is inserted at a time. +* Fix `contrib/postgres_fdw` to detect failure to send an asynchronous data fetch query (Fujii Masao) [§](https://postgr.es/c/169d50ba3) +* Ensure that `contrib/postgres_fdw` sends constants of `regconfig` and other `reg*` types with proper schema qualification (Tom Lane) [§](https://postgr.es/c/810bcbd38) +* Block signals while allocating dynamic shared memory on Linux (Thomas Munro) [§](https://postgr.es/c/2019e6ecf) [§](https://postgr.es/c/838364559) [§](https://postgr.es/c/c412c60b9) + + This avoids problems when a signal interrupts `posix_fallocate()`. +* Detect unexpected `EEXIST` error from `shm_open()` (Thomas Munro) [§](https://postgr.es/c/fb81a93a6) + + This avoids a possible crash on Solaris. +* Avoid using `signalfd()` on illumos systems (Thomas Munro) [§](https://postgr.es/c/e086b5538) + + This appears to trigger hangs and kernel panics, so avoid the function until a fix is available. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-14-6.html "E.15. Release 14.6") | [Up](release.html "Appendix E. Release Notes") | [Next](release-14-4.html "E.17. Release 14.4") | +| E.15. Release 14.6 | [Home](index.html "PostgreSQL 14.20 Documentation") | E.17. Release 14.4 | + +[Previous](/docs/release/14.4/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/14.6/) diff --git a/corpus/changelog/postgresql_releases/postgresql_146.md b/corpus/changelog/postgresql_releases/postgresql_146.md new file mode 100644 index 0000000000000000000000000000000000000000..ded3683df1decd4a14311ff82d7003d0a0b859d3 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_146.md @@ -0,0 +1,159 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.6/ +Version: 14.6 + +## PostgreSQL 14.6 + +| E.15. Release 14.6 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-14-7.html "E.14. Release 14.7") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-14-5.html "E.16. Release 14.5") | + +--- + +## E.15. Release 14.6 + +[E.15.1. Migration to Version 14.6](release-14-6.html#id-1.11.6.20.4) + +[E.15.2. Changes](release-14-6.html#id-1.11.6.20.5) + +**Release date:**2022-11-10 + +This release contains a variety of fixes from 14.5. For information about new features in major release 14, see [Section E.21](release-14.html "E.21. Release 14"). + +### E.15.1. Migration to Version 14.6 + +A dump/restore is not required for those running 14.X. + +However, if you are upgrading from a version earlier than 14.4, see [Section E.17](release-14-4.html "E.17. Release 14.4"). + +### E.15.2. Changes + +* Avoid rare PANIC during updates occurring concurrently with `VACUUM` (Tom Lane, Jeff Davis) [§](https://postgr.es/c/b93d7e688) [§](https://postgr.es/c/21934612d) + + If a concurrent `VACUUM` sets the all-visible flag bit in a page that `UPDATE` or `DELETE` is in process of modifying, the updating command needs to clear that bit again; but some code paths failed to do so, ending in a PANIC exit and database restart. + + This is known to be possible in versions 14 and 15. It may be only latent in previous branches. +* Fix handling of `DEFAULT` tokens that appear in a multi-row `VALUES` clause of an `INSERT` on an updatable view (Tom Lane) [§](https://postgr.es/c/3162bd95c) + + This oversight could lead to “cache lookup failed for type” errors, or in older branches even to crashes. +* Disallow rules named `_RETURN` that are not `ON SELECT` (Tom Lane) [§](https://postgr.es/c/2f26cec48) + + This avoids confusion between a view's `ON SELECT` rule and any other rules it may have. +* Fix resource management bug in saving tuples for `AFTER` triggers (Tom Lane) [§](https://postgr.es/c/992376461) + + Given the right circumstances, this manifested as a “tupdesc reference *`NNNN`* is not owned by resource owner” error followed by a PANIC exit. +* Avoid failure in `EXPLAIN VERBOSE` for a query using `SEARCH BREADTH FIRST` with constant initial values (Tom Lane) [§](https://postgr.es/c/8122160ff) +* Fix construction of per-partition foreign key constraints while doing `ALTER TABLE ATTACH PARTITION` (Jehan-Guillaume de Rorthais, Álvaro Herrera) [§](https://postgr.es/c/18865f4df) [§](https://postgr.es/c/483d26930) + + Previously, incorrect or duplicate constraints could be constructed for the newly-added partition. +* Fix generation of constraint names for per-partition foreign key constraints (Jehan-Guillaume de Rorthais) [§](https://postgr.es/c/640c20d62) + + If the initially-given name is already in use for some constraint of the partition, a new one is selected; but it wasn't being spelled as intended. +* Fix incorrect matching of index expressions and predicates when creating a partitioned index (Richard Guo, Tom Lane) [§](https://postgr.es/c/3bfea5cbb) + + While creating a partitioned index, we try to identify any existing indexes on the partitions that match the partitioned index, so that we can absorb those as child indexes instead of building new ones. Matching of expressions was not done right, so that a usable child index might be ignored, leading to creation of a duplicative index. +* Prevent WAL corruption after a standby promotion (Dilip Kumar, Robert Haas) [§](https://postgr.es/c/0e54a5e27) + + When a PostgreSQL instance performing archive recovery (but not using standby mode) is promoted, and the last WAL segment that it attempted to read ended in a partial record, the instance would write an invalid WAL segment on the new timeline. +* Fix mis-ordering of WAL operations in fast insert path for GIN indexes (Matthias van de Meent, Zhang Mingli) [§](https://postgr.es/c/5a30d43fa) + + This mistake is not known to have any negative consequences within core PostgreSQL, but it did cause issues for some extensions. +* Fix bugs in logical decoding when replay starts from a point between the beginning of a transaction and the beginning of its subtransaction (Masahiko Sawada, Kuroda Hayato) [§](https://postgr.es/c/a592ed923) [§](https://postgr.es/c/4fbe6096b) + + These errors could lead to assertion failures in debug builds, and otherwise to memory leaks. +* Prevent examining system catalogs with the wrong snapshot during logical decoding (Masahiko Sawada) [§](https://postgr.es/c/68dcce247) + + If decoding begins partway through a transaction that modifies system catalogs, the decoder may not recognize that, causing it to fail to treat that transaction as in-progress for catalog lookups. +* Accept interrupts in more places during logical decoding (Amit Kapila, Masahiko Sawada) [§](https://postgr.es/c/36fc013fa) [§](https://postgr.es/c/6d05d575b) + + This ameliorates problems with slow shutdown of replication workers. +* Prevent attempts to replicate into a foreign-table partition in replication workers (Shi Yu, Tom Lane) [§](https://postgr.es/c/a5b7821fc) + + Although partitioned tables can have foreign tables as partitions, replicating into such a partition isn't currently supported. The logical replication worker process would crash if it was attempted. Now, an error is thrown. +* Remove pointless check on replica identity setting of partitioned tables (Hou Zhijie) [§](https://postgr.es/c/02f8d68af) + + What matters is the replica identity setting of the leaf partitions, so there's no need to throw error if it's not set on the parent. +* Avoid crash after function syntax error in replication workers (Maxim Orlov, Anton Melnikov, Masahiko Sawada, Tom Lane) [§](https://postgr.es/c/2489c38cd) + + If a syntax error occurred in a SQL-language or PL/pgSQL-language `CREATE FUNCTION` or `DO` command executed in a logical replication worker, the worker process would crash with a null pointer dereference or assertion failure. +* Fix handling of read-write expanded datums that are passed to SQL functions (Tom Lane) [§](https://postgr.es/c/95bfadd4e) + + If a non-inlined SQL function uses a parameter in more than one place, and one of those functions expects to be able to modify read-write datums in place, then later uses of the parameter would observe the wrong value. (Within core PostgreSQL, the expanded-datum mechanism is only used for array and composite-type values; but extensions might use it for other structured types.) +* Fix type `circle`'s equality comparator to handle NaNs properly (Ranier Vilela) [§](https://postgr.es/c/13b8a1c19) + + If the left-hand circle had a floating-point NaN for its radius, it would be considered equal to a circle with the same center and any radius. +* In Snowball dictionaries, don't try to stem excessively-long words (Olly Betts, Tom Lane) [§](https://postgr.es/c/e969f1ae2) + + If the input word exceeds 1000 bytes, return it as-is after case folding, rather than trying to run it through the Snowball code. This restriction protects against a known recursion-to-stack-overflow problem in the Turkish stemmer, and it seems like good insurance against any other safety or performance issues that may exist in the Snowball stemmers. Such a long string is surely not a word in any human language, so it's doubtful that the stemmer would have done anything desirable with it anyway. +* Fix use-after-free hazard in string comparisons (Tom Lane) [§](https://postgr.es/c/06602372b) + + Improper memory management in the string comparison functions could result in scribbling on no-longer-allocated buffers, potentially breaking things for whatever is using that memory now. This would only happen with fairly long strings (more than 1kB), and only if an ICU collation is in use. +* Add plan-time check for attempted access to a table that has no table access method (Tom Lane) [§](https://postgr.es/c/8c611602b) + + This prevents a crash in some catalog-corruption scenarios, for example use of a view whose `ON SELECT` rule is missing. +* Prevent postmaster crash when shared-memory state is corrupted (Tom Lane) [§](https://postgr.es/c/b10546ecf) + + The postmaster process is supposed to survive and initiate a database restart if shared memory becomes corrupted, but one bit of code was being insufficiently cautious about that. +* Add some more defenses against recursion till stack overrun (Richard Guo, Tom Lane) [§](https://postgr.es/c/444ec169a) [§](https://postgr.es/c/496ab1d6c) +* Avoid misbehavior when choosing hash table size with very small `work_mem` and large tuples (Zhang Mingli) [§](https://postgr.es/c/1dfc9193a) +* Avoid long-term memory leakage in the autovacuum launcher process (Reid Thompson) [§](https://postgr.es/c/feec1b2d5) + + The lack of field reports suggests that this problem is only latent in pre-v15 branches; but it's not very clear why, so back-patch the fix anyway. +* Improve PL/pgSQL's ability to handle parameters declared as `RECORD` (Tom Lane) [§](https://postgr.es/c/56d45fdab) + + Build a separate function cache entry for each concrete type passed to the `RECORD` parameter during a session, much as we do for polymorphic parameters. This allows some usages to work that previously failed with errors such as “type of parameter does not match that when preparing the plan”. +* In libpq, handle single-row mode correctly when pipelining (Denis Laxalde) [§](https://postgr.es/c/b8af4166f) + + The single-row flag was not reset at the correct time if pipeline mode was also active. +* Add missing guards for `NULL` connection pointer in libpq (Daniele Varrazzo, Tom Lane) [§](https://postgr.es/c/d63a69157) + + There's a convention that libpq functions should check for a NULL PGconn argument, and fail gracefully instead of crashing. `PQflush()` and `PQisnonblocking()` didn't get that memo, so fix them. +* In ecpg, fix omission of variable storage classes when multiple `varchar` or `bytea` variables are declared in the same declaration (Andrey Sokolov) [§](https://postgr.es/c/be0b0528c) + + For example, ecpg translated `static varchar str1[10], str2[20], str3[30];` in such a way that only `str1` was marked `static`. +* Allow cross-platform tablespace relocation in pg\_basebackup (Robert Haas) [§](https://postgr.es/c/aaad8adb0) + + Allow the remote path in `--tablespace-mapping` to be either a Unix-style or Windows-style absolute path, since the source server could be on a different OS than the local system. +* In pg\_stat\_statements, fix access to already-freed memory (zhaoqigui) [§](https://postgr.es/c/0f2f5645a) + + This occurred if pg\_stat\_statements tracked a `ROLLBACK` command issued via extended query protocol. In debug builds it consistently led to an assertion failure. In production builds there would often be no visible ill effect; but if the freed memory had already been reused, the likely result would be to store garbage for the query string. +* In postgres\_fdw, ensure that target lists constructed for EvalPlanQual plans will have all required columns (Richard Guo, Etsuro Fujita) [§](https://postgr.es/c/b53d104ae) + + This avoids “variable not found in subplan target list” errors in rare cases. +* Reject unwanted output from the platform's `uuid_create()` function (Nazir Bilal Yavuz) [§](https://postgr.es/c/e55ccb3b1) + + The uuid-ossp module expects libc's `uuid_create()` to produce a version-1 UUID, but recent NetBSD releases produce a version-4 (random) UUID instead. Check for that, and complain if so. Drop the documentation's claim that the NetBSD implementation is usable for uuid-ossp. (If a version-4 UUID is okay for your purposes, you don't need uuid-ossp at all; just use `gen_random_uuid()`.) +* Include new Perl test modules in standard installations (Álvaro Herrera) [§](https://postgr.es/c/4f6d1cfd6) + + Add `PostgreSQL/Test/Cluster.pm` and `PostgreSQL/Test/Utils.pm` to the standard installation file set in pre-version-15 branches. This is for the benefit of extensions that want to use newly-written test code in older branches. +* On NetBSD, force dynamic symbol resolution at postmaster start (Andres Freund, Tom Lane) [§](https://postgr.es/c/464db4676) + + This avoids a risk of deadlock in the dynamic linker on NetBSD 10. +* Fix incompatibilities with LLVM 15 (Thomas Munro, Andres Freund) [§](https://postgr.es/c/d033f8f8b) +* Allow use of `__sync_lock_test_and_set()` for spinlocks on any machine (Tom Lane) [§](https://postgr.es/c/058c7b5dd) + + This eases porting to new machine architectures, at least if you're using a compiler that supports this GCC builtin function. +* Rename symbol `REF` to `REF_P` to avoid compile failure on recent macOS (Tom Lane) [§](https://postgr.es/c/18e60712d) +* Avoid using `sprintf`, to avoid compile-time deprecation warnings (Tom Lane) [§](https://postgr.es/c/6fa431d84) +* Silence assorted compiler warnings from clang 15 and later (Tom Lane) [§](https://postgr.es/c/dcd7dbed5) [§](https://postgr.es/c/2e124d857) [§](https://postgr.es/c/88c947cb5) +* Update time zone data files to tzdata release 2022f for DST law changes in Chile, Fiji, Iran, Jordan, Mexico, Palestine, and Syria, plus historical corrections for Chile, Crimea, Iran, and Mexico. (Tom Lane) [§](https://postgr.es/c/97bb80b1b) + + Also, the Europe/Kiev zone has been renamed to Europe/Kyiv. Also, the following zones have been merged into nearby, more-populous zones whose clocks have agreed with them since 1970: Antarctica/Vostok, Asia/Brunei, Asia/Kuala\_Lumpur, Atlantic/Reykjavik, Europe/Amsterdam, Europe/Copenhagen, Europe/Luxembourg, Europe/Monaco, Europe/Oslo, Europe/Stockholm, Indian/Christmas, Indian/Cocos, Indian/Kerguelen, Indian/Mahe, Indian/Reunion, Pacific/Chuuk, Pacific/Funafuti, Pacific/Majuro, Pacific/Pohnpei, Pacific/Wake and Pacific/Wallis. (This indirectly affects zones that were already links to one of these: Arctic/Longyearbyen, Atlantic/Jan\_Mayen, Iceland, Pacific/Ponape, Pacific/Truk, and Pacific/Yap.) America/Nipigon, America/Rainy\_River, America/Thunder\_Bay, Europe/Uzhgorod, and Europe/Zaporozhye were also merged into nearby zones after discovering that their claimed post-1970 differences from those zones seem to have been errors. In all these cases, the previous zone name remains as an alias; but the actual data is that of the zone that was merged into. + + These zone mergers result in loss of pre-1970 timezone history for the merged zones, which may be troublesome for applications expecting consistency of `timestamptz` display. As an example, the stored value `1944-06-01 12:00 UTC` would previously display as `1944-06-01 13:00:00+01` if the Europe/Stockholm zone is selected, but now it will read out as `1944-06-01 14:00:00+02`. + + It is possible to build the time zone data files with options that will restore the older zone data, but that choice also inserts a lot of other old (and typically poorly-attested) zone data, resulting in more total changes from the previous release than accepting these upstream changes does. PostgreSQL has chosen to ship the tzdb data as-recommended, and so far as we are aware most major operating system distributions are doing likewise. However, if these changes cause significant problems for your application, a possible solution is to install a local build of the time zone data files using tzdb's backwards-compatibility options (see their `PACKRATDATA` and `PACKRATLIST` options). + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-14-7.html "E.14. Release 14.7") | [Up](release.html "Appendix E. Release Notes") | [Next](release-14-5.html "E.16. Release 14.5") | +| E.14. Release 14.7 | [Home](index.html "PostgreSQL 14.20 Documentation") | E.16. Release 14.5 | + +[Previous](/docs/release/14.5/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/14.7/) diff --git a/corpus/changelog/postgresql_releases/postgresql_147.md b/corpus/changelog/postgresql_releases/postgresql_147.md new file mode 100644 index 0000000000000000000000000000000000000000..86e5a9abf21891f35aef41dfb4942f9453499cac --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_147.md @@ -0,0 +1,169 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.7/ +Version: 14.7 + +## PostgreSQL 14.7 + +| E.14. Release 14.7 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-14-8.html "E.13. Release 14.8") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-14-6.html "E.15. Release 14.6") | + +--- + +## E.14. Release 14.7 + +[E.14.1. Migration to Version 14.7](release-14-7.html#id-1.11.6.19.4) + +[E.14.2. Changes](release-14-7.html#id-1.11.6.19.5) + +**Release date:**2023-02-09 + +This release contains a variety of fixes from 14.6. For information about new features in major release 14, see [Section E.21](release-14.html "E.21. Release 14"). + +### E.14.1. Migration to Version 14.7 + +A dump/restore is not required for those running 14.X. + +However, if you are upgrading from a version earlier than 14.4, see [Section E.17](release-14-4.html "E.17. Release 14.4"). + +### E.14.2. Changes + +* libpq can leak memory contents after GSSAPI transport encryption initiation fails (Jacob Champion) [§](https://postgr.es/c/626f2c1d6) + + A modified server, or an unauthenticated man-in-the-middle, can send a not-zero-terminated error message during setup of GSSAPI (Kerberos) transport encryption. libpq will then copy that string, as well as following bytes in application memory up to the next zero byte, to its error report. Depending on what the calling application does with the error report, this could result in disclosure of application memory contents. There is also a small probability of a crash due to reading beyond the end of memory. Fix by properly zero-terminating the server message. (CVE-2022-41862) +* Fix calculation of which `GENERATED` columns need to be updated in child tables during an `UPDATE` on a partitioned table or inheritance tree (Amit Langote, Tom Lane) [§](https://postgr.es/c/8cd190e13) [§](https://postgr.es/c/a8b88c26f) + + This fixes failure to update `GENERATED` columns that do not exist in the parent table, or that have different dependencies than are in the parent column's generation expression. +* Allow a `WITH RECURSIVE ... CYCLE` CTE to access its output column (Tom Lane) [§](https://postgr.es/c/ea5ae4cae) + + A reference to the `SET` column from within the CTE would fail with “cache lookup failed for type 0”. +* Fix handling of pending inserts when doing a bulk insertion to a foreign table (Etsuro Fujita) [§](https://postgr.es/c/e52245228) [§](https://postgr.es/c/d43a97ef4) + + In some cases pending insertions were not flushed to the FDW soon enough, leading to logical inconsistencies, for example `BEFORE ROW` triggers not seeing rows they should be able to see. +* Allow `REPLICA IDENTITY` to be set on an index that's not (yet) valid (Tom Lane) [§](https://postgr.es/c/70ec756b0) + + When pg\_dump dumps a partitioned index that's marked `REPLICA IDENTITY`, it generates a command sequence that applies `REPLICA IDENTITY` before the partitioned index has been marked valid, causing restore to fail. There seems no very good reason to prohibit doing it in that order, so allow it. The marking will have no effect anyway until the index becomes valid. +* Fix handling of `DEFAULT` markers in rules that perform an `INSERT` from a multi-row `VALUES` list (Dean Rasheed) [§](https://postgr.es/c/2c7ed9f75) + + In some cases a `DEFAULT` marker would not get replaced with the proper default-value expression, leading to an “unrecognized node type” error. +* Reject uses of undefined variables in `jsonpath` existence checks (Alexander Korotkov, David G. Johnston) [§](https://postgr.es/c/0d9221f1d) + + While `jsonpath` match operators threw an error for an undefined variable in the path pattern, the existence operators silently treated it as a match. +* Fix `jsonb` subscripting to cope with toasted subscript values (Tom Lane, David G. Johnston) [§](https://postgr.es/c/a18328bb3) + + Using a text value fetched directly from a table as a `jsonb` subscript was likely to fail. Fetches would usually not find any matching element. Assignments could store the value with a garbage key, although keys long enough to cause that problem are probably rare in the field. +* Fix edge-case data corruption in parallel hash joins (Dmitry Astapov) [§](https://postgr.es/c/2f65b8468) + + If the final chunk of a large tuple being written out to a temporary file was exactly 32760 bytes, it would be corrupted due to a fencepost bug. The query would typically fail later with corrupted-data symptoms. +* Honor non-default settings of `checkpoint_completion_target` (Bharath Rupireddy) [§](https://postgr.es/c/2e21e2857) + + Internal state was not updated after a change in `checkpoint_completion_target`, possibly resulting in performing checkpoint I/O faster or slower than desired, especially if that setting was changed on-the-fly. +* Log the correct ending timestamp in `recovery_target_xid` mode (Tom Lane) [§](https://postgr.es/c/103450724) + + When ending recovery based on the `recovery_target_xid` setting with `recovery_target_inclusive` = `off`, we printed an incorrect timestamp (always 2000-01-01) in the “recovery stopping before ... transaction” log message. +* Improve error reporting for some buffered file read failures (Peter Eisentraut) [§](https://postgr.es/c/f463335e1) + + Correctly report a short read, giving the numbers of bytes desired and actually read, instead of reporting an irrelevant error code. Most places got this right already, but some recently-written replication logic did not. +* In extended query protocol, avoid an immediate commit after `ANALYZE` if we're running a pipeline (Tom Lane) [§](https://postgr.es/c/ae47f8a96) + + If there's not been an explicit `BEGIN TRANSACTION`, `ANALYZE` would take it on itself to commit, which should not happen within a pipelined series of commands. +* Reject cancel request packets having the wrong length (Andrey Borodin) [§](https://postgr.es/c/6900aea67) + + The server would process a cancel request even if its length word was too small. This led to reading beyond the end of the allocated buffer. In theory that could cause a segfault, but it seems quite unlikely to happen in practice, since the buffer would have to be very close to the end of memory. The more likely outcome was a bogus log message about wrong backend PID or cancel code. Complain about the wrong length, instead. +* Add recursion and looping defenses in subquery pullup (Tom Lane) [§](https://postgr.es/c/97431d673) + + A contrived query can result in deep recursion and unreasonable amounts of time spent trying to flatten subqueries. A proper fix for that seems unduly invasive for a back-patch, but we can at least add stack depth checks and an interrupt check to allow the query to be cancelled. +* Fix planner issues when combining Memoize nodes with partitionwise joins or parameterized nestloops (Richard Guo) [§](https://postgr.es/c/dc3648f65) [§](https://postgr.es/c/ce093aa18) + + These errors could lead to not using Memoize in contexts where it would be useful, or possibly to wrong query plans. +* Fix partitionwise-join code to tolerate failure to produce a plan for each partition (Tom Lane) [§](https://postgr.es/c/ec3daeec3) + + This could result in “could not devise a query plan for the given query” errors. +* Limit the amount of cleanup work done by `get_actual_variable_range` (Simon Riggs) [§](https://postgr.es/c/bd06fe4de) + + Planner runs occurring just after deletion of a large number of tuples appearing at the end of an index could expend significant amounts of work setting the “killed” bits for those index entries. Limit the amount of work done in any one query by giving up on this process after examining 100 heap pages. All the cleanup will still happen eventually, but without so large a performance hiccup. +* Fix under-parenthesized display of `AT TIME ZONE` constructs (Tom Lane) [§](https://postgr.es/c/de0ff6088) + + This could result in dump/restore failures for rules or views in which an argument of `AT TIME ZONE` is itself an expression. +* Prevent clobbering of cached parsetrees for utility statements in SQL functions (Tom Lane, Daniel Gustafsson) [§](https://postgr.es/c/7715a3c24) + + If a SQL-language function executes the same utility command more than once within a single calling query, it could crash or report strange errors such as “unrecognized node type”. +* Ensure that execution of full-text-search queries can be cancelled while they are performing phrase matches (Tom Lane) [§](https://postgr.es/c/1b9c04b13) +* Fix memory leak in hashing strings with nondeterministic collations (Jeff Davis) [§](https://postgr.es/c/47e1224d5) +* Fix deadlock between `DROP DATABASE` and logical replication worker process (Hou Zhijie) [§](https://postgr.es/c/fd270b728) + + This was caused by an ill-advised choice to block interrupts while creating a logical replication slot in the worker. In version 15 that could lead to an undetected deadlock. In version 14, no deadlock has been observed, but it's still a bad idea to block interrupts while waiting for network I/O. +* Clean up the libpq connection object after a failed replication connection attempt (Andres Freund) [§](https://postgr.es/c/0a796b8b3) + + The previous coding leaked the connection object. In background code paths that's pretty harmless because the calling process will give up and exit. But in commands such as `CREATE SUBSCRIPTION`, such a failure resulted in a small session-lifespan memory leak. +* In hot-standby servers, reduce processing effort for tracking XIDs known to be active on the primary (Simon Riggs, Michail Nikolaev) [§](https://postgr.es/c/06998eab1) + + Insufficiently-aggressive cleanup of the KnownAssignedXids array could lead to poor performance, particularly when `max_connections` is set to a large value on the standby. +* Ignore invalidated logical-replication slots while determining oldest catalog xmin (Sirisha Chamarthi) [§](https://postgr.es/c/1b3ed7571) + + A replication slot could prevent cleanup of dead tuples in the system catalogs even after it becomes invalidated due to exceeding `max_slot_wal_keep_size`. Thus, failure of a replication consumer could lead to indefinitely-large catalog bloat. +* In logical decoding, notify the remote node when a transaction is detected to have crashed (Hou Zhijie) [§](https://postgr.es/c/b2cc5b810) + + After a server restart, we'll re-stream the changes for transactions occurring shortly before the restart. Some of these transactions probably never completed; when we realize that one didn't we throw away the relevant decoding state locally, but we neglected to tell the subscriber about it. That led to the subscriber keeping useless streaming files until it's next restarted. +* Fix uninitialized-memory usage in logical decoding (Masahiko Sawada) [§](https://postgr.es/c/9f2cc1a73) + + In certain cases, resumption of logical decoding could try to re-use XID data that had already been freed, leading to unpredictable behavior. +* Avoid rare “failed to acquire cleanup lock” panic during WAL replay of hash-index page split operations (Robert Haas) [§](https://postgr.es/c/9693f1900) +* Advance a heap page's LSN when setting its all-visible bit during WAL replay (Jeff Davis) [§](https://postgr.es/c/f893af496) + + Failure to do this left the page possibly different on standby servers than the primary, and violated some other expectations about when the LSN changes. This seems only a theoretical hazard so far as PostgreSQL itself is concerned, but it could upset third-party tools. +* Prevent unsafe usage of a relation cache entry's `rd_smgr` pointer (Amul Sul) [§](https://postgr.es/c/32d5a4974) + + Remove various assumptions that `rd_smgr` would stay valid over a series of operations, by wrapping all uses of it in a function that will recompute it if needed. This prevents bugs occurring when an unexpected cache flush occurs partway through such a series. +* Fix `int64_div_fast_to_numeric()` to work for a wider range of inputs (Dean Rasheed) [§](https://postgr.es/c/86bfbeab4) + + This function misbehaved with some values of its second argument. No such usages exist in core PostgreSQL, but it's clearly a hazard for external modules, so repair. +* Fix latent buffer-overrun problem in `WaitEventSet` logic (Thomas Munro) [§](https://postgr.es/c/547e60b83) + + The `epoll`-based and `kqueue`-based implementations could ask the kernel for too many events if the size of their internal buffer was different from the size of the caller's output buffer. That case is not known to occur in released PostgreSQL versions, but this error is a hazard for external modules and future bug fixes. +* Avoid nominally-undefined behavior when accessing shared memory in 32-bit builds (Andres Freund) [§](https://postgr.es/c/fc4154286) + + clang's undefined-behavior sanitizer complained about use of a pointer that was less aligned than it should be. It's very unlikely that this would cause a problem in non-debug builds, but it's worth fixing for testing purposes. +* Fix assertion failure in BRIN minmax-multi opclasses (Tomas Vondra) [§](https://postgr.es/c/883dc0214) + + The assertion was overly strict, so this mistake was harmless in non-assert builds. +* Remove faulty assertion in useless-RESULT-RTE optimization logic (Tom Lane) [§](https://postgr.es/c/0224646be) +* Fix copy-and-paste errors in cache-lookup-failure messages for ACL checks (Justin Pryzby) [§](https://postgr.es/c/7ad458e06) + + In principle these errors should never be reached. But if they are, some of them reported the wrong type of object. +* In pg\_dump, avoid calling unsafe server functions before we have locks on the tables to be examined (Tom Lane, Gilles Darold) [§](https://postgr.es/c/55f30e6c7) [§](https://postgr.es/c/03ac48549) + + pg\_dump uses certain server functions that can fail if examining a table that gets dropped concurrently. Avoid this type of failure by ensuring that we obtain access share lock before inquiring too deeply into a table's properties, and that we don't apply such functions to tables we don't intend to dump at all. +* Fix psql's `\sf` and `\ef` commands to handle SQL-language functions that have SQL-standard function bodies (Tom Lane) [§](https://postgr.es/c/303b26c1b) + + These commands misidentified the start of the function body when it used new-style syntax. +* Fix tab completion of `ALTER FUNCTION/PROCEDURE/ROUTINE` ... `SET SCHEMA` (Dean Rasheed) [§](https://postgr.es/c/48599a18d) +* Fix `contrib/seg` to not crash or print garbage if an input number has more than 127 digits (Tom Lane) [§](https://postgr.es/c/f489b480f) +* Fix build on Microsoft Visual Studio 2013 (Tom Lane) [§](https://postgr.es/c/06dca17ad) + + A previous patch supposed that all platforms of interest have `snprintf()`, but MSVC 2013 isn't quite there yet. Revert to using `sprintf()` on that platform. +* Fix compile failure in building PL/Perl with MSVC when using Strawberry Perl (Andrew Dunstan) [§](https://postgr.es/c/f76191fd9) +* Fix mismatch of PL/Perl built with MSVC versus a Perl library built with gcc (Andrew Dunstan) [§](https://postgr.es/c/f3f70b8de) + + Such combinations could previously fail with “loadable library and perl binaries are mismatched” errors. +* Suppress compiler warnings from Perl's header files (Andres Freund) [§](https://postgr.es/c/7b5dec760) + + Our preferred compiler options provoke warnings about constructs appearing in recent versions of Perl's header files. When using gcc, we can suppress these warnings with a pragma. +* Fix pg\_waldump to build on compilers that don't discard unused static-inline functions (Tom Lane) [§](https://postgr.es/c/21c058648) +* Update time zone data files to tzdata release 2022g for DST law changes in Greenland and Mexico, plus historical corrections for northern Canada, Colombia, and Singapore. (Tom Lane) [§](https://postgr.es/c/7e6154779) + + Notably, a new timezone America/Ciudad\_Juarez has been split off from America/Ojinaga. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-14-8.html "E.13. Release 14.8") | [Up](release.html "Appendix E. Release Notes") | [Next](release-14-6.html "E.15. Release 14.6") | +| E.13. Release 14.8 | [Home](index.html "PostgreSQL 14.20 Documentation") | E.15. Release 14.6 | + +[Previous](/docs/release/14.6/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/14.8/) diff --git a/corpus/changelog/postgresql_releases/postgresql_148.md b/corpus/changelog/postgresql_releases/postgresql_148.md new file mode 100644 index 0000000000000000000000000000000000000000..7dc4c989b109010fbf650eab142739365cd75d57 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_148.md @@ -0,0 +1,227 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.8/ +Version: 14.8 + +## PostgreSQL 14.8 + +| E.13. Release 14.8 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-14-9.html "E.12. Release 14.9") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-14-7.html "E.14. Release 14.7") | + +--- + +## E.13. Release 14.8 + +[E.13.1. Migration to Version 14.8](release-14-8.html#id-1.11.6.18.4) + +[E.13.2. Changes](release-14-8.html#id-1.11.6.18.5) + +**Release date:**2023-05-11 + +This release contains a variety of fixes from 14.7. For information about new features in major release 14, see [Section E.21](release-14.html "E.21. Release 14"). + +### E.13.1. Migration to Version 14.8 + +A dump/restore is not required for those running 14.X. + +However, if you are upgrading from a version earlier than 14.4, see [Section E.17](release-14-4.html "E.17. Release 14.4"). + +### E.13.2. Changes + +* Prevent `CREATE SCHEMA` from defeating changes in `search_path` (Alexander Lakhin) [§](https://postgr.es/c/01e8182c7) [§](https://postgr.es/c/1913f63dc) + + Within a `CREATE SCHEMA` command, objects in the prevailing `search_path`, as well as those in the newly-created schema, would be visible even within a called function or script that attempted to set a secure `search_path`. This could allow any user having permission to create a schema to hijack the privileges of a security definer function or extension script. + + The PostgreSQL Project thanks Alexander Lakhin for reporting this problem. (CVE-2023-2454) +* Enforce row-level security policies correctly after inlining a set-returning function (Stephen Frost, Tom Lane) [§](https://postgr.es/c/f8d799eda) + + If a set-returning SQL-language function refers to a table having row-level security policies, and it can be inlined into a calling query, those RLS policies would not get enforced properly in some cases involving re-using a cached plan under a different role. This could allow a user to see or modify rows that should have been invisible. + + The PostgreSQL Project thanks Wolfgang Walther for reporting this problem. (CVE-2023-2455) +* Avoid crash when the new schema name is omitted in `CREATE SCHEMA` (Michael Paquier) [§](https://postgr.es/c/d29eba198) + + The SQL standard allows writing `CREATE SCHEMA AUTHORIZATION owner_name`, with the schema name defaulting to *`owner_name`*. However some code paths expected the schema name to be present and would fail. +* Fix enabling/disabling of cloned triggers in partitioned tables (Tom Lane) [§](https://postgr.es/c/0a6aaf011) + + `ALTER TABLE ... ENABLE/DISABLE TRIGGER USER` skipped cloned triggers, mistaking them for system triggers. Other variants of `ENABLE/DISABLE TRIGGER` would process them, but only after improperly enforcing a superuserness check. +* Disallow altering composite types that are stored in indexes (Tom Lane) [§](https://postgr.es/c/334cc4c96) + + `ALTER TYPE` disallows non-binary-compatible modifications of composite types if they are stored in any table columns. (Perhaps that will be allowed someday, but it hasn't happened yet; the locking implications of rewriting many tables are daunting.) We overlooked the possibility that an index might contain a composite type that doesn't also appear in its table. +* Disallow system columns as elements of foreign keys (Tom Lane) [§](https://postgr.es/c/b0b55d8b8) + + Since the removal of OID as a system column, there is no plausible use-case for this, and various bits of code no longer support it. Disallow it rather than trying to fix all the cases. +* Ensure that `COPY TO` from an RLS-enabled parent table does not copy any rows from child tables (Antonin Houska) [§](https://postgr.es/c/53a53ea33) + + The documentation is quite clear that `COPY TO` copies rows from only the named table, not any inheritance children it may have. However, if row-level security was enabled on the table then this stopped being true. +* Avoid possible crash when `array_position()` or `array_positions()` is passed an empty array (Tom Lane) [§](https://postgr.es/c/d5de344a5) +* Fix possible out-of-bounds fetch in `to_char()` (Tom Lane) [§](https://postgr.es/c/7cac19105) + + With bad luck this could have resulted in a server crash. +* Avoid buffer overread in `translate()` function (Daniil Anisimov) [§](https://postgr.es/c/1a9356f65) + + When using the deletion feature, the function might fetch the byte just after the input string, creating a small risk of crash. +* Fix error cursor setting for parse errors in JSON string literals (Tom Lane) [§](https://postgr.es/c/0ee9d685d) + + Most cases in which a syntax error is detected in a string literal within a JSON value failed to set the error cursor appropriately. This led at least to an unhelpful error message (pointing to the token before the string, rather than the actual trouble spot), and could even result in a crash in v14 and later. +* Fix data corruption due to `vacuum_defer_cleanup_age` being larger than the current 64-bit xid (Andres Freund) [§](https://postgr.es/c/324281fd5) + + In v14 and later with non-default settings of `vacuum_defer_cleanup_age`, it was possible to compute a very large vacuum cleanup horizon xid, leading to vacuum removing rows that are still live. v12 and v13 have a lesser form of the same problem affecting only GiST indexes, which could lead to index pages getting recycled too early. +* Fix parser's failure to detect some cases of improperly-nested aggregates (Tom Lane) [§](https://postgr.es/c/096e70805) + + This oversight could lead to executor failures for queries that should have been rejected as invalid. +* Fix data structure corruption during parsing of serial `SEQUENCE NAME` options (David Rowley) [§](https://postgr.es/c/211016220) + + This can lead to trouble if an event trigger captures the corrupted parse tree. +* Correctly update plan nodes' parallel-safety markings when moving initplans from one node to another (Tom Lane) [§](https://postgr.es/c/0dd55ef9b) + + This planner oversight could lead to “subplan was not initialized” errors at runtime. +* Avoid failure with PlaceHolderVars in extended-statistics code (Tom Lane) [§](https://postgr.es/c/7c509f7e5) + + Use of dependency-type extended statistics could fail with “PlaceHolderVar found where not expected”. +* Disable the inverse-transition optimization for window aggregates when the call contains sub-SELECTs (David Rowley) [§](https://postgr.es/c/4aa43ba21) + + This optimization requires that the aggregate's argument expressions have repeatable results, which might not hold for a sub-SELECT. +* Fix oversights in execution of nested `ARRAY[]` constructs (Alexander Lakhin, Tom Lane) [§](https://postgr.es/c/11213d446) + + Correctly detect overflow of the total space needed for the result array, avoiding a possible crash due to undersized output allocation. Also ensure that any trailing padding space in the result array is zeroed; while leaving garbage there is harmless for most purposes, it can result in odd behavior later. +* Prevent crash when updating a field within an array-of-domain-over-composite-type column (Dmitry Dolgov) [§](https://postgr.es/c/9b104a27c) +* Fix partition pruning logic for partitioning on boolean columns (David Rowley) [§](https://postgr.es/c/ae85fb828) + + Pruning with a condition like `boolcol IS NOT TRUE` was done incorrectly, leading to possibly not returning rows in which `boolcol` is NULL. Also, the rather unlikely case of partitioning on `NOT boolcol` was handled incorrectly. +* Fix race condition in per-batch cleanup during parallel hash join (Thomas Munro, Melanie Plageman) [§](https://postgr.es/c/1b9e42e82) + + A crash was possible given unlucky timing and `parallel_leader_participation` = `off` (which is not the default). +* Recalculate `GENERATED` columns after an EvalPlanQual check (Tom Lane) [§](https://postgr.es/c/1e05ea51d) + + In `READ COMMITTED` isolation mode, the effects of a row update might need to get reapplied to a newer version of the row than the query found originally. If so, we need to recompute any `GENERATED` columns, in case they depend on columns that were changed by the concurrent update. +* Fix memory leak in Memoize plan execution (David Rowley) [§](https://postgr.es/c/f654f343c) +* Fix buffer refcount leak when using batched inserts for a foreign table included in a partitioned tree (Alexander Pyhalov) [§](https://postgr.es/c/4cc56f8ed) +* Restore support for sub-millisecond `vacuum_cost_delay` settings (Thomas Munro) [§](https://postgr.es/c/2bef57ee8) +* Don't balance vacuum cost delay when a table has a per-relation `vacuum_cost_delay` setting of zero (Masahiko Sawada) [§](https://postgr.es/c/0e8e5e856) + + Delay balancing is supposed to be disabled whenever autovacuum is processing a table with a per-relation `vacuum_cost_delay` setting, but this was done only for positive settings, not zero. +* Fix corner-case crashes when columns have been added to the end of a view (Tom Lane) [§](https://postgr.es/c/9f1e51b59) +* Repair rare failure of MULTIEXPR\_SUBLINK subplans in partitioned updates (Andres Freund, Tom Lane) [§](https://postgr.es/c/9eaba0602) + + Use of the syntax `INSERT ... ON CONFLICT DO UPDATE SET (c1, ...) = (SELECT ...)` with a partitioned target table could result in failure if any child table is dissimilar from the parent (for example, different physical column order). This typically manifested as failure of consistency checks in the executor; but a crash or incorrect data updates are also possible. +* Fix handling of `DEFAULT` markers within a multi-row `INSERT ... VALUES` query on a view that has a `DO ALSO INSERT ... SELECT` rule (Dean Rasheed) [§](https://postgr.es/c/f0423bea7) + + Such cases typically failed with “unrecognized node type” errors or assertion failures. +* Support references to `OLD` and `NEW` within subqueries in rule actions (Dean Rasheed, Tom Lane) [§](https://postgr.es/c/27ff93d18) + + Such references are really lateral references, but the server could crash if the subquery wasn't explicitly marked with `LATERAL`. Arrange to do that implicitly when necessary. +* When decompiling a rule or SQL function body containing `INSERT`/`UPDATE`/`DELETE` within `WITH`, take care to print the correct alias for the target table (Tom Lane) [§](https://postgr.es/c/14345f3c6) +* Fix glitches in `SERIALIZABLE READ ONLY` optimization (Thomas Munro) [§](https://postgr.es/c/e9051ecd5) [§](https://postgr.es/c/d811d74be) + + Transactions already marked as “doomed” confused the safe-snapshot optimization for `SERIALIZABLE READ ONLY` transactions. The optimization was unnecessarily skipped in some cases. In other cases an assertion failure occurred (but there was no problem in non-assert builds). +* Avoid leaking cache callback slots in the `pgoutput` logical decoding plugin (Shi Yu) [§](https://postgr.es/c/0f78df719) + + Multiple cycles of starting up and shutting down the plugin within a single session would eventually lead to an “out of relcache\_callback\_list slots” error. +* Avoid unnecessary calls to custom validators for index operator class options (Alexander Korotkov) [§](https://postgr.es/c/9ef5a3583) + + This change fixes some cases where an unexpected error was thrown. +* Avoid useless work while scanning a multi-column BRIN index with multiple scan keys (Tomas Vondra) [§](https://postgr.es/c/f3daa3116) + + The existing code effectively considered only the last scan key while deciding whether a range matched, thus usually scanning more of the index than it needed to. +* Fix netmask handling in BRIN inet\_minmax\_multi\_ops opclass (Tomas Vondra) [§](https://postgr.es/c/6a78a42fe) + + This error triggered an assertion failure in assert-enabled builds, but is mostly harmless in production builds. +* Fix dereference of dangling pointer during buffering build of a GiST index (Alexander Lakhin) [§](https://postgr.es/c/a1904c9ce) + + This error seems to usually be harmless in production builds, as the fetched value is noncritical; but in principle it could cause a server crash. +* Ignore dropped columns and generated columns during logical replication of an update or delete action (Onder Kalaci, Shi Yu) [§](https://postgr.es/c/9dac02c77) [§](https://postgr.es/c/65ead7696) + + Replication with the `REPLICA IDENTITY FULL` option failed if the table contained such columns. +* Correct the name of the wait event for SLRU buffer I/O for commit timestamps (Alexander Lakhin) [§](https://postgr.es/c/ae4ffa722) + + This wait event is named `CommitTsBuffer` according to the documentation, but the code had it as `CommitTSBuffer`. Change the code to match the documentation, as that way is more consistent with the naming of related wait events. +* Re-activate reporting of wait event `SLRUFlushSync` (Thomas Munro) [§](https://postgr.es/c/aeb6f4b3b) + + Reporting of this type of wait was accidentally removed in code refactoring. +* Avoid possible underflow when calculating how many WAL segments to keep (Kyotaro Horiguchi) [§](https://postgr.es/c/137003036) + + This could result in not honoring `wal_keep_size` accurately. +* Support RSA-PSS certificates with SCRAM-SHA-256 channel binding (Jacob Champion, Heikki Linnakangas) [§](https://postgr.es/c/864f80fea) + + This feature requires building with OpenSSL 1.1.1 or newer. Both the server and libpq are affected. +* Avoid race condition with process ID tracking on Windows (Thomas Munro) [§](https://postgr.es/c/9b6e0b9c3) [§](https://postgr.es/c/00fc4b3a3) [§](https://postgr.es/c/1c0d4affa) + + The operating system could recycle a PID before the postmaster observed that that child process was gone. This could lead to tracking more than one child with the same PID, resulting in confusion. +* Add missing cases to `SPI_result_code_string()` (Dean Rasheed) [§](https://postgr.es/c/482ab3e4f) +* Fix erroneous Valgrind markings in `AllocSetRealloc()` (Karina Litskevich) [§](https://postgr.es/c/dc44180f6) + + In the unusual case where the size of a large (>8kB) palloc chunk is decreased, a Valgrind-aware build would mismark the defined-ness state of the memory released from the chunk, possibly causing incorrect results during Valgrind testing. +* Avoid assertion failure when decoding a transactional logical replication message (Tomas Vondra) [§](https://postgr.es/c/8b9cbd42b) +* Avoid locale sensitivity when processing regular expression escapes (Jeff Davis) [§](https://postgr.es/c/dde926b0f) + + A backslash followed by a non-ASCII character could sometimes cause an assertion failure, depending on the prevailing locale. +* Avoid trying to write an empty WAL record in `log_newpage_range()` when the last few pages in the specified range are empty (Matthias van de Meent) [§](https://postgr.es/c/72a914e9f) + + It is not entirely clear whether this case is reachable in released branches, but if it is then an assertion failure could occur. +* Fix session-lifespan memory leakage in plpgsql `DO` blocks that use cast expressions (Ajit Awekar, Tom Lane) [§](https://postgr.es/c/2ba890ce7) +* Tighten array dimensionality checks when converting Perl list structures to multi-dimensional SQL arrays (Tom Lane) [§](https://postgr.es/c/1e868bb6c) + + plperl could misbehave when the nesting of sub-lists is inconsistent so that the data does not represent a rectangular array of values. Such cases now produce errors, but previously they could result in a crash or garbage output. +* Tighten array dimensionality checks when converting Python list structures to multi-dimensional SQL arrays (Tom Lane) [§](https://postgr.es/c/9d517339e) [§](https://postgr.es/c/a1d9aacc4) + + plpython could misbehave when dealing with empty sub-lists, or when the nesting of sub-lists is inconsistent so that the data does not represent a rectangular array of values. The former should result in an empty output array, and the latter in an error. But some cases resulted in a crash, and others in unexpected output. +* Fix unwinding of exception stack in plpython (Xing Guo) [§](https://postgr.es/c/52c9cf323) + + Some rare failure cases could return without cleaning up the PG\_TRY exception stack, risking a crash if another error was raised before the next stack level was unwound. +* Fix inconsistent GSS-encryption error handling in libpq's `PQconnectPoll()` (Michael Paquier) [§](https://postgr.es/c/7e319231c) + + With `gssencmode` set to `require`, the connection was not marked dead after a GSS initialization failure. Make it fail immediately, as the equivalent case for TLS encryption has long done. +* Fix possible data corruption in ecpg programs built with the `-C ORACLE` option (Kyotaro Horiguchi) [§](https://postgr.es/c/02f076454) + + When `ecpg_get_data()` is called with `varcharsize` set to zero, it could write a terminating zero character into the last byte of the preceding field, truncating the data in that field. +* Fix pg\_dump so that partitioned tables that are hash-partitioned on an enum-type column can be restored successfully (Tom Lane) [§](https://postgr.es/c/5fc1ac151) + + Since the hash codes for enum values depend on the OIDs assigned to the enum, they are typically different after a dump and restore, meaning that rows often need to go into a different partition than they were in originally. Users can work around that by specifying the `--load-via-partition-root` option; but since there is very little chance of success without that, teach pg\_dump to apply it automatically to such tables. + + Also, fix pg\_restore to not try to `TRUNCATE` target tables before restoring into them when `--load-via-partition-root` mode is used. This avoids a hazard of deadlocks and lost data. +* Correctly detect non-seekable files on Windows (Juan José Santamaría Flecha, Michael Paquier, Daniel Watzinger) [§](https://postgr.es/c/34105eea6) [§](https://postgr.es/c/bbf18fe19) + + This bug led to misbehavior when pg\_dump writes to a pipe or pg\_restore reads from one. +* In pgbench's “prepared” mode, prepare all the commands in a pipeline before starting the pipeline (Álvaro Herrera) [§](https://postgr.es/c/663e50e83) + + This avoids a failure when a pgbench script tries to start a serializable transaction inside a pipeline. +* In `contrib/amcheck`'s heap checking code, deal correctly with tuples having zero xmin or xmax (Robert Haas) [§](https://postgr.es/c/8fd5aa76c) [§](https://postgr.es/c/e3363cda9) +* In `contrib/amcheck`, deal sanely with xids that appear to be before epoch zero (Andres Freund) [§](https://postgr.es/c/b3a83055c) + + In cases of corruption we might see a wrapped-around 32-bit xid that appears to be before the first xid epoch. Promoting such a value to 64-bit form produced a value far in the future, resulting in wrong reports. Return FirstNormalFullTransactionId in such cases so that things work reasonably sanely. +* In `contrib/hstore_plpython`, avoid crashing if the Python value to be transformed isn't a mapping (Dmitry Dolgov, Tom Lane) [§](https://postgr.es/c/c74f88c40) + + This should give an error, but Python 3 changed some APIs in a way that caused the check to misbehave, allowing a crash to ensue. +* Require the `siglen` option of a GiST index on an `ltree` column, if specified, to be a multiple of 4 (Alexander Korotkov) [§](https://postgr.es/c/f4a4a18ec) + + Other values result in misaligned accesses to index content, which is harmless on Intel-compatible hardware but can cause a crash on some other architectures. +* In `contrib/pageinspect`, add defenses against incorrect input for the `gist_page_items()` function (Dmitry Koval) [§](https://postgr.es/c/5ad63eee1) +* Fix misbehavior in `contrib/pg_trgm` with an unsatisfiable regular expression (Tom Lane) [§](https://postgr.es/c/786528039) + + A regex such as `$foo` is legal but unsatisfiable; the regex compiler recognizes that and produces an empty NFA graph. Attempting to optimize such a graph into a pg\_trgm GIN or GiST index qualification resulted in accessing off the end of a work array, possibly leading to crashes. +* Use the `--strip-unneeded` option when stripping static libraries with GNU-compatible strip (Tom Lane) [§](https://postgr.es/c/6d60b718c) + + Previously, `make install-strip` used the `-x` option in this case. This change avoids misbehavior of llvm-strip, and gives slightly smaller output as well. +* Stop recommending auto-download of DTD files for building the documentation, and indeed disable it (Aleksander Alekseev, Peter Eisentraut, Tom Lane) [§](https://postgr.es/c/7f8778fcf) + + It appears no longer possible to build the SGML documentation without a local installation of the DocBook DTD files. Formerly xsltproc could download those files on-the-fly from sourceforge.net; but sourceforge.net now permits only HTTPS access, and no common version of xsltproc supports that. Hence, remove the bits of our documentation suggesting that that's possible or useful, and instead add xsltproc's `--nonet` option to the build recipes. +* When running TAP tests in PGXS builds, use a saner location for the temporary `portlock` directory (Peter Eisentraut) [§](https://postgr.es/c/e07022500) + + Place it under `tmp_check` in the build directory. With the previous coding, a PGXS build would try to place it in the installation directory, which is not necessarily writable. +* Update time zone data files to tzdata release 2023c for DST law changes in Egypt, Greenland, Morocco, and Palestine. (Tom Lane) [§](https://postgr.es/c/b79b36f26) + + When observing Moscow time, Europe/Kirov and Europe/Volgograd now use the abbreviations MSK/MSD instead of numeric abbreviations, for consistency with other timezones observing Moscow time. Also, America/Yellowknife is no longer distinct from America/Edmonton; this affects some pre-1948 timestamps in that area. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-14-9.html "E.12. Release 14.9") | [Up](release.html "Appendix E. Release Notes") | [Next](release-14-7.html "E.14. Release 14.7") | +| E.12. Release 14.9 | [Home](index.html "PostgreSQL 14.20 Documentation") | E.14. Release 14.7 | + +[Previous](/docs/release/14.7/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/14.9/) diff --git a/corpus/changelog/postgresql_releases/postgresql_149.md b/corpus/changelog/postgresql_releases/postgresql_149.md new file mode 100644 index 0000000000000000000000000000000000000000..777c22eda604ecd2e1be4c5cc376cb21f2ea6d13 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_149.md @@ -0,0 +1,151 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/14.9/ +Version: 14.9 + +## PostgreSQL 14.9 + +| E.12. Release 14.9 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-14-10.html "E.11. Release 14.10") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 14.20 Documentation") | [Next](release-14-8.html "E.13. Release 14.8") | + +--- + +## E.12. Release 14.9 + +[E.12.1. Migration to Version 14.9](release-14-9.html#id-1.11.6.17.4) + +[E.12.2. Changes](release-14-9.html#id-1.11.6.17.5) + +**Release date:**2023-08-10 + +This release contains a variety of fixes from 14.8. For information about new features in major release 14, see [Section E.21](release-14.html "E.21. Release 14"). + +### E.12.1. Migration to Version 14.9 + +A dump/restore is not required for those running 14.X. + +However, if you use BRIN indexes, it may be advisable to reindex them; see the second changelog entry below. + +Also, if you are upgrading from a version earlier than 14.4, see [Section E.17](release-14-4.html "E.17. Release 14.4"). + +### E.12.2. Changes + +* Disallow substituting a schema or owner name into an extension script if the name contains a quote, backslash, or dollar sign (Noah Misch) [§](https://postgr.es/c/d4648a74b) + + This restriction guards against SQL-injection hazards for trusted extensions. + + The PostgreSQL Project thanks Micah Gates, Valerie Woolard, Tim Carey-Smith, and Christoph Berg for reporting this problem. (CVE-2023-39417) +* Fix confusion between empty (no rows) ranges and all-NULL ranges in BRIN indexes, as well as incorrect merging of all-NULL summaries (Tomas Vondra) [§](https://postgr.es/c/40d465caf) [§](https://postgr.es/c/3f1356e5d) + + Each of these oversights could result in forgetting that a BRIN index range contains any NULL values, potentially allowing subsequent queries that should return NULL values to miss doing so. + + This fix will not in itself correct faulty BRIN entries. It's recommended to `REINDEX` any BRIN indexes that may be used to search for nulls. +* Avoid leaving a corrupted database behind when `DROP DATABASE` is interrupted (Andres Freund) [§](https://postgr.es/c/d11efe830) + + If `DROP DATABASE` was interrupted after it had already begun taking irreversible steps, the target database remained accessible (because the removal of its `pg_database` row would roll back), but it would have corrupt contents. Fix by marking the database as inaccessible before we begin to perform irreversible operations. A failure after that will leave the database still partially present, but nothing can be done with it except to issue another `DROP DATABASE`. +* Ensure that partitioned indexes are correctly marked as valid or not at creation (Michael Paquier) [§](https://postgr.es/c/663b35f2d) + + If a new partitioned index matches an existing but invalid index on one of the partitions, the partitioned index could end up being marked valid prematurely. This could lead to misbehavior or assertion failures in subsequent queries on the partitioned table. +* Ignore invalid child indexes when matching partitioned indexes to child indexes during `ALTER TABLE ATTACH PARTITION` (Michael Paquier) [§](https://postgr.es/c/6160e221d) + + Such an index will now be ignored, and a new child index created instead. +* Fix possible failure when marking a partitioned index valid after all of its partitions have been attached (Michael Paquier) [§](https://postgr.es/c/954cc2139) + + The update of the index's `pg_index` entry could use stale data for other columns. One reported symptom is an “attempted to update invisible tuple” error. +* Fix `ALTER EXTENSION SET SCHEMA` to complain if the extension contains any objects outside the extension's schema (Michael Paquier, Heikki Linnakangas) [§](https://postgr.es/c/235e716bc) + + Erroring out if the extension contains objects in multiple schemas was always intended; but the check was mis-coded so that it would fail to detect some cases, leading to surprising behavior. +* Don't use partial unique indexes for uniqueness proofs in the planner (David Rowley) [§](https://postgr.es/c/73f1c17fc) + + This could give rise to incorrect plans, since the presumed uniqueness of rows read from a table might not hold if the index in question isn't used to scan the table. +* Don't Memoize lateral joins with volatile join conditions (Richard Guo) [§](https://postgr.es/c/bf315354e) + + Applying Memoize to a sub-plan that contains volatile filter conditions is likely to lead to wrong answers. The check to avoid doing this missed some cases that can arise when using `LATERAL`. +* Avoid producing incorrect plans for foreign joins with pseudoconstant join clauses (Etsuro Fujita) [§](https://postgr.es/c/b0e390e6d) + + The planner currently lacks support for attaching pseudoconstant join clauses to a pushed-down remote join, so disable generation of remote joins in such cases. (A better solution will require ABI-breaking changes of planner data structures, so it will have to wait for a future major release.) +* Correctly handle sub-SELECTs in RLS policy expressions and security-barrier views when expanding rule actions (Tom Lane) [§](https://postgr.es/c/d1423c52e) +* Fix race conditions in conflict detection for `SERIALIZABLE` isolation mode (Thomas Munro) [§](https://postgr.es/c/fb663f387) [§](https://postgr.es/c/3f7d3a77e) [§](https://postgr.es/c/ae6d536ed) + + Conflicts could be missed when using bitmap heap scans, when using GIN indexes, and when examining an initially-empty btree index. All these cases could lead to serializability failures due to improperly allowing conflicting transactions to commit. +* Fix misbehavior of EvalPlanQual checks with inherited or partitioned target tables (Tom Lane) [§](https://postgr.es/c/f8320cc72) + + This oversight could lead to update or delete actions in `READ COMMITTED` isolation mode getting performed when they should have been skipped because of a conflicting concurrent update. +* Fix hash join with an inner-side hash key that contains Params coming from an outer nested loop (Tom Lane) [§](https://postgr.es/c/d911dce14) + + When rescanning the join after the values of such Params have changed, we must rebuild the hash table, but neglected to do so. This could result in missing join output rows. +* Fix intermittent failures when trying to update a field of a composite column (Tom Lane) [§](https://postgr.es/c/0789b82a9) + + If the overall value of the composite column is wide enough to require out-of-line toasting, then an unluckily-timed cache flush could cause errors or server crashes. +* Prevent query-lifespan memory leaks in some `UPDATE` queries with triggers (Tomas Vondra) [§](https://postgr.es/c/7f528e96c) [§](https://postgr.es/c/260dbf19a) +* Prevent query-lifespan memory leaks when an Incremental Sort plan node is rescanned (James Coleman, Laurenz Albe, Tom Lane) [§](https://postgr.es/c/c1affa38c) +* Accept fractional seconds in the input to `jsonpath`'s `datetime()` method (Tom Lane) [§](https://postgr.es/c/5eaa05f63) +* Prevent stack-overflow crashes with very complex text search patterns (Tom Lane) [§](https://postgr.es/c/4c61afa47) +* Allow tokens up to 10240 bytes long in `pg_hba.conf` and `pg_ident.conf` (Tom Lane) [§](https://postgr.es/c/341996248) + + The previous limit of 256 bytes has been found insufficient for some use-cases. +* Fix mishandling of C++ out-of-memory conditions (Heikki Linnakangas) [§](https://postgr.es/c/bfb493dba) + + If JIT is in use, running out of memory in a C++ `new` call would lead to a PostgreSQL FATAL error, instead of the expected C++ exception. +* Fix rare null-pointer crash in `plancache.c` (Tom Lane) [§](https://postgr.es/c/10fd061bb) +* Avoid losing track of possibly-useful shared memory segments when a page free results in coalescing ranges of free space (Dongming Liu) [§](https://postgr.es/c/b7ec66731) + + Ensure that the segment is moved into the appropriate “bin” for its new amount of free space, so that it will be found by subsequent searches. +* Allow `VACUUM` to continue after detecting certain types of b-tree index corruption (Peter Geoghegan) [§](https://postgr.es/c/63fa0deb3) [§](https://postgr.es/c/322c9b340) + + If an invalid sibling-page link is detected, log the issue and press on, rather than throwing an error as before. Nothing short of `REINDEX` will fix the broken index, but preventing `VACUUM` from completing until that is done risks making matters far worse. +* Ensure that `WrapLimitsVacuumLock` is released after `VACUUM` detects invalid data in `pg_database`.`datfrozenxid` or `pg_database`.`datminmxid` (Andres Freund) [§](https://postgr.es/c/e246fd423) + + Failure to release this lock could lead to a deadlock later, although the lock would be cleaned up if the session exits or encounters some other error. +* Avoid double replay of prepared transactions during crash recovery (suyu.cmj, Michael Paquier) [§](https://postgr.es/c/442749100) [§](https://postgr.es/c/763d26205) + + After a crash partway through a checkpoint with some two-phase transaction state data already flushed to disk by this checkpoint, crash recovery could attempt to replay the prepared transaction(s) twice, leading to a fatal error such as “lock is already held” in the startup process. +* Fix possible failure while promoting a standby server, if archiving is enabled and two-phase transactions need to be recovered (Julian Markwort) [§](https://postgr.es/c/f663b0091) + + If any required two-phase transactions were logged in the most recent (partial) log segment, promotion would fail with an incorrect complaint about “requested WAL segment has already been removed”. +* Ensure that a newly created, but still empty table is `fsync`'ed at the next checkpoint (Heikki Linnakangas) [§](https://postgr.es/c/d85bf0719) + + Without this, if there is an operating system crash causing the empty file to disappear, subsequent operations on the table might fail with “could not open file” errors. +* Ensure that creation of the init fork of an unlogged index is WAL-logged (Heikki Linnakangas) [§](https://postgr.es/c/32f327f68) + + While an unlogged index's main data fork is not WAL-logged, its init fork should be, to ensure that we have a consistent state to restore the index to after a crash. This step was missed if the init fork contains no data, which is a case not used by any standard index AM; but perhaps some extension behaves that way. +* Fix missing reinitializations of delay-checkpoint-end flags (suyu.cmj) [§](https://postgr.es/c/c6043fcbb) + + This could result in unnecessary delays of checkpoints, or in assertion failures in assert-enabled builds. +* Fix overly strict assertion in `jsonpath` code (David Rowley) [§](https://postgr.es/c/f457f2ef1) + + This assertion failed if a query applied the `.type()` operator to a `like_regex` result. There was no bug in non-assert builds. +* Avoid assertion failure when processing an empty statement via the extended query protocol in an already-aborted transaction (Tom Lane) [§](https://postgr.es/c/120ea65b8) +* Fix `contrib/fuzzystrmatch`'s Soundex `difference()` function to handle empty input sanely (Alexander Lakhin, Tom Lane) [§](https://postgr.es/c/ccd362325) + + An input string containing no alphabetic characters resulted in unpredictable output. +* Tighten whitespace checks in `contrib/hstore` input (Evan Jones) [§](https://postgr.es/c/e0e682945) + + In some cases, characters would be falsely recognized as whitespace and hence discarded. +* Disallow oversize input arrays with `contrib/intarray`'s `gist__int_ops` index opclass (Ankit Kumar Pandey, Alexander Lakhin) [§](https://postgr.es/c/019a40d61) + + Previously this code would report a `NOTICE` but press on anyway, creating an invalid index entry that presents a risk of crashes when the index is read. +* Avoid useless double decompression of GiST index entries in `contrib/intarray` (Konstantin Knizhnik, Matthias van de Meent, Tom Lane) [§](https://postgr.es/c/a6991f763) +* Fix `contrib/pageinspect`'s `gist_page_items()` function to work when there are included index columns (Alexander Lakhin, Michael Paquier) [§](https://postgr.es/c/e72580232) + + Previously, if the index has included columns, `gist_page_items()` would fail to display those values on index leaf pages, or crash outright on non-leaf pages. +* Fix pg\_dump to correctly handle new-style SQL-language functions whose bodies require parse-time dependencies on unique indexes (Tom Lane) [§](https://postgr.es/c/d6f549d7a) + + Such cases can arise from `GROUP BY` and `ON CONFLICT` clauses, for example. The function must then be postponed until after the unique index in the dump output, but pg\_dump did not do that and instead printed a warning about “could not resolve dependency loop”. +* Ensure that `pg_index`.`indisreplident` is kept up-to-date in relation cache entries (Shruthi Gowda) [§](https://postgr.es/c/7af65523a) + + This value could be stale in some cases. There is no core code that relies on the relation cache's copy, so this is only a latent bug as far as Postgres itself is concerned; but there may be extensions for which it is a live bug. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-14-10.html "E.11. Release 14.10") | [Up](release.html "Appendix E. Release Notes") | [Next](release-14-8.html "E.13. Release 14.8") | +| E.11. Release 14.10 | [Home](index.html "PostgreSQL 14.20 Documentation") | E.13. Release 14.8 | + +[Previous](/docs/release/14.8/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/14.10/) diff --git a/corpus/changelog/postgresql_releases/postgresql_150.md b/corpus/changelog/postgresql_releases/postgresql_150.md new file mode 100644 index 0000000000000000000000000000000000000000..a3d2082453b0e04ba7b3e9379336e50d91a5eebc --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_150.md @@ -0,0 +1,961 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/15.0/ +Version: 15.0 + +## PostgreSQL 15.0 + +| E.16. Release 15 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-15-1.html "E.15. Release 15.1") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 15.15 Documentation") | [Next](release-prior.html "E.17. Prior Releases") | + +--- + +## E.16. Release 15 + +[E.16.1. Overview](release-15.html#id-1.11.6.21.3) + +[E.16.2. Migration to Version 15](release-15.html#id-1.11.6.21.4) + +[E.16.3. Changes](release-15.html#id-1.11.6.21.5) + +[E.16.4. Acknowledgments](release-15.html#RELEASE-15-ACKNOWLEDGEMENTS) + +**Release date:**2022-10-13 + +### E.16.1. Overview + +PostgreSQL 15 contains many new features and enhancements, including: + +* Support for the SQL [`MERGE`](sql-merge.html "MERGE") command. +* Selective publication of tables' contents within [logical replication](logical-replication.html "Chapter 31. Logical Replication") publications, through the ability to specify column lists and row filter conditions. +* More options for compression, including support for Zstandard (zstd) compression. This includes support for performing compression on the server side during [pg\_basebackup](app-pgbasebackup.html "pg_basebackup"). +* Support for structured [server log output](runtime-config-logging.html#GUC-LOG-DESTINATION) using the JSON format. +* Performance improvements, particularly for in-memory and on-disk sorting. + +The above items and other new features of PostgreSQL 15 are explained in more detail in the sections below. + +### E.16.2. Migration to Version 15 + +A dump/restore using [pg\_dumpall](app-pg-dumpall.html "pg_dumpall") or use of [pg\_upgrade](pgupgrade.html "pg_upgrade") or logical replication is required for those wishing to migrate data from any previous release. See [Section 19.6](upgrading.html "19.6. Upgrading a PostgreSQL Cluster") for general information on migrating to new major releases. + +Version 15 contains a number of changes that may affect compatibility with previous releases. Observe the following incompatibilities: + +* Remove `PUBLIC` creation permission on the [`public` schema](ddl-schemas.html#DDL-SCHEMAS-PUBLIC "5.9.2. The Public Schema") (Noah Misch) [§](https://postgr.es/c/b073c3ccd) + + The new default is one of the secure schema usage patterns that [Section 5.9.6](ddl-schemas.html#DDL-SCHEMAS-PATTERNS "5.9.6. Usage Patterns") has recommended since the security release for CVE-2018-1058. The change applies to new database clusters and to newly-created databases in existing clusters. Upgrading a cluster or restoring a database dump will preserve `public`'s existing permissions. + + For existing databases, especially those having multiple users, consider revoking `CREATE` permission on the `public` schema to adopt this new default. For new databases having no need to defend against insider threats, granting `CREATE` permission will yield the behavior of prior releases. +* Change the owner of the `public` schema to be the new `pg_database_owner` role (Noah Misch) [§](https://postgr.es/c/b073c3ccd) + + This allows each database's owner to have ownership privileges on the `public` schema within their database. Previously it was owned by the bootstrap superuser, so that non-superuser database owners could not do anything with it. + + This change applies to new database clusters and to newly-created databases in existing clusters. Upgrading a cluster or restoring a database dump will preserve `public`'s existing ownership specification. +* Remove long-deprecated [exclusive backup mode](continuous-archiving.html#BACKUP-BASE-BACKUP "26.3.2. Making a Base Backup") (David Steele, Nathan Bossart) [§](https://postgr.es/c/39969e2a1) + + If the database server stops abruptly while in this mode, the server could fail to start. The non-exclusive backup mode is considered superior for all purposes. Functions `pg_start_backup()`/`pg_stop_backup()` have been renamed to `pg_backup_start()`/`pg_backup_stop()`, and the functions `pg_backup_start_time()` and `pg_is_in_backup()` have been removed. +* Increase [`hash_mem_multiplier`](runtime-config-resource.html#GUC-HASH-MEM-MULTIPLIER) default to 2.0 (Peter Geoghegan) [§](https://postgr.es/c/8f388f6f5) + + This allows query hash operations to use more [`work_mem`](runtime-config-resource.html#GUC-WORK-MEM) memory than other operations. +* Remove server-side language [`plpython2u`](plpython.html "Chapter 46. PL/Python — Python Procedural Language") and generic Python language `plpythonu` (Andres Freund) [§](https://postgr.es/c/76a29adee) + + Python 2.x is no longer supported. While the original intent of `plpythonu` was that it could eventually refer to `plpython3u`, changing it now seems more likely to cause problems than solve them, so it's just been removed. +* Generate an error if [`array_to_tsvector()`](functions-textsearch.html#TEXTSEARCH-FUNCTIONS-TABLE "Table 9.43. Text Search Functions") is passed an empty-string array element (Jean-Christophe Arnu) [§](https://postgr.es/c/cbe25dcff) + + This is prohibited because lexemes should never be empty. Users of previous Postgres releases should verify that no empty lexemes are stored because they can lead to dump/restore failures and inconsistent results. +* Generate an error when [`chr()`](functions-string.html#FUNCTIONS-STRING-OTHER "Table 9.10. Other String Functions and Operators") is supplied with a negative argument (Peter Eisentraut) [§](https://postgr.es/c/e9e63b702) +* Prevent [`CREATE OR REPLACE VIEW`](sql-createview.html "CREATE VIEW") from changing the collation of an output column (Tom Lane) [§](https://postgr.es/c/2523928b2) +* Disallow zero-length [Unicode identifiers](sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS "4.1.1. Identifiers and Key Words"), e.g., `U&""` (Peter Eisentraut) [§](https://postgr.es/c/a18b6d2dc) + + Non-Unicode zero-length identifiers were already disallowed. +* Prevent [numeric literals](sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS-NUMERIC "4.1.2.6. Numeric Constants") from having non-numeric trailing characters (Peter Eisentraut) [§](https://postgr.es/c/2549f0661) + + Previously, query text like `123abc` would be interpreted as `123` followed by a separate token `abc`. +* Adjust [JSON](datatype-json.html "8.14. JSON Types") numeric literal processing to match the SQL/JSON-standard (Peter Eisentraut) [§](https://postgr.es/c/e26114c81) + + This accepts numeric formats like `.1` and `1.`, and disallows trailing junk after numeric literals, like `1.type()`. +* When [`interval`](datatype-datetime.html "8.5. Date/Time Types") input provides a fractional value for a unit greater than months, round to the nearest month (Bruce Momjian) [§](https://postgr.es/c/95ab1e0a9) + + For example, convert `1.99 years` to `2 years`, not `1 year 11 months` as before. +* Improve consistency of `interval` parsing with trailing periods (Tom Lane) [§](https://postgr.es/c/591e088dd) + + Numbers with trailing periods were rejected on some platforms. +* Mark the `interval` output function as stable, not immutable, since it depends on [`IntervalStyle`](runtime-config-client.html#GUC-INTERVALSTYLE) (Tom Lane) [§](https://postgr.es/c/a3d6264bb) + + This will, for example, cause creation of indexes relying on the text output of `interval` values to fail. +* Detect integer overflow in [interval justification functions](functions-datetime.html#FUNCTIONS-DATETIME-TABLE "Table 9.33. Date/Time Functions") (Joe Koshakow) [§](https://postgr.es/c/54bd1e43c) + + The affected functions are `justify_interval()`, `justify_hours()`, and `justify_days()`. +* Change the I/O format of type `"char"` for non-ASCII characters (Tom Lane) [§](https://postgr.es/c/c034b629c) + + Bytes with the high bit set are now output as a backslash and three octal digits, to avoid encoding issues. +* Remove the default [`ADMIN OPTION`](sql-createrole.html "CREATE ROLE") privilege a login role has on its own role membership (Robert Haas) [§](https://postgr.es/c/79de9842a) + + Previously, a login role could add/remove members of its own role, even without `ADMIN OPTION` privilege. +* Allow [logical replication](logical-replication.html "Chapter 31. Logical Replication") to run as the owner of the subscription (Mark Dilger) [§](https://postgr.es/c/a2ab9c06e) + + Because row-level security policies are not checked, only superusers, roles with `bypassrls`, and table owners can replicate into tables with row-level security policies. +* Prevent `UPDATE` and `DELETE` [logical replication](logical-replication.html "Chapter 31. Logical Replication") operations on tables where the subscription owner does not have `SELECT` permission on the table (Jeff Davis) [§](https://postgr.es/c/96a6f11c0) + + `UPDATE` and `DELETE` commands typically involve reading the table as well, so require the subscription owner to have table `SELECT` permission. +* When [`EXPLAIN`](sql-explain.html "EXPLAIN") references the session's temporary object schema, refer to it as `pg_temp` (Amul Sul) [§](https://postgr.es/c/48c5c9068) + + Previously the actual schema name was reported, leading to inconsistencies across sessions. +* Fix [`pg_statio_all_tables`](monitoring-stats.html#MONITORING-PG-STATIO-ALL-TABLES-VIEW "28.2.19. pg_statio_all_tables") to sum values for the rare case of TOAST tables with multiple indexes (Andrei Zubkov) [§](https://postgr.es/c/ce95c5437) + + Previously such cases would show one row for each index. +* Disallow setting [custom options](runtime-config-custom.html "20.16. Customized Options") that match the name of an installed extension, but are not one of the extension's declared variables (Florin Irion, Tom Lane) [§](https://postgr.es/c/75d22069e) [§](https://postgr.es/c/2ed8a8cc5) [§](https://postgr.es/c/88103567c) + + This change causes any such pre-existing variables to be deleted during extension load, and then prevents new ones from being created later in the session. The intent is to prevent confusion about whether a variable is associated with an extension or not. +* Remove obsolete server variable `stats_temp_directory` (Andres Freund, Kyotaro Horiguchi) [§](https://postgr.es/c/6f0cf8787) +* Improve the algorithm used to compute [`random()`](functions-math.html#FUNCTIONS-MATH-RANDOM-TABLE "Table 9.6. Random Functions") (Fabien Coelho) [§](https://postgr.es/c/3804539e4) [§](https://postgr.es/c/d4f109e4a) + + This will cause `random()`'s results to differ from what was emitted by prior versions, even for the same seed value. +* libpq's [`PQsendQuery()`](libpq-async.html#LIBPQ-PQSENDQUERY) function is no longer supported in pipeline mode (Álvaro Herrera) [§](https://postgr.es/c/bd8ac900d) + + Applications that are using that combination will need to be modified to use `PQsendQueryParams()` instead. +* On non-Windows platforms, consult the `HOME` environment variable to find the user's home directory (Anders Kaseorg) [§](https://postgr.es/c/376ce3e40) + + If `HOME` is empty or unset, fall back to the previous method of checking the `` database. This change affects libpq (for example, while looking up `~/.pgpass`) as well as various client application programs. +* Remove [pg\_dump](app-pgdump.html "pg_dump")'s `--no-synchronized-snapshots` option (Tom Lane) [§](https://postgr.es/c/2a712066d) + + All still-supported server versions support synchronized snapshots, so there's no longer a need for this option. +* After an error is detected in [psql](app-psql.html "psql")'s `--single-transaction` mode, change the final `COMMIT` command to `ROLLBACK` only if `ON_ERROR_STOP` is set (Michael Paquier) [§](https://postgr.es/c/a3ff08e0b) +* Avoid unnecessary casting of constants in queries sent by [postgres\_fdw](postgres-fdw.html "F.38. postgres_fdw") (Dian Fay) [§](https://postgr.es/c/f8abb0f5e) + + When column types are intentionally different between local and remote databases, such casts could cause errors. +* Remove [xml2](xml2.html "F.50. xml2")'s `xml_is_well_formed()` function (Tom Lane) [§](https://postgr.es/c/fd2abeb7c) + + This function has been implemented in the core backend since Postgres 9.1. +* Allow [custom scan providers](custom-scan.html "Chapter 61. Writing a Custom Scan Provider") to indicate if they support projections (Sven Klemm) [§](https://postgr.es/c/955b3e0f9) + + The default is now that custom scan providers are assumed to not support projections; those that do will need to be updated for this release. + +### E.16.3. Changes + +Below you will find a detailed account of the changes between PostgreSQL 15 and the previous major release. + +#### E.16.3.1. Server + +* Record and check the collation version of each [database](sql-createdatabase.html "CREATE DATABASE") (Peter Eisentraut) [§](https://postgr.es/c/37851a8b8) + + This feature is designed to detect collation version changes to avoid index corruption. Function `pg_database_collation_actual_version()` reports the underlying operating system collation version, and `ALTER DATABASE ... REFRESH` sets the recorded database collation version to match the operating system collation version. +* Allow [ICU](locale.html "24.1. Locale Support") collations to be set as the default for clusters and databases (Peter Eisentraut) [§](https://postgr.es/c/f2553d430) + + Previously, only libc-based collations could be selected at the cluster and database levels. ICU collations could only be used via explicit `COLLATE` clauses. +* Add system view [`pg_ident_file_mappings`](view-pg-ident-file-mappings.html "54.10. pg_ident_file_mappings") to report `pg_ident.conf` information (Julien Rouhaud) [§](https://postgr.es/c/a2c84990b) + +##### E.16.3.1.1. [Partitioning](ddl-partitioning.html "5.11. Table Partitioning") + +* Improve planning time for queries referencing partitioned tables (David Rowley) [§](https://postgr.es/c/475dbd0b7) + + This change helps when only a few of many partitions are relevant. +* Allow ordered scans of partitions to avoid sorting in more cases (David Rowley) [§](https://postgr.es/c/db632fbca) + + Previously, a partitioned table with a `DEFAULT` partition or a `LIST` partition containing multiple values could not be used for ordered partition scans. Now they can be used if such partitions are pruned during planning. +* Improve foreign key behavior of updates on partitioned tables that move rows between partitions (Amit Langote) [§](https://postgr.es/c/ba9a7e392) + + Previously, such updates ran a delete action on the source partition and an insert action on the target partition. PostgreSQL will now run an update action on the partition root, providing cleaner semantics. +* Allow [`CLUSTER`](sql-cluster.html "CLUSTER") on partitioned tables (Justin Pryzby) [§](https://postgr.es/c/cfdd03f45) [§](https://postgr.es/c/3f19e176a) +* Fix [`ALTER TRIGGER RENAME`](sql-altertable.html "ALTER TABLE") on partitioned tables to properly rename triggers on all partitions (Arne Roland, Álvaro Herrera) [§](https://postgr.es/c/80ba4bb38) + + Also prohibit cloned triggers from being renamed. + +##### E.16.3.1.2. Indexes + +* Allow btree indexes on system and [TOAST](storage-toast.html "73.2. TOAST") tables to efficiently store duplicates (Peter Geoghegan) [§](https://postgr.es/c/2903f1404) + + Previously de-duplication was disabled for these types of indexes. +* Improve lookup performance of [GiST](gist.html "Chapter 68. GiST Indexes") indexes that were built using sorting (Aliaksandr Kalenik, Sergei Shoulbakov, Andrey Borodin) [§](https://postgr.es/c/f1ea98a79) +* Allow unique constraints and indexes to treat `NULL` values as not distinct (Peter Eisentraut) [§](https://postgr.es/c/94aa7cc5f) + + Previously `NULL` entries were always treated as distinct values, but this can now be changed by creating constraints and indexes using `UNIQUE NULLS NOT DISTINCT`. +* Allow the [`^@`](functions-string.html#FUNCTIONS-STRING-OTHER "Table 9.10. Other String Functions and Operators") starts-with operator and the `starts_with()` function to use btree indexes if using the C collation (Tom Lane) [§](https://postgr.es/c/a148f8bc0) + + Previously these could only use [SP-GiST](spgist.html "Chapter 69. SP-GiST Indexes") indexes. + +##### E.16.3.1.3. Optimizer + +* Allow [extended statistics](sql-createstatistics.html "CREATE STATISTICS") to record statistics for a parent with all its children (Tomas Vondra, Justin Pryzby) [§](https://postgr.es/c/269b532ae) + + Regular statistics already tracked parent and parent-plus-all-children statistics separately. +* Add server variable [`recursive_worktable_factor`](runtime-config-query.html#GUC-RECURSIVE-WORKTABLE-FACTOR) to allow the user to specify the expected size of the working table of a [recursive query](queries-with.html#QUERIES-WITH-RECURSIVE "7.8.2. Recursive Queries") (Simon Riggs) [§](https://postgr.es/c/0bd7af082) + +##### E.16.3.1.4. General Performance + +* Allow hash lookup for [`NOT IN`](functions-subquery.html#FUNCTIONS-SUBQUERY-NOTIN "9.23.3. NOT IN") clauses with many constants (David Rowley, James Coleman) [§](https://postgr.es/c/29f45e299) + + Previously the code always sequentially scanned the list of values. +* Allow `SELECT DISTINCT` to be parallelized (David Rowley) [§](https://postgr.es/c/22c4e88eb) +* Speed up encoding validation of UTF-8 text by processing 16 bytes at a time (John Naylor, Heikki Linnakangas) [§](https://postgr.es/c/911588a3f) + + This will improve text-heavy operations like [`COPY FROM`](sql-copy.html "COPY"). +* Improve performance for sorts that exceed [`work_mem`](runtime-config-resource.html#GUC-WORK-MEM) (Heikki Linnakangas) [§](https://postgr.es/c/65014000b) [§](https://postgr.es/c/166f94377) + + When the sort data no longer fits in `work_mem`, switch to a batch sorting algorithm that uses more output streams than before. +* Improve performance and reduce memory consumption of in-memory sorts (Ronan Dunklau, David Rowley, Thomas Munro, John Naylor) [§](https://postgr.es/c/91e9e89dc) [§](https://postgr.es/c/40af10b57) [§](https://postgr.es/c/697492434) +* Allow WAL [full page writes](runtime-config-wal.html#GUC-FULL-PAGE-WRITES) to use LZ4 and Zstandard compression (Andrey Borodin, Justin Pryzby) [§](https://postgr.es/c/4035cd5d4) [§](https://postgr.es/c/e9537321a) + + This is controlled by the [`wal_compression`](runtime-config-wal.html#GUC-WAL-COMPRESSION) server setting. +* Add support for writing WAL using [direct I/O](runtime-config-wal.html#GUC-WAL-SYNC-METHOD) on macOS (Thomas Munro) [§](https://postgr.es/c/2dbe89057) + + This only works if `max_wal_senders = 0` and `wal_level = minimal`. +* Allow [vacuum](routine-vacuuming.html "25.1. Routine Vacuuming") to be more aggressive in setting the oldest frozen and multi transaction id (Peter Geoghegan) [§](https://postgr.es/c/0b018faba) +* Allow a query referencing multiple [foreign tables](ddl-foreign-data.html "5.12. Foreign Data") to perform parallel foreign table scans in more cases (Andrey Lepikhov, Etsuro Fujita) [§](https://postgr.es/c/c2bb02bc2) +* Improve the performance of [window functions](functions-window.html "9.22. Window Functions") that use `row_number()`, `rank()`, `dense_rank()` and `count()` (David Rowley) [§](https://postgr.es/c/9d9c02ccd) +* Improve the performance of spinlocks on high-core-count ARM64 systems (Geoffrey Blake) [§](https://postgr.es/c/a82a5eee3) + +##### E.16.3.1.5. Monitoring + +* Enable default logging of checkpoints and slow autovacuum operations (Bharath Rupireddy) [§](https://postgr.es/c/64da07c41) + + This changes the default of [`log_checkpoints`](runtime-config-logging.html#GUC-LOG-CHECKPOINTS) to `on` and that of [`log_autovacuum_min_duration`](runtime-config-logging.html#GUC-LOG-AUTOVACUUM-MIN-DURATION) to 10 minutes. This will cause even an idle server to generate some log output, which might cause problems on resource-constrained servers without log file rotation. These defaults should be changed in such cases. +* Generate progress messages in the server log during slow server starts (Nitin Jadhav, Robert Haas) [§](https://postgr.es/c/9ce346eab) [§](https://postgr.es/c/e543906e2) + + The messages report the cause of the delay. The time interval for notification is controlled by the new server variable [`log_startup_progress_interval`](runtime-config-logging.html#GUC-LOG-STARTUP-PROGRESS-INTERVAL). +* Store [cumulative statistics system](monitoring-stats.html "28.2. The Cumulative Statistics System") data in shared memory (Kyotaro Horiguchi, Andres Freund, Melanie Plageman) [§](https://postgr.es/c/5891c7a8e) [§](https://postgr.es/c/b3abca681) + + Previously this data was sent to a statistics collector process via UDP packets, and could only be read by sessions after transferring it via the file system. There is no longer a separate statistics collector process. +* Add additional information to `VACUUM VERBOSE` and autovacuum logging messages (Peter Geoghegan) [§](https://postgr.es/c/872770fd6) [§](https://postgr.es/c/6e20f4600) [§](https://postgr.es/c/bdb71dbe8) +* Add [`EXPLAIN (BUFFERS)`](sql-explain.html "EXPLAIN") output for temporary file block I/O (Masahiko Sawada) [§](https://postgr.es/c/efb0ef909) +* Allow [log output](runtime-config-logging.html#GUC-LOG-DESTINATION) in JSON format (Sehrope Sarkuni, Michael Paquier) [§](https://postgr.es/c/dc686681e) + + The new setting is `log_destination = jsonlog`. +* Allow [`pg_stat_reset_single_table_counters()`](monitoring-stats.html#MONITORING-STATS-FUNCS-TABLE "Table 28.34. Additional Statistics Functions") to reset the counters of relations shared across all databases (Sadhuprasad Patro) [§](https://postgr.es/c/e04267844) +* Add [wait events](monitoring-stats.html#WAIT-EVENT-TABLE "Table 28.4. Wait Event Types") for local shell commands (Fujii Masao) [§](https://postgr.es/c/1b06d7bac) + + The new wait events are used when calling `archive_command`, `archive_cleanup_command`, `restore_command` and `recovery_end_command`. + +##### E.16.3.1.6. Privileges + +* Allow table accesses done by a [view](sql-createview.html "CREATE VIEW") to optionally be controlled by privileges of the view's caller (Christoph Heiss) [§](https://postgr.es/c/7faa5fc84) + + Previously, view accesses were always treated as being done by the view's owner. That's still the default. +* Allow members of the [`pg_write_server_files`](predefined-roles.html#PREDEFINED-ROLES-TABLE "Table 22.1. Predefined Roles") predefined role to perform server-side base backups (Dagfinn Ilmari Mannsåker) [§](https://postgr.es/c/7f6772317) + + Previously only superusers could perform such backups. +* Allow [`GRANT`](sql-grant.html "GRANT") to grant permissions to change individual server variables via `SET` and `ALTER SYSTEM` (Mark Dilger) [§](https://postgr.es/c/a0ffa885e) [§](https://postgr.es/c/a2944d872) + + The new function `has_parameter_privilege()` reports on this privilege. +* Add predefined role [`pg_checkpoint`](predefined-roles.html#PREDEFINED-ROLES-TABLE "Table 22.1. Predefined Roles") that allows members to run `CHECKPOINT` (Jeff Davis) [§](https://postgr.es/c/4168a4745) [§](https://postgr.es/c/d3526e59f) + + Previously checkpoints could only be run by superusers. +* Allow members of the [`pg_read_all_stats`](predefined-roles.html#PREDEFINED-ROLES-TABLE "Table 22.1. Predefined Roles") predefined role to access the views [`pg_backend_memory_contexts`](view-pg-backend-memory-contexts.html "54.4. pg_backend_memory_contexts") and [`pg_shmem_allocations`](view-pg-shmem-allocations.html "54.26. pg_shmem_allocations") (Bharath Rupireddy) [§](https://postgr.es/c/77ea4f943) + + Previously these views could only be accessed by superusers. +* Allow [`GRANT`](sql-grant.html "GRANT") to grant permissions on [`pg_log_backend_memory_contexts()`](functions-admin.html#FUNCTIONS-ADMIN-SIGNAL "9.27.2. Server Signaling Functions") (Jeff Davis) [§](https://postgr.es/c/f0b051e32) + + Previously this function could only be run by superusers. + +##### E.16.3.1.7. Server Configuration + +* Add server variable [`shared_memory_size`](runtime-config-preset.html#GUC-SHARED-MEMORY-SIZE) to report the size of allocated shared memory (Nathan Bossart) [§](https://postgr.es/c/bd1788051) [§](https://postgr.es/c/3b231596c) +* Add server variable [`shared_memory_size_in_huge_pages`](runtime-config-preset.html#GUC-SHARED-MEMORY-SIZE-IN-HUGE-PAGES) to report the number of huge memory pages required (Nathan Bossart) [§](https://postgr.es/c/43c1c4f65) [§](https://postgr.es/c/bbd4951b7) + + This is only supported on Linux. +* Honor server variable [`shared_preload_libraries`](runtime-config-client.html#GUC-SHARED-PRELOAD-LIBRARIES) in single-user mode (Jeff Davis) [§](https://postgr.es/c/2103266a3) + + This change supports use of `shared_preload_libraries` to load custom access methods and WAL resource managers, which would be essential for database access even in single-user mode. +* On Solaris, make the default setting of [`dynamic_shared_memory_type`](runtime-config-resource.html#GUC-DYNAMIC-SHARED-MEMORY-TYPE) be `sysv` (Thomas Munro) [§](https://postgr.es/c/a2b0719cc) + + The previous default choice, `posix`, can result in spurious failures on this platform. +* Allow [`postgres -C`](app-postgres.html "postgres") to properly report runtime-computed values (Nathan Bossart) [§](https://postgr.es/c/0c39c2920) + + Previously runtime-computed values [`data_checksums`](runtime-config-preset.html#GUC-DATA-CHECKSUMS), [`wal_segment_size`](runtime-config-preset.html#GUC-WAL-SEGMENT-SIZE), and [`data_directory_mode`](runtime-config-preset.html#GUC-DATA-DIRECTORY-MODE) would report values that would not be accurate on the running server. However, this does not work on a running server. + +#### E.16.3.2. Streaming Replication and Recovery + +* Add support for LZ4 and Zstandard compression of server-side [base backups](continuous-archiving.html#BACKUP-BASE-BACKUP "26.3.2. Making a Base Backup") (Jeevan Ladhe, Robert Haas) [§](https://postgr.es/c/dab298471) [§](https://postgr.es/c/7cf085f07) [§](https://postgr.es/c/51c0d186d) +* Run the checkpointer and bgwriter processes during crash recovery (Thomas Munro) [§](https://postgr.es/c/7ff23c6d2) + + This helps to speed up long crash recoveries. +* Allow WAL processing to pre-fetch needed file contents (Thomas Munro) [§](https://postgr.es/c/5dc0418fa) + + This is controlled by the server variable [`recovery_prefetch`](runtime-config-wal.html#GUC-RECOVERY-PREFETCH). +* Allow archiving via loadable modules (Nathan Bossart) [§](https://postgr.es/c/5ef1eefd7) + + Previously, archiving was only done by calling shell commands. The new server variable [`archive_library`](runtime-config-wal.html#GUC-ARCHIVE-LIBRARY) can be set to specify a library to be called for archiving. +* No longer require [`IDENTIFY_SYSTEM`](protocol-replication.html "55.4. Streaming Replication Protocol") to be run before `START_REPLICATION` (Jeff Davis) [§](https://postgr.es/c/8e7811e95) + +##### E.16.3.2.1. [Logical Replication](logical-replication.html "Chapter 31. Logical Replication") + +* Allow [publication](sql-createpublication.html "CREATE PUBLICATION") of all tables in a schema (Vignesh C, Hou Zhijie, Amit Kapila) [§](https://postgr.es/c/5a2832465) [§](https://postgr.es/c/1a2aaeb0d) [§](https://postgr.es/c/f256236fb) + + For example, this syntax is now supported: `CREATE PUBLICATION pub1 FOR TABLES IN SCHEMA s1,s2`. `ALTER PUBLICATION` supports a similar syntax. Tables added later to the listed schemas will also be replicated. +* Allow publication content to be filtered using a `WHERE` clause (Hou Zhijie, Euler Taveira, Peter Smith, Ajin Cherian, Tomas Vondra, Amit Kapila) [§](https://postgr.es/c/52e4f0cd4) [§](https://postgr.es/c/5a0796622) [§](https://postgr.es/c/676eeb6dd) + + Rows not satisfying the `WHERE` clause are not published. +* Allow publication content to be restricted to specific columns (Tomas Vondra, Álvaro Herrera, Rahila Syed) [§](https://postgr.es/c/923def9a5) +* Allow skipping of transactions on a subscriber using [`ALTER SUBSCRIPTION ... SKIP`](sql-altersubscription.html "ALTER SUBSCRIPTION") (Masahiko Sawada) [§](https://postgr.es/c/208c5d65b) +* Add support for prepared (two-phase) transactions to logical replication (Peter Smith, Ajin Cherian, Amit Kapila, Nikhil Sontakke, Stas Kelvich) [§](https://postgr.es/c/cda03cfed) [§](https://postgr.es/c/a8fd13cab) [§](https://postgr.es/c/63cf61cde) + + The new [`CREATE_REPLICATION_SLOT`](protocol-replication.html "55.4. Streaming Replication Protocol") option is called `TWO_PHASE`. pg\_recvlogical now supports a new `--two-phase` option during slot creation. +* Prevent logical replication of empty transactions (Ajin Cherian, Hou Zhijie, Euler Taveira) [§](https://postgr.es/c/d5a9d86d8) + + Previously, publishers would send empty transactions to subscribers if subscribed tables were not modified. +* Add SQL functions to monitor the directory contents of logical replication slots (Bharath Rupireddy) [§](https://postgr.es/c/1922d7c6e) + + The new functions are [`pg_ls_logicalsnapdir()`](functions-admin.html#FUNCTIONS-ADMIN-GENFILE-TABLE "Table 9.99. Generic File Access Functions"), `pg_ls_logicalmapdir()`, and `pg_ls_replslotdir()`. They can be run by members of the predefined `pg_monitor` role. +* Allow subscribers to stop the application of logical replication changes on error (Osumi Takamichi, Mark Dilger) [§](https://postgr.es/c/705e20f85) + + This is enabled with the subscriber option [`disable_on_error`](sql-createsubscription.html "CREATE SUBSCRIPTION") and avoids possible infinite error loops during stream application. +* Adjust subscriber server variables to match the publisher so datetime and float8 values are interpreted consistently (Japin Li) [§](https://postgr.es/c/f3d4019da) + + Some publishers might be relying on inconsistent behavior. +* Add system view [`pg_stat_subscription_stats`](monitoring-stats.html#MONITORING-PG-STAT-SUBSCRIPTION-STATS "28.2.9. pg_stat_subscription_stats") to report on subscriber activity (Masahiko Sawada) [§](https://postgr.es/c/8d74fc96d) [§](https://postgr.es/c/7a8507329) + + The new function [`pg_stat_reset_subscription_stats()`](monitoring-stats.html#MONITORING-STATS-FUNCTIONS "28.2.24. Statistics Functions") allows resetting these statistics counters. +* Suppress duplicate entries in the [`pg_publication_tables`](view-pg-publication-tables.html "54.17. pg_publication_tables") system view (Hou Zhijie) [§](https://postgr.es/c/a61bff2bf) + + In some cases a partition could appear more than once. + +#### E.16.3.3. Utility Commands + +* Add SQL [`MERGE`](sql-merge.html "MERGE") command to adjust one table to match another (Simon Riggs, Pavan Deolasee, Álvaro Herrera, Amit Langote) [§](https://postgr.es/c/7103ebb7a) + + This is similar to `INSERT ... ON CONFLICT` but more batch-oriented. +* Add support for `HEADER` option in [`COPY`](sql-copy.html "COPY") text format (Rémi Lapeyre) [§](https://postgr.es/c/43f33dc01) [§](https://postgr.es/c/072132f04) + + The new option causes the column names to be output, and optionally verified on input. +* Add new WAL-logged method for [database creation](sql-createdatabase.html "CREATE DATABASE") (Dilip Kumar) [§](https://postgr.es/c/9c08aea6a) + + This is the new default method for copying the template database, as it avoids the need for checkpoints during database creation. However, it might be slow if the template database is large, so the old method is still available. +* Allow [`CREATE DATABASE`](sql-createdatabase.html "CREATE DATABASE") to set the database OID (Shruthi Gowda, Antonin Houska) [§](https://postgr.es/c/aa0105141) +* Prevent [`DROP DATABASE`](sql-dropdatabase.html "DROP DATABASE"), [`DROP TABLESPACE`](sql-droptablespace.html "DROP TABLESPACE"), and [`ALTER DATABASE SET TABLESPACE`](sql-alterdatabase.html "ALTER DATABASE") from occasionally failing during concurrent use on Windows (Thomas Munro) [§](https://postgr.es/c/4eb217631) +* Allow foreign key [`ON DELETE SET`](ddl-constraints.html#DDL-CONSTRAINTS-FK "5.4.5. Foreign Keys") actions to affect only specified columns (Paul Martinez) [§](https://postgr.es/c/d6f96ed94) + + Previously, all of the columns in the foreign key were always affected. +* Allow [`ALTER TABLE`](sql-altertable.html "ALTER TABLE") to modify a table's `ACCESS METHOD` (Justin Pryzby, Jeff Davis) [§](https://postgr.es/c/b0483263d) +* Properly call object access hooks when [`ALTER TABLE`](sql-altertable.html "ALTER TABLE") causes table rewrites (Michael Paquier) [§](https://postgr.es/c/7b565843a) +* Allow creation of unlogged [sequences](sql-createsequence.html "CREATE SEQUENCE") (Peter Eisentraut) [§](https://postgr.es/c/344d62fb9) +* Track dependencies on individual columns in the results of functions returning composite types (Tom Lane) [§](https://postgr.es/c/c2fa113dd) + + Previously, if a view or rule contained a reference to a specific column within the result of a composite-returning function, that was not noted as a dependency; the view or rule was only considered to depend on the composite type as a whole. This meant that dropping the individual column would be allowed, causing problems in later use of the view or rule. The column-level dependency is now also noted, so that dropping such a column will be rejected unless the view is changed or dropped. + +#### E.16.3.4. Data Types + +* Allow the scale of a [`numeric`](datatype-numeric.html "8.1. Numeric Types") value to be negative, or greater than its precision (Dean Rasheed, Tom Lane) [§](https://postgr.es/c/085f931f5) + + This allows rounding of values to the left of the decimal point, e.g., `'1234'::numeric(4, -2)` returns 1200. +* Improve overflow detection when casting values to [interval](datatype-datetime.html "8.5. Date/Time Types") (Joe Koshakow) [§](https://postgr.es/c/e39f99046) +* Change the I/O format of type `"char"` for non-ASCII characters (Tom Lane) [§](https://postgr.es/c/c034b629c) +* Update the display width information of modern Unicode characters, like emojis (Jacob Champion) [§](https://postgr.es/c/bab982161) [§](https://postgr.es/c/f7e56f1f5) + + Also update from Unicode 5.0 to 14.0.0. There is now an automated way to keep Postgres updated with Unicode releases. + +#### E.16.3.5. Functions + +* Add multirange input to [`range_agg()`](functions-aggregate.html#FUNCTIONS-AGGREGATE-TABLE "Table 9.58. General-Purpose Aggregate Functions") (Paul Jungwirth) [§](https://postgr.es/c/7ae1619bc) +* Add [`MIN()`](tutorial-agg.html "2.7. Aggregate Functions") and `MAX()` aggregates for the [`xid8`](datatype-numeric.html#DATATYPE-INT "8.1.1. Integer Types") data type (Ken Kato) [§](https://postgr.es/c/400fc6b64) +* Add regular expression functions for compatibility with other relational systems (Gilles Darold, Tom Lane) [§](https://postgr.es/c/642433707) + + The new functions are [`regexp_count()`](functions-string.html#FUNCTIONS-STRING-OTHER "Table 9.10. Other String Functions and Operators"), `regexp_instr()`, `regexp_like()`, and `regexp_substr()`. Some new optional arguments were also added to `regexp_replace()`. +* Add the ability to compute the distance between [`polygons`](datatype-geometric.html#DATATYPE-POLYGON "8.8.6. Polygons") (Tom Lane) [§](https://postgr.es/c/c5c192d7b) +* Add [`to_char()`](functions-formatting.html#FUNCTIONS-FORMATTING-TABLE "Table 9.26. Formatting Functions") format codes `of`, `tzh`, and `tzm` (Nitin Jadhav) [§](https://postgr.es/c/9dde82899) + + The upper-case equivalents of these were already supported. +* When applying [`AT TIME ZONE`](functions-datetime.html#FUNCTIONS-DATETIME-ZONECONVERT "9.9.4. AT TIME ZONE") to a `time with time zone` value, use the transaction start time rather than wall clock time to determine whether DST applies (Aleksander Alekseev, Tom Lane) [§](https://postgr.es/c/388e71af8) + + This allows the conversion to be considered stable rather than volatile, and it saves a kernel call per invocation. +* Ignore NULL array elements in [`ts_delete()`](functions-textsearch.html#TEXTSEARCH-FUNCTIONS-TABLE "Table 9.43. Text Search Functions") and `setweight()` functions with array arguments (Jean-Christophe Arnu) [§](https://postgr.es/c/cbe25dcff) + + These functions effectively ignore empty-string array elements (since those could never match a valid lexeme). It seems consistent to let them ignore NULL elements too, instead of failing. +* Add support for petabyte units to [`pg_size_pretty()`](functions-admin.html#FUNCTIONS-ADMIN-DBSIZE "Table 9.94. Database Object Size Functions") and `pg_size_bytes()` (David Christensen) [§](https://postgr.es/c/ca2e4472b) +* Change [`pg_event_trigger_ddl_commands()`](functions-event-triggers.html#PG-EVENT-TRIGGER-DDL-COMMAND-END-FUNCTIONS "9.29.1. Capturing Changes at Command End") to output references to other sessions' temporary schemas using the actual schema name (Tom Lane) [§](https://postgr.es/c/024515cac) + + Previously this function reported all temporary schemas as `pg_temp`, but it's misleading to use that for any but the current session's temporary schema. + +#### E.16.3.6. [PL/pgSQL](plpgsql.html "Chapter 43. PL/pgSQL — SQL Procedural Language") + +* Fix enforcement of PL/pgSQL variable `CONSTANT` markings (Tom Lane) [§](https://postgr.es/c/ccd10a9bf) + + Previously, a variable could be used as a [`CALL`](plpgsql-control-structures.html#PLPGSQL-STATEMENTS-CALLING-PROCEDURE "43.6.3. Calling a Procedure") output parameter or refcursor `OPEN` variable despite being marked `CONSTANT`. + +#### E.16.3.7. [libpq](libpq.html "Chapter 34. libpq — C Library") + +* Allow IP address matching against a server certificate's Subject Alternative Name (Jacob Champion) [§](https://postgr.es/c/c1932e542) +* Allow `PQsslAttribute()` to report the SSL library type without requiring a libpq connection (Jacob Champion) [§](https://postgr.es/c/ebc8b7d44) +* Change query cancellations sent by the client to use the same TCP settings as normal client connections (Jelte Fennema) [§](https://postgr.es/c/5987feb70) + + This allows configured TCP timeouts to apply to query cancel connections. +* Prevent libpq event callback failures from forcing an error result (Tom Lane) [§](https://postgr.es/c/ce1e7a2f7) [§](https://postgr.es/c/2e372869a) + +#### E.16.3.8. Client Applications + +* Allow [pgbench](pgbench.html "pgbench") to retry after serialization and deadlock failures (Yugo Nagata, Marina Polyakova) [§](https://postgr.es/c/4a39f87ac) + +##### E.16.3.8.1. [psql](app-psql.html "psql") + +* Improve performance of psql's `\copy` command, by sending data in larger chunks (Heikki Linnakangas) [§](https://postgr.es/c/eec57115e) +* Add `\dconfig` command to report server variables (Mark Dilger, Tom Lane) [§](https://postgr.es/c/3e707fbb4) [§](https://postgr.es/c/5e70d8b5d) [§](https://postgr.es/c/139d46ee2) + + This is similar to the server-side `SHOW` command, but it can process patterns to show multiple variables conveniently. +* Add `\getenv` command to assign the value of an environment variable to a psql variable (Tom Lane) [§](https://postgr.es/c/33d3eeadb) +* Add `+` option to the `\lo_list` and `\dl` commands to show large-object privileges (Pavel Luzanov) [§](https://postgr.es/c/328dfbdab) +* Add a pager option for the `\watch` command (Pavel Stehule, Thomas Munro) [§](https://postgr.es/c/7c09d2797) + + This is only supported on Unix and is controlled by the `PSQL_WATCH_PAGER` environment variable. +* Make psql include intra-query double-hyphen comments in queries sent to the server (Tom Lane, Greg Nancarrow) [§](https://postgr.es/c/83884682f) [§](https://postgr.es/c/c2f654930) + + Previously such comments were removed from the query before being sent. Double-hyphen comments that are before any query text are not sent, and are not recorded as separate psql history entries. +* Adjust psql so that Readline's meta-`#` command will insert a double-hyphen comment marker (Tom Lane) [§](https://postgr.es/c/3d858af07) + + Previously a pound marker was inserted, unless the user had taken the trouble to configure a non-default comment marker. +* Make psql output all results when multiple queries are passed to the server at once (Fabien Coelho) [§](https://postgr.es/c/7844c9918) + + Previously, only the last query result was displayed. The old behavior can be restored by setting the `SHOW_ALL_RESULTS` psql variable to `off`. +* After an error is detected in `--single-transaction` mode, change the final `COMMIT` command to `ROLLBACK` only if `ON_ERROR_STOP` is set (Michael Paquier) [§](https://postgr.es/c/a3ff08e0b) + + Previously, detection of an error in a `-c` command or `-f` script file would lead to issuing `ROLLBACK` at the end, regardless of the value of `ON_ERROR_STOP`. +* Improve psql's tab completion (Shinya Kato, Dagfinn Ilmari Mannsåker, Peter Smith, Koyu Tanigawa, Ken Kato, David Fetter, Haiying Tang, Peter Eisentraut, Álvaro Herrera, Tom Lane, Masahiko Sawada) [§](https://postgr.es/c/e2ce88b58) [§](https://postgr.es/c/346511313) [§](https://postgr.es/c/d3fa87657) [§](https://postgr.es/c/f2bbadce6) [§](https://postgr.es/c/b0c066297) [§](https://postgr.es/c/0b0d277c3) [§](https://postgr.es/c/a5b336b8b) [§](https://postgr.es/c/0cd6d3b3c) [§](https://postgr.es/c/f44ceb46e) [§](https://postgr.es/c/9270778f4) [§](https://postgr.es/c/dfe67c0e8) [§](https://postgr.es/c/74527c3e0) [§](https://postgr.es/c/fefce9ef9) [§](https://postgr.es/c/95787e849) [§](https://postgr.es/c/02b8048ba) [§](https://postgr.es/c/020258fbd) [§](https://postgr.es/c/f0cd9097c) [§](https://postgr.es/c/7fa3db367) [§](https://postgr.es/c/2d2232933) [§](https://postgr.es/c/b5607b074) +* Limit support of psql's backslash commands to servers running PostgreSQL 9.2 or later (Tom Lane) [§](https://postgr.es/c/cf0cab868) + + Remove code that was only used when running with an older server. Commands that do not require any version-specific adjustments compared to 9.2 will still work. + +##### E.16.3.8.2. [pg\_dump](app-pgdump.html "pg_dump") + +* Make pg\_dump dump `public` schema ownership changes and security labels (Noah Misch) [§](https://postgr.es/c/a7a7be1f2) [§](https://postgr.es/c/7ac10f692) +* Improve performance of dumping databases with many objects (Tom Lane) [§](https://postgr.es/c/989596152) [§](https://postgr.es/c/be85727a3) [§](https://postgr.es/c/d5e8930f5) + + This will also improve the performance of [pg\_upgrade](pgupgrade.html "pg_upgrade"). +* Improve parallel pg\_dump's performance for tables with large TOAST tables (Tom Lane) [§](https://postgr.es/c/65aaed22a) +* Add dump/restore option `--no-table-access-method` to force restore to only use the default table access method (Justin Pryzby) [§](https://postgr.es/c/215862886) +* Limit support of pg\_dump and [pg\_dumpall](app-pg-dumpall.html "pg_dumpall") to servers running PostgreSQL 9.2 or later (Tom Lane) [§](https://postgr.es/c/30e7c175b) + +#### E.16.3.9. Server Applications + +* Add new [pg\_basebackup](app-pgbasebackup.html "pg_basebackup") option `--target` to control the base backup location (Robert Haas) [§](https://postgr.es/c/3500ccc39) + + The new options are `server` to write the backup locally and `blackhole` to discard the backup (for testing). +* Allow pg\_basebackup to do server-side gzip, LZ4, and Zstandard compression and client-side LZ4 and Zstandard compression of base backup files (Dipesh Pandit, Jeevan Ladhe) [§](https://postgr.es/c/751b8d23b) [§](https://postgr.es/c/7cf085f07) [§](https://postgr.es/c/0ad803291) + + Client-side `gzip` compression was already supported. +* Allow pg\_basebackup to compress on the server side and decompress on the client side before storage (Dipesh Pandit) [§](https://postgr.es/c/d45099425) + + This is accomplished by specifying compression on the server side and plain output format. +* Allow pg\_basebackup's `--compress` option to control the compression location (server or client), compression method, and compression options (Michael Paquier, Robert Haas) [§](https://postgr.es/c/5c649fe15) [§](https://postgr.es/c/0ad803291) [§](https://postgr.es/c/e1f860f13) +* Add the LZ4 compression method to [pg\_receivewal](app-pgreceivewal.html "pg_receivewal") (Georgios Kokolatos) [§](https://postgr.es/c/babbbb595) [§](https://postgr.es/c/042a923ad) + + This is enabled via `--compress=lz4` and requires binaries to be built using `--with-lz4`. +* Add additional capabilities to pg\_receivewal's `--compress` option (Georgios Kokolatos) [§](https://postgr.es/c/d62bcc8b0) +* Improve pg\_receivewal's ability to restart at the proper WAL location (Ronan Dunklau) [§](https://postgr.es/c/f61e1dd2c) + + Previously, pg\_receivewal would start based on the WAL file stored in the local archive directory, or at the sending server's current WAL flush location. With this change, if the sending server is running Postgres 15 or later, the local archive directory is empty, and a replication slot is specified, the replication slot's restart point will be used. +* Add [pg\_rewind](app-pgrewind.html "pg_rewind") option `--config-file` to simplify use when server configuration files are stored outside the data directory (Gunnar Bluth) [§](https://postgr.es/c/0d5c38757) + +##### E.16.3.9.1. [pg\_upgrade](pgupgrade.html "pg_upgrade") + +* Store pg\_upgrade's log and temporary files in a subdirectory of the new cluster called `pg_upgrade_output.d` (Justin Pryzby) [§](https://postgr.es/c/38bfae365) [§](https://postgr.es/c/a00849630) [§](https://postgr.es/c/f5047c129) + + Previously such files were left in the current directory, requiring manual cleanup. Now they are automatically removed on successful completion of pg\_upgrade. +* Disable default status reporting during pg\_upgrade operation if the output is not a terminal (Andres Freund) [§](https://postgr.es/c/27b02e070) + + The status reporting output can be enabled for non-tty usage by using `--verbose`. +* Make pg\_upgrade report all databases with invalid connection settings (Jeevan Ladhe) [§](https://postgr.es/c/26ebb0e28) + + Previously only the first database with an invalid connection setting was reported. +* Make pg\_upgrade preserve tablespace and database OIDs, as well as relation relfilenode numbers (Shruthi Gowda, Antonin Houska) [§](https://postgr.es/c/9a974cbcb) [§](https://postgr.es/c/aa0105141) [§](https://postgr.es/c/4ab5dae94) +* Add a `--no-sync` option to pg\_upgrade (Michael Paquier) [§](https://postgr.es/c/3d5ffccb6) + + This is recommended only for testing. +* Limit support of pg\_upgrade to old servers running PostgreSQL 9.2 or later (Tom Lane) [§](https://postgr.es/c/e469f0aaf) + +##### E.16.3.9.2. [pg\_waldump](pgwaldump.html "pg_waldump") + +* Allow pg\_waldump output to be filtered by relation file node, block number, fork number, and full page images (David Christensen, Thomas Munro) [§](https://postgr.es/c/127aea2a6) [§](https://postgr.es/c/52b556843) +* Make pg\_waldump report statistics before an interrupted exit (Bharath Rupireddy) [§](https://postgr.es/c/f2c52eeba) + + For example, issuing a control-C in a terminal running `pg_waldump --stats --follow` will report the current statistics before exiting. This does not work on Windows. +* Improve descriptions of some transaction WAL records reported by pg\_waldump (Masahiko Sawada, Michael Paquier) [§](https://postgr.es/c/c8b733c4c) +* Allow pg\_waldump to dump information about multiple resource managers (Heikki Linnakangas) [§](https://postgr.es/c/c8bf5098c) + + This is enabled by specifying the `--rmgr` option multiple times. + +#### E.16.3.10. Documentation + +* Add documentation for [`pg_encoding_to_char()`](functions-info.html#FUNCTIONS-INFO-CATALOG-TABLE "Table 9.71. System Catalog Information Functions") and `pg_char_to_encoding()` (Ian Lawrence Barwick) [§](https://postgr.es/c/f6b5d05ba) +* Document the [`^@`](functions-string.html#FUNCTIONS-STRING-OTHER "Table 9.10. Other String Functions and Operators") starts-with operator (Tom Lane) [§](https://postgr.es/c/2ae5d72f0) + +#### E.16.3.11. Source Code + +* Add support for continuous integration testing using cirrus-ci (Andres Freund, Thomas Munro, Melanie Plageman) [§](https://postgr.es/c/93d973494) +* Add configure option [`--with-zstd`](install-procedure.html#CONFIGURE-OPTIONS-FEATURES "17.4.1.2. PostgreSQL Features") to enable Zstandard builds (Jeevan Ladhe, Robert Haas, Michael Paquier) [§](https://postgr.es/c/6c417bbcc) +* Add an ABI identifier field to the magic block in loadable libraries, allowing non-community PostgreSQL distributions to identify libraries that are not compatible with other builds (Peter Eisentraut) [§](https://postgr.es/c/d6d1dfcc9) + + An ABI field mismatch will generate an error at load time. +* Create a new [`pg_type.typcategory`](catalog-pg-type.html "53.64. pg_type") value for `"char"` (Tom Lane) [§](https://postgr.es/c/07eee5a0d) + + Some other internal-use-only types have also been assigned to this category. +* Add new protocol message [`TARGET`](protocol-replication.html#PROTOCOL-REPLICATION-BASE-BACKUP) to specify a new `COPY` method to be used for base backups (Robert Haas) [§](https://postgr.es/c/cc333f323) + + [pg\_basebackup](app-pgbasebackup.html "pg_basebackup") now uses this method. +* Add new protocol message [`COMPRESSION`](protocol-replication.html#PROTOCOL-REPLICATION-BASE-BACKUP) and `COMPRESSION_DETAIL` to specify the compression method and options (Robert Haas) [§](https://postgr.es/c/0ad803291) [§](https://postgr.es/c/ffd53659c) +* Remove server support for old `BASE_BACKUP` command syntax and base backup protocol (Robert Haas) [§](https://postgr.es/c/9cd28c2e5) [§](https://postgr.es/c/0d4513b61) +* Add support for extensions to set custom backup targets (Robert Haas) [§](https://postgr.es/c/e4ba69f3f) +* Allow extensions to define custom WAL resource managers (Jeff Davis) [§](https://postgr.es/c/5c279a6d3) +* Add function [`pg_settings_get_flags()`](functions-info.html#FUNCTIONS-INFO-CATALOG-TABLE "Table 9.71. System Catalog Information Functions") to get the flags of server variables (Justin Pryzby) [§](https://postgr.es/c/d10e41d42) +* On Windows, export all the server's global variables using `PGDLLIMPORT` markers (Robert Haas) [§](https://postgr.es/c/8ec569479) + + Previously, only specific variables were accessible to extensions on Windows. +* Require GNU make version 3.81 or later to build PostgreSQL (Tom Lane) [§](https://postgr.es/c/3b474a2e6) +* Require OpenSSL to build the [pgcrypto](pgcrypto.html "F.28. pgcrypto") extension (Peter Eisentraut) [§](https://postgr.es/c/db7d1a7b0) +* Require Perl version 5.8.3 or later (Dagfinn Ilmari Mannsåker) [§](https://postgr.es/c/92e6a98c3) +* Require Python version 3.2 or later (Andres Freund) [§](https://postgr.es/c/19252e8ec) + +#### E.16.3.12. Additional Modules + +* Allow [amcheck](amcheck.html "F.2. amcheck") to check sequences (Mark Dilger) [§](https://postgr.es/c/c3b011d99) +* Improve amcheck sanity checks for TOAST tables (Mark Dilger) [§](https://postgr.es/c/bd807be69) +* Add new module [basebackup\_to\_shell](basebackup-to-shell.html "F.5. basebackup_to_shell") as an example of a custom backup target (Robert Haas) [§](https://postgr.es/c/c6306db24) [§](https://postgr.es/c/26a0c025e) +* Add new module [basic\_archive](basic-archive.html "F.6. basic_archive") as an example of performing archiving via a library (Nathan Bossart) [§](https://postgr.es/c/5ef1eefd7) +* Allow [btree\_gist](btree-gist.html "F.9. btree_gist") indexes on boolean columns (Emre Hasegeli) [§](https://postgr.es/c/57e3c5160) [§](https://postgr.es/c/e2fbb8837) [§](https://postgr.es/c/4c6145b51) + + These can be used for exclusion constraints. +* Fix [pageinspect](pageinspect.html "F.25. pageinspect")'s `page_header()` to handle 32-kilobyte page sizes (Quan Zongliang) [§](https://postgr.es/c/127404fbe) + + Previously, improper negative values could be returned in certain cases. +* Add counters for temporary file block I/O to [pg\_stat\_statements](pgstatstatements.html "F.32. pg_stat_statements") (Masahiko Sawada) [§](https://postgr.es/c/76cbf7edb) +* Add JIT counters to pg\_stat\_statements (Magnus Hagander) [§](https://postgr.es/c/57d6aea00) +* Add new module [pg\_walinspect](pgwalinspect.html "F.37. pg_walinspect") (Bharath Rupireddy) [§](https://postgr.es/c/2258e76f9) + + This gives SQL-level output similar to [pg\_waldump](pgwaldump.html "pg_waldump"). +* Indicate the permissive/enforcing state in [sepgsql](sepgsql.html "F.40. sepgsql") log messages (Dave Page) [§](https://postgr.es/c/134d97463) + +##### E.16.3.12.1. [postgres\_fdw](postgres-fdw.html "F.38. postgres_fdw") + +* Allow postgres\_fdw to push down `CASE` expressions (Alexander Pyhalov) [§](https://postgr.es/c/5d44fff01) +* Add server variable `postgres_fdw.application_name` to control the application name of postgres\_fdw connections (Hayato Kuroda) [§](https://postgr.es/c/449ab6350) [§](https://postgr.es/c/6e0cb3dec) [§](https://postgr.es/c/94c49d534) + + Previously the remote session's [`application_name`](runtime-config-logging.html#GUC-APPLICATION-NAME) could only be set on the remote server or via a postgres\_fdw connection specification. `postgres_fdw.application_name` supports some escape sequences for customization, making it easier to tell such connections apart on the remote server. +* Allow parallel commit on postgres\_fdw servers (Etsuro Fujita) [§](https://postgr.es/c/04e706d42) + + This is enabled with the `CREATE SERVER` option `parallel_commit`. + +### E.16.4. Acknowledgments + +The following individuals (in alphabetical order) have contributed to this release as patch authors, committers, reviewers, testers, or reporters of issues. + +| | +| --- | +| Abhijit Menon-Sen | +| Adam Brusselback | +| Adam Mackler | +| Adrian Ho | +| Ahsan Hadi | +| Ajin Cherian | +| Alastair McKinley | +| Aleksander Alekseev | +| Ales Zeleny | +| Alex Kingsborough | +| Alex Kozhemyakin | +| Alexander Korotkov | +| Alexander Kukushkin | +| Alexander Lakhin | +| Alexander Nawratil | +| Alexander Pyhalov | +| Alexey Borzov | +| Alexey Ermakov | +| Aliaksandr Kalenik | +| Álvaro Herrera | +| Amit Kapila | +| Amit Khandekar | +| Amit Langote | +| Amul Sul | +| Anastasia Lubennikova | +| Anders Kaseorg | +| Andreas Dijkman | +| Andreas Grob | +| Andreas Seltenreich | +| Andrei Zubkov | +| Andres Freund | +| Andrew Alsup | +| Andrew Bille | +| Andrew Dunstan | +| Andrew Gierth | +| Andrew Kesper | +| Andrey Borodin | +| Andrey Lepikhov | +| Andrey Sokolov | +| Andy Fan | +| Anton Melnikov | +| Anton Voloshin | +| Antonin Houska | +| Arjan van de Ven | +| Arne Roland | +| Arthur Zakirov | +| Ashutosh Bapat | +| Ashutosh Sharma | +| Ashwin Agrawal | +| Asif Rehman | +| Asim Praveen | +| Atsushi Torikoshi | +| Aya Iwata | +| Bauyrzhan Sakhariyev | +| Benoit Lobréau | +| Bernd Dorn | +| Bertrand Drouvot | +| Bharath Rupireddy | +| Björn Harrtell | +| Boris Kolpackov | +| Boris Korzun | +| Brad Nicholson | +| Brar Piening | +| Bruce Momjian | +| Bruno da Silva | +| Bryn Llewellyn | +| Carl Sopchak | +| Cary Huang | +| Chapman Flack | +| Chen Jiaoqian | +| Chris Bandy | +| Chris Lowder | +| Christian Quest | +| Christoph Berg | +| Christoph Heiss | +| Christophe Pettus | +| Christopher Painter-Wakefield | +| Claudio Freire | +| Clemens Zeidler | +| Corey Huinker | +| Dag Lem | +| Dagfinn Ilmari Mannsåker | +| Dan Kubb | +| Daniel Cherniy | +| Daniel Gustafsson | +| Daniel Polski | +| Daniel Vérité | +| Daniel Westermann | +| Daniele Varrazzo | +| Daniil Anisimov | +| Danny Shemesh | +| Darafei Praliaskouski | +| Daria Lepikhova | +| Dave Cramer | +| Dave Page | +| David Christensen | +| David Fetter | +| David G. Johnston | +| David Rowley | +| David Steele | +| David Zhang | +| Dean Rasheed | +| Dian Fay | +| Dilip Kumar | +| Dipesh Pandit | +| Dmitry Dolgov | +| Dmitry Koval | +| Dmitry Marakasov | +| Dominique Devienne | +| Dong Wook | +| Drew DeVault | +| Eduard Català | +| Egor Chindyaskin | +| Egor Rogov | +| Ekaterina Kiryanova | +| Elena Indrupskaya | +| Elvis Pranskevichus | +| Emmanuel Quincerot | +| Emre Hasegeli | +| Eric Mutta | +| Erica Zhang | +| Erik Rijkers | +| Erki Eessaar | +| Etsuro Fujita | +| Euler Taveira | +| Fabien Coelho | +| Fabrice Chapuis | +| Fabrice Fontaine | +| Fabrízio de Royes Mello | +| Feike Steenbergen | +| Filip Gospodinov | +| Florin Irion | +| Floris Van Nee | +| Frédéric Yhuel | +| Gabriela Serventi | +| Gaurab Dey | +| Geoff Winkless | +| Geoffrey Blake | +| Georgios Kokolatos | +| Gilles Darold | +| Greg Nancarrow | +| Greg Rychlewski | +| Greg Sabino Mullane | +| Greg Stark | +| Gregory Smith | +| Guillaume Lelarge | +| Gunnar Bluth | +| Gurjeet Singh | +| Haiyang Wang | +| Haiying Tang | +| Hannu Krosing | +| Hans Buschmann | +| Hayato Kuroda | +| Heath Lord | +| Heikki Linnakangas | +| Herwig Goemans | +| Himanshu Upadhyaya | +| Holly Roberts | +| Hou Zhijie | +| Hubert Lubaczewski | +| Ian Barwick | +| Ian Campbell | +| Ibrar Ahmed | +| Ildus Kurbangaliev | +| Ilya Anfimov | +| Itamar Gafni | +| Jacob Champion | +| Jaime Casanova | +| Jakub Wartak | +| James Coleman | +| James Hilliard | +| James Inform | +| Jan Piotrowski | +| Japin Li | +| Jason Harvey | +| Jason Kim | +| Jean-Christophe Arnu | +| Jeevan Ladhe | +| Jeff Davis | +| Jeff Janes | +| Jehan-Guillaume de Rorthais | +| Jelte Fennema | +| Jeremy Evans | +| Jeremy Schneider | +| Jian Guo | +| Jian He | +| Jimmy Yih | +| Jiri Fejfar | +| Jitka Plesníková | +| Joe Conway | +| Joe Wildish | +| Joel Jacobson | +| Joey Bodoia | +| John Naylor | +| Jonathan Katz | +| Josef Simanek | +| Joseph Koshakow | +| Josh Soref | +| Joshua Brindle | +| Juan José Santamaría Flecha | +| Julien Rouhaud | +| Julien Roze | +| Junwang Zhao | +| Jürgen Purtz | +| Justin Pryzby | +| Ken Kato | +| Kevin Burke | +| Kevin Grittner | +| Kevin Humphreys | +| Kevin McKibbin | +| Kevin Sweet | +| Kevin Zheng | +| Klaudie Willis | +| Konstantin Knizhnik | +| Konstantina Skovola | +| Kosei Masumura | +| Kotaro Kawamoto | +| Koyu Tanigawa | +| Kuntal Ghosh | +| Kyotaro Horiguchi | +| Lars Kanis | +| Lauren Fliksteen | +| Laurent Hasson | +| Laurenz Albe | +| Leslie Lemaire | +| Liam Bowen | +| Lingjie Qiang | +| Liu Huailing | +| Louis Jachiet | +| Lukas Fittl | +| Ma Liangzhu | +| Maciek Sakrejda | +| Magnus Hagander | +| Mahendra Singh Thalor | +| Maksim Milyutin | +| Marc Bachmann | +| Marcin Krupowicz | +| Marcus Gartner | +| Marek Szuba | +| Marina Polyakova | +| Mario Emmenlauer | +| Mark Dilger | +| Mark Murawski | +| Mark Wong | +| Markus Wanner | +| Markus Winand | +| Martijn van Oosterhout | +| Martin Jurca | +| Martin Kalcher | +| Martín Marqués | +| Masahiko Sawada | +| Masahiro Ikeda | +| Masao Fujii | +| Masaya Kawamoto | +| Masayuki Hirose | +| Matthias van de Meent | +| Matthijs van der Vleuten | +| Maxim Orlov | +| Maxim Yablokov | +| Melanie Plageman | +| Michael Banck | +| Michael Harris | +| Michael J. Sullivan | +| Michael Meskes | +| Michael Mühlbeyer | +| Michael Paquier | +| Michael Powers | +| Mike Fiedler | +| Mike Oh | +| Mikhail Kulagin | +| Miles Delahunty | +| Naoki Okano | +| Nathan Bossart | +| Nathan Long | +| Nazir Bilal Yavuz | +| Neha Sharma | +| Neil Chen | +| Nicola Contu | +| Nicolas Lutic | +| Nikhil Benesch | +| Nikhil Shetty | +| Nikhil Sontakke | +| Nikita Glukhov | +| Nikolai Berkoff | +| Nikolay Samokhvalov | +| Nikolay Shaplov | +| Nitin Jadhav | +| Noah Misch | +| Noboru Saito | +| Noriyoshi Shinoda | +| Olaf Bohlen | +| Olly Betts | +| Onder Kalaci | +| Oskar Stenberg | +| Otto Kekalainen | +| Paul Guo | +| Paul Jungwirth | +| Paul Martinez | +| Pavan Deolasee | +| Pavel Borisov | +| Pavel Luzanov | +| Pavel Stehule | +| Peter Eisentraut | +| Peter Geoghegan | +| Peter Slavov | +| Peter Smith | +| Petr Jelínek | +| Phil Florent | +| Phil Krylov | +| Pierre-Aurélien Georges | +| Prabhat Sahu | +| Quan Zongliang | +| Rachel Heaton | +| Rahila Syed | +| Rajakavitha Kodhandapani | +| Rajkumar Raghuwanshi | +| Ranier Vilela | +| Rei Kamigishi | +| Reid Thompson | +| Rémi Lapeyre | +| Renan Soares Lopes | +| Richard Guo | +| Richard Wesley | +| RKN Sai Krishna | +| Robert Haas | +| Robert Treat | +| Roberto Mello | +| Robins Tharakan | +| Roger Mason | +| Roman Zharkov | +| Ronan Dunklau | +| Rui Zhao | +| Ryan Kelly | +| Ryo Matsumura | +| Ryohei Takahashi | +| Sadhuprasad Patro | +| Sait Talha Nisanci | +| Sami Imseih | +| Sandeep Thakkar | +| Sebastian Kemper | +| Sehrope Sarkuni | +| Sergei Kornilov | +| Sergei Shoulbakov | +| Sergey Shinderuk | +| Shay Rojansky | +| Shenhao Wang | +| Shi Yu | +| Shinya Kato | +| Shruthi Gowda | +| Simon Perepelitsa | +| Simon Riggs | +| Sirisha Chamarthi | +| Soumyadeep Chakraborty | +| Stan Hu | +| Stas Kelvich | +| Stefen Hillman | +| Stephen Frost | +| Steve Chavez | +| Sumanta Mukherjee | +| Suraj Khamkar | +| Suraj Kharage | +| Sven Klemm | +| Takamichi Osumi | +| Takayuki Tsunakawa | +| Takeshi Ideriha | +| Tatsuhiro Nakamori | +| Tatsuhito Kasahara | +| Tatsuo Ishii | +| Tatsuro Yamada | +| Teja Mupparti | +| Teodor Sigaev | +| Thibaud Walkowiak | +| Thom Brown | +| Thomas McKay | +| Thomas Munro | +| Tim McNamara | +| Timo Stolz | +| Timur Khanjanov | +| Tom Lane | +| Tomas Barton | +| Tomas Vondra | +| Tony Reix | +| Troy Frericks | +| Tushar Ahuja | +| Victor Wagner | +| Victor Yegorov | +| Vignesh C | +| Vik Fearing | +| Vincas Dargis | +| Vitaly Burovoy | +| Vitaly Voronov | +| Vladimir Sitnikov | +| Wang Ke | +| Wei Sun | +| Wei Wang | +| Whale Song | +| Will Mortensen | +| Wolfgang Walther | +| Yanliang Lei | +| Yaoguang Chen | +| Yogendra Suralkar | +| YoungHwan Joo | +| Yugo Nagata | +| Yukun Wang | +| Yura Sokolov | +| Yusuke Egashira | +| Yuzuko Hosoya | +| Zhang Mingli | +| Zhang Wenjie | +| Zhihong Yu | +| Zhiyong Wu | + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-15-1.html "E.15. Release 15.1") | [Up](release.html "Appendix E. Release Notes") | [Next](release-prior.html "E.17. Prior Releases") | +| E.15. Release 15.1 | [Home](index.html "PostgreSQL 15.15 Documentation") | E.17. Prior Releases | + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/15.1/) diff --git a/corpus/changelog/postgresql_releases/postgresql_151.md b/corpus/changelog/postgresql_releases/postgresql_151.md new file mode 100644 index 0000000000000000000000000000000000000000..5dcf4c2977782a62106634b147732c64e3def94e --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_151.md @@ -0,0 +1,116 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/15.1/ +Version: 15.1 + +## PostgreSQL 15.1 + +| E.15. Release 15.1 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-15-2.html "E.14. Release 15.2") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 15.15 Documentation") | [Next](release-15.html "E.16. Release 15") | + +--- + +## E.15. Release 15.1 + +[E.15.1. Migration to Version 15.1](release-15-1.html#id-1.11.6.20.4) + +[E.15.2. Changes](release-15-1.html#id-1.11.6.20.5) + +**Release date:**2022-11-10 + +This release contains a variety of fixes from 15.0. For information about new features in major release 15, see [Section E.16](release-15.html "E.16. Release 15"). + +### E.15.1. Migration to Version 15.1 + +A dump/restore is not required for those running 15.X. + +However, if you regularly create and drop tables exceeding 1GB, see the first changelog entry below. + +### E.15.2. Changes + +* Fix failure to remove non-first segments of large tables (Tom Lane) [§](https://postgr.es/c/5fe0ab420) + + PostgreSQL splits large tables into multiple files (normally with 1GB per file). The logic for dropping a table was broken and would miss removing all but the first such file, in two cases: drops of temporary tables and WAL replay of drops of regular tables. Applications that routinely create multi-gigabyte temporary tables could suffer significant disk space leakage. + + Orphaned temporary-table files are removed during postmaster start, so the mere act of updating to 15.1 is sufficient to clear any leaked temporary-table storage. However, if you suffered any database crashes while using 15.0, and there might have been large tables dropped just before such crashes, it's advisable to check the database directories for files named according to the pattern `NNNN.NN`. If there is no matching file named just `NNNN` (without the `.NN` suffix), these files should be removed manually. +* Fix handling of `DEFAULT` tokens that appear in a multi-row `VALUES` clause of an `INSERT` on an updatable view (Tom Lane) [§](https://postgr.es/c/07ce67698) + + This oversight could lead to “cache lookup failed for type” errors, or in older branches even to crashes. +* Disallow rules named `_RETURN` that are not `ON SELECT` (Tom Lane) [§](https://postgr.es/c/4a41a069e) + + This avoids confusion between a view's `ON SELECT` rule and any other rules it may have. +* Avoid failure in `EXPLAIN VERBOSE` for a query using `SEARCH BREADTH FIRST` with constant initial values (Tom Lane) [§](https://postgr.es/c/d4abb0bc5) +* Prevent use of `MERGE` on a partitioned table with foreign-table partitions (Álvaro Herrera) [§](https://postgr.es/c/16d11d684) + + The case isn't supported, and previously threw an incomprehensible error. +* Fix construction of per-partition foreign key constraints while doing `ALTER TABLE ATTACH PARTITION` (Jehan-Guillaume de Rorthais, Álvaro Herrera) [§](https://postgr.es/c/c301e1c0c) [§](https://postgr.es/c/6083132ab) + + Previously, incorrect or duplicate constraints could be constructed for the newly-added partition. +* Fix planner failure with extended statistics on partitioned or inherited tables (Richard Guo, Justin Pryzby) [§](https://postgr.es/c/1f1865e90) + + Some cases failed with “cache lookup failed for statistics object”. +* Fix mis-ordering of WAL operations in fast insert path for GIN indexes (Matthias van de Meent, Zhang Mingli) [§](https://postgr.es/c/ca4070f2b) + + This mistake is not known to have any negative consequences within core PostgreSQL, but it did cause issues for some extensions. +* Fix bugs in logical decoding when replay starts from a point between the beginning of a transaction and the beginning of its subtransaction (Masahiko Sawada, Kuroda Hayato) [§](https://postgr.es/c/64ff0fe4e) [§](https://postgr.es/c/343afa967) + + These errors could lead to assertion failures in debug builds, and otherwise to memory leaks. +* Accept interrupts in more places during logical decoding (Amit Kapila, Masahiko Sawada) [§](https://postgr.es/c/10eaa9750) [§](https://postgr.es/c/42681dffa) + + This ameliorates problems with slow shutdown of replication workers. +* Prevent attempts to replicate into a foreign-table partition in replication workers (Shi Yu, Tom Lane) [§](https://postgr.es/c/414d29a82) + + Although partitioned tables can have foreign tables as partitions, replicating into such a partition isn't currently supported. The logical replication worker process would crash if it was attempted. Now, an error is thrown. +* Avoid crash after function syntax error in replication workers (Maxim Orlov, Anton Melnikov, Masahiko Sawada, Tom Lane) [§](https://postgr.es/c/f2dc7f9e3) + + If a syntax error occurred in a SQL-language or PL/pgSQL-language `CREATE FUNCTION` or `DO` command executed in a logical replication worker, the worker process would crash with a null pointer dereference or assertion failure. +* Avoid double call of the shutdown callback of an archiver module (Nathan Bossart, Bharath Rupireddy) [§](https://postgr.es/c/5d2a47a29) +* Add plan-time check for attempted access to a table that has no table access method (Tom Lane) [§](https://postgr.es/c/2e3326929) + + This prevents a crash in some catalog-corruption scenarios, for example use of a view whose `ON SELECT` rule is missing. +* Prevent postmaster crash when shared-memory state is corrupted (Tom Lane) [§](https://postgr.es/c/e7b4ff327) + + The postmaster process is supposed to survive and initiate a database restart if shared memory becomes corrupted, but one bit of code was being insufficiently cautious about that. +* In libpq, handle single-row mode correctly when pipelining (Denis Laxalde) [§](https://postgr.es/c/27ca0bce5) + + The single-row flag was not reset at the correct time if pipeline mode was also active. +* Fix psql's exit status when a command-line query is canceled (Peter Eisentraut) [§](https://postgr.es/c/4a6de748d) + + `psql -c query` would exit successfully if the query was canceled. Fix it to exit with nonzero status, as in other error cases. +* Allow cross-platform tablespace relocation in pg\_basebackup (Robert Haas) [§](https://postgr.es/c/5c013e620) + + Allow the remote path in `--tablespace-mapping` to be either a Unix-style or Windows-style absolute path, since the source server could be on a different OS than the local system. +* Fix pg\_dump's failure to dump comments attached to some `CHECK` constraints (Tom Lane) [§](https://postgr.es/c/0eede9625) +* Fix `CREATE DATABASE` to allow its `oid` parameter to exceed 231 (Tom Lane) [§](https://postgr.es/c/2c6d43650) + + This oversight prevented pg\_upgrade from succeeding when the source installation contained databases with OIDs larger than that. +* In pg\_stat\_statements, fix access to already-freed memory (zhaoqigui) [§](https://postgr.es/c/8b0a5cf3f) + + This occurred if pg\_stat\_statements tracked a `ROLLBACK` command issued via extended query protocol. In debug builds it consistently led to an assertion failure. In production builds there would often be no visible ill effect; but if the freed memory had already been reused, the likely result would be to store garbage for the query string. +* Fix incompatibilities with LLVM 15 (Thomas Munro, Andres Freund) [§](https://postgr.es/c/af64846e1) +* Allow use of `__sync_lock_test_and_set()` for spinlocks on any machine (Tom Lane) [§](https://postgr.es/c/a5737e765) + + This eases porting to new machine architectures, at least if you're using a compiler that supports this GCC builtin function. +* Rename symbol `REF` to `REF_P` to avoid compile failure on recent macOS (Tom Lane) [§](https://postgr.es/c/24c4c2617) +* Avoid using `sprintf`, to avoid compile-time deprecation warnings (Tom Lane) [§](https://postgr.es/c/bd4b2926e) +* Update time zone data files to tzdata release 2022f for DST law changes in Chile, Fiji, Iran, Jordan, Mexico, Palestine, and Syria, plus historical corrections for Chile, Crimea, Iran, and Mexico. (Tom Lane) [§](https://postgr.es/c/c3d16eb3d) + + Also, the Europe/Kiev zone has been renamed to Europe/Kyiv. Also, the following zones have been merged into nearby, more-populous zones whose clocks have agreed with them since 1970: Antarctica/Vostok, Asia/Brunei, Asia/Kuala\_Lumpur, Atlantic/Reykjavik, Europe/Amsterdam, Europe/Copenhagen, Europe/Luxembourg, Europe/Monaco, Europe/Oslo, Europe/Stockholm, Indian/Christmas, Indian/Cocos, Indian/Kerguelen, Indian/Mahe, Indian/Reunion, Pacific/Chuuk, Pacific/Funafuti, Pacific/Majuro, Pacific/Pohnpei, Pacific/Wake and Pacific/Wallis. (This indirectly affects zones that were already links to one of these: Arctic/Longyearbyen, Atlantic/Jan\_Mayen, Iceland, Pacific/Ponape, Pacific/Truk, and Pacific/Yap.) America/Nipigon, America/Rainy\_River, America/Thunder\_Bay, Europe/Uzhgorod, and Europe/Zaporozhye were also merged into nearby zones after discovering that their claimed post-1970 differences from those zones seem to have been errors. In all these cases, the previous zone name remains as an alias; but the actual data is that of the zone that was merged into. + + These zone mergers result in loss of pre-1970 timezone history for the merged zones, which may be troublesome for applications expecting consistency of `timestamptz` display. As an example, the stored value `1944-06-01 12:00 UTC` would previously display as `1944-06-01 13:00:00+01` if the Europe/Stockholm zone is selected, but now it will read out as `1944-06-01 14:00:00+02`. + + It is possible to build the time zone data files with options that will restore the older zone data, but that choice also inserts a lot of other old (and typically poorly-attested) zone data, resulting in more total changes from the previous release than accepting these upstream changes does. PostgreSQL has chosen to ship the tzdb data as-recommended, and so far as we are aware most major operating system distributions are doing likewise. However, if these changes cause significant problems for your application, a possible solution is to install a local build of the time zone data files using tzdb's backwards-compatibility options (see their `PACKRATDATA` and `PACKRATLIST` options). + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-15-2.html "E.14. Release 15.2") | [Up](release.html "Appendix E. Release Notes") | [Next](release-15.html "E.16. Release 15") | +| E.14. Release 15.2 | [Home](index.html "PostgreSQL 15.15 Documentation") | E.16. Release 15 | + +[Previous](/docs/release/15.0/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/15.2/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1510.md b/corpus/changelog/postgresql_releases/postgresql_1510.md new file mode 100644 index 0000000000000000000000000000000000000000..d41161131255c2cbd5389bf0351b829a416856cf --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1510.md @@ -0,0 +1,66 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/15.10/ +Version: 15.10 + +## PostgreSQL 15.10 + +| E.6. Release 15.10 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-15-11.html "E.5. Release 15.11") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 15.15 Documentation") | [Next](release-15-9.html "E.7. Release 15.9") | + +--- + +## E.6. Release 15.10 + +[E.6.1. Migration to Version 15.10](release-15-10.html#id-1.11.6.11.4) + +[E.6.2. Changes](release-15-10.html#id-1.11.6.11.5) + +**Release date:**2024-11-21 + +This release contains a few fixes from 15.9. For information about new features in major release 15, see [Section E.16](release-15.html "E.16. Release 15"). + +### E.6.1. Migration to Version 15.10 + +A dump/restore is not required for those running 15.X. + +However, if you are upgrading from a version earlier than 15.9, see [Section E.7](release-15-9.html "E.7. Release 15.9"). + +### E.6.2. Changes + +* Repair ABI break for extensions that work with struct `ResultRelInfo` (Tom Lane) [§](https://postgr.es/c/17db248f3) + + Last week's minor releases unintentionally broke binary compatibility with timescaledb and several other extensions. Restore the affected structure to its previous size, so that such extensions need not be rebuilt. +* Restore functionality of `ALTER {ROLE|DATABASE} SET role` (Tom Lane, Noah Misch) [§](https://postgr.es/c/edf80895f) + + The fix for CVE-2024-10978 accidentally caused settings for `role` to not be applied if they come from non-interactive sources, including previous `ALTER {ROLE|DATABASE}` commands and the `PGOPTIONS` environment variable. +* Fix cases where a logical replication slot's `restart_lsn` could go backwards (Masahiko Sawada) [§](https://postgr.es/c/91771b3fb) + + Previously, restarting logical replication could sometimes cause the slot's restart point to be recomputed as an older value than had previously been advertised in `pg_replication_slots`. This is bad, since for example WAL files might have been removed on the basis of the later `restart_lsn` value, in which case replication would fail to restart. +* Avoid deleting still-needed WAL files during pg\_rewind (Polina Bungina, Alexander Kukushkin) [§](https://postgr.es/c/e28cf2fbc) + + Previously, in unlucky cases, it was possible for pg\_rewind to remove important WAL files from the rewound demoted primary. In particular this happens if those files have been marked for archival (i.e., their `.ready` files were created) but not yet archived. Then the newly promoted node no longer has such files because of them having been recycled, but likely they are needed for recovery in the demoted node. If pg\_rewind removes them, recovery is not possible anymore. +* Fix race conditions associated with dropping shared statistics entries (Kyotaro Horiguchi, Michael Paquier) [§](https://postgr.es/c/154c5b42a) + + These bugs could lead to loss of statistics data, assertion failures, or “can only drop stats once” errors. +* Count index scans in `contrib/bloom` indexes in the statistics views, such as the `pg_stat_user_indexes`.`idx_scan` counter (Masahiro Ikeda) [§](https://postgr.es/c/16a2bb079) +* Fix crash when checking to see if an index's opclass options have changed (Alexander Korotkov) [§](https://postgr.es/c/713b8546a) + + Some forms of `ALTER TABLE` would fail if the table has an index with non-default operator class options. +* Avoid assertion failure caused by disconnected NFA sub-graphs in regular expression parsing (Tom Lane) [§](https://postgr.es/c/2496c3f6f) + + This bug does not appear to have any visible consequences in non-assert builds. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-15-11.html "E.5. Release 15.11") | [Up](release.html "Appendix E. Release Notes") | [Next](release-15-9.html "E.7. Release 15.9") | +| E.5. Release 15.11 | [Home](index.html "PostgreSQL 15.15 Documentation") | E.7. Release 15.9 | + +[Previous](/docs/release/15.9/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/15.11/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1511.md b/corpus/changelog/postgresql_releases/postgresql_1511.md new file mode 100644 index 0000000000000000000000000000000000000000..48fd90ff2741d260969e44ab101b836a209cf184 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1511.md @@ -0,0 +1,166 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/15.11/ +Version: 15.11 + +## PostgreSQL 15.11 + +| E.5. Release 15.11 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-15-12.html "E.4. Release 15.12") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 15.15 Documentation") | [Next](release-15-10.html "E.6. Release 15.10") | + +--- + +## E.5. Release 15.11 + +[E.5.1. Migration to Version 15.11](release-15-11.html#id-1.11.6.10.4) + +[E.5.2. Changes](release-15-11.html#id-1.11.6.10.5) + +**Release date:**2025-02-13 + +This release contains a variety of fixes from 15.10. For information about new features in major release 15, see [Section E.16](release-15.html "E.16. Release 15"). + +### E.5.1. Migration to Version 15.11 + +A dump/restore is not required for those running 15.X. + +However, if you are upgrading from a version earlier than 15.9, see [Section E.7](release-15-9.html "E.7. Release 15.9"). + +### E.5.2. Changes + +* Harden `PQescapeString` and allied functions against invalidly-encoded input strings (Andres Freund, Noah Misch) [§](https://postgr.es/c/370c94d4c) [§](https://postgr.es/c/703b3fd5d) [§](https://postgr.es/c/b1756da75) [§](https://postgr.es/c/de4b92f33) [§](https://postgr.es/c/a085fa731) [§](https://postgr.es/c/9862de917) + + Data-quoting functions supplied by libpq now fully check the encoding validity of their input. If invalid characters are detected, they report an error if possible. For the ones that lack an error return convention, the output string is adjusted to ensure that the server will report invalid encoding and no intervening processing will be fooled by bytes that might happen to match single quote, backslash, etc. + + The purpose of this change is to guard against SQL-injection attacks that are possible if one of these functions is used to quote crafted input. There is no hazard when the resulting string is sent directly to a PostgreSQL server (which would check its encoding anyway), but there is a risk when it is passed through psql or other client-side code. Historically such code has not carefully vetted encoding, and in many cases it's not clear what it should do if it did detect such a problem. + + This fix is effective only if the data-quoting function, the server, and any intermediate processing agree on the character encoding that's being used. Applications that insert untrusted input into SQL commands should take special care to ensure that that's true. + + Applications and drivers that quote untrusted input without using these libpq functions may be at risk of similar problems. They should first confirm the data is valid in the encoding expected by the server. + + The PostgreSQL Project thanks Stephen Fewer for reporting this problem. (CVE-2025-1094) +* Exclude parallel workers from connection privilege checks and limits (Tom Lane) [§](https://postgr.es/c/3d1ecc92a) + + Do not check `datallowconn`, `rolcanlogin`, and `ACL_CONNECT` privileges when starting a parallel worker, instead assuming that it's enough for the leader process to have passed similar checks originally. This avoids, for example, unexpected failures of parallelized queries when the leader is running as a role that lacks login privilege. In the same vein, enforce `ReservedConnections`, `datconnlimit`, and `rolconnlimit` limits only against regular backends, and count only regular backends while checking if the limits were already reached. Those limits are meant to prevent excessive consumption of process slots for regular backends --- but parallel workers and other special processes have their own pools of process slots with their own limit checks. +* Fix possible re-use of stale results in window aggregates (David Rowley) [§](https://postgr.es/c/d54378e98) + + A window aggregate with a “run condition” optimization and a pass-by-reference result type might incorrectly return the result from the previous partition instead of performing a fresh calculation. +* Keep `TransactionXmin` in sync with `MyProc->xmin` (Heikki Linnakangas) [§](https://postgr.es/c/acd5c28db) + + This oversight could permit a process to try to access data that had already been vacuumed away. One known consequence is transient “could not access status of transaction” errors. +* Fix race condition that could cause failure to add a newly-inserted catalog entry to a catalog cache list (Heikki Linnakangas) [§](https://postgr.es/c/ce7c406f0) + + This could result, for example, in failure to use a newly-created function within an existing session. +* Prevent possible catalog corruption when a system catalog is vacuumed concurrently with an update (Noah Misch) [§](https://postgr.es/c/dc02b98bd) +* Fix data corruption when relation truncation fails (Thomas Munro) [§](https://postgr.es/c/fb540b6aa) [§](https://postgr.es/c/3181befdc) [§](https://postgr.es/c/190054e61) + + The filesystem calls needed to perform relation truncation could fail, leaving inconsistent state on disk (for example, effectively reviving deleted data). We can't really prevent that, but we can recover by dint of making such failures into PANICs, so that consistency is restored by replaying from WAL up to just before the attempted truncation. This isn't a hugely desirable behavior, but such failures are rare enough that it seems an acceptable solution. +* Prevent checkpoints from starting during relation truncation (Robert Haas) [§](https://postgr.es/c/a501fe5a9) + + This avoids a race condition wherein the modified file might not get fsync'd before completing the checkpoint, creating a risk of data corruption if the operating system crashes soon after. +* Use `rename()` not `link()`/`unlink()` to rename files (Nathan Bossart) [§](https://postgr.es/c/c1c9df315) + + The previous coding was intended to assure that the operation could not accidentally overwrite an existing file. However a failure could leave two links to the same file in existence, confusing subsequent operations and creating a risk of data corruption. In practice we do not use this functionality in places where the target filename could already exist, so it seems better to give up the no-overwrite guarantee to remove the multiple-link hazard. +* Avoid possibly losing an update of `pg_database`.`datfrozenxid` when `VACUUM` runs concurrently with a `REASSIGN OWNED` that changes that database's owner (Kirill Reshke) [§](https://postgr.es/c/83bb52375) +* Fix incorrect `tg_updatedcols` values passed to `AFTER UPDATE` triggers (Tom Lane) [§](https://postgr.es/c/cdeed4de7) + + In some cases the `tg_updatedcols` bitmap could describe the set of columns updated by an earlier command in the same transaction, fooling the trigger into doing the wrong thing. + + Also, prevent memory bloat caused by making too many copies of the `tg_updatedcols` bitmap. +* Fix detach of a partition that has its own foreign-key constraint referencing a partitioned table (Amul Sul) [§](https://postgr.es/c/1bc092519) + + In common cases, foreign keys are defined on a partitioned table's top level; but if instead one is defined on a partition and references a partitioned table, and the referencing partition is detached, the relevant `pg_constraint` entries were updated incorrectly. This led to errors like “could not find ON INSERT check triggers of foreign key constraint”. +* Fix mis-processing of `to_timestamp`'s `FFn` format codes (Tom Lane) [§](https://postgr.es/c/d2f59497a) + + An integer format code immediately preceding `FFn` would consume all available digits, leaving none for `FFn`. +* When deparsing an `XMLTABLE()` expression, ensure that XML namespace names are double-quoted when necessary (Dean Rasheed) [§](https://postgr.es/c/7c0379516) +* Include the `ldapscheme` option in `pg_hba_file_rules()` output (Laurenz Albe) [§](https://postgr.es/c/830215a4c) [§](https://postgr.es/c/9ad7a32b2) +* Don't merge `UNION` operations if their column collations aren't consistent (Tom Lane) [§](https://postgr.es/c/fd3383ff1) + + Previously we ignored collations when deciding if it's safe to merge `UNION` steps into a single N-way `UNION` operation. This was arguably valid before the introduction of nondeterministic collations, but it's not anymore, since the collation in use can affect the definition of uniqueness. +* Fix missed expression processing for partition pruning steps (Tom Lane) [§](https://postgr.es/c/724ebebb1) + + This oversight could lead to “unrecognized node type” errors, and perhaps other problems, in queries accessing partitioned tables. +* Allow dshash tables to grow past 1GB (Matthias van de Meent) [§](https://postgr.es/c/9f7b7d516) + + This avoids errors like “invalid DSA memory alloc request size”. The case can occur for example in transactions that process several million tables. +* Avoid possible integer overflow in `bringetbitmap()` (James Hunter, Evgeniy Gorbanyov) [§](https://postgr.es/c/9e9f30139) + + Since the result is only used for statistical purposes, the effects of this error were mostly cosmetic. +* Prevent streaming standby servers from looping infinitely when reading a WAL record that crosses pages (Kyotaro Horiguchi, Alexander Kukushkin) [§](https://postgr.es/c/26554facc) + + This would happen when the record's continuation is on a page that needs to be read from a different WAL source. +* Fix unintended promotion of FATAL errors to PANIC during early process startup (Noah Misch) [§](https://postgr.es/c/839da50bd) + + This fixes some unlikely cases that would result in “PANIC: proc\_exit() called in child process”. +* Fix cases where an operator family member operator or support procedure could become a dangling reference (Tom Lane) [§](https://postgr.es/c/0e4fa06ba) [§](https://postgr.es/c/d40191467) + + In some cases a data type could be dropped while references to its OID still remain in `pg_amop` or `pg_amproc`. While that caused no immediate issues, an attempt to drop the owning operator family would fail, and pg\_dump would produce bogus output when dumping the operator family. This fix causes creation and modification of operator families/classes to add needed dependency entries so that dropping a data type will also drop any dependent operator family elements. That does not help vulnerable pre-existing operator families, though, so a band-aid has also been added to `DROP OPERATOR FAMILY` to prevent failure when dropping a family that has dangling members. +* Fix multiple memory leaks in logical decoding output (Vignesh C, Masahiko Sawada, Boyu Yang) [§](https://postgr.es/c/da8bd5d42) [§](https://postgr.es/c/6c9b39754) [§](https://postgr.es/c/6fc30c24c) +* Avoid low-probability crash on out-of-memory, due to missing check for failure return from `malloc()` (Karina Litskevich) [§](https://postgr.es/c/4398507df) +* Avoid integer overflow while testing `wal_skip_threshold` condition (Tom Lane) [§](https://postgr.es/c/b296e55b4) + + A transaction that created a very large relation could mistakenly decide to ensure durability by copying the relation into WAL instead of fsync'ing it, thereby negating the point of `wal_skip_threshold`. (This only matters when `wal_level` is set to `minimal`, else a WAL copy is required anyway.) +* Fix unsafe order of operations during cache lookups (Noah Misch) [§](https://postgr.es/c/941e0c0df) + + The only known consequence was a usually-harmless “you don't own a lock of type ExclusiveLock” warning during `GRANT TABLESPACE`. +* Fix possible “failed to resolve name” failures when using JIT on older ARM platforms (Thomas Munro) [§](https://postgr.es/c/15ab513fe) + + This could occur as a consequence of inconsistency about the default setting of `-moutline-atomics` between gcc and clang. At least Debian and Ubuntu are known to ship gcc and clang compilers that target armv8-a but differ on the use of outline atomics by default. +* Fix handling of Windows junction points that are not of PostgreSQL origin (Thomas Munro) [§](https://postgr.es/c/9b136b0f2) [§](https://postgr.es/c/e708f3188) + + Previously, initdb would fail if the path to the data directory included junction points whose expansion isn't in “drive absolute” format, or whose expansion points to another junction point. +* Fix assertion failure in `WITH RECURSIVE ... UNION` queries (David Rowley) [§](https://postgr.es/c/ef178d38b) +* Avoid assertion failure in rule deparsing if a set operation leaf query contains set operations (Man Zeng, Tom Lane) [§](https://postgr.es/c/9b9689e26) +* Avoid edge-case assertion failure in parallel query startup (Tom Lane) [§](https://postgr.es/c/4089b9bd6) +* Fix assertion failure at shutdown when writing out the statistics file (Michael Paquier) [§](https://postgr.es/c/1df1e1e78) +* In `NULLIF()`, avoid passing a read-write expanded object pointer to the data type's equality function (Tom Lane) [§](https://postgr.es/c/80cd33bad) + + The equality function could modify or delete the object if it's given a read-write pointer, which would be bad if we decide to return it as the `NULLIF()` result. There is probably no problem with any built-in equality function, but it's easy to demonstrate a failure with one coded in PL/pgSQL. +* Ensure that expression preprocessing is applied to a default null value in `INSERT` (Tom Lane) [§](https://postgr.es/c/bb85d0935) + + If the target column is of a domain type, the planner must insert a coerce-to-domain step not just a null constant, and this expression missed going through some required processing steps. There is no known consequence with domains based on core data types, but in theory an error could occur with domains based on extension types. +* Repair memory leaks in PL/Python (Mat Arye, Tom Lane) [§](https://postgr.es/c/71bb9c4b2) + + Repeated use of `PLyPlan.execute` or `plpy.cursor` resulted in memory leakage for the duration of the calling PL/Python function. +* Fix PL/Tcl to compile with Tcl 9 (Peter Eisentraut) [§](https://postgr.es/c/a5f9cbde9) +* In the ecpg preprocessor, fix possible misprocessing of cursors that reference out-of-scope variables (Tom Lane) [§](https://postgr.es/c/60b47525c) +* In ecpg, fix compile-time warnings about unsupported use of `COPY ... FROM STDIN` (Ryo Kanbayashi) [§](https://postgr.es/c/71ef47cf0) + + Previously, the intended warning was not issued due to a typo. +* Fix psql to safely handle file path names that are encoded in SJIS (Tom Lane) [§](https://postgr.es/c/b17e3970c) + + Some two-byte characters in SJIS have a second byte that is equal to ASCII backslash (`\`). These characters were corrupted by path name normalization, preventing access to files whose names include such characters. +* Fix use of wrong version of `pqsignal()` in pgbench and psql (Fujii Masao, Tom Lane) [§](https://postgr.es/c/a3b709cf7) + + This error could lead to misbehavior when using the `-T` option in pgbench or the `\watch` command in psql, due to interrupted system calls not being resumed as expected. +* Fix misexecution of some nested `\if` constructs in pgbench (Michail Nikolaev) [§](https://postgr.es/c/ff88db910) + + An `\if` command appearing within a false (not-being-executed) `\if` branch was incorrectly treated the same as `\elif`. +* In pgbench, fix possible misdisplay of progress messages during table initialization (Yushi Ogiwara, Tatsuo Ishii, Fujii Masao) [§](https://postgr.es/c/1e46f7351) [§](https://postgr.es/c/499d1cf55) +* Make pg\_controldata more robust against corrupted `pg_control` files (Ilyasov Ian, Anton Voloshin) [§](https://postgr.es/c/f1e0b078b) + + Since pg\_controldata will attempt to print the contents of `pg_control` even if the CRC check fails, it must take care not to misbehave for invalid field values. This patch fixes some issues triggered by invalid timestamps and apparently-negative WAL segment sizes. +* Fix possible crash in pg\_dump with identity sequences attached to tables that are extension members (Tom Lane) [§](https://postgr.es/c/6978129b4) +* Fix pg\_basebackup to correctly handle `pg_wal.tar` files exceeding 2GB on Windows (Davinder Singh, Thomas Munro) [§](https://postgr.es/c/6b6901a26) [§](https://postgr.es/c/70a7a3761) +* Update configuration probes that determine the compiler switches needed to access ARM CRC instructions (Tom Lane) [§](https://postgr.es/c/851c6ff18) + + On ARM platforms where the baseline CPU target lacks CRC instructions, we need to supply a `-march` switch to persuade the compiler to compile such instructions. Recent versions of gcc reject the value we were trying, leading to silently falling back to software CRC. +* During configure, if a C23 compiler is detected, try asking for C17 (Thomas Munro) [§](https://postgr.es/c/f00c401c6) + + PostgreSQL versions before v16 will not compile under C23 rules. If the chosen compiler defaults to C23 or later, try adding a `-std=gnu17` switch to change that. (If this won't work for your compiler, manually specify `CFLAGS` with a suitable switch.) +* Update time zone data files to tzdata release 2025a for DST law changes in Paraguay, plus historical corrections for the Philippines (Tom Lane) [§](https://postgr.es/c/48bc95d0d) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-15-12.html "E.4. Release 15.12") | [Up](release.html "Appendix E. Release Notes") | [Next](release-15-10.html "E.6. Release 15.10") | +| E.4. Release 15.12 | [Home](index.html "PostgreSQL 15.15 Documentation") | E.6. Release 15.10 | + +[Previous](/docs/release/15.10/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/15.12/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1512.md b/corpus/changelog/postgresql_releases/postgresql_1512.md new file mode 100644 index 0000000000000000000000000000000000000000..e838c7bc9617b1f22b34b06d1d8a3fce2ce5bf1b --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1512.md @@ -0,0 +1,49 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/15.12/ +Version: 15.12 + +## PostgreSQL 15.12 + +| E.4. Release 15.12 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-15-13.html "E.3. Release 15.13") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 15.15 Documentation") | [Next](release-15-11.html "E.5. Release 15.11") | + +--- + +## E.4. Release 15.12 + +[E.4.1. Migration to Version 15.12](release-15-12.html#id-1.11.6.9.4) + +[E.4.2. Changes](release-15-12.html#id-1.11.6.9.5) + +**Release date:**2025-02-20 + +This release contains a few fixes from 15.11. For information about new features in major release 15, see [Section E.16](release-15.html "E.16. Release 15"). + +### E.4.1. Migration to Version 15.12 + +A dump/restore is not required for those running 15.X. + +However, if you are upgrading from a version earlier than 15.9, see [Section E.7](release-15-9.html "E.7. Release 15.9"). + +### E.4.2. Changes + +* Improve behavior of libpq's quoting functions (Andres Freund, Tom Lane) [§](https://postgr.es/c/22ffbbf24) [§](https://postgr.es/c/e782a63cc) [§](https://postgr.es/c/2226a2e26) + + The changes made for CVE-2025-1094 had one serious oversight: `PQescapeLiteral()` and `PQescapeIdentifier()` failed to honor their string length parameter, instead always reading to the input string's trailing null. This resulted in including unwanted text in the output, if the caller intended to truncate the string via the length parameter. With very bad luck it could cause a crash due to reading off the end of memory. + + In addition, modify all these quoting functions so that when invalid encoding is detected, an invalid sequence is substituted for just the first byte of the presumed character, not all of it. This reduces the risk of problems if a calling application performs additional processing on the quoted string. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-15-13.html "E.3. Release 15.13") | [Up](release.html "Appendix E. Release Notes") | [Next](release-15-11.html "E.5. Release 15.11") | +| E.3. Release 15.13 | [Home](index.html "PostgreSQL 15.15 Documentation") | E.5. Release 15.11 | + +[Previous](/docs/release/15.11/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/15.13/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1513.md b/corpus/changelog/postgresql_releases/postgresql_1513.md new file mode 100644 index 0000000000000000000000000000000000000000..a471e34f20c62612e8a656b0a5ea625347391a28 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1513.md @@ -0,0 +1,136 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/15.13/ +Version: 15.13 + +## PostgreSQL 15.13 + +| E.3. Release 15.13 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-15-14.html "E.2. Release 15.14") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 15.15 Documentation") | [Next](release-15-12.html "E.4. Release 15.12") | + +--- + +## E.3. Release 15.13 + +[E.3.1. Migration to Version 15.13](release-15-13.html#id-1.11.6.8.4) + +[E.3.2. Changes](release-15-13.html#id-1.11.6.8.5) + +**Release date:**2025-05-08 + +This release contains a variety of fixes from 15.12. For information about new features in major release 15, see [Section E.16](release-15.html "E.16. Release 15"). + +### E.3.1. Migration to Version 15.13 + +A dump/restore is not required for those running 15.X. + +However, if you have any self-referential foreign key constraints on partitioned tables, it may be necessary to recreate those constraints to ensure that they are being enforced correctly. See the second changelog entry below. + +Also, if you have any BRIN bloom indexes, it may be advisable to reindex them after updating. See the third changelog entry below. + +Also, if you are upgrading from a version earlier than 15.9, see [Section E.7](release-15-9.html "E.7. Release 15.9"). + +### E.3.2. Changes + +* Avoid one-byte buffer overread when examining invalidly-encoded strings that are claimed to be in GB18030 encoding (Noah Misch, Andres Freund) [§](https://postgr.es/c/44ba3f55f) [§](https://postgr.es/c/45fe7e08f) + + While unlikely, a SIGSEGV crash could occur if an incomplete multibyte character appeared at the end of memory. This was possible both in the server and in libpq-using applications. (CVE-2025-4207) +* Handle self-referential foreign keys on partitioned tables correctly (Álvaro Herrera) [§](https://postgr.es/c/6ba979cf5) + + Creating or attaching partitions failed to make the required catalog entries for a foreign-key constraint, if the table referenced by the constraint was the same partitioned table. This resulted in failure to enforce the constraint fully. + + To fix this, you should drop and recreate any self-referential foreign keys on partitioned tables, if partitions have been created or attached since the constraint was created. Bear in mind that violating rows might already be present, in which case recreating the constraint will fail, and you'll need to fix up those rows before trying again. +* Avoid data loss when merging compressed BRIN summaries in `brin_bloom_union()` (Tomas Vondra) [§](https://postgr.es/c/e064b770c) + + The code failed to account for decompression results not being identical to the input objects, which would result in failure to add some of the data to the merged summary, leading to missed rows in index searches. + + This mistake was present back to v14 where BRIN bloom indexes were introduced, but this code path was only rarely reached then. It's substantially more likely to be hit in v17 because parallel index builds now use the code. +* Fix unexpected “attribute has wrong type” errors in `UPDATE`, `DELETE`, and `MERGE` queries that use whole-row table references to views or functions in `FROM` (Tom Lane) [§](https://postgr.es/c/ae0be2f0b) [§](https://postgr.es/c/317aba70e) [§](https://postgr.es/c/7713f4592) +* Fix `MERGE` into a partitioned table with `DO NOTHING` actions (Tender Wang) [§](https://postgr.es/c/14a33d3f0) + + Some cases failed with “unknown action in MERGE WHEN clause” errors. +* Prevent failure in `INSERT` commands when the table has a `GENERATED` column of a domain data type and the domain's constraints disallow null values (Jian He) [§](https://postgr.es/c/97d671672) + + Constraint failure was reported even if the generation expression produced a perfectly okay result. +* Correctly process references to outer CTE names that appear within a `WITH` clause attached to an `INSERT`/`UPDATE`/`DELETE`/`MERGE` command that's inside `WITH` (Tom Lane) [§](https://postgr.es/c/ede29a1e4) + + The parser failed to detect disallowed recursion cases, nor did it account for such references when sorting CTEs into a usable order. +* Fix `ARRAY(subquery)` and `ARRAY[expression, ...]` constructs to produce sane results when the input is of type `int2vector` or `oidvector` (Tom Lane) [§](https://postgr.es/c/13dd6f772) + + This patch restores the behavior that existed before PostgreSQL 9.5: the result is of type `int2vector[]` or `oidvector[]`. +* Fix possible erroneous reports of invalid affixes while parsing Ispell dictionaries (Jacob Brazeal) [§](https://postgr.es/c/e2921c0e9) +* Fix `ALTER TABLE ADD COLUMN` to correctly handle the case of a domain type that has a default (Jian He, Tom Lane, Tender Wang) [§](https://postgr.es/c/1d180931c) [§](https://postgr.es/c/2d6cfb0cd) + + If a domain type has a default, adding a column of that type (without any explicit `DEFAULT` clause) failed to install the domain's default value in existing rows, instead leaving the new column null. +* Repair misbehavior when there are duplicate column names in a foreign key constraint's `ON DELETE SET DEFAULT` or `SET NULL` action (Tom Lane) [§](https://postgr.es/c/f5069f026) +* Improve the error message for disallowed attempts to alter the properties of a foreign key constraint (Álvaro Herrera) [§](https://postgr.es/c/bf1e2d2db) +* Avoid error when resetting the `relhassubclass` flag of a temporary table that's marked `ON COMMIT DELETE ROWS` (Noah Misch) [§](https://postgr.es/c/e0f53e669) +* Fix planner's failure to identify more than one hashable ScalarArrayOpExpr subexpression within a top-level expression (David Geier) [§](https://postgr.es/c/a7f213b11) + + This resulted in unnecessarily-inefficient execution of any additional subexpressions that could have been processed with a hash table (that is, `IN`, `NOT IN`, or `= ANY` clauses with all-constant right-hand sides). +* Disable “skip fetch” optimization in bitmap heap scan (Matthias van de Meent) [§](https://postgr.es/c/77d90d6d6) + + It turns out that this optimization can result in returning dead tuples when a concurrent vacuum marks a page all-visible. +* Fix performance issues in GIN index search startup when there are many search keys (Tom Lane, Vinod Sridharan) [§](https://postgr.es/c/2d313375c) [§](https://postgr.es/c/9a8c16aec) + + An indexable clause with many keys (for example, `jsonbcol ?| array[...]` with tens of thousands of array elements) took O(N2) time to start up, and was uncancelable for that interval too. +* Detect missing support procedures in a BRIN index operator class, and report an error instead of crashing (Álvaro Herrera) [§](https://postgr.es/c/5d8c58800) +* Respond to interrupts (such as query cancel) while waiting for asynchronous subplans of an Append plan node (Heikki Linnakangas) [§](https://postgr.es/c/d4d34c08c) + + Previously, nothing would happen until one of the subplans becomes ready. +* Fix race condition in handling of `synchronous_standby_names` immediately after startup (Melnikov Maksim, Michael Paquier) [§](https://postgr.es/c/ec59500a1) + + For a short period after system startup, backends might fail to wait for synchronous commit even though `synchronous_standby_names` is enabled. +* Fix `pg_strtof()` to not crash with null endptr (Alexander Lakhin, Tom Lane) [§](https://postgr.es/c/c7303f01c) +* Avoid crash when a Snowball stemmer encounters an out-of-memory condition (Maksim Korotkov) [§](https://postgr.es/c/9c46d902b) +* Prevent over-advancement of catalog xmin in “fast forward” mode of logical decoding (Zhijie Hou) [§](https://postgr.es/c/f6429bd7d) + + This mistake could allow deleted catalog entries to be vacuumed away even though they were still potentially needed by the WAL-reading process. +* Avoid data loss when DDL operations that don't take a strong lock affect tables that are being logically replicated (Shlok Kyal, Hayato Kuroda) [§](https://postgr.es/c/9f21be08e) [§](https://postgr.es/c/90bc4523f) + + The catalog changes caused by the DDL command were not reflected into WAL-decoding processes, allowing them to decode subsequent changes using stale catalog data, probably resulting in data corruption. +* Avoid duplicate snapshot creation in logical replication index lookups (Heikki Linnakangas) [§](https://postgr.es/c/50c589992) [§](https://postgr.es/c/d765226cb) +* Fix wrong checkpoint details in error message about incorrect recovery timeline choice (David Steele) [§](https://postgr.es/c/62bed7bb0) + + If the requested recovery timeline is not reachable, the reported checkpoint and timeline should be the values read from the backup\_label, if there is one. This message previously reported values from the control file, which is correct when recovering from the control file without a backup\_label, but not when there is a backup\_label. +* Fix assertion failure in snapshot building (Masahiko Sawada) [§](https://postgr.es/c/0f404c581) +* Remove incorrect assertion in `pgstat_report_stat()` (Michael Paquier) [§](https://postgr.es/c/c1201ffcf) +* Fix overly-strict assertion in `gistFindCorrectParent()` (Heikki Linnakangas) [§](https://postgr.es/c/3c0fe75c4) +* Fix rare assertion failure in standby servers when the primary is restarted (Heikki Linnakangas) [§](https://postgr.es/c/b30c77a0e) +* In PL/pgSQL, avoid “unexpected plan node type” error when a scrollable cursor is defined on a simple `SELECT expression` query (Andrei Lepikhov) [§](https://postgr.es/c/5e56efa7c) +* Don't try to drop individual index partitions in pg\_dump's `--clean` mode (Jian He) [§](https://postgr.es/c/7144cd538) + + The server rejects such `DROP` commands. That has no real consequences, since the partitions will go away anyway in the subsequent `DROP`s of either their parent tables or their partitioned index. However, the error reported for the attempted drop causes problems when restoring in `--single-transaction` mode. +* In pg\_dumpall, avoid emitting invalid role `GRANT` commands if `pg_auth_members` contains invalid role OIDs (Tom Lane) [§](https://postgr.es/c/6df3be415) + + Instead, print a warning and skip the entry. This copes better with catalog corruption that has been seen to occur in back branches as a result of race conditions between `GRANT` and `DROP ROLE`. +* In pg\_amcheck and pg\_upgrade, use the correct function to free allocations made by libpq (Michael Paquier, Ranier Vilela) [§](https://postgr.es/c/ec741d480) + + These oversights could result in crashes in certain Windows build configurations, such as a debug build of libpq used by a non-debug build of the calling application. +* Allow `contrib/dblink` queries to be interrupted by query cancel (Noah Misch) [§](https://postgr.es/c/63f6ecb6b) [§](https://postgr.es/c/9e129a224) + + This change back-patches a v17-era fix. It prevents possible hangs in `CREATE DATABASE` and `DROP DATABASE` due to failure to detect deadlocks. +* Avoid crashing with corrupt input data in `contrib/pageinspect`'s `heap_page_items()` (Dmitry Kovalenko) [§](https://postgr.es/c/90a3fd811) +* Prevent assertion failure in `contrib/pg_freespacemap`'s `pg_freespacemap()` (Tender Wang) [§](https://postgr.es/c/0e86bad38) + + Applying `pg_freespacemap()` to a relation lacking storage (such as a view) caused an assertion failure, although there was no ill effect in non-assert builds. Add an error check to reject that case. +* Fix build failure on macOS 15.4 (Tom Lane, Peter Eisentraut) [§](https://postgr.es/c/0de9560ba) + + This macOS update broke our configuration probe for `strchrnul()`. +* Update time zone data files to tzdata release 2025b for DST law changes in Chile, plus historical corrections for Iran (Tom Lane) [§](https://postgr.es/c/a144cf145) + + There is a new time zone America/Coyhaique for Chile's Aysén Region, to account for it changing to UTC-03 year-round and thus diverging from America/Santiago. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-15-14.html "E.2. Release 15.14") | [Up](release.html "Appendix E. Release Notes") | [Next](release-15-12.html "E.4. Release 15.12") | +| E.2. Release 15.14 | [Home](index.html "PostgreSQL 15.15 Documentation") | E.4. Release 15.12 | + +[Previous](/docs/release/15.12/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/15.14/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1514.md b/corpus/changelog/postgresql_releases/postgresql_1514.md new file mode 100644 index 0000000000000000000000000000000000000000..a53db01f17f156d1ff47ecde5ad6b4cda37c2f5b --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1514.md @@ -0,0 +1,198 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/15.14/ +Version: 15.14 + +## PostgreSQL 15.14 + +| E.2. Release 15.14 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-15-15.html "E.1. Release 15.15") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 15.15 Documentation") | [Next](release-15-13.html "E.3. Release 15.13") | + +--- + +## E.2. Release 15.14 + +[E.2.1. Migration to Version 15.14](release-15-14.html#id-1.11.6.7.4) + +[E.2.2. Changes](release-15-14.html#id-1.11.6.7.5) + +**Release date:**2025-08-14 + +This release contains a variety of fixes from 15.13. For information about new features in major release 15, see [Section E.16](release-15.html "E.16. Release 15"). + +### E.2.1. Migration to Version 15.14 + +A dump/restore is not required for those running 15.X. + +However, if you have any BRIN `numeric_minmax_multi_ops` indexes, it is advisable to reindex them after updating. See the fourth changelog entry below. + +Also, if you are upgrading from a version earlier than 15.13, see [Section E.3](release-15-13.html "E.3. Release 15.13"). + +### E.2.2. Changes + +* Tighten security checks in planner estimation functions (Dean Rasheed) [§](https://postgr.es/c/415badc13) + + The fix for CVE-2017-7484, plus followup fixes, intended to prevent leaky functions from being applied to statistics data for columns that the calling user does not have permission to read. Two gaps in that protection have been found. One gap applies to partitioning and inheritance hierarchies where RLS policies on the tables should restrict access to statistics data, but did not. + + The other gap applies to cases where the query accesses a table via a view, and the view owner has permissions to read the underlying table but the calling user does not have permissions on the view. The view owner's permissions satisfied the security checks, and the leaky function would get applied to the underlying table's statistics before we check the calling user's permissions on the view. This has been fixed by making security checks on views occur at the start of planning. That might cause permissions failures to occur earlier than before. + + The PostgreSQL Project thanks Dean Rasheed for reporting this problem. (CVE-2025-8713) +* Prevent pg\_dump scripts from being used to attack the user running the restore (Nathan Bossart) [§](https://postgr.es/c/424040506) + + Since dump/restore operations typically involve running SQL commands as superuser, the target database installation must trust the source server. However, it does not follow that the operating system user who executes psql to perform the restore should have to trust the source server. The risk here is that an attacker who has gained superuser-level control over the source server might be able to cause it to emit text that would be interpreted as psql meta-commands. That would provide shell-level access to the restoring user's own account, independently of access to the target database. + + To provide a positive guarantee that this can't happen, extend psql with a `\restrict` command that prevents execution of further meta-commands, and teach pg\_dump to issue that before any data coming from the source server. + + The PostgreSQL Project thanks Martin Rakhmanov, Matthieu Denais, and RyotaK for reporting this problem. (CVE-2025-8714) +* Convert newlines to spaces in names included in comments in pg\_dump output (Noah Misch) [§](https://postgr.es/c/9751f934a) + + Object names containing newlines offered the ability to inject arbitrary SQL commands into the output script. (Without the preceding fix, injection of psql meta-commands would also be possible this way.) CVE-2012-0868 fixed this class of problem at the time, but later work reintroduced several cases. + + The PostgreSQL Project thanks Noah Misch for reporting this problem. (CVE-2025-8715) +* Fix incorrect distance calculation in BRIN `numeric_minmax_multi_ops` support function (Peter Eisentraut, Tom Lane) [§](https://postgr.es/c/835c9374d) + + The results were sometimes wrong on 64-bit platforms, and wildly wrong on 32-bit platforms. This did not produce obvious failures because the logic is only used to choose how to merge values into ranges; at worst the index would become inefficient and bloated. Nonetheless it's recommended to reindex any BRIN indexes that use the `numeric_minmax_multi_ops` operator class. +* Avoid regression in the size of XML input that we will accept (Michael Paquier, Erik Wienhold) [§](https://postgr.es/c/0ffbd345e) [§](https://postgr.es/c/0928e18eb) + + Our workaround for a bug in early 2.13.x releases of libxml2 made use of a code path that rejects text chunks exceeding 10MB, whereas the previous coding did not. Those early releases are presumably extinct in the wild by now, so revert to the previous coding. +* Fix `MERGE` into a plain-inheritance parent table (Dean Rasheed) [§](https://postgr.es/c/d6a3f3272) + + Insertions into such a target table could crash or produce incorrect query results due to failing to handle `WITH CHECK OPTION` and `RETURNING` actions. +* Allow tables with statement-level triggers to become partitions or inheritance children (Etsuro Fujita) [§](https://postgr.es/c/f39a7f32a) + + We do not allow partitions or inheritance child tables to have row-level triggers with transition tables, because an operation on the whole inheritance tree would need to maintain a separate transition table for each such child table. But that problem does not apply for statement-level triggers, because only the parent's statement-level triggers will be fired. The code that checks whether an existing table can become a partition or inheritance child nonetheless rejected both kinds of trigger. +* Disallow collecting transition tuples from child foreign tables (Etsuro Fujita) [§](https://postgr.es/c/d642d2306) + + We do not support triggers with transition tables on foreign tables. However, the case of a partition or inheritance child that is a foreign table was overlooked. If the parent has such a trigger, incorrect transition tuples were collected from the foreign child. Instead throw an error, reporting that the case is not supported. +* Allow resetting unknown custom parameters with reserved prefixes (Nathan Bossart) [§](https://postgr.es/c/f79ca73d7) + + Previously, if a parameter setting had been stored using `ALTER DATABASE/ROLE/SYSTEM`, the stored setting could not be removed if the parameter was unknown but had a reserved prefix. This case could arise if an extension used to have a parameter, but that parameter had been removed in an upgrade. +* Fix a potential deadlock during `ALTER SUBSCRIPTION ... DROP PUBLICATION` (Ajin Cherian) [§](https://postgr.es/c/434d2d147) + + Ensure that server processes acquire catalog locks in a consistent order during replication origin drops. +* Shorten the race condition window for creating indexes with conflicting names (Tom Lane) [§](https://postgr.es/c/75b8982ea) + + When choosing an auto-generated name for an index, avoid conflicting with not-yet-committed `pg_class` rows as well as fully-valid ones. This avoids possibly choosing the same name as some concurrent `CREATE INDEX` did, when that command is still in process of filling its index, or is done but is part of a not-yet-committed transaction. There's still a window for trouble, but it's only as long as the time needed to validate a new index's parameters and insert its `pg_class` row. +* Prevent usage of incorrect `VACUUM` options in some cases where multiple tables are vacuumed in a single command (Nathan Bossart, Michael Paquier) [§](https://postgr.es/c/354944663) + + The `TRUNCATE` and `INDEX_CLEANUP` options of one table could be applied to others. +* Fix processing of character classes within `SIMILAR TO` regular expressions (Laurenz Albe) [§](https://postgr.es/c/b3e99115e) [§](https://postgr.es/c/4dc642e75) + + The code that translates `SIMILAR TO` pattern matching expressions to POSIX-style regular expressions did not consider that square brackets can be nested. For example, in a pattern like `[[:alpha:]%_]`, the code treated the `%` and `_` characters as metacharacters when they should be literals. +* When deparsing queries, always add parentheses around the expression in `FETCH FIRST expression ROWS WITH TIES` clauses (Heikki Linnakangas) [§](https://postgr.es/c/72fe74ca5) + + This avoids some cases where the deparsed result wasn't syntactically valid. +* Limit the checkpointer process's fsync request queue size (Alexander Korotkov, Xuneng Zhou) [§](https://postgr.es/c/b248a3ba4) [§](https://postgr.es/c/73f897ba5) + + With very large `shared_buffers` settings, it was possible for the checkpointer to attempt to allocate more than 1GB for fsync requests, leading to failure and an infinite loop. Clamp the queue size to prevent this scenario. +* Avoid infinite wait in logical decoding when reading a partially-written WAL record (Vignesh C) [§](https://postgr.es/c/9f270f48f) + + If the server crashes after writing the first part of a WAL record that would span multiple pages, subsequent logical decoding of the WAL stream would wait for data to arrive on the next WAL page. That might never happen if the server is now idle. +* Fix inconsistent quoting of role names in ACL strings (Tom Lane) [§](https://postgr.es/c/de73cb3ed) + + The previous quoting rule was locale-sensitive, which could lead to portability problems when transferring `aclitem` values across installations. (pg\_dump does not do that, but other tools might.) To ensure consistency, always quote non-ASCII characters in `aclitem` output; but to preserve backward compatibility, never require that they be quoted during `aclitem` input. +* Reject equal signs (`=`) in the names of relation options and foreign-data options (Tom Lane) [§](https://postgr.es/c/e76097124) + + There's no evident use-case for option names like this, and allowing them creates ambiguity in the stored representation. +* Fix potentially-incorrect decompression of LZ4-compressed archive data (Mikhail Gribkov) [§](https://postgr.es/c/d44efe87e) + + This error seems to manifest only with not-very-compressible input data, which may explain why it escaped detection. +* Avoid a rare scenario where a btree index scan could mark the wrong index entries as dead (Peter Geoghegan) [§](https://postgr.es/c/d2ec67109) +* Avoid re-distributing cache invalidation messages from other transactions during logical replication (vignesh C) [§](https://postgr.es/c/fc0fb77c5) + + Our previous round of minor releases included a bug fix to ensure that replication receiver processes would respond to cross-process cache invalidation messages, preventing them from using stale catalog data while performing replication updates. However, the fix unintentionally made them also redistribute those messages again, leading to an exponential increase in the number of invalidation messages, which would often end in a memory allocation failure. Fix by not redistributing received messages. +* Avoid premature removal of old WAL during checkpoints (Vitaly Davydov) [§](https://postgr.es/c/dd9bc1a17) + + If a replication slot's restart point is advanced while a checkpoint is in progress, no-longer-needed WAL segments could get removed too soon, leading to recovery failure if the database crashes immediately afterwards. Fix by keeping them for one additional checkpoint cycle. +* Never move a replication slot's confirmed-flush position backwards (Shveta Malik) [§](https://postgr.es/c/9d1a62359) + + In some cases a replication client could acknowledge an LSN that's past what it has stored persistently, and then perhaps send an older LSN after a restart. We consider this not-a-bug so long as the client did not have anything it needed to do for the WAL between the two points. However, we should not re-send that WAL for fear of data duplication, so make sure we always believe the latest confirmed LSN for a given slot. +* Allow waiting for a transaction on a standby server to be interrupted (Kevin K Biju) [§](https://postgr.es/c/405cca9da) + + Creation of a replication slot on a standby server may require waiting for some active transaction(s) to finish on the primary and then be replayed on the standby. Since that could be an indefinite wait, it's desirable to allow the operation to be cancelled, but there was no check for query cancel in the loop. +* Fix per-relation memory leakage in autovacuum (Tom Lane) [§](https://postgr.es/c/13d21b48a) +* Fix some places that might try to fetch toasted fields of system catalogs without any snapshot (Nathan Bossart) [§](https://postgr.es/c/ddfcfb7ce) + + This could result in an assertion failure or “cannot fetch toast data without an active snapshot” error. +* Avoid assertion failure during cross-table constraint updates (Tom Lane, Jian He) [§](https://postgr.es/c/614ffb26d) [§](https://postgr.es/c/e6dd6e6ee) +* Remove faulty assertion that a command tag must have been determined by the end of `PortalRunMulti()` (Álvaro Herrera) [§](https://postgr.es/c/c2720ac60) + + This failed in edge cases such as an empty prepared statement. +* Fix assertion failure in `XMLTABLE` parsing (Richard Guo) [§](https://postgr.es/c/666103090) +* Restore the ability to run PL/pgSQL expressions in parallel (Dipesh Dhameliya) [§](https://postgr.es/c/c65c36ab5) + + PL/pgSQL's notion of an “expression” is very broad, encompassing any SQL `SELECT` query that returns a single column and no more than one row. So there are cases, for example evaluation of an aggregate function, where the query involves significant work and it'd be useful to run it with parallel workers. This used to be possible, but a previous bug fix unintentionally disabled it. +* Fix edge-case resource leaks in PL/Python error reporting (Tom Lane) [§](https://postgr.es/c/b56a92651) [§](https://postgr.es/c/b898bb2a7) + + An out-of-memory failure while reporting an error from Python could result in failure to drop reference counts on Python objects, leading to session-lifespan memory leakage. +* Fix libpq's `PQport()` function to never return NULL unless the passed connection is NULL (Daniele Varrazzo) [§](https://postgr.es/c/a372a64db) + + This is the documented behavior, but recent libpq versions would return NULL in some cases where the user had not provided a port specification. Revert to our historical behavior of returning an empty string in such cases. (v18 and later will return the compiled-in default port number, typically `"5432"`, instead.) +* Avoid failure when GSSAPI authentication requires packets larger than 16kB (Jacob Champion, Tom Lane) [§](https://postgr.es/c/39b1d1907) + + Larger authentication packets are needed for Active Directory users who belong to many AD groups. This limitation manifested in connection failures with unintelligible error messages, typically “GSSAPI context establishment error: The routine must be called again to complete its function: Unknown error”. +* Fix timing-dependent failures in SSL and GSSAPI data transmission (Tom Lane) [§](https://postgr.es/c/6a4d93eda) + + When using SSL or GSSAPI encryption in non-blocking mode, libpq sometimes failed with “SSL error: bad length” or “GSSAPI caller failed to retransmit all data needing to be retried”. +* Avoid null-pointer dereference during connection lookup in ecpg applications (Aleksander Alekseev) [§](https://postgr.es/c/0123922f8) + + The case could occur only if the application has some connections that are named and some that are not. +* Improve psql's tab completion for `COPY` and `\copy` options (Atsushi Torikoshi) [§](https://postgr.es/c/e3584e457) + + The same completions were offered for both `COPY FROM` and `COPY TO`, although some options are only valid for one case or the other. Distinguish these cases to provide more accurate suggestions. +* Avoid assertion failure in pgbench when multiple pipeline sync messages are received (Fujii Masao) [§](https://postgr.es/c/6914a330f) +* Ensure that pg\_dump dumps comments on domain constraints in a valid order (Jian He) [§](https://postgr.es/c/5a261c135) + + In some cases the comment command could appear before creation of the constraint. +* Ensure stable sort ordering in pg\_dump for all types of database objects (Noah Misch, Andreas Karlsson) [§](https://postgr.es/c/22f126da6) [§](https://postgr.es/c/e99010cbd) [§](https://postgr.es/c/70637d7ae) + + pg\_dump sorts objects by their logical names before performing dependency-driven reordering. This sort did not account for the full unique key identifying certain object types such as rules and constraints, and thus it could produce dissimilar sort orders for logically-identical databases. That made it difficult to compare databases by diff'ing pg\_dump output, so improve the logic to ensure stable sort ordering in all cases. +* In pg\_upgrade, check for inconsistent inherited not-null constraints (Ali Akbar) [§](https://postgr.es/c/0f4958685) [§](https://postgr.es/c/bd48455d8) [§](https://postgr.es/c/63c79a6fc) [§](https://postgr.es/c/22d783350) [§](https://postgr.es/c/a8b31b160) [§](https://postgr.es/c/18d2d8ae4) + + PostgreSQL versions before 18 allow an inherited column not-null constraint to be dropped. However, this results in a schema that cannot be restored, leading to failure in pg\_upgrade. Detect such cases during pg\_upgrade's preflight checks to allow users to fix them before initiating the upgrade. +* Avoid assertion failure if `track_commit_timestamp` is enabled during initdb (Hayato Kuroda, Andy Fan) [§](https://postgr.es/c/dcbbd4331) +* Fix pg\_waldump to show information about dropped statistics in `PREPARE TRANSACTION` WAL records (Daniil Davydov) [§](https://postgr.es/c/0e0174b49) +* Avoid possible leak of the open connection during `contrib/dblink` connection establishment (Tom Lane) [§](https://postgr.es/c/09c9ae8f6) + + In the rare scenario where we hit out-of-memory while inserting the new connection object into dblink's hashtable, the open connection would be leaked until end of session, leaving an idle session sitting on the remote server. +* Make `contrib/pg_prewarm` cope with very large `shared_buffers` settings (Daria Shanina) [§](https://postgr.es/c/d59ff3be2) + + Autoprewarm failed with a memory allocation error if `shared_buffers` was larger than about 50 million buffers (400GB). +* In `contrib/pg_stat_statements`, avoid leaving gaps in the set of parameter numbers used in a normalized query (Sami Imseih) [§](https://postgr.es/c/130300a15) +* Fix memory leakage in `contrib/postgres_fdw`'s DirectModify methods (Tom Lane) [§](https://postgr.es/c/3c31594f5) + + The `PGresult` holding the results of the remote modify command would be leaked for the rest of the session if the query fails between invocations of the DirectModify methods, which could happen when there's `RETURNING` data to process. +* Ensure that directories listed in configure's `--with-includes` and `--with-libraries` options are searched before system-supplied directories (Tom Lane) [§](https://postgr.es/c/19857437b) + + A common reason for using these options is to allow a user-built version of some library to override the system-supplied version. However, that failed to work in some environments because of careless ordering of switches in the commands issued by the makefiles. +* Fix configure's checks for `__cpuid()` and `__cpuidex()` (Lukas Fittl, Michael Paquier) [§](https://postgr.es/c/d6ffc43f9) + + configure failed to detect these Windows-specific functions, so that they would not be used, leading to slower-than-necessary CRC computations since the availability of hardware instructions could not be verified. The practical impact of this error was limited, because production builds for Windows typically do not use the Autoconf toolchain. +* Fix build failure with `--with-pam` option on Solaris-based platforms (Tom Lane) [§](https://postgr.es/c/b252ce311) + + Solaris is inconsistent with other Unix platforms about the API for PAM authentication. This manifested as an “inconsistent pointer” compiler warning, which we never did anything about. But as of GCC 14 it's an error not warning by default, so fix it. +* Make our code portable to GNU Hurd (Michael Banck, Christoph Berg, Samuel Thibault) [§](https://postgr.es/c/0fb496c70) + + Fix assumptions about `IOV_MAX` and `O_RDONLY` that don't hold on Hurd. +* Make our usage of `memset_s()` conform strictly to the C11 standard (Tom Lane) [§](https://postgr.es/c/00652b3c9) + + This avoids compile failures on some platforms. +* Prevent uninitialized-value compiler warnings in JSONB comparison code (Tom Lane) [§](https://postgr.es/c/f32e45641) +* Avoid deprecation warnings when building with libxml2 2.14 and later (Michael Paquier) [§](https://postgr.es/c/75c1eb60b) +* Avoid problems when compiling `pg_locale.h` under C++ (John Naylor) [§](https://postgr.es/c/baacfb9e6) + + PostgreSQL header files generally need to be wrapped in `extern "C" { ... }` in order to be included in extensions written in C++. This failed for `pg_locale.h` because of its use of libicu headers, but we can work around that by suppressing C++-only declarations in those headers. C++ extensions that want to use libicu's C++ APIs can do so by including the libicu headers ahead of `pg_locale.h`. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-15-15.html "E.1. Release 15.15") | [Up](release.html "Appendix E. Release Notes") | [Next](release-15-13.html "E.3. Release 15.13") | +| E.1. Release 15.15 | [Home](index.html "PostgreSQL 15.15 Documentation") | E.3. Release 15.13 | + +[Previous](/docs/release/15.13/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/15.15/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1515.md b/corpus/changelog/postgresql_releases/postgresql_1515.md new file mode 100644 index 0000000000000000000000000000000000000000..abb572186a9421cc8bc1d4208bc7abd92f28bb34 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1515.md @@ -0,0 +1,188 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/15.15/ +Version: 15.15 + +## PostgreSQL 15.15 + +| E.1. Release 15.15 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release.html "Appendix E. Release Notes") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 15.15 Documentation") | [Next](release-15-14.html "E.2. Release 15.14") | + +--- + +## E.1. Release 15.15 + +[E.1.1. Migration to Version 15.15](release-15-15.html#id-1.11.6.6.4) + +[E.1.2. Changes](release-15-15.html#id-1.11.6.6.5) + +**Release date:**2025-11-13 + +This release contains a variety of fixes from 15.14. For information about new features in major release 15, see [Section E.16](release-15.html "E.16. Release 15"). + +### E.1.1. Migration to Version 15.15 + +A dump/restore is not required for those running 15.X. + +However, if you are upgrading from a version earlier than 15.14, see [Section E.2](release-15-14.html "E.2. Release 15.14"). + +### E.1.2. Changes + +* Check for `CREATE` privileges on the schema in `CREATE STATISTICS` (Jelte Fennema-Nio) [§](https://postgr.es/c/2393d374a) + + This omission allowed table owners to create statistics in any schema, potentially leading to unexpected naming conflicts. + + The PostgreSQL Project thanks Jelte Fennema-Nio for reporting this problem. (CVE-2025-12817) +* Avoid integer overflow in allocation-size calculations within libpq (Jacob Champion) [§](https://postgr.es/c/91421565f) + + Several places in libpq were not sufficiently careful about computing the required size of a memory allocation. Sufficiently large inputs could cause integer overflow, resulting in an undersized buffer, which would then lead to writing past the end of the buffer. + + The PostgreSQL Project thanks Aleksey Solovev of Positive Technologies for reporting this problem. (CVE-2025-12818) +* Further fix processing of character classes within `SIMILAR TO` regular expressions (Laurenz Albe) [§](https://postgr.es/c/9fd531534) + + The previous fix for translating `SIMILAR TO` pattern matching expressions to POSIX-style regular expressions broke a corner case that formerly worked: if there is an escape character right after the opening bracket and then a closing bracket right after the escape sequence (for example `[\w]`), the closing bracket was no longer seen as terminating the character class. +* Fix parsing of aggregate functions whose arguments contain a sub-select with a `FROM` reference to a CTE outside the aggregate function (Tom Lane) [§](https://postgr.es/c/afd18f276) + + Such a CTE reference must act like a outer-level column reference when determining the aggregate's semantic level; but it was not being accounted for, leading to obscure planner or executor errors. +* Fix “no relation entry for relid” errors in corner cases while estimating SubPlan costs (Richard Guo) [§](https://postgr.es/c/53e35fb56) +* Avoid unlikely use-after-free in planner's expansion of partitioned tables (Bernd Reiß) [§](https://postgr.es/c/8286bce0a) + + There was a hazard only when the last live partition was concurrently dropped. +* Remove faulty assertion in btree index cleanup (Peter Geoghegan) [§](https://postgr.es/c/ca0c93908) +* Fix possible infinite loop in GIN index scans with multiple scan conditions (Tom Lane) [§](https://postgr.es/c/34249b3b5) + + GIN can handle scan conditions that can reject non-matching entries but are not useful for searching for relevant entries, for example a `tsquery` clause like `!term`. But such a condition must not be first in the array of scan conditions. The code failed to ensure that in all cases, with the result that a query having a mix of such conditions with normal conditions might work or not depending on the order in which the conditions were given in the query. +* Ensure that GIN index scans can be canceled (Tom Lane) [§](https://postgr.es/c/a9c1b9c1c) + + Some code paths were capable of running for a long time without checking for interrupts. +* Ensure that BRIN autosummarization provides a snapshot for index expressions that need one (Álvaro Herrera) [§](https://postgr.es/c/23ddadf68) [§](https://postgr.es/c/bcfbd3f74) + + Previously, autosummarization would fail for such indexes, and then leave placeholder index tuples behind, causing the index to bloat over time. +* Fix integer-overflow hazard in BRIN index scans when the table contains close to 232 pages (Sunil S) [§](https://postgr.es/c/810aaf7f2) + + This oversight could result in an infinite loop or scanning of unneeded table pages. +* Fix incorrect zero-extension of stored values in JIT-generated tuple deforming code (David Rowley) [§](https://postgr.es/c/b8ecfbe5a) + + When not using JIT, the equivalent code does sign-extension not zero-extension, leading to a different Datum representation of small integer data types. This inconsistency was masked in most cases, but it is known to lead to “could not find memoization table entry” errors when using Memoize plan nodes, and there might be other symptoms. +* Fix incorrect logic for caching result-relation information for triggers (David Rowley, Amit Langote) [§](https://postgr.es/c/2992b9a07) + + In cases where partitions' column sets aren't physically identical to their parent partitioned tables' column sets, this oversight could lead to crashes. +* Add missing EvalPlanQual rechecks for TID Scan and TID Range Scan plan nodes (Sophie Alpert, David Rowley) [§](https://postgr.es/c/f00ad440a) [§](https://postgr.es/c/005770203) + + This omission led to possibly not rechecking a condition on `ctid` during concurrent-update situations, causing the update's behavior to vary depending on which plan type had been selected. +* Fix EvalPlanQual handling of foreign or custom joins that do not have an alternative local-join plan prepared for EPQ (Masahiko Sawada, Etsuro Fujita) [§](https://postgr.es/c/4a08603a2) + + In such cases the foreign or custom access method should be invoked normally, but that did not happen, typically leading to a crash. +* Avoid duplicating hash partition constraints during `DETACH CONCURRENTLY` (Haiyang Li) [§](https://postgr.es/c/bdae98495) + + `ALTER TABLE DETACH PARTITION CONCURRENTLY` was written to add a copy of the partitioning constraint to the now-detached partition. This was misguided, partially because non-concurrent `DETACH` doesn't do that, but mostly because in the case of hash partitioning the constraint expression contains references to the parent table's OID. That causes problems during dump/restore, or if the parent table is dropped after `DETACH`. In v19 and later, we'll no longer create any such copied constraints at all. In released branches, to minimize the risk of unforeseen consequences, only skip adding a copied constraint if it is for hash partitioning. +* Disallow generated columns in partition keys (Jian He, Ashutosh Bapat) [§](https://postgr.es/c/643a5e96c) + + This was already not allowed, but the check missed some cases, such as where the column reference is implicit in a whole-row reference. +* Disallow generated columns in `COPY ... FROM ... WHERE` clauses (Peter Eisentraut, Jian He) [§](https://postgr.es/c/8278737bf) + + Previously, incorrect behavior or an obscure error message resulted from attempting to reference such a column, since generated columns have not yet been computed at the point where `WHERE` filtering is done. +* Fix visibility checking for statistics objects in `pg_temp` (Noah Misch) [§](https://postgr.es/c/d202ec1fb) + + A statistics object located in a temporary schema cannot be named without schema qualification, but `pg_statistics_obj_is_visible()` missed that memo and could return “true” regardless. In turn, functions such as `pg_describe_object()` could fail to schema-qualify the object's name as expected. +* Fix `pg_event_trigger_dropped_objects()`'s reporting of temporary status (Antoine Violin, Tom Lane) [§](https://postgr.es/c/451373dc5) [§](https://postgr.es/c/33e49ee01) + + If a dropped column default, trigger, or RLS policy belongs to a temporary table, report it with `is_temporary` true. +* Fix memory leakage in hashed subplans (Haiyang Li) [§](https://postgr.es/c/5ac973892) + + Any memory consumed by the hash functions used for hashing tuples constituted a query-lifespan memory leak. One way that could happen is if the values being hashed require de-toasting. +* Fix minor memory leak during WAL replay of database creation (Nathan Bossart) [§](https://postgr.es/c/23b316c36) +* Fix corruption of the shared statistics table after out-of-memory failures (Mikhail Kot) [§](https://postgr.es/c/1852ec5db) + + Previously, an out-of-memory failure partway through creating a new hash table entry left a broken entry behind, potentially causing errors in other sessions later. +* Fix concurrent update issue in `MERGE` (Yugo Nagata) [§](https://postgr.es/c/f871fbae9) + + When executing a `MERGE UPDATE` action, if there is more than one concurrent update of the target row, the lock-and-retry code would sometimes incorrectly identify the latest version of the target tuple, leading to incorrect results. +* Add missing replica identity checks in `MERGE` and `INSERT ... ON CONFLICT DO UPDATE` (Zhijie Hou) [§](https://postgr.es/c/5481cc332) [§](https://postgr.es/c/451b22efd) [§](https://postgr.es/c/a4624929d) + + If `MERGE` may require update or delete actions, and the target table publishes updates or deletes, insist that it have a `REPLICA IDENTITY` defined. Failing to require this can silently break replication. Likewise, `INSERT` with an `UPDATE` option must require `REPLICA IDENTITY` if the target table publishes either inserts or updates. +* Avoid deadlock during `DROP SUBSCRIPTION` when publisher is on the same server as subscriber (Dilip Kumar) [§](https://postgr.es/c/e41137155) +* Fix incorrect reporting of replication lag in `pg_stat_replication` view (Fujii Masao) [§](https://postgr.es/c/59b215f72) + + If any standby server's replay LSN stopped advancing, the `write_lag` and `flush_lag` columns would eventually stop updating. +* Avoid duplicative log messages about invalid `primary_slot_name` settings (Fujii Masao) [§](https://postgr.es/c/caf529aba) +* Remove the unfinished slot state file after failing to write a replication slot's state to disk (Michael Paquier) [§](https://postgr.es/c/0adf424b4) + + Previously, a failure such as out-of-disk-space resulted in leaving a temporary `state.tmp` file behind. That's problematic because it would block all subsequent attempts to write the state, requiring manual intervention to clean up. +* Avoid unwanted WAL receiver shutdown when switching from streaming to archive WAL source (Xuneng Zhou) [§](https://postgr.es/c/da5ea6c70) + + During a timeline change, a standby server's WAL receiver should remain alive, waiting for a new WAL streaming start point. Instead it was repeatedly shutting down and immediately getting restarted, which could confuse status monitoring code. +* Avoid failures in logical replication due to chance collisions of file numbers between regular and temporary tables (Vignesh C) [§](https://postgr.es/c/ec471008c) + + This low-probability problem manifested as transient errors like “unexpected duplicate for tablespace *`X`*, relfilenode *`Y`*”. `contrib/autoprewarm` was also affected. A side-effect of the fix is that the SQL function `pg_filenode_relation()` will now ignore temporary tables. +* Fix use-after-free issue in the relation synchronization cache maintained by the pgoutput logical decoding plugin (Vignesh C, Masahiko Sawada) [§](https://postgr.es/c/c40761759) + + An error during logical decoding could result in crashes in subsequent logical decoding attempts in the same session. The case is only reachable when pgoutput is invoked via SQL functions. +* Avoid assertion failure when trying to release a replication slot in single-user mode (Hayato Kuroda) [§](https://postgr.es/c/818be9b73) +* Fix incorrect printing of messages about failures in checking whether the user has Windows administrator privilege (Bryan Green) [§](https://postgr.es/c/f91666c83) + + This code would have crashed or at least printed garbage. No such cases have been reported though, indicating that failure of these system calls is extremely rare. +* Avoid startup failure on macOS and BSD platforms when there is a collision with a pre-existing semaphore set (Tom Lane) [§](https://postgr.es/c/f4c088344) + + If the pre-existing set has fewer semaphores than we asked for, these platforms return EINVAL not EEXIST as our code expected, resulting in failure to start the database. +* Fix false memory-context-checking warnings in debug builds on 64-bit Windows (David Rowley) [§](https://postgr.es/c/f3420e006) +* Correctly handle `GROUP BY DISTINCT` in PL/pgSQL assignment statements (Tom Lane) [§](https://postgr.es/c/9ca79896a) + + The parser failed to record the `DISTINCT` option in this context, so that the command would act as if it were plain `GROUP BY`. +* Avoid leaking memory when handling a SQL error within PL/Python (Tom Lane) [§](https://postgr.es/c/4cde73259) + + This fixes a session-lifespan memory leak introduced in our previous minor releases. +* Fix libpq's trace output of characters with the high bit set (Ran Benita) [§](https://postgr.es/c/0b274c475) + + On platforms where `char` is considered signed, the output included unsightly `\xffffff` decoration. +* Fix libpq's handling of socket-related errors on Windows within its GSSAPI logic (Ning Wu, Tom Lane) [§](https://postgr.es/c/771b106d1) + + The code for encrypting/decrypting transmitted data using GSSAPI did not correctly recognize error conditions on the connection socket, since Windows reports those differently than other platforms. This led to failure to make such connections on Windows. +* In pg\_dump, dump security labels on subscriptions and event triggers (Jian He, Fujii Masao) [§](https://postgr.es/c/165b07efe) + + Labels on these types of objects were previously missed. +* Fix pg\_dump's sorting of default ACLs and foreign key constraints (Kirill Reshke, Álvaro Herrera) [§](https://postgr.es/c/fbf967e99) [§](https://postgr.es/c/090c9c960) [§](https://postgr.es/c/4cc3b4445) + + Ensure consistent ordering of these database object types, as was already done for other object types. +* In pg\_dump, label comments for separately-dumped domain constraints with the proper dependency (Noah Misch) [§](https://postgr.es/c/0773f3a87) + + This error could lead to parallel pg\_restore attempting to create the comment before the constraint itself has been restored. +* In pg\_restore, skip comments and security labels for publications and subscriptions that are not being restored (Jian He, Fujii Masao) [§](https://postgr.es/c/c8ed16050) [§](https://postgr.es/c/5f42008f9) + + Do not emit `COMMENT` or `SECURITY LABEL` commands for these objects when `--no-publications` or `--no-subscriptions` is specified. +* Fix assorted errors in the data compression logic in pg\_dump and pg\_restore (Daniel Gustafsson, Tom Lane) [§](https://postgr.es/c/8b9924bce) + + Error checking was missing or incorrect in several places, and there were also portability issues that would manifest on big-endian hardware. These problems had been missed because this code is only used to read compressed TOC files within directory-format dumps. pg\_dump never produces such a dump; the case can be reached only by manually compressing the TOC file after the fact, which is a supported thing to do but very uncommon. +* Fix pgbench to error out cleanly if a `COPY` operation is started (Anthonin Bonnefoy) [§](https://postgr.es/c/b5cefc197) + + pgbench doesn't intend to support this case, but previously it went into an infinite loop. +* Fix pgbench's reporting of multiple errors (Yugo Nagata) [§](https://postgr.es/c/bdccb6302) + + In cases where two successive `PQgetResult` calls both fail, pgbench might report the wrong error message. +* In pgbench, fix faulty assertion about errors in pipeline mode (Yugo Nagata) [§](https://postgr.es/c/704f51771) +* Ensure that `contrib/pg_buffercache` functions can be canceled (Satyanarayana Narlapuram, Yuhang Qiu) [§](https://postgr.es/c/eb9ee4d18) + + Some code paths were capable of running for a long time without checking for interrupts. +* Fix `contrib/pg_prewarm`'s privilege checks for indexes (Ayush Vatsa, Nathan Bossart) [§](https://postgr.es/c/6c03ae8d6) + + `pg_prewarm()` requires `SELECT` privilege on relations to be prewarmed. However, since indexes have no SQL privileges of their own, this resulted in non-superusers being unable to prewarm indexes. Instead, check for `SELECT` privilege on the index's table. +* Make `contrib/pgstattuple` more robust about empty or invalid index pages (Nitin Motiani) [§](https://postgr.es/c/49b5f0b53) + + Count all-zero pages as free space, and ignore pages that are invalid according to a check of the page's special-space size. The code for btree indexes already counted all-zero pages as free, but the hash and gist code would error out, which has been found to be much less user-friendly. Similarly, make all three cases agree on ignoring corrupted pages rather than throwing errors. +* Harden our read and write barrier macros to satisfy Clang (Thomas Munro) [§](https://postgr.es/c/1c7cba4c5) + + We supposed that `__atomic_thread_fence()` is a sufficient barrier to prevent the C compiler from re-ordering memory accesses around it, but it appears that that's not true for Clang, allowing it to generate incorrect code for at least RISC-V, MIPS, and LoongArch machines. Add explicit compiler barriers to fix that. +* Fix building with LLVM version 21 and later (Holger Hoffstätte) [§](https://postgr.es/c/72a24bebc) +* Fix PGXS build infrastructure to support building NLS `po` files for extensions (Ryo Matsumura) [§](https://postgr.es/c/33202cba8) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release.html "Appendix E. Release Notes") | [Up](release.html "Appendix E. Release Notes") | [Next](release-15-14.html "E.2. Release 15.14") | +| Appendix E. Release Notes | [Home](index.html "PostgreSQL 15.15 Documentation") | E.2. Release 15.14 | + +[Previous](/docs/release/15.14/) + +[Return to the Release Notes Archive](/docs/release/) diff --git a/corpus/changelog/postgresql_releases/postgresql_152.md b/corpus/changelog/postgresql_releases/postgresql_152.md new file mode 100644 index 0000000000000000000000000000000000000000..cace9663b22c2bce1abf8fd175935f681e2502fa --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_152.md @@ -0,0 +1,200 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/15.2/ +Version: 15.2 + +## PostgreSQL 15.2 + +| E.14. Release 15.2 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-15-3.html "E.13. Release 15.3") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 15.15 Documentation") | [Next](release-15-1.html "E.15. Release 15.1") | + +--- + +## E.14. Release 15.2 + +[E.14.1. Migration to Version 15.2](release-15-2.html#id-1.11.6.19.4) + +[E.14.2. Changes](release-15-2.html#id-1.11.6.19.5) + +**Release date:**2023-02-09 + +This release contains a variety of fixes from 15.1. For information about new features in major release 15, see [Section E.16](release-15.html "E.16. Release 15"). + +### E.14.1. Migration to Version 15.2 + +A dump/restore is not required for those running 15.X. + +However, if you are upgrading from a version earlier than 15.1, see [Section E.15](release-15-1.html "E.15. Release 15.1"). + +### E.14.2. Changes + +* libpq can leak memory contents after GSSAPI transport encryption initiation fails (Jacob Champion) [§](https://postgr.es/c/715c345dd) + + A modified server, or an unauthenticated man-in-the-middle, can send a not-zero-terminated error message during setup of GSSAPI (Kerberos) transport encryption. libpq will then copy that string, as well as following bytes in application memory up to the next zero byte, to its error report. Depending on what the calling application does with the error report, this could result in disclosure of application memory contents. There is also a small probability of a crash due to reading beyond the end of memory. Fix by properly zero-terminating the server message. (CVE-2022-41862) +* Fix calculation of which `GENERATED` columns need to be updated in child tables during an `UPDATE` on a partitioned table or inheritance tree (Amit Langote, Tom Lane) [§](https://postgr.es/c/3706cc97a) [§](https://postgr.es/c/a8f7687a0) + + This fixes failure to update `GENERATED` columns that do not exist in the parent table, or that have different dependencies than are in the parent column's generation expression. +* Fix possible failure of `MERGE` to compute `GENERATED` columns (Dean Rasheed) [§](https://postgr.es/c/4785af9e6) + + When the first row-level action of the `MERGE` was an `UPDATE`, any subsequent `INSERT` actions would fail to compute `GENERATED` columns that were deemed unnecessary to compute for the `UPDATE` action (due to not depending on any of the `UPDATE` target columns). +* Fix `MERGE`'s check for unreachable `WHEN` clauses (Dean Rasheed) [§](https://postgr.es/c/38255f2d0) + + A `WHEN` clause following an unconditional `WHEN` clause should be rejected as unreachable, but this case was not always detected. +* Fix `MERGE`'s rule-detection test (Dean Rasheed) [§](https://postgr.es/c/04d61bfe6) + + `MERGE` is not supported on tables with rules; but it also failed on tables that once had rules but no longer do. +* In `MERGE`, don't count a `DO NOTHING` action as a processed tuple (Álvaro Herrera) [§](https://postgr.es/c/3d45edcef) + + This makes the code's behavior match the documentation. +* Allow a `WITH RECURSIVE ... CYCLE` CTE to access its output column (Tom Lane) [§](https://postgr.es/c/ae98debf7) + + A reference to the `SET` column from within the CTE would fail with “cache lookup failed for type 0”. +* Fix handling of pending inserts when doing a bulk insertion to a foreign table (Etsuro Fujita) [§](https://postgr.es/c/fc02019c0) [§](https://postgr.es/c/a0bf7a0ec) + + In some cases pending insertions were not flushed to the FDW soon enough, leading to logical inconsistencies, for example `BEFORE ROW` triggers not seeing rows they should be able to see. +* Allow `REPLICA IDENTITY` to be set on an index that's not (yet) valid (Tom Lane) [§](https://postgr.es/c/9e4288ce6) + + When pg\_dump dumps a partitioned index that's marked `REPLICA IDENTITY`, it generates a command sequence that applies `REPLICA IDENTITY` before the partitioned index has been marked valid, causing restore to fail. There seems no very good reason to prohibit doing it in that order, so allow it. The marking will have no effect anyway until the index becomes valid. +* Fix handling of `DEFAULT` markers in rules that perform an `INSERT` from a multi-row `VALUES` list (Dean Rasheed) [§](https://postgr.es/c/c67204db6) + + In some cases a `DEFAULT` marker would not get replaced with the proper default-value expression, leading to an “unrecognized node type” error. +* Reject uses of undefined variables in `jsonpath` existence checks (Alexander Korotkov, David G. Johnston) [§](https://postgr.es/c/4dc3f94fa) + + While `jsonpath` match operators threw an error for an undefined variable in the path pattern, the existence operators silently treated it as a match. +* Fix `jsonb` subscripting to cope with toasted subscript values (Tom Lane, David G. Johnston) [§](https://postgr.es/c/d79b76b10) + + Using a text value fetched directly from a table as a `jsonb` subscript was likely to fail. Fetches would usually not find any matching element. Assignments could store the value with a garbage key, although keys long enough to cause that problem are probably rare in the field. +* Fix edge-case data corruption in parallel hash joins (Dmitry Astapov) [§](https://postgr.es/c/d9f5345bf) + + If the final chunk of a large tuple being written out to a temporary file was exactly 32760 bytes, it would be corrupted due to a fencepost bug. The query would typically fail later with corrupted-data symptoms. +* Honor non-default settings of `checkpoint_completion_target` (Bharath Rupireddy) [§](https://postgr.es/c/49e3a5e71) + + Internal state was not updated after a change in `checkpoint_completion_target`, possibly resulting in performing checkpoint I/O faster or slower than desired, especially if that setting was changed on-the-fly. +* Log the correct ending timestamp in `recovery_target_xid` mode (Tom Lane) [§](https://postgr.es/c/abe203304) + + When ending recovery based on the `recovery_target_xid` setting with `recovery_target_inclusive` = `off`, we printed an incorrect timestamp (always 2000-01-01) in the “recovery stopping before ... transaction” log message. +* Improve error reporting for some buffered file read failures (Peter Eisentraut) [§](https://postgr.es/c/ac01fa647) + + Correctly report a short read, giving the numbers of bytes desired and actually read, instead of reporting an irrelevant error code. Most places got this right already, but some recently-written replication logic did not. +* Remove arbitrary limit on number of elements in `int2vector` and `oidvector` (Tom Lane) [§](https://postgr.es/c/db9127c58) + + The input functions for these types previously rejected more than 100 elements. With the introduction of the logical replication column list feature, it's necessary to accept `int2vector`s having up to 1600 columns, otherwise long column lists cause logical-replication failures. +* In extended query protocol, avoid an immediate commit after `ANALYZE` if we're running a pipeline (Tom Lane) [§](https://postgr.es/c/18431ee6f) + + If there's not been an explicit `BEGIN TRANSACTION`, `ANALYZE` would take it on itself to commit, which should not happen within a pipelined series of commands. +* Reject cancel request packets having the wrong length (Andrey Borodin) [§](https://postgr.es/c/b152bb7b2) + + The server would process a cancel request even if its length word was too small. This led to reading beyond the end of the allocated buffer. In theory that could cause a segfault, but it seems quite unlikely to happen in practice, since the buffer would have to be very close to the end of memory. The more likely outcome was a bogus log message about wrong backend PID or cancel code. Complain about the wrong length, instead. +* Fix planner preprocessing oversights for window function run-condition expressions (Richard Guo, David Rowley) [§](https://postgr.es/c/04788ee4c) + + This could lead to planner errors such as “WindowFunc not found in subplan target lists”. +* Fix possible dangling-pointer access during execution of window function run-condition expressions (David Rowley) [§](https://postgr.es/c/2a535620c) + + In practice, because the run-condition optimization is only applied to certain window functions that happen to all return `int8`, this only manifested as a problem on 32-bit builds. +* Add recursion and looping defenses in subquery pullup (Tom Lane) [§](https://postgr.es/c/1a3daa5bb) + + A contrived query can result in deep recursion and unreasonable amounts of time spent trying to flatten subqueries. A proper fix for that seems unduly invasive for a back-patch, but we can at least add stack depth checks and an interrupt check to allow the query to be cancelled. +* Fix planner issues when combining Memoize nodes with partitionwise joins or parameterized nestloops (Richard Guo) [§](https://postgr.es/c/c959f84c2) [§](https://postgr.es/c/834d97c32) + + These errors could lead to not using Memoize in contexts where it would be useful, or possibly to wrong query plans. +* Fix partitionwise-join code to tolerate failure to produce a plan for each partition (Tom Lane) [§](https://postgr.es/c/bf8fd64ff) + + This could result in “could not devise a query plan for the given query” errors. +* Limit the amount of cleanup work done by `get_actual_variable_range` (Simon Riggs) [§](https://postgr.es/c/2debceed2) + + Planner runs occurring just after deletion of a large number of tuples appearing at the end of an index could expend significant amounts of work setting the “killed” bits for those index entries. Limit the amount of work done in any one query by giving up on this process after examining 100 heap pages. All the cleanup will still happen eventually, but without so large a performance hiccup. +* Prevent the statistics machinery from getting confused when a relation's relkind changes (Andres Freund) [§](https://postgr.es/c/c6a60471a) + + Converting a table to a view could lead to crashes or assertion failures. +* Fix under-parenthesized display of `AT TIME ZONE` constructs (Tom Lane) [§](https://postgr.es/c/a711b36e5) + + This could result in dump/restore failures for rules or views in which an argument of `AT TIME ZONE` is itself an expression. +* Prevent clobbering of cached parsetrees for utility statements in SQL functions (Tom Lane, Daniel Gustafsson) [§](https://postgr.es/c/5dfc2b753) + + If a SQL-language function executes the same utility command more than once within a single calling query, it could crash or report strange errors such as “unrecognized node type”. +* Ensure that execution of full-text-search queries can be cancelled while they are performing phrase matches (Tom Lane) [§](https://postgr.es/c/0353db996) +* Fix memory leak in hashing strings with nondeterministic collations (Jeff Davis) [§](https://postgr.es/c/9377b4f30) +* Fix deadlock between `DROP DATABASE` and logical replication worker process (Hou Zhijie) [§](https://postgr.es/c/267135d01) + + This was caused by an ill-advised choice to block interrupts while creating a logical replication slot in the worker. In version 15 that could lead to an undetected deadlock. In version 14, no deadlock has been observed, but it's still a bad idea to block interrupts while waiting for network I/O. +* Clean up the libpq connection object after a failed replication connection attempt (Andres Freund) [§](https://postgr.es/c/704a330a9) + + The previous coding leaked the connection object. In background code paths that's pretty harmless because the calling process will give up and exit. But in commands such as `CREATE SUBSCRIPTION`, such a failure resulted in a small session-lifespan memory leak. +* In hot-standby servers, reduce processing effort for tracking XIDs known to be active on the primary (Simon Riggs, Michail Nikolaev) [§](https://postgr.es/c/55fa993d7) + + Insufficiently-aggressive cleanup of the KnownAssignedXids array could lead to poor performance, particularly when `max_connections` is set to a large value on the standby. +* Ignore invalidated logical-replication slots while determining oldest catalog xmin (Sirisha Chamarthi) [§](https://postgr.es/c/1ad033df1) + + A replication slot could prevent cleanup of dead tuples in the system catalogs even after it becomes invalidated due to exceeding `max_slot_wal_keep_size`. Thus, failure of a replication consumer could lead to indefinitely-large catalog bloat. +* In logical decoding, notify the remote node when a transaction is detected to have crashed (Hou Zhijie) [§](https://postgr.es/c/18b81258a) + + After a server restart, we'll re-stream the changes for transactions occurring shortly before the restart. Some of these transactions probably never completed; when we realize that one didn't we throw away the relevant decoding state locally, but we neglected to tell the subscriber about it. That led to the subscriber keeping useless streaming files until it's next restarted. +* Fix uninitialized-memory usage in logical decoding (Masahiko Sawada) [§](https://postgr.es/c/898ef41bf) + + In certain cases, resumption of logical decoding could try to re-use XID data that had already been freed, leading to unpredictable behavior. +* Acquire spinlock while updating shared state during logical decoding context creation (Masahiko Sawada) [§](https://postgr.es/c/6f25e4877) + + We neglected to acquire the appropriate lock while updating data about two-phase transactions, potentially allowing other processes to see inconsistent data. +* Fix pgoutput replication plug-in to not send columns not listed in a table's replication column list (Hou Zhijie) [§](https://postgr.es/c/ebf87c019) + + `UPDATE` and `DELETE` events did not pay attention to the configured column list, thus sending more data than expected. This did not cause a problem when the receiver is our built-in logical replication code, but it might confuse other receivers, and in any case it wasted network bandwidth. +* Avoid rare “failed to acquire cleanup lock” panic during WAL replay of hash-index page split operations (Robert Haas) [§](https://postgr.es/c/e49e19181) +* Advance a heap page's LSN when setting its all-visible bit during WAL replay (Jeff Davis) [§](https://postgr.es/c/7bf713dd2) + + Failure to do this left the page possibly different on standby servers than the primary, and violated some other expectations about when the LSN changes. This seems only a theoretical hazard so far as PostgreSQL itself is concerned, but it could upset third-party tools. +* Fix `int64_div_fast_to_numeric()` to work for a wider range of inputs (Dean Rasheed) [§](https://postgr.es/c/4f74741a5) + + This function misbehaved with some values of its second argument. No such usages exist in core PostgreSQL, but it's clearly a hazard for external modules, so repair. +* Fix latent buffer-overrun problem in `WaitEventSet` logic (Thomas Munro) [§](https://postgr.es/c/8a98523a5) + + The `epoll`-based and `kqueue`-based implementations could ask the kernel for too many events if the size of their internal buffer was different from the size of the caller's output buffer. That case is not known to occur in released PostgreSQL versions, but this error is a hazard for external modules and future bug fixes. +* Avoid nominally-undefined behavior when accessing shared memory in 32-bit builds (Andres Freund) [§](https://postgr.es/c/a0d35ebcc) + + clang's undefined-behavior sanitizer complained about use of a pointer that was less aligned than it should be. It's very unlikely that this would cause a problem in non-debug builds, but it's worth fixing for testing purposes. +* Fix assertion failure in BRIN minmax-multi opclasses (Tomas Vondra) [§](https://postgr.es/c/c4f64cfab) + + The assertion was overly strict, so this mistake was harmless in non-assert builds. +* Remove faulty assertion in useless-RESULT-RTE optimization logic (Tom Lane) [§](https://postgr.es/c/556c0b913) +* Fix copy-and-paste errors in cache-lookup-failure messages for ACL checks (Justin Pryzby) [§](https://postgr.es/c/e3897a3a4) + + In principle these errors should never be reached. But if they are, some of them reported the wrong type of object. +* Fix possible corruption of very large tablespace map files in pg\_basebackup (Antonin Houska) [§](https://postgr.es/c/8b5ba2f3f) +* Avoid harmless warning from pg\_dump in `--if-exists` mode (Tom Lane) [§](https://postgr.es/c/488e89bf7) + + If the `public` schema has a non-default owner then use of pg\_dump's `--if-exists` option resulted in a warning message “warning: could not find where to insert IF EXISTS in statement "-- \*not\* dropping schema, since initdb creates it"”. The dump output was okay, though. +* Fix psql's `\sf` and `\ef` commands to handle SQL-language functions that have SQL-standard function bodies (Tom Lane) [§](https://postgr.es/c/97299cf99) + + These commands misidentified the start of the function body when it used new-style syntax. +* Fix tab completion of `ALTER FUNCTION/PROCEDURE/ROUTINE` ... `SET SCHEMA` (Dean Rasheed) [§](https://postgr.es/c/2daf4664c) +* Update `contrib/pageinspect` to mark its disk-accessing functions as `PARALLEL RESTRICTED` (Tom Lane) [§](https://postgr.es/c/b8988cf1d) + + This avoids possible failure if one of these functions is used to examine a temporary table, since a session's temporary tables are not accessible from parallel workers. +* Fix `contrib/seg` to not crash or print garbage if an input number has more than 127 digits (Tom Lane) [§](https://postgr.es/c/b87037b37) +* Fix build on Microsoft Visual Studio 2013 (Tom Lane) [§](https://postgr.es/c/576506303) + + A previous patch supposed that all platforms of interest have `snprintf()`, but MSVC 2013 isn't quite there yet. Revert to using `sprintf()` on that platform. +* Fix compile failure in building PL/Perl with MSVC when using Strawberry Perl (Andrew Dunstan) [§](https://postgr.es/c/fed54fc9a) +* Fix mismatch of PL/Perl built with MSVC versus a Perl library built with gcc (Andrew Dunstan) [§](https://postgr.es/c/b5d8fd418) + + Such combinations could previously fail with “loadable library and perl binaries are mismatched” errors. +* Suppress compiler warnings from Perl's header files (Andres Freund) [§](https://postgr.es/c/c6e75e4c2) + + Our preferred compiler options provoke warnings about constructs appearing in recent versions of Perl's header files. When using gcc, we can suppress these warnings with a pragma. +* Fix pg\_waldump to build on compilers that don't discard unused static-inline functions (Tom Lane) [§](https://postgr.es/c/9a40a0311) +* Update time zone data files to tzdata release 2022g for DST law changes in Greenland and Mexico, plus historical corrections for northern Canada, Colombia, and Singapore. (Tom Lane) [§](https://postgr.es/c/65f0d9d27) + + Notably, a new timezone America/Ciudad\_Juarez has been split off from America/Ojinaga. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-15-3.html "E.13. Release 15.3") | [Up](release.html "Appendix E. Release Notes") | [Next](release-15-1.html "E.15. Release 15.1") | +| E.13. Release 15.3 | [Home](index.html "PostgreSQL 15.15 Documentation") | E.15. Release 15.1 | + +[Previous](/docs/release/15.1/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/15.3/) diff --git a/corpus/changelog/postgresql_releases/postgresql_153.md b/corpus/changelog/postgresql_releases/postgresql_153.md new file mode 100644 index 0000000000000000000000000000000000000000..1084d5c77ab427fbd0b6641e04200fad1e8f46ef --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_153.md @@ -0,0 +1,265 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/15.3/ +Version: 15.3 + +## PostgreSQL 15.3 + +| E.13. Release 15.3 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-15-4.html "E.12. Release 15.4") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 15.15 Documentation") | [Next](release-15-2.html "E.14. Release 15.2") | + +--- + +## E.13. Release 15.3 + +[E.13.1. Migration to Version 15.3](release-15-3.html#id-1.11.6.18.4) + +[E.13.2. Changes](release-15-3.html#id-1.11.6.18.5) + +**Release date:**2023-05-11 + +This release contains a variety of fixes from 15.2. For information about new features in major release 15, see [Section E.16](release-15.html "E.16. Release 15"). + +### E.13.1. Migration to Version 15.3 + +A dump/restore is not required for those running 15.X. + +However, if you are upgrading from a version earlier than 15.1, see [Section E.15](release-15-1.html "E.15. Release 15.1"). + +### E.13.2. Changes + +* Prevent `CREATE SCHEMA` from defeating changes in `search_path` (Alexander Lakhin) [§](https://postgr.es/c/dbd5795e7) [§](https://postgr.es/c/1b761d896) + + Within a `CREATE SCHEMA` command, objects in the prevailing `search_path`, as well as those in the newly-created schema, would be visible even within a called function or script that attempted to set a secure `search_path`. This could allow any user having permission to create a schema to hijack the privileges of a security definer function or extension script. + + The PostgreSQL Project thanks Alexander Lakhin for reporting this problem. (CVE-2023-2454) +* Enforce row-level security policies correctly after inlining a set-returning function (Stephen Frost, Tom Lane) [§](https://postgr.es/c/04e560604) + + If a set-returning SQL-language function refers to a table having row-level security policies, and it can be inlined into a calling query, those RLS policies would not get enforced properly in some cases involving re-using a cached plan under a different role. This could allow a user to see or modify rows that should have been invisible. + + The PostgreSQL Project thanks Wolfgang Walther for reporting this problem. (CVE-2023-2455) +* Fix potential corruption of the template (source) database after `CREATE DATABASE` with the `STRATEGY WAL_LOG` option (Nathan Bossart, Ryo Matsumura) [§](https://postgr.es/c/fa5dd460c) + + Improper buffer handling created a risk that any later modification of the template's `pg_class` catalog would be lost. +* Fix memory leakage and unnecessary disk reads during `CREATE DATABASE` with the `STRATEGY WAL_LOG` option (Andres Freund) [§](https://postgr.es/c/560bb56c6) +* Avoid crash when the new schema name is omitted in `CREATE SCHEMA` (Michael Paquier) [§](https://postgr.es/c/b9ad73ad2) + + The SQL standard allows writing `CREATE SCHEMA AUTHORIZATION owner_name`, with the schema name defaulting to *`owner_name`*. However some code paths expected the schema name to be present and would fail. +* Fix various planner failures with `MERGE` commands (Tom Lane) [§](https://postgr.es/c/bf5c4b3d9) [§](https://postgr.es/c/3908d6ae1) + + Planning could fail with errors like “variable not found in subplan target list” or “PlaceHolderVar found where not expected”. +* Fix the row count reported by `MERGE` for some corner cases (Dean Rasheed) [§](https://postgr.es/c/da6257eee) [§](https://postgr.es/c/018af1cc1) + + The row count reported in the command tag counted rows that actually hadn't been modified due to a `BEFORE ROW` trigger returning NULL. This is inconsistent with what happens in plain `UPDATE` or `DELETE`, so change it to not count such rows. Also, avoid counting a row twice when `MERGE` moves it into a different partition of a partitioned table. +* Fix `MERGE` problems with concurrent updates (Dean Rasheed, Álvaro Herrera) [§](https://postgr.es/c/7d9a75713) [§](https://postgr.es/c/5d8ec1b9f) + + Some cases misbehaved if a row to be updated or deleted by `MERGE` had just been updated by a concurrent transaction. This could lead to a crash, or the wrong merge action being executed, or no action at all. +* Add support for decompiling `MERGE` commands (Álvaro Herrera) [§](https://postgr.es/c/f200b9695) + + This was overlooked when `MERGE` was added, but it's essential support for `MERGE` in new-style SQL functions. +* Fix enabling/disabling of foreign-key triggers in partitioned tables (Tom Lane) [§](https://postgr.es/c/f61e60102) + + `ALTER TABLE ... ENABLE/DISABLE TRIGGER` failed if applied to a partitioned table's foreign-key enforcement triggers, because it tried to locate the clone triggers for the partitions by name, and they do not have the same name. Locate them by parent-trigger OID instead. +* Disallow altering composite types that are stored in indexes (Tom Lane) [§](https://postgr.es/c/d90d59e25) + + `ALTER TYPE` disallows non-binary-compatible modifications of composite types if they are stored in any table columns. (Perhaps that will be allowed someday, but it hasn't happened yet; the locking implications of rewriting many tables are daunting.) We overlooked the possibility that an index might contain a composite type that doesn't also appear in its table. +* Disallow system columns as elements of foreign keys (Tom Lane) [§](https://postgr.es/c/6e3698173) + + Since the removal of OID as a system column, there is no plausible use-case for this, and various bits of code no longer support it. Disallow it rather than trying to fix all the cases. +* Ensure that `COPY TO` from an RLS-enabled parent table does not copy any rows from child tables (Antonin Houska) [§](https://postgr.es/c/59947bac7) + + The documentation is quite clear that `COPY TO` copies rows from only the named table, not any inheritance children it may have. However, if row-level security was enabled on the table then this stopped being true. +* Avoid possible crash when `array_position()` or `array_positions()` is passed an empty array (Tom Lane) [§](https://postgr.es/c/ccb479e76) +* Fix possible out-of-bounds fetch in `to_char()` (Tom Lane) [§](https://postgr.es/c/a67c75f82) + + With bad luck this could have resulted in a server crash. +* Avoid buffer overread in `translate()` function (Daniil Anisimov) [§](https://postgr.es/c/eae09137d) + + When using the deletion feature, the function might fetch the byte just after the input string, creating a small risk of crash. +* Adjust text-search-related character classification logic to correctly detect whether the prevailing locale is `C` (Jeff Davis) [§](https://postgr.es/c/8b87e9291) + + This code got confused if the database's default collation uses ICU. +* Avoid possible crash on empty input for type `interval` (Tom Lane) [§](https://postgr.es/c/0ef65d0f5) +* Re-allow exponential notation in ISO-8601 interval fields (Tom Lane) [§](https://postgr.es/c/ded5ede27) + + Interval input like `P0.1e10D` isn't officially sanctioned by ISO-8601, but we accepted it for a long time before version 15, so re-allow it. +* Fix error cursor setting for parse errors in JSON string literals (Tom Lane) [§](https://postgr.es/c/74a1a36d7) + + Most cases in which a syntax error is detected in a string literal within a JSON value failed to set the error cursor appropriately. This led at least to an unhelpful error message (pointing to the token before the string, rather than the actual trouble spot), and could even result in a crash in v14 and later. +* Fix data corruption due to `vacuum_defer_cleanup_age` being larger than the current 64-bit xid (Andres Freund) [§](https://postgr.es/c/391f08fd6) + + In v14 and later with non-default settings of `vacuum_defer_cleanup_age`, it was possible to compute a very large vacuum cleanup horizon xid, leading to vacuum removing rows that are still live. v12 and v13 have a lesser form of the same problem affecting only GiST indexes, which could lead to index pages getting recycled too early. +* Fix parser's failure to detect some cases of improperly-nested aggregates (Tom Lane) [§](https://postgr.es/c/5fd61bdc1) + + This oversight could lead to executor failures for queries that should have been rejected as invalid. +* Fix data structure corruption during parsing of serial `SEQUENCE NAME` options (David Rowley) [§](https://postgr.es/c/df567fbf6) + + This can lead to trouble if an event trigger captures the corrupted parse tree. +* Correctly update plan nodes' parallel-safety markings when moving initplans from one node to another (Tom Lane) [§](https://postgr.es/c/f4badbcf4) + + This planner oversight could lead to “subplan was not initialized” errors at runtime. +* Avoid failure with PlaceHolderVars in extended-statistics code (Tom Lane) [§](https://postgr.es/c/3b4594443) + + Use of dependency-type extended statistics could fail with “PlaceHolderVar found where not expected”. +* Fix incorrect tests for whether a qual clause applied to a subquery can be transformed into a window aggregate “run condition” within the subquery (David Rowley) [§](https://postgr.es/c/371e3daaa) + + A SubPlan within such a clause would cause assertion failures or incorrect answers, as would some other unusual cases. +* Disable the inverse-transition optimization for window aggregates when the call contains sub-SELECTs (David Rowley) [§](https://postgr.es/c/a9fa6d79a) + + This optimization requires that the aggregate's argument expressions have repeatable results, which might not hold for a sub-SELECT. +* Fix oversights in execution of nested `ARRAY[]` constructs (Alexander Lakhin, Tom Lane) [§](https://postgr.es/c/7c4873438) + + Correctly detect overflow of the total space needed for the result array, avoiding a possible crash due to undersized output allocation. Also ensure that any trailing padding space in the result array is zeroed; while leaving garbage there is harmless for most purposes, it can result in odd behavior later. +* Prevent crash when updating a field within an array-of-domain-over-composite-type column (Dmitry Dolgov) [§](https://postgr.es/c/c53ed26ea) +* Fix partition pruning logic for partitioning on boolean columns (David Rowley) [§](https://postgr.es/c/0c09160e1) + + Pruning with a condition like `boolcol IS NOT TRUE` was done incorrectly, leading to possibly not returning rows in which `boolcol` is NULL. Also, the rather unlikely case of partitioning on `NOT boolcol` was handled incorrectly. +* Fix race condition in per-batch cleanup during parallel hash join (Thomas Munro, Melanie Plageman) [§](https://postgr.es/c/c03c6e8cf) + + A crash was possible given unlucky timing and `parallel_leader_participation` = `off` (which is not the default). +* Recalculate `GENERATED` columns after an EvalPlanQual check (Tom Lane) [§](https://postgr.es/c/70ef50954) + + In `READ COMMITTED` isolation mode, the effects of a row update might need to get reapplied to a newer version of the row than the query found originally. If so, we need to recompute any `GENERATED` columns, in case they depend on columns that were changed by the concurrent update. +* Fix memory leak in Memoize plan execution (David Rowley) [§](https://postgr.es/c/8de4660a5) +* Fix buffer refcount leak when using batched inserts for a foreign table included in a partitioned tree (Alexander Pyhalov) [§](https://postgr.es/c/aa6177c88) +* Restore support for sub-millisecond `vacuum_cost_delay` settings (Thomas Munro) [§](https://postgr.es/c/d9c9c43af) +* Don't balance vacuum cost delay when a table has a per-relation `vacuum_cost_delay` setting of zero (Masahiko Sawada) [§](https://postgr.es/c/0319b306e) + + Delay balancing is supposed to be disabled whenever autovacuum is processing a table with a per-relation `vacuum_cost_delay` setting, but this was done only for positive settings, not zero. +* Fix corner-case crashes when columns have been added to the end of a view (Tom Lane) [§](https://postgr.es/c/76d2177fb) +* Repair rare failure of MULTIEXPR\_SUBLINK subplans in partitioned updates (Andres Freund, Tom Lane) [§](https://postgr.es/c/a033f9165) + + Use of the syntax `INSERT ... ON CONFLICT DO UPDATE SET (c1, ...) = (SELECT ...)` with a partitioned target table could result in failure if any child table is dissimilar from the parent (for example, different physical column order). This typically manifested as failure of consistency checks in the executor; but a crash or incorrect data updates are also possible. +* Fix handling of `DEFAULT` markers within a multi-row `INSERT ... VALUES` query on a view that has a `DO ALSO INSERT ... SELECT` rule (Dean Rasheed) [§](https://postgr.es/c/940b54743) + + Such cases typically failed with “unrecognized node type” errors or assertion failures. +* Support references to `OLD` and `NEW` within subqueries in rule actions (Dean Rasheed, Tom Lane) [§](https://postgr.es/c/8e5b4e001) + + Such references are really lateral references, but the server could crash if the subquery wasn't explicitly marked with `LATERAL`. Arrange to do that implicitly when necessary. +* When decompiling a rule or SQL function body containing `INSERT`/`UPDATE`/`DELETE` within `WITH`, take care to print the correct alias for the target table (Tom Lane) [§](https://postgr.es/c/c8a5f1685) +* Fix glitches in `SERIALIZABLE READ ONLY` optimization (Thomas Munro) [§](https://postgr.es/c/055990904) [§](https://postgr.es/c/af397c6c2) + + Transactions already marked as “doomed” confused the safe-snapshot optimization for `SERIALIZABLE READ ONLY` transactions. The optimization was unnecessarily skipped in some cases. In other cases an assertion failure occurred (but there was no problem in non-assert builds). +* Avoid leaking cache callback slots in the `pgoutput` logical decoding plugin (Shi Yu) [§](https://postgr.es/c/cef1c9c0c) + + Multiple cycles of starting up and shutting down the plugin within a single session would eventually lead to an “out of relcache\_callback\_list slots” error. +* Avoid unnecessary calls to custom validators for index operator class options (Alexander Korotkov) [§](https://postgr.es/c/6e7361c85) + + This change fixes some cases where an unexpected error was thrown. +* Avoid useless work while scanning a multi-column BRIN index with multiple scan keys (Tomas Vondra) [§](https://postgr.es/c/305d89ad9) + + The existing code effectively considered only the last scan key while deciding whether a range matched, thus usually scanning more of the index than it needed to. +* Fix netmask handling in BRIN inet\_minmax\_multi\_ops opclass (Tomas Vondra) [§](https://postgr.es/c/0c7726c28) + + This error triggered an assertion failure in assert-enabled builds, but is mostly harmless in production builds. +* Fix dereference of dangling pointer during buffering build of a GiST index (Alexander Lakhin) [§](https://postgr.es/c/2dc77adc7) + + This error seems to usually be harmless in production builds, as the fetched value is noncritical; but in principle it could cause a server crash. +* Ignore dropped columns and generated columns during logical replication of an update or delete action (Onder Kalaci, Shi Yu) [§](https://postgr.es/c/b6bf90edc) [§](https://postgr.es/c/3c12407f4) + + Replication with the `REPLICA IDENTITY FULL` option failed if the table contained such columns. +* Correct the name of the wait event for SLRU buffer I/O for commit timestamps (Alexander Lakhin) [§](https://postgr.es/c/d31dab9a5) + + This wait event is named `CommitTsBuffer` according to the documentation, but the code had it as `CommitTSBuffer`. Change the code to match the documentation, as that way is more consistent with the naming of related wait events. +* Re-activate reporting of wait event `SLRUFlushSync` (Thomas Munro) [§](https://postgr.es/c/1ed1b84bd) + + Reporting of this type of wait was accidentally removed in code refactoring. +* Avoid possible underflow when calculating how many WAL segments to keep (Kyotaro Horiguchi) [§](https://postgr.es/c/c98b06e2f) + + This could result in not honoring `wal_keep_size` accurately. +* Disable startup progress reporting overhead in standby mode (Bharath Rupireddy) [§](https://postgr.es/c/ecb01e6eb) + + In standby mode, we don't actually report progress of recovery, but we were doing work to track it anyway. +* Support RSA-PSS certificates with SCRAM-SHA-256 channel binding (Jacob Champion, Heikki Linnakangas) [§](https://postgr.es/c/5fd61055e) + + This feature requires building with OpenSSL 1.1.1 or newer. Both the server and libpq are affected. +* Avoid race condition with process ID tracking on Windows (Thomas Munro) [§](https://postgr.es/c/06066915d) [§](https://postgr.es/c/75e7378f6) [§](https://postgr.es/c/e8a774d00) + + The operating system could recycle a PID before the postmaster observed that that child process was gone. This could lead to tracking more than one child with the same PID, resulting in confusion. +* Fix `list_copy_head()` to work correctly on an empty List (David Rowley) [§](https://postgr.es/c/63a03aea6) + + This case is not known to be reached by any core PostgreSQL code, but extensions might rely on it working. +* Add missing cases to `SPI_result_code_string()` (Dean Rasheed) [§](https://postgr.es/c/576b25bfd) +* Fix erroneous Valgrind markings in `AllocSetRealloc()` (Karina Litskevich) [§](https://postgr.es/c/f6a55c1d5) + + In the unusual case where the size of a large (>8kB) palloc chunk is decreased, a Valgrind-aware build would mismark the defined-ness state of the memory released from the chunk, possibly causing incorrect results during Valgrind testing. +* Fix assertion failure for `MERGE` into a partitioned table with row-level security enabled (Dean Rasheed) [§](https://postgr.es/c/d8c3b65db) +* Avoid assertion failure when decoding a transactional logical replication message (Tomas Vondra) [§](https://postgr.es/c/949ac32e1) +* Avoid locale sensitivity when processing regular expression escapes (Jeff Davis) [§](https://postgr.es/c/109363de0) + + A backslash followed by a non-ASCII character could sometimes cause an assertion failure, depending on the prevailing locale. +* Avoid trying to write an empty WAL record in `log_newpage_range()` when the last few pages in the specified range are empty (Matthias van de Meent) [§](https://postgr.es/c/2207df7c3) + + It is not entirely clear whether this case is reachable in released branches, but if it is then an assertion failure could occur. +* Fix session-lifespan memory leakage in plpgsql `DO` blocks that use cast expressions (Ajit Awekar, Tom Lane) [§](https://postgr.es/c/c1598d85f) +* Tighten array dimensionality checks when converting Perl list structures to multi-dimensional SQL arrays (Tom Lane) [§](https://postgr.es/c/ce9a1a3ea) + + plperl could misbehave when the nesting of sub-lists is inconsistent so that the data does not represent a rectangular array of values. Such cases now produce errors, but previously they could result in a crash or garbage output. +* Tighten array dimensionality checks when converting Python list structures to multi-dimensional SQL arrays (Tom Lane) [§](https://postgr.es/c/b7001c6b6) [§](https://postgr.es/c/512c55522) + + plpython could misbehave when dealing with empty sub-lists, or when the nesting of sub-lists is inconsistent so that the data does not represent a rectangular array of values. The former should result in an empty output array, and the latter in an error. But some cases resulted in a crash, and others in unexpected output. +* Fix unwinding of exception stack in plpython (Xing Guo) [§](https://postgr.es/c/825ebc984) + + Some rare failure cases could return without cleaning up the PG\_TRY exception stack, risking a crash if another error was raised before the next stack level was unwound. +* Fix inconsistent GSS-encryption error handling in libpq's `PQconnectPoll()` (Michael Paquier) [§](https://postgr.es/c/4493256c5) + + With `gssencmode` set to `require`, the connection was not marked dead after a GSS initialization failure. Make it fail immediately, as the equivalent case for TLS encryption has long done. +* Fix possible data corruption in ecpg programs built with the `-C ORACLE` option (Kyotaro Horiguchi) [§](https://postgr.es/c/8c746be44) + + When `ecpg_get_data()` is called with `varcharsize` set to zero, it could write a terminating zero character into the last byte of the preceding field, truncating the data in that field. +* Fix pg\_dump so that partitioned tables that are hash-partitioned on an enum-type column can be restored successfully (Tom Lane) [§](https://postgr.es/c/2b216da1e) + + Since the hash codes for enum values depend on the OIDs assigned to the enum, they are typically different after a dump and restore, meaning that rows often need to go into a different partition than they were in originally. Users can work around that by specifying the `--load-via-partition-root` option; but since there is very little chance of success without that, teach pg\_dump to apply it automatically to such tables. + + Also, fix pg\_restore to not try to `TRUNCATE` target tables before restoring into them when `--load-via-partition-root` mode is used. This avoids a hazard of deadlocks and lost data. +* Correctly detect non-seekable files on Windows (Juan José Santamaría Flecha, Michael Paquier, Daniel Watzinger) [§](https://postgr.es/c/5c3254946) [§](https://postgr.es/c/69b6032e0) + + This bug led to misbehavior when pg\_dump writes to a pipe or pg\_restore reads from one. +* In pgbench's “prepared” mode, prepare all the commands in a pipeline before starting the pipeline (Álvaro Herrera) [§](https://postgr.es/c/108a22bd1) + + This avoids a failure when a pgbench script tries to start a serializable transaction inside a pipeline. +* In `contrib/amcheck`'s heap checking code, deal correctly with tuples having zero xmin or xmax (Robert Haas) [§](https://postgr.es/c/701ec5557) [§](https://postgr.es/c/453f53821) +* In `contrib/amcheck`, deal sanely with xids that appear to be before epoch zero (Andres Freund) [§](https://postgr.es/c/e8a9750d0) + + In cases of corruption we might see a wrapped-around 32-bit xid that appears to be before the first xid epoch. Promoting such a value to 64-bit form produced a value far in the future, resulting in wrong reports. Return FirstNormalFullTransactionId in such cases so that things work reasonably sanely. +* In `contrib/basebackup_to_shell`, properly detect failure to open a pipe (Robert Haas) [§](https://postgr.es/c/fa83e9e23) +* In `contrib/hstore_plpython`, avoid crashing if the Python value to be transformed isn't a mapping (Dmitry Dolgov, Tom Lane) [§](https://postgr.es/c/85ec8bcce) + + This should give an error, but Python 3 changed some APIs in a way that caused the check to misbehave, allowing a crash to ensue. +* Require the `siglen` option of a GiST index on an `ltree` column, if specified, to be a multiple of 4 (Alexander Korotkov) [§](https://postgr.es/c/214495dc5) + + Other values result in misaligned accesses to index content, which is harmless on Intel-compatible hardware but can cause a crash on some other architectures. +* In `contrib/pageinspect`, add defenses against incorrect input for the `gist_page_items()` function (Dmitry Koval) [§](https://postgr.es/c/9d41ecfcd) +* Fix misbehavior in `contrib/pg_trgm` with an unsatisfiable regular expression (Tom Lane) [§](https://postgr.es/c/6170386c7) + + A regex such as `$foo` is legal but unsatisfiable; the regex compiler recognizes that and produces an empty NFA graph. Attempting to optimize such a graph into a pg\_trgm GIN or GiST index qualification resulted in accessing off the end of a work array, possibly leading to crashes. +* Fix handling of escape sequences in `contrib/postgres_fdw`'s `application_name` parameter (Kyotaro Horiguchi, Michael Paquier) [§](https://postgr.es/c/5bace41ab) + + The code to expand these could fail if executed in a background process, as for example during auto-analyze of a foreign table. +* In `contrib/pg_walinspect`, limit memory usage of `pg_get_wal_records_info()` (Bharath Rupireddy) [§](https://postgr.es/c/da32a99df) +* Use the `--strip-unneeded` option when stripping static libraries with GNU-compatible strip (Tom Lane) [§](https://postgr.es/c/a14afd3bd) + + Previously, `make install-strip` used the `-x` option in this case. This change avoids misbehavior of llvm-strip, and gives slightly smaller output as well. +* Stop recommending auto-download of DTD files for building the documentation, and indeed disable it (Aleksander Alekseev, Peter Eisentraut, Tom Lane) [§](https://postgr.es/c/2ee703c9d) + + It appears no longer possible to build the SGML documentation without a local installation of the DocBook DTD files. Formerly xsltproc could download those files on-the-fly from sourceforge.net; but sourceforge.net now permits only HTTPS access, and no common version of xsltproc supports that. Hence, remove the bits of our documentation suggesting that that's possible or useful, and instead add xsltproc's `--nonet` option to the build recipes. +* When running TAP tests in PGXS builds, use a saner location for the temporary `portlock` directory (Peter Eisentraut) [§](https://postgr.es/c/3d37476f5) + + Place it under `tmp_check` in the build directory. With the previous coding, a PGXS build would try to place it in the installation directory, which is not necessarily writable. +* Update time zone data files to tzdata release 2023c for DST law changes in Egypt, Greenland, Morocco, and Palestine. (Tom Lane) [§](https://postgr.es/c/62b22caa5) + + When observing Moscow time, Europe/Kirov and Europe/Volgograd now use the abbreviations MSK/MSD instead of numeric abbreviations, for consistency with other timezones observing Moscow time. Also, America/Yellowknife is no longer distinct from America/Edmonton; this affects some pre-1948 timestamps in that area. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-15-4.html "E.12. Release 15.4") | [Up](release.html "Appendix E. Release Notes") | [Next](release-15-2.html "E.14. Release 15.2") | +| E.12. Release 15.4 | [Home](index.html "PostgreSQL 15.15 Documentation") | E.14. Release 15.2 | + +[Previous](/docs/release/15.2/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/15.4/) diff --git a/corpus/changelog/postgresql_releases/postgresql_154.md b/corpus/changelog/postgresql_releases/postgresql_154.md new file mode 100644 index 0000000000000000000000000000000000000000..9d7b7dba3df64511da3455f3310e9a368da7c480 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_154.md @@ -0,0 +1,169 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/15.4/ +Version: 15.4 + +## PostgreSQL 15.4 + +| E.12. Release 15.4 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-15-5.html "E.11. Release 15.5") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 15.15 Documentation") | [Next](release-15-3.html "E.13. Release 15.3") | + +--- + +## E.12. Release 15.4 + +[E.12.1. Migration to Version 15.4](release-15-4.html#id-1.11.6.17.4) + +[E.12.2. Changes](release-15-4.html#id-1.11.6.17.5) + +**Release date:**2023-08-10 + +This release contains a variety of fixes from 15.3. For information about new features in major release 15, see [Section E.16](release-15.html "E.16. Release 15"). + +### E.12.1. Migration to Version 15.4 + +A dump/restore is not required for those running 15.X. + +However, if you use BRIN indexes, it may be advisable to reindex them; see the third changelog entry below. + +Also, if you are upgrading from a version earlier than 15.1, see [Section E.15](release-15-1.html "E.15. Release 15.1"). + +### E.12.2. Changes + +* Disallow substituting a schema or owner name into an extension script if the name contains a quote, backslash, or dollar sign (Noah Misch) [§](https://postgr.es/c/de494ec14) + + This restriction guards against SQL-injection hazards for trusted extensions. + + The PostgreSQL Project thanks Micah Gates, Valerie Woolard, Tim Carey-Smith, and Christoph Berg for reporting this problem. (CVE-2023-39417) +* Fix `MERGE` to enforce row security policies properly (Dean Rasheed) [§](https://postgr.es/c/cb2ae5741) + + When `MERGE` performs an `UPDATE` action, it should enforce any `UPDATE` or `SELECT` RLS policies defined on the target table, to be consistent with the way that a plain `UPDATE` with a `WHERE` clause works. Instead it was enforcing `INSERT` RLS policies for both `INSERT` and `UPDATE` actions. + + In addition, when `MERGE` performs a `DO NOTHING` action, it applied the target table's `DELETE` RLS policies to existing rows, even though those rows are not being deleted. While it's not a security problem, this could result in unwanted errors. + + The PostgreSQL Project thanks Dean Rasheed for reporting this problem. (CVE-2023-39418) +* Fix confusion between empty (no rows) ranges and all-NULL ranges in BRIN indexes, as well as incorrect merging of all-NULL summaries (Tomas Vondra) [§](https://postgr.es/c/e18769323) [§](https://postgr.es/c/80f64b900) + + Each of these oversights could result in forgetting that a BRIN index range contains any NULL values, potentially allowing subsequent queries that should return NULL values to miss doing so. + + This fix will not in itself correct faulty BRIN entries. It's recommended to `REINDEX` any BRIN indexes that may be used to search for nulls. +* Avoid leaving a corrupted database behind when `DROP DATABASE` is interrupted (Andres Freund) [§](https://postgr.es/c/f66403749) + + If `DROP DATABASE` was interrupted after it had already begun taking irreversible steps, the target database remained accessible (because the removal of its `pg_database` row would roll back), but it would have corrupt contents. Fix by marking the database as inaccessible before we begin to perform irreversible operations. A failure after that will leave the database still partially present, but nothing can be done with it except to issue another `DROP DATABASE`. +* Ensure that partitioned indexes are correctly marked as valid or not at creation (Michael Paquier) [§](https://postgr.es/c/cb4ac3e56) + + If a new partitioned index matches an existing but invalid index on one of the partitions, the partitioned index could end up being marked valid prematurely. This could lead to misbehavior or assertion failures in subsequent queries on the partitioned table. +* Ignore invalid child indexes when matching partitioned indexes to child indexes during `ALTER TABLE ATTACH PARTITION` (Michael Paquier) [§](https://postgr.es/c/7aa17b498) + + Such an index will now be ignored, and a new child index created instead. +* Fix possible failure when marking a partitioned index valid after all of its partitions have been attached (Michael Paquier) [§](https://postgr.es/c/c0dc97c7b) + + The update of the index's `pg_index` entry could use stale data for other columns. One reported symptom is an “attempted to update invisible tuple” error. +* Fix `ALTER EXTENSION SET SCHEMA` to complain if the extension contains any objects outside the extension's schema (Michael Paquier, Heikki Linnakangas) [§](https://postgr.es/c/d1e0f408c) + + Erroring out if the extension contains objects in multiple schemas was always intended; but the check was mis-coded so that it would fail to detect some cases, leading to surprising behavior. +* Fix tracking of tables' access method dependencies (Michael Paquier) [§](https://postgr.es/c/93401ec02) + + `ALTER TABLE ... SET ACCESS METHOD` failed to update relevant `pg_depend` entries when changing a table's access method. When using non-built-in access methods, this creates a risk that an access method could be dropped even though tables still depend on it. This fix corrects the logic in `ALTER TABLE`, but it will not adjust any already-missing `pg_depend` entries. +* Don't use partial unique indexes for uniqueness proofs in the planner (David Rowley) [§](https://postgr.es/c/8f2ec8cc7) + + This could give rise to incorrect plans, since the presumed uniqueness of rows read from a table might not hold if the index in question isn't used to scan the table. +* Don't Memoize lateral joins with volatile join conditions (Richard Guo) [§](https://postgr.es/c/71662373b) + + Applying Memoize to a sub-plan that contains volatile filter conditions is likely to lead to wrong answers. The check to avoid doing this missed some cases that can arise when using `LATERAL`. +* Avoid producing incorrect plans for foreign joins with pseudoconstant join clauses (Etsuro Fujita) [§](https://postgr.es/c/d1ef5631e) + + The planner currently lacks support for attaching pseudoconstant join clauses to a pushed-down remote join, so disable generation of remote joins in such cases. (A better solution will require ABI-breaking changes of planner data structures, so it will have to wait for a future major release.) +* Correctly handle sub-SELECTs in RLS policy expressions and security-barrier views when expanding rule actions (Tom Lane) [§](https://postgr.es/c/cc6974df1) +* Fix race conditions in conflict detection for `SERIALIZABLE` isolation mode (Thomas Munro) [§](https://postgr.es/c/d34aa0a2f) [§](https://postgr.es/c/ab265e985) [§](https://postgr.es/c/0f275b0ee) + + Conflicts could be missed when using bitmap heap scans, when using GIN indexes, and when examining an initially-empty btree index. All these cases could lead to serializability failures due to improperly allowing conflicting transactions to commit. +* Fix misbehavior of EvalPlanQual checks with inherited or partitioned target tables (Tom Lane) [§](https://postgr.es/c/4729d1e8a) + + This oversight could lead to update or delete actions in `READ COMMITTED` isolation mode getting performed when they should have been skipped because of a conflicting concurrent update. +* Fix hash join with an inner-side hash key that contains Params coming from an outer nested loop (Tom Lane) [§](https://postgr.es/c/c2f974fff) + + When rescanning the join after the values of such Params have changed, we must rebuild the hash table, but neglected to do so. This could result in missing join output rows. +* Fix intermittent failures when trying to update a field of a composite column (Tom Lane) [§](https://postgr.es/c/cc8cca3c2) + + If the overall value of the composite column is wide enough to require out-of-line toasting, then an unluckily-timed cache flush could cause errors or server crashes. +* Prevent query-lifespan memory leaks in some `UPDATE` queries with triggers (Tomas Vondra) [§](https://postgr.es/c/ee87f8b63) [§](https://postgr.es/c/7ae4e7868) +* Prevent query-lifespan memory leaks when an Incremental Sort plan node is rescanned (James Coleman, Laurenz Albe, Tom Lane) [§](https://postgr.es/c/0c5fe4ff6) +* Accept fractional seconds in the input to `jsonpath`'s `datetime()` method (Tom Lane) [§](https://postgr.es/c/bd590d1fe) +* Prevent stack-overflow crashes with very complex text search patterns (Tom Lane) [§](https://postgr.es/c/a77d90171) +* Allow tokens up to 10240 bytes long in `pg_hba.conf` and `pg_ident.conf` (Tom Lane) [§](https://postgr.es/c/313ceda2f) + + The previous limit of 256 bytes has been found insufficient for some use-cases. +* Ensure that all existing placeholders are checked for matches when an extension declares its GUC prefix to be reserved (Karina Litskevich, Ekaterina Sokolova) [§](https://postgr.es/c/a5f312c58) + + Faulty loop logic could cause some entries to be skipped. +* Fix mishandling of C++ out-of-memory conditions (Heikki Linnakangas) [§](https://postgr.es/c/fa96a74a0) + + If JIT is in use, running out of memory in a C++ `new` call would lead to a PostgreSQL FATAL error, instead of the expected C++ exception. +* Fix rare null-pointer crash in `plancache.c` (Tom Lane) [§](https://postgr.es/c/fbaf65cd6) +* Avoid leaking a stats entry for a subscription when it is dropped (Masahiko Sawada) [§](https://postgr.es/c/66f8a1397) +* Avoid losing track of possibly-useful shared memory segments when a page free results in coalescing ranges of free space (Dongming Liu) [§](https://postgr.es/c/9ffb10f18) + + Ensure that the segment is moved into the appropriate “bin” for its new amount of free space, so that it will be found by subsequent searches. +* Allow `VACUUM` to continue after detecting certain types of b-tree index corruption (Peter Geoghegan) [§](https://postgr.es/c/642bec1f8) [§](https://postgr.es/c/6983a5112) + + If an invalid sibling-page link is detected, log the issue and press on, rather than throwing an error as before. Nothing short of `REINDEX` will fix the broken index, but preventing `VACUUM` from completing until that is done risks making matters far worse. +* Ensure that `WrapLimitsVacuumLock` is released after `VACUUM` detects invalid data in `pg_database`.`datfrozenxid` or `pg_database`.`datminmxid` (Andres Freund) [§](https://postgr.es/c/82e97b864) + + Failure to release this lock could lead to a deadlock later, although the lock would be cleaned up if the session exits or encounters some other error. +* Avoid double replay of prepared transactions during crash recovery (suyu.cmj, Michael Paquier) [§](https://postgr.es/c/a878eff6b) [§](https://postgr.es/c/f6ecd2622) + + After a crash partway through a checkpoint with some two-phase transaction state data already flushed to disk by this checkpoint, crash recovery could attempt to replay the prepared transaction(s) twice, leading to a fatal error such as “lock is already held” in the startup process. +* Ensure that a newly created, but still empty table is `fsync`'ed at the next checkpoint (Heikki Linnakangas) [§](https://postgr.es/c/e24c02e4d) + + Without this, if there is an operating system crash causing the empty file to disappear, subsequent operations on the table might fail with “could not open file” errors. +* Ensure that creation of the init fork of an unlogged index is WAL-logged (Heikki Linnakangas) [§](https://postgr.es/c/25624c5d3) + + While an unlogged index's main data fork is not WAL-logged, its init fork should be, to ensure that we have a consistent state to restore the index to after a crash. This step was missed if the init fork contains no data, which is a case not used by any standard index AM; but perhaps some extension behaves that way. +* Silence bogus “missing contrecord” errors (Thomas Munro) [§](https://postgr.es/c/f50200c01) + + Treat this case as plain end-of-WAL to avoid logging inaccurate complaints from pg\_waldump and walsender. +* Fix overly strict assertion in `jsonpath` code (David Rowley) [§](https://postgr.es/c/67f3a697b) + + This assertion failed if a query applied the `.type()` operator to a `like_regex` result. There was no bug in non-assert builds. +* Avoid assertion failure when processing an empty statement via the extended query protocol in an already-aborted transaction (Tom Lane) [§](https://postgr.es/c/cb74f7bec) +* Avoid assertion failure when the `stats_fetch_consistency` setting is changed intra-transaction (Kyotaro Horiguchi) [§](https://postgr.es/c/ccd21e1cf) +* Fix `contrib/fuzzystrmatch`'s Soundex `difference()` function to handle empty input sanely (Alexander Lakhin, Tom Lane) [§](https://postgr.es/c/eaf99e4c4) + + An input string containing no alphabetic characters resulted in unpredictable output. +* Tighten whitespace checks in `contrib/hstore` input (Evan Jones) [§](https://postgr.es/c/3a5222a43) + + In some cases, characters would be falsely recognized as whitespace and hence discarded. +* Disallow oversize input arrays with `contrib/intarray`'s `gist__int_ops` index opclass (Ankit Kumar Pandey, Alexander Lakhin) [§](https://postgr.es/c/4be308ede) + + Previously this code would report a `NOTICE` but press on anyway, creating an invalid index entry that presents a risk of crashes when the index is read. +* Avoid useless double decompression of GiST index entries in `contrib/intarray` (Konstantin Knizhnik, Matthias van de Meent, Tom Lane) [§](https://postgr.es/c/5cb461989) +* Fix `contrib/pageinspect`'s `gist_page_items()` function to work when there are included index columns (Alexander Lakhin, Michael Paquier) [§](https://postgr.es/c/2dd778221) + + Previously, if the index has included columns, `gist_page_items()` would fail to display those values on index leaf pages, or crash outright on non-leaf pages. +* In psql, ignore the `PSQL_WATCH_PAGER` environment variable when stdin/stdout are not a terminal (Tom Lane) [§](https://postgr.es/c/bc478a0a8) + + This corresponds to the treatment of `PSQL_PAGER` in commands besides `\watch`. +* Fix pg\_dump to correctly handle new-style SQL-language functions whose bodies require parse-time dependencies on unique indexes (Tom Lane) [§](https://postgr.es/c/ca9e79274) + + Such cases can arise from `GROUP BY` and `ON CONFLICT` clauses, for example. The function must then be postponed until after the unique index in the dump output, but pg\_dump did not do that and instead printed a warning about “could not resolve dependency loop”. +* Improve pg\_dump's display of details about dependency-loop problems (Tom Lane) [§](https://postgr.es/c/751ba1a7c) +* Avoid crash in pgbench with an empty pipeline and prepared mode (Álvaro Herrera) [§](https://postgr.es/c/34f511965) +* Ensure that `pg_index`.`indisreplident` is kept up-to-date in relation cache entries (Shruthi Gowda) [§](https://postgr.es/c/eb3abec4b) + + This value could be stale in some cases. There is no core code that relies on the relation cache's copy, so this is only a latent bug as far as Postgres itself is concerned; but there may be extensions for which it is a live bug. +* Fix make\_etags script to work with non-Exuberant ctags (Masahiko Sawada) [§](https://postgr.es/c/af26f28b9) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-15-5.html "E.11. Release 15.5") | [Up](release.html "Appendix E. Release Notes") | [Next](release-15-3.html "E.13. Release 15.3") | +| E.11. Release 15.5 | [Home](index.html "PostgreSQL 15.15 Documentation") | E.13. Release 15.3 | + +[Previous](/docs/release/15.3/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/15.5/) diff --git a/corpus/changelog/postgresql_releases/postgresql_155.md b/corpus/changelog/postgresql_releases/postgresql_155.md new file mode 100644 index 0000000000000000000000000000000000000000..47a703dd9997f075e9c1ac483328eb6eb356f7ab --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_155.md @@ -0,0 +1,202 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/15.5/ +Version: 15.5 + +## PostgreSQL 15.5 + +| E.11. Release 15.5 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-15-6.html "E.10. Release 15.6") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 15.15 Documentation") | [Next](release-15-4.html "E.12. Release 15.4") | + +--- + +## E.11. Release 15.5 + +[E.11.1. Migration to Version 15.5](release-15-5.html#id-1.11.6.16.4) + +[E.11.2. Changes](release-15-5.html#id-1.11.6.16.5) + +**Release date:**2023-11-09 + +This release contains a variety of fixes from 15.4. For information about new features in major release 15, see [Section E.16](release-15.html "E.16. Release 15"). + +### E.11.1. Migration to Version 15.5 + +A dump/restore is not required for those running 15.X. + +However, several mistakes have been discovered that could lead to certain types of indexes yielding wrong search results or being unnecessarily inefficient. It is advisable to `REINDEX` potentially-affected indexes after installing this update. See the fourth through seventh changelog entries below. + +Also, if you are upgrading from a version earlier than 15.4, see [Section E.12](release-15-4.html "E.12. Release 15.4"). + +### E.11.2. Changes + +* Fix handling of unknown-type arguments in `DISTINCT` `"any"` aggregate functions (Tom Lane) [§](https://postgr.es/c/4f4a422fb) + + This error led to a `text`-type value being interpreted as an `unknown`-type value (that is, a zero-terminated string) at runtime. This could result in disclosure of server memory following the `text` value. + + The PostgreSQL Project thanks Jingzhou Fu for reporting this problem. (CVE-2023-5868) +* Detect integer overflow while computing new array dimensions (Tom Lane) [§](https://postgr.es/c/3bc6bc3ee) + + When assigning new elements to array subscripts that are outside the current array bounds, an undetected integer overflow could occur in edge cases. Memory stomps that are potentially exploitable for arbitrary code execution are possible, and so is disclosure of server memory. + + The PostgreSQL Project thanks Pedro Gallegos for reporting this problem. (CVE-2023-5869) +* Prevent the `pg_signal_backend` role from signalling background workers and autovacuum processes (Noah Misch, Jelte Fennema-Nio) [§](https://postgr.es/c/595c988c9) [§](https://postgr.es/c/fbc371909) + + The documentation says that `pg_signal_backend` cannot issue signals to superuser-owned processes. It was able to signal these background processes, though, because they advertise a role OID of zero. Treat that as indicating superuser ownership. The security implications of cancelling one of these process types are fairly small so far as the core code goes (we'll just start another one), but extensions might add background workers that are more vulnerable. + + Also ensure that the `is_superuser` parameter is set correctly in such processes. No specific security consequences are known for that oversight, but it might be significant for some extensions. + + The PostgreSQL Project thanks Hemanth Sandrana and Mahendrakar Srinivasarao for reporting this problem. (CVE-2023-5870) +* Fix misbehavior during recursive page split in GiST index build (Heikki Linnakangas) [§](https://postgr.es/c/c3c284b37) + + Fix a case where the location of a page downlink was incorrectly tracked, and introduce some logic to allow recovering from such situations rather than silently doing the wrong thing. This error could result in incorrect answers from subsequent index searches. It may be advisable to reindex all GiST indexes after installing this update. +* Prevent de-duplication of btree index entries for `interval` columns (Noah Misch) [§](https://postgr.es/c/782be0f71) + + There are `interval` values that are distinguishable but compare equal, for example `24:00:00` and `1 day`. This breaks assumptions made by btree de-duplication, so `interval` columns need to be excluded from de-duplication. This oversight can cause incorrect results from index-only scans. Moreover, after updating amcheck will report an error for almost all such indexes. Users should reindex any btree indexes on `interval` columns. +* Process `date` values more sanely in BRIN `datetime_minmax_multi_ops` indexes (Tomas Vondra) [§](https://postgr.es/c/088233f8d) + + The distance calculation for dates was backward, causing poor decisions about which entries to merge. The index still produces correct results, but is much less efficient than it should be. Reindexing BRIN `minmax_multi` indexes on `date` columns is advisable. +* Process large `timestamp` and `timestamptz` values more sanely in BRIN `datetime_minmax_multi_ops` indexes (Tomas Vondra) [§](https://postgr.es/c/d04a9283b) [§](https://postgr.es/c/daa7b0d7c) + + Infinities were mistakenly treated as having distance zero rather than a large distance from other values, causing poor decisions about which entries to merge. Also, finite-but-very-large values (near the endpoints of the representable timestamp range) could result in internal overflows, again causing poor decisions. The index still produces correct results, but is much less efficient than it should be. Reindexing BRIN `minmax_multi` indexes on `timestamp` and `timestamptz` columns is advisable if the column contains, or has contained, infinities or large finite values. +* Avoid calculation overflows in BRIN `interval_minmax_multi_ops` indexes with extreme interval values (Tomas Vondra) [§](https://postgr.es/c/2fbb2fcb0) + + This bug might have caused unexpected failures while trying to insert large interval values into such an index. +* Fix partition step generation and runtime partition pruning for hash-partitioned tables with multiple partition keys (David Rowley) [§](https://postgr.es/c/1e81d3e6e) [§](https://postgr.es/c/916adc7c5) + + Some cases involving an `IS NULL` condition on one of the partition keys could result in a crash. +* Fix inconsistent rechecking of concurrently-updated rows during `MERGE` (Dean Rasheed) [§](https://postgr.es/c/3c1a1af91) + + In `READ COMMITTED` mode, an update that finds that its target row was just updated by a concurrent transaction will recheck the query's `WHERE` conditions on the updated row. `MERGE` failed to ensure that the proper rows of other joined tables were used during this recheck, possibly resulting in incorrect decisions about whether the newly-updated row should be updated again by `MERGE`. +* Correctly identify the target table in an inherited `UPDATE`/`DELETE`/`MERGE` even when the parent table is excluded by constraints (Amit Langote, Tom Lane) [§](https://postgr.es/c/1268e7378) + + If the initially-named table is excluded by constraints, but not all its inheritance descendants are, the first non-excluded descendant was identified as the primary target table. This would lead to firing statement-level triggers associated with that table, rather than the initially-named table as should happen. In v16, the same oversight could also lead to “invalid perminfoindex 0 in RTE with relid NNNN” errors. +* Fix edge case in btree mark/restore processing of ScalarArrayOpExpr clauses (Peter Geoghegan) [§](https://postgr.es/c/cac37c1a1) + + When restoring an indexscan to a previously marked position, the code could miss required setup steps if the scan had advanced exactly to the end of the matches for a ScalarArrayOpExpr (that is, an `indexcol = ANY(ARRAY[])`) clause. This could result in missing some rows that should have been fetched. +* Fix intra-query memory leak in Memoize execution (Orlov Aleksej, David Rowley) [§](https://postgr.es/c/689af6db6) +* Fix intra-query memory leak when a set-returning function repeatedly returns zero rows (Tom Lane) [§](https://postgr.es/c/592cb11fb) +* Don't crash if `cursor_to_xmlschema()` is applied to a non-data-returning Portal (Boyu Yang) [§](https://postgr.es/c/95f54f0d0) +* Throw the intended error if `pgrowlocks()` is applied to a partitioned table (David Rowley) [§](https://postgr.es/c/136068353) + + Previously, a not-on-point complaint “only heap AM is supported” would be raised. +* Handle invalid indexes more cleanly in assorted SQL functions (Noah Misch) [§](https://postgr.es/c/e633e9b13) + + Report an error if `pgstatindex()`, `pgstatginindex()`, `pgstathashindex()`, or `pgstattuple()` is applied to an invalid index. If `brin_desummarize_range()`, `brin_summarize_new_values()`, `brin_summarize_range()`, or `gin_clean_pending_list()` is applied to an invalid index, do nothing except to report a debug-level message. Formerly these functions attempted to process the index, and might fail in strange ways depending on what the failed `CREATE INDEX` had left behind. +* Fix `pg_stat_reset_single_table_counters()` to do the right thing for a shared catalog (Masahiro Ikeda) [§](https://postgr.es/c/ad8753a3a) + + Previously the reset would be ineffective. +* Avoid premature memory allocation failure with long inputs to `to_tsvector()` (Tom Lane) [§](https://postgr.es/c/71bb73f60) +* Fix over-allocation of the constructed `tsvector` in `tsvectorrecv()` (Denis Erokhin) [§](https://postgr.es/c/55e188a15) + + If the incoming vector includes position data, the binary receive function left wasted space (roughly equal to the size of the position data) in the finished `tsvector`. In extreme cases this could lead to “maximum total lexeme length exceeded” failures for vectors that were under the length limit when emitted. In any case it could lead to wasted space on-disk. +* Fix incorrect coding in `gtsvector_picksplit()` (Alexander Lakhin) [§](https://postgr.es/c/88aa4a049) + + This could lead to poor page-split decisions in GiST indexes on `tsvector` columns. +* Improve checks for corrupt PGLZ compressed data (Flavien Guedez) [§](https://postgr.es/c/985ac5ce2) +* In `COPY FROM`, fail cleanly when an unsupported encoding conversion is needed (Tom Lane) [§](https://postgr.es/c/95fd5c89f) + + Recent refactoring accidentally removed the intended error check for this, such that it ended in “cache lookup failed for function 0” instead of a useful error message. +* Avoid crash in `EXPLAIN` if a parameter marked to be displayed by `EXPLAIN` has a NULL boot-time value (Xing Guo, Aleksander Alekseev, Tom Lane) [§](https://postgr.es/c/ae33659d4) + + No built-in parameter fits this description, but an extension could define such a parameter. +* Ensure we have a snapshot while dropping `ON COMMIT DROP` temp tables (Tom Lane) [§](https://postgr.es/c/0d1a7cd14) + + This prevents possible misbehavior if any catalog entries for the temp tables have fields wide enough to require toasting (such as a very complex `CHECK` condition). +* Avoid improper response to shutdown signals in child processes just forked by `system()` (Nathan Bossart) [§](https://postgr.es/c/c9265ae80) + + This fix avoids a race condition in which a child process that has been forked off by `system()`, but hasn't yet exec'd the intended child program, might receive and act on a signal intended for the parent server process. That would lead to duplicate cleanup actions being performed, which will not end well. +* Cope with torn reads of `pg_control` in frontend programs (Thomas Munro) [§](https://postgr.es/c/5e39884d3) + + On some file systems, reading `pg_control` may not be an atomic action when the server concurrently writes that file. This is detectable via a bad CRC. Retry a few times to see if the file becomes valid before we report error. +* Avoid torn reads of `pg_control` in relevant SQL functions (Thomas Munro) [§](https://postgr.es/c/606be8a35) + + Acquire the appropriate lock before reading `pg_control`, to ensure we get a consistent view of that file. +* Avoid integer overflow when computing size of backend activity string array (Jakub Wartak) [§](https://postgr.es/c/95e91da66) + + On 64-bit machines we will allow values of `track_activity_query_size` large enough to cause 32-bit overflow when multiplied by the allowed number of connections. The code actually allocating the per-backend local array was careless about this though, and allocated the array incorrectly. +* Fix briefly showing inconsistent progress statistics for `ANALYZE` on inherited tables (Heikki Linnakangas) [§](https://postgr.es/c/5ae245664) + + The block-level counters should be reset to zero at the same time we update the current-relation field. +* Fix the background writer to report any WAL writes it makes to the statistics counters (Nazir Bilal Yavuz) [§](https://postgr.es/c/0684d1949) +* Fix confusion about forced-flush behavior in `pgstat_report_wal()` (Ryoga Yoshida, Michael Paquier) [§](https://postgr.es/c/802fcb9ed) + + This could result in some statistics about WAL I/O being forgotten in a shutdown. +* Track the dependencies of cached `CALL` statements, and re-plan them when needed (Tom Lane) [§](https://postgr.es/c/0e59266a5) + + DDL commands, such as replacement of a function that has been inlined into a `CALL` argument, can create the need to re-plan a `CALL` that has been cached by PL/pgSQL. That was not happening, leading to misbehavior or strange errors such as “cache lookup failed”. +* Avoid a possible pfree-a-NULL-pointer crash after an error in OpenSSL connection setup (Sergey Shinderuk) [§](https://postgr.es/c/9dc85806d) +* Track nesting depth correctly when inspecting `RECORD`-type Vars from outer query levels (Richard Guo) [§](https://postgr.es/c/2679a107a) + + This oversight could lead to assertion failures, core dumps, or “bogus varno” errors. +* Track hash function and negator function dependencies of ScalarArrayOpExpr plan nodes (David Rowley) [§](https://postgr.es/c/17a3f1c34) + + In most cases this oversight was harmless, since these functions would be unlikely to disappear while the node's original operator remains present. +* Fix error-handling bug in `RECORD` type cache management (Thomas Munro) [§](https://postgr.es/c/a26cc0334) + + An out-of-memory error occurring at just the wrong point could leave behind inconsistent state that would lead to an infinite loop. +* Fix assertion failure when logical decoding is retried in the same session after an error (Hou Zhijie) [§](https://postgr.es/c/c7256e656) +* Treat out-of-memory failures as fatal while reading WAL (Michael Paquier) [§](https://postgr.es/c/afc79591d) + + Previously this would be treated as a bogus-data condition, leading to the conclusion that we'd reached the end of WAL, which is incorrect and could lead to inconsistent WAL replay. +* Fix possible recovery failure due to trying to allocate memory based on a bogus WAL record length field (Thomas Munro, Michael Paquier) [§](https://postgr.es/c/f4d152edd) [§](https://postgr.es/c/99d334a18) +* Fix race condition in database dropping that could lead to the autovacuum launcher getting stuck (Andres Freund, Will Mortensen, Jacob Speidel) [§](https://postgr.es/c/5a9325fdd) + + The race could lead to a statistics entry for the removed database remaining present, confusing the launcher's selection of which database to process. +* Fix datatype size confusion in logical tape management (Ranier Vilela) [§](https://postgr.es/c/5180160c1) + + Integer overflow was possible on platforms where long is wider than int, although it would take a multiple-terabyte temporary file to cause a problem. +* Avoid unintended close of syslogger process's stdin (Heikki Linnakangas) [§](https://postgr.es/c/0c1024060) +* Avoid doing plan cache revalidation of utility statements that do not receive interesting processing during parse analysis (Tom Lane) [§](https://postgr.es/c/870085135) + + Aside from saving a few cycles, this prevents failure after a cache invalidation for statements that must not set a snapshot, such as `SET TRANSACTION ISOLATION LEVEL`. +* Keep by-reference `attmissingval` values in a long-lived context while they are being used (Andrew Dunstan) [§](https://postgr.es/c/75f323aa1) + + This avoids possible use of dangling pointers when a tuple slot outlives the tuple descriptor with which its value was constructed. +* Recalculate the effective value of `search_path` after `ALTER ROLE` (Jeff Davis) [§](https://postgr.es/c/9f3343e40) [§](https://postgr.es/c/1bc19dfcf) + + This ensures that after renaming a role, the meaning of the special string `$user` is re-determined. +* Fix “could not duplicate handle” error occurring on Windows when `min_dynamic_shared_memory` is set above zero (Thomas Munro) [§](https://postgr.es/c/f72790b29) +* Fix order of operations in `GenericXLogFinish` (Jeff Davis) [§](https://postgr.es/c/b9bb02620) + + This code violated the conditions required for crash safety by writing WAL before marking changed buffers dirty. No core code uses this function, but extensions do (`contrib/bloom` does, for example). +* Remove incorrect assertion in PL/Python exception handling (Alexander Lakhin) [§](https://postgr.es/c/9e0ce80f3) +* Fix assertion failure in pg\_dump when it's asked to dump the `pg_catalog` schema (Peter Eisentraut) [§](https://postgr.es/c/1d9976d1b) [§](https://postgr.es/c/3a788447d) +* Fix pg\_restore so that selective restores will include both table-level and column-level ACLs for selected tables (Euler Taveira, Tom Lane) [§](https://postgr.es/c/10e705bd2) + + Formerly, only the table-level ACL would get restored if both types were present. +* Add logic to pg\_upgrade to check for use of `abstime`, `reltime`, and `tinterval` data types (Álvaro Herrera) [§](https://postgr.es/c/8845d8597) [§](https://postgr.es/c/04d2d605f) + + These obsolete data types were removed in PostgreSQL version 12, so check to make sure they aren't present in an older database before claiming it can be upgraded. +* Avoid generating invalid temporary slot names in pg\_basebackup (Jelte Fennema) [§](https://postgr.es/c/574bff7bd) + + This has only been seen to occur when the server connection runs through pgbouncer. +* Avoid false “too many client connections” errors in pgbench on Windows (Noah Misch) [§](https://postgr.es/c/1102f4ece) +* In `contrib/amcheck`, do not report interrupted page deletion as corruption (Noah Misch) [§](https://postgr.es/c/6f81386a9) + + This fix prevents false-positive reports of “the first child of leftmost target page is not leftmost of its level”, “block NNNN is not leftmost” or “left link/right link pair in index XXXX not in agreement”. They appeared if amcheck ran after an unfinished btree index page deletion and before `VACUUM` had cleaned things up. +* Fix failure of `contrib/btree_gin` indexes on `interval` columns, when an indexscan using the `<` or `<=` operator is performed (Dean Rasheed) [§](https://postgr.es/c/5f0691839) + + Such an indexscan failed to return all the entries it should. +* Add support for LLVM 16 and 17 (Thomas Munro, Dmitry Dolgov) [§](https://postgr.es/c/b60e3ac76) [§](https://postgr.es/c/eed1feb3f) [§](https://postgr.es/c/b2e097788) +* Suppress assorted build-time warnings on recent macOS (Tom Lane) [§](https://postgr.es/c/be3398ea1) [§](https://postgr.es/c/78f17fb97) + + Xcode 15 (released with macOS Sonoma) changed the linker's behavior in a way that causes many duplicate-library warnings while building PostgreSQL. These were harmless, but they're annoying so avoid citing the same libraries twice. Also remove use of the `-multiply_defined suppress` linker switch, which apparently has been a no-op for a long time, and is now actively complained of. +* When building `contrib/unaccent`'s rules file, fall back to using `python` if `--with-python` was not given and make variable `PYTHON` was not set (Japin Li) [§](https://postgr.es/c/8a9e4e84e) +* Remove `PHOT` (Phoenix Islands Time) from the default timezone abbreviations list (Tom Lane) [§](https://postgr.es/c/85b98a70b) + + Presence of this abbreviation in the default list can cause failures on recent Debian and Ubuntu releases, as they no longer install the underlying tzdb entry by default. Since this is a made-up abbreviation for a zone with a total human population of about two dozen, it seems unlikely that anyone will miss it. If someone does, they can put it back via a custom abbreviations file. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-15-6.html "E.10. Release 15.6") | [Up](release.html "Appendix E. Release Notes") | [Next](release-15-4.html "E.12. Release 15.4") | +| E.10. Release 15.6 | [Home](index.html "PostgreSQL 15.15 Documentation") | E.12. Release 15.4 | + +[Previous](/docs/release/15.4/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/15.6/) diff --git a/corpus/changelog/postgresql_releases/postgresql_156.md b/corpus/changelog/postgresql_releases/postgresql_156.md new file mode 100644 index 0000000000000000000000000000000000000000..1b2903973aec5317a3618d966e0995762e219cb0 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_156.md @@ -0,0 +1,206 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/15.6/ +Version: 15.6 + +## PostgreSQL 15.6 + +| E.10. Release 15.6 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-15-7.html "E.9. Release 15.7") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 15.15 Documentation") | [Next](release-15-5.html "E.11. Release 15.5") | + +--- + +## E.10. Release 15.6 + +[E.10.1. Migration to Version 15.6](release-15-6.html#id-1.11.6.15.4) + +[E.10.2. Changes](release-15-6.html#id-1.11.6.15.5) + +**Release date:**2024-02-08 + +This release contains a variety of fixes from 15.5. For information about new features in major release 15, see [Section E.16](release-15.html "E.16. Release 15"). + +### E.10.1. Migration to Version 15.6 + +A dump/restore is not required for those running 15.X. + +However, one bug was fixed that could have resulted in corruption of GIN indexes during concurrent updates. If you suspect such corruption, reindex affected indexes after installing this update. + +Also, if you are upgrading from a version earlier than 15.5, see [Section E.11](release-15-5.html "E.11. Release 15.5"). + +### E.10.2. Changes + +* Tighten security restrictions within `REFRESH MATERIALIZED VIEW CONCURRENTLY` (Heikki Linnakangas) [§](https://postgr.es/c/f2fdea198) [§](https://postgr.es/c/06f36bc01) + + One step of a concurrent refresh command was run under weak security restrictions. If a materialized view's owner could persuade a superuser or other high-privileged user to perform a concurrent refresh on that view, the view's owner could control code executed with the privileges of the user running `REFRESH`. Fix things so that all user-determined code is run as the view's owner, as expected. + + The only known exploit for this error does not work in PostgreSQL 16.0 and later, so it may be that v16 is not vulnerable in practice. + + The PostgreSQL Project thanks Pedro Gallegos for reporting this problem. (CVE-2024-0985) +* Fix memory leak when performing JIT inlining (Andres Freund, Daniel Gustafsson) [§](https://postgr.es/c/aef521849) + + There have been multiple reports of backend processes suffering out-of-memory conditions after sufficiently many JIT compilations. This fix should resolve that. +* When dequeueing from an LWLock, avoid needing to search the list of waiting processes (Andres Freund) [§](https://postgr.es/c/f374fb4aa) + + This fixes O(N^2) behavior when the list of waiters is long. In some use-cases this results in substantial throughput improvements. +* Avoid generating incorrect partitioned-join plans (Richard Guo) [§](https://postgr.es/c/12ec16d11) + + Some uncommon situations involving lateral references could create incorrect plans. Affected queries could produce wrong answers, or odd failures such as “variable not found in subplan target list”, or executor crashes. +* Fix incorrect wrapping of subquery output expressions in PlaceHolderVars (Tom Lane) [§](https://postgr.es/c/a0b4fda44) + + This fixes incorrect results when a subquery is underneath an outer join and has an output column that laterally references something outside the outer join's scope. The output column might not appear as NULL when it should do so due to the action of the outer join. +* Fix misprocessing of window function run conditions (Richard Guo) [§](https://postgr.es/c/c3f52fd5d) + + This oversight could lead to “WindowFunc not found in subplan target lists” errors. +* Skip inappropriate actions when `MERGE` causes a cross-partition update (Dean Rasheed) [§](https://postgr.es/c/c0bfdaf2b) + + When executing a `MERGE UPDATE` action on a partitioned table, if the `UPDATE` is turned into a `DELETE` and `INSERT` due to changing a partition key column, skip firing `AFTER UPDATE ROW` triggers, as well as other post-update actions such as RLS checks. These actions would typically fail, which is why a regular `UPDATE` doesn't do them in such cases; `MERGE` shouldn't either. +* Cope with `BEFORE ROW DELETE` triggers in cross-partition `MERGE` updates (Dean Rasheed) [§](https://postgr.es/c/7e8c6d7af) + + If such a trigger attempted to prevent the update by returning NULL, `MERGE` would suffer an error or assertion failure. +* Prevent access to a no-longer-pinned buffer in `BEFORE ROW UPDATE` triggers (Alexander Lakhin, Tom Lane) [§](https://postgr.es/c/1a4e54617) + + If the tuple being updated had just been updated and moved to another page by another session, there was a narrow window where we would attempt to fetch data from the new tuple version without any pin on its buffer. In principle this could result in garbage data appearing in non-updated columns of the proposed new tuple. The odds of problems in practice seem rather low, however. +* Avoid requesting an oversize shared-memory area in parallel hash join (Thomas Munro, Andrei Lepikhov, Alexander Korotkov) [§](https://postgr.es/c/1a7c03e6f) [§](https://postgr.es/c/6eecc3a62) + + The limiting value was too large, allowing “invalid DSA memory alloc request size” errors to occur with sufficiently large expected hash table sizes. +* Avoid assertion failures in `heap_update()` and `heap_delete()` when a tuple to be updated by a foreign-key enforcement trigger fails the extra visibility crosscheck (Alexander Lakhin) [§](https://postgr.es/c/2873fbfe0) + + This error had no impact in non-assert builds. +* Fix overly tight assertion about `false_positive_rate` parameter of BRIN bloom operator classes (Alexander Lakhin) [§](https://postgr.es/c/7e18c0bd6) + + This error had no impact in non-assert builds, either. +* Fix possible failure during `ALTER TABLE ADD COLUMN` on a complex inheritance tree (Tender Wang) [§](https://postgr.es/c/ad6fbbeeb) + + If a grandchild table would inherit the new column via multiple intermediate parents, the command failed with “tuple already updated by self”. +* Fix problems with duplicate token names in `ALTER TEXT SEARCH CONFIGURATION ... MAPPING` commands (Tender Wang, Michael Paquier) [§](https://postgr.es/c/41fa4b31c) +* Properly lock the associated table during `DROP STATISTICS` (Tomas Vondra) [§](https://postgr.es/c/0177fc773) + + Failure to acquire the lock could result in “tuple concurrently deleted” errors if the `DROP` executes concurrently with `ANALYZE`. +* Fix function volatility checking for `GENERATED` and `DEFAULT` expressions (Tom Lane) [§](https://postgr.es/c/9057ddbef) + + These places could fail to detect insertion of a volatile function default-argument expression, or decide that a polymorphic function is volatile although it is actually immutable on the datatype of interest. This could lead to improperly rejecting or accepting a `GENERATED` clause, or to mistakenly applying the constant-default-value optimization in `ALTER TABLE ADD COLUMN`. +* Detect that a new catalog cache entry became stale while detoasting its fields (Tom Lane) [§](https://postgr.es/c/2a46a0df4) [§](https://postgr.es/c/d41358f4b) + + We expand any out-of-line fields in a catalog tuple before inserting it into the catalog caches. That involves database access which might cause invalidation of catalog cache entries — but the new entry isn't in the cache yet, so we would miss noticing that it should get invalidated. The result is a race condition in which an already-stale cache entry could get made, and then persist indefinitely. This would lead to hard-to-predict misbehavior. Fix by rechecking the tuple's visibility after detoasting. +* Fix edge-case integer overflow detection bug on some platforms (Dean Rasheed) [§](https://postgr.es/c/308a69a98) + + Computing `0 - INT64_MIN` should result in an overflow error, and did on most platforms. However, platforms with neither integer overflow builtins nor 128-bit integers would fail to spot the overflow, instead returning `INT64_MIN`. +* Detect Julian-date overflow when adding or subtracting an `interval` to/from a `timestamp` (Tom Lane) [§](https://postgr.es/c/86b6243a8) + + Some cases that should cause an out-of-range error produced an incorrect result instead. +* Add more checks for overflow in `interval_mul()` and `interval_div()` (Dean Rasheed) [§](https://postgr.es/c/2851aa7d1) + + Some cases that should cause an out-of-range error produced an incorrect result instead. +* Ensure cached statistics are discarded after a change to `stats_fetch_consistency` (Shinya Kato) [§](https://postgr.es/c/171d21f50) + + In some code paths, it was possible for stale statistics to be returned. +* Make the `pg_file_settings` view check validity of unapplied values for settings with `backend` or `superuser-backend` context (Tom Lane) [§](https://postgr.es/c/76dd3d94a) + + Invalid values were not noted in the view as intended. This escaped detection because there are very few settings in these groups. +* Match collation too when matching an existing index to a new partitioned index (Peter Eisentraut) [§](https://postgr.es/c/15d485921) + + Previously we could accept an index that has a different collation from the corresponding element of the partition key, possibly leading to misbehavior. +* Avoid failure if a child index is dropped concurrently with `REINDEX INDEX` on a partitioned index (Fei Changhong) [§](https://postgr.es/c/a0c19de11) [§](https://postgr.es/c/1cf2dba84) +* Fix insufficient locking when cleaning up an incomplete split of a GIN index's internal page (Fei Changhong, Heikki Linnakangas) [§](https://postgr.es/c/e43425f48) + + The code tried to do this with shared rather than exclusive lock on the buffer. This could lead to index corruption if two processes attempted the cleanup concurrently. +* Avoid premature release of buffer pin in GIN index insertion (Tom Lane) [§](https://postgr.es/c/4c73ec604) + + If an index root page split occurs concurrently with our own insertion, the code could fail with “buffer NNNN is not owned by resource owner”. +* Avoid failure with partitioned SP-GiST indexes (Tom Lane) [§](https://postgr.es/c/ab04c1901) + + Trying to use an index of this kind could lead to “No such file or directory” errors. +* Fix ownership change reporting for large objects (Tom Lane) [§](https://postgr.es/c/7a99fb6e1) + + A no-op `ALTER LARGE OBJECT OWNER` command (that is, one selecting the existing owner) passed the wrong class ID to the `PostAlterHook`, probably confusing any extension using that hook. +* Fix reporting of I/O timing data in `EXPLAIN (BUFFERS)` (Michael Paquier) [§](https://postgr.es/c/8dd70828b) + + The numbers labeled as “shared/local” actually refer only to shared buffers, so change that label to “shared”. +* Ensure durability of `CREATE DATABASE` (Noah Misch) [§](https://postgr.es/c/d493bed28) [§](https://postgr.es/c/8fa4a1ac6) + + If an operating system crash occurred during or shortly after `CREATE DATABASE`, recovery could fail, or subsequent connections to the new database could fail. If a base backup was taken in that window, similar problems could be observed when trying to use the backup. The symptom would be that the database directory, `PG_VERSION` file, or `pg_filenode.map` file was missing or empty. +* Add more `LOG` messages when starting and ending recovery from a backup (Andres Freund) [§](https://postgr.es/c/8b34cff33) + + This change provides additional information in the postmaster log that may be useful for diagnosing recovery problems. +* Prevent standby servers from incorrectly processing dead index tuples during subtransactions (Fei Changhong) [§](https://postgr.es/c/f5d8f59ca) + + The `startedInRecovery` flag was not correctly set for a subtransaction. This affects only processing of dead index tuples. It could allow a query in a subtransaction to ignore index entries that it should return (if they are already dead on the primary server, but not dead to the standby transaction), or to prematurely mark index entries as dead that are not yet dead on the primary. It is not clear that the latter case has any serious consequences, but it's not the intended behavior. +* Fix integer overflow hazard in checking whether a record will fit into the WAL decoding buffer (Thomas Munro) [§](https://postgr.es/c/b9f687f5a) + + This bug appears to be only latent except when running a 32-bit PostgreSQL build on a 64-bit platform. +* Fix deadlock between a logical replication apply worker, its tablesync worker, and a session process trying to alter the subscription (Shlok Kyal) [§](https://postgr.es/c/332b43063) + + One edge of the deadlock loop did not involve a lock wait, so the deadlock went undetected and would persist until manual intervention. +* Ensure that column default values are correctly transmitted by the pgoutput logical replication plugin (Nikhil Benesch) [§](https://postgr.es/c/a77fb8c68) + + `ALTER TABLE ADD COLUMN` with a constant default value for the new column avoids rewriting existing tuples, instead expecting that reading code will insert the correct default into a tuple that lacks that column. If replication was subsequently initiated on the table, pgoutput would transmit NULL instead of the correct default for such a column, causing incorrect replication on the subscriber. +* Fix failure of logical replication's initial sync for a table with no columns (Vignesh C) [§](https://postgr.es/c/57aae65ae) + + This case generated an improperly-formatted `COPY` command. +* Prevent examining system catalogs with the wrong snapshot during logical decoding (Fei Changhong) [§](https://postgr.es/c/b793a416b) + + If decoding begins partway through a transaction that modifies system catalogs, the decoder may not recognize that, causing it to fail to treat that transaction as in-progress for catalog lookups. This fix deals with the case that a top-level transaction is already marked as containing catalog changes, but its subtransaction(s) are not. +* Return the correct status code when a new client disconnects without responding to the server's password challenge (Liu Lang, Tom Lane) [§](https://postgr.es/c/a0d016393) + + In some cases we'd treat this as a loggable error, which was not the intention and tends to create log spam, since common clients like psql frequently do this. It may also confuse extensions that use `ClientAuthentication_hook`. +* Fix incompatibility with OpenSSL 3.2 (Tristan Partin, Bo Andreson) [§](https://postgr.es/c/5dd30bb54) + + Use the BIO “app\_data” field for our private storage, instead of assuming it's okay to use the “data” field. This mistake didn't cause problems before, but with 3.2 it leads to crashes and complaints about double frees. +* Be more wary about OpenSSL not setting `errno` on error (Tom Lane) [§](https://postgr.es/c/551d4b28e) + + If `errno` isn't set, assume the cause of the reported failure is read EOF. This fixes rare cases of strange error reports like “could not accept SSL connection: Success”. +* Fix file descriptor leakage when a foreign data wrapper's `ForeignAsyncRequest` function fails (Heikki Linnakangas) [§](https://postgr.es/c/481d7d1c0) +* Report ENOMEM errors from file-related system calls as `ERRCODE_OUT_OF_MEMORY`, not `ERRCODE_INTERNAL_ERROR` (Alexander Kuzmenkov) [§](https://postgr.es/c/3766b8b64) +* In PL/pgSQL, support SQL commands that are `CREATE FUNCTION`/`CREATE PROCEDURE` with SQL-standard bodies (Tom Lane) [§](https://postgr.es/c/de2d393a8) + + Previously, such cases failed with parsing errors due to the semicolon(s) appearing in the function body. +* Fix libpq's handling of errors in pipelines (Álvaro Herrera) [§](https://postgr.es/c/1171c6e74) [§](https://postgr.es/c/2b656cbd2) + + The pipeline state could get out of sync if an error is returned for reasons other than a query problem (for example, if the connection is lost). Potentially this would lead to a busy-loop in the calling application. +* Make libpq's `PQsendFlushRequest()` function flush the client output buffer under the same rules as other `PQsend` functions (Jelte Fennema-Nio) [§](https://postgr.es/c/0e28091d5) + + In pipeline mode, it may still be necessary to call `PQflush()` as well; but this change removes some inconsistency. +* Avoid race condition when libpq initializes OpenSSL support concurrently in two different threads (Willi Mann, Michael Paquier) [§](https://postgr.es/c/b97226815) +* Fix timing-dependent failure in GSSAPI data transmission (Tom Lane) [§](https://postgr.es/c/a50053777) + + When using GSSAPI encryption in non-blocking mode, libpq sometimes failed with “GSSAPI caller failed to retransmit all data needing to be retried”. +* In pg\_dump, don't dump RLS policies or security labels for extension member objects (Tom Lane, Jacob Champion) [§](https://postgr.es/c/f15147df6) [§](https://postgr.es/c/63c1b4d88) + + Previously, commands would be included in the dump to set these properties, which is really incorrect since they should be considered as internal affairs of the extension. Moreover, the restoring user might not have adequate privilege to set them, and indeed the dumping user might not have enough privilege to dump them (since dumping RLS policies requires acquiring lock on their table). +* In pg\_dump, don't dump an extended statistics object if its underlying table isn't being dumped (Rian McGuire, Tom Lane) [§](https://postgr.es/c/1e0841426) + + This conforms to the behavior for other dependent objects such as indexes. +* Make it an error for a pgbench script to end with an open pipeline (Anthonin Bonnefoy) [§](https://postgr.es/c/3fd36be52) + + Previously, pgbench would behave oddly if a `\startpipeline` command lacked a matching `\endpipeline`. This seems like a scripting mistake rather than a case that pgbench needs to handle nicely, so throw an error. +* Fix crash in `contrib/intarray` if an array with an element equal to `INT_MAX` is inserted into a `gist__int_ops` index (Alexander Lakhin, Tom Lane) [§](https://postgr.es/c/940ab02b5) +* Report a better error when `contrib/pageinspect`'s `hash_bitmap_info()` function is applied to a partitioned hash index (Alexander Lakhin, Michael Paquier) [§](https://postgr.es/c/2e08440d6) +* Report a better error when `contrib/pgstattuple`'s `pgstathashindex()` function is applied to a partitioned hash index (Alexander Lakhin) [§](https://postgr.es/c/b745f1680) +* On Windows, suppress autorun options when launching subprocesses in pg\_ctl and pg\_regress (Kyotaro Horiguchi) [§](https://postgr.es/c/33d1be06a) [§](https://postgr.es/c/7e7d827f5) + + When launching a child process via `cmd.exe`, pass the `/D` flag to prevent executing any autorun commands specified in the registry. This avoids possibly-surprising side effects. +* Move `is_valid_ascii()` from `mb/pg_wchar.h` to `utils/ascii.h` (Jubilee Young) [§](https://postgr.es/c/3726c1cb0) + + This change avoids the need to include `` in `pg_wchar.h`, which was causing problems for some third-party code. +* Fix compilation failures with libxml2 version 2.12.0 and later (Tom Lane) [§](https://postgr.es/c/3f8ac13b1) +* Fix compilation failure of `WAL_DEBUG` code on Windows (Bharath Rupireddy) [§](https://postgr.es/c/87ed81a87) +* Suppress compiler warnings from Python's header files (Peter Eisentraut, Tom Lane) [§](https://postgr.es/c/5f8d6d709) + + Our preferred compiler options provoke warnings about constructs appearing in recent versions of Python's header files. When using gcc, we can suppress these warnings with a pragma. +* Avoid deprecation warning when compiling with LLVM 18 (Thomas Munro) [§](https://postgr.es/c/67f7aaa38) +* Update time zone data files to tzdata release 2024a for DST law changes in Greenland, Kazakhstan, and Palestine, plus corrections for the Antarctic stations Casey and Vostok. Also historical corrections for Vietnam, Toronto, and Miquelon. (Tom Lane) [§](https://postgr.es/c/970b1aeeb) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-15-7.html "E.9. Release 15.7") | [Up](release.html "Appendix E. Release Notes") | [Next](release-15-5.html "E.11. Release 15.5") | +| E.9. Release 15.7 | [Home](index.html "PostgreSQL 15.15 Documentation") | E.11. Release 15.5 | + +[Previous](/docs/release/15.5/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/15.7/) diff --git a/corpus/changelog/postgresql_releases/postgresql_157.md b/corpus/changelog/postgresql_releases/postgresql_157.md new file mode 100644 index 0000000000000000000000000000000000000000..0b6b8706d584db6881bbab311b862f77160e92e1 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_157.md @@ -0,0 +1,198 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/15.7/ +Version: 15.7 + +## PostgreSQL 15.7 + +| E.9. Release 15.7 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-15-8.html "E.8. Release 15.8") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 15.15 Documentation") | [Next](release-15-6.html "E.10. Release 15.6") | + +--- + +## E.9. Release 15.7 + +[E.9.1. Migration to Version 15.7](release-15-7.html#id-1.11.6.14.4) + +[E.9.2. Changes](release-15-7.html#id-1.11.6.14.5) + +**Release date:**2024-05-09 + +This release contains a variety of fixes from 15.6. For information about new features in major release 15, see [Section E.16](release-15.html "E.16. Release 15"). + +### E.9.1. Migration to Version 15.7 + +A dump/restore is not required for those running 15.X. + +However, a security vulnerability was found in the system views `pg_stats_ext` and `pg_stats_ext_exprs`, potentially allowing authenticated database users to see data they shouldn't. If this is of concern in your installation, follow the steps in the first changelog entry below to rectify it. + +Also, if you are upgrading from a version earlier than 15.6, see [Section E.10](release-15-6.html "E.10. Release 15.6"). + +### E.9.2. Changes + +* Restrict visibility of `pg_stats_ext` and `pg_stats_ext_exprs` entries to the table owner (Nathan Bossart) [§](https://postgr.es/c/9cc2b6289) + + These views failed to hide statistics for expressions that involve columns the accessing user does not have permission to read. View columns such as `most_common_vals` might expose security-relevant data. The potential interactions here are not fully clear, so in the interest of erring on the side of safety, make rows in these views visible only to the owner of the associated table. + + The PostgreSQL Project thanks Lukas Fittl for reporting this problem. (CVE-2024-4317) + + By itself, this fix will only fix the behavior in newly initdb'd database clusters. If you wish to apply this change in an existing cluster, you will need to do the following: + + 1. Find the SQL script `fix-CVE-2024-4317.sql` in the *`share`* directory of the PostgreSQL installation (typically located someplace like `/usr/share/postgresql/`). Be sure to use the script appropriate to your PostgreSQL major version. If you do not see this file, either your version is not vulnerable (only v14–v16 are affected) or your minor version is too old to have the fix. + 2. In *each* database of the cluster, run the `fix-CVE-2024-4317.sql` script as superuser. In psql this would look like + + ```None + \i /usr/share/postgresql/fix-CVE-2024-4317.sql + ``` + + (adjust the file path as appropriate). Any error probably indicates that you've used the wrong script version. It will not hurt to run the script more than once. + 3. Do not forget to include the `template0` and `template1` databases, or the vulnerability will still exist in databases you create later. To fix `template0`, you'll need to temporarily make it accept connections. Do that with + + ```None + ALTER DATABASE template0 WITH ALLOW_CONNECTIONS true; + ``` + + and then after fixing `template0`, undo it with + + ```None + ALTER DATABASE template0 WITH ALLOW_CONNECTIONS false; + ``` +* Fix `INSERT` from multiple `VALUES` rows into a target column that is a domain over an array or composite type (Tom Lane) [§](https://postgr.es/c/7c61d2342) + + Such cases would either fail with surprising complaints about mismatched datatypes, or insert unexpected coercions that could lead to odd results. +* Require `SELECT` privilege on the target table for `MERGE` with a `DO NOTHING` clause (Álvaro Herrera) [§](https://postgr.es/c/90ad85db6) + + `SELECT` privilege would be required in all practical cases anyway, but require it even if the query reads no columns of the target table. This avoids an edge case in which `MERGE` would require no privileges whatever, which seems undesirable even when it's a do-nothing command. +* Fix handling of self-modified tuples in `MERGE` (Dean Rasheed) [§](https://postgr.es/c/b5c645d2a) + + Throw an error if a target row joins to more than one source row, as required by the SQL standard. (The previous coding could silently ignore this condition if a concurrent update was involved.) Also, throw a non-misleading error if a target row is already updated by a later command in the current transaction, thanks to a `BEFORE` trigger or a volatile function used in the query. +* Fix incorrect pruning of NULL partition when a table is partitioned on a boolean column and the query has a boolean `IS NOT` clause (David Rowley) [§](https://postgr.es/c/1b3495e29) + + A NULL value satisfies a clause such as `boolcol IS NOT FALSE`, so pruning away a partition containing NULLs yielded incorrect answers. +* Make `ALTER FOREIGN TABLE SET SCHEMA` move any owned sequences into the new schema (Tom Lane) [§](https://postgr.es/c/b48eda4e5) + + Moving a regular table to a new schema causes any sequences owned by the table to be moved to that schema too (along with indexes and constraints). This was overlooked for foreign tables, however. +* Make `ALTER TABLE ... ADD COLUMN` create identity/serial sequences with the same persistence as their owning tables (Peter Eisentraut) [§](https://postgr.es/c/d17a3a4c6) + + `CREATE UNLOGGED TABLE` will make any owned sequences be unlogged too. `ALTER TABLE` missed that consideration, so that an added identity column would have a logged sequence, which seems pointless. +* Improve `ALTER TABLE ... ALTER COLUMN TYPE`'s error message when there is a dependent function or publication (Tom Lane) [§](https://postgr.es/c/5f4a1a0a7) [§](https://postgr.es/c/9b41d1d63) +* In `CREATE DATABASE`, recognize strategy keywords case-insensitively for consistency with other options (Tomas Vondra) [§](https://postgr.es/c/276b7888f) +* Fix `EXPLAIN`'s counting of heap pages accessed by a bitmap heap scan (Melanie Plageman) [§](https://postgr.es/c/d3d95f583) + + Previously, heap pages that contain no visible tuples were not counted; but it seems more consistent to count all pages returned by the bitmap index scan. +* Fix `EXPLAIN`'s output for subplans in `MERGE` (Dean Rasheed) [§](https://postgr.es/c/89ee14a2f) + + `EXPLAIN` would sometimes fail to properly display subplan Params referencing variables in other parts of the plan tree. +* Avoid deadlock during removal of orphaned temporary tables (Mikhail Zhilin) [§](https://postgr.es/c/4fb56a734) + + If the session that creates a temporary table crashes without removing the table, autovacuum will eventually try to remove the orphaned table. However, an incoming session that's been assigned the same temporary namespace will do that too. If a temporary table has a dependency (such as an owned sequence) then a deadlock could result between these two cleanup attempts. +* Avoid race condition while examining per-relation frozen-XID values (Noah Misch) [§](https://postgr.es/c/7c5915c4b) + + `VACUUM`'s computation of per-database frozen-XID values from per-relation values could get confused by a concurrent update of those values by another `VACUUM`. +* Fix buffer usage reporting for parallel vacuuming (Anthonin Bonnefoy) [§](https://postgr.es/c/faba2f8f3) + + Buffer accesses performed by parallel workers were not getting counted in the statistics reported in `VERBOSE` mode. +* Disallow converting a table to a view within an outer SQL command that is using that table (Tom Lane) [§](https://postgr.es/c/bf379b555) + + This avoids possible crashes. +* Ensure that join conditions generated from equivalence classes are applied at the correct plan level (Tom Lane) [§](https://postgr.es/c/5aacfa64e) + + In versions before PostgreSQL 16, it was possible for generated conditions to be evaluated below outer joins when they should be evaluated above (after) the outer join, leading to incorrect query results. All versions have a similar hazard when considering joins to `UNION ALL` trees that have constant outputs for the join column in some `SELECT` arms. +* Prevent potentially-incorrect optimization of some window functions (David Rowley) [§](https://postgr.es/c/7e5d20bbd) + + Disable “run condition” optimization of `ntile()` and `count()` with non-constant arguments. This avoids possible misbehavior with sub-selects, typically leading to errors like “WindowFunc not found in subplan target lists”. +* Avoid unnecessary use of moving-aggregate mode with a non-moving window frame (Vallimaharajan G) [§](https://postgr.es/c/03561a6c7) + + When a plain aggregate is used as a window function, and the window frame start is specified as `UNBOUNDED PRECEDING`, the frame's head cannot move so we do not need to use the special (and more expensive) moving-aggregate mode. This optimization was intended all along, but due to a coding error it never triggered. +* Avoid use of already-freed data while planning partition-wise joins under GEQO (Tom Lane) [§](https://postgr.es/c/37bbe3d3a) + + This would typically end in a crash or unexpected error message. +* Avoid freeing still-in-use data in Memoize (Tender Wang, Andrei Lepikhov) [§](https://postgr.es/c/74530804f) + + In production builds this error frequently didn't cause any problems, as the freed data would most likely not get overwritten before it was used. +* Fix incorrectly-reported statistics kind codes in “requested statistics kind *`X`* is not yet built” error messages (David Rowley) [§](https://postgr.es/c/164fe7a6e) +* Be more careful with `RECORD`-returning functions in `FROM` (Tom Lane) [§](https://postgr.es/c/09989ba84) [§](https://postgr.es/c/3b671dcf5) + + The output columns of such a function call must be defined by an `AS` clause that specifies the column names and data types. If the actual function output value doesn't match that, an error is supposed to be thrown at runtime. However, some code paths would examine the actual value prematurely, and potentially issue strange errors or suffer assertion failures if it doesn't match expectations. +* Fix confusion about the return rowtype of SQL-language procedures (Tom Lane) [§](https://postgr.es/c/6f66fadad) + + A procedure implemented in SQL language that returns a single composite-type column would cause an assertion failure or core dump. +* Add protective stack depth checks to some recursive functions (Egor Chindyaskin) [§](https://postgr.es/c/84788ee5b) +* Fix mis-rounding and overflow hazards in `date_bin()` (Moaaz Assali) [§](https://postgr.es/c/db8855b66) + + In the case where the source timestamp is before the origin timestamp and their difference is already an exact multiple of the stride, the code incorrectly subtracted the stride anyway. Also, detect some integer-overflow cases that would have produced incorrect results. +* Detect integer overflow when adding or subtracting an `interval` to/from a `timestamp` (Joseph Koshakow) [§](https://postgr.es/c/e6e3ee5b7) + + Some cases that should cause an out-of-range error produced an incorrect result instead. +* Avoid race condition in `pg_get_expr()` (Tom Lane) [§](https://postgr.es/c/26c89d105) + + If the relation referenced by the argument is dropped concurrently, the function's intention is to return NULL, but sometimes it failed instead. +* Fix detection of old transaction IDs in XID status functions (Karina Litskevich) [§](https://postgr.es/c/503299b7f) + + Transaction IDs more than 231 transactions in the past could be misidentified as recent, leading to misbehavior of `pg_xact_status()` or `txid_status()`. +* Ensure that a table's freespace map won't return a page that's past the end of the table (Ronan Dunklau) [§](https://postgr.es/c/7c490a18b) + + Because the freespace map isn't WAL-logged, this was possible in edge cases involving an OS crash, a replica promote, or a PITR restore. The result would be a “could not read block” error. +* Fix file descriptor leakage when an error is thrown while waiting in `WaitEventSetWait` (Etsuro Fujita) [§](https://postgr.es/c/b82dca2a5) +* Avoid corrupting exception stack if an FDW implements async append but doesn't configure any wait conditions for the Append plan node to wait for (Alexander Pyhalov) [§](https://postgr.es/c/3f96d113f) +* Throw an error if an index is accessed while it is being reindexed (Tom Lane) [§](https://postgr.es/c/940489b46) + + Previously this was just an assertion check, but promote it into a regular runtime error. This will provide a more on-point error message when reindexing a user-defined index expression that attempts to access its own table. +* Ensure that index-only scans on `name` columns return a fully-padded value (David Rowley) [§](https://postgr.es/c/52f21f928) + + The value physically stored in the index is truncated, and previously a pointer to that value was returned to callers. This provoked complaints when testing under valgrind. In theory it could result in crashes, though none have been reported. +* Fix race condition in deciding whether a table sync operation is needed in logical replication (Vignesh C) [§](https://postgr.es/c/28a8cc457) + + An invalidation event arriving while a subscriber identifies which tables need to be synced would be forgotten about, so that any tables newly in need of syncing might not get processed in a timely fashion. +* Fix crash with DSM allocations larger than 4GB (Heikki Linnakangas) [§](https://postgr.es/c/d46c26961) +* Disconnect if a new server session's client socket cannot be put into non-blocking mode (Heikki Linnakangas) [§](https://postgr.es/c/4fce5f970) + + It was once theoretically possible for us to operate with a socket that's in blocking mode; but that hasn't worked fully in a long time, so fail at connection start rather than misbehave later. +* Fix inadequate error reporting with OpenSSL 3.0.0 and later (Heikki Linnakangas, Tom Lane) [§](https://postgr.es/c/0fe82e45c) + + System-reported errors passed through by OpenSSL were reported with a numeric error code rather than anything readable. +* Avoid concurrent calls to `bindtextdomain()` in libpq and ecpglib (Tom Lane) [§](https://postgr.es/c/806f98951) [§](https://postgr.es/c/9f041b041) + + Although GNU gettext's implementation seems to be fine with concurrent calls, the version available on Windows is not. +* Fix crash in ecpg's preprocessor if the program tries to redefine a macro that was defined on the preprocessor command line (Tom Lane) [§](https://postgr.es/c/25f937217) [§](https://postgr.es/c/1e7b1b026) [§](https://postgr.es/c/f7e891748) +* In ecpg, avoid issuing false “unsupported feature will be passed to server” warnings (Tom Lane) [§](https://postgr.es/c/f159f1814) +* Ensure that the string result of ecpg's `intoasc()` function is correctly zero-terminated (Oleg Tselebrovskiy) [§](https://postgr.es/c/b5cb6022b) +* In psql, avoid leaking a query result after the query is cancelled (Tom Lane) [§](https://postgr.es/c/4f1d33d70) + + This happened only when cancelling a non-last query in a query string made with `\;` separators. +* Fix pg\_dumpall so that role comments, if present, will be dumped regardless of the setting of `--no-role-passwords` (Daniel Gustafsson, Álvaro Herrera) [§](https://postgr.es/c/12128be62) +* Skip files named `.DS_Store` in pg\_basebackup, pg\_checksums, and pg\_rewind (Daniel Gustafsson) [§](https://postgr.es/c/29f005238) + + This avoids problems on macOS, where the Finder may create such files. +* Fix PL/pgSQL's parsing of single-line comments (`--`-style comments) following expressions (Erik Wienhold, Tom Lane) [§](https://postgr.es/c/d85db0a8e) + + This mistake caused parse errors if such a comment followed a `WHEN` expression in a PL/pgSQL `CASE` statement. +* In `contrib/amcheck`, don't report false match failures due to short- versus long-header values (Andrey Borodin, Michael Zhilin) [§](https://postgr.es/c/0d466bce9) [§](https://postgr.es/c/54e6184db) + + A variable-length datum in a heap tuple or index tuple could have either a short or a long header, depending on compression parameters that applied when it was made. Treat these cases as equivalent rather than complaining if there's a difference. +* Fix bugs in BRIN output functions (Tomas Vondra) [§](https://postgr.es/c/3cd413511) + + These output functions are only used for displaying index entries in `contrib/pageinspect`, so the errors are of limited practical concern. +* In `contrib/postgres_fdw`, avoid emitting requests to sort by a constant (David Rowley) [§](https://postgr.es/c/ab64b275a) + + This could occur in cases involving `UNION ALL` with constant-emitting subqueries. Sorting by a constant is useless of course, but it also risks being misinterpreted by the remote server, leading to “ORDER BY position *`N`* is not in select list” errors. +* Make `contrib/postgres_fdw` set the remote session's time zone to `GMT` not `UTC` (Tom Lane) [§](https://postgr.es/c/6c85e3359) + + This should have the same results for practical purposes. However, `GMT` is recognized by hard-wired code in the server, while `UTC` is looked up in the timezone database. So the old code could fail in the unlikely event that the remote server's timezone database is missing entries. +* In `contrib/xml2`, avoid use of library functions that have been deprecated in recent versions of libxml2 (Dmitry Koval) [§](https://postgr.es/c/689ba4f1c) +* Fix incompatibility with LLVM 18 (Thomas Munro, Dmitry Dolgov) [§](https://postgr.es/c/74992929a) +* Allow `make check` to work with the musl C library (Thomas Munro, Bruce Momjian, Tom Lane) [§](https://postgr.es/c/3c3f4fd74) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-15-8.html "E.8. Release 15.8") | [Up](release.html "Appendix E. Release Notes") | [Next](release-15-6.html "E.10. Release 15.6") | +| E.8. Release 15.8 | [Home](index.html "PostgreSQL 15.15 Documentation") | E.10. Release 15.6 | + +[Previous](/docs/release/15.6/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/15.8/) diff --git a/corpus/changelog/postgresql_releases/postgresql_158.md b/corpus/changelog/postgresql_releases/postgresql_158.md new file mode 100644 index 0000000000000000000000000000000000000000..e02ecff122dc6c3fb0ade040605546946b4b9058 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_158.md @@ -0,0 +1,179 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/15.8/ +Version: 15.8 + +## PostgreSQL 15.8 + +| E.8. Release 15.8 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-15-9.html "E.7. Release 15.9") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 15.15 Documentation") | [Next](release-15-7.html "E.9. Release 15.7") | + +--- + +## E.8. Release 15.8 + +[E.8.1. Migration to Version 15.8](release-15-8.html#id-1.11.6.13.4) + +[E.8.2. Changes](release-15-8.html#id-1.11.6.13.5) + +**Release date:**2024-08-08 + +This release contains a variety of fixes from 15.7. For information about new features in major release 15, see [Section E.16](release-15.html "E.16. Release 15"). + +### E.8.1. Migration to Version 15.8 + +A dump/restore is not required for those running 15.X. + +However, if you are upgrading from a version earlier than 15.7, see [Section E.9](release-15-7.html "E.9. Release 15.7"). + +### E.8.2. Changes + +* Prevent unauthorized code execution during pg\_dump (Masahiko Sawada) [§](https://postgr.es/c/e81e53a0c) + + An attacker able to create and drop non-temporary objects could inject SQL code that would be executed by a concurrent pg\_dump session with the privileges of the role running pg\_dump (which is often a superuser). The attack involves replacing a sequence or similar object with a view or foreign table that will execute malicious code. To prevent this, introduce a new server parameter `restrict_nonsystem_relation_kind` that can disable expansion of non-builtin views as well as access to foreign tables, and teach pg\_dump to set it when available. Note that the attack is prevented only if both pg\_dump and the server it is dumping from are new enough to have this fix. + + The PostgreSQL Project thanks Noah Misch for reporting this problem. (CVE-2024-7348) +* Prevent infinite loop in `VACUUM` (Melanie Plageman) [§](https://postgr.es/c/dc6354c67) + + After a disconnected standby server with an old running transaction reconnected to the primary, it was possible for `VACUUM` on the primary to get confused about which tuples are removable, resulting in an infinite loop. +* Fix failure after attaching a table as a partition, if the table had previously had inheritance children (Álvaro Herrera) [§](https://postgr.es/c/f74fac06c) +* Fix `ALTER TABLE DETACH PARTITION` for cases involving inconsistent index-based constraints (Álvaro Herrera, Tender Wang) [§](https://postgr.es/c/4ae09c59d) [§](https://postgr.es/c/9f0f72d89) + + When a partitioned table has an index that is not associated with a constraint, but a partition has an equivalent index that is, then detaching the partition would misbehave, leaving the ex-partition's constraint with an incorrect `coninhcount` value. This would cause trouble during any further manipulations of that constraint. +* Fix partition pruning setup during `ALTER TABLE DETACH PARTITION CONCURRENTLY` (Álvaro Herrera) [§](https://postgr.es/c/fb0fb0740) [§](https://postgr.es/c/03c8cdbb7) + + The executor assumed that no partition could be detached between planning and execution of a query on a partitioned table. This is no longer true since the introduction of `DETACH PARTITION`'s `CONCURRENTLY` option, making it possible for query execution to fail transiently when that is used. +* Correctly update a partitioned table's `pg_class`.`reltuples` field to zero after its last child partition is dropped (Noah Misch) [§](https://postgr.es/c/2b4a2a79e) + + The first `ANALYZE` on such a partitioned table must update `relhassubclass` as well, and that caused the `reltuples` update to be lost. +* Fix handling of polymorphic output arguments for procedures (Tom Lane) [§](https://postgr.es/c/c40e78d23) [§](https://postgr.es/c/5fe43d41d) + + The SQL `CALL` statement did not resolve the correct data types for such arguments, leading to errors such as “cannot display a value of type anyelement”, or even outright crashes. (But `CALL` in PL/pgSQL worked correctly.) +* Fix behavior of stable functions called from a `CALL` statement's argument list (Tom Lane) [§](https://postgr.es/c/a160e9277) + + If the `CALL` is within an atomic context (e.g. there's an outer transaction block), such functions were passed the wrong snapshot, causing them to see stale values of rows modified since the start of the outer transaction. +* Detect integer overflow in `money` calculations (Joseph Koshakow) [§](https://postgr.es/c/b82791c8f) + + None of the arithmetic functions for the `money` type checked for overflow before, so they would silently give wrong answers for overflowing cases. +* Fix over-aggressive clamping of the scale argument in `round(numeric)` and `trunc(numeric)` (Dean Rasheed) [§](https://postgr.es/c/47ca912de) + + These functions clamped their scale argument to +/-2000, but there are valid use-cases for it to be larger; the functions returned incorrect results in such cases. Instead clamp to the actual allowed range of type `numeric`. +* Fix result for `pg_size_pretty()` when applied to the smallest possible `bigint` value (Joseph Koshakow) [§](https://postgr.es/c/0a80e88d9) +* Prevent `pg_sequence_last_value()` from failing on unlogged sequences on standby servers and on temporary sequences of other sessions (Nathan Bossart) [§](https://postgr.es/c/857d280c6) + + Make it return NULL in these cases instead of throwing an error. +* Fix parsing of ignored operators in `websearch_to_tsquery()` (Tom Lane) [§](https://postgr.es/c/df95c1ec0) + + Per the manual, punctuation in the input of `websearch_to_tsquery()` is ignored except for the special cases of dashes and quotes. However, parentheses and a few other characters appearing immediately before an `or` could cause `or` to be treated as a data word, rather than as an `OR` operator as expected. +* Detect another integer overflow case while computing new array dimensions (Joseph Koshakow) [§](https://postgr.es/c/547dd2cbd) + + Reject applying array dimensions `[-2147483648:2147483647]` to an empty array. This is closely related to CVE-2023-5869, but appears harmless since the array still ends up empty. +* Detect another case of a new catalog cache entry becoming stale while detoasting its fields (Noah Misch) [§](https://postgr.es/c/b08a4b616) + + An in-place update occurring while we expand out-of-line fields in a catalog tuple could be missed, leading to a catalog cache entry that lacks the in-place change but is not known to be stale. This is only possible in the `pg_database` catalog, so the effects are narrow, but misbehavior is possible. +* Correctly check updatability of view columns targeted by `INSERT` ... `DEFAULT` (Tom Lane) [§](https://postgr.es/c/96953052a) + + If such a column is non-updatable, we should give an error reporting that. But the check was missed and then later code would report an unhelpful error such as “attribute number *`N`* not found in view targetlist”. +* Avoid reporting an unhelpful internal error for incorrect recursive queries (Tom Lane) [§](https://postgr.es/c/e7f9f44e3) + + Rearrange the order of error checks so that we throw an on-point error when a `WITH RECURSIVE` query does not have a self-reference within the second arm of the `UNION`, but does have one self-reference in some other place such as `ORDER BY`. +* Lock owned sequences during `ALTER TABLE SET LOGGED|UNLOGGED` (Noah Misch) [§](https://postgr.es/c/24561b498) + + These commands change the persistence of a table's owned sequences along with the table, but they failed to acquire lock on the sequences while doing so. This could result in losing the effects of concurrent `nextval()` calls. +* Don't throw an error if a queued `AFTER` trigger no longer exists (Tom Lane) [§](https://postgr.es/c/1424c7abc) + + It's possible for a transaction to execute an operation that queues a deferred `AFTER` trigger for later execution, and then to drop the trigger before that happens. Formerly this led to weird errors such as “could not find trigger *`NNNN`*”. It seems better to silently do nothing if the trigger no longer exists at the time when it would have been executed. +* Fix failure to remove `pg_init_privs` entries for column-level privileges when their table is dropped (Tom Lane) [§](https://postgr.es/c/1f1eedd3f) + + If an extension grants some column-level privileges on a table it creates, relevant catalog entries would remain behind after the extension is dropped. This was harmless until/unless the table's OID was re-used for another relation, when it could interfere with what pg\_dump dumps for that relation. +* Fix selection of an arbiter index for `ON CONFLICT` when the desired index has expressions or predicates (Tom Lane) [§](https://postgr.es/c/1d0399b54) + + If a query using `ON CONFLICT` accesses the target table through an updatable view, it could fail with “there is no unique or exclusion constraint matching the ON CONFLICT specification”, even though a matching index does exist. +* Refuse to modify a temporary table of another session with `ALTER TABLE` (Tom Lane) [§](https://postgr.es/c/3c71cb497) + + Permissions checks normally would prevent this case from arising, but it is possible to reach it by altering a parent table whose child is another session's temporary table. Throw an error if we discover that such a child table belongs to another session. +* Fix handling of extended statistics on expressions in `CREATE TABLE LIKE STATISTICS` (Tom Lane) [§](https://postgr.es/c/2f3cfcf76) + + The `CREATE` command failed to adjust column references in statistics expressions to the possibly-different column numbering of the new table. This resulted in invalid statistics objects that would cause problems later. A typical scenario where renumbering columns is needed is when the source table contains some dropped columns. +* Fix failure to recalculate sub-queries generated from `MIN()` or `MAX()` aggregates (Tom Lane) [§](https://postgr.es/c/4ac385adc) + + In some cases the aggregate result computed at one row of the outer query could be re-used for later rows when it should not be. This has only been seen to happen when the outer query uses `DISTINCT` that is implemented with hash aggregation, but other cases may exist. +* Avoid crashing when a JIT-inlined backend function throws an error (Tom Lane) [§](https://postgr.es/c/5401e70e4) + + The error state can include pointers into the dynamically loaded module holding the JIT-compiled code (for error location strings). In some code paths the module could get unloaded before the error report is processed, leading to SIGSEGV when the location strings are accessed. +* Cope with behavioral changes in libxml2 version 2.13.x (Erik Wienhold, Tom Lane) [§](https://postgr.es/c/f68d6aabb) + + Notably, we now suppress “chunk is not well balanced” errors from libxml2, unless that is the only reported error. This is to make error reports consistent between 2.13.x and earlier libxml2 versions. In earlier versions, that message was almost always redundant or outright incorrect, so 2.13.x substantially reduced the number of cases in which it's reported. +* Fix handling of subtransactions of prepared transactions when starting a hot standby server (Heikki Linnakangas) [§](https://postgr.es/c/0e2f3d78b) + + When starting a standby's replay at a shutdown checkpoint WAL record, transactions that had been prepared but not yet committed on the primary are correctly understood as being still in progress. But subtransactions of a prepared transaction (created by savepoints or PL/pgSQL exception blocks) were not accounted for and would be treated as aborted. That led to inconsistency if the prepared transaction was later committed. +* Prevent incorrect initialization of logical replication slots (Masahiko Sawada) [§](https://postgr.es/c/aee8c2b95) + + In some cases a replication slot's start point within the WAL stream could be set to a point within a transaction, leading to assertion failures or incorrect decoding results. +* Avoid “can only drop stats once” error during replication slot creation and drop (Floris Van Nee) [§](https://postgr.es/c/bfc44da24) +* Fix resource leakage in logical replication WAL sender (Hou Zhijie) [§](https://postgr.es/c/76fda6140) + + The walsender process leaked memory when publishing changes to a partitioned table whose partitions have row types physically different from the partitioned table's. +* Avoid memory leakage after servicing a notify or sinval interrupt (Tom Lane) [§](https://postgr.es/c/4df767cf9) + + The processing functions for these events could switch the current memory context to TopMemoryContext, resulting in session-lifespan leakage of any data allocated before the incorrect setting gets replaced. There were observable leaks associated with (at least) encoding conversion of incoming queries and parameters attached to Bind messages. +* Prevent leakage of reference counts for the shared memory block used for statistics (Anthonin Bonnefoy) [§](https://postgr.es/c/eb144dfca) + + A new backend process attaching to the statistics shared memory incremented its reference count, but failed to decrement the count when exiting. After 232 sessions had been created, the reference count would overflow to zero, causing failures in all subsequent backend process starts. +* Prevent deadlocks and assertion failures during truncation of the multixact SLRU log (Heikki Linnakangas) [§](https://postgr.es/c/c809a2b2d) + + A process trying to delete SLRU segments could deadlock with the checkpointer process. +* Avoid possibly missing end-of-input events on Windows sockets (Thomas Munro) [§](https://postgr.es/c/5546a834c) + + Windows reports an FD\_CLOSE event only once after the remote end of the connection disconnects. With unlucky timing, we could miss that report and wait indefinitely, or at least until a timeout elapsed, expecting more input. +* Fix buffer overread in JSON parse error reports for incomplete byte sequences (Jacob Champion) [§](https://postgr.es/c/8c3f30e67) + + It was possible to walk off the end of the input buffer by a few bytes when the last bytes comprise an incomplete multi-byte character. While usually harmless, in principle this could cause a crash. +* Disable creation of stateful TLS session tickets by OpenSSL (Daniel Gustafsson) [§](https://postgr.es/c/118ec331b) [§](https://postgr.es/c/970cd5c62) [§](https://postgr.es/c/ce3045e9b) + + This avoids possible failures with clients that think receipt of a session ticket means that TLS session resumption is supported. +* When replanning a PL/pgSQL “simple expression”, check it's still simple (Tom Lane) [§](https://postgr.es/c/bf552b1b2) + + Certain fairly-artificial cases, such as dropping a referenced function and recreating it as an aggregate, could lead to surprising failures such as “unexpected plan node type”. +* Fix incompatibility between PL/Perl and Perl 5.40 (Andrew Dunstan) [§](https://postgr.es/c/f853e23bf) +* Fix recursive `RECORD`-returning PL/Python functions (Tom Lane) [§](https://postgr.es/c/6e29963ed) + + If we recurse to a new call of the same function that passes a different column definition list (`AS` clause), it would fail because the inner call would overwrite the outer call's idea of what rowtype to return. +* Don't corrupt PL/Python's `TD` dictionary during a recursive trigger call (Tom Lane) [§](https://postgr.es/c/363e8c2f9) + + If a PL/Python-language trigger caused another one to be invoked, the `TD` dictionary created for the inner one would overwrite the outer one's `TD` dictionary. +* Fix PL/Tcl's reporting of invalid list syntax in the result of a function returning tuple (Erik Wienhold, Tom Lane) [§](https://postgr.es/c/89ef2aeda) + + Such a case could result in a crash, or in emission of misleading context information that actually refers to the previous Tcl error. +* Avoid non-thread-safe usage of `strerror()` in libpq (Peter Eisentraut) [§](https://postgr.es/c/6ddc8556c) + + Certain error messages returned by OpenSSL could become garbled in multi-threaded applications. +* Avoid memory leak within pg\_dump during a binary upgrade (Daniel Gustafsson) [§](https://postgr.es/c/e6fc3b70d) +* Ensure that `pg_restore` `-l` reports dependent TOC entries correctly (Tom Lane) [§](https://postgr.es/c/6a458d93b) + + If `-l` was specified together with selective-restore options such as `-n` or `-N`, dependent TOC entries such as comments would be omitted from the listing, even when an actual restore would have selected them. +* Avoid “cursor can only scan forward” error in `contrib/postgres_fdw` (Etsuro Fujita) [§](https://postgr.es/c/f39f3e0fb) + + This error could occur if the remote server is v15 or later and a foreign table is mapped to a non-trivial remote view. +* In `contrib/postgres_fdw`, do not send `FETCH FIRST WITH TIES` clauses to the remote server (Japin Li) [§](https://postgr.es/c/b33c141cc) + + The remote server might not implement this clause, or might interpret it differently than we would locally, so don't risk attempting remote execution. +* Avoid clashing with system-provided `` headers (Thomas Munro) [§](https://postgr.es/c/467d77bb1) + + This fixes a compilation failure on macOS version 15 and up. +* Fix otherwise-harmless assertion failure in Memoize cost estimation (David Rowley) [§](https://postgr.es/c/27c6242a0) +* Fix otherwise-harmless assertion failures in `REINDEX CONCURRENTLY` applied to an SP-GiST index (Tom Lane) [§](https://postgr.es/c/f55083319) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-15-9.html "E.7. Release 15.9") | [Up](release.html "Appendix E. Release Notes") | [Next](release-15-7.html "E.9. Release 15.7") | +| E.7. Release 15.9 | [Home](index.html "PostgreSQL 15.15 Documentation") | E.9. Release 15.7 | + +[Previous](/docs/release/15.7/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/15.9/) diff --git a/corpus/changelog/postgresql_releases/postgresql_159.md b/corpus/changelog/postgresql_releases/postgresql_159.md new file mode 100644 index 0000000000000000000000000000000000000000..ec17aad56b9fca704c3ac1b11848f1b2569d2919 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_159.md @@ -0,0 +1,205 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/15.9/ +Version: 15.9 + +## PostgreSQL 15.9 + +| E.7. Release 15.9 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-15-10.html "E.6. Release 15.10") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 15.15 Documentation") | [Next](release-15-8.html "E.8. Release 15.8") | + +--- + +## E.7. Release 15.9 + +[E.7.1. Migration to Version 15.9](release-15-9.html#id-1.11.6.12.4) + +[E.7.2. Changes](release-15-9.html#id-1.11.6.12.5) + +**Release date:**2024-11-14 + +This release contains a variety of fixes from 15.8. For information about new features in major release 15, see [Section E.16](release-15.html "E.16. Release 15"). + +### E.7.1. Migration to Version 15.9 + +A dump/restore is not required for those running 15.X. + +However, if you have ever detached a partition from a partitioned table that has a foreign-key reference to another partitioned table, and not dropped the former partition, then you may have catalog and/or data corruption to repair, as detailed in the fifth changelog entry below. + +Also, if you are upgrading from a version earlier than 15.7, see [Section E.9](release-15-7.html "E.9. Release 15.7"). + +### E.7.2. Changes + +* Ensure cached plans are marked as dependent on the calling role when RLS applies to a non-top-level table reference (Nathan Bossart) [§](https://postgr.es/c/6db5ea8de) + + If a CTE, subquery, sublink, security invoker view, or coercion projection in a query references a table with row-level security policies, we neglected to mark the resulting plan as potentially dependent on which role is executing it. This could lead to later query executions in the same session using the wrong plan, and then returning or hiding rows that should have been hidden or returned instead. + + The PostgreSQL Project thanks Wolfgang Walther for reporting this problem. (CVE-2024-10976) +* Make libpq discard error messages received during SSL or GSS protocol negotiation (Jacob Champion) [§](https://postgr.es/c/d2c3e31c1) + + An error message received before encryption negotiation is completed might have been injected by a man-in-the-middle, rather than being real server output. Reporting it opens the door to various security hazards; for example, the message might spoof a query result that a careless user could mistake for correct output. The best answer seems to be to discard such data and rely only on libpq's own report of the connection failure. + + The PostgreSQL Project thanks Jacob Champion for reporting this problem. (CVE-2024-10977) +* Fix unintended interactions between `SET SESSION AUTHORIZATION` and `SET ROLE` (Tom Lane) [§](https://postgr.es/c/a5d2e6205) [§](https://postgr.es/c/109a32380) + + The SQL standard mandates that `SET SESSION AUTHORIZATION` have a side-effect of doing `SET ROLE NONE`. Our implementation of that was flawed, creating more interaction between the two settings than intended. Notably, rolling back a transaction that had done `SET SESSION AUTHORIZATION` would revert `ROLE` to `NONE` even if that had not been the previous state, so that the effective user ID might now be different from what it had been before the transaction. Transiently setting `session_authorization` in a function `SET` clause had a similar effect. A related bug was that if a parallel worker inspected `current_setting('role')`, it saw `none` even when it should see something else. + + The PostgreSQL Project thanks Tom Lane for reporting this problem. (CVE-2024-10978) +* Prevent trusted PL/Perl code from changing environment variables (Andrew Dunstan, Noah Misch) [§](https://postgr.es/c/e530835c6) [§](https://postgr.es/c/16ed4f4d0) [§](https://postgr.es/c/c834b375a) + + The ability to manipulate process environment variables such as `PATH` gives an attacker opportunities to execute arbitrary code. Therefore, “trusted” PLs must not offer the ability to do that. To fix `plperl`, replace `%ENV` with a tied hash that rejects any modification attempt with a warning. Untrusted `plperlu` retains the ability to change the environment. + + The PostgreSQL Project thanks Coby Abrams for reporting this problem. (CVE-2024-10979) +* Fix updates of catalog state for foreign-key constraints when attaching or detaching table partitions (Jehan-Guillaume de Rorthais, Tender Wang, Álvaro Herrera) [§](https://postgr.es/c/5d83bad6b) [§](https://postgr.es/c/1b216fcef) + + If the referenced table is partitioned, then different catalog entries are needed for a referencing table that is stand-alone versus one that is a partition. `ATTACH/DETACH PARTITION` commands failed to perform this conversion correctly. In particular, after `DETACH` the now stand-alone table would be missing foreign-key enforcement triggers, which could result in the table later containing rows that fail the foreign-key constraint. A subsequent re-`ATTACH` could fail with surprising errors, too. + + The way to fix this is to do `ALTER TABLE DROP CONSTRAINT` on the now stand-alone table for each faulty constraint, and then re-add the constraint. If re-adding the constraint fails, then some erroneous data has crept in. You will need to manually re-establish consistency between the referencing and referenced tables, then re-add the constraint. + + This query can be used to identify broken constraints and construct the commands needed to recreate them: + + ```None + SELECT conrelid::pg_catalog.regclass AS "constrained table", + conname AS constraint, + confrelid::pg_catalog.regclass AS "references", + pg_catalog.format('ALTER TABLE %s DROP CONSTRAINT %I;', + conrelid::pg_catalog.regclass, conname) AS "drop", + pg_catalog.format('ALTER TABLE %s ADD CONSTRAINT %I %s;', + conrelid::pg_catalog.regclass, conname, + pg_catalog.pg_get_constraintdef(oid)) AS "add" + FROM pg_catalog.pg_constraint c + WHERE contype = 'f' AND conparentid = 0 AND + (SELECT count(*) FROM pg_catalog.pg_constraint c2 + WHERE c2.conparentid = c.oid) <> + ((SELECT count(*) FROM pg_catalog.pg_inherits i + WHERE (i.inhparent = c.conrelid OR i.inhparent = c.confrelid) AND + EXISTS (SELECT 1 FROM pg_catalog.pg_partitioned_table + WHERE partrelid = i.inhparent)) + + CASE WHEN pg_catalog.pg_partition_root(conrelid) = confrelid THEN + (SELECT count(*) FROM pg_catalog.pg_partition_tree(confrelid) + WHERE level = 1) + ELSE 0 END); + ``` + + Since it is possible that one or more of the `ADD CONSTRAINT` steps will fail, you should save the query's output in a file and then attempt to perform each step. +* Avoid possible crashes and “could not open relation” errors in queries on a partitioned table occurring concurrently with a `DETACH CONCURRENTLY` and immediate drop of a partition (Álvaro Herrera, Kuntal Gosh) [§](https://postgr.es/c/be73e7008) [§](https://postgr.es/c/305db9543) +* Disallow `ALTER TABLE ATTACH PARTITION` if the table to be attached has a foreign key referencing the partitioned table (Álvaro Herrera) [§](https://postgr.es/c/8c0944ac8) [§](https://postgr.es/c/38f506470) + + This arrangement is not supported, and other ways of creating it already fail. +* Don't use partitionwise joins or grouping if the query's collation for the key column doesn't match the partition key's collation (Jian He, Webbo Han) [§](https://postgr.es/c/33040b171) [§](https://postgr.es/c/0a620659c) + + Such plans could produce incorrect results. +* Fix possible “could not find pathkey item to sort” error when the output of a `UNION ALL` member query needs to be sorted, and the sort column is an expression (Andrei Lepikhov, Tom Lane) [§](https://postgr.es/c/4f3bccbaa) +* Allow cancellation of the second stage of index build for large hash indexes (Pavel Borisov) [§](https://postgr.es/c/e0857898b) +* Fix assertion failure or confusing error message for `COPY (query) TO ...`, when the *`query`* is rewritten by a `DO INSTEAD NOTIFY` rule (Tender Wang, Tom Lane) [§](https://postgr.es/c/c80a1e048) +* Fix detection of skewed data during parallel hash join (Thomas Munro) [§](https://postgr.es/c/1831545ca) + + After repartitioning the inner side of a hash join because one partition has accumulated too many tuples, we check to see if all the partition's tuples went into the same child partition, which suggests that they all have the same hash value and further repartitioning cannot improve matters. This check malfunctioned in some cases, allowing repeated futile repartitioning which would eventually end in a resource-exhaustion error. +* Fix race condition in committing a serializable transaction (Heikki Linnakangas) [§](https://postgr.es/c/d97419b85) + + Mis-processing of a recently committed transaction could lead to an assertion failure or a “could not access status of transaction” error. +* Fix race condition in `COMMIT PREPARED` that resulted in orphaned 2PC files (wuchengwen) [§](https://postgr.es/c/41ab45680) + + A concurrent `PREPARE TRANSACTION` could cause `COMMIT PREPARED` to not remove the on-disk two-phase state file for the completed transaction. There was no immediate ill effect, but a subsequent crash-and-recovery could fail with “could not access status of transaction”, requiring manual removal of the orphaned file to restore service. +* Avoid invalid memory accesses after skipping an invalid toast index during `VACUUM FULL` (Tender Wang) [§](https://postgr.es/c/a613edc5c) + + A list tracking yet-to-be-rebuilt indexes was not properly updated in this code path, risking assertion failures or crashes later on. +* Fix ways in which an “in place” catalog update could be lost (Noah Misch) [§](https://postgr.es/c/8590c942c) [§](https://postgr.es/c/5c837f8fa) [§](https://postgr.es/c/159bf0f31) [§](https://postgr.es/c/d34ffbaa1) [§](https://postgr.es/c/0fe002d0c) [§](https://postgr.es/c/6d5b4031b) [§](https://postgr.es/c/d14e94ac4) + + Normal row updates write a new version of the row to preserve rollback-ability of the transaction. However, certain system catalog updates are intentionally non-transactional and are done with an in-place update of the row. These patches fix race conditions that could cause the effects of an in-place update to be lost. As an example, it was possible to forget having set `pg_class`.`relhasindex` to true, preventing updates of the new index and thus causing index corruption. +* Reset catalog caches at end of recovery (Noah Misch) [§](https://postgr.es/c/3baf804b7) + + This prevents scenarios wherein an in-place catalog update could be lost due to using stale data from a catalog cache. +* Avoid using parallel query while holding off interrupts (Francesco Degrassi, Noah Misch, Tom Lane) [§](https://postgr.es/c/884860bfc) [§](https://postgr.es/c/bcbdb176e) + + This situation cannot arise normally, but it can be reached with test scenarios such as using a SQL-language function as B-tree support (which would be far too slow for production usage). If it did occur it would result in an indefinite wait. +* Report the active query ID for statistics purposes at the start of processing of Bind and Execute protocol messages (Sami Imseih) [§](https://postgr.es/c/cbcd4bb41) + + This allows more of the work done in extended query protocol to be attributed to the correct query. +* Guard against stack overflow in libxml2 with too-deeply-nested XML input (Tom Lane, with hat tip to Nick Wellnhofer) [§](https://postgr.es/c/634804885) + + Use `xmlXPathCtxtCompile()` rather than `xmlXPathCompile()`, because the latter fails to protect itself against recursion-to-stack-overflow in libxml2 releases before 2.13.4. +* Do not ignore a concurrent `REINDEX CONCURRENTLY` that is working on an index with predicates or expressions (Michail Nikolaev) [§](https://postgr.es/c/239837a70) + + Normally, `REINDEX CONCURRENTLY` does not need to wait for other `REINDEX CONCURRENTLY` operations on other tables. However, this optimization is not applied if the other `REINDEX CONCURRENTLY` is processing an index with predicates or expressions, on the chance that such expressions contain user-defined code that accesses other tables. Careless coding created a race condition such that that rule was not applied uniformly, possibly allowing inconsistent behavior. +* Fix “failed to find plan for subquery/CTE” errors in `EXPLAIN` (Richard Guo, Tom Lane) [§](https://postgr.es/c/16e67bc5f) [§](https://postgr.es/c/12010f414) + + This case arose while trying to print references to fields of a RECORD-type output of a subquery when the subquery has been optimized out of the plan altogether (which is possible at least in the case that it has a constant-false `WHERE` condition). Nothing remains in the plan to identify the original field names, so fall back to printing `fN` for the *`N`*'th record column. (That's actually the right thing anyway, if the record output arose from a `ROW()` constructor.) +* Disallow a `USING` clause when altering the type of a generated column (Peter Eisentraut) [§](https://postgr.es/c/cf49a606c) + + A generated column already has an expression specifying the column contents, so including `USING` doesn't make sense. +* Ignore not-yet-defined Portals in the `pg_cursors` view (Tom Lane) [§](https://postgr.es/c/aef75219c) + + It is possible for user-defined code that inspects this view to be called while a new cursor is being set up, and if that happens a null pointer dereference would ensue. Avoid the problem by defining the view to exclude incompletely-set-up cursors. +* Prevent mis-encoding of “trailing junk after numeric literal” error messages (Karina Litskevich) [§](https://postgr.es/c/f37ac613a) + + We do not allow identifiers to appear immediately following numeric literals (there must be some whitespace between). If a multibyte character immediately followed a numeric literal, the syntax error message about it included only the first byte of that character, causing bad-encoding problems both in the report to the client and in the postmaster log file. +* Avoid “unexpected table\_index\_fetch\_tuple call during logical decoding” error while decoding a transaction involving insertion of a column default value (Takeshi Ideriha, Hou Zhijie) [§](https://postgr.es/c/8175a7d11) [§](https://postgr.es/c/5ce0dcc99) +* Reduce memory consumption of logical decoding (Masahiko Sawada) [§](https://postgr.es/c/4a675f318) + + Use a smaller default block size to store tuple data received during logical replication. This reduces memory wastage, which has been reported to be severe while processing long-running transactions, even leading to out-of-memory failures. +* Re-disable sending of stateless (TLSv1.2) session tickets (Daniel Gustafsson) [§](https://postgr.es/c/23c200940) + + A previous change to prevent sending of stateful (TLSv1.3) session tickets accidentally re-enabled sending of stateless ones. Thus, while we intended to prevent clients from thinking that TLS session resumption is supported, some still did. +* Avoid “wrong tuple length” failure when dropping a database with many ACL (permission) entries (Ayush Tiwari) [§](https://postgr.es/c/df9c5fb58) [§](https://postgr.es/c/e498d22e2) +* Allow adjusting the `session_authorization` and `role` settings in parallel workers (Tom Lane) [§](https://postgr.es/c/2f4e895be) + + Our code intends to allow modifiable server settings to be set by function `SET` clauses, but not otherwise within a parallel worker. `SET` clauses failed for these two settings, though. +* Fix behavior of stable functions called from a `CALL` statement's argument list, when the `CALL` is within a PL/pgSQL `EXCEPTION` block (Tom Lane) [§](https://postgr.es/c/b35231989) + + As with a similar fix in our previous quarterly releases, this case allowed such functions to be passed the wrong snapshot, causing them to see stale values of rows modified since the start of the outer transaction. +* Fix “cache lookup failed for function” errors in edge cases in PL/pgSQL's `CALL` (Tom Lane) [§](https://postgr.es/c/de3520701) +* Fix thread safety of our fallback (non-OpenSSL) MD5 implementation on big-endian hardware (Heikki Linnakangas) [§](https://postgr.es/c/a38f5f880) + + Thread safety is not currently a concern in the server, but it is for libpq. +* Parse libpq's `keepalives` connection option in the same way as other integer-valued options (Yuto Sasaki) [§](https://postgr.es/c/bb8c89dbc) + + The coding used here rejected trailing whitespace in the option value, unlike other cases. This turns out to be problematic in ecpg's usage, for example. +* Avoid use of `pnstrdup()` in ecpglib (Jacob Champion) [§](https://postgr.es/c/2de129b35) + + That function will call `exit()` on out-of-memory, which is undesirable in a library. The calling code already handles allocation failures properly. +* In ecpglib, fix out-of-bounds read when parsing incorrect datetime input (Bruce Momjian, Pavel Nekrasov) [§](https://postgr.es/c/335501fb2) + + It was possible to try to read the location just before the start of a constant array. Real-world consequences seem minimal, though. +* Fix pg\_dump's handling of identity sequences that have persistence different from their owning table's persistence (Tom Lane) [§](https://postgr.es/c/fc2d1ac1a) + + Since v15, it's been possible to set an identity sequence to be LOGGED when its owning table is UNLOGGED or vice versa. However, pg\_dump's method for recreating that situation failed in binary-upgrade mode, causing pg\_upgrade to fail when such sequences are present. Fix by introducing a new option for `ADD/ALTER COLUMN GENERATED AS IDENTITY` to allow the sequence's persistence to be set correctly at creation. Note that this means a dump from a database containing such a sequence will only load into a server of this minor version or newer. +* Include the source timeline history in pg\_rewind's debug output (Heikki Linnakangas) [§](https://postgr.es/c/b5a5027c9) + + This was the intention to begin with, but a coding error caused the source history to always print as empty. +* Fix misbehavior with junction points on Windows, particularly in pg\_rewind (Alexandra Wang) [§](https://postgr.es/c/b9d4a927d) [§](https://postgr.es/c/f95ad555d) [§](https://postgr.es/c/f2a4a137b) [§](https://postgr.es/c/b73c1496d) + + This entailed back-patching previous fixes by Thomas Munro, Peter Eisentraut, Alexander Lakhin, and Juan José Santamaría Flecha. Those changes were originally not back-patched out of caution, but they have been in use in later branches for long enough to deem them safe. +* Avoid trying to reindex temporary tables and indexes in vacuumdb and in parallel reindexdb (VaibhaveS, Michael Paquier, Fujii Masao, Nathan Bossart) [§](https://postgr.es/c/74eaa0544) [§](https://postgr.es/c/92cc21d15) [§](https://postgr.es/c/6d047c6a9) + + Reindexing other sessions' temporary tables cannot work, but the check to skip them was missing in some code paths, leading to unwanted failures. +* Allow inspection of sequence relations in relevant functions of `contrib/pageinspect` and `contrib/pgstattuple` (Nathan Bossart, Ayush Vatsa) [§](https://postgr.es/c/e03042a70) [§](https://postgr.es/c/a63aef5e4) + + This had been allowed in the past, but it got broken during the introduction of non-default access methods for tables. +* Fix incorrect LLVM-generated code on ARM64 platforms (Thomas Munro, Anthonin Bonnefoy) [§](https://postgr.es/c/19bf81c06) + + When using JIT compilation on ARM platforms, the generated code could not support relocation distances exceeding 32 bits, allowing unlucky placement of generated code to cause server crashes on large-memory systems. +* Fix a few places that assumed that process start time (represented as a `time_t`) will fit into a `long` value (Max Johnson, Nathan Bossart) [§](https://postgr.es/c/01731eeea) + + On platforms where `long` is 32 bits (notably Windows), this coding would fail after Y2038. Most of the failures appear only cosmetic, but notably `pg_ctl start` would hang. +* Fix building with Strawberry Perl on Windows (Andrew Dunstan) [§](https://postgr.es/c/17c35ab23) +* Prevent “missing declaration for inet\_pton” compiler warning or error when building with MinGW (Thomas Munro, Andrew Dunstan) [§](https://postgr.es/c/d700e8d75) +* Update time zone data files to tzdata release 2024b (Tom Lane) [§](https://postgr.es/c/74f70cb86) [§](https://postgr.es/c/2b94ee58b) + + This tzdata release changes the old System-V-compatibility zone names to duplicate the corresponding geographic zones; for example `PST8PDT` is now an alias for `America/Los_Angeles`. The main visible consequence is that for timestamps before the introduction of standardized time zones, the zone is considered to represent local mean solar time for the named location. For example, in `PST8PDT`, `timestamptz` input such as `1801-01-01 00:00` would previously have been rendered as `1801-01-01 00:00:00-08`, but now it is rendered as `1801-01-01 00:00:00-07:52:58`. + + Also, historical corrections for Mexico, Mongolia, and Portugal. Notably, `Asia/Choibalsan` is now an alias for `Asia/Ulaanbaatar` rather than being a separate zone, mainly because the differences between those zones were found to be based on untrustworthy data. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-15-10.html "E.6. Release 15.10") | [Up](release.html "Appendix E. Release Notes") | [Next](release-15-8.html "E.8. Release 15.8") | +| E.6. Release 15.10 | [Home](index.html "PostgreSQL 15.15 Documentation") | E.8. Release 15.8 | + +[Previous](/docs/release/15.8/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/15.10/) diff --git a/corpus/changelog/postgresql_releases/postgresql_160.md b/corpus/changelog/postgresql_releases/postgresql_160.md new file mode 100644 index 0000000000000000000000000000000000000000..1d9b81ca3e2a979dc8e5329831431264223e4ff8 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_160.md @@ -0,0 +1,931 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/16.0/ +Version: 16.0 + +## PostgreSQL 16.0 + +| E.12. Release 16 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-16-1.html "E.11. Release 16.1") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 16.11 Documentation") | [Next](release-prior.html "E.13. Prior Releases") | + +--- + +## E.12. Release 16 [#](#RELEASE-16) + +[E.12.1. Overview](release-16.html#RELEASE-16-HIGHLIGHTS) + +[E.12.2. Migration to Version 16](release-16.html#RELEASE-16-MIGRATION) + +[E.12.3. Changes](release-16.html#RELEASE-16-CHANGES) + +[E.12.4. Acknowledgments](release-16.html#RELEASE-16-ACKNOWLEDGEMENTS) + +**Release date:**2023-09-14 + +### E.12.1. Overview [#](#RELEASE-16-HIGHLIGHTS) + +PostgreSQL 16 contains many new features and enhancements, including: + +* Allow parallelization of `FULL` and internal right `OUTER` hash joins +* Allow logical replication from standby servers +* Allow logical replication subscribers to apply large transactions in parallel +* Allow monitoring of I/O statistics using the new `pg_stat_io` view +* Add SQL/JSON constructors and identity functions +* Improve performance of vacuum freezing +* Add support for regular expression matching of user and database names in `pg_hba.conf`, and user names in `pg_ident.conf` + +The above items and other new features of PostgreSQL 16 are explained in more detail in the sections below. + +### E.12.2. Migration to Version 16 [#](#RELEASE-16-MIGRATION) + +A dump/restore using [pg\_dumpall](app-pg-dumpall.html "pg_dumpall") or use of [pg\_upgrade](pgupgrade.html "pg_upgrade") or logical replication is required for those wishing to migrate data from any previous release. See [Section 19.6](upgrading.html "19.6. Upgrading a PostgreSQL Cluster") for general information on migrating to new major releases. + +Version 16 contains a number of changes that may affect compatibility with previous releases. Observe the following incompatibilities: + +* Change assignment rules for [PL/pgSQL](plpgsql-cursors.html#PLPGSQL-OPEN-BOUND-CURSOR "43.7.2.3. Opening a Bound Cursor") bound cursor variables (Tom Lane) [§](https://postgr.es/c/d747dc85a) + + Previously, the string value of such variables was set to match the variable name during cursor assignment; now it will be assigned during [`OPEN`](plpgsql-cursors.html#PLPGSQL-CURSOR-OPENING "43.7.2. Opening Cursors"), and will not match the variable name. To restore the previous behavior, assign the desired portal name to the cursor variable before `OPEN`. +* Disallow [`NULLS NOT DISTINCT`](sql-createindex.html "CREATE INDEX") indexes for primary keys (Daniel Gustafsson) [§](https://postgr.es/c/d95952325) +* Change [`REINDEX DATABASE`](sql-reindex.html "REINDEX") and [reindexdb](app-reindexdb.html "reindexdb") to not process indexes on system catalogs (Simon Riggs) [§](https://postgr.es/c/2cbc3c17a) [§](https://postgr.es/c/0a5f06b84) + + Processing such indexes is still possible using `REINDEX SYSTEM` and [`reindexdb --system`](app-reindexdb.html "reindexdb"). +* Tighten [`GENERATED`](ddl-generated-columns.html "5.3. Generated Columns") expression restrictions on inherited and partitioned tables (Amit Langote, Tom Lane) [§](https://postgr.es/c/8bf6ec3ba) + + Columns of parent/partitioned and child/partition tables must all have the same generation status, though now the actual generation expressions can be different. +* Remove [pg\_walinspect](pgwalinspect.html "F.37. pg_walinspect — low-level WAL inspection") functions `pg_get_wal_records_info_till_end_of_wal()` and `pg_get_wal_stats_till_end_of_wal()` (Bharath Rupireddy) [§](https://postgr.es/c/5c1b66280) +* Rename server variable `force_parallel_mode` to [`debug_parallel_query`](runtime-config-developer.html#GUC-DEBUG-PARALLEL-QUERY) (David Rowley) [§](https://postgr.es/c/5352ca22e) [§](https://postgr.es/c/0981846b9) +* Remove the ability to [create views](sql-createview.html "CREATE VIEW") manually with `ON SELECT` rules (Tom Lane) [§](https://postgr.es/c/b23cd185f) +* Remove the server variable `vacuum_defer_cleanup_age` (Andres Freund) [§](https://postgr.es/c/1118cd37e) + + This has been unnecessary since [`hot_standby_feedback`](runtime-config-replication.html#GUC-HOT-STANDBY-FEEDBACK) and [replication slots](warm-standby.html#STREAMING-REPLICATION-SLOTS "27.2.6. Replication Slots") were added. +* Remove server variable `promote_trigger_file` (Simon Riggs) [§](https://postgr.es/c/cd4329d93) + + This was used to promote a standby to primary, but is now more easily accomplished with [`pg_ctl promote`](app-pg-ctl.html "pg_ctl") or [`pg_promote()`](functions-admin.html#FUNCTIONS-RECOVERY-CONTROL-TABLE "Table 9.93. Recovery Control Functions"). +* Remove read-only server variables `lc_collate` and `lc_ctype` (Peter Eisentraut) [§](https://postgr.es/c/b0f6c4371) + + Collations and locales can vary between databases so having them as read-only server variables was unhelpful. +* Role inheritance now controls the default inheritance status of member roles added during [`GRANT`](sql-grant.html "GRANT") (Robert Haas) [§](https://postgr.es/c/e3ce2de09) + + The role's default inheritance behavior can be overridden with the new `GRANT ... WITH INHERIT` clause. This allows inheritance of some roles and not others because the members' inheritance status is set at `GRANT` time. Previously the inheritance status of member roles was controlled only by the role's inheritance status, and changes to a role's inheritance status affected all previous and future member roles. +* Restrict the privileges of [`CREATEROLE`](sql-createrole.html "CREATE ROLE") and its ability to modify other roles (Robert Haas) [§](https://postgr.es/c/cf5eb37c5) [§](https://postgr.es/c/f1358ca52) + + Previously roles with `CREATEROLE` privileges could change many aspects of any non-superuser role. Such changes, including adding members, now require the role requesting the change to have `ADMIN OPTION` permission. For example, they can now change the `CREATEDB`, `REPLICATION`, and `BYPASSRLS` properties only if they also have those permissions. +* Remove symbolic links for the postmaster binary (Peter Eisentraut) [§](https://postgr.es/c/37e267335) + +### E.12.3. Changes [#](#RELEASE-16-CHANGES) + +Below you will find a detailed account of the changes between PostgreSQL 16 and the previous major release. + +#### E.12.3.1. Server [#](#RELEASE-16-SERVER) + +##### E.12.3.1.1. Optimizer [#](#RELEASE-16-OPTIMIZER) + +* Allow incremental sorts in more cases, including `DISTINCT` (David Rowley) [§](https://postgr.es/c/b59242209) [§](https://postgr.es/c/3c6fc5820) +* Add the ability for aggregates having `ORDER BY` or `DISTINCT` to use pre-sorted data (David Rowley) [§](https://postgr.es/c/1349d2790) [§](https://postgr.es/c/3226f4728) [§](https://postgr.es/c/da5800d5f) + + The new server variable [`enable_presorted_aggregate`](runtime-config-query.html#GUC-ENABLE-PRESORTED-AGGREGATE) can be used to disable this. +* Allow memoize atop a `UNION ALL` (Richard Guo) [§](https://postgr.es/c/9bfd2822b) +* Allow anti-joins to be performed with the non-nullable input as the inner relation (Richard Guo) [§](https://postgr.es/c/16dc2703c) +* Allow parallelization of [`FULL`](queries-table-expressions.html#QUERIES-JOIN "7.2.1.1. Joined Tables") and internal right `OUTER` hash joins (Melanie Plageman, Thomas Munro) [§](https://postgr.es/c/11c2d6fdf) +* Improve the accuracy of [`GIN`](gin.html "Chapter 70. GIN Indexes") index access optimizer costs (Ronan Dunklau) [§](https://postgr.es/c/cd9479af2) + +##### E.12.3.1.2. General Performance [#](#RELEASE-16-PERFORMANCE) + +* Allow more efficient addition of heap and index pages (Andres Freund) [§](https://postgr.es/c/00d1e02be) [§](https://postgr.es/c/26158b852) +* During non-freeze operations, perform page [freezing](routine-vacuuming.html#VACUUM-FOR-WRAPAROUND "25.1.5. Preventing Transaction ID Wraparound Failures") where appropriate (Peter Geoghegan) [§](https://postgr.es/c/d977ffd92) [§](https://postgr.es/c/9e5405993) [§](https://postgr.es/c/1de58df4f) + + This makes full-table freeze vacuums less necessary. +* Allow window functions to use the faster [`ROWS`](sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS "4.2.8. Window Function Calls") mode internally when `RANGE` mode is active but unnecessary (David Rowley) [§](https://postgr.es/c/ed1a88dda) +* Allow optimization of always-increasing window functions [`ntile()`](functions-window.html#FUNCTIONS-WINDOW-TABLE "Table 9.64. General-Purpose Window Functions"), `cume_dist()` and `percent_rank()` (David Rowley) [§](https://postgr.es/c/456fa635a) +* Allow aggregate functions [`string_agg()`](functions-aggregate.html#FUNCTIONS-AGGREGATE-TABLE "Table 9.59. General-Purpose Aggregate Functions") and `array_agg()` to be parallelized (David Rowley) [§](https://postgr.es/c/16fd03e95) +* Improve performance by caching [`RANGE`](ddl-partitioning.html#DDL-PARTITIONING-OVERVIEW "5.11.1. Overview") and `LIST` partition lookups (Amit Langote, Hou Zhijie, David Rowley) [§](https://postgr.es/c/3592e0ff9) +* Allow control of the shared buffer usage by vacuum and analyze (Melanie Plageman) [§](https://postgr.es/c/1cbbee033) [§](https://postgr.es/c/ae78cae3b) [§](https://postgr.es/c/b72f564d8) + + The [`VACUUM`](sql-vacuum.html "VACUUM")/[`ANALYZE`](sql-analyze.html "ANALYZE") option is `BUFFER_USAGE_LIMIT`, and the [vacuumdb](app-vacuumdb.html "vacuumdb") option is `--buffer-usage-limit`. The default value is set by server variable [`vacuum_buffer_usage_limit`](runtime-config-resource.html#GUC-VACUUM-BUFFER-USAGE-LIMIT), which also controls autovacuum. +* Support [`wal_sync_method=fdatasync`](runtime-config-wal.html#GUC-WAL-SYNC-METHOD) on Windows (Thomas Munro) [§](https://postgr.es/c/9430fb407) +* Allow [HOT](storage-hot.html "73.7. Heap-Only Tuples (HOT)") updates if only `BRIN`-indexed columns are updated (Matthias van de Meent, Josef Simanek, Tomas Vondra) [§](https://postgr.es/c/19d8e2308) +* Improve the speed of updating the [process title](runtime-config-logging.html#GUC-UPDATE-PROCESS-TITLE) (David Rowley) [§](https://postgr.es/c/2cb82e2ac) +* Allow `xid`/`subxid` searches and ASCII string detection to use vector operations (Nathan Bossart, John Naylor) [§](https://postgr.es/c/37a6e5df3) [§](https://postgr.es/c/121d2d3d7) [§](https://postgr.es/c/b6ef16756) [§](https://postgr.es/c/e813e0e16) + + ASCII detection is particularly useful for [`COPY FROM`](sql-copy.html "COPY"). Vector operations are also used for some C array searches. +* Reduce overhead of memory allocations (Andres Freund, David Rowley) [§](https://postgr.es/c/c6e0fe1f2) + +##### E.12.3.1.3. Monitoring [#](#RELEASE-16-MONITORING) + +* Add system view [`pg_stat_io`](monitoring-stats.html#MONITORING-PG-STAT-IO-VIEW "28.2.13. pg_stat_io") view to track I/O statistics (Melanie Plageman) [§](https://postgr.es/c/a9c70b46d) [§](https://postgr.es/c/8aaa04b32) [§](https://postgr.es/c/ac8d53dae) [§](https://postgr.es/c/0ecb87e1f) [§](https://postgr.es/c/093e5c57d) +* Record statistics on the last sequential and index scans on tables (Dave Page) [§](https://postgr.es/c/c03747183) + + This information appears in [`pg_stat_*_tables`](monitoring-stats.html#PG-STAT-ALL-TABLES-VIEW "Table 28.28. pg_stat_all_tables View") and [`pg_stat_*_indexes`](monitoring-stats.html#MONITORING-PG-STAT-ALL-INDEXES-VIEW "28.2.19. pg_stat_all_indexes"). +* Record statistics on the occurrence of updated rows moving to new pages (Corey Huinker) [§](https://postgr.es/c/ae4fdde13) + + The `pg_stat_*_tables` column is [`n_tup_newpage_upd`](monitoring-stats.html#MONITORING-PG-STAT-ALL-TABLES-VIEW "28.2.18. pg_stat_all_tables"). +* Add speculative lock information to the [`pg_locks`](view-pg-locks.html "54.12. pg_locks") system view (Masahiko Sawada, Noriyoshi Shinoda) [§](https://postgr.es/c/f74573969) + + The transaction id is displayed in the `transactionid` column and the speculative insertion token is displayed in the `objid` column. +* Add the display of prepared statement result types to the [`pg_prepared_statements`](view-pg-prepared-statements.html "54.15. pg_prepared_statements") view (Dagfinn Ilmari Mannsåker) [§](https://postgr.es/c/84ad713cf) [§](https://postgr.es/c/6ffff0fd2) +* Create subscription statistics entries at subscription creation time so [`stats_reset`](monitoring-stats.html#PG-STAT-DATABASE-VIEW "Table 28.26. pg_stat_database View") is accurate (Andres Freund) [§](https://postgr.es/c/e0b014295) + + Previously entries were created only when the first statistics were reported. +* Correct the I/O accounting for temp relation writes shown in [`pg_stat_database`](monitoring-stats.html#PG-STAT-DATABASE-VIEW "Table 28.26. pg_stat_database View") (Melanie Plageman) [§](https://postgr.es/c/704261ecc) +* Add function [`pg_stat_get_backend_subxact()`](monitoring-stats.html#MONITORING-STATS-BACKEND-FUNCS-TABLE "Table 28.36. Per-Backend Statistics Functions") to report on a session's subtransaction cache (Dilip Kumar) [§](https://postgr.es/c/10ea0f924) +* Have [`pg_stat_get_backend_idset()`](monitoring-stats.html#MONITORING-STATS-BACKEND-FUNCS-TABLE "Table 28.36. Per-Backend Statistics Functions"), `pg_stat_get_backend_activity()`, and related functions use the unchanging backend id (Nathan Bossart) [§](https://postgr.es/c/d7e39d72c) + + Previously the index values might change during the lifetime of the session. +* Report stand-alone backends with a special backend type (Melanie Plageman) [§](https://postgr.es/c/0c679464a) +* Add wait event [`SpinDelay`](monitoring-stats.html#WAIT-EVENT-TIMEOUT-TABLE "Table 28.13. Wait Events of Type Timeout") to report spinlock sleep delays (Andres Freund) [§](https://postgr.es/c/92daeca45) +* Create new wait event [`DSMAllocate`](monitoring-stats.html#WAIT-EVENT-IO-TABLE "Table 28.9. Wait Events of Type IO") to indicate waiting for dynamic shared memory allocation (Thomas Munro) [§](https://postgr.es/c/7bae3bbf6) + + Previously this type of wait was reported as `DSMFillZeroWrite`, which was also used by `mmap()` allocations. +* Add the database name to the [process title](runtime-config-logging.html#GUC-UPDATE-PROCESS-TITLE) of logical WAL senders (Tatsuhiro Nakamori) [§](https://postgr.es/c/af205152e) + + Physical WAL senders do not display a database name. +* Add checkpoint and `REDO LSN` information to [`log_checkpoints`](runtime-config-logging.html#GUC-LOG-CHECKPOINTS) messages (Bharath Rupireddy, Kyotaro Horiguchi) [§](https://postgr.es/c/62c46eee2) +* Provide additional details during client certificate failures (Jacob Champion) [§](https://postgr.es/c/3a0e38504) + +##### E.12.3.1.4. Privileges [#](#RELEASE-16-PRIVILEGES) + +* Add predefined role [`pg_create_subscription`](predefined-roles.html "22.5. Predefined Roles") with permission to create subscriptions (Robert Haas) [§](https://postgr.es/c/c3afe8cf5) +* Allow subscriptions to not require passwords (Robert Haas) [§](https://postgr.es/c/c3afe8cf5) [§](https://postgr.es/c/c1cc4e688) [§](https://postgr.es/c/19e65dff3) + + This is accomplished with the option [`password_required=false`](sql-createsubscription.html "CREATE SUBSCRIPTION"). +* Simplify permissions for [`LOCK TABLE`](sql-lock.html "LOCK") (Jeff Davis) [§](https://postgr.es/c/c44f6334c) + + Previously a user's ability to perform `LOCK TABLE` at various lock levels was limited to the lock levels required by the commands they had permission to execute on the table. For example, someone with [`UPDATE`](sql-update.html "UPDATE") permission could perform all lock levels except `ACCESS SHARE`, even though it was a lesser lock level. Now users can issue lesser lock levels if they already have permission for greater lock levels. +* Allow [`ALTER GROUP group_name ADD USER user_name`](sql-altergroup.html "ALTER GROUP") to be performed with `ADMIN OPTION` (Robert Haas) [§](https://postgr.es/c/ce6b672e4) + + Previously `CREATEROLE` permission was required. +* Allow [`GRANT`](sql-grant.html "GRANT") to use `WITH ADMIN TRUE`/`FALSE` syntax (Robert Haas) [§](https://postgr.es/c/e3ce2de09) + + Previously only the `WITH ADMIN OPTION` syntax was supported. +* Allow roles that create other roles to automatically inherit the new role's rights or the ability to [`SET ROLE`](sql-set-role.html "SET ROLE") to the new role (Robert Haas, Shi Yu) [§](https://postgr.es/c/e5b8a4c09) [§](https://postgr.es/c/e00bc6c92) + + This is controlled by server variable [`createrole_self_grant`](runtime-config-client.html#GUC-CREATEROLE-SELF-GRANT). +* Prevent users from changing the default privileges of non-inherited roles (Robert Haas) [§](https://postgr.es/c/48a257d44) + + This is now only allowed for inherited roles. +* When granting role membership, require the granted-by role to be a role that has appropriate permissions (Robert Haas) [§](https://postgr.es/c/ce6b672e4) + + This is a requirement even when a non-bootstrap superuser is granting role membership. +* Allow non-superusers to grant permissions using a granted-by user that is not the current user (Robert Haas) [§](https://postgr.es/c/ce6b672e4) + + The current user still must have sufficient permissions given by the specified granted-by user. +* Add [`GRANT`](sql-grant.html "GRANT") to control permission to use [`SET ROLE`](sql-set-role.html "SET ROLE") (Robert Haas) [§](https://postgr.es/c/3d14e171e) + + This is controlled by a new `GRANT ... SET` option. +* Add dependency tracking to roles which have granted privileges (Robert Haas) [§](https://postgr.es/c/ce6b672e4) + + For example, removing `ADMIN OPTION` will fail if there are privileges using that option; `CASCADE` must be used to revoke dependent permissions. +* Add dependency tracking of grantors for [`GRANT`](sql-grant.html "GRANT") records (Robert Haas) [§](https://postgr.es/c/6566133c5) + + This guarantees that [`pg_auth_members`](catalog-pg-auth-members.html "53.9. pg_auth_members").`grantor` values are always valid. +* Allow multiple role membership records (Robert Haas) [§](https://postgr.es/c/ce6b672e4) [§](https://postgr.es/c/0101f770a) + + Previously a new membership grant would remove a previous matching membership grant, even if other aspects of the grant did not match. +* Prevent removal of superuser privileges for the bootstrap user (Robert Haas) [§](https://postgr.es/c/e530be2c5) + + Restoring such users could lead to errors. +* Allow [`makeaclitem()`](functions-info.html#FUNCTIONS-ACLITEM-FN-TABLE "Table 9.70. aclitem Functions") to accept multiple privilege names (Robins Tharakan) [§](https://postgr.es/c/b762bbde3) + + Previously only a single privilege name, like [`SELECT`](sql-select.html "SELECT"), was accepted. + +##### E.12.3.1.5. Server Configuration [#](#RELEASE-16-SERVER-CONFIG) + +* Add support for Kerberos credential delegation (Stephen Frost) [§](https://postgr.es/c/6633cfb21) [§](https://postgr.es/c/9c0a0e2ed) [§](https://postgr.es/c/f4001a553) [§](https://postgr.es/c/a2eb99a01) + + This is enabled with server variable [`gss_accept_delegation`](runtime-config-connection.html#GUC-GSS-ACCEPT-DELEGATION) and libpq connection parameter [`gssdelegation`](libpq-connect.html#LIBPQ-CONNECT-GSSDELEGATION). +* Allow the SCRAM iteration count to be set with server variable [`scram_iterations`](runtime-config-connection.html#GUC-SCRAM-ITERATIONS) (Daniel Gustafsson) [§](https://postgr.es/c/b57774300) +* Improve performance of server variable management (Tom Lane) [§](https://postgr.es/c/3057465ac) [§](https://postgr.es/c/f13b2088f) +* Tighten restrictions on which server variables can be reset (Masahiko Sawada) [§](https://postgr.es/c/385366426) + + Previously, while certain variables, like [`transaction_isolation`](runtime-config-client.html#GUC-DEFAULT-TRANSACTION-ISOLATION), were not affected by [`RESET ALL`](sql-reset.html "RESET"), they could be individually reset in inappropriate situations. +* Move various [`postgresql.conf`](config-setting.html#CONFIG-SETTING-CONFIGURATION-FILE "20.1.2. Parameter Interaction via the Configuration File") items into new categories (Shinya Kato) [§](https://postgr.es/c/0b039e3a8) + + This also affects the categories displayed in the [`pg_settings`](view-pg-settings.html "54.24. pg_settings") view. +* Prevent configuration file recursion beyond 10 levels (Julien Rouhaud) [§](https://postgr.es/c/d13b68411) +* Allow [autovacuum](routine-vacuuming.html#AUTOVACUUM "25.1.6. The Autovacuum Daemon") to more frequently honor changes to delay settings (Melanie Plageman) [§](https://postgr.es/c/7d71d3dd0) [§](https://postgr.es/c/a9781ae11) + + Rather than honor changes only at the start of each relation, honor them at the start of each block. +* Remove restrictions that archive files be durably renamed (Nathan Bossart) [§](https://postgr.es/c/756e221db) [§](https://postgr.es/c/3cabe45a8) + + The [`archive_command`](runtime-config-wal.html#GUC-ARCHIVE-COMMAND) command is now more likely to be called with already-archived files after a crash. +* Prevent [`archive_library`](runtime-config-wal.html#GUC-ARCHIVE-LIBRARY) and [`archive_command`](runtime-config-wal.html#GUC-ARCHIVE-COMMAND) from being set at the same time (Nathan Bossart) [§](https://postgr.es/c/d627ce3b7) + + Previously `archive_library` would override `archive_command`. +* Allow the postmaster to terminate children with an abort signal (Tom Lane) [§](https://postgr.es/c/51b5834cd) + + This allows collection of a core dump for a stuck child process. This is controlled by [`send_abort_for_crash`](runtime-config-developer.html#GUC-SEND-ABORT-FOR-CRASH) and [`send_abort_for_kill`](runtime-config-developer.html#GUC-SEND-ABORT-FOR-KILL). The postmaster's `-T` switch is now the same as setting `send_abort_for_crash`. +* Remove the non-functional postmaster `-n` option (Tom Lane) [§](https://postgr.es/c/51b5834cd) +* Allow the server to reserve backend slots for roles with [`pg_use_reserved_connections`](predefined-roles.html "22.5. Predefined Roles") membership (Nathan Bossart) [§](https://postgr.es/c/6e2775e4d) + + The number of reserved slots is set by server variable [`reserved_connections`](runtime-config-connection.html#GUC-RESERVED-CONNECTIONS). +* Allow [huge pages](runtime-config-resource.html#GUC-HUGE-PAGES) to work on newer versions of Windows 10 (Thomas Munro) [§](https://postgr.es/c/fdd8937c0) + + This adds the special handling required to enable huge pages on newer versions of Windows 10. +* Add [`debug_io_direct`](runtime-config-developer.html#GUC-DEBUG-IO-DIRECT) setting for developer usage (Thomas Munro, Andres Freund, Bharath Rupireddy) [§](https://postgr.es/c/d4e71df6d) [§](https://postgr.es/c/319bae9a8) + + While primarily for developers, [`wal_sync_method=open_sync`](runtime-config-wal.html#GUC-WAL-SYNC-METHOD)/`open_datasync` has been modified to not use direct I/O with `wal_level=minimal`; this is now enabled with `debug_io_direct=wal`. +* Add function [`pg_split_walfile_name()`](functions-admin.html#FUNCTIONS-ADMIN-BACKUP-TABLE "Table 9.91. Backup Control Functions") to report the segment and timeline values of WAL file names (Bharath Rupireddy) [§](https://postgr.es/c/cca186348) [§](https://postgr.es/c/13e0d7a60) + +##### E.12.3.1.6. [pg\_hba.conf](auth-pg-hba-conf.html "21.1. The pg_hba.conf File") [#](#RELEASE-16-PG-HBA) + +* Add support for regular expression matching on database and role entries in `pg_hba.conf` (Bertrand Drouvot) [§](https://postgr.es/c/8fea86830) + + Regular expression patterns are prefixed with a slash. Database and role names that begin with slashes need to be double-quoted if referenced in `pg_hba.conf`. +* Improve user-column handling of [`pg_ident.conf`](runtime-config-file-locations.html "20.2. File Locations") to match `pg_hba.conf` (Jelte Fennema) [§](https://postgr.es/c/efb6f4a4f) + + Specifically, add support for `all`, role membership with `+`, and regular expressions with a leading slash. Any user name that matches these patterns must be double-quoted. +* Allow include files in `pg_hba.conf` and `pg_ident.conf` (Julien Rouhaud) [§](https://postgr.es/c/a54b658ce) + + These are controlled by `include`, `include_if_exists`, and `include_dir`. System views [`pg_hba_file_rules`](view-pg-hba-file-rules.html "54.9. pg_hba_file_rules") and [`pg_ident_file_mappings`](view-pg-ident-file-mappings.html "54.10. pg_ident_file_mappings") now display the file name. +* Allow `pg_hba.conf` tokens to be of unlimited length (Tom Lane) [§](https://postgr.es/c/de3f0e3fe) +* Add rule and map numbers to the system view [`pg_hba_file_rules`](view-pg-hba-file-rules.html "54.9. pg_hba_file_rules") (Julien Rouhaud) [§](https://postgr.es/c/c591300a8) + +##### E.12.3.1.7. [Localization](charset.html "Chapter 24. Localization") [#](#RELEASE-16-LOCALIZATION) + +* Determine the default encoding from the locale when using ICU (Jeff Davis) [§](https://postgr.es/c/c45dc7ffb) + + Previously the default was always `UTF-8`. +* Have [`CREATE DATABASE`](sql-createdatabase.html "CREATE DATABASE") and [`CREATE COLLATION`](sql-createcollation.html "CREATE COLLATION")'s `LOCALE` options, and [initdb](app-initdb.html "initdb") and [createdb](app-createdb.html "createdb") `--locale` options, control non-libc collation providers (Jeff Davis) + + Previously they only controlled libc providers. +* Add predefined collations `unicode` and `ucs_basic` (Peter Eisentraut) [§](https://postgr.es/c/0d21d4b9b) + + This only works if ICU support is enabled. +* Allow custom ICU collation rules to be created (Peter Eisentraut) [§](https://postgr.es/c/30a53b792) + + This is done using [`CREATE COLLATION`](sql-createcollation.html "CREATE COLLATION")'s new `RULES` clause, as well as new options for [`CREATE DATABASE`](sql-createdatabase.html "CREATE DATABASE"), [createdb](app-createdb.html "createdb"), and [initdb](app-initdb.html "initdb"). +* Allow Windows to import system locales automatically (Juan José Santamaría Flecha) [§](https://postgr.es/c/bf03cfd16) + + Previously, only ICU locales could be imported on Windows. + +#### E.12.3.2. [Logical Replication](logical-replication.html "Chapter 31. Logical Replication") [#](#RELEASE-16-LOGICAL) + +* Allow [logical decoding](logicaldecoding.html "Chapter 49. Logical Decoding") on standbys (Bertrand Drouvot, Andres Freund, Amit Khandekar) [§](https://postgr.es/c/0fdab27ad) [§](https://postgr.es/c/be87200ef) [§](https://postgr.es/c/26669757b) + + Snapshot WAL records are required for logical slot creation but cannot be created on standbys. To avoid delays, the new function [`pg_log_standby_snapshot()`](functions-admin.html#FUNCTIONS-SNAPSHOT-SYNCHRONIZATION-TABLE "Table 9.94. Snapshot Synchronization Functions") allows creation of such records. +* Add server variable to control how logical decoding publishers transfer changes and how subscribers apply them (Shi Yu) [§](https://postgr.es/c/5de94a041) [§](https://postgr.es/c/1e8b61735) [§](https://postgr.es/c/9f2213a7c) + + The variable is [`debug_logical_replication_streaming`](runtime-config-developer.html#GUC-DEBUG-LOGICAL-REPLICATION-STREAMING). +* Allow logical replication initial table synchronization to copy rows in binary format (Melih Mutlu) [§](https://postgr.es/c/ecb696527) + + This is only possible for subscriptions marked as binary. +* Allow parallel application of logical replication (Hou Zhijie, Wang Wei, Amit Kapila) [§](https://postgr.es/c/216a78482) [§](https://postgr.es/c/cd06ccd78) [§](https://postgr.es/c/fce003cfd) + + The [`CREATE SUBSCRIPTION`](sql-createsubscription.html "CREATE SUBSCRIPTION") `STREAMING` option now supports `parallel` to enable application of large transactions by parallel workers. The number of parallel workers is controlled by the new server variable [`max_parallel_apply_workers_per_subscription`](runtime-config-replication.html#GUC-MAX-PARALLEL-APPLY-WORKERS-PER-SUBSCRIPTION). Wait events [`LogicalParallelApplyMain`](monitoring-stats.html#WAIT-EVENT-ACTIVITY-TABLE "Table 28.5. Wait Events of Type Activity"), `LogicalParallelApplyStateChange`, and `LogicalApplySendData` were also added. Column `leader_pid` was added to system view [`pg_stat_subscription`](monitoring-stats.html#MONITORING-PG-STAT-SUBSCRIPTION "28.2.8. pg_stat_subscription") to track parallel activity. +* Improve performance for [logical replication apply](logical-replication-architecture.html "31.7. Architecture") without a primary key (Onder Kalaci, Amit Kapila) [§](https://postgr.es/c/89e46da5e) + + Specifically, `REPLICA IDENTITY FULL` can now use btree indexes rather than sequentially scanning the table to find matches. +* Allow logical replication subscribers to process only changes that have no origin (Vignesh C, Amit Kapila) [§](https://postgr.es/c/366283961) [§](https://postgr.es/c/875693019) + + This can be used to avoid replication loops. This is controlled by the new `CREATE SUBSCRIPTION ... ORIGIN` option. +* Perform logical replication [`SELECT`](sql-select.html "SELECT") and DML actions as the table owner (Robert Haas) [§](https://postgr.es/c/1e10d49b6) [§](https://postgr.es/c/482675987) + + This improves security and now requires subscription owners to be either superusers or to have [`SET ROLE`](sql-set-role.html "SET ROLE") permission on all roles owning tables in the replication set. The previous behavior of performing all operations as the subscription owner can be enabled with the subscription [`run_as_owner`](sql-createsubscription.html "CREATE SUBSCRIPTION") option. +* Have [`wal_retrieve_retry_interval`](runtime-config-replication.html#GUC-WAL-RETRIEVE-RETRY-INTERVAL) operate on a per-subscription basis (Nathan Bossart) [§](https://postgr.es/c/5a3a95385) + + Previously the retry time was applied globally. This also adds wait events [>`LogicalRepLauncherDSA`](monitoring-stats.html#WAIT-EVENT-LWLOCK-TABLE "Table 28.12. Wait Events of Type LWLock") and `LogicalRepLauncherHash`. + +#### E.12.3.3. Utility Commands [#](#RELEASE-16-UTILITY) + +* Add [`EXPLAIN`](sql-explain.html "EXPLAIN") option `GENERIC_PLAN` to display the generic plan for a parameterized query (Laurenz Albe) [§](https://postgr.es/c/3c05284d8) +* Allow a [`COPY FROM`](sql-copy.html "COPY") value to map to a column's `DEFAULT` (Israel Barth Rubio) [§](https://postgr.es/c/9f8377f7a) +* Allow [`COPY`](sql-copy.html "COPY") into foreign tables to add rows in batches (Andrey Lepikhov, Etsuro Fujita) [§](https://postgr.es/c/97da48246) + + This is controlled by the [postgres\_fdw](postgres-fdw.html "F.38. postgres_fdw — access data stored in external PostgreSQL servers") option [`batch_size`](postgres-fdw.html#POSTGRES-FDW-OPTIONS-COST-ESTIMATION "F.38.1.3. Cost Estimation Options"). +* Allow the `STORAGE` type to be specified by [`CREATE TABLE`](sql-createtable.html "CREATE TABLE") (Teodor Sigaev, Aleksander Alekseev) [§](https://postgr.es/c/784cedda0) [§](https://postgr.es/c/b9424d014) + + Previously only [`ALTER TABLE`](sql-altertable.html "ALTER TABLE") could control this. +* Allow [truncate triggers](sql-createtrigger.html "CREATE TRIGGER") on foreign tables (Yugo Nagata) [§](https://postgr.es/c/3b00a944a) +* Allow [`VACUUM`](sql-vacuum.html "VACUUM") and [vacuumdb](app-vacuumdb.html "vacuumdb") to only process [`TOAST`](storage-toast.html "73.2. TOAST") tables (Nathan Bossart) [§](https://postgr.es/c/4211fbd84) + + This is accomplished by having [`VACUUM`](sql-vacuum.html "VACUUM") turn off `PROCESS_MAIN` or by [vacuumdb](app-vacuumdb.html "vacuumdb") using the `--no-process-main` option. +* Add [`VACUUM`](sql-vacuum.html "VACUUM") options to skip or update all [frozen](routine-vacuuming.html#VACUUM-FOR-WRAPAROUND "25.1.5. Preventing Transaction ID Wraparound Failures") statistics (Tom Lane, Nathan Bossart) [§](https://postgr.es/c/a46a7011b) + + The options are `SKIP_DATABASE_STATS` and `ONLY_DATABASE_STATS`. +* Change [`REINDEX DATABASE`](sql-reindex.html "REINDEX") and [`REINDEX SYSTEM`](sql-reindex.html "REINDEX") to no longer require an argument (Simon Riggs) [§](https://postgr.es/c/2cbc3c17a) [§](https://postgr.es/c/0a5f06b84) + + Previously the database name had to be specified. +* Allow [`CREATE STATISTICS`](sql-createstatistics.html "CREATE STATISTICS") to generate a statistics name if none is specified (Simon Riggs) [§](https://postgr.es/c/624aa2a13) + +#### E.12.3.4. Data Types [#](#RELEASE-16-DATATYPES) + +* Allow non-decimal [integer literals](sql-syntax-lexical.html#SQL-SYNTAX-BIT-STRINGS "4.1.2.5. Bit-String Constants") (Peter Eisentraut) [§](https://postgr.es/c/6fcda9aba) + + For example, `0x42F`, `0o273`, and `0b100101`. +* Allow [`NUMERIC`](datatype-numeric.html "8.1. Numeric Types") to process hexadecimal, octal, and binary integers of any size (Dean Rasheed) [§](https://postgr.es/c/6dfacbf72) + + Previously only unquoted eight-byte integers were supported with these non-decimal bases. +* Allow underscores in integer and numeric [constants](sql-syntax-lexical.html#SQL-SYNTAX-BIT-STRINGS "4.1.2.5. Bit-String Constants") (Peter Eisentraut, Dean Rasheed) [§](https://postgr.es/c/faff8f8e4) + + This can improve readability for long strings of digits. +* Accept the spelling `+infinity` in datetime input (Vik Fearing) [§](https://postgr.es/c/2ceea5adb) +* Prevent the specification of `epoch` and `infinity` together with other fields in datetime strings (Joseph Koshakow) [§](https://postgr.es/c/bcc704b52) +* Remove undocumented support for date input in the form `YyearMmonthDday` (Joseph Koshakow) [§](https://postgr.es/c/5b3c59535) +* Add functions [`pg_input_is_valid()`](functions-info.html#FUNCTIONS-INFO-VALIDITY-TABLE "Table 9.79. Data Validity Checking Functions") and `pg_input_error_info()` to check for type conversion errors (Tom Lane) [§](https://postgr.es/c/1939d2628) [§](https://postgr.es/c/b8da37b3a) + +#### E.12.3.5. General Queries [#](#RELEASE-16-GENERAL) + +* Allow subqueries in the `FROM` clause to omit aliases (Dean Rasheed) [§](https://postgr.es/c/bcedd8f5f) +* Add support for enhanced numeric literals in SQL/JSON paths (Peter Eisentraut) [§](https://postgr.es/c/102a5c164) + + For example, allow hexadecimal, octal, and binary integers and underscores between digits. + +#### E.12.3.6. Functions [#](#RELEASE-16-FUNCTIONS) + +* Add SQL/JSON constructors (Nikita Glukhov, Teodor Sigaev, Oleg Bartunov, Alexander Korotkov, Amit Langote) [§](https://postgr.es/c/7081ac46a) + + The new functions [`JSON_ARRAY()`](functions-json.html#FUNCTIONS-JSON-CREATION-TABLE "Table 9.47. JSON Creation Functions"), [`JSON_ARRAYAGG()`](functions-aggregate.html#FUNCTIONS-AGGREGATE-TABLE "Table 9.59. General-Purpose Aggregate Functions"), `JSON_OBJECT()`, and `JSON_OBJECTAGG()` are part of the SQL standard. +* Add SQL/JSON object checks (Nikita Glukhov, Teodor Sigaev, Oleg Bartunov, Alexander Korotkov, Amit Langote, Andrew Dunstan) [§](https://postgr.es/c/6ee30209a) + + The [`IS JSON`](functions-json.html#FUNCTIONS-SQLJSON-MISC "Table 9.48. SQL/JSON Testing Functions") checks include checks for values, arrays, objects, scalars, and unique keys. +* Allow JSON string parsing to use vector operations (John Naylor) [§](https://postgr.es/c/0a8de93a4) +* Improve the handling of full text highlighting function [`ts_headline()`](functions-textsearch.html#TEXTSEARCH-FUNCTIONS-TABLE "Table 9.43. Text Search Functions") for `OR` and `NOT` expressions (Tom Lane) [§](https://postgr.es/c/5a617d75d) +* Add functions to add, subtract, and generate `timestamptz` values in a specified time zone (Przemyslaw Sztoch, Gurjeet Singh) [§](https://postgr.es/c/75bd846b6) + + The functions are [`date_add()`](functions-datetime.html#FUNCTIONS-DATETIME-TABLE "Table 9.33. Date/Time Functions"), `date_subtract()`, and [`generate_series()`](functions-srf.html#FUNCTIONS-SRF-SERIES "Table 9.65. Series Generating Functions"). +* Change [`date_trunc(unit, timestamptz, time_zone)`](functions-datetime.html#FUNCTIONS-DATETIME-TABLE "Table 9.33. Date/Time Functions") to be an immutable function (Przemyslaw Sztoch) [§](https://postgr.es/c/533e02e92) + + This allows the creation of expression indexes using this function. +* Add server variable [`SYSTEM_USER`](functions-info.html#FUNCTIONS-INFO-SESSION-TABLE "Table 9.67. Session Information Functions") (Bertrand Drouvot) [§](https://postgr.es/c/0823d061b) + + This reports the authentication method and its authenticated user. +* Add functions [`array_sample()`](functions-array.html#ARRAY-FUNCTIONS-TABLE "Table 9.54. Array Functions") and `array_shuffle()` (Martin Kalcher) [§](https://postgr.es/c/888f2ea0a) +* Add aggregate function [`ANY_VALUE()`](functions-aggregate.html#FUNCTIONS-AGGREGATE-TABLE "Table 9.59. General-Purpose Aggregate Functions") which returns any value from a set (Vik Fearing) [§](https://postgr.es/c/2ddab010c) +* Add function [`random_normal()`](functions-math.html#FUNCTIONS-MATH-RANDOM-TABLE "Table 9.6. Random Functions") to supply normally-distributed random numbers (Paul Ramsey) [§](https://postgr.es/c/38d81760c) +* Add error function [`erf()`](functions-math.html#FUNCTIONS-MATH-FUNC-TABLE "Table 9.5. Mathematical Functions") and its complement `erfc()` (Dean Rasheed) [§](https://postgr.es/c/d5d574146) +* Improve the accuracy of numeric [`power()`](functions-math.html#FUNCTIONS-MATH-FUNC-TABLE "Table 9.5. Mathematical Functions") for integer exponents (Dean Rasheed) [§](https://postgr.es/c/40c7fcbbe) +* Add [`XMLSERIALIZE()`](datatype-xml.html#DATATYPE-XML-CREATING "8.13.1. Creating XML Values") option `INDENT` to pretty-print its output (Jim Jones) [§](https://postgr.es/c/483bdb2af) +* Change [`pg_collation_actual_version()`](functions-admin.html#FUNCTIONS-ADMIN-COLLATION "Table 9.98. Collation Management Functions") to return a reasonable value for the default collation (Jeff Davis) [§](https://postgr.es/c/10932ed5e) + + Previously it returned `NULL`. +* Allow [`pg_read_file()`](functions-admin.html#FUNCTIONS-ADMIN-GENFILE-TABLE "Table 9.101. Generic File Access Functions") and `pg_read_binary_file()` to ignore missing files (Kyotaro Horiguchi) [§](https://postgr.es/c/283129e32) +* Add byte specification (`B`) to [`pg_size_bytes()`](functions-admin.html#FUNCTIONS-ADMIN-DBSIZE "Table 9.96. Database Object Size Functions") (Peter Eisentraut) [§](https://postgr.es/c/ce1215d9b) +* Allow [`to_reg`](functions-info.html#FUNCTIONS-INFO-CATALOG-TABLE "Table 9.72. System Catalog Information Functions")\* functions to accept numeric OIDs as input (Tom Lane) [§](https://postgr.es/c/3ea7329c9) + +#### E.12.3.7. [PL/pgSQL](plpgsql.html "Chapter 43. PL/pgSQL — SQL Procedural Language") [#](#RELEASE-16-PLPGSQL) + +* Add the ability to get the current function's OID in PL/pgSQL (Pavel Stehule) [§](https://postgr.es/c/d3d53f955) + + This is accomplished with [`GET DIAGNOSTICS variable = PG_ROUTINE_OID`](plpgsql-statements.html#PLPGSQL-STATEMENTS-DIAGNOSTICS "43.5.5. Obtaining the Result Status"). + +#### E.12.3.8. [libpq](libpq.html "Chapter 34. libpq — C Library") [#](#RELEASE-16-LIBPQ) + +* Add libpq connection option [`require_auth`](libpq-connect.html#LIBPQ-CONNECT-REQUIRE-AUTH) to specify a list of acceptable authentication methods (Jacob Champion) [§](https://postgr.es/c/3a465cc67) + + This can also be used to disallow certain authentication methods. +* Allow multiple libpq-specified hosts to be randomly selected (Jelte Fennema) [§](https://postgr.es/c/7f5b19817) [§](https://postgr.es/c/0a16512d4) + + This is enabled with [`load_balance_hosts=random`](libpq-connect.html#LIBPQ-CONNECT-LOAD-BALANCE-HOSTS) and can be used for load balancing. +* Add libpq option [`sslcertmode`](libpq-connect.html#LIBPQ-CONNECT-SSLCERTMODE) to control transmission of the client certificate (Jacob Champion) [§](https://postgr.es/c/36f40ce2d) + + The option values are `disable`, `allow`, and `require`. +* Allow libpq to use the system certificate pool for certificate verification (Jacob Champion, Thomas Habets) [§](https://postgr.es/c/8eda73146) + + This is enabled with [`sslrootcert=system`](libpq-connect.html#LIBPQ-CONNECT-SSLROOTCERT), which also enables [`sslmode=verify-full`](libpq-connect.html#LIBPQ-CONNECT-SSLMODE). + +#### E.12.3.9. Client Applications [#](#RELEASE-16-CLIENT-APPS) + +* Allow [`ECPG`](ecpg.html "Chapter 36. ECPG — Embedded SQL in C") variable declarations to use typedef names that match unreserved SQL keywords (Tom Lane) [§](https://postgr.es/c/83f1c7b74) + + This change does prevent keywords which match C typedef names from being processed as keywords in later `EXEC SQL` blocks. + +##### E.12.3.9.1. [psql](app-psql.html "psql") [#](#RELEASE-16-PSQL) + +* Allow psql to control the maximum width of header lines in expanded format (Platon Pronko) [§](https://postgr.es/c/a45388d6e) + + This is controlled by [`xheader_width`](app-psql.html#APP-PSQL-META-COMMAND-PSET-XHEADER-WIDTH). +* Add psql command [`\drg`](app-psql.html#APP-PSQL-META-COMMAND-DRG) to show role membership details (Pavel Luzanov) [§](https://postgr.es/c/d913928c9) [§](https://postgr.es/c/d65ddaca9) + + The `Member of` output column has been removed from `\du` and `\dg` because this new command displays this information in more detail. +* Allow psql's access privilege commands to show system objects (Nathan Bossart) [§](https://postgr.es/c/d913928c9) [§](https://postgr.es/c/d65ddaca9) + + The options are [`\dpS`](app-psql.html#APP-PSQL-META-COMMAND-DP-LC) and [`\zS`](app-psql.html#APP-PSQL-META-COMMAND-Z). +* Add `FOREIGN` designation to psql [`\d+`](app-psql.html#APP-PSQL-META-COMMAND-D) for foreign table children and partitions (Ian Lawrence Barwick) [§](https://postgr.es/c/bd95816f7) +* Prevent [`\df+`](app-psql.html#APP-PSQL-META-COMMAND-DF-UC) from showing function source code (Isaac Morland) [§](https://postgr.es/c/3dfae91f7) + + Function bodies are more easily viewed with [`\sf`](app-psql.html#APP-PSQL-META-COMMAND-SF). +* Allow psql to submit queries using the extended query protocol (Peter Eisentraut) [§](https://postgr.es/c/5b66de343) + + Passing arguments to such queries is done using the new psql [`\bind`](app-psql.html#APP-PSQL-META-COMMAND-BIND) command. +* Allow psql [`\watch`](app-psql.html#APP-PSQL-META-COMMAND-WATCH) to limit the number of executions (Andrey Borodin) [§](https://postgr.es/c/00beecfe8) + + The `\watch` options can now be named when specified. +* Detect invalid values for psql [`\watch`](app-psql.html#APP-PSQL-META-COMMAND-WATCH), and allow zero to specify no delay (Andrey Borodin) [§](https://postgr.es/c/6f9ee74d4) +* Allow psql scripts to obtain the exit status of shell commands and queries (Corey Huinker, Tom Lane) [§](https://postgr.es/c/b0d8f2d98) [§](https://postgr.es/c/31ae2aa9d) + + The new psql control variables are [`SHELL_ERROR`](app-psql.html#APP-PSQL-VARIABLES-SHELL-ERROR) and [`SHELL_EXIT_CODE`](app-psql.html#APP-PSQL-VARIABLES-SHELL-EXIT-CODE). +* Various psql tab completion improvements (Vignesh C, Aleksander Alekseev, Dagfinn Ilmari Mannsåker, Shi Yu, Michael Paquier, Ken Kato, Peter Smith) [§](https://postgr.es/c/f6c750d31) [§](https://postgr.es/c/4cbe57974) [§](https://postgr.es/c/6afcab6ac) [§](https://postgr.es/c/9aa58d48f) [§](https://postgr.es/c/3cf2f7af7) [§](https://postgr.es/c/2ea5de296) [§](https://postgr.es/c/07f7237c2) [§](https://postgr.es/c/9d0cf5749) [§](https://postgr.es/c/a3bc631ea) [§](https://postgr.es/c/2ff5ca86e) [§](https://postgr.es/c/9e1e9d656) [§](https://postgr.es/c/96c498d2f) + +##### E.12.3.9.2. [pg\_dump](app-pgdump.html "pg_dump") [#](#RELEASE-16-PGDUMP) + +* Add pg\_dump control of dumping child tables and partitions (Gilles Darold) [§](https://postgr.es/c/a563c24c9) + + The new options are `--table-and-children`, `--exclude-table-and-children`, and `--exclude-table-data-and-children`. +* Add LZ4 and Zstandard compression to pg\_dump (Georgios Kokolatos, Justin Pryzby) +* Allow pg\_dump and [pg\_basebackup](app-pgbasebackup.html "pg_basebackup") to use `long` mode for compression (Justin Pryzby) [§](https://postgr.es/c/0da243fed) [§](https://postgr.es/c/0070b66fe) [§](https://postgr.es/c/84adc8e20) [§](https://postgr.es/c/2820adf77) +* Improve pg\_dump to accept a more consistent compression syntax (Georgios Kokolatos) [§](https://postgr.es/c/5e73a6048) + + Options like `--compress=gzip:5`. + +#### E.12.3.10. Server Applications [#](#RELEASE-16-SERVER-APPS) + +* Add [initdb](app-initdb.html "initdb") option to set server variables for the duration of initdb and all future server starts (Tom Lane) [§](https://postgr.es/c/3e51b278d) + + The option is `-c name=value`. +* Add options to [createuser](app-createuser.html "createuser") to control more user options (Shinya Kato) [§](https://postgr.es/c/08951a7c9) [§](https://postgr.es/c/2dcd1578c) + + Specifically, the new options control the valid-until date, bypassing of row-level security, and role membership. +* Deprecate [createuser](app-createuser.html "createuser") option `--role` (Nathan Bossart) [§](https://postgr.es/c/2dcd1578c) [§](https://postgr.es/c/381d19b3e) + + This option could be easily confused with new createuser role membership options, so option `--member-of` has been added with the same functionality. The `--role` option can still be used. +* Allow control of [vacuumdb](app-vacuumdb.html "vacuumdb") schema processing (Gilles Darold) [§](https://postgr.es/c/7781f4e3e) + + These are controlled by options `--schema` and `--exclude-schema`. +* Use new [`VACUUM`](sql-vacuum.html "VACUUM") options to improve the performance of [vacuumdb](app-vacuumdb.html "vacuumdb") (Tom Lane, Nathan Bossart) [§](https://postgr.es/c/a46a7011b) +* Have [pg\_upgrade](pgupgrade.html "pg_upgrade") set the new cluster's locale and encoding (Jeff Davis) [§](https://postgr.es/c/9637badd9) + + This removes the requirement that the new cluster be created with the same locale and encoding settings. +* Add [pg\_upgrade](pgupgrade.html "pg_upgrade") option to specify the default transfer mode (Peter Eisentraut) [§](https://postgr.es/c/746915c68) + + The option is `--copy`. +* Improve [pg\_basebackup](app-pgbasebackup.html "pg_basebackup") to accept numeric compression options (Georgios Kokolatos, Michael Paquier) [§](https://postgr.es/c/d18655cc0) + + Options like `--compress=server-5` are now supported. +* Fix [pg\_basebackup](app-pgbasebackup.html "pg_basebackup") to handle tablespaces stored in the `PGDATA` directory (Robert Haas) [§](https://postgr.es/c/363e8f911) +* Add [pg\_waldump](pgwaldump.html "pg_waldump") option `--save-fullpage` to dump full page images (David Christensen) [§](https://postgr.es/c/d497093cb) +* Allow [pg\_waldump](pgwaldump.html "pg_waldump") options `-t`/`--timeline` to accept hexadecimal values (Peter Eisentraut) [§](https://postgr.es/c/4c8044c04) +* Add support for progress reporting to [pg\_verifybackup](app-pgverifybackup.html "pg_verifybackup") (Masahiko Sawada) [§](https://postgr.es/c/d07c2948b) +* Allow [pg\_rewind](app-pgrewind.html "pg_rewind") to properly track timeline changes (Heikki Linnakangas) [§](https://postgr.es/c/009eeee74) [§](https://postgr.es/c/0a0500207) + + Previously if pg\_rewind was run after a timeline switch but before a checkpoint was issued, it might incorrectly determine that a rewind was unnecessary. +* Have [pg\_receivewal](app-pgreceivewal.html "pg_receivewal") and [pg\_recvlogical](app-pgrecvlogical.html "pg_recvlogical") cleanly exit on `SIGTERM` (Christoph Berg) [§](https://postgr.es/c/8b60db774) + + This signal is often used by systemd. + +#### E.12.3.11. Source Code [#](#RELEASE-16-SOURCE-CODE) + +* Build ICU support by default (Jeff Davis) [§](https://postgr.es/c/fcb21b3ac) + + This removes [build flag](installation.html "Chapter 17. Installation from Source Code") `--with-icu` and adds flag `--without-icu`. +* Add support for SSE2 (Streaming SIMD Extensions 2) vector operations on x86-64 architectures (John Naylor) [§](https://postgr.es/c/56f2c7b58) +* Add support for Advanced SIMD (Single Instruction Multiple Data) (NEON) instructions on ARM architectures (Nathan Bossart) [§](https://postgr.es/c/82739d4a8) +* Have Windows binaries built with MSVC use `RandomizedBaseAddress` (ASLR) (Michael Paquier) [§](https://postgr.es/c/36389a060) + + This was already enabled on MinGW builds. +* Prevent extension libraries from exporting their symbols by default (Andres Freund, Tom Lane) [§](https://postgr.es/c/089480c07) [§](https://postgr.es/c/8cf64d35e) + + Functions that need to be called from the core backend or other extensions must now be explicitly marked `PGDLLEXPORT`. +* Require Windows 10 or newer versions (Michael Paquier, Juan José Santamaría Flecha) [§](https://postgr.es/c/495ed0ef2) + + Previously Windows Vista and Windows XP were supported. +* Require Perl version 5.14 or later (John Naylor) [§](https://postgr.es/c/4c1532763) +* Require Bison version 2.3 or later (John Naylor) [§](https://postgr.es/c/b086a47a2) +* Require Flex version 2.5.35 or later (John Naylor) [§](https://postgr.es/c/8b878bffa) +* Require MIT Kerberos for GSSAPI support (Stephen Frost) [§](https://postgr.es/c/f7431bca8) +* Remove support for Visual Studio 2013 (Michael Paquier) [§](https://postgr.es/c/6203583b7) +* Remove support for HP-UX (Thomas Munro) [§](https://postgr.es/c/9db300ce6) +* Remove support for HP/Intel Itanium (Thomas Munro) [§](https://postgr.es/c/0ad5b48e5) +* Remove support for M68K, M88K, M32R, and SuperH CPU architectures (Thomas Munro) [§](https://postgr.es/c/718aa43a4) [§](https://postgr.es/c/14168d3c6) +* Remove [libpq](libpq.html "Chapter 34. libpq — C Library") support for SCM credential authentication (Michael Paquier) [§](https://postgr.es/c/98ae2c84a) + + Backend support for this authentication method was removed in PostgresSQL 9.1. +* Add [meson](install-meson.html "17.4. Building and Installation with Meson") build system (Andres Freund, Nazir Bilal Yavuz, Peter Eisentraut) [§](https://postgr.es/c/e6927270c) + + This eventually will replace the Autoconf and Windows-based MSVC build systems. +* Allow control of the location of the openssl binary used by the build system (Peter Eisentraut) [§](https://postgr.es/c/c8e4030d1) + + Make finding openssl program a configure or meson option +* Add build option to allow testing of small table segment sizes (Andres Freund) [§](https://postgr.es/c/d3b111e32) + + The build options are [`--with-segsize-blocks`](install-make.html#CONFIGURE-OPTION-WITH-SEGSIZE) and `-Dsegsize_blocks`. +* Add [pgindent](source.html "Chapter 56. PostgreSQL Coding Conventions") options (Andrew Dunstan) [§](https://postgr.es/c/b90f0b574) [§](https://postgr.es/c/62e1e28bf) [§](https://postgr.es/c/124937163) [§](https://postgr.es/c/a1c4cd6f2) [§](https://postgr.es/c/068a243b7) [§](https://postgr.es/c/dab07e8c6) [§](https://postgr.es/c/b16259b3c) + + The new options are `--show-diff`, `--silent-diff`, `--commit`, and `--help`, and allow multiple `--exclude` options. Also require the typedef file to be explicitly specified. Options `--code-base` and `--build` were also removed. +* Add [pg\_bsd\_indent](source.html "Chapter 56. PostgreSQL Coding Conventions") source code to the main tree (Tom Lane) [§](https://postgr.es/c/4e831f4ce) +* Improve make\_ctags and make\_etags (Yugo Nagata) [§](https://postgr.es/c/d1e2a380c) +* Adjust [`pg_attribute`](catalog-pg-attribute.html "53.7. pg_attribute") columns for efficiency (Peter Eisentraut) [§](https://postgr.es/c/90189eefc) + +#### E.12.3.12. Additional Modules [#](#RELEASE-16-MODULES) + +* Improve use of extension-based indexes on boolean columns (Zongliang Quan, Tom Lane) [§](https://postgr.es/c/ff720a597) +* Add support for Daitch-Mokotoff Soundex to [fuzzystrmatch](fuzzystrmatch.html "F.17. fuzzystrmatch — determine string similarities and distance") (Dag Lem) [§](https://postgr.es/c/a290378a3) +* Allow [auto\_explain](auto-explain.html "F.4. auto_explain — log execution plans of slow queries") to log values passed to parameterized statements (Dagfinn Ilmari Mannsåker) [§](https://postgr.es/c/d4bfe4128) + + This affects queries using server-side [`PREPARE`](sql-prepare.html "PREPARE")/[`EXECUTE`](sql-execute.html "EXECUTE") and client-side parse/bind. Logging is controlled by [`auto_explain.log_parameter_max_length`](auto-explain.html#AUTO-EXPLAIN-CONFIGURATION-PARAMETERS-LOG-PARAMETER-MAX-LENGTH); by default query parameters will be logged with no length restriction. +* Have [auto\_explain](auto-explain.html "F.4. auto_explain — log execution plans of slow queries")'s `log_verbose` mode honor the value of [`compute_query_id`](runtime-config-statistics.html#GUC-COMPUTE-QUERY-ID) (Atsushi Torikoshi) [§](https://postgr.es/c/9d2d9728b) + + Previously even if `compute_query_id` was enabled, [`log_verbose`](auto-explain.html#AUTO-EXPLAIN-CONFIGURATION-PARAMETERS-LOG-VERBOSE) was not showing the query identifier. +* Change the maximum length of [ltree](ltree.html "F.23. ltree — hierarchical tree-like data type") labels from 256 to 1000 and allow hyphens (Garen Torikian) [§](https://postgr.es/c/b1665bf01) +* Have [`pg_stat_statements`](pgstatstatements.html "F.32. pg_stat_statements — track statistics of SQL planning and execution") normalize constants used in utility commands (Michael Paquier) [§](https://postgr.es/c/daa8365a9) + + Previously constants appeared instead of placeholders, e.g., `$1`. +* Add [pg\_walinspect](pgwalinspect.html "F.37. pg_walinspect — low-level WAL inspection") function [`pg_get_wal_block_info()`](pgwalinspect.html#PGWALINSPECT-FUNCS-PG-GET-WAL-BLOCK-INFO) to report WAL block information (Michael Paquier, Melanie Plageman, Bharath Rupireddy) [§](https://postgr.es/c/c31cf1c03) [§](https://postgr.es/c/9ecb134a9) [§](https://postgr.es/c/122376f02) [§](https://postgr.es/c/df4f3ab51) +* Change how [pg\_walinspect](pgwalinspect.html "F.37. pg_walinspect — low-level WAL inspection") functions [`pg_get_wal_records_info()`](pgwalinspect.html#PGWALINSPECT-FUNCS-PG-GET-WAL-RECORDS-INFO) and [`pg_get_wal_stats()`](pgwalinspect.html#PGWALINSPECT-FUNCS-PG-GET-WAL-STATS) interpret ending LSNs (Bharath Rupireddy) [§](https://postgr.es/c/5c1b66280) + + Previously ending LSNs which represent nonexistent WAL locations would generate an error, while they will now be interpreted as the end of the WAL. +* Add detailed descriptions of WAL records in [pg\_walinspect](pgwalinspect.html "F.37. pg_walinspect — low-level WAL inspection") and [pg\_waldump](pgwaldump.html "pg_waldump") (Melanie Plageman, Peter Geoghegan) [§](https://postgr.es/c/7d8219a44) [§](https://postgr.es/c/1c453cfd8) [§](https://postgr.es/c/96149a180) [§](https://postgr.es/c/50547a3fa) +* Add [pageinspect](pageinspect.html "F.25. pageinspect — low-level inspection of database pages") function [`bt_multi_page_stats()`](pageinspect.html#PAGEINSPECT-B-TREE-FUNCS "F.25.3. B-Tree Functions") to report statistics on multiple pages (Hamid Akhtar) [§](https://postgr.es/c/1fd3dd204) + + This is similar to `bt_page_stats()` except it can report on a range of pages. +* Add empty range output column to [pageinspect](pageinspect.html "F.25. pageinspect — low-level inspection of database pages") function [`brin_page_items()`](pageinspect.html#PAGEINSPECT-BRIN-FUNCS "F.25.4. BRIN Functions") (Tomas Vondra) [§](https://postgr.es/c/1fd3dd204) +* Redesign archive modules to be more flexible (Nathan Bossart) [§](https://postgr.es/c/35739b87d) + + Initialization changes will require modules written for older versions of Postgres to be updated. +* Correct inaccurate [pg\_stat\_statements](pgstatstatements.html "F.32. pg_stat_statements — track statistics of SQL planning and execution") row tracking extended query protocol statements (Sami Imseih) [§](https://postgr.es/c/1d477a907) +* Add [pg\_buffercache](pgbuffercache.html "F.27. pg_buffercache — inspect PostgreSQL buffer cache state") function `pg_buffercache_usage_counts()` to report usage totals (Nathan Bossart) [§](https://postgr.es/c/f3fa31327) +* Add [pg\_buffercache](pgbuffercache.html "F.27. pg_buffercache — inspect PostgreSQL buffer cache state") function `pg_buffercache_summary()` to report summarized buffer statistics (Melih Mutlu) [§](https://postgr.es/c/2589434ae) +* Allow the schemas of required extensions to be referenced in extension scripts using the new syntax `@extschema:referenced_extension_name@` (Regina Obe) [§](https://postgr.es/c/72a5b1fc8) +* Allow required extensions to be marked as non-relocatable using [`no_relocate`](extend-extensions.html#EXTEND-EXTENSIONS-FILES-NO-RELOCATE) (Regina Obe) [§](https://postgr.es/c/72a5b1fc8) + + This allows `@extschema:referenced_extension_name@` to be treated as a constant for the lifetime of the extension. + +##### E.12.3.12.1. [postgres\_fdw](postgres-fdw.html "F.38. postgres_fdw — access data stored in external PostgreSQL servers") [#](#RELEASE-16-PGFDW) + +* Allow postgres\_fdw to do aborts in parallel (Etsuro Fujita) [§](https://postgr.es/c/983ec2300) + + This is enabled with postgres\_fdw option [`parallel_abort`](postgres-fdw.html#POSTGRES-FDW-OPTIONS-TRANSACTION-MANAGEMENT "F.38.1.6. Transaction Management Options"). +* Make [`ANALYZE`](sql-analyze.html "ANALYZE") on foreign postgres\_fdw tables more efficient (Tomas Vondra) [§](https://postgr.es/c/8ad51b5f4) + + The postgres\_fdw option [`analyze_sampling`](postgres-fdw.html#POSTGRES-FDW-OPTIONS-COST-ESTIMATION "F.38.1.3. Cost Estimation Options") controls the sampling method. +* Restrict shipment of [`reg`](datatype-oid.html "8.19. Object Identifier Types")\* type constants in postgres\_fdw to those referencing built-in objects or extensions marked as shippable (Tom Lane) [§](https://postgr.es/c/31e5b5029) +* Have postgres\_fdw and [dblink](dblink.html "F.12. dblink — connect to other PostgreSQL databases") handle interrupts during connection establishment (Andres Freund) [§](https://postgr.es/c/e4602483e) + +### E.12.4. Acknowledgments [#](#RELEASE-16-ACKNOWLEDGEMENTS) + +The following individuals (in alphabetical order) have contributed to this release as patch authors, committers, reviewers, testers, or reporters of issues. + +| | +| --- | +| Abhijit Menon-Sen | +| Adam Mackler | +| Adrian Klaver | +| Ahsan Hadi | +| Ajin Cherian | +| Ajit Awekar | +| Alan Hodgson | +| Aleksander Alekseev | +| Alex Denman | +| Alex Kozhemyakin | +| Alexander Korolev | +| Alexander Korotkov | +| Alexander Lakhin | +| Alexander Pyhalov | +| Alexey Borzov | +| Alexey Ermakov | +| Alexey Makhmutov | +| Álvaro Herrera | +| Amit Kapila | +| Amit Khandekar | +| Amit Langote | +| Amul Sul | +| Anastasia Lubennikova | +| Anban Company | +| Andreas Dijkman | +| Andreas Karlsson | +| Andreas Scherbaum | +| Andrei Zubkov | +| Andres Freund | +| Andrew Alsup | +| Andrew Bille | +| Andrew Dunstan | +| Andrew Gierth | +| Andrew Kesper | +| Andrey Borodin | +| Andrey Lepikhov | +| Andrey Sokolov | +| Ankit Kumar Pandey | +| Ante Kresic | +| Anton Melnikov | +| Anton Sidyakin | +| Anton Voloshin | +| Antonin Houska | +| Arne Roland | +| Artem Anisimov | +| Arthur Zakirov | +| Ashutosh Bapat | +| Ashutosh Sharma | +| Asim Praveen | +| Atsushi Torikoshi | +| Ayaki Tachikake | +| Balazs Szilfai | +| Benoit Lobréau | +| Bernd Helmle | +| Bertrand Drouvot | +| Bharath Rupireddy | +| Bilva Sanaba | +| Bob Krier | +| Boris Zentner | +| Brad Nicholson | +| Brar Piening | +| Bruce Momjian | +| Bruno da Silva | +| Carl Sopchak | +| Cary Huang | +| Changhong Fei | +| Chris Travers | +| Christoph Berg | +| Christophe Pettus | +| Corey Huinker | +| Craig Ringer | +| Curt Kolovson | +| Dag Lem | +| Dagfinn Ilmari Mannsåker | +| Daniel Gustafsson | +| Daniel Vérité | +| Daniel Watzinger | +| Daniel Westermann | +| Daniele Varrazzo | +| Daniil Anisimov | +| Danny Shemesh | +| Dave Page | +| David Christensen | +| David G. Johnston | +| David Geier | +| David Gilman | +| David Kimura | +| David Rowley | +| David Steele | +| David Turon | +| David Zhang | +| Davinder Singh | +| Dean Rasheed | +| Denis Laxalde | +| Dilip Kumar | +| Dimos Stamatakis | +| Dmitriy Kuzmin | +| Dmitry Astapov | +| Dmitry Dolgov | +| Dmitry Koval | +| Dong Wook Lee | +| Dongming Liu | +| Drew DeVault | +| Duncan Sands | +| Ed Maste | +| Egor Chindyaskin | +| Ekaterina Kiryanova | +| Elena Indrupskaya | +| Emmanuel Quincerot | +| Eric Mutta | +| Erik Rijkers | +| Erki Eessaar | +| Erwin Brandstetter | +| Etsuro Fujita | +| Eugeny Zhuzhnev | +| Euler Taveira | +| Evan Jones | +| Evgeny Morozov | +| Fabrízio de Royes Mello | +| Farias de Oliveira | +| Florin Irion | +| Franz-Josef Färber | +| Garen Torikian | +| Georgios Kokolatos | +| Gilles Darold | +| Greg Stark | +| Guillaume Lelarge | +| Gunnar Bluth | +| Gunnar Morling | +| Gurjeet Singh | +| Haiyang Wang | +| Haiying Tang | +| Hamid Akhtar | +| Hans Buschmann | +| Hao Wu | +| Hayato Kuroda | +| Heath Lord | +| Heikki Linnakangas | +| Himanshu Upadhyaya | +| Hisahiro Kauchi | +| Hongyu Song | +| Hubert Lubaczewski | +| Hung Nguyen | +| Ian Barwick | +| Ibrar Ahmed | +| Ilya Gladyshev | +| Ilya Nenashev | +| Isaac Morland | +| Israel Barth Rubio | +| Jacob Champion | +| Jacob Speidel | +| Jaime Casanova | +| Jakub Wartak | +| James Coleman | +| James Inform | +| James Vanns | +| Jan Wieck | +| Japin Li | +| Jeevan Ladhe | +| Jeff Davis | +| Jeff Janes | +| Jehan-Guillaume de Rorthais | +| Jelte Fennema | +| Jian He | +| Jim Jones | +| Jinbao Chen | +| Joe Conway | +| Joel Jacobson | +| John Naylor | +| Jonathan Katz | +| Josef Simanek | +| Joseph Koshakow | +| Juan José Santamaría Flecha | +| Julien Rouhaud | +| Julien Roze | +| Junwang Zhao | +| Justin Pryzby | +| Justin Zhang | +| Karina Litskevich | +| Karl O. Pinc | +| Keisuke Kuroda | +| Ken Kato | +| Kevin McKibbin | +| Kieran McCusker | +| Kirk Wolak | +| Konstantin Knizhnik | +| Koshi Shibagaki | +| Kotaro Kawamoto | +| Kui Liu | +| Kyotaro Horiguchi | +| Lakshmi Narayanan Sreethar | +| Laurence Parry | +| Laurenz Albe | +| Luca Ferrari | +| Lukas Fittl | +| Maciek Sakrejda | +| Magnus Hagander | +| Maja Zaloznik | +| Marcel Hofstetter | +| Marina Polyakova | +| Mark Dilger | +| Marko Tiikkaja | +| Markus Winand | +| Martijn van Oosterhout | +| Martin Jurca | +| Martin Kalcher | +| Mary Xu | +| Masahiko Sawada | +| Masahiro Ikeda | +| Masao Fujii | +| Mason Sharp | +| Matheus Alcantara | +| Mats Kindahl | +| Matthias van de Meent | +| Matthijs van der Vleuten | +| Maxim Orlov | +| Maxim Yablokov | +| Mehmet Emin Karakas | +| Melanie Plageman | +| Melih Mutlu | +| Micah Gates | +| Michael Banck | +| Michael Paquier | +| Michail Nikolaev | +| Michel Pelletier | +| Mike Oh | +| Mikhail Gribkov | +| Mingli Zhang | +| Miroslav Bendik | +| Mitsuru Hinata | +| Myo Wai Thant | +| Naeem Akhter | +| Naoki Okano | +| Nathan Bossart | +| Nazir Bilal Yavuz | +| Neha Sharma | +| Nick Babadzhanian | +| Nicola Contu | +| Nikhil Shetty | +| Nikita Glukhov | +| Nikolay Samokhvalov | +| Nikolay Shaplov | +| Nishant Sharma | +| Nitin Jadhav | +| Noah Misch | +| Noboru Saito | +| Noriyoshi Shinoda | +| Nuko Yokohama | +| Oleg Bartunov | +| Oleg Tselebrovskiy | +| Olly Betts | +| Onder Kalaci | +| Onur Tirtir | +| Pablo Federico | +| Palle Girgensohn | +| Paul Guo | +| Paul Jungwirth | +| Paul Ramsey | +| Pavel Borisov | +| Pavel Kulakov | +| Pavel Luzanov | +| Pavel Stehule | +| Peifeng Qiu | +| Peter Eisentraut | +| Peter Geoghegan | +| Peter Smith | +| Phil Florent | +| Philippe Godfrin | +| Platon Pronko | +| Przemyslaw Sztoch | +| Rachel Heaton | +| Ranier Vilela | +| Regina Obe | +| Reid Thompson | +| Reiner Peterke | +| Richard Guo | +| Riivo Kolka | +| Rishu Bagga | +| Robert Haas | +| Robert Sjöblom | +| Robert Treat | +| Roberto Mello | +| Robins Tharakan | +| Roman Zharkov | +| Ronan Dunklau | +| Rushabh Lathia | +| Ryo Matsumura | +| Samay Sharma | +| Sami Imseih | +| Sandeep Thakkar | +| Sandro Santilli | +| Sebastien Flaesch | +| Sébastien Lardière | +| Sehrope Sarkuni | +| Sergey Belyashov | +| Sergey Pankov | +| Sergey Shinderuk | +| Shi Yu | +| Shinya Kato | +| Sho Kato | +| Shruthi Gowda | +| Shveta Mallik | +| Simon Riggs | +| Sindy Senorita | +| Sirisha Chamarthi | +| Sravan Kumar | +| Stéphane Tachoires | +| Stephen Frost | +| Steve Chavez | +| Stone Tickle | +| Sven Klemm | +| Takamichi Osumi | +| Takeshi Ideriha | +| Tatsuhiro Nakamori | +| Tatsuo Ishii | +| Teja Mupparti | +| Tender Wang | +| Teodor Sigaev | +| Thiago Nunes | +| Thom Brown | +| Thomas Habets | +| Thomas Mc Kay | +| Thomas Munro | +| Tim Carey-Smith | +| Tim Field | +| Timo Stolz | +| Tom Lane | +| Tomas Vondra | +| Tor Erik Linnerud | +| Torsten Förtsch | +| Tristan Partin | +| Troy Frericks | +| Tushar Ahuja | +| Valerie Woolard | +| Vibhor Kumar | +| Victor Spirin | +| Victoria Shepard | +| Vignesh C | +| Vik Fearing | +| Vitaly Burovoy | +| Vitaly Davydov | +| Wang Wei | +| Wenjing Zeng | +| Whale Song | +| Will Mortensen | +| Wolfgang Walther | +| Xin Wen | +| Xing Guo | +| Xingwang Xu | +| XueJing Zhao | +| Yanliang Lei | +| Youmiu Mo | +| Yugo Nagata | +| Yura Sokolov | +| Yuta Katsuragi | +| Zhen Mingyang | +| Zheng Li | +| Zhihong Yu | +| Zhijie Hou | +| Zongliang Quan | +| Zuming Jiang | + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-16-1.html "E.11. Release 16.1") | [Up](release.html "Appendix E. Release Notes") | [Next](release-prior.html "E.13. Prior Releases") | +| E.11. Release 16.1 | [Home](index.html "PostgreSQL 16.11 Documentation") | E.13. Prior Releases | + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/16.1/) diff --git a/corpus/changelog/postgresql_releases/postgresql_161.md b/corpus/changelog/postgresql_releases/postgresql_161.md new file mode 100644 index 0000000000000000000000000000000000000000..ecba16e8b37c5fc5d06d97cd492c566e5b3f0a5e --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_161.md @@ -0,0 +1,195 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/16.1/ +Version: 16.1 + +## PostgreSQL 16.1 + +| E.11. Release 16.1 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-16-2.html "E.10. Release 16.2") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 16.11 Documentation") | [Next](release-16.html "E.12. Release 16") | + +--- + +## E.11. Release 16.1 [#](#RELEASE-16-1) + +[E.11.1. Migration to Version 16.1](release-16-1.html#RELEASE-16-1-MIGRATION) + +[E.11.2. Changes](release-16-1.html#RELEASE-16-1-CHANGES) + +**Release date:**2023-11-09 + +This release contains a variety of fixes from 16.0. For information about new features in major release 16, see [Section E.12](release-16.html "E.12. Release 16"). + +### E.11.1. Migration to Version 16.1 [#](#RELEASE-16-1-MIGRATION) + +A dump/restore is not required for those running 16.X. + +However, several mistakes have been discovered that could lead to certain types of indexes yielding wrong search results or being unnecessarily inefficient. It is advisable to `REINDEX` potentially-affected indexes after installing this update. See the fourth through seventh changelog entries below. + +### E.11.2. Changes [#](#RELEASE-16-1-CHANGES) + +* Fix handling of unknown-type arguments in `DISTINCT` `"any"` aggregate functions (Tom Lane) [§](https://postgr.es/c/d3d1e2509) + + This error led to a `text`-type value being interpreted as an `unknown`-type value (that is, a zero-terminated string) at runtime. This could result in disclosure of server memory following the `text` value. + + The PostgreSQL Project thanks Jingzhou Fu for reporting this problem. (CVE-2023-5868) +* Detect integer overflow while computing new array dimensions (Tom Lane) [§](https://postgr.es/c/e24daa94b) + + When assigning new elements to array subscripts that are outside the current array bounds, an undetected integer overflow could occur in edge cases. Memory stomps that are potentially exploitable for arbitrary code execution are possible, and so is disclosure of server memory. + + The PostgreSQL Project thanks Pedro Gallegos for reporting this problem. (CVE-2023-5869) +* Prevent the `pg_signal_backend` role from signalling background workers and autovacuum processes (Noah Misch, Jelte Fennema-Nio) [§](https://postgr.es/c/785412731) [§](https://postgr.es/c/2c3c5ec49) + + The documentation says that `pg_signal_backend` cannot issue signals to superuser-owned processes. It was able to signal these background processes, though, because they advertise a role OID of zero. Treat that as indicating superuser ownership. The security implications of cancelling one of these process types are fairly small so far as the core code goes (we'll just start another one), but extensions might add background workers that are more vulnerable. + + Also ensure that the `is_superuser` parameter is set correctly in such processes. No specific security consequences are known for that oversight, but it might be significant for some extensions. + + The PostgreSQL Project thanks Hemanth Sandrana and Mahendrakar Srinivasarao for reporting this problem. (CVE-2023-5870) +* Fix misbehavior during recursive page split in GiST index build (Heikki Linnakangas) [§](https://postgr.es/c/d7f521325) + + Fix a case where the location of a page downlink was incorrectly tracked, and introduce some logic to allow recovering from such situations rather than silently doing the wrong thing. This error could result in incorrect answers from subsequent index searches. It may be advisable to reindex all GiST indexes after installing this update. +* Prevent de-duplication of btree index entries for `interval` columns (Noah Misch) [§](https://postgr.es/c/bf1c21c4f) + + There are `interval` values that are distinguishable but compare equal, for example `24:00:00` and `1 day`. This breaks assumptions made by btree de-duplication, so `interval` columns need to be excluded from de-duplication. This oversight can cause incorrect results from index-only scans. Moreover, after updating amcheck will report an error for almost all such indexes. Users should reindex any btree indexes on `interval` columns. +* Process `date` values more sanely in BRIN `datetime_minmax_multi_ops` indexes (Tomas Vondra) [§](https://postgr.es/c/e7965226d) + + The distance calculation for dates was backward, causing poor decisions about which entries to merge. The index still produces correct results, but is much less efficient than it should be. Reindexing BRIN `minmax_multi` indexes on `date` columns is advisable. +* Process large `timestamp` and `timestamptz` values more sanely in BRIN `datetime_minmax_multi_ops` indexes (Tomas Vondra) [§](https://postgr.es/c/497fc9208) [§](https://postgr.es/c/0635fe02b) + + Infinities were mistakenly treated as having distance zero rather than a large distance from other values, causing poor decisions about which entries to merge. Also, finite-but-very-large values (near the endpoints of the representable timestamp range) could result in internal overflows, again causing poor decisions. The index still produces correct results, but is much less efficient than it should be. Reindexing BRIN `minmax_multi` indexes on `timestamp` and `timestamptz` columns is advisable if the column contains, or has contained, infinities or large finite values. +* Avoid calculation overflows in BRIN `interval_minmax_multi_ops` indexes with extreme interval values (Tomas Vondra) [§](https://postgr.es/c/924e0e2ee) + + This bug might have caused unexpected failures while trying to insert large interval values into such an index. +* Fix partition step generation and runtime partition pruning for hash-partitioned tables with multiple partition keys (David Rowley) [§](https://postgr.es/c/595db9e9c) [§](https://postgr.es/c/6352f1627) + + Some cases involving an `IS NULL` condition on one of the partition keys could result in a crash. +* Fix inconsistent rechecking of concurrently-updated rows during `MERGE` (Dean Rasheed) [§](https://postgr.es/c/6d2de076c) + + In `READ COMMITTED` mode, an update that finds that its target row was just updated by a concurrent transaction will recheck the query's `WHERE` conditions on the updated row. `MERGE` failed to ensure that the proper rows of other joined tables were used during this recheck, possibly resulting in incorrect decisions about whether the newly-updated row should be updated again by `MERGE`. +* Correctly identify the target table in an inherited `UPDATE`/`DELETE`/`MERGE` even when the parent table is excluded by constraints (Amit Langote, Tom Lane) [§](https://postgr.es/c/b1444a09d) [§](https://postgr.es/c/178ee1d85) [§](https://postgr.es/c/2bf99b48d) + + If the initially-named table is excluded by constraints, but not all its inheritance descendants are, the first non-excluded descendant was identified as the primary target table. This would lead to firing statement-level triggers associated with that table, rather than the initially-named table as should happen. In v16, the same oversight could also lead to “invalid perminfoindex 0 in RTE with relid NNNN” errors. +* Fix edge case in btree mark/restore processing of ScalarArrayOpExpr clauses (Peter Geoghegan) [§](https://postgr.es/c/3fa81b62e) + + When restoring an indexscan to a previously marked position, the code could miss required setup steps if the scan had advanced exactly to the end of the matches for a ScalarArrayOpExpr (that is, an `indexcol = ANY(ARRAY[])`) clause. This could result in missing some rows that should have been fetched. +* Fix intra-query memory leak in Memoize execution (Orlov Aleksej, David Rowley) [§](https://postgr.es/c/31b2b2d72) +* Fix intra-query memory leak when a set-returning function repeatedly returns zero rows (Tom Lane) [§](https://postgr.es/c/07494a0df) +* Don't crash if `cursor_to_xmlschema()` is applied to a non-data-returning Portal (Boyu Yang) [§](https://postgr.es/c/ec693a3f3) +* Fix improper sharing of origin filter condition across successive `pg_logical_slot_get_changes()` calls (Hou Zhijie) [§](https://postgr.es/c/8d05be931) + + The origin condition set by one call of this function would be re-used by later calls that did not specify the origin argument. This was not intended. +* Throw the intended error if `pgrowlocks()` is applied to a partitioned table (David Rowley) [§](https://postgr.es/c/a98f01c93) + + Previously, a not-on-point complaint “only heap AM is supported” would be raised. +* Handle invalid indexes more cleanly in assorted SQL functions (Noah Misch) [§](https://postgr.es/c/1a368dd3e) + + Report an error if `pgstatindex()`, `pgstatginindex()`, `pgstathashindex()`, or `pgstattuple()` is applied to an invalid index. If `brin_desummarize_range()`, `brin_summarize_new_values()`, `brin_summarize_range()`, or `gin_clean_pending_list()` is applied to an invalid index, do nothing except to report a debug-level message. Formerly these functions attempted to process the index, and might fail in strange ways depending on what the failed `CREATE INDEX` had left behind. +* Avoid premature memory allocation failure with long inputs to `to_tsvector()` (Tom Lane) [§](https://postgr.es/c/8465efc1a) +* Fix over-allocation of the constructed `tsvector` in `tsvectorrecv()` (Denis Erokhin) [§](https://postgr.es/c/5c34a7374) + + If the incoming vector includes position data, the binary receive function left wasted space (roughly equal to the size of the position data) in the finished `tsvector`. In extreme cases this could lead to “maximum total lexeme length exceeded” failures for vectors that were under the length limit when emitted. In any case it could lead to wasted space on-disk. +* Improve checks for corrupt PGLZ compressed data (Flavien Guedez) [§](https://postgr.es/c/cfa4eba02) +* Fix `ALTER SUBSCRIPTION` so that a commanded change in the `run_as_owner` option is actually applied (Hou Zhijie) [§](https://postgr.es/c/a81e5516f) +* Fix bulk table insertion into partitioned tables (Andres Freund) [§](https://postgr.es/c/0002feb82) + + Improper sharing of insertion state across partitions could result in failures during `COPY FROM`, typically manifesting as “could not read block NNNN in file XXXX: read only 0 of 8192 bytes” errors. +* In `COPY FROM`, avoid evaluating column default values that will not be needed by the command (Laurenz Albe) [§](https://postgr.es/c/910eb61b2) + + This avoids a possible error if the default value isn't actually valid for the column, or if the default's expression would fail in the current execution context. Such edge cases sometimes arise while restoring dumps, for example. Previous releases did not fail in this situation, so prevent v16 from doing so. +* In `COPY FROM`, fail cleanly when an unsupported encoding conversion is needed (Tom Lane) [§](https://postgr.es/c/ea0e7cd6b) + + Recent refactoring accidentally removed the intended error check for this, such that it ended in “cache lookup failed for function 0” instead of a useful error message. +* Avoid crash in `EXPLAIN` if a parameter marked to be displayed by `EXPLAIN` has a NULL boot-time value (Xing Guo, Aleksander Alekseev, Tom Lane) [§](https://postgr.es/c/82063edd4) + + No built-in parameter fits this description, but an extension could define such a parameter. +* Ensure we have a snapshot while dropping `ON COMMIT DROP` temp tables (Tom Lane) [§](https://postgr.es/c/57e6e861d) + + This prevents possible misbehavior if any catalog entries for the temp tables have fields wide enough to require toasting (such as a very complex `CHECK` condition). +* Avoid improper response to shutdown signals in child processes just forked by `system()` (Nathan Bossart) [§](https://postgr.es/c/ee06199fc) + + This fix avoids a race condition in which a child process that has been forked off by `system()`, but hasn't yet exec'd the intended child program, might receive and act on a signal intended for the parent server process. That would lead to duplicate cleanup actions being performed, which will not end well. +* Cope with torn reads of `pg_control` in frontend programs (Thomas Munro) [§](https://postgr.es/c/5725e4ebe) + + On some file systems, reading `pg_control` may not be an atomic action when the server concurrently writes that file. This is detectable via a bad CRC. Retry a few times to see if the file becomes valid before we report error. +* Avoid torn reads of `pg_control` in relevant SQL functions (Thomas Munro) [§](https://postgr.es/c/2371432cd) + + Acquire the appropriate lock before reading `pg_control`, to ensure we get a consistent view of that file. +* Fix “could not find pathkey item to sort” errors occurring while planning aggregate functions with `ORDER BY` or `DISTINCT` options (David Rowley) [§](https://postgr.es/c/9154ededf) +* Avoid integer overflow when computing size of backend activity string array (Jakub Wartak) [§](https://postgr.es/c/75f31a3f2) + + On 64-bit machines we will allow values of `track_activity_query_size` large enough to cause 32-bit overflow when multiplied by the allowed number of connections. The code actually allocating the per-backend local array was careless about this though, and allocated the array incorrectly. +* Fix briefly showing inconsistent progress statistics for `ANALYZE` on inherited tables (Heikki Linnakangas) [§](https://postgr.es/c/992d2ca81) + + The block-level counters should be reset to zero at the same time we update the current-relation field. +* Fix the background writer to report any WAL writes it makes to the statistics counters (Nazir Bilal Yavuz) [§](https://postgr.es/c/4a97a43a7) +* Fix confusion about forced-flush behavior in `pgstat_report_wal()` (Ryoga Yoshida, Michael Paquier) [§](https://postgr.es/c/280f70221) + + This could result in some statistics about WAL I/O being forgotten in a shutdown. +* Fix statistics tracking of temporary-table extensions (Karina Litskevich, Andres Freund) [§](https://postgr.es/c/c4758649b) + + These were counted as normal-table writes when they should be counted as temp-table writes. +* When `track_io_timing` is enabled, include the time taken by relation extension operations as write time (Nazir Bilal Yavuz) [§](https://postgr.es/c/2308f18c0) +* Track the dependencies of cached `CALL` statements, and re-plan them when needed (Tom Lane) [§](https://postgr.es/c/055f786ea) + + DDL commands, such as replacement of a function that has been inlined into a `CALL` argument, can create the need to re-plan a `CALL` that has been cached by PL/pgSQL. That was not happening, leading to misbehavior or strange errors such as “cache lookup failed”. +* Avoid a possible pfree-a-NULL-pointer crash after an error in OpenSSL connection setup (Sergey Shinderuk) [§](https://postgr.es/c/f720875a4) +* Track nesting depth correctly when inspecting `RECORD`-type Vars from outer query levels (Richard Guo) [§](https://postgr.es/c/53630f12d) + + This oversight could lead to assertion failures, core dumps, or “bogus varno” errors. +* Track hash function and negator function dependencies of ScalarArrayOpExpr plan nodes (David Rowley) [§](https://postgr.es/c/1a6900e58) + + In most cases this oversight was harmless, since these functions would be unlikely to disappear while the node's original operator remains present. +* Fix error-handling bug in `RECORD` type cache management (Thomas Munro) [§](https://postgr.es/c/f899c7f1e) + + An out-of-memory error occurring at just the wrong point could leave behind inconsistent state that would lead to an infinite loop. +* Treat out-of-memory failures as fatal while reading WAL (Michael Paquier) [§](https://postgr.es/c/a06efbc3a) + + Previously this would be treated as a bogus-data condition, leading to the conclusion that we'd reached the end of WAL, which is incorrect and could lead to inconsistent WAL replay. +* Fix possible recovery failure due to trying to allocate memory based on a bogus WAL record length field (Thomas Munro, Michael Paquier) [§](https://postgr.es/c/ce497f648) [§](https://postgr.es/c/10d0591ea) +* Fix “could not duplicate handle” error occurring on Windows when `min_dynamic_shared_memory` is set above zero (Thomas Munro) [§](https://postgr.es/c/174ccda5e) +* Fix order of operations in `GenericXLogFinish` (Jeff Davis) [§](https://postgr.es/c/b8963e8a2) + + This code violated the conditions required for crash safety by writing WAL before marking changed buffers dirty. No core code uses this function, but extensions do (`contrib/bloom` does, for example). +* Remove incorrect assertion in PL/Python exception handling (Alexander Lakhin) [§](https://postgr.es/c/f171430f0) +* Fix pg\_dump to dump the new `run_as_owner` option of subscriptions (Philip Warner) [§](https://postgr.es/c/67738dbf9) + + Due to this oversight, subscriptions would always be restored with `run_as_owner` set to `false`, which is not equivalent to their behavior in pre-v16 releases. +* Fix pg\_restore so that selective restores will include both table-level and column-level ACLs for selected tables (Euler Taveira, Tom Lane) [§](https://postgr.es/c/aaaf8fbb6) + + Formerly, only the table-level ACL would get restored if both types were present. +* Add logic to pg\_upgrade to check for use of `abstime`, `reltime`, and `tinterval` data types (Álvaro Herrera) [§](https://postgr.es/c/fb9ddd0fa) + + These obsolete data types were removed in PostgreSQL version 12, so check to make sure they aren't present in an older database before claiming it can be upgraded. +* Avoid false “too many client connections” errors in pgbench on Windows (Noah Misch) [§](https://postgr.es/c/06ff06484) +* Fix vacuumdb's handling of multiple `-N` switches (Nathan Bossart, Kuwamura Masaki) [§](https://postgr.es/c/2143d96dc) + + Multiple `-N` switches should exclude tables in multiple schemas, but in fact excluded nothing due to faulty construction of a generated query. +* Fix vacuumdb to honor its `--buffer-usage-limit` option in analyze-only mode (Ryoga Yoshida, David Rowley) [§](https://postgr.es/c/f7dbdab05) +* In `contrib/amcheck`, do not report interrupted page deletion as corruption (Noah Misch) [§](https://postgr.es/c/3c6a05b80) + + This fix prevents false-positive reports of “the first child of leftmost target page is not leftmost of its level”, “block NNNN is not leftmost” or “left link/right link pair in index XXXX not in agreement”. They appeared if amcheck ran after an unfinished btree index page deletion and before `VACUUM` had cleaned things up. +* Fix failure of `contrib/btree_gin` indexes on `interval` columns, when an indexscan using the `<` or `<=` operator is performed (Dean Rasheed) [§](https://postgr.es/c/ab73a37e9) + + Such an indexscan failed to return all the entries it should. +* Add support for LLVM 16 and 17 (Thomas Munro, Dmitry Dolgov) [§](https://postgr.es/c/774185056) [§](https://postgr.es/c/74d19ec09) [§](https://postgr.es/c/60596f148) +* Suppress assorted build-time warnings on recent macOS (Tom Lane) [§](https://postgr.es/c/75c562653) [§](https://postgr.es/c/e73d6a0df) + + Xcode 15 (released with macOS Sonoma) changed the linker's behavior in a way that causes many duplicate-library warnings while building PostgreSQL. These were harmless, but they're annoying so avoid citing the same libraries twice. Also remove use of the `-multiply_defined suppress` linker switch, which apparently has been a no-op for a long time, and is now actively complained of. +* When building `contrib/unaccent`'s rules file, fall back to using `python` if `--with-python` was not given and make variable `PYTHON` was not set (Japin Li) [§](https://postgr.es/c/641db601b) +* Remove `PHOT` (Phoenix Islands Time) from the default timezone abbreviations list (Tom Lane) [§](https://postgr.es/c/d1537afe3) + + Presence of this abbreviation in the default list can cause failures on recent Debian and Ubuntu releases, as they no longer install the underlying tzdb entry by default. Since this is a made-up abbreviation for a zone with a total human population of about two dozen, it seems unlikely that anyone will miss it. If someone does, they can put it back via a custom abbreviations file. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-16-2.html "E.10. Release 16.2") | [Up](release.html "Appendix E. Release Notes") | [Next](release-16.html "E.12. Release 16") | +| E.10. Release 16.2 | [Home](index.html "PostgreSQL 16.11 Documentation") | E.12. Release 16 | + +[Previous](/docs/release/16.0/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/16.2/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1610.md b/corpus/changelog/postgresql_releases/postgresql_1610.md new file mode 100644 index 0000000000000000000000000000000000000000..cbe25508606d4a5b35af0754dc97c52c1e29598a --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1610.md @@ -0,0 +1,209 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/16.10/ +Version: 16.10 + +## PostgreSQL 16.10 + +| E.2. Release 16.10 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-16-11.html "E.1. Release 16.11") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 16.11 Documentation") | [Next](release-16-9.html "E.3. Release 16.9") | + +--- + +## E.2. Release 16.10 [#](#RELEASE-16-10) + +[E.2.1. Migration to Version 16.10](release-16-10.html#RELEASE-16-10-MIGRATION) + +[E.2.2. Changes](release-16-10.html#RELEASE-16-10-CHANGES) + +**Release date:**2025-08-14 + +This release contains a variety of fixes from 16.9. For information about new features in major release 16, see [Section E.12](release-16.html "E.12. Release 16"). + +### E.2.1. Migration to Version 16.10 [#](#RELEASE-16-10-MIGRATION) + +A dump/restore is not required for those running 16.X. + +However, if you have any BRIN `numeric_minmax_multi_ops` indexes, it is advisable to reindex them after updating. See the fourth changelog entry below. + +Also, if you are upgrading from a version earlier than 16.9, see [Section E.3](release-16-9.html "E.3. Release 16.9"). + +### E.2.2. Changes [#](#RELEASE-16-10-CHANGES) + +* Tighten security checks in planner estimation functions (Dean Rasheed) [§](https://postgr.es/c/7e86da539) + + The fix for CVE-2017-7484, plus followup fixes, intended to prevent leaky functions from being applied to statistics data for columns that the calling user does not have permission to read. Two gaps in that protection have been found. One gap applies to partitioning and inheritance hierarchies where RLS policies on the tables should restrict access to statistics data, but did not. + + The other gap applies to cases where the query accesses a table via a view, and the view owner has permissions to read the underlying table but the calling user does not have permissions on the view. The view owner's permissions satisfied the security checks, and the leaky function would get applied to the underlying table's statistics before we check the calling user's permissions on the view. This has been fixed by making security checks on views occur at the start of planning. That might cause permissions failures to occur earlier than before. + + The PostgreSQL Project thanks Dean Rasheed for reporting this problem. (CVE-2025-8713) +* Prevent pg\_dump scripts from being used to attack the user running the restore (Nathan Bossart) [§](https://postgr.es/c/7ad8e7909) + + Since dump/restore operations typically involve running SQL commands as superuser, the target database installation must trust the source server. However, it does not follow that the operating system user who executes psql to perform the restore should have to trust the source server. The risk here is that an attacker who has gained superuser-level control over the source server might be able to cause it to emit text that would be interpreted as psql meta-commands. That would provide shell-level access to the restoring user's own account, independently of access to the target database. + + To provide a positive guarantee that this can't happen, extend psql with a `\restrict` command that prevents execution of further meta-commands, and teach pg\_dump to issue that before any data coming from the source server. + + The PostgreSQL Project thanks Martin Rakhmanov, Matthieu Denais, and RyotaK for reporting this problem. (CVE-2025-8714) +* Convert newlines to spaces in names included in comments in pg\_dump output (Noah Misch) [§](https://postgr.es/c/850caae60) + + Object names containing newlines offered the ability to inject arbitrary SQL commands into the output script. (Without the preceding fix, injection of psql meta-commands would also be possible this way.) CVE-2012-0868 fixed this class of problem at the time, but later work reintroduced several cases. + + The PostgreSQL Project thanks Noah Misch for reporting this problem. (CVE-2025-8715) +* Fix incorrect distance calculation in BRIN `numeric_minmax_multi_ops` support function (Peter Eisentraut, Tom Lane) [§](https://postgr.es/c/b9279058a) + + The results were sometimes wrong on 64-bit platforms, and wildly wrong on 32-bit platforms. This did not produce obvious failures because the logic is only used to choose how to merge values into ranges; at worst the index would become inefficient and bloated. Nonetheless it's recommended to reindex any BRIN indexes that use the `numeric_minmax_multi_ops` operator class. +* Avoid regression in the size of XML input that we will accept (Michael Paquier, Erik Wienhold) [§](https://postgr.es/c/6d5e493b4) [§](https://postgr.es/c/762c6d8d2) + + Our workaround for a bug in early 2.13.x releases of libxml2 made use of a code path that rejects text chunks exceeding 10MB, whereas the previous coding did not. Those early releases are presumably extinct in the wild by now, so revert to the previous coding. +* Fix `MERGE` into a plain-inheritance parent table (Dean Rasheed) [§](https://postgr.es/c/3611794af) + + Insertions into such a target table could crash or produce incorrect query results due to failing to handle `WITH CHECK OPTION` and `RETURNING` actions. +* Allow tables with statement-level triggers to become partitions or inheritance children (Etsuro Fujita) [§](https://postgr.es/c/3863c6fb6) + + We do not allow partitions or inheritance child tables to have row-level triggers with transition tables, because an operation on the whole inheritance tree would need to maintain a separate transition table for each such child table. But that problem does not apply for statement-level triggers, because only the parent's statement-level triggers will be fired. The code that checks whether an existing table can become a partition or inheritance child nonetheless rejected both kinds of trigger. +* Disallow collecting transition tuples from child foreign tables (Etsuro Fujita) [§](https://postgr.es/c/9cca445df) + + We do not support triggers with transition tables on foreign tables. However, the case of a partition or inheritance child that is a foreign table was overlooked. If the parent has such a trigger, incorrect transition tuples were collected from the foreign child. Instead throw an error, reporting that the case is not supported. +* Allow resetting unknown custom parameters with reserved prefixes (Nathan Bossart) [§](https://postgr.es/c/b998ce327) + + Previously, if a parameter setting had been stored using `ALTER DATABASE/ROLE/SYSTEM`, the stored setting could not be removed if the parameter was unknown but had a reserved prefix. This case could arise if an extension used to have a parameter, but that parameter had been removed in an upgrade. +* Fix a potential deadlock during `ALTER SUBSCRIPTION ... DROP PUBLICATION` (Ajin Cherian) [§](https://postgr.es/c/adfd80219) + + Ensure that server processes acquire catalog locks in a consistent order during replication origin drops. +* Shorten the race condition window for creating indexes with conflicting names (Tom Lane) [§](https://postgr.es/c/1e24ea160) + + When choosing an auto-generated name for an index, avoid conflicting with not-yet-committed `pg_class` rows as well as fully-valid ones. This avoids possibly choosing the same name as some concurrent `CREATE INDEX` did, when that command is still in process of filling its index, or is done but is part of a not-yet-committed transaction. There's still a window for trouble, but it's only as long as the time needed to validate a new index's parameters and insert its `pg_class` row. +* Prevent usage of incorrect `VACUUM` options in some cases where multiple tables are vacuumed in a single command (Nathan Bossart, Michael Paquier) [§](https://postgr.es/c/d187cabdd) + + The `TRUNCATE` and `INDEX_CLEANUP` options of one table could be applied to others. +* Fix processing of character classes within `SIMILAR TO` regular expressions (Laurenz Albe) [§](https://postgr.es/c/e9e535d61) [§](https://postgr.es/c/52d08620e) + + The code that translates `SIMILAR TO` pattern matching expressions to POSIX-style regular expressions did not consider that square brackets can be nested. For example, in a pattern like `[[:alpha:]%_]`, the code treated the `%` and `_` characters as metacharacters when they should be literals. +* When deparsing queries, always add parentheses around the expression in `FETCH FIRST expression ROWS WITH TIES` clauses (Heikki Linnakangas) [§](https://postgr.es/c/92a9ba3b9) [§](https://postgr.es/c/558ea446a) + + This avoids some cases where the deparsed result wasn't syntactically valid. +* Limit the checkpointer process's fsync request queue size (Alexander Korotkov, Xuneng Zhou) [§](https://postgr.es/c/f0cdc2afd) [§](https://postgr.es/c/2ac50f118) + + With very large `shared_buffers` settings, it was possible for the checkpointer to attempt to allocate more than 1GB for fsync requests, leading to failure and an infinite loop. Clamp the queue size to prevent this scenario. +* Avoid infinite wait in logical decoding when reading a partially-written WAL record (Vignesh C) [§](https://postgr.es/c/b485e1c89) + + If the server crashes after writing the first part of a WAL record that would span multiple pages, subsequent logical decoding of the WAL stream would wait for data to arrive on the next WAL page. That might never happen if the server is now idle. +* Fix inconsistent quoting of role names in ACL strings (Tom Lane) [§](https://postgr.es/c/53a936b61) + + The previous quoting rule was locale-sensitive, which could lead to portability problems when transferring `aclitem` values across installations. (pg\_dump does not do that, but other tools might.) To ensure consistency, always quote non-ASCII characters in `aclitem` output; but to preserve backward compatibility, never require that they be quoted during `aclitem` input. +* Reject equal signs (`=`) in the names of relation options and foreign-data options (Tom Lane) [§](https://postgr.es/c/ab758ec4d) + + There's no evident use-case for option names like this, and allowing them creates ambiguity in the stored representation. +* Fix potentially-incorrect decompression of LZ4-compressed archive data (Mikhail Gribkov) [§](https://postgr.es/c/5c639523f) + + This error seems to manifest only with not-very-compressible input data, which may explain why it escaped detection. +* Avoid a rare scenario where a btree index scan could mark the wrong index entries as dead (Peter Geoghegan) [§](https://postgr.es/c/c7f25feb3) +* Avoid re-distributing cache invalidation messages from other transactions during logical replication (vignesh C) [§](https://postgr.es/c/b2ae07720) + + Our previous round of minor releases included a bug fix to ensure that replication receiver processes would respond to cross-process cache invalidation messages, preventing them from using stale catalog data while performing replication updates. However, the fix unintentionally made them also redistribute those messages again, leading to an exponential increase in the number of invalidation messages, which would often end in a memory allocation failure. Fix by not redistributing received messages. +* Avoid premature removal of old WAL during checkpoints (Vitaly Davydov) [§](https://postgr.es/c/cea8f2c3e) + + If a replication slot's restart point is advanced while a checkpoint is in progress, no-longer-needed WAL segments could get removed too soon, leading to recovery failure if the database crashes immediately afterwards. Fix by keeping them for one additional checkpoint cycle. +* Never move a replication slot's confirmed-flush position backwards (Shveta Malik) [§](https://postgr.es/c/c0f51fde5) + + In some cases a replication client could acknowledge an LSN that's past what it has stored persistently, and then perhaps send an older LSN after a restart. We consider this not-a-bug so long as the client did not have anything it needed to do for the WAL between the two points. However, we should not re-send that WAL for fear of data duplication, so make sure we always believe the latest confirmed LSN for a given slot. +* Prevent excessive delays before launching new logical replication workers (Tom Lane) [§](https://postgr.es/c/87c8ed3db) + + In some cases the logical replication launcher could sleep considerably longer than the configured `wal_retrieve_retry_interval` before launching a new worker. +* Fix use-after-free during logical replication of `INSERT ... ON CONFLICT` (Ethan Mertz, Michael Paquier) [§](https://postgr.es/c/ec96e8812) + + This could result in incorrect progress reporting, or with very bad luck it could result in a crash of the WAL sender process. +* Allow waiting for a transaction on a standby server to be interrupted (Kevin K Biju) [§](https://postgr.es/c/63fa7caa9) + + Creation of a replication slot on a standby server may require waiting for some active transaction(s) to finish on the primary and then be replayed on the standby. Since that could be an indefinite wait, it's desirable to allow the operation to be cancelled, but there was no check for query cancel in the loop. +* Do not let cascading logical WAL senders try to send data that's beyond what has been replayed on their standby server (Alexey Makhmutov) [§](https://postgr.es/c/5e6d561bc) + + This avoids a situation where such WAL senders could get stuck at standby server shutdown, waiting for replay work that will not happen because the server's startup process is already shut down. +* Fix per-relation memory leakage in autovacuum (Tom Lane) [§](https://postgr.es/c/e087b5b79) +* Fix session-lifespan memory leaks in `XMLSERIALIZE(... INDENT)` (Dmitry Kovalenko, Tom Lane) [§](https://postgr.es/c/abb517d61) [§](https://postgr.es/c/ee58de100) +* Fix some places that might try to fetch toasted fields of system catalogs without any snapshot (Nathan Bossart) [§](https://postgr.es/c/24135398f) + + This could result in an assertion failure or “cannot fetch toast data without an active snapshot” error. +* Avoid assertion failure during cross-table constraint updates (Tom Lane, Jian He) [§](https://postgr.es/c/c15798cf9) [§](https://postgr.es/c/d36980b71) +* Remove faulty assertion that a command tag must have been determined by the end of `PortalRunMulti()` (Álvaro Herrera) [§](https://postgr.es/c/4871c1e9c) + + This failed in edge cases such as an empty prepared statement. +* Fix assertion failure in `XMLTABLE` parsing (Richard Guo) [§](https://postgr.es/c/d3716d4b1) +* Restore the ability to run PL/pgSQL expressions in parallel (Dipesh Dhameliya) [§](https://postgr.es/c/3bbc1c4a7) + + PL/pgSQL's notion of an “expression” is very broad, encompassing any SQL `SELECT` query that returns a single column and no more than one row. So there are cases, for example evaluation of an aggregate function, where the query involves significant work and it'd be useful to run it with parallel workers. This used to be possible, but a previous bug fix unintentionally disabled it. +* Fix edge-case resource leaks in PL/Python error reporting (Tom Lane) [§](https://postgr.es/c/5c7fd5976) [§](https://postgr.es/c/ecc8fd2b7) + + An out-of-memory failure while reporting an error from Python could result in failure to drop reference counts on Python objects, leading to session-lifespan memory leakage. +* Fix libpq's `PQport()` function to never return NULL unless the passed connection is NULL (Daniele Varrazzo) [§](https://postgr.es/c/009c20a3d) + + This is the documented behavior, but recent libpq versions would return NULL in some cases where the user had not provided a port specification. Revert to our historical behavior of returning an empty string in such cases. (v18 and later will return the compiled-in default port number, typically `"5432"`, instead.) +* Avoid failure when GSSAPI authentication requires packets larger than 16kB (Jacob Champion, Tom Lane) [§](https://postgr.es/c/ca70ee6ed) + + Larger authentication packets are needed for Active Directory users who belong to many AD groups. This limitation manifested in connection failures with unintelligible error messages, typically “GSSAPI context establishment error: The routine must be called again to complete its function: Unknown error”. +* Fix timing-dependent failures in SSL and GSSAPI data transmission (Tom Lane) [§](https://postgr.es/c/3f37400cf) + + When using SSL or GSSAPI encryption in non-blocking mode, libpq sometimes failed with “SSL error: bad length” or “GSSAPI caller failed to retransmit all data needing to be retried”. +* Avoid null-pointer dereference during connection lookup in ecpg applications (Aleksander Alekseev) [§](https://postgr.es/c/313d3102f) + + The case could occur only if the application has some connections that are named and some that are not. +* Improve psql's tab completion for `COPY` and `\copy` options (Atsushi Torikoshi) [§](https://postgr.es/c/d69836b13) + + The same completions were offered for both `COPY FROM` and `COPY TO`, although some options are only valid for one case or the other. Distinguish these cases to provide more accurate suggestions. +* Avoid assertion failure in pgbench when multiple pipeline sync messages are received (Fujii Masao) [§](https://postgr.es/c/1d3ded521) +* Ensure that pg\_dump dumps comments on domain constraints in a valid order (Jian He) [§](https://postgr.es/c/cef998ef8) + + In some cases the comment command could appear before creation of the constraint. +* Ensure stable sort ordering in pg\_dump for all types of database objects (Noah Misch, Andreas Karlsson) [§](https://postgr.es/c/0ac1581c3) [§](https://postgr.es/c/9affed263) [§](https://postgr.es/c/216683296) + + pg\_dump sorts objects by their logical names before performing dependency-driven reordering. This sort did not account for the full unique key identifying certain object types such as rules and constraints, and thus it could produce dissimilar sort orders for logically-identical databases. That made it difficult to compare databases by diff'ing pg\_dump output, so improve the logic to ensure stable sort ordering in all cases. +* In pg\_upgrade, check for inconsistent inherited not-null constraints (Ali Akbar) [§](https://postgr.es/c/f63e408e8) [§](https://postgr.es/c/f943e2339) [§](https://postgr.es/c/05b367bea) [§](https://postgr.es/c/06f444816) + + PostgreSQL versions before 18 allow an inherited column not-null constraint to be dropped. However, this results in a schema that cannot be restored, leading to failure in pg\_upgrade. Detect such cases during pg\_upgrade's preflight checks to allow users to fix them before initiating the upgrade. +* Avoid assertion failure if `track_commit_timestamp` is enabled during initdb (Hayato Kuroda, Andy Fan) [§](https://postgr.es/c/7e7059abf) +* Fix pg\_waldump to show information about dropped statistics in `PREPARE TRANSACTION` WAL records (Daniil Davydov) [§](https://postgr.es/c/0d2063585) +* Avoid possible leak of the open connection during `contrib/dblink` connection establishment (Tom Lane) [§](https://postgr.es/c/8eef55db1) + + In the rare scenario where we hit out-of-memory while inserting the new connection object into dblink's hashtable, the open connection would be leaked until end of session, leaving an idle session sitting on the remote server. +* Make `contrib/pg_prewarm` cope with very large `shared_buffers` settings (Daria Shanina) [§](https://postgr.es/c/169429264) + + Autoprewarm failed with a memory allocation error if `shared_buffers` was larger than about 50 million buffers (400GB). +* In `contrib/pg_stat_statements`, avoid leaving gaps in the set of parameter numbers used in a normalized query (Sami Imseih) [§](https://postgr.es/c/7e8b44f4e) +* Fix memory leakage in `contrib/postgres_fdw`'s DirectModify methods (Tom Lane) [§](https://postgr.es/c/2b92dc4ee) + + The `PGresult` holding the results of the remote modify command would be leaked for the rest of the session if the query fails between invocations of the DirectModify methods, which could happen when there's `RETURNING` data to process. +* Ensure that directories listed in configure's `--with-includes` and `--with-libraries` options are searched before system-supplied directories (Tom Lane) [§](https://postgr.es/c/bbc20c8a9) + + A common reason for using these options is to allow a user-built version of some library to override the system-supplied version. However, that failed to work in some environments because of careless ordering of switches in the commands issued by the makefiles. +* Fix configure's checks for `__cpuid()` and `__cpuidex()` (Lukas Fittl, Michael Paquier) [§](https://postgr.es/c/c1984be23) + + configure failed to detect these Windows-specific functions, so that they would not be used, leading to slower-than-necessary CRC computations since the availability of hardware instructions could not be verified. The practical impact of this error was limited, because production builds for Windows typically do not use the Autoconf toolchain. +* Fix build failure with `--with-pam` option on Solaris-based platforms (Tom Lane) [§](https://postgr.es/c/e4d585455) + + Solaris is inconsistent with other Unix platforms about the API for PAM authentication. This manifested as an “inconsistent pointer” compiler warning, which we never did anything about. But as of GCC 14 it's an error not warning by default, so fix it. +* Make our code portable to GNU Hurd (Michael Banck, Christoph Berg, Samuel Thibault) [§](https://postgr.es/c/d25d392e8) [§](https://postgr.es/c/3a2617e4f) + + Fix assumptions about `IOV_MAX` and `O_RDONLY` that don't hold on Hurd. +* Make our usage of `memset_s()` conform strictly to the C11 standard (Tom Lane) [§](https://postgr.es/c/253cf661c) [§](https://postgr.es/c/4b53cb493) + + This avoids compile failures on some platforms. +* Silence compatibility warning when using Meson to build with MSVC (Peter Eisentraut) [§](https://postgr.es/c/629cc1623) +* Prevent uninitialized-value compiler warnings in JSONB comparison code (Tom Lane) [§](https://postgr.es/c/5db55e13f) +* Avoid deprecation warnings when building with libxml2 2.14 and later (Michael Paquier) [§](https://postgr.es/c/d24a96ce2) +* Avoid problems when compiling `pg_locale.h` under C++ (John Naylor) [§](https://postgr.es/c/aae9aad19) + + PostgreSQL header files generally need to be wrapped in `extern "C" { ... }` in order to be included in extensions written in C++. This failed for `pg_locale.h` because of its use of libicu headers, but we can work around that by suppressing C++-only declarations in those headers. C++ extensions that want to use libicu's C++ APIs can do so by including the libicu headers ahead of `pg_locale.h`. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-16-11.html "E.1. Release 16.11") | [Up](release.html "Appendix E. Release Notes") | [Next](release-16-9.html "E.3. Release 16.9") | +| E.1. Release 16.11 | [Home](index.html "PostgreSQL 16.11 Documentation") | E.3. Release 16.9 | + +[Previous](/docs/release/16.9/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/16.11/) diff --git a/corpus/changelog/postgresql_releases/postgresql_1611.md b/corpus/changelog/postgresql_releases/postgresql_1611.md new file mode 100644 index 0000000000000000000000000000000000000000..20a2abe0cce6e8934093932adccfae889cefb640 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_1611.md @@ -0,0 +1,199 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/16.11/ +Version: 16.11 + +## PostgreSQL 16.11 + +| E.1. Release 16.11 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release.html "Appendix E. Release Notes") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 16.11 Documentation") | [Next](release-16-10.html "E.2. Release 16.10") | + +--- + +## E.1. Release 16.11 [#](#RELEASE-16-11) + +[E.1.1. Migration to Version 16.11](release-16-11.html#RELEASE-16-11-MIGRATION) + +[E.1.2. Changes](release-16-11.html#RELEASE-16-11-CHANGES) + +**Release date:**2025-11-13 + +This release contains a variety of fixes from 16.10. For information about new features in major release 16, see [Section E.12](release-16.html "E.12. Release 16"). + +### E.1.1. Migration to Version 16.11 [#](#RELEASE-16-11-MIGRATION) + +A dump/restore is not required for those running 16.X. + +However, if you are upgrading from a version earlier than 16.10, see [Section E.2](release-16-10.html "E.2. Release 16.10"). + +### E.1.2. Changes [#](#RELEASE-16-11-CHANGES) + +* Check for `CREATE` privileges on the schema in `CREATE STATISTICS` (Jelte Fennema-Nio) [§](https://postgr.es/c/d20abb587) + + This omission allowed table owners to create statistics in any schema, potentially leading to unexpected naming conflicts. + + The PostgreSQL Project thanks Jelte Fennema-Nio for reporting this problem. (CVE-2025-12817) +* Avoid integer overflow in allocation-size calculations within libpq (Jacob Champion) [§](https://postgr.es/c/585fd9b3c) + + Several places in libpq were not sufficiently careful about computing the required size of a memory allocation. Sufficiently large inputs could cause integer overflow, resulting in an undersized buffer, which would then lead to writing past the end of the buffer. + + The PostgreSQL Project thanks Aleksey Solovev of Positive Technologies for reporting this problem. (CVE-2025-12818) +* Correctly treat JSON constructor expressions, such as `JSON_OBJECT()`, as non-strict (Tender Wang, Richard Guo) [§](https://postgr.es/c/62397bb18) + + In some cases these expressions can yield a non-null result despite having one or more null inputs, making them non-strict. The planner incorrectly classified them as strict and could perform incorrect query transformations as a result. +* Further fix processing of character classes within `SIMILAR TO` regular expressions (Laurenz Albe) [§](https://postgr.es/c/281ad4ed1) + + The previous fix for translating `SIMILAR TO` pattern matching expressions to POSIX-style regular expressions broke a corner case that formerly worked: if there is an escape character right after the opening bracket and then a closing bracket right after the escape sequence (for example `[\w]`), the closing bracket was no longer seen as terminating the character class. +* Fix parsing of aggregate functions whose arguments contain a sub-select with a `FROM` reference to a CTE outside the aggregate function (Tom Lane) [§](https://postgr.es/c/7df74e635) + + Such a CTE reference must act like a outer-level column reference when determining the aggregate's semantic level; but it was not being accounted for, leading to obscure planner or executor errors. +* Fix “no relation entry for relid” errors in corner cases while estimating SubPlan costs (Richard Guo) [§](https://postgr.es/c/79ade5873) +* Avoid unlikely use-after-free in planner's expansion of partitioned tables (Bernd Reiß) [§](https://postgr.es/c/f0fe1da50) + + There was a hazard only when the last live partition was concurrently dropped. +* Remove faulty assertion in btree index cleanup (Peter Geoghegan) [§](https://postgr.es/c/c160fd469) +* Fix possible infinite loop in GIN index scans with multiple scan conditions (Tom Lane) [§](https://postgr.es/c/d532069c3) + + GIN can handle scan conditions that can reject non-matching entries but are not useful for searching for relevant entries, for example a `tsquery` clause like `!term`. But such a condition must not be first in the array of scan conditions. The code failed to ensure that in all cases, with the result that a query having a mix of such conditions with normal conditions might work or not depending on the order in which the conditions were given in the query. +* Ensure that GIN index scans can be canceled (Tom Lane) [§](https://postgr.es/c/25eadfd0f) + + Some code paths were capable of running for a long time without checking for interrupts. +* Ensure that BRIN autosummarization provides a snapshot for index expressions that need one (Álvaro Herrera) [§](https://postgr.es/c/6ef33c805) [§](https://postgr.es/c/20442cf50) + + Previously, autosummarization would fail for such indexes, and then leave placeholder index tuples behind, causing the index to bloat over time. +* Fix integer-overflow hazard in BRIN index scans when the table contains close to 232 pages (Sunil S) [§](https://postgr.es/c/ef915bf93) + + This oversight could result in an infinite loop or scanning of unneeded table pages. +* Fix incorrect zero-extension of stored values in JIT-generated tuple deforming code (David Rowley) [§](https://postgr.es/c/3398b0d02) + + When not using JIT, the equivalent code does sign-extension not zero-extension, leading to a different Datum representation of small integer data types. This inconsistency was masked in most cases, but it is known to lead to “could not find memoization table entry” errors when using Memoize plan nodes, and there might be other symptoms. +* Fix incorrect logic for caching result-relation information for triggers (David Rowley, Amit Langote) [§](https://postgr.es/c/a546964db) + + In cases where partitions' column sets aren't physically identical to their parent partitioned tables' column sets, this oversight could lead to crashes. +* Add missing EvalPlanQual rechecks for TID Scan and TID Range Scan plan nodes (Sophie Alpert, David Rowley) [§](https://postgr.es/c/ba0203880) [§](https://postgr.es/c/d6539f88b) + + This omission led to possibly not rechecking a condition on `ctid` during concurrent-update situations, causing the update's behavior to vary depending on which plan type had been selected. +* Fix EvalPlanQual handling of foreign or custom joins that do not have an alternative local-join plan prepared for EPQ (Masahiko Sawada, Etsuro Fujita) [§](https://postgr.es/c/5a9af4868) + + In such cases the foreign or custom access method should be invoked normally, but that did not happen, typically leading to a crash. +* Avoid duplicating hash partition constraints during `DETACH CONCURRENTLY` (Haiyang Li) [§](https://postgr.es/c/b835759ec) + + `ALTER TABLE DETACH PARTITION CONCURRENTLY` was written to add a copy of the partitioning constraint to the now-detached partition. This was misguided, partially because non-concurrent `DETACH` doesn't do that, but mostly because in the case of hash partitioning the constraint expression contains references to the parent table's OID. That causes problems during dump/restore, or if the parent table is dropped after `DETACH`. In v19 and later, we'll no longer create any such copied constraints at all. In released branches, to minimize the risk of unforeseen consequences, only skip adding a copied constraint if it is for hash partitioning. +* Disallow generated columns in partition keys (Jian He, Ashutosh Bapat) [§](https://postgr.es/c/7180d56c5) + + This was already not allowed, but the check missed some cases, such as where the column reference is implicit in a whole-row reference. +* Disallow generated columns in `COPY ... FROM ... WHERE` clauses (Peter Eisentraut, Jian He) [§](https://postgr.es/c/26958f4d9) + + Previously, incorrect behavior or an obscure error message resulted from attempting to reference such a column, since generated columns have not yet been computed at the point where `WHERE` filtering is done. +* Fix visibility checking for statistics objects in `pg_temp` (Noah Misch) [§](https://postgr.es/c/ab16418ee) + + A statistics object located in a temporary schema cannot be named without schema qualification, but `pg_statistics_obj_is_visible()` missed that memo and could return “true” regardless. In turn, functions such as `pg_describe_object()` could fail to schema-qualify the object's name as expected. +* Fix `pg_event_trigger_dropped_objects()`'s reporting of temporary status (Antoine Violin, Tom Lane) [§](https://postgr.es/c/8856f1acc) [§](https://postgr.es/c/f6c8e7824) + + If a dropped column default, trigger, or RLS policy belongs to a temporary table, report it with `is_temporary` true. +* Fix memory leakage in hashed subplans (Haiyang Li) [§](https://postgr.es/c/e1da9c072) + + Any memory consumed by the hash functions used for hashing tuples constituted a query-lifespan memory leak. One way that could happen is if the values being hashed require de-toasting. +* Fix minor memory leak during WAL replay of database creation (Nathan Bossart) [§](https://postgr.es/c/c72b5c536) +* Fix corruption of the shared statistics table after out-of-memory failures (Mikhail Kot) [§](https://postgr.es/c/12f57681c) + + Previously, an out-of-memory failure partway through creating a new hash table entry left a broken entry behind, potentially causing errors in other sessions later. +* Fix concurrent update issue in `MERGE` (Yugo Nagata) [§](https://postgr.es/c/21a61b87f) + + When executing a `MERGE UPDATE` action, if there is more than one concurrent update of the target row, the lock-and-retry code would sometimes incorrectly identify the latest version of the target tuple, leading to incorrect results. +* Add missing replica identity checks in `MERGE` and `INSERT ... ON CONFLICT DO UPDATE` (Zhijie Hou) [§](https://postgr.es/c/421d7a157) [§](https://postgr.es/c/0c4d5a45d) [§](https://postgr.es/c/d37694b97) + + If `MERGE` may require update or delete actions, and the target table publishes updates or deletes, insist that it have a `REPLICA IDENTITY` defined. Failing to require this can silently break replication. Likewise, `INSERT` with an `UPDATE` option must require `REPLICA IDENTITY` if the target table publishes either inserts or updates. +* Avoid deadlock during `DROP SUBSCRIPTION` when publisher is on the same server as subscriber (Dilip Kumar) [§](https://postgr.es/c/7ece76129) +* Fix incorrect reporting of replication lag in `pg_stat_replication` view (Fujii Masao) [§](https://postgr.es/c/2e55cf4ef) + + If any standby server's replay LSN stopped advancing, the `write_lag` and `flush_lag` columns would eventually stop updating. +* Avoid duplicative log messages about invalid `primary_slot_name` settings (Fujii Masao) [§](https://postgr.es/c/4fd916eab) +* Remove the unfinished slot state file after failing to write a replication slot's state to disk (Michael Paquier) [§](https://postgr.es/c/bfdd1a12d) + + Previously, a failure such as out-of-disk-space resulted in leaving a temporary `state.tmp` file behind. That's problematic because it would block all subsequent attempts to write the state, requiring manual intervention to clean up. +* Fix mishandling of lock timeout signals in parallel apply workers for logical replication (Hayato Kuroda) [§](https://postgr.es/c/a54c7a113) + + The same signal number was being used for both worker shutdown and lock timeout, leading to confusion. +* Avoid unwanted WAL receiver shutdown when switching from streaming to archive WAL source (Xuneng Zhou) [§](https://postgr.es/c/9b6109607) + + During a timeline change, a standby server's WAL receiver should remain alive, waiting for a new WAL streaming start point. Instead it was repeatedly shutting down and immediately getting restarted, which could confuse status monitoring code. +* Avoid failures in logical replication due to chance collisions of file numbers between regular and temporary tables (Vignesh C) [§](https://postgr.es/c/ab874faaa) + + This low-probability problem manifested as transient errors like “unexpected duplicate for tablespace *`X`*, relfilenode *`Y`*”. `contrib/autoprewarm` was also affected. A side-effect of the fix is that the SQL function `pg_filenode_relation()` will now ignore temporary tables. +* Fix use-after-free issue in the relation synchronization cache maintained by the pgoutput logical decoding plugin (Vignesh C, Masahiko Sawada) [§](https://postgr.es/c/b07682bce) + + An error during logical decoding could result in crashes in subsequent logical decoding attempts in the same session. The case is only reachable when pgoutput is invoked via SQL functions. +* Avoid unnecessary invalidation of logical replication slots (Bertrand Drouvot) [§](https://postgr.es/c/e3714dc05) +* Avoid assertion failure when trying to release a replication slot in single-user mode (Hayato Kuroda) [§](https://postgr.es/c/fea1cc3f7) +* Fix incorrect printing of messages about failures in checking whether the user has Windows administrator privilege (Bryan Green) [§](https://postgr.es/c/9883e3cd1) + + This code would have crashed or at least printed garbage. No such cases have been reported though, indicating that failure of these system calls is extremely rare. +* Avoid startup failure on macOS and BSD platforms when there is a collision with a pre-existing semaphore set (Tom Lane) [§](https://postgr.es/c/e67d5f7ba) + + If the pre-existing set has fewer semaphores than we asked for, these platforms return EINVAL not EEXIST as our code expected, resulting in failure to start the database. +* Avoid crash when attempting to test PostgreSQL with certain libsanitizer options (Emmanuel Sibi, Jacob Champion) [§](https://postgr.es/c/c775bf048) +* Fix false memory-context-checking warnings in debug builds on 64-bit Windows (David Rowley) [§](https://postgr.es/c/cdc04a6c3) +* Correctly handle `GROUP BY DISTINCT` in PL/pgSQL assignment statements (Tom Lane) [§](https://postgr.es/c/b7f6798c0) + + The parser failed to record the `DISTINCT` option in this context, so that the command would act as if it were plain `GROUP BY`. +* Avoid leaking memory when handling a SQL error within PL/Python (Tom Lane) [§](https://postgr.es/c/cbfd4d0f8) + + This fixes a session-lifespan memory leak introduced in our previous minor releases. +* Fix libpq's trace output of characters with the high bit set (Ran Benita) [§](https://postgr.es/c/701a0bd56) + + On platforms where `char` is considered signed, the output included unsightly `\xffffff` decoration. +* Fix libpq's handling of socket-related errors on Windows within its GSSAPI logic (Ning Wu, Tom Lane) [§](https://postgr.es/c/46c4478db) + + The code for encrypting/decrypting transmitted data using GSSAPI did not correctly recognize error conditions on the connection socket, since Windows reports those differently than other platforms. This led to failure to make such connections on Windows. +* In pg\_dump, dump security labels on subscriptions and event triggers (Jian He, Fujii Masao) [§](https://postgr.es/c/20b23784f) + + Labels on these types of objects were previously missed. +* Fix pg\_dump's sorting of default ACLs and foreign key constraints (Kirill Reshke, Álvaro Herrera) [§](https://postgr.es/c/e68fa9a83) [§](https://postgr.es/c/412d29fd2) [§](https://postgr.es/c/06c1ee6b7) + + Ensure consistent ordering of these database object types, as was already done for other object types. +* In pg\_dump, label comments for separately-dumped domain constraints with the proper dependency (Noah Misch) [§](https://postgr.es/c/3cf328eca) + + This error could lead to parallel pg\_restore attempting to create the comment before the constraint itself has been restored. +* In pg\_restore, skip comments and security labels for publications and subscriptions that are not being restored (Jian He, Fujii Masao) [§](https://postgr.es/c/97527a5e6) [§](https://postgr.es/c/0870397cc) + + Do not emit `COMMENT` or `SECURITY LABEL` commands for these objects when `--no-publications` or `--no-subscriptions` is specified. +* Fix assorted errors in the data compression logic in pg\_dump and pg\_restore (Daniel Gustafsson, Tom Lane) [§](https://postgr.es/c/ec017a305) [§](https://postgr.es/c/1518b7d76) [§](https://postgr.es/c/c865f5b9f) + + Error checking was missing or incorrect in several places, and there were also portability issues that would manifest on big-endian hardware. These problems had been missed because this code is only used to read compressed TOC files within directory-format dumps. pg\_dump never produces such a dump; the case can be reached only by manually compressing the TOC file after the fact, which is a supported thing to do but very uncommon. +* Fix pgbench to error out cleanly if a `COPY` operation is started (Anthonin Bonnefoy) [§](https://postgr.es/c/640590bb4) + + pgbench doesn't intend to support this case, but previously it went into an infinite loop. +* Fix pgbench's reporting of multiple errors (Yugo Nagata) [§](https://postgr.es/c/36c4d30c8) + + In cases where two successive `PQgetResult` calls both fail, pgbench might report the wrong error message. +* In pgbench, fix faulty assertion about errors in pipeline mode (Yugo Nagata) [§](https://postgr.es/c/8b2e290bd) +* Ensure that `contrib/pg_buffercache` functions can be canceled (Satyanarayana Narlapuram, Yuhang Qiu) [§](https://postgr.es/c/815fcfb20) + + Some code paths were capable of running for a long time without checking for interrupts. +* Fix `contrib/pg_prewarm`'s privilege checks for indexes (Ayush Vatsa, Nathan Bossart) [§](https://postgr.es/c/fae0ce5e3) [§](https://postgr.es/c/c26a8eaf6) + + `pg_prewarm()` requires `SELECT` privilege on relations to be prewarmed. However, since indexes have no SQL privileges of their own, this resulted in non-superusers being unable to prewarm indexes. Instead, check for `SELECT` privilege on the index's table. +* Make `contrib/pgstattuple` more robust about empty or invalid index pages (Nitin Motiani) [§](https://postgr.es/c/c0f9fe877) + + Count all-zero pages as free space, and ignore pages that are invalid according to a check of the page's special-space size. The code for btree indexes already counted all-zero pages as free, but the hash and gist code would error out, which has been found to be much less user-friendly. Similarly, make all three cases agree on ignoring corrupted pages rather than throwing errors. +* Harden our read and write barrier macros to satisfy Clang (Thomas Munro) [§](https://postgr.es/c/2f76ffe5e) + + We supposed that `__atomic_thread_fence()` is a sufficient barrier to prevent the C compiler from re-ordering memory accesses around it, but it appears that that's not true for Clang, allowing it to generate incorrect code for at least RISC-V, MIPS, and LoongArch machines. Add explicit compiler barriers to fix that. +* Fix building with LLVM version 21 and later (Holger Hoffstätte) [§](https://postgr.es/c/2670881af) +* When building with meson, apply the same special optimization flags for `numeric.c` and `checksum.c` as the makefile build does (Nathan Bossart, Jeff Davis) [§](https://postgr.es/c/509c77929) [§](https://postgr.es/c/2de24ca6c) + + Use `-ftree-vectorize` for both files, as well as `-funroll-loops` for `checksum.c`, to match what the makefiles have long done. +* Fix PGXS build infrastructure to support building NLS `po` files for extensions (Ryo Matsumura) [§](https://postgr.es/c/a506b0c0a) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release.html "Appendix E. Release Notes") | [Up](release.html "Appendix E. Release Notes") | [Next](release-16-10.html "E.2. Release 16.10") | +| Appendix E. Release Notes | [Home](index.html "PostgreSQL 16.11 Documentation") | E.2. Release 16.10 | + +[Previous](/docs/release/16.10/) + +[Return to the Release Notes Archive](/docs/release/) diff --git a/corpus/changelog/postgresql_releases/postgresql_162.md b/corpus/changelog/postgresql_releases/postgresql_162.md new file mode 100644 index 0000000000000000000000000000000000000000..199dc8dc31413c176c6cbf0798db1413f2307235 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_162.md @@ -0,0 +1,230 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/16.2/ +Version: 16.2 + +## PostgreSQL 16.2 + +| E.10. Release 16.2 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-16-3.html "E.9. Release 16.3") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 16.11 Documentation") | [Next](release-16-1.html "E.11. Release 16.1") | + +--- + +## E.10. Release 16.2 [#](#RELEASE-16-2) + +[E.10.1. Migration to Version 16.2](release-16-2.html#RELEASE-16-2-MIGRATION) + +[E.10.2. Changes](release-16-2.html#RELEASE-16-2-CHANGES) + +**Release date:**2024-02-08 + +This release contains a variety of fixes from 16.1. For information about new features in major release 16, see [Section E.12](release-16.html "E.12. Release 16"). + +### E.10.1. Migration to Version 16.2 [#](#RELEASE-16-2-MIGRATION) + +A dump/restore is not required for those running 16.X. + +However, one bug was fixed that could have resulted in corruption of GIN indexes during concurrent updates. If you suspect such corruption, reindex affected indexes after installing this update. + +Also, if you are upgrading from a version earlier than 16.1, see [Section E.11](release-16-1.html "E.11. Release 16.1"). + +### E.10.2. Changes [#](#RELEASE-16-2-CHANGES) + +* Tighten security restrictions within `REFRESH MATERIALIZED VIEW CONCURRENTLY` (Heikki Linnakangas) [§](https://postgr.es/c/d6a61cb3b) [§](https://postgr.es/c/fb3836855) + + One step of a concurrent refresh command was run under weak security restrictions. If a materialized view's owner could persuade a superuser or other high-privileged user to perform a concurrent refresh on that view, the view's owner could control code executed with the privileges of the user running `REFRESH`. Fix things so that all user-determined code is run as the view's owner, as expected. + + The only known exploit for this error does not work in PostgreSQL 16.0 and later, so it may be that v16 is not vulnerable in practice. + + The PostgreSQL Project thanks Pedro Gallegos for reporting this problem. (CVE-2024-0985) +* Fix memory leak when performing JIT inlining (Andres Freund, Daniel Gustafsson) [§](https://postgr.es/c/2cf50585e) + + There have been multiple reports of backend processes suffering out-of-memory conditions after sufficiently many JIT compilations. This fix should resolve that. +* Avoid generating incorrect partitioned-join plans (Richard Guo) [§](https://postgr.es/c/62f120203) + + Some uncommon situations involving lateral references could create incorrect plans. Affected queries could produce wrong answers, or odd failures such as “variable not found in subplan target list”, or executor crashes. +* Fix incorrect wrapping of subquery output expressions in PlaceHolderVars (Tom Lane) [§](https://postgr.es/c/80bece312) + + This fixes incorrect results when a subquery is underneath an outer join and has an output column that laterally references something outside the outer join's scope. The output column might not appear as NULL when it should do so due to the action of the outer join. +* Fix misprocessing of window function run conditions (Richard Guo) [§](https://postgr.es/c/ee9553218) + + This oversight could lead to “WindowFunc not found in subplan target lists” errors. +* Fix detection of inner-side uniqueness for Memoize plans (Richard Guo) [§](https://postgr.es/c/74f770ef2) + + This mistake could lead to “cache entry already complete” errors. +* Fix computation of nullingrels when constant-folding field selection (Richard Guo) [§](https://postgr.es/c/6bf2efb38) + + Failure to do this led to errors like “wrong varnullingrels (b) (expected (b 3)) for Var 2/2”. +* Skip inappropriate actions when `MERGE` causes a cross-partition update (Dean Rasheed) [§](https://postgr.es/c/06a546382) + + When executing a `MERGE UPDATE` action on a partitioned table, if the `UPDATE` is turned into a `DELETE` and `INSERT` due to changing a partition key column, skip firing `AFTER UPDATE ROW` triggers, as well as other post-update actions such as RLS checks. These actions would typically fail, which is why a regular `UPDATE` doesn't do them in such cases; `MERGE` shouldn't either. +* Cope with `BEFORE ROW DELETE` triggers in cross-partition `MERGE` updates (Dean Rasheed) [§](https://postgr.es/c/7f07384dc) + + If such a trigger attempted to prevent the update by returning NULL, `MERGE` would suffer an error or assertion failure. +* Prevent access to a no-longer-pinned buffer in `BEFORE ROW UPDATE` triggers (Alexander Lakhin, Tom Lane) [§](https://postgr.es/c/23e0ba59c) + + If the tuple being updated had just been updated and moved to another page by another session, there was a narrow window where we would attempt to fetch data from the new tuple version without any pin on its buffer. In principle this could result in garbage data appearing in non-updated columns of the proposed new tuple. The odds of problems in practice seem rather low, however. +* Avoid requesting an oversize shared-memory area in parallel hash join (Thomas Munro, Andrei Lepikhov, Alexander Korotkov) [§](https://postgr.es/c/714a987bc) [§](https://postgr.es/c/20a566cd4) + + The limiting value was too large, allowing “invalid DSA memory alloc request size” errors to occur with sufficiently large expected hash table sizes. +* Fix corruption of local buffer state when an error occurs while trying to extend a temporary table (Tender Wang) [§](https://postgr.es/c/37c551663) +* Fix use of wrong tuple slot while evaluating `DISTINCT` aggregates that have multiple arguments (David Rowley) [§](https://postgr.es/c/6298673f4) + + This mistake could lead to errors such as “attribute 1 of type record has wrong type”. +* Avoid assertion failures in `heap_update()` and `heap_delete()` when a tuple to be updated by a foreign-key enforcement trigger fails the extra visibility crosscheck (Alexander Lakhin) [§](https://postgr.es/c/9fee3232a) + + This error had no impact in non-assert builds. +* Fix overly tight assertion about `false_positive_rate` parameter of BRIN bloom operator classes (Alexander Lakhin) [§](https://postgr.es/c/4dccf9575) + + This error had no impact in non-assert builds, either. +* Fix possible failure during `ALTER TABLE ADD COLUMN` on a complex inheritance tree (Tender Wang) [§](https://postgr.es/c/51193e7a7) + + If a grandchild table would inherit the new column via multiple intermediate parents, the command failed with “tuple already updated by self”. +* Fix problems with duplicate token names in `ALTER TEXT SEARCH CONFIGURATION ... MAPPING` commands (Tender Wang, Michael Paquier) [§](https://postgr.es/c/f33e83285) +* Fix `DROP ROLE` with duplicate role names (Michael Paquier) [§](https://postgr.es/c/f57a580fd) + + Previously this led to a “tuple already updated by self” failure. Instead, ignore the duplicate. +* Properly lock the associated table during `DROP STATISTICS` (Tomas Vondra) [§](https://postgr.es/c/ee32b824d) + + Failure to acquire the lock could result in “tuple concurrently deleted” errors if the `DROP` executes concurrently with `ANALYZE`. +* Fix function volatility checking for `GENERATED` and `DEFAULT` expressions (Tom Lane) [§](https://postgr.es/c/f07a3039c) + + These places could fail to detect insertion of a volatile function default-argument expression, or decide that a polymorphic function is volatile although it is actually immutable on the datatype of interest. This could lead to improperly rejecting or accepting a `GENERATED` clause, or to mistakenly applying the constant-default-value optimization in `ALTER TABLE ADD COLUMN`. +* Detect that a new catalog cache entry became stale while detoasting its fields (Tom Lane) [§](https://postgr.es/c/7e2561e1a) [§](https://postgr.es/c/56dcd71de) + + We expand any out-of-line fields in a catalog tuple before inserting it into the catalog caches. That involves database access which might cause invalidation of catalog cache entries — but the new entry isn't in the cache yet, so we would miss noticing that it should get invalidated. The result is a race condition in which an already-stale cache entry could get made, and then persist indefinitely. This would lead to hard-to-predict misbehavior. Fix by rechecking the tuple's visibility after detoasting. +* Fix edge-case integer overflow detection bug on some platforms (Dean Rasheed) [§](https://postgr.es/c/c396aca2b) + + Computing `0 - INT64_MIN` should result in an overflow error, and did on most platforms. However, platforms with neither integer overflow builtins nor 128-bit integers would fail to spot the overflow, instead returning `INT64_MIN`. +* Detect Julian-date overflow when adding or subtracting an `interval` to/from a `timestamp` (Tom Lane) [§](https://postgr.es/c/7204aea83) + + Some cases that should cause an out-of-range error produced an incorrect result instead. +* Add more checks for overflow in `interval_mul()` and `interval_div()` (Dean Rasheed) [§](https://postgr.es/c/72d0c135b) + + Some cases that should cause an out-of-range error produced an incorrect result instead. +* Allow `scram_SaltedPassword()` to be interrupted (Bowen Shi) [§](https://postgr.es/c/07cb7bc1c) + + With large `scram_iterations` values, this function could take a long time to run. Allow it to be interrupted by query cancel requests. +* Ensure cached statistics are discarded after a change to `stats_fetch_consistency` (Shinya Kato) [§](https://postgr.es/c/781bc121d) + + In some code paths, it was possible for stale statistics to be returned. +* Make the `pg_file_settings` view check validity of unapplied values for settings with `backend` or `superuser-backend` context (Tom Lane) [§](https://postgr.es/c/e87252ceb) + + Invalid values were not noted in the view as intended. This escaped detection because there are very few settings in these groups. +* Match collation too when matching an existing index to a new partitioned index (Peter Eisentraut) [§](https://postgr.es/c/267f33f68) + + Previously we could accept an index that has a different collation from the corresponding element of the partition key, possibly leading to misbehavior. +* Avoid failure if a child index is dropped concurrently with `REINDEX INDEX` on a partitioned index (Fei Changhong) [§](https://postgr.es/c/c030e263e) [§](https://postgr.es/c/7ce65c6f7) +* Fix insufficient locking when cleaning up an incomplete split of a GIN index's internal page (Fei Changhong, Heikki Linnakangas) [§](https://postgr.es/c/b899e00e7) + + The code tried to do this with shared rather than exclusive lock on the buffer. This could lead to index corruption if two processes attempted the cleanup concurrently. +* Avoid premature release of buffer pin in GIN index insertion (Tom Lane) [§](https://postgr.es/c/f76b975d5) + + If an index root page split occurs concurrently with our own insertion, the code could fail with “buffer NNNN is not owned by resource owner”. +* Avoid failure with partitioned SP-GiST indexes (Tom Lane) [§](https://postgr.es/c/0977bd64e) + + Trying to use an index of this kind could lead to “No such file or directory” errors. +* Fix ownership tests for large objects (Tom Lane) [§](https://postgr.es/c/152bfc0af) + + Operations on large objects that require ownership privilege failed with “unrecognized class ID: 2613”, unless run by a superuser. +* Fix ownership change reporting for large objects (Tom Lane) [§](https://postgr.es/c/152bfc0af) + + A no-op `ALTER LARGE OBJECT OWNER` command (that is, one selecting the existing owner) passed the wrong class ID to the `PostAlterHook`, probably confusing any extension using that hook. +* Fix reporting of I/O timing data in `EXPLAIN (BUFFERS)` (Michael Paquier) [§](https://postgr.es/c/db69101a1) + + The numbers labeled as “shared/local” actually refer only to shared buffers, so change that label to “shared”. +* Ensure durability of `CREATE DATABASE` (Noah Misch) [§](https://postgr.es/c/6d423e9ff) [§](https://postgr.es/c/48a6bf5c4) + + If an operating system crash occurred during or shortly after `CREATE DATABASE`, recovery could fail, or subsequent connections to the new database could fail. If a base backup was taken in that window, similar problems could be observed when trying to use the backup. The symptom would be that the database directory, `PG_VERSION` file, or `pg_filenode.map` file was missing or empty. +* Add more `LOG` messages when starting and ending recovery from a backup (Andres Freund) [§](https://postgr.es/c/edbd1b41a) + + This change provides additional information in the postmaster log that may be useful for diagnosing recovery problems. +* Prevent standby servers from incorrectly processing dead index tuples during subtransactions (Fei Changhong) [§](https://postgr.es/c/0e2c05af9) + + The `startedInRecovery` flag was not correctly set for a subtransaction. This affects only processing of dead index tuples. It could allow a query in a subtransaction to ignore index entries that it should return (if they are already dead on the primary server, but not dead to the standby transaction), or to prematurely mark index entries as dead that are not yet dead on the primary. It is not clear that the latter case has any serious consequences, but it's not the intended behavior. +* Fix signal handling in walreceiver processes (Heikki Linnakangas) [§](https://postgr.es/c/c5a6d5337) + + Revert a change that made walreceivers non-responsive to SIGTERM while waiting for the replication connection to be established. +* Fix integer overflow hazard in checking whether a record will fit into the WAL decoding buffer (Thomas Munro) [§](https://postgr.es/c/8ca56620c) + + This bug appears to be only latent except when running a 32-bit PostgreSQL build on a 64-bit platform. +* Fix deadlock between a logical replication apply worker, its tablesync worker, and a session process trying to alter the subscription (Shlok Kyal) [§](https://postgr.es/c/01cc92fa6) + + One edge of the deadlock loop did not involve a lock wait, so the deadlock went undetected and would persist until manual intervention. +* Ensure that column default values are correctly transmitted by the pgoutput logical replication plugin (Nikhil Benesch) [§](https://postgr.es/c/d7ca9209c) + + `ALTER TABLE ADD COLUMN` with a constant default value for the new column avoids rewriting existing tuples, instead expecting that reading code will insert the correct default into a tuple that lacks that column. If replication was subsequently initiated on the table, pgoutput would transmit NULL instead of the correct default for such a column, causing incorrect replication on the subscriber. +* Fix failure of logical replication's initial sync for a table with no columns (Vignesh C) [§](https://postgr.es/c/1b6da28e0) + + This case generated an improperly-formatted `COPY` command. +* Re-validate a subscription's connection string before use (Vignesh C) [§](https://postgr.es/c/4c03ac7e2) [§](https://postgr.es/c/5b5318c38) + + This is meant to detect cases where a subscription was created without a password (which is allowed to superusers) but then the subscription owner is changed to a non-superuser. +* Return the correct status code when a new client disconnects without responding to the server's password challenge (Liu Lang, Tom Lane) [§](https://postgr.es/c/fb464a1ae) + + In some cases we'd treat this as a loggable error, which was not the intention and tends to create log spam, since common clients like psql frequently do this. It may also confuse extensions that use `ClientAuthentication_hook`. +* Fix incompatibility with OpenSSL 3.2 (Tristan Partin, Bo Andreson) [§](https://postgr.es/c/efa8f6064) + + Use the BIO “app\_data” field for our private storage, instead of assuming it's okay to use the “data” field. This mistake didn't cause problems before, but with 3.2 it leads to crashes and complaints about double frees. +* Be more wary about OpenSSL not setting `errno` on error (Tom Lane) [§](https://postgr.es/c/ebbd499d4) + + If `errno` isn't set, assume the cause of the reported failure is read EOF. This fixes rare cases of strange error reports like “could not accept SSL connection: Success”. +* Fix file descriptor leakage when a foreign data wrapper's `ForeignAsyncRequest` function fails (Heikki Linnakangas) [§](https://postgr.es/c/501cfd07d) +* Fix minor memory leak in connection string validation for `CREATE SUBSCRIPTION` (Jeff Davis) [§](https://postgr.es/c/41820e640) +* Report ENOMEM errors from file-related system calls as `ERRCODE_OUT_OF_MEMORY`, not `ERRCODE_INTERNAL_ERROR` (Alexander Kuzmenkov) [§](https://postgr.es/c/a15378100) +* In PL/pgSQL, support SQL commands that are `CREATE FUNCTION`/`CREATE PROCEDURE` with SQL-standard bodies (Tom Lane) [§](https://postgr.es/c/00f941356) + + Previously, such cases failed with parsing errors due to the semicolon(s) appearing in the function body. +* Fix libpq's handling of errors in pipelines (Álvaro Herrera) [§](https://postgr.es/c/878aa41f8) [§](https://postgr.es/c/39aab1108) + + The pipeline state could get out of sync if an error is returned for reasons other than a query problem (for example, if the connection is lost). Potentially this would lead to a busy-loop in the calling application. +* Make libpq's `PQsendFlushRequest()` function flush the client output buffer under the same rules as other `PQsend` functions (Jelte Fennema-Nio) [§](https://postgr.es/c/42f832685) + + In pipeline mode, it may still be necessary to call `PQflush()` as well; but this change removes some inconsistency. +* Avoid race condition when libpq initializes OpenSSL support concurrently in two different threads (Willi Mann, Michael Paquier) [§](https://postgr.es/c/8984480b5) +* Fix timing-dependent failure in GSSAPI data transmission (Tom Lane) [§](https://postgr.es/c/85eb77185) + + When using GSSAPI encryption in non-blocking mode, libpq sometimes failed with “GSSAPI caller failed to retransmit all data needing to be retried”. +* Change initdb to always un-comment the `postgresql.conf` entries for the `lc_xxx` parameters (Kyotaro Horiguchi) [§](https://postgr.es/c/ba33775fd) + + initdb used to work this way before v16, and now it does again. The change caused initdb's `--no-locale` option to not have the intended effect on `lc_messages`. +* In pg\_dump, don't dump RLS policies or security labels for extension member objects (Tom Lane, Jacob Champion) [§](https://postgr.es/c/64d2467fc) [§](https://postgr.es/c/f1674ac6b) + + Previously, commands would be included in the dump to set these properties, which is really incorrect since they should be considered as internal affairs of the extension. Moreover, the restoring user might not have adequate privilege to set them, and indeed the dumping user might not have enough privilege to dump them (since dumping RLS policies requires acquiring lock on their table). +* In pg\_dump, don't dump an extended statistics object if its underlying table isn't being dumped (Rian McGuire, Tom Lane) [§](https://postgr.es/c/b2c9936a7) + + This conforms to the behavior for other dependent objects such as indexes. +* Properly detect out-of-memory in one code path in pg\_dump (Daniel Gustafsson) [§](https://postgr.es/c/5b5db413d) +* Make it an error for a pgbench script to end with an open pipeline (Anthonin Bonnefoy) [§](https://postgr.es/c/07b53de70) + + Previously, pgbench would behave oddly if a `\startpipeline` command lacked a matching `\endpipeline`. This seems like a scripting mistake rather than a case that pgbench needs to handle nicely, so throw an error. +* Fix crash in `contrib/intarray` if an array with an element equal to `INT_MAX` is inserted into a `gist__int_ops` index (Alexander Lakhin, Tom Lane) [§](https://postgr.es/c/cf6f802bf) +* Report a better error when `contrib/pageinspect`'s `hash_bitmap_info()` function is applied to a partitioned hash index (Alexander Lakhin, Michael Paquier) [§](https://postgr.es/c/7f68b1462) +* Report a better error when `contrib/pgstattuple`'s `pgstathashindex()` function is applied to a partitioned hash index (Alexander Lakhin) [§](https://postgr.es/c/b4948ed66) +* On Windows, suppress autorun options when launching subprocesses in pg\_ctl and pg\_regress (Kyotaro Horiguchi) [§](https://postgr.es/c/714bfb781) [§](https://postgr.es/c/506c77f9b) + + When launching a child process via `cmd.exe`, pass the `/D` flag to prevent executing any autorun commands specified in the registry. This avoids possibly-surprising side effects. +* Move `is_valid_ascii()` from `mb/pg_wchar.h` to `utils/ascii.h` (Jubilee Young) [§](https://postgr.es/c/1b924a86e) + + This change avoids the need to include `` in `pg_wchar.h`, which was causing problems for some third-party code. +* Fix compilation failures with libxml2 version 2.12.0 and later (Tom Lane) [§](https://postgr.es/c/e02fea093) +* Fix compilation failure of `WAL_DEBUG` code on Windows (Bharath Rupireddy) [§](https://postgr.es/c/6248a2bb9) +* Suppress compiler warnings from Python's header files (Peter Eisentraut, Tom Lane) [§](https://postgr.es/c/b0115e7e2) [§](https://postgr.es/c/c72049dbc) + + Our preferred compiler options provoke warnings about constructs appearing in recent versions of Python's header files. When using gcc, we can suppress these warnings with a pragma. +* Avoid deprecation warning when compiling with LLVM 18 (Thomas Munro) [§](https://postgr.es/c/60ba7cae7) +* Update time zone data files to tzdata release 2024a for DST law changes in Greenland, Kazakhstan, and Palestine, plus corrections for the Antarctic stations Casey and Vostok. Also historical corrections for Vietnam, Toronto, and Miquelon. (Tom Lane) [§](https://postgr.es/c/b4fb76fb5) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-16-3.html "E.9. Release 16.3") | [Up](release.html "Appendix E. Release Notes") | [Next](release-16-1.html "E.11. Release 16.1") | +| E.9. Release 16.3 | [Home](index.html "PostgreSQL 16.11 Documentation") | E.11. Release 16.1 | + +[Previous](/docs/release/16.1/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/16.3/) diff --git a/corpus/changelog/postgresql_releases/postgresql_163.md b/corpus/changelog/postgresql_releases/postgresql_163.md new file mode 100644 index 0000000000000000000000000000000000000000..8e99591204a808d7f997d919696f863353d43316 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_163.md @@ -0,0 +1,211 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/16.3/ +Version: 16.3 + +## PostgreSQL 16.3 + +| E.9. Release 16.3 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-16-4.html "E.8. Release 16.4") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 16.11 Documentation") | [Next](release-16-2.html "E.10. Release 16.2") | + +--- + +## E.9. Release 16.3 [#](#RELEASE-16-3) + +[E.9.1. Migration to Version 16.3](release-16-3.html#RELEASE-16-3-MIGRATION) + +[E.9.2. Changes](release-16-3.html#RELEASE-16-3-CHANGES) + +**Release date:**2024-05-09 + +This release contains a variety of fixes from 16.2. For information about new features in major release 16, see [Section E.12](release-16.html "E.12. Release 16"). + +### E.9.1. Migration to Version 16.3 [#](#RELEASE-16-3-MIGRATION) + +A dump/restore is not required for those running 16.X. + +However, a security vulnerability was found in the system views `pg_stats_ext` and `pg_stats_ext_exprs`, potentially allowing authenticated database users to see data they shouldn't. If this is of concern in your installation, follow the steps in the first changelog entry below to rectify it. + +Also, if you are upgrading from a version earlier than 16.2, see [Section E.10](release-16-2.html "E.10. Release 16.2"). + +### E.9.2. Changes [#](#RELEASE-16-3-CHANGES) + +* Restrict visibility of `pg_stats_ext` and `pg_stats_ext_exprs` entries to the table owner (Nathan Bossart) [§](https://postgr.es/c/2485a85e9) + + These views failed to hide statistics for expressions that involve columns the accessing user does not have permission to read. View columns such as `most_common_vals` might expose security-relevant data. The potential interactions here are not fully clear, so in the interest of erring on the side of safety, make rows in these views visible only to the owner of the associated table. + + The PostgreSQL Project thanks Lukas Fittl for reporting this problem. (CVE-2024-4317) + + By itself, this fix will only fix the behavior in newly initdb'd database clusters. If you wish to apply this change in an existing cluster, you will need to do the following: + + 1. Find the SQL script `fix-CVE-2024-4317.sql` in the *`share`* directory of the PostgreSQL installation (typically located someplace like `/usr/share/postgresql/`). Be sure to use the script appropriate to your PostgreSQL major version. If you do not see this file, either your version is not vulnerable (only v14–v16 are affected) or your minor version is too old to have the fix. + 2. In *each* database of the cluster, run the `fix-CVE-2024-4317.sql` script as superuser. In psql this would look like + + ```None + \i /usr/share/postgresql/fix-CVE-2024-4317.sql + ``` + + (adjust the file path as appropriate). Any error probably indicates that you've used the wrong script version. It will not hurt to run the script more than once. + 3. Do not forget to include the `template0` and `template1` databases, or the vulnerability will still exist in databases you create later. To fix `template0`, you'll need to temporarily make it accept connections. Do that with + + ```None + ALTER DATABASE template0 WITH ALLOW_CONNECTIONS true; + ``` + + and then after fixing `template0`, undo it with + + ```None + ALTER DATABASE template0 WITH ALLOW_CONNECTIONS false; + ``` +* Fix `INSERT` from multiple `VALUES` rows into a target column that is a domain over an array or composite type (Tom Lane) [§](https://postgr.es/c/52898c63e) + + Such cases would either fail with surprising complaints about mismatched datatypes, or insert unexpected coercions that could lead to odd results. +* Require `SELECT` privilege on the target table for `MERGE` with a `DO NOTHING` clause (Álvaro Herrera) [§](https://postgr.es/c/a3f5d2056) + + `SELECT` privilege would be required in all practical cases anyway, but require it even if the query reads no columns of the target table. This avoids an edge case in which `MERGE` would require no privileges whatever, which seems undesirable even when it's a do-nothing command. +* Fix handling of self-modified tuples in `MERGE` (Dean Rasheed) [§](https://postgr.es/c/dd73d10ad) + + Throw an error if a target row joins to more than one source row, as required by the SQL standard. (The previous coding could silently ignore this condition if a concurrent update was involved.) Also, throw a non-misleading error if a target row is already updated by a later command in the current transaction, thanks to a `BEFORE` trigger or a volatile function used in the query. +* Fix incorrect pruning of NULL partition when a table is partitioned on a boolean column and the query has a boolean `IS NOT` clause (David Rowley) [§](https://postgr.es/c/fb95cc72b) + + A NULL value satisfies a clause such as `boolcol IS NOT FALSE`, so pruning away a partition containing NULLs yielded incorrect answers. +* Make `ALTER FOREIGN TABLE SET SCHEMA` move any owned sequences into the new schema (Tom Lane) [§](https://postgr.es/c/7445f0928) + + Moving a regular table to a new schema causes any sequences owned by the table to be moved to that schema too (along with indexes and constraints). This was overlooked for foreign tables, however. +* Make `ALTER TABLE ... ADD COLUMN` create identity/serial sequences with the same persistence as their owning tables (Peter Eisentraut) [§](https://postgr.es/c/86d2b434c) + + `CREATE UNLOGGED TABLE` will make any owned sequences be unlogged too. `ALTER TABLE` missed that consideration, so that an added identity column would have a logged sequence, which seems pointless. +* Improve `ALTER TABLE ... ALTER COLUMN TYPE`'s error message when there is a dependent function or publication (Tom Lane) [§](https://postgr.es/c/11d40a44b) [§](https://postgr.es/c/b19255ca6) +* In `CREATE DATABASE`, recognize strategy keywords case-insensitively for consistency with other options (Tomas Vondra) [§](https://postgr.es/c/9e6faeb32) +* Fix `EXPLAIN`'s counting of heap pages accessed by a bitmap heap scan (Melanie Plageman) [§](https://postgr.es/c/1f4eb7342) + + Previously, heap pages that contain no visible tuples were not counted; but it seems more consistent to count all pages returned by the bitmap index scan. +* Fix `EXPLAIN`'s output for subplans in `MERGE` (Dean Rasheed) [§](https://postgr.es/c/34c854b93) + + `EXPLAIN` would sometimes fail to properly display subplan Params referencing variables in other parts of the plan tree. +* Avoid deadlock during removal of orphaned temporary tables (Mikhail Zhilin) [§](https://postgr.es/c/cbfbb14bd) + + If the session that creates a temporary table crashes without removing the table, autovacuum will eventually try to remove the orphaned table. However, an incoming session that's been assigned the same temporary namespace will do that too. If a temporary table has a dependency (such as an owned sequence) then a deadlock could result between these two cleanup attempts. +* Fix updating of visibility map state in `VACUUM` with the `DISABLE_PAGE_SKIPPING` option (Heikki Linnakangas) [§](https://postgr.es/c/407cb6c65) + + Due to an oversight, this mode caused all heap pages to be dirtied, resulting in excess I/O. Also, visibility map bits that were incorrectly set would not get cleared. +* Avoid race condition while examining per-relation frozen-XID values (Noah Misch) [§](https://postgr.es/c/92685c389) + + `VACUUM`'s computation of per-database frozen-XID values from per-relation values could get confused by a concurrent update of those values by another `VACUUM`. +* Fix buffer usage reporting for parallel vacuuming (Anthonin Bonnefoy) [§](https://postgr.es/c/f199436c1) + + Buffer accesses performed by parallel workers were not getting counted in the statistics reported in `VERBOSE` mode. +* Ensure that join conditions generated from equivalence classes are applied at the correct plan level (Tom Lane) [§](https://postgr.es/c/91800af13) + + In versions before PostgreSQL 16, it was possible for generated conditions to be evaluated below outer joins when they should be evaluated above (after) the outer join, leading to incorrect query results. All versions have a similar hazard when considering joins to `UNION ALL` trees that have constant outputs for the join column in some `SELECT` arms. +* Fix “could not find pathkey item to sort” errors occurring while planning aggregate functions with `ORDER BY` or `DISTINCT` options (David Rowley) [§](https://postgr.es/c/4e1ff2aad) + + This is similar to a fix applied in 16.1, but it solves the problem for parallel plans. +* Prevent potentially-incorrect optimization of some window functions (David Rowley) [§](https://postgr.es/c/9d36b883b) + + Disable “run condition” optimization of `ntile()` and `count()` with non-constant arguments. This avoids possible misbehavior with sub-selects, typically leading to errors like “WindowFunc not found in subplan target lists”. +* Avoid unnecessary use of moving-aggregate mode with a non-moving window frame (Vallimaharajan G) [§](https://postgr.es/c/a94f51a7b) + + When a plain aggregate is used as a window function, and the window frame start is specified as `UNBOUNDED PRECEDING`, the frame's head cannot move so we do not need to use the special (and more expensive) moving-aggregate mode. This optimization was intended all along, but due to a coding error it never triggered. +* Avoid use of already-freed data while planning partition-wise joins under GEQO (Tom Lane) [§](https://postgr.es/c/ef0333e67) + + This would typically end in a crash or unexpected error message. +* Avoid freeing still-in-use data in Memoize (Tender Wang, Andrei Lepikhov) [§](https://postgr.es/c/348233cb1) + + In production builds this error frequently didn't cause any problems, as the freed data would most likely not get overwritten before it was used. +* Fix incorrectly-reported statistics kind codes in “requested statistics kind *`X`* is not yet built” error messages (David Rowley) [§](https://postgr.es/c/ac7e6a01c) +* Use a hash table instead of linear search for “catcache list” objects (Tom Lane) [§](https://postgr.es/c/14e991db8) + + This change solves performance problems that were reported for certain operations in installations with many thousands of roles. +* Be more careful with `RECORD`-returning functions in `FROM` (Tom Lane) [§](https://postgr.es/c/cc1eb6a3c) [§](https://postgr.es/c/1b3029be5) + + The output columns of such a function call must be defined by an `AS` clause that specifies the column names and data types. If the actual function output value doesn't match that, an error is supposed to be thrown at runtime. However, some code paths would examine the actual value prematurely, and potentially issue strange errors or suffer assertion failures if it doesn't match expectations. +* Fix confusion about the return rowtype of SQL-language procedures (Tom Lane) [§](https://postgr.es/c/40d1bdeb7) + + A procedure implemented in SQL language that returns a single composite-type column would cause an assertion failure or core dump. +* Add protective stack depth checks to some recursive functions (Egor Chindyaskin) [§](https://postgr.es/c/760767182) +* Fix mis-rounding and overflow hazards in `date_bin()` (Moaaz Assali) [§](https://postgr.es/c/17db5436e) + + In the case where the source timestamp is before the origin timestamp and their difference is already an exact multiple of the stride, the code incorrectly subtracted the stride anyway. Also, detect some integer-overflow cases that would have produced incorrect results. +* Detect integer overflow when adding or subtracting an `interval` to/from a `timestamp` (Joseph Koshakow) [§](https://postgr.es/c/3752e3d21) + + Some cases that should cause an out-of-range error produced an incorrect result instead. +* Avoid race condition in `pg_get_expr()` (Tom Lane) [§](https://postgr.es/c/4eb261165) + + If the relation referenced by the argument is dropped concurrently, the function's intention is to return NULL, but sometimes it failed instead. +* Fix detection of old transaction IDs in XID status functions (Karina Litskevich) [§](https://postgr.es/c/e3e05adde) + + Transaction IDs more than 231 transactions in the past could be misidentified as recent, leading to misbehavior of `pg_xact_status()` or `txid_status()`. +* Ensure that a table's freespace map won't return a page that's past the end of the table (Ronan Dunklau) [§](https://postgr.es/c/4e62ba21a) + + Because the freespace map isn't WAL-logged, this was possible in edge cases involving an OS crash, a replica promote, or a PITR restore. The result would be a “could not read block” error. +* Fix file descriptor leakage when an error is thrown while waiting in `WaitEventSetWait` (Etsuro Fujita) [§](https://postgr.es/c/e79ceafe9) +* Avoid corrupting exception stack if an FDW implements async append but doesn't configure any wait conditions for the Append plan node to wait for (Alexander Pyhalov) [§](https://postgr.es/c/f6f61a4bd) +* Throw an error if an index is accessed while it is being reindexed (Tom Lane) [§](https://postgr.es/c/8c785d354) + + Previously this was just an assertion check, but promote it into a regular runtime error. This will provide a more on-point error message when reindexing a user-defined index expression that attempts to access its own table. +* Ensure that index-only scans on `name` columns return a fully-padded value (David Rowley) [§](https://postgr.es/c/68d358545) + + The value physically stored in the index is truncated, and previously a pointer to that value was returned to callers. This provoked complaints when testing under valgrind. In theory it could result in crashes, though none have been reported. +* Fix race condition that could lead to reporting an incorrect conflict cause when invalidating a replication slot (Bertrand Drouvot) [§](https://postgr.es/c/59cea09f0) +* Fix race condition in deciding whether a table sync operation is needed in logical replication (Vignesh C) [§](https://postgr.es/c/a9155efc7) + + An invalidation event arriving while a subscriber identifies which tables need to be synced would be forgotten about, so that any tables newly in need of syncing might not get processed in a timely fashion. +* Fix crash with DSM allocations larger than 4GB (Heikki Linnakangas) [§](https://postgr.es/c/f2f09b825) +* Disconnect if a new server session's client socket cannot be put into non-blocking mode (Heikki Linnakangas) [§](https://postgr.es/c/539e328b1) + + It was once theoretically possible for us to operate with a socket that's in blocking mode; but that hasn't worked fully in a long time, so fail at connection start rather than misbehave later. +* Fix inadequate error reporting with OpenSSL 3.0.0 and later (Heikki Linnakangas, Tom Lane) [§](https://postgr.es/c/6a2c80e95) + + System-reported errors passed through by OpenSSL were reported with a numeric error code rather than anything readable. +* Fix thread-safety of error reporting for `getaddrinfo()` on Windows (Thomas Munro) [§](https://postgr.es/c/0460e4ecc) + + A multi-threaded libpq client program could get an incorrect or corrupted error message after a network lookup failure. +* Avoid concurrent calls to `bindtextdomain()` in libpq and ecpglib (Tom Lane) [§](https://postgr.es/c/52afe5632) [§](https://postgr.es/c/9440d23a0) + + Although GNU gettext's implementation seems to be fine with concurrent calls, the version available on Windows is not. +* Fix crash in ecpg's preprocessor if the program tries to redefine a macro that was defined on the preprocessor command line (Tom Lane) [§](https://postgr.es/c/392e6e9e6) [§](https://postgr.es/c/0018f0af5) [§](https://postgr.es/c/dd3fddc85) +* In ecpg, avoid issuing false “unsupported feature will be passed to server” warnings (Tom Lane) [§](https://postgr.es/c/118558e6d) +* Ensure that the string result of ecpg's `intoasc()` function is correctly zero-terminated (Oleg Tselebrovskiy) [§](https://postgr.es/c/88e03d055) +* In initdb's `-c` option, match parameter names case-insensitively (Tom Lane) [§](https://postgr.es/c/b78f4d22b) + + The server treats parameter names case-insensitively, so this code should too. This avoids putting redundant entries into the generated `postgresql.conf` file. +* In psql, avoid leaking a query result after the query is cancelled (Tom Lane) [§](https://postgr.es/c/a85e3ba1c) + + This happened only when cancelling a non-last query in a query string made with `\;` separators. +* Fix pg\_dumpall so that role comments, if present, will be dumped regardless of the setting of `--no-role-passwords` (Daniel Gustafsson, Álvaro Herrera) [§](https://postgr.es/c/5863bacb8) +* Skip files named `.DS_Store` in pg\_basebackup, pg\_checksums, and pg\_rewind (Daniel Gustafsson) [§](https://postgr.es/c/103235888) + + This avoids problems on macOS, where the Finder may create such files. +* Fix PL/pgSQL's parsing of single-line comments (`--`-style comments) following expressions (Erik Wienhold, Tom Lane) [§](https://postgr.es/c/48f216dc6) + + This mistake caused parse errors if such a comment followed a `WHEN` expression in a PL/pgSQL `CASE` statement. +* In `contrib/amcheck`, don't report false match failures due to short- versus long-header values (Andrey Borodin, Michael Zhilin) [§](https://postgr.es/c/3676b846b) [§](https://postgr.es/c/a6ddb8ad0) + + A variable-length datum in a heap tuple or index tuple could have either a short or a long header, depending on compression parameters that applied when it was made. Treat these cases as equivalent rather than complaining if there's a difference. +* Fix bugs in BRIN output functions (Tomas Vondra) [§](https://postgr.es/c/8cea358b1) [§](https://postgr.es/c/ccd8f0fa1) + + These output functions are only used for displaying index entries in `contrib/pageinspect`, so the errors are of limited practical concern. +* In `contrib/postgres_fdw`, avoid emitting requests to sort by a constant (David Rowley) [§](https://postgr.es/c/6a9e2cb2b) + + This could occur in cases involving `UNION ALL` with constant-emitting subqueries. Sorting by a constant is useless of course, but it also risks being misinterpreted by the remote server, leading to “ORDER BY position *`N`* is not in select list” errors. +* Make `contrib/postgres_fdw` set the remote session's time zone to `GMT` not `UTC` (Tom Lane) [§](https://postgr.es/c/75929b6cf) + + This should have the same results for practical purposes. However, `GMT` is recognized by hard-wired code in the server, while `UTC` is looked up in the timezone database. So the old code could fail in the unlikely event that the remote server's timezone database is missing entries. +* In `contrib/xml2`, avoid use of library functions that have been deprecated in recent versions of libxml2 (Dmitry Koval) [§](https://postgr.es/c/7c93f31de) +* Fix incompatibility with LLVM 18 (Thomas Munro, Dmitry Dolgov) [§](https://postgr.es/c/bf1cfe77e) +* Allow `make check` to work with the musl C library (Thomas Munro, Bruce Momjian, Tom Lane) [§](https://postgr.es/c/7651fd387) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-16-4.html "E.8. Release 16.4") | [Up](release.html "Appendix E. Release Notes") | [Next](release-16-2.html "E.10. Release 16.2") | +| E.8. Release 16.4 | [Home](index.html "PostgreSQL 16.11 Documentation") | E.10. Release 16.2 | + +[Previous](/docs/release/16.2/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/16.4/) diff --git a/corpus/changelog/postgresql_releases/postgresql_164.md b/corpus/changelog/postgresql_releases/postgresql_164.md new file mode 100644 index 0000000000000000000000000000000000000000..9915dbc0a141240dddbe69b39f2241c6e8190e3e --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_164.md @@ -0,0 +1,196 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/16.4/ +Version: 16.4 + +## PostgreSQL 16.4 + +| E.8. Release 16.4 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-16-5.html "E.7. Release 16.5") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 16.11 Documentation") | [Next](release-16-3.html "E.9. Release 16.3") | + +--- + +## E.8. Release 16.4 [#](#RELEASE-16-4) + +[E.8.1. Migration to Version 16.4](release-16-4.html#RELEASE-16-4-MIGRATION) + +[E.8.2. Changes](release-16-4.html#RELEASE-16-4-CHANGES) + +**Release date:**2024-08-08 + +This release contains a variety of fixes from 16.3. For information about new features in major release 16, see [Section E.12](release-16.html "E.12. Release 16"). + +### E.8.1. Migration to Version 16.4 [#](#RELEASE-16-4-MIGRATION) + +A dump/restore is not required for those running 16.X. + +However, if you are upgrading from a version earlier than 16.3, see [Section E.9](release-16-3.html "E.9. Release 16.3"). + +### E.8.2. Changes [#](#RELEASE-16-4-CHANGES) + +* Prevent unauthorized code execution during pg\_dump (Masahiko Sawada) [§](https://postgr.es/c/6aba85a4b) + + An attacker able to create and drop non-temporary objects could inject SQL code that would be executed by a concurrent pg\_dump session with the privileges of the role running pg\_dump (which is often a superuser). The attack involves replacing a sequence or similar object with a view or foreign table that will execute malicious code. To prevent this, introduce a new server parameter `restrict_nonsystem_relation_kind` that can disable expansion of non-builtin views as well as access to foreign tables, and teach pg\_dump to set it when available. Note that the attack is prevented only if both pg\_dump and the server it is dumping from are new enough to have this fix. + + The PostgreSQL Project thanks Noah Misch for reporting this problem. (CVE-2024-7348) +* Avoid incorrect results from Merge Right Anti Join plans (Richard Guo) [§](https://postgr.es/c/507f2347e) + + If the inner relation is known to have unique join keys, the merge could misbehave when there are duplicated join keys in the outer relation. +* Prevent infinite loop in `VACUUM` (Melanie Plageman) [§](https://postgr.es/c/06bf404cd) + + After a disconnected standby server with an old running transaction reconnected to the primary, it was possible for `VACUUM` on the primary to get confused about which tuples are removable, resulting in an infinite loop. +* Fix failure after attaching a table as a partition, if the table had previously had inheritance children (Álvaro Herrera) [§](https://postgr.es/c/084814d88) +* Fix `ALTER TABLE DETACH PARTITION` for cases involving inconsistent index-based constraints (Álvaro Herrera, Tender Wang) [§](https://postgr.es/c/00a40e33c) [§](https://postgr.es/c/34eb37f79) + + When a partitioned table has an index that is not associated with a constraint, but a partition has an equivalent index that is, then detaching the partition would misbehave, leaving the ex-partition's constraint with an incorrect `coninhcount` value. This would cause trouble during any further manipulations of that constraint. +* Fix partition pruning setup during `ALTER TABLE DETACH PARTITION CONCURRENTLY` (Álvaro Herrera) [§](https://postgr.es/c/96105ebfe) [§](https://postgr.es/c/bf78abebf) + + The executor assumed that no partition could be detached between planning and execution of a query on a partitioned table. This is no longer true since the introduction of `DETACH PARTITION`'s `CONCURRENTLY` option, making it possible for query execution to fail transiently when that is used. +* Correctly update a partitioned table's `pg_class`.`reltuples` field to zero after its last child partition is dropped (Noah Misch) [§](https://postgr.es/c/e81deeefc) + + The first `ANALYZE` on such a partitioned table must update `relhassubclass` as well, and that caused the `reltuples` update to be lost. +* Fix handling of polymorphic output arguments for procedures (Tom Lane) [§](https://postgr.es/c/8e0e99972) [§](https://postgr.es/c/bb331af4a) + + The SQL `CALL` statement did not resolve the correct data types for such arguments, leading to errors such as “cannot display a value of type anyelement”, or even outright crashes. (But `CALL` in PL/pgSQL worked correctly.) +* Fix behavior of stable functions called from a `CALL` statement's argument list (Tom Lane) [§](https://postgr.es/c/0d18b8eb4) + + If the `CALL` is within an atomic context (e.g. there's an outer transaction block), such functions were passed the wrong snapshot, causing them to see stale values of rows modified since the start of the outer transaction. +* Fix input of ISO-8601 “extended” time format for types `time` and `timetz` (Tom Lane) [§](https://postgr.es/c/019ea7675) + + Re-allow cases such as `T12:34:56`. +* Detect integer overflow in `money` calculations (Joseph Koshakow) [§](https://postgr.es/c/34e9dce69) + + None of the arithmetic functions for the `money` type checked for overflow before, so they would silently give wrong answers for overflowing cases. +* Fix over-aggressive clamping of the scale argument in `round(numeric)` and `trunc(numeric)` (Dean Rasheed) [§](https://postgr.es/c/f7aec8c1d) + + These functions clamped their scale argument to +/-2000, but there are valid use-cases for it to be larger; the functions returned incorrect results in such cases. Instead clamp to the actual allowed range of type `numeric`. +* Fix result for `pg_size_pretty()` when applied to the smallest possible `bigint` value (Joseph Koshakow) [§](https://postgr.es/c/6f6b0f193) +* Prevent `pg_sequence_last_value()` from failing on unlogged sequences on standby servers and on temporary sequences of other sessions (Nathan Bossart) [§](https://postgr.es/c/c1664c8ee) + + Make it return NULL in these cases instead of throwing an error. +* Fix parsing of ignored operators in `websearch_to_tsquery()` (Tom Lane) [§](https://postgr.es/c/086ecd12b) + + Per the manual, punctuation in the input of `websearch_to_tsquery()` is ignored except for the special cases of dashes and quotes. However, parentheses and a few other characters appearing immediately before an `or` could cause `or` to be treated as a data word, rather than as an `OR` operator as expected. +* Detect another integer overflow case while computing new array dimensions (Joseph Koshakow) [§](https://postgr.es/c/a57d16865) + + Reject applying array dimensions `[-2147483648:2147483647]` to an empty array. This is closely related to CVE-2023-5869, but appears harmless since the array still ends up empty. +* Fix unportable usage of `strnxfrm()` (Jeff Davis) [§](https://postgr.es/c/403cbd210) + + Some code paths for non-deterministic collations could fail with errors like “pg\_strnxfrm() returned unexpected result”. +* Detect another case of a new catalog cache entry becoming stale while detoasting its fields (Noah Misch) [§](https://postgr.es/c/e4afd7153) + + An in-place update occurring while we expand out-of-line fields in a catalog tuple could be missed, leading to a catalog cache entry that lacks the in-place change but is not known to be stale. This is only possible in the `pg_database` catalog, so the effects are narrow, but misbehavior is possible. +* Correctly check updatability of view columns targeted by `INSERT` ... `DEFAULT` (Tom Lane) [§](https://postgr.es/c/fd958bbbd) + + If such a column is non-updatable, we should give an error reporting that. But the check was missed and then later code would report an unhelpful error such as “attribute number *`N`* not found in view targetlist”. +* Avoid reporting an unhelpful internal error for incorrect recursive queries (Tom Lane) [§](https://postgr.es/c/8fc487614) + + Rearrange the order of error checks so that we throw an on-point error when a `WITH RECURSIVE` query does not have a self-reference within the second arm of the `UNION`, but does have one self-reference in some other place such as `ORDER BY`. +* Lock owned sequences during `ALTER TABLE SET LOGGED|UNLOGGED` (Noah Misch) [§](https://postgr.es/c/112d05570) + + These commands change the persistence of a table's owned sequences along with the table, but they failed to acquire lock on the sequences while doing so. This could result in losing the effects of concurrent `nextval()` calls. +* Don't throw an error if a queued `AFTER` trigger no longer exists (Tom Lane) [§](https://postgr.es/c/4f1966676) + + It's possible for a transaction to execute an operation that queues a deferred `AFTER` trigger for later execution, and then to drop the trigger before that happens. Formerly this led to weird errors such as “could not find trigger *`NNNN`*”. It seems better to silently do nothing if the trigger no longer exists at the time when it would have been executed. +* Fix failure to remove `pg_init_privs` entries for column-level privileges when their table is dropped (Tom Lane) [§](https://postgr.es/c/9cf4beb9e) + + If an extension grants some column-level privileges on a table it creates, relevant catalog entries would remain behind after the extension is dropped. This was harmless until/unless the table's OID was re-used for another relation, when it could interfere with what pg\_dump dumps for that relation. +* Fix selection of an arbiter index for `ON CONFLICT` when the desired index has expressions or predicates (Tom Lane) [§](https://postgr.es/c/b188e1bf7) + + If a query using `ON CONFLICT` accesses the target table through an updatable view, it could fail with “there is no unique or exclusion constraint matching the ON CONFLICT specification”, even though a matching index does exist. +* Refuse to modify a temporary table of another session with `ALTER TABLE` (Tom Lane) [§](https://postgr.es/c/8397f161e) + + Permissions checks normally would prevent this case from arising, but it is possible to reach it by altering a parent table whose child is another session's temporary table. Throw an error if we discover that such a child table belongs to another session. +* Fix handling of extended statistics on expressions in `CREATE TABLE LIKE STATISTICS` (Tom Lane) [§](https://postgr.es/c/2aa90c02d) + + The `CREATE` command failed to adjust column references in statistics expressions to the possibly-different column numbering of the new table. This resulted in invalid statistics objects that would cause problems later. A typical scenario where renumbering columns is needed is when the source table contains some dropped columns. +* Fix failure to recalculate sub-queries generated from `MIN()` or `MAX()` aggregates (Tom Lane) [§](https://postgr.es/c/ce0d16544) + + In some cases the aggregate result computed at one row of the outer query could be re-used for later rows when it should not be. This has only been seen to happen when the outer query uses `DISTINCT` that is implemented with hash aggregation, but other cases may exist. +* Re-forbid underscore in positional parameters (Erik Wienhold) [§](https://postgr.es/c/315661eca) + + As of v16 we allow integer literals to contain underscores. This change caused input such as `$1_234` to be taken as a single token, but it did not work correctly. It seems better to revert to the original definition in which a parameter symbol is only `$` followed by digits. +* Avoid crashing when a JIT-inlined backend function throws an error (Tom Lane) [§](https://postgr.es/c/07d66d3cc) + + The error state can include pointers into the dynamically loaded module holding the JIT-compiled code (for error location strings). In some code paths the module could get unloaded before the error report is processed, leading to SIGSEGV when the location strings are accessed. +* Cope with behavioral changes in libxml2 version 2.13.x (Erik Wienhold, Tom Lane) [§](https://postgr.es/c/f85c91a18) + + Notably, we now suppress “chunk is not well balanced” errors from libxml2, unless that is the only reported error. This is to make error reports consistent between 2.13.x and earlier libxml2 versions. In earlier versions, that message was almost always redundant or outright incorrect, so 2.13.x substantially reduced the number of cases in which it's reported. +* Fix handling of subtransactions of prepared transactions when starting a hot standby server (Heikki Linnakangas) [§](https://postgr.es/c/b5b418b68) + + When starting a standby's replay at a shutdown checkpoint WAL record, transactions that had been prepared but not yet committed on the primary are correctly understood as being still in progress. But subtransactions of a prepared transaction (created by savepoints or PL/pgSQL exception blocks) were not accounted for and would be treated as aborted. That led to inconsistency if the prepared transaction was later committed. +* Prevent incorrect initialization of logical replication slots (Masahiko Sawada) [§](https://postgr.es/c/2f3304ce1) + + In some cases a replication slot's start point within the WAL stream could be set to a point within a transaction, leading to assertion failures or incorrect decoding results. +* Avoid “can only drop stats once” error during replication slot creation and drop (Floris Van Nee) [§](https://postgr.es/c/f2c922ff2) +* Fix resource leakage in logical replication WAL sender (Hou Zhijie) [§](https://postgr.es/c/b8f953d8d) + + The walsender process leaked memory when publishing changes to a partitioned table whose partitions have row types physically different from the partitioned table's. +* Avoid memory leakage after servicing a notify or sinval interrupt (Tom Lane) [§](https://postgr.es/c/54a7b21b3) + + The processing functions for these events could switch the current memory context to TopMemoryContext, resulting in session-lifespan leakage of any data allocated before the incorrect setting gets replaced. There were observable leaks associated with (at least) encoding conversion of incoming queries and parameters attached to Bind messages. +* Prevent leakage of reference counts for the shared memory block used for statistics (Anthonin Bonnefoy) [§](https://postgr.es/c/6f61d0e7e) + + A new backend process attaching to the statistics shared memory incremented its reference count, but failed to decrement the count when exiting. After 232 sessions had been created, the reference count would overflow to zero, causing failures in all subsequent backend process starts. +* Prevent deadlocks and assertion failures during truncation of the multixact SLRU log (Heikki Linnakangas) [§](https://postgr.es/c/e7cbe5a85) + + A process trying to delete SLRU segments could deadlock with the checkpointer process. +* Avoid possibly missing end-of-input events on Windows sockets (Thomas Munro) [§](https://postgr.es/c/a622095bc) + + Windows reports an FD\_CLOSE event only once after the remote end of the connection disconnects. With unlucky timing, we could miss that report and wait indefinitely, or at least until a timeout elapsed, expecting more input. +* Fix buffer overread in JSON parse error reports for incomplete byte sequences (Jacob Champion) [§](https://postgr.es/c/5396a2987) + + It was possible to walk off the end of the input buffer by a few bytes when the last bytes comprise an incomplete multi-byte character. While usually harmless, in principle this could cause a crash. +* Disable creation of stateful TLS session tickets by OpenSSL (Daniel Gustafsson) [§](https://postgr.es/c/cc606afce) [§](https://postgr.es/c/83b4a6358) [§](https://postgr.es/c/441eba34d) + + This avoids possible failures with clients that think receipt of a session ticket means that TLS session resumption is supported. +* When replanning a PL/pgSQL “simple expression”, check it's still simple (Tom Lane) [§](https://postgr.es/c/82a931d3d) + + Certain fairly-artificial cases, such as dropping a referenced function and recreating it as an aggregate, could lead to surprising failures such as “unexpected plan node type”. +* Fix PL/pgSQL's handling of integer ranges containing underscores (Erik Wienhold) [§](https://postgr.es/c/b4e909082) + + As of v16 we allow integer literals to contain underscores, but PL/pgSQL failed to handle examples such as `FOR i IN 1_001..1_003`. +* Fix recursive `RECORD`-returning PL/Python functions (Tom Lane) [§](https://postgr.es/c/52ea653aa) + + If we recurse to a new call of the same function that passes a different column definition list (`AS` clause), it would fail because the inner call would overwrite the outer call's idea of what rowtype to return. +* Don't corrupt PL/Python's `TD` dictionary during a recursive trigger call (Tom Lane) [§](https://postgr.es/c/be18a12b6) + + If a PL/Python-language trigger caused another one to be invoked, the `TD` dictionary created for the inner one would overwrite the outer one's `TD` dictionary. +* Fix PL/Tcl's reporting of invalid list syntax in the result of a function returning tuple (Erik Wienhold, Tom Lane) [§](https://postgr.es/c/c236ecc82) + + Such a case could result in a crash, or in emission of misleading context information that actually refers to the previous Tcl error. +* Avoid non-thread-safe usage of `strerror()` in libpq (Peter Eisentraut) [§](https://postgr.es/c/c53016860) + + Certain error messages returned by OpenSSL could become garbled in multi-threaded applications. +* Avoid memory leak within pg\_dump during a binary upgrade (Daniel Gustafsson) [§](https://postgr.es/c/0ae05c18e) +* Ensure that `pg_restore` `-l` reports dependent TOC entries correctly (Tom Lane) [§](https://postgr.es/c/5dce8ce0a) + + If `-l` was specified together with selective-restore options such as `-n` or `-N`, dependent TOC entries such as comments would be omitted from the listing, even when an actual restore would have selected them. +* Allow `contrib/pg_stat_statements` to distinguish among utility statements appearing within SQL-language functions (Anthonin Bonnefoy) [§](https://postgr.es/c/9cd365f28) + + The SQL-language function executor failed to pass along the query ID that is computed for a utility (non `SELECT`/`INSERT`/`UPDATE`/`DELETE`/`MERGE`) statement. +* Avoid “cursor can only scan forward” error in `contrib/postgres_fdw` (Etsuro Fujita) [§](https://postgr.es/c/d97f2ee50) + + This error could occur if the remote server is v15 or later and a foreign table is mapped to a non-trivial remote view. +* In `contrib/postgres_fdw`, do not send `FETCH FIRST WITH TIES` clauses to the remote server (Japin Li) [§](https://postgr.es/c/8405d5a37) + + The remote server might not implement this clause, or might interpret it differently than we would locally, so don't risk attempting remote execution. +* Avoid clashing with system-provided `` headers (Thomas Munro) [§](https://postgr.es/c/31423bc44) + + This fixes a compilation failure on macOS version 15 and up. +* Fix otherwise-harmless assertion failure in Memoize cost estimation (David Rowley) [§](https://postgr.es/c/6143c9c03) +* Fix otherwise-harmless assertion failures in `REINDEX CONCURRENTLY` applied to an SP-GiST index (Tom Lane) [§](https://postgr.es/c/06f81fed3) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-16-5.html "E.7. Release 16.5") | [Up](release.html "Appendix E. Release Notes") | [Next](release-16-3.html "E.9. Release 16.3") | +| E.7. Release 16.5 | [Home](index.html "PostgreSQL 16.11 Documentation") | E.9. Release 16.3 | + +[Previous](/docs/release/16.3/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/16.5/) diff --git a/corpus/changelog/postgresql_releases/postgresql_165.md b/corpus/changelog/postgresql_releases/postgresql_165.md new file mode 100644 index 0000000000000000000000000000000000000000..51dca658ca4fea79aa5dc99c0cea7eab794bcd71 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_165.md @@ -0,0 +1,229 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/16.5/ +Version: 16.5 + +## PostgreSQL 16.5 + +| E.7. Release 16.5 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-16-6.html "E.6. Release 16.6") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 16.11 Documentation") | [Next](release-16-4.html "E.8. Release 16.4") | + +--- + +## E.7. Release 16.5 [#](#RELEASE-16-5) + +[E.7.1. Migration to Version 16.5](release-16-5.html#RELEASE-16-5-MIGRATION) + +[E.7.2. Changes](release-16-5.html#RELEASE-16-5-CHANGES) + +**Release date:**2024-11-14 + +This release contains a variety of fixes from 16.4. For information about new features in major release 16, see [Section E.12](release-16.html "E.12. Release 16"). + +### E.7.1. Migration to Version 16.5 [#](#RELEASE-16-5-MIGRATION) + +A dump/restore is not required for those running 16.X. + +However, if you have ever detached a partition from a partitioned table that has a foreign-key reference to another partitioned table, and not dropped the former partition, then you may have catalog and/or data corruption to repair, as detailed in the fifth changelog entry below. + +Also, if you are upgrading from a version earlier than 16.3, see [Section E.9](release-16-3.html "E.9. Release 16.3"). + +### E.7.2. Changes [#](#RELEASE-16-5-CHANGES) + +* Ensure cached plans are marked as dependent on the calling role when RLS applies to a non-top-level table reference (Nathan Bossart) [§](https://postgr.es/c/562289460) + + If a CTE, subquery, sublink, security invoker view, or coercion projection in a query references a table with row-level security policies, we neglected to mark the resulting plan as potentially dependent on which role is executing it. This could lead to later query executions in the same session using the wrong plan, and then returning or hiding rows that should have been hidden or returned instead. + + The PostgreSQL Project thanks Wolfgang Walther for reporting this problem. (CVE-2024-10976) +* Make libpq discard error messages received during SSL or GSS protocol negotiation (Jacob Champion) [§](https://postgr.es/c/67d28bd02) + + An error message received before encryption negotiation is completed might have been injected by a man-in-the-middle, rather than being real server output. Reporting it opens the door to various security hazards; for example, the message might spoof a query result that a careless user could mistake for correct output. The best answer seems to be to discard such data and rely only on libpq's own report of the connection failure. + + The PostgreSQL Project thanks Jacob Champion for reporting this problem. (CVE-2024-10977) +* Fix unintended interactions between `SET SESSION AUTHORIZATION` and `SET ROLE` (Tom Lane) [§](https://postgr.es/c/ae340d031) [§](https://postgr.es/c/95f5a5237) + + The SQL standard mandates that `SET SESSION AUTHORIZATION` have a side-effect of doing `SET ROLE NONE`. Our implementation of that was flawed, creating more interaction between the two settings than intended. Notably, rolling back a transaction that had done `SET SESSION AUTHORIZATION` would revert `ROLE` to `NONE` even if that had not been the previous state, so that the effective user ID might now be different from what it had been before the transaction. Transiently setting `session_authorization` in a function `SET` clause had a similar effect. A related bug was that if a parallel worker inspected `current_setting('role')`, it saw `none` even when it should see something else. + + The PostgreSQL Project thanks Tom Lane for reporting this problem. (CVE-2024-10978) +* Prevent trusted PL/Perl code from changing environment variables (Andrew Dunstan, Noah Misch) [§](https://postgr.es/c/8fe3e697a) [§](https://postgr.es/c/88269df4d) [§](https://postgr.es/c/168579e23) [§](https://postgr.es/c/c335264c9) [§](https://postgr.es/c/64df88700) + + The ability to manipulate process environment variables such as `PATH` gives an attacker opportunities to execute arbitrary code. Therefore, “trusted” PLs must not offer the ability to do that. To fix `plperl`, replace `%ENV` with a tied hash that rejects any modification attempt with a warning. Untrusted `plperlu` retains the ability to change the environment. + + The PostgreSQL Project thanks Coby Abrams for reporting this problem. (CVE-2024-10979) +* Fix updates of catalog state for foreign-key constraints when attaching or detaching table partitions (Jehan-Guillaume de Rorthais, Tender Wang, Álvaro Herrera) [§](https://postgr.es/c/2aaf2a28b) [§](https://postgr.es/c/f7d510a38) + + If the referenced table is partitioned, then different catalog entries are needed for a referencing table that is stand-alone versus one that is a partition. `ATTACH/DETACH PARTITION` commands failed to perform this conversion correctly. In particular, after `DETACH` the now stand-alone table would be missing foreign-key enforcement triggers, which could result in the table later containing rows that fail the foreign-key constraint. A subsequent re-`ATTACH` could fail with surprising errors, too. + + The way to fix this is to do `ALTER TABLE DROP CONSTRAINT` on the now stand-alone table for each faulty constraint, and then re-add the constraint. If re-adding the constraint fails, then some erroneous data has crept in. You will need to manually re-establish consistency between the referencing and referenced tables, then re-add the constraint. + + This query can be used to identify broken constraints and construct the commands needed to recreate them: + + ```None + SELECT conrelid::pg_catalog.regclass AS "constrained table", + conname AS constraint, + confrelid::pg_catalog.regclass AS "references", + pg_catalog.format('ALTER TABLE %s DROP CONSTRAINT %I;', + conrelid::pg_catalog.regclass, conname) AS "drop", + pg_catalog.format('ALTER TABLE %s ADD CONSTRAINT %I %s;', + conrelid::pg_catalog.regclass, conname, + pg_catalog.pg_get_constraintdef(oid)) AS "add" + FROM pg_catalog.pg_constraint c + WHERE contype = 'f' AND conparentid = 0 AND + (SELECT count(*) FROM pg_catalog.pg_constraint c2 + WHERE c2.conparentid = c.oid) <> + ((SELECT count(*) FROM pg_catalog.pg_inherits i + WHERE (i.inhparent = c.conrelid OR i.inhparent = c.confrelid) AND + EXISTS (SELECT 1 FROM pg_catalog.pg_partitioned_table + WHERE partrelid = i.inhparent)) + + CASE WHEN pg_catalog.pg_partition_root(conrelid) = confrelid THEN + (SELECT count(*) FROM pg_catalog.pg_partition_tree(confrelid) + WHERE level = 1) + ELSE 0 END); + ``` + + Since it is possible that one or more of the `ADD CONSTRAINT` steps will fail, you should save the query's output in a file and then attempt to perform each step. +* Avoid possible crashes and “could not open relation” errors in queries on a partitioned table occurring concurrently with a `DETACH CONCURRENTLY` and immediate drop of a partition (Álvaro Herrera, Kuntal Gosh) [§](https://postgr.es/c/a6ff329e7) [§](https://postgr.es/c/1b9dd6b05) +* Disallow `ALTER TABLE ATTACH PARTITION` if the table to be attached has a foreign key referencing the partitioned table (Álvaro Herrera) [§](https://postgr.es/c/ada34d714) [§](https://postgr.es/c/57c8b8726) + + This arrangement is not supported, and other ways of creating it already fail. +* Don't use partitionwise joins or grouping if the query's collation for the key column doesn't match the partition key's collation (Jian He, Webbo Han) [§](https://postgr.es/c/f734b6b4d) [§](https://postgr.es/c/dd2f8ebee) + + Such plans could produce incorrect results. +* Fix possible “could not find pathkey item to sort” error when the output of a `UNION ALL` member query needs to be sorted, and the sort column is an expression (Andrei Lepikhov, Tom Lane) [§](https://postgr.es/c/64635c8af) +* Fix performance regressions involving flattening of subqueries underneath outer joins that are later reduced to plain joins (Tom Lane) [§](https://postgr.es/c/80d9c07a4) + + v16 failed to optimize some queries as well as prior versions had, because of overoptimistic simplification of query-pullup logic. +* Allow cancellation of the second stage of index build for large hash indexes (Pavel Borisov) [§](https://postgr.es/c/d23109f4b) +* Fix assertion failure or confusing error message for `COPY (query) TO ...`, when the *`query`* is rewritten by a `DO INSTEAD NOTIFY` rule (Tender Wang, Tom Lane) [§](https://postgr.es/c/6c3b2d204) +* Fix server crash when a `json_objectagg()` call contains a volatile function (Amit Langote) [§](https://postgr.es/c/fa4f11854) +* Fix checking of key uniqueness in JSON object constructors (Junwang Zhao, Tomas Vondra) [§](https://postgr.es/c/8e65d9ff9) + + When building an object larger than a kilobyte, it was possible to accept invalid input that includes duplicate object keys, or to falsely report that duplicate keys are present. +* Fix detection of skewed data during parallel hash join (Thomas Munro) [§](https://postgr.es/c/53edc9485) + + After repartitioning the inner side of a hash join because one partition has accumulated too many tuples, we check to see if all the partition's tuples went into the same child partition, which suggests that they all have the same hash value and further repartitioning cannot improve matters. This check malfunctioned in some cases, allowing repeated futile repartitioning which would eventually end in a resource-exhaustion error. +* Disallow locale names containing non-ASCII characters (Thomas Munro) [§](https://postgr.es/c/ce17de580) + + This is only an issue on Windows, as such locale names are not used elsewhere. They are problematic because it's quite unclear what encoding such names are represented in (since the locale itself defines the encoding to use). In recent PostgreSQL releases, an abort in the Windows runtime library could occur because of confusion about that. + + Anyone who encounters the new error message should either create a new duplicated locale with an ASCII-only name using Windows Locale Builder, or consider using BCP 47-compliant locale names like `tr-TR`. +* Fix race condition in committing a serializable transaction (Heikki Linnakangas) [§](https://postgr.es/c/22665f210) + + Mis-processing of a recently committed transaction could lead to an assertion failure or a “could not access status of transaction” error. +* Fix race condition in `COMMIT PREPARED` that resulted in orphaned 2PC files (wuchengwen) [§](https://postgr.es/c/7de9b64a5) + + A concurrent `PREPARE TRANSACTION` could cause `COMMIT PREPARED` to not remove the on-disk two-phase state file for the completed transaction. There was no immediate ill effect, but a subsequent crash-and-recovery could fail with “could not access status of transaction”, requiring manual removal of the orphaned file to restore service. +* Avoid invalid memory accesses after skipping an invalid toast index during `VACUUM FULL` (Tender Wang) [§](https://postgr.es/c/afbd3dc7d) + + A list tracking yet-to-be-rebuilt indexes was not properly updated in this code path, risking assertion failures or crashes later on. +* Fix ways in which an “in place” catalog update could be lost (Noah Misch) [§](https://postgr.es/c/63f019805) [§](https://postgr.es/c/51ff46de2) [§](https://postgr.es/c/4c922821e) [§](https://postgr.es/c/2d63c964f) [§](https://postgr.es/c/370bc7740) [§](https://postgr.es/c/6c837c237) [§](https://postgr.es/c/f8f9110b4) + + Normal row updates write a new version of the row to preserve rollback-ability of the transaction. However, certain system catalog updates are intentionally non-transactional and are done with an in-place update of the row. These patches fix race conditions that could cause the effects of an in-place update to be lost. As an example, it was possible to forget having set `pg_class`.`relhasindex` to true, preventing updates of the new index and thus causing index corruption. +* Reset catalog caches at end of recovery (Noah Misch) [§](https://postgr.es/c/d36b4d8ec) + + This prevents scenarios wherein an in-place catalog update could be lost due to using stale data from a catalog cache. +* Avoid using parallel query while holding off interrupts (Francesco Degrassi, Noah Misch, Tom Lane) [§](https://postgr.es/c/6f6521de9) [§](https://postgr.es/c/06424e9a2) + + This situation cannot arise normally, but it can be reached with test scenarios such as using a SQL-language function as B-tree support (which would be far too slow for production usage). If it did occur it would result in an indefinite wait. +* Report the active query ID for statistics purposes at the start of processing of Bind and Execute protocol messages (Sami Imseih) [§](https://postgr.es/c/21aad4bea) + + This allows more of the work done in extended query protocol to be attributed to the correct query. +* Guard against stack overflow in libxml2 with too-deeply-nested XML input (Tom Lane, with hat tip to Nick Wellnhofer) [§](https://postgr.es/c/4c9bf947a) + + Use `xmlXPathCtxtCompile()` rather than `xmlXPathCompile()`, because the latter fails to protect itself against recursion-to-stack-overflow in libxml2 releases before 2.13.4. +* Fix some whitespace issues in the result of `XMLSERIALIZE(... INDENT)` (Jim Jones) [§](https://postgr.es/c/06c285018) + + Fix failure to indent nodes separated by whitespace, and ensure that a trailing newline is not added. +* Do not ignore a concurrent `REINDEX CONCURRENTLY` that is working on an index with predicates or expressions (Michail Nikolaev) [§](https://postgr.es/c/edb0f6e41) + + Normally, `REINDEX CONCURRENTLY` does not need to wait for other `REINDEX CONCURRENTLY` operations on other tables. However, this optimization is not applied if the other `REINDEX CONCURRENTLY` is processing an index with predicates or expressions, on the chance that such expressions contain user-defined code that accesses other tables. Careless coding created a race condition such that that rule was not applied uniformly, possibly allowing inconsistent behavior. +* Fix mis-deparsing of `ORDER BY` lists when there is a name conflict (Tom Lane) [§](https://postgr.es/c/9fe6319dc) + + If an `ORDER BY` item in `SELECT` is a bare identifier, the parser first seeks it as an output column name of the `SELECT`, for SQL92 compatibility. However, ruleutils.c expects the SQL99 interpretation where such a name is an input column name. So it was possible to produce an incorrect display of a view in the (rather ill-advised) case where some other column is renamed in the `SELECT` output list to match an input column used in `ORDER BY`. Fix by table-qualifying such names in the dumped view text. +* Fix “failed to find plan for subquery/CTE” errors in `EXPLAIN` (Richard Guo, Tom Lane) [§](https://postgr.es/c/9db6650a5) [§](https://postgr.es/c/03f679475) + + This case arose while trying to print references to fields of a RECORD-type output of a subquery when the subquery has been optimized out of the plan altogether (which is possible at least in the case that it has a constant-false `WHERE` condition). Nothing remains in the plan to identify the original field names, so fall back to printing `fN` for the *`N`*'th record column. (That's actually the right thing anyway, if the record output arose from a `ROW()` constructor.) +* Disallow a `USING` clause when altering the type of a generated column (Peter Eisentraut) [§](https://postgr.es/c/5867ee005) + + A generated column already has an expression specifying the column contents, so including `USING` doesn't make sense. +* Ignore not-yet-defined Portals in the `pg_cursors` view (Tom Lane) [§](https://postgr.es/c/5de77b609) + + It is possible for user-defined code that inspects this view to be called while a new cursor is being set up, and if that happens a null pointer dereference would ensue. Avoid the problem by defining the view to exclude incompletely-set-up cursors. +* Fix incorrect output of the `pg_stat_io` view on 32-bit machines (Bertrand Drouvot) [§](https://postgr.es/c/dd20f950d) + + The `stats_reset` timestamp column contained garbage on such hardware. +* Prevent mis-encoding of “trailing junk after numeric literal” error messages (Karina Litskevich) [§](https://postgr.es/c/4fd4d7653) + + We do not allow identifiers to appear immediately following numeric literals (there must be some whitespace between). If a multibyte character immediately followed a numeric literal, the syntax error message about it included only the first byte of that character, causing bad-encoding problems both in the report to the client and in the postmaster log file. +* Avoid “unexpected table\_index\_fetch\_tuple call during logical decoding” error while decoding a transaction involving insertion of a column default value (Takeshi Ideriha, Hou Zhijie) [§](https://postgr.es/c/0f0e253db) [§](https://postgr.es/c/0c40d9019) +* Reduce memory consumption of logical decoding (Masahiko Sawada) [§](https://postgr.es/c/05e982cdc) + + Use a smaller default block size to store tuple data received during logical replication. This reduces memory wastage, which has been reported to be severe while processing long-running transactions, even leading to out-of-memory failures. +* In a logical replication apply worker, ensure that origin progress is not advanced during an error or apply worker shutdown (Hayato Kuroda, Shveta Malik) [§](https://postgr.es/c/b39c5272c) + + This avoids possible loss of a transaction, since once the origin progress point is advanced the source server won't send that data again. +* Re-disable sending of stateless (TLSv1.2) session tickets (Daniel Gustafsson) [§](https://postgr.es/c/9333174af) + + A previous change to prevent sending of stateful (TLSv1.3) session tickets accidentally re-enabled sending of stateless ones. Thus, while we intended to prevent clients from thinking that TLS session resumption is supported, some still did. +* Avoid “wrong tuple length” failure when dropping a database with many ACL (permission) entries (Ayush Tiwari) [§](https://postgr.es/c/545794515) [§](https://postgr.es/c/f6991cafa) +* Allow adjusting the `session_authorization` and `role` settings in parallel workers (Tom Lane) [§](https://postgr.es/c/f3ab5d3a2) + + Our code intends to allow modifiable server settings to be set by function `SET` clauses, but not otherwise within a parallel worker. `SET` clauses failed for these two settings, though. +* Fix behavior of stable functions called from a `CALL` statement's argument list, when the `CALL` is within a PL/pgSQL `EXCEPTION` block (Tom Lane) [§](https://postgr.es/c/25d639eea) + + As with a similar fix in our previous quarterly releases, this case allowed such functions to be passed the wrong snapshot, causing them to see stale values of rows modified since the start of the outer transaction. +* Fix “cache lookup failed for function” errors in edge cases in PL/pgSQL's `CALL` (Tom Lane) [§](https://postgr.es/c/a073835c1) +* Fix thread safety of our fallback (non-OpenSSL) MD5 implementation on big-endian hardware (Heikki Linnakangas) [§](https://postgr.es/c/0583863e9) + + Thread safety is not currently a concern in the server, but it is for libpq. +* Parse libpq's `keepalives` connection option in the same way as other integer-valued options (Yuto Sasaki) [§](https://postgr.es/c/65f431aff) + + The coding used here rejected trailing whitespace in the option value, unlike other cases. This turns out to be problematic in ecpg's usage, for example. +* Avoid use of `pnstrdup()` in ecpglib (Jacob Champion) [§](https://postgr.es/c/ee2997c67) + + That function will call `exit()` on out-of-memory, which is undesirable in a library. The calling code already handles allocation failures properly. +* In ecpglib, fix out-of-bounds read when parsing incorrect datetime input (Bruce Momjian, Pavel Nekrasov) [§](https://postgr.es/c/a1e613b81) + + It was possible to try to read the location just before the start of a constant array. Real-world consequences seem minimal, though. +* Fix memory leak in psql during repeated use of `\bind` (Michael Paquier) [§](https://postgr.es/c/c2fb2f9e2) +* Avoid hanging if an interval less than 1ms is specified in psql's `\watch` command (Andrey Borodin, Michael Paquier) [§](https://postgr.es/c/6331972c7) + + Instead, treat this the same as an interval of zero (no wait between executions). +* Fix pg\_dump's handling of identity sequences that have persistence different from their owning table's persistence (Tom Lane) [§](https://postgr.es/c/b8b175a4c) + + Since v15, it's been possible to set an identity sequence to be LOGGED when its owning table is UNLOGGED or vice versa. However, pg\_dump's method for recreating that situation failed in binary-upgrade mode, causing pg\_upgrade to fail when such sequences are present. Fix by introducing a new option for `ADD/ALTER COLUMN GENERATED AS IDENTITY` to allow the sequence's persistence to be set correctly at creation. Note that this means a dump from a database containing such a sequence will only load into a server of this minor version or newer. +* Include the source timeline history in pg\_rewind's debug output (Heikki Linnakangas) [§](https://postgr.es/c/e8240dbd8) + + This was the intention to begin with, but a coding error caused the source history to always print as empty. +* Avoid trying to reindex temporary tables and indexes in vacuumdb and in parallel reindexdb (VaibhaveS, Michael Paquier, Fujii Masao, Nathan Bossart) [§](https://postgr.es/c/1ea4d9c00) [§](https://postgr.es/c/653ce5b8b) [§](https://postgr.es/c/eba8cc1af) + + Reindexing other sessions' temporary tables cannot work, but the check to skip them was missing in some code paths, leading to unwanted failures. +* Allow inspection of sequence relations in relevant functions of `contrib/pageinspect` and `contrib/pgstattuple` (Nathan Bossart, Ayush Vatsa) [§](https://postgr.es/c/2bd4c06bb) [§](https://postgr.es/c/0938a4ecd) + + This had been allowed in the past, but it got broken during the introduction of non-default access methods for tables. +* Fix incorrect LLVM-generated code on ARM64 platforms (Thomas Munro, Anthonin Bonnefoy) [§](https://postgr.es/c/ee67b73f5) + + When using JIT compilation on ARM platforms, the generated code could not support relocation distances exceeding 32 bits, allowing unlucky placement of generated code to cause server crashes on large-memory systems. +* Fix a few places that assumed that process start time (represented as a `time_t`) will fit into a `long` value (Max Johnson, Nathan Bossart) [§](https://postgr.es/c/8aaf88b63) + + On platforms where `long` is 32 bits (notably Windows), this coding would fail after Y2038. Most of the failures appear only cosmetic, but notably `pg_ctl start` would hang. +* Fix building with Strawberry Perl on Windows (Andrew Dunstan) [§](https://postgr.es/c/0a0db4631) +* Update time zone data files to tzdata release 2024b (Tom Lane) [§](https://postgr.es/c/a0c8d600b) [§](https://postgr.es/c/2abc88958) + + This tzdata release changes the old System-V-compatibility zone names to duplicate the corresponding geographic zones; for example `PST8PDT` is now an alias for `America/Los_Angeles`. The main visible consequence is that for timestamps before the introduction of standardized time zones, the zone is considered to represent local mean solar time for the named location. For example, in `PST8PDT`, `timestamptz` input such as `1801-01-01 00:00` would previously have been rendered as `1801-01-01 00:00:00-08`, but now it is rendered as `1801-01-01 00:00:00-07:52:58`. + + Also, historical corrections for Mexico, Mongolia, and Portugal. Notably, `Asia/Choibalsan` is now an alias for `Asia/Ulaanbaatar` rather than being a separate zone, mainly because the differences between those zones were found to be based on untrustworthy data. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-16-6.html "E.6. Release 16.6") | [Up](release.html "Appendix E. Release Notes") | [Next](release-16-4.html "E.8. Release 16.4") | +| E.6. Release 16.6 | [Home](index.html "PostgreSQL 16.11 Documentation") | E.8. Release 16.4 | + +[Previous](/docs/release/16.4/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/16.6/) diff --git a/corpus/changelog/postgresql_releases/postgresql_166.md b/corpus/changelog/postgresql_releases/postgresql_166.md new file mode 100644 index 0000000000000000000000000000000000000000..d501ad08760fb3d08d1831dabefce476c13ea32b --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_166.md @@ -0,0 +1,66 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/16.6/ +Version: 16.6 + +## PostgreSQL 16.6 + +| E.6. Release 16.6 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-16-7.html "E.5. Release 16.7") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 16.11 Documentation") | [Next](release-16-5.html "E.7. Release 16.5") | + +--- + +## E.6. Release 16.6 [#](#RELEASE-16-6) + +[E.6.1. Migration to Version 16.6](release-16-6.html#RELEASE-16-6-MIGRATION) + +[E.6.2. Changes](release-16-6.html#RELEASE-16-6-CHANGES) + +**Release date:**2024-11-21 + +This release contains a few fixes from 16.5. For information about new features in major release 16, see [Section E.12](release-16.html "E.12. Release 16"). + +### E.6.1. Migration to Version 16.6 [#](#RELEASE-16-6-MIGRATION) + +A dump/restore is not required for those running 16.X. + +However, if you are upgrading from a version earlier than 16.5, see [Section E.7](release-16-5.html "E.7. Release 16.5"). + +### E.6.2. Changes [#](#RELEASE-16-6-CHANGES) + +* Repair ABI break for extensions that work with struct `ResultRelInfo` (Tom Lane) [§](https://postgr.es/c/ee33d5847) + + Last week's minor releases unintentionally broke binary compatibility with timescaledb and several other extensions. Restore the affected structure to its previous size, so that such extensions need not be rebuilt. +* Restore functionality of `ALTER {ROLE|DATABASE} SET role` (Tom Lane, Noah Misch) [§](https://postgr.es/c/b0918c128) + + The fix for CVE-2024-10978 accidentally caused settings for `role` to not be applied if they come from non-interactive sources, including previous `ALTER {ROLE|DATABASE}` commands and the `PGOPTIONS` environment variable. +* Fix cases where a logical replication slot's `restart_lsn` could go backwards (Masahiko Sawada) [§](https://postgr.es/c/f35391133) + + Previously, restarting logical replication could sometimes cause the slot's restart point to be recomputed as an older value than had previously been advertised in `pg_replication_slots`. This is bad, since for example WAL files might have been removed on the basis of the later `restart_lsn` value, in which case replication would fail to restart. +* Avoid deleting still-needed WAL files during pg\_rewind (Polina Bungina, Alexander Kukushkin) [§](https://postgr.es/c/ea1649c35) + + Previously, in unlucky cases, it was possible for pg\_rewind to remove important WAL files from the rewound demoted primary. In particular this happens if those files have been marked for archival (i.e., their `.ready` files were created) but not yet archived. Then the newly promoted node no longer has such files because of them having been recycled, but likely they are needed for recovery in the demoted node. If pg\_rewind removes them, recovery is not possible anymore. +* Fix race conditions associated with dropping shared statistics entries (Kyotaro Horiguchi, Michael Paquier) [§](https://postgr.es/c/afa20845d) + + These bugs could lead to loss of statistics data, assertion failures, or “can only drop stats once” errors. +* Count index scans in `contrib/bloom` indexes in the statistics views, such as the `pg_stat_user_indexes`.`idx_scan` counter (Masahiro Ikeda) [§](https://postgr.es/c/05aac2e83) +* Fix crash when checking to see if an index's opclass options have changed (Alexander Korotkov) [§](https://postgr.es/c/b242aba02) + + Some forms of `ALTER TABLE` would fail if the table has an index with non-default operator class options. +* Avoid assertion failure caused by disconnected NFA sub-graphs in regular expression parsing (Tom Lane) [§](https://postgr.es/c/b6312becc) + + This bug does not appear to have any visible consequences in non-assert builds. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-16-7.html "E.5. Release 16.7") | [Up](release.html "Appendix E. Release Notes") | [Next](release-16-5.html "E.7. Release 16.5") | +| E.5. Release 16.7 | [Home](index.html "PostgreSQL 16.11 Documentation") | E.7. Release 16.5 | + +[Previous](/docs/release/16.5/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/16.7/) diff --git a/corpus/changelog/postgresql_releases/postgresql_167.md b/corpus/changelog/postgresql_releases/postgresql_167.md new file mode 100644 index 0000000000000000000000000000000000000000..1ff74773d857650fe883c438c5d581789a7998b8 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_167.md @@ -0,0 +1,185 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/16.7/ +Version: 16.7 + +## PostgreSQL 16.7 + +| E.5. Release 16.7 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-16-8.html "E.4. Release 16.8") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 16.11 Documentation") | [Next](release-16-6.html "E.6. Release 16.6") | + +--- + +## E.5. Release 16.7 [#](#RELEASE-16-7) + +[E.5.1. Migration to Version 16.7](release-16-7.html#RELEASE-16-7-MIGRATION) + +[E.5.2. Changes](release-16-7.html#RELEASE-16-7-CHANGES) + +**Release date:**2025-02-13 + +This release contains a variety of fixes from 16.6. For information about new features in major release 16, see [Section E.12](release-16.html "E.12. Release 16"). + +### E.5.1. Migration to Version 16.7 [#](#RELEASE-16-7-MIGRATION) + +A dump/restore is not required for those running 16.X. + +However, if you are upgrading from a version earlier than 16.5, see [Section E.7](release-16-5.html "E.7. Release 16.5"). + +### E.5.2. Changes [#](#RELEASE-16-7-CHANGES) + +* Harden `PQescapeString` and allied functions against invalidly-encoded input strings (Andres Freund, Noah Misch) [§](https://postgr.es/c/92e4170f4) [§](https://postgr.es/c/6e05b195d) [§](https://postgr.es/c/56aa2dcdd) [§](https://postgr.es/c/01784793f) [§](https://postgr.es/c/41343f840) [§](https://postgr.es/c/0075a5c6c) + + Data-quoting functions supplied by libpq now fully check the encoding validity of their input. If invalid characters are detected, they report an error if possible. For the ones that lack an error return convention, the output string is adjusted to ensure that the server will report invalid encoding and no intervening processing will be fooled by bytes that might happen to match single quote, backslash, etc. + + The purpose of this change is to guard against SQL-injection attacks that are possible if one of these functions is used to quote crafted input. There is no hazard when the resulting string is sent directly to a PostgreSQL server (which would check its encoding anyway), but there is a risk when it is passed through psql or other client-side code. Historically such code has not carefully vetted encoding, and in many cases it's not clear what it should do if it did detect such a problem. + + This fix is effective only if the data-quoting function, the server, and any intermediate processing agree on the character encoding that's being used. Applications that insert untrusted input into SQL commands should take special care to ensure that that's true. + + Applications and drivers that quote untrusted input without using these libpq functions may be at risk of similar problems. They should first confirm the data is valid in the encoding expected by the server. + + The PostgreSQL Project thanks Stephen Fewer for reporting this problem. (CVE-2025-1094) +* Exclude parallel workers from connection privilege checks and limits (Tom Lane) [§](https://postgr.es/c/41a252c2c) + + Do not check `datallowconn`, `rolcanlogin`, and `ACL_CONNECT` privileges when starting a parallel worker, instead assuming that it's enough for the leader process to have passed similar checks originally. This avoids, for example, unexpected failures of parallelized queries when the leader is running as a role that lacks login privilege. In the same vein, enforce `ReservedConnections`, `datconnlimit`, and `rolconnlimit` limits only against regular backends, and count only regular backends while checking if the limits were already reached. Those limits are meant to prevent excessive consumption of process slots for regular backends --- but parallel workers and other special processes have their own pools of process slots with their own limit checks. +* Fix possible re-use of stale results in window aggregates (David Rowley) [§](https://postgr.es/c/c1d6506ac) + + A window aggregate with a “run condition” optimization and a pass-by-reference result type might incorrectly return the result from the previous partition instead of performing a fresh calculation. +* Keep `TransactionXmin` in sync with `MyProc->xmin` (Heikki Linnakangas) [§](https://postgr.es/c/9d8ab2c46) + + This oversight could permit a process to try to access data that had already been vacuumed away. One known consequence is transient “could not access status of transaction” errors. +* Fix race condition that could cause failure to add a newly-inserted catalog entry to a catalog cache list (Heikki Linnakangas) [§](https://postgr.es/c/91fc447c2) + + This could result, for example, in failure to use a newly-created function within an existing session. +* Prevent possible catalog corruption when a system catalog is vacuumed concurrently with an update (Noah Misch) [§](https://postgr.es/c/9311fcb86) +* Fix data corruption when relation truncation fails (Thomas Munro) [§](https://postgr.es/c/ba02d24ba) [§](https://postgr.es/c/c957d7444) [§](https://postgr.es/c/9defaaa1d) + + The filesystem calls needed to perform relation truncation could fail, leaving inconsistent state on disk (for example, effectively reviving deleted data). We can't really prevent that, but we can recover by dint of making such failures into PANICs, so that consistency is restored by replaying from WAL up to just before the attempted truncation. This isn't a hugely desirable behavior, but such failures are rare enough that it seems an acceptable solution. +* Prevent checkpoints from starting during relation truncation (Robert Haas) [§](https://postgr.es/c/ad5aa7bfd) + + This avoids a race condition wherein the modified file might not get fsync'd before completing the checkpoint, creating a risk of data corruption if the operating system crashes soon after. +* Avoid possibly losing an update of `pg_database`.`datfrozenxid` when `VACUUM` runs concurrently with a `REASSIGN OWNED` that changes that database's owner (Kirill Reshke) [§](https://postgr.es/c/5d94aa4dc) +* Fix incorrect `tg_updatedcols` values passed to `AFTER UPDATE` triggers (Tom Lane) [§](https://postgr.es/c/8c57f5485) + + In some cases the `tg_updatedcols` bitmap could describe the set of columns updated by an earlier command in the same transaction, fooling the trigger into doing the wrong thing. + + Also, prevent memory bloat caused by making too many copies of the `tg_updatedcols` bitmap. +* Fix detach of a partition that has its own foreign-key constraint referencing a partitioned table (Amul Sul) [§](https://postgr.es/c/ddab512eb) + + In common cases, foreign keys are defined on a partitioned table's top level; but if instead one is defined on a partition and references a partitioned table, and the referencing partition is detached, the relevant `pg_constraint` entries were updated incorrectly. This led to errors like “could not find ON INSERT check triggers of foreign key constraint”. +* Fix mis-processing of `to_timestamp`'s `FFn` format codes (Tom Lane) [§](https://postgr.es/c/26c233b8b) + + An integer format code immediately preceding `FFn` would consume all available digits, leaving none for `FFn`. +* When deparsing an `XMLTABLE()` expression, ensure that XML namespace names are double-quoted when necessary (Dean Rasheed) [§](https://postgr.es/c/77763f3be) +* Include the `ldapscheme` option in `pg_hba_file_rules()` output (Laurenz Albe) [§](https://postgr.es/c/c35bbdfbc) [§](https://postgr.es/c/116036d81) +* Don't merge `UNION` operations if their column collations aren't consistent (Tom Lane) [§](https://postgr.es/c/f286f64bc) + + Previously we ignored collations when deciding if it's safe to merge `UNION` steps into a single N-way `UNION` operation. This was arguably valid before the introduction of nondeterministic collations, but it's not anymore, since the collation in use can affect the definition of uniqueness. +* Prevent “wrong varnullingrels” planner errors after pulling up a subquery that's underneath an outer join (Tom Lane) [§](https://postgr.es/c/85990e2fd) [§](https://postgr.es/c/7b456f040) +* Ignore nulling-relation marker bits when looking up statistics (Richard Guo) [§](https://postgr.es/c/a1a9120c7) + + This oversight could lead to failure to use relevant statistics about expressions, or to “corrupt MVNDistinct entry” errors. +* Fix missed expression processing for partition pruning steps (Tom Lane) [§](https://postgr.es/c/94c02bd33) + + This oversight could lead to “unrecognized node type” errors, and perhaps other problems, in queries accessing partitioned tables. +* Allow dshash tables to grow past 1GB (Matthias van de Meent) [§](https://postgr.es/c/2a7402322) + + This avoids errors like “invalid DSA memory alloc request size”. The case can occur for example in transactions that process several million tables. +* Avoid possible integer overflow in `bringetbitmap()` (James Hunter, Evgeniy Gorbanyov) [§](https://postgr.es/c/bfda7d8dd) + + Since the result is only used for statistical purposes, the effects of this error were mostly cosmetic. +* Ensure that an already-set process latch doesn't prevent the postmaster from noticing socket events (Thomas Munro) [§](https://postgr.es/c/b4b52c911) + + An extremely heavy workload of backends launching workers and workers exiting could prevent the postmaster from responding to incoming client connections in a timely fashion. +* Prevent streaming standby servers from looping infinitely when reading a WAL record that crosses pages (Kyotaro Horiguchi, Alexander Kukushkin) [§](https://postgr.es/c/2c2e1d4f4) + + This would happen when the record's continuation is on a page that needs to be read from a different WAL source. +* Fix unintended promotion of FATAL errors to PANIC during early process startup (Noah Misch) [§](https://postgr.es/c/ac4a2b403) + + This fixes some unlikely cases that would result in “PANIC: proc\_exit() called in child process”. +* Fix cases where an operator family member operator or support procedure could become a dangling reference (Tom Lane) [§](https://postgr.es/c/be5db08ed) [§](https://postgr.es/c/faad01835) + + In some cases a data type could be dropped while references to its OID still remain in `pg_amop` or `pg_amproc`. While that caused no immediate issues, an attempt to drop the owning operator family would fail, and pg\_dump would produce bogus output when dumping the operator family. This fix causes creation and modification of operator families/classes to add needed dependency entries so that dropping a data type will also drop any dependent operator family elements. That does not help vulnerable pre-existing operator families, though, so a band-aid has also been added to `DROP OPERATOR FAMILY` to prevent failure when dropping a family that has dangling members. +* Fix multiple memory leaks in logical decoding output (Vignesh C, Masahiko Sawada, Boyu Yang) [§](https://postgr.es/c/e3a27fd06) [§](https://postgr.es/c/4d45e7490) [§](https://postgr.es/c/e749eaf46) +* Fix small memory leak when updating the `application_name` or `cluster_name` settings (Tofig Aliev) [§](https://postgr.es/c/be9dac9af) +* Avoid integer overflow while testing `wal_skip_threshold` condition (Tom Lane) [§](https://postgr.es/c/f7a08b6e9) + + A transaction that created a very large relation could mistakenly decide to ensure durability by copying the relation into WAL instead of fsync'ing it, thereby negating the point of `wal_skip_threshold`. (This only matters when `wal_level` is set to `minimal`, else a WAL copy is required anyway.) +* Fix unsafe order of operations during cache lookups (Noah Misch) [§](https://postgr.es/c/c1285bbeb) + + The only known consequence was a usually-harmless “you don't own a lock of type ExclusiveLock” warning during `GRANT TABLESPACE`. +* Fix possible “failed to resolve name” failures when using JIT on older ARM platforms (Thomas Munro) [§](https://postgr.es/c/6de14dbb3) + + This could occur as a consequence of inconsistency about the default setting of `-moutline-atomics` between gcc and clang. At least Debian and Ubuntu are known to ship gcc and clang compilers that target armv8-a but differ on the use of outline atomics by default. +* Fix assertion failure in `WITH RECURSIVE ... UNION` queries (David Rowley) [§](https://postgr.es/c/093fc156b) +* Avoid assertion failure in rule deparsing if a set operation leaf query contains set operations (Man Zeng, Tom Lane) [§](https://postgr.es/c/fe084039e) +* Avoid edge-case assertion failure in parallel query startup (Tom Lane) [§](https://postgr.es/c/bb649b553) +* Fix assertion failure at shutdown when writing out the statistics file (Michael Paquier) [§](https://postgr.es/c/ae77bcc3a) +* In `NULLIF()`, avoid passing a read-write expanded object pointer to the data type's equality function (Tom Lane) [§](https://postgr.es/c/4aba56adc) + + The equality function could modify or delete the object if it's given a read-write pointer, which would be bad if we decide to return it as the `NULLIF()` result. There is probably no problem with any built-in equality function, but it's easy to demonstrate a failure with one coded in PL/pgSQL. +* Ensure that expression preprocessing is applied to a default null value in `INSERT` (Tom Lane) [§](https://postgr.es/c/6655d931c) + + If the target column is of a domain type, the planner must insert a coerce-to-domain step not just a null constant, and this expression missed going through some required processing steps. There is no known consequence with domains based on core data types, but in theory an error could occur with domains based on extension types. +* Repair memory leaks in PL/Python (Mat Arye, Tom Lane) [§](https://postgr.es/c/33a4e656d) + + Repeated use of `PLyPlan.execute` or `plpy.cursor` resulted in memory leakage for the duration of the calling PL/Python function. +* Fix PL/Tcl to compile with Tcl 9 (Peter Eisentraut) [§](https://postgr.es/c/07c77803c) +* In the ecpg preprocessor, fix possible misprocessing of cursors that reference out-of-scope variables (Tom Lane) [§](https://postgr.es/c/cca34f68c) +* In ecpg, fix compile-time warnings about unsupported use of `COPY ... FROM STDIN` (Ryo Kanbayashi) [§](https://postgr.es/c/5c7c34db2) + + Previously, the intended warning was not issued due to a typo. +* Fix psql to safely handle file path names that are encoded in SJIS (Tom Lane) [§](https://postgr.es/c/998c4fc7c) + + Some two-byte characters in SJIS have a second byte that is equal to ASCII backslash (`\`). These characters were corrupted by path name normalization, preventing access to files whose names include such characters. +* Fix use of wrong version of `pqsignal()` in pgbench and psql (Fujii Masao, Tom Lane) [§](https://postgr.es/c/b935691b8) + + This error could lead to misbehavior when using the `-T` option in pgbench or the `\watch` command in psql, due to interrupted system calls not being resumed as expected. +* Fix misexecution of some nested `\if` constructs in pgbench (Michail Nikolaev) [§](https://postgr.es/c/076b09123) + + An `\if` command appearing within a false (not-being-executed) `\if` branch was incorrectly treated the same as `\elif`. +* In pgbench, fix possible misdisplay of progress messages during table initialization (Yushi Ogiwara, Tatsuo Ishii, Fujii Masao) [§](https://postgr.es/c/1cf646957) [§](https://postgr.es/c/21b815f92) +* Make pg\_controldata more robust against corrupted `pg_control` files (Ilyasov Ian, Anton Voloshin) [§](https://postgr.es/c/d54d5668b) + + Since pg\_controldata will attempt to print the contents of `pg_control` even if the CRC check fails, it must take care not to misbehave for invalid field values. This patch fixes some issues triggered by invalid timestamps and apparently-negative WAL segment sizes. +* Fix possible crash in pg\_dump with identity sequences attached to tables that are extension members (Tom Lane) [§](https://postgr.es/c/782cc1aa3) +* Fix memory leak in pg\_restore with zstd-compressed data (Tom Lane) [§](https://postgr.es/c/8cfff087b) + + The leak was per-decompression-operation, so would be most noticeable with a dump containing many tables or large objects. +* Fix pg\_basebackup to correctly handle `pg_wal.tar` files exceeding 2GB on Windows (Davinder Singh, Thomas Munro) [§](https://postgr.es/c/be7489662) [§](https://postgr.es/c/0bff6f1da) +* Use SQL-standard function bodies in the declarations of `contrib/earthdistance`'s SQL-language functions (Tom Lane, Ronan Dunklau) [§](https://postgr.es/c/31daa10fa) + + This change allows their references to `contrib/cube` to be resolved during extension creation, reducing the risk of search-path-based failures and possible attacks. + + In particular, this restores their usability in contexts like generated columns, for which PostgreSQL v17 restricts the search path on security grounds. We have received reports of databases failing to be upgraded to v17 because of that. This patch has been included in v16 to provide a workaround: updating the `earthdistance` extension to this version beforehand should allow an upgrade to succeed. +* Update configuration probes that determine the compiler switches needed to access ARM CRC instructions (Tom Lane) [§](https://postgr.es/c/1f4aadec4) + + On ARM platforms where the baseline CPU target lacks CRC instructions, we need to supply a `-march` switch to persuade the compiler to compile such instructions. Recent versions of gcc reject the value we were trying, leading to silently falling back to software CRC. +* Fix meson build system to support old OpenSSL libraries on Windows (Darek Slusarczyk) [§](https://postgr.es/c/60516fc8b) + + Add support for the legacy library names `ssleay32` and `libeay32`. +* In Windows builds using meson, ensure all libcommon and libpgport functions are exported (Vladlen Popolitov, Heikki Linnakangas) [§](https://postgr.es/c/4e0d71ff2) [§](https://postgr.es/c/643efb18b) + + This fixes “unresolved external symbol” build errors for extensions. +* Fix meson configuration process to correctly detect OSSP's `uuid.h` header file under MSVC (Andrew Dunstan) [§](https://postgr.es/c/1250adfdf) +* When building with meson, install `pgevent` in *`pkglibdir`* not *`bindir`* (Peter Eisentraut) [§](https://postgr.es/c/766b0b40a) + + This matches the behavior of the make-based build system and the old MSVC build system. +* When building with meson, install `sepgsql.sql` under `share/contrib/` not `share/extension/` (Peter Eisentraut) [§](https://postgr.es/c/155d6162e) + + This matches what the make-based build system does. +* Update time zone data files to tzdata release 2025a for DST law changes in Paraguay, plus historical corrections for the Philippines (Tom Lane) [§](https://postgr.es/c/d62403c51) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-16-8.html "E.4. Release 16.8") | [Up](release.html "Appendix E. Release Notes") | [Next](release-16-6.html "E.6. Release 16.6") | +| E.4. Release 16.8 | [Home](index.html "PostgreSQL 16.11 Documentation") | E.6. Release 16.6 | + +[Previous](/docs/release/16.6/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/16.8/) diff --git a/corpus/changelog/postgresql_releases/postgresql_168.md b/corpus/changelog/postgresql_releases/postgresql_168.md new file mode 100644 index 0000000000000000000000000000000000000000..5046b35ac648532545e811baf23ea42aceca7d15 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_168.md @@ -0,0 +1,50 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/16.8/ +Version: 16.8 + +## PostgreSQL 16.8 + +| E.4. Release 16.8 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-16-9.html "E.3. Release 16.9") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 16.11 Documentation") | [Next](release-16-7.html "E.5. Release 16.7") | + +--- + +## E.4. Release 16.8 [#](#RELEASE-16-8) + +[E.4.1. Migration to Version 16.8](release-16-8.html#RELEASE-16-8-MIGRATION) + +[E.4.2. Changes](release-16-8.html#RELEASE-16-8-CHANGES) + +**Release date:**2025-02-20 + +This release contains a few fixes from 16.7. For information about new features in major release 16, see [Section E.12](release-16.html "E.12. Release 16"). + +### E.4.1. Migration to Version 16.8 [#](#RELEASE-16-8-MIGRATION) + +A dump/restore is not required for those running 16.X. + +However, if you are upgrading from a version earlier than 16.5, see [Section E.7](release-16-5.html "E.7. Release 16.5"). + +### E.4.2. Changes [#](#RELEASE-16-8-CHANGES) + +* Improve behavior of libpq's quoting functions (Andres Freund, Tom Lane) [§](https://postgr.es/c/111f4dd27) [§](https://postgr.es/c/991a60a9f) [§](https://postgr.es/c/644b7d686) + + The changes made for CVE-2025-1094 had one serious oversight: `PQescapeLiteral()` and `PQescapeIdentifier()` failed to honor their string length parameter, instead always reading to the input string's trailing null. This resulted in including unwanted text in the output, if the caller intended to truncate the string via the length parameter. With very bad luck it could cause a crash due to reading off the end of memory. + + In addition, modify all these quoting functions so that when invalid encoding is detected, an invalid sequence is substituted for just the first byte of the presumed character, not all of it. This reduces the risk of problems if a calling application performs additional processing on the quoted string. +* Fix meson build system to correctly detect availability of the `bsd_auth.h` system header (Nazir Bilal Yavuz) [§](https://postgr.es/c/01cdb98e4) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-16-9.html "E.3. Release 16.9") | [Up](release.html "Appendix E. Release Notes") | [Next](release-16-7.html "E.5. Release 16.7") | +| E.3. Release 16.9 | [Home](index.html "PostgreSQL 16.11 Documentation") | E.5. Release 16.7 | + +[Previous](/docs/release/16.7/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/16.9/) diff --git a/corpus/changelog/postgresql_releases/postgresql_169.md b/corpus/changelog/postgresql_releases/postgresql_169.md new file mode 100644 index 0000000000000000000000000000000000000000..f47dfdb61421c02aeb34217950450912db2c8b7b --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_169.md @@ -0,0 +1,162 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/16.9/ +Version: 16.9 + +## PostgreSQL 16.9 + +| E.3. Release 16.9 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-16-10.html "E.2. Release 16.10") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 16.11 Documentation") | [Next](release-16-8.html "E.4. Release 16.8") | + +--- + +## E.3. Release 16.9 [#](#RELEASE-16-9) + +[E.3.1. Migration to Version 16.9](release-16-9.html#RELEASE-16-9-MIGRATION) + +[E.3.2. Changes](release-16-9.html#RELEASE-16-9-CHANGES) + +**Release date:**2025-05-08 + +This release contains a variety of fixes from 16.8. For information about new features in major release 16, see [Section E.12](release-16.html "E.12. Release 16"). + +### E.3.1. Migration to Version 16.9 [#](#RELEASE-16-9-MIGRATION) + +A dump/restore is not required for those running 16.X. + +However, if you have any self-referential foreign key constraints on partitioned tables, it may be necessary to recreate those constraints to ensure that they are being enforced correctly. See the second changelog entry below. + +Also, if you have any BRIN bloom indexes, it may be advisable to reindex them after updating. See the third changelog entry below. + +Also, if you are upgrading from a version earlier than 16.5, see [Section E.7](release-16-5.html "E.7. Release 16.5"). + +### E.3.2. Changes [#](#RELEASE-16-9-CHANGES) + +* Avoid one-byte buffer overread when examining invalidly-encoded strings that are claimed to be in GB18030 encoding (Noah Misch, Andres Freund) [§](https://postgr.es/c/d1264948f) [§](https://postgr.es/c/f3bb0b2c4) + + While unlikely, a SIGSEGV crash could occur if an incomplete multibyte character appeared at the end of memory. This was possible both in the server and in libpq-using applications. (CVE-2025-4207) +* Handle self-referential foreign keys on partitioned tables correctly (Álvaro Herrera) [§](https://postgr.es/c/1817d62ec) + + Creating or attaching partitions failed to make the required catalog entries for a foreign-key constraint, if the table referenced by the constraint was the same partitioned table. This resulted in failure to enforce the constraint fully. + + To fix this, you should drop and recreate any self-referential foreign keys on partitioned tables, if partitions have been created or attached since the constraint was created. Bear in mind that violating rows might already be present, in which case recreating the constraint will fail, and you'll need to fix up those rows before trying again. +* Avoid data loss when merging compressed BRIN summaries in `brin_bloom_union()` (Tomas Vondra) [§](https://postgr.es/c/ebcc799a7) + + The code failed to account for decompression results not being identical to the input objects, which would result in failure to add some of the data to the merged summary, leading to missed rows in index searches. + + This mistake was present back to v14 where BRIN bloom indexes were introduced, but this code path was only rarely reached then. It's substantially more likely to be hit in v17 because parallel index builds now use the code. +* Fix unexpected “attribute has wrong type” errors in `UPDATE`, `DELETE`, and `MERGE` queries that use whole-row table references to views or functions in `FROM` (Tom Lane) [§](https://postgr.es/c/fec43428c) +* Fix `MERGE` into a partitioned table with `DO NOTHING` actions (Tender Wang) [§](https://postgr.es/c/8d4cd3b4a) + + Some cases failed with “unknown action in MERGE WHEN clause” errors. +* Prevent failure in `INSERT` commands when the table has a `GENERATED` column of a domain data type and the domain's constraints disallow null values (Jian He) [§](https://postgr.es/c/f04e0faa3) + + Constraint failure was reported even if the generation expression produced a perfectly okay result. +* Correctly process references to outer CTE names that appear within a `WITH` clause attached to an `INSERT`/`UPDATE`/`DELETE`/`MERGE` command that's inside `WITH` (Tom Lane) [§](https://postgr.es/c/1980ec2bc) + + The parser failed to detect disallowed recursion cases, nor did it account for such references when sorting CTEs into a usable order. +* Don't try to parallelize `array_agg()` when the argument is of an anonymous record type (Richard Guo, Tom Lane) [§](https://postgr.es/c/a7aa9f21f) + + The protocol for communicating with parallel workers doesn't support identifying the concrete record type that a worker is returning. +* Fix `ARRAY(subquery)` and `ARRAY[expression, ...]` constructs to produce sane results when the input is of type `int2vector` or `oidvector` (Tom Lane) [§](https://postgr.es/c/0405982c7) + + This patch restores the behavior that existed before PostgreSQL 9.5: the result is of type `int2vector[]` or `oidvector[]`. +* Fix possible erroneous reports of invalid affixes while parsing Ispell dictionaries (Jacob Brazeal) [§](https://postgr.es/c/61513da08) +* Fix `ALTER TABLE ADD COLUMN` to correctly handle the case of a domain type that has a default (Jian He, Tom Lane, Tender Wang) [§](https://postgr.es/c/edc3bccd0) [§](https://postgr.es/c/053222a97) + + If a domain type has a default, adding a column of that type (without any explicit `DEFAULT` clause) failed to install the domain's default value in existing rows, instead leaving the new column null. +* Repair misbehavior when there are duplicate column names in a foreign key constraint's `ON DELETE SET DEFAULT` or `SET NULL` action (Tom Lane) [§](https://postgr.es/c/fb3a77fd9) +* Improve the error message for disallowed attempts to alter the properties of a foreign key constraint (Álvaro Herrera) [§](https://postgr.es/c/9ea5fe5b6) +* Avoid error when resetting the `relhassubclass` flag of a temporary table that's marked `ON COMMIT DELETE ROWS` (Noah Misch) [§](https://postgr.es/c/5905e9935) +* Add missing deparsing of the `INDENT` option of `XMLSERIALIZE()` (Jim Jones) [§](https://postgr.es/c/0af3ae468) [§](https://postgr.es/c/514d47dfb) + + Previously, views or rules using `XMLSERIALIZE(... INDENT)` were dumped without the `INDENT` clause, causing incorrect results after restore. +* Avoid premature evaluation of the arguments of an aggregate function that has both `FILTER` and `ORDER BY` (or `DISTINCT`) options (David Rowley) [§](https://postgr.es/c/887a23237) + + If there is `ORDER BY` or `DISTINCT`, we consider pre-sorting the aggregate input values rather than doing the sort within the Agg plan node. But this is problematic if the aggregate inputs include expressions that could fail (for example, a division where some of the input divisors could be zero) and there is a `FILTER` clause that's meant to prevent such failures. Pre-sorting would push the expression evaluations to before the `FILTER` test, allowing the failures to happen anyway. Avoid this by not pre-sorting if there's a `FILTER` and the input expressions are anything more complex than a simple Var or Const. +* Fix planner's failure to identify more than one hashable ScalarArrayOpExpr subexpression within a top-level expression (David Geier) [§](https://postgr.es/c/5a0840b76) + + This resulted in unnecessarily-inefficient execution of any additional subexpressions that could have been processed with a hash table (that is, `IN`, `NOT IN`, or `= ANY` clauses with all-constant right-hand sides). +* Disable “skip fetch” optimization in bitmap heap scan (Matthias van de Meent) [§](https://postgr.es/c/980727b84) + + It turns out that this optimization can result in returning dead tuples when a concurrent vacuum marks a page all-visible. +* Fix performance issues in GIN index search startup when there are many search keys (Tom Lane, Vinod Sridharan) [§](https://postgr.es/c/d52221cf0) [§](https://postgr.es/c/4b65b085a) + + An indexable clause with many keys (for example, `jsonbcol ?| array[...]` with tens of thousands of array elements) took O(N2) time to start up, and was uncancelable for that interval too. +* Detect missing support procedures in a BRIN index operator class, and report an error instead of crashing (Álvaro Herrera) [§](https://postgr.es/c/e0d8f49a3) +* Respond to interrupts (such as query cancel) while waiting for asynchronous subplans of an Append plan node (Heikki Linnakangas) [§](https://postgr.es/c/004dbbd72) + + Previously, nothing would happen until one of the subplans becomes ready. +* Report the I/O statistics of active WAL senders more frequently (Bertrand Drouvot) [§](https://postgr.es/c/e2a82cd23) + + Previously, the `pg_stat_io` view failed to accumulate I/O performed by a WAL sender until that process exited. Now such I/O will be reported after at most one second's delay. +* Fix race condition in handling of `synchronous_standby_names` immediately after startup (Melnikov Maksim, Michael Paquier) [§](https://postgr.es/c/c922ae2c4) + + For a short period after system startup, backends might fail to wait for synchronous commit even though `synchronous_standby_names` is enabled. +* Avoid infinite loop if `scram_iterations` is set to INT\_MAX (Kevin K Biju) [§](https://postgr.es/c/de1484736) +* Avoid possible crashes due to double transformation of `json_array()`'s subquery (Tom Lane) [§](https://postgr.es/c/ca54f9b70) +* Fix `pg_strtof()` to not crash with null endptr (Alexander Lakhin, Tom Lane) [§](https://postgr.es/c/5c64ece8a) +* Fix crash after out-of-memory in certain GUC assignments (Daniel Gustafsson) [§](https://postgr.es/c/8d48e84c5) +* Avoid crash when a Snowball stemmer encounters an out-of-memory condition (Maksim Korotkov) [§](https://postgr.es/c/c0c364fa1) +* Disallow copying of invalidated replication slots (Shlok Kyal) [§](https://postgr.es/c/87e8599e0) + + This prevents trouble when the invalid slot points to WAL that's already been removed. +* Disallow restoring logical replication slots on standby servers that are not in hot-standby mode (Masahiko Sawada) [§](https://postgr.es/c/cc628f661) + + This prevents a scenario where the slot could remain valid after promotion even if `wal_level` is too low. +* Prevent over-advancement of catalog xmin in “fast forward” mode of logical decoding (Zhijie Hou) [§](https://postgr.es/c/21a7caeeb) + + This mistake could allow deleted catalog entries to be vacuumed away even though they were still potentially needed by the WAL-reading process. +* Avoid data loss when DDL operations that don't take a strong lock affect tables that are being logically replicated (Shlok Kyal, Hayato Kuroda) [§](https://postgr.es/c/9a2f8b4f0) [§](https://postgr.es/c/9987c9466) + + The catalog changes caused by the DDL command were not reflected into WAL-decoding processes, allowing them to decode subsequent changes using stale catalog data, probably resulting in data corruption. +* Prevent incorrect reset of replication origin when an apply worker encounters an error but the error is caught and does not result in worker exit (Hayato Kuroda) [§](https://postgr.es/c/0de091a4b) + + This mistake could allow duplicate data to be applied. +* Avoid duplicate snapshot creation in logical replication index lookups (Heikki Linnakangas) [§](https://postgr.es/c/8171d2dae) [§](https://postgr.es/c/324e0b656) +* Improve detection of mixed-origin subscriptions (Hou Zhijie, Shlok Kyal) [§](https://postgr.es/c/1c2a2354c) + + Subscription creation gives a warning if a subscribed-to table is also being followed through other publications, since that could cause duplicate data to be received. This change improves that logic to also detect cases where a partition parent or child table is the one being followed through another publication. +* Fix wrong checkpoint details in error message about incorrect recovery timeline choice (David Steele) [§](https://postgr.es/c/b4969a296) + + If the requested recovery timeline is not reachable, the reported checkpoint and timeline should be the values read from the backup\_label, if there is one. This message previously reported values from the control file, which is correct when recovering from the control file without a backup\_label, but not when there is a backup\_label. +* Remove incorrect assertion in `pgstat_report_stat()` (Michael Paquier) [§](https://postgr.es/c/e9ab8677b) +* Fix overly-strict assertion in `gistFindCorrectParent()` (Heikki Linnakangas) [§](https://postgr.es/c/419321398) +* Fix rare assertion failure in standby servers when the primary is restarted (Heikki Linnakangas) [§](https://postgr.es/c/2f33de3cd) +* In PL/pgSQL, avoid “unexpected plan node type” error when a scrollable cursor is defined on a simple `SELECT expression` query (Andrei Lepikhov) [§](https://postgr.es/c/a28c1fb61) +* Don't try to drop individual index partitions in pg\_dump's `--clean` mode (Jian He) [§](https://postgr.es/c/a25f21d99) + + The server rejects such `DROP` commands. That has no real consequences, since the partitions will go away anyway in the subsequent `DROP`s of either their parent tables or their partitioned index. However, the error reported for the attempted drop causes problems when restoring in `--single-transaction` mode. +* In pg\_dumpall, avoid emitting invalid role `GRANT` commands if `pg_auth_members` contains invalid role OIDs (Tom Lane) [§](https://postgr.es/c/d850a6600) + + Instead, print a warning and skip the entry. This copes better with catalog corruption that has been seen to occur in back branches as a result of race conditions between `GRANT` and `DROP ROLE`. +* In pg\_amcheck and pg\_upgrade, use the correct function to free allocations made by libpq (Michael Paquier, Ranier Vilela) [§](https://postgr.es/c/9ca2145b0) [§](https://postgr.es/c/57467ec7b) [§](https://postgr.es/c/816149dc6) + + These oversights could result in crashes in certain Windows build configurations, such as a debug build of libpq used by a non-debug build of the calling application. +* Allow `contrib/dblink` queries to be interrupted by query cancel (Noah Misch) [§](https://postgr.es/c/82a8f0f46) + + This change back-patches a v17-era fix. It prevents possible hangs in `CREATE DATABASE` and `DROP DATABASE` due to failure to detect deadlocks. +* Avoid crashing with corrupt input data in `contrib/pageinspect`'s `heap_page_items()` (Dmitry Kovalenko) [§](https://postgr.es/c/2d33cf7b8) +* Prevent assertion failure in `contrib/pg_freespacemap`'s `pg_freespacemap()` (Tender Wang) [§](https://postgr.es/c/41ed749e4) + + Applying `pg_freespacemap()` to a relation lacking storage (such as a view) caused an assertion failure, although there was no ill effect in non-assert builds. Add an error check to reject that case. +* Fix build failure on macOS 15.4 (Tom Lane, Peter Eisentraut) [§](https://postgr.es/c/a39eb9c77) + + This macOS update broke our configuration probe for `strchrnul()`. +* Update time zone data files to tzdata release 2025b for DST law changes in Chile, plus historical corrections for Iran (Tom Lane) [§](https://postgr.es/c/e076120d9) + + There is a new time zone America/Coyhaique for Chile's Aysén Region, to account for it changing to UTC-03 year-round and thus diverging from America/Santiago. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-16-10.html "E.2. Release 16.10") | [Up](release.html "Appendix E. Release Notes") | [Next](release-16-8.html "E.4. Release 16.8") | +| E.2. Release 16.10 | [Home](index.html "PostgreSQL 16.11 Documentation") | E.4. Release 16.8 | + +[Previous](/docs/release/16.8/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/16.10/) diff --git a/corpus/changelog/postgresql_releases/postgresql_170.md b/corpus/changelog/postgresql_releases/postgresql_170.md new file mode 100644 index 0000000000000000000000000000000000000000..8eb7a169f5f767c56f71dadf8ee31d516b124b36 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_170.md @@ -0,0 +1,954 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/17.0/ +Version: 17.0 + +## PostgreSQL 17.0 + +| E.8. Release 17 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-17-1.html "E.7. Release 17.1") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 17.7 Documentation") | [Next](release-prior.html "E.9. Prior Releases") | + +--- + +## E.8. Release 17 [#](#RELEASE-17) + +[E.8.1. Overview](release-17.html#RELEASE-17-HIGHLIGHTS) + +[E.8.2. Migration to Version 17](release-17.html#RELEASE-17-MIGRATION) + +[E.8.3. Changes](release-17.html#RELEASE-17-CHANGES) + +[E.8.4. Acknowledgments](release-17.html#RELEASE-17-ACKNOWLEDGEMENTS) + +**Release date:**2024-09-26 + +### E.8.1. Overview [#](#RELEASE-17-HIGHLIGHTS) + +PostgreSQL 17 contains many new features and enhancements, including: + +* New memory management system for `VACUUM`, which reduces memory consumption and can improve overall vacuuming performance. +* New SQL/JSON capabilities, including constructors, identity functions, and the [`JSON_TABLE()`](functions-json.html#FUNCTIONS-SQLJSON-TABLE "9.16.4. JSON_TABLE") function, which converts JSON data into a table representation. +* Various query performance improvements, including for sequential reads using streaming I/O, write throughput under high concurrency, and searches over multiple values in a [btree](btree.html "64.1. B-Tree Indexes") index. +* Logical replication enhancements, including: + + + Failover control + + [pg\_createsubscriber](app-pgcreatesubscriber.html "pg_createsubscriber"), a utility that creates logical replicas from physical standbys + + [pg\_upgrade](pgupgrade.html "pg_upgrade") now preserves logical replication slots on publishers and full subscription state on subscribers. This will allow upgrades to future major versions to continue logical replication without requiring copy to resynchronize. +* New client-side connection option, [`sslnegotiation=direct`](libpq-connect.html#LIBPQ-CONNECT-SSLNEGOTIATION), that performs a direct TLS handshake to avoid a round-trip negotiation. +* [pg\_basebackup](app-pgbasebackup.html "pg_basebackup") now supports incremental backup. +* [`COPY`](sql-copy.html "COPY") adds a new option, `ON_ERROR ignore`, that allows a copy operation to continue in the event of an error. + +The above items and other new features of PostgreSQL 17 are explained in more detail in the sections below. + +### E.8.2. Migration to Version 17 [#](#RELEASE-17-MIGRATION) + +A dump/restore using [pg\_dumpall](app-pg-dumpall.html "pg_dumpall") or use of [pg\_upgrade](pgupgrade.html "pg_upgrade") or logical replication is required for those wishing to migrate data from any previous release. See [Section 18.6](upgrading.html "18.6. Upgrading a PostgreSQL Cluster") for general information on migrating to new major releases. + +Version 17 contains a number of changes that may affect compatibility with previous releases. Observe the following incompatibilities: + +* Change functions to use a safe [search\_path](runtime-config-client.html#GUC-SEARCH-PATH) during maintenance operations (Jeff Davis) [§](https://postgr.es/c/2af07e2f7) [§](https://postgr.es/c/b4da732fd64) + + This prevents maintenance operations (`ANALYZE`, `CLUSTER`, `CREATE INDEX`, `CREATE MATERIALIZED VIEW`, `REFRESH MATERIALIZED VIEW`, `REINDEX`, or `VACUUM`) from performing unsafe access. Functions used by expression indexes and materialized views that need to reference non-default schemas must specify a search path during function creation. +* Restrict `ago` to only appear at the end in `interval` values (Joseph Koshakow) [§](https://postgr.es/c/165d581f1) [§](https://postgr.es/c/617f9b7d4) + + Also, prevent empty interval units from appearing multiple times. +* Remove server variable old\_snapshot\_threshold (Thomas Munro) [§](https://postgr.es/c/f691f5b80) + + This variable allowed vacuum to remove rows that potentially could be still visible to running transactions, causing "snapshot too old" errors later if accessed. This feature might be re-added to PostgreSQL later if an improved implementation is found. +* Change [`SET SESSION AUTHORIZATION`](sql-set-session-authorization.html "SET SESSION AUTHORIZATION") handling of the initial session user's superuser status (Joseph Koshakow) [§](https://postgr.es/c/a0363ab7a) + + The new behavior is based on the session user's superuser status at the time the `SET SESSION AUTHORIZATION` command is issued, rather than their superuser status at connection time. +* Remove feature which simulated per-database users (Nathan Bossart) [§](https://postgr.es/c/884eee5bf) + + The feature, `db_user_namespace`, was rarely used. +* Remove adminpack contrib extension (Daniel Gustafsson) [§](https://postgr.es/c/cc09e6549) + + This was used by now end-of-life pgAdmin III. +* Remove [wal\_sync\_method](runtime-config-wal.html#GUC-WAL-SYNC-METHOD) value `fsync_writethrough` on Windows (Thomas Munro) [§](https://postgr.es/c/d0c28601e) + + This value was the same as `fsync` on Windows. +* Change file boundary handling of two WAL file name functions (Kyotaro Horiguchi, Andres Freund, Bruce Momjian) [§](https://postgr.es/c/344afc776) + + The functions [`pg_walfile_name()`](functions-admin.html#FUNCTIONS-ADMIN-BACKUP-TABLE "Table 9.95. Backup Control Functions") and `pg_walfile_name_offset()` used to report the previous LSN segment number when the LSN was on a file segment boundary; it now returns the current LSN segment. +* Remove server variable `trace_recovery_messages` since it is no longer needed (Bharath Rupireddy) [§](https://postgr.es/c/c7a3e6b46) +* Remove [information schema](information-schema.html "Chapter 35. The Information Schema") column `element_types`.`domain_default` (Peter Eisentraut) [§](https://postgr.es/c/78806a950) +* Change [pgrowlocks](pgrowlocks.html "F.29. pgrowlocks — show a table's row locking information") lock mode output labels (Bruce Momjian) [§](https://postgr.es/c/15d5d7405) +* Remove `buffers_backend` and `buffers_backend_fsync` from [`pg_stat_bgwriter`](monitoring-stats.html#MONITORING-PG-STAT-BGWRITER-VIEW "27.2.14. pg_stat_bgwriter") (Bharath Rupireddy) [§](https://postgr.es/c/74604a37f) + + These fields are considered redundant to similar columns in [`pg_stat_io`](monitoring-stats.html#MONITORING-PG-STAT-IO-VIEW "27.2.13. pg_stat_io"). +* Rename I/O block read/write timing statistics columns of [pg\_stat\_statements](pgstatstatements.html "F.30. pg_stat_statements — track statistics of SQL planning and execution") (Nazir Bilal Yavuz) [§](https://postgr.es/c/13d00729d) + + This renames `blk_read_time` to `shared_blk_read_time`, and `blk_write_time` to `shared_blk_write_time`. +* Change [`pg_attribute`.`attstattarget`](catalog-pg-attribute.html "51.7. pg_attribute") and `pg_statistic_ext`.`stxstattarget` to represent the default statistics target as `NULL` (Peter Eisentraut) [§](https://postgr.es/c/4f622503d) [§](https://postgr.es/c/012460ee9) +* Rename [`pg_collation`.`colliculocale`](catalog-pg-collation.html "51.12. pg_collation") to `colllocale` and [`pg_database`.`daticulocale`](catalog-pg-database.html "51.15. pg_database") to `datlocale` (Jeff Davis) [§](https://postgr.es/c/f696c0cd5) +* Rename [`pg_stat_progress_vacuum`](progress-reporting.html#VACUUM-PROGRESS-REPORTING "27.4.5. VACUUM Progress Reporting") column `max_dead_tuples` to `max_dead_tuple_bytes`, rename `num_dead_tuples` to `num_dead_item_ids`, and add `dead_tuple_bytes` (Masahiko Sawada) [§](https://postgr.es/c/667e65aac) [§](https://postgr.es/c/f1affb670) +* Rename SLRU columns in system view [`pg_stat_slru`](monitoring-stats.html#MONITORING-PG-STAT-SLRU-VIEW "27.2.25. pg_stat_slru") (Alvaro Herrera) [§](https://postgr.es/c/bcdfa5f2e) + + The column names accepted by [`pg_stat_reset_slru()`](monitoring-stats.html#MONITORING-STATS-FUNCS-TABLE "Table 27.36. Additional Statistics Functions") are also changed. + +### E.8.3. Changes [#](#RELEASE-17-CHANGES) + +Below you will find a detailed account of the changes between PostgreSQL 17 and the previous major release. + +#### E.8.3.1. Server [#](#RELEASE-17-SERVER) + +##### E.8.3.1.1. Optimizer [#](#RELEASE-17-OPTIMIZER) + +* Allow the optimizer to improve CTE plans by considering the statistics and sort order of columns referenced in earlier row output clauses (Jian Guo, Richard Guo, Tom Lane) [§](https://postgr.es/c/f7816aec2) [§](https://postgr.es/c/a65724dfa) +* Improve optimization of `IS NOT NULL` and `IS NULL` query restrictions (David Rowley, Richard Guo, Andy Fan) [§](https://postgr.es/c/b262ad440) [§](https://postgr.es/c/3af704098) + + Remove `IS NOT NULL` restrictions from queries on `NOT NULL` columns and eliminate scans on `NOT NULL` columns if `IS NULL` is specified. +* Allow partition pruning on boolean columns on `IS [NOT] UNKNOWN` conditionals (David Rowley) [§](https://postgr.es/c/07c36c133) +* Improve optimization of range values when using containment operators <@ and @> (Kim Johan Andersson, Jian He) [§](https://postgr.es/c/075df6b20) +* Allow correlated `IN` subqueries to be transformed into joins (Andy Fan, Tom Lane) [§](https://postgr.es/c/9f1337639) +* Improve optimization of the `LIMIT` clause on partitioned tables, inheritance parents, and `UNION ALL` queries (Andy Fan, David Rowley) [§](https://postgr.es/c/a8a968a82) +* Allow query nodes to be run in parallel in more cases (Tom Lane) [§](https://postgr.es/c/e08d74ca1) +* Allow `GROUP BY` columns to be internally ordered to match `ORDER BY` (Andrei Lepikhov, Teodor Sigaev) [§](https://postgr.es/c/0452b461b) + + This can be disabled using server variable [enable\_group\_by\_reordering](runtime-config-query.html#GUC-ENABLE-GROUPBY-REORDERING). +* Allow `UNION` (without `ALL`) to use MergeAppend (David Rowley) [§](https://postgr.es/c/66c0185a3) +* Fix MergeAppend plans to more accurately compute the number of rows that need to be sorted (Alexander Kuzmenkov) [§](https://postgr.es/c/9d1a5354f) +* Allow [GiST](gist.html "64.2. GiST Indexes") and [SP-GiST](spgist.html "64.3. SP-GiST Indexes") indexes to be part of incremental sorts (Miroslav Bendik) [§](https://postgr.es/c/625d5b3ca) + + This is particularly useful for `ORDER BY` clauses where the first column has a GiST and SP-GiST index, and other columns do not. +* Add columns to [`pg_stats`](view-pg-stats.html "52.27. pg_stats") to report range-type histogram information (Egor Rogov, Soumyadeep Chakraborty) [§](https://postgr.es/c/bc3c8db8a) + +##### E.8.3.1.2. Indexes [#](#RELEASE-17-INDEXES) + +* Allow [btree](btree.html "64.1. B-Tree Indexes") indexes to more efficiently find a set of values, such as those supplied by `IN` clauses using constants (Peter Geoghegan, Matthias van de Meent) [§](https://postgr.es/c/5bf748b86) +* Allow [BRIN](brin.html "64.5. BRIN Indexes") indexes to be created using parallel workers (Tomas Vondra, Matthias van de Meent) [§](https://postgr.es/c/b43757171) + +##### E.8.3.1.3. General Performance [#](#RELEASE-17-PERFORMANCE) + +* Allow vacuum to more efficiently remove and freeze tuples (Melanie Plageman, Heikki Linnakangas) [§](https://postgr.es/c/6dbb49026) + + WAL traffic caused by vacuum is also more compact. +* Allow vacuum to more efficiently store tuple references (Masahiko Sawada, John Naylor) [§](https://postgr.es/c/ee1b30f12) [§](https://postgr.es/c/30e144287) [§](https://postgr.es/c/667e65aac) [§](https://postgr.es/c/6dbb49026) + + Additionally, vacuum is no longer silently limited to one gigabyte of memory when [maintenance\_work\_mem](runtime-config-resource.html#GUC-MAINTENANCE-WORK-MEM) or [autovacuum\_work\_mem](runtime-config-resource.html#GUC-AUTOVACUUM-WORK-MEM) are higher. +* Optimize vacuuming of relations with no indexes (Melanie Plageman) [§](https://postgr.es/c/c120550ed) +* Increase default [vacuum\_buffer\_usage\_limit](runtime-config-resource.html#GUC-VACUUM-BUFFER-USAGE-LIMIT) to 2MB (Thomas Munro) [§](https://postgr.es/c/98f320eb2) +* Improve performance when checking roles with many memberships (Nathan Bossart) [§](https://postgr.es/c/d365ae705) +* Improve performance of heavily-contended WAL writes (Bharath Rupireddy) [§](https://postgr.es/c/71e4cc6b8) +* Improve performance when transferring large blocks of data to a client (Melih Mutlu) [§](https://postgr.es/c/c4ab7da60) +* Allow the grouping of file system reads with the new system variable [io\_combine\_limit](runtime-config-resource.html#GUC-IO-COMBINE-LIMIT) (Thomas Munro, Andres Freund, Melanie Plageman, Nazir Bilal Yavuz) [§](https://postgr.es/c/210622c60) [§](https://postgr.es/c/b7b0f3f27) [§](https://postgr.es/c/041b96802) + +##### E.8.3.1.4. Monitoring [#](#RELEASE-17-MONITORING) + +* Create system view [`pg_stat_checkpointer`](monitoring-stats.html#MONITORING-PG-STAT-CHECKPOINTER-VIEW "27.2.15. pg_stat_checkpointer") (Bharath Rupireddy, Anton A. Melnikov, Alexander Korotkov) [§](https://postgr.es/c/96f052613) [§](https://postgr.es/c/12915a58e) [§](https://postgr.es/c/e820db5b5) + + Relevant columns have been removed from [`pg_stat_bgwriter`](monitoring-stats.html#PG-STAT-BGWRITER-VIEW "Table 27.24. pg_stat_bgwriter View") and added to this new system view. +* Improve control over resetting statistics (Atsushi Torikoshi, Bharath Rupireddy) [§](https://postgr.es/c/23c8c0c8f) [§](https://postgr.es/c/2e8a0edc2) [§](https://postgr.es/c/e5cca6288) + + Allow [`pg_stat_reset_shared()`](monitoring-stats.html#MONITORING-STATS-FUNCS-TABLE "Table 27.36. Additional Statistics Functions") (with no arguments) and pg\_stat\_reset\_shared(`NULL`) to reset all shared statistics. Allow pg\_stat\_reset\_shared('slru') and [`pg_stat_reset_slru()`](monitoring-stats.html#MONITORING-STATS-FUNCS-TABLE "Table 27.36. Additional Statistics Functions") (with no arguments) to reset SLRU statistics, which was already possible with pg\_stat\_reset\_slru(NULL). +* Add log messages related to WAL recovery from backups (Andres Freund) [§](https://postgr.es/c/1d35f705e) +* Add [log\_connections](runtime-config-logging.html#GUC-LOG-CONNECTIONS) log line for `trust` connections (Jacob Champion) [§](https://postgr.es/c/e48b19c5d) +* Add log message to report walsender acquisition and release of replication slots (Bharath Rupireddy) [§](https://postgr.es/c/7c3fb505b) + + This is enabled by the server variable [log\_replication\_commands](runtime-config-logging.html#GUC-LOG-REPLICATION-COMMANDS). +* Add system view [`pg_wait_events`](view-pg-wait-events.html "52.36. pg_wait_events") that reports wait event types (Bertrand Drouvot) [§](https://postgr.es/c/1e68e43d3) + + This is useful for adding descriptions to wait events reported in [`pg_stat_activity`](monitoring-stats.html#MONITORING-PG-STAT-ACTIVITY-VIEW "27.2.3. pg_stat_activity"). +* Add [wait events](view-pg-wait-events.html "52.36. pg_wait_events") for checkpoint delays (Thomas Munro) [§](https://postgr.es/c/0013ba290) +* Allow vacuum to report the progress of index processing (Sami Imseih) [§](https://postgr.es/c/46ebdfe16) + + This appears in system view [`pg_stat_progress_vacuum`](progress-reporting.html#PG-STAT-PROGRESS-VACUUM-VIEW "Table 27.45. pg_stat_progress_vacuum View") columns `indexes_total` and `indexes_processed`. + +##### E.8.3.1.5. Privileges [#](#RELEASE-17-PRIVILEGES) + +* Allow granting the right to perform maintenance operations (Nathan Bossart) [§](https://postgr.es/c/ecb0fd337) + + The permission can be granted on a per-table basis using the [`MAINTAIN`](ddl-priv.html#DDL-PRIV-MAINTAIN) privilege and on a per-role basis via the [`pg_maintain`](predefined-roles.html "21.5. Predefined Roles") predefined role. Permitted operations are `VACUUM`, `ANALYZE`, `REINDEX`, `REFRESH MATERIALIZED VIEW`, `CLUSTER`, and `LOCK TABLE`. +* Allow roles with [`pg_monitor`](predefined-roles.html "21.5. Predefined Roles") membership to execute [`pg_current_logfile()`](functions-info.html#FUNCTIONS-INFO-SESSION-TABLE "Table 9.69. Session Information Functions") (Pavlo Golub, Nathan Bossart) [§](https://postgr.es/c/8d8afd48d) + +##### E.8.3.1.6. Server Configuration [#](#RELEASE-17-SERVER-CONFIG) + +* Add system variable [allow\_alter\_system](runtime-config-compatible.html#GUC-ALLOW-ALTER-SYSTEM) to disallow [`ALTER SYSTEM`](sql-altersystem.html "ALTER SYSTEM") (Jelte Fennema-Nio, Gabriele Bartolini) [§](https://postgr.es/c/d3ae2a24f) +* Allow [`ALTER SYSTEM`](sql-altersystem.html "ALTER SYSTEM") to set unrecognized custom server variables (Tom Lane) [§](https://postgr.es/c/2d870b4ae) + + This is also possible with [`GRANT ON PARAMETER`](sql-grant.html "GRANT"). +* Add server variable [transaction\_timeout](runtime-config-client.html#GUC-TRANSACTION-TIMEOUT) to restrict the duration of transactions (Andrey Borodin, Japin Li, Junwang Zhao, Alexander Korotkov) [§](https://postgr.es/c/51efe38cb) [§](https://postgr.es/c/bf82f4379) [§](https://postgr.es/c/28e858c0f) +* Add a builtin platform-independent collation provider (Jeff Davis) [§](https://postgr.es/c/2d819a08a) [§](https://postgr.es/c/846311051) [§](https://postgr.es/c/f69319f2f) [§](https://postgr.es/c/9acae56ce) + + This supports `C` and `C.UTF-8` collations. +* Add server variable [huge\_pages\_status](runtime-config-preset.html#GUC-HUGE-PAGES-STATUS) to report the use of huge pages by Postgres (Justin Pryzby) [§](https://postgr.es/c/a14354cac) + + This is useful when [huge\_pages](runtime-config-resource.html#GUC-HUGE-PAGES) is set to `try`. +* Add server variable to disable event triggers (Daniel Gustafsson) [§](https://postgr.es/c/7750fefdb) + + The setting, [event\_triggers](runtime-config-client.html#GUC-EVENT-TRIGGERS), allows for the temporary disabling of event triggers for debugging. +* Allow the [SLRU](monitoring-stats.html#MONITORING-PG-STAT-SLRU-VIEW "27.2.25. pg_stat_slru") cache sizes to be configured (Andrey Borodin, Dilip Kumar, Alvaro Herrera) [§](https://postgr.es/c/53c2a97a9) + + The new server variables are [commit\_timestamp\_buffers](runtime-config-resource.html#GUC-COMMIT-TIMESTAMP-BUFFERS), [multixact\_member\_buffers](runtime-config-resource.html#GUC-MULTIXACT-MEMBER-BUFFERS), [multixact\_offset\_buffers](runtime-config-resource.html#GUC-MULTIXACT-OFFSET-BUFFERS), [notify\_buffers](runtime-config-resource.html#GUC-NOTIFY-BUFFERS), [serializable\_buffers](runtime-config-resource.html#GUC-SERIALIZABLE-BUFFERS), [subtransaction\_buffers](runtime-config-resource.html#GUC-SUBTRANSACTION-BUFFERS), and [transaction\_buffers](runtime-config-resource.html#GUC-TRANSACTION-BUFFERS). [commit\_timestamp\_buffers](runtime-config-resource.html#GUC-COMMIT-TIMESTAMP-BUFFERS), [transaction\_buffers](runtime-config-resource.html#GUC-TRANSACTION-BUFFERS), and [subtransaction\_buffers](runtime-config-resource.html#GUC-SUBTRANSACTION-BUFFERS) scale up automatically with [shared\_buffers](runtime-config-resource.html#GUC-SHARED-BUFFERS). + +##### E.8.3.1.7. Streaming Replication and Recovery [#](#RELEASE-17-REPLICATION) + +* Add support for incremental file system backup (Robert Haas, Jakub Wartak, Tomas Vondra) [§](https://postgr.es/c/dc2123400) [§](https://postgr.es/c/f8ce4ed78) + + Incremental backups can be created using [pg\_basebackup](app-pgbasebackup.html "pg_basebackup")'s new `--incremental` option. The new application [pg\_combinebackup](app-pgcombinebackup.html "pg_combinebackup") allows manipulation of base and incremental file system backups. +* Allow the creation of WAL summarization files (Robert Haas, Nathan Bossart, Hubert Depesz Lubaczewski) [§](https://postgr.es/c/174c48050) [§](https://postgr.es/c/d97ef756a) [§](https://postgr.es/c/f896057e4) [§](https://postgr.es/c/d9ef650fc) + + These files record the block numbers that have changed within an [LSN](datatype-pg-lsn.html "8.20. pg_lsn Type") range and are useful for incremental file system backups. This is controlled by the server variables [summarize\_wal](runtime-config-wal.html#GUC-SUMMARIZE-WAL) and [wal\_summary\_keep\_time](runtime-config-wal.html#GUC-WAL-SUMMARY-KEEP-TIME), and introspected with [`pg_available_wal_summaries()`](functions-info.html#FUNCTIONS-WAL-SUMMARY "Table 9.92. WAL Summarization Information Functions"), `pg_wal_summary_contents()`, and `pg_get_wal_summarizer_state()`. +* Add the system identifier to file system [backup manifest](backup-manifest-format.html "Chapter 69. Backup Manifest Format") files (Amul Sul) [§](https://postgr.es/c/2041bc427) + + This helps detect invalid WAL usage. +* Allow connection string value `dbname` to be written when [pg\_basebackup](app-pgbasebackup.html "pg_basebackup") writes connection information to `postgresql.auto.conf` (Vignesh C, Hayato Kuroda) [§](https://postgr.es/c/a145f424d) +* Add column [`pg_replication_slots`.`invalidation_reason`](view-pg-replication-slots.html "52.19. pg_replication_slots") to report the reason for invalid slots (Shveta Malik, Bharath Rupireddy) [§](https://postgr.es/c/007693f2a) [§](https://postgr.es/c/6ae701b43) +* Add column [`pg_replication_slots`.`inactive_since`](view-pg-replication-slots.html "52.19. pg_replication_slots") to report slot inactivity duration (Bharath Rupireddy) [§](https://postgr.es/c/a11f330b5) [§](https://postgr.es/c/6d49c8d4b) [§](https://postgr.es/c/6f132ed69) +* Add function [`pg_sync_replication_slots()`](functions-admin.html#FUNCTIONS-REPLICATION-TABLE "Table 9.99. Replication Management Functions") to synchronize logical replication slots (Hou Zhijie, Shveta Malik, Ajin Cherian, Peter Eisentraut) [§](https://postgr.es/c/ddd5f4f54) [§](https://postgr.es/c/7a424ece4) +* Add the `failover` property to the [replication protocol](protocol-replication.html "53.4. Streaming Replication Protocol") (Hou Zhijie, Shveta Malik) [§](https://postgr.es/c/732924043) + +##### E.8.3.1.8. [Logical Replication](logical-replication.html "Chapter 29. Logical Replication") [#](#RELEASE-17-LOGICAL) + +* Add application [pg\_createsubscriber](app-pgcreatesubscriber.html "pg_createsubscriber") to create a logical replica from a physical standby server (Euler Taveira) [§](https://postgr.es/c/d44032d01) +* Have [pg\_upgrade](pgupgrade.html "pg_upgrade") migrate valid logical slots and subscriptions (Hayato Kuroda, Hou Zhijie, Vignesh C, Julien Rouhaud, Shlok Kyal) [§](https://postgr.es/c/29d0a77fa) [§](https://postgr.es/c/9a17be1e2) + + This allows logical replication to continue quickly after the upgrade. This only works for old PostgreSQL clusters that are version 17 or later. +* Enable the failover of [logical slots](logical-replication-subscription.html#LOGICAL-REPLICATION-SUBSCRIPTION-SLOT "29.2.1. Replication Slot Management") (Hou Zhijie, Shveta Malik, Ajin Cherian) [§](https://postgr.es/c/c393308b6) + + This is controlled by an optional fifth argument to [`pg_create_logical_replication_slot()`](functions-admin.html#FUNCTIONS-REPLICATION-TABLE "Table 9.99. Replication Management Functions"). +* Add server variable [sync\_replication\_slots](runtime-config-replication.html#GUC-SYNC-REPLICATION-SLOTS) to enable failover logical slot synchronization (Shveta Malik, Hou Zhijie, Peter Smith) [§](https://postgr.es/c/93db6cbda) [§](https://postgr.es/c/60c07820d) +* Add logical replication failover control to [`CREATE/ALTER SUBSCRIPTION`](sql-createsubscription.html "CREATE SUBSCRIPTION") (Shveta Malik, Hou Zhijie, Ajin Cherian) [§](https://postgr.es/c/776621a5e) [§](https://postgr.es/c/22f7e61a6) +* Allow the application of logical replication changes to use [hash](hash-index.html "64.6. Hash Indexes") indexes on the subscriber (Hayato Kuroda) [§](https://postgr.es/c/edca34243) + + Previously only [btree](btree.html "64.1. B-Tree Indexes") indexes could be used for this purpose. +* Improve [logical decoding](logicaldecoding.html "Chapter 47. Logical Decoding") performance in cases where there are many subtransactions (Masahiko Sawada) [§](https://postgr.es/c/5bec1d6bc) +* Restart apply workers if subscription owner's superuser privileges are revoked (Vignesh C) [§](https://postgr.es/c/79243de13) + + This forces reauthentication. +* Add `flush` option to [`pg_logical_emit_message()`](functions-admin.html#FUNCTIONS-REPLICATION-TABLE "Table 9.99. Replication Management Functions") (Michael Paquier) [§](https://postgr.es/c/173b56f1e) + + This makes the message durable. +* Allow specification of physical standbys that must be synchronized before they are visible to subscribers (Hou Zhijie, Shveta Malik) [§](https://postgr.es/c/bf279ddd1) [§](https://postgr.es/c/0f934b073) + + The new server variable is [synchronized\_standby\_slots](runtime-config-replication.html#GUC-SYNCHRONIZED-STANDBY-SLOTS). +* Add worker type column to [`pg_stat_subscription`](monitoring-stats.html#MONITORING-PG-STAT-SUBSCRIPTION "27.2.8. pg_stat_subscription") (Peter Smith) [§](https://postgr.es/c/13aeaf079) + +#### E.8.3.2. Utility Commands [#](#RELEASE-17-UTILITY) + +* Add new [`COPY`](sql-copy.html "COPY") option `ON_ERROR ignore` to discard error rows (Damir Belyalov, Atsushi Torikoshi, Alex Shulgin, Jian He, Yugo Nagata) [§](https://postgr.es/c/9e2d87011) [§](https://postgr.es/c/b725b7eec) [§](https://postgr.es/c/40bbc8cf0) [§](https://postgr.es/c/a6d0fa5ef) + + The default behavior is `ON_ERROR stop`. +* Add new `COPY` option `LOG_VERBOSITY` which reports `COPY FROM` ignored error rows (Bharath Rupireddy) [§](https://postgr.es/c/f5a227895) +* Allow `COPY FROM` to report the number of skipped rows during processing (Atsushi Torikoshi) [§](https://postgr.es/c/729439607) + + This appears in system view column [`pg_stat_progress_copy`.`tuples_skipped`](progress-reporting.html#COPY-PROGRESS-REPORTING "27.4.3. COPY Progress Reporting"). +* In `COPY FROM`, allow easy specification that all columns should be forced null or not null (Zhang Mingli) [§](https://postgr.es/c/f6d4c9cf1) +* Allow partitioned tables to have identity columns (Ashutosh Bapat) [§](https://postgr.es/c/699586315) +* Allow [exclusion constraints](ddl-constraints.html#DDL-CONSTRAINTS-EXCLUSION "5.5.6. Exclusion Constraints") on partitioned tables (Paul A. Jungwirth) [§](https://postgr.es/c/8c852ba9a) + + As long as exclusion constraints compare partition key columns for equality, other columns can use exclusion constraint-specific comparisons. +* Add clearer [`ALTER TABLE`](sql-altertable.html "ALTER TABLE") method to set a column to the default statistics target (Peter Eisentraut) [§](https://postgr.es/c/4f622503d) + + The new syntax is `ALTER TABLE ... SET STATISTICS DEFAULT`; using `SET STATISTICS -1` is still supported. +* Allow `ALTER TABLE` to change a column's generation expression (Amul Sul) [§](https://postgr.es/c/5d06e99a3) + + The syntax is `ALTER TABLE ... ALTER COLUMN ... SET EXPRESSION`. +* Allow specification of [table access methods](tableam.html "Chapter 61. Table Access Method Interface Definition") on partitioned tables (Justin Pryzby, Soumyadeep Chakraborty, Michael Paquier) [§](https://postgr.es/c/374c7a229) [§](https://postgr.es/c/e2395cdbe) +* Add `DEFAULT` setting for `ALTER TABLE .. SET ACCESS METHOD` (Michael Paquier) [§](https://postgr.es/c/d61a6cad6) +* Add support for [event triggers](sql-createeventtrigger.html "CREATE EVENT TRIGGER") that fire at connection time (Konstantin Knizhnik, Mikhail Gribkov) [§](https://postgr.es/c/e83d1b0c4) +* Add event trigger support for [`REINDEX`](sql-reindex.html "REINDEX") (Garrett Thornburg, Jian He) [§](https://postgr.es/c/f21848de2) +* Allow parenthesized syntax for [`CLUSTER`](sql-cluster.html "CLUSTER") options if a table name is not specified (Nathan Bossart) [§](https://postgr.es/c/cdaedfc96) + +##### E.8.3.2.1. [`EXPLAIN`](sql-explain.html "EXPLAIN") [#](#RELEASE-17-EXPLAIN) + +* Allow `EXPLAIN` to report optimizer memory usage (Ashutosh Bapat) [§](https://postgr.es/c/5de890e36) + + The option is called `MEMORY`. +* Add `EXPLAIN` option `SERIALIZE` to report the cost of converting data for network transmission (Stepan Rutz, Matthias van de Meent) [§](https://postgr.es/c/06286709e) +* Add local I/O block read/write timing statistics to `EXPLAIN`'s `BUFFERS` output (Nazir Bilal Yavuz) [§](https://postgr.es/c/295c36c0c) +* Improve `EXPLAIN`'s display of SubPlan nodes and output parameters (Tom Lane, Dean Rasheed) [§](https://postgr.es/c/fd0398fcb) +* Add JIT `deform_counter` details to `EXPLAIN` (Dmitry Dolgov) [§](https://postgr.es/c/5a3423ad8) + +#### E.8.3.3. Data Types [#](#RELEASE-17-DATATYPES) + +* Allow the `interval` data type to support `+/-infinity` values (Joseph Koshakow, Jian He, Ashutosh Bapat) [§](https://postgr.es/c/519fc1bd9) +* Allow the use of an [`ENUM`](datatype-enum.html "8.7. Enumerated Types") added via [`ALTER TYPE`](sql-altertype.html "ALTER TYPE") if the type was created in the same transaction (Tom Lane) [§](https://postgr.es/c/af1d39584) + + This was previously disallowed. + +#### E.8.3.4. [MERGE](sql-merge.html "MERGE") [#](#RELEASE-17-MERGE) + +* Allow `MERGE` to modify updatable views (Dean Rasheed) [§](https://postgr.es/c/5f2e179bd) +* Add `WHEN NOT MATCHED BY SOURCE` to `MERGE` (Dean Rasheed) [§](https://postgr.es/c/0294df2f1) + + `WHEN NOT MATCHED` on target rows was already supported. +* Allow `MERGE` to use the `RETURNING` clause (Dean Rasheed) [§](https://postgr.es/c/c649fa24a) + + The new `RETURNING` function `merge_action()` reports on the DML that generated the row. + +#### E.8.3.5. Functions [#](#RELEASE-17-FUNCTIONS) + +* Add function [`JSON_TABLE()`](functions-json.html#FUNCTIONS-SQLJSON-TABLE "9.16.4. JSON_TABLE") to convert `JSON` data to a table representation (Nikita Glukhov, Teodor Sigaev, Oleg Bartunov, Alexander Korotkov, Andrew Dunstan, Amit Langote, Jian He) [§](https://postgr.es/c/de3600452) [§](https://postgr.es/c/bb766cde6) + + This function can be used in the `FROM` clause of `SELECT` queries as a tuple source. +* Add SQL/JSON constructor functions [`JSON()`](functions-json.html#FUNCTIONS-JSON-CREATION-TABLE "Table 9.47. JSON Creation Functions"), `JSON_SCALAR()`, and `JSON_SERIALIZE()` (Nikita Glukhov, Teodor Sigaev, Oleg Bartunov, Alexander Korotkov, Andrew Dunstan, Amit Langote) [§](https://postgr.es/c/03734a7fe) +* Add SQL/JSON query functions [`JSON_EXISTS()`](functions-json.html#FUNCTIONS-SQLJSON-QUERYING "Table 9.52. SQL/JSON Query Functions"), `JSON_QUERY()`, and `JSON_VALUE()` (Nikita Glukhov, Teodor Sigaev, Oleg Bartunov, Alexander Korotkov, Andrew Dunstan, Amit Langote, Peter Eisentraut, Jian He) [§](https://postgr.es/c/aaaf9449e) [§](https://postgr.es/c/1edb3b491) [§](https://postgr.es/c/6185c9737) [§](https://postgr.es/c/c0fc07518) [§](https://postgr.es/c/ef744ebb7) +* Add [jsonpath](functions-json.html#FUNCTIONS-SQLJSON-PATH-OPERATORS "9.16.2.3. SQL/JSON Path Operators and Methods") methods to convert `JSON` values to other `JSON` data types (Jeevan Chalke) [§](https://postgr.es/c/66ea94e8e) + + The jsonpath methods are `.bigint()`, `.boolean()`, `.date()`, `.decimal([precision [, scale]])`, `.integer()`, `.number()`, `.string()`, `.time()`, `.time_tz()`, `.timestamp()`, and `.timestamp_tz()`. +* Add [`to_timestamp()`](functions-formatting.html#FUNCTIONS-FORMATTING-TABLE "Table 9.26. Formatting Functions") time zone format specifiers (Tom Lane) [§](https://postgr.es/c/8ba6fdf90) + + `TZ` accepts time zone abbreviations or numeric offsets, while `OF` accepts only numeric offsets. +* Allow the session [time zone](runtime-config-client.html#GUC-TIMEZONE) to be specified by `AT LOCAL` (Vik Fearing) [§](https://postgr.es/c/97957fdba) + + This is useful when converting adding and removing time zones from time stamps values, rather than specifying the literal session time zone. +* Add functions [`uuid_extract_timestamp()`](functions-uuid.html "9.14. UUID Functions") and `uuid_extract_version()` to return UUID information (Andrey Borodin) [§](https://postgr.es/c/794f10f6b) +* Add functions to generate random numbers in a specified range (Dean Rasheed) [§](https://postgr.es/c/e6341323a) + + The functions are [`random(min, max)`](functions-math.html#FUNCTIONS-MATH-RANDOM-TABLE "Table 9.6. Random Functions") and they take values of type `integer`, `bigint`, and `numeric`. +* Add functions to convert integers to binary and octal strings (Eric Radman, Nathan Bossart) [§](https://postgr.es/c/260a1f18d) + + The functions are [`to_bin()`](functions-string.html#FUNCTIONS-STRING-OTHER "Table 9.10. Other String Functions and Operators") and `to_oct()`. +* Add Unicode informational functions (Jeff Davis) [§](https://postgr.es/c/a02b37fc0) + + Function [`unicode_version()`](functions-info.html#FUNCTIONS-INFO-VERSION "9.27.11. Version Information Functions") returns the Unicode version, `icu_unicode_version()` returns the ICU version, and `unicode_assigned()` returns if the characters are assigned Unicode codepoints. +* Add function [`xmltext()`](functions-xml.html#FUNCTIONS-PRODUCING-XML-XMLTEXT "9.15.1.1. xmltext") to convert text to a single `XML` text node (Jim Jones) [§](https://postgr.es/c/526fe0d79) +* Add function [`to_regtypemod()`](functions-info.html#FUNCTIONS-INFO-CATALOG-TABLE "Table 9.74. System Catalog Information Functions") to return the type modifier of a type specification (David Wheeler, Erik Wienhold) [§](https://postgr.es/c/1218ca995) +* Add [`pg_basetype()`](functions-info.html#FUNCTIONS-INFO-CATALOG-TABLE "Table 9.74. System Catalog Information Functions") function to return a domain's base type (Steve Chavez) [§](https://postgr.es/c/b154d8a6d) +* Add function [`pg_column_toast_chunk_id()`](functions-admin.html#FUNCTIONS-ADMIN-DBSIZE "Table 9.100. Database Object Size Functions") to return a value's [TOAST](storage-toast.html "65.2. TOAST") identifier (Yugo Nagata) [§](https://postgr.es/c/d1162cfda) + + This returns `NULL` if the value is not stored in TOAST. + +#### E.8.3.6. [PL/pgSQL](plpgsql.html "Chapter 41. PL/pgSQL — SQL Procedural Language") [#](#RELEASE-17-PLPGSQL) + +* Allow plpgsql [`%TYPE`](plpgsql-declarations.html#PLPGSQL-DECLARATION-TYPE "41.3.3. Copying Types") and `%ROWTYPE` specifications to represent arrays of non-array types (Quan Zongliang, Pavel Stehule) [§](https://postgr.es/c/5e8674dc8) +* Allow plpgsql `%TYPE` specification to reference composite column (Tom Lane) [§](https://postgr.es/c/43b46aae1) + +#### E.8.3.7. [libpq](libpq.html "Chapter 32. libpq — C Library") [#](#RELEASE-17-LIBPQ) + +* Add libpq function to change role passwords (Joe Conway) [§](https://postgr.es/c/a7be2a6c2) + + The new function, [`PQchangePassword()`](libpq-misc.html#LIBPQ-PQCHANGEPASSWORD), hashes the new password before sending it to the server. +* Add libpq functions to close portals and prepared statements (Jelte Fennema-Nio) [§](https://postgr.es/c/28b572656) + + The functions are [`PQclosePrepared()`](libpq-exec.html#LIBPQ-PQCLOSEPREPARED), [`PQclosePortal()`](libpq-exec.html#LIBPQ-PQCLOSEPORTAL), [`PQsendClosePrepared()`](libpq-async.html#LIBPQ-PQSENDCLOSEPREPARED), and [`PQsendClosePortal()`](libpq-async.html#LIBPQ-PQSENDCLOSEPORTAL). +* Add libpq API which allows for blocking and non-blocking [cancel requests](libpq-cancel.html "32.7. Canceling Queries in Progress"), with encryption if already in use (Jelte Fennema-Nio) [§](https://postgr.es/c/61461a300) + + Previously only blocking, unencrypted cancel requests were supported. +* Add libpq function [`PQsocketPoll()`](libpq-connect.html#LIBPQ-PQSOCKETPOLL) to allow polling of network sockets (Tristan Partin, Tom Lane) [§](https://postgr.es/c/f5e4dedfa) [§](https://postgr.es/c/105024a47) +* Add libpq function [`PQsendPipelineSync()`](libpq-pipeline-mode.html#LIBPQ-PQSENDPIPELINESYNC) to send a pipeline synchronization point (Anton Kirilov) [§](https://postgr.es/c/4794c2d31) + + This is similar to [`PQpipelineSync()`](libpq-pipeline-mode.html#LIBPQ-PQPIPELINESYNC) but it does not flush to the server unless the size threshold of the output buffer is reached. +* Add libpq function [`PQsetChunkedRowsMode()`](libpq-single-row-mode.html#LIBPQ-PQSETCHUNKEDROWSMODE) to allow retrieval of results in chunks (Daniel Vérité) [§](https://postgr.es/c/4643a2b26) +* Allow TLS connections without requiring a network round-trip negotiation (Greg Stark, Heikki Linnakangas, Peter Eisentraut, Michael Paquier, Daniel Gustafsson) [§](https://postgr.es/c/d39a49c1e) [§](https://postgr.es/c/91044ae4b) [§](https://postgr.es/c/44e27f0a6) [§](https://postgr.es/c/d80f2ce29) [§](https://postgr.es/c/03a0e0d4b) [§](https://postgr.es/c/17a834a04) [§](https://postgr.es/c/407e0b023) [§](https://postgr.es/c/fb5718f35) + + This is enabled with the client-side option [`sslnegotiation=direct`](libpq-connect.html#LIBPQ-CONNECT-SSLNEGOTIATION), requires ALPN, and only works on PostgreSQL 17 and later servers. + +#### E.8.3.8. [psql](app-psql.html "psql") [#](#RELEASE-17-PSQL) + +* Improve psql display of default and empty privileges (Erik Wienhold, Laurenz Albe) [§](https://postgr.es/c/d1379ebf4) + + Command `\dp` now displays `(none)` for empty privileges; default still displays as empty. +* Have backslash commands honor `\pset null` (Erik Wienhold, Laurenz Albe) [§](https://postgr.es/c/d1379ebf4) + + Previously `\pset null` was ignored. +* Allow psql's `\watch` to stop after a minimum number of rows returned (Greg Sabino Mullane) [§](https://postgr.es/c/f347ec76e) + + The parameter is `min_rows`. +* Allow psql connection attempts to be canceled with control-C (Tristan Partin) [§](https://postgr.es/c/cafe10565) +* Allow psql to honor `FETCH_COUNT` for non-`SELECT` queries (Daniel Vérité) [§](https://postgr.es/c/90f517821) +* Improve psql tab completion (Dagfinn Ilmari Mannsåker, Gilles Darold, Christoph Heiss, Steve Chavez, Vignesh C, Pavel Borisov, Jian He) [§](https://postgr.es/c/c951e9042) [§](https://postgr.es/c/d16eb83ab) [§](https://postgr.es/c/cd3424748) [§](https://postgr.es/c/816f10564) [§](https://postgr.es/c/927332b95) [§](https://postgr.es/c/f1bb9284f) [§](https://postgr.es/c/304b6b1a6) [§](https://postgr.es/c/2800fbb2b) + +#### E.8.3.9. Server Applications [#](#RELEASE-17-SERVER-APPS) + +* Add application [pg\_walsummary](app-pgwalsummary.html "pg_walsummary") to dump WAL summary files (Robert Haas) [§](https://postgr.es/c/ee1bfd168) +* Allow [pg\_dump](app-pgdump.html "pg_dump")'s large objects to be restorable in batches (Tom Lane) [§](https://postgr.es/c/a45c78e32) + + This allows the restoration of many large objects to avoid transaction limits and to be restored in parallel. +* Add pg\_dump option `--exclude-extension` (Ayush Vatsa) [§](https://postgr.es/c/522ed12f7) +* Allow [pg\_dump](app-pgdump.html "pg_dump"), [pg\_dumpall](app-pg-dumpall.html "pg_dumpall"), and [pg\_restore](app-pgrestore.html "pg_restore") to specify include/exclude objects in a file (Pavel Stehule, Daniel Gustafsson) [§](https://postgr.es/c/a5cf808be) + + The option is called `--filter`. +* Add the `--sync-method` parameter to several client applications (Justin Pryzby, Nathan Bossart) [§](https://postgr.es/c/8c16ad3b4) + + The applications are [initdb](app-initdb.html "initdb"), [pg\_basebackup](app-pgbasebackup.html "pg_basebackup"), [pg\_checksums](app-pgchecksums.html "pg_checksums"), [pg\_dump](app-pgdump.html "pg_dump"), [pg\_rewind](app-pgrewind.html "pg_rewind"), and [pg\_upgrade](pgupgrade.html "pg_upgrade"). +* Add [pg\_restore](app-pgrestore.html "pg_restore") option `--transaction-size` to allow object restores in transaction batches (Tom Lane) [§](https://postgr.es/c/959b38d77) + + This allows the performance benefits of transaction batches without the problems of excessively large transaction blocks. +* Change [pgbench](pgbench.html "pgbench") debug mode option from `-d` to `--debug` (Greg Sabino Mullane) [§](https://postgr.es/c/3ff01b2b6) + + Option `-d` is now used for the database name, and the new `--dbname` option can be used as well. +* Add pgbench option `--exit-on-abort` to exit after any client aborts (Yugo Nagata) [§](https://postgr.es/c/3c662643c) +* Add pgbench command `\syncpipeline` to allow sending of sync messages (Anthonin Bonnefoy) [§](https://postgr.es/c/94edfe250) +* Allow [pg\_archivecleanup](pgarchivecleanup.html "pg_archivecleanup") to remove backup history files (Atsushi Torikoshi) [§](https://postgr.es/c/3f8c98d0b) + + The option is `--clean-backup-history`. +* Add some long options to pg\_archivecleanup (Atsushi Torikoshi) [§](https://postgr.es/c/dd7c60f19) + + The long options are `--debug`, `--dry-run`, and `--strip-extension`. +* Allow [pg\_basebackup](app-pgbasebackup.html "pg_basebackup") and [pg\_receivewal](app-pgreceivewal.html "pg_receivewal") to use dbname in their connection specification (Jelte Fennema-Nio) [§](https://postgr.es/c/cca97ce6a) + + This is useful for connection poolers that are sensitive to the database name. +* Add [pg\_upgrade](pgupgrade.html "pg_upgrade") option `--copy-file-range` (Thomas Munro) [§](https://postgr.es/c/d93627bcb) + + This is supported on Linux and FreeBSD. +* Allow [reindexdb](app-reindexdb.html "reindexdb") `--index` to process indexes from different tables in parallel (Maxim Orlov, Svetlana Derevyanko, Alexander Korotkov) [§](https://postgr.es/c/47f99a407) +* Allow [reindexdb](app-reindexdb.html "reindexdb"), [vacuumdb](app-vacuumdb.html "vacuumdb"), and [clusterdb](app-clusterdb.html "clusterdb") to process objects in all databases matching a pattern (Nathan Bossart) [§](https://postgr.es/c/24c928ad9) [§](https://postgr.es/c/648928c79) [§](https://postgr.es/c/1b49d56d3) + + The new option `--all` controls this behavior. + +#### E.8.3.10. Source Code [#](#RELEASE-17-SOURCE-CODE) + +* Remove support for OpenSSL 1.0.1 (Michael Paquier) [§](https://postgr.es/c/8e278b657) +* Allow tests to pass in OpenSSL FIPS mode (Peter Eisentraut) [§](https://postgr.es/c/284cbaea7) [§](https://postgr.es/c/3c44e7d8d) +* Use CPU AVX-512 instructions for bit counting (Paul Amonson, Nathan Bossart, Ants Aasma) [§](https://postgr.es/c/792752af4) [§](https://postgr.es/c/41c51f0c6) +* Require LLVM version 10 or later (Thomas Munro) [§](https://postgr.es/c/820b5af73) +* Use native CRC instructions on 64-bit LoongArch CPUs (Xudong Yang) [§](https://postgr.es/c/4d14ccd6a) +* Remove AIX support (Heikki Linnakangas) [§](https://postgr.es/c/0b16bb877) +* Remove the Microsoft Visual Studio-specific PostgreSQL build option (Michael Paquier) [§](https://postgr.es/c/1301c80b2) + + Meson is now the only available method for Visual Studio builds. +* Remove configure option `--disable-thread-safety` (Thomas Munro, Heikki Linnakangas) [§](https://postgr.es/c/68a4b58ec) [§](https://postgr.es/c/ce0b0fa3e) + + We now assume all supported platforms have sufficient thread support. +* Remove configure option `--with-CC` (Heikki Linnakangas) [§](https://postgr.es/c/1c1eec0f2) + + Setting the `CC` environment variable is now the only supported method for specifying the compiler. +* User-defined data type receive functions will no longer receive their data null-terminated (David Rowley) [§](https://postgr.es/c/f0efa5aec) +* Add incremental `JSON` parser for use with huge `JSON` documents (Andrew Dunstan) [§](https://postgr.es/c/3311ea86e) +* Convert top-level `README` file to Markdown (Nathan Bossart) [§](https://postgr.es/c/363eb0599) +* Remove no longer needed top-level `INSTALL` file (Tom Lane) [§](https://postgr.es/c/e2b73f4a4) +* Remove make's `distprep` option (Peter Eisentraut) [§](https://postgr.es/c/721856ff2) +* Add make support for Android shared libraries (Peter Eisentraut) [§](https://postgr.es/c/79b03dbb3) +* Add backend support for injection points (Michael Paquier) [§](https://postgr.es/c/d86d20f0b) [§](https://postgr.es/c/37b369dc6) [§](https://postgr.es/c/f587338de) [§](https://postgr.es/c/bb93640a6) + + This is used for server debugging and they must be enabled at server compile time. +* Add dynamic shared memory registry (Nathan Bossart) [§](https://postgr.es/c/8b2bcf3f2) + + This allows shared libraries which are not initialized at startup to coordinate dynamic shared memory access. +* Fix `emit_log_hook` to use the same time value as other log records for the same query (Kambam Vinay, Michael Paquier) [§](https://postgr.es/c/2a217c371) +* Improve documentation for using `jsonpath` for predicate checks (David Wheeler) [§](https://postgr.es/c/7014c9a4b) + +#### E.8.3.11. Additional Modules [#](#RELEASE-17-MODULES) + +* Allow joins with non-join qualifications to be pushed down to foreign servers and custom scans (Richard Guo, Etsuro Fujita) [§](https://postgr.es/c/9e9931d2b) + + Foreign data wrappers and custom scans will need to be modified to handle these cases. +* Allow pushdown of `EXISTS` and `IN` subqueries to [postgres\_fdw](postgres-fdw.html "F.36. postgres_fdw — access data stored in external PostgreSQL servers") foreign servers (Alexander Pyhalov) [§](https://postgr.es/c/824dbea3e) +* Increase the default foreign data wrapper tuple cost (David Rowley, Umair Shahid) [§](https://postgr.es/c/cac169d68) [§](https://postgr.es/c/f7f694b21) + + This value is used by the optimizer. +* Allow [dblink](dblink.html "F.11. dblink — connect to other PostgreSQL databases") database operations to be interrupted (Noah Misch) [§](https://postgr.es/c/d3c5f37dd) +* Allow the creation of hash indexes on [ltree](ltree.html "F.22. ltree — hierarchical tree-like data type") columns (Tommy Pavlicek) [§](https://postgr.es/c/485f0aa85) + + This also enables hash join and hash aggregation on ltree columns. +* Allow [unaccent](unaccent.html "F.46. unaccent — a text search dictionary which removes diacritics") character translation rules to contain whitespace and quotes (Michael Paquier) [§](https://postgr.es/c/59f47fb98) + + The syntax for the `unaccent.rules` file has changed. +* Allow [amcheck](amcheck.html "F.1. amcheck — tools to verify table and index consistency") to check for unique constraint violations using new option `--checkunique` (Anastasia Lubennikova, Pavel Borisov, Maxim Orlov) [§](https://postgr.es/c/5ae208720) +* Allow [citext](citext.html "F.9. citext — a case-insensitive character string type") tests to pass in OpenSSL FIPS mode (Peter Eisentraut) [§](https://postgr.es/c/3c551ebed) +* Allow [pgcrypto](pgcrypto.html "F.26. pgcrypto — cryptographic functions") tests to pass in OpenSSL FIPS mode (Peter Eisentraut) [§](https://postgr.es/c/795592865) +* Remove some unused [SPI](spi.html "Chapter 45. Server Programming Interface") macros (Bharath Rupireddy) [§](https://postgr.es/c/75680c3d8) +* Allow [`ALTER OPERATOR`](sql-alteroperator.html "ALTER OPERATOR") to set more optimization attributes (Tommy Pavlicek) [§](https://postgr.es/c/2b5154bea) + + This is useful for extensions. +* Allow extensions to define [custom wait events](xfunc-c.html#XFUNC-ADDIN-WAIT-EVENTS "36.10.12. Custom Wait Events") (Masahiro Ikeda) [§](https://postgr.es/c/c9af05465) [§](https://postgr.es/c/c8e318b1b) [§](https://postgr.es/c/d61f2538a) [§](https://postgr.es/c/c789f0f6c) + + Custom wait events have been added to [postgres\_fdw](postgres-fdw.html "F.36. postgres_fdw — access data stored in external PostgreSQL servers") and [dblink](dblink.html "F.11. dblink — connect to other PostgreSQL databases"). +* Add [pg\_buffercache](pgbuffercache.html "F.25. pg_buffercache — inspect PostgreSQL buffer cache state") function `pg_buffercache_evict()` to allow shared buffer eviction (Palak Chaturvedi, Thomas Munro) [§](https://postgr.es/c/13453eedd) + + This is useful for testing. + +##### E.8.3.11.1. [pg\_stat\_statements](pgstatstatements.html "F.30. pg_stat_statements — track statistics of SQL planning and execution") [#](#RELEASE-17-PGSTATSTATEMENTS) + +* Replace [`CALL`](sql-call.html "CALL") parameters in pg\_stat\_statements with placeholders (Sami Imseih) [§](https://postgr.es/c/11c34b342) +* Replace savepoint names stored in `pg_stat_statements` with placeholders (Greg Sabino Mullane) [§](https://postgr.es/c/31de7e60d) + + This greatly reduces the number of entries needed to record [`SAVEPOINT`](sql-savepoint.html "SAVEPOINT"), [`RELEASE SAVEPOINT`](sql-release-savepoint.html "RELEASE SAVEPOINT"), and [`ROLLBACK TO SAVEPOINT`](sql-rollback-to.html "ROLLBACK TO SAVEPOINT") commands. +* Replace the two-phase commit GIDs stored in `pg_stat_statements` with placeholders (Michael Paquier) [§](https://postgr.es/c/638d42a3c) + + This greatly reduces the number of entries needed to record [`PREPARE TRANSACTION`](sql-prepare-transaction.html "PREPARE TRANSACTION"), [`COMMIT PREPARED`](sql-commit-prepared.html "COMMIT PREPARED"), and [`ROLLBACK PREPARED`](sql-rollback-prepared.html "ROLLBACK PREPARED"). +* Track [`DEALLOCATE`](sql-deallocate.html "DEALLOCATE") in `pg_stat_statements` (Dagfinn Ilmari Mannsåker, Michael Paquier) [§](https://postgr.es/c/bb45156f3) + + `DEALLOCATE` names are stored in `pg_stat_statements` as placeholders. +* Add local I/O block read/write timing statistics columns of `pg_stat_statements` (Nazir Bilal Yavuz) [§](https://postgr.es/c/295c36c0c) [§](https://postgr.es/c/5147ab1dd) + + The new columns are `local_blk_read_time` and `local_blk_write_time`. +* Add JIT deform\_counter details to `pg_stat_statements` (Dmitry Dolgov) [§](https://postgr.es/c/5a3423ad8) +* Add optional fourth argument (`minmax_only`) to `pg_stat_statements_reset()` to allow for the resetting of only min/max statistics (Andrei Zubkov) [§](https://postgr.es/c/dc9f8a798) + + This argument defaults to `false`. +* Add `pg_stat_statements` columns `stats_since` and `minmax_stats_since` to track entry creation time and last min/max reset time (Andrei Zubkov) [§](https://postgr.es/c/dc9f8a798) + +### E.8.4. Acknowledgments [#](#RELEASE-17-ACKNOWLEDGEMENTS) + +The following individuals (in alphabetical order) have contributed to this release as patch authors, committers, reviewers, testers, or reporters of issues. + +| | +| --- | +| Abhijit Menon-Sen | +| Adnan Dautovic | +| Aidar Imamov | +| Ajin Cherian | +| Akash Shankaran | +| Akshat Jaimini | +| Alaa Attya | +| Aleksander Alekseev | +| Aleksej Orlov | +| Alena Rybakina | +| Alex Hsieh | +| Alex Malek | +| Alex Shulgin | +| Alex Work | +| Alexander Korotkov | +| Alexander Kozhemyakin | +| Alexander Kuzmenkov | +| Alexander Lakhin | +| Alexander Pyhalov | +| Alexey Palazhchenko | +| Alfons Kemper | +| Álvaro Herrera | +| Amadeo Gallardo | +| Amit Kapila | +| Amit Langote | +| Amul Sul | +| Anastasia Lubennikova | +| Anatoly Zaretsky | +| Andreas Karlsson | +| Andreas Ulbrich | +| Andrei Lepikhov | +| Andrei Zubkov | +| Andres Freund | +| Andrew Alsup | +| Andrew Atkinson | +| Andrew Bille | +| Andrew Dunstan | +| Andrew Kane | +| Andrey Borodin | +| Andrey Rachitskiy | +| Andrey Sokolov | +| Andy Fan | +| Anthonin Bonnefoy | +| Anthony Hsu | +| Anton Kirilov | +| Anton Melnikov | +| Anton Voloshin | +| Antonin Houska | +| Ants Aasma | +| Antti Lampinen | +| Aramaki Zyake | +| Artem Anisimov | +| Artur Zakirov | +| Ashutosh Bapat | +| Ashutosh Sharma | +| Atsushi Torikoshi | +| Attila Gulyás | +| Ayush Tiwari | +| Ayush Vatsa | +| Bartosz Chrol | +| Benoît Ryder | +| Bernd Helmle | +| Bertrand Drouvot | +| Bharath Rupireddy | +| Bo Andreson | +| Boshomi Phenix | +| Bowen Shi | +| Boyu Yang | +| Bruce Momjian | +| Cameron Vogt | +| Cary Huang | +| Cédric Villemain | +| Changhong Fei | +| Chantal Keller | +| Chapman Flack | +| Chengxi Sun | +| Chris Travers | +| Christian Maurer | +| Christian Stork | +| Christoph Berg | +| Christoph Heiss | +| Christophe Courtois | +| Christopher Kline | +| Claudio Freire | +| Colin Caine | +| Corey Huinker | +| Curt Kolovson | +| Dag Lem | +| Dagfinn Ilmari Mannsåker | +| Damir Belyalov | +| Daniel Fredouille | +| Daniel Gustafsson | +| Daniel Shelepanov | +| Daniel Vérité | +| Daniel Westermann | +| Darren Rush | +| Dave Cramer | +| Dave Page | +| David Christensen | +| David Cook | +| David G. Johnston | +| David Geier | +| David Hillman | +| David Perez | +| David Rowley | +| David Steele | +| David Wheeler | +| David Zhang | +| Dean Rasheed | +| Denis Erokhin | +| Denis Laxalde | +| Devrim Gündüz | +| Dilip Kumar | +| Dimitrios Apostolou | +| Dmitry Dolgov | +| Dmitry Koval | +| Dmitry Vasiliev | +| Dominique Devienne | +| Dong Wook Lee | +| Donghang Lin | +| Dongming Liu | +| Drew Callahan | +| Drew Kimball | +| Dzmitry Jachnik | +| Egor Chindyaskin | +| Egor Rogov | +| Ekaterina Kiryanova | +| Elena Indrupskaya | +| Elizabeth Christensen | +| Emre Hasegeli | +| Eric Cyr | +| Eric Mutta | +| Eric Radman | +| Eric Ridge | +| Erik Rijkers | +| Erik Wienhold | +| Erki Eessaar | +| Ethan Mertz | +| Etsuro Fujita | +| Eugen Konkov | +| Euler Taveira | +| Evan Macbeth | +| Evgeny Morozov | +| Fabien Coelho | +| Fabrízio de Royes Mello | +| Farias de Oliveira | +| Feliphe Pozzer | +| Fire Emerald | +| Flavien Guedez | +| Floris Van Nee | +| Francesco Degrassi | +| Frank Streitzig | +| Gabriele Bartolini | +| Garrett Thornburg | +| Gavin Flower | +| Gavin Panella | +| Gilles Darold | +| Gilles Parc | +| Grant Gryczan | +| Greg Nancarrow | +| Greg Sabino Mullane | +| Greg Stark | +| Gurjeet Singh | +| Haiying Tang | +| Hajime Matsunaga | +| Hal Takahara | +| Hanefi Onaldi | +| Hannu Krosing | +| Hans Buschmann | +| Hao Wu | +| Hao Zhang | +| Hayato Kuroda | +| Heikki Linnakangas | +| Hemanth Sandrana | +| Himanshu Upadhyaya | +| Hironobu Suzuki | +| Holger Reise | +| Hongxu Ma | +| Hongyu Song | +| Horst Reiterer | +| Hubert Lubaczewski | +| Hywel Carver | +| Ian Barwick | +| Ian Ilyasov | +| Ilya Nenashev | +| Isaac Morland | +| Israel Barth Rubio | +| Ivan Kartyshov | +| Ivan Kolombet | +| Ivan Lazarev | +| Ivan Panchenko | +| Ivan Trofimov | +| Jacob Champion | +| Jacob Speidel | +| Jacques Combrink | +| Jaime Casanova | +| Jakub Wartak | +| James Coleman | +| James Pang | +| Jani Rahkola | +| Japin Li | +| Jeevan Chalke | +| Jeff Davis | +| Jeff Janes | +| Jelte Fennema-Nio | +| Jeremy Schneider | +| Jian Guo | +| Jian He | +| Jim Jones | +| Jim Keener | +| Jim Nasby | +| Jingtang Zhang | +| Jingxian Li | +| Jingzhou Fu | +| Joe Conway | +| Joel Jacobson | +| John Ekins | +| John Hsu | +| John Morris | +| John Naylor | +| John Russell | +| Jonathan Katz | +| Jordi Gutiérrez | +| Joseph Koshakow | +| Josh Kupershmidt | +| Joshua D. Drake | +| Joshua Uyehara | +| Jubilee Young | +| Julien Rouhaud | +| Junwang Zhao | +| Justin Pryzby | +| Kaido Vaikla | +| Kambam Vinay | +| Karen Talarico | +| Karina Litskevich | +| Karl O. Pinc | +| Kashif Zeeshan | +| Kim Johan Andersson | +| Kirill Reshke | +| Kirk Parker | +| Kirk Wolak | +| Kisoon Kwon | +| Koen De Groote | +| Kohei KaiGai | +| Kong Man | +| Konstantin Knizhnik | +| Kouhei Sutou | +| Krishnakumar R | +| Kuntal Ghosh | +| Kurt Roeckx | +| Kyotaro Horiguchi | +| Lang Liu | +| Lars Kanis | +| Laurenz Albe | +| Lauri Laanmets | +| Legs Mansion | +| Lukas Fittl | +| Magnus Hagander | +| Mahendrakar Srinivasarao | +| Maiquel Grassi | +| Manos Emmanouilidis | +| Marcel Hofstetter | +| Marcos Pegoraro | +| Marian Krucina | +| Marina Polyakova | +| Mark Dilger | +| Mark Guertin | +| Mark Sloan | +| Markus Winand | +| Marlene Reiterer | +| Martín Marqués | +| Martin Nash | +| Martin Schlossarek | +| Masahiko Sawada | +| Masahiro Ikeda | +| Masaki Kuwamura | +| Masao Fujii | +| Mason Sharp | +| Matheus Alcantara | +| Mats Kindahl | +| Matthias Kuhn | +| Matthias van de Meent | +| Maxim Boguk | +| Maxim Orlov | +| Maxim Yablokov | +| Maxime Boyer | +| Melanie Plageman | +| Melih Mutlu | +| Merlin Moncure | +| Micah Gate | +| Michael Banck | +| Michael Bondarenko | +| Michael Paquier | +| Michael Wang | +| Michael Zhilin | +| Michail Nikolaev | +| Michal Bartak | +| Michal Kleczek | +| Mikhail Gribkov | +| Mingli Zhang | +| Miroslav Bendik | +| Mitsuru Hinata | +| Moaaz Assali | +| Muralikrishna Bandaru | +| Nathan Bossart | +| Nazir Bilal Yavuz | +| Neil Tiffin | +| Ngigi Waithaka | +| Nikhil Benesch | +| Nikhil Raj | +| Nikita Glukhov | +| Nikita Kalinin | +| Nikita Malakhov | +| Nikolay Samokhvalov | +| Nikolay Shaplov | +| Nisha Moond | +| Nishant Sharma | +| Nitin Jadhav | +| Noah Misch | +| Noriyoshi Shinoda | +| Ole Peder Brandtzæg | +| Oleg Bartunov | +| Oleg Sibiryakov | +| Oleg Tselebrovskiy | +| Olleg Samoylov | +| Onder Kalaci | +| Ondrej Navratil | +| Pablo Kharo | +| Palak Chaturvedi | +| Pantelis Theodosiou | +| Paul Amonson | +| Paul Jungwirth | +| Pavel Borisov | +| Pavel Kulakov | +| Pavel Luzanov | +| Pavel Stehule | +| Pavlo Golub | +| Pedro Gallegos | +| Pete Storer | +| Peter Eisentraut | +| Peter Geoghegan | +| Peter Smith | +| Philip Warner | +| Philipp Salvisberg | +| Pierre Ducroquet | +| Pierre Fortin | +| Przemyslaw Sztoch | +| Quynh Tran | +| Raghuveer Devulapalli | +| Ranier Vilela | +| Reid Thompson | +| Rian McGuire | +| Richard Guo | +| Richard Vesely | +| Ridvan Korkmaz | +| Robert Haas | +| Robert Scott | +| Robert Treat | +| Roberto Mello | +| Robins Tharakan | +| Roman Lozko | +| Ronan Dunklau | +| Rui Zhao | +| Ryo Matsumura | +| Ryoga Yoshida | +| Sameer Kumar | +| Sami Imseih | +| Samuel Dussault | +| Sanjay Minni | +| Satoru Koizumi | +| Sebastian Skalacki | +| Sergei Glukhov | +| Sergei Kornilov | +| Sergey Prokhorenko | +| Sergey Sargsyan | +| Sergey Shinderuk | +| Shaozhong Shi | +| Shaun Thomas | +| Shay Rojansky | +| Shihao Zhong | +| Shinya Kato | +| Shlok Kyal | +| Shruthi Gowda | +| Shubham Khanna | +| Shulin Zhou | +| Shveta Malik | +| Simon Riggs | +| Soumyadeep Chakraborty | +| Sravan Velagandula | +| Stan Hu | +| Stepan Neretin | +| Stepan Rutz | +| Stéphane Schildknecht | +| Stephane Tachoires | +| Stephen Frost | +| Steve Atkins | +| Steve Chavez | +| Suraj Khamkar | +| Suraj Kharage | +| Svante Richter | +| Svetlana Derevyanko | +| Sylvain Frandaz | +| Takayuki Tsunakawa | +| Tatsuo Ishii | +| Tatsuro Yamada | +| Tender Wang | +| Teodor Sigaev | +| Thom Brown | +| Thomas Munro | +| Tim Carey-Smith | +| Tim Needham | +| Tim Palmer | +| Tobias Bussmann | +| Tom Lane | +| Tomas Vondra | +| Tommy Pavlicek | +| Tomonari Katsumata | +| Tristan Partin | +| Tristen Raab | +| Tung Nguyen | +| Umair Shahid | +| Uwe Binder | +| Valerie Woolard | +| Vallimaharajan G | +| Vasya Boytsov | +| Victor Wagner | +| Victor Yegorov | +| Victoria Shepard | +| Vidushi Gupta | +| Vignesh C | +| Vik Fearing | +| Viktor Leis | +| Vinayak Pokale | +| Vitaly Burovoy | +| Vojtech Benes | +| Wei Sun | +| Wei Wang | +| Wenjiang Zhang | +| Will Mortensen | +| Willi Mann | +| Wolfgang Walther | +| Xiang Liu | +| Xiaoran Wang | +| Xing Guo | +| Xudong Yang | +| Yahor Yuzefovich | +| Yajun Hu | +| Yaroslav Saburov | +| Yong Li | +| Yongtao Huang | +| Yugo Nagata | +| Yuhang Qiu | +| Yuki Seino | +| Yura Sokolov | +| Yurii Rashkovskii | +| Yuuki Fujii | +| Yuya Watari | +| Yves Colin | +| Zhihong Yu | +| Zhijie Hou | +| Zongliang Quan | +| Zubeyr Eryilmaz | +| Zuming Jiang | + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-17-1.html "E.7. Release 17.1") | [Up](release.html "Appendix E. Release Notes") | [Next](release-prior.html "E.9. Prior Releases") | +| E.7. Release 17.1 | [Home](index.html "PostgreSQL 17.7 Documentation") | E.9. Prior Releases | + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/17.1/) diff --git a/corpus/changelog/postgresql_releases/postgresql_171.md b/corpus/changelog/postgresql_releases/postgresql_171.md new file mode 100644 index 0000000000000000000000000000000000000000..d8e3c8a550a61b441b35ea2a63866dfe2ea99b15 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_171.md @@ -0,0 +1,196 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/17.1/ +Version: 17.1 + +## PostgreSQL 17.1 + +| E.7. Release 17.1 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-17-2.html "E.6. Release 17.2") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 17.7 Documentation") | [Next](release-17.html "E.8. Release 17") | + +--- + +## E.7. Release 17.1 [#](#RELEASE-17-1) + +[E.7.1. Migration to Version 17.1](release-17-1.html#RELEASE-17-1-MIGRATION) + +[E.7.2. Changes](release-17-1.html#RELEASE-17-1-CHANGES) + +**Release date:**2024-11-14 + +This release contains a variety of fixes from 17.0. For information about new features in major release 17, see [Section E.8](release-17.html "E.8. Release 17"). + +### E.7.1. Migration to Version 17.1 [#](#RELEASE-17-1-MIGRATION) + +A dump/restore is not required for those running 17.X. + +However, if you have ever detached a partition from a partitioned table that has a foreign-key reference to another partitioned table, and not dropped the former partition, then you may have catalog and/or data corruption to repair, as detailed in the fifth changelog entry below. + +Also, in the uncommon case that a database's `LC_CTYPE` setting is `C` while its `LC_COLLATE` setting is some other locale, indexes on textual columns should be reindexed, as described in the sixth changelog entry below. + +### E.7.2. Changes [#](#RELEASE-17-1-CHANGES) + +* Ensure cached plans are marked as dependent on the calling role when RLS applies to a non-top-level table reference (Nathan Bossart) [§](https://postgr.es/c/edcda9bb4) + + If a CTE, subquery, sublink, security invoker view, or coercion projection in a query references a table with row-level security policies, we neglected to mark the resulting plan as potentially dependent on which role is executing it. This could lead to later query executions in the same session using the wrong plan, and then returning or hiding rows that should have been hidden or returned instead. + + The PostgreSQL Project thanks Wolfgang Walther for reporting this problem. (CVE-2024-10976) +* Make libpq discard error messages received during SSL or GSS protocol negotiation (Jacob Champion) [§](https://postgr.es/c/a5cc4c667) + + An error message received before encryption negotiation is completed might have been injected by a man-in-the-middle, rather than being real server output. Reporting it opens the door to various security hazards; for example, the message might spoof a query result that a careless user could mistake for correct output. The best answer seems to be to discard such data and rely only on libpq's own report of the connection failure. + + The PostgreSQL Project thanks Jacob Champion for reporting this problem. (CVE-2024-10977) +* Fix unintended interactions between `SET SESSION AUTHORIZATION` and `SET ROLE` (Tom Lane) [§](https://postgr.es/c/cd82afdda) [§](https://postgr.es/c/f4f5d27d8) + + The SQL standard mandates that `SET SESSION AUTHORIZATION` have a side-effect of doing `SET ROLE NONE`. Our implementation of that was flawed, creating more interaction between the two settings than intended. Notably, rolling back a transaction that had done `SET SESSION AUTHORIZATION` would revert `ROLE` to `NONE` even if that had not been the previous state, so that the effective user ID might now be different from what it had been before the transaction. Transiently setting `session_authorization` in a function `SET` clause had a similar effect. A related bug was that if a parallel worker inspected `current_setting('role')`, it saw `none` even when it should see something else. + + The PostgreSQL Project thanks Tom Lane for reporting this problem. (CVE-2024-10978) +* Prevent trusted PL/Perl code from changing environment variables (Andrew Dunstan, Noah Misch) [§](https://postgr.es/c/3ebcfa54d) [§](https://postgr.es/c/4cd4f3b97) [§](https://postgr.es/c/8d19f3fea) + + The ability to manipulate process environment variables such as `PATH` gives an attacker opportunities to execute arbitrary code. Therefore, “trusted” PLs must not offer the ability to do that. To fix `plperl`, replace `%ENV` with a tied hash that rejects any modification attempt with a warning. Untrusted `plperlu` retains the ability to change the environment. + + The PostgreSQL Project thanks Coby Abrams for reporting this problem. (CVE-2024-10979) +* Fix updates of catalog state for foreign-key constraints when attaching or detaching table partitions (Jehan-Guillaume de Rorthais, Tender Wang, Álvaro Herrera) [§](https://postgr.es/c/5914a22f6) [§](https://postgr.es/c/936ab6de9) + + If the referenced table is partitioned, then different catalog entries are needed for a referencing table that is stand-alone versus one that is a partition. `ATTACH/DETACH PARTITION` commands failed to perform this conversion correctly. In particular, after `DETACH` the now stand-alone table would be missing foreign-key enforcement triggers, which could result in the table later containing rows that fail the foreign-key constraint. A subsequent re-`ATTACH` could fail with surprising errors, too. + + The way to fix this is to do `ALTER TABLE DROP CONSTRAINT` on the now stand-alone table for each faulty constraint, and then re-add the constraint. If re-adding the constraint fails, then some erroneous data has crept in. You will need to manually re-establish consistency between the referencing and referenced tables, then re-add the constraint. + + This query can be used to identify broken constraints and construct the commands needed to recreate them: + + ```None + SELECT conrelid::pg_catalog.regclass AS "constrained table", + conname AS constraint, + confrelid::pg_catalog.regclass AS "references", + pg_catalog.format('ALTER TABLE %s DROP CONSTRAINT %I;', + conrelid::pg_catalog.regclass, conname) AS "drop", + pg_catalog.format('ALTER TABLE %s ADD CONSTRAINT %I %s;', + conrelid::pg_catalog.regclass, conname, + pg_catalog.pg_get_constraintdef(oid)) AS "add" + FROM pg_catalog.pg_constraint c + WHERE contype = 'f' AND conparentid = 0 AND + (SELECT count(*) FROM pg_catalog.pg_constraint c2 + WHERE c2.conparentid = c.oid) <> + ((SELECT count(*) FROM pg_catalog.pg_inherits i + WHERE (i.inhparent = c.conrelid OR i.inhparent = c.confrelid) AND + EXISTS (SELECT 1 FROM pg_catalog.pg_partitioned_table + WHERE partrelid = i.inhparent)) + + CASE WHEN pg_catalog.pg_partition_root(conrelid) = confrelid THEN + (SELECT count(*) FROM pg_catalog.pg_partition_tree(confrelid) + WHERE level = 1) + ELSE 0 END); + ``` + + Since it is possible that one or more of the `ADD CONSTRAINT` steps will fail, you should save the query's output in a file and then attempt to perform each step. +* Fix test for `C` locale when `LC_COLLATE` is different from `LC_CTYPE` (Jeff Davis) [§](https://postgr.es/c/8148e7124) + + When using `libc` as the default collation provider, the test to see if `C` locale is in use for collation accidentally checked `LC_CTYPE` not `LC_COLLATE`. This has no impact in the typical case where those settings are the same, nor if both are not `C` (nor its alias `POSIX`). However, if `LC_CTYPE` is `C` while `LC_COLLATE` is some other locale, wrong query answers could ensue, and corruption of indexes on strings was possible. Users of databases with such settings should reindex affected indexes after installing this update. The converse case with `LC_COLLATE` being `C` while `LC_CTYPE` is some other locale would cause performance degradation, but no actual errors. +* Don't use partitionwise joins or grouping if the query's collation for the key column doesn't match the partition key's collation (Jian He, Webbo Han) [§](https://postgr.es/c/a0cdfc889) [§](https://postgr.es/c/b6484ca95) + + Such plans could produce incorrect results. +* Avoid planner failure after converting an `IS NULL` test on a `NOT NULL` column to constant `FALSE` (Richard Guo) [§](https://postgr.es/c/78b1c553b) + + This bug typically led to errors such as “variable not found in subplan target lists”. +* Avoid possible planner crash while inlining a SQL function whose arguments contain certain array-related constructs (Tom Lane, Nathan Bossart) [§](https://postgr.es/c/a3c4a91f1) +* Fix possible wrong answers or “wrong varnullingrels” planner errors for `MERGE ... WHEN NOT MATCHED BY SOURCE` actions (Dean Rasheed) [§](https://postgr.es/c/d7d297f84) [§](https://postgr.es/c/34ae54af9) +* Fix possible “could not find pathkey item to sort” error when the output of a `UNION ALL` member query needs to be sorted, and the sort column is an expression (Andrei Lepikhov, Tom Lane) [§](https://postgr.es/c/54889ea64) +* Fix edge case in B-tree ScalarArrayOp index scans (Peter Geoghegan) [§](https://postgr.es/c/c177726ae) + + When a scrollable cursor with a plan of this kind was backed up to its starting point and then run forward again, wrong answers were possible. +* Fix assertion failure or confusing error message for `COPY (query) TO ...`, when the *`query`* is rewritten by a `DO INSTEAD NOTIFY` rule (Tender Wang, Tom Lane) [§](https://postgr.es/c/3685ad618) +* Fix validation of `COPY`'s `FORCE_NOT_NULL` and `FORCE_NULL` options (Joel Jacobson) [§](https://postgr.es/c/c06a4746b) + + Some incorrect usages are now rejected as they should be. +* Fix server crash when a `json_objectagg()` call contains a volatile function (Amit Langote) [§](https://postgr.es/c/7148cb3e3) +* Fix detection of skewed data during parallel hash join (Thomas Munro) [§](https://postgr.es/c/4ac5d33a8) + + After repartitioning the inner side of a hash join because one partition has accumulated too many tuples, we check to see if all the partition's tuples went into the same child partition, which suggests that they all have the same hash value and further repartitioning cannot improve matters. This check malfunctioned in some cases, allowing repeated futile repartitioning which would eventually end in a resource-exhaustion error. +* Avoid crash when `ALTER DATABASE SET` is used to set a server parameter that requires search-path-based lookup, such as `default_text_search_config` (Jeff Davis) [§](https://postgr.es/c/2fe4167bc) +* Avoid repeated lookups of opclasses and collations while creating a new index on a partitioned table (Tom Lane) [§](https://postgr.es/c/fee8cb947) + + This was problematic mainly because some of the lookups would be done with a restricted `search_path`, leading to unexpected failures if the `CREATE INDEX` command referenced objects outside `pg_catalog`. + + This fix also prevents comments on the parent partitioned index from being copied to child indexes. +* Add missing dependency from a partitioned table to a non-built-in access method specified in `CREATE TABLE ... USING` (Michael Paquier) [§](https://postgr.es/c/bb584e831) + + Dropping the access method should be blocked when a table exists that depends on it, but it was not, allowing subsequent odd behavior. Note that this fix only prevents problems for partitioned tables created after this update. +* Disallow locale names containing non-ASCII characters (Thomas Munro) [§](https://postgr.es/c/9c7acc333) + + This is only an issue on Windows, as such locale names are not used elsewhere. They are problematic because it's quite unclear what encoding such names are represented in (since the locale itself defines the encoding to use). In recent PostgreSQL releases, an abort in the Windows runtime library could occur because of confusion about that. + + Anyone who encounters the new error message should either create a new duplicated locale with an ASCII-only name using Windows Locale Builder, or consider using BCP 47-compliant locale names like `tr-TR`. +* Fix race condition in committing a serializable transaction (Heikki Linnakangas) [§](https://postgr.es/c/234f6d09e) + + Mis-processing of a recently committed transaction could lead to an assertion failure or a “could not access status of transaction” error. +* Fix race condition in `COMMIT PREPARED` that resulted in orphaned 2PC files (wuchengwen) [§](https://postgr.es/c/f250cb29d) + + A concurrent `PREPARE TRANSACTION` could cause `COMMIT PREPARED` to not remove the on-disk two-phase state file for the completed transaction. There was no immediate ill effect, but a subsequent crash-and-recovery could fail with “could not access status of transaction”, requiring manual removal of the orphaned file to restore service. +* Avoid invalid memory accesses after skipping an invalid toast index during `VACUUM FULL` (Tender Wang) [§](https://postgr.es/c/1532599a8) + + A list tracking yet-to-be-rebuilt indexes was not properly updated in this code path, risking assertion failures or crashes later on. +* Fix ways in which an “in place” catalog update could be lost (Noah Misch) [§](https://postgr.es/c/fd27b878c) [§](https://postgr.es/c/3b7a689e1) [§](https://postgr.es/c/da99df15c) [§](https://postgr.es/c/e11907682) [§](https://postgr.es/c/9aef6f19a) [§](https://postgr.es/c/0bcb9d079) [§](https://postgr.es/c/54bc22fbf) + + Normal row updates write a new version of the row to preserve rollback-ability of the transaction. However, certain system catalog updates are intentionally non-transactional and are done with an in-place update of the row. These patches fix race conditions that could cause the effects of an in-place update to be lost. As an example, it was possible to forget having set `pg_class`.`relhasindex` to true, preventing updates of the new index and thus causing index corruption. +* Reset catalog caches at end of recovery (Noah Misch) [§](https://postgr.es/c/a4668c99f) + + This prevents scenarios wherein an in-place catalog update could be lost due to using stale data from a catalog cache. +* Avoid using parallel query while holding off interrupts (Francesco Degrassi, Noah Misch, Tom Lane) [§](https://postgr.es/c/2370582ab) [§](https://postgr.es/c/943b65358) + + This situation cannot arise normally, but it can be reached with test scenarios such as using a SQL-language function as B-tree support (which would be far too slow for production usage). If it did occur it would result in an indefinite wait. +* Ignore not-yet-defined Portals in the `pg_cursors` view (Tom Lane) [§](https://postgr.es/c/3daeb539a) + + It is possible for user-defined code that inspects this view to be called while a new cursor is being set up, and if that happens a null pointer dereference would ensue. Avoid the problem by defining the view to exclude incompletely-set-up cursors. +* Avoid “unexpected table\_index\_fetch\_tuple call during logical decoding” error while decoding a transaction involving insertion of a column default value (Takeshi Ideriha, Hou Zhijie) [§](https://postgr.es/c/918107759) [§](https://postgr.es/c/c4b8a916f) +* Reduce memory consumption of logical decoding (Masahiko Sawada) [§](https://postgr.es/c/eef9cc4dc) + + Use a smaller default block size to store tuple data received during logical replication. This reduces memory wastage, which has been reported to be severe while processing long-running transactions, even leading to out-of-memory failures. +* Fix behavior of stable functions called from a `CALL` statement's argument list, when the `CALL` is within a PL/pgSQL `EXCEPTION` block (Tom Lane) [§](https://postgr.es/c/b5eef7539) + + As with a similar fix in our previous quarterly releases, this case allowed such functions to be passed the wrong snapshot, causing them to see stale values of rows modified since the start of the outer transaction. +* Parse libpq's `keepalives` connection option in the same way as other integer-valued options (Yuto Sasaki) [§](https://postgr.es/c/c7a201053) + + The coding used here rejected trailing whitespace in the option value, unlike other cases. This turns out to be problematic in ecpg's usage, for example. +* In ecpglib, fix out-of-bounds read when parsing incorrect datetime input (Bruce Momjian, Pavel Nekrasov) [§](https://postgr.es/c/2c37cb26f) + + It was possible to try to read the location just before the start of a constant array. Real-world consequences seem minimal, though. +* Fix psql's describe commands to again work with pre-9.4 servers (Tom Lane) [§](https://postgr.es/c/923a71584) + + Commands involving display of an ACL (permissions) column failed with very old PostgreSQL servers, due to use of a function not present in those versions. +* Avoid hanging if an interval less than 1ms is specified in psql's `\watch` command (Andrey Borodin, Michael Paquier) [§](https://postgr.es/c/8a6170860) + + Instead, treat this the same as an interval of zero (no wait between executions). +* Fix failure to find replication password in `~/.pgpass` (Tom Lane) [§](https://postgr.es/c/e2a912909) + + pg\_basebackup and pg\_receivewal failed to match an entry in `~/.pgpass` that had `replication` in the database name field, if no `-d` or `--dbname` switch was supplied. This resulted in an unexpected prompt for password. +* In pg\_combinebackup, throw an error if an incremental backup file is present in a directory that is supposed to contain a full backup (Robert Haas) [§](https://postgr.es/c/e36711442) +* In pg\_combinebackup, don't construct filenames containing double slashes (Robert Haas) [§](https://postgr.es/c/0d635b615) + + This caused no functional problems, but the duplicate slashes were visible in error messages, which could create confusion. +* Avoid trying to reindex temporary tables and indexes in vacuumdb and in parallel reindexdb (VaibhaveS, Michael Paquier, Fujii Masao, Nathan Bossart) [§](https://postgr.es/c/85cb21df6) [§](https://postgr.es/c/77f154681) [§](https://postgr.es/c/5bd26e652) + + Reindexing other sessions' temporary tables cannot work, but the check to skip them was missing in some code paths, leading to unwanted failures. +* Fix incorrect LLVM-generated code on ARM64 platforms (Thomas Munro, Anthonin Bonnefoy) [§](https://postgr.es/c/b7467ab71) + + When using JIT compilation on ARM platforms, the generated code could not support relocation distances exceeding 32 bits, allowing unlucky placement of generated code to cause server crashes on large-memory systems. +* Fix a few places that assumed that process start time (represented as a `time_t`) will fit into a `long` value (Max Johnson, Nathan Bossart) [§](https://postgr.es/c/a356d23fd) + + On platforms where `long` is 32 bits (notably Windows), this coding would fail after Y2038. Most of the failures appear only cosmetic, but notably `pg_ctl start` would hang. +* Update time zone data files to tzdata release 2024b (Tom Lane) [§](https://postgr.es/c/cad65907e) [§](https://postgr.es/c/6283ff201) + + This tzdata release changes the old System-V-compatibility zone names to duplicate the corresponding geographic zones; for example `PST8PDT` is now an alias for `America/Los_Angeles`. The main visible consequence is that for timestamps before the introduction of standardized time zones, the zone is considered to represent local mean solar time for the named location. For example, in `PST8PDT`, `timestamptz` input such as `1801-01-01 00:00` would previously have been rendered as `1801-01-01 00:00:00-08`, but now it is rendered as `1801-01-01 00:00:00-07:52:58`. + + Also, historical corrections for Mexico, Mongolia, and Portugal. Notably, `Asia/Choibalsan` is now an alias for `Asia/Ulaanbaatar` rather than being a separate zone, mainly because the differences between those zones were found to be based on untrustworthy data. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-17-2.html "E.6. Release 17.2") | [Up](release.html "Appendix E. Release Notes") | [Next](release-17.html "E.8. Release 17") | +| E.6. Release 17.2 | [Home](index.html "PostgreSQL 17.7 Documentation") | E.8. Release 17 | + +[Previous](/docs/release/17.0/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/17.2/) diff --git a/corpus/changelog/postgresql_releases/postgresql_172.md b/corpus/changelog/postgresql_releases/postgresql_172.md new file mode 100644 index 0000000000000000000000000000000000000000..52d8f91133e2e68cc3d0dc5548d25a23f1fe0089 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_172.md @@ -0,0 +1,66 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/17.2/ +Version: 17.2 + +## PostgreSQL 17.2 + +| E.6. Release 17.2 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-17-3.html "E.5. Release 17.3") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 17.7 Documentation") | [Next](release-17-1.html "E.7. Release 17.1") | + +--- + +## E.6. Release 17.2 [#](#RELEASE-17-2) + +[E.6.1. Migration to Version 17.2](release-17-2.html#RELEASE-17-2-MIGRATION) + +[E.6.2. Changes](release-17-2.html#RELEASE-17-2-CHANGES) + +**Release date:**2024-11-21 + +This release contains a few fixes from 17.1. For information about new features in major release 17, see [Section E.8](release-17.html "E.8. Release 17"). + +### E.6.1. Migration to Version 17.2 [#](#RELEASE-17-2-MIGRATION) + +A dump/restore is not required for those running 17.X. + +However, if you are upgrading from a version earlier than 17.1, see [Section E.7](release-17-1.html "E.7. Release 17.1"). + +### E.6.2. Changes [#](#RELEASE-17-2-CHANGES) + +* Repair ABI break for extensions that work with struct `ResultRelInfo` (Tom Lane) [§](https://postgr.es/c/6bfacd368) + + Last week's minor releases unintentionally broke binary compatibility with timescaledb and several other extensions. Restore the affected structure to its previous size, so that such extensions need not be rebuilt. +* Restore functionality of `ALTER {ROLE|DATABASE} SET role` (Tom Lane, Noah Misch) [§](https://postgr.es/c/1c05004a8) + + The fix for CVE-2024-10978 accidentally caused settings for `role` to not be applied if they come from non-interactive sources, including previous `ALTER {ROLE|DATABASE}` commands and the `PGOPTIONS` environment variable. +* Fix cases where a logical replication slot's `restart_lsn` could go backwards (Masahiko Sawada) [§](https://postgr.es/c/568e78a65) + + Previously, restarting logical replication could sometimes cause the slot's restart point to be recomputed as an older value than had previously been advertised in `pg_replication_slots`. This is bad, since for example WAL files might have been removed on the basis of the later `restart_lsn` value, in which case replication would fail to restart. +* Avoid deleting still-needed WAL files during pg\_rewind (Polina Bungina, Alexander Kukushkin) [§](https://postgr.es/c/cb844d66b) + + Previously, in unlucky cases, it was possible for pg\_rewind to remove important WAL files from the rewound demoted primary. In particular this happens if those files have been marked for archival (i.e., their `.ready` files were created) but not yet archived. Then the newly promoted node no longer has such files because of them having been recycled, but likely they are needed for recovery in the demoted node. If pg\_rewind removes them, recovery is not possible anymore. +* Fix race conditions associated with dropping shared statistics entries (Kyotaro Horiguchi, Michael Paquier) [§](https://postgr.es/c/1d6a03ea4) + + These bugs could lead to loss of statistics data, assertion failures, or “can only drop stats once” errors. +* Count index scans in `contrib/bloom` indexes in the statistics views, such as the `pg_stat_user_indexes`.`idx_scan` counter (Masahiro Ikeda) [§](https://postgr.es/c/7af6d1306) +* Fix crash when checking to see if an index's opclass options have changed (Alexander Korotkov) [§](https://postgr.es/c/a6fa869cf) + + Some forms of `ALTER TABLE` would fail if the table has an index with non-default operator class options. +* Avoid assertion failure caused by disconnected NFA sub-graphs in regular expression parsing (Tom Lane) [§](https://postgr.es/c/5f28e6ba7) + + This bug does not appear to have any visible consequences in non-assert builds. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-17-3.html "E.5. Release 17.3") | [Up](release.html "Appendix E. Release Notes") | [Next](release-17-1.html "E.7. Release 17.1") | +| E.5. Release 17.3 | [Home](index.html "PostgreSQL 17.7 Documentation") | E.7. Release 17.1 | + +[Previous](/docs/release/17.1/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/17.3/) diff --git a/corpus/changelog/postgresql_releases/postgresql_173.md b/corpus/changelog/postgresql_releases/postgresql_173.md new file mode 100644 index 0000000000000000000000000000000000000000..bbf4273c2fe857cd4d92475587b7be9ce2a181c1 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_173.md @@ -0,0 +1,221 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/17.3/ +Version: 17.3 + +## PostgreSQL 17.3 + +| E.5. Release 17.3 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-17-4.html "E.4. Release 17.4") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 17.7 Documentation") | [Next](release-17-2.html "E.6. Release 17.2") | + +--- + +## E.5. Release 17.3 [#](#RELEASE-17-3) + +[E.5.1. Migration to Version 17.3](release-17-3.html#RELEASE-17-3-MIGRATION) + +[E.5.2. Changes](release-17-3.html#RELEASE-17-3-CHANGES) + +**Release date:**2025-02-13 + +This release contains a variety of fixes from 17.2. For information about new features in major release 17, see [Section E.8](release-17.html "E.8. Release 17"). + +### E.5.1. Migration to Version 17.3 [#](#RELEASE-17-3-MIGRATION) + +A dump/restore is not required for those running 17.X. + +However, if you are upgrading from a version earlier than 17.1, see [Section E.7](release-17-1.html "E.7. Release 17.1"). + +### E.5.2. Changes [#](#RELEASE-17-3-CHANGES) + +* Harden `PQescapeString` and allied functions against invalidly-encoded input strings (Andres Freund, Noah Misch) [§](https://postgr.es/c/43a77239d) [§](https://postgr.es/c/7d43ca6fe) [§](https://postgr.es/c/61ad93cdd) [§](https://postgr.es/c/02d4d87ac) [§](https://postgr.es/c/05abb0f83) [§](https://postgr.es/c/85c1fcc65) + + Data-quoting functions supplied by libpq now fully check the encoding validity of their input. If invalid characters are detected, they report an error if possible. For the ones that lack an error return convention, the output string is adjusted to ensure that the server will report invalid encoding and no intervening processing will be fooled by bytes that might happen to match single quote, backslash, etc. + + The purpose of this change is to guard against SQL-injection attacks that are possible if one of these functions is used to quote crafted input. There is no hazard when the resulting string is sent directly to a PostgreSQL server (which would check its encoding anyway), but there is a risk when it is passed through psql or other client-side code. Historically such code has not carefully vetted encoding, and in many cases it's not clear what it should do if it did detect such a problem. + + This fix is effective only if the data-quoting function, the server, and any intermediate processing agree on the character encoding that's being used. Applications that insert untrusted input into SQL commands should take special care to ensure that that's true. + + Applications and drivers that quote untrusted input without using these libpq functions may be at risk of similar problems. They should first confirm the data is valid in the encoding expected by the server. + + The PostgreSQL Project thanks Stephen Fewer for reporting this problem. (CVE-2025-1094) +* Restore auto-truncation of database and user names appearing in connection requests (Nathan Bossart) [§](https://postgr.es/c/d09fbf645) + + This reverts a v17 change that proved to cause trouble for some users. Over-length names should be truncated in an encoding-aware fashion, but for now just return to the former behavior of blind truncation at `NAMEDATALEN-1` bytes. +* Exclude parallel workers from connection privilege checks and limits (Tom Lane) [§](https://postgr.es/c/15b4c46c3) + + Do not check `datallowconn`, `rolcanlogin`, and `ACL_CONNECT` privileges when starting a parallel worker, instead assuming that it's enough for the leader process to have passed similar checks originally. This avoids, for example, unexpected failures of parallelized queries when the leader is running as a role that lacks login privilege. In the same vein, enforce `ReservedConnections`, `datconnlimit`, and `rolconnlimit` limits only against regular backends, and count only regular backends while checking if the limits were already reached. Those limits are meant to prevent excessive consumption of process slots for regular backends --- but parallel workers and other special processes have their own pools of process slots with their own limit checks. +* Drop “Lock” suffix from LWLock wait event names (Bertrand Drouvot) [§](https://postgr.es/c/5ffbbcfa1) + + Refactoring unintentionally caused the `pg_stat_activity` view to show lock-related wait event names with a “Lock” suffix, which among other things broke joining it to `pg_wait_events`. +* Fix possible failure to return all matching tuples for a btree index scan with a ScalarArrayOp (`= ANY`) condition (Peter Geoghegan) [§](https://postgr.es/c/9e85b20da) +* Fix possible re-use of stale results in window aggregates (David Rowley) [§](https://postgr.es/c/9d5ce4f1a) + + A window aggregate with a “run condition” optimization and a pass-by-reference result type might incorrectly return the result from the previous partition instead of performing a fresh calculation. +* Keep `TransactionXmin` in sync with `MyProc->xmin` (Heikki Linnakangas) [§](https://postgr.es/c/7cfdb4d1e) + + This oversight could permit a process to try to access data that had already been vacuumed away. One known consequence is transient “could not access status of transaction” errors. +* Fix race condition that could cause failure to add a newly-inserted catalog entry to a catalog cache list (Heikki Linnakangas) [§](https://postgr.es/c/96e61b279) + + This could result, for example, in failure to use a newly-created function within an existing session. +* Prevent possible catalog corruption when a system catalog is vacuumed concurrently with an update (Noah Misch) [§](https://postgr.es/c/1587f7b9f) [§](https://postgr.es/c/f4af4515b) +* Fix data corruption when relation truncation fails (Thomas Munro) [§](https://postgr.es/c/0350b876b) [§](https://postgr.es/c/66aaabe7a) [§](https://postgr.es/c/45aef9f6b) + + The filesystem calls needed to perform relation truncation could fail, leaving inconsistent state on disk (for example, effectively reviving deleted data). We can't really prevent that, but we can recover by dint of making such failures into PANICs, so that consistency is restored by replaying from WAL up to just before the attempted truncation. This isn't a hugely desirable behavior, but such failures are rare enough that it seems an acceptable solution. +* Prevent checkpoints from starting during relation truncation (Robert Haas) [§](https://postgr.es/c/d4ffbf47b) + + This avoids a race condition wherein the modified file might not get fsync'd before completing the checkpoint, creating a risk of data corruption if the operating system crashes soon after. +* Avoid possibly losing an update of `pg_database`.`datfrozenxid` when `VACUUM` runs concurrently with a `REASSIGN OWNED` that changes that database's owner (Kirill Reshke) [§](https://postgr.es/c/fa6131377) +* Fix incorrect `tg_updatedcols` values passed to `AFTER UPDATE` triggers (Tom Lane) [§](https://postgr.es/c/2b72fed2d) + + In some cases the `tg_updatedcols` bitmap could describe the set of columns updated by an earlier command in the same transaction, fooling the trigger into doing the wrong thing. + + Also, prevent memory bloat caused by making too many copies of the `tg_updatedcols` bitmap. +* Fix detach of a partition that has its own foreign-key constraint referencing a partitioned table (Amul Sul) [§](https://postgr.es/c/2f30847d1) + + In common cases, foreign keys are defined on a partitioned table's top level; but if instead one is defined on a partition and references a partitioned table, and the referencing partition is detached, the relevant `pg_constraint` entries were updated incorrectly. This led to errors like “could not find ON INSERT check triggers of foreign key constraint”. +* Fix `pg_get_constraintdef`'s support for `NOT NULL` constraints on domains (Álvaro Herrera) [§](https://postgr.es/c/6e793582b) +* Fix mis-processing of `to_timestamp`'s `FFn` format codes (Tom Lane) [§](https://postgr.es/c/765f76d8c) + + An integer format code immediately preceding `FFn` would consume all available digits, leaving none for `FFn`. +* When deparsing a `PASSING` clause in a SQL/JSON query function, ensure that variable names are double-quoted when necessary (Dean Rasheed) [§](https://postgr.es/c/d037cc2af) +* When deparsing an `XMLTABLE()` expression, ensure that XML namespace names are double-quoted when necessary (Dean Rasheed) [§](https://postgr.es/c/61b12135f) +* Include the `ldapscheme` option in `pg_hba_file_rules()` output (Laurenz Albe) [§](https://postgr.es/c/8ed9bf0a3) [§](https://postgr.es/c/dc24c9ad5) +* Fix planning of pre-sorted `UNION` operations for cases where the input column datatypes don't all match (David Rowley) [§](https://postgr.es/c/5db9367e5) + + This error could lead to sorting data with the wrong sort operator, with consequences ranging from no visible problem to core dumps. +* Don't merge `UNION` operations if their column collations aren't consistent (Tom Lane) [§](https://postgr.es/c/c1ebef3c1) + + Previously we ignored collations when deciding if it's safe to merge `UNION` steps into a single N-way `UNION` operation. This was arguably valid before the introduction of nondeterministic collations, but it's not anymore, since the collation in use can affect the definition of uniqueness. +* Prevent “wrong varnullingrels” planner errors after pulling up a subquery that's underneath an outer join (Tom Lane) [§](https://postgr.es/c/72822a99d) [§](https://postgr.es/c/78883cd90) +* Ignore nulling-relation marker bits when looking up statistics (Richard Guo) [§](https://postgr.es/c/297b280ab) + + This oversight could lead to failure to use relevant statistics about expressions, or to “corrupt MVNDistinct entry” errors. +* Fix missed expression processing for partition pruning steps (Tom Lane) [§](https://postgr.es/c/0671a71e0) + + This oversight could lead to “unrecognized node type” errors, and perhaps other problems, in queries accessing partitioned tables. +* Give the slotsync worker process its own process slot (Tom Lane, Hou Zhijie) [§](https://postgr.es/c/14141bbbc) + + This was overlooked in the addition of the slotsync worker, with the result that its process slot effectively came out of the pool meant for regular backend processes. This could result in failure to launch the worker, or to subsequent failures of connection requests that should have succeeded according to the configured settings, if the number of regular backend processes approached `max_connections`. +* Allow dshash tables to grow past 1GB (Matthias van de Meent) [§](https://postgr.es/c/18452b70a) + + This avoids errors like “invalid DSA memory alloc request size”. The case can occur for example in transactions that process several million tables. +* Avoid possible integer overflow in `bringetbitmap()` (James Hunter, Evgeniy Gorbanyov) [§](https://postgr.es/c/e027ee990) + + Since the result is only used for statistical purposes, the effects of this error were mostly cosmetic. +* Correct miscalculation of SLRU bank numbers (Yura Sokolov) [§](https://postgr.es/c/ffd9b8134) + + This error led to using a smaller number of banks than intended, causing more contention but no functional misbehavior. +* Ensure that an already-set process latch doesn't prevent the postmaster from noticing socket events (Thomas Munro) [§](https://postgr.es/c/44f400fbc) + + An extremely heavy workload of backends launching workers and workers exiting could prevent the postmaster from responding to incoming client connections in a timely fashion. +* Prevent streaming standby servers from looping infinitely when reading a WAL record that crosses pages (Kyotaro Horiguchi, Alexander Kukushkin) [§](https://postgr.es/c/e6767c0ed) + + This would happen when the record's continuation is on a page that needs to be read from a different WAL source. +* Fix unintended promotion of FATAL errors to PANIC during early process startup (Noah Misch) [§](https://postgr.es/c/4bd9de3f4) + + This fixes some unlikely cases that would result in “PANIC: proc\_exit() called in child process”. +* Fix cases where an operator family member operator or support procedure could become a dangling reference (Tom Lane) [§](https://postgr.es/c/ec7b89cc5) [§](https://postgr.es/c/5b44a317a) + + In some cases a data type could be dropped while references to its OID still remain in `pg_amop` or `pg_amproc`. While that caused no immediate issues, an attempt to drop the owning operator family would fail, and pg\_dump would produce bogus output when dumping the operator family. This fix causes creation and modification of operator families/classes to add needed dependency entries so that dropping a data type will also drop any dependent operator family elements. That does not help vulnerable pre-existing operator families, though, so a band-aid has also been added to `DROP OPERATOR FAMILY` to prevent failure when dropping a family that has dangling members. +* Fix multiple memory leaks in logical decoding output (Vignesh C, Masahiko Sawada, Boyu Yang) [§](https://postgr.es/c/836435424) [§](https://postgr.es/c/bbe68c13a) [§](https://postgr.es/c/afe9b0d9f) +* Fix small memory leak when updating the `application_name` or `cluster_name` settings (Tofig Aliev) [§](https://postgr.es/c/9add1bbfa) +* Avoid crash when a background process tries to check a new value of `synchronized_standby_slots` (Álvaro Herrera) [§](https://postgr.es/c/9abdc1841) +* Avoid integer overflow while testing `wal_skip_threshold` condition (Tom Lane) [§](https://postgr.es/c/1e25cdb21) + + A transaction that created a very large relation could mistakenly decide to ensure durability by copying the relation into WAL instead of fsync'ing it, thereby negating the point of `wal_skip_threshold`. (This only matters when `wal_level` is set to `minimal`, else a WAL copy is required anyway.) +* Fix unsafe order of operations during cache lookups (Noah Misch) [§](https://postgr.es/c/718af10da) + + The only known consequence was a usually-harmless “you don't own a lock of type ExclusiveLock” warning during `GRANT TABLESPACE`. +* Avoid potential use-after-free in parallel vacuum (Vallimaharajan G, John Naylor) [§](https://postgr.es/c/83ce20d67) + + This bug seems to have no consequences in standard builds, but it's theoretically a hazard. +* Fix possible “failed to resolve name” failures when using JIT on older ARM platforms (Thomas Munro) [§](https://postgr.es/c/8a9a51518) + + This could occur as a consequence of inconsistency about the default setting of `-moutline-atomics` between gcc and clang. At least Debian and Ubuntu are known to ship gcc and clang compilers that target armv8-a but differ on the use of outline atomics by default. +* Fix assertion failure in `WITH RECURSIVE ... UNION` queries (David Rowley) [§](https://postgr.es/c/7b8d45d27) +* Avoid assertion failure in rule deparsing if a set operation leaf query contains set operations (Man Zeng, Tom Lane) [§](https://postgr.es/c/fea81aee8) +* Avoid edge-case assertion failure in parallel query startup (Tom Lane) [§](https://postgr.es/c/556f7b7bc) +* Fix assertion failure at shutdown when writing out the statistics file (Michael Paquier) [§](https://postgr.es/c/dc5f90541) +* Avoid valgrind complaints about string hashing code (John Naylor) [§](https://postgr.es/c/6555fe197) +* In `NULLIF()`, avoid passing a read-write expanded object pointer to the data type's equality function (Tom Lane) [§](https://postgr.es/c/97be02ad0) + + The equality function could modify or delete the object if it's given a read-write pointer, which would be bad if we decide to return it as the `NULLIF()` result. There is probably no problem with any built-in equality function, but it's easy to demonstrate a failure with one coded in PL/pgSQL. +* Ensure that expression preprocessing is applied to a default null value in `INSERT` (Tom Lane) [§](https://postgr.es/c/6e41e9e5e) + + If the target column is of a domain type, the planner must insert a coerce-to-domain step not just a null constant, and this expression missed going through some required processing steps. There is no known consequence with domains based on core data types, but in theory an error could occur with domains based on extension types. +* Avoid data loss when starting a bulk write on a relation fork that already contains data (Matthias van de Meent) [§](https://postgr.es/c/969583553) + + Any pre-existing data was overwritten with zeroes. This is not an issue for core PostgreSQL, which never does that. Some extensions would like to, however. +* Avoid crash if a server process tried to iterate over a shared radix tree that it didn't create (Masahiko Sawada) [§](https://postgr.es/c/9af2b3435) + + There is no code in core PostgreSQL that does this, but an extension might wish to. +* Repair memory leaks in PL/Python (Mat Arye, Tom Lane) [§](https://postgr.es/c/e98df02df) + + Repeated use of `PLyPlan.execute` or `plpy.cursor` resulted in memory leakage for the duration of the calling PL/Python function. +* Fix PL/Tcl to compile with Tcl 9 (Peter Eisentraut) [§](https://postgr.es/c/f979197eb) +* In the ecpg preprocessor, fix possible misprocessing of cursors that reference out-of-scope variables (Tom Lane) [§](https://postgr.es/c/a963abd54) +* In ecpg, fix compile-time warnings about unsupported use of `COPY ... FROM STDIN` (Ryo Kanbayashi) [§](https://postgr.es/c/ba2dbedd5) + + Previously, the intended warning was not issued due to a typo. +* Fix psql to safely handle file path names that are encoded in SJIS (Tom Lane) [§](https://postgr.es/c/0b713b94b) + + Some two-byte characters in SJIS have a second byte that is equal to ASCII backslash (`\`). These characters were corrupted by path name normalization, preventing access to files whose names include such characters. +* Add psql tab completion for `COPY (MERGE INTO)` (Jian He) [§](https://postgr.es/c/4527b9e26) +* Fix use of wrong version of `pqsignal()` in pgbench and psql (Fujii Masao, Tom Lane) [§](https://postgr.es/c/a0dfeae0d) + + This error could lead to misbehavior when using the `-T` option in pgbench or the `\watch` command in psql, due to interrupted system calls not being resumed as expected. +* Fix misexecution of some nested `\if` constructs in pgbench (Michail Nikolaev) [§](https://postgr.es/c/ff9dc96f3) + + An `\if` command appearing within a false (not-being-executed) `\if` branch was incorrectly treated the same as `\elif`. +* In pgbench, fix possible misdisplay of progress messages during table initialization (Yushi Ogiwara, Tatsuo Ishii, Fujii Masao) [§](https://postgr.es/c/adb103fca) [§](https://postgr.es/c/e35d396ec) +* Make pg\_controldata more robust against corrupted `pg_control` files (Ilyasov Ian, Anton Voloshin) [§](https://postgr.es/c/1b8a9533f) + + Since pg\_controldata will attempt to print the contents of `pg_control` even if the CRC check fails, it must take care not to misbehave for invalid field values. This patch fixes some issues triggered by invalid timestamps and apparently-negative WAL segment sizes. +* Fix possible crash in pg\_dump with identity sequences attached to tables that are extension members (Tom Lane) [§](https://postgr.es/c/ad950ea98) +* Fix memory leak in pg\_restore with zstd-compressed data (Tom Lane) [§](https://postgr.es/c/04b860198) + + The leak was per-decompression-operation, so would be most noticeable with a dump containing many tables or large objects. +* Fix pg\_basebackup to correctly handle `pg_wal.tar` files exceeding 2GB on Windows (Davinder Singh, Thomas Munro) [§](https://postgr.es/c/faee3185a) [§](https://postgr.es/c/af109e339) +* Use SQL-standard function bodies in the declarations of `contrib/earthdistance`'s SQL-language functions (Tom Lane, Ronan Dunklau) [§](https://postgr.es/c/3652de36e) + + This change allows their references to `contrib/cube` to be resolved during extension creation, reducing the risk of search-path-based failures and possible attacks. + + In particular, this restores their usability in contexts like generated columns, for which PostgreSQL v17 restricts the search path on security grounds. We have received reports of databases failing to be upgraded to v17 because of that. This patch has been included in v16 to provide a workaround: updating the `earthdistance` extension to this version beforehand should allow an upgrade to succeed. +* Detect version mismatch between `contrib/pageinspect`'s SQL declarations and the underlying shared library (Tomas Vondra) [§](https://postgr.es/c/3668c1d50) + + Previously, such a mismatch could result in a crash while calling `brin_page_items()`. Instead throw an error recommending updating the extension. +* When trying to cancel a remote query in `contrib/postgres_fdw`, re-issue the cancel request a few times if it didn't seem to do anything (Tom Lane) [§](https://postgr.es/c/89962bfef) + + This fixes a race condition where we might try to cancel a just-sent query before the remote server has started to process it, so that the initial cancel request is ignored. +* Update configuration probes that determine the compiler switches needed to access ARM CRC instructions (Tom Lane) [§](https://postgr.es/c/e266a0ed6) + + On ARM platforms where the baseline CPU target lacks CRC instructions, we need to supply a `-march` switch to persuade the compiler to compile such instructions. Recent versions of gcc reject the value we were trying, leading to silently falling back to software CRC. +* Fix meson build system to support old OpenSSL libraries on Windows (Darek Slusarczyk) [§](https://postgr.es/c/0951d4ee4) + + Add support for the legacy library names `ssleay32` and `libeay32`. +* In Windows builds using meson, ensure all libcommon and libpgport functions are exported (Vladlen Popolitov, Heikki Linnakangas) [§](https://postgr.es/c/c80acbc6f) [§](https://postgr.es/c/d8b0c6411) + + This fixes “unresolved external symbol” build errors for extensions. +* Fix meson configuration process to correctly detect OSSP's `uuid.h` header file under MSVC (Andrew Dunstan) [§](https://postgr.es/c/7c655a04a) +* When building with meson, install `pgevent` in *`pkglibdir`* not *`bindir`* (Peter Eisentraut) [§](https://postgr.es/c/e00c1e249) + + This matches the behavior of the make-based build system and the old MSVC build system. +* When building with meson, install `sepgsql.sql` under `share/contrib/` not `share/extension/` (Peter Eisentraut) [§](https://postgr.es/c/24c5b73eb) + + This matches what the make-based build system does. +* Update time zone data files to tzdata release 2025a for DST law changes in Paraguay, plus historical corrections for the Philippines (Tom Lane) [§](https://postgr.es/c/e292ba333) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-17-4.html "E.4. Release 17.4") | [Up](release.html "Appendix E. Release Notes") | [Next](release-17-2.html "E.6. Release 17.2") | +| E.4. Release 17.4 | [Home](index.html "PostgreSQL 17.7 Documentation") | E.6. Release 17.2 | + +[Previous](/docs/release/17.2/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/17.4/) diff --git a/corpus/changelog/postgresql_releases/postgresql_174.md b/corpus/changelog/postgresql_releases/postgresql_174.md new file mode 100644 index 0000000000000000000000000000000000000000..e9ced6a3f1183720e64b5a00a018f31aca35c24c --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_174.md @@ -0,0 +1,51 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/17.4/ +Version: 17.4 + +## PostgreSQL 17.4 + +| E.4. Release 17.4 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-17-5.html "E.3. Release 17.5") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 17.7 Documentation") | [Next](release-17-3.html "E.5. Release 17.3") | + +--- + +## E.4. Release 17.4 [#](#RELEASE-17-4) + +[E.4.1. Migration to Version 17.4](release-17-4.html#RELEASE-17-4-MIGRATION) + +[E.4.2. Changes](release-17-4.html#RELEASE-17-4-CHANGES) + +**Release date:**2025-02-20 + +This release contains a few fixes from 17.3. For information about new features in major release 17, see [Section E.8](release-17.html "E.8. Release 17"). + +### E.4.1. Migration to Version 17.4 [#](#RELEASE-17-4-MIGRATION) + +A dump/restore is not required for those running 17.X. + +However, if you are upgrading from a version earlier than 17.1, see [Section E.7](release-17-1.html "E.7. Release 17.1"). + +### E.4.2. Changes [#](#RELEASE-17-4-CHANGES) + +* Improve behavior of libpq's quoting functions (Andres Freund, Tom Lane) [§](https://postgr.es/c/a92db3d02) [§](https://postgr.es/c/3abe6e04c) [§](https://postgr.es/c/3977bd298) + + The changes made for CVE-2025-1094 had one serious oversight: `PQescapeLiteral()` and `PQescapeIdentifier()` failed to honor their string length parameter, instead always reading to the input string's trailing null. This resulted in including unwanted text in the output, if the caller intended to truncate the string via the length parameter. With very bad luck it could cause a crash due to reading off the end of memory. + + In addition, modify all these quoting functions so that when invalid encoding is detected, an invalid sequence is substituted for just the first byte of the presumed character, not all of it. This reduces the risk of problems if a calling application performs additional processing on the quoted string. +* Fix small memory leak in pg\_createsubscriber (Ranier Vilela) [§](https://postgr.es/c/ff6d9cfcb) +* Fix meson build system to correctly detect availability of the `bsd_auth.h` system header (Nazir Bilal Yavuz) [§](https://postgr.es/c/c9a1d2135) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-17-5.html "E.3. Release 17.5") | [Up](release.html "Appendix E. Release Notes") | [Next](release-17-3.html "E.5. Release 17.3") | +| E.3. Release 17.5 | [Home](index.html "PostgreSQL 17.7 Documentation") | E.5. Release 17.3 | + +[Previous](/docs/release/17.3/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/17.5/) diff --git a/corpus/changelog/postgresql_releases/postgresql_175.md b/corpus/changelog/postgresql_releases/postgresql_175.md new file mode 100644 index 0000000000000000000000000000000000000000..227afaf0e10bbca70e3076478e89cdb22401e32e --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_175.md @@ -0,0 +1,187 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/17.5/ +Version: 17.5 + +## PostgreSQL 17.5 + +| E.3. Release 17.5 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-17-6.html "E.2. Release 17.6") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 17.7 Documentation") | [Next](release-17-4.html "E.4. Release 17.4") | + +--- + +## E.3. Release 17.5 [#](#RELEASE-17-5) + +[E.3.1. Migration to Version 17.5](release-17-5.html#RELEASE-17-5-MIGRATION) + +[E.3.2. Changes](release-17-5.html#RELEASE-17-5-CHANGES) + +**Release date:**2025-05-08 + +This release contains a variety of fixes from 17.4. For information about new features in major release 17, see [Section E.8](release-17.html "E.8. Release 17"). + +### E.3.1. Migration to Version 17.5 [#](#RELEASE-17-5-MIGRATION) + +A dump/restore is not required for those running 17.X. + +However, if you have any self-referential foreign key constraints on partitioned tables, it may be necessary to recreate those constraints to ensure that they are being enforced correctly. See the second changelog entry below. + +Also, if you have any BRIN bloom indexes, it may be advisable to reindex them after updating. See the third changelog entry below. + +Also, if you are upgrading from a version earlier than 17.1, see [Section E.7](release-17-1.html "E.7. Release 17.1"). + +### E.3.2. Changes [#](#RELEASE-17-5-CHANGES) + +* Avoid one-byte buffer overread when examining invalidly-encoded strings that are claimed to be in GB18030 encoding (Noah Misch, Andres Freund) [§](https://postgr.es/c/ec5f89e8a) [§](https://postgr.es/c/617d34908) + + While unlikely, a SIGSEGV crash could occur if an incomplete multibyte character appeared at the end of memory. This was possible both in the server and in libpq-using applications. (CVE-2025-4207) +* Handle self-referential foreign keys on partitioned tables correctly (Álvaro Herrera) [§](https://postgr.es/c/f51ae3187) + + Creating or attaching partitions failed to make the required catalog entries for a foreign-key constraint, if the table referenced by the constraint was the same partitioned table. This resulted in failure to enforce the constraint fully. + + To fix this, you should drop and recreate any self-referential foreign keys on partitioned tables, if partitions have been created or attached since the constraint was created. Bear in mind that violating rows might already be present, in which case recreating the constraint will fail, and you'll need to fix up those rows before trying again. +* Avoid data loss when merging compressed BRIN summaries in `brin_bloom_union()` (Tomas Vondra) [§](https://postgr.es/c/cb0ad70b8) + + The code failed to account for decompression results not being identical to the input objects, which would result in failure to add some of the data to the merged summary, leading to missed rows in index searches. + + This mistake was present back to v14 where BRIN bloom indexes were introduced, but this code path was only rarely reached then. It's substantially more likely to be hit in v17 because parallel index builds now use the code. +* Fix unexpected “attribute has wrong type” errors in `UPDATE`, `DELETE`, and `MERGE` queries that use whole-row table references to views or functions in `FROM` (Tom Lane) [§](https://postgr.es/c/ca0830e5a) +* Fix `MERGE` into a partitioned table with `DO NOTHING` actions (Tender Wang) [§](https://postgr.es/c/25303678a) + + Some cases failed with “unknown action in MERGE WHEN clause” errors. +* Prevent failure in `INSERT` commands when the table has a `GENERATED` column of a domain data type and the domain's constraints disallow null values (Jian He) [§](https://postgr.es/c/3c39c000c) + + Constraint failure was reported even if the generation expression produced a perfectly okay result. +* Correctly process references to outer CTE names that appear within a `WITH` clause attached to an `INSERT`/`UPDATE`/`DELETE`/`MERGE` command that's inside `WITH` (Tom Lane) [§](https://postgr.es/c/5e7be43f4) + + The parser failed to detect disallowed recursion cases, nor did it account for such references when sorting CTEs into a usable order. +* Fix misprocessing of casts within the keys of JSON constructor expressions (Amit Langote) [§](https://postgr.es/c/8b2392ae3) +* Don't try to parallelize `array_agg()` when the argument is of an anonymous record type (Richard Guo, Tom Lane) [§](https://postgr.es/c/43847dd5e) + + The protocol for communicating with parallel workers doesn't support identifying the concrete record type that a worker is returning. +* Fix `ARRAY(subquery)` and `ARRAY[expression, ...]` constructs to produce sane results when the input is of type `int2vector` or `oidvector` (Tom Lane) [§](https://postgr.es/c/c826cd1b1) + + This patch restores the behavior that existed before PostgreSQL 9.5: the result is of type `int2vector[]` or `oidvector[]`. +* Fix possible erroneous reports of invalid affixes while parsing Ispell dictionaries (Jacob Brazeal) [§](https://postgr.es/c/99c01aadf) +* Fix `ALTER TABLE ADD COLUMN` to correctly handle the case of a domain type that has a default (Jian He, Tom Lane, Tender Wang) [§](https://postgr.es/c/d6dd2a02b) [§](https://postgr.es/c/0941aadcd) + + If a domain type has a default, adding a column of that type (without any explicit `DEFAULT` clause) failed to install the domain's default value in existing rows, instead leaving the new column null. +* Repair misbehavior when there are duplicate column names in a foreign key constraint's `ON DELETE SET DEFAULT` or `SET NULL` action (Tom Lane) [§](https://postgr.es/c/5e6e97fbf) +* Improve the error message for disallowed attempts to alter the properties of a foreign key constraint (Álvaro Herrera) [§](https://postgr.es/c/4e026be5f) +* Avoid error when resetting the `relhassubclass` flag of a temporary table that's marked `ON COMMIT DELETE ROWS` (Noah Misch) [§](https://postgr.es/c/d0a049987) +* Add missing deparsing of the `INDENT` option of `XMLSERIALIZE()` (Jim Jones) [§](https://postgr.es/c/2e0f93d7c) [§](https://postgr.es/c/310907aaf) + + Previously, views or rules using `XMLSERIALIZE(... INDENT)` were dumped without the `INDENT` clause, causing incorrect results after restore. +* Avoid premature evaluation of the arguments of an aggregate function that has both `FILTER` and `ORDER BY` (or `DISTINCT`) options (David Rowley) [§](https://postgr.es/c/065ce49a1) + + If there is `ORDER BY` or `DISTINCT`, we consider pre-sorting the aggregate input values rather than doing the sort within the Agg plan node. But this is problematic if the aggregate inputs include expressions that could fail (for example, a division where some of the input divisors could be zero) and there is a `FILTER` clause that's meant to prevent such failures. Pre-sorting would push the expression evaluations to before the `FILTER` test, allowing the failures to happen anyway. Avoid this by not pre-sorting if there's a `FILTER` and the input expressions are anything more complex than a simple Var or Const. +* Fix erroneous deductions from column `NOT NULL` constraints in the presence of outer joins (Richard Guo) [§](https://postgr.es/c/bc5a08af3) + + In some cases the planner would discard an `IS NOT NULL` query condition, even though the condition applies after an outer join and thus is not redundant. +* Avoid incorrect optimizations based on `IS [NOT] NULL` tests that are applied to composite values (Bruce Momjian) [§](https://postgr.es/c/b8b1e87b7) +* Fix planner's failure to identify more than one hashable ScalarArrayOpExpr subexpression within a top-level expression (David Geier) [§](https://postgr.es/c/5672a8399) + + This resulted in unnecessarily-inefficient execution of any additional subexpressions that could have been processed with a hash table (that is, `IN`, `NOT IN`, or `= ANY` clauses with all-constant right-hand sides). +* Fix incorrect table size estimate with low fill factor (Tomas Vondra) [§](https://postgr.es/c/587b6aa3f) + + When the planner estimates the number of rows in a never-yet-analyzed table, it uses the table's fillfactor setting in the estimation, but it neglected to clamp the result to at least one row per page. A low fillfactor could thus result in an unreasonably small estimate. +* Disable “skip fetch” optimization in bitmap heap scan (Matthias van de Meent) [§](https://postgr.es/c/78cb2466f) + + It turns out that this optimization can result in returning dead tuples when a concurrent vacuum marks a page all-visible. +* Fix performance issues in GIN index search startup when there are many search keys (Tom Lane, Vinod Sridharan) [§](https://postgr.es/c/9094eb25b) [§](https://postgr.es/c/8c153fcfa) + + An indexable clause with many keys (for example, `jsonbcol ?| array[...]` with tens of thousands of array elements) took O(N2) time to start up, and was uncancelable for that interval too. +* Detect missing support procedures in a BRIN index operator class, and report an error instead of crashing (Álvaro Herrera) [§](https://postgr.es/c/ade976f8b) +* Respond to interrupts (such as query cancel) while waiting for asynchronous subplans of an Append plan node (Heikki Linnakangas) [§](https://postgr.es/c/e731e9d5e) + + Previously, nothing would happen until one of the subplans becomes ready. +* Report the I/O statistics of active WAL senders more frequently (Bertrand Drouvot) [§](https://postgr.es/c/5cbbe70a9) + + Previously, the `pg_stat_io` view failed to accumulate I/O performed by a WAL sender until that process exited. Now such I/O will be reported after at most one second's delay. +* Fix race condition in handling of `synchronous_standby_names` immediately after startup (Melnikov Maksim, Michael Paquier) [§](https://postgr.es/c/3339847cc) + + For a short period after system startup, backends might fail to wait for synchronous commit even though `synchronous_standby_names` is enabled. +* Cope with possible intra-query changes of `io_combine_limit` (Thomas Munro) [§](https://postgr.es/c/e27346807) +* Avoid infinite loop if `scram_iterations` is set to INT\_MAX (Kevin K Biju) [§](https://postgr.es/c/34fbfe1f5) +* Avoid possible crashes due to double transformation of `json_array()`'s subquery (Tom Lane) [§](https://postgr.es/c/717e8a1e5) +* Fix `pg_strtof()` to not crash with null endptr (Alexander Lakhin, Tom Lane) [§](https://postgr.es/c/d69c78108) +* Fix crash after out-of-memory in certain GUC assignments (Daniel Gustafsson) [§](https://postgr.es/c/8afec4ef6) +* Avoid crash when a Snowball stemmer encounters an out-of-memory condition (Maksim Korotkov) [§](https://postgr.es/c/7edd2cbc5) +* Fix over-enthusiastic freeing of SpecialJoinInfo structs during planning (Richard Guo) [§](https://postgr.es/c/727bc6ac3) + + This led to crashes during planning if partitionwise joining is enabled. +* Disallow copying of invalidated replication slots (Shlok Kyal) [§](https://postgr.es/c/a4309e85f) + + This prevents trouble when the invalid slot points to WAL that's already been removed. +* Disallow restoring logical replication slots on standby servers that are not in hot-standby mode (Masahiko Sawada) [§](https://postgr.es/c/174952ece) + + This prevents a scenario where the slot could remain valid after promotion even if `wal_level` is too low. +* Prevent over-advancement of catalog xmin in “fast forward” mode of logical decoding (Zhijie Hou) [§](https://postgr.es/c/36148b22e) + + This mistake could allow deleted catalog entries to be vacuumed away even though they were still potentially needed by the WAL-reading process. +* Avoid data loss when DDL operations that don't take a strong lock affect tables that are being logically replicated (Shlok Kyal, Hayato Kuroda) [§](https://postgr.es/c/cadaf0ac4) [§](https://postgr.es/c/d96206f25) + + The catalog changes caused by the DDL command were not reflected into WAL-decoding processes, allowing them to decode subsequent changes using stale catalog data, probably resulting in data corruption. +* Prevent incorrect reset of replication origin when an apply worker encounters an error but the error is caught and does not result in worker exit (Hayato Kuroda) [§](https://postgr.es/c/05676d87e) + + This mistake could allow duplicate data to be applied. +* Fix crash in logical replication if the subscriber's partitioned table has a BRIN index (Tom Lane) [§](https://postgr.es/c/788baa9a2) +* Avoid duplicate snapshot creation in logical replication index lookups (Heikki Linnakangas) [§](https://postgr.es/c/c1dd3a944) [§](https://postgr.es/c/f1ef111a0) +* Improve detection of mixed-origin subscriptions (Hou Zhijie, Shlok Kyal) [§](https://postgr.es/c/0ae1245e0) + + Subscription creation gives a warning if a subscribed-to table is also being followed through other publications, since that could cause duplicate data to be received. This change improves that logic to also detect cases where a partition parent or child table is the one being followed through another publication. +* Fix wrong checkpoint details in error message about incorrect recovery timeline choice (David Steele) [§](https://postgr.es/c/29cce279b) + + If the requested recovery timeline is not reachable, the reported checkpoint and timeline should be the values read from the backup\_label, if there is one. This message previously reported values from the control file, which is correct when recovering from the control file without a backup\_label, but not when there is a backup\_label. +* Fix order of operations in `smgropen()` (Andres Freund) [§](https://postgr.es/c/ee578921b) + + Ensure that the SMgrRelation object is fully initialized before calling the smgr\_open callback, so that it can be cleaned up properly if the callback fails. +* Remove incorrect assertion in `pgstat_report_stat()` (Michael Paquier) [§](https://postgr.es/c/4b6331e0f) +* Fix overly-strict assertion in `gistFindCorrectParent()` (Heikki Linnakangas) [§](https://postgr.es/c/6526d0794) +* Avoid assertion failure in parallel vacuum when `maintenance_work_mem` has a very small value (Masahiko Sawada) [§](https://postgr.es/c/a38dce3c4) +* Fix rare assertion failure in standby servers when the primary is restarted (Heikki Linnakangas) [§](https://postgr.es/c/302ce5bd9) +* In PL/pgSQL, avoid “unexpected plan node type” error when a scrollable cursor is defined on a simple `SELECT expression` query (Andrei Lepikhov) [§](https://postgr.es/c/1353b1161) +* Don't try to drop individual index partitions in pg\_dump's `--clean` mode (Jian He) [§](https://postgr.es/c/3424c1075) + + The server rejects such `DROP` commands. That has no real consequences, since the partitions will go away anyway in the subsequent `DROP`s of either their parent tables or their partitioned index. However, the error reported for the attempted drop causes problems when restoring in `--single-transaction` mode. +* In pg\_dumpall, avoid emitting invalid role `GRANT` commands if `pg_auth_members` contains invalid role OIDs (Tom Lane) [§](https://postgr.es/c/16eff4261) + + Instead, print a warning and skip the entry. This copes better with catalog corruption that has been seen to occur in back branches as a result of race conditions between `GRANT` and `DROP ROLE`. +* In pg\_amcheck and pg\_upgrade, use the correct function to free allocations made by libpq (Michael Paquier, Ranier Vilela) [§](https://postgr.es/c/ee78823ff) [§](https://postgr.es/c/0851b6573) [§](https://postgr.es/c/f903d4da9) + + These oversights could result in crashes in certain Windows build configurations, such as a debug build of libpq used by a non-debug build of the calling application. +* Fix reindexdb's scheduling of parallel reindex operations (Alexander Korotkov) [§](https://postgr.es/c/09ef2f8df) + + The original coding failed to achieve the expected amount of parallelism. +* Avoid crashing with corrupt input data in `contrib/pageinspect`'s `heap_page_items()` (Dmitry Kovalenko) [§](https://postgr.es/c/ecb8e5641) +* Prevent assertion failure in `contrib/pg_freespacemap`'s `pg_freespacemap()` (Tender Wang) [§](https://postgr.es/c/51d038da8) + + Applying `pg_freespacemap()` to a relation lacking storage (such as a view) caused an assertion failure, although there was no ill effect in non-assert builds. Add an error check to reject that case. +* In `contrib/postgres_fdw`, avoid pulling up restriction conditions from subqueries (Alexander Pyhalov) [§](https://postgr.es/c/729fe699e) + + This fix prevents rare cases of “unexpected expression in subquery output” errors. +* Fix build failure when an old version of `libpq_fe.h` is present in system include directories (Tom Lane) [§](https://postgr.es/c/f186f90e5) +* Fix build failure on macOS 15.4 (Tom Lane, Peter Eisentraut) [§](https://postgr.es/c/915e88968) + + This macOS update broke our configuration probe for `strchrnul()`. +* Fix valgrind labeling of per-buffer data of read streams (Thomas Munro) [§](https://postgr.es/c/57dca6faa) + + This affects no core code in released versions of PostgreSQL, but an extension using the per-buffer data feature might have encountered spurious failures when being tested under valgrind. +* Avoid valgrind complaints about string hashing code (John Naylor) [§](https://postgr.es/c/fde7c0164) +* Update time zone data files to tzdata release 2025b for DST law changes in Chile, plus historical corrections for Iran (Tom Lane) [§](https://postgr.es/c/5d5970b9f) + + There is a new time zone America/Coyhaique for Chile's Aysén Region, to account for it changing to UTC-03 year-round and thus diverging from America/Santiago. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-17-6.html "E.2. Release 17.6") | [Up](release.html "Appendix E. Release Notes") | [Next](release-17-4.html "E.4. Release 17.4") | +| E.2. Release 17.6 | [Home](index.html "PostgreSQL 17.7 Documentation") | E.4. Release 17.4 | + +[Previous](/docs/release/17.4/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/17.6/) diff --git a/corpus/changelog/postgresql_releases/postgresql_176.md b/corpus/changelog/postgresql_releases/postgresql_176.md new file mode 100644 index 0000000000000000000000000000000000000000..b35b462cfab1ed1f5d05cef8d9a04f4d8f6fbf29 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_176.md @@ -0,0 +1,237 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/17.6/ +Version: 17.6 + +## PostgreSQL 17.6 + +| E.2. Release 17.6 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-17-7.html "E.1. Release 17.7") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 17.7 Documentation") | [Next](release-17-5.html "E.3. Release 17.5") | + +--- + +## E.2. Release 17.6 [#](#RELEASE-17-6) + +[E.2.1. Migration to Version 17.6](release-17-6.html#RELEASE-17-6-MIGRATION) + +[E.2.2. Changes](release-17-6.html#RELEASE-17-6-CHANGES) + +**Release date:**2025-08-14 + +This release contains a variety of fixes from 17.5. For information about new features in major release 17, see [Section E.8](release-17.html "E.8. Release 17"). + +### E.2.1. Migration to Version 17.6 [#](#RELEASE-17-6-MIGRATION) + +A dump/restore is not required for those running 17.X. + +However, if you have any BRIN `numeric_minmax_multi_ops` indexes, it is advisable to reindex them after updating. See the fourth changelog entry below. + +Also, if you are upgrading from a version earlier than 17.5, see [Section E.3](release-17-5.html "E.3. Release 17.5"). + +### E.2.2. Changes [#](#RELEASE-17-6-CHANGES) + +* Tighten security checks in planner estimation functions (Dean Rasheed) [§](https://postgr.es/c/a85eddab2) + + The fix for CVE-2017-7484, plus followup fixes, intended to prevent leaky functions from being applied to statistics data for columns that the calling user does not have permission to read. Two gaps in that protection have been found. One gap applies to partitioning and inheritance hierarchies where RLS policies on the tables should restrict access to statistics data, but did not. + + The other gap applies to cases where the query accesses a table via a view, and the view owner has permissions to read the underlying table but the calling user does not have permissions on the view. The view owner's permissions satisfied the security checks, and the leaky function would get applied to the underlying table's statistics before we check the calling user's permissions on the view. This has been fixed by making security checks on views occur at the start of planning. That might cause permissions failures to occur earlier than before. + + The PostgreSQL Project thanks Dean Rasheed for reporting this problem. (CVE-2025-8713) +* Prevent pg\_dump scripts from being used to attack the user running the restore (Nathan Bossart) [§](https://postgr.es/c/575f54d4c) + + Since dump/restore operations typically involve running SQL commands as superuser, the target database installation must trust the source server. However, it does not follow that the operating system user who executes psql to perform the restore should have to trust the source server. The risk here is that an attacker who has gained superuser-level control over the source server might be able to cause it to emit text that would be interpreted as psql meta-commands. That would provide shell-level access to the restoring user's own account, independently of access to the target database. + + To provide a positive guarantee that this can't happen, extend psql with a `\restrict` command that prevents execution of further meta-commands, and teach pg\_dump to issue that before any data coming from the source server. + + The PostgreSQL Project thanks Martin Rakhmanov, Matthieu Denais, and RyotaK for reporting this problem. (CVE-2025-8714) +* Convert newlines to spaces in names included in comments in pg\_dump output (Noah Misch) [§](https://postgr.es/c/9b92f115b) + + Object names containing newlines offered the ability to inject arbitrary SQL commands into the output script. (Without the preceding fix, injection of psql meta-commands would also be possible this way.) CVE-2012-0868 fixed this class of problem at the time, but later work reintroduced several cases. + + The PostgreSQL Project thanks Noah Misch for reporting this problem. (CVE-2025-8715) +* Fix incorrect distance calculation in BRIN `numeric_minmax_multi_ops` support function (Peter Eisentraut, Tom Lane) [§](https://postgr.es/c/0b0d3c19b) + + The results were sometimes wrong on 64-bit platforms, and wildly wrong on 32-bit platforms. This did not produce obvious failures because the logic is only used to choose how to merge values into ranges; at worst the index would become inefficient and bloated. Nonetheless it's recommended to reindex any BRIN indexes that use the `numeric_minmax_multi_ops` operator class. +* Avoid regression in the size of XML input that we will accept (Michael Paquier, Erik Wienhold) [§](https://postgr.es/c/fd4ad33fe) [§](https://postgr.es/c/7571e0f6e) + + Our workaround for a bug in early 2.13.x releases of libxml2 made use of a code path that rejects text chunks exceeding 10MB, whereas the previous coding did not. Those early releases are presumably extinct in the wild by now, so revert to the previous coding. +* Fix `MERGE` problems with concurrent updates (Dean Rasheed) [§](https://postgr.es/c/91ad1bdef) + + If a `MERGE` inside a CTE attempts an update or delete on a table with `BEFORE ROW` triggers, and a concurrent `UPDATE` or `DELETE` changes the target row, the `MERGE` command would fail (crashing in the case of an update action, and potentially executing the wrong action in the case of a delete action). +* Fix `MERGE` into a plain-inheritance parent table (Dean Rasheed) [§](https://postgr.es/c/ab52f6b5b) + + Insertions into such a target table could crash or produce incorrect query results due to failing to handle `WITH CHECK OPTION` and `RETURNING` actions. +* Allow tables with statement-level triggers to become partitions or inheritance children (Etsuro Fujita) [§](https://postgr.es/c/e028ce911) + + We do not allow partitions or inheritance child tables to have row-level triggers with transition tables, because an operation on the whole inheritance tree would need to maintain a separate transition table for each such child table. But that problem does not apply for statement-level triggers, because only the parent's statement-level triggers will be fired. The code that checks whether an existing table can become a partition or inheritance child nonetheless rejected both kinds of trigger. +* Disallow collecting transition tuples from child foreign tables (Etsuro Fujita) [§](https://postgr.es/c/9048a83c7) + + We do not support triggers with transition tables on foreign tables. However, the case of a partition or inheritance child that is a foreign table was overlooked. If the parent has such a trigger, incorrect transition tuples were collected from the foreign child. Instead throw an error, reporting that the case is not supported. +* Allow resetting unknown custom parameters with reserved prefixes (Nathan Bossart) [§](https://postgr.es/c/39ff05636) + + Previously, if a parameter setting had been stored using `ALTER DATABASE/ROLE/SYSTEM`, the stored setting could not be removed if the parameter was unknown but had a reserved prefix. This case could arise if an extension used to have a parameter, but that parameter had been removed in an upgrade. +* Fix a potential deadlock during `ALTER SUBSCRIPTION ... DROP PUBLICATION` (Ajin Cherian) [§](https://postgr.es/c/8c298324a) + + Ensure that server processes acquire catalog locks in a consistent order during replication origin drops. +* Shorten the race condition window for creating indexes with conflicting names (Tom Lane) [§](https://postgr.es/c/fdd826922) + + When choosing an auto-generated name for an index, avoid conflicting with not-yet-committed `pg_class` rows as well as fully-valid ones. This avoids possibly choosing the same name as some concurrent `CREATE INDEX` did, when that command is still in process of filling its index, or is done but is part of a not-yet-committed transaction. There's still a window for trouble, but it's only as long as the time needed to validate a new index's parameters and insert its `pg_class` row. +* Prevent usage of incorrect `VACUUM` options in some cases where multiple tables are vacuumed in a single command (Nathan Bossart, Michael Paquier) [§](https://postgr.es/c/2e0b5d252) + + The `TRUNCATE` and `INDEX_CLEANUP` options of one table could be applied to others. +* Ensure that the table's free-space map is updated in a timely way when vacuuming a table that has no indexes (Masahiko Sawada) [§](https://postgr.es/c/792238c8b) + + A previous optimization caused FSM vacuuming to sometimes be skipped for such tables. +* Fix processing of character classes within `SIMILAR TO` regular expressions (Laurenz Albe) [§](https://postgr.es/c/e3ffc3e91) [§](https://postgr.es/c/a3c6d92f3) + + The code that translates `SIMILAR TO` pattern matching expressions to POSIX-style regular expressions did not consider that square brackets can be nested. For example, in a pattern like `[[:alpha:]%_]`, the code treated the `%` and `_` characters as metacharacters when they should be literals. +* When deparsing queries, always add parentheses around the expression in `FETCH FIRST expression ROWS WITH TIES` clauses (Heikki Linnakangas) [§](https://postgr.es/c/54c05292b) [§](https://postgr.es/c/a4da7b0cf) + + This avoids some cases where the deparsed result wasn't syntactically valid. +* Limit the checkpointer process's fsync request queue size (Alexander Korotkov, Xuneng Zhou) [§](https://postgr.es/c/13559de95) [§](https://postgr.es/c/605890034) + + With very large `shared_buffers` settings, it was possible for the checkpointer to attempt to allocate more than 1GB for fsync requests, leading to failure and an infinite loop. Clamp the queue size to prevent this scenario. +* Avoid infinite wait in logical decoding when reading a partially-written WAL record (Vignesh C) [§](https://postgr.es/c/c9f4e7520) + + If the server crashes after writing the first part of a WAL record that would span multiple pages, subsequent logical decoding of the WAL stream would wait for data to arrive on the next WAL page. That might never happen if the server is now idle. +* Fix inconsistent spelling of LWLock names for `MultiXactOffsetSLRU` and `MultiXactMemberSLRU` (Bertrand Drouvot) [§](https://postgr.es/c/b3abec0ad) + + This resulted in different wait-event names being displayed in `pg_wait_events` and `pg_stat_activity`, potentially breaking monitoring queries that join those views. +* Fix inconsistent quoting of role names in ACL strings (Tom Lane) [§](https://postgr.es/c/50959f96e) + + The previous quoting rule was locale-sensitive, which could lead to portability problems when transferring `aclitem` values across installations. (pg\_dump does not do that, but other tools might.) To ensure consistency, always quote non-ASCII characters in `aclitem` output; but to preserve backward compatibility, never require that they be quoted during `aclitem` input. +* Reject equal signs (`=`) in the names of relation options and foreign-data options (Tom Lane) [§](https://postgr.es/c/d4046125d) + + There's no evident use-case for option names like this, and allowing them creates ambiguity in the stored representation. +* Fix potentially-incorrect decompression of LZ4-compressed archive data (Mikhail Gribkov) [§](https://postgr.es/c/074003431) + + This error seems to manifest only with not-very-compressible input data, which may explain why it escaped detection. +* Avoid a rare scenario where a btree index scan could mark the wrong index entries as dead (Peter Geoghegan) [§](https://postgr.es/c/40aa5ddea) +* Avoid re-distributing cache invalidation messages from other transactions during logical replication (vignesh C) [§](https://postgr.es/c/45c357e0e) + + Our previous round of minor releases included a bug fix to ensure that replication receiver processes would respond to cross-process cache invalidation messages, preventing them from using stale catalog data while performing replication updates. However, the fix unintentionally made them also redistribute those messages again, leading to an exponential increase in the number of invalidation messages, which would often end in a memory allocation failure. Fix by not redistributing received messages. +* Avoid unexpected server shutdown when replication slot synchronization is misconfigured (Fujii Masao) [§](https://postgr.es/c/f71fa981c) + + The postmaster process would report an error (and then stop) if `sync_replication_slots` was set to `true` while `wal_level` was less than `logical`. The desired behavior is just that slot synchronization should be disabled, so reduce this error message's level to avoid postmaster shutdown. +* Avoid premature removal of old WAL during checkpoints (Vitaly Davydov) [§](https://postgr.es/c/2090edc6f) + + If a replication slot's restart point is advanced while a checkpoint is in progress, no-longer-needed WAL segments could get removed too soon, leading to recovery failure if the database crashes immediately afterwards. Fix by keeping them for one additional checkpoint cycle. +* Never move a replication slot's confirmed-flush position backwards (Shveta Malik) [§](https://postgr.es/c/7318f241d) + + In some cases a replication client could acknowledge an LSN that's past what it has stored persistently, and then perhaps send an older LSN after a restart. We consider this not-a-bug so long as the client did not have anything it needed to do for the WAL between the two points. However, we should not re-send that WAL for fear of data duplication, so make sure we always believe the latest confirmed LSN for a given slot. +* Prevent excessive delays before launching new logical replication workers (Tom Lane) [§](https://postgr.es/c/9f33300e6) + + In some cases the logical replication launcher could sleep considerably longer than the configured `wal_retrieve_retry_interval` before launching a new worker. +* Fix use-after-free during logical replication of `INSERT ... ON CONFLICT` (Ethan Mertz, Michael Paquier) [§](https://postgr.es/c/9e0b4b1ab) + + This could result in incorrect progress reporting, or with very bad luck it could result in a crash of the WAL sender process. +* Allow waiting for a transaction on a standby server to be interrupted (Kevin K Biju) [§](https://postgr.es/c/24c5ad5be) + + Creation of a replication slot on a standby server may require waiting for some active transaction(s) to finish on the primary and then be replayed on the standby. Since that could be an indefinite wait, it's desirable to allow the operation to be cancelled, but there was no check for query cancel in the loop. +* Do not let cascading logical WAL senders try to send data that's beyond what has been replayed on their standby server (Alexey Makhmutov) [§](https://postgr.es/c/87be749c7) + + This avoids a situation where such WAL senders could get stuck at standby server shutdown, waiting for replay work that will not happen because the server's startup process is already shut down. +* Fix per-relation memory leakage in autovacuum (Tom Lane) [§](https://postgr.es/c/cd3064f98) +* Fix session-lifespan memory leaks in `XMLSERIALIZE(... INDENT)` (Dmitry Kovalenko, Tom Lane) [§](https://postgr.es/c/95cf1a181) [§](https://postgr.es/c/20bae0690) +* Fix possible crash after out-of-memory when allocating large chunks with the “bump” allocator (Tom Lane) [§](https://postgr.es/c/a05cf22e0) +* Fix some places that might try to fetch toasted fields of system catalogs without any snapshot (Nathan Bossart) [§](https://postgr.es/c/fe8ea7a2a) + + This could result in an assertion failure or “cannot fetch toast data without an active snapshot” error. +* Avoid assertion failure during cross-table constraint updates (Tom Lane, Jian He) [§](https://postgr.es/c/bbfcbc4cd) [§](https://postgr.es/c/6d4395b40) +* Remove faulty assertion that a command tag must have been determined by the end of `PortalRunMulti()` (Álvaro Herrera) [§](https://postgr.es/c/0c466f5e0) + + This failed in edge cases such as an empty prepared statement. +* Fix assertion failure in `XMLTABLE` parsing (Richard Guo) [§](https://postgr.es/c/2f48b4f07) +* Restore the ability to run PL/pgSQL expressions in parallel (Dipesh Dhameliya) [§](https://postgr.es/c/a553a2289) + + PL/pgSQL's notion of an “expression” is very broad, encompassing any SQL `SELECT` query that returns a single column and no more than one row. So there are cases, for example evaluation of an aggregate function, where the query involves significant work and it'd be useful to run it with parallel workers. This used to be possible, but a previous bug fix unintentionally disabled it. +* Fix edge-case resource leaks in PL/Python error reporting (Tom Lane) [§](https://postgr.es/c/7559a16e2) [§](https://postgr.es/c/6f724fcf8) + + An out-of-memory failure while reporting an error from Python could result in failure to drop reference counts on Python objects, leading to session-lifespan memory leakage. +* Fix libpq's `PQcancelCreate()` function for the case where the server's address was specified using `hostaddr` (Sergei Kornilov) [§](https://postgr.es/c/445bd37b1) + + libpq would crash if the resulting cancel object was actually used. +* Fix libpq's `PQport()` function to never return NULL unless the passed connection is NULL (Daniele Varrazzo) [§](https://postgr.es/c/3f10d2b66) + + This is the documented behavior, but recent libpq versions would return NULL in some cases where the user had not provided a port specification. Revert to our historical behavior of returning an empty string in such cases. (v18 and later will return the compiled-in default port number, typically `"5432"`, instead.) +* Avoid failure when GSSAPI authentication requires packets larger than 16kB (Jacob Champion, Tom Lane) [§](https://postgr.es/c/8b0aa7a6b) + + Larger authentication packets are needed for Active Directory users who belong to many AD groups. This limitation manifested in connection failures with unintelligible error messages, typically “GSSAPI context establishment error: The routine must be called again to complete its function: Unknown error”. +* Fix timing-dependent failures in SSL and GSSAPI data transmission (Tom Lane) [§](https://postgr.es/c/30e0d9ee9) + + When using SSL or GSSAPI encryption in non-blocking mode, libpq sometimes failed with “SSL error: bad length” or “GSSAPI caller failed to retransmit all data needing to be retried”. +* Avoid null-pointer dereference during connection lookup in ecpg applications (Aleksander Alekseev) [§](https://postgr.es/c/2805e1c1e) + + The case could occur only if the application has some connections that are named and some that are not. +* Improve psql's tab completion for `COPY` and `\copy` options (Atsushi Torikoshi) [§](https://postgr.es/c/c1c6169eb) + + The same completions were offered for both `COPY FROM` and `COPY TO`, although some options are only valid for one case or the other. Distinguish these cases to provide more accurate suggestions. +* Avoid assertion failure in pgbench when multiple pipeline sync messages are received (Fujii Masao) [§](https://postgr.es/c/398e07162) +* Fix duplicate transaction replay when initializing a subscription with pg\_createsubscriber (Shlok Kyal) [§](https://postgr.es/c/967309116) + + It was possible for the last transaction processed during subscriber recovery to be sent again once normal replication begins. +* Ensure that pg\_dump dumps comments on not-null constraints on domain types (Jian He, Álvaro Herrera) [§](https://postgr.es/c/6b755d8d7) +* Ensure that pg\_dump dumps comments on domain constraints in a valid order (Jian He) [§](https://postgr.es/c/d07bc7c2b) + + In some cases the comment command could appear before creation of the constraint. +* Ensure stable sort ordering in pg\_dump for all types of database objects (Noah Misch, Andreas Karlsson) [§](https://postgr.es/c/1ca1889ea) [§](https://postgr.es/c/5dd4957b2) [§](https://postgr.es/c/28e7252e4) + + pg\_dump sorts objects by their logical names before performing dependency-driven reordering. This sort did not account for the full unique key identifying certain object types such as rules and constraints, and thus it could produce dissimilar sort orders for logically-identical databases. That made it difficult to compare databases by diff'ing pg\_dump output, so improve the logic to ensure stable sort ordering in all cases. +* Fix incorrect parsing of object types in pg\_dump filter files (Fujii Masao) [§](https://postgr.es/c/7dafc4a41) + + Treat keywords as extending to the next whitespace, rather than stopping at the first non-alphanumeric character as before. This makes no difference for valid keywords, but it allows some error cases to be recognized properly. For example, `table-data` will now be rejected, whereas previously it was misinterpreted as `table`. +* pg\_restore failed to restore large objects (BLOBs) from directory-format dumps made by pg\_dump versions before PostgreSQL v12 (Pavel Stehule) [§](https://postgr.es/c/839802792) +* In pg\_upgrade, check for inconsistent inherited not-null constraints (Ali Akbar) [§](https://postgr.es/c/b8b2e6052) [§](https://postgr.es/c/bcb8d47cd) [§](https://postgr.es/c/930e1faec) + + PostgreSQL versions before 18 allow an inherited column not-null constraint to be dropped. However, this results in a schema that cannot be restored, leading to failure in pg\_upgrade. Detect such cases during pg\_upgrade's preflight checks to allow users to fix them before initiating the upgrade. +* Don't require that the target installation have `max_slot_wal_keep_size` set to its default during pg\_upgrade (Dilip Kumar) [§](https://postgr.es/c/24f6c1bd4) +* Avoid assertion failure if `track_commit_timestamp` is enabled during initdb (Hayato Kuroda, Andy Fan) [§](https://postgr.es/c/ae20c105f) +* Fix pg\_waldump to show information about dropped statistics in `PREPARE TRANSACTION` WAL records (Daniil Davydov) [§](https://postgr.es/c/11efaaffa) +* Avoid possible leak of the open connection during `contrib/dblink` connection establishment (Tom Lane) [§](https://postgr.es/c/e20b3256a) + + In the rare scenario where we hit out-of-memory while inserting the new connection object into dblink's hashtable, the open connection would be leaked until end of session, leaving an idle session sitting on the remote server. +* Make `contrib/pg_prewarm` cope with very large `shared_buffers` settings (Daria Shanina) [§](https://postgr.es/c/e4b8f925a) + + Autoprewarm failed with a memory allocation error if `shared_buffers` was larger than about 50 million buffers (400GB). +* Prevent assertion failure in `contrib/pg_prewarm` (Masahiro Ikeda) [§](https://postgr.es/c/b64c585fd) + + Applying `pg_prewarm()` to a relation lacking storage (such as a view) caused an assertion failure, although there was no ill effect in non-assert builds. Add an error check to reject that case. +* In `contrib/pg_stat_statements`, avoid leaving gaps in the set of parameter numbers used in a normalized query (Sami Imseih) [§](https://postgr.es/c/290e8ab32) +* Fix memory leakage in `contrib/postgres_fdw`'s DirectModify methods (Tom Lane) [§](https://postgr.es/c/9339c85af) + + The `PGresult` holding the results of the remote modify command would be leaked for the rest of the session if the query fails between invocations of the DirectModify methods, which could happen when there's `RETURNING` data to process. +* Ensure that directories listed in configure's `--with-includes` and `--with-libraries` options are searched before system-supplied directories (Tom Lane) [§](https://postgr.es/c/a644f5fc6) + + A common reason for using these options is to allow a user-built version of some library to override the system-supplied version. However, that failed to work in some environments because of careless ordering of switches in the commands issued by the makefiles. +* Fix configure's checks for `__cpuid()` and `__cpuidex()` (Lukas Fittl, Michael Paquier) [§](https://postgr.es/c/8de56323c) + + configure failed to detect these Windows-specific functions, so that they would not be used, leading to slower-than-necessary CRC computations since the availability of hardware instructions could not be verified. The practical impact of this error was limited, because production builds for Windows typically do not use the Autoconf toolchain. +* Fix build failure with `--with-pam` option on Solaris-based platforms (Tom Lane) [§](https://postgr.es/c/635a85627) + + Solaris is inconsistent with other Unix platforms about the API for PAM authentication. This manifested as an “inconsistent pointer” compiler warning, which we never did anything about. But as of GCC 14 it's an error not warning by default, so fix it. +* Make our code portable to GNU Hurd (Michael Banck, Christoph Berg, Samuel Thibault) [§](https://postgr.es/c/0991249d7) [§](https://postgr.es/c/29c54ea7b) + + Fix assumptions about `IOV_MAX` and `O_RDONLY` that don't hold on Hurd. +* Make our usage of `memset_s()` conform strictly to the C11 standard (Tom Lane) [§](https://postgr.es/c/5355a2400) + + This avoids compile failures on some platforms. +* Silence compatibility warning when using Meson to build with MSVC (Peter Eisentraut) [§](https://postgr.es/c/2499c3490) +* Prevent uninitialized-value compiler warnings in JSONB comparison code (Tom Lane) [§](https://postgr.es/c/5a2139a90) +* Avoid deprecation warnings when building with libxml2 2.14 and later (Michael Paquier) [§](https://postgr.es/c/c911e7802) +* Avoid problems when compiling `pg_locale.h` under C++ (John Naylor) [§](https://postgr.es/c/21ae8fc5f) + + PostgreSQL header files generally need to be wrapped in `extern "C" { ... }` in order to be included in extensions written in C++. This failed for `pg_locale.h` because of its use of libicu headers, but we can work around that by suppressing C++-only declarations in those headers. C++ extensions that want to use libicu's C++ APIs can do so by including the libicu headers ahead of `pg_locale.h`. + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-17-7.html "E.1. Release 17.7") | [Up](release.html "Appendix E. Release Notes") | [Next](release-17-5.html "E.3. Release 17.5") | +| E.1. Release 17.7 | [Home](index.html "PostgreSQL 17.7 Documentation") | E.3. Release 17.5 | + +[Previous](/docs/release/17.5/) + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/17.7/) diff --git a/corpus/changelog/postgresql_releases/postgresql_177.md b/corpus/changelog/postgresql_releases/postgresql_177.md new file mode 100644 index 0000000000000000000000000000000000000000..b2f971f508721308482e8bf09d78a29ab12d6791 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_177.md @@ -0,0 +1,211 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/17.7/ +Version: 17.7 + +## PostgreSQL 17.7 + +| E.1. Release 17.7 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release.html "Appendix E. Release Notes") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 17.7 Documentation") | [Next](release-17-6.html "E.2. Release 17.6") | + +--- + +## E.1. Release 17.7 [#](#RELEASE-17-7) + +[E.1.1. Migration to Version 17.7](release-17-7.html#RELEASE-17-7-MIGRATION) + +[E.1.2. Changes](release-17-7.html#RELEASE-17-7-CHANGES) + +**Release date:**2025-11-13 + +This release contains a variety of fixes from 17.6. For information about new features in major release 17, see [Section E.8](release-17.html "E.8. Release 17"). + +### E.1.1. Migration to Version 17.7 [#](#RELEASE-17-7-MIGRATION) + +A dump/restore is not required for those running 17.X. + +However, if you are upgrading from a version earlier than 17.6, see [Section E.2](release-17-6.html "E.2. Release 17.6"). + +### E.1.2. Changes [#](#RELEASE-17-7-CHANGES) + +* Check for `CREATE` privileges on the schema in `CREATE STATISTICS` (Jelte Fennema-Nio) [§](https://postgr.es/c/e2fb3dfa8) + + This omission allowed table owners to create statistics in any schema, potentially leading to unexpected naming conflicts. + + The PostgreSQL Project thanks Jelte Fennema-Nio for reporting this problem. (CVE-2025-12817) +* Avoid integer overflow in allocation-size calculations within libpq (Jacob Champion) [§](https://postgr.es/c/f5999f018) + + Several places in libpq were not sufficiently careful about computing the required size of a memory allocation. Sufficiently large inputs could cause integer overflow, resulting in an undersized buffer, which would then lead to writing past the end of the buffer. + + The PostgreSQL Project thanks Aleksey Solovev of Positive Technologies for reporting this problem. (CVE-2025-12818) +* Prevent “unrecognized node type” errors when a SQL/JSON function such as `JSON_VALUE` has a `DEFAULT` clause containing a `COLLATE` expression (Jian He) [§](https://postgr.es/c/09f86a42f) [§](https://postgr.es/c/1e6dfdaa0) +* Correctly treat JSON constructor expressions, such as `JSON_OBJECT()`, as non-strict (Tender Wang, Richard Guo) [§](https://postgr.es/c/d719e2ecb) + + In some cases these expressions can yield a non-null result despite having one or more null inputs, making them non-strict. The planner incorrectly classified them as strict and could perform incorrect query transformations as a result. +* Further fix processing of character classes within `SIMILAR TO` regular expressions (Laurenz Albe) [§](https://postgr.es/c/e09adb5b9) + + The previous fix for translating `SIMILAR TO` pattern matching expressions to POSIX-style regular expressions broke a corner case that formerly worked: if there is an escape character right after the opening bracket and then a closing bracket right after the escape sequence (for example `[\w]`), the closing bracket was no longer seen as terminating the character class. +* Fix parsing of aggregate functions whose arguments contain a sub-select with a `FROM` reference to a CTE outside the aggregate function (Tom Lane) [§](https://postgr.es/c/e830896c1) + + Such a CTE reference must act like a outer-level column reference when determining the aggregate's semantic level; but it was not being accounted for, leading to obscure planner or executor errors. +* Fix “no relation entry for relid” errors in corner cases while estimating SubPlan costs (Richard Guo) [§](https://postgr.es/c/f34202f51) +* Avoid unlikely use-after-free in planner's expansion of partitioned tables (Bernd Reiß) [§](https://postgr.es/c/ed394c4bd) + + There was a hazard only when the last live partition was concurrently dropped. +* Remove faulty assertion in btree index cleanup (Peter Geoghegan) [§](https://postgr.es/c/ae15cebc2) +* Fix possible infinite loop in GIN index scans with multiple scan conditions (Tom Lane) [§](https://postgr.es/c/456c6a05d) + + GIN can handle scan conditions that can reject non-matching entries but are not useful for searching for relevant entries, for example a `tsquery` clause like `!term`. But such a condition must not be first in the array of scan conditions. The code failed to ensure that in all cases, with the result that a query having a mix of such conditions with normal conditions might work or not depending on the order in which the conditions were given in the query. +* Ensure that GIN index scans can be canceled (Tom Lane) [§](https://postgr.es/c/d17abaea8) + + Some code paths were capable of running for a long time without checking for interrupts. +* Ensure that BRIN autosummarization provides a snapshot for index expressions that need one (Álvaro Herrera) [§](https://postgr.es/c/f4b68b033) [§](https://postgr.es/c/3b5007347) + + Previously, autosummarization would fail for such indexes, and then leave placeholder index tuples behind, causing the index to bloat over time. +* Fix integer-overflow hazard in BRIN index scans when the table contains close to 232 pages (Sunil S) [§](https://postgr.es/c/c4f5a59ab) + + This oversight could result in an infinite loop or scanning of unneeded table pages. +* Fix incorrect zero-extension of stored values in JIT-generated tuple deforming code (David Rowley) [§](https://postgr.es/c/10945148e) + + When not using JIT, the equivalent code does sign-extension not zero-extension, leading to a different Datum representation of small integer data types. This inconsistency was masked in most cases, but it is known to lead to “could not find memoization table entry” errors when using Memoize plan nodes, and there might be other symptoms. +* Fix incorrect logic for caching result-relation information for triggers (David Rowley, Amit Langote) [§](https://postgr.es/c/0d3074615) + + In cases where partitions' column sets aren't physically identical to their parent partitioned tables' column sets, this oversight could lead to crashes. +* Add missing EvalPlanQual rechecks for TID Scan and TID Range Scan plan nodes (Sophie Alpert, David Rowley) [§](https://postgr.es/c/0fb06e893) [§](https://postgr.es/c/3d939a9b1) + + This omission led to possibly not rechecking a condition on `ctid` during concurrent-update situations, causing the update's behavior to vary depending on which plan type had been selected. +* Fix EvalPlanQual handling of foreign or custom joins that do not have an alternative local-join plan prepared for EPQ (Masahiko Sawada, Etsuro Fujita) [§](https://postgr.es/c/2bb84ea7e) + + In such cases the foreign or custom access method should be invoked normally, but that did not happen, typically leading to a crash. +* Avoid duplicating hash partition constraints during `DETACH CONCURRENTLY` (Haiyang Li) [§](https://postgr.es/c/ea06f97ee) + + `ALTER TABLE DETACH PARTITION CONCURRENTLY` was written to add a copy of the partitioning constraint to the now-detached partition. This was misguided, partially because non-concurrent `DETACH` doesn't do that, but mostly because in the case of hash partitioning the constraint expression contains references to the parent table's OID. That causes problems during dump/restore, or if the parent table is dropped after `DETACH`. In v19 and later, we'll no longer create any such copied constraints at all. In released branches, to minimize the risk of unforeseen consequences, only skip adding a copied constraint if it is for hash partitioning. +* Disallow generated columns in partition keys (Jian He, Ashutosh Bapat) [§](https://postgr.es/c/0b44f2443) + + This was already not allowed, but the check missed some cases, such as where the column reference is implicit in a whole-row reference. +* Disallow generated columns in `COPY ... FROM ... WHERE` clauses (Peter Eisentraut, Jian He) [§](https://postgr.es/c/07f787e57) + + Previously, incorrect behavior or an obscure error message resulted from attempting to reference such a column, since generated columns have not yet been computed at the point where `WHERE` filtering is done. +* Avoid potential use-after-free in parallel vacuum (Kevin Oommen Anish) [§](https://postgr.es/c/3549ffb6a) + + This bug seems to have no consequences in standard builds, but it's theoretically a hazard. +* Fix visibility checking for statistics objects in `pg_temp` (Noah Misch) [§](https://postgr.es/c/6778fbca6) + + A statistics object located in a temporary schema cannot be named without schema qualification, but `pg_statistics_obj_is_visible()` missed that memo and could return “true” regardless. In turn, functions such as `pg_describe_object()` could fail to schema-qualify the object's name as expected. +* Fix `pg_event_trigger_dropped_objects()`'s reporting of temporary status (Antoine Violin, Tom Lane) [§](https://postgr.es/c/c0c8ee23c) [§](https://postgr.es/c/a220e40d1) + + If a dropped column default, trigger, or RLS policy belongs to a temporary table, report it with `is_temporary` true. +* Fix memory leakage in hashed subplans (Haiyang Li) [§](https://postgr.es/c/862980f92) + + Any memory consumed by the hash functions used for hashing tuples constituted a query-lifespan memory leak. One way that could happen is if the values being hashed require de-toasting. +* Avoid leaking `SMgrRelation` objects in the startup process (Jingtang Zhang) [§](https://postgr.es/c/e2dd7b2ac) + + In a long-running standby server, the hashtable holding these objects could bloat substantially, because there was no mechanism for freeing no-longer-interesting entries. +* Fix minor memory leak during WAL replay of database creation (Nathan Bossart) [§](https://postgr.es/c/f9993ac64) +* Fix corruption of the shared statistics table after out-of-memory failures (Mikhail Kot) [§](https://postgr.es/c/3e6dfcfb0) + + Previously, an out-of-memory failure partway through creating a new hash table entry left a broken entry behind, potentially causing errors in other sessions later. +* Fix concurrent update issue in `MERGE` (Yugo Nagata) [§](https://postgr.es/c/6195afbe5) + + When executing a `MERGE UPDATE` action, if there is more than one concurrent update of the target row, the lock-and-retry code would sometimes incorrectly identify the latest version of the target tuple, leading to incorrect results. +* Add missing replica identity checks in `MERGE` and `INSERT ... ON CONFLICT DO UPDATE` (Zhijie Hou) [§](https://postgr.es/c/76f45be93) [§](https://postgr.es/c/0b934d399) [§](https://postgr.es/c/57dfb64ec) + + If `MERGE` may require update or delete actions, and the target table publishes updates or deletes, insist that it have a `REPLICA IDENTITY` defined. Failing to require this can silently break replication. Likewise, `INSERT` with an `UPDATE` option must require `REPLICA IDENTITY` if the target table publishes either inserts or updates. +* Avoid deadlock during `DROP SUBSCRIPTION` when publisher is on the same server as subscriber (Dilip Kumar) [§](https://postgr.es/c/288a817bc) +* Fix incorrect reporting of replication lag in `pg_stat_replication` view (Fujii Masao) [§](https://postgr.es/c/62d5ee75b) + + If any standby server's replay LSN stopped advancing, the `write_lag` and `flush_lag` columns would eventually stop updating. +* Avoid duplicative log messages about invalid `primary_slot_name` settings (Fujii Masao) [§](https://postgr.es/c/1db2870bb) +* Avoid failures when `synchronized_standby_slots` references nonexistent replication slots (Shlok Kyal) [§](https://postgr.es/c/0024f5a10) +* Remove the unfinished slot state file after failing to write a replication slot's state to disk (Michael Paquier) [§](https://postgr.es/c/42348839d) + + Previously, a failure such as out-of-disk-space resulted in leaving a temporary `state.tmp` file behind. That's problematic because it would block all subsequent attempts to write the state, requiring manual intervention to clean up. +* Fix mishandling of lock timeout signals in parallel apply workers for logical replication (Hayato Kuroda) [§](https://postgr.es/c/2f6e1a490) + + The same signal number was being used for both worker shutdown and lock timeout, leading to confusion. +* Avoid unwanted WAL receiver shutdown when switching from streaming to archive WAL source (Xuneng Zhou) [§](https://postgr.es/c/e7340b484) + + During a timeline change, a standby server's WAL receiver should remain alive, waiting for a new WAL streaming start point. Instead it was repeatedly shutting down and immediately getting restarted, which could confuse status monitoring code. +* Avoid failures in logical replication due to chance collisions of file numbers between regular and temporary tables (Vignesh C) [§](https://postgr.es/c/dcdc95cb4) + + This low-probability problem manifested as transient errors like “unexpected duplicate for tablespace *`X`*, relfilenode *`Y`*”. `contrib/autoprewarm` was also affected. A side-effect of the fix is that the SQL function `pg_filenode_relation()` will now ignore temporary tables. +* Fix use-after-free issue in the relation synchronization cache maintained by the pgoutput logical decoding plugin (Vignesh C, Masahiko Sawada) [§](https://postgr.es/c/a61592253) + + An error during logical decoding could result in crashes in subsequent logical decoding attempts in the same session. The case is only reachable when pgoutput is invoked via SQL functions. +* Avoid unnecessary invalidation of logical replication slots (Bertrand Drouvot) [§](https://postgr.es/c/f3fb6bc9f) +* Avoid assertion failure when trying to release a replication slot in single-user mode (Hayato Kuroda) [§](https://postgr.es/c/07a302387) +* Fix incorrect printing of messages about failures in checking whether the user has Windows administrator privilege (Bryan Green) [§](https://postgr.es/c/4c53519e1) + + This code would have crashed or at least printed garbage. No such cases have been reported though, indicating that failure of these system calls is extremely rare. +* Avoid startup failure on macOS and BSD platforms when there is a collision with a pre-existing semaphore set (Tom Lane) [§](https://postgr.es/c/ab92f0e7f) + + If the pre-existing set has fewer semaphores than we asked for, these platforms return EINVAL not EEXIST as our code expected, resulting in failure to start the database. +* Avoid crash when attempting to test PostgreSQL with certain libsanitizer options (Emmanuel Sibi, Jacob Champion) [§](https://postgr.es/c/a9515f294) +* Fix false memory-context-checking warnings in debug builds on 64-bit Windows (David Rowley) [§](https://postgr.es/c/bd6f986c9) +* Correctly handle `GROUP BY DISTINCT` in PL/pgSQL assignment statements (Tom Lane) [§](https://postgr.es/c/3fc9aa5b0) + + The parser failed to record the `DISTINCT` option in this context, so that the command would act as if it were plain `GROUP BY`. +* Avoid leaking memory when handling a SQL error within PL/Python (Tom Lane) [§](https://postgr.es/c/fbc41a145) + + This fixes a session-lifespan memory leak introduced in our previous minor releases. +* Fix libpq's trace output of characters with the high bit set (Ran Benita) [§](https://postgr.es/c/0fedb3a27) + + On platforms where `char` is considered signed, the output included unsightly `\xffffff` decoration. +* Fix libpq's handling of socket-related errors on Windows within its GSSAPI logic (Ning Wu, Tom Lane) [§](https://postgr.es/c/1c4671f7b) + + The code for encrypting/decrypting transmitted data using GSSAPI did not correctly recognize error conditions on the connection socket, since Windows reports those differently than other platforms. This led to failure to make such connections on Windows. +* Fix dumping of non-inherited not-null constraints on inherited table columns (Dilip Kumar) [§](https://postgr.es/c/c945b06d5) + + pg\_dump failed to preserve such constraints when dumping from a pre-v18 server. +* In pg\_dump, dump security labels on subscriptions and event triggers (Jian He, Fujii Masao) [§](https://postgr.es/c/968141898) + + Labels on these types of objects were previously missed. +* Fix pg\_dump's sorting of default ACLs and foreign key constraints (Kirill Reshke, Álvaro Herrera) [§](https://postgr.es/c/e8d22095e) [§](https://postgr.es/c/49a09c6c5) [§](https://postgr.es/c/7419c99a2) + + Ensure consistent ordering of these database object types, as was already done for other object types. +* In pg\_dump, label comments for separately-dumped domain constraints with the proper dependency (Noah Misch) [§](https://postgr.es/c/e127764b6) + + This error could lead to parallel pg\_restore attempting to create the comment before the constraint itself has been restored. +* In pg\_restore, skip comments and security labels for publications and subscriptions that are not being restored (Jian He, Fujii Masao) [§](https://postgr.es/c/f7f9c5d65) [§](https://postgr.es/c/dc8aa2f58) + + Do not emit `COMMENT` or `SECURITY LABEL` commands for these objects when `--no-publications` or `--no-subscriptions` is specified. +* Fix assorted errors in the data compression logic in pg\_dump and pg\_restore (Daniel Gustafsson, Tom Lane) [§](https://postgr.es/c/92268b35d) [§](https://postgr.es/c/bf18e9bd7) [§](https://postgr.es/c/2efca1633) + + Error checking was missing or incorrect in several places, and there were also portability issues that would manifest on big-endian hardware. These problems had been missed because this code is only used to read compressed TOC files within directory-format dumps. pg\_dump never produces such a dump; the case can be reached only by manually compressing the TOC file after the fact, which is a supported thing to do but very uncommon. +* Fix pgbench to error out cleanly if a `COPY` operation is started (Anthonin Bonnefoy) [§](https://postgr.es/c/de6de069d) + + pgbench doesn't intend to support this case, but previously it went into an infinite loop. +* Fix pgbench's reporting of multiple errors (Yugo Nagata) [§](https://postgr.es/c/a912118c6) + + In cases where two successive `PQgetResult` calls both fail, pgbench might report the wrong error message. +* In pgbench, fix faulty assertion about errors in pipeline mode (Yugo Nagata) [§](https://postgr.es/c/f39d9164b) +* Fix per-file memory leakage in pg\_combinebackup (Tom Lane) [§](https://postgr.es/c/4eb6992af) +* Ensure that `contrib/pg_buffercache` functions can be canceled (Satyanarayana Narlapuram, Yuhang Qiu) [§](https://postgr.es/c/b6090ed96) + + Some code paths were capable of running for a long time without checking for interrupts. +* Fix `contrib/pg_prewarm`'s privilege checks for indexes (Ayush Vatsa, Nathan Bossart) [§](https://postgr.es/c/a0551bc57) [§](https://postgr.es/c/d4e8c37cc) + + `pg_prewarm()` requires `SELECT` privilege on relations to be prewarmed. However, since indexes have no SQL privileges of their own, this resulted in non-superusers being unable to prewarm indexes. Instead, check for `SELECT` privilege on the index's table. +* Make `contrib/pgstattuple` more robust about empty or invalid index pages (Nitin Motiani) [§](https://postgr.es/c/036decbba) + + Count all-zero pages as free space, and ignore pages that are invalid according to a check of the page's special-space size. The code for btree indexes already counted all-zero pages as free, but the hash and gist code would error out, which has been found to be much less user-friendly. Similarly, make all three cases agree on ignoring corrupted pages rather than throwing errors. +* Harden our read and write barrier macros to satisfy Clang (Thomas Munro) [§](https://postgr.es/c/03d9140cb) + + We supposed that `__atomic_thread_fence()` is a sufficient barrier to prevent the C compiler from re-ordering memory accesses around it, but it appears that that's not true for Clang, allowing it to generate incorrect code for at least RISC-V, MIPS, and LoongArch machines. Add explicit compiler barriers to fix that. +* Fix building with LLVM version 21 and later (Holger Hoffstätte) [§](https://postgr.es/c/755f01ad7) +* When building with meson, apply the same special optimization flags for `numeric.c` and `checksum.c` as the makefile build does (Nathan Bossart, Jeff Davis) [§](https://postgr.es/c/15f9eeef6) [§](https://postgr.es/c/e25453a36) + + Use `-ftree-vectorize` for both files, as well as `-funroll-loops` for `checksum.c`, to match what the makefiles have long done. +* Fix PGXS build infrastructure to support building NLS `po` files for extensions (Ryo Matsumura) [§](https://postgr.es/c/a8933194e) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release.html "Appendix E. Release Notes") | [Up](release.html "Appendix E. Release Notes") | [Next](release-17-6.html "E.2. Release 17.6") | +| Appendix E. Release Notes | [Home](index.html "PostgreSQL 17.7 Documentation") | E.2. Release 17.6 | + +[Previous](/docs/release/17.6/) + +[Return to the Release Notes Archive](/docs/release/) diff --git a/corpus/changelog/postgresql_releases/postgresql_180.md b/corpus/changelog/postgresql_releases/postgresql_180.md new file mode 100644 index 0000000000000000000000000000000000000000..8ea5712f6d3b70f27107956880e4ec8477d6f1c7 --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_180.md @@ -0,0 +1,1071 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/18.0/ +Version: 18.0 + +## PostgreSQL 18.0 + +| E.2. Release 18 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release-18-1.html "E.1. Release 18.1") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 18.1 Documentation") | [Next](release-prior.html "E.3. Prior Releases") | + +--- + +## E.2. Release 18 [#](#RELEASE-18) + +[E.2.1. Overview](release-18.html#RELEASE-18-HIGHLIGHTS) + +[E.2.2. Migration to Version 18](release-18.html#RELEASE-18-MIGRATION) + +[E.2.3. Changes](release-18.html#RELEASE-18-CHANGES) + +[E.2.4. Acknowledgments](release-18.html#RELEASE-18-ACKNOWLEDGEMENTS) + +**Release date:**2025-09-25 + +### E.2.1. Overview [#](#RELEASE-18-HIGHLIGHTS) + +PostgreSQL 18 contains many new features and enhancements, including: + +* An asynchronous I/O (AIO) subsystem that can improve performance of sequential scans, bitmap heap scans, vacuums, and other operations. +* [pg\_upgrade](pgupgrade.html "pg_upgrade") now retains optimizer statistics. +* Support for "skip scan" lookups that allow using [multicolumn B-tree indexes](indexes-multicolumn.html "11.3. Multicolumn Indexes") in more cases. +* [`uuidv7()`](functions-uuid.html#FUNC_UUID_GEN_TABLE "Table 9.45. UUID Generation Functions") function for generating timestamp-ordered [UUIDs](datatype-uuid.html "8.12. UUID Type"). +* Virtual [generated columns](sql-createtable.html#SQL-CREATETABLE-PARMS-GENERATED-STORED) that compute their values during read operations. This is now the default for generated columns. +* [OAuth authentication](auth-oauth.html "20.15. OAuth Authorization/Authentication") support. +* `OLD` and `NEW` support for [`RETURNING`](dml-returning.html "6.4. Returning Data from Modified Rows") clauses in [INSERT](sql-insert.html "INSERT"), [UPDATE](sql-update.html "UPDATE"), [DELETE](sql-delete.html "DELETE"), and [MERGE](sql-merge.html "MERGE") commands. +* Temporal constraints, or constraints over ranges, for [PRIMARY KEY](sql-createtable.html#SQL-CREATETABLE-PARMS-PRIMARY-KEY), [UNIQUE](sql-createtable.html#SQL-CREATETABLE-PARMS-UNIQUE), and [FOREIGN KEY](sql-createtable.html#SQL-CREATETABLE-PARMS-REFERENCES) constraints. + +The above items and other new features of PostgreSQL 18 are explained in more detail in the sections below. + +### E.2.2. Migration to Version 18 [#](#RELEASE-18-MIGRATION) + +A dump/restore using [pg\_dumpall](app-pg-dumpall.html "pg_dumpall") or use of [pg\_upgrade](pgupgrade.html "pg_upgrade") or logical replication is required for those wishing to migrate data from any previous release. See [Section 18.6](upgrading.html "18.6. Upgrading a PostgreSQL Cluster") for general information on migrating to new major releases. + +Version 18 contains a number of changes that may affect compatibility with previous releases. Observe the following incompatibilities: + +* Change [initdb](app-initdb.html "initdb") default to enable data checksums (Greg Sabino Mullane) [§](https://postgr.es/c/04bec894a04) + + Checksums can be disabled with the new initdb option `--no-data-checksums`. [pg\_upgrade](pgupgrade.html "pg_upgrade") requires matching cluster checksum settings, so this new option can be useful to upgrade non-checksum old clusters. +* Change time zone abbreviation handling (Tom Lane) [§](https://postgr.es/c/d7674c9fa) + + The system will now favor the current session's time zone abbreviations before checking the server variable [timezone\_abbreviations](runtime-config-client.html#GUC-TIMEZONE-ABBREVIATIONS). Previously `timezone_abbreviations` was checked first. +* Deprecate [MD5 password](auth-password.html "20.5. Password Authentication") authentication (Nathan Bossart) [§](https://postgr.es/c/db6a4a985) + + Support for MD5 passwords will be removed in a future major version release. [CREATE ROLE](sql-createrole.html "CREATE ROLE") and [ALTER ROLE](sql-alterrole.html "ALTER ROLE") now emit deprecation warnings when setting MD5 passwords. These warnings can be disabled by setting the [md5\_password\_warnings](runtime-config-connection.html#GUC-MD5-PASSWORD-WARNINGS) parameter to `off`. +* Change [VACUUM](sql-vacuum.html "VACUUM") and [ANALYZE](sql-analyze.html "ANALYZE") to process the inheritance children of a parent (Michael Harris) [§](https://postgr.es/c/62ddf7ee9) + + The previous behavior can be performed by using the new `ONLY` option. +* Prevent [`COPY FROM`](sql-copy.html "COPY") from treating `\.` as an end-of-file marker when reading CSV files (Daniel Vérité, Tom Lane) [§](https://postgr.es/c/770233748) [§](https://postgr.es/c/da8a4c166) + + [psql](app-psql.html "psql") will still treat `\.` as an end-of-file marker when reading CSV files from `STDIN`. Older psql clients connecting to PostgreSQL 18 servers might experience [`\copy`](app-psql.html#APP-PSQL-META-COMMANDS-COPY) problems. This release also enforces that `\.` must appear alone on a line. +* Disallow unlogged partitioned tables (Michael Paquier) [§](https://postgr.es/c/e2bab2d79) + + Previously [`ALTER TABLE SET [UN]LOGGED`](sql-altertable.html "ALTER TABLE") did nothing, and the creation of an unlogged partitioned table did not cause its children to be unlogged. +* Execute `AFTER` [triggers](triggers.html "Chapter 37. Triggers") as the role that was active when trigger events were queued (Laurenz Albe) [§](https://postgr.es/c/01463e1cc) + + Previously such triggers were run as the role that was active at trigger execution time (e.g., at [COMMIT](sql-commit.html "COMMIT")). This is significant for cases where the role is changed between queue time and transaction commit. +* Remove non-functional support for rule privileges in [GRANT](sql-grant.html "GRANT")/[REVOKE](sql-revoke.html "REVOKE") (Fujii Masao) [§](https://postgr.es/c/fefa76f70) + + These have been non-functional since PostgreSQL 8.2. +* Remove column [`pg_backend_memory_contexts`](view-pg-backend-memory-contexts.html "53.5. pg_backend_memory_contexts").`parent` (Melih Mutlu) [§](https://postgr.es/c/f0d112759) + + This is no longer needed since `pg_backend_memory_contexts`.`path` was added. +* Change `pg_backend_memory_contexts`.`level` and [`pg_log_backend_memory_contexts()`](functions-admin.html#FUNCTIONS-ADMIN-SIGNAL-TABLE "Table 9.96. Server Signaling Functions") to be one-based (Melih Mutlu, Atsushi Torikoshi, David Rowley, Fujii Masao) [§](https://postgr.es/c/32d3ed816) [§](https://postgr.es/c/d9e03864b) [§](https://postgr.es/c/706cbed35) + + These were previously zero-based. +* Change [full text search](textsearch.html "Chapter 12. Full Text Search") to use the default collation provider of the cluster to read configuration files and dictionaries, rather than always using libc (Peter Eisentraut) [§](https://postgr.es/c/fb1a18810f0) + + Clusters that default to non-libc collation providers (e.g., ICU, builtin) that behave differently than libc for characters processed by LC\_CTYPE could observe changes in behavior of some full-text search functions, as well as the [pg\_trgm](pgtrgm.html "F.35. pg_trgm — support for similarity of text using trigram matching") extension. When upgrading such clusters using [pg\_upgrade](pgupgrade.html "pg_upgrade"), it is recommended to reindex all indexes related to full-text search and pg\_trgm after the upgrade. + +### E.2.3. Changes [#](#RELEASE-18-CHANGES) + +Below you will find a detailed account of the changes between PostgreSQL 18 and the previous major release. + +#### E.2.3.1. Server [#](#RELEASE-18-SERVER) + +##### E.2.3.1.1. Optimizer [#](#RELEASE-18-OPTIMIZER) + +* Automatically remove some unnecessary table self-joins (Andrey Lepikhov, Alexander Kuzmenkov, Alexander Korotkov, Alena Rybakina) [§](https://postgr.es/c/fc069a3a6) + + This optimization can be disabled using server variable [enable\_self\_join\_elimination](runtime-config-query.html#GUC-ENABLE-SELF-JOIN-ELIMINATION). +* Convert some [`IN (VALUES ...)`](functions-comparisons.html#FUNCTIONS-COMPARISONS-IN-SCALAR "9.25.1. IN") to `x = ANY ...` for better optimizer statistics (Alena Rybakina, Andrei Lepikhov) [§](https://postgr.es/c/c0962a113) +* Allow transforming [`OR`](functions-logical.html "9.1. Logical Operators")-clauses to arrays for faster index processing (Alexander Korotkov, Andrey Lepikhov) [§](https://postgr.es/c/ae4569161) +* Speed up the processing of [`INTERSECT`](sql-select.html#SQL-INTERSECT "INTERSECT Clause"), [`EXCEPT`](sql-select.html#SQL-EXCEPT "EXCEPT Clause"), [window aggregates](tutorial-window.html "3.5. Window Functions"), and [view column aliases](sql-createview.html "CREATE VIEW") (Tom Lane, David Rowley) [§](https://postgr.es/c/52c707483) [§](https://postgr.es/c/276279295) [§](https://postgr.es/c/8d96f57d5) [§](https://postgr.es/c/908a96861) +* Allow the keys of [`SELECT DISTINCT`](sql-select.html#SQL-DISTINCT "DISTINCT Clause") to be internally reordered to avoid sorting (Richard Guo) [§](https://postgr.es/c/a8ccf4e93) + + This optimization can be disabled using [enable\_distinct\_reordering](runtime-config-query.html#GUC-ENABLE-DISTINCT-REORDERING). +* Ignore [`GROUP BY`](sql-select.html#SQL-GROUPBY "GROUP BY Clause") columns that are functionally dependent on other columns (Zhang Mingli, Jian He, David Rowley) [§](https://postgr.es/c/bd10ec529) + + If a `GROUP BY` clause includes all columns of a unique index, as well as other columns of the same table, those other columns are redundant and can be dropped from the grouping. This was already true for non-deferred primary keys. +* Allow some [`HAVING`](sql-select.html#SQL-HAVING "HAVING Clause") clauses on [`GROUPING SETS`](queries-table-expressions.html#QUERIES-GROUPING-SETS "7.2.4. GROUPING SETS, CUBE, and ROLLUP") to be pushed to [`WHERE`](sql-select.html#SQL-WHERE "WHERE Clause") clauses (Richard Guo) [§](https://postgr.es/c/67a54b9e8) [§](https://postgr.es/c/247dea89f) [§](https://postgr.es/c/f5050f795) [§](https://postgr.es/c/cc5d98525) + + This allows earlier row filtering. This release also fixes some `GROUPING SETS` queries that used to return incorrect results. +* Improve row estimates for [`generate_series()`](functions-srf.html#FUNCTIONS-SRF-SERIES "Table 9.69. Series Generating Functions") using [`numeric`](datatype-numeric.html "8.1. Numeric Types") and [`timestamp`](datatype-datetime.html "8.5. Date/Time Types") values (David Rowley, Song Jinzhou) [§](https://postgr.es/c/036bdcec9) [§](https://postgr.es/c/97173536e) +* Allow the optimizer to use `Right Semi Join` plans (Richard Guo) [§](https://postgr.es/c/aa86129e1) + + Semi-joins are used when needing to find if there is at least one match. +* Allow merge joins to use [incremental sorts](runtime-config-query.html#GUC-ENABLE-INCREMENTAL-SORT) (Richard Guo) [§](https://postgr.es/c/828e94c9d) +* Improve the efficiency of planning queries accessing many partitions (Ashutosh Bapat, Yuya Watari, David Rowley) [§](https://postgr.es/c/88f55bc97) [§](https://postgr.es/c/d69d45a5a) +* Allow [partitionwise joins](runtime-config-query.html#GUC-ENABLE-PARTITIONWISE-JOIN) in more cases, and reduce its memory usage (Richard Guo, Tom Lane, Ashutosh Bapat) [§](https://postgr.es/c/9b282a935) [§](https://postgr.es/c/513f4472a) +* Improve cost estimates of partition queries (Nikita Malakhov, Andrei Lepikhov) [§](https://postgr.es/c/fae535da0) +* Improve [SQL-language function](xfunc-sql.html "36.5. Query Language (SQL) Functions") plan caching (Alexander Pyhalov, Tom Lane) [§](https://postgr.es/c/0dca5d68d) [§](https://postgr.es/c/09b07c295) +* Improve handling of disabled optimizer features (Robert Haas) [§](https://postgr.es/c/e22253467) + +##### E.2.3.1.2. Indexes [#](#RELEASE-18-INDEXES) + +* Allow skip scans of [btree](xfunc-sql.html "36.5. Query Language (SQL) Functions") indexes (Peter Geoghegan) [§](https://postgr.es/c/92fe23d93) [§](https://postgr.es/c/8a510275d) + + This allows multi-column btree indexes to be used in more cases such as when there are no restrictions on the first or early indexed columns (or there are non-equality ones), and there are useful restrictions on later indexed columns. +* Allow non-btree unique indexes to be used as partition keys and in materialized views (Mark Dilger) [§](https://postgr.es/c/f278e1fe3) [§](https://postgr.es/c/9d6db8bec) + + The index type must still support equality. +* Allow [`GIN`](gin.html "65.4. GIN Indexes") indexes to be created in parallel (Tomas Vondra, Matthias van de Meent) [§](https://postgr.es/c/8492feb98) +* Allow values to be sorted to speed range-type [GiST](gist.html "65.2. GiST Indexes") and [btree](btree.html "65.1. B-Tree Indexes") index builds (Bernd Helmle) [§](https://postgr.es/c/e9e7b6604) + +##### E.2.3.1.3. General Performance [#](#RELEASE-18-PERFORMANCE) + +* Add an asynchronous I/O subsystem (Andres Freund, Thomas Munro, Nazir Bilal Yavuz, Melanie Plageman) [§](https://postgr.es/c/02844012b) [§](https://postgr.es/c/da7226993) [§](https://postgr.es/c/55b454d0e) [§](https://postgr.es/c/247ce06b8) [§](https://postgr.es/c/10f664684) [§](https://postgr.es/c/06fb5612c) [§](https://postgr.es/c/c325a7633) [§](https://postgr.es/c/50cb7505b) [§](https://postgr.es/c/047cba7fa) [§](https://postgr.es/c/12ce89fd0) [§](https://postgr.es/c/2a5e709e7) + + This feature allows backends to queue multiple read requests, which allows for more efficient sequential scans, bitmap heap scans, vacuums, etc. This is enabled by server variable [io\_method](runtime-config-resource.html#GUC-IO-METHOD), with server variables [io\_combine\_limit](runtime-config-resource.html#GUC-IO-COMBINE-LIMIT) and [io\_max\_combine\_limit](runtime-config-resource.html#GUC-IO-MAX-COMBINE-LIMIT) added to control it. This also enables [effective\_io\_concurrency](runtime-config-resource.html#GUC-EFFECTIVE-IO-CONCURRENCY) and [maintenance\_io\_concurrency](runtime-config-resource.html#GUC-MAINTENANCE-IO-CONCURRENCY) values greater than zero for systems without `fadvise()` support. The new system view [`pg_aios`](view-pg-aios.html "53.2. pg_aios") shows the file handles being used for asynchronous I/O. +* Improve the locking performance of queries that access many relations (Tomas Vondra) [§](https://postgr.es/c/c4d5cb71d) +* Improve the performance and reduce memory usage of hash joins and [`GROUP BY`](sql-select.html#SQL-GROUPBY "GROUP BY Clause") (David Rowley, Jeff Davis) [§](https://postgr.es/c/adf97c156) [§](https://postgr.es/c/0f5738202) [§](https://postgr.es/c/4d143509c) [§](https://postgr.es/c/a0942f441) [§](https://postgr.es/c/626df47ad) + + This also improves hash set operations used by [`EXCEPT`](sql-select.html#SQL-EXCEPT "EXCEPT Clause"), and hash lookups of subplan values. +* Allow normal vacuums to freeze some pages, even though they are all-visible (Melanie Plageman) [§](https://postgr.es/c/052026c9b) [§](https://postgr.es/c/06eae9e62) + + This reduces the overhead of later full-relation freezing. The aggressiveness of this can be controlled by server variable and per-table setting [vacuum\_max\_eager\_freeze\_failure\_rate](runtime-config-vacuum.html#GUC-VACUUM-MAX-EAGER-FREEZE-FAILURE-RATE). Previously vacuum never processed all-visible pages until freezing was required. +* Add server variable [vacuum\_truncate](runtime-config-vacuum.html#GUC-VACUUM-TRUNCATE) to control file truncation during [VACUUM](sql-vacuum.html "VACUUM") (Nathan Bossart, Gurjeet Singh) [§](https://postgr.es/c/0164a0f9e) + + A storage-level parameter with the same name and behavior already existed. +* Increase server variables [effective\_io\_concurrency](runtime-config-resource.html#GUC-EFFECTIVE-IO-CONCURRENCY)'s and [maintenance\_io\_concurrency](runtime-config-resource.html#GUC-MAINTENANCE-IO-CONCURRENCY)'s default values to 16 (Melanie Plageman) [§](https://postgr.es/c/ff79b5b2a) [§](https://postgr.es/c/cc6be07eb) + + This more accurately reflects modern hardware. + +##### E.2.3.1.4. Monitoring [#](#RELEASE-18-MONITORING) + +* Increase the logging granularity of server variable [log\_connections](runtime-config-logging.html#GUC-LOG-CONNECTIONS) (Melanie Plageman) [§](https://postgr.es/c/9219093ca) + + This server variable was previously only boolean, which is still supported. +* Add `log_connections` option to report the duration of connection stages (Melanie Plageman) [§](https://postgr.es/c/18cd15e70) +* Add [log\_line\_prefix](runtime-config-logging.html#GUC-LOG-LINE-PREFIX) escape `%L` to output the client IP address (Greg Sabino Mullane) [§](https://postgr.es/c/3516ea768) +* Add server variable [log\_lock\_failures](runtime-config-logging.html#GUC-LOG-LOCK-FAILURES) to log lock acquisition failures (Yuki Seino, Fujii Masao) [§](https://postgr.es/c/6d376c3b0) [§](https://postgr.es/c/73bdcfab3) + + Specifically it reports [`SELECT ... NOWAIT`](sql-select.html#SQL-FOR-UPDATE-SHARE "The Locking Clause") lock failures. +* Modify [`pg_stat_all_tables`](monitoring-stats.html#MONITORING-PG-STAT-ALL-TABLES-VIEW "27.2.19. pg_stat_all_tables") and its variants to report the time spent in [VACUUM](sql-vacuum.html "VACUUM"), [ANALYZE](sql-analyze.html "ANALYZE"), and their [automatic](routine-vacuuming.html#AUTOVACUUM "24.1.6. The Autovacuum Daemon") variants (Sami Imseih) [§](https://postgr.es/c/30a6ed0ce) + + The new columns are `total_vacuum_time`, `total_autovacuum_time`, `total_analyze_time`, and `total_autoanalyze_time`. +* Add delay time reporting to [VACUUM](sql-vacuum.html "VACUUM") and [ANALYZE](sql-analyze.html "ANALYZE") (Bertrand Drouvot, Nathan Bossart) [§](https://postgr.es/c/bb8dff999) [§](https://postgr.es/c/7720082ae) + + This information appears in the server log, the system views [`pg_stat_progress_vacuum`](progress-reporting.html#VACUUM-PROGRESS-REPORTING "27.4.5. VACUUM Progress Reporting") and [`pg_stat_progress_analyze`](progress-reporting.html#PG-STAT-PROGRESS-ANALYZE-VIEW "Table 27.38. pg_stat_progress_analyze View"), and the output of [VACUUM](sql-vacuum.html "VACUUM") and [ANALYZE](sql-analyze.html "ANALYZE") when in `VERBOSE` mode; tracking must be enabled with the server variable [track\_cost\_delay\_timing](runtime-config-statistics.html#GUC-TRACK-COST-DELAY-TIMING). +* Add WAL, CPU, and average read statistics output to `ANALYZE VERBOSE` (Anthonin Bonnefoy) [§](https://postgr.es/c/4c1b4cdb8) [§](https://postgr.es/c/bb7775234) +* Add full WAL buffer count to `VACUUM`/`ANALYZE (VERBOSE)` and autovacuum log output (Bertrand Drouvot) [§](https://postgr.es/c/6a8a7ce47) +* Add per-backend I/O statistics reporting (Bertrand Drouvot) [§](https://postgr.es/c/9aea73fc6) [§](https://postgr.es/c/3f1db99bf) + + The statistics are accessed via [`pg_stat_get_backend_io()`](monitoring-stats.html#PG-STAT-GET-BACKEND-IO). Per-backend I/O statistics can be cleared via [`pg_stat_reset_backend_stats()`](monitoring-stats.html#MONITORING-STATS-FUNCS-TABLE "Table 27.36. Additional Statistics Functions"). +* Add [`pg_stat_io`](monitoring-stats.html#MONITORING-PG-STAT-IO-VIEW "27.2.13. pg_stat_io") columns to report I/O activity in bytes (Nazir Bilal Yavuz) [§](https://postgr.es/c/f92c854cf) + + The new columns are `read_bytes`, `write_bytes`, and `extend_bytes`. The `op_bytes` column, which always equaled [`BLCKSZ`](runtime-config-preset.html#GUC-BLOCK-SIZE), has been removed. +* Add WAL I/O activity rows to `pg_stat_io` (Nazir Bilal Yavuz, Bertrand Drouvot, Michael Paquier) [§](https://postgr.es/c/a051e71e2) [§](https://postgr.es/c/4538bd3f1) [§](https://postgr.es/c/7f7f324eb) + + This includes WAL receiver activity and a wait event for such writes. +* Change server variable [track\_wal\_io\_timing](runtime-config-statistics.html#GUC-TRACK-WAL-IO-TIMING) to control tracking WAL timing in `pg_stat_io` instead of [`pg_stat_wal`](monitoring-stats.html#PG-STAT-WAL-VIEW "Table 27.26. pg_stat_wal View") (Bertrand Drouvot) [§](https://postgr.es/c/6c349d83b) +* Remove read/sync columns from `pg_stat_wal` (Bertrand Drouvot) [§](https://postgr.es/c/2421e9a51) [§](https://postgr.es/c/6c349d83b) + + This removes columns `wal_write`, `wal_sync`, `wal_write_time`, and `wal_sync_time`. +* Add function [`pg_stat_get_backend_wal()`](monitoring-stats.html#PG-STAT-GET-BACKEND-WAL) to return per-backend WAL statistics (Bertrand Drouvot) [§](https://postgr.es/c/76def4cdd) + + Per-backend WAL statistics can be cleared via [`pg_stat_reset_backend_stats()`](monitoring-stats.html#MONITORING-STATS-FUNCS-TABLE "Table 27.36. Additional Statistics Functions"). +* Add function [`pg_ls_summariesdir()`](functions-admin.html#FUNCTIONS-ADMIN-GENFILE-TABLE "Table 9.108. Generic File Access Functions") to specifically list the contents of [`PGDATA`](storage-file-layout.html "66.1. Database File Layout")/[`pg_wal/summaries`](runtime-config-wal.html#GUC-WAL-SUMMARY-KEEP-TIME) (Yushi Ogiwara) [§](https://postgr.es/c/4e1fad378) +* Add column [`pg_stat_checkpointer`](monitoring-stats.html#MONITORING-PG-STAT-CHECKPOINTER-VIEW "27.2.15. pg_stat_checkpointer").`num_done` to report the number of completed checkpoints (Anton A. Melnikov) [§](https://postgr.es/c/559efce1d) + + Columns `num_timed` and `num_requested` count both completed and skipped checkpoints. +* Add column `pg_stat_checkpointer`.`slru_written` to report SLRU buffers written (Nitin Jadhav) [§](https://postgr.es/c/17cc5f666) + + Also, modify the checkpoint server log message to report separate shared buffer and SLRU buffer values. +* Add columns to [`pg_stat_database`](monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW "27.2.17. pg_stat_database") to report parallel worker activity (Benoit Lobréau) [§](https://postgr.es/c/e7a9496de) + + The new columns are `parallel_workers_to_launch` and `parallel_workers_launched`. +* Have [query id](runtime-config-statistics.html#GUC-COMPUTE-QUERY-ID) computation of constant lists consider only the first and last constants (Dmitry Dolgov, Sami Imseih) [§](https://postgr.es/c/62d712ecf) [§](https://postgr.es/c/9fbd53dea) [§](https://postgr.es/c/c2da1a5d6) + + Jumbling is used by [pg\_stat\_statements](pgstatstatements.html "F.32. pg_stat_statements — track statistics of SQL planning and execution"). +* Adjust query id computations to group together queries using the same relation name (Michael Paquier, Sami Imseih) [§](https://postgr.es/c/787514b30) + + This is true even if the tables in different schemas have different column names. +* Add column [`pg_backend_memory_contexts`](view-pg-backend-memory-contexts.html "53.5. pg_backend_memory_contexts").`type` to report the type of memory context (David Rowley) [§](https://postgr.es/c/12227a1d5) +* Add column `pg_backend_memory_contexts`.`path` to show memory context parents (Melih Mutlu) [§](https://postgr.es/c/32d3ed816) + +##### E.2.3.1.5. Privileges [#](#RELEASE-18-PRIVILEGES) + +* Add function [`pg_get_acl()`](functions-info.html#FUNCTIONS-INFO-OBJECT-TABLE "Table 9.81. Object Information and Addressing Functions") to retrieve database access control details (Joel Jacobson) [§](https://postgr.es/c/4564f1ceb) [§](https://postgr.es/c/d898665bf) +* Add function [`has_largeobject_privilege()`](functions-info.html#FUNCTIONS-INFO-ACCESS-TABLE "Table 9.72. Access Privilege Inquiry Functions") to check large object privileges (Yugo Nagata) [§](https://postgr.es/c/4eada203a) +* Allow [ALTER DEFAULT PRIVILEGES](sql-alterdefaultprivileges.html "ALTER DEFAULT PRIVILEGES") to define large object default privileges (Takatsuka Haruka, Yugo Nagata, Laurenz Albe) [§](https://postgr.es/c/0d6c47766) +* Add predefined role [`pg_signal_autovacuum_worker`](predefined-roles.html "21.5. Predefined Roles") (Kirill Reshke) [§](https://postgr.es/c/ccd38024b) + + This allows sending signals to autovacuum workers. + +##### E.2.3.1.6. Server Configuration [#](#RELEASE-18-SERVER-CONFIG) + +* Add support for the [OAuth authentication method](auth-oauth.html "20.15. OAuth Authorization/Authentication") (Jacob Champion, Daniel Gustafsson, Thomas Munro) [§](https://postgr.es/c/b3f0be788) + + This adds an `oauth` authentication method to [`pg_hba.conf`](auth-pg-hba-conf.html "20.1. The pg_hba.conf File"), libpq OAuth options, a server variable [oauth\_validator\_libraries](runtime-config-connection.html#GUC-OAUTH-VALIDATOR-LIBRARIES) to load token validation libraries, and a configure flag [`--with-libcurl`](install-make.html#CONFIGURE-OPTION-WITH-LIBCURL) to add the required compile-time libraries. +* Add server variable [ssl\_tls13\_ciphers](runtime-config-connection.html#GUC-SSL-TLS13-CIPHERS) to allow specification of multiple colon-separated TLSv1.3 cipher suites (Erica Zhang, Daniel Gustafsson) [§](https://postgr.es/c/45188c2ea) +* Change server variable [ssl\_groups](runtime-config-connection.html#GUC-SSL-GROUPS)'s default to include elliptic curve X25519 (Daniel Gustafsson, Jacob Champion) [§](https://postgr.es/c/daa02c6bd) +* Rename server variable `ssl_ecdh_curve` to [ssl\_groups](runtime-config-connection.html#GUC-SSL-GROUPS) and allow multiple colon-separated ECDH curves to be specified (Erica Zhang, Daniel Gustafsson) [§](https://postgr.es/c/3d1ef3a15) + + The previous name still works. +* Make [cancel request keys](functions-admin.html#FUNCTIONS-ADMIN-SIGNAL-TABLE "Table 9.96. Server Signaling Functions") 256 bits (Heikki Linnakangas, Jelte Fennema-Nio) [§](https://postgr.es/c/a460251f0) [§](https://postgr.es/c/9d9b9d46f) + + This is only possible when the server and client support wire protocol version 3.2, introduced in this release. +* Add server variable [autovacuum\_worker\_slots](runtime-config-vacuum.html#GUC-AUTOVACUUM-WORKER-SLOTS) to specify the maximum number of background workers (Nathan Bossart) [§](https://postgr.es/c/c758119e5) + + With this variable set, [autovacuum\_max\_workers](runtime-config-vacuum.html#GUC-AUTOVACUUM-MAX-WORKERS) can be adjusted at runtime up to this maximum without a server restart. +* Allow specification of the fixed number of dead tuples that will trigger an [autovacuum](routine-vacuuming.html#AUTOVACUUM "24.1.6. The Autovacuum Daemon") (Nathan Bossart, Frédéric Yhuel) [§](https://postgr.es/c/306dc520b) + + The server variable is [autovacuum\_vacuum\_max\_threshold](runtime-config-vacuum.html#GUC-AUTOVACUUM-VACUUM-MAX-THRESHOLD). Percentages are still used for triggering. +* Change server variable [max\_files\_per\_process](runtime-config-resource.html#GUC-MAX-FILES-PER-PROCESS) to limit only files opened by a backend (Andres Freund) [§](https://postgr.es/c/adb5f85fa) + + Previously files opened by the postmaster were also counted toward this limit. +* Add server variable [num\_os\_semaphores](runtime-config-preset.html#GUC-NUM-OS-SEMAPHORES) to report the required number of semaphores (Nathan Bossart) [§](https://postgr.es/c/0dcaea569) + + This is useful for operating system configuration. +* Add server variable [extension\_control\_path](runtime-config-client.html#GUC-EXTENSION-CONTROL-PATH) to specify the location of extension control files (Peter Eisentraut, Matheus Alcantara) [§](https://postgr.es/c/4f7f7b037) [§](https://postgr.es/c/81eaaa2c4) + +##### E.2.3.1.7. Streaming Replication and Recovery [#](#RELEASE-18-REPLICATION) + +* Allow inactive replication slots to be automatically invalidated using server variable [idle\_replication\_slot\_timeout](runtime-config-replication.html#GUC-IDLE-REPLICATION-SLOT-TIMEOUT) (Nisha Moond, Bharath Rupireddy) [§](https://postgr.es/c/ac0e33136) +* Add server variable [max\_active\_replication\_origins](runtime-config-replication.html#GUC-MAX-ACTIVE-REPLICATION-ORIGINS) to control the maximum active replication origins (Euler Taveira) [§](https://postgr.es/c/04ff636cb) + + This was previously controlled by [max\_replication\_slots](runtime-config-replication.html#GUC-MAX-REPLICATION-SLOTS), but this new setting allows a higher origin count in cases where fewer slots are required. + +##### E.2.3.1.8. [Logical Replication](logical-replication.html "Chapter 29. Logical Replication") [#](#RELEASE-18-LOGICAL) + +* Allow the values of [generated columns](sql-createtable.html#SQL-CREATETABLE-PARMS-GENERATED-STORED) to be logically replicated (Shubham Khanna, Vignesh C, Zhijie Hou, Shlok Kyal, Peter Smith) [§](https://postgr.es/c/745217a05) [§](https://postgr.es/c/7054186c4) [§](https://postgr.es/c/87ce27de6) [§](https://postgr.es/c/6252b1eaf) + + If the publication specifies a column list, all specified columns, generated and non-generated, are published. Without a specified column list, publication option `publish_generated_columns` controls whether generated columns are published. Previously generated columns were not replicated and the subscriber had to compute the values if possible; this is particularly useful for non-PostgreSQL subscribers which lack such a capability. +* Change the default [CREATE SUBSCRIPTION](sql-createsubscription.html "CREATE SUBSCRIPTION") streaming option from `off` to `parallel` (Vignesh C) [§](https://postgr.es/c/1bf1140be) +* Allow [ALTER SUBSCRIPTION](sql-altersubscription.html "ALTER SUBSCRIPTION") to change the replication slot's two-phase commit behavior (Hayato Kuroda, Ajin Cherian, Amit Kapila, Zhijie Hou) [§](https://postgr.es/c/1462aad2e) [§](https://postgr.es/c/4868c96bc) +* Log [conflicts](hot-standby.html#HOT-STANDBY-CONFLICT "26.4.2. Handling Query Conflicts") while applying logical replication changes (Zhijie Hou, Nisha Moond) [§](https://postgr.es/c/9758174e2) [§](https://postgr.es/c/edcb71258) [§](https://postgr.es/c/640178c92) [§](https://postgr.es/c/6c2b5edec) [§](https://postgr.es/c/73eba5004) + + Also report in new columns of [`pg_stat_subscription_stats`](monitoring-stats.html#MONITORING-PG-STAT-SUBSCRIPTION-STATS "27.2.9. pg_stat_subscription_stats"). + +#### E.2.3.2. Utility Commands [#](#RELEASE-18-UTILITY) + +* Allow [generated columns](sql-createtable.html#SQL-CREATETABLE-PARMS-GENERATED-STORED) to be virtual, and make them the default (Peter Eisentraut, Jian He, Richard Guo, Dean Rasheed) [§](https://postgr.es/c/83ea6c540) [§](https://postgr.es/c/cdc168ad4) [§](https://postgr.es/c/1e4351af3) + + Virtual generated columns generate their values when the columns are read, not written. The write behavior can still be specified via the `STORED` option. +* Add `OLD`/`NEW` support to [`RETURNING`](dml-returning.html "6.4. Returning Data from Modified Rows") in DML queries (Dean Rasheed) [§](https://postgr.es/c/80feb727c) + + Previously `RETURNING` only returned new values for [INSERT](sql-insert.html "INSERT") and [UPDATE](sql-update.html "UPDATE"), and old values for [DELETE](sql-delete.html "DELETE"); [MERGE](sql-merge.html "MERGE") would return the appropriate value for the internal query executed. This new syntax allows the `RETURNING` list of `INSERT`/`UPDATE`/`DELETE`/`MERGE` to explicitly return old and new values by using the special aliases `old` and `new`. These aliases can be renamed to avoid identifier conflicts. +* Allow foreign tables to be created like existing local tables (Zhang Mingli) [§](https://postgr.es/c/302cf1575) + + The syntax is [`CREATE FOREIGN TABLE ... LIKE`](sql-createforeigntable.html "CREATE FOREIGN TABLE"). +* Allow [`LIKE`](functions-matching.html#FUNCTIONS-LIKE "9.7.1. LIKE") with [nondeterministic collations](collation.html#COLLATION-NONDETERMINISTIC "23.2.2.4. Nondeterministic Collations") (Peter Eisentraut) [§](https://postgr.es/c/85b7efa1c) +* Allow text position search functions with nondeterministic collations (Peter Eisentraut) [§](https://postgr.es/c/329304c90) + + These used to generate an error. +* Add builtin collation provider [`PG_UNICODE_FAST`](locale.html#LOCALE-PROVIDERS "23.1.4. Locale Providers") (Jeff Davis) [§](https://postgr.es/c/d3d098316) + + This locale supports case mapping, but sorts in code point order, not natural language order. +* Allow [VACUUM](sql-vacuum.html "VACUUM") and [ANALYZE](sql-analyze.html "ANALYZE") to process partitioned tables without processing their children (Michael Harris) [§](https://postgr.es/c/62ddf7ee9) + + This is enabled with the new `ONLY` option. This is useful since autovacuum does not process partitioned tables, just its children. +* Add functions to modify per-relation and per-column optimizer statistics (Corey Huinker) [§](https://postgr.es/c/e839c8ecc) [§](https://postgr.es/c/d32d14639) [§](https://postgr.es/c/650ab8aaf) + + The functions are [`pg_restore_relation_stats()`](functions-admin.html#FUNCTIONS-ADMIN-STATSMOD "Table 9.105. Database Object Statistics Manipulation Functions"), `pg_restore_attribute_stats()`, `pg_clear_relation_stats()`, and `pg_clear_attribute_stats()`. +* Add server variable [file\_copy\_method](runtime-config-resource.html#GUC-FILE-COPY-METHOD) to control the file copying method (Nazir Bilal Yavuz) [§](https://postgr.es/c/f78ca6f3e) + + This controls whether [`CREATE DATABASE ... STRATEGY=FILE_COPY`](sql-createdatabase.html "CREATE DATABASE") and [`ALTER DATABASE ... SET TABLESPACE`](sql-alterdatabase.html "ALTER DATABASE") uses file copy or clone. + +##### E.2.3.2.1. [Constraints](ddl-constraints.html "5.5. Constraints") [#](#RELEASE-18-CONSTRAINTS) + +* Allow the specification of non-overlapping [`PRIMARY KEY`](sql-createtable.html#SQL-CREATETABLE-PARMS-PRIMARY-KEY), [`UNIQUE`](sql-createtable.html#SQL-CREATETABLE-PARMS-UNIQUE), and [foreign key](sql-createtable.html#SQL-CREATETABLE-PARMS-REFERENCES) constraints (Paul A. Jungwirth) [§](https://postgr.es/c/fc0438b4e) [§](https://postgr.es/c/89f908a6d) + + This is specified by `WITHOUT OVERLAPS` for `PRIMARY KEY` and `UNIQUE`, and by `PERIOD` for foreign keys, all applied to the last specified column. +* Allow [`CHECK`](sql-createtable.html#SQL-CREATETABLE-PARMS-CHECK) and [foreign key](sql-createtable.html#SQL-CREATETABLE-PARMS-REFERENCES) constraints to be specified as `NOT ENFORCED` (Amul Sul) [§](https://postgr.es/c/ca87c415e) [§](https://postgr.es/c/eec0040c4) + + This also adds column [`pg_constraint`](catalog-pg-constraint.html "52.13. pg_constraint").`conenforced`. +* Require [primary/foreign key](sql-createtable.html#SQL-CREATETABLE-PARMS-REFERENCES) relationships to use either deterministic collations or the the same nondeterministic collations (Peter Eisentraut) [§](https://postgr.es/c/9321d2fdf) + + The restore of a [pg\_dump](app-pgdump.html "pg_dump"), also used by [pg\_upgrade](pgupgrade.html "pg_upgrade"), will fail if these requirements are not met; schema changes must be made for these upgrade methods to succeed. +* Store column [`NOT NULL`](sql-createtable.html#SQL-CREATETABLE-PARMS-NOT-NULL) specifications in [`pg_constraint`](catalog-pg-constraint.html "52.13. pg_constraint") (Álvaro Herrera, Bernd Helmle) [§](https://postgr.es/c/14e87ffa5) [§](https://postgr.es/c/81ce602d4) + + This allows names to be specified for `NOT NULL` constraint. This also adds `NOT NULL` constraints to foreign tables and `NOT NULL` inheritance control to local tables. +* Allow [ALTER TABLE](sql-altertable.html "ALTER TABLE") to set the `NOT VALID` attribute of `NOT NULL` constraints (Rushabh Lathia, Jian He) [§](https://postgr.es/c/a379061a2) +* Allow modification of the inheritability of `NOT NULL` constraints (Suraj Kharage, Álvaro Herrera) [§](https://postgr.es/c/f4e53e10b) [§](https://postgr.es/c/4a02af8b1) + + The syntax is [`ALTER TABLE ... ALTER CONSTRAINT ... [NO] INHERIT`](sql-altertable.html "ALTER TABLE"). +* Allow `NOT VALID` foreign key constraints on partitioned tables (Amul Sul) [§](https://postgr.es/c/b663b9436) +* Allow [dropping](sql-altertable.html#SQL-ALTERTABLE-DESC-DROP-CONSTRAINT) of constraints `ONLY` on partitioned tables (Álvaro Herrera) [§](https://postgr.es/c/4dea33ce7) + + This was previously erroneously prohibited. + +##### E.2.3.2.2. [COPY](sql-copy.html "COPY") [#](#RELEASE-18-COPY) + +* Add `REJECT_LIMIT` to control the number of invalid rows `COPY FROM` can ignore (Atsushi Torikoshi) [§](https://postgr.es/c/4ac2a9bec) + + This is available when `ON_ERROR = 'ignore'`. +* Allow `COPY TO` to copy rows from populated materialized views (Jian He) [§](https://postgr.es/c/534874fac) +* Add `COPY` `LOG_VERBOSITY` level `silent` to suppress log output of ignored rows (Atsushi Torikoshi) [§](https://postgr.es/c/e7834a1a2) + + This new level suppresses output for discarded input rows when `on_error = 'ignore'`. +* Disallow `COPY FREEZE` on foreign tables (Nathan Bossart) [§](https://postgr.es/c/401a6956f) + + Previously, the `COPY` worked but the `FREEZE` was ignored, so disallow this command. + +##### E.2.3.2.3. [EXPLAIN](sql-explain.html "EXPLAIN") [#](#RELEASE-18-EXPLAIN) + +* Automatically include `BUFFERS` output in `EXPLAIN ANALYZE` (Guillaume Lelarge, David Rowley) [§](https://postgr.es/c/c2a4078eb) +* Add full WAL buffer count to `EXPLAIN (WAL)` output (Bertrand Drouvot) [§](https://postgr.es/c/320545bfc) +* In `EXPLAIN ANALYZE`, report the number of index lookups used per index scan node (Peter Geoghegan) [§](https://postgr.es/c/0fbceae84) +* Modify `EXPLAIN` to output fractional row counts (Ibrar Ahmed, Ilia Evdokimov, Robert Haas) [§](https://postgr.es/c/ddb17e387) [§](https://postgr.es/c/95dbd827f) +* Add memory and disk usage details to `Material`, `Window Aggregate`, and common table expression nodes to `EXPLAIN` output (David Rowley, Tatsuo Ishii) [§](https://postgr.es/c/1eff8279d) [§](https://postgr.es/c/53abb1e0e) [§](https://postgr.es/c/95d6e9af0) [§](https://postgr.es/c/40708acd6) +* Add details about window function arguments to `EXPLAIN` output (Tom Lane) [§](https://postgr.es/c/8b1b34254) +* Add `Parallel Bitmap Heap Scan` worker cache statistics to `EXPLAIN ANALYZE` (David Geier, Heikki Linnakangas, Donghang Lin, Alena Rybakina, David Rowley) [§](https://postgr.es/c/5a1e6df3b) +* Indicate disabled nodes in `EXPLAIN ANALYZE` output (Robert Haas, David Rowley, Laurenz Albe) [§](https://postgr.es/c/c01743aa4) [§](https://postgr.es/c/161320b4b) [§](https://postgr.es/c/84b8fccbe) + +#### E.2.3.3. Data Types [#](#RELEASE-18-DATATYPES) + +* Improve [Unicode](collation.html#COLLATION-MANAGING-STANDARD "23.2.2.1. Standard Collations") full case mapping and conversion (Jeff Davis) [§](https://postgr.es/c/4e7f62bc3) [§](https://postgr.es/c/286a365b9) + + This adds the ability to do conditional and title case mapping, and case map single characters to multiple characters. +* Allow [`jsonb`](datatype-json.html "8.14. JSON Types") `null` values to be cast to scalar types as `NULL` (Tom Lane) [§](https://postgr.es/c/a5579a90a) + + Previously such casts generated an error. +* Add optional parameter to [`json{b}_strip_nulls`](functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE "Table 9.51. JSON Processing Functions") to allow removal of null array elements (Florents Tselai) [§](https://postgr.es/c/4603903d2) +* Add function [`array_sort()`](functions-array.html#ARRAY-FUNCTIONS-TABLE "Table 9.57. Array Functions") which sorts an array's first dimension (Junwang Zhao, Jian He) [§](https://postgr.es/c/6c12ae09f) +* Add function [`array_reverse()`](functions-array.html#ARRAY-FUNCTIONS-TABLE "Table 9.57. Array Functions") which reverses an array's first dimension (Aleksander Alekseev) [§](https://postgr.es/c/49d6c7d8d) +* Add function [`reverse()`](functions-string.html#FUNCTIONS-STRING-OTHER "Table 9.10. Other String Functions and Operators") to reverse bytea bytes (Aleksander Alekseev) [§](https://postgr.es/c/0697b2390) +* Allow casting between integer types and [`bytea`](datatype-binary.html "8.4. Binary Data Types") (Aleksander Alekseev) [§](https://postgr.es/c/6da469bad) + + The integer values are stored as `bytea` two's complement values. +* Update Unicode data to [Unicode](collation.html#COLLATION-MANAGING-STANDARD "23.2.2.1. Standard Collations") 16.0.0 (Peter Eisentraut) [§](https://postgr.es/c/82a46cca9) +* Add full text search [stemming](textsearch-dictionaries.html#TEXTSEARCH-SNOWBALL-DICTIONARY "12.6.6. Snowball Dictionary") for Estonian (Tom Lane) [§](https://postgr.es/c/b464e51ab) +* Improve the [`XML`](datatype-xml.html "8.13. XML Type") error codes to more closely match the SQL standard (Tom Lane) [§](https://postgr.es/c/cd838e200) + + These errors are reported via [`SQLSTATE`](errcodes-appendix.html "Appendix A. PostgreSQL Error Codes"). + +#### E.2.3.4. Functions [#](#RELEASE-18-FUNCTIONS) + +* Add function [`casefold()`](functions-string.html#FUNCTIONS-STRING-OTHER "Table 9.10. Other String Functions and Operators") to allow for more sophisticated case-insensitive matching (Jeff Davis) [§](https://postgr.es/c/bfc599206) + + This allows more accurate comparisons, i.e., a character can have multiple upper or lower case equivalents, or upper or lower case conversion changes the number of characters. +* Allow [`MIN()`](functions-aggregate.html#FUNCTIONS-AGGREGATE-TABLE "Table 9.62. General-Purpose Aggregate Functions")/[`MAX()`](functions-aggregate.html#FUNCTIONS-AGGREGATE-TABLE "Table 9.62. General-Purpose Aggregate Functions") aggregates on arrays and composite types (Aleksander Alekseev, Marat Buharov) [§](https://postgr.es/c/a0f1fce80) [§](https://postgr.es/c/2d24fd942) +* Add a `WEEK` option to [`EXTRACT()`](functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT "9.9.1. EXTRACT, date_part") (Tom Lane) [§](https://postgr.es/c/6be39d77a) +* Improve the output `EXTRACT(QUARTER ...)` for negative values (Tom Lane) [§](https://postgr.es/c/6be39d77a) +* Add roman numeral support to [`to_number()`](functions-formatting.html#FUNCTIONS-FORMATTING-TABLE "Table 9.26. Formatting Functions") (Hunaid Sohail) [§](https://postgr.es/c/172e6b3ad) + + This is accessed via the `RN` pattern. +* Add [`UUID`](datatype-uuid.html "8.12. UUID Type") version 7 generation function [`uuidv7()`](functions-uuid.html#FUNC_UUID_GEN_TABLE "Table 9.45. UUID Generation Functions") (Andrey Borodin) [§](https://postgr.es/c/78c5e141e) + + This `UUID` value is temporally sortable. Function alias [`uuidv4()`](functions-uuid.html#FUNC_UUID_GEN_TABLE "Table 9.45. UUID Generation Functions") has been added to explicitly generate version 4 UUIDs. +* Add functions [`crc32()`](functions-binarystring.html#FUNCTIONS-BINARYSTRING-OTHER "Table 9.12. Other Binary String Functions") and [`crc32c()`](functions-binarystring.html#FUNCTIONS-BINARYSTRING-OTHER "Table 9.12. Other Binary String Functions") to compute CRC values (Aleksander Alekseev) [§](https://postgr.es/c/760162fed) +* Add math functions [`gamma()`](functions-math.html#FUNCTIONS-MATH-FUNC-TABLE "Table 9.5. Mathematical Functions") and [`lgamma()`](functions-math.html#FUNCTIONS-MATH-FUNC-TABLE "Table 9.5. Mathematical Functions") (Dean Rasheed) [§](https://postgr.es/c/a3b6dfd41) +* Allow `=>` syntax for named cursor arguments in [PL/pgSQL](plpgsql.html "Chapter 41. PL/pgSQL — SQL Procedural Language") (Pavel Stehule) [§](https://postgr.es/c/246dedc5d) + + We previously only accepted `:=`. +* Allow [`regexp_match[es]()`](functions-matching.html#FUNCTIONS-POSIX-REGEXP "9.7.3. POSIX Regular Expressions")/[`regexp_like()`](functions-matching.html#FUNCTIONS-POSIX-REGEXP "9.7.3. POSIX Regular Expressions")/[`regexp_replace()`](functions-matching.html#FUNCTIONS-POSIX-REGEXP "9.7.3. POSIX Regular Expressions")/[`regexp_count()`](functions-matching.html#FUNCTIONS-POSIX-REGEXP "9.7.3. POSIX Regular Expressions")/[`regexp_instr()`](functions-matching.html#FUNCTIONS-POSIX-REGEXP "9.7.3. POSIX Regular Expressions")/[`regexp_substr()`](functions-matching.html#FUNCTIONS-POSIX-REGEXP "9.7.3. POSIX Regular Expressions")/[`regexp_split_to_table()`](functions-matching.html#FUNCTIONS-POSIX-REGEXP "9.7.3. POSIX Regular Expressions")/[`regexp_split_to_array()`](functions-matching.html#FUNCTIONS-POSIX-REGEXP "9.7.3. POSIX Regular Expressions") to use named arguments (Jian He) [§](https://postgr.es/c/580f8727c) + +#### E.2.3.5. [libpq](libpq.html "Chapter 32. libpq — C Library") [#](#RELEASE-18-LIBPQ) + +* Add function [`PQfullProtocolVersion()`](libpq-status.html#LIBPQ-PQFULLPROTOCOLVERSION) to report the full, including minor, protocol version number (Jacob Champion, Jelte Fennema-Nio) [§](https://postgr.es/c/cdb6b0fdb) +* Add libpq connection [parameters](libpq-connect.html#LIBPQ-CONNECT-SSL-MAX-PROTOCOL-VERSION) and [environment variables](libpq-envars.html "32.15. Environment Variables") to specify the minimum and maximum acceptable protocol version for connections (Jelte Fennema-Nio) [§](https://postgr.es/c/285613c60) [§](https://postgr.es/c/507034910) +* Report [search\_path](runtime-config-client.html#GUC-SEARCH-PATH) changes to the client (Alexander Kukushkin, Jelte Fennema-Nio, Tomas Vondra) [§](https://postgr.es/c/28a1121fd) [§](https://postgr.es/c/0d06a7eac) +* Add [`PQtrace()`](libpq-control.html#LIBPQ-PQTRACE) output for all message types, including authentication (Jelte Fennema-Nio) [§](https://postgr.es/c/ea92f3a0a) [§](https://postgr.es/c/a5c6b8f22) [§](https://postgr.es/c/b8b3f861f) [§](https://postgr.es/c/e87c14b19) [§](https://postgr.es/c/7adec2d5f) +* Add libpq connection parameter [`sslkeylogfile`](libpq-connect.html#LIBPQ-CONNECT-SSLKEYLOGFILE) which dumps out SSL key material (Abhishek Chanda, Daniel Gustafsson) [§](https://postgr.es/c/2da74d8d6) + + This is useful for debugging. +* Modify some libpq function signatures to use `int64_t` (Thomas Munro) [§](https://postgr.es/c/3c86223c9) + + These previously used `pg_int64`, which is now deprecated. + +#### E.2.3.6. [psql](app-psql.html "psql") [#](#RELEASE-18-PSQL) + +* Allow psql to parse, bind, and close named prepared statements (Anthonin Bonnefoy, Michael Paquier) [§](https://postgr.es/c/d55322b0d) [§](https://postgr.es/c/fc39b286a) + + This is accomplished with new commands [`\parse`](app-psql.html#APP-PSQL-META-COMMAND-PARSE), [`\bind_named`](app-psql.html#APP-PSQL-META-COMMAND-BIND-NAMED), and [`\close_prepared`](app-psql.html#APP-PSQL-META-COMMAND-CLOSE-PREPARED). +* Add psql backslash commands to allowing issuance of pipeline queries (Anthonin Bonnefoy) [§](https://postgr.es/c/41625ab8e) [§](https://postgr.es/c/17caf6644) [§](https://postgr.es/c/2cce0fe44) + + The new commands are [`\startpipeline`](app-psql.html#APP-PSQL-META-COMMAND-PIPELINE), `\syncpipeline`, `\sendpipeline`, `\endpipeline`, `\flushrequest`, `\flush`, and `\getresults`. +* Allow adding pipeline status to the psql prompt and add related state variables (Anthonin Bonnefoy) [§](https://postgr.es/c/3ce357584) + + The new prompt character is `%P` and the new psql variables are [`PIPELINE_SYNC_COUNT`](app-psql.html#APP-PSQL-VARIABLES-PIPELINE-SYNC-COUNT), [`PIPELINE_COMMAND_COUNT`](app-psql.html#APP-PSQL-VARIABLES-PIPELINE-COMMAND-COUNT), and [`PIPELINE_RESULT_COUNT`](app-psql.html#APP-PSQL-VARIABLES-PIPELINE-RESULT-COUNT). +* Allow adding the connection service name to the psql prompt or access it via psql variable (Michael Banck) [§](https://postgr.es/c/477728b5d) +* Add psql option to use expanded mode on all list commands (Dean Rasheed) [§](https://postgr.es/c/00f4c2959) + + Adding backslash suffix `x` enables this. +* Change psql's [`\conninfo`](app-psql.html#APP-PSQL-META-COMMAND-CONNINFO) to use tabular format and include more information (Álvaro Herrera, Maiquel Grassi, Hunaid Sohail) [§](https://postgr.es/c/bba2fbc62) +* Add function's leakproof indicator to psql's [`\df+`](app-psql.html#APP-PSQL-META-COMMAND-DF-LC), `\do+`, `\dAo+`, and `\dC+` outputs (Yugo Nagata) [§](https://postgr.es/c/2355e5111) +* Add access method details for partitioned relations in [`\dP+`](app-psql.html#APP-PSQL-META-COMMAND-DP-UC) (Justin Pryzby) [§](https://postgr.es/c/978f38c77) +* Add `default_version` to the psql [`\dx`](app-psql.html#APP-PSQL-META-COMMAND-DX-LC) extension output (Magnus Hagander) [§](https://postgr.es/c/d696406a9) +* Add psql variable [`WATCH_INTERVAL`](app-psql.html#APP-PSQL-VARIABLES-WATCH-INTERVAL) to set the default [`\watch`](app-psql.html#APP-PSQL-META-COMMAND-WATCH) wait time (Daniel Gustafsson) [§](https://postgr.es/c/1a759c832) + +#### E.2.3.7. Server Applications [#](#RELEASE-18-SERVER-APPS) + +* Change [initdb](app-initdb.html "initdb") to default to enabling checksums (Greg Sabino Mullane) [§](https://postgr.es/c/983a588e0) [§](https://postgr.es/c/04bec894a) + + The new initdb option `--no-data-checksums` disables checksums. +* Add initdb option `--no-sync-data-files` to avoid syncing heap/index files (Nathan Bossart) [§](https://postgr.es/c/cf131fa94) + + initdb option `--no-sync` is still available to avoid syncing any files. +* Add [vacuumdb](app-vacuumdb.html "vacuumdb") option `--missing-stats-only` to compute only missing optimizer statistics (Corey Huinker, Nathan Bossart) [§](https://postgr.es/c/edba754f0) [§](https://postgr.es/c/987910502) + + This option can only be run by superusers and can only be used with options `--analyze-only` and `--analyze-in-stages`. +* Add [pg\_combinebackup](app-pgcombinebackup.html "pg_combinebackup") option `-k`/`--link` to enable hard linking (Israel Barth Rubio, Robert Haas) [§](https://postgr.es/c/99aeb8470) + + Only some files can be hard linked. This should not be used if the backups will be used independently. +* Allow [pg\_verifybackup](app-pgverifybackup.html "pg_verifybackup") to verify tar-format backups (Amul Sul) [§](https://postgr.es/c/8dfd31290) +* If [pg\_rewind](app-pgrewind.html "pg_rewind")'s `--source-server` specifies a database name, use it in `--write-recovery-conf` output (Masahiko Sawada) [§](https://postgr.es/c/4ecdd4110) +* Add [pg\_resetwal](app-pgresetwal.html "pg_resetwal") option `--char-signedness` to change the default `char` signedness (Masahiko Sawada) [§](https://postgr.es/c/30666d185) + +##### E.2.3.7.1. [pg\_dump](app-pgdump.html "pg_dump")/[pg\_dumpall](app-pg-dumpall.html "pg_dumpall")/[pg\_restore](app-pgrestore.html "pg_restore") [#](#RELEASE-18-PGDUMP) + +* Add [pg\_dump](app-pgdump.html "pg_dump") option `--statistics` (Jeff Davis) [§](https://postgr.es/c/bde2fb797) [§](https://postgr.es/c/a3e8dc143) +* Add pg\_dump and [pg\_dumpall](app-pg-dumpall.html "pg_dumpall") option `--sequence-data` to dump sequence data that would normally be excluded (Nathan Bossart) [§](https://postgr.es/c/9c49f0e8c) [§](https://postgr.es/c/acea3fc49) +* Add [pg\_dump](app-pgdump.html "pg_dump"), [pg\_dumpall](app-pg-dumpall.html "pg_dumpall"), and [pg\_restore](app-pgrestore.html "pg_restore") options `--statistics-only`, `--no-statistics`, `--no-data`, and `--no-schema` (Corey Huinker, Jeff Davis) [§](https://postgr.es/c/1fd1bd871) +* Add option `--no-policies` to disable row level security policy processing in [pg\_dump](app-pgdump.html "pg_dump"), [pg\_dumpall](app-pg-dumpall.html "pg_dumpall"), [pg\_restore](app-pgrestore.html "pg_restore") (Nikolay Samokhvalov) [§](https://postgr.es/c/cd3c45125) + + This is useful for migrating to systems with different policies. + +##### E.2.3.7.2. [pg\_upgrade](pgupgrade.html "pg_upgrade") [#](#RELEASE-18-PGUPGRADE) + +* Allow pg\_upgrade to preserve optimizer statistics (Corey Huinker, Jeff Davis, Nathan Bossart) [§](https://postgr.es/c/1fd1bd871) [§](https://postgr.es/c/c9d502eb6) [§](https://postgr.es/c/d5f1b6a75) [§](https://postgr.es/c/1fd1bd871) + + Extended statistics are not preserved. Also add pg\_upgrade option `--no-statistics` to disable statistics preservation. +* Allow pg\_upgrade to process database checks in parallel (Nathan Bossart) [§](https://postgr.es/c/40e2e5e92) [§](https://postgr.es/c/6d3d2e8e5) [§](https://postgr.es/c/7baa36de5) [§](https://postgr.es/c/46cad8b31) [§](https://postgr.es/c/6ab8f27bc) [§](https://postgr.es/c/bbf83cab9) [§](https://postgr.es/c/9db3018cf) [§](https://postgr.es/c/c34eabfbb) [§](https://postgr.es/c/cf2f82a37) [§](https://postgr.es/c/f93f5f7b9) [§](https://postgr.es/c/c880cf258) + + This is controlled by the existing `--jobs` option. +* Add pg\_upgrade option `--swap` to swap directories rather than copy, clone, or link files (Nathan Bossart) [§](https://postgr.es/c/626d7236b) + + This mode is potentially the fastest. +* Add pg\_upgrade option `--set-char-signedness` to set the default `char` signedness of new cluster (Masahiko Sawada) [§](https://postgr.es/c/a8238f87f) [§](https://postgr.es/c/1aab68059) + + This is to handle cases where a pre-PostgreSQL 18 cluster's default CPU signedness does not match the new cluster. + +##### E.2.3.7.3. Logical Replication Applications [#](#RELEASE-18-LOGICALREP-APP) + +* Add [pg\_createsubscriber](app-pgcreatesubscriber.html "pg_createsubscriber") option `--all` to create logical replicas for all databases (Shubham Khanna) [§](https://postgr.es/c/fb2ea12f4) +* Add pg\_createsubscriber option `--clean` to remove publications (Shubham Khanna) [§](https://postgr.es/c/e5aeed4b8) [§](https://postgr.es/c/60dda7bbc) +* Add pg\_createsubscriber option `--enable-two-phase` to enable prepared transactions (Shubham Khanna) [§](https://postgr.es/c/e117cfb2f) +* Add [pg\_recvlogical](app-pgrecvlogical.html "pg_recvlogical") option `--enable-failover` to specify failover slots (Hayato Kuroda) [§](https://postgr.es/c/cf2655a90) + + Also add option `--enable-two-phase` as a synonym for `--two-phase`, and deprecate the latter. +* Allow pg\_recvlogical `--drop-slot` to work without `--dbname` (Hayato Kuroda) [§](https://postgr.es/c/c68100aa4) + +#### E.2.3.8. Source Code [#](#RELEASE-18-SOURCE-CODE) + +* Separate the loading and running of [injection points](xfunc-c.html#XFUNC-ADDIN-INJECTION-POINTS "36.10.14. Injection Points") (Michael Paquier, Heikki Linnakangas) [§](https://postgr.es/c/4b211003e) [§](https://postgr.es/c/a0a5869a8) + + Injection points can now be created, but not run, via [`INJECTION_POINT_LOAD()`](xfunc-c.html#XFUNC-ADDIN-INJECTION-POINTS "36.10.14. Injection Points"), and such injection points can be run via [`INJECTION_POINT_CACHED()`](xfunc-c.html#XFUNC-ADDIN-INJECTION-POINTS "36.10.14. Injection Points"). +* Support runtime arguments in injection points (Michael Paquier) [§](https://postgr.es/c/371f2db8b) +* Allow inline injection point test code with [`IS_INJECTION_POINT_ATTACHED()`](xfunc-c.html#XFUNC-ADDIN-INJECTION-POINTS "36.10.14. Injection Points") (Heikki Linnakangas) [§](https://postgr.es/c/20e0e7da9) +* Improve the performance of processing long [`JSON`](datatype-json.html "8.14. JSON Types") strings using SIMD (Single Instruction Multiple Data) (David Rowley) [§](https://postgr.es/c/ca6fde922) +* Speed up CRC32C calculations using x86 AVX-512 instructions (Raghuveer Devulapalli, Paul Amonson) [§](https://postgr.es/c/3c6e8c123) +* Add ARM Neon and SVE CPU intrinsics for popcount (integer bit counting) (Chiranmoy Bhattacharya, Devanga Susmitha, Rama Malladi) [§](https://postgr.es/c/6be53c276) [§](https://postgr.es/c/519338ace) +* Improve the speed of numeric multiplication and division (Joel Jacobson, Dean Rasheed) [§](https://postgr.es/c/ca481d3c9) [§](https://postgr.es/c/c4e44224c) [§](https://postgr.es/c/8dc28d7eb) [§](https://postgr.es/c/9428c001f) +* Add configure option [`--with-libnuma`](install-make.html#CONFIGURE-OPTION-WITH-LIBNUMA) to enable NUMA awareness (Jakub Wartak, Bertrand Drouvot) [§](https://postgr.es/c/65c298f61) [§](https://postgr.es/c/8cc139bec) [§](https://postgr.es/c/ba2a3c230) + + The function [`pg_numa_available()`](functions-info.html#FUNCTIONS-INFO-SESSION-TABLE "Table 9.71. Session Information Functions") reports on NUMA awareness, and system views [`pg_shmem_allocations_numa`](view-pg-shmem-allocations-numa.html "53.28. pg_shmem_allocations_numa") and [`pg_buffercache_numa`](pgbuffercache.html#PGBUFFERCACHE-PG-BUFFERCACHE-NUMA "F.25.2. The pg_buffercache_numa View") which report on shared memory distribution across NUMA nodes. +* Add [TOAST](storage-toast.html "66.2. TOAST") table to [`pg_index`](catalog-pg-index.html "52.26. pg_index") to allow for very large expression indexes (Nathan Bossart) [§](https://postgr.es/c/b52c4fc3c) +* Remove column [`pg_attribute`](catalog-pg-attribute.html "52.7. pg_attribute").`attcacheoff` (David Rowley) [§](https://postgr.es/c/02a8d0c45) +* Add column [`pg_class`](catalog-pg-class.html "52.11. pg_class").`relallfrozen` (Melanie Plageman) [§](https://postgr.es/c/99f8f3fbb) +* Add [`amgettreeheight`](indexam.html "Chapter 63. Index Access Method Interface Definition"), `amconsistentequality`, and `amconsistentordering` to the index access method API (Mark Dilger) [§](https://postgr.es/c/56fead44d) [§](https://postgr.es/c/af4002b38) +* Add GiST support function [`stratnum()`](gist.html#GIST-EXTENSIBILITY "65.2.3. Extensibility") (Paul A. Jungwirth) [§](https://postgr.es/c/7406ab623) +* Record the default CPU signedness of `char` in [pg\_controldata](app-pgcontroldata.html "pg_controldata") (Masahiko Sawada) [§](https://postgr.es/c/44fe30fda) +* Add support for Python "Limited API" in [PL/Python](plpython.html "Chapter 44. PL/Python — Python Procedural Language") (Peter Eisentraut) [§](https://postgr.es/c/72a3d0462) [§](https://postgr.es/c/0793ab810) + + This helps prevent problems caused by Python 3.x version mismatches. +* Change the minimum supported Python version to 3.6.8 (Jacob Champion) [§](https://postgr.es/c/45363fca6) +* Remove support for OpenSSL versions older than 1.1.1 (Daniel Gustafsson) [§](https://postgr.es/c/a70e01d43) [§](https://postgr.es/c/6c66b7443) +* If LLVM is enabled, require version 14 or later (Thomas Munro) [§](https://postgr.es/c/972c2cd28) +* Add macro [`PG_MODULE_MAGIC_EXT`](functions-info.html "9.27. System Information Functions and Operators") to allow extensions to report their name and version (Andrei Lepikhov) [§](https://postgr.es/c/9324c8c58) + + This information can be access via the new function [`pg_get_loaded_modules()`](functions-info.html#FUNCTIONS-INFO-SESSION-TABLE "Table 9.71. Session Information Functions"). +* Document that [`SPI_connect()`](spi-spi-connect.html "SPI_connect")/[`SPI_connect_ext()`](spi-spi-connect.html "SPI_connect") always returns success (`SPI_OK_CONNECT`) (Stepan Neretin) [§](https://postgr.es/c/218527d01) + + Errors are always reported via `ereport()`. +* Add [documentation section](xfunc-c.html#XFUNC-API-ABI-STABILITY-GUIDANCE "36.10.6. Server API and ABI Stability Guidance") about API and ABI compatibility (David Wheeler, Peter Eisentraut) [§](https://postgr.es/c/e54a42ac9) +* Remove the experimental designation of Meson builds on Windows (Aleksander Alekseev) [§](https://postgr.es/c/5afaba629) +* Remove configure options `--disable-spinlocks` and `--disable-atomics` (Thomas Munro) [§](https://postgr.es/c/e25626677) [§](https://postgr.es/c/813852613) + + Thirty-two-bit atomic operations are now required. +* Remove support for the HPPA/PA-RISC architecture (Tom Lane) [§](https://postgr.es/c/edadeb071) + +#### E.2.3.9. Additional Modules [#](#RELEASE-18-MODULES) + +* Add extension [pg\_logicalinspect](pglogicalinspect.html "F.28. pg_logicalinspect — logical decoding components inspection") to inspect logical snapshots (Bertrand Drouvot) [§](https://postgr.es/c/7cdfeee32) +* Add extension [pg\_overexplain](pgoverexplain.html "F.29. pg_overexplain — allow EXPLAIN to dump even more details") which adds debug details to [`EXPLAIN`](sql-explain.html "EXPLAIN") output (Robert Haas) [§](https://postgr.es/c/8d5ceb113) +* Add output columns to [`postgres_fdw_get_connections()`](postgres-fdw.html#POSTGRES-FDW-FUNCTIONS "F.38.2. Functions") (Hayato Kuroda, Sagar Dilip Shedge) [§](https://postgr.es/c/c297a47c5) [§](https://postgr.es/c/857df3cef) [§](https://postgr.es/c/4f08ab554) [§](https://postgr.es/c/fe186bda7) + + New output column `used_in_xact` indicates if the foreign data wrapper is being used by a current transaction, `closed` indicates if it is closed, `user_name` indicates the user name, and `remote_backend_pid` indicates the remote backend process identifier. +* Allow [SCRAM](auth-password.html "20.5. Password Authentication") authentication from the client to be passed to [postgres\_fdw](postgres-fdw.html "F.38. postgres_fdw — access data stored in external PostgreSQL servers") servers (Matheus Alcantara, Peter Eisentraut) [§](https://postgr.es/c/761c79508) + + This avoids storing postgres\_fdw authentication information in the database, and is enabled with the postgres\_fdw [`use_scram_passthrough`](postgres-fdw.html#POSTGRES-FDW-OPTION-USE-SCRAM-PASSTHROUGH) connection option. libpq uses new connection parameters [scram\_client\_key](libpq-connect.html#LIBPQ-CONNECT-SCRAM-CLIENT-KEY) and [scram\_server\_key](libpq-connect.html#LIBPQ-CONNECT-SCRAM-SERVER-KEY). +* Allow SCRAM authentication from the client to be passed to [dblink](dblink.html "F.11. dblink — connect to other PostgreSQL databases") servers (Matheus Alcantara) [§](https://postgr.es/c/3642df265) +* Add `on_error` and `log_verbosity` options to [file\_fdw](file-fdw.html "F.15. file_fdw — access data files in the server's file system") (Atsushi Torikoshi) [§](https://postgr.es/c/a1c4c8a9e) + + These control how file\_fdw handles and reports invalid file rows. +* Add `reject_limit` to control the number of invalid rows file\_fdw can ignore (Atsushi Torikoshi) [§](https://postgr.es/c/6c8f67032) + + This is active when `ON_ERROR = 'ignore'`. +* Add configurable variable `min_password_length` to [passwordcheck](passwordcheck.html "F.24. passwordcheck — verify password strength") (Emanuele Musella, Maurizio Boriani) [§](https://postgr.es/c/f7e1b3828) + + This controls the minimum password length. +* Have [pgbench](pgbench.html "pgbench") report the number of failed, retried, or skipped transactions in per-script reports (Yugo Nagata) [§](https://postgr.es/c/cae0f3c40) +* Add [isn](isn.html "F.20. isn — data types for international standard numbers (ISBN, EAN, UPC, etc.)") server variable `weak` to control invalid check digit acceptance (Viktor Holmberg) [§](https://postgr.es/c/448904423) + + This was previously only controlled by function [`isn_weak()`](isn.html#ISN-FUNCTIONS "Table F.11. isn Functions"). +* Allow values to be sorted to speed [btree\_gist](btree-gist.html "F.8. btree_gist — GiST operator classes with B-tree behavior") index builds (Bernd Helmle, Andrey Borodin) [§](https://postgr.es/c/e4309f73f) +* Add [amcheck](amcheck.html "F.1. amcheck — tools to verify table and index consistency") check function [`gin_index_check()`](amcheck.html#AMCHECK-FUNCTIONS "F.1.1. Functions") to verify `GIN` indexes (Grigory Kryachko, Heikki Linnakangas, Andrey Borodin) [§](https://postgr.es/c/14ffaece0) +* Add functions [`pg_buffercache_evict_relation()`](pgbuffercache.html#PGBUFFERCACHE-PG-BUFFERCACHE-EVICT-RELATION "F.25.6. The pg_buffercache_evict_relation() Function") and [`pg_buffercache_evict_all()`](pgbuffercache.html#PGBUFFERCACHE-PG-BUFFERCACHE-EVICT-ALL "F.25.7. The pg_buffercache_evict_all() Function") to evict unpinned shared buffers (Nazir Bilal Yavuz) [§](https://postgr.es/c/dcf7e1697) + + The existing function [`pg_buffercache_evict()`](pgbuffercache.html#PGBUFFERCACHE-PG-BUFFERCACHE-EVICT "F.25.5. The pg_buffercache_evict() Function") now returns the buffer flush status. +* Allow extensions to install custom [EXPLAIN](sql-explain.html "EXPLAIN") options (Robert Haas, Sami Imseih) [§](https://postgr.es/c/c65bc2e1d) [§](https://postgr.es/c/4fd02bf7c) [§](https://postgr.es/c/50ba65e73) +* Allow extensions to use the server's cumulative statistics API (Michael Paquier) [§](https://postgr.es/c/7949d9594) [§](https://postgr.es/c/2eff9e678) + +##### E.2.3.9.1. [pg\_stat\_statements](pgstatstatements.html "F.32. pg_stat_statements — track statistics of SQL planning and execution") [#](#RELEASE-18-PGSTATSTATEMENTS) + +* Allow the queries of [CREATE TABLE AS](sql-createtableas.html "CREATE TABLE AS") and [DECLARE](sql-declare.html "DECLARE") to be tracked by pg\_stat\_statements (Anthonin Bonnefoy) [§](https://postgr.es/c/6b652e6ce) + + They are also now assigned query ids. +* Allow the parameterization of [SET](sql-set.html "SET") values in pg\_stat\_statements (Greg Sabino Mullane, Michael Paquier) [§](https://postgr.es/c/dc6851596) + + This reduces the bloat caused by `SET` statements with differing constants. +* Add [`pg_stat_statements`](pgstatstatements.html#PGSTATSTATEMENTS-PG-STAT-STATEMENTS "F.32.1. The pg_stat_statements View") columns to report parallel activity (Guillaume Lelarge) [§](https://postgr.es/c/cf54a2c00) + + The new columns are `parallel_workers_to_launch` and `parallel_workers_launched`. +* Add `pg_stat_statements`.`wal_buffers_full` to report full WAL buffers (Bertrand Drouvot) [§](https://postgr.es/c/ce5bcc4a9) + +##### E.2.3.9.2. [pgcrypto](pgcrypto.html "F.26. pgcrypto — cryptographic functions") [#](#RELEASE-18-PGCRYPTO) + +* Add pgcrypto algorithms [`sha256crypt`](pgcrypto.html#PGCRYPTO-CRYPT-ALGORITHMS "Table F.18. Supported Algorithms for crypt()") and [`sha512crypt`](pgcrypto.html#PGCRYPTO-CRYPT-ALGORITHMS "Table F.18. Supported Algorithms for crypt()") (Bernd Helmle) [§](https://postgr.es/c/749a9e20c) +* Add [CFB](pgcrypto.html#PGCRYPTO-RAW-ENC-FUNCS "F.26.4. Raw Encryption Functions") mode to pgcrypto encryption and decryption (Umar Hayat) [§](https://postgr.es/c/9ad1b3d01) +* Add function [`fips_mode()`](pgcrypto.html#PGCRYPTO-OPENSSL-SUPPORT-FUNCS "F.26.6. OpenSSL Support Functions") to report the server's FIPS mode (Daniel Gustafsson) [§](https://postgr.es/c/924d89a35) +* Add pgcrypto server variable [`builtin_crypto_enabled`](pgcrypto.html#PGCRYPTO-CONFIGURATION-PARAMETERS-BUILTIN_CRYPTO_ENABLED) to allow disabling builtin non-FIPS mode cryptographic functions (Daniel Gustafsson, Joe Conway) [§](https://postgr.es/c/035f99cbe) + + This is useful for guaranteeing FIPS mode behavior. + +### E.2.4. Acknowledgments [#](#RELEASE-18-ACKNOWLEDGEMENTS) + +The following individuals (in alphabetical order) have contributed to this release as patch authors, committers, reviewers, testers, or reporters of issues. + +| | +| --- | +| Abhishek Chanda | +| Adam Guo | +| Adam Rauch | +| Aidar Imamov | +| Ajin Cherian | +| Alastair Turner | +| Alec Cozens | +| Aleksander Alekseev | +| Alena Rybakina | +| Alex Friedman | +| Alex Richman | +| Alexander Alehin | +| Alexander Borisov | +| Alexander Korotkov | +| Alexander Kozhemyakin | +| Alexander Kukushkin | +| Alexander Kuzmenkov | +| Alexander Kuznetsov | +| Alexander Lakhin | +| Alexander Pyhalov | +| Alexandra Wang | +| Alexey Dvoichenkov | +| Alexey Makhmutov | +| Alexey Shishkin | +| Ali Akbar | +| Álvaro Herrera | +| Álvaro Mongil | +| Amit Kapila | +| Amit Langote | +| Amul Sul | +| Andreas Karlsson | +| Andreas Scherbaum | +| Andreas Ulbrich | +| Andrei Lepikhov | +| Andres Freund | +| Andrew | +| Andrew Bille | +| Andrew Dunstan | +| Andrew Jackson | +| Andrew Kane | +| Andrew Watkins | +| Andrey Borodin | +| Andrey Chudnovsky | +| Andrey Rachitskiy | +| Andrey Rudometov | +| Andy Alsup | +| Andy Fan | +| Anthonin Bonnefoy | +| Anthony Hsu | +| Anthony Leung | +| Anton Melnikov | +| Anton Voloshin | +| Antonin Houska | +| Antti Lampinen | +| Arseniy Mukhin | +| Artur Zakirov | +| Arun Thirupathi | +| Ashutosh Bapat | +| Asphator | +| Atsushi Torikoshi | +| Avi Weinberg | +| Aya Iwata | +| Ayush Tiwari | +| Ayush Vatsa | +| Bastien Roucariès | +| Ben Peachey Higdon | +| Benoit Lobréau | +| Bernd Helmle | +| Bernd Reiß | +| Bernhard Wiedemann | +| Bertrand Drouvot | +| Bertrand Mamasam | +| Bharath Rupireddy | +| Bogdan Grigorenko | +| Boyu Yang | +| Braulio Fdo Gonzalez | +| Bruce Momjian | +| Bykov Ivan | +| Cameron Vogt | +| Cary Huang | +| Cédric Villemain | +| Cees van Zeeland | +| ChangAo Chen | +| Chao Li | +| Chapman Flack | +| Charles Samborski | +| Chengwen Wu | +| Chengxi Sun | +| Chiranmoy Bhattacharya | +| Chris Gooch | +| Christian Charukiewicz | +| Christoph Berg | +| Christophe Courtois | +| Christopher Inokuchi | +| Clemens Ruck | +| Corey Huinker | +| Craig Milhiser | +| Crisp Lee | +| Dagfinn Ilmari Mannsåker | +| Daniel Elishakov | +| Daniel Gustafsson | +| Daniel Vérité | +| Daniel Westermann | +| Daniele Varrazzo | +| Daniil Davydov | +| Daria Shanina | +| Dave Cramer | +| Dave Page | +| David Benjamin | +| David Christensen | +| David Fiedler | +| David G. Johnston | +| David Geier | +| David Rowley | +| David Steele | +| David Wheeler | +| David Zhang | +| Davinder Singh | +| Dean Rasheed | +| Devanga Susmitha | +| Devrim Gündüz | +| Dian Fay | +| Dilip Kumar | +| Dimitrios Apostolou | +| Dipesh Dhameliya | +| Dmitrii Bondar | +| Dmitry Dolgov | +| Dmitry Koval | +| Dmitry Kovalenko | +| Dmitry Yurichev | +| Dominique Devienne | +| Donghang Lin | +| Dorjpalam Batbaatar | +| Drew Callahan | +| Duncan Sands | +| Dwayne Towell | +| Dzmitry Jachnik | +| Egor Chindyaskin | +| Egor Rogov | +| Emanuel Ionescu | +| Emanuele Musella | +| Emre Hasegeli | +| Eric Cyr | +| Erica Zhang | +| Erik Nordström | +| Erik Rijkers | +| Erik Wienhold | +| Erki Eessaar | +| Ethan Mertz | +| Etienne LAFARGE | +| Etsuro Fujita | +| Euler Taveira | +| Evan Si | +| Evgeniy Gorbanev | +| Fabio R. Sluzala | +| Fabrízio de Royes Mello | +| Feike Steenbergen | +| Feliphe Pozzer | +| Felix | +| Fire Emerald | +| Florents Tselai | +| Francesco Degrassi | +| Frank Streitzig | +| Frédéric Yhuel | +| Fredrik Widlert | +| Gabriele Bartolini | +| Gavin Panella | +| Geoff Winkless | +| George MacKerron | +| Gilles Darold | +| Grant Gryczan | +| Greg Burd | +| Greg Sabino Mullane | +| Greg Stark | +| Grigory Kryachko | +| Guillaume Lelarge | +| Gunnar Morling | +| Gunnar Wagner | +| Gurjeet Singh | +| Haifang Wang | +| Hajime Matsunaga | +| Hamid Akhtar | +| Hannu Krosing | +| Hari Krishna Sunder | +| Haruka Takatsuka | +| Hayato Kuroda | +| Heikki Linnakangas | +| Hironobu Suzuki | +| Holger Jakobs | +| Hubert Lubaczewski | +| Hugo Dubois | +| Hugo Zhang | +| Hunaid Sohail | +| Hywel Carver | +| Ian Barwick | +| Ibrar Ahmed | +| Igor Gnatyuk | +| Igor Korot | +| Ilia Evdokimov | +| Ilya Gladyshev | +| Ilyasov Ian | +| Imran Zaheer | +| Isaac Morland | +| Israel Barth Rubio | +| Ivan Kush | +| Jacob Brazeal | +| Jacob Champion | +| Jaime Casanova | +| Jakob Egger | +| Jakub Wartak | +| James Coleman | +| James Hunter | +| Jan Behrens | +| Japin Li | +| Jason Smith | +| Jayesh Dehankar | +| Jeevan Chalke | +| Jeff Davis | +| Jehan-Guillaume de Rorthais | +| Jelte Fennema-Nio | +| Jian He | +| Jianghua Yang | +| Jiao Shuntian | +| Jim Jones | +| Jim Nasby | +| Jingtang Zhang | +| Jingzhou Fu | +| Joe Conway | +| Joel Jacobson | +| John Hutchins | +| John Naylor | +| Jonathan Katz | +| Jorge Solórzano | +| José Villanova | +| Josef Šimánek | +| Joseph Koshakow | +| Julien Rouhaud | +| Junwang Zhao | +| Justin Pryzby | +| Kaido Vaikla | +| Kaimeh | +| Karina Litskevich | +| Karthik S | +| Kartyshov Ivan | +| Kashif Zeeshan | +| Keisuke Kuroda | +| Kevin Hale Boyes | +| Kevin K Biju | +| Kirill Reshke | +| Kirill Zdornyy | +| Koen De Groote | +| Koichi Suzuki | +| Koki Nakamura | +| Konstantin Knizhnik | +| Kouhei Sutou | +| Kuntal Ghosh | +| Kyotaro Horiguchi | +| Lakshmi Narayana Velayudam | +| Lars Kanis | +| Laurence Parry | +| Laurenz Albe | +| Lele Gaifax | +| Li Yong | +| Lilian Ontowhee | +| Lingbin Meng | +| Luboslav Špilák | +| Luca Vallisa | +| Lukas Fittl | +| Maciek Sakrejda | +| Magnus Hagander | +| Mahendra Singh Thalor | +| Mahendrakar Srinivasarao | +| Maiquel Grassi | +| Maksim Korotkov | +| Maksim Melnikov | +| Man Zeng | +| Marat Buharov | +| Marc Balmer | +| Marco Nenciarini | +| Marcos Pegoraro | +| Marina Polyakova | +| Mark Callaghan | +| Mark Dilger | +| Marlene Brandstaetter | +| Marlene Reiterer | +| Martin Rakhmanov | +| Masahiko Sawada | +| Masahiro Ikeda | +| Masao Fujii | +| Mason Mackaman | +| Mat Arye | +| Matheus Alcantara | +| Mats Kindahl | +| Matthew Gabeler-Lee | +| Matthew Kim | +| Matthew Sterrett | +| Matthew Woodcraft | +| Matthias van de Meent | +| Matthieu Denais | +| Maurizio Boriani | +| Max Johnson | +| Max Madden | +| Maxim Boguk | +| Maxim Orlov | +| Maximilian Chrzan | +| Melanie Plageman | +| Melih Mutlu | +| Mert Alev | +| Michael Banck | +| Michael Bondarenko | +| Michael Christofides | +| Michael Guissine | +| Michael Harris | +| Michaël Paquier | +| Michail Nikolaev | +| Michal Kleczek | +| Michel Pelletier | +| Mikaël Gourlaouen | +| Mikhail Gribkov | +| Mikhail Kot | +| Milosz Chmura | +| Muralikrishna Bandaru | +| Murat Efendioglu | +| Mutaamba Maasha | +| Naeem Akhter | +| Nat Makarevitch | +| Nathan Bossart | +| Navneet Kumar | +| Nazir Bilal Yavuz | +| Neil Conway | +| Niccolò Fei | +| Nick Davies | +| Nicolas Maus | +| Niek Brasa | +| Nikhil Raj | +| Nikita | +| Nikita Kalinin | +| Nikita Malakhov | +| Nikolay Samokhvalov | +| Nikolay Shaplov | +| Nisha Moond | +| Nitin Jadhav | +| Nitin Motiani | +| Noah Misch | +| Noboru Saito | +| Noriyoshi Shinoda | +| Ole Peder Brandtzæg | +| Oleg Sibiryakov | +| Oleg Tselebrovskiy | +| Olleg Samoylov | +| Onder Kalaci | +| Ondrej Navratil | +| Patrick Stählin | +| Paul Amonson | +| Paul Jungwirth | +| Paul Ramsey | +| Pavel Borisov | +| Pavel Luzanov | +| Pavel Nekrasov | +| Pavel Stehule | +| Peter Eisentraut | +| Peter Geoghegan | +| Peter Mittere | +| Peter Smith | +| Phil Eaton | +| Philipp Salvisberg | +| Philippe Beaudoin | +| Pierre Giraud | +| Pixian Shi | +| Polina Bungina | +| Przemyslaw Sztoch | +| Quynh Tran | +| Rafia Sabih | +| Raghuveer Devulapalli | +| Rahila Syed | +| Rama Malladi | +| Ran Benita | +| Ranier Vilela | +| Renan Alves Fonseca | +| Richard Guo | +| Richard Neill | +| Rintaro Ikeda | +| Robert Haas | +| Robert Treat | +| Robins Tharakan | +| Roman Zharkov | +| Ronald Cruz | +| Ronan Dunklau | +| Rui Zhao | +| Rushabh Lathia | +| Rustam Allakov | +| Ryo Kanbayashi | +| Ryohei Takahashi | +| RyotaK | +| Sagar Dilip Shedge | +| Salvatore Dipietro | +| Sam Gabrielsson | +| Sam James | +| Sameer Kumar | +| Sami Imseih | +| Samuel Thibault | +| Satyanarayana Narlapuram | +| Sebastian Skalacki | +| Senglee Choi | +| Sergei Kornilov | +| Sergey Belyashov | +| Sergey Dudoladov | +| Sergey Prokhorenko | +| Sergey Sargsyan | +| Sergey Soloviev | +| Sergey Tatarintsev | +| Shaik Mohammad Mujeeb | +| Shawn McCoy | +| Shenhao Wang | +| Shihao Zhong | +| Shinya Kato | +| Shlok Kyal | +| Shubham Khanna | +| Shveta Malik | +| Simon Riggs | +| Smolkin Grigory | +| Sofia Kopikova | +| Song Hongyu | +| Song Jinzhou | +| Soumyadeep Chakraborty | +| Sravan Kumar | +| Srinath Reddy | +| Stan Hu | +| Stepan Neretin | +| Stephen Fewer | +| Stephen Frost | +| Steve Chavez | +| Steven Niu | +| Suraj Kharage | +| Sven Klemm | +| Takamichi Osumi | +| Takeshi Ideriha | +| Tatsuo Ishii | +| Ted Yu | +| Tels | +| Tender Wang | +| Teodor Sigaev | +| Thom Brown | +| Thomas Baehler | +| Thomas Krennwallner | +| Thomas Munro | +| Tim Wood | +| Timur Magomedov | +| Tobias Wendorff | +| Todd Cook | +| Tofig Aliev | +| Tom Lane | +| Tomas Vondra | +| Tomasz Rybak | +| Tomasz Szypowski | +| Torsten Foertsch | +| Toshi Harada | +| Tristan Partin | +| Triveni N | +| Umar Hayat | +| Vallimaharajan G | +| Vasya Boytsov | +| Victor Yegorov | +| Vignesh C | +| Viktor Holmberg | +| Vinícius Abrahão | +| Vinod Sridharan | +| Virender Singla | +| Vitaly Davydov | +| Vladlen Popolitov | +| Vladyslav Nebozhyn | +| Walid Ibrahim | +| Webbo Han | +| Wenhui Qiu | +| Will Mortensen | +| Will Storey | +| Wolfgang Walther | +| Xin Zhang | +| Xing Guo | +| Xuneng Zhou | +| Yan Chengpen | +| Yang Lei | +| Yaroslav Saburov | +| Yaroslav Syrytsia | +| Yasir Hussain | +| Yasuo Honda | +| Yogesh Sharma | +| Yonghao Lee | +| Yoran Heling | +| Yu Liang | +| Yugo Nagata | +| Yuhang Qiu | +| Yuki Seino | +| Yura Sokolov | +| Yurii Rashkovskii | +| Yushi Ogiwara | +| Yusuke Sugie | +| Yuta Katsuragi | +| Yuto Sasaki | +| Yuuki Fujii | +| Yuya Watari | +| Zane Duffield | +| Zeyuan Hu | +| Zhang Mingli | +| Zhihong Yu | +| Zhijie Hou | +| Zsolt Parragi | + +--- + +| | | | +| --- | --- | --- | +| [Prev](release-18-1.html "E.1. Release 18.1") | [Up](release.html "Appendix E. Release Notes") | [Next](release-prior.html "E.3. Prior Releases") | +| E.1. Release 18.1 | [Home](index.html "PostgreSQL 18.1 Documentation") | E.3. Prior Releases | + +[Return to the Release Notes Archive](/docs/release/) + +[Next](/docs/release/18.1/) diff --git a/corpus/changelog/postgresql_releases/postgresql_181.md b/corpus/changelog/postgresql_releases/postgresql_181.md new file mode 100644 index 0000000000000000000000000000000000000000..0eb59d3f5c049a84cfb430bfe63bf8847810a10e --- /dev/null +++ b/corpus/changelog/postgresql_releases/postgresql_181.md @@ -0,0 +1,171 @@ +# Release Notes + +Source: https://www.postgresql.org/docs/release/18.1/ +Version: 18.1 + +## PostgreSQL 18.1 + +| E.1. Release 18.1 | | | | | +| --- | --- | --- | --- | --- | +| [Prev](release.html "Appendix E. Release Notes") | [Up](release.html "Appendix E. Release Notes") | Appendix E. Release Notes | [Home](index.html "PostgreSQL 18.1 Documentation") | [Next](release-18.html "E.2. Release 18") | + +--- + +## E.1. Release 18.1 [#](#RELEASE-18-1) + +[E.1.1. Migration to Version 18.1](release-18-1.html#RELEASE-18-1-MIGRATION) + +[E.1.2. Changes](release-18-1.html#RELEASE-18-1-CHANGES) + +**Release date:**2025-11-13 + +This release contains a variety of fixes from 18.0. For information about new features in major release 18, see [Section E.2](release-18.html "E.2. Release 18"). + +### E.1.1. Migration to Version 18.1 [#](#RELEASE-18-1-MIGRATION) + +A dump/restore is not required for those running 18.X. + +### E.1.2. Changes [#](#RELEASE-18-1-CHANGES) + +* Check for `CREATE` privileges on the schema in `CREATE STATISTICS` (Jelte Fennema-Nio) [§](https://postgr.es/c/00eb646ea) + + This omission allowed table owners to create statistics in any schema, potentially leading to unexpected naming conflicts. + + The PostgreSQL Project thanks Jelte Fennema-Nio for reporting this problem. (CVE-2025-12817) +* Avoid integer overflow in allocation-size calculations within libpq (Jacob Champion) [§](https://postgr.es/c/7eb8fcad8) + + Several places in libpq were not sufficiently careful about computing the required size of a memory allocation. Sufficiently large inputs could cause integer overflow, resulting in an undersized buffer, which would then lead to writing past the end of the buffer. + + The PostgreSQL Project thanks Aleksey Solovev of Positive Technologies for reporting this problem. (CVE-2025-12818) +* Prevent “unrecognized node type” errors when a SQL/JSON function such as `JSON_VALUE` has a `DEFAULT` clause containing a `COLLATE` expression (Jian He) [§](https://postgr.es/c/dc9125111) [§](https://postgr.es/c/1baae827e) +* Avoid incorrect optimization of variable-free `HAVING` clauses with grouping sets (Richard Guo) [§](https://postgr.es/c/40c242830) [§](https://postgr.es/c/ee49f2cf4) +* Do not use parallelism in hash right semi joins (Richard Guo) [§](https://postgr.es/c/ef6168baf) + + The case does not work reliably due to a race condition in updating the join's shared hash table. +* Avoid possible division-by-zero when creating ordered-append plans (Richard Guo) [§](https://postgr.es/c/500f64636) + + This mistake could result in incorrect selection of the cheapest path, or in an assertion failure in debug builds. +* Fix planner failure with index types that can do ordered access but not index-only scans (Maxime Schoemans) [§](https://postgr.es/c/74197bdc8) + + This oversight resulted in errors like “no data returned for index-only scan”. The case does not arise with any in-core index type, but some extensions encountered the problem. +* Remove faulty assertion in btree index cleanup (Peter Geoghegan) [§](https://postgr.es/c/61de81a49) +* Avoid possible out-of-memory or “invalid memory alloc request size” failures during parallel GIN index build (Tomas Vondra) [§](https://postgr.es/c/a26b753a0) +* Ensure that BRIN autosummarization provides a snapshot for index expressions that need one (Álvaro Herrera) [§](https://postgr.es/c/419ffde23) [§](https://postgr.es/c/8733f0b54) + + Previously, autosummarization would fail for such indexes, and then leave placeholder index tuples behind, causing the index to bloat over time. +* Fix integer-overflow hazard in BRIN index scans when the table contains close to 232 pages (Sunil S) [§](https://postgr.es/c/715983a81) + + This oversight could result in an infinite loop or scanning of unneeded table pages. +* Fix incorrect zero-extension of stored values in JIT-generated tuple deforming code (David Rowley) [§](https://postgr.es/c/ceb51d09b) + + When not using JIT, the equivalent code does sign-extension not zero-extension, leading to a different Datum representation of small integer data types. This inconsistency was masked in most cases, but it is known to lead to “could not find memoization table entry” errors when using Memoize plan nodes, and there might be other symptoms. +* Fix rare crash when processing hashed `GROUPING SETS` queries (David Rowley) [§](https://postgr.es/c/0b6a02f03) +* Repair faulty hash-table-size-choosing logic in hash joins (Tomas Vondra) [§](https://postgr.es/c/aa151022e) + + Hash joins sometimes used more memory than intended, or failed to divide it in an efficient way. +* Improve relation lookup logic in statistics manipulation functions (Nathan Bossart) [§](https://postgr.es/c/c8af5019b) [§](https://postgr.es/c/15d7dded0) + + Fix `pg_restore_relation_stats()`, `pg_clear_relation_stats()`, `pg_restore_attribute_stats()`, and `pg_clear_attribute_stats()` to check privileges before acquiring lock on the target relation rather than after. +* Fix incorrect logic for caching result-relation information for triggers (David Rowley, Amit Langote) [§](https://postgr.es/c/a2387c32f) + + In cases where partitions' column sets aren't physically identical to their parent partitioned tables' column sets, this oversight could lead to crashes. +* Fix crash during EvalPlanQual rechecks on partitioned tables (David Rowley, Amit Langote) [§](https://postgr.es/c/1296dcf18) +* Fix EvalPlanQual handling of foreign or custom joins that do not have an alternative local-join plan prepared for EPQ (Masahiko Sawada, Etsuro Fujita) [§](https://postgr.es/c/b14144325) + + In such cases the foreign or custom access method should be invoked normally, but that did not happen, typically leading to a crash. +* Avoid duplicating hash partition constraints during `DETACH CONCURRENTLY` (Haiyang Li) [§](https://postgr.es/c/08c037dff) + + `ALTER TABLE DETACH PARTITION CONCURRENTLY` was written to add a copy of the partitioning constraint to the now-detached partition. This was misguided, partially because non-concurrent `DETACH` doesn't do that, but mostly because in the case of hash partitioning the constraint expression contains references to the parent table's OID. That causes problems during dump/restore, or if the parent table is dropped after `DETACH`. In v19 and later, we'll no longer create any such copied constraints at all. In released branches, to minimize the risk of unforeseen consequences, only skip adding a copied constraint if it is for hash partitioning. +* Disallow generated columns in partition keys (Jian He, Ashutosh Bapat) [§](https://postgr.es/c/ba99c9491) + + This was already not allowed, but the check missed some cases, such as where the column reference is implicit in a whole-row reference. +* Disallow generated columns in `COPY ... FROM ... WHERE` clauses (Peter Eisentraut, Jian He) [§](https://postgr.es/c/0f9e0068b) + + Previously, incorrect behavior or an obscure error message resulted from attempting to reference such a column, since generated columns have not yet been computed at the point where `WHERE` filtering is done. +* Prevent setting a column as identity if it has a not-null constraint but the constraint is marked as invalid (Jian He) [§](https://postgr.es/c/d9ffc2729) + + Identity columns must be not-null, but the check for that missed this edge case. +* Avoid potential use-after-free in parallel vacuum (Kevin Oommen Anish) [§](https://postgr.es/c/76613b539) + + This bug seems to have no consequences in standard builds, but it's theoretically a hazard. +* Fix visibility checking for statistics objects in `pg_temp` (Noah Misch) [§](https://postgr.es/c/d024160ff) + + A statistics object located in a temporary schema cannot be named without schema qualification, but `pg_statistics_obj_is_visible()` missed that memo and could return “true” regardless. In turn, functions such as `pg_describe_object()` could fail to schema-qualify the object's name as expected. +* Fix minor memory leak during WAL replay of database creation (Nathan Bossart) [§](https://postgr.es/c/33e7b4a7c) +* Fix incorrect reporting of replication lag in `pg_stat_replication` view (Fujii Masao) [§](https://postgr.es/c/9670032cc) + + If any standby server's replay LSN stopped advancing, the `write_lag` and `flush_lag` columns would eventually stop updating. +* Avoid duplicative log messages about invalid `primary_slot_name` settings (Fujii Masao) [§](https://postgr.es/c/6ff7ba9fe) +* Avoid failures when `synchronized_standby_slots` references nonexistent replication slots (Shlok Kyal) [§](https://postgr.es/c/b45a8d7d8) +* Remove the unfinished slot state file after failing to write a replication slot's state to disk (Michael Paquier) [§](https://postgr.es/c/9a6ea00ac) + + Previously, a failure such as out-of-disk-space resulted in leaving a temporary `state.tmp` file behind. That's problematic because it would block all subsequent attempts to write the state, requiring manual intervention to clean up. +* Fix mishandling of lock timeout signals in parallel apply workers for logical replication (Hayato Kuroda) [§](https://postgr.es/c/37fc5de43) + + The same signal number was being used for both worker shutdown and lock timeout, leading to confusion. +* Avoid unwanted WAL receiver shutdown when switching from streaming to archive WAL source (Xuneng Zhou) [§](https://postgr.es/c/a14201073) + + During a timeline change, a standby server's WAL receiver should remain alive, waiting for a new WAL streaming start point. Instead it was repeatedly shutting down and immediately getting restarted, which could confuse status monitoring code. +* Fix use-after-free issue in the relation synchronization cache maintained by the pgoutput logical decoding plugin (Vignesh C, Masahiko Sawada) [§](https://postgr.es/c/32b95fc71) + + An error during logical decoding could result in crashes in subsequent logical decoding attempts in the same session. The case is only reachable when pgoutput is invoked via SQL functions. +* Avoid unnecessary invalidation of logical replication slots (Bertrand Drouvot) [§](https://postgr.es/c/bf3dba508) +* Re-establish special case for `C` collation in locale setup (Jeff Davis) [§](https://postgr.es/c/3ebea75f9) + + This fixes a regression in access to shared catalogs early in backend startup, before a database has been selected. It is not known to be a problem for any core PostgreSQL code, but some extensions were broken. +* Fix incorrect printing of messages about failures in checking whether the user has Windows administrator privilege (Bryan Green) [§](https://postgr.es/c/b48ae226e) + + This code would have crashed or at least printed garbage. No such cases have been reported though, indicating that failure of these system calls is extremely rare. +* Avoid crash when attempting to test PostgreSQL with certain libsanitizer options (Emmanuel Sibi, Jacob Champion) [§](https://postgr.es/c/6d8acb777) +* Fix false memory-context-checking warnings in debug builds on 64-bit Windows (David Rowley) [§](https://postgr.es/c/af3a79e08) +* Correctly handle `GROUP BY DISTINCT` in PL/pgSQL assignment statements (Tom Lane) [§](https://postgr.es/c/78a284b0b) + + The parser failed to record the `DISTINCT` option in this context, so that the command would act as if it were plain `GROUP BY`. +* Avoid leaking memory when handling a SQL error within PL/Python (Tom Lane) [§](https://postgr.es/c/447a794f6) + + This fixes a session-lifespan memory leak introduced in our previous minor releases. +* Fix libpq's handling of socket-related errors on Windows within its GSSAPI logic (Ning Wu, Tom Lane) [§](https://postgr.es/c/d83879a32) + + The code for encrypting/decrypting transmitted data using GSSAPI did not correctly recognize error conditions on the connection socket, since Windows reports those differently than other platforms. This led to failure to make such connections on Windows. +* Fix dumping of non-inherited not-null constraints on inherited table columns (Dilip Kumar) [§](https://postgr.es/c/0fe07fa11) + + pg\_dump failed to preserve such constraints when dumping from a pre-v18 server. +* Fix pg\_dump's sorting of foreign key constraints (Álvaro Herrera) [§](https://postgr.es/c/162e70ea0) + + Ensure consistent ordering of these database objects, as was already done for other object types. +* Fix assorted errors in the data compression logic in pg\_dump and pg\_restore (Daniel Gustafsson, Tom Lane) [§](https://postgr.es/c/8980c724b) [§](https://postgr.es/c/6a4009747) [§](https://postgr.es/c/aa1fcd087) + + Error checking was missing or incorrect in several places, and there were also portability issues that would manifest on big-endian hardware. These problems had been missed because this code is only used to read compressed TOC files within directory-format dumps. pg\_dump never produces such a dump; the case can be reached only by manually compressing the TOC file after the fact, which is a supported thing to do but very uncommon. +* Fix pgbench to error out cleanly if a `COPY` operation is started (Anthonin Bonnefoy) [§](https://postgr.es/c/c00637b5f) + + pgbench doesn't intend to support this case, but previously it went into an infinite loop. +* Fix pgbench's reporting of multiple errors (Yugo Nagata) [§](https://postgr.es/c/29aabbc43) + + In cases where two successive `PQgetResult` calls both fail, pgbench might report the wrong error message. +* In pgbench, fix faulty assertion about errors in pipeline mode (Yugo Nagata) [§](https://postgr.es/c/c736808e0) +* Fix per-file memory leakage in pg\_combinebackup (Tom Lane) [§](https://postgr.es/c/e2072b47b) +* Ensure that `contrib/pg_buffercache` functions can be canceled (Satyanarayana Narlapuram, Yuhang Qiu) [§](https://postgr.es/c/71aa2e114) [§](https://postgr.es/c/0beb7e933) + + Some code paths were capable of running for a long time without checking for interrupts. +* Fix `contrib/pg_prewarm`'s privilege checks for indexes (Ayush Vatsa, Nathan Bossart) [§](https://postgr.es/c/3ccf8e9ac) [§](https://postgr.es/c/c29d32d27) + + `pg_prewarm()` requires `SELECT` privilege on relations to be prewarmed. However, since indexes have no SQL privileges of their own, this resulted in non-superusers being unable to prewarm indexes. Instead, check for `SELECT` privilege on the index's table. +* In `contrib/pg_stat_statements`, avoid crash when two or more constants are marked as having the same location in the SQL statement text (Sami Imseih, Dmitry Dolgov) [§](https://postgr.es/c/b1635c166) +* Make `contrib/pgstattuple` more robust about empty or invalid index pages (Nitin Motiani) [§](https://postgr.es/c/fc295beb7) + + Count all-zero pages as free space, and ignore pages that are invalid according to a check of the page's special-space size. The code for btree indexes already counted all-zero pages as free, but the hash and gist code would error out, which has been found to be much less user-friendly. Similarly, make all three cases agree on ignoring corrupted pages rather than throwing errors. +* Harden our read and write barrier macros to satisfy Clang (Thomas Munro) [§](https://postgr.es/c/f8ccab0e9) + + We supposed that `__atomic_thread_fence()` is a sufficient barrier to prevent the C compiler from re-ordering memory accesses around it, but it appears that that's not true for Clang, allowing it to generate incorrect code for at least RISC-V, MIPS, and LoongArch machines. Add explicit compiler barriers to fix that. +* Fix PGXS build infrastructure to support building NLS `po` files for extensions (Ryo Matsumura) [§](https://postgr.es/c/6aa04a60c) + +--- + +| | | | +| --- | --- | --- | +| [Prev](release.html "Appendix E. Release Notes") | [Up](release.html "Appendix E. Release Notes") | [Next](release-18.html "E.2. Release 18") | +| Appendix E. Release Notes | [Home](index.html "PostgreSQL 18.1 Documentation") | E.2. Release 18 | + +[Previous](/docs/release/18.0/) + +[Return to the Release Notes Archive](/docs/release/) diff --git a/corpus/changelog/scipy_releases/scipy_100.md b/corpus/changelog/scipy_releases/scipy_100.md new file mode 100644 index 0000000000000000000000000000000000000000..64a129455a52d51c0075d671d8b989310869c317 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_100.md @@ -0,0 +1,910 @@ +# SciPy 1.0.0 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.0.0-notes.html +Version: 1.0.0 + +Contents + +* [SciPy 1.0.0 Release Notes](#scipy-1-0-0-release-notes) + + + [Why 1.0 now?](#why-1-0-now) + + [Some history and perspectives](#some-history-and-perspectives) + + [Highlights of this release](#highlights-of-this-release) + + [Upgrading and compatibility](#upgrading-and-compatibility) + + - [New features](#new-features) + + [[`scipy.cluster`](../reference/cluster.html#module-scipy.cluster "scipy.cluster") improvements](#scipy-cluster-improvements) + + [[`scipy.fftpack`](../reference/fftpack.html#module-scipy.fftpack "scipy.fftpack") improvements](#scipy-fftpack-improvements) + + [[`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") improvements](#scipy-integrate-improvements) + + [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#scipy-linalg-improvements) + + [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#scipy-ndimage-improvements) + + [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#scipy-optimize-improvements) + + [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#scipy-signal-improvements) + + [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#scipy-sparse-improvements) + + [[`scipy.sparse.linalg`](../reference/sparse.linalg.html#module-scipy.sparse.linalg "scipy.sparse.linalg") improvements](#scipy-sparse-linalg-improvements) + + [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#scipy-spatial-improvements) + + [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#scipy-stats-improvements) + + - [Deprecated features](#deprecated-features) + - [Backwards incompatible changes](#backwards-incompatible-changes) + - [Other changes](#other-changes) + - [Authors](#authors) + + [Issues closed for 1.0.0](#issues-closed-for-1-0-0) + + [Pull requests for 1.0.0](#pull-requests-for-1-0-0) + +We are extremely pleased to announce the release of SciPy 1.0, 16 years after +version 0.1 saw the light of day. It has been a long, productive journey to +get here, and we anticipate many more exciting new features and releases in the +future. + +## [Why 1.0 now?](#id2)[#](#why-1-0-now "Link to this heading") + +A version number should reflect the maturity of a project - and SciPy was a +mature and stable library that is heavily used in production settings for a +long time already. From that perspective, the 1.0 version number is long +overdue. + +Some key project goals, both technical (e.g. Windows wheels and continuous +integration) and organisational (a governance structure, code of conduct and a +roadmap), have been achieved recently. + +Many of us are a bit perfectionist, and therefore are reluctant to call +something “1.0” because it may imply that it’s “finished” or “we are 100% happy +with it”. This is normal for many open source projects, however that doesn’t +make it right. We acknowledge to ourselves that it’s not perfect, and there +are some dusty corners left (that will probably always be the case). Despite +that, SciPy is extremely useful to its users, on average has high quality code +and documentation, and gives the stability and backwards compatibility +guarantees that a 1.0 label imply. + +## [Some history and perspectives](#id3)[#](#some-history-and-perspectives "Link to this heading") + +* 2001: the first SciPy release +* 2005: transition to NumPy +* 2007: creation of scikits +* 2008: scipy.spatial module and first Cython code added +* 2010: moving to a 6-monthly release cycle +* 2011: SciPy development moves to GitHub +* 2011: Python 3 support +* 2012: adding a sparse graph module and unified optimization interface +* 2012: removal of scipy.maxentropy +* 2013: continuous integration with TravisCI +* 2015: adding Cython interface for BLAS/LAPACK and a benchmark suite +* 2017: adding a unified C API with scipy.LowLevelCallable; removal of scipy.weave +* 2017: SciPy 1.0 release + +**Pauli Virtanen** is SciPy’s Benevolent Dictator For Life (BDFL). He says: + +*Truthfully speaking, we could have released a SciPy 1.0 a long time ago, so I’m +happy we do it now at long last. The project has a long history, and during the +years it has matured also as a software project. I believe it has well proved +its merit to warrant a version number starting with unity.* + +*Since its conception 15+ years ago, SciPy has largely been written by and for +scientists, to provide a box of basic tools that they need. Over time, the set +of people active in its development has undergone some rotation, and we have +evolved towards a somewhat more systematic approach to development. Regardless, +this underlying drive has stayed the same, and I think it will also continue +propelling the project forward in future. This is all good, since not long +after 1.0 comes 1.1.* + +**Travis Oliphant** is one of SciPy’s creators. He says: + +*I’m honored to write a note of congratulations to the SciPy developers and the +entire SciPy community for the release of SciPy 1.0. This release represents +a dream of many that has been patiently pursued by a stalwart group of pioneers +for nearly 2 decades. Efforts have been broad and consistent over that time +from many hundreds of people. From initial discussions to efforts coding and +packaging to documentation efforts to extensive conference and community +building, the SciPy effort has been a global phenomenon that it has been a +privilege to participate in.* + +*The idea of SciPy was already in multiple people’s minds in 1997 when I first +joined the Python community as a young graduate student who had just fallen in +love with the expressibility and extensibility of Python. The internet was +just starting to bringing together like-minded mathematicians and scientists in +nascent electronically-connected communities. In 1998, there was a concerted +discussion on the matrix-SIG, python mailing list with people like Paul +Barrett, Joe Harrington, Perry Greenfield, Paul Dubois, Konrad Hinsen, David +Ascher, and others. This discussion encouraged me in 1998 and 1999 to +procrastinate my PhD and spend a lot of time writing extension modules to +Python that mostly wrapped battle-tested Fortran and C-code making it available +to the Python user. This work attracted the help of others like Robert Kern, +Pearu Peterson and Eric Jones who joined their efforts with mine in 2000 so +that by 2001, the first SciPy release was ready. This was long before Github +simplified collaboration and input from others and the “patch” command and +email was how you helped a project improve.* + +*Since that time, hundreds of people have spent an enormous amount of time +improving the SciPy library and the community surrounding this library has +dramatically grown. I stopped being able to participate actively in developing +the SciPy library around 2010. Fortunately, at that time, Pauli Virtanen and +Ralf Gommers picked up the pace of development supported by dozens of other key +contributors such as David Cournapeau, Evgeni Burovski, Josef Perktold, and +Warren Weckesser. While I have only been able to admire the development of +SciPy from a distance for the past 7 years, I have never lost my love of the +project and the concept of community-driven development. I remain driven +even now by a desire to help sustain the development of not only the SciPy +library but many other affiliated and related open-source projects. I am +extremely pleased that SciPy is in the hands of a world-wide community of +talented developers who will ensure that SciPy remains an example of how +grass-roots, community-driven development can succeed.* + +**Fernando Perez** offers a wider community perspective: + +*The existence of a nascent Scipy library, and the incredible –if tiny by +today’s standards– community surrounding it is what drew me into the +scientific Python world while still a physics graduate student in 2001. Today, +I am awed when I see these tools power everything from high school education to +the research that led to the 2017 Nobel Prize in physics.* + +*Don’t be fooled by the 1.0 number: this project is a mature cornerstone of the +modern scientific computing ecosystem. I am grateful for the many who have +made it possible, and hope to be able to contribute again to it in the future. +My sincere congratulations to the whole team!* + +## [Highlights of this release](#id4)[#](#highlights-of-this-release "Link to this heading") + +Some of the highlights of this release are: + +* Major build improvements. Windows wheels are available on PyPI for the + first time, and continuous integration has been set up on Windows and OS X + in addition to Linux. +* A set of new ODE solvers and a unified interface to them + ([`scipy.integrate.solve_ivp`](../reference/generated/scipy.integrate.solve_ivp.html#scipy.integrate.solve_ivp "scipy.integrate.solve_ivp")). +* Two new trust region optimizers and a new linear programming method, with + improved performance compared to what [`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") offered previously. +* Many new BLAS and LAPACK functions were wrapped. The BLAS wrappers are now + complete. + +## [Upgrading and compatibility](#id5)[#](#upgrading-and-compatibility "Link to this heading") + +There have been a number of deprecations and API changes in this release, which +are documented below. Before upgrading, we recommend that users check that +their own code does not use deprecated SciPy functionality (to do so, run your +code with `python -Wd` and check for `DeprecationWarning` s). + +This release requires Python 2.7 or >=3.4 and NumPy 1.8.2 or greater. + +This is also the last release to support LAPACK 3.1.x - 3.3.x. Moving the +lowest supported LAPACK version to >3.2.x was long blocked by Apple Accelerate +providing the LAPACK 3.2.1 API. We have decided that it’s time to either drop +Accelerate or, if there is enough interest, provide shims for functions added +in more recent LAPACK versions so it can still be used. + +### [New features](#id6)[#](#new-features "Link to this heading") + +## [[`scipy.cluster`](../reference/cluster.html#module-scipy.cluster "scipy.cluster") improvements](#id7)[#](#scipy-cluster-improvements "Link to this heading") + +[`scipy.cluster.hierarchy.optimal_leaf_ordering`](../reference/generated/scipy.cluster.hierarchy.optimal_leaf_ordering.html#scipy.cluster.hierarchy.optimal_leaf_ordering "scipy.cluster.hierarchy.optimal_leaf_ordering"), a function to reorder a +linkage matrix to minimize distances between adjacent leaves, was added. + +## [[`scipy.fftpack`](../reference/fftpack.html#module-scipy.fftpack "scipy.fftpack") improvements](#id8)[#](#scipy-fftpack-improvements "Link to this heading") + +N-dimensional versions of the discrete sine and cosine transforms and their +inverses were added as `dctn`, `idctn`, `dstn` and `idstn`. + +## [[`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") improvements](#id9)[#](#scipy-integrate-improvements "Link to this heading") + +A set of new ODE solvers have been added to [`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate"). The convenience +function [`scipy.integrate.solve_ivp`](../reference/generated/scipy.integrate.solve_ivp.html#scipy.integrate.solve_ivp "scipy.integrate.solve_ivp") allows uniform access to all solvers. +The individual solvers (`RK23`, `RK45`, `Radau`, `BDF` and `LSODA`) +can also be used directly. + +## [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#id10)[#](#scipy-linalg-improvements "Link to this heading") + +The BLAS wrappers in [`scipy.linalg.blas`](../reference/linalg.blas.html#module-scipy.linalg.blas "scipy.linalg.blas") have been completed. Added functions +are `*gbmv`, `*hbmv`, `*hpmv`, `*hpr`, `*hpr2`, `*spmv`, `*spr`, +`*tbmv`, `*tbsv`, `*tpmv`, `*tpsv`, `*trsm`, `*trsv`, `*sbmv`, +`*spr2`, + +Wrappers for the LAPACK functions `*gels`, `*stev`, `*sytrd`, `*hetrd`, +`*sytf2`, `*hetrf`, `*sytrf`, `*sycon`, `*hecon`, `*gglse`, +`*stebz`, `*stemr`, `*sterf`, and `*stein` have been added. + +The function [`scipy.linalg.subspace_angles`](../reference/generated/scipy.linalg.subspace_angles.html#scipy.linalg.subspace_angles "scipy.linalg.subspace_angles") has been added to compute the +subspace angles between two matrices. + +The function [`scipy.linalg.clarkson_woodruff_transform`](../reference/generated/scipy.linalg.clarkson_woodruff_transform.html#scipy.linalg.clarkson_woodruff_transform "scipy.linalg.clarkson_woodruff_transform") has been added. +It finds low-rank matrix approximation via the Clarkson-Woodruff Transform. + +The functions [`scipy.linalg.eigh_tridiagonal`](../reference/generated/scipy.linalg.eigh_tridiagonal.html#scipy.linalg.eigh_tridiagonal "scipy.linalg.eigh_tridiagonal") and +[`scipy.linalg.eigvalsh_tridiagonal`](../reference/generated/scipy.linalg.eigvalsh_tridiagonal.html#scipy.linalg.eigvalsh_tridiagonal "scipy.linalg.eigvalsh_tridiagonal"), which find the eigenvalues and +eigenvectors of tridiagonal hermitian/symmetric matrices, were added. + +## [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#id11)[#](#scipy-ndimage-improvements "Link to this heading") + +Support for homogeneous coordinate transforms has been added to +[`scipy.ndimage.affine_transform`](../reference/generated/scipy.ndimage.affine_transform.html#scipy.ndimage.affine_transform "scipy.ndimage.affine_transform"). + +The `ndimage` C code underwent a significant refactoring, and is now +a lot easier to understand and maintain. + +## [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#id12)[#](#scipy-optimize-improvements "Link to this heading") + +The methods `trust-region-exact` and `trust-krylov` have been added to the +function [`scipy.optimize.minimize`](../reference/generated/scipy.optimize.minimize.html#scipy.optimize.minimize "scipy.optimize.minimize"). These new trust-region methods solve the +subproblem with higher accuracy at the cost of more Hessian factorizations +(compared to dogleg) or more matrix vector products (compared to ncg) but +usually require less nonlinear iterations and are able to deal with indefinite +Hessians. They seem very competitive against the other Newton methods +implemented in scipy. + +[`scipy.optimize.linprog`](../reference/generated/scipy.optimize.linprog.html#scipy.optimize.linprog "scipy.optimize.linprog") gained an interior point method. Its performance is +superior (both in accuracy and speed) to the older simplex method. + +## [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#id13)[#](#scipy-signal-improvements "Link to this heading") + +An argument `fs` (sampling frequency) was added to the following functions: +`firwin`, `firwin2`, `firls`, and `remez`. This makes these functions +consistent with many other functions in [`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") in which the sampling +frequency can be specified. + +[`scipy.signal.freqz`](../reference/generated/scipy.signal.freqz.html#scipy.signal.freqz "scipy.signal.freqz") has been sped up significantly for FIR filters. + +## [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#id14)[#](#scipy-sparse-improvements "Link to this heading") + +Iterating over and slicing of CSC and CSR matrices is now faster by up to ~35%. + +The `tocsr` method of COO matrices is now several times faster. + +The `diagonal` method of sparse matrices now takes a parameter, indicating +which diagonal to return. + +## [[`scipy.sparse.linalg`](../reference/sparse.linalg.html#module-scipy.sparse.linalg "scipy.sparse.linalg") improvements](#id15)[#](#scipy-sparse-linalg-improvements "Link to this heading") + +A new iterative solver for large-scale nonsymmetric sparse linear systems, +[`scipy.sparse.linalg.gcrotmk`](../reference/generated/scipy.sparse.linalg.gcrotmk.html#scipy.sparse.linalg.gcrotmk "scipy.sparse.linalg.gcrotmk"), was added. It implements `GCROT(m,k)`, a +flexible variant of `GCROT`. + +[`scipy.sparse.linalg.lsmr`](../reference/generated/scipy.sparse.linalg.lsmr.html#scipy.sparse.linalg.lsmr "scipy.sparse.linalg.lsmr") now accepts an initial guess, yielding potentially +faster convergence. + +SuperLU was updated to version 5.2.1. + +## [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#id16)[#](#scipy-spatial-improvements "Link to this heading") + +Many distance metrics in [`scipy.spatial.distance`](../reference/spatial.distance.html#module-scipy.spatial.distance "scipy.spatial.distance") gained support for weights. + +The signatures of [`scipy.spatial.distance.pdist`](../reference/generated/scipy.spatial.distance.pdist.html#scipy.spatial.distance.pdist "scipy.spatial.distance.pdist") and +[`scipy.spatial.distance.cdist`](../reference/generated/scipy.spatial.distance.cdist.html#scipy.spatial.distance.cdist "scipy.spatial.distance.cdist") were changed to `*args, **kwargs` in order to +support a wider range of metrics (e.g. string-based metrics that need extra +keywords). Also, an optional `out` parameter was added to `pdist` and +`cdist` allowing the user to specify where the resulting distance matrix is +to be stored + +## [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#id17)[#](#scipy-stats-improvements "Link to this heading") + +The methods `cdf` and `logcdf` were added to +[`scipy.stats.multivariate_normal`](../reference/generated/scipy.stats.multivariate_normal.html#scipy.stats.multivariate_normal "scipy.stats.multivariate_normal"), providing the cumulative distribution +function of the multivariate normal distribution. + +New statistical distance functions were added, namely +[`scipy.stats.wasserstein_distance`](../reference/generated/scipy.stats.wasserstein_distance.html#scipy.stats.wasserstein_distance "scipy.stats.wasserstein_distance") for the first Wasserstein distance and +[`scipy.stats.energy_distance`](../reference/generated/scipy.stats.energy_distance.html#scipy.stats.energy_distance "scipy.stats.energy_distance") for the energy distance. + +### [Deprecated features](#id18)[#](#deprecated-features "Link to this heading") + +The following functions in *scipy.misc* are deprecated: `bytescale`, +`fromimage`, `imfilter`, `imread`, `imresize`, `imrotate`, +`imsave`, `imshow` and `toimage`. Most of those functions have unexpected +behavior (like rescaling and type casting image data without the user asking +for that). Other functions simply have better alternatives. + +`scipy.interpolate.interpolate_wrapper` and all functions in that submodule +are deprecated. This was a never finished set of wrapper functions which is +not relevant anymore. + +The `fillvalue` of [`scipy.signal.convolve2d`](../reference/generated/scipy.signal.convolve2d.html#scipy.signal.convolve2d "scipy.signal.convolve2d") will be cast directly to the +dtypes of the input arrays in the future and checked that it is a scalar or +an array with a single element. + +`scipy.spatial.distance.matching` is deprecated. It is an alias of +[`scipy.spatial.distance.hamming`](../reference/generated/scipy.spatial.distance.hamming.html#scipy.spatial.distance.hamming "scipy.spatial.distance.hamming"), which should be used instead. + +Implementation of *scipy.spatial.distance.wminkowski* was based on a wrong +interpretation of the metric definition. In scipy 1.0 it has been just +deprecated in the documentation to keep retro-compatibility but is recommended +to use the new version of [`scipy.spatial.distance.minkowski`](../reference/generated/scipy.spatial.distance.minkowski.html#scipy.spatial.distance.minkowski "scipy.spatial.distance.minkowski") that implements +the correct behaviour. + +Positional arguments of [`scipy.spatial.distance.pdist`](../reference/generated/scipy.spatial.distance.pdist.html#scipy.spatial.distance.pdist "scipy.spatial.distance.pdist") and +[`scipy.spatial.distance.cdist`](../reference/generated/scipy.spatial.distance.cdist.html#scipy.spatial.distance.cdist "scipy.spatial.distance.cdist") should be replaced with their keyword version. + +### [Backwards incompatible changes](#id19)[#](#backwards-incompatible-changes "Link to this heading") + +The following deprecated functions have been removed from [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats"): +`betai`, `chisqprob`, `f_value`, `histogram`, `histogram2`, +`pdf_fromgamma`, `signaltonoise`, `square_of_sums`, `ss` and +`threshold`. + +The following deprecated functions have been removed from [`scipy.stats.mstats`](../reference/stats.mstats.html#module-scipy.stats.mstats "scipy.stats.mstats"): +`betai`, `f_value_wilks_lambda`, `signaltonoise` and `threshold`. + +The deprecated `a` and `reta` keywords have been removed from +[`scipy.stats.shapiro`](../reference/generated/scipy.stats.shapiro.html#scipy.stats.shapiro "scipy.stats.shapiro"). + +The deprecated functions `sparse.csgraph.cs_graph_components` and +`sparse.linalg.symeig` have been removed from [`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse"). + +The following deprecated keywords have been removed in [`scipy.sparse.linalg`](../reference/sparse.linalg.html#module-scipy.sparse.linalg "scipy.sparse.linalg"): +`drop_tol` from `splu`, and `xtype` from `bicg`, `bicgstab`, `cg`, +`cgs`, `gmres`, `qmr` and `minres`. + +The deprecated functions `expm2` and `expm3` have been removed from +[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg"). The deprecated keyword `q` was removed from +[`scipy.linalg.expm`](../reference/generated/scipy.linalg.expm.html#scipy.linalg.expm "scipy.linalg.expm"). And the deprecated submodule `linalg.calc_lwork` was +removed. + +The deprecated functions `C2K`, `K2C`, `F2C`, `C2F`, `F2K` and +`K2F` have been removed from [`scipy.constants`](../reference/constants.html#module-scipy.constants "scipy.constants"). + +The deprecated `ppform` class was removed from [`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate"). + +The deprecated keyword `iprint` was removed from [`scipy.optimize.fmin_cobyla`](../reference/generated/scipy.optimize.fmin_cobyla.html#scipy.optimize.fmin_cobyla "scipy.optimize.fmin_cobyla"). + +The default value for the `zero_phase` keyword of [`scipy.signal.decimate`](../reference/generated/scipy.signal.decimate.html#scipy.signal.decimate "scipy.signal.decimate") +has been changed to True. + +The `kmeans` and `kmeans2` functions in [`scipy.cluster.vq`](../reference/cluster.vq.html#module-scipy.cluster.vq "scipy.cluster.vq") changed the +method used for random initialization, so using a fixed random seed will +not necessarily produce the same results as in previous versions. + +[`scipy.special.gammaln`](../reference/generated/scipy.special.gammaln.html#scipy.special.gammaln "scipy.special.gammaln") does not accept complex arguments anymore. + +The deprecated functions `sph_jn`, `sph_yn`, `sph_jnyn`, `sph_in`, +`sph_kn`, and `sph_inkn` have been removed. Users should instead use +the functions `spherical_jn`, `spherical_yn`, `spherical_in`, and +`spherical_kn`. Be aware that the new functions have different +signatures. + +The cross-class properties of [`scipy.signal.lti`](../reference/generated/scipy.signal.lti.html#scipy.signal.lti "scipy.signal.lti") systems have been removed. +The following properties/setters have been removed: + +Name - (accessing/setting has been removed) - (setting has been removed) + +* StateSpace - (`num`, `den`, `gain`) - (`zeros`, `poles`) +* TransferFunction (`A`, `B`, `C`, `D`, `gain`) - (`zeros`, `poles`) +* ZerosPolesGain (`A`, `B`, `C`, `D`, `num`, `den`) - () + +`signal.freqz(b, a)` with `b` or `a` >1-D raises a `ValueError`. This +was a corner case for which it was unclear that the behavior was well-defined. + +The method `var` of `scipy.stats.dirichlet` now returns a scalar rather than +an ndarray when the length of alpha is 1. + +### [Other changes](#id20)[#](#other-changes "Link to this heading") + +SciPy now has a formal governance structure. It consists of a BDFL (Pauli +Virtanen) and a Steering Committee. See [the governance document](https://github.com/scipy/scipy/blob/main/doc/source/dev/governance/governance.rst) +for details. + +It is now possible to build SciPy on Windows with MSVC + gfortran! Continuous +integration has been set up for this build configuration on Appveyor, building +against OpenBLAS. + +Continuous integration for OS X has been set up on TravisCI. + +The SciPy test suite has been migrated from `nose` to `pytest`. + +`scipy/_distributor_init.py` was added to allow redistributors of SciPy to +add custom code that needs to run when importing SciPy (e.g. checks for +hardware, DLL search paths, etc.). + +Support for PEP 518 (specifying build system requirements) was added - see +`pyproject.toml` in the root of the SciPy repository. + +In order to have consistent function names, the function +`scipy.linalg.solve_lyapunov` is renamed to +[`scipy.linalg.solve_continuous_lyapunov`](../reference/generated/scipy.linalg.solve_continuous_lyapunov.html#scipy.linalg.solve_continuous_lyapunov "scipy.linalg.solve_continuous_lyapunov"). The old name is kept for +backwards-compatibility. + +### [Authors](#id21)[#](#authors "Link to this heading") + +* @arcady + +* @xoviat + +* Anton Akhmerov +* Dominic Antonacci + +* Alessandro Pietro Bardelli +* Ved Basu + +* Michael James Bedford + +* Ray Bell + +* Juan M. Bello-Rivas + +* Sebastian Berg +* Felix Berkenkamp +* Jyotirmoy Bhattacharya + +* Matthew Brett +* Jonathan Bright +* Bruno Jiménez + +* Evgeni Burovski +* Patrick Callier +* Mark Campanelli + +* CJ Carey +* Robert Cimrman +* Adam Cox + +* Michael Danilov + +* David Haberthür + +* Andras Deak + +* Philip DeBoer +* Anne-Sylvie Deutsch +* Cathy Douglass + +* Dominic Else + +* Guo Fei + +* Roman Feldbauer + +* Yu Feng +* Jaime Fernandez del Rio +* Orestis Floros + +* David Freese + +* Adam Geitgey + +* James Gerity + +* Dezmond Goff + +* Christoph Gohlke +* Ralf Gommers +* Dirk Gorissen + +* Matt Haberland + +* David Hagen + +* Charles Harris +* Lam Yuen Hei + +* Jean Helie + +* Gaute Hope + +* Guillaume Horel + +* Franziska Horn + +* Yevhenii Hyzyla + +* Vladislav Iakovlev + +* Marvin Kastner + +* Mher Kazandjian +* Thomas Keck +* Adam Kurkiewicz + +* Ronan Lamy + +* J.L. Lanfranchi + +* Eric Larson +* Denis Laxalde +* Gregory R. Lee +* Felix Lenders + +* Evan Limanto +* Julian Lukwata + +* François Magimel +* Syrtis Major + +* Charles Masson + +* Nikolay Mayorov +* Tobias Megies +* Markus Meister + +* Roman Mirochnik + +* Jordi Montes + +* Nathan Musoke + +* Andrew Nelson +* M.J. Nichol +* Juan Nunez-Iglesias +* Arno Onken + +* Nick Papior + +* Dima Pasechnik + +* Ashwin Pathak + +* Oleksandr Pavlyk + +* Stefan Peterson +* Ilhan Polat +* Andrey Portnoy + +* Ravi Kumar Prasad + +* Aman Pratik +* Eric Quintero +* Vedant Rathore + +* Tyler Reddy +* Joscha Reimer +* Philipp Rentzsch + +* Antonio Horta Ribeiro +* Ned Richards + +* Kevin Rose + +* Benoit Rostykus + +* Matt Ruffalo + +* Eli Sadoff + +* Pim Schellart +* Nico Schlömer + +* Klaus Sembritzki + +* Nikolay Shebanov + +* Jonathan Tammo Siebert +* Scott Sievert +* Max Silbiger + +* Mandeep Singh + +* Michael Stewart + +* Jonathan Sutton + +* Deep Tavker + +* Martin Thoma +* James Tocknell + +* Aleksandar Trifunovic + +* Paul van Mulbregt + +* Jacob Vanderplas +* Aditya Vijaykumar +* Pauli Virtanen +* James Webber +* Warren Weckesser +* Eric Wieser + +* Josh Wilson +* Zhiqing Xiao + +* Evgeny Zhurko +* Nikolay Zinov + +* Zé Vinícius + + +A total of 121 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +## [Issues closed for 1.0.0](#id22)[#](#issues-closed-for-1-0-0 "Link to this heading") + +* [#2300](https://github.com/scipy/scipy/issues/2300): scipy.misc.toimage (and therefore imresize) converts to uint32… +* [#2347](https://github.com/scipy/scipy/issues/2347): Several `misc.im*` functions incorrectly handle 3 or 4-channeled… +* [#2442](https://github.com/scipy/scipy/issues/2442): scipy.misc.pilutil -> scipy.ndimage? +* [#2829](https://github.com/scipy/scipy/issues/2829): Mingw Gfortran on Windows? +* [#3154](https://github.com/scipy/scipy/issues/3154): scipy.misc.imsave creates wrong bitmap header +* [#3505](https://github.com/scipy/scipy/issues/3505): scipy.linalg.lstsq() residual’s help text is a lil strange +* [#3808](https://github.com/scipy/scipy/issues/3808): Is Brent’s method for minimizing the value of a function implemented… +* [#4121](https://github.com/scipy/scipy/issues/4121): Add cdf() method to stats.multivariate\_normal +* [#4458](https://github.com/scipy/scipy/issues/4458): scipy.misc.imresize changes image range +* [#4575](https://github.com/scipy/scipy/issues/4575): Docs for L-BFGS-B mention non-existent parameter +* [#4893](https://github.com/scipy/scipy/issues/4893): misc.imsave does not work with file type defined +* [#5231](https://github.com/scipy/scipy/issues/5231): Discrepancies in scipy.optimize.minimize(method=’L-BFGS-B’) +* [#5238](https://github.com/scipy/scipy/issues/5238): Optimal leaf ordering in scipy.cluster.hierarchy.dendrogram +* [#5305](https://github.com/scipy/scipy/issues/5305): Wrong image scaling in scipy/misc/pilutil.py with misc.imsave? +* [#5823](https://github.com/scipy/scipy/issues/5823): test failure in `filter_design` +* [#6061](https://github.com/scipy/scipy/issues/6061): scipy.stats.spearmanr return values outside range -1 to 1 +* [#6242](https://github.com/scipy/scipy/issues/6242): Inconsistency / duplication for imread and imshow, imsave +* [#6265](https://github.com/scipy/scipy/issues/6265): BUG: signal.iirfilter of bandpass type is unstable when high… +* [#6370](https://github.com/scipy/scipy/issues/6370): `scipy.optimize.linear_sum_assignment` hangs on undefined matrix +* [#6417](https://github.com/scipy/scipy/issues/6417): scipy.misc.imresize converts images to uint8 +* [#6618](https://github.com/scipy/scipy/issues/6618): splrep and splprep inconsistent +* [#6854](https://github.com/scipy/scipy/issues/6854): Support PEP 519 in I/O functions +* [#6921](https://github.com/scipy/scipy/issues/6921): [Feature request] Random unitary matrix +* [#6930](https://github.com/scipy/scipy/issues/6930): `uniform_filter1d` appears to truncate rather than round when output… +* [#6949](https://github.com/scipy/scipy/issues/6949): interp2d function crashes python +* [#6959](https://github.com/scipy/scipy/issues/6959): scipy.interpolate.LSQUnivariateSpline - check for increasing… +* [#7005](https://github.com/scipy/scipy/issues/7005): linear\_sum\_assignment in scipy.optimize never return if one of… +* [#7010](https://github.com/scipy/scipy/issues/7010): `scipy.statsbinned_statistic_2d`: incorrect binnumbers returned +* [#7049](https://github.com/scipy/scipy/issues/7049): `expm_multiply` is excessively slow when called for intervals +* [#7050](https://github.com/scipy/scipy/issues/7050): Documenting `_argcheck` for `rv_discrete` +* [#7077](https://github.com/scipy/scipy/issues/7077): `coo_matrix.tocsr()` still slow +* [#7093](https://github.com/scipy/scipy/issues/7093): Wheels licensing +* [#7122](https://github.com/scipy/scipy/issues/7122): Sketching-based Matrix Computations +* [#7133](https://github.com/scipy/scipy/issues/7133): Discontinuity of a scipy special function +* [#7141](https://github.com/scipy/scipy/issues/7141): Improve documentation for Elliptic Integrals +* [#7181](https://github.com/scipy/scipy/issues/7181): A change in [`numpy.poly1d`](https://numpy.org/doc/stable/reference/generated/numpy.poly1d.html#numpy.poly1d "(in NumPy v2.4)") is causing the scipy tests to fail. +* [#7220](https://github.com/scipy/scipy/issues/7220): String Formatting Issue in `LinearOperator.__init__` +* [#7239](https://github.com/scipy/scipy/issues/7239): Source tarball distribution +* [#7247](https://github.com/scipy/scipy/issues/7247): genlaguerre poly1d-object doesn’t respect ‘monic’ option at evaluation +* [#7248](https://github.com/scipy/scipy/issues/7248): BUG: regression in Legendre polynomials on master +* [#7316](https://github.com/scipy/scipy/issues/7316): dgels is missing +* [#7381](https://github.com/scipy/scipy/issues/7381): Krogh interpolation fails to produce derivatives for complex… +* [#7416](https://github.com/scipy/scipy/issues/7416): scipy.stats.kappa4(h,k) raise a ValueError for positive integer… +* [#7421](https://github.com/scipy/scipy/issues/7421): scipy.stats.arcsine().pdf and scipy.stats.beta(0.5, 0.5).pdf… +* [#7429](https://github.com/scipy/scipy/issues/7429): `test_matrix_norms()` in scipy/linalg/tests/test\_basic.py calls… +* [#7444](https://github.com/scipy/scipy/issues/7444): Doc: stats.dirichlet.var output description is wrong +* [#7475](https://github.com/scipy/scipy/issues/7475): Parameter amax in `scalar_search_wolfe2` is not used +* [#7510](https://github.com/scipy/scipy/issues/7510): Operations between numpy.array and scipy.sparse matrix return… +* [#7550](https://github.com/scipy/scipy/issues/7550): DOC: signal tutorial: Typo in explanation of convolution +* [#7551](https://github.com/scipy/scipy/issues/7551): stdint.h included in SuperLU header files, but does not exist… +* [#7553](https://github.com/scipy/scipy/issues/7553): Build for master broken on OS X +* [#7557](https://github.com/scipy/scipy/issues/7557): Error in scipy.signal.periodogram example +* [#7590](https://github.com/scipy/scipy/issues/7590): OSX test fail - `test_ltisys.TestPlacePoles.test_real` +* [#7658](https://github.com/scipy/scipy/issues/7658): optimize.BenchGlobal broken +* [#7669](https://github.com/scipy/scipy/issues/7669): nan result from multivariate\_normal.cdf +* [#7733](https://github.com/scipy/scipy/issues/7733): Inconsistent usage of indices, indptr in `Delaunay.vertex_neighbor_vertices` +* [#7747](https://github.com/scipy/scipy/issues/7747): Numpy changes in np.random.dirichlet cause test failures +* [#7772](https://github.com/scipy/scipy/issues/7772): Fix numpy lstsq rcond= parameter +* [#7776](https://github.com/scipy/scipy/issues/7776): tests require `nose` +* [#7798](https://github.com/scipy/scipy/issues/7798): contributor names for 1.0 release notes +* [#7828](https://github.com/scipy/scipy/issues/7828): 32-bit Linux test errors on TestCephes +* [#7893](https://github.com/scipy/scipy/issues/7893): scipy.spatial.distance.wminkowski behaviour change in 1.0.0b1 +* [#7898](https://github.com/scipy/scipy/issues/7898): DOC: Window functions +* [#7959](https://github.com/scipy/scipy/issues/7959): BUG maybe: fmin\_bfgs possibly broken in 1.0 +* [#7969](https://github.com/scipy/scipy/issues/7969): scipy 1.0.0rc1 windows wheels depend on missing msvcp140.dll + +## [Pull requests for 1.0.0](#id23)[#](#pull-requests-for-1-0-0 "Link to this heading") + +* [#4978](https://github.com/scipy/scipy/pull/4978): WIP: add pre\_center and normalize options to lombscargle +* [#5796](https://github.com/scipy/scipy/pull/5796): TST: Remove all permanent filter changes from tests +* [#5910](https://github.com/scipy/scipy/pull/5910): ENH: sparse.linalg: add GCROT(m,k) +* [#6326](https://github.com/scipy/scipy/pull/6326): ENH: New ODE solvers +* [#6480](https://github.com/scipy/scipy/pull/6480): ENH: Make *signal.decimate* default to `zero_phase=True` +* [#6705](https://github.com/scipy/scipy/pull/6705): ENH: add initial guess to sparse.linalg.lsqr +* [#6706](https://github.com/scipy/scipy/pull/6706): ENH: add initial guess to sparse.linalg.lsmr +* [#6769](https://github.com/scipy/scipy/pull/6769): BUG: optimize: add sufficient descent condition check to CG line… +* [#6855](https://github.com/scipy/scipy/pull/6855): Handle objects supporting PEP 519 in I/O functions +* [#6945](https://github.com/scipy/scipy/pull/6945): MAINT: ckdtree codebase clean up +* [#6953](https://github.com/scipy/scipy/pull/6953): DOC: add a SciPy Project Governance document +* [#6998](https://github.com/scipy/scipy/pull/6998): fix documentation of spearman rank corrcoef +* [#7017](https://github.com/scipy/scipy/pull/7017): ENH: add methods logcdf and cdf to `scipy.stats.multivariate_normal` +* [#7027](https://github.com/scipy/scipy/pull/7027): Add random unitary matrices +* [#7030](https://github.com/scipy/scipy/pull/7030): ENH: Add strictly-increasing checks for x to 1D splines +* [#7031](https://github.com/scipy/scipy/pull/7031): BUG: Fix `linear_sum_assignment` hanging on an undefined matrix +* [#7041](https://github.com/scipy/scipy/pull/7041): DOC: Clairfy that windows are DFT-even by default +* [#7048](https://github.com/scipy/scipy/pull/7048): DOC: modified docs for `find_peak_cwt`. Fixes #6922 +* [#7056](https://github.com/scipy/scipy/pull/7056): Fix insufficient precision when calculating spearman/kendall… +* [#7057](https://github.com/scipy/scipy/pull/7057): MAINT: change dtype comparison in `optimize.linear_sum_assignment`. +* [#7059](https://github.com/scipy/scipy/pull/7059): TST: make `Xdist_deprecated_args` cover all metrics +* [#7061](https://github.com/scipy/scipy/pull/7061): Fix msvc 9 and 10 compile errors +* [#7070](https://github.com/scipy/scipy/pull/7070): ENH: sparse: optimizing CSR/CSC slicing fast paths +* [#7078](https://github.com/scipy/scipy/pull/7078): ENH: sparse: defer `sum_duplicates` to csr/csc +* [#7079](https://github.com/scipy/scipy/pull/7079): ENH: sparse: allow subclasses to override specific math operations +* [#7081](https://github.com/scipy/scipy/pull/7081): ENH: sparse: speed up CSR/CSC toarray() +* [#7082](https://github.com/scipy/scipy/pull/7082): MAINT: Add missing `PyType_Ready(&SuperLUGlobalType)` for Py3 +* [#7083](https://github.com/scipy/scipy/pull/7083): Corrected typo in the doc of scipy.linalg.lstsq() +* [#7086](https://github.com/scipy/scipy/pull/7086): Fix bug #7049 causing excessive slowness in `expm_multiply` +* [#7088](https://github.com/scipy/scipy/pull/7088): Documented `_argcheck` for `rv_discrete` +* [#7094](https://github.com/scipy/scipy/pull/7094): MAINT: Fix mistake in PR #7082 +* [#7098](https://github.com/scipy/scipy/pull/7098): BF: return NULL from failed Py3 module check +* [#7105](https://github.com/scipy/scipy/pull/7105): MAINT: Customize ?TRSYL call in lyapunov solver +* [#7111](https://github.com/scipy/scipy/pull/7111): Fix error message typo in UnivariateSpline +* [#7113](https://github.com/scipy/scipy/pull/7113): FIX: Add add float to return type in documentation +* [#7119](https://github.com/scipy/scipy/pull/7119): ENH: sparse.linalg: remove `_count_nonzero` hack +* [#7123](https://github.com/scipy/scipy/pull/7123): ENH: added “interior-point” method for `scipy.optimize.linprog` +* [#7137](https://github.com/scipy/scipy/pull/7137): DOC: clarify stats.linregress docstring, closes gh-7074 +* [#7138](https://github.com/scipy/scipy/pull/7138): DOC: special: Add an example to the airy docstring. +* [#7139](https://github.com/scipy/scipy/pull/7139): DOC: stats: Update stats tutorial +* [#7142](https://github.com/scipy/scipy/pull/7142): BUG: special: prevent segfault in `pbwa` +* [#7143](https://github.com/scipy/scipy/pull/7143): DOC: special: warn about alternate elliptic integral parameterizations +* [#7146](https://github.com/scipy/scipy/pull/7146): fix docstring of NearestNDInterpolator +* [#7148](https://github.com/scipy/scipy/pull/7148): DOC: special: Add Parameters, Returns and Examples to gamma docstring +* [#7152](https://github.com/scipy/scipy/pull/7152): MAINT: spatial: Remove two unused variables in ckdtree/src/distance.h +* [#7153](https://github.com/scipy/scipy/pull/7153): MAINT: special: remove deprecated variant of `gammaln` +* [#7154](https://github.com/scipy/scipy/pull/7154): MAINT: Fix some code that generates C compiler warnings +* [#7155](https://github.com/scipy/scipy/pull/7155): DOC: linalg: Add examples for `solve_banded` and `solve_triangular` +* [#7156](https://github.com/scipy/scipy/pull/7156): DOC: fix docstring of NearestNDInterpolator +* [#7159](https://github.com/scipy/scipy/pull/7159): BUG: special: fix sign of derivative when `x < 0` in `pbwa` +* [#7161](https://github.com/scipy/scipy/pull/7161): MAINT: interpolate: make Rbf.A array a property +* [#7163](https://github.com/scipy/scipy/pull/7163): MAINT: special: return nan for inaccurate regions of `pbwa` +* [#7165](https://github.com/scipy/scipy/pull/7165): ENH: optimize: changes to make BFGS implementation more efficient. +* [#7166](https://github.com/scipy/scipy/pull/7166): BUG: Prevent infinite loop in `optimize._lsq.trf_linear.py` +* [#7173](https://github.com/scipy/scipy/pull/7173): BUG: sparse: return a numpy matrix from `_add_dense` +* [#7179](https://github.com/scipy/scipy/pull/7179): DOC: Fix an error in sparse argmax docstring +* [#7180](https://github.com/scipy/scipy/pull/7180): MAINT: interpolate: A bit of clean up in `interpolate/src/_interpolate.cpp` +* [#7182](https://github.com/scipy/scipy/pull/7182): Allow homogeneous coordinate transforms in `affine_transform` +* [#7184](https://github.com/scipy/scipy/pull/7184): MAINT: Remove hack modifying a readonly attr +* [#7185](https://github.com/scipy/scipy/pull/7185): ENH: Add evaluation of periodic splines #6730 +* [#7186](https://github.com/scipy/scipy/pull/7186): MAINT: PPoly: improve error messages for wrong shape/axis +* [#7187](https://github.com/scipy/scipy/pull/7187): DEP: interpolate: deprecate interpolate\_wrapper +* [#7198](https://github.com/scipy/scipy/pull/7198): DOC: linalg: Add examples for `solveh_banded` and `solve_toeplitz`. +* [#7200](https://github.com/scipy/scipy/pull/7200): DOC: stats: Added tutorial documentation for the generalized… +* [#7208](https://github.com/scipy/scipy/pull/7208): DOC: Added docstrings to `issparse/isspmatrix(_...)` methods and… +* [#7213](https://github.com/scipy/scipy/pull/7213): DOC: Added examples to circmean, circvar, circstd +* [#7215](https://github.com/scipy/scipy/pull/7215): DOC: Adding examples to scipy.sparse.linalg…. docstrings +* [#7223](https://github.com/scipy/scipy/pull/7223): DOC: special: Add examples for expit and logit. +* [#7224](https://github.com/scipy/scipy/pull/7224): BUG: interpolate: fix integer overflow in fitpack.bispev +* [#7225](https://github.com/scipy/scipy/pull/7225): DOC: update 1.0 release notes for several recent PRs. +* [#7226](https://github.com/scipy/scipy/pull/7226): MAINT: update docs and code for mailing list move to python.org +* [#7233](https://github.com/scipy/scipy/pull/7233): Fix issue #7232: Do not mask exceptions in objective func evaluation +* [#7234](https://github.com/scipy/scipy/pull/7234): MAINT: cluster: cleaning up VQ/k-means code +* [#7236](https://github.com/scipy/scipy/pull/7236): DOC: Fixed typo +* [#7238](https://github.com/scipy/scipy/pull/7238): BUG: fix syntaxerror due to unicode character in `trustregion_exact`. +* [#7243](https://github.com/scipy/scipy/pull/7243): DOC: Update docstring in misc/pilutil.py +* [#7246](https://github.com/scipy/scipy/pull/7246): DEP: misc: deprecate imported names +* [#7249](https://github.com/scipy/scipy/pull/7249): DOC: Add plotted example to scipy.cluster.vq.kmeans +* [#7252](https://github.com/scipy/scipy/pull/7252): Fix 5231: docs of *factr*, *ftol* in sync w/ code +* [#7254](https://github.com/scipy/scipy/pull/7254): ENH: SphericalVoronoi Input Handling +* [#7256](https://github.com/scipy/scipy/pull/7256): fix for issue #7255 - Circular statistics functions give wrong… +* [#7263](https://github.com/scipy/scipy/pull/7263): CI: use python’s faulthandler to ease tracing segfaults +* [#7288](https://github.com/scipy/scipy/pull/7288): ENH: linalg: add `subspace_angles` function. +* [#7290](https://github.com/scipy/scipy/pull/7290): BUG: stats: Fix spurious warnings in genextreme. +* [#7292](https://github.com/scipy/scipy/pull/7292): ENH: optimize: added trust region method trust-trlib +* [#7296](https://github.com/scipy/scipy/pull/7296): DOC: stats: Add an example to the `ttest_ind_from_stats` docstring. +* [#7297](https://github.com/scipy/scipy/pull/7297): DOC: signal: Add examples for `chirp()` and `sweep_poly()`. +* [#7299](https://github.com/scipy/scipy/pull/7299): DOC: Made difference between brent and fminbound clearer +* [#7305](https://github.com/scipy/scipy/pull/7305): Simplify if-statements and constructor calls in `integrate._ode` +* [#7309](https://github.com/scipy/scipy/pull/7309): Comply with PEP 518. +* [#7313](https://github.com/scipy/scipy/pull/7313): REL: add `python_requires` to setup.py, fix Python version check. +* [#7315](https://github.com/scipy/scipy/pull/7315): BUG: Fixed bug with Laguerre and Legendre polynomials +* [#7320](https://github.com/scipy/scipy/pull/7320): DOC: clarify meaning of flags in ode.integrate +* [#7333](https://github.com/scipy/scipy/pull/7333): DOC: Add examples to `scipy.ndimage.gaussian_filter1d` +* [#7337](https://github.com/scipy/scipy/pull/7337): ENH: add n-dimensional DCT and IDCT to fftpack +* [#7353](https://github.com/scipy/scipy/pull/7353): Add `_gels` functions +* [#7357](https://github.com/scipy/scipy/pull/7357): DOC: linalg: Add examples to the svdvals docstring. +* [#7359](https://github.com/scipy/scipy/pull/7359): Bump Sphinx version to 1.5.5 +* [#7361](https://github.com/scipy/scipy/pull/7361): DOC: linalg: Add some ‘See Also’ links among special matrices… +* [#7362](https://github.com/scipy/scipy/pull/7362): TST: Fix some Fedora 25 test failures. +* [#7363](https://github.com/scipy/scipy/pull/7363): DOC: linalg: tweak the docstring example of svd +* [#7365](https://github.com/scipy/scipy/pull/7365): MAINT: fix `refguide_check.py` for Sphinx >= 1.5 +* [#7367](https://github.com/scipy/scipy/pull/7367): BUG: odrpack: fix invalid stride checks in `d_lpkbls.f` +* [#7368](https://github.com/scipy/scipy/pull/7368): DOC: constants: Add examples to the ‘find’ docstring. +* [#7376](https://github.com/scipy/scipy/pull/7376): MAINT: bundle Mathjax with built docs +* [#7377](https://github.com/scipy/scipy/pull/7377): MAINT: optimize: Better name for trust-region-exact method. +* [#7378](https://github.com/scipy/scipy/pull/7378): Improve wording in tutorial +* [#7383](https://github.com/scipy/scipy/pull/7383): fix KroghInterpolator.derivatives failure with complex input +* [#7389](https://github.com/scipy/scipy/pull/7389): FIX: Copy mutable window in `resample_poly` +* [#7390](https://github.com/scipy/scipy/pull/7390): DOC: optimize: A few tweaks of the examples in the `curve_fit` +* [#7391](https://github.com/scipy/scipy/pull/7391): DOC: Add examples to scipy.stats +* [#7394](https://github.com/scipy/scipy/pull/7394): “Weight” is actually mass. Add slugs and slinches/blobs to mass +* [#7398](https://github.com/scipy/scipy/pull/7398): DOC: Correct minor typo in optimize.{brenth,brentq} +* [#7401](https://github.com/scipy/scipy/pull/7401): DOC: zeta only accepts real input +* [#7413](https://github.com/scipy/scipy/pull/7413): BUG: fix error messages in `_minimize_trustregion_exact` +* [#7414](https://github.com/scipy/scipy/pull/7414): DOC: fix `ndimage.distance_transform_bf` docstring [ci skip] +* [#7415](https://github.com/scipy/scipy/pull/7415): DOC: fix skew docstring [ci skip] +* [#7423](https://github.com/scipy/scipy/pull/7423): Expand binnumbers with correct dimensions +* [#7431](https://github.com/scipy/scipy/pull/7431): BUG: Extend scipy.stats.arcsine.pdf to endpoints 0 and 1 #7427 +* [#7432](https://github.com/scipy/scipy/pull/7432): DOC: Add examples to scipy.cluster.hierarchy +* [#7448](https://github.com/scipy/scipy/pull/7448): ENH: stats: Implement the survival function for pareto. +* [#7454](https://github.com/scipy/scipy/pull/7454): FIX Replaced `np.assert_allclose` with imported `assert_allclose` +* [#7460](https://github.com/scipy/scipy/pull/7460): TST: fix integrate.ivp test that fails on 32-bit Python. +* [#7461](https://github.com/scipy/scipy/pull/7461): Doc: Added tutorial documentation for stats distributions ksone +* [#7463](https://github.com/scipy/scipy/pull/7463): DOC: Fix typos and remove trailing whitespace +* [#7465](https://github.com/scipy/scipy/pull/7465): Fix some ndimage.interpolation endianness bugs +* [#7468](https://github.com/scipy/scipy/pull/7468): del redundance in interpolate.py +* [#7470](https://github.com/scipy/scipy/pull/7470): Initialize “info” in `minpack_lmdif` +* [#7478](https://github.com/scipy/scipy/pull/7478): Added more testing of smirnov/smirnovi functions +* [#7479](https://github.com/scipy/scipy/pull/7479): MAINT: update for new FutureWarning’s in numpy 1.13.0 +* [#7480](https://github.com/scipy/scipy/pull/7480): DOC: correctly describe output shape of dirichlet.mean() and… +* [#7482](https://github.com/scipy/scipy/pull/7482): signal.lti: Remove deprecated cross-system properties +* [#7484](https://github.com/scipy/scipy/pull/7484): MAINT: Clean-up uses of np.asarray in ndimage +* [#7485](https://github.com/scipy/scipy/pull/7485): ENH: support any order >=0 in `ndimage.gaussian_filter` +* [#7486](https://github.com/scipy/scipy/pull/7486): ENH: Support k!=0 for sparse.diagonal() +* [#7498](https://github.com/scipy/scipy/pull/7498): BUG: sparse: pass assumeSortedIndices option to scikit.umfpack +* [#7501](https://github.com/scipy/scipy/pull/7501): ENH: add optimal leaf ordering for linkage matrices +* [#7506](https://github.com/scipy/scipy/pull/7506): MAINT: remove overflow in Metropolis fixes #7495 +* [#7507](https://github.com/scipy/scipy/pull/7507): TST: speed up full test suite by less eval points in mpmath tests. +* [#7509](https://github.com/scipy/scipy/pull/7509): BUG: fix issue when using `python setup.py somecommand --force`. +* [#7511](https://github.com/scipy/scipy/pull/7511): fix some alerts found with lgtm +* [#7514](https://github.com/scipy/scipy/pull/7514): Add explanation what the integer returned mean. +* [#7516](https://github.com/scipy/scipy/pull/7516): BUG: Fix roundoff errors in `ndimage.uniform_filter1d`. +* [#7517](https://github.com/scipy/scipy/pull/7517): TST: fix signal.convolve test that was effectively being skipped. +* [#7523](https://github.com/scipy/scipy/pull/7523): ENH: linalg: allow lstsq to work with 0-shaped arrays +* [#7525](https://github.com/scipy/scipy/pull/7525): TST: Warning cleanup +* [#7526](https://github.com/scipy/scipy/pull/7526): DOC: params in ndimage.interpolation functions not optional +* [#7527](https://github.com/scipy/scipy/pull/7527): MAINT: Encapsulate error message handling in `NI_LineBuffer`. +* [#7528](https://github.com/scipy/scipy/pull/7528): MAINT: Remove ndimage aliases for `NPY_MAXDIMS`. +* [#7529](https://github.com/scipy/scipy/pull/7529): MAINT: Remove `NI_(UN)LIKELY` macros in favor of numpy ones. +* [#7537](https://github.com/scipy/scipy/pull/7537): MAINT: Use accessor function for numpy array internals +* [#7541](https://github.com/scipy/scipy/pull/7541): MAINT: Remove some uses of Numarray types in ndimage. +* [#7543](https://github.com/scipy/scipy/pull/7543): MAINT: Replace all NumarrayTypes uses in `ni_fourier.c` +* [#7544](https://github.com/scipy/scipy/pull/7544): MAINT: Replace all uses of NumarrayTypes in `ni_interpolation.c` +* [#7545](https://github.com/scipy/scipy/pull/7545): MAINT: Replace all uses of NumarrayTypes in `ni_measure.c` +* [#7546](https://github.com/scipy/scipy/pull/7546): MAINT: Replace all uses of NumarrayTypes in `ni_morphology.c` +* [#7548](https://github.com/scipy/scipy/pull/7548): DOC: make a note in benchmarks README on how to run without rebuilding. +* [#7549](https://github.com/scipy/scipy/pull/7549): MAINT: Get rid of NumarrayTypes. +* [#7552](https://github.com/scipy/scipy/pull/7552): TST: Fix new warnings -> error bugs found on OSX +* [#7554](https://github.com/scipy/scipy/pull/7554): Update superlu to 5.2.1 + fix stdint.h issue on MSVC +* [#7556](https://github.com/scipy/scipy/pull/7556): MAINT: Fix some types from #7549 + miscellaneous warnings. +* [#7558](https://github.com/scipy/scipy/pull/7558): MAINT: Use correct #define `NO_IMPORT_ARRAY`, not `NO_ARRAY_IMPORT`… +* [#7562](https://github.com/scipy/scipy/pull/7562): BUG: Copy `import_nose` from numpy. +* [#7563](https://github.com/scipy/scipy/pull/7563): ENH: Add the first Wasserstein and the Cramér-von Mises statistical… +* [#7568](https://github.com/scipy/scipy/pull/7568): Test janitoring +* [#7571](https://github.com/scipy/scipy/pull/7571): Test janitoring pt. 2 +* [#7572](https://github.com/scipy/scipy/pull/7572): Pytestifying +* [#7574](https://github.com/scipy/scipy/pull/7574): TST: Remove ignore warnings filters from stats +* [#7577](https://github.com/scipy/scipy/pull/7577): MAINT: Remove unused code in `ndimage/ni_measure.c` and .h +* [#7578](https://github.com/scipy/scipy/pull/7578): TST: Remove ignore warnings filters from sparse, clean up warning… +* [#7581](https://github.com/scipy/scipy/pull/7581): BUG: properly deallocate memory from `PyArray_IntpConverter`. +* [#7582](https://github.com/scipy/scipy/pull/7582): DOC: signal tutorial: Typo in explanation of convolution +* [#7583](https://github.com/scipy/scipy/pull/7583): Remove remaining ignore warnings filters +* [#7586](https://github.com/scipy/scipy/pull/7586): DOC: add note to HACKING.rst on where to find build docs. +* [#7587](https://github.com/scipy/scipy/pull/7587): DOC: Add examples to scipy.optimize +* [#7594](https://github.com/scipy/scipy/pull/7594): TST: Add tests for ndimage converter functions. +* [#7596](https://github.com/scipy/scipy/pull/7596): Added a sanity check to `signal.savgol_filter` +* [#7599](https://github.com/scipy/scipy/pull/7599): \_upfirdn\_apply stopping condition bugfix +* [#7601](https://github.com/scipy/scipy/pull/7601): MAINT: special: remove `sph_jn` et al. +* [#7602](https://github.com/scipy/scipy/pull/7602): TST: fix test failures in trimmed statistics tests with numpy… +* [#7605](https://github.com/scipy/scipy/pull/7605): Be clear about required dimension order +* [#7606](https://github.com/scipy/scipy/pull/7606): MAINT: Remove unused function `NI_NormalizeType`. +* [#7607](https://github.com/scipy/scipy/pull/7607): TST: add osx to travis matrix +* [#7608](https://github.com/scipy/scipy/pull/7608): DOC: improve HACKING guide - mention reviewing PRs as contribution. +* [#7609](https://github.com/scipy/scipy/pull/7609): MAINT: Remove unnecessary warning filter by avoiding unnecessary… +* [#7610](https://github.com/scipy/scipy/pull/7610): #7557 : fix example code in periodogram +* [#7611](https://github.com/scipy/scipy/pull/7611): #7220 : fix TypeError while raising ValueError for invalid shape +* [#7612](https://github.com/scipy/scipy/pull/7612): Convert yield tests to pytest parametrized tests +* [#7613](https://github.com/scipy/scipy/pull/7613): Add distributor init file +* [#7614](https://github.com/scipy/scipy/pull/7614): fixup header +* [#7615](https://github.com/scipy/scipy/pull/7615): BUG: sparse: Fix assignment w/ non-canonical sparse argument +* [#7617](https://github.com/scipy/scipy/pull/7617): DOC: Clarify digital filter functions +* [#7619](https://github.com/scipy/scipy/pull/7619): ENH: scipy.sparse.spmatrix.astype: casting and copy parameter… +* [#7621](https://github.com/scipy/scipy/pull/7621): Expose VODE/ZVODE/LSODE IDID return code to user +* [#7622](https://github.com/scipy/scipy/pull/7622): MAINT: special: remove out-of-date comment for `ellpk` +* [#7625](https://github.com/scipy/scipy/pull/7625): TST: Add a test for “ignore” warning filters +* [#7628](https://github.com/scipy/scipy/pull/7628): MAINT: refactoring and cleaning distance.py/.c/.h +* [#7629](https://github.com/scipy/scipy/pull/7629): DEP: deprecate args usage in xdist +* [#7630](https://github.com/scipy/scipy/pull/7630): ENH: weighted metrics +* [#7634](https://github.com/scipy/scipy/pull/7634): Follow-up to #6855 +* [#7635](https://github.com/scipy/scipy/pull/7635): interpolate.splprep: Test some error cases, give slightly better… +* [#7642](https://github.com/scipy/scipy/pull/7642): Add an example to `interpolate.lagrange` +* [#7643](https://github.com/scipy/scipy/pull/7643): ENH: Added wrappers for LAPACK stev +* [#7649](https://github.com/scipy/scipy/pull/7649): Fix #7636, add PEP 519 test coverage to remaining I/O functions +* [#7650](https://github.com/scipy/scipy/pull/7650): DOC: signal: Add ‘Examples’ to the docstring for sosfiltfilt. +* [#7651](https://github.com/scipy/scipy/pull/7651): Fix up ccache usage on Travis + try enabling on OSX +* [#7653](https://github.com/scipy/scipy/pull/7653): DOC: transition of examples from 2 to 3. Closes #7366 +* [#7659](https://github.com/scipy/scipy/pull/7659): BENCH: fix optimize.BenchGlobal. Closes gh-7658. +* [#7662](https://github.com/scipy/scipy/pull/7662): CI: speed up continuous integration builds +* [#7664](https://github.com/scipy/scipy/pull/7664): Update odr documentation +* [#7665](https://github.com/scipy/scipy/pull/7665): BUG: wolfe2 line/scalar search now uses amax parameter +* [#7671](https://github.com/scipy/scipy/pull/7671): MAINT: `_lib/ccallback.h`: PyCapsule\_GetName returns const `char*` +* [#7672](https://github.com/scipy/scipy/pull/7672): TST: interpolate: test integrating periodic b-splines against… +* [#7674](https://github.com/scipy/scipy/pull/7674): Tests tuning +* [#7675](https://github.com/scipy/scipy/pull/7675): CI: move refguide-check to faster build +* [#7676](https://github.com/scipy/scipy/pull/7676): DOC: bump scipy-sphinx-theme to fix copybutton.js +* [#7678](https://github.com/scipy/scipy/pull/7678): Note the zero-padding of the results of `splrep` and `splprep` +* [#7681](https://github.com/scipy/scipy/pull/7681): MAINT: `_lib`: add user-overridable available memory determination +* [#7684](https://github.com/scipy/scipy/pull/7684): TST: linalg: explicitly close opened npz files +* [#7686](https://github.com/scipy/scipy/pull/7686): MAINT: remove unnecessary shebang lines and executable bits +* [#7687](https://github.com/scipy/scipy/pull/7687): BUG: stats: don’t emit invalid warnings if moments are infinite +* [#7690](https://github.com/scipy/scipy/pull/7690): ENH: allow int-like parameters in several routines +* [#7691](https://github.com/scipy/scipy/pull/7691): DOC: Drop non-working source links from docs +* [#7694](https://github.com/scipy/scipy/pull/7694): fix `ma.rray` to `ma.array` in func `median_cihs` +* [#7698](https://github.com/scipy/scipy/pull/7698): BUG: stats: fix nan result from `multivariate_normal.cdf` (#7669) +* [#7703](https://github.com/scipy/scipy/pull/7703): DOC: special: Update the docstrings for noncentral F functions. +* [#7709](https://github.com/scipy/scipy/pull/7709): BLD: integrate: avoid symbol clash between lsoda and vode +* [#7711](https://github.com/scipy/scipy/pull/7711): TST: `_lib`: make `test_parallel_threads` to not fail falsely +* [#7712](https://github.com/scipy/scipy/pull/7712): TST: stats: bump test tolerance in `TestMultivariateNormal.test_broadcasting` +* [#7715](https://github.com/scipy/scipy/pull/7715): MAINT: fix deprecated use of numpy.issubdtype +* [#7716](https://github.com/scipy/scipy/pull/7716): TST: integrate: drop timing tests +* [#7717](https://github.com/scipy/scipy/pull/7717): MAINT: mstats.winsorize inclusion bug fix +* [#7719](https://github.com/scipy/scipy/pull/7719): DOC: stats: Add a note about the special cases of the rdist distribution. +* [#7720](https://github.com/scipy/scipy/pull/7720): DOC: Add example and math to stats.pearsonr +* [#7723](https://github.com/scipy/scipy/pull/7723): DOC: Added Mann-Whitney U statistic reference +* [#7727](https://github.com/scipy/scipy/pull/7727): BUG: special/cdflib: deal with nan and nonfinite inputs +* [#7728](https://github.com/scipy/scipy/pull/7728): BLD: spatial: fix ckdtree depends header list +* [#7732](https://github.com/scipy/scipy/pull/7732): BLD: update Bento build for optimal\_leaf\_ordering addition +* [#7734](https://github.com/scipy/scipy/pull/7734): DOC: signal: Copy-edit and add examples to the Kaiser-related… +* [#7736](https://github.com/scipy/scipy/pull/7736): BUG: Fixes #7735: Prevent integer overflow in concatenated index… +* [#7737](https://github.com/scipy/scipy/pull/7737): DOC: rename indices/indptr for `spatial.Delaunay vertex_neighbor_vertices` +* [#7738](https://github.com/scipy/scipy/pull/7738): ENH: Speed up freqz computation +* [#7739](https://github.com/scipy/scipy/pull/7739): TST: ignore ncfdtridfn failure in win32 and warn on FPU mode changes +* [#7740](https://github.com/scipy/scipy/pull/7740): Fix overflow in Anderson-Darling k-sample test +* [#7742](https://github.com/scipy/scipy/pull/7742): TST: special: limit expm1 mpmath comparison range +* [#7748](https://github.com/scipy/scipy/pull/7748): TST: stats: don’t pass invalid alpha to np.random.dirichlet +* [#7749](https://github.com/scipy/scipy/pull/7749): BUG/DOC: optimize: method is ‘interior-point’, not ‘interior… +* [#7751](https://github.com/scipy/scipy/pull/7751): BUG: optimize: `show_options('linprog', method='interior-point')`… +* [#7753](https://github.com/scipy/scipy/pull/7753): ENH: io: easier syntax for FortranFile read/write of mixed records +* [#7754](https://github.com/scipy/scipy/pull/7754): BLD: add `_lib._fpumode` extension to Bento build. +* [#7756](https://github.com/scipy/scipy/pull/7756): DOC: Show probability density functions as math +* [#7757](https://github.com/scipy/scipy/pull/7757): MAINT: remove outdated OS X build scripts. Fixes pytest failure. +* [#7758](https://github.com/scipy/scipy/pull/7758): MAINT: stats: pep8, wrap lines +* [#7760](https://github.com/scipy/scipy/pull/7760): DOC: special: add instructions on how to add special functions +* [#7761](https://github.com/scipy/scipy/pull/7761): DOC: allow specifying Python version for Sphinx makefile +* [#7765](https://github.com/scipy/scipy/pull/7765): TST: fix test coverage of `mstats_extras.py` +* [#7767](https://github.com/scipy/scipy/pull/7767): DOC: update 1.0 release notes. +* [#7768](https://github.com/scipy/scipy/pull/7768): DOC: update notes on how to release. Also change paver file to… +* [#7769](https://github.com/scipy/scipy/pull/7769): Add the `_sf` and `_logsf` function for planck dist +* [#7770](https://github.com/scipy/scipy/pull/7770): DOC: Replace rotten links in the docstring of minres +* [#7771](https://github.com/scipy/scipy/pull/7771): MAINT: f2py build output cleanup +* [#7773](https://github.com/scipy/scipy/pull/7773): DOC: optimize: Some copy-editing of linprog docs. +* [#7774](https://github.com/scipy/scipy/pull/7774): MAINT: set rcond explicitly for np.linalg.lstsq calls +* [#7777](https://github.com/scipy/scipy/pull/7777): remove leftover `nose` imports +* [#7780](https://github.com/scipy/scipy/pull/7780): ENH: Wrap LAPACK’s dsytrd +* [#7781](https://github.com/scipy/scipy/pull/7781): DOC: Link rfft +* [#7782](https://github.com/scipy/scipy/pull/7782): MAINT: run pyx autogeneration in cythonize & remove autogen files +* [#7783](https://github.com/scipy/scipy/pull/7783): FIX: Disallow Wn==1 in digital filters +* [#7790](https://github.com/scipy/scipy/pull/7790): Fix test errors introduced by gh-5910 +* [#7792](https://github.com/scipy/scipy/pull/7792): MAINT: fix syntax in pyproject.toml +* [#7809](https://github.com/scipy/scipy/pull/7809): ENH: sketches - Clarkson Woodruff Transform +* [#7810](https://github.com/scipy/scipy/pull/7810): ENH: Add `eig(vals)_tridiagonal` +* [#7811](https://github.com/scipy/scipy/pull/7811): BUG: stats: Fix warnings in `binned_statistics_dd` +* [#7814](https://github.com/scipy/scipy/pull/7814): ENH: signal: Replace ‘nyq’ and ‘Hz’ arguments with ‘fs’. +* [#7820](https://github.com/scipy/scipy/pull/7820): DOC: update 1.0 release notes and mailmap +* [#7823](https://github.com/scipy/scipy/pull/7823): BUG: memory leak in messagestream / qhull.pyx +* [#7830](https://github.com/scipy/scipy/pull/7830): DOC: linalg: Add an example to the lstsq docstring. +* [#7835](https://github.com/scipy/scipy/pull/7835): ENH: Automatic FIR order for `decimate` +* [#7838](https://github.com/scipy/scipy/pull/7838): MAINT: stats: Deprecate `frechet_l` and `frechet_r`. +* [#7841](https://github.com/scipy/scipy/pull/7841): slsqp PEP8 formatting fixes, typos, etc. +* [#7843](https://github.com/scipy/scipy/pull/7843): ENH: Wrap all BLAS routines +* [#7844](https://github.com/scipy/scipy/pull/7844): DOC: update LICENSE.txt with licenses of bundled libs as needed. +* [#7851](https://github.com/scipy/scipy/pull/7851): ENH: Add wrappers for ?GGLSE, ?(HE/SY)CON, ?SYTF2, ?(HE/SY)TRF +* [#7856](https://github.com/scipy/scipy/pull/7856): ENH: added out argument to Xdist +* [#7858](https://github.com/scipy/scipy/pull/7858): BUG: special/cdflib: fix fatal loss of precision issues in cumfnc +* [#7859](https://github.com/scipy/scipy/pull/7859): FIX: Squash `place_poles` warning corner case +* [#7861](https://github.com/scipy/scipy/pull/7861): dummy statement for undefined `WITH_THREAD` +* [#7863](https://github.com/scipy/scipy/pull/7863): MAINT: add license texts to binary distributions +* [#7866](https://github.com/scipy/scipy/pull/7866): DOC, MAINT: fix links in the doc +* [#7867](https://github.com/scipy/scipy/pull/7867): DOC: fix up descriptions of pdf’s in distribution docstrings. +* [#7869](https://github.com/scipy/scipy/pull/7869): DEP: deprecate misc.pilutil functions +* [#7870](https://github.com/scipy/scipy/pull/7870): DEP: remove deprecated functions +* [#7872](https://github.com/scipy/scipy/pull/7872): TST: silence RuntimeWarning for stats.truncnorm test marked as… +* [#7874](https://github.com/scipy/scipy/pull/7874): TST: fix an optimize.linprog test that fails intermittently. +* [#7875](https://github.com/scipy/scipy/pull/7875): TST: filter two integration warnings in stats tests. +* [#7876](https://github.com/scipy/scipy/pull/7876): GEN: Add comments to the tests for clarification +* [#7891](https://github.com/scipy/scipy/pull/7891): ENH: backport #7879 to 1.0.x +* [#7902](https://github.com/scipy/scipy/pull/7902): MAINT: signal: Make freqz handling of multidim. arrays match… +* [#7905](https://github.com/scipy/scipy/pull/7905): REV: restore wminkowski +* [#7908](https://github.com/scipy/scipy/pull/7908): FIX: Avoid bad `__del__` (close) behavior +* [#7918](https://github.com/scipy/scipy/pull/7918): TST: mark two optimize.linprog tests as xfail. See gh-7877. +* [#7929](https://github.com/scipy/scipy/pull/7929): MAINT: changed defaults to lower in sytf2, sytrf and hetrf +* [#7939](https://github.com/scipy/scipy/pull/7939): Fix umfpack solver construction for win-amd64 +* [#7948](https://github.com/scipy/scipy/pull/7948): DOC: add note on checking for deprecations before upgrade to… +* [#7952](https://github.com/scipy/scipy/pull/7952): DOC: update SciPy Roadmap for 1.0 release and recent discussions. +* [#7960](https://github.com/scipy/scipy/pull/7960): BUG: optimize: revert changes to bfgs in gh-7165 +* [#7962](https://github.com/scipy/scipy/pull/7962): TST: special: mark a failing hyp2f1 test as xfail +* [#7973](https://github.com/scipy/scipy/pull/7973): BUG: fixed keyword in ‘info’ in `_get_mem_available` utility +* [#8001](https://github.com/scipy/scipy/pull/8001): TST: fix test failures from Matplotlib 2.1 update +* [#8010](https://github.com/scipy/scipy/pull/8010): BUG: signal: fix crash in lfilter +* [#8019](https://github.com/scipy/scipy/pull/8019): MAINT: fix test failures with NumPy master diff --git a/corpus/changelog/scipy_releases/scipy_101.md b/corpus/changelog/scipy_releases/scipy_101.md new file mode 100644 index 0000000000000000000000000000000000000000..9273f0c6c6d4915a39f6ce3816f0741457c2bd63 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_101.md @@ -0,0 +1,72 @@ +# SciPy 1.0.1 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.0.1-notes.html +Version: 1.0.1 + +Contents + +* [SciPy 1.0.1 Release Notes](#scipy-1-0-1-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.0.1](#issues-closed-for-1-0-1) + - [Pull requests for 1.0.1](#pull-requests-for-1-0-1) + +SciPy 1.0.1 is a bug-fix release with no new features compared to 1.0.0. +Probably the most important change is a fix for an incompatibility between +SciPy 1.0.0 and `numpy.f2py` in the NumPy master branch. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Saurabh Agarwal + +* Alessandro Pietro Bardelli +* Philip DeBoer +* Ralf Gommers +* Matt Haberland +* Eric Larson +* Denis Laxalde +* Mihai Capotă + +* Andrew Nelson +* Oleksandr Pavlyk +* Ilhan Polat +* Anant Prakash + +* Pauli Virtanen +* Warren Weckesser +* @xoviat +* Ted Ying + + +A total of 16 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.0.1](#id3)[#](#issues-closed-for-1-0-1 "Link to this heading") + +* [#7493](https://github.com/scipy/scipy/issues/7493): *ndimage.morphology* functions are broken with numpy 1.13.0 +* [#8118](https://github.com/scipy/scipy/issues/8118): minimize\_cobyla broken if *disp=True* passed +* [#8142](https://github.com/scipy/scipy/issues/8142): scipy-v1.0.0 pdist with metric=`minkowski` raises `ValueError:… +* [#8173](https://github.com/scipy/scipy/issues/8173): [`scipy.stats.ortho_group`](../reference/generated/scipy.stats.ortho_group.html#scipy.stats.ortho_group "scipy.stats.ortho_group") produces all negative determinants… +* [#8207](https://github.com/scipy/scipy/issues/8207): gaussian\_filter seg faults on float16 numpy arrays +* [#8234](https://github.com/scipy/scipy/issues/8234): [`scipy.optimize.linprog`](../reference/generated/scipy.optimize.linprog.html#scipy.optimize.linprog "scipy.optimize.linprog") *interior-point* presolve bug with trivial… +* [#8243](https://github.com/scipy/scipy/issues/8243): Make csgraph importable again via *from scipy.sparse import\** +* [#8320](https://github.com/scipy/scipy/issues/8320): scipy.root segfaults with optimizer ‘lm’ + +### [Pull requests for 1.0.1](#id4)[#](#pull-requests-for-1-0-1 "Link to this heading") + +* [#8068](https://github.com/scipy/scipy/pull/8068): BUG: fix numpy deprecation test failures +* [#8082](https://github.com/scipy/scipy/pull/8082): BUG: fix solve\_lyapunov import +* [#8144](https://github.com/scipy/scipy/pull/8144): MRG: Fix for cobyla +* [#8150](https://github.com/scipy/scipy/pull/8150): MAINT: resolve UPDATEIFCOPY deprecation errors +* [#8156](https://github.com/scipy/scipy/pull/8156): BUG: missing check on minkowski w kwarg +* [#8187](https://github.com/scipy/scipy/pull/8187): BUG: Sign of elements in random orthogonal 2D matrices in “ortho\_group\_gen”… +* [#8197](https://github.com/scipy/scipy/pull/8197): CI: uninstall oclint +* [#8215](https://github.com/scipy/scipy/pull/8215): Fixes Numpy datatype compatibility issues +* [#8237](https://github.com/scipy/scipy/pull/8237): BUG: optimize: fix bug when variables fixed by bounds are inconsistent… +* [#8248](https://github.com/scipy/scipy/pull/8248): BUG: declare “gfk” variable before call of terminate() in newton-cg +* [#8280](https://github.com/scipy/scipy/pull/8280): REV: reintroduce csgraph import in scipy.sparse +* [#8322](https://github.com/scipy/scipy/pull/8322): MAINT: prevent scipy.optimize.root segfault closes #8320 +* [#8334](https://github.com/scipy/scipy/pull/8334): TST: stats: don’t use exact equality check for hdmedian test +* [#8477](https://github.com/scipy/scipy/pull/8477): BUG: signal/signaltools: fix wrong refcounting in PyArray\_OrderFilterND +* [#8530](https://github.com/scipy/scipy/pull/8530): BUG: linalg: Fixed typo in flapack.pyf.src. +* [#8566](https://github.com/scipy/scipy/pull/8566): CI: Temporarily pin Cython version to 0.27.3 +* [#8573](https://github.com/scipy/scipy/pull/8573): Backports for 1.0.1 +* [#8581](https://github.com/scipy/scipy/pull/8581): Fix Cython 0.28 build break of qhull.pyx diff --git a/corpus/changelog/scipy_releases/scipy_110.md b/corpus/changelog/scipy_releases/scipy_110.md new file mode 100644 index 0000000000000000000000000000000000000000..0d06f9befa4cd187d91c68946d737d98000159f8 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_110.md @@ -0,0 +1,667 @@ +# SciPy 1.1.0 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.1.0-notes.html +Version: 1.1.0 + +Contents + +* [SciPy 1.1.0 Release Notes](#scipy-1-1-0-release-notes) + + + [New features](#new-features) + + - [[`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") improvements](#scipy-integrate-improvements) + - [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#scipy-linalg-improvements) + - [*scipy.misc* improvements](#scipy-misc-improvements) + - [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#scipy-ndimage-improvements) + - [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#scipy-optimize-improvements) + - [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#scipy-signal-improvements) + - [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#scipy-sparse-improvements) + - [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#scipy-special-improvements) + - [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#scipy-stats-improvements) + + [Deprecated features](#deprecated-features) + + [Backwards incompatible changes](#backwards-incompatible-changes) + + [Other changes](#other-changes) + + [Authors](#authors) + + - [Issues closed for 1.1.0](#issues-closed-for-1-1-0) + - [Pull requests for 1.1.0](#pull-requests-for-1-1-0) + +SciPy 1.1.0 is the culmination of 7 months of hard work. It contains +many new features, numerous bug-fixes, improved test coverage and better +documentation. There have been a number of deprecations and API changes +in this release, which are documented below. All users are encouraged to +upgrade to this release, as there are a large number of bug-fixes and +optimizations. Before upgrading, we recommend that users check that +their own code does not use deprecated SciPy functionality (to do so, +run your code with `python -Wd` and check for `DeprecationWarning` +s). Our development attention will now shift to bug-fix releases on the +1.1.x branch, and on adding new features on the master branch. + +This release requires Python 2.7 or 3.4+ and NumPy 1.8.2 or greater. + +This release has improved but not necessarily 100% compatible with +the [PyPy](https://pypy.org/) Python implementation. For running on +PyPy, PyPy 6.0+ and Numpy 1.15.0+ are required. + +## [New features](#id2)[#](#new-features "Link to this heading") + +### [[`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") improvements](#id3)[#](#scipy-integrate-improvements "Link to this heading") + +The argument `tfirst` has been added to the function +[`scipy.integrate.odeint`](../reference/generated/scipy.integrate.odeint.html#scipy.integrate.odeint "scipy.integrate.odeint"). This allows `odeint` to use the same user +functions as [`scipy.integrate.solve_ivp`](../reference/generated/scipy.integrate.solve_ivp.html#scipy.integrate.solve_ivp "scipy.integrate.solve_ivp") and [`scipy.integrate.ode`](../reference/generated/scipy.integrate.ode.html#scipy.integrate.ode "scipy.integrate.ode") without +the need for wrapping them in a function that swaps the first two +arguments. + +Error messages from `quad()` are now clearer. + +### [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#id4)[#](#scipy-linalg-improvements "Link to this heading") + +The function [`scipy.linalg.ldl`](../reference/generated/scipy.linalg.ldl.html#scipy.linalg.ldl "scipy.linalg.ldl") has been added for factorization of +indefinite symmetric/hermitian matrices into triangular and block +diagonal matrices. + +Python wrappers for LAPACK `sygst`, `hegst` added in +[`scipy.linalg.lapack`](../reference/linalg.lapack.html#module-scipy.linalg.lapack "scipy.linalg.lapack"). + +Added [`scipy.linalg.null_space`](../reference/generated/scipy.linalg.null_space.html#scipy.linalg.null_space "scipy.linalg.null_space"), [`scipy.linalg.cdf2rdf`](../reference/generated/scipy.linalg.cdf2rdf.html#scipy.linalg.cdf2rdf "scipy.linalg.cdf2rdf"), +[`scipy.linalg.rsf2csf`](../reference/generated/scipy.linalg.rsf2csf.html#scipy.linalg.rsf2csf "scipy.linalg.rsf2csf"). + +### [*scipy.misc* improvements](#id5)[#](#scipy-misc-improvements "Link to this heading") + +An electrocardiogram has been added as an example dataset for a +one-dimensional signal. It can be accessed through +*scipy.misc.electrocardiogram*. + +### [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#id6)[#](#scipy-ndimage-improvements "Link to this heading") + +The routines [`scipy.ndimage.binary_opening`](../reference/generated/scipy.ndimage.binary_opening.html#scipy.ndimage.binary_opening "scipy.ndimage.binary_opening"), and +[`scipy.ndimage.binary_closing`](../reference/generated/scipy.ndimage.binary_closing.html#scipy.ndimage.binary_closing "scipy.ndimage.binary_closing") now support masks and different border +values. + +### [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#id7)[#](#scipy-optimize-improvements "Link to this heading") + +The method `trust-constr` has been added to +[`scipy.optimize.minimize`](../reference/generated/scipy.optimize.minimize.html#scipy.optimize.minimize "scipy.optimize.minimize"). The method switches between two +implementations depending on the problem definition. For equality-constrained +problems it is an implementation of a trust-region +sequential quadratic programming solver and, when inequality constraints +are imposed, it switches to a trust-region interior point method. Both +methods are appropriate for large scale problems. Quasi-Newton options +BFGS and SR1 were implemented and can be used to approximate +second-order derivatives for this new method. Also, finite-differences can be +used to approximate either first-order or second-order derivatives. + +Random-to-Best/1/bin and Random-to-Best/1/exp mutation strategies were +added to [`scipy.optimize.differential_evolution`](../reference/generated/scipy.optimize.differential_evolution.html#scipy.optimize.differential_evolution "scipy.optimize.differential_evolution") as `randtobest1bin` +and `randtobest1exp`, respectively. Note: These names were already in +use but implemented a different mutation strategy. See [Backwards-incompatible +changes](#backwards-incompatible-changes) below. The +`init` keyword for the [`scipy.optimize.differential_evolution`](../reference/generated/scipy.optimize.differential_evolution.html#scipy.optimize.differential_evolution "scipy.optimize.differential_evolution") +function can now accept an array. This array allows the user to specify +the entire population. + +Added an `adaptive` option to Nelder-Mead to use step parameters adapted +to the dimensionality of the problem. + +Minor improvements in [`scipy.optimize.basinhopping`](../reference/generated/scipy.optimize.basinhopping.html#scipy.optimize.basinhopping "scipy.optimize.basinhopping"). + +### [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#id8)[#](#scipy-signal-improvements "Link to this heading") + +Three new functions for peak finding in one-dimensional arrays were +added. [`scipy.signal.find_peaks`](../reference/generated/scipy.signal.find_peaks.html#scipy.signal.find_peaks "scipy.signal.find_peaks") searches for peaks (local maxima) based +on simple value comparison of neighboring samples and returns those +peaks whose properties match optionally specified conditions for their +height, prominence, width, threshold and distance to each other. +[`scipy.signal.peak_prominences`](../reference/generated/scipy.signal.peak_prominences.html#scipy.signal.peak_prominences "scipy.signal.peak_prominences") and [`scipy.signal.peak_widths`](../reference/generated/scipy.signal.peak_widths.html#scipy.signal.peak_widths "scipy.signal.peak_widths") can directly +calculate the prominences or widths of known peaks. + +Added ZPK versions of frequency transformations: +[`scipy.signal.bilinear_zpk`](../reference/generated/scipy.signal.bilinear_zpk.html#scipy.signal.bilinear_zpk "scipy.signal.bilinear_zpk"), [`scipy.signal.lp2bp_zpk`](../reference/generated/scipy.signal.lp2bp_zpk.html#scipy.signal.lp2bp_zpk "scipy.signal.lp2bp_zpk"), +[`scipy.signal.lp2bs_zpk`](../reference/generated/scipy.signal.lp2bs_zpk.html#scipy.signal.lp2bs_zpk "scipy.signal.lp2bs_zpk"), [`scipy.signal.lp2hp_zpk`](../reference/generated/scipy.signal.lp2hp_zpk.html#scipy.signal.lp2hp_zpk "scipy.signal.lp2hp_zpk"), +[`scipy.signal.lp2lp_zpk`](../reference/generated/scipy.signal.lp2lp_zpk.html#scipy.signal.lp2lp_zpk "scipy.signal.lp2lp_zpk"). + +Added [`scipy.signal.windows.dpss`](../reference/generated/scipy.signal.windows.dpss.html#scipy.signal.windows.dpss "scipy.signal.windows.dpss"), +[`scipy.signal.windows.general_cosine`](../reference/generated/scipy.signal.windows.general_cosine.html#scipy.signal.windows.general_cosine "scipy.signal.windows.general_cosine") and +[`scipy.signal.windows.general_hamming`](../reference/generated/scipy.signal.windows.general_hamming.html#scipy.signal.windows.general_hamming "scipy.signal.windows.general_hamming"). + +### [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#id9)[#](#scipy-sparse-improvements "Link to this heading") + +Previously, the `reshape` method only worked on +[`scipy.sparse.lil_matrix`](../reference/generated/scipy.sparse.lil_matrix.html#scipy.sparse.lil_matrix "scipy.sparse.lil_matrix"), and in-place reshaping did not work on any +matrices. Both operations are now implemented for all matrices. Handling +of shapes has been made consistent with `numpy.matrix` throughout the +[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") module (shape can be a tuple or splatted, negative +number acts as placeholder, padding and unpadding dimensions of size 1 +to ensure length-2 shape). + +### [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#id10)[#](#scipy-special-improvements "Link to this heading") + +Added Owen’s T function as [`scipy.special.owens_t`](../reference/generated/scipy.special.owens_t.html#scipy.special.owens_t "scipy.special.owens_t"). + +Accuracy improvements in `chndtr`, `digamma`, `gammaincinv`, +`lambertw`, `zetac`. + +### [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#id11)[#](#scipy-stats-improvements "Link to this heading") + +The Moyal distribution has been added as [`scipy.stats.moyal`](../reference/generated/scipy.stats.moyal.html#scipy.stats.moyal "scipy.stats.moyal"). + +Added the normal inverse Gaussian distribution as +[`scipy.stats.norminvgauss`](../reference/generated/scipy.stats.norminvgauss.html#scipy.stats.norminvgauss "scipy.stats.norminvgauss"). + +## [Deprecated features](#id12)[#](#deprecated-features "Link to this heading") + +The iterative linear equation solvers in [`scipy.sparse.linalg`](../reference/sparse.linalg.html#module-scipy.sparse.linalg "scipy.sparse.linalg") had a +sub-optimal way of how absolute tolerance is considered. The default +behavior will be changed in a future Scipy release to a more standard +and less surprising one. To silence deprecation warnings, set the +`atol=` parameter explicitly. + +*scipy.signal.windows.slepian* is deprecated, replaced by +[`scipy.signal.windows.dpss`](../reference/generated/scipy.signal.windows.dpss.html#scipy.signal.windows.dpss "scipy.signal.windows.dpss"). + +The window functions in [`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") are now available in +[`scipy.signal.windows`](../reference/signal.windows.html#module-scipy.signal.windows "scipy.signal.windows"). They will remain also available in the old +location in the [`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") namespace in future Scipy versions. +However, importing them from [`scipy.signal.windows`](../reference/signal.windows.html#module-scipy.signal.windows "scipy.signal.windows") is preferred, and +new window functions will be added only there. + +Indexing sparse matrices with floating-point numbers instead of integers +is deprecated. + +The function *scipy.stats.itemfreq* is deprecated. + +## [Backwards incompatible changes](#id13)[#](#backwards-incompatible-changes "Link to this heading") + +Previously, [`scipy.linalg.orth`](../reference/generated/scipy.linalg.orth.html#scipy.linalg.orth "scipy.linalg.orth") used a singular value cutoff value +appropriate for double precision numbers also for single-precision +input. The cutoff value is now tunable, and the default has been changed +to depend on the input data precision. + +In previous versions of Scipy, the `randtobest1bin` and +`randtobest1exp` mutation strategies in +[`scipy.optimize.differential_evolution`](../reference/generated/scipy.optimize.differential_evolution.html#scipy.optimize.differential_evolution "scipy.optimize.differential_evolution") were actually implemented using +the Current-to-Best/1/bin and Current-to-Best/1/exp strategies, +respectively. These strategies were renamed to `currenttobest1bin` and +`currenttobest1exp` and the implementations of `randtobest1bin` and +`randtobest1exp` strategies were corrected. + +Functions in the ndimage module now always return their output array. +Before, most functions only returned the output array if it had been +allocated by the function, and would return `None` if it had been +provided by the user. + +Distance metrics in [`scipy.spatial.distance`](../reference/spatial.distance.html#module-scipy.spatial.distance "scipy.spatial.distance") now require non-negative +weights. + +[`scipy.special.loggamma`](../reference/generated/scipy.special.loggamma.html#scipy.special.loggamma "scipy.special.loggamma") now returns real-valued result when the input +is real-valued. + +## [Other changes](#id14)[#](#other-changes "Link to this heading") + +When building on Linux with GNU compilers, the `.so` Python extension +files now hide all symbols except those required by Python, which can +avoid problems when embedding the Python interpreter. + +## [Authors](#id15)[#](#authors "Link to this heading") + +* Saurabh Agarwal + +* Diogo Aguiam + +* Joseph Albert + +* Gerrit Ansmann + +* Jean-François B + +* Vahan Babayan + +* Alessandro Pietro Bardelli +* Christoph Baumgarten + +* Felix Berkenkamp +* Lilian Besson + +* Aditya Bharti + +* Matthew Brett +* Evgeni Burovski +* CJ Carey +* Martin Ø. Christensen + +* Robert Cimrman +* Vicky Close + +* Peter Cock + +* Philip DeBoer +* Jaime Fernandez del Rio +* Dieter Werthmüller + +* Tom Donoghue + +* Matt Dzugan + +* Lars G + +* Jacques Gaudin + +* Andriy Gelman + +* Sean Gillies + +* Dezmond Goff +* Christoph Gohlke +* Ralf Gommers +* Uri Goren + +* Deepak Kumar Gouda + +* Douglas Lessa Graciosa + +* Matt Haberland +* David Hagen +* Charles Harris +* Jordan Heemskerk + +* Danny Hermes + +* Stephan Hoyer + +* Theodore Hu + +* Jean-François B. + +* Mads Jensen + +* Jon Haitz Legarreta Gorroño + +* Ben Jude + +* Noel Kippers + +* Julius Bier Kirkegaard + +* Maria Knorps + +* Mikkel Kristensen + +* Eric Larson +* Kasper Primdal Lauritzen + +* Denis Laxalde +* KangWon Lee + +* Jan Lehky + +* Jackie Leng + +* P.L. Lim + +* Nikolay Mayorov +* Mihai Capotă + +* Max Mikhaylov + +* Mark Mikofski + +* Jarrod Millman +* Raden Muhammad + +* Paul Nation +* Andrew Nelson +* Nico Schlömer +* Joel Nothman +* Kyle Oman + +* Egor Panfilov + +* Nick Papior +* Anubhav Patel + +* Oleksandr Pavlyk +* Ilhan Polat +* Robert Pollak + +* Anant Prakash + +* Aman Pratik +* Sean Quinn + +* Giftlin Rajaiah + +* Tyler Reddy +* Joscha Reimer +* Antonio H Ribeiro + +* Antonio Horta Ribeiro +* Benjamin Rose + +* Fabian Rost +* Divakar Roy + +* Scott Sievert +* Leo Singer +* Sourav Singh +* Martino Sorbaro + +* Eric Stansifer + +* Martin Thoma +* Phil Tooley + +* Piotr Uchwat + +* Paul van Mulbregt +* Pauli Virtanen +* Stefan van der Walt +* Warren Weckesser +* Florian Weimer + +* Eric Wieser +* Josh Wilson +* Ted Ying + +* Evgeny Zhurko +* Zé Vinícius +* @Astrofysicus + +* @awakenting + +* @endolith +* @FormerPhysicist + +* @gaulinmp + +* @hugovk +* @ksemb + +* @kshitij12345 + +* @luzpaz + +* @NKrvavica + +* @rafalalgo + +* @samyak0210 + +* @soluwalana + +* @sudheerachary + +* @Tokixix + +* @tttthomasssss + +* @vkk800 + +* @xoviat +* @ziejcow + + +A total of 122 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.1.0](#id16)[#](#issues-closed-for-1-1-0 "Link to this heading") + +* [#979](https://github.com/scipy/scipy/issues/979): Allow Hermitian matrices in lobpcg (Trac #452) +* [#2694](https://github.com/scipy/scipy/issues/2694): Solution of iterative solvers can be less accurate than tolerance… +* [#3164](https://github.com/scipy/scipy/issues/3164): RectBivariateSpline usage inconsistent with other interpolation… +* [#4161](https://github.com/scipy/scipy/issues/4161): Missing ITMAX optional argument in scipy.optimize.nnls +* [#4354](https://github.com/scipy/scipy/issues/4354): signal.slepian should use definition of digital window +* [#4866](https://github.com/scipy/scipy/issues/4866): Shouldn’t scipy.linalg.sqrtm raise an error if matrix is singular? +* [#4953](https://github.com/scipy/scipy/issues/4953): The dirichlet distribution unnecessarily requires strictly positive… +* [#5336](https://github.com/scipy/scipy/issues/5336): sqrtm on a diagonal matrix can warn “Matrix is singular and may… +* [#5922](https://github.com/scipy/scipy/issues/5922): Suboptimal convergence of Halley’s method? +* [#6036](https://github.com/scipy/scipy/issues/6036): Incorrect edge case in scipy.stats.triang.pdf +* [#6202](https://github.com/scipy/scipy/issues/6202): Enhancement: Add LDLt factorization to scipy +* [#6589](https://github.com/scipy/scipy/issues/6589): sparse.random with custom rvs callable does pass on arg to subclass +* [#6654](https://github.com/scipy/scipy/issues/6654): Spearman’s rank correlation coefficient slow with nan values… +* [#6794](https://github.com/scipy/scipy/issues/6794): Remove NumarrayType struct with numarray type names from ndimage +* [#7136](https://github.com/scipy/scipy/issues/7136): The dirichlet distribution unnecessarily rejects probabilities… +* [#7169](https://github.com/scipy/scipy/issues/7169): Will it be possible to add LDL’ factorization for Hermitian indefinite… +* [#7291](https://github.com/scipy/scipy/issues/7291): fsolve docs should say it doesn’t handle over- or under-determined… +* [#7453](https://github.com/scipy/scipy/issues/7453): binary\_opening/binary\_closing missing arguments +* [#7500](https://github.com/scipy/scipy/issues/7500): linalg.solve test failure on OS X with Accelerate +* [#7555](https://github.com/scipy/scipy/issues/7555): Integratig a function with singularities using the quad routine +* [#7624](https://github.com/scipy/scipy/issues/7624): allow setting both absolute and relative tolerance of sparse… +* [#7724](https://github.com/scipy/scipy/issues/7724): odeint documentation refers to t0 instead of t +* [#7746](https://github.com/scipy/scipy/issues/7746): False CDF values for skew normal distribution +* [#7750](https://github.com/scipy/scipy/issues/7750): mstats.winsorize documentation needs clarification +* [#7787](https://github.com/scipy/scipy/issues/7787): Documentation error in spherical Bessel, Neumann, modified spherical… +* [#7836](https://github.com/scipy/scipy/issues/7836): Scipy mmwrite incorrectly writes the zeros for skew-symmetric,… +* [#7839](https://github.com/scipy/scipy/issues/7839): sqrtm is unable to compute square root of zero matrix +* [#7847](https://github.com/scipy/scipy/issues/7847): solve is very slow since #6775 +* [#7888](https://github.com/scipy/scipy/issues/7888): Scipy 1.0.0b1 prints spurious DVODE/ZVODE/lsoda messages +* [#7909](https://github.com/scipy/scipy/issues/7909): bessel kv function in 0 is nan +* [#7915](https://github.com/scipy/scipy/issues/7915): LinearOperator’s \_\_init\_\_ runs two times when instantiating the… +* [#7958](https://github.com/scipy/scipy/issues/7958): integrate.quad could use better error messages when given bad… +* [#7968](https://github.com/scipy/scipy/issues/7968): integrate.quad handles decreasing limits (b +* [#8279](https://github.com/scipy/scipy/pull/8279): CI: fixing doctests +* [#8282](https://github.com/scipy/scipy/pull/8282): MAINT: weightedtau, change search for nan +* [#8287](https://github.com/scipy/scipy/pull/8287): Improving documentation of solve\_ivp and the underlying solvers +* [#8291](https://github.com/scipy/scipy/pull/8291): DOC: fix non-ascii characters in docstrings which broke the doc… +* [#8292](https://github.com/scipy/scipy/pull/8292): CI: use numpy 1.13 for refguide check build +* [#8296](https://github.com/scipy/scipy/pull/8296): Fixed bug reported in issue #8181 +* [#8297](https://github.com/scipy/scipy/pull/8297): DOC: Examples for linalg/decomp eigvals function +* [#8300](https://github.com/scipy/scipy/pull/8300): MAINT: Housekeeping for minimizing the linalg compiler warnings +* [#8301](https://github.com/scipy/scipy/pull/8301): DOC: make public API documentation cross-link to refguide. +* [#8302](https://github.com/scipy/scipy/pull/8302): make sure \_onenorm\_matrix\_power\_nnm actually returns a float +* [#8313](https://github.com/scipy/scipy/pull/8313): Change copyright to outdated 2008-2016 to 2008-year +* [#8315](https://github.com/scipy/scipy/pull/8315): TST: Add tests for `scipy.sparse.linalg.isolve.minres` +* [#8318](https://github.com/scipy/scipy/pull/8318): ENH: odeint: Add the argument ‘tfirst’ to odeint. +* [#8328](https://github.com/scipy/scipy/pull/8328): ENH: optimize: `trust-constr` optimization algorithms [GSoC… +* [#8330](https://github.com/scipy/scipy/pull/8330): ENH: add a maxiter argument to NNLS +* [#8331](https://github.com/scipy/scipy/pull/8331): DOC: tweak the Moyal distribution docstring +* [#8333](https://github.com/scipy/scipy/pull/8333): FIX: Rewrapped ?gels and ?gels\_lwork routines +* [#8336](https://github.com/scipy/scipy/pull/8336): MAINT: integrate: handle b < a in quad +* [#8337](https://github.com/scipy/scipy/pull/8337): BUG: special: Ensure zetac(1) returns inf. +* [#8347](https://github.com/scipy/scipy/pull/8347): BUG: Fix overflow in special.binom. Issue #8346 +* [#8356](https://github.com/scipy/scipy/pull/8356): DOC: Corrected Documentation Issue #7750 winsorize function +* [#8358](https://github.com/scipy/scipy/pull/8358): ENH: stats: Use explicit MLE formulas in lognorm.fit and expon.fit +* [#8374](https://github.com/scipy/scipy/pull/8374): BUG: gh7854, maxiter for l-bfgs-b closes #7854 +* [#8379](https://github.com/scipy/scipy/pull/8379): CI: enable gcov coverage on travis +* [#8383](https://github.com/scipy/scipy/pull/8383): Removed collections.OrderedDict import ignore. +* [#8384](https://github.com/scipy/scipy/pull/8384): TravisCI: tool pep8 is now pycodestyle +* [#8387](https://github.com/scipy/scipy/pull/8387): MAINT: special: remove unused specfun code for Struve functions +* [#8393](https://github.com/scipy/scipy/pull/8393): DOC: Replace old type names in ndimage tutorial. +* [#8400](https://github.com/scipy/scipy/pull/8400): Fix tolerance specification in sparse.linalg iterative solvers +* [#8402](https://github.com/scipy/scipy/pull/8402): MAINT: Some small cleanups in ndimage. +* [#8403](https://github.com/scipy/scipy/pull/8403): FIX: Make scipy.optimize.zeros run under PyPy +* [#8407](https://github.com/scipy/scipy/pull/8407): BUG: sparse.linalg: fix termination bugs for cg, cgs +* [#8409](https://github.com/scipy/scipy/pull/8409): MAINT: special: add a *pxd* file for Cephes functions +* [#8412](https://github.com/scipy/scipy/pull/8412): MAINT: special: remove *cephes/protos.h* +* [#8421](https://github.com/scipy/scipy/pull/8421): Setting “unknown” message in OptimizeResult when calling MINPACK. +* [#8423](https://github.com/scipy/scipy/pull/8423): FIX: Handle unsigned integers in mmio +* [#8426](https://github.com/scipy/scipy/pull/8426): DOC: correct FAQ entry on Apache license compatibility. Closes… +* [#8433](https://github.com/scipy/scipy/pull/8433): MAINT: add *pytest\_cache* to the *gitignore* +* [#8436](https://github.com/scipy/scipy/pull/8436): MAINT: scipy.sparse: less copies at transpose method +* [#8437](https://github.com/scipy/scipy/pull/8437): BUG: correct behavior for skew-symmetric matrices in io.mmwrite +* [#8440](https://github.com/scipy/scipy/pull/8440): DOC:Add examples to integrate.quadpack docstrings +* [#8441](https://github.com/scipy/scipy/pull/8441): BUG: sparse.linalg/gmres: deal with exact breakdown in gmres +* [#8442](https://github.com/scipy/scipy/pull/8442): MAINT: special: clean up Cephes header files +* [#8448](https://github.com/scipy/scipy/pull/8448): TST: Generalize doctest stopwords .axis( .plot( +* [#8457](https://github.com/scipy/scipy/pull/8457): MAINT: special: use JSON for function signatures in *\_generate\_pyx.py* +* [#8461](https://github.com/scipy/scipy/pull/8461): MAINT: Simplify return value of ndimage functions. +* [#8464](https://github.com/scipy/scipy/pull/8464): MAINT: Trivial typos +* [#8474](https://github.com/scipy/scipy/pull/8474): BUG: spatial: make qhull.pyx more pypy-friendly +* [#8476](https://github.com/scipy/scipy/pull/8476): TST: \_lib: disable refcounting tests on PyPy +* [#8479](https://github.com/scipy/scipy/pull/8479): BUG: io/matlab: fix issues in matlab i/o on pypy +* [#8481](https://github.com/scipy/scipy/pull/8481): DOC: Example for signal.cmplx\_sort +* [#8482](https://github.com/scipy/scipy/pull/8482): TST: integrate: use integers instead of PyCapsules to store pointers +* [#8483](https://github.com/scipy/scipy/pull/8483): ENH: io/netcdf: make mmap=False the default on PyPy +* [#8484](https://github.com/scipy/scipy/pull/8484): BUG: io/matlab: work around issue in to\_writeable on PyPy +* [#8488](https://github.com/scipy/scipy/pull/8488): MAINT: special: add const/static specifiers where possible +* [#8489](https://github.com/scipy/scipy/pull/8489): BUG: ENH: use common halley’s method instead of parabolic variant +* [#8491](https://github.com/scipy/scipy/pull/8491): DOC: fix typos +* [#8496](https://github.com/scipy/scipy/pull/8496): ENH: special: make Chebyshev nodes symmetric +* [#8501](https://github.com/scipy/scipy/pull/8501): BUG: stats: Split the integral used to compute skewnorm.cdf. +* [#8502](https://github.com/scipy/scipy/pull/8502): WIP: Port CircleCI to v2 +* [#8507](https://github.com/scipy/scipy/pull/8507): DOC: Add missing description to *brute\_force* parameter. +* [#8509](https://github.com/scipy/scipy/pull/8509): BENCH: forgot to add nelder-mead to list of methods +* [#8512](https://github.com/scipy/scipy/pull/8512): MAINT: Move spline interpolation code to spline.c +* [#8513](https://github.com/scipy/scipy/pull/8513): TST: special: mark a slow test as xslow +* [#8514](https://github.com/scipy/scipy/pull/8514): CircleCI: Share data between jobs +* [#8515](https://github.com/scipy/scipy/pull/8515): ENH: special: improve accuracy of *zetac* for negative arguments +* [#8520](https://github.com/scipy/scipy/pull/8520): TST: Decrease the array sizes for two linalg tests +* [#8522](https://github.com/scipy/scipy/pull/8522): TST: special: restrict range of *test\_besselk*/*test\_besselk\_int* +* [#8527](https://github.com/scipy/scipy/pull/8527): Documentation - example added for voronoi\_plot\_2d +* [#8528](https://github.com/scipy/scipy/pull/8528): DOC: Better, shared docstrings in ndimage +* [#8533](https://github.com/scipy/scipy/pull/8533): BUG: Fix PEP8 errors introduced in #8528. +* [#8534](https://github.com/scipy/scipy/pull/8534): ENH: Expose additional window functions +* [#8538](https://github.com/scipy/scipy/pull/8538): MAINT: Fix a couple mistakes in .pyf files. +* [#8540](https://github.com/scipy/scipy/pull/8540): ENH: interpolate: allow string aliases in make\_interp\_spline… +* [#8541](https://github.com/scipy/scipy/pull/8541): ENH: Cythonize peak\_prominences +* [#8542](https://github.com/scipy/scipy/pull/8542): Remove numerical arguments from convolve2d / correlate2d +* [#8546](https://github.com/scipy/scipy/pull/8546): ENH: New arguments, documentation, and tests for ndimage.binary\_opening +* [#8547](https://github.com/scipy/scipy/pull/8547): Giving both size and input now raises UserWarning (#7334) +* [#8549](https://github.com/scipy/scipy/pull/8549): DOC: stats: invweibull is also known as Frechet or type II extreme… +* [#8550](https://github.com/scipy/scipy/pull/8550): add cdf2rdf function +* [#8551](https://github.com/scipy/scipy/pull/8551): ENH: Port of most of the dd\_real part of the qd high-precision… +* [#8553](https://github.com/scipy/scipy/pull/8553): Note in docs to address issue #3164. +* [#8554](https://github.com/scipy/scipy/pull/8554): ENH: stats: Use explicit MLE formulas in uniform.fit() +* [#8555](https://github.com/scipy/scipy/pull/8555): MAINT: adjust benchmark config +* [#8557](https://github.com/scipy/scipy/pull/8557): [DOC]: fix Nakagami density docstring +* [#8559](https://github.com/scipy/scipy/pull/8559): DOC: Fix docstring of diric(x, n) +* [#8563](https://github.com/scipy/scipy/pull/8563): [DOC]: fix gamma density docstring +* [#8564](https://github.com/scipy/scipy/pull/8564): BLD: change default Python version for doc build from 2.7 to… +* [#8568](https://github.com/scipy/scipy/pull/8568): BUG: Fixes Bland’s Rule for pivot row/leaving variable, closes… +* [#8572](https://github.com/scipy/scipy/pull/8572): ENH: Add previous/next to interp1d +* [#8578](https://github.com/scipy/scipy/pull/8578): Example for linalg.eig() +* [#8580](https://github.com/scipy/scipy/pull/8580): DOC: update link to asv docs +* [#8584](https://github.com/scipy/scipy/pull/8584): filter\_design: switch to explicit arguments, keeping None as… +* [#8586](https://github.com/scipy/scipy/pull/8586): DOC: stats: Add parentheses that were missing in the exponnorm… +* [#8587](https://github.com/scipy/scipy/pull/8587): TST: add benchmark for newton, secant, halley +* [#8588](https://github.com/scipy/scipy/pull/8588): DOC: special: Remove heaviside from “functions not in special”… +* [#8591](https://github.com/scipy/scipy/pull/8591): DOC: cdf2rdf Added version info and “See also” +* [#8594](https://github.com/scipy/scipy/pull/8594): ENH: Cythonize peak\_widths +* [#8595](https://github.com/scipy/scipy/pull/8595): MAINT/ENH/BUG/TST: cdf2rdf: Address review comments made after… +* [#8597](https://github.com/scipy/scipy/pull/8597): DOC: add versionadded 1.1.0 for new keywords in ndimage.morphology +* [#8605](https://github.com/scipy/scipy/pull/8605): MAINT: special: improve implementations of *sinpi* and *cospi* +* [#8607](https://github.com/scipy/scipy/pull/8607): MAINT: add 2D benchmarks for convolve +* [#8608](https://github.com/scipy/scipy/pull/8608): FIX: Fix int check +* [#8613](https://github.com/scipy/scipy/pull/8613): fix typo in doc of signal.peak\_widths +* [#8615](https://github.com/scipy/scipy/pull/8615): TST: fix failing linalg.qz float32 test by decreasing precision. +* [#8617](https://github.com/scipy/scipy/pull/8617): MAINT: clean up code in ellpj.c +* [#8618](https://github.com/scipy/scipy/pull/8618): add fsolve docs it doesn’t handle over- or under-determined problems +* [#8620](https://github.com/scipy/scipy/pull/8620): DOC: add note on dtype attribute of aslinearoperator() argument +* [#8627](https://github.com/scipy/scipy/pull/8627): ENH: Add example 1D signal (ECG) to scipy.misc +* [#8630](https://github.com/scipy/scipy/pull/8630): ENH: Remove unnecessary copying in stats.percentileofscore +* [#8631](https://github.com/scipy/scipy/pull/8631): BLD: fix pdf doc build. closes gh-8076 +* [#8633](https://github.com/scipy/scipy/pull/8633): BUG: fix regression in *io.netcdf\_file* with append mode. +* [#8635](https://github.com/scipy/scipy/pull/8635): MAINT: remove spurious warning from (z)vode and lsoda. Closes… +* [#8636](https://github.com/scipy/scipy/pull/8636): BUG: sparse.linalg/gcrotmk: avoid rounding error in termination… +* [#8637](https://github.com/scipy/scipy/pull/8637): For pdf build +* [#8639](https://github.com/scipy/scipy/pull/8639): CI: build pdf documentation on circleci +* [#8640](https://github.com/scipy/scipy/pull/8640): TST: fix special test that was importing *np.testing.utils* (deprecated) +* [#8641](https://github.com/scipy/scipy/pull/8641): BUG: optimize: fixed sparse redundancy removal bug +* [#8645](https://github.com/scipy/scipy/pull/8645): BUG: modified sigmaclip to avoid clipping of constant input in… +* [#8647](https://github.com/scipy/scipy/pull/8647): TST: sparse: skip test\_inplace\_dense for numpy<1.13 +* [#8657](https://github.com/scipy/scipy/pull/8657): Latex reduce left margins +* [#8659](https://github.com/scipy/scipy/pull/8659): TST: special: skip sign-of-zero test on 32-bit win32 with old… +* [#8661](https://github.com/scipy/scipy/pull/8661): Fix dblquad and tplquad not accepting float boundaries +* [#8666](https://github.com/scipy/scipy/pull/8666): DOC: fixes #8532 +* [#8667](https://github.com/scipy/scipy/pull/8667): BUG: optimize: fixed issue #8663 +* [#8668](https://github.com/scipy/scipy/pull/8668): Fix example in docstring of netcdf\_file +* [#8671](https://github.com/scipy/scipy/pull/8671): DOC: Replace deprecated matplotlib kwarg +* [#8673](https://github.com/scipy/scipy/pull/8673): BUG: special: Use a stricter tolerance for the chndtr calculation. +* [#8674](https://github.com/scipy/scipy/pull/8674): ENH: In the Dirichlet distribution allow x\_i to be 0 if alpha\_i… +* [#8676](https://github.com/scipy/scipy/pull/8676): BUG: optimize: partial fix to linprog fails to detect infeasibility… +* [#8685](https://github.com/scipy/scipy/pull/8685): DOC: Add interp1d-next/previous example to tutorial +* [#8687](https://github.com/scipy/scipy/pull/8687): TST: netcdf: explicit mmap=True in test +* [#8688](https://github.com/scipy/scipy/pull/8688): BUG: signal, stats: use Python sum() instead of np.sum for summing… +* [#8689](https://github.com/scipy/scipy/pull/8689): TST: bump tolerances in tests +* [#8690](https://github.com/scipy/scipy/pull/8690): DEP: deprecate stats.itemfreq +* [#8691](https://github.com/scipy/scipy/pull/8691): BLD: special: fix build vs. dd\_real.h package +* [#8695](https://github.com/scipy/scipy/pull/8695): DOC: Improve examples in signal.find\_peaks with ECG signal +* [#8697](https://github.com/scipy/scipy/pull/8697): BUG: Fix *setup.py build install egg\_info*, which did not previously… +* [#8704](https://github.com/scipy/scipy/pull/8704): TST: linalg: drop large size from solve() test +* [#8705](https://github.com/scipy/scipy/pull/8705): DOC: Describe signal.find\_peaks and related functions behavior… +* [#8706](https://github.com/scipy/scipy/pull/8706): DOC: Specify encoding of rst file, remove an ambiguity in an… +* [#8710](https://github.com/scipy/scipy/pull/8710): MAINT: fix an import cycle sparse -> special -> integrate ->… +* [#8711](https://github.com/scipy/scipy/pull/8711): ENH: remove an avoidable overflow in scipy.stats.norminvgauss.pdf() +* [#8716](https://github.com/scipy/scipy/pull/8716): BUG: interpolate: allow list inputs for make\_interp\_spline(…,… +* [#8720](https://github.com/scipy/scipy/pull/8720): np.testing import that is compatible with numpy 1.15 +* [#8724](https://github.com/scipy/scipy/pull/8724): CI: don’t use pyproject.toml in the CI builds diff --git a/corpus/changelog/scipy_releases/scipy_1100.md b/corpus/changelog/scipy_releases/scipy_1100.md new file mode 100644 index 0000000000000000000000000000000000000000..7882f8a39b4cbf31de5b3df90b90d6d785f92220 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1100.md @@ -0,0 +1,1198 @@ +# SciPy 1.10.0 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.10.0-notes.html +Version: 1.10.0 + +Contents + +* [SciPy 1.10.0 Release Notes](#scipy-1-10-0-release-notes) + + + [Highlights of this release](#highlights-of-this-release) + + [New features](#new-features) + + - [[`scipy.datasets`](../reference/datasets.html#module-scipy.datasets "scipy.datasets") introduction](#scipy-datasets-introduction) + - [[`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") improvements](#scipy-integrate-improvements) + - [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#scipy-interpolate-improvements) + - [[`scipy.sparse.linalg`](../reference/sparse.linalg.html#module-scipy.sparse.linalg "scipy.sparse.linalg") improvements](#scipy-sparse-linalg-improvements) + - [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#scipy-linalg-improvements) + - [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#scipy-ndimage-improvements) + - [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#scipy-optimize-improvements) + - [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#scipy-signal-improvements) + - [[`scipy.sparse.csgraph`](../reference/sparse.csgraph.html#module-scipy.sparse.csgraph "scipy.sparse.csgraph") improvements](#scipy-sparse-csgraph-improvements) + - [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#scipy-special-improvements) + - [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#scipy-stats-improvements) + + [Deprecated features](#deprecated-features) + + [Expired Deprecations](#expired-deprecations) + + [Other changes](#other-changes) + + [Authors](#authors) + + [Issues closed for 1.10.0](#issues-closed-for-1-10-0) + + [Pull requests for 1.10.0](#pull-requests-for-1-10-0) + +SciPy 1.10.0 is the culmination of 6 months of hard work. It contains +many new features, numerous bug-fixes, improved test coverage and better +documentation. There have been a number of deprecations and API changes +in this release, which are documented below. All users are encouraged to +upgrade to this release, as there are a large number of bug-fixes and +optimizations. Before upgrading, we recommend that users check that +their own code does not use deprecated SciPy functionality (to do so, +run your code with `python -Wd` and check for `DeprecationWarning` s). +Our development attention will now shift to bug-fix releases on the +1.10.x branch, and on adding new features on the main branch. + +This release requires Python 3.8+ and NumPy 1.19.5 or greater. + +For running on PyPy, PyPy3 6.0+ is required. + +## [Highlights of this release](#id2)[#](#highlights-of-this-release "Link to this heading") + +* A new dedicated datasets submodule ([`scipy.datasets`](../reference/datasets.html#module-scipy.datasets "scipy.datasets")) has been added, and is + now preferred over usage of *scipy.misc* for dataset retrieval. +* A new [`scipy.interpolate.make_smoothing_spline`](../reference/generated/scipy.interpolate.make_smoothing_spline.html#scipy.interpolate.make_smoothing_spline "scipy.interpolate.make_smoothing_spline") function was added. This + function constructs a smoothing cubic spline from noisy data, using the + generalized cross-validation (GCV) criterion to find the tradeoff between + smoothness and proximity to data points. +* [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") has three new distributions, two new hypothesis tests, three + new sample statistics, a class for greater control over calculations + involving covariance matrices, and many other enhancements. + +## [New features](#id3)[#](#new-features "Link to this heading") + +### [[`scipy.datasets`](../reference/datasets.html#module-scipy.datasets "scipy.datasets") introduction](#id4)[#](#scipy-datasets-introduction "Link to this heading") + +* A new dedicated `datasets` submodule has been added. The submodules + is meant for datasets that are relevant to other SciPy submodules ands + content (tutorials, examples, tests), as well as contain a curated + set of datasets that are of wider interest. As of this release, all + the datasets from *scipy.misc* have been added to [`scipy.datasets`](../reference/datasets.html#module-scipy.datasets "scipy.datasets") + (and deprecated in *scipy.misc*). +* The submodule is based on [Pooch]() + (a new optional dependency for SciPy), a Python package to simplify fetching + data files. This move will, in a subsequent release, facilitate SciPy + to trim down the sdist/wheel sizes, by decoupling the data files and + moving them out of the SciPy repository, hosting them externally and + downloading them when requested. After downloading the datasets once, + the files are cached to avoid network dependence and repeated usage. +* Added datasets from `scipy.misc`: [`scipy.datasets.face`](../reference/generated/scipy.datasets.face.html#scipy.datasets.face "scipy.datasets.face"), + [`scipy.datasets.ascent`](../reference/generated/scipy.datasets.ascent.html#scipy.datasets.ascent "scipy.datasets.ascent"), [`scipy.datasets.electrocardiogram`](../reference/generated/scipy.datasets.electrocardiogram.html#scipy.datasets.electrocardiogram "scipy.datasets.electrocardiogram") +* Added download and caching functionality: + + + [`scipy.datasets.download_all`](../reference/generated/scipy.datasets.download_all.html#scipy.datasets.download_all "scipy.datasets.download_all"): a function to download all the [`scipy.datasets`](../reference/datasets.html#module-scipy.datasets "scipy.datasets") + associated files at once. + + [`scipy.datasets.clear_cache`](../reference/generated/scipy.datasets.clear_cache.html#scipy.datasets.clear_cache "scipy.datasets.clear_cache"): a simple utility function to clear cached dataset + files from the file system. + + `scipy/datasets/_download_all.py` can be run as a standalone script for + packaging purposes to avoid any external dependency at build or test time. + This can be used by SciPy packagers (e.g., for Linux distros) which may + have to adhere to rules that forbid downloading sources from external + repositories at package build time. + +### [[`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") improvements](#id5)[#](#scipy-integrate-improvements "Link to this heading") + +* Added parameter `complex_func` to [`scipy.integrate.quad`](../reference/generated/scipy.integrate.quad.html#scipy.integrate.quad "scipy.integrate.quad"), which can be set + `True` to integrate a complex integrand. + +### [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#id6)[#](#scipy-interpolate-improvements "Link to this heading") + +* [`scipy.interpolate.interpn`](../reference/generated/scipy.interpolate.interpn.html#scipy.interpolate.interpn "scipy.interpolate.interpn") now supports tensor-product interpolation methods + (`slinear`, `cubic`, `quintic` and `pchip`) +* Tensor-product interpolation methods (`slinear`, `cubic`, `quintic` and + `pchip`) in [`scipy.interpolate.interpn`](../reference/generated/scipy.interpolate.interpn.html#scipy.interpolate.interpn "scipy.interpolate.interpn") and + [`scipy.interpolate.RegularGridInterpolator`](../reference/generated/scipy.interpolate.RegularGridInterpolator.html#scipy.interpolate.RegularGridInterpolator "scipy.interpolate.RegularGridInterpolator") now allow values with trailing + dimensions. +* [`scipy.interpolate.RegularGridInterpolator`](../reference/generated/scipy.interpolate.RegularGridInterpolator.html#scipy.interpolate.RegularGridInterpolator "scipy.interpolate.RegularGridInterpolator") has a new fast path for + `method="linear"` with 2D data, and `RegularGridInterpolator` is now + easier to subclass +* [`scipy.interpolate.interp1d`](../reference/generated/scipy.interpolate.interp1d.html#scipy.interpolate.interp1d "scipy.interpolate.interp1d") now can take a single value for non-spline + methods. +* A new `extrapolate` argument is available to [`scipy.interpolate.BSpline.design_matrix`](../reference/generated/scipy.interpolate.BSpline.design_matrix.html#scipy.interpolate.BSpline.design_matrix "scipy.interpolate.BSpline.design_matrix"), + allowing extrapolation based on the first and last intervals. +* A new function [`scipy.interpolate.make_smoothing_spline`](../reference/generated/scipy.interpolate.make_smoothing_spline.html#scipy.interpolate.make_smoothing_spline "scipy.interpolate.make_smoothing_spline") has been added. It is an + implementation of the generalized cross-validation spline smoothing + algorithm. The `lam=None` (default) mode of this function is a clean-room + reimplementation of the classic `gcvspl.f` Fortran algorithm for + constructing GCV splines. +* A new `method="pchip"` mode was aded to + [`scipy.interpolate.RegularGridInterpolator`](../reference/generated/scipy.interpolate.RegularGridInterpolator.html#scipy.interpolate.RegularGridInterpolator "scipy.interpolate.RegularGridInterpolator"). This mode constructs an + interpolator using tensor products of C1-continuous monotone splines + (essentially, a [`scipy.interpolate.PchipInterpolator`](../reference/generated/scipy.interpolate.PchipInterpolator.html#scipy.interpolate.PchipInterpolator "scipy.interpolate.PchipInterpolator") instance per + dimension). + +### [[`scipy.sparse.linalg`](../reference/sparse.linalg.html#module-scipy.sparse.linalg "scipy.sparse.linalg") improvements](#id7)[#](#scipy-sparse-linalg-improvements "Link to this heading") + +* The spectral 2-norm is now available in [`scipy.sparse.linalg.norm`](../reference/generated/scipy.sparse.linalg.norm.html#scipy.sparse.linalg.norm "scipy.sparse.linalg.norm"). +* The performance of [`scipy.sparse.linalg.norm`](../reference/generated/scipy.sparse.linalg.norm.html#scipy.sparse.linalg.norm "scipy.sparse.linalg.norm") for the default case (Frobenius + norm) has been improved. +* LAPACK wrappers were added for `trexc` and `trsen`. +* The [`scipy.sparse.linalg.lobpcg`](../reference/generated/scipy.sparse.linalg.lobpcg.html#scipy.sparse.linalg.lobpcg "scipy.sparse.linalg.lobpcg") algorithm was rewritten, yielding + the following improvements: + + + a simple tunable restart potentially increases the attainable + accuracy for edge cases, + + internal postprocessing runs one final exact Rayleigh-Ritz method + giving more accurate and orthonormal eigenvectors, + + output the computed iterate with the smallest max norm of the residual + and drop the history of subsequent iterations, + + remove the check for `LinearOperator` format input and thus allow + a simple function handle of a callable object as an input, + + better handling of common user errors with input data, rather + than letting the algorithm fail. + +### [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#id8)[#](#scipy-linalg-improvements "Link to this heading") + +* [`scipy.linalg.lu_factor`](../reference/generated/scipy.linalg.lu_factor.html#scipy.linalg.lu_factor "scipy.linalg.lu_factor") now accepts rectangular arrays instead of being restricted + to square arrays. + +### [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#id9)[#](#scipy-ndimage-improvements "Link to this heading") + +* The new [`scipy.ndimage.value_indices`](../reference/generated/scipy.ndimage.value_indices.html#scipy.ndimage.value_indices "scipy.ndimage.value_indices") function provides a time-efficient method to + search for the locations of individual values with an array of image data. +* A new `radius` argument is supported by [`scipy.ndimage.gaussian_filter1d`](../reference/generated/scipy.ndimage.gaussian_filter1d.html#scipy.ndimage.gaussian_filter1d "scipy.ndimage.gaussian_filter1d") and + [`scipy.ndimage.gaussian_filter`](../reference/generated/scipy.ndimage.gaussian_filter.html#scipy.ndimage.gaussian_filter "scipy.ndimage.gaussian_filter") for adjusting the kernel size of the filter. + +### [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#id10)[#](#scipy-optimize-improvements "Link to this heading") + +* [`scipy.optimize.brute`](../reference/generated/scipy.optimize.brute.html#scipy.optimize.brute "scipy.optimize.brute") now coerces non-iterable/single-value `args` into a + tuple. +* [`scipy.optimize.least_squares`](../reference/generated/scipy.optimize.least_squares.html#scipy.optimize.least_squares "scipy.optimize.least_squares") and [`scipy.optimize.curve_fit`](../reference/generated/scipy.optimize.curve_fit.html#scipy.optimize.curve_fit "scipy.optimize.curve_fit") now accept + [`scipy.optimize.Bounds`](../reference/generated/scipy.optimize.Bounds.html#scipy.optimize.Bounds "scipy.optimize.Bounds") for bounds constraints. +* Added a tutorial for [`scipy.optimize.milp`](../reference/generated/scipy.optimize.milp.html#scipy.optimize.milp "scipy.optimize.milp"). +* Improved the pretty-printing of [`scipy.optimize.OptimizeResult`](../reference/generated/scipy.optimize.OptimizeResult.html#scipy.optimize.OptimizeResult "scipy.optimize.OptimizeResult") objects. +* Additional options (`parallel`, `threads`, `mip_rel_gap`) can now + be passed to [`scipy.optimize.linprog`](../reference/generated/scipy.optimize.linprog.html#scipy.optimize.linprog "scipy.optimize.linprog") with `method='highs'`. + +### [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#id11)[#](#scipy-signal-improvements "Link to this heading") + +* The new window function [`scipy.signal.windows.lanczos`](../reference/generated/scipy.signal.windows.lanczos.html#scipy.signal.windows.lanczos "scipy.signal.windows.lanczos") was added to compute a + Lanczos window, also known as a sinc window. + +### [[`scipy.sparse.csgraph`](../reference/sparse.csgraph.html#module-scipy.sparse.csgraph "scipy.sparse.csgraph") improvements](#id12)[#](#scipy-sparse-csgraph-improvements "Link to this heading") + +* the performance of [`scipy.sparse.csgraph.dijkstra`](../reference/generated/scipy.sparse.csgraph.dijkstra.html#scipy.sparse.csgraph.dijkstra "scipy.sparse.csgraph.dijkstra") has been improved, and + star graphs in particular see a marked performance improvement + +### [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#id13)[#](#scipy-special-improvements "Link to this heading") + +* The new function [`scipy.special.powm1`](../reference/generated/scipy.special.powm1.html#scipy.special.powm1 "scipy.special.powm1"), a ufunc with signature + `powm1(x, y)`, computes `x**y - 1`. The function avoids the loss of + precision that can result when `y` is close to 0 or when `x` is close to + 1. +* [`scipy.special.erfinv`](../reference/generated/scipy.special.erfinv.html#scipy.special.erfinv "scipy.special.erfinv") is now more accurate as it leverages the Boost equivalent under + the hood. + +### [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#id14)[#](#scipy-stats-improvements "Link to this heading") + +* Added [`scipy.stats.goodness_of_fit`](../reference/generated/scipy.stats.goodness_of_fit.html#scipy.stats.goodness_of_fit "scipy.stats.goodness_of_fit"), a generalized goodness-of-fit test for + use with any univariate distribution, any combination of known and unknown + parameters, and several choices of test statistic (Kolmogorov-Smirnov, + Cramer-von Mises, and Anderson-Darling). +* Improved [`scipy.stats.bootstrap`](../reference/generated/scipy.stats.bootstrap.html#scipy.stats.bootstrap "scipy.stats.bootstrap"): Default method `'BCa'` now supports + multi-sample statistics. Also, the bootstrap distribution is returned in the + result object, and the result object can be passed into the function as + parameter `bootstrap_result` to add additional resamples or change the + confidence interval level and type. +* Added maximum spacing estimation to [`scipy.stats.fit`](../reference/generated/scipy.stats.fit.html#scipy.stats.fit "scipy.stats.fit"). +* Added the Poisson means test (“E-test”) as [`scipy.stats.poisson_means_test`](../reference/generated/scipy.stats.poisson_means_test.html#scipy.stats.poisson_means_test "scipy.stats.poisson_means_test"). +* Added new sample statistics. + + + Added [`scipy.stats.contingency.odds_ratio`](../reference/generated/scipy.stats.contingency.odds_ratio.html#scipy.stats.contingency.odds_ratio "scipy.stats.contingency.odds_ratio") to compute both the conditional + and unconditional odds ratios and corresponding confidence intervals for + 2x2 contingency tables. + + Added [`scipy.stats.directional_stats`](../reference/generated/scipy.stats.directional_stats.html#scipy.stats.directional_stats "scipy.stats.directional_stats") to compute sample statistics of + n-dimensional directional data. + + Added [`scipy.stats.expectile`](../reference/generated/scipy.stats.expectile.html#scipy.stats.expectile "scipy.stats.expectile"), which generalizes the expected value in the + same way as quantiles are a generalization of the median. +* Added new statistical distributions. + + + Added [`scipy.stats.uniform_direction`](../reference/generated/scipy.stats.uniform_direction.html#scipy.stats.uniform_direction "scipy.stats.uniform_direction"), a multivariate distribution to + sample uniformly from the surface of a hypersphere. + + Added [`scipy.stats.random_table`](../reference/generated/scipy.stats.random_table.html#scipy.stats.random_table "scipy.stats.random_table"), a multivariate distribution to sample + uniformly from m x n contingency tables with provided marginals. + + Added [`scipy.stats.truncpareto`](../reference/generated/scipy.stats.truncpareto.html#scipy.stats.truncpareto "scipy.stats.truncpareto"), the truncated Pareto distribution. +* Improved the `fit` method of several distributions. + + + [`scipy.stats.skewnorm`](../reference/generated/scipy.stats.skewnorm.html#scipy.stats.skewnorm "scipy.stats.skewnorm") and [`scipy.stats.weibull_min`](../reference/generated/scipy.stats.weibull_min.html#scipy.stats.weibull_min "scipy.stats.weibull_min") now use an analytical + solution when `method='mm'`, which also serves a starting guess to + improve the performance of `method='mle'`. + + [`scipy.stats.gumbel_r`](../reference/generated/scipy.stats.gumbel_r.html#scipy.stats.gumbel_r "scipy.stats.gumbel_r") and [`scipy.stats.gumbel_l`](../reference/generated/scipy.stats.gumbel_l.html#scipy.stats.gumbel_l "scipy.stats.gumbel_l"): analytical maximum + likelihood estimates have been extended to the cases in which location or + scale are fixed by the user. + + Analytical maximum likelihood estimates have been added for + [`scipy.stats.powerlaw`](../reference/generated/scipy.stats.powerlaw.html#scipy.stats.powerlaw "scipy.stats.powerlaw"). +* Improved random variate sampling of several distributions. + + + Drawing multiple samples from [`scipy.stats.matrix_normal`](../reference/generated/scipy.stats.matrix_normal.html#scipy.stats.matrix_normal "scipy.stats.matrix_normal"), + [`scipy.stats.ortho_group`](../reference/generated/scipy.stats.ortho_group.html#scipy.stats.ortho_group "scipy.stats.ortho_group"), [`scipy.stats.special_ortho_group`](../reference/generated/scipy.stats.special_ortho_group.html#scipy.stats.special_ortho_group "scipy.stats.special_ortho_group"), and + [`scipy.stats.unitary_group`](../reference/generated/scipy.stats.unitary_group.html#scipy.stats.unitary_group "scipy.stats.unitary_group") is faster. + + The `rvs` method of [`scipy.stats.vonmises`](../reference/generated/scipy.stats.vonmises.html#scipy.stats.vonmises "scipy.stats.vonmises") now wraps to the interval + `[-np.pi, np.pi]`. + + Improved the reliability of [`scipy.stats.loggamma`](../reference/generated/scipy.stats.loggamma.html#scipy.stats.loggamma "scipy.stats.loggamma") `rvs` method for small + values of the shape parameter. +* Improved the speed and/or accuracy of functions of several statistical + distributions. + + + Added [`scipy.stats.Covariance`](../reference/generated/scipy.stats.Covariance.html#scipy.stats.Covariance "scipy.stats.Covariance") for better speed, accuracy, and user control + in multivariate normal calculations. + + [`scipy.stats.skewnorm`](../reference/generated/scipy.stats.skewnorm.html#scipy.stats.skewnorm "scipy.stats.skewnorm") methods `cdf`, `sf`, `ppf`, and `isf` + methods now use the implementations from Boost, improving speed while + maintaining accuracy. The calculation of higher-order moments is also + faster and more accurate. + + [`scipy.stats.invgauss`](../reference/generated/scipy.stats.invgauss.html#scipy.stats.invgauss "scipy.stats.invgauss") methods `ppf` and `isf` methods now use the + implementations from Boost, improving speed and accuracy. + + [`scipy.stats.invweibull`](../reference/generated/scipy.stats.invweibull.html#scipy.stats.invweibull "scipy.stats.invweibull") methods `sf` and `isf` are more accurate for + small probability masses. + + [`scipy.stats.nct`](../reference/generated/scipy.stats.nct.html#scipy.stats.nct "scipy.stats.nct") and [`scipy.stats.ncx2`](../reference/generated/scipy.stats.ncx2.html#scipy.stats.ncx2 "scipy.stats.ncx2") now rely on the implementations + from Boost, improving speed and accuracy. + + Implemented the `logpdf` method of [`scipy.stats.vonmises`](../reference/generated/scipy.stats.vonmises.html#scipy.stats.vonmises "scipy.stats.vonmises") for reliability + in extreme tails. + + Implemented the `isf` method of [`scipy.stats.levy`](../reference/generated/scipy.stats.levy.html#scipy.stats.levy "scipy.stats.levy") for speed and + accuracy. + + Improved the robustness of [`scipy.stats.studentized_range`](../reference/generated/scipy.stats.studentized_range.html#scipy.stats.studentized_range "scipy.stats.studentized_range") for large `df` + by adding an infinite degree-of-freedom approximation. + + Added a parameter `lower_limit` to [`scipy.stats.multivariate_normal`](../reference/generated/scipy.stats.multivariate_normal.html#scipy.stats.multivariate_normal "scipy.stats.multivariate_normal"), + allowing the user to change the integration limit from -inf to a desired + value. + + Improved the robustness of `entropy` of [`scipy.stats.vonmises`](../reference/generated/scipy.stats.vonmises.html#scipy.stats.vonmises "scipy.stats.vonmises") for large + concentration values. +* Enhanced [`scipy.stats.gaussian_kde`](../reference/generated/scipy.stats.gaussian_kde.html#scipy.stats.gaussian_kde "scipy.stats.gaussian_kde"). + + + Added [`scipy.stats.gaussian_kde.marginal`](../reference/generated/scipy.stats.gaussian_kde.marginal.html#scipy.stats.gaussian_kde.marginal "scipy.stats.gaussian_kde.marginal"), which returns the desired + marginal distribution of the original kernel density estimate distribution. + + The `cdf` method of [`scipy.stats.gaussian_kde`](../reference/generated/scipy.stats.gaussian_kde.html#scipy.stats.gaussian_kde "scipy.stats.gaussian_kde") now accepts a + `lower_limit` parameter for integrating the PDF over a rectangular region. + + Moved calculations for [`scipy.stats.gaussian_kde.logpdf`](../reference/generated/scipy.stats.gaussian_kde.logpdf.html#scipy.stats.gaussian_kde.logpdf "scipy.stats.gaussian_kde.logpdf") to Cython, + improving speed. + + The global interpreter lock is released by the `pdf` method of + [`scipy.stats.gaussian_kde`](../reference/generated/scipy.stats.gaussian_kde.html#scipy.stats.gaussian_kde "scipy.stats.gaussian_kde") for improved multithreading performance. + + Replaced explicit matrix inversion with Cholesky decomposition for speed + and accuracy. +* Enhanced the result objects returned by many [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") functions + + + Added a `confidence_interval` method to the result object returned by + [`scipy.stats.ttest_1samp`](../reference/generated/scipy.stats.ttest_1samp.html#scipy.stats.ttest_1samp "scipy.stats.ttest_1samp") and [`scipy.stats.ttest_rel`](../reference/generated/scipy.stats.ttest_rel.html#scipy.stats.ttest_rel "scipy.stats.ttest_rel"). + + The [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") functions `combine_pvalues`, `fisher_exact`, + `chi2_contingency`, `median_test` and `mood` now return + bunch objects rather than plain tuples, allowing attributes to be + accessed by name. + + Attributes of the result objects returned by `multiscale_graphcorr`, + `anderson_ksamp`, `binomtest`, `crosstab`, `pointbiserialr`, + `spearmanr`, `kendalltau`, and `weightedtau` have been renamed to + `statistic` and `pvalue` for consistency throughout [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats"). + Old attribute names are still allowed for backward compatibility. + + [`scipy.stats.anderson`](../reference/generated/scipy.stats.anderson.html#scipy.stats.anderson "scipy.stats.anderson") now returns the parameters of the fitted + distribution in a [`scipy.stats._result_classes.FitResult`](../reference/generated/scipy.stats._result_classes.FitResult.html#scipy.stats._result_classes.FitResult "scipy.stats._result_classes.FitResult") object. + + The `plot` method of [`scipy.stats._result_classes.FitResult`](../reference/generated/scipy.stats._result_classes.FitResult.html#scipy.stats._result_classes.FitResult "scipy.stats._result_classes.FitResult") now accepts + a `plot_type` parameter; the options are `'hist'` (histogram, default), + `'qq'` (Q-Q plot), `'pp'` (P-P plot), and `'cdf'` (empirical CDF + plot). + + Kolmogorov-Smirnov tests (e.g. [`scipy.stats.kstest`](../reference/generated/scipy.stats.kstest.html#scipy.stats.kstest "scipy.stats.kstest")) now return the + location (argmax) at which the statistic is calculated and the variant + of the statistic used. +* Improved the performance of several [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") functions. + + + Improved the performance of [`scipy.stats.cramervonmises_2samp`](../reference/generated/scipy.stats.cramervonmises_2samp.html#scipy.stats.cramervonmises_2samp "scipy.stats.cramervonmises_2samp") and + [`scipy.stats.ks_2samp`](../reference/generated/scipy.stats.ks_2samp.html#scipy.stats.ks_2samp "scipy.stats.ks_2samp") with `method='exact'`. + + Improved the performance of [`scipy.stats.siegelslopes`](../reference/generated/scipy.stats.siegelslopes.html#scipy.stats.siegelslopes "scipy.stats.siegelslopes"). + + Improved the performance of *scipy.stats.mstats.hdquantile\_sd*. + + Improved the performance of [`scipy.stats.binned_statistic_dd`](../reference/generated/scipy.stats.binned_statistic_dd.html#scipy.stats.binned_statistic_dd "scipy.stats.binned_statistic_dd") for several + NumPy statistics, and binned statistics methods now support complex data. +* Added the `scramble` optional argument to [`scipy.stats.qmc.LatinHypercube`](../reference/generated/scipy.stats.qmc.LatinHypercube.html#scipy.stats.qmc.LatinHypercube "scipy.stats.qmc.LatinHypercube"). + It replaces `centered`, which is now deprecated. +* Added a parameter `optimization` to all [`scipy.stats.qmc.QMCEngine`](../reference/generated/scipy.stats.qmc.QMCEngine.html#scipy.stats.qmc.QMCEngine "scipy.stats.qmc.QMCEngine") + subclasses to improve characteristics of the quasi-random variates. +* Added tie correction to [`scipy.stats.mood`](../reference/generated/scipy.stats.mood.html#scipy.stats.mood "scipy.stats.mood"). +* Added tutorials for resampling methods in [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats"). +* [`scipy.stats.bootstrap`](../reference/generated/scipy.stats.bootstrap.html#scipy.stats.bootstrap "scipy.stats.bootstrap"), [`scipy.stats.permutation_test`](../reference/generated/scipy.stats.permutation_test.html#scipy.stats.permutation_test "scipy.stats.permutation_test"), and + [`scipy.stats.monte_carlo_test`](../reference/generated/scipy.stats.monte_carlo_test.html#scipy.stats.monte_carlo_test "scipy.stats.monte_carlo_test") now automatically detect whether the provided + `statistic` is vectorized, so passing the `vectorized` argument + explicitly is no longer required to take advantage of vectorized statistics. +* Improved the speed of [`scipy.stats.permutation_test`](../reference/generated/scipy.stats.permutation_test.html#scipy.stats.permutation_test "scipy.stats.permutation_test") for permutation types + `'samples'` and `'pairings'`. +* Added `axis`, `nan_policy`, and masked array support to + [`scipy.stats.jarque_bera`](../reference/generated/scipy.stats.jarque_bera.html#scipy.stats.jarque_bera "scipy.stats.jarque_bera"). +* Added the `nan_policy` optional argument to [`scipy.stats.rankdata`](../reference/generated/scipy.stats.rankdata.html#scipy.stats.rankdata "scipy.stats.rankdata"). + +## [Deprecated features](#id15)[#](#deprecated-features "Link to this heading") + +* *scipy.misc* module and all the methods in `misc` are deprecated in v1.10 + and will be completely removed in SciPy v2.0.0. Users are suggested to + utilize the [`scipy.datasets`](../reference/datasets.html#module-scipy.datasets "scipy.datasets") module instead for the dataset methods. +* [`scipy.stats.qmc.LatinHypercube`](../reference/generated/scipy.stats.qmc.LatinHypercube.html#scipy.stats.qmc.LatinHypercube "scipy.stats.qmc.LatinHypercube") parameter `centered` has been deprecated. + It is replaced by the `scramble` argument for more consistency with other + QMC engines. +* [`scipy.interpolate.interp2d`](../reference/generated/scipy.interpolate.interp2d.html#scipy.interpolate.interp2d "scipy.interpolate.interp2d") class has been deprecated. The docstring of the + deprecated routine lists recommended replacements. + +## [Expired Deprecations](#id16)[#](#expired-deprecations "Link to this heading") + +* There is an ongoing effort to follow through on long-standing deprecations. +* The following previously deprecated features are affected: + + + Removed `cond` & `rcond` kwargs in `linalg.pinv` + + Removed wrappers `scipy.linalg.blas.{clapack, flapack}` + + Removed `scipy.stats.NumericalInverseHermite` and removed `tol` & `max_intervals` kwargs from `scipy.stats.sampling.NumericalInverseHermite` + + Removed `local_search_options` kwarg frrom `scipy.optimize.dual_annealing`. + +## [Other changes](#id17)[#](#other-changes "Link to this heading") + +* [`scipy.stats.bootstrap`](../reference/generated/scipy.stats.bootstrap.html#scipy.stats.bootstrap "scipy.stats.bootstrap"), [`scipy.stats.permutation_test`](../reference/generated/scipy.stats.permutation_test.html#scipy.stats.permutation_test "scipy.stats.permutation_test"), and + [`scipy.stats.monte_carlo_test`](../reference/generated/scipy.stats.monte_carlo_test.html#scipy.stats.monte_carlo_test "scipy.stats.monte_carlo_test") now automatically detect whether the provided + `statistic` is vectorized by looking for an `axis` parameter in the + signature of `statistic`. If an `axis` parameter is present in + `statistic` but should not be relied on for vectorized calls, users must + pass option `vectorized==False` explicitly. +* [`scipy.stats.multivariate_normal`](../reference/generated/scipy.stats.multivariate_normal.html#scipy.stats.multivariate_normal "scipy.stats.multivariate_normal") will now raise a `ValueError` when the + covariance matrix is not positive semidefinite, regardless of which method + is called. + +## [Authors](#id18)[#](#authors "Link to this heading") + +* Name (commits) +* h-vetinari (10) +* Jelle Aalbers (1) +* Oriol Abril-Pla (1) + +* Alan-Hung (1) + +* Tania Allard (7) +* Oren Amsalem (1) + +* Sven Baars (10) +* Balthasar (1) + +* Ross Barnowski (1) +* Christoph Baumgarten (2) +* Peter Bell (2) +* Sebastian Berg (1) +* Aaron Berk (1) + +* boatwrong (1) + +* boeleman (1) + +* Jake Bowhay (50) +* Matthew Brett (4) +* Evgeni Burovski (93) +* Matthias Bussonnier (6) +* Dominic C (2) +* Mingbo Cai (1) + +* James Campbell (2) + +* CJ Carey (4) +* cesaregarza (1) + +* charlie0389 (1) + +* Hood Chatham (5) +* Andrew Chin (1) + +* Daniel Ching (1) + +* Leo Chow (1) + +* chris (3) + +* John Clow (1) + +* cm7S (1) + +* cmgodwin (1) + +* Christopher Cowden (2) + +* Henry Cuzco (2) + +* Anirudh Dagar (12) +* Hans Dembinski (2) + +* Jaiden di Lanzo (24) + +* Felipe Dias (1) + +* Dieter Werthmüller (1) +* Giuseppe Dilillo (1) + +* dpoerio (1) + +* drpeteb (1) + +* Christopher Dupuis (1) + +* Jordan Edmunds (1) + +* Pieter Eendebak (1) + +* Jérome Eertmans (1) + +* Fabian Egli (2) + +* Sebastian Ehlert (2) + +* Kian Eliasi (1) + +* Tomohiro Endo (1) + +* Stefan Endres (1) +* Zeb Engberg (4) + +* Jonas Eschle (1) + +* Thomas J. Fan (9) +* fiveseven (1) + +* Neil Flood (1) + +* Franz Forstmayr (1) +* Sara Fridovich-Keil (1) +* David Gilbertson (1) + +* Ralf Gommers (251) +* Marco Gorelli (2) + +* Matt Haberland (387) +* Andrew Hawryluk (2) + +* Christoph Hohnerlein (2) + +* Loïc Houpert (2) + +* Shamus Husheer (1) + +* ideasrule (1) + +* imoiwm (1) + +* Lakshaya Inani (1) + +* Joseph T. Iosue (1) +* iwbc-mzk (1) + +* Nathan Jacobi (3) + +* Julien Jerphanion (5) +* He Jia (1) +* jmkuebler (1) + +* Johannes Müller (1) + +* Vedant Jolly (1) + +* Juan Luis Cano Rodríguez (2) +* Justin (1) + +* jvavrek (1) + +* jyuv (2) +* Kai Mühlbauer (1) + +* Nikita Karetnikov (3) + +* Reinert Huseby Karlsen (1) + +* kaspar (2) + +* Toshiki Kataoka (1) +* Robert Kern (3) +* Joshua Klein (1) + +* Andrew Knyazev (7) +* Jozsef Kutas (16) + +* Eric Larson (4) +* Lechnio (1) + +* Antony Lee (2) +* Aditya Limaye (1) + +* Xingyu Liu (2) +* Christian Lorentzen (4) +* Loïc Estève (2) +* Thibaut Lunet (2) + +* Peter Lysakovski (1) +* marianasalamoni (2) + +* mariprudencio (1) + +* Paige Martin (1) + +* Arno Marty (1) + +* matthewborish (3) + +* Damon McDougall (1) +* Nicholas McKibben (22) +* McLP (1) + +* mdmahendri (1) + +* Melissa Weber Mendonça (9) +* Jarrod Millman (1) +* Naoto Mizuno (2) +* Shashaank N (1) +* Pablo S Naharro (1) + +* nboudrie (2) + +* Andrew Nelson (52) +* Nico Schlömer (1) +* NiMlr (1) + +* o-alexandre-felipe (1) + +* Maureen Ononiwu (1) + +* Dimitri Papadopoulos (2) + +* partev (1) + +* Tirth Patel (10) +* Paulius Šarka (1) + +* Josef Perktold (1) +* Giacomo Petrillo (3) + +* Matti Picus (1) +* Rafael Pinto (1) + +* PKNaveen (1) + +* Ilhan Polat (6) +* Akshita Prasanth (2) + +* Sean Quinn (1) +* Tyler Reddy (155) +* Martin Reinecke (1) +* Ned Richards (1) +* Marie Roald (1) + +* Sam Rosen (4) + +* Pamphile Roy (105) +* sabonerune (2) + +* Atsushi Sakai (94) +* Daniel Schmitz (27) +* Anna Scholtz (1) + +* Eli Schwartz (11) +* serge-sans-paille (2) +* JEEVANSHI SHARMA (1) + +* ehsan shirvanian (2) + +* siddhantwahal (2) +* Mathieu Dutour Sikiric (1) + +* Sourav Singh (1) +* Alexander Soare (1) + +* Bjørge Solli (2) + +* Scott Staniewicz (1) +* Ethan Steinberg (3) + +* Albert Steppi (3) +* Thomas Stoeger (1) + +* Kai Striega (4) +* Tartopohm (1) + +* Mamoru TASAKA (2) + +* Ewout ter Hoeven (5) +* TianyiQ (1) + +* Tiger (1) + +* Will Tirone (1) +* Ajay Shanker Tripathi (1) + +* Edgar Andrés Margffoy Tuay (1) + +* Dmitry Ulyumdzhiev (1) + +* Hari Vamsi (1) + +* VitalyChait (1) + +* Rik Voorhaar (1) + +* Samuel Wallan (4) +* Stefan van der Walt (2) +* Warren Weckesser (145) +* wei2222 (1) + +* windows-server-2003 (3) + +* Marek Wojciechowski (2) + +* Niels Wouda (1) + +* WRKampi (1) + +* Yeonjoo Yoo (1) + +* Rory Yorke (1) +* Xiao Yuan (2) + +* Meekail Zain (2) + +* Fabio Zanini (1) + +* Steffen Zeile (1) + +* Egor Zemlyanoy (19) +* Gavin Zhang (3) + + +A total of 184 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +## [Issues closed for 1.10.0](#id19)[#](#issues-closed-for-1-10-0 "Link to this heading") + +* [#1261](https://github.com/scipy/scipy/issues/1261): errors in fmin\_bfgs and some improvements (Trac #734) +* [#2167](https://github.com/scipy/scipy/issues/2167): BivariateSpline errors with kx=ky=1 (Trac #1642) +* [#2304](https://github.com/scipy/scipy/issues/2304): funm gives incorrect results for non-diagonalizable inputs (Trac… +* [#3421](https://github.com/scipy/scipy/issues/3421): Rename information theory functions? +* [#3854](https://github.com/scipy/scipy/issues/3854): KroghInterpolator doesn’t pass through points +* [#4043](https://github.com/scipy/scipy/issues/4043): scipy.interpolate.interp1d should be able to take a single value +* [#4555](https://github.com/scipy/scipy/issues/4555): leastsq should use cholesky not inv for hessian inversion +* [#4598](https://github.com/scipy/scipy/issues/4598): von Mises random variate sampling broken for non-zero location… +* [#4975](https://github.com/scipy/scipy/issues/4975): Documentation for s in UnivariateSpline is confusing +* [#6173](https://github.com/scipy/scipy/issues/6173): scipy.interpolate.lagrange implemented through coefficients +* [#6688](https://github.com/scipy/scipy/issues/6688): ENH: optimize.basinhopping: call an acceptance test before local… +* [#7104](https://github.com/scipy/scipy/issues/7104): scipy.stats.nct - wrong values in tails +* [#7268](https://github.com/scipy/scipy/issues/7268): scipy.sparse.linalg.norm does not implement spectral norm +* [#7521](https://github.com/scipy/scipy/issues/7521): scipy.UnivariateSpline smoothing condition documentation inaccuracy +* [#7857](https://github.com/scipy/scipy/issues/7857): griddata sensible to size of original grid when it should not +* [#8376](https://github.com/scipy/scipy/issues/8376): InterpolatedUnivariateSpline.roots() seems to miss roots sometimes +* [#9119](https://github.com/scipy/scipy/issues/9119): documentation issues of functions in scipy.stats.mstats +* [#9389](https://github.com/scipy/scipy/issues/9389): Kolmogorov Smirnov 2 samples returning max distance location… +* [#9440](https://github.com/scipy/scipy/issues/9440): Unexpected successful optimization with minimize when number… +* [#9451](https://github.com/scipy/scipy/issues/9451): Add shgo to optimize benchmarks +* [#10737](https://github.com/scipy/scipy/issues/10737): Goodness of fit tests for distributions with unknown parameters +* [#10911](https://github.com/scipy/scipy/issues/10911): scipy.optimize.minimize\_scalar does not automatically select… +* [#11026](https://github.com/scipy/scipy/issues/11026): rv\_discrete.interval returning wrong values for alpha = 1 +* [#11053](https://github.com/scipy/scipy/issues/11053): scipy.stats: Allow specifying inverse-variance matrix to multivariate\_normal +* [#11131](https://github.com/scipy/scipy/issues/11131): DOC: stats.fisher\_exact does not match R functionality for `oddsratio`… +* [#11406](https://github.com/scipy/scipy/issues/11406): scipy.sparse.linalg.svds (v1.4.1) on singular matrix does not… +* [#11475](https://github.com/scipy/scipy/issues/11475): Filter radius as optional argument for gaussian\_filter1d/gaussian\_filter +* [#11772](https://github.com/scipy/scipy/issues/11772): Cache covariance matrix decomposition in frozen multivariate\_normal +* [#11777](https://github.com/scipy/scipy/issues/11777): non-central chi2 (scipy.stats.ncx2.pdf) gets clipped to zero… +* [#11790](https://github.com/scipy/scipy/issues/11790): NaN handling of stats.rankdata +* [#11860](https://github.com/scipy/scipy/issues/11860): Occurrence of nan values when using multinomial.pmf from scipy.stats? +* [#11916](https://github.com/scipy/scipy/issues/11916): Improve documentation for smoothing in interpolate.UnivariateSpline… +* [#12041](https://github.com/scipy/scipy/issues/12041): Spherical mean/variance +* [#12246](https://github.com/scipy/scipy/issues/12246): Interpolation 2D with SmoothBivariateSpline +* [#12621](https://github.com/scipy/scipy/issues/12621): Scalar minimization functions have no references +* [#12632](https://github.com/scipy/scipy/issues/12632): curve\_fit algorithm try to transform xdata in an array of floats +* [#12963](https://github.com/scipy/scipy/issues/12963): shgo is not correctly passing jac to minimizer +* [#13021](https://github.com/scipy/scipy/issues/13021): 2D Interpolation Scaling Issues +* [#13049](https://github.com/scipy/scipy/issues/13049): Examples missing import numpy as np? +* [#13452](https://github.com/scipy/scipy/issues/13452): Calling `len()` on the `scipy.spatial.transform.rotation.Rotation`… +* [#13529](https://github.com/scipy/scipy/issues/13529): signal.decimate doesn’t use sosfilters and sosfiltfilt +* [#14098](https://github.com/scipy/scipy/issues/14098): DOC-Update for InterpolatedUnivariateSpline and LSQUnivariateSpline +* [#14198](https://github.com/scipy/scipy/issues/14198): better description of solveh\_banded limitations +* [#14348](https://github.com/scipy/scipy/issues/14348): Extract spline coefficient from splprep: tck +* [#14386](https://github.com/scipy/scipy/issues/14386): Let CloughTocher2DInterpolator fit “nearest” for points outside… +* [#14472](https://github.com/scipy/scipy/issues/14472): scipy.interpolate.CubicSpline boundary conditions appear to be… +* [#14533](https://github.com/scipy/scipy/issues/14533): optimize.shgo gives unexpected TypeError +* [#14541](https://github.com/scipy/scipy/issues/14541): Raspberry Pi 4 aarch64: ModuleNotFoundError: No module named… +* [#14584](https://github.com/scipy/scipy/issues/14584): scipy.signal.filter\_design.zpk2sos doctests fail (values different… +* [#14809](https://github.com/scipy/scipy/issues/14809): BUG: scipy.signal.periodogram window parameter +* [#14853](https://github.com/scipy/scipy/issues/14853): BUG: sqrtm dtype +* [#14922](https://github.com/scipy/scipy/issues/14922): Question: Seemingly unused, non-working script `isolve/tests/demo\_lgres.py` +* [#15049](https://github.com/scipy/scipy/issues/15049): BUG: Visualization of CWT matrix in signal.cwt example code +* [#15072](https://github.com/scipy/scipy/issues/15072): BUG: signal.decimate returns NaN with large float32 arrays +* [#15393](https://github.com/scipy/scipy/issues/15393): BUG: signal.decimate returns unexpected values with float32 arrays +* [#15473](https://github.com/scipy/scipy/issues/15473): ENH: `skewnorm.cdf` is very slow. Consider a much more efficient… +* [#15618](https://github.com/scipy/scipy/issues/15618): ENH: Generation of random 2D tables with given marginal totals +* [#15675](https://github.com/scipy/scipy/issues/15675): ENH: `multivariate\_normal` should accept eigendecomposition… +* [#15685](https://github.com/scipy/scipy/issues/15685): ENH: The exact p-value calculation in `stats.cramervonmises\_2samp`… +* [#15733](https://github.com/scipy/scipy/issues/15733): DEP: remove quiet parameter from fitpack +* [#15749](https://github.com/scipy/scipy/issues/15749): DEP: remove tol from `NumericalInverseHermite` +* [#15792](https://github.com/scipy/scipy/issues/15792): MAINT: There is no unittest and documentation of Improper integral… +* [#15807](https://github.com/scipy/scipy/issues/15807): DEP: remove dual\_annealing argument ‘local\_search\_options’ +* [#15844](https://github.com/scipy/scipy/issues/15844): It’s not that obvious that `firls` requires an even number… +* [#15883](https://github.com/scipy/scipy/issues/15883): BUG: stats.bootstrap bca implementation triggers ValueError for… +* [#15936](https://github.com/scipy/scipy/issues/15936): Please add citations to the papers for COLAMD +* [#15996](https://github.com/scipy/scipy/issues/15996): Symbol hiding when using GNU linker in the Meson build should… +* [#16148](https://github.com/scipy/scipy/issues/16148): Documentation in spearmanr +* [#16235](https://github.com/scipy/scipy/issues/16235): BUG: Memory leak in function `Py\_FindObjects` due to new reference… +* [#16236](https://github.com/scipy/scipy/issues/16236): BUG: Memory leak in function `py\_filter2d` due to new reference… +* [#16251](https://github.com/scipy/scipy/issues/16251): DEP: Execute deprecation of scipy.linalg.blas.{clapack, flapack} +* [#16252](https://github.com/scipy/scipy/issues/16252): DEP: add deprecation warnings to kwargs `turbo` / `eigvals`… +* [#16253](https://github.com/scipy/scipy/issues/16253): DEP: add deprecation warning for kwargs `nyq` / `Hz` in firwin\* +* [#16256](https://github.com/scipy/scipy/issues/16256): DEP: add deprecation warning for binom\_test +* [#16272](https://github.com/scipy/scipy/issues/16272): BUG: unclear error for invalid bracketing +* [#16291](https://github.com/scipy/scipy/issues/16291): BUG: lambertw returns nan’s on small values +* [#16297](https://github.com/scipy/scipy/issues/16297): DOC: minor release procedure adjustment +* [#16319](https://github.com/scipy/scipy/issues/16319): ENH: improved accuracy and orthonormality of output eigenvectors… +* [#16333](https://github.com/scipy/scipy/issues/16333): DOC: rvalue description is missing in stats.probplot +* [#16334](https://github.com/scipy/scipy/issues/16334): BUG: CLI help is not accessible using light themes +* [#16338](https://github.com/scipy/scipy/issues/16338): ENH: Add option to clip out of bounds input values to minimum… +* [#16342](https://github.com/scipy/scipy/issues/16342): BUG: IIRdesign function ftype=’bessel’ not recognized +* [#16344](https://github.com/scipy/scipy/issues/16344): ENH: improved `stats.ortho\_group` +* [#16364](https://github.com/scipy/scipy/issues/16364): ENH: stats: return bunches rather than plain tuples +* [#16380](https://github.com/scipy/scipy/issues/16380): BUG: RegularGridInterpolator error message is wrong +* [#16386](https://github.com/scipy/scipy/issues/16386): TST: sparse/linalg/tests/test\_expm\_multiply.py::test\_expm\_multiply\_dtype… +* [#16399](https://github.com/scipy/scipy/issues/16399): `test\_mio.py::test\_recarray` failure due to dtype handling… +* [#16413](https://github.com/scipy/scipy/issues/16413): DOC: rvs method docstrings refer to seed argument instead of… +* [#16433](https://github.com/scipy/scipy/issues/16433): ENH: scipy.stats.bootstrap() should do BCa for multivariate statistics… +* [#16472](https://github.com/scipy/scipy/issues/16472): handle spline interpolation methods in `interpn` +* [#16476](https://github.com/scipy/scipy/issues/16476): dev.py does not propagate error codes, thus hides errors on CI +* [#16490](https://github.com/scipy/scipy/issues/16490): DOC: err on example for `scipy.signal.upfirdn` +* [#16558](https://github.com/scipy/scipy/issues/16558): BUG: leaves\_color\_list incorrect when distance=0 +* [#16580](https://github.com/scipy/scipy/issues/16580): Typo in scipy/optimize/tests/test\_optimize.py, logit instead… +* [#16582](https://github.com/scipy/scipy/issues/16582): TST: RegularGridInterpolator tests should be parameterised +* [#16603](https://github.com/scipy/scipy/issues/16603): ENH, DOC: Add policy on typo and small docs fixes +* [#16663](https://github.com/scipy/scipy/issues/16663): BUG: `bool(rotation)` leads to error +* [#16673](https://github.com/scipy/scipy/issues/16673): Test failure for `TestPoisson.test\_mindist` in Azure CI job +* [#16713](https://github.com/scipy/scipy/issues/16713): BUG/DOC: spatial: docstrings of `Rotation` methods are missing… +* [#16726](https://github.com/scipy/scipy/issues/16726): CI: Python 3.11 tests are failing because a dependency is using… +* [#16741](https://github.com/scipy/scipy/issues/16741): BUG: DOC: editing docstring example in svds +* [#16759](https://github.com/scipy/scipy/issues/16759): DOC: Add ‘import numpy as np’ to the ‘Examples’ section of docstrings. +* [#16763](https://github.com/scipy/scipy/issues/16763): BUG: numpy version requirement mismatch docs vs setup.py +* [#16773](https://github.com/scipy/scipy/issues/16773): BUG: indexing error in scipy.spatial.Voronoi in 3D +* [#16796](https://github.com/scipy/scipy/issues/16796): DOC: Method “bisect” for root\_scalar lacks correct argument list +* [#16819](https://github.com/scipy/scipy/issues/16819): BUG: stats.binned\_statistic\_2d is ~8x slower when using `statistic=np.mean`… +* [#16833](https://github.com/scipy/scipy/issues/16833): Runtime performance in BSpline.design\_matrix is inferior to BSpline().\_\_call\_\_() +* [#16892](https://github.com/scipy/scipy/issues/16892): Add legend to `rv\_histogram` plot in docs +* [#16912](https://github.com/scipy/scipy/issues/16912): MAINT: stats: optimize: Move `\_contains\_nan` function to more… +* [#16914](https://github.com/scipy/scipy/issues/16914): BUG: documentation of scipy.stats.truncnorm could be clearer +* [#17031](https://github.com/scipy/scipy/issues/17031): BUG: stats: Intermittent failure of the test ‘test\_plot\_iv’ +* [#17033](https://github.com/scipy/scipy/issues/17033): New CI failures in `sparse` with nightly numpy +* [#17047](https://github.com/scipy/scipy/issues/17047): BUG: Documentation error in scipy.signal +* [#17056](https://github.com/scipy/scipy/issues/17056): Mypy failure in CI for `numpy/\_\_init\_\_.pyi` positional-only… +* [#17065](https://github.com/scipy/scipy/issues/17065): BUG: minimize(method=’L-BFGS-B’) documentation is contradictory +* [#17070](https://github.com/scipy/scipy/issues/17070): Using Meson-built 1.10.0.dev0 nightly wheel in a conda environment… +* [#17074](https://github.com/scipy/scipy/issues/17074): BUG: scipy.optimize.linprog does not fulfill integer constraints… +* [#17078](https://github.com/scipy/scipy/issues/17078): DOC: “These are not universal functions” difficult to understand… +* [#17089](https://github.com/scipy/scipy/issues/17089): ENH: Documentation on test behind p-values of .spearmanr +* [#17129](https://github.com/scipy/scipy/issues/17129): DOC: inconsistency in when a new feature was added +* [#17155](https://github.com/scipy/scipy/issues/17155): BUG: stats: Bug in XSLOW tests in TestNumericalInverseHermite +* [#17167](https://github.com/scipy/scipy/issues/17167): BUG: bernoulli.pmf returns non-zero values with non-integer arguments +* [#17168](https://github.com/scipy/scipy/issues/17168): `test\_powm1` failing in CI on Windows +* [#17174](https://github.com/scipy/scipy/issues/17174): MAINT, REL: wheels not uploaded to staging on push to maintenance +* [#17241](https://github.com/scipy/scipy/issues/17241): BUG: CubicSpline segfaults when passing empty values for `y`with… +* [#17336](https://github.com/scipy/scipy/issues/17336): BUG: Meson build unconditionally probes for pythran, despite… +* [#17375](https://github.com/scipy/scipy/issues/17375): BUG: resample\_poly() freezes with large data and specific samplerate… +* [#17380](https://github.com/scipy/scipy/issues/17380): BUG: optimize: using `integrality` prevents `linprog` from… +* [#17382](https://github.com/scipy/scipy/issues/17382): BUG/DOC: optimize: `minimize` doc should reflect tnc’s deprecation… +* [#17412](https://github.com/scipy/scipy/issues/17412): BUG: Meson error:compiler for language “cpp”, not specified for… +* [#17444](https://github.com/scipy/scipy/issues/17444): BUG: beta.ppf causes segfault +* [#17468](https://github.com/scipy/scipy/issues/17468): Weird errors with running the tests `scipy.stats.tests.test\_distributions`… +* [#17518](https://github.com/scipy/scipy/issues/17518): ENH: stats.pearsonr: support complex data +* [#17523](https://github.com/scipy/scipy/issues/17523): BUG: `[source]` button in the docs sending to the wrong place +* [#17578](https://github.com/scipy/scipy/issues/17578): TST, BLD, CI: 1.10.0rc1 wheel build/test failures +* [#17619](https://github.com/scipy/scipy/issues/17619): BUG: core dump when calling scipy.optimize.linprog +* [#17644](https://github.com/scipy/scipy/issues/17644): BUG: 1.10.0rc2 Windows wheel tests runs all segfault +* [#17650](https://github.com/scipy/scipy/issues/17650): BUG: Assertion failed when using HiGHS + +## [Pull requests for 1.10.0](#id20)[#](#pull-requests-for-1-10-0 "Link to this heading") + +* [#9072](https://github.com/scipy/scipy/pull/9072): ENH: Added rectangular integral to multivariate\_normal +* [#9932](https://github.com/scipy/scipy/pull/9932): ENH: stats.gaussian\_kde: add method that returns marginal distribution +* [#11712](https://github.com/scipy/scipy/pull/11712): BUG: trust-constr evaluates function out of bounds +* [#12211](https://github.com/scipy/scipy/pull/12211): DOC: Dice similiarity index +* [#12312](https://github.com/scipy/scipy/pull/12312): ENH: Accelerate matrix normal sampling using matmul +* [#12594](https://github.com/scipy/scipy/pull/12594): BUG: fixed indexing error when using bounds in Powell’s method… +* [#13053](https://github.com/scipy/scipy/pull/13053): ENH: add MLE for stats.powerlaw.fit +* [#13265](https://github.com/scipy/scipy/pull/13265): ENH: Kstest exact performance improvements +* [#13340](https://github.com/scipy/scipy/pull/13340): ENH: stats: Add the function odds\_ratio. +* [#13663](https://github.com/scipy/scipy/pull/13663): ENH: linalg: Add LAPACK wrappers for trexc and trsen. +* [#13753](https://github.com/scipy/scipy/pull/13753): DOC: optimize: update Powell docs to reflect API +* [#13957](https://github.com/scipy/scipy/pull/13957): ENH: stats.ks\_2samp: Pythranize remaining exact p-value calculations +* [#14248](https://github.com/scipy/scipy/pull/14248): MAINT:linalg: Make lu\_factor accept rectangular arrays +* [#14317](https://github.com/scipy/scipy/pull/14317): ENH: Optimize sparse frobenius norm +* [#14402](https://github.com/scipy/scipy/pull/14402): DOC: Clarify argument documentation for `solve` +* [#14430](https://github.com/scipy/scipy/pull/14430): ENH: improve siegelslopes via pythran +* [#14563](https://github.com/scipy/scipy/pull/14563): WIP: stats: bins=auto in docstrings +* [#14579](https://github.com/scipy/scipy/pull/14579): BENCH: optimize: add DFO CUTEST benchmark +* [#14638](https://github.com/scipy/scipy/pull/14638): DOC: added mention of the limitations of Thomas’ algorithm +* [#14840](https://github.com/scipy/scipy/pull/14840): ENH: Addition of Poisson Means Test (E-test). +* [#15097](https://github.com/scipy/scipy/pull/15097): ENH: add radius to gaussian\_filter1d and gaussian\_filter +* [#15444](https://github.com/scipy/scipy/pull/15444): ENH: Infinite df approximation for Studentized Range PDF +* [#15493](https://github.com/scipy/scipy/pull/15493): ENH: Convert gaussian\_kde logpdf to Cython +* [#15607](https://github.com/scipy/scipy/pull/15607): ENH: Add `scipy.datasets` submodule +* [#15709](https://github.com/scipy/scipy/pull/15709): ENH: improve the computation time of stats.cramervonmises\_2samp() +* [#15770](https://github.com/scipy/scipy/pull/15770): ENH: stats: replace ncx2 stats distribution with Boost non\_central\_chi\_squared +* [#15878](https://github.com/scipy/scipy/pull/15878): DEP: remove local\_search\_options of dual\_annealing +* [#15892](https://github.com/scipy/scipy/pull/15892): BUG: stats: use mean behavior for percentileofscore in bootstrap +* [#15901](https://github.com/scipy/scipy/pull/15901): DEP: Deprecate scipy.misc in favour of scipy.datasets +* [#15967](https://github.com/scipy/scipy/pull/15967): TST/DOC: stats: explain/check 100% interval for discrete distributions +* [#15972](https://github.com/scipy/scipy/pull/15972): DOC: length of `bands` param. specified in `firls` +* [#16002](https://github.com/scipy/scipy/pull/16002): ENH: Allow specyfing inverse covariance of a multivariate normal… +* [#16017](https://github.com/scipy/scipy/pull/16017): ENH: special: Use boost for a couple ufuncs. +* [#16069](https://github.com/scipy/scipy/pull/16069): ENH: add additional MLE for fixed parameters in gumbel\_r.fit +* [#16096](https://github.com/scipy/scipy/pull/16096): BUG: use SOS filters in decimate for numerical stability +* [#16109](https://github.com/scipy/scipy/pull/16109): ENH: add `optimization` to `QMCEngine` +* [#16140](https://github.com/scipy/scipy/pull/16140): ENH: stats: Add `nan\_policy` optional argument for `stats.rankdata` +* [#16224](https://github.com/scipy/scipy/pull/16224): Add a `pchip` mode to RegularGridInterpolator. +* [#16227](https://github.com/scipy/scipy/pull/16227): BUG: special: Fix a couple issues with the ‘double-double’ code… +* [#16238](https://github.com/scipy/scipy/pull/16238): MAINT: stats: support string array for \_contains\_nan and add… +* [#16268](https://github.com/scipy/scipy/pull/16268): DOC: optimize: add marginals/slack example to `linprog` +* [#16294](https://github.com/scipy/scipy/pull/16294): BUG: linalg: Add precision preservation for `sqrtm` +* [#16298](https://github.com/scipy/scipy/pull/16298): REL: set version to 1.10.0.dev0 +* [#16299](https://github.com/scipy/scipy/pull/16299): DEP: Execute deprecation of scipy.linalg.blas.{clapack, flapack} +* [#16307](https://github.com/scipy/scipy/pull/16307): DEP: add deprecation warning for binom\_test +* [#16315](https://github.com/scipy/scipy/pull/16315): DEP: add deprecation warning for kwargs nyq / Hz in firwin +* [#16317](https://github.com/scipy/scipy/pull/16317): ENH: stats: add truncated (i.e. upper bounded) Pareto distribution… +* [#16320](https://github.com/scipy/scipy/pull/16320): ENH: improved accuracy and orthonormality of output eigenvectors… +* [#16327](https://github.com/scipy/scipy/pull/16327): DOC: BLD: remove `-scipyopt` from html Make command and build… +* [#16328](https://github.com/scipy/scipy/pull/16328): MAINT: retry openblas download in CI +* [#16332](https://github.com/scipy/scipy/pull/16332): BLD: ensure we get understandable messages when git submodules… +* [#16335](https://github.com/scipy/scipy/pull/16335): BLD: update NumPy to >=1.19.5 +* [#16336](https://github.com/scipy/scipy/pull/16336): MAINT: forward port git scoping +* [#16340](https://github.com/scipy/scipy/pull/16340): DEP: remove tol & max\_intervals from NumericalInverseHermite +* [#16346](https://github.com/scipy/scipy/pull/16346): DEV: add meson-python to environment.yml +* [#16351](https://github.com/scipy/scipy/pull/16351): Added “import numpy as np” statement to filter examples +* [#16354](https://github.com/scipy/scipy/pull/16354): DOC: optimize: remove callback doc from the options in `\_minimize\_lbfgsb`… +* [#16355](https://github.com/scipy/scipy/pull/16355): DEP: add deprecation warnings to kwargs turbo / eigvals of linalg.eigh +* [#16356](https://github.com/scipy/scipy/pull/16356): DOC: add examples to `signal.medfilt2d` +* [#16357](https://github.com/scipy/scipy/pull/16357): BENCH: Add SHGO and DIRECT to optimization benchmark +* [#16362](https://github.com/scipy/scipy/pull/16362): ENH: Provide more information when a value is out of bounds in… +* [#16367](https://github.com/scipy/scipy/pull/16367): BUG: unclear error for invalid bracketing +* [#16371](https://github.com/scipy/scipy/pull/16371): MAINT: remove last (already safe) usage of `mktemp` +* [#16372](https://github.com/scipy/scipy/pull/16372): MAINT: rename `do.py` to `dev.py` +* [#16373](https://github.com/scipy/scipy/pull/16373): DOC: added rvalue description in `stats.probplot` +* [#16377](https://github.com/scipy/scipy/pull/16377): ENH: stats.bootstrap: update warning to mention np.min +* [#16383](https://github.com/scipy/scipy/pull/16383): BUG: fix error message of RegularGridInterpolator +* [#16387](https://github.com/scipy/scipy/pull/16387): ENH: stats.combine\_pvalues: convert output tuple to Bunch +* [#16388](https://github.com/scipy/scipy/pull/16388): DEP: deprecate `stats.kendalltau` kwarg `initial\_lexsort` +* [#16389](https://github.com/scipy/scipy/pull/16389): DEP: sharpen stats deprecations +* [#16392](https://github.com/scipy/scipy/pull/16392): DEP: add warning to `sparse.gmres` deprecated kwarg `restrt` +* [#16397](https://github.com/scipy/scipy/pull/16397): MAINT: fix two refcounting issues in `ndimage` +* [#16398](https://github.com/scipy/scipy/pull/16398): MAINT: Replace find\_common\_types +* [#16406](https://github.com/scipy/scipy/pull/16406): MAINT: stats.rankdata: change default to nan\_policy=’propagate’ +* [#16407](https://github.com/scipy/scipy/pull/16407): ENH: stats.fisher\_exact: convert output tuple to Bunch +* [#16411](https://github.com/scipy/scipy/pull/16411): MAINT: optimize.brute should coerce non-tuple args to tuple +* [#16415](https://github.com/scipy/scipy/pull/16415): DOC: stats: fix seed -> random\_state in `rvs` docstring +* [#16423](https://github.com/scipy/scipy/pull/16423): MAINT: stats: not using nested TypeErrors in \_contains\_nan +* [#16424](https://github.com/scipy/scipy/pull/16424): MAINT: future-proof `stats.kde` for changes in numpy casting… +* [#16425](https://github.com/scipy/scipy/pull/16425): DOC: Procedure adjustment in file doc/source/dev/core-dev/releasing.rst.inc +* [#16428](https://github.com/scipy/scipy/pull/16428): MAINT: fix up `\_sputils.get\_index\_dtype` for NEP 50 casting… +* [#16431](https://github.com/scipy/scipy/pull/16431): CI: fix Gitpod build after dev.py update to the new CLI +* [#16432](https://github.com/scipy/scipy/pull/16432): Docstring fixes in lobpcg.py +* [#16434](https://github.com/scipy/scipy/pull/16434): DOC: stats.mstats.sen\_seasonal\_slopes: add docstring +* [#16435](https://github.com/scipy/scipy/pull/16435): ENH: directional mean +* [#16438](https://github.com/scipy/scipy/pull/16438): MAINT: remove unused `DeprecatedImport` +* [#16439](https://github.com/scipy/scipy/pull/16439): ENH: stats.chi2\_contingency: convert output tuple to Bunch +* [#16440](https://github.com/scipy/scipy/pull/16440): ENH: stats.median\_test: convert output tuple to Bunch +* [#16441](https://github.com/scipy/scipy/pull/16441): ENH: stats.mood: convert output tuple to Bunch +* [#16442](https://github.com/scipy/scipy/pull/16442): MAINT: fix issues with Python scalar related casting behavior… +* [#16447](https://github.com/scipy/scipy/pull/16447): BLD: make it easier to build with AddressSanitizer +* [#16449](https://github.com/scipy/scipy/pull/16449): ENH: improve scipy.interpolate.RegularGridInterpolator performance +* [#16450](https://github.com/scipy/scipy/pull/16450): BUG: Fix CLI Help in light themes +* [#16454](https://github.com/scipy/scipy/pull/16454): ENH: stats.bootstrap: return bootstrap distribution +* [#16455](https://github.com/scipy/scipy/pull/16455): ENH: stats.bootstrap: add BCa method for multi-sample statistic +* [#16462](https://github.com/scipy/scipy/pull/16462): CI: Update Python 3.8-dbg job to ubuntu-20.04 +* [#16463](https://github.com/scipy/scipy/pull/16463): ENH: stats.jarque\_bera: add axis, nan\_policy, masked array support +* [#16470](https://github.com/scipy/scipy/pull/16470): DOC: stats.spearmanr: add information about p-value calculation +* [#16471](https://github.com/scipy/scipy/pull/16471): MAINT: interpolate/RGI: only call `find\_indices` when needed +* [#16474](https://github.com/scipy/scipy/pull/16474): DOC: Add more information to entropy docstring +* [#16475](https://github.com/scipy/scipy/pull/16475): BLD: build the f2py shared source file once and link to each… +* [#16481](https://github.com/scipy/scipy/pull/16481): BUG: Change (n+1) to n for correct jackknife calculation of hd… +* [#16486](https://github.com/scipy/scipy/pull/16486): DOC: special.entr: add context +* [#16487](https://github.com/scipy/scipy/pull/16487): MAINT: Improve test speed, add timeouts +* [#16496](https://github.com/scipy/scipy/pull/16496): add notes for x and y array sorted in decreasing order +* [#16497](https://github.com/scipy/scipy/pull/16497): DOC: special: Add ‘Examples’ section to spence docstring. +* [#16498](https://github.com/scipy/scipy/pull/16498): ENH: Speed up hdquantile\_sd via cumulative sums +* [#16501](https://github.com/scipy/scipy/pull/16501): DOC: Fix typo in spatial.Delaunay +* [#16502](https://github.com/scipy/scipy/pull/16502): DOC: Minor Rst syntax update. +* [#16503](https://github.com/scipy/scipy/pull/16503): ENH: stats: Implement \_munp() for the skewnorm distribution. +* [#16505](https://github.com/scipy/scipy/pull/16505): DOC: correct errs on examples for scipy.signal.upfirdn +* [#16508](https://github.com/scipy/scipy/pull/16508): BUG/ENH: handle spline interpolation methods in `interpn` and… +* [#16511](https://github.com/scipy/scipy/pull/16511): add reference to regulargridinterpolator +* [#16513](https://github.com/scipy/scipy/pull/16513): MAINT: skip complex128 propack tests on windows (& module clean-up) +* [#16516](https://github.com/scipy/scipy/pull/16516): DOC: add a hint on what to use in case of matlab v7.3 +* [#16518](https://github.com/scipy/scipy/pull/16518): CI: pip and conda caching in all workflows +* [#16524](https://github.com/scipy/scipy/pull/16524): TST: stats.permutation\_test: strengthen test against `ks\_2samp` +* [#16529](https://github.com/scipy/scipy/pull/16529): CI: clean up scikit-umfpack and scikit-sparse usage in CI +* [#16532](https://github.com/scipy/scipy/pull/16532): Deprecated imports in docstring examples in `io.harwell\_boeing`… +* [#16533](https://github.com/scipy/scipy/pull/16533): ENH: signal: add Lanczos window function +* [#16534](https://github.com/scipy/scipy/pull/16534): CI: fix scikit-umfpack and scikit-sparse install in Azure job +* [#16535](https://github.com/scipy/scipy/pull/16535): MAINT: signal: Fix matplotlib deprecation warning in the chirp… +* [#16543](https://github.com/scipy/scipy/pull/16543): DOC: update cwt doc examples +* [#16544](https://github.com/scipy/scipy/pull/16544): DOC: add better example for `MultinomialQMC`. +* [#16546](https://github.com/scipy/scipy/pull/16546): DOC: Add alt-text to tutorial images +* [#16547](https://github.com/scipy/scipy/pull/16547): ENH: correct bounds warnings in `minimize` +* [#16550](https://github.com/scipy/scipy/pull/16550): TST: fix flaky sparse.linalg.exmp test +* [#16552](https://github.com/scipy/scipy/pull/16552): CI: test distro Python install on Ubuntu Jammy (22.04 LTS) +* [#16554](https://github.com/scipy/scipy/pull/16554): TST: add timeout to `test\_kappa4\_array\_gh13582` +* [#16557](https://github.com/scipy/scipy/pull/16557): BUG: fix `interpolate.RegularGridInterpolator` `out\_of\_bounds`… +* [#16559](https://github.com/scipy/scipy/pull/16559): ENH: adding a logpdf function to von-mises distribution +* [#16560](https://github.com/scipy/scipy/pull/16560): vectorize ortho\_group.rvs +* [#16561](https://github.com/scipy/scipy/pull/16561): DOC: optimize: Fix warning in differential\_evolution docstring +* [#16565](https://github.com/scipy/scipy/pull/16565): [DOC] improper type syntax in basinhopping docstring. +* [#16566](https://github.com/scipy/scipy/pull/16566): fix window function doc string for Window length +* [#16567](https://github.com/scipy/scipy/pull/16567): DOC: Add note about inaccuracies in matrix functions +* [#16571](https://github.com/scipy/scipy/pull/16571): DOC: sparse.linalg: add references for UMFPACK. +* [#16574](https://github.com/scipy/scipy/pull/16574): ENH: vectorize along samples `stats.ortho\_group.rvs` and `stats.unitary\_group.rvs` +* [#16576](https://github.com/scipy/scipy/pull/16576): testing documentation broken link fix +* [#16587](https://github.com/scipy/scipy/pull/16587): DOC: add import NumPy in QMC examples. +* [#16589](https://github.com/scipy/scipy/pull/16589): DOC: update toolchain.rst after EOL of manylinux\_2\_24; allow… +* [#16591](https://github.com/scipy/scipy/pull/16591): ENH: stats.nct: replace with boost implementation +* [#16592](https://github.com/scipy/scipy/pull/16592): DOC: interpolate: document the .roots() workaround +* [#16594](https://github.com/scipy/scipy/pull/16594): MAINT: Better pytest-timeout support +* [#16596](https://github.com/scipy/scipy/pull/16596): MAINT: stats.rv\_continuous: consistently return NumPy scalars +* [#16607](https://github.com/scipy/scipy/pull/16607): MAINT: remove unnecessary `\_\_future\_\_` imports +* [#16608](https://github.com/scipy/scipy/pull/16608): TST: stats.rv\_continuous: more direct test for numpy scalar output +* [#16612](https://github.com/scipy/scipy/pull/16612): ENH: vectorize along samples `stats.special\_ortho\_group.rvs` +* [#16614](https://github.com/scipy/scipy/pull/16614): DOC: add import NumPy in linalg decomposition function examples +* [#16615](https://github.com/scipy/scipy/pull/16615): DOC: Adding import numpy to several files +* [#16616](https://github.com/scipy/scipy/pull/16616): DOC: Adding import numpy to examples in some stats files +* [#16617](https://github.com/scipy/scipy/pull/16617): DOC: Update instructions for debugging using dev.py +* [#16618](https://github.com/scipy/scipy/pull/16618): DOC: add import NumPy in bsplines examples +* [#16619](https://github.com/scipy/scipy/pull/16619): DOC: add import numpy in some stats examples +* [#16620](https://github.com/scipy/scipy/pull/16620): DOC: Add numpy import to examples +* [#16621](https://github.com/scipy/scipy/pull/16621): FIX: upstream fix for binomial distribution divide-by-zero +* [#16624](https://github.com/scipy/scipy/pull/16624): DOC: add NumPy imports in `\_mstats\_basic.py` examples +* [#16625](https://github.com/scipy/scipy/pull/16625): DOC: add `import numpy as np` to examples +* [#16626](https://github.com/scipy/scipy/pull/16626): BUG: cluster: fix `leaves\_color\_list` issue +* [#16627](https://github.com/scipy/scipy/pull/16627): TST: spatial.directed\_hausdorff: Parametrized test\_random\_state\_None\_int +* [#16629](https://github.com/scipy/scipy/pull/16629): DOC: Modifiy the scipy.stats.mode example to be nontrivial. +* [#16631](https://github.com/scipy/scipy/pull/16631): MAINT: stats.gaussian\_kde: raise informative message with degenerate… +* [#16632](https://github.com/scipy/scipy/pull/16632): MAINT: signal:corrected peak\_finding example +* [#16633](https://github.com/scipy/scipy/pull/16633): DOC: update benchmarking docs to use dev.py user interface +* [#16634](https://github.com/scipy/scipy/pull/16634): DOC: Add example to fft.fht +* [#16635](https://github.com/scipy/scipy/pull/16635): DOC: fix default\_rng namespace and linestyle of an example +* [#16639](https://github.com/scipy/scipy/pull/16639): DOC: better links in readme for newcomers +* [#16640](https://github.com/scipy/scipy/pull/16640): MAINT: optimize: always return a float from goal functional wrapper +* [#16641](https://github.com/scipy/scipy/pull/16641): DOC: optimize: fix doc that `curve\_fit` xdata should be float… +* [#16644](https://github.com/scipy/scipy/pull/16644): DOC: io: Add Examples section for mminfo, mmread and mmwrite. +* [#16646](https://github.com/scipy/scipy/pull/16646): MAINT: have get\_index\_dtype follow its documentation and return… +* [#16647](https://github.com/scipy/scipy/pull/16647): MAINT: Fix expit function name typo in test\_optimize.py +* [#16650](https://github.com/scipy/scipy/pull/16650): DOC: io: Add ‘Examples’ to the ‘whosmat’ docstring. +* [#16651](https://github.com/scipy/scipy/pull/16651): ENH: stats.resampling: automatically detect whether statistic… +* [#16652](https://github.com/scipy/scipy/pull/16652): MAINT: Remove unused imports. +* [#16653](https://github.com/scipy/scipy/pull/16653): DEV: generalized cross-validation smoothing spline +* [#16654](https://github.com/scipy/scipy/pull/16654): ENH: stats: add aliases to results objects +* [#16658](https://github.com/scipy/scipy/pull/16658): BUG: signal: Compare window\_length to correct axis in savgol\_filter +* [#16659](https://github.com/scipy/scipy/pull/16659): DOC: replace `sphinx\_panels` and `sphinx\_tabs` with `sphinx\_design` +* [#16666](https://github.com/scipy/scipy/pull/16666): MAINT: remove unused `\_\_main\_\_` code from `optimize` submodule +* [#16667](https://github.com/scipy/scipy/pull/16667): DOC: spatial: Correct barycentric description in Delaunay +* [#16668](https://github.com/scipy/scipy/pull/16668): DOC: signal: Update values in zpk2sos docstring examples. +* [#16670](https://github.com/scipy/scipy/pull/16670): MAINT: fix a compiler warning in `signal/\_firfilter.c` +* [#16672](https://github.com/scipy/scipy/pull/16672): BLD: update minimum `meson` and `meson-python` versions +* [#16675](https://github.com/scipy/scipy/pull/16675): TST: sparse.linalg: increase `lobpcg` solve tolerance in test +* [#16676](https://github.com/scipy/scipy/pull/16676): MAINT: stats.mstats.mode: refactor to keep `kwargs` out of… +* [#16677](https://github.com/scipy/scipy/pull/16677): TST: speed up mindist test +* [#16678](https://github.com/scipy/scipy/pull/16678): DOC: remove custom colours in css +* [#16680](https://github.com/scipy/scipy/pull/16680): MAINT: stats.gmean: corrections with `axis=None` when masked-array… +* [#16683](https://github.com/scipy/scipy/pull/16683): DEV: add `–durations` argument to dev.py interface +* [#16685](https://github.com/scipy/scipy/pull/16685): BLD: implement compiler version checks for GCC and MSVC +* [#16687](https://github.com/scipy/scipy/pull/16687): DOC: signal: Update the examples in the remez docstring. +* [#16689](https://github.com/scipy/scipy/pull/16689): MAINT: sparse.linalg: remove LGMRES demo +* [#16690](https://github.com/scipy/scipy/pull/16690): random uniform -> normal to initiate lobpcg and arpack in svds +* [#16691](https://github.com/scipy/scipy/pull/16691): ENH: stats: Implement isf for the levy distribution. +* [#16692](https://github.com/scipy/scipy/pull/16692): ENH: stats.gaussian\_kde: replace use of inv\_cov in pdf +* [#16696](https://github.com/scipy/scipy/pull/16696): ENH: Speed up sparse.csgraph.dijkstra +* [#16699](https://github.com/scipy/scipy/pull/16699): DOC: stats: resampling and Monte Carlo methods tutorial +* [#16703](https://github.com/scipy/scipy/pull/16703): BLD: upgrade meson(-python) min versions and remove explicit… +* [#16704](https://github.com/scipy/scipy/pull/16704): DOC: improve some MSVC links in toolchain.rst +* [#16705](https://github.com/scipy/scipy/pull/16705): MAINT: add `\_\_bool\_\_` method to spatial.transform.Rotation +* [#16706](https://github.com/scipy/scipy/pull/16706): CI: add Meson version number in environment.yml to rebuild Docker… +* [#16707](https://github.com/scipy/scipy/pull/16707): DOC: expand the `scipy.interpolate` tutorial +* [#16712](https://github.com/scipy/scipy/pull/16712): BUG: Update \_svds.py: orthogonalize eigenvectors from arpack… +* [#16714](https://github.com/scipy/scipy/pull/16714): ENH: stats.bootstrap: extend previous bootstrap result +* [#16715](https://github.com/scipy/scipy/pull/16715): DOC: interpolate: add an example of splPrep/PPoly.from\_spline… +* [#16717](https://github.com/scipy/scipy/pull/16717): DOC: reformat seed docstrings +* [#16722](https://github.com/scipy/scipy/pull/16722): MAINT: additional test truthiness and length the empty Rotation +* [#16730](https://github.com/scipy/scipy/pull/16730): MAINT: interpolate: use \_fitpack\_impl in fitpack2 +* [#16731](https://github.com/scipy/scipy/pull/16731): ENH: interpolate.KroghInterpolator: raise warning about numerical… +* [#16732](https://github.com/scipy/scipy/pull/16732): DOC: Replace runtests.py with dev.py where appropriate +* [#16733](https://github.com/scipy/scipy/pull/16733): DOC: Add link to development workflow +* [#16735](https://github.com/scipy/scipy/pull/16735): DOC: forward port 1.9.0 relnotes +* [#16738](https://github.com/scipy/scipy/pull/16738): REL: DOC: update version switcher +* [#16739](https://github.com/scipy/scipy/pull/16739): CI: move the py311-dev job over to Meson +* [#16740](https://github.com/scipy/scipy/pull/16740): DOC: Fix Sphinx markup. +* [#16742](https://github.com/scipy/scipy/pull/16742): CI: move test\_numpy\_main to linux\_meson +* [#16743](https://github.com/scipy/scipy/pull/16743): DEP: interpolate: revert docstring only deprecation of fitpack… +* [#16747](https://github.com/scipy/scipy/pull/16747): DOC: sparse.linalg: Fix output in an example in the lobpcg docstring. +* [#16753](https://github.com/scipy/scipy/pull/16753): DOC: Integrate: Add improper integral examples for `dblquad`… +* [#16754](https://github.com/scipy/scipy/pull/16754): DOC: optimize: Fix mistake in a linprog example. +* [#16755](https://github.com/scipy/scipy/pull/16755): TST: sparse.linalg: Loosen tolerance for the lobpcg test ‘test\_tolerance\_float32’ +* [#16756](https://github.com/scipy/scipy/pull/16756): TST: test fixes for pypy +* [#16758](https://github.com/scipy/scipy/pull/16758): ENH: Release the GIL while computing KDE kernel estimate +* [#16761](https://github.com/scipy/scipy/pull/16761): DOC: add logo to readme. +* [#16762](https://github.com/scipy/scipy/pull/16762): MAINT: stats: mark slow tests +* [#16766](https://github.com/scipy/scipy/pull/16766): DOC: toolchain: fix numpy dependency for 1.7.2/3 +* [#16770](https://github.com/scipy/scipy/pull/16770): ENH: stats: use Boost implementation of skewnorm cdf/ppf +* [#16772](https://github.com/scipy/scipy/pull/16772): DOC: add one :math: to docstring for consistency +* [#16776](https://github.com/scipy/scipy/pull/16776): BUG: Set nperseg size to the size of an already-initialized window… +* [#16778](https://github.com/scipy/scipy/pull/16778): MAINT: fix a couple of Mypy errors that appeared recently +* [#16779](https://github.com/scipy/scipy/pull/16779): TST: Interpolate: Move incorrectly located NDInterpolator tests +* [#16788](https://github.com/scipy/scipy/pull/16788): DOC, TST: clarify Voronoi Qz +* [#16790](https://github.com/scipy/scipy/pull/16790): ENH: stats.invgauss: use Boost implementation of ppf/isf +* [#16791](https://github.com/scipy/scipy/pull/16791): MAINT: stats.skewnorm: fix fit when data skewness is greater… +* [#16793](https://github.com/scipy/scipy/pull/16793): DOC: optimize: add tutorial for milp +* [#16795](https://github.com/scipy/scipy/pull/16795): DOC: Embed method signatures of `spatial.transform.Rotation` +* [#16797](https://github.com/scipy/scipy/pull/16797): ENH add extrapolate to BSpline.design\_matrix +* [#16799](https://github.com/scipy/scipy/pull/16799): DOC: optimize.root\_scalar: improve parametrization of methods +* [#16800](https://github.com/scipy/scipy/pull/16800): MAINT: remove `\_lib/\_c99compat.h` and use C99 rather than `npy\_math.h`… +* [#16801](https://github.com/scipy/scipy/pull/16801): ENH: added the spectral 2-norm to \_norm.py +* [#16804](https://github.com/scipy/scipy/pull/16804): ENH: stats.weibull\_min: override fit +* [#16806](https://github.com/scipy/scipy/pull/16806): DEV: update pydevtool version to propagate exit codes +* [#16809](https://github.com/scipy/scipy/pull/16809): Doc: Added missing “import numpy as np” to docstring examples… +* [#16811](https://github.com/scipy/scipy/pull/16811): DOC: fix broken links +* [#16816](https://github.com/scipy/scipy/pull/16816): MAINT: special: remove one `libnpymath` dependency; more `NPY\_`… +* [#16817](https://github.com/scipy/scipy/pull/16817): MAINT: remove `NPY\_INLINE`, use `inline` instead +* [#16818](https://github.com/scipy/scipy/pull/16818): MAINT: update PROPACK git submodule to get rid of prints in test… +* [#16826](https://github.com/scipy/scipy/pull/16826): MAINT: fix some build warnings from `special/ellip\_harm.pxd` +* [#16828](https://github.com/scipy/scipy/pull/16828): DOC: add NumPy import in scipy.io examples +* [#16829](https://github.com/scipy/scipy/pull/16829): Interpn nonscalar followup +* [#16830](https://github.com/scipy/scipy/pull/16830): DOC: Add plot to circmean docstring +* [#16831](https://github.com/scipy/scipy/pull/16831): DOC: special: Several docstring updates. +* [#16832](https://github.com/scipy/scipy/pull/16832): DOC: add NumPy import in scipy.optimize examples +* [#16834](https://github.com/scipy/scipy/pull/16834): DOC: Improve circular stats doc +* [#16835](https://github.com/scipy/scipy/pull/16835): ENH: stats.ttest\_1samp: add confidence\_interval and df +* [#16837](https://github.com/scipy/scipy/pull/16837): DOC: interpolate: small example code improvement for `BSpline.basis\_element` +* [#16840](https://github.com/scipy/scipy/pull/16840): ENH: BSplines.design\_matrix performance improvement +* [#16843](https://github.com/scipy/scipy/pull/16843): ENH: Handle np array methods in stats.binned\_statistic\_dd +* [#16847](https://github.com/scipy/scipy/pull/16847): DOC: interpolate.{RegularGridInterpolator, interpn} add note… +* [#16848](https://github.com/scipy/scipy/pull/16848): ENH: stats.anderson: add fit parameters to result +* [#16853](https://github.com/scipy/scipy/pull/16853): DOC: interpolate: improve `interpolate.make\_interp.spline`… +* [#16854](https://github.com/scipy/scipy/pull/16854): MAINT: Delay `pooch` import error for `scipy.datasets` +* [#16855](https://github.com/scipy/scipy/pull/16855): Roadmap update: scipy.interpolate and Fortran libs +* [#16856](https://github.com/scipy/scipy/pull/16856): DOC: interpolate: add default spline degree value for `InterpolatedUnivariateSpline` +* [#16857](https://github.com/scipy/scipy/pull/16857): ENH : remove an expected warning in BarycentricInterpolator +* [#16858](https://github.com/scipy/scipy/pull/16858): ENH: Modify scipy.optimize.least\_squares to accept bounds of… +* [#16860](https://github.com/scipy/scipy/pull/16860): DOC: interpolate: improve spline smoothing parameter docs. +* [#16863](https://github.com/scipy/scipy/pull/16863): DOC: Adding docs contribution guidelines +* [#16864](https://github.com/scipy/scipy/pull/16864): DOC: stats: Some updates: +* [#16865](https://github.com/scipy/scipy/pull/16865): DOC: interpolate: improve `make\_lsq\_spline` docs +* [#16866](https://github.com/scipy/scipy/pull/16866): DEP, DOC: Show deprecated methods in docs and fix overwriting… +* [#16867](https://github.com/scipy/scipy/pull/16867): DOC: fix an accuracy issue in the docstring of `Rotation.align\_vectors` +* [#16869](https://github.com/scipy/scipy/pull/16869): DOC: Added missing ‘import numpy as np’ to docstring examples… +* [#16873](https://github.com/scipy/scipy/pull/16873): MAINT: stats.multinomial: don’t alter p[-1] when p[:-1].sum()… +* [#16874](https://github.com/scipy/scipy/pull/16874): DOC: signal: Add ‘Examples’ to the ‘normalize’ docstring. +* [#16884](https://github.com/scipy/scipy/pull/16884): DOC: improve installing from source instructions +* [#16885](https://github.com/scipy/scipy/pull/16885): TST: Interpolate: Parameterise RegularGridInterpolator tests +* [#16886](https://github.com/scipy/scipy/pull/16886): CI: wheels only on scipy [skip azp][skip github] +* [#16887](https://github.com/scipy/scipy/pull/16887): DOC: optimize.linprog: adjust tutorial to address gh16531 +* [#16888](https://github.com/scipy/scipy/pull/16888): DOC: outline how cibuildwheel is triggered and runs in CI +* [#16889](https://github.com/scipy/scipy/pull/16889): MAINT: interpolate: Remove a couple unused imports. +* [#16890](https://github.com/scipy/scipy/pull/16890): ENH: optimize.OptimizeResult: improve pretty-printing +* [#16891](https://github.com/scipy/scipy/pull/16891): TST: Interpolate: rename test so that is executed +* [#16893](https://github.com/scipy/scipy/pull/16893): DOC: add diagram explaining how Docker images get built and used… +* [#16896](https://github.com/scipy/scipy/pull/16896): DOC: Fix broken link in the “Additional Git Resources” page. +* [#16897](https://github.com/scipy/scipy/pull/16897): Pass down mip\_rel\_gap to the HiGHS optimizer +* [#16899](https://github.com/scipy/scipy/pull/16899): DOC: add legend to rv\_histogram plot +* [#16902](https://github.com/scipy/scipy/pull/16902): ENH: stats.ttest\_rel: add confidence\_interval to result +* [#16903](https://github.com/scipy/scipy/pull/16903): DOC: interpolate: add actual smoothing condition for `UnivariateSpline` +* [#16906](https://github.com/scipy/scipy/pull/16906): DOC: fixes for refguide check issues +* [#16907](https://github.com/scipy/scipy/pull/16907): BUG: stats: expect method of the vonmises distribution +* [#16910](https://github.com/scipy/scipy/pull/16910): MAINT: forward port 1.9.1 relnotes +* [#16913](https://github.com/scipy/scipy/pull/16913): ENH:interpolate: allow interp1d to take single value +* [#16916](https://github.com/scipy/scipy/pull/16916): DOC: add note about using interpn for data on a regular grid +* [#16923](https://github.com/scipy/scipy/pull/16923): MAINT: integrate.qmc\_quad: add QMC quadrature +* [#16924](https://github.com/scipy/scipy/pull/16924): Fix compilation with -Wincompatible-function-pointer-types +* [#16931](https://github.com/scipy/scipy/pull/16931): DOC: add details on Meson build debugging and introspection +* [#16933](https://github.com/scipy/scipy/pull/16933): MAINT : interpolate: added test for DivideByZero warning silencing… +* [#16937](https://github.com/scipy/scipy/pull/16937): MAINT: refer to python3 in refguide\_check +* [#16939](https://github.com/scipy/scipy/pull/16939): MAINT: stats: move `\_contains\_nan` function to `\_lib.\_util.py` +* [#16940](https://github.com/scipy/scipy/pull/16940): DOC: Documentation note update for truncnorm +* [#16941](https://github.com/scipy/scipy/pull/16941): MAINT: support logpdf in NumericalInverseHermite (stats.sampling) +* [#16948](https://github.com/scipy/scipy/pull/16948): DOC: sparse.linalg.svds: fix intermittent refguide check failure +* [#16950](https://github.com/scipy/scipy/pull/16950): DOC: Add examples for common Bessel functions +* [#16951](https://github.com/scipy/scipy/pull/16951): ENH: stats.fit: add plot\_types to FitResult.plot +* [#16953](https://github.com/scipy/scipy/pull/16953): DEV: update dev.py to only install changed files +* [#16955](https://github.com/scipy/scipy/pull/16955): BLD: fix up or suppress Fortran build warnings +* [#16956](https://github.com/scipy/scipy/pull/16956): BLD: fix meson version checks for MSVC +* [#16958](https://github.com/scipy/scipy/pull/16958): ENH: stats.crosstab: convert output tuple to bunch +* [#16959](https://github.com/scipy/scipy/pull/16959): DOC: Add example for morlet in scipy.signal +* [#16960](https://github.com/scipy/scipy/pull/16960): DOC: Fix indentation in benchmarking.rst +* [#16963](https://github.com/scipy/scipy/pull/16963): DOC: Update 2 links to point to stable. +* [#16967](https://github.com/scipy/scipy/pull/16967): ENH: stats.goodness\_of\_fit: a general goodness of fit test +* [#16968](https://github.com/scipy/scipy/pull/16968): ENH: Close parenthesis in numpy version warning +* [#16976](https://github.com/scipy/scipy/pull/16976): DOC: stats.qmc: fix description of seed parameter +* [#16980](https://github.com/scipy/scipy/pull/16980): DOC: fix duplicate word typos. +* [#16986](https://github.com/scipy/scipy/pull/16986): DOC: Fix link to rendered docs in documentation guide +* [#16987](https://github.com/scipy/scipy/pull/16987): ENH: stats.gaussian\_kde: replace use of inv\_cov in logpdf +* [#16989](https://github.com/scipy/scipy/pull/16989): DOC: edited t\_span parameter description in integrate.solve\_ivp +* [#16990](https://github.com/scipy/scipy/pull/16990): CI: enable uploads for (weekly) nightlies and update how action… +* [#16992](https://github.com/scipy/scipy/pull/16992): CI: upgrade CI image to run on Ubuntu 22.04 instead of 20.04 +* [#16995](https://github.com/scipy/scipy/pull/16995): DOC: stats: fix incorrectly documented statistic attribute for… +* [#17003](https://github.com/scipy/scipy/pull/17003): DOC: Add examples for a few Bessel functions +* [#17005](https://github.com/scipy/scipy/pull/17005): CI: pin OpenBLAS to specific build in macOS job to avoid gges… +* [#17006](https://github.com/scipy/scipy/pull/17006): ENH: stats.spearmanr: add statistic attribute to result object… +* [#17007](https://github.com/scipy/scipy/pull/17007): ENH: stats.kendalltau: add statistic attribute to result object… +* [#17008](https://github.com/scipy/scipy/pull/17008): ENH: stats.weightedtau: add statistic attribute to result object +* [#17009](https://github.com/scipy/scipy/pull/17009): Revert “CI: pin OpenBLAS to specific build in macOS job to avoid… +* [#17014](https://github.com/scipy/scipy/pull/17014): MAINT: remove unused variables and imports +* [#17016](https://github.com/scipy/scipy/pull/17016): ENH: stats.pearsonr, stats.pointbiserialr: add statistic/correlation… +* [#17017](https://github.com/scipy/scipy/pull/17017): ENH: stats.somersd: add correlation attribute to result object +* [#17021](https://github.com/scipy/scipy/pull/17021): FIX: `dev.py build` parallelism behaviour and fixed typos +* [#17022](https://github.com/scipy/scipy/pull/17022): Explain where LIL comes from +* [#17027](https://github.com/scipy/scipy/pull/17027): Fix explanation of LIst of List sparse matrix +* [#17029](https://github.com/scipy/scipy/pull/17029): CI: cirrus for building aarch64 +* [#17030](https://github.com/scipy/scipy/pull/17030): ENH: stats.permutation\_test: improve performance of samples/pairings… +* [#17032](https://github.com/scipy/scipy/pull/17032): TST: stats.fit: fix random state +* [#17034](https://github.com/scipy/scipy/pull/17034): TST: stats.jarque\_bera: fix test failure due to NumPy update +* [#17036](https://github.com/scipy/scipy/pull/17036): DEV: Update GPG key in Docker [Gitpod] +* [#17038](https://github.com/scipy/scipy/pull/17038): deduplicate `splint` in FITPACK wrappers; take 3 +* [#17039](https://github.com/scipy/scipy/pull/17039): ENH: add a `stats.expectile` function +* [#17041](https://github.com/scipy/scipy/pull/17041): DOC: Add examples for integrals of Bessel functions +* [#17048](https://github.com/scipy/scipy/pull/17048): DOC:signal: Fix typo in TransferFunction +* [#17049](https://github.com/scipy/scipy/pull/17049): TST: stats.jarque\_bera: fix test failure due to NumPy update +* [#17051](https://github.com/scipy/scipy/pull/17051): ENH: support complex functions in integrate.quad +* [#17052](https://github.com/scipy/scipy/pull/17052): BLD: implement symbol hiding for Meson through a linker version… +* [#17057](https://github.com/scipy/scipy/pull/17057): Fix or avoid various test failures that are showing up in CI +* [#17062](https://github.com/scipy/scipy/pull/17062): Add location and sign to KS test result +* [#17063](https://github.com/scipy/scipy/pull/17063): CI: fix uploading of nightly wheels +* [#17068](https://github.com/scipy/scipy/pull/17068): MAINT: Removed unused imports. +* [#17071](https://github.com/scipy/scipy/pull/17071): DOC: update maxfun in scipy.optimize.minimize(method=’L-BFGS-B’)… +* [#17073](https://github.com/scipy/scipy/pull/17073): DOC: examples for derivatives of Bessel functions +* [#17076](https://github.com/scipy/scipy/pull/17076): DOC: spatial: Copy-edit the voronoi\_plot\_2d example. +* [#17079](https://github.com/scipy/scipy/pull/17079): BUG: fix `signal.sosfilt` issue with complex dtypes and Intel… +* [#17081](https://github.com/scipy/scipy/pull/17081): DOC: Fix formatting in svds docstrings +* [#17083](https://github.com/scipy/scipy/pull/17083): DOC: Fix broken link for environment variables NumPy doc +* [#17085](https://github.com/scipy/scipy/pull/17085): DOC: optimize: add link to SciPy cookbooks milp tutorials +* [#17091](https://github.com/scipy/scipy/pull/17091): MAINT: interpolate remove duplication of FITPACK interface `sproot`. +* [#17093](https://github.com/scipy/scipy/pull/17093): ENH: Improves behavior of scipy.optimize.linprog (#17074) +* [#17094](https://github.com/scipy/scipy/pull/17094): DOC: examples for roots of Bessel functions +* [#17099](https://github.com/scipy/scipy/pull/17099): BLD: turn off fast-math for Intel compilers +* [#17103](https://github.com/scipy/scipy/pull/17103): ENH: stats.Covariance: add CovViaDiagonal +* [#17106](https://github.com/scipy/scipy/pull/17106): CI: fix testing of `SCIPY\_USE\_PYTHRAN=0`, and upgrade to pythran… +* [#17108](https://github.com/scipy/scipy/pull/17108): DOC: Reformulate ufunc description in special doc page +* [#17109](https://github.com/scipy/scipy/pull/17109): BLD: Ensure Intel Fortran handles negative 0 as expected. +* [#17110](https://github.com/scipy/scipy/pull/17110): DOC: add Numpy import to scipy.sparse examples +* [#17112](https://github.com/scipy/scipy/pull/17112): ENH: Add support for bounds class in curve\_fit +* [#17115](https://github.com/scipy/scipy/pull/17115): DOC: add Numpy import to examples +* [#17117](https://github.com/scipy/scipy/pull/17117): ENH: stats.logistic: override fit for remaining cases +* [#17118](https://github.com/scipy/scipy/pull/17118): ENH: Support for complex functions in binned\_statistic\_dd +* [#17122](https://github.com/scipy/scipy/pull/17122): ENH: remove duplicate function call +* [#17126](https://github.com/scipy/scipy/pull/17126): MAINT, ENH: scipy.stats: Refactor `directionalmean` to return… +* [#17128](https://github.com/scipy/scipy/pull/17128): ENH: stats.covariance: add CovViaCholesky +* [#17130](https://github.com/scipy/scipy/pull/17130): DOC: remove inconsistent messages +* [#17135](https://github.com/scipy/scipy/pull/17135): ENH: stats.Covariance: specifying covariance matrix by its eigendecomposition +* [#17138](https://github.com/scipy/scipy/pull/17138): CI: add permission to GH actions. +* [#17140](https://github.com/scipy/scipy/pull/17140): BUG: Fix issue with shgo not correctly passing jac to minimizer +* [#17141](https://github.com/scipy/scipy/pull/17141): ENH: stats.fit: add maximum spacing estimation +* [#17144](https://github.com/scipy/scipy/pull/17144): DOC: replace `set\_tight\_layout` with `set\_layout\_engine`… +* [#17147](https://github.com/scipy/scipy/pull/17147): BENCH: remove `–quick` flag to `asv run` in dev.py +* [#17149](https://github.com/scipy/scipy/pull/17149): MAINT: remove certifi py3.11 warning filter +* [#17152](https://github.com/scipy/scipy/pull/17152): ENH/MAINT: `qmc.LatinHypercube`: deprecate centered with scramble +* [#17157](https://github.com/scipy/scipy/pull/17157): ENH: Added value\_indices() function to scipy.ndimage +* [#17159](https://github.com/scipy/scipy/pull/17159): MAINT: spatial: Skip `test\_massive\_arr\_overflow` on systems… +* [#17161](https://github.com/scipy/scipy/pull/17161): MAINT: stats.sampling.NumericalInverseHermite: private distribution… +* [#17163](https://github.com/scipy/scipy/pull/17163): ENH: Add `download\_all` utility method & script +* [#17169](https://github.com/scipy/scipy/pull/17169): MAINT: special: Loosen the tolerance for a test of powm1. +* [#17170](https://github.com/scipy/scipy/pull/17170): MAINT: better handling of mode/center outside of the domain in… +* [#17175](https://github.com/scipy/scipy/pull/17175): MAINT: forward port 1.9.2 relnotes +* [#17177](https://github.com/scipy/scipy/pull/17177): DOC: stats: Fix versionadded markup for odds\_ratio +* [#17178](https://github.com/scipy/scipy/pull/17178): DOC: interpolate: discuss failure modes of SmoothBivariateSpline +* [#17180](https://github.com/scipy/scipy/pull/17180): DEP: interpolate: deprecate interp2d +* [#17181](https://github.com/scipy/scipy/pull/17181): CI: Fix when wheels are built for staging +* [#17182](https://github.com/scipy/scipy/pull/17182): MAINT: fix typo “mat[r]ix” +* [#17183](https://github.com/scipy/scipy/pull/17183): DOC: examples for `ive` and `kve` +* [#17184](https://github.com/scipy/scipy/pull/17184): DOC: stats: Fix the 1.9.0 release note about the ‘weights’ parameter… +* [#17188](https://github.com/scipy/scipy/pull/17188): DOC: update version switcher for 1.9.2 +* [#17198](https://github.com/scipy/scipy/pull/17198): MAINT: stats: remove use of interp2d from levy\_stable.\_fitstart +* [#17199](https://github.com/scipy/scipy/pull/17199): DOC: Fix typos in IIR design argument documentation +* [#17215](https://github.com/scipy/scipy/pull/17215): MAINT: remove code for old numpy versions +* [#17217](https://github.com/scipy/scipy/pull/17217): MAINT: interpolate/RGI: make all \_evaluate\_YYY methods use self.values +* [#17223](https://github.com/scipy/scipy/pull/17223): DOC: linalg: Expand the qz example. +* [#17227](https://github.com/scipy/scipy/pull/17227): TST: stats.sampling.NumericalInverseHermite: filter all RuntimeWarnings +* [#17230](https://github.com/scipy/scipy/pull/17230): ENH: subclass-friendly refactor RegularGridInterpolator +* [#17233](https://github.com/scipy/scipy/pull/17233): DOC: examples for Struve functions +* [#17236](https://github.com/scipy/scipy/pull/17236): stats/distributions: make rv\_sample public, allow subclassing +* [#17237](https://github.com/scipy/scipy/pull/17237): ENH: add conditional\_table to SciPy.stats. +* [#17238](https://github.com/scipy/scipy/pull/17238): DOC: linalg: Several docstring updates. +* [#17243](https://github.com/scipy/scipy/pull/17243): DOC: special: Updates for smirnov and smirnovi +* [#17247](https://github.com/scipy/scipy/pull/17247): MAINT: optimize.leastsq: fix covariance not SPD +* [#17256](https://github.com/scipy/scipy/pull/17256): doc/RegularizedIncompleteBetaFunction +* [#17258](https://github.com/scipy/scipy/pull/17258): MAINT: stats.multivariate\_normal: frozen rvs should pass cov\_object… +* [#17259](https://github.com/scipy/scipy/pull/17259): DOC: CI: Add note about skipping Cirrus CI. +* [#17262](https://github.com/scipy/scipy/pull/17262): MAINT: forward port 1.9.3 relnotes +* [#17264](https://github.com/scipy/scipy/pull/17264): DOC: update version switcher for 1.9.3 +* [#17273](https://github.com/scipy/scipy/pull/17273): TST: linalg: temporarily silence failure in test\_solve\_discrete\_are +* [#17276](https://github.com/scipy/scipy/pull/17276): MAINT/ENH: stats.multivariate\_normal.rvs: fix shape and speed… +* [#17277](https://github.com/scipy/scipy/pull/17277): ENH: Random unit vector distribution +* [#17279](https://github.com/scipy/scipy/pull/17279): TST: mark no\_segmentation fault test for DIRECT as xslow +* [#17280](https://github.com/scipy/scipy/pull/17280): DOC: example for voigt\_profile +* [#17283](https://github.com/scipy/scipy/pull/17283): STY: stats.Covariance: fix lint issue in `main` +* [#17284](https://github.com/scipy/scipy/pull/17284): MAINT: special: Loosen tolerance in test\_sinpi() and test\_cospi(). +* [#17291](https://github.com/scipy/scipy/pull/17291): Cythonize 2D linear code path in RegularGridInterpolator +* [#17296](https://github.com/scipy/scipy/pull/17296): Fix test fails caused by pytest 7.1.3 +* [#17298](https://github.com/scipy/scipy/pull/17298): DOC: Add examples to Stats Anderson +* [#17299](https://github.com/scipy/scipy/pull/17299): DOC: interpolate: Extrapolation tips and tricks +* [#17301](https://github.com/scipy/scipy/pull/17301): DOC, MAINT: remove use of inspect.formatargspec during doc build +* [#17302](https://github.com/scipy/scipy/pull/17302): MAINT: special: Use boost for special.hyp1f1 with real inputs. +* [#17303](https://github.com/scipy/scipy/pull/17303): Remove handwritten `\_fitpack.spalde` : a rebase of pr/17145 +* [#17304](https://github.com/scipy/scipy/pull/17304): ENH: stats: implement \_sf and \_isf for invweibull. +* [#17305](https://github.com/scipy/scipy/pull/17305): BUG: interpolate: allow zero-sized data arrays +* [#17313](https://github.com/scipy/scipy/pull/17313): DOC: interpolate: add a note on data with different scales +* [#17314](https://github.com/scipy/scipy/pull/17314): DOC: interpolate/tutorial: add a length-1 example +* [#17315](https://github.com/scipy/scipy/pull/17315): MAINT: special: Remove tests of numpy functions arccosh, arcsinh… +* [#17317](https://github.com/scipy/scipy/pull/17317): DOC: interpolate/tutorial: add an example for equally-spaced… +* [#17319](https://github.com/scipy/scipy/pull/17319): DOC: references and examples for huber/pseudo\_huber +* [#17331](https://github.com/scipy/scipy/pull/17331): CI: On Azure, pin pytest-xdist to version 2.5.0 +* [#17340](https://github.com/scipy/scipy/pull/17340): DOC: clarify use of bounds with basinhopping +* [#17345](https://github.com/scipy/scipy/pull/17345): ENH: commit to close #1261 (trac #734) by adding xtol argument. +* [#17346](https://github.com/scipy/scipy/pull/17346): BLD: fix `SCIPY\_USE\_PYTHRAN=0` usage for the Meson build +* [#17349](https://github.com/scipy/scipy/pull/17349): DOC: Fix signal docstrings; finish adding ‘import numpy as np’ +* [#17351](https://github.com/scipy/scipy/pull/17351): CI: Pin ninja==1.10.2.4 to avoid bug in 1.11.1 that breaks meson. +* [#17355](https://github.com/scipy/scipy/pull/17355): DOC: spatial: Fix some docstrings. +* [#17359](https://github.com/scipy/scipy/pull/17359): CI: ninja packages are repaired, so unpin. +* [#17361](https://github.com/scipy/scipy/pull/17361): DOC: examples for gdtr and gdtrc +* [#17363](https://github.com/scipy/scipy/pull/17363): DOC: adjust the deprecation notice for interp2d +* [#17366](https://github.com/scipy/scipy/pull/17366): DOC/MAINT: clean doctests namespace +* [#17367](https://github.com/scipy/scipy/pull/17367): DOC: Add missing `build` parameter to `dev.py` +* [#17369](https://github.com/scipy/scipy/pull/17369): DOC: consistent use of `=` for argument documentation +* [#17371](https://github.com/scipy/scipy/pull/17371): DOC: update RBF tutorial with new `RBFInterpolator` +* [#17372](https://github.com/scipy/scipy/pull/17372): BLD: update to Meson 0.64.0, remove `pure: false` lines +* [#17374](https://github.com/scipy/scipy/pull/17374): DOC: `special.itairy` example +* [#17376](https://github.com/scipy/scipy/pull/17376): DOC: Add examples to stats.mstats.find\_repeats +* [#17395](https://github.com/scipy/scipy/pull/17395): DOC: optimize: minimize doc to reflect tnc’s deprecation of maxiter +* [#17397](https://github.com/scipy/scipy/pull/17397): BUG: signal: Change types in the upfirdn utility function \_output\_len() +* [#17399](https://github.com/scipy/scipy/pull/17399): DOC: signal.iirdesign: remove `bessel` from supported filter… +* [#17400](https://github.com/scipy/scipy/pull/17400): TST: use norm in signal.TestBessel.test\_fs\_param +* [#17409](https://github.com/scipy/scipy/pull/17409): DOC: Examples for special functions related to F distribution +* [#17415](https://github.com/scipy/scipy/pull/17415): MAINT: Python 3.8 typing simplify +* [#17416](https://github.com/scipy/scipy/pull/17416): BLD: fix a lot of configuration warnings by using `fs.copyfile` +* [#17417](https://github.com/scipy/scipy/pull/17417): BUG: integrate: simpson didn’t handle integer n-d arrays. +* [#17418](https://github.com/scipy/scipy/pull/17418): DOC: special: Remove duplicate imports from special examples. +* [#17423](https://github.com/scipy/scipy/pull/17423): Documentation to fix #17089 +* [#17426](https://github.com/scipy/scipy/pull/17426): BLD: fix for propack and boost submodules - don’t ask for native… +* [#17427](https://github.com/scipy/scipy/pull/17427): DOC: optimize.linprog: adjust HiGHS URL +* [#17430](https://github.com/scipy/scipy/pull/17430): BLD: define NDEBUG to mimic cmake release build +* [#17433](https://github.com/scipy/scipy/pull/17433): MAINT/TST: improved test coverage for DIRECT optimizer +* [#17439](https://github.com/scipy/scipy/pull/17439): DOC: Improve example for uniform\_direction distribution +* [#17446](https://github.com/scipy/scipy/pull/17446): MAINT: stats.gaussian\_kde: error early if n\_features > n\_data +* [#17447](https://github.com/scipy/scipy/pull/17447): MAINT: optimize.fminbound/minimize\_scalar: add references, distinguish… +* [#17448](https://github.com/scipy/scipy/pull/17448): MAINT: optimize.minimize\_scalar: always acknowledge ‘bounds’… +* [#17449](https://github.com/scipy/scipy/pull/17449): MAINT: remove remaining occurrences of unicode +* [#17457](https://github.com/scipy/scipy/pull/17457): DOC: Double Integral Example Typo +* [#17466](https://github.com/scipy/scipy/pull/17466): BUG: stats: Fix for gh-17444. +* [#17467](https://github.com/scipy/scipy/pull/17467): BUG: ndimage: Don’t use np.int0 (it is the same as np.intp) +* [#17469](https://github.com/scipy/scipy/pull/17469): BUG: stats: Random parameters in `pytest.mark.parametrize()`… +* [#17471](https://github.com/scipy/scipy/pull/17471): MAINT: stats.rv\_count: revert gh-17236 +* [#17472](https://github.com/scipy/scipy/pull/17472): Getting rid of \_make\_points\_and\_values\_ascending and its unnecessary… +* [#17478](https://github.com/scipy/scipy/pull/17478): ENH: Add clear\_cache utility for `scipy.datasets` +* [#17481](https://github.com/scipy/scipy/pull/17481): MAINT: special: remove more `npy\_math.h` usage +* [#17482](https://github.com/scipy/scipy/pull/17482): MAINT: stats: Unconditionally disable boost double promotion. +* [#17484](https://github.com/scipy/scipy/pull/17484): DOC: remove hard-coded value from PoissonDisk example +* [#17485](https://github.com/scipy/scipy/pull/17485): ENH: increase range of vonmises entropy +* [#17487](https://github.com/scipy/scipy/pull/17487): CI: pin setuptools for musllinux +* [#17489](https://github.com/scipy/scipy/pull/17489): BUG: ndimage: Work around gh-17270 +* [#17496](https://github.com/scipy/scipy/pull/17496): DEV: dev.py: make lint task consistent with CI +* [#17500](https://github.com/scipy/scipy/pull/17500): MAINT: special: Remove references to nonexistent function exp1m. +* [#17501](https://github.com/scipy/scipy/pull/17501): Minor: Misspelling typos fixed in \_svds.py +* [#17504](https://github.com/scipy/scipy/pull/17504): CI: PRs run against merged main [skip circle][skip gh][skip azp] +* [#17512](https://github.com/scipy/scipy/pull/17512): TST: interpolate: stop skipping a test with zero-sized arrays +* [#17513](https://github.com/scipy/scipy/pull/17513): BUG: optimize: fixed issue 17380 +* [#17526](https://github.com/scipy/scipy/pull/17526): BUG, DOC: stats: fix `[source]` button redicting to the wrong… +* [#17534](https://github.com/scipy/scipy/pull/17534): DOC: 1.10.0 release notes +* [#17536](https://github.com/scipy/scipy/pull/17536): DOC: Examples for `yve` and `jve` +* [#17540](https://github.com/scipy/scipy/pull/17540): DOC: fix documentation of `make\_smoothing\_spline` +* [#17543](https://github.com/scipy/scipy/pull/17543): CI: fix gh17539 failures of the alpine linux run +* [#17545](https://github.com/scipy/scipy/pull/17545): BUG: special: Fix handling of subnormal input for lambertw. +* [#17551](https://github.com/scipy/scipy/pull/17551): BUG Fix: Update lobpcg.py to turn history arrays into lists for… +* [#17569](https://github.com/scipy/scipy/pull/17569): MAINT: version bounds for 1.10.0rc1/relnotes fixes +* [#17579](https://github.com/scipy/scipy/pull/17579): Revert “ENH: stats.ks\_2samp: Pythranize remaining exact p-value… +* [#17580](https://github.com/scipy/scipy/pull/17580): CI: native cp38-macosx\_arm64 [wheel build][skip azp][skip circle][ski… +* [#17583](https://github.com/scipy/scipy/pull/17583): MAINT: 1.10.0rc1 backports round 2 +* [#17591](https://github.com/scipy/scipy/pull/17591): MAINT: stats.pearsonr: raise error for complex input +* [#17600](https://github.com/scipy/scipy/pull/17600): DOC: update version switcher for 1.10 +* [#17611](https://github.com/scipy/scipy/pull/17611): MAINT: Update ascent.dat file hash +* [#17614](https://github.com/scipy/scipy/pull/17614): MAINT: optimize.milp: don’t warn about `mip\_rel\_gap` option +* [#17627](https://github.com/scipy/scipy/pull/17627): MAINT: Cast `datasets.ascent` image to float64 +* [#17634](https://github.com/scipy/scipy/pull/17634): MAINT: casting errstate for NumPy 1.24 +* [#17638](https://github.com/scipy/scipy/pull/17638): MAINT, TST: alpine/musl segfault shim +* [#17640](https://github.com/scipy/scipy/pull/17640): MAINT: prepare for SciPy 1.10.0rc2 +* [#17645](https://github.com/scipy/scipy/pull/17645): MAINT: stats.rankdata: ensure consistent shape handling +* [#17653](https://github.com/scipy/scipy/pull/17653): MAINT: pybind11 win exclusion +* [#17656](https://github.com/scipy/scipy/pull/17656): MAINT: 1.10.0rc2 backports, round two +* [#17662](https://github.com/scipy/scipy/pull/17662): Fix undefined behavior within scipy.fft +* [#17686](https://github.com/scipy/scipy/pull/17686): REV: integrate.qmc\_quad: delay release to SciPy 1.11.0 +* [#17689](https://github.com/scipy/scipy/pull/17689): REL: integrate.qmc\_quad: remove from release notes diff --git a/corpus/changelog/scipy_releases/scipy_1101.md b/corpus/changelog/scipy_releases/scipy_1101.md new file mode 100644 index 0000000000000000000000000000000000000000..5af8939deaf05654181851aed451f003f3e34369 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1101.md @@ -0,0 +1,101 @@ +# SciPy 1.10.1 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.10.1-notes.html +Version: 1.10.1 + +Contents + +* [SciPy 1.10.1 Release Notes](#scipy-1-10-1-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.10.1](#issues-closed-for-1-10-1) + - [Pull requests for 1.10.1](#pull-requests-for-1-10-1) + +SciPy 1.10.1 is a bug-fix release with no new features +compared to 1.10.0. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Name (commits) +* alice (1) + +* Matt Borland (2) + +* Evgeni Burovski (2) +* CJ Carey (1) +* Ralf Gommers (9) +* Brett Graham (1) + +* Matt Haberland (5) +* Alex Herbert (1) + +* Ganesh Kathiresan (2) + +* Rishi Kulkarni (1) + +* Loïc Estève (1) +* Michał Górny (1) + +* Jarrod Millman (1) +* Andrew Nelson (4) +* Tyler Reddy (50) +* Pamphile Roy (2) +* Eli Schwartz (2) +* Tomer Sery (1) + +* Kai Striega (1) +* Jacopo Tissino (1) + +* windows-server-2003 (1) + +A total of 21 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.10.1](#id3)[#](#issues-closed-for-1-10-1 "Link to this heading") + +* [#14980](https://github.com/scipy/scipy/issues/14980): BUG: Johnson’s algorithm fails without negative cycles +* [#17670](https://github.com/scipy/scipy/issues/17670): Failed to install on Raspberry Pi (ARM) 32bit in 3.11.1 +* [#17715](https://github.com/scipy/scipy/issues/17715): scipy.stats.bootstrap broke with statistic returning multiple… +* [#17716](https://github.com/scipy/scipy/issues/17716): BUG: interpolate.interpn fails with read only input +* [#17718](https://github.com/scipy/scipy/issues/17718): BUG: RegularGridInterpolator 2D mixed precision crashes +* [#17727](https://github.com/scipy/scipy/issues/17727): BUG: RegularGridInterpolator does not work on non-native byteorder… +* [#17736](https://github.com/scipy/scipy/issues/17736): BUG: SciPy requires OpenBLAS even when building against a different… +* [#17775](https://github.com/scipy/scipy/issues/17775): BUG: Asymptotic computation of ksone.sf has intermediate overflow +* [#17782](https://github.com/scipy/scipy/issues/17782): BUG: Segfault in scipy.sparse.csgraph.shortest\_path() with v1.10.0 +* [#17795](https://github.com/scipy/scipy/issues/17795): BUG: stats.pearsonr one-sided hypothesis yields incorrect p-value… +* [#17801](https://github.com/scipy/scipy/issues/17801): BUG: stats.powerlaw.fit: raises OverflowError +* [#17808](https://github.com/scipy/scipy/issues/17808): BUG: name of cython executable is hardcoded in \_build\_utils/cythoner.py +* [#17811](https://github.com/scipy/scipy/issues/17811): CI job with numpy nightly build failing on missing `\_ArrayFunctionDispatcher.\_\_code\_\_` +* [#17839](https://github.com/scipy/scipy/issues/17839): BUG: 1.10.0 tests fail on i386 and other less common arches +* [#17896](https://github.com/scipy/scipy/issues/17896): DOC: publicly expose `multivariate\_normal` attributes `mean`… +* [#17934](https://github.com/scipy/scipy/issues/17934): BUG: meson `\_\_config\_\_` generation - truncated unicode characters +* [#17938](https://github.com/scipy/scipy/issues/17938): BUG: `scipy.stats.qmc.LatinHypercube` with `optimization=”random-cd”`… + +### [Pull requests for 1.10.1](#id4)[#](#pull-requests-for-1-10-1 "Link to this heading") + +* [#17712](https://github.com/scipy/scipy/pull/17712): REL, MAINT: prepare for 1.10.1 +* [#17717](https://github.com/scipy/scipy/pull/17717): BUG: allow readonly input to interpolate.interpn +* [#17721](https://github.com/scipy/scipy/pull/17721): MAINT: update `meson-python` upper bound to <0.13.0 +* [#17726](https://github.com/scipy/scipy/pull/17726): BUG: interpolate/RGI: upcast float32 to float64 +* [#17735](https://github.com/scipy/scipy/pull/17735): MAINT: stats.bootstrap: fix BCa with vector-valued statistics +* [#17743](https://github.com/scipy/scipy/pull/17743): DOC: improve the docs on using BLAS/LAPACK libraries with Meson +* [#17777](https://github.com/scipy/scipy/pull/17777): BLD: link to libatomic if necessary +* [#17783](https://github.com/scipy/scipy/pull/17783): BUG: Correct intermediate overflow in KS one asymptotic in SciPy.stats +* [#17790](https://github.com/scipy/scipy/pull/17790): BUG: signal: fix check\_malloc extern declaration type +* [#17797](https://github.com/scipy/scipy/pull/17797): MAINT: stats.pearsonr: correct p-value with negative correlation… +* [#17800](https://github.com/scipy/scipy/pull/17800): [sparse.csgraph] Fix a bug in dijkstra and johnson algorithm +* [#17803](https://github.com/scipy/scipy/pull/17803): MAINT: add missing `\_\_init\_\_.py` in test folder +* [#17806](https://github.com/scipy/scipy/pull/17806): MAINT: stats.powerlaw.fit: fix overflow when np.min(data)==0 +* [#17810](https://github.com/scipy/scipy/pull/17810): BLD: use Meson’s found cython instead of a wrapper script +* [#17831](https://github.com/scipy/scipy/pull/17831): MAINT, CI: GHA MacOS setup.py update +* [#17850](https://github.com/scipy/scipy/pull/17850): MAINT: remove use of `\_\_code\_\_` in `scipy.integrate` +* [#17854](https://github.com/scipy/scipy/pull/17854): TST: mark test for `stats.kde.marginal` as xslow +* [#17855](https://github.com/scipy/scipy/pull/17855): BUG: Fix handling of `powm1` overflow errors +* [#17859](https://github.com/scipy/scipy/pull/17859): TST: fix test failures on i386, s390x, ppc64, riscv64 (Debian) +* [#17862](https://github.com/scipy/scipy/pull/17862): BLD: Meson `\_\_config\_\_` generation +* [#17863](https://github.com/scipy/scipy/pull/17863): BUG: fix Johnson’s algorithm +* [#17872](https://github.com/scipy/scipy/pull/17872): BUG: fix powm1 overflow handling +* [#17904](https://github.com/scipy/scipy/pull/17904): ENH: `multivariate\_normal\_frozen`: restore `cov` attribute +* [#17910](https://github.com/scipy/scipy/pull/17910): CI: use nightly numpy musllinux\_x86\_64 wheel +* [#17931](https://github.com/scipy/scipy/pull/17931): TST: test\_location\_scale proper 32bit Linux skip +* [#17932](https://github.com/scipy/scipy/pull/17932): TST: 32-bit tol for test\_pdist\_jensenshannon\_iris +* [#17936](https://github.com/scipy/scipy/pull/17936): BUG: Use raw strings for paths in `\_\_config\_\_.py.in` +* [#17940](https://github.com/scipy/scipy/pull/17940): BUG: `rng\_integers` in `\_random\_cd` now samples on a closed… +* [#17942](https://github.com/scipy/scipy/pull/17942): BLD: update classifiers for Python 3.11 +* [#17963](https://github.com/scipy/scipy/pull/17963): MAINT: backports/prep for SciPy 1.10.1 +* [#17981](https://github.com/scipy/scipy/pull/17981): BLD: make sure macosx\_x86\_64 10.9 tags are being made on maintenance/1.10.x +* [#17984](https://github.com/scipy/scipy/pull/17984): DOC: update link of the logo in the readme +* [#17997](https://github.com/scipy/scipy/pull/17997): BUG: at least one entry from trial should be used in exponential… diff --git a/corpus/changelog/scipy_releases/scipy_1110.md b/corpus/changelog/scipy_releases/scipy_1110.md new file mode 100644 index 0000000000000000000000000000000000000000..c42c08d2dade4b31da0ac48aaa135bf65f5f9fe5 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1110.md @@ -0,0 +1,1178 @@ +# SciPy 1.11.0 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.11.0-notes.html +Version: 1.11.0 + +Contents + +* [SciPy 1.11.0 Release Notes](#scipy-1-11-0-release-notes) + + + [Highlights of this release](#highlights-of-this-release) + + [New features](#new-features) + + - [[`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") improvements](#scipy-integrate-improvements) + - [[`scipy.cluster`](../reference/cluster.html#module-scipy.cluster "scipy.cluster") improvements](#scipy-cluster-improvements) + - [[`scipy.constants`](../reference/constants.html#module-scipy.constants "scipy.constants") improvements](#scipy-constants-improvements) + - [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#scipy-linalg-improvements) + - [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#scipy-ndimage-improvements) + - [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#scipy-optimize-improvements) + - [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#scipy-signal-improvements) + - [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#scipy-sparse-improvements) + - [[`scipy.sparse.linalg`](../reference/sparse.linalg.html#module-scipy.sparse.linalg "scipy.sparse.linalg") improvements](#scipy-sparse-linalg-improvements) + - [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#scipy-spatial-improvements) + - [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#scipy-special-improvements) + - [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#scipy-stats-improvements) + + * [New Features](#id1) + * [Statistical Distributions](#statistical-distributions) + * [Other Improvements](#other-improvements) + + [Deprecated features](#deprecated-features) + + [Backwards incompatible changes](#backwards-incompatible-changes) + + [Expired Deprecations](#expired-deprecations) + + [Other changes](#other-changes) + + [Authors](#authors) + + [Issues closed for 1.11.0](#issues-closed-for-1-11-0) + + [Pull requests for 1.11.0](#pull-requests-for-1-11-0) + +SciPy 1.11.0 is the culmination of 6 months of hard work. It contains +many new features, numerous bug-fixes, improved test coverage and better +documentation. There have been a number of deprecations and API changes +in this release, which are documented below. All users are encouraged to +upgrade to this release, as there are a large number of bug-fixes and +optimizations. Before upgrading, we recommend that users check that +their own code does not use deprecated SciPy functionality (to do so, +run your code with `python -Wd` and check for `DeprecationWarning` s). +Our development attention will now shift to bug-fix releases on the +1.11.x branch, and on adding new features on the main branch. + +This release requires Python 3.9+ and NumPy 1.21.6 or greater. + +For running on PyPy, PyPy3 6.0+ is required. + +## [Highlights of this release](#id3)[#](#highlights-of-this-release "Link to this heading") + +* Several [`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") array API improvements, including *sparse.sparray*, a new + public base class distinct from the older *sparse.spmatrix* class, + proper 64-bit index support, and numerous deprecations paving the way to a + modern sparse array experience. +* [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") added tools for survival analysis, multiple hypothesis testing, + sensitivity analysis, and working with censored data. +* A new function was added for quasi-Monte Carlo integration, and linear + algebra functions `det` and `lu` now accept nD-arrays. +* An `axes` argument was added broadly to `ndimage` functions, facilitating + analysis of stacked image data. + +## [New features](#id4)[#](#new-features "Link to this heading") + +### [[`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") improvements](#id5)[#](#scipy-integrate-improvements "Link to this heading") + +* Added [`scipy.integrate.qmc_quad`](../reference/generated/scipy.integrate.qmc_quad.html#scipy.integrate.qmc_quad "scipy.integrate.qmc_quad") for quasi-Monte Carlo integration. +* For an even number of points, [`scipy.integrate.simpson`](../reference/generated/scipy.integrate.simpson.html#scipy.integrate.simpson "scipy.integrate.simpson") now calculates + a parabolic segment over the last three points which gives improved + accuracy over the previous implementation. + +### [[`scipy.cluster`](../reference/cluster.html#module-scipy.cluster "scipy.cluster") improvements](#id6)[#](#scipy-cluster-improvements "Link to this heading") + +* `disjoint_set` has a new method `subset_size` for providing the size + of a particular subset. + +### [[`scipy.constants`](../reference/constants.html#module-scipy.constants "scipy.constants") improvements](#id7)[#](#scipy-constants-improvements "Link to this heading") + +* The `quetta`, `ronna`, `ronto`, and `quecto` SI prefixes were added. + +### [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#id8)[#](#scipy-linalg-improvements "Link to this heading") + +* [`scipy.linalg.det`](../reference/generated/scipy.linalg.det.html#scipy.linalg.det "scipy.linalg.det") is improved and now accepts nD-arrays. +* [`scipy.linalg.lu`](../reference/generated/scipy.linalg.lu.html#scipy.linalg.lu "scipy.linalg.lu") is improved and now accepts nD-arrays. With the new + `p_indices` switch the output permutation argument can be 1D `(n,)` + permutation index instead of the full `(n, n)` array. + +### [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#id9)[#](#scipy-ndimage-improvements "Link to this heading") + +* `axes` argument was added to `rank_filter`, `percentile_filter`, + `median_filter`, `uniform_filter`, `minimum_filter`, + `maximum_filter`, and `gaussian_filter`, which can be useful for + processing stacks of image data. + +### [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#id10)[#](#scipy-optimize-improvements "Link to this heading") + +* [`scipy.optimize.linprog`](../reference/generated/scipy.optimize.linprog.html#scipy.optimize.linprog "scipy.optimize.linprog") now passes unrecognized options directly to HiGHS. +* [`scipy.optimize.root_scalar`](../reference/generated/scipy.optimize.root_scalar.html#scipy.optimize.root_scalar "scipy.optimize.root_scalar") now uses Newton’s method to be used without + providing `fprime` and the `secant` method to be used without a second + guess. +* [`scipy.optimize.lsq_linear`](../reference/generated/scipy.optimize.lsq_linear.html#scipy.optimize.lsq_linear "scipy.optimize.lsq_linear") now accepts `bounds` arguments of type + [`scipy.optimize.Bounds`](../reference/generated/scipy.optimize.Bounds.html#scipy.optimize.Bounds "scipy.optimize.Bounds"). +* [`scipy.optimize.minimize`](../reference/generated/scipy.optimize.minimize.html#scipy.optimize.minimize "scipy.optimize.minimize") `method='cobyla'` now supports simple bound + constraints. +* Users can opt into a new callback interface for most methods of + [`scipy.optimize.minimize`](../reference/generated/scipy.optimize.minimize.html#scipy.optimize.minimize "scipy.optimize.minimize"): If the provided callback callable accepts + a single keyword argument, `intermediate_result`, [`scipy.optimize.minimize`](../reference/generated/scipy.optimize.minimize.html#scipy.optimize.minimize "scipy.optimize.minimize") + now passes both the current solution and the optimal value of the objective + function to the callback as an instance of [`scipy.optimize.OptimizeResult`](../reference/generated/scipy.optimize.OptimizeResult.html#scipy.optimize.OptimizeResult "scipy.optimize.OptimizeResult"). + It also allows the user to terminate optimization by raising a + `StopIteration` exception from the callback function. + [`scipy.optimize.minimize`](../reference/generated/scipy.optimize.minimize.html#scipy.optimize.minimize "scipy.optimize.minimize") will return normally, and the latest solution + information is provided in the result object. +* [`scipy.optimize.curve_fit`](../reference/generated/scipy.optimize.curve_fit.html#scipy.optimize.curve_fit "scipy.optimize.curve_fit") now supports an optional `nan_policy` argument. +* [`scipy.optimize.shgo`](../reference/generated/scipy.optimize.shgo.html#scipy.optimize.shgo "scipy.optimize.shgo") now has parallelization with the `workers` argument, + symmetry arguments that can improve performance, class-based design to + improve usability, and generally improved performance. + +### [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#id11)[#](#scipy-signal-improvements "Link to this heading") + +* `istft` has an improved warning message when the NOLA condition fails. + +### [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#id12)[#](#scipy-sparse-improvements "Link to this heading") + +* A new public base class [`scipy.sparse.sparray`](../reference/generated/scipy.sparse.sparray.html#scipy.sparse.sparray "scipy.sparse.sparray") was introduced, allowing further + extension of the sparse array API (such as the support for 1-dimensional + sparse arrays) without breaking backwards compatibility. + `isinstance(x, scipy.sparse.sparray)` to select the new sparse array classes, + while `isinstance(x, scipy.sparse.spmatrix)` selects only the old sparse + matrix classes. +* Division of sparse arrays by a dense array now returns sparse arrays. +* [`scipy.sparse.isspmatrix`](../reference/generated/scipy.sparse.isspmatrix.html#scipy.sparse.isspmatrix "scipy.sparse.isspmatrix") now only returns *True* for the sparse matrices instances. + [`scipy.sparse.issparse`](../reference/generated/scipy.sparse.issparse.html#scipy.sparse.issparse "scipy.sparse.issparse") now has to be used instead to check for instances of sparse + arrays or instances of sparse matrices. +* Sparse arrays constructed with int64 indices will no longer automatically + downcast to int32. +* The `argmin` and `argmax` methods now return the correct result when explicit + zeros are present. + +### [[`scipy.sparse.linalg`](../reference/sparse.linalg.html#module-scipy.sparse.linalg "scipy.sparse.linalg") improvements](#id13)[#](#scipy-sparse-linalg-improvements "Link to this heading") + +* dividing `LinearOperator` by a number now returns a + `_ScaledLinearOperator` +* `LinearOperator` now supports right multiplication by arrays +* `lobpcg` should be more efficient following removal of an extraneous + QR decomposition. + +### [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#id14)[#](#scipy-spatial-improvements "Link to this heading") + +* Usage of new C++ backend for additional distance metrics, the majority of + which will see substantial performance improvements, though a few minor + regressions are known. These are focused on distances between boolean + arrays. + +### [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#id15)[#](#scipy-special-improvements "Link to this heading") + +* The factorial functions `factorial`, `factorial2` and `factorialk` + were made consistent in their behavior (in terms of dimensionality, + errors etc.). Additionally, `factorial2` can now handle arrays with + `exact=True`, and `factorialk` can handle arrays. + +### [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#id16)[#](#scipy-stats-improvements "Link to this heading") + +#### [New Features](#id17)[#](#id1 "Link to this heading") + +* [`scipy.stats.sobol_indices`](../reference/generated/scipy.stats.sobol_indices.html#scipy.stats.sobol_indices "scipy.stats.sobol_indices"), a method to compute Sobol’ sensitivity indices. +* [`scipy.stats.dunnett`](../reference/generated/scipy.stats.dunnett.html#scipy.stats.dunnett "scipy.stats.dunnett"), which performs Dunnett’s test of the means of multiple + experimental groups against the mean of a control group. +* [`scipy.stats.ecdf`](../reference/generated/scipy.stats.ecdf.html#scipy.stats.ecdf "scipy.stats.ecdf") for computing the empirical CDF and complementary + CDF (survival function / SF) from uncensored or right-censored data. This + function is also useful for survival analysis / Kaplan-Meier estimation. +* [`scipy.stats.logrank`](../reference/generated/scipy.stats.logrank.html#scipy.stats.logrank "scipy.stats.logrank") to compare survival functions underlying samples. +* [`scipy.stats.false_discovery_control`](../reference/generated/scipy.stats.false_discovery_control.html#scipy.stats.false_discovery_control "scipy.stats.false_discovery_control") for adjusting p-values to control the + false discovery rate of multiple hypothesis tests using the + Benjamini-Hochberg or Benjamini-Yekutieli procedures. +* [`scipy.stats.CensoredData`](../reference/generated/scipy.stats.CensoredData.html#scipy.stats.CensoredData "scipy.stats.CensoredData") to represent censored data. It can be used as + input to the `fit` method of univariate distributions and to the new + `ecdf` function. +* Filliben’s goodness of fit test as `method='Filliben'` of + [`scipy.stats.goodness_of_fit`](../reference/generated/scipy.stats.goodness_of_fit.html#scipy.stats.goodness_of_fit "scipy.stats.goodness_of_fit"). +* [`scipy.stats.ttest_ind`](../reference/generated/scipy.stats.ttest_ind.html#scipy.stats.ttest_ind "scipy.stats.ttest_ind") has a new method, `confidence_interval` for + computing a confidence interval of the difference between means. +* [`scipy.stats.MonteCarloMethod`](../reference/generated/scipy.stats.MonteCarloMethod.html#scipy.stats.MonteCarloMethod "scipy.stats.MonteCarloMethod"), [`scipy.stats.PermutationMethod`](../reference/generated/scipy.stats.PermutationMethod.html#scipy.stats.PermutationMethod "scipy.stats.PermutationMethod"), and + [`scipy.stats.BootstrapMethod`](../reference/generated/scipy.stats.BootstrapMethod.html#scipy.stats.BootstrapMethod "scipy.stats.BootstrapMethod") are new classes to configure resampling and/or + Monte Carlo versions of hypothesis tests. They can currently be used with + [`scipy.stats.pearsonr`](../reference/generated/scipy.stats.pearsonr.html#scipy.stats.pearsonr "scipy.stats.pearsonr"). + +#### [Statistical Distributions](#id18)[#](#statistical-distributions "Link to this heading") + +* Added the von-Mises Fisher distribution as [`scipy.stats.vonmises_fisher`](../reference/generated/scipy.stats.vonmises_fisher.html#scipy.stats.vonmises_fisher "scipy.stats.vonmises_fisher"). + This distribution is the most common analogue of the normal distribution + on the unit sphere. +* Added the relativistic Breit-Wigner distribution as + [`scipy.stats.rel_breitwigner`](../reference/generated/scipy.stats.rel_breitwigner.html#scipy.stats.rel_breitwigner "scipy.stats.rel_breitwigner"). + It is used in high energy physics to model resonances. +* Added the Dirichlet multinomial distribution as + [`scipy.stats.dirichlet_multinomial`](../reference/generated/scipy.stats.dirichlet_multinomial.html#scipy.stats.dirichlet_multinomial "scipy.stats.dirichlet_multinomial"). +* Improved the speed and precision of several univariate statistical + distributions. + + + [`scipy.stats.anglit`](../reference/generated/scipy.stats.anglit.html#scipy.stats.anglit "scipy.stats.anglit") `sf` + + [`scipy.stats.beta`](../reference/generated/scipy.stats.beta.html#scipy.stats.beta "scipy.stats.beta") `entropy` + + [`scipy.stats.betaprime`](../reference/generated/scipy.stats.betaprime.html#scipy.stats.betaprime "scipy.stats.betaprime") `cdf`, `sf`, `ppf` + + [`scipy.stats.chi`](../reference/generated/scipy.stats.chi.html#scipy.stats.chi "scipy.stats.chi") `entropy` + + [`scipy.stats.chi2`](../reference/generated/scipy.stats.chi2.html#scipy.stats.chi2 "scipy.stats.chi2") `entropy` + + [`scipy.stats.dgamma`](../reference/generated/scipy.stats.dgamma.html#scipy.stats.dgamma "scipy.stats.dgamma") `entropy`, `cdf`, `sf`, `ppf`, and `isf` + + [`scipy.stats.dweibull`](../reference/generated/scipy.stats.dweibull.html#scipy.stats.dweibull "scipy.stats.dweibull") `entropy`, `sf`, and `isf` + + [`scipy.stats.exponweib`](../reference/generated/scipy.stats.exponweib.html#scipy.stats.exponweib "scipy.stats.exponweib") `sf` and `isf` + + [`scipy.stats.f`](../reference/generated/scipy.stats.f.html#scipy.stats.f "scipy.stats.f") `entropy` + + [`scipy.stats.foldcauchy`](../reference/generated/scipy.stats.foldcauchy.html#scipy.stats.foldcauchy "scipy.stats.foldcauchy") `sf` + + [`scipy.stats.foldnorm`](../reference/generated/scipy.stats.foldnorm.html#scipy.stats.foldnorm "scipy.stats.foldnorm") `cdf` and `sf` + + [`scipy.stats.gamma`](../reference/generated/scipy.stats.gamma.html#scipy.stats.gamma "scipy.stats.gamma") `entropy` + + [`scipy.stats.genexpon`](../reference/generated/scipy.stats.genexpon.html#scipy.stats.genexpon "scipy.stats.genexpon") `ppf`, `isf`, `rvs` + + [`scipy.stats.gengamma`](../reference/generated/scipy.stats.gengamma.html#scipy.stats.gengamma "scipy.stats.gengamma") `entropy` + + [`scipy.stats.geom`](../reference/generated/scipy.stats.geom.html#scipy.stats.geom "scipy.stats.geom") `entropy` + + [`scipy.stats.genlogistic`](../reference/generated/scipy.stats.genlogistic.html#scipy.stats.genlogistic "scipy.stats.genlogistic") `entropy`, `logcdf`, `sf`, `ppf`, + and `isf` + + [`scipy.stats.genhyperbolic`](../reference/generated/scipy.stats.genhyperbolic.html#scipy.stats.genhyperbolic "scipy.stats.genhyperbolic") `cdf` and `sf` + + [`scipy.stats.gibrat`](../reference/generated/scipy.stats.gibrat.html#scipy.stats.gibrat "scipy.stats.gibrat") `sf` and `isf` + + [`scipy.stats.gompertz`](../reference/generated/scipy.stats.gompertz.html#scipy.stats.gompertz "scipy.stats.gompertz") `entropy`, `sf`. and `isf` + + [`scipy.stats.halflogistic`](../reference/generated/scipy.stats.halflogistic.html#scipy.stats.halflogistic "scipy.stats.halflogistic") `sf`, and `isf` + + [`scipy.stats.halfcauchy`](../reference/generated/scipy.stats.halfcauchy.html#scipy.stats.halfcauchy "scipy.stats.halfcauchy") `sf` and `isf` + + [`scipy.stats.halfnorm`](../reference/generated/scipy.stats.halfnorm.html#scipy.stats.halfnorm "scipy.stats.halfnorm") `cdf`, `sf`, and `isf` + + [`scipy.stats.invgamma`](../reference/generated/scipy.stats.invgamma.html#scipy.stats.invgamma "scipy.stats.invgamma") `entropy` + + [`scipy.stats.invgauss`](../reference/generated/scipy.stats.invgauss.html#scipy.stats.invgauss "scipy.stats.invgauss") `entropy` + + [`scipy.stats.johnsonsb`](../reference/generated/scipy.stats.johnsonsb.html#scipy.stats.johnsonsb "scipy.stats.johnsonsb") `pdf`, `cdf`, `sf`, `ppf`, and `isf` + + [`scipy.stats.johnsonsu`](../reference/generated/scipy.stats.johnsonsu.html#scipy.stats.johnsonsu "scipy.stats.johnsonsu") `pdf`, `sf`, `isf`, and `stats` + + [`scipy.stats.lognorm`](../reference/generated/scipy.stats.lognorm.html#scipy.stats.lognorm "scipy.stats.lognorm") `fit` + + [`scipy.stats.loguniform`](../reference/generated/scipy.stats.loguniform.html#scipy.stats.loguniform "scipy.stats.loguniform") `entropy`, `logpdf`, `pdf`, `cdf`, `ppf`, + and `stats` + + [`scipy.stats.maxwell`](../reference/generated/scipy.stats.maxwell.html#scipy.stats.maxwell "scipy.stats.maxwell") `sf` and `isf` + + [`scipy.stats.nakagami`](../reference/generated/scipy.stats.nakagami.html#scipy.stats.nakagami "scipy.stats.nakagami") `entropy` + + [`scipy.stats.powerlaw`](../reference/generated/scipy.stats.powerlaw.html#scipy.stats.powerlaw "scipy.stats.powerlaw") `sf` + + [`scipy.stats.powerlognorm`](../reference/generated/scipy.stats.powerlognorm.html#scipy.stats.powerlognorm "scipy.stats.powerlognorm") `logpdf`, `logsf`, `sf`, and `isf` + + [`scipy.stats.powernorm`](../reference/generated/scipy.stats.powernorm.html#scipy.stats.powernorm "scipy.stats.powernorm") `sf` and `isf` + + [`scipy.stats.t`](../reference/generated/scipy.stats.t.html#scipy.stats.t "scipy.stats.t") `entropy`, `logpdf`, and `pdf` + + [`scipy.stats.truncexpon`](../reference/generated/scipy.stats.truncexpon.html#scipy.stats.truncexpon "scipy.stats.truncexpon") `sf`, and `isf` + + [`scipy.stats.truncnorm`](../reference/generated/scipy.stats.truncnorm.html#scipy.stats.truncnorm "scipy.stats.truncnorm") `entropy` + + [`scipy.stats.truncpareto`](../reference/generated/scipy.stats.truncpareto.html#scipy.stats.truncpareto "scipy.stats.truncpareto") `fit` + + [`scipy.stats.vonmises`](../reference/generated/scipy.stats.vonmises.html#scipy.stats.vonmises "scipy.stats.vonmises") `fit` +* [`scipy.stats.multivariate_t`](../reference/generated/scipy.stats.multivariate_t.html#scipy.stats.multivariate_t "scipy.stats.multivariate_t") now has `cdf` and `entropy` methods. +* [`scipy.stats.multivariate_normal`](../reference/generated/scipy.stats.multivariate_normal.html#scipy.stats.multivariate_normal "scipy.stats.multivariate_normal"), [`scipy.stats.matrix_normal`](../reference/generated/scipy.stats.matrix_normal.html#scipy.stats.matrix_normal "scipy.stats.matrix_normal"), and + [`scipy.stats.invwishart`](../reference/generated/scipy.stats.invwishart.html#scipy.stats.invwishart "scipy.stats.invwishart") now have an `entropy` method. + +#### [Other Improvements](#id19)[#](#other-improvements "Link to this heading") + +* [`scipy.stats.monte_carlo_test`](../reference/generated/scipy.stats.monte_carlo_test.html#scipy.stats.monte_carlo_test "scipy.stats.monte_carlo_test") now supports multi-sample statistics. +* [`scipy.stats.bootstrap`](../reference/generated/scipy.stats.bootstrap.html#scipy.stats.bootstrap "scipy.stats.bootstrap") can now produce one-sided confidence intervals. +* [`scipy.stats.rankdata`](../reference/generated/scipy.stats.rankdata.html#scipy.stats.rankdata "scipy.stats.rankdata") performance was improved for `method=ordinal` and + `method=dense`. +* [`scipy.stats.moment`](../reference/generated/scipy.stats.moment.html#scipy.stats.moment "scipy.stats.moment") now supports non-central moment calculation. +* [`scipy.stats.anderson`](../reference/generated/scipy.stats.anderson.html#scipy.stats.anderson "scipy.stats.anderson") now supports the `weibull_min` distribution. +* [`scipy.stats.sem`](../reference/generated/scipy.stats.sem.html#scipy.stats.sem "scipy.stats.sem") and [`scipy.stats.iqr`](../reference/generated/scipy.stats.iqr.html#scipy.stats.iqr "scipy.stats.iqr") now support `axis`, `nan_policy`, + and masked array input. + +## [Deprecated features](#id20)[#](#deprecated-features "Link to this heading") + +* Multi-Ellipsis sparse matrix indexing has been deprecated and will + be removed in SciPy 1.13. +* Several methods were deprecated for sparse arrays: `asfptype`, `getrow`, + `getcol`, `get_shape`, `getmaxprint`, `set_shape`, + `getnnz`, and `getformat`. Additionally, the `.A` and `.H` + attributes were deprecated. Sparse matrix types are not affected. +* The [`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") functions `tri`, `triu` & `tril` are deprecated and + will be removed in SciPy 1.13. Users are recommended to use the NumPy + versions of these functions with identical names. +* The [`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") functions `bspline`, `quadratic` & `cubic` are + deprecated and will be removed in SciPy 1.13. Users are recommended to use + [`scipy.interpolate.BSpline`](../reference/generated/scipy.interpolate.BSpline.html#scipy.interpolate.BSpline "scipy.interpolate.BSpline") instead. +* The `even` keyword of [`scipy.integrate.simpson`](../reference/generated/scipy.integrate.simpson.html#scipy.integrate.simpson "scipy.integrate.simpson") is deprecated and will be + removed in SciPy 1.13.0. Users should leave this as the default as this + gives improved accuracy compared to the other methods. +* Using `exact=True` when passing integers in a float array to `factorial` + is deprecated and will be removed in SciPy 1.13.0. +* float128 and object dtypes are deprecated for [`scipy.signal.medfilt`](../reference/generated/scipy.signal.medfilt.html#scipy.signal.medfilt "scipy.signal.medfilt") and + [`scipy.signal.order_filter`](../reference/generated/scipy.signal.order_filter.html#scipy.signal.order_filter "scipy.signal.order_filter") +* The functions `scipy.signal.{lsim2, impulse2, step2}` had long been + deprecated in documentation only. They now raise a DeprecationWarning and + will be removed in SciPy 1.13.0. +* Importing window functions directly from *scipy.window* has been soft + deprecated since SciPy 1.1.0. They now raise a `DeprecationWarning` and + will be removed in SciPy 1.13.0. Users should instead import them from + *scipy.signal.window* or use the convenience function + [`scipy.signal.get_window`](../reference/generated/scipy.signal.get_window.html#scipy.signal.get_window "scipy.signal.get_window"). + +## [Backwards incompatible changes](#id21)[#](#backwards-incompatible-changes "Link to this heading") + +* The default for the `legacy` keyword of [`scipy.special.comb`](../reference/generated/scipy.special.comb.html#scipy.special.comb "scipy.special.comb") has changed + from `True` to `False`, as announced since its introduction. + +## [Expired Deprecations](#id22)[#](#expired-deprecations "Link to this heading") + +There is an ongoing effort to follow through on long-standing deprecations. +The following previously deprecated features are affected: + +* The `n` keyword has been removed from [`scipy.stats.moment`](../reference/generated/scipy.stats.moment.html#scipy.stats.moment "scipy.stats.moment"). +* The `alpha` keyword has been removed from *scipy.stats.interval*. +* The misspelt `gilbrat` distribution has been removed (use + [`scipy.stats.gibrat`](../reference/generated/scipy.stats.gibrat.html#scipy.stats.gibrat "scipy.stats.gibrat")). +* The deprecated spelling of the `kulsinski` distance metric has been + removed (use *scipy.spatial.distance.kulczynski1*). +* The `vertices` keyword of *scipy.spatial.Delauney.qhull* has been removed + (use simplices). +* The `residual` property of [`scipy.sparse.csgraph.maximum_flow`](../reference/generated/scipy.sparse.csgraph.maximum_flow.html#scipy.sparse.csgraph.maximum_flow "scipy.sparse.csgraph.maximum_flow") has been + removed (use `flow`). +* The `extradoc` keyword of [`scipy.stats.rv_continuous`](../reference/generated/scipy.stats.rv_continuous.html#scipy.stats.rv_continuous "scipy.stats.rv_continuous"), + [`scipy.stats.rv_discrete`](../reference/generated/scipy.stats.rv_discrete.html#scipy.stats.rv_discrete "scipy.stats.rv_discrete") and *scipy.stats.rv\_sample* has been removed. +* The `sym_pos` keyword of [`scipy.linalg.solve`](../reference/generated/scipy.linalg.solve.html#scipy.linalg.solve "scipy.linalg.solve") has been removed. +* The [`scipy.optimize.minimize`](../reference/generated/scipy.optimize.minimize.html#scipy.optimize.minimize "scipy.optimize.minimize") function now raises an error for `x0` with + `x0.ndim > 1`. +* In [`scipy.stats.mode`](../reference/generated/scipy.stats.mode.html#scipy.stats.mode "scipy.stats.mode"), the default value of `keepdims` is now `False`, + and support for non-numeric input has been removed. +* The function [`scipy.signal.lsim`](../reference/generated/scipy.signal.lsim.html#scipy.signal.lsim "scipy.signal.lsim") does not support non-uniform time steps + anymore. + +## [Other changes](#id23)[#](#other-changes "Link to this heading") + +* Rewrote the source build docs and restructured the contributor guide. +* Improved support for cross-compiling with meson build system. +* MyST-NB notebook infrastructure has been added to our documentation. + +## [Authors](#id24)[#](#authors "Link to this heading") + +* h-vetinari (69) +* Oriol Abril-Pla (1) + +* Tom Adamczewski (1) + +* Anton Akhmerov (13) +* Andrey Akinshin (1) + +* alice (1) + +* Oren Amsalem (1) +* Ross Barnowski (13) +* Christoph Baumgarten (2) +* Dawson Beatty (1) + +* Doron Behar (1) + +* Peter Bell (1) +* John Belmonte (1) + +* boeleman (1) + +* Jack Borchanian (1) + +* Matt Borland (3) + +* Jake Bowhay (41) +* Larry Bradley (1) + +* Sienna Brent (1) + +* Matthew Brett (1) +* Evgeni Burovski (39) +* Matthias Bussonnier (2) +* Maria Cann (1) + +* Alfredo Carella (1) + +* CJ Carey (34) +* Hood Chatham (2) +* Anirudh Dagar (3) +* Alberto Defendi (1) + +* Pol del Aguila (1) + +* Hans Dembinski (1) +* Dennis (1) + +* Vinayak Dev (1) + +* Thomas Duvernay (1) +* DWesl (4) +* Stefan Endres (66) +* Evandro (1) + +* Tom Eversdijk (2) + +* Isuru Fernando (1) +* Franz Forstmayr (4) +* Joseph Fox-Rabinovitz (1) +* Stefano Frazzetto (1) + +* Neil Girdhar (1) +* Caden Gobat (1) + +* Ralf Gommers (153) +* GonVas (1) + +* Marco Gorelli (1) +* Brett Graham (2) + +* Matt Haberland (388) +* harshvardhan2707 (1) + +* Alex Herbert (1) + +* Guillaume Horel (1) +* Geert-Jan Huizing (1) + +* Jakob Jakobson (2) +* Julien Jerphanion (10) +* jyuv (2) +* Rajarshi Karmakar (1) + +* Ganesh Kathiresan (3) + +* Robert Kern (4) +* Andrew Knyazev (4) +* Sergey Koposov (1) +* Rishi Kulkarni (2) + +* Eric Larson (1) +* Zoufiné Lauer-Bare (2) + +* Antony Lee (3) +* Gregory R. Lee (8) +* Guillaume Lemaitre (2) + +* lilinjie (2) + +* Yannis Linardos (1) + +* Christian Lorentzen (5) +* Loïc Estève (1) +* Adam Lugowski (1) + +* Charlie Marsh (2) + +* Boris Martin (1) + +* Nicholas McKibben (11) +* Melissa Weber Mendonça (58) +* Michał Górny (1) + +* Jarrod Millman (5) +* Stefanie Molin (2) + +* Mark W. Mueller (1) + +* mustafacevik (1) + +* Takumasa N (1) + +* nboudrie (1) +* Andrew Nelson (112) +* Nico Schlömer (4) +* Lysandros Nikolaou (2) + +* Kyle Oman (1) +* OmarManzoor (2) + +* Simon Ott (1) + +* Geoffrey Oxberry (1) + +* Geoffrey M. Oxberry (2) + +* Sravya papaganti (1) + +* Tirth Patel (2) +* Ilhan Polat (32) +* Quentin Barthélemy (1) +* Matteo Raso (12) + +* Tyler Reddy (143) +* Lucas Roberts (1) +* Pamphile Roy (225) +* Jordan Rupprecht (1) + +* Atsushi Sakai (11) +* Omar Salman (7) + +* Leo Sandler (1) + +* Ujjwal Sarswat (3) + +* Saumya (1) + +* Daniel Schmitz (79) +* Henry Schreiner (2) + +* Dan Schult (8) + +* Eli Schwartz (6) +* Tomer Sery (2) + +* Scott Shambaugh (10) + +* Gagandeep Singh (1) +* Ethan Steinberg (6) + +* stepeos (2) + +* Albert Steppi (3) +* Strahinja Lukić (1) +* Kai Striega (4) +* suen-bit (1) + +* Tartopohm (2) +* Logan Thomas (2) + +* Jacopo Tissino (1) + +* Matus Valo (12) + +* Jacob Vanderplas (2) +* Christian Veenhuis (1) + +* Isaac Virshup (3) +* Stefan van der Walt (14) +* Warren Weckesser (63) +* windows-server-2003 (1) +* Levi John Wolf (3) +* Nobel Wong (1) + +* Benjamin Yeh (1) + +* Rory Yorke (1) +* Younes (2) + +* Zaikun ZHANG (1) + +* Alex Zverianskii (1) + + +A total of 134 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +## [Issues closed for 1.11.0](#id25)[#](#issues-closed-for-1-11-0 "Link to this heading") + +* [#1766](https://github.com/scipy/scipy/issues/1766): \_\_fitpack.h work array computations pretty much one big bug…. +* [#1953](https://github.com/scipy/scipy/issues/1953): use custom warnings instead of print statements (Trac #1428) +* [#3089](https://github.com/scipy/scipy/issues/3089): brentq, nan returns, and bounds +* [#4257](https://github.com/scipy/scipy/issues/4257): scipy.optimize.line\_search returns None +* [#4532](https://github.com/scipy/scipy/issues/4532): box constraint in scipy optimize cobyla +* [#5584](https://github.com/scipy/scipy/issues/5584): Suspected underflow issue with sign check in bisection method +* [#5618](https://github.com/scipy/scipy/issues/5618): Solution for low accuracy of simps with even number of points +* [#5899](https://github.com/scipy/scipy/issues/5899): minimize\_scalar – strange behaviour +* [#6414](https://github.com/scipy/scipy/issues/6414): scipy.stats Breit-Wigner distribution +* [#6842](https://github.com/scipy/scipy/issues/6842): Covariance matrix returned by ODR needs to be scaled by the residual… +* [#7306](https://github.com/scipy/scipy/issues/7306): any way of stopping optimization? +* [#7799](https://github.com/scipy/scipy/issues/7799): basinhopping result violates constraints +* [#8176](https://github.com/scipy/scipy/issues/8176): optimize.minimize should provide a way to return the cost function… +* [#8394](https://github.com/scipy/scipy/issues/8394): brentq returns solutions outside of the bounds +* [#8485](https://github.com/scipy/scipy/issues/8485): freqz() output for fifth order butterworth bandpass (low cut… +* [#8922](https://github.com/scipy/scipy/issues/8922): Bug in Solve\_ivp with BDF and Radau solvers and numpy arrays +* [#9061](https://github.com/scipy/scipy/issues/9061): Will a vectorized fun offer advantages for scipy.integrate.LSODA? +* [#9265](https://github.com/scipy/scipy/issues/9265): DOC: optimize.minimize: recipe for avoiding redundant work when… +* [#9412](https://github.com/scipy/scipy/issues/9412): Callback return value erroneously ignored in minimize +* [#9728](https://github.com/scipy/scipy/issues/9728): DOC: scipy.integrate.solve\_ivp +* [#9955](https://github.com/scipy/scipy/issues/9955): stats.mode nan\_policy=’omit’ unexpected behavior when data are… +* [#10050](https://github.com/scipy/scipy/issues/10050): [Bug] inconsistent canonical format for coo\_matrix +* [#10370](https://github.com/scipy/scipy/issues/10370): SciPy errors out expecting square matrix using for root-finding… +* [#10437](https://github.com/scipy/scipy/issues/10437): scipy.optimize.dual\_annealing always rejects non-improving state +* [#10554](https://github.com/scipy/scipy/issues/10554): ndimage.gaussian\_filter provide axis option +* [#10829](https://github.com/scipy/scipy/issues/10829): Extend Anderson Darling to cover Weibull distribution +* [#10853](https://github.com/scipy/scipy/issues/10853): ImportError: cannot import name spatial +* [#11052](https://github.com/scipy/scipy/issues/11052): optimize.dual\_annealing does not pass arguments to jacobian. +* [#11564](https://github.com/scipy/scipy/issues/11564): LinearOperator objects cannot be applied to sparse matrices +* [#11723](https://github.com/scipy/scipy/issues/11723): Monte Carlo methods for scipy.integrate +* [#11775](https://github.com/scipy/scipy/issues/11775): Multi xatol for Nedler-Mead algorithm +* [#11841](https://github.com/scipy/scipy/issues/11841): Ignore NaN with scipy.optimize.curve\_fit +* [#12114](https://github.com/scipy/scipy/issues/12114): scipy.optimize.shgo(): ‘args’ is incorrectly passed to constraint… +* [#12715](https://github.com/scipy/scipy/issues/12715): Why the covariance from curve\_fit depends so sharply on the overall… +* [#13122](https://github.com/scipy/scipy/issues/13122): The test suite fails on Python 3.10: issue with factorial() on… +* [#13258](https://github.com/scipy/scipy/issues/13258): \*\*kwargs for optimize.root\_scalar and alike +* [#13407](https://github.com/scipy/scipy/issues/13407): `if rtol < \_rtol / 4` should be changed? +* [#13535](https://github.com/scipy/scipy/issues/13535): Newton-iteration should not be done after secant interpolation +* [#13547](https://github.com/scipy/scipy/issues/13547): optimize.shgo: handle objective functions that return the gradient… +* [#13554](https://github.com/scipy/scipy/issues/13554): The correct root for test APS13 is 0 +* [#13757](https://github.com/scipy/scipy/issues/13757): API for representing censored data +* [#13974](https://github.com/scipy/scipy/issues/13974): BUG: optimize.shgo: not using options +* [#14059](https://github.com/scipy/scipy/issues/14059): Bound on absolute tolerance ‘xtol’ in ‘optimize/zeros.py’ is… +* [#14262](https://github.com/scipy/scipy/issues/14262): cython\_blas does not use const in signatures +* [#14414](https://github.com/scipy/scipy/issues/14414): brentq does converge and not raise an error for np.nan functions +* [#14486](https://github.com/scipy/scipy/issues/14486): One bug, one mistake and one refactorization proposal for the… +* [#14519](https://github.com/scipy/scipy/issues/14519): scipy/stats/tests/test\_continuous\_basic.py::test\_cont\_basic[500-200-ncf-arg74] test fails with IntegrationWarning +* [#14525](https://github.com/scipy/scipy/issues/14525): scipy.signal.bspline does not work for integer types +* [#14858](https://github.com/scipy/scipy/issues/14858): BUG: scipy.optimize.bracket sometimes fails silently +* [#14901](https://github.com/scipy/scipy/issues/14901): BUG: stats: distribution methods emit unnecessary warnings from… +* [#15089](https://github.com/scipy/scipy/issues/15089): BUG: scipy.optimize.minimize() does not report lowest energy… +* [#15136](https://github.com/scipy/scipy/issues/15136): ENH: Bump boost.math version +* [#15177](https://github.com/scipy/scipy/issues/15177): BUG: element-wise division between sparse matrices and array-likes… +* [#15212](https://github.com/scipy/scipy/issues/15212): BUG: stange behavior of scipy.integrate.quad for divergent integrals +* [#15514](https://github.com/scipy/scipy/issues/15514): BUG: optimize.shgo: error with vector constraints +* [#15600](https://github.com/scipy/scipy/issues/15600): BUG: handle inconsistencies in factorial functions and their… +* [#15613](https://github.com/scipy/scipy/issues/15613): ENH: Provide functions to compute log-integrals numerically (e.g.,… +* [#15702](https://github.com/scipy/scipy/issues/15702): MAINT:linalg: Either silent import NumPy versions or deprecate… +* [#15706](https://github.com/scipy/scipy/issues/15706): DEP: remove deprecated parameters from stats distributions +* [#15755](https://github.com/scipy/scipy/issues/15755): DEP: absorb lsim2 into lsim +* [#15756](https://github.com/scipy/scipy/issues/15756): DEP: remove non-numeric array support in stats.mode +* [#15790](https://github.com/scipy/scipy/issues/15790): BUG: `isspmatrix` doesn’t account for sparse arrays +* [#15808](https://github.com/scipy/scipy/issues/15808): DEP: raise on >1-dim inputs for optimize.minimize +* [#15814](https://github.com/scipy/scipy/issues/15814): CI: move Azure jobs to GitHub Actions +* [#15818](https://github.com/scipy/scipy/issues/15818): DEP: remove extradoc keyword in \_distn\_infrastructure +* [#15829](https://github.com/scipy/scipy/issues/15829): DEP: remove sym\_pos-keyword of scipy.linalg.solve +* [#15852](https://github.com/scipy/scipy/issues/15852): DOC: helper function to seed examples +* [#15906](https://github.com/scipy/scipy/issues/15906): Missing degree of freedom parameter in return value from `stats.ttest\_ind` +* [#15985](https://github.com/scipy/scipy/issues/15985): ENH, DOC: Add section explaining why and when to use a custom… +* [#15988](https://github.com/scipy/scipy/issues/15988): DEP: remove deprecated gilbrat distribution +* [#16014](https://github.com/scipy/scipy/issues/16014): DEP: remove MaximumFlowResult.residual +* [#16068](https://github.com/scipy/scipy/issues/16068): BUG: Missing Constant in Documentation +* [#16079](https://github.com/scipy/scipy/issues/16079): BUG: hypergeom.cdf slower in 1.8.0 than 1.7.3 +* [#16196](https://github.com/scipy/scipy/issues/16196): BUG: OptimizeResult from optimize.minimize\_scalar changes ‘x’… +* [#16269](https://github.com/scipy/scipy/issues/16269): DEP: remove `maxiter` kwarg in `\_minimize\_tnc` +* [#16270](https://github.com/scipy/scipy/issues/16270): DEP: remove `vertices` kwarg in qhull +* [#16271](https://github.com/scipy/scipy/issues/16271): DEP: remove `scipy.spatial.distance.kulsinski` +* [#16312](https://github.com/scipy/scipy/issues/16312): Meson complains about an absolute include path +* [#16322](https://github.com/scipy/scipy/issues/16322): DOC: building on Windows uses GCC with Meson, not MSVC +* [#16595](https://github.com/scipy/scipy/issues/16595): BUG: stats.mode emits annoying RuntimeWarning about nans even… +* [#16734](https://github.com/scipy/scipy/issues/16734): BUG: function p1evl in povevl.h not making what’s described +* [#16803](https://github.com/scipy/scipy/issues/16803): Update `scipy/\_\_config\_\_.py` to contain useful information +* [#16810](https://github.com/scipy/scipy/issues/16810): ENH: implement Dirichlet-multinomial distribution +* [#16917](https://github.com/scipy/scipy/issues/16917): BUG: Windows Built SciPy can’t import \_fblas via pip install… +* [#16929](https://github.com/scipy/scipy/issues/16929): BUG: `scipy.sparse.csc\_matrix.argmin` returns wrong values +* [#16949](https://github.com/scipy/scipy/issues/16949): Test failures for `gges` and `qz` for float32 input in macOS… +* [#16971](https://github.com/scipy/scipy/issues/16971): BUG: [issue in scipy.optimize.shgo, for COBYLA’s minimizer\_kwargs… +* [#16998](https://github.com/scipy/scipy/issues/16998): Unpickled and deepcopied distributions do not use global random… +* [#17024](https://github.com/scipy/scipy/issues/17024): ENH: Force real part of Rotation.as\_quat() to be positive. +* [#17107](https://github.com/scipy/scipy/issues/17107): BUG: The signature of cKDTree.query\_pairs in the docs does not… +* [#17137](https://github.com/scipy/scipy/issues/17137): BUG: optimize: Intermittent failure of `test\_milp\_timeout\_16545` +* [#17146](https://github.com/scipy/scipy/issues/17146): BUG: Scipy stats probability greater than 1 +* [#17214](https://github.com/scipy/scipy/issues/17214): BUG: scipy.stats.mode: inconsistent shape with `axis=None`… +* [#17234](https://github.com/scipy/scipy/issues/17234): BUG: cythonization / compliation failure with development branch… +* [#17250](https://github.com/scipy/scipy/issues/17250): ENH: Expose parallel HiGHS solvers in high-level API +* [#17281](https://github.com/scipy/scipy/issues/17281): BUG: using LinearOperator as RHS operand of @ causes a NumPy… +* [#17285](https://github.com/scipy/scipy/issues/17285): ENH: Expose DisjointSet.\_sizes +* [#17312](https://github.com/scipy/scipy/issues/17312): ENH: Clarify that ndimage.find\_objects returns slices ordered… +* [#17335](https://github.com/scipy/scipy/issues/17335): ENH: change term zero to root in newton +* [#17368](https://github.com/scipy/scipy/issues/17368): BUG: import scipy.stats fails under valgrind +* [#17378](https://github.com/scipy/scipy/issues/17378): griddata linear / LinearNDInterpolator unexpected behavior +* [#17381](https://github.com/scipy/scipy/issues/17381): BUG: FutureWarning in distance\_transform\_cdt +* [#17388](https://github.com/scipy/scipy/issues/17388): BUG: stats.binom: Boost binomial distribution edge case bug? +* [#17403](https://github.com/scipy/scipy/issues/17403): DOC: There is no general `scipy.sparse` page in the user guide +* [#17431](https://github.com/scipy/scipy/issues/17431): ENH: ECDF in scipy. +* [#17456](https://github.com/scipy/scipy/issues/17456): ENH: custom stopping criteria with auxiliary function +* [#17516](https://github.com/scipy/scipy/issues/17516): BUG: Error in documentation for scipy.optimize.minimize +* [#17532](https://github.com/scipy/scipy/issues/17532): DOC: side bar renders over the top of some of the text in the… +* [#17548](https://github.com/scipy/scipy/issues/17548): CI: The Ubuntu 18.04 Actions runner image is deprecated +* [#17570](https://github.com/scipy/scipy/issues/17570): ENH: optimize.root\_scalar: default to `newton` when only `x0`… +* [#17576](https://github.com/scipy/scipy/issues/17576): ENH: override fit method for von mises +* [#17593](https://github.com/scipy/scipy/issues/17593): BUG: cannot import name ‘permutation\_test’ from ‘scipy.stats’ +* [#17604](https://github.com/scipy/scipy/issues/17604): DOC: optimize.curve\_fit: documentation of `fvec` is not specific +* [#17620](https://github.com/scipy/scipy/issues/17620): ENH: Cachable normalisation parameter for frozen distributions +* [#17631](https://github.com/scipy/scipy/issues/17631): BUG: numerical issues for cdf/ppf of the betaprime distribution +* [#17639](https://github.com/scipy/scipy/issues/17639): BUG: “xl” not returned if success = False for scipy.optimize.shgo +* [#17652](https://github.com/scipy/scipy/issues/17652): Check for non-running tests because of test function name and… +* [#17667](https://github.com/scipy/scipy/issues/17667): BUG: Wrong p-values with Wilcoxon signed-rank test because of… +* [#17683](https://github.com/scipy/scipy/issues/17683): TST: stats: Several functions with no tests in `stats.mstats` +* [#17713](https://github.com/scipy/scipy/issues/17713): BUG: `\_axis\_nan\_policy` changes some common `TypeError`s +* [#17725](https://github.com/scipy/scipy/issues/17725): BUG: spatial: Bad error message from `hamming` when `w` has… +* [#17749](https://github.com/scipy/scipy/issues/17749): ENH: Compute non centraled moments with `stats.moment`? +* [#17754](https://github.com/scipy/scipy/issues/17754): Cosine distance of vector to self returns small non-zero answer… +* [#17776](https://github.com/scipy/scipy/issues/17776): BUG: dblquad and args kwarg +* [#17788](https://github.com/scipy/scipy/issues/17788): ENH: Scipy Optimize, equal Bounds should be directly passed to… +* [#17805](https://github.com/scipy/scipy/issues/17805): BUG: stats: dgamma.sf and dgamma.cdf lose precision in the tails +* [#17809](https://github.com/scipy/scipy/issues/17809): BUG: CDF and PMF of binomial function not same with extreme values +* [#17815](https://github.com/scipy/scipy/issues/17815): DOC: improve documentation for distance\_transform\_{cdt,edt} +* [#17819](https://github.com/scipy/scipy/issues/17819): BUG: `stats.ttest\_ind\_from\_stats` doesn’t check whether standard… +* [#17828](https://github.com/scipy/scipy/issues/17828): DOC: UnivariateSpline does not have any documentation or a reference. +* [#17845](https://github.com/scipy/scipy/issues/17845): BUG: 1.10.0 FIR Decimation is broken when supplying ftype as… +* [#17846](https://github.com/scipy/scipy/issues/17846): BUG: Infinite loop in scipy.integrate.solve\_ivp() +* [#17860](https://github.com/scipy/scipy/issues/17860): DOC: Incorrect link to ARPACK +* [#17866](https://github.com/scipy/scipy/issues/17866): DOC: Should `Result Classes` be its own top level section? +* [#17911](https://github.com/scipy/scipy/issues/17911): DOC: Formula of Tustin formula in scipy.signal.bilinear misses… +* [#17913](https://github.com/scipy/scipy/issues/17913): Unexpected behaviour of pearsonr pvalue for one sided tests +* [#17916](https://github.com/scipy/scipy/issues/17916): BUG: scipy 1.10.0 crashes when using a large float in skellam… +* [#17941](https://github.com/scipy/scipy/issues/17941): DOC: guidance on setting dev.py build -j flag in documentation,… +* [#17954](https://github.com/scipy/scipy/issues/17954): BUG: failure in lobpcg +* [#17970](https://github.com/scipy/scipy/issues/17970): BUG: ILP64 build issue on Python 3.11 +* [#17985](https://github.com/scipy/scipy/issues/17985): DOC: update wheel generation process +* [#17992](https://github.com/scipy/scipy/issues/17992): BUG: matlab files with deeply lists of arrays with different… +* [#17999](https://github.com/scipy/scipy/issues/17999): DOC: incorrect example for stats.cramervonmises +* [#18026](https://github.com/scipy/scipy/issues/18026): BUG: stats: Error from e.g. `stats.betabinom.stats(10, 2, 3,… +* [#18067](https://github.com/scipy/scipy/issues/18067): ENH: stats: resampling/Monte Carlo configuration object +* [#18069](https://github.com/scipy/scipy/issues/18069): ENH: stats.ttest\_ind is inconsistent with R. It does not allow… +* [#18071](https://github.com/scipy/scipy/issues/18071): BUG: rv\_continuous.stats fails to converge when trying to estimate… +* [#18074](https://github.com/scipy/scipy/issues/18074): BUG: wrong dependencies for pooch +* [#18078](https://github.com/scipy/scipy/issues/18078): BUG: `QMCEngine.reset()` semantics and passed `Generator`… +* [#18079](https://github.com/scipy/scipy/issues/18079): BUG: `Halton(seed=rng)` does not consume `Generator` PRNG… +* [#18106](https://github.com/scipy/scipy/issues/18106): BUG: Linprog reports failure despite success convergence, given… +* [#18115](https://github.com/scipy/scipy/issues/18115): BUG: ValueError: setting an array element with a sequence for… +* [#18117](https://github.com/scipy/scipy/issues/18117): BUG: stats: large errors in genhyperbolic.cdf and .sf for large… +* [#18119](https://github.com/scipy/scipy/issues/18119): DOC: The comment about `fmin\_powell` is wrong +* [#18123](https://github.com/scipy/scipy/issues/18123): BUG: [mmread] Error while reading mtx file with spaces before… +* [#18132](https://github.com/scipy/scipy/issues/18132): BUG: invalid output and behavior of scipy.stats.somersd +* [#18139](https://github.com/scipy/scipy/issues/18139): BUG: Overflow in ‘new’ implementation of scipy.stats.kendalltau +* [#18143](https://github.com/scipy/scipy/issues/18143): Building from source on Windows 32-bit Python did not succeed +* [#18171](https://github.com/scipy/scipy/issues/18171): BUG: optimize.root\_scalar: should return normally with `converged=False`… +* [#18223](https://github.com/scipy/scipy/issues/18223): BUG: cKDTree segmentation faults when NaN input and balanced\_tree=False,… +* [#18226](https://github.com/scipy/scipy/issues/18226): ENH: stats.geometric.entropy: implement analytical formula +* [#18239](https://github.com/scipy/scipy/issues/18239): DOC: linking to custom BLAS/LAPACK locations is not clear +* [#18254](https://github.com/scipy/scipy/issues/18254): BUG: stats.mode: failure with array of Pandas integers +* [#18271](https://github.com/scipy/scipy/issues/18271): Broken or wrong formulas on distance definition +* [#18272](https://github.com/scipy/scipy/issues/18272): BUG: stats: occasional failure of `test\_multivariate.TestOrthoGroup.test\_det\_and\_ortho` +* [#18274](https://github.com/scipy/scipy/issues/18274): BUG: stats: Spurious warnings from `betaprime.fit` +* [#18282](https://github.com/scipy/scipy/issues/18282): Incompatible pointer warning from `stats.\_rcond` +* [#18302](https://github.com/scipy/scipy/issues/18302): BUG: beta.pdf is broken on main (1.11.0.dev0) +* [#18322](https://github.com/scipy/scipy/issues/18322): BUG: scipy.stats.shapiro gives a negative pvalue +* [#18326](https://github.com/scipy/scipy/issues/18326): ENH: milp supporting sparse inputs +* [#18329](https://github.com/scipy/scipy/issues/18329): BUG: meson generates `warning: “MS\_WIN64” redefined` when building… +* [#18368](https://github.com/scipy/scipy/issues/18368): DOC: Issue in scipy.stats.chisquare +* [#18377](https://github.com/scipy/scipy/issues/18377): BUG: `const` signature changes in `cython\_blas` and `cython\_lapack`… +* [#18388](https://github.com/scipy/scipy/issues/18388): Question about usage of \_MACHEPS +* [#18407](https://github.com/scipy/scipy/issues/18407): CI: test\_enzo\_example\_c\_with\_unboundedness started failing +* [#18415](https://github.com/scipy/scipy/issues/18415): BUG: Windows compilation error with Intel Fortran in PROPACK +* [#18425](https://github.com/scipy/scipy/issues/18425): DOC: clarify that scipy.ndimage.sobel does not compute the 2D… +* [#18443](https://github.com/scipy/scipy/issues/18443): BLD: errors when building SciPy on Windows with Meson +* [#18456](https://github.com/scipy/scipy/issues/18456): ENH: Allow passing non-varying arguments for the model function… +* [#18484](https://github.com/scipy/scipy/issues/18484): DEP: Warn on deprecated windows-import in base `scipy.signal`… +* [#18485](https://github.com/scipy/scipy/issues/18485): DEP: deprecate multiple-ellipsis handling in sparse matrix indexing +* [#18494](https://github.com/scipy/scipy/issues/18494): CI: occasional failure of `test\_minimum\_spanning\_tree` +* [#18497](https://github.com/scipy/scipy/issues/18497): MAINT, BUG: guard against non-finite kd-tree queries +* [#18498](https://github.com/scipy/scipy/issues/18498): TST: interpolate overflow xslow tests (low priority) +* [#18525](https://github.com/scipy/scipy/issues/18525): DOC: sparse doc build warning causing failure (including in CI) +* [#18535](https://github.com/scipy/scipy/issues/18535): DOC: Dev branch docs render Dev TOC while viewing API Reference +* [#18547](https://github.com/scipy/scipy/issues/18547): CI: occasionally failing test `test\_minimize\_callback\_copies\_array[fmin]` +* [#18595](https://github.com/scipy/scipy/issues/18595): BUG: dev.py notes needs a small shim +* [#18597](https://github.com/scipy/scipy/issues/18597): CI, BUG: Cirrus wheel upload fails on maintenance branch +* [#18600](https://github.com/scipy/scipy/issues/18600): BUG: SciPy 1.11.0rc1 not buildable on PPC due to boost submodule +* [#18632](https://github.com/scipy/scipy/issues/18632): 1.11.0rc1: remaining test failures in conda-forge +* [#18634](https://github.com/scipy/scipy/issues/18634): BUG: stats.truncnorm.moments yields error for moment order greater… +* [#18654](https://github.com/scipy/scipy/issues/18654): BUG: ci/circleci: build\_scipy broken +* [#18675](https://github.com/scipy/scipy/issues/18675): BUG: `signal.detrend` on main no longer accepts a sequence… +* [#18732](https://github.com/scipy/scipy/issues/18732): TST, MAINT: some tests blocking 1.11.0 on MacOS ARM64 with NumPy… + +## [Pull requests for 1.11.0](#id26)[#](#pull-requests-for-1-11-0 "Link to this heading") + +* [#8727](https://github.com/scipy/scipy/pull/8727): BUG: vq.kmeans() compares signed diff to a threshold. +* [#12787](https://github.com/scipy/scipy/pull/12787): ENH: add anderson darling test for weibull #10829 +* [#13699](https://github.com/scipy/scipy/pull/13699): ENH: stats: Add handling of censored data to univariate cont…. +* [#14069](https://github.com/scipy/scipy/pull/14069): Use warnings instead of print statements +* [#15073](https://github.com/scipy/scipy/pull/15073): TST/MAINT: Parametrize `\_METRICS\_NAMES` & replace `assert\_raises`… +* [#15841](https://github.com/scipy/scipy/pull/15841): Overhaul `factorial{,2,k}`: API coherence, bug fixes & consistent… +* [#15873](https://github.com/scipy/scipy/pull/15873): DEP: remove sym\_pos argument from linalg.solve +* [#15877](https://github.com/scipy/scipy/pull/15877): DEP: remove extradoc in \_distn\_infrastructure +* [#15929](https://github.com/scipy/scipy/pull/15929): DEP: `lsim2` deprecated in favor of `lsim` +* [#15958](https://github.com/scipy/scipy/pull/15958): CI: move `prerelease\_deps\_coverage\_64bit\_blas` to GitHub actions. +* [#16071](https://github.com/scipy/scipy/pull/16071): ENH: Add missing “characteristic impedance of vacuum” +* [#16313](https://github.com/scipy/scipy/pull/16313): MAINT: Update optimize.shgo +* [#16782](https://github.com/scipy/scipy/pull/16782): ENH: stats: optimised fit for the truncated Pareto distribution +* [#16839](https://github.com/scipy/scipy/pull/16839): ENH: stats: optimised MLE for the lognormal distribution +* [#16936](https://github.com/scipy/scipy/pull/16936): BUG: sparse: fix argmin/argmax when all entries are nonzero +* [#16961](https://github.com/scipy/scipy/pull/16961): ENH: optimize: Add `nan\_policy` optional argument for `curve\_fit`. +* [#16996](https://github.com/scipy/scipy/pull/16996): ENH: stats.anderson\_ksamp: add permutation version of test +* [#17116](https://github.com/scipy/scipy/pull/17116): MAINT: Adjust Pull-Request labeler configuration +* [#17208](https://github.com/scipy/scipy/pull/17208): DOC: Add triage guide +* [#17211](https://github.com/scipy/scipy/pull/17211): ENH: Implemented Dirichlet-multinomial distribution (#16810) +* [#17212](https://github.com/scipy/scipy/pull/17212): Guard against integer overflows in fitpackmodule.c +* [#17235](https://github.com/scipy/scipy/pull/17235): MAINT: pass check\_finite to the vq() call of kmeans2() +* [#17267](https://github.com/scipy/scipy/pull/17267): DOC/MAINT: special: Several updates for tklmbda +* [#17268](https://github.com/scipy/scipy/pull/17268): DOC: special: Show that lambertw can solve x = a + b\*exp(c\*x) +* [#17287](https://github.com/scipy/scipy/pull/17287): DOC: Clarify minimum\_spanning\_tree behavior in non-connected… +* [#17310](https://github.com/scipy/scipy/pull/17310): DOC: missing-bits: document recommendations on return object… +* [#17322](https://github.com/scipy/scipy/pull/17322): DOC: Add notebook infrastructure for the docs +* [#17326](https://github.com/scipy/scipy/pull/17326): ENH: Clarify the index of element corresponding to a label in… +* [#17334](https://github.com/scipy/scipy/pull/17334): ENH: Map the rotation quaternion double cover of rotation space… +* [#17402](https://github.com/scipy/scipy/pull/17402): ENH: stats: add false discovery rate control function +* [#17410](https://github.com/scipy/scipy/pull/17410): ENH: stats.multivariate\_t: add cdf method +* [#17432](https://github.com/scipy/scipy/pull/17432): BLD: Boost.Math standalone submodule +* [#17451](https://github.com/scipy/scipy/pull/17451): DEP: Remove `vertices` in qhull. +* [#17455](https://github.com/scipy/scipy/pull/17455): Deprecate scipy.signal.{bspline, quadratic, cubic} +* [#17479](https://github.com/scipy/scipy/pull/17479): ENH: Add new SI prefixes +* [#17480](https://github.com/scipy/scipy/pull/17480): ENH: stats: Implement \_sf and \_isf for halfnorm, gibrat, gompertz. +* [#17483](https://github.com/scipy/scipy/pull/17483): MAINT: optimize.basinhopping: fix acceptance of failed local… +* [#17486](https://github.com/scipy/scipy/pull/17486): ENH: optimize.minimize: callback enhancements +* [#17499](https://github.com/scipy/scipy/pull/17499): MAINT: remove use of `NPY\_UPDATEIFCOPY` +* [#17505](https://github.com/scipy/scipy/pull/17505): ENH: Add relativistic Breit-Wigner Distribution +* [#17529](https://github.com/scipy/scipy/pull/17529): ENH: stats: Implement powerlaw.\_sf +* [#17531](https://github.com/scipy/scipy/pull/17531): TST: scipy.signal.order\_filter: add test coverage +* [#17535](https://github.com/scipy/scipy/pull/17535): MAINT: special: Improve comments about Cephes p1evl function. +* [#17538](https://github.com/scipy/scipy/pull/17538): ENH: Extending \_distance\_pybind with additional distance metrics… +* [#17541](https://github.com/scipy/scipy/pull/17541): REL: set version to 1.11.0.dev0 +* [#17553](https://github.com/scipy/scipy/pull/17553): DOC: optimize.curve\_fit: add note about `pcov` condition number +* [#17555](https://github.com/scipy/scipy/pull/17555): DEP: stats: removal of kwargs n in stats.moment and alpha in… +* [#17556](https://github.com/scipy/scipy/pull/17556): DEV: bump flake8 version used in CI job +* [#17557](https://github.com/scipy/scipy/pull/17557): MAINT: bump Ubuntu version in Azure CI +* [#17561](https://github.com/scipy/scipy/pull/17561): MAINT: stats.mode: remove deprecated features, smooth edges +* [#17562](https://github.com/scipy/scipy/pull/17562): ENH: stats: Implement \_ppf for the betaprime distribution. +* [#17563](https://github.com/scipy/scipy/pull/17563): DEP: stats: remove misspelt gilbrat distribution +* [#17566](https://github.com/scipy/scipy/pull/17566): DOC: correct, update, and extend `lobpcg` docstring info and… +* [#17567](https://github.com/scipy/scipy/pull/17567): MAINT: Update gitpod setup +* [#17573](https://github.com/scipy/scipy/pull/17573): DOC: Update testing documentation to dev.py +* [#17574](https://github.com/scipy/scipy/pull/17574): MAINT: clean up `NPY\_OLD` usage in Cython code and build files +* [#17581](https://github.com/scipy/scipy/pull/17581): DOC fix trivial typo in description of loggamma in \_add\_newdocs.py +* [#17585](https://github.com/scipy/scipy/pull/17585): ENH: Von Mises distribution fit +* [#17587](https://github.com/scipy/scipy/pull/17587): BUG: stats: Avoid overflow/underflow issues in loggamma \_cdf,… +* [#17589](https://github.com/scipy/scipy/pull/17589): BUG: FutureWarning in distance\_transform\_cdt +* [#17590](https://github.com/scipy/scipy/pull/17590): DEP: raise on >1-dim inputs for optimize.minimize +* [#17595](https://github.com/scipy/scipy/pull/17595): DOC: optimize.line\_search: note that `pk` must be a descent… +* [#17597](https://github.com/scipy/scipy/pull/17597): DOC: Add Legacy directive +* [#17603](https://github.com/scipy/scipy/pull/17603): DEP: remove spatial.distance.kulsinski +* [#17605](https://github.com/scipy/scipy/pull/17605): DOC: example of epidemic model with LHS +* [#17608](https://github.com/scipy/scipy/pull/17608): DOC: curve\_fit - clarify fvec output +* [#17610](https://github.com/scipy/scipy/pull/17610): DOC: add example to chi2\_contingency +* [#17613](https://github.com/scipy/scipy/pull/17613): DOC: curve\_fit, include sigma +* [#17615](https://github.com/scipy/scipy/pull/17615): MAINT: scipy.optimize.root: fix error when both args and jac… +* [#17616](https://github.com/scipy/scipy/pull/17616): MAINT: optimize.minimize: enhance `callback` for remaining… +* [#17617](https://github.com/scipy/scipy/pull/17617): DEP: remove MaximumFlowResult.residual +* [#17618](https://github.com/scipy/scipy/pull/17618): DOC: fix unicode in qmc example +* [#17622](https://github.com/scipy/scipy/pull/17622): MAINT: optimize.root\_scalar: raise when NaN is encountered +* [#17624](https://github.com/scipy/scipy/pull/17624): ENH: add von Mises-Fisher distribution +* [#17625](https://github.com/scipy/scipy/pull/17625): DOC: Examples for special functions related to the student t… +* [#17626](https://github.com/scipy/scipy/pull/17626): DOC: improve docstrings of exp. scaled Bessel functions +* [#17628](https://github.com/scipy/scipy/pull/17628): ENH: add Sobol’ indices +* [#17629](https://github.com/scipy/scipy/pull/17629): DOC: stats: example treatment odd\_ratio +* [#17637](https://github.com/scipy/scipy/pull/17637): DEP: switch default of special.comb to legacy=False +* [#17643](https://github.com/scipy/scipy/pull/17643): TST: interpolate/rgi: Add tests for descending ordered points +* [#17649](https://github.com/scipy/scipy/pull/17649): fix documentation lines +* [#17651](https://github.com/scipy/scipy/pull/17651): Update \_svds.py removing no longer necessary QR for LOBPCG output +* [#17654](https://github.com/scipy/scipy/pull/17654): MAINT:interpolate:Add .c file to .gitignore +* [#17655](https://github.com/scipy/scipy/pull/17655): DEV: add check for misnamed tests +* [#17657](https://github.com/scipy/scipy/pull/17657): DEV: streamline OpenBLAS handling on Win machine +* [#17660](https://github.com/scipy/scipy/pull/17660): MAINT: optimize.newton: converged=False when secant has zero… +* [#17663](https://github.com/scipy/scipy/pull/17663): DOC: optimize.curve\_fit: example output may vary +* [#17664](https://github.com/scipy/scipy/pull/17664): MAINT: optimize.root\_scalar: fix underflow sign check bug +* [#17665](https://github.com/scipy/scipy/pull/17665): DOC: mention inaccuracy of curve\_fit result `pcov` +* [#17666](https://github.com/scipy/scipy/pull/17666): DOC: optimize.root\_scalar: harmonize documentation and implementation… +* [#17668](https://github.com/scipy/scipy/pull/17668): ENH: stats.loguniform: reformulate methods to avoid overflow +* [#17669](https://github.com/scipy/scipy/pull/17669): MAINT: optimize.newton: avoid error with complex `x0` +* [#17674](https://github.com/scipy/scipy/pull/17674): DOC: optimize: add tutorial example of passing kwargs to callable +* [#17675](https://github.com/scipy/scipy/pull/17675): ENH: update lobpcg.py +* [#17676](https://github.com/scipy/scipy/pull/17676): BUG: correctly handle array-like types in scipy.io.savemat +* [#17678](https://github.com/scipy/scipy/pull/17678): DOC: optimize: show how memoization avoids duplicating work +* [#17679](https://github.com/scipy/scipy/pull/17679): ENH: optimize.minimize: add bound constraints to COBYLA +* [#17680](https://github.com/scipy/scipy/pull/17680): DOC: examples for special functions related to neg. binomial… +* [#17682](https://github.com/scipy/scipy/pull/17682): DOC: add real example for `stats.chisquare` +* [#17684](https://github.com/scipy/scipy/pull/17684): ENH: support `Bounds` class in lsq\_linear +* [#17685](https://github.com/scipy/scipy/pull/17685): ENH: stats: Implement \_sf for the foldnorm distribution. +* [#17687](https://github.com/scipy/scipy/pull/17687): MAINT: optimize.toms748: correct “rtol too small” message +* [#17688](https://github.com/scipy/scipy/pull/17688): MAINT: optimize.curve\_fit: memoize `f` and `jac` +* [#17691](https://github.com/scipy/scipy/pull/17691): ENH: optimize.root\_scalar: allow newton without f’, secant without… +* [#17692](https://github.com/scipy/scipy/pull/17692): MAINT: optimize.minimize\_scalar: enforce output shape consistency +* [#17693](https://github.com/scipy/scipy/pull/17693): DOC: pointbiserialr correlation formula notation fix. +* [#17694](https://github.com/scipy/scipy/pull/17694): ENH: stats: Implement \_sf and \_isf for halfcauchy; \_sf for foldcauchy +* [#17698](https://github.com/scipy/scipy/pull/17698): MAINT: implicit float conversion in rgi test +* [#17700](https://github.com/scipy/scipy/pull/17700): ENH: Inverse wishart entropy +* [#17701](https://github.com/scipy/scipy/pull/17701): DOC: stats: Fix a reference for the genexpon distribution. +* [#17702](https://github.com/scipy/scipy/pull/17702): DOC: stats: complete references and links for descriptive stats +* [#17704](https://github.com/scipy/scipy/pull/17704): MAINT: optimize.bracket: don’t fail silently +* [#17705](https://github.com/scipy/scipy/pull/17705): DOC: optimize.minimize\_scalar and friends: correct documentation… +* [#17707](https://github.com/scipy/scipy/pull/17707): DOC: add acetazolamide example to `stats.fisher\_exact` +* [#17708](https://github.com/scipy/scipy/pull/17708): ENH: stats: Implement \_ppf and \_isf for genexpon. +* [#17709](https://github.com/scipy/scipy/pull/17709): MAINT: update copyright date +* [#17711](https://github.com/scipy/scipy/pull/17711): MAINT: forward port 1.10.0 relnotes +* [#17714](https://github.com/scipy/scipy/pull/17714): ENH: Provide public API for fast DisjointSet subset size. +* [#17724](https://github.com/scipy/scipy/pull/17724): DOC: spatial: Several updates: +* [#17729](https://github.com/scipy/scipy/pull/17729): STY: fix unicode error +* [#17730](https://github.com/scipy/scipy/pull/17730): MAINT: rotate CircleCI ssh key +* [#17732](https://github.com/scipy/scipy/pull/17732): MAINT: optimize.toms748: don’t do newton after secant interpolation +* [#17742](https://github.com/scipy/scipy/pull/17742): ENH: override \_entropy for beta, chi and chi2 distributions +* [#17747](https://github.com/scipy/scipy/pull/17747): DOC: stats.jarque\_bera: add semi-realistic example +* [#17750](https://github.com/scipy/scipy/pull/17750): ENH: Support multinomial distributions with n=0 trials. +* [#17758](https://github.com/scipy/scipy/pull/17758): ENH: analytical formula for f distribution entropy +* [#17759](https://github.com/scipy/scipy/pull/17759): DOC: stats.skewtest: add semi-realistic example +* [#17762](https://github.com/scipy/scipy/pull/17762): DOC: remove space between directive name and double colon `::` +* [#17763](https://github.com/scipy/scipy/pull/17763): DOC: single -> double colon for directive. +* [#17764](https://github.com/scipy/scipy/pull/17764): ENH: entropy for matrix normal distribution +* [#17765](https://github.com/scipy/scipy/pull/17765): DOC: stats: additional normality test examples +* [#17767](https://github.com/scipy/scipy/pull/17767): DOC: stats: reorganize hypothesis tests in main page +* [#17768](https://github.com/scipy/scipy/pull/17768): TST: special: fix incorrectly named tests +* [#17769](https://github.com/scipy/scipy/pull/17769): DOC/BUG: add missing entropy methods in docstrings +* [#17770](https://github.com/scipy/scipy/pull/17770): TST: stats: fixed misnamed tests +* [#17772](https://github.com/scipy/scipy/pull/17772): MAINT: remove unused test utility functions +* [#17773](https://github.com/scipy/scipy/pull/17773): DOC: stats: add realistic examples to correlation tests +* [#17778](https://github.com/scipy/scipy/pull/17778): DOC: stats: add realistic examples to variance tests +* [#17780](https://github.com/scipy/scipy/pull/17780): MAINT: optimize.minimize: fix new callback interface when parameter… +* [#17784](https://github.com/scipy/scipy/pull/17784): DOC: linalg: fix docstring of `linalg.sqrtm` +* [#17786](https://github.com/scipy/scipy/pull/17786): DOC: examples for ndtr, ndtri +* [#17791](https://github.com/scipy/scipy/pull/17791): DEP: remove maxiter kwarg in \_minimize\_tnc +* [#17793](https://github.com/scipy/scipy/pull/17793): MAINT: remove divide by zero in differential\_evolution +* [#17794](https://github.com/scipy/scipy/pull/17794): TST: Added test suite for dgamma distribution +* [#17812](https://github.com/scipy/scipy/pull/17812): MAINT: add (optional) pre-commit hook +* [#17813](https://github.com/scipy/scipy/pull/17813): MAINT: integrate.qmc\_quad: re-introduce qmc\_quad +* [#17816](https://github.com/scipy/scipy/pull/17816): MAINT: allow typed method in `stats.sobol\_indices` +* [#17817](https://github.com/scipy/scipy/pull/17817): MAINT: remove unused args parameter from `qmc\_quad` +* [#17818](https://github.com/scipy/scipy/pull/17818): BUG/ENH: stats: several updates for dgamma. +* [#17820](https://github.com/scipy/scipy/pull/17820): DOC/BUG: plot `ndtri` only where it is defined +* [#17824](https://github.com/scipy/scipy/pull/17824): ENH: analytical entropy for invgauss distribution +* [#17825](https://github.com/scipy/scipy/pull/17825): DOC: optimize: change term zero to root +* [#17829](https://github.com/scipy/scipy/pull/17829): DOC: stats: document RNG behavior when distribution is deepcopied +* [#17830](https://github.com/scipy/scipy/pull/17830): MAINT: stats.\_axis\_nan\_policy: raise appropriate TypeErrors +* [#17834](https://github.com/scipy/scipy/pull/17834): MAINT: improve accuracy of betaprime cdf in scipy.stats +* [#17835](https://github.com/scipy/scipy/pull/17835): DOC: integrate: document limitation of numerical integration +* [#17836](https://github.com/scipy/scipy/pull/17836): DOC: integrate.solve\_ivp: clarify impact of parameter `vectorized` +* [#17837](https://github.com/scipy/scipy/pull/17837): DEP: integrate.nquad: deprecate parameter `full\_output` +* [#17838](https://github.com/scipy/scipy/pull/17838): DOC: integrate.quad: behavior is not guaranteed for divergent… +* [#17841](https://github.com/scipy/scipy/pull/17841): DOC: linalg: expand pinv example +* [#17842](https://github.com/scipy/scipy/pull/17842): DOC, MAINT: Add issue template for Documentation issues +* [#17848](https://github.com/scipy/scipy/pull/17848): ENH: implement \_sf and \_isf for powernorm distribution +* [#17849](https://github.com/scipy/scipy/pull/17849): ENH: special: Add the function \_scaled\_exp1 +* [#17852](https://github.com/scipy/scipy/pull/17852): MAINT: optimize: improve `optimize.curve\_fit` doc and error… +* [#17853](https://github.com/scipy/scipy/pull/17853): DOC: integrate.dblquad/tplquad: update result descriptions +* [#17857](https://github.com/scipy/scipy/pull/17857): MAINT: analytical formula for genlogistic entropy +* [#17865](https://github.com/scipy/scipy/pull/17865): MAINT: stats: fix recent CI and other issues +* [#17867](https://github.com/scipy/scipy/pull/17867): DOC: note on negative variables for linprog +* [#17868](https://github.com/scipy/scipy/pull/17868): ENH: add analytical formula for Nakagami distribution entropy +* [#17873](https://github.com/scipy/scipy/pull/17873): ENH: Added analytical formula for dgamma distribution entropy… +* [#17874](https://github.com/scipy/scipy/pull/17874): ENH: Added analytical formula for truncnorm entropy (#17748) +* [#17876](https://github.com/scipy/scipy/pull/17876): DOC: remove hidden stats sections from sidebar/toctree +* [#17878](https://github.com/scipy/scipy/pull/17878): Lint everything +* [#17879](https://github.com/scipy/scipy/pull/17879): DOC: add docs for the main namespace +* [#17881](https://github.com/scipy/scipy/pull/17881): BUG: Fix handling on user-supplied filters in `signal.decimate` +* [#17882](https://github.com/scipy/scipy/pull/17882): BLD: fix Meson build warnings about multiple targets +* [#17883](https://github.com/scipy/scipy/pull/17883): DOC: Clarified the meaning of optional arguments in optimize.leastsq +* [#17886](https://github.com/scipy/scipy/pull/17886): ENH: Warn about missing boundary when NOLA condition failed in… +* [#17889](https://github.com/scipy/scipy/pull/17889): DOC: Cleanup development guide +* [#17892](https://github.com/scipy/scipy/pull/17892): MAINT: stats: Post-“lint everything” clean up in stats. +* [#17894](https://github.com/scipy/scipy/pull/17894): MAINT: update .gitignore with meson and linter +* [#17895](https://github.com/scipy/scipy/pull/17895): DOC: config info in issue template +* [#17897](https://github.com/scipy/scipy/pull/17897): MAINT: Update the “lint everything” SHA in .git-blame-ignore-revs +* [#17898](https://github.com/scipy/scipy/pull/17898): DOC: remove hidden submodules from sidebar +* [#17899](https://github.com/scipy/scipy/pull/17899): MAINT: use conda for linters +* [#17900](https://github.com/scipy/scipy/pull/17900): Re-implement pre-commit hook in Python +* [#17906](https://github.com/scipy/scipy/pull/17906): DOC: interpolate: add a note against using triangulation based… +* [#17907](https://github.com/scipy/scipy/pull/17907): DOC: stats.wilcoxon: warn about roundoff errors in x-y +* [#17908](https://github.com/scipy/scipy/pull/17908): ENH: powerlognormal distribution improvements +* [#17909](https://github.com/scipy/scipy/pull/17909): ENH: improve accuracy of betaprime ppf in scipy.stats +* [#17915](https://github.com/scipy/scipy/pull/17915): DOC: Add warning to butter function docstring +* [#17921](https://github.com/scipy/scipy/pull/17921): CI: clean conda index upon cache invalidation +* [#17922](https://github.com/scipy/scipy/pull/17922): DOC: corrected doc of bilinear discretization of lti +* [#17929](https://github.com/scipy/scipy/pull/17929): ENH: stats.nakagami.entropy: improve formulation +* [#17930](https://github.com/scipy/scipy/pull/17930): ENH: use asymptotic expansions for entropy of `genlogistic`… +* [#17937](https://github.com/scipy/scipy/pull/17937): DOC: Update pip + venv instructions in the contributor documentation… +* [#17939](https://github.com/scipy/scipy/pull/17939): DOC: ttest\_ind\_from\_stats: discuss negative stdev +* [#17943](https://github.com/scipy/scipy/pull/17943): ENH: early exit random-cd optimization in 1D +* [#17944](https://github.com/scipy/scipy/pull/17944): pre-commit should fail when fixes are made by Ruff +* [#17945](https://github.com/scipy/scipy/pull/17945): DOC: remove seed in HTML only +* [#17946](https://github.com/scipy/scipy/pull/17946): ENH: Maxwell distribution `sf`/`isf` override +* [#17947](https://github.com/scipy/scipy/pull/17947): TST: Update list of modules for import cycle checks +* [#17948](https://github.com/scipy/scipy/pull/17948): STY: fix only staged files. +* [#17949](https://github.com/scipy/scipy/pull/17949): ENH: stats.dirichlet\_multinomial: vectorize implementation +* [#17950](https://github.com/scipy/scipy/pull/17950): MAINT: bump OpenBLAS version, bump macOS image used in GHA +* [#17956](https://github.com/scipy/scipy/pull/17956): MAINT: optimize.dual\_annealing: fix callable jac with args +* [#17959](https://github.com/scipy/scipy/pull/17959): MAINT: update supported versions of Python and NumPy to follow… +* [#17961](https://github.com/scipy/scipy/pull/17961): ENH: optimize.linprog: pass unrecognized options to HiGHS verbatim +* [#17964](https://github.com/scipy/scipy/pull/17964): DEP: integrate.quad\_vec: deprecate parameter full\_output +* [#17967](https://github.com/scipy/scipy/pull/17967): MAINT: Fully qualify std::move invocations to fix clang -Wunqualified-std-cast-call +* [#17971](https://github.com/scipy/scipy/pull/17971): ENH: stats: add axis tuple and nan\_policy to `sem` and `iqr` +* [#17975](https://github.com/scipy/scipy/pull/17975): BUG: Update test\_lobpcg.py +* [#17976](https://github.com/scipy/scipy/pull/17976): DOC/MAINT: simplify release entries +* [#17980](https://github.com/scipy/scipy/pull/17980): FIX: CI: avoid passing Cython files to ruff +* [#17982](https://github.com/scipy/scipy/pull/17982): MAINT: add release entries move to blame ignore +* [#17987](https://github.com/scipy/scipy/pull/17987): DOC: move .rst.txt to source and cleaning around generating doc +* [#17989](https://github.com/scipy/scipy/pull/17989): MAINT: sparse.linalg: remove unused \_\_main\_\_ code +* [#17990](https://github.com/scipy/scipy/pull/17990): BLD: make musllinux wheels for nightly +* [#17998](https://github.com/scipy/scipy/pull/17998): ENH: optimize.RootResults: make `RootResults` an `OptimizeResult` +* [#18000](https://github.com/scipy/scipy/pull/18000): DOC: stats, interpolate: Fix some minor docstring issues. +* [#18002](https://github.com/scipy/scipy/pull/18002): ENH: override halflogistic `sf` and `isf` +* [#18003](https://github.com/scipy/scipy/pull/18003): ENH: improve halfnorm CDF precision +* [#18006](https://github.com/scipy/scipy/pull/18006): BLD: use a relative path to numpy include and library directories +* [#18008](https://github.com/scipy/scipy/pull/18008): MAINT: forward port 1.10.1 relnotes +* [#18013](https://github.com/scipy/scipy/pull/18013): MAINT: stats.vonmises.fit: maintain backward compatibility +* [#18015](https://github.com/scipy/scipy/pull/18015): TST: optimize.root\_scalar: refactor tests and add Chandrupatla… +* [#18016](https://github.com/scipy/scipy/pull/18016): Add axes argument to ndimage filters +* [#18018](https://github.com/scipy/scipy/pull/18018): DOC: Add an example showing how to plot Rotations to the docs +* [#18019](https://github.com/scipy/scipy/pull/18019): add tests for `trimmed\_var` and `trimmed\_std` in `stats.mstats` +* [#18020](https://github.com/scipy/scipy/pull/18020): TST: stats.mstats: add `median\_cihs`/`sen\_seasonal\_slopes`… +* [#18021](https://github.com/scipy/scipy/pull/18021): DEP: linalg: deprecate tri{,u,l} +* [#18022](https://github.com/scipy/scipy/pull/18022): DOC: interpolate: link to the gist with the porting guide +* [#18023](https://github.com/scipy/scipy/pull/18023): DOC: how to document examples using RNG and also self-contained… +* [#18027](https://github.com/scipy/scipy/pull/18027): DOC: fix section title typo in interpolation tutorial +* [#18028](https://github.com/scipy/scipy/pull/18028): DOC: fix underlying of title in extrapolate +* [#18029](https://github.com/scipy/scipy/pull/18029): fix error from betabinom stats using only integers for a and… +* [#18032](https://github.com/scipy/scipy/pull/18032): BLD: add NDEBUG flag for release builds +* [#18034](https://github.com/scipy/scipy/pull/18034): BLD: avoid running `run\_command(py3, …)`, for better cross-compiling +* [#18035](https://github.com/scipy/scipy/pull/18035): ENH: stats: add ecdf function +* [#18036](https://github.com/scipy/scipy/pull/18036): BLD: build Windows wheel for py39 against numpy 1.22.3 +* [#18037](https://github.com/scipy/scipy/pull/18037): DOC/MAINT: fix source button +* [#18040](https://github.com/scipy/scipy/pull/18040): DOC: Fix error in doc of \_minimize\_trustregion\_exact +* [#18043](https://github.com/scipy/scipy/pull/18043): MAINT: update GH bug template +* [#18045](https://github.com/scipy/scipy/pull/18045): MAINT: update codeowners. +* [#18047](https://github.com/scipy/scipy/pull/18047): DOC: Update scipy.spatial.distance.pdist docstring to match its… +* [#18049](https://github.com/scipy/scipy/pull/18049): STY: Include Python.h before any other headers. +* [#18050](https://github.com/scipy/scipy/pull/18050): MAINT: integrate.qmc\_quad: correct behavior of parameter `log` +* [#18052](https://github.com/scipy/scipy/pull/18052): BLD: use anaconda-client to upload wheels +* [#18053](https://github.com/scipy/scipy/pull/18053): DOC fix expectile docstring - empirical CDF +* [#18058](https://github.com/scipy/scipy/pull/18058): BLD: use meson-native dependency lookup for pybind11 +* [#18059](https://github.com/scipy/scipy/pull/18059): Johnson distributions `sf` and `isf` override +* [#18060](https://github.com/scipy/scipy/pull/18060): MAINT: remove pavement +* [#18061](https://github.com/scipy/scipy/pull/18061): ENH: implement array @ LinearOperator +* [#18063](https://github.com/scipy/scipy/pull/18063): DOC: improve documentation for distance\_transform\_{cdt,edt} +* [#18064](https://github.com/scipy/scipy/pull/18064): DOC: add examples in for xlogy +* [#18066](https://github.com/scipy/scipy/pull/18066): TST: stats.nct: add test for crash with large nc +* [#18068](https://github.com/scipy/scipy/pull/18068): TST: stats.ksone: loosen variance test tolerance +* [#18070](https://github.com/scipy/scipy/pull/18070): Docstring: note on bivariate spline axis ordering +* [#18072](https://github.com/scipy/scipy/pull/18072): DOC: Modifying t parameter documentation issue in splprep #17893 +* [#18073](https://github.com/scipy/scipy/pull/18073): MAINT: avoid non-recommended numpy functions and constants +* [#18075](https://github.com/scipy/scipy/pull/18075): MAINT: update pooch deps +* [#18076](https://github.com/scipy/scipy/pull/18076): DOC: fix docstring typo for `kurtosis` and whitespace in `\_continuous\_distns` +* [#18077](https://github.com/scipy/scipy/pull/18077): BUG: Check for initial state finiteness +* [#18081](https://github.com/scipy/scipy/pull/18081): ENH: allow single observation for equal variance in `stats.ttest\_ind` +* [#18082](https://github.com/scipy/scipy/pull/18082): DOC: add examples for xlog1py +* [#18083](https://github.com/scipy/scipy/pull/18083): STY: fix mypy assignment. +* [#18084](https://github.com/scipy/scipy/pull/18084): BUG: calculate VDC permutations at init of Halton +* [#18092](https://github.com/scipy/scipy/pull/18092): ENH: stats.ecdf: support right-censored data +* [#18094](https://github.com/scipy/scipy/pull/18094): ENH: improve entropy calculation of chi distribution using asymptotic… +* [#18095](https://github.com/scipy/scipy/pull/18095): ENH: asymptotic expansion for gamma distribution entropy +* [#18096](https://github.com/scipy/scipy/pull/18096): MAINT: stats.johnsonsu: override \_stats +* [#18098](https://github.com/scipy/scipy/pull/18098): ENH: increase available range of Gompertz entropy using scaled\_exp1 +* [#18101](https://github.com/scipy/scipy/pull/18101): DOC: adding references to the UnivariateSpline docstring #17828 +* [#18102](https://github.com/scipy/scipy/pull/18102): ENH: stats.goodness\_of\_fit: add Filliben’s test +* [#18104](https://github.com/scipy/scipy/pull/18104): BUG: enable matlab nested arrs +* [#18107](https://github.com/scipy/scipy/pull/18107): ENH: add Dunnett’s test +* [#18112](https://github.com/scipy/scipy/pull/18112): FIX: reset semantic in `QMCEngine.reset` +* [#18120](https://github.com/scipy/scipy/pull/18120): Correct the comments about ` fmin\_powell` in `scipy/optimize` +* [#18122](https://github.com/scipy/scipy/pull/18122): ENH: Added asymptotic expansion for invgamma entropy (#18093) +* [#18127](https://github.com/scipy/scipy/pull/18127): MAINT: cleanup inconsistencies in \_continous\_dists +* [#18128](https://github.com/scipy/scipy/pull/18128): MAINT: add test against generic fit method for vonmises distribution +* [#18129](https://github.com/scipy/scipy/pull/18129): TST: stats.rv\_continuous.fit: use `nnlf` instead of `\_reduce\_func`… +* [#18130](https://github.com/scipy/scipy/pull/18130): Some doc updates and small code tweaks. +* [#18131](https://github.com/scipy/scipy/pull/18131): ENH: Added asymptotic expansion for gengamma entropy +* [#18134](https://github.com/scipy/scipy/pull/18134): ENH: stats: Improve \_cdf and implement \_sf for genhyperbolic +* [#18135](https://github.com/scipy/scipy/pull/18135): Added asymptotic expansion for t entropy (#18093) +* [#18136](https://github.com/scipy/scipy/pull/18136): ENH: stats.ecdf: add `confidence\_interval` methods +* [#18137](https://github.com/scipy/scipy/pull/18137): Bugfix for somersd where an integer overflow could occur +* [#18138](https://github.com/scipy/scipy/pull/18138): ENH: improve precision of genlogistic methods +* [#18144](https://github.com/scipy/scipy/pull/18144): DOC: Add doc examples for friedmanchisquare +* [#18145](https://github.com/scipy/scipy/pull/18145): BLD: emit a warning when building from source on 32-bit Windows +* [#18149](https://github.com/scipy/scipy/pull/18149): TST: fix issue with inaccurate `cython\_blas` tests +* [#18150](https://github.com/scipy/scipy/pull/18150): ENH: add CI and str to Dunnett’s test +* [#18152](https://github.com/scipy/scipy/pull/18152): ENH: stats.moment: enable non-central moment calculation +* [#18157](https://github.com/scipy/scipy/pull/18157): CI: fix pre-release job that is failing on Cython 3.0b1 +* [#18158](https://github.com/scipy/scipy/pull/18158): DOC:stats: Fix levy and levy\_l descriptions +* [#18160](https://github.com/scipy/scipy/pull/18160): BUG: Wrong status returned by \_check\_result. See #18106. optimize +* [#18162](https://github.com/scipy/scipy/pull/18162): ENH: Dweibull entropy +* [#18168](https://github.com/scipy/scipy/pull/18168): TST: spatial: skip failing test to make CI green again +* [#18172](https://github.com/scipy/scipy/pull/18172): MAINT: optimize.root\_scalar: return gracefully when callable… +* [#18173](https://github.com/scipy/scipy/pull/18173): DOC: update links for ARPACK to point to ARPACK-NG +* [#18174](https://github.com/scipy/scipy/pull/18174): DOC: cite pip issue about multiple `–config-settings` +* [#18178](https://github.com/scipy/scipy/pull/18178): ENH: Added `\_sf` method for anglit distribution (#17832) +* [#18181](https://github.com/scipy/scipy/pull/18181): DOC: wheel build infra updates +* [#18187](https://github.com/scipy/scipy/pull/18187): MAINT: stats.ecdf: store number at risk just before events +* [#18188](https://github.com/scipy/scipy/pull/18188): BUG: interpolate: add x-y length validation for `make\_smoothing\_spline`. +* [#18189](https://github.com/scipy/scipy/pull/18189): DOC: Fix for side bar rendering on top of text issue +* [#18190](https://github.com/scipy/scipy/pull/18190): ENH: fix vonmises fit for bad guess of location parameter +* [#18193](https://github.com/scipy/scipy/pull/18193): MAINT: stats.kendalltau: avoid overflow +* [#18195](https://github.com/scipy/scipy/pull/18195): MAINT: interpolate: remove duplicated FITPACK interface \_fitpack.\_spl\_. +* [#18196](https://github.com/scipy/scipy/pull/18196): ENH: add Log rank for survival analysis +* [#18199](https://github.com/scipy/scipy/pull/18199): BUG: throw ValueError for mismatched w dimensions and test for… +* [#18200](https://github.com/scipy/scipy/pull/18200): TST: stats: Move genexpon from xslow to slow fit test sets. +* [#18204](https://github.com/scipy/scipy/pull/18204): MAINT/TST: fix `Slerp` typing and better iv in `Rotation` +* [#18207](https://github.com/scipy/scipy/pull/18207): ENH: improve precision of folded normal distribution cdf +* [#18209](https://github.com/scipy/scipy/pull/18209): ENH: improve integrate.simpson for even number of points +* [#18210](https://github.com/scipy/scipy/pull/18210): ENH: stats.ttest\_ind: add degrees of freedom and confidence interval +* [#18212](https://github.com/scipy/scipy/pull/18212): ENH: stats.ecdf: add `evaluate` and `plot` methods; restructure… +* [#18215](https://github.com/scipy/scipy/pull/18215): DOC: stats: describe attributes of `DunnettResult` +* [#18216](https://github.com/scipy/scipy/pull/18216): MAINT: replace use of make\_dataclass with explicit dataclasses +* [#18217](https://github.com/scipy/scipy/pull/18217): MAINT: stats: consistently return NumPy numbers +* [#18221](https://github.com/scipy/scipy/pull/18221): DOC: add guidance on how to make a dataclass for result objects +* [#18222](https://github.com/scipy/scipy/pull/18222): MAINT: stats.TTestResult: fix NaN bug in ttest confidence intervals +* [#18225](https://github.com/scipy/scipy/pull/18225): ENH:MAINT:linalg det in Cython and with nDarray support +* [#18227](https://github.com/scipy/scipy/pull/18227): ENH: stats: resampling methods configuration classes and example… +* [#18228](https://github.com/scipy/scipy/pull/18228): ENH: stats.geometric.entropy: implement analytical formula +* [#18229](https://github.com/scipy/scipy/pull/18229): ENH: stats.bootstrap: add one-sided confidence intervals +* [#18230](https://github.com/scipy/scipy/pull/18230): BUG: nan segfault in KDTree, reject non-finite input +* [#18231](https://github.com/scipy/scipy/pull/18231): ENH: stats.monte\_carlo\_test: add support for multi-sample statistics +* [#18232](https://github.com/scipy/scipy/pull/18232): ENH: override dweibull distribution survival and inverse survival… +* [#18237](https://github.com/scipy/scipy/pull/18237): MAINT: update typing of Rotation +* [#18238](https://github.com/scipy/scipy/pull/18238): MAINT:optimize: shgo assorted fixes +* [#18240](https://github.com/scipy/scipy/pull/18240): fix typo +* [#18241](https://github.com/scipy/scipy/pull/18241): MAINT: remove Gitpod in favour of GitHub CodeSpaces +* [#18242](https://github.com/scipy/scipy/pull/18242): MAINT: Allow scipy to be compiled in cython3 +* [#18243](https://github.com/scipy/scipy/pull/18243): TST: stats.dunnett: fix seed in test\_shapes +* [#18245](https://github.com/scipy/scipy/pull/18245): DOC: remove content related to `setup.py` usage from the docs +* [#18246](https://github.com/scipy/scipy/pull/18246): ci: touch up wheel build action +* [#18247](https://github.com/scipy/scipy/pull/18247): BLD: Add const to Cython signatures for BLAS/LAPACK +* [#18248](https://github.com/scipy/scipy/pull/18248): BLD: implement version check for minimum Cython version +* [#18251](https://github.com/scipy/scipy/pull/18251): DOC: orthogonal\_procrustes fix date of reference paper and DOI +* [#18257](https://github.com/scipy/scipy/pull/18257): BLD: fix missing build dependency on cython signature .txt files +* [#18258](https://github.com/scipy/scipy/pull/18258): DOC: fix link in release notes v1.7 +* [#18261](https://github.com/scipy/scipy/pull/18261): Add axes support to uniform\_filter, minimum\_filter, maximum\_filter +* [#18263](https://github.com/scipy/scipy/pull/18263): BUG: some tweaks to PROPACK f2py wrapper and build flags +* [#18264](https://github.com/scipy/scipy/pull/18264): MAINT: remove `from numpy.math cimport` usages, update `npy\_blas.h` +* [#18266](https://github.com/scipy/scipy/pull/18266): MAINT: Explicitly mark `cdef` functions not raising exception… +* [#18269](https://github.com/scipy/scipy/pull/18269): ENH: stats: Implement \_sf and \_isf for exponweib. +* [#18270](https://github.com/scipy/scipy/pull/18270): CI: test meson-python from its main branch in one CI job +* [#18275](https://github.com/scipy/scipy/pull/18275): TST: stats: infrastructure for generation of distribution function… +* [#18276](https://github.com/scipy/scipy/pull/18276): MAINT: stats.betaprime: avoid spurious warnings in `fit`, `stats` +* [#18280](https://github.com/scipy/scipy/pull/18280): DOC: spatial.distance: update formula for {s,sq}euclidean +* [#18281](https://github.com/scipy/scipy/pull/18281): BLD: Enable incompatible pointer types warnings +* [#18284](https://github.com/scipy/scipy/pull/18284): DOC: improved gmres doc on preconditioning (scipy.sparse.linalg) +* [#18285](https://github.com/scipy/scipy/pull/18285): MAINT: Remove codecov +* [#18287](https://github.com/scipy/scipy/pull/18287): DOC: `distance\_transform\_bf` example +* [#18288](https://github.com/scipy/scipy/pull/18288): TST: stats.ortho\_group: improve determinant distribution test +* [#18289](https://github.com/scipy/scipy/pull/18289): MAINT: mmread allow leading whitespace +* [#18290](https://github.com/scipy/scipy/pull/18290): DEP: stats.mode: raise with non-numeric input +* [#18291](https://github.com/scipy/scipy/pull/18291): TST: stats.\_axis\_nan\_policy: add test that decorated function… +* [#18292](https://github.com/scipy/scipy/pull/18292): CI: add CircleCI API token to fix html preview link +* [#18293](https://github.com/scipy/scipy/pull/18293): BUG: fix for incompatible pointer warning from stats.\_rcond #18282 +* [#18294](https://github.com/scipy/scipy/pull/18294): CI: remove `setup.py` based jobs from GitHub Actions and run… +* [#18297](https://github.com/scipy/scipy/pull/18297): MAINT: linalg.solve\_discrete\_are: fix typo in error message +* [#18299](https://github.com/scipy/scipy/pull/18299): DOC: interpolate: add see also references for data on regular… +* [#18301](https://github.com/scipy/scipy/pull/18301): CI: remove `runtests.py` and related scripts/files +* [#18303](https://github.com/scipy/scipy/pull/18303): DOC: css adjustment in dark mode and hidden toctree in dev section +* [#18304](https://github.com/scipy/scipy/pull/18304): MAINT: update boost\_math +* [#18305](https://github.com/scipy/scipy/pull/18305): ENH: ndimage: add axes argument to rank\_filter, percentile\_filter,… +* [#18307](https://github.com/scipy/scipy/pull/18307): DOC: add cdf under methods for multivariate t distribution +* [#18311](https://github.com/scipy/scipy/pull/18311): CI: move lint job from Azure to GHA +* [#18312](https://github.com/scipy/scipy/pull/18312): CI: move gcc-8 test to GHA +* [#18313](https://github.com/scipy/scipy/pull/18313): CI: remove asv from AzureCI +* [#18314](https://github.com/scipy/scipy/pull/18314): CI: remove scikit-umfpack/sparse from Azure testing +* [#18315](https://github.com/scipy/scipy/pull/18315): CI: remove coverage jobs +* [#18318](https://github.com/scipy/scipy/pull/18318): MAINT: Mark function pointer ctypedefs as noexcept +* [#18320](https://github.com/scipy/scipy/pull/18320): CI: migrate ref guide-check to CircleCI +* [#18321](https://github.com/scipy/scipy/pull/18321): Revert “ENH: stats.anderson\_ksamp: add permutation version of… +* [#18323](https://github.com/scipy/scipy/pull/18323): ENH: increase available range of vonmises `fit` +* [#18324](https://github.com/scipy/scipy/pull/18324): ENH: add `entropy` method for multivariate t distribution +* [#18325](https://github.com/scipy/scipy/pull/18325): CI: move Azure cp39/full/win job to GHA +* [#18327](https://github.com/scipy/scipy/pull/18327): MAINT: optimize.milp: improve behavior for unexpected sparse… +* [#18328](https://github.com/scipy/scipy/pull/18328): MAINT: stats.shapiro: override p-value when len(x)==3 +* [#18330](https://github.com/scipy/scipy/pull/18330): BLD: avoid build warnings on Windows, bump pybind11 and meson… +* [#18332](https://github.com/scipy/scipy/pull/18332): TST: fix minor tolerance issue for `stats.multivariate\_t` test +* [#18333](https://github.com/scipy/scipy/pull/18333): CI: windows cp311 use-pythran=false full, sdist GHA +* [#18337](https://github.com/scipy/scipy/pull/18337): MAINT: update boost\_math +* [#18339](https://github.com/scipy/scipy/pull/18339): TST: optimize: fix test\_milp\_timeout +* [#18340](https://github.com/scipy/scipy/pull/18340): DOC: interpolate: declare Rbf legacy +* [#18341](https://github.com/scipy/scipy/pull/18341): DEP: signal: deprecate using medfilt and order\_filter with float128… +* [#18342](https://github.com/scipy/scipy/pull/18342): TST: stats.mstats.median\_cihs: strengthen test +* [#18343](https://github.com/scipy/scipy/pull/18343): MAINT: use math.prod (python >= 3.8) +* [#18344](https://github.com/scipy/scipy/pull/18344): MAINT: Set cython compiler directive cpow to True +* [#18345](https://github.com/scipy/scipy/pull/18345): DEV: work around pathlib bug affecting dev.py for Python 3.9… +* [#18349](https://github.com/scipy/scipy/pull/18349): MAINT: stats.dgamma.entropy: avoid deprecated NumPy usage and… +* [#18350](https://github.com/scipy/scipy/pull/18350): TST: use np not math for functions to avoid conversion of ndim>0… +* [#18351](https://github.com/scipy/scipy/pull/18351): CI: remove Azure sdist job +* [#18352](https://github.com/scipy/scipy/pull/18352): MAINT: stats: more avoidance of deprecated NumPy usage +* [#18353](https://github.com/scipy/scipy/pull/18353): Migrate ruff.toml configuration to lint.toml +* [#18355](https://github.com/scipy/scipy/pull/18355): ENH: allow dividing LinearOperator by number +* [#18357](https://github.com/scipy/scipy/pull/18357): MAINT: clearer error in `LinearOperator \* spmatrix` +* [#18358](https://github.com/scipy/scipy/pull/18358): ENH:MAINT:linalg:lu Cythonized and ndarray support added +* [#18359](https://github.com/scipy/scipy/pull/18359): MAINT: Fix broken link in setup.py +* [#18360](https://github.com/scipy/scipy/pull/18360): DOC: improve neg. binomial function examples in `special` +* [#18362](https://github.com/scipy/scipy/pull/18362): MAINT: Add noexcept function declaration to `\_cythonized\_array\_utils.pxd` +* [#18369](https://github.com/scipy/scipy/pull/18369): CI: bdist\_wheel windows job Azure –> GHA +* [#18370](https://github.com/scipy/scipy/pull/18370): DOC: stats.chisquare: attribute is pvalue, not p +* [#18374](https://github.com/scipy/scipy/pull/18374): CI: pin to rtools40 +* [#18378](https://github.com/scipy/scipy/pull/18378): DOC: add output\_type to signature of cKDTree.query\_pairs +* [#18379](https://github.com/scipy/scipy/pull/18379): TST/MAINT: remove vonmises fit correctnes test for extreme kappa… +* [#18380](https://github.com/scipy/scipy/pull/18380): MAINT: Limit fittable data for von mises fisher distribution… +* [#18382](https://github.com/scipy/scipy/pull/18382): TST: stats.cosine: modify test to silence failure +* [#18383](https://github.com/scipy/scipy/pull/18383): MAINT: add smoke testing of signal.detrend +* [#18384](https://github.com/scipy/scipy/pull/18384): DOC: improve vonmises documentation +* [#18387](https://github.com/scipy/scipy/pull/18387): DOC: interpolate: deduplicate docstrings in \_fitpack\_py and \_fitpack\_impl +* [#18392](https://github.com/scipy/scipy/pull/18392): BUG: optimize.differential\_evolution: fix division by zero error +* [#18399](https://github.com/scipy/scipy/pull/18399): DOC: Replace “HACKING” with “hacking” +* [#18400](https://github.com/scipy/scipy/pull/18400): DOC: improve description of the method argument in mannwhitneyu +* [#18402](https://github.com/scipy/scipy/pull/18402): TST: fix failing signal.windows tests +* [#18405](https://github.com/scipy/scipy/pull/18405): Revert “BLD: Add const to Cython signatures for BLAS/LAPACK (#18247)” +* [#18410](https://github.com/scipy/scipy/pull/18410): TST: fix test failures in linprog unboundedness test +* [#18411](https://github.com/scipy/scipy/pull/18411): BLD: an Intel Fortran fix and MinGW-related cleanups +* [#18412](https://github.com/scipy/scipy/pull/18412): MAINT: signal: simplify shape manipulations in signal.detrend +* [#18413](https://github.com/scipy/scipy/pull/18413): MAINT: Harmonized documentation for Interpolator classes +* [#18414](https://github.com/scipy/scipy/pull/18414): CI: move last Azure job to GHA +* [#18418](https://github.com/scipy/scipy/pull/18418): Fix warning when `nogil` is placed before `except` +* [#18419](https://github.com/scipy/scipy/pull/18419): MAINT: interpolate: remove unused codes in `\_fitpackmodule.c`. +* [#18421](https://github.com/scipy/scipy/pull/18421): BLD: more PROPACK fixes, removing timer code +* [#18422](https://github.com/scipy/scipy/pull/18422): MAINT: stats: genexpon is no longer too slow for test\_rvs\_broadcast. +* [#18426](https://github.com/scipy/scipy/pull/18426): BLD: fix two `-Duse-g77-abi` regressions and a PROPACK bug +* [#18427](https://github.com/scipy/scipy/pull/18427): ENH: prevent unnecessary computation in `scipy.stats.rankdata` +* [#18429](https://github.com/scipy/scipy/pull/18429): DOC: rewrite all build docs and restructure build/contributor… +* [#18430](https://github.com/scipy/scipy/pull/18430): MAINT: stats.mode: improve `nan\_policy` behavior +* [#18433](https://github.com/scipy/scipy/pull/18433): ENH: improve t distribution logpdf and pdf for large degrees… +* [#18438](https://github.com/scipy/scipy/pull/18438): BLD: DOC: fix Sphinx doc build caching behavior for `.dev`… +* [#18439](https://github.com/scipy/scipy/pull/18439): BLD: detect `xsimd` if it’s installed and add to pythran dependency +* [#18441](https://github.com/scipy/scipy/pull/18441): ENH:stats: add sf method for betaprime +* [#18442](https://github.com/scipy/scipy/pull/18442): TST: fix precision of several linalg/sparse.linalg tests +* [#18444](https://github.com/scipy/scipy/pull/18444): DOC: clarify Sobel transform +* [#18446](https://github.com/scipy/scipy/pull/18446): MAINT: fix Deb03 GO benchmark +* [#18447](https://github.com/scipy/scipy/pull/18447): DOC: remove references to Azure +* [#18449](https://github.com/scipy/scipy/pull/18449): ENH: increase truncated exponential distribution sf/isf precision +* [#18451](https://github.com/scipy/scipy/pull/18451): DEV: use number of physical cores in `dev.py build` by default +* [#18454](https://github.com/scipy/scipy/pull/18454): DOC: add `distance\_transform\_cdt` example +* [#18455](https://github.com/scipy/scipy/pull/18455): MAINT: simplifiy detrend +* [#18458](https://github.com/scipy/scipy/pull/18458): DOC: odr: clarify `cov\_beta` is not scaled by the residual… +* [#18459](https://github.com/scipy/scipy/pull/18459): DOC: optimize: add use of functools.partial to tutorial +* [#18460](https://github.com/scipy/scipy/pull/18460): DOC: examples for `ndimage.generic\_filter` +* [#18461](https://github.com/scipy/scipy/pull/18461): TST: stats: ReferenceDistribution: use complementary methods… +* [#18462](https://github.com/scipy/scipy/pull/18462): MAINT: Clean up scipy/sparse/linalg/\_isolve/tests/test\_iterative.py +* [#18463](https://github.com/scipy/scipy/pull/18463): MAINT: parametrize scipy/sparse/linalg/\_isolve/tests/test\_iterative.py +* [#18466](https://github.com/scipy/scipy/pull/18466): DOC: fix issues in `svds` docstring examples that were failing… +* [#18468](https://github.com/scipy/scipy/pull/18468): BLD: enforce utf-8 in tools/cythonize.py, and some cleanups +* [#18472](https://github.com/scipy/scipy/pull/18472): MAINT: remove lsim2/impulse2/step2 docstring examples +* [#18475](https://github.com/scipy/scipy/pull/18475): DOC: remove warnings in doc build +* [#18476](https://github.com/scipy/scipy/pull/18476): TST: stats/optimize: filter warnings in tests +* [#18482](https://github.com/scipy/scipy/pull/18482): MAINT: ensure Nelder-Mead respects floating point type +* [#18486](https://github.com/scipy/scipy/pull/18486): DOC: remove already-resolved deprecation warning filter +* [#18489](https://github.com/scipy/scipy/pull/18489): DEP: signal: deprecate importing window functions from signal… +* [#18493](https://github.com/scipy/scipy/pull/18493): BUG: stats: Fix the variable that is checked to skip a test. +* [#18500](https://github.com/scipy/scipy/pull/18500): MAINT: tweak code comment for list of private-but-present modules +* [#18501](https://github.com/scipy/scipy/pull/18501): TST: interpolate: add a regression test for bisplev integer overflow +* [#18502](https://github.com/scipy/scipy/pull/18502): BUG: guard against non-finite kd-tree queries +* [#18503](https://github.com/scipy/scipy/pull/18503): Fix PPoly readonly issue for c parameter +* [#18504](https://github.com/scipy/scipy/pull/18504): MAINT: upload nighlighties to new location +* [#18505](https://github.com/scipy/scipy/pull/18505): MAINT: sparse: Generalize isshape to (optionally) handle non-2d… +* [#18507](https://github.com/scipy/scipy/pull/18507): Clean up sparse array API +* [#18508](https://github.com/scipy/scipy/pull/18508): ENH: Ensure that the result of divide(sparse, dense) is sparse +* [#18509](https://github.com/scipy/scipy/pull/18509): Remove indices downcasting for sparse arrays +* [#18510](https://github.com/scipy/scipy/pull/18510): TST: Add regression tests for sparse creation functions. +* [#18513](https://github.com/scipy/scipy/pull/18513): MAINT: sparse: cosmetic updates + typing for sputils +* [#18516](https://github.com/scipy/scipy/pull/18516): DOC: add user guide page introing new sparse arrays +* [#18522](https://github.com/scipy/scipy/pull/18522): Pin prerelease pipeline with Cython>=3.0.0b3 +* [#18523](https://github.com/scipy/scipy/pull/18523): TST: piecemeal updates to `test\_base.py` for sparray conversion +* [#18526](https://github.com/scipy/scipy/pull/18526): DOC: Fix broken reference to count\_nonzero in See Also. +* [#18527](https://github.com/scipy/scipy/pull/18527): try stable sort in mst tree ordering +* [#18528](https://github.com/scipy/scipy/pull/18528): ENH: Update isspmatrix behavior +* [#18531](https://github.com/scipy/scipy/pull/18531): Class names to enable isinstance +* [#18532](https://github.com/scipy/scipy/pull/18532): Fix format property in \_csr.py +* [#18536](https://github.com/scipy/scipy/pull/18536): Add deprecation notices to sparse array docs +* [#18538](https://github.com/scipy/scipy/pull/18538): ENH: sparse: Add \_array version of `diags` creation functions. +* [#18539](https://github.com/scipy/scipy/pull/18539): DOC: sparse: Document sparse canonical formats +* [#18540](https://github.com/scipy/scipy/pull/18540): MAINT: sparse: Deprecate multi-Ellipsis indexing +* [#18542](https://github.com/scipy/scipy/pull/18542): ENH: sparse: add nanmin/nanmax (followup on gh-8902) +* [#18543](https://github.com/scipy/scipy/pull/18543): MAINT: optimize.root\_scalar: ensure that root is a scalar +* [#18545](https://github.com/scipy/scipy/pull/18545): TST: speed up `test\_import\_cycles` +* [#18549](https://github.com/scipy/scipy/pull/18549): TST: optimize: filter RuntimeWarning that does not indicate test… +* [#18550](https://github.com/scipy/scipy/pull/18550): DOC: optimize.OptimizeResult: note that not all listed attributes… +* [#18551](https://github.com/scipy/scipy/pull/18551): Replace sparse \_\_getattr\_\_ with properties +* [#18553](https://github.com/scipy/scipy/pull/18553): BENCH: sparse: Add a benchmark for sparse matrix power +* [#18554](https://github.com/scipy/scipy/pull/18554): BUG: sparse: Fix DIA.tocoo canonical format setting +* [#18556](https://github.com/scipy/scipy/pull/18556): MAINT: io: replace isspmatrix with issparse in mmio module +* [#18560](https://github.com/scipy/scipy/pull/18560): MAINT: integrate: revert`full\_output` deprecation / result… +* [#18562](https://github.com/scipy/scipy/pull/18562): fix doc strings for csr\_array and friends +* [#18563](https://github.com/scipy/scipy/pull/18563): DOC: SciPy 1.11.0 release notes +* [#18591](https://github.com/scipy/scipy/pull/18591): MAINT: version bounds for 1.11.0rc1 +* [#18596](https://github.com/scipy/scipy/pull/18596): DOC: Fix sidebar for API reference pages +* [#18598](https://github.com/scipy/scipy/pull/18598): CI: fix wheel upload to anaconda [wheel build] +* [#18599](https://github.com/scipy/scipy/pull/18599): Revert “ENH: sparse: Add \_array version of `diags` creation… +* [#18608](https://github.com/scipy/scipy/pull/18608): Fix typo of module name in deprecation warning +* [#18629](https://github.com/scipy/scipy/pull/18629): Mark `void` functions as `noexcept` in \_rotation.pyx +* [#18630](https://github.com/scipy/scipy/pull/18630): MAINT: stats: remove long double support for all boost ufuncs +* [#18636](https://github.com/scipy/scipy/pull/18636): MAINT: stats.truncnorm/stats.betaprime: fix \_munp for higher… +* [#18657](https://github.com/scipy/scipy/pull/18657): MAINT: fix ‘no such option’ error in build\_scipy CI +* [#18658](https://github.com/scipy/scipy/pull/18658): TST: fix two test failures that showed up on conda-forge +* [#18659](https://github.com/scipy/scipy/pull/18659): DOC: `scipy.\_sensitivity\_analysis`: correct statement about… +* [#18671](https://github.com/scipy/scipy/pull/18671): MAINT: backports for 1.11.0rc2 +* [#18672](https://github.com/scipy/scipy/pull/18672): BUG: small shim for release process +* [#18676](https://github.com/scipy/scipy/pull/18676): BUG: signal: fix detrend with array-like bp +* [#18697](https://github.com/scipy/scipy/pull/18697): MAINT: NumPy 1.25.0 shims for arm64 +* [#18698](https://github.com/scipy/scipy/pull/18698): DEP: interpolate: delay interp2d deprecation and update link +* [#18724](https://github.com/scipy/scipy/pull/18724): MAINT, REL: prepare for SciPy 1.11.0 “final” +* [#18737](https://github.com/scipy/scipy/pull/18737): TST: flaky TestSOSFreqz::test\_fs\_param +* [#18738](https://github.com/scipy/scipy/pull/18738): TST: flaky `test\_complex\_iir\_dlti` diff --git a/corpus/changelog/scipy_releases/scipy_1111.md b/corpus/changelog/scipy_releases/scipy_1111.md new file mode 100644 index 0000000000000000000000000000000000000000..788a95a07062f7f10046e5b90c974024c39b2490 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1111.md @@ -0,0 +1,46 @@ +# SciPy 1.11.1 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.11.1-notes.html +Version: 1.11.1 + +Contents + +* [SciPy 1.11.1 Release Notes](#scipy-1-11-1-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.11.1](#issues-closed-for-1-11-1) + - [Pull requests for 1.11.1](#pull-requests-for-1-11-1) + +SciPy 1.11.1 is a bug-fix release with no new features +compared to 1.11.0. In particular, a licensing issue +discovered after the release of 1.11.0 has been addressed. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Name (commits) +* h-vetinari (1) +* Robert Kern (1) +* Ilhan Polat (4) +* Tyler Reddy (8) + +A total of 4 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.11.1](#id3)[#](#issues-closed-for-1-11-1 "Link to this heading") + +* [#18739](https://github.com/scipy/scipy/issues/18739): BUG: run method of scipy.odr.ODR class fails when delta0 parameter… +* [#18751](https://github.com/scipy/scipy/issues/18751): BUG: segfault in `scipy.linalg.lu` on x86\_64 windows and macos… +* [#18753](https://github.com/scipy/scipy/issues/18753): BUG: factorial return type inconsistent for 0-dim arrays +* [#18759](https://github.com/scipy/scipy/issues/18759): determinant of a 1x1 matrix returns an array, not a scalar +* [#18765](https://github.com/scipy/scipy/issues/18765): Licensing concern + +### [Pull requests for 1.11.1](#id4)[#](#pull-requests-for-1-11-1 "Link to this heading") + +* [#18741](https://github.com/scipy/scipy/pull/18741): BUG: Fix work array construction for various weight shapes. +* [#18747](https://github.com/scipy/scipy/pull/18747): REL, MAINT: prep for 1.11.1 +* [#18754](https://github.com/scipy/scipy/pull/18754): BUG: fix handling for `factorial(…, exact=False)` for 0-dim… +* [#18762](https://github.com/scipy/scipy/pull/18762): FIX:linalg.lu:Guard against permute\_l out of bound behavior +* [#18763](https://github.com/scipy/scipy/pull/18763): MAINT:linalg.det:Return scalars for singleton inputs +* [#18778](https://github.com/scipy/scipy/pull/18778): MAINT: fix unuran licensing diff --git a/corpus/changelog/scipy_releases/scipy_1112.md b/corpus/changelog/scipy_releases/scipy_1112.md new file mode 100644 index 0000000000000000000000000000000000000000..69f0d6f534b1033b72d494261da70a272fb51c5d --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1112.md @@ -0,0 +1,84 @@ +# SciPy 1.11.2 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.11.2-notes.html +Version: 1.11.2 + +Contents + +* [SciPy 1.11.2 Release Notes](#scipy-1-11-2-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.11.2](#issues-closed-for-1-11-2) + - [Pull requests for 1.11.2](#pull-requests-for-1-11-2) + +SciPy 1.11.2 is a bug-fix release with no new features +compared to 1.11.1. Python 3.12 and musllinux wheels +are provided with this release. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Name (commits) +* Evgeni Burovski (2) +* CJ Carey (3) +* Dieter Werthmüller (1) +* elbarso (1) + +* Ralf Gommers (2) +* Matt Haberland (1) +* jokasimr (1) + +* Thilo Leitzbach (1) + +* LemonBoy (1) + +* Ellie Litwack (2) + +* Sturla Molden (1) +* Andrew Nelson (5) +* Tyler Reddy (39) +* Daniel Schmitz (6) +* Dan Schult (2) +* Albert Steppi (1) +* Matus Valo (1) +* Stefan van der Walt (1) + +A total of 18 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.11.2](#id3)[#](#issues-closed-for-1-11-2 "Link to this heading") + +* [#4690](https://github.com/scipy/scipy/issues/4690): special.jn\_zeros(281, 6) hangs +* [#12247](https://github.com/scipy/scipy/issues/12247): Complex matrix square root of positive semi-definite matrix +* [#18398](https://github.com/scipy/scipy/issues/18398): BUG: `loadmat` fails to load matlab structures with anonymous… +* [#18603](https://github.com/scipy/scipy/issues/18603): BUG: Floating point CSC with int64 indices doesn’t work with… +* [#18730](https://github.com/scipy/scipy/issues/18730): BUG: `scipy.optimize.minimize` fails when `dtype=float32`… +* [#18788](https://github.com/scipy/scipy/issues/18788): DOC: Broken link to installation instructions in README.rst +* [#18792](https://github.com/scipy/scipy/issues/18792): BUG: Build failure with Cython 3.0.0b3 if scipy is already installed +* [#18793](https://github.com/scipy/scipy/issues/18793): BUG: optimize.least\_squares with method=’trf’ yields wrong result… +* [#18800](https://github.com/scipy/scipy/issues/18800): BUG: cKDtree.query no longer accepts DataFrame as input +* [#19002](https://github.com/scipy/scipy/issues/19002): Spalde error with scipy 1.10: 0-th dimension must be fixed +* [#19022](https://github.com/scipy/scipy/issues/19022): BUG: +* [#19026](https://github.com/scipy/scipy/issues/19026): BUG: Compilation of scipy 1.10.1 and 1.11.1 fails with Python… + +### [Pull requests for 1.11.2](#id4)[#](#pull-requests-for-1-11-2 "Link to this heading") + +* [#17918](https://github.com/scipy/scipy/pull/17918): BUG: Fix error in linalg/\_matfuncs\_sqrtm.py +* [#18644](https://github.com/scipy/scipy/pull/18644): BUG: sparse.linalg: Cast index arrays to intc before calling… +* [#18784](https://github.com/scipy/scipy/pull/18784): Allow johnsonsu parameters to be floats +* [#18785](https://github.com/scipy/scipy/pull/18785): MAINT: stats: fix NumPy DeprecationWarnings +* [#18787](https://github.com/scipy/scipy/pull/18787): REL, MAINT: prep for 1.11.2 +* [#18790](https://github.com/scipy/scipy/pull/18790): DOC: Fix broken link to installation guide in README +* [#18804](https://github.com/scipy/scipy/pull/18804): BUG: Ensure cKDtree.query does not pass Pandas DataFrame to np.isfinite +* [#18809](https://github.com/scipy/scipy/pull/18809): CI, MAINT: 32-bit Pillow pin +* [#18810](https://github.com/scipy/scipy/pull/18810): BLD: copy `cython\_optimize.pxd` to build dir +* [#18825](https://github.com/scipy/scipy/pull/18825): BUG: make `L-BFGS-B` optimizer work with single precision gradient +* [#18831](https://github.com/scipy/scipy/pull/18831): BUG: io/matlab: Fix loading of mat files containing fn handles… +* [#18859](https://github.com/scipy/scipy/pull/18859): BUG: make Bessel-roots function not hang and not skip roots +* [#18894](https://github.com/scipy/scipy/pull/18894): DOC: linking interp1d docstring to tutorial +* [#18896](https://github.com/scipy/scipy/pull/18896): BUG: lsq trf gives x=1e-10 if x0 is near a bound +* [#18937](https://github.com/scipy/scipy/pull/18937): CI/BLD: create cp312 wheels +* [#18961](https://github.com/scipy/scipy/pull/18961): DOC: Fix installation instructions using venv/pip +* [#18985](https://github.com/scipy/scipy/pull/18985): CI: move the musllinux Cirrus job to GHA, optimize other jobs +* [#18999](https://github.com/scipy/scipy/pull/18999): CI: reduce Cirrus CI usage during wheel builds +* [#19004](https://github.com/scipy/scipy/pull/19004): BUG: interpolate: fix spalde with len(c) < len(t) +* [#19025](https://github.com/scipy/scipy/pull/19025): BUG: pass unused xrtol in fmin\_bfgs to \_minimize\_bfgs +* [#19027](https://github.com/scipy/scipy/pull/19027): BLD: rename `setup.py` to `\_setup.py` to signal it should… +* [#19034](https://github.com/scipy/scipy/pull/19034): MAINT: NumPy 1.25.x deprecations +* [#19054](https://github.com/scipy/scipy/pull/19054): MAINT: ensure cobyla objective returns scalar diff --git a/corpus/changelog/scipy_releases/scipy_1113.md b/corpus/changelog/scipy_releases/scipy_1113.md new file mode 100644 index 0000000000000000000000000000000000000000..3f9d51f218eaf5f54b49a3df4834e09992288c23 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1113.md @@ -0,0 +1,78 @@ +# SciPy 1.11.3 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.11.3-notes.html +Version: 1.11.3 + +Contents + +* [SciPy 1.11.3 Release Notes](#scipy-1-11-3-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.11.3](#issues-closed-for-1-11-3) + - [Pull requests for 1.11.3](#pull-requests-for-1-11-3) + +SciPy 1.11.3 is a bug-fix release with no new features +compared to 1.11.2. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Name (commits) +* Jake Bowhay (2) +* CJ Carey (1) +* Colin Carroll (1) + +* Anirudh Dagar (2) +* drestebon (1) + +* Ralf Gommers (5) +* Matt Haberland (2) +* Julien Jerphanion (1) +* Uwe L. Korn (1) + +* Ellie Litwack (2) +* Andrew Nelson (5) +* Bharat Raghunathan (1) +* Tyler Reddy (37) +* Søren Fuglede Jørgensen (2) +* Hielke Walinga (1) + +* Warren Weckesser (1) +* Bernhard M. Wiedemann (1) + +A total of 17 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.11.3](#id3)[#](#issues-closed-for-1-11-3 "Link to this heading") + +* [#15093](https://github.com/scipy/scipy/issues/15093): BUG: scipy.optimize’s trust-constr algorithm hangs when keep-feasible… +* [#15273](https://github.com/scipy/scipy/issues/15273): freqz: suboptimal performance for worN=2\*\*n+1, include\_nyquist=True… +* [#17269](https://github.com/scipy/scipy/issues/17269): Bug in scipy.sparse.csgraph.min\_weight\_full\_bipartite\_matching +* [#17289](https://github.com/scipy/scipy/issues/17289): BUG: Different results between numpy.fft.rfft and scipy.signal.freqz +* [#18716](https://github.com/scipy/scipy/issues/18716): Buffer dtype mismatch, expected ‘ITYPE\_t’ but got ‘long’ +* [#18782](https://github.com/scipy/scipy/issues/18782): BUG: johnsonsu distribution no longer accepts integer `b` parameter +* [#18922](https://github.com/scipy/scipy/issues/18922): BUG: dev.py has `distutils` usage +* [#19101](https://github.com/scipy/scipy/issues/19101): BUG: mesonpy embeds random path in .pyx files +* [#19103](https://github.com/scipy/scipy/issues/19103): BUG: Regression in 1.11.2: optimize.least\_squares with method=’trf’… +* [#19132](https://github.com/scipy/scipy/issues/19132): BUG: Build fails on latest commit +* [#19149](https://github.com/scipy/scipy/issues/19149): BUG: scipy.sparse.csgraph.laplacian raises AttributeError on… +* [#19197](https://github.com/scipy/scipy/issues/19197): BUG: Incorrect sampling from zero rank covariance + +### [Pull requests for 1.11.3](#id4)[#](#pull-requests-for-1-11-3 "Link to this heading") + +* [#17633](https://github.com/scipy/scipy/pull/17633): BUG: add infeasibility checks to min\_weight\_full\_bipartite\_matching +* [#18784](https://github.com/scipy/scipy/pull/18784): BUG: Allow johnsonsu parameters to be floats +* [#18913](https://github.com/scipy/scipy/pull/18913): BUG: sparse.csgraph: Support int64 indices in traversal.pyx +* [#18924](https://github.com/scipy/scipy/pull/18924): BUG: Fix python3.12 distutils dev.py build +* [#18956](https://github.com/scipy/scipy/pull/18956): BUG: trust-constr Bounds exclusive +* [#19076](https://github.com/scipy/scipy/pull/19076): MAINT: should not be using np.float64() on arrays +* [#19084](https://github.com/scipy/scipy/pull/19084): REL, MAINT: prep for 1.11.3 +* [#19111](https://github.com/scipy/scipy/pull/19111): BUG: Fixes #19103 by adding back make\_strictly\_feasible to lsq… +* [#19123](https://github.com/scipy/scipy/pull/19123): BLD: Avoid absolute pathnames in .pyx files +* [#19135](https://github.com/scipy/scipy/pull/19135): MAINT: signal: Remove the cval parameter from the private function… +* [#19139](https://github.com/scipy/scipy/pull/19139): BLD: revert to using published wheels [wheel build] +* [#19156](https://github.com/scipy/scipy/pull/19156): BUG: Support sparse arrays in scipy.sparse.csgraph.laplacian +* [#19199](https://github.com/scipy/scipy/pull/19199): MAINT: stats.CovViaEigendecomposition: fix `\_LA` attribute… +* [#19200](https://github.com/scipy/scipy/pull/19200): TST: fix `TestODR.test\_implicit` test failure with tolerance… +* [#19208](https://github.com/scipy/scipy/pull/19208): BUG: freqz rfft grid fix +* [#19280](https://github.com/scipy/scipy/pull/19280): MAINT: newton, make sure x0 is an inexact type +* [#19286](https://github.com/scipy/scipy/pull/19286): BUG: stats: fix build failure due to incorrect Boost policies… +* [#19290](https://github.com/scipy/scipy/pull/19290): BLD: add float.h include to `\_fpumode.c`, fixes Clang on Windows… +* [#19299](https://github.com/scipy/scipy/pull/19299): MAINT: fix libquadmath licence diff --git a/corpus/changelog/scipy_releases/scipy_1114.md b/corpus/changelog/scipy_releases/scipy_1114.md new file mode 100644 index 0000000000000000000000000000000000000000..ac1377b71ae83853d7c4288c035d3aed3d565af8 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1114.md @@ -0,0 +1,63 @@ +# SciPy 1.11.4 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.11.4-notes.html +Version: 1.11.4 + +Contents + +* [SciPy 1.11.4 Release Notes](#scipy-1-11-4-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.11.4](#issues-closed-for-1-11-4) + - [Pull requests for 1.11.4](#pull-requests-for-1-11-4) + +SciPy 1.11.4 is a bug-fix release with no new features +compared to 1.11.3. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Name (commits) +* Jake Bowhay (2) +* Ralf Gommers (4) +* Julien Jerphanion (2) +* Nikolay Mayorov (2) +* Melissa Weber Mendonça (1) +* Tirth Patel (1) +* Tyler Reddy (22) +* Dan Schult (3) +* Nicolas Vetsch (1) + + +A total of 9 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.11.4](#id3)[#](#issues-closed-for-1-11-4 "Link to this heading") + +* [#19189](https://github.com/scipy/scipy/issues/19189): Contradiction in `pyproject.toml` requirements? +* [#19228](https://github.com/scipy/scipy/issues/19228): Doc build fails with Python 3.11 +* [#19245](https://github.com/scipy/scipy/issues/19245): BUG: upcasting of indices dtype from DIA to COO/CSR/BSR arrays +* [#19351](https://github.com/scipy/scipy/issues/19351): BUG: Regression in 1.11.3 can still fail for `optimize.least\_squares`… +* [#19357](https://github.com/scipy/scipy/issues/19357): BUG: build failure with Xcode 15 linker +* [#19359](https://github.com/scipy/scipy/issues/19359): BUG: DiscreteAliasUrn construction fails with UNURANError for… +* [#19387](https://github.com/scipy/scipy/issues/19387): BUG: problem importing libgfortran.5.dylib on macOS Sonoma +* [#19403](https://github.com/scipy/scipy/issues/19403): BUG: scipy.sparse.lil\_matrix division by complex number leads… +* [#19437](https://github.com/scipy/scipy/issues/19437): BUG: can’t install scipy on mac m1 with poetry due to incompatible… +* [#19500](https://github.com/scipy/scipy/issues/19500): DOC: doc build failing +* [#19513](https://github.com/scipy/scipy/issues/19513): BUG: Python version constraints in releases causes issues for… + +### [Pull requests for 1.11.4](#id4)[#](#pull-requests-for-1-11-4 "Link to this heading") + +* [#19230](https://github.com/scipy/scipy/pull/19230): DOC, MAINT: workaround for py311 docs +* [#19307](https://github.com/scipy/scipy/pull/19307): set idx\_dtype in sparse dia\_array.tocoo +* [#19316](https://github.com/scipy/scipy/pull/19316): MAINT: Prep 1.11.4 +* [#19320](https://github.com/scipy/scipy/pull/19320): BLD: fix up version parsing issue in cythonize.py for setup.py… +* [#19329](https://github.com/scipy/scipy/pull/19329): DOC: stats.chisquare: result object contains attribute ‘statistic’ +* [#19335](https://github.com/scipy/scipy/pull/19335): BUG: fix pow method for sparrays with power zero +* [#19364](https://github.com/scipy/scipy/pull/19364): MAINT, BUG: stats: update the UNU.RAN submodule with DAU fix +* [#19379](https://github.com/scipy/scipy/pull/19379): BUG: Restore the original behavior of ‘trf’ from least\_squares… +* [#19400](https://github.com/scipy/scipy/pull/19400): BLD: use classic linker on macOS 14 (Sonoma), the new linker… +* [#19408](https://github.com/scipy/scipy/pull/19408): BUG: Fix typecasting problem in scipy.sparse.lil\_matrix truediv +* [#19504](https://github.com/scipy/scipy/pull/19504): DOC, MAINT: Bump CircleCI Python version to 3.11 +* [#19517](https://github.com/scipy/scipy/pull/19517): MAINT, REL: unpin Python 1.11.x branch +* [#19550](https://github.com/scipy/scipy/pull/19550): MAINT, BLD: poetry loongarch shims diff --git a/corpus/changelog/scipy_releases/scipy_1120.md b/corpus/changelog/scipy_releases/scipy_1120.md new file mode 100644 index 0000000000000000000000000000000000000000..b87f703091a4cc33cc756d85c0a4eff814e41f37 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1120.md @@ -0,0 +1,1105 @@ +# SciPy 1.12.0 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.12.0-notes.html +Version: 1.12.0 + +Contents + +* [SciPy 1.12.0 Release Notes](#scipy-1-12-0-release-notes) + + + [Highlights of this release](#highlights-of-this-release) + + [New features](#new-features) + + - [[`scipy.cluster`](../reference/cluster.html#module-scipy.cluster "scipy.cluster") improvements](#scipy-cluster-improvements) + - [[`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") improvements](#scipy-fft-improvements) + - [[`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") improvements](#scipy-integrate-improvements) + - [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#scipy-interpolate-improvements) + - [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#scipy-linalg-improvements) + - [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#scipy-ndimage-improvements) + - [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#scipy-optimize-improvements) + - [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#scipy-signal-improvements) + - [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#scipy-sparse-improvements) + - [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#scipy-spatial-improvements) + - [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#scipy-special-improvements) + - [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#scipy-stats-improvements) + + [Deprecated features](#deprecated-features) + + [Expired Deprecations](#expired-deprecations) + + [Backwards incompatible changes](#backwards-incompatible-changes) + + [Other changes](#other-changes) + + [Authors](#authors) + + [Issues closed for 1.12.0](#issues-closed-for-1-12-0) + + [Pull requests for 1.12.0](#pull-requests-for-1-12-0) + +SciPy 1.12.0 is the culmination of 6 months of hard work. It contains +many new features, numerous bug-fixes, improved test coverage and better +documentation. There have been a number of deprecations and API changes +in this release, which are documented below. All users are encouraged to +upgrade to this release, as there are a large number of bug-fixes and +optimizations. Before upgrading, we recommend that users check that +their own code does not use deprecated SciPy functionality (to do so, +run your code with `python -Wd` and check for `DeprecationWarning` s). +Our development attention will now shift to bug-fix releases on the +1.12.x branch, and on adding new features on the main branch. + +This release requires Python 3.9+ and NumPy 1.22.4 or greater. + +For running on PyPy, PyPy3 6.0+ is required. + +## [Highlights of this release](#id2)[#](#highlights-of-this-release "Link to this heading") + +* Experimental support for the array API standard has been added to part of + [`scipy.special`](../reference/special.html#module-scipy.special "scipy.special"), and to all of [`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") and [`scipy.cluster`](../reference/cluster.html#module-scipy.cluster "scipy.cluster"). There are + likely to be bugs and early feedback for usage with CuPy arrays, PyTorch + tensors, and other array API compatible libraries is appreciated. Use the + `SCIPY_ARRAY_API` environment variable for testing. +* A new class, `ShortTimeFFT`, provides a more versatile implementation of the + short-time Fourier transform (STFT), its inverse (ISTFT) as well as the (cross-) + spectrogram. It utilizes an improved algorithm for calculating the ISTFT. +* Several new constructors have been added for sparse arrays, and many operations + now additionally support sparse arrays, further facilitating the migration + from sparse matrices. +* A large portion of the [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") API now has improved support for handling + `NaN` values, masked arrays, and more fine-grained shape-handling. The + accuracy and performance of a number of `stats` methods have been improved, + and a number of new statistical tests and distributions have been added. + +## [New features](#id3)[#](#new-features "Link to this heading") + +### [[`scipy.cluster`](../reference/cluster.html#module-scipy.cluster "scipy.cluster") improvements](#id4)[#](#scipy-cluster-improvements "Link to this heading") + +* Experimental support added for the array API standard; PyTorch tensors, + CuPy arrays and array API compatible array libraries are now accepted + (GPU support is limited to functions with pure Python implementations). + CPU arrays which can be converted to and from NumPy are supported + module-wide and returned arrays will match the input type. + This behaviour is enabled by setting the `SCIPY_ARRAY_API` environment + variable before importing `scipy`. This experimental support is still + under development and likely to contain bugs - testing is very welcome. + +### [[`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") improvements](#id5)[#](#scipy-fft-improvements "Link to this heading") + +* Experimental support added for the array API standard; functions which are + part of the `fft` array API standard extension module, as well as the + Fast Hankel Transforms and the basic FFTs which are not in the extension + module, now accept PyTorch tensors, CuPy arrays and array API compatible + array libraries. CPU arrays which can be converted to and from NumPy arrays + are supported module-wide and returned arrays will match the input type. + This behaviour is enabled by setting the `SCIPY_ARRAY_API` environment + variable before importing `scipy`. This experimental support is still under + development and likely to contain bugs - testing is very welcome. + +### [[`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") improvements](#id6)[#](#scipy-integrate-improvements "Link to this heading") + +* Added [`scipy.integrate.cumulative_simpson`](../reference/generated/scipy.integrate.cumulative_simpson.html#scipy.integrate.cumulative_simpson "scipy.integrate.cumulative_simpson") for cumulative quadrature + from sampled data using Simpson’s 1/3 rule. + +### [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#id7)[#](#scipy-interpolate-improvements "Link to this heading") + +* New class `NdBSpline` represents tensor-product splines in N dimensions. + This class only knows how to evaluate a tensor product given coefficients + and knot vectors. This way it generalizes `BSpline` for 1D data to N-D, and + parallels `NdPPoly` (which represents N-D tensor product polynomials). + Evaluations exploit the localized nature of b-splines. +* `NearestNDInterpolator.__call__` accepts `**query_options`, which are + passed through to the `KDTree.query` call to find nearest neighbors. This + allows, for instance, to limit the neighbor search distance and parallelize + the query using the `workers` keyword. +* `BarycentricInterpolator` now allows computing the derivatives. +* It is now possible to change interpolation values in an existing + `CloughTocher2DInterpolator` instance, while also saving the barycentric + coordinates of interpolation points. + +### [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#id8)[#](#scipy-linalg-improvements "Link to this heading") + +* Access to new low-level LAPACK functions is provided via `dtgsyl` and + `stgsyl`. + +### [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#id9)[#](#scipy-ndimage-improvements "Link to this heading") + +### [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#id10)[#](#scipy-optimize-improvements "Link to this heading") + +* [`scipy.optimize.isotonic_regression`](../reference/generated/scipy.optimize.isotonic_regression.html#scipy.optimize.isotonic_regression "scipy.optimize.isotonic_regression") has been added to allow nonparametric isotonic + regression. +* [`scipy.optimize.nnls`](../reference/generated/scipy.optimize.nnls.html#scipy.optimize.nnls "scipy.optimize.nnls") is rewritten in Python and now implements the so-called + fnnls or fast nnls, making it more efficient for high-dimensional problems. +* The result object of [`scipy.optimize.root`](../reference/generated/scipy.optimize.root.html#scipy.optimize.root "scipy.optimize.root") and [`scipy.optimize.root_scalar`](../reference/generated/scipy.optimize.root_scalar.html#scipy.optimize.root_scalar "scipy.optimize.root_scalar") + now reports the method used. +* The `callback` method of [`scipy.optimize.differential_evolution`](../reference/generated/scipy.optimize.differential_evolution.html#scipy.optimize.differential_evolution "scipy.optimize.differential_evolution") can now be + passed more detailed information via the `intermediate_results` keyword + parameter. Also, the evolution `strategy` now accepts a callable for + additional customization. The performance of `differential_evolution` has + also been improved. +* [`scipy.optimize.minimize`](../reference/generated/scipy.optimize.minimize.html#scipy.optimize.minimize "scipy.optimize.minimize") method `Newton-CG` now supports functions that + return sparse Hessian matrices/arrays for the `hess` parameter and is slightly + more efficient. +* [`scipy.optimize.minimize`](../reference/generated/scipy.optimize.minimize.html#scipy.optimize.minimize "scipy.optimize.minimize") method `BFGS` now accepts an initial estimate for the + inverse of the Hessian, which allows for more efficient workflows in some + circumstances. The new parameter is `hess_inv0`. +* [`scipy.optimize.minimize`](../reference/generated/scipy.optimize.minimize.html#scipy.optimize.minimize "scipy.optimize.minimize") methods `CG`, `Newton-CG`, and `BFGS` now accept + parameters `c1` and `c2`, allowing specification of the Armijo and curvature rule + parameters, respectively. +* [`scipy.optimize.curve_fit`](../reference/generated/scipy.optimize.curve_fit.html#scipy.optimize.curve_fit "scipy.optimize.curve_fit") performance has improved due to more efficient memoization + of the callable function. + +### [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#id11)[#](#scipy-signal-improvements "Link to this heading") + +* `freqz`, `freqz_zpk`, and `group_delay` are now more accurate + when `fs` has a default value. +* The new class `ShortTimeFFT` provides a more versatile implementation of the + short-time Fourier transform (STFT), its inverse (ISTFT) as well as the (cross-) + spectrogram. It utilizes an improved algorithm for calculating the ISTFT based on + dual windows and provides more fine-grained control of the parametrization especially + in regard to scaling and phase-shift. Functionality was implemented to ease + working with signal and STFT chunks. A section has been added to the “SciPy User Guide” + providing algorithmic details. The functions `stft`, `istft` and `spectrogram` + have been marked as legacy. + +### [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#id12)[#](#scipy-sparse-improvements "Link to this heading") + +* `sparse.linalg` iterative solvers `sparse.linalg.cg`, + `sparse.linalg.cgs`, `sparse.linalg.bicg`, `sparse.linalg.bicgstab`, + `sparse.linalg.gmres`, and `sparse.linalg.qmr` are rewritten in Python. +* Updated vendored SuperLU version to `6.0.1`, along with a few additional + fixes. +* Sparse arrays have gained additional constructors: `eye_array`, + `random_array`, `block_array`, and `identity`. `kron` and `kronsum` + have been adjusted to additionally support operation on sparse arrays. +* Sparse matrices now support a transpose with `axes=(1, 0)`, to mirror + the `.T` method. +* `LaplacianNd` now allows selection of the largest subset of eigenvalues, + and additionally now supports retrieval of the corresponding eigenvectors. + The performance of `LaplacianNd` has also been improved. +* The performance of `dok_matrix` and `dok_array` has been improved, + and their inheritance behavior should be more robust. +* `hstack`, `vstack`, and `block_diag` now work with sparse arrays, and + preserve the input sparse type. +* A new function, [`scipy.sparse.linalg.matrix_power`](../reference/generated/scipy.sparse.linalg.matrix_power.html#scipy.sparse.linalg.matrix_power "scipy.sparse.linalg.matrix_power"), has been added, allowing + for exponentiation of sparse arrays. + +### [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#id13)[#](#scipy-spatial-improvements "Link to this heading") + +* Two new methods were implemented for `spatial.transform.Rotation`: + `__pow__` to raise a rotation to integer or fractional power and + `approx_equal` to check if two rotations are approximately equal. +* The method `Rotation.align_vectors` was extended to solve a constrained + alignment problem where two vectors are required to be aligned precisely. + Also when given a single pair of vectors, the algorithm now returns the + rotation with minimal magnitude, which can be considered as a minor + backward incompatible change. +* A new representation for `spatial.transform.Rotation` called Davenport + angles is available through `from_davenport` and `as_davenport` methods. +* Performance improvements have been added to `distance.hamming` and + `distance.correlation`. +* Improved performance of `SphericalVoronoi` `sort_vertices_of_regions` + and two dimensional area calculations. + +### [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#id14)[#](#scipy-special-improvements "Link to this heading") + +* Added [`scipy.special.stirling2`](../reference/generated/scipy.special.stirling2.html#scipy.special.stirling2 "scipy.special.stirling2") for computation of Stirling numbers of the + second kind. Both exact calculation and an asymptotic approximation + (the default) are supported via `exact=True` and `exact=False` (the + default) respectively. +* Added [`scipy.special.betaincc`](../reference/generated/scipy.special.betaincc.html#scipy.special.betaincc "scipy.special.betaincc") for computation of the complementary + incomplete Beta function and [`scipy.special.betainccinv`](../reference/generated/scipy.special.betainccinv.html#scipy.special.betainccinv "scipy.special.betainccinv") for computation of + its inverse. +* Improved precision of [`scipy.special.betainc`](../reference/generated/scipy.special.betainc.html#scipy.special.betainc "scipy.special.betainc") and [`scipy.special.betaincinv`](../reference/generated/scipy.special.betaincinv.html#scipy.special.betaincinv "scipy.special.betaincinv"). +* Experimental support added for alternative backends: functions + [`scipy.special.log_ndtr`](../reference/generated/scipy.special.log_ndtr.html#scipy.special.log_ndtr "scipy.special.log_ndtr"), [`scipy.special.ndtr`](../reference/generated/scipy.special.ndtr.html#scipy.special.ndtr "scipy.special.ndtr"), [`scipy.special.ndtri`](../reference/generated/scipy.special.ndtri.html#scipy.special.ndtri "scipy.special.ndtri"), + [`scipy.special.erf`](../reference/generated/scipy.special.erf.html#scipy.special.erf "scipy.special.erf"), [`scipy.special.erfc`](../reference/generated/scipy.special.erfc.html#scipy.special.erfc "scipy.special.erfc"), [`scipy.special.i0`](../reference/generated/scipy.special.i0.html#scipy.special.i0 "scipy.special.i0"), + [`scipy.special.i0e`](../reference/generated/scipy.special.i0e.html#scipy.special.i0e "scipy.special.i0e"), [`scipy.special.i1`](../reference/generated/scipy.special.i1.html#scipy.special.i1 "scipy.special.i1"), [`scipy.special.i1e`](../reference/generated/scipy.special.i1e.html#scipy.special.i1e "scipy.special.i1e"), + [`scipy.special.gammaln`](../reference/generated/scipy.special.gammaln.html#scipy.special.gammaln "scipy.special.gammaln"), [`scipy.special.gammainc`](../reference/generated/scipy.special.gammainc.html#scipy.special.gammainc "scipy.special.gammainc"), [`scipy.special.gammaincc`](../reference/generated/scipy.special.gammaincc.html#scipy.special.gammaincc "scipy.special.gammaincc"), + [`scipy.special.logit`](../reference/generated/scipy.special.logit.html#scipy.special.logit "scipy.special.logit"), and [`scipy.special.expit`](../reference/generated/scipy.special.expit.html#scipy.special.expit "scipy.special.expit") now accept PyTorch tensors + and CuPy arrays. These features are still under development and likely to + contain bugs, so they are disabled by default; enable them by setting a + `SCIPY_ARRAY_API` environment variable to `1` before importing `scipy`. + Testing is appreciated! + +### [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#id15)[#](#scipy-stats-improvements "Link to this heading") + +* Added [`scipy.stats.quantile_test`](../reference/generated/scipy.stats.quantile_test.html#scipy.stats.quantile_test "scipy.stats.quantile_test"), a nonparametric test of whether a + hypothesized value is the quantile associated with a specified probability. + The `confidence_interval` method of the result object gives a confidence + interval of the quantile. +* [`scipy.stats.sampling.FastGeneratorInversion`](../reference/generated/scipy.stats.sampling.FastGeneratorInversion.html#scipy.stats.sampling.FastGeneratorInversion "scipy.stats.sampling.FastGeneratorInversion") provides a convenient + interface to fast random sampling via numerical inversion of distribution + CDFs. +* *scipy.stats.geometric\_discrepancy* adds geometric/topological discrepancy + metrics for random samples. +* [`scipy.stats.multivariate_normal`](../reference/generated/scipy.stats.multivariate_normal.html#scipy.stats.multivariate_normal "scipy.stats.multivariate_normal") now has a `fit` method for fitting + distribution parameters to data via maximum likelihood estimation. +* [`scipy.stats.bws_test`](../reference/generated/scipy.stats.bws_test.html#scipy.stats.bws_test "scipy.stats.bws_test") performs the Baumgartner-Weiss-Schindler test of + whether two-samples were drawn from the same distribution. +* [`scipy.stats.jf_skew_t`](../reference/generated/scipy.stats.jf_skew_t.html#scipy.stats.jf_skew_t "scipy.stats.jf_skew_t") implements the Jones and Faddy skew-t distribution. +* [`scipy.stats.anderson_ksamp`](../reference/generated/scipy.stats.anderson_ksamp.html#scipy.stats.anderson_ksamp "scipy.stats.anderson_ksamp") now supports a permutation version of the test + using the `method` parameter. +* The `fit` methods of [`scipy.stats.halfcauchy`](../reference/generated/scipy.stats.halfcauchy.html#scipy.stats.halfcauchy "scipy.stats.halfcauchy"), [`scipy.stats.halflogistic`](../reference/generated/scipy.stats.halflogistic.html#scipy.stats.halflogistic "scipy.stats.halflogistic"), and + [`scipy.stats.halfnorm`](../reference/generated/scipy.stats.halfnorm.html#scipy.stats.halfnorm "scipy.stats.halfnorm") are faster and more accurate. +* [`scipy.stats.beta`](../reference/generated/scipy.stats.beta.html#scipy.stats.beta "scipy.stats.beta") `entropy` accuracy has been improved for extreme values of + distribution parameters. +* The accuracy of `sf` and/or `isf` methods have been improved for + several distributions: [`scipy.stats.burr`](../reference/generated/scipy.stats.burr.html#scipy.stats.burr "scipy.stats.burr"), [`scipy.stats.hypsecant`](../reference/generated/scipy.stats.hypsecant.html#scipy.stats.hypsecant "scipy.stats.hypsecant"), + [`scipy.stats.kappa3`](../reference/generated/scipy.stats.kappa3.html#scipy.stats.kappa3 "scipy.stats.kappa3"), [`scipy.stats.loglaplace`](../reference/generated/scipy.stats.loglaplace.html#scipy.stats.loglaplace "scipy.stats.loglaplace"), [`scipy.stats.lognorm`](../reference/generated/scipy.stats.lognorm.html#scipy.stats.lognorm "scipy.stats.lognorm"), + [`scipy.stats.lomax`](../reference/generated/scipy.stats.lomax.html#scipy.stats.lomax "scipy.stats.lomax"), [`scipy.stats.pearson3`](../reference/generated/scipy.stats.pearson3.html#scipy.stats.pearson3 "scipy.stats.pearson3"), [`scipy.stats.rdist`](../reference/generated/scipy.stats.rdist.html#scipy.stats.rdist "scipy.stats.rdist"), and + [`scipy.stats.pareto`](../reference/generated/scipy.stats.pareto.html#scipy.stats.pareto "scipy.stats.pareto"). +* The following functions now support parameters `axis`, `nan_policy`, and + `keep_dims`: [`scipy.stats.entropy`](../reference/generated/scipy.stats.entropy.html#scipy.stats.entropy "scipy.stats.entropy"), [`scipy.stats.differential_entropy`](../reference/generated/scipy.stats.differential_entropy.html#scipy.stats.differential_entropy "scipy.stats.differential_entropy"), + [`scipy.stats.variation`](../reference/generated/scipy.stats.variation.html#scipy.stats.variation "scipy.stats.variation"), [`scipy.stats.ansari`](../reference/generated/scipy.stats.ansari.html#scipy.stats.ansari "scipy.stats.ansari"), [`scipy.stats.bartlett`](../reference/generated/scipy.stats.bartlett.html#scipy.stats.bartlett "scipy.stats.bartlett"), + [`scipy.stats.levene`](../reference/generated/scipy.stats.levene.html#scipy.stats.levene "scipy.stats.levene"), [`scipy.stats.fligner`](../reference/generated/scipy.stats.fligner.html#scipy.stats.fligner "scipy.stats.fligner"), [`scipy.stats.circmean`](../reference/generated/scipy.stats.circmean.html#scipy.stats.circmean "scipy.stats.circmean"), + [`scipy.stats.circvar`](../reference/generated/scipy.stats.circvar.html#scipy.stats.circvar "scipy.stats.circvar"), [`scipy.stats.circstd`](../reference/generated/scipy.stats.circstd.html#scipy.stats.circstd "scipy.stats.circstd"), [`scipy.stats.tmean`](../reference/generated/scipy.stats.tmean.html#scipy.stats.tmean "scipy.stats.tmean"), + [`scipy.stats.tvar`](../reference/generated/scipy.stats.tvar.html#scipy.stats.tvar "scipy.stats.tvar"), [`scipy.stats.tstd`](../reference/generated/scipy.stats.tstd.html#scipy.stats.tstd "scipy.stats.tstd"), [`scipy.stats.tmin`](../reference/generated/scipy.stats.tmin.html#scipy.stats.tmin "scipy.stats.tmin"), [`scipy.stats.tmax`](../reference/generated/scipy.stats.tmax.html#scipy.stats.tmax "scipy.stats.tmax"), + and [`scipy.stats.tsem`](../reference/generated/scipy.stats.tsem.html#scipy.stats.tsem "scipy.stats.tsem"). +* The `logpdf` and `fit` methods of [`scipy.stats.skewnorm`](../reference/generated/scipy.stats.skewnorm.html#scipy.stats.skewnorm "scipy.stats.skewnorm") have been improved. +* The beta negative binomial distribution is implemented as [`scipy.stats.betanbinom`](../reference/generated/scipy.stats.betanbinom.html#scipy.stats.betanbinom "scipy.stats.betanbinom"). +* Improved performance of [`scipy.stats.invwishart`](../reference/generated/scipy.stats.invwishart.html#scipy.stats.invwishart "scipy.stats.invwishart") `rvs` and `logpdf`. +* A source of intermediate overflow in [`scipy.stats.boxcox_normmax`](../reference/generated/scipy.stats.boxcox_normmax.html#scipy.stats.boxcox_normmax "scipy.stats.boxcox_normmax") with + `method='mle'` has been eliminated, and the returned value of `lmbda` is + constrained such that the transformed data will not overflow. +* [`scipy.stats.nakagami`](../reference/generated/scipy.stats.nakagami.html#scipy.stats.nakagami "scipy.stats.nakagami") `stats` is more accurate and reliable. +* A source of intermediate overflow in *scipy.norminvgauss.pdf* has been eliminated. +* Added support for masked arrays to [`scipy.stats.circmean`](../reference/generated/scipy.stats.circmean.html#scipy.stats.circmean "scipy.stats.circmean"), [`scipy.stats.circvar`](../reference/generated/scipy.stats.circvar.html#scipy.stats.circvar "scipy.stats.circvar"), + [`scipy.stats.circstd`](../reference/generated/scipy.stats.circstd.html#scipy.stats.circstd "scipy.stats.circstd"), and [`scipy.stats.entropy`](../reference/generated/scipy.stats.entropy.html#scipy.stats.entropy "scipy.stats.entropy"). +* [`scipy.stats.dirichlet`](../reference/generated/scipy.stats.dirichlet.html#scipy.stats.dirichlet "scipy.stats.dirichlet") has gained a new covariance (`cov`) method. +* Improved accuracy of `entropy` method of [`scipy.stats.multivariate_t`](../reference/generated/scipy.stats.multivariate_t.html#scipy.stats.multivariate_t "scipy.stats.multivariate_t") for large + degrees of freedom. +* [`scipy.stats.loggamma`](../reference/generated/scipy.stats.loggamma.html#scipy.stats.loggamma "scipy.stats.loggamma") has an improved `entropy` method. + +## [Deprecated features](#id16)[#](#deprecated-features "Link to this heading") + +* Error messages have been made clearer for objects that don’t exist in the + public namespace and warnings sharpened for private attributes that are not + supposed to be imported at all. +* *scipy.signal.cmplx\_sort* has been deprecated and will be removed in + SciPy 1.15. A replacement you can use is provided in the deprecation message. +* Values the argument `initial` of [`scipy.integrate.cumulative_trapezoid`](../reference/generated/scipy.integrate.cumulative_trapezoid.html#scipy.integrate.cumulative_trapezoid "scipy.integrate.cumulative_trapezoid") + other than `0` and `None` are now deprecated. +* *scipy.stats.rvs\_ratio\_uniforms* is deprecated in favour of + [`scipy.stats.sampling.RatioUniforms`](../reference/generated/scipy.stats.sampling.RatioUniforms.html#scipy.stats.sampling.RatioUniforms "scipy.stats.sampling.RatioUniforms") +* *scipy.integrate.quadrature* and *scipy.integrate.romberg* have been + deprecated due to accuracy issues and interface shortcomings. They will + be removed in SciPy 1.15. Please use [`scipy.integrate.quad`](../reference/generated/scipy.integrate.quad.html#scipy.integrate.quad "scipy.integrate.quad") instead. +* Coinciding with upcoming changes to function signatures (e.g. removal of a + deprecated keyword), we are deprecating positional use of keyword arguments + for the affected functions, which will raise an error starting with + SciPy 1.14. In some cases, this has delayed the originally announced + removal date, to give time to respond to the second part of the deprecation. + Affected functions are: + + + `linalg.{eigh, eigvalsh, pinv}` + + `integrate.simpson` + + `signal.{firls, firwin, firwin2, remez}` + + `sparse.linalg.{bicg, bicgstab, cg, cgs, gcrotmk, gmres, lgmres, minres, qmr, tfqmr}` + + `special.comb` + + `stats.kendalltau` +* All wavelet functions have been deprecated, as PyWavelets provides suitable + implementations; affected functions are: `signal.{daub, qmf, cascade, + morlet, morlet2, ricker, cwt}` +* `scipy.integrate.trapz`, `scipy.integrate.cumtrapz`, and `scipy.integrate.simps` have + been deprecated in favour of [`scipy.integrate.trapezoid`](../reference/generated/scipy.integrate.trapezoid.html#scipy.integrate.trapezoid "scipy.integrate.trapezoid"), [`scipy.integrate.cumulative_trapezoid`](../reference/generated/scipy.integrate.cumulative_trapezoid.html#scipy.integrate.cumulative_trapezoid "scipy.integrate.cumulative_trapezoid"), + and [`scipy.integrate.simpson`](../reference/generated/scipy.integrate.simpson.html#scipy.integrate.simpson "scipy.integrate.simpson") respectively and will be removed in SciPy 1.14. +* The `tol` argument of `scipy.sparse.linalg.{bicg,bicgstab,cg,cgs,gcrotmk,gmres,lgmres,minres,qmr,tfqmr}` + is now deprecated in favour of `rtol` and will be removed in SciPy 1.14. + Furthermore, the default value of `atol` for these functions is due + to change to `0.0` in SciPy 1.14. + +## [Expired Deprecations](#id17)[#](#expired-deprecations "Link to this heading") + +There is an ongoing effort to follow through on long-standing deprecations. +The following previously deprecated features are affected: + +* The `centered` keyword of [`scipy.stats.qmc.LatinHypercube`](../reference/generated/scipy.stats.qmc.LatinHypercube.html#scipy.stats.qmc.LatinHypercube "scipy.stats.qmc.LatinHypercube") has been removed. + Use `scrambled=False` instead of `centered=True`. +* `scipy.stats.binom_test` has been removed in favour of [`scipy.stats.binomtest`](../reference/generated/scipy.stats.binomtest.html#scipy.stats.binomtest "scipy.stats.binomtest"). +* In [`scipy.stats.iqr`](../reference/generated/scipy.stats.iqr.html#scipy.stats.iqr "scipy.stats.iqr"), the use of `scale='raw'` has been removed in favour + of `scale=1`. +* Functions from NumPy’s main namespace which were exposed in SciPy’s main + namespace, such as `numpy.histogram` exposed by `scipy.histogram`, have + been removed from SciPy’s main namespace. Please use the functions directly + from `numpy`. + +## [Backwards incompatible changes](#id18)[#](#backwards-incompatible-changes "Link to this heading") + +## [Other changes](#id19)[#](#other-changes "Link to this heading") + +* The arguments used to compile and link SciPy are now available via + `show_config`. + +## [Authors](#id20)[#](#authors "Link to this heading") + +* Name (commits) +* endolith (1) +* h-vetinari (34) +* Tom Adamczewski (3) + +* Anudeep Adiraju (1) + +* akeemlh (1) +* Alex Amadori (2) + +* Raja Yashwanth Avantsa (2) + +* Seth Axen (1) + +* Ross Barnowski (1) +* Dan Barzilay (1) + +* Ashish Bastola (1) + +* Christoph Baumgarten (2) +* Ben Beasley (3) + +* Doron Behar (1) +* Peter Bell (1) +* Sebastian Berg (1) +* Ben Boeckel (1) + +* David Boetius (1) + +* Matt Borland (1) +* Jake Bowhay (103) +* Larry Bradley (1) + +* Dietrich Brunn (5) +* Evgeni Burovski (102) +* Matthias Bussonnier (18) +* CJ Carey (6) +* Colin Carroll (1) + +* Aadya Chinubhai (1) + +* Luca Citi (1) +* Lucas Colley (141) + +* com3dian (1) + +* Anirudh Dagar (4) +* Danni (1) + +* Dieter Werthmüller (1) +* John Doe (2) + +* Philippe DONNAT (2) + +* drestebon (1) + +* Thomas Duvernay (1) +* elbarso (1) + +* emilfrost (2) + +* Paul Estano (8) + +* Evandro (2) +* Franz Király (1) + +* Nikita Furin (1) + +* gabrielthomsen (1) + +* Lukas Geiger (9) + +* Artem Glebov (22) + +* Caden Gobat (1) +* Ralf Gommers (127) +* Alexander Goscinski (2) + +* Rohit Goswami (2) + +* Olivier Grisel (1) +* Matt Haberland (244) +* Charles Harris (1) +* harshilkamdar (1) + +* Alon Hovav (2) + +* Gert-Ludwig Ingold (1) +* Romain Jacob (1) + +* jcwhitehead (1) + +* Julien Jerphanion (13) +* He Jia (1) +* JohnWT (1) + +* jokasimr (1) + +* Evan W Jones (1) +* Karen Róbertsdóttir (1) + +* Ganesh Kathiresan (1) +* Robert Kern (11) +* Andrew Knyazev (4) +* Uwe L. Korn (1) + +* Rishi Kulkarni (1) +* Kale Kundert (3) + +* Jozsef Kutas (2) +* Kyle0 (2) + +* Robert Langefeld (1) + +* Jeffrey Larson (1) + +* Jessy Lauer (1) + +* lciti (1) + +* Hoang Le (1) + +* Antony Lee (5) +* Thilo Leitzbach (4) + +* LemonBoy (2) + +* Ellie Litwack (8) + +* Thomas Loke (4) + +* Malte Londschien (1) + +* Christian Lorentzen (6) +* Adam Lugowski (10) + +* lutefiskhotdish (1) +* mainak33 (1) + +* Ben Mares (11) + +* mart-mihkel (2) + +* Mateusz Sokół (24) + +* Nikolay Mayorov (4) +* Nicholas McKibben (1) +* Melissa Weber Mendonça (7) +* Michał Górny (1) +* Kat Mistberg (2) + +* mkiffer (1) + +* mocquin (1) + +* Nicolas Mokus (2) + +* Sturla Molden (1) +* Roberto Pastor Muela (3) + +* Bijay Nayak (1) + +* Andrew Nelson (105) +* Praveer Nidamaluri (3) + +* Lysandros Nikolaou (2) +* Dimitri Papadopoulos Orfanos (7) +* Pablo Rodríguez Pérez (1) + +* Dimitri Papadopoulos (2) +* Tirth Patel (14) +* Kyle Paterson (1) + +* Paul (4) + +* Yann Pellegrini (2) + +* Matti Picus (4) +* Ilhan Polat (36) +* Pranav (1) + +* Bharat Raghunathan (1) +* Chris Rapson (1) + +* Matteo Raso (4) +* Tyler Reddy (215) +* Martin Reinecke (1) +* Tilo Reneau-Cardoso (1) + +* resting-dove (2) + +* Simon Segerblom Rex (4) +* Lucas Roberts (2) +* Pamphile Roy (31) +* Feras Saad (3) + +* Atsushi Sakai (3) +* Masahiro Sakai (2) + +* Omar Salman (14) +* Andrej Savikin (1) + +* Daniel Schmitz (55) +* Dan Schult (19) +* Scott Shambaugh (9) +* Sheila-nk (2) + +* Mauro Silberberg (3) + +* Maciej Skorski (1) + +* Laurent Sorber (1) + +* Albert Steppi (28) +* Kai Striega (1) +* Saswat Susmoy (1) + +* Alex Szatmary (1) + +* Søren Fuglede Jørgensen (3) +* othmane tamri (3) + +* Ewout ter Hoeven (1) +* Will Tirone (1) +* TLeitzbach (1) + +* Kevin Topolski (1) + +* Edgar Andrés Margffoy Tuay (1) +* Dipansh Uikey (1) + +* Matus Valo (3) +* Christian Veenhuis (2) +* Nicolas Vetsch (1) + +* Isaac Virshup (7) +* Hielke Walinga (2) + +* Stefan van der Walt (2) +* Warren Weckesser (7) +* Bernhard M. Wiedemann (4) +* Levi John Wolf (1) +* Xuefeng Xu (4) + +* Rory Yorke (2) +* YoussefAli1 (1) + +* Irwin Zaid (4) + +* Jinzhe Zeng (1) + +* JIMMY ZHAO (1) + + +A total of 163 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +## [Issues closed for 1.12.0](#id21)[#](#issues-closed-for-1-12-0 "Link to this heading") + +* [#2725](https://github.com/scipy/scipy/issues/2725): Barycentric interpolation should allow evaluation of derivatives +* [#4244](https://github.com/scipy/scipy/issues/4244): betaincinv accuracy +* [#4677](https://github.com/scipy/scipy/issues/4677): Unexpected behavior from scipy.special.btdtri +* [#4819](https://github.com/scipy/scipy/issues/4819): Comparison operator overloading doesn’t work with sparse matrices +* [#5022](https://github.com/scipy/scipy/issues/5022): bicg returns last iterate, not the smallest-residue vector +* [#6198](https://github.com/scipy/scipy/issues/6198): callback for Krylov methods +* [#7241](https://github.com/scipy/scipy/issues/7241): ENH: Implement Chandrupatla’s algorithm for root finding (simpler/faster… +* [#8792](https://github.com/scipy/scipy/issues/8792): Newton-CG throws error when Hessian is a `scipy.sparse` class +* [#9527](https://github.com/scipy/scipy/issues/9527): Anderson-Darling ksamples can not estimate p-values beyond given… +* [#11516](https://github.com/scipy/scipy/issues/11516): Recommend ccache for benchmarks in contributor documentation +* [#12017](https://github.com/scipy/scipy/issues/12017): Expose FACTOR parameter instead of using magic number in scipy.optimize.nnls +* [#12748](https://github.com/scipy/scipy/issues/12748): Convergence issue of GMRES +* [#12796](https://github.com/scipy/scipy/issues/12796): BUG: nonmonotonicity in betaincinv, btdtri, stats.beta.ppf +* [#13306](https://github.com/scipy/scipy/issues/13306): griddata with multiple data values +* [#13437](https://github.com/scipy/scipy/issues/13437): DOC: Add example as to how to use solve\_ivp to solve complex… +* [#14037](https://github.com/scipy/scipy/issues/14037): ENH: other quality metrics for random sampling +* [#14480](https://github.com/scipy/scipy/issues/14480): LSODA implementation of dense output yields incorrect result +* [#15676](https://github.com/scipy/scipy/issues/15676): ENH: Implement `multivariate\_normal.fit` +* [#15738](https://github.com/scipy/scipy/issues/15738): DEP: change default of atol in `scipy.sparse.linalg.\*` +* [#16729](https://github.com/scipy/scipy/issues/16729): \_fitpack / dfitpack duplication +* [#16880](https://github.com/scipy/scipy/issues/16880): ENH: Add Rotation.align\_vector +* [#17290](https://github.com/scipy/scipy/issues/17290): ENH: multi dimensional wasserstein/earth mover distance in Scipy +* [#17398](https://github.com/scipy/scipy/issues/17398): BUG: Documentation for `scipy.optimize.differential\_evolution`… +* [#17462](https://github.com/scipy/scipy/issues/17462): ENH: Create Rotations by aligning a primary axis and best-fitting… +* [#17493](https://github.com/scipy/scipy/issues/17493): BUG: stats: Occasional failures of some tests of `levy\_stable` +* [#17572](https://github.com/scipy/scipy/issues/17572): BUG: Deprecation warning says to use non-existent symbols +* [#17706](https://github.com/scipy/scipy/issues/17706): ENH: add isotonic regression +* [#17734](https://github.com/scipy/scipy/issues/17734): BUG: dijkstra algorithm is returning different results in v1.10… +* [#17744](https://github.com/scipy/scipy/issues/17744): BUG: test\_maxiter\_worsening[lgmres] failed on riscv +* [#17756](https://github.com/scipy/scipy/issues/17756): DOC: dimension clarification in `directed\_hausdorff ` +* [#17771](https://github.com/scipy/scipy/issues/17771): BUG: cannot import ODEintWarning from scipy.integrate +* [#17864](https://github.com/scipy/scipy/issues/17864): ENH: feature request for initial hessian estimate in scipy bfgs… +* [#17890](https://github.com/scipy/scipy/issues/17890): ENH: Stirling Numbers of the second Kind +* [#18093](https://github.com/scipy/scipy/issues/18093): BUG: entropy calculations failing for large values +* [#18279](https://github.com/scipy/scipy/issues/18279): BUG: deprecation warnings for private API are misleading +* [#18316](https://github.com/scipy/scipy/issues/18316): DOC: update scipy.stats.truncnorm.rvs example +* [#18389](https://github.com/scipy/scipy/issues/18389): BUG: Yeo-Johnson Power Transformer gives Numpy warning +* [#18404](https://github.com/scipy/scipy/issues/18404): ENH: Add wrapper for LAPACK functions stgsyl and dtgsyl +* [#18432](https://github.com/scipy/scipy/issues/18432): BUG: levy\_stable.pdf does not use pdf\_default\_method\_name attribute +* [#18452](https://github.com/scipy/scipy/issues/18452): BUG: DST 2 and 3 with `norm=”ortho”` are not orthogonal +* [#18457](https://github.com/scipy/scipy/issues/18457): DOC: clarify that `prewitt` filter does not return the magnitude… +* [#18506](https://github.com/scipy/scipy/issues/18506): BUG: Strange behavior of scipy.stats.hypergeom.sf function with… +* [#18511](https://github.com/scipy/scipy/issues/18511): BUG: Incorrect hypergeometric mean calculation +* [#18564](https://github.com/scipy/scipy/issues/18564): BUG: `rv\_discrete` fails when support is unbounded below +* [#18568](https://github.com/scipy/scipy/issues/18568): BUG: circe-ci eigenvalue-LOBPCG benchmarks do not check accuracy… +* [#18577](https://github.com/scipy/scipy/issues/18577): DEP: deprecate positional arguments in `sparse.gmres` +* [#18578](https://github.com/scipy/scipy/issues/18578): DEP: deprecate positional arguments in `stats.kendalltau` +* [#18579](https://github.com/scipy/scipy/issues/18579): DEP: deprecate positional arguments in `firwin\*` +* [#18580](https://github.com/scipy/scipy/issues/18580): DEP: removal of `scale=’raw’` in `iqr` +* [#18581](https://github.com/scipy/scipy/issues/18581): DEP: removal of `stats.binom\_test` +* [#18582](https://github.com/scipy/scipy/issues/18582): DEP: removal of parameter `centered` of `stats.qmc.LatinHypercube` +* [#18592](https://github.com/scipy/scipy/issues/18592): Semantics of sparse array creation functions +* [#18637](https://github.com/scipy/scipy/issues/18637): BUG: Anaconda environment creation with python 3.11 +* [#18639](https://github.com/scipy/scipy/issues/18639): ENH: `multivariate\_normal.rvs` extremely slow +* [#18643](https://github.com/scipy/scipy/issues/18643): DOC: Problem with the randint description +* [#18647](https://github.com/scipy/scipy/issues/18647): BUG: dgbmv gives “(len(x)>offx+(trans==0?m-1:n-1)\*abs(incx))… +* [#18651](https://github.com/scipy/scipy/issues/18651): DOC: Missing equal sign in equation of Lomb-Scargle periodogram +* [#18669](https://github.com/scipy/scipy/issues/18669): DOC: sparse docs “matrix” and “array” mixup +* [#18680](https://github.com/scipy/scipy/issues/18680): stats: XSLOW test failures in TestFit +* [#18702](https://github.com/scipy/scipy/issues/18702): DEP: deprecate aliased integration methods that are (close to)… +* [#18721](https://github.com/scipy/scipy/issues/18721): TST: Cause of `test\_linsolve.py` test failure +* [#18748](https://github.com/scipy/scipy/issues/18748): [DOC] Incorrect docstring for `boxcox\_normmax` argument `method=”mle”`,… +* [#18836](https://github.com/scipy/scipy/issues/18836): DOC: API reference doesn’t point users to replacement for interp1d +* [#18838](https://github.com/scipy/scipy/issues/18838): BUG: stats.burr12: distribution returns invalid moments +* [#18839](https://github.com/scipy/scipy/issues/18839): ENH: concatenating sparse arrays should return sparse arrays +* [#18849](https://github.com/scipy/scipy/issues/18849): BUG: `python dev.py bench` fails +* [#18860](https://github.com/scipy/scipy/issues/18860): BUG/BENCH: clough\_tocher benchmark fails +* [#18864](https://github.com/scipy/scipy/issues/18864): BUG: curve\_fit memoization causes significant overhead in function… +* [#18868](https://github.com/scipy/scipy/issues/18868): CI/BENCH: Fail on error +* [#18876](https://github.com/scipy/scipy/issues/18876): DOC: integrate: clarify that event and jac must have the same… +* [#18881](https://github.com/scipy/scipy/issues/18881): DOC: lobpcg examples improvement +* [#18903](https://github.com/scipy/scipy/issues/18903): DOC: links in hacking.rst go back to hacking.rst instead of their… +* [#18939](https://github.com/scipy/scipy/issues/18939): ENH: add new representations for Sakurai and Mikota matrices… +* [#18944](https://github.com/scipy/scipy/issues/18944): How to change the default setup for using res.plot() +* [#18953](https://github.com/scipy/scipy/issues/18953): BUG: ``scipy.optimize.\_differentialevolution`` incorrectly… +* [#18966](https://github.com/scipy/scipy/issues/18966): BUG: `PyArray\_MAX` no longer available in `numpy/arrayobject.h` +* [#18981](https://github.com/scipy/scipy/issues/18981): ENH: Publish musllinux wheels to PyPI +* [#18984](https://github.com/scipy/scipy/issues/18984): DOC: scipy.stats.lognorm — SciPy v1.12.0.dev Manual +* [#18987](https://github.com/scipy/scipy/issues/18987): BUG: reproducible builds problem in \_stats\_pythran.cpython-311-x86\_64-linux-gnu.so +* [#19008](https://github.com/scipy/scipy/issues/19008): DOC: error in scipy.integrate.DOP853 +* [#19009](https://github.com/scipy/scipy/issues/19009): DOC: Maybe a typo on the parameter ‘alternative’ in the Mann-Whitney… +* [#19024](https://github.com/scipy/scipy/issues/19024): BUG: #18481 made BFGS minimization less accurate +* [#19039](https://github.com/scipy/scipy/issues/19039): BUG: stats.zscore returns all NaN if given masked array with… +* [#19049](https://github.com/scipy/scipy/issues/19049): TST: add test for gh-17918 +* [#19056](https://github.com/scipy/scipy/issues/19056): ENH: add computing a selected number `m` of extreme eigenpairs… +* [#19063](https://github.com/scipy/scipy/issues/19063): DOC: typo in scipy.linalg.pinv.html +* [#19075](https://github.com/scipy/scipy/issues/19075): ENH: Allow to choose line-search parameters in related optimization… +* [#19082](https://github.com/scipy/scipy/issues/19082): MAINT, REL: Programming Language directive +* [#19090](https://github.com/scipy/scipy/issues/19090): BUG: root\_scalar (newton method), inconsistent objective function… +* [#19092](https://github.com/scipy/scipy/issues/19092): ENH: update vendored SuperLU version +* [#19098](https://github.com/scipy/scipy/issues/19098): ENH: add method in RootResults of root\_scalar and root +* [#19102](https://github.com/scipy/scipy/issues/19102): BUG: `least\_squares` with `method=’trf’` with initial params… +* [#19117](https://github.com/scipy/scipy/issues/19117): TST/MAINT: `AssertionError`s with fresh build on M1 macOS +* [#19118](https://github.com/scipy/scipy/issues/19118): BUG: `np`-coercible array-likes are not accepted with array… +* [#19140](https://github.com/scipy/scipy/issues/19140): DOC: stats: alternative loc-scale handling in levy\_stable +* [#19147](https://github.com/scipy/scipy/issues/19147): BUG: asfarray is removed from numpy +* [#19150](https://github.com/scipy/scipy/issues/19150): build warnings from pythran (?) +* [#19158](https://github.com/scipy/scipy/issues/19158): BUG: Source archives have bogus timestamps +* [#19161](https://github.com/scipy/scipy/issues/19161): ENH: allow `sparse\_matrix.transpose(axes=(1, 0))` +* [#19167](https://github.com/scipy/scipy/issues/19167): BUG: build graph non-determinism +* [#19177](https://github.com/scipy/scipy/issues/19177): TST: SphericalVoronoi tests not sensitive to regions internal… +* [#19185](https://github.com/scipy/scipy/issues/19185): BUG: minimize\_scalar not checking entire area specified by bounds +* [#19188](https://github.com/scipy/scipy/issues/19188): DOC: 1D arrays with KDTree +* [#19190](https://github.com/scipy/scipy/issues/19190): TST: skip reason incorrect in some cases, related to array API… +* [#19193](https://github.com/scipy/scipy/issues/19193): DOC: typo in scipy.stats.Covariance +* [#19241](https://github.com/scipy/scipy/issues/19241): BUG: utils from scipy.sparse.sputils are not available from scipy.sparse… +* [#19273](https://github.com/scipy/scipy/issues/19273): Calculation of frequencies w is not accurate when fs is default… +* [#19276](https://github.com/scipy/scipy/issues/19276): MAINT: array types: make `compliance\_scipy` more strict +* [#19332](https://github.com/scipy/scipy/issues/19332): ENH: help `skewnorm.fit` find global minimum +* [#19352](https://github.com/scipy/scipy/issues/19352): CI, BUILD: SciPy build failure with Cython 3.0.3 (bisected) +* [#19363](https://github.com/scipy/scipy/issues/19363): DOC: inconsistent terminology at scipy.interpolate.griddata.html +* [#19373](https://github.com/scipy/scipy/issues/19373): DOC: interpolate: add note to BarycentricInterpolator.add\_xi… +* [#19396](https://github.com/scipy/scipy/issues/19396): BUG: L-BFGS-B has surprisingly high memory consumption +* [#19398](https://github.com/scipy/scipy/issues/19398): BUG: Missing assertion in test\_filter\_design.py +* [#19406](https://github.com/scipy/scipy/issues/19406): CI, MAINT: known CI issue with NumPy main/latest +* [#19442](https://github.com/scipy/scipy/issues/19442): BUG: Error collecting tests due to inconsistent parameterization… +* [#19448](https://github.com/scipy/scipy/issues/19448): DOC:fft: next\_fast\_len signature is empty in docs +* [#19490](https://github.com/scipy/scipy/issues/19490): MAINT: lint: fail inventory +* [#19544](https://github.com/scipy/scipy/issues/19544): DOC/MAINT: refguide-check errors +* [#19553](https://github.com/scipy/scipy/issues/19553): BUG: Test suite leaks file descriptors (`OSError: [Errno 24]… +* [#19565](https://github.com/scipy/scipy/issues/19565): DOC/DX: `meson-python` missing from ‘required build dependencies’ +* [#19568](https://github.com/scipy/scipy/issues/19568): DOC/DX: `cd scipy` missing from ‘Building from source’ +* [#19575](https://github.com/scipy/scipy/issues/19575): BUG: scipy.ndimage.watershed\_ift cost data type is too small… +* [#19577](https://github.com/scipy/scipy/issues/19577): Windows build problems related to fast matrix market parts +* [#19599](https://github.com/scipy/scipy/issues/19599): ENH: Returning NotImplemented when multiplying sparse arrays… +* [#19612](https://github.com/scipy/scipy/issues/19612): ENH: add best cost function evaluation to differential evolution… +* [#19616](https://github.com/scipy/scipy/issues/19616): BUG: Normal Inverse Gaussian numerically unstable +* [#19620](https://github.com/scipy/scipy/issues/19620): \_lib: Test error in test\_warning\_calls\_filters because of a Python… +* [#19636](https://github.com/scipy/scipy/issues/19636): DOC: issue in documentation for the callback argument in scipy.optimize.minimize +* [#19640](https://github.com/scipy/scipy/issues/19640): CI, MAINT: pre-release job failures with scipy-openblas32 +* [#19726](https://github.com/scipy/scipy/issues/19726): BUG: 1.12.0rc1: build failure on windows due to macro collision… +* [#19747](https://github.com/scipy/scipy/issues/19747): BUG: Invalid `IndexError` from `scipy.stats.nbinom.logcdf` +* [#19795](https://github.com/scipy/scipy/issues/19795): MAINT: need stable Pythran release for SciPy 1.12.0 RC2 +* [#19804](https://github.com/scipy/scipy/issues/19804): MAINT/TST: Warnings failing test suite with `pytest 8` +* [#19852](https://github.com/scipy/scipy/issues/19852): CI, MAINT: Windows 3.11 CI failure with file access issue +* [#19906](https://github.com/scipy/scipy/issues/19906): BUG: 1.12.0rc2 SciPy rather than scipy in `pip list` output + +## [Pull requests for 1.12.0](#id22)[#](#pull-requests-for-1-12-0 "Link to this heading") + +* [#12680](https://github.com/scipy/scipy/pull/12680): ENH: stats: add nonparametric one-sample quantile test and CI +* [#14103](https://github.com/scipy/scipy/pull/14103): DOC: integrate: Add complex matrix DE solution to examples +* [#14552](https://github.com/scipy/scipy/pull/14552): BUG: Fix LSODA interpolation scheme +* [#17408](https://github.com/scipy/scipy/pull/17408): ENH: Short-Time Fourier Transform (STFT) Enhancements +* [#17452](https://github.com/scipy/scipy/pull/17452): ENH: Add the \_\_pow\_\_ operator for Rotations +* [#17460](https://github.com/scipy/scipy/pull/17460): ENH: New Rotation method approx\_equal() +* [#17473](https://github.com/scipy/scipy/pull/17473): ENH: stats: multivariate Wasserstein distance/EMD +* [#17495](https://github.com/scipy/scipy/pull/17495): DOC: Optimize: update DE documentation +* [#17542](https://github.com/scipy/scipy/pull/17542): ENH: Extend Rotation.align\_vectors() to allow an infinite weight,… +* [#17697](https://github.com/scipy/scipy/pull/17697): ENH: special: Improvements for the incomplete beta functions. +* [#17719](https://github.com/scipy/scipy/pull/17719): ENH: Add Chandrupatla’s algorithm to optimize.\_zeros\_py.py to… +* [#17722](https://github.com/scipy/scipy/pull/17722): ENH add pava and isotonic\_regression +* [#17728](https://github.com/scipy/scipy/pull/17728): ENH: Implemented Rotation.from\_davenport and Rotation.as\_davenport +* [#17757](https://github.com/scipy/scipy/pull/17757): DOC: clarify input dimensions for `directed\_hausdorff` method +* [#17955](https://github.com/scipy/scipy/pull/17955): ENH: add simplified fast numerical inversion to stats.sampling +* [#18103](https://github.com/scipy/scipy/pull/18103): ENH: add stirling2 function to `scipy.special` +* [#18133](https://github.com/scipy/scipy/pull/18133): BUG: Fix fails of some tests and bad behaviour for x=zeta in… +* [#18151](https://github.com/scipy/scipy/pull/18151): ENH: add cumulative\_simpson integration to scipy.integrate +* [#18156](https://github.com/scipy/scipy/pull/18156): ENH: Added loggamma entropy method +* [#18197](https://github.com/scipy/scipy/pull/18197): ENH: Add derivatives for BarycentricInterpolator +* [#18219](https://github.com/scipy/scipy/pull/18219): DEP: integrate: Deprecate `initial` values other than None… +* [#18348](https://github.com/scipy/scipy/pull/18348): ENH: add private function to bracket root of monotonic function +* [#18361](https://github.com/scipy/scipy/pull/18361): ENH: add `fit` method to `multivariate\_normal` +* [#18363](https://github.com/scipy/scipy/pull/18363): ENH: stats: add Baumgartner-Weiss-Schindler test +* [#18376](https://github.com/scipy/scipy/pull/18376): ENH: CloughTocher2DInterpolator multiple times with different… +* [#18465](https://github.com/scipy/scipy/pull/18465): ENH: asymptotic expansion for multivariate t entropy +* [#18470](https://github.com/scipy/scipy/pull/18470): ENH: stats.anderson\_ksamp: re-add permutation version of test +* [#18477](https://github.com/scipy/scipy/pull/18477): DOC: stats.truncnorm: add example about truncation points +* [#18481](https://github.com/scipy/scipy/pull/18481): MAINT: differentiable fns respect float width. Closes #15602 +* [#18488](https://github.com/scipy/scipy/pull/18488): MAINT:ENH:sparse.linalg: Rewrite iterative solvers in Python,… +* [#18492](https://github.com/scipy/scipy/pull/18492): Add NdBSpline: n-dim tensor product b-spline object +* [#18496](https://github.com/scipy/scipy/pull/18496): ENH: Faster \_select\_samples in \_differential\_evolution.py +* [#18499](https://github.com/scipy/scipy/pull/18499): ENH: asymptotic expansion for beta entropy for large a and b +* [#18544](https://github.com/scipy/scipy/pull/18544): ENH: sparse.linalg: Implement matrix\_power() +* [#18552](https://github.com/scipy/scipy/pull/18552): DOC: stats.laplace\_asymmetric: note relationship between scale… +* [#18570](https://github.com/scipy/scipy/pull/18570): ENH:optimize: Rewrite nnls in Python +* [#18571](https://github.com/scipy/scipy/pull/18571): ENH: linalg: Add wrapper for `?tgsyl` +* [#18575](https://github.com/scipy/scipy/pull/18575): REL: set version to 1.12.0.dev0 +* [#18585](https://github.com/scipy/scipy/pull/18585): DOC: stats.rv\_discrete: note that default methods are not compatible… +* [#18586](https://github.com/scipy/scipy/pull/18586): ENH: override sf for rdist distribution +* [#18587](https://github.com/scipy/scipy/pull/18587): DEP: signal: deprecate cmplx\_sort +* [#18589](https://github.com/scipy/scipy/pull/18589): DEP: remove parameter centered of stats.qmc.LatinHypercube +* [#18594](https://github.com/scipy/scipy/pull/18594): DOC: more explicit example usage of scipy.linalg.lu\_factor +* [#18602](https://github.com/scipy/scipy/pull/18602): MAINT: stats.hypergeom.mean: correct for large args +* [#18606](https://github.com/scipy/scipy/pull/18606): ENH: override sf for Pearson3 distribution +* [#18609](https://github.com/scipy/scipy/pull/18609): TST: update nonlin tests for sparse arrays +* [#18610](https://github.com/scipy/scipy/pull/18610): DEP: stats: remove deprecated binom\_test +* [#18612](https://github.com/scipy/scipy/pull/18612): DEP: stats.iqr: remove deprecated `scale=’raw’` +* [#18613](https://github.com/scipy/scipy/pull/18613): BUG: fix ortho mode in DST type 2/3 +* [#18614](https://github.com/scipy/scipy/pull/18614): MAINT: don’t override sf for loguniform/reciprocal distribution +* [#18616](https://github.com/scipy/scipy/pull/18616): ENH: override sf in loglaplace distribution +* [#18617](https://github.com/scipy/scipy/pull/18617): MAINT: interpolate: delete duplicated FITPACK bisplev interface +* [#18620](https://github.com/scipy/scipy/pull/18620): MAINT: signal: avoid eval/exec in hilbert2 +* [#18622](https://github.com/scipy/scipy/pull/18622): MAINT: Move rvs\_ratio\_uniforms to sampling +* [#18624](https://github.com/scipy/scipy/pull/18624): DEP: adjust deprecation of positional arguments +* [#18631](https://github.com/scipy/scipy/pull/18631): ENH: Add `fast\_matrix\_market` to scipy.io +* [#18633](https://github.com/scipy/scipy/pull/18633): BUG: Fix issue levy\_stable.pdf +* [#18640](https://github.com/scipy/scipy/pull/18640): MAINT: Fix lint warnings in `\_traversal.pyx` +* [#18641](https://github.com/scipy/scipy/pull/18641): ENH: makes `\_covariance` a cached property +* [#18649](https://github.com/scipy/scipy/pull/18649): DEP: scipy.stats.morestats: clarify deprecation warnings +* [#18652](https://github.com/scipy/scipy/pull/18652): BUG: Fixes how the length of argument x of linalg.blas.?gbmv… +* [#18653](https://github.com/scipy/scipy/pull/18653): DOC: Add missing equal sign to Lomb-Scargle periodogram equation +* [#18661](https://github.com/scipy/scipy/pull/18661): CI: update `SCIPY\_NIGHTLY\_UPLOAD\_TOKEN` on CirrusCI. +* [#18664](https://github.com/scipy/scipy/pull/18664): ENH: stats.dirichlet: add covariance method +* [#18666](https://github.com/scipy/scipy/pull/18666): DEV: update environment.yml, removing setuptools +* [#18667](https://github.com/scipy/scipy/pull/18667): DEV: Add Windows specific instructions to environment.yml +* [#18668](https://github.com/scipy/scipy/pull/18668): ENH: add machinery to support Array API +* [#18670](https://github.com/scipy/scipy/pull/18670): MAINT: signal: deduplicate \*ord functions +* [#18677](https://github.com/scipy/scipy/pull/18677): TST: linalg: improve seeding of some tests that are a problem… +* [#18679](https://github.com/scipy/scipy/pull/18679): MAINT:stats:Cythonize and remove Fortran statlib code +* [#18682](https://github.com/scipy/scipy/pull/18682): TST: stats: fix xslow test failures +* [#18686](https://github.com/scipy/scipy/pull/18686): DEV: Add ability to run memory benchmarks on macOS +* [#18689](https://github.com/scipy/scipy/pull/18689): CI: test with Python 3.12-beta +* [#18690](https://github.com/scipy/scipy/pull/18690): DOC: mention that `genlogistic` is one of several types of… +* [#18692](https://github.com/scipy/scipy/pull/18692): MAINT: signal: replace `np.r\_[“-1”, arrays]` by a more sane… +* [#18694](https://github.com/scipy/scipy/pull/18694): DOC: signal: Updated Chebyshev 2 documentation +* [#18695](https://github.com/scipy/scipy/pull/18695): ENH: override halflogistic fit for free parameters +* [#18696](https://github.com/scipy/scipy/pull/18696): MAINT Fix broken link in scipy.optimize.\_differentialevolution.py +* [#18699](https://github.com/scipy/scipy/pull/18699): DEP: integrate: deprecate old aliases +* [#18705](https://github.com/scipy/scipy/pull/18705): MAINT Optimize link in scipy.optimize.\_differentialevolution.py +* [#18706](https://github.com/scipy/scipy/pull/18706): DOC: linalg: various doc improvements +* [#18708](https://github.com/scipy/scipy/pull/18708): MAINT: signal/dlsim: avoid using interp1d; use make\_interp\_spline… +* [#18710](https://github.com/scipy/scipy/pull/18710): MAINT: remove np.r\_[“-1”, …] +* [#18712](https://github.com/scipy/scipy/pull/18712): MAINT: bump minimal supported NumPy version to 1.22.4 +* [#18713](https://github.com/scipy/scipy/pull/18713): MAINT: fix linter error in `\_fitpack\_impl.py` +* [#18714](https://github.com/scipy/scipy/pull/18714): ENH: Improve beta entropy when one argument is large +* [#18715](https://github.com/scipy/scipy/pull/18715): MAINT: signal: remove duplicated \_atleast\_2d\_or\_none +* [#18718](https://github.com/scipy/scipy/pull/18718): TST: mark two tests of `lsq\_linear` as xslow +* [#18719](https://github.com/scipy/scipy/pull/18719): MAINT: optimize.\_chandrupatla: result object fixup +* [#18720](https://github.com/scipy/scipy/pull/18720): DOC: Fix notational variation in \_lbfgsb\_py.py: “pg\_i” and “proj… +* [#18723](https://github.com/scipy/scipy/pull/18723): MAINT:sparse.linalg: Use \_NoValue for deprecated kwargs +* [#18726](https://github.com/scipy/scipy/pull/18726): ENH: improve halflogistic distribution fitting with fixed parameters +* [#18727](https://github.com/scipy/scipy/pull/18727): MAINT: Add skip CI link to PR template +* [#18728](https://github.com/scipy/scipy/pull/18728): MAINT: optimize.\_chandrupatla: refactor for code reuse +* [#18729](https://github.com/scipy/scipy/pull/18729): DOC: Add note connecting weibull\_min to standard exponential. +* [#18734](https://github.com/scipy/scipy/pull/18734): MAINT: Update codeowners +* [#18742](https://github.com/scipy/scipy/pull/18742): ENH: differential\_evolution callback accepts intermediate\_result +* [#18744](https://github.com/scipy/scipy/pull/18744): TST:sparse.linalg:Relax test\_hermitian\_modes tolerances +* [#18746](https://github.com/scipy/scipy/pull/18746): MAINT: forward port 1.11.0 relnotes +* [#18755](https://github.com/scipy/scipy/pull/18755): ENH: override isf for Burr distribution +* [#18756](https://github.com/scipy/scipy/pull/18756): DOC: stats.boxcox\_normmax: correct minimize -> maximize +* [#18758](https://github.com/scipy/scipy/pull/18758): DOC: Document performance cliff for scipy.sparse.random +* [#18760](https://github.com/scipy/scipy/pull/18760): ENH: override halfnorm fit +* [#18764](https://github.com/scipy/scipy/pull/18764): ENH: stats: add informative error message to `boxcox\_normmax`… +* [#18771](https://github.com/scipy/scipy/pull/18771): Fix typo from #18758 +* [#18777](https://github.com/scipy/scipy/pull/18777): DOC: Clarify Prewitt filter +* [#18783](https://github.com/scipy/scipy/pull/18783): ENH: stats: Implement \_sf and \_isf for hypsecant. +* [#18786](https://github.com/scipy/scipy/pull/18786): MAINT: forward port 1.11.1 relnotes +* [#18794](https://github.com/scipy/scipy/pull/18794): MAINT: fix `halflogistic.fit` for bad location guess +* [#18795](https://github.com/scipy/scipy/pull/18795): BUG, DOC: Correct `adsurl` value and add a general `url`… +* [#18799](https://github.com/scipy/scipy/pull/18799): ENH: simplify `gausshyper.pdf` +* [#18802](https://github.com/scipy/scipy/pull/18802): MAINT: Use `sparse.diags` instead of `spdiags` internally. +* [#18803](https://github.com/scipy/scipy/pull/18803): MAINT: `rv\_discrete` should raise with duplicate `xk` in… +* [#18807](https://github.com/scipy/scipy/pull/18807): ENH: remove unnecessary root-find from skewnorm +* [#18808](https://github.com/scipy/scipy/pull/18808): TST: test for gh-18800 +* [#18812](https://github.com/scipy/scipy/pull/18812): DEP: linalg: sharpen deprecation warning for pinv {,r}cond +* [#18814](https://github.com/scipy/scipy/pull/18814): DOC: update windows instructions and move conda/mamba +* [#18815](https://github.com/scipy/scipy/pull/18815): ENH:stats: Add \_isf method to loglaplace +* [#18816](https://github.com/scipy/scipy/pull/18816): ENH:stats: Add \_isf method to lognorm +* [#18817](https://github.com/scipy/scipy/pull/18817): DOC: Fix examples in randint description +* [#18818](https://github.com/scipy/scipy/pull/18818): MAINT: Simplify codespaces env activation +* [#18819](https://github.com/scipy/scipy/pull/18819): TST: stats.dgamma.pdf: adjust test that fails intermittently +* [#18820](https://github.com/scipy/scipy/pull/18820): ENH:stats: Add \_isf method to pareto +* [#18822](https://github.com/scipy/scipy/pull/18822): ENH:stats: Add \_sf and \_isf methods to kappa3 +* [#18823](https://github.com/scipy/scipy/pull/18823): ENH:stats: Add \_isf method to lomax +* [#18824](https://github.com/scipy/scipy/pull/18824): ENH: override halfcauchy distribution fit +* [#18826](https://github.com/scipy/scipy/pull/18826): DEP: linalg: use \_NoValue for eigh/eigvalsh positional argument… +* [#18829](https://github.com/scipy/scipy/pull/18829): ENH: optimize: vectorized minimization of univariate functions +* [#18830](https://github.com/scipy/scipy/pull/18830): DOC: soften wording on import guidelines, mention lazy loading +* [#18833](https://github.com/scipy/scipy/pull/18833): ENH: optimize: release the GIL while computing the LSAP solution +* [#18835](https://github.com/scipy/scipy/pull/18835): DEP: scipy.stats.stats: clarify deprecation warnings +* [#18840](https://github.com/scipy/scipy/pull/18840): MAINT: stats.burr12: moments are undefined when c\*d <= order +* [#18841](https://github.com/scipy/scipy/pull/18841): MAINT: \*sctype\* replace NumPy 2.0 +* [#18843](https://github.com/scipy/scipy/pull/18843): DEP: vendor sklearn’s mechanism to deprecate passing kwargs positionally +* [#18846](https://github.com/scipy/scipy/pull/18846): MAINT: Reduce file size of the SVG files included in `signal.rst` +* [#18847](https://github.com/scipy/scipy/pull/18847): MAINT: ptp no method for NumPy 2.0 +* [#18848](https://github.com/scipy/scipy/pull/18848): ENH: add compile and link args to `show\_config` output +* [#18850](https://github.com/scipy/scipy/pull/18850): ENH: improve performance of `SphericalVoronoi` area calculation +* [#18852](https://github.com/scipy/scipy/pull/18852): BUG: fix overflow in stats.yeojohnson +* [#18853](https://github.com/scipy/scipy/pull/18853): BENCH: Remove factorial benchmarks +* [#18854](https://github.com/scipy/scipy/pull/18854): MAINT: signal: lighten the notation in lsim +* [#18856](https://github.com/scipy/scipy/pull/18856): MAINT: Remove more runtests.py stuff +* [#18858](https://github.com/scipy/scipy/pull/18858): MAINT: clean up views/strides/dtypes utilities in `cluster.hierarcy` +* [#18861](https://github.com/scipy/scipy/pull/18861): MAINT: avoid `np.deprecate` and `np.core`, add `normalize\_axis\_index`… +* [#18862](https://github.com/scipy/scipy/pull/18862): ENH: sparse arrays for hstack, vstack, bmat, block\_diag. New… +* [#18863](https://github.com/scipy/scipy/pull/18863): DEP: remove extra np.deprecate and add docs back +* [#18872](https://github.com/scipy/scipy/pull/18872): DOC: Add relationship between Fisk (log-logistic) and logistic. +* [#18873](https://github.com/scipy/scipy/pull/18873): DOC: add more cross compilation details +* [#18885](https://github.com/scipy/scipy/pull/18885): DOC: minor issues in install commands +* [#18886](https://github.com/scipy/scipy/pull/18886): MAINT/DOC: remove docstring issues in ndimage +* [#18887](https://github.com/scipy/scipy/pull/18887): DOC: tab sync based on same tab name using ``sync`` statement +* [#18888](https://github.com/scipy/scipy/pull/18888): MAINT: Set RAM requirement for Codespaces +* [#18889](https://github.com/scipy/scipy/pull/18889): CI: Add prerelease build with 64bit OpenBLAS nightly +* [#18893](https://github.com/scipy/scipy/pull/18893): ENH: Geometric quality metrics for random sampling +* [#18898](https://github.com/scipy/scipy/pull/18898): DOC: fix sparse docs “matrix” and “array” mixup +* [#18905](https://github.com/scipy/scipy/pull/18905): DOC: Clarify DOF in f-distribution notes +* [#18910](https://github.com/scipy/scipy/pull/18910): DOC: from CONTRIBUTING.rst link to SciPy website +* [#18911](https://github.com/scipy/scipy/pull/18911): DOC/MAINT: `special` doc fixes +* [#18914](https://github.com/scipy/scipy/pull/18914): ENH: Enhance `dev.py` by adding command to query PYTHONPATH +* [#18916](https://github.com/scipy/scipy/pull/18916): DEP: stats: improve deprecation of private but present modules +* [#18917](https://github.com/scipy/scipy/pull/18917): ENH: move {c, q}spline\_1d to use sosfilt/lfilter +* [#18920](https://github.com/scipy/scipy/pull/18920): DOC: indicate functions with multiple valid solutions in csgraph +* [#18927](https://github.com/scipy/scipy/pull/18927): TST: use Hypothesis for property-based tests +* [#18929](https://github.com/scipy/scipy/pull/18929): ENH: change sparse dok from subclass of dict to have attribute… +* [#18930](https://github.com/scipy/scipy/pull/18930): ENH: \_lib.\_util: make \_lazywhere compatible with Array API +* [#18931](https://github.com/scipy/scipy/pull/18931): MAINT: cleanup redundant tests for `vonmises.fit` +* [#18932](https://github.com/scipy/scipy/pull/18932): DEP: deprecate positional arguments for some methods in signal.\_fir\_f… +* [#18933](https://github.com/scipy/scipy/pull/18933): DEP: deprecate positional arguments for special.comb +* [#18934](https://github.com/scipy/scipy/pull/18934): DEP: deprecate positional arguments for some methods in sparse.linalg… +* [#18935](https://github.com/scipy/scipy/pull/18935): DEP: deprecate positional arguments for linalg.pinv +* [#18936](https://github.com/scipy/scipy/pull/18936): DEP: deprecate positional arguments for stats.kendalltau +* [#18942](https://github.com/scipy/scipy/pull/18942): CI: Change OpenBLAS nightly wheel location +* [#18943](https://github.com/scipy/scipy/pull/18943): DEP: sparse.linalg: deprecate positional arguments for gcrotmk,… +* [#18946](https://github.com/scipy/scipy/pull/18946): DEP: linalg: deprecate positional args for eigh/eigvalsh +* [#18948](https://github.com/scipy/scipy/pull/18948): ENH: Jones and Faddy Skew-T distribution +* [#18949](https://github.com/scipy/scipy/pull/18949): DOC: stats.FitResult.plot: add example +* [#18952](https://github.com/scipy/scipy/pull/18952): MAINT: Remove `.\_is\_array` since there’s now: `isinstance(x,… +* [#18954](https://github.com/scipy/scipy/pull/18954): BENCH: update/rewrite lobpcg benchmark sparse\_linalg\_lobpcg.py +* [#18955](https://github.com/scipy/scipy/pull/18955): MAINT/DOC: spatial: Document and test the double cover property… +* [#18958](https://github.com/scipy/scipy/pull/18958): MAINT: optimize.differential\_evolution: clarify that bounds must… +* [#18962](https://github.com/scipy/scipy/pull/18962): Update name of coverage action +* [#18963](https://github.com/scipy/scipy/pull/18963): ENH:sparse.linalg: Add LaplacianNd class to special sparse arrays +* [#18967](https://github.com/scipy/scipy/pull/18967): MAINT: redefine `PyArray\_MAX`/`PyArray\_MIN` because they… +* [#18968](https://github.com/scipy/scipy/pull/18968): DEP: optimize: improve deprecation of private modules named without… +* [#18970](https://github.com/scipy/scipy/pull/18970): DEP: integrate: improve deprecation of private modules named… +* [#18973](https://github.com/scipy/scipy/pull/18973): MAINT: linalg: remove a stray np.cast +* [#18975](https://github.com/scipy/scipy/pull/18975): ENH: Port scipy to use new numpy complex types +* [#18977](https://github.com/scipy/scipy/pull/18977): ENH: Expose c1 and c2 of scalar\_search\_wolfe to fmin\_bfgs +* [#18986](https://github.com/scipy/scipy/pull/18986): ENH: add possibility to fix parameters in multivariate normal… +* [#18992](https://github.com/scipy/scipy/pull/18992): DEP: interpolate: improve deprecation of private modules named… +* [#18995](https://github.com/scipy/scipy/pull/18995): DOC: stats.lognorm: add example of the relationship between norm… +* [#18996](https://github.com/scipy/scipy/pull/18996): ENH: optimize.curve\_fit: reduce overhead of lightweight memoization +* [#18997](https://github.com/scipy/scipy/pull/18997): DOC: add `noexcept` to `cython\_optimize` docs +* [#19000](https://github.com/scipy/scipy/pull/19000): MAINT: fft: rename `test\_numpy.py` to `test\_basic.py` +* [#19005](https://github.com/scipy/scipy/pull/19005): ENH: fft: support array API standard +* [#19007](https://github.com/scipy/scipy/pull/19007): BLD: Add venv to .gitignore +* [#19010](https://github.com/scipy/scipy/pull/19010): DOC/MAINT: typo: change Azure reference to Cirrus +* [#19012](https://github.com/scipy/scipy/pull/19012): DOC: stats.mannwhitneyu: address apparent sign inconsistency… +* [#19013](https://github.com/scipy/scipy/pull/19013): DOCS: Fixed typo in \_fitpack2.py +* [#19014](https://github.com/scipy/scipy/pull/19014): MAINT: copy, array-api compatible utility function +* [#19015](https://github.com/scipy/scipy/pull/19015): ENH: Update numpy exceptions imports +* [#19018](https://github.com/scipy/scipy/pull/19018): TST/BUG: fix array API test skip decorators +* [#19023](https://github.com/scipy/scipy/pull/19023): ENH: special: dispatch to array library +* [#19030](https://github.com/scipy/scipy/pull/19030): MAINT: replace `optparse` usage with `argparse` +* [#19033](https://github.com/scipy/scipy/pull/19033): MAINT: Fix codespaces setup.sh script +* [#19035](https://github.com/scipy/scipy/pull/19035): DEP: linalg: improve deprecation of private modules named without… +* [#19045](https://github.com/scipy/scipy/pull/19045): MAINT: Change `add\_newdoc` import and remove `NINF` +* [#19047](https://github.com/scipy/scipy/pull/19047): Corrected a grammatical error in the docstring of class DOP853 +* [#19050](https://github.com/scipy/scipy/pull/19050): CI/BLD: make nightly wheels daily closes #19048 +* [#19051](https://github.com/scipy/scipy/pull/19051): ENH: array agnostic `cov`, used in `cluster` +* [#19052](https://github.com/scipy/scipy/pull/19052): BENCH: update asv, fail benchmark CI on errors, fix fallout +* [#19053](https://github.com/scipy/scipy/pull/19053): CI: cirrus mods +* [#19055](https://github.com/scipy/scipy/pull/19055): MAINT: use `copy` utility from #19014 in `cluster` +* [#19057](https://github.com/scipy/scipy/pull/19057): ENH: add computing a selected number m of extreme eigenpairs… +* [#19060](https://github.com/scipy/scipy/pull/19060): MAINT: port minpack2.dcsrch from Fortran to Python, remove Fortran… +* [#19061](https://github.com/scipy/scipy/pull/19061): DOC: spell NaN -> nan +* [#19062](https://github.com/scipy/scipy/pull/19062): BLD: Replace complex occurences with singlecomplex in SuperLU +* [#19064](https://github.com/scipy/scipy/pull/19064): TST: bump tolerance of `TestTruncexpon.test\_is\_isf` a little +* [#19066](https://github.com/scipy/scipy/pull/19066): Update dfovec.py case 20 for zero indexing +* [#19067](https://github.com/scipy/scipy/pull/19067): DEP: remove all deprecated `scipy.` objects +* [#19070](https://github.com/scipy/scipy/pull/19070): DEP: odr: improved deprecation of private modules +* [#19073](https://github.com/scipy/scipy/pull/19073): DOC: remove reference to no longer imported numpy funcs +* [#19074](https://github.com/scipy/scipy/pull/19074): TST: add regression test for sqrtm unexpectedly converting to… +* [#19078](https://github.com/scipy/scipy/pull/19078): ENH: Reflect changes from numpy namespace refactor part 3 +* [#19081](https://github.com/scipy/scipy/pull/19081): ENH: optimize: c1 and c2 of scalar\_search\_wolfe to cg and newton-cg +* [#19083](https://github.com/scipy/scipy/pull/19083): MAINT: forward port 1.11.2 relnotes +* [#19086](https://github.com/scipy/scipy/pull/19086): BLD: tweaks to build dependencies and 3.12 classifier in pyproject.toml +* [#19087](https://github.com/scipy/scipy/pull/19087): DOC: add info about usage of ccache for benchmarks +* [#19089](https://github.com/scipy/scipy/pull/19089): DOC: add comment on args in solve\_ivp (#18876) +* [#19091](https://github.com/scipy/scipy/pull/19091): MAINT: optimize.root\_scalar: handle args when method is newton… +* [#19093](https://github.com/scipy/scipy/pull/19093): MAINT: stats.zscore: return correct result when 0th element is… +* [#19094](https://github.com/scipy/scipy/pull/19094): BUG: optimize: update incorrect c1 value +* [#19095](https://github.com/scipy/scipy/pull/19095): ENH: optimize: add inv Hess estimate in BFGS +* [#19100](https://github.com/scipy/scipy/pull/19100): MAINT: Move `trapezoid` implementation to SciPy +* [#19104](https://github.com/scipy/scipy/pull/19104): MAINT: fix the CT subclass benchmark +* [#19110](https://github.com/scipy/scipy/pull/19110): MAINT: Remove usages of np.row\_stack and np.in1d +* [#19113](https://github.com/scipy/scipy/pull/19113): MAINT, TST: default\_rng few tests +* [#19115](https://github.com/scipy/scipy/pull/19115): ENH, TST: Use explicit imports in docstring examples +* [#19127](https://github.com/scipy/scipy/pull/19127): DOC: linalg: fix typos in pinv docs +* [#19128](https://github.com/scipy/scipy/pull/19128): ENH: optimize: add method attribute to result object from root\_scalar… +* [#19129](https://github.com/scipy/scipy/pull/19129): DOC:Added Examples To `combine\_pvalues` and `fhtoffset` +* [#19136](https://github.com/scipy/scipy/pull/19136): MAINT: remove NumPy infty alias +* [#19141](https://github.com/scipy/scipy/pull/19141): MAINT: more NumPy API shims +* [#19143](https://github.com/scipy/scipy/pull/19143): MAINT: remove asfarray usage +* [#19146](https://github.com/scipy/scipy/pull/19146): DOC: sparse.linalg: Enhance lobpcg documentation with updated… +* [#19152](https://github.com/scipy/scipy/pull/19152): DOC: fix predeces(s)or typo. +* [#19157](https://github.com/scipy/scipy/pull/19157): TST: add array-agnostic assertions +* [#19162](https://github.com/scipy/scipy/pull/19162): ENH: Allow `sparse\_mtx.transpose(axes=(1, 0))` +* [#19165](https://github.com/scipy/scipy/pull/19165): DEP: improve deprecation warnings for constants module +* [#19166](https://github.com/scipy/scipy/pull/19166): MAINT: Reflect changes from `numpy` namespace refactor Part… +* [#19168](https://github.com/scipy/scipy/pull/19168): BLD: special: fix dependencies for `\_ellip\_harm\_2` +* [#19170](https://github.com/scipy/scipy/pull/19170): MAINT: fix a number of issues in Cython code +* [#19171](https://github.com/scipy/scipy/pull/19171): ENH: constructors for sparse arrays +* [#19172](https://github.com/scipy/scipy/pull/19172): MAINT: Spherical Voronoi sort simplify +* [#19173](https://github.com/scipy/scipy/pull/19173): MAINT: integrate.\_tanhsinh: improvements after further testing +* [#19175](https://github.com/scipy/scipy/pull/19175): DOC: stats: Correct levy\_stable loc-scale note +* [#19178](https://github.com/scipy/scipy/pull/19178): MAINT/DOC: add `fit` to multivariate normal methods in documentation +* [#19179](https://github.com/scipy/scipy/pull/19179): DOC: Added example for tf2zpk function +* [#19183](https://github.com/scipy/scipy/pull/19183): MAINT: Import `fromarrays` from `rec` +* [#19184](https://github.com/scipy/scipy/pull/19184): TST: fix sparse constructor test with large memory footprint +* [#19186](https://github.com/scipy/scipy/pull/19186): TST: \_lib: improve array API assertions +* [#19187](https://github.com/scipy/scipy/pull/19187): BUG: accept `np`-coercible array-likes with array API flag… +* [#19191](https://github.com/scipy/scipy/pull/19191): BLD: update minimum versions of meson-python and pythran +* [#19192](https://github.com/scipy/scipy/pull/19192): TST: test tolerance bumps to fix reported failures +* [#19194](https://github.com/scipy/scipy/pull/19194): BUG/TST: fix `test\_array\_api` for `cupy` +* [#19195](https://github.com/scipy/scipy/pull/19195): DOC: Fixed typo in scipy.stats.Covariance +* [#19198](https://github.com/scipy/scipy/pull/19198): DOC: optimize.minimize\_scalar: note limitations and suggest alternatives +* [#19201](https://github.com/scipy/scipy/pull/19201): DOC: missing backticks +* [#19202](https://github.com/scipy/scipy/pull/19202): DOC: remove old mention to Python 2. +* [#19203](https://github.com/scipy/scipy/pull/19203): DOC: Fix \_nan\_allsame example prompt. +* [#19204](https://github.com/scipy/scipy/pull/19204): DOC: missing (and stray) backtick in mannwhitneyu +* [#19206](https://github.com/scipy/scipy/pull/19206): TST, MAINT: skip fix for array API tests +* [#19217](https://github.com/scipy/scipy/pull/19217): BLD: start building wheels against numpy 2.0 [wheel build] +* [#19218](https://github.com/scipy/scipy/pull/19218): DOC: Added examples for zpk2tf, tf2sos, sos2tf, lp2lp\_zpk, lp2hp\_zpk,… +* [#19219](https://github.com/scipy/scipy/pull/19219): ENH: Implemented custom mutation / crossover functions for DifferentialEvolution +* [#19222](https://github.com/scipy/scipy/pull/19222): DOC: clarify guidance on style modifications +* [#19224](https://github.com/scipy/scipy/pull/19224): BUG: integrate: expose ODEintWarning +* [#19226](https://github.com/scipy/scipy/pull/19226): DEP: improve message for deprecated private API for `sparse` +* [#19227](https://github.com/scipy/scipy/pull/19227): DOC: Trailing character after closing backquote. +* [#19229](https://github.com/scipy/scipy/pull/19229): DOC: Fix repeated typos in dev.py +* [#19233](https://github.com/scipy/scipy/pull/19233): DOC: Fix character after trailing backticks +* [#19236](https://github.com/scipy/scipy/pull/19236): BUG: Remove removed item from `\_\_all\_\_` +* [#19237](https://github.com/scipy/scipy/pull/19237): DOC: Missing import in private \_nan\_allsame function docs. +* [#19240](https://github.com/scipy/scipy/pull/19240): DEP: spatial: improve deprecation of private modules without… +* [#19243](https://github.com/scipy/scipy/pull/19243): DOC: stats: fix documentation of warnings raised by pearsonr +* [#19244](https://github.com/scipy/scipy/pull/19244): MAINT: scipy.io NEP 50 shims +* [#19247](https://github.com/scipy/scipy/pull/19247): MAINT: NumPy version check removals +* [#19251](https://github.com/scipy/scipy/pull/19251): TST/MAINT: cluster: use new array API assertions +* [#19253](https://github.com/scipy/scipy/pull/19253): MAINT: Cleanup expired ndarray methods +* [#19256](https://github.com/scipy/scipy/pull/19256): DOC: Added examples for correlation, num\_obs\_dm, num\_obs\_y functions. +* [#19259](https://github.com/scipy/scipy/pull/19259): DOC: outline workaround when precision losses occur in BFGS [skip… +* [#19261](https://github.com/scipy/scipy/pull/19261): MAINT: fft: refactor basic backend with `\_execute\_1D` +* [#19262](https://github.com/scipy/scipy/pull/19262): MAINT: fft: clean up test-skips +* [#19263](https://github.com/scipy/scipy/pull/19263): ENH: fft: GPU support for non-standard basic transforms +* [#19264](https://github.com/scipy/scipy/pull/19264): MAINT/TST: fft: remove duplicate namespace and dtype checks +* [#19265](https://github.com/scipy/scipy/pull/19265): MAINT: array API: rename `arg\_err\_msg` and move to `\_lib` +* [#19266](https://github.com/scipy/scipy/pull/19266): ENH: use inplace add in \_minimize\_newtoncg +* [#19267](https://github.com/scipy/scipy/pull/19267): MAINT: use linalg.norm in `\_minimize\_newtoncg` +* [#19270](https://github.com/scipy/scipy/pull/19270): MAINT: fix -Wdeprecated-non-prototype warnings in Cephes code +* [#19271](https://github.com/scipy/scipy/pull/19271): DOC: add example for `ndimage.shift` +* [#19275](https://github.com/scipy/scipy/pull/19275): MAINT: Add warning filter for `numpy.core` rename +* [#19278](https://github.com/scipy/scipy/pull/19278): DOC: use `np.copysign()` instead of `np.sign()` +* [#19281](https://github.com/scipy/scipy/pull/19281): DOC: add `fft` to list of array API supporting modules +* [#19282](https://github.com/scipy/scipy/pull/19282): MAINT: fft: clean up assertions +* [#19284](https://github.com/scipy/scipy/pull/19284): ENH: update SuperLU to version 6.0.1 +* [#19285](https://github.com/scipy/scipy/pull/19285): MAINT fix more `-Wdeprecate-non-prototype` warnings +* [#19287](https://github.com/scipy/scipy/pull/19287): ENH: add exact=False support for stirling2 +* [#19289](https://github.com/scipy/scipy/pull/19289): BLD: stats: improve build config for `unuran\_wrapper` +* [#19293](https://github.com/scipy/scipy/pull/19293): MAINT: optimize.\_bracket\_root: refactor and comment for clarity +* [#19294](https://github.com/scipy/scipy/pull/19294): MAINT: replace IOError alias with OSError +* [#19295](https://github.com/scipy/scipy/pull/19295): DOC: fix typos found by codespell +* [#19296](https://github.com/scipy/scipy/pull/19296): MAINT: fix linter issues +* [#19298](https://github.com/scipy/scipy/pull/19298): MAINT: replace io.open alias with built-in open +* [#19302](https://github.com/scipy/scipy/pull/19302): MAINT: Fix/parametrize Rotation tests. +* [#19304](https://github.com/scipy/scipy/pull/19304): DOC: fix page typo in ks\_2samp reference +* [#19310](https://github.com/scipy/scipy/pull/19310): MAINT: Remove `np.int\_` and `np.uint` +* [#19311](https://github.com/scipy/scipy/pull/19311): DOC: invalid interpreted-text (missing space after closing backtick). +* [#19312](https://github.com/scipy/scipy/pull/19312): DOC: Misc formatting error. +* [#19313](https://github.com/scipy/scipy/pull/19313): DOC: And new line at end of line in CPP code. +* [#19314](https://github.com/scipy/scipy/pull/19314): DOC: Rst don’t like list without blanklines. +* [#19315](https://github.com/scipy/scipy/pull/19315): MAINT: forward port 1.11.3 relnotes +* [#19317](https://github.com/scipy/scipy/pull/19317): MAINT: remove support for building with setup.py +* [#19327](https://github.com/scipy/scipy/pull/19327): ENH: Add a numerically stable logpdf function for the skewnorm… +* [#19331](https://github.com/scipy/scipy/pull/19331): MAINT, BLD: more setup.py cleanups +* [#19333](https://github.com/scipy/scipy/pull/19333): ENH: Fit skewnorms with MLE more robustly +* [#19340](https://github.com/scipy/scipy/pull/19340): DEP: deprecate scipy.signal wavelets +* [#19341](https://github.com/scipy/scipy/pull/19341): MAINT: Remove remaining `numpy.int\_` and filter `np.long`… +* [#19346](https://github.com/scipy/scipy/pull/19346): MAINT: stats: fix `differential\_entropy` too small error behavior +* [#19347](https://github.com/scipy/scipy/pull/19347): BUG: fix ValueError in stats.truncpareto +* [#19349](https://github.com/scipy/scipy/pull/19349): MAINT: Minor fix to shim import of scipy.signal. +* [#19350](https://github.com/scipy/scipy/pull/19350): ENH: stats: add support for masked arrays, `nan\_policy`, and… +* [#19358](https://github.com/scipy/scipy/pull/19358): TST: SphericalVoronoi region type +* [#19360](https://github.com/scipy/scipy/pull/19360): BLD, MAINT: more build system cleanups +* [#19367](https://github.com/scipy/scipy/pull/19367): CI: avoid using Cython 3.0.3 +* [#19371](https://github.com/scipy/scipy/pull/19371): ENH: stats.ansari: add axis / nan\_policy / keepdims support +* [#19376](https://github.com/scipy/scipy/pull/19376): TST: bump tolerance of `test\_al\_mohy\_higham\_2012\_experiment\_1` +* [#19380](https://github.com/scipy/scipy/pull/19380): DEV/CI: use scipy-openblas32 wheels in dev.py and some CI jobs +* [#19385](https://github.com/scipy/scipy/pull/19385): ENH: beta negative binomial distribution +* [#19390](https://github.com/scipy/scipy/pull/19390): DOC, MAINT: more distutils/build cleanups +* [#19391](https://github.com/scipy/scipy/pull/19391): MAINT: spatial: Change error message in KDTree to be more informative. +* [#19392](https://github.com/scipy/scipy/pull/19392): ENH: stats.bartlett: add axis / nan\_policy / keepdims support +* [#19394](https://github.com/scipy/scipy/pull/19394): MAINT: Partially revert `np.int\_` changes +* [#19395](https://github.com/scipy/scipy/pull/19395): DEP: ndimage: improve the deprecation of private modules named… +* [#19399](https://github.com/scipy/scipy/pull/19399): TST: signal: add missing assertion in test\_filter\_design.py +* [#19402](https://github.com/scipy/scipy/pull/19402): MAINT: l-bfgs-b remove intermediate bounds array +* [#19409](https://github.com/scipy/scipy/pull/19409): MAINT: fix a C++ build error with GCC 13 +* [#19410](https://github.com/scipy/scipy/pull/19410): DOC: interpolate: add note to BarycentricInterpolator.add\_xi +* [#19412](https://github.com/scipy/scipy/pull/19412): ENH: stats: add support for masked arrays for circular statistics… +* [#19414](https://github.com/scipy/scipy/pull/19414): BLD: with-scipy-openblas instead of use-scipy-openblas +* [#19419](https://github.com/scipy/scipy/pull/19419): ENH: SphericalVoronoi sort faster +* [#19422](https://github.com/scipy/scipy/pull/19422): DOC: Fix trivial typo. +* [#19425](https://github.com/scipy/scipy/pull/19425): ENH: stats: add masked array, axis tuple, and nan policy support… +* [#19426](https://github.com/scipy/scipy/pull/19426): MAINT: Update `fft.helper` import +* [#19428](https://github.com/scipy/scipy/pull/19428): ENH: stats.levene/fligner: add axis / nan\_policy / keepdims support +* [#19429](https://github.com/scipy/scipy/pull/19429): DOC: Fix documentation of callback function signature of scipy.optimize.minimize +* [#19431](https://github.com/scipy/scipy/pull/19431): MAINT: more NEP 50 shims +* [#19433](https://github.com/scipy/scipy/pull/19433): DOC: Add example for `stats.hdquantiles` +* [#19435](https://github.com/scipy/scipy/pull/19435): MAINT: Translate lambertw\_scalar into C++ +* [#19439](https://github.com/scipy/scipy/pull/19439): BLD: update build dependency versions in pyproject.toml +* [#19440](https://github.com/scipy/scipy/pull/19440): DOC: remove unused parameter in spline\_filter docstring +* [#19443](https://github.com/scipy/scipy/pull/19443): TST: Fix #19442 minimally +* [#19445](https://github.com/scipy/scipy/pull/19445): TST: Remove some unnecessary tuple conversions +* [#19449](https://github.com/scipy/scipy/pull/19449): DOC/MAINT: fft: fix signature for next\_fast\_len +* [#19453](https://github.com/scipy/scipy/pull/19453): Added parenthesis for accurate calculation of frequencies w when… +* [#19458](https://github.com/scipy/scipy/pull/19458): DOC: spatial: Rotation docs updates +* [#19461](https://github.com/scipy/scipy/pull/19461): DOC: dev: update max line length to 88 characters +* [#19465](https://github.com/scipy/scipy/pull/19465): DOC: fix broken NetCDF URL +* [#19466](https://github.com/scipy/scipy/pull/19466): MAINT: NumPy int type shims +* [#19469](https://github.com/scipy/scipy/pull/19469): DEP: special: improve deprecation of private modules named without… +* [#19471](https://github.com/scipy/scipy/pull/19471): MAINT: Translate binom to C++ +* [#19472](https://github.com/scipy/scipy/pull/19472): MAINT: Update fast\_matrix\_market to 1.7.4 +* [#19482](https://github.com/scipy/scipy/pull/19482): MAINT: Make use of sf\_error conditional on flag in scipy::special… +* [#19483](https://github.com/scipy/scipy/pull/19483): ENH: add max dist to NearestNDInterpolator +* [#19484](https://github.com/scipy/scipy/pull/19484): CI: limit scipy-openblas32 wheel to 0.3.23.293.2 +* [#19487](https://github.com/scipy/scipy/pull/19487): ENH: stats.cramervonmises/epps\_singleton: add axis / nan\_policy… +* [#19489](https://github.com/scipy/scipy/pull/19489): MAINT: lint: ignore E501 (line length) by subpackage +* [#19491](https://github.com/scipy/scipy/pull/19491): MAINT/STY: misc: remove E501 (line length) lint ignore +* [#19494](https://github.com/scipy/scipy/pull/19494): MAINT/STY: `conftest.py`: remove E501 (line length) lint ignore +* [#19495](https://github.com/scipy/scipy/pull/19495): MAINT: get rid of Python 2 left-overs +* [#19497](https://github.com/scipy/scipy/pull/19497): CI: add ‘[lint only]’, ‘[docs only]’ skip tags +* [#19501](https://github.com/scipy/scipy/pull/19501): TST: skip test\_bootstrap\_against\_theory +* [#19503](https://github.com/scipy/scipy/pull/19503): MAINT/STY: fftpack: remove E501 (line length) lint ignore +* [#19505](https://github.com/scipy/scipy/pull/19505): MAINT/STY: `scipyoptdoc.py`: remove E501 (line length) lint… +* [#19506](https://github.com/scipy/scipy/pull/19506): MAINT: sparse: update tests to switch to format and toarray from… +* [#19507](https://github.com/scipy/scipy/pull/19507): MAINT/DOC: stats: fix lint errors +* [#19508](https://github.com/scipy/scipy/pull/19508): MAINT/DOC/BENCH: optimize: fix linter errors +* [#19509](https://github.com/scipy/scipy/pull/19509): MAINT: fix remaining lint errors +* [#19510](https://github.com/scipy/scipy/pull/19510): DEP: integrate: deprecate romberg and quadrature +* [#19514](https://github.com/scipy/scipy/pull/19514): MAINT/STY: odr: remove E501 (line length) lint ignore +* [#19515](https://github.com/scipy/scipy/pull/19515): MAINT: Restructure extra\_special (working name) as internal library +* [#19516](https://github.com/scipy/scipy/pull/19516): MAINT: lint: enable UP rules +* [#19519](https://github.com/scipy/scipy/pull/19519): DOC: Fix example used in stats tutorial +* [#19520](https://github.com/scipy/scipy/pull/19520): MAINT/STY: fft: remove E501 (line length) lint ignore, `noqa`… +* [#19523](https://github.com/scipy/scipy/pull/19523): MAINT/STY: constants: remove E501 (line length) lint ignore +* [#19525](https://github.com/scipy/scipy/pull/19525): DOC, CI: refguide may vary locs +* [#19527](https://github.com/scipy/scipy/pull/19527): DOC, MAINT: more refguide fixes +* [#19529](https://github.com/scipy/scipy/pull/19529): MAINT: blanket `noqa` vet +* [#19533](https://github.com/scipy/scipy/pull/19533): DOC: fix more typos found by codespell +* [#19534](https://github.com/scipy/scipy/pull/19534): MAINT: get rid of more Python 2 left-overs +* [#19540](https://github.com/scipy/scipy/pull/19540): DOC: \_binomtest.py: Add clearer error messages +* [#19546](https://github.com/scipy/scipy/pull/19546): MAINT: Fix interpolate.make\_smoothing\_spline’s size validation… +* [#19556](https://github.com/scipy/scipy/pull/19556): DOC: revert part of bcbb18f / #19533 +* [#19558](https://github.com/scipy/scipy/pull/19558): MAINT: forward port 1.11.4 relnotes +* [#19562](https://github.com/scipy/scipy/pull/19562): MAINT: Fix typos in Rotation.from\_mrp referenced paper +* [#19564](https://github.com/scipy/scipy/pull/19564): MAINT: Mark in `.gitignore` the directories instead of their… +* [#19570](https://github.com/scipy/scipy/pull/19570): DOC: Fixed build instructions in index.rst (#19568) +* [#19574](https://github.com/scipy/scipy/pull/19574): DOC: update Building from source docs for editable installs +* [#19576](https://github.com/scipy/scipy/pull/19576): BUG: Use uint32 for cost in NI\_WatershedElement +* [#19578](https://github.com/scipy/scipy/pull/19578): BUG: stats.\_axis\_nan\_policy\_factory: respect too\_small when detecting… +* [#19579](https://github.com/scipy/scipy/pull/19579): BLD:MAINT:Update dev.py message +* [#19581](https://github.com/scipy/scipy/pull/19581): BUG: interpolate/ndbspline: fix OOB access for len(tx) != len(ty)… +* [#19583](https://github.com/scipy/scipy/pull/19583): ENH: Use `np.dot` to speedup `spatial.distance.correlation` +* [#19585](https://github.com/scipy/scipy/pull/19585): DEP: improve deprecation of remaining private modules named without… +* [#19588](https://github.com/scipy/scipy/pull/19588): BLD:Add missing cstdin include in fast matrix market +* [#19589](https://github.com/scipy/scipy/pull/19589): ENH: Use `np.dot` to speedup `spatial.distance.hamming` +* [#19590](https://github.com/scipy/scipy/pull/19590): MAINT:special:Add more noexcept to Cython signatures +* [#19591](https://github.com/scipy/scipy/pull/19591): MAINT: interpolate/RGI: avoid unnecessary validation of data… +* [#19593](https://github.com/scipy/scipy/pull/19593): Returning NotImplemented in comparisons with sparse arrays +* [#19597](https://github.com/scipy/scipy/pull/19597): TST: special.\_sinpi/\_cospi: skip failing `test\_intermediate\_overflow` +* [#19600](https://github.com/scipy/scipy/pull/19600): Fix sparse multiply +* [#19601](https://github.com/scipy/scipy/pull/19601): ENH: Make special C++ implementations work on CUDA (and beyond!) +* [#19603](https://github.com/scipy/scipy/pull/19603): DOC: doc shim for eig normalization +* [#19604](https://github.com/scipy/scipy/pull/19604): BUG: fix overflow in stats.boxcox\_normmax when method=’mle’ +* [#19606](https://github.com/scipy/scipy/pull/19606): MAINT: array types: restrict to boolean & numerical dtypes +* [#19608](https://github.com/scipy/scipy/pull/19608): MAINT/DOC: refguide-check fixes +* [#19609](https://github.com/scipy/scipy/pull/19609): MAINT: lint: enable line-length check (package-wide) +* [#19611](https://github.com/scipy/scipy/pull/19611): DOC: clarify interpolator termionolgy +* [#19613](https://github.com/scipy/scipy/pull/19613): MAINT: Added clang-format formatting for special C++ files +* [#19617](https://github.com/scipy/scipy/pull/19617): fix numerical stability +* [#19618](https://github.com/scipy/scipy/pull/19618): MAINT: qmc permutations win type +* [#19622](https://github.com/scipy/scipy/pull/19622): CI: undo cython==0.29.35 pin for the 32-bit Linux job, remove… +* [#19623](https://github.com/scipy/scipy/pull/19623): MAINT: lint: enable `stacklevel` warnings check +* [#19624](https://github.com/scipy/scipy/pull/19624): MAINT/TST: \_lib: use value instead of deprecated s +* [#19626](https://github.com/scipy/scipy/pull/19626): MAINT: more SciPy windows int shims +* [#19628](https://github.com/scipy/scipy/pull/19628): DOC: 1.12.0 release notes +* [#19635](https://github.com/scipy/scipy/pull/19635): MAINT: simplify Nakagami mean calculation +* [#19637](https://github.com/scipy/scipy/pull/19637): DOC: Clarify integration error bound in `integrate` tutorial +* [#19648](https://github.com/scipy/scipy/pull/19648): MAINT: simplify chi distribution mean calculation +* [#19651](https://github.com/scipy/scipy/pull/19651): MAINT: stats.entropy: silence mypy +* [#19656](https://github.com/scipy/scipy/pull/19656): BUG: Remove unnecessary incref on unrelated type +* [#19658](https://github.com/scipy/scipy/pull/19658): MAINT: git blame ignores for lint clean-ups +* [#19660](https://github.com/scipy/scipy/pull/19660): STY: special: use indent width of 4 in clang-format +* [#19661](https://github.com/scipy/scipy/pull/19661): CI: fix pre-release job by correct version pin for scipy-openblas32 +* [#19670](https://github.com/scipy/scipy/pull/19670): MAINT: version bounds for 1.12.0rc1 +* [#19677](https://github.com/scipy/scipy/pull/19677): DOC: array types: mention partial support in `special` +* [#19686](https://github.com/scipy/scipy/pull/19686): TST: fix incorrect signal.sosfilt tests +* [#19690](https://github.com/scipy/scipy/pull/19690): BLD: avoid fast-math for oneAPI compilers, fix up handling of… +* [#19691](https://github.com/scipy/scipy/pull/19691): BUG: fix negative overflow in stats.boxcox\_normmax +* [#19693](https://github.com/scipy/scipy/pull/19693): BUG: Prevent mutation of `w` parameter in `spatial.distance.\*` +* [#19702](https://github.com/scipy/scipy/pull/19702): DEP: Adopt `\*tol` deprecations also for `gcrotmk/lgmres/minres/tfqmr` +* [#19709](https://github.com/scipy/scipy/pull/19709): MAINT: Cumulative simpson follow-up comments +* [#19735](https://github.com/scipy/scipy/pull/19735): DOC: update release notes with all deprecations for 1.12 release +* [#19748](https://github.com/scipy/scipy/pull/19748): TST: skip RGI(…, method=”pchip” for complex values) +* [#19751](https://github.com/scipy/scipy/pull/19751): BUG: Make FMM classes `py::module\_local` (fix for 1.12RC) +* [#19761](https://github.com/scipy/scipy/pull/19761): MAINT: Avoid use of aligned\_alloc in pocketfft on windows +* [#19779](https://github.com/scipy/scipy/pull/19779): BUG: Fix `nbinom.logcdf` for invalid input +* [#19785](https://github.com/scipy/scipy/pull/19785): BUG: support sparse Hessian in `Newton-CG` +* [#19797](https://github.com/scipy/scipy/pull/19797): MAINT: 1.12.0rc2 prep +* [#19800](https://github.com/scipy/scipy/pull/19800): TST: loosen tolerances for tests that fail otherwise on windows+MKL +* [#19806](https://github.com/scipy/scipy/pull/19806): TST: fix compatibility with pytest 8 +* [#19830](https://github.com/scipy/scipy/pull/19830): REL: bump copyright to 2024 +* [#19842](https://github.com/scipy/scipy/pull/19842): TST: move reference data for test\_real\_transforms to a fixture +* [#19859](https://github.com/scipy/scipy/pull/19859): BLD: improve scipy-openblas dependency check +* [#19877](https://github.com/scipy/scipy/pull/19877): DOC: 1.12 release notes tweaks +* [#19881](https://github.com/scipy/scipy/pull/19881): Revert “ENH: stats.wasserstein\_distance: multivariate Wasserstein… +* [#19892](https://github.com/scipy/scipy/pull/19892): DEP: extend some announced deprecations due to out-of-band 1.13… +* [#19903](https://github.com/scipy/scipy/pull/19903): DEP: reflect extended deprecations also in release notes +* [#19910](https://github.com/scipy/scipy/pull/19910): BLD: ensure the name of the installed `scipy` package is lower-case diff --git a/corpus/changelog/scipy_releases/scipy_1130.md b/corpus/changelog/scipy_releases/scipy_1130.md new file mode 100644 index 0000000000000000000000000000000000000000..d117d9ddfa5770b851377b98561fa35b9f8f2ceb --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1130.md @@ -0,0 +1,706 @@ +# SciPy 1.13.0 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.13.0-notes.html +Version: 1.13.0 + +Contents + +* [SciPy 1.13.0 Release Notes](#scipy-1-13-0-release-notes) + + + [Highlights of this release](#highlights-of-this-release) + + [New features](#new-features) + + - [[`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") improvements](#scipy-integrate-improvements) + - [[`scipy.io`](../reference/io.html#module-scipy.io "scipy.io") improvements](#scipy-io-improvements) + - [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#scipy-interpolate-improvements) + - [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#scipy-signal-improvements) + - [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#scipy-sparse-improvements) + - [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#scipy-spatial-improvements) + - [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#scipy-special-improvements) + - [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#scipy-stats-improvements) + + [Deprecated features](#deprecated-features) + + [Expired Deprecations](#expired-deprecations) + + [Backwards incompatible changes](#backwards-incompatible-changes) + + [Other changes](#other-changes) + + [Authors](#authors) + + [Issues closed for 1.13.0](#issues-closed-for-1-13-0) + + [Pull requests for 1.13.0](#pull-requests-for-1-13-0) + +SciPy 1.13.0 is the culmination of 3 months of hard work. This +out-of-band release aims to support NumPy `2.0.0`, and is backwards +compatible to NumPy `1.22.4`. The version of OpenBLAS used to build +the PyPI wheels has been increased to `0.3.26.dev`. + +This release requires Python 3.9+ and NumPy 1.22.4 or greater. + +For running on PyPy, PyPy3 6.0+ is required. + +## [Highlights of this release](#id2)[#](#highlights-of-this-release "Link to this heading") + +* Support for NumPy `2.0.0`. +* Interactive examples have been added to the documentation, allowing users + to run the examples locally on embedded Jupyterlite notebooks in their + browser. +* Preliminary 1D array support for the COO and DOK sparse formats. +* Several [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") functions have gained support for additional + `axis`, `nan_policy`, and `keepdims` arguments. [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") also + has several performance and accuracy improvements. + +## [New features](#id3)[#](#new-features "Link to this heading") + +### [[`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") improvements](#id4)[#](#scipy-integrate-improvements "Link to this heading") + +* The `terminal` attribute of [`scipy.integrate.solve_ivp`](../reference/generated/scipy.integrate.solve_ivp.html#scipy.integrate.solve_ivp "scipy.integrate.solve_ivp") `events` + callables now additionally accepts integer values to specify a number + of occurrences required for termination, rather than the previous restriction + of only accepting a `bool` value to terminate on the first registered + event. + +### [[`scipy.io`](../reference/io.html#module-scipy.io "scipy.io") improvements](#id5)[#](#scipy-io-improvements "Link to this heading") + +* [`scipy.io.wavfile.write`](../reference/generated/scipy.io.wavfile.write.html#scipy.io.wavfile.write "scipy.io.wavfile.write") has improved `dtype` input validation. + +### [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#id6)[#](#scipy-interpolate-improvements "Link to this heading") + +* The Modified Akima Interpolation has been added to + `interpolate.Akima1DInterpolator`, available via the new `method` + argument. +* New method `BSpline.insert_knot` inserts a knot into a `BSpline` instance. + This routine is similar to the module-level [`scipy.interpolate.insert`](../reference/generated/scipy.interpolate.insert.html#scipy.interpolate.insert "scipy.interpolate.insert") + function, and works with the BSpline objects instead of `tck` tuples. +* `RegularGridInterpolator` gained the functionality to compute derivatives + in place. For instance, `RegularGridInterolator((x, y), values, + method="cubic")(xi, nu=(1, 1))` evaluates the mixed second derivative, + \(\partial^2 / \partial x \partial y\) at `xi`. +* Performance characteristics of tensor-product spline methods of + `RegularGridInterpolator` have been changed: evaluations should be + significantly faster, while construction might be slower. If you experience + issues with construction times, you may need to experiment with optional + keyword arguments `solver` and `solver_args`. Previous behavior (fast + construction, slow evaluations) can be obtained via *“\*\_legacy”* methods: + `method="cubic_legacy"` is exactly equivalent to `method="cubic"` in + previous releases. See `gh-19633` for details. + +### [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#id7)[#](#scipy-signal-improvements "Link to this heading") + +* Many filter design functions now have improved input validation for the + sampling frequency (`fs`). + +### [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#id8)[#](#scipy-sparse-improvements "Link to this heading") + +* `coo_array` now supports 1D shapes, and has additional 1D support for + `min`, `max`, `argmin`, and `argmax`. The DOK format now has + preliminary 1D support as well, though only supports simple integer indices + at the time of writing. +* Experimental support has been added for `pydata/sparse` array inputs to + [`scipy.sparse.csgraph`](../reference/sparse.csgraph.html#module-scipy.sparse.csgraph "scipy.sparse.csgraph"). +* `dok_array` and `dok_matrix` now have proper implementations of + `fromkeys`. +* `csr` and `csc` formats now have improved `setdiag` performance. + +### [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#id9)[#](#scipy-spatial-improvements "Link to this heading") + +* `voronoi_plot_2d` now draws Voronoi edges to infinity more clearly + when the aspect ratio is skewed. + +### [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#id10)[#](#scipy-special-improvements "Link to this heading") + +* All Fortran code, namely, `AMOS`, `specfun`, and `cdflib` libraries + that the majority of special functions depend on, is ported to Cython/C. +* The function `factorialk` now also supports faster, approximate + calculation using `exact=False`. + +### [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#id11)[#](#scipy-stats-improvements "Link to this heading") + +* [`scipy.stats.rankdata`](../reference/generated/scipy.stats.rankdata.html#scipy.stats.rankdata "scipy.stats.rankdata") and [`scipy.stats.wilcoxon`](../reference/generated/scipy.stats.wilcoxon.html#scipy.stats.wilcoxon "scipy.stats.wilcoxon") have been vectorized, + improving their performance and the performance of hypothesis tests that + depend on them. +* `stats.mannwhitneyu` should now be faster due to a vectorized statistic + calculation, improved caching, improved exploitation of symmetry, and a + memory reduction. `PermutationMethod` support was also added. +* [`scipy.stats.mood`](../reference/generated/scipy.stats.mood.html#scipy.stats.mood "scipy.stats.mood") now has `nan_policy` and `keepdims` support. +* [`scipy.stats.brunnermunzel`](../reference/generated/scipy.stats.brunnermunzel.html#scipy.stats.brunnermunzel "scipy.stats.brunnermunzel") now has `axis` and `keepdims` support. +* [`scipy.stats.friedmanchisquare`](../reference/generated/scipy.stats.friedmanchisquare.html#scipy.stats.friedmanchisquare "scipy.stats.friedmanchisquare"), [`scipy.stats.shapiro`](../reference/generated/scipy.stats.shapiro.html#scipy.stats.shapiro "scipy.stats.shapiro"), + [`scipy.stats.normaltest`](../reference/generated/scipy.stats.normaltest.html#scipy.stats.normaltest "scipy.stats.normaltest"), [`scipy.stats.skewtest`](../reference/generated/scipy.stats.skewtest.html#scipy.stats.skewtest "scipy.stats.skewtest"), + [`scipy.stats.kurtosistest`](../reference/generated/scipy.stats.kurtosistest.html#scipy.stats.kurtosistest "scipy.stats.kurtosistest"), [`scipy.stats.f_oneway`](../reference/generated/scipy.stats.f_oneway.html#scipy.stats.f_oneway "scipy.stats.f_oneway"), + [`scipy.stats.alexandergovern`](../reference/generated/scipy.stats.alexandergovern.html#scipy.stats.alexandergovern "scipy.stats.alexandergovern"), [`scipy.stats.combine_pvalues`](../reference/generated/scipy.stats.combine_pvalues.html#scipy.stats.combine_pvalues "scipy.stats.combine_pvalues"), and + [`scipy.stats.kstest`](../reference/generated/scipy.stats.kstest.html#scipy.stats.kstest "scipy.stats.kstest") have gained `axis`, `nan_policy` and + `keepdims` support. +* [`scipy.stats.boxcox_normmax`](../reference/generated/scipy.stats.boxcox_normmax.html#scipy.stats.boxcox_normmax "scipy.stats.boxcox_normmax") has gained a `ymax` parameter to allow user + specification of the maximum value of the transformed data. +* [`scipy.stats.vonmises`](../reference/generated/scipy.stats.vonmises.html#scipy.stats.vonmises "scipy.stats.vonmises") `pdf` method has been extended to support + `kappa=0`. The `fit` method is also more performant due to the use of + non-trivial bounds to solve for `kappa`. +* High order `moment` calculations for [`scipy.stats.powerlaw`](../reference/generated/scipy.stats.powerlaw.html#scipy.stats.powerlaw "scipy.stats.powerlaw") are now more + accurate. +* The `fit` methods of [`scipy.stats.gamma`](../reference/generated/scipy.stats.gamma.html#scipy.stats.gamma "scipy.stats.gamma") (with `method='mm'`) and + [`scipy.stats.loglaplace`](../reference/generated/scipy.stats.loglaplace.html#scipy.stats.loglaplace "scipy.stats.loglaplace") are faster and more reliable. +* [`scipy.stats.goodness_of_fit`](../reference/generated/scipy.stats.goodness_of_fit.html#scipy.stats.goodness_of_fit "scipy.stats.goodness_of_fit") now supports the use of a custom `statistic` + provided by the user. +* [`scipy.stats.wilcoxon`](../reference/generated/scipy.stats.wilcoxon.html#scipy.stats.wilcoxon "scipy.stats.wilcoxon") now supports `PermutationMethod`, enabling + calculation of accurate p-values in the presence of ties and zeros. +* [`scipy.stats.monte_carlo_test`](../reference/generated/scipy.stats.monte_carlo_test.html#scipy.stats.monte_carlo_test "scipy.stats.monte_carlo_test") now has improved robustness in the face of + numerical noise. +* [`scipy.stats.wasserstein_distance_nd`](../reference/generated/scipy.stats.wasserstein_distance_nd.html#scipy.stats.wasserstein_distance_nd "scipy.stats.wasserstein_distance_nd") was introduced to compute the + Wasserstein-1 distance between two N-D discrete distributions. + +## [Deprecated features](#id12)[#](#deprecated-features "Link to this heading") + +* Complex dtypes in `PchipInterpolator` and `Akima1DInterpolator` have + been deprecated and will raise an error in SciPy 1.15.0. If you are trying + to use the real components of the passed array, use `np.real` on `y`. +* Non-integer values of `n` together with `exact=True` are deprecated for + [`scipy.special.factorial`](../reference/generated/scipy.special.factorial.html#scipy.special.factorial "scipy.special.factorial"). + +## [Expired Deprecations](#id13)[#](#expired-deprecations "Link to this heading") + +There is an ongoing effort to follow through on long-standing deprecations. +The following previously deprecated features are affected: + +* `scipy.signal.{lsim2,impulse2,step2}` have been removed in favour of + `scipy.signal.{lsim,impulse,step}`. +* Window functions can no longer be imported from the [`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") namespace and + instead should be accessed through either [`scipy.signal.windows`](../reference/signal.windows.html#module-scipy.signal.windows "scipy.signal.windows") or + [`scipy.signal.get_window`](../reference/generated/scipy.signal.get_window.html#scipy.signal.get_window "scipy.signal.get_window"). +* [`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") no longer supports multi-Ellipsis indexing +* `scipy.signal.{bspline,quadratic,cubic}` have been removed in favour of alternatives + in [`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate"). +* `scipy.linalg.tri{,u,l}` have been removed in favour of `numpy.tri{,u,l}`. +* Non-integer arrays in [`scipy.special.factorial`](../reference/generated/scipy.special.factorial.html#scipy.special.factorial "scipy.special.factorial") with `exact=True` now raise an + error. +* Functions from NumPy’s main namespace which were exposed in SciPy’s main + namespace, such as `numpy.histogram` exposed by `scipy.histogram`, have + been removed from SciPy’s main namespace. Please use the functions directly + from `numpy`. This was originally performed for SciPy 1.12.0 however was missed from + the release notes so is included here for completeness. + +## [Backwards incompatible changes](#id14)[#](#backwards-incompatible-changes "Link to this heading") + +## [Other changes](#id15)[#](#other-changes "Link to this heading") + +* The second argument of [`scipy.stats.moment`](../reference/generated/scipy.stats.moment.html#scipy.stats.moment "scipy.stats.moment") has been renamed to `order` + while maintaining backward compatibility. + +## [Authors](#id16)[#](#authors "Link to this heading") + +* Name (commits) +* h-vetinari (50) +* acceptacross (1) + +* Petteri Aimonen (1) + +* Francis Allanah (2) + +* Jonas Kock am Brink (1) + +* anupriyakkumari (12) + +* Aman Atman (2) + +* Aaditya Bansal (1) + +* Christoph Baumgarten (2) +* Sebastian Berg (4) +* Nicolas Bloyet (2) + +* Matt Borland (1) +* Jonas Bosse (1) + +* Jake Bowhay (25) +* Matthew Brett (1) +* Dietrich Brunn (7) +* Evgeni Burovski (65) +* Matthias Bussonnier (4) +* Tim Butters (1) + +* Cale (1) + +* CJ Carey (5) +* Thomas A Caswell (1) +* Sean Cheah (44) + +* Lucas Colley (97) +* com3dian (1) +* Gianluca Detommaso (1) + +* Thomas Duvernay (1) +* DWesl (2) +* f380cedric (1) + +* fancidev (13) + +* Daniel Garcia (1) + +* Lukas Geiger (3) +* Ralf Gommers (147) +* Matt Haberland (81) +* Tessa van der Heiden (2) + +* Shawn Hsu (1) + +* inky (3) + +* Jannes Münchmeyer (2) + +* Aditya Vidyadhar Kamath (2) + +* Agriya Khetarpal (1) + +* Andrew Landau (1) + +* Eric Larson (7) +* Zhen-Qi Liu (1) + +* Christian Lorentzen (2) +* Adam Lugowski (4) +* m-maggi (6) + +* Chethin Manage (1) + +* Ben Mares (1) +* Chris Markiewicz (1) + +* Mateusz Sokół (3) +* Daniel McCloy (1) + +* Melissa Weber Mendonça (6) +* Josue Melka (1) +* Michał Górny (4) +* Juan Montesinos (1) + +* Juan F. Montesinos (1) + +* Takumasa Nakamura (1) +* Andrew Nelson (27) +* Praveer Nidamaluri (1) +* Yagiz Olmez (5) + +* Dimitri Papadopoulos Orfanos (1) +* Drew Parsons (1) + +* Tirth Patel (7) +* Pearu Peterson (1) +* Matti Picus (3) +* Rambaud Pierrick (1) + +* Ilhan Polat (30) +* Quentin Barthélemy (1) +* Tyler Reddy (117) +* Pamphile Roy (10) +* Atsushi Sakai (8) +* Daniel Schmitz (10) +* Dan Schult (17) +* Eli Schwartz (4) +* Stefanie Senger (1) + +* Scott Shambaugh (2) +* Kevin Sheppard (2) +* sidsrinivasan (4) + +* Samuel St-Jean (1) +* Albert Steppi (31) +* Adam J. Stewart (4) +* Kai Striega (3) +* Ruikang Sun (1) + +* Mike Taves (1) +* Nicolas Tessore (3) +* Benedict T Thekkel (1) + +* Will Tirone (4) +* Jacob Vanderplas (2) +* Christian Veenhuis (1) +* Isaac Virshup (2) +* Ben Wallace (1) + +* Xuefeng Xu (3) +* Xiao Yuan (5) +* Irwin Zaid (8) +* Elmar Zander (1) + +* Mathias Zechmeister (1) + + +A total of 96 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +## [Issues closed for 1.13.0](#id17)[#](#issues-closed-for-1-13-0 "Link to this heading") + +* [#1603](https://github.com/scipy/scipy/issues/1603): binomial ppf gives bogus results for small binomial probability… +* [#2254](https://github.com/scipy/scipy/issues/2254): linalg.eig test failure (test\_singular) (Trac #1735) +* [#8398](https://github.com/scipy/scipy/issues/8398): Precision of CDFLIB too low +* [#9950](https://github.com/scipy/scipy/issues/9950): “++” initialization in kmeans2 fails for univariate data +* [#10317](https://github.com/scipy/scipy/issues/10317): scipy.stats.nbinom.interval returns wrong result for p=1 +* [#10569](https://github.com/scipy/scipy/issues/10569): API: `s` argument different in scipy.fft and numpy.fft +* [#11359](https://github.com/scipy/scipy/issues/11359): lfilter error when input b is 0-dim +* [#11577](https://github.com/scipy/scipy/issues/11577): generalized eigenvalues are sometimes wrong (on some hardware) +* [#14001](https://github.com/scipy/scipy/issues/14001): Pycharm scipy SVD returning error code without message +* [#14176](https://github.com/scipy/scipy/issues/14176): Add option for terminating solver after n events +* [#14220](https://github.com/scipy/scipy/issues/14220): Documentation for dctn/idctn s-parameter is confusing +* [#14450](https://github.com/scipy/scipy/issues/14450): Passing a numpy array as sampling frequency to signal.iirfilter… +* [#14586](https://github.com/scipy/scipy/issues/14586): Problem with freeing-up memory of matrix +* [#15039](https://github.com/scipy/scipy/issues/15039): BUG: sparse.dok\_matrix.fromkeys method totally nonfunctional +* [#15108](https://github.com/scipy/scipy/issues/15108): BUG: Seg. fault in scipy.sparse.linalg tests in PROPACK +* [#16098](https://github.com/scipy/scipy/issues/16098): BLD:1.8.0: SciPy is not LTO ready +* [#16792](https://github.com/scipy/scipy/issues/16792): BUG: Manually vectorizing scipy.linalg.expm fails in version… +* [#16930](https://github.com/scipy/scipy/issues/16930): BUG: scipy.linalg.blas.dnrm2 may return error result when incx… +* [#17004](https://github.com/scipy/scipy/issues/17004): Test failures for `Test\_SVDS\_PROPACK.test\_small\_sigma2` test… +* [#17125](https://github.com/scipy/scipy/issues/17125): BUG: osx-64 scipy 1.9.1 test\_bad\_geneig numerical error +* [#17172](https://github.com/scipy/scipy/issues/17172): BUG: scipy.linalg.expm, coshm, sinhm and tanhm fail for read-only… +* [#17362](https://github.com/scipy/scipy/issues/17362): Add support for Flexiblas +* [#17436](https://github.com/scipy/scipy/issues/17436): BUG: linalg.cholesky: segmentation fault with large matrix +* [#17530](https://github.com/scipy/scipy/issues/17530): Unnecessary approximation in `scipy.stats.wilcoxon(x, y)` +* [#17681](https://github.com/scipy/scipy/issues/17681): BUG: special: `pbvv\_seq` is broken. +* [#18086](https://github.com/scipy/scipy/issues/18086): BUG: `scipy.linalg.expm` generates inconsistent results between… +* [#18089](https://github.com/scipy/scipy/issues/18089): DOC: +* [#18166](https://github.com/scipy/scipy/issues/18166): ENH: stats.vonmises.pdf: return 1/(2pi) when kappa=0 +* [#18408](https://github.com/scipy/scipy/issues/18408): MAINT: status of C++17 in the interregnum of meson without native… +* [#18423](https://github.com/scipy/scipy/issues/18423): ENH: Adding the SDMN Fortran routine to the python Wrapped functions. +* [#18678](https://github.com/scipy/scipy/issues/18678): BUG: scipy.special.stdtrit is not thread-safe for df.size > 500 +* [#18722](https://github.com/scipy/scipy/issues/18722): DOC: in optimize.quadratic\_assignment 2opt method, partial\_match… +* [#18767](https://github.com/scipy/scipy/issues/18767): Too-strict version restrictions on NumPy break distribution builds +* [#18773](https://github.com/scipy/scipy/issues/18773): BUG: Update oldest-supported-numpy metadata +* [#18902](https://github.com/scipy/scipy/issues/18902): DOC: make default bounds in scipy.optimize.linprog more obvious +* [#19088](https://github.com/scipy/scipy/issues/19088): `pull-request-labeler` misbehaving and therefore disabled again +* [#19181](https://github.com/scipy/scipy/issues/19181): TST: improve array API test skip decorators +* [#19225](https://github.com/scipy/scipy/issues/19225): stats.t.fit() with own optimizer (e.g. to use Nelder-Mead) fails… +* [#19486](https://github.com/scipy/scipy/issues/19486): Query: Where is cdflib used in SciPy code? +* [#19573](https://github.com/scipy/scipy/issues/19573): scipy.fft.fht - documentation issue +* [#19584](https://github.com/scipy/scipy/issues/19584): BUG: MATLAB expm vs scipy.linalg.expm: overflow/invalid value… +* [#19596](https://github.com/scipy/scipy/issues/19596): BENCH: spatial.distance.\* “non-xdist” benchmarks +* [#19605](https://github.com/scipy/scipy/issues/19605): BUG: wheel runs have a \*lot\* of test fails at the moment. +* [#19642](https://github.com/scipy/scipy/issues/19642): Speeding up Mann-Whitney U-Test +* [#19653](https://github.com/scipy/scipy/issues/19653): ENH: Voronoi diagram gives unexpected results from scipy.spatial +* [#19659](https://github.com/scipy/scipy/issues/19659): BUG: savemat(…, format=”4”) throws ValueError errorneously… +* [#19678](https://github.com/scipy/scipy/issues/19678): BUG: scipy.stats.theilslopes returns invalid data when input… +* [#19683](https://github.com/scipy/scipy/issues/19683): BUG/TST: cluster: incorrect test for `seed` param of {`kmeans`,… +* [#19729](https://github.com/scipy/scipy/issues/19729): DOC: Add interactive examples with jupyterlite-sphinx +* [#19732](https://github.com/scipy/scipy/issues/19732): DOC: Likelihood function depending on censoring type +* [#19733](https://github.com/scipy/scipy/issues/19733): BUG: `pythran` min version not enforced +* [#19737](https://github.com/scipy/scipy/issues/19737): TST: io: `test\_fortranfiles\_mixed\_record` fails with numpy… +* [#19739](https://github.com/scipy/scipy/issues/19739): BUG: pchip interpolation of complex values is buggy due to sign… +* [#19740](https://github.com/scipy/scipy/issues/19740): CI, MAINT: some easy cleanups for Python version +* [#19754](https://github.com/scipy/scipy/issues/19754): MAINT, TST: test\_public\_api.py can fail with NumPy main, via… +* [#19767](https://github.com/scipy/scipy/issues/19767): Build warnings from SuperLU fixed upstream +* [#19772](https://github.com/scipy/scipy/issues/19772): DOC: stats: The docstring for `scipy.stats.crystalball` needs… +* [#19774](https://github.com/scipy/scipy/issues/19774): DOC: Detail what “concatenate” means in the context of `spatial.transform.Rotation.concatenate` +* [#19799](https://github.com/scipy/scipy/issues/19799): DOC: array types: update array validation guidance +* [#19813](https://github.com/scipy/scipy/issues/19813): BUG: typo in specfun.f? +* [#19819](https://github.com/scipy/scipy/issues/19819): BUG: In RBFInterpolator, wrong warning message if degree=-1 +* [#19831](https://github.com/scipy/scipy/issues/19831): Test failures with OpenBLAS 0.3.26 +* [#19835](https://github.com/scipy/scipy/issues/19835): DOC: `fft` missing from list of subpackages +* [#19836](https://github.com/scipy/scipy/issues/19836): DOC: remove incorrect sentence about subpackage imports +* [#19846](https://github.com/scipy/scipy/issues/19846): CI: pre-release Linux job isn’t using NumPy pre-release anymore +* [#19848](https://github.com/scipy/scipy/issues/19848): `\_lib.\_util.MapWrapper` uses multiprocessing with `fork`,… +* [#19854](https://github.com/scipy/scipy/issues/19854): scipy.special.logsumexp for complex input with return\_sign=True… +* [#19862](https://github.com/scipy/scipy/issues/19862): DOC: documentation for transpose operator for sparse matrices… +* [#19867](https://github.com/scipy/scipy/issues/19867): New ndimage and RBFInterpolator test failures in pre-release… +* [#19896](https://github.com/scipy/scipy/issues/19896): BUG: `special.nctdtr` broken in main +* [#19897](https://github.com/scipy/scipy/issues/19897): DOC: scipy.stats.unitary\_group does not specify dim>1 +* [#19928](https://github.com/scipy/scipy/issues/19928): TST: special: array types: test tol failure with `torch` backend +* [#19943](https://github.com/scipy/scipy/issues/19943): BUG: sparse: CSC.setdiag is slower than converting to LIL and… +* [#19948](https://github.com/scipy/scipy/issues/19948): BUG: scipy.sparse.linalg.gmres fails when provided x0 solves… +* [#19951](https://github.com/scipy/scipy/issues/19951): BUG: boolean masking broken for sparse array classes +* [#19963](https://github.com/scipy/scipy/issues/19963): DOC: scipy.optimize with large differences in parameter scales +* [#19974](https://github.com/scipy/scipy/issues/19974): DOC/REL: retroactively add missing expired deprecations to 1.12.0… +* [#19991](https://github.com/scipy/scipy/issues/19991): BUG: Scipy Optimize with Nelder-Mead method has issues when specifying… +* [#19993](https://github.com/scipy/scipy/issues/19993): BUG: F\_INT type conflict with f2py translation of INTEGER type… +* [#19998](https://github.com/scipy/scipy/issues/19998): DOC: Boundary conditions in splrep +* [#20001](https://github.com/scipy/scipy/issues/20001): BUG: scipy.stats.loglaplace may return negative moments +* [#20009](https://github.com/scipy/scipy/issues/20009): BUG: ShortTimeFFT fails with complex input +* [#20012](https://github.com/scipy/scipy/issues/20012): MAINT: Use NumPy sliding\_window\_view instead of as\_strided in… +* [#20014](https://github.com/scipy/scipy/issues/20014): TST: signal: TestCorrelateReal failing on Meson 3.12 job +* [#20027](https://github.com/scipy/scipy/issues/20027): BUG: `sparse.random` returns transposed array in 1.12 +* [#20031](https://github.com/scipy/scipy/issues/20031): TST: prefer `pytest.warns` over `np.testing.assert\_warns` +* [#20034](https://github.com/scipy/scipy/issues/20034): TST: linalg: test\_decomp\_cossin.py::test\_cossin\_separate[float64]… +* [#20036](https://github.com/scipy/scipy/issues/20036): MAINT: implement scipy.stats.powerlaw.\_munp +* [#20041](https://github.com/scipy/scipy/issues/20041): BUG: Using LinearConstraint with optimize.differential\_evolution +* [#20042](https://github.com/scipy/scipy/issues/20042): BUG: scipy.stats.percentileofscore has a mistake +* [#20043](https://github.com/scipy/scipy/issues/20043): equality used to compare floating point numbers (test\_bootstrap\_alternative) +* [#20060](https://github.com/scipy/scipy/issues/20060): BUG: stacking two dok\_array produces a NotImplementedError about… +* [#20062](https://github.com/scipy/scipy/issues/20062): MAINT, TST: test failures against NumPy main +* [#20071](https://github.com/scipy/scipy/issues/20071): MAINT: doc build warnings +* [#20075](https://github.com/scipy/scipy/issues/20075): BUG: `eigh\_tridiagonal` with `select=”i”` fails for 1x1 matrices +* [#20084](https://github.com/scipy/scipy/issues/20084): BUG: `import scipy.\_lib.\_testutils` raises exception in some… +* [#20100](https://github.com/scipy/scipy/issues/20100): ENH: Expose NoConvergence error class in the scipy.optimize namespace +* [#20107](https://github.com/scipy/scipy/issues/20107): MAINT: builds broken against NumPy main +* [#20129](https://github.com/scipy/scipy/issues/20129): BUG: regression: eval\_chebyt gives wrong results for complex… +* [#20131](https://github.com/scipy/scipy/issues/20131): DOC: linalg: Unclear description for the output `P` of `qr`. +* [#20142](https://github.com/scipy/scipy/issues/20142): Typo in the doc of the Kstwobign distribution +* [#20156](https://github.com/scipy/scipy/issues/20156): BUG: sparse.dok\_matrix throws KeyError for valid pop(key) since… +* [#20157](https://github.com/scipy/scipy/issues/20157): MAINT, TST: test\_svds\_parameter\_tol failures +* [#20161](https://github.com/scipy/scipy/issues/20161): `dev.py test` fails to accept both `–argument` and `–… +* [#20170](https://github.com/scipy/scipy/issues/20170): Test failures due to `asarray(…, copy=False)` semantics change… +* [#20180](https://github.com/scipy/scipy/issues/20180): deprecation warnings for Node.js 16 on GHA wheel build jobs +* [#20182](https://github.com/scipy/scipy/issues/20182): BUG: `csr\_row\_index` and `csr\_column\_index` error for mixed… +* [#20188](https://github.com/scipy/scipy/issues/20188): BUG: Raising scipy.spatial.transform.Rotation to power of 0 adds… +* [#20214](https://github.com/scipy/scipy/issues/20214): BUG: minimize(method=”newton-cg”) crashes with UnboundLocalError… +* [#20220](https://github.com/scipy/scipy/issues/20220): new problem on Cirrus with Homebrew Python in macOS arm64 jobs +* [#20225](https://github.com/scipy/scipy/issues/20225): CI/MAINT: `choco` error for invalid credentials +* [#20230](https://github.com/scipy/scipy/issues/20230): CI, DOC, TST: failure related to scipy/stats/\_distn\_infrastructure.py… +* [#20268](https://github.com/scipy/scipy/issues/20268): MAINT: failing prerelease deps job - “numpy.broadcast size changed” +* [#20291](https://github.com/scipy/scipy/issues/20291): BUG: Macro collision (`complex`) with Windows SDK in amos code +* [#20294](https://github.com/scipy/scipy/issues/20294): BUG: Hang on Windows in scikit-learn with 1.13rc1 and 1.14.dev… +* [#20300](https://github.com/scipy/scipy/issues/20300): BUG: SciPy 1.13.0rc1 not buildable on old macOS due to pocketfft… +* [#20302](https://github.com/scipy/scipy/issues/20302): BUG: scipy.optimize.nnls fails with exception +* [#20340](https://github.com/scipy/scipy/issues/20340): BUG: line\_search\_wolfe2 fails to converge due to a wrong condition +* [#20344](https://github.com/scipy/scipy/issues/20344): MAINT/DOC: remove outdated note about NumPy imports + +## [Pull requests for 1.13.0](#id18)[#](#pull-requests-for-1-13-0 "Link to this heading") + +* [#8404](https://github.com/scipy/scipy/pull/8404): ENH:special:Tighten cdflib precision to 1e-15 +* [#14771](https://github.com/scipy/scipy/pull/14771): ENH: integrate.solve\_ivp: allow event `terminal` attribute… +* [#16660](https://github.com/scipy/scipy/pull/16660): DOC: update pydata-sphinx theme +* [#17265](https://github.com/scipy/scipy/pull/17265): Doc: fix linalg.lstsq documentation on residues +* [#17525](https://github.com/scipy/scipy/pull/17525): TST: linalg: temporarily silence failure in test\_solve\_generalized\_discrete\_are +* [#18530](https://github.com/scipy/scipy/pull/18530): ENH: sparse: Generalize coo\_array to support 1d shapes +* [#18541](https://github.com/scipy/scipy/pull/18541): MAINT: sparse: Stop supporting multi-Ellipsis indexing +* [#18828](https://github.com/scipy/scipy/pull/18828): ENH: improve dtype check in wavfile.write +* [#19444](https://github.com/scipy/scipy/pull/19444): ENH: Add faster inverse-Wishart rvs and logpdf +* [#19488](https://github.com/scipy/scipy/pull/19488): DOC: Improving “Spectral Analysis” section in User Guide +* [#19541](https://github.com/scipy/scipy/pull/19541): BUG: fix cosine distance result type +* [#19545](https://github.com/scipy/scipy/pull/19545): ENH: integrate.\_tanhsinh: support vector-valued functions +* [#19555](https://github.com/scipy/scipy/pull/19555): DOC: Small documentation and docstring corrections for `ShortTimeFFT` +* [#19560](https://github.com/scipy/scipy/pull/19560): ENH:MAINT:special:Cythonize cdflib +* [#19587](https://github.com/scipy/scipy/pull/19587): ENH:MAINT:special:Rewrite amos F77 code +* [#19631](https://github.com/scipy/scipy/pull/19631): ENH: add parameter ymax in stats.boxcox\_normmax +* [#19633](https://github.com/scipy/scipy/pull/19633): ENH: use NdBSpline in RegularGridInterpolator to speed up evaluations +* [#19650](https://github.com/scipy/scipy/pull/19650): ENH: stats.kstests: add axis / nan\_policy / keepdims support +* [#19662](https://github.com/scipy/scipy/pull/19662): ENH: stats.normaltest/skewtest/kurtosistest: add axis / nan\_policy… +* [#19663](https://github.com/scipy/scipy/pull/19663): DOC: Add example to rv\_continuous.fit +* [#19664](https://github.com/scipy/scipy/pull/19664): DOC: Add example for mstats.brunnermunzel +* [#19666](https://github.com/scipy/scipy/pull/19666): DOC: Add Example to lbfgsb docstring +* [#19667](https://github.com/scipy/scipy/pull/19667): ENH: integrate.\_nsum: function for finite and infinite summation +* [#19669](https://github.com/scipy/scipy/pull/19669): REL: set version to 1.13.0.dev0 +* [#19672](https://github.com/scipy/scipy/pull/19672): DEP: signal: remove scipy.signal.{bspline,quadratic,cubic} +* [#19674](https://github.com/scipy/scipy/pull/19674): DEP: linalg: remove tri{,u,l} +* [#19675](https://github.com/scipy/scipy/pull/19675): DEP: signal: remove scipy.signal.{lsim2,impulse2,step2} +* [#19676](https://github.com/scipy/scipy/pull/19676): DEP: signal: remove ability to import window functions from signal… +* [#19679](https://github.com/scipy/scipy/pull/19679): MAINT: stats.theilslopes: consistent promotion of `x` and `y` +* [#19680](https://github.com/scipy/scipy/pull/19680): ENH: stats.shapiro: add axis / nan\_policy / keepdims support +* [#19681](https://github.com/scipy/scipy/pull/19681): MAINT: Add binom to new C++ special lib along with its cephes… +* [#19682](https://github.com/scipy/scipy/pull/19682): TST: consolidate array API test skip decorators +* [#19687](https://github.com/scipy/scipy/pull/19687): MAINT:linalg: Remove redundant det and lu Fortran files +* [#19689](https://github.com/scipy/scipy/pull/19689): MAINT: stats.moment: rename parameter `moment` to `order` +* [#19694](https://github.com/scipy/scipy/pull/19694): MAINT: Remove `PDistWeightedMetricWrapper` and `CDistWeightedMetricWrapper` +* [#19695](https://github.com/scipy/scipy/pull/19695): MAINT: Prefer `np.fill\_diagonal` over `diag\_indices` +* [#19696](https://github.com/scipy/scipy/pull/19696): ENH: add `method` arg to `interpolate.Akima1DInterpolator` +* [#19698](https://github.com/scipy/scipy/pull/19698): MAINT: bump project version +* [#19701](https://github.com/scipy/scipy/pull/19701): MAINT: make import of `array\_api\_compat` nicer +* [#19703](https://github.com/scipy/scipy/pull/19703): DEP: non-integers in `factorial(…, exact=True)`: deprecate… +* [#19708](https://github.com/scipy/scipy/pull/19708): DOC: spatial.distance: add missing optional param markers +* [#19710](https://github.com/scipy/scipy/pull/19710): TST: fix pytest discovery errors with editable installs +* [#19711](https://github.com/scipy/scipy/pull/19711): DOC: clarify ttest\_1samp argument +* [#19714](https://github.com/scipy/scipy/pull/19714): BLD: require Cython >=3.0.4, drop 0.29.X support +* [#19715](https://github.com/scipy/scipy/pull/19715): ENH: sparse: Add DOK support for 1d (without indexing) +* [#19716](https://github.com/scipy/scipy/pull/19716): ENH: enable approximation for factorialk +* [#19721](https://github.com/scipy/scipy/pull/19721): DOC: add rationale for 88 char line length +* [#19722](https://github.com/scipy/scipy/pull/19722): DOC: update release version procedure +* [#19723](https://github.com/scipy/scipy/pull/19723): ENH, MAINT: voronoi\_plot\_2d nicer inf lines +* [#19724](https://github.com/scipy/scipy/pull/19724): MAINT: Windows NumPy 2.x int shims +* [#19725](https://github.com/scipy/scipy/pull/19725): MNT: use int instead of long in cython code +* [#19728](https://github.com/scipy/scipy/pull/19728): MAINT: enhance the configuration for the `pull-request-labeler`… +* [#19730](https://github.com/scipy/scipy/pull/19730): MAINT: bs4 deprecation shim +* [#19731](https://github.com/scipy/scipy/pull/19731): ENH: stats.mood: add nan\_policy / keepdims support +* [#19738](https://github.com/scipy/scipy/pull/19738): BLD: require `pythran>=0.14.0` +* [#19741](https://github.com/scipy/scipy/pull/19741): ENH: stats.friedmanchisquare/brunnermunzel: add axis / nan\_policy… +* [#19742](https://github.com/scipy/scipy/pull/19742): CI: fix PR labeler config file +* [#19743](https://github.com/scipy/scipy/pull/19743): ENH: sparse: Add min-max 1d support and tests +* [#19744](https://github.com/scipy/scipy/pull/19744): ENH: stats.mannwhitneyu: speed improvement, memory reduction,… +* [#19745](https://github.com/scipy/scipy/pull/19745): TST: fortranfiles fix +* [#19746](https://github.com/scipy/scipy/pull/19746): CI: add labeler based on issue/PR titles +* [#19749](https://github.com/scipy/scipy/pull/19749): ENH: stats.mannwhitneyu: vectorize statistic calculation +* [#19750](https://github.com/scipy/scipy/pull/19750): DEV/BLD: generate `requirements/\*` files to simplify build +* [#19752](https://github.com/scipy/scipy/pull/19752): DEP: deprecate complex dtypes in `PchipInterpolator` and `Akima1DInterpolator` +* [#19755](https://github.com/scipy/scipy/pull/19755): MAINT/TST: ignore backend import errors when not in array API… +* [#19757](https://github.com/scipy/scipy/pull/19757): ENH: Add vectorized scalar minimization bracket finder +* [#19758](https://github.com/scipy/scipy/pull/19758): MAINT: correct inaccurate comment +* [#19760](https://github.com/scipy/scipy/pull/19760): MAINT: interpolate: remove dead code +* [#19762](https://github.com/scipy/scipy/pull/19762): ENH: stats.monte\_carlo\_test: account for inexact calculation… +* [#19763](https://github.com/scipy/scipy/pull/19763): MAINT: integrate.\_nsum: adjust algorithm for determining number… +* [#19768](https://github.com/scipy/scipy/pull/19768): MAINT: SuperLU upstream fix for compile warnings +* [#19770](https://github.com/scipy/scipy/pull/19770): ENH: stats.wilcoxon: rewrite for speed and clarity; add PermutationMethod… +* [#19773](https://github.com/scipy/scipy/pull/19773): DOC: stats: The docstring for scipy.stats.crystalball needs an… +* [#19775](https://github.com/scipy/scipy/pull/19775): DOC: Docstring and examples for Rotation.concatenate +* [#19776](https://github.com/scipy/scipy/pull/19776): ENH: stats.rankdata: vectorize calculation +* [#19777](https://github.com/scipy/scipy/pull/19777): ENH: add `BSpline.insert\_knot` method +* [#19778](https://github.com/scipy/scipy/pull/19778): DOC, MAINT: fix make dist in rel process +* [#19780](https://github.com/scipy/scipy/pull/19780): MAINT: scipy.stats: replace `\_normtest\_finish`/`\_ttest\_finish`/etc…… +* [#19781](https://github.com/scipy/scipy/pull/19781): CI, MAINT: switch to stable python release +* [#19786](https://github.com/scipy/scipy/pull/19786): BLD: fix “Failed to guess install tag” in meson-log.txt, add… +* [#19787](https://github.com/scipy/scipy/pull/19787): DOC/BLD: macOS Homebrew OpenBlas detection advice +* [#19788](https://github.com/scipy/scipy/pull/19788): DOC: stats.trim\_mean: correct documentation +* [#19790](https://github.com/scipy/scipy/pull/19790): BENCH: Added benchmarks for individual distance metrics +* [#19792](https://github.com/scipy/scipy/pull/19792): MAINT: simplify `t.logpdf` +* [#19796](https://github.com/scipy/scipy/pull/19796): API: Enable `pydata/sparse` input for csgraph module +* [#19803](https://github.com/scipy/scipy/pull/19803): TST: stats: compare geometric zscore to naive version instead… +* [#19807](https://github.com/scipy/scipy/pull/19807): DOC: fft: add note about FHT formulas +* [#19808](https://github.com/scipy/scipy/pull/19808): MAINT: move elementwise algorithms and framework +* [#19810](https://github.com/scipy/scipy/pull/19810): MAINT: set `NPY\_NO\_DEPRECATED\_API` also for Cython code +* [#19811](https://github.com/scipy/scipy/pull/19811): BLD: set default `cpp\_std` to `c++17` +* [#19818](https://github.com/scipy/scipy/pull/19818): MAINT: uarray CXX version hex cleanup +* [#19820](https://github.com/scipy/scipy/pull/19820): TST: linalg: Test Cython LAPACK complex ladiv +* [#19821](https://github.com/scipy/scipy/pull/19821): BLD: resolve missing prototype warnings in lsoda/vode +* [#19822](https://github.com/scipy/scipy/pull/19822): BLD: propack: resolve missing return value warnings +* [#19823](https://github.com/scipy/scipy/pull/19823): CI/DEV: add some new auto-labels +* [#19824](https://github.com/scipy/scipy/pull/19824): ENH:Rewrite specfun F77 code in C +* [#19825](https://github.com/scipy/scipy/pull/19825): MAINT: `CODEOWNERS` syntax fix and changes +* [#19827](https://github.com/scipy/scipy/pull/19827): MAINT: spatial: fix build warnings in `ckdtree` code +* [#19828](https://github.com/scipy/scipy/pull/19828): CI/DEV: fix and simplify `label-globs` syntax +* [#19829](https://github.com/scipy/scipy/pull/19829): MAINT: interpolate: fix build warning from `\_ppoly.pyx` +* [#19837](https://github.com/scipy/scipy/pull/19837): MAINT: special: fix meson deprecation warning +* [#19838](https://github.com/scipy/scipy/pull/19838): DOC: fft: improve `s` description for real transforms +* [#19843](https://github.com/scipy/scipy/pull/19843): DOC: Add `fft` to list of submodules in tutorial +* [#19844](https://github.com/scipy/scipy/pull/19844): TST: fix more cases of fd leaks from np.load() +* [#19849](https://github.com/scipy/scipy/pull/19849): CI: fix prerelease job to use numpy 2.0, and add a second job… +* [#19853](https://github.com/scipy/scipy/pull/19853): ENH: sparse: foundation for 1D arrays (add test suite, round… +* [#19855](https://github.com/scipy/scipy/pull/19855): BLD: Revamp BLAS/LAPACK G77 ABI wrappers and fix PROPACK segfaults +* [#19856](https://github.com/scipy/scipy/pull/19856): BLD: simplify pythran version requirement in meson +* [#19857](https://github.com/scipy/scipy/pull/19857): BLD: make scipy build warning-free with LTO enabled +* [#19860](https://github.com/scipy/scipy/pull/19860): MAINT: fix BLD label typo +* [#19861](https://github.com/scipy/scipy/pull/19861): BUG:io:Skip arr\_to\_chars call for single code points +* [#19864](https://github.com/scipy/scipy/pull/19864): Add documentation to explain behavior for transposing csr or… +* [#19866](https://github.com/scipy/scipy/pull/19866): DOC: Change default for bounds in scipy.optimize.linprog +* [#19868](https://github.com/scipy/scipy/pull/19868): MAINT: fix use of `unique(…, return\_inverse=True)` +* [#19869](https://github.com/scipy/scipy/pull/19869): MAINT: array types: rename `as\_xparray` to `\_asarray` +* [#19870](https://github.com/scipy/scipy/pull/19870): MAINT: logsumexp: properly handle complex sign +* [#19871](https://github.com/scipy/scipy/pull/19871): MAINT: make isinstance check in `stats.\_distn\_infrastructure`… +* [#19874](https://github.com/scipy/scipy/pull/19874): rankdata: ensure correct shape for empty inputs +* [#19876](https://github.com/scipy/scipy/pull/19876): MAINT: stats: Add tests to ensure consistency between `wasserstein\_distance` and different backends of `wasserstein\_distance\_nd` +* [#19880](https://github.com/scipy/scipy/pull/19880): DOC: prepare 1.13.0 release notes +* [#19882](https://github.com/scipy/scipy/pull/19882): MAINT: vendor `pocketfft` as git submodule +* [#19885](https://github.com/scipy/scipy/pull/19885): MAINT: fix some small array API support issues +* [#19886](https://github.com/scipy/scipy/pull/19886): TST: stats: fix a few issues with non-reproducible seeding +* [#19891](https://github.com/scipy/scipy/pull/19891): MAINT: stats: fix editable install issue in `qmc` and MPL-related… +* [#19893](https://github.com/scipy/scipy/pull/19893): MAINT: remove unused itertools-import in scipy.interpolate.\_interpolate +* [#19901](https://github.com/scipy/scipy/pull/19901): MAINT: special: remove use of `numpy.math` from `\_cdflib.pyx` +* [#19902](https://github.com/scipy/scipy/pull/19902): BUG:special:cdflib: Correct cdftnc Cython bugs +* [#19908](https://github.com/scipy/scipy/pull/19908): Fix AIX build break. +* [#19909](https://github.com/scipy/scipy/pull/19909): MAINT:linalg:Adjust lwork/liwork changes OpenBLAS 0.3.26 +* [#19916](https://github.com/scipy/scipy/pull/19916): MAINT: update pocketfft git submodule location +* [#19917](https://github.com/scipy/scipy/pull/19917): MAINT: replicate FITPACK’s `fpchec` routine in python +* [#19924](https://github.com/scipy/scipy/pull/19924): TST: cluster: fix test\_kmeans\_and\_kmeans2\_random\_seed +* [#19925](https://github.com/scipy/scipy/pull/19925): MAINT: forward port 1.12.0 relnotes +* [#19927](https://github.com/scipy/scipy/pull/19927): BUG: cluster.kmeans\*: array types: accept `int`s for k +* [#19929](https://github.com/scipy/scipy/pull/19929): DOC: updated incorrect sentence about subpackage imports. See… +* [#19931](https://github.com/scipy/scipy/pull/19931): MAINT:special:cdflib:Refine the tolerances further +* [#19932](https://github.com/scipy/scipy/pull/19932): ENH:stats:Use explicit formula for gamma.fit(‘mm’) +* [#19933](https://github.com/scipy/scipy/pull/19933): BUG: Correct handling of -inf in special stdr funcs +* [#19934](https://github.com/scipy/scipy/pull/19934): BUG:special:amos: Fix some mistakes in the AMOS C translation +* [#19937](https://github.com/scipy/scipy/pull/19937): TST: Add RNG seeds for TestInvgauss and TestLaplace +* [#19938](https://github.com/scipy/scipy/pull/19938): MAINT: special: array types: fix warning when not in array API… +* [#19939](https://github.com/scipy/scipy/pull/19939): BUG:special:amos: Fix exit path in `amos\_asyi` +* [#19942](https://github.com/scipy/scipy/pull/19942): MAINT: hypothesis: document minimum required version +* [#19944](https://github.com/scipy/scipy/pull/19944): BUG: Correct handling of inf support in binomial +* [#19945](https://github.com/scipy/scipy/pull/19945): BLD: fix issue with escape sequences in `\_\_config\_\_.py` +* [#19947](https://github.com/scipy/scipy/pull/19947): BUG:special:amos: Fix typo in `amos\_mlri` +* [#19950](https://github.com/scipy/scipy/pull/19950): DOC: stats.logrank: fix typo that affect survival curves in manual +* [#19952](https://github.com/scipy/scipy/pull/19952): BUG:sparse:Add early exit to gmres when x0 already solves problem +* [#19957](https://github.com/scipy/scipy/pull/19957): defect: sparse: 1d bool mask with wrong shape should raise IndexError +* [#19961](https://github.com/scipy/scipy/pull/19961): DOC: Add version warning banner to documentation +* [#19962](https://github.com/scipy/scipy/pull/19962): ENH: sparse: speedup csr/csc setdiag by converting to coo +* [#19965](https://github.com/scipy/scipy/pull/19965): DOC: scale of parameters in optimize.curve\_fit +* [#19969](https://github.com/scipy/scipy/pull/19969): DOC: Fix landing page images for dark theme +* [#19971](https://github.com/scipy/scipy/pull/19971): ENH: Input validation for sampling frequency in signal.filter… +* [#19975](https://github.com/scipy/scipy/pull/19975): ENH: support custom statistic in goodness\_of\_fit function (gh-19894) +* [#19977](https://github.com/scipy/scipy/pull/19977): DOC: document a common alternative parameterization of invgauss. +* [#19978](https://github.com/scipy/scipy/pull/19978): DOC: fix autosummary for scipy.signal.ShortTimeFFT.t/T under… +* [#19980](https://github.com/scipy/scipy/pull/19980): ENH: stats: add axis/nan\_policy support to `f\_oneway` and `alexandergovern` +* [#19981](https://github.com/scipy/scipy/pull/19981): TST: correct typo in TestGamma.test\_fit\_mm function. +* [#19995](https://github.com/scipy/scipy/pull/19995): TST, MAINT: test\_immediate\_updating fix +* [#19997](https://github.com/scipy/scipy/pull/19997): MAINT: Adjust the codebase to the new `np.array`’s `copy`… +* [#20000](https://github.com/scipy/scipy/pull/20000): MAINT: interpolate: address review comments on NdBSpline/RGI +* [#20003](https://github.com/scipy/scipy/pull/20003): MAINT: sparse: change coo\_matrix.indices to coo\_matrix.coords +* [#20004](https://github.com/scipy/scipy/pull/20004): MAINT: sparse: change method names \_mul\_\* to \_matmul\_\* all… +* [#20005](https://github.com/scipy/scipy/pull/20005): MAINT: Remove partial from `\_\_all\_\_` (removed from submodule) +* [#20006](https://github.com/scipy/scipy/pull/20006): BENCH: optimize: add timings to global optimizers benchmarks +* [#20010](https://github.com/scipy/scipy/pull/20010): BUG: Add proper error message for `ShortTimeFFT` for onesided… +* [#20013](https://github.com/scipy/scipy/pull/20013): MAINT: signal: use `sliding\_window\_view` instead of `as\_strided` +* [#20016](https://github.com/scipy/scipy/pull/20016): DOC: update release docs to reflect new version banner +* [#20017](https://github.com/scipy/scipy/pull/20017): BUG: loglaplace moment should be non-negative. +* [#20018](https://github.com/scipy/scipy/pull/20018): ENH: refer to the Laplace distribution in log-Laplace documentation. +* [#20019](https://github.com/scipy/scipy/pull/20019): DOC: Add support for interactive examples with jupyterlite-sphinx +* [#20020](https://github.com/scipy/scipy/pull/20020): TST: TestCorrelateReal overflow shim +* [#20021](https://github.com/scipy/scipy/pull/20021): ENH: fix numerical instability around zero in boxcox\_llf +* [#20023](https://github.com/scipy/scipy/pull/20023): ENH: use analytic formula for log-laplace MLE when loc is known. +* [#20024](https://github.com/scipy/scipy/pull/20024): ENH:stats: Add multivariate Wasserstein distance as a separate… +* [#20032](https://github.com/scipy/scipy/pull/20032): MAINT: Adjust some comments in special C++ library +* [#20033](https://github.com/scipy/scipy/pull/20033): MAINT: sparse: Un-deprecate getnnz() +* [#20037](https://github.com/scipy/scipy/pull/20037): MAINT: Add special handling for complex infinite input in digamma +* [#20039](https://github.com/scipy/scipy/pull/20039): ENH: use analytical formula in scipy.stats.powerlaw.\_munp(). +* [#20044](https://github.com/scipy/scipy/pull/20044): TST: \_ConstraintWrapper returns a violation of the correct shape +* [#20045](https://github.com/scipy/scipy/pull/20045): DOC: add missing np. in tutorial +* [#20047](https://github.com/scipy/scipy/pull/20047): TST: use assert\_allclose in test\_bootstrap\_alternative +* [#20052](https://github.com/scipy/scipy/pull/20052): FIX: Allow any dtype-specifier for ndimage output +* [#20053](https://github.com/scipy/scipy/pull/20053): Add sorting requirement for partial\_match and partial\_guess +* [#20054](https://github.com/scipy/scipy/pull/20054): BUG: SciPy.interpolate.CubicSpline with periodic data +* [#20063](https://github.com/scipy/scipy/pull/20063): ENH: optimize.\_differentiate: add option preserve\_shape +* [#20065](https://github.com/scipy/scipy/pull/20065): MAINT Fix broken link in `scipy.stats.\_multivariate.py` +* [#20067](https://github.com/scipy/scipy/pull/20067): TST: shims for NumPy fft changes +* [#20068](https://github.com/scipy/scipy/pull/20068): Changed assert\_warns in stats testing to pytest.warns. +* [#20069](https://github.com/scipy/scipy/pull/20069): MAINT/DOC: `special.nrdtrimn/nrdtrisd` docstring fixes +* [#20070](https://github.com/scipy/scipy/pull/20070): MAINT: silence ruff deprecation warning +* [#20076](https://github.com/scipy/scipy/pull/20076): BUG:linalg:Add early exit to eigh\_tridiagonal for 1x1 input +* [#20078](https://github.com/scipy/scipy/pull/20078): CI: update github actions and cibuildwheel +* [#20080](https://github.com/scipy/scipy/pull/20080): BUG: sparse: Fix hstack, etc for dok\_array +* [#20086](https://github.com/scipy/scipy/pull/20086): MAINT: detect musl differently. +* [#20087](https://github.com/scipy/scipy/pull/20087): MAINT: switch from `numpy.array\_api` to `array-api-strict` +* [#20092](https://github.com/scipy/scipy/pull/20092): DOC: Fix a could of places that are parsed as substitution references… +* [#20093](https://github.com/scipy/scipy/pull/20093): DOC: Fix small typos in `signal.rst` and `\_short\_time\_fft.py` +* [#20095](https://github.com/scipy/scipy/pull/20095): DOC: tick tensor product splines off the roadmap +* [#20096](https://github.com/scipy/scipy/pull/20096): TST:linalg:Reduce the size of the cossin test +* [#20098](https://github.com/scipy/scipy/pull/20098): MAINT: minor array API skip improvements +* [#20101](https://github.com/scipy/scipy/pull/20101): MAINT: editorial changes in the doc string of scipy.stats.vonmises. +* [#20102](https://github.com/scipy/scipy/pull/20102): ENH: use non-trivial bounds to solve for kappa of vonmises MLE. +* [#20103](https://github.com/scipy/scipy/pull/20103): MAINT: optimize: expose `NoConvergence` +* [#20104](https://github.com/scipy/scipy/pull/20104): ENH: allow shape parameter kappa to be zero in vonmises distribution. +* [#20106](https://github.com/scipy/scipy/pull/20106): DOC: update docstring of stats.percentileofscore +* [#20108](https://github.com/scipy/scipy/pull/20108): MAINT: shim for descr->f access +* [#20111](https://github.com/scipy/scipy/pull/20111): DOC: clarify accepted values for `dim` in `unitary\_group`. +* [#20112](https://github.com/scipy/scipy/pull/20112): BLD: signal: do not install Pythran source alongside the Cython… +* [#20119](https://github.com/scipy/scipy/pull/20119): Fix small issues in docstrings +* [#20121](https://github.com/scipy/scipy/pull/20121): BLD: simplifications in meson.build files +* [#20122](https://github.com/scipy/scipy/pull/20122): MAINT: update Boost.Math to 1.83.0 +* [#20123](https://github.com/scipy/scipy/pull/20123): MAINT: stats: fix test failure in `kendalltau\_seasonal` +* [#20130](https://github.com/scipy/scipy/pull/20130): BUG: Use Cython implementation of complex hyp2f1 in orthogonal\_eval.pxd +* [#20135](https://github.com/scipy/scipy/pull/20135): MAINT: interpolate: define `F\_INT` as `int` rather than `npy\_int32` +* [#20138](https://github.com/scipy/scipy/pull/20138): TST: optimize: silence the output from calling cobyla with disp=True +* [#20141](https://github.com/scipy/scipy/pull/20141): MAINT/CI: special/array types: test alternative backends in CI +* [#20143](https://github.com/scipy/scipy/pull/20143): DOC: stats: Fix typo in the doc of the Kstwobign distribution +* [#20144](https://github.com/scipy/scipy/pull/20144): MAINT, ENH: Hausdorff simplification +* [#20145](https://github.com/scipy/scipy/pull/20145): TST: special: bump tolerances for new `cdftnc` regression tests +* [#20146](https://github.com/scipy/scipy/pull/20146): MAINT: fix incorrect `noexcept` usage in Cython functions +* [#20149](https://github.com/scipy/scipy/pull/20149): BLD: Ensure Python.h is included before system headers. +* [#20153](https://github.com/scipy/scipy/pull/20153): BLD: interpolate: \_interpnd\_info does not need installing +* [#20154](https://github.com/scipy/scipy/pull/20154): ENH: sparse: implement fromkeys for \_dok\_base +* [#20163](https://github.com/scipy/scipy/pull/20163): MAINT: dev.py: allow –args after – +* [#20168](https://github.com/scipy/scipy/pull/20168): BUG: optimize: Fix constraint condition in inner loop of nnls +* [#20172](https://github.com/scipy/scipy/pull/20172): MAINT: (additional) array copy semantics shims +* [#20173](https://github.com/scipy/scipy/pull/20173): TST:special:Add partial tests for nrdtrimn and nrdtrisd +* [#20174](https://github.com/scipy/scipy/pull/20174): DOC: interpolate: `splrep` default boundary condition +* [#20175](https://github.com/scipy/scipy/pull/20175): MAINT: sparse: add missing dict methods to DOK and tests +* [#20176](https://github.com/scipy/scipy/pull/20176): MAINT: vulture/ruff fixups +* [#20181](https://github.com/scipy/scipy/pull/20181): MAINT: Avoid `descr->elsize` and use intp for it. +* [#20183](https://github.com/scipy/scipy/pull/20183): BUG: Fix fancy indexing on compressed sparse arrays with mixed… +* [#20184](https://github.com/scipy/scipy/pull/20184): DOC, DX: Remove version warning banner in latest version +* [#20186](https://github.com/scipy/scipy/pull/20186): MAINT: update action. Closes #20180 +* [#20191](https://github.com/scipy/scipy/pull/20191): BUG: Fix shape of single Rotation raised to the 0 or 1 power +* [#20193](https://github.com/scipy/scipy/pull/20193): MAINT: Bump `npy2\_compat.h` and add temporary pybind11 workaround +* [#20195](https://github.com/scipy/scipy/pull/20195): ENH: linalg: allow readonly arrays in expm et al +* [#20197](https://github.com/scipy/scipy/pull/20197): TST: linalg: fix complex sort in test\_bad\_geneig +* [#20198](https://github.com/scipy/scipy/pull/20198): BLD: update minimum Cython version to 3.0.8 +* [#20203](https://github.com/scipy/scipy/pull/20203): TST: linalg: undo xfail TestEig::test\_singular +* [#20204](https://github.com/scipy/scipy/pull/20204): TST: linalg: add a regression test for a gen eig problem +* [#20205](https://github.com/scipy/scipy/pull/20205): BUG: Fixed `fftshift()` in `ShortTimeFFT`. +* [#20206](https://github.com/scipy/scipy/pull/20206): DOC: clarify role of p in linalg.qr. +* [#20209](https://github.com/scipy/scipy/pull/20209): CI: move regular macosx\_arm64 from cirrus to GHA +* [#20210](https://github.com/scipy/scipy/pull/20210): BLD: macosx\_arm64 wheel build on GHA instead of cirrus +* [#20212](https://github.com/scipy/scipy/pull/20212): BUG: linalg/sqrtm: more robust check for real->complex Schur… +* [#20215](https://github.com/scipy/scipy/pull/20215): MAINT: bump OpenBLAS “the old way” +* [#20217](https://github.com/scipy/scipy/pull/20217): DOC/MAINT: add examples for nctdtridf, nctdtrinc, nctdtrit +* [#20218](https://github.com/scipy/scipy/pull/20218): TST: mark linalg.sqrtm test as xfail +* [#20221](https://github.com/scipy/scipy/pull/20221): TST: Tweak tols and ignore warnings for more reliable SVD tests +* [#20222](https://github.com/scipy/scipy/pull/20222): DOC add likelihood formula to stats.CensoredData +* [#20224](https://github.com/scipy/scipy/pull/20224): BUG: fix `cluster.vq.kmeans2` with minit=’++’ for 1D data +* [#20227](https://github.com/scipy/scipy/pull/20227): MAINT: remove repeated “the” typos +* [#20229](https://github.com/scipy/scipy/pull/20229): BUG: linalg: fix int overflow in Cholesky (potrf) +* [#20231](https://github.com/scipy/scipy/pull/20231): DOC/DX: array types: update `\_asarray` description +* [#20232](https://github.com/scipy/scipy/pull/20232): BLD: Refactor BLAS/LAPACK wrapper infrastructure +* [#20233](https://github.com/scipy/scipy/pull/20233): DOC: stats.rv\_continuous.fit: fix backslashes +* [#20235](https://github.com/scipy/scipy/pull/20235): DOC: add reference for ARGUS distribution in scipy.stats +* [#20236](https://github.com/scipy/scipy/pull/20236): DOC: fix small typo in array API docs +* [#20237](https://github.com/scipy/scipy/pull/20237): MAINT: optimize: update `\_direct` for typos +* [#20238](https://github.com/scipy/scipy/pull/20238): MAINT: revert ARPACK changes from #20227 +* [#20241](https://github.com/scipy/scipy/pull/20241): BLD: remove use of `NPY\_VISIBILITY\_HIDDEN` +* [#20243](https://github.com/scipy/scipy/pull/20243): MAINT: Specfun translation into C++ +* [#20245](https://github.com/scipy/scipy/pull/20245): MAINT: Updated \_specfun.pyx +* [#20248](https://github.com/scipy/scipy/pull/20248): MAINT: Removed specfun\_lib and updated specfun\_wrappers +* [#20250](https://github.com/scipy/scipy/pull/20250): MAINT: interpolate: const qualify cython arrays +* [#20251](https://github.com/scipy/scipy/pull/20251): MAINT:special:Adjust inf values for cdflib +* [#20254](https://github.com/scipy/scipy/pull/20254): MAINT: linalg: readability refactor Riccati equation solver tests +* [#20259](https://github.com/scipy/scipy/pull/20259): BUG: linalg: fix `expm` for large arrays +* [#20261](https://github.com/scipy/scipy/pull/20261): BUG:linalg:Remove the 2x2 branch in expm +* [#20263](https://github.com/scipy/scipy/pull/20263): DOC/REL: add missing expired deprecations to 1.12.0 notes +* [#20266](https://github.com/scipy/scipy/pull/20266): MAINT: stats.wilcoxon: pass `PermutationMethod` options to… +* [#20270](https://github.com/scipy/scipy/pull/20270): BLD: update dependencies for 1.13.0 release and numpy 2.0 +* [#20279](https://github.com/scipy/scipy/pull/20279): MAINT: 1.13.0rc1 prep [wheel build] +* [#20290](https://github.com/scipy/scipy/pull/20290): REL: set 1.13.0rc2 unreleased +* [#20299](https://github.com/scipy/scipy/pull/20299): BUG: Optimize: NewtonCG min crashes with xtol=0 +* [#20313](https://github.com/scipy/scipy/pull/20313): MAINT: bump pocketfft, MacOS patch +* [#20314](https://github.com/scipy/scipy/pull/20314): BUG: sparse: Restore random coordinate ordering to pre-1.12 results +* [#20318](https://github.com/scipy/scipy/pull/20318): BUG: signal: Fix scalar input issue of signal.lfilter +* [#20327](https://github.com/scipy/scipy/pull/20327): DOC: mention BSpline.insert\_knot in the 1.13.0 release notes +* [#20333](https://github.com/scipy/scipy/pull/20333): BUG: sync pocketfft again +* [#20337](https://github.com/scipy/scipy/pull/20337): MAINT: spatial: use cython\_lapack in spatial/\_qhull.pyx +* [#20341](https://github.com/scipy/scipy/pull/20341): BUG: linalg: raise an error in dnrm2(…, incx<0) +* [#20345](https://github.com/scipy/scipy/pull/20345): BUG: nelder-mead fix degenerate simplex +* [#20347](https://github.com/scipy/scipy/pull/20347): BLD: require pybind11 >=2.12.0 for numpy 2.0 compatibility +* [#20349](https://github.com/scipy/scipy/pull/20349): Do not segfault in svd(a) with VT.size > INT\_MAX +* [#20350](https://github.com/scipy/scipy/pull/20350): BUG: optimize: Fix wrong condition to check invalid optimization… +* [#20353](https://github.com/scipy/scipy/pull/20353): DOC: remove outdated NumPy imports note +* [#20359](https://github.com/scipy/scipy/pull/20359): ENH: Converting amos to std::complex +* [#20361](https://github.com/scipy/scipy/pull/20361): ENH: Rest of amos translation +* [#20362](https://github.com/scipy/scipy/pull/20362): MAINT, BUG: bump OpenBLAS +* [#20364](https://github.com/scipy/scipy/pull/20364): BUG: interpolate: Fix wrong warning message if degree=-1 in `interpolate.RBFInterpolator` +* [#20374](https://github.com/scipy/scipy/pull/20374): MAINT: update pybind11 and numpy build-time requirements for… diff --git a/corpus/changelog/scipy_releases/scipy_1131.md b/corpus/changelog/scipy_releases/scipy_1131.md new file mode 100644 index 0000000000000000000000000000000000000000..32582bc4130882aa7d39f5e8430c104a3074315f --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1131.md @@ -0,0 +1,104 @@ +# SciPy 1.13.1 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.13.1-notes.html +Version: 1.13.1 + +Contents + +* [SciPy 1.13.1 Release Notes](#scipy-1-13-1-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.13.1](#issues-closed-for-1-13-1) + - [Pull requests for 1.13.1](#pull-requests-for-1-13-1) + +SciPy 1.13.1 is a bug-fix release with no new features +compared to 1.13.0. The version of OpenBLAS shipped with +the PyPI binaries has been increased to 0.3.27. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Name (commits) +* h-vetinari (1) +* Jake Bowhay (2) +* Evgeni Burovski (6) +* Sean Cheah (2) +* Lucas Colley (2) +* DWesl (2) +* Ralf Gommers (7) +* Ben Greiner (1) + +* Matt Haberland (2) +* Gregory R. Lee (1) +* Philip Loche (1) + +* Sijo Valayakkad Manikandan (1) + +* Matti Picus (1) +* Tyler Reddy (62) +* Atsushi Sakai (1) +* Daniel Schmitz (2) +* Dan Schult (3) +* Scott Shambaugh (2) +* Edgar Andrés Margffoy Tuay (1) + +A total of 19 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.13.1](#id3)[#](#issues-closed-for-1-13-1 "Link to this heading") + +* [#19423](https://github.com/scipy/scipy/issues/19423): BUG: `scipy.ndimage.value\_indices` returns empty dict for `intc`/`uintc` dtype on Windows +* [#20264](https://github.com/scipy/scipy/issues/20264): DOC, MAINT: .jupyterlite.doit.db shows up untracked +* [#20392](https://github.com/scipy/scipy/issues/20392): DOC: optimize.root(method=’lm’) option +* [#20415](https://github.com/scipy/scipy/issues/20415): BUG: csr\_array can no longer be initialized with 1D array +* [#20471](https://github.com/scipy/scipy/issues/20471): BUG: `TestEig.test\_falker` fails on windows + MKL as well as… +* [#20491](https://github.com/scipy/scipy/issues/20491): BUG: Cannot find `OpenBLAS` on Cygwin +* [#20506](https://github.com/scipy/scipy/issues/20506): BUG: special.spherical\_in: derivative at `z=0, n=1` incorrect +* [#20512](https://github.com/scipy/scipy/issues/20512): BUG: `eigh` fails for size 1 array with driver=evd +* [#20531](https://github.com/scipy/scipy/issues/20531): BUG: warning from `optimize.least\_squares` for astropy with… +* [#20555](https://github.com/scipy/scipy/issues/20555): BUG: spatial: error in `Rotation.align\_vectors()` with an infinite… +* [#20576](https://github.com/scipy/scipy/issues/20576): MAINT, TST: two types of failures observed on maintenance/1.13.x… +* [#20580](https://github.com/scipy/scipy/issues/20580): BUG: scipy.special.factorial2 doesn’t handle `uint32` dtypes +* [#20591](https://github.com/scipy/scipy/issues/20591): BUG: scipy.stats.wilcoxon in 1.13 fails on 2D array with nan… +* [#20623](https://github.com/scipy/scipy/issues/20623): BUG: scipy.spatial.Delaunay, scipy.interpolate.LinearNDInterpolator… +* [#20648](https://github.com/scipy/scipy/issues/20648): BUG: stats.yulesimon: incorrect kurtosis values +* [#20652](https://github.com/scipy/scipy/issues/20652): BUG: incorrect origin tuple handling in ndimage `minimum\_filter`… +* [#20660](https://github.com/scipy/scipy/issues/20660): BUG: spatial: `Rotation.align\_vectors()` incorrect for anti-parallel… +* [#20670](https://github.com/scipy/scipy/issues/20670): BUG: sparse matrix creation in 1.13 with indices not summing… +* [#20692](https://github.com/scipy/scipy/issues/20692): BUG: stats.zipf: incorrect pmf values +* [#20714](https://github.com/scipy/scipy/issues/20714): CI: scipy installation failing in umfpack tests + +### [Pull requests for 1.13.1](#id4)[#](#pull-requests-for-1-13-1 "Link to this heading") + +* [#20280](https://github.com/scipy/scipy/pull/20280): MAINT: added doc/source/.jupyterlite.doit.db to .gitignore See… +* [#20322](https://github.com/scipy/scipy/pull/20322): BUG: sparse: align dok\_array.pop() to dict.pop() for case with… +* [#20333](https://github.com/scipy/scipy/pull/20333): BUG: sync pocketfft again +* [#20381](https://github.com/scipy/scipy/pull/20381): REL, MAINT: prep for 1.13.1 +* [#20401](https://github.com/scipy/scipy/pull/20401): DOC: optimize: fix wrong optional argument name in `root(method=”lm”)`. +* [#20435](https://github.com/scipy/scipy/pull/20435): DOC: add missing deprecations from 1.13.0 release notes +* [#20437](https://github.com/scipy/scipy/pull/20437): MAINT/DOC: fix syntax in 1.13.0 release notes +* [#20444](https://github.com/scipy/scipy/pull/20444): BUG: sparse: Clean up 1D input handling to sparse array/matrix… +* [#20449](https://github.com/scipy/scipy/pull/20449): DOC: remove spurious backtick from release notes +* [#20473](https://github.com/scipy/scipy/pull/20473): BUG: linalg: fix ordering of complex conj gen eigenvalues +* [#20474](https://github.com/scipy/scipy/pull/20474): TST: tolerance bumps for the conda-forge builds +* [#20484](https://github.com/scipy/scipy/pull/20484): TST: compare absolute values of U and VT in pydata-sparse SVD… +* [#20505](https://github.com/scipy/scipy/pull/20505): BUG: Include Python.h before system headers. +* [#20516](https://github.com/scipy/scipy/pull/20516): BUG: linalg: fix eigh(1x1 array, driver=’evd’) f2py check +* [#20527](https://github.com/scipy/scipy/pull/20527): BUG: `spherical\_in` for `n=0` and `z=0` +* [#20530](https://github.com/scipy/scipy/pull/20530): BLD: Fix error message for f2py generation fail +* [#20533](https://github.com/scipy/scipy/pull/20533): TST: Adapt to `\_\_array\_\_(copy=True)` +* [#20537](https://github.com/scipy/scipy/pull/20537): BLD: Move Python-including files to start of source. +* [#20567](https://github.com/scipy/scipy/pull/20567): REV: 1.13.x: revert changes to f2py and tempita handling in meson.build… +* [#20569](https://github.com/scipy/scipy/pull/20569): update openblas to 0.3.27 +* [#20573](https://github.com/scipy/scipy/pull/20573): BUG: Fix error with 180 degree rotation in Rotation.align\_vectors()… +* [#20586](https://github.com/scipy/scipy/pull/20586): MAINT: optimize.linprog: fix bug when integrality is a list of… +* [#20592](https://github.com/scipy/scipy/pull/20592): MAINT: stats.wilcoxon: fix failure with multidimensional `x`… +* [#20601](https://github.com/scipy/scipy/pull/20601): MAINT: lint: temporarily disable UP031 +* [#20607](https://github.com/scipy/scipy/pull/20607): BUG: handle uint arrays in factorial{,2,k} +* [#20611](https://github.com/scipy/scipy/pull/20611): BUG: prevent QHull message stream being closed twice +* [#20629](https://github.com/scipy/scipy/pull/20629): MAINT/DEV: lint: disable UP032 +* [#20633](https://github.com/scipy/scipy/pull/20633): BUG: fix Vor/Delaunay segfaults +* [#20644](https://github.com/scipy/scipy/pull/20644): BUG: ndimage.value\_indices: deal with unfixed types +* [#20653](https://github.com/scipy/scipy/pull/20653): BUG: ndimage: fix origin handling for `{minimum, maximum}\_filter` +* [#20654](https://github.com/scipy/scipy/pull/20654): MAINT: stats.yulesimon: fix kurtosis +* [#20687](https://github.com/scipy/scipy/pull/20687): BUG: sparse: Fix summing duplicates for CSR/CSC creation from… +* [#20702](https://github.com/scipy/scipy/pull/20702): BUG: stats: Fix `zipf.pmf` and `zipfian.pmf` for int32 `k` +* [#20727](https://github.com/scipy/scipy/pull/20727): CI: pin Python for MacOS conda diff --git a/corpus/changelog/scipy_releases/scipy_1140.md b/corpus/changelog/scipy_releases/scipy_1140.md new file mode 100644 index 0000000000000000000000000000000000000000..751da255c3781b44d711c3253f621b316ab145c7 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1140.md @@ -0,0 +1,746 @@ +# SciPy 1.14.0 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.14.0-notes.html +Version: 1.14.0 + +Contents + +* [SciPy 1.14.0 Release Notes](#scipy-1-14-0-release-notes) + + + [Highlights of this release](#highlights-of-this-release) + + [New features](#new-features) + + - [[`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") improvements](#scipy-fft-improvements) + - [[`scipy.io`](../reference/io.html#module-scipy.io "scipy.io") improvements](#scipy-io-improvements) + - [[`scipy.constants`](../reference/constants.html#module-scipy.constants "scipy.constants") improvements](#scipy-constants-improvements) + - [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#scipy-interpolate-improvements) + - [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#scipy-optimize-improvements) + - [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#scipy-signal-improvements) + - [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#scipy-sparse-improvements) + - [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#scipy-spatial-improvements) + - [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#scipy-special-improvements) + - [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#scipy-stats-improvements) + + [Array API Standard Support](#array-api-standard-support) + + [Deprecated features](#deprecated-features) + + [Backwards incompatible changes](#backwards-incompatible-changes) + + - [Expired deprecations](#expired-deprecations) + + [Other changes](#other-changes) + + [Authors](#authors) + + [Issues closed for 1.14.0](#issues-closed-for-1-14-0) + + [Pull requests for 1.14.0](#pull-requests-for-1-14-0) + +SciPy 1.14.0 is the culmination of 3 months of hard work. It contains +many new features, numerous bug-fixes, improved test coverage and better +documentation. There have been a number of deprecations and API changes +in this release, which are documented below. All users are encouraged to +upgrade to this release, as there are a large number of bug-fixes and +optimizations. Before upgrading, we recommend that users check that +their own code does not use deprecated SciPy functionality (to do so, +run your code with `python -Wd` and check for `DeprecationWarning` s). +Our development attention will now shift to bug-fix releases on the +1.14.x branch, and on adding new features on the main branch. + +This release requires Python 3.10+ and NumPy 1.23.5 or greater. + +For running on PyPy, PyPy3 6.0+ is required. + +## [Highlights of this release](#id2)[#](#highlights-of-this-release "Link to this heading") + +* SciPy now supports the new Accelerate library introduced in macOS 13.3, and + has wheels built against Accelerate for macOS >=14 resulting in significant + performance improvements for many linear algebra operations. +* A new method, `cobyqa`, has been added to [`scipy.optimize.minimize`](../reference/generated/scipy.optimize.minimize.html#scipy.optimize.minimize "scipy.optimize.minimize") - this + is an interface for COBYQA (Constrained Optimization BY Quadratic + Approximations), a derivative-free optimization solver, designed to + supersede COBYLA, developed by the Department of Applied Mathematics, The + Hong Kong Polytechnic University. +* [`scipy.sparse.linalg.spsolve_triangular`](../reference/generated/scipy.sparse.linalg.spsolve_triangular.html#scipy.sparse.linalg.spsolve_triangular "scipy.sparse.linalg.spsolve_triangular") is now more than an order of + magnitude faster in many cases. + +## [New features](#id3)[#](#new-features "Link to this heading") + +### [[`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") improvements](#id4)[#](#scipy-fft-improvements "Link to this heading") + +* A new function, [`scipy.fft.prev_fast_len`](../reference/generated/scipy.fft.prev_fast_len.html#scipy.fft.prev_fast_len "scipy.fft.prev_fast_len"), has been added. This function + finds the largest composite of FFT radices that is less than the target + length. It is useful for discarding a minimal number of samples before FFT. + +### [[`scipy.io`](../reference/io.html#module-scipy.io "scipy.io") improvements](#id5)[#](#scipy-io-improvements "Link to this heading") + +* `wavfile` now supports reading and writing of `wav` files in the RF64 + format, allowing files greater than 4 GB in size to be handled. + +### [[`scipy.constants`](../reference/constants.html#module-scipy.constants "scipy.constants") improvements](#id6)[#](#scipy-constants-improvements "Link to this heading") + +* Experimental support for the array API standard has been added. + +### [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#id7)[#](#scipy-interpolate-improvements "Link to this heading") + +* [`scipy.interpolate.Akima1DInterpolator`](../reference/generated/scipy.interpolate.Akima1DInterpolator.html#scipy.interpolate.Akima1DInterpolator "scipy.interpolate.Akima1DInterpolator") now supports extrapolation via the + `extrapolate` argument. + +### [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#id8)[#](#scipy-optimize-improvements "Link to this heading") + +* [`scipy.optimize.HessianUpdateStrategy`](../reference/generated/scipy.optimize.HessianUpdateStrategy.html#scipy.optimize.HessianUpdateStrategy "scipy.optimize.HessianUpdateStrategy") now also accepts square arrays for + `init_scale`. +* A new method, `cobyqa`, has been added to [`scipy.optimize.minimize`](../reference/generated/scipy.optimize.minimize.html#scipy.optimize.minimize "scipy.optimize.minimize") - this + is an interface for COBYQA (Constrained Optimization BY Quadratic + Approximations), a derivative-free optimization solver, designed to + supersede COBYLA, developed by the Department of Applied Mathematics, The + Hong Kong Polytechnic University. +* There are some performance improvements in + [`scipy.optimize.differential_evolution`](../reference/generated/scipy.optimize.differential_evolution.html#scipy.optimize.differential_evolution "scipy.optimize.differential_evolution"). +* [`scipy.optimize.approx_fprime`](../reference/generated/scipy.optimize.approx_fprime.html#scipy.optimize.approx_fprime "scipy.optimize.approx_fprime") now has linear space complexity. + +### [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#id9)[#](#scipy-signal-improvements "Link to this heading") + +* [`scipy.signal.minimum_phase`](../reference/generated/scipy.signal.minimum_phase.html#scipy.signal.minimum_phase "scipy.signal.minimum_phase") has a new argument `half`, allowing the + provision of a filter of the same length as the linear-phase FIR filter + coefficients and with the same magnitude spectrum. + +### [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#id10)[#](#scipy-sparse-improvements "Link to this heading") + +* Sparse arrays now support 1D shapes in COO, DOK and CSR formats. + These are all the formats we currently intend to support 1D shapes. + Other sparse array formats raise an exception for 1D input. +* Sparse array methods min/nanmin/argmin and max analogs now return 1D arrays. + Results are still COO format sparse arrays for min/nanmin and + dense `np.ndarray` for argmin. +* Iterating over `csr_array` or `csc_array` yields 1D (CSC) arrays. +* Sparse matrix and array objects improve their `repr` and `str` output. +* A special case has been added to handle multiplying a `dia_array` by a + scalar, which avoids a potentially costly conversion to CSR format. +* [`scipy.sparse.csgraph.yen`](../reference/generated/scipy.sparse.csgraph.yen.html#scipy.sparse.csgraph.yen "scipy.sparse.csgraph.yen") has been added, allowing usage of Yen’s K-Shortest + Paths algorithm on a directed on undirected graph. +* Addition between DIA-format sparse arrays and matrices is now faster. +* [`scipy.sparse.linalg.spsolve_triangular`](../reference/generated/scipy.sparse.linalg.spsolve_triangular.html#scipy.sparse.linalg.spsolve_triangular "scipy.sparse.linalg.spsolve_triangular") is now more than an order of + magnitude faster in many cases. + +### [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#id11)[#](#scipy-spatial-improvements "Link to this heading") + +* `Rotation` supports an alternative “scalar-first” convention of quaternion + component ordering. It is available via the keyword argument `scalar_first` + of `from_quat` and `as_quat` methods. +* Some minor performance improvements for inverting of `Rotation` objects. + +### [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#id12)[#](#scipy-special-improvements "Link to this heading") + +* Added [`scipy.special.log_wright_bessel`](../reference/generated/scipy.special.log_wright_bessel.html#scipy.special.log_wright_bessel "scipy.special.log_wright_bessel"), for calculation of the logarithm of + Wright’s Bessel function. +* The relative error in [`scipy.special.hyp2f1`](../reference/generated/scipy.special.hyp2f1.html#scipy.special.hyp2f1 "scipy.special.hyp2f1") calculations has improved + substantially. +* Improved behavior of `boxcox`, `inv_boxcox`, `boxcox1p`, and + `inv_boxcox1p` by preventing premature overflow. + +### [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#id13)[#](#scipy-stats-improvements "Link to this heading") + +* A new function [`scipy.stats.power`](../reference/generated/scipy.stats.power.html#scipy.stats.power "scipy.stats.power") can be used for simulating the power + of a hypothesis test with respect to a specified alternative. +* The Irwin-Hall (AKA Uniform Sum) distribution has been added as + [`scipy.stats.irwinhall`](../reference/generated/scipy.stats.irwinhall.html#scipy.stats.irwinhall "scipy.stats.irwinhall"). +* Exact p-value calculations of [`scipy.stats.mannwhitneyu`](../reference/generated/scipy.stats.mannwhitneyu.html#scipy.stats.mannwhitneyu "scipy.stats.mannwhitneyu") are much faster + and use less memory. +* [`scipy.stats.pearsonr`](../reference/generated/scipy.stats.pearsonr.html#scipy.stats.pearsonr "scipy.stats.pearsonr") now accepts n-D arrays and computes the statistic + along a specified `axis`. +* [`scipy.stats.kstat`](../reference/generated/scipy.stats.kstat.html#scipy.stats.kstat "scipy.stats.kstat"), [`scipy.stats.kstatvar`](../reference/generated/scipy.stats.kstatvar.html#scipy.stats.kstatvar "scipy.stats.kstatvar"), and [`scipy.stats.bartlett`](../reference/generated/scipy.stats.bartlett.html#scipy.stats.bartlett "scipy.stats.bartlett") + are faster at performing calculations along an axis of a large n-D array. + +## [Array API Standard Support](#id14)[#](#array-api-standard-support "Link to this heading") + +*Experimental* support for array libraries other than NumPy has been added to +existing sub-packages in recent versions of SciPy. Please consider testing +these features by setting an environment variable `SCIPY_ARRAY_API=1` and +providing PyTorch, JAX, or CuPy arrays as array arguments. + +As of 1.14.0, there is support for + +* [`scipy.cluster`](../reference/cluster.html#module-scipy.cluster "scipy.cluster") +* [`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") +* [`scipy.constants`](../reference/constants.html#module-scipy.constants "scipy.constants") +* [`scipy.special`](../reference/special.html#module-scipy.special "scipy.special"): (select functions) + + + [`scipy.special.log_ndtr`](../reference/generated/scipy.special.log_ndtr.html#scipy.special.log_ndtr "scipy.special.log_ndtr") + + [`scipy.special.ndtr`](../reference/generated/scipy.special.ndtr.html#scipy.special.ndtr "scipy.special.ndtr") + + [`scipy.special.ndtri`](../reference/generated/scipy.special.ndtri.html#scipy.special.ndtri "scipy.special.ndtri") + + [`scipy.special.erf`](../reference/generated/scipy.special.erf.html#scipy.special.erf "scipy.special.erf") + + [`scipy.special.erfc`](../reference/generated/scipy.special.erfc.html#scipy.special.erfc "scipy.special.erfc") + + [`scipy.special.i0`](../reference/generated/scipy.special.i0.html#scipy.special.i0 "scipy.special.i0") + + [`scipy.special.i0e`](../reference/generated/scipy.special.i0e.html#scipy.special.i0e "scipy.special.i0e") + + [`scipy.special.i1`](../reference/generated/scipy.special.i1.html#scipy.special.i1 "scipy.special.i1") + + [`scipy.special.i1e`](../reference/generated/scipy.special.i1e.html#scipy.special.i1e "scipy.special.i1e") + + [`scipy.special.gammaln`](../reference/generated/scipy.special.gammaln.html#scipy.special.gammaln "scipy.special.gammaln") + + [`scipy.special.gammainc`](../reference/generated/scipy.special.gammainc.html#scipy.special.gammainc "scipy.special.gammainc") + + [`scipy.special.gammaincc`](../reference/generated/scipy.special.gammaincc.html#scipy.special.gammaincc "scipy.special.gammaincc") + + [`scipy.special.logit`](../reference/generated/scipy.special.logit.html#scipy.special.logit "scipy.special.logit") + + [`scipy.special.expit`](../reference/generated/scipy.special.expit.html#scipy.special.expit "scipy.special.expit") + + [`scipy.special.entr`](../reference/generated/scipy.special.entr.html#scipy.special.entr "scipy.special.entr") + + [`scipy.special.rel_entr`](../reference/generated/scipy.special.rel_entr.html#scipy.special.rel_entr "scipy.special.rel_entr") + + [`scipy.special.xlogy`](../reference/generated/scipy.special.xlogy.html#scipy.special.xlogy "scipy.special.xlogy") + + [`scipy.special.chdtrc`](../reference/generated/scipy.special.chdtrc.html#scipy.special.chdtrc "scipy.special.chdtrc") +* [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats"): (select functions) + + + [`scipy.stats.describe`](../reference/generated/scipy.stats.describe.html#scipy.stats.describe "scipy.stats.describe") + + [`scipy.stats.moment`](../reference/generated/scipy.stats.moment.html#scipy.stats.moment "scipy.stats.moment") + + [`scipy.stats.skew`](../reference/generated/scipy.stats.skew.html#scipy.stats.skew "scipy.stats.skew") + + [`scipy.stats.kurtosis`](../reference/generated/scipy.stats.kurtosis.html#scipy.stats.kurtosis "scipy.stats.kurtosis") + + [`scipy.stats.kstat`](../reference/generated/scipy.stats.kstat.html#scipy.stats.kstat "scipy.stats.kstat") + + [`scipy.stats.kstatvar`](../reference/generated/scipy.stats.kstatvar.html#scipy.stats.kstatvar "scipy.stats.kstatvar") + + [`scipy.stats.circmean`](../reference/generated/scipy.stats.circmean.html#scipy.stats.circmean "scipy.stats.circmean") + + [`scipy.stats.circvar`](../reference/generated/scipy.stats.circvar.html#scipy.stats.circvar "scipy.stats.circvar") + + [`scipy.stats.circstd`](../reference/generated/scipy.stats.circstd.html#scipy.stats.circstd "scipy.stats.circstd") + + [`scipy.stats.entropy`](../reference/generated/scipy.stats.entropy.html#scipy.stats.entropy "scipy.stats.entropy") + + [`scipy.stats.variation`](../reference/generated/scipy.stats.variation.html#scipy.stats.variation "scipy.stats.variation") + + [`scipy.stats.sem`](../reference/generated/scipy.stats.sem.html#scipy.stats.sem "scipy.stats.sem") + + [`scipy.stats.ttest_1samp`](../reference/generated/scipy.stats.ttest_1samp.html#scipy.stats.ttest_1samp "scipy.stats.ttest_1samp") + + [`scipy.stats.pearsonr`](../reference/generated/scipy.stats.pearsonr.html#scipy.stats.pearsonr "scipy.stats.pearsonr") + + [`scipy.stats.chisquare`](../reference/generated/scipy.stats.chisquare.html#scipy.stats.chisquare "scipy.stats.chisquare") + + [`scipy.stats.skewtest`](../reference/generated/scipy.stats.skewtest.html#scipy.stats.skewtest "scipy.stats.skewtest") + + [`scipy.stats.kurtosistest`](../reference/generated/scipy.stats.kurtosistest.html#scipy.stats.kurtosistest "scipy.stats.kurtosistest") + + [`scipy.stats.normaltest`](../reference/generated/scipy.stats.normaltest.html#scipy.stats.normaltest "scipy.stats.normaltest") + + [`scipy.stats.jarque_bera`](../reference/generated/scipy.stats.jarque_bera.html#scipy.stats.jarque_bera "scipy.stats.jarque_bera") + + [`scipy.stats.bartlett`](../reference/generated/scipy.stats.bartlett.html#scipy.stats.bartlett "scipy.stats.bartlett") + + [`scipy.stats.power_divergence`](../reference/generated/scipy.stats.power_divergence.html#scipy.stats.power_divergence "scipy.stats.power_divergence") + + [`scipy.stats.monte_carlo_test`](../reference/generated/scipy.stats.monte_carlo_test.html#scipy.stats.monte_carlo_test "scipy.stats.monte_carlo_test") + +## [Deprecated features](#id15)[#](#deprecated-features "Link to this heading") + +* [`scipy.stats.gstd`](../reference/generated/scipy.stats.gstd.html#scipy.stats.gstd "scipy.stats.gstd"), [`scipy.stats.chisquare`](../reference/generated/scipy.stats.chisquare.html#scipy.stats.chisquare "scipy.stats.chisquare"), and + [`scipy.stats.power_divergence`](../reference/generated/scipy.stats.power_divergence.html#scipy.stats.power_divergence "scipy.stats.power_divergence") have deprecated support for masked array + input. +* [`scipy.stats.linregress`](../reference/generated/scipy.stats.linregress.html#scipy.stats.linregress "scipy.stats.linregress") has deprecated support for specifying both samples + in one argument; `x` and `y` are to be provided as separate arguments. +* The `conjtransp` method for [`scipy.sparse.dok_array`](../reference/generated/scipy.sparse.dok_array.html#scipy.sparse.dok_array "scipy.sparse.dok_array") and + [`scipy.sparse.dok_matrix`](../reference/generated/scipy.sparse.dok_matrix.html#scipy.sparse.dok_matrix "scipy.sparse.dok_matrix") has been deprecated and will be removed in SciPy + 1.16.0. +* The option `quadrature="trapz"` in [`scipy.integrate.quad_vec`](../reference/generated/scipy.integrate.quad_vec.html#scipy.integrate.quad_vec "scipy.integrate.quad_vec") has been + deprecated in favour of `quadrature="trapezoid"` and will be removed in + SciPy 1.16.0. +* `scipy.special.{comb,perm}` have deprecated support for use of `exact=True` in + conjunction with non-integral `N` and/or `k`. + +## [Backwards incompatible changes](#id16)[#](#backwards-incompatible-changes "Link to this heading") + +* Many [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") functions now produce a standardized warning message when + an input sample is too small (e.g. zero size). Previously, these functions + may have raised an error, emitted one or more less informative warnings, or + emitted no warnings. In most cases, returned results are unchanged; in almost + all cases the correct result is `NaN`. + +### [Expired deprecations](#id17)[#](#expired-deprecations "Link to this heading") + +There is an ongoing effort to follow through on long-standing deprecations. +The following previously deprecated features are affected: + +* Several previously deprecated methods for sparse arrays were removed: + `asfptype`, `getrow`, `getcol`, `get_shape`, `getmaxprint`, + `set_shape`, `getnnz`, and `getformat`. Additionally, the `.A` and + `.H` attributes were removed. +* `scipy.integrate.{simps,trapz,cumtrapz}` have been removed in favour of + `simpson`, `trapezoid`, and `cumulative_trapezoid`. +* The `tol` argument of `scipy.sparse.linalg.{bcg,bicstab,cg,cgs,gcrotmk, + mres,lgmres,minres,qmr,tfqmr}` has been removed in favour of `rtol`. + Furthermore, the default value of `atol` for these functions has changed + to `0.0`. +* The `restrt` argument of [`scipy.sparse.linalg.gmres`](../reference/generated/scipy.sparse.linalg.gmres.html#scipy.sparse.linalg.gmres "scipy.sparse.linalg.gmres") has been removed in + favour of `restart`. +* The `initial_lexsort` argument of [`scipy.stats.kendalltau`](../reference/generated/scipy.stats.kendalltau.html#scipy.stats.kendalltau "scipy.stats.kendalltau") has been + removed. +* The `cond` and `rcond` arguments of [`scipy.linalg.pinv`](../reference/generated/scipy.linalg.pinv.html#scipy.linalg.pinv "scipy.linalg.pinv") have been + removed. +* The `even` argument of [`scipy.integrate.simpson`](../reference/generated/scipy.integrate.simpson.html#scipy.integrate.simpson "scipy.integrate.simpson") has been removed. +* The `turbo` and `eigvals` arguments from `scipy.linalg.{eigh,eigvalsh}` + have been removed. +* The `legacy` argument of [`scipy.special.comb`](../reference/generated/scipy.special.comb.html#scipy.special.comb "scipy.special.comb") has been removed. +* The `hz`/`nyq` argument of `signal.{firls, firwin, firwin2, remez}` has + been removed. +* Objects that weren’t part of the public interface but were accessible through + deprecated submodules have been removed. +* `float128`, `float96`, and object arrays now raise an error in + [`scipy.signal.medfilt`](../reference/generated/scipy.signal.medfilt.html#scipy.signal.medfilt "scipy.signal.medfilt") and [`scipy.signal.order_filter`](../reference/generated/scipy.signal.order_filter.html#scipy.signal.order_filter "scipy.signal.order_filter"). +* `scipy.interpolate.interp2d` has been replaced by an empty stub (to be + removed completely in the future). +* Coinciding with changes to function signatures (e.g. removal of a deprecated + keyword), we had deprecated positional use of keyword arguments for the + affected functions, which will now raise an error. Affected functions are: + + + `sparse.linalg.{bicg, bicgstab, cg, cgs, gcrotmk, gmres, lgmres, minres, + qmr, tfqmr}` + + `stats.kendalltau` + + `linalg.pinv` + + `integrate.simpson` + + `linalg.{eigh,eigvalsh}` + + `special.comb` + + `signal.{firls, firwin, firwin2, remez}` + +## [Other changes](#id18)[#](#other-changes "Link to this heading") + +* SciPy now uses C17 as the C standard to build with, instead of C99. The C++ + standard remains C++17. +* macOS Accelerate, which got a major upgrade in macOS 13.3, is now supported. + This results in significant performance improvements for linear algebra + operations, as well as smaller binary wheels. +* Cross-compilation should be smoother and QEMU or similar is no longer needed + to run the cross interpreter. +* Experimental array API support for the JAX backend has been added to several + parts of SciPy. + +## [Authors](#id19)[#](#authors "Link to this heading") + +* Name (commits) +* h-vetinari (34) +* Steven Adams (1) + +* Max Aehle (1) + +* Ataf Fazledin Ahamed (2) + +* Luiz Eduardo Amaral (1) + +* Trinh Quoc Anh (1) + +* Miguel A. Batalla (7) + +* Tim Beyer (1) + +* Andrea Blengino (1) + +* boatwrong (1) +* Jake Bowhay (51) +* Dietrich Brunn (2) +* Evgeni Burovski (177) +* Tim Butters (7) + +* CJ Carey (5) +* Sean Cheah (46) +* Lucas Colley (73) +* Giuseppe “Peppe” Dilillo (1) + +* DWesl (2) +* Pieter Eendebak (5) +* Kenji S Emerson (1) + +* Jonas Eschle (1) +* fancidev (2) +* Anthony Frazier (1) + +* Ilan Gold (1) + +* Ralf Gommers (125) +* Rohit Goswami (28) +* Ben Greiner (1) + +* Lorenzo Gualniera (1) + +* Matt Haberland (260) +* Shawn Hsu (1) + +* Budjen Jovan (3) + +* Jozsef Kutas (1) +* Eric Larson (3) +* Gregory R. Lee (4) +* Philip Loche (1) + +* Christian Lorentzen (5) +* Sijo Valayakkad Manikandan (2) + +* marinelay (2) + +* Nikolay Mayorov (1) +* Nicholas McKibben (2) +* Melissa Weber Mendonça (7) +* João Mendes (1) + +* Samuel Le Meur-Diebolt (1) + +* Tomiță Militaru (2) + +* Andrew Nelson (35) +* Lysandros Nikolaou (1) +* Nick ODell (5) + +* Jacob Ogle (1) + +* Pearu Peterson (1) +* Matti Picus (5) +* Ilhan Polat (9) +* pwcnorthrop (3) + +* Bharat Raghunathan (1) +* Tom M. Ragonneau (2) + +* Tyler Reddy (101) +* Pamphile Roy (18) +* Atsushi Sakai (9) +* Daniel Schmitz (5) +* Julien Schueller (2) + +* Dan Schult (13) +* Tomer Sery (7) +* Scott Shambaugh (4) +* Tuhin Sharma (1) + +* Sheila-nk (4) +* Skylake (1) + +* Albert Steppi (215) +* Kai Striega (6) +* Zhibing Sun (2) + +* Nimish Telang (1) + +* toofooboo (1) + +* tpl2go (1) + +* Edgar Andrés Margffoy Tuay (44) +* Andrew Valentine (1) +* Valerix (1) + +* Christian Veenhuis (1) +* void (2) + +* Warren Weckesser (3) +* Xuefeng Xu (1) +* Rory Yorke (1) +* Xiao Yuan (1) +* Irwin Zaid (35) +* Elmar Zander (1) + +* Zaikun ZHANG (1) +* ਗਗਨਦੀਪ ਸਿੰਘ (Gagandeep Singh) (4) + + +A total of 85 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +## [Issues closed for 1.14.0](#id20)[#](#issues-closed-for-1-14-0 "Link to this heading") + +* [#5369](https://github.com/scipy/scipy/issues/5369): fsolve & root incorrect function-call count +* [#7203](https://github.com/scipy/scipy/issues/7203): vtk incompatibility with scipy.interpolate (and mvpoly.rbf) +* [#8056](https://github.com/scipy/scipy/issues/8056): cho\_factor and cho\_solve don’t support (0,0)-shape matrices +* [#8083](https://github.com/scipy/scipy/issues/8083): special.hyp2f1 returns the wrong values when c-a-b is an integer… +* [#8510](https://github.com/scipy/scipy/issues/8510): ValueError: failed to create intent(cache|hide)|optional array–… +* [#8848](https://github.com/scipy/scipy/issues/8848): `integrate.solve\_ivp` try to evaluate the function with much… +* [#8856](https://github.com/scipy/scipy/issues/8856): LinearNDInterpolator not thread safe +* [#9198](https://github.com/scipy/scipy/issues/9198): `solve\_ivp` RK45 can evaluate the function at times later than… +* [#9307](https://github.com/scipy/scipy/issues/9307): feature request: make `scipy.stats.pearsonr` accept 2-D arrays +* [#9459](https://github.com/scipy/scipy/issues/9459): BUG: linalg: lu and decompositions don’t support (0, 1) or (0,… +* [#12515](https://github.com/scipy/scipy/issues/12515): scipy.linalg.pinvh gives incorrect results +* [#14244](https://github.com/scipy/scipy/issues/14244): ValueError: On entry to DGESDD parameter number 10 had an illegal… +* [#14389](https://github.com/scipy/scipy/issues/14389): `linalg.inv` fails for arrays of shape (0, 0) +* [#14806](https://github.com/scipy/scipy/issues/14806): ENH: Add the Irwin-Hall (Uniform Sum) and Bates (Uniform Mean)… +* [#15722](https://github.com/scipy/scipy/issues/15722): DEP: special.comb: deprecate `exact=True` for non-integers +* [#16131](https://github.com/scipy/scipy/issues/16131): BUG: spsolve\_triangular is way slower than spsolve +* [#16583](https://github.com/scipy/scipy/issues/16583): Combining extensions in `stats.\_boost` into one +* [#16748](https://github.com/scipy/scipy/issues/16748): None of the `cython\_\*` APIs have any tests using Cython +* [#16926](https://github.com/scipy/scipy/issues/16926): TEST/BUG: Tolerance violation in test\_solvers::test\_solve\_discrete\_are +* [#17084](https://github.com/scipy/scipy/issues/17084): ENH: Exporting the removed component of detrend() +* [#17341](https://github.com/scipy/scipy/issues/17341): BUG: `solve\_ivp` evaluates outside the requested interval for… +* [#17559](https://github.com/scipy/scipy/issues/17559): ENH: \_mannwhitneyu.py computation of exact MWU statistics may… +* [#17658](https://github.com/scipy/scipy/issues/17658): Inconsistent support for empty matrices in linalg +* [#19322](https://github.com/scipy/scipy/issues/19322): BUG: `rv\_discrete.expect` fails when duplicate positions +* [#19348](https://github.com/scipy/scipy/issues/19348): BUG: stats.nct.pdf inconsistent behavior when compared to MATLAB… +* [#19586](https://github.com/scipy/scipy/issues/19586): BUG: scipy.signal.group\_delay not correct for complex coefficients +* [#19598](https://github.com/scipy/scipy/issues/19598): BUG: Bug in `scipy.sparse.linalg.svds` for large sparse matrices… +* [#19649](https://github.com/scipy/scipy/issues/19649): ENH: as\_quat() and from\_quat() seams to be reverse x,y,z,w vs… +* [#19734](https://github.com/scipy/scipy/issues/19734): Build warnings from HiGHS +* [#19872](https://github.com/scipy/scipy/issues/19872): BUG: error in calculation of p-values in sp.stats.wilcoxon when… +* [#19905](https://github.com/scipy/scipy/issues/19905): DEP: remove deprecated imports from privatized modules +* [#19918](https://github.com/scipy/scipy/issues/19918): ENH: Adding COBYQA to `scipy.optimize`? +* [#19921](https://github.com/scipy/scipy/issues/19921): BUG: Inconsistent Output from BenchGlobal Compared to BenchLeastSquares… +* [#19964](https://github.com/scipy/scipy/issues/19964): MAINT:BLD:special:Overhaul \_ufuncs and cython\_special machinery +* [#20124](https://github.com/scipy/scipy/issues/20124): BUG: stats.skewnorm.ppf returns wrong values with moderately… +* [#20128](https://github.com/scipy/scipy/issues/20128): BUG: `csr\_array(int())` errors +* [#20208](https://github.com/scipy/scipy/issues/20208): BUG: Test failures due to `invalid value encountered in \_beta\_ppf`… +* [#20247](https://github.com/scipy/scipy/issues/20247): ENH: Akima1DInterpolator Extrapolation +* [#20256](https://github.com/scipy/scipy/issues/20256): MAINT, BLD: symbol visibility warnings on MacOS ARM static lib… +* [#20277](https://github.com/scipy/scipy/issues/20277): Very noisy doc builds after jupyterlite-sphinx integration +* [#20296](https://github.com/scipy/scipy/issues/20296): CI: jupyterlite-shpinx pin breaks recent doc builds +* [#20324](https://github.com/scipy/scipy/issues/20324): MAINT, BUG (?): pearsonr statistic return type change +* [#20357](https://github.com/scipy/scipy/issues/20357): BUG: Memory usage in griddata function in version 1.12 +* [#20358](https://github.com/scipy/scipy/issues/20358): TST, MAINT: failure in TestGroupDelay::test\_singular against… +* [#20377](https://github.com/scipy/scipy/issues/20377): ENH: sparse: Update str dunder to handle 1D (and 2D better) +* [#20378](https://github.com/scipy/scipy/issues/20378): ENH: sparse: Update repr dunder to handle 1D (and maybe 2D better) +* [#20385](https://github.com/scipy/scipy/issues/20385): MAINT: special version hex cleanup +* [#20386](https://github.com/scipy/scipy/issues/20386): BUG: scipy.stats.kstest returns NaN starting in scipy 1.12 +* [#20388](https://github.com/scipy/scipy/issues/20388): DOC: Version switcher is not vertically centred on mobile +* [#20394](https://github.com/scipy/scipy/issues/20394): BUG: unnecessary computations in iirpeak/iirnotch/iircomb filter… +* [#20399](https://github.com/scipy/scipy/issues/20399): BUG: scipy.special.logsumexp raises ValueError for a zero-size… +* [#20419](https://github.com/scipy/scipy/issues/20419): BUG: nightly: .special.jv now promotes float32 inputs to float64 +* [#20434](https://github.com/scipy/scipy/issues/20434): BUG: sparse dia\_array changes to csr after multiplication +* [#20455](https://github.com/scipy/scipy/issues/20455): BUG: signal.iirfilter: overflow for integer input +* [#20458](https://github.com/scipy/scipy/issues/20458): MAINT: more potential cleanups related to version bumps +* [#20461](https://github.com/scipy/scipy/issues/20461): DOC: some likely changes to release process docs +* [#20466](https://github.com/scipy/scipy/issues/20466): BUG: scipy.linalg.bandwidth returns incorrect upper bandwidth +* [#20470](https://github.com/scipy/scipy/issues/20470): BUG: `TestNNLS.test\_nnls\_inner\_loop\_case1` fails with MKL +* [#20486](https://github.com/scipy/scipy/issues/20486): DEP: deprecate and remove remaining usages of slur-adjacent “trapz” +* [#20488](https://github.com/scipy/scipy/issues/20488): BUG: When given invalid bounds, `\_minimize\_neldermead` raises… +* [#20492](https://github.com/scipy/scipy/issues/20492): DOC: linalg.solve\_discrete\_lyapunov: dead reference link +* [#20502](https://github.com/scipy/scipy/issues/20502): BUG: special.hyp2f1: local test failure +* [#20509](https://github.com/scipy/scipy/issues/20509): DOC: Clarify behavior of `sparse.csgraph.dijkstra` for `directed=False` +* [#20523](https://github.com/scipy/scipy/issues/20523): CI/BLD: Nightly wheel builds failing for macOS x86\_64 +* [#20535](https://github.com/scipy/scipy/issues/20535): BUG: generate\_f2py mod is called by the wrong interpreter +* [#20540](https://github.com/scipy/scipy/issues/20540): BUG: pytest scipy/linalg/tests/test\_extending.py fails with Cython… +* [#20551](https://github.com/scipy/scipy/issues/20551): DOC/DEV: clearly document which code has an active upstream repo +* [#20562](https://github.com/scipy/scipy/issues/20562): BUG: Invalid default bracket selection in \_bracket\_minimum. +* [#20564](https://github.com/scipy/scipy/issues/20564): TST: stats array API failure for test\_skew\_constant\_value[torch]… +* [#20584](https://github.com/scipy/scipy/issues/20584): BUG: `optimize.linprog` fails with `list` type `integrality`… +* [#20587](https://github.com/scipy/scipy/issues/20587): BLD: warning from `scipy/special/special/gamma.h` +* [#20598](https://github.com/scipy/scipy/issues/20598): ENH: special: add log of wright\_bessel +* [#20603](https://github.com/scipy/scipy/issues/20603): DOC: document switch from mailing list to discourse +* [#20614](https://github.com/scipy/scipy/issues/20614): DOC: dual\_annealing optimizer does not pass bounds to minimizer… +* [#20618](https://github.com/scipy/scipy/issues/20618): BUG: scipy ‘minimize’ with method=’trust-constr’ with equality… +* [#20620](https://github.com/scipy/scipy/issues/20620): DOC: Suggested improvement to interp2d transition guide +* [#20641](https://github.com/scipy/scipy/issues/20641): BUG: stats: Two new XSLOW test failures +* [#20661](https://github.com/scipy/scipy/issues/20661): MAINT, TST: failure in test\_axis\_nan\_policy\_decorated\_positional\_args… +* [#20662](https://github.com/scipy/scipy/issues/20662): DOC: Missing blankspace in error message raised by cont2discrete() +* [#20674](https://github.com/scipy/scipy/issues/20674): DOC: A typo in authors name in signal.ellipap reference +* [#20683](https://github.com/scipy/scipy/issues/20683): DOC: A typo in ValueError raised by signal.iirdesign +* [#20691](https://github.com/scipy/scipy/issues/20691): ENH: Reintroduce Apple Accelerate support +* [#20697](https://github.com/scipy/scipy/issues/20697): BUG: special: algorithmic Error in `ratevl` in `cephes/polevl.h` +* [#20755](https://github.com/scipy/scipy/issues/20755): BUG: stats: Two new test failures +* [#20768](https://github.com/scipy/scipy/issues/20768): BUG: optimize.minimize: garbage collection in `lbfgs` +* [#20783](https://github.com/scipy/scipy/issues/20783): BUG: Build failure on PyPy3.10 7.3.16: `error: ‘Py\_Initialize’… +* [#20797](https://github.com/scipy/scipy/issues/20797): BUG: special.hyp1f1: broken for complex argument +* [#20802](https://github.com/scipy/scipy/issues/20802): MAINT, TST: pytest-fail-slow and local concurrent runs/variability +* [#20840](https://github.com/scipy/scipy/issues/20840): BUG: first shared library in scipy fails to be consumed by MSVC +* [#20850](https://github.com/scipy/scipy/issues/20850): DOC: stats.bootstrap: improve documentation multidimensional… +* [#20852](https://github.com/scipy/scipy/issues/20852): BUG: Library not loaded: @rpath/libgfortran.5.dylib for scipy… +* [#20860](https://github.com/scipy/scipy/issues/20860): BUG/BLD: scipy-1.13.1 fails to build with msvc +* [#20901](https://github.com/scipy/scipy/issues/20901): BUG: `zsh: abort python` after `scipy.linalg.sqrtm` on empty… +* [#20911](https://github.com/scipy/scipy/issues/20911): TST: TestEig.test\_singular failing tolerance with generic BLAS… +* [#20921](https://github.com/scipy/scipy/issues/20921): DOC: stats: wrong docstrings of `\*Result` classes +* [#20938](https://github.com/scipy/scipy/issues/20938): TST: tolerance violations with SciPy 1.14.0rc1 on linux-{aarch64,ppc64le} +* [#20943](https://github.com/scipy/scipy/issues/20943): TST: test failures on windows with SciPy 1.14.0rc1 + +## [Pull requests for 1.14.0](#id21)[#](#pull-requests-for-1-14-0 "Link to this heading") + +* [#13534](https://github.com/scipy/scipy/pull/13534): ENH: Add more initialization methods for HessianUpdateStrategy +* [#15321](https://github.com/scipy/scipy/pull/15321): ENH: fft: Add `prev\_fast\_len` to complement `next\_fast\_len` +* [#17348](https://github.com/scipy/scipy/pull/17348): BUG: integrate: make `select\_initial\_step` aware of integration… +* [#17924](https://github.com/scipy/scipy/pull/17924): ENH: sparse.linalg: speed up `spsolve\_triangular` +* [#18926](https://github.com/scipy/scipy/pull/18926): ENH: Move symiirorder1/2, cspline2d, qspline2d and spline\_filter… +* [#19561](https://github.com/scipy/scipy/pull/19561): ENH: stats.power: add function to simulate hypothesis test power +* [#19627](https://github.com/scipy/scipy/pull/19627): FIX: correctly compute group\_delay for complex-coefficient TFs +* [#19673](https://github.com/scipy/scipy/pull/19673): DEP: signal: raise error using medfilt and order\_filter with… +* [#19706](https://github.com/scipy/scipy/pull/19706): ENH: Add half=True kwarg to minimum\_phase +* [#19816](https://github.com/scipy/scipy/pull/19816): BLD: Add Accelerate support for macOS 13.3+ +* [#19900](https://github.com/scipy/scipy/pull/19900): MAINT/TST: fft: remove xp backend skips, test `fftfreq` `device` +* [#19904](https://github.com/scipy/scipy/pull/19904): MAINT: remove incidental imports from private modules +* [#19923](https://github.com/scipy/scipy/pull/19923): ENH: stats.mannwhitneyu: replace exact p-value calculation +* [#19954](https://github.com/scipy/scipy/pull/19954): MAINT: Translate wright\_bessel function to C++ +* [#19960](https://github.com/scipy/scipy/pull/19960): DOC: Add examples to `scipy.interpolate.spalde` +* [#19994](https://github.com/scipy/scipy/pull/19994): ENH: add cobyqa to scipy.optimize. +* [#20073](https://github.com/scipy/scipy/pull/20073): ENH: special: fix premature overflow in `boxcox` +* [#20079](https://github.com/scipy/scipy/pull/20079): ENH: io: Read and write wav files of size > 4GB +* [#20085](https://github.com/scipy/scipy/pull/20085): ENH: array types: add JAX support +* [#20089](https://github.com/scipy/scipy/pull/20089): ENH: Translate complex valued hyp2f1 to C++ and make improvements +* [#20127](https://github.com/scipy/scipy/pull/20127): ENH/TST: Refactor refguide-check, take 3 +* [#20137](https://github.com/scipy/scipy/pull/20137): ENH: stats.pearsonr: add support for `axis` argument +* [#20187](https://github.com/scipy/scipy/pull/20187): ENH: sparse.csgraph: Yen K-shortest paths +* [#20199](https://github.com/scipy/scipy/pull/20199): DOC/DEV/MAINT: update core-dev guide +* [#20202](https://github.com/scipy/scipy/pull/20202): DOC: Reorganize contents of stats User Guide section +* [#20255](https://github.com/scipy/scipy/pull/20255): TST: linalg: reenable gges[float32] tests +* [#20257](https://github.com/scipy/scipy/pull/20257): BUG: prevent file descriptor leak in `openblas\_support.py`… +* [#20260](https://github.com/scipy/scipy/pull/20260): ENH: Begin overhaul of ufunc machinery +* [#20265](https://github.com/scipy/scipy/pull/20265): ENH: optimize: const qualify Cython array arguments +* [#20269](https://github.com/scipy/scipy/pull/20269): REL: set version to 1.14.0dev0 +* [#20273](https://github.com/scipy/scipy/pull/20273): MAINT/DEV: enforce minimum `ruff` version +* [#20275](https://github.com/scipy/scipy/pull/20275): MAINT/DEV: add auto-fix to `dev.py lint` +* [#20278](https://github.com/scipy/scipy/pull/20278): DEP: integrate: remove simps,trapz,cumtrapz +* [#20281](https://github.com/scipy/scipy/pull/20281): BUG: optimize: correct `nfev` values +* [#20283](https://github.com/scipy/scipy/pull/20283): DEP: sparse: deprecate conjtransp() method for dok\_array/matrix… +* [#20284](https://github.com/scipy/scipy/pull/20284): ENH: stats.pearsonr: add array API support +* [#20289](https://github.com/scipy/scipy/pull/20289): DOC: Pin Jupyterlite Sphinx to avoid noisy doc builds +* [#20292](https://github.com/scipy/scipy/pull/20292): ENH: stats.moment: add array API support +* [#20295](https://github.com/scipy/scipy/pull/20295): BUG: linalg: support empty arrays +* [#20297](https://github.com/scipy/scipy/pull/20297): BUG: linalg: use SYEV not SYEVR for pinvh +* [#20298](https://github.com/scipy/scipy/pull/20298): DOC: linalg: mention that eigenvalues\_only=True/False may change… +* [#20304](https://github.com/scipy/scipy/pull/20304): ENH: interpolate: allow Akima extrapolation +* [#20310](https://github.com/scipy/scipy/pull/20310): MAINT: Pin jupyterlite-sphinx to >=0.13.1 +* [#20315](https://github.com/scipy/scipy/pull/20315): DOC: add docs on how to debug linear algebra related issues +* [#20317](https://github.com/scipy/scipy/pull/20317): MAINT/DEV: rename `skip\_if\_array\_api` to `skip\_xp\_backends` +* [#20320](https://github.com/scipy/scipy/pull/20320): ENH: Generalised ufuncs in special +* [#20321](https://github.com/scipy/scipy/pull/20321): BUG: Fix for scipy.special seterr, geterr, errstate +* [#20325](https://github.com/scipy/scipy/pull/20325): MAINT: Improve performance of ndimage.binary\_erosion +* [#20326](https://github.com/scipy/scipy/pull/20326): MAINT: Replace usage of np.prod +* [#20328](https://github.com/scipy/scipy/pull/20328): DOC: fix small typo in odds\_ratio +* [#20329](https://github.com/scipy/scipy/pull/20329): MAINT: update `array\_api\_compat` to v1.5.1 +* [#20331](https://github.com/scipy/scipy/pull/20331): MAINT: Fix Cythonize bug in optimize with const view +* [#20335](https://github.com/scipy/scipy/pull/20335): TST: linalg: undo xfails of QZ and DARE +* [#20342](https://github.com/scipy/scipy/pull/20342): BLD: linalg: fix rebuild dependencies for .pyf.src files +* [#20354](https://github.com/scipy/scipy/pull/20354): MAINT: unpin pytest for wheels +* [#20355](https://github.com/scipy/scipy/pull/20355): TST: signal: bump tolerance for new `signal.group\_delay` test +* [#20356](https://github.com/scipy/scipy/pull/20356): BLD: update numpy build dependency in pyproject.toml for numpy… +* [#20367](https://github.com/scipy/scipy/pull/20367): STY: always `import numpy as np` +* [#20373](https://github.com/scipy/scipy/pull/20373): MAINT: drop Python 3.9 and NumPy 1.22.x +* [#20380](https://github.com/scipy/scipy/pull/20380): MAINT: forward port 1.13.0 relnotes +* [#20382](https://github.com/scipy/scipy/pull/20382): MAINT: lint: enforce `numpy as np` alias +* [#20384](https://github.com/scipy/scipy/pull/20384): ENH:special:Re-rewrite cdflib in C +* [#20390](https://github.com/scipy/scipy/pull/20390): MAINT:Translate the entirety of cephes into C++ +* [#20393](https://github.com/scipy/scipy/pull/20393): MAINT/BLD: Remove `stats.\_boost` and add the distribution related… +* [#20397](https://github.com/scipy/scipy/pull/20397): ENH: Support scalar-first order of quaternion components in Rotation +* [#20403](https://github.com/scipy/scipy/pull/20403): ENH: special: add ufuncs for amos +* [#20404](https://github.com/scipy/scipy/pull/20404): BUG: interpolate: fix high memory usage for 2 classes +* [#20405](https://github.com/scipy/scipy/pull/20405): BUG: Fix pair of bugs in Amos and Cephes yv which masked each… +* [#20413](https://github.com/scipy/scipy/pull/20413): MAINT: Vendor npyrandom instead of using static library +* [#20416](https://github.com/scipy/scipy/pull/20416): ENH: optimize.\_chandrupatla: allow infinite function value at… +* [#20417](https://github.com/scipy/scipy/pull/20417): ENH: Make cython\_special actual code, not autogenerated +* [#20418](https://github.com/scipy/scipy/pull/20418): BUG: signal: corrections to `iir{peak,notch,comb}` filter gain +* [#20420](https://github.com/scipy/scipy/pull/20420): DOC: stats: speed up the very slow `bootstrap` examples +* [#20421](https://github.com/scipy/scipy/pull/20421): Added float32 overloads for amos functions +* [#20422](https://github.com/scipy/scipy/pull/20422): TST: Test cimporting Cython APIs +* [#20424](https://github.com/scipy/scipy/pull/20424): MAINT:special: Add license to cdflib and remove old pxd file +* [#20425](https://github.com/scipy/scipy/pull/20425): MAINT: Fix DOI visibility badge in README +* [#20426](https://github.com/scipy/scipy/pull/20426): DOC: add hints on how to debug linalg issues with gdb +* [#20427](https://github.com/scipy/scipy/pull/20427): DOC: speed up some examples +* [#20438](https://github.com/scipy/scipy/pull/20438): ENH: Translate `sph\_harm` Cython->C++, add `sph\_harm\_all`… +* [#20441](https://github.com/scipy/scipy/pull/20441): BLD: Install cython\_special.pxd +* [#20443](https://github.com/scipy/scipy/pull/20443): MAINT: sparse: Update EfficiencyWarning message to reflect array/matrix +* [#20445](https://github.com/scipy/scipy/pull/20445): ENH: sparse: special-case DIA \* scalar +* [#20446](https://github.com/scipy/scipy/pull/20446): MAINT: remove repetitive word typos +* [#20450](https://github.com/scipy/scipy/pull/20450): BLD: avoid setting an environment variable in a meson.build file +* [#20453](https://github.com/scipy/scipy/pull/20453): DOC: special: add examples for pdtrc, pdtri, pdtrik +* [#20454](https://github.com/scipy/scipy/pull/20454): DOC: Update toolchain roadmap (1/N) +* [#20456](https://github.com/scipy/scipy/pull/20456): BUG: signal.iirfilter: avoid integer overflow +* [#20457](https://github.com/scipy/scipy/pull/20457): ENH: Add `scipy.special.\_ufuncs.\_iv\_ratio` +* [#20460](https://github.com/scipy/scipy/pull/20460): DOC: Remove extra css colors and settings +* [#20462](https://github.com/scipy/scipy/pull/20462): DOC: update readme with link to new forum +* [#20463](https://github.com/scipy/scipy/pull/20463): MAINT: Refactor special function ufunc generation and consolidate… +* [#20465](https://github.com/scipy/scipy/pull/20465): MAINT: special: fix compiler warning for unused variable +* [#20467](https://github.com/scipy/scipy/pull/20467): MAINT: stats.\_contains\_nan: fix bug when -inf and inf are in… +* [#20468](https://github.com/scipy/scipy/pull/20468): TST: stats: mark tests slow/xslow +* [#20469](https://github.com/scipy/scipy/pull/20469): MAINT/CI: Remove doctesting from refguide-check +* [#20477](https://github.com/scipy/scipy/pull/20477): BLD: ensure all static libraries use hidden visibility +* [#20478](https://github.com/scipy/scipy/pull/20478): CI/MAINT: Increase minimum required compiler versions to GCC… +* [#20480](https://github.com/scipy/scipy/pull/20480): CI: fail slow tests +* [#20481](https://github.com/scipy/scipy/pull/20481): ENH: stats: Add the Irwin-Hall distribution +* [#20482](https://github.com/scipy/scipy/pull/20482): CI: standardize job names +* [#20483](https://github.com/scipy/scipy/pull/20483): ENH: special: translate `sph\_bessel` to C++, refactor `cyl\_bessel` +* [#20487](https://github.com/scipy/scipy/pull/20487): TST: adjust other very slow tests +* [#20490](https://github.com/scipy/scipy/pull/20490): BUG: sparse: raise error for array classes, document/test old… +* [#20494](https://github.com/scipy/scipy/pull/20494): BUG: \_qmc.py::\_random\_oa\_lhs produces correlated samples +* [#20495](https://github.com/scipy/scipy/pull/20495): BUG: Remove keyword argument from ValueError in SciPy.optimize +* [#20497](https://github.com/scipy/scipy/pull/20497): DEP: interpolate: replace interp2d by stub +* [#20498](https://github.com/scipy/scipy/pull/20498): DEP: switch sparse methods to kwarg-only; remove tol/restrt kwargs +* [#20499](https://github.com/scipy/scipy/pull/20499): DEP: execute sparse array API deprecations +* [#20500](https://github.com/scipy/scipy/pull/20500): DOC: Update dead reference link in `Scipy.linalg.\_solvers.py`:… +* [#20501](https://github.com/scipy/scipy/pull/20501): MAINT: optimize.\_chandrupatla: reduce xatol +* [#20503](https://github.com/scipy/scipy/pull/20503): MAINT: spatial: Fix type annotation of `query\_ball\_point` +* [#20508](https://github.com/scipy/scipy/pull/20508): DOC: Fix legacy admonition styling +* [#20510](https://github.com/scipy/scipy/pull/20510): BLD: Accelerate wheels for macOS 14+ +* [#20511](https://github.com/scipy/scipy/pull/20511): BUG: Fix raising ValueError on a zero-size array for SciPy.special.logsumexp +* [#20515](https://github.com/scipy/scipy/pull/20515): BLD: default to C17 rather than C99 +* [#20522](https://github.com/scipy/scipy/pull/20522): TST: Skip or fix some failing tests on certain macOS builds +* [#20526](https://github.com/scipy/scipy/pull/20526): BLD: adjust lower bound on Clang/LLVM from 14.0 to 12.0 +* [#20529](https://github.com/scipy/scipy/pull/20529): MAINT: remove repeated “is” typos +* [#20534](https://github.com/scipy/scipy/pull/20534): BUG: Fixes incorrect upper\_band value for scipy.linalg.bandwidth +* [#20536](https://github.com/scipy/scipy/pull/20536): CI: Check whether Python.h is included first in a file +* [#20538](https://github.com/scipy/scipy/pull/20538): TST: \_lib: remove redundant test for missing `stacklevel` +* [#20541](https://github.com/scipy/scipy/pull/20541): ENH: stats.skew: add array-API support +* [#20542](https://github.com/scipy/scipy/pull/20542): BLD: Accelerate builds should not define `NO\_APPEND\_FORTRAN` +* [#20545](https://github.com/scipy/scipy/pull/20545): ENH: stats.ttest\_1samp: add array-API support +* [#20546](https://github.com/scipy/scipy/pull/20546): DOC: use more correct and inclusive pronouns +* [#20547](https://github.com/scipy/scipy/pull/20547): DOC: stats.linregress: split stats/mstats documentation +* [#20548](https://github.com/scipy/scipy/pull/20548): TST: Skip Cython tests for editable installs +* [#20550](https://github.com/scipy/scipy/pull/20550): DEP: stats: switch kendalltau to kwarg-only, remove initial\_lexsort… +* [#20554](https://github.com/scipy/scipy/pull/20554): DEP: integrate: switch simpson to kwarg-only, remove even kwarg +* [#20556](https://github.com/scipy/scipy/pull/20556): DOC: release process updates +* [#20559](https://github.com/scipy/scipy/pull/20559): DOC/DEV: add core-dev page on vendored code +* [#20560](https://github.com/scipy/scipy/pull/20560): DEP: linalg: remove turbo / eigvals kwargs from linalg.{eigh,eigvalsh}… +* [#20563](https://github.com/scipy/scipy/pull/20563): BUG: Fix invalid default bracket selection in \_bracket\_minimum +* [#20565](https://github.com/scipy/scipy/pull/20565): DEP: linalg: remove cond / rcond kwargs from linalg.pinv and… +* [#20568](https://github.com/scipy/scipy/pull/20568): DOC: change approx\_fprime doctest +* [#20572](https://github.com/scipy/scipy/pull/20572): MAINT: vendor Tempita in `scipy/\_build\_utils` +* [#20575](https://github.com/scipy/scipy/pull/20575): TST: stats.skew: assert\_equal -> xp\_assert\_equal as appropriate +* [#20577](https://github.com/scipy/scipy/pull/20577): DEV: add unicode check to pre-commit-hook +* [#20578](https://github.com/scipy/scipy/pull/20578): DEP: signal: remove nyq / Hz kwargs in firwin\* and switch to… +* [#20582](https://github.com/scipy/scipy/pull/20582): MAINT: optimize.isotonic\_regression: remove unnecessary copies +* [#20583](https://github.com/scipy/scipy/pull/20583): TST: stats.rv\_continuous.fit: adjust fit XSLOW/XFAIL/skip sets +* [#20585](https://github.com/scipy/scipy/pull/20585): CI/BLD: use scipy-openblas wheel when building +* [#20588](https://github.com/scipy/scipy/pull/20588): DEP: special: remove legacy kwarg from special.comb and switch… +* [#20590](https://github.com/scipy/scipy/pull/20590): Revert “ENH: Use `highspy` in `linprog`” +* [#20593](https://github.com/scipy/scipy/pull/20593): ENH: constants: add array api support +* [#20595](https://github.com/scipy/scipy/pull/20595): ENH: `stats.circ\_\_\_`: add array-API support +* [#20597](https://github.com/scipy/scipy/pull/20597): ENH: stats.skewtest: add array-API support +* [#20600](https://github.com/scipy/scipy/pull/20600): TYP: update supported Mypy version from 1.0.0 to 1.10.0 +* [#20604](https://github.com/scipy/scipy/pull/20604): ENH: stats.monte\_carlo\_test: add array API support +* [#20612](https://github.com/scipy/scipy/pull/20612): BLD: fix use of non-default interpreter, improve f2py handling +* [#20615](https://github.com/scipy/scipy/pull/20615): ENH: stats: Implement \_isf for burr12 +* [#20616](https://github.com/scipy/scipy/pull/20616): DOC: integrate: remove references to deprecated and legacy functions +* [#20619](https://github.com/scipy/scipy/pull/20619): ENH: spatial: serialize concurrent calls to QHull +* [#20621](https://github.com/scipy/scipy/pull/20621): TYP: add type annotations to `scipy/\_lib/\_array\_api.py` +* [#20625](https://github.com/scipy/scipy/pull/20625): TST: add dtype dependent default rtol to xp\_assert\_close +* [#20627](https://github.com/scipy/scipy/pull/20627): MAINT: special: Drop unused function\_calls variable in kolmogorov.h +* [#20628](https://github.com/scipy/scipy/pull/20628): TST: integrate.tanhsinh: make test case XSLOW +* [#20630](https://github.com/scipy/scipy/pull/20630): ENH: optimize.\_jacobian: use \_differentiate to compute accurate… +* [#20631](https://github.com/scipy/scipy/pull/20631): ENH: stats.sem: add array-API support +* [#20634](https://github.com/scipy/scipy/pull/20634): ENH: stats: add array-API support to kstat/kstatvar +* [#20637](https://github.com/scipy/scipy/pull/20637): MAINT: Fix broken links in `datasets.\_fetchers` module +* [#20640](https://github.com/scipy/scipy/pull/20640): TST: adjust new array API test, slow tests +* [#20642](https://github.com/scipy/scipy/pull/20642): TST: stats.ttest\_1samp: fix xslow test +* [#20643](https://github.com/scipy/scipy/pull/20643): MAINT:update boost to fix `skewnorm.ppf` +* [#20645](https://github.com/scipy/scipy/pull/20645): ENH: optimize.approx\_fprime: avoid quadratic memory usage +* [#20646](https://github.com/scipy/scipy/pull/20646): ENH: special: add `log\_wright\_bessel` +* [#20647](https://github.com/scipy/scipy/pull/20647): ENH: stats.variation: add array-API support +* [#20649](https://github.com/scipy/scipy/pull/20649): MAINT: sparse: reformat str and repr for sparse arrays, correct… +* [#20651](https://github.com/scipy/scipy/pull/20651): ENH: stats.kstat/kstatvar: add native support for `axis` +* [#20656](https://github.com/scipy/scipy/pull/20656): ENH: Micro-optimizations for spatial.transform.Rotation methods +* [#20657](https://github.com/scipy/scipy/pull/20657): MAINT: remove unused variable in special +* [#20658](https://github.com/scipy/scipy/pull/20658): ENH: stats.kurtosis: add array API support +* [#20663](https://github.com/scipy/scipy/pull/20663): MAINT: stats.kruskal: fix no-arg behavior w/ SCIPY\_ARRAY\_API=1 +* [#20664](https://github.com/scipy/scipy/pull/20664): Fix typo in cont2discrete +* [#20665](https://github.com/scipy/scipy/pull/20665): trust-constr make origin of error message clearer when there… +* [#20667](https://github.com/scipy/scipy/pull/20667): ENH: stats.describe: add array API support +* [#20673](https://github.com/scipy/scipy/pull/20673): ENH: stats.entropy, special.{entr, rel\_entr}: add array API support +* [#20675](https://github.com/scipy/scipy/pull/20675): DOC: Fixed typo in signal.ellipap +* [#20676](https://github.com/scipy/scipy/pull/20676): MAINT: clarify dual\_annealing-minimizer\_kwargs docstring. Closes… +* [#20677](https://github.com/scipy/scipy/pull/20677): TST: test\_\_differential\_evolution tweaks for speed +* [#20679](https://github.com/scipy/scipy/pull/20679): MAINT: special.wright\_bessel: add comment about reference text +* [#20684](https://github.com/scipy/scipy/pull/20684): MAINT: Fix missing whitespace in signal.iirdesign, spacing consistency… +* [#20685](https://github.com/scipy/scipy/pull/20685): MAINT: Add graceful handling of invalid initial brackets to elementwise… +* [#20689](https://github.com/scipy/scipy/pull/20689): ENH: optimize.\_chandrupatla: add array API support +* [#20694](https://github.com/scipy/scipy/pull/20694): MAINT: stats: make reducing functions emit consistent warning… +* [#20696](https://github.com/scipy/scipy/pull/20696): MAINT: stats.gstd: return result rather than raising +* [#20698](https://github.com/scipy/scipy/pull/20698): DEV/BLD: add –with-accelerate flag to `dev.py build` +* [#20705](https://github.com/scipy/scipy/pull/20705): MAINT: Add missing whitespace +* [#20711](https://github.com/scipy/scipy/pull/20711): MAINT: numpy cleanup version bumps: fixes issue #20458 +* [#20712](https://github.com/scipy/scipy/pull/20712): ENH/BLD: Add install tags for `tests` +* [#20715](https://github.com/scipy/scipy/pull/20715): ENH: stats.kurtosistest: add array API support +* [#20716](https://github.com/scipy/scipy/pull/20716): DEP: integrate.quad\_vec: deprecate `quadrature=”trapz”` +* [#20722](https://github.com/scipy/scipy/pull/20722): ENH: sparse: Speed up `\_add\_sparse` for DIA format +* [#20726](https://github.com/scipy/scipy/pull/20726): DOC: stats.{circmean, circvar, circstd}: improve accuracy/clarity +* [#20730](https://github.com/scipy/scipy/pull/20730): BUG: special: fix algorithmic error in `ratevl` in `cephes/polevl.h` +* [#20732](https://github.com/scipy/scipy/pull/20732): BUG: interpolate: do not segfault on bad boundary conditions +* [#20734](https://github.com/scipy/scipy/pull/20734): BUG: stats.ttest\_1samp: fix use of `keepdims` +* [#20736](https://github.com/scipy/scipy/pull/20736): ENH: stats.normaltest/jarque\_bera: add array-API support +* [#20737](https://github.com/scipy/scipy/pull/20737): TST, MAINT: run optimize array API tests and fix `chandrupatla` +* [#20738](https://github.com/scipy/scipy/pull/20738): DOC: sparse.csgraph.dijkstra: add warning for `directed=False`… +* [#20741](https://github.com/scipy/scipy/pull/20741): MAINT: optimize: another fail\_slow exception for COBYQA +* [#20744](https://github.com/scipy/scipy/pull/20744): MAINT: use PyTorch 2.3 in CI, fix CuPy failures, more type annotations… +* [#20745](https://github.com/scipy/scipy/pull/20745): BUG: Fix incorrect brackets in cephes hyperg.h +* [#20746](https://github.com/scipy/scipy/pull/20746): DOC: stats: update formulas given for kstat/kstatvar to reflect… +* [#20748](https://github.com/scipy/scipy/pull/20748): TST: bump tolerance to address local `test\_axis\_nan\_policy`… +* [#20750](https://github.com/scipy/scipy/pull/20750): ENH: some micro-optimisations for differential\_evolution +* [#20751](https://github.com/scipy/scipy/pull/20751): ENH: stats.bartlett: add native `axis` and array API support +* [#20753](https://github.com/scipy/scipy/pull/20753): ENH: stats.chisquare/power\_divergence: add array API support +* [#20756](https://github.com/scipy/scipy/pull/20756): TST: stats: refactor tests of normality tests +* [#20764](https://github.com/scipy/scipy/pull/20764): TST: stats.fit: address xslow test failures +* [#20765](https://github.com/scipy/scipy/pull/20765): MAINT: stats.wilcoxon: make `method=’exact’` symmetric w/ ties +* [#20769](https://github.com/scipy/scipy/pull/20769): MAINT: stats: move `multiscale\_graphcorr` tests to save time +* [#20770](https://github.com/scipy/scipy/pull/20770): MAINT: optimize: remove circular reference in `ScalarFunction` +* [#20775](https://github.com/scipy/scipy/pull/20775): MAINT: forward port 1.13.1 relnotes +* [#20777](https://github.com/scipy/scipy/pull/20777): ENH: stats: end-to-end array-API support for normality tests +* [#20778](https://github.com/scipy/scipy/pull/20778): DOC: signal: Documentation improvements of `detrend` function +* [#20780](https://github.com/scipy/scipy/pull/20780): DEP: special.comb: deprecate `exact=True` for non-integer intputs +* [#20781](https://github.com/scipy/scipy/pull/20781): TST: stats: remove overhead of array\_namespace in calls to \_get\_pvalue +* [#20782](https://github.com/scipy/scipy/pull/20782): ENH: stats: end-to-end array-API support for NHSTs with chi-squared… +* [#20784](https://github.com/scipy/scipy/pull/20784): DOC: SciPy 1.14.0 relnotes +* [#20787](https://github.com/scipy/scipy/pull/20787): DOC: interpolate: mention default kinds in interp2d transition… +* [#20788](https://github.com/scipy/scipy/pull/20788): ENH: optimize: improve `cobyqa` performance by reducing overhead… +* [#20789](https://github.com/scipy/scipy/pull/20789): DEP: stats.linregress: deprecate one-arg use +* [#20790](https://github.com/scipy/scipy/pull/20790): BUG: special: remove redundant `Py\_Initialize` +* [#20791](https://github.com/scipy/scipy/pull/20791): TST: optimize: fix failing tests for `\_bracket\_minimum` +* [#20792](https://github.com/scipy/scipy/pull/20792): BUG: sparse: Fix argmin/max shape diff between axis 0/1. And… +* [#20795](https://github.com/scipy/scipy/pull/20795): MAINT: fix warnings about `noexcept` and `except \*` in Cython… +* [#20796](https://github.com/scipy/scipy/pull/20796): BLD: optimize: silence build warnings coming from HiGHS +* [#20798](https://github.com/scipy/scipy/pull/20798): MAINT: special: fix numpy initialization, avoid build warnings +* [#20799](https://github.com/scipy/scipy/pull/20799): DOC: ndimage: improve grayscale morphology docstrings +* [#20804](https://github.com/scipy/scipy/pull/20804): MAINT: remove pytest-fail-slow from pyproject.toml +* [#20805](https://github.com/scipy/scipy/pull/20805): BUG: special: Restore missing line of code in the function cchg(). +* [#20807](https://github.com/scipy/scipy/pull/20807): TST: stats.nbinom: adjust cdf-ppf roundtrip test +* [#20812](https://github.com/scipy/scipy/pull/20812): DOC: extend “building reproducible binaries” page +* [#20815](https://github.com/scipy/scipy/pull/20815): DOC: integrate: odeint user functions must not modify y. +* [#20819](https://github.com/scipy/scipy/pull/20819): REV: revert accidental `cobyqa` update in gh-17924 +* [#20820](https://github.com/scipy/scipy/pull/20820): BLD: Warning fix from ``scipy/special/special/gamma.h`` +* [#20828](https://github.com/scipy/scipy/pull/20828): DEP: deprecate trapz alias of `stats.trapezoid` distribution +* [#20831](https://github.com/scipy/scipy/pull/20831): MAINT: version pins/prep for 1.14.0rc1 +* [#20838](https://github.com/scipy/scipy/pull/20838): DOC: sparse: 1.14.0 release notes additions +* [#20839](https://github.com/scipy/scipy/pull/20839): REL: set 1.14.0rc2 unreleased +* [#20841](https://github.com/scipy/scipy/pull/20841): DOC: add cobyqa website reference +* [#20851](https://github.com/scipy/scipy/pull/20851): DOC: add cobyqa website reference (#20841) +* [#20858](https://github.com/scipy/scipy/pull/20858): MAINT: `stats.bootstrap`: emit `FutureWarning` about broadcasting +* [#20870](https://github.com/scipy/scipy/pull/20870): BLD: test delocate works by removing original lib [wheel build] +* [#20881](https://github.com/scipy/scipy/pull/20881): DOC: mailing list to forum +* [#20890](https://github.com/scipy/scipy/pull/20890): DOC: Write API reference titles in monospace font +* [#20909](https://github.com/scipy/scipy/pull/20909): DEP: special.perm: deprecate non-integer `N` and `k` with… +* [#20914](https://github.com/scipy/scipy/pull/20914): TST: linalg: bump tolerance in `TestEig::test\_singular` +* [#20919](https://github.com/scipy/scipy/pull/20919): BLD: optimize: use hidden visibility for static HiGHS libraries +* [#20920](https://github.com/scipy/scipy/pull/20920): MAINT: special: fix msvc build by using `new` and `delete`… +* [#20923](https://github.com/scipy/scipy/pull/20923): DOC: update doctests to satisfy scipy-doctests==1.2.0 +* [#20927](https://github.com/scipy/scipy/pull/20927): MAINT: adapt to a scipy-doctests change +* [#20933](https://github.com/scipy/scipy/pull/20933): MAINT: 1.14.0rc2 backports +* [#20936](https://github.com/scipy/scipy/pull/20936): DOC: `array\_api.rst`: update 1.14 functions with array API… +* [#20937](https://github.com/scipy/scipy/pull/20937): BUG/BLD: special: Ensure symbols in `sf\_error\_state` shared… +* [#20945](https://github.com/scipy/scipy/pull/20945): TST: address tolerance violations with SciPy 1.14.0rc1 on linux-{aarch64,ppc64le} +* [#20952](https://github.com/scipy/scipy/pull/20952): TST: loosen tolerance in test\_x0\_working to pass with alternate… +* [#20953](https://github.com/scipy/scipy/pull/20953): TST: loosen tolerance in test\_krandinit slightly to pass with… +* [#20961](https://github.com/scipy/scipy/pull/20961): TST: robustify test\_nnls\_inner\_loop\_case1 +* [#20970](https://github.com/scipy/scipy/pull/20970): REL: set 1.14.0 rc3 unreleased +* [#20973](https://github.com/scipy/scipy/pull/20973): TST:sparse.linalg: Skip test due to sensitivity to numerical… +* [#20979](https://github.com/scipy/scipy/pull/20979): STY: `\_lib.\_util`: address new mypy complaint in main diff --git a/corpus/changelog/scipy_releases/scipy_1141.md b/corpus/changelog/scipy_releases/scipy_1141.md new file mode 100644 index 0000000000000000000000000000000000000000..13eeedff8bc8924bf5ba9042f76ee32c5b767a14 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1141.md @@ -0,0 +1,91 @@ +# SciPy 1.14.1 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.14.1-notes.html +Version: 1.14.1 + +Contents + +* [SciPy 1.14.1 Release Notes](#scipy-1-14-1-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.14.1](#issues-closed-for-1-14-1) + - [Pull requests for 1.14.1](#pull-requests-for-1-14-1) + +SciPy 1.14.1 adds support for Python 3.13, including binary +wheels on PyPI. Apart from that, it is a bug-fix release with +no new features compared to 1.14.0. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Name (commits) +* h-vetinari (1) +* Evgeni Burovski (1) +* CJ Carey (2) +* Lucas Colley (3) +* Ralf Gommers (3) +* Melissa Weber Mendonça (1) +* Andrew Nelson (3) +* Nick ODell (1) +* Tyler Reddy (36) +* Daniel Schmitz (1) +* Dan Schult (4) +* Albert Steppi (2) +* Ewout ter Hoeven (1) +* Tibor Völcker (2) + +* Adam Turner (1) + +* Warren Weckesser (2) +* ਗਗਨਦੀਪ ਸਿੰਘ (Gagandeep Singh) (1) + +A total of 17 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.14.1](#id3)[#](#issues-closed-for-1-14-1 "Link to this heading") + +* [#19572](https://github.com/scipy/scipy/issues/19572): BUG: doccer: `test\_decorator` fails with Python 3.13 due to… +* [#19911](https://github.com/scipy/scipy/issues/19911): BUG: open\_memstream unavailable with glibc >= 2.10 + C99 +* [#20992](https://github.com/scipy/scipy/issues/20992): ENH: 3.13 wheels +* [#20993](https://github.com/scipy/scipy/issues/20993): BUG: spsolve prints “dgstrf info” to stdout on singular matrices +* [#21058](https://github.com/scipy/scipy/issues/21058): BUG: `special.pro\_rad1`: incorrect results +* [#21064](https://github.com/scipy/scipy/issues/21064): BUG: sparse: `hstack/vstack` between a sparse and ndarray breaks… +* [#21073](https://github.com/scipy/scipy/issues/21073): MAINT: `cluster`/`stats`: array API test failures in main +* [#21079](https://github.com/scipy/scipy/issues/21079): BUG: unable to securely deploy app as scipy 1.14.0 requires write… +* [#21142](https://github.com/scipy/scipy/issues/21142): BUG: signal: crash in `signaltools` on free-threaded Python,… +* [#21195](https://github.com/scipy/scipy/issues/21195): CI: documentation build failing? +* [#21207](https://github.com/scipy/scipy/issues/21207): BUG: `fft.hfftn` fails on list inputs +* [#21234](https://github.com/scipy/scipy/issues/21234): BUG: Files in SuperLU under LGPL license +* [#21238](https://github.com/scipy/scipy/issues/21238): BUG: io/scipy.sparse.csgraph: refguide check failure in main +* [#21250](https://github.com/scipy/scipy/issues/21250): DOC: `sampling\_tdr.rst` failing in CircleCI smoke-tutorials… +* [#21272](https://github.com/scipy/scipy/issues/21272): BUG: dtype changed for argument to `rv\_discrete.\_pmf` +* [#21306](https://github.com/scipy/scipy/issues/21306): BUG: odr: pickling is not possible +* [#21323](https://github.com/scipy/scipy/issues/21323): DOC: build failing in CI +* [#21408](https://github.com/scipy/scipy/issues/21408): BLD, CI: Cirrus 3.13 wheels? + +### [Pull requests for 1.14.1](#id4)[#](#pull-requests-for-1-14-1 "Link to this heading") + +* [#21000](https://github.com/scipy/scipy/pull/21000): BLD: make cp313 wheels [wheel build] +* [#21038](https://github.com/scipy/scipy/pull/21038): REL, MAINT: prep for 1.14.1 +* [#21062](https://github.com/scipy/scipy/pull/21062): BUG: special: Fixes for pro\_rad1 +* [#21067](https://github.com/scipy/scipy/pull/21067): BUG: special: remove type punning to avoid warnings in LTO builds +* [#21069](https://github.com/scipy/scipy/pull/21069): MAINT: uarray: fix typo in `small\_dynamic\_array.h` +* [#21074](https://github.com/scipy/scipy/pull/21074): MAINT: adapt to array-api-strict 2.0 +* [#21084](https://github.com/scipy/scipy/pull/21084): BLD: Enable `open\_memstream()` on newer glibc +* [#21104](https://github.com/scipy/scipy/pull/21104): MAINT: Unskip `scipy.misc.test.test\_decorator` for Python 3.13+ +* [#21107](https://github.com/scipy/scipy/pull/21107): DOC: add release note for 1.14 sparse section about sparse array… +* [#21108](https://github.com/scipy/scipy/pull/21108): BUG: sparse: fix 1D for vstack/hstack and Improve 1D error msgs… +* [#21160](https://github.com/scipy/scipy/pull/21160): BUG: signal: fix crash under free-threaded CPython in medfilt2d +* [#21172](https://github.com/scipy/scipy/pull/21172): BUG: sparse.linalg: Update `SuperLU` to fix unfilterable output… +* [#21200](https://github.com/scipy/scipy/pull/21200): DOC: Fix type of ``html\_sidebars`` value in ``conf.py`` +* [#21209](https://github.com/scipy/scipy/pull/21209): BUG: fft: fix array-like input +* [#21244](https://github.com/scipy/scipy/pull/21244): BUG: sparse: fix failing doctests in io and csgraph that print… +* [#21271](https://github.com/scipy/scipy/pull/21271): DOC: stats: silence the doctest error +* [#21274](https://github.com/scipy/scipy/pull/21274): MAINT: sparse.linalg: update `SuperLU/colamd.c` to fix license… +* [#21283](https://github.com/scipy/scipy/pull/21283): BUG: stats: adapt to `np.floor` type promotion removal +* [#21305](https://github.com/scipy/scipy/pull/21305): MAINT: `stats.bartlett`: ensure statistic is non-negative +* [#21315](https://github.com/scipy/scipy/pull/21315): CI: Update to cibuildwheel 2.20.0 +* [#21320](https://github.com/scipy/scipy/pull/21320): BUG: odr: fix pickling +* [#21324](https://github.com/scipy/scipy/pull/21324): DOC: Don’t use Sphinx 8.0.0 until gh-21323 is resolved. +* [#21400](https://github.com/scipy/scipy/pull/21400): BUG: sparse: Fix 1D specialty hstack codes +* [#21401](https://github.com/scipy/scipy/pull/21401): MAINT: special: Accommodate changed integer handling in NumPy… +* [#21409](https://github.com/scipy/scipy/pull/21409): BLD: cp313 wheels on `manylinux\_aarch64` diff --git a/corpus/changelog/scipy_releases/scipy_1150.md b/corpus/changelog/scipy_releases/scipy_1150.md new file mode 100644 index 0000000000000000000000000000000000000000..0a2a50b70ea234adc7d92c4590d34438c30caff6 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1150.md @@ -0,0 +1,1574 @@ +# SciPy 1.15.0 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.15.0-notes.html +Version: 1.15.0 + +Contents + +* [SciPy 1.15.0 Release Notes](#scipy-1-15-0-release-notes) + + + [Highlights of this release](#highlights-of-this-release) + + [New features](#new-features) + + - [`scipy.differentiate` introduction](#scipy-differentiate-introduction) + - [`scipy.integrate` improvements](#scipy-integrate-improvements) + - [`scipy.interpolate` improvements](#scipy-interpolate-improvements) + - [`scipy.linalg` improvements](#scipy-linalg-improvements) + - [`scipy.ndimage` improvements](#scipy-ndimage-improvements) + - [`scipy.optimize` improvements](#scipy-optimize-improvements) + - [`scipy.signal` improvements](#scipy-signal-improvements) + - [`scipy.sparse` improvements](#scipy-sparse-improvements) + - [`scipy.spatial` improvements](#scipy-spatial-improvements) + - [`scipy.special` improvements](#scipy-special-improvements) + - [`scipy.stats` improvements](#scipy-stats-improvements) + - [Preliminary Support for Free-Threaded CPython 3.13](#preliminary-support-for-free-threaded-cpython-3-13) + + [Array API Standard Support](#array-api-standard-support) + + [Deprecated features and future changes](#deprecated-features-and-future-changes) + + [Expired Deprecations](#expired-deprecations) + + [Backwards incompatible changes](#backwards-incompatible-changes) + + [Other changes](#other-changes) + + [Authors (commits)](#authors-commits) + + [Issues closed for 1.15.0](#issues-closed-for-1-15-0) + + [Pull requests for 1.15.0](#pull-requests-for-1-15-0) + +SciPy 1.15.0 is the culmination of 6 months of hard work. It contains +many new features, numerous bug-fixes, improved test coverage and better +documentation. There have been a number of deprecations and API changes +in this release, which are documented below. All users are encouraged to +upgrade to this release, as there are a large number of bug-fixes and +optimizations. Before upgrading, we recommend that users check that +their own code does not use deprecated SciPy functionality (to do so, +run your code with `python -Wd` and check for `DeprecationWarning` s). +Our development attention will now shift to bug-fix releases on the +1.15.x branch, and on adding new features on the main branch. + +This release requires Python 3.10-3.13 and NumPy 1.23.5 or greater. + +## [Highlights of this release](#id3)[#](#highlights-of-this-release "Link to this heading") + +* Sparse arrays are now fully functional for 1-D and 2-D arrays. We recommend + that all new code use sparse arrays instead of sparse matrices and that + developers start to migrate their existing code from sparse matrix to sparse + array: + [Migration from spmatrix to sparray](../reference/sparse.migration_to_sparray.html#migration-to-sparray). Both `sparse.linalg` and `sparse.csgraph` + work with either sparse matrix or sparse array and work internally with + sparse array. +* Sparse arrays now provide basic support for n-D arrays in the COO format + including `add`, `subtract`, `reshape`, `transpose`, `matmul`, + `dot`, `tensordot` and others. More functionality is coming in future + releases. +* Preliminary support for free-threaded Python 3.13. +* New probability distribution features in [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") can be used to improve + the speed and accuracy of existing continuous distributions and perform new + probability calculations. +* Several new features support vectorized calculations with Python Array API + Standard compatible input (see “Array API Standard Support” below): + + + [`scipy.differentiate`](../reference/differentiate.html#module-scipy.differentiate "scipy.differentiate") is a new top-level submodule for accurate + estimation of derivatives of black box functions. + + [`scipy.optimize.elementwise`](../reference/optimize.elementwise.html#module-scipy.optimize.elementwise "scipy.optimize.elementwise") contains new functions for root-finding and + minimization of univariate functions. + + [`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") offers new functions `cubature`, `tanhsinh`, and + `nsum` for multivariate integration, univariate integration, and + univariate series summation, respectively. +* [`scipy.interpolate.AAA`](../reference/generated/scipy.interpolate.AAA.html#scipy.interpolate.AAA "scipy.interpolate.AAA") adds the AAA algorithm for barycentric rational + approximation of real or complex functions. +* [`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") adds new functions offering improved Legendre function + implementations with a more consistent interface. + +## [New features](#id4)[#](#new-features "Link to this heading") + +### [`scipy.differentiate` introduction](#id5)[#](#scipy-differentiate-introduction "Link to this heading") + +The new [`scipy.differentiate`](../reference/differentiate.html#module-scipy.differentiate "scipy.differentiate") sub-package contains functions for accurate +estimation of derivatives of black box functions. + +* Use [`scipy.differentiate.derivative`](../reference/generated/scipy.differentiate.derivative.html#scipy.differentiate.derivative "scipy.differentiate.derivative") for first-order derivatives of + scalar-in, scalar-out functions. +* Use [`scipy.differentiate.jacobian`](../reference/generated/scipy.differentiate.jacobian.html#scipy.differentiate.jacobian "scipy.differentiate.jacobian") for first-order partial derivatives of + vector-in, vector-out functions. +* Use [`scipy.differentiate.hessian`](../reference/generated/scipy.differentiate.hessian.html#scipy.differentiate.hessian "scipy.differentiate.hessian") for second-order partial derivatives of + vector-in, scalar-out functions. + +All functions use high-order finite difference rules with adaptive (real) +step size. To facilitate batch computation, these functions are vectorized +and support several Array API compatible array libraries in addition to NumPy +(see “Array API Standard Support” below). + +### [`scipy.integrate` improvements](#id6)[#](#scipy-integrate-improvements "Link to this heading") + +* The new [`scipy.integrate.cubature`](../reference/generated/scipy.integrate.cubature.html#scipy.integrate.cubature "scipy.integrate.cubature") function supports multidimensional + integration, and has support for approximating integrals with + one or more sets of infinite limits. +* [`scipy.integrate.tanhsinh`](../reference/generated/scipy.integrate.tanhsinh.html#scipy.integrate.tanhsinh "scipy.integrate.tanhsinh") is now exposed for public use, allowing + evaluation of a convergent integral using tanh-sinh quadrature. +* [`scipy.integrate.nsum`](../reference/generated/scipy.integrate.nsum.html#scipy.integrate.nsum "scipy.integrate.nsum") evaluates finite and infinite series and their + logarithms. +* [`scipy.integrate.lebedev_rule`](../reference/generated/scipy.integrate.lebedev_rule.html#scipy.integrate.lebedev_rule "scipy.integrate.lebedev_rule") computes abscissae and weights for + integration over the surface of a sphere. +* The `QUADPACK` Fortran77 package has been ported to C. + +### [`scipy.interpolate` improvements](#id7)[#](#scipy-interpolate-improvements "Link to this heading") + +* [`scipy.interpolate.AAA`](../reference/generated/scipy.interpolate.AAA.html#scipy.interpolate.AAA "scipy.interpolate.AAA") adds the AAA algorithm for barycentric rational + approximation of real or complex functions. +* [`scipy.interpolate.FloaterHormannInterpolator`](../reference/generated/scipy.interpolate.FloaterHormannInterpolator.html#scipy.interpolate.FloaterHormannInterpolator "scipy.interpolate.FloaterHormannInterpolator") adds barycentric rational + interpolation. +* New functions [`scipy.interpolate.make_splrep`](../reference/generated/scipy.interpolate.make_splrep.html#scipy.interpolate.make_splrep "scipy.interpolate.make_splrep") and + [`scipy.interpolate.make_splprep`](../reference/generated/scipy.interpolate.make_splprep.html#scipy.interpolate.make_splprep "scipy.interpolate.make_splprep") implement construction of smoothing splines. + The algorithmic content is equivalent to FITPACK (`splrep` and `splprep` + functions, and `*UnivariateSpline` classes) and the user API is consistent + with `make_interp_spline`: these functions receive data arrays and return + a [`scipy.interpolate.BSpline`](../reference/generated/scipy.interpolate.BSpline.html#scipy.interpolate.BSpline "scipy.interpolate.BSpline") instance. +* New generator function [`scipy.interpolate.generate_knots`](../reference/generated/scipy.interpolate.generate_knots.html#scipy.interpolate.generate_knots "scipy.interpolate.generate_knots") implements the + FITPACK strategy for selecting knots of a smoothing spline given the + smoothness parameter, `s`. The function exposes the internal logic of knot + selection that `splrep` and `*UnivariateSpline` was using. + +### [`scipy.linalg` improvements](#id8)[#](#scipy-linalg-improvements "Link to this heading") + +* [`scipy.linalg.interpolative`](../reference/linalg.interpolative.html#module-scipy.linalg.interpolative "scipy.linalg.interpolative") Fortran77 code has been ported to Cython. +* [`scipy.linalg.solve`](../reference/generated/scipy.linalg.solve.html#scipy.linalg.solve "scipy.linalg.solve") supports several new values for the `assume_a` + argument, enabling faster computation for diagonal, tri-diagonal, banded, and + triangular matrices. Also, when `assume_a` is left unspecified, the + function now automatically detects and exploits diagonal, tri-diagonal, + and triangular structures. +* [`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") matrix creation functions ([`scipy.linalg.circulant`](../reference/generated/scipy.linalg.circulant.html#scipy.linalg.circulant "scipy.linalg.circulant"), + [`scipy.linalg.companion`](../reference/generated/scipy.linalg.companion.html#scipy.linalg.companion "scipy.linalg.companion"), [`scipy.linalg.convolution_matrix`](../reference/generated/scipy.linalg.convolution_matrix.html#scipy.linalg.convolution_matrix "scipy.linalg.convolution_matrix"), + [`scipy.linalg.fiedler`](../reference/generated/scipy.linalg.fiedler.html#scipy.linalg.fiedler "scipy.linalg.fiedler"), [`scipy.linalg.fiedler_companion`](../reference/generated/scipy.linalg.fiedler_companion.html#scipy.linalg.fiedler_companion "scipy.linalg.fiedler_companion"), and + [`scipy.linalg.leslie`](../reference/generated/scipy.linalg.leslie.html#scipy.linalg.leslie "scipy.linalg.leslie")) now support batch + matrix creation. +* [`scipy.linalg.funm`](../reference/generated/scipy.linalg.funm.html#scipy.linalg.funm "scipy.linalg.funm") is faster. +* [`scipy.linalg.orthogonal_procrustes`](../reference/generated/scipy.linalg.orthogonal_procrustes.html#scipy.linalg.orthogonal_procrustes "scipy.linalg.orthogonal_procrustes") now supports complex input. +* Wrappers for the following LAPACK routines have been added in + [`scipy.linalg.lapack`](../reference/linalg.lapack.html#module-scipy.linalg.lapack "scipy.linalg.lapack"): `?lantr`, `?sytrs`, `?hetrs`, `?trcon`, + and `?gtcon`. +* [`scipy.linalg.expm`](../reference/generated/scipy.linalg.expm.html#scipy.linalg.expm "scipy.linalg.expm") was rewritten in C. +* [`scipy.linalg.null_space`](../reference/generated/scipy.linalg.null_space.html#scipy.linalg.null_space "scipy.linalg.null_space") now accepts the new arguments `overwrite_a`, + `check_finite`, and `lapack_driver`. +* `id_dist` Fortran code was rewritten in Cython. + +### [`scipy.ndimage` improvements](#id9)[#](#scipy-ndimage-improvements "Link to this heading") + +* Several additional filtering functions now support an `axes` argument + that specifies which axes of the input filtering is to be performed on. + These include `correlate`, `convolve`, `generic_laplace`, `laplace`, + `gaussian_laplace`, `derivative2`, `generic_gradient_magnitude`, + `gaussian_gradient_magnitude` and `generic_filter`. +* The binary and grayscale morphology functions now support an `axes` + argument that specifies which axes of the input filtering is to be performed + on. +* [`scipy.ndimage.rank_filter`](../reference/generated/scipy.ndimage.rank_filter.html#scipy.ndimage.rank_filter "scipy.ndimage.rank_filter") time complexity has improved from `n` to + `log(n)`. + +### [`scipy.optimize` improvements](#id10)[#](#scipy-optimize-improvements "Link to this heading") + +* The vendored HiGHS library has been upgraded from `1.4.0` to `1.8.0`, + bringing accuracy and performance improvements to solvers. +* The `MINPACK` Fortran77 package has been ported to C. +* The `L-BFGS-B` Fortran77 package has been ported to C. +* The new [`scipy.optimize.elementwise`](../reference/optimize.elementwise.html#module-scipy.optimize.elementwise "scipy.optimize.elementwise") namespace includes functions + `bracket_root`, `find_root`, `bracket_minimum`, and `find_minimum` + for root-finding and minimization of univariate functions. To facilitate + batch computation, these functions are vectorized and support several + Array API compatible array libraries in addition to NumPy (see + “Array API Standard Support” below). Compared to existing functions (e.g. + [`scipy.optimize.root_scalar`](../reference/generated/scipy.optimize.root_scalar.html#scipy.optimize.root_scalar "scipy.optimize.root_scalar") and [`scipy.optimize.minimize_scalar`](../reference/generated/scipy.optimize.minimize_scalar.html#scipy.optimize.minimize_scalar "scipy.optimize.minimize_scalar")), + these functions can offer speedups of over 100x when used with NumPy arrays, + and even greater gains are possible with other Array API Standard compatible + array libraries (e.g. CuPy). +* [`scipy.optimize.differential_evolution`](../reference/generated/scipy.optimize.differential_evolution.html#scipy.optimize.differential_evolution "scipy.optimize.differential_evolution") now supports more general use of + `workers`, such as passing a map-like callable. +* [`scipy.optimize.nnls`](../reference/generated/scipy.optimize.nnls.html#scipy.optimize.nnls "scipy.optimize.nnls") was rewritten in Cython. +* `HessianUpdateStrategy` now supports `__matmul__`. + +### [`scipy.signal` improvements](#id11)[#](#scipy-signal-improvements "Link to this heading") + +* Add functionality of complex-valued waveforms to `signal.chirp()`. +* [`scipy.signal.lombscargle`](../reference/generated/scipy.signal.lombscargle.html#scipy.signal.lombscargle "scipy.signal.lombscargle") has two new arguments, `weights` and + `floating_mean`, enabling sample weighting and removal of an unknown + y-offset independently for each frequency. Additionally, the `normalize` + argument includes a new option to return the complex representation of the + amplitude and phase. +* New function [`scipy.signal.envelope`](../reference/generated/scipy.signal.envelope.html#scipy.signal.envelope "scipy.signal.envelope") for computation of the envelope of a + real or complex valued signal. + +### [`scipy.sparse` improvements](#id12)[#](#scipy-sparse-improvements "Link to this heading") + +* A [migration guide](../reference/sparse.migration_to_sparray.html#migration-to-sparray) is now available for + moving from sparse.matrix to sparse.array in your code/library. +* Sparse arrays now support indexing for 1-D and 2-D arrays. So, sparse + arrays are now fully functional for 1-D and 2D. +* n-D sparse arrays in COO format can now be constructed, reshaped and used + for basic arithmetic. +* New functions `sparse.linalg.is_sptriangular` and + `sparse.linalg.spbandwidth` mimic the existing dense tools + `linalg.is_triangular` and `linalg.bandwidth`. +* `sparse.linalg` and `sparse.csgraph` now work with sparse arrays. Be + careful that your index arrays are 32-bit. We are working on 64bit support. +* The vendored `ARPACK` library has been upgraded to version `3.9.1`. +* COO, CSR, CSC and LIL formats now support the `axis` argument for + `count_nonzero`. +* Sparse arrays and matrices may now raise errors when initialized with + incompatible data types, such as `float16`. +* `min`, `max`, `argmin`, and `argmax` now support computation + over nonzero elements only via the new `explicit` argument. +* New functions `get_index_dtype` and `safely_cast_index_arrays` are + available to facilitate index array casting in `sparse`. + +### [`scipy.spatial` improvements](#id13)[#](#scipy-spatial-improvements "Link to this heading") + +* `Rotation.concatenate` now accepts a bare `Rotation` object, and will + return a copy of it. + +### [`scipy.special` improvements](#id14)[#](#scipy-special-improvements "Link to this heading") + +* New functions offering improved Legendre function implementations with a + more consistent interface. See respective docstrings for more information. + + + [`scipy.special.legendre_p`](../reference/generated/scipy.special.legendre_p.html#scipy.special.legendre_p "scipy.special.legendre_p"), [`scipy.special.legendre_p_all`](../reference/generated/scipy.special.legendre_p_all.html#scipy.special.legendre_p_all "scipy.special.legendre_p_all") + + [`scipy.special.assoc_legendre_p`](../reference/generated/scipy.special.assoc_legendre_p.html#scipy.special.assoc_legendre_p "scipy.special.assoc_legendre_p"), [`scipy.special.assoc_legendre_p_all`](../reference/generated/scipy.special.assoc_legendre_p_all.html#scipy.special.assoc_legendre_p_all "scipy.special.assoc_legendre_p_all") + + [`scipy.special.sph_harm_y`](../reference/generated/scipy.special.sph_harm_y.html#scipy.special.sph_harm_y "scipy.special.sph_harm_y"), [`scipy.special.sph_harm_y_all`](../reference/generated/scipy.special.sph_harm_y_all.html#scipy.special.sph_harm_y_all "scipy.special.sph_harm_y_all") + + [`scipy.special.sph_legendre_p`](../reference/generated/scipy.special.sph_legendre_p.html#scipy.special.sph_legendre_p "scipy.special.sph_legendre_p"), [`scipy.special.sph_legendre_p_all`](../reference/generated/scipy.special.sph_legendre_p_all.html#scipy.special.sph_legendre_p_all "scipy.special.sph_legendre_p_all"), +* The factorial functions `special.{factorial,factorial2,factorialk}` now + offer an extension to the complex domain by passing the kwarg + `extend='complex'`. This is opt-in because it changes the values for + negative inputs (which by default return 0), as well as for some integers + (in the case of `factorial2` and `factorialk`; for more details, + check the respective docstrings). +* [`scipy.special.zeta`](../reference/generated/scipy.special.zeta.html#scipy.special.zeta "scipy.special.zeta") now defines the Riemann zeta function on the complex + plane. +* [`scipy.special.softplus`](../reference/generated/scipy.special.softplus.html#scipy.special.softplus "scipy.special.softplus") computes the softplus function +* The spherical Bessel functions ([`scipy.special.spherical_jn`](../reference/generated/scipy.special.spherical_jn.html#scipy.special.spherical_jn "scipy.special.spherical_jn"), + [`scipy.special.spherical_yn`](../reference/generated/scipy.special.spherical_yn.html#scipy.special.spherical_yn "scipy.special.spherical_yn"), [`scipy.special.spherical_in`](../reference/generated/scipy.special.spherical_in.html#scipy.special.spherical_in "scipy.special.spherical_in"), and + [`scipy.special.spherical_kn`](../reference/generated/scipy.special.spherical_kn.html#scipy.special.spherical_kn "scipy.special.spherical_kn")) now support negative arguments with real dtype. +* [`scipy.special.logsumexp`](../reference/generated/scipy.special.logsumexp.html#scipy.special.logsumexp "scipy.special.logsumexp") now preserves precision when one element of the + sum has magnitude much bigger than the rest. +* The accuracy of several functions has been improved: + + + [`scipy.special.ncfdtr`](../reference/generated/scipy.special.ncfdtr.html#scipy.special.ncfdtr "scipy.special.ncfdtr"), [`scipy.special.nctdtr`](../reference/generated/scipy.special.nctdtr.html#scipy.special.nctdtr "scipy.special.nctdtr"), and + [`scipy.special.gdtrib`](../reference/generated/scipy.special.gdtrib.html#scipy.special.gdtrib "scipy.special.gdtrib") have been improved throughout the domain. + + [`scipy.special.hyperu`](../reference/generated/scipy.special.hyperu.html#scipy.special.hyperu "scipy.special.hyperu") is improved for the case of `b=1`, small `x`, + and small `a`. + + [`scipy.special.logit`](../reference/generated/scipy.special.logit.html#scipy.special.logit "scipy.special.logit") is improved near the argument `p=0.5`. + + [`scipy.special.rel_entr`](../reference/generated/scipy.special.rel_entr.html#scipy.special.rel_entr "scipy.special.rel_entr") is improved when `x/y` overflows, underflows, + or is close to `1`. +* [`scipy.special.ndtr`](../reference/generated/scipy.special.ndtr.html#scipy.special.ndtr "scipy.special.ndtr") is now more efficient for `sqrt(2)/2 < |x| < 1`. + +### [`scipy.stats` improvements](#id15)[#](#scipy-stats-improvements "Link to this heading") + +* A new probability distribution infrastructure has been added for the + implementation of univariate, continuous distributions. It has several + speed, accuracy, memory, and interface advantages compared to the + previous infrastructure. See [Random Variable Transition Guide](../tutorial/stats/rv_infrastructure.html#rv-infrastructure) for a tutorial. + + + Use [`scipy.stats.make_distribution`](../reference/generated/scipy.stats.make_distribution.html#scipy.stats.make_distribution "scipy.stats.make_distribution") to treat an existing continuous + distribution (e.g. [`scipy.stats.norm`](../reference/generated/scipy.stats.norm.html#scipy.stats.norm "scipy.stats.norm")) with the new infrastructure. + This can improve the speed and accuracy of existing distributions, + especially those with methods not overridden with distribution-specific + formulas. + + [`scipy.stats.Normal`](../reference/generated/scipy.stats.Normal.html#scipy.stats.Normal "scipy.stats.Normal") and [`scipy.stats.Uniform`](../reference/generated/scipy.stats.Uniform.html#scipy.stats.Uniform "scipy.stats.Uniform") are pre-defined classes + to represent the normal and uniform distributions, respectively. + Their interfaces may be faster and more convenient than those produced by + `make_distribution`. + + [`scipy.stats.Mixture`](../reference/generated/scipy.stats.Mixture.html#scipy.stats.Mixture "scipy.stats.Mixture") can be used to represent mixture distributions. +* Instances of [`scipy.stats.Normal`](../reference/generated/scipy.stats.Normal.html#scipy.stats.Normal "scipy.stats.Normal"), [`scipy.stats.Uniform`](../reference/generated/scipy.stats.Uniform.html#scipy.stats.Uniform "scipy.stats.Uniform"), and the classes + returned by [`scipy.stats.make_distribution`](../reference/generated/scipy.stats.make_distribution.html#scipy.stats.make_distribution "scipy.stats.make_distribution") are supported by several new + mathematical transformations. + + + [`scipy.stats.truncate`](../reference/generated/scipy.stats.truncate.html#scipy.stats.truncate "scipy.stats.truncate") for truncation of the support. + + [`scipy.stats.order_statistic`](../reference/generated/scipy.stats.order_statistic.html#scipy.stats.order_statistic "scipy.stats.order_statistic") for the order statistics of a given number + of IID random variables. + + [`scipy.stats.abs`](../reference/generated/scipy.stats.abs.html#scipy.stats.abs "scipy.stats.abs"), [`scipy.stats.exp`](../reference/generated/scipy.stats.exp.html#scipy.stats.exp "scipy.stats.exp"), and [`scipy.stats.log`](../reference/generated/scipy.stats.log.html#scipy.stats.log "scipy.stats.log"). For example, + `scipy.stats.abs(Normal())` is distributed according to the folded normal + and `scipy.stats.exp(Normal())` is lognormally distributed. +* The new [`scipy.stats.lmoment`](../reference/generated/scipy.stats.lmoment.html#scipy.stats.lmoment "scipy.stats.lmoment") calculates sample l-moments and l-moment + ratios. Notably, these sample estimators are unbiased. +* [`scipy.stats.chatterjeexi`](../reference/generated/scipy.stats.chatterjeexi.html#scipy.stats.chatterjeexi "scipy.stats.chatterjeexi") computes the Xi correlation coefficient, which + can detect nonlinear dependence. The function also performs a hypothesis + test of independence between samples. +* [`scipy.stats.wilcoxon`](../reference/generated/scipy.stats.wilcoxon.html#scipy.stats.wilcoxon "scipy.stats.wilcoxon") has improved method resolution logic for the default + `method='auto'`. Other values of `method` provided by the user are now + respected in all cases, and the method argument `approx` has been + renamed to `asymptotic` for consistency with similar functions. (Use of + `approx` is still allowed for backward compatibility.) +* There are several new probability distributions: + + + [`scipy.stats.dpareto_lognorm`](../reference/generated/scipy.stats.dpareto_lognorm.html#scipy.stats.dpareto_lognorm "scipy.stats.dpareto_lognorm") represents the double Pareto lognormal + distribution. + + [`scipy.stats.landau`](../reference/generated/scipy.stats.landau.html#scipy.stats.landau "scipy.stats.landau") represents the Landau distribution. + + [`scipy.stats.normal_inverse_gamma`](../reference/generated/scipy.stats.normal_inverse_gamma.html#scipy.stats.normal_inverse_gamma "scipy.stats.normal_inverse_gamma") represents the normal-inverse-gamma + distribution. + + [`scipy.stats.poisson_binom`](../reference/generated/scipy.stats.poisson_binom.html#scipy.stats.poisson_binom "scipy.stats.poisson_binom") represents the Poisson binomial distribution. +* Batch calculation with [`scipy.stats.alexandergovern`](../reference/generated/scipy.stats.alexandergovern.html#scipy.stats.alexandergovern "scipy.stats.alexandergovern") and + [`scipy.stats.combine_pvalues`](../reference/generated/scipy.stats.combine_pvalues.html#scipy.stats.combine_pvalues "scipy.stats.combine_pvalues") is faster. +* [`scipy.stats.chisquare`](../reference/generated/scipy.stats.chisquare.html#scipy.stats.chisquare "scipy.stats.chisquare") added an argument `sum_check`. By default, the + function raises an error when the sum of expected and obseved frequencies + are not equal; setting `sum_check=False` disables this check to + facilitate hypothesis tests other than Pearson’s chi-squared test. +* The accuracy of several distribution methods has been improved, including: + + + [`scipy.stats.nct`](../reference/generated/scipy.stats.nct.html#scipy.stats.nct "scipy.stats.nct") method `pdf` + + [`scipy.stats.crystalball`](../reference/generated/scipy.stats.crystalball.html#scipy.stats.crystalball "scipy.stats.crystalball") method `sf` + + [`scipy.stats.geom`](../reference/generated/scipy.stats.geom.html#scipy.stats.geom "scipy.stats.geom") method `rvs` + + [`scipy.stats.cauchy`](../reference/generated/scipy.stats.cauchy.html#scipy.stats.cauchy "scipy.stats.cauchy") methods `logpdf`, `pdf`, `ppf` and `isf` + + The `logcdf` and/or `logsf` methods of distributions that do not + override the generic implementation of these methods, including + [`scipy.stats.beta`](../reference/generated/scipy.stats.beta.html#scipy.stats.beta "scipy.stats.beta"), [`scipy.stats.betaprime`](../reference/generated/scipy.stats.betaprime.html#scipy.stats.betaprime "scipy.stats.betaprime"), [`scipy.stats.cauchy`](../reference/generated/scipy.stats.cauchy.html#scipy.stats.cauchy "scipy.stats.cauchy"), + [`scipy.stats.chi`](../reference/generated/scipy.stats.chi.html#scipy.stats.chi "scipy.stats.chi"), [`scipy.stats.chi2`](../reference/generated/scipy.stats.chi2.html#scipy.stats.chi2 "scipy.stats.chi2"), [`scipy.stats.exponweib`](../reference/generated/scipy.stats.exponweib.html#scipy.stats.exponweib "scipy.stats.exponweib"), + [`scipy.stats.gamma`](../reference/generated/scipy.stats.gamma.html#scipy.stats.gamma "scipy.stats.gamma"), [`scipy.stats.gompertz`](../reference/generated/scipy.stats.gompertz.html#scipy.stats.gompertz "scipy.stats.gompertz"), [`scipy.stats.halflogistic`](../reference/generated/scipy.stats.halflogistic.html#scipy.stats.halflogistic "scipy.stats.halflogistic"), + [`scipy.stats.hypsecant`](../reference/generated/scipy.stats.hypsecant.html#scipy.stats.hypsecant "scipy.stats.hypsecant"), [`scipy.stats.invgamma`](../reference/generated/scipy.stats.invgamma.html#scipy.stats.invgamma "scipy.stats.invgamma"), [`scipy.stats.laplace`](../reference/generated/scipy.stats.laplace.html#scipy.stats.laplace "scipy.stats.laplace"), + [`scipy.stats.levy`](../reference/generated/scipy.stats.levy.html#scipy.stats.levy "scipy.stats.levy"), [`scipy.stats.loggamma`](../reference/generated/scipy.stats.loggamma.html#scipy.stats.loggamma "scipy.stats.loggamma"), [`scipy.stats.maxwell`](../reference/generated/scipy.stats.maxwell.html#scipy.stats.maxwell "scipy.stats.maxwell"), + [`scipy.stats.nakagami`](../reference/generated/scipy.stats.nakagami.html#scipy.stats.nakagami "scipy.stats.nakagami"), and [`scipy.stats.t`](../reference/generated/scipy.stats.t.html#scipy.stats.t "scipy.stats.t"). +* [`scipy.stats.qmc.PoissonDisk`](../reference/generated/scipy.stats.qmc.PoissonDisk.html#scipy.stats.qmc.PoissonDisk "scipy.stats.qmc.PoissonDisk") now accepts lower and upper bounds + parameters `l_bounds` and `u_bounds`. +* [`scipy.stats.fisher_exact`](../reference/generated/scipy.stats.fisher_exact.html#scipy.stats.fisher_exact "scipy.stats.fisher_exact") now supports two-dimensional tables with shapes + other than `(2, 2)`. + +### [Preliminary Support for Free-Threaded CPython 3.13](#id16)[#](#preliminary-support-for-free-threaded-cpython-3-13 "Link to this heading") + +SciPy `1.15` has preliminary support for the free-threaded build of CPython +`3.13.` This allows SciPy functionality to execute in parallel with Python +threads +(see the `threading` stdlib module). This support was enabled by fixing a +significant number of thread-safety issues in both pure Python and +C/C++/Cython/Fortran extension modules. Wheels are provided on PyPI for this +release; NumPy `>=2.1.3` is required at runtime. Note that building for a +free-threaded interpreter requires a recent pre-release or nightly for Cython +`3.1.0`. + +Support for free-threaded Python does not mean that SciPy is fully thread-safe. +Please see [Thread Safety in SciPy](../tutorial/thread_safety.html#scipy-thread-safety) for more details. + +If you are interested in free-threaded Python, for example because you have a +multiprocessing-based workflow that you are interested in running with Python +threads, we encourage testing and experimentation. If you run into problems +that you suspect are because of SciPy, please open an issue, checking first if +the bug also occurs in the “regular” non-free-threaded CPython `3.13` build. +Many threading bugs can also occur in code that releases the GIL; disabling +the GIL only makes it easier to hit threading bugs. + +## [Array API Standard Support](#id17)[#](#array-api-standard-support "Link to this heading") + +Experimental support for array libraries other than NumPy has been added to +existing sub-packages in recent versions of SciPy. Please consider testing +these features by setting an environment variable `SCIPY_ARRAY_API=1` and +providing PyTorch, JAX, ndonnx, or CuPy arrays as array arguments. Features +with support added for SciPy `1.15.0` include: + +* All functions in [`scipy.differentiate`](../reference/differentiate.html#module-scipy.differentiate "scipy.differentiate") (new sub-package) +* All functions in [`scipy.optimize.elementwise`](../reference/optimize.elementwise.html#module-scipy.optimize.elementwise "scipy.optimize.elementwise") (new namespace) +* [`scipy.optimize.rosen`](../reference/generated/scipy.optimize.rosen.html#scipy.optimize.rosen "scipy.optimize.rosen"), [`scipy.optimize.rosen_der`](../reference/generated/scipy.optimize.rosen_der.html#scipy.optimize.rosen_der "scipy.optimize.rosen_der"), and + [`scipy.optimize.rosen_hess`](../reference/generated/scipy.optimize.rosen_hess.html#scipy.optimize.rosen_hess "scipy.optimize.rosen_hess") +* [`scipy.special.logsumexp`](../reference/generated/scipy.special.logsumexp.html#scipy.special.logsumexp "scipy.special.logsumexp") +* [`scipy.integrate.trapezoid`](../reference/generated/scipy.integrate.trapezoid.html#scipy.integrate.trapezoid "scipy.integrate.trapezoid") +* [`scipy.integrate.tanhsinh`](../reference/generated/scipy.integrate.tanhsinh.html#scipy.integrate.tanhsinh "scipy.integrate.tanhsinh") (newly public function) +* [`scipy.integrate.cubature`](../reference/generated/scipy.integrate.cubature.html#scipy.integrate.cubature "scipy.integrate.cubature") (new function) +* [`scipy.integrate.nsum`](../reference/generated/scipy.integrate.nsum.html#scipy.integrate.nsum "scipy.integrate.nsum") (new function) +* [`scipy.special.chdtr`](../reference/generated/scipy.special.chdtr.html#scipy.special.chdtr "scipy.special.chdtr"), [`scipy.special.betainc`](../reference/generated/scipy.special.betainc.html#scipy.special.betainc "scipy.special.betainc"), and [`scipy.special.betaincc`](../reference/generated/scipy.special.betaincc.html#scipy.special.betaincc "scipy.special.betaincc") +* [`scipy.stats.boxcox_llf`](../reference/generated/scipy.stats.boxcox_llf.html#scipy.stats.boxcox_llf "scipy.stats.boxcox_llf") +* [`scipy.stats.differential_entropy`](../reference/generated/scipy.stats.differential_entropy.html#scipy.stats.differential_entropy "scipy.stats.differential_entropy") +* [`scipy.stats.zmap`](../reference/generated/scipy.stats.zmap.html#scipy.stats.zmap "scipy.stats.zmap"), [`scipy.stats.zscore`](../reference/generated/scipy.stats.zscore.html#scipy.stats.zscore "scipy.stats.zscore"), and [`scipy.stats.gzscore`](../reference/generated/scipy.stats.gzscore.html#scipy.stats.gzscore "scipy.stats.gzscore") +* [`scipy.stats.tmean`](../reference/generated/scipy.stats.tmean.html#scipy.stats.tmean "scipy.stats.tmean"), [`scipy.stats.tvar`](../reference/generated/scipy.stats.tvar.html#scipy.stats.tvar "scipy.stats.tvar"), [`scipy.stats.tstd`](../reference/generated/scipy.stats.tstd.html#scipy.stats.tstd "scipy.stats.tstd"), + [`scipy.stats.tsem`](../reference/generated/scipy.stats.tsem.html#scipy.stats.tsem "scipy.stats.tsem"), [`scipy.stats.tmin`](../reference/generated/scipy.stats.tmin.html#scipy.stats.tmin "scipy.stats.tmin"), and [`scipy.stats.tmax`](../reference/generated/scipy.stats.tmax.html#scipy.stats.tmax "scipy.stats.tmax") +* [`scipy.stats.gmean`](../reference/generated/scipy.stats.gmean.html#scipy.stats.gmean "scipy.stats.gmean"), [`scipy.stats.hmean`](../reference/generated/scipy.stats.hmean.html#scipy.stats.hmean "scipy.stats.hmean") and [`scipy.stats.pmean`](../reference/generated/scipy.stats.pmean.html#scipy.stats.pmean "scipy.stats.pmean") +* [`scipy.stats.combine_pvalues`](../reference/generated/scipy.stats.combine_pvalues.html#scipy.stats.combine_pvalues "scipy.stats.combine_pvalues") +* [`scipy.stats.ttest_ind`](../reference/generated/scipy.stats.ttest_ind.html#scipy.stats.ttest_ind "scipy.stats.ttest_ind"), [`scipy.stats.ttest_rel`](../reference/generated/scipy.stats.ttest_rel.html#scipy.stats.ttest_rel "scipy.stats.ttest_rel") +* [`scipy.stats.directional_stats`](../reference/generated/scipy.stats.directional_stats.html#scipy.stats.directional_stats "scipy.stats.directional_stats") +* [`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") functions will now delegate to `cupyx.scipy.ndimage`, + and for other backends will transit via NumPy arrays on the host. + +## [Deprecated features and future changes](#id18)[#](#deprecated-features-and-future-changes "Link to this heading") + +* Functions *scipy.linalg.interpolative.rand* and + *scipy.linalg.interpolative.seed* have been deprecated and will be removed + in SciPy `1.17.0`. +* Complex inputs to [`scipy.spatial.distance.cosine`](../reference/generated/scipy.spatial.distance.cosine.html#scipy.spatial.distance.cosine "scipy.spatial.distance.cosine") and + [`scipy.spatial.distance.correlation`](../reference/generated/scipy.spatial.distance.correlation.html#scipy.spatial.distance.correlation "scipy.spatial.distance.correlation") have been deprecated and will raise + an error in SciPy `1.17.0`. +* *scipy.spatial.distance.kulczynski1* and + *scipy.spatial.distance.sokalmichener* were deprecated and will be removed + in SciPy `1.17.0`. +* *scipy.stats.find\_repeats* is deprecated and will be + removed in SciPy `1.17.0`. Please use + `numpy.unique`/`numpy.unique_counts` instead. +* *scipy.linalg.kron* is deprecated in favour of `numpy.kron`. +* Using object arrays and longdouble arrays in [`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") + convolution/correlation functions ([`scipy.signal.correlate`](../reference/generated/scipy.signal.correlate.html#scipy.signal.correlate "scipy.signal.correlate"), + [`scipy.signal.convolve`](../reference/generated/scipy.signal.convolve.html#scipy.signal.convolve "scipy.signal.convolve") and [`scipy.signal.choose_conv_method`](../reference/generated/scipy.signal.choose_conv_method.html#scipy.signal.choose_conv_method "scipy.signal.choose_conv_method")) and + filtering functions ([`scipy.signal.lfilter`](../reference/generated/scipy.signal.lfilter.html#scipy.signal.lfilter "scipy.signal.lfilter"), [`scipy.signal.sosfilt`](../reference/generated/scipy.signal.sosfilt.html#scipy.signal.sosfilt "scipy.signal.sosfilt")) has + been deprecated and will be removed in SciPy `1.17.0`. +* [`scipy.stats.linregress`](../reference/generated/scipy.stats.linregress.html#scipy.stats.linregress "scipy.stats.linregress") has deprecated one-argument use; the two + variables must be specified as separate arguments. +* `scipy.stats.trapz` is deprecated in favor of [`scipy.stats.trapezoid`](../reference/generated/scipy.stats.trapezoid.html#scipy.stats.trapezoid "scipy.stats.trapezoid"). +* *scipy.special.lpn* is deprecated in favor of [`scipy.special.legendre_p_all`](../reference/generated/scipy.special.legendre_p_all.html#scipy.special.legendre_p_all "scipy.special.legendre_p_all"). +* *scipy.special.lpmn* and *scipy.special.clpmn* are deprecated in favor of + [`scipy.special.assoc_legendre_p_all`](../reference/generated/scipy.special.assoc_legendre_p_all.html#scipy.special.assoc_legendre_p_all "scipy.special.assoc_legendre_p_all"). +* *scipy.special.sph\_harm* has been deprecated in favor of + [`scipy.special.sph_harm_y`](../reference/generated/scipy.special.sph_harm_y.html#scipy.special.sph_harm_y "scipy.special.sph_harm_y"). +* Multi-dimensional `r` and `c` arrays passed to [`scipy.linalg.toeplitz`](../reference/generated/scipy.linalg.toeplitz.html#scipy.linalg.toeplitz "scipy.linalg.toeplitz"), + [`scipy.linalg.matmul_toeplitz`](../reference/generated/scipy.linalg.matmul_toeplitz.html#scipy.linalg.matmul_toeplitz "scipy.linalg.matmul_toeplitz"), or [`scipy.linalg.solve_toeplitz`](../reference/generated/scipy.linalg.solve_toeplitz.html#scipy.linalg.solve_toeplitz "scipy.linalg.solve_toeplitz") will be + treated as batches of 1-D coefficients beginning in SciPy `1.17.0`. +* The `random_state` and `permutations` arguments of + [`scipy.stats.ttest_ind`](../reference/generated/scipy.stats.ttest_ind.html#scipy.stats.ttest_ind "scipy.stats.ttest_ind") are deprecated. Use `method` to perform a + permutation test, instead. + +## [Expired Deprecations](#id19)[#](#expired-deprecations "Link to this heading") + +* The wavelet functions in [`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") have been removed. This includes + `daub`, `qmf`, `cascade`, `morlet`, `morlet2`, `ricker`, + and `cwt`. Users should use `pywavelets` instead. +* `scipy.signal.cmplx_sort` has been removed. +* `scipy.integrate.quadrature` and `scipy.integrate.romberg` have been + removed in favour of [`scipy.integrate.quad`](../reference/generated/scipy.integrate.quad.html#scipy.integrate.quad "scipy.integrate.quad"). +* `scipy.stats.rvs_ratio_uniforms` has been removed in favor of + [`scipy.stats.sampling.RatioUniforms`](../reference/generated/scipy.stats.sampling.RatioUniforms.html#scipy.stats.sampling.RatioUniforms "scipy.stats.sampling.RatioUniforms"). +* [`scipy.special.factorial`](../reference/generated/scipy.special.factorial.html#scipy.special.factorial "scipy.special.factorial") now raises an error for non-integer scalars when + `exact=True`. +* [`scipy.integrate.cumulative_trapezoid`](../reference/generated/scipy.integrate.cumulative_trapezoid.html#scipy.integrate.cumulative_trapezoid "scipy.integrate.cumulative_trapezoid") now raises an error for values of + `initial` other than `0` and `None`. +* Complex dtypes now raise an error in [`scipy.interpolate.Akima1DInterpolator`](../reference/generated/scipy.interpolate.Akima1DInterpolator.html#scipy.interpolate.Akima1DInterpolator "scipy.interpolate.Akima1DInterpolator") + and [`scipy.interpolate.PchipInterpolator`](../reference/generated/scipy.interpolate.PchipInterpolator.html#scipy.interpolate.PchipInterpolator "scipy.interpolate.PchipInterpolator") +* `special.btdtr` and `special.btdtri` have been removed. +* The default of the `exact=` kwarg in `special.factorialk` has changed + from `True` to `False`. +* All functions in the `scipy.misc` submodule have been removed. + +## [Backwards incompatible changes](#id20)[#](#backwards-incompatible-changes "Link to this heading") + +* `interpolate.BSpline.integrate` output is now always a numpy array. + Previously, for 1D splines the output was a python float or a 0D array + depending on the value of the `extrapolate` argument. +* [`scipy.stats.wilcoxon`](../reference/generated/scipy.stats.wilcoxon.html#scipy.stats.wilcoxon "scipy.stats.wilcoxon") now respects the `method` argument provided by the + user. Previously, even if `method='exact'` was specified, the function + would resort to `method='approx'` in some cases. +* `scipy.integrate.AccuracyWarning` has been removed as the functions the + warning was emitted from (`scipy.integrate.quadrature` and + `scipy.integrate.romberg`) have been removed. + +## [Other changes](#id21)[#](#other-changes "Link to this heading") + +* A separate accompanying type stubs package, `scipy-stubs`, will be made + available with the `1.15.0` release. [Installation instructions are + available](https://github.com/jorenham/scipy-stubs?tab=readme-ov-file#installation). +* [`scipy.stats.bootstrap`](../reference/generated/scipy.stats.bootstrap.html#scipy.stats.bootstrap "scipy.stats.bootstrap") now emits a `FutureWarning` if the shapes of the + input arrays do not agree. Broadcast the arrays to the same batch shape + (i.e. for all dimensions except those specified by the `axis` argument) + to avoid the warning. Broadcasting will be performed automatically in the + future. +* SciPy endorsed [SPEC-7](https://scientific-python.org/specs/spec-0007/), + which proposes a `rng` argument to control pseudorandom number generation + (PRNG) in a standard way, replacing legacy arguments like `seed` and + `random_sate`. In many cases, use of `rng` will change the behavior of + the function unless the argument is already an instance of + `numpy.random.Generator`. + + + Effective in SciPy `1.15.0`: + + - The `rng` argument has been added to the following functions: + [`scipy.cluster.vq.kmeans`](../reference/generated/scipy.cluster.vq.kmeans.html#scipy.cluster.vq.kmeans "scipy.cluster.vq.kmeans"), [`scipy.cluster.vq.kmeans2`](../reference/generated/scipy.cluster.vq.kmeans2.html#scipy.cluster.vq.kmeans2 "scipy.cluster.vq.kmeans2"), + [`scipy.interpolate.BarycentricInterpolator`](../reference/generated/scipy.interpolate.BarycentricInterpolator.html#scipy.interpolate.BarycentricInterpolator "scipy.interpolate.BarycentricInterpolator"), + [`scipy.interpolate.barycentric_interpolate`](../reference/generated/scipy.interpolate.barycentric_interpolate.html#scipy.interpolate.barycentric_interpolate "scipy.interpolate.barycentric_interpolate"), + [`scipy.linalg.clarkson_woodruff_transform`](../reference/generated/scipy.linalg.clarkson_woodruff_transform.html#scipy.linalg.clarkson_woodruff_transform "scipy.linalg.clarkson_woodruff_transform"), + [`scipy.optimize.basinhopping`](../reference/generated/scipy.optimize.basinhopping.html#scipy.optimize.basinhopping "scipy.optimize.basinhopping"), + [`scipy.optimize.differential_evolution`](../reference/generated/scipy.optimize.differential_evolution.html#scipy.optimize.differential_evolution "scipy.optimize.differential_evolution"), [`scipy.optimize.dual_annealing`](../reference/generated/scipy.optimize.dual_annealing.html#scipy.optimize.dual_annealing "scipy.optimize.dual_annealing"), + [`scipy.optimize.check_grad`](../reference/generated/scipy.optimize.check_grad.html#scipy.optimize.check_grad "scipy.optimize.check_grad"), [`scipy.optimize.quadratic_assignment`](../reference/generated/scipy.optimize.quadratic_assignment.html#scipy.optimize.quadratic_assignment "scipy.optimize.quadratic_assignment"), + [`scipy.sparse.random`](../reference/generated/scipy.sparse.random.html#scipy.sparse.random "scipy.sparse.random"), [`scipy.sparse.random_array`](../reference/generated/scipy.sparse.random_array.html#scipy.sparse.random_array "scipy.sparse.random_array"), [`scipy.sparse.rand`](../reference/generated/scipy.sparse.rand.html#scipy.sparse.rand "scipy.sparse.rand"), + [`scipy.sparse.linalg.svds`](../reference/generated/scipy.sparse.linalg.svds.html#scipy.sparse.linalg.svds "scipy.sparse.linalg.svds"), [`scipy.spatial.transform.Rotation.random`](../reference/generated/scipy.spatial.transform.Rotation.random.html#scipy.spatial.transform.Rotation.random "scipy.spatial.transform.Rotation.random"), + [`scipy.spatial.distance.directed_hausdorff`](../reference/generated/scipy.spatial.distance.directed_hausdorff.html#scipy.spatial.distance.directed_hausdorff "scipy.spatial.distance.directed_hausdorff"), + [`scipy.stats.goodness_of_fit`](../reference/generated/scipy.stats.goodness_of_fit.html#scipy.stats.goodness_of_fit "scipy.stats.goodness_of_fit"), [`scipy.stats.BootstrapMethod`](../reference/generated/scipy.stats.BootstrapMethod.html#scipy.stats.BootstrapMethod "scipy.stats.BootstrapMethod"), + [`scipy.stats.PermutationMethod`](../reference/generated/scipy.stats.PermutationMethod.html#scipy.stats.PermutationMethod "scipy.stats.PermutationMethod"), [`scipy.stats.bootstrap`](../reference/generated/scipy.stats.bootstrap.html#scipy.stats.bootstrap "scipy.stats.bootstrap"), + [`scipy.stats.permutation_test`](../reference/generated/scipy.stats.permutation_test.html#scipy.stats.permutation_test "scipy.stats.permutation_test"), [`scipy.stats.dunnett`](../reference/generated/scipy.stats.dunnett.html#scipy.stats.dunnett "scipy.stats.dunnett"), all + [`scipy.stats.qmc`](../reference/stats.qmc.html#module-scipy.stats.qmc "scipy.stats.qmc") classes that consume random numbers, and + [`scipy.stats.sobol_indices`](../reference/generated/scipy.stats.sobol_indices.html#scipy.stats.sobol_indices "scipy.stats.sobol_indices"). + - When passed by keyword, the `rng` argument will follow the SPEC 7 + standard behavior: the argument will be normalized with + `np.random.default_rng` before being used. + - When passed by position or legacy keyword, the behavior of the argument + will remain unchanged (for now). + + It is planned that in `1.17.0` the legacy argument will start emitting + warnings, and that in `1.19.0` the default behavior will change. + + In all cases, users can avoid future disruption by proactively passing + an instance of `np.random.Generator` by keyword `rng`. For details, + see [SPEC-7](https://scientific-python.org/specs/spec-0007/). +* The SciPy build no longer adds `-std=legacy` for Fortran code, + except when using Gfortran. This avoids problems with the new Flang and + AMD Fortran compilers. It may make new build warnings appear for other + compilers - if so, please file an issue. +* `scipy.signal.sosfreqz` has been renamed to [`scipy.signal.freqz_sos`](../reference/generated/scipy.signal.freqz_sos.html#scipy.signal.freqz_sos "scipy.signal.freqz_sos"). + New code should use the new name. The old name is maintained as an alias for + backwards compatibility. +* Testing thread-safety improvements related to Python `3.13t` have been + made in: [`scipy.special`](../reference/special.html#module-scipy.special "scipy.special"), [`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial"), [`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse"), + [`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate"). + +## [Authors (commits)](#id22)[#](#authors-commits "Link to this heading") + +* endolith (4) +* h-vetinari (62) +* a-drenaline (1) + +* Afleloup (1) + +* Ahmad Alkadri (1) + +* Luiz Eduardo Amaral (3) + +* Virgile Andreani (3) +* Isaac Alonso Asensio (2) + +* Matteo Bachetti (1) + +* Arash Badie-Modiri (1) + +* Arnaud Baguet (1) + +* Soutrik Bandyopadhyay (1) + +* Ankit Barik (1) + +* Christoph Baumgarten (1) +* Nickolai Belakovski (3) +* Krishan Bhasin (1) + +* Jake Bowhay (89) +* Michael Bratsch (2) + +* Matthew Brett (1) +* Keith Briggs (1) + +* Olly Britton (145) + +* Dietrich Brunn (11) +* Clemens Brunner (1) +* Evgeni Burovski (185) +* Matthias Bussonnier (7) +* CJ Carey (32) +* Cesar Carrasco (4) + +* Hood Chatham (1) +* Aadya Chinubhai (1) +* Alessandro Chitarrini (1) + +* Thibault de Coincy (1) + +* Lucas Colley (217) +* Martin Diehl (1) + +* Djip007 (1) + +* Kevin Doshi (2) + +* Michael Dunphy (2) +* Andy Everall (1) + +* Thomas J. Fan (2) +* fancidev (60) +* Sergey Fedorov (2) + +* Sahil Garje (1) + +* Gabriel Gerlero (2) +* Yotam Gingold (1) + +* Ralf Gommers (111) +* Rohit Goswami (62) +* Anil Gurses (1) + +* Oscar Gustafsson (1) + +* Matt Haberland (392) +* Matt Hall (1) + +* Joren Hammudoglu (6) + +* CY Han (1) + +* Daniel Isaac (4) + +* Maxim Ivanov (1) +* Jakob Jakobson (2) +* Janez Demšar (4) + +* Chris Jerdonek (2) + +* Adam Jones (4) + +* Aditi Juneja (1) + +* Nuri Jung (1) + +* Guus Kamphuis (1) + +* Aditya Karumanchi (2) + +* Robert Kern (5) +* Agriya Khetarpal (11) +* Andrew Knyazev (7) +* Gideon Genadi Kogan (1) + +* Damien LaRocque (1) + +* Eric Larson (10) +* Gregory R. Lee (4) +* Linfye (1) + +* Boyu Liu (1) + +* Drew Allan Loney (1) + +* Christian Lorentzen (1) +* Loïc Estève (2) +* Smit Lunagariya (1) +* Henry Lunn (1) + +* Marco Maggi (4) +* Lauren Main (1) + +* Martin Spišák (1) + +* Mateusz Sokół (4) +* Jan-Kristian Mathisen (1) + +* Nikolay Mayorov (2) +* Nicholas McKibben (1) +* Melissa Weber Mendonça (62) +* João Mendes (10) +* Gian Marco Messa (1) + +* Samuel Le Meur-Diebolt (1) + +* Michał Górny (2) +* Naoto Mizuno (2) +* Nicolas Mokus (2) +* musvaage (18) + +* Andrew Nelson (88) +* Jens Hedegaard Nielsen (1) + +* Roman Nigmatullin (8) + +* Nick ODell (37) +* Yagiz Olmez (4) +* Matti Picus (9) +* Diogo Pires (5) + +* Ilhan Polat (96) +* Zachary Potthoff (1) + +* Tom M. Ragonneau (2) +* Peter Ralph (1) + +* Stephan Rave (1) + +* Tyler Reddy (192) +* redha2404 (2) + +* Ritvik1sharma (1) + +* Érico Nogueira Rolim (1) + +* Heshy Roskes (1) +* Pamphile Roy (34) +* Mikhail Ryazanov (1) + +* Sina Saber (1) + +* Atsushi Sakai (1) +* Clemens Schmid (1) + +* Daniel Schmitz (17) +* Moritz Schreiber (1) + +* Dan Schult (91) +* Searchingdays (1) + +* Matias Senger (1) + +* Scott Shambaugh (1) +* Zhida Shang (1) + +* Sheila-nk (4) +* Romain Simon (2) + +* Gagandeep Singh (31) +* Albert Steppi (40) +* Kai Striega (1) +* Anushka Suyal (143) + +* Alex Szatmary (1) +* Svetlin Tassev (1) + +* Ewout ter Hoeven (1) +* Tibor Völcker (4) + +* Kanishk Tiwari (1) + +* Yusuke Toyama (1) + +* Edgar Andrés Margffoy Tuay (124) +* Adam Turner (2) + +* Nicole Vadot (1) + +* Andrew Valentine (1) +* Christian Veenhuis (2) +* vfdev (2) + +* Pauli Virtanen (2) +* Simon Waldherr (1) + +* Stefan van der Walt (2) +* Warren Weckesser (23) +* Anreas Weh (1) +* Benoît Wygas (2) + +* Pavadol Yamsiri (3) + +* ysard (1) + +* Xiao Yuan (2) +* Irwin Zaid (12) +* Gang Zhao (1) +* ਗਗਨਦੀਪ ਸਿੰਘ (Gagandeep Singh) (10) + +A total of 149 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +## [Issues closed for 1.15.0](#id23)[#](#issues-closed-for-1-15-0 "Link to this heading") + +* [#2011](https://github.com/scipy/scipy/issues/2011): DEP: spatial: ‘sokalmichener’ and ‘rogerstanimoto’ distances… +* [#2035](https://github.com/scipy/scipy/issues/2035): ENH: Add methods to compute derivatives (Trac #1510) +* [#2116](https://github.com/scipy/scipy/issues/2116): Cholesky decomposition - are elements in the ‘other’ triangle… +* [#2162](https://github.com/scipy/scipy/issues/2162): MAINT: signal: `lombscargle` is unclear about normalisation… +* [#2509](https://github.com/scipy/scipy/issues/2509): distributions cdf, sf evaluation in the wrong tail +* [#4096](https://github.com/scipy/scipy/issues/4096): DOC: special: Clarify Mathieu function documentation +* [#4275](https://github.com/scipy/scipy/issues/4275): BUG: linalg.interpolative: svd integer overflow +* [#4517](https://github.com/scipy/scipy/issues/4517): MAINT: special.hankel2: `(0, 0)` delivers (nan+nan\*j) instead… +* [#4538](https://github.com/scipy/scipy/issues/4538): alternative parametrizations of univariate distributions +* [#4708](https://github.com/scipy/scipy/issues/4708): ENH: linalg.funm: a possible speed-up +* [#4952](https://github.com/scipy/scipy/issues/4952): DOC: stats: improvement suggestions for tutorial +* [#5818](https://github.com/scipy/scipy/issues/5818): Clarify definition of preconditioner for sparse linear system… +* [#6528](https://github.com/scipy/scipy/issues/6528): ENH: stats: Add Normal-inverse-gamma distribution +* [#7099](https://github.com/scipy/scipy/issues/7099): ENH: `stats.fisher_exact`: support tables larger than 2x2 +* [#7242](https://github.com/scipy/scipy/issues/7242): ENH: implement at least one good robust scalar root-finding algorithm… +* [#8053](https://github.com/scipy/scipy/issues/8053): Random variate distribution random\_state set after init does… +* [#8307](https://github.com/scipy/scipy/issues/8307): scipy.sparse.linalg.eigs gives incorrect largest magnitude eigenvalue +* [#8344](https://github.com/scipy/scipy/issues/8344): BUG: special.nctdtr: incorrect results +* [#8362](https://github.com/scipy/scipy/issues/8362): a function to convert a matrix into diagonal ordered form (ab)… +* [#8787](https://github.com/scipy/scipy/issues/8787): BUG: signal.lombscargle: raises `ZeroDivisionError` +* [#8888](https://github.com/scipy/scipy/issues/8888): MAINT: special.gegenbauer: case of `alpha = 0` not handled +* [#9249](https://github.com/scipy/scipy/issues/9249): BUG: linalg: `test_interpolative::TestInterpolativeDecomposition::test_id`… +* [#9321](https://github.com/scipy/scipy/issues/9321): Easy access to scipy.stat. frozen distribution… +* [#9509](https://github.com/scipy/scipy/issues/9509): BUG: special: `test_kolmogorov` fails on 32-bit platforms +* [#10106](https://github.com/scipy/scipy/issues/10106): Slow random variate generation in scipy.stats +* [#10328](https://github.com/scipy/scipy/issues/10328): DOC: stats: documentation is not distribution-specific +* [#10364](https://github.com/scipy/scipy/issues/10364): Add Double Pareto-Lognormal Distribution +* [#10374](https://github.com/scipy/scipy/issues/10374): ENH: make ARPACK-NG deterministic +* [#11341](https://github.com/scipy/scipy/issues/11341): MAINT: constants: disparate electric permittivity constants +* [#11465](https://github.com/scipy/scipy/issues/11465): Numerical stability of distributions: Add log\_p as argument to… +* [#11649](https://github.com/scipy/scipy/issues/11649): trust-constr error when attempting to keep bound constrained… +* [#12019](https://github.com/scipy/scipy/issues/12019): scipy.linalg.orthogonal\_procrustes +* [#12282](https://github.com/scipy/scipy/issues/12282): API: stats.chisquare: must observed and expected frequencies… +* [#12367](https://github.com/scipy/scipy/issues/12367): Allow whitespace alignment of tables of numbers? +* [#12593](https://github.com/scipy/scipy/issues/12593): BUG: linalg: `estimate_rank` is quite unreliable +* [#12651](https://github.com/scipy/scipy/issues/12651): BUG: cluster: `fcluster` assigning all points to a single cluster… +* [#12662](https://github.com/scipy/scipy/issues/12662): Complex numpy exponentiation, nan, and/or inf causes segfault… +* [#12895](https://github.com/scipy/scipy/issues/12895): BUG: `special.riccati_yn`: Definition missing minus sign +* [#13019](https://github.com/scipy/scipy/issues/13019): TST, MAINT: test\_maxiter\_worsening on Python 3.9 + Linux ARM64 +* [#13137](https://github.com/scipy/scipy/issues/13137): BUG: linalg.schur: bug sorting complex eigenvalues in real form +* [#13504](https://github.com/scipy/scipy/issues/13504): TST: stats: test distribution `support` method behavior for… +* [#13643](https://github.com/scipy/scipy/issues/13643): BUG: signal.sepfir2d: fails with complex input on Windows +* [#13986](https://github.com/scipy/scipy/issues/13986): Distributions cannot be freed by garbage collector due to self-references +* [#14304](https://github.com/scipy/scipy/issues/14304): Jaccard distance greater than 1 if elements are strings +* [#14467](https://github.com/scipy/scipy/issues/14467): DOC: constants: explain `0.0` uncertainty +* [#14582](https://github.com/scipy/scipy/issues/14582): BUG: `special.spherical_jn`: Negative arguments lead to nans +* [#14788](https://github.com/scipy/scipy/issues/14788): DOC: `linalg.hankel`: clarify that first entry of `r` is… +* [#14895](https://github.com/scipy/scipy/issues/14895): ENH: All statistical distributions in scipy.stats should have… +* [#14945](https://github.com/scipy/scipy/issues/14945): BUG: Overflows/NaNs cause segfault in integrate.quad on certain… +* [#15012](https://github.com/scipy/scipy/issues/15012): ENH: `linalg.cholesky`: document that user is responsible… +* [#15016](https://github.com/scipy/scipy/issues/15016): BUG: linalg.schur: sorting by imaginary part does not work for… +* [#15021](https://github.com/scipy/scipy/issues/15021): scipy.linalg.qr with pivoting=True should return P as (N,N) permutation… +* [#15533](https://github.com/scipy/scipy/issues/15533): BUG: test failure in `test_x0_equals_Mb` with `bicgstab` +* [#15582](https://github.com/scipy/scipy/issues/15582): BUG: `special.ncfdtr(dfn, dfd, nc, f)` and `stats.ncf.cdf(x,`… +* [#15620](https://github.com/scipy/scipy/issues/15620): BUG: signal.resample\_poly returns an array consisting only of… +* [#15888](https://github.com/scipy/scipy/issues/15888): BUG: linprog, with highs is killed by the OOM killer when called… +* [#15896](https://github.com/scipy/scipy/issues/15896): Compiled code coverage with `--gcov` doesn’t work with Meson +* [#15915](https://github.com/scipy/scipy/issues/15915): ENH: optimize: object-oriented interface to HiGHS +* [#16494](https://github.com/scipy/scipy/issues/16494): MAINT: Speed up some slow tests +* [#16531](https://github.com/scipy/scipy/issues/16531): DOC: Warnings/error in docstring examples. +* [#16700](https://github.com/scipy/scipy/issues/16700): BUG: segfault on i386 in special `test_kolmogorov.py` TestSmirnovp +* [#17059](https://github.com/scipy/scipy/issues/17059): ENH: Robust and fast numerical derivative for error propagation +* [#17075](https://github.com/scipy/scipy/issues/17075): Test failures with Intel compilers +* [#17136](https://github.com/scipy/scipy/issues/17136): BUG: logm sometimes raises ZeroDivisionError for matrices with… +* [#17307](https://github.com/scipy/scipy/issues/17307): BUG: stats: frozen distribution domain error produced too late +* [#17344](https://github.com/scipy/scipy/issues/17344): ENH: `scipy.linalg.circulant` should allow batching +* [#17385](https://github.com/scipy/scipy/issues/17385): BUG: `TestOnenormest.test_onenormest_table_6_t_1` is failing… +* [#17404](https://github.com/scipy/scipy/issues/17404): DOC: comparison of optimizers in optimization guide +* [#17494](https://github.com/scipy/scipy/issues/17494): MAINT: HiGHS build flag cleanup +* [#17571](https://github.com/scipy/scipy/issues/17571): ENH: Add units to scipy.constants description +* [#17905](https://github.com/scipy/scipy/issues/17905): ENH: Add softplus implementation +* [#18014](https://github.com/scipy/scipy/issues/18014): Potential use-after-free bug in `fcn_callback` (Static Analyzer… +* [#18250](https://github.com/scipy/scipy/issues/18250): BUG: `complex256` type created by entering `complex128` into… +* [#18295](https://github.com/scipy/scipy/issues/18295): BUG: special: Loss of precision in `logsumexp` +* [#18367](https://github.com/scipy/scipy/issues/18367): RFC: Get rid of linalg.interpolative Fortran code +* [#18409](https://github.com/scipy/scipy/issues/18409): ENH: extensions of `factorial{,2,k}` for complex domains, recurrences,… +* [#18445](https://github.com/scipy/scipy/issues/18445): ENH: add a callback feature to minimize\_scalar and root\_scalar +* [#18879](https://github.com/scipy/scipy/issues/18879): BUG: `integrate.quad_vec`: Fatal error when using `workers`… +* [#18880](https://github.com/scipy/scipy/issues/18880): TST: `test_expm_multiply_dtype` failure on aarch64 (flaky test) +* [#18882](https://github.com/scipy/scipy/issues/18882): BUG: minimize does not satisfy nonlinear constraint even if keep\_feasible=True +* [#18907](https://github.com/scipy/scipy/issues/18907): BUG: `presolve` option in `milp` causing feasible problem… +* [#18909](https://github.com/scipy/scipy/issues/18909): BUG: Cython3 linalg import order bug +* [#18945](https://github.com/scipy/scipy/issues/18945): BUG: circe-ci SVD-LOBPCG benchmarks do not check accuracy so… +* [#19042](https://github.com/scipy/scipy/issues/19042): DOC: sparse: BSR does not support slicing, `__getitem__` not… +* [#19071](https://github.com/scipy/scipy/issues/19071): BUG: scipy.special.gammasgn implementation & docs inconsistent… +* [#19207](https://github.com/scipy/scipy/issues/19207): BUG: sparse.linalg: `LinearOperator` dtype determination broken +* [#19223](https://github.com/scipy/scipy/issues/19223): BUG: io: scipy.io.loadmat error message recommend use of function… +* [#19355](https://github.com/scipy/scipy/issues/19355): MAINT: lobpcg: add unit tests for accuracy matching benchmark… +* [#19405](https://github.com/scipy/scipy/issues/19405): ENH: sparse.csr\_array: keep axis functionality in `getnnz()` +* [#19446](https://github.com/scipy/scipy/issues/19446): BUG: In test\_b\_orthonormalize, cannot parameterize Vdtype, Bdtype,… +* [#19524](https://github.com/scipy/scipy/issues/19524): BUG: deepcopy on stats.rvs breaks seed / random generation. +* [#19634](https://github.com/scipy/scipy/issues/19634): ENH: Dedicated Function for Envelope Extraction +* [#19759](https://github.com/scipy/scipy/issues/19759): BUG: Bad result for stats.randint.pmf (edge case) +* [#19791](https://github.com/scipy/scipy/issues/19791): DOC: linalg.schur: unclear signature for `sort` callable when… +* [#19907](https://github.com/scipy/scipy/issues/19907): DEP: extend deprecation of private namespaces also to fortran-generated… +* [#20026](https://github.com/scipy/scipy/issues/20026): ENH: ndimage: 1D rank filter speed up +* [#20048](https://github.com/scipy/scipy/issues/20048): BUG: `stats.rv_discrete.ppf`: infinite loop in default implementation +* [#20077](https://github.com/scipy/scipy/issues/20077): DEP: linalg: deprecate `kron` +* [#20155](https://github.com/scipy/scipy/issues/20155): DOC: `optimize.curve_fit`: Inconsistent naming convention… +* [#20196](https://github.com/scipy/scipy/issues/20196): MAINT: Audit usage of cython memoryviews, add `const` to allow… +* [#20207](https://github.com/scipy/scipy/issues/20207): ENH: sparse: Validate dtype on sparse array/matrix creation +* [#20239](https://github.com/scipy/scipy/issues/20239): DOC: Sparse arrays: todense() does not return numpy.matrix +* [#20240](https://github.com/scipy/scipy/issues/20240): ENH: multiple small improvements to scipy.stats.circmean +* [#20288](https://github.com/scipy/scipy/issues/20288): ENH: Poisson disk sampling for arbitrary bounds +* [#20370](https://github.com/scipy/scipy/issues/20370): DOC: ndimage.convolve: clarify origin parameter description +* [#20389](https://github.com/scipy/scipy/issues/20389): BUG: `sparse.hstack` does not respect `dtype` of `{indptr,indices}`… +* [#20452](https://github.com/scipy/scipy/issues/20452): BUG:linalg:interpolative: Crashing if k is requested too high… +* [#20552](https://github.com/scipy/scipy/issues/20552): DOC/DEV/MAINT: review distributing section of core-dev guide +* [#20574](https://github.com/scipy/scipy/issues/20574): MAINT, BENCH: would be good to be able to run benchmarks with… +* [#20602](https://github.com/scipy/scipy/issues/20602): MAINT/STY: fix UP031, UP032 linter errors +* [#20609](https://github.com/scipy/scipy/issues/20609): BUG:linalg:interpolative: Inputs are not mapped to compatible… +* [#20635](https://github.com/scipy/scipy/issues/20635): DOC: Titles of long function names in API Reference truncated… +* [#20638](https://github.com/scipy/scipy/issues/20638): DOC: Specify cut-off frequency in firwin as half-ampltude vs… +* [#20693](https://github.com/scipy/scipy/issues/20693): BUG: stats.noncentral\_t: incorrect pdf values +* [#20710](https://github.com/scipy/scipy/issues/20710): ENH: `special.rel_entr`: avoid premature overflow +* [#20728](https://github.com/scipy/scipy/issues/20728): BUG: sparse.linalg: Segfault in `arpack` with `ifx` +* [#20733](https://github.com/scipy/scipy/issues/20733): DOC: stats.mannwhitneyu: reversed options for `alternative`… +* [#20739](https://github.com/scipy/scipy/issues/20739): DOC/DEV: update commit message guidance +* [#20740](https://github.com/scipy/scipy/issues/20740): BLD/DEV: special: build warnings +* [#20761](https://github.com/scipy/scipy/issues/20761): ENH: stats.cauchy: improve cdf and quantile accuracy in tail +* [#20763](https://github.com/scipy/scipy/issues/20763): BUG: sparse.csgraph, array types: some functions should expect… +* [#20813](https://github.com/scipy/scipy/issues/20813): BUG: `optimize.nnls` sometimes fails when input `A` is a… +* [#20821](https://github.com/scipy/scipy/issues/20821): BUG: `stats.levy_stable.rvs`: “S0”-parameterization ignored +* [#20844](https://github.com/scipy/scipy/issues/20844): DOC: update testing docs for alternative backends +* [#20879](https://github.com/scipy/scipy/issues/20879): MAINT: clean up `sparse._sputils.getdtype` +* [#20893](https://github.com/scipy/scipy/issues/20893): DOC/DEV: Developer docs should mention Accelerate support +* [#20904](https://github.com/scipy/scipy/issues/20904): BUG: sparse.csgraph.dijkstra errors on inputs with int64 or no… +* [#20910](https://github.com/scipy/scipy/issues/20910): BUG: positional argument `DeprecationWarning` message is overly… +* [#20931](https://github.com/scipy/scipy/issues/20931): MAINT: Premature setting of attributes in `HBInfo` in `scipy.io._harwell_boei`… +* [#20957](https://github.com/scipy/scipy/issues/20957): TST, MAINT: array API GPU test failures +* [#20963](https://github.com/scipy/scipy/issues/20963): TST: `special.tests.test_support_alternative_backends`: failure… +* [#20984](https://github.com/scipy/scipy/issues/20984): BUG: scipy.optimize.nnls 1.11.4 version has better performance… +* [#20991](https://github.com/scipy/scipy/issues/20991): BUG: `special.pro_rad1` returns ‘nan’ for any combination of… +* [#20994](https://github.com/scipy/scipy/issues/20994): BUG: `spatial.distance.cosine` with `complex` arguments raises… +* [#21009](https://github.com/scipy/scipy/issues/21009): BUG: Floating point exception when passing the invalid argument… +* [#21010](https://github.com/scipy/scipy/issues/21010): BUG: Segmentation fault when passing invalid arguments to some… +* [#21011](https://github.com/scipy/scipy/issues/21011): BUG: Double free or corruption when passing invalid arguments… +* [#21016](https://github.com/scipy/scipy/issues/21016): BUG: Indexing broken for sparse arrays +* [#21030](https://github.com/scipy/scipy/issues/21030): DOC, DEV: release notes `gh_lists` touchups +* [#21044](https://github.com/scipy/scipy/issues/21044): RFC: quo vadis, `xp_assert_*` infrastructure? +* [#21045](https://github.com/scipy/scipy/issues/21045): BUG: `scipy/optimize/tests/test_hessian_update_strategy.py::TestHessianUpdateSt`… +* [#21057](https://github.com/scipy/scipy/issues/21057): BUG: loong64 architecture fails TestQuad.test\_complex +* [#21059](https://github.com/scipy/scipy/issues/21059): TST, MAINT: `TestHyp2f1.test_region5` tol issue with gcc 14.1.0 +* [#21078](https://github.com/scipy/scipy/issues/21078): BUG: linalg.expm: slower by a factor of ~4 in `scipy>1.13` +* [#21088](https://github.com/scipy/scipy/issues/21088): DOC: `optimize.InverseJacobian`: document or deprecate? +* [#21099](https://github.com/scipy/scipy/issues/21099): DOC: incorrect section ordering for classes +* [#21106](https://github.com/scipy/scipy/issues/21106): BUG: `stats.combine_pvalues` gives result with wrong dimensionality… +* [#21140](https://github.com/scipy/scipy/issues/21140): BUG: optimize.nnls: re-implementation not robust +* [#21144](https://github.com/scipy/scipy/issues/21144): BUG: sparse: Two new XSLOW test failures +* [#21145](https://github.com/scipy/scipy/issues/21145): BUG: dev.py build –debug doesn’t produce a debug build +* [#21148](https://github.com/scipy/scipy/issues/21148): BUG: scipy.optimize.root\_scalar pass in an array instead of float +* [#21152](https://github.com/scipy/scipy/issues/21152): BUG: `stats.bartlett`: returned statistic can be negative… +* [#21158](https://github.com/scipy/scipy/issues/21158): RFC: spatial: review calculation formula for Jaccard distance… +* [#21166](https://github.com/scipy/scipy/issues/21166): ENH: `linalg.null_space`: expose `lapack_driver` and `check_finite` +* [#21174](https://github.com/scipy/scipy/issues/21174): BUG: special tests failing on main when CuPy is installed with… +* [#21178](https://github.com/scipy/scipy/issues/21178): DOC: `optimize.root_scalar`: arguments incorrectly marked… +* [#21181](https://github.com/scipy/scipy/issues/21181): MAINT: spatial: weighted `chebyshev` distance revisited +* [#21187](https://github.com/scipy/scipy/issues/21187): BUG: spatial.distance: `kulczynski1` returns similarity rather… +* [#21192](https://github.com/scipy/scipy/issues/21192): BUG: `stats.differential_entropy`: incorrect results with… +* [#21193](https://github.com/scipy/scipy/issues/21193): BUG: optimize: Hessian update strategy fails on nested minimize… +* [#21208](https://github.com/scipy/scipy/issues/21208): RFC: Should mutable default arguments be forbidden by the linter? +* [#21212](https://github.com/scipy/scipy/issues/21212): DOC: doc build failing in CI +* [#21217](https://github.com/scipy/scipy/issues/21217): BUG: SciPy won’t pick the correct BLAS when running the test… +* [#21227](https://github.com/scipy/scipy/issues/21227): BUG: stats/fft/differentiate/optimize: test suite failures with… +* [#21239](https://github.com/scipy/scipy/issues/21239): ENH: Add a Python level lapack wrapper for DSYTRS +* [#21241](https://github.com/scipy/scipy/issues/21241): DOC: add sphinx-copybutton to the documentation +* [#21248](https://github.com/scipy/scipy/issues/21248): BUG: ValueError: `x0` violates bound constraints in minimize +* [#21256](https://github.com/scipy/scipy/issues/21256): BUG: io.loadmat: failure with large file due to address position… +* [#21266](https://github.com/scipy/scipy/issues/21266): DOC: CosineMixture function in go\_benchmark\_functions is wrong +* [#21275](https://github.com/scipy/scipy/issues/21275): CI: wheel builds for Python 3.13 are failing +* [#21286](https://github.com/scipy/scipy/issues/21286): BUG: Delaunay/qhull segfault on self-pass +* [#21292](https://github.com/scipy/scipy/issues/21292): TST: ndimage: GPU test failures +* [#21296](https://github.com/scipy/scipy/issues/21296): DOC: optimize.root: fix docs for `inner_\*` parameters +* [#21300](https://github.com/scipy/scipy/issues/21300): BUG: integrate.simpson: `x` param is keyword only +* [#21311](https://github.com/scipy/scipy/issues/21311): BUG: special.chdtr: torch failures +* [#21351](https://github.com/scipy/scipy/issues/21351): ENH: spatial: Rotation: add `split` to break apart object with… +* [#21357](https://github.com/scipy/scipy/issues/21357): DOC: signal.hilbert: Terminology issue +* [#21366](https://github.com/scipy/scipy/issues/21366): DOC: `stats.f_oneway`: use attributes instead of tuple unpacking… +* [#21369](https://github.com/scipy/scipy/issues/21369): BUG: stats.tukeylambda: `support(lam)` is incorrect when `lam`… +* [#21379](https://github.com/scipy/scipy/issues/21379): BUG: spatial: Voronoi diagram missing ridges +* [#21383](https://github.com/scipy/scipy/issues/21383): BUG: `stats.sobol_indices`: in-place modification of `func`… +* [#21394](https://github.com/scipy/scipy/issues/21394): DEV: jupytext notebooks break caching of doc builds +* [#21405](https://github.com/scipy/scipy/issues/21405): MAINT: a few potential minor cleanups +* [#21421](https://github.com/scipy/scipy/issues/21421): DOC/DEV: direct to building guide from quickstart guide +* [#21439](https://github.com/scipy/scipy/issues/21439): DOC/DEV: replace mambaforge with miniforge +* [#21447](https://github.com/scipy/scipy/issues/21447): DEV/MAINT: Allow unicode characters `±` and `∞` in source… +* [#21452](https://github.com/scipy/scipy/issues/21452): DOC: signal.firls: reference unavailable +* [#21453](https://github.com/scipy/scipy/issues/21453): ENH: Add support for Xi Correlation in scipy +* [#21460](https://github.com/scipy/scipy/issues/21460): MAINT, DOC: make dist pipefail issue +* [#21461](https://github.com/scipy/scipy/issues/21461): BUG: `special.pro_rad2`: incorrect results since translation… +* [#21486](https://github.com/scipy/scipy/issues/21486): MAINT: ndimage test failures with CuPy +* [#21504](https://github.com/scipy/scipy/issues/21504): DOC: add note about `args`/`kwargs` to description of callable… +* [#21507](https://github.com/scipy/scipy/issues/21507): BUG: fft.fft: real-valued array-api-strict inputs fail +* [#21510](https://github.com/scipy/scipy/issues/21510): DOC: signal.freqz: problem with `fs` +* [#21513](https://github.com/scipy/scipy/issues/21513): TST, MAINT: test\_differentiate torch GPU failures +* [#21519](https://github.com/scipy/scipy/issues/21519): BUG: optimize.minimize: `method='Powell'` gives array not scalar +* [#21534](https://github.com/scipy/scipy/issues/21534): TST, MAINT: `test_matrix_input` failing +* [#21556](https://github.com/scipy/scipy/issues/21556): DOC: Lack of table of contents in cluster +* [#21566](https://github.com/scipy/scipy/issues/21566): DOC: stats.pearsonr: error in notes of API reference +* [#21571](https://github.com/scipy/scipy/issues/21571): DOC: interpolate.interp1d: clarify status and alternatives +* [#21576](https://github.com/scipy/scipy/issues/21576): DOC: building: specify `.ps1` for windows example +* [#21582](https://github.com/scipy/scipy/issues/21582): BUG: Squeezed output from batched `scipy.linalg.det` +* [#21583](https://github.com/scipy/scipy/issues/21583): BUG: optimize: test failures in scikit-learn following LBFGS… +* [#21584](https://github.com/scipy/scipy/issues/21584): BUG: linalg.expm: nightly inaccurate for `complex64` +* [#21596](https://github.com/scipy/scipy/issues/21596): MAINT: Update constants to CODATA 2022 recommendation +* [#21610](https://github.com/scipy/scipy/issues/21610): BUG: special.logsumexp: imaginary component exceeds `(-pi, pi]` +* [#21615](https://github.com/scipy/scipy/issues/21615): BUG: Invalid treatment of ellipsis in indexing of sparse matrices +* [#21627](https://github.com/scipy/scipy/issues/21627): DOC: optimize.root: outdated naming of fprime in `method=’hybr’` +* [#21630](https://github.com/scipy/scipy/issues/21630): BUG: optimize.nnls: precision problems +* [#21641](https://github.com/scipy/scipy/issues/21641): BUG: io.mmwrite: auto-appending of `.mtx` extension +* [#21660](https://github.com/scipy/scipy/issues/21660): BLD, MAINT: linker warnings with newer AppleClang/ld +* [#21661](https://github.com/scipy/scipy/issues/21661): BUG: fft.fht: should set `u.imag[-1] = 0` only when `n` is… +* [#21670](https://github.com/scipy/scipy/issues/21670): BUG: ndimage: `_normalize_sequence` fails on 0d array +* [#21671](https://github.com/scipy/scipy/issues/21671): BUG: signal.ShortTimeFFT: inverse tranform error with multichannel… +* [#21675](https://github.com/scipy/scipy/issues/21675): BUG: Errors at compiling through pip for python 3.13 with option… +* [#21677](https://github.com/scipy/scipy/issues/21677): BLD: build warnings from quadpack +* [#21696](https://github.com/scipy/scipy/issues/21696): MAINT: lombscargle numerical backward-compat +* [#21704](https://github.com/scipy/scipy/issues/21704): DOC: stats.bootstrap: clarify meaning of `paired` argument +* [#21709](https://github.com/scipy/scipy/issues/21709): BUG: logsumexp returning incorrect results in Scipy 1.15.0.dev0 +* [#21724](https://github.com/scipy/scipy/issues/21724): MAINT: signal deprecation cleanups +* [#21733](https://github.com/scipy/scipy/issues/21733): BUG: cluster: incorrect type of default value of `dist` in… +* [#21738](https://github.com/scipy/scipy/issues/21738): BUG: “ERROR: Dependency “OpenBLAS” not found” in macOS tests… +* [#21745](https://github.com/scipy/scipy/issues/21745): TST, MAINT: array API GPU test fails in `test_cubature.py` +* [#21747](https://github.com/scipy/scipy/issues/21747): BUG: boolean indexing of sparse arrays broken on `main` +* [#21758](https://github.com/scipy/scipy/issues/21758): BENCH/DEV: Add `conda-build` to `environment.yml` +* [#21759](https://github.com/scipy/scipy/issues/21759): DEP: remove `special.btdtr` and `special.btdtri` +* [#21760](https://github.com/scipy/scipy/issues/21760): BUG: failure in `scipy/optimize/tests/test_minimize_constrained.py::test_gh1164`… +* [#21769](https://github.com/scipy/scipy/issues/21769): BENCH: Warnings from `linprog` +* [#21772](https://github.com/scipy/scipy/issues/21772): BUG: `optimize.curve_fit` with `nan_policy="omit"` fails… +* [#21775](https://github.com/scipy/scipy/issues/21775): BUG: sparse matrix-vector multiplication fails with flattened… +* [#21788](https://github.com/scipy/scipy/issues/21788): BUG: stats: `qmc.Sobol` raises `ValueError` in multi-threading +* [#21791](https://github.com/scipy/scipy/issues/21791): BUG: sparse: `setdiag` broken when not entire diagonal belongs… +* [#21807](https://github.com/scipy/scipy/issues/21807): BUG: signal: Confusing error when giving an invalid mode to `correlation_lags` +* [#21810](https://github.com/scipy/scipy/issues/21810): RFC: special: Behavior of `gamma` function and related functions… +* [#21814](https://github.com/scipy/scipy/issues/21814): TST: interpolate: tests on `griddata` are not parametrized +* [#21817](https://github.com/scipy/scipy/issues/21817): QUERY: `optimize.isotonic_regression`: cannot replicate results… +* [#21820](https://github.com/scipy/scipy/issues/21820): BUG: stats: New XSLOW failures in `test_fit.py::TestFit` +* [#21829](https://github.com/scipy/scipy/issues/21829): BLD: accelerate detection with GNU toolchain on ARM mac +* [#21830](https://github.com/scipy/scipy/issues/21830): BLD: threads.h with MacOS 14.x ARM + gcc 14.2.0 +* [#21833](https://github.com/scipy/scipy/issues/21833): SPEC 7 Transition Tracker +* [#21837](https://github.com/scipy/scipy/issues/21837): BUG: linalg.svd: Segmentation Fault, Integer overflow in LAPACK… +* [#21838](https://github.com/scipy/scipy/issues/21838): ENH: sparse: revisit default index dtype selection in sparray… +* [#21855](https://github.com/scipy/scipy/issues/21855): TST, MAINT: torch + GPU failures for test\_create\_diagonal +* [#21862](https://github.com/scipy/scipy/issues/21862): BUG: large number of fails with macOS 15.1 using Accelerate +* [#21885](https://github.com/scipy/scipy/issues/21885): BUG: `interpolate/tests/test_interpnd.py::TestLinearNDInterpolation::test_threa`… +* [#21900](https://github.com/scipy/scipy/issues/21900): BUG: stats: New XSLOW test failure in test\_sampling.py +* [#21908](https://github.com/scipy/scipy/issues/21908): BUG: integrate.trapezoid: broadcasting failure after #21524 +* [#21927](https://github.com/scipy/scipy/issues/21927): TST: failures in `test_riemann_zeta_complex` on windows in… +* [#21934](https://github.com/scipy/scipy/issues/21934): BUG: Intel oneAPI tests / py3.12, dev.py: `meson.build:1:0:`… +* [#21940](https://github.com/scipy/scipy/issues/21940): DOC, REL: 1.15.0 author mappings +* [#21946](https://github.com/scipy/scipy/issues/21946): BUG: several failing tests in `interpolate` on macOS15 +* [#21949](https://github.com/scipy/scipy/issues/21949): BUG: stats: XSLOW test failure in `scipy.stats.tests.test_fit::TestFit` +* [#21952](https://github.com/scipy/scipy/issues/21952): DOC: `stats.goodness_of_fit`: improve examples +* [#21957](https://github.com/scipy/scipy/issues/21957): CI: failure for “Oldest GCC …” Linux CI job (related to pre-release… +* [#21963](https://github.com/scipy/scipy/issues/21963): DOC: Deprecation warning in `sphinx` when used with Python… +* [#21988](https://github.com/scipy/scipy/issues/21988): refguide\_check currently failing +* [#22005](https://github.com/scipy/scipy/issues/22005): TST: `TestJacobian::test_attrs` tol bump? +* [#22022](https://github.com/scipy/scipy/issues/22022): TST: tolerance violation in `test_x0_working[tfqmr]` on windows +* [#22029](https://github.com/scipy/scipy/issues/22029): `Test_SVDS_LOBPCG.test_svd_rng_3` test failure in wheel build… +* [#22031](https://github.com/scipy/scipy/issues/22031): BUG: mypy failure in main +* [#22077](https://github.com/scipy/scipy/issues/22077): DOC, REL: a few release notes/process issues +* [#22094](https://github.com/scipy/scipy/issues/22094): API: unannounced breaking change: `scipy.integrate.AccuracyWarning`… +* [#22095](https://github.com/scipy/scipy/issues/22095): DOC: sparse: `sparse.eye_array` does not accept `tuple[int,`… +* [#22097](https://github.com/scipy/scipy/issues/22097): DEP: `interpolate.interpnd.GradientEstimationWarning` still… +* [#22112](https://github.com/scipy/scipy/issues/22112): BUG/DOC: sparse: ND COO unexpected behaviour 1.15.0rc1 +* [#22123](https://github.com/scipy/scipy/issues/22123): DOC: stats: random variable transition guide launches wrong notebook +* [#22128](https://github.com/scipy/scipy/issues/22128): BUG/DOC: it’s not clear how to use `differentiate.jacobian`… +* [#22137](https://github.com/scipy/scipy/issues/22137): BUG: `stats._distribution_infrastructure._Domain.symbols` class… +* [#22143](https://github.com/scipy/scipy/issues/22143): BUG: Fail to call `BSpline` after unpickling with `mmap_mode="r"` +* [#22146](https://github.com/scipy/scipy/issues/22146): BUG:`stats.ContinuousDistribution.llf`: should not be public +* [#22204](https://github.com/scipy/scipy/issues/22204): BUG: signal.ShortTimeFFT: `istft` with `mfft > len(win)`… + +## [Pull requests for 1.15.0](#id24)[#](#pull-requests-for-1-15-0 "Link to this heading") + +* [#11345](https://github.com/scipy/scipy/pull/11345): MAINT: constants: revise way ‘exact’ values are recomputed +* [#12071](https://github.com/scipy/scipy/pull/12071): ENH: linalg: update `_procrustes.py` to handle complex matrices… +* [#12824](https://github.com/scipy/scipy/pull/12824): ENH: `linalg.solve`: detect and exploit matrix structure +* [#15993](https://github.com/scipy/scipy/pull/15993): TST: sparse.linalg: Add iterative step test of solvers with LU… +* [#16088](https://github.com/scipy/scipy/pull/16088): DOC: signal: Make `_filter_design.py` plot labels consistent +* [#16090](https://github.com/scipy/scipy/pull/16090): ENH: vectorize companion matrix function +* [#16467](https://github.com/scipy/scipy/pull/16467): ENH: sparse: add nonzero functionality to `min, max, argmin,`… +* [#16877](https://github.com/scipy/scipy/pull/16877): MAINT: remove un-necessary all-true array. +* [#17318](https://github.com/scipy/scipy/pull/17318): ENH: signal: Add functionality of Complex Chirp waveform +* [#18605](https://github.com/scipy/scipy/pull/18605): ENH: special: add `softplus` +* [#18979](https://github.com/scipy/scipy/pull/18979): DOC: Add units to scipy.constants description +* [#19058](https://github.com/scipy/scipy/pull/19058): DOC:special/signal: Add examples for `berp_zeros` and `band_stop_obj` +* [#19145](https://github.com/scipy/scipy/pull/19145): ENH: stats: add Landau distribution +* [#19209](https://github.com/scipy/scipy/pull/19209): BUG: sparse.linalg: fix `LinearOperator` dtype determination +* [#19255](https://github.com/scipy/scipy/pull/19255): ENH: Use `highspy` in `linprog` +* [#19361](https://github.com/scipy/scipy/pull/19361): BENCH: sparse.linalg: check accuracy in SVD-LOBPCG benchmarks +* [#19475](https://github.com/scipy/scipy/pull/19475): ENH: stats.lmoment: add function to calculate sample L-moments +* [#19764](https://github.com/scipy/scipy/pull/19764): MAINT: stats: fix `axis_nan_policy` decorator non-broadcastable… +* [#19970](https://github.com/scipy/scipy/pull/19970): ENH: interpolate: replicate `splrep` and `splprep` in Python +* [#19988](https://github.com/scipy/scipy/pull/19988): MAINT: unify factorial implementations +* [#19989](https://github.com/scipy/scipy/pull/19989): MAINT: special: factorial clean-ups +* [#20040](https://github.com/scipy/scipy/pull/20040): DOC: optimize: add comparison of optimizers to guide +* [#20058](https://github.com/scipy/scipy/pull/20058): DOC:signal: Suggest remedies for slow speed in `resample` when… +* [#20097](https://github.com/scipy/scipy/pull/20097): ENH: signal: Compute envelope of a real- or complex-valued signal +* [#20194](https://github.com/scipy/scipy/pull/20194): BUG: linalg.cossin: fix for nonsymmetric cases +* [#20242](https://github.com/scipy/scipy/pull/20242): DOC: sparse: Correct `todense` documentation +* [#20303](https://github.com/scipy/scipy/pull/20303): DOC: stats: Convert sampling tutorial to MyST-md +* [#20408](https://github.com/scipy/scipy/pull/20408): DOC: ndimage.convolve: modify `origin` param description +* [#20496](https://github.com/scipy/scipy/pull/20496): DOC: stats: added `Raises` section to a few functions +* [#20514](https://github.com/scipy/scipy/pull/20514): TST/BUG: linalg.expm: empty array support +* [#20517](https://github.com/scipy/scipy/pull/20517): DOC: sparse.linalg: updated preconditioner doc for iterative… +* [#20519](https://github.com/scipy/scipy/pull/20519): MAINT: signal: further refactor spline filters +* [#20520](https://github.com/scipy/scipy/pull/20520): BUG: linalg.polar: empty array support +* [#20539](https://github.com/scipy/scipy/pull/20539): ENH: special: Overhaul of Legendre functions +* [#20543](https://github.com/scipy/scipy/pull/20543): ENH: ndimage: log(n) implementation for 1D rank filter +* [#20558](https://github.com/scipy/scipy/pull/20558): ENH: linalg: Cythonize `id_dist` FORTRAN code +* [#20589](https://github.com/scipy/scipy/pull/20589): TST: optimize.linprog/milp: add tests for various bug reports +* [#20671](https://github.com/scipy/scipy/pull/20671): ENH: interpolate: fix concurrency issues throughout +* [#20695](https://github.com/scipy/scipy/pull/20695): MAINT: special.ndtr: adjust implementation to more closely match… +* [#20701](https://github.com/scipy/scipy/pull/20701): TST/MAINT: special: test with CuPy, make some CUDA fixes +* [#20708](https://github.com/scipy/scipy/pull/20708): ENH: `differentiate.hessian`: use `jacobian` to compute… +* [#20713](https://github.com/scipy/scipy/pull/20713): ENH: optimize.HessianUpdateStrategy: add `__matmul__` +* [#20719](https://github.com/scipy/scipy/pull/20719): MAINT: sparse: fix `__init__` func sig to allow `maxprint`… +* [#20743](https://github.com/scipy/scipy/pull/20743): ENH: `stats._xp_mean`, an array API compatible `mean` with… +* [#20754](https://github.com/scipy/scipy/pull/20754): ENH: sparse: add dtype validation in `__init__` and `astype` +* [#20759](https://github.com/scipy/scipy/pull/20759): MAINT: sparse.linalg: adjust `norm`, `eigs`, and `lsqr`… +* [#20766](https://github.com/scipy/scipy/pull/20766): MAINT: stats: minor numerical improvements to circular statistics +* [#20767](https://github.com/scipy/scipy/pull/20767): ENH: stats.qmc: add bounds parameters to PoissonDisk +* [#20771](https://github.com/scipy/scipy/pull/20771): ENH: `stats.ttest_ind`: add array API support +* [#20773](https://github.com/scipy/scipy/pull/20773): BUG: sparse.csgraph, array types: support non-zero `fill_value`... +* [#20785](https://github.com/scipy/scipy/pull/20785): ENH: `stats.nct.pdf`: increase range in left tail using boost +* [#20793](https://github.com/scipy/scipy/pull/20793): ENH: stats: end-to-end array-API support for NHSTs with beta… +* [#20794](https://github.com/scipy/scipy/pull/20794): ENH: stats: add array API support for `directional_stats` +* [#20800](https://github.com/scipy/scipy/pull/20800): ENH: optimize.elementwise: vectorized scalar optimization and… +* [#20809](https://github.com/scipy/scipy/pull/20809): ENH: ndimage: extend ndimage filter axes support to correlate… +* [#20811](https://github.com/scipy/scipy/pull/20811): ENH: ndimage: extend filter axes support to remaining filters… +* [#20816](https://github.com/scipy/scipy/pull/20816): ENH: `special.rel_entr`: Avoid overflow before computing… +* [#20822](https://github.com/scipy/scipy/pull/20822): CI: Add Linux workflow to test on free-threaded Python builds +* [#20827](https://github.com/scipy/scipy/pull/20827): REL: set version to 1.15.0.dev0 +* [#20829](https://github.com/scipy/scipy/pull/20829): MAINT: special: fix typo in `four_gammas` used by `hyp2f1` +* [#20830](https://github.com/scipy/scipy/pull/20830): DOC: `optimize.differential_evolution`: change convergence… +* [#20833](https://github.com/scipy/scipy/pull/20833): BUG: interpolate: make BSpline.integrate always return an array +* [#20834](https://github.com/scipy/scipy/pull/20834): ENH: integrate.nsum: elementwise evaluation of finite or infinite… +* [#20837](https://github.com/scipy/scipy/pull/20837): MAINT: linalg: add `const` to Cython function signatures +* [#20843](https://github.com/scipy/scipy/pull/20843): DOC/DEV: add docs for enabling interactive examples +* [#20846](https://github.com/scipy/scipy/pull/20846): DOC: Wrap long titles in docs pages +* [#20849](https://github.com/scipy/scipy/pull/20849): DOC/DEV: mention `-b` option in contributor guide on testing +* [#20855](https://github.com/scipy/scipy/pull/20855): TST: add additional margin to `fail_slow`s +* [#20856](https://github.com/scipy/scipy/pull/20856): TYP: `_lib.doccer`: add type annotations +* [#20857](https://github.com/scipy/scipy/pull/20857): ENH: sparse: add axis parameter to `count_nonzero` method +* [#20859](https://github.com/scipy/scipy/pull/20859): DEP: signal: remove `cmplx_sort` +* [#20862](https://github.com/scipy/scipy/pull/20862): MAINT: special: Add kokkos `mdspan` +* [#20864](https://github.com/scipy/scipy/pull/20864): DEP: integrate: remove quadrature and romberg +* [#20865](https://github.com/scipy/scipy/pull/20865): DEP: signal: remove wavelet functions +* [#20866](https://github.com/scipy/scipy/pull/20866): DEP: stats: remove `rvs_ratio_uniforms` +* [#20867](https://github.com/scipy/scipy/pull/20867): DEP: `integrate.cumulative_trapezoid`: raise `ValueError`… +* [#20868](https://github.com/scipy/scipy/pull/20868): DEP: interpolate: deprecate complex dtypes in `{Akima1D, Pchip}Interpolator` +* [#20869](https://github.com/scipy/scipy/pull/20869): DEP: special.factorial: raise error for non-integer scalars and… +* [#20872](https://github.com/scipy/scipy/pull/20872): MAINT: interpolate: add `const` to Cython function signatures +* [#20873](https://github.com/scipy/scipy/pull/20873): MAINT: sparse: add `const` to Cython function signatures +* [#20874](https://github.com/scipy/scipy/pull/20874): MAINT: spatial: add `const` to Cython function signatures +* [#20875](https://github.com/scipy/scipy/pull/20875): BLD/DEV: special: Fix warning due to mixed initializers +* [#20876](https://github.com/scipy/scipy/pull/20876): DOC: use `intersphinx_registry` for easier intersphinx mapping… +* [#20882](https://github.com/scipy/scipy/pull/20882): CI: Add workflow to build and upload free-threaded wheels +* [#20883](https://github.com/scipy/scipy/pull/20883): ENH: stats: rewrite `ttest_rel` in terms of `ttest_1samp` +* [#20884](https://github.com/scipy/scipy/pull/20884): ENH: stats: end-to-end array-API support for NHSTs with Student’s… +* [#20885](https://github.com/scipy/scipy/pull/20885): BUG: fix incorrect intersphinx-registry entry in environment.yml +* [#20886](https://github.com/scipy/scipy/pull/20886): CI/DEV: fix Node.js 16 warnings by bumping actions +* [#20887](https://github.com/scipy/scipy/pull/20887): MAINT: signal: add `const` to Cython function signatures +* [#20889](https://github.com/scipy/scipy/pull/20889): MAINT: sparse: Align matmul tests in `test_base.py` for spmatrix… +* [#20891](https://github.com/scipy/scipy/pull/20891): MAINT: stats: add `const` to Cython function signatures +* [#20895](https://github.com/scipy/scipy/pull/20895): TST: sparse: Finish allowing `test_base.py` to easily switch… +* [#20897](https://github.com/scipy/scipy/pull/20897): DOC: Fix bug with parallel doc build +* [#20898](https://github.com/scipy/scipy/pull/20898): MAINT: sparse: clean up `_sputils.getdtype` docstring +* [#20900](https://github.com/scipy/scipy/pull/20900): ENH: stats: add array API support to combine\_pvalues +* [#20906](https://github.com/scipy/scipy/pull/20906): DOC: linalg.schur: update doc for the argument `sort` +* [#20907](https://github.com/scipy/scipy/pull/20907): CI: Make sure nightly free-threaded wheels are tested with GIL… +* [#20908](https://github.com/scipy/scipy/pull/20908): DOC: signal.dbode: improve docstring +* [#20912](https://github.com/scipy/scipy/pull/20912): DOC: Add more information about how to use Accelerate +* [#20913](https://github.com/scipy/scipy/pull/20913): BUG: sparse.csgraph.dijkstra: fix dtype and shape bugs +* [#20915](https://github.com/scipy/scipy/pull/20915): DOC: `integrate.quad_vec`: Add example when using `workers` +* [#20916](https://github.com/scipy/scipy/pull/20916): DOC: Mention that `sparse.bsr_array` does not support slicing. +* [#20922](https://github.com/scipy/scipy/pull/20922): BUG: stats.mstats: fix `mstats.{ttest_rel, ttest_1samp}` when… +* [#20924](https://github.com/scipy/scipy/pull/20924): BUG: `_lib`: ensure reasonable length `_deprecate_positional_args`… +* [#20926](https://github.com/scipy/scipy/pull/20926): DOC: sparse: Add migration guide for converting code from spmatrix… +* [#20928](https://github.com/scipy/scipy/pull/20928): ENH: `optimize._differentiate`: add array API support +* [#20932](https://github.com/scipy/scipy/pull/20932): MAINT: io: fix premature setting of attributes in `HBInfo` +* [#20934](https://github.com/scipy/scipy/pull/20934): TST: `stats.combine_pvalues`: parameterise tests and update… +* [#20941](https://github.com/scipy/scipy/pull/20941): DOC/MAINT: single to double backticks to remove improper linking +* [#20942](https://github.com/scipy/scipy/pull/20942): CI: Use Cython nightly wheel on free-threaded CI +* [#20944](https://github.com/scipy/scipy/pull/20944): DOC: update distributing section +* [#20946](https://github.com/scipy/scipy/pull/20946): ENH: stats.gmean: add array API support +* [#20951](https://github.com/scipy/scipy/pull/20951): CI: Add MacOS to free-threaded wheel release CI +* [#20954](https://github.com/scipy/scipy/pull/20954): MAINT: stats.hmean/pmean: simplify prior to array API conversion +* [#20955](https://github.com/scipy/scipy/pull/20955): DOC: Single to double backticks for non-targets +* [#20962](https://github.com/scipy/scipy/pull/20962): DOC/MAINT: stats.gmean/gstd/hmean/pmean: document/treat invalid… +* [#20965](https://github.com/scipy/scipy/pull/20965): ENH: `stats.tmean`: add array API support +* [#20968](https://github.com/scipy/scipy/pull/20968): MAINT: fix some misspellings +* [#20969](https://github.com/scipy/scipy/pull/20969): DOC: linalg: add # may vary to a linalg.schur example +* [#20971](https://github.com/scipy/scipy/pull/20971): TST: special: use `standard_normal` to generate arguments in… +* [#20974](https://github.com/scipy/scipy/pull/20974): ENH: `stats.combine_pvalues`: add native axis support +* [#20975](https://github.com/scipy/scipy/pull/20975): DOC: single to double backticks +* [#20976](https://github.com/scipy/scipy/pull/20976): BUG: Update scipy-optimise directive in view of new default role +* [#20977](https://github.com/scipy/scipy/pull/20977): DOC: More single to double backtick +* [#20980](https://github.com/scipy/scipy/pull/20980): CI, MAINT: `test_plot_iv` NumPy 2 shim +* [#20985](https://github.com/scipy/scipy/pull/20985): BLD: Add build only CI workflow for Windows using MSVC + ifx… +* [#20986](https://github.com/scipy/scipy/pull/20986): DEV: `gh_lists`: single -> double backticks +* [#20987](https://github.com/scipy/scipy/pull/20987): DOC/DEV: update commit message guidance +* [#20989](https://github.com/scipy/scipy/pull/20989): ENH: `stats.chi2_contingency`: add `method` parameter +* [#20995](https://github.com/scipy/scipy/pull/20995): CI: test cp313-dev +* [#20998](https://github.com/scipy/scipy/pull/20998): MAINT: signal: fix code comment typo +* [#21003](https://github.com/scipy/scipy/pull/21003): MAINT: odr: fix a refcounting issue in `__odrpack.c` +* [#21004](https://github.com/scipy/scipy/pull/21004): DOC: stats: Convert `chisquare` example to notebook +* [#21005](https://github.com/scipy/scipy/pull/21005): CI: one invocation for all tests in array API job +* [#21017](https://github.com/scipy/scipy/pull/21017): MAINT: smoke-docs: add `special/_precompute` to –ignore list,… +* [#21018](https://github.com/scipy/scipy/pull/21018): MAINT: sparse: better error message on `matmul` mismatch +* [#21021](https://github.com/scipy/scipy/pull/21021): ENH:MAINT:optimize: Re-rewrite nnls in Cython +* [#21022](https://github.com/scipy/scipy/pull/21022): BUG: sparse: Fix advanced indexing using both slice and array +* [#21023](https://github.com/scipy/scipy/pull/21023): DEV: lint: enforce newlines at end of files +* [#21025](https://github.com/scipy/scipy/pull/21025): API: signal: rename `sosfreqz` to `freqz_sos` +* [#21028](https://github.com/scipy/scipy/pull/21028): ENH: stats.tmin/tmax: add array API support +* [#21029](https://github.com/scipy/scipy/pull/21029): MAINT/STY: Fix UP031 AND UP032 linter errors +* [#21032](https://github.com/scipy/scipy/pull/21032): DOC/DEV: update vendored-code page +* [#21033](https://github.com/scipy/scipy/pull/21033): DOC: interpolate: discuss linear interpolation with extrapolation +* [#21034](https://github.com/scipy/scipy/pull/21034): ENH: `stats.xp_var`: array-API compatible variance with `scipy.stats`… +* [#21035](https://github.com/scipy/scipy/pull/21035): ENH: stats.hmean/pmean: add array API support +* [#21036](https://github.com/scipy/scipy/pull/21036): ENH: stats.tvar/tstd/tsem: add array API support +* [#21037](https://github.com/scipy/scipy/pull/21037): MAINT: forward port 1.14.0 relnotes +* [#21041](https://github.com/scipy/scipy/pull/21041): ENH: `differentiate`: add sub-package for array-API compatible… +* [#21042](https://github.com/scipy/scipy/pull/21042): DOC: stats: Move biomedical examples to notebooks +* [#21047](https://github.com/scipy/scipy/pull/21047): TST: optimize: fix exception test on PyPy3.10 +* [#21050](https://github.com/scipy/scipy/pull/21050): ENH: `stats.Normal`: add new continuous distribution infrastructure… +* [#21051](https://github.com/scipy/scipy/pull/21051): BUG: interpolate.LinearNDInterpolator: fix for precomputed triangulation +* [#21063](https://github.com/scipy/scipy/pull/21063): MAINT: gcc-14 `test_region5` tol bump +* [#21068](https://github.com/scipy/scipy/pull/21068): ENH: `stats.zmap`/`zscore`/`gzscore`: add array API… +* [#21076](https://github.com/scipy/scipy/pull/21076): ENH: `stats.differential_entropy`: add array API support +* [#21081](https://github.com/scipy/scipy/pull/21081): DOC: Add default options for COBYQA +* [#21083](https://github.com/scipy/scipy/pull/21083): MAINT: simplify `_integrate_pdf` +* [#21085](https://github.com/scipy/scipy/pull/21085): DEP: spatial: deprecate complex input to `cosine` and `correlation` +* [#21086](https://github.com/scipy/scipy/pull/21086): DOC: spatial: Fix typo in `seuclidean` docstring +* [#21087](https://github.com/scipy/scipy/pull/21087): DOC: optimize: remove inadvertent block quote indentation +* [#21089](https://github.com/scipy/scipy/pull/21089): ENH: `stats.alexandergovern`: vectorize calculation for n-D… +* [#21094](https://github.com/scipy/scipy/pull/21094): DOC: sparse.linalg.gcrotmk: fix backticks and add `maxiter`… +* [#21096](https://github.com/scipy/scipy/pull/21096): DOC: sparse.linalg.gcrotmk: add missing backticks +* [#21097](https://github.com/scipy/scipy/pull/21097): ENH: `stats.boxcox_llf`: add array API support +* [#21098](https://github.com/scipy/scipy/pull/21098): DEV: don’t add `sparse` label for submodules +* [#21101](https://github.com/scipy/scipy/pull/21101): DOC: special.ellipj: fix order of parameters in docstring +* [#21103](https://github.com/scipy/scipy/pull/21103): MAINT: itemsize pybind cleanup +* [#21109](https://github.com/scipy/scipy/pull/21109): MAINT: `stats.combine_pvalues`: fix native `axis` support… +* [#21110](https://github.com/scipy/scipy/pull/21110): ENH:sparse.linalg: Update vendored ARPACK version to 3.9.1 +* [#21111](https://github.com/scipy/scipy/pull/21111): BUG: `ndimage.binary_erosion`: avoid divide by zero by capping… +* [#21112](https://github.com/scipy/scipy/pull/21112): DOC: `optimize.differential_evolution`: fix interval for… +* [#21113](https://github.com/scipy/scipy/pull/21113): MAINT, DOC: simplify docs warn filter +* [#21115](https://github.com/scipy/scipy/pull/21115): BENCH: Corrections to benchmarks README and `sparse.Arithmetic`… +* [#21116](https://github.com/scipy/scipy/pull/21116): BUG: `optimize.root_scalar`: let bracket be passed as a NumPy… +* [#21117](https://github.com/scipy/scipy/pull/21117): TST: interpolate: use `xp_assert` infrastructure +* [#21118](https://github.com/scipy/scipy/pull/21118): DOC: optimize: Add docstring to `InverseJacobian` +* [#21119](https://github.com/scipy/scipy/pull/21119): MAINT: remove another mpl test shim +* [#21120](https://github.com/scipy/scipy/pull/21120): BUG: cluster: Avoid OOB write when distances are NaN in `centroid` +* [#21121](https://github.com/scipy/scipy/pull/21121): BUG: cluster: Fix `fcluster` `"maxclust"` binary search logic +* [#21123](https://github.com/scipy/scipy/pull/21123): DEV/CI: add `gmpy2` back to test dependencies +* [#21124](https://github.com/scipy/scipy/pull/21124): MAINT: use `xp_vector_norm` instead of `xp.linalg.vector_norm` +* [#21125](https://github.com/scipy/scipy/pull/21125): MAINT: remove unused minpack2 fortran code +* [#21127](https://github.com/scipy/scipy/pull/21127): TST: fix `boxcox_llf` test skips +* [#21128](https://github.com/scipy/scipy/pull/21128): TST: special.logsumexp: modernise tests +* [#21129](https://github.com/scipy/scipy/pull/21129): TST: sparse.linalg: test all dtypes for `lobpcg` B-orthonormalization +* [#21131](https://github.com/scipy/scipy/pull/21131): ENH:optimize: Rewrite MINPACK in C +* [#21132](https://github.com/scipy/scipy/pull/21132): TST: sparse.linalg: simplify dtypes def in `test_expm_multiply.py` +* [#21133](https://github.com/scipy/scipy/pull/21133): TST: sparse.csgraph: simplify dtypes def in `test_graph_laplacian.py` +* [#21141](https://github.com/scipy/scipy/pull/21141): DOC: Remove outdated comment about macos/musl in Cirrus CI config +* [#21143](https://github.com/scipy/scipy/pull/21143): MAINT: signal: Don’t redefine `PyArray_MIN` macro +* [#21146](https://github.com/scipy/scipy/pull/21146): MAINT: sparse.linalg: `spsolve` simplification +* [#21149](https://github.com/scipy/scipy/pull/21149): ENH: special.logsumexp: add array API standard support +* [#21150](https://github.com/scipy/scipy/pull/21150): ENH: ndimage: add array API standard support +* [#21151](https://github.com/scipy/scipy/pull/21151): DOC: interpolate: fix `py:obj reference target not found` warning +* [#21154](https://github.com/scipy/scipy/pull/21154): DOC: fix documentation about verbose in minimize\_trustregion\_constr.py +* [#21157](https://github.com/scipy/scipy/pull/21157): DEP: `stats.find_repeats`: deprecate function +* [#21162](https://github.com/scipy/scipy/pull/21162): MAINT: `optimize.root_scalar`: ensure user function gets… +* [#21163](https://github.com/scipy/scipy/pull/21163): MAINT: special: Make fixes needed for ellipkinc and ellipeinc… +* [#21167](https://github.com/scipy/scipy/pull/21167): ENH: interpolate: add AAA algorithm for rational approximation +* [#21168](https://github.com/scipy/scipy/pull/21168): BLD: remove optional test dependencies from cibuildwheel config +* [#21171](https://github.com/scipy/scipy/pull/21171): DEV: fix `--debug` and add `--release` to `dev.py build` +* [#21173](https://github.com/scipy/scipy/pull/21173): BUG/CI: Compile and run tests with `ifx` + `MKL` on Linux +* [#21176](https://github.com/scipy/scipy/pull/21176): MAINT: spatial.distance.jaccard: correct numerator calculation +* [#21179](https://github.com/scipy/scipy/pull/21179): BUG: special: `cupy` import guard +* [#21182](https://github.com/scipy/scipy/pull/21182): MAINT: spatial: improve weighted Chebyshev distance doc and zero… +* [#21185](https://github.com/scipy/scipy/pull/21185): DOC: optimize: Mark `x1` as optional for secant root finding +* [#21186](https://github.com/scipy/scipy/pull/21186): DOC: `array`->``array\_like`` in a few functions +* [#21194](https://github.com/scipy/scipy/pull/21194): MAINT: `stats.differential_entropy`: fix results with integer… +* [#21196](https://github.com/scipy/scipy/pull/21196): DEV: add label glob for `scipy.differentiate` +* [#21197](https://github.com/scipy/scipy/pull/21197): ENH: sparse: extend COO arrays to n-dimensions +* [#21199](https://github.com/scipy/scipy/pull/21199): MAINT: bump pybind11, mark C/C++/Cython extension modules as… +* [#21201](https://github.com/scipy/scipy/pull/21201): ENH:integrate: Rewrite QUADPACK in C +* [#21203](https://github.com/scipy/scipy/pull/21203): BUG: optimize: Avoid sharing BFGS HessianUpdateStrategy between… +* [#21204](https://github.com/scipy/scipy/pull/21204): MAINT: ensure Python.h is included first in \_\_minpack.c +* [#21210](https://github.com/scipy/scipy/pull/21210): MAINT: special: Make sine and cosine integrals work in CUDA +* [#21211](https://github.com/scipy/scipy/pull/21211): DEP: signal.{correlate,convolve,lfilter}: deprecate object arrays… +* [#21213](https://github.com/scipy/scipy/pull/21213): MAINT, DOC: bump jupyterlite-sphinx lower bound +* [#21215](https://github.com/scipy/scipy/pull/21215): MAINT: `_lib`: update `_docscrape` from upstream +* [#21216](https://github.com/scipy/scipy/pull/21216): ENH: `integrate._tanhsinh`: add array API support +* [#21220](https://github.com/scipy/scipy/pull/21220): TST: sparse.linalg.lobpcg: add unit tests for accuracy +* [#21221](https://github.com/scipy/scipy/pull/21221): BENCH: sparse.linalg: check accuracy properly in LOBPCG benchmarks +* [#21222](https://github.com/scipy/scipy/pull/21222): BUG: special: `cython_special` missing dep +* [#21223](https://github.com/scipy/scipy/pull/21223): MAINT: interpolate: remove several fused type uses from `_bspl.pyx` +* [#21225](https://github.com/scipy/scipy/pull/21225): MAINT: io: move `_test_fortran` under `tests` +* [#21230](https://github.com/scipy/scipy/pull/21230): ENH: `differentiate`: support array `initial_step` +* [#21231](https://github.com/scipy/scipy/pull/21231): ENH: `optimize.elementwise.find_minimum`: add array API support +* [#21235](https://github.com/scipy/scipy/pull/21235): MAINT: interpolate: remove `README` +* [#21240](https://github.com/scipy/scipy/pull/21240): ENH: sparse: refactor 2-D COO sparse-dense matrix-matrix multiplication +* [#21242](https://github.com/scipy/scipy/pull/21242): BUG: sparse: fix two slow tests that fail in numpy 2 inside A.nnz +* [#21243](https://github.com/scipy/scipy/pull/21243): BENCH: fix `--compare` in `python dev.py bench` +* [#21245](https://github.com/scipy/scipy/pull/21245): DOC: add sphinx-copybutton +* [#21247](https://github.com/scipy/scipy/pull/21247): ENH: linalg.nullspace: expose SVD options +* [#21252](https://github.com/scipy/scipy/pull/21252): DOC: `integrate.solve_bvp`: make notation consistent +* [#21254](https://github.com/scipy/scipy/pull/21254): CI: Test icx + icpx + ifx + MKL build of SciPy +* [#21257](https://github.com/scipy/scipy/pull/21257): MAINT: BUG: fixed issue where optimization method trust-constr… +* [#21259](https://github.com/scipy/scipy/pull/21259): BUG: interpolate: avoid OOB in the periodic spline constructor +* [#21260](https://github.com/scipy/scipy/pull/21260): BUG: io.loadmat: fix read of large Matlab 4 arrays +* [#21264](https://github.com/scipy/scipy/pull/21264): MAINT: utilise `array_api_compat` v1.8 +* [#21265](https://github.com/scipy/scipy/pull/21265): BUG: fix cstddef include +* [#21267](https://github.com/scipy/scipy/pull/21267): DOC: add Stack Overflow link to readme file +* [#21268](https://github.com/scipy/scipy/pull/21268): MAINT/BENCH: optimize: fix `CosineMixture` reference +* [#21276](https://github.com/scipy/scipy/pull/21276): MAINT: Fix incorrectly named 1234 Hz fs .wav test file +* [#21277](https://github.com/scipy/scipy/pull/21277): ENH: signal.lombscargle: update to the generalized Lomb-Scargle… +* [#21278](https://github.com/scipy/scipy/pull/21278): BLD: bump cibuildwheel closes #21275 +* [#21281](https://github.com/scipy/scipy/pull/21281): MAINT: `test_maxiter_worsening` cleanup +* [#21282](https://github.com/scipy/scipy/pull/21282): TST: ndimage: unskip `test_boundary_spline_accuracy` for `torch` +* [#21284](https://github.com/scipy/scipy/pull/21284): MAINT: Remove mutable defaults in function definitions, forbid… +* [#21290](https://github.com/scipy/scipy/pull/21290): MAINT: linalg: run `dos2unix` on `cython_lapack_signatures.txt` +* [#21294](https://github.com/scipy/scipy/pull/21294): TST: fix GPU failures +* [#21295](https://github.com/scipy/scipy/pull/21295): DOC: `find_simplex` no self +* [#21297](https://github.com/scipy/scipy/pull/21297): MAINT: special: rename C++ library to `xsf` +* [#21299](https://github.com/scipy/scipy/pull/21299): DEV: `gh_lists`: improve sanitization of backticks +* [#21301](https://github.com/scipy/scipy/pull/21301): ENH: stats: Implement `_logcdf` and `_logsf` for `rv_continuous` +* [#21304](https://github.com/scipy/scipy/pull/21304): TST: Fix bugs in various tests found via linter +* [#21309](https://github.com/scipy/scipy/pull/21309): MAINT:integrate: Fix an off-by-one error in QUADPACK +* [#21310](https://github.com/scipy/scipy/pull/21310): MAINT/DOC: clean up `_lib._array_api`, update docs +* [#21312](https://github.com/scipy/scipy/pull/21312): MAINT: special: fix Pylance typing nit +* [#21313](https://github.com/scipy/scipy/pull/21313): BUG: find\_simplex shape () segfault +* [#21314](https://github.com/scipy/scipy/pull/21314): ENH: optimize: Rewrite LBFGSB in C +* [#21316](https://github.com/scipy/scipy/pull/21316): MAINT: special.chdtr: fix generic chdtr +* [#21318](https://github.com/scipy/scipy/pull/21318): BUG: special: Fix bug in beta ppf by setting correct Boost policy +* [#21321](https://github.com/scipy/scipy/pull/21321): BUG: linalg: fix `solve_banded` raising `IndexError` when… +* [#21322](https://github.com/scipy/scipy/pull/21322): BUG: stats: Allow `betaprime._ppf` to accept scalars. +* [#21326](https://github.com/scipy/scipy/pull/21326): MAINT: stats: Improve precision of argus.sf. +* [#21328](https://github.com/scipy/scipy/pull/21328): ENH: linalg: add Python wrapper of `?gtcon` +* [#21329](https://github.com/scipy/scipy/pull/21329): MAINT: interpolate.AAA: improve input validation of `max_terms` +* [#21330](https://github.com/scipy/scipy/pull/21330): ENH: integrate: multidimensional integration of array-valued… +* [#21331](https://github.com/scipy/scipy/pull/21331): ENH: linalg: add Python wrapper of ?trcon +* [#21332](https://github.com/scipy/scipy/pull/21332): BUG: `stats.levy_stable`: fix ignored parameterization +* [#21333](https://github.com/scipy/scipy/pull/21333): DOC:integrate.simpson: Remove reference to removed `even` param +* [#21334](https://github.com/scipy/scipy/pull/21334): TST: add `xfail_xp_backends` +* [#21335](https://github.com/scipy/scipy/pull/21335): BUG/ENH: stats: updates for cauchy. +* [#21336](https://github.com/scipy/scipy/pull/21336): ENH: linalg: Add `sy/hetrs` LAPACK wrappers +* [#21339](https://github.com/scipy/scipy/pull/21339): ENH: `stats.poisson_binom`: add Poisson Binomial distribution +* [#21342](https://github.com/scipy/scipy/pull/21342): MAINT: stats: fix test that discrete distribution methods accept… +* [#21344](https://github.com/scipy/scipy/pull/21344): BLD: require Meson 1.5.0, fix a missing build dependency for… +* [#21346](https://github.com/scipy/scipy/pull/21346): TST: special: Fix two XSLOW tests. +* [#21347](https://github.com/scipy/scipy/pull/21347): BUG/ENH: stats: Cauchy distribution fixes +* [#21349](https://github.com/scipy/scipy/pull/21349): TST: linalg: skip `svd_gesdd` test for large matrices for/in… +* [#21352](https://github.com/scipy/scipy/pull/21352): ENH: `linalg.lapack.?lantr`: add Python wrapper +* [#21353](https://github.com/scipy/scipy/pull/21353): MAINT: `stats.randint.pmf`: fix zero PMF values within the… +* [#21354](https://github.com/scipy/scipy/pull/21354): MAINT: `stats.rv_discrete.ppf`: fix infinite loop bug +* [#21355](https://github.com/scipy/scipy/pull/21355): MAINT: `stats.geom.rvs`: ensure that output is not negative… +* [#21360](https://github.com/scipy/scipy/pull/21360): BLD: use OpenBLAS v0.3.28 with fewer kernels, fix OpenBLAS licences +* [#21361](https://github.com/scipy/scipy/pull/21361): BLD: switch to more robust git hash determination +* [#21363](https://github.com/scipy/scipy/pull/21363): ENH: linalg.solve: use structure to speed up finite check, apply… +* [#21365](https://github.com/scipy/scipy/pull/21365): BUG: interpolate: FITPACK: remove `fpchec.f` in-line `if-then-endif`… +* [#21367](https://github.com/scipy/scipy/pull/21367): MAINT: `stats.mannwhitneyu`: simplify alternative hypotheses +* [#21368](https://github.com/scipy/scipy/pull/21368): DOC: fixes ISSUE#21366 +* [#21371](https://github.com/scipy/scipy/pull/21371): BUG: stats.tukeylambda: Fix the support() method. +* [#21373](https://github.com/scipy/scipy/pull/21373): ENH: interpolate.AAA: add cleanup function for removing spurious… +* [#21375](https://github.com/scipy/scipy/pull/21375): MAINT: Add local resources for smoke-tutorials +* [#21377](https://github.com/scipy/scipy/pull/21377): BENCH: Update BlockDiagSparseConstruction to use a `coo_matrix`… +* [#21378](https://github.com/scipy/scipy/pull/21378): DOC: signal.hilbert: update to reflect implementation +* [#21387](https://github.com/scipy/scipy/pull/21387): DOC: signal: fix typos in `_short_time_fft.py` and `signal.rst` +* [#21388](https://github.com/scipy/scipy/pull/21388): ENH: special: Improve precision of special.logit. +* [#21389](https://github.com/scipy/scipy/pull/21389): ENH: `scipy.stats`: add normal-inverse-gamma distribution +* [#21395](https://github.com/scipy/scipy/pull/21395): DOC: stats.ecdf: fix example plot +* [#21397](https://github.com/scipy/scipy/pull/21397): DOC/DEV: add `pooch` to virtualenv dev quickstart guide +* [#21399](https://github.com/scipy/scipy/pull/21399): MAINT: optimize: remove unnecessary `isnan` check +* [#21407](https://github.com/scipy/scipy/pull/21407): BUG: optimize.minimize: set `trust-constr` `success=False`… +* [#21412](https://github.com/scipy/scipy/pull/21412): ENH: sparse: add CSR/CSC `_broadcast_to` method +* [#21413](https://github.com/scipy/scipy/pull/21413): MAINT: cleaner 0-D/scalar checks for `xp` assertions, round… +* [#21419](https://github.com/scipy/scipy/pull/21419): ENH: `linalg.circulant`: allow batching +* [#21423](https://github.com/scipy/scipy/pull/21423): MAINT: `linalg.logm`: avoid `ZeroDivisionError`, emit… +* [#21425](https://github.com/scipy/scipy/pull/21425): DOC: linalg.qr: add example about explicit permutation matrix +* [#21427](https://github.com/scipy/scipy/pull/21427): DOC: linalg.cholesky: document when/whether only selected half… +* [#21428](https://github.com/scipy/scipy/pull/21428): DOC: linalg.hankel: emphasize that first element of `r` is… +* [#21429](https://github.com/scipy/scipy/pull/21429): MAINT: `linalg.schur`: fix `sort='iuc'/'ouc'`, correct… +* [#21430](https://github.com/scipy/scipy/pull/21430): MAINT: forward port 1.14.1 relnotes +* [#21433](https://github.com/scipy/scipy/pull/21433): DOC: Cache jupyter notebooks build +* [#21435](https://github.com/scipy/scipy/pull/21435): ENH: sparse: Add nD COO support for matmul, dot and tensordot +* [#21437](https://github.com/scipy/scipy/pull/21437): TST/DOC: smoke docs: strict checks +* [#21440](https://github.com/scipy/scipy/pull/21440): ENH: linalg.funm: Pythranize double for loop +* [#21441](https://github.com/scipy/scipy/pull/21441): DOC: special: prolate spheroidal docs wrong +* [#21443](https://github.com/scipy/scipy/pull/21443): DOC/DEV/CI: mambaforge -> miniforge +* [#21444](https://github.com/scipy/scipy/pull/21444): DOC: optimize: make `lsq_linear` example smaller +* [#21446](https://github.com/scipy/scipy/pull/21446): ENH: linalg: enable N-D batch support in special matrix functions +* [#21449](https://github.com/scipy/scipy/pull/21449): DEV/MAINT: Add `±` and `∞` to the extra set of allowed Unicode… +* [#21450](https://github.com/scipy/scipy/pull/21450): Use miniforge for uploading wheel builds +* [#21451](https://github.com/scipy/scipy/pull/21451): DOC: interpolate: add missing call to example code +* [#21454](https://github.com/scipy/scipy/pull/21454): ENH: special: Add root finding tools to xsf and implement gdtrib… +* [#21455](https://github.com/scipy/scipy/pull/21455): TYP: ignore missing sphinx import in mypy.ini +* [#21457](https://github.com/scipy/scipy/pull/21457): MAINT: few scipy cleanups +* [#21458](https://github.com/scipy/scipy/pull/21458): DOC: signal.firls: fix broken link +* [#21464](https://github.com/scipy/scipy/pull/21464): CI: remove `fetch-depth: 0` from wheel build jobs +* [#21467](https://github.com/scipy/scipy/pull/21467): STY: fix new lint rules that are popping up in CI +* [#21468](https://github.com/scipy/scipy/pull/21468): MAINT: special: remove more functions from `functions.json` +* [#21469](https://github.com/scipy/scipy/pull/21469): DOC/MAINT: add references to Boost +* [#21471](https://github.com/scipy/scipy/pull/21471): BUG: sparse: undesired behaviour of 1D/2D matmul +* [#21472](https://github.com/scipy/scipy/pull/21472): MAINT: special: refactor `ufunc.h` and move to `xsf` +* [#21473](https://github.com/scipy/scipy/pull/21473): ENH: integrate.cubature: array API standard support +* [#21474](https://github.com/scipy/scipy/pull/21474): DOC: use `https` URLs in pull request template +* [#21477](https://github.com/scipy/scipy/pull/21477): DOC: update Contributor Quickstart guide to refer to the Building… +* [#21478](https://github.com/scipy/scipy/pull/21478): DOC: Fix version matching by extending the length of `GITVER` +* [#21481](https://github.com/scipy/scipy/pull/21481): MAINT/DEV: pin sphinx in `environment.yml`, bump `jupyterlite-sphinx` +* [#21483](https://github.com/scipy/scipy/pull/21483): ENH: special: computing derivatives by simple autodifferentiation +* [#21485](https://github.com/scipy/scipy/pull/21485): MAINT: interpolate: abstract out barycentric representation of… +* [#21492](https://github.com/scipy/scipy/pull/21492): MAINT: Specify SHELL=/bin/bash in doc/Makefile +* [#21493](https://github.com/scipy/scipy/pull/21493): MAINT: Check for all submodule paths in `check_installation` +* [#21496](https://github.com/scipy/scipy/pull/21496): TST: Use pytest-run-parallel against free-threaded CI +* [#21497](https://github.com/scipy/scipy/pull/21497): ENH: interpolate: add `FloaterHormannInterpolator` +* [#21499](https://github.com/scipy/scipy/pull/21499): MAINT, TST: CuPy skip ndimage test +* [#21502](https://github.com/scipy/scipy/pull/21502): MAINT: Update COBYQA to the latest release +* [#21505](https://github.com/scipy/scipy/pull/21505): BUG: special: Use Boost for ncfdtr, fixing accuracy issues +* [#21508](https://github.com/scipy/scipy/pull/21508): BUG: fft: fix real input to standard funcs +* [#21512](https://github.com/scipy/scipy/pull/21512): TST: signal: convert to `xp_assert_\*` infrastructure (pt…. +* [#21514](https://github.com/scipy/scipy/pull/21514): DOC: signal.freqz: fix example +* [#21515](https://github.com/scipy/scipy/pull/21515): MAINT: differentiate: manually promote dtype before element assignment +* [#21516](https://github.com/scipy/scipy/pull/21516): TST: remove redundant torch skips +* [#21517](https://github.com/scipy/scipy/pull/21517): DEV: `pytorch` -> `torch` +* [#21518](https://github.com/scipy/scipy/pull/21518): ENH: `stats.boxcox_llf`: add GPU support +* [#21520](https://github.com/scipy/scipy/pull/21520): TST: `special._smirnovp`: remove test xfail after translation… +* [#21524](https://github.com/scipy/scipy/pull/21524): ENH: integrate.trapezoid: add array API standard support +* [#21525](https://github.com/scipy/scipy/pull/21525): MAINT: stats: Fix typos principle -> principal +* [#21526](https://github.com/scipy/scipy/pull/21526): BUG: optimize.minimize.powell: stop squeezing everything +* [#21528](https://github.com/scipy/scipy/pull/21528): BUG: special.logsumexp: fix type promotion +* [#21530](https://github.com/scipy/scipy/pull/21530): TST: signal: convert to `xp_assert_\*` infrastructure, pt 2 +* [#21536](https://github.com/scipy/scipy/pull/21536): TST: interpolate: fix a spurious failure with -b all +* [#21539](https://github.com/scipy/scipy/pull/21539): MAINT: interpolate: move an internal utility from cython to python +* [#21542](https://github.com/scipy/scipy/pull/21542): DOC: integrate.cubature: fix doc formatting and references issues +* [#21544](https://github.com/scipy/scipy/pull/21544): DOC: optimize: document recipe for `\*args` and `\*\*kwargs` +* [#21545](https://github.com/scipy/scipy/pull/21545): STY: ignore rule UP038 +* [#21549](https://github.com/scipy/scipy/pull/21549): ENH: ndimage: add axes support to most morphology functions +* [#21551](https://github.com/scipy/scipy/pull/21551): MAINT: interpolate: trim down `_bspl` extension +* [#21553](https://github.com/scipy/scipy/pull/21553): ENH:linalg: Rewrite expm in C +* [#21564](https://github.com/scipy/scipy/pull/21564): TST, MAINT: skip some torch GPU tests +* [#21565](https://github.com/scipy/scipy/pull/21565): ENH: HiGHs re-integration +* [#21567](https://github.com/scipy/scipy/pull/21567): MAINT: stats.wilcoxon: small improvements/fixes +* [#21568](https://github.com/scipy/scipy/pull/21568): MAINT: special: performance optimization for simple autodifferentiation +* [#21570](https://github.com/scipy/scipy/pull/21570): MAINT, BLD: 3.13 to classifiers +* [#21572](https://github.com/scipy/scipy/pull/21572): DEP: spatial.distance: deprecate `kulczynski1` and `sokalmichener`… +* [#21573](https://github.com/scipy/scipy/pull/21573): DOC/MAINT: stats: fix some typos +* [#21575](https://github.com/scipy/scipy/pull/21575): DOC/MAINT: doc: fix some typos +* [#21577](https://github.com/scipy/scipy/pull/21577): MAINT: special.hankel2: fix edge case +* [#21578](https://github.com/scipy/scipy/pull/21578): DOC: `special.mathieu_c/sem`: add information to docstring +* [#21579](https://github.com/scipy/scipy/pull/21579): TST/DEV: allow stacking of `skip_xp_backends` +* [#21585](https://github.com/scipy/scipy/pull/21585): DOC/MAINT: special: fix some typos +* [#21586](https://github.com/scipy/scipy/pull/21586): DOC/MAINT: spatial: fix some typos +* [#21587](https://github.com/scipy/scipy/pull/21587): BUG:linalg: Fix single precision expm UV computation +* [#21588](https://github.com/scipy/scipy/pull/21588): BUG: linalg.det: Fix edge case handling of stacked 1x1 arrays +* [#21590](https://github.com/scipy/scipy/pull/21590): DOC: signal.firwin: emphasise cutoff freq is half-amplitude +* [#21593](https://github.com/scipy/scipy/pull/21593): DOC: `special.roots_legendre`: fix typo in example +* [#21595](https://github.com/scipy/scipy/pull/21595): DOC: building: specify .ps1 for windows example +* [#21597](https://github.com/scipy/scipy/pull/21597): ENH: `special.logsumexp`: improve precision when one element… +* [#21598](https://github.com/scipy/scipy/pull/21598): DOC: `spatial.voronoi_plot_2d`: notes on degeneracy +* [#21599](https://github.com/scipy/scipy/pull/21599): CI: use gha-update [wheel build] +* [#21600](https://github.com/scipy/scipy/pull/21600): MAINT: `_lib`: vendor and use array-api-extra +* [#21602](https://github.com/scipy/scipy/pull/21602): BUG:optimize: Correct guarding, previosuly Fortran indexed, mod… +* [#21603](https://github.com/scipy/scipy/pull/21603): DOC: `special.riccati_yn`: highlight sign convention +* [#21604](https://github.com/scipy/scipy/pull/21604): MAINT: `special.gegenbauer`: fix behavior for `n=0`;… +* [#21605](https://github.com/scipy/scipy/pull/21605): MAINT: constants: update codata values to 2022 +* [#21607](https://github.com/scipy/scipy/pull/21607): DOC/MAINT: sparse: fix some typos +* [#21608](https://github.com/scipy/scipy/pull/21608): TST: ndimage: skip fourier tests for JAX +* [#21609](https://github.com/scipy/scipy/pull/21609): ENH: `integrate.lebedev_rule`: points and weights of Lebedev… +* [#21612](https://github.com/scipy/scipy/pull/21612): MAINT: special: fix delegation to generic implementations +* [#21616](https://github.com/scipy/scipy/pull/21616): BUG: sparse: fix indexing after ellipsis and 2D array indexing +* [#21617](https://github.com/scipy/scipy/pull/21617): DOC/MAINT: signal: fix some typos +* [#21621](https://github.com/scipy/scipy/pull/21621): DOC/MAINT: ndimage: fix some typos +* [#21622](https://github.com/scipy/scipy/pull/21622): MAINT: special.logsumexp: enforce branch cut convention +* [#21624](https://github.com/scipy/scipy/pull/21624): DOC/MAINT: linalg: fix some typos +* [#21625](https://github.com/scipy/scipy/pull/21625): ENH: `optimize.differential_evolution`: respect workers when… +* [#21626](https://github.com/scipy/scipy/pull/21626): BUG: sparse.linalg: Set `t=2` in `test_onenormest_table_6_t_1`… +* [#21629](https://github.com/scipy/scipy/pull/21629): MAINT: special: use reflection formulas for spherical Bessel… +* [#21633](https://github.com/scipy/scipy/pull/21633): DEP: linalg: deprecate kron +* [#21635](https://github.com/scipy/scipy/pull/21635): TST: special: fix XSLOW failure in `test_mpmath.TestSystematic.test_spherical_j`… +* [#21636](https://github.com/scipy/scipy/pull/21636): MAINT: `differentiate.differentiate`: rename function to… +* [#21637](https://github.com/scipy/scipy/pull/21637): MAINT: interpolate: deduplicate input validation for NdBSpline +* [#21638](https://github.com/scipy/scipy/pull/21638): ENH: `differentiate.jacobian`: support array `step_direction` +* [#21642](https://github.com/scipy/scipy/pull/21642): BUG: io.mmwrite: fix auto-appending of `.mtx` extension +* [#21646](https://github.com/scipy/scipy/pull/21646): DOC: sparse: Migration Guide rewording and tweaks +* [#21647](https://github.com/scipy/scipy/pull/21647): DOC: optimize.root: replace ‘fprime’ with ‘jac’ in `method=’hybr’` +* [#21648](https://github.com/scipy/scipy/pull/21648): DOC/TST: `integrate.cubature`: Clean up docstring and add… +* [#21656](https://github.com/scipy/scipy/pull/21656): API: `integrate.cubature`: change some arguments to keyword-only +* [#21657](https://github.com/scipy/scipy/pull/21657): ENH: `integrate.cubature`: support for infinite limits +* [#21658](https://github.com/scipy/scipy/pull/21658): ENH: stats.chatterjeexi: add xi correlation function +* [#21663](https://github.com/scipy/scipy/pull/21663): CI: fix failing conda setup +* [#21668](https://github.com/scipy/scipy/pull/21668): BUG: fft.fht: set `u.imag[-1] = 0` only when `n` is even +* [#21672](https://github.com/scipy/scipy/pull/21672): BUG: ndimage: fix 0d arrays in `_normalize_sequence` +* [#21673](https://github.com/scipy/scipy/pull/21673): BUG: signal.ShortTimeFFT: fix multichannel roundtrip with `mfft`… +* [#21678](https://github.com/scipy/scipy/pull/21678): BUG: fix `nan` output of `special.betaincinv` +* [#21680](https://github.com/scipy/scipy/pull/21680): MAINT:integrate: Silence a few QUADPACK compiler warnings +* [#21682](https://github.com/scipy/scipy/pull/21682): DOC: Reduce duplication in user guide +* [#21686](https://github.com/scipy/scipy/pull/21686): BUG: signal: int handling for `resample_poly` +* [#21689](https://github.com/scipy/scipy/pull/21689): BUG: optimize: fix bugs found in L-BFGS-B implementation +* [#21695](https://github.com/scipy/scipy/pull/21695): ENH: `stats.chisquare`: add `sum_check` to disable check… +* [#21697](https://github.com/scipy/scipy/pull/21697): MAINT: signal.lombscargle: fix numerical backward-compat +* [#21699](https://github.com/scipy/scipy/pull/21699): BUG: sparse.linalg: remove faulty test of eigval order from ARPACK +* [#21700](https://github.com/scipy/scipy/pull/21700): ENH: `stats.Mixture`: add mixture distributions for new infrastructure +* [#21701](https://github.com/scipy/scipy/pull/21701): MAINT: interpolate: remove undocumented nu arg of BSpline.design\_matrix +* [#21702](https://github.com/scipy/scipy/pull/21702): MAINT: special: clean up factorial corner cases, including complex… +* [#21703](https://github.com/scipy/scipy/pull/21703): DOC: sparse: update spdiags handling in `doc_string` and migration… +* [#21705](https://github.com/scipy/scipy/pull/21705): MAINT: Allow greek Unicode symbols in linter. +* [#21706](https://github.com/scipy/scipy/pull/21706): DEP: signal: deprecate object arrays in sosfilt +* [#21707](https://github.com/scipy/scipy/pull/21707): ENH: `stats.make_distribution`: generate a `ContinuousDistribution`… +* [#21710](https://github.com/scipy/scipy/pull/21710): ENH: sparse.linalg: convert sparse.linalg to use sparray internally +* [#21711](https://github.com/scipy/scipy/pull/21711): BUG: special: Fix formula for division of dual numbers in xsf +* [#21712](https://github.com/scipy/scipy/pull/21712): MAINT: special.logsumexp: preserve tiny imaginary components +* [#21714](https://github.com/scipy/scipy/pull/21714): TST: stats.sampling: add fail slow exception +* [#21718](https://github.com/scipy/scipy/pull/21718): DOC: `stats.bootstrap`: improve description of `paired`… +* [#21719](https://github.com/scipy/scipy/pull/21719): BLD: macos-12 image deprecated [wheel build] +* [#21721](https://github.com/scipy/scipy/pull/21721): MAINT: signal: lombscargle docstring tweaks and fix handling… +* [#21723](https://github.com/scipy/scipy/pull/21723): DOC: Fixed a typo in the description of `scipy.sparse.csgraph.maximum_bipartite`… +* [#21726](https://github.com/scipy/scipy/pull/21726): ENH: linalg.solve: add `assume_a='banded'` +* [#21728](https://github.com/scipy/scipy/pull/21728): ENH: special: use boost in `nctdtr` +* [#21729](https://github.com/scipy/scipy/pull/21729): MAINT: signal.lombscargle: vectorization changes and handling… +* [#21730](https://github.com/scipy/scipy/pull/21730): MAINT: sparse.linalg: use @ for matmul in docs/tests for Linear… +* [#21731](https://github.com/scipy/scipy/pull/21731): ENH: `stats.dpareto_lognorm`: add double Pareto lognormal… +* [#21734](https://github.com/scipy/scipy/pull/21734): BUG: cluster: correct type of default value of `dist` in `ClusterNode` +* [#21737](https://github.com/scipy/scipy/pull/21737): TST: differentiate: small tolerance bump on failing test +* [#21739](https://github.com/scipy/scipy/pull/21739): BLD: fix issue with capitalisation when meson detects Accelerate +* [#21744](https://github.com/scipy/scipy/pull/21744): ENH: special: Extend Riemann Zeta function to complex inputs +* [#21746](https://github.com/scipy/scipy/pull/21746): ENH: stats: exponential, logarithm, and reciprocal of a random… +* [#21748](https://github.com/scipy/scipy/pull/21748): MAINT: Updated pybind11 min version to 2.13.2 +* [#21749](https://github.com/scipy/scipy/pull/21749): MAINT/DEV: fix `python dev.py ipython` under Debian 12 / Python… +* [#21751](https://github.com/scipy/scipy/pull/21751): BUG: array API conformance in cubature +* [#21752](https://github.com/scipy/scipy/pull/21752): ENH: stats.truncate: truncated random variables +* [#21753](https://github.com/scipy/scipy/pull/21753): DOC: sparse: migration to sparray guide updates +* [#21754](https://github.com/scipy/scipy/pull/21754): MAINT: interpolate: rename `interpnd` -> `_interpnd` +* [#21756](https://github.com/scipy/scipy/pull/21756): DOC: interpolate: detail `interp1d` recommended replacements +* [#21763](https://github.com/scipy/scipy/pull/21763): BUG: handle pearsonr constant case with n=2 vectors +* [#21765](https://github.com/scipy/scipy/pull/21765): MAINT: remove equality constraint that was impossible to satisfy… +* [#21767](https://github.com/scipy/scipy/pull/21767): MAINT: `stats.ContinuousDistribution`: protect attributes,… +* [#21768](https://github.com/scipy/scipy/pull/21768): BUG: sparse: fix ellipsis and bool array indexing combination +* [#21770](https://github.com/scipy/scipy/pull/21770): DOC: stats: correct conclusion associated with high p-value +* [#21773](https://github.com/scipy/scipy/pull/21773): DEP: special: Remove `special.btdtr` and `special.btdtri` +* [#21774](https://github.com/scipy/scipy/pull/21774): API: `optimize.differential_evolution`: transition to Generator… +* [#21776](https://github.com/scipy/scipy/pull/21776): BUG/ENH/DOC: spatial: Better handle & document `Rotation` splitting +* [#21777](https://github.com/scipy/scipy/pull/21777): ENH: stats: absolute value of a random variable +* [#21778](https://github.com/scipy/scipy/pull/21778): ENH: optimize: add array api support to `rosen` and friends +* [#21779](https://github.com/scipy/scipy/pull/21779): ENH: sparse.csgraph: migrate to use sparray (code changes only) +* [#21780](https://github.com/scipy/scipy/pull/21780): BUG: signal: Fix `ShortTimeFFT.extent()` for `fft_mode ==`… +* [#21784](https://github.com/scipy/scipy/pull/21784): BUG: sparse: fix Asp @ vsp for 1D sparse vector and add tests +* [#21785](https://github.com/scipy/scipy/pull/21785): MAINT: optimize: migration to sparray pass 1 changes +* [#21789](https://github.com/scipy/scipy/pull/21789): ENH: integrate.nsum: support unimodal functions and infinite… +* [#21790](https://github.com/scipy/scipy/pull/21790): ENH: stats: distributions of order statistics +* [#21792](https://github.com/scipy/scipy/pull/21792): BUG: sparse: fix setdiag for matrices with missing diagonal entries +* [#21793](https://github.com/scipy/scipy/pull/21793): CI: Move free-threaded-wheels.yml into wheels.yml +* [#21794](https://github.com/scipy/scipy/pull/21794): BUG: stats.qmc: fix `get_poly_vinit` for multi-threading +* [#21796](https://github.com/scipy/scipy/pull/21796): MAINT: Update `array_api_compat` submodule for the 2023.12… +* [#21797](https://github.com/scipy/scipy/pull/21797): BUG: special: fix array index out of bound for `pro_rad2` +* [#21799](https://github.com/scipy/scipy/pull/21799): ENH: sparse.linalg: add `is_sptriangular` and `spbandwidth`… +* [#21800](https://github.com/scipy/scipy/pull/21800): DOC: signal.find\_peaks: Document that widths are returned +* [#21801](https://github.com/scipy/scipy/pull/21801): ENH: extend factorial{,2,k} to allow complex inputs +* [#21802](https://github.com/scipy/scipy/pull/21802): MAINT: special: remove dependence of `xsf::numpy` on `sf_error` +* [#21808](https://github.com/scipy/scipy/pull/21808): BUG: `signal.correlation_lags`: fail with meaningful error… +* [#21811](https://github.com/scipy/scipy/pull/21811): ENH: differentiate: add array API support to `jacobian` and… +* [#21812](https://github.com/scipy/scipy/pull/21812): API: interpolate.BarycentricInterpolator: transition to Generator… +* [#21815](https://github.com/scipy/scipy/pull/21815): TST: interpolate: parametrize tests on `griddata` +* [#21818](https://github.com/scipy/scipy/pull/21818): CI: Replace deadsnakes 3.13t by Quansight-Labs/setup-python action +* [#21819](https://github.com/scipy/scipy/pull/21819): ENH: `stats.ContinuousDistribution`: improve method resolution… +* [#21821](https://github.com/scipy/scipy/pull/21821): TST: optimize: mark MIP6 tests xslow +* [#21822](https://github.com/scipy/scipy/pull/21822): TST: `stats.fit`: adjust tests for `seed`->``rng`` transition +* [#21823](https://github.com/scipy/scipy/pull/21823): API: `optimize.dual_annealing`: adopt SPEC007 +* [#21824](https://github.com/scipy/scipy/pull/21824): BUG: sparse: fix `idx_dtype` when building index arrays in… +* [#21825](https://github.com/scipy/scipy/pull/21825): DOC: make `_transition_to_rng` replace documentation of `rng` +* [#21827](https://github.com/scipy/scipy/pull/21827): BUG: special: Fix behavior of `gamma` and `gammasgn` at poles… +* [#21831](https://github.com/scipy/scipy/pull/21831): DOC: fixup `_transition_to_rng` Oldest GCC `"'rng' is not`… +* [#21832](https://github.com/scipy/scipy/pull/21832): CI: constrain array-api-strict version to allow conversion to… +* [#21834](https://github.com/scipy/scipy/pull/21834): DOC: fft.fht: fix typo in example +* [#21839](https://github.com/scipy/scipy/pull/21839): MAINT:sparse.linalg: Detach ARPACK and PROPACK code sharing +* [#21840](https://github.com/scipy/scipy/pull/21840): DOC: interpolate: add a tutorial page for smoothing splines +* [#21841](https://github.com/scipy/scipy/pull/21841): DOC: tone down the text of the “legacy” admonition +* [#21843](https://github.com/scipy/scipy/pull/21843): MAINT: stats.lmoment: fixup keepdims behavior +* [#21845](https://github.com/scipy/scipy/pull/21845): API: `optimize.check_grad`: transition to Generator (SPEC… +* [#21847](https://github.com/scipy/scipy/pull/21847): API: optimize.basinhopping: transition to Generator (SPEC 7) +* [#21848](https://github.com/scipy/scipy/pull/21848): API: `optimize.quadratic_assignment`: transition to rng (SPEC… +* [#21849](https://github.com/scipy/scipy/pull/21849): DOC: interpolate: declare 1D FITPACK wrappers legacy +* [#21850](https://github.com/scipy/scipy/pull/21850): BUG: linalg.svd: avoid segmentation fault +* [#21851](https://github.com/scipy/scipy/pull/21851): STY: add comment about allowed whitespace in table +* [#21853](https://github.com/scipy/scipy/pull/21853): DOC: replace only first paragraph of rng documentation +* [#21854](https://github.com/scipy/scipy/pull/21854): API: `stats._resampling`: transition to rng (SPEC 7) +* [#21856](https://github.com/scipy/scipy/pull/21856): MAINT, TST: `test_create_diagonal` GPU support +* [#21857](https://github.com/scipy/scipy/pull/21857): BLD: warn on accelerate + non-native +* [#21858](https://github.com/scipy/scipy/pull/21858): ENH: sparse: Add safe casting function for sparse index to sputils +* [#21859](https://github.com/scipy/scipy/pull/21859): DOC: `signal.unit_impulse`: add explanation about delta +* [#21860](https://github.com/scipy/scipy/pull/21860): MAINT: improve handling of thread-local storage +* [#21861](https://github.com/scipy/scipy/pull/21861): MAINT: special: Use consistent std::isnan and std::isinf in a… +* [#21864](https://github.com/scipy/scipy/pull/21864): DEP: remove scipy.misc +* [#21865](https://github.com/scipy/scipy/pull/21865): MAINT: `fft`: Remove outdated documentation workaround +* [#21867](https://github.com/scipy/scipy/pull/21867): MAINT: stats.wilcoxon: improve documentation and tests +* [#21868](https://github.com/scipy/scipy/pull/21868): BUG: io.matlab: expose `varmats_from_mat` +* [#21869](https://github.com/scipy/scipy/pull/21869): MAINT: stats.ContinuousDistribution: clarify conditions that… +* [#21870](https://github.com/scipy/scipy/pull/21870): MAINT: spatial/special: follow-up on `std::isnan`, `std::isinf` +* [#21871](https://github.com/scipy/scipy/pull/21871): ENH: stats.ContinuousDistribution.sample: generate QMC samples +* [#21873](https://github.com/scipy/scipy/pull/21873): DOC: sparse.csgraph: update csgraph docs to use sparray +* [#21875](https://github.com/scipy/scipy/pull/21875): MAINT: `interpolate.barycentric_interpolate`: add rng argument +* [#21878](https://github.com/scipy/scipy/pull/21878): API: cluster: transition to rng (SPEC 7) +* [#21880](https://github.com/scipy/scipy/pull/21880): API: `linalg.clarkson_woodruff_transform`: transition to… +* [#21881](https://github.com/scipy/scipy/pull/21881): API: `stats`: transition `goodness_of_fit`, `sobol_indices`... +* [#21883](https://github.com/scipy/scipy/pull/21883): DOC/MAINT: Fix some typos regarding GitHub +* [#21886](https://github.com/scipy/scipy/pull/21886): API: `stats.{PermutationMethod,BootstrapMethod}`: transition… +* [#21888](https://github.com/scipy/scipy/pull/21888): API: `sparse`: transition `random`-like functions to… +* [#21891](https://github.com/scipy/scipy/pull/21891): BUG: spatial: guard `distance_wrap` directives +* [#21892](https://github.com/scipy/scipy/pull/21892): MAINT: `_lib`: use `is_numpy` etc helpers from the compat… +* [#21893](https://github.com/scipy/scipy/pull/21893): MAINT: linalg.interpolative: normalize rng argument (SPEC7) +* [#21895](https://github.com/scipy/scipy/pull/21895): MAINT: bump array-api-extra +* [#21897](https://github.com/scipy/scipy/pull/21897): MAINT: Hausdorff Generator handling +* [#21901](https://github.com/scipy/scipy/pull/21901): MAINT: stats.dpareto\_lognorm.\_cdf: treat special case at x=0 +* [#21903](https://github.com/scipy/scipy/pull/21903): MAINT: Silence warnings during linprog benchmarks +* [#21904](https://github.com/scipy/scipy/pull/21904): BUG: fix nogil LinearNDInterpolator +* [#21905](https://github.com/scipy/scipy/pull/21905): MAINT: io: migration to use sparray in IO +* [#21906](https://github.com/scipy/scipy/pull/21906): CI: gha update +* [#21909](https://github.com/scipy/scipy/pull/21909): DOC: io.loadmat: document `uint16_codec` parameter +* [#21912](https://github.com/scipy/scipy/pull/21912): BUG: integrate.trapezoid: fix broadcasting issue +* [#21913](https://github.com/scipy/scipy/pull/21913): API: `spatial.directed_hausdorff`: transition to ‘rng’ keyword… +* [#21914](https://github.com/scipy/scipy/pull/21914): MAINT: `spatial.transform.Rotation.random`: transition to… +* [#21916](https://github.com/scipy/scipy/pull/21916): MAINT, TST: differentiate: `test_examples` tolerance bump +* [#21917](https://github.com/scipy/scipy/pull/21917): BLD: fortran: only use `-std=legacy` for gfortran +* [#21918](https://github.com/scipy/scipy/pull/21918): BUG: `optimize.curve_fit`: fix sigma dimension issue with… +* [#21919](https://github.com/scipy/scipy/pull/21919): Call `lcov` to generate coverage reports for C, C++ and Fortran… +* [#21921](https://github.com/scipy/scipy/pull/21921): DEP: `stats.ttest_ind`: deprecate `random_state` and `permutation`… +* [#21926](https://github.com/scipy/scipy/pull/21926): REV: Revert “MAINT: io: move `_test_fortran` under `tests`... +* [#21928](https://github.com/scipy/scipy/pull/21928): DEV: `gh_lists`: fix warnings +* [#21929](https://github.com/scipy/scipy/pull/21929): MAINT: bump array-api-extra to 0.2.0 +* [#21930](https://github.com/scipy/scipy/pull/21930): TST: sparse.linalg: tweak rtol for flaky `expm_multiply` test +* [#21931](https://github.com/scipy/scipy/pull/21931): MAINT: stats.qmc: transition to rng (SPEC 7) +* [#21932](https://github.com/scipy/scipy/pull/21932): ENH: integrate.nsum: add array API standard support +* [#21937](https://github.com/scipy/scipy/pull/21937): TST: linalg.blas: fix test concurrency, mark `\*ger` as unsafe +* [#21938](https://github.com/scipy/scipy/pull/21938): TST: linalg: do not call `np.asarray_chkfinite(np.empty((3,`… +* [#21941](https://github.com/scipy/scipy/pull/21941): DOC: add docs on parallel execution and thread safety +* [#21943](https://github.com/scipy/scipy/pull/21943): MAINT: mark f2py-generated extension modules as safe to run without… +* [#21944](https://github.com/scipy/scipy/pull/21944): MAINT: sparse: add `broadcast_shapes` function to `_sputils.py` +* [#21947](https://github.com/scipy/scipy/pull/21947): TST: stats.chatterjeexi: fix error message +* [#21948](https://github.com/scipy/scipy/pull/21948): TST: add more thorough SPEC 7 tests +* [#21950](https://github.com/scipy/scipy/pull/21950): CI: fix `Intel oneAPI tests` job +* [#21953](https://github.com/scipy/scipy/pull/21953): TST: stats.rdist: skip failing xslow test +* [#21954](https://github.com/scipy/scipy/pull/21954): ENH: sparse: ensure thread-safety +* [#21955](https://github.com/scipy/scipy/pull/21955): ENH: spatial: ensure thread-safety +* [#21961](https://github.com/scipy/scipy/pull/21961): MAINT: free-threading: declare HiGHS, `ndimage._rank_filter_1d`… +* [#21964](https://github.com/scipy/scipy/pull/21964): TST: optimize: slight tolerance bump for a dual-annealing test +* [#21965](https://github.com/scipy/scipy/pull/21965): ENH: special: ensure tests are thread-safe +* [#21967](https://github.com/scipy/scipy/pull/21967): DOC: stats.goodness\_of\_fit: clarify distinction between known/fit… +* [#21973](https://github.com/scipy/scipy/pull/21973): DEV: lint: disable UP031 +* [#21974](https://github.com/scipy/scipy/pull/21974): DEV: add `conda-build` to `environment.yml` +* [#21975](https://github.com/scipy/scipy/pull/21975): CI: use stable NumPy for “old build” +* [#21976](https://github.com/scipy/scipy/pull/21976): TST: `optimize.elementwise.bracket_root`: fix torch test… +* [#21977](https://github.com/scipy/scipy/pull/21977): ENH: integrate.tanhsinh: make `_tanhsinh` public +* [#21979](https://github.com/scipy/scipy/pull/21979): API: integrate.simpson: allow `x` to be passed positionally +* [#21981](https://github.com/scipy/scipy/pull/21981): MAINT: purge `from __future__ import annotations` +* [#21982](https://github.com/scipy/scipy/pull/21982): DOC: SciPy 1.15.0 relnotes +* [#21983](https://github.com/scipy/scipy/pull/21983): BUG: linalg: fix cython import order +* [#21984](https://github.com/scipy/scipy/pull/21984): BUG: signal: actually reject objects in correlate/convolve +* [#21985](https://github.com/scipy/scipy/pull/21985): DOC: optimize.root: fix docs for `inner_\*` parameters +* [#21989](https://github.com/scipy/scipy/pull/21989): DOC: integrate.tanhsinh: fix reference format; Examples heading +* [#21990](https://github.com/scipy/scipy/pull/21990): CI: remove setting macOS 10.9 for SDK and deployment target +* [#21991](https://github.com/scipy/scipy/pull/21991): BUG: `stats.sobol_indices`: fix mutation of input parameters +* [#21992](https://github.com/scipy/scipy/pull/21992): DOC: Unhide `toctree` in `scipy.cluster` with `maxdepth`… +* [#21994](https://github.com/scipy/scipy/pull/21994): BLD: Remove `ld_classic` usage on macOS +* [#21996](https://github.com/scipy/scipy/pull/21996): ENH: `stats.fisher_exact`: extend to `R x C` tables +* [#21998](https://github.com/scipy/scipy/pull/21998): MAINT, DOC: Use Jupytext’s API, and fix cross-platform usage… +* [#22002](https://github.com/scipy/scipy/pull/22002): TST: Run complex zeta avoid underflow tests only on platforms… +* [#22003](https://github.com/scipy/scipy/pull/22003): DEV: unified git submodule exclusion for tools +* [#22009](https://github.com/scipy/scipy/pull/22009): TST: differentiate.jacobian: tolerance bump for float32 +* [#22024](https://github.com/scipy/scipy/pull/22024): MAINT: version pins/prep for 1.15.0rc1 +* [#22025](https://github.com/scipy/scipy/pull/22025): DOC: stats: probability tutorial/transition guide +* [#22026](https://github.com/scipy/scipy/pull/22026): MAINT: stats.Mixture: fix default `weights` +* [#22027](https://github.com/scipy/scipy/pull/22027): MAINT: stats.ContinuousDistribution: improve doc generation;… +* [#22030](https://github.com/scipy/scipy/pull/22030): MAINT: `stats.FoldedDistribution`: accommodate for private… +* [#22032](https://github.com/scipy/scipy/pull/22032): MAINT: fix mypy complaints +* [#22033](https://github.com/scipy/scipy/pull/22033): TST: fix sparse.linalg failures for tfmqr and svds +* [#22036](https://github.com/scipy/scipy/pull/22036): DOC: adapt to NumPy 2.2 changes for abbreviation of large arrays +* [#22037](https://github.com/scipy/scipy/pull/22037): MAINT: stats: Add custom reprs for transformed distributions +* [#22040](https://github.com/scipy/scipy/pull/22040): MAINT: `stats.make_distribution`: support more existing distributions +* [#22043](https://github.com/scipy/scipy/pull/22043): ENH: sparse: make two sputils public for easier index array casting +* [#22048](https://github.com/scipy/scipy/pull/22048): TST: integrate.tanhsinh: fix abscissae/weight “compression” bug +* [#22050](https://github.com/scipy/scipy/pull/22050): MAINT: `stats.order_statistic`: override `support` +* [#22058](https://github.com/scipy/scipy/pull/22058): DOC: `stats.order_statistic`: add ‘Returns’ section +* [#22059](https://github.com/scipy/scipy/pull/22059): TST: temp skip of extending tests +* [#22067](https://github.com/scipy/scipy/pull/22067): MAINT: 1.15.0rc1 backports +* [#22078](https://github.com/scipy/scipy/pull/22078): REL: set 1.15.0rc2 unreleased +* [#22081](https://github.com/scipy/scipy/pull/22081): MAINT: Add `__str__` overrides for distributions in new infra… +* [#22082](https://github.com/scipy/scipy/pull/22082): BUG, DOC: fixup md5 hash reporting +* [#22085](https://github.com/scipy/scipy/pull/22085): DOC: sparse: explicit dtypes for nonzero() +* [#22091](https://github.com/scipy/scipy/pull/22091): DOC: Update special release notes +* [#22098](https://github.com/scipy/scipy/pull/22098): DOC: mention the removal of AccuracyWarning +* [#22099](https://github.com/scipy/scipy/pull/22099): DEP: update version in deprecation warning of interpnd +* [#22104](https://github.com/scipy/scipy/pull/22104): DOC: 1.15.0 release note updates +* [#22106](https://github.com/scipy/scipy/pull/22106): DOC: sparse: correct `eye_array` docs for first shape input… +* [#22107](https://github.com/scipy/scipy/pull/22107): MAINT/DOC: Doctests fix scpdt 1.6 +* [#22113](https://github.com/scipy/scipy/pull/22113): ENH: sparse: enhance dtype checking in constructors +* [#22124](https://github.com/scipy/scipy/pull/22124): DOC: Fix incorrect reference to “Random Variable Transition Guide”… +* [#22129](https://github.com/scipy/scipy/pull/22129): ENH: sparse: nD cleanup and docs +* [#22135](https://github.com/scipy/scipy/pull/22135): MAINT: \_lib: add missing f string to \_deprecate\_positional\_args +* [#22139](https://github.com/scipy/scipy/pull/22139): MAINT: stats.\_SimpleDomain: ensure that instances do not share… +* [#22149](https://github.com/scipy/scipy/pull/22149): MAINT: stats.ContinuousDistribution.llf: remove method +* [#22150](https://github.com/scipy/scipy/pull/22150): MAINT: SciPy 1.15.0rc2 backports +* [#22156](https://github.com/scipy/scipy/pull/22156): DEP: deprecation warnings for `special.lpn` and `[c]lpmn` +* [#22158](https://github.com/scipy/scipy/pull/22158): MAINT: accept ndarray subclasses in interpolate.\_dierckx +* [#22162](https://github.com/scipy/scipy/pull/22162): TYP: temporarily ignore the `numpy==2.2.1` mypy errors +* [#22167](https://github.com/scipy/scipy/pull/22167): DEP: special: deprecation warning for `sph_harm` + comments +* [#22168](https://github.com/scipy/scipy/pull/22168): BUG: fix incorrect values in factorial for 0 with uint dtypes +* [#22175](https://github.com/scipy/scipy/pull/22175): MAINT: stats: fix thread-safety issues under free-threaded CPython +* [#22177](https://github.com/scipy/scipy/pull/22177): MAINT: fix extension module not declaring free-threading support,… +* [#22181](https://github.com/scipy/scipy/pull/22181): REL: set 1.15.0rc3 unreleased +* [#22193](https://github.com/scipy/scipy/pull/22193): DEP: linalg.solve\_toeplitz/matmul\_toeplitz: warn on n-D `c`... +* [#22225](https://github.com/scipy/scipy/pull/22225): DOC: differentiate.jacobian: correct/improve documentation about… diff --git a/corpus/changelog/scipy_releases/scipy_1151.md b/corpus/changelog/scipy_releases/scipy_1151.md new file mode 100644 index 0000000000000000000000000000000000000000..396040c38797a713190d924d33995d6b45b354ba --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1151.md @@ -0,0 +1,45 @@ +# SciPy 1.15.1 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.15.1-notes.html +Version: 1.15.1 + +Contents + +* [SciPy 1.15.1 Release Notes](#scipy-1-15-1-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.15.1](#issues-closed-for-1-15-1) + - [Pull requests for 1.15.1](#pull-requests-for-1-15-1) + +SciPy 1.15.1 is a bug-fix release with no new features +compared to 1.15.0. Importantly, an issue with the +import of [`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") breaking other packages +has been fixed. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Name (commits) +* Ralf Gommers (3) +* Rohit Goswami (1) +* Matt Haberland (2) +* Tyler Reddy (7) +* Daniel Schmitz (1) + +A total of 5 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.15.1](#id3)[#](#issues-closed-for-1-15-1 "Link to this heading") + +* [#22257](https://github.com/scipy/scipy/issues/22257): BUG: Importing scipy.optimize break highspy +* [#22297](https://github.com/scipy/scipy/issues/22297): TST: TestDistributions.test\_funcs[logcdf-methods10-x-Normal]… + +### [Pull requests for 1.15.1](#id4)[#](#pull-requests-for-1-15-1 "Link to this heading") + +* [#22235](https://github.com/scipy/scipy/pull/22235): REL, MAINT: prep for 1.15.1 +* [#22245](https://github.com/scipy/scipy/pull/22245): MAINT: fix url for array-api-extra git submodule +* [#22270](https://github.com/scipy/scipy/pull/22270): BLD: fix some issues with undeclared internal build dependencies +* [#22272](https://github.com/scipy/scipy/pull/22272): TST: fix thread safety issue in interpolate.bsplines memmap test +* [#22276](https://github.com/scipy/scipy/pull/22276): TST: stats.Normal: bump tolerance on test of logcdf +* [#22292](https://github.com/scipy/scipy/pull/22292): MAINT: Update highs subproject commit diff --git a/corpus/changelog/scipy_releases/scipy_1152.md b/corpus/changelog/scipy_releases/scipy_1152.md new file mode 100644 index 0000000000000000000000000000000000000000..aca4ae7b8b339afd27bc14b1e480c0f542540d3e --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1152.md @@ -0,0 +1,85 @@ +# SciPy 1.15.2 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.15.2-notes.html +Version: 1.15.2 + +Contents + +* [SciPy 1.15.2 Release Notes](#scipy-1-15-2-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.15.2](#issues-closed-for-1-15-2) + - [Pull requests for 1.15.2](#pull-requests-for-1-15-2) + +SciPy 1.15.2 is a bug-fix release with no new features +compared to 1.15.1. Free-threaded Python 3.13 wheels +for Linux ARM platform are available on PyPI starting with +this release. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Name (commits) +* Peter Bell (1) +* Charles Bousseau (1) + +* Jake Bowhay (3) +* Matthew Brett (1) +* Ralf Gommers (3) +* Rohit Goswami (1) +* Matt Haberland (4) +* Parth Nobel (1) + +* Tyler Reddy (33) +* Daniel Schmitz (2) +* Dan Schult (5) +* Scott Shambaugh (2) +* Edgar Andrés Margffoy Tuay (1) +* Warren Weckesser (4) + +A total of 14 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.15.2](#id3)[#](#issues-closed-for-1-15-2 "Link to this heading") + +* [#21214](https://github.com/scipy/scipy/issues/21214): BUG: \_lib: crash in uarray on interpreter exit with a free-threaded… +* [#21417](https://github.com/scipy/scipy/issues/21417): BUG: special: Unchecked calls of malloc() and calloc() in specfun.h +* [#22183](https://github.com/scipy/scipy/issues/22183): BUG: Segmentation Fault when passing a special array to `scipy.cluster.hierarch`… +* [#22250](https://github.com/scipy/scipy/issues/22250): BUG: median\_filter on 1D array crashes with memory corruption… +* [#22314](https://github.com/scipy/scipy/issues/22314): BUG: special: Potential memory leak in the function `besy()`… +* [#22325](https://github.com/scipy/scipy/issues/22325): BUG: ndimage.median\_filter: Heap corruption with scipy 1.15 +* [#22333](https://github.com/scipy/scipy/issues/22333): BUG: signal.medfilt and ndimage.median\_filter not returning correct… +* [#22336](https://github.com/scipy/scipy/issues/22336): BUG: special: Unchecked malloc in stirling2.h +* [#22347](https://github.com/scipy/scipy/issues/22347): BUG: Matrix multiplication of a coo\_matrix with an invalid type… +* [#22349](https://github.com/scipy/scipy/issues/22349): BLD: libhighs.a static library is installed +* [#22355](https://github.com/scipy/scipy/issues/22355): BUG: interpolate test\_bary\_rational.TestAAA.test\_basic\_functions… +* [#22404](https://github.com/scipy/scipy/issues/22404): BUG: `scipy.stats.zmap` returns incorrect values for complex… +* [#22417](https://github.com/scipy/scipy/issues/22417): BUG: spatial.transform: `Rotation.from_matrix()` uses inaccurate… +* [#22444](https://github.com/scipy/scipy/issues/22444): BUG: io.loadmat thinks a file with a lot of zeros is valid +* [#22458](https://github.com/scipy/scipy/issues/22458): BUG: Slicing sparse matrix with `None` gives result different… +* [#22479](https://github.com/scipy/scipy/issues/22479): MAINT: scipy.stats: test\_regressZEROX SIMD warning for certain… + +### [Pull requests for 1.15.2](#id4)[#](#pull-requests-for-1-15-2 "Link to this heading") + +* [#22038](https://github.com/scipy/scipy/pull/22038): BUG: immortalize uarray global strings in order to prevent negative… +* [#22080](https://github.com/scipy/scipy/pull/22080): BUG: special: Fix unchecked memory allocations in `specfun.h` +* [#22187](https://github.com/scipy/scipy/pull/22187): BUG: cluster: `cophenet` intercept invalid linkage matrix count +* [#22306](https://github.com/scipy/scipy/pull/22306): REL, MAINT: prep for 1.15.2 +* [#22322](https://github.com/scipy/scipy/pull/22322): MAINT: stats.Mixture: make return type consistent when `shape`… +* [#22337](https://github.com/scipy/scipy/pull/22337): MAINT: stats.Mixture: fix inverse functions when mean is undefined +* [#22339](https://github.com/scipy/scipy/pull/22339): BUG: special: Fix unchecked malloc in stirling2.h +* [#22345](https://github.com/scipy/scipy/pull/22345): TST: turn off dtype check due to endianness +* [#22353](https://github.com/scipy/scipy/pull/22353): BUG: sparse: fix selecting wrong dtype for coo coords +* [#22356](https://github.com/scipy/scipy/pull/22356): TST: interpolate: small tolerance bump to TestAAA.test\_basic\_functions +* [#22357](https://github.com/scipy/scipy/pull/22357): MAINT: Stop installing `libhighs` +* [#22372](https://github.com/scipy/scipy/pull/22372): BUG: sparse.linalg.norm: add test for and fix return type +* [#22373](https://github.com/scipy/scipy/pull/22373): BUG: sparse: revert NotImplemented return values in dot and matmul +* [#22374](https://github.com/scipy/scipy/pull/22374): DOC: sparse.linalg: add two recent functions to namespace and… +* [#22402](https://github.com/scipy/scipy/pull/22402): BUG: wrap median\_filter stability +* [#22405](https://github.com/scipy/scipy/pull/22405): MAINT: stats.zmap: restore support for complex data +* [#22408](https://github.com/scipy/scipy/pull/22408): MAINT: integrate.cumulative\_simpson: bump test tolerance +* [#22418](https://github.com/scipy/scipy/pull/22418): BUG: scipy.spatial: Fix inaccurate orthonormalization in `Rotation.from_matrix(`… +* [#22423](https://github.com/scipy/scipy/pull/22423): BUG: special: Fix a memory leak in the AMOS function besy(). +* [#22446](https://github.com/scipy/scipy/pull/22446): CI: migrate Linux aarch64 jobs to GitHub Actions, add cp313t… +* [#22447](https://github.com/scipy/scipy/pull/22447): BUG: io.loadmat: throw error on file containing all zeros +* [#22472](https://github.com/scipy/scipy/pull/22472): BUG: sparse: fix spmatrix indexing with None and implicit padding… +* [#22482](https://github.com/scipy/scipy/pull/22482): MAINT: stats: pearsonr SIMD-related shim diff --git a/corpus/changelog/scipy_releases/scipy_1153.md b/corpus/changelog/scipy_releases/scipy_1153.md new file mode 100644 index 0000000000000000000000000000000000000000..76fc228c8d0f3d5ca9466d0877138acb2ab96341 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1153.md @@ -0,0 +1,110 @@ +# SciPy 1.15.3 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.15.3-notes.html +Version: 1.15.3 + +Contents + +* [SciPy 1.15.3 Release Notes](#scipy-1-15-3-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.15.3](#issues-closed-for-1-15-3) + - [Pull requests for 1.15.3](#pull-requests-for-1-15-3) + +SciPy 1.15.3 is a bug-fix release with no new features +compared to 1.15.2. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Name (commits) +* aiudirog (1) + +* Nickolai Belakovski (1) +* Florian Bourgey (1) + +* Richard Strong Bowen (2) + +* Jake Bowhay (1) +* Dietrich Brunn (2) +* Evgeni Burovski (1) +* Lucas Colley (1) +* Ralf Gommers (1) +* Saarthak Gupta (1) + +* Matt Haberland (4) +* Chengyu Han (1) + +* Lukas Huber (1) + +* Nick ODell (2) +* Ilhan Polat (4) +* Tyler Reddy (52) +* Neil Schemenauer (1) + +* Dan Schult (1) +* sildater (1) + +* Gagandeep Singh (4) +* Albert Steppi (2) +* Matthias Urlichs (1) + +* David Varela (1) + +* ਗਗਨਦੀਪ ਸਿੰਘ (Gagandeep Singh) (3) + +A total of 24 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.15.3](#id3)[#](#issues-closed-for-1-15-3 "Link to this heading") + +* [#10634](https://github.com/scipy/scipy/issues/10634): BUG: optimize: `least_squares` with `'trf'` and `'trf_sover=lsmr'`… +* [#18146](https://github.com/scipy/scipy/issues/18146): BUG: scipy.sparse.linalg.expm\_multiply fails with sparse matrices +* [#19418](https://github.com/scipy/scipy/issues/19418): BUG: integrate.solve\_ivp fails for some step sizes if dense\_output=True… +* [#19865](https://github.com/scipy/scipy/issues/19865): BUG: HalfspaceIntersection.add\_halfspaces() does not seem to… +* [#20988](https://github.com/scipy/scipy/issues/20988): BUG: special.hyp2f1: wrong result for extreme inputs +* [#22236](https://github.com/scipy/scipy/issues/22236): BUG: scipy v1.15 breaking for pytest when assert-rewrite is on +* [#22400](https://github.com/scipy/scipy/issues/22400): BUG: stats.genextreme.stats: Spurious warning from `genextreme.stats(0.0,`… +* [#22451](https://github.com/scipy/scipy/issues/22451): BUG: interpolative svd broken for non-square linear operators +* [#22515](https://github.com/scipy/scipy/issues/22515): CI: Some GitHub workflows failing due to check on `actions/cache`… +* [#22547](https://github.com/scipy/scipy/issues/22547): BUG: \_lib: Data race reported by TSAN in `ccallback` mechanism +* [#22558](https://github.com/scipy/scipy/issues/22558): BUG: linalg.expm: bug on Windows / conda +* [#22574](https://github.com/scipy/scipy/issues/22574): CI: benchmark job on CircleCI is failing on `io.mmread` memory… +* [#22586](https://github.com/scipy/scipy/issues/22586): BUG: ndimage.median\_filter: additional hard crashes +* [#22589](https://github.com/scipy/scipy/issues/22589): BUG: spatial: `Rotation` no longer supports zero-length collections +* [#22599](https://github.com/scipy/scipy/issues/22599): DOC: sparse.linalg.ArpackError: entire default `infodict` displayed +* [#22615](https://github.com/scipy/scipy/issues/22615): CI: oneAPI job: `Not enough disk space.` +* [#22637](https://github.com/scipy/scipy/issues/22637): BUG: Transposed LinearOperator fails on vector multiplication +* [#22655](https://github.com/scipy/scipy/issues/22655): BUG: optimize.linprog: 40x slower in v1.15 compared to v1.14 +* [#22681](https://github.com/scipy/scipy/issues/22681): DOC: integrate.tanhsinh: documentation refers to non-existent… +* [#22684](https://github.com/scipy/scipy/issues/22684): BUG: signal.resample\_poly: dtype not preserved +* [#22720](https://github.com/scipy/scipy/issues/22720): MAINT, CI: floating point exceptions activated in NumPy +* [#22868](https://github.com/scipy/scipy/issues/22868): BUG: re-importing `scipy` fails +* [#22903](https://github.com/scipy/scipy/issues/22903): BUG: special.logsumexp: nan in 1.15 + +### [Pull requests for 1.15.3](#id4)[#](#pull-requests-for-1-15-3 "Link to this heading") + +* [#20035](https://github.com/scipy/scipy/pull/20035): BUG: spatial.HalfspaceIntersection: raise on non-feasible half… +* [#22502](https://github.com/scipy/scipy/pull/22502): BUG: special: Fix typo in specfun::chgu +* [#22517](https://github.com/scipy/scipy/pull/22517): CI: Use actions/cache 4.2.0 +* [#22532](https://github.com/scipy/scipy/pull/22532): BUG: Remove warning for genextreme.stats(0.0, moments=’mvsk’) +* [#22543](https://github.com/scipy/scipy/pull/22543): REL, MAINT: prep for 1.15.3 +* [#22555](https://github.com/scipy/scipy/pull/22555): BUG: `scipy.sparse.linalg`: Fix `expm_multiply` if both… +* [#22561](https://github.com/scipy/scipy/pull/22561): BUG: \_lib: Fix data race found by TSAN, use SCIPY\_TLS. +* [#22567](https://github.com/scipy/scipy/pull/22567): BUG: optimize: Fix `bracket_root` termination check and default… +* [#22582](https://github.com/scipy/scipy/pull/22582): BUG: `integrate.solve_ivp`: Avoid duplicate time stamps in… +* [#22587](https://github.com/scipy/scipy/pull/22587): BUG: Pin jupyterlite-sphinx to >= 0.19.1 +* [#22588](https://github.com/scipy/scipy/pull/22588): BUG/BLD: xsf: force defining the mdspan parenthesis operator… +* [#22590](https://github.com/scipy/scipy/pull/22590): BENCH: remove triple run of mmread/mmwrite benchmark, limit sizes +* [#22600](https://github.com/scipy/scipy/pull/22600): BUG: Fix ArpackError default argument +* [#22608](https://github.com/scipy/scipy/pull/22608): BUG: ndimage.median\_filter: fix segfault when using `mode='mirror'` +* [#22617](https://github.com/scipy/scipy/pull/22617): CI: minimise disk space usage for oneAPI jobs +* [#22642](https://github.com/scipy/scipy/pull/22642): BUG: sparse: sparse sum/mean out parameter shape not enforced… +* [#22643](https://github.com/scipy/scipy/pull/22643): BUG: spatial.transform.Rotation: support 0-length rotations +* [#22660](https://github.com/scipy/scipy/pull/22660): BUG: optimize: avoid expensive access of `basis.col_status`… +* [#22689](https://github.com/scipy/scipy/pull/22689): BUG: signal.resample\_poly: fix dtype preservation +* [#22690](https://github.com/scipy/scipy/pull/22690): MAINT/DOC: integrate.tanhsinh: lightly refactor error estimate… +* [#22693](https://github.com/scipy/scipy/pull/22693): BUG: spatial.HalfspaceIntersection: fix `add_halfspaces` batch… +* [#22726](https://github.com/scipy/scipy/pull/22726): MAINT: compensate for dot exceptions +* [#22763](https://github.com/scipy/scipy/pull/22763): BUG: sparse: Remove reference cycle to improve memory use +* [#22772](https://github.com/scipy/scipy/pull/22772): BUG: sparse.linalg: Transposed `LinearOperator` multiplication… +* [#22784](https://github.com/scipy/scipy/pull/22784): BUG: signal.\_short\_time\_fft: incorrect index computation in `upper_border_begin`… +* [#22792](https://github.com/scipy/scipy/pull/22792): BUG: signal.ShortTimeFFT.upper\_border\_begin: Document parameter… +* [#22801](https://github.com/scipy/scipy/pull/22801): BUG: `signal.windows._windows.kaiser_bessel_derived`: use… +* [#22810](https://github.com/scipy/scipy/pull/22810): BUG: special.hyp2f1: fix for extreme inputs +* [#22822](https://github.com/scipy/scipy/pull/22822): BUG: linalg.expm: Fix noncompliant compiler branch typos in C… +* [#22828](https://github.com/scipy/scipy/pull/22828): BUG: add workaround for pytest assertion rewriting overreach +* [#22834](https://github.com/scipy/scipy/pull/22834): BUG: linalg: Fix shape mismatch in interpolative.svd +* [#22869](https://github.com/scipy/scipy/pull/22869): BUG: optimize.\_highspy: don’t import from inside a C module +* [#22910](https://github.com/scipy/scipy/pull/22910): MAINT: special.logsumexp: improvement when weight of largest… diff --git a/corpus/changelog/scipy_releases/scipy_1160.md b/corpus/changelog/scipy_releases/scipy_1160.md new file mode 100644 index 0000000000000000000000000000000000000000..6334809ec93baad881e1a0d384d725925d39a010 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1160.md @@ -0,0 +1,1129 @@ +# SciPy 1.16.0 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.16.0-notes.html +Version: 1.16.0 + +Contents + +* [SciPy 1.16.0 Release Notes](#scipy-1-16-0-release-notes) + + + [Highlights of this release](#highlights-of-this-release) + + [New features](#new-features) + + - [`scipy.io` improvements](#scipy-io-improvements) + - [`scipy.integrate` improvements](#scipy-integrate-improvements) + - [`scipy.interpolate` improvements](#scipy-interpolate-improvements) + - [`scipy.linalg` improvements](#scipy-linalg-improvements) + - [`scipy.ndimage` improvements](#scipy-ndimage-improvements) + - [`scipy.optimize` improvements](#scipy-optimize-improvements) + - [`scipy.signal` improvements](#scipy-signal-improvements) + - [`scipy.sparse` improvements](#scipy-sparse-improvements) + - [`scipy.spatial` improvements](#scipy-spatial-improvements) + - [`scipy.stats` improvements](#scipy-stats-improvements) + + [Array API Standard Support](#array-api-standard-support) + + [Deprecated features](#deprecated-features) + + [Expired Deprecations](#expired-deprecations) + + [Backwards incompatible changes](#backwards-incompatible-changes) + + [Build and packaging related changes](#build-and-packaging-related-changes) + + [Other changes](#other-changes) + + [Authors](#authors) + + [Issues closed for 1.16.0](#issues-closed-for-1-16-0) + + [Pull requests for 1.16.0](#pull-requests-for-1-16-0) + +SciPy 1.16.0 is the culmination of 6 months of hard work. It contains +many new features, numerous bug-fixes, improved test coverage and better +documentation. There have been a number of deprecations and API changes +in this release, which are documented below. All users are encouraged to +upgrade to this release, as there are a large number of bug-fixes and +optimizations. Before upgrading, we recommend that users check that +their own code does not use deprecated SciPy functionality (to do so, +run your code with `python -Wd` and check for `DeprecationWarning` s). +Our development attention will now shift to bug-fix releases on the +1.16.x branch, and on adding new features on the main branch. + +This release requires Python 3.11-3.13 and NumPy 1.25.2 or greater. + +## [Highlights of this release](#id4)[#](#highlights-of-this-release "Link to this heading") + +* Improved experimental support for the Python array API standard, including + new support in [`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal"), and additional support in [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") and + [`scipy.special`](../reference/special.html#module-scipy.special "scipy.special"). Improved support for JAX and Dask backends has been added, + with notable support in [`scipy.cluster.hierarchy`](../reference/cluster.hierarchy.html#module-scipy.cluster.hierarchy "scipy.cluster.hierarchy"), many functions in + [`scipy.special`](../reference/special.html#module-scipy.special "scipy.special"), and many of the trimmed statistics functions. +* [`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") now uses the new Python implementation from the + [PRIMA](https://www.libprima.net) package for COBYLA. + The PRIMA implementation [fixes many bugs](https://github.com/libprima/prima#bug-fixes) + in the old Fortran 77 implementation with + [a better performance on average](https://github.com/libprima/prima#improvements). +* [`scipy.sparse.coo_array`](../reference/generated/scipy.sparse.coo_array.html#scipy.sparse.coo_array "scipy.sparse.coo_array") now supports n-D arrays with reshaping, arithmetic and + reduction operations like sum/mean/min/max. No n-D indexing or + [`random_array`](../reference/generated/scipy.sparse.random_array.html#scipy.sparse.random_array "scipy.sparse.random_array") support yet. +* Updated guide and tools for migration from sparse matrices to sparse arrays. +* Nearly all functions in the [`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") namespace that accept array + arguments now support N-dimensional arrays to be processed as a batch. +* Two new [`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") functions, [`firwin_2d`](../reference/generated/scipy.signal.firwin_2d.html#scipy.signal.firwin_2d "scipy.signal.firwin_2d") and + [`closest_STFT_dual_window`](../reference/generated/scipy.signal.closest_STFT_dual_window.html#scipy.signal.closest_STFT_dual_window "scipy.signal.closest_STFT_dual_window"), for creation of a 2-D FIR filter and + [`ShortTimeFFT`](../reference/generated/scipy.signal.ShortTimeFFT.html#scipy.signal.ShortTimeFFT "scipy.signal.ShortTimeFFT") dual window calculation, respectively. +* A new class, [`scipy.spatial.transform.RigidTransform`](../reference/generated/scipy.spatial.transform.RigidTransform.html#scipy.spatial.transform.RigidTransform "scipy.spatial.transform.RigidTransform"), provides functionality + to convert between different representations of rigid transforms in 3-D + space. +* A new function [`scipy.ndimage.vectorized_filter`](../reference/generated/scipy.ndimage.vectorized_filter.html#scipy.ndimage.vectorized_filter "scipy.ndimage.vectorized_filter") for generic filters that + take advantage of a vectorized Python callable was added. + +## [New features](#id5)[#](#new-features "Link to this heading") + +### [`scipy.io` improvements](#id6)[#](#scipy-io-improvements "Link to this heading") + +* [`scipy.io.savemat`](../reference/generated/scipy.io.savemat.html#scipy.io.savemat "scipy.io.savemat") now provides informative warnings for invalid field names. +* [`scipy.io.mmread`](../reference/generated/scipy.io.mmread.html#scipy.io.mmread "scipy.io.mmread") now provides a clearer error message when provided with + a source file path that does not exist. +* [`scipy.io.wavfile.read`](../reference/generated/scipy.io.wavfile.read.html#scipy.io.wavfile.read "scipy.io.wavfile.read") can now read non-seekable files. + +### [`scipy.integrate` improvements](#id7)[#](#scipy-integrate-improvements "Link to this heading") + +* The error estimate of [`scipy.integrate.tanhsinh`](../reference/generated/scipy.integrate.tanhsinh.html#scipy.integrate.tanhsinh "scipy.integrate.tanhsinh") was improved. + +### [`scipy.interpolate` improvements](#id8)[#](#scipy-interpolate-improvements "Link to this heading") + +* Batch support was added to [`scipy.interpolate.make_smoothing_spline`](../reference/generated/scipy.interpolate.make_smoothing_spline.html#scipy.interpolate.make_smoothing_spline "scipy.interpolate.make_smoothing_spline"). + +### [`scipy.linalg` improvements](#id9)[#](#scipy-linalg-improvements "Link to this heading") + +* Nearly all functions in the [`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") namespace that accept array + arguments now support N-dimensional arrays to be processed as a batch. + See [Batched Linear Operations](../tutorial/linalg_batch.html#linalg-batch) for details. +* [`scipy.linalg.sqrtm`](../reference/generated/scipy.linalg.sqrtm.html#scipy.linalg.sqrtm "scipy.linalg.sqrtm") is rewritten in C and its performance is improved. It + also tries harder to return real-valued results for real-valued inputs if + possible. See the function docstring for more details. In this version the + input argument `disp` and the optional output argument `errest` are + deprecated and will be removed four versions later. Similarly, after + changing the underlying algorithm to recursion, the `blocksize` keyword + argument has no effect and will be removed two versions later. +* Wrappers for `?stevd`, `?langb`, `?sytri`, `?hetri` and + `?gbcon` were added to [`scipy.linalg.lapack`](../reference/linalg.lapack.html#module-scipy.linalg.lapack "scipy.linalg.lapack"). +* The default driver of [`scipy.linalg.eigh_tridiagonal`](../reference/generated/scipy.linalg.eigh_tridiagonal.html#scipy.linalg.eigh_tridiagonal "scipy.linalg.eigh_tridiagonal") was improved. +* [`scipy.linalg.solve`](../reference/generated/scipy.linalg.solve.html#scipy.linalg.solve "scipy.linalg.solve") can now estimate the reciprocal condition number and + the matrix norm calculation is more efficient. + +### [`scipy.ndimage` improvements](#id10)[#](#scipy-ndimage-improvements "Link to this heading") + +* A new function [`scipy.ndimage.vectorized_filter`](../reference/generated/scipy.ndimage.vectorized_filter.html#scipy.ndimage.vectorized_filter "scipy.ndimage.vectorized_filter") for generic filters that + take advantage of a vectorized Python callable was added. +* [`scipy.ndimage.rotate`](../reference/generated/scipy.ndimage.rotate.html#scipy.ndimage.rotate "scipy.ndimage.rotate") has improved performance, especially on ARM platforms. + +### [`scipy.optimize` improvements](#id11)[#](#scipy-optimize-improvements "Link to this heading") + +* COBYLA was updated to use the new Python implementation from the + [PRIMA](https://www.libprima.net) package. + The PRIMA implementation + [fixes many bugs](https://github.com/libprima/prima#bug-fixes) + in the old Fortran 77 implementation. In addition, it results in + [fewer function evaluations on average](https://github.com/libprima/prima#improvements), + but it depends on the problem and for some + problems it can result in more function evaluations or a less optimal + result. For those cases the user can try modifying the initial and final + trust region radii given by `rhobeg` and `tol` respectively. A larger + `rhobeg` can help the algorithm take bigger steps initially, while a + smaller `tol` can help it continue and find a better solution. + For more information, see the [PRIMA documentation](https://www.libprima.net). +* Several of the [`scipy.optimize.minimize`](../reference/generated/scipy.optimize.minimize.html#scipy.optimize.minimize "scipy.optimize.minimize") methods, and the + [`scipy.optimize.least_squares`](../reference/generated/scipy.optimize.least_squares.html#scipy.optimize.least_squares "scipy.optimize.least_squares") function, have been given a `workers` + keyword. This allows parallelization of some calculations via a map-like + callable, such as `multiprocessing.Pool`. These parallelization + opportunities typically occur during numerical differentiation. This can + greatly speed up minimization when the objective function is expensive to + calculate. +* The `lm` method of [`scipy.optimize.least_squares`](../reference/generated/scipy.optimize.least_squares.html#scipy.optimize.least_squares "scipy.optimize.least_squares") can now accept + `3-point` and `cs` for the `jac` keyword. +* The SLSQP Fortran 77 code was ported to C. When this method is used now the + constraint multipliers are exposed to the user through the `multiplier` + keyword of the returned [`OptimizeResult`](../reference/generated/scipy.optimize.OptimizeResult.html#scipy.optimize.OptimizeResult "scipy.optimize.OptimizeResult") object. +* NNLS code has been corrected and rewritten in C to address the performance + regression introduced in 1.15.x +* [`scipy.optimize.root`](../reference/generated/scipy.optimize.root.html#scipy.optimize.root "scipy.optimize.root") now warns for invalid inner parameters when using the + `newton_krylov` method +* The return value of minimization with `method='L-BFGS-B'` now has + a faster `hess_inv.todense()` implementation. Time complexity has improved + from cubic to quadratic. +* [`scipy.optimize.least_squares`](../reference/generated/scipy.optimize.least_squares.html#scipy.optimize.least_squares "scipy.optimize.least_squares") has a new `callback` argument that is applicable + to the `trf` and `dogbox` methods. `callback` may be used to track + optimization results at each step or to provide custom conditions for + stopping. + +### [`scipy.signal` improvements](#id12)[#](#scipy-signal-improvements "Link to this heading") + +* A new function [`scipy.signal.firwin_2d`](../reference/generated/scipy.signal.firwin_2d.html#scipy.signal.firwin_2d "scipy.signal.firwin_2d") for the creation of a 2-D FIR Filter + using the 1-D window method was added. +* [`scipy.signal.cspline1d_eval`](../reference/generated/scipy.signal.cspline1d_eval.html#scipy.signal.cspline1d_eval "scipy.signal.cspline1d_eval") and [`scipy.signal.qspline1d_eval`](../reference/generated/scipy.signal.qspline1d_eval.html#scipy.signal.qspline1d_eval "scipy.signal.qspline1d_eval") now provide + an informative error on empty input rather than hitting the recursion limit. +* A new function [`scipy.signal.closest_STFT_dual_window`](../reference/generated/scipy.signal.closest_STFT_dual_window.html#scipy.signal.closest_STFT_dual_window "scipy.signal.closest_STFT_dual_window") to calculate the + [`ShortTimeFFT`](../reference/generated/scipy.signal.ShortTimeFFT.html#scipy.signal.ShortTimeFFT "scipy.signal.ShortTimeFFT") dual window of a given window closest to a + desired dual window. +* A new classmethod [`scipy.signal.ShortTimeFFT.from_win_equals_dual`](../reference/generated/scipy.signal.ShortTimeFFT.from_win_equals_dual.html#scipy.signal.ShortTimeFFT.from_win_equals_dual "scipy.signal.ShortTimeFFT.from_win_equals_dual") to + create a [`ShortTimeFFT`](../reference/generated/scipy.signal.ShortTimeFFT.html#scipy.signal.ShortTimeFFT "scipy.signal.ShortTimeFFT") instance where the window and its dual + are equal up to a scaling factor. It allows to create short-time Fourier + transforms which are unitary mappings. +* The performance of [`scipy.signal.convolve2d`](../reference/generated/scipy.signal.convolve2d.html#scipy.signal.convolve2d "scipy.signal.convolve2d") was improved. + +### [`scipy.sparse` improvements](#id13)[#](#scipy-sparse-improvements "Link to this heading") + +* [`scipy.sparse.coo_array`](../reference/generated/scipy.sparse.coo_array.html#scipy.sparse.coo_array "scipy.sparse.coo_array") now supports n-D arrays using binary and reduction + operations. +* Faster operations between two DIA arrays/matrices for: add, sub, multiply, + matmul. +* [`scipy.sparse.csgraph.dijkstra`](../reference/generated/scipy.sparse.csgraph.dijkstra.html#scipy.sparse.csgraph.dijkstra "scipy.sparse.csgraph.dijkstra") shortest\_path is more efficient. +* [`scipy.sparse.csgraph.yen`](../reference/generated/scipy.sparse.csgraph.yen.html#scipy.sparse.csgraph.yen "scipy.sparse.csgraph.yen") has performance improvements. +* Support for lazy loading of `sparse.csgraph` and `sparse.linalg` was + added. + +### [`scipy.spatial` improvements](#id14)[#](#scipy-spatial-improvements "Link to this heading") + +* A new class, [`scipy.spatial.transform.RigidTransform`](../reference/generated/scipy.spatial.transform.RigidTransform.html#scipy.spatial.transform.RigidTransform "scipy.spatial.transform.RigidTransform"), provides functionality + to convert between different representations of rigid transforms in 3-D + space, its application to vectors and transform composition. + It follows the same design approach as [`scipy.spatial.transform.Rotation`](../reference/generated/scipy.spatial.transform.Rotation.html#scipy.spatial.transform.Rotation "scipy.spatial.transform.Rotation"). +* [`Rotation`](../reference/generated/scipy.spatial.transform.Rotation.html#scipy.spatial.transform.Rotation "scipy.spatial.transform.Rotation") now has an appropriate `__repr__` method, + and improved performance for its [`apply`](../reference/generated/scipy.spatial.transform.Rotation.apply.html#scipy.spatial.transform.Rotation.apply "scipy.spatial.transform.Rotation.apply") + method. + +### [`scipy.stats` improvements](#id15)[#](#scipy-stats-improvements "Link to this heading") + +* A new function [`scipy.stats.quantile`](../reference/generated/scipy.stats.quantile.html#scipy.stats.quantile "scipy.stats.quantile"), an array API compatible function for + quantile estimation, was added. +* [`scipy.stats.make_distribution`](../reference/generated/scipy.stats.make_distribution.html#scipy.stats.make_distribution "scipy.stats.make_distribution") was extended to work with existing discrete + distributions and to facilitate the creation of custom distributions in the + new random variable infrastructure. +* A new distribution, [`scipy.stats.Binomial`](../reference/generated/scipy.stats.Binomial.html#scipy.stats.Binomial "scipy.stats.Binomial"), was added. +* An `equal_var` keyword was added to [`scipy.stats.tukey_hsd`](../reference/generated/scipy.stats.tukey_hsd.html#scipy.stats.tukey_hsd "scipy.stats.tukey_hsd") (enables the + Games-Howell test) and [`scipy.stats.f_oneway`](../reference/generated/scipy.stats.f_oneway.html#scipy.stats.f_oneway "scipy.stats.f_oneway") (enables Welch ANOVA). +* The moment calculation for [`scipy.stats.gennorm`](../reference/generated/scipy.stats.gennorm.html#scipy.stats.gennorm "scipy.stats.gennorm") was improved. +* The [`scipy.stats.mode`](../reference/generated/scipy.stats.mode.html#scipy.stats.mode "scipy.stats.mode") implementation was vectorized, for faster batch + calculation. +* Support for `axis`, `nan_policy`, and `keepdims` keywords was added to + [`power_divergence`](../reference/generated/scipy.stats.power_divergence.html#scipy.stats.power_divergence "scipy.stats.power_divergence"), [`chisquare`](../reference/generated/scipy.stats.chisquare.html#scipy.stats.chisquare "scipy.stats.chisquare"), + [`pointbiserialr`](../reference/generated/scipy.stats.pointbiserialr.html#scipy.stats.pointbiserialr "scipy.stats.pointbiserialr"), [`kendalltau`](../reference/generated/scipy.stats.kendalltau.html#scipy.stats.kendalltau "scipy.stats.kendalltau"), + [`weightedtau`](../reference/generated/scipy.stats.weightedtau.html#scipy.stats.weightedtau "scipy.stats.weightedtau"), [`theilslopes`](../reference/generated/scipy.stats.theilslopes.html#scipy.stats.theilslopes "scipy.stats.theilslopes"), + [`siegelslopes`](../reference/generated/scipy.stats.siegelslopes.html#scipy.stats.siegelslopes "scipy.stats.siegelslopes"), [`boxcox_llf`](../reference/generated/scipy.stats.boxcox_llf.html#scipy.stats.boxcox_llf "scipy.stats.boxcox_llf"), and + [`linregress`](../reference/generated/scipy.stats.linregress.html#scipy.stats.linregress "scipy.stats.linregress"). +* Support for `keepdims` and `nan_policy` keywords was added to + [`gstd`](../reference/generated/scipy.stats.gstd.html#scipy.stats.gstd "scipy.stats.gstd"). +* The performance of [`scipy.stats.special_ortho_group`](../reference/generated/scipy.stats.special_ortho_group.html#scipy.stats.special_ortho_group "scipy.stats.special_ortho_group") and [`scipy.stats.pearsonr`](../reference/generated/scipy.stats.pearsonr.html#scipy.stats.pearsonr "scipy.stats.pearsonr") + was improved. +* Support for an `rng` keyword argument was added to the `logcdf` and + `cdf` methods of `multivariate_normal_gen` and `multivariate_normal_frozen`. + +## [Array API Standard Support](#id16)[#](#array-api-standard-support "Link to this heading") + +Experimental support for array libraries other than NumPy has been added to +multiple submodules in recent versions of SciPy. Please consider testing +these features by setting the environment variable `SCIPY_ARRAY_API=1` and +providing PyTorch, JAX, CuPy or Dask arrays as array arguments. + +Many functions in [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats"), [`scipy.special`](../reference/special.html#module-scipy.special "scipy.special"), [`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize"), and +[`scipy.constants`](../reference/constants.html#module-scipy.constants "scipy.constants") now provide tables documenting compatible array and device +types as well as support for lazy arrays and JIT compilation. New features with +support and old features with support added for SciPy 1.16.0 include: + +* Most of the [`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") functionality +* [`scipy.ndimage.vectorized_filter`](../reference/generated/scipy.ndimage.vectorized_filter.html#scipy.ndimage.vectorized_filter "scipy.ndimage.vectorized_filter") +* [`scipy.special.stdtrit`](../reference/generated/scipy.special.stdtrit.html#scipy.special.stdtrit "scipy.special.stdtrit") +* [`scipy.special.softmax`](../reference/generated/scipy.special.softmax.html#scipy.special.softmax "scipy.special.softmax") +* [`scipy.special.log_softmax`](../reference/generated/scipy.special.log_softmax.html#scipy.special.log_softmax "scipy.special.log_softmax") +* [`scipy.stats.quantile`](../reference/generated/scipy.stats.quantile.html#scipy.stats.quantile "scipy.stats.quantile") +* [`scipy.stats.gstd`](../reference/generated/scipy.stats.gstd.html#scipy.stats.gstd "scipy.stats.gstd") +* [`scipy.stats.rankdata`](../reference/generated/scipy.stats.rankdata.html#scipy.stats.rankdata "scipy.stats.rankdata") + +Features with extended array API support (generally, improved support +for JAX and Dask) in SciPy 1.16.0 include: + +* many of the [`scipy.cluster.hierarchy`](../reference/cluster.hierarchy.html#module-scipy.cluster.hierarchy "scipy.cluster.hierarchy") functions +* many functions in [`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") +* many of the trimmed statistics functions in [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") + +SciPy now has a CI job that exercises GPU (CUDA) support, and as a result +using PyTorch, CuPy or JAX arrays on GPU with SciPy is now more reliable. + +## [Deprecated features](#id17)[#](#deprecated-features "Link to this heading") + +* The unused `atol` argument of [`scipy.optimize.nnls`](../reference/generated/scipy.optimize.nnls.html#scipy.optimize.nnls "scipy.optimize.nnls") is deprecated and will + be removed in SciPy 1.18.0. +* The `disp` argument of [`scipy.linalg.signm`](../reference/generated/scipy.linalg.signm.html#scipy.linalg.signm "scipy.linalg.signm"), [`scipy.linalg.logm`](../reference/generated/scipy.linalg.logm.html#scipy.linalg.logm "scipy.linalg.logm"), and + [`scipy.linalg.sqrtm`](../reference/generated/scipy.linalg.sqrtm.html#scipy.linalg.sqrtm "scipy.linalg.sqrtm") will be removed in SciPy 1.18.0. +* [`scipy.stats.multinomial`](../reference/generated/scipy.stats.multinomial.html#scipy.stats.multinomial "scipy.stats.multinomial") now emits a `FutureWarning` if the rows of `p` + do not sum to `1.0`. This condition will produce NaNs beginning in SciPy + 1.18.0. +* The `disp` and `iprint` arguments of the `l-bfgs-b` solver of [`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") + have been deprecated, and will be removed in SciPy 1.18.0. + +## [Expired Deprecations](#id18)[#](#expired-deprecations "Link to this heading") + +* `scipy.sparse.conjtransp` has been removed. Use `.T.conj()` instead. +* The `quadrature='trapz'` option has been removed from + [`scipy.integrate.quad_vec`](../reference/generated/scipy.integrate.quad_vec.html#scipy.integrate.quad_vec "scipy.integrate.quad_vec"), and `scipy.stats.trapz` has been removed. Use + `trapezoid` in both instances instead. +* [`scipy.special.comb`](../reference/generated/scipy.special.comb.html#scipy.special.comb "scipy.special.comb") and [`scipy.special.perm`](../reference/generated/scipy.special.perm.html#scipy.special.perm "scipy.special.perm") now raise when `exact=True` + and arguments are non-integral. +* Support for inference of the two sets of measurements from the single + argument `x` has been removed from [`scipy.stats.linregress`](../reference/generated/scipy.stats.linregress.html#scipy.stats.linregress "scipy.stats.linregress"). The data + must be specified separately as `x` and `y`. +* Support for NumPy masked arrays has been removed from + [`scipy.stats.power_divergence`](../reference/generated/scipy.stats.power_divergence.html#scipy.stats.power_divergence "scipy.stats.power_divergence") and [`scipy.stats.chisquare`](../reference/generated/scipy.stats.chisquare.html#scipy.stats.chisquare "scipy.stats.chisquare"). +* A significant number of functions from non-public namespaces + (e.g., `scipy.sparse.base`, `scipy.interpolate.dfitpack`) were cleaned + up. They were previously already emitting deprecation warnings. + +## [Backwards incompatible changes](#id19)[#](#backwards-incompatible-changes "Link to this heading") + +* Several of the [`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") functions for solving a linear system (e.g. + [`solve`](../reference/generated/scipy.linalg.solve.html#scipy.linalg.solve "scipy.linalg.solve")) documented that the RHS argument must be either 1-D or + 2-D but did not always raise an error when the RHS argument had more the + two dimensions. Now, many-dimensional right hand sides are treated according + to the rules specified in [Batched Linear Operations](../tutorial/linalg_batch.html#linalg-batch). +* [`scipy.stats.bootstrap`](../reference/generated/scipy.stats.bootstrap.html#scipy.stats.bootstrap "scipy.stats.bootstrap") now explicitly broadcasts elements of `data` to the + same shape (ignoring `axis`) before performing the calculation. +* Several submodule names are no longer available via `from scipy.signal import *`, + but may still be imported directly, as detailed at + [scipy/scipy-stubs#549](https://github.com/scipy/scipy-stubs/pull/549). + +## [Build and packaging related changes](#id20)[#](#build-and-packaging-related-changes "Link to this heading") + +* The minimum supported version of Clang was bumped from 12.0 to 15.0. +* The lowest supported macOS version for wheels on PyPI is now 10.14 instead of + 10.13. +* The sdist contents were optimized, resulting in a size reduction of about 50%, + from 60 MB to 30 MB. +* For `Cython>=3.1.0`, SciPy now uses the new `cython --generate-shared` + functionality, which reduces the total size of SciPy’s wheels and on-disk + installations significantly. +* SciPy no longer contains an internal shared library that requires RPATH support, + after `sf_error_state` was removed from [`scipy.special`](../reference/special.html#module-scipy.special "scipy.special"). +* A new build option `-Duse-system-libraries` has been added. It allows + opting in to using system libraries instead of using vendored sources. + Currently `Boost.Math` and `Qhull` are supported as system build + dependencies. + +## [Other changes](#id21)[#](#other-changes "Link to this heading") + +* A new accompanying release of `scipy-stubs` (`v1.16.0.0`) is + available. +* The internal dependency of `scipy._lib` on `scipy.sparse` was removed, + which reduces the import time of a number of other SciPy submodules. +* Support for free-threaded CPython was improved: the last known thread-safety + issues in [`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") were fixed, and `pytest-run-parallel` is now used + in a CI job to guard against regressions. +* Support for [spin](https://github.com/scientific-python/spin) as a developer + CLI was added, including support for editable installs. The SciPy-specific + `python dev.py` CLI will be removed in the next release cycle in favor of + `spin`. +* The vendored Qhull library was upgraded from version 2019.1 to 2020.2. +* A large amount of the C++ code in `scipy.special` was moved to the new + header-only [xsf](https://github.com/scipy/xsf) library. That library was + included back in the SciPy source tree as a git submodule. +* The `namedtuple`-like bunch objects returned by some SciPy functions + now have improved compatibility with the `polars` library. +* The output of the `rvs` method of [`scipy.stats.wrapcauchy`](../reference/generated/scipy.stats.wrapcauchy.html#scipy.stats.wrapcauchy "scipy.stats.wrapcauchy") is now mapped to + the unit circle between 0 and `2 * pi`. +* The `lm` method of [`scipy.optimize.least_squares`](../reference/generated/scipy.optimize.least_squares.html#scipy.optimize.least_squares "scipy.optimize.least_squares") now has a different behavior + for the maximum number of function evaluations, `max_nfev`. The default for + the `lm` method is changed to `100 * n`, for both a callable and a + numerically estimated jacobian. This limit on function evaluations excludes + those used for any numerical estimation of the Jacobian. Previously the + default when using an estimated jacobian was `100 * n * (n + 1)`, because + the method included evaluations used in the estimation. In addition, for the + `lm` method the number of function calls used in Jacobian approximation + is no longer included in `OptimizeResult.nfev`. This brings the behavior + of `lm`, `trf`, and `dogbox` into line. + +## [Authors](#id22)[#](#authors "Link to this heading") + +* Name (commits) +* h-vetinari (4) +* aiudirog (1) + +* Anton Akhmerov (2) +* Thorsten Alteholz (1) + +* Gabriel Augusto (1) + +* Backfisch263 (1) + +* Nickolai Belakovski (5) +* Peter Bell (1) +* Benoît W. (1) + +* Evandro Bernardes (1) +* Gauthier Berthomieu (1) + +* Maxwell Bileschi (1) + +* Sam Birch (1) + +* Florian Bourgey (3) + +* Charles Bousseau (2) + +* Richard Strong Bowen (2) + +* Jake Bowhay (127) +* Matthew Brett (1) +* Dietrich Brunn (53) +* Evgeni Burovski (254) +* Christine P. Chai (12) + +* Gayatri Chakkithara (1) + +* Saransh Chopra (2) + +* Omer Cohen (1) + +* Lucas Colley (91) +* Yahya Darman (3) + +* Benjamin Eisele (1) + +* Donnie Erb (1) +* Sagi Ezri (58) + +* Alexander Fabisch (2) + +* Matthew H Flamm (1) +* Karthik Viswanath Ganti (1) + +* Neil Girdhar (1) +* Ralf Gommers (162) +* Rohit Goswami (4) +* Saarthak Gupta (4) + +* Matt Haberland (326) +* Sasha Hafner (1) + +* Joren Hammudoglu (11) +* Chengyu Han (1) + +* Charles Harris (1) +* Kim Hsieh (4) + +* Yongcai Huang (2) + +* Lukas Huber (1) + +* Yuji Ikeda (2) + +* Guido Imperiale (105) + +* Robert Kern (2) +* Harin Khakhi (2) + +* Agriya Khetarpal (4) +* Daniil Kiktenko (1) + +* Kirill R. (2) + +* Tetsuo Koyama (1) +* Jigyasu Krishnan (1) + +* Abhishek Kumar (2) + +* Pratham Kumar (3) + +* David Kun (1) + +* Eric Larson (3) +* lciti (1) +* Antony Lee (1) +* Kieran Leschinski (1) + +* Thomas Li (2) + +* Yuxi Long (2) + +* Christian Lorentzen (2) +* Loïc Estève (4) +* Panos Mavrogiorgos (1) + +* Nikolay Mayorov (2) +* Melissa Weber Mendonça (10) +* Michał Górny (1) +* Miguel Cárdenas (2) + +* Swastik Mishra (1) + +* Sturla Molden (2) +* Andreas Nazlidis (1) + +* Andrew Nelson (209) +* Parth Nobel (1) + +* Nick ODell (9) +* Giacomo Petrillo (1) +* Victor PM (10) + +* pmav99 (1) + +* Ilhan Polat (74) +* Tyler Reddy (128) +* Érico Nogueira Rolim (1) + +* Pamphile Roy (10) +* Mikhail Ryazanov (6) +* Atsushi Sakai (9) +* Marco Salathe (1) + +* sanvi (1) + +* Neil Schemenauer (2) + +* Daniel Schmitz (20) +* Martin Schuck (1) + +* Dan Schult (33) +* Tomer Sery (19) +* Adrian Seyboldt (1) + +* Scott Shambaugh (4) +* ShannonS00 (1) + +* sildater (3) + +* Param Singh (1) + +* G Sreeja (7) + +* Albert Steppi (133) +* Kai Striega (3) +* Anushka Suyal (2) +* Julia Tatz (1) + +* Tearyt (1) + +* Elia Tomasi (1) + +* Jamie Townsend (2) + +* Edgar Andrés Margffoy Tuay (4) +* Matthias Urlichs (1) + +* Mark van Rossum (1) + +* Jacob Vanderplas (2) +* David Varela (2) + +* Christian Veenhuis (3) +* vfdev (1) +* Stefan van der Walt (2) +* Warren Weckesser (5) +* Jason N. White (1) + +* windows-server-2003 (5) +* Zhiqing Xiao (1) +* Pavadol Yamsiri (1) +* Rory Yorke (3) +* Irwin Zaid (4) +* Austin Zhang (1) + +* William Zijie Zhang (1) + +* Zaikun Zhang (1) + +* Zhenyu Zhu (1) + +* Eric Zitong Zhou (11) + +* Case Zumbrum (2) + +* ਗਗਨਦੀਪ ਸਿੰਘ (Gagandeep Singh) (45) + + > A total of 126 people contributed to this release. + > People with a “+” by their names contributed a patch for the first time. + > This list of names is automatically generated, and may not be fully complete. + +## [Issues closed for 1.16.0](#id23)[#](#issues-closed-for-1-16-0 "Link to this heading") + +* [#4800](https://github.com/scipy/scipy/issues/4800): ENH: ndimage.median\_filter: behavior with NaNs +* [#4878](https://github.com/scipy/scipy/issues/4878): ENH: ndimage.median\_filter: excessive memory usage +* [#5137](https://github.com/scipy/scipy/issues/5137): ENH: ndimage.generic\_filter: function to return higher-dimensional… +* [#5435](https://github.com/scipy/scipy/issues/5435): savemat silently drops entries starting with “\_” +* [#5451](https://github.com/scipy/scipy/issues/5451): ENH: linalg.solve: support broadcasting +* [#6052](https://github.com/scipy/scipy/issues/6052): savemat does not save keys starting with underscore +* [#6606](https://github.com/scipy/scipy/issues/6606): BUG: signal.bilinear: can’t handle leading zeros +* [#6689](https://github.com/scipy/scipy/issues/6689): ENH: optimize: consider using NLopt’s version of `slsqp` +* [#6755](https://github.com/scipy/scipy/issues/6755): ENH: ndimage.percentile\_filter: take multiple percentiles +* [#7518](https://github.com/scipy/scipy/issues/7518): DOC: optimize: meaning of accuracy in `fmin_slsqp` undocumented +* [#7818](https://github.com/scipy/scipy/issues/7818): ENH: ndimage.uniform\_filter: expands NaNs all the way to the… +* [#8140](https://github.com/scipy/scipy/issues/8140): sparse LU decomposition does not solve with complex right-hand… +* [#8367](https://github.com/scipy/scipy/issues/8367): ENH: stats.mvndst: make thread-safe +* [#8411](https://github.com/scipy/scipy/issues/8411): nan with betainc for a=0, b=3 and x=0.5 +* [#8916](https://github.com/scipy/scipy/issues/8916): ENH: ndimage.generic\_filter: slow on large images +* [#9077](https://github.com/scipy/scipy/issues/9077): maximum\_filter is not symmetrical with nans +* [#9841](https://github.com/scipy/scipy/issues/9841): ENH: linalg: 0-th dimension must be fixed to 1 but got 2 (real… +* [#9873](https://github.com/scipy/scipy/issues/9873): ENH: ndimage: majority voting filter +* [#10416](https://github.com/scipy/scipy/issues/10416): ENH: optimize.minimize: slsqp: give better error when work array… +* [#10793](https://github.com/scipy/scipy/issues/10793): BUG: integrate: `solve_ivp` and `odeint` with `lsoda` have… +* [#11312](https://github.com/scipy/scipy/issues/11312): BUG: signal.cont2discrete not handling lti instances as documented +* [#11328](https://github.com/scipy/scipy/issues/11328): Scipy unable to read piped wav file +* [#12133](https://github.com/scipy/scipy/issues/12133): How to define new distributions? +* [#12544](https://github.com/scipy/scipy/issues/12544): signal.spectral.\_triage\_segments doesn’t support window as tuple… +* [#12994](https://github.com/scipy/scipy/issues/12994): ENH: linalg.sqrtm: efficiently process upper triangular matrices +* [#13577](https://github.com/scipy/scipy/issues/13577): Split scipy.signal.spectral.\_spectral\_helper into two to support… +* [#13666](https://github.com/scipy/scipy/issues/13666): ENH: invgauss.pdf should return correct output when mu=infinity +* [#13788](https://github.com/scipy/scipy/issues/13788): Documentation for scipy.signal.resample should say what to use… +* [#13789](https://github.com/scipy/scipy/issues/13789): Documentation for scipy.signal.decimate doesn’t say what to use… +* [#13823](https://github.com/scipy/scipy/issues/13823): BUG: signal.bilinear: doesn’t work for complex valued arrays +* [#13914](https://github.com/scipy/scipy/issues/13914): DOC: sparse.csgraph.shortest\_path: predecessors array contains… +* [#13952](https://github.com/scipy/scipy/issues/13952): fmin\_cobyla result violates constraint +* [#13982](https://github.com/scipy/scipy/issues/13982): ENH: linalg.eigh\_tridiagonal: divide and conquer option +* [#14394](https://github.com/scipy/scipy/issues/14394): ENH: optimize.slsqp: return Lagrange multipliers +* [#14569](https://github.com/scipy/scipy/issues/14569): BUG: signal.resample: inconsistency across dtypes +* [#14915](https://github.com/scipy/scipy/issues/14915): BUG: optimize.minimize: corruption/segfault with constraints +* [#15153](https://github.com/scipy/scipy/issues/15153): BUG: signal.resample: incorrect with `datetime[ns]` for `t`… +* [#15527](https://github.com/scipy/scipy/issues/15527): BUG: optimize: COBYLA hangs on some CPUs +* [#16009](https://github.com/scipy/scipy/issues/16009): BUG: `act` fails for local GitHub Actions CI run +* [#16142](https://github.com/scipy/scipy/issues/16142): ENH: Fix the random state in `scipy.stats.multivariate_normal.cdf()` +* [#16203](https://github.com/scipy/scipy/issues/16203): BUG: scipy.io.savemat discards nested names with a leading digit +* [#16234](https://github.com/scipy/scipy/issues/16234): BUG: Memory leak in \_superluobject.c when `ENUM_CHECK` is not… +* [#16452](https://github.com/scipy/scipy/issues/16452): doit based dev interface garbles pdb command history (in some… +* [#17546](https://github.com/scipy/scipy/issues/17546): ENH: Adding ‘valid’ mode to ndimage.generic\_filter +* [#17787](https://github.com/scipy/scipy/issues/17787): BUG: Erratic results from RectBivariateSpline when smoothing… +* [#17891](https://github.com/scipy/scipy/issues/17891): BUG: inconsistent checks for integrality in several distributions +* [#17968](https://github.com/scipy/scipy/issues/17968): ENH: creation of a 2-D FIR Filter using 1-D window method +* [#18046](https://github.com/scipy/scipy/issues/18046): BUG: dev.py does not work in a Windows CI environment on GHA… +* [#18105](https://github.com/scipy/scipy/issues/18105): ENH: optimize `LbfgsInvHessProduct.todense()`, 10x speed… +* [#18118](https://github.com/scipy/scipy/issues/18118): ENH: The Fortran 77 implementation of COBYLA is buggy and challenging… +* [#18214](https://github.com/scipy/scipy/issues/18214): DOC: inconsistent definitions of “OP” and “OPinv” in eigsh +* [#18346](https://github.com/scipy/scipy/issues/18346): DOC: optimize: l\_bfgs\_b: sets `maxiter` and `maxfun` to the… +* [#18437](https://github.com/scipy/scipy/issues/18437): ENH: ndimage.generic\_filter: support complex input +* [#18740](https://github.com/scipy/scipy/issues/18740): BUG: scipy.optimize.bisect gives incorrect results for very small… +* [#18866](https://github.com/scipy/scipy/issues/18866): MAINT: follow-up actions for array API support in `cluster` +* [#18951](https://github.com/scipy/scipy/issues/18951): ENH: improve `python dev.py test` experience caused by imp… +* [#18998](https://github.com/scipy/scipy/issues/18998): BUG: dev.py has issues with site-packages and Python installed… +* [#19254](https://github.com/scipy/scipy/issues/19254): ENH: spatial.transform: cover proper rigid transformations with… +* [#19362](https://github.com/scipy/scipy/issues/19362): BUG: optimize: warning generated by SLSQP is useless +* [#19415](https://github.com/scipy/scipy/issues/19415): BUG: linalg.sqrtm results different between version 1.11.1 and… +* [#19459](https://github.com/scipy/scipy/issues/19459): BUG: optimize.least\_squares giving poor result compared to optimize.leastsq… +* [#20219](https://github.com/scipy/scipy/issues/20219): BUG: failing `sqrtm` regression test +* [#20366](https://github.com/scipy/scipy/issues/20366): ENH: Yens algorithm improvements and enhancements +* [#20608](https://github.com/scipy/scipy/issues/20608): BUG: `refguide-check` incorrectly flags references to equations… +* [#20622](https://github.com/scipy/scipy/issues/20622): DOC: signal: add an example cross-spectrogram application +* [#20806](https://github.com/scipy/scipy/issues/20806): Failures for new `pytest-fail-slow` check in Windows CI jobs +* [#20972](https://github.com/scipy/scipy/issues/20972): BUG: special.chdtrc: returns 1.0 when both degrees of freedom… +* [#20999](https://github.com/scipy/scipy/issues/20999): BUG: ndimage.zoom: wrong output with zoom factor of 1 +* [#21020](https://github.com/scipy/scipy/issues/21020): DOC: signal: Use `where='post'` when plotting discrete response +* [#21095](https://github.com/scipy/scipy/issues/21095): DOC: `RegularGridInterpolator` uses half down rounding instead… +* [#21102](https://github.com/scipy/scipy/issues/21102): RFC/ENH?: `optimize.curve_fit`: option to use global optimization… +* [#21293](https://github.com/scipy/scipy/issues/21293): DOC: stats.qmc.discrepancy: clarify deviation from reference +* [#21317](https://github.com/scipy/scipy/issues/21317): BUG: `special.gammainc`: returns finite results with NaN… +* [#21323](https://github.com/scipy/scipy/issues/21323): DOC: build fails with Sphinx 8 +* [#21341](https://github.com/scipy/scipy/issues/21341): DOC: signal.correlate: formula doesn’t match behavior when `x`… +* [#21484](https://github.com/scipy/scipy/issues/21484): DEP: optimize.nnls: deprecate atol parameter which does nothing +* [#21531](https://github.com/scipy/scipy/issues/21531): MAINT: `stats.dirichlet_multinomial`: relax `n` to `>=0` +* [#21547](https://github.com/scipy/scipy/issues/21547): STY/DEV: fix and enable lint rule UP038 +* [#21606](https://github.com/scipy/scipy/issues/21606): ENH: stats: generic power law with negative index +* [#21649](https://github.com/scipy/scipy/issues/21649): RFC: Splitting off special function scalar kernels into separate… +* [#21692](https://github.com/scipy/scipy/issues/21692): BUG: optimize.shgo: not working with `jac=True` +* [#21717](https://github.com/scipy/scipy/issues/21717): DOC: `assert_allclose` instead of `xp_assert_close` is recommended… +* [#21740](https://github.com/scipy/scipy/issues/21740): CI: adding a GPU-enabled CI job +* [#21764](https://github.com/scipy/scipy/issues/21764): ENH: linalg.lapack: add symmetric solvers +* [#21844](https://github.com/scipy/scipy/issues/21844): ENH: linalg: wrap ?gbcon/?langb and use in linalg.solve +* [#21879](https://github.com/scipy/scipy/issues/21879): BUG: `scipy.datasets` failing with Error 403 for readthedocs… +* [#21971](https://github.com/scipy/scipy/issues/21971): ENH: `ndimage.median_filter`: extended `dtype` support? +* [#21972](https://github.com/scipy/scipy/issues/21972): STY: fix and enable lint rule UP031 +* [#21986](https://github.com/scipy/scipy/issues/21986): ENH: optimize.root: warn when inner parameters are ignored with… +* [#21995](https://github.com/scipy/scipy/issues/21995): BUG: `optimize.curve_fit` with `method='lm'` fails to determine… +* [#21999](https://github.com/scipy/scipy/issues/21999): ENH: `io.mmread`: Provide better error message when loading… +* [#22000](https://github.com/scipy/scipy/issues/22000): DOC: `ndimage.median_filter`: document behaviour with `nan`... +* [#22011](https://github.com/scipy/scipy/issues/22011): BUG: interpolate.Akima1DInterpolator: different values on subsequent… +* [#22044](https://github.com/scipy/scipy/issues/22044): TST: `optimize.elementwise.bracket_minimum`: CuPy failure +* [#22045](https://github.com/scipy/scipy/issues/22045): DOC: stats: clarify the support of a distribution is unaffected… +* [#22051](https://github.com/scipy/scipy/issues/22051): BUG: AttributeError: module ‘numpy’ has no attribute ‘AxisError’… +* [#22054](https://github.com/scipy/scipy/issues/22054): BUG: ndimage, array types: `minimum_position` and `extrema`… +* [#22055](https://github.com/scipy/scipy/issues/22055): DOC: ndimage.minimum and maximum: incorrect return type +* [#22057](https://github.com/scipy/scipy/issues/22057): DOC: `stats.order_statistic`: docstring missing the “Returns”… +* [#22065](https://github.com/scipy/scipy/issues/22065): DOC: sparse: Several functions are missing the ‘Returns’ section… +* [#22072](https://github.com/scipy/scipy/issues/22072): DOC: PchipInterpolator: missing integrate function +* [#22086](https://github.com/scipy/scipy/issues/22086): MAINT: signal: build warning (`sprintf`) on macOS +* [#22093](https://github.com/scipy/scipy/issues/22093): DOC: integrate.quad: uses Gauss-Kronrod not Curtis-Clenshaw? +* [#22136](https://github.com/scipy/scipy/issues/22136): DOC: linalg.matrix\_balance: equation does not render +* [#22144](https://github.com/scipy/scipy/issues/22144): Query: optimize.minimize: trust\_constr does not avoid Nonlinear… +* [#22163](https://github.com/scipy/scipy/issues/22163): DOC: update `scipy` module docstring for lazy loading +* [#22164](https://github.com/scipy/scipy/issues/22164): MAINT: undo ignored errors in mypy +* [#22195](https://github.com/scipy/scipy/issues/22195): Query: optimize.basinhopping: lowest minimum not accepted if… +* [#22224](https://github.com/scipy/scipy/issues/22224): MAINT: remove end year from copyright +* [#22252](https://github.com/scipy/scipy/issues/22252): MAINT: Fix a dtype check in `scipy.signal._waveforms.py` +* [#22258](https://github.com/scipy/scipy/issues/22258): BUG: Constructing sparse matrix with big-endian float32/64 raises… +* [#22263](https://github.com/scipy/scipy/issues/22263): BUG: linalg.solve doesn’t raise an error when A is a singular… +* [#22265](https://github.com/scipy/scipy/issues/22265): BUG: linalg: `hecon` returns NaN incorrectly with some lower… +* [#22271](https://github.com/scipy/scipy/issues/22271): Query: empty `Rotation` is not allowed in scipy=1.15 +* [#22282](https://github.com/scipy/scipy/issues/22282): QUERY/DEV: test failure in IDE with `SCIPY_ARRAY_API` +* [#22288](https://github.com/scipy/scipy/issues/22288): QUERY: Pyright raises error/warning in IDE +* [#22294](https://github.com/scipy/scipy/issues/22294): DOC: `source` now links to top of file, not location within… +* [#22303](https://github.com/scipy/scipy/issues/22303): ENH: stats.special\_ortho\_group: improve and simplify +* [#22309](https://github.com/scipy/scipy/issues/22309): DOC: optimize.elementwise.find\_minimum: harmonize documented/implemented… +* [#22328](https://github.com/scipy/scipy/issues/22328): QUERY: stats.beta.fit: `FitError` on reasonable data +* [#22338](https://github.com/scipy/scipy/issues/22338): QUERY: Intellisense Autocomplete Not Working for `spatial.transform.Rotation` +* [#22361](https://github.com/scipy/scipy/issues/22361): BUG: interpolation test TestSmoothingSpline.test\_compare\_with\_GCVSPL… +* [#22363](https://github.com/scipy/scipy/issues/22363): BUG: special test TestHyp2f1.test\_region3[hyp2f1\_test\_case23]… +* [#22367](https://github.com/scipy/scipy/issues/22367): QUERY/TYP: sparse: Pylance reports unreachable after `toarray()` +* [#22378](https://github.com/scipy/scipy/issues/22378): DOC/TST: interpolate, signal: `smoke-docs` failures +* [#22382](https://github.com/scipy/scipy/issues/22382): ENH: sparse.spmatrix: allow fast import +* [#22395](https://github.com/scipy/scipy/issues/22395): BUG: special: failure of TestSystematic.test\_besselj\_complex… +* [#22403](https://github.com/scipy/scipy/issues/22403): DOC: `gaussian_kde`‘s `bw_method='silverman'` deviates… +* [#22415](https://github.com/scipy/scipy/issues/22415): Two `TestBatch` failures in macOS x86-64 Accelerate wheel build… +* [#22429](https://github.com/scipy/scipy/issues/22429): DOC: integrate: missing bold font for a vector in tutorial +* [#22437](https://github.com/scipy/scipy/issues/22437): DOC: The code of conduct link is dead +* [#22449](https://github.com/scipy/scipy/issues/22449): BUG: sparse.csgraph.construct\_dist\_matrix: buffer dtype mismatch +* [#22450](https://github.com/scipy/scipy/issues/22450): QUERY: difference between `namedtuple`s and objects produced… +* [#22461](https://github.com/scipy/scipy/issues/22461): DOC: freqz\_sos: claims that it was introduced in 0.19; no mention… +* [#22470](https://github.com/scipy/scipy/issues/22470): BUG: `lfiltic`‘s handling of `a[0] != 1` differs from `lfilter`... +* [#22485](https://github.com/scipy/scipy/issues/22485): DOC: remove links to the reference guide in the tutorials page +* [#22488](https://github.com/scipy/scipy/issues/22488): DOC: interpolate.lagrange: the Lagrange function is using the… +* [#22495](https://github.com/scipy/scipy/issues/22495): BUG: special test TestHyp2f1.test\_region4[hyp2f1\_test\_case42]… +* [#22501](https://github.com/scipy/scipy/issues/22501): BUG: `min_weight_full_bipartite_matching` fails for `coo_matrix`… +* [#22508](https://github.com/scipy/scipy/issues/22508): DOC: Inconsistent notation in Linear algebra (scipy.linalg) page +* [#22534](https://github.com/scipy/scipy/issues/22534): CI: failures `*/tests/test_extending` due to a regression in… +* [#22559](https://github.com/scipy/scipy/issues/22559): BUG: `ndimage`: Numerical regressions in Dask 2025.2.0 +* [#22565](https://github.com/scipy/scipy/issues/22565): BUG: stats.multinomial.pmf: inconsistent results? +* [#22581](https://github.com/scipy/scipy/issues/22581): DOC: stats.gaussian\_kde: clarify the meaning of `factor` +* [#22591](https://github.com/scipy/scipy/issues/22591): BUG: sparse.coo: `ImportError` for `upcast` +* [#22601](https://github.com/scipy/scipy/issues/22601): BUG: special.logsumexp: inconsistency in phase when one element… +* [#22626](https://github.com/scipy/scipy/issues/22626): BUG: scipy.stats: tmin/tmax: loss of precision for large integers +* [#22646](https://github.com/scipy/scipy/issues/22646): CI/DOC: CloughTocher2DInterpolator: `UserWarning` in docs build +* [#22659](https://github.com/scipy/scipy/issues/22659): BUG: spatial: `RigidTransform` does not support zero-length… +* [#22692](https://github.com/scipy/scipy/issues/22692): DOC: interpolate.make\_smoothing\_spline: example plot uses the… +* [#22700](https://github.com/scipy/scipy/issues/22700): CI: new failures: segfault in free-threaded, `linprog` invalid… +* [#22703](https://github.com/scipy/scipy/issues/22703): DOC: integrate: `quad_vec` info return type is `_Bunch` not… +* [#22767](https://github.com/scipy/scipy/issues/22767): BUG: test\_cython Failing on Windows on ARM64 with clang-cl +* [#22768](https://github.com/scipy/scipy/issues/22768): DOC/DEV: outdated references to Cirrus CI +* [#22769](https://github.com/scipy/scipy/issues/22769): ENH: optimize: Return bound multiplier for SLSQP +* [#22775](https://github.com/scipy/scipy/issues/22775): ENH: Use cython shared utility module +* [#22791](https://github.com/scipy/scipy/issues/22791): BUG: optimize.nnls: unstable on i686 (32-bit) machine +* [#22800](https://github.com/scipy/scipy/issues/22800): BUG: `signal.windows.kaiser_bessel_derived` uses `array`… +* [#22881](https://github.com/scipy/scipy/issues/22881): DOC: Update minimum NumPy and Python in toolchain roadmap +* [#22904](https://github.com/scipy/scipy/issues/22904): BUG: Wrong use of `__builtin_prefetch()` +* [#22912](https://github.com/scipy/scipy/issues/22912): BUG: optimize: `SyntaxWarning: 'break' in a 'finally' block`… +* [#22920](https://github.com/scipy/scipy/issues/22920): BUG: `check_test_name` fails with `UnicodeDecodeError`? +* [#22921](https://github.com/scipy/scipy/issues/22921): DOC: clarify the status of Apple’s Accelerate Framework support +* [#22931](https://github.com/scipy/scipy/issues/22931): BUG: interpolate.\_dierckx: `check_array()` can crash if the… +* [#22942](https://github.com/scipy/scipy/issues/22942): TST: `special`: `test_compiles_in_cupy` is broken +* [#22945](https://github.com/scipy/scipy/issues/22945): TST: Nested arrays failing in array-api-strict git tip +* [#22951](https://github.com/scipy/scipy/issues/22951): BUG: stats.wrapcauchy: output isn’t wrapped around the unit circle +* [#22956](https://github.com/scipy/scipy/issues/22956): BUG: special.\_ufuncs.\_ncx2\_pdf: interpreter crash with extreme… +* [#22965](https://github.com/scipy/scipy/issues/22965): BUG: The attribute “nit” is not found when using the callback… +* [#22981](https://github.com/scipy/scipy/issues/22981): Bug with freqz when specifying worN after #22886 +* [#23035](https://github.com/scipy/scipy/issues/23035): TST: theilsope & siegelslope-related tests are failing on PyPy3.11… +* [#23036](https://github.com/scipy/scipy/issues/23036): BUG: signal.csd: doesn’t zero-pad for different size inputs in… +* [#23038](https://github.com/scipy/scipy/issues/23038): DOC: `linalg.toeplitz` does not support batching like the `1.16.0rc1`… +* [#23046](https://github.com/scipy/scipy/issues/23046): ENH: `vectorized_filter`: special case of scalar `size`… +* [#23061](https://github.com/scipy/scipy/issues/23061): DOC: Wrong SPDX identifier for OpenBLAS and LAPACK +* [#23068](https://github.com/scipy/scipy/issues/23068): BUG: sparse: `!=` operator with csr matrices +* [#23109](https://github.com/scipy/scipy/issues/23109): BUG: spatial.distance.cdist: wrong result in Yule metric +* [#23169](https://github.com/scipy/scipy/issues/23169): BUG: special.betainc: evaluates incorrectly to nan when `b=0` +* [#23184](https://github.com/scipy/scipy/issues/23184): BUG: min Python version enforcement in 1.16.x series? (and main) +* [#23186](https://github.com/scipy/scipy/issues/23186): BUG: scipy.optimize minimize routine does not show info logs… + +## [Pull requests for 1.16.0](#id24)[#](#pull-requests-for-1-16-0 "Link to this heading") + +* [#18375](https://github.com/scipy/scipy/pull/18375): ENH: signal: Add `firwin_2d` filter +* [#20610](https://github.com/scipy/scipy/pull/20610): ENH: signal.ShortTimeFFT: determine arbitrary dual windows +* [#20639](https://github.com/scipy/scipy/pull/20639): ENH: stats.rankdata: add array API standard support +* [#20717](https://github.com/scipy/scipy/pull/20717): ENH: Speed up sparse.csgraph.dijkstra 2.0 +* [#20772](https://github.com/scipy/scipy/pull/20772): ENH: array types, signal: delegate to CuPy and JAX for correlations… +* [#20950](https://github.com/scipy/scipy/pull/20950): ENH: spatial: speed up `Rotation.apply` by replacing `np.einsum`… +* [#21180](https://github.com/scipy/scipy/pull/21180): ENH: sparse: efficient arithmetic operations for DIA format +* [#21233](https://github.com/scipy/scipy/pull/21233): ENH: `stats.boxcox_llf`: vectorize for n-D arrays +* [#21270](https://github.com/scipy/scipy/pull/21270): MAINT: make `boost_math` a `subproject` +* [#21462](https://github.com/scipy/scipy/pull/21462): ENH: linalg.eig: support batched input +* [#21482](https://github.com/scipy/scipy/pull/21482): MAINT/DEV: use Sphinx 8 for documentation builds +* [#21557](https://github.com/scipy/scipy/pull/21557): ENH: `stats._continued_fraction`: elementwise, Array API… +* [#21628](https://github.com/scipy/scipy/pull/21628): BUG:signal: Fix passing lti as system to cont2discrete +* [#21674](https://github.com/scipy/scipy/pull/21674): DEV: use `spin` +* [#21684](https://github.com/scipy/scipy/pull/21684): MAINT: `stats.dirichlet_multinomial` relax `n` to `>= 0` +* [#21713](https://github.com/scipy/scipy/pull/21713): ENH: signal: add array API support / delegation to lfilter et… +* [#21783](https://github.com/scipy/scipy/pull/21783): ENH: signal.windows: add array API support (take 2) +* [#21863](https://github.com/scipy/scipy/pull/21863): CI: use macos-15 for a macOS run +* [#21987](https://github.com/scipy/scipy/pull/21987): STY: fix lint rule UP031 +* [#22008](https://github.com/scipy/scipy/pull/22008): ENH: signal.vectorstrength: add array API standard support +* [#22010](https://github.com/scipy/scipy/pull/22010): REL: set version to 1.16.0.dev0 +* [#22012](https://github.com/scipy/scipy/pull/22012): MAINT: bump min NumPy to 1.25.2, min Python to 3.11 +* [#22013](https://github.com/scipy/scipy/pull/22013): DEV: `gh_lists`: fix asterisk sanitisation +* [#22015](https://github.com/scipy/scipy/pull/22015): DEV: lint: add option to lint all files +* [#22019](https://github.com/scipy/scipy/pull/22019): MAINT: signal: remove tempita templating +* [#22042](https://github.com/scipy/scipy/pull/22042): DOC, MAINT: Add a `"jupyterlite_sphinx_strip"` tag to the `scipy.stats`… +* [#22046](https://github.com/scipy/scipy/pull/22046): TST: optimize: fix CuPy failure for `bracket_minimum` +* [#22052](https://github.com/scipy/scipy/pull/22052): DOC: sparse.linalg: add note about complex matrices to `splu`… +* [#22056](https://github.com/scipy/scipy/pull/22056): MAINT: stats.wilcoxon: fix attempt to access np.AxisError +* [#22061](https://github.com/scipy/scipy/pull/22061): BUG: ndimage: convert array scalars on return +* [#22062](https://github.com/scipy/scipy/pull/22062): MAINT: `_lib`: co-vendor array-api-extra and array-api-compat +* [#22064](https://github.com/scipy/scipy/pull/22064): MAINT: `sparse.linalg._isolve`: Remove postprocess function +* [#22068](https://github.com/scipy/scipy/pull/22068): ENH: optimize: migrate to use sparray +* [#22070](https://github.com/scipy/scipy/pull/22070): ENH: `_lib`: JAX support (non-jitted) +* [#22071](https://github.com/scipy/scipy/pull/22071): MAINT: Use `ENUM_CHECK_NAME` for avoiding memory leaks in `_superluobject.c` +* [#22073](https://github.com/scipy/scipy/pull/22073): DEP: sparse: remove conjtransp +* [#22074](https://github.com/scipy/scipy/pull/22074): DEP: remove remaining trapz references +* [#22075](https://github.com/scipy/scipy/pull/22075): DEP: stats.linregress: remove one arg use +* [#22076](https://github.com/scipy/scipy/pull/22076): BUG: datasets: add headers to fetchers to avoid 403 errors +* [#22079](https://github.com/scipy/scipy/pull/22079): DEP: stats: remove support for masked arrays from `power_divergence`… +* [#22087](https://github.com/scipy/scipy/pull/22087): DEP: special: raise error for non-integer types with exact=True… +* [#22088](https://github.com/scipy/scipy/pull/22088): TST: optimize.elementwise.find\_root: refactor tests to use `find_root`… +* [#22089](https://github.com/scipy/scipy/pull/22089): TST: optimize: suppress incorrect sparray warning from scikit-sparse +* [#22090](https://github.com/scipy/scipy/pull/22090): ENH: optimize: migrate to sparray (docs) +* [#22092](https://github.com/scipy/scipy/pull/22092): MAINT: signal: fixed build warning (`sprintf`) on MacOS +* [#22100](https://github.com/scipy/scipy/pull/22100): DEP: signal.spline: use standard submodule deprecation machinery +* [#22101](https://github.com/scipy/scipy/pull/22101): DOC: update `stats`, `integrate`, `optimize`, and… +* [#22108](https://github.com/scipy/scipy/pull/22108): CI: Run ‘Checkout scipy’ and ‘Check for skips’ only on Github… +* [#22110](https://github.com/scipy/scipy/pull/22110): TST: linalg: use infinity norm of matrix when norm=’I’ +* [#22115](https://github.com/scipy/scipy/pull/22115): DOC: release notes: ensure TOC links to headings below +* [#22116](https://github.com/scipy/scipy/pull/22116): DOC: update the interpolate roadmap +* [#22122](https://github.com/scipy/scipy/pull/22122): MAINT: signal.oaconvolve: avoid xp <-> numpy conversions +* [#22125](https://github.com/scipy/scipy/pull/22125): TST: stats: ensure tests are thread-safe +* [#22127](https://github.com/scipy/scipy/pull/22127): ENH: linalg: add batch support for matrix -> scalar funcs +* [#22130](https://github.com/scipy/scipy/pull/22130): TST: ndimage: array API-related cosmetic tweaks in tests +* [#22131](https://github.com/scipy/scipy/pull/22131): TST: `skip|xfail_xp_backends` disregards `reason=` +* [#22132](https://github.com/scipy/scipy/pull/22132): TST: array types: enforce namespace in tests +* [#22133](https://github.com/scipy/scipy/pull/22133): ENH: linalg: add batch support for functions that accept a single… +* [#22140](https://github.com/scipy/scipy/pull/22140): DOC: linalg.matrix\_balance: move math to notes; ensure that it… +* [#22142](https://github.com/scipy/scipy/pull/22142): ENH: signal: add CuPy/JAX delegation to scipy.signal +* [#22148](https://github.com/scipy/scipy/pull/22148): TST: ndimage: fix test skip typo +* [#22152](https://github.com/scipy/scipy/pull/22152): ENH: stats.f\_oneway: add `equal_var` for Welch ANOVA +* [#22154](https://github.com/scipy/scipy/pull/22154): ENH: linalg.clarkson\_woodruff\_transform: add batch support +* [#22155](https://github.com/scipy/scipy/pull/22155): ENH: stats: add axis/nan\_policy/keepdims/etc. support to correlation… +* [#22157](https://github.com/scipy/scipy/pull/22157): ENH: linalg: add batch support for remaining cholesky functions +* [#22160](https://github.com/scipy/scipy/pull/22160): DEP: interpolate: remove incidental imports from private modules +* [#22161](https://github.com/scipy/scipy/pull/22161): DOC, MAINT: Add updates for interactive notebooks via `jupyterlite-sphinx`… +* [#22165](https://github.com/scipy/scipy/pull/22165): ENH: linalg: add batch support to remaining eigenvalue functions +* [#22166](https://github.com/scipy/scipy/pull/22166): ENH: linalg.block\_diag: add batch support +* [#22169](https://github.com/scipy/scipy/pull/22169): MAINT: sparse: refactor CSC to use CSR sparsetools +* [#22170](https://github.com/scipy/scipy/pull/22170): ENH: signal: convert `symiirorder` and related filters to work… +* [#22172](https://github.com/scipy/scipy/pull/22172): MAINT: improve overflow handling in factorial functions +* [#22173](https://github.com/scipy/scipy/pull/22173): DOC: interpolate: add missing method `integrate` for `PchipInterpolator` +* [#22174](https://github.com/scipy/scipy/pull/22174): MAINT: optimize: switch suppress\_warnings to catch\_warnings +* [#22176](https://github.com/scipy/scipy/pull/22176): MAINT: special: Move Faddeeva into xsf +* [#22179](https://github.com/scipy/scipy/pull/22179): DOC/DEV: mention `scipy-stubs` in building from source guide +* [#22182](https://github.com/scipy/scipy/pull/22182): TST: ndimage: cupy tweaks for inplace out= +* [#22185](https://github.com/scipy/scipy/pull/22185): ENH: stats.tukey\_hsd: `equal_var=False` option to perform Games-Howell… +* [#22186](https://github.com/scipy/scipy/pull/22186): DOC: interpolate: add a note about rounding rule of the `nearest`… +* [#22190](https://github.com/scipy/scipy/pull/22190): MAINT: special: Migrate remaining exp and log functions to xsf +* [#22192](https://github.com/scipy/scipy/pull/22192): ENH: linalg: add batch support to linear system solvers +* [#22196](https://github.com/scipy/scipy/pull/22196): DOC: update scipy module docstring for lazy loading +* [#22197](https://github.com/scipy/scipy/pull/22197): ENH: linalg.cossin: add batch support +* [#22198](https://github.com/scipy/scipy/pull/22198): DOC: basinhopping, clarify when lowest\_optimization\_result is… +* [#22201](https://github.com/scipy/scipy/pull/22201): DOC: Clarify support behavior in rv\_continuous documentation +* [#22208](https://github.com/scipy/scipy/pull/22208): ENH: io.wavfile: read unseekable files +* [#22211](https://github.com/scipy/scipy/pull/22211): DOC: interpolate: add missed `integrate` doc link for `Akima1DInterpolator` +* [#22212](https://github.com/scipy/scipy/pull/22212): ENH: linalg: wrap ?gbcon +* [#22213](https://github.com/scipy/scipy/pull/22213): BUG: zpk2tf works correctly with complex k, real p, z +* [#22214](https://github.com/scipy/scipy/pull/22214): TST: make torch default dtype configurable +* [#22215](https://github.com/scipy/scipy/pull/22215): ENH: io: throw `FileNotFoundError` exception when the source… +* [#22216](https://github.com/scipy/scipy/pull/22216): TST: TestBracketMinimum MPS shims +* [#22217](https://github.com/scipy/scipy/pull/22217): ENH: linalg: wrap ?langb +* [#22219](https://github.com/scipy/scipy/pull/22219): ENH: `_lib`: deobfuscate `jax.jit` crash in `_asarray` +* [#22220](https://github.com/scipy/scipy/pull/22220): MAINT: stats: replace nonstandard calls in (mostly) array API… +* [#22221](https://github.com/scipy/scipy/pull/22221): MAINT: linalg.leslie: use \_apply\_over\_batch +* [#22222](https://github.com/scipy/scipy/pull/22222): ENH: `special`/`stats`: implement xp-compatible `stdtrit`… +* [#22226](https://github.com/scipy/scipy/pull/22226): ENH: signal.upfirdn: array API standard support +* [#22227](https://github.com/scipy/scipy/pull/22227): TST: linalg: add missing lower arguments in test\_sy\_hetrs +* [#22228](https://github.com/scipy/scipy/pull/22228): ENH: linalg.lapack: wrap ?sytri and ?hetri +* [#22229](https://github.com/scipy/scipy/pull/22229): MAINT: cluster: remove unnecessary namespace changes +* [#22231](https://github.com/scipy/scipy/pull/22231): ENH: add `callback` to `optimize.least_squares` +* [#22234](https://github.com/scipy/scipy/pull/22234): MAINT: forward port 1.15.0 relnotes +* [#22237](https://github.com/scipy/scipy/pull/22237): BENCH: sparse.csgraph.dijkstra: add benchmark +* [#22240](https://github.com/scipy/scipy/pull/22240): ENH: array types: add dask.array support +* [#22242](https://github.com/scipy/scipy/pull/22242): MAINT: integrate.cubature: fix undefined `asarray` use +* [#22243](https://github.com/scipy/scipy/pull/22243): DOC: sparse: docstring example of random\_array with uint32 data\_sampler +* [#22251](https://github.com/scipy/scipy/pull/22251): ENH: linalg.solve: use langb +* [#22255](https://github.com/scipy/scipy/pull/22255): EHN: cluster: JAX support (non-jitted) +* [#22256](https://github.com/scipy/scipy/pull/22256): ENH: special: JAX support (non-jitted) +* [#22259](https://github.com/scipy/scipy/pull/22259): TST: signal: fix symiir tests +* [#22260](https://github.com/scipy/scipy/pull/22260): TST: Make `@pytest.mark.usefixtures("skip_xp_backends")` redundant +* [#22261](https://github.com/scipy/scipy/pull/22261): TST: dev.py quietly ignores user markers +* [#22262](https://github.com/scipy/scipy/pull/22262): TST: Mark with `xp` all tests in Array API-compatible modules +* [#22264](https://github.com/scipy/scipy/pull/22264): MAINT: interpolate: make BSpline allocate out arrays in C +* [#22266](https://github.com/scipy/scipy/pull/22266): MAINT: linalg.solve: raise when diagonal matrix is exactly singular +* [#22267](https://github.com/scipy/scipy/pull/22267): ENH: spatial.transform: baseline implementation of `RigidTransform` +* [#22268](https://github.com/scipy/scipy/pull/22268): TST: clean up obsolete Array API fixtures +* [#22269](https://github.com/scipy/scipy/pull/22269): DOC: optimize.curve\_fit: add note about more advanced curve fitting +* [#22273](https://github.com/scipy/scipy/pull/22273): ENH: linalg.solve: use gbcon +* [#22274](https://github.com/scipy/scipy/pull/22274): ENH: `_contains_nan` for lazy arrays +* [#22275](https://github.com/scipy/scipy/pull/22275): CI: add a GPU CI job +* [#22278](https://github.com/scipy/scipy/pull/22278): BUG: Fix `Akima1DInterpolator` by returning linear interpolant… +* [#22279](https://github.com/scipy/scipy/pull/22279): TST: Add skips for GPU CI failures +* [#22280](https://github.com/scipy/scipy/pull/22280): TST: `_lib`: more idiomatic conditional skips +* [#22281](https://github.com/scipy/scipy/pull/22281): TST: special: better skip message for stdtrit on JAX +* [#22283](https://github.com/scipy/scipy/pull/22283): BUG: Fix banded Jacobian for lsoda: `ode` and `solve_ivp` +* [#22284](https://github.com/scipy/scipy/pull/22284): BUG: sparse: better error message for unsupported dtypes +* [#22289](https://github.com/scipy/scipy/pull/22289): CI: fix skip/trigger condition of GPU CI job +* [#22293](https://github.com/scipy/scipy/pull/22293): ENH: Add \_\_repr\_\_ method to scipy.spatial.transform.Rotation +* [#22295](https://github.com/scipy/scipy/pull/22295): DOC: signal.ShortTimeFFT.nearest\_k\_p: fix typo +* [#22298](https://github.com/scipy/scipy/pull/22298): MAINT: stats: remove `mvn` fortran calls from `multivariate_normal.cdf` +* [#22300](https://github.com/scipy/scipy/pull/22300): MAINT: remove end year from copyright +* [#22302](https://github.com/scipy/scipy/pull/22302): MAINT: remove unused library import +* [#22304](https://github.com/scipy/scipy/pull/22304): ENH: stats.special\_ortho\_group: speed up, allow 1x1 and 0x0 ortho… +* [#22305](https://github.com/scipy/scipy/pull/22305): MAINT, DOC: forward port 1.15.1 relnotes +* [#22308](https://github.com/scipy/scipy/pull/22308): TST: `_lib`: run tests with `@jax.jit` +* [#22311](https://github.com/scipy/scipy/pull/22311): TST: replace `pytest.xfail` with `skip/xfail_xp_backends` +* [#22312](https://github.com/scipy/scipy/pull/22312): ENH: stats.Binomial: add binomial distribution with new infrastructure +* [#22313](https://github.com/scipy/scipy/pull/22313): BUG: signal.bilinear handles complex input, and strips leading… +* [#22320](https://github.com/scipy/scipy/pull/22320): TST: array types: wrap namespaces centrally +* [#22324](https://github.com/scipy/scipy/pull/22324): ENH: io: add invalid field name warning for `savemat` +* [#22330](https://github.com/scipy/scipy/pull/22330): ENH: sparse.csgraph.yen: performance improvements +* [#22340](https://github.com/scipy/scipy/pull/22340): MAINT: linalg: reorganize tridiagonal eigenvalue routines +* [#22342](https://github.com/scipy/scipy/pull/22342): ENH: cluster: `linkage` support for jax.jit and dask +* [#22343](https://github.com/scipy/scipy/pull/22343): ENH: `signal.{envelope,resample,resample_poly}`: array API… +* [#22344](https://github.com/scipy/scipy/pull/22344): BUG: Fix bug with dpss degenerate case +* [#22348](https://github.com/scipy/scipy/pull/22348): DOC: Harmonize summary line of docstrings of iterative sparse… +* [#22350](https://github.com/scipy/scipy/pull/22350): ENH: Replace Fortran COBYLA with Python version from PRIMA +* [#22351](https://github.com/scipy/scipy/pull/22351): DOC: sparse.linalg.eigsh: fix inconsistent definitions of OP… +* [#22352](https://github.com/scipy/scipy/pull/22352): ENH: stats.quantile: add array API compatible quantile function +* [#22358](https://github.com/scipy/scipy/pull/22358): MAINT: `special.nctdtrit`: migrate to boost +* [#22359](https://github.com/scipy/scipy/pull/22359): MAINT: remove temporary `# type: ignore`‘s from #22162 +* [#22364](https://github.com/scipy/scipy/pull/22364): TST: bump tolerance on TestHyp2f1.test\_region3[hyp2f1\_test\_case23] +* [#22366](https://github.com/scipy/scipy/pull/22366): DOC: integrate: fix quad documentation to correctly describe… +* [#22371](https://github.com/scipy/scipy/pull/22371): ENH: stats.make\_distribution: allow definition of custom distributions +* [#22375](https://github.com/scipy/scipy/pull/22375): DOC: sparse.linalg: fix doctest in scipy.sparse.linalg.\_norm.py +* [#22376](https://github.com/scipy/scipy/pull/22376): DOC: sparse.linalg: sparray updates in doc\_strings and Sakurai… +* [#22379](https://github.com/scipy/scipy/pull/22379): DOC: interpolate.AAA: add may vary to example +* [#22380](https://github.com/scipy/scipy/pull/22380): DOC: Replace link to X in header with link to scientific python… +* [#22381](https://github.com/scipy/scipy/pull/22381): MAINT: special: A bit of clean up in stirling2.h +* [#22386](https://github.com/scipy/scipy/pull/22386): DEP: optimize.nnls: deprecate unused atol parameter +* [#22387](https://github.com/scipy/scipy/pull/22387): DOC: Add example to show usage of `predecessors` matrix returned… +* [#22388](https://github.com/scipy/scipy/pull/22388): DOC: Fix documentation for `predecessors` matrix in `shortest_path`... +* [#22389](https://github.com/scipy/scipy/pull/22389): DOC: Add “Assert function selection guideline” doc in the new… +* [#22393](https://github.com/scipy/scipy/pull/22393): TST: stats: test support for array API compatible masked arrays +* [#22396](https://github.com/scipy/scipy/pull/22396): DOC: signal: Use where=’post’ when plotting discrete response… +* [#22397](https://github.com/scipy/scipy/pull/22397): DOC: spatial: Added mention of Davenport Angles to Rotation class… +* [#22398](https://github.com/scipy/scipy/pull/22398): MAINT: special: clean up os/warnings modules exposed in special… +* [#22399](https://github.com/scipy/scipy/pull/22399): TST: remove thread-unsafe skips for a now fixed Cython fused… +* [#22401](https://github.com/scipy/scipy/pull/22401): TYP: Runtime-subscriptable `sparray` and `spmatrix` types +* [#22406](https://github.com/scipy/scipy/pull/22406): ENH: linalg: Rewrite `sqrtm` in C with low-level nD support +* [#22407](https://github.com/scipy/scipy/pull/22407): MAINT: remove `_lib`->``sparse`` dependency +* [#22411](https://github.com/scipy/scipy/pull/22411): DOC: stats.gaussian\_kde: clarify Silverman method +* [#22413](https://github.com/scipy/scipy/pull/22413): DOC: stats: Edited the NIST Handbook reference +* [#22416](https://github.com/scipy/scipy/pull/22416): TST: linalg: bump tolerances in two TestBatch tests +* [#22419](https://github.com/scipy/scipy/pull/22419): MAINT: special: Remove `libsf_error_state` shared library in… +* [#22420](https://github.com/scipy/scipy/pull/22420): TST: use singular `reason=` in `skip_xp_backends` +* [#22421](https://github.com/scipy/scipy/pull/22421): BUG: ndimage: `binary_erosion` vs. broadcasted input +* [#22422](https://github.com/scipy/scipy/pull/22422): MAINT: `_lib`: adapt `array_namespace` to accept scalars… +* [#22425](https://github.com/scipy/scipy/pull/22425): MAINT: special: Update handling of `betainc` and `betaincc`… +* [#22426](https://github.com/scipy/scipy/pull/22426): ENH: linalg: wrap ?stevd +* [#22427](https://github.com/scipy/scipy/pull/22427): DEP: linalg: deprecate disp argument for signm, logm, sqrtm +* [#22428](https://github.com/scipy/scipy/pull/22428): DOC: add note on getting the version switcher to behave to release… +* [#22430](https://github.com/scipy/scipy/pull/22430): MAINT: cluster: vectorize tests in `is_valid_linkage` +* [#22431](https://github.com/scipy/scipy/pull/22431): DOC: integrate: correct tutorial formatting +* [#22433](https://github.com/scipy/scipy/pull/22433): BUG: interpolate.RectBivariateSpline: fix `NaN` output when… +* [#22434](https://github.com/scipy/scipy/pull/22434): DOC: integrate.tanhsinh: remove incorrect reference to \_differentiate +* [#22435](https://github.com/scipy/scipy/pull/22435): MAINT: bump to array-api-extra git tip +* [#22439](https://github.com/scipy/scipy/pull/22439): MAINT: special: Add `log1mexp` for `log(1 - exp(x))` +* [#22440](https://github.com/scipy/scipy/pull/22440): DOC: Fix year of publication in `_dual_annealing.py` +* [#22441](https://github.com/scipy/scipy/pull/22441): BUG: special: Fix incorrect handling of `nan` input in `gammainc`… +* [#22442](https://github.com/scipy/scipy/pull/22442): DOC: Modified Link for code of conduct documentation +* [#22443](https://github.com/scipy/scipy/pull/22443): DOC: Corrected Path +* [#22445](https://github.com/scipy/scipy/pull/22445): CI: avoid mpmath pre-release version that’s failing in CI +* [#22448](https://github.com/scipy/scipy/pull/22448): DOC: optimize.elementwise.find\_minimum: fix documented termination… +* [#22452](https://github.com/scipy/scipy/pull/22452): ENH: linalg.eigh\_tridiagonal: add stevd as a driver and make… +* [#22453](https://github.com/scipy/scipy/pull/22453): DOC: Improve docstrs of `dlsim`, `dimpulse`, `dstep`... +* [#22454](https://github.com/scipy/scipy/pull/22454): BUG: signal.ShortTimeFFT: make attributes `win` and `dual_win`… +* [#22455](https://github.com/scipy/scipy/pull/22455): ENH: stats.gstd: add array API support +* [#22456](https://github.com/scipy/scipy/pull/22456): ENH: stats: add nan\_policy support to power\_divergence, chisquare +* [#22457](https://github.com/scipy/scipy/pull/22457): TST: sparse: add tests for subscriptable types +* [#22459](https://github.com/scipy/scipy/pull/22459): DOC: ndimage: fix wrong return type doc for `ndimage.minimum`… +* [#22460](https://github.com/scipy/scipy/pull/22460): MAINT: signal.csd: port away from using `_spectral_helper` +* [#22462](https://github.com/scipy/scipy/pull/22462): ENH: stats.pearsonr: two simple (but substantial) efficiency… +* [#22463](https://github.com/scipy/scipy/pull/22463): DOC: update Halton docs +* [#22464](https://github.com/scipy/scipy/pull/22464): DOC: Prevent [A@x=b](mailto:A%40x=b) from becoming a URL +* [#22467](https://github.com/scipy/scipy/pull/22467): MAINT/TST: address nits from Dask PR +* [#22469](https://github.com/scipy/scipy/pull/22469): TST: stats: improve JAX test coverage +* [#22475](https://github.com/scipy/scipy/pull/22475): BUG: optimize.shgo: delegate `options['jac']` to `minimizer_kwargs['jac']` +* [#22478](https://github.com/scipy/scipy/pull/22478): ENH: optimize: add `workers` kwarg to BFGS, SLSQP, trust-constr +* [#22480](https://github.com/scipy/scipy/pull/22480): CI: use mpmath pre-release again +* [#22481](https://github.com/scipy/scipy/pull/22481): BUG: fix `make_lsq_spline` with a non-default axis +* [#22483](https://github.com/scipy/scipy/pull/22483): MAINT: spatial: missing Cython type in build +* [#22484](https://github.com/scipy/scipy/pull/22484): ENH: allow batching in `make_smoothing_spline` +* [#22489](https://github.com/scipy/scipy/pull/22489): MAINT: simplifications related to NumPy bounds +* [#22490](https://github.com/scipy/scipy/pull/22490): ENH: stats: add `marray` support to most remaining array API… +* [#22491](https://github.com/scipy/scipy/pull/22491): DOC: stats: resampling tutorial fixups +* [#22493](https://github.com/scipy/scipy/pull/22493): DOC: Add a docstring to OptimizeWarning +* [#22494](https://github.com/scipy/scipy/pull/22494): ENH: \_lib.\_make\_tuple\_bunch: pretend to be namedtuple even more +* [#22496](https://github.com/scipy/scipy/pull/22496): MAINT: `stats.invgauss`: return correct result when `mu=inf` +* [#22498](https://github.com/scipy/scipy/pull/22498): TST: bump tolerance in TestHyp2f1.test\_region4[hyp2f1\_test\_case42] +* [#22499](https://github.com/scipy/scipy/pull/22499): DOC: remove links to the reference guide in the tutorials page +* [#22504](https://github.com/scipy/scipy/pull/22504): BLD: bump min version of Clang to 15.0, and macOS min version… +* [#22505](https://github.com/scipy/scipy/pull/22505): ENH: stats.quantile: add discontinuous (HF 1-3) and Harrell-Davis… +* [#22507](https://github.com/scipy/scipy/pull/22507): BENCH: make Benchmark.change\_dimensionality a class variable +* [#22509](https://github.com/scipy/scipy/pull/22509): DOC: sparse.linalg: add explanation for `MatrixRankWarning` +* [#22511](https://github.com/scipy/scipy/pull/22511): BUG: sparse.csgraph: Added support for casting coo array to csc/csr… +* [#22514](https://github.com/scipy/scipy/pull/22514): TST: special: Add edgecase tests for gammainc and friends +* [#22516](https://github.com/scipy/scipy/pull/22516): STY: enable lint rule UP038 and fix instances in violation of… +* [#22518](https://github.com/scipy/scipy/pull/22518): DOC: interpolate.FloaterHormannInterpolator: fix typos +* [#22519](https://github.com/scipy/scipy/pull/22519): ENH: add workers to least\_squares +* [#22520](https://github.com/scipy/scipy/pull/22520): MAINT: Remove an extraneous dtype check in `scipy/signal/_waveforms.py` +* [#22524](https://github.com/scipy/scipy/pull/22524): ENH:MAINT:optimize: Rewrite SLSQP and NNLS in C +* [#22526](https://github.com/scipy/scipy/pull/22526): DOC: interpolate: reorganize the API listing +* [#22527](https://github.com/scipy/scipy/pull/22527): DOC: sparse: add returns sections to some `_construct.py` functions +* [#22528](https://github.com/scipy/scipy/pull/22528): DOC: interpolate: improve visibility of univariate interpolator… +* [#22529](https://github.com/scipy/scipy/pull/22529): DOC: Update a link in SciPy Core Developer Guide +* [#22530](https://github.com/scipy/scipy/pull/22530): DOC: interpolate: improve one-line descriptions +* [#22531](https://github.com/scipy/scipy/pull/22531): DOC: batching in 1D/ND interpolation/smoothing routines +* [#22535](https://github.com/scipy/scipy/pull/22535): DOC: update roadmap sparse +* [#22536](https://github.com/scipy/scipy/pull/22536): DOC: io: link to netcdf4-python +* [#22537](https://github.com/scipy/scipy/pull/22537): DOC: linalg: fix inconsistent notation +* [#22541](https://github.com/scipy/scipy/pull/22541): Interpolate tutorial: discuss the bases and interconversions +* [#22542](https://github.com/scipy/scipy/pull/22542): MAINT, DOC: forward port 1.15.2 release notes +* [#22546](https://github.com/scipy/scipy/pull/22546): DOC: Add docstring for QhullError in \_qhull.pyx [docs only] +* [#22548](https://github.com/scipy/scipy/pull/22548): DOC: interpolate.lagrange: add notes / references; recommend… +* [#22549](https://github.com/scipy/scipy/pull/22549): ENH: use `workers` keyword in `optimize._differentiable_functions.VectorFunct`… +* [#22552](https://github.com/scipy/scipy/pull/22552): MAINT: sparse.csgraph: Raise error if `predecessors.dtype !=`… +* [#22554](https://github.com/scipy/scipy/pull/22554): BUG: `lfiltic`‘s handling of `a[0] != 1` differs from `lfilter`... +* [#22556](https://github.com/scipy/scipy/pull/22556): ENH: optimize: speed up `LbfgsInvHessProduct.todense` on large… +* [#22557](https://github.com/scipy/scipy/pull/22557): ENH: Replace `_lazywhere` with `xpx.apply_where` +* [#22560](https://github.com/scipy/scipy/pull/22560): ENH: Allow endpoints of custom distributions created with `stats.make_distribut`… +* [#22562](https://github.com/scipy/scipy/pull/22562): DOC: Correct a typo: MATLAB(R) -> MATLAB® +* [#22564](https://github.com/scipy/scipy/pull/22564): TST: add missing custom markers to pytest.ini +* [#22566](https://github.com/scipy/scipy/pull/22566): TST: `skip_xp_backends(eager_only=True)` +* [#22569](https://github.com/scipy/scipy/pull/22569): CI: fix dev-deps job by not testing Meson master +* [#22572](https://github.com/scipy/scipy/pull/22572): TST: skip two ndimage tests that are failing for Dask +* [#22573](https://github.com/scipy/scipy/pull/22573): DOC: sparse: Add docstrings to warnings in `scipy.sparse` +* [#22575](https://github.com/scipy/scipy/pull/22575): ENH: `ndimage.vectorized_filter`: `generic_filter` with… +* [#22579](https://github.com/scipy/scipy/pull/22579): DOC: signal.correlate: improve notes section +* [#22584](https://github.com/scipy/scipy/pull/22584): TST: ndimage: tidy `skip_xp_backends` +* [#22585](https://github.com/scipy/scipy/pull/22585): MAINT: stats.multinomial: `FutureWarning` about normalization… +* [#22593](https://github.com/scipy/scipy/pull/22593): TST: add one more missing custom marker (`fail_slow`) to… +* [#22597](https://github.com/scipy/scipy/pull/22597): ENH: stats.make\_distribution: improve interface for overriding… +* [#22598](https://github.com/scipy/scipy/pull/22598): MAINT: stats.bootstrap: broadcast like other stats functions +* [#22602](https://github.com/scipy/scipy/pull/22602): DOC: stats.pearsonr: add tutorial +* [#22603](https://github.com/scipy/scipy/pull/22603): MAINT: \_lib: bump version array\_api\_compat to 1.11 +* [#22605](https://github.com/scipy/scipy/pull/22605): MAINT: signal: clean up unnecessary shims +* [#22606](https://github.com/scipy/scipy/pull/22606): DOC: Ignore dict subclass docstring warning +* [#22607](https://github.com/scipy/scipy/pull/22607): MAINT: special.logsumexp: improve behavior with complex infinities +* [#22609](https://github.com/scipy/scipy/pull/22609): ENH: stats: shared array api support information to generate… +* [#22610](https://github.com/scipy/scipy/pull/22610): ENH: \_lib.doccer: Simplify and optimize indentation loop +* [#22611](https://github.com/scipy/scipy/pull/22611): MAINT: stats: rewrite `gaussian_kde.integrate_box`, remove… +* [#22614](https://github.com/scipy/scipy/pull/22614): MAINT: linalg: fix cython lint failures in build output +* [#22616](https://github.com/scipy/scipy/pull/22616): ENH: stats: use `vecdot` and `nonzero` where appropriate +* [#22618](https://github.com/scipy/scipy/pull/22618): BUG: Fix dual quaternion normalization procedure +* [#22619](https://github.com/scipy/scipy/pull/22619): DOC: stats.gaussian\_kde: clarify the meaning of `factor` +* [#22621](https://github.com/scipy/scipy/pull/22621): MAINT: sparse: remove incidental imports from private modules +* [#22623](https://github.com/scipy/scipy/pull/22623): ENH: signal.convolve2d: Performance Enhancement on WoA +* [#22624](https://github.com/scipy/scipy/pull/22624): BUG: stats: `kde.integrate_box` was missing an `rng` parameter +* [#22625](https://github.com/scipy/scipy/pull/22625): MAINT: Bump array-api-compat and array-api-strict +* [#22628](https://github.com/scipy/scipy/pull/22628): MAINT: stats.tmin/tmax: ensure exact results with unreasonably… +* [#22630](https://github.com/scipy/scipy/pull/22630): MAINT: stats: tmin/tmax tweaks +* [#22631](https://github.com/scipy/scipy/pull/22631): DOC: interpolate.BarycentricInterpolator: documentation improvements +* [#22632](https://github.com/scipy/scipy/pull/22632): MAINT: stats.multinomial: use dtype-dependent tolerance +* [#22633](https://github.com/scipy/scipy/pull/22633): ENH: special: `softmax` / `log_softmax` Array API support +* [#22634](https://github.com/scipy/scipy/pull/22634): TST: special: cosmetic nits +* [#22636](https://github.com/scipy/scipy/pull/22636): MAINT: fix domain check for `ncfdtri` +* [#22639](https://github.com/scipy/scipy/pull/22639): ENH: special: `support_alternative_backends` on Dask and jax.jit +* [#22641](https://github.com/scipy/scipy/pull/22641): ENH: special: add Dask support to `rel_entr` +* [#22645](https://github.com/scipy/scipy/pull/22645): DOC: stats.special\_ortho\_group: update algorithm description +* [#22647](https://github.com/scipy/scipy/pull/22647): MAINT: sparse: rewrite `sparse._sputils.validateaxis` to centralize… +* [#22648](https://github.com/scipy/scipy/pull/22648): MAINT: stats.quantile: fixup quantile for p < minimum plotting… +* [#22649](https://github.com/scipy/scipy/pull/22649): DOC, CI: Fix legend warning for CloughTocher2DInterpolator docstring +* [#22650](https://github.com/scipy/scipy/pull/22650): TST: stats: mark `nct` fit xslow +* [#22651](https://github.com/scipy/scipy/pull/22651): MAINT: ndimage.zoom: eliminate noise when `zoom=1` +* [#22653](https://github.com/scipy/scipy/pull/22653): DOC: add COBYQA to local optimizer comparison table +* [#22658](https://github.com/scipy/scipy/pull/22658): CI: clean up free-threading job, add new job using pytest-run-parallel +* [#22661](https://github.com/scipy/scipy/pull/22661): TST: fix some test failures and excessive memory use on Guix +* [#22666](https://github.com/scipy/scipy/pull/22666): MAINT: interpolate: move NdBSpline evaluations to C +* [#22667](https://github.com/scipy/scipy/pull/22667): DEV: cap Sphinx version in environment.yml +* [#22668](https://github.com/scipy/scipy/pull/22668): DOC: document Array API support for the constants module and… +* [#22669](https://github.com/scipy/scipy/pull/22669): TST: constants: tidy up tests +* [#22671](https://github.com/scipy/scipy/pull/22671): MAINT: enforce modularity with `tach` +* [#22675](https://github.com/scipy/scipy/pull/22675): ENH: stats: Improvements to support/domain endpoints in custom… +* [#22676](https://github.com/scipy/scipy/pull/22676): ENH: stats.mode: vectorize implementation +* [#22677](https://github.com/scipy/scipy/pull/22677): MAINT: use function handles rather than custom strings in `xp_capabilities_tabl`… +* [#22683](https://github.com/scipy/scipy/pull/22683): MAINT: remove outdated `xp_` functions, `xp.asarray` on elementwise… +* [#22686](https://github.com/scipy/scipy/pull/22686): TST/DOC: `lazy_xp_backends` in `xp_capabilities` +* [#22687](https://github.com/scipy/scipy/pull/22687): MAINT: Bump Array API to 2024.12 +* [#22691](https://github.com/scipy/scipy/pull/22691): DOC: signal: fix `freqz_sos` and `sosfreqz` docstrings +* [#22694](https://github.com/scipy/scipy/pull/22694): DOC: interpolate.make\_smoothing\_spline: improve example visibility +* [#22695](https://github.com/scipy/scipy/pull/22695): MAINT: improve dtype handling now that `xp.result_type` accepts… +* [#22696](https://github.com/scipy/scipy/pull/22696): MAINT: spatial: support empty case in `RigidTransform` +* [#22698](https://github.com/scipy/scipy/pull/22698): MAINT/DOC: Update incomplete examples of `expectile()` +* [#22701](https://github.com/scipy/scipy/pull/22701): TST: optimize: add more tests +* [#22710](https://github.com/scipy/scipy/pull/22710): DOC: integrate.quad\_vec: returned object is not a dictionary +* [#22711](https://github.com/scipy/scipy/pull/22711): DOC: stats: Extend documentation of random\_correlation matrix +* [#22712](https://github.com/scipy/scipy/pull/22712): MAINT: bump array-api-extra to 0.7.0 +* [#22713](https://github.com/scipy/scipy/pull/22713): DOC: linalg.solve: clarify symmetry requirement +* [#22714](https://github.com/scipy/scipy/pull/22714): MAINT: ndimage.maximum\_filter: recommend `vectorized_filter`… +* [#22715](https://github.com/scipy/scipy/pull/22715): ENH: ndimage.vectorized\_filter: make CuPy-compatible +* [#22716](https://github.com/scipy/scipy/pull/22716): DOC: optimize: Clarify use of `xtol` in 1D rootfinder docstrings +* [#22718](https://github.com/scipy/scipy/pull/22718): TST: special: overhaul test\_support\_alternative\_backends +* [#22719](https://github.com/scipy/scipy/pull/22719): TST: add tests for `ncfdtri` +* [#22722](https://github.com/scipy/scipy/pull/22722): DOC: ndimage.affine\_transformation: add examples to docstring +* [#22723](https://github.com/scipy/scipy/pull/22723): DOC: fft.dst: add example to docstring +* [#22725](https://github.com/scipy/scipy/pull/22725): MAINT: ndimage.affine\_transform: remove outdated and unhelpful… +* [#22729](https://github.com/scipy/scipy/pull/22729): DOC: datasets.download\_all: add examples to docstring +* [#22735](https://github.com/scipy/scipy/pull/22735): ENH: stats: lazy trimmed stats for Dask and JAX +* [#22738](https://github.com/scipy/scipy/pull/22738): DOC: PRIMA licence and reference fix +* [#22740](https://github.com/scipy/scipy/pull/22740): TST: special: remove test skips due to array-api-strict#131 +* [#22741](https://github.com/scipy/scipy/pull/22741): CI: fix crash of free-threading job in `sparse`, bump GHA… +* [#22742](https://github.com/scipy/scipy/pull/22742): CI/MAINT: make special.errstate thread-safe and run pytest-run-parallel… +* [#22745](https://github.com/scipy/scipy/pull/22745): DOC: fft.rfft2: add example to docstring +* [#22749](https://github.com/scipy/scipy/pull/22749): ENH: stats: add support for multiple parameterizations for custom… +* [#22750](https://github.com/scipy/scipy/pull/22750): DOC: fft.hfft2: added example +* [#22751](https://github.com/scipy/scipy/pull/22751): TST: linalg.test\_batch: minor tolerance bumps +* [#22755](https://github.com/scipy/scipy/pull/22755): MAINT: special: refine `logsumexp` writeback behaviour +* [#22756](https://github.com/scipy/scipy/pull/22756): BUG/TST: `special.logsumexp` on non-default device +* [#22759](https://github.com/scipy/scipy/pull/22759): TST: weightedtau rng thread safety +* [#22760](https://github.com/scipy/scipy/pull/22760): BUG: optimize: `VectorFunction.f_updated` wasn’t being set… +* [#22761](https://github.com/scipy/scipy/pull/22761): DOC: optimize: l-bfgs-b: clarify what is meant by `maxfun`... +* [#22764](https://github.com/scipy/scipy/pull/22764): MAINT: optimize: `VectorFunction`: remove reference cycle +* [#22766](https://github.com/scipy/scipy/pull/22766): DOC: improve docstrings of boxcox and yeojohnson +* [#22770](https://github.com/scipy/scipy/pull/22770): TST: stats: add marray tests for \_length\_nonmasked directly +* [#22771](https://github.com/scipy/scipy/pull/22771): TST: stats: don’t encapsulate `pytest.warns` +* [#22778](https://github.com/scipy/scipy/pull/22778): MAINT: switch to vendoring libprima/prima +* [#22779](https://github.com/scipy/scipy/pull/22779): MAINT: optimize: `VectorFunction`: fix array copy for sparse +* [#22782](https://github.com/scipy/scipy/pull/22782): MAINT: fix failures in free-threading(parallel=1) job +* [#22783](https://github.com/scipy/scipy/pull/22783): TST/MAINT: signal.symiirorder2: r, omega, precision are floats;… +* [#22785](https://github.com/scipy/scipy/pull/22785): DOC/DEV: remove references to CirrusCI in skipping CI doc +* [#22787](https://github.com/scipy/scipy/pull/22787): DOC: optimize: Add the multiplier details to SLSQP funcs +* [#22788](https://github.com/scipy/scipy/pull/22788): TST: stats.quantile: add edge test case for axis=None && keepdims=True +* [#22790](https://github.com/scipy/scipy/pull/22790): MAINT: optimize.least\_squares: change `x_scale` default +* [#22796](https://github.com/scipy/scipy/pull/22796): ENH/BLD: cython: share memoryview utility between extension modules +* [#22798](https://github.com/scipy/scipy/pull/22798): TST: stats: mark some tests as slow +* [#22802](https://github.com/scipy/scipy/pull/22802): BUG: optimize: Fix instability with NNLS on 32bit systems +* [#22803](https://github.com/scipy/scipy/pull/22803): MAINT: use `xp.asarray` instead of `xp.array` +* [#22805](https://github.com/scipy/scipy/pull/22805): CI: start using the `CIBW_ENABLE` env var +* [#22807](https://github.com/scipy/scipy/pull/22807): TST: fix issue with `cython_special` test which was missing… +* [#22808](https://github.com/scipy/scipy/pull/22808): BUG: `special.logsumexp` device propagation on PyTorch +* [#22809](https://github.com/scipy/scipy/pull/22809): ENH: `optimize.root`: add warning for invalid inner parameters… +* [#22811](https://github.com/scipy/scipy/pull/22811): ENH: ndimage.rotate: performance enhancement on WoA +* [#22814](https://github.com/scipy/scipy/pull/22814): BUG: signal.resample: Fix bug for parameter num=2 (including… +* [#22815](https://github.com/scipy/scipy/pull/22815): MAINT: sparse: add lazy loading for csgraph and linalg +* [#22818](https://github.com/scipy/scipy/pull/22818): DEV: add `.editorconfig` +* [#22820](https://github.com/scipy/scipy/pull/22820): MAINT: signal: consolidate `order_filter` tests +* [#22821](https://github.com/scipy/scipy/pull/22821): ENH: signal.lp2{lp,hp,bp,bs}: add array API standard support +* [#22823](https://github.com/scipy/scipy/pull/22823): MAINT: integrate.tanhsinh: simplify error estimate +* [#22829](https://github.com/scipy/scipy/pull/22829): DOC: stats.qmc.discrepancy: clarify definitions +* [#22832](https://github.com/scipy/scipy/pull/22832): DOC: interpolate: remove outdated deprecation notices +* [#22833](https://github.com/scipy/scipy/pull/22833): DOC: special.comb: remove missed deprecation notice +* [#22835](https://github.com/scipy/scipy/pull/22835): MAINT: stats.boxcox\_llf: refactor for simplicity +* [#22842](https://github.com/scipy/scipy/pull/22842): MAINT: bump boost\_math to 1.88.0 +* [#22843](https://github.com/scipy/scipy/pull/22843): DOC: `special`: add `xp_capabilities` to logsumexp +* [#22844](https://github.com/scipy/scipy/pull/22844): TST: `stats`: minor nits to test\_stats.py +* [#22845](https://github.com/scipy/scipy/pull/22845): TST: `stats`: reorder tests to match `xp_capabilities` +* [#22846](https://github.com/scipy/scipy/pull/22846): MAINT: \_lib/differentiate: update EIM with `at.set` +* [#22848](https://github.com/scipy/scipy/pull/22848): MAINT: \_lib: eliminate try/excepts in EIM +* [#22850](https://github.com/scipy/scipy/pull/22850): TST: optimize `VectorFunction` add test for J0=None branch… +* [#22852](https://github.com/scipy/scipy/pull/22852): TST: fix `boxcox_llf` test failure on main +* [#22854](https://github.com/scipy/scipy/pull/22854): MAINT: special: Add `xsf` as a submodule of SciPy +* [#22855](https://github.com/scipy/scipy/pull/22855): MAINT: spatial.pdist: make dimensionality error more descriptive +* [#22858](https://github.com/scipy/scipy/pull/22858): DOC: Fix typo in `ndimage.generic_gradient_magnitude()` +* [#22859](https://github.com/scipy/scipy/pull/22859): DOC: rewording of “ties” into “tied pairs” for clearer meaning +* [#22862](https://github.com/scipy/scipy/pull/22862): TST: integrate/spatial: make fail\_slow allowances +* [#22863](https://github.com/scipy/scipy/pull/22863): TST: reintroduce `eager_warns` and fix free-threading test… +* [#22864](https://github.com/scipy/scipy/pull/22864): MAINT: linalg.svd: raise correct error message for GESDD when… +* [#22873](https://github.com/scipy/scipy/pull/22873): ENH: sparse: Support nD sum/mean/min/max/argmin for sparse arrays +* [#22875](https://github.com/scipy/scipy/pull/22875): CI: limit pytest-fail-slow usage to a single CI job +* [#22886](https://github.com/scipy/scipy/pull/22886): ENH: signal: filter design functions array API standard support +* [#22891](https://github.com/scipy/scipy/pull/22891): DOC: Document allowed NumPy / Python versions +* [#22893](https://github.com/scipy/scipy/pull/22893): MAINT: vendor qhull as subproject and add `-Duse-system-libraries` +* [#22895](https://github.com/scipy/scipy/pull/22895): MAINT: signal: correct the `get_window` delegator +* [#22896](https://github.com/scipy/scipy/pull/22896): ENH: signal: `tf2zpk` et al Array API +* [#22897](https://github.com/scipy/scipy/pull/22897): ENH: sparse: ND binary operations support +* [#22898](https://github.com/scipy/scipy/pull/22898): DEV: add editable install support for `spin` +* [#22899](https://github.com/scipy/scipy/pull/22899): MAINT: bump array-api submodules +* [#22900](https://github.com/scipy/scipy/pull/22900): MAINT: fix `np.copyto` warnings on Dask +* [#22908](https://github.com/scipy/scipy/pull/22908): MAINT: bump qhull to 2020.2 +* [#22909](https://github.com/scipy/scipy/pull/22909): TST: Use `jax_autojit` +* [#22913](https://github.com/scipy/scipy/pull/22913): BUG: fix syntax warning break in finally block under 3.14 +* [#22915](https://github.com/scipy/scipy/pull/22915): BLD: optimize sdist contents through a dist script +* [#22916](https://github.com/scipy/scipy/pull/22916): DOC: integrate.solve\_bvp: add missing reference details +* [#22917](https://github.com/scipy/scipy/pull/22917): DEV: fix invocation of linter on Windows +* [#22918](https://github.com/scipy/scipy/pull/22918): TST: `linalg` add test coverage to exception handling for invalid… +* [#22926](https://github.com/scipy/scipy/pull/22926): MAINT: spatial.cKDTree: remove software prefetching and software… +* [#22927](https://github.com/scipy/scipy/pull/22927): MAINT: tools/check\_test\_name: specify encoding +* [#22930](https://github.com/scipy/scipy/pull/22930): DOC: linalg: update roadmap entry for BLAS/LAPACK bindings +* [#22932](https://github.com/scipy/scipy/pull/22932): BUG: interpolate: do not call PyArray macros on non-arrays +* [#22934](https://github.com/scipy/scipy/pull/22934): MAINT: optimize.zeros: fix error message +* [#22939](https://github.com/scipy/scipy/pull/22939): TST: spatial.transform: Add array API standard support for testing +* [#22941](https://github.com/scipy/scipy/pull/22941): MAINT: stats.qmc.Sobol: fix stacklevel of warning +* [#22944](https://github.com/scipy/scipy/pull/22944): MAINT: fix regressions in array-api-strict after disabling np.float64 +* [#22946](https://github.com/scipy/scipy/pull/22946): ENH: `special`: add `xp_capabilities` +* [#22947](https://github.com/scipy/scipy/pull/22947): MAINT: avoid nested `asarray` calls +* [#22949](https://github.com/scipy/scipy/pull/22949): MAINT: mass rename `make_skip_xp_backends` to `make_xp_test_case` +* [#22950](https://github.com/scipy/scipy/pull/22950): MAINT: refresh gpu-ci pixi.lock +* [#22952](https://github.com/scipy/scipy/pull/22952): MAINT, DOC: forward port 1.15.3 release notes +* [#22955](https://github.com/scipy/scipy/pull/22955): MAINT: wheel downloader +* [#22959](https://github.com/scipy/scipy/pull/22959): ENH: `cluster`: more lazy functions +* [#22960](https://github.com/scipy/scipy/pull/22960): DOC/TST: `cluster.hierarchy`: use `xp_capabilities` +* [#22961](https://github.com/scipy/scipy/pull/22961): TST: `cluster`: reduce test reliance from linkage +* [#22963](https://github.com/scipy/scipy/pull/22963): MAINT: wrap wrapcauchy samples around the circle +* [#22967](https://github.com/scipy/scipy/pull/22967): CI: address some potential vulnerabilities +* [#22968](https://github.com/scipy/scipy/pull/22968): DOC: outline that not all attributes of OptimizeResult may be… +* [#22969](https://github.com/scipy/scipy/pull/22969): MAINT: stats.make\_distribution: fix most remaining discrete distribution… +* [#22970](https://github.com/scipy/scipy/pull/22970): MAINT: stats.DiscreteDistribution: fix inversion methods +* [#22971](https://github.com/scipy/scipy/pull/22971): MAINT: fix skellam distribution tests +* [#22973](https://github.com/scipy/scipy/pull/22973): BUG: interpolate.make\_splrep: raise error when `residuals.sum()`… +* [#22976](https://github.com/scipy/scipy/pull/22976): ENH: stats: Implement \_munp for gennorm +* [#22982](https://github.com/scipy/scipy/pull/22982): BUG: signal: fix incorrect vendoring of `npp_polyval` +* [#22984](https://github.com/scipy/scipy/pull/22984): MAINT: special: remove test\_compiles\_in\_cupy +* [#22987](https://github.com/scipy/scipy/pull/22987): DOC: sparse: sparray migration guide updates +* [#22991](https://github.com/scipy/scipy/pull/22991): DOC: update SciPy 1.16.0 release notes +* [#22992](https://github.com/scipy/scipy/pull/22992): ENH: `signal.cspline1d_eval,qspline1d_eval` throw exception… +* [#22994](https://github.com/scipy/scipy/pull/22994): DOC: signal.csd: Small fixes to docstr +* [#22997](https://github.com/scipy/scipy/pull/22997): CI: temporarily disable free-threaded job with parallel-threads +* [#22998](https://github.com/scipy/scipy/pull/22998): BUG: Fix duplicate `--pyargs` due to double addition in SciPy… +* [#22999](https://github.com/scipy/scipy/pull/22999): MAINT: bump up array-api-compat and array-api-extra +* [#23000](https://github.com/scipy/scipy/pull/23000): ENH/DOC/TST: `cluster.vq`: use `xp_capabilities` +* [#23001](https://github.com/scipy/scipy/pull/23001): DOC: `special`: update top-level docs to reflect `xp_capabilities` +* [#23005](https://github.com/scipy/scipy/pull/23005): BUG: sparse: fix mean/sum change in return of np.matrix for sparse… +* [#23010](https://github.com/scipy/scipy/pull/23010): DOC: edit and extend the release notes for 1.16.0 +* [#23013](https://github.com/scipy/scipy/pull/23013): MAINT: version pins/prep for 1.16.0rc1 +* [#23014](https://github.com/scipy/scipy/pull/23014): DOC: .mailmap updates for 1.16.0rc1 +* [#23029](https://github.com/scipy/scipy/pull/23029): DOC: add documentation for the new `use-system-libraries` build… +* [#23031](https://github.com/scipy/scipy/pull/23031): REL: set 1.16.0rc2 unreleased +* [#23040](https://github.com/scipy/scipy/pull/23040): DOC: linalg: adjust release note wording +* [#23044](https://github.com/scipy/scipy/pull/23044): TST: update all `result_to_tuple=` callables to accept two… +* [#23047](https://github.com/scipy/scipy/pull/23047): BUG: signal.csd: Zero-pad for different size inputs +* [#23048](https://github.com/scipy/scipy/pull/23048): MAINT: ndimage.vectorized\_filter: fix behavior of axes when length… +* [#23051](https://github.com/scipy/scipy/pull/23051): MAINT/ENH: ndimage.vectorized\_filter: adjust scalar size to match… +* [#23086](https://github.com/scipy/scipy/pull/23086): CI: update windows-2019 runner image to windows-2022 +* [#23091](https://github.com/scipy/scipy/pull/23091): BUG: sparse: correct eq and ne with different shapes. (and add… +* [#23098](https://github.com/scipy/scipy/pull/23098): MAINT: 1.16.0rc2 backports +* [#23099](https://github.com/scipy/scipy/pull/23099): MAINT: fix SPDX license expressions for LAPACK, OpenBLAS, GCC +* [#23106](https://github.com/scipy/scipy/pull/23106): TST: CI broken vs pytest 8.4.0 +* [#23110](https://github.com/scipy/scipy/pull/23110): BUG: spatial.distance: yule implementation in `distance_metrics.h` +* [#23113](https://github.com/scipy/scipy/pull/23113): DOC: improve docs for `-Duse-system-libraries` build option +* [#23114](https://github.com/scipy/scipy/pull/23114): DOC: Add missing BLAS Level 2 functions +* [#23127](https://github.com/scipy/scipy/pull/23127): DOC: fix linkcode\_resolve line-number anchors +* [#23131](https://github.com/scipy/scipy/pull/23131): REL: set 1.16.0rc3 unreleased +* [#23134](https://github.com/scipy/scipy/pull/23134): BUG: linalg.lapack: fix incorrectly sized work array for {c,z}syrti +* [#23144](https://github.com/scipy/scipy/pull/23144): MAINT: array types: array-api-strict got stricter +* [#23146](https://github.com/scipy/scipy/pull/23146): DOC: stats.Mixture: add example +* [#23164](https://github.com/scipy/scipy/pull/23164): MAINT: backports and prep for 1.16.0 “final” +* [#23170](https://github.com/scipy/scipy/pull/23170): TST: add all SciPy-specific pytest markers to `scipy/conftest.py` +* [#23178](https://github.com/scipy/scipy/pull/23178): CI: skip JAX 0.6.2 +* [#23180](https://github.com/scipy/scipy/pull/23180): CI: remove free-threading workarounds in wheel builds +* [#23189](https://github.com/scipy/scipy/pull/23189): BLD: implement build-time version check for minimum Python version +* [#23197](https://github.com/scipy/scipy/pull/23197): DEP: optimize: Add deprecation warnings to L-BFGS-B `disp`... diff --git a/corpus/changelog/scipy_releases/scipy_1161.md b/corpus/changelog/scipy_releases/scipy_1161.md new file mode 100644 index 0000000000000000000000000000000000000000..b98622ed22ed0d38c0d3ba721486de97790f9890 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1161.md @@ -0,0 +1,70 @@ +# SciPy 1.16.1 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.16.1-notes.html +Version: 1.16.1 + +Contents + +* [SciPy 1.16.1 Release Notes](#scipy-1-16-1-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.16.1](#issues-closed-for-1-16-1) + - [Pull requests for 1.16.1](#pull-requests-for-1-16-1) + +SciPy 1.16.1 is a bug-fix release that adds support for +Python 3.14.0rc1, including PyPI wheels. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Name (commits) +* Evgeni Burovski (1) +* Rob Falck (1) +* Ralf Gommers (7) +* Geoffrey Gunter (1) + +* Matt Haberland (2) +* Joren Hammudoglu (1) +* Andrew Nelson (2) +* newyork\_loki (1) + +* Ilhan Polat (1) +* Tyler Reddy (25) +* Daniel Schmitz (1) +* Dan Schult (2) + + > A total of 12 people contributed to this release. + > People with a “+” by their names contributed a patch for the first time. + > This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.16.1](#id3)[#](#issues-closed-for-1-16-1 "Link to this heading") + +* [#23075](https://github.com/scipy/scipy/issues/23075): BUG: ndimage.median\_filter: always returns `0` on single element… +* [#23158](https://github.com/scipy/scipy/issues/23158): BUG: optimize.shgo: unbounded cache in Complex.split\_edge +* [#23216](https://github.com/scipy/scipy/issues/23216): BUG: `@_transition_to_rng` leads to inconsistent function signatures +* [#23217](https://github.com/scipy/scipy/issues/23217): BUG: stats.beta.entropy: doesn’t work with array-valued a, b +* [#23221](https://github.com/scipy/scipy/issues/23221): BUG: signal.tf2sos: `ComplexWarning` +* [#23277](https://github.com/scipy/scipy/issues/23277): BUG: signal.freqz: erroneously returns complex-valued frequencies +* [#23278](https://github.com/scipy/scipy/issues/23278): BUG: linalg.sqrtm: incorrect results in 1.16.0 when at least… +* [#23321](https://github.com/scipy/scipy/issues/23321): BUG: CSC matrix multiplication and indptrs +* [#23329](https://github.com/scipy/scipy/issues/23329): BUG: Compilation failure in HiGHs with MSVC +* [#23338](https://github.com/scipy/scipy/issues/23338): DOC: optimize.minimize: erroneously claims COBYLA doesn’t support… + +### [Pull requests for 1.16.1](#id4)[#](#pull-requests-for-1-16-1 "Link to this heading") + +* [#23167](https://github.com/scipy/scipy/pull/23167): BUG: optimize.shgo: Complex cache `split_edge` differently +* [#23187](https://github.com/scipy/scipy/pull/23187): CI: add cp314/cp314t nighly wheel builds +* [#23206](https://github.com/scipy/scipy/pull/23206): DOC: ndimage.vectorized\_filter: correct `output` description +* [#23214](https://github.com/scipy/scipy/pull/23214): REL, MAINT: prep for 1.16.1 +* [#23222](https://github.com/scipy/scipy/pull/23222): BUG: signal.tf2sos: fix a new `ComplexWarning` +* [#23266](https://github.com/scipy/scipy/pull/23266): BUG: signal.remez: fix handling of `weight` array +* [#23276](https://github.com/scipy/scipy/pull/23276): BUG: fix signature of `@_transition_to_rng` functions (SPEC… +* [#23279](https://github.com/scipy/scipy/pull/23279): BUG: linalg: Fix pointer casting order for sqrtm +* [#23280](https://github.com/scipy/scipy/pull/23280): BUG: fix broadcasting in `beta.entropy()` with new infrastructure +* [#23284](https://github.com/scipy/scipy/pull/23284): DOC: optimize.least\_squares: minor nit +* [#23293](https://github.com/scipy/scipy/pull/23293): BUG: ndimage.median\_filter: single element array handling +* [#23322](https://github.com/scipy/scipy/pull/23322): BUG: sparse: `multiply()` should produce CSC output for CSC… +* [#23332](https://github.com/scipy/scipy/pull/23332): BLD: Add bigobj flag for MSVC to fix object file section limit +* [#23339](https://github.com/scipy/scipy/pull/23339): DOC: optimize.minimize: remove outdated limitation for equality… +* [#23348](https://github.com/scipy/scipy/pull/23348): MAINT: sparse: `multiply()` uses attribute presence instead… +* [#23380](https://github.com/scipy/scipy/pull/23380): CI: bump to cibuildwheel 3.1.0 for 3.14.0rc1, add cp314t musllinux… +* [#23384](https://github.com/scipy/scipy/pull/23384): CI: disable special-casing of 3.14-dev now that Python 3.14rc1… +* [#23387](https://github.com/scipy/scipy/pull/23387): MAINT: Python 3.14 to classifiers diff --git a/corpus/changelog/scipy_releases/scipy_1162.md b/corpus/changelog/scipy_releases/scipy_1162.md new file mode 100644 index 0000000000000000000000000000000000000000..c7101f12727630e81e4ae7f6c134cde58f1b10c5 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1162.md @@ -0,0 +1,70 @@ +# SciPy 1.16.2 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.16.2-notes.html +Version: 1.16.2 + +Contents + +* [SciPy 1.16.2 Release Notes](#scipy-1-16-2-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.16.2](#issues-closed-for-1-16-2) + - [Pull requests for 1.16.2](#pull-requests-for-1-16-2) + +SciPy 1.16.2 is a bug-fix release with no new features +compared to 1.16.1. This is the first stable release of +SciPy to provide Windows on ARM wheels on PyPI. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Name (commits) +* Dietrich Brunn (1) +* Ralf Gommers (6) +* Adam Jones (1) +* Gleb Khmyznikov (1) + +* Jost Migenda (1) + +* newyork\_loki (1) +* Nick ODell (3) +* Dimitri Papadopoulos Orfanos (1) +* Ilhan Polat (2) +* Tyler Reddy (26) +* Mugunthan Selvanayagam (1) + +* Shuhei Watanabe (1) + + + > A total of 12 people contributed to this release. + > People with a “+” by their names contributed a patch for the first time. + > This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.16.2](#id3)[#](#issues-closed-for-1-16-2 "Link to this heading") + +* [#21562](https://github.com/scipy/scipy/issues/21562): BLD: Windows Arm builds +* [#22244](https://github.com/scipy/scipy/issues/22244): MAINT: specify lower bound for `pytest` in `pyproject.toml` +* [#22825](https://github.com/scipy/scipy/issues/22825): CI: new GH runners available for macOS 15 and Windows 2025 +* [#23411](https://github.com/scipy/scipy/issues/23411): BUG: signal.periodogram: memory leak +* [#23428](https://github.com/scipy/scipy/issues/23428): Incomplete license terms for sub components since version 1.16.0… +* [#23429](https://github.com/scipy/scipy/issues/23429): BUG: optimize.nnls: memory leak +* [#23430](https://github.com/scipy/scipy/issues/23430): BUG: optimize: missing error checking for slsqp inputs +* [#23458](https://github.com/scipy/scipy/issues/23458): CI: CUDA compilation failures for all cupy tests +* [#23474](https://github.com/scipy/scipy/issues/23474): BUG: signal.lombscargle(precenter=True) modifies input array… +* [#23564](https://github.com/scipy/scipy/issues/23564): CI: macOS conda-forge job failing because of scikit-umfpack upgrade + +### [Pull requests for 1.16.2](#id4)[#](#pull-requests-for-1-16-2 "Link to this heading") + +* [#23122](https://github.com/scipy/scipy/pull/23122): BLD: Windows Arm64 wheel support +* [#23133](https://github.com/scipy/scipy/pull/23133): CI: validate build on Win-ARM64 +* [#23154](https://github.com/scipy/scipy/pull/23154): CI: bump OpenBLAS and cibuildwheel versions +* [#23402](https://github.com/scipy/scipy/pull/23402): REL, MAINT: prepare for SciPy 1.16.2 +* [#23403](https://github.com/scipy/scipy/pull/23403): BUG: Skip installing gmpy2(test deps) for Win-ARM64 +* [#23414](https://github.com/scipy/scipy/pull/23414): BUG: signal: Avoid unbounded cache for ShortTimeFFT +* [#23435](https://github.com/scipy/scipy/pull/23435): MAINT: ensure Qhull license file gets included in wheels +* [#23442](https://github.com/scipy/scipy/pull/23442): BUG: fix regression for non-integer `maxiter` in SLSQP +* [#23452](https://github.com/scipy/scipy/pull/23452): MAINT: Update licensing of bundled software +* [#23457](https://github.com/scipy/scipy/pull/23457): BUG: signal.ShortTimeFFT: Remove `@lru_cache` decorators +* [#23471](https://github.com/scipy/scipy/pull/23471): BUG: optimize: fix the incompatible dtypes in L-BFGS-B +* [#23475](https://github.com/scipy/scipy/pull/23475): BUG: signal.lombscargle: replace in-place input adjustments +* [#23488](https://github.com/scipy/scipy/pull/23488): MAINT: Bump CuPy to 13.6.0 to fix GPU CI +* [#23495](https://github.com/scipy/scipy/pull/23495): MAINT: add lower bound for pytest +* [#23540](https://github.com/scipy/scipy/pull/23540): MAINT, BLD: ignore meson wraplock +* [#23563](https://github.com/scipy/scipy/pull/23563): BUG: fix memory leaks in `optimize.nnls` and `linalg.sqrtm` +* [#23576](https://github.com/scipy/scipy/pull/23576): CI: pin scikit-umfpack to 0.3.3 to avoid failures, 0.4.2 is broken. diff --git a/corpus/changelog/scipy_releases/scipy_1163.md b/corpus/changelog/scipy_releases/scipy_1163.md new file mode 100644 index 0000000000000000000000000000000000000000..c671171bb5db8d283cf6ef30e94d49dda182ef34 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1163.md @@ -0,0 +1,56 @@ +# SciPy 1.16.3 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.16.3-notes.html +Version: 1.16.3 + +Contents + +* [SciPy 1.16.3 Release Notes](#scipy-1-16-3-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.16.3](#issues-closed-for-1-16-3) + - [Pull requests for 1.16.3](#pull-requests-for-1-16-3) + +SciPy 1.16.3 is a bug-fix release with no new features +compared to 1.16.2. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Name (commits) +* ChrisAB (1) + +* Lucas Colley (1) +* Ralf Gommers (3) +* Matt Haberland (8) +* Nick ODell (2) +* Ilhan Polat (1) +* Tyler Reddy (28) +* Lucas Roberts (2) + + > A total of 8 people contributed to this release. + > People with a “+” by their names contributed a patch for the first time. + > This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.16.3](#id3)[#](#issues-closed-for-1-16-3 "Link to this heading") + +* [#23336](https://github.com/scipy/scipy/issues/23336): BUG: linalg: wrong handling of args/kwargs in `_apply_over_batch` +* [#23469](https://github.com/scipy/scipy/issues/23469): BUG: huge speed and quality regression for stats.multivariate\_normal.cdf +* [#23589](https://github.com/scipy/scipy/issues/23589): BUG: `lqmn(1,1,0)` and `lqmn(1,1,0j)` return incompatible… +* [#23642](https://github.com/scipy/scipy/issues/23642): CI: meson setup fails with “invalid int value: ‘Sentinel.UNSET’” +* [#23738](https://github.com/scipy/scipy/issues/23738): BUG: `special.expi(inf)` is `nan`, should be `inf` +* [#23820](https://github.com/scipy/scipy/issues/23820): MAINT, TST: optimize test\_input\_validation torch failure +* [#23859](https://github.com/scipy/scipy/issues/23859): TST, MAINT: boxcox\_llf failing again + +### [Pull requests for 1.16.3](#id4)[#](#pull-requests-for-1-16-3 "Link to this heading") + +* [#23602](https://github.com/scipy/scipy/pull/23602): REL, MAINT: prepare for SciPy 1.16.3 +* [#23615](https://github.com/scipy/scipy/pull/23615): TST, MAINT: backports, restore lfilter +* [#23681](https://github.com/scipy/scipy/pull/23681): BUG: linalg:solve…are: fix bug when optional array is skipped +* [#23685](https://github.com/scipy/scipy/pull/23685): MAINT: optimize: fix usage of `nextafter(..., where=)` without… +* [#23777](https://github.com/scipy/scipy/pull/23777): CI: pin Python 3.11.13 in CircleCI job +* [#23787](https://github.com/scipy/scipy/pull/23787): BUG:optimize:SLSQP: Use double negative in an if condition for… +* [#23815](https://github.com/scipy/scipy/pull/23815): ENH: scipy.stats: speed up bivariate normal cdf +* [#23817](https://github.com/scipy/scipy/pull/23817): BUG/TST: Bump xsf to v0.1.3 add tests for expi limits +* [#23821](https://github.com/scipy/scipy/pull/23821): CI: optimize: allow new Pytorch message +* [#23829](https://github.com/scipy/scipy/pull/23829): MAINT: patch vendored qhull source for security fix +* [#23864](https://github.com/scipy/scipy/pull/23864): TST: stats.boxcox\_llf: bump test tolerance diff --git a/corpus/changelog/scipy_releases/scipy_1170.md b/corpus/changelog/scipy_releases/scipy_1170.md new file mode 100644 index 0000000000000000000000000000000000000000..f43ca92cb875acd83bb0c38ee63201a302211fc9 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_1170.md @@ -0,0 +1,1224 @@ +# SciPy 1.17.0 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.17.0-notes.html +Version: 1.17.0 + +Contents + +* [SciPy 1.17.0 Release Notes](#scipy-1-17-0-release-notes) + + + [Highlights of this release](#highlights-of-this-release) + + [New features](#new-features) + + - [`scipy.integrate` improvements](#scipy-integrate-improvements) + - [`scipy.cluster` improvements](#scipy-cluster-improvements) + - [`scipy.interpolate` improvements](#scipy-interpolate-improvements) + - [`scipy.linalg` improvements](#scipy-linalg-improvements) + - [`scipy.optimize` improvements](#scipy-optimize-improvements) + - [`scipy.signal` improvements](#scipy-signal-improvements) + - [`scipy.sparse` improvements](#scipy-sparse-improvements) + - [`scipy.spatial` improvements](#scipy-spatial-improvements) + - [`scipy.special` improvements](#scipy-special-improvements) + - [`scipy.stats` improvements](#scipy-stats-improvements) + + [Array API Standard Support](#array-api-standard-support) + + [Deprecated features and future changes](#deprecated-features-and-future-changes) + + [Expired deprecations](#expired-deprecations) + + [Backwards incompatible changes](#backwards-incompatible-changes) + + [Other changes](#other-changes) + + [Authors](#authors) + + [Issues closed for 1.17.0](#issues-closed-for-1-17-0) + + [Pull requests for 1.17.0](#pull-requests-for-1-17-0) + +SciPy 1.17.0 is the culmination of 6 months of hard work. It contains +many new features, numerous bug-fixes, improved test coverage and better +documentation. There have been a number of deprecations and API changes +in this release, which are documented below. All users are encouraged to +upgrade to this release, as there are a large number of bug-fixes and +optimizations. Before upgrading, we recommend that users check that +their own code does not use deprecated SciPy functionality (to do so, +run your code with `python -Wd` and check for `DeprecationWarning` s). +Our development attention will now shift to bug-fix releases on the +1.17.x branch, and on adding new features on the main branch. + +This release requires Python 3.11-3.14 and NumPy 1.26.4 or greater. + +## [Highlights of this release](#id2)[#](#highlights-of-this-release "Link to this heading") + +* Many SciPy functions have gained native support for batching of N-dimensional + array input and additional support for the array API standard. An overall + summary of the latter is now available in a + [set of tables](../dev/api-dev/array_api.html#dev-arrayapi-coverage). +* In [`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse"), `coo_array` now supports indexing. This includes integers, + slices, arrays, `np.newaxis`, `Ellipsis`, in 1D, 2D and the relatively + new nD. In [`scipy.sparse.linalg`](../reference/sparse.linalg.html#module-scipy.sparse.linalg "scipy.sparse.linalg"), ARPACK and PROPACK rewrites from Fortran77 + to C now empower the use of external pseudorandom number generators, e.g. + from numpy. +* In [`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial"), `transform.Rotation` and `transform.RigidTransform` + have been extended to support N-D arrays. `geometric_slerp` now has support + for extrapolation. +* [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") has gained the matrix t and logistic distributions and many + performance and accuracy improvements. +* Initial support for 64-bit integer (ILP64) BLAS and LAPACK libraries has + been added, including for MKL and Apple Accelerate. Please report any issues with + ILP64 you encounter. + +## [New features](#id3)[#](#new-features "Link to this heading") + +### [`scipy.integrate` improvements](#id4)[#](#scipy-integrate-improvements "Link to this heading") + +* The integration routines `dopri5`, `dopri853`, `LSODA`, `vode`, and + `zvode` have been ported from Fortran77 to C. +* [`scipy.integrate.quad`](../reference/generated/scipy.integrate.quad.html#scipy.integrate.quad "scipy.integrate.quad") now has a fast path for returning 0 when the integration + interval is empty. +* The `BDF`, `DOP853`, `RK23`, `RK45`, `OdeSolver`, `DenseOutput`, + `ode`, and `complex_ode` classes now support subscription, making them + generic types, for compatibility with `scipy-stubs`. + +### [`scipy.cluster` improvements](#id5)[#](#scipy-cluster-improvements "Link to this heading") + +* [`scipy.cluster.hierarchy.is_isomorphic`](../reference/generated/scipy.cluster.hierarchy.is_isomorphic.html#scipy.cluster.hierarchy.is_isomorphic "scipy.cluster.hierarchy.is_isomorphic") has improved performance and array + API support. + +### [`scipy.interpolate` improvements](#id6)[#](#scipy-interpolate-improvements "Link to this heading") + +* A new `bc_type` argument has been added to [`scipy.interpolate.make_splrep`](../reference/generated/scipy.interpolate.make_splrep.html#scipy.interpolate.make_splrep "scipy.interpolate.make_splrep"), + [`scipy.interpolate.make_splprep`](../reference/generated/scipy.interpolate.make_splprep.html#scipy.interpolate.make_splprep "scipy.interpolate.make_splprep"), and [`scipy.interpolate.generate_knots`](../reference/generated/scipy.interpolate.generate_knots.html#scipy.interpolate.generate_knots "scipy.interpolate.generate_knots") to + control the boundary conditions for spline fitting. Allowed values are + `"not-a-knot"` (default) and `"periodic"`. +* A new `derivative` method has been added to the + [`scipy.interpolate.NdBSpline`](../reference/generated/scipy.interpolate.NdBSpline.html#scipy.interpolate.NdBSpline "scipy.interpolate.NdBSpline") class, to construct a new spline representing a + partial derivative of the given spline. This method is similar to the + `BSpline.derivative` method of 1-D spline objects. In addition, the + `NdBSpline` mutable instance attribute `.c` was changed into a read-only + `@property`. +* Performance of `"cubic"` and `"quintic"` modes of + [`scipy.interpolate.RegularGridInterpolator`](../reference/generated/scipy.interpolate.RegularGridInterpolator.html#scipy.interpolate.RegularGridInterpolator "scipy.interpolate.RegularGridInterpolator") has been improved. Furthermore, + the (mutable) instance attributes `.grid` and `.values` were changed into + (read-only) properties. +* Numerical stability of [`scipy.interpolate.AAA`](../reference/generated/scipy.interpolate.AAA.html#scipy.interpolate.AAA "scipy.interpolate.AAA") has been improved and it has + gained a new `axis` parameter. +* [`scipy.interpolate.FloaterHormannInterpolator`](../reference/generated/scipy.interpolate.FloaterHormannInterpolator.html#scipy.interpolate.FloaterHormannInterpolator "scipy.interpolate.FloaterHormannInterpolator") added support for + multidimensional, batched inputs and gained a new `axis` parameter to + select the interpolation axis. +* `RBFInterpolator` has gained an array API standard compatible backend, with an + improved support for GPU arrays. +* The `AAA`, `*Interpolator`, `*Poly`, and `*Spline` classes now + support subscription, making them generic types, for compatibility with + `scipy-stubs`. + +### [`scipy.linalg` improvements](#id7)[#](#scipy-linalg-improvements "Link to this heading") + +* [`scipy.linalg.inv`](../reference/generated/scipy.linalg.inv.html#scipy.linalg.inv "scipy.linalg.inv") routine has been improved: + + + it now attempts to detect the structure of its argument and selects an + appropriate low-level matrix inversion routine. A new `assume_a` keyword + allows to bypass the structure detection if the structure is known. For + batched inputs, the detection is run for each 2D slice, unless an explicit + value for `assume_a` is provided (in which case, the structure is + assumed to be the same for all 2-D slices of the batch); + + the new `lower={True,False}` keyword argument has been added to help + select the upper or lower triangle of the input matrix for symmetric + inputs; refer to the docstring of [`scipy.linalg.inv`](../reference/generated/scipy.linalg.inv.html#scipy.linalg.inv "scipy.linalg.inv") for details; + + the routine emits a `LinAlgWarning` if it detects an ill-conditioned + input; + + performance for batched inputs has been improved. +* [`scipy.linalg.fiedler`](../reference/generated/scipy.linalg.fiedler.html#scipy.linalg.fiedler "scipy.linalg.fiedler") has gained native support for batched inputs. +* performance has improved for [`scipy.linalg.solve`](../reference/generated/scipy.linalg.solve.html#scipy.linalg.solve "scipy.linalg.solve") with batched inputs + for certain matrix structures. + +### [`scipy.optimize` improvements](#id8)[#](#scipy-optimize-improvements "Link to this heading") + +* `optimize.minimize(method="trust-exact")` now accepts a + solver-specific `"subproblem_maxiter"` option. This option can be used to + assure that the algorithm converges for functions with an ill-conditioned + Hessian. +* Callback functions used by `optimize.minimize(method="slsqp")` can + opt into the new callback interface by accepting a single keyword argument + `intermediate_result`. +* The `BroydenFirst`, `*Jacobian`, and `Bounds` classes now support + subscription, making them generic types, for compatibility with + `scipy-stubs`. + +### [`scipy.signal` improvements](#id9)[#](#scipy-signal-improvements "Link to this heading") + +* [`abcd_normalize`](../reference/generated/scipy.signal.abcd_normalize.html#scipy.signal.abcd_normalize "scipy.signal.abcd_normalize") gained more informative error messages and the + documentation was improved. +* [`get_window`](../reference/generated/scipy.signal.get_window.html#scipy.signal.get_window "scipy.signal.get_window") now accepts the suffixes `'_periodic'` and + `'_symmetric'` to distinguish between periodic and symmetric windows + (overriding the `fftbin` parameter). This benefits the functions + `coherence`, `csd`, `periodogram`, `welch`, `spectrogram`, + `stft`, `istft`, `resample`, `resample_poly`, `firwin`, + `firwin2`, `firwin_2d`, `check_COLA` and `check_NOLA`, which utilize + `get_window` but do not expose the `fftbin` parameter. +* [`hilbert2`](../reference/generated/scipy.signal.hilbert2.html#scipy.signal.hilbert2 "scipy.signal.hilbert2") gained the new keyword `axes` for specifying the + axes along which the two-dimensional analytic signal should be calculated. + Furthermore, the documentation of [`hilbert`](../reference/generated/scipy.signal.hilbert.html#scipy.signal.hilbert "scipy.signal.hilbert") and + [`hilbert2`](../reference/generated/scipy.signal.hilbert2.html#scipy.signal.hilbert2 "scipy.signal.hilbert2") was significantly improved. +* The `ShortTimeFFT` and `LinearTimeInvariant` classes now support + subscription, making them generic types, for compatibility with + `scipy-stubs`. + +### [`scipy.sparse` improvements](#id10)[#](#scipy-sparse-improvements "Link to this heading") + +* `coo_array` now supports indexing. This includes slices, arrays, + `np.newaxis`, `Ellipsis`, in 1D, 2D and the new nD. So COO format now + has full support for nD and COO now allows indexing without converting + formats. +* Additional sparse construction functions include `expand_dims`, + `swapaxes`, `permute_dims`, and nD support for the `kron` function. +* ARPACK Fortran77 library is ported to C. Among many changes, it is now + possible to use external random generators including NumPy PRNGs for + reproducible runs. Previously this was not the case due to internal seeding + behavior of the original ARPACK code. +* Similarly, PROPACK Fortran77 library is also ported to C with the same PRNG + enhancements and other improvements. +* [`dok_array`](../reference/generated/scipy.sparse.dok_array.html#scipy.sparse.dok_array "scipy.sparse.dok_array") now supports an `update` method which can be + used to update the sparse array using a dict, `dict.items()`-like iterable, + or another `dok_array` matrix. It performs additional validation that keys + are valid index tuples. +* [`tocsr`](../reference/generated/scipy.sparse.dia_array.tocsr.html#scipy.sparse.dia_array.tocsr "scipy.sparse.dia_array.tocsr") is approximately three times faster and + some unnecessary copy operations have been removed from sparse format + interconversions more broadly. +* Added [`scipy.sparse.linalg.funm_multiply_krylov`](../reference/generated/scipy.sparse.linalg.funm_multiply_krylov.html#scipy.sparse.linalg.funm_multiply_krylov "scipy.sparse.linalg.funm_multiply_krylov"), a restarted Krylov method + for evaluating `y = f(tA) b`. +* In `sparse.linalg`, the `LinearOperator`, `LaplacianNd`, and `SuperLU` + classes now support subscription, making them generic types, for + compatibility with `scipy-stubs`. +* In `sparse.linalg` the `eigs` and `eigsh` functions now accept a new + `rng` parameter. + +### [`scipy.spatial` improvements](#id11)[#](#scipy-spatial-improvements "Link to this heading") + +* The `spatial.transform` module has gained an array API standard compatible + backend. +* `transform.Rotation` and `transform.RigidTransform` have been extended + from 0D single values and 1D arrays to N-D arrays, with standard indexing and + broadcasting rules. Both now have the following additions: + + + A `shape` property. + + A `shape` argument to their `identity()` constructors, which should be + preferred over the existing `num` argument. This has also been added as an + argument for `Rotation.random()` (`RigidTransform` does not currently + have a `random` constructor). + + An `axis` argument to their `mean()` functions. +* The resulting shapes for `transform.Rotation.from_euler` / + `from_davenport` have changed to make them consistent with broadcasting + rules. Angle inputs to Euler angles must now strictly match the number of + provided axes in the last dimension. The resulting `Rotation` has the shape + `np.atleast_1d(angles).shape[:-1]`. Angle inputs to Davenport angles must + also match the number of axes in the last dimension. The resulting `Rotation` + has the shape `np.broadcast_shapes(np.atleast_2d(axes).shape[:-2], + np.atleast_1d(angles).shape[:-1])`. +* `Rotation.from_matrix` has gained an `assume_valid` argument that allows for + performance improvements when users can guarantee valid matrix inputs. + `from_matrix` is now also faster in cases where a known orthogonal matrix + is used. +* The [`scipy.spatial.geometric_slerp`](../reference/generated/scipy.spatial.geometric_slerp.html#scipy.spatial.geometric_slerp "scipy.spatial.geometric_slerp") function can now extrapolate. When given a + value outside the range [0, 1], `geometric_slerp()` will continue with + the same rotation outside this range. For example, if spherically + interpolating with `start` being a point on the equator, and `end` + being a point at the north pole, then a value of `t=-1` would give you a + point at the south pole. +* `Rotation.as_euler` and `Rotation.as_davenport` methods have gained a + `suppress_warnings` parameter to enable suppression of gimbal lock warnings. +* `Rotation.__init__` has gained a new optional `scalar_first` parameter and + there is a new `Rotation.__setitem__` method. + +### [`scipy.special` improvements](#id12)[#](#scipy-special-improvements "Link to this heading") + +* The following functions for statistical applications have significantly + improved parameter ranges and reduced error rates: `btdtria`, `btdtrib`, + `chdtriv`, `chndtr`, `chndtrix`, `chndtridf`, `chndtrinc`, `fdtr`, + `fdtrc`, `fdtri`, `gdtria`, `gdtrix`, `pdtrik`, `stdtr` and + `stdtrit`. +* The incomplete beta functions `betainc`, `betaincc`, `betaincinv` and + `betainccinv` are improved for extreme parameter ranges. + +### [`scipy.stats` improvements](#id13)[#](#scipy-stats-improvements "Link to this heading") + +* [`scipy.stats.matrix_t`](../reference/generated/scipy.stats.matrix_t.html#scipy.stats.matrix_t "scipy.stats.matrix_t") has been added to represent the matrix t distribution. + It supports methods `pdf` (and `logpdf`) for computing the probability + density function and `rvs` for generating random variates. +* [`scipy.stats.Logistic`](../reference/generated/scipy.stats.Logistic.html#scipy.stats.Logistic "scipy.stats.Logistic") was added for modeling random variables that follow a + logistic distribution. +* [`scipy.stats.quantile`](../reference/generated/scipy.stats.quantile.html#scipy.stats.quantile "scipy.stats.quantile") now accepts a `weights` argument to specify + frequency weights. +* [`scipy.stats.quantile`](../reference/generated/scipy.stats.quantile.html#scipy.stats.quantile "scipy.stats.quantile") is now faster on large arrays as it no longer uses + stable sort internally. +* [`scipy.stats.quantile`](../reference/generated/scipy.stats.quantile.html#scipy.stats.quantile "scipy.stats.quantile") supports three new values of the `method` argument, + `'round_inward'`, `'round_outward'`, and `'round_neareast'`, for use in + the context of trimming and winsorizing data. +* [`scipy.stats.truncpareto`](../reference/generated/scipy.stats.truncpareto.html#scipy.stats.truncpareto "scipy.stats.truncpareto") now accepts negative values for the exponent shape + parameter, enabling use of `truncpareto` as a more general power law + distribution. +* [`scipy.stats.logser`](../reference/generated/scipy.stats.logser.html#scipy.stats.logser "scipy.stats.logser") now provides a distribution-specific implementation of + the `sf` method, improving speed and accuracy. +* Implementations of the following function have been vectorized: + [`scipy.stats.ansari`](../reference/generated/scipy.stats.ansari.html#scipy.stats.ansari "scipy.stats.ansari"), [`scipy.stats.cramervonmises`](../reference/generated/scipy.stats.cramervonmises.html#scipy.stats.cramervonmises "scipy.stats.cramervonmises"), + [`scipy.stats.cramervonmises_2samp`](../reference/generated/scipy.stats.cramervonmises_2samp.html#scipy.stats.cramervonmises_2samp "scipy.stats.cramervonmises_2samp"), [`scipy.stats.epps_singleton_2samp`](../reference/generated/scipy.stats.epps_singleton_2samp.html#scipy.stats.epps_singleton_2samp "scipy.stats.epps_singleton_2samp"), + [`scipy.stats.fligner`](../reference/generated/scipy.stats.fligner.html#scipy.stats.fligner "scipy.stats.fligner"), [`scipy.stats.friedmanchisquare`](../reference/generated/scipy.stats.friedmanchisquare.html#scipy.stats.friedmanchisquare "scipy.stats.friedmanchisquare"), [`scipy.stats.kruskal`](../reference/generated/scipy.stats.kruskal.html#scipy.stats.kruskal "scipy.stats.kruskal"), + [`scipy.stats.ks_1samp`](../reference/generated/scipy.stats.ks_1samp.html#scipy.stats.ks_1samp "scipy.stats.ks_1samp"), [`scipy.stats.levene`](../reference/generated/scipy.stats.levene.html#scipy.stats.levene "scipy.stats.levene"), and [`scipy.stats.mood`](../reference/generated/scipy.stats.mood.html#scipy.stats.mood "scipy.stats.mood"). + Typically, this improves performance with multidimensional (batch) input. +* The critical value tables of [`scipy.stats.anderson`](../reference/generated/scipy.stats.anderson.html#scipy.stats.anderson "scipy.stats.anderson") have been updated. +* A new `method` parameter of [`scipy.stats.anderson`](../reference/generated/scipy.stats.anderson.html#scipy.stats.anderson "scipy.stats.anderson") allows the user + to compute p-values by interpolating between tabulated values or using Monte + Carlo simulation. The `method` parameter must be passed explicitly + to add a `pvalue` attribute to the result object and avoid a warning + about the upcoming removal of `critical_value`, `significance_level`, + and `fit_result` attributes. +* A new `variant` parameter of [`scipy.stats.anderson_ksamp`](../reference/generated/scipy.stats.anderson_ksamp.html#scipy.stats.anderson_ksamp "scipy.stats.anderson_ksamp") allows the user + to select between three different variants of the statistic, superseding the + `midrank` parameter which allowed toggling between two. The new `'continuous'` + variant is equivalent to `'discrete'` when there are no ties in the sample, but + the calculation is faster. The `variant` parameter must be passed explicitly to + avoid a warning about the deprecation of the `midrank` attribute and the upcoming + removal of `critical_values` from the result object. +* The speed and accuracy of most [`scipy.stats.zipfian`](../reference/generated/scipy.stats.zipfian.html#scipy.stats.zipfian "scipy.stats.zipfian") methods has been + improved. +* The accuracies of the [`scipy.stats.Binomial`](../reference/generated/scipy.stats.Binomial.html#scipy.stats.Binomial "scipy.stats.Binomial") methods `logcdf` and + `logccdf` have been improved in the tails. +* The default guess of `scipy.stats.trapezoid.fit` has been improved. +* The accuracy and range of the `cdf`, `sf`, `isf`, and `ppf` methods + of [`scipy.stats.binom`](../reference/generated/scipy.stats.binom.html#scipy.stats.binom "scipy.stats.binom") and [`scipy.stats.nbinom`](../reference/generated/scipy.stats.nbinom.html#scipy.stats.nbinom "scipy.stats.nbinom") has been improved. +* The `Covariance`, `Uniform`, `Normal`, `Binomial`, `Mixture`, + `rv_frozen`, and `multi_rv_frozen` classes now support subscription, + making them generic types, for compatibility with `scipy-stubs`. +* The `multivariate_t` and `multivariate_normal` distributions have gained + a new `marginal` method. +* `yeojohnson_llf` gained new parameters `axis`, `nan_policy`, + and `keepdims`, and now returns a numpy scalar where it would previously + return a 0D array. +* The new `spearmanrho` function is an array API compatible substitute for + `spearmanr`. +* The `median_abs_deviation` function has gained a `keepdims` parameter. +* The `trim_mean` function has gained new `nan_policy` and `keepdims` + parameters. + +## [Array API Standard Support](#id14)[#](#array-api-standard-support "Link to this heading") + +* An overall summary table for our array API standard support/coverage is + [now available](../dev/api-dev/array_api.html#dev-arrayapi-coverage). +* The overhead associated with array namespace determination has been reduced, + providing improved performance in dispatching to different backends. +* [`scipy.cluster.hierarchy.is_isomorphic`](../reference/generated/scipy.cluster.hierarchy.is_isomorphic.html#scipy.cluster.hierarchy.is_isomorphic "scipy.cluster.hierarchy.is_isomorphic") has gained support. +* [`scipy.interpolate.make_lsq_spline`](../reference/generated/scipy.interpolate.make_lsq_spline.html#scipy.interpolate.make_lsq_spline "scipy.interpolate.make_lsq_spline"), [`scipy.interpolate.make_smoothing_spline`](../reference/generated/scipy.interpolate.make_smoothing_spline.html#scipy.interpolate.make_smoothing_spline "scipy.interpolate.make_smoothing_spline"), + [`scipy.interpolate.make_splrep`](../reference/generated/scipy.interpolate.make_splrep.html#scipy.interpolate.make_splrep "scipy.interpolate.make_splrep"), [`scipy.interpolate.make_splprep`](../reference/generated/scipy.interpolate.make_splprep.html#scipy.interpolate.make_splprep "scipy.interpolate.make_splprep"), + [`scipy.interpolate.generate_knots`](../reference/generated/scipy.interpolate.generate_knots.html#scipy.interpolate.generate_knots "scipy.interpolate.generate_knots"), and [`scipy.interpolate.make_interp_spline`](../reference/generated/scipy.interpolate.make_interp_spline.html#scipy.interpolate.make_interp_spline "scipy.interpolate.make_interp_spline") + have gained support. +* [`scipy.signal.bilinear`](../reference/generated/scipy.signal.bilinear.html#scipy.signal.bilinear "scipy.signal.bilinear"), [`scipy.signal.iircomb`](../reference/generated/scipy.signal.iircomb.html#scipy.signal.iircomb "scipy.signal.iircomb"), [`scipy.signal.iirdesign`](../reference/generated/scipy.signal.iirdesign.html#scipy.signal.iirdesign "scipy.signal.iirdesign"), + [`scipy.signal.iirfilter`](../reference/generated/scipy.signal.iirfilter.html#scipy.signal.iirfilter "scipy.signal.iirfilter"), [`scipy.signal.iirpeak`](../reference/generated/scipy.signal.iirpeak.html#scipy.signal.iirpeak "scipy.signal.iirpeak"), [`scipy.signal.iirnotch`](../reference/generated/scipy.signal.iirnotch.html#scipy.signal.iirnotch "scipy.signal.iirnotch"), + [`scipy.signal.gammatone`](../reference/generated/scipy.signal.gammatone.html#scipy.signal.gammatone "scipy.signal.gammatone"), and [`scipy.signal.group_delay`](../reference/generated/scipy.signal.group_delay.html#scipy.signal.group_delay "scipy.signal.group_delay") have gained support. +* [`scipy.signal.butter`](../reference/generated/scipy.signal.butter.html#scipy.signal.butter "scipy.signal.butter"), [`scipy.signal.buttap`](../reference/generated/scipy.signal.buttap.html#scipy.signal.buttap "scipy.signal.buttap"), [`scipy.signal.buttord`](../reference/generated/scipy.signal.buttord.html#scipy.signal.buttord "scipy.signal.buttord"), + [`scipy.signal.cheby1`](../reference/generated/scipy.signal.cheby1.html#scipy.signal.cheby1 "scipy.signal.cheby1"), [`scipy.signal.cheb1ap`](../reference/generated/scipy.signal.cheb1ap.html#scipy.signal.cheb1ap "scipy.signal.cheb1ap"), [`scipy.signal.cheb1ord`](../reference/generated/scipy.signal.cheb1ord.html#scipy.signal.cheb1ord "scipy.signal.cheb1ord"), + [`scipy.signal.cheby2`](../reference/generated/scipy.signal.cheby2.html#scipy.signal.cheby2 "scipy.signal.cheby2"), [`scipy.signal.cheb2ap`](../reference/generated/scipy.signal.cheb2ap.html#scipy.signal.cheb2ap "scipy.signal.cheb2ap"), [`scipy.signal.cheb2ord`](../reference/generated/scipy.signal.cheb2ord.html#scipy.signal.cheb2ord "scipy.signal.cheb2ord"), + [`scipy.signal.bessel`](../reference/generated/scipy.signal.bessel.html#scipy.signal.bessel "scipy.signal.bessel"), [`scipy.signal.besselap`](../reference/generated/scipy.signal.besselap.html#scipy.signal.besselap "scipy.signal.besselap"), [`scipy.signal.ellip`](../reference/generated/scipy.signal.ellip.html#scipy.signal.ellip "scipy.signal.ellip"), + [`scipy.signal.ellipap`](../reference/generated/scipy.signal.ellipap.html#scipy.signal.ellipap "scipy.signal.ellipap"), and [`scipy.signal.ellipord`](../reference/generated/scipy.signal.ellipord.html#scipy.signal.ellipord "scipy.signal.ellipord") have gained support. +* [`scipy.signal.savgol_filter`](../reference/generated/scipy.signal.savgol_filter.html#scipy.signal.savgol_filter "scipy.signal.savgol_filter"), [`scipy.signal.savgol_coeffs`](../reference/generated/scipy.signal.savgol_coeffs.html#scipy.signal.savgol_coeffs "scipy.signal.savgol_coeffs"), and + [`scipy.signal.abcd_normalize`](../reference/generated/scipy.signal.abcd_normalize.html#scipy.signal.abcd_normalize "scipy.signal.abcd_normalize") have gained support. +* `spatial.transform` has gained support. +* [`scipy.integrate.qmc_quad`](../reference/generated/scipy.integrate.qmc_quad.html#scipy.integrate.qmc_quad "scipy.integrate.qmc_quad"), [`scipy.integrate.cumulative_simpson`](../reference/generated/scipy.integrate.cumulative_simpson.html#scipy.integrate.cumulative_simpson "scipy.integrate.cumulative_simpson"), + [`scipy.integrate.cumulative_trapezoid`](../reference/generated/scipy.integrate.cumulative_trapezoid.html#scipy.integrate.cumulative_trapezoid "scipy.integrate.cumulative_trapezoid"), and [`scipy.integrate.romb`](../reference/generated/scipy.integrate.romb.html#scipy.integrate.romb "scipy.integrate.romb") have + gained support. +* [`scipy.linalg.block_diag`](../reference/generated/scipy.linalg.block_diag.html#scipy.linalg.block_diag "scipy.linalg.block_diag"), [`scipy.linalg.fiedler`](../reference/generated/scipy.linalg.fiedler.html#scipy.linalg.fiedler "scipy.linalg.fiedler"), and + [`scipy.linalg.orthogonal_procrustes`](../reference/generated/scipy.linalg.orthogonal_procrustes.html#scipy.linalg.orthogonal_procrustes "scipy.linalg.orthogonal_procrustes") have gained support. +* [`scipy.interpolate.BSpline`](../reference/generated/scipy.interpolate.BSpline.html#scipy.interpolate.BSpline "scipy.interpolate.BSpline"), [`scipy.interpolate.NdBSpline`](../reference/generated/scipy.interpolate.NdBSpline.html#scipy.interpolate.NdBSpline "scipy.interpolate.NdBSpline"), + [`scipy.interpolate.RegularGridInterpolator`](../reference/generated/scipy.interpolate.RegularGridInterpolator.html#scipy.interpolate.RegularGridInterpolator "scipy.interpolate.RegularGridInterpolator"), and + [`scipy.interpolate.RBFInterpolator`](../reference/generated/scipy.interpolate.RBFInterpolator.html#scipy.interpolate.RBFInterpolator "scipy.interpolate.RBFInterpolator") gained support. +* Support added for [`scipy.stats.alexandergovern`](../reference/generated/scipy.stats.alexandergovern.html#scipy.stats.alexandergovern "scipy.stats.alexandergovern"), [`scipy.stats.bootstrap`](../reference/generated/scipy.stats.bootstrap.html#scipy.stats.bootstrap "scipy.stats.bootstrap"), + [`scipy.stats.brunnermunzel`](../reference/generated/scipy.stats.brunnermunzel.html#scipy.stats.brunnermunzel "scipy.stats.brunnermunzel"), [`scipy.stats.chatterjeexi`](../reference/generated/scipy.stats.chatterjeexi.html#scipy.stats.chatterjeexi "scipy.stats.chatterjeexi"), + [`scipy.stats.cramervonmises`](../reference/generated/scipy.stats.cramervonmises.html#scipy.stats.cramervonmises "scipy.stats.cramervonmises"), [`scipy.stats.cramervonmises_2samp`](../reference/generated/scipy.stats.cramervonmises_2samp.html#scipy.stats.cramervonmises_2samp "scipy.stats.cramervonmises_2samp"), + [`scipy.stats.epps_singleton_2samp`](../reference/generated/scipy.stats.epps_singleton_2samp.html#scipy.stats.epps_singleton_2samp "scipy.stats.epps_singleton_2samp"), [`scipy.stats.false_discovery_control`](../reference/generated/scipy.stats.false_discovery_control.html#scipy.stats.false_discovery_control "scipy.stats.false_discovery_control"), + [`scipy.stats.fligner`](../reference/generated/scipy.stats.fligner.html#scipy.stats.fligner "scipy.stats.fligner"), [`scipy.stats.friedmanchisquare`](../reference/generated/scipy.stats.friedmanchisquare.html#scipy.stats.friedmanchisquare "scipy.stats.friedmanchisquare"), [`scipy.stats.iqr`](../reference/generated/scipy.stats.iqr.html#scipy.stats.iqr "scipy.stats.iqr"), + [`scipy.stats.kruskal`](../reference/generated/scipy.stats.kruskal.html#scipy.stats.kruskal "scipy.stats.kruskal"), [`scipy.stats.ks_1samp`](../reference/generated/scipy.stats.ks_1samp.html#scipy.stats.ks_1samp "scipy.stats.ks_1samp"), [`scipy.stats.levene`](../reference/generated/scipy.stats.levene.html#scipy.stats.levene "scipy.stats.levene"), + [`scipy.stats.lmoment`](../reference/generated/scipy.stats.lmoment.html#scipy.stats.lmoment "scipy.stats.lmoment"), [`scipy.stats.mannwhitneyu`](../reference/generated/scipy.stats.mannwhitneyu.html#scipy.stats.mannwhitneyu "scipy.stats.mannwhitneyu"), + [`scipy.stats.median_abs_deviation`](../reference/generated/scipy.stats.median_abs_deviation.html#scipy.stats.median_abs_deviation "scipy.stats.median_abs_deviation"), [`scipy.stats.mode`](../reference/generated/scipy.stats.mode.html#scipy.stats.mode "scipy.stats.mode"), [`scipy.stats.mood`](../reference/generated/scipy.stats.mood.html#scipy.stats.mood "scipy.stats.mood"), + [`scipy.stats.ansari`](../reference/generated/scipy.stats.ansari.html#scipy.stats.ansari "scipy.stats.ansari"), + [`scipy.stats.power`](../reference/generated/scipy.stats.power.html#scipy.stats.power "scipy.stats.power"), [`scipy.stats.permutation_test`](../reference/generated/scipy.stats.permutation_test.html#scipy.stats.permutation_test "scipy.stats.permutation_test"), [`scipy.stats.sigmaclip`](../reference/generated/scipy.stats.sigmaclip.html#scipy.stats.sigmaclip "scipy.stats.sigmaclip"), + [`scipy.stats.wilcoxon`](../reference/generated/scipy.stats.wilcoxon.html#scipy.stats.wilcoxon "scipy.stats.wilcoxon"), and [`scipy.stats.yeojohnson_llf`](../reference/generated/scipy.stats.yeojohnson_llf.html#scipy.stats.yeojohnson_llf "scipy.stats.yeojohnson_llf"). +* [`scipy.stats.pearsonr`](../reference/generated/scipy.stats.pearsonr.html#scipy.stats.pearsonr "scipy.stats.pearsonr") has gained support for JAX and Dask backends. +* [`scipy.stats.variation`](../reference/generated/scipy.stats.variation.html#scipy.stats.variation "scipy.stats.variation") has gained support for the Dask backend. +* `marray` support was added for `stats.gtstd`, `stats.directional_stats`, + `stats.bartlett`, `stats.variation`, `stats.pearsonr`, and + `stats.entropy`. + +## [Deprecated features and future changes](#id15)[#](#deprecated-features-and-future-changes "Link to this heading") + +* The [`scipy.odr`](../reference/odr.html#module-scipy.odr "scipy.odr") module is deprecated in v1.17.0 and will be completely + removed in v1.19.0. Users are suggested to use the `odrpack` package instead. +* The default dype behavior of [`scipy.sparse.diags`](../reference/generated/scipy.sparse.diags.html#scipy.sparse.diags "scipy.sparse.diags") and + [`scipy.sparse.diags_array`](../reference/generated/scipy.sparse.diags_array.html#scipy.sparse.diags_array "scipy.sparse.diags_array") will change in v1.19.0. +* In v1.19.0, [`scipy.linalg.hankel`](../reference/generated/scipy.linalg.hankel.html#scipy.linalg.hankel "scipy.linalg.hankel") will no longer ravel multidimensional + inputs and instead will treat them as a batch. +* The `precenter` argument of [`scipy.signal.lombscargle`](../reference/generated/scipy.signal.lombscargle.html#scipy.signal.lombscargle "scipy.signal.lombscargle") is deprecated and + will be removed in v1.19.0. Furthermore, some arguments will become keyword + only. +* For [`scipy.stats.anderson`](../reference/generated/scipy.stats.anderson.html#scipy.stats.anderson "scipy.stats.anderson"), the tuple-unpacking behavior of the return object + and attributes `critical_values`, `significance_level`, and + `fit_result` are deprecated. Use the new `method` parameter to avoid the + deprecation warning. Beginning in SciPy 1.19.0, these features will + no longer be available, and the object returned will have attributes + `statistic` and `pvalue`. +* For [`scipy.stats.anderson_ksamp`](../reference/generated/scipy.stats.anderson_ksamp.html#scipy.stats.anderson_ksamp "scipy.stats.anderson_ksamp"), the `midrank` parameter is deprecated + and the new `variant` parameter should be preferred. This also means that + the presence of the `critical_values` return array is deprecated. + +## [Expired deprecations](#id16)[#](#expired-deprecations "Link to this heading") + +* `scipy.stats.find_repeats` has been removed. Please use + `numpy.unique`/`numpy.unique_counts` instead. +* [`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") functions for Toeplitz matrices no longer ravel n-d input + arguments; instead, multidimensional input is treated as a batch. +* The `seed` and `rand` functions from [`scipy.linalg.interpolative`](../reference/linalg.interpolative.html#module-scipy.linalg.interpolative "scipy.linalg.interpolative") have + been removed. Use the `rng` argument instead. +* Complex inputs to [`scipy.spatial.distance.cosine`](../reference/generated/scipy.spatial.distance.cosine.html#scipy.spatial.distance.cosine "scipy.spatial.distance.cosine") and + [`scipy.spatial.distance.correlation`](../reference/generated/scipy.spatial.distance.correlation.html#scipy.spatial.distance.correlation "scipy.spatial.distance.correlation") now raise an error. +* Support for object arrays and longdoubles has been removed from + [`scipy.signal.correlate`](../reference/generated/scipy.signal.correlate.html#scipy.signal.correlate "scipy.signal.correlate"), [`scipy.signal.convolve`](../reference/generated/scipy.signal.convolve.html#scipy.signal.convolve "scipy.signal.convolve"), [`scipy.signal.lfilter`](../reference/generated/scipy.signal.lfilter.html#scipy.signal.lfilter "scipy.signal.lfilter"), + and [`scipy.signal.sosfilt`](../reference/generated/scipy.signal.sosfilt.html#scipy.signal.sosfilt "scipy.signal.sosfilt"). +* `kulczynski1` and `sokalmichener` have been removed from + [`scipy.spatial.distance`](../reference/spatial.distance.html#module-scipy.spatial.distance "scipy.spatial.distance"). +* `kron` has been removed from [`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg"). Please use `numpy.kron`. +* Accidentally exposed functions have been removed from + `scipy.interpolate.interpnd`. +* The `random_state` and `permutation` arguments of + [`scipy.stats.ttest_ind`](../reference/generated/scipy.stats.ttest_ind.html#scipy.stats.ttest_ind "scipy.stats.ttest_ind") have been removed. +* `sph_harm`, `clpmn`, `lpn`, and `lpmn` have been removed from + [`scipy.special`](../reference/special.html#module-scipy.special "scipy.special"). + +## [Backwards incompatible changes](#id17)[#](#backwards-incompatible-changes "Link to this heading") + +* The resulting shapes for `transform.Rotation.from_euler` / + `from_davenport` have changed to make them consistent with broadcasting + rules. Angle inputs to Euler angles must now strictly match the number of + provided axes in the last dimension. The resulting `Rotation` has the shape + `np.atleast_1d(angles).shape[:-1]`. Angle inputs to Davenport angles must + also match the number of axes in the last dimension. The resulting `Rotation` + has the shape `np.broadcast_shapes(np.atleast_2d(axes).shape[:-2], + np.atleast_1d(angles).shape[:-1])`. + +## [Other changes](#id18)[#](#other-changes "Link to this heading") + +* The version of the Boost Math library leveraged by SciPy has been + increased from `1.88.0` to `1.89.0`. +* On POSIX operating systems, SciPy will now use the `'forkserver'` + multiprocessing context on Python 3.13 and older for `workers=` + calls if the user hasn’t configured a default method themselves. This follows + the default behavior on Python 3.14. +* Initial support for 64-bit integer (ILP64) BLAS and LAPACK libraries has been + added. To enable it, build SciPy with `-Duse-ilp64=true` meson option, and make + sure to have a LAPACK library which exposes both LP64 and ILP64 symbols. + Currently supported LAPACK libraries are MKL and Apple Accelerate. Note that: + + + the ILP64 support is optional, and is in addition to the always-available + LP64 interface; + + at runtime, you can select the ILP64 variants via the + `get_{blas,lapack}_funcs` functions: + `scipy.linalg.lapack.get_lapack_funcs(..., use_ilp64="preferred")` selects + the ILP64 variant if available and LP64 variant otherwise; + + `cython_blas` and `cython_lapack` modules always contain the LP64 + routines for ABI compatibility. + +Please report any issues with ILP64 you encounter. + +## [Authors](#id19)[#](#authors "Link to this heading") + +* Name (commits) +* h-vetinari (3) +* Joshua Alexander (1) + +* Amit Aronovitch (1) + +* Ayush Baranwal (1) + +* Cristrian Batrin (1) + +* Marco Berzborn (1) + +* Ole Bialas (1) + +* Om Biradar (1) + +* Florian Bourgey (2) +* Jake Bowhay (103) +* Matteo Brivio (1) + +* Dietrich Brunn (34) +* Johannes Buchner (2) + +* Evgeni Burovski (292) +* Nicholas Carlini (1) + +* Luca Cerina (1) + +* Christine P. Chai (35) +* Saransh Chopra (1) +* Lucas Colley (121) +* Björn Ingvar Dahlgren (2) + +* Sumit Das (1) + +* Hans Dembinski (1) +* John M Dusel (1) + +* DWesl (4) +* Pieter Eendebak (6) +* Kian Eliasi (2) +* Rob Falck (1) +* Abdullah Fayed (3) + +* Emmanuel Ferdman (2) + +* Filipe Laíns (1) + +* Daniel Fremont (1) + +* Neil Girdhar (1) +* Ilan Gold (35) +* Nathan Goldbaum (3) + +* Ralf Gommers (124) +* Nicolas Guidotti (1) + +* Geoffrey Gunter (1) + +* Matt Haberland (183) +* Joren Hammudoglu (60) +* Jacob Hass (2) + +* Nick Hodgskin (1) + +* Stephen Huan (1) + +* Guido Imperiale (41) +* Gert-Ludwig Ingold (1) +* Jaime Rodríguez-Guerra (2) + +* Jan Möseritz-Schmidt (2) + +* JBlitzar (1) + +* Adam Jones (2) +* Dustin Kenefake (1) + +* Robert Kern (3) +* Gleb Khmyznikov (1) + +* Daniil Kiktenko (1) + +* Pascal Klein (2) + +* kleiter (1) + +* Oliver Kovacs (1) + +* Koven (1) + +* Abhishek Kumar (2) + +* Arthur Lacote (2) + +* Eric Larson (7) +* Mouad Leachouri (1) + +* Tristan Leclercq (1) + +* Antony Lee (5) +* Jesse Livezey (8) +* Philip Loche (1) +* Yuxi Long (4) + +* Christian Lorentzen (1) +* Joshua Markovic (1) + +* Gabryel Mason-Williams (1) + +* mcdigman (1) + +* Rafael Menezes (1) + +* Stefano Miccoli (1) + +* Michał Górny (2) +* Jost Migenda (7) + +* Suriyaa MM (1) + +* Andrew Nelson (72) +* newyork\_loki (2) + +* Nick ODell (34) +* Dimitri Papadopoulos Orfanos (2) +* Drew Parsons (1) +* Gilles Peiffer (3) + +* Matti Picus (1) +* Jonas Pleyer (2) + +* Ilhan Polat (119) +* Akshay Priyadarshi (2) + +* Mohammed Abdul Rahman (1) + +* Daniele Raimondi (2) + +* Ritesh Rana (1) + +* Adrian Raso (1) + +* Dan Raviv (1) + +* Tyler Reddy (136) +* Lucas Roberts (4) +* Bernard Roesler (1) + +* Mikhail Ryazanov (27) +* Daniel Schmitz (25) +* Martin Schuck (25) +* Dan Schult (33) +* Mugunthan Selvanayagam (1) + +* Scott Shambaugh (14) +* Rodrigo Silva (1) + +* Samaresh Kumar Singh (8) + +* Kartik Sirohi (1) + +* Albert Steppi (179) +* Matthias Straka (1) + +* Theo Teske (1) + +* Noam Teyssier (1) + +* tommie979 (1) + +* Christian Veenhuis (1) +* Pierre Veron (1) + +* Shuhei Watanabe (1) + +* Warren Weckesser (25) +* WhimsyHippo (7) + +* Rory Yorke (2) +* Will Zhang (1) + +* Eric Zitong Zhou (1) +* Tingwei Zhu (1) + +* Zhenyu Zhu (1) + +* ਗਗਨਦੀਪ ਸਿੰਘ (Gagandeep Singh) (38) + + > A total of 117 people contributed to this release. + > People with a “+” by their names contributed a patch for the first time. + > This list of names is automatically generated, and may not be fully complete. + +## [Issues closed for 1.17.0](#id20)[#](#issues-closed-for-1-17-0 "Link to this heading") + +* [#1508](https://github.com/scipy/scipy/issues/1508): Riccati-Bessel functions are misspelled in the docs (Trac #981) +* [#3890](https://github.com/scipy/scipy/issues/3890): ENH: stats.logser: implement `cdf`/`sf` +* [#4487](https://github.com/scipy/scipy/issues/4487): “\_solout” in “dopri5” class of “scipy.integrate” reverses the… +* [#5503](https://github.com/scipy/scipy/issues/5503): ENH: special.betainc: improve errors for extreme numbers of trials +* [#7931](https://github.com/scipy/scipy/issues/7931): scipy.special.tests.test\_basic::TestCephes::test\_fdtri fails… +* [#9023](https://github.com/scipy/scipy/issues/9023): Opportunity to add a seed or a random\_state parameter to scipy.sparse.linalg.eig… +* [#9185](https://github.com/scipy/scipy/issues/9185): BUG: sparse.linalg: ARPACK error 1 +* [#9460](https://github.com/scipy/scipy/issues/9460): BUG: sparse.linalg.eigs: sorting behavior reliability +* [#10744](https://github.com/scipy/scipy/issues/10744): BUG: sparse.linalg: Test failures with BLIS BLAS +* [#11805](https://github.com/scipy/scipy/issues/11805): Fatal Python error: Segmentation fault - test\_arpack.py::test\_symmetric\_modes +* [#12513](https://github.com/scipy/scipy/issues/12513): BUG: optimize: Halting problem in trust-exact subproblem +* [#13222](https://github.com/scipy/scipy/issues/13222): porting scipy’s Fortran code to NAG’s nagfor compiler +* [#13671](https://github.com/scipy/scipy/issues/13671): QUERY: signal.coherence: discrepancy with Matlab +* [#13692](https://github.com/scipy/scipy/issues/13692): scipy.sparse.linalg.eigsh hangs for complex matrices on macOS +* [#13780](https://github.com/scipy/scipy/issues/13780): reprodcibility of scipy.sparse.linalg.svds +* [#14498](https://github.com/scipy/scipy/issues/14498): overwrite\_data=True kwarg ignored when type=”constant” in scipy.signal.detrend +* [#14823](https://github.com/scipy/scipy/issues/14823): BUG: vectors/matrices produced by eigenvalues/vectors routines… +* [#15940](https://github.com/scipy/scipy/issues/15940): odeint (lsoda) emits too many warnings that are not filterable. +* [#16232](https://github.com/scipy/scipy/issues/16232): BUG: Memory leak due to new reference passed to non-stealing… +* [#18191](https://github.com/scipy/scipy/issues/18191): BUG: Iteration count in scipy.sparse.linalg.\_eigen.arpack greater… +* [#18736](https://github.com/scipy/scipy/issues/18736): TST: `test_hermitian_modes` test failure +* [#18919](https://github.com/scipy/scipy/issues/18919): BUG: Bad result (broadcasting ?) for binom.ppf and q=1, when… +* [#19291](https://github.com/scipy/scipy/issues/19291): BUG: firwin(pass\_zero=False) does not block DC +* [#19756](https://github.com/scipy/scipy/issues/19756): BUG: sparse.linalg.eigsh: output eigenvector non-deterministic… +* [#19826](https://github.com/scipy/scipy/issues/19826): MAINT: follow-ups to gh-19724 (pytest pins, temporary CI changes,… +* [#19930](https://github.com/scipy/scipy/issues/19930): BUG: multivariate t broken for `df=inf` +* [#20050](https://github.com/scipy/scipy/issues/20050): ENH: interpolate: NdBSpline partial derivatives +* [#20339](https://github.com/scipy/scipy/issues/20339): BUG: Segfault in complex sparse eigen solver +* [#20835](https://github.com/scipy/scipy/issues/20835): BUG: special.fdtri: inaccurate results for extreme arguments… +* [#21039](https://github.com/scipy/scipy/issues/21039): ENH: Implement all relevant methods for `sparse.dia_array` +* [#21137](https://github.com/scipy/scipy/issues/21137): BUG: sparse.linalg.svds: `ARPACK error -9: Starting vector is`… +* [#21156](https://github.com/scipy/scipy/issues/21156): DOC: `integrate`: tutorial `help` command output is out… +* [#21541](https://github.com/scipy/scipy/issues/21541): ENH: spatial: `Rotation.__mul__`: handle non-`Rotation`… +* [#21563](https://github.com/scipy/scipy/issues/21563): ENH: stats.percentileofscore: 2D array input should be fixed… +* [#21716](https://github.com/scipy/scipy/issues/21716): DOC: conda-forge `compilers` package now also usable on windows +* [#21936](https://github.com/scipy/scipy/issues/21936): BUG: `*ger*` routines in `linalg.blas` are not thread-safe +* [#22053](https://github.com/scipy/scipy/issues/22053): MAINT: Cython lint failures in build output +* [#22310](https://github.com/scipy/scipy/issues/22310): BUG: scipy.sparse.linalg.eigsh returns an error when LinearOperator.dtype=None +* [#22365](https://github.com/scipy/scipy/issues/22365): BUG: ndimage: C++ memory management issues in `_rank_filter_1d.cpp` +* [#22412](https://github.com/scipy/scipy/issues/22412): RFC/API: move `clarkson_woodruff_transform` from `linalg`… +* [#22436](https://github.com/scipy/scipy/issues/22436): BUG: special.itj0y0: regression for `t > 19` +* [#22500](https://github.com/scipy/scipy/issues/22500): ENH: spatial.transform: Add array API standard support +* [#22510](https://github.com/scipy/scipy/issues/22510): performance: \_construct\_docstrings slow in scipy.stats +* [#22682](https://github.com/scipy/scipy/issues/22682): BUG: special.betainc: inaccurate/incorrect for small a and b… +* [#22794](https://github.com/scipy/scipy/issues/22794): ENH: add `weights` param to `stats.quantile` similarly to… +* [#22871](https://github.com/scipy/scipy/issues/22871): BUG: stats.sigmaclip: returns strange thresholds +* [#22880](https://github.com/scipy/scipy/issues/22880): BUG: interpolate: Akima1DInterpolator raises ValueError for valid… +* [#22887](https://github.com/scipy/scipy/issues/22887): DEV: follow-up tasks after merge of `spin` support +* [#22974](https://github.com/scipy/scipy/issues/22974): ENH: sparse.linalg: Krylov methods for matrix functions +* [#22979](https://github.com/scipy/scipy/issues/22979): DOC: optimize.nnls: squared 2-norm instead of 2-norm? +* [#22980](https://github.com/scipy/scipy/issues/22980): DEV: `spin test -b all` adds `--pyargs scipy` twice +* [#23021](https://github.com/scipy/scipy/issues/23021): DEV: can we ‘scrape’ package-wide `make_xp_test_case` info? +* [#23053](https://github.com/scipy/scipy/issues/23053): DEV: `spin smoke-docs` adds an option twice +* [#23080](https://github.com/scipy/scipy/issues/23080): BUG: optimize: too many open files with multiprocessing +* [#23101](https://github.com/scipy/scipy/issues/23101): BUG: special: Discontinuity in associated Legendre functions +* [#23111](https://github.com/scipy/scipy/issues/23111): BUG: stats.pmean: wrong value for infinite orders +* [#23116](https://github.com/scipy/scipy/issues/23116): BUG: `UserWarning` due to `spin build` +* [#23124](https://github.com/scipy/scipy/issues/23124): CI: (re-)adopt `(d)tach` for modularity enforcement +* [#23136](https://github.com/scipy/scipy/issues/23136): DEV/DOC: update vendored code pages for `_lib.decorator` +* [#23160](https://github.com/scipy/scipy/issues/23160): DOC: signal.medfilt: remove outdated note +* [#23166](https://github.com/scipy/scipy/issues/23166): BENCH/DEV: `spin bench` option `--quick` is useless (always… +* [#23171](https://github.com/scipy/scipy/issues/23171): BUG: `interpolate.RegularGridInterpolator` fails on a 2D grid… +* [#23195](https://github.com/scipy/scipy/issues/23195): BUG: New backend for interpolative decomposition breaks for (1xn)… +* [#23204](https://github.com/scipy/scipy/issues/23204): BUG/TST: stats: XSLOW test failures of `ttest_ind` +* [#23208](https://github.com/scipy/scipy/issues/23208): DOC: Missing docstrings for some warnings in scipy.io +* [#23231](https://github.com/scipy/scipy/issues/23231): DOC: Fix bug in release notes for scipy v1.12.0 +* [#23237](https://github.com/scipy/scipy/issues/23237): DOC: Breadcrumbs missing and sidebar different in API reference… +* [#23248](https://github.com/scipy/scipy/issues/23248): BUG/TST: `differentiate` `test_dtype` fails with `float16`… +* [#23272](https://github.com/scipy/scipy/issues/23272): BUG: linalg.interpolative.reconstruct\_matrix\_from\_id: segfault… +* [#23297](https://github.com/scipy/scipy/issues/23297): BUG [nightly]: spatial.transform.Rotation.from\_quat: fails for… +* [#23301](https://github.com/scipy/scipy/issues/23301): BUG: free-threading: functionality based on multiprocessing.Pool… +* [#23303](https://github.com/scipy/scipy/issues/23303): BUG: spatial.transform.Rotation: Warning Inconsistency +* [#23330](https://github.com/scipy/scipy/issues/23330): BUG: special.kv: incorrect translation of AMOS Fortran code resulting… +* [#23334](https://github.com/scipy/scipy/issues/23334): DEV: `spin lint`: use `sys.executable` always +* [#23344](https://github.com/scipy/scipy/issues/23344): CircleCI benchmarks job requires `hypothesis` +* [#23345](https://github.com/scipy/scipy/issues/23345): DOC: Incorrect dimension of PPoly.c in docstring +* [#23352](https://github.com/scipy/scipy/issues/23352): DOC: spatial.is\_valid\_dm: misleading documentation +* [#23355](https://github.com/scipy/scipy/issues/23355): Chatterjee’s Xi returns different results based on `numpy`… +* [#23358](https://github.com/scipy/scipy/issues/23358): BUG: stats: ppf of 0 returns a value outside the distribution… +* [#23369](https://github.com/scipy/scipy/issues/23369): DOC: interpolate: NearestNDInterpolator works with multi-dimensional… +* [#23371](https://github.com/scipy/scipy/issues/23371): BUG: (interpolate) \_dierckx.data\_matrix gives ValueError if input… +* [#23382](https://github.com/scipy/scipy/issues/23382): BUG: setting with `sparse.xxx_{matrix,array}` 2D singleton +* [#23383](https://github.com/scipy/scipy/issues/23383): DOC/DEV: correct editable install `spin` guidance +* [#23390](https://github.com/scipy/scipy/issues/23390): BUG: stats.sampling: segfault in various classes on osx-arm64 +* [#23391](https://github.com/scipy/scipy/issues/23391): ENH: spatial.transform: array API standard support tracker +* [#23400](https://github.com/scipy/scipy/issues/23400): ENH: spatial.geometric\_slerp: allow for extrapolation +* [#23409](https://github.com/scipy/scipy/issues/23409): BUG: stats.qmc.Sobol: stuck in infinite loop in low\_0\_bit after… +* [#23412](https://github.com/scipy/scipy/issues/23412): TST: stats: `marray` tests failing with latest array-api-strict +* [#23418](https://github.com/scipy/scipy/issues/23418): BUG: scipy.signal.square ignores input dtype due to incorrect… +* [#23423](https://github.com/scipy/scipy/issues/23423): CI: new BLAS tests ci jobs don’t respect ci skips +* [#23431](https://github.com/scipy/scipy/issues/23431): DOC: interpolate.RbfInterpolator: incorrect equation in Notes +* [#23449](https://github.com/scipy/scipy/issues/23449): DOC/ENH: signal.get\_window: different default for symmetric/periodic… +* [#23462](https://github.com/scipy/scipy/issues/23462): BUG: sparse: load\_npz fails for coo\_arry with dim>2 +* [#23477](https://github.com/scipy/scipy/issues/23477): DOC: The file `scipy/_lib/_lazy_testing.py` has been removed +* [#23510](https://github.com/scipy/scipy/issues/23510): BUG: NdBSpline segfaults for too high derivative orders +* [#23514](https://github.com/scipy/scipy/issues/23514): DOC: add LFX Insights badge to README +* [#23517](https://github.com/scipy/scipy/issues/23517): SHGO: issue passing args to objective function +* [#23542](https://github.com/scipy/scipy/issues/23542): BUG: interpolate: Internal error from `fpknot` while running… +* [#23551](https://github.com/scipy/scipy/issues/23551): BUG: stats.levene: test results are incorrect when `center="trimmed"` +* [#23553](https://github.com/scipy/scipy/issues/23553): BUG: scipy.sparse.csgraph.yen crashes with out-of-bounds source… +* [#23555](https://github.com/scipy/scipy/issues/23555): BUG: lfilter with empty a array can trigger misleading error… +* [#23556](https://github.com/scipy/scipy/issues/23556): BUG: deconvolve with empty divisor or signal arrays causes inconsistent… +* [#23559](https://github.com/scipy/scipy/issues/23559): DOC: stats: A reference in the `fligner` docstring occurs twice. +* [#23581](https://github.com/scipy/scipy/issues/23581): BUG: `xp_capabilities` adds empty lines to docstrings +* [#23596](https://github.com/scipy/scipy/issues/23596): DOC: wrong version for stats.f\_oneway’s equal\_var parameter +* [#23603](https://github.com/scipy/scipy/issues/23603): TST: adapt to NumPy warning change (mean of empty slice) +* [#23608](https://github.com/scipy/scipy/issues/23608): DOC: Being clear about the distribution of `scipy.spatial.transform.Rotation.ra`… +* [#23640](https://github.com/scipy/scipy/issues/23640): BUG: optimize: incorrect termination criteria in minpack LMSTR? +* [#23644](https://github.com/scipy/scipy/issues/23644): BUG: sparse: `csc_array.setdiag()` makes indices unsorted without… +* [#23670](https://github.com/scipy/scipy/issues/23670): BUG: `xp_promote` and `xp_result_type` are slow for big tensors… +* [#23678](https://github.com/scipy/scipy/issues/23678): BUG: stats: custom distribution generated from `zipfian` has… +* [#23686](https://github.com/scipy/scipy/issues/23686): BUG: Hang in scipy 1.16.2 on macOS x86\_64 in scipy.sparse.linalg.eigsh… +* [#23689](https://github.com/scipy/scipy/issues/23689): CI: optimize: “UserWarning: ‘where’ used without ‘out’” error… +* [#23703](https://github.com/scipy/scipy/issues/23703): DOC: special: second parameter in the `factorialk` docstring… +* [#23704](https://github.com/scipy/scipy/issues/23704): DOC: optimize: typo in LinearConstraint docs +* [#23708](https://github.com/scipy/scipy/issues/23708): TST: `FAILED scipy/stats/tests/test_continuous.py::TestDistributions::test_func`… +* [#23710](https://github.com/scipy/scipy/issues/23710): BUG: `signal/tests/test_short_time_fft.py::test_closest_STFT_dual_window_roundt`… +* [#23711](https://github.com/scipy/scipy/issues/23711): BUG: `stats/tests/test_axis_nan_policy.py::test_axis_nan_policy_axis_is_None` +* [#23715](https://github.com/scipy/scipy/issues/23715): BUG: integrate: benchmark integrate.CubatureOscillatory.time\_plain… +* [#23720](https://github.com/scipy/scipy/issues/23720): TST: test\_as\_euler\_symmetric\_axes tol with torch +* [#23742](https://github.com/scipy/scipy/issues/23742): QUERY: Fitting 4 parameters beta distribution leads to unexpected… +* [#23750](https://github.com/scipy/scipy/issues/23750): TST: signal: Add better isolation to alternative backend tests… +* [#23760](https://github.com/scipy/scipy/issues/23760): DOC/DX: `spin ipython --help` missing required use of `--`… +* [#23762](https://github.com/scipy/scipy/issues/23762): ENH: interpolate.RegularGridInterpolator: `eliminate_zeros()`… +* [#23763](https://github.com/scipy/scipy/issues/23763): BUG: scipy.odr.ODR Segmentation Fault with job=1 and Explicit… +* [#23778](https://github.com/scipy/scipy/issues/23778): ENH: Improve performance of converting csc arrays to csr arrays… +* [#23825](https://github.com/scipy/scipy/issues/23825): TST: Missing tests for `mathieu_even_coef`, `mathieu_odd_coef` +* [#23832](https://github.com/scipy/scipy/issues/23832): DOC: Broadcasting in `stats.quantile` +* [#23852](https://github.com/scipy/scipy/issues/23852): BUG/TST: stats: New XSLOW failures in stats +* [#23867](https://github.com/scipy/scipy/issues/23867): BUG: `special.comb(0, 0, repetition=False) == 0` , not 1 +* [#23879](https://github.com/scipy/scipy/issues/23879): DOC: RigidTransform.as\_components doc is incorrect +* [#23910](https://github.com/scipy/scipy/issues/23910): TST: stats: free-threaded failure in `test_non_finite_inputs_and_int_bins` +* [#23925](https://github.com/scipy/scipy/issues/23925): DOC: Invalid documentation of parameter “shape” of the “scipy.sparse…. +* [#23932](https://github.com/scipy/scipy/issues/23932): CI: mypy and clang jobs failing with “unused function” error… +* [#23989](https://github.com/scipy/scipy/issues/23989): CI: hang in windows job, OpenMP clash +* [#24043](https://github.com/scipy/scipy/issues/24043): DEV: switch from `dtach` to `tach` +* [#24046](https://github.com/scipy/scipy/issues/24046): TST: stats: TestStudentT.test\_moments\_t failure +* [#24052](https://github.com/scipy/scipy/issues/24052): CI: TypeError: Multiple namespaces for array inputs +* [#24089](https://github.com/scipy/scipy/issues/24089): ENH: spatial.transform: Add `normalize` argument to `Rotation.from_matrix` +* [#24131](https://github.com/scipy/scipy/issues/24131): BUG: `1.17.0rc1`: ModuleNotFoundError: No module named ‘scipy.integrate.\_lso… +* [#24152](https://github.com/scipy/scipy/issues/24152): DOC: 1.17 API changes not mentioned in the 1.17.0rc1 release… +* [#24212](https://github.com/scipy/scipy/issues/24212): BENCH, MAINT: (sparse) asv suite compat with NumPy 2.4.0 +* [#24251](https://github.com/scipy/scipy/issues/24251): CI: linalg: several test failures for ILP64 +* [#24256](https://github.com/scipy/scipy/issues/24256): DOC: 1.17 API changes not mentioned in the 1.17.0rc2 release… + +## [Pull requests for 1.17.0](#id21)[#](#pull-requests-for-1-17-0 "Link to this heading") + +* [#19668](https://github.com/scipy/scipy/pull/19668): ENH: optimize.minimize: add `subproblem_maxiter` option for… +* [#21683](https://github.com/scipy/scipy/pull/21683): ENH:MAINT:integrate: Rewrite DOP F77 code in C +* [#22041](https://github.com/scipy/scipy/pull/22041): BUG: Perform `Py_DECREF` on `obj` to avoid memory leak +* [#22506](https://github.com/scipy/scipy/pull/22506): ENH: special.btdtria: migrate to boost +* [#22539](https://github.com/scipy/scipy/pull/22539): ENH/MAINT: migrate `special.chndtr` and its inverses to boost +* [#22644](https://github.com/scipy/scipy/pull/22644): ENH: stats.quantile: methods to support trimming/Winsorizing +* [#22699](https://github.com/scipy/scipy/pull/22699): ENH: special: boostify F distribution functions +* [#22743](https://github.com/scipy/scipy/pull/22743): ENH: ILP64 BLAS/LAPACK support +* [#22748](https://github.com/scipy/scipy/pull/22748): ENH:MAINT: sparse.linalg: rewrite ARPACK in C +* [#22795](https://github.com/scipy/scipy/pull/22795): ENH: special: add more functions to `_support_alternative_backends` +* [#22827](https://github.com/scipy/scipy/pull/22827): ENH: stats: add `marray` support to a few remaining functions +* [#22856](https://github.com/scipy/scipy/pull/22856): MAINT: stats: ensure functions work on non-default device +* [#22857](https://github.com/scipy/scipy/pull/22857): ENH: stats: add array API support to much of `_axis_nan_policy`… +* [#22885](https://github.com/scipy/scipy/pull/22885): MAINT: eager\_warns: accept xp as keyword-only argument +* [#22889](https://github.com/scipy/scipy/pull/22889): MAINT: migrate `special.btdtrib` to boost +* [#22907](https://github.com/scipy/scipy/pull/22907): BENCH: stats.qmc.geometric\_discrepancy: add benchmarks +* [#22911](https://github.com/scipy/scipy/pull/22911): ENH: signal: Array API for filter design functions +* [#22914](https://github.com/scipy/scipy/pull/22914): ENH: signal: Add Array API compatibility to the `filter_design`… +* [#22924](https://github.com/scipy/scipy/pull/22924): ENH: linalg: low-level nD support, take 3 +* [#22925](https://github.com/scipy/scipy/pull/22925): ENH: stats: Add matrix variate t distribution +* [#22938](https://github.com/scipy/scipy/pull/22938): TST: `signal` add test coverage to the handling of new set… +* [#22962](https://github.com/scipy/scipy/pull/22962): MAINT: migrate `stdtr` and `stdtrit` to boost +* [#22972](https://github.com/scipy/scipy/pull/22972): ENH: spatial.transform.RigidTransform: refactor into pure Python… +* [#22983](https://github.com/scipy/scipy/pull/22983): ENH: sparse.linalg: a restarted Krylov method for evaluating… +* [#22989](https://github.com/scipy/scipy/pull/22989): ENH: `cluster`: vectorize `is_isomorphic` +* [#23006](https://github.com/scipy/scipy/pull/23006): REL: set version to 1.17.0.dev0 +* [#23009](https://github.com/scipy/scipy/pull/23009): ENH: sparse: efficient conversion from DIA to CSR format +* [#23012](https://github.com/scipy/scipy/pull/23012): BENCH: asv benchmarks for alternative array backends +* [#23015](https://github.com/scipy/scipy/pull/23015): DOC: scipy.signal.ShortTimeFFT.k\_max: Fix slice index +* [#23016](https://github.com/scipy/scipy/pull/23016): MAINT: bump minimum NumPy version +* [#23019](https://github.com/scipy/scipy/pull/23019): BUG: interpolate.Akima1DInterpolator: Identical Rearrangement… +* [#23020](https://github.com/scipy/scipy/pull/23020): ENH: interpolate.BSpline: add array API standard interface +* [#23023](https://github.com/scipy/scipy/pull/23023): DEP: stats: remove find\_repeats +* [#23026](https://github.com/scipy/scipy/pull/23026): DEV: Remove `--parallel` and rely on `spin`‘s `--jobs`… +* [#23028](https://github.com/scipy/scipy/pull/23028): MAINT: create `_lib._array_api_override` to solve circular… +* [#23034](https://github.com/scipy/scipy/pull/23034): DEP: linalg.interpolative: remove seed and rand +* [#23039](https://github.com/scipy/scipy/pull/23039): TYP: fix and improve the `linalg._decomp_lu_cython` stub +* [#23041](https://github.com/scipy/scipy/pull/23041): DOC/DEV: Updated developer docs for `spin` +* [#23043](https://github.com/scipy/scipy/pull/23043): DEP: linalg: remove kron +* [#23045](https://github.com/scipy/scipy/pull/23045): DEP: interpolate.interpnd: remove incidental imports from private… +* [#23050](https://github.com/scipy/scipy/pull/23050): DEV: add `spin notes` and `spin authors` commands +* [#23052](https://github.com/scipy/scipy/pull/23052): ENH: interpolate: array API for BSpline-based `make_` functions +* [#23057](https://github.com/scipy/scipy/pull/23057): ENH: Speed up `array_namespace` through caching +* [#23058](https://github.com/scipy/scipy/pull/23058): CI: clean up free-threading job, use released Cython/Pythran +* [#23059](https://github.com/scipy/scipy/pull/23059): MAINT: remove nan-handling from \_factorialx\_array\_exact +* [#23060](https://github.com/scipy/scipy/pull/23060): DOC: Revise a footnote in meson-distutils +* [#23062](https://github.com/scipy/scipy/pull/23062): DEV: help debug free-threading build of Fortran modules +* [#23063](https://github.com/scipy/scipy/pull/23063): DEV: ignore `pixi-dev-scipystack` dirs +* [#23065](https://github.com/scipy/scipy/pull/23065): ENH: stats.tukey\_hsd: improve array index iteration in `` TukeyHSDResult.__str__` ``… +* [#23071](https://github.com/scipy/scipy/pull/23071): ENH: linalg: low-level batching support in `solve` +* [#23073](https://github.com/scipy/scipy/pull/23073): TST: `linalg`: refactor `test_blas` +* [#23078](https://github.com/scipy/scipy/pull/23078): MAINT: smoke-docs: add a `--doctest-only-doctests` flag to… +* [#23081](https://github.com/scipy/scipy/pull/23081): DOC: Add tables summarizing array API backend capabilities across… +* [#23082](https://github.com/scipy/scipy/pull/23082): TST: linalg: thread-safe rng +* [#23083](https://github.com/scipy/scipy/pull/23083): TST: linalg: pytest-run-parallell out of memory +* [#23084](https://github.com/scipy/scipy/pull/23084): TST: linalg: race condition in BLAS `ger*` +* [#23085](https://github.com/scipy/scipy/pull/23085): TST: signal: fix flaky TestZpk2Sos +* [#23087](https://github.com/scipy/scipy/pull/23087): CI: move pre-release and free-threading jobs to CPython 3.14-dev +* [#23089](https://github.com/scipy/scipy/pull/23089): ENH/DEP: linalg: support batching for toeplitz and related functions +* [#23092](https://github.com/scipy/scipy/pull/23092): DEV: Address issues in `spin docs` command +* [#23093](https://github.com/scipy/scipy/pull/23093): DEV: remove duplicate `--doctest-collect=api` in `spin smoke-docs` +* [#23094](https://github.com/scipy/scipy/pull/23094): DOC: linalg: fix overview for `cdf2rdf` and `khatri_rao` +* [#23095](https://github.com/scipy/scipy/pull/23095): DEV: remove `python dev.py` in favor of `spin` +* [#23096](https://github.com/scipy/scipy/pull/23096): CI: move to `cibuildwheel` 3.0b4 and to `manylinux_2_28` +* [#23104](https://github.com/scipy/scipy/pull/23104): ENH: stats: Dask support for `variation` +* [#23105](https://github.com/scipy/scipy/pull/23105): ENH: stats: Dask and JAX support for `pearsonr` +* [#23108](https://github.com/scipy/scipy/pull/23108): MAINT: Remove optional arguments from `*_impl` functions in… +* [#23112](https://github.com/scipy/scipy/pull/23112): MAINT: remove duplicated test in `stats.tests.test_stats.py` +* [#23117](https://github.com/scipy/scipy/pull/23117): BUG: remove `cdef` exports in `linalg._decomp_interpolative` +* [#23118](https://github.com/scipy/scipy/pull/23118): TYP: generic `signal.ShortTimeFFT` type +* [#23121](https://github.com/scipy/scipy/pull/23121): BUG: sparse.linalg.LaplacianNd: periodic eigenvectors +* [#23123](https://github.com/scipy/scipy/pull/23123): TYP: Disable NumPy’s deprecated mypy plugin +* [#23125](https://github.com/scipy/scipy/pull/23125): MAINT: Update vendored `_lib.decorators` module to `v5.2.1` +* [#23129](https://github.com/scipy/scipy/pull/23129): DOC: special.roots\_jacobi: add example to docstring +* [#23130](https://github.com/scipy/scipy/pull/23130): DEV: spin: change shorthand of `--setup-args` to `-S` to… +* [#23138](https://github.com/scipy/scipy/pull/23138): MAINT: sparse: remove python 2 remnants from `_spbase` +* [#23140](https://github.com/scipy/scipy/pull/23140): TST: Fix missing exceptions +* [#23143](https://github.com/scipy/scipy/pull/23143): TST: Run pytest-run-parallel on `xp` tests +* [#23149](https://github.com/scipy/scipy/pull/23149): TST: ndimage.vectorized\_filter: add missing assertion to test +* [#23151](https://github.com/scipy/scipy/pull/23151): CI: use 4 cores on GitHub Actions +* [#23152](https://github.com/scipy/scipy/pull/23152): TST: io: reduce peak memory usage 9x +* [#23153](https://github.com/scipy/scipy/pull/23153): TST: optimize: cap pytest-run-parallel memory usage +* [#23173](https://github.com/scipy/scipy/pull/23173): ENH/DOC: signal.hilbert: Refactor to avoid extra scaling array… +* [#23175](https://github.com/scipy/scipy/pull/23175): MAINT: Bump array-api-compat; speed up `array-namespace` +* [#23176](https://github.com/scipy/scipy/pull/23176): BUG: `spin bench` ignores `--quick` parameter +* [#23181](https://github.com/scipy/scipy/pull/23181): DOC: spatial: Rigid Transformation docs cleanup +* [#23190](https://github.com/scipy/scipy/pull/23190): BUG/BENCH: remove unconditional `--quick` from `spin bench`… +* [#23193](https://github.com/scipy/scipy/pull/23193): ENH: spatial: optimize performance of `RigidTransform` +* [#23194](https://github.com/scipy/scipy/pull/23194): MAINT: Improve error type for RigidTransform.from\_rotation +* [#23198](https://github.com/scipy/scipy/pull/23198): ENH: spatial.transform.Rotation: refactor into pure Python class… +* [#23201](https://github.com/scipy/scipy/pull/23201): DOC : removes outdated notes from the `medfilt` function +* [#23202](https://github.com/scipy/scipy/pull/23202): DEP: spatial: raise error for complex input to cosine and correlation +* [#23205](https://github.com/scipy/scipy/pull/23205): TST: stats.ttest\_ind: remove test of deprecated/removed `permutations` +* [#23207](https://github.com/scipy/scipy/pull/23207): CI: always set Python in array API testing +* [#23210](https://github.com/scipy/scipy/pull/23210): DEP: spatial.distance: remove kulczynski1 and sokalmichener metrics +* [#23212](https://github.com/scipy/scipy/pull/23212): DEP: signal: remove support for object arrays and longdoubles… +* [#23213](https://github.com/scipy/scipy/pull/23213): MAINT: forward port 1.16.0 relnotes +* [#23218](https://github.com/scipy/scipy/pull/23218): ENH: sparse: Add COO indexing for 1d, 2d, and nD +* [#23223](https://github.com/scipy/scipy/pull/23223): MAINT: port `_test_fortran.f` to Python functions in `test_fortran.py` +* [#23224](https://github.com/scipy/scipy/pull/23224): MAINT: \_lib: remove old/unneeded code +* [#23232](https://github.com/scipy/scipy/pull/23232): DOC: Fix typo in 1.12.0-notes.rst +* [#23233](https://github.com/scipy/scipy/pull/23233): ENH: Implement support for `bc_type="periodic"` in `make_splrep`… +* [#23234](https://github.com/scipy/scipy/pull/23234): TYP: generic `interpolate` types +* [#23243](https://github.com/scipy/scipy/pull/23243): DEP: special: remove deprecated functions +* [#23244](https://github.com/scipy/scipy/pull/23244): TYP: generic `optimize` types +* [#23247](https://github.com/scipy/scipy/pull/23247): ENH/DOC: signal.hilbert2: Refactor to avoid extra scaling array… +* [#23249](https://github.com/scipy/scipy/pull/23249): ENH: spatial.transform.Rotation: add array API backend +* [#23253](https://github.com/scipy/scipy/pull/23253): BUG: interpolate.RegularGridInterpolator: fix linear interp…. +* [#23254](https://github.com/scipy/scipy/pull/23254): DOC: special: LaTeX cleanup +* [#23255](https://github.com/scipy/scipy/pull/23255): MAINT: `spatial._plotutils`: remove matplotlib 1 code +* [#23256](https://github.com/scipy/scipy/pull/23256): MAINT: remove `_lib._threadsafety` +* [#23257](https://github.com/scipy/scipy/pull/23257): DOC: add orphaned modules to toctree +* [#23258](https://github.com/scipy/scipy/pull/23258): MAINT: `sparse` testing without `decorator` +* [#23259](https://github.com/scipy/scipy/pull/23259): ENH: stats: `Logistic` distribution +* [#23260](https://github.com/scipy/scipy/pull/23260): MAINT: Remove `_lib.decorator` +* [#23262](https://github.com/scipy/scipy/pull/23262): TST: sparse.linalg: improve coverage for `funm_multiply_krylov` +* [#23264](https://github.com/scipy/scipy/pull/23264): TST: `test_axis_nan_policy`: skip on unexpected exceptions +* [#23265](https://github.com/scipy/scipy/pull/23265): TST: signal: add test for `zpk2tf` with multi-dimensional arrays +* [#23267](https://github.com/scipy/scipy/pull/23267): MAINT: sparse: move `_validate_indices` and `_asindices`… +* [#23271](https://github.com/scipy/scipy/pull/23271): DOC: interpolate.make\_interp\_spline: fix minor formatting typos… +* [#23273](https://github.com/scipy/scipy/pull/23273): DOC: interpolate.make\_splprep: fix dimensions ordering +* [#23274](https://github.com/scipy/scipy/pull/23274): MAINT:sparse.linalg: ARPACK to Arnaud rename and project structure… +* [#23275](https://github.com/scipy/scipy/pull/23275): TST: migrate away from suppress\_warnings and assert\_warns +* [#23286](https://github.com/scipy/scipy/pull/23286): TST: signal: clean-up tests post array api conversion +* [#23287](https://github.com/scipy/scipy/pull/23287): MAINT: differentiate: add `xp_capabilities` +* [#23288](https://github.com/scipy/scipy/pull/23288): MAINT: optimize: mark functions with `xp_capabilities` +* [#23289](https://github.com/scipy/scipy/pull/23289): DOC: Add link to Golub and Van Loan’s book “Matrix Computations” +* [#23290](https://github.com/scipy/scipy/pull/23290): TST: differentiate: use correct `xp_capabilities` for `jacobian` +* [#23291](https://github.com/scipy/scipy/pull/23291): BENCH: sparse: parameterize benchmark with sparse arrays and… +* [#23294](https://github.com/scipy/scipy/pull/23294): TST: better thread-unsafe markers and re-enable pytest-run-parallel… +* [#23298](https://github.com/scipy/scipy/pull/23298): BUG: spatial.transform.Rotation.from\_quat: fix dtype inference… +* [#23300](https://github.com/scipy/scipy/pull/23300): DOC: development\_workflow: fix SciPy’s commit guideline link +* [#23304](https://github.com/scipy/scipy/pull/23304): TST: optimize: Speed up `test__basinhopping` +* [#23305](https://github.com/scipy/scipy/pull/23305): TST: linalg: make `test_expm_multiply` friendly to pytest-run-parallel +* [#23306](https://github.com/scipy/scipy/pull/23306): TST: free-threading performance tweaks +* [#23307](https://github.com/scipy/scipy/pull/23307): TST: free-threading: More local RNGs +* [#23311](https://github.com/scipy/scipy/pull/23311): MAINT/TST: always use forkserver multiprocessing on POSIX +* [#23313](https://github.com/scipy/scipy/pull/23313): BLD: support build warnings for flang/clang-cl on Windows +* [#23317](https://github.com/scipy/scipy/pull/23317): BUG: sparse.linalg: fix arpack complex arrays on windows +* [#23319](https://github.com/scipy/scipy/pull/23319): TST: io.wavfile: add test for `SeekEmulatingReader.seek` +* [#23320](https://github.com/scipy/scipy/pull/23320): BUG:DOC: sparse.linalg: Fix more arnaud bugs and add C code documentation +* [#23324](https://github.com/scipy/scipy/pull/23324): BUG: stats: avoid building docstrings if python is run with `-OO` +* [#23325](https://github.com/scipy/scipy/pull/23325): DOC: interpolate/RBF: tweak the docstring example, tweak dimensions +* [#23326](https://github.com/scipy/scipy/pull/23326): DEV: remove non-generated file from `.gitignore` +* [#23327](https://github.com/scipy/scipy/pull/23327): DOC/BUG: Fix a few dynamically modified docstrings. +* [#23331](https://github.com/scipy/scipy/pull/23331): TST: Read `@xp_capabilities` from `pytestmark` +* [#23340](https://github.com/scipy/scipy/pull/23340): DEP/MAINT: sparse: change default dtype behavior of ‘diags\_array’… +* [#23341](https://github.com/scipy/scipy/pull/23341): BUG: signal: zpk2tf: support array-api-strict on multi-dim arrays +* [#23343](https://github.com/scipy/scipy/pull/23343): DOC: Fix trivial typos +* [#23346](https://github.com/scipy/scipy/pull/23346): DOC: correct dimensions of PPoly.c in docstring +* [#23349](https://github.com/scipy/scipy/pull/23349): BENCH, TST: benchmarks without hypothesis +* [#23350](https://github.com/scipy/scipy/pull/23350): BUG: linalg: fix `solve(..., assume_a='pos', lower=False)` +* [#23354](https://github.com/scipy/scipy/pull/23354): DEV: Use `sys.executable` everywhere in spin lint +* [#23357](https://github.com/scipy/scipy/pull/23357): ENH, MAINT: linalg: assume\_a=”diagonal” for solve and inv +* [#23359](https://github.com/scipy/scipy/pull/23359): DOC: Add example to `show_config()` +* [#23360](https://github.com/scipy/scipy/pull/23360): DOC: io: add docstrings to warnings and errors +* [#23362](https://github.com/scipy/scipy/pull/23362): MAINT: linalg.{inv, solve}: better error reporting for batched… +* [#23366](https://github.com/scipy/scipy/pull/23366): DOC: Clarify that is\_valid\_dm doesn’t check triangle inequality +* [#23368](https://github.com/scipy/scipy/pull/23368): TST: linalg: small tolerance bump for `test_orth_memory_efficiency` +* [#23370](https://github.com/scipy/scipy/pull/23370): ENH: spatial: add ability to suppress gimbal lock warnings for… +* [#23374](https://github.com/scipy/scipy/pull/23374): DOC: corrected the docstring of NearestNDInterpolator +* [#23375](https://github.com/scipy/scipy/pull/23375): ENH: Add `NdBSpline.derivative` method +* [#23381](https://github.com/scipy/scipy/pull/23381): MAINT: stats: Apply xp\_capabilities decorator to all public functions +* [#23388](https://github.com/scipy/scipy/pull/23388): DOC: fix array api support table +* [#23389](https://github.com/scipy/scipy/pull/23389): MAINT: cluster.hierarchy: mark set\_link\_color\_palette as out… +* [#23392](https://github.com/scipy/scipy/pull/23392): MAINT: datasets: mark functions as out of scope for array api… +* [#23393](https://github.com/scipy/scipy/pull/23393): DOC: remove manual array api support list +* [#23394](https://github.com/scipy/scipy/pull/23394): DOC: stats.rv\_continuous.ppf/isf: document convention +* [#23399](https://github.com/scipy/scipy/pull/23399): ENH: add Accelerate ILP64 support and CI job +* [#23401](https://github.com/scipy/scipy/pull/23401): DOC: forward port 1.16.1 relnotes +* [#23404](https://github.com/scipy/scipy/pull/23404): DOC: special: fix output shape of `*_all` functions +* [#23405](https://github.com/scipy/scipy/pull/23405): MAINT:BLD:\_lib: Remove deprecated Python TLS fallback code from… +* [#23406](https://github.com/scipy/scipy/pull/23406): DOC: stats.false\_discovery\_control: added note that input does… +* [#23410](https://github.com/scipy/scipy/pull/23410): MAINT: integrate: add xp\_capabilities to public functions +* [#23415](https://github.com/scipy/scipy/pull/23415): MAINT: ndimage: add `xp_capabilities` to functions in public… +* [#23416](https://github.com/scipy/scipy/pull/23416): DOC: Add complexity remark to scipy.stats.kendalltau +* [#23420](https://github.com/scipy/scipy/pull/23420): MAINT: break import dependencies between special-linalg and linalg-sparse +* [#23421](https://github.com/scipy/scipy/pull/23421): DX: don’t lint cython build output +* [#23422](https://github.com/scipy/scipy/pull/23422): DOC: special: add example to ellipeinc and correct docstring… +* [#23424](https://github.com/scipy/scipy/pull/23424): ENH: spatial: optimize performance of Rotation +* [#23425](https://github.com/scipy/scipy/pull/23425): ENH: spatial.transform.RigidTransform: add array API backend +* [#23426](https://github.com/scipy/scipy/pull/23426): ENH: spatial.geometric\_slerp: allow for extrapolation +* [#23427](https://github.com/scipy/scipy/pull/23427): DOC: stats.chatterjeexi: document how to handle ties in `x` +* [#23432](https://github.com/scipy/scipy/pull/23432): DOC: interpolate.RBFInterpolator: fix typo +* [#23434](https://github.com/scipy/scipy/pull/23434): CI: fix skip conditions in `linux_blas.yml` jobs +* [#23439](https://github.com/scipy/scipy/pull/23439): DOC: special: Add some simple examples for loggamma. +* [#23443](https://github.com/scipy/scipy/pull/23443): BUG: stats.qmc: Avoid infinite loop in sobol when requesting… +* [#23453](https://github.com/scipy/scipy/pull/23453): MAINT: Support ruff 0.12 +* [#23454](https://github.com/scipy/scipy/pull/23454): ENH, MAINT: simpler calculate\_areas() +* [#23456](https://github.com/scipy/scipy/pull/23456): DOC: Update link to Jupyter Project Governance +* [#23463](https://github.com/scipy/scipy/pull/23463): DOC: sparse.kronsum: add example +* [#23465](https://github.com/scipy/scipy/pull/23465): BUG: sparse: nD sparse save\_npz and load\_npz +* [#23466](https://github.com/scipy/scipy/pull/23466): DOC: Remove boilerplate text in a remark +* [#23467](https://github.com/scipy/scipy/pull/23467): ENH: spatial.transform.Rotation: support broadcasting +* [#23468](https://github.com/scipy/scipy/pull/23468): DOC: optimize.shgo: correct `minimize_every_iter` description +* [#23470](https://github.com/scipy/scipy/pull/23470): DOC: Update a link about numba support +* [#23473](https://github.com/scipy/scipy/pull/23473): DOC: special.hankel1: add example and remove old docstring copy +* [#23476](https://github.com/scipy/scipy/pull/23476): DEP: signal.lombscargle: deprecate argument `precenter` +* [#23479](https://github.com/scipy/scipy/pull/23479): DOC: Update outdated `lazy_xp_function` references +* [#23483](https://github.com/scipy/scipy/pull/23483): ENH: signal.abcd\_normalize: Refactor, improve docstr, and make… +* [#23486](https://github.com/scipy/scipy/pull/23486): DOC: special: remove duplicated docstrings +* [#23489](https://github.com/scipy/scipy/pull/23489): DOC: clarify nnls minimizes squared 2-norm (closes #22979) +* [#23491](https://github.com/scipy/scipy/pull/23491): DOC: signal.detrend: clarify `overwrite_data` behaviour +* [#23492](https://github.com/scipy/scipy/pull/23492): DOC: remove `help(integrate)` output +* [#23494](https://github.com/scipy/scipy/pull/23494): ENH: integrate.quad: shortcut if upper/lower bounds are equal +* [#23496](https://github.com/scipy/scipy/pull/23496): DOC: special: added refs to Digital Library of Math. Functions +* [#23497](https://github.com/scipy/scipy/pull/23497): ENH: integrate.romb: array-API support +* [#23498](https://github.com/scipy/scipy/pull/23498): TST: additional tests if `integrate.quad` upper/lower bounds… +* [#23499](https://github.com/scipy/scipy/pull/23499): ENH: update boost to 1.89 +* [#23501](https://github.com/scipy/scipy/pull/23501): ENH: integrate.cumulative\_trapezoid: add array API support +* [#23502](https://github.com/scipy/scipy/pull/23502): DOC: add header to array api support in docstring +* [#23504](https://github.com/scipy/scipy/pull/23504): BUG: stats: trapezoid.fit does not converge +* [#23507](https://github.com/scipy/scipy/pull/23507): ENH: add array api support for `linalg.orthogonal_procrustes`… +* [#23511](https://github.com/scipy/scipy/pull/23511): DOC: interpolate: Ndbspline derivative methods list +* [#23512](https://github.com/scipy/scipy/pull/23512): MAINT: remove unused cdflib code +* [#23513](https://github.com/scipy/scipy/pull/23513): ENH: integrate.cumulative\_simpson: add array api support +* [#23518](https://github.com/scipy/scipy/pull/23518): ENH/BUG: signal.get\_window: Refactor and allow ‘\_periodic’ and… +* [#23520](https://github.com/scipy/scipy/pull/23520): BUG: shgo mutating user supplied dictionaries +* [#23521](https://github.com/scipy/scipy/pull/23521): BUG: shgo should accept args for fun/jac/hess +* [#23523](https://github.com/scipy/scipy/pull/23523): MAINT: Use reshape instead of setting the shape attribute for… +* [#23524](https://github.com/scipy/scipy/pull/23524): MAINT: Use reshape instead of setting the shape attribute for… +* [#23526](https://github.com/scipy/scipy/pull/23526): MAINT: Use reshape instead of setting the shape attribute for… +* [#23528](https://github.com/scipy/scipy/pull/23528): CI: swap to windows-2025 [wheel build] +* [#23531](https://github.com/scipy/scipy/pull/23531): ENH:MAINT: sparse.linalg: Rewrite PROPACK in C +* [#23534](https://github.com/scipy/scipy/pull/23534): ENH: sparse: add funcs `swapaxes`, `permute_dims`, `expand_dims`… +* [#23535](https://github.com/scipy/scipy/pull/23535): BUG: special: Fix switched overflow and underflow error messages. +* [#23536](https://github.com/scipy/scipy/pull/23536): DOC: Convert math symbols into Latex for format consistency +* [#23537](https://github.com/scipy/scipy/pull/23537): ENH: Add two private ufuncs related to generalized harmonic numbers. +* [#23538](https://github.com/scipy/scipy/pull/23538): MAINT: differential\_evolution, polish takes a callable +* [#23547](https://github.com/scipy/scipy/pull/23547): `linalg.solve`: move “sym”/”her” solvers to C +* [#23557](https://github.com/scipy/scipy/pull/23557): BUG: fix levene and fligner test incorrect results with trimmed… +* [#23558](https://github.com/scipy/scipy/pull/23558): DOC: `special.modfresnelm` docstring equation fix +* [#23562](https://github.com/scipy/scipy/pull/23562): DOC: Fix duplicate and dead link in fligner docstring +* [#23565](https://github.com/scipy/scipy/pull/23565): DOC/DEV: update editable install guidance for `spin install` +* [#23566](https://github.com/scipy/scipy/pull/23566): MAINT: Use np.view instead of setting dtype +* [#23569](https://github.com/scipy/scipy/pull/23569): ENH: interpolate.FloaterHormannInterpolator: add axis parameter +* [#23572](https://github.com/scipy/scipy/pull/23572): DOC: Fix a few typos in API Reference +* [#23573](https://github.com/scipy/scipy/pull/23573): MAINT: slsqp callback accepts intermediate\_result +* [#23574](https://github.com/scipy/scipy/pull/23574): ENH: linalg.fiedler: add native batch support and array api support +* [#23575](https://github.com/scipy/scipy/pull/23575): MAINT: use boost master branch +* [#23579](https://github.com/scipy/scipy/pull/23579): ENH: interpolate.AAA: add diagonal scaling to improve conditioning +* [#23584](https://github.com/scipy/scipy/pull/23584): ENH: migrate `special.chdtriv` to boost +* [#23585](https://github.com/scipy/scipy/pull/23585): MAINT: remove empty lines added to docstring by various decorators +* [#23586](https://github.com/scipy/scipy/pull/23586): MAINT: bump array-api-extra to v0.9.0 +* [#23588](https://github.com/scipy/scipy/pull/23588): MAINT: Test spatial.transform.Rotation.\_\_iter\_\_ with jit +* [#23590](https://github.com/scipy/scipy/pull/23590): ENH: linalg.block\_diag: add array api support +* [#23591](https://github.com/scipy/scipy/pull/23591): DOC: Remove typo +* [#23592](https://github.com/scipy/scipy/pull/23592): MAINT: special: Replace disrecommended assert functions with… +* [#23598](https://github.com/scipy/scipy/pull/23598): DOC: Fix format issues in API Reference +* [#23599](https://github.com/scipy/scipy/pull/23599): DOC: stats.f\_oneway: change versionadded to 1.16.0 +* [#23600](https://github.com/scipy/scipy/pull/23600): MAINT: fix more memory management and error handling issues in… +* [#23601](https://github.com/scipy/scipy/pull/23601): DOC: forward port 1.16.2 relnotes +* [#23606](https://github.com/scipy/scipy/pull/23606): MAINT: signal: simplify `cheb2ap` formulas +* [#23607](https://github.com/scipy/scipy/pull/23607): BUG: signal.lfilter: More meaningful error messages for invalid… +* [#23609](https://github.com/scipy/scipy/pull/23609): BUG: signal.deconvolve: More meaningful error messages for invalid… +* [#23610](https://github.com/scipy/scipy/pull/23610): TYP: more generic `integrate` types +* [#23614](https://github.com/scipy/scipy/pull/23614): TST: shim for NumPy warning changes +* [#23616](https://github.com/scipy/scipy/pull/23616): BUG: ndimage: fix handling of memory allocation failures. +* [#23618](https://github.com/scipy/scipy/pull/23618): BUG: sparse.csgraph.yen: Validate source and sink to avoid seg…. +* [#23620](https://github.com/scipy/scipy/pull/23620): MAINT: io: Improve `spmatrix` arg handling and description… +* [#23621](https://github.com/scipy/scipy/pull/23621): DOC/BUG: signal.firwin: Improve documentation +* [#23623](https://github.com/scipy/scipy/pull/23623): DOC: stats.levy\_stable: improvements +* [#23625](https://github.com/scipy/scipy/pull/23625): ENH: sparse: Add DOK update method and tests +* [#23626](https://github.com/scipy/scipy/pull/23626): BUG:sparse: allow setting a singleton via a sparse container +* [#23627](https://github.com/scipy/scipy/pull/23627): DOC: spatial: Rotation.random: mention distribution in docstring +* [#23629](https://github.com/scipy/scipy/pull/23629): CI: use asv<0.6.5 to avoid problem with that release - fixes… +* [#23630](https://github.com/scipy/scipy/pull/23630): DEV: drop `shallow` from submodules +* [#23632](https://github.com/scipy/scipy/pull/23632): MAINT: spatial.transform.Rotation: `from_euler/from_davenport`… +* [#23633](https://github.com/scipy/scipy/pull/23633): MAINT/TST: stats: loosen a test tolerance. +* [#23636](https://github.com/scipy/scipy/pull/23636): TST: stats: test against `marray` backend again +* [#23638](https://github.com/scipy/scipy/pull/23638): CI: adapt `gpu-ci.yml` to new Pixi workspace +* [#23645](https://github.com/scipy/scipy/pull/23645): MAINT:optimize: Fix missing pointer dereference in MINPACK +* [#23646](https://github.com/scipy/scipy/pull/23646): CI: fix issue with `spin` broken due to new `click` release +* [#23647](https://github.com/scipy/scipy/pull/23647): CI: fix issue with spin broken due to new click release (follow-up) +* [#23649](https://github.com/scipy/scipy/pull/23649): CI: use Pixi for `array_api.yml` and `lint.yml` +* [#23650](https://github.com/scipy/scipy/pull/23650): DOC: Update a reference link in scipy.optimize.root +* [#23653](https://github.com/scipy/scipy/pull/23653): MAINT: Fix `spatial.transform.RigidTransform` xp backend comments +* [#23654](https://github.com/scipy/scipy/pull/23654): CI: use Pixi for `macos.yml` +* [#23655](https://github.com/scipy/scipy/pull/23655): ENH: stats.truncpareto: allow negative exponent +* [#23658](https://github.com/scipy/scipy/pull/23658): CI: Pixi: use `no-pin` strategy and refactor environments +* [#23659](https://github.com/scipy/scipy/pull/23659): MAINT: signal: deduplicate `_swapaxes` helpers +* [#23661](https://github.com/scipy/scipy/pull/23661): DOC: Improve formatting in continuous distributions description +* [#23662](https://github.com/scipy/scipy/pull/23662): ENH: signal: Convert Savitzky-Golay filter to Array API +* [#23666](https://github.com/scipy/scipy/pull/23666): DOC/DEV: Document `scipy.signal`‘s Array API caveats. +* [#23667](https://github.com/scipy/scipy/pull/23667): ENH: integrate.qmc\_quad: add array API support +* [#23668](https://github.com/scipy/scipy/pull/23668): MAINT: signal: tighten the workaround for object arrays +* [#23669](https://github.com/scipy/scipy/pull/23669): DOC: linalg: document batch support +* [#23671](https://github.com/scipy/scipy/pull/23671): DOC: Update stable version switcher button styles in CSS +* [#23674](https://github.com/scipy/scipy/pull/23674): MAINT: fix whitespace test +* [#23675](https://github.com/scipy/scipy/pull/23675): ENH: spatial.transform.RigidTransform: support broadcasting +* [#23676](https://github.com/scipy/scipy/pull/23676): BUG: Fixes #23644: sparse: csc\_array.setdiag() makes indices… +* [#23677](https://github.com/scipy/scipy/pull/23677): ENH: sparse: Add nD kron sparse construction +* [#23679](https://github.com/scipy/scipy/pull/23679): MAINT/STY: `spatial._kdtree`: Fix type of default value of… +* [#23680](https://github.com/scipy/scipy/pull/23680): MAINT: linalg.hankel: warn against changing behavior for multidimensional… +* [#23683](https://github.com/scipy/scipy/pull/23683): MAINT: sparse: avoid recent free-threading `test_matrix_io.py`… +* [#23688](https://github.com/scipy/scipy/pull/23688): MAINT: Remove ‘o’ (Greek omicron) from allowed symbols. +* [#23690](https://github.com/scipy/scipy/pull/23690): DOC: spatial.transform.Rotation: update docs +* [#23692](https://github.com/scipy/scipy/pull/23692): MAINT: stats.pmean: enforce finite `p` requirement +* [#23693](https://github.com/scipy/scipy/pull/23693): ENH: stats.mode: add array API support +* [#23694](https://github.com/scipy/scipy/pull/23694): DOC: Correct minor formatting issues in `scipy.sparse.linalg` +* [#23695](https://github.com/scipy/scipy/pull/23695): DOC: spatial.transform.RigidTransform: update docs +* [#23696](https://github.com/scipy/scipy/pull/23696): TST: special: avoid extremely slow edge cases in `mpmath` tests +* [#23697](https://github.com/scipy/scipy/pull/23697): DEV: improve `spin build --help` w.r.t. debug builds +* [#23699](https://github.com/scipy/scipy/pull/23699): DOC: stats.sigmaclip: results may not satisfy an intuitive property +* [#23702](https://github.com/scipy/scipy/pull/23702): ENH: stats.lmoment: add array API support +* [#23705](https://github.com/scipy/scipy/pull/23705): MAINT: stats.rv\_discrete.ppf/isf: fix behavior with array args,… +* [#23706](https://github.com/scipy/scipy/pull/23706): MAINT: stats.multivariate\_t.logpdf/pdf: fix infinite DOF special… +* [#23709](https://github.com/scipy/scipy/pull/23709): ENH: stats.alexandergovern: add array API support +* [#23713](https://github.com/scipy/scipy/pull/23713): TST: macos-15-intel +* [#23714](https://github.com/scipy/scipy/pull/23714): DOC: correct typo in `factorialk` parameters doc +* [#23716](https://github.com/scipy/scipy/pull/23716): TST: stats.Binomial.logcdf: improves precision in tails +* [#23717](https://github.com/scipy/scipy/pull/23717): ENH: Migrate special.pdtrik to boost +* [#23718](https://github.com/scipy/scipy/pull/23718): ENH: spatial: Implement `RigidTransform.mean()` +* [#23719](https://github.com/scipy/scipy/pull/23719): DOC: minor typo +* [#23721](https://github.com/scipy/scipy/pull/23721): TST: test\_as\_euler\_symmetric\_axes tol bump +* [#23724](https://github.com/scipy/scipy/pull/23724): DOC: Fixing scipy.linalg.polar `u` docstring. +* [#23726](https://github.com/scipy/scipy/pull/23726): Fix typo (coefficent -> coefficient) +* [#23727](https://github.com/scipy/scipy/pull/23727): MAINT: Consistent `spatial.[c]KDTree` method parameter defaults… +* [#23729](https://github.com/scipy/scipy/pull/23729): BUG: spatial: Fix shape of Rotation mean when ndim > 1 +* [#23733](https://github.com/scipy/scipy/pull/23733): ENH: stats.logser: implement sf +* [#23735](https://github.com/scipy/scipy/pull/23735): CI: silence pyparsing 3.3.0a1 deprecation warnings +* [#23739](https://github.com/scipy/scipy/pull/23739): MAINT: stats: remove use of `np.random.seed` +* [#23740](https://github.com/scipy/scipy/pull/23740): Fix typo in documentation where Riccati is misspelled as Ricatti +* [#23741](https://github.com/scipy/scipy/pull/23741): DOC: signal.hilbert : example uses instantaneous frequency +* [#23743](https://github.com/scipy/scipy/pull/23743): Cygwin interpolate test xfail +* [#23744](https://github.com/scipy/scipy/pull/23744): ENH: stats.bootstrap: array API support +* [#23745](https://github.com/scipy/scipy/pull/23745): DOC: stats.beta: document issues with 3- and 4- parameter MLE +* [#23746](https://github.com/scipy/scipy/pull/23746): ENH: add Array API support to RBFInterpolator +* [#23752](https://github.com/scipy/scipy/pull/23752): DOC: Move a paragraph from code to markdown in ndimage tutorial +* [#23753](https://github.com/scipy/scipy/pull/23753): MAINT: interpolate: use xp-capabilities for `make\_` functions +* [#23755](https://github.com/scipy/scipy/pull/23755): BUG: interpolate: fail gracefully if all weights are zero +* [#23758](https://github.com/scipy/scipy/pull/23758): ENH: implement `gdtrix` and `gdtria` using xsf’s incomplete… +* [#23759](https://github.com/scipy/scipy/pull/23759): ENH: interpolate: make NdBSpline and RGI Array API compatible +* [#23764](https://github.com/scipy/scipy/pull/23764): DOC: special: consistent modified Bessel order and fix Hankel… +* [#23765](https://github.com/scipy/scipy/pull/23765): TST: signal: isolate use of alternative backend only to function… +* [#23767](https://github.com/scipy/scipy/pull/23767): BUG: signal: Fix `test_closest_STFT_dual_window_roundtrip`… +* [#23769](https://github.com/scipy/scipy/pull/23769): DOC: `special._specfun.eulerb`: fix cython docstring +* [#23770](https://github.com/scipy/scipy/pull/23770): MAINT: clean up some outdated CPython C API idioms +* [#23771](https://github.com/scipy/scipy/pull/23771): BUG: odr: prevent segfault with explicit model and job=1 (#23763) +* [#23772](https://github.com/scipy/scipy/pull/23772): ENH: stats.permutation\_test: add array API support +* [#23773](https://github.com/scipy/scipy/pull/23773): DOC/DX: Document use of `--` in spin ipython and spin python +* [#23775](https://github.com/scipy/scipy/pull/23775): ENH: stats.power: add array API support +* [#23779](https://github.com/scipy/scipy/pull/23779): ENH: stats.false\_discovery\_control: add array API support +* [#23780](https://github.com/scipy/scipy/pull/23780): ENH: interpolate.RegularGridInterpolator: remove zeroes from… +* [#23782](https://github.com/scipy/scipy/pull/23782): ENH: speedup quantile by not using stable sort +* [#23788](https://github.com/scipy/scipy/pull/23788): TST: some more test tol bumps +* [#23789](https://github.com/scipy/scipy/pull/23789): DOC: Improve formatting for the `scipy.optimize` module +* [#23792](https://github.com/scipy/scipy/pull/23792): CI: use Pixi for a windows job +* [#23795](https://github.com/scipy/scipy/pull/23795): MAINT: stats.iqr: prepare for array API translation +* [#23796](https://github.com/scipy/scipy/pull/23796): TST: still more test tolerance bumps to accommodate Accelerate +* [#23797](https://github.com/scipy/scipy/pull/23797): ENH: sparse: add `copy=False` arg to `astype()` where it… +* [#23802](https://github.com/scipy/scipy/pull/23802): BENCH: add simple benchmark for scipy.stats.quantile +* [#23803](https://github.com/scipy/scipy/pull/23803): ENH: stats.sigmaclip: add array API support +* [#23804](https://github.com/scipy/scipy/pull/23804): DOC: Convert a math narrative into LaTeX format [docs only] +* [#23807](https://github.com/scipy/scipy/pull/23807): ENH: stats.yeojohnson\_llf: add array API support +* [#23808](https://github.com/scipy/scipy/pull/23808): DOC: Remove two references to files that do nothing +* [#23809](https://github.com/scipy/scipy/pull/23809): ENH: stats.median\_abs\_deviation: add array API support +* [#23810](https://github.com/scipy/scipy/pull/23810): ENH: stats.brunnermunzel: add array API support +* [#23812](https://github.com/scipy/scipy/pull/23812): DOC: fix typo +* [#23816](https://github.com/scipy/scipy/pull/23816): DOC: `special.diric`: “Dirichlet function” -> “Dirichlet… +* [#23819](https://github.com/scipy/scipy/pull/23819): ENH: stats.cramervonmises\_2samp: vectorize statistic and asymptotic… +* [#23822](https://github.com/scipy/scipy/pull/23822): ENH: stats.kruskal: vectorize implementation +* [#23823](https://github.com/scipy/scipy/pull/23823): MAINT: interpolate: mark legacy functions out of scope for Array… +* [#23824](https://github.com/scipy/scipy/pull/23824): DOC: `special.mathieu_odd_coef`: “even” -> “odd” +* [#23828](https://github.com/scipy/scipy/pull/23828): ENH: spatial.transform.Rotation Add axis argument to `Rotation.mean` +* [#23831](https://github.com/scipy/scipy/pull/23831): DOC: Correct a few typos and indentations +* [#23834](https://github.com/scipy/scipy/pull/23834): ENH: stats.friedmanchisquare: simplify and vectorize implementation +* [#23835](https://github.com/scipy/scipy/pull/23835): DOC: stats.quantile: clarify broadcasting behavior +* [#23837](https://github.com/scipy/scipy/pull/23837): ENH: stats.mood: vectorize implementation +* [#23838](https://github.com/scipy/scipy/pull/23838): TST: special: Update tests for some Mathieu functions. +* [#23840](https://github.com/scipy/scipy/pull/23840): ENH: stats.levene: vectorize implementation +* [#23841](https://github.com/scipy/scipy/pull/23841): BLD: bump wheel build image +* [#23843](https://github.com/scipy/scipy/pull/23843): ENH: stats.ansari: vectorize implementation +* [#23844](https://github.com/scipy/scipy/pull/23844): DEV: move Pixi workspace to repo root +* [#23845](https://github.com/scipy/scipy/pull/23845): DOC: fix denominator in scipy.stats.kstatvar for var(k2) +* [#23846](https://github.com/scipy/scipy/pull/23846): DOC: Remove an invalid URL in References +* [#23847](https://github.com/scipy/scipy/pull/23847): ENH: stats.fligner: vectorize implementation +* [#23849](https://github.com/scipy/scipy/pull/23849): ENH: stats.chatterjeexi: add array API support +* [#23850](https://github.com/scipy/scipy/pull/23850): DOC: Improve documentation for the directed Hausdorff distance +* [#23851](https://github.com/scipy/scipy/pull/23851): ENH: stats.spearmanrho: array API compatible substitute for `spearmanr` +* [#23853](https://github.com/scipy/scipy/pull/23853): DOC: spin: Copy-edit help text for python and ipython commands. +* [#23855](https://github.com/scipy/scipy/pull/23855): TST: stats.multiscale\_graph\_correlation: update reference values +* [#23856](https://github.com/scipy/scipy/pull/23856): TST: sparse.linalg.tfqmr: avoid failure due to platform-dependent,… +* [#23858](https://github.com/scipy/scipy/pull/23858): DOC: Make a DOI clickable +* [#23861](https://github.com/scipy/scipy/pull/23861): DOC: Correct typos: an 1d -> a 1d +* [#23862](https://github.com/scipy/scipy/pull/23862): ENH: stats.kruskal: add array API support +* [#23863](https://github.com/scipy/scipy/pull/23863): ENH: special: add handling of double type for `_gen_harmonic`... +* [#23865](https://github.com/scipy/scipy/pull/23865): MAINT/TST: stats.yeojohnson\_llf/boxcox\_llf: fix/test nan\_policy/keepdims… +* [#23866](https://github.com/scipy/scipy/pull/23866): DOC: Add reference paper to `scipy.spatial.KDTree` +* [#23869](https://github.com/scipy/scipy/pull/23869): ENH: spatial.transform.Rotation: Add shape to `random` and… +* [#23870](https://github.com/scipy/scipy/pull/23870): ENH: stats.mannwhitneyu: add array API support +* [#23871](https://github.com/scipy/scipy/pull/23871): DOC: stats: Fix some math markup in the boxcox docstring. +* [#23873](https://github.com/scipy/scipy/pull/23873): DOC: Update `scipy.stats.moyal` reference to new URL +* [#23874](https://github.com/scipy/scipy/pull/23874): TST: spatial.transform.Rotation: fix `Rotation.random` tests +* [#23875](https://github.com/scipy/scipy/pull/23875): ENH: spatial.transform.RigidTransform: implement `shape` for… +* [#23876](https://github.com/scipy/scipy/pull/23876): DOC: Add DOI to reference paper in `fractional_matrix_power`… +* [#23877](https://github.com/scipy/scipy/pull/23877): MAINT/CI: use `dtach` for modularity enforcement +* [#23880](https://github.com/scipy/scipy/pull/23880): TST: interpolate.AAA: bump test tolerance +* [#23881](https://github.com/scipy/scipy/pull/23881): ENH: stats.epps\_singleton\_2samp: vectorize implementation +* [#23883](https://github.com/scipy/scipy/pull/23883): DOC: forward port 1.16.3 relnotes +* [#23887](https://github.com/scipy/scipy/pull/23887): DOC: correct grammar issues in code comments +* [#23889](https://github.com/scipy/scipy/pull/23889): ENH: stats.levene: add array API support +* [#23890](https://github.com/scipy/scipy/pull/23890): DOC/TST: stats.quantile: document and test JAX support +* [#23891](https://github.com/scipy/scipy/pull/23891): ENH: stats.iqr: add array API support +* [#23893](https://github.com/scipy/scipy/pull/23893): MAINT: stats.epps\_singleton\_2samp: NaNs/Infs in input -> NaNs… +* [#23895](https://github.com/scipy/scipy/pull/23895): BUG: linalg: fix MKL ILP64 symbol misnamings +* [#23897](https://github.com/scipy/scipy/pull/23897): DOC: sparse: Add examples sections to three new function doc\_strings +* [#23898](https://github.com/scipy/scipy/pull/23898): ENH: stats.wilcoxon: add array API support +* [#23899](https://github.com/scipy/scipy/pull/23899): ENH: stats.friedmanchisquare: add array API support +* [#23903](https://github.com/scipy/scipy/pull/23903): TST: signal: mark failing tests to unblock CI +* [#23904](https://github.com/scipy/scipy/pull/23904): BENCH: integrate: skip xslow benchmarks in CI +* [#23905](https://github.com/scipy/scipy/pull/23905): CI: free up disk space in Intel oneAPI workflow +* [#23911](https://github.com/scipy/scipy/pull/23911): TST: stats: avoid modifying shared self.u +* [#23912](https://github.com/scipy/scipy/pull/23912): ENH: stats.fligner: add array API support +* [#23914](https://github.com/scipy/scipy/pull/23914): ENH:integrate: Rewrite LSODA in C +* [#23915](https://github.com/scipy/scipy/pull/23915): BUG: `special`: Fix convergence criterion in `eval_{legendre,`… +* [#23917](https://github.com/scipy/scipy/pull/23917): DOC: special: Ellipsoidal harmonic functions aren’t Lame +* [#23920](https://github.com/scipy/scipy/pull/23920): DEV: update `CODEOWNERS` +* [#23921](https://github.com/scipy/scipy/pull/23921): BUG:signal: Ensure consistent dtypes for filter functions across… +* [#23922](https://github.com/scipy/scipy/pull/23922): BUG: optimize: add py314 wrapper for `inspect.signature` of… +* [#23928](https://github.com/scipy/scipy/pull/23928): ENH: stats.cramervonmises\_2samp: add array API support +* [#23929](https://github.com/scipy/scipy/pull/23929): ENH: stats.epps\_singleton\_2samp: add array API support +* [#23930](https://github.com/scipy/scipy/pull/23930): ENH: stats.\_xp\_searchsorted: private vectorized searchsorted +* [#23933](https://github.com/scipy/scipy/pull/23933): ENH: spatial.transform: add `axis` argument to `RigidTransform.mean` +* [#23934](https://github.com/scipy/scipy/pull/23934): DOC: spatial: RigidTransform docs tweaks +* [#23936](https://github.com/scipy/scipy/pull/23936): BLD/CI: Add ASAN suppressions and CI job +* [#23937](https://github.com/scipy/scipy/pull/23937): TST: `spatial.transform.RigidTransform`: Add ND concatenation… +* [#23940](https://github.com/scipy/scipy/pull/23940): BUG: sparse.csgraph: remove rel import to fix Cython 3.2 +* [#23941](https://github.com/scipy/scipy/pull/23941): ENH: stats.quantile: add support for frequency weights +* [#23942](https://github.com/scipy/scipy/pull/23942): DOC correct “shape” type for “scipy.sparse.random\_array” +* [#23948](https://github.com/scipy/scipy/pull/23948): DOC: stats.cumfreq: correct bin edges of plot +* [#23952](https://github.com/scipy/scipy/pull/23952): MAINT: stats: silence the “unused function” build noise from… +* [#23954](https://github.com/scipy/scipy/pull/23954): BENCH: interpolate: fix the RGI subclassing benchmark +* [#23955](https://github.com/scipy/scipy/pull/23955): DOC: list classes in Array API tables +* [#23956](https://github.com/scipy/scipy/pull/23956): MAINT: add `xp-capabilities` to `BSpline` +* [#23963](https://github.com/scipy/scipy/pull/23963): ENH:integrate: Rewrite VODE and ZVODE in C +* [#23964](https://github.com/scipy/scipy/pull/23964): ENH: stats.ks\_1samp: vectorize implementation +* [#23966](https://github.com/scipy/scipy/pull/23966): ENH: stats.cramervonmises: vectorize and add array API support +* [#23970](https://github.com/scipy/scipy/pull/23970): ENH: stats.ks\_1samp: add array API support +* [#23971](https://github.com/scipy/scipy/pull/23971): ENH: stats.ansari: add array API support +* [#23974](https://github.com/scipy/scipy/pull/23974): ENH: stats: Updated tabulated critical values for the normal… +* [#23975](https://github.com/scipy/scipy/pull/23975): MAINT: signal: remove an obsolete workaround in detrend +* [#23976](https://github.com/scipy/scipy/pull/23976): DOC: interpolate.interpn: add value comparison to example +* [#23979](https://github.com/scipy/scipy/pull/23979): BUG: special: fix `comb(n, 0, repetition=True)` returning `0`… +* [#23981](https://github.com/scipy/scipy/pull/23981): ENH: stats.\_xp\_searchsorted: simplification, edge case handling,… +* [#23982](https://github.com/scipy/scipy/pull/23982): DEV: update Pixi workspace name and description +* [#23984](https://github.com/scipy/scipy/pull/23984): DEV: update CODEOWNERS +* [#23986](https://github.com/scipy/scipy/pull/23986): MAINT: sync and update scipy-openblas to 0.3.30.0.8 +* [#23987](https://github.com/scipy/scipy/pull/23987): CI: reduce cache usage in GitHub Actions +* [#23988](https://github.com/scipy/scipy/pull/23988): CI: add `environments` args to `setup-pixi` to log dependencies +* [#23993](https://github.com/scipy/scipy/pull/23993): BLD/DEV: force openblas on Windows +* [#23994](https://github.com/scipy/scipy/pull/23994): DOC/BLD: Clarify `yum` usage in RHEL +* [#24003](https://github.com/scipy/scipy/pull/24003): MAINT: stats: re-enable the “unused function” warning in qmc… +* [#24004](https://github.com/scipy/scipy/pull/24004): CI: use stable numpy release in free-threading job +* [#24006](https://github.com/scipy/scipy/pull/24006): MAINT: removes a reference cycle in `optimize.differential_evolution` +* [#24007](https://github.com/scipy/scipy/pull/24007): TST: optimize.least\_squares: reduce process count and thread… +* [#24008](https://github.com/scipy/scipy/pull/24008): BUG: fix interpreter crashes in special functions related to… +* [#24012](https://github.com/scipy/scipy/pull/24012): TST: optimize.minimize: make trust-constr test thread safe by… +* [#24013](https://github.com/scipy/scipy/pull/24013): BUG: Ensure C-contiguous inputs in `_fitpack_repro._validate_inputs`… +* [#24016](https://github.com/scipy/scipy/pull/24016): CI: run cache-heavy OneAPI job on main every 2 days to optimize… +* [#24017](https://github.com/scipy/scipy/pull/24017): BUG: special.assoc\_legendre\_p: update `xsf` to fix `z=-1,`… +* [#24023](https://github.com/scipy/scipy/pull/24023): TST: integrate.qmc\_quad: tolerance bump +* [#24024](https://github.com/scipy/scipy/pull/24024): ENH/TST: signal: Add xp\_capabilities for scipy.signal +* [#24025](https://github.com/scipy/scipy/pull/24025): DOC: stats: add equations for Cramer von Mises functions +* [#24028](https://github.com/scipy/scipy/pull/24028): MAINT:integrate: Initialize variable to silence compiler warnings +* [#24029](https://github.com/scipy/scipy/pull/24029): ENH: stats.mood: add array API support +* [#24030](https://github.com/scipy/scipy/pull/24030): ENH: stats.anderson: add `method` parameter +* [#24031](https://github.com/scipy/scipy/pull/24031): ENH: stats.anderson\_ksamp: add `variant` parameter +* [#24033](https://github.com/scipy/scipy/pull/24033): DEP: deprecate `scipy.odr` +* [#24036](https://github.com/scipy/scipy/pull/24036): CI: run Windows OneAPI job on main every 2 days to prefetch cache +* [#24039](https://github.com/scipy/scipy/pull/24039): DOC/TST: fft: mark array api coverage with `xp_capabilities` +* [#24040](https://github.com/scipy/scipy/pull/24040): DOC: add LFX Insights badge to README +* [#24044](https://github.com/scipy/scipy/pull/24044): DOC: optimize.minimize: fix `subproblem_maxiter` docs for `trust-exact`… +* [#24045](https://github.com/scipy/scipy/pull/24045): MAINT: signal: remove stray np.testing assertions +* [#24047](https://github.com/scipy/scipy/pull/24047): TST: stats.t: add tolerance to moment test +* [#24048](https://github.com/scipy/scipy/pull/24048): DEV: switch from `dtach` to `tach` +* [#24049](https://github.com/scipy/scipy/pull/24049): MAINT: speed up `xp_promote` and `xp_result_type` for big… +* [#24050](https://github.com/scipy/scipy/pull/24050): DEV: remove unused `build-mkl` task from workspace +* [#24053](https://github.com/scipy/scipy/pull/24053): BUG: signal: fix a GetWindow test +* [#24056](https://github.com/scipy/scipy/pull/24056): ENH: spatial: factor out `from_matrix` orthogonalization for… +* [#24057](https://github.com/scipy/scipy/pull/24057): MAINT: Fix a deprecation warning coming from pytest-run-parallel +* [#24059](https://github.com/scipy/scipy/pull/24059): CI: revert pre-release NumPy and no isolation from np2 release… +* [#24061](https://github.com/scipy/scipy/pull/24061): MAINT: fix a typo in nnls documentation +* [#24063](https://github.com/scipy/scipy/pull/24063): TST: linalg/solve: reenable and fix the “pos def” solve test +* [#24067](https://github.com/scipy/scipy/pull/24067): DEV: add test-coverage and test-xslow tasks +* [#24068](https://github.com/scipy/scipy/pull/24068): DEV: tach: use `respect_gitignore = "if_git_repo"` +* [#24070](https://github.com/scipy/scipy/pull/24070): MAINT: interpolate/RBF: use fixed-width ints with pythran +* [#24071](https://github.com/scipy/scipy/pull/24071): DEV: add `bench` task +* [#24076](https://github.com/scipy/scipy/pull/24076): BUG: Return zero for out-of-range derivative orders in `NdBSpline`... +* [#24077](https://github.com/scipy/scipy/pull/24077): MAINT: lock Pixi to fix CI +* [#24080](https://github.com/scipy/scipy/pull/24080): DEP: signal.lombscargle: deprecate positional args, warn on `precenter=False` +* [#24083](https://github.com/scipy/scipy/pull/24083): ENH: stats.f\_oneway: add array API support +* [#24085](https://github.com/scipy/scipy/pull/24085): DOC: linalg: edit the doc note: we no longer import numpy linalg… +* [#24092](https://github.com/scipy/scipy/pull/24092): ENH: spatial.transform: Add `assume_valid` argument to `` Rotation.from_matrix` ``… +* [#24094](https://github.com/scipy/scipy/pull/24094): TST: fft: `allow_dask_compute` for all `uarray`-using funcs +* [#24095](https://github.com/scipy/scipy/pull/24095): DOC: differential\_evolution - fix typo in custom strategy example +* [#24097](https://github.com/scipy/scipy/pull/24097): ENH: stats: added marginal function to `stats.multivariate_t` +* [#24098](https://github.com/scipy/scipy/pull/24098): TST: linalg: unskip a test +* [#24100](https://github.com/scipy/scipy/pull/24100): DOC: SciPy 1.17.0 release notes +* [#24106](https://github.com/scipy/scipy/pull/24106): BUG: interpolate: Fix h[m] -> h[n] typo in \_deBoor\_D derivative… +* [#24107](https://github.com/scipy/scipy/pull/24107): ENH: linalg/solve: move the tridiagonal solve slice iteration… +* [#24111](https://github.com/scipy/scipy/pull/24111): BLD/DEV: fix windows build +* [#24113](https://github.com/scipy/scipy/pull/24113): DOC: signal: mark some legacy functions as out of scope for array… +* [#24118](https://github.com/scipy/scipy/pull/24118): MAINT: version pins/prep for 1.17.0rc1 +* [#24129](https://github.com/scipy/scipy/pull/24129): REL: set 1.17.0rc2 unreleased +* [#24132](https://github.com/scipy/scipy/pull/24132): DOC: update mailmap +* [#24133](https://github.com/scipy/scipy/pull/24133): BUG: integrate: fix no module named ‘scipy.integrate.\_lsoda’ +* [#24138](https://github.com/scipy/scipy/pull/24138): DOC: release notes: improve wording of sparse highlight +* [#24139](https://github.com/scipy/scipy/pull/24139): API: `linalg.inv`: keyword-only `assume_a` and `lower`… +* [#24140](https://github.com/scipy/scipy/pull/24140): API: `signal.savgol_coeffs`: keyword-only `xp` and `device` +* [#24143](https://github.com/scipy/scipy/pull/24143): TYP: generic `signal.LinearTimeInvariant` type +* [#24145](https://github.com/scipy/scipy/pull/24145): BUG: `sparse`: fix `coo_matrix.__setitem__` signature +* [#24151](https://github.com/scipy/scipy/pull/24151): MAINT: linalg: raise for zero-size batch +* [#24155](https://github.com/scipy/scipy/pull/24155): MAINT: bump `xsf` to fix `special.itj0y0` regression +* [#24161](https://github.com/scipy/scipy/pull/24161): BUG:linalg.interpolative: Fix two edge cases for id\_dist Cython… +* [#24174](https://github.com/scipy/scipy/pull/24174): REV:integrate: Revert the stepsize change in LSODA +* [#24207](https://github.com/scipy/scipy/pull/24207): MAINT: backports for SciPy 1.17.0rc2 +* [#24213](https://github.com/scipy/scipy/pull/24213): TST: fft: Add allow\_dask\_compute=True to more places in fft +* [#24214](https://github.com/scipy/scipy/pull/24214): DOC: update 1.17.0 notes for RBFInterpolator +* [#24218](https://github.com/scipy/scipy/pull/24218): BENCH, MAINT: NumPy 2.4.0 bench compat +* [#24223](https://github.com/scipy/scipy/pull/24223): BLD: linalg: `link_language: 'fortran'` for `_fblas` +* [#24239](https://github.com/scipy/scipy/pull/24239): MAINT: bump array-api-compat for JAX>=0.8.2 compat +* [#24240](https://github.com/scipy/scipy/pull/24240): MAINT: bump array-api-compat to 1.13 tag +* [#24250](https://github.com/scipy/scipy/pull/24250): BUG: stats.\_unuran: fix va\_args memory corruption bug +* [#24255](https://github.com/scipy/scipy/pull/24255): REL: set 1.17.0rc3 unreleased +* [#24260](https://github.com/scipy/scipy/pull/24260): DOC: stats.anderson/anderson\_ksamp: improve release notes +* [#24284](https://github.com/scipy/scipy/pull/24284): CI: fix ILP64 jobs for build failures and unpinned scipy-openblas… +* [#24304](https://github.com/scipy/scipy/pull/24304): DOC: clarify ILP64 support caveats in the release notes diff --git a/corpus/changelog/scipy_releases/scipy_120.md b/corpus/changelog/scipy_releases/scipy_120.md new file mode 100644 index 0000000000000000000000000000000000000000..b9ce55bef413f8f1b42b3456e2cd0f494d0a6c0d --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_120.md @@ -0,0 +1,716 @@ +# SciPy 1.2.0 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.2.0-notes.html +Version: 1.2.0 + +Contents + +* [SciPy 1.2.0 Release Notes](#scipy-1-2-0-release-notes) + + + [Highlights of this release](#highlights-of-this-release) + + [New features](#new-features) + + - [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#scipy-ndimage-improvements) + - [[`scipy.fftpack`](../reference/fftpack.html#module-scipy.fftpack "scipy.fftpack") improvements](#scipy-fftpack-improvements) + - [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#scipy-interpolate-improvements) + - [[`scipy.cluster`](../reference/cluster.html#module-scipy.cluster "scipy.cluster") improvements](#scipy-cluster-improvements) + - [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#scipy-special-improvements) + - [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#scipy-optimize-improvements) + - [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#scipy-signal-improvements) + - [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#scipy-sparse-improvements) + - [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#scipy-spatial-improvements) + - [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#scipy-stats-improvements) + - [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#scipy-linalg-improvements) + + [Deprecated features](#deprecated-features) + + [Backwards-incompatible changes](#backwards-incompatible-changes) + + [Authors](#authors) + + - [Issues closed for 1.2.0](#issues-closed-for-1-2-0) + - [Pull requests for 1.2.0](#pull-requests-for-1-2-0) + +SciPy 1.2.0 is the culmination of 6 months of hard work. It contains +many new features, numerous bug-fixes, improved test coverage and better +documentation. There have been a number of deprecations and API changes +in this release, which are documented below. All users are encouraged to +upgrade to this release, as there are a large number of bug-fixes and +optimizations. Before upgrading, we recommend that users check that +their own code does not use deprecated SciPy functionality (to do so, +run your code with `python -Wd` and check for `DeprecationWarning` s). +Our development attention will now shift to bug-fix releases on the +1.2.x branch, and on adding new features on the master branch. + +This release requires Python 2.7 or 3.4+ and NumPy 1.8.2 or greater. + +Note + +This will be the last SciPy release to support Python 2.7. +Consequently, the 1.2.x series will be a long term support (LTS) +release; we will backport bug-fixes until 1 Jan 2020. + +For running on PyPy, PyPy3 6.0+ and NumPy 1.15.0 are required. + +## [Highlights of this release](#id2)[#](#highlights-of-this-release "Link to this heading") + +* 1-D root finding improvements with a new solver, `toms748`, and a new + unified interface, `root_scalar` +* new `dual_annealing` optimization method that combines stochastic and + local deterministic searching +* a new optimization algorithm, `shgo` (simplicial homology + global optimization), for derivative-free optimization problems +* a new category of quaternion-based transformations are available in + [`scipy.spatial.transform`](../reference/spatial.transform.html#module-scipy.spatial.transform "scipy.spatial.transform") + +## [New features](#id3)[#](#new-features "Link to this heading") + +### [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#id4)[#](#scipy-ndimage-improvements "Link to this heading") + +Proper spline coefficient calculations have been added for the `mirror`, +`wrap`, and `reflect` modes of [`scipy.ndimage.rotate`](../reference/generated/scipy.ndimage.rotate.html#scipy.ndimage.rotate "scipy.ndimage.rotate"). + +### [[`scipy.fftpack`](../reference/fftpack.html#module-scipy.fftpack "scipy.fftpack") improvements](#id5)[#](#scipy-fftpack-improvements "Link to this heading") + +DCT-IV, DST-IV, DCT-I, and DST-I orthonormalization are now supported in +[`scipy.fftpack`](../reference/fftpack.html#module-scipy.fftpack "scipy.fftpack"). + +### [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#id6)[#](#scipy-interpolate-improvements "Link to this heading") + +[`scipy.interpolate.pade`](../reference/generated/scipy.interpolate.pade.html#scipy.interpolate.pade "scipy.interpolate.pade") now accepts a new argument for the order of the +numerator. + +### [[`scipy.cluster`](../reference/cluster.html#module-scipy.cluster "scipy.cluster") improvements](#id7)[#](#scipy-cluster-improvements "Link to this heading") + +[`scipy.cluster.vq.kmeans2`](../reference/generated/scipy.cluster.vq.kmeans2.html#scipy.cluster.vq.kmeans2 "scipy.cluster.vq.kmeans2") gained a new initialization method, kmeans++. + +### [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#id8)[#](#scipy-special-improvements "Link to this heading") + +The function `softmax` was added to [`scipy.special`](../reference/special.html#module-scipy.special "scipy.special"). + +### [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#id9)[#](#scipy-optimize-improvements "Link to this heading") + +The one-dimensional nonlinear solvers have been given a unified interface +[`scipy.optimize.root_scalar`](../reference/generated/scipy.optimize.root_scalar.html#scipy.optimize.root_scalar "scipy.optimize.root_scalar"), similar to the [`scipy.optimize.root`](../reference/generated/scipy.optimize.root.html#scipy.optimize.root "scipy.optimize.root") interface +for multi-dimensional solvers. `scipy.optimize.root_scalar(f, bracket=[a ,b], +method="brenth")` is equivalent to `scipy.optimize.brenth(f, a ,b)`. If no +`method` is specified, an appropriate one will be selected based upon the +bracket and the number of derivatives available. + +The so-called Algorithm 748 of Alefeld, Potra and Shi for root-finding within +an enclosing interval has been added as [`scipy.optimize.toms748`](../reference/generated/scipy.optimize.toms748.html#scipy.optimize.toms748 "scipy.optimize.toms748"). This provides +guaranteed convergence to a root with convergence rate per function evaluation +of approximately 1.65 (for sufficiently well-behaved functions). + +`differential_evolution` now has the `updating` and `workers` keywords. +The first chooses between continuous updating of the best solution vector (the +default), or once per generation. Continuous updating can lead to faster +convergence. The `workers` keyword accepts an `int` or map-like callable, +and parallelises the solver (having the side effect of updating once per +generation). Supplying an `int` evaluates the trial solutions in N parallel +parts. Supplying a map-like callable allows other parallelisation approaches +(such as `mpi4py`, or `joblib`) to be used. + +`dual_annealing` (and `shgo` below) is a powerful new general-purpose +global optimization (GO) algorithm. `dual_annealing` uses two annealing +processes to accelerate the convergence towards the global minimum of an +objective mathematical function. The first annealing process controls the +stochastic Markov chain searching and the second annealing process controls the +deterministic minimization. So, dual annealing is a hybrid method that takes +advantage of stochastic and local deterministic searching in an efficient way. + +`shgo` (simplicial homology global optimization) is a similar algorithm +appropriate for solving black box and derivative-free optimization (DFO) +problems. The algorithm generally converges to the global solution in finite +time. The convergence holds for non-linear inequality and +equality constraints. In addition to returning a global minimum, the +algorithm also returns any other global and local minima found after every +iteration. This makes it useful for exploring the solutions in a domain. + +[`scipy.optimize.newton`](../reference/generated/scipy.optimize.newton.html#scipy.optimize.newton "scipy.optimize.newton") can now accept a scalar or an array. + +`MINPACK` usage is now thread-safe, such that `MINPACK` + callbacks may +be used on multiple threads. + +### [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#id10)[#](#scipy-signal-improvements "Link to this heading") + +Digital filter design functions now include a parameter to specify the sampling +rate. Previously, digital filters could only be specified using normalized +frequency, but different functions used different scales (e.g. 0 to 1 for +`butter` vs 0 to π for `freqz`), leading to errors and confusion. With +the `fs` parameter, ordinary frequencies can now be entered directly into +functions, with the normalization handled internally. + +`find_peaks` and related functions no longer raise an exception if the +properties of a peak have unexpected values (e.g. a prominence of 0). A +`PeakPropertyWarning` is given instead. + +The new keyword argument `plateau_size` was added to `find_peaks`. +`plateau_size` may be used to select peaks based on the length of the +flat top of a peak. + +`welch()` and `csd()` methods in [`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") now support calculation +of a median average PSD, using `average='mean'` keyword. + +### [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#id11)[#](#scipy-sparse-improvements "Link to this heading") + +The [`scipy.sparse.bsr_matrix.tocsr`](../reference/generated/scipy.sparse.bsr_matrix.tocsr.html#scipy.sparse.bsr_matrix.tocsr "scipy.sparse.bsr_matrix.tocsr") method is now implemented directly instead +of converting via COO format, and the [`scipy.sparse.bsr_matrix.tocsc`](../reference/generated/scipy.sparse.bsr_matrix.tocsc.html#scipy.sparse.bsr_matrix.tocsc "scipy.sparse.bsr_matrix.tocsc") method +is now also routed via CSR conversion instead of COO. The efficiency of both +conversions is now improved. + +The issue where SuperLU or UMFPACK solvers crashed on matrices with +non-canonical format in [`scipy.sparse.linalg`](../reference/sparse.linalg.html#module-scipy.sparse.linalg "scipy.sparse.linalg") was fixed. The solver wrapper +canonicalizes the matrix if necessary before calling the SuperLU or UMFPACK +solver. + +The `largest` option of *scipy.sparse.linalg.lobpcg()* was fixed to have +a correct (and expected) behavior. The order of the eigenvalues was made +consistent with the ARPACK solver (`eigs()`), i.e. ascending for the +smallest eigenvalues, and descending for the largest eigenvalues. + +The [`scipy.sparse.random`](../reference/generated/scipy.sparse.random.html#scipy.sparse.random "scipy.sparse.random") function is now faster and also supports integer and +complex values by passing the appropriate value to the `dtype` argument. + +### [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#id12)[#](#scipy-spatial-improvements "Link to this heading") + +The function [`scipy.spatial.distance.jaccard`](../reference/generated/scipy.spatial.distance.jaccard.html#scipy.spatial.distance.jaccard "scipy.spatial.distance.jaccard") was modified to return 0 instead +of `np.nan` when two all-zero vectors are compared. + +Support for the Jensen Shannon distance, the square-root of the divergence, has +been added under [`scipy.spatial.distance.jensenshannon`](../reference/generated/scipy.spatial.distance.jensenshannon.html#scipy.spatial.distance.jensenshannon "scipy.spatial.distance.jensenshannon"). + +An optional keyword was added to the function +*scipy.spatial.cKDTree.query\_ball\_point()* to sort or not sort the returned +indices. Not sorting the indices can speed up calls. + +A new category of quaternion-based transformations are available in +[`scipy.spatial.transform`](../reference/spatial.transform.html#module-scipy.spatial.transform "scipy.spatial.transform"), including spherical linear interpolation of +rotations (`Slerp`), conversions to and from quaternions, Euler angles, +and general rotation and inversion capabilities +(*spatial.transform.Rotation*), and uniform random sampling of 3D +rotations (*spatial.transform.Rotation.random*). + +### [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#id13)[#](#scipy-stats-improvements "Link to this heading") + +The Yeo-Johnson power transformation is now supported (`yeojohnson`, +`yeojohnson_llf`, `yeojohnson_normmax`, `yeojohnson_normplot`). Unlike +the Box-Cox transformation, the Yeo-Johnson transformation can accept negative +values. + +Added a general method to sample random variates based on the density only, in +the new function `rvs_ratio_uniforms`. + +The Yule-Simon distribution (`yulesimon`) was added – this is a new +discrete probability distribution. + +`stats` and `mstats` now have access to a new regression method, +`siegelslopes`, a robust linear regression algorithm + +[`scipy.stats.gaussian_kde`](../reference/generated/scipy.stats.gaussian_kde.html#scipy.stats.gaussian_kde "scipy.stats.gaussian_kde") now has the ability to deal with weighted samples, +and should have a modest improvement in performance + +Levy Stable Parameter Estimation, PDF, and CDF calculations are now supported +for [`scipy.stats.levy_stable`](../reference/generated/scipy.stats.levy_stable.html#scipy.stats.levy_stable "scipy.stats.levy_stable"). + +The Brunner-Munzel test is now available as `brunnermunzel` in `stats` +and `mstats`. + +### [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#id14)[#](#scipy-linalg-improvements "Link to this heading") + +[`scipy.linalg.lapack`](../reference/linalg.lapack.html#module-scipy.linalg.lapack "scipy.linalg.lapack") now exposes the LAPACK routines using the Rectangular +Full Packed storage (RFP) for upper triangular, lower triangular, symmetric, +or Hermitian matrices; the upper trapezoidal fat matrix RZ decomposition +routines are now available as well. + +## [Deprecated features](#id15)[#](#deprecated-features "Link to this heading") + +The functions `hyp2f0`, `hyp1f2` and `hyp3f0` in `scipy.special` have +been deprecated. + +## [Backwards-incompatible changes](#id16)[#](#backwards-incompatible-changes "Link to this heading") + +LAPACK version 3.4.0 or later is now required. Building with +Apple Accelerate is no longer supported. + +The function `scipy.linalg.subspace_angles(A, B)` now gives correct +results for all angles. Before this, the function only returned +correct values for those angles which were greater than π/4. + +Support for the Bento build system has been removed. Bento had not been +maintained for several years, and did not have good Python 3 or wheel support, +hence it was time to remove it. + +The required signature of *scipy.optimize.lingprog* `method=simplex` +callback function has changed. Before iteration begins, the simplex solver +first converts the problem into a standard form that does not, in general, +have the same variables or constraints +as the problem defined by the user. Previously, the simplex solver would pass a +user-specified callback function several separate arguments, such as the +current solution vector `xk`, corresponding to this standard-form problem. +Unfortunately, the relationship between the standard-form problem and the +user-defined problem was not documented, limiting the utility of the +information passed to the callback function. + +In addition to numerous bug-fix changes, the simplex solver now passes a +user-specified callback function a single `OptimizeResult` object containing +information that corresponds directly to the user-defined problem. In future +releases, this `OptimizeResult` object may be expanded to include additional +information, such as variables corresponding to the standard-form problem and +information concerning the relationship between the standard-form and +user-defined problems. + +The implementation of [`scipy.sparse.random`](../reference/generated/scipy.sparse.random.html#scipy.sparse.random "scipy.sparse.random") has changed, and this affects the +numerical values returned for both `sparse.random` and `sparse.rand` for +some matrix shapes and a given seed. + +[`scipy.optimize.newton`](../reference/generated/scipy.optimize.newton.html#scipy.optimize.newton "scipy.optimize.newton") will no longer use Halley’s method in cases where it +negatively impacts convergence. + +## [Authors](#id17)[#](#authors "Link to this heading") + +* @endolith +* @luzpaz +* Hameer Abbasi + +* akahard2dj + +* Anton Akhmerov +* Joseph Albert +* alexthomas93 + +* ashish + +* atpage + +* Blair Azzopardi + +* Yoshiki Vázquez Baeza +* Bence Bagi + +* Christoph Baumgarten +* Lucas Bellomo + +* BH4 + +* Aditya Bharti +* Max Bolingbroke +* François Boulogne +* Ward Bradt + +* Matthew Brett +* Evgeni Burovski +* Rafał Byczek + +* Alfredo Canziani + +* CJ Carey +* Lucía Cheung + +* Poom Chiarawongse + +* Jeanne Choo + +* Robert Cimrman +* Graham Clenaghan + +* cynthia-rempel + +* Johannes Damp + +* Jaime Fernandez del Rio +* Dowon + +* emmi474 + +* Stefan Endres + +* Thomas Etherington + +* Piotr Figiel +* Alex Fikl + +* fo40225 + +* Joseph Fox-Rabinovitz +* Lars G +* Abhinav Gautam + +* Stiaan Gerber + +* C.A.M. Gerlach + +* Ralf Gommers +* Todd Goodall +* Lars Grueter + +* Sylvain Gubian + +* Matt Haberland +* David Hagen +* Will Handley + +* Charles Harris +* Ian Henriksen +* Thomas Hisch + +* Theodore Hu +* Michael Hudson-Doyle + +* Nicolas Hug + +* jakirkham + +* Jakob Jakobson + +* James + +* Jan Schlüter +* jeanpauphilet + +* josephmernst + +* Kai + +* Kai-Striega + +* kalash04 + +* Toshiki Kataoka + +* Konrad0 + +* Tom Krauss + +* Johannes Kulick +* Lars Grüter + +* Eric Larson +* Denis Laxalde +* Will Lee + +* Katrin Leinweber + +* Yin Li + +* 16. 12. Lim + +* Jesse Livezey + +* Duncan Macleod + +* MatthewFlamm + +* Nikolay Mayorov +* Mike McClurg + +* Christian Meyer + +* Mark Mikofski +* Naoto Mizuno + +* mohmmadd + +* Nathan Musoke +* Anju Geetha Nair + +* Andrew Nelson +* Ayappan P + +* Nick Papior +* Haesun Park + +* Ronny Pfannschmidt + +* pijyoi + +* Ilhan Polat +* Anthony Polloreno + +* Ted Pudlik +* puenka +* Eric Quintero +* Pradeep Reddy Raamana + +* Vyas Ramasubramani + +* Ramon Viñas + +* Tyler Reddy +* Joscha Reimer +* Antonio H Ribeiro +* richardjgowers + +* Rob + +* robbystk + +* Lucas Roberts + +* rohan + +* Joaquin Derrac Rus + +* Josua Sassen + +* Bruce Sharpe + +* Max Shinn + +* Scott Sievert +* Sourav Singh +* Strahinja Lukić + +* Kai Striega + +* Shinya SUZUKI + +* Mike Toews + +* Piotr Uchwat +* Miguel de Val-Borro + +* Nicky van Foreest +* Paul van Mulbregt +* Gael Varoquaux +* Pauli Virtanen +* Stefan van der Walt +* Warren Weckesser +* Joshua Wharton + +* Bernhard M. Wiedemann + +* Eric Wieser +* Josh Wilson +* Tony Xiang + +* Roman Yurchak + +* Roy Zywina + + +A total of 137 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.2.0](#id18)[#](#issues-closed-for-1-2-0 "Link to this heading") + +* [#9520](https://github.com/scipy/scipy/issues/9520): signal.correlate with method=’fft’ doesn’t benefit from long… +* [#9547](https://github.com/scipy/scipy/issues/9547): signature of dual\_annealing doesn’t match other optimizers +* [#9540](https://github.com/scipy/scipy/issues/9540): SciPy v1.2.0rc1 cannot be imported on Python 2.7.15 +* [#1240](https://github.com/scipy/scipy/issues/1240): Allowing multithreaded use of minpack through scipy.optimize… +* [#1432](https://github.com/scipy/scipy/issues/1432): scipy.stats.mode extremely slow (Trac #905) +* [#3372](https://github.com/scipy/scipy/issues/3372): Please add Sphinx search field to online scipy html docs +* [#3678](https://github.com/scipy/scipy/issues/3678): \_clough\_tocher\_2d\_single direction between centroids +* [#4174](https://github.com/scipy/scipy/issues/4174): lobpcg “largest” option invalid? +* [#5493](https://github.com/scipy/scipy/issues/5493): anderson\_ksamp p-values>1 +* [#5743](https://github.com/scipy/scipy/issues/5743): slsqp fails to detect infeasible problem +* [#6139](https://github.com/scipy/scipy/issues/6139): scipy.optimize.linprog failed to find a feasible starting point… +* [#6358](https://github.com/scipy/scipy/issues/6358): stats: docstring for *vonmises\_line* points to *vonmises\_line*… +* [#6498](https://github.com/scipy/scipy/issues/6498): runtests.py is missing in pypi distfile +* [#7426](https://github.com/scipy/scipy/issues/7426): scipy.stats.ksone(n).pdf(x) returns nan for positive values of… +* [#7455](https://github.com/scipy/scipy/issues/7455): scipy.stats.ksone.pdf(2,x) return incorrect values for x near… +* [#7456](https://github.com/scipy/scipy/issues/7456): scipy.special.smirnov and scipy.special.smirnovi have accuracy… +* [#7492](https://github.com/scipy/scipy/issues/7492): scipy.special.kolmogorov(x)/kolmogi(p) inefficient, inaccurate… +* [#7914](https://github.com/scipy/scipy/issues/7914): TravisCI not failing when it should for -OO run +* [#8064](https://github.com/scipy/scipy/issues/8064): linalg.solve test crashes on Windows +* [#8212](https://github.com/scipy/scipy/issues/8212): LAPACK Rectangular Full Packed routines +* [#8256](https://github.com/scipy/scipy/issues/8256): differential\_evolution bug converges to wrong results in complex… +* [#8443](https://github.com/scipy/scipy/issues/8443): Deprecate *hyp2f0*, *hyp1f2*, and *hyp3f0*? +* [#8452](https://github.com/scipy/scipy/issues/8452): DOC: ARPACK tutorial has two conflicting equations +* [#8680](https://github.com/scipy/scipy/issues/8680): scipy fails compilation when building from source +* [#8686](https://github.com/scipy/scipy/issues/8686): Division by zero in \_trustregion.py when x0 is exactly equal… +* [#8700](https://github.com/scipy/scipy/issues/8700): \_MINPACK\_LOCK not held when calling into minpack from least\_squares +* [#8786](https://github.com/scipy/scipy/issues/8786): erroneous moment values for t-distribution +* [#8791](https://github.com/scipy/scipy/issues/8791): Checking COLA condition in istft should be optional (or omitted) +* [#8843](https://github.com/scipy/scipy/issues/8843): imresize cannot be deprecated just yet +* [#8844](https://github.com/scipy/scipy/issues/8844): Inverse Wishart Log PDF Incorrect for Non-diagonal Scale Matrix? +* [#8878](https://github.com/scipy/scipy/issues/8878): vonmises and vonmises\_line in stats: vonmises wrong and superfluous? +* [#8895](https://github.com/scipy/scipy/issues/8895): v1.1.0 *ndi.rotate* documentation – reused parameters not filled… +* [#8900](https://github.com/scipy/scipy/issues/8900): Missing complex conjugation in scipy.sparse.linalg.LinearOperator +* [#8904](https://github.com/scipy/scipy/issues/8904): BUG: if zero derivative at root, then Newton fails with RuntimeWarning +* [#8911](https://github.com/scipy/scipy/issues/8911): make\_interp\_spline bc\_type incorrect input interpretation +* [#8942](https://github.com/scipy/scipy/issues/8942): MAINT: Refactor `_linprog.py` and `_linprog_ip.py` to remove… +* [#8947](https://github.com/scipy/scipy/issues/8947): np.int64 in scipy.fftpack.next\_fast\_len +* [#9020](https://github.com/scipy/scipy/issues/9020): BUG: linalg.subspace\_angles gives wrong results +* [#9033](https://github.com/scipy/scipy/issues/9033): scipy.stats.normaltest sometimes gives incorrect returns b/c… +* [#9036](https://github.com/scipy/scipy/issues/9036): Bizarre times for [`scipy.sparse.rand`](../reference/generated/scipy.sparse.rand.html#scipy.sparse.rand "scipy.sparse.rand") function with ‘low’ density… +* [#9044](https://github.com/scipy/scipy/issues/9044): optimize.minimize(method=`trust-constr`) result dict does not… +* [#9071](https://github.com/scipy/scipy/issues/9071): doc/linalg: add cho\_solve\_banded to see also of cholesky\_banded +* [#9082](https://github.com/scipy/scipy/issues/9082): eigenvalue sorting in scipy.sparse.linalg.eigsh +* [#9086](https://github.com/scipy/scipy/issues/9086): signaltools.py:491: FutureWarning: Using a non-tuple sequence… +* [#9091](https://github.com/scipy/scipy/issues/9091): test\_spline\_filter failure on 32-bit +* [#9122](https://github.com/scipy/scipy/issues/9122): Typo on scipy minimization tutorial +* [#9135](https://github.com/scipy/scipy/issues/9135): doc error at +* [#9167](https://github.com/scipy/scipy/issues/9167): DOC: BUG: typo in ndimage LowLevelCallable tutorial example +* [#9169](https://github.com/scipy/scipy/issues/9169): truncnorm does not work if b < a in scipy.stats +* [#9250](https://github.com/scipy/scipy/issues/9250): scipy.special.tests.test\_mpmath::TestSystematic::test\_pcfw fails… +* [#9259](https://github.com/scipy/scipy/issues/9259): rv.expect() == rv.mean() is false for rv.mean() == nan (and inf) +* [#9286](https://github.com/scipy/scipy/issues/9286): DOC: Rosenbrock expression in optimize.minimize tutorial +* [#9316](https://github.com/scipy/scipy/issues/9316): SLSQP fails in nested optimization +* [#9337](https://github.com/scipy/scipy/issues/9337): scipy.signal.find\_peaks key typo in documentation +* [#9345](https://github.com/scipy/scipy/issues/9345): Example from documentation of scipy.sparse.linalg.eigs raises… +* [#9383](https://github.com/scipy/scipy/issues/9383): Default value for “mode” in “ndimage.shift” +* [#9419](https://github.com/scipy/scipy/issues/9419): dual\_annealing off by one in the number of iterations +* [#9442](https://github.com/scipy/scipy/issues/9442): Error in Defintion of Rosenbrock Function +* [#9453](https://github.com/scipy/scipy/issues/9453): TST: test\_eigs\_consistency() doesn’t have consistent results + +### [Pull requests for 1.2.0](#id19)[#](#pull-requests-for-1-2-0 "Link to this heading") + +* [#9526](https://github.com/scipy/scipy/pull/9526): TST: relax precision requirements in signal.correlate tests +* [#9507](https://github.com/scipy/scipy/pull/9507): CI: MAINT: Skip a ckdtree test on pypy +* [#9512](https://github.com/scipy/scipy/pull/9512): TST: test\_random\_sampling 32-bit handling +* [#9494](https://github.com/scipy/scipy/pull/9494): TST: test\_kolmogorov xfail 32-bit +* [#9486](https://github.com/scipy/scipy/pull/9486): BUG: fix sparse random int handling +* [#9550](https://github.com/scipy/scipy/pull/9550): BUG: scipy/\_lib/\_numpy\_compat: get\_randint +* [#9549](https://github.com/scipy/scipy/pull/9549): MAINT: make dual\_annealing signature match other optimizers +* [#9541](https://github.com/scipy/scipy/pull/9541): BUG: fix SyntaxError due to non-ascii character on Python 2.7 +* [#7352](https://github.com/scipy/scipy/pull/7352): ENH: add Brunner Munzel test to scipy.stats. +* [#7373](https://github.com/scipy/scipy/pull/7373): BUG: Jaccard distance for all-zero arrays would return np.nan +* [#7374](https://github.com/scipy/scipy/pull/7374): ENH: Add PDF, CDF and parameter estimation for Stable Distributions +* [#8098](https://github.com/scipy/scipy/pull/8098): ENH: Add shgo for global optimization of NLPs. +* [#8203](https://github.com/scipy/scipy/pull/8203): ENH: adding simulated dual annealing to optimize +* [#8259](https://github.com/scipy/scipy/pull/8259): Option to follow original Storn and Price algorithm and its parallelisation +* [#8293](https://github.com/scipy/scipy/pull/8293): ENH add ratio-of-uniforms method for rv generation to scipy.stats +* [#8294](https://github.com/scipy/scipy/pull/8294): BUG: Fix slowness in stats.mode +* [#8295](https://github.com/scipy/scipy/pull/8295): ENH: add Jensen Shannon distance to [`scipy.spatial.distance`](../reference/spatial.distance.html#module-scipy.spatial.distance "scipy.spatial.distance") +* [#8357](https://github.com/scipy/scipy/pull/8357): ENH: vectorize scalar zero-search-functions +* [#8397](https://github.com/scipy/scipy/pull/8397): Add *fs=* parameter to filter design functions +* [#8537](https://github.com/scipy/scipy/pull/8537): ENH: Implement mode parameter for spline filtering. +* [#8558](https://github.com/scipy/scipy/pull/8558): ENH: small speedup for stats.gaussian\_kde +* [#8560](https://github.com/scipy/scipy/pull/8560): BUG: fix p-value calc of anderson\_ksamp in scipy.stats +* [#8614](https://github.com/scipy/scipy/pull/8614): ENH: correct p-values for stats.kendalltau and stats.mstats.kendalltau +* [#8670](https://github.com/scipy/scipy/pull/8670): ENH: Require Lapack 3.4.0 +* [#8683](https://github.com/scipy/scipy/pull/8683): Correcting kmeans documentation +* [#8725](https://github.com/scipy/scipy/pull/8725): MAINT: Cleanup scipy.optimize.leastsq +* [#8726](https://github.com/scipy/scipy/pull/8726): BUG: Fix \_get\_output in scipy.ndimage to support string +* [#8733](https://github.com/scipy/scipy/pull/8733): MAINT: stats: A bit of clean up. +* [#8737](https://github.com/scipy/scipy/pull/8737): BUG: Improve numerical precision/convergence failures of smirnov/kolmogorov +* [#8738](https://github.com/scipy/scipy/pull/8738): MAINT: stats: A bit of clean up in test\_distributions.py. +* [#8740](https://github.com/scipy/scipy/pull/8740): BF/ENH: make minpack thread safe +* [#8742](https://github.com/scipy/scipy/pull/8742): BUG: Fix division by zero in trust-region optimization methods +* [#8746](https://github.com/scipy/scipy/pull/8746): MAINT: signal: Fix a docstring of a private function, and fix… +* [#8750](https://github.com/scipy/scipy/pull/8750): DOC clarified description of norminvgauss in scipy.stats +* [#8753](https://github.com/scipy/scipy/pull/8753): DOC: signal: Fix a plot title in the chirp docstring. +* [#8755](https://github.com/scipy/scipy/pull/8755): DOC: MAINT: Fix link to the wheel documentation in developer… +* [#8760](https://github.com/scipy/scipy/pull/8760): BUG: stats: boltzmann wasn’t setting the upper bound. +* [#8763](https://github.com/scipy/scipy/pull/8763): [DOC] Improved scipy.cluster.hierarchy documentation +* [#8765](https://github.com/scipy/scipy/pull/8765): DOC: added example for scipy.stat.mstats.tmin +* [#8788](https://github.com/scipy/scipy/pull/8788): DOC: fix definition of optional *disp* parameter +* [#8802](https://github.com/scipy/scipy/pull/8802): MAINT: Suppress dd\_real unused function compiler warnings. +* [#8803](https://github.com/scipy/scipy/pull/8803): ENH: Add full\_output support to optimize.newton() +* [#8804](https://github.com/scipy/scipy/pull/8804): MAINT: stats cleanup +* [#8808](https://github.com/scipy/scipy/pull/8808): DOC: add note about isinstance for frozen rvs +* [#8812](https://github.com/scipy/scipy/pull/8812): Updated numpydoc submodule +* [#8813](https://github.com/scipy/scipy/pull/8813): MAINT: stats: Fix multinomial docstrings, and do some clean up. +* [#8816](https://github.com/scipy/scipy/pull/8816): BUG: fixed \_stats of t-distribution in scipy.stats +* [#8817](https://github.com/scipy/scipy/pull/8817): BUG: ndimage: Fix validation of the origin argument in correlate… +* [#8822](https://github.com/scipy/scipy/pull/8822): BUG: integrate: Fix crash with repeated t values in odeint. +* [#8832](https://github.com/scipy/scipy/pull/8832): Hyperlink DOIs against preferred resolver +* [#8837](https://github.com/scipy/scipy/pull/8837): BUG: sparse: Ensure correct dtype for sparse comparison operations. +* [#8839](https://github.com/scipy/scipy/pull/8839): DOC: stats: A few tweaks to the linregress docstring. +* [#8846](https://github.com/scipy/scipy/pull/8846): BUG: stats: Fix logpdf method of invwishart. +* [#8849](https://github.com/scipy/scipy/pull/8849): DOC: signal: Fixed mistake in the firwin docstring. +* [#8854](https://github.com/scipy/scipy/pull/8854): DOC: fix type descriptors in ltisys documentation +* [#8865](https://github.com/scipy/scipy/pull/8865): Fix tiny typo in docs for chi2 pdf +* [#8870](https://github.com/scipy/scipy/pull/8870): Fixes related to invertibility of STFT +* [#8872](https://github.com/scipy/scipy/pull/8872): ENH: special: Add the softmax function +* [#8874](https://github.com/scipy/scipy/pull/8874): DOC correct gamma function in docstrings in scipy.stats +* [#8876](https://github.com/scipy/scipy/pull/8876): ENH: Added TOMS Algorithm 748 as 1-d root finder; 17 test function… +* [#8882](https://github.com/scipy/scipy/pull/8882): ENH: Only use Halley’s adjustment to Newton if close enough. +* [#8883](https://github.com/scipy/scipy/pull/8883): FIX: optimize: make jac and hess truly optional for ‘trust-constr’ +* [#8885](https://github.com/scipy/scipy/pull/8885): TST: Do not error on warnings raised about non-tuple indexing. +* [#8887](https://github.com/scipy/scipy/pull/8887): MAINT: filter out np.matrix PendingDeprecationWarning’s in numpy… +* [#8889](https://github.com/scipy/scipy/pull/8889): DOC: optimize: separate legacy interfaces from new ones +* [#8890](https://github.com/scipy/scipy/pull/8890): ENH: Add optimize.root\_scalar() as a universal dispatcher for… +* [#8899](https://github.com/scipy/scipy/pull/8899): DCT-IV, DST-IV and DCT-I, DST-I orthonormalization support in… +* [#8901](https://github.com/scipy/scipy/pull/8901): MAINT: Reorganize flapack.pyf.src file +* [#8907](https://github.com/scipy/scipy/pull/8907): BUG: ENH: Check if guess for newton is already zero before checking… +* [#8908](https://github.com/scipy/scipy/pull/8908): ENH: Make sorting optional for cKDTree.query\_ball\_point() +* [#8910](https://github.com/scipy/scipy/pull/8910): DOC: sparse.csgraph simple examples. +* [#8914](https://github.com/scipy/scipy/pull/8914): DOC: interpolate: fix equivalences of string aliases +* [#8918](https://github.com/scipy/scipy/pull/8918): add float\_control(precise, on) to \_fpumode.c +* [#8919](https://github.com/scipy/scipy/pull/8919): MAINT: interpolate: improve error messages for common *bc\_type*… +* [#8920](https://github.com/scipy/scipy/pull/8920): DOC: update Contributing to SciPy to say “prefer no PEP8 only… +* [#8924](https://github.com/scipy/scipy/pull/8924): MAINT: special: deprecate *hyp2f0*, *hyp1f2*, and *hyp3f0* +* [#8927](https://github.com/scipy/scipy/pull/8927): MAINT: special: remove *errprint* +* [#8932](https://github.com/scipy/scipy/pull/8932): Fix broadcasting scale arg of entropy +* [#8936](https://github.com/scipy/scipy/pull/8936): Fix (some) non-tuple index warnings +* [#8937](https://github.com/scipy/scipy/pull/8937): ENH: implement sparse matrix BSR to CSR conversion directly. +* [#8938](https://github.com/scipy/scipy/pull/8938): DOC: add @\_ni\_docstrings.docfiller in ndimage.rotate +* [#8940](https://github.com/scipy/scipy/pull/8940): Update \_discrete\_distns.py +* [#8943](https://github.com/scipy/scipy/pull/8943): DOC: Finish dangling sentence in *convolve* docstring +* [#8944](https://github.com/scipy/scipy/pull/8944): MAINT: Address tuple indexing and warnings +* [#8945](https://github.com/scipy/scipy/pull/8945): ENH: spatial.transform.Rotation [GSOC2018] +* [#8950](https://github.com/scipy/scipy/pull/8950): csgraph Dijkstra function description rewording +* [#8953](https://github.com/scipy/scipy/pull/8953): DOC, MAINT: HTTP -> HTTPS, and other linkrot fixes +* [#8955](https://github.com/scipy/scipy/pull/8955): BUG: np.int64 in scipy.fftpack.next\_fast\_len +* [#8958](https://github.com/scipy/scipy/pull/8958): MAINT: Add more descriptive error message for phase one simplex. +* [#8962](https://github.com/scipy/scipy/pull/8962): BUG: sparse.linalg: add missing conjugate to \_ScaledLinearOperator.adjoint +* [#8963](https://github.com/scipy/scipy/pull/8963): BUG: sparse.linalg: downgrade LinearOperator TypeError to warning +* [#8965](https://github.com/scipy/scipy/pull/8965): ENH: Wrapped RFP format and RZ decomposition routines +* [#8969](https://github.com/scipy/scipy/pull/8969): MAINT: doc and code fixes for optimize.newton +* [#8970](https://github.com/scipy/scipy/pull/8970): Added ‘average’ keyword for welch/csd to enable median averaging +* [#8971](https://github.com/scipy/scipy/pull/8971): Better imresize deprecation warning +* [#8972](https://github.com/scipy/scipy/pull/8972): MAINT: Switch np.where(c) for np.nonzero(c) +* [#8975](https://github.com/scipy/scipy/pull/8975): MAINT: Fix warning-based failures +* [#8979](https://github.com/scipy/scipy/pull/8979): DOC: fix description of count\_sort keyword of dendrogram +* [#8982](https://github.com/scipy/scipy/pull/8982): MAINT: optimize: Fixed minor mistakes in test\_linprog.py (#8978) +* [#8984](https://github.com/scipy/scipy/pull/8984): BUG: sparse.linalg: ensure expm casts integer inputs to float +* [#8986](https://github.com/scipy/scipy/pull/8986): BUG: optimize/slsqp: do not exit with convergence on steps where… +* [#8989](https://github.com/scipy/scipy/pull/8989): MAINT: use collections.abc in basinhopping +* [#8990](https://github.com/scipy/scipy/pull/8990): ENH extend p-values of anderson\_ksamp in scipy.stats +* [#8991](https://github.com/scipy/scipy/pull/8991): ENH: Weighted kde +* [#8993](https://github.com/scipy/scipy/pull/8993): ENH: spatial.transform.Rotation.random [GSOC 2018] +* [#8994](https://github.com/scipy/scipy/pull/8994): ENH: spatial.transform.Slerp [GSOC 2018] +* [#8995](https://github.com/scipy/scipy/pull/8995): TST: time.time in test +* [#9007](https://github.com/scipy/scipy/pull/9007): Fix typo in fftpack.rst +* [#9013](https://github.com/scipy/scipy/pull/9013): Added correct plotting code for two sided output from spectrogram +* [#9014](https://github.com/scipy/scipy/pull/9014): BUG: differential\_evolution with inf objective functions +* [#9017](https://github.com/scipy/scipy/pull/9017): BUG: fixed #8446 corner case for asformat(array|dense) +* [#9018](https://github.com/scipy/scipy/pull/9018): MAINT: \_lib/ccallback: remove unused code +* [#9021](https://github.com/scipy/scipy/pull/9021): BUG: Issue with subspace\_angles +* [#9022](https://github.com/scipy/scipy/pull/9022): DOC: Added “See Also” section to lombscargle docstring +* [#9034](https://github.com/scipy/scipy/pull/9034): BUG: Fix tolerance printing behavior, remove meaningless tol… +* [#9035](https://github.com/scipy/scipy/pull/9035): TST: improve signal.bsplines test coverage +* [#9037](https://github.com/scipy/scipy/pull/9037): ENH: add a new init method for k-means +* [#9039](https://github.com/scipy/scipy/pull/9039): DOC: Add examples to fftpack.irfft docstrings +* [#9048](https://github.com/scipy/scipy/pull/9048): ENH: scipy.sparse.random +* [#9050](https://github.com/scipy/scipy/pull/9050): BUG: scipy.io.hb\_write: fails for matrices not in csc format +* [#9051](https://github.com/scipy/scipy/pull/9051): MAINT: Fix slow sparse.rand for k < mn/3 (#9036). +* [#9054](https://github.com/scipy/scipy/pull/9054): MAINT: spatial: Explicitly initialize LAPACK output parameters. +* [#9055](https://github.com/scipy/scipy/pull/9055): DOC: Add examples to scipy.special docstrings +* [#9056](https://github.com/scipy/scipy/pull/9056): ENH: Use one thread in OpenBLAS +* [#9059](https://github.com/scipy/scipy/pull/9059): DOC: Update README with link to Code of Conduct +* [#9060](https://github.com/scipy/scipy/pull/9060): BLD: remove support for the Bento build system. +* [#9062](https://github.com/scipy/scipy/pull/9062): DOC add sections to overview in scipy.stats +* [#9066](https://github.com/scipy/scipy/pull/9066): BUG: Correct “remez” error message +* [#9069](https://github.com/scipy/scipy/pull/9069): DOC: update linalg section of roadmap for LAPACK versions. +* [#9079](https://github.com/scipy/scipy/pull/9079): MAINT: add spatial.transform to refguide check; complete some… +* [#9081](https://github.com/scipy/scipy/pull/9081): MAINT: Add warnings if pivot value is close to tolerance in linprog(method=’simplex’) +* [#9084](https://github.com/scipy/scipy/pull/9084): BUG fix incorrect p-values of kurtosistest in scipy.stats +* [#9095](https://github.com/scipy/scipy/pull/9095): DOC: add sections to mstats overview in scipy.stats +* [#9096](https://github.com/scipy/scipy/pull/9096): BUG: Add test for Stackoverflow example from issue 8174. +* [#9101](https://github.com/scipy/scipy/pull/9101): ENH: add Siegel slopes (robust regression) to scipy.stats +* [#9105](https://github.com/scipy/scipy/pull/9105): allow resample\_poly() to output float32 for float32 inputs. +* [#9112](https://github.com/scipy/scipy/pull/9112): MAINT: optimize: make trust-constr accept constraint dict (#9043) +* [#9118](https://github.com/scipy/scipy/pull/9118): Add doc entry to cholesky\_banded +* [#9120](https://github.com/scipy/scipy/pull/9120): eigsh documentation parameters +* [#9125](https://github.com/scipy/scipy/pull/9125): interpolative: correctly reconstruct full rank matrices +* [#9126](https://github.com/scipy/scipy/pull/9126): MAINT: Use warnings for unexpected peak properties +* [#9129](https://github.com/scipy/scipy/pull/9129): BUG: Do not catch and silence KeyboardInterrupt +* [#9131](https://github.com/scipy/scipy/pull/9131): DOC: Correct the typo in scipy.optimize tutorial page +* [#9133](https://github.com/scipy/scipy/pull/9133): FIX: Avoid use of bare except +* [#9134](https://github.com/scipy/scipy/pull/9134): DOC: Update of ‘return\_eigenvectors’ description +* [#9137](https://github.com/scipy/scipy/pull/9137): DOC: typo fixes for discrete Poisson tutorial +* [#9139](https://github.com/scipy/scipy/pull/9139): FIX: Doctest failure in optimize tutorial +* [#9143](https://github.com/scipy/scipy/pull/9143): DOC: missing sigma in Pearson r formula +* [#9145](https://github.com/scipy/scipy/pull/9145): MAINT: Refactor linear programming solvers +* [#9149](https://github.com/scipy/scipy/pull/9149): FIX: Make scipy.odr.ODR ifixx equal to its data.fix if given +* [#9156](https://github.com/scipy/scipy/pull/9156): DOC: special: Mention the sigmoid function in the expit docstring. +* [#9160](https://github.com/scipy/scipy/pull/9160): Fixed a latex delimiter error in levy() +* [#9170](https://github.com/scipy/scipy/pull/9170): DOC: correction / update of docstrings of distributions in scipy.stats +* [#9171](https://github.com/scipy/scipy/pull/9171): better description of the hierarchical clustering parameter +* [#9174](https://github.com/scipy/scipy/pull/9174): domain check for a < b in stats.truncnorm +* [#9175](https://github.com/scipy/scipy/pull/9175): DOC: Minor grammar fix +* [#9176](https://github.com/scipy/scipy/pull/9176): BUG: CloughTocher2DInterpolator: fix miscalculation at neighborless… +* [#9177](https://github.com/scipy/scipy/pull/9177): BUILD: Document the “clean” target in the doc/Makefile. +* [#9178](https://github.com/scipy/scipy/pull/9178): MAINT: make refguide-check more robust for printed numpy arrays +* [#9186](https://github.com/scipy/scipy/pull/9186): MAINT: Remove np.ediff1d occurence +* [#9188](https://github.com/scipy/scipy/pull/9188): DOC: correct typo in extending ndimage with C +* [#9190](https://github.com/scipy/scipy/pull/9190): ENH: Support specifying axes for fftconvolve +* [#9192](https://github.com/scipy/scipy/pull/9192): MAINT: optimize: fixed @pv style suggestions from #9112 +* [#9200](https://github.com/scipy/scipy/pull/9200): Fix make\_interp\_spline(…, k=0 or 1, axis<0) +* [#9201](https://github.com/scipy/scipy/pull/9201): BUG: sparse.linalg/gmres: use machine eps in breakdown check +* [#9204](https://github.com/scipy/scipy/pull/9204): MAINT: fix up stats.spearmanr and match mstats.spearmanr with… +* [#9206](https://github.com/scipy/scipy/pull/9206): MAINT: include benchmarks and dev files in sdist. +* [#9208](https://github.com/scipy/scipy/pull/9208): TST: signal: bump bsplines test tolerance for complex data +* [#9210](https://github.com/scipy/scipy/pull/9210): TST: mark tests as slow, fix missing random seed +* [#9211](https://github.com/scipy/scipy/pull/9211): ENH: add capability to specify orders in pade func +* [#9217](https://github.com/scipy/scipy/pull/9217): MAINT: Include `success` and `nit` in OptimizeResult returned… +* [#9222](https://github.com/scipy/scipy/pull/9222): ENH: interpolate: Use scipy.spatial.distance to speed-up Rbf +* [#9229](https://github.com/scipy/scipy/pull/9229): MNT: Fix Fourier filter double case +* [#9233](https://github.com/scipy/scipy/pull/9233): BUG: spatial/distance: fix pdist/cdist performance regression… +* [#9234](https://github.com/scipy/scipy/pull/9234): FIX: Proper suppression +* [#9235](https://github.com/scipy/scipy/pull/9235): BENCH: rationalize slow benchmarks + miscellaneous fixes +* [#9238](https://github.com/scipy/scipy/pull/9238): BENCH: limit number of parameter combinations in spatial.\*KDTree… +* [#9239](https://github.com/scipy/scipy/pull/9239): DOC: stats: Fix LaTeX markup of a couple distribution PDFs. +* [#9241](https://github.com/scipy/scipy/pull/9241): ENH: Evaluate plateau size during peak finding +* [#9242](https://github.com/scipy/scipy/pull/9242): ENH: stats: Implement \_ppf and \_logpdf for crystalball, and do… +* [#9246](https://github.com/scipy/scipy/pull/9246): DOC: Properly render versionadded directive in HTML documentation +* [#9255](https://github.com/scipy/scipy/pull/9255): DOC: mention RootResults in optimization reference guide +* [#9260](https://github.com/scipy/scipy/pull/9260): TST: relax some tolerances so tests pass with x87 math +* [#9264](https://github.com/scipy/scipy/pull/9264): TST Use assert\_raises “match” parameter instead of the “message”… +* [#9267](https://github.com/scipy/scipy/pull/9267): DOC: clarify expect() return val when moment is inf/nan +* [#9272](https://github.com/scipy/scipy/pull/9272): DOC: Add description of default bounds to linprog +* [#9277](https://github.com/scipy/scipy/pull/9277): MAINT: sparse/linalg: make test deterministic +* [#9278](https://github.com/scipy/scipy/pull/9278): MAINT: interpolate: pep8 cleanup in test\_polyint +* [#9279](https://github.com/scipy/scipy/pull/9279): Fixed docstring for resample +* [#9280](https://github.com/scipy/scipy/pull/9280): removed first check for float in get\_sum\_dtype +* [#9281](https://github.com/scipy/scipy/pull/9281): BUG: only accept 1d input for bartlett / levene in scipy.stats +* [#9282](https://github.com/scipy/scipy/pull/9282): MAINT: dense\_output and t\_eval are mutually exclusive inputs +* [#9283](https://github.com/scipy/scipy/pull/9283): MAINT: add docs and do some cleanups in interpolate.Rbf +* [#9288](https://github.com/scipy/scipy/pull/9288): Run distance\_transform\_edt tests on all types +* [#9294](https://github.com/scipy/scipy/pull/9294): DOC: fix the formula typo +* [#9298](https://github.com/scipy/scipy/pull/9298): MAINT: optimize/trust-constr: restore .niter attribute for backward-compat +* [#9299](https://github.com/scipy/scipy/pull/9299): DOC: clarification of default rvs method in scipy.stats +* [#9301](https://github.com/scipy/scipy/pull/9301): MAINT: removed unused import sys +* [#9302](https://github.com/scipy/scipy/pull/9302): MAINT: removed unused imports +* [#9303](https://github.com/scipy/scipy/pull/9303): DOC: signal: Refer to fs instead of nyq in the firwin docstring. +* [#9305](https://github.com/scipy/scipy/pull/9305): ENH: Added Yeo-Johnson power transformation +* [#9306](https://github.com/scipy/scipy/pull/9306): ENH - add dual annealing +* [#9309](https://github.com/scipy/scipy/pull/9309): ENH add the yulesimon distribution to scipy.stats +* [#9317](https://github.com/scipy/scipy/pull/9317): Nested SLSQP bug fix. +* [#9320](https://github.com/scipy/scipy/pull/9320): MAINT: stats: avoid underflow in stats.geom.ppf +* [#9326](https://github.com/scipy/scipy/pull/9326): Add example for Rosenbrock function +* [#9332](https://github.com/scipy/scipy/pull/9332): Sort file lists +* [#9340](https://github.com/scipy/scipy/pull/9340): Fix typo in find\_peaks documentation +* [#9343](https://github.com/scipy/scipy/pull/9343): MAINT Use np.full when possible +* [#9344](https://github.com/scipy/scipy/pull/9344): DOC: added examples to docstring of dirichlet class +* [#9346](https://github.com/scipy/scipy/pull/9346): DOC: Fix import of scipy.sparse.linalg in example (#9345) +* [#9350](https://github.com/scipy/scipy/pull/9350): Fix interpolate read only +* [#9351](https://github.com/scipy/scipy/pull/9351): MAINT: special.erf: use the x->-x symmetry +* [#9356](https://github.com/scipy/scipy/pull/9356): Fix documentation typo +* [#9358](https://github.com/scipy/scipy/pull/9358): DOC: improve doc for ksone and kstwobign in scipy.stats +* [#9362](https://github.com/scipy/scipy/pull/9362): DOC: Change datatypes of A matrices in linprog +* [#9364](https://github.com/scipy/scipy/pull/9364): MAINT: Adds implicit none to fftpack fortran sources +* [#9369](https://github.com/scipy/scipy/pull/9369): DOC: minor tweak to CoC (updated NumFOCUS contact address). +* [#9373](https://github.com/scipy/scipy/pull/9373): Fix exception if python is called with -OO option +* [#9374](https://github.com/scipy/scipy/pull/9374): FIX: AIX compilation issue with NAN and INFINITY +* [#9376](https://github.com/scipy/scipy/pull/9376): COBLYA -> COBYLA in docs +* [#9377](https://github.com/scipy/scipy/pull/9377): DOC: Add examples integrate: fixed\_quad and quadrature +* [#9379](https://github.com/scipy/scipy/pull/9379): MAINT: TST: Make tests NumPy 1.8 compatible +* [#9385](https://github.com/scipy/scipy/pull/9385): CI: On Travis matrix “OPTIMIZE=-OO” flag ignored +* [#9387](https://github.com/scipy/scipy/pull/9387): Fix defaut value for ‘mode’ in ‘ndimage.shift’ in the doc +* [#9392](https://github.com/scipy/scipy/pull/9392): BUG: rank has to be integer in rank\_filter: fixed issue 9388 +* [#9399](https://github.com/scipy/scipy/pull/9399): DOC: Misc. typos +* [#9400](https://github.com/scipy/scipy/pull/9400): TST: stats: Fix the expected r-value of a linregress test. +* [#9405](https://github.com/scipy/scipy/pull/9405): BUG: np.hstack does not accept generator expressions +* [#9408](https://github.com/scipy/scipy/pull/9408): ENH: linalg: Shorter ill-conditioned warning message +* [#9418](https://github.com/scipy/scipy/pull/9418): DOC: Fix ndimage docstrings and reduce doc build warnings +* [#9421](https://github.com/scipy/scipy/pull/9421): DOC: Add missing docstring examples in scipy.spatial +* [#9422](https://github.com/scipy/scipy/pull/9422): DOC: Add an example to integrate.newton\_cotes +* [#9427](https://github.com/scipy/scipy/pull/9427): BUG: Fixed defect with maxiter #9419 in dual annealing +* [#9431](https://github.com/scipy/scipy/pull/9431): BENCH: Add dual annealing to scipy benchmark (see #9415) +* [#9435](https://github.com/scipy/scipy/pull/9435): DOC: Add docstring examples for stats.binom\_test +* [#9443](https://github.com/scipy/scipy/pull/9443): DOC: Fix the order of indices in optimize tutorial +* [#9444](https://github.com/scipy/scipy/pull/9444): MAINT: interpolate: use operator.index for checking/coercing… +* [#9445](https://github.com/scipy/scipy/pull/9445): DOC: Added missing example to stats.mstats.kruskal +* [#9446](https://github.com/scipy/scipy/pull/9446): DOC: Add note about version changed for jaccard distance +* [#9447](https://github.com/scipy/scipy/pull/9447): BLD: version-script handling in setup.py +* [#9448](https://github.com/scipy/scipy/pull/9448): TST: skip a problematic linalg test +* [#9449](https://github.com/scipy/scipy/pull/9449): TST: fix missing seed in lobpcg test. +* [#9456](https://github.com/scipy/scipy/pull/9456): TST: test\_eigs\_consistency() now sorts output diff --git a/corpus/changelog/scipy_releases/scipy_121.md b/corpus/changelog/scipy_releases/scipy_121.md new file mode 100644 index 0000000000000000000000000000000000000000..38d535d6f06daa18ab0cba4d04014e5ee850409b --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_121.md @@ -0,0 +1,49 @@ +# SciPy 1.2.1 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.2.1-notes.html +Version: 1.2.1 + +Contents + +* [SciPy 1.2.1 Release Notes](#scipy-1-2-1-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.2.1](#issues-closed-for-1-2-1) + - [Pull requests for 1.2.1](#pull-requests-for-1-2-1) + +SciPy 1.2.1 is a bug-fix release with no new features compared to 1.2.0. +Most importantly, it solves the issue that 1.2.0 cannot be installed +from source on Python 2.7 because of non-ascii character issues. + +It is also notable that SciPy 1.2.1 wheels were built with OpenBLAS +0.3.5.dev, which may alleviate some linear algebra issues observed +in SciPy 1.2.0. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Eric Larson +* Mark Mikofski +* Evgeni Burovski +* Ralf Gommers +* Eric Moore +* Tyler Reddy + +### [Issues closed for 1.2.1](#id3)[#](#issues-closed-for-1-2-1 "Link to this heading") + +* [#9606](https://github.com/scipy/scipy/issues/9606): SyntaxError: Non-ASCII character ‘xe2’ in file scipy/stats/\_continuous\_distns.py on line 3346, but no encoding declared +* [#9608](https://github.com/scipy/scipy/issues/9608): Version 1.2.0 introduces *too many indices for array* error in… +* [#9709](https://github.com/scipy/scipy/issues/9709): scipy.stats.gaussian\_kde normalizes the weights keyword argument… +* [#9733](https://github.com/scipy/scipy/issues/9733): scipy.linalg.qr\_update gives NaN result +* [#9724](https://github.com/scipy/scipy/issues/9724): CI: Is scipy.scipy Windows Python36-32bit-full working? + +### [Pull requests for 1.2.1](#id4)[#](#pull-requests-for-1-2-1 "Link to this heading") + +* [#9612](https://github.com/scipy/scipy/pull/9612): BUG: don’t use array newton unless size is greater than 1 +* [#9615](https://github.com/scipy/scipy/pull/9615): ENH: Add test for encoding +* [#9720](https://github.com/scipy/scipy/pull/9720): BUG: stats: weighted KDE does not modify the weights array +* [#9739](https://github.com/scipy/scipy/pull/9739): BUG: qr\_updates fails if u is exactly in span Q +* [#9725](https://github.com/scipy/scipy/pull/9725): TST: pin mingw for Azure Win CI +* [#9736](https://github.com/scipy/scipy/pull/9736): TST: adjust to vmImage dispatch in Azure +* [#9681](https://github.com/scipy/scipy/pull/9681): BUG: Fix failing stats tests (partial backport) +* [#9662](https://github.com/scipy/scipy/pull/9662): TST: interpolate: avoid pytest deprecations diff --git a/corpus/changelog/scipy_releases/scipy_122.md b/corpus/changelog/scipy_releases/scipy_122.md new file mode 100644 index 0000000000000000000000000000000000000000..2b9f4ee1fa94783539bd8aaef326b2ee94ac80e0 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_122.md @@ -0,0 +1,46 @@ +# SciPy 1.2.2 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.2.2-notes.html +Version: 1.2.2 + +Contents + +* [SciPy 1.2.2 Release Notes](#scipy-1-2-2-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.2.2](#issues-closed-for-1-2-2) + - [Pull requests for 1.2.2](#pull-requests-for-1-2-2) + +SciPy 1.2.2 is a bug-fix release with no new features compared to 1.2.1. +Importantly, the SciPy 1.2.2 wheels are built with OpenBLAS 0.3.7.dev to +alleviate issues with SkylakeX AVX512 kernels. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* CJ Carey +* Tyler Dawson + +* Ralf Gommers +* Kai Striega +* Andrew Nelson +* Tyler Reddy +* Kevin Sheppard + + +A total of 7 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.2.2](#id3)[#](#issues-closed-for-1-2-2 "Link to this heading") + +* [#9611](https://github.com/scipy/scipy/issues/9611): Overflow error with new way of p-value calculation in kendall tau correlation for perfectly monotonic vectors +* [#9964](https://github.com/scipy/scipy/issues/9964): optimize.newton : overwrites x0 argument when it is a numpy array +* [#9784](https://github.com/scipy/scipy/issues/9784): TST: Minimum NumPy version is not being CI tested +* [#10132](https://github.com/scipy/scipy/issues/10132): Docs: Description of nnz attribute of sparse.csc\_matrix misleading + +### [Pull requests for 1.2.2](#id4)[#](#pull-requests-for-1-2-2 "Link to this heading") + +* [#10056](https://github.com/scipy/scipy/pull/10056): BUG: Ensure factorial is not too large in kendaltau +* [#9991](https://github.com/scipy/scipy/pull/9991): BUG: Avoid inplace modification of input array in newton +* [#9788](https://github.com/scipy/scipy/pull/9788): TST, BUG: f2py-related issues with NumPy < 1.14.0 +* [#9749](https://github.com/scipy/scipy/pull/9749): BUG: MapWrapper.\_\_exit\_\_ should terminate +* [#10141](https://github.com/scipy/scipy/pull/10141): Update description for nnz on csc.py diff --git a/corpus/changelog/scipy_releases/scipy_123.md b/corpus/changelog/scipy_releases/scipy_123.md new file mode 100644 index 0000000000000000000000000000000000000000..507f95022754c8938f745ae8b691825140c446c4 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_123.md @@ -0,0 +1,68 @@ +# SciPy 1.2.3 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.2.3-notes.html +Version: 1.2.3 + +Contents + +* [SciPy 1.2.3 Release Notes](#scipy-1-2-3-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.2.3](#issues-closed-for-1-2-3) + - [Pull requests for 1.2.3](#pull-requests-for-1-2-3) + +SciPy 1.2.3 is a bug-fix release with no new features compared to 1.2.2. It is +part of the long-term support (LTS) release series for Python 2.7. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Geordie McBain +* Matt Haberland +* David Hagen +* Tyler Reddy +* Pauli Virtanen +* Eric Larson +* Yu Feng +* ananyashreyjain +* Nikolay Mayorov +* Evgeni Burovski +* Warren Weckesser + +### [Issues closed for 1.2.3](#id3)[#](#issues-closed-for-1-2-3 "Link to this heading") + +* [#4915](https://github.com/scipy/scipy/issues/4915): Bug in unique\_roots in scipy.signal.signaltools.py for roots with same magnitude +* [#5546](https://github.com/scipy/scipy/issues/5546): ValueError raised if scipy.sparse.linalg.expm recieves array larger than 200x200 +* [#7117](https://github.com/scipy/scipy/issues/7117): Warn users when using float32 input data to curve\_fit and friends +* [#7906](https://github.com/scipy/scipy/issues/7906): Wrong result from scipy.interpolate.UnivariateSpline.integral for out-of-bounds +* [#9581](https://github.com/scipy/scipy/issues/9581): Least-squares minimization fails silently when x and y data are different types +* [#9901](https://github.com/scipy/scipy/issues/9901): lsoda fails to detect stiff problem when called from solve\_ivp +* [#9988](https://github.com/scipy/scipy/issues/9988): doc build broken with Sphinx 2.0.0 +* [#10303](https://github.com/scipy/scipy/issues/10303): BUG: optimize: *linprog* failing TestLinprogSimplexBland::test\_unbounded\_below\_no\_presolve\_corrected +* [#10376](https://github.com/scipy/scipy/issues/10376): TST: Travis CI fails (with pytest 5.0 ?) +* [#10384](https://github.com/scipy/scipy/issues/10384): CircleCI doc build failing on new warnings +* [#10535](https://github.com/scipy/scipy/issues/10535): TST: master branch CI failures +* [#11121](https://github.com/scipy/scipy/issues/11121): Calls to [`scipy.interpolate.splprep`](../reference/generated/scipy.interpolate.splprep.html#scipy.interpolate.splprep "scipy.interpolate.splprep") increase RAM usage. +* [#11198](https://github.com/scipy/scipy/issues/11198): BUG: sparse eigs (arpack) shift-invert drops the smallest eigenvalue for some k +* [#11266](https://github.com/scipy/scipy/issues/11266): Sparse matrix constructor data type detection changes on Numpy 1.18.0 + +### [Pull requests for 1.2.3](#id4)[#](#pull-requests-for-1-2-3 "Link to this heading") + +* [#9992](https://github.com/scipy/scipy/pull/9992): MAINT: Undo Sphinx pin +* [#10071](https://github.com/scipy/scipy/pull/10071): DOC: reconstruct SuperLU permutation matrices avoiding SparseEfficiencyWarning +* [#10076](https://github.com/scipy/scipy/pull/10076): BUG: optimize: fix curve\_fit for mixed float32/float64 input +* [#10138](https://github.com/scipy/scipy/pull/10138): BUG: special: Invalid arguments to ellip\_harm can crash Python. +* [#10306](https://github.com/scipy/scipy/pull/10306): BUG: optimize: Fix for 10303 +* [#10309](https://github.com/scipy/scipy/pull/10309): BUG: Pass jac=None directly to lsoda +* [#10377](https://github.com/scipy/scipy/pull/10377): TST, MAINT: adjustments for pytest 5.0 +* [#10379](https://github.com/scipy/scipy/pull/10379): BUG: sparse: set writeability to be forward-compatible with numpy>=1.17 +* [#10426](https://github.com/scipy/scipy/pull/10426): MAINT: Fix doc build bugs +* [#10540](https://github.com/scipy/scipy/pull/10540): MAINT: Fix Travis and Circle +* [#10633](https://github.com/scipy/scipy/pull/10633): BUG: interpolate: integral(a, b) should be zero when both limits are outside of the interpolation range +* [#10833](https://github.com/scipy/scipy/pull/10833): BUG: Fix subspace\_angles for complex values +* [#10882](https://github.com/scipy/scipy/pull/10882): BUG: sparse/arpack: fix incorrect code for complex hermitian M +* [#10906](https://github.com/scipy/scipy/pull/10906): BUG: sparse/linalg: fix expm for np.matrix inputs +* [#10961](https://github.com/scipy/scipy/pull/10961): BUG: Fix signal.unique\_roots +* [#11126](https://github.com/scipy/scipy/pull/11126): BUG: interpolate/fitpack: fix memory leak in splprep +* [#11199](https://github.com/scipy/scipy/pull/11199): BUG: sparse.linalg: mistake in unsymm. real shift-invert ARPACK eigenvalue selection +* [#11269](https://github.com/scipy/scipy/pull/11269): Fix: Sparse matrix constructor data type detection changes on Numpy 1.18.0 diff --git a/corpus/changelog/scipy_releases/scipy_130.md b/corpus/changelog/scipy_releases/scipy_130.md new file mode 100644 index 0000000000000000000000000000000000000000..691f3d6f73a552fe08fe1b012f86dbb5d31eba7d --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_130.md @@ -0,0 +1,614 @@ +# SciPy 1.3.0 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.3.0-notes.html +Version: 1.3.0 + +Contents + +* [SciPy 1.3.0 Release Notes](#scipy-1-3-0-release-notes) + + + [Highlights of this release](#highlights-of-this-release) + + [New features](#new-features) + + - [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#scipy-interpolate-improvements) + - [[`scipy.io`](../reference/io.html#module-scipy.io "scipy.io") improvements](#scipy-io-improvements) + - [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#scipy-linalg-improvements) + - [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#scipy-ndimage-improvements) + - [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#scipy-optimize-improvements) + - [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#scipy-signal-improvements) + - [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#scipy-sparse-improvements) + - [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#scipy-spatial-improvements) + - [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#scipy-stats-improvements) + + [Backwards-incompatible changes](#backwards-incompatible-changes) + + - [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") changes](#scipy-interpolate-changes) + - [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") changes](#scipy-linalg-changes) + - [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") changes](#scipy-optimize-changes) + - [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") changes](#scipy-stats-changes) + + [Other changes](#other-changes) + + [Authors](#authors) + + - [Issues closed for 1.3.0](#issues-closed-for-1-3-0) + - [Pull requests for 1.3.0](#pull-requests-for-1-3-0) + +SciPy 1.3.0 is the culmination of 5 months of hard work. It contains +many new features, numerous bug-fixes, improved test coverage and better +documentation. There have been some API changes +in this release, which are documented below. All users are encouraged to +upgrade to this release, as there are a large number of bug-fixes and +optimizations. Before upgrading, we recommend that users check that +their own code does not use deprecated SciPy functionality (to do so, +run your code with `python -Wd` and check for `DeprecationWarning` s). +Our development attention will now shift to bug-fix releases on the +1.3.x branch, and on adding new features on the master branch. + +This release requires Python 3.5+ and NumPy 1.13.3 or greater. + +For running on PyPy, PyPy3 6.0+ and NumPy 1.15.0 are required. + +## [Highlights of this release](#id2)[#](#highlights-of-this-release "Link to this heading") + +* Three new `stats` functions, a rewrite of `pearsonr`, and an exact + computation of the Kolmogorov-Smirnov two-sample test. +* A new Cython API for bounded scalar-function root-finders in [`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize"). +* Substantial `CSR` and `CSC` sparse matrix indexing performance + improvements. +* Added support for interpolation of rotations with continuous angular + rate and acceleration in `RotationSpline`. + +## [New features](#id3)[#](#new-features "Link to this heading") + +### [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#id4)[#](#scipy-interpolate-improvements "Link to this heading") + +A new class `CubicHermiteSpline` is introduced. It is a piecewise-cubic +interpolator which matches observed values and first derivatives. Existing +cubic interpolators `CubicSpline`, `PchipInterpolator` and +`Akima1DInterpolator` were made subclasses of `CubicHermiteSpline`. + +### [[`scipy.io`](../reference/io.html#module-scipy.io "scipy.io") improvements](#id5)[#](#scipy-io-improvements "Link to this heading") + +For the Attribute-Relation File Format (ARFF) [`scipy.io.arff.loadarff`](../reference/generated/scipy.io.arff.loadarff.html#scipy.io.arff.loadarff "scipy.io.arff.loadarff") +now supports relational attributes. + +[`scipy.io.mmread`](../reference/generated/scipy.io.mmread.html#scipy.io.mmread "scipy.io.mmread") can now parse Matrix Market format files with empty lines. + +### [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#id6)[#](#scipy-linalg-improvements "Link to this heading") + +Added wrappers for `?syconv` routines, which convert a symmetric matrix +given by a triangular matrix factorization into two matrices and vice versa. + +[`scipy.linalg.clarkson_woodruff_transform`](../reference/generated/scipy.linalg.clarkson_woodruff_transform.html#scipy.linalg.clarkson_woodruff_transform "scipy.linalg.clarkson_woodruff_transform") now uses an algorithm that leverages +sparsity. This may provide a 60-90 percent speedup for dense input matrices. +Truly sparse input matrices should also benefit from the improved sketch +algorithm, which now correctly runs in `O(nnz(A))` time. + +Added new functions to calculate symmetric Fiedler matrices and +Fiedler companion matrices, named [`scipy.linalg.fiedler`](../reference/generated/scipy.linalg.fiedler.html#scipy.linalg.fiedler "scipy.linalg.fiedler") and +[`scipy.linalg.fiedler_companion`](../reference/generated/scipy.linalg.fiedler_companion.html#scipy.linalg.fiedler_companion "scipy.linalg.fiedler_companion"), respectively. These may be used +for root finding. + +### [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#id7)[#](#scipy-ndimage-improvements "Link to this heading") + +Gaussian filter performances may improve by an order of magnitude in +some cases, thanks to the removal of a dependence on `np.polynomial`. This +may impact [`scipy.ndimage.gaussian_filter`](../reference/generated/scipy.ndimage.gaussian_filter.html#scipy.ndimage.gaussian_filter "scipy.ndimage.gaussian_filter") for example. + +### [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#id8)[#](#scipy-optimize-improvements "Link to this heading") + +The [`scipy.optimize.brute`](../reference/generated/scipy.optimize.brute.html#scipy.optimize.brute "scipy.optimize.brute") minimizer obtained a new keyword `workers`, which +can be used to parallelize computation. + +A Cython API for bounded scalar-function root-finders in [`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") +is available in a new module [`scipy.optimize.cython_optimize`](../reference/optimize.cython_optimize.html#module-scipy.optimize.cython_optimize "scipy.optimize.cython_optimize") via `cimport`. +This API may be used with `nogil` and `prange` to loop +over an array of function arguments to solve for an array of roots more +quickly than with pure Python. + +`'interior-point'` is now the default method for `linprog`, and +`'interior-point'` now uses SuiteSparse for sparse problems when the +required scikits (scikit-umfpack and scikit-sparse) are available. +On benchmark problems (gh-10026), execution time reductions by factors of 2-3 +were typical. Also, a new `method='revised simplex'` has been added. +It is not as fast or robust as `method='interior-point'`, but it is a faster, +more robust, and equally accurate substitute for the legacy +`method='simplex'`. + +`differential_evolution` can now use a `Bounds` class to specify the +bounds for the optimizing argument of a function. + +[`scipy.optimize.dual_annealing`](../reference/generated/scipy.optimize.dual_annealing.html#scipy.optimize.dual_annealing "scipy.optimize.dual_annealing") performance improvements related to +vectorization of some internal code. + +### [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#id9)[#](#scipy-signal-improvements "Link to this heading") + +Two additional methods of discretization are now supported by +[`scipy.signal.cont2discrete`](../reference/generated/scipy.signal.cont2discrete.html#scipy.signal.cont2discrete "scipy.signal.cont2discrete"): `impulse` and `foh`. + +[`scipy.signal.firls`](../reference/generated/scipy.signal.firls.html#scipy.signal.firls "scipy.signal.firls") now uses faster solvers. + +[`scipy.signal.detrend`](../reference/generated/scipy.signal.detrend.html#scipy.signal.detrend "scipy.signal.detrend") now has a lower physical memory footprint in some +cases, which may be leveraged using the new `overwrite_data` keyword argument. + +[`scipy.signal.firwin`](../reference/generated/scipy.signal.firwin.html#scipy.signal.firwin "scipy.signal.firwin") `pass_zero` argument now accepts new string arguments +that allow specification of the desired filter type: `'bandpass'`, +`'lowpass'`, `'highpass'`, and `'bandstop'`. + +[`scipy.signal.sosfilt`](../reference/generated/scipy.signal.sosfilt.html#scipy.signal.sosfilt "scipy.signal.sosfilt") may have improved performance due to lower retention +of the global interpreter lock (GIL) in the algorithm. + +### [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#id10)[#](#scipy-sparse-improvements "Link to this heading") + +A new keyword was added to `csgraph.dijsktra` that +allows users to query the shortest path to ANY of the passed-in indices, +as opposed to the shortest path to EVERY passed index. + +[`scipy.sparse.linalg.lsmr`](../reference/generated/scipy.sparse.linalg.lsmr.html#scipy.sparse.linalg.lsmr "scipy.sparse.linalg.lsmr") performance has been improved by roughly 10 percent +on large problems. + +Improved performance and reduced physical memory footprint of the algorithm +used by [`scipy.sparse.linalg.lobpcg`](../reference/generated/scipy.sparse.linalg.lobpcg.html#scipy.sparse.linalg.lobpcg "scipy.sparse.linalg.lobpcg"). + +`CSR` and `CSC` sparse matrix fancy indexing performance has been +improved substantially. + +### [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#id11)[#](#scipy-spatial-improvements "Link to this heading") + +[`scipy.spatial.ConvexHull`](../reference/generated/scipy.spatial.ConvexHull.html#scipy.spatial.ConvexHull "scipy.spatial.ConvexHull") now has a `good` attribute that can be used +alongside the `QGn` Qhull options to determine which external facets of a +convex hull are visible from an external query point. + +[`scipy.spatial.cKDTree.query_ball_point`](../reference/generated/scipy.spatial.cKDTree.query_ball_point.html#scipy.spatial.cKDTree.query_ball_point "scipy.spatial.cKDTree.query_ball_point") has been modernized to use some newer +Cython features, including GIL handling and exception translation. An issue +with `return_sorted=True` and scalar queries was fixed, and a new mode named +`return_length` was added. `return_length` only computes the length of the +returned indices list instead of allocating the array every time. + +[`scipy.spatial.transform.RotationSpline`](../reference/generated/scipy.spatial.transform.RotationSpline.html#scipy.spatial.transform.RotationSpline "scipy.spatial.transform.RotationSpline") has been added to enable interpolation +of rotations with continuous angular rates and acceleration. + +### [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#id12)[#](#scipy-stats-improvements "Link to this heading") + +Added a new function to compute the Epps-Singleton test statistic, +[`scipy.stats.epps_singleton_2samp`](../reference/generated/scipy.stats.epps_singleton_2samp.html#scipy.stats.epps_singleton_2samp "scipy.stats.epps_singleton_2samp"), which can be applied to continuous and +discrete distributions. + +New functions *scipy.stats.median\_absolute\_deviation* and [`scipy.stats.gstd`](../reference/generated/scipy.stats.gstd.html#scipy.stats.gstd "scipy.stats.gstd") +(geometric standard deviation) were added. The [`scipy.stats.combine_pvalues`](../reference/generated/scipy.stats.combine_pvalues.html#scipy.stats.combine_pvalues "scipy.stats.combine_pvalues") +method now supports `pearson`, `tippett` and `mudholkar_george` pvalue +combination methods. + +The [`scipy.stats.ortho_group`](../reference/generated/scipy.stats.ortho_group.html#scipy.stats.ortho_group "scipy.stats.ortho_group") and [`scipy.stats.special_ortho_group`](../reference/generated/scipy.stats.special_ortho_group.html#scipy.stats.special_ortho_group "scipy.stats.special_ortho_group") +`rvs(dim)` functions’ algorithms were updated from a `O(dim^4)` +implementation to a `O(dim^3)` which gives large speed improvements +for `dim>100`. + +A rewrite of [`scipy.stats.pearsonr`](../reference/generated/scipy.stats.pearsonr.html#scipy.stats.pearsonr "scipy.stats.pearsonr") to use a more robust algorithm, +provide meaningful exceptions and warnings on potentially pathological input, +and fix at least five separate reported issues in the original implementation. + +Improved the precision of `hypergeom.logcdf` and `hypergeom.logsf`. + +Added exact computation for Kolmogorov-Smirnov (KS) two-sample test, replacing +the previously approximate computation for the two-sided test *stats.ks\_2samp*. +Also added a one-sided, two-sample KS test, and a keyword `alternative` to +*stats.ks\_2samp*. + +## [Backwards-incompatible changes](#id13)[#](#backwards-incompatible-changes "Link to this heading") + +### [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") changes](#id14)[#](#scipy-interpolate-changes "Link to this heading") + +Functions from `scipy.interpolate` (`spleval`, `spline`, `splmake`, +and `spltopp`) and functions from `scipy.misc` (`bytescale`, +`fromimage`, `imfilter`, `imread`, `imresize`, `imrotate`, +`imsave`, `imshow`, `toimage`) have been removed. The former set has +been deprecated since v0.19.0 and the latter has been deprecated since v1.0.0. +Similarly, aliases from `scipy.misc` (`comb`, `factorial`, +`factorial2`, `factorialk`, `logsumexp`, `pade`, `info`, `source`, +`who`) which have been deprecated since v1.0.0 are removed. +[SciPy documentation for +v1.1.0](https://docs.scipy.org/doc/scipy-1.1.0/reference/misc.html) +can be used to track the new import locations for the relocated functions. + +### [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") changes](#id15)[#](#scipy-linalg-changes "Link to this heading") + +For `pinv`, `pinv2`, and `pinvh`, the default cutoff values are changed +for consistency (see the docs for the actual values). + +### [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") changes](#id16)[#](#scipy-optimize-changes "Link to this heading") + +The default method for `linprog` is now `'interior-point'`. The method’s +robustness and speed come at a cost: solutions may not be accurate to +machine precision or correspond with a vertex of the polytope defined +by the constraints. To revert to the original simplex method, +include the argument `method='simplex'`. + +### [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") changes](#id17)[#](#scipy-stats-changes "Link to this heading") + +Previously, `ks_2samp(data1, data2)` would run a two-sided test and return +the approximated p-value. The new signature, `ks_2samp(data1, data2, +alternative="two-sided", method="auto")`, still runs the two-sided test by +default but returns the exact p-value for small samples and the approximated +value for large samples. `method="asymp"` would be equivalent to the +old version but `auto` is the better choice. + +## [Other changes](#id18)[#](#other-changes "Link to this heading") + +Our tutorial has been expanded with a new section on global optimizers. + +There has been a rework of the `stats.distributions` tutorials. + +[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") now correctly sets the convergence flag of the result to +`CONVERR`, a convergence error, for bounded scalar-function root-finders +if the maximum iterations has been exceeded, `disp` is false, and +`full_output` is true. + +[`scipy.optimize.curve_fit`](../reference/generated/scipy.optimize.curve_fit.html#scipy.optimize.curve_fit "scipy.optimize.curve_fit") no longer fails if `xdata` and `ydata` dtypes +differ; they are both now automatically cast to `float64`. + +[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") functions including `binary_erosion`, `binary_closing`, and +`binary_dilation` now require an integer value for the number of iterations, +which alleviates a number of reported issues. + +Fixed normal approximation in case `zero_method == "pratt"` in +[`scipy.stats.wilcoxon`](../reference/generated/scipy.stats.wilcoxon.html#scipy.stats.wilcoxon "scipy.stats.wilcoxon"). + +Fixes for incorrect probabilities, broadcasting issues and thread-safety +related to stats distributions setting member variables inside `_argcheck()`. + +[`scipy.optimize.newton`](../reference/generated/scipy.optimize.newton.html#scipy.optimize.newton "scipy.optimize.newton") now correctly raises a `RuntimeError` in the following cases: when default +arguments are used and if a derivative of value zero is obtained (which is a special case of failing to converge). + +A draft toolchain roadmap is now available, laying out a compatibility plan +including Python versions, C standards, and NumPy versions. + +## [Authors](#id19)[#](#authors "Link to this heading") + +* ananyashreyjain + +* ApamNapat + +* Scott Calabrese Barton + +* Christoph Baumgarten +* Peter Bell + +* Jacob Blomgren + +* Doctor Bob + +* Mana Borwornpadungkitti + +* Matthew Brett +* Evgeni Burovski +* CJ Carey +* Vega Theil Carstensen + +* Robert Cimrman +* Forrest Collman + +* Pietro Cottone + +* David + +* Idan David + +* Christoph Deil +* Dieter Werthmüller +* Conner DiPaolo + +* Dowon +* Michael Dunphy + +* Peter Andreas Entschev + +* Gökçen Eraslan + +* Johann Faouzi + +* Yu Feng +* Piotr Figiel + +* Matthew H Flamm +* Franz Forstmayr + +* Christoph Gohlke +* Richard Janis Goldschmidt + +* Ralf Gommers +* Lars Grueter +* Sylvain Gubian +* Matt Haberland +* Yaroslav Halchenko +* Charles Harris +* Lindsey Hiltner +* JakobStruye + +* He Jia + +* Jwink3101 + +* Greg Kiar + +* Julius Bier Kirkegaard +* John Kirkham + +* Thomas Kluyver +* Vladimir Korolev + +* Joseph Kuo + +* Michael Lamparski + +* Eric Larson +* Denis Laxalde +* Katrin Leinweber +* Jesse Livezey +* ludcila + +* Dhruv Madeka + +* Magnus + +* Nikolay Mayorov +* Mark Mikofski +* Jarrod Millman +* Markus Mohrhard + +* Eric Moore +* Andrew Nelson +* Aki Nishimura + +* OGordon100 + +* Petar Mlinarić + +* Stefan Peterson +* Matti Picus + +* Ilhan Polat +* Aaron Pries + +* Matteo Ravasi + +* Tyler Reddy +* Ashton Reimer + +* Joscha Reimer +* rfezzani + +* Riadh + +* Lucas Roberts +* Heshy Roskes + +* Mirko Scholz + +* Taylor D. Scott + +* Srikrishna Sekhar + +* Kevin Sheppard + +* Sourav Singh +* skjerns + +* Kai Striega +* SyedSaifAliAlvi + +* Gopi Manohar T + +* Albert Thomas + +* Timon + +* Paul van Mulbregt +* Jacob Vanderplas +* Daniel Vargas + +* Pauli Virtanen +* VNMabus + +* Stefan van der Walt +* Warren Weckesser +* Josh Wilson +* Nate Yoder + +* Roman Yurchak + +A total of 97 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.3.0](#id20)[#](#issues-closed-for-1-3-0 "Link to this heading") + +* [#1320](https://github.com/scipy/scipy/issues/1320): scipy.stats.distribution: problem with self.a, self.b if they… +* [#2002](https://github.com/scipy/scipy/issues/2002): members set in scipy.stats.distributions.##.\_argcheck (Trac #1477) +* [#2823](https://github.com/scipy/scipy/issues/2823): distribution methods add tmp +* [#3220](https://github.com/scipy/scipy/issues/3220): Scipy.opimize.fmin\_powell direc argument syntax unclear +* [#3728](https://github.com/scipy/scipy/issues/3728): scipy.stats.pearsonr: possible bug with zero variance input +* [#6805](https://github.com/scipy/scipy/issues/6805): error-in-scipy-wilcoxon-signed-rank-test-for-equal-series +* [#6873](https://github.com/scipy/scipy/issues/6873): ‘stats.boxcox’ return all same values +* [#7117](https://github.com/scipy/scipy/issues/7117): Warn users when using float32 input data to curve\_fit and friends +* [#7632](https://github.com/scipy/scipy/issues/7632): it’s not possible to tell the `optimize.least\_squares` solver… +* [#7730](https://github.com/scipy/scipy/issues/7730): stats.pearsonr: Potential division by zero for dataset of length… +* [#7933](https://github.com/scipy/scipy/issues/7933): stats.truncnorm fails when providing values outside truncation… +* [#8033](https://github.com/scipy/scipy/issues/8033): Add standard filter types to firwin to set pass\_zero intuitively… +* [#8600](https://github.com/scipy/scipy/issues/8600): lfilter.c.src zfill has erroneous header +* [#8692](https://github.com/scipy/scipy/issues/8692): Non-negative values of `stats.hypergeom.logcdf` +* [#8734](https://github.com/scipy/scipy/issues/8734): Enable pip build isolation +* [#8861](https://github.com/scipy/scipy/issues/8861): scipy.linalg.pinv gives wrong result while scipy.linalg.pinv2… +* [#8915](https://github.com/scipy/scipy/issues/8915): need to fix macOS build against older numpy versions +* [#8980](https://github.com/scipy/scipy/issues/8980): scipy.stats.pearsonr overflows with high values of x and y +* [#9226](https://github.com/scipy/scipy/issues/9226): BUG: signal: SystemError: … +* [#9254](https://github.com/scipy/scipy/issues/9254): BUG: root finders brentq, etc, flag says “converged” even if… +* [#9308](https://github.com/scipy/scipy/issues/9308): Test failure - test\_initial\_constraints\_as\_canonical +* [#9353](https://github.com/scipy/scipy/issues/9353): scipy.stats.pearsonr returns r=1 if r\_num/r\_den = inf +* [#9359](https://github.com/scipy/scipy/issues/9359): Planck distribution is a geometric distribution +* [#9381](https://github.com/scipy/scipy/issues/9381): linregress should warn user in 2x2 array case +* [#9406](https://github.com/scipy/scipy/issues/9406): BUG: stats: In pearsonr, when r is nan, the p-value must also… +* [#9437](https://github.com/scipy/scipy/issues/9437): Cannot create sparse matrix from size\_t indexes +* [#9518](https://github.com/scipy/scipy/issues/9518): Relational attributes in loadarff +* [#9551](https://github.com/scipy/scipy/issues/9551): BUG: scipy.optimize.newton says the root of x^2+1 is zero. +* [#9564](https://github.com/scipy/scipy/issues/9564): rv\_sample accepts invalid input in scipy.stats +* [#9565](https://github.com/scipy/scipy/issues/9565): improper handling of multidimensional input in stats.rv\_sample +* [#9581](https://github.com/scipy/scipy/issues/9581): Least-squares minimization fails silently when x and y data are… +* [#9587](https://github.com/scipy/scipy/issues/9587): Outdated value for scipy.constants.au +* [#9611](https://github.com/scipy/scipy/issues/9611): Overflow error with new way of p-value calculation in kendall… +* [#9645](https://github.com/scipy/scipy/issues/9645): `scipy.stats.mode` crashes with variable length arrays (`dtype=object`) +* [#9734](https://github.com/scipy/scipy/issues/9734): PendingDeprecationWarning for np.matrix with pytest +* [#9786](https://github.com/scipy/scipy/issues/9786): stats.ks\_2samp() misleading for small data sets. +* [#9790](https://github.com/scipy/scipy/issues/9790): Excessive memory usage on detrend +* [#9801](https://github.com/scipy/scipy/issues/9801): dual\_annealing does not set the success attribute in OptimizeResult +* [#9833](https://github.com/scipy/scipy/issues/9833): IntegrationWarning from mielke.stats() during build of html doc. +* [#9835](https://github.com/scipy/scipy/issues/9835): scipy.signal.firls seems to be inefficient versus MATLAB firls +* [#9864](https://github.com/scipy/scipy/issues/9864): Curve\_fit does not check for empty input data if called with… +* [#9869](https://github.com/scipy/scipy/issues/9869): scipy.ndimage.label: Minor documentation issue +* [#9882](https://github.com/scipy/scipy/issues/9882): format at the wrong paranthesis in scipy.spatial.transform +* [#9889](https://github.com/scipy/scipy/issues/9889): scipy.signal.find\_peaks minor documentation issue +* [#9890](https://github.com/scipy/scipy/issues/9890): Minkowski p-norm Issues in cKDTree For Values Other Than 2 Or… +* [#9896](https://github.com/scipy/scipy/issues/9896): scipy.stats.\_argcheck sets (not just checks) values +* [#9905](https://github.com/scipy/scipy/issues/9905): Memory error in ndimage.binary\_erosion +* [#9909](https://github.com/scipy/scipy/issues/9909): binary\_dilation/erosion/closing crashes when iterations is float +* [#9919](https://github.com/scipy/scipy/issues/9919): BUG: `coo\_matrix` does not validate the `shape` argument. +* [#9982](https://github.com/scipy/scipy/issues/9982): lsq\_linear hangs/infinite loop with ‘trf’ method +* [#10003](https://github.com/scipy/scipy/issues/10003): exponnorm.pdf returns NAN for small K +* [#10011](https://github.com/scipy/scipy/issues/10011): Incorrect check for invalid rotation plane in scipy.ndimage.rotate +* [#10024](https://github.com/scipy/scipy/issues/10024): Fails to build from git +* [#10048](https://github.com/scipy/scipy/issues/10048): DOC: scipy.optimize.root\_scalar +* [#10068](https://github.com/scipy/scipy/issues/10068): DOC: scipy.interpolate.splev +* [#10074](https://github.com/scipy/scipy/issues/10074): BUG: `expm` calculates the wrong coefficients in the backward… + +### [Pull requests for 1.3.0](#id21)[#](#pull-requests-for-1-3-0 "Link to this heading") + +* [#7827](https://github.com/scipy/scipy/pull/7827): ENH: sparse: overhaul of sparse matrix indexing +* [#8431](https://github.com/scipy/scipy/pull/8431): ENH: Cython optimize zeros api +* [#8743](https://github.com/scipy/scipy/pull/8743): DOC: Updated linalg.pinv, .pinv2, .pinvh docstrings +* [#8744](https://github.com/scipy/scipy/pull/8744): DOC: added examples to remez docstring +* [#9227](https://github.com/scipy/scipy/pull/9227): DOC: update description of “direc” parameter of “fmin\_powell” +* [#9263](https://github.com/scipy/scipy/pull/9263): ENH: optimize: added “revised simplex” for scipy.optimize.linprog +* [#9325](https://github.com/scipy/scipy/pull/9325): DEP: Remove deprecated functions for 1.3.0 +* [#9330](https://github.com/scipy/scipy/pull/9330): Add note on push and pull affine transformations +* [#9423](https://github.com/scipy/scipy/pull/9423): DOC: Clearly state how 2x2 input arrays are handled in stats.linregress +* [#9428](https://github.com/scipy/scipy/pull/9428): ENH: parallelised brute +* [#9438](https://github.com/scipy/scipy/pull/9438): BUG: Initialize coo matrix with size\_t indexes +* [#9455](https://github.com/scipy/scipy/pull/9455): MAINT: Speed up get\_(lapack,blas)\_func +* [#9465](https://github.com/scipy/scipy/pull/9465): MAINT: Clean up optimize.zeros C solvers interfaces/code. +* [#9477](https://github.com/scipy/scipy/pull/9477): DOC: linalg: fix lstsq docstring on residues shape +* [#9478](https://github.com/scipy/scipy/pull/9478): DOC: Add docstring examples for rosen functions +* [#9479](https://github.com/scipy/scipy/pull/9479): DOC: Add docstring example for ai\_zeros and bi\_zeros +* [#9480](https://github.com/scipy/scipy/pull/9480): MAINT: linalg: lstsq clean up +* [#9489](https://github.com/scipy/scipy/pull/9489): DOC: roadmap update for changes over the last year. +* [#9492](https://github.com/scipy/scipy/pull/9492): MAINT: stats: Improve implementation of chi2 ppf method. +* [#9497](https://github.com/scipy/scipy/pull/9497): DOC: Improve docstrings sparse.linalg.isolve +* [#9499](https://github.com/scipy/scipy/pull/9499): DOC: Replace “Scipy” with “SciPy” in the .rst doc files for consistency. +* [#9500](https://github.com/scipy/scipy/pull/9500): DOC: Document the toolchain and its roadmap. +* [#9505](https://github.com/scipy/scipy/pull/9505): DOC: specify which definition of skewness is used +* [#9511](https://github.com/scipy/scipy/pull/9511): DEP: interpolate: remove deprecated interpolate\_wrapper +* [#9517](https://github.com/scipy/scipy/pull/9517): BUG: improve error handling in stats.iqr +* [#9522](https://github.com/scipy/scipy/pull/9522): ENH: Add Fiedler and fiedler companion to special matrices +* [#9526](https://github.com/scipy/scipy/pull/9526): TST: relax precision requirements in signal.correlate tests +* [#9529](https://github.com/scipy/scipy/pull/9529): DOC: fix missing random seed in optimize.newton example +* [#9533](https://github.com/scipy/scipy/pull/9533): MAINT: Use list comprehension when possible +* [#9537](https://github.com/scipy/scipy/pull/9537): DOC: add a “big picture” roadmap +* [#9538](https://github.com/scipy/scipy/pull/9538): DOC: Replace “Numpy” with “NumPy” in .py, .rst and .txt doc files… +* [#9539](https://github.com/scipy/scipy/pull/9539): ENH: add two-sample test (Epps-Singleton) to scipy.stats +* [#9559](https://github.com/scipy/scipy/pull/9559): DOC: add section on global optimizers to tutorial +* [#9561](https://github.com/scipy/scipy/pull/9561): ENH: remove noprefix.h, change code appropriately +* [#9562](https://github.com/scipy/scipy/pull/9562): MAINT: stats: Rewrite pearsonr. +* [#9563](https://github.com/scipy/scipy/pull/9563): BUG: Minor bug fix Callback in linprog(method=’simplex’) +* [#9568](https://github.com/scipy/scipy/pull/9568): MAINT: raise runtime error for newton with zeroder if disp true,… +* [#9570](https://github.com/scipy/scipy/pull/9570): Correct docstring in show\_options in optimize. Fixes #9407 +* [#9573](https://github.com/scipy/scipy/pull/9573): BUG fixes range of pk variable pre-check +* [#9577](https://github.com/scipy/scipy/pull/9577): TST: fix minor issue in a signal.stft test. +* [#9580](https://github.com/scipy/scipy/pull/9580): Included blank line before list - Fixes #8658 +* [#9582](https://github.com/scipy/scipy/pull/9582): MAINT: drop Python 2.7 and 3.4 +* [#9588](https://github.com/scipy/scipy/pull/9588): MAINT: update `constants.astronomical\_unit` to new 2012 value. +* [#9592](https://github.com/scipy/scipy/pull/9592): TST: Add 32-bit testing to CI +* [#9593](https://github.com/scipy/scipy/pull/9593): DOC: Replace cumulative density with cumulative distribution +* [#9596](https://github.com/scipy/scipy/pull/9596): TST: remove VC 9.0 from Azure CI +* [#9599](https://github.com/scipy/scipy/pull/9599): Hyperlink DOI to preferred resolver +* [#9601](https://github.com/scipy/scipy/pull/9601): DEV: try to limit GC memory use on PyPy +* [#9603](https://github.com/scipy/scipy/pull/9603): MAINT: improve logcdf and logsf of hypergeometric distribution +* [#9605](https://github.com/scipy/scipy/pull/9605): Reference to pylops in LinearOperator notes and ARPACK example +* [#9617](https://github.com/scipy/scipy/pull/9617): TST: reduce max memory usage for sparse.linalg.lgmres test +* [#9619](https://github.com/scipy/scipy/pull/9619): FIX: Sparse matrix addition/subtraction eliminates explicit zeros +* [#9621](https://github.com/scipy/scipy/pull/9621): bugfix in rv\_sample in scipy.stats +* [#9622](https://github.com/scipy/scipy/pull/9622): MAINT: Raise error in directed\_hausdorff distance +* [#9623](https://github.com/scipy/scipy/pull/9623): DOC: Build docs with warnings as errors +* [#9625](https://github.com/scipy/scipy/pull/9625): Return the number of calls to ‘hessp’ (not just ‘hess’) in trust… +* [#9627](https://github.com/scipy/scipy/pull/9627): BUG: ignore empty lines in mmio +* [#9637](https://github.com/scipy/scipy/pull/9637): Function to calculate the MAD of an array +* [#9646](https://github.com/scipy/scipy/pull/9646): BUG: stats: mode for objects w/ndim > 1 +* [#9648](https://github.com/scipy/scipy/pull/9648): Add `stats.contingency` to refguide-check +* [#9650](https://github.com/scipy/scipy/pull/9650): ENH: many lobpcg() algorithm improvements +* [#9652](https://github.com/scipy/scipy/pull/9652): Move misc.doccer to \_lib.doccer +* [#9660](https://github.com/scipy/scipy/pull/9660): ENH: add pearson, tippett, and mudholkar-george to combine\_pvalues +* [#9661](https://github.com/scipy/scipy/pull/9661): BUG: Fix ksone right-hand endpoint, documentation and tests. +* [#9664](https://github.com/scipy/scipy/pull/9664): ENH: adding multi-target dijsktra performance enhancement +* [#9670](https://github.com/scipy/scipy/pull/9670): MAINT: link planck and geometric distribution in scipy.stats +* [#9676](https://github.com/scipy/scipy/pull/9676): ENH: optimize: change default linprog method to interior-point +* [#9685](https://github.com/scipy/scipy/pull/9685): Added reference to ndimage.filters.median\_filter +* [#9705](https://github.com/scipy/scipy/pull/9705): Fix coefficients in expm helper function +* [#9711](https://github.com/scipy/scipy/pull/9711): Release the GIL during sosfilt processing for simple types +* [#9721](https://github.com/scipy/scipy/pull/9721): ENH: Convexhull visiblefacets +* [#9723](https://github.com/scipy/scipy/pull/9723): BLD: Modify rv\_generic.\_construct\_doc to print out failing distribution… +* [#9726](https://github.com/scipy/scipy/pull/9726): BUG: Fix small issues with `signal.lfilter’ +* [#9729](https://github.com/scipy/scipy/pull/9729): BUG: Typecheck iterations for binary image operations +* [#9730](https://github.com/scipy/scipy/pull/9730): ENH: reduce sizeof(NI\_WatershedElement) by 20% +* [#9731](https://github.com/scipy/scipy/pull/9731): ENH: remove suspicious sequence of type castings +* [#9739](https://github.com/scipy/scipy/pull/9739): BUG: qr\_updates fails if u is exactly in span Q +* [#9749](https://github.com/scipy/scipy/pull/9749): BUG: MapWrapper.\_\_exit\_\_ should terminate +* [#9753](https://github.com/scipy/scipy/pull/9753): ENH: Added exact computation for Kolmogorov-Smirnov two-sample… +* [#9755](https://github.com/scipy/scipy/pull/9755): DOC: Added example for signal.impulse, copied from impulse2 +* [#9756](https://github.com/scipy/scipy/pull/9756): DOC: Added docstring example for iirdesign +* [#9757](https://github.com/scipy/scipy/pull/9757): DOC: Added examples for step functions +* [#9759](https://github.com/scipy/scipy/pull/9759): ENH: Allow pass\_zero to act like btype +* [#9760](https://github.com/scipy/scipy/pull/9760): DOC: Added docstring for lp2bs +* [#9761](https://github.com/scipy/scipy/pull/9761): DOC: Added docstring and example for lp2bp +* [#9764](https://github.com/scipy/scipy/pull/9764): BUG: Catch internal warnings for matrix +* [#9766](https://github.com/scipy/scipy/pull/9766): ENH: Speed up \_gaussian\_kernel1d by removing dependence on np.polynomial +* [#9769](https://github.com/scipy/scipy/pull/9769): BUG: Fix Cubic Spline Read Only issues +* [#9773](https://github.com/scipy/scipy/pull/9773): DOC: Several docstrings +* [#9774](https://github.com/scipy/scipy/pull/9774): TST: bump Azure CI OpenBLAS version to match wheels +* [#9775](https://github.com/scipy/scipy/pull/9775): DOC: Improve clarity of cov\_x documentation for scipy.optimize.leastsq +* [#9779](https://github.com/scipy/scipy/pull/9779): ENH: dual\_annealing vectorise visit\_fn +* [#9788](https://github.com/scipy/scipy/pull/9788): TST, BUG: f2py-related issues with NumPy < 1.14.0 +* [#9791](https://github.com/scipy/scipy/pull/9791): BUG: fix amax constraint not enforced in scalar\_search\_wolfe2 +* [#9792](https://github.com/scipy/scipy/pull/9792): ENH: Allow inplace copying in place in “detrend” function +* [#9795](https://github.com/scipy/scipy/pull/9795): DOC: Fix/update docstring for dstn and dst +* [#9796](https://github.com/scipy/scipy/pull/9796): MAINT: Allow None tolerances in least\_squares +* [#9798](https://github.com/scipy/scipy/pull/9798): BUG: fixes abort trap 6 error in scipy issue 9785 in unit tests +* [#9807](https://github.com/scipy/scipy/pull/9807): MAINT: improve doc and add alternative keyword to wilcoxon in… +* [#9808](https://github.com/scipy/scipy/pull/9808): Fix PPoly integrate and test for CubicSpline +* [#9810](https://github.com/scipy/scipy/pull/9810): ENH: Add the geometric standard deviation function +* [#9811](https://github.com/scipy/scipy/pull/9811): MAINT: remove invalid derphi default None value in scalar\_search\_wolfe2 +* [#9813](https://github.com/scipy/scipy/pull/9813): Adapt hamming distance in C to support weights +* [#9817](https://github.com/scipy/scipy/pull/9817): DOC: Copy solver description to solver modules +* [#9829](https://github.com/scipy/scipy/pull/9829): ENH: Add FOH and equivalent impulse response discretizations… +* [#9831](https://github.com/scipy/scipy/pull/9831): ENH: Implement RotationSpline +* [#9834](https://github.com/scipy/scipy/pull/9834): DOC: Change mielke distribution default parameters to ensure… +* [#9838](https://github.com/scipy/scipy/pull/9838): ENH: Use faster solvers for firls +* [#9854](https://github.com/scipy/scipy/pull/9854): ENH: loadarff now supports relational attributes. +* [#9856](https://github.com/scipy/scipy/pull/9856): integrate.bvp - improve handling of nonlinear boundary conditions +* [#9862](https://github.com/scipy/scipy/pull/9862): TST: reduce Appveyor CI load +* [#9874](https://github.com/scipy/scipy/pull/9874): DOC: Update requirements in release notes +* [#9883](https://github.com/scipy/scipy/pull/9883): BUG: fixed parenthesis in spatial.rotation +* [#9884](https://github.com/scipy/scipy/pull/9884): ENH: Use Sparsity in Clarkson-Woodruff Sketch +* [#9888](https://github.com/scipy/scipy/pull/9888): MAINT: Replace NumPy aliased functions +* [#9892](https://github.com/scipy/scipy/pull/9892): BUG: Fix 9890 query\_ball\_point returns wrong result when p is… +* [#9893](https://github.com/scipy/scipy/pull/9893): BUG: curve\_fit doesn’t check for empty input if called with bounds +* [#9894](https://github.com/scipy/scipy/pull/9894): scipy.signal.find\_peaks documentation error +* [#9898](https://github.com/scipy/scipy/pull/9898): BUG: Set success attribute in OptimizeResult. See #9801 +* [#9900](https://github.com/scipy/scipy/pull/9900): BUG: Restrict rv\_generic.\_argcheck() and its overrides from setting… +* [#9906](https://github.com/scipy/scipy/pull/9906): fixed a bug in kde logpdf +* [#9911](https://github.com/scipy/scipy/pull/9911): DOC: replace example for “np.select” with the one from numpy… +* [#9912](https://github.com/scipy/scipy/pull/9912): BF(DOC): point to numpy.select instead of plain (python) .select +* [#9914](https://github.com/scipy/scipy/pull/9914): DOC: change ValueError message in \_validate\_pad of signaltools. +* [#9915](https://github.com/scipy/scipy/pull/9915): cKDTree query\_ball\_point improvements +* [#9918](https://github.com/scipy/scipy/pull/9918): Update ckdtree.pyx with boxsize argument in docstring +* [#9920](https://github.com/scipy/scipy/pull/9920): BUG: sparse: Validate explicit shape if given with dense argument… +* [#9924](https://github.com/scipy/scipy/pull/9924): BLD: add back pyproject.toml +* [#9931](https://github.com/scipy/scipy/pull/9931): Fix empty constraint +* [#9935](https://github.com/scipy/scipy/pull/9935): DOC: fix references for stats.f\_oneway +* [#9936](https://github.com/scipy/scipy/pull/9936): Revert gh-9619: “FIX: Sparse matrix addition/subtraction eliminates… +* [#9937](https://github.com/scipy/scipy/pull/9937): MAINT: fix PEP8 issues and update to pycodestyle 2.5.0 +* [#9939](https://github.com/scipy/scipy/pull/9939): DOC: correct `structure` description in `ndimage.label` docstring +* [#9940](https://github.com/scipy/scipy/pull/9940): MAINT: remove extraneous distutils copies +* [#9945](https://github.com/scipy/scipy/pull/9945): ENH: differential\_evolution can use Bounds object +* [#9949](https://github.com/scipy/scipy/pull/9949): Added ‘std’ to add doctstrings since it is a `known\_stats`… +* [#9953](https://github.com/scipy/scipy/pull/9953): DOC: Documentation cleanup for stats tutorials. +* [#9962](https://github.com/scipy/scipy/pull/9962): \_\_repr\_\_ for Bounds +* [#9971](https://github.com/scipy/scipy/pull/9971): ENH: Improve performance of lsmr +* [#9987](https://github.com/scipy/scipy/pull/9987): CI: pin Sphinx version to 1.8.5 +* [#9990](https://github.com/scipy/scipy/pull/9990): ENH: constraint violation +* [#9991](https://github.com/scipy/scipy/pull/9991): BUG: Avoid inplace modification of input array in newton +* [#9995](https://github.com/scipy/scipy/pull/9995): MAINT: sparse.csgraph: Add cdef to stop build warning. +* [#9996](https://github.com/scipy/scipy/pull/9996): BUG: Make minimize\_quadratic\_1d work with infinite bounds correctly +* [#10004](https://github.com/scipy/scipy/pull/10004): BUG: Fix unbound local error in linprog - simplex. +* [#10007](https://github.com/scipy/scipy/pull/10007): BLD: fix Python 3.7 build with build isolation +* [#10009](https://github.com/scipy/scipy/pull/10009): BUG: Make sure that \_binary\_erosion only accepts an integer number… +* [#10016](https://github.com/scipy/scipy/pull/10016): Update link to airspeed-velocity +* [#10017](https://github.com/scipy/scipy/pull/10017): DOC: Update `interpolate.LSQSphereBivariateSpline` to include… +* [#10018](https://github.com/scipy/scipy/pull/10018): MAINT: special: Fix a few warnings that occur when compiling… +* [#10019](https://github.com/scipy/scipy/pull/10019): TST: Azure summarizes test failures +* [#10021](https://github.com/scipy/scipy/pull/10021): ENH: Introduce CubicHermiteSpline +* [#10022](https://github.com/scipy/scipy/pull/10022): BENCH: Increase cython version in asv to fix benchmark builds +* [#10023](https://github.com/scipy/scipy/pull/10023): BUG: Avoid exponnorm producing nan for small K values. +* [#10025](https://github.com/scipy/scipy/pull/10025): BUG: optimize: tweaked linprog status 4 error message +* [#10026](https://github.com/scipy/scipy/pull/10026): ENH: optimize: use SuiteSparse in linprog interior-point when… +* [#10027](https://github.com/scipy/scipy/pull/10027): MAINT: cluster: clean up the use of malloc() in the function… +* [#10028](https://github.com/scipy/scipy/pull/10028): Fix rotate invalid plane check +* [#10040](https://github.com/scipy/scipy/pull/10040): MAINT: fix pratt method of wilcox test in scipy.stats +* [#10041](https://github.com/scipy/scipy/pull/10041): MAINT: special: Fix a warning generated when building the AMOS… +* [#10044](https://github.com/scipy/scipy/pull/10044): DOC: fix up spatial.transform.Rotation docstrings +* [#10047](https://github.com/scipy/scipy/pull/10047): MAINT: interpolate: Fix a few build warnings. +* [#10051](https://github.com/scipy/scipy/pull/10051): Add project\_urls to setup +* [#10052](https://github.com/scipy/scipy/pull/10052): don’t set flag to “converged” if max iter exceeded +* [#10054](https://github.com/scipy/scipy/pull/10054): MAINT: signal: Fix a few build warnings and modernize some C… +* [#10056](https://github.com/scipy/scipy/pull/10056): BUG: Ensure factorial is not too large in kendaltau +* [#10058](https://github.com/scipy/scipy/pull/10058): Small speedup in samping from ortho and special\_ortho groups +* [#10059](https://github.com/scipy/scipy/pull/10059): BUG: optimize: fix #10038 by increasing tol +* [#10061](https://github.com/scipy/scipy/pull/10061): BLD: DOC: make building docs easier by parsing python version. +* [#10064](https://github.com/scipy/scipy/pull/10064): ENH: Significant speedup for ortho and special ortho group +* [#10065](https://github.com/scipy/scipy/pull/10065): DOC: Reword parameter descriptions in `optimize.root\_scalar` +* [#10066](https://github.com/scipy/scipy/pull/10066): BUG: signal: Fix error raised by savgol\_coeffs when deriv > polyorder. +* [#10067](https://github.com/scipy/scipy/pull/10067): MAINT: Fix the cutoff value inconsistency for pinv2 and pinvh +* [#10072](https://github.com/scipy/scipy/pull/10072): BUG: stats: Fix boxcox\_llf to avoid loss of precision. +* [#10075](https://github.com/scipy/scipy/pull/10075): ENH: Add wrappers for ?syconv routines +* [#10076](https://github.com/scipy/scipy/pull/10076): BUG: optimize: fix curve\_fit for mixed float32/float64 input +* [#10077](https://github.com/scipy/scipy/pull/10077): DOC: Replace undefined `k` in `interpolate.splev` docstring +* [#10079](https://github.com/scipy/scipy/pull/10079): DOC: Fixed typo, rearranged some doc of stats.morestats.wilcoxon. +* [#10080](https://github.com/scipy/scipy/pull/10080): TST: install scikit-sparse for full TravisCI tests +* [#10083](https://github.com/scipy/scipy/pull/10083): Clean ``\_clean\_inputs`` in optimize.linprog +* [#10088](https://github.com/scipy/scipy/pull/10088): ENH: optimize: linprog test CHOLMOD/UMFPACK solvers when available +* [#10090](https://github.com/scipy/scipy/pull/10090): MAINT: Fix CubicSplinerInterpolator for pandas +* [#10091](https://github.com/scipy/scipy/pull/10091): MAINT: improve logcdf and logsf of hypergeometric distribution +* [#10095](https://github.com/scipy/scipy/pull/10095): MAINT: Clean ``\_clean\_inputs`` in linprog +* [#10116](https://github.com/scipy/scipy/pull/10116): MAINT: update scipy-sphinx-theme +* [#10135](https://github.com/scipy/scipy/pull/10135): BUG: fix linprog revised simplex docstring problem failure diff --git a/corpus/changelog/scipy_releases/scipy_131.md b/corpus/changelog/scipy_releases/scipy_131.md new file mode 100644 index 0000000000000000000000000000000000000000..f422cb16ca0ac6d89c8dcb493aa2e4b30cd92ff0 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_131.md @@ -0,0 +1,75 @@ +# SciPy 1.3.1 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.3.1-notes.html +Version: 1.3.1 + +Contents + +* [SciPy 1.3.1 Release Notes](#scipy-1-3-1-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.3.1](#issues-closed-for-1-3-1) + - [Pull requests for 1.3.1](#pull-requests-for-1-3-1) + +SciPy 1.3.1 is a bug-fix release with no new features +compared to 1.3.0. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Matt Haberland +* Geordie McBain +* Yu Feng +* Evgeni Burovski +* Sturla Molden +* Tapasweni Pathak +* Eric Larson +* Peter Bell +* Carlos Ramos Carreño + +* Ralf Gommers +* David Hagen +* Antony Lee +* Ayappan P +* Tyler Reddy +* Pauli Virtanen + +A total of 15 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.3.1](#id3)[#](#issues-closed-for-1-3-1 "Link to this heading") + +* [#5040](https://github.com/scipy/scipy/issues/5040): BUG: Empty data handling of (c)KDTrees +* [#9901](https://github.com/scipy/scipy/issues/9901): lsoda fails to detect stiff problem when called from solve\_ivp +* [#10206](https://github.com/scipy/scipy/issues/10206): sparse matrices indexing with scipy 1.3 +* [#10232](https://github.com/scipy/scipy/issues/10232): Exception in loadarff with quoted nominal attributes in scipy… +* [#10292](https://github.com/scipy/scipy/issues/10292): DOC/REL: Some sections of the release notes are not nested correctly. +* [#10303](https://github.com/scipy/scipy/issues/10303): BUG: optimize: *linprog* failing TestLinprogSimplexBland::test\_unbounded\_below\_no\_presolve\_corrected +* [#10376](https://github.com/scipy/scipy/issues/10376): TST: Travis CI fails (with pytest 5.0 ?) +* [#10384](https://github.com/scipy/scipy/issues/10384): CircleCI doc build failing on new warnings +* [#10398](https://github.com/scipy/scipy/issues/10398): Scipy 1.3.0 build broken in AIX +* [#10501](https://github.com/scipy/scipy/issues/10501): BUG: scipy.spatial.HalfspaceIntersection works incorrectly +* [#10514](https://github.com/scipy/scipy/issues/10514): BUG: cKDTree GIL handling is incorrect +* [#10535](https://github.com/scipy/scipy/issues/10535): TST: master branch CI failures +* [#10572](https://github.com/scipy/scipy/issues/10572): BUG: ckdtree query\_ball\_point errors on discontiguous input +* [#10597](https://github.com/scipy/scipy/issues/10597): BUG: No warning on PchipInterpolator changing from bernstein base to local power base + +### [Pull requests for 1.3.1](#id4)[#](#pull-requests-for-1-3-1 "Link to this heading") + +* [#10071](https://github.com/scipy/scipy/pull/10071): DOC: reconstruct SuperLU permutation matrices avoiding SparseEfficiencyWarning +* [#10196](https://github.com/scipy/scipy/pull/10196): Fewer checks on xdata for curve\_fit. +* [#10207](https://github.com/scipy/scipy/pull/10207): BUG: Compressed matrix indexing should return a scalar +* [#10233](https://github.com/scipy/scipy/pull/10233): Fix for ARFF reader regression (#10232) +* [#10306](https://github.com/scipy/scipy/pull/10306): BUG: optimize: Fix for 10303 +* [#10309](https://github.com/scipy/scipy/pull/10309): BUG: Pass jac=None directly to lsoda +* [#10377](https://github.com/scipy/scipy/pull/10377): TST, MAINT: adjustments for pytest 5.0 +* [#10379](https://github.com/scipy/scipy/pull/10379): BUG: sparse: set writeability to be forward-compatible with numpy>=1.17 +* [#10426](https://github.com/scipy/scipy/pull/10426): MAINT: Fix doc build bugs +* [#10431](https://github.com/scipy/scipy/pull/10431): Update numpy version for AIX +* [#10457](https://github.com/scipy/scipy/pull/10457): BUG: Allow ckdtree to accept empty data input +* [#10503](https://github.com/scipy/scipy/pull/10503): BUG: spatial/qhull: get HalfspaceIntersection.dual\_points from the correct array +* [#10516](https://github.com/scipy/scipy/pull/10516): BUG: Use nogil contexts in cKDTree +* [#10520](https://github.com/scipy/scipy/pull/10520): DOC: Proper .rst formatting for deprecated features and Backwards incompatible changes +* [#10540](https://github.com/scipy/scipy/pull/10540): MAINT: Fix Travis and Circle +* [#10573](https://github.com/scipy/scipy/pull/10573): BUG: Fix query\_ball\_point with discontiguous input +* [#10600](https://github.com/scipy/scipy/pull/10600): BUG: interpolate: fix broken conversions between PPoly/BPoly objects diff --git a/corpus/changelog/scipy_releases/scipy_132.md b/corpus/changelog/scipy_releases/scipy_132.md new file mode 100644 index 0000000000000000000000000000000000000000..a143c4b68c2abdd06236d75e9a196e4140ecd316 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_132.md @@ -0,0 +1,73 @@ +# SciPy 1.3.2 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.3.2-notes.html +Version: 1.3.2 + +Contents + +* [SciPy 1.3.2 Release Notes](#scipy-1-3-2-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.3.2](#issues-closed-for-1-3-2) + - [Pull requests for 1.3.2](#pull-requests-for-1-3-2) + +SciPy 1.3.2 is a bug-fix and maintenance release that adds +support for Python 3.8. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* CJ Carey +* Dany Vohl +* Martin Gauch + +* Ralf Gommers +* Matt Haberland +* Eric Larson +* Nikolay Mayorov +* Sam McCormack + +* Andrew Nelson +* Tyler Reddy +* Pauli Virtanen +* Huize Wang + +* Warren Weckesser +* Joseph Weston + + +A total of 14 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.3.2](#id3)[#](#issues-closed-for-1-3-2 "Link to this heading") + +* [#4915](https://github.com/scipy/scipy/issues/4915): Bug in unique\_roots in scipy.signal.signaltools.py for roots… +* [#5161](https://github.com/scipy/scipy/issues/5161): Optimizers reporting success when the minimum is NaN +* [#5546](https://github.com/scipy/scipy/issues/5546): ValueError raised if scipy.sparse.linalg.expm recieves array… +* [#10124](https://github.com/scipy/scipy/issues/10124): linprog(method=’revised simplex’) doctest bug +* [#10609](https://github.com/scipy/scipy/issues/10609): Graph shortest path with Floyd-Warshall removes explicit zeros. +* [#10658](https://github.com/scipy/scipy/issues/10658): BUG: stats: Formula for the variance of the noncentral F distribution… +* [#10695](https://github.com/scipy/scipy/issues/10695): BUG: Assignation issues in csr\_matrix with fancy indexing +* [#10846](https://github.com/scipy/scipy/issues/10846): root\_scalar fails when passed a function wrapped with functools.lru\_cache +* [#10902](https://github.com/scipy/scipy/issues/10902): CI: travis osx build failure +* [#10967](https://github.com/scipy/scipy/issues/10967): macOS build failure in SuperLU on maintenance/1.3.x +* [#10976](https://github.com/scipy/scipy/issues/10976): Typo in sp.stats.wilcoxon docstring + +### [Pull requests for 1.3.2](#id4)[#](#pull-requests-for-1-3-2 "Link to this heading") + +* [#10498](https://github.com/scipy/scipy/pull/10498): TST: optimize: fixed `linprog` `”disp”: True` bug +* [#10536](https://github.com/scipy/scipy/pull/10536): CI: add 3.8-dev to travis +* [#10671](https://github.com/scipy/scipy/pull/10671): BUG: stats: Fix the formula for the variance of the noncentral… +* [#10693](https://github.com/scipy/scipy/pull/10693): BUG: ScalarFunction stores original array +* [#10700](https://github.com/scipy/scipy/pull/10700): BUG: sparse: Loosen checks on sparse fancy assignment +* [#10709](https://github.com/scipy/scipy/pull/10709): BUG: Fix floyd\_warshall to support zero-weight edges +* [#10756](https://github.com/scipy/scipy/pull/10756): BUG: optimize: ensure solvers exit with success=False for nan… +* [#10833](https://github.com/scipy/scipy/pull/10833): BUG: Fix subspace\_angles for complex values +* [#10882](https://github.com/scipy/scipy/pull/10882): BUG: sparse/arpack: fix incorrect code for complex hermitian… +* [#10891](https://github.com/scipy/scipy/pull/10891): BUG: make C-implemented root finders work with functools.lru\_cache +* [#10906](https://github.com/scipy/scipy/pull/10906): BUG: sparse/linalg: fix expm for np.matrix inputs +* [#10917](https://github.com/scipy/scipy/pull/10917): CI: fix travis osx CI +* [#10930](https://github.com/scipy/scipy/pull/10930): MAINT: Updates for 3.8 +* [#10938](https://github.com/scipy/scipy/pull/10938): MAINT: Add Python 3.8 to pyproject.toml +* [#10943](https://github.com/scipy/scipy/pull/10943): BLD: update Cython version to 0.29.13 +* [#10961](https://github.com/scipy/scipy/pull/10961): BUG: Fix signal.unique\_roots +* [#10971](https://github.com/scipy/scipy/pull/10971): MAINT: use 3.8 stable in CI +* [#10977](https://github.com/scipy/scipy/pull/10977): DOC: Fix typo in sp.stats.wilcoxon docsting +* [#11025](https://github.com/scipy/scipy/pull/11025): Update \_peak\_finding.py diff --git a/corpus/changelog/scipy_releases/scipy_133.md b/corpus/changelog/scipy_releases/scipy_133.md new file mode 100644 index 0000000000000000000000000000000000000000..edb1b5c646e02f799a5241d9a2e3beffccce5ca4 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_133.md @@ -0,0 +1,35 @@ +# SciPy 1.3.3 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.3.3-notes.html +Version: 1.3.3 + +Contents + +* [SciPy 1.3.3 Release Notes](#scipy-1-3-3-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.3.3](#issues-closed-for-1-3-3) + - [Pull requests for 1.3.3](#pull-requests-for-1-3-3) + +SciPy 1.3.3 is a bug-fix release with no new features +compared to 1.3.2. In particular, a test suite issue +involving multiprocessing was fixed for Windows and +Python 3.8 on macOS. + +Wheels were also updated to place msvcp140.dll at the +appropriate location, which was previously causing issues. + +## [Authors](#id2)[#](#authors "Link to this heading") + +Ilhan Polat +Tyler Reddy +Ralf Gommers + +### [Issues closed for 1.3.3](#id3)[#](#issues-closed-for-1-3-3 "Link to this heading") + +* [#11033](https://github.com/scipy/scipy/issues/11033): deadlock on osx for python 3.8 + +### [Pull requests for 1.3.3](#id4)[#](#pull-requests-for-1-3-3 "Link to this heading") + +* [#11034](https://github.com/scipy/scipy/pull/11034): MAINT: TST: Skip tests with multiprocessing that use “spawn” start method diff --git a/corpus/changelog/scipy_releases/scipy_140.md b/corpus/changelog/scipy_releases/scipy_140.md new file mode 100644 index 0000000000000000000000000000000000000000..9d536b6f166f810d5f12f2bcc8c5e378aab915cb --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_140.md @@ -0,0 +1,1025 @@ +# SciPy 1.4.0 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.4.0-notes.html +Version: 1.4.0 + +Contents + +* [SciPy 1.4.0 Release Notes](#scipy-1-4-0-release-notes) + + + [Highlights of this release](#highlights-of-this-release) + + - [New features](#new-features) + + [Infrastructure](#infrastructure) + + [[`scipy.constants`](../reference/constants.html#module-scipy.constants "scipy.constants") improvements](#scipy-constants-improvements) + + [[`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") added](#scipy-fft-added) + + [[`scipy.fftpack`](../reference/fftpack.html#module-scipy.fftpack "scipy.fftpack") improvements](#scipy-fftpack-improvements) + + [[`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") improvements](#scipy-integrate-improvements) + + [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#scipy-interpolate-improvements) + + [[`scipy.io`](../reference/io.html#module-scipy.io "scipy.io") improvements](#scipy-io-improvements) + + [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#scipy-linalg-improvements) + + [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#scipy-ndimage-improvements) + + [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#scipy-optimize-improvements) + + [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#scipy-signal-improvements) + + [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#scipy-sparse-improvements) + + [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#scipy-spatial-improvements) + + [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#scipy-special-improvements) + + [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#scipy-stats-improvements) + + - [Deprecated features](#deprecated-features) + + [[`scipy`](../index.html#module-scipy "scipy") deprecations](#scipy-deprecations) + + - [Backwards incompatible changes](#backwards-incompatible-changes) + + [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") changes](#scipy-special-changes) + + [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") changes](#scipy-sparse-changes) + + [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") changes](#scipy-signal-changes) + + [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") changes](#scipy-stats-changes) + + - [Other changes](#other-changes) + - [Authors](#authors) + + [Issues closed for 1.4.0](#issues-closed-for-1-4-0) + + [Pull requests for 1.4.0](#pull-requests-for-1-4-0) + +SciPy 1.4.0 is the culmination of 6 months of hard work. It contains +many new features, numerous bug-fixes, improved test coverage and better +documentation. There have been a number of deprecations and API changes +in this release, which are documented below. All users are encouraged to +upgrade to this release, as there are a large number of bug-fixes and +optimizations. Before upgrading, we recommend that users check that +their own code does not use deprecated SciPy functionality (to do so, +run your code with `python -Wd` and check for `DeprecationWarning` s). +Our development attention will now shift to bug-fix releases on the +1.4.x branch, and on adding new features on the master branch. + +This release requires Python 3.5+ and NumPy >=1.13.3 (for Python 3.5, 3.6), +>=1.14.5 (for Python 3.7), >= 1.17.3 (for Python 3.8) + +For running on PyPy, PyPy3 6.0+ and NumPy 1.15.0 are required. + +## [Highlights of this release](#id2)[#](#highlights-of-this-release "Link to this heading") + +* a new submodule, [`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft"), now supersedes [`scipy.fftpack`](../reference/fftpack.html#module-scipy.fftpack "scipy.fftpack"); this + means support for `long double` transforms, faster multi-dimensional + transforms, improved algorithm time complexity, release of the global + interpreter lock, and control over threading behavior +* support for `pydata/sparse` arrays in [`scipy.sparse.linalg`](../reference/sparse.linalg.html#module-scipy.sparse.linalg "scipy.sparse.linalg") +* substantial improvement to the documentation and functionality of + several [`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") functions, and some new additions +* the generalized inverse Gaussian distribution has been added to + [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") +* an implementation of the Edmonds-Karp algorithm in + [`scipy.sparse.csgraph.maximum_flow`](../reference/generated/scipy.sparse.csgraph.maximum_flow.html#scipy.sparse.csgraph.maximum_flow "scipy.sparse.csgraph.maximum_flow") +* [`scipy.spatial.SphericalVoronoi`](../reference/generated/scipy.spatial.SphericalVoronoi.html#scipy.spatial.SphericalVoronoi "scipy.spatial.SphericalVoronoi") now supports n-dimensional input, + : has linear memory complexity, improved performance, and + supports single-hemisphere generators + +### [New features](#id3)[#](#new-features "Link to this heading") + +## [Infrastructure](#id4)[#](#infrastructure "Link to this heading") + +Documentation can now be built with `runtests.py --doc` + +A `Dockerfile` is now available in the `scipy/scipy-dev` repository to +facilitate getting started with SciPy development. + +## [[`scipy.constants`](../reference/constants.html#module-scipy.constants "scipy.constants") improvements](#id5)[#](#scipy-constants-improvements "Link to this heading") + +[`scipy.constants`](../reference/constants.html#module-scipy.constants "scipy.constants") has been updated with the CODATA 2018 constants. + +## [[`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") added](#id6)[#](#scipy-fft-added "Link to this heading") + +[`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") is a new submodule that supersedes the [`scipy.fftpack`](../reference/fftpack.html#module-scipy.fftpack "scipy.fftpack") submodule. +For the most part, this is a drop-in replacement for `numpy.fft` and +[`scipy.fftpack`](../reference/fftpack.html#module-scipy.fftpack "scipy.fftpack") alike. With some important differences, [`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft"): +- uses NumPy’s conventions for real transforms (`rfft`). This means the +return value is a complex array, half the size of the full `fft` output. +This is different from the output of `fftpack` which returned a real array +representing complex components packed together. +- the inverse real to real transforms (`idct` and `idst`) are normalized +for `norm=None` in the same way as `ifft`. This means the identity +`idct(dct(x)) == x` is now `True` for all norm modes. +- does not include the convolutions or pseudo-differential operators +from `fftpack`. + +This submodule is based on the `pypocketfft` library, developed by the +author of `pocketfft` which was recently adopted by NumPy as well. +`pypocketfft` offers a number of advantages over fortran `FFTPACK`: +- support for long double (`np.longfloat`) precision transforms. +- faster multi-dimensional transforms using vectorisation +- Bluestein’s algorithm removes the worst-case `O(n^2)` complexity of +`FFTPACK` +- the global interpreter lock (`GIL`) is released during transforms +- optional multithreading of multi-dimensional transforms via the `workers` +argument + +Note that [`scipy.fftpack`](../reference/fftpack.html#module-scipy.fftpack "scipy.fftpack") has not been deprecated and will continue to be +maintained but is now considered legacy. New code is recommended to use +[`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") instead, where possible. + +## [[`scipy.fftpack`](../reference/fftpack.html#module-scipy.fftpack "scipy.fftpack") improvements](#id7)[#](#scipy-fftpack-improvements "Link to this heading") + +[`scipy.fftpack`](../reference/fftpack.html#module-scipy.fftpack "scipy.fftpack") now uses pypocketfft to perform its FFTs, offering the same +speed and accuracy benefits listed for scipy.fft above but without the +improved API. + +## [[`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") improvements](#id8)[#](#scipy-integrate-improvements "Link to this heading") + +The function [`scipy.integrate.solve_ivp`](../reference/generated/scipy.integrate.solve_ivp.html#scipy.integrate.solve_ivp "scipy.integrate.solve_ivp") now has an `args` argument. +This allows the user-defined functions passed to the function to have +additional parameters without having to create wrapper functions or +lambda expressions for them. + +[`scipy.integrate.solve_ivp`](../reference/generated/scipy.integrate.solve_ivp.html#scipy.integrate.solve_ivp "scipy.integrate.solve_ivp") can now return a `y_events` attribute +representing the solution of the ODE at event times + +New `OdeSolver` is implemented — `DOP853`. This is a high-order explicit +Runge-Kutta method originally implemented in Fortran. Now we provide a pure +Python implementation usable through `solve_ivp` with all its features. + +[`scipy.integrate.quad`](../reference/generated/scipy.integrate.quad.html#scipy.integrate.quad "scipy.integrate.quad") provides better user feedback when break points are +specified with a weighted integrand. + +[`scipy.integrate.quad_vec`](../reference/generated/scipy.integrate.quad_vec.html#scipy.integrate.quad_vec "scipy.integrate.quad_vec") is now available for general purpose integration +of vector-valued functions + +## [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#id9)[#](#scipy-interpolate-improvements "Link to this heading") + +[`scipy.interpolate.pade`](../reference/generated/scipy.interpolate.pade.html#scipy.interpolate.pade "scipy.interpolate.pade") now handles complex input data gracefully + +[`scipy.interpolate.Rbf`](../reference/generated/scipy.interpolate.Rbf.html#scipy.interpolate.Rbf "scipy.interpolate.Rbf") can now interpolate multi-dimensional functions + +## [[`scipy.io`](../reference/io.html#module-scipy.io "scipy.io") improvements](#id10)[#](#scipy-io-improvements "Link to this heading") + +[`scipy.io.wavfile.read`](../reference/generated/scipy.io.wavfile.read.html#scipy.io.wavfile.read "scipy.io.wavfile.read") can now read data from a *WAV* file that has a +malformed header, similar to other modern *WAV* file parsers + +[`scipy.io.FortranFile`](../reference/generated/scipy.io.FortranFile.html#scipy.io.FortranFile "scipy.io.FortranFile") now has an expanded set of available `Exception` +classes for handling poorly-formatted files + +## [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#id11)[#](#scipy-linalg-improvements "Link to this heading") + +The function `scipy.linalg.subspace_angles(A, B)` now gives correct +results for complex-valued matrices. Before this, the function only returned +correct values for real-valued matrices. + +New boolean keyword argument `check_finite` for [`scipy.linalg.norm`](../reference/generated/scipy.linalg.norm.html#scipy.linalg.norm "scipy.linalg.norm"); whether +to check that the input matrix contains only finite numbers. Disabling may +give a performance gain, but may result in problems (crashes, non-termination) +if the inputs do contain infinities or NaNs. + +[`scipy.linalg.solve_triangular`](../reference/generated/scipy.linalg.solve_triangular.html#scipy.linalg.solve_triangular "scipy.linalg.solve_triangular") has improved performance for a C-ordered +triangular matrix + +`LAPACK` wrappers have been added for `?geequ`, `?geequb`, `?syequb`, +and `?heequb` + +Some performance improvements may be observed due to an internal optimization +in operations involving LAPACK routines via `_compute_lwork`. This is +particularly true for operations on small arrays. + +Block `QR` wrappers are now available in [`scipy.linalg.lapack`](../reference/linalg.lapack.html#module-scipy.linalg.lapack "scipy.linalg.lapack") + +## [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#id12)[#](#scipy-ndimage-improvements "Link to this heading") + +## [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#id13)[#](#scipy-optimize-improvements "Link to this heading") + +It is now possible to use linear and non-linear constraints with +[`scipy.optimize.differential_evolution`](../reference/generated/scipy.optimize.differential_evolution.html#scipy.optimize.differential_evolution "scipy.optimize.differential_evolution"). + +[`scipy.optimize.linear_sum_assignment`](../reference/generated/scipy.optimize.linear_sum_assignment.html#scipy.optimize.linear_sum_assignment "scipy.optimize.linear_sum_assignment") has been re-written in C++ to improve +performance, and now allows input costs to be infinite. + +A `ScalarFunction.fun_and_grad` method was added for convenient simultaneous +retrieval of a function and gradient evaluation + +[`scipy.optimize.minimize`](../reference/generated/scipy.optimize.minimize.html#scipy.optimize.minimize "scipy.optimize.minimize") `BFGS` method has improved performance by avoiding +duplicate evaluations in some cases + +Better user feedback is provided when an objective function returns an array +instead of a scalar. + +## [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#id14)[#](#scipy-signal-improvements "Link to this heading") + +Added a new function to calculate convolution using the overlap-add method, +named [`scipy.signal.oaconvolve`](../reference/generated/scipy.signal.oaconvolve.html#scipy.signal.oaconvolve "scipy.signal.oaconvolve"). Like [`scipy.signal.fftconvolve`](../reference/generated/scipy.signal.fftconvolve.html#scipy.signal.fftconvolve "scipy.signal.fftconvolve"), this +function supports specifying dimensions along which to do the convolution. + +*scipy.signal.cwt* now supports complex wavelets. + +The implementation of `choose_conv_method` has been updated to reflect the +new FFT implementation. In addition, the performance has been significantly +improved (with rather drastic improvements in edge cases). + +The function `upfirdn` now has a `mode` keyword argument that can be used +to select the signal extension mode used at the signal boundaries. These modes +are also available for use in `resample_poly` via a newly added `padtype` +argument. + +[`scipy.signal.sosfilt`](../reference/generated/scipy.signal.sosfilt.html#scipy.signal.sosfilt "scipy.signal.sosfilt") now benefits from Cython code for improved performance + +[`scipy.signal.resample`](../reference/generated/scipy.signal.resample.html#scipy.signal.resample "scipy.signal.resample") should be more efficient by leveraging `rfft` when +possible + +## [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#id15)[#](#scipy-sparse-improvements "Link to this heading") + +It is now possible to use the LOBPCG method in [`scipy.sparse.linalg.svds`](../reference/generated/scipy.sparse.linalg.svds.html#scipy.sparse.linalg.svds "scipy.sparse.linalg.svds"). + +[`scipy.sparse.linalg.LinearOperator`](../reference/generated/scipy.sparse.linalg.LinearOperator.html#scipy.sparse.linalg.LinearOperator "scipy.sparse.linalg.LinearOperator") now supports the operation `rmatmat` +for adjoint matrix-matrix multiplication, in addition to `rmatvec`. + +Multiple stability updates enable float32 support in the LOBPCG eigenvalue +solver for symmetric and Hermitian eigenvalues problems in +`scipy.sparse.linalg.lobpcg`. + +A solver for the maximum flow problem has been added as +[`scipy.sparse.csgraph.maximum_flow`](../reference/generated/scipy.sparse.csgraph.maximum_flow.html#scipy.sparse.csgraph.maximum_flow "scipy.sparse.csgraph.maximum_flow"). + +[`scipy.sparse.csgraph.maximum_bipartite_matching`](../reference/generated/scipy.sparse.csgraph.maximum_bipartite_matching.html#scipy.sparse.csgraph.maximum_bipartite_matching "scipy.sparse.csgraph.maximum_bipartite_matching") now allows non-square inputs, +no longer requires a perfect matching to exist, and has improved performance. + +[`scipy.sparse.lil_matrix`](../reference/generated/scipy.sparse.lil_matrix.html#scipy.sparse.lil_matrix "scipy.sparse.lil_matrix") conversions now perform better in some scenarios + +Basic support is available for `pydata/sparse` arrays in +[`scipy.sparse.linalg`](../reference/sparse.linalg.html#module-scipy.sparse.linalg "scipy.sparse.linalg") + +[`scipy.sparse.linalg.spsolve_triangular`](../reference/generated/scipy.sparse.linalg.spsolve_triangular.html#scipy.sparse.linalg.spsolve_triangular "scipy.sparse.linalg.spsolve_triangular") now supports the `unit_diagonal` +argument to improve call signature similarity with its dense counterpart, +[`scipy.linalg.solve_triangular`](../reference/generated/scipy.linalg.solve_triangular.html#scipy.linalg.solve_triangular "scipy.linalg.solve_triangular") + +`assertAlmostEqual` may now be used with sparse matrices, which have added +support for `__round__` + +## [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#id16)[#](#scipy-spatial-improvements "Link to this heading") + +The bundled Qhull library was upgraded to version 2019.1, fixing several +issues. Scipy-specific patches are no longer applied to it. + +[`scipy.spatial.SphericalVoronoi`](../reference/generated/scipy.spatial.SphericalVoronoi.html#scipy.spatial.SphericalVoronoi "scipy.spatial.SphericalVoronoi") now has linear memory complexity, improved +performance, and supports single-hemisphere generators. Support has also been +added for handling generators that lie on a great circle arc (geodesic input) +and for generators in n-dimensions. + +[`scipy.spatial.transform.Rotation`](../reference/generated/scipy.spatial.transform.Rotation.html#scipy.spatial.transform.Rotation "scipy.spatial.transform.Rotation") now includes functions for calculation of a +mean rotation, generation of the 3D rotation groups, and reduction of rotations +with rotational symmetries. + +[`scipy.spatial.transform.Slerp`](../reference/generated/scipy.spatial.transform.Slerp.html#scipy.spatial.transform.Slerp "scipy.spatial.transform.Slerp") is now callable with a scalar argument + +[`scipy.spatial.voronoi_plot_2d`](../reference/generated/scipy.spatial.voronoi_plot_2d.html#scipy.spatial.voronoi_plot_2d "scipy.spatial.voronoi_plot_2d") now supports furthest site Voronoi diagrams + +[`scipy.spatial.Delaunay`](../reference/generated/scipy.spatial.Delaunay.html#scipy.spatial.Delaunay "scipy.spatial.Delaunay") and [`scipy.spatial.Voronoi`](../reference/generated/scipy.spatial.Voronoi.html#scipy.spatial.Voronoi "scipy.spatial.Voronoi") now have attributes +for tracking whether they are furthest site diagrams + +## [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#id17)[#](#scipy-special-improvements "Link to this heading") + +The Voigt profile has been added as [`scipy.special.voigt_profile`](../reference/generated/scipy.special.voigt_profile.html#scipy.special.voigt_profile "scipy.special.voigt_profile"). + +A real dispatch has been added for the Wright Omega function +([`scipy.special.wrightomega`](../reference/generated/scipy.special.wrightomega.html#scipy.special.wrightomega "scipy.special.wrightomega")). + +The analytic continuation of the Riemann zeta function has been added. (The +Riemann zeta function is the one-argument variant of [`scipy.special.zeta`](../reference/generated/scipy.special.zeta.html#scipy.special.zeta "scipy.special.zeta").) + +The complete elliptic integral of the first kind ([`scipy.special.ellipk`](../reference/generated/scipy.special.ellipk.html#scipy.special.ellipk "scipy.special.ellipk")) is +now available in [`scipy.special.cython_special`](../reference/special.cython_special.html#module-scipy.special.cython_special "scipy.special.cython_special"). + +The accuracy of [`scipy.special.hyp1f1`](../reference/generated/scipy.special.hyp1f1.html#scipy.special.hyp1f1 "scipy.special.hyp1f1") for real arguments has been improved. + +The documentation of many functions has been improved. + +## [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#id18)[#](#scipy-stats-improvements "Link to this heading") + +[`scipy.stats.multiscale_graphcorr`](../reference/generated/scipy.stats.multiscale_graphcorr.html#scipy.stats.multiscale_graphcorr "scipy.stats.multiscale_graphcorr") added as an independence test that +operates on high dimensional and nonlinear data sets. It has higher statistical +power than other [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") tests while being the only one that operates on +multivariate data. + +The generalized inverse Gaussian distribution ([`scipy.stats.geninvgauss`](../reference/generated/scipy.stats.geninvgauss.html#scipy.stats.geninvgauss "scipy.stats.geninvgauss")) has +been added. + +It is now possible to efficiently reuse [`scipy.stats.binned_statistic_dd`](../reference/generated/scipy.stats.binned_statistic_dd.html#scipy.stats.binned_statistic_dd "scipy.stats.binned_statistic_dd") +with new values by providing the result of a previous call to the function. + +[`scipy.stats.hmean`](../reference/generated/scipy.stats.hmean.html#scipy.stats.hmean "scipy.stats.hmean") now handles input with zeros more gracefully. + +The beta-binomial distribution is now available in [`scipy.stats.betabinom`](../reference/generated/scipy.stats.betabinom.html#scipy.stats.betabinom "scipy.stats.betabinom"). + +[`scipy.stats.zscore`](../reference/generated/scipy.stats.zscore.html#scipy.stats.zscore "scipy.stats.zscore"), [`scipy.stats.circmean`](../reference/generated/scipy.stats.circmean.html#scipy.stats.circmean "scipy.stats.circmean"), [`scipy.stats.circstd`](../reference/generated/scipy.stats.circstd.html#scipy.stats.circstd "scipy.stats.circstd"), and +[`scipy.stats.circvar`](../reference/generated/scipy.stats.circvar.html#scipy.stats.circvar "scipy.stats.circvar") now support the `nan_policy` argument for enhanced +handling of `NaN` values + +[`scipy.stats.entropy`](../reference/generated/scipy.stats.entropy.html#scipy.stats.entropy "scipy.stats.entropy") now accepts an `axis` argument + +[`scipy.stats.gaussian_kde.resample`](../reference/generated/scipy.stats.gaussian_kde.resample.html#scipy.stats.gaussian_kde.resample "scipy.stats.gaussian_kde.resample") now accepts a `seed` argument to empower +reproducibility + +[`scipy.stats.kendalltau`](../reference/generated/scipy.stats.kendalltau.html#scipy.stats.kendalltau "scipy.stats.kendalltau") performance has improved, especially for large inputs, +due to improved cache usage + +[`scipy.stats.truncnorm`](../reference/generated/scipy.stats.truncnorm.html#scipy.stats.truncnorm "scipy.stats.truncnorm") distribution has been rewritten to support much wider +tails + +### [Deprecated features](#id19)[#](#deprecated-features "Link to this heading") + +## [[`scipy`](../index.html#module-scipy "scipy") deprecations](#id20)[#](#scipy-deprecations "Link to this heading") + +Support for NumPy functions exposed via the root SciPy namespace is deprecated +and will be removed in 2.0.0. For example, if you use `scipy.rand` or +`scipy.diag`, you should change your code to directly use +`numpy.random.default_rng` or `numpy.diag`, respectively. +They remain available in the currently continuing Scipy 1.x release series. + +The exception to this rule is using `scipy.fft` as a function – +[`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") is now meant to be used only as a module, so the ability to +call `scipy.fft(...)` will be removed in SciPy 1.5.0. + +In *scipy.spatial.Rotation* methods `from_dcm`, `as_dcm` were renamed to +`from_matrix`, `as_matrix` respectively. The old names will be removed in +SciPy 1.6.0. + +Method `Rotation.match_vectors` was deprecated in favor of +`Rotation.align_vectors`, which provides a more logical and +general API to the same functionality. The old method +will be removed in SciPy 1.6.0. + +### [Backwards incompatible changes](#id21)[#](#backwards-incompatible-changes "Link to this heading") + +## [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") changes](#id22)[#](#scipy-special-changes "Link to this heading") + +The deprecated functions `hyp2f0`, `hyp1f2`, and `hyp3f0` have been +removed. + +The deprecated function `bessel_diff_formula` has been removed. + +The function `i0` is no longer registered with `numpy.dual`, so that +`numpy.dual.i0` will unconditionally refer to the NumPy version regardless +of whether [`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") is imported. + +The function `expn` has been changed to return `nan` outside of its +domain of definition (`x, n < 0`) instead of `inf`. + +## [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") changes](#id23)[#](#scipy-sparse-changes "Link to this heading") + +Sparse matrix reshape now raises an error if shape is not two-dimensional, +rather than guessing what was meant. The behavior is now the same as before +SciPy 1.1.0. + +`CSR` and `CSC` sparse matrix classes should now return empty matrices +of the same type when indexed out of bounds. Previously, for some versions +of SciPy, this would raise an `IndexError`. The change is largely motivated +by greater consistency with `ndarray` and `numpy.matrix` semantics. + +## [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") changes](#id24)[#](#scipy-signal-changes "Link to this heading") + +[`scipy.signal.resample`](../reference/generated/scipy.signal.resample.html#scipy.signal.resample "scipy.signal.resample") behavior for length-1 signal inputs has been +fixed to output a constant (DC) value rather than an impulse, consistent with +the assumption of signal periodicity in the FFT method. + +*scipy.signal.cwt* now performs complex conjugation and time-reversal of +wavelet data, which is a backwards-incompatible bugfix for +time-asymmetric wavelets. + +## [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") changes](#id25)[#](#scipy-stats-changes "Link to this heading") + +[`scipy.stats.loguniform`](../reference/generated/scipy.stats.loguniform.html#scipy.stats.loguniform "scipy.stats.loguniform") added with better documentation as (an alias for +`scipy.stats.reciprocal`). `loguniform` generates random variables +that are equally likely in the log space; e.g., `1`, `10` and `100` +are all equally likely if `loguniform(10 ** 0, 10 ** 2).rvs()` is used. + +### [Other changes](#id26)[#](#other-changes "Link to this heading") + +The `LSODA` method of [`scipy.integrate.solve_ivp`](../reference/generated/scipy.integrate.solve_ivp.html#scipy.integrate.solve_ivp "scipy.integrate.solve_ivp") now correctly detects stiff +problems. + +[`scipy.spatial.cKDTree`](../reference/generated/scipy.spatial.cKDTree.html#scipy.spatial.cKDTree "scipy.spatial.cKDTree") now accepts and correctly handles empty input data + +[`scipy.stats.binned_statistic_dd`](../reference/generated/scipy.stats.binned_statistic_dd.html#scipy.stats.binned_statistic_dd "scipy.stats.binned_statistic_dd") now calculates the standard deviation +statistic in a numerically stable way. + +[`scipy.stats.binned_statistic_dd`](../reference/generated/scipy.stats.binned_statistic_dd.html#scipy.stats.binned_statistic_dd "scipy.stats.binned_statistic_dd") now throws an error if the input data +contains either `np.nan` or `np.inf`. Similarly, in [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") now all +continuous distributions’ `.fit()` methods throw an error if the input data +contain any instance of either `np.nan` or `np.inf`. + +### [Authors](#id27)[#](#authors "Link to this heading") + +* @endolith +* @wenhui-prudencemed + +* Abhinav + +* Anne Archibald +* ashwinpathak20nov1996 + +* Danilo Augusto + +* Nelson Auner + +* aypiggott + +* Christoph Baumgarten +* Peter Bell +* Sebastian Berg +* Arman Bilge + +* Benedikt Boecking + +* Christoph Boeddeker + +* Daniel Bunting +* Evgeni Burovski +* Angeline Burrell + +* Angeline G. Burrell + +* CJ Carey +* Carlos Ramos Carreño + +* Mak Sze Chun + +* Malayaja Chutani + +* Christian Clauss + +* Jonathan Conroy + +* Stephen P Cook + +* Dylan Cutler + +* Anirudh Dagar + +* Aidan Dang + +* dankleeman + +* Brandon David + +* Tyler Dawson + +* Dieter Werthmüller +* Joe Driscoll + +* Jakub Dyczek + +* Dávid Bodnár +* Fletcher Easton + +* Stefan Endres +* etienne + +* Johann Faouzi +* Yu Feng +* Isuru Fernando + +* Matthew H Flamm +* Martin Gauch + +* Gabriel Gerlero + +* Ralf Gommers +* Chris Gorgolewski + +* Domen Gorjup + +* Edouard Goudenhoofdt + +* Jan Gwinner + +* Maja Gwozdz + +* Matt Haberland +* hadshirt + +* Pierre Haessig + +* David Hagen +* Charles Harris +* Gina Helfrich + +* Alex Henrie + +* Francisco J. Hernandez Heras + +* Andreas Hilboll +* Lindsey Hiltner +* Thomas Hisch +* Min ho Kim + +* Gert-Ludwig Ingold +* jakobjakobson13 + +* Todd Jennings +* He Jia +* Muhammad Firmansyah Kasim + +* Andrew Knyazev + +* Holger Kohr + +* Mateusz Konieczny + +* Krzysztof Pióro + +* Philipp Lang + +* Peter Mahler Larsen + +* Eric Larson +* Antony Lee +* Gregory R. Lee +* Chelsea Liu + +* Jesse Livezey +* Peter Lysakovski + +* Jason Manley + +* Michael Marien + +* Nikolay Mayorov +* 7. 4. McBain + +* Sam McCormack + +* Melissa Weber Mendonça + +* Kevin Michel + +* mikeWShef + +* Sturla Molden +* Eric Moore +* Peyton Murray + +* Andrew Nelson +* Clement Ng + +* Juan Nunez-Iglesias +* Renee Otten + +* Kellie Ottoboni + +* Ayappan P +* Sambit Panda + +* Tapasweni Pathak + +* Oleksandr Pavlyk +* Fabian Pedregosa +* Petar Mlinarić +* Matti Picus +* Marcel Plch + +* Christoph Pohl + +* Ilhan Polat +* Siddhesh Poyarekar + +* Ioannis Prapas + +* James Alan Preiss + +* Yisheng Qiu + +* Eric Quintero +* Bharat Raghunathan + +* Tyler Reddy +* Joscha Reimer +* Antonio Horta Ribeiro +* Lucas Roberts +* rtshort + +* Josua Sassen +* Kevin Sheppard +* Scott Sievert +* Leo Singer +* Kai Striega +* Søren Fuglede Jørgensen +* tborisow + +* Étienne Tremblay + +* tuxcell + +* Miguel de Val-Borro +* Andrew Valentine + +* Hugo van Kemenade +* Paul van Mulbregt +* Sebastiano Vigna +* Pauli Virtanen +* Dany Vohl + +* Ben Walsh + +* Huize Wang + +* Warren Weckesser +* Anreas Weh + +* Joseph Weston + +* Adrian Wijaya + +* Timothy Willard + +* Josh Wilson +* Kentaro Yamamoto + +* Dave Zbarsky + + +A total of 142 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +## [Issues closed for 1.4.0](#id28)[#](#issues-closed-for-1-4-0 "Link to this heading") + +* [#1255](https://github.com/scipy/scipy/issues/1255): maxiter broken for Scipy.sparse.linalg gmres, in addition to… +* [#1301](https://github.com/scipy/scipy/issues/1301): consolidate multipack.h from interpolate and integrate packages… +* [#1739](https://github.com/scipy/scipy/issues/1739): Single precision FFT insufficiently accurate. (Trac #1212) +* [#1795](https://github.com/scipy/scipy/issues/1795): stats test\_distributions.py: replace old fuzz tests (Trac #1269) +* [#2233](https://github.com/scipy/scipy/issues/2233): fftpack segfault with big arrays (Trac #1714) +* [#2434](https://github.com/scipy/scipy/issues/2434): rmatmat and the sophistication of linear operator objects +* [#2477](https://github.com/scipy/scipy/issues/2477): stats.truncnorm.rvs() does not give symmetric results for negative… +* [#2629](https://github.com/scipy/scipy/issues/2629): FFTpack is unacceptably slow on non power of 2 +* [#2883](https://github.com/scipy/scipy/issues/2883): UnboundLocalError in scipy.interpolate.splrep +* [#2956](https://github.com/scipy/scipy/issues/2956): Feature Request: axis argument for stats.entropy function +* [#3528](https://github.com/scipy/scipy/issues/3528): Segfault on test\_djbfft (possibly MKL-related?) +* [#3793](https://github.com/scipy/scipy/issues/3793): cwt should also return complex array +* [#4464](https://github.com/scipy/scipy/issues/4464): TST: residue/residuez/invres/invresz don’t have any tests +* [#4561](https://github.com/scipy/scipy/issues/4561): BUG: tf filter trailing and leading zeros in residuez +* [#4669](https://github.com/scipy/scipy/issues/4669): Rewrite sosfilt to make a single loop over the input? +* [#5040](https://github.com/scipy/scipy/issues/5040): BUG: Empty data handling of (c)KDTrees +* [#5112](https://github.com/scipy/scipy/issues/5112): boxcox transform edge cases could use more care +* [#5441](https://github.com/scipy/scipy/issues/5441): scipy.stats.ncx2 fails for nc=0 +* [#5502](https://github.com/scipy/scipy/issues/5502): args keyword not handled in optimize.curve\_fit +* [#6484](https://github.com/scipy/scipy/issues/6484): Qhull segmentation fault +* [#6900](https://github.com/scipy/scipy/issues/6900): linear\_sum\_assignment with infinite weights +* [#6966](https://github.com/scipy/scipy/issues/6966): Hypergeometric Functions documentation is lacking +* [#6999](https://github.com/scipy/scipy/issues/6999): possible false positive corruption check in compressed loadmat() +* [#7018](https://github.com/scipy/scipy/issues/7018): ydata that needs broadcasting renders curve\_fit unable to compute… +* [#7140](https://github.com/scipy/scipy/issues/7140): trouble with documentation for windows +* [#7327](https://github.com/scipy/scipy/issues/7327): interpolate.ndgriddata.griddata causes Python to crash rather… +* [#7396](https://github.com/scipy/scipy/issues/7396): MatrixLinearOperator implements \_adjoint(), but not \_transpose() +* [#7400](https://github.com/scipy/scipy/issues/7400): BUG(?): special: factorial and factorial2 return a 0-dimensional… +* [#7434](https://github.com/scipy/scipy/issues/7434): Testing of scipy.stats continuous distributions misses 25 distributions +* [#7491](https://github.com/scipy/scipy/issues/7491): Several scipy.stats distributions (fisk, burr, burr12, f) return… +* [#7759](https://github.com/scipy/scipy/issues/7759): Overflow in stats.kruskal for large samples +* [#7906](https://github.com/scipy/scipy/issues/7906): Wrong result from scipy.interpolate.UnivariateSpline.integral… +* [#8165](https://github.com/scipy/scipy/issues/8165): ENH: match functionality of R for hmean +* [#8417](https://github.com/scipy/scipy/issues/8417): optimimze.minimize(method=’L-BFGS-B’, options={‘disp’: True})… +* [#8535](https://github.com/scipy/scipy/issues/8535): Strictly increasing requirement in UnivariateSpline +* [#8815](https://github.com/scipy/scipy/issues/8815): [BUG] GMRES: number of iteration is only increased if callback… +* [#9207](https://github.com/scipy/scipy/issues/9207): scipy.linalg.solve\_triangular speed after scipy.linalg.lu\_factor +* [#9275](https://github.com/scipy/scipy/issues/9275): new feature: adding LOBPCG solver in svds in addition to ARPACK +* [#9403](https://github.com/scipy/scipy/issues/9403): range of truncnorm.logpdf could be extended +* [#9429](https://github.com/scipy/scipy/issues/9429): gaussian\_kde not working with numpy matrix +* [#9515](https://github.com/scipy/scipy/issues/9515): ndimage implementation relies on undefined behavior +* [#9643](https://github.com/scipy/scipy/issues/9643): arpack returns singular values in ascending order +* [#9669](https://github.com/scipy/scipy/issues/9669): DOC: matthew-brett/build-openblas has been retired +* [#9852](https://github.com/scipy/scipy/issues/9852): scipy.spatial.ConvexHull exit with code 134, free(): invalid… +* [#9902](https://github.com/scipy/scipy/issues/9902): scipy.stats.truncnorm second moment may be wrong +* [#9943](https://github.com/scipy/scipy/issues/9943): Custom sampling methods in shgo do not work +* [#9947](https://github.com/scipy/scipy/issues/9947): DOC: Incorrect documentation for `nan\_policy=’propagate` in… +* [#9994](https://github.com/scipy/scipy/issues/9994): BUG: sparse: reshape method allows a shape containing an arbitrary… +* [#10036](https://github.com/scipy/scipy/issues/10036): Official Nelder mead tutorial uses xtol instead of xatol, which… +* [#10078](https://github.com/scipy/scipy/issues/10078): possible to get a better error message when objective function… +* [#10092](https://github.com/scipy/scipy/issues/10092): overflow in truncnorm.rvs +* [#10121](https://github.com/scipy/scipy/issues/10121): A little spelling mistake +* [#10126](https://github.com/scipy/scipy/issues/10126): inaccurate std implementation in binned\_statistic +* [#10161](https://github.com/scipy/scipy/issues/10161): Error in documentation scipy.special.modstruve +* [#10195](https://github.com/scipy/scipy/issues/10195): Derivative of spline with ‘const’ extrapolation is also extrapolted… +* [#10206](https://github.com/scipy/scipy/issues/10206): sparse matrices indexing with scipy 1.3 +* [#10236](https://github.com/scipy/scipy/issues/10236): Non-descriptive error on type mismatch for functions of scipy.optimize… +* [#10258](https://github.com/scipy/scipy/issues/10258): LOBPCG convergence failure if guess provided +* [#10262](https://github.com/scipy/scipy/issues/10262): distance matrix lacks dtype checks / warnings +* [#10271](https://github.com/scipy/scipy/issues/10271): BUG: optimize failure on wheels +* [#10277](https://github.com/scipy/scipy/issues/10277): scipy.special.zeta(0) = NAN +* [#10292](https://github.com/scipy/scipy/issues/10292): DOC/REL: Some sections of the release notes are not nested correctly. +* [#10300](https://github.com/scipy/scipy/issues/10300): scipy.stats.rv\_continuous.fit throws empty RuntimeError when… +* [#10319](https://github.com/scipy/scipy/issues/10319): events in scipy.integrate.solve\_ivp: How do I setup an events… +* [#10323](https://github.com/scipy/scipy/issues/10323): Adding more low-level LAPACK wrappers +* [#10360](https://github.com/scipy/scipy/issues/10360): firwin2 inadvertently modifies input and may result in undefined… +* [#10388](https://github.com/scipy/scipy/issues/10388): BLD: TestHerd::test\_hetrd core dumps with Python-dbg +* [#10395](https://github.com/scipy/scipy/issues/10395): Remove warning about output shape of zoom +* [#10403](https://github.com/scipy/scipy/issues/10403): DOC: scipy.signal.resample ignores t parameter +* [#10421](https://github.com/scipy/scipy/issues/10421): Yeo-Johnson power transformation fails with integer input data +* [#10422](https://github.com/scipy/scipy/issues/10422): BUG: scipy.fft does not support multiprocessing +* [#10427](https://github.com/scipy/scipy/issues/10427): ENH: convolve numbers should be updated +* [#10444](https://github.com/scipy/scipy/issues/10444): BUG: scipy.spatial.transform.Rotation.match\_vectors returns improper… +* [#10488](https://github.com/scipy/scipy/issues/10488): ENH: DCTs/DSTs for scipy.fft +* [#10501](https://github.com/scipy/scipy/issues/10501): BUG: scipy.spatial.HalfspaceIntersection works incorrectly +* [#10514](https://github.com/scipy/scipy/issues/10514): BUG: cKDTree GIL handling is incorrect +* [#10535](https://github.com/scipy/scipy/issues/10535): TST: master branch CI failures +* [#10588](https://github.com/scipy/scipy/issues/10588): scipy.fft and numpy.fft inconsistency when axes=None and shape… +* [#10628](https://github.com/scipy/scipy/issues/10628): Scipy python>3.6 Windows wheels don’t ship msvcp\*.dll +* [#10733](https://github.com/scipy/scipy/issues/10733): DOC/BUG: min\_only result does not match documentation +* [#10774](https://github.com/scipy/scipy/issues/10774): min\_only=true djisktra infinite loop with duplicate indices +* [#10775](https://github.com/scipy/scipy/issues/10775): UnboundLocalError in Radau when given a NaN +* [#10835](https://github.com/scipy/scipy/issues/10835): io.wavfile.read unnecessarily raises an error for a bad wav header +* [#10838](https://github.com/scipy/scipy/issues/10838): Error in documentation for scipy.linalg.lu\_factor +* [#10875](https://github.com/scipy/scipy/issues/10875): DOC: Graphical guides (using TikZ) +* [#10880](https://github.com/scipy/scipy/issues/10880): setting verbose > 2 in minimize with trust-constr method leads… +* [#10887](https://github.com/scipy/scipy/issues/10887): scipy.signal.signaltools.\_fftconv\_faster has incorrect estimates +* [#10948](https://github.com/scipy/scipy/issues/10948): gammainc(0,x) = nan but should be 1, gammaincc(0,x) = nan but… +* [#10952](https://github.com/scipy/scipy/issues/10952): TestQRdelete\_F.test\_delete\_last\_p\_col test failure +* [#10968](https://github.com/scipy/scipy/issues/10968): API: Change normalized=False to normalize=True in Rotation +* [#10987](https://github.com/scipy/scipy/issues/10987): Memory leak in shgo triangulation +* [#10991](https://github.com/scipy/scipy/issues/10991): Error running openBlas probably missing a step +* [#11033](https://github.com/scipy/scipy/issues/11033): deadlock on osx for python 3.8 +* [#11041](https://github.com/scipy/scipy/issues/11041): Test failure in wheel builds for TestTf2zpk.test\_simple +* [#11089](https://github.com/scipy/scipy/issues/11089): Regression in scipy.stats where distribution will not accept loc and scale parameters +* [#11100](https://github.com/scipy/scipy/issues/11100): BUG: multiscale\_graphcorr random state seeding and parallel use +* [#11121](https://github.com/scipy/scipy/issues/11121): Calls to [`scipy.interpolate.splprep`](../reference/generated/scipy.interpolate.splprep.html#scipy.interpolate.splprep "scipy.interpolate.splprep") increase RAM usage. +* [#11125](https://github.com/scipy/scipy/issues/11125): BUG: segfault when slicing a CSR or CSC sparse matrix with slice start index > stop index +* [#11198](https://github.com/scipy/scipy/issues/11198): BUG: sparse eigs (arpack) shift-invert drops the smallest eigenvalue for some k + +## [Pull requests for 1.4.0](#id29)[#](#pull-requests-for-1-4-0 "Link to this heading") + +* [#4591](https://github.com/scipy/scipy/pull/4591): BUG, TST: Several issues with scipy.signal.residue +* [#6629](https://github.com/scipy/scipy/pull/6629): ENH: sparse: canonicalize on initialization +* [#7076](https://github.com/scipy/scipy/pull/7076): ENH: add complex wavelet support to scipy.signal.cwt. +* [#8681](https://github.com/scipy/scipy/pull/8681): ENH add generalized inverse Gaussian distribution to scipy.stats +* [#9064](https://github.com/scipy/scipy/pull/9064): BUG/ENH: Added default \_transpose into LinearOperator. Fixes… +* [#9215](https://github.com/scipy/scipy/pull/9215): ENH: Rbf interpolation of large multi-dimensional data +* [#9311](https://github.com/scipy/scipy/pull/9311): ENH: Added voigt in scipy.special. +* [#9642](https://github.com/scipy/scipy/pull/9642): ENH: integrate: quad() for vector-valued functions +* [#9679](https://github.com/scipy/scipy/pull/9679): DOC: expand docstring of exponweib distribution +* [#9684](https://github.com/scipy/scipy/pull/9684): TST: add ppc64le ci testing +* [#9800](https://github.com/scipy/scipy/pull/9800): WIP : ENH: Refactored \_hungarian.py for speed and added a minimize/maximize… +* [#9847](https://github.com/scipy/scipy/pull/9847): DOC: Change integrate tutorial to use solve\_ivp instead of odeint +* [#9876](https://github.com/scipy/scipy/pull/9876): ENH: Use rfft when possible in resampling +* [#9998](https://github.com/scipy/scipy/pull/9998): BUG: Do not remove 1s when calling sparse: reshape method #9994 +* [#10002](https://github.com/scipy/scipy/pull/10002): ENH: adds constraints for differential evolution +* [#10098](https://github.com/scipy/scipy/pull/10098): ENH: integrate: add args argument to solve\_ivp. +* [#10099](https://github.com/scipy/scipy/pull/10099): DOC: Add missing docs for linprog unknown\_options +* [#10104](https://github.com/scipy/scipy/pull/10104): BUG: Rewrite of stats.truncnorm distribution. +* [#10105](https://github.com/scipy/scipy/pull/10105): MAINT improve efficiency of rvs\_ratio\_uniforms in scipy.stats +* [#10107](https://github.com/scipy/scipy/pull/10107): TST: dual\_annealing set seed +* [#10108](https://github.com/scipy/scipy/pull/10108): ENH: stats: improve kendall\_tau cache usage +* [#10110](https://github.com/scipy/scipy/pull/10110): MAINT: \_lib: Fix a build warning. +* [#10114](https://github.com/scipy/scipy/pull/10114): FIX: only print bounds when supported by minimizer (shgo) +* [#10115](https://github.com/scipy/scipy/pull/10115): TST: Add a test with an almost singular design matrix for lsq\_linear +* [#10118](https://github.com/scipy/scipy/pull/10118): MAINT: fix rdist methods in scipy.stats +* [#10119](https://github.com/scipy/scipy/pull/10119): MAINT: improve rvs of randint in scipy.stats +* [#10127](https://github.com/scipy/scipy/pull/10127): Fix typo in record array field name (spatial-ckdtree-sparse\_distance… +* [#10130](https://github.com/scipy/scipy/pull/10130): MAINT: ndimage: Fix some compiler warnings. +* [#10131](https://github.com/scipy/scipy/pull/10131): DOC: Note the solve\_ivp args enhancement in the 1.4.0 release… +* [#10133](https://github.com/scipy/scipy/pull/10133): MAINT: add rvs for semicircular in scipy.stats +* [#10138](https://github.com/scipy/scipy/pull/10138): BUG: special: Invalid arguments to ellip\_harm can crash Python. +* [#10139](https://github.com/scipy/scipy/pull/10139): MAINT: spatial: Fix some compiler warnings in the file distance\_wrap.c. +* [#10140](https://github.com/scipy/scipy/pull/10140): ENH: add handling of NaN in RuntimeWarning except clause +* [#10142](https://github.com/scipy/scipy/pull/10142): DOC: return value of scipy.special.comb +* [#10143](https://github.com/scipy/scipy/pull/10143): MAINT: Loosen linprog tol +* [#10152](https://github.com/scipy/scipy/pull/10152): BUG: Fix custom sampling input for shgo, add unittest +* [#10154](https://github.com/scipy/scipy/pull/10154): MAINT: add moments and improve doc of mielke in scipy.stats +* [#10158](https://github.com/scipy/scipy/pull/10158): Issue #6999: read zlib checksum before checking bytes read. +* [#10166](https://github.com/scipy/scipy/pull/10166): BUG: Correctly handle broadcasted ydata in curve\_fit pcov computation. +* [#10167](https://github.com/scipy/scipy/pull/10167): DOC: special: Add missing factor of `i` to `modstruve` docstring +* [#10168](https://github.com/scipy/scipy/pull/10168): MAINT: stats: Fix an incorrect comment. +* [#10169](https://github.com/scipy/scipy/pull/10169): ENH: optimize: Clarify error when objective function returns… +* [#10172](https://github.com/scipy/scipy/pull/10172): DEV: Run tests in parallel when –parallel flag is passed to… +* [#10173](https://github.com/scipy/scipy/pull/10173): ENH: Implement DOP853 ODE integrator +* [#10176](https://github.com/scipy/scipy/pull/10176): Fixed typo +* [#10182](https://github.com/scipy/scipy/pull/10182): TST: fix test issue for stats.pearsonr +* [#10184](https://github.com/scipy/scipy/pull/10184): MAINT: stats: Simplify zmap and zscore (we can use keepdims now). +* [#10191](https://github.com/scipy/scipy/pull/10191): DOC: fix a formatting issue in the scipy.spatial module docstring. +* [#10193](https://github.com/scipy/scipy/pull/10193): DOC: Updated docstring for optimize.nnls +* [#10198](https://github.com/scipy/scipy/pull/10198): DOC, ENH: special: Make `hyp2f1` references more specific +* [#10202](https://github.com/scipy/scipy/pull/10202): DOC: Format DST and DCT definitions as latex equations +* [#10207](https://github.com/scipy/scipy/pull/10207): BUG: Compressed matrix indexing should return a scalar +* [#10210](https://github.com/scipy/scipy/pull/10210): DOC: Update docs for connection=’weak’ in connected\_components +* [#10225](https://github.com/scipy/scipy/pull/10225): DOC: Clarify new interfaces for legacy functions in ‘optimize’ +* [#10231](https://github.com/scipy/scipy/pull/10231): DOC, MAINT: gpg2 updates to release docs / pavement +* [#10235](https://github.com/scipy/scipy/pull/10235): LICENSE: split license file in standard BSD 3-clause and bundled. +* [#10238](https://github.com/scipy/scipy/pull/10238): ENH: Add new scipy.fft module using pocketfft +* [#10243](https://github.com/scipy/scipy/pull/10243): BUG: fix ARFF reader regression with quoted values. +* [#10248](https://github.com/scipy/scipy/pull/10248): DOC: update README file +* [#10255](https://github.com/scipy/scipy/pull/10255): CI: bump OpenBLAS to match wheels +* [#10264](https://github.com/scipy/scipy/pull/10264): TST: add tests for stats.tvar with unflattened arrays +* [#10280](https://github.com/scipy/scipy/pull/10280): MAINT: stats: Use a constant value for sqrt(2/PI). +* [#10286](https://github.com/scipy/scipy/pull/10286): Development Documentation Overhaul +* [#10290](https://github.com/scipy/scipy/pull/10290): MAINT: Deprecate NumPy functions in SciPy root +* [#10291](https://github.com/scipy/scipy/pull/10291): FIX: Avoid importing xdist when checking for availability +* [#10295](https://github.com/scipy/scipy/pull/10295): Disable deprecated Numpy API in \_\_odrpack.c +* [#10296](https://github.com/scipy/scipy/pull/10296): ENH: C++ extension for linear assignment problem +* [#10298](https://github.com/scipy/scipy/pull/10298): ENH: Made pade function work with complex inputs +* [#10301](https://github.com/scipy/scipy/pull/10301): DOC: Fix critical value significance levels in stats.anderson\_ksamp +* [#10307](https://github.com/scipy/scipy/pull/10307): Minkowski Distance Type Fix (issue #10262) +* [#10309](https://github.com/scipy/scipy/pull/10309): BUG: Pass jac=None directly to lsoda +* [#10310](https://github.com/scipy/scipy/pull/10310): BUG: interpolate: UnivariateSpline.derivative.ext is ‘zeros’… +* [#10312](https://github.com/scipy/scipy/pull/10312): FIX: Fixing a typo in a comment +* [#10314](https://github.com/scipy/scipy/pull/10314): scipy.spatial enhancement request +* [#10315](https://github.com/scipy/scipy/pull/10315): DOC: Update integration tutorial to solve\_ivp +* [#10318](https://github.com/scipy/scipy/pull/10318): DOC: update the example for PPoly.solve +* [#10333](https://github.com/scipy/scipy/pull/10333): TST: add tests for stats.tvar with unflattened arrays +* [#10334](https://github.com/scipy/scipy/pull/10334): MAINT: special: Remove deprecated `hyp2f0`, `hyp1f2`, and… +* [#10336](https://github.com/scipy/scipy/pull/10336): BUG: linalg/interpolative: fix interp\_decomp modifying input +* [#10341](https://github.com/scipy/scipy/pull/10341): BUG: sparse.linalg/gmres: deprecate effect of callback on semantics… +* [#10344](https://github.com/scipy/scipy/pull/10344): DOC: improve wording of mathematical formulation +* [#10345](https://github.com/scipy/scipy/pull/10345): ENH: Tiled QR wrappers for scipy.linalg.lapack +* [#10350](https://github.com/scipy/scipy/pull/10350): MAINT: linalg: Use the new fft subpackage in linalg.dft test… +* [#10351](https://github.com/scipy/scipy/pull/10351): BUG: Fix unstable standard deviation calculation in histogram +* [#10353](https://github.com/scipy/scipy/pull/10353): Bug: interpolate.NearestNDInterpolator (issue #10352) +* [#10357](https://github.com/scipy/scipy/pull/10357): DOC: linalg: Refer to scipy.fft.fft (not fftpack) in the dft… +* [#10359](https://github.com/scipy/scipy/pull/10359): DOC: Update roadmap now scipy.fft has been merged +* [#10361](https://github.com/scipy/scipy/pull/10361): ENH: Prefer scipy.fft to scipy.fftpack in scipy.signal +* [#10371](https://github.com/scipy/scipy/pull/10371): DOC: Tweaks to fft documentation +* [#10372](https://github.com/scipy/scipy/pull/10372): DOC: Fix typos +* [#10377](https://github.com/scipy/scipy/pull/10377): TST, MAINT: adjustments for pytest 5.0 +* [#10378](https://github.com/scipy/scipy/pull/10378): ENH: \_lib: allow new np.random.Generator in check\_random\_state +* [#10379](https://github.com/scipy/scipy/pull/10379): BUG: sparse: set writeability to be forward-compatible with numpy>=1.17 +* [#10381](https://github.com/scipy/scipy/pull/10381): BUG: Fixes gh-7491, pdf at x=0 of fisk/burr/burr12/f distributions. +* [#10387](https://github.com/scipy/scipy/pull/10387): ENH: optimize/bfgs: don’t evaluate twice at initial point for… +* [#10392](https://github.com/scipy/scipy/pull/10392): [DOC] Add an example for \_binned\_statistic\_dd +* [#10396](https://github.com/scipy/scipy/pull/10396): Remove warning about output shape of zoom +* [#10397](https://github.com/scipy/scipy/pull/10397): ENH: Add check\_finite to sp.linalg.norm +* [#10399](https://github.com/scipy/scipy/pull/10399): ENH: Add \_\_round\_\_ method to sparse matrix +* [#10407](https://github.com/scipy/scipy/pull/10407): MAINT: drop pybind11 from install\_requires, it’s only build-time… +* [#10408](https://github.com/scipy/scipy/pull/10408): TST: use pytest.raises, not numpy assert\_raises +* [#10409](https://github.com/scipy/scipy/pull/10409): CI: uninstall nose on Travis +* [#10410](https://github.com/scipy/scipy/pull/10410): [ENH] ncx2 dispatch to chi2 when nc=0 +* [#10411](https://github.com/scipy/scipy/pull/10411): TST: optimize: test should use assert\_allclose for fp comparisons +* [#10414](https://github.com/scipy/scipy/pull/10414): DOC: add pybind11 to the other part of quickstart guides +* [#10417](https://github.com/scipy/scipy/pull/10417): DOC: special: don’t mark non-ufuncs with a `[+]` +* [#10423](https://github.com/scipy/scipy/pull/10423): FIX: Use pybind11::isinstace to check array dtypes +* [#10424](https://github.com/scipy/scipy/pull/10424): DOC: add doctest example for binary data for ttest\_ind\_from\_stats +* [#10425](https://github.com/scipy/scipy/pull/10425): ENH: Add missing Hermitian transforms to scipy.fft +* [#10426](https://github.com/scipy/scipy/pull/10426): MAINT: Fix doc build bugs +* [#10431](https://github.com/scipy/scipy/pull/10431): Update numpy version for AIX +* [#10433](https://github.com/scipy/scipy/pull/10433): MAINT: Minor fixes for the stats +* [#10434](https://github.com/scipy/scipy/pull/10434): BUG: special: make `ndtri` return NaN outside domain of definition +* [#10435](https://github.com/scipy/scipy/pull/10435): BUG: Allow integer input data in scipy.stats.yeojohnson +* [#10438](https://github.com/scipy/scipy/pull/10438): [DOC] Add example for kurtosis +* [#10440](https://github.com/scipy/scipy/pull/10440): ENH: special: make `ellipk` a ufunc +* [#10443](https://github.com/scipy/scipy/pull/10443): MAINT: ndimage: malloc fail check +* [#10447](https://github.com/scipy/scipy/pull/10447): BLD: Divert output from test compiles into a temporary directory +* [#10451](https://github.com/scipy/scipy/pull/10451): MAINT: signal: malloc fail check +* [#10455](https://github.com/scipy/scipy/pull/10455): BUG: special: fix values of `hyperu` for negative `x` +* [#10456](https://github.com/scipy/scipy/pull/10456): DOC: Added comment clarifying the call for dcsrch.f in lbfgsb.f +* [#10457](https://github.com/scipy/scipy/pull/10457): BUG: Allow ckdtree to accept empty data input +* [#10459](https://github.com/scipy/scipy/pull/10459): BUG:TST: Compute lwork safely +* [#10460](https://github.com/scipy/scipy/pull/10460): [DOC] Add example to entropy +* [#10461](https://github.com/scipy/scipy/pull/10461): DOC: Quickstart Guide updates +* [#10462](https://github.com/scipy/scipy/pull/10462): TST: special: only show max atol/rtol for test points that failed +* [#10465](https://github.com/scipy/scipy/pull/10465): BUG: Correctly align fft inputs +* [#10467](https://github.com/scipy/scipy/pull/10467): ENH: lower-memory duplicate generator checking in spatial.SphericalVoronoi +* [#10470](https://github.com/scipy/scipy/pull/10470): ENH: Normalise the inverse DCT/DST in scipy.fft +* [#10472](https://github.com/scipy/scipy/pull/10472): BENCH: adjust timeout for slow setup\_cache +* [#10475](https://github.com/scipy/scipy/pull/10475): CI: include python debug for Travis-ci +* [#10476](https://github.com/scipy/scipy/pull/10476): TST: special: use `\_\_tracebackhide\_\_` to get better error messages +* [#10477](https://github.com/scipy/scipy/pull/10477): ENH: faster region building in spatial.SphericalVoronoi +* [#10479](https://github.com/scipy/scipy/pull/10479): BUG: stats: Fix a few issues with the distributions’ fit method. +* [#10480](https://github.com/scipy/scipy/pull/10480): Add RuntimeError in \_distn\_infrastructure.py in fit() method +* [#10481](https://github.com/scipy/scipy/pull/10481): BENCH, MAINT: wheel\_cache\_size has been renamed build\_cache\_size +* [#10494](https://github.com/scipy/scipy/pull/10494): ENH: faster circumcenter calculation in spatial.SphericalVoronoi +* [#10500](https://github.com/scipy/scipy/pull/10500): Splrep \_curfit\_cache global variable bugfix +* [#10503](https://github.com/scipy/scipy/pull/10503): BUG: spatial/qhull: get HalfspaceIntersection.dual\_points from… +* [#10506](https://github.com/scipy/scipy/pull/10506): DOC: interp2d, note nearest neighbor extrapolation +* [#10507](https://github.com/scipy/scipy/pull/10507): MAINT: Remove fortran fftpack library in favour of pypocketfft +* [#10508](https://github.com/scipy/scipy/pull/10508): TST: fix a bug in the circular import test. +* [#10509](https://github.com/scipy/scipy/pull/10509): MAINT: Set up \_build\_utils as subpackage +* [#10516](https://github.com/scipy/scipy/pull/10516): BUG: Use nogil contexts in cKDTree +* [#10517](https://github.com/scipy/scipy/pull/10517): ENH: fftconvolve should not FFT broadcastable axes +* [#10518](https://github.com/scipy/scipy/pull/10518): ENH: Speedup fftconvolve +* [#10520](https://github.com/scipy/scipy/pull/10520): DOC: Proper .rst formatting for deprecated features and Backwards… +* [#10523](https://github.com/scipy/scipy/pull/10523): DOC: Improve scipy.signal.resample documentation +* [#10524](https://github.com/scipy/scipy/pull/10524): ENH: Add MGC to scipy.stats +* [#10525](https://github.com/scipy/scipy/pull/10525): [ENH] ncx2.ppf dispatch to chi2 when nc=0 +* [#10526](https://github.com/scipy/scipy/pull/10526): DOC: clarify laplacian normalization +* [#10528](https://github.com/scipy/scipy/pull/10528): API: Rename scipy.fft DCT/DST shape argument to s +* [#10531](https://github.com/scipy/scipy/pull/10531): BUG: fixed improper rotations in spatial.transform.rotation.match\_vectors +* [#10533](https://github.com/scipy/scipy/pull/10533): [DOC] Add example for winsorize function +* [#10539](https://github.com/scipy/scipy/pull/10539): MAINT: special: don’t register `i0` with `numpy.dual` +* [#10540](https://github.com/scipy/scipy/pull/10540): MAINT: Fix Travis and Circle +* [#10542](https://github.com/scipy/scipy/pull/10542): MAINT: interpolate: use cython\_lapack +* [#10547](https://github.com/scipy/scipy/pull/10547): Feature request. Add furthest site Voronoi diagrams to scipy.spatial.plotutils. +* [#10549](https://github.com/scipy/scipy/pull/10549): [BUG] Fix bug in trimr when inclusive=False +* [#10552](https://github.com/scipy/scipy/pull/10552): add scipy.signal.upfirdn signal extension modes +* [#10555](https://github.com/scipy/scipy/pull/10555): MAINT: special: move `c\_misc` into Cephes +* [#10556](https://github.com/scipy/scipy/pull/10556): [DOC] Add example for trima +* [#10562](https://github.com/scipy/scipy/pull/10562): [DOC] Fix triple string fo trimmed so that \_\_doc\_\_ can show… +* [#10563](https://github.com/scipy/scipy/pull/10563): improve least\_squares error msg for mismatched shape +* [#10564](https://github.com/scipy/scipy/pull/10564): ENH: linalg: memoize get\_lapack/blas\_funcs to speed it up +* [#10566](https://github.com/scipy/scipy/pull/10566): ENH: add implementation of solver for the maximum flow problem +* [#10567](https://github.com/scipy/scipy/pull/10567): BUG: spatial: use c++11 construct for getting start of vector… +* [#10568](https://github.com/scipy/scipy/pull/10568): DOC: special: small tweaks to the `zetac` docstring +* [#10571](https://github.com/scipy/scipy/pull/10571): [ENH] Gaussian\_kde can accept matrix dataset +* [#10574](https://github.com/scipy/scipy/pull/10574): ENH: linalg: speed up \_compute\_lwork by avoiding numpy constructs +* [#10582](https://github.com/scipy/scipy/pull/10582): Fix typos with typos in bundled libraries reverted +* [#10583](https://github.com/scipy/scipy/pull/10583): ENH: special: add the analytic continuation of Riemann zeta +* [#10584](https://github.com/scipy/scipy/pull/10584): MAINT: special: clean up `special.\_\_all\_\_` +* [#10586](https://github.com/scipy/scipy/pull/10586): BUG: multidimensional scipy.fft functions should accept ‘s’ rather… +* [#10587](https://github.com/scipy/scipy/pull/10587): BUG: integrate/lsoda: never abort run, set error istate instead +* [#10594](https://github.com/scipy/scipy/pull/10594): API: Replicate numpy’s fftn behaviour when s is given but not… +* [#10599](https://github.com/scipy/scipy/pull/10599): DOC: dev: update documentation vs. github pull request workflow… +* [#10603](https://github.com/scipy/scipy/pull/10603): MAINT: installer scripts removed +* [#10604](https://github.com/scipy/scipy/pull/10604): MAINT: Change c\*np.ones(…) to np.full(…, c, …) in many… +* [#10608](https://github.com/scipy/scipy/pull/10608): Univariate splines should require x to be strictly increasing… +* [#10613](https://github.com/scipy/scipy/pull/10613): ENH: Add seed option for gaussian\_kde.resample +* [#10614](https://github.com/scipy/scipy/pull/10614): ENH: Add parallel computation to scipy.fft +* [#10615](https://github.com/scipy/scipy/pull/10615): MAINT: interpolate: remove unused header file +* [#10616](https://github.com/scipy/scipy/pull/10616): MAINT: Clean up 32-bit platform xfail markers +* [#10618](https://github.com/scipy/scipy/pull/10618): BENCH: Added ‘trust-constr’ to minimize benchmarks +* [#10621](https://github.com/scipy/scipy/pull/10621): [MRG] multiple stability updates in lobpcg +* [#10622](https://github.com/scipy/scipy/pull/10622): MAINT: forward port 1.3.1 release notes +* [#10624](https://github.com/scipy/scipy/pull/10624): DOC: stats: Fix spelling of ‘support’. +* [#10627](https://github.com/scipy/scipy/pull/10627): DOC: stats: Add references for the alpha distribution. +* [#10629](https://github.com/scipy/scipy/pull/10629): MAINT: special: avoid overflow longer in `zeta` for negative… +* [#10630](https://github.com/scipy/scipy/pull/10630): TST: GH10271, relax test assertion, fixes #10271 +* [#10631](https://github.com/scipy/scipy/pull/10631): DOC: nelder-mean uses xatol fixes #10036 +* [#10633](https://github.com/scipy/scipy/pull/10633): BUG: interpolate: integral(a, b) should be zero when both limits… +* [#10635](https://github.com/scipy/scipy/pull/10635): DOC: special: complete hypergeometric functions documentation +* [#10636](https://github.com/scipy/scipy/pull/10636): BUG: special: use series for `hyp1f1` when it converges rapidly +* [#10641](https://github.com/scipy/scipy/pull/10641): ENH: allow matching of general bipartite graphs +* [#10643](https://github.com/scipy/scipy/pull/10643): ENH: scipy.sparse.linalg.spsolve triangular unit diagonal +* [#10650](https://github.com/scipy/scipy/pull/10650): ENH: Cythonize sosfilt +* [#10654](https://github.com/scipy/scipy/pull/10654): DOC: Vertical alignment of table entries +* [#10655](https://github.com/scipy/scipy/pull/10655): ENH: Dockerfile for scipy development +* [#10660](https://github.com/scipy/scipy/pull/10660): TST: clean up tests for rvs in scipy.stats +* [#10664](https://github.com/scipy/scipy/pull/10664): Throw error on non-finite input for binned\_statistic\_dd() +* [#10665](https://github.com/scipy/scipy/pull/10665): DOC: special: improve the docstrings for `gamma` and `gammasgn` +* [#10669](https://github.com/scipy/scipy/pull/10669): TST: Update scipy.fft real transform tests +* [#10670](https://github.com/scipy/scipy/pull/10670): DOC: Clarify docs and error messages for scipy.signal.butter +* [#10672](https://github.com/scipy/scipy/pull/10672): ENH: return solution attribute when using events in solve\_ivp +* [#10675](https://github.com/scipy/scipy/pull/10675): MAINT: special: add an explicit NaN check for `iv` arguments +* [#10679](https://github.com/scipy/scipy/pull/10679): DOC: special: Add documentation for `beta` function +* [#10681](https://github.com/scipy/scipy/pull/10681): TST: sparse.linalg: fix arnoldi test seed +* [#10682](https://github.com/scipy/scipy/pull/10682): DOC: special: Add documentation for `betainc` function +* [#10684](https://github.com/scipy/scipy/pull/10684): TST: special: require Mpmath 1.1.0 for `test\_hyperu\_around\_0` +* [#10686](https://github.com/scipy/scipy/pull/10686): FIX: sphinx isattributedescriptor is not available in sphinx… +* [#10687](https://github.com/scipy/scipy/pull/10687): DOC: added Docker quickstart guide by @andyfaff +* [#10689](https://github.com/scipy/scipy/pull/10689): DOC: special: clarify format of parameters/returns sections for… +* [#10690](https://github.com/scipy/scipy/pull/10690): DOC: special: improve docstrings of incomplete gamma functions +* [#10692](https://github.com/scipy/scipy/pull/10692): ENH: higher-dimensional input in `spatial.SphericalVoronoi` +* [#10694](https://github.com/scipy/scipy/pull/10694): ENH: ScalarFunction.fun\_and\_grad +* [#10698](https://github.com/scipy/scipy/pull/10698): DOC: special: Add documentation for `betaincinv` +* [#10699](https://github.com/scipy/scipy/pull/10699): MAINT: remove time print lbfgsb fixes #8417 +* [#10701](https://github.com/scipy/scipy/pull/10701): TST, MAINT: bump OpenBLAS to 0.3.7 stable +* [#10702](https://github.com/scipy/scipy/pull/10702): DOC: clarify iterations consume multiple function calls +* [#10703](https://github.com/scipy/scipy/pull/10703): DOC: iprint doc lbfgsb closes #5482 +* [#10708](https://github.com/scipy/scipy/pull/10708): TST: test suggested in gh1758 +* [#10710](https://github.com/scipy/scipy/pull/10710): ENH: Added nan\_policy to circ functions in `stats` +* [#10712](https://github.com/scipy/scipy/pull/10712): ENH: add axis parameter to stats.entropy +* [#10714](https://github.com/scipy/scipy/pull/10714): DOC: Formatting fix rv\_continuous.expect docs +* [#10715](https://github.com/scipy/scipy/pull/10715): DOC: BLD: update doc Makefile for python version; add scipy version… +* [#10717](https://github.com/scipy/scipy/pull/10717): MAINT: modernize doc/Makefile +* [#10719](https://github.com/scipy/scipy/pull/10719): Enable setting minres initial vector +* [#10720](https://github.com/scipy/scipy/pull/10720): DOC: silence random warning in doc build for `stats.binned\_statistic\_dd` +* [#10724](https://github.com/scipy/scipy/pull/10724): DEV: Add doc option to runtests.py +* [#10728](https://github.com/scipy/scipy/pull/10728): MAINT: get rid of gramA, gramB text files that lobpcg tests leave… +* [#10732](https://github.com/scipy/scipy/pull/10732): DOC: add min\_only to docstring for Dijkstra’s algorithm +* [#10734](https://github.com/scipy/scipy/pull/10734): DOC: spell out difference between source and target in shortest… +* [#10735](https://github.com/scipy/scipy/pull/10735): Fix for Python 4 +* [#10739](https://github.com/scipy/scipy/pull/10739): BUG: optimize/slsqp: deal with singular BFGS update +* [#10741](https://github.com/scipy/scipy/pull/10741): ENH: LAPACK wrappers for ?geequ, ?geequb, ?syequb, ?heequb +* [#10742](https://github.com/scipy/scipy/pull/10742): DOC: special: add to the docstring of `gammaln` +* [#10743](https://github.com/scipy/scipy/pull/10743): ENH: special: add a real dispatch for `wrightomega` +* [#10746](https://github.com/scipy/scipy/pull/10746): MAINT: Fix typos in comments, docs and test name +* [#10747](https://github.com/scipy/scipy/pull/10747): Remove spurious quotes +* [#10750](https://github.com/scipy/scipy/pull/10750): MAINT: make cython code more precise +* [#10751](https://github.com/scipy/scipy/pull/10751): MAINT: Check that scipy.linalg.lapack functions are documented +* [#10752](https://github.com/scipy/scipy/pull/10752): MAINT: special: use `sf\_error` in Cephes +* [#10755](https://github.com/scipy/scipy/pull/10755): DOC: cluster: Add ‘See Also’ and ‘Examples’ for kmeans2. +* [#10763](https://github.com/scipy/scipy/pull/10763): MAINT: list of minimize methods +* [#10768](https://github.com/scipy/scipy/pull/10768): BUG: Fix corner case for sos2zpk +* [#10773](https://github.com/scipy/scipy/pull/10773): Fix error type for complex input to scipy.fftpack.rfft and irfft +* [#10776](https://github.com/scipy/scipy/pull/10776): ENH: handle geodesic input in `spatial.SphericalVoronoi` +* [#10777](https://github.com/scipy/scipy/pull/10777): MAINT: minimizer–>custom should handle the kinds of bounds/constrain…… +* [#10781](https://github.com/scipy/scipy/pull/10781): ENH: solve\_triangular C order improvement +* [#10787](https://github.com/scipy/scipy/pull/10787): Fix behavior of `exp1` on branch cut and add docstring +* [#10789](https://github.com/scipy/scipy/pull/10789): DOC: special: add parameters/returns doc sections for erfc/erfcx/erfi +* [#10790](https://github.com/scipy/scipy/pull/10790): Travis CI: sudo is deprecated and Xenial is default distro +* [#10792](https://github.com/scipy/scipy/pull/10792): DOC: special: add full docstring for `expi` +* [#10799](https://github.com/scipy/scipy/pull/10799): DOC: special: add a complete docstring for `expn` +* [#10800](https://github.com/scipy/scipy/pull/10800): Docs edits (GSoD) +* [#10802](https://github.com/scipy/scipy/pull/10802): BUG: fix UnboundLocalError in Radau (scipy#10775) +* [#10804](https://github.com/scipy/scipy/pull/10804): ENH: Speed up next\_fast\_len with LRU cache +* [#10805](https://github.com/scipy/scipy/pull/10805): DOC: Fix unbalanced quotes in signal.place\_poles +* [#10809](https://github.com/scipy/scipy/pull/10809): ENH: Speed up next\_fast\_len +* [#10810](https://github.com/scipy/scipy/pull/10810): ENH: Raise catchable exceptions for bad Fortran files +* [#10811](https://github.com/scipy/scipy/pull/10811): MAINT: optimize: Remove extra variable from \_remove\_redundancy\_dense +* [#10813](https://github.com/scipy/scipy/pull/10813): MAINT: special: Remove unused variables from \_kolmogi and \_smirnovi +* [#10815](https://github.com/scipy/scipy/pull/10815): DOC, API: scipy.stats.reciprocal is “log-uniform” +* [#10816](https://github.com/scipy/scipy/pull/10816): MAINT: special: remove deprecated `bessel\_diff\_formula` +* [#10817](https://github.com/scipy/scipy/pull/10817): DOC: special: complete the docstring for `fresnel` +* [#10820](https://github.com/scipy/scipy/pull/10820): Fixed compiler\_helper.py to allow compilation with ICC on Linux +* [#10823](https://github.com/scipy/scipy/pull/10823): DOC: updated reference guide text for consistency in writing… +* [#10825](https://github.com/scipy/scipy/pull/10825): MAINT: special: change some features of the Voigt function +* [#10828](https://github.com/scipy/scipy/pull/10828): MAINT: integrate: Remove unused variable from init\_callback +* [#10830](https://github.com/scipy/scipy/pull/10830): Adding LOBPCG solver in svds in addition to ARPACK +* [#10837](https://github.com/scipy/scipy/pull/10837): WIP: ENH: reduction function for `spatial.tranform.Rotation`… +* [#10843](https://github.com/scipy/scipy/pull/10843): ENH: Adding optional parameter to stats.zscores to allow for… +* [#10845](https://github.com/scipy/scipy/pull/10845): Rebase kruskal fix +* [#10847](https://github.com/scipy/scipy/pull/10847): remove redundant \_\_getitem\_\_ from scipy.sparse.lil +* [#10848](https://github.com/scipy/scipy/pull/10848): Better handling of empty (not missing) docstrings +* [#10849](https://github.com/scipy/scipy/pull/10849): ENH: implement rmatmat for LinearOperator +* [#10850](https://github.com/scipy/scipy/pull/10850): MAINT : Refactoring lil List of Lists +* [#10851](https://github.com/scipy/scipy/pull/10851): DOC: add a generative art example to the scipy.spatial tutorial. +* [#10852](https://github.com/scipy/scipy/pull/10852): DOC: linalg: fixed gh-10838 unused imports in example deleted +* [#10854](https://github.com/scipy/scipy/pull/10854): DOC: special: add a full docstring for `pdtr` +* [#10861](https://github.com/scipy/scipy/pull/10861): ENH: option to reuse binnumbers in stats.binned\_statistic\_dd +* [#10863](https://github.com/scipy/scipy/pull/10863): DOC: partial standardization and validation of scipy.stats reference… +* [#10865](https://github.com/scipy/scipy/pull/10865): BUG: special: fix incomplete gamma functions for infinite `a` +* [#10866](https://github.com/scipy/scipy/pull/10866): ENH: calculation of mean in spatial.transform.Rotation +* [#10867](https://github.com/scipy/scipy/pull/10867): MAINT: Also store latex directory +* [#10869](https://github.com/scipy/scipy/pull/10869): ENH: Implement overlap-add convolution +* [#10870](https://github.com/scipy/scipy/pull/10870): ENH: Do not raise EOF error if wavfile data read +* [#10876](https://github.com/scipy/scipy/pull/10876): ENH: Add beta-binomial distribution to scipy.stats +* [#10878](https://github.com/scipy/scipy/pull/10878): MAINT: Update R project URL +* [#10883](https://github.com/scipy/scipy/pull/10883): MAINT: (ndimage) More robust check for output being a numpy dtype +* [#10884](https://github.com/scipy/scipy/pull/10884): DOC: Added instructions on adding a new distribution to scipy.stats. +* [#10885](https://github.com/scipy/scipy/pull/10885): [BUG] fix lobpcg with maxiter=None results in Exception +* [#10899](https://github.com/scipy/scipy/pull/10899): ENH: Match R functionality for hmean +* [#10900](https://github.com/scipy/scipy/pull/10900): MAINT: stats: Use keepdims to simplify a few lines in power\_divergence. +* [#10901](https://github.com/scipy/scipy/pull/10901): ENH: sparse/linalg: support pydata/sparse matrices +* [#10907](https://github.com/scipy/scipy/pull/10907): Check whether `maxiter` is integer +* [#10912](https://github.com/scipy/scipy/pull/10912): ENH: warn user that quad() ignores `points=…` when `weight=…`… +* [#10918](https://github.com/scipy/scipy/pull/10918): CI: fix Travis CI py3.8 build +* [#10920](https://github.com/scipy/scipy/pull/10920): MAINT: Update constants to codata 2018 values (second try) +* [#10921](https://github.com/scipy/scipy/pull/10921): ENH: scipy.sparse.lil: tocsr accelerated +* [#10924](https://github.com/scipy/scipy/pull/10924): BUG: Forbid passing ‘args’ as kwarg in scipy.optimize.curve\_fit +* [#10928](https://github.com/scipy/scipy/pull/10928): DOC: Add examples to io.wavfile docstrings +* [#10934](https://github.com/scipy/scipy/pull/10934): typo fix +* [#10935](https://github.com/scipy/scipy/pull/10935): BUG: Avoid undefined behaviour on float to unsigned conversion +* [#10936](https://github.com/scipy/scipy/pull/10936): DOC: Added missing example to stats.mstats.variation +* [#10939](https://github.com/scipy/scipy/pull/10939): ENH: scipy.sparse.lil: tocsr accelerated depending on density +* [#10946](https://github.com/scipy/scipy/pull/10946): BUG: setting verbose > 2 in minimize with trust-constr method… +* [#10947](https://github.com/scipy/scipy/pull/10947): DOC: special: small improvements to the `poch` docstring +* [#10949](https://github.com/scipy/scipy/pull/10949): BUG: fix return type of erlang\_gen.\_argcheck +* [#10951](https://github.com/scipy/scipy/pull/10951): DOC: fixed Ricker wavelet formula +* [#10954](https://github.com/scipy/scipy/pull/10954): BUG: special: fix `factorial` return type for 0-d inputs +* [#10955](https://github.com/scipy/scipy/pull/10955): MAINT: Relax the assert\_unitary atol value +* [#10956](https://github.com/scipy/scipy/pull/10956): WIP: make pdtr(int, double) be pdtr(double, double) +* [#10957](https://github.com/scipy/scipy/pull/10957): BUG: Ensure full binary compatibility of long double test data +* [#10964](https://github.com/scipy/scipy/pull/10964): ENH: Make Slerp callable with a scalar argument +* [#10972](https://github.com/scipy/scipy/pull/10972): BUG: Handle complex gains in zpk2sos +* [#10975](https://github.com/scipy/scipy/pull/10975): TST: skip test\_kendalltau ppc64le +* [#10978](https://github.com/scipy/scipy/pull/10978): BUG: boxcox data dimension and constancy check #5112 +* [#10979](https://github.com/scipy/scipy/pull/10979): API: Rename dcm to (rotation) matrix in Rotation class +* [#10981](https://github.com/scipy/scipy/pull/10981): MAINT: add support for a==0 and x>0 edge case to igam and igamc +* [#10986](https://github.com/scipy/scipy/pull/10986): MAINT: Remove direct imports from numpy in signaltools.py +* [#10988](https://github.com/scipy/scipy/pull/10988): BUG: signal: fixed issue #10360 +* [#10989](https://github.com/scipy/scipy/pull/10989): FIX binned\_statistic\_dd Mac wheel test fails +* [#10990](https://github.com/scipy/scipy/pull/10990): BUG: Fix memory leak in shgo triangulation +* [#10992](https://github.com/scipy/scipy/pull/10992): TST: Relax tolerance in upfirdn test\_modes +* [#10993](https://github.com/scipy/scipy/pull/10993): TST: bump tolerance in optimize tests +* [#10997](https://github.com/scipy/scipy/pull/10997): MAINT: Rework residue and residuez +* [#11001](https://github.com/scipy/scipy/pull/11001): DOC: Updated Windows build tutorial +* [#11004](https://github.com/scipy/scipy/pull/11004): BUG: integrate/quad\_vec: fix several bugs in quad\_vec +* [#11005](https://github.com/scipy/scipy/pull/11005): TST: add Python 3.8 Win CI +* [#11006](https://github.com/scipy/scipy/pull/11006): DOC: special: add a reference for `kl\_div` +* [#11012](https://github.com/scipy/scipy/pull/11012): MAINT: Rework invres and invresz +* [#11015](https://github.com/scipy/scipy/pull/11015): DOC: special: add references for `rel\_entr` +* [#11017](https://github.com/scipy/scipy/pull/11017): DOC: numpydoc validation of morestats.py +* [#11018](https://github.com/scipy/scipy/pull/11018): MAINT: Filter unrelated warning +* [#11031](https://github.com/scipy/scipy/pull/11031): MAINT: update choose\_conv\_method for pocketfft implementation +* [#11034](https://github.com/scipy/scipy/pull/11034): MAINT: TST: Skip tests with multiprocessing that use “spawn”… +* [#11036](https://github.com/scipy/scipy/pull/11036): DOC: update doc/README with some more useful content. +* [#11037](https://github.com/scipy/scipy/pull/11037): DOC: special: add a complete docstring for `rgamma` +* [#11038](https://github.com/scipy/scipy/pull/11038): DOC: special: add a reference for the polygamma function +* [#11042](https://github.com/scipy/scipy/pull/11042): TST: fix tf2zpk test failure due to incorrect complex sorting. +* [#11044](https://github.com/scipy/scipy/pull/11044): MAINT: choose\_conv\_method can choose fftconvolution for longcomplex +* [#11046](https://github.com/scipy/scipy/pull/11046): TST: Reduce tolerance for ppc64le with reference lapack +* [#11048](https://github.com/scipy/scipy/pull/11048): DOC: special: add reference for orthogonal polynomial functions +* [#11049](https://github.com/scipy/scipy/pull/11049): MAINT: proper random number initialization and readability fix +* [#11051](https://github.com/scipy/scipy/pull/11051): MAINT: pep8 cleanup +* [#11054](https://github.com/scipy/scipy/pull/11054): TST: bump test precision for dual\_annealing SLSQP test +* [#11055](https://github.com/scipy/scipy/pull/11055): DOC: special: add a reference for `zeta` +* [#11056](https://github.com/scipy/scipy/pull/11056): API: Deprecated normalized keyword in Rotation +* [#11065](https://github.com/scipy/scipy/pull/11065): DOC: Ubuntu Development Environment Quickstart should not modify… +* [#11066](https://github.com/scipy/scipy/pull/11066): BUG: skip deprecation for numpy top-level types +* [#11067](https://github.com/scipy/scipy/pull/11067): DOC: updated documentation for consistency in writing style +* [#11070](https://github.com/scipy/scipy/pull/11070): DOC: Amendment to Ubuntu Development Environment Quickstart should… +* [#11073](https://github.com/scipy/scipy/pull/11073): DOC: fix 1.4.0 release notes +* [#11081](https://github.com/scipy/scipy/pull/11081): API: Replace Rotation.match\_vectors with align\_vectors +* [#11083](https://github.com/scipy/scipy/pull/11083): DOC: more 1.4.0 release note fixes +* [#11092](https://github.com/scipy/scipy/pull/11092): BUG: stats: fix freezing of some distributions +* [#11096](https://github.com/scipy/scipy/pull/11096): BUG: scipy.sparse.csgraph: fixed issue #10774 +* [#11124](https://github.com/scipy/scipy/pull/11124): fix Cython warnings related to \_stats.pyx +* [#11126](https://github.com/scipy/scipy/pull/11126): BUG: interpolate/fitpack: fix memory leak in splprep +* [#11127](https://github.com/scipy/scipy/pull/11127): Avoid potential segfault in CSR and CSC matrix indexing +* [#11152](https://github.com/scipy/scipy/pull/11152): BUG: Fix random state bug multiscale\_graphcorr +* [#11166](https://github.com/scipy/scipy/pull/11166): BUG: empty sparse slice shapes +* [#11167](https://github.com/scipy/scipy/pull/11167): BUG: redundant fft in signal.resample +* [#11181](https://github.com/scipy/scipy/pull/11181): TST: Fix tolerance of tests for aarch64 +* [#11182](https://github.com/scipy/scipy/pull/11182): TST: Bump up tolerance for test\_maxiter\_worsening +* [#11199](https://github.com/scipy/scipy/pull/11199): BUG: sparse.linalg: mistake in unsymm. real shift-invert ARPACK eigenvalue selection diff --git a/corpus/changelog/scipy_releases/scipy_141.md b/corpus/changelog/scipy_releases/scipy_141.md new file mode 100644 index 0000000000000000000000000000000000000000..2321b7113ed89be6e7b1600d73a2174f37414d17 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_141.md @@ -0,0 +1,31 @@ +# SciPy 1.4.1 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.4.1-notes.html +Version: 1.4.1 + +Contents + +* [SciPy 1.4.1 Release Notes](#scipy-1-4-1-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.4.1](#issues-closed-for-1-4-1) + - [Pull requests for 1.4.1](#pull-requests-for-1-4-1) + +SciPy 1.4.1 is a bug-fix release with no new features +compared to 1.4.0. Importantly, it aims to fix a problem +where an older version of pybind11 may cause a segmentation +fault when imported alongside incompatible libraries. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Ralf Gommers +* Tyler Reddy + +### [Issues closed for 1.4.1](#id3)[#](#issues-closed-for-1-4-1 "Link to this heading") + +* [#11237](https://github.com/scipy/scipy/issues/11237): Seg fault when importing torch + +### [Pull requests for 1.4.1](#id4)[#](#pull-requests-for-1-4-1 "Link to this heading") + +* [#11238](https://github.com/scipy/scipy/pull/11238): BLD: update minimum pybind11 version to 2.4.0. diff --git a/corpus/changelog/scipy_releases/scipy_150.md b/corpus/changelog/scipy_releases/scipy_150.md new file mode 100644 index 0000000000000000000000000000000000000000..105c042af934dc5973403c9bec6140b379c87434 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_150.md @@ -0,0 +1,1153 @@ +# SciPy 1.5.0 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.5.0-notes.html +Version: 1.5.0 + +Contents + +* [SciPy 1.5.0 Release Notes](#scipy-1-5-0-release-notes) + + + [Highlights of this release](#highlights-of-this-release) + + - [New features](#new-features) + + [[`scipy.cluster`](../reference/cluster.html#module-scipy.cluster "scipy.cluster") improvements](#scipy-cluster-improvements) + + [[`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") improvements](#scipy-fft-improvements) + + [[`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") improvements](#scipy-integrate-improvements) + + [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#scipy-interpolate-improvements) + + [[`scipy.io`](../reference/io.html#module-scipy.io "scipy.io") improvements](#scipy-io-improvements) + + [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#scipy-linalg-improvements) + + [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#scipy-ndimage-improvements) + + [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#scipy-optimize-improvements) + + [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#scipy-signal-improvements) + + [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#scipy-sparse-improvements) + + [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#scipy-spatial-improvements) + + [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#scipy-special-improvements) + + [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#scipy-stats-improvements) + + - [Deprecated features](#deprecated-features) + + [[`scipy`](../index.html#module-scipy "scipy") deprecations](#scipy-deprecations) + + [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") changes](#scipy-special-changes) + + [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") changes](#scipy-stats-changes) + + - [Backwards incompatible changes](#backwards-incompatible-changes) + + [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") changes](#scipy-interpolate-changes) + + [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") changes](#scipy-linalg-changes) + + [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") changes](#scipy-signal-changes) + + [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") changes](#id1) + + - [Other changes](#other-changes) + - [Authors](#authors) + + [Issues closed for 1.5.0](#issues-closed-for-1-5-0) + + [Pull requests for 1.5.0](#pull-requests-for-1-5-0) + +SciPy 1.5.0 is the culmination of 6 months of hard work. It contains +many new features, numerous bug-fixes, improved test coverage and better +documentation. There have been a number of deprecations and API changes +in this release, which are documented below. All users are encouraged to +upgrade to this release, as there are a large number of bug-fixes and +optimizations. Before upgrading, we recommend that users check that +their own code does not use deprecated SciPy functionality (to do so, +run your code with `python -Wd` and check for `DeprecationWarning` s). +Our development attention will now shift to bug-fix releases on the +1.5.x branch, and on adding new features on the master branch. + +This release requires Python 3.6+ and NumPy 1.14.5 or greater. + +For running on PyPy, PyPy3 6.0+ and NumPy 1.15.0 are required. + +## [Highlights of this release](#id3)[#](#highlights-of-this-release "Link to this heading") + +* wrappers for more than a dozen new `LAPACK` routines are now available + in [`scipy.linalg.lapack`](../reference/linalg.lapack.html#module-scipy.linalg.lapack "scipy.linalg.lapack") +* Improved support for leveraging 64-bit integer size from linear algebra + backends +* addition of the probability distribution for two-sided one-sample + Kolmogorov-Smirnov tests + +### [New features](#id4)[#](#new-features "Link to this heading") + +## [[`scipy.cluster`](../reference/cluster.html#module-scipy.cluster "scipy.cluster") improvements](#id5)[#](#scipy-cluster-improvements "Link to this heading") + +Initialization of [`scipy.cluster.vq.kmeans2`](../reference/generated/scipy.cluster.vq.kmeans2.html#scipy.cluster.vq.kmeans2 "scipy.cluster.vq.kmeans2") using `minit="++"` had a +quadratic complexity in the number of samples. It has been improved, resulting +in a much faster initialization with quasi-linear complexity. + +[`scipy.cluster.hierarchy.dendrogram`](../reference/generated/scipy.cluster.hierarchy.dendrogram.html#scipy.cluster.hierarchy.dendrogram "scipy.cluster.hierarchy.dendrogram") now respects the `matplotlib` color +palette + +## [[`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") improvements](#id6)[#](#scipy-fft-improvements "Link to this heading") + +A new keyword-only argument `plan` is added to all FFT functions in this +module. It is reserved for passing in a precomputed plan from libraries +providing a FFT backend (such as `PyFFTW` and `mkl-fft`), and it is +currently not used in SciPy. + +## [[`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") improvements](#id7)[#](#scipy-integrate-improvements "Link to this heading") + +## [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#id8)[#](#scipy-interpolate-improvements "Link to this heading") + +## [[`scipy.io`](../reference/io.html#module-scipy.io "scipy.io") improvements](#id9)[#](#scipy-io-improvements "Link to this heading") + +[`scipy.io.wavfile`](../reference/io.html#module-scipy.io.wavfile "scipy.io.wavfile") error messages are more explicit about what’s wrong, and +extraneous bytes at the ends of files are ignored instead of raising an error +when the data has successfully been read. + +[`scipy.io.loadmat`](../reference/generated/scipy.io.loadmat.html#scipy.io.loadmat "scipy.io.loadmat") gained a `simplify_cells` parameter, which if set to +`True` simplifies the structure of the return value if the `.mat` file +contains cell arrays. + +`pathlib.Path` objects are now supported in [`scipy.io`](../reference/io.html#module-scipy.io "scipy.io") Matrix Market I/O +functions + +## [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#id10)[#](#scipy-linalg-improvements "Link to this heading") + +[`scipy.linalg.eigh`](../reference/generated/scipy.linalg.eigh.html#scipy.linalg.eigh "scipy.linalg.eigh") has been improved. Now various `LAPACK` drivers can be +selected at will and also subsets of eigenvalues can be requested via +`subset_by_value` keyword. Another keyword `subset_by_index` is introduced. +Keywords `turbo` and `eigvals` are deprecated. + +Similarly, standard and generalized Hermitian eigenvalue `LAPACK` routines +`?evx` are added and existing ones now have full `_lwork` +counterparts. + +Wrappers for the following `LAPACK` routines have been added to +[`scipy.linalg.lapack`](../reference/linalg.lapack.html#module-scipy.linalg.lapack "scipy.linalg.lapack"): + +* `?getc2`: computes the LU factorization of a general matrix with complete + : pivoting +* `?gesc2`: solves a linear system given an LU factorization from `?getc2` +* `?gejsv`: computes the singular value decomposition of a general matrix + : with higher accuracy calculation of tiny singular values and their + corresponding singular vectors +* `?geqrfp`: computes the QR factorization of a general matrix with + : non-negative elements on the diagonal of R +* `?gtsvx`: solves a linear system with general tridiagonal matrix +* `?gttrf`: computes the LU factorization of a tridiagonal matrix +* `?gttrs`: solves a linear system given an LU factorization from `?gttrf` +* `?ptsvx`: solves a linear system with symmetric positive definite + : tridiagonal matrix +* `?pttrf`: computes the LU factorization of a symmetric positive definite + : tridiagonal matrix +* `?pttrs`: solves a linear system given an LU factorization from `?pttrf` +* `?pteqr`: computes the eigenvectors and eigenvalues of a positive definite + : tridiagonal matrix +* `?tbtrs`: solves a linear system with a triangular banded matrix +* `?csd`: computes the Cosine Sine decomposition of an orthogonal/unitary + : matrix + +Generalized QR factorization routines (`?geqrf`) now have full `_lwork` +counterparts. + +[`scipy.linalg.cossin`](../reference/generated/scipy.linalg.cossin.html#scipy.linalg.cossin "scipy.linalg.cossin") Cosine Sine decomposition of unitary matrices has been +added. + +The function [`scipy.linalg.khatri_rao`](../reference/generated/scipy.linalg.khatri_rao.html#scipy.linalg.khatri_rao "scipy.linalg.khatri_rao"), which computes the Khatri-Rao product, +was added. + +The new function [`scipy.linalg.convolution_matrix`](../reference/generated/scipy.linalg.convolution_matrix.html#scipy.linalg.convolution_matrix "scipy.linalg.convolution_matrix") constructs the Toeplitz +matrix representing one-dimensional convolution. + +## [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#id11)[#](#scipy-ndimage-improvements "Link to this heading") + +## [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#id12)[#](#scipy-optimize-improvements "Link to this heading") + +The finite difference numerical differentiation used in various `minimize` +methods that use gradients has several new features: + +* 2-point, 3-point, or complex step finite differences can be used. Previously + only a 2-step finite difference was available. +* There is now the possibility to use a relative step size, previously only an + absolute step size was available. +* If the `minimize` method uses bounds the numerical differentiation strictly + obeys those limits. +* The numerical differentiation machinery now makes use of a simple cache, + which in some cases can reduce the number of function evaluations. +* `minimize`’s `method= 'powell'` now supports simple bound constraints + +There have been several improvements to [`scipy.optimize.linprog`](../reference/generated/scipy.optimize.linprog.html#scipy.optimize.linprog "scipy.optimize.linprog"): + +* The `linprog` benchmark suite has been expanded considerably. +* `linprog`’s dense pivot-based redundancy removal routine and sparse + presolve are faster +* When `scikit-sparse` is available, solving sparse problems with + `method='interior-point'` is faster + +The caching of values when optimizing a function returning both value and +gradient together has been improved, avoiding repeated function evaluations +when using a `HessianApproximation` such as `BFGS`. + +`differential_evolution` can now use the modern `np.random.Generator` as +well as the legacy `np.random.RandomState` as a seed. + +## [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#id13)[#](#scipy-signal-improvements "Link to this heading") + +A new optional argument `include_nyquist` is added to `freqz` functions in +this module. It is used for including the last frequency (Nyquist frequency). + +[`scipy.signal.find_peaks_cwt`](../reference/generated/scipy.signal.find_peaks_cwt.html#scipy.signal.find_peaks_cwt "scipy.signal.find_peaks_cwt") now accepts a `window_size` parameter for the +size of the window used to calculate the noise floor. + +## [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#id14)[#](#scipy-sparse-improvements "Link to this heading") + +Outer indexing is now faster when using a 2d column vector to select column +indices. + +*scipy.sparse.lil.tocsr* is faster + +Fixed/improved comparisons between pydata sparse arrays and sparse matrices + +BSR format sparse multiplication performance has been improved. + +[`scipy.sparse.linalg.LinearOperator`](../reference/generated/scipy.sparse.linalg.LinearOperator.html#scipy.sparse.linalg.LinearOperator "scipy.sparse.linalg.LinearOperator") has gained the new `ndim` class +attribute + +## [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#id15)[#](#scipy-spatial-improvements "Link to this heading") + +[`scipy.spatial.geometric_slerp`](../reference/generated/scipy.spatial.geometric_slerp.html#scipy.spatial.geometric_slerp "scipy.spatial.geometric_slerp") has been added to enable geometric +spherical linear interpolation on an n-sphere + +[`scipy.spatial.SphericalVoronoi`](../reference/generated/scipy.spatial.SphericalVoronoi.html#scipy.spatial.SphericalVoronoi "scipy.spatial.SphericalVoronoi") now supports calculation of region areas in 2D +and 3D cases + +The tree building algorithm used by `cKDTree` has improved from quadratic +worst case time complexity to loglinear. Benchmarks are also now available for +building and querying of balanced/unbalanced kd-trees. + +## [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#id16)[#](#scipy-special-improvements "Link to this heading") + +The following functions now have Cython interfaces in *cython\_special*: + +* [`scipy.special.erfinv`](../reference/generated/scipy.special.erfinv.html#scipy.special.erfinv "scipy.special.erfinv") +* [`scipy.special.erfcinv`](../reference/generated/scipy.special.erfcinv.html#scipy.special.erfcinv "scipy.special.erfcinv") +* [`scipy.special.spherical_jn`](../reference/generated/scipy.special.spherical_jn.html#scipy.special.spherical_jn "scipy.special.spherical_jn") +* [`scipy.special.spherical_yn`](../reference/generated/scipy.special.spherical_yn.html#scipy.special.spherical_yn "scipy.special.spherical_yn") +* [`scipy.special.spherical_in`](../reference/generated/scipy.special.spherical_in.html#scipy.special.spherical_in "scipy.special.spherical_in") +* [`scipy.special.spherical_kn`](../reference/generated/scipy.special.spherical_kn.html#scipy.special.spherical_kn "scipy.special.spherical_kn") + +[`scipy.special.log_softmax`](../reference/generated/scipy.special.log_softmax.html#scipy.special.log_softmax "scipy.special.log_softmax") has been added to calculate the logarithm of softmax +function. It provides better accuracy than `log(scipy.special.softmax(x))` for +inputs that make softmax saturate. + +## [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#id17)[#](#scipy-stats-improvements "Link to this heading") + +The function for generating random samples in [`scipy.stats.dlaplace`](../reference/generated/scipy.stats.dlaplace.html#scipy.stats.dlaplace "scipy.stats.dlaplace") has been +improved. The new function is approximately twice as fast with a memory +footprint reduction between 25 % and 60 % (see gh-11069). + +[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") functions that accept a seed for reproducible calculations using +random number generation (e.g. random variates from distributions) can now use +the modern `np.random.Generator` as well as the legacy +`np.random.RandomState` as a seed. + +The `axis` parameter was added to [`scipy.stats.rankdata`](../reference/generated/scipy.stats.rankdata.html#scipy.stats.rankdata "scipy.stats.rankdata"). This allows slices +of an array along the given axis to be ranked independently. + +The `axis` parameter was added to [`scipy.stats.f_oneway`](../reference/generated/scipy.stats.f_oneway.html#scipy.stats.f_oneway "scipy.stats.f_oneway"), allowing it to +compute multiple one-way ANOVA tests for data stored in n-dimensional +arrays. The performance of `f_oneway` was also improved for some cases. + +The PDF and CDF methods for `stats.geninvgauss` are now significantly faster +as the numerical integration to calculate the CDF uses a Cython based +`LowLevelCallable`. + +Moments of the normal distribution ([`scipy.stats.norm`](../reference/generated/scipy.stats.norm.html#scipy.stats.norm "scipy.stats.norm")) are now calculated using +analytical formulas instead of numerical integration for greater speed and +accuracy + +Moments and entropy trapezoidal distribution (`scipy.stats.trapz`) are now +calculated using analytical formulas instead of numerical integration for +greater speed and accuracy + +Methods of the truncated normal distribution ([`scipy.stats.truncnorm`](../reference/generated/scipy.stats.truncnorm.html#scipy.stats.truncnorm "scipy.stats.truncnorm")), +especially `_rvs`, are significantly faster after a complete rewrite. + +The *fit* method of the Laplace distribution, [`scipy.stats.laplace`](../reference/generated/scipy.stats.laplace.html#scipy.stats.laplace "scipy.stats.laplace"), now uses +the analytical formulas for the maximum likelihood estimates of the parameters. + +Generation of random variates is now thread safe for all SciPy distributions. +3rd-party distributions may need to modify the signature of the `_rvs()` +method to conform to `_rvs(self, ..., size=None, random_state=None)`. (A +one-time VisibleDeprecationWarning is emitted when using non-conformant +distributions.) + +The Kolmogorov-Smirnov two-sided test statistic distribution +([`scipy.stats.kstwo`](../reference/generated/scipy.stats.kstwo.html#scipy.stats.kstwo "scipy.stats.kstwo")) was added. Calculates the distribution of the K-S +two-sided statistic `D_n` for a sample of size n, using a mixture of exact +and asymptotic algorithms. + +The new function `median_abs_deviation` replaces the deprecated +`median_absolute_deviation`. + +The `wilcoxon` function now computes the p-value for Wilcoxon’s signed rank +test using the exact distribution for inputs up to length 25. The function has +a new `mode` parameter to specify how the p-value is to be computed. The +default is `"auto"`, which uses the exact distribution for inputs up to length +25 and the normal approximation for larger inputs. + +Added a new Cython-based implementation to evaluate gaussian kernel estimates, +which should improve the performance of `gaussian_kde` + +The `winsorize` function now has a `nan_policy` argument for refined +handling of `nan` input values. + +The `binned_statistic_dd` function with `statistic="std"` performance was +improved by ~4x. + +`scipy.stats.kstest(rvs, cdf,...)` now handles both one-sample and +two-sample testing. The one-sample variation uses [`scipy.stats.ksone`](../reference/generated/scipy.stats.ksone.html#scipy.stats.ksone "scipy.stats.ksone") +(or [`scipy.stats.kstwo`](../reference/generated/scipy.stats.kstwo.html#scipy.stats.kstwo "scipy.stats.kstwo") with back off to [`scipy.stats.kstwobign`](../reference/generated/scipy.stats.kstwobign.html#scipy.stats.kstwobign "scipy.stats.kstwobign")) to calculate +the p-value. The two-sample variation, invoked if `cdf` is array\_like, uses +an algorithm described by Hodges to compute the probability directly, only +backing off to [`scipy.stats.kstwo`](../reference/generated/scipy.stats.kstwo.html#scipy.stats.kstwo "scipy.stats.kstwo") in case of overflow. The result in both +cases is more accurate p-values, especially for two-sample testing with +smaller (or quite different) sizes. + +[`scipy.stats.maxwell`](../reference/generated/scipy.stats.maxwell.html#scipy.stats.maxwell "scipy.stats.maxwell") performance improvements include a 20 % speed up for +`fit()` and 5 % for `pdf()` + +[`scipy.stats.shapiro`](../reference/generated/scipy.stats.shapiro.html#scipy.stats.shapiro "scipy.stats.shapiro") and [`scipy.stats.jarque_bera`](../reference/generated/scipy.stats.jarque_bera.html#scipy.stats.jarque_bera "scipy.stats.jarque_bera") now return a named tuple +for greater consistency with other `stats` functions + +### [Deprecated features](#id18)[#](#deprecated-features "Link to this heading") + +## [[`scipy`](../index.html#module-scipy "scipy") deprecations](#id19)[#](#scipy-deprecations "Link to this heading") + +## [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") changes](#id20)[#](#scipy-special-changes "Link to this heading") + +The `bdtr`, `bdtrc`, and `bdtri` functions are deprecating non-negative +non-integral `n` arguments. + +## [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") changes](#id21)[#](#scipy-stats-changes "Link to this heading") + +The function `median_absolute_deviation` is deprecated. Use +`median_abs_deviation` instead. + +The use of the string `"raw"` with the `scale` parameter of `iqr` is +deprecated. Use `scale=1` instead. + +### [Backwards incompatible changes](#id22)[#](#backwards-incompatible-changes "Link to this heading") + +## [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") changes](#id23)[#](#scipy-interpolate-changes "Link to this heading") + +## [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") changes](#id24)[#](#scipy-linalg-changes "Link to this heading") + +The output signatures of `?syevr`, `?heevr` have been changed from +`w, v, info` to `w, v, m, isuppz, info` + +The order of output arguments `w`, `v` of `{gv, gvd, gvx}` is +swapped. + +## [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") changes](#id25)[#](#scipy-signal-changes "Link to this heading") + +The output length of [`scipy.signal.upfirdn`](../reference/generated/scipy.signal.upfirdn.html#scipy.signal.upfirdn "scipy.signal.upfirdn") has been corrected, resulting +outputs may now be shorter for some combinations of up/down ratios and input +signal and filter lengths. + +[`scipy.signal.resample`](../reference/generated/scipy.signal.resample.html#scipy.signal.resample "scipy.signal.resample") now supports a `domain` keyword argument for +specification of time or frequency domain input. + +## [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") changes](#id26)[#](#id1 "Link to this heading") + +### [Other changes](#id27)[#](#other-changes "Link to this heading") + +Improved support for leveraging 64-bit integer size from linear algebra backends +in several parts of the SciPy codebase. + +Shims designed to ensure the compatibility of SciPy with Python 2.7 have now +been removed. + +Many warnings due to unused imports and unused assignments have been addressed. + +Many usage examples were added to function docstrings, and many input +validations and intuitive exception messages have been added throughout the +codebase. + +Early stage adoption of type annotations in a few parts of the codebase + +### [Authors](#id28)[#](#authors "Link to this heading") + +* @endolith +* Hameer Abbasi +* ADmitri + +* Wesley Alves + +* Berkay Antmen + +* Sylwester Arabas + +* Arne Küderle + +* Christoph Baumgarten +* Peter Bell +* Felix Berkenkamp +* Jordão Bragantini + +* Clemens Brunner + +* Evgeni Burovski +* Matthias Bussonnier + +* CJ Carey +* Derrick Chambers + +* Leander Claes + +* Christian Clauss +* Luigi F. Cruz + +* dankleeman +* Andras Deak +* Milad Sadeghi DM + +* jeremie du boisberranger + +* Stefan Endres +* Malte Esders + +* Leo Fang + +* felixhekhorn + +* Isuru Fernando +* Andrew Fowlie +* Lakshay Garg + +* Gaurav Gijare + +* Ralf Gommers +* Emmanuelle Gouillart + +* Kevin Green + +* Martin Grignard + +* Maja Gwozdz +* Sturla Molden +* gyu-don + +* Matt Haberland +* hakeemo + +* Charles Harris +* Alex Henrie +* Santi Hernandez + +* William Hickman + +* Till Hoffmann + +* Joseph T. Iosue + +* Anany Shrey Jain +* Jakob Jakobson +* Charles Jekel + +* Julien Jerphanion + +* Jiacheng-Liu + +* Christoph Kecht + +* Paul Kienzle + +* Reidar Kind + +* Dmitry E. Kislov + +* Konrad + +* Konrad0 +* Takuya KOUMURA + +* Krzysztof Pióro +* Peter Mahler Larsen +* Eric Larson +* Antony Lee +* Gregory Lee + +* Gregory R. Lee +* Chelsea Liu +* Cong Ma + +* Kevin Mader + +* Maja Gwóźdź + +* Alex Marvin + +* Matthias Kümmerer +* Nikolay Mayorov +* Mazay0 + +* 7. 4. McBain +* Nicholas McKibben + +* Sabrina J. Mielke + +* Sebastian J. Mielke + +* Miloš Komarčević + +* Shubham Mishra + +* Santiago M. Mola + +* Grzegorz Mrukwa + +* Peyton Murray +* Andrew Nelson +* Nico Schlömer +* nwjenkins + +* odidev + +* Sambit Panda +* Vikas Pandey + +* Rick Paris + +* Harshal Prakash Patankar + +* Balint Pato + +* Matti Picus +* Ilhan Polat +* poom + +* Siddhesh Poyarekar +* Vladyslav Rachek + +* Bharat Raghunathan +* Manu Rajput + +* Tyler Reddy +* Andrew Reed + +* Lucas Roberts +* Ariel Rokem +* Heshy Roskes +* Matt Ruffalo +* Atsushi Sakai + +* Benjamin Santos + +* Christoph Schock + +* Lisa Schwetlick + +* Chris Simpson + +* Leo Singer +* Kai Striega +* Søren Fuglede Jørgensen +* Kale-ab Tessera + +* Seth Troisi + +* Robert Uhl + +* Paul van Mulbregt +* Vasiliy + +* Isaac Virshup + +* Pauli Virtanen +* Shakthi Visagan + +* Jan Vleeshouwers + +* Sam Wallan + +* Lijun Wang + +* Warren Weckesser +* Richard Weiss + +* wenhui-prudencemed + +* Eric Wieser +* Josh Wilson +* James Wright + +* Ruslan Yevdokymov + +* Ziyao Zhang + + +A total of 129 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +## [Issues closed for 1.5.0](#id29)[#](#issues-closed-for-1-5-0 "Link to this heading") + +* [#1455](https://github.com/scipy/scipy/issues/1455): ellipord does returns bogus values if gstop or gpass are negative… +* [#1968](https://github.com/scipy/scipy/issues/1968): correlate2d’s output does not agree with correlate’s output in… +* [#2744](https://github.com/scipy/scipy/issues/2744): BUG: optimize: ‘\*\*kw’ argument of ‘newton\_krylov’ is not documented +* [#4755](https://github.com/scipy/scipy/issues/4755): TypeError: data type “ suggesting an easy fix +* [#9553](https://github.com/scipy/scipy/issues/9553): ndimage routines behave badly when output has memory overlap… +* [#9632](https://github.com/scipy/scipy/issues/9632): ndimage.maximum\_filter undocumented behaviour using footprint… +* [#9658](https://github.com/scipy/scipy/issues/9658): `scipy.optimize.minimize(method=’COBYLA’)` not threadsafe +* [#9710](https://github.com/scipy/scipy/issues/9710): stats.weightedtau([1], [1.0]) SEGFAULTs +* [#9797](https://github.com/scipy/scipy/issues/9797): Master Tracker for some Kolmogorov-Smirnov test Issues +* [#9844](https://github.com/scipy/scipy/issues/9844): scipy.signal.upfirdn gives different length matrix versus MATLAB… +* [#9872](https://github.com/scipy/scipy/issues/9872): scipy.signal.convolve is slower when vectorized +* [#9913](https://github.com/scipy/scipy/issues/9913): BUG: No dt in StateSpace operations +* [#10014](https://github.com/scipy/scipy/issues/10014): Distribution names `weibull\_min`and `weibull\_max` should… +* [#10159](https://github.com/scipy/scipy/issues/10159): BUG: stats: chisquare returns incorrect results for arrays of… +* [#10302](https://github.com/scipy/scipy/issues/10302): scipy.fft: Add a `plan` argument +* [#10332](https://github.com/scipy/scipy/issues/10332): ‘Incomplete wav chunk’ inconsistent/reason unknown +* [#10441](https://github.com/scipy/scipy/issues/10441): Remove uses of `numpy.dual`? +* [#10558](https://github.com/scipy/scipy/issues/10558): Document implicit sum in csr\_matrix() constructor +* [#10788](https://github.com/scipy/scipy/issues/10788): LU with full pivoting +* [#10841](https://github.com/scipy/scipy/issues/10841): Unexpected behavior in linalg.blas.dtrmm wrapper +* [#10919](https://github.com/scipy/scipy/issues/10919): optimize.\_lbfgsb setulb() function violates parameter bounds +* [#10963](https://github.com/scipy/scipy/issues/10963): kstest, ks\_2samp: confusing `mode` argument descriptions +* [#11022](https://github.com/scipy/scipy/issues/11022): Unexpected Result in factorial function with NaN input +* [#11028](https://github.com/scipy/scipy/issues/11028): Documentation error in optimize.minimize +* [#11058](https://github.com/scipy/scipy/issues/11058): Adding logsoftmax function +* [#11076](https://github.com/scipy/scipy/issues/11076): ValueError: Unknown wave file format +* [#11090](https://github.com/scipy/scipy/issues/11090): Misconception of the median absolute deviation in stats? +* [#11095](https://github.com/scipy/scipy/issues/11095): BUG: find\_peaks\_cwt test failures in 32-bit Linux wheels +* [#11107](https://github.com/scipy/scipy/issues/11107): scipy.io.mmread generated an error “TypeError: startswith first… +* [#11123](https://github.com/scipy/scipy/issues/11123): Add wrapper for ?gttrf/?gttrs +* [#11128](https://github.com/scipy/scipy/issues/11128): OverflowError in resample\_poly (upfirdn) +* [#11132](https://github.com/scipy/scipy/issues/11132): Possible bug: rv\_discret.ppf for percentiles 0 and 100 and loc… +* [#11163](https://github.com/scipy/scipy/issues/11163): Comparisons between scipy spmatrix and can sparse.SparseArray… +* [#11168](https://github.com/scipy/scipy/issues/11168): Generalized Pareto variance inaccurate for concentrations near… +* [#11169](https://github.com/scipy/scipy/issues/11169): Add wrapper for ?geqrfp +* [#11184](https://github.com/scipy/scipy/issues/11184): 2-sided Kolmogorov Smirnov returns p-value of 1 +* [#11185](https://github.com/scipy/scipy/issues/11185): The .roots() or solve() function of scipy.interpolate.CubicHermiteSpline… +* [#11190](https://github.com/scipy/scipy/issues/11190): Add wrapper for ?tbtrs +* [#11200](https://github.com/scipy/scipy/issues/11200): Can no longer slice csr\_matrix in 1.3.0 +* [#11207](https://github.com/scipy/scipy/issues/11207): \_minimize\_scalar\_bounded: reference before assignment +* [#11216](https://github.com/scipy/scipy/issues/11216): linprog: interior-point: Cholmod reordering can be reused +* [#11223](https://github.com/scipy/scipy/issues/11223): Add wrappers for ?pttrf, ?pttrs +* [#11224](https://github.com/scipy/scipy/issues/11224): Add wrapperfor ?pteqr +* [#11235](https://github.com/scipy/scipy/issues/11235): MAINT: Missleading Error Message for IIR Filter +* [#11244](https://github.com/scipy/scipy/issues/11244): Missing reference in `scipy.optimize.line\_search` +* [#11262](https://github.com/scipy/scipy/issues/11262): Hermitian Eigenvalue Problem eigh() API and wrapper change proposal +* [#11266](https://github.com/scipy/scipy/issues/11266): Sparse matrix constructor data type detection changes on Numpy… +* [#11270](https://github.com/scipy/scipy/issues/11270): CI failing: Travis CI Py36 refguide and Linux\_Python\_36\_32bit\_full… +* [#11279](https://github.com/scipy/scipy/issues/11279): linalg.eigh checks whole array for finite values +* [#11295](https://github.com/scipy/scipy/issues/11295): CI: azure does not auto-cancel old jobs on pushes +* [#11299](https://github.com/scipy/scipy/issues/11299): stats.truncnorm.rvs 100x slower in v1.4.x than v1.3.3 +* [#11315](https://github.com/scipy/scipy/issues/11315): BUG: special: rgamma on negative integers smaller -34 +* [#11319](https://github.com/scipy/scipy/issues/11319): Missing `int64\_t` declaration in rectangular\_lsap.cpp +* [#11323](https://github.com/scipy/scipy/issues/11323): Compilation failure due to missing symbol pthread\_atfork +* [#11332](https://github.com/scipy/scipy/issues/11332): BUG: directed\_hausdorff distance on sets u and v when u is a… +* [#11350](https://github.com/scipy/scipy/issues/11350): Khatri-Rao product +* [#11354](https://github.com/scipy/scipy/issues/11354): ENH: Add wrapper for ?gejsv +* [#11361](https://github.com/scipy/scipy/issues/11361): Dropped NaN in eval\_genlaguerre function +* [#11363](https://github.com/scipy/scipy/issues/11363): Dropped NaN in hyperu function +* [#11365](https://github.com/scipy/scipy/issues/11365): scipy.stats.binned\_statistic regressed in v1.4.0 +* [#11369](https://github.com/scipy/scipy/issues/11369): Dropped NaN in eval\_hermite +* [#11370](https://github.com/scipy/scipy/issues/11370): Dropped NaN in eval\_gegenbauer +* [#11373](https://github.com/scipy/scipy/issues/11373): Add wrapper for ?gtsvx +* [#11374](https://github.com/scipy/scipy/issues/11374): Add wrapper for ?ptsvx +* [#11391](https://github.com/scipy/scipy/issues/11391): csgraph.minimum\_spanning\_tree loses precision +* [#11398](https://github.com/scipy/scipy/issues/11398): Update stats to cope with `np.random.Generator` machinery +* [#11412](https://github.com/scipy/scipy/issues/11412): Array copying causes unwanted type casting from complex to float… +* [#11415](https://github.com/scipy/scipy/issues/11415): Where is the Wiener Filter derived from? +* [#11416](https://github.com/scipy/scipy/issues/11416): \_lib.\_util.getargspec\_no\_self is missing KEYWORD\_ONLY support +* [#11428](https://github.com/scipy/scipy/issues/11428): Documentation on SHGO inequality constraints appears contradictory +* [#11429](https://github.com/scipy/scipy/issues/11429): Add LAPACK’s ZUNCSD cosine sine decomposition +* [#11438](https://github.com/scipy/scipy/issues/11438): run\_dualannealing passes bounds incorrectly in benchmarks/optimize.py +* [#11441](https://github.com/scipy/scipy/issues/11441): Can’t run optimize benchmarks +* [#11442](https://github.com/scipy/scipy/issues/11442): Chebyshev weights +* [#11448](https://github.com/scipy/scipy/issues/11448): Wrongly typed comparison in integrate.quad +* [#11458](https://github.com/scipy/scipy/issues/11458): BUG: maximum\_bipartite\_matching produces infeasible solution +* [#11460](https://github.com/scipy/scipy/issues/11460): CI failing: 2 Travis CI tests fail with numpy build or version… +* [#11462](https://github.com/scipy/scipy/issues/11462): Bug on “++” initialization on “kmeans2” +* [#11464](https://github.com/scipy/scipy/issues/11464): Shouldn’t data type of KDE evaluation should be like in the input… +* [#11468](https://github.com/scipy/scipy/issues/11468): performance of binned\_statistics\_2d 100x slowdown from 1.3.2… +* [#11484](https://github.com/scipy/scipy/issues/11484): Callback function doesn’t give the same value as the one being… +* [#11492](https://github.com/scipy/scipy/issues/11492): Confusing dendrogram labelling +* [#11493](https://github.com/scipy/scipy/issues/11493): scipy.optimize.least\_squares fails if the return array of the… +* [#11494](https://github.com/scipy/scipy/issues/11494): Error performing kronecker product between large sparse vectors +* [#11503](https://github.com/scipy/scipy/issues/11503): medfilt produces 0 on input of length 1 +* [#11529](https://github.com/scipy/scipy/issues/11529): Pyflakes generates almost 700 warnings. +* [#11566](https://github.com/scipy/scipy/issues/11566): irfft/irfft2/irfftn docs are slightly confusing re: input type. +* [#11572](https://github.com/scipy/scipy/issues/11572): least\_squares: too small tolerances not catched with method=’lm’ +* [#11581](https://github.com/scipy/scipy/issues/11581): DOC: scipy.interpolate.RectSphereBivariateSpline +* [#11586](https://github.com/scipy/scipy/issues/11586): Differential evolution breaks with LinearConstraints with sparse… +* [#11595](https://github.com/scipy/scipy/issues/11595): scipy.spatial.cKDTree construction slow for some datasets +* [#11598](https://github.com/scipy/scipy/issues/11598): output of special.voigt\_profile when sigma=0 +* [#11601](https://github.com/scipy/scipy/issues/11601): linalg tests failing in runtests.py +* [#11602](https://github.com/scipy/scipy/issues/11602): scipy.optimize.linear\_sum\_assignment returns reverse diagonal… +* [#11610](https://github.com/scipy/scipy/issues/11610): Analytic formula for normal moments +* [#11611](https://github.com/scipy/scipy/issues/11611): Build failure with gfortran 10 +* [#11613](https://github.com/scipy/scipy/issues/11613): TST, MAINT: test\_quadpack TestCtypesQuad wasn’t fully migrated… +* [#11630](https://github.com/scipy/scipy/issues/11630): SmoothBivariateSpline bbox parameter +* [#11635](https://github.com/scipy/scipy/issues/11635): typo in docstring of scipy.stats.norminvgauss +* [#11637](https://github.com/scipy/scipy/issues/11637): BUG: core dumps when calling scipy.interpolate.interp1d with… +* [#11638](https://github.com/scipy/scipy/issues/11638): better documentation for ‘return\_all’ option in minimize(Nelder… +* [#11652](https://github.com/scipy/scipy/issues/11652): TST, MAINT: CI failures for pre-release NumPy wheels +* [#11659](https://github.com/scipy/scipy/issues/11659): optimize.fmin\_l\_bfgs\_b needs bound check and appropiate error… +* [#11660](https://github.com/scipy/scipy/issues/11660): BUG/ENH: distribution.ncf with nc=0 returns nan +* [#11661](https://github.com/scipy/scipy/issues/11661): scipy.ndimage.convolve1d and correlate1d don’t behave properly… +* [#11669](https://github.com/scipy/scipy/issues/11669): p-value varies with the order of the data +* [#11676](https://github.com/scipy/scipy/issues/11676): documentation of scipy.spatial.HalfspaceIntersection: wrong method… +* [#11685](https://github.com/scipy/scipy/issues/11685): Rotation cannot be expressed as matrix +* [#11686](https://github.com/scipy/scipy/issues/11686): MAINT: mypy imports of Cython “modules” +* [#11693](https://github.com/scipy/scipy/issues/11693): TestDifferentialEvolutionSolver::test\_L4 failing in CI +* [#11696](https://github.com/scipy/scipy/issues/11696): DOC: incorrect compiler information for macOS in docs +* [#11709](https://github.com/scipy/scipy/issues/11709): eigh() tests fail to pass, crash Python with seemingly ramdom… +* [#11763](https://github.com/scipy/scipy/issues/11763): Small error in gamma continuous rv fit comments +* [#11769](https://github.com/scipy/scipy/issues/11769): truncnorm.rvs Weird Behaviors +* [#11770](https://github.com/scipy/scipy/issues/11770): crash in TestEigh::test\_value\_subsets +* [#11795](https://github.com/scipy/scipy/issues/11795): trapz distribution mean computed using single precision +* [#11800](https://github.com/scipy/scipy/issues/11800): Segmentation fault in scipy.odr for multidimensional independent… +* [#11811](https://github.com/scipy/scipy/issues/11811): pyflakes silently failing on travis-ci +* [#11826](https://github.com/scipy/scipy/issues/11826): Error with \_fblas +* [#11827](https://github.com/scipy/scipy/issues/11827): `fft.tests.test\_numpy.test\_multiprocess` hangs on Python3.8… +* [#11835](https://github.com/scipy/scipy/issues/11835): tests with `multiprocessing` hang on Python 3.8 on macOS +* [#11839](https://github.com/scipy/scipy/issues/11839): linalg.expm returns nans with RuntimeWarning: overflow encountered… +* [#11856](https://github.com/scipy/scipy/issues/11856): Documentation of fit methods for `weibull\_min` and `exponweib`… +* [#11868](https://github.com/scipy/scipy/issues/11868): Function always evaluated twice when using HessianUpdateStrategy… +* [#11875](https://github.com/scipy/scipy/issues/11875): Typo in the docstring of simps() +* [#11877](https://github.com/scipy/scipy/issues/11877): kmeans2 ‘++’ method is orders of magnitude slower than sklearn.cluster.KMeans() +* [#11884](https://github.com/scipy/scipy/issues/11884): The upper code lines are dead code +* [#11886](https://github.com/scipy/scipy/issues/11886): Array shape mismatch in scipy.optimize +* [#11892](https://github.com/scipy/scipy/issues/11892): BUG: stats: Incorrect handling of edges cases by ttest\_rel and… +* [#11908](https://github.com/scipy/scipy/issues/11908): LinearOperator should have ndim attribute +* [#11910](https://github.com/scipy/scipy/issues/11910): Documentation missing for what M is in init argument +* [#11922](https://github.com/scipy/scipy/issues/11922): macOS actions CI has started failing in last couple of days. +* [#11928](https://github.com/scipy/scipy/issues/11928): DOC: signal: Wrong description for sepfir2d, cspline2d, qspline2d +* [#11944](https://github.com/scipy/scipy/issues/11944): curve\_fit documentation unclear on default value of absolute\_sigma +* [#11945](https://github.com/scipy/scipy/issues/11945): Add a (potentially temporary) py.typed file? +* [#11949](https://github.com/scipy/scipy/issues/11949): ValueError ‘k exceeds matrix dimensions’ for sparse.diagonal()… +* [#11951](https://github.com/scipy/scipy/issues/11951): BUG: asv benchmark failed because of cython version +* [#11967](https://github.com/scipy/scipy/issues/11967): BLD: Azure windows runs complain about drives +* [#11973](https://github.com/scipy/scipy/issues/11973): oaconvolve(a,b,’same’) differs in shape from convolve(a,b,’same’)… +* [#12002](https://github.com/scipy/scipy/issues/12002): pybind11 license +* [#12003](https://github.com/scipy/scipy/issues/12003): MAINT: circular SphericalVoronoi input +* [#12015](https://github.com/scipy/scipy/issues/12015): Reordering of CSC matrix breaks when you go above int32 limits +* [#12031](https://github.com/scipy/scipy/issues/12031): Documentation Rendering Issues Visible in CircleCI Artifacts +* [#12037](https://github.com/scipy/scipy/issues/12037): MAINT, CI: new Cython 3.0a4 issue +* [#12087](https://github.com/scipy/scipy/issues/12087): DOC: some odr models are missing docs +* [#12119](https://github.com/scipy/scipy/issues/12119): signal.fftconvolve no longer convolves types f8 and numpy.float64 +* [#12149](https://github.com/scipy/scipy/issues/12149): Documentation of Rosenbrock function +* [#12173](https://github.com/scipy/scipy/issues/12173): Large memory usage when indexing sparse matrices with `np.ix\_` +* [#12178](https://github.com/scipy/scipy/issues/12178): BUG: stats: Some discrete distributions don’t accept lists of… +* [#12220](https://github.com/scipy/scipy/issues/12220): BUG, REL: gh\_lists.py compromised scraping +* [#12239](https://github.com/scipy/scipy/issues/12239): BUG: median absolute deviation handling of nan +* [#12301](https://github.com/scipy/scipy/issues/12301): integer overflow in scipy.sparse.sputils.check\_shape when matrix size > 2^32 +* [#12314](https://github.com/scipy/scipy/issues/12314): scipy.spatial.transform.Rotation multiplication does not normalize quaternion + +## [Pull requests for 1.5.0](#id30)[#](#pull-requests-for-1-5-0 "Link to this heading") + +* [#6510](https://github.com/scipy/scipy/pull/6510): Add Eigenvalue Range Functionality for Symmetric Eigenvalue Problems +* [#9525](https://github.com/scipy/scipy/pull/9525): BUG: SuperLU ‘NATURAL’ order applies a column permutation +* [#9634](https://github.com/scipy/scipy/pull/9634): Add the number of Jacobian evaluations to the output of L-BFGS-B. +* [#9719](https://github.com/scipy/scipy/pull/9719): ENH: Added kstwo probability distribution for two-sided one-sample… +* [#9783](https://github.com/scipy/scipy/pull/9783): WIP: optimize: added (dense) interpolative decomposition redundancy… +* [#10053](https://github.com/scipy/scipy/pull/10053): Adding docstring to weibull\_min and weibull\_max based on issue… +* [#10136](https://github.com/scipy/scipy/pull/10136): DEP: Add warning to linprog\_verbose\_callback +* [#10380](https://github.com/scipy/scipy/pull/10380): ENH: add geometric\_slerp +* [#10602](https://github.com/scipy/scipy/pull/10602): MAINT: optimize: refactor common linprog arguments into namedtuple +* [#10648](https://github.com/scipy/scipy/pull/10648): Bounds for the Powell minimization method +* [#10673](https://github.com/scipy/scipy/pull/10673): ENH: approx\_fprime –> approx\_derivative +* [#10759](https://github.com/scipy/scipy/pull/10759): ENH: calculation of region areas in spatial.SphericalVoronoi +* [#10762](https://github.com/scipy/scipy/pull/10762): BENCH: optimize: more comprehensive linprog benchmarking +* [#10796](https://github.com/scipy/scipy/pull/10796): ENH exact p-values of wilcoxon test in scipy.stats +* [#10797](https://github.com/scipy/scipy/pull/10797): ENH: linalg: LU with full pivoting (wrappers for ?getc2/?gesc2) +* [#10824](https://github.com/scipy/scipy/pull/10824): ENH: Fast gaussian kernel estimator +* [#10942](https://github.com/scipy/scipy/pull/10942): BUG: prevent bound violation in L-BFGS-B optimize method +* [#11003](https://github.com/scipy/scipy/pull/11003): ENH: add scipy.linalg.convolution\_matrix +* [#11023](https://github.com/scipy/scipy/pull/11023): improving error message for cubic-interpolate with duplicates +* [#11045](https://github.com/scipy/scipy/pull/11045): MAINT: make bdt{r,rc,ri}() functions accept double n,k args +… +* [#11063](https://github.com/scipy/scipy/pull/11063): Fix documentation error in optimize.minimize +* [#11069](https://github.com/scipy/scipy/pull/11069): ENH: stats.dlaplace.rvs improvements +* [#11071](https://github.com/scipy/scipy/pull/11071): DOC: Added examples to maximum\_position in ndimage +* [#11075](https://github.com/scipy/scipy/pull/11075): DOC: Update stylistic consistency in multiple files +* [#11097](https://github.com/scipy/scipy/pull/11097): BUG: stats: fixing chisquare to return correct results for arrays… +* [#11110](https://github.com/scipy/scipy/pull/11110): ENH: special: Cythonise erfinv, erfcinv +* [#11112](https://github.com/scipy/scipy/pull/11112): BUG: special: Return NaN outside the domain of `eval\_hermite` +* [#11114](https://github.com/scipy/scipy/pull/11114): BUG: special: fix `hyp1f1` for nonnegative integral `a` and… +* [#11115](https://github.com/scipy/scipy/pull/11115): DOC: special: add docstrings for `kei`, `ker`, `keip`,… +* [#11130](https://github.com/scipy/scipy/pull/11130): ENH: support for circular input +* [#11136](https://github.com/scipy/scipy/pull/11136): BUG: expm handling of empty input +* [#11138](https://github.com/scipy/scipy/pull/11138): DOC: stylistic consistency, punctuation, etc. +* [#11139](https://github.com/scipy/scipy/pull/11139): MAINT: cluster: use cython\_blas, remove handwritten BLAS wrappers +* [#11146](https://github.com/scipy/scipy/pull/11146): DOC: update docs on bp parameter for detrend +* [#11151](https://github.com/scipy/scipy/pull/11151): DOC: special: add docstrings for `bei`, `ber`, `beip`,… +* [#11156](https://github.com/scipy/scipy/pull/11156): ENH: add input validation for ellipord. +* [#11157](https://github.com/scipy/scipy/pull/11157): DOC: stylistic revision, punctuation, consistency +* [#11160](https://github.com/scipy/scipy/pull/11160): ignore warning on 0 \* inf in basin hopping +* [#11162](https://github.com/scipy/scipy/pull/11162): DOC: minor stylistic revision, undo changes +* [#11164](https://github.com/scipy/scipy/pull/11164): ENH/ BUG: Pydata sparse equality +* [#11171](https://github.com/scipy/scipy/pull/11171): Fix dtype validation of “seuclidean” metric V parameter +* [#11177](https://github.com/scipy/scipy/pull/11177): BUG: stats: Improve genpareto stats calculations. +* [#11180](https://github.com/scipy/scipy/pull/11180): MAINT: stats: Some clean up in test\_distributions.py. +* [#11187](https://github.com/scipy/scipy/pull/11187): ENH: add functionality log\_softmax to SciPy.special. +* [#11188](https://github.com/scipy/scipy/pull/11188): MAINT: add rvs method to argus in scipy.stats +* [#11196](https://github.com/scipy/scipy/pull/11196): DOC: special: add to docstrings of Kelvin zeros functions +* [#11202](https://github.com/scipy/scipy/pull/11202): BUG: fix edge counting in shortest\_path +* [#11218](https://github.com/scipy/scipy/pull/11218): BUG: scipy/interpolate: fix PPoly/Cubic\*Spline roots() extrapolation… +* [#11225](https://github.com/scipy/scipy/pull/11225): Add a warning to constant input for spearmanr() function +* [#11226](https://github.com/scipy/scipy/pull/11226): Speed up of interior-point method for cholesky solver +* [#11229](https://github.com/scipy/scipy/pull/11229): BUG: Explicit dtype specification in \_upfirdn.py +* [#11230](https://github.com/scipy/scipy/pull/11230): Additional citation for optimize tutorial +* [#11231](https://github.com/scipy/scipy/pull/11231): Adds SLSQP test for duplicate f-evals (#10738) +* [#11236](https://github.com/scipy/scipy/pull/11236): MAINT: Improved error message for Wn range in iirfilter. +* [#11245](https://github.com/scipy/scipy/pull/11245): ENH: optimize: dense redundancy removal routine optimizations +* [#11247](https://github.com/scipy/scipy/pull/11247): MAINT: Remove \_lib/\_numpy\_compat.py +* [#11248](https://github.com/scipy/scipy/pull/11248): BUG: rv\_discrete.ppf() to handle loc +* [#11251](https://github.com/scipy/scipy/pull/11251): DOC: add reference for linesearch zoom algorithm +* [#11253](https://github.com/scipy/scipy/pull/11253): BUG: fix kendalltau issue where p-value becomes >1 +* [#11254](https://github.com/scipy/scipy/pull/11254): MAINT: make special.factorial handle nan correctly +* [#11256](https://github.com/scipy/scipy/pull/11256): DOC: Updated documentation for scipy.linalg.qr +* [#11265](https://github.com/scipy/scipy/pull/11265): Fix: Can no longer slice csr\_matrix in 1.3.0 +* [#11267](https://github.com/scipy/scipy/pull/11267): BUG: Rework the scaling in the ks\_2samp two-sided exact test. +* [#11268](https://github.com/scipy/scipy/pull/11268): DOC: example of NonLinearConstraint +* [#11269](https://github.com/scipy/scipy/pull/11269): Fix: Sparse matrix constructor data type detection changes on… +* [#11276](https://github.com/scipy/scipy/pull/11276): BLD: update minimum Python, NumPy, Cython, Pybind11 versions +* [#11277](https://github.com/scipy/scipy/pull/11277): MAINT: Cleanup conditionals for unsupported numpy verisons +* [#11278](https://github.com/scipy/scipy/pull/11278): MAINT: Cleanup stats.iqr workarounds for unsupported NumPy versions +* [#11282](https://github.com/scipy/scipy/pull/11282): TST/CI: improve traceback formatting for test failures +* [#11284](https://github.com/scipy/scipy/pull/11284): fix docs & behavior for mode sequences in ndimage filters +* [#11285](https://github.com/scipy/scipy/pull/11285): DOC: special: complete the docstrings of Chi-square functions +* [#11286](https://github.com/scipy/scipy/pull/11286): BUG: make loadmat/savemat file opening close resources correctly +* [#11287](https://github.com/scipy/scipy/pull/11287): CI: skip Azure and TravisCI builds on merges and direct pushes… +* [#11288](https://github.com/scipy/scipy/pull/11288): DOC: Fix import in scipy.io.wavfile.read sample code +* [#11289](https://github.com/scipy/scipy/pull/11289): BUG: Use context manager for open +* [#11290](https://github.com/scipy/scipy/pull/11290): MAINT: Remove \_lib.\_version in favour of \_lib.\_pep440 +* [#11292](https://github.com/scipy/scipy/pull/11292): DOC: special: add docstrings for various convenience functions +* [#11293](https://github.com/scipy/scipy/pull/11293): DOC: special: fix typo in `chdtri` docstring +* [#11296](https://github.com/scipy/scipy/pull/11296): DOC: special: add to docstrings of Bessel zeros and derivatives +* [#11297](https://github.com/scipy/scipy/pull/11297): DOC: special: add parameters/returns sections for Bessel integrals +* [#11300](https://github.com/scipy/scipy/pull/11300): MAINT: Update vendored uarray version +* [#11301](https://github.com/scipy/scipy/pull/11301): CI: azure conditions should require succeeded() +* [#11302](https://github.com/scipy/scipy/pull/11302): ENH: build infrastructure for ILP64 BLAS + ARPACK conversion +* [#11303](https://github.com/scipy/scipy/pull/11303): DOC: special: fix typo in `besselpoly` docstring +* [#11304](https://github.com/scipy/scipy/pull/11304): ENH: MAINT: Rewrite of eigh() and relevant wrappers +* [#11306](https://github.com/scipy/scipy/pull/11306): TST: skip test\_aligned\_mem linalg test that is crashing on ppcle64 +* [#11307](https://github.com/scipy/scipy/pull/11307): MAINT: Fix typo ‘solutuion’ -> ‘solution’ +* [#11308](https://github.com/scipy/scipy/pull/11308): ENH: do not create 1d array out of a scalar +* [#11310](https://github.com/scipy/scipy/pull/11310): MAINT: clean up object array creation, scalar/1d confusion +* [#11311](https://github.com/scipy/scipy/pull/11311): DOC: Specify custom callable option for metric in cluster.hierarchy.fclusterdata +* [#11316](https://github.com/scipy/scipy/pull/11316): BUG: special: fix behavior for `rgamma` zeros +* [#11317](https://github.com/scipy/scipy/pull/11317): BUG: fix floating-point literal comparisons under C99 +* [#11318](https://github.com/scipy/scipy/pull/11318): TST: optimize: mark two linprog tests for skipping +* [#11320](https://github.com/scipy/scipy/pull/11320): BUG: Include `int64\_t` declaration to `rectangular\_lsap.cpp` +* [#11330](https://github.com/scipy/scipy/pull/11330): MAINT: Update vendored pypocketfft version +* [#11333](https://github.com/scipy/scipy/pull/11333): BUG: directed\_hausdorff subset fix +* [#11335](https://github.com/scipy/scipy/pull/11335): [ENH] sparse: Loosen check for sparse outer indexing fast path +* [#11337](https://github.com/scipy/scipy/pull/11337): Undefined name ‘e’ in pavement.py +* [#11338](https://github.com/scipy/scipy/pull/11338): scipyoptdoc.py: Remove unused variable ‘sixu’ +* [#11340](https://github.com/scipy/scipy/pull/11340): xrange() was removed in Python 3 in favor of range() +* [#11342](https://github.com/scipy/scipy/pull/11342): range() was removed in Py3 in \_binned\_statistic.py +* [#11343](https://github.com/scipy/scipy/pull/11343): BUG: constants: fix ‘exact’ values table +* [#11347](https://github.com/scipy/scipy/pull/11347): ENH: add input validation function and apply it to needed functions +* [#11348](https://github.com/scipy/scipy/pull/11348): MAINT: remove six.string\_types usages +* [#11349](https://github.com/scipy/scipy/pull/11349): MAINT: minor doc fix \_minimize\_trustregion\_constr +* [#11353](https://github.com/scipy/scipy/pull/11353): MAINT: py3 remove various six usages +* [#11358](https://github.com/scipy/scipy/pull/11358): ENH: optimize: Use CSR format instead of LIL for speed +* [#11362](https://github.com/scipy/scipy/pull/11362): MAINT: sys.version\_info >= 3.5 +* [#11364](https://github.com/scipy/scipy/pull/11364): ENH: cache square of sums for f\_oneway +* [#11368](https://github.com/scipy/scipy/pull/11368): ENH: add optional argument, “include\_nyquist”, for freqz() +* [#11372](https://github.com/scipy/scipy/pull/11372): BENCH: optimize: added linprog presolve benchmarks +* [#11376](https://github.com/scipy/scipy/pull/11376): ENH: Add wrapper for ?gttrf/?gttrs +* [#11377](https://github.com/scipy/scipy/pull/11377): MAINT: Remove Python 2 code from tools/authors.py +* [#11378](https://github.com/scipy/scipy/pull/11378): ENH (WIP): Python wrapper for ?tbtrs +* [#11379](https://github.com/scipy/scipy/pull/11379): MAINT: Remove six.with\_metaclass from benchmarks/cython\_special.py +* [#11380](https://github.com/scipy/scipy/pull/11380): BUG: sparse/isolve: bicg and qmr don’t treat x0 correctly +* [#11382](https://github.com/scipy/scipy/pull/11382): MAINT: remove error throw in binned\_statistic\_dd() on non-finite… +* [#11383](https://github.com/scipy/scipy/pull/11383): MAINT: \_lib: remove py2 compat shims in getargspec +* [#11384](https://github.com/scipy/scipy/pull/11384): MAINT: Use numpy scalar types directly +* [#11385](https://github.com/scipy/scipy/pull/11385): ENH: special: add spherical Bessel functions to `cython\_special` +* [#11389](https://github.com/scipy/scipy/pull/11389): MAINT: line.startswith shouldn’t be bytes +* [#11393](https://github.com/scipy/scipy/pull/11393): ENH: Speed up truncnorm’s ppf()and rvs() methods +* [#11394](https://github.com/scipy/scipy/pull/11394): MAINT: Remove self.\_size (and self.\_random\_state) from stats… +* [#11395](https://github.com/scipy/scipy/pull/11395): correction in error message (%d->%g format) +* [#11396](https://github.com/scipy/scipy/pull/11396): DOC: revert gh10540, removing mtrand +* [#11397](https://github.com/scipy/scipy/pull/11397): MAINT: differential\_evolution accepts np.random.Generator +* [#11402](https://github.com/scipy/scipy/pull/11402): ENH: stats can use np.random.Generator +* [#11404](https://github.com/scipy/scipy/pull/11404): ENH: add docstring of butter() for transfer function syntax problem +* [#11405](https://github.com/scipy/scipy/pull/11405): DOC: Fix “see also” for SmoothBivariateSpline +* [#11408](https://github.com/scipy/scipy/pull/11408): ENH: Add a `plan` argument to FFT functions in `scipy.fft` +* [#11411](https://github.com/scipy/scipy/pull/11411): MAINT: check minimize duplicate evaluations +* [#11418](https://github.com/scipy/scipy/pull/11418): ENH: Linalg: Python wrapper for ?geqrfp +* [#11419](https://github.com/scipy/scipy/pull/11419): TST: Python 3.7 mac OS gcc multibuild fix +* [#11423](https://github.com/scipy/scipy/pull/11423): ENH: Add tool to lint diffs +* [#11425](https://github.com/scipy/scipy/pull/11425): FIX: \_array\_newton should preserve complex inputs +* [#11426](https://github.com/scipy/scipy/pull/11426): MAINT: licence for global optimization benchmarks +* [#11431](https://github.com/scipy/scipy/pull/11431): Make median\_absolute\_deviation scale argument aligned w/iqr +* [#11432](https://github.com/scipy/scipy/pull/11432): Fix error message typo +* [#11433](https://github.com/scipy/scipy/pull/11433): DOC: Remove L from longs +* [#11434](https://github.com/scipy/scipy/pull/11434): MAINT: Python3 improvements to refguide\_check.py +* [#11435](https://github.com/scipy/scipy/pull/11435): DOC: Update runtest –parallel help +* [#11436](https://github.com/scipy/scipy/pull/11436): MAINT: Remove checks for sys.version < 3.5 +* [#11437](https://github.com/scipy/scipy/pull/11437): DOC: Fix documentation issue +* [#11439](https://github.com/scipy/scipy/pull/11439): Support path objects (PEP 519) in mmio functions +* [#11440](https://github.com/scipy/scipy/pull/11440): correct bounds pass in run\_dualannealing for benchmarks/optimize.py +* [#11443](https://github.com/scipy/scipy/pull/11443): BENCH: optimize\_linprog remove ImportError exception +* [#11453](https://github.com/scipy/scipy/pull/11453): BUG: sparse: convert csc/csr indices to int64 as needed +* [#11454](https://github.com/scipy/scipy/pull/11454): DOC: Remove caveat on `maximum\_bipartite\_matching` +* [#11455](https://github.com/scipy/scipy/pull/11455): BUG: Fix \_lib.\_util.getargspec\_no\_self lack of KEYWORD\_ONLY support. +* [#11456](https://github.com/scipy/scipy/pull/11456): Implementation of khatri\_rao product +* [#11459](https://github.com/scipy/scipy/pull/11459): BUG: fix augmentation being broken in maximum\_bipartite\_matching +* [#11461](https://github.com/scipy/scipy/pull/11461): MAINT: minor spelling corrections in comments in SciPy.sparse.linalg.arpack +* [#11467](https://github.com/scipy/scipy/pull/11467): [MRG] Make result data type of KDE evaluation like in the input… +* [#11469](https://github.com/scipy/scipy/pull/11469): Update integrate.quad documentation +* [#11472](https://github.com/scipy/scipy/pull/11472): Fixed result typo +* [#11476](https://github.com/scipy/scipy/pull/11476): DOC: stats: Copy-edit the anderson docstring. +* [#11478](https://github.com/scipy/scipy/pull/11478): ENH: avoid unnecessary array copies in matrix product +* [#11481](https://github.com/scipy/scipy/pull/11481): BUG: Make special.hyperu return nan if any argument is nan +* [#11483](https://github.com/scipy/scipy/pull/11483): BUG: Fixed `\_kpp` initialization on `scipy.cluster.vq`, closing… +* [#11485](https://github.com/scipy/scipy/pull/11485): ENH: Update docstring of class KrylovJacobian to fix #2744 +* [#11486](https://github.com/scipy/scipy/pull/11486): BUG: make special.eval\_hermite return nan if second argument… +* [#11487](https://github.com/scipy/scipy/pull/11487): ENH: improve docstring of correlate and correlate2d to fix #1968 +* [#11488](https://github.com/scipy/scipy/pull/11488): FIX: change “func -> fun” of scipy.optimize \_root.py to solve… +* [#11489](https://github.com/scipy/scipy/pull/11489): BUG: fixes typo introduced in PR #11253 in stats.mstats.kendalltau() +* [#11490](https://github.com/scipy/scipy/pull/11490): DOC: fix typo in scipy/io/matlab/mio4.py +* [#11495](https://github.com/scipy/scipy/pull/11495): MAINT: refactor slsqp to fix issue in callback function +* [#11498](https://github.com/scipy/scipy/pull/11498): [DOC] mention graph cuts in maximum flow docstring +* [#11499](https://github.com/scipy/scipy/pull/11499): DOC: Improve documentation of scipy.signal.signaltools.wiener +* [#11506](https://github.com/scipy/scipy/pull/11506): DOC: Fix typo in documentation of scipy.stats.morestats +* [#11508](https://github.com/scipy/scipy/pull/11508): ENH: avoid copy on sparse \_\_init\_\_ when dtype is given +* [#11509](https://github.com/scipy/scipy/pull/11509): ENH: avoid unnecessary array copies in matrix product (again) +* [#11510](https://github.com/scipy/scipy/pull/11510): [DOC] An ex. for creating arbitrary size tri-diagonal +* [#11511](https://github.com/scipy/scipy/pull/11511): TST: pin numba for Travis/sparse +* [#11513](https://github.com/scipy/scipy/pull/11513): TST: disable NumPy cache dir ppc64le +* [#11514](https://github.com/scipy/scipy/pull/11514): BUG: make special.eval\_genlaguerre return nan if passed nan +* [#11517](https://github.com/scipy/scipy/pull/11517): ENH: improve sparse.lil.tocsr performance +* [#11519](https://github.com/scipy/scipy/pull/11519): Fix fresnel documentation +* [#11520](https://github.com/scipy/scipy/pull/11520): BUG: make special.eval\_gegenbauer return nan if passed nan +* [#11524](https://github.com/scipy/scipy/pull/11524): ENH: Cosine Sine Decomposition +* [#11526](https://github.com/scipy/scipy/pull/11526): BUG: fix SLSQP max iteration setting to fix #4921 +* [#11527](https://github.com/scipy/scipy/pull/11527): ENH: improve docstring of weibull\_min\_gen and weibull\_max\_gen… +* [#11530](https://github.com/scipy/scipy/pull/11530): MAINT: Removed 3 unused imports, 3 unused assignments from ndimage. +* [#11531](https://github.com/scipy/scipy/pull/11531): DOC: fix typos in bdtr and bdtrc from gh PR 11045 +* [#11532](https://github.com/scipy/scipy/pull/11532): MAINT: Fixed several unused imports and unused assignments from… +* [#11533](https://github.com/scipy/scipy/pull/11533): MAINT: Fixed about 100 unused imports, unused assignment warnings… +* [#11534](https://github.com/scipy/scipy/pull/11534): FIX: Allow non-native byte order inputs to scipy.fft +* [#11535](https://github.com/scipy/scipy/pull/11535): MAINT: Fixed several unused imports in \_lib. +* [#11536](https://github.com/scipy/scipy/pull/11536): MAINT: Fixed several unused imports and unused assignments in… +* [#11537](https://github.com/scipy/scipy/pull/11537): MAINT: Removed an unused import in scipy/constants. +* [#11538](https://github.com/scipy/scipy/pull/11538): MAINT: Fixed several unused imports in scipy/fft. +* [#11539](https://github.com/scipy/scipy/pull/11539): MAINT: Fixed several unused imports and unused assignments in… +* [#11540](https://github.com/scipy/scipy/pull/11540): MAINT: Fixed two unused imports in scipy/misc. +* [#11541](https://github.com/scipy/scipy/pull/11541): MAINT: Fixed several unused imports and unused assignments in… +* [#11542](https://github.com/scipy/scipy/pull/11542): MAINT: Fixed an unused import in scipy/odr. +* [#11543](https://github.com/scipy/scipy/pull/11543): MAINT: Fixed several unused imports and unused assignments in… +* [#11544](https://github.com/scipy/scipy/pull/11544): MAINT: Fixed unused imports and unused assignments in scipy/integrate. +* [#11545](https://github.com/scipy/scipy/pull/11545): MAINT: Removed unused imports and fixed unused assignments in… +* [#11546](https://github.com/scipy/scipy/pull/11546): MAINT: Removed unused imports; fixed unused assignments in scipy/signal. +* [#11547](https://github.com/scipy/scipy/pull/11547): MAINT: Removed unused imports; fixed unused assignments in scipy/spatial +* [#11548](https://github.com/scipy/scipy/pull/11548): MAINT: Removed unused imports; fixed unused assignments in scipy.sparse. +* [#11549](https://github.com/scipy/scipy/pull/11549): MAINT: Replace xrange with range +* [#11560](https://github.com/scipy/scipy/pull/11560): MAINT: stats: remove an \_argcheck call +* [#11573](https://github.com/scipy/scipy/pull/11573): MAINT: Removed unused imports; fixed unused assignments in scipy/stats. +* [#11574](https://github.com/scipy/scipy/pull/11574): MAINT: Small change to `optimize.nnls` error messages. +* [#11575](https://github.com/scipy/scipy/pull/11575): MAINT: Update sytrd/hetrd tests +* [#11582](https://github.com/scipy/scipy/pull/11582): MAINT: fix typo in quadpack.py closes #11448 +* [#11585](https://github.com/scipy/scipy/pull/11585): TST: add openblas\_support.py +* [#11587](https://github.com/scipy/scipy/pull/11587): BUG: Differential evolution with LinearConstraint with sparse… +* [#11588](https://github.com/scipy/scipy/pull/11588): MAINT: Fully display problem size in lsmr/lsqr. +* [#11589](https://github.com/scipy/scipy/pull/11589): MAINT: Remove Python 2 workarounds +* [#11590](https://github.com/scipy/scipy/pull/11590): MAINT: Remove Python2 module init +* [#11605](https://github.com/scipy/scipy/pull/11605): Standardization of bounds in \_linprog\_util.py +* [#11608](https://github.com/scipy/scipy/pull/11608): BUG: fix use of is in DE callback +* [#11614](https://github.com/scipy/scipy/pull/11614): TST, MAINT: TestCtypesQuad skip with pytest +* [#11619](https://github.com/scipy/scipy/pull/11619): ENH: add nan\_policy argument and functionality to stats.mstats.winsorize +* [#11621](https://github.com/scipy/scipy/pull/11621): MAINT: Cleanup uses of PY\_VERSION\_HEX, NPY\_PY3K in ndimage +* [#11622](https://github.com/scipy/scipy/pull/11622): MAINT: Cleanup uses of PY\_VERSION\_HEX, NPY\_PY3K in sparse +* [#11623](https://github.com/scipy/scipy/pull/11623): MAINT: Remove unnecessary ‘from \_\_future\_\_ import …’ statements +* [#11626](https://github.com/scipy/scipy/pull/11626): MAINT: Cleanup uses of PY\_VERSION\_HEX +* [#11627](https://github.com/scipy/scipy/pull/11627): ENH: add analytic formula for normal moments +* [#11628](https://github.com/scipy/scipy/pull/11628): MAINT, TST: adjust azure for matplotlib release +* [#11631](https://github.com/scipy/scipy/pull/11631): Revert to old behaviour for constant cost matrices in `linear\_sum\_assignment` +* [#11632](https://github.com/scipy/scipy/pull/11632): MAINT: Define ARRAY\_ANYORDER with DEF instead of cdef +* [#11639](https://github.com/scipy/scipy/pull/11639): BUG: interpolate/interp1d: fail gracefully on all-nan inputs +* [#11640](https://github.com/scipy/scipy/pull/11640): MAINT: Fix BLAS3 trmm wrapper for “side” arg +* [#11642](https://github.com/scipy/scipy/pull/11642): TST, MAINT: remove dead code in Travis CI +* [#11643](https://github.com/scipy/scipy/pull/11643): MAINT: fix conversion in binom\_test +* [#11645](https://github.com/scipy/scipy/pull/11645): MAINT: Assorted clean up. +* [#11646](https://github.com/scipy/scipy/pull/11646): MAINT: Remove unnecessary ‘from \_\_future\_\_ import …’ statements +* [#11647](https://github.com/scipy/scipy/pull/11647): DOC: document return\_all arguments +* [#11648](https://github.com/scipy/scipy/pull/11648): Perform geometric slerp in quaternion space +* [#11651](https://github.com/scipy/scipy/pull/11651): DOC: Update paper URL in lambertw documentation +* [#11653](https://github.com/scipy/scipy/pull/11653): PERF: Switch to C++ STL std::nth\_element +* [#11655](https://github.com/scipy/scipy/pull/11655): MAINT: Remove Python2 cStringStream +* [#11657](https://github.com/scipy/scipy/pull/11657): ENH: Add wrapper for ?pttrf/?pttrs +* [#11664](https://github.com/scipy/scipy/pull/11664): ENH: Add wrapper for ?gejsv +* [#11665](https://github.com/scipy/scipy/pull/11665): ENH: Add wrapper for ?pteqr +* [#11667](https://github.com/scipy/scipy/pull/11667): BUG: Non-central Fisher distribution (fix nan-values when nc=0) +* [#11668](https://github.com/scipy/scipy/pull/11668): ENH: Add wrapper for ?gtsvx +* [#11671](https://github.com/scipy/scipy/pull/11671): TST, CI: restore Azure temporarily +* [#11672](https://github.com/scipy/scipy/pull/11672): Add warning to medfilt when array size < kernel\_size +* [#11674](https://github.com/scipy/scipy/pull/11674): TST: bump test precision for two np.dot related linalg tests. +* [#11675](https://github.com/scipy/scipy/pull/11675): MAINT: pycodestyle clean-up +* [#11677](https://github.com/scipy/scipy/pull/11677): ENH: Add wrapper for ?ptsvx +* [#11679](https://github.com/scipy/scipy/pull/11679): BENCH: cKDTree benchmarks added: balanced/unbalanced tree (related… +* [#11680](https://github.com/scipy/scipy/pull/11680): MAINT: rng\_integers allows RandomState.randint or Generator.integers +* [#11683](https://github.com/scipy/scipy/pull/11683): BUG: fix mode=’mirror’ on length 1 axes +* [#11684](https://github.com/scipy/scipy/pull/11684): BUG: fix scipy.special.voigt\_profile +* [#11687](https://github.com/scipy/scipy/pull/11687): MAINT: sparse.linalg: avoid importing from `np.core` +* [#11688](https://github.com/scipy/scipy/pull/11688): ENH: mypy: get specific about ignoring missing imports +* [#11690](https://github.com/scipy/scipy/pull/11690): MAINT: mypy: fix errors about incompatible types in lists +* [#11692](https://github.com/scipy/scipy/pull/11692): MAINT: mypy: fix remaining type errors +* [#11694](https://github.com/scipy/scipy/pull/11694): TST, MAINT: bump to OpenBLAS 0.3.9 stable, raise tol for Win… +* [#11697](https://github.com/scipy/scipy/pull/11697): DOC: fix pdf of norminvgauss in scipy.stats +* [#11701](https://github.com/scipy/scipy/pull/11701): MAINT: special: add rudimentary types for `\_ufuncs` extension… +* [#11702](https://github.com/scipy/scipy/pull/11702): BUG: Fixed a post-merge bug for eigh() +* [#11703](https://github.com/scipy/scipy/pull/11703): Improves docstring with consistent L2-norm +* [#11705](https://github.com/scipy/scipy/pull/11705): DOC: Slerp the SphericalVoronoi docstring +* [#11706](https://github.com/scipy/scipy/pull/11706): ENH: mypy: add `–mypy` option to `runtests.py` +* [#11710](https://github.com/scipy/scipy/pull/11710): ENH: Modified stats.kstest() to use the exact stats.kstwo.sf()… +* [#11715](https://github.com/scipy/scipy/pull/11715): DOC: add .. versionadded:: to as\_matrix/from\_matrix in spatial/transf… +* [#11716](https://github.com/scipy/scipy/pull/11716): BENCH: fix benchmark imports for ``optimize\_linprog.py`` +* [#11721](https://github.com/scipy/scipy/pull/11721): MAINT: io: Remove now-unnecessary `# type: ignore` +* [#11722](https://github.com/scipy/scipy/pull/11722): MAINT: mypy: remove mpmath from the ratchet +* [#11726](https://github.com/scipy/scipy/pull/11726): Handle constant input for scipy.stats.f\_oneway +* [#11729](https://github.com/scipy/scipy/pull/11729): BENCH: optimize: added infeasible benchmarks for linprog +* [#11731](https://github.com/scipy/scipy/pull/11731): fix inaccurate information about Mac OS compiler (#11696) +* [#11733](https://github.com/scipy/scipy/pull/11733): Fix inaccurate docstring example of HalfspaceIntersection +* [#11734](https://github.com/scipy/scipy/pull/11734): Doc: fix inaccurate docstring of SmoothBivariateSpline. +* [#11735](https://github.com/scipy/scipy/pull/11735): Bug: stats: fix wrong shape from median\_absolute\_deviation for… +* [#11736](https://github.com/scipy/scipy/pull/11736): ENH: add input validations and its tests for FITPACK in fitpack2.py +* [#11737](https://github.com/scipy/scipy/pull/11737): BUG: Prevent crashes due to MKL bug in ?heevr +* [#11739](https://github.com/scipy/scipy/pull/11739): MAINT: special: add type stubs for `\_test\_round.pyx` +* [#11740](https://github.com/scipy/scipy/pull/11740): MAINT: special: remove unused specfun f2py wrappers +* [#11741](https://github.com/scipy/scipy/pull/11741): BUG: fix small tolerances handling for minpack and add a test. +* [#11743](https://github.com/scipy/scipy/pull/11743): Doc: fix docstring of rfft, rfft2, rfftn, irfft, irfft2, irfftn… +* [#11744](https://github.com/scipy/scipy/pull/11744): MAINT: Remove unused py3k.h code +* [#11745](https://github.com/scipy/scipy/pull/11745): DOC: stats: Clean up ncf documentation. +* [#11748](https://github.com/scipy/scipy/pull/11748): MAINT: special: type `cython\_special` as `Any` +* [#11750](https://github.com/scipy/scipy/pull/11750): MAINT: type hints for `\_spherical\_voronoi` +* [#11752](https://github.com/scipy/scipy/pull/11752): DOC: fix docstring of scipy.optimize.least\_squares +* [#11753](https://github.com/scipy/scipy/pull/11753): ENH: add input validation for dendrogram and a test. +* [#11755](https://github.com/scipy/scipy/pull/11755): MAINT: Replace uses of tostring with tobytes +* [#11757](https://github.com/scipy/scipy/pull/11757): ENH: improve binned\_statistics\_2d performance. +* [#11759](https://github.com/scipy/scipy/pull/11759): ENH: optimize: add HiGHS methods to linprog +* [#11760](https://github.com/scipy/scipy/pull/11760): MAINT: Remove FileStream replaced by GenericStream +* [#11761](https://github.com/scipy/scipy/pull/11761): MAINT: Replace npy\_3kcompat.h shims +* [#11765](https://github.com/scipy/scipy/pull/11765): TST: Speedup test\_pascal which is VERY slow on Azure +* [#11766](https://github.com/scipy/scipy/pull/11766): TST: speed up differential\_evolution L8 test +* [#11767](https://github.com/scipy/scipy/pull/11767): Change comment in continuous rv gamma fit function +* [#11776](https://github.com/scipy/scipy/pull/11776): Add domain option for resample. +* [#11784](https://github.com/scipy/scipy/pull/11784): BUG: Fixed calculation of nonzero elements in scipy.sparse.random +* [#11786](https://github.com/scipy/scipy/pull/11786): ENH: stats: add axis keyword argument to scipy.stats.rankdata +* [#11789](https://github.com/scipy/scipy/pull/11789): Doc: fix docstring of scipy.spatial.chebyshev +* [#11792](https://github.com/scipy/scipy/pull/11792): DOC: dev: add guidelines for developing public Cython APIs +* [#11794](https://github.com/scipy/scipy/pull/11794): MAINT: add comments explaining a problem in cython\_optimize organization +* [#11796](https://github.com/scipy/scipy/pull/11796): DOC: add a note about precision losing in csgraph.minimum\_spanning\_tree… +* [#11797](https://github.com/scipy/scipy/pull/11797): ENH: Allow negative `axis` in `interpolate.BSpline`. Also… +* [#11798](https://github.com/scipy/scipy/pull/11798): Add simplify\_cells parameter to scipy.io.loadmat +* [#11801](https://github.com/scipy/scipy/pull/11801): MAINT, DOC: minor changes of ratio-of-uniforms in scipy.stats +* [#11802](https://github.com/scipy/scipy/pull/11802): BUG: fix scipy.odr to handle multidimensional independent and… +* [#11803](https://github.com/scipy/scipy/pull/11803): scipy.stats.trapz: Use analytic formulas for stats and entropy. +* [#11808](https://github.com/scipy/scipy/pull/11808): DOC: add Examples in the scipy.interpolate.interpn docstring. +* [#11809](https://github.com/scipy/scipy/pull/11809): Duplicate entries are added together in csr\_matrix constructor +* [#11813](https://github.com/scipy/scipy/pull/11813): MAINT: bump pyflakes to version 2.1.1 +* [#11814](https://github.com/scipy/scipy/pull/11814): BUG: scipy.sparse.csr doctest failing with incorrect output value +* [#11817](https://github.com/scipy/scipy/pull/11817): DOC: add Examples in the scipy.optimize.leastsq docstring +* [#11820](https://github.com/scipy/scipy/pull/11820): ENH: Raise an error on incorrect bounds format in optimize.fmin\_l\_bfgs\_b +* [#11822](https://github.com/scipy/scipy/pull/11822): CI: add github actions for macOS +* [#11824](https://github.com/scipy/scipy/pull/11824): DOC: add Examples in scipy.optimize.line\_search docstring (line\_search\_wolfe2) +* [#11830](https://github.com/scipy/scipy/pull/11830): TST: Always use fork for multiprocessing in fft tests +* [#11831](https://github.com/scipy/scipy/pull/11831): DOC: add Examples and Returns in scipy.misc.central\_diff\_weights… +* [#11832](https://github.com/scipy/scipy/pull/11832): DOC: stats: Some small corrections to a couple docstrings. +* [#11833](https://github.com/scipy/scipy/pull/11833): BUG: Fix compiler\_name when there are paths used in flags +* [#11836](https://github.com/scipy/scipy/pull/11836): MAINT: re-introduce multiprocessing tests on Python3.8 +* [#11837](https://github.com/scipy/scipy/pull/11837): Doc: add Examples in scipy.optimize.fsolve docstring +* [#11838](https://github.com/scipy/scipy/pull/11838): Doc: add Examples in scipy.sparse.linalg.minres docstring +* [#11840](https://github.com/scipy/scipy/pull/11840): BUG: sparse.linalg: fix overflow in expm intermediate computation +* [#11842](https://github.com/scipy/scipy/pull/11842): BLD: fix build with gfortran 10 +* [#11843](https://github.com/scipy/scipy/pull/11843): MAINT: Simplify floats in constants.py +* [#11847](https://github.com/scipy/scipy/pull/11847): DOC: add a tutorial of scipy.optimize.linprog +* [#11849](https://github.com/scipy/scipy/pull/11849): ENH: speed up geninvgauss by using cython +* [#11852](https://github.com/scipy/scipy/pull/11852): CI: remove osx from travisCI +* [#11857](https://github.com/scipy/scipy/pull/11857): BUG: Change parameter fc of gausspulse to float. +* [#11861](https://github.com/scipy/scipy/pull/11861): order = degree + 1 for splines +* [#11863](https://github.com/scipy/scipy/pull/11863): Make g77 ABI wrapper work with gfortran ABI lapack +* [#11866](https://github.com/scipy/scipy/pull/11866): MAINT: add type ignores to sympy and matplotlib imports +* [#11867](https://github.com/scipy/scipy/pull/11867): CI: Add arm64 in travis-ci +* [#11869](https://github.com/scipy/scipy/pull/11869): DOC: signal: Add an example to the lsim2 docstring. +* [#11870](https://github.com/scipy/scipy/pull/11870): DOC: signal: Use impulse instead of impulse2 in the impulse example… +* [#11871](https://github.com/scipy/scipy/pull/11871): ENH: type ufuncs in special as ufuncs instead of Any +* [#11872](https://github.com/scipy/scipy/pull/11872): BUG: avoid recomputing in scipy.optimize.optimize.MemoizeJac +* [#11873](https://github.com/scipy/scipy/pull/11873): DOC: signal: Fix ODE in impulse and impulse2 docstrings. +* [#11874](https://github.com/scipy/scipy/pull/11874): DOC: add Examples of docstring for scipy.interpolate.approximate\_taylor\_polynomial +* [#11878](https://github.com/scipy/scipy/pull/11878): DOC: fixed a typo under scipy/integrate/quadrature.py +* [#11879](https://github.com/scipy/scipy/pull/11879): BUG: Fix index arrays overflow in sparse.kron +* [#11880](https://github.com/scipy/scipy/pull/11880): DOC: stats: Add Examples for bartlett, fligner, levene. +* [#11881](https://github.com/scipy/scipy/pull/11881): MAINT: normalise numpy–>np in optimize.py +* [#11882](https://github.com/scipy/scipy/pull/11882): DOC: add Examples for scipy.io.readsav docstring. +* [#11883](https://github.com/scipy/scipy/pull/11883): DOC: add Returns and Examples for scipy.ndimage.correlate() docstring +* [#11885](https://github.com/scipy/scipy/pull/11885): BUG: stats: Handle multidimensional arrays in f\_oneway, and more. +* [#11889](https://github.com/scipy/scipy/pull/11889): DOC: signal: Unify lsim and lsim2 examples. +* [#11896](https://github.com/scipy/scipy/pull/11896): BUG: stats: Fix handling of size 0 inputs for ttest\_rel and ttest\_ind. +* [#11897](https://github.com/scipy/scipy/pull/11897): DOC: Remove misleading default values from fit method +* [#11898](https://github.com/scipy/scipy/pull/11898): MAINT: LinearVectorFunction.J is ndarray closes #11886 +* [#11902](https://github.com/scipy/scipy/pull/11902): BUG: linalg: test\_heequb failure +* [#11904](https://github.com/scipy/scipy/pull/11904): fix real-to-real transforms for complex inputs and overwrite\_x=True +* [#11906](https://github.com/scipy/scipy/pull/11906): DOC: stats: fix error caused by trapz docstring +* [#11907](https://github.com/scipy/scipy/pull/11907): BUG: stats: fixed SEGFAULT from Issue #9710 +* [#11912](https://github.com/scipy/scipy/pull/11912): ENH: Respect matplotlib color palette with hierarchy/dendrogram. +* [#11914](https://github.com/scipy/scipy/pull/11914): DOC: refine doc for spatial.distance.squareform +* [#11915](https://github.com/scipy/scipy/pull/11915): ENH: Ndim linear operator +* [#11919](https://github.com/scipy/scipy/pull/11919): ENH: expose “window\_size” parameter in find\_peaks\_cwt() +* [#11920](https://github.com/scipy/scipy/pull/11920): DOC: explain M, diffev +* [#11923](https://github.com/scipy/scipy/pull/11923): CI: macOS install swig closes #11922 +* [#11924](https://github.com/scipy/scipy/pull/11924): DOC: add Examples for scipy.optimize.bracket() docstring +* [#11930](https://github.com/scipy/scipy/pull/11930): DOC: add Examples and clean up for signal.qspline1d and signal.qspline\_eval… +* [#11931](https://github.com/scipy/scipy/pull/11931): DOC: add Examples for sparse.linalg.bicg docstring. +* [#11933](https://github.com/scipy/scipy/pull/11933): DOC: Add original reference for Yao-Liu objective functions +* [#11934](https://github.com/scipy/scipy/pull/11934): DOC, MAINT: mailmap update +* [#11935](https://github.com/scipy/scipy/pull/11935): DOC: make scipy.stats.mode documentation reflect that the function… +* [#11936](https://github.com/scipy/scipy/pull/11936): ENH: special: add type stubs for `orthogonal.py` +* [#11937](https://github.com/scipy/scipy/pull/11937): DOC: Add docstring examples to fft2, ifft2, io.savemat +* [#11938](https://github.com/scipy/scipy/pull/11938): MAINT: add helper function for deprecating Cython API functions +* [#11942](https://github.com/scipy/scipy/pull/11942): MAINT: ignore conditional import in \_lib/\_util +* [#11943](https://github.com/scipy/scipy/pull/11943): MAINT: special: add types for geterr/seterr/errstate +* [#11946](https://github.com/scipy/scipy/pull/11946): MAINT: add py.typed marker +* [#11950](https://github.com/scipy/scipy/pull/11950): TST:MAINT: separated and stabilized heequb tests +* [#11952](https://github.com/scipy/scipy/pull/11952): DOC: update toolchain roadmap for py38, C99, C++11/14 +* [#11957](https://github.com/scipy/scipy/pull/11957): MAINT: Use np.errstate context manager instead of np.seterr. +* [#11958](https://github.com/scipy/scipy/pull/11958): MAINT: interpolate: Remove some trailing spaces. +* [#11960](https://github.com/scipy/scipy/pull/11960): MAINT: Cleanup Python2 compatibility code +* [#11961](https://github.com/scipy/scipy/pull/11961): MAINT: Remove numpy/npy\_3kcompat.h from \_superluobject.c +* [#11962](https://github.com/scipy/scipy/pull/11962): DOC: Fix type of `codes` in docstring of `\_vq.\_vq()` +* [#11964](https://github.com/scipy/scipy/pull/11964): MAINT: Cleanup unused IS\_PYPY +* [#11969](https://github.com/scipy/scipy/pull/11969): DOC: add Examples and fix docstring for special.airye +* [#11970](https://github.com/scipy/scipy/pull/11970): BUG: sparse: ‘diagonal’ of sparse matrices fixed to match numpy’s… +* [#11974](https://github.com/scipy/scipy/pull/11974): BUG: Reshape oaconvolve output even when no axes are convolved +* [#11976](https://github.com/scipy/scipy/pull/11976): MAINT: add logo for github actions +* [#11977](https://github.com/scipy/scipy/pull/11977): CI: test bleeding edge Python +* [#11979](https://github.com/scipy/scipy/pull/11979): DOC: add Examples for stats.ranksums() docstring. +* [#11982](https://github.com/scipy/scipy/pull/11982): Fix KMeans++ initialisation slowness +* [#11983](https://github.com/scipy/scipy/pull/11983): DOC: add Examples for stats.mstats.argstoarray() docstring. +* [#11986](https://github.com/scipy/scipy/pull/11986): Avoid bugs in ndimage when the output and input arrays overlap… +* [#11988](https://github.com/scipy/scipy/pull/11988): ENH: Override fit method of Laplace distribution with Maximum… +* [#11993](https://github.com/scipy/scipy/pull/11993): TST, CI: Azure Windows path fixups +* [#11995](https://github.com/scipy/scipy/pull/11995): MAINT, CI: remove custom mingw Azure +* [#11996](https://github.com/scipy/scipy/pull/11996): DOC: add Examples and fix pep warning for fft.set\_global\_backend… +* [#11997](https://github.com/scipy/scipy/pull/11997): MAINT, CI: Azure OpenBLAS simplify +* [#11998](https://github.com/scipy/scipy/pull/11998): BENCH: Run against current HEAD instead of master +* [#12001](https://github.com/scipy/scipy/pull/12001): ENH: stats: Implement \_logpdf for the maxwell distribution. +* [#12004](https://github.com/scipy/scipy/pull/12004): DOC: add examples for integrate.quad\_vec() and integrate.quad\_explain() +* [#12005](https://github.com/scipy/scipy/pull/12005): MAINT: Use helper functions in ?tbtrs tests +* [#12007](https://github.com/scipy/scipy/pull/12007): MAINT: updated LICENSES\_bundled for pybind11 and six +* [#12008](https://github.com/scipy/scipy/pull/12008): DOC: roadmap update +* [#12009](https://github.com/scipy/scipy/pull/12009): ENH: optimize: support 64-bit BLAS in lbfgsb +* [#12010](https://github.com/scipy/scipy/pull/12010): ENH: sparse.linalg: support 64-bit BLAS in isolve +* [#12012](https://github.com/scipy/scipy/pull/12012): DOC: add Examples for interpolate.barycentric\_interpolate(),… +* [#12013](https://github.com/scipy/scipy/pull/12013): MAINT: remove last uses of numpy.dual +* [#12014](https://github.com/scipy/scipy/pull/12014): CI: print 10 slowest tests +* [#12020](https://github.com/scipy/scipy/pull/12020): MAINT: Removed handling of circular input in SphericalVoronoi +* [#12022](https://github.com/scipy/scipy/pull/12022): DOC : added default value of absolute\_sigma to False in scipy.optimize.curve\_fit docs +* [#12024](https://github.com/scipy/scipy/pull/12024): DOC: add Examples for io.hb\_read() and io.hb\_write() +* [#12025](https://github.com/scipy/scipy/pull/12025): MAINT: Remove numpy/npy\_3kcompat.h from nd\_image +* [#12028](https://github.com/scipy/scipy/pull/12028): Spelling correction +* [#12030](https://github.com/scipy/scipy/pull/12030): ENH: optimize/\_trlib: support ILP64 blas/lapack +* [#12036](https://github.com/scipy/scipy/pull/12036): MAINT: Add some generated C files .gitignore +* [#12038](https://github.com/scipy/scipy/pull/12038): MAINT, CI: Travis rackcdn->conda.org +* [#12039](https://github.com/scipy/scipy/pull/12039): MAINT: signal: Lower the resolution of the plots in the chirp… +* [#12040](https://github.com/scipy/scipy/pull/12040): DOC: add Examples for ndimage.spline\_filter1d() and spline\_filter()… +* [#12044](https://github.com/scipy/scipy/pull/12044): MAINT: combine apt-get update and apt-get install into one RUN +* [#12045](https://github.com/scipy/scipy/pull/12045): TST: Reduce size of test\_diagonal\_types to speed up tests +* [#12046](https://github.com/scipy/scipy/pull/12046): MAINT: Remove unused npy\_3kcompat.h +* [#12047](https://github.com/scipy/scipy/pull/12047): MAINT: Cython 3.0 compat +* [#12050](https://github.com/scipy/scipy/pull/12050): DOC: add download number badges of PyPI and conda-forge in README.rst +* [#12052](https://github.com/scipy/scipy/pull/12052): DOC: add Examples odr.models.polynomial() and fix odr.odr docstring… +* [#12056](https://github.com/scipy/scipy/pull/12056): ENH: Modifies shapiro to return a named tuple +* [#12057](https://github.com/scipy/scipy/pull/12057): Adding my name into THANKS.txt +* [#12060](https://github.com/scipy/scipy/pull/12060): TST: Reduce number of test\_diagonal\_types configs +* [#12062](https://github.com/scipy/scipy/pull/12062): TST: Change dec.slow to pytest.mark.slow +* [#12068](https://github.com/scipy/scipy/pull/12068): ENH: Modifies jarque\_bera to return a named tuple +* [#12070](https://github.com/scipy/scipy/pull/12070): MAINT, CI: appveyor rack->conda.org +* [#12072](https://github.com/scipy/scipy/pull/12072): TST: filter out factorial(float) deprecation warning +* [#12078](https://github.com/scipy/scipy/pull/12078): TST: Skip test on colab with large memory alloc +* [#12079](https://github.com/scipy/scipy/pull/12079): DOC: Remove Python2 reference from stats tutorial +* [#12081](https://github.com/scipy/scipy/pull/12081): DOC: add Examples docstring for optimize.show\_options() +* [#12084](https://github.com/scipy/scipy/pull/12084): BUG: interpolate: fix BarycentricInterpolator with integer input… +* [#12089](https://github.com/scipy/scipy/pull/12089): ENH: spatial/qhull: support ILP64 Lapack +* [#12090](https://github.com/scipy/scipy/pull/12090): ENH: integrate: support ILP64 BLAS in odeint/vode/lsoda +* [#12091](https://github.com/scipy/scipy/pull/12091): ENH: integrate: support ILP64 in quadpack +* [#12092](https://github.com/scipy/scipy/pull/12092): BUG: Fix dropping dt in signal.StateSpace +* [#12093](https://github.com/scipy/scipy/pull/12093): MAINT: Rollback python2.6 workaround +* [#12094](https://github.com/scipy/scipy/pull/12094): MAINT: `openblas\_support` hash checks +* [#12095](https://github.com/scipy/scipy/pull/12095): MAINT: ndimage: change `shares\_memory` to `may\_share\_memory` +* [#12098](https://github.com/scipy/scipy/pull/12098): Doc: change 4 model instances of odr to be instances of `Model`… +* [#12101](https://github.com/scipy/scipy/pull/12101): Removed more unused imports and assignments. +* [#12107](https://github.com/scipy/scipy/pull/12107): ENH: Area calculation for 2D inputs in SphericalVoronoi +* [#12108](https://github.com/scipy/scipy/pull/12108): MAINT: ensure attributes have correct data type in `SphericalVoronoi` +* [#12109](https://github.com/scipy/scipy/pull/12109): degree is not order in splines +* [#12110](https://github.com/scipy/scipy/pull/12110): ENH: More helpful/forgiving io.wavfile errors +* [#12117](https://github.com/scipy/scipy/pull/12117): BUG: fix newline +* [#12123](https://github.com/scipy/scipy/pull/12123): [MAINT] Fix error on PyData/Sparse import. +* [#12124](https://github.com/scipy/scipy/pull/12124): TST: Always test matmul now that Python3.5+ is required +* [#12126](https://github.com/scipy/scipy/pull/12126): TST: Cleanup unused matplotlib code. +* [#12127](https://github.com/scipy/scipy/pull/12127): DOC: update docstrings of signal.cspline2d, qspline2d, sepfir2d +* [#12130](https://github.com/scipy/scipy/pull/12130): MAINT: Fixing broken links with linkchecker +* [#12135](https://github.com/scipy/scipy/pull/12135): ENH: linalg: Add the function convolution\_matrix. +* [#12136](https://github.com/scipy/scipy/pull/12136): MAINT: Cleanup np.poly1d hack +* [#12137](https://github.com/scipy/scipy/pull/12137): TST, CI: reproduce wheels 32-bit setup +* [#12140](https://github.com/scipy/scipy/pull/12140): TST: stats: add kstwo, ksone to slow tests. +* [#12141](https://github.com/scipy/scipy/pull/12141): Support 64-bit integer size in Fitpack +* [#12151](https://github.com/scipy/scipy/pull/12151): DOC: Correct Rosenbrock function sum +* [#12159](https://github.com/scipy/scipy/pull/12159): BUG: Fix length calculation in upfirdn +* [#12160](https://github.com/scipy/scipy/pull/12160): BUG: Fix M\_PI +* [#12168](https://github.com/scipy/scipy/pull/12168): DOC: add an obsolete version checking javascript to doc release… +* [#12171](https://github.com/scipy/scipy/pull/12171): CI, MAINT: Azure OpenBLAS drive flip +* [#12172](https://github.com/scipy/scipy/pull/12172): ENH: Bounds for the Powell minimization method +* [#12175](https://github.com/scipy/scipy/pull/12175): BLD: support more Fortran compilers for ilp64 and macro expansion… +* [#12179](https://github.com/scipy/scipy/pull/12179): BUG: stats: A few distributions didn’t accept lists as arguments. +* [#12180](https://github.com/scipy/scipy/pull/12180): MAINT: removed redundant import in SphericalVoronoi tests +* [#12181](https://github.com/scipy/scipy/pull/12181): DOC: for versionwarning don’t use $.getScript +* [#12182](https://github.com/scipy/scipy/pull/12182): MAINT: random sampling on the hypersphere in SphericalVoronoi… +* [#12194](https://github.com/scipy/scipy/pull/12194): MAINT: Module and example cleanups for doc build +* [#12202](https://github.com/scipy/scipy/pull/12202): ENH: tool to DL release wheels from Anaconda +* [#12210](https://github.com/scipy/scipy/pull/12210): Remove py.typed marker (at least for the release) +* [#12217](https://github.com/scipy/scipy/pull/12217): BUG: stats: Fix handling of edge cases in median\_abs\_deviation. +* [#12223](https://github.com/scipy/scipy/pull/12223): BUG: stats: wilcoxon returned p > 1 for certain inputs. +* [#12227](https://github.com/scipy/scipy/pull/12227): BLD: Set macos min version when building rectangular\_lsap +* [#12229](https://github.com/scipy/scipy/pull/12229): MAINT: tools/gh\_lists.py: fix http header case sensitivity issue +* [#12236](https://github.com/scipy/scipy/pull/12236): DOC: Fix a couple grammatical mistakes in 1.5.0-notes.rst. +* [#12276](https://github.com/scipy/scipy/pull/12276): TST: skip *test\_heequb*, it fails intermittently. +* [#12285](https://github.com/scipy/scipy/pull/12285): CI: split travis arm64 run into two +* [#12317](https://github.com/scipy/scipy/pull/12317): BUG: prevent error accumulation in *Rotation* multiplication +* [#12318](https://github.com/scipy/scipy/pull/12318): BUG: sparse: avoid np.prod overflow in check\_shape +* [#12319](https://github.com/scipy/scipy/pull/12319): BUG: Make cobyla threadsafe +* [#12335](https://github.com/scipy/scipy/pull/12335): MAINT: Work around Sphinx bug diff --git a/corpus/changelog/scipy_releases/scipy_151.md b/corpus/changelog/scipy_releases/scipy_151.md new file mode 100644 index 0000000000000000000000000000000000000000..22970af6957653f8ad4682b3c75888004ede4366 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_151.md @@ -0,0 +1,49 @@ +# SciPy 1.5.1 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.5.1-notes.html +Version: 1.5.1 + +Contents + +* [SciPy 1.5.1 Release Notes](#scipy-1-5-1-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.5.1](#issues-closed-for-1-5-1) + - [Pull requests for 1.5.1](#pull-requests-for-1-5-1) + +SciPy 1.5.1 is a bug-fix release with no new features +compared to 1.5.0. In particular, an issue where DLL loading +can fail for SciPy wheels on Windows with Python 3.6 has been +fixed. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Peter Bell +* Loïc Estève +* Philipp Thölke + +* Tyler Reddy +* Paul van Mulbregt +* Pauli Virtanen +* Warren Weckesser + +A total of 7 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.5.1](#id3)[#](#issues-closed-for-1-5-1 "Link to this heading") + +* [#9108](https://github.com/scipy/scipy/issues/9108): documentation: scipy.spatial.KDTree vs. scipy.spatial.cKDTree +* [#12218](https://github.com/scipy/scipy/issues/12218): Type error in stats.ks\_2samp when alternative != ‘two-sided- +* [#12406](https://github.com/scipy/scipy/issues/12406): DOC: Docstring in stats.anderson function not properly formatted +* [#12418](https://github.com/scipy/scipy/issues/12418): Regression in hierarchy.dendogram + +### [Pull requests for 1.5.1](#id4)[#](#pull-requests-for-1-5-1 "Link to this heading") + +* [#12280](https://github.com/scipy/scipy/pull/12280): BUG: Fixes gh-12218, TypeError converting int to float inside… +* [#12336](https://github.com/scipy/scipy/pull/12336): BUG: KDTree should reject complex input points +* [#12344](https://github.com/scipy/scipy/pull/12344): MAINT: Don’t use numpy’s aliases of Python builtin objects. +* [#12407](https://github.com/scipy/scipy/pull/12407): DOC: Fix docstring for dist param in anderson function +* [#12410](https://github.com/scipy/scipy/pull/12410): CI: Run the Azure Windows Python36 32bit tests with mode ‘fast’ +* [#12421](https://github.com/scipy/scipy/pull/12421): Fix regression in scipy 1.5.0 in dendogram when labels is a numpy… +* [#12462](https://github.com/scipy/scipy/pull/12462): MAINT: move distributor\_init import after \_\_config\_\_ import diff --git a/corpus/changelog/scipy_releases/scipy_152.md b/corpus/changelog/scipy_releases/scipy_152.md new file mode 100644 index 0000000000000000000000000000000000000000..9f690b45297bb82a7f6b05d10539fb688f24bb9d --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_152.md @@ -0,0 +1,81 @@ +# SciPy 1.5.2 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.5.2-notes.html +Version: 1.5.2 + +Contents + +* [SciPy 1.5.2 Release Notes](#scipy-1-5-2-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.5.2](#issues-closed-for-1-5-2) + - [Pull requests for 1.5.2](#pull-requests-for-1-5-2) + +SciPy 1.5.2 is a bug-fix release with no new features +compared to 1.5.1. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Peter Bell +* Tobias Biester + +* Evgeni Burovski +* Thomas A Caswell +* Ralf Gommers +* Sturla Molden +* Andrew Nelson +* ofirr + +* Sambit Panda +* Ilhan Polat +* Tyler Reddy +* Atsushi Sakai +* Pauli Virtanen + +A total of 13 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.5.2](#id3)[#](#issues-closed-for-1-5-2 "Link to this heading") + +* [#3847](https://github.com/scipy/scipy/issues/3847): Crash of interpolate.splprep(task=-1) +* [#7395](https://github.com/scipy/scipy/issues/7395): splprep segfaults if fixed knots are specified +* [#10761](https://github.com/scipy/scipy/issues/10761): scipy.signal.convolve2d produces incorrect values for large arrays +* [#11971](https://github.com/scipy/scipy/issues/11971): DOC: search in devdocs returns wrong link +* [#12155](https://github.com/scipy/scipy/issues/12155): BUG: Fix permutation of distance matrices in scipy.stats.multiscale\_graphcorr +* [#12203](https://github.com/scipy/scipy/issues/12203): Unable to install on PyPy 7.3.1 (Python 3.6.9) +* [#12316](https://github.com/scipy/scipy/issues/12316): negative scipy.spatial.distance.correlation +* [#12422](https://github.com/scipy/scipy/issues/12422): BUG: slsqp: ValueError: failed to initialize intent(inout) array… +* [#12428](https://github.com/scipy/scipy/issues/12428): stats.truncnorm.rvs() never returns a scalar in 1.5 +* [#12441](https://github.com/scipy/scipy/issues/12441): eigvalsh inconsistent eigvals= subset\_by\_index= +* [#12445](https://github.com/scipy/scipy/issues/12445): DOC: scipy.linalg.eigh +* [#12449](https://github.com/scipy/scipy/issues/12449): Warnings are not filtered in csr\_matrix.sum() +* [#12469](https://github.com/scipy/scipy/issues/12469): SciPy 1.9 exception in LSQSphereBivariateSpline +* [#12487](https://github.com/scipy/scipy/issues/12487): BUG: optimize: incorrect result from approx\_fprime +* [#12493](https://github.com/scipy/scipy/issues/12493): CI: GitHub Actions for maintenance branches +* [#12533](https://github.com/scipy/scipy/issues/12533): eigh gives incorrect results +* [#12579](https://github.com/scipy/scipy/issues/12579): BLD, MAINT: distutils issues in wheels repo + +### [Pull requests for 1.5.2](#id4)[#](#pull-requests-for-1-5-2 "Link to this heading") + +* [#12156](https://github.com/scipy/scipy/pull/12156): BUG: Fix permutation of distance matrices in scipy.stats.multiscale\_graphcorr +* [#12238](https://github.com/scipy/scipy/pull/12238): BUG: Use 64-bit indexing in convolve2d to avoid overflow +* [#12256](https://github.com/scipy/scipy/pull/12256): BLD: Build lsap as a single extension instead of extension +… +* [#12320](https://github.com/scipy/scipy/pull/12320): BUG: spatial: avoid returning negative correlation distance +* [#12383](https://github.com/scipy/scipy/pull/12383): ENH: Make cKDTree.tree more efficient +* [#12392](https://github.com/scipy/scipy/pull/12392): DOC: update scipy-sphinx-theme +* [#12430](https://github.com/scipy/scipy/pull/12430): BUG: truncnorm and geninvgauss never return scalars from rvs +* [#12437](https://github.com/scipy/scipy/pull/12437): BUG: optimize: cast bounds to floats in new\_bounds\_to\_old/old\_bounds\_to\_new +* [#12442](https://github.com/scipy/scipy/pull/12442): MAINT:linalg: Fix for input args of eigvalsh +* [#12461](https://github.com/scipy/scipy/pull/12461): MAINT: sparse: write matrix/asmatrix wrappers without warning… +* [#12478](https://github.com/scipy/scipy/pull/12478): BUG: fix array\_like input defects and add tests for all functions… +* [#12488](https://github.com/scipy/scipy/pull/12488): BUG: fix approx\_derivative step size. Closes #12487 +* [#12500](https://github.com/scipy/scipy/pull/12500): CI: actions branch trigger fix +* [#12501](https://github.com/scipy/scipy/pull/12501): CI: actions branch trigger fix +* [#12504](https://github.com/scipy/scipy/pull/12504): BUG: cKDTreeNode use after free +* [#12529](https://github.com/scipy/scipy/pull/12529): MAINT: allow graceful docs re-upload +* [#12538](https://github.com/scipy/scipy/pull/12538): BUG:linalg: eigh type parameter handling corrected +* [#12560](https://github.com/scipy/scipy/pull/12560): MAINT: truncnorm.rvs compatibility for `Generator` +* [#12562](https://github.com/scipy/scipy/pull/12562): redo gh-12188: fix segfaults in splprep with fixed knots +* [#12586](https://github.com/scipy/scipy/pull/12586): BLD: Add -std=c99 to sigtools to compile with C99 +* [#12590](https://github.com/scipy/scipy/pull/12590): CI: Add GCC 4.8 entry to travis build matrix +* [#12591](https://github.com/scipy/scipy/pull/12591): BLD: fix cython error on master-branch cython diff --git a/corpus/changelog/scipy_releases/scipy_153.md b/corpus/changelog/scipy_releases/scipy_153.md new file mode 100644 index 0000000000000000000000000000000000000000..158ab183d2ae08e04990f87acda391b70f10f275 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_153.md @@ -0,0 +1,77 @@ +# SciPy 1.5.3 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.5.3-notes.html +Version: 1.5.3 + +Contents + +* [SciPy 1.5.3 Release Notes](#scipy-1-5-3-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.5.3](#issues-closed-for-1-5-3) + - [Pull requests for 1.5.3](#pull-requests-for-1-5-3) + +SciPy 1.5.3 is a bug-fix release with no new features +compared to 1.5.2. In particular, Linux ARM64 wheels are now +available and a compatibility issue with XCode 12 has +been fixed. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Peter Bell +* CJ Carey +* Thomas Duvernay + +* Gregory Lee +* Eric Moore +* odidev +* Dima Pasechnik +* Tyler Reddy +* Simon Segerblom Rex + +* Daniel B. Smith +* Will Tirone + +* Warren Weckesser + +A total of 12 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.5.3](#id3)[#](#issues-closed-for-1-5-3 "Link to this heading") + +* [#9611](https://github.com/scipy/scipy/issues/9611): Overflow error with new way of p-value calculation in kendall… +* [#10069](https://github.com/scipy/scipy/issues/10069): scipy.ndimage.watershed\_ift regression in 1.0.0 +* [#11260](https://github.com/scipy/scipy/issues/11260): BUG: DOP853 with complex data computes complex error norm, causing… +* [#11479](https://github.com/scipy/scipy/issues/11479): RuntimeError: dictionary changed size during iteration on loading… +* [#11972](https://github.com/scipy/scipy/issues/11972): BUG (solved): Error estimation in DOP853 ODE solver fails for… +* [#12543](https://github.com/scipy/scipy/issues/12543): BUG: Picture rotated 180 degrees and rotated -180 degrees should… +* [#12613](https://github.com/scipy/scipy/issues/12613): Travis X.4 and X.7 failures in master +* [#12654](https://github.com/scipy/scipy/issues/12654): scipy.stats.combine\_pvalues produces wrong results with method=’mudholkar\_george’ +* [#12819](https://github.com/scipy/scipy/issues/12819): BUG: Scipy Sparse slice indexing assignment Bug with zeros +* [#12834](https://github.com/scipy/scipy/issues/12834): BUG: ValueError upon calling Scipy Interpolator objects +* [#12836](https://github.com/scipy/scipy/issues/12836): ndimage.median can return incorrect values for integer inputs +* [#12860](https://github.com/scipy/scipy/issues/12860): Build failure with Xcode 12 + +### [Pull requests for 1.5.3](#id4)[#](#pull-requests-for-1-5-3 "Link to this heading") + +* [#12611](https://github.com/scipy/scipy/pull/12611): MAINT: prepare for SciPy 1.5.3 +* [#12614](https://github.com/scipy/scipy/pull/12614): MAINT: prevent reverse broadcasting +* [#12617](https://github.com/scipy/scipy/pull/12617): MAINT: optimize: Handle nonscalar size 1 arrays in fmin\_slsqp… +* [#12623](https://github.com/scipy/scipy/pull/12623): MAINT: stats: Loosen some test tolerances. +* [#12638](https://github.com/scipy/scipy/pull/12638): CI, MAINT: pin pytest for Azure win +* [#12668](https://github.com/scipy/scipy/pull/12668): BUG: Ensure factorial is not too large in mstats.kendalltau +* [#12705](https://github.com/scipy/scipy/pull/12705): MAINT: `openblas\_support` added sha256 hash +* [#12706](https://github.com/scipy/scipy/pull/12706): BUG: fix incorrect 1d case of the fourier\_ellipsoid filter +* [#12721](https://github.com/scipy/scipy/pull/12721): BUG: use special.sindg in ndimage.rotate +* [#12724](https://github.com/scipy/scipy/pull/12724): BUG: per #12654 adjusted mudholkar\_george method to combine p… +* [#12726](https://github.com/scipy/scipy/pull/12726): BUG: Fix DOP853 error norm for complex problems +* [#12730](https://github.com/scipy/scipy/pull/12730): CI: pin xdist for Azure windows +* [#12786](https://github.com/scipy/scipy/pull/12786): BUG: stats: Fix formula in the `stats` method of the ARGUS… +* [#12795](https://github.com/scipy/scipy/pull/12795): CI: Pin setuptools on windows CI +* [#12830](https://github.com/scipy/scipy/pull/12830): [BUG] sparse: Avoid using size attribute in LIL \_\_setitem\_\_ +* [#12833](https://github.com/scipy/scipy/pull/12833): BUG: change list of globals items to list of a copy +* [#12842](https://github.com/scipy/scipy/pull/12842): BUG: Use uint16 for cost in NI\_WatershedElement +* [#12845](https://github.com/scipy/scipy/pull/12845): BUG: avoid boolean or integer addition error in ndimage.measurements.median +* [#12864](https://github.com/scipy/scipy/pull/12864): BLD: replace the #include of libqull\_r.h with with this of qhull\_ra.h… +* [#12867](https://github.com/scipy/scipy/pull/12867): BUG: Fixes a ValueError yielded upon calling Scipy Interpolator… +* [#12902](https://github.com/scipy/scipy/pull/12902): CI: Remove ‘env’ from pytest.ini +* [#12913](https://github.com/scipy/scipy/pull/12913): MAINT: Ignore pytest’s PytestConfigWarning diff --git a/corpus/changelog/scipy_releases/scipy_154.md b/corpus/changelog/scipy_releases/scipy_154.md new file mode 100644 index 0000000000000000000000000000000000000000..a697f24e60cdbdef6c2893a09c7d5aa255ba531b --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_154.md @@ -0,0 +1,57 @@ +# SciPy 1.5.4 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.5.4-notes.html +Version: 1.5.4 + +Contents + +* [SciPy 1.5.4 Release Notes](#scipy-1-5-4-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.5.4](#issues-closed-for-1-5-4) + - [Pull requests for 1.5.4](#pull-requests-for-1-5-4) + +SciPy 1.5.4 is a bug-fix release with no new features +compared to 1.5.3. Importantly, wheels are now available +for Python 3.9 and a more complete fix has been applied for +issues building with XCode 12. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Peter Bell +* CJ Carey +* Andrew McCluskey + +* Andrew Nelson +* Tyler Reddy +* Eli Rykoff + +* Ian Thomas + + +A total of 7 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.5.4](#id3)[#](#issues-closed-for-1-5-4 "Link to this heading") + +* [#12763](https://github.com/scipy/scipy/issues/12763): ndimage.fourier\_ellipsoid segmentation fault +* [#12789](https://github.com/scipy/scipy/issues/12789): TestConvolve2d.test\_large\_array failing on Windows ILP64 CI job +* [#12857](https://github.com/scipy/scipy/issues/12857): sparse A[0,:] = ndarray is ok, A[:,0] = ndarray ValueError from… +* [#12860](https://github.com/scipy/scipy/issues/12860): BUG: Build failure with Xcode 12 +* [#12935](https://github.com/scipy/scipy/issues/12935): Failure to build with Python 3.9.0 on macOS +* [#12966](https://github.com/scipy/scipy/issues/12966): MAINT: lint\_diff.py on some backport PRs +* [#12988](https://github.com/scipy/scipy/issues/12988): BUG: Highly multi-dimensional `gaussian\_kde` giving `-inf`… + +### [Pull requests for 1.5.4](#id4)[#](#pull-requests-for-1-5-4 "Link to this heading") + +* [#12790](https://github.com/scipy/scipy/pull/12790): TST: Skip TestConvolve2d.test\_large\_array if not enough memory +* [#12851](https://github.com/scipy/scipy/pull/12851): BUG: sparse: fix inner indexed assignment of a 1d array +* [#12875](https://github.com/scipy/scipy/pull/12875): BUG: segfault in ndimage.fourier\_ellipsoid with length-1 dims +* [#12937](https://github.com/scipy/scipy/pull/12937): CI: macOS3.9 testing +* [#12957](https://github.com/scipy/scipy/pull/12957): MAINT: fixes XCode 12/ python 3.9.0 build for 1.5.x maint branch +* [#12959](https://github.com/scipy/scipy/pull/12959): CI: add Windows Python 3.9 to CI +* [#12974](https://github.com/scipy/scipy/pull/12974): MAINT: Run lint\_diff.py against the merge target and only for… +* [#12978](https://github.com/scipy/scipy/pull/12978): DOC: next\_fast\_len output doesn’t match docstring +* [#12979](https://github.com/scipy/scipy/pull/12979): BUG: fft.next\_fast\_len should accept keyword arguments +* [#12989](https://github.com/scipy/scipy/pull/12989): BUG: improved the stability of kde for highly (1000s) multi-dimension… +* [#13017](https://github.com/scipy/scipy/pull/13017): BUG: Add explicit cast to \_tmp sum. +* [#13022](https://github.com/scipy/scipy/pull/13022): TST: xfail test\_maxiter\_worsening() diff --git a/corpus/changelog/scipy_releases/scipy_160.md b/corpus/changelog/scipy_releases/scipy_160.md new file mode 100644 index 0000000000000000000000000000000000000000..c325d7d3e07fde39beb6eb1a187e30629c04b659 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_160.md @@ -0,0 +1,969 @@ +# SciPy 1.6.0 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.6.0-notes.html +Version: 1.6.0 + +Contents + +* [SciPy 1.6.0 Release Notes](#scipy-1-6-0-release-notes) + + + [Highlights of this release](#highlights-of-this-release) + + - [New features](#new-features) + + [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#scipy-special-improvements) + + [[`scipy.odr`](../reference/odr.html#module-scipy.odr "scipy.odr") improvements](#scipy-odr-improvements) + + [[`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") improvements](#scipy-integrate-improvements) + + [[`scipy.cluster`](../reference/cluster.html#module-scipy.cluster "scipy.cluster") improvements](#scipy-cluster-improvements) + + [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#scipy-interpolate-improvements) + + [[`scipy.io`](../reference/io.html#module-scipy.io "scipy.io") improvements](#scipy-io-improvements) + + [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#scipy-linalg-improvements) + + [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#scipy-ndimage-improvements) + + [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#scipy-optimize-improvements) + + [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#scipy-signal-improvements) + + [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#scipy-sparse-improvements) + + [[`scipy.sparse.linalg`](../reference/sparse.linalg.html#module-scipy.sparse.linalg "scipy.sparse.linalg") improvements](#scipy-sparse-linalg-improvements) + + [[`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") improvements](#scipy-fft-improvements) + + [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#scipy-spatial-improvements) + + [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#scipy-stats-improvements) + + - [Deprecated features](#deprecated-features) + + [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") changes](#scipy-spatial-changes) + + - [Backwards incompatible changes](#backwards-incompatible-changes) + + [[`scipy`](../index.html#module-scipy "scipy") changes](#scipy-changes) + + [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") changes](#scipy-interpolate-changes) + + [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") changes](#scipy-linalg-changes) + + [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") changes](#scipy-signal-changes) + + [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") changes](#id1) + + [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") changes](#scipy-stats-changes) + + - [Other changes](#other-changes) + - [Authors](#authors) + + [Issues closed for 1.6.0](#issues-closed-for-1-6-0) + + [Pull requests for 1.6.0](#pull-requests-for-1-6-0) + +SciPy 1.6.0 is the culmination of 6 months of hard work. It contains +many new features, numerous bug-fixes, improved test coverage and better +documentation. There have been a number of deprecations and API changes +in this release, which are documented below. All users are encouraged to +upgrade to this release, as there are a large number of bug-fixes and +optimizations. Before upgrading, we recommend that users check that +their own code does not use deprecated SciPy functionality (to do so, +run your code with `python -Wd` and check for `DeprecationWarning` s). +Our development attention will now shift to bug-fix releases on the +1.6.x branch, and on adding new features on the master branch. + +This release requires Python 3.7+ and NumPy 1.16.5 or greater. + +For running on PyPy, PyPy3 6.0+ is required. + +## [Highlights of this release](#id3)[#](#highlights-of-this-release "Link to this heading") + +* [`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements: Fixes and ehancements to boundary extension + modes for interpolation functions. Support for complex-valued inputs in many + filtering and interpolation functions. New `grid_mode` option for + [`scipy.ndimage.zoom`](../reference/generated/scipy.ndimage.zoom.html#scipy.ndimage.zoom "scipy.ndimage.zoom") to enable results consistent with scikit-image’s + `rescale`. +* [`scipy.optimize.linprog`](../reference/generated/scipy.optimize.linprog.html#scipy.optimize.linprog "scipy.optimize.linprog") has fast, new methods for large, sparse problems + from the `HiGHS` library. +* [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements including new distributions, a new test, and + enhancements to existing distributions and tests + +### [New features](#id4)[#](#new-features "Link to this heading") + +## [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#id5)[#](#scipy-special-improvements "Link to this heading") + +[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") now has improved support for 64-bit `LAPACK` backend + +## [[`scipy.odr`](../reference/odr.html#module-scipy.odr "scipy.odr") improvements](#id6)[#](#scipy-odr-improvements "Link to this heading") + +[`scipy.odr`](../reference/odr.html#module-scipy.odr "scipy.odr") now has support for 64-bit integer `BLAS` + +[`scipy.odr.ODR`](../reference/generated/scipy.odr.ODR.html#scipy.odr.ODR "scipy.odr.ODR") has gained an optional `overwrite` argument so that existing +files may be overwritten. + +## [[`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") improvements](#id7)[#](#scipy-integrate-improvements "Link to this heading") + +Some renames of functions with poor names were done, with the old names +retained without being in the reference guide for backwards compatibility +reasons: +- `integrate.simps` was renamed to `integrate.simpson` +- `integrate.trapz` was renamed to `integrate.trapezoid` +- `integrate.cumtrapz` was renamed to `integrate.cumulative_trapezoid` + +## [[`scipy.cluster`](../reference/cluster.html#module-scipy.cluster "scipy.cluster") improvements](#id8)[#](#scipy-cluster-improvements "Link to this heading") + +[`scipy.cluster.hierarchy.DisjointSet`](../reference/generated/scipy.cluster.hierarchy.DisjointSet.html#scipy.cluster.hierarchy.DisjointSet "scipy.cluster.hierarchy.DisjointSet") has been added for incremental +connectivity queries. + +[`scipy.cluster.hierarchy.dendrogram`](../reference/generated/scipy.cluster.hierarchy.dendrogram.html#scipy.cluster.hierarchy.dendrogram "scipy.cluster.hierarchy.dendrogram") return value now also includes leaf color +information in *leaves\_color\_list*. + +## [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#id9)[#](#scipy-interpolate-improvements "Link to this heading") + +[`scipy.interpolate.interp1d`](../reference/generated/scipy.interpolate.interp1d.html#scipy.interpolate.interp1d "scipy.interpolate.interp1d") has a new method `nearest-up`, similar to the +existing method `nearest` but rounds half-integers up instead of down. + +## [[`scipy.io`](../reference/io.html#module-scipy.io "scipy.io") improvements](#id10)[#](#scipy-io-improvements "Link to this heading") + +Support has been added for reading arbitrary bit depth integer PCM WAV files +from 1- to 32-bit, including the commonly-requested 24-bit depth. + +## [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#id11)[#](#scipy-linalg-improvements "Link to this heading") + +The new function [`scipy.linalg.matmul_toeplitz`](../reference/generated/scipy.linalg.matmul_toeplitz.html#scipy.linalg.matmul_toeplitz "scipy.linalg.matmul_toeplitz") uses the FFT to compute the +product of a Toeplitz matrix with another matrix. + +[`scipy.linalg.sqrtm`](../reference/generated/scipy.linalg.sqrtm.html#scipy.linalg.sqrtm "scipy.linalg.sqrtm") and [`scipy.linalg.logm`](../reference/generated/scipy.linalg.logm.html#scipy.linalg.logm "scipy.linalg.logm") have performance improvements +thanks to additional Cython code. + +Python `LAPACK` wrappers have been added for `pptrf`, `pptrs`, `ppsv`, +`pptri`, and `ppcon`. + +[`scipy.linalg.norm`](../reference/generated/scipy.linalg.norm.html#scipy.linalg.norm "scipy.linalg.norm") and the `svd` family of functions will now use 64-bit +integer backends when available. + +## [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#id12)[#](#scipy-ndimage-improvements "Link to this heading") + +[`scipy.ndimage.convolve`](../reference/generated/scipy.ndimage.convolve.html#scipy.ndimage.convolve "scipy.ndimage.convolve"), [`scipy.ndimage.correlate`](../reference/generated/scipy.ndimage.correlate.html#scipy.ndimage.correlate "scipy.ndimage.correlate") and their 1d counterparts +now accept both complex-valued images and/or complex-valued filter kernels. All +convolution-based filters also now accept complex-valued inputs +(e.g. `gaussian_filter`, `uniform_filter`, etc.). + +Multiple fixes and enhancements to boundary handling were introduced to +[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") interpolation functions (i.e. `affine_transform`, +`geometric_transform`, `map_coordinates`, `rotate`, `shift`, `zoom`). + +A new boundary mode, `grid-wrap` was added which wraps images periodically, +using a period equal to the shape of the input image grid. This is in contrast +to the existing `wrap` mode which uses a period that is one sample smaller +than the original signal extent along each dimension. + +A long-standing bug in the `reflect` boundary condition has been fixed and +the mode `grid-mirror` was introduced as a synonym for `reflect`. + +A new boundary mode, `grid-constant` is now available. This is similar to +the existing ndimage `constant` mode, but interpolation will still performed +at coordinate values outside of the original image extent. This +`grid-constant` mode is consistent with OpenCV’s `BORDER_CONSTANT` mode +and scikit-image’s `constant` mode. + +Spline pre-filtering (used internally by `ndimage` interpolation functions +when `order >= 2`), now supports all boundary modes rather than always +defaulting to mirror boundary conditions. The standalone functions +`spline_filter` and `spline_filter1d` have analytical boundary conditions +that match modes `mirror`, `grid-wrap` and `reflect`. + +[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") interpolation functions now accept complex-valued inputs. In +this case, the interpolation is applied independently to the real and +imaginary components. + +The `ndimage` tutorials +() have been +updated with new figures to better clarify the exact behavior of all of the +interpolation boundary modes. + +[`scipy.ndimage.zoom`](../reference/generated/scipy.ndimage.zoom.html#scipy.ndimage.zoom "scipy.ndimage.zoom") now has a `grid_mode` option that changes the coordinate +of the center of the first pixel along an axis from 0 to 0.5. This allows +resizing in a manner that is consistent with the behavior of scikit-image’s +`resize` and `rescale` functions (and OpenCV’s `cv2.resize`). + +## [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#id13)[#](#scipy-optimize-improvements "Link to this heading") + +[`scipy.optimize.linprog`](../reference/generated/scipy.optimize.linprog.html#scipy.optimize.linprog "scipy.optimize.linprog") has fast, new methods for large, sparse problems from +the `HiGHS` C++ library. `method='highs-ds'` uses a high performance dual +revised simplex implementation (HSOL), `method='highs-ipm'` uses an +interior-point method with crossover, and `method='highs'` chooses between +the two automatically. These methods are typically much faster and often exceed +the accuracy of other `linprog` methods, so we recommend explicitly +specifying one of these three method values when using `linprog`. + +[`scipy.optimize.quadratic_assignment`](../reference/generated/scipy.optimize.quadratic_assignment.html#scipy.optimize.quadratic_assignment "scipy.optimize.quadratic_assignment") has been added for approximate solution +of the quadratic assignment problem. + +[`scipy.optimize.linear_sum_assignment`](../reference/generated/scipy.optimize.linear_sum_assignment.html#scipy.optimize.linear_sum_assignment "scipy.optimize.linear_sum_assignment") now has a substantially reduced overhead +for small cost matrix sizes + +[`scipy.optimize.least_squares`](../reference/generated/scipy.optimize.least_squares.html#scipy.optimize.least_squares "scipy.optimize.least_squares") has improved performance when the user provides +the jacobian as a sparse jacobian already in `csr_matrix` format + +[`scipy.optimize.linprog`](../reference/generated/scipy.optimize.linprog.html#scipy.optimize.linprog "scipy.optimize.linprog") now has an `rr_method` argument for specification +of the method used for redundancy handling, and a new method for this purpose +is available based on the interpolative decomposition approach. + +## [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#id14)[#](#scipy-signal-improvements "Link to this heading") + +[`scipy.signal.gammatone`](../reference/generated/scipy.signal.gammatone.html#scipy.signal.gammatone "scipy.signal.gammatone") has been added to design FIR or IIR filters that +model the human auditory system. + +[`scipy.signal.iircomb`](../reference/generated/scipy.signal.iircomb.html#scipy.signal.iircomb "scipy.signal.iircomb") has been added to design IIR peaking/notching comb +filters that can boost/attenuate a frequency from a signal. + +[`scipy.signal.sosfilt`](../reference/generated/scipy.signal.sosfilt.html#scipy.signal.sosfilt "scipy.signal.sosfilt") performance has been improved to avoid some previously- +observed slowdowns + +[`scipy.signal.windows.taylor`](../reference/generated/scipy.signal.windows.taylor.html#scipy.signal.windows.taylor "scipy.signal.windows.taylor") has been added–the Taylor window function is +commonly used in radar digital signal processing + +[`scipy.signal.gauss_spline`](../reference/generated/scipy.signal.gauss_spline.html#scipy.signal.gauss_spline "scipy.signal.gauss_spline") now supports `list` type input for consistency +with other related SciPy functions + +[`scipy.signal.correlation_lags`](../reference/generated/scipy.signal.correlation_lags.html#scipy.signal.correlation_lags "scipy.signal.correlation_lags") has been added to allow calculation of the lag/ +displacement indices array for 1D cross-correlation. + +## [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#id15)[#](#scipy-sparse-improvements "Link to this heading") + +A solver for the minimum weight full matching problem for bipartite graphs, +also known as the linear assignment problem, has been added in +[`scipy.sparse.csgraph.min_weight_full_bipartite_matching`](../reference/generated/scipy.sparse.csgraph.min_weight_full_bipartite_matching.html#scipy.sparse.csgraph.min_weight_full_bipartite_matching "scipy.sparse.csgraph.min_weight_full_bipartite_matching"). In particular, this +provides functionality analogous to that of +[`scipy.optimize.linear_sum_assignment`](../reference/generated/scipy.optimize.linear_sum_assignment.html#scipy.optimize.linear_sum_assignment "scipy.optimize.linear_sum_assignment"), but with improved performance for sparse +inputs, and the ability to handle inputs whose dense representations would not +fit in memory. + +The time complexity of [`scipy.sparse.block_diag`](../reference/generated/scipy.sparse.block_diag.html#scipy.sparse.block_diag "scipy.sparse.block_diag") has been improved dramatically +from quadratic to linear. + +## [[`scipy.sparse.linalg`](../reference/sparse.linalg.html#module-scipy.sparse.linalg "scipy.sparse.linalg") improvements](#id16)[#](#scipy-sparse-linalg-improvements "Link to this heading") + +The vendored version of `SuperLU` has been updated + +## [[`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") improvements](#id17)[#](#scipy-fft-improvements "Link to this heading") + +The vendored `pocketfft` library now supports compiling with ARM neon vector +extensions and has improved thread pool behavior. + +## [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#id18)[#](#scipy-spatial-improvements "Link to this heading") + +The python implementation of `KDTree` has been dropped and `KDTree` is now +implemented in terms of `cKDTree`. You can now expect `cKDTree`-like +performance by default. This also means `sys.setrecursionlimit` no longer +needs to be increased for querying large trees. + +`transform.Rotation` has been updated with support for Modified Rodrigues +Parameters alongside the existing rotation representations (PR gh-12667). + +[`scipy.spatial.transform.Rotation`](../reference/generated/scipy.spatial.transform.Rotation.html#scipy.spatial.transform.Rotation "scipy.spatial.transform.Rotation") has been partially cythonized, with some +performance improvements observed + +[`scipy.spatial.distance.cdist`](../reference/generated/scipy.spatial.distance.cdist.html#scipy.spatial.distance.cdist "scipy.spatial.distance.cdist") has improved performance with the `minkowski` +metric, especially for p-norm values of 1 or 2. + +## [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#id19)[#](#scipy-stats-improvements "Link to this heading") + +New distributions have been added to [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats"): + +* The asymmetric Laplace continuous distribution has been added as + [`scipy.stats.laplace_asymmetric`](../reference/generated/scipy.stats.laplace_asymmetric.html#scipy.stats.laplace_asymmetric "scipy.stats.laplace_asymmetric"). +* The negative hypergeometric distribution has been added as [`scipy.stats.nhypergeom`](../reference/generated/scipy.stats.nhypergeom.html#scipy.stats.nhypergeom "scipy.stats.nhypergeom"). +* The multivariate t distribution has been added as [`scipy.stats.multivariate_t`](../reference/generated/scipy.stats.multivariate_t.html#scipy.stats.multivariate_t "scipy.stats.multivariate_t"). +* The multivariate hypergeometric distribution has been added as [`scipy.stats.multivariate_hypergeom`](../reference/generated/scipy.stats.multivariate_hypergeom.html#scipy.stats.multivariate_hypergeom "scipy.stats.multivariate_hypergeom"). + +The `fit` method has been overridden for several distributions (`laplace`, +`pareto`, `rayleigh`, `invgauss`, `logistic`, `gumbel_l`, +`gumbel_r`); they now use analytical, distribution-specific maximum +likelihood estimation results for greater speed and accuracy than the generic +(numerical optimization) implementation. + +The one-sample Cramér-von Mises test has been added as +[`scipy.stats.cramervonmises`](../reference/generated/scipy.stats.cramervonmises.html#scipy.stats.cramervonmises "scipy.stats.cramervonmises"). + +An option to compute one-sided p-values was added to [`scipy.stats.ttest_1samp`](../reference/generated/scipy.stats.ttest_1samp.html#scipy.stats.ttest_1samp "scipy.stats.ttest_1samp"), +[`scipy.stats.ttest_ind_from_stats`](../reference/generated/scipy.stats.ttest_ind_from_stats.html#scipy.stats.ttest_ind_from_stats "scipy.stats.ttest_ind_from_stats"), [`scipy.stats.ttest_ind`](../reference/generated/scipy.stats.ttest_ind.html#scipy.stats.ttest_ind "scipy.stats.ttest_ind") and +[`scipy.stats.ttest_rel`](../reference/generated/scipy.stats.ttest_rel.html#scipy.stats.ttest_rel "scipy.stats.ttest_rel"). + +The function [`scipy.stats.kendalltau`](../reference/generated/scipy.stats.kendalltau.html#scipy.stats.kendalltau "scipy.stats.kendalltau") now has an option to compute Kendall’s +tau-c (also known as Stuart’s tau-c), and support has been added for exact +p-value calculations for sample sizes `> 171`. + +*stats.trapz* was renamed to *stats.trapezoid*, with the former name retained +as an alias for backwards compatibility reasons. + +The function [`scipy.stats.linregress`](../reference/generated/scipy.stats.linregress.html#scipy.stats.linregress "scipy.stats.linregress") now includes the standard error of the +intercept in its return value. + +The `_logpdf`, `_sf`, and `_isf` methods have been added to +[`scipy.stats.nakagami`](../reference/generated/scipy.stats.nakagami.html#scipy.stats.nakagami "scipy.stats.nakagami"); `_sf` and `_isf` methods also added to +[`scipy.stats.gumbel_r`](../reference/generated/scipy.stats.gumbel_r.html#scipy.stats.gumbel_r "scipy.stats.gumbel_r") + +The `sf` method has been added to [`scipy.stats.levy`](../reference/generated/scipy.stats.levy.html#scipy.stats.levy "scipy.stats.levy") and [`scipy.stats.levy_l`](../reference/generated/scipy.stats.levy_l.html#scipy.stats.levy_l "scipy.stats.levy_l") +for improved precision. + +[`scipy.stats.binned_statistic_dd`](../reference/generated/scipy.stats.binned_statistic_dd.html#scipy.stats.binned_statistic_dd "scipy.stats.binned_statistic_dd") performance improvements for the following +computed statistics: `max`, `min`, `median`, and `std`. + +We gratefully acknowledge the Chan-Zuckerberg Initiative Essential Open Source +Software for Science program for supporting many of these improvements to +[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats"). + +### [Deprecated features](#id20)[#](#deprecated-features "Link to this heading") + +## [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") changes](#id21)[#](#scipy-spatial-changes "Link to this heading") + +Calling `KDTree.query` with `k=None` to find all neighbours is deprecated. +Use `KDTree.query_ball_point` instead. + +`distance.wminkowski` was deprecated; use `distance.minkowski` and supply +weights with the `w` keyword instead. + +### [Backwards incompatible changes](#id22)[#](#backwards-incompatible-changes "Link to this heading") + +## [[`scipy`](../index.html#module-scipy "scipy") changes](#id23)[#](#scipy-changes "Link to this heading") + +Using [`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") as a function aliasing `numpy.fft.fft` was removed after +being deprecated in SciPy `1.4.0`. As a result, the [`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") submodule +must be explicitly imported now, in line with other SciPy subpackages. + +## [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") changes](#id24)[#](#scipy-interpolate-changes "Link to this heading") + +## [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") changes](#id25)[#](#scipy-linalg-changes "Link to this heading") + +## [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") changes](#id26)[#](#scipy-signal-changes "Link to this heading") + +The output of `decimate`, `lfilter_zi`, `lfiltic`, `sos2tf`, and +`sosfilt_zi` have been changed to match `numpy.result_type` of their inputs. + +The window function `slepian` was removed. It had been deprecated since SciPy +`1.1`. + +## [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") changes](#id27)[#](#id1 "Link to this heading") + +`cKDTree.query` now returns 64-bit rather than 32-bit integers on Windows, +making behaviour consistent between platforms (PR gh-12673). + +## [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") changes](#id28)[#](#scipy-stats-changes "Link to this heading") + +The `frechet_l` and `frechet_r` distributions were removed. They were +deprecated since SciPy `1.0`. + +### [Other changes](#id29)[#](#other-changes "Link to this heading") + +`setup_requires` was removed from `setup.py`. This means that users +invoking `python setup.py install` without having numpy already installed +will now get an error, rather than having numpy installed for them via +`easy_install`. This install method was always fragile and problematic, users +are encouraged to use `pip` when installing from source. + +* Fixed a bug in [`scipy.optimize.dual_annealing`](../reference/generated/scipy.optimize.dual_annealing.html#scipy.optimize.dual_annealing "scipy.optimize.dual_annealing") `accept_reject` calculation + that caused uphill jumps to be accepted less frequently. +* The time required for (un)pickling of [`scipy.stats.rv_continuous`](../reference/generated/scipy.stats.rv_continuous.html#scipy.stats.rv_continuous "scipy.stats.rv_continuous"), + [`scipy.stats.rv_discrete`](../reference/generated/scipy.stats.rv_discrete.html#scipy.stats.rv_discrete "scipy.stats.rv_discrete"), and *scipy.stats.rv\_frozen* has been significantly + reduced (gh12550). Inheriting subclasses should note that `__setstate__` no + longer calls `__init__` upon unpickling. + +### [Authors](#id30)[#](#authors "Link to this heading") + +* @endolith +* @vkk800 +* aditya + +* George Bateman + +* Christoph Baumgarten +* Peter Bell +* Tobias Biester + +* Keaton J. Burns + +* Evgeni Burovski +* Rüdiger Busche + +* Matthias Bussonnier +* Dominic C + +* Corallus Caninus + +* CJ Carey +* Thomas A Caswell +* chapochn + +* Lucía Cheung +* Zach Colbert + +* Coloquinte + +* Yannick Copin + +* Devin Crowley + +* Terry Davis + +* Michaël Defferrard + +* devonwp + +* Didier + +* divenex + +* Thomas Duvernay + +* Eoghan O’Connell + +* Gökçen Eraslan +* Kristian Eschenburg + +* Ralf Gommers +* Thomas Grainger + +* GreatV + +* Gregory Gundersen + +* h-vetinari + +* Matt Haberland +* Mark Harfouche + +* He He + +* Alex Henrie +* Chun-Ming Huang + +* Martin James McHugh III + +* Alex Izvorski + +* Joey + +* ST John + +* Jonas Jonker + +* Julius Bier Kirkegaard +* Marcin Konowalczyk + +* Konrad0 +* Sam Van Kooten + +* Sergey Koposov + +* Peter Mahler Larsen +* Eric Larson +* Antony Lee +* Gregory R. Lee +* Loïc Estève +* Jean-Luc Margot + +* MarkusKoebis + +* Nikolay Mayorov +* 7. 4. McBain +* Andrew McCluskey + +* Nicholas McKibben +* Sturla Molden +* Denali Molitor + +* Eric Moore +* Shashaank N + +* Prashanth Nadukandi + +* nbelakovski + +* Andrew Nelson +* Nick + +* Nikola Forró + +* odidev +* ofirr + +* Sambit Panda +* Dima Pasechnik +* Tirth Patel + +* Matti Picus +* Paweł Redzyński + +* Vladimir Philipenko + +* Philipp Thölke + +* Ilhan Polat +* Eugene Prilepin + +* Vladyslav Rachek +* Ram Rachum + +* Tyler Reddy +* Martin Reinecke + +* Simon Segerblom Rex + +* Lucas Roberts +* Benjamin Rowell + +* Eli Rykoff + +* Atsushi Sakai +* Moritz Schulte + +* Daniel B. Smith +* Steve Smith + +* Jan Soedingrekso + +* Victor Stinner + +* Jose Storopoli + +* Diana Sukhoverkhova + +* Søren Fuglede Jørgensen +* taoky + +* Mike Taves + +* Ian Thomas + +* Will Tirone + +* Frank Torres + +* Seth Troisi +* Ronald van Elburg + +* Hugo van Kemenade +* Paul van Mulbregt +* Saul Ivan Rivas Vega + +* Pauli Virtanen +* Jan Vleeshouwers +* Samuel Wallan +* Warren Weckesser +* Ben West + +* Eric Wieser +* WillTirone + +* Levi John Wolf + +* Zhiqing Xiao +* Rory Yorke + +* Yun Wang (Maigo) + +* Egor Zemlyanoy + +* ZhihuiChen0903 + +* Jacob Zhong + + +A total of 122 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +## [Issues closed for 1.6.0](#id31)[#](#issues-closed-for-1-6-0 "Link to this heading") + +* [#1323](https://github.com/scipy/scipy/issues/1323): ndimage.shift destroys data from edges (Trac #796) +* [#1892](https://github.com/scipy/scipy/issues/1892): using rptfile= with an existing file causes a Fortran runtime… +* [#1903](https://github.com/scipy/scipy/issues/1903): ndimage.rotate misses some values (Trac #1378) +* [#1930](https://github.com/scipy/scipy/issues/1930): scipy.io.wavfile should be able to read 24 bit signed wave (Trac… +* [#3158](https://github.com/scipy/scipy/issues/3158): Odd casting behaviour of signal.filtfilt +* [#3203](https://github.com/scipy/scipy/issues/3203): interpolation.zoom incorrect output for certain cases +* [#3645](https://github.com/scipy/scipy/issues/3645): BUG: stats: mstats.pearsonr calculation is wrong if the masks… +* [#3665](https://github.com/scipy/scipy/issues/3665): Return Bunch objects from stats functions +* [#4922](https://github.com/scipy/scipy/issues/4922): unexpected zero output values from zoom +* [#5202](https://github.com/scipy/scipy/issues/5202): BUG: stats: Spurious warnings from the pdf method of several… +* [#5223](https://github.com/scipy/scipy/issues/5223): Zoom does not return the same values when resizing a sub-array… +* [#5396](https://github.com/scipy/scipy/issues/5396): scipy.spatial.distance.pdist documention bug +* [#5489](https://github.com/scipy/scipy/issues/5489): ValueError: failed to create intent(cache|hide)|optional array–… +* [#6096](https://github.com/scipy/scipy/issues/6096): loadmat drops dtype of empty arrays when squeeze\_me=True +* [#6713](https://github.com/scipy/scipy/issues/6713): sicpy.ndimage.zoom returns artefacts and boundaries in some cases +* [#7125](https://github.com/scipy/scipy/issues/7125): Impossible to know number of dimensions in c function used by… +* [#7324](https://github.com/scipy/scipy/issues/7324): scipy.ndimage.zoom bad interpolation when downsampling (zoom… +* [#8131](https://github.com/scipy/scipy/issues/8131): BUG: geometric\_transform wrap mode possible bug +* [#8163](https://github.com/scipy/scipy/issues/8163): LSMR fails on some random values when providing an x0 +* [#8210](https://github.com/scipy/scipy/issues/8210): Why should I choose order > 1 for scipy.ndimage.zoom? +* [#8465](https://github.com/scipy/scipy/issues/8465): Unexpected behavior with reflect mode of ndimage.rotate +* [#8776](https://github.com/scipy/scipy/issues/8776): cdist behavior with Minkowsky and np.inf +* [#9168](https://github.com/scipy/scipy/issues/9168): documentation of pearson3 in scipy.stats unclear +* [#9223](https://github.com/scipy/scipy/issues/9223): Faster implementation of scipy.sparse.block\_diag +* [#9476](https://github.com/scipy/scipy/issues/9476): Invalid index in signal.medfilt2d’s QUICK\_SELECT +* [#9857](https://github.com/scipy/scipy/issues/9857): scipy.odr.Output.sd\_beta is not standard error +* [#9865](https://github.com/scipy/scipy/issues/9865): Strange behavior of `ndimage.shift` and `ndimage.affine\_transform` +* [#10042](https://github.com/scipy/scipy/issues/10042): Consider support for multivariate student-t distribution? +* [#10134](https://github.com/scipy/scipy/issues/10134): gausshyper distribution accepts invalid parameters +* [#10179](https://github.com/scipy/scipy/issues/10179): str+bytes concatenation error in test\_lapack.py +* [#10216](https://github.com/scipy/scipy/issues/10216): cKDTree.query\_ball\_point speed regression +* [#10463](https://github.com/scipy/scipy/issues/10463): ENH: vectorize scipy.fft for more CPU architectures +* [#10593](https://github.com/scipy/scipy/issues/10593): Rename `sum` ndimage function +* [#10595](https://github.com/scipy/scipy/issues/10595): scipy.stats.ttest\_1samp should support alternative hypothesis +* [#10610](https://github.com/scipy/scipy/issues/10610): ndimage.interpolation.spline\_filter1d default value of mode +* [#10620](https://github.com/scipy/scipy/issues/10620): ndimage.interpolation.zoom() option to work like skimage.transform.resize() +* [#10711](https://github.com/scipy/scipy/issues/10711): Array Shapes Not Aligned Bug in scipy.optimize.\_lsq.lsq\_linear.py +* [#10782](https://github.com/scipy/scipy/issues/10782): BUG: optimize: methods unknown to `scipy.optimize.show\_options` +* [#10892](https://github.com/scipy/scipy/issues/10892): Possible typo in an equation of optimize/dual\_annealing +* [#11020](https://github.com/scipy/scipy/issues/11020): signal.fftconvolve return a tuple including lag information +* [#11093](https://github.com/scipy/scipy/issues/11093): scipy.interpolate.interp1d can not handle datetime64 +* [#11170](https://github.com/scipy/scipy/issues/11170): Use manylinux2014 to get aarch64/ppc64le support +* [#11186](https://github.com/scipy/scipy/issues/11186): BUG: stats: pearson3 CDF and SF functions incorrect when skew… +* [#11366](https://github.com/scipy/scipy/issues/11366): DeprecationWarning due to invalid escape sequences +* [#11403](https://github.com/scipy/scipy/issues/11403): Optimize raises “ValueError: `x0` violates bound constraints”… +* [#11558](https://github.com/scipy/scipy/issues/11558): ENH: IIR comb filter +* [#11559](https://github.com/scipy/scipy/issues/11559): BUG: iirdesign doesn’t fail for frequencies above Nyquist +* [#11567](https://github.com/scipy/scipy/issues/11567): scipy.signal.iirdesign doesn’t check consistency of wp and ws… +* [#11654](https://github.com/scipy/scipy/issues/11654): ENH: Add Negative Hypergeometric Distribution +* [#11720](https://github.com/scipy/scipy/issues/11720): BUG: stats: wrong shape from median\_absolute\_deviation for arrays… +* [#11746](https://github.com/scipy/scipy/issues/11746): BUG: stats: pearson3 returns size 1 arrays where other distributions… +* [#11756](https://github.com/scipy/scipy/issues/11756): Improve and fix \*Spline docstrings and code +* [#11758](https://github.com/scipy/scipy/issues/11758): BUG: of scipy.interpolate.CubicSpline when `bc\_type’ is set… +* [#11925](https://github.com/scipy/scipy/issues/11925): MAINT: remove character encoding check in CI? +* [#11963](https://github.com/scipy/scipy/issues/11963): Test failures - TestLinprogIPSparseCholmod +* [#12102](https://github.com/scipy/scipy/issues/12102): incorrect first moment of non central t-distribution +* [#12113](https://github.com/scipy/scipy/issues/12113): scipy.stats.poisson docs for rate = 0 +* [#12152](https://github.com/scipy/scipy/issues/12152): ENH: signal.gauss\_spline should accept a list +* [#12157](https://github.com/scipy/scipy/issues/12157): BUG: Iteration index initialisation is wrong in scipy.optimize.linesearch.scalar\_search\_wolfe2 +* [#12162](https://github.com/scipy/scipy/issues/12162): Storing Rotation object in NumPy array returns an array with… +* [#12176](https://github.com/scipy/scipy/issues/12176): cannot modify the slice of an array returned by `wavfile.read` +* [#12190](https://github.com/scipy/scipy/issues/12190): retrieve leave colors from dendrogram +* [#12196](https://github.com/scipy/scipy/issues/12196): PERF: scipy.linalg.pinv is very slow compared to numpy.linalg.pinv +* [#12222](https://github.com/scipy/scipy/issues/12222): Interpolating categorical data (interp1d) +* [#12231](https://github.com/scipy/scipy/issues/12231): Is the p-value of the Kruskal-Wallis test two-sided? +* [#12249](https://github.com/scipy/scipy/issues/12249): ENH: least\_squares: should not re-instanciate csr\_matrix if already… +* [#12264](https://github.com/scipy/scipy/issues/12264): DOC: optimize: linprog method-specific function signature +* [#12290](https://github.com/scipy/scipy/issues/12290): DOC: Convex Hull areas are actually perimeters for 2-dimensional… +* [#12308](https://github.com/scipy/scipy/issues/12308): integrate.solve\_ivp with DOP853 method fails when yDot = 0 +* [#12326](https://github.com/scipy/scipy/issues/12326): BUG: stats.exponnorm.pdf returns 0 for small K +* [#12337](https://github.com/scipy/scipy/issues/12337): scipy.sparse.linalg.eigsh documentation is misleading +* [#12339](https://github.com/scipy/scipy/issues/12339): scipy.io.wavfile.write documentation has wrong example +* [#12340](https://github.com/scipy/scipy/issues/12340): sparse.lil\_matrix.tocsr() fails silently on matrices with nzn… +* [#12350](https://github.com/scipy/scipy/issues/12350): Create a 2-parameter version of the gamma distribution +* [#12369](https://github.com/scipy/scipy/issues/12369): scipy.signal.correlate has an error in the documentation, examples… +* [#12373](https://github.com/scipy/scipy/issues/12373): interp1d returns incorrect values for step functions +* [#12378](https://github.com/scipy/scipy/issues/12378): interpolate.NearestNDInterpolator.\_\_call\_\_ & LinearNDInterpolator.\_\_call\_\_… +* [#12411](https://github.com/scipy/scipy/issues/12411): scipy.stats.spearmanr mishandles nan variables with “propogate” +* [#12413](https://github.com/scipy/scipy/issues/12413): DOC: Remove the “Basic functions” section from the SciPy tutorial. +* [#12415](https://github.com/scipy/scipy/issues/12415): scipy.stats.dirichlet documentation issue +* [#12419](https://github.com/scipy/scipy/issues/12419): least\_squares ValueError with ‘lm’ method - regression from 1.4.1… +* [#12431](https://github.com/scipy/scipy/issues/12431): Request for Python wrapper for LAPACK’s ?pptrf (Cholesky factorization… +* [#12458](https://github.com/scipy/scipy/issues/12458): spearmanr with entire NaN columns produces errors +* [#12477](https://github.com/scipy/scipy/issues/12477): WIP: Addition of MLE for stats.invgauss/wald +* [#12483](https://github.com/scipy/scipy/issues/12483): reading .wav fails when the file is too big on python 3.6.0 +* [#12490](https://github.com/scipy/scipy/issues/12490): BUG: stats: logistic and genlogistic logpdf overflow for large… +* [#12499](https://github.com/scipy/scipy/issues/12499): LinearNDInterpolator raises ValueError when value array has writeable=False… +* [#12523](https://github.com/scipy/scipy/issues/12523): Wrong key in \_\_odrpack.c +* [#12547](https://github.com/scipy/scipy/issues/12547): typo in scipy/cluster/\_hierarchy.pyx +* [#12549](https://github.com/scipy/scipy/issues/12549): DOC: least\_squares return type is poorly formatted. +* [#12578](https://github.com/scipy/scipy/issues/12578): TST: test\_bounds\_infeasible\_2 failing on wheels repo cron jobs +* [#12585](https://github.com/scipy/scipy/issues/12585): ENH: Add Multivariate Hypergeometric Distribution +* [#12604](https://github.com/scipy/scipy/issues/12604): unintuitive conversion in `scipy.constants.lambda2nu` +* [#12606](https://github.com/scipy/scipy/issues/12606): DOC: Invalid syntax in example. +* [#12665](https://github.com/scipy/scipy/issues/12665): List of possible bugs found by automated code analysis +* [#12696](https://github.com/scipy/scipy/issues/12696): scipy.optimize.fminbound, numpy depreciation warning Creating… +* [#12699](https://github.com/scipy/scipy/issues/12699): TestProjections.test\_iterative\_refinements\_dense failure +* [#12701](https://github.com/scipy/scipy/issues/12701): TestDifferentialEvolutionSolver::test\_L4 failing +* [#12719](https://github.com/scipy/scipy/issues/12719): Misleading scipy.signal.get\_window() docstring with ‘exponential’… +* [#12740](https://github.com/scipy/scipy/issues/12740): circstd doesn’t handle R = hypot(S, C) > 1 +* [#12749](https://github.com/scipy/scipy/issues/12749): ENH: interp1d Matlab compatibility +* [#12773](https://github.com/scipy/scipy/issues/12773): Meta-issue: ndimage spline boundary handling (NumFOCUS proposal) +* [#12813](https://github.com/scipy/scipy/issues/12813): optimize.root(method=”krylov”) fails if options[“tol\_norm”] expects… +* [#12815](https://github.com/scipy/scipy/issues/12815): stats.zscore inconsistent behavior when all values are the same +* [#12840](https://github.com/scipy/scipy/issues/12840): scipy.signal.windows.dpss docstring typo +* [#12874](https://github.com/scipy/scipy/issues/12874): Rotation.random vs stats.special\_ortho\_group +* [#12881](https://github.com/scipy/scipy/issues/12881): FFT - documentation - examples - linspace construction +* [#12904](https://github.com/scipy/scipy/issues/12904): BUG: parsing in loadarff() +* [#12917](https://github.com/scipy/scipy/issues/12917): GitHub Actions nightly build triggered on forks +* [#12919](https://github.com/scipy/scipy/issues/12919): BUG: numerical precision, use gammaln in nct.mean +* [#12924](https://github.com/scipy/scipy/issues/12924): Rename Sample Based Integration Methods to Comply with Code of… +* [#12940](https://github.com/scipy/scipy/issues/12940): Should the minimum numpy for AIX be bumped to 1.16.5 +* [#12951](https://github.com/scipy/scipy/issues/12951): A possible typo in scipy.stats.weightedtau +* [#12952](https://github.com/scipy/scipy/issues/12952): [Documentation question] Would it be more precise to specify… +* [#12970](https://github.com/scipy/scipy/issues/12970): Documentation presents second order sections as the correct choice… +* [#12982](https://github.com/scipy/scipy/issues/12982): Calculate standard error of the intercept in linregress +* [#12985](https://github.com/scipy/scipy/issues/12985): Possible wrong link in scipy.stats.wilcoxon doc +* [#12991](https://github.com/scipy/scipy/issues/12991): least\_squares broken with float32 +* [#13001](https://github.com/scipy/scipy/issues/13001): `OptimizeResult.message` from `L-BFGS-B` is a bytes, not… +* [#13030](https://github.com/scipy/scipy/issues/13030): BUG: lint\_diff.py still fails for backport PRs +* [#13077](https://github.com/scipy/scipy/issues/13077): CI: codecov proper patch diffs +* [#13085](https://github.com/scipy/scipy/issues/13085): Build failing on main branch after HiGHS solver merge +* [#13088](https://github.com/scipy/scipy/issues/13088): BLD, BUG: wheel builds failure with HiGHS/optimize +* [#13099](https://github.com/scipy/scipy/issues/13099): Wrong output format for empty sparse results of kron +* [#13108](https://github.com/scipy/scipy/issues/13108): TST, CI: GitHub Actions MacOS Failures +* [#13111](https://github.com/scipy/scipy/issues/13111): BUG, DOC: refguide check is failing +* [#13127](https://github.com/scipy/scipy/issues/13127): ODR output file writing broken in conda env with system compilers +* [#13134](https://github.com/scipy/scipy/issues/13134): FromTravis migration tracker +* [#13140](https://github.com/scipy/scipy/issues/13140): BUG: signal: `ss2tf` incorrectly truncates output to integers. +* [#13179](https://github.com/scipy/scipy/issues/13179): CI: lint is failing because of output to stderr +* [#13182](https://github.com/scipy/scipy/issues/13182): Key appears twice in `test\_optimize.test\_show\_options` +* [#13191](https://github.com/scipy/scipy/issues/13191): `scipy.linalg.lapack.dgesjv` overwrites original arrays if… +* [#13207](https://github.com/scipy/scipy/issues/13207): TST: Erratic test failure in test\_cossin\_separate +* [#13221](https://github.com/scipy/scipy/issues/13221): BUG: pavement.py glitch +* [#13239](https://github.com/scipy/scipy/issues/13239): Segmentation fault with `eigh(…, driver=”evx”)` for 10x10… +* [#13248](https://github.com/scipy/scipy/issues/13248): ndimage: improper cval handling for complex-valued inputs + +## [Pull requests for 1.6.0](#id32)[#](#pull-requests-for-1-6-0 "Link to this heading") + +* [#8032](https://github.com/scipy/scipy/pull/8032): ENH: Add in taylor window common in Radar processing +* [#8779](https://github.com/scipy/scipy/pull/8779): CI: Run benchmarks +* [#9361](https://github.com/scipy/scipy/pull/9361): ENH: Add Kendall’s tau-a and tau-c variants to scipy.stats.kendalltau() +* [#11068](https://github.com/scipy/scipy/pull/11068): ENH: Adds correlation\_lags function to scipy.signal +* [#11119](https://github.com/scipy/scipy/pull/11119): ENH: add Cramer-von-Mises (one-sample) test to scipy.stats +* [#11249](https://github.com/scipy/scipy/pull/11249): ENH: optimize: interpolative decomposition redundancy removal… +* [#11346](https://github.com/scipy/scipy/pull/11346): ENH: add fast toeplitz matrix multiplication using FFT +* [#11413](https://github.com/scipy/scipy/pull/11413): ENH: Multivariate t-distribution (stale) +* [#11563](https://github.com/scipy/scipy/pull/11563): ENH: exact p-value in stats.kendalltau() for sample sizes > 171 +* [#11691](https://github.com/scipy/scipy/pull/11691): ENH: add a stack of reversal functions to linprog +* [#12043](https://github.com/scipy/scipy/pull/12043): ENH: optimize: add HiGHS methods to linprog - continued +* [#12061](https://github.com/scipy/scipy/pull/12061): Check parameter consistensy in signal.iirdesign +* [#12067](https://github.com/scipy/scipy/pull/12067): MAINT: Cleanup OLDAPI in ndimage/src/\_ctest.c +* [#12069](https://github.com/scipy/scipy/pull/12069): DOC: Add developer guidelines for implementing the nan\_policy… +* [#12077](https://github.com/scipy/scipy/pull/12077): MAINT: malloc return value checks for cython +* [#12080](https://github.com/scipy/scipy/pull/12080): MAINT: Remove suppress\_warnings +* [#12085](https://github.com/scipy/scipy/pull/12085): ENH: special: support ILP64 Lapack +* [#12086](https://github.com/scipy/scipy/pull/12086): MAINT: Cleanup PyMODINIT\_FUNC used during 2to3 +* [#12097](https://github.com/scipy/scipy/pull/12097): ENH: stats: override stats.rayleigh.fit with analytical MLE +* [#12112](https://github.com/scipy/scipy/pull/12112): DOC: Improve integrate.nquad docstring +* [#12125](https://github.com/scipy/scipy/pull/12125): TST: Add a test for stats.gmean with negative input +* [#12139](https://github.com/scipy/scipy/pull/12139): TST: Reduce flakiness in lsmr test +* [#12142](https://github.com/scipy/scipy/pull/12142): DOC: add a note in poisson distribution when mu=0 and k=0 in… +* [#12144](https://github.com/scipy/scipy/pull/12144): DOC: Update ndimage.morphology.distance\_transform\* +* [#12154](https://github.com/scipy/scipy/pull/12154): ENH: scipy.signal: allow lists in gauss\_spline +* [#12170](https://github.com/scipy/scipy/pull/12170): ENH: scipy.stats: add negative hypergeometric distribution +* [#12177](https://github.com/scipy/scipy/pull/12177): MAINT: Correctly add input line to ValueError +* [#12183](https://github.com/scipy/scipy/pull/12183): ENH: Use fromfile where possible +* [#12186](https://github.com/scipy/scipy/pull/12186): MAINT: generalize tests in SphericalVoronoi +* [#12198](https://github.com/scipy/scipy/pull/12198): TST: Fix str + bytes error +* [#12199](https://github.com/scipy/scipy/pull/12199): ENH: match np.result\_type behaviour in some scipy.signal functions +* [#12200](https://github.com/scipy/scipy/pull/12200): ENH: add FIR and IIR gammatone filters to scipy.signal +* [#12204](https://github.com/scipy/scipy/pull/12204): ENH: Add overwrite argument for odr.ODR() and its test. +* [#12206](https://github.com/scipy/scipy/pull/12206): MAINT:lstsq: Switch to tranposed problem if the array is tall +* [#12208](https://github.com/scipy/scipy/pull/12208): wavfile bugfixes and maintenance +* [#12214](https://github.com/scipy/scipy/pull/12214): DOC: fix docstring of “sd\_beta” of odr.Output. +* [#12234](https://github.com/scipy/scipy/pull/12234): MAINT: prevent divide by zero warnings in scipy.optimize BFGS… +* [#12235](https://github.com/scipy/scipy/pull/12235): REL: set version to 1.6.0.dev0 +* [#12237](https://github.com/scipy/scipy/pull/12237): BUG: Fix exit condition for QUICK\_SELECT pivot +* [#12242](https://github.com/scipy/scipy/pull/12242): ENH: Rename ndimage.sum to ndimage.sum\_labels (keep sum as alias) +* [#12243](https://github.com/scipy/scipy/pull/12243): EHN: Update SuperLU +* [#12244](https://github.com/scipy/scipy/pull/12244): MAINT: stats: avoid spurious warnings in ncx2.pdf +* [#12245](https://github.com/scipy/scipy/pull/12245): DOC: Fixed incorrect default for mode in scipy.ndimage.spline\_filter1d +* [#12248](https://github.com/scipy/scipy/pull/12248): MAINT: clean up pavement.py +* [#12250](https://github.com/scipy/scipy/pull/12250): ENH: Replaced csr\_matrix() by tocsr() and complemented docstring +* [#12253](https://github.com/scipy/scipy/pull/12253): TST, CI: turn on codecov patch diffs +* [#12259](https://github.com/scipy/scipy/pull/12259): MAINT: Remove duplicated test for import cycles +* [#12263](https://github.com/scipy/scipy/pull/12263): ENH: Rename LocalSearchWrapper bounds +* [#12265](https://github.com/scipy/scipy/pull/12265): BUG optimize: Accept np.matrix in lsq\_linear +* [#12266](https://github.com/scipy/scipy/pull/12266): BUG: Fix paren error in dual annealing accept\_reject calculation +* [#12269](https://github.com/scipy/scipy/pull/12269): MAINT: Included mismatched shapes in error messages. +* [#12279](https://github.com/scipy/scipy/pull/12279): MAINT: `\_\_array\_\_` and array protocols cannot be used in sparse. +* [#12281](https://github.com/scipy/scipy/pull/12281): DOC: update wheel DL docs +* [#12283](https://github.com/scipy/scipy/pull/12283): ENH: odr: ILP64 Blas support in ODR +* [#12284](https://github.com/scipy/scipy/pull/12284): ENH: linalg: support for ILP64 BLAS/LAPACK in f2py wrappers +* [#12286](https://github.com/scipy/scipy/pull/12286): ENH: Cythonize scipy.spatial.transform.Rotation +* [#12287](https://github.com/scipy/scipy/pull/12287): ENH: Read arbitrary bit depth (including 24-bit) WAVs +* [#12292](https://github.com/scipy/scipy/pull/12292): BLD: fix musl compilation +* [#12293](https://github.com/scipy/scipy/pull/12293): MAINT: Fix a DeprecationWarning in validate\_runtests\_log.py. +* [#12296](https://github.com/scipy/scipy/pull/12296): DOC: Clarify area/volume in scipy.spatial.ConvexHull docstrings +* [#12302](https://github.com/scipy/scipy/pull/12302): CI: Run travis builds on master to keep cache up to date +* [#12305](https://github.com/scipy/scipy/pull/12305): TST: Cleanup print statements in tests +* [#12323](https://github.com/scipy/scipy/pull/12323): ENH: Add a Bunch-like class to use as a backwards compatible… +* [#12324](https://github.com/scipy/scipy/pull/12324): BUG: io: Fix an error that occurs when attempting to raise a… +* [#12327](https://github.com/scipy/scipy/pull/12327): DOC: clarify docstrings of `query\_ball\_tree` and `query\_pairs` +* [#12334](https://github.com/scipy/scipy/pull/12334): PERF: Improve cKDTree.query\_ball\_point constant time cython overhead +* [#12338](https://github.com/scipy/scipy/pull/12338): DOC: improve consistency and clarity of docs in linalg and sparse/linalg +* [#12341](https://github.com/scipy/scipy/pull/12341): DOC: add Examples for KDTree query\_ball\_tree and query\_pairs +* [#12343](https://github.com/scipy/scipy/pull/12343): DOC: add examples for special.eval\_legendre() +* [#12349](https://github.com/scipy/scipy/pull/12349): BUG: avoid overflow in sum() for 32-bit systems +* [#12351](https://github.com/scipy/scipy/pull/12351): DOC: Fix example wavfile to be 16bit +* [#12352](https://github.com/scipy/scipy/pull/12352): [BUG] Consider 0/0 division in DOP853 error estimation +* [#12353](https://github.com/scipy/scipy/pull/12353): Fix exception causes in vq.py +* [#12354](https://github.com/scipy/scipy/pull/12354): MAINT: Cleanup unneeded void\* cast in setlist.pxd +* [#12355](https://github.com/scipy/scipy/pull/12355): TST: Remove hack for old win-amd64 bug +* [#12356](https://github.com/scipy/scipy/pull/12356): ENH: Faster implementation of scipy.sparse.block\_diag (#9411… +* [#12357](https://github.com/scipy/scipy/pull/12357): MAINT,TST: update and run scipy/special/utils/convert.py +* [#12358](https://github.com/scipy/scipy/pull/12358): TST: Check mstat.skewtest pvalue +* [#12359](https://github.com/scipy/scipy/pull/12359): TST: Sparse matrix test with int64 indptr and indices +* [#12363](https://github.com/scipy/scipy/pull/12363): DOC: ref. in CloughTocher2DInterpolator +* [#12364](https://github.com/scipy/scipy/pull/12364): DOC: `sparse\_distance\_matrix` and `count\_neighbors` examples +* [#12371](https://github.com/scipy/scipy/pull/12371): MAINT, CI: bump to latest stable OpenBLAS +* [#12372](https://github.com/scipy/scipy/pull/12372): MAINT: Minor cleanup of (c)KDTree tests +* [#12374](https://github.com/scipy/scipy/pull/12374): DEP: Deprecate `distance.wminkowski` +* [#12375](https://github.com/scipy/scipy/pull/12375): ENH: Add fast path for minkowski distance with p=1,2 and support… +* [#12376](https://github.com/scipy/scipy/pull/12376): Fix exception causes in most of the codebase +* [#12377](https://github.com/scipy/scipy/pull/12377): DOC: Quick fix - adds newline to correlation\_lags docstring Examples… +* [#12381](https://github.com/scipy/scipy/pull/12381): BENCH: remove obsolete goal\_time param +* [#12382](https://github.com/scipy/scipy/pull/12382): ENH: Replace KDTree with a thin wrapper over cKDTree +* [#12385](https://github.com/scipy/scipy/pull/12385): DOC: improve docstrings of interpolate.NearestNDInterpolator.\_\_call\_\_… +* [#12387](https://github.com/scipy/scipy/pull/12387): DOC/STY: add example to scipy.signal.correlate +* [#12393](https://github.com/scipy/scipy/pull/12393): CI: Replace the existing check for non-ASCII characters with… +* [#12394](https://github.com/scipy/scipy/pull/12394): CI: arm64 numpy now available +* [#12395](https://github.com/scipy/scipy/pull/12395): ENH: improve stats.binned\_statistic\_dd performance +* [#12396](https://github.com/scipy/scipy/pull/12396): DOC, MAINT: forward port 1.5.0 relnotes +* [#12398](https://github.com/scipy/scipy/pull/12398): API: Disable len() and indexing of Rotation instances with single… +* [#12399](https://github.com/scipy/scipy/pull/12399): MAINT: Replace some Unicode dash-like chars with an ASCII hyphen. +* [#12402](https://github.com/scipy/scipy/pull/12402): update .mailmap +* [#12404](https://github.com/scipy/scipy/pull/12404): MAINT: io: Change the encoding comment of test\_mio.py to utf-8. +* [#12416](https://github.com/scipy/scipy/pull/12416): CI: cache mingw, azure pipelines +* [#12427](https://github.com/scipy/scipy/pull/12427): BUG: logic error in loop unrolling (cKDTree) +* [#12432](https://github.com/scipy/scipy/pull/12432): DOC: Remove the “Basic functions” section from the SciPy tutorial. +* [#12434](https://github.com/scipy/scipy/pull/12434): ENH:linalg: Add LAPACK wrappers pptrf/pptrs/ppsv/pptri/ppcon +* [#12435](https://github.com/scipy/scipy/pull/12435): DOC: fix simplex math for scipy.stats.dirichlet documentation +* [#12439](https://github.com/scipy/scipy/pull/12439): DOC: add API methods summary for NdPPoly +* [#12443](https://github.com/scipy/scipy/pull/12443): BUG: stats: Improve calculation of exponnorm.pdf +* [#12448](https://github.com/scipy/scipy/pull/12448): DOC: stats: Add “Examples” to the ansari docstring. +* [#12450](https://github.com/scipy/scipy/pull/12450): ENH: add `leaves\_color\_list` for cluster.dendrogram dictionary. +* [#12451](https://github.com/scipy/scipy/pull/12451): MAINT: remove “blacklist” terminology from code base +* [#12452](https://github.com/scipy/scipy/pull/12452): DOC: clarify the meaning of whitening for cluster.vq.whiten() +* [#12455](https://github.com/scipy/scipy/pull/12455): MAINT: clearer error message in setup.py +* [#12457](https://github.com/scipy/scipy/pull/12457): ENH: stats: override stats.pareto.fit with analytical MLE +* [#12460](https://github.com/scipy/scipy/pull/12460): check if column in spearman rho is entirely NaN or Inf +* [#12463](https://github.com/scipy/scipy/pull/12463): DOC: improve and clean up \*Spline docstrings in fitpack2.py +* [#12474](https://github.com/scipy/scipy/pull/12474): ENH: linalg: speedup \_sqrtm\_triu by moving tight loop to Cython +* [#12476](https://github.com/scipy/scipy/pull/12476): ENH: add IIR comb filter to scipy.signal +* [#12484](https://github.com/scipy/scipy/pull/12484): Fix documentation for minimize +* [#12486](https://github.com/scipy/scipy/pull/12486): DOC: add a note in poisson distribution when mu=0 and k=0 in… +* [#12491](https://github.com/scipy/scipy/pull/12491): MAINT: forward port 1.5.1 release notes +* [#12508](https://github.com/scipy/scipy/pull/12508): Fix exception causes all over the codebase +* [#12514](https://github.com/scipy/scipy/pull/12514): ENH: stats: override stats.invgauss.fit with analytical MLE +* [#12519](https://github.com/scipy/scipy/pull/12519): PERF: Avoid np.zeros when custom initialization is needed anyway +* [#12520](https://github.com/scipy/scipy/pull/12520): DOC: Minor RST section renaming. +* [#12521](https://github.com/scipy/scipy/pull/12521): MAINT: Remove unused imports +* [#12522](https://github.com/scipy/scipy/pull/12522): PERF: Get rid of unnececssary allocation in VarReader5.cread\_fieldnames +* [#12524](https://github.com/scipy/scipy/pull/12524): DOC: special: Set Axes3D rect to avoid clipping labels in plot. +* [#12525](https://github.com/scipy/scipy/pull/12525): Fix large sparse nnz +* [#12526](https://github.com/scipy/scipy/pull/12526): DOC: Remove double section and too long header underline. +* [#12527](https://github.com/scipy/scipy/pull/12527): Improve error message for wrong interpolation type +* [#12530](https://github.com/scipy/scipy/pull/12530): Move redundant logic outside loop for conditional speedup in… +* [#12532](https://github.com/scipy/scipy/pull/12532): ENH: Add norm={“forward”, “backward”} to `scipy.fft` +* [#12535](https://github.com/scipy/scipy/pull/12535): MAINT: Avoid sphinx deprecated aliases for SeeAlso and Only +* [#12540](https://github.com/scipy/scipy/pull/12540): BUG: fix odr.output.work\_ind key bug and add its test. +* [#12541](https://github.com/scipy/scipy/pull/12541): ENH: add solver for minimum weight full bipartite matching +* [#12550](https://github.com/scipy/scipy/pull/12550): PERF: pickling speed of rv\* +* [#12551](https://github.com/scipy/scipy/pull/12551): DOC: fix typo in cluster/\_hierarchy.pyx +* [#12552](https://github.com/scipy/scipy/pull/12552): CI: Cleanup travis pip installs +* [#12556](https://github.com/scipy/scipy/pull/12556): BUG: Fix problem with Scipy.integrate.solve\_bvp for big problems +* [#12557](https://github.com/scipy/scipy/pull/12557): MAINT: Use extern templates to improve sparsetools compile time +* [#12558](https://github.com/scipy/scipy/pull/12558): MAINT: Remove hack to allow scipy.fft to act like a function +* [#12563](https://github.com/scipy/scipy/pull/12563): MAINT: Remove unused mu0 in special/orthogonal.py +* [#12564](https://github.com/scipy/scipy/pull/12564): DOC: fix return type docstring for least\_squares +* [#12565](https://github.com/scipy/scipy/pull/12565): DOC: stats: respond to query about Kruskal-Wallis test being… +* [#12566](https://github.com/scipy/scipy/pull/12566): BUG: Interpolate: use stable sort +* [#12568](https://github.com/scipy/scipy/pull/12568): Updated documentation for as\_quat +* [#12571](https://github.com/scipy/scipy/pull/12571): DEP: remove deprecated slepian window +* [#12573](https://github.com/scipy/scipy/pull/12573): DEP: remove `frechet\_l` and `frechet\_r` +* [#12575](https://github.com/scipy/scipy/pull/12575): BUG: stats: fix multinomial.pmf NaNs when params sum > 1 +* [#12576](https://github.com/scipy/scipy/pull/12576): MAINT: remove warning from LSQSphereBivariateSpline +* [#12582](https://github.com/scipy/scipy/pull/12582): ENH: Multivariate t-distribution +* [#12587](https://github.com/scipy/scipy/pull/12587): ENH: speed up rvs of gengamma in scipy.stats +* [#12588](https://github.com/scipy/scipy/pull/12588): DOC: add Examples add see also sections for LinearNDInterpolator,… +* [#12597](https://github.com/scipy/scipy/pull/12597): ENH: Add single-sided p-values to t-tests +* [#12599](https://github.com/scipy/scipy/pull/12599): Small update to scipy FFT tutorial +* [#12600](https://github.com/scipy/scipy/pull/12600): ENH: disjoint set data structure +* [#12602](https://github.com/scipy/scipy/pull/12602): BUG: add const for Read-only views in interpnd.pyx +* [#12605](https://github.com/scipy/scipy/pull/12605): BUG: correct `np.asanyarray` use in `scipy.constants.lambda2nu` +* [#12610](https://github.com/scipy/scipy/pull/12610): MAINT: forward port 1.5.2 release notes +* [#12612](https://github.com/scipy/scipy/pull/12612): MAINT: stats: Use explicit keyword parameters instead of `\*\*kwds`. +* [#12616](https://github.com/scipy/scipy/pull/12616): DOC: make explicit docstring that interpolate.interp1d only accepts… +* [#12618](https://github.com/scipy/scipy/pull/12618): DOC: Minor doc formatting. +* [#12640](https://github.com/scipy/scipy/pull/12640): MAINT: stats: fix issues with scipy.stats.pearson3 docs, moment,… +* [#12647](https://github.com/scipy/scipy/pull/12647): TST: Add Boost ellipr[cdfgj]\_data test data +* [#12648](https://github.com/scipy/scipy/pull/12648): DOC: Update special/utils/README with instructions +* [#12649](https://github.com/scipy/scipy/pull/12649): DOC: simplified pip quickstart guide +* [#12650](https://github.com/scipy/scipy/pull/12650): DOC: stats: Fix boxcox docstring: lambda can be negative. +* [#12655](https://github.com/scipy/scipy/pull/12655): DOC: update Steering Council members listed in governance docs +* [#12659](https://github.com/scipy/scipy/pull/12659): rv\_sample expect bug +* [#12663](https://github.com/scipy/scipy/pull/12663): DOC: optimize: try to fix linprog method-specific documentation +* [#12664](https://github.com/scipy/scipy/pull/12664): BUG: stats: Fix logpdf with large negative values for logistic… +* [#12666](https://github.com/scipy/scipy/pull/12666): MAINT: Fixes from static analysis +* [#12667](https://github.com/scipy/scipy/pull/12667): ENH: Adding Modified Rodrigues Parameters to the Rotation class +* [#12670](https://github.com/scipy/scipy/pull/12670): DOC: Update documentation for Gamma distribution +* [#12673](https://github.com/scipy/scipy/pull/12673): API: Unconditionally return np.intp from cKDTree.query +* [#12677](https://github.com/scipy/scipy/pull/12677): MAINT: Add Autogenerated notice to ufuncs.pyi +* [#12682](https://github.com/scipy/scipy/pull/12682): MAINT: Remove \_util.\_valarray +* [#12688](https://github.com/scipy/scipy/pull/12688): MAINT: add f2py-generated scipy.integrate files to .gitignore +* [#12689](https://github.com/scipy/scipy/pull/12689): BENCH: simplify benchmark setup, remove benchmarks/run.py +* [#12694](https://github.com/scipy/scipy/pull/12694): scipy/stats: Add laplace\_asymmetric continuous distribution +* [#12695](https://github.com/scipy/scipy/pull/12695): DOC: update Ubuntu quickstart; conda compilers now work! +* [#12698](https://github.com/scipy/scipy/pull/12698): MAINT: Replace np.max with np.maximum +* [#12700](https://github.com/scipy/scipy/pull/12700): TST: bump test precision for constrained trustregion test +* [#12702](https://github.com/scipy/scipy/pull/12702): TST: bump test tolerance for `DifferentialEvolutionSolver.test\_L4` +* [#12703](https://github.com/scipy/scipy/pull/12703): BUG: Improve input validation for sepfir2d +* [#12708](https://github.com/scipy/scipy/pull/12708): MAINT: fix a typo in scipy.sparse +* [#12709](https://github.com/scipy/scipy/pull/12709): BUG: bvls can fail catastrophically to converge +* [#12711](https://github.com/scipy/scipy/pull/12711): MAINT: Use platform.python\_implementation to determine IS\_PYPY +* [#12713](https://github.com/scipy/scipy/pull/12713): TST: Fix flaky test\_lgmres +* [#12716](https://github.com/scipy/scipy/pull/12716): DOC: add examples and tutorial links for interpolate functions… +* [#12717](https://github.com/scipy/scipy/pull/12717): DOC: Fix Issue #5396 +* [#12725](https://github.com/scipy/scipy/pull/12725): ENH: Support complex-valued images and kernels for many ndimage… +* [#12729](https://github.com/scipy/scipy/pull/12729): DEP: remove setup\_requires +* [#12732](https://github.com/scipy/scipy/pull/12732): BENCH: skip benchmarks instead of hiding them when SCIPY\_XSLOW=0 +* [#12734](https://github.com/scipy/scipy/pull/12734): CI: Don’t ignore line-length in the lint\_diff check. +* [#12736](https://github.com/scipy/scipy/pull/12736): DOC: Fix signal.windows.get\_window() ‘exponential’ docstring +* [#12737](https://github.com/scipy/scipy/pull/12737): ENH: stats: override stats.gumbel\_r.fit and stats.gumbel\_l.fit… +* [#12738](https://github.com/scipy/scipy/pull/12738): ENH: stats: override stats.logistic.fit with system of equations… +* [#12743](https://github.com/scipy/scipy/pull/12743): BUG: Avoid negative variances in circular statistics +* [#12744](https://github.com/scipy/scipy/pull/12744): Prevent build error on GNU/Hurd +* [#12746](https://github.com/scipy/scipy/pull/12746): TST: parameterize the test cases in test\_ndimage.py +* [#12752](https://github.com/scipy/scipy/pull/12752): DOC: Add examples for some root finding functions. +* [#12754](https://github.com/scipy/scipy/pull/12754): MAINT, CI: Azure windows deps multiline +* [#12756](https://github.com/scipy/scipy/pull/12756): ENH: stats: Add an sf method to levy for improved precision in… +* [#12757](https://github.com/scipy/scipy/pull/12757): ENH: stats: Add an sf method to levy\_l for improved precision. +* [#12765](https://github.com/scipy/scipy/pull/12765): TST, MAINT: infeasible\_2 context +* [#12767](https://github.com/scipy/scipy/pull/12767): Fix spline interpolation boundary handling for modes reflect… +* [#12769](https://github.com/scipy/scipy/pull/12769): DOC: syntax error in scipy.interpolate.bspl +* [#12770](https://github.com/scipy/scipy/pull/12770): ENH: add nearest-up rounding to scipy.interpolate.interp1d +* [#12771](https://github.com/scipy/scipy/pull/12771): TST: fix invalid input unit test for scipy.signal.gammatone +* [#12775](https://github.com/scipy/scipy/pull/12775): ENH: Adds quadratic\_assignment with two methods +* [#12776](https://github.com/scipy/scipy/pull/12776): ENH: add grid-constant boundary handling in ndimage interpolation… +* [#12777](https://github.com/scipy/scipy/pull/12777): Add Taylor Window function - Common in Radar DSP +* [#12779](https://github.com/scipy/scipy/pull/12779): ENH: Improvements to pocketfft thread pool and ARM neon vectorization +* [#12788](https://github.com/scipy/scipy/pull/12788): API: Rename cKDTree n\_jobs argument to workers +* [#12792](https://github.com/scipy/scipy/pull/12792): DOC: remove THANKS.txt file in favor of scipy.org +* [#12793](https://github.com/scipy/scipy/pull/12793): Add new flag to authors tool +* [#12802](https://github.com/scipy/scipy/pull/12802): BENCH: add scipy.ndimage.interpolation benchmarks +* [#12803](https://github.com/scipy/scipy/pull/12803): Do not pin the version of numpy in unsupported python versions +* [#12810](https://github.com/scipy/scipy/pull/12810): CI: fix 32-bit Linux build failure on Azure CI runs +* [#12812](https://github.com/scipy/scipy/pull/12812): ENH: support interpolation of complex-valued images +* [#12814](https://github.com/scipy/scipy/pull/12814): BUG: nonlin\_solve shouldn’t pass non-vector dx to tol\_norm +* [#12818](https://github.com/scipy/scipy/pull/12818): Update ckdtree.pyx +* [#12822](https://github.com/scipy/scipy/pull/12822): MAINT: simplify directed\_hausdorff +* [#12827](https://github.com/scipy/scipy/pull/12827): DOC: Fix wrong name w being used instead of worN in docs. +* [#12831](https://github.com/scipy/scipy/pull/12831): DOC: fix typo in sparse/base.py +* [#12835](https://github.com/scipy/scipy/pull/12835): MAINT: stats: Improve vonmises PDF calculation. +* [#12839](https://github.com/scipy/scipy/pull/12839): ENH: scipy.stats: add multivariate hypergeometric distribution +* [#12843](https://github.com/scipy/scipy/pull/12843): changed M to N in windows.dpss +* [#12846](https://github.com/scipy/scipy/pull/12846): MAINT: update minimum NumPy version to 1.16.5 +* [#12847](https://github.com/scipy/scipy/pull/12847): DOC: Unify the formula in docs of scipy.stats.pearsonr() +* [#12849](https://github.com/scipy/scipy/pull/12849): DOC: polish QAP docs for consistency and readability +* [#12852](https://github.com/scipy/scipy/pull/12852): ENH, MAINT: Bring KDTree interface to feature-parity with cKDTree +* [#12858](https://github.com/scipy/scipy/pull/12858): DOC: use :doi: and :arxiv: directives for references +* [#12872](https://github.com/scipy/scipy/pull/12872): lazily import multiprocessing.Pool in MapWrapper +* [#12878](https://github.com/scipy/scipy/pull/12878): DOC: document ScalarFunction +* [#12882](https://github.com/scipy/scipy/pull/12882): MAINT: stats: Change a test to use <= instead of strictly less… +* [#12885](https://github.com/scipy/scipy/pull/12885): numpy.linspace calls edited to ensure correct spacing. +* [#12886](https://github.com/scipy/scipy/pull/12886): DOC: stats: Add ‘versionadded’ to cramervonmises docstring. +* [#12899](https://github.com/scipy/scipy/pull/12899): TST: make a couple of tests expected to fail on 32-bit architectures +* [#12903](https://github.com/scipy/scipy/pull/12903): DOC: update Windows build guide and move into contributor guide +* [#12907](https://github.com/scipy/scipy/pull/12907): DOC: clarify which array the precenter option applies to +* [#12908](https://github.com/scipy/scipy/pull/12908): MAINT: spatial: Remove two occurrences of unused variables in… +* [#12909](https://github.com/scipy/scipy/pull/12909): ENH: stats: Add methods gumbel\_r.\_sf and gumbel\_r.\_isf +* [#12910](https://github.com/scipy/scipy/pull/12910): CI: travis: Remove some unnecessary code from .travis.yml. +* [#12911](https://github.com/scipy/scipy/pull/12911): Minor fixes to dendrogram plotting +* [#12921](https://github.com/scipy/scipy/pull/12921): CI: don’t run GitHub Actions on fork or in cron job +* [#12927](https://github.com/scipy/scipy/pull/12927): MAINT: rename integrate.simps to simpson +* [#12934](https://github.com/scipy/scipy/pull/12934): MAINT: rename trapz and cumtrapz to (cumulative\_)trapezoid +* [#12936](https://github.com/scipy/scipy/pull/12936): MAINT: fix numerical precision in nct.stats +* [#12938](https://github.com/scipy/scipy/pull/12938): MAINT: fix linter on master +* [#12941](https://github.com/scipy/scipy/pull/12941): Update minimum AIX pinnings to match non AIX builds +* [#12955](https://github.com/scipy/scipy/pull/12955): BUG: Fixed wrong NaNs check in scipy.stats.weightedtau +* [#12958](https://github.com/scipy/scipy/pull/12958): ENH: stats: Implement \_logpdf, \_sf and \_isf for nakagami. +* [#12962](https://github.com/scipy/scipy/pull/12962): Correcting that p should be in [0,1] for a variety of discrete… +* [#12964](https://github.com/scipy/scipy/pull/12964): BUG: added line.strip() to split\_data\_line() +* [#12968](https://github.com/scipy/scipy/pull/12968): ENH: stats: Use only an analytical formula or scalar root-finding… +* [#12971](https://github.com/scipy/scipy/pull/12971): MAINT: Declare support for Python 3.9 +* [#12972](https://github.com/scipy/scipy/pull/12972): MAINT: Remove redundant Python < 3.6 code +* [#12980](https://github.com/scipy/scipy/pull/12980): DOC: Update documentation on optimize.rosen +* [#12983](https://github.com/scipy/scipy/pull/12983): ENH: improvements to stats.linregress +* [#12990](https://github.com/scipy/scipy/pull/12990): DOC: Clarify that using sos as output type for iirdesign can… +* [#12992](https://github.com/scipy/scipy/pull/12992): DOC: capitalization and formatting in lsmr +* [#12995](https://github.com/scipy/scipy/pull/12995): DOC: stats: Several documentation fixes. +* [#12996](https://github.com/scipy/scipy/pull/12996): BUG: Improve error messages for `range` arg of binned\_statistic\_dd +* [#12998](https://github.com/scipy/scipy/pull/12998): MAINT: approx\_derivative with FP32 closes #12991 +* [#13004](https://github.com/scipy/scipy/pull/13004): TST: isinstance(OptimizeResult.message, str) closes #13001 +* [#13006](https://github.com/scipy/scipy/pull/13006): Keep correct dtype when loading empty mat arrays. +* [#13009](https://github.com/scipy/scipy/pull/13009): MAINT: clip SLSQP step within bounds +* [#13012](https://github.com/scipy/scipy/pull/13012): DOC: fix bilinear\_zpk example labels +* [#13013](https://github.com/scipy/scipy/pull/13013): ENH: Add `subset` and `subsets` methods to `DisjointSet`… +* [#13029](https://github.com/scipy/scipy/pull/13029): MAINT: basinhopping callback for initial mininmisation +* [#13032](https://github.com/scipy/scipy/pull/13032): DOC: fix docstring errors in in stats.wilcoxon +* [#13036](https://github.com/scipy/scipy/pull/13036): BUG: forward port lint\_diff shims +* [#13041](https://github.com/scipy/scipy/pull/13041): MAINT: dogbox ensure x is within bounds closes #11403 +* [#13042](https://github.com/scipy/scipy/pull/13042): MAINT: forward port 1.5.4 release notes +* [#13046](https://github.com/scipy/scipy/pull/13046): DOC: Update optimize.least\_squares doc for all tolerance must… +* [#13052](https://github.com/scipy/scipy/pull/13052): Typo fix for cluster documentation +* [#13054](https://github.com/scipy/scipy/pull/13054): BUG: fix `scipy.optimize.show\_options` for unknown methods…. +* [#13056](https://github.com/scipy/scipy/pull/13056): MAINT: fft: Fix a C++ compiler warning. +* [#13057](https://github.com/scipy/scipy/pull/13057): Minor fixes on doc of function csr\_tocsc +* [#13058](https://github.com/scipy/scipy/pull/13058): DOC: stats: Replace np.float with np.float64 in a tutorial file. +* [#13059](https://github.com/scipy/scipy/pull/13059): DOC: stats: Update the “Returns” section of the linregress docstring. +* [#13060](https://github.com/scipy/scipy/pull/13060): MAINT: clip\_x\_for\_func should be private +* [#13061](https://github.com/scipy/scipy/pull/13061): DOC: signal.win -> signal.windows.win in Examples +* [#13063](https://github.com/scipy/scipy/pull/13063): MAINT: Add suite-sparse and sksparse installation check +* [#13070](https://github.com/scipy/scipy/pull/13070): MAINT: stats: Remove a couple obsolete comments. +* [#13073](https://github.com/scipy/scipy/pull/13073): BUG: Fix scalar\_search\_wolfe2 to resolve #12157 +* [#13078](https://github.com/scipy/scipy/pull/13078): CI, MAINT: migrate Lint to Azure +* [#13081](https://github.com/scipy/scipy/pull/13081): BLD: drop Python 3.6 support (NEP 29) +* [#13082](https://github.com/scipy/scipy/pull/13082): MAINT: update minimum NumPy version to 1.16.5 in a couple more… +* [#13083](https://github.com/scipy/scipy/pull/13083): DOC: update toolchain.rst +* [#13086](https://github.com/scipy/scipy/pull/13086): DOC: Update the Parameters section of the correlation docstring +* [#13087](https://github.com/scipy/scipy/pull/13087): ENH:signal: Speed-up Cython implementation of \_sosfilt +* [#13089](https://github.com/scipy/scipy/pull/13089): BLD, BUG: add c99 compiler flag to HiGHS basiclu library +* [#13091](https://github.com/scipy/scipy/pull/13091): BUG: Fix GIL handling in \_sosfilt +* [#13094](https://github.com/scipy/scipy/pull/13094): DOC: clarify “location” in docstring of cKDTree.query +* [#13095](https://github.com/scipy/scipy/pull/13095): Zoom resize update +* [#13097](https://github.com/scipy/scipy/pull/13097): BUG: fix CubicSpline(…, bc\_type=”periodic”) #11758 +* [#13100](https://github.com/scipy/scipy/pull/13100): BUG: sparse: Correct output format of kron +* [#13107](https://github.com/scipy/scipy/pull/13107): ENH: faster linear\_sum\_assignment for small cost matrices +* [#13110](https://github.com/scipy/scipy/pull/13110): CI, MAINT: refguide/asv checks to azure +* [#13112](https://github.com/scipy/scipy/pull/13112): CI: fix MacOS CI +* [#13113](https://github.com/scipy/scipy/pull/13113): CI: Install word list package for refguide-check +* [#13115](https://github.com/scipy/scipy/pull/13115): BUG: add value range check for signal.iirdesign() +* [#13116](https://github.com/scipy/scipy/pull/13116): CI: Don’t report name errors after an exception in refguide-check +* [#13117](https://github.com/scipy/scipy/pull/13117): CI: move sdist/pre-release test Azure +* [#13119](https://github.com/scipy/scipy/pull/13119): Improve error message on friedmanchisquare function +* [#13121](https://github.com/scipy/scipy/pull/13121): Fix factorial() for NaN on Python 3.10 +* [#13123](https://github.com/scipy/scipy/pull/13123): BLD: Specify file extension for language standard version tests +* [#13128](https://github.com/scipy/scipy/pull/13128): TST: skip Fortran I/O test for ODR +* [#13130](https://github.com/scipy/scipy/pull/13130): TST: skip factorial() float tests on Python 3.10 +* [#13136](https://github.com/scipy/scipy/pull/13136): CI:Add python dbg run to GH Actions +* [#13138](https://github.com/scipy/scipy/pull/13138): CI: Port coverage, 64-bit BLAS, GCC 4.8 build to azure +* [#13139](https://github.com/scipy/scipy/pull/13139): Fix edge case for mode=’nearest’ in ndimage.interpolation functions +* [#13141](https://github.com/scipy/scipy/pull/13141): BUG: signal: Fix data type of the numerator returned by ss2tf. +* [#13144](https://github.com/scipy/scipy/pull/13144): MAINT: stats: restrict gausshyper z > -1 +* [#13146](https://github.com/scipy/scipy/pull/13146): typo in csr.py +* [#13148](https://github.com/scipy/scipy/pull/13148): BUG: stats: fix typo in stable rvs per gh-12870 +* [#13149](https://github.com/scipy/scipy/pull/13149): DOC: spatial/stats: cross-ref random rotation matrix functions +* [#13151](https://github.com/scipy/scipy/pull/13151): MAINT: stats: Fix a test and a couple PEP-8 issues. +* [#13152](https://github.com/scipy/scipy/pull/13152): MAINT: stats: Use np.take\_along\_axis in the private function… +* [#13154](https://github.com/scipy/scipy/pull/13154): ENH: stats: Implement defined handling of constant inputs in… +* [#13156](https://github.com/scipy/scipy/pull/13156): DOC: maintain equal display range for ndimage.zoom example +* [#13159](https://github.com/scipy/scipy/pull/13159): CI: Azure: Don’t run tests on merge commits, except for coverage +* [#13160](https://github.com/scipy/scipy/pull/13160): DOC: stats: disambiguate location-shifted/noncentral +* [#13161](https://github.com/scipy/scipy/pull/13161): BUG: DifferentialEvolutionSolver.\_\_del\_\_ can fail in garbage… +* [#13163](https://github.com/scipy/scipy/pull/13163): BUG: stats: fix bug in spearmanr nan propagation +* [#13167](https://github.com/scipy/scipy/pull/13167): MAINT: stats: Fix a test. +* [#13169](https://github.com/scipy/scipy/pull/13169): BUG: stats: Fix handling of misaligned masks in mstats.pearsonr. +* [#13178](https://github.com/scipy/scipy/pull/13178): CI: testing.yml –> macos.yml +* [#13181](https://github.com/scipy/scipy/pull/13181): CI: fix lint +* [#13190](https://github.com/scipy/scipy/pull/13190): BUG: optimize: fix a duplicate key bug for `test\_show\_options` +* [#13192](https://github.com/scipy/scipy/pull/13192): BUG:linalg: Add overwrite option to gejsv wrapper +* [#13194](https://github.com/scipy/scipy/pull/13194): BUG: slsqp should be able to use rel\_step +* [#13199](https://github.com/scipy/scipy/pull/13199): [skip travis] DOC: 1.6.0 release notes +* [#13203](https://github.com/scipy/scipy/pull/13203): fix typos +* [#13209](https://github.com/scipy/scipy/pull/13209): TST:linalg: set the seed for cossin test +* [#13212](https://github.com/scipy/scipy/pull/13212): [DOC] Backtick and directive consistency. +* [#13217](https://github.com/scipy/scipy/pull/13217): REL: add necessary setuptools and numpy version pins in pyproject.toml… +* [#13226](https://github.com/scipy/scipy/pull/13226): BUG: pavement.py file handle fixes +* [#13249](https://github.com/scipy/scipy/pull/13249): Handle cval correctly for ndimage functions with complex-valued… +* [#13253](https://github.com/scipy/scipy/pull/13253): BUG,MAINT: Ensure all Pool objects are closed +* [#13255](https://github.com/scipy/scipy/pull/13255): BUG:linalg: Fix heevx wrappers and add new tests +* [#13260](https://github.com/scipy/scipy/pull/13260): CI: fix macOS testing +* [#13269](https://github.com/scipy/scipy/pull/13269): CI: github actions: In the linux dbg tests, update apt before… +* [#13279](https://github.com/scipy/scipy/pull/13279): MAINT: 1.6.0 rc2 backports diff --git a/corpus/changelog/scipy_releases/scipy_161.md b/corpus/changelog/scipy_releases/scipy_161.md new file mode 100644 index 0000000000000000000000000000000000000000..a442bcfc795ad8e895f1b4c6919393dd9c0abe51 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_161.md @@ -0,0 +1,78 @@ +# SciPy 1.6.1 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.6.1-notes.html +Version: 1.6.1 + +Contents + +* [SciPy 1.6.1 Release Notes](#scipy-1-6-1-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.6.1](#issues-closed-for-1-6-1) + - [Pull requests for 1.6.1](#pull-requests-for-1-6-1) + +SciPy 1.6.1 is a bug-fix release with no new features +compared to 1.6.0. + +Please note that for SciPy wheels to correctly install with Pip on +macOS 11, Pip >= 20.3.3 is needed. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Peter Bell +* Evgeni Burovski +* CJ Carey +* Ralf Gommers +* Peter Mahler Larsen +* Cheng H. Lee + +* Cong Ma +* Nicholas McKibben +* Nikola Forró +* Tyler Reddy +* Warren Weckesser + +A total of 11 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.6.1](#id3)[#](#issues-closed-for-1-6-1 "Link to this heading") + +* [#13072](https://github.com/scipy/scipy/issues/13072): BLD: Quadpack undefined references +* [#13241](https://github.com/scipy/scipy/issues/13241): Not enough values to unpack when passing tuple to `blocksize`… +* [#13329](https://github.com/scipy/scipy/issues/13329): Large sparse matrices of big integers lose information +* [#13342](https://github.com/scipy/scipy/issues/13342): fftn crashes if shape arguments are supplied as ndarrays +* [#13356](https://github.com/scipy/scipy/issues/13356): LSQBivariateSpline segmentation fault when quitting the Python… +* [#13358](https://github.com/scipy/scipy/issues/13358): scipy.spatial.transform.Rotation object can not be deepcopied… +* [#13408](https://github.com/scipy/scipy/issues/13408): Type of `has\_sorted\_indices` property +* [#13412](https://github.com/scipy/scipy/issues/13412): Sorting spherical Voronoi vertices leads to crash in area calculation +* [#13421](https://github.com/scipy/scipy/issues/13421): linear\_sum\_assignment - support for matrices with more than 2^31… +* [#13428](https://github.com/scipy/scipy/issues/13428): `stats.exponnorm.cdf` returns `nan` for small values of `K`… +* [#13465](https://github.com/scipy/scipy/issues/13465): KDTree.count\_neighbors : 0xC0000005 error for tuple of different… +* [#13468](https://github.com/scipy/scipy/issues/13468): directed\_hausdorff issue with shuffle +* [#13472](https://github.com/scipy/scipy/issues/13472): Failures on FutureWarnings with numpy 1.20.0 for lfilter, sosfilt… +* [#13565](https://github.com/scipy/scipy/issues/13565): BUG: 32-bit wheels repo test failure in optimize + +### [Pull requests for 1.6.1](#id4)[#](#pull-requests-for-1-6-1 "Link to this heading") + +* [#13318](https://github.com/scipy/scipy/pull/13318): REL: prepare for SciPy 1.6.1 +* [#13344](https://github.com/scipy/scipy/pull/13344): BUG: fftpack doesn’t work with ndarray shape argument +* [#13345](https://github.com/scipy/scipy/pull/13345): MAINT: Replace scipy.take with numpy.take in FFT function docstrings. +* [#13354](https://github.com/scipy/scipy/pull/13354): BUG: optimize: rename private functions to include leading underscore +* [#13387](https://github.com/scipy/scipy/pull/13387): BUG: Support big-endian platforms and big-endian WAVs +* [#13394](https://github.com/scipy/scipy/pull/13394): BUG: Fix Python crash by allocating larger array in LSQBivariateSpline +* [#13400](https://github.com/scipy/scipy/pull/13400): BUG: sparse: Better validation for BSR ctor +* [#13403](https://github.com/scipy/scipy/pull/13403): BUG: sparse: Propagate dtype through CSR/CSC constructors +* [#13414](https://github.com/scipy/scipy/pull/13414): BUG: maintain dtype of SphericalVoronoi regions +* [#13422](https://github.com/scipy/scipy/pull/13422): FIX: optimize: use npy\_intp to store array dims for lsap +* [#13425](https://github.com/scipy/scipy/pull/13425): BUG: spatial: make Rotation picklable +* [#13426](https://github.com/scipy/scipy/pull/13426): BUG: `has\_sorted\_indices` and `has\_canonical\_format` should… +* [#13430](https://github.com/scipy/scipy/pull/13430): BUG: stats: Fix exponnorm.cdf and exponnorm.sf for small K +* [#13470](https://github.com/scipy/scipy/pull/13470): MAINT: silence warning generated by `spatial.directed\_hausdorff` +* [#13473](https://github.com/scipy/scipy/pull/13473): TST: fix failures due to new FutureWarnings in NumPy 1.21.dev0 +* [#13479](https://github.com/scipy/scipy/pull/13479): MAINT: update directed\_hausdorff Cython code +* [#13485](https://github.com/scipy/scipy/pull/13485): BUG: KDTree weighted count\_neighbors doesn’t work between two… +* [#13503](https://github.com/scipy/scipy/pull/13503): TST: fix `test\_fortranfile\_read\_mixed\_record` on big-endian… +* [#13518](https://github.com/scipy/scipy/pull/13518): DOC: document that pip >= 20.3.3 is needed for macOS 11 +* [#13520](https://github.com/scipy/scipy/pull/13520): BLD: update reqs based on oldest-supported-numpy in pyproject.toml +* [#13567](https://github.com/scipy/scipy/pull/13567): TST, BUG: adjust tol on test\_equivalence diff --git a/corpus/changelog/scipy_releases/scipy_162.md b/corpus/changelog/scipy_releases/scipy_162.md new file mode 100644 index 0000000000000000000000000000000000000000..982c4905c45d296d0e13c4c829f7ebb377ed87f6 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_162.md @@ -0,0 +1,46 @@ +# SciPy 1.6.2 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.6.2-notes.html +Version: 1.6.2 + +Contents + +* [SciPy 1.6.2 Release Notes](#scipy-1-6-2-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.6.2](#issues-closed-for-1-6-2) + - [Pull requests for 1.6.2](#pull-requests-for-1-6-2) + +SciPy 1.6.2 is a bug-fix release with no new features +compared to 1.6.1. This is also the first SciPy release +to place upper bounds on some dependencies to improve +the long-term repeatability of source builds. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Pradipta Ghosh + +* Tyler Reddy +* Ralf Gommers +* Martin K. Scherer + +* Robert Uhl +* Warren Weckesser + +A total of 6 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.6.2](#id3)[#](#issues-closed-for-1-6-2 "Link to this heading") + +* [#13512](https://github.com/scipy/scipy/issues/13512): `stats.gaussian\_kde.evaluate` broken on S390X +* [#13584](https://github.com/scipy/scipy/issues/13584): rotation.\_compute\_euler\_from\_matrix() creates an array with negative… +* [#13585](https://github.com/scipy/scipy/issues/13585): Behavior change in coo\_matrix when dtype=None +* [#13686](https://github.com/scipy/scipy/issues/13686): delta0 argument of scipy.odr.ODR() ignored + +### [Pull requests for 1.6.2](#id4)[#](#pull-requests-for-1-6-2 "Link to this heading") + +* [#12862](https://github.com/scipy/scipy/pull/12862): REL: put upper bounds on versions of dependencies +* [#13575](https://github.com/scipy/scipy/pull/13575): BUG: fix `gaussian\_kernel\_estimate` on S390X +* [#13586](https://github.com/scipy/scipy/pull/13586): BUG: sparse: Create a utility function `getdata` +* [#13598](https://github.com/scipy/scipy/pull/13598): MAINT, BUG: enforce contiguous layout for output array in Rotation.as\_euler +* [#13687](https://github.com/scipy/scipy/pull/13687): BUG: fix scipy.odr to consider given delta0 argument diff --git a/corpus/changelog/scipy_releases/scipy_163.md b/corpus/changelog/scipy_releases/scipy_163.md new file mode 100644 index 0000000000000000000000000000000000000000..f89c9a97c3860a4702bfd8654ede38a070e1f9a4 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_163.md @@ -0,0 +1,45 @@ +# SciPy 1.6.3 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.6.3-notes.html +Version: 1.6.3 + +Contents + +* [SciPy 1.6.3 Release Notes](#scipy-1-6-3-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.6.3](#issues-closed-for-1-6-3) + - [Pull requests for 1.6.3](#pull-requests-for-1-6-3) + +SciPy 1.6.3 is a bug-fix release with no new features +compared to 1.6.2. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Peter Bell +* Ralf Gommers +* Matt Haberland +* Peter Mahler Larsen +* Tirth Patel +* Tyler Reddy +* Pamphile ROY + +* Xingyu Liu + + +A total of 8 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.6.3](#id3)[#](#issues-closed-for-1-6-3 "Link to this heading") + +* [#13772](https://github.com/scipy/scipy/issues/13772): Divide by zero in distance.yule +* [#13796](https://github.com/scipy/scipy/issues/13796): CI: prerelease\_deps failures +* [#13890](https://github.com/scipy/scipy/issues/13890): TST: spatial rotation failure in (1.6.3) wheels repo (ARM64) + +### [Pull requests for 1.6.3](#id4)[#](#pull-requests-for-1-6-3 "Link to this heading") + +* [#13755](https://github.com/scipy/scipy/pull/13755): CI: fix the matplotlib warning emitted during builing docs +* [#13773](https://github.com/scipy/scipy/pull/13773): BUG: Divide by zero in yule dissimilarity of constant vectors +* [#13799](https://github.com/scipy/scipy/pull/13799): CI/MAINT: deprecated np.typeDict +* [#13819](https://github.com/scipy/scipy/pull/13819): substitute np.math.factorial with math.factorial +* [#13895](https://github.com/scipy/scipy/pull/13895): TST: add random seeds in Rotation module diff --git a/corpus/changelog/scipy_releases/scipy_170.md b/corpus/changelog/scipy_releases/scipy_170.md new file mode 100644 index 0000000000000000000000000000000000000000..bcf5ba8621cd48c6c0353efecf35a949f45c6b7d --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_170.md @@ -0,0 +1,1026 @@ +# SciPy 1.7.0 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.7.0-notes.html +Version: 1.7.0 + +Contents + +* [SciPy 1.7.0 Release Notes](#scipy-1-7-0-release-notes) + + + [Highlights of this release](#highlights-of-this-release) + + [New features](#new-features) + + - [[`scipy.cluster`](../reference/cluster.html#module-scipy.cluster "scipy.cluster") improvements](#scipy-cluster-improvements) + - [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#scipy-interpolate-improvements) + - [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#scipy-linalg-improvements) + - [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#scipy-ndimage-improvements) + - [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#scipy-optimize-improvements) + - [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#scipy-signal-improvements) + - [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#scipy-sparse-improvements) + - [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#scipy-spatial-improvements) + - [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#scipy-special-improvements) + - [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#scipy-stats-improvements) + + * [Hypothesis Tests](#hypothesis-tests) + * [Sample statistics](#sample-statistics) + * [Statistical Distributions](#statistical-distributions) + * [Other](#other) + * [New [`scipy.stats.qmc`](../reference/stats.qmc.html#module-scipy.stats.qmc "scipy.stats.qmc") module](#new-scipy-stats-qmc-module) + + [Deprecated features](#deprecated-features) + + - [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") deprecations](#scipy-linalg-deprecations) + - [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") deprecations](#scipy-spatial-deprecations) + + [Backwards incompatible changes](#backwards-incompatible-changes) + + [Other changes](#other-changes) + + [Authors](#authors) + + [Issues closed for 1.7.0](#issues-closed-for-1-7-0) + + [Pull requests for 1.7.0](#pull-requests-for-1-7-0) + +SciPy 1.7.0 is the culmination of 6 months of hard work. It contains +many new features, numerous bug-fixes, improved test coverage and better +documentation. There have been a number of deprecations and API changes +in this release, which are documented below. All users are encouraged to +upgrade to this release, as there are a large number of bug-fixes and +optimizations. Before upgrading, we recommend that users check that +their own code does not use deprecated SciPy functionality (to do so, +run your code with `python -Wd` and check for `DeprecationWarning` s). +Our development attention will now shift to bug-fix releases on the +1.7.x branch, and on adding new features on the master branch. + +This release requires Python 3.7+ and NumPy 1.16.5 or greater. + +For running on PyPy, PyPy3 6.0+ is required. + +## [Highlights of this release](#id2)[#](#highlights-of-this-release "Link to this heading") + +* A new submodule for quasi-Monte Carlo, [`scipy.stats.qmc`](../reference/stats.qmc.html#module-scipy.stats.qmc "scipy.stats.qmc"), was added +* The documentation design was updated to use the same PyData-Sphinx theme as + NumPy and other ecosystem libraries. +* We now vendor and leverage the Boost C++ library to enable numerous + improvements for long-standing weaknesses in [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") +* [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") has six new distributions, eight new (or overhauled) + hypothesis tests, a new function for bootstrapping, a class that enables + fast random variate sampling and percentile point function evaluation, + and many other enhancements. +* `cdist` and `pdist` distance calculations are faster for several metrics, + especially weighted cases, thanks to a rewrite to a new C++ backend framework +* A new class for radial basis function interpolation, *RBFInterpolator*, was + added to address issues with the *Rbf* class. + +*We gratefully acknowledge the Chan-Zuckerberg Initiative Essential Open Source +Software for Science program for supporting many of the improvements to* +[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats"). + +## [New features](#id3)[#](#new-features "Link to this heading") + +### [[`scipy.cluster`](../reference/cluster.html#module-scipy.cluster "scipy.cluster") improvements](#id4)[#](#scipy-cluster-improvements "Link to this heading") + +An optional argument, `seed`, has been added to `kmeans` and `kmeans2` to +set the random generator and random state. + +### [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#id5)[#](#scipy-interpolate-improvements "Link to this heading") + +Improved input validation and error messages for `fitpack.bispev` and +`fitpack.parder` for scenarios that previously caused substantial confusion +for users. + +The class *RBFInterpolator* was added to supersede the *Rbf* class. The new +class has usage that more closely follows other interpolator classes, corrects +sign errors that caused unexpected smoothing behavior, includes polynomial +terms in the interpolant (which are necessary for some RBF choices), and +supports interpolation using only the k-nearest neighbors for memory +efficiency. + +### [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#id6)[#](#scipy-linalg-improvements "Link to this heading") + +An LAPACK wrapper was added for access to the `tgexc` subroutine. + +### [[`scipy.ndimage`](../reference/ndimage.html#module-scipy.ndimage "scipy.ndimage") improvements](#id7)[#](#scipy-ndimage-improvements "Link to this heading") + +[`scipy.ndimage.affine_transform`](../reference/generated/scipy.ndimage.affine_transform.html#scipy.ndimage.affine_transform "scipy.ndimage.affine_transform") is now able to infer the `output_shape` from +the `out` array. + +### [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#id8)[#](#scipy-optimize-improvements "Link to this heading") + +The optional parameter `bounds` was added to +`_minimize_neldermead` to support bounds constraints +for the Nelder-Mead solver. + +`trustregion` methods `trust-krylov`, `dogleg` and `trust-ncg` can now +estimate `hess` by finite difference using one of +`["2-point", "3-point", "cs"]`. + +`halton` was added as a `sampling_method` in [`scipy.optimize.shgo`](../reference/generated/scipy.optimize.shgo.html#scipy.optimize.shgo "scipy.optimize.shgo"). +`sobol` was fixed and is now using [`scipy.stats.qmc.Sobol`](../reference/generated/scipy.stats.qmc.Sobol.html#scipy.stats.qmc.Sobol "scipy.stats.qmc.Sobol"). + +`halton` and `sobol` were added as `init` methods in +*scipy.optimize.differential\_evolution.* + +`differential_evolution` now accepts an `x0` parameter to provide an +initial guess for the minimization. + +`least_squares` has a modest performance improvement when SciPy is built +with Pythran transpiler enabled. + +When `linprog` is used with `method` `'highs'`, `'highs-ipm'`, or +`'highs-ds'`, the result object now reports the marginals (AKA shadow +prices, dual values) and residuals associated with each constraint. + +### [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#id9)[#](#scipy-signal-improvements "Link to this heading") + +`get_window` supports `general_cosine` and `general_hamming` window +functions. + +[`scipy.signal.medfilt2d`](../reference/generated/scipy.signal.medfilt2d.html#scipy.signal.medfilt2d "scipy.signal.medfilt2d") now releases the GIL where appropriate to enable +performance gains via multithreaded calculations. + +### [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#id10)[#](#scipy-sparse-improvements "Link to this heading") + +Addition of `dia_matrix` sparse matrices is now faster. + +### [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#id11)[#](#scipy-spatial-improvements "Link to this heading") + +`distance.cdist` and `distance.pdist` performance has greatly improved for +certain weighted metrics. Namely: `minkowski`, `euclidean`, `chebyshev`, +`canberra`, and `cityblock`. + +Modest performance improvements for many of the unweighted `cdist` and +`pdist` metrics noted above. + +The parameter `seed` was added to *scipy.spatial.vq.kmeans* and +*scipy.spatial.vq.kmeans2*. + +The parameters `axis` and `keepdims` where added to +[`scipy.spatial.distance.jensenshannon`](../reference/generated/scipy.spatial.distance.jensenshannon.html#scipy.spatial.distance.jensenshannon "scipy.spatial.distance.jensenshannon"). + +The `rotation` methods `from_rotvec` and `as_rotvec` now accept a +`degrees` argument to specify usage of degrees instead of radians. + +### [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#id12)[#](#scipy-special-improvements "Link to this heading") + +Wright’s generalized Bessel function for positive arguments was added as +[`scipy.special.wright_bessel`](../reference/generated/scipy.special.wright_bessel.html#scipy.special.wright_bessel "scipy.special.wright_bessel"). + +An implementation of the inverse of the Log CDF of the Normal Distribution is +now available via [`scipy.special.ndtri_exp`](../reference/generated/scipy.special.ndtri_exp.html#scipy.special.ndtri_exp "scipy.special.ndtri_exp"). + +### [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#id13)[#](#scipy-stats-improvements "Link to this heading") + +#### [Hypothesis Tests](#id14)[#](#hypothesis-tests "Link to this heading") + +The Mann-Whitney-Wilcoxon test, `mannwhitneyu`, has been rewritten. It now +supports n-dimensional input, an exact test method when there are no ties, +and improved documentation. Please see “Other changes” for adjustments to +default behavior. + +The new function [`scipy.stats.binomtest`](../reference/generated/scipy.stats.binomtest.html#scipy.stats.binomtest "scipy.stats.binomtest") replaces *scipy.stats.binom\_test*. The +new function returns an object that calculates a confidence intervals of the +proportion parameter. Also, performance was improved from O(n) to O(log(n)) by +using binary search. + +The two-sample version of the Cramer-von Mises test is implemented in +[`scipy.stats.cramervonmises_2samp`](../reference/generated/scipy.stats.cramervonmises_2samp.html#scipy.stats.cramervonmises_2samp "scipy.stats.cramervonmises_2samp"). + +The Alexander-Govern test is implemented in the new function +[`scipy.stats.alexandergovern`](../reference/generated/scipy.stats.alexandergovern.html#scipy.stats.alexandergovern "scipy.stats.alexandergovern"). + +The new functions [`scipy.stats.barnard_exact`](../reference/generated/scipy.stats.barnard_exact.html#scipy.stats.barnard_exact "scipy.stats.barnard_exact") and *scipy.stats. boschloo\_exact* +respectively perform Barnard’s exact test and Boschloo’s exact test +for 2x2 contingency tables. + +The new function [`scipy.stats.page_trend_test`](../reference/generated/scipy.stats.page_trend_test.html#scipy.stats.page_trend_test "scipy.stats.page_trend_test") performs Page’s test for ordered +alternatives. + +The new function [`scipy.stats.somersd`](../reference/generated/scipy.stats.somersd.html#scipy.stats.somersd "scipy.stats.somersd") performs Somers’ D test for ordinal +association between two variables. + +An option, `permutations`, has been added in [`scipy.stats.ttest_ind`](../reference/generated/scipy.stats.ttest_ind.html#scipy.stats.ttest_ind "scipy.stats.ttest_ind") to +perform permutation t-tests. A `trim` option was also added to perform +a trimmed (Yuen’s) t-test. + +The `alternative` parameter was added to the `skewtest`, `kurtosistest`, +`ranksums`, `mood`, `ansari`, `linregress`, and `spearmanr` functions +to allow one-sided hypothesis testing. + +#### [Sample statistics](#id15)[#](#sample-statistics "Link to this heading") + +The new function [`scipy.stats.differential_entropy`](../reference/generated/scipy.stats.differential_entropy.html#scipy.stats.differential_entropy "scipy.stats.differential_entropy") estimates the differential +entropy of a continuous distribution from a sample. + +The `boxcox` and `boxcox_normmax` now allow the user to control the +optimizer used to minimize the negative log-likelihood function. + +A new function [`scipy.stats.contingency.relative_risk`](../reference/generated/scipy.stats.contingency.relative_risk.html#scipy.stats.contingency.relative_risk "scipy.stats.contingency.relative_risk") calculates the +relative risk, or risk ratio, of a 2x2 contingency table. The object +returned has a method to compute the confidence interval of the relative risk. + +Performance improvements in the `skew` and `kurtosis` functions achieved +by removal of repeated/redundant calculations. + +Substantial performance improvements in [`scipy.stats.mstats.hdquantiles_sd`](../reference/generated/scipy.stats.mstats.hdquantiles_sd.html#scipy.stats.mstats.hdquantiles_sd "scipy.stats.mstats.hdquantiles_sd"). + +The new function [`scipy.stats.contingency.association`](../reference/generated/scipy.stats.contingency.association.html#scipy.stats.contingency.association "scipy.stats.contingency.association") computes several +measures of association for a contingency table: Pearsons contingency +coefficient, Cramer’s V, and Tschuprow’s T. + +The parameter `nan_policy` was added to [`scipy.stats.zmap`](../reference/generated/scipy.stats.zmap.html#scipy.stats.zmap "scipy.stats.zmap") to provide options +for handling the occurrence of `nan` in the input data. + +The parameter `ddof` was added to [`scipy.stats.variation`](../reference/generated/scipy.stats.variation.html#scipy.stats.variation "scipy.stats.variation") and +[`scipy.stats.mstats.variation`](../reference/generated/scipy.stats.mstats.variation.html#scipy.stats.mstats.variation "scipy.stats.mstats.variation"). + +The parameter `weights` was added to [`scipy.stats.gmean`](../reference/generated/scipy.stats.gmean.html#scipy.stats.gmean "scipy.stats.gmean"). + +#### [Statistical Distributions](#id16)[#](#statistical-distributions "Link to this heading") + +We now vendor and leverage the Boost C++ library to address a number of +previously reported issues in `stats`. Notably, `beta`, `binom`, +`nbinom` now have Boost backends, and it is straightforward to leverage +the backend for additional functions. + +The skew Cauchy probability distribution has been implemented as +[`scipy.stats.skewcauchy`](../reference/generated/scipy.stats.skewcauchy.html#scipy.stats.skewcauchy "scipy.stats.skewcauchy"). + +The Zipfian probability distribution has been implemented as +[`scipy.stats.zipfian`](../reference/generated/scipy.stats.zipfian.html#scipy.stats.zipfian "scipy.stats.zipfian"). + +The new distributions `nchypergeom_fisher` and `nchypergeom_wallenius` +implement the Fisher and Wallenius versions of the noncentral hypergeometric +distribution, respectively. + +The generalized hyperbolic distribution was added in +[`scipy.stats.genhyperbolic`](../reference/generated/scipy.stats.genhyperbolic.html#scipy.stats.genhyperbolic "scipy.stats.genhyperbolic"). + +The studentized range distribution was added in [`scipy.stats.studentized_range`](../reference/generated/scipy.stats.studentized_range.html#scipy.stats.studentized_range "scipy.stats.studentized_range"). + +[`scipy.stats.argus`](../reference/generated/scipy.stats.argus.html#scipy.stats.argus "scipy.stats.argus") now has improved handling for small parameter values. + +Better argument handling/preparation has resulted in performance improvements +for many distributions. + +The `cosine` distribution has added ufuncs for `ppf`, `cdf`, `sf`, and +`isf` methods including numerical precision improvements at the edges of the +support of the distribution. + +An option to fit the distribution to data by the method of moments has been +added to the `fit` method of the univariate continuous distributions. + +#### [Other](#id17)[#](#other "Link to this heading") + +[`scipy.stats.bootstrap`](../reference/generated/scipy.stats.bootstrap.html#scipy.stats.bootstrap "scipy.stats.bootstrap") has been added to allow estimation of the confidence +interval and standard error of a statistic. + +The new function [`scipy.stats.contingency.crosstab`](../reference/generated/scipy.stats.contingency.crosstab.html#scipy.stats.contingency.crosstab "scipy.stats.contingency.crosstab") computes a contingency +table (i.e. a table of counts of unique entries) for the given data. + +`scipy.stats.NumericalInverseHermite` enables fast random variate sampling +and percentile point function evaluation of an arbitrary univariate statistical +distribution. + +#### [New [`scipy.stats.qmc`](../reference/stats.qmc.html#module-scipy.stats.qmc "scipy.stats.qmc") module](#id18)[#](#new-scipy-stats-qmc-module "Link to this heading") + +This new module provides Quasi-Monte Carlo (QMC) generators and associated +helper functions. + +It provides a generic class [`scipy.stats.qmc.QMCEngine`](../reference/generated/scipy.stats.qmc.QMCEngine.html#scipy.stats.qmc.QMCEngine "scipy.stats.qmc.QMCEngine") which defines a QMC +engine/sampler. An engine is state aware: it can be continued, advanced and +reset. 3 base samplers are available: + +* [`scipy.stats.qmc.Sobol`](../reference/generated/scipy.stats.qmc.Sobol.html#scipy.stats.qmc.Sobol "scipy.stats.qmc.Sobol") the well known Sobol low discrepancy sequence. + Several warnings have been added to guide the user into properly using this + sampler. The sequence is scrambled by default. +* [`scipy.stats.qmc.Halton`](../reference/generated/scipy.stats.qmc.Halton.html#scipy.stats.qmc.Halton "scipy.stats.qmc.Halton"): Halton low discrepancy sequence. The sequence is + scrambled by default. +* [`scipy.stats.qmc.LatinHypercube`](../reference/generated/scipy.stats.qmc.LatinHypercube.html#scipy.stats.qmc.LatinHypercube "scipy.stats.qmc.LatinHypercube"): plain LHS design. + +And 2 special samplers are available: + +* [`scipy.stats.qmc.MultinomialQMC`](../reference/generated/scipy.stats.qmc.MultinomialQMC.html#scipy.stats.qmc.MultinomialQMC "scipy.stats.qmc.MultinomialQMC"): sampling from a multinomial distribution + using any of the base [`scipy.stats.qmc.QMCEngine`](../reference/generated/scipy.stats.qmc.QMCEngine.html#scipy.stats.qmc.QMCEngine "scipy.stats.qmc.QMCEngine"). +* [`scipy.stats.qmc.MultivariateNormalQMC`](../reference/generated/scipy.stats.qmc.MultivariateNormalQMC.html#scipy.stats.qmc.MultivariateNormalQMC "scipy.stats.qmc.MultivariateNormalQMC"): sampling from a multivariate Normal + using any of the base [`scipy.stats.qmc.QMCEngine`](../reference/generated/scipy.stats.qmc.QMCEngine.html#scipy.stats.qmc.QMCEngine "scipy.stats.qmc.QMCEngine"). + +The module also provide the following helpers: + +* [`scipy.stats.qmc.discrepancy`](../reference/generated/scipy.stats.qmc.discrepancy.html#scipy.stats.qmc.discrepancy "scipy.stats.qmc.discrepancy"): assess the quality of a set of points in terms + of space coverage. +* [`scipy.stats.qmc.update_discrepancy`](../reference/generated/scipy.stats.qmc.update_discrepancy.html#scipy.stats.qmc.update_discrepancy "scipy.stats.qmc.update_discrepancy"): can be used in an optimization loop to + construct a good set of points. +* [`scipy.stats.qmc.scale`](../reference/generated/scipy.stats.qmc.scale.html#scipy.stats.qmc.scale "scipy.stats.qmc.scale"): easily scale a set of points from (to) the unit + interval to (from) a given range. + +## [Deprecated features](#id19)[#](#deprecated-features "Link to this heading") + +### [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") deprecations](#id20)[#](#scipy-linalg-deprecations "Link to this heading") + +* *scipy.linalg.pinv2* is deprecated and its functionality is completely + subsumed into [`scipy.linalg.pinv`](../reference/generated/scipy.linalg.pinv.html#scipy.linalg.pinv "scipy.linalg.pinv") +* Both `rcond`, `cond` keywords of [`scipy.linalg.pinv`](../reference/generated/scipy.linalg.pinv.html#scipy.linalg.pinv "scipy.linalg.pinv") and + [`scipy.linalg.pinvh`](../reference/generated/scipy.linalg.pinvh.html#scipy.linalg.pinvh "scipy.linalg.pinvh") were not working and now are deprecated. They are now + replaced with functioning `atol` and `rtol` keywords with clear usage. + +### [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") deprecations](#id21)[#](#scipy-spatial-deprecations "Link to this heading") + +* [`scipy.spatial.distance`](../reference/spatial.distance.html#module-scipy.spatial.distance "scipy.spatial.distance") metrics expect 1d input vectors but will call + `np.squeeze` on their inputs to accept any extra length-1 dimensions. That + behaviour is now deprecated. + +## [Backwards incompatible changes](#id22)[#](#backwards-incompatible-changes "Link to this heading") + +## [Other changes](#id23)[#](#other-changes "Link to this heading") + +We now accept and leverage performance improvements from the ahead-of-time +Python-to-C++ transpiler, Pythran, which can be optionally disabled (via +`export SCIPY_USE_PYTHRAN=0`) but is enabled by default at build time. + +There are two changes to the default behavior of *scipy.stats.mannwhitenyu*: + +* For years, use of the default `alternative=None` was deprecated; explicit + `alternative` specification was required. Use of the new default value of + `alternative`, “two-sided”, is now permitted. +* Previously, all p-values were based on an asymptotic approximation. Now, for + small samples without ties, the p-values returned are exact by default. + +Support has been added for PEP 621 (project metadata in `pyproject.toml`) + +We now support a Gitpod environment to reduce the barrier to entry for SciPy +development; for more details see `quickstart-gitpod`. + +## [Authors](#id24)[#](#authors "Link to this heading") + +* @endolith +* Jelle Aalbers + +* Adam + +* Tania Allard + +* Sven Baars + +* Max Balandat + +* baumgarc + +* Christoph Baumgarten +* Peter Bell +* Lilian Besson +* Robinson Besson + +* Max Bolingbroke +* Blair Bonnett + +* Jordão Bragantini +* Harm Buisman + +* Evgeni Burovski +* Matthias Bussonnier +* Dominic C +* CJ Carey +* Ramón Casero + +* Chachay + +* charlotte12l + +* Benjamin Curtice Corbett + +* Falcon Dai + +* Ian Dall + +* Terry Davis +* droussea2001 + +* DWesl + +* dwight200 + +* Thomas J. Fan + +* Joseph Fox-Rabinovitz +* Max Frei + +* Laura Gutierrez Funderburk + +* gbonomib + +* Matthias Geier + +* Pradipta Ghosh + +* Ralf Gommers +* Evan H + +* h-vetinari +* Matt Haberland +* Anselm Hahn + +* Alex Henrie +* Piet Hessenius + +* Trever Hines + +* Elisha Hollander + +* Stephan Hoyer +* Tom Hu + +* Kei Ishikawa + +* Julien Jerphanion +* Robert Kern +* Shashank KS + +* Peter Mahler Larsen +* Eric Larson +* Cheng H. Lee + +* Gregory R. Lee +* Jean-Benoist Leger + +* lgfunderburk + +* liam-o-marsh + +* Xingyu Liu + +* Alex Loftus + +* Christian Lorentzen + +* Cong Ma +* Marc + +* MarkPundurs + +* Markus Löning + +* Liam Marsh + +* Nicholas McKibben +* melissawm + +* Jamie Morton +* Andrew Nelson +* Nikola Forró +* Tor Nordam + +* Olivier Gauthé + +* Rohit Pandey + +* Avanindra Kumar Pandeya + +* Tirth Patel +* paugier + +* Alex H. Wagner, PhD + +* Jeff Plourde + +* Ilhan Polat +* pranavrajpal + +* Vladyslav Rachek +* Bharat Raghunathan +* Recursing + +* Tyler Reddy +* Lucas Roberts +* Gregor Robinson + +* Pamphile Roy + +* Atsushi Sakai +* Benjamin Santos +* Martin K. Scherer + +* Thomas Schmelzer + +* Daniel Scott + +* Sebastian Wallkötter + +* serge-sans-paille + +* Namami Shanker + +* Masashi Shibata + +* Alexandre de Siqueira + +* Albert Steppi + +* Adam J. Stewart + +* Kai Striega +* Diana Sukhoverkhova +* Søren Fuglede Jørgensen +* Mike Taves +* Dan Temkin + +* Nicolas Tessore + +* tsubota20 + +* Robert Uhl +* christos val + +* Bas van Beek + +* Ashutosh Varma + +* Jose Vazquez + +* Sebastiano Vigna +* Aditya Vijaykumar +* VNMabus +* Arthur Volant + +* Samuel Wallan +* Stefan van der Walt +* Warren Weckesser +* Anreas Weh +* Josh Wilson +* Rory Yorke +* Egor Zemlyanoy +* Marc Zoeller + +* zoj613 + +* 秋纫 + + +A total of 126 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +## [Issues closed for 1.7.0](#id25)[#](#issues-closed-for-1-7-0 "Link to this heading") + +* [#636](https://github.com/scipy/scipy/issues/636): Statistics Review: mannwhitneyu (Trac #109) +* [#1346](https://github.com/scipy/scipy/issues/1346): signal.medfilt2d should fall back on signal.medfilt for types… +* [#2118](https://github.com/scipy/scipy/issues/2118): Mann-Whitney statistic returns incorrect results (Trac #1593) +* [#2158](https://github.com/scipy/scipy/issues/2158): special.chndtrix (ncx2.ppf) gives wrong results (Trac #1633) +* [#3284](https://github.com/scipy/scipy/issues/3284): build\_sphinx weirdness +* [#3352](https://github.com/scipy/scipy/issues/3352): beta distribution sf +* [#4067](https://github.com/scipy/scipy/issues/4067): Mannwhitneyu with arrays full of nan still reports significance +* [#4080](https://github.com/scipy/scipy/issues/4080): entropy in Scipy +* [#4641](https://github.com/scipy/scipy/issues/4641): mstats.mannwhitneyu and stats.mannwhitneyu return inconsistent… +* [#5122](https://github.com/scipy/scipy/issues/5122): scipy.stats.binom.ppf Incorrect for p=0 +* [#5180](https://github.com/scipy/scipy/issues/5180): Rbf interpolation - use only K nearest neighbors +* [#5258](https://github.com/scipy/scipy/issues/5258): affine\_transform complains about output\_shape when output array… +* [#5562](https://github.com/scipy/scipy/issues/5562): Wishart degrees of freedom should be $v > p-1$ instead of $v… +* [#5933](https://github.com/scipy/scipy/issues/5933): mstats\_basic.py - mannwhitneyu [scipy/scipy/stats/mstats\_basic.py] +* [#6409](https://github.com/scipy/scipy/issues/6409): \_unequal\_var\_ttest\_denom causes ZeroDivisionError in early samples +* [#6682](https://github.com/scipy/scipy/issues/6682): negative binomial survival function is imprecise +* [#6897](https://github.com/scipy/scipy/issues/6897): scipy.stats.mannwhitneyu of empty sets gives p=0.0 and does not… +* [#7303](https://github.com/scipy/scipy/issues/7303): stats.describe with nan\_policy=omit returns matrix-wide minmax… +* [#7406](https://github.com/scipy/scipy/issues/7406): scipy.stats.binom.ppf returns nan for q between 0 and 1 if n… +* [#7437](https://github.com/scipy/scipy/issues/7437): ENH: add skewed Cauchy distribution to stats +* [#7542](https://github.com/scipy/scipy/issues/7542): DOC: stats tutorials: Questions on arcsine and Student t formulae +* [#7593](https://github.com/scipy/scipy/issues/7593): Meaning of `tol` argument in `scipy.optimize.minimize` is… +* [#8565](https://github.com/scipy/scipy/issues/8565): Error in SmoothSphereBivariateSpline(): “ValueError: Error code… +* [#8665](https://github.com/scipy/scipy/issues/8665): `scipy.ncx2.sf` should be monotone decreasing +* [#8836](https://github.com/scipy/scipy/issues/8836): scipy.optimize.linprog(method=’simplex’) needs to return duals +* [#9184](https://github.com/scipy/scipy/issues/9184): Mann-Whitney implementation wrong? +* [#9450](https://github.com/scipy/scipy/issues/9450): allow seeding of init methods in vq.kmeans2 +* [#9704](https://github.com/scipy/scipy/issues/9704): RectSphereBivariateSpline fails for negative longitude +* [#9836](https://github.com/scipy/scipy/issues/9836): scipy.stats.rice gives incorrect results when s is very low compared… +* [#9904](https://github.com/scipy/scipy/issues/9904): Request/Proposal: Greatly improve scipy.interpolate.Rbf +* [#9981](https://github.com/scipy/scipy/issues/9981): stats.kruskal : add a warning for an input with 2 or more columns +* [#10358](https://github.com/scipy/scipy/issues/10358): DOC: linprog and linear\_sum\_assignment tutorials needed +* [#10908](https://github.com/scipy/scipy/issues/10908): Nakami fitting doesn’t converge (scipy.stats) +* [#10933](https://github.com/scipy/scipy/issues/10933): Add scaled inverse chi2 distribution +* [#11014](https://github.com/scipy/scipy/issues/11014): Barnard’s Test for More Powerful Hypothesis Testing of 2x2 Contingency… +* [#11050](https://github.com/scipy/scipy/issues/11050): Feature request: Nelder-Mead with bounds +* [#11086](https://github.com/scipy/scipy/issues/11086): scipy.stats.skew doesn’t work correctly for float point numbers +* [#11113](https://github.com/scipy/scipy/issues/11113): inconsistent result from ttest\_ind and mannwhitneyu when used… +* [#11134](https://github.com/scipy/scipy/issues/11134): Wrong confidence interval for binomial distribution with p=0 +* [#11325](https://github.com/scipy/scipy/issues/11325): Add axis parameter for scipy.spatial.distance.jensenshannon +* [#11474](https://github.com/scipy/scipy/issues/11474): scipy.stats.skellam.cdf(0) returns 0 for large mu1 = mu2 +* [#11523](https://github.com/scipy/scipy/issues/11523): scipy.stats.zipf doesn’t implement zipf distribution +* [#11848](https://github.com/scipy/scipy/issues/11848): How to get Lagrange / lambda multipliers out of ‘linprog’ optimize… +* [#11909](https://github.com/scipy/scipy/issues/11909): Enable bounds for lambda in boxcox +* [#12118](https://github.com/scipy/scipy/issues/12118): Docstring missing defaults +* [#12132](https://github.com/scipy/scipy/issues/12132): Slow tests to be trimmed or moved to test(‘full’) +* [#12230](https://github.com/scipy/scipy/issues/12230): Dendrogram: enable leaves labelling with ‘labels’ when using… +* [#12282](https://github.com/scipy/scipy/issues/12282): scipy.stats.chisquare test does not check that observed and expected… +* [#12298](https://github.com/scipy/scipy/issues/12298): BUG: fmin\_powell missing squeeze in 1.5.0rc +* [#12403](https://github.com/scipy/scipy/issues/12403): Add nan\_policy to stats.zmap +* [#12518](https://github.com/scipy/scipy/issues/12518): Null hypothesis of Kolmogorov Smirnov test is not correctly described +* [#12534](https://github.com/scipy/scipy/issues/12534): Feature request: scipy.linalg.norm to deal with 0-size array +* [#12622](https://github.com/scipy/scipy/issues/12622): scipy.interpolate.interpn docstring example +* [#12635](https://github.com/scipy/scipy/issues/12635): scipy.stats.beta.ppf gives unexpexted results +* [#12669](https://github.com/scipy/scipy/issues/12669): Median-averaging of complex CSDs +* [#12731](https://github.com/scipy/scipy/issues/12731): stats.ncx2.cdf fails for nc >> x >> 1 +* [#12778](https://github.com/scipy/scipy/issues/12778): Confusing documentation of scipy.stats.weightedtau +* [#12794](https://github.com/scipy/scipy/issues/12794): [Bug] The result of stats.beta.isf is inconsistent with stats.beta.sf +* [#12837](https://github.com/scipy/scipy/issues/12837): stats.mannwhitneyu could support arrays +* [#12868](https://github.com/scipy/scipy/issues/12868): Vector-valued interpolation in `interp2d` +* [#12922](https://github.com/scipy/scipy/issues/12922): Minimize with trust-constr method leads to TypeError if option… +* [#12929](https://github.com/scipy/scipy/issues/12929): The use of starred expressions to create data detracts from understanding… +* [#12965](https://github.com/scipy/scipy/issues/12965): domain of argument of scipy.interpolate.RectSphereBivariateSpline(u,… +* [#13025](https://github.com/scipy/scipy/issues/13025): Generalized Hyperbolic Distribution +* [#13090](https://github.com/scipy/scipy/issues/13090): Broken link in doc for signal.max\_len\_seq +* [#13101](https://github.com/scipy/scipy/issues/13101): MAINT: Upgrade python version in docker file +* [#13158](https://github.com/scipy/scipy/issues/13158): `signal.get\_window()` has a missing doc link and cannot get… +* [#13173](https://github.com/scipy/scipy/issues/13173): Uninformative error message from bisplev function +* [#13234](https://github.com/scipy/scipy/issues/13234): BUG: stats: Wrong shape of burr.moment() and fisk.moment() when… +* [#13242](https://github.com/scipy/scipy/issues/13242): Does kmeans “drop” clusters? +* [#13243](https://github.com/scipy/scipy/issues/13243): tgsen uses an output argument for computing a default argument +* [#13245](https://github.com/scipy/scipy/issues/13245): Kurtosis returning 1 for array of same elements +* [#13257](https://github.com/scipy/scipy/issues/13257): GitHub Actions test failures for MacOS +* [#13272](https://github.com/scipy/scipy/issues/13272): scipy.stats.yeojohnson\_llf doc mistake +* [#13280](https://github.com/scipy/scipy/issues/13280): Wrong results with hypergeom cdf +* [#13285](https://github.com/scipy/scipy/issues/13285): description correction in scipy.stats.t +* [#13287](https://github.com/scipy/scipy/issues/13287): Generate binomial CDF with mu instead of prob +* [#13294](https://github.com/scipy/scipy/issues/13294): BUG: stats: wrong bounds returned by ‘support’ method for distributions… +* [#13299](https://github.com/scipy/scipy/issues/13299): Typing for scipy.spatial +* [#13300](https://github.com/scipy/scipy/issues/13300): Add a single individual to a latinhypercube initial population… +* [#13311](https://github.com/scipy/scipy/issues/13311): MAINT: pavement.py PYVER is outdated +* [#13339](https://github.com/scipy/scipy/issues/13339): savemat discards dimension information if any dimension is zero +* [#13341](https://github.com/scipy/scipy/issues/13341): add scipy.stats.variation with an ddof parameter +* [#13353](https://github.com/scipy/scipy/issues/13353): Documentation: in scipy.stats.johnsonsu, parameter `a` can… +* [#13405](https://github.com/scipy/scipy/issues/13405): TST: add a few tests for sparse BSR ctor +* [#13410](https://github.com/scipy/scipy/issues/13410): BUG: skew for empty array raises +* [#13417](https://github.com/scipy/scipy/issues/13417): 10,000 times speedup for generating random numbers from the cosine… +* [#13440](https://github.com/scipy/scipy/issues/13440): python runtest.py -t path-to-test.py failed +* [#13454](https://github.com/scipy/scipy/issues/13454): Scipy cosine distance can be greater than 2 +* [#13459](https://github.com/scipy/scipy/issues/13459): Broken link in cramervonmises documentation +* [#13494](https://github.com/scipy/scipy/issues/13494): One-word typo in the documentation of optimize.linprog\_simplex +* [#13501](https://github.com/scipy/scipy/issues/13501): minimize using Powell methods with Bounds leads to “TypeError:… +* [#13509](https://github.com/scipy/scipy/issues/13509): signal.medfilt2d vs ndimage.median\_filter +* [#13511](https://github.com/scipy/scipy/issues/13511): DOC: error in description of “direc” parameter of “fmin\_powell” +* [#13526](https://github.com/scipy/scipy/issues/13526): TST: stats: intermittent `test\_ttest\_ind\_randperm\_alternative2… +* [#13536](https://github.com/scipy/scipy/issues/13536): `\_within\_tolerance` seems an unnecessary repetition of `numpy.isclose` +* [#13540](https://github.com/scipy/scipy/issues/13540): missing python 3.8 manylinux wheels on scipy-wheels-nightly +* [#13559](https://github.com/scipy/scipy/issues/13559): shape error in linprog with revised simplex +* [#13587](https://github.com/scipy/scipy/issues/13587): binned\_statistic unreliable with single precision +* [#13589](https://github.com/scipy/scipy/issues/13589): Better argument preparation for distributions in stats package. +* [#13602](https://github.com/scipy/scipy/issues/13602): The crystallball distribution entropy is sometimes minus infinity +* [#13606](https://github.com/scipy/scipy/issues/13606): MAINT: mypy: some typing errors while running mypy + adding mypy… +* [#13608](https://github.com/scipy/scipy/issues/13608): Why does stats.binned\_statistic\_2d convert its values argument… +* [#13609](https://github.com/scipy/scipy/issues/13609): BUG: SciPy pip install -e gets unusable version spec +* [#13610](https://github.com/scipy/scipy/issues/13610): Highs solver did not provide a solution nor did it report a failure +* [#13614](https://github.com/scipy/scipy/issues/13614): BUG: invgauss.cdf should return the correct value when `mu`… +* [#13628](https://github.com/scipy/scipy/issues/13628): 1-letter typo in the definition of scipy.special.spence function… +* [#13634](https://github.com/scipy/scipy/issues/13634): mmwrite fails on dense, skew-symmetric array +* [#13646](https://github.com/scipy/scipy/issues/13646): Sparse matrix argmax() integer overflow on Windows 10 +* [#13647](https://github.com/scipy/scipy/issues/13647): `scipy.stats.qmc.LatinHypercube` cannot sample single sample… +* [#13651](https://github.com/scipy/scipy/issues/13651): Documentation wrong in scipy.linalg.eigvalsh +* [#13664](https://github.com/scipy/scipy/issues/13664): BUG: gamma distribution’s inverse survival function overflows… +* [#13693](https://github.com/scipy/scipy/issues/13693): BUG: sokalmichener appears to incorrectly apply weights +* [#13697](https://github.com/scipy/scipy/issues/13697): BUG: stats: Spurious warning generated by arcsine.pdf at the… +* [#13704](https://github.com/scipy/scipy/issues/13704): Make it possible to pass a rank cut-off value relatively to the… +* [#13707](https://github.com/scipy/scipy/issues/13707): Kullback Leibler Divergence broadcasting no longer works +* [#13740](https://github.com/scipy/scipy/issues/13740): Scipy.optimize x0 out of bounds when it is within bounds. +* [#13744](https://github.com/scipy/scipy/issues/13744): scipy.interpolate.interp1d has inconsistent behavior for non-unique… +* [#13754](https://github.com/scipy/scipy/issues/13754): optimize.minimize ‘trust’ methods and finite difference Hessian… +* [#13762](https://github.com/scipy/scipy/issues/13762): MAINT, TST: aarch64 stats test failures showing up in wheels… +* [#13769](https://github.com/scipy/scipy/issues/13769): probplot draws fit line even when fit=False +* [#13791](https://github.com/scipy/scipy/issues/13791): BUG: stats: wrapcauchy.cdf does not broadcast the shape parameter… +* [#13793](https://github.com/scipy/scipy/issues/13793): CI: CircleCI doc build failure +* [#13840](https://github.com/scipy/scipy/issues/13840): manylinux1 builds are failing because of C99 usage in `special/\_cosine.c` +* [#13850](https://github.com/scipy/scipy/issues/13850): CI: Homebrew is failing due to bintray +* [#13875](https://github.com/scipy/scipy/issues/13875): BUG: chi2\_contingency with Yates correction +* [#13878](https://github.com/scipy/scipy/issues/13878): BUG: `signal.get\_window` argument handling issue +* [#13880](https://github.com/scipy/scipy/issues/13880): Remove all usages of numpy.compat +* [#13896](https://github.com/scipy/scipy/issues/13896): Boschloo’s Test for More Powerful Hypothesis Testing of 2x2 Contingency… +* [#13923](https://github.com/scipy/scipy/issues/13923): Inverse of Log CDF of Normal Distribution +* [#13933](https://github.com/scipy/scipy/issues/13933): `signal.get\_window` does not support `general\_cosine` and… +* [#13950](https://github.com/scipy/scipy/issues/13950): DOC: scipy.spatial.KDTree.query +* [#13969](https://github.com/scipy/scipy/issues/13969): N=4 must not exceed M=3 +* [#13970](https://github.com/scipy/scipy/issues/13970): Pearson’s original paper on chi-square test could be referenced. +* [#13984](https://github.com/scipy/scipy/issues/13984): Faster addition of sparse diagonal matrices +* [#13988](https://github.com/scipy/scipy/issues/13988): An error occurred when using scipy.io.wavfile of scipy 1.6 version… +* [#13997](https://github.com/scipy/scipy/issues/13997): BUG: sparse: Incorrect result from `dia\_matrix.diagonal()` +* [#14005](https://github.com/scipy/scipy/issues/14005): MAINT: optimize: `curve\_fit` input error msg can be improved. +* [#14038](https://github.com/scipy/scipy/issues/14038): MAINT: add type annotations for \_sobol.pyx +* [#14048](https://github.com/scipy/scipy/issues/14048): DOC: missing git submodule information +* [#14055](https://github.com/scipy/scipy/issues/14055): linalg.solve: Unclear error when using assume\_a=’her’ with real… +* [#14093](https://github.com/scipy/scipy/issues/14093): DOC: Inconsistency in the definition of default values in the… +* [#14158](https://github.com/scipy/scipy/issues/14158): TST, BUG: test\_rbfinterp.py – test\_interpolation\_misfit\_1d fails… +* [#14170](https://github.com/scipy/scipy/issues/14170): TST: signal submodule test\_filtfilt\_gust failing on 32-bit amd64… +* [#14194](https://github.com/scipy/scipy/issues/14194): MAINT: download-wheels.py missing import +* [#14199](https://github.com/scipy/scipy/issues/14199): Generated sources for biasedurn extension are broken in 1.7.0rc1 + +## [Pull requests for 1.7.0](#id26)[#](#pull-requests-for-1-7-0 "Link to this heading") + +* [#4824](https://github.com/scipy/scipy/pull/4824): Permutation Ttest (new PR) +* [#4933](https://github.com/scipy/scipy/pull/4933): ENH: Update the Mann-Whitney-Wilcoxon test +* [#7702](https://github.com/scipy/scipy/pull/7702): ENH: stats: Add Skewed Cauchy Distribution +* [#8306](https://github.com/scipy/scipy/pull/8306): Optional Pythran support for scipy.signal.max\_len\_seq\_inner +* [#10170](https://github.com/scipy/scipy/pull/10170): MAINT: stats: Implement cdf and ppf as ufuncs for the cosine… +* [#10454](https://github.com/scipy/scipy/pull/10454): ENH: Extend find\_peaks\_cwt to take numbers and iterables for… +* [#10844](https://github.com/scipy/scipy/pull/10844): ENH: add stats.qmc module with quasi Monte Carlo functionality +* [#11313](https://github.com/scipy/scipy/pull/11313): ENH: add Wright’s generalized Bessel function +* [#11352](https://github.com/scipy/scipy/pull/11352): ENH: stats: Add crosstab function. +* [#11477](https://github.com/scipy/scipy/pull/11477): FIX: bounded parameter in cdfchn.f gives bad results +* [#11695](https://github.com/scipy/scipy/pull/11695): ENH: stats: add method of moments to `rv\_continuous.fit` +* [#11911](https://github.com/scipy/scipy/pull/11911): ENH: Added bounds to boxcox and boxcox\_normmax +* [#12438](https://github.com/scipy/scipy/pull/12438): BUG: use ellipkm1 in elliptical filter design to prevent numerical… +* [#12531](https://github.com/scipy/scipy/pull/12531): ENH: stats: add Page’s L test +* [#12603](https://github.com/scipy/scipy/pull/12603): ENH: stats: Add `binomtest` to replace `binom\_test`. +* [#12653](https://github.com/scipy/scipy/pull/12653): ENH: stats: add Somers’ D test +* [#12676](https://github.com/scipy/scipy/pull/12676): BUG: update median averaging in signal.csd +* [#12760](https://github.com/scipy/scipy/pull/12760): BUG: special: erfinv(x<<1) loses precision +* [#12801](https://github.com/scipy/scipy/pull/12801): ENH: Add single-sided p-values to remaining spearmanr and linregress +* [#12873](https://github.com/scipy/scipy/pull/12873): ENH: Stats: add Alexander Govern Test +* [#13008](https://github.com/scipy/scipy/pull/13008): ENH: Add ‘alternative’ to functions using normal CDF for p-value +* [#13040](https://github.com/scipy/scipy/pull/13040): BUG: Allow RectSphereBivariateSpline to accept negative longitude +* [#13048](https://github.com/scipy/scipy/pull/13048): ENH: stats: Add a function that computes the relative risk. +* [#13067](https://github.com/scipy/scipy/pull/13067): ENH: Add weights parameter to stats.gmean +* [#13084](https://github.com/scipy/scipy/pull/13084): ENH: fast Hankel transform +* [#13104](https://github.com/scipy/scipy/pull/13104): MAINT: upgrade python version (drop python 3.6) for docker dev… +* [#13153](https://github.com/scipy/scipy/pull/13153): ENH: added association measurements Pearsons Contingency Coefficient,… +* [#13166](https://github.com/scipy/scipy/pull/13166): ENH: stats: Add nan\_policy to zmap. +* [#13175](https://github.com/scipy/scipy/pull/13175): MAINT: tests for tall cost matrices in `linear\_sum\_assignment` +* [#13177](https://github.com/scipy/scipy/pull/13177): BUG: raise NotImplementedError in fourier\_ellipsoid when ndim… +* [#13184](https://github.com/scipy/scipy/pull/13184): BUG: stats: Fix min and max calculation of mstats.describe with… +* [#13188](https://github.com/scipy/scipy/pull/13188): DOC: stats: make null and alternative hypotheses of kstest more… +* [#13193](https://github.com/scipy/scipy/pull/13193): MAINT: stats: chisquare check sum of observed/expected frequencies +* [#13197](https://github.com/scipy/scipy/pull/13197): ENH/MAINT: HiGHS upstream enhancements and bug fixes +* [#13198](https://github.com/scipy/scipy/pull/13198): ENH: allow inference of output\_shape from out array in affine\_transform +* [#13204](https://github.com/scipy/scipy/pull/13204): ENH: stats: add Zipfian (different from Zipf/zeta) distribution +* [#13208](https://github.com/scipy/scipy/pull/13208): REL: set version to 1.7.0.dev0 +* [#13216](https://github.com/scipy/scipy/pull/13216): TST: stats: break up and mark slow tests +* [#13224](https://github.com/scipy/scipy/pull/13224): Update docs for the weighted τ +* [#13230](https://github.com/scipy/scipy/pull/13230): ENH: linalg: Add LAPACK wrapper for tgexc. +* [#13232](https://github.com/scipy/scipy/pull/13232): MAINT: stats: raise error when input to kruskal has >1 dim +* [#13233](https://github.com/scipy/scipy/pull/13233): DOC: stats: fix MGF of arcsine and entropy of t in tutorial +* [#13236](https://github.com/scipy/scipy/pull/13236): MAINT: reorganize shared linear assignment tests +* [#13237](https://github.com/scipy/scipy/pull/13237): BENCH: Refactor stats.Distribution to easily add new distributions +* [#13238](https://github.com/scipy/scipy/pull/13238): BUG: stats: fix wrong shape output of burr and fisk distributions +* [#13240](https://github.com/scipy/scipy/pull/13240): MAINT: add tests of trivial cost matrices for linear sum assignment +* [#13252](https://github.com/scipy/scipy/pull/13252): DOC: optimize: add `optimize.linear\_sum\_assignment` tutorial. +* [#13254](https://github.com/scipy/scipy/pull/13254): BUG: Fix precision issues for constant input in skew and kurtosis +* [#13262](https://github.com/scipy/scipy/pull/13262): BUG: scipy.medfilt and .medfilt2d fixes +* [#13263](https://github.com/scipy/scipy/pull/13263): ENH: add Cramer-von Mises test for two samples +* [#13264](https://github.com/scipy/scipy/pull/13264): fix a minor typo in `stats.anderson` doc +* [#13268](https://github.com/scipy/scipy/pull/13268): ENH: stats: Add implementation of \_entropy for the t distr. +* [#13273](https://github.com/scipy/scipy/pull/13273): DOC: stats: fix typo in Yeo-Johnson LL function documentation +* [#13275](https://github.com/scipy/scipy/pull/13275): MAINT: stats: Correct a comment in the \_fitstart method of gamma. +* [#13283](https://github.com/scipy/scipy/pull/13283): BUG: stats: fix the cdf method of rv\_discrete class +* [#13286](https://github.com/scipy/scipy/pull/13286): DOC: stats: clairify rv\_continuous/discrete.stats example +* [#13288](https://github.com/scipy/scipy/pull/13288): DOC: stats: discrete distribution shape parameter restrictions +* [#13289](https://github.com/scipy/scipy/pull/13289): MAINT: fix a build warning in sigtoolsmodule.c +* [#13290](https://github.com/scipy/scipy/pull/13290): DOC: Expand the discussion of the nan\_policy API. +* [#13291](https://github.com/scipy/scipy/pull/13291): MAINT: signal, stats: Use keepdims where appropriate. +* [#13292](https://github.com/scipy/scipy/pull/13292): DOC: stats: note another common parameterization of nbinom +* [#13293](https://github.com/scipy/scipy/pull/13293): DOC: Change broken link for default values to archived link +* [#13295](https://github.com/scipy/scipy/pull/13295): BUG: stats: fix the support method to return correct bounds +* [#13296](https://github.com/scipy/scipy/pull/13296): DOC: stats: Fix latex markup in the kstwo docstring. +* [#13297](https://github.com/scipy/scipy/pull/13297): TST: mark kde.logpdf overflow test as xslow +* [#13298](https://github.com/scipy/scipy/pull/13298): Generalized Hyperbolic Distribution +* [#13301](https://github.com/scipy/scipy/pull/13301): DOC: cluster: Add cluster number note to the docstring of cluster.vq.kmeans +* [#13302](https://github.com/scipy/scipy/pull/13302): BUG: Fix ndimage.morphology.distance\_transform\_\* argument handling +* [#13303](https://github.com/scipy/scipy/pull/13303): CI: prevent Codecov giving false CI failures and wrong PR annotations +* [#13313](https://github.com/scipy/scipy/pull/13313): ENH: static typing for qhull +* [#13316](https://github.com/scipy/scipy/pull/13316): Pythran implementation of scipy.signal.\_spectral +* [#13317](https://github.com/scipy/scipy/pull/13317): DOC: forward port 1.6.0 relnotes +* [#13319](https://github.com/scipy/scipy/pull/13319): ENH: stats: add fast numerical inversion of distribution CDF +* [#13320](https://github.com/scipy/scipy/pull/13320): ENH: x0 for differential\_evolution +* [#13324](https://github.com/scipy/scipy/pull/13324): DOC correct linprog highs versionadded to 1.6 +* [#13326](https://github.com/scipy/scipy/pull/13326): MAINT: update numpydoc to v1.1.0 +* [#13327](https://github.com/scipy/scipy/pull/13327): DOC: interpolate: improved docstring examples of `interpolate.interpn()`… +* [#13328](https://github.com/scipy/scipy/pull/13328): ENH: Boost stats distributions +* [#13330](https://github.com/scipy/scipy/pull/13330): ENH: stats: add noncentral hypergeometric distributions (Fisher’s… +* [#13331](https://github.com/scipy/scipy/pull/13331): MAINT/ENH: resolve mypy warnings/errors +* [#13332](https://github.com/scipy/scipy/pull/13332): DOC: interpolate: improved docstring of `interpolate.interp2d`… +* [#13333](https://github.com/scipy/scipy/pull/13333): ENH: stats: Some more \_sf and \_isf implementations. +* [#13334](https://github.com/scipy/scipy/pull/13334): MAINT: stats: Clean up a few defunct comments in \_continuous\_distns.py +* [#13336](https://github.com/scipy/scipy/pull/13336): Pythran version of scipy.optimize.\_group\_columns +* [#13337](https://github.com/scipy/scipy/pull/13337): DOC|ENH: type hinting in scipy.integrate.simpson +* [#13346](https://github.com/scipy/scipy/pull/13346): ENH: stats: add ‘ddof’ parameter to the ‘variation’ function +* [#13355](https://github.com/scipy/scipy/pull/13355): ENH: stats: implement \_logpdf, \_sf and \_isf for loggamma. +* [#13360](https://github.com/scipy/scipy/pull/13360): ENH|DOC: fix docstring and input validation in interpolate.RectSphereBivariateSpline +* [#13366](https://github.com/scipy/scipy/pull/13366): BUG: stats: Don’t raise ZeroDivisionError in \_unequal\_var\_ttest\_denom +* [#13370](https://github.com/scipy/scipy/pull/13370): ENH: fix ARGUS distribution for small parameters in stats +* [#13371](https://github.com/scipy/scipy/pull/13371): ENH: stats: add `bootstrap` for estimating confidence interval… +* [#13373](https://github.com/scipy/scipy/pull/13373): BUG: io/matlab: preserve dimensions of empty >=2D arrays +* [#13374](https://github.com/scipy/scipy/pull/13374): ENH: stats: add skewed Cauchy distribution +* [#13379](https://github.com/scipy/scipy/pull/13379): BUG: sparse: fix verbosity in sparse lsqr +* [#13383](https://github.com/scipy/scipy/pull/13383): TST: stats: mark many dimension permutation t-test slow +* [#13384](https://github.com/scipy/scipy/pull/13384): MAINT: Make keywords array static +* [#13388](https://github.com/scipy/scipy/pull/13388): PERF: Avoid duplicate mean calculations in skew and kurtosis +* [#13389](https://github.com/scipy/scipy/pull/13389): DOC: Fix deprecated directive syntax +* [#13390](https://github.com/scipy/scipy/pull/13390): DOC: Correct line length for Parameter Section underline +* [#13393](https://github.com/scipy/scipy/pull/13393): MAINT: stats: allow wishart dim - 1 < df < dim +* [#13395](https://github.com/scipy/scipy/pull/13395): DOC: fix typo in setup.py warning message +* [#13396](https://github.com/scipy/scipy/pull/13396): BUG: Fix MLE for Nakagami `nakagami\_gen.fit` +* [#13397](https://github.com/scipy/scipy/pull/13397): MAINT:linalg: Fix tgsen family wrapper and ordqz +* [#13406](https://github.com/scipy/scipy/pull/13406): TST: add error handling tests for sparse BSR ctor +* [#13413](https://github.com/scipy/scipy/pull/13413): DOC: ultra-quickstart guide +* [#13418](https://github.com/scipy/scipy/pull/13418): BUG: Fix moment returning inconsistent types and shapes +* [#13423](https://github.com/scipy/scipy/pull/13423): DOC: Update example for leaf\_label\_func/dendrogram +* [#13431](https://github.com/scipy/scipy/pull/13431): ENH: stats: override \_rvs for nhypergeom +* [#13432](https://github.com/scipy/scipy/pull/13432): Add indicator in NDInterpolator docstring that N must be > 1 +* [#13434](https://github.com/scipy/scipy/pull/13434): DOC: stats: note relationship between scaled-inv-chi2 and invgamma +* [#13436](https://github.com/scipy/scipy/pull/13436): ENH: interpolate: add input validation to check input x-y is… +* [#13441](https://github.com/scipy/scipy/pull/13441): ENH: add functionality `barnard\_exact` test to scipy.stats. +* [#13443](https://github.com/scipy/scipy/pull/13443): MAINT: stats: Updates for skewcauchy +* [#13444](https://github.com/scipy/scipy/pull/13444): DOC: clarify range of `a` parameter fpr johnsonsu/johnsonsb +* [#13445](https://github.com/scipy/scipy/pull/13445): DOC: fix runtests guidelines. +* [#13446](https://github.com/scipy/scipy/pull/13446): MAINT: stats: Add \_fitstart method to wrapcauchy. +* [#13447](https://github.com/scipy/scipy/pull/13447): DEV: Update development Docker image +* [#13448](https://github.com/scipy/scipy/pull/13448): ENH: Add annotations for `scipy.spatial.distance` +* [#13451](https://github.com/scipy/scipy/pull/13451): DOC: minor formatting. +* [#13458](https://github.com/scipy/scipy/pull/13458): DOC: indent see also. +* [#13460](https://github.com/scipy/scipy/pull/13460): DOC: stats: Fix link to Cramer-von Mises wikipedia article. +* [#13461](https://github.com/scipy/scipy/pull/13461): DOC: reorganize scipy.stats overview docs page +* [#13463](https://github.com/scipy/scipy/pull/13463): DOC: misc formatting fixes +* [#13466](https://github.com/scipy/scipy/pull/13466): DOC: Typo in see also s/SmoothUni/SmoothBi/g +* [#13467](https://github.com/scipy/scipy/pull/13467): DOC: optimize: add description about `tol` argument for `minimize`. +* [#13469](https://github.com/scipy/scipy/pull/13469): MAINT: Refactor optimization methods to use scipy.stats.qmc +* [#13477](https://github.com/scipy/scipy/pull/13477): CI: pin numpy to 1.19.5 for the three macOS CI jobs +* [#13478](https://github.com/scipy/scipy/pull/13478): DOC: fix typos where double :: for Sphinx directives were missing +* [#13481](https://github.com/scipy/scipy/pull/13481): CI: pin numpy to 1.19.5 in the 4 parallel Windows builds on Azure +* [#13482](https://github.com/scipy/scipy/pull/13482): CI: use numpy 1.20.0 again in macOS CI +* [#13483](https://github.com/scipy/scipy/pull/13483): DOC: Multiple documentation syntax fixes. +* [#13484](https://github.com/scipy/scipy/pull/13484): Move some pythran config from CI to setup +* [#13487](https://github.com/scipy/scipy/pull/13487): DOC: add a tutorial about scipy.stats.qmc +* [#13492](https://github.com/scipy/scipy/pull/13492): ENH: GH actions should not run on forks +* [#13493](https://github.com/scipy/scipy/pull/13493): DEV: Enable gitpod for SciPy +* [#13495](https://github.com/scipy/scipy/pull/13495): DOC One-word typo in the documentation of optimize.linprog\_simplex +* [#13499](https://github.com/scipy/scipy/pull/13499): DOC: describe LSAP implementation +* [#13502](https://github.com/scipy/scipy/pull/13502): BUG: Bounds created with lists weren’t working for Powell +* [#13507](https://github.com/scipy/scipy/pull/13507): MAINT, TST: stats: centralize invalid parameters list for all… +* [#13510](https://github.com/scipy/scipy/pull/13510): DOC: stats: fix small doc errors in ‘multivariate\_hypergeom’ +* [#13513](https://github.com/scipy/scipy/pull/13513): DOC: Added math notation in examples in ltisys.py +* [#13514](https://github.com/scipy/scipy/pull/13514): ENH: simplify low\_0\_bit function for Sobol +* [#13515](https://github.com/scipy/scipy/pull/13515): ENH: optimize: add bound constraint support for nelder-mead solver +* [#13516](https://github.com/scipy/scipy/pull/13516): DOC: reduce LaTeX usage for johnsonb docstring +* [#13519](https://github.com/scipy/scipy/pull/13519): BLD: remove build\_sphinx support from setup.py +* [#13527](https://github.com/scipy/scipy/pull/13527): TST: stats: xfail ttest\_ind\_randperm\_alternative2 on 32 bit +* [#13530](https://github.com/scipy/scipy/pull/13530): DOC: correct comparisons between median filter functions +* [#13532](https://github.com/scipy/scipy/pull/13532): ENH: release the GIL inside medfilt2d +* [#13538](https://github.com/scipy/scipy/pull/13538): DOC: optimize: fix minor doc error in ‘fmin\_powell’ (#13511) +* [#13546](https://github.com/scipy/scipy/pull/13546): DOC: fix list of “mode” options for ndimage +* [#13549](https://github.com/scipy/scipy/pull/13549): ENH: stats: add ‘alternative’ keyword to some normality tests. +* [#13551](https://github.com/scipy/scipy/pull/13551): MAINT: add git to docker env +* [#13552](https://github.com/scipy/scipy/pull/13552): MAINT: stats: remove float\_power shim +* [#13553](https://github.com/scipy/scipy/pull/13553): DOC: use support rather than a/b in stats tutorial +* [#13560](https://github.com/scipy/scipy/pull/13560): MAINT: optimize: improve linprog error message for sparse input… +* [#13562](https://github.com/scipy/scipy/pull/13562): MAINT: optimize: using np.isclose instead of \_within\_tolerance. +* [#13566](https://github.com/scipy/scipy/pull/13566): ENH: Speed up hdquantiles\_sd() +* [#13569](https://github.com/scipy/scipy/pull/13569): BENCH: optimize: benchmark only HiGHS methods; add bigger linprog… +* [#13574](https://github.com/scipy/scipy/pull/13574): DOC: In description of cluster.hierarchy.dendrogram ‘level’ parameter,… +* [#13576](https://github.com/scipy/scipy/pull/13576): ENH: improve discrepancy performance +* [#13579](https://github.com/scipy/scipy/pull/13579): TST: Add pybind11 to tox environments +* [#13583](https://github.com/scipy/scipy/pull/13583): BUG: Fix Dockerfile apt-get installs +* [#13588](https://github.com/scipy/scipy/pull/13588): MAINT: forward port 1.6.1 relnotes. +* [#13593](https://github.com/scipy/scipy/pull/13593): BUG: stats: preserve sample dtype for bin edges +* [#13595](https://github.com/scipy/scipy/pull/13595): ENH: interpolate: add RBFInterpolator +* [#13596](https://github.com/scipy/scipy/pull/13596): DOC: Fix indentation in new\_stats\_distribution.rst.inc +* [#13601](https://github.com/scipy/scipy/pull/13601): Add dpss for get\_window function +* [#13604](https://github.com/scipy/scipy/pull/13604): DOC: Correct dual annealing visiting param range. +* [#13605](https://github.com/scipy/scipy/pull/13605): Add Codecov badge to README +* [#13607](https://github.com/scipy/scipy/pull/13607): MAINT: stats: fix crystalball entropy +* [#13611](https://github.com/scipy/scipy/pull/13611): Better argument preparation for distributions in stats package. +* [#13612](https://github.com/scipy/scipy/pull/13612): Add docker run command for Windows cmd +* [#13613](https://github.com/scipy/scipy/pull/13613): MAINT, CI: mypy: fix typing errors + add mypy to CI +* [#13616](https://github.com/scipy/scipy/pull/13616): FIX: Return correct output for invgauss.cdf when mu is very small +* [#13617](https://github.com/scipy/scipy/pull/13617): MAINT: accept numbers and iterables for width in find\_peaks\_cwt +* [#13620](https://github.com/scipy/scipy/pull/13620): CI: disable the mypy CI job (partial revert of gh-13613) +* [#13621](https://github.com/scipy/scipy/pull/13621): DOC: signal: use array\_like for input types +* [#13622](https://github.com/scipy/scipy/pull/13622): MAINT: clean up some unused files, make `mypy scipy` pass +* [#13623](https://github.com/scipy/scipy/pull/13623): CI: enable Mypy CI job again +* [#13624](https://github.com/scipy/scipy/pull/13624): TST: test more values for `visiting\_param` input to `dual\_annealing` +* [#13625](https://github.com/scipy/scipy/pull/13625): Rename integrate.simps to integrate.simpsons in documentation… +* [#13631](https://github.com/scipy/scipy/pull/13631): ENH: add a `stats.differential\_entropy` function +* [#13633](https://github.com/scipy/scipy/pull/13633): BUG: stats.binned\_statistic\_2d user function expecting arrays +* [#13641](https://github.com/scipy/scipy/pull/13641): ENH: Added degrees parameter to rotvec +* [#13645](https://github.com/scipy/scipy/pull/13645): MAINT: mypy: don’t install numpy-stubs +* [#13649](https://github.com/scipy/scipy/pull/13649): BUG: sparse: csc\_matrix.argmax() integer overflow +* [#13650](https://github.com/scipy/scipy/pull/13650): ENH: stats: add ‘alternative’ parameter to ansari +* [#13652](https://github.com/scipy/scipy/pull/13652): DOC: fix eigvalsh documentation (#13651) +* [#13654](https://github.com/scipy/scipy/pull/13654): BUG: Fix LatinHypercubes +* [#13656](https://github.com/scipy/scipy/pull/13656): DOC: Fix PCHIP references +* [#13657](https://github.com/scipy/scipy/pull/13657): TST: remove IPython warning in debug session +* [#13658](https://github.com/scipy/scipy/pull/13658): Remove spurious quotes in docstring +* [#13661](https://github.com/scipy/scipy/pull/13661): ENH: stats: improve efficiency of / fix bug in exact permutation… +* [#13667](https://github.com/scipy/scipy/pull/13667): MAINT: Make latest Docker image default +* [#13668](https://github.com/scipy/scipy/pull/13668): MAINT: add .theia/ to .gitignore +* [#13669](https://github.com/scipy/scipy/pull/13669): BLD: change SCIPY\_USE\_PYTHRAN default to `1` +* [#13676](https://github.com/scipy/scipy/pull/13676): ENH Small improvements for LSQR with damp +* [#13678](https://github.com/scipy/scipy/pull/13678): MAINT: add Pythran-generated files to .gitignore +* [#13679](https://github.com/scipy/scipy/pull/13679): MAINT: move the `conda develop .` in the Gitpod config +* [#13680](https://github.com/scipy/scipy/pull/13680): DOC: Add cKDTree note comparing it with KDTree +* [#13681](https://github.com/scipy/scipy/pull/13681): DOC: build doc updates on Pythran, compiled code, and cleanups +* [#13683](https://github.com/scipy/scipy/pull/13683): BUG: mmwrite correctly serializes non skew-symmetric arrays +* [#13684](https://github.com/scipy/scipy/pull/13684): FIX: fix numerical overflow in gamma.isf method +* [#13685](https://github.com/scipy/scipy/pull/13685): BUG: fix cosine distance range to 0-2 +* [#13694](https://github.com/scipy/scipy/pull/13694): MAINT: fix warning emitted when NumPy version is incorrect +* [#13696](https://github.com/scipy/scipy/pull/13696): ENH: support trimming in ttest\_ind +* [#13698](https://github.com/scipy/scipy/pull/13698): BUG: stats: Fix spurious warnings generated by arcsine.pdf +* [#13701](https://github.com/scipy/scipy/pull/13701): DEV: scipy.interpolate b-splines (periodic case) +* [#13702](https://github.com/scipy/scipy/pull/13702): DEP: Clean up spent deprecations in spatial.distance +* [#13703](https://github.com/scipy/scipy/pull/13703): MAINT: fix issues found by static code analysis +* [#13706](https://github.com/scipy/scipy/pull/13706): ENH: stats: Implement sf and isf for the laplace distribution. +* [#13711](https://github.com/scipy/scipy/pull/13711): MAINT: stats: fix broadcasting for scipy.stats.entropy +* [#13712](https://github.com/scipy/scipy/pull/13712): BUG: stats: Override \_fitstart for the invweibull distribution. +* [#13713](https://github.com/scipy/scipy/pull/13713): DOC: update toolchain.rst to reflect windows universal C runtime +* [#13714](https://github.com/scipy/scipy/pull/13714): MAINT: stats: Remove an unused list from test\_continuous\_basic.py. +* [#13715](https://github.com/scipy/scipy/pull/13715): MAINT: stats: No need to suppress frechet deprecation warnings. +* [#13716](https://github.com/scipy/scipy/pull/13716): MAINT: use super() as described by PEP 3135 +* [#13718](https://github.com/scipy/scipy/pull/13718): MAINT: new-style class, removing inheritance to object +* [#13721](https://github.com/scipy/scipy/pull/13721): MAINT: add a type-ignore for mpmath (#13721) +* [#13723](https://github.com/scipy/scipy/pull/13723): MAINT: mypy: ignore mpmath imports in mypy.ini +* [#13724](https://github.com/scipy/scipy/pull/13724): DOC: pydata sphinx theme +* [#13725](https://github.com/scipy/scipy/pull/13725): BENCH: add benchmark for Kendalltau +* [#13727](https://github.com/scipy/scipy/pull/13727): CI: simplify Pythran configuration setup for Azure +* [#13731](https://github.com/scipy/scipy/pull/13731): MAINT: stats: Some flake8-driven clean up. +* [#13732](https://github.com/scipy/scipy/pull/13732): ENH: stats: Studentized Range Distribution +* [#13735](https://github.com/scipy/scipy/pull/13735): DOC: correct Voronoi docstring +* [#13738](https://github.com/scipy/scipy/pull/13738): DOC: add example to wright\_bessel +* [#13739](https://github.com/scipy/scipy/pull/13739): ENH: stats: Implement \_sf and \_isf for the chi distribution. +* [#13741](https://github.com/scipy/scipy/pull/13741): MAINT: prevent overwriting of x in minimize +* [#13747](https://github.com/scipy/scipy/pull/13747): DOC: Add note for interp1d for non-unique x-values +* [#13749](https://github.com/scipy/scipy/pull/13749): MAINT: forward port 1.6.2 relnotes +* [#13759](https://github.com/scipy/scipy/pull/13759): MAINT: simpson small performance speedups +* [#13765](https://github.com/scipy/scipy/pull/13765): FIX: npymath missing causing npy\_log1p to be unknown +* [#13768](https://github.com/scipy/scipy/pull/13768): BENCH: Add missing pythran dependency +* [#13770](https://github.com/scipy/scipy/pull/13770): ENH: stats.contingency: Add the sparse option to crosstab. +* [#13774](https://github.com/scipy/scipy/pull/13774): DEP: Deprecate squeezing input vectors in spatial.distance +* [#13775](https://github.com/scipy/scipy/pull/13775): Enable trust region methods to use a finite difference Hessian… +* [#13777](https://github.com/scipy/scipy/pull/13777): DOC: Fix Ubuntu/Debian installation instructions +* [#13778](https://github.com/scipy/scipy/pull/13778): DOC: remove references to RandomState +* [#13782](https://github.com/scipy/scipy/pull/13782): MAINT: LBFGSB err msg on MAXLS changed closes #11718 +* [#13785](https://github.com/scipy/scipy/pull/13785): BENCH: Add benchmark for cdist/pdist with weights +* [#13786](https://github.com/scipy/scipy/pull/13786): MAINT: Prepare cdist/pdist for C++ rework +* [#13787](https://github.com/scipy/scipy/pull/13787): MAINT: stats: move entropy and differential\_entropy functions… +* [#13790](https://github.com/scipy/scipy/pull/13790): DOC: Add some dependencies for Dockerfile doc of scipy development. +* [#13792](https://github.com/scipy/scipy/pull/13792): BUG: stats: Fix broadcasting in wrapcauchy.cdf +* [#13795](https://github.com/scipy/scipy/pull/13795): MAINT: stats: add hypotests to \_\_all\_\_ in init.py, not stats.py +* [#13797](https://github.com/scipy/scipy/pull/13797): MAINT: stats: probplot: don’t plot least-squares fit line unless… +* [#13798](https://github.com/scipy/scipy/pull/13798): MAINT: fix incorrect code comment in `hierarchy.to\_tree` +* [#13802](https://github.com/scipy/scipy/pull/13802): DEV: add environment.yml file for development with conda/mamba +* [#13803](https://github.com/scipy/scipy/pull/13803): DOC: fix doc build warning about arxiv role already being registered +* [#13804](https://github.com/scipy/scipy/pull/13804): DOC+MAINT: optimize: lb and ub in the Bounds constructor are… +* [#13807](https://github.com/scipy/scipy/pull/13807): MAINT: Dont use parallel Sphinx +* [#13808](https://github.com/scipy/scipy/pull/13808): MAINT: cluster.to\_tree: more idiomatic looping over rows of matrix… +* [#13810](https://github.com/scipy/scipy/pull/13810): MAINT: add a CODEOWNERS file +* [#13811](https://github.com/scipy/scipy/pull/13811): MAINT: Add ci skip to azp +* [#13814](https://github.com/scipy/scipy/pull/13814): ENH/DOC: pydata sphinx theme polishing +* [#13817](https://github.com/scipy/scipy/pull/13817): DOC: Misc parameter typo and casing in scipy/linalg/\_decomp\_ldl.py +* [#13818](https://github.com/scipy/scipy/pull/13818): MAINT: stats: keep `entropy` importable from `scipy.stats.distributions` +* [#13820](https://github.com/scipy/scipy/pull/13820): BUG: update \_kendall\_p\_exact ValueError to f-string +* [#13831](https://github.com/scipy/scipy/pull/13831): FIX:DEP: Allow better tolerance control for pinv and pinvh and… +* [#13832](https://github.com/scipy/scipy/pull/13832): BUG: stats: Fix rvs for levy\_stable when alpha=1 +* [#13833](https://github.com/scipy/scipy/pull/13833): MAINT: Add inline type hintings for stats.qmc +* [#13836](https://github.com/scipy/scipy/pull/13836): MAINT: Fix a couple compiler warnings. +* [#13838](https://github.com/scipy/scipy/pull/13838): TST: relax test tolerances for BinomTest +* [#13841](https://github.com/scipy/scipy/pull/13841): BLD: add `-std=c99` flag to scipy.special extensions using… +* [#13845](https://github.com/scipy/scipy/pull/13845): ENH: stats: add `method` parameter to `differential\_entropy`… +* [#13847](https://github.com/scipy/scipy/pull/13847): TST: skip on optimize failure on macOS, mark one as xfail +* [#13848](https://github.com/scipy/scipy/pull/13848): DOC: optimize: move Nelder Mead doc from Unconstrained minimization… +* [#13849](https://github.com/scipy/scipy/pull/13849): DOC: Roadmap update +* [#13852](https://github.com/scipy/scipy/pull/13852): CI: fix temporary wrong brew version from GitHub +* [#13854](https://github.com/scipy/scipy/pull/13854): ENH: Update Scipy Gitpod +* [#13859](https://github.com/scipy/scipy/pull/13859): TST: fix ultra-slow ttest permutations test +* [#13860](https://github.com/scipy/scipy/pull/13860): MAINT: clean up LSAP error checking +* [#13863](https://github.com/scipy/scipy/pull/13863): DOC: remove seed in examples +* [#13865](https://github.com/scipy/scipy/pull/13865): DOC: optimize: The bounds param of differential\_evolution is… +* [#13866](https://github.com/scipy/scipy/pull/13866): MAINT: special: Remove an unused variable from \_poly\_approx in… +* [#13867](https://github.com/scipy/scipy/pull/13867): DOC: stats: Explain meaning of alternatives for fisher\_exact. +* [#13868](https://github.com/scipy/scipy/pull/13868): CI: fix the failing job on linux. +* [#13870](https://github.com/scipy/scipy/pull/13870): MAINT: move LSAP rectangular matrix handling into solver code +* [#13871](https://github.com/scipy/scipy/pull/13871): DOC: Add Gitpod documentation +* [#13876](https://github.com/scipy/scipy/pull/13876): Workflow : Add nightly release of NumPy in linux workflows +* [#13877](https://github.com/scipy/scipy/pull/13877): DOC: Conform to numpydoc + uniformity. +* [#13879](https://github.com/scipy/scipy/pull/13879): BUG: signal: fix get\_window argument handling and add tests. +* [#13881](https://github.com/scipy/scipy/pull/13881): CI: remove .travis.yml, remove codecov from CircleCI +* [#13882](https://github.com/scipy/scipy/pull/13882): BLD: ensure incrementing dev version strings +* [#13886](https://github.com/scipy/scipy/pull/13886): TST: optimize: skip test\_network\_flow\_limited\_capacity w/ UMFPACK… +* [#13888](https://github.com/scipy/scipy/pull/13888): MAINT: Fix issues involving elif conditions +* [#13891](https://github.com/scipy/scipy/pull/13891): Rename InivariateSpline to UnivariateSpline +* [#13893](https://github.com/scipy/scipy/pull/13893): ENH: linprog HiGHS marginals/sensitivy analysis +* [#13894](https://github.com/scipy/scipy/pull/13894): DOC: Add blank line before `Return` section. +* [#13897](https://github.com/scipy/scipy/pull/13897): DOC: BLD: fix doc build version check, and improve build time +* [#13903](https://github.com/scipy/scipy/pull/13903): MAINT: Gitpod fixes +* [#13907](https://github.com/scipy/scipy/pull/13907): ENH: Rewrite minkowski metric in C++ with pybind11 +* [#13909](https://github.com/scipy/scipy/pull/13909): Revert “Workflow : Add nightly release of NumPy in linux workflows” +* [#13910](https://github.com/scipy/scipy/pull/13910): DOC: update Readme +* [#13911](https://github.com/scipy/scipy/pull/13911): MAINT: use dict built-in rather than OrderedDict +* [#13920](https://github.com/scipy/scipy/pull/13920): BUG: Reactivate conda environment in init +* [#13925](https://github.com/scipy/scipy/pull/13925): BUG: stats: magnitude of Yates’ correction <= abs(observed-expected)… +* [#13926](https://github.com/scipy/scipy/pull/13926): DOC: correct return type in disjoint\_set.subsets docstring +* [#13927](https://github.com/scipy/scipy/pull/13927): DOC/MAINT: Add copyright notice to qmc.primes\_from\_2\_to +* [#13928](https://github.com/scipy/scipy/pull/13928): BUG: DOC: signal: fix need argument config and add missing doc… +* [#13929](https://github.com/scipy/scipy/pull/13929): REL: add PEP 621 (project metadata in pyproject.toml) support +* [#13931](https://github.com/scipy/scipy/pull/13931): MAINT: special: get rid of \_logit.c.src +* [#13934](https://github.com/scipy/scipy/pull/13934): ENH: signal: make `get\_window` supports `general\_cosine`… +* [#13940](https://github.com/scipy/scipy/pull/13940): MAINT: QMCEngine d input validation +* [#13941](https://github.com/scipy/scipy/pull/13941): MAINT: forward port 1.6.3 relnotes +* [#13944](https://github.com/scipy/scipy/pull/13944): BUG: spatial: fix weight handling of `distance.sokalmichener`. +* [#13947](https://github.com/scipy/scipy/pull/13947): MAINT: Remove duplicate calculations in sokalmichener +* [#13949](https://github.com/scipy/scipy/pull/13949): DOC: minor grammar fixes in minimize and KDTree.query +* [#13951](https://github.com/scipy/scipy/pull/13951): ENH: Add Boschloo exact test to stats +* [#13956](https://github.com/scipy/scipy/pull/13956): ENH: spatial: add `axis` and `keepdims` optional argument… +* [#13963](https://github.com/scipy/scipy/pull/13963): MAINT: stats: Fix unused imports and a few other issues related… +* [#13971](https://github.com/scipy/scipy/pull/13971): DOC: Add Karl Pearson’s reference to chi-square test +* [#13972](https://github.com/scipy/scipy/pull/13972): ENH: cluster: add an optional argument `seed` for `kmeans`… +* [#13973](https://github.com/scipy/scipy/pull/13973): BLD: fix build warnings for causal/anticausal pointers in ndimage +* [#13975](https://github.com/scipy/scipy/pull/13975): ENH: set empty array norm to zero. +* [#13977](https://github.com/scipy/scipy/pull/13977): MAINT: signal: replace distutils templating with tempita +* [#13978](https://github.com/scipy/scipy/pull/13978): MAINT: improve validations and keyword only arguments for some… +* [#13979](https://github.com/scipy/scipy/pull/13979): ENH: Add Inverse of Log CDF of Normal Distribution +* [#13983](https://github.com/scipy/scipy/pull/13983): Fixing `ndimage.watershed\_ift` tutorial’s documentation +* [#13987](https://github.com/scipy/scipy/pull/13987): DOC: Adding examples to docstrings in morphology: white\_tophat,… +* [#13989](https://github.com/scipy/scipy/pull/13989): DOC: interpolate: improve examples of `RegularGridInterpolator`… +* [#13990](https://github.com/scipy/scipy/pull/13990): MAINT, DOC: optimize: Make the input validation explanation clear… +* [#13992](https://github.com/scipy/scipy/pull/13992): Workflow : Add nightly release of NumPy in linux workflows +* [#13995](https://github.com/scipy/scipy/pull/13995): Doc: Continuous integration information +* [#14000](https://github.com/scipy/scipy/pull/14000): BUG: sparse: Fix DIA.diagonal bug and add a regression test +* [#14004](https://github.com/scipy/scipy/pull/14004): ENH: Fast addition dia matrix +* [#14006](https://github.com/scipy/scipy/pull/14006): MAINT: optimize: add validation to check func parameter number… +* [#14008](https://github.com/scipy/scipy/pull/14008): BUG: Raise exception for inconsistent WAV header +* [#14009](https://github.com/scipy/scipy/pull/14009): DEP: Remove usage of numpy.compat +* [#14010](https://github.com/scipy/scipy/pull/14010): MAINT: add support for wheel DL proxy +* [#14012](https://github.com/scipy/scipy/pull/14012): DOC: Broaden Exact Test Reference +* [#14015](https://github.com/scipy/scipy/pull/14015): MAINT: remove brew update +* [#14017](https://github.com/scipy/scipy/pull/14017): BENCH: Add more formats for sparse arithmetic +* [#14018](https://github.com/scipy/scipy/pull/14018): BENCH: add benchmark for f\_oneway +* [#14020](https://github.com/scipy/scipy/pull/14020): MAINT: modify np.int\_ to np.int32 to make it the same for 32/64… +* [#14023](https://github.com/scipy/scipy/pull/14023): MAINT: Fix clang build and remove some unicode characters +* [#14025](https://github.com/scipy/scipy/pull/14025): BUG: sparse: fix DIA.setdiag issue +* [#14026](https://github.com/scipy/scipy/pull/14026): TST: optimize: xfail part of test\_powell +* [#14029](https://github.com/scipy/scipy/pull/14029): CI: github macos fix +* [#14030](https://github.com/scipy/scipy/pull/14030): MAINT: use ‘yield from ’ (PEP 380) +* [#14031](https://github.com/scipy/scipy/pull/14031): MAINT: new-style class, removing inheritance to object +* [#14032](https://github.com/scipy/scipy/pull/14032): MAINT: CXXFLAGS for Pythran +* [#14033](https://github.com/scipy/scipy/pull/14033): ENH: Port sqeuclidean and braycurtis to \_distance\_pybind +* [#14034](https://github.com/scipy/scipy/pull/14034): MAINT: Clean-up ‘next = \_\_next\_\_’ +* [#14045](https://github.com/scipy/scipy/pull/14045): MAINT: bump PYVER pavement.py +* [#14047](https://github.com/scipy/scipy/pull/14047): DEV: initialize boost submodule in Gitpod Dockerfile +* [#14051](https://github.com/scipy/scipy/pull/14051): BLD: if boost submodule content is missing, error out early +* [#14052](https://github.com/scipy/scipy/pull/14052): DOC: missing submodule init information +* [#14057](https://github.com/scipy/scipy/pull/14057): DOC: special: Add Examples to `psi` docstring +* [#14058](https://github.com/scipy/scipy/pull/14058): BUG: fixed a dtype bug in linalg.solve. +* [#14060](https://github.com/scipy/scipy/pull/14060): Doc: Fix typo in documentation of spence function. +* [#14061](https://github.com/scipy/scipy/pull/14061): MAINT:stats: Type annotations for \_sobol.pyx +* [#14062](https://github.com/scipy/scipy/pull/14062): DOC: A few small fixes in quickstart\_gitpod.rst +* [#14063](https://github.com/scipy/scipy/pull/14063): DOC: signal: add Add Examples to `cont2discrete` docstring +* [#14064](https://github.com/scipy/scipy/pull/14064): DOC: optimize: Add Examples to fmin\_bfgs docstring +* [#14065](https://github.com/scipy/scipy/pull/14065): Add example for scipy stats.trim1 under docstring +* [#14066](https://github.com/scipy/scipy/pull/14066): DOC add example to scipy.special.hermite +* [#14067](https://github.com/scipy/scipy/pull/14067): DOC add alpha docstring description, add example to docstring +* [#14070](https://github.com/scipy/scipy/pull/14070): DOC add parameters, return, and example to docstring +* [#14072](https://github.com/scipy/scipy/pull/14072): MAINT/TST: Fix tests failing with the nightly build of numpy. +* [#14075](https://github.com/scipy/scipy/pull/14075): DOC Improve the code snippet in signal.hilbert docstring. +* [#14076](https://github.com/scipy/scipy/pull/14076): DOC: Document Jensen-Shannon distance being accepted by cdist/pdist +* [#14079](https://github.com/scipy/scipy/pull/14079): BLD: Avoid importing scipy.stats during cythonize stage +* [#14082](https://github.com/scipy/scipy/pull/14082): MAINT: Remove old, commented extract\_diagonal +* [#14083](https://github.com/scipy/scipy/pull/14083): MAINT: sparse: Remove defunct function extract\_diagonal +* [#14085](https://github.com/scipy/scipy/pull/14085): ENH: Implement canberra distance in \_distance\_pybind +* [#14086](https://github.com/scipy/scipy/pull/14086): MAINT: Clear scipy namespace of entries better imported from… +* [#14088](https://github.com/scipy/scipy/pull/14088): Install Pythran from sources for python 3.10 +* [#14092](https://github.com/scipy/scipy/pull/14092): BUG: Fixes issue with clang. +* [#14094](https://github.com/scipy/scipy/pull/14094): DOC: Correct the inconsistence definition of Default in class… +* [#14105](https://github.com/scipy/scipy/pull/14105): TST: stats: mannwhitneyu: check that mstats and stats mannwhitneyu… +* [#14106](https://github.com/scipy/scipy/pull/14106): DOC: stats.mstats: mannwhitneyu: the returned statistic is the… +* [#14107](https://github.com/scipy/scipy/pull/14107): ENH: stats: bootstrap: add `vectorized` parameter; automatically… +* [#14109](https://github.com/scipy/scipy/pull/14109): BUG: fix two issues in the fblas signature files +* [#14110](https://github.com/scipy/scipy/pull/14110): DOC: mailmap update +* [#14113](https://github.com/scipy/scipy/pull/14113): ENH: stats: bootstrap: add `paired` parameter +* [#14116](https://github.com/scipy/scipy/pull/14116): MAINT: fix deprecated Python C API usage in odr +* [#14118](https://github.com/scipy/scipy/pull/14118): DOC: 1.7.0 release notes +* [#14125](https://github.com/scipy/scipy/pull/14125): DOC: fix typo +* [#14126](https://github.com/scipy/scipy/pull/14126): ENH: stats: bootstrap: add `batch` parameter to control batch… +* [#14127](https://github.com/scipy/scipy/pull/14127): CI: upgrade pip in benchmarks CI run +* [#14130](https://github.com/scipy/scipy/pull/14130): BUG: Fix trust-constr report TypeError if verbose is set to 2… +* [#14133](https://github.com/scipy/scipy/pull/14133): MAINT: interpolate: raise NotImplementedError not ValueError +* [#14139](https://github.com/scipy/scipy/pull/14139): FIX/DOC: lsqr doctests print failure +* [#14145](https://github.com/scipy/scipy/pull/14145): MAINT: 1.7.x version pins (“backport”) +* [#14146](https://github.com/scipy/scipy/pull/14146): MAINT: commit count if no tag +* [#14164](https://github.com/scipy/scipy/pull/14164): TST, BUG: fix rbf matrix value +* [#14166](https://github.com/scipy/scipy/pull/14166): CI, MAINT: restrictions on pre-release CI +* [#14171](https://github.com/scipy/scipy/pull/14171): TST: signal: Bump tolerances for a test of Gustafsson’s… +* [#14175](https://github.com/scipy/scipy/pull/14175): TST: stats: Loosen tolerance in some binomtest tests. +* [#14182](https://github.com/scipy/scipy/pull/14182): MAINT: stats: Update ppcc\_plot and ppcc\_max docstring. +* [#14195](https://github.com/scipy/scipy/pull/14195): MAINT: download-wheels missing import +* [#14230](https://github.com/scipy/scipy/pull/14230): REL: stop shipping generated Cython sources in sdist diff --git a/corpus/changelog/scipy_releases/scipy_171.md b/corpus/changelog/scipy_releases/scipy_171.md new file mode 100644 index 0000000000000000000000000000000000000000..09a041528ee95d82e323e7264ea2a24fa9f80178 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_171.md @@ -0,0 +1,60 @@ +# SciPy 1.7.1 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.7.1-notes.html +Version: 1.7.1 + +Contents + +* [SciPy 1.7.1 Release Notes](#scipy-1-7-1-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.7.1](#issues-closed-for-1-7-1) + - [Pull requests for 1.7.1](#pull-requests-for-1-7-1) + +SciPy 1.7.1 is a bug-fix release with no new features +compared to 1.7.0. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Peter Bell +* Evgeni Burovski +* Justin Charlong + +* Ralf Gommers +* Matti Picus +* Tyler Reddy +* Pamphile Roy +* Sebastian Wallkötter +* Arthur Volant + +A total of 9 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.7.1](#id3)[#](#issues-closed-for-1-7-1 "Link to this heading") + +* [#14074](https://github.com/scipy/scipy/issues/14074): Segmentation fault when building cKDTree with Scipy 1.6.3. +* [#14271](https://github.com/scipy/scipy/issues/14271): scipy.io.loadmat failure in 1.7.0 +* [#14273](https://github.com/scipy/scipy/issues/14273): `scipy.signal.{medfilt,medfilt2d}` hit “Windows fatal exception:… +* [#14282](https://github.com/scipy/scipy/issues/14282): DOC, CI: stats skewtest refguide failure +* [#14363](https://github.com/scipy/scipy/issues/14363): Huge stack allocation in \_sobol.pyx may cause stack overvflow +* [#14382](https://github.com/scipy/scipy/issues/14382): Memory leak in `scipy.spatial.distance` for `cdist` +* [#14396](https://github.com/scipy/scipy/issues/14396): BUG: Sphinx 4.1 breaks the banner’s logo +* [#14444](https://github.com/scipy/scipy/issues/14444): DOC/FEAT Rotation.from\_rotvec documents a degrees argument which… + +### [Pull requests for 1.7.1](#id4)[#](#pull-requests-for-1-7-1 "Link to this heading") + +* [#14178](https://github.com/scipy/scipy/pull/14178): DEV: Update Boschloo Exact test +* [#14264](https://github.com/scipy/scipy/pull/14264): REL: prepare for SciPy 1.7.1 +* [#14283](https://github.com/scipy/scipy/pull/14283): BUG: fix refguide-check namedtuple handling +* [#14303](https://github.com/scipy/scipy/pull/14303): FIX: Check for None before calling str methods +* [#14327](https://github.com/scipy/scipy/pull/14327): BUG: medfilt can access beyond the end of an array +* [#14355](https://github.com/scipy/scipy/pull/14355): BUG: KDTree balanced\_tree is unbalanced for degenerate data +* [#14368](https://github.com/scipy/scipy/pull/14368): BUG: avoid large cython global variable in function +* [#14384](https://github.com/scipy/scipy/pull/14384): BUG: Reference count leak in distance\_pybind +* [#14397](https://github.com/scipy/scipy/pull/14397): DOC/CI: do not allow sphinx 4.1. +* [#14417](https://github.com/scipy/scipy/pull/14417): DOC/CI: pin sphinx to !=4.1.0 +* [#14460](https://github.com/scipy/scipy/pull/14460): DOC: add required scipy version to kwarg +* [#14466](https://github.com/scipy/scipy/pull/14466): MAINT: 1.7.1 backports (round 1) +* [#14508](https://github.com/scipy/scipy/pull/14508): MAINT: bump scipy-mathjax +* [#14509](https://github.com/scipy/scipy/pull/14509): MAINT: 1.7.1 backports (round 2) diff --git a/corpus/changelog/scipy_releases/scipy_172.md b/corpus/changelog/scipy_releases/scipy_172.md new file mode 100644 index 0000000000000000000000000000000000000000..a526b840247c2d908b3fd690a688580f925ce533 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_172.md @@ -0,0 +1,75 @@ +# SciPy 1.7.2 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.7.2-notes.html +Version: 1.7.2 + +Contents + +* [SciPy 1.7.2 Release Notes](#scipy-1-7-2-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.7.2](#issues-closed-for-1-7-2) + - [Pull requests for 1.7.2](#pull-requests-for-1-7-2) + +SciPy 1.7.2 is a bug-fix release with no new features +compared to 1.7.1. Notably, the release includes wheels +for Python 3.10, and wheels are now built with a newer +version of OpenBLAS, 0.3.17. Python 3.10 wheels are provided +for MacOS x86\_64 (thin, not universal2 or arm64 at this time), +and Windows/Linux 64-bit. Many wheels are now built with newer +versions of manylinux, which may require newer versions of pip. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Peter Bell +* da-woods + +* Isuru Fernando +* Ralf Gommers +* Matt Haberland +* Nicholas McKibben +* Ilhan Polat +* Judah Rand + +* Tyler Reddy +* Pamphile Roy +* Charles Harris +* Matti Picus +* Hugo van Kemenade +* Jacob Vanderplas + +A total of 14 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.7.2](#id3)[#](#issues-closed-for-1-7-2 "Link to this heading") + +* [#6019](https://github.com/scipy/scipy/issues/6019): minimize\_scalar doesn’t seem to honor “disp” option +* [#14321](https://github.com/scipy/scipy/issues/14321): BUG: Indexing of CSR matrices with many rows is much slower than… +* [#14465](https://github.com/scipy/scipy/issues/14465): BUG: n-d interpolation parameter provided to geometric\_slerp +* [#14599](https://github.com/scipy/scipy/issues/14599): SciPy 1.7 builds as zipped egg, ruining imports +* [#14606](https://github.com/scipy/scipy/issues/14606): BUG: crash / core dump when calling scipy.stats.beta.ppf with… +* [#14732](https://github.com/scipy/scipy/issues/14732): CI, TST: pre-release failures for scipy/interpolate/tests/test\_rbfinterp.py +* [#14802](https://github.com/scipy/scipy/issues/14802): CI: Azure Main coverage job failure +* [#14829](https://github.com/scipy/scipy/issues/14829): macOS CI failing with `ld: library not found for -lSystem` +* [#14887](https://github.com/scipy/scipy/issues/14887): BUG: scipy.stats.multivariate\_normal.logpdf mutates some inputs + +### [Pull requests for 1.7.2](#id4)[#](#pull-requests-for-1-7-2 "Link to this heading") + +* [#14207](https://github.com/scipy/scipy/pull/14207): DOC: stats: remove ‘Methods’ section from `binomtest` docstring… +* [#14316](https://github.com/scipy/scipy/pull/14316): MAINT: Update `openblas\_support.py` to support Apple Silicon +* [#14323](https://github.com/scipy/scipy/pull/14323): BUG: Speed up sparse compressed indexing with very many rows +* [#14333](https://github.com/scipy/scipy/pull/14333): MAINT: Use /usr/bin/linux32 so that sysconfig.get\_platform()… +* [#14478](https://github.com/scipy/scipy/pull/14478): BUG: geometric\_slerp t ndim guard +* [#14605](https://github.com/scipy/scipy/pull/14605): MAINT: Skip some interpolative decomposition tests +* [#14616](https://github.com/scipy/scipy/pull/14616): REL: update build dependency versions in pyproject.toml for 1.7.2 +* [#14618](https://github.com/scipy/scipy/pull/14618): FIX: raise RuntimeWarning when Boost evaluation\_error is encountered +* [#14672](https://github.com/scipy/scipy/pull/14672): BLD: add `zip\_safe=False` to the `setup()` call +* [#14791](https://github.com/scipy/scipy/pull/14791): MAINT: SciPy 1.7.2 prep/backports +* [#14803](https://github.com/scipy/scipy/pull/14803): MAINT: disable include/source coverage warning. +* [#14813](https://github.com/scipy/scipy/pull/14813): Added missing np.import\_array() +* [#14831](https://github.com/scipy/scipy/pull/14831): CI: Add stdlib to LD\_LIBRARY\_PATH +* [#14893](https://github.com/scipy/scipy/pull/14893): BUG: Fix alignment errors due to relaxed stride checking +* [#14897](https://github.com/scipy/scipy/pull/14897): BUG: avoid mutating inputs in multivariate distributions +* [#14921](https://github.com/scipy/scipy/pull/14921): MAINT: “backport” 3.10 support +* [#14937](https://github.com/scipy/scipy/pull/14937): MAINT: backports for 1.7.2, plus update Pythran min version to… +* [#14938](https://github.com/scipy/scipy/pull/14938): TST: silence test failures on macOS for `beta.ppf` overflow diff --git a/corpus/changelog/scipy_releases/scipy_173.md b/corpus/changelog/scipy_releases/scipy_173.md new file mode 100644 index 0000000000000000000000000000000000000000..e12dc34645e19a85b3ce00284dcb1cecac43c92d --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_173.md @@ -0,0 +1,45 @@ +# SciPy 1.7.3 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.7.3-notes.html +Version: 1.7.3 + +Contents + +* [SciPy 1.7.3 Release Notes](#scipy-1-7-3-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.7.3](#issues-closed-for-1-7-3) + - [Pull requests for 1.7.3](#pull-requests-for-1-7-3) + +SciPy 1.7.3 is a bug-fix release that provides binary wheels +for MacOS arm64 with Python 3.8, 3.9, and 3.10. The MacOS arm64 wheels +are only available for MacOS version 12.0 and greater, as explained +in Issue 14688, linked below. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Anirudh Dagar +* Ralf Gommers +* Tyler Reddy +* Pamphile Roy +* Olivier Grisel +* Isuru Fernando + +A total of 6 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.7.3](#id3)[#](#issues-closed-for-1-7-3 "Link to this heading") + +* [#13364](https://github.com/scipy/scipy/issues/13364): Segmentation fault on import of scipy.integrate on Apple M1 ARM… +* [#14688](https://github.com/scipy/scipy/issues/14688): BUG: ARPACK’s eigsh & OpenBLAS from Apple Silicon M1 (arm64)… +* [#14991](https://github.com/scipy/scipy/issues/14991): four CI failures on pre-release job +* [#15077](https://github.com/scipy/scipy/issues/15077): Remaining test failures for macOS arm64 wheel +* [#15081](https://github.com/scipy/scipy/issues/15081): BUG: Segmentation fault caused by scipy.stats.qmc.qmc.update\_discrepancy + +### [Pull requests for 1.7.3](#id4)[#](#pull-requests-for-1-7-3 "Link to this heading") + +* [#14990](https://github.com/scipy/scipy/pull/14990): BLD: update pyproject.toml for Python 3.10 changes +* [#15086](https://github.com/scipy/scipy/pull/15086): BUG: out of bounds indexing in stats.qmc.update\_discrepancy +* [#15090](https://github.com/scipy/scipy/pull/15090): MAINT: skip a few failing tests in `1.7.x` for macOS arm64 diff --git a/corpus/changelog/scipy_releases/scipy_180.md b/corpus/changelog/scipy_releases/scipy_180.md new file mode 100644 index 0000000000000000000000000000000000000000..30d6fd18ebbaf9b29c4569b0bf3fef7377550dd4 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_180.md @@ -0,0 +1,960 @@ +# SciPy 1.8.0 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.8.0-notes.html +Version: 1.8.0 + +Contents + +* [SciPy 1.8.0 Release Notes](#scipy-1-8-0-release-notes) + + + [Highlights of this release](#highlights-of-this-release) + + [New features](#new-features) + + - [[`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") improvements](#scipy-fft-improvements) + - [[`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") improvements](#scipy-integrate-improvements) + - [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#scipy-interpolate-improvements) + - [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#scipy-linalg-improvements) + - [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#scipy-optimize-improvements) + - [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#scipy-signal-improvements) + - [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#scipy-sparse-improvements) + - [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#scipy-spatial-improvements) + - [[`scipy.special`](../reference/special.html#module-scipy.special "scipy.special") improvements](#scipy-special-improvements) + - [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#scipy-stats-improvements) + + [Deprecated features](#deprecated-features) + + - [Clear split between public and private API](#clear-split-between-public-and-private-api) + - [Other deprecations](#other-deprecations) + + [Backwards incompatible changes](#backwards-incompatible-changes) + + [Other changes](#other-changes) + + [Authors](#authors) + + [Issues closed for 1.8.0](#issues-closed-for-1-8-0) + + [Pull requests for 1.8.0](#pull-requests-for-1-8-0) + +SciPy 1.8.0 is the culmination of 6 months of hard work. It contains +many new features, numerous bug-fixes, improved test coverage and better +documentation. There have been a number of deprecations and API changes +in this release, which are documented below. All users are encouraged to +upgrade to this release, as there are a large number of bug-fixes and +optimizations. Before upgrading, we recommend that users check that +their own code does not use deprecated SciPy functionality (to do so, +run your code with `python -Wd` and check for `DeprecationWarning` s). +Our development attention will now shift to bug-fix releases on the +1.8.x branch, and on adding new features on the master branch. + +This release requires Python 3.8+ and NumPy 1.17.3 or greater. + +For running on PyPy, PyPy3 6.0+ is required. + +## [Highlights of this release](#id4)[#](#highlights-of-this-release "Link to this heading") + +* A sparse array API has been added for early testing and feedback; this + work is ongoing, and users should expect minor API refinements over + the next few releases. +* The sparse SVD library PROPACK is now vendored with SciPy, and an interface + is exposed via *scipy.sparse.svds* with `solver='PROPACK'`. It is currently + default-off due to potential issues on Windows that we aim to + resolve in the next release, but can be optionally enabled at runtime for + friendly testing with an environment variable setting of `USE_PROPACK=1`. +* A new [`scipy.stats.sampling`](../reference/stats.sampling.html#module-scipy.stats.sampling "scipy.stats.sampling") submodule that leverages the `UNU.RAN` C + library to sample from arbitrary univariate non-uniform continuous and + discrete distributions +* All namespaces that were private but happened to miss underscores in + their names have been deprecated. + +## [New features](#id5)[#](#new-features "Link to this heading") + +### [[`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") improvements](#id6)[#](#scipy-fft-improvements "Link to this heading") + +Added an `orthogonalize=None` parameter to the real transforms in [`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") +which controls whether the modified definition of DCT/DST is used without +changing the overall scaling. + +[`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") backend registration is now smoother, operating with a single +registration call and no longer requiring a context manager. + +### [[`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate") improvements](#id7)[#](#scipy-integrate-improvements "Link to this heading") + +[`scipy.integrate.quad_vec`](../reference/generated/scipy.integrate.quad_vec.html#scipy.integrate.quad_vec "scipy.integrate.quad_vec") introduces a new optional keyword-only argument, +`args`. `args` takes in a tuple of extra arguments if any (default is +`args=()`), which is then internally used to pass into the callable function +(needing these extra arguments) which we wish to integrate. + +### [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#id8)[#](#scipy-interpolate-improvements "Link to this heading") + +[`scipy.interpolate.BSpline`](../reference/generated/scipy.interpolate.BSpline.html#scipy.interpolate.BSpline "scipy.interpolate.BSpline") has a new method, `design_matrix`, which +constructs a design matrix of b-splines in the sparse CSR format. + +A new method `from_cubic` in `BSpline` class allows to convert a +`CubicSpline` object to `BSpline` object. + +### [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#id9)[#](#scipy-linalg-improvements "Link to this heading") + +[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") gained three new public array structure investigation functions. +[`scipy.linalg.bandwidth`](../reference/generated/scipy.linalg.bandwidth.html#scipy.linalg.bandwidth "scipy.linalg.bandwidth") returns information about the bandedness of an array +and can be used to test for triangular structure discovery, while +[`scipy.linalg.issymmetric`](../reference/generated/scipy.linalg.issymmetric.html#scipy.linalg.issymmetric "scipy.linalg.issymmetric") and [`scipy.linalg.ishermitian`](../reference/generated/scipy.linalg.ishermitian.html#scipy.linalg.ishermitian "scipy.linalg.ishermitian") test the array for +exact and approximate symmetric/Hermitian structure. + +### [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#id10)[#](#scipy-optimize-improvements "Link to this heading") + +[`scipy.optimize.check_grad`](../reference/generated/scipy.optimize.check_grad.html#scipy.optimize.check_grad "scipy.optimize.check_grad") introduces two new optional keyword only arguments, +`direction` and `seed`. `direction` can take values, `'all'` (default), +in which case all the one hot direction vectors will be used for verifying +the input analytical gradient function and `'random'`, in which case a +random direction vector will be used for the same purpose. `seed` +(default is `None`) can be used for reproducing the return value of +`check_grad` function. It will be used only when `direction='random'`. + +The [`scipy.optimize.minimize`](../reference/generated/scipy.optimize.minimize.html#scipy.optimize.minimize "scipy.optimize.minimize") `TNC` method has been rewritten to use Cython +bindings. This also fixes an issue with the callback altering the state of the +optimization. + +Added optional parameters `target_accept_rate` and `stepwise_factor` for +adapative step size adjustment in `basinhopping`. + +The `epsilon` argument to `approx_fprime` is now optional so that it may +have a default value consistent with most other functions in [`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize"). + +### [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#id11)[#](#scipy-signal-improvements "Link to this heading") + +Add `analog` argument, default `False`, to `zpk2sos`, and add new pairing +option `'minimal'` to construct analog and minimal discrete SOS arrays. +`tf2sos` uses zpk2sos; add `analog` argument here as well, and pass it on +to `zpk2sos`. + +`savgol_coeffs` and `savgol_filter` now work for even window lengths. + +Added the Chirp Z-transform and Zoom FFT available as [`scipy.signal.CZT`](../reference/generated/scipy.signal.CZT.html#scipy.signal.CZT "scipy.signal.CZT") and +[`scipy.signal.ZoomFFT`](../reference/generated/scipy.signal.ZoomFFT.html#scipy.signal.ZoomFFT "scipy.signal.ZoomFFT"). + +### [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#id12)[#](#scipy-sparse-improvements "Link to this heading") + +An array API has been added for early testing and feedback; this +work is ongoing, and users should expect minor API refinements over +the next few releases. Please refer to the [`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") +docstring for more information. + +`maximum_flow` introduces optional keyword only argument, `method` +which accepts either, `'edmonds-karp'` (Edmonds Karp algorithm) or +`'dinic'` (Dinic’s algorithm). Moreover, `'dinic'` is used as default +value for `method` which means that Dinic’s algorithm is used for computing +maximum flow unless specified. See, the comparison between the supported +algorithms in +[this comment](https://github.com/scipy/scipy/pull/14358#issue-684212523). + +Parameters `atol`, `btol` now default to 1e-6 in +[`scipy.sparse.linalg.lsmr`](../reference/generated/scipy.sparse.linalg.lsmr.html#scipy.sparse.linalg.lsmr "scipy.sparse.linalg.lsmr") to match with default values in +[`scipy.sparse.linalg.lsqr`](../reference/generated/scipy.sparse.linalg.lsqr.html#scipy.sparse.linalg.lsqr "scipy.sparse.linalg.lsqr"). + +Add the Transpose-Free Quasi-Minimal Residual algorithm (TFQMR) for general +nonsingular non-Hermitian linear systems in [`scipy.sparse.linalg.tfqmr`](../reference/generated/scipy.sparse.linalg.tfqmr.html#scipy.sparse.linalg.tfqmr "scipy.sparse.linalg.tfqmr"). + +The sparse SVD library PROPACK is now vendored with SciPy, and an interface is +exposed via *scipy.sparse.svds* with `solver='PROPACK'`. For some problems, +this may be faster and/or more accurate than the default, ARPACK. PROPACK +functionality is currently opt-in–you must specify `USE_PROPACK=1` at +runtime to use it due to potential issues on Windows +that we aim to resolve in the next release. + +`sparse.linalg` iterative solvers now have a nonzero initial guess option, +which may be specified as `x0 = 'Mb'`. + +The `trace` method has been added for sparse matrices. + +### [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#id13)[#](#scipy-spatial-improvements "Link to this heading") + +[`scipy.spatial.transform.Rotation`](../reference/generated/scipy.spatial.transform.Rotation.html#scipy.spatial.transform.Rotation "scipy.spatial.transform.Rotation") now supports item assignment and has a new +`concatenate` method. + +Add *scipy.spatial.distance.kulczynski1* in favour of +`scipy.spatial.distance.kulsinski` which will be deprecated in the next +release. + +[`scipy.spatial.distance.minkowski`](../reference/generated/scipy.spatial.distance.minkowski.html#scipy.spatial.distance.minkowski "scipy.spatial.distance.minkowski") now also supports `0 namespace +* [#14477](https://github.com/scipy/scipy/pull/14477): MAINT: Using Tempita file for bspline (signal) +* [#14479](https://github.com/scipy/scipy/pull/14479): Added `Inverse` word in `idstn` and `idctn` docstrings +* [#14487](https://github.com/scipy/scipy/pull/14487): TST: modify flaky test for constrained minimization +* [#14489](https://github.com/scipy/scipy/pull/14489): MAINT: cleanup of some line\_search code +* [#14492](https://github.com/scipy/scipy/pull/14492): CI: make sure Azure job step fails when building a SciPy wheel… +* [#14496](https://github.com/scipy/scipy/pull/14496): MAINT: switch to using spmatrix.toarray instead of .todense +* [#14499](https://github.com/scipy/scipy/pull/14499): DOC: fix toarray/todense docstring +* [#14507](https://github.com/scipy/scipy/pull/14507): CI: Add lint\_diff docs & option to run only on specified files/dirs +* [#14513](https://github.com/scipy/scipy/pull/14513): DOC: added reference and example in jacobi docstring +* [#14520](https://github.com/scipy/scipy/pull/14520): BUG: diffev maxfun can be reached partway through population +* [#14524](https://github.com/scipy/scipy/pull/14524): ENH: Rotation.concatenate +* [#14532](https://github.com/scipy/scipy/pull/14532): ENH: sparse.linalg: The solution is zero when R.H.S. is zero +* [#14538](https://github.com/scipy/scipy/pull/14538): CI: Revert “CI: make sure Azure job step fails when building… +* [#14539](https://github.com/scipy/scipy/pull/14539): DOC: added chebyt and chebyu docstring examples in scipy.special +* [#14546](https://github.com/scipy/scipy/pull/14546): ENH: Orthogonal Latin Hypercube Sampling to QMC +* [#14547](https://github.com/scipy/scipy/pull/14547): ENH: \_\_setitem\_\_ method for Rotation class +* [#14549](https://github.com/scipy/scipy/pull/14549): Small test fixes for pypy + win + mmap +* [#14554](https://github.com/scipy/scipy/pull/14554): ENH: scipy.interpolate.BSpline from\_power\_basis +* [#14555](https://github.com/scipy/scipy/pull/14555): BUG: sparse: fix a DIA.tocsc bug +* [#14556](https://github.com/scipy/scipy/pull/14556): Fix the link to details of the strongly connected components… +* [#14559](https://github.com/scipy/scipy/pull/14559): WIP: TST: add tests for Pythran somersd +* [#14561](https://github.com/scipy/scipy/pull/14561): DOC: added reference and examples in (gen)laguerre docstring… +* [#14564](https://github.com/scipy/scipy/pull/14564): ENH: Add threaded Van Der Corput +* [#14571](https://github.com/scipy/scipy/pull/14571): Fix repeated word in \_mannwhitneyu.py example +* [#14572](https://github.com/scipy/scipy/pull/14572): Set min length of the knot array for BSpline.design\_matrix +* [#14578](https://github.com/scipy/scipy/pull/14578): DOC: added examples in spherical Bessel docstrings +* [#14581](https://github.com/scipy/scipy/pull/14581): MAINT: Refactor `linalg.tests.test\_interpolative::TestInterpolativeDecomposition::test\_id` +* [#14588](https://github.com/scipy/scipy/pull/14588): ENH: Added ``kulczynski1`` to ``scipy.spatial.distance`` +* [#14592](https://github.com/scipy/scipy/pull/14592): DOC: clarify parameters of norminvgauss in scipy.stats +* [#14595](https://github.com/scipy/scipy/pull/14595): Removing unused subroutines in ``scipy/linalg/src/id\_dist/src/prini.f`` +* [#14601](https://github.com/scipy/scipy/pull/14601): Fixed inconsistencies between numpy and scipy interp +* [#14602](https://github.com/scipy/scipy/pull/14602): MAINT: Fix `-Wunused-result` warnings in `sparse/linalg/dsolve` +* [#14603](https://github.com/scipy/scipy/pull/14603): DEV: initialize all submodules in Gitpod Dockerfile +* [#14609](https://github.com/scipy/scipy/pull/14609): MAINT: Fix `-Wmaybe-uninitialized` warnings in `optimize/\_highs` +* [#14610](https://github.com/scipy/scipy/pull/14610): MAINT: Ignored ``scipy/signal/bspline\_util.c`` +* [#14613](https://github.com/scipy/scipy/pull/14613): MAINT: interpolate: Declare type for a Cython indexing variable. +* [#14619](https://github.com/scipy/scipy/pull/14619): ENH: stats.unuran: add Polynomial interpolation based numerical… +* [#14620](https://github.com/scipy/scipy/pull/14620): CI: fix Azure job which uses pre-release wheels + Python 3.7 +* [#14625](https://github.com/scipy/scipy/pull/14625): ENH: optimize min max and median scipy.stats.binned\_statistic +* [#14626](https://github.com/scipy/scipy/pull/14626): MAINT: fix type-narrowing addition in sparse.construct.bmat +* [#14627](https://github.com/scipy/scipy/pull/14627): MAINT: Bumped tolerances to pass ``special.tests`` on Apple… +* [#14628](https://github.com/scipy/scipy/pull/14628): DOC: clarify usage of options param in scipy.optimize.linprog +* [#14629](https://github.com/scipy/scipy/pull/14629): ENH: optimize std in scipy.stats.binned\_statistic +* [#14630](https://github.com/scipy/scipy/pull/14630): DOC: add citation file +* [#14631](https://github.com/scipy/scipy/pull/14631): Fix unuran builds for older compilers +* [#14633](https://github.com/scipy/scipy/pull/14633): BUG: scipy.stats.\_unran: send only strings to include\_dirs +* [#14634](https://github.com/scipy/scipy/pull/14634): DOC: Fix Wikipedia bootstrap link +* [#14635](https://github.com/scipy/scipy/pull/14635): DOC: stats: fix multivariate\_t docs pdf eqn +* [#14637](https://github.com/scipy/scipy/pull/14637): MAINT: copy discrete dist dict +* [#14643](https://github.com/scipy/scipy/pull/14643): MAINT: address gh6019, disp for minimize\_scalar +* [#14644](https://github.com/scipy/scipy/pull/14644): DOC: stats: add UNU.RAN references in the tutorial +* [#14649](https://github.com/scipy/scipy/pull/14649): DOC: clarify SciPy compatibility with Python and NumPy. +* [#14655](https://github.com/scipy/scipy/pull/14655): MAINT: remove support for Python 3.7 (hence NumPy 1.16) +* [#14656](https://github.com/scipy/scipy/pull/14656): MAINT: replacing `assert_` with assert +* [#14658](https://github.com/scipy/scipy/pull/14658): DOC: use conda-forge in Ubuntu quickstart +* [#14660](https://github.com/scipy/scipy/pull/14660): MAINT: refactor “for … in range(len(” statements +* [#14663](https://github.com/scipy/scipy/pull/14663): MAINT: update leftover Python and NumPy version from pyproject.toml +* [#14665](https://github.com/scipy/scipy/pull/14665): BLD: fix confusing “import pip” failure that should be caught +* [#14666](https://github.com/scipy/scipy/pull/14666): MAINT: remove unnecessary seeding and update `check\_random\_state` +* [#14669](https://github.com/scipy/scipy/pull/14669): ENH: Refactor GitHub Issue form templates +* [#14673](https://github.com/scipy/scipy/pull/14673): BLD: fix include order, Python.h before standard headers +* [#14676](https://github.com/scipy/scipy/pull/14676): BUG: Fixes failing benchmark tests optimize\_qap.QuadraticAssignment.track\_score +* [#14677](https://github.com/scipy/scipy/pull/14677): MAINT: github labeler on file paths +* [#14682](https://github.com/scipy/scipy/pull/14682): DOC: Fix typo in mannwhitneyu docstring +* [#14684](https://github.com/scipy/scipy/pull/14684): DOC: optimize: fix sporadic linprog doctest failure +* [#14685](https://github.com/scipy/scipy/pull/14685): MAINT: static typing of entropy +* [#14686](https://github.com/scipy/scipy/pull/14686): BUG: fix issue in lsqr.py introduced in a recent commit +* [#14689](https://github.com/scipy/scipy/pull/14689): MAINT: replace IOError alias with OSError or other appropriate… +* [#14692](https://github.com/scipy/scipy/pull/14692): MAINT: Translation of hyp2f1 for complex numbers into Cython,… +* [#14693](https://github.com/scipy/scipy/pull/14693): DOC: update OptimizeResult notes +* [#14694](https://github.com/scipy/scipy/pull/14694): Simplify PythranBuildExt usage +* [#14695](https://github.com/scipy/scipy/pull/14695): BLD: bump Pythran version to 0.9.12 +* [#14697](https://github.com/scipy/scipy/pull/14697): CI: add `cffi` in the benchmark CI job, and in environment.yml +* [#14699](https://github.com/scipy/scipy/pull/14699): BUG: Fix TypeError in `stats.\_discrete\_distns` +* [#14700](https://github.com/scipy/scipy/pull/14700): DOC: update detailed roadmap +* [#14701](https://github.com/scipy/scipy/pull/14701): ENH:linalg: Add Cythonized get\_array\_bandwidth, issymmetric,… +* [#14706](https://github.com/scipy/scipy/pull/14706): BUG: Fix hyp2f1 to return correct values in regions near exp(±iπ/3). +* [#14707](https://github.com/scipy/scipy/pull/14707): Update constants.py +* [#14708](https://github.com/scipy/scipy/pull/14708): BENCH: shorten svds benchmark that is timing out in CI +* [#14709](https://github.com/scipy/scipy/pull/14709): CI: remove labeler sync +* [#14712](https://github.com/scipy/scipy/pull/14712): MAINT: special: Updates for \_cosine.c. +* [#14720](https://github.com/scipy/scipy/pull/14720): DOC: optimize hess and consistency +* [#14721](https://github.com/scipy/scipy/pull/14721): MAINT: correct PR template link +* [#14723](https://github.com/scipy/scipy/pull/14723): DOC: add note on padding to `stats.binned\_statistic\_2d` docs +* [#14727](https://github.com/scipy/scipy/pull/14727): ENH: sparse.linalg: Add an useful nonzero initial guess option +* [#14729](https://github.com/scipy/scipy/pull/14729): DOC: fix documentation for scipy.optimize.brenth +* [#14737](https://github.com/scipy/scipy/pull/14737): BUG:signal: matching window dtype to input +* [#14739](https://github.com/scipy/scipy/pull/14739): TST: sparse.linalg: Add test case with 2-D Poisson equations +* [#14743](https://github.com/scipy/scipy/pull/14743): TST:sparse.linalg: Use the more convenient “assert\_normclose”… +* [#14748](https://github.com/scipy/scipy/pull/14748): DOC: fix matrix representation in scipy.sparse.csgraph +* [#14751](https://github.com/scipy/scipy/pull/14751): ENH: numpy masked\_arrays in refguide-check +* [#14755](https://github.com/scipy/scipy/pull/14755): BUG: Avoid `solve\_ivp` failure when `ts` is empty +* [#14756](https://github.com/scipy/scipy/pull/14756): MAINT: LinAlgError from public numpy.linalg +* [#14759](https://github.com/scipy/scipy/pull/14759): BLD: change section name in site.cfg.example from ALL to DEFAULT +* [#14760](https://github.com/scipy/scipy/pull/14760): TST: suppress jinja2 deprecation warning +* [#14761](https://github.com/scipy/scipy/pull/14761): CI: remove `pre\_release\_deps\_source\_dist` job from Azure CI… +* [#14762](https://github.com/scipy/scipy/pull/14762): TST: add a seed to the pickling test of RBFInterpolator +* [#14763](https://github.com/scipy/scipy/pull/14763): MAINT: Make solve\_ivp slightly more strict wrt. t\_span. +* [#14772](https://github.com/scipy/scipy/pull/14772): DOC:special: Fix broken links to jburkardt +* [#14787](https://github.com/scipy/scipy/pull/14787): MAINT: Increase tolerance values to avoid test failures +* [#14789](https://github.com/scipy/scipy/pull/14789): MAINT: fix a tiny typo in signal/spectral.py +* [#14790](https://github.com/scipy/scipy/pull/14790): [MRG] BUG: Avoid lobpcg failure when iterations can’t continue +* [#14794](https://github.com/scipy/scipy/pull/14794): Fix typos in bspline docs (and comments) +* [#14796](https://github.com/scipy/scipy/pull/14796): MAINT: Allow F401 and F403 in module init files +* [#14798](https://github.com/scipy/scipy/pull/14798): BUG: correct the test loop in test\_arpack.eval\_evec +* [#14801](https://github.com/scipy/scipy/pull/14801): CI, MAINT: pin Cython for azure pre-rel +* [#14805](https://github.com/scipy/scipy/pull/14805): BUG: optimize: fix max function call validation for minimize… +* [#14808](https://github.com/scipy/scipy/pull/14808): Fix Bug #14807 +* [#14814](https://github.com/scipy/scipy/pull/14814): MAINT:integrate: add upstream quadpack changes +* [#14817](https://github.com/scipy/scipy/pull/14817): ENH: stats: add geometric zscore +* [#14820](https://github.com/scipy/scipy/pull/14820): MAINT: Remove `np.rollaxis` usage with `np.moveaxis` and… +* [#14821](https://github.com/scipy/scipy/pull/14821): DOC: Updated documentation for interp1d +* [#14822](https://github.com/scipy/scipy/pull/14822): Add an array API to scipy.sparse +* [#14832](https://github.com/scipy/scipy/pull/14832): MAINT: py3.10 in more jobs and bump some 3.8 to 3.9 +* [#14833](https://github.com/scipy/scipy/pull/14833): FIX: raise Python OverflowError exception on Boost.Math error +* [#14836](https://github.com/scipy/scipy/pull/14836): Bug fix: dqc25f.f +* [#14837](https://github.com/scipy/scipy/pull/14837): DOC: sparse.linalg: Fixed incorrect comments when the initial… +* [#14838](https://github.com/scipy/scipy/pull/14838): TST: seed a stats test +* [#14841](https://github.com/scipy/scipy/pull/14841): MAINT: Increase tolerances in tests to avoid Nightly CPython3.10… +* [#14844](https://github.com/scipy/scipy/pull/14844): DOC: Add refguide\_check option details to runtests.rst +* [#14845](https://github.com/scipy/scipy/pull/14845): DOC: update a type specifier in a docstring in `radau.py` +* [#14848](https://github.com/scipy/scipy/pull/14848): Typo “copmlex” +* [#14852](https://github.com/scipy/scipy/pull/14852): DOC: Fix documentation bugs in `lstsq` +* [#14860](https://github.com/scipy/scipy/pull/14860): minimize: copy user constraints if parameter is factored out…. +* [#14865](https://github.com/scipy/scipy/pull/14865): BUG: stats: Fix a crash in stats.skew +* [#14868](https://github.com/scipy/scipy/pull/14868): [MRG] BUG: Update lobpcg.py to validate the accuracy and issue… +* [#14871](https://github.com/scipy/scipy/pull/14871): MAINT: removed a pitfall where a built-in name was being shadowed +* [#14872](https://github.com/scipy/scipy/pull/14872): DEP: Deprecate private namespaces in `scipy.linalg` +* [#14878](https://github.com/scipy/scipy/pull/14878): TST: bump rtol for equal\_bounds +* [#14881](https://github.com/scipy/scipy/pull/14881): DEP: Deprecate private namespaces in `scipy.special` +* [#14882](https://github.com/scipy/scipy/pull/14882): BUG: Convert TNC C module to cython +* [#14883](https://github.com/scipy/scipy/pull/14883): DOC:linalg: Clarify driver defaults in eigh +* [#14884](https://github.com/scipy/scipy/pull/14884): BUG: optimize: add missing attributes of `OptimizeResult` for… +* [#14892](https://github.com/scipy/scipy/pull/14892): DOC: Correct docs for Hausdorff distance +* [#14898](https://github.com/scipy/scipy/pull/14898): DEP: Deprecate private namespace in `scipy.stats` +* [#14902](https://github.com/scipy/scipy/pull/14902): MAINT:linalg: Rename func to “bandwidth” +* [#14906](https://github.com/scipy/scipy/pull/14906): DEP: Deprecate private namespace in `scipy.constants` +* [#14913](https://github.com/scipy/scipy/pull/14913): DEP: Deprecate private namespace in `scipy.fftpack` +* [#14916](https://github.com/scipy/scipy/pull/14916): DEP: Deprecate `stats.biasedurn` and make it private +* [#14918](https://github.com/scipy/scipy/pull/14918): DEP: Deprecate private namespaces in ``scipy.interpolate`` +* [#14919](https://github.com/scipy/scipy/pull/14919): DEP: Deprecate private namespaces in `scipy.integrate` +* [#14920](https://github.com/scipy/scipy/pull/14920): Fix for complex Fresnel +* [#14923](https://github.com/scipy/scipy/pull/14923): DEP: Deprecate private namespaces in ``scipy.spatial`` +* [#14924](https://github.com/scipy/scipy/pull/14924): Fix extent for scipy.signal.cwt example +* [#14925](https://github.com/scipy/scipy/pull/14925): MAINT: Ignore build generated files in ``scipy.stats`` +* [#14927](https://github.com/scipy/scipy/pull/14927): DEP: Deprecate private namespaces in `scipy.misc` +* [#14928](https://github.com/scipy/scipy/pull/14928): MAINT: fix runtest.py overriding `$PYTHONPATH`: prepend instead +* [#14934](https://github.com/scipy/scipy/pull/14934): BUG: optimize: add a missing attribute of OptimizeResult in `basinhopping` +* [#14939](https://github.com/scipy/scipy/pull/14939): DEP: Deprecate private namespaces in ``scipy.sparse`` +* [#14941](https://github.com/scipy/scipy/pull/14941): ENH: optimize: add optional parameters of adaptive step size… +* [#14943](https://github.com/scipy/scipy/pull/14943): DOC: clarify mac pytest; add blank line +* [#14944](https://github.com/scipy/scipy/pull/14944): BUG: MultivariateNormalQMC with specific QMCEngine remove unneeded… +* [#14947](https://github.com/scipy/scipy/pull/14947): DOC: adding example to decimate function +* [#14950](https://github.com/scipy/scipy/pull/14950): MAINT: Use matmul binary operator in scipy.sparse.linalg +* [#14954](https://github.com/scipy/scipy/pull/14954): DOC: Add missing params to minres docstring. +* [#14955](https://github.com/scipy/scipy/pull/14955): BUG: stats: fix broadcasting behavior of argsreduce +* [#14960](https://github.com/scipy/scipy/pull/14960): Update links for new site +* [#14961](https://github.com/scipy/scipy/pull/14961): CI: use https protocol for git in CircleCI +* [#14962](https://github.com/scipy/scipy/pull/14962): DEP: Deprecate private namespaces in `scipy.signal` +* [#14963](https://github.com/scipy/scipy/pull/14963): MAINT: `integrate.lsoda` missing in .gitignore +* [#14965](https://github.com/scipy/scipy/pull/14965): DOC: update logo and add favicon. +* [#14966](https://github.com/scipy/scipy/pull/14966): DEP: Deprecate private namespaces in ``scipy.optimize`` +* [#14969](https://github.com/scipy/scipy/pull/14969): CI: Fixes pyparsing version in doc build +* [#14972](https://github.com/scipy/scipy/pull/14972): Don’t put space after directive name. +* [#14979](https://github.com/scipy/scipy/pull/14979): BUG: scipy.sparse.linalg.spsolve: fix memory error caused from… +* [#14988](https://github.com/scipy/scipy/pull/14988): BLD: update pyproject.toml for Python 3.10 +* [#14989](https://github.com/scipy/scipy/pull/14989): ENH: Speed up knot interval lookup for BSpline.design\_matrix +* [#14992](https://github.com/scipy/scipy/pull/14992): Pythranized version of \_matfuncs\_sqrtm +* [#14993](https://github.com/scipy/scipy/pull/14993): MAINT: forward port 1.7.2 relnotes +* [#15004](https://github.com/scipy/scipy/pull/15004): ENH: Make `get\_matfile\_version` and other `io.matlab` objects… +* [#15007](https://github.com/scipy/scipy/pull/15007): DOC: add missing “regularized” to `gammainccinv` documentation +* [#15008](https://github.com/scipy/scipy/pull/15008): MAINT: restore access to deprecated private namespaces +* [#15010](https://github.com/scipy/scipy/pull/15010): TST: remove fragile test which checks if g77 is linked +* [#15013](https://github.com/scipy/scipy/pull/15013): MAINT: Fix use-after-free bug in Py\_FindObjects +* [#15018](https://github.com/scipy/scipy/pull/15018): CI: Work around Sphinx bug +* [#15019](https://github.com/scipy/scipy/pull/15019): Finite Difference Hessian in Scipy Optimize Solvers (Newton-CG) +* [#15020](https://github.com/scipy/scipy/pull/15020): ENH: sparse.linalg: Fixed the issue that the initial guess “x0”… +* [#15022](https://github.com/scipy/scipy/pull/15022): DOC: mitigate newton optimization not converging. +* [#15023](https://github.com/scipy/scipy/pull/15023): CI: Unpin Sphinx +* [#15027](https://github.com/scipy/scipy/pull/15027): DOC: linalg: Fix a small condition doc error +* [#15029](https://github.com/scipy/scipy/pull/15029): DEP: Deprecate private namespaces in `scipy.sparse.linalg` +* [#15034](https://github.com/scipy/scipy/pull/15034): DOC: use numpydoc format for C function in `\_superlumodule.c` +* [#15035](https://github.com/scipy/scipy/pull/15035): MAINT: simplify UNU.RAN api in stats +* [#15037](https://github.com/scipy/scipy/pull/15037): New example for gaussian\_filter +* [#15040](https://github.com/scipy/scipy/pull/15040): MAINT: Add test for public API +* [#15041](https://github.com/scipy/scipy/pull/15041): DOC: Add warning to dct documentation about norm=’ortho’ +* [#15045](https://github.com/scipy/scipy/pull/15045): DOC: update toolchain.rst +* [#15053](https://github.com/scipy/scipy/pull/15053): TST: Add some test skips to get wheel builder CI green again +* [#15054](https://github.com/scipy/scipy/pull/15054): MAINT: Remove wminkowski +* [#15055](https://github.com/scipy/scipy/pull/15055): ENH: allow p>0 for Minkowski distance +* [#15061](https://github.com/scipy/scipy/pull/15061): MAINT:sparse: expm() fix redundant imports +* [#15062](https://github.com/scipy/scipy/pull/15062): MAINT:BLD: Open file in text mode for tempita +* [#15066](https://github.com/scipy/scipy/pull/15066): CI: bump gcc from 4.8 to 6 +* [#15067](https://github.com/scipy/scipy/pull/15067): DOC: Update broken link to SuperLU library. +* [#15078](https://github.com/scipy/scipy/pull/15078): MAINT: update `stats.iqr` for deprecated `np.percentile`… +* [#15083](https://github.com/scipy/scipy/pull/15083): MAINT: stats: separate UNU.RAN functionality to its own submodule +* [#15084](https://github.com/scipy/scipy/pull/15084): MAINT: Include `scipy.io.matlab` in public API +* [#15085](https://github.com/scipy/scipy/pull/15085): ENH: support creation of analog SOS outputs +* [#15087](https://github.com/scipy/scipy/pull/15087): TST: Review ``\_assert\_within\_tol`` positional arguments +* [#15095](https://github.com/scipy/scipy/pull/15095): MAINT: update gitignore to ignore private directories +* [#15099](https://github.com/scipy/scipy/pull/15099): MAINT: ScalarFunction remember best\_x +* [#15100](https://github.com/scipy/scipy/pull/15100): MAINT: Include `stats.contingency` in public API +* [#15102](https://github.com/scipy/scipy/pull/15102): ENH: Add orthogonalize argument to DCT/DST +* [#15105](https://github.com/scipy/scipy/pull/15105): MAINT: Add missing imports in deprecated modules +* [#15107](https://github.com/scipy/scipy/pull/15107): BUG: Update chi\_gen to use scipy.special.gammaln +* [#15109](https://github.com/scipy/scipy/pull/15109): MAINT: remove NaiveRatioUniforms from scipy.stats +* [#15111](https://github.com/scipy/scipy/pull/15111): ENH: Add special.log\_expit and use it in stats.logistic +* [#15112](https://github.com/scipy/scipy/pull/15112): DOC: update ‘Wn’ definition in signal.butter +* [#15114](https://github.com/scipy/scipy/pull/15114): DOC: added Fermi-Dirac distribution by name +* [#15119](https://github.com/scipy/scipy/pull/15119): DOC: fix symlink to `logistic.sf` in `stats.logistic` +* [#15120](https://github.com/scipy/scipy/pull/15120): MAINT: Install `sparse.linalg.\_eigen` tests and fix test failures +* [#15123](https://github.com/scipy/scipy/pull/15123): MAINT: interpolate: move the `sparse` dependency from cython… +* [#15127](https://github.com/scipy/scipy/pull/15127): DOC: update linux build instructions to mention C++ +* [#15134](https://github.com/scipy/scipy/pull/15134): DOC: Improve Lomb-Scargle example +* [#15135](https://github.com/scipy/scipy/pull/15135): ENH: Carlson symmetric elliptic integrals. +* [#15137](https://github.com/scipy/scipy/pull/15137): DOC: special: Add ‘Examples’ to multigammaln and roots\_legendre… +* [#15139](https://github.com/scipy/scipy/pull/15139): Use constrained\_layout in Lomb-Scargle example +* [#15142](https://github.com/scipy/scipy/pull/15142): ENH: stats.sampling: add SROU method +* [#15143](https://github.com/scipy/scipy/pull/15143): MAINT: Remove some unused imports. +* [#15144](https://github.com/scipy/scipy/pull/15144): BUG: Add missing import of ‘errno’ to runtests.py +* [#15157](https://github.com/scipy/scipy/pull/15157): ENH: rebased version of gh-14279 +* [#15159](https://github.com/scipy/scipy/pull/15159): DOC: stats: fix a header in `stats.sampling` tutorial +* [#15161](https://github.com/scipy/scipy/pull/15161): DOC: 1.8.0 relnotes update +* [#15175](https://github.com/scipy/scipy/pull/15175): MAINT: 1.8.0 backports for relnotes and .gitignore +* [#15181](https://github.com/scipy/scipy/pull/15181): BUG: The pytest decorator for conditional skipping is ‘skipif’ +* [#15191](https://github.com/scipy/scipy/pull/15191): MAINT: version bounds before 1.8.0rc1 +* [#15192](https://github.com/scipy/scipy/pull/15192): MAINT: Replace use of `pytest.warns(None)` with `warnings.catch\_warnings` +* [#15194](https://github.com/scipy/scipy/pull/15194): BUG: stats: Fix numerical issues of recipinvgauss +* [#15214](https://github.com/scipy/scipy/pull/15214): TST: sparse.linalg: store only PROPACK test matrices; generate… +* [#15220](https://github.com/scipy/scipy/pull/15220): BUG: sparse.linalg: Fix deprecation warnings. +* [#15225](https://github.com/scipy/scipy/pull/15225): Make 0th power of a sparse array/matrix return the identity with… +* [#15229](https://github.com/scipy/scipy/pull/15229): BUG: minimize should work with a scalar closes #15228 +* [#15232](https://github.com/scipy/scipy/pull/15232): BUG: Add rmul for sparse arrays +* [#15236](https://github.com/scipy/scipy/pull/15236): BLD: update setup.py for Python 3.10 +* [#15248](https://github.com/scipy/scipy/pull/15248): MAINT: 1.8.0rc2 backports +* [#15249](https://github.com/scipy/scipy/pull/15249): FIX: PROPACK MKL compatibility +* [#15253](https://github.com/scipy/scipy/pull/15253): BUG: special: fix `stdtr` and `stdtrit` for infinite df +* [#15256](https://github.com/scipy/scipy/pull/15256): MAINT: use PEP440 vs. distutils +* [#15268](https://github.com/scipy/scipy/pull/15268): CI: pin setuptools to 59.6.0 and Pythran to 0.10.0 for Windows… +* [#15270](https://github.com/scipy/scipy/pull/15270): MAINT: rename `moduleTNC` extension back to `\_moduleTNC` +* [#15271](https://github.com/scipy/scipy/pull/15271): TST: slightly bump test tolerance for a new lobpcg test +* [#15275](https://github.com/scipy/scipy/pull/15275): MAINT: Fix imports in `signal.\_signaltools` +* [#15278](https://github.com/scipy/scipy/pull/15278): MAINT: remove non-default settings (except `shallow`) in `.gitmodules` +* [#15288](https://github.com/scipy/scipy/pull/15288): BLD Respect the –skip-build flag in setup.py +* [#15293](https://github.com/scipy/scipy/pull/15293): BUG: fix Hausdorff int overflow +* [#15301](https://github.com/scipy/scipy/pull/15301): TST: update `sparse.linalg` tests for failures due to tolerances +* [#15318](https://github.com/scipy/scipy/pull/15318): BLD: update pyproject.toml to not pin numpy for aarch64 + PyPy +* [#15322](https://github.com/scipy/scipy/pull/15322): BLD: update minimum Pythran version to 0.10.0 for SciPy 1.8.0 +* [#15323](https://github.com/scipy/scipy/pull/15323): MAINT: filter RuntimeWarnings in stats functions +* [#15328](https://github.com/scipy/scipy/pull/15328): MAINT: interpolate: csr\_matrix -> csr\_array +* [#15331](https://github.com/scipy/scipy/pull/15331): BUG: stats.\_unuran: fix invalid attribute lookups +* [#15332](https://github.com/scipy/scipy/pull/15332): CI: pin numpy to 1.21.5 for the doc build on CircleCI +* [#15334](https://github.com/scipy/scipy/pull/15334): BUG: stats.\_unuran: fix remaining attribute lookup errors +* [#15335](https://github.com/scipy/scipy/pull/15335): CI: pin numpy to 1.21.5 in the Azure refguide check job +* [#15341](https://github.com/scipy/scipy/pull/15341): BUG: `highs-ds` returns memoryviews instead of np.arrays for… +* [#15397](https://github.com/scipy/scipy/pull/15397): BUG: ensured vendored pep440 is imported +* [#15416](https://github.com/scipy/scipy/pull/15416): BUG: Fix PyUFunc for wasm targets +* [#15418](https://github.com/scipy/scipy/pull/15418): MAINT: 1.8.0 rc3 backports round 1 +* [#15421](https://github.com/scipy/scipy/pull/15421): BUG: stats: mode: fix negative axis issue with np.moveaxis instead… +* [#15432](https://github.com/scipy/scipy/pull/15432): MAINT: release branch PROPACK switch (default off) +* [#15515](https://github.com/scipy/scipy/pull/15515): MAINT: fix broken link and remove CI badges diff --git a/corpus/changelog/scipy_releases/scipy_181.md b/corpus/changelog/scipy_releases/scipy_181.md new file mode 100644 index 0000000000000000000000000000000000000000..ff72bdeab405c690fd5a56748f68fba59d0e0664 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_181.md @@ -0,0 +1,80 @@ +# SciPy 1.8.1 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.8.1-notes.html +Version: 1.8.1 + +Contents + +* [SciPy 1.8.1 Release Notes](#scipy-1-8-1-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.8.1](#issues-closed-for-1-8-1) + - [Pull requests for 1.8.1](#pull-requests-for-1-8-1) + +SciPy 1.8.1 is a bug-fix release with no new features +compared to 1.8.0. Notably, usage of Pythran has been +restored for Windows builds/binaries. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Henry Schreiner +* Maximilian Nöthe +* Sebastian Berg (1) +* Sameer Deshmukh (1) + +* Niels Doucet (1) + +* DWesl (4) +* Isuru Fernando (1) +* Ralf Gommers (4) +* Matt Haberland (1) +* Andrew Nelson (1) +* Dimitri Papadopoulos Orfanos (1) + +* Tirth Patel (3) +* Tyler Reddy (46) +* Pamphile Roy (7) +* Niyas Sait (1) + +* 8. Vetinari (2) +* Warren Weckesser (1) + +A total of 17 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.8.1](#id3)[#](#issues-closed-for-1-8-1 "Link to this heading") + +* [#15258](https://github.com/scipy/scipy/issues/15258): BUG: sparse `dot` method should accept scalars +* [#15433](https://github.com/scipy/scipy/issues/15433): BUG: optimize: minimize: `ValueError` when `np.all(lb==ub)` +* [#15539](https://github.com/scipy/scipy/issues/15539): BUG: Questionable macOS wheel contents +* [#15543](https://github.com/scipy/scipy/issues/15543): REL: list contributors using GitHub handles +* [#15552](https://github.com/scipy/scipy/issues/15552): BUG: MacOS universal2 wheels have two gfortran shared libraries,… +* [#15636](https://github.com/scipy/scipy/issues/15636): BUG: DOCS incorrect `source` link on docs +* [#15678](https://github.com/scipy/scipy/issues/15678): BUG: scipy.stats.skew does not work with scipy.stats.bootstrap +* [#16174](https://github.com/scipy/scipy/issues/16174): Failure of `TestCorrelateComplex.test\_rank0` in CI with NumPy… + +### [Pull requests for 1.8.1](#id4)[#](#pull-requests-for-1-8-1 "Link to this heading") + +* [#15167](https://github.com/scipy/scipy/pull/15167): CI: make sure CI stays on VS2019 unless changed explicitly +* [#15306](https://github.com/scipy/scipy/pull/15306): Revert “BLD Respect the –skip-build flag in setup.py” +* [#15504](https://github.com/scipy/scipy/pull/15504): MAINT: np.all(lb == ub) for optimize.minimize +* [#15530](https://github.com/scipy/scipy/pull/15530): REL: prep for SciPy 1.8.1 +* [#15531](https://github.com/scipy/scipy/pull/15531): [BUG] Fix importing scipy.lib.\_pep440 +* [#15558](https://github.com/scipy/scipy/pull/15558): CI: re-enable Pythran in Azure Windows CI jobs +* [#15566](https://github.com/scipy/scipy/pull/15566): BUG: fix error message +* [#15580](https://github.com/scipy/scipy/pull/15580): BUG: Avoid C Preprocessor symbol in \_hypotests\_pythran.py. +* [#15614](https://github.com/scipy/scipy/pull/15614): REL: filter out @ in authors name and add count +* [#15637](https://github.com/scipy/scipy/pull/15637): DOC, MAINT: fix links to wrapped functions and SciPy’s distributions +* [#15669](https://github.com/scipy/scipy/pull/15669): BUG: stats: fix a bug in UNU.RAN error handler +* [#15691](https://github.com/scipy/scipy/pull/15691): MAINT: stats: bootstrap: fix bug with `method=”BCa”` when `statistic`… +* [#15798](https://github.com/scipy/scipy/pull/15798): MAINT,BUG: stats: update to UNU.RAN 1.9.0 +* [#15870](https://github.com/scipy/scipy/pull/15870): TST: signal: Convert a test with ‘assert\_array\_less’ to ‘less… +* [#15910](https://github.com/scipy/scipy/pull/15910): make sure CI stays on VS2019 unless changed explicitly +* [#15926](https://github.com/scipy/scipy/pull/15926): MAINT: 1.8.1 backports/prep +* [#16035](https://github.com/scipy/scipy/pull/16035): BUG: allow scalar input to the `.dot` method of sparse matrices +* [#16041](https://github.com/scipy/scipy/pull/16041): MAINT: add include dir explicitly for PROPACK to build with classic… +* [#16139](https://github.com/scipy/scipy/pull/16139): WIP, BLD, MAINT: git security/version shim +* [#16152](https://github.com/scipy/scipy/pull/16152): TST: Fortify invalid-value warning filters to small changes in… +* [#16155](https://github.com/scipy/scipy/pull/16155): MAINT: correct wrong license of Biasedurn +* [#16158](https://github.com/scipy/scipy/pull/16158): MAINT: better UNU.RAN licensing information +* [#16163](https://github.com/scipy/scipy/pull/16163): MAINT: update UNU.RAN copyright information +* [#16172](https://github.com/scipy/scipy/pull/16172): CI: pin Pip to 22.0.4 to avoid issues with `–no-build-isolation` +* [#16175](https://github.com/scipy/scipy/pull/16175): TST: fix test failure due to changes in numpy scalar behavior. diff --git a/corpus/changelog/scipy_releases/scipy_190.md b/corpus/changelog/scipy_releases/scipy_190.md new file mode 100644 index 0000000000000000000000000000000000000000..cc05f33809f7474aeaa6c11d7a1d903cb8f09148 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_190.md @@ -0,0 +1,1220 @@ +# SciPy 1.9.0 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.9.0-notes.html +Version: 1.9.0 + +Contents + +* [SciPy 1.9.0 Release Notes](#scipy-1-9-0-release-notes) + + + [Highlights of this release](#highlights-of-this-release) + + [New features](#new-features) + + - [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#scipy-interpolate-improvements) + - [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#scipy-linalg-improvements) + - [[`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") improvements](#scipy-fft-improvements) + - [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#scipy-optimize-improvements) + - [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#scipy-signal-improvements) + - [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#scipy-sparse-improvements) + - [[`scipy.sparse.linalg`](../reference/sparse.linalg.html#module-scipy.sparse.linalg "scipy.sparse.linalg") improvements](#scipy-sparse-linalg-improvements) + - [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#scipy-spatial-improvements) + - [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#scipy-stats-improvements) + + [Deprecated features](#deprecated-features) + + [Expired Deprecations](#expired-deprecations) + + [Backwards incompatible changes](#backwards-incompatible-changes) + + [Other changes](#other-changes) + + - [Lazy access to subpackages](#lazy-access-to-subpackages) + - [SciPy switched to Meson as its build system](#scipy-switched-to-meson-as-its-build-system) + + [Authors](#authors) + + [Issues closed for 1.9.0](#issues-closed-for-1-9-0) + + [Pull requests for 1.9.0](#pull-requests-for-1-9-0) + +SciPy 1.9.0 is the culmination of 6 months of hard work. It contains +many new features, numerous bug-fixes, improved test coverage and better +documentation. There have been a number of deprecations and API changes +in this release, which are documented below. All users are encouraged to +upgrade to this release, as there are a large number of bug-fixes and +optimizations. Before upgrading, we recommend that users check that +their own code does not use deprecated SciPy functionality (to do so, +run your code with `python -Wd` and check for `DeprecationWarning` s). +Our development attention will now shift to bug-fix releases on the +1.9.x branch, and on adding new features on the main branch. + +This release requires Python 3.8-3.11 and NumPy 1.18.5 or greater. + +For running on PyPy, PyPy3 6.0+ is required. + +## [Highlights of this release](#id2)[#](#highlights-of-this-release "Link to this heading") + +* We have modernized our build system to use `meson`, substantially improving + our build performance, and providing better build-time configuration and + cross-compilation support, +* Added [`scipy.optimize.milp`](../reference/generated/scipy.optimize.milp.html#scipy.optimize.milp "scipy.optimize.milp"), new function for mixed-integer linear + programming, +* Added [`scipy.stats.fit`](../reference/generated/scipy.stats.fit.html#scipy.stats.fit "scipy.stats.fit") for fitting discrete and continuous distributions + to data, +* Tensor-product spline interpolation modes were added to + [`scipy.interpolate.RegularGridInterpolator`](../reference/generated/scipy.interpolate.RegularGridInterpolator.html#scipy.interpolate.RegularGridInterpolator "scipy.interpolate.RegularGridInterpolator"), +* A new global optimizer (DIviding RECTangles algorithm) + [`scipy.optimize.direct`](../reference/generated/scipy.optimize.direct.html#scipy.optimize.direct "scipy.optimize.direct"). + +## [New features](#id3)[#](#new-features "Link to this heading") + +### [[`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate") improvements](#id4)[#](#scipy-interpolate-improvements "Link to this heading") + +* Speed up the `RBFInterpolator` evaluation with high dimensional + interpolants. +* Added new spline based interpolation methods for + [`scipy.interpolate.RegularGridInterpolator`](../reference/generated/scipy.interpolate.RegularGridInterpolator.html#scipy.interpolate.RegularGridInterpolator "scipy.interpolate.RegularGridInterpolator") and its tutorial. +* [`scipy.interpolate.RegularGridInterpolator`](../reference/generated/scipy.interpolate.RegularGridInterpolator.html#scipy.interpolate.RegularGridInterpolator "scipy.interpolate.RegularGridInterpolator") and [`scipy.interpolate.interpn`](../reference/generated/scipy.interpolate.interpn.html#scipy.interpolate.interpn "scipy.interpolate.interpn") + now accept descending ordered points. +* `RegularGridInterpolator` now handles length-1 grid axes. +* The `BivariateSpline` subclasses have a new method `partial_derivative` + which constructs a new spline object representing a derivative of an + original spline. This mirrors the corresponding functionality for univariate + splines, `splder` and `BSpline.derivative`, and can substantially speed + up repeated evaluation of derivatives. + +### [[`scipy.linalg`](../reference/linalg.html#module-scipy.linalg "scipy.linalg") improvements](#id5)[#](#scipy-linalg-improvements "Link to this heading") + +* [`scipy.linalg.expm`](../reference/generated/scipy.linalg.expm.html#scipy.linalg.expm "scipy.linalg.expm") now accepts nD arrays. Its speed is also improved. +* Minimum required LAPACK version is bumped to `3.7.1`. + +### [[`scipy.fft`](../reference/fft.html#module-scipy.fft "scipy.fft") improvements](#id6)[#](#scipy-fft-improvements "Link to this heading") + +* Added `uarray` multimethods for [`scipy.fft.fht`](../reference/generated/scipy.fft.fht.html#scipy.fft.fht "scipy.fft.fht") and [`scipy.fft.ifht`](../reference/generated/scipy.fft.ifht.html#scipy.fft.ifht "scipy.fft.ifht") + to allow provision of third party backend implementations such as those + recently added to CuPy. + +### [[`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize") improvements](#id7)[#](#scipy-optimize-improvements "Link to this heading") + +* A new global optimizer, [`scipy.optimize.direct`](../reference/generated/scipy.optimize.direct.html#scipy.optimize.direct "scipy.optimize.direct") (DIviding RECTangles algorithm) + was added. For problems with inexpensive function evaluations, like the ones + in the SciPy benchmark suite, `direct` is competitive with the best other + solvers in SciPy (`dual_annealing` and `differential_evolution`) in terms + of execution time. See + [gh-14300](https://github.com/scipy/scipy/pull/14300) for more details. +* Add a `full_output` parameter to [`scipy.optimize.curve_fit`](../reference/generated/scipy.optimize.curve_fit.html#scipy.optimize.curve_fit "scipy.optimize.curve_fit") to output + additional solution information. +* Add a `integrality` parameter to [`scipy.optimize.differential_evolution`](../reference/generated/scipy.optimize.differential_evolution.html#scipy.optimize.differential_evolution "scipy.optimize.differential_evolution"), + enabling integer constraints on parameters. +* Add a `vectorized` parameter to call a vectorized objective function only + once per iteration. This can improve minimization speed by reducing + interpreter overhead from the multiple objective function calls. +* The default method of [`scipy.optimize.linprog`](../reference/generated/scipy.optimize.linprog.html#scipy.optimize.linprog "scipy.optimize.linprog") is now `'highs'`. +* Added [`scipy.optimize.milp`](../reference/generated/scipy.optimize.milp.html#scipy.optimize.milp "scipy.optimize.milp"), new function for mixed-integer linear + programming. +* Added Newton-TFQMR method to `newton_krylov`. +* Added support for the `Bounds` class in `shgo` and `dual_annealing` for + a more uniform API across [`scipy.optimize`](../reference/optimize.html#module-scipy.optimize "scipy.optimize"). +* Added the `vectorized` keyword to `differential_evolution`. +* `approx_fprime` now works with vector-valued functions. + +### [[`scipy.signal`](../reference/signal.html#module-scipy.signal "scipy.signal") improvements](#id8)[#](#scipy-signal-improvements "Link to this heading") + +* The new window function [`scipy.signal.windows.kaiser_bessel_derived`](../reference/generated/scipy.signal.windows.kaiser_bessel_derived.html#scipy.signal.windows.kaiser_bessel_derived "scipy.signal.windows.kaiser_bessel_derived") was + added to compute the Kaiser-Bessel derived window. +* Single-precision `hilbert` operations are now faster as a result of more + consistent `dtype` handling. + +### [[`scipy.sparse`](../reference/sparse.html#module-scipy.sparse "scipy.sparse") improvements](#id9)[#](#scipy-sparse-improvements "Link to this heading") + +* Add a `copy` parameter to [`scipy.sparse.csgraph.laplacian`](../reference/generated/scipy.sparse.csgraph.laplacian.html#scipy.sparse.csgraph.laplacian "scipy.sparse.csgraph.laplacian"). Using inplace + computation with `copy=False` reduces the memory footprint. +* Add a `dtype` parameter to [`scipy.sparse.csgraph.laplacian`](../reference/generated/scipy.sparse.csgraph.laplacian.html#scipy.sparse.csgraph.laplacian "scipy.sparse.csgraph.laplacian") for type casting. +* Add a `symmetrized` parameter to [`scipy.sparse.csgraph.laplacian`](../reference/generated/scipy.sparse.csgraph.laplacian.html#scipy.sparse.csgraph.laplacian "scipy.sparse.csgraph.laplacian") to produce + symmetric Laplacian for directed graphs. +* Add a `form` parameter to [`scipy.sparse.csgraph.laplacian`](../reference/generated/scipy.sparse.csgraph.laplacian.html#scipy.sparse.csgraph.laplacian "scipy.sparse.csgraph.laplacian") taking one of the + three values: `array`, or `function`, or `lo` determining the format of + the output Laplacian: + \* `array` is a numpy array (backward compatible default); + \* `function` is a pointer to a lambda-function evaluating the + Laplacian-vector or Laplacian-matrix product; + \* `lo` results in the format of the `LinearOperator`. + +### [[`scipy.sparse.linalg`](../reference/sparse.linalg.html#module-scipy.sparse.linalg "scipy.sparse.linalg") improvements](#id10)[#](#scipy-sparse-linalg-improvements "Link to this heading") + +* `lobpcg` performance improvements for small input cases. + +### [[`scipy.spatial`](../reference/spatial.html#module-scipy.spatial "scipy.spatial") improvements](#id11)[#](#scipy-spatial-improvements "Link to this heading") + +* Add an `order` parameter to [`scipy.spatial.transform.Rotation.from_quat`](../reference/generated/scipy.spatial.transform.Rotation.from_quat.html#scipy.spatial.transform.Rotation.from_quat "scipy.spatial.transform.Rotation.from_quat") + and [`scipy.spatial.transform.Rotation.as_quat`](../reference/generated/scipy.spatial.transform.Rotation.as_quat.html#scipy.spatial.transform.Rotation.as_quat "scipy.spatial.transform.Rotation.as_quat") to specify quaternion format. + +### [[`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") improvements](#id12)[#](#scipy-stats-improvements "Link to this heading") + +* [`scipy.stats.monte_carlo_test`](../reference/generated/scipy.stats.monte_carlo_test.html#scipy.stats.monte_carlo_test "scipy.stats.monte_carlo_test") performs one-sample Monte Carlo hypothesis + tests to assess whether a sample was drawn from a given distribution. Besides + reproducing the results of hypothesis tests like [`scipy.stats.ks_1samp`](../reference/generated/scipy.stats.ks_1samp.html#scipy.stats.ks_1samp "scipy.stats.ks_1samp"), + [`scipy.stats.normaltest`](../reference/generated/scipy.stats.normaltest.html#scipy.stats.normaltest "scipy.stats.normaltest"), and [`scipy.stats.cramervonmises`](../reference/generated/scipy.stats.cramervonmises.html#scipy.stats.cramervonmises "scipy.stats.cramervonmises") without small sample + size limitations, it makes it possible to perform similar tests using arbitrary + statistics and distributions. +* Several [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") functions support new `axis` (integer or tuple of + integers) and `nan_policy` (‘raise’, ‘omit’, or ‘propagate’), and + `keepdims` arguments. + These functions also support masked arrays as inputs, even if they do not have + a [`scipy.stats.mstats`](../reference/stats.mstats.html#module-scipy.stats.mstats "scipy.stats.mstats") counterpart. Edge cases for multidimensional arrays, + such as when axis-slices have no unmasked elements or entire inputs are of + size zero, are handled consistently. +* Add a `weights` parameter to [`scipy.stats.hmean`](../reference/generated/scipy.stats.hmean.html#scipy.stats.hmean "scipy.stats.hmean"). +* Several improvements have been made to [`scipy.stats.levy_stable`](../reference/generated/scipy.stats.levy_stable.html#scipy.stats.levy_stable "scipy.stats.levy_stable"). Substantial + improvement has been made for numerical evaluation of the pdf and cdf, + resolving [#12658]([scipy/scipy#12658](https://github.com/scipy/scipy/issues/12658)) and + [#14944]([scipy/scipy#14994](https://github.com/scipy/scipy/issues/14994)). The improvement is + particularly dramatic for stability parameter `alpha` close to or equal to 1 + and for `alpha` below but approaching its maximum value of 2. The alternative + fast Fourier transform based method for pdf calculation has also been updated + to use the approach of Wang and Zhang from their 2008 conference paper + *Simpson’s rule based FFT method to compute densities of stable distribution*, + making this method more competitive with the default method. In addition, + users now have the option to change the parametrization of the Levy Stable + distribution to Nolan’s “S0” parametrization which is used internally by + SciPy’s pdf and cdf implementations. The “S0” parametrization is described in + Nolan’s paper [*Numerical calculation of stable densities and distribution + functions*]() upon which SciPy’s + implementation is based. “S0” has the advantage that `delta` and `gamma` + are proper location and scale parameters. With `delta` and `gamma` fixed, + the location and scale of the resulting distribution remain unchanged as + `alpha` and `beta` change. This is not the case for the default “S1” + parametrization. Finally, more options have been exposed to allow users to + trade off between runtime and accuracy for both the default and FFT methods of + pdf and cdf calculation. More information can be found in the documentation + here (to be linked). +* Added [`scipy.stats.fit`](../reference/generated/scipy.stats.fit.html#scipy.stats.fit "scipy.stats.fit") for fitting discrete and continuous distributions to + data. +* The methods `"pearson"` and `"tippet"` from [`scipy.stats.combine_pvalues`](../reference/generated/scipy.stats.combine_pvalues.html#scipy.stats.combine_pvalues "scipy.stats.combine_pvalues") + have been fixed to return the correct p-values, resolving + [#15373]([scipy/scipy#15373](https://github.com/scipy/scipy/issues/15373)). In addition, the + documentation for [`scipy.stats.combine_pvalues`](../reference/generated/scipy.stats.combine_pvalues.html#scipy.stats.combine_pvalues "scipy.stats.combine_pvalues") has been expanded and improved. +* Unlike other reduction functions, `stats.mode` didn’t consume the axis + being operated on and failed for negative axis inputs. Both the bugs have been + fixed. Note that `stats.mode` will now consume the input axis and return an + ndarray with the `axis` dimension removed. +* Replaced implementation of [`scipy.stats.ncf`](../reference/generated/scipy.stats.ncf.html#scipy.stats.ncf "scipy.stats.ncf") with the implementation from + Boost for improved reliability. +* Add a *bits* parameter to [`scipy.stats.qmc.Sobol`](../reference/generated/scipy.stats.qmc.Sobol.html#scipy.stats.qmc.Sobol "scipy.stats.qmc.Sobol"). It allows to use from 0 + to 64 bits to compute the sequence. Default is `None` which corresponds to + 30 for backward compatibility. Using a higher value allow to sample more + points. Note: `bits` does not affect the output dtype. +* Add a *integers* method to [`scipy.stats.qmc.QMCEngine`](../reference/generated/scipy.stats.qmc.QMCEngine.html#scipy.stats.qmc.QMCEngine "scipy.stats.qmc.QMCEngine"). It allows sampling + integers using any QMC sampler. +* Improved the fit speed and accuracy of `stats.pareto`. +* Added `qrvs` method to `NumericalInversePolynomial` to match the + situation for `NumericalInverseHermite`. +* Faster random variate generation for `gennorm` and `nakagami`. +* `lloyd_centroidal_voronoi_tessellation` has been added to allow improved + sample distributions via iterative application of Voronoi diagrams and + centering operations +* Add [`scipy.stats.qmc.PoissonDisk`](../reference/generated/scipy.stats.qmc.PoissonDisk.html#scipy.stats.qmc.PoissonDisk "scipy.stats.qmc.PoissonDisk") to sample using the Poisson disk sampling + method. It guarantees that samples are separated from each other by a + given `radius`. +* Add [`scipy.stats.pmean`](../reference/generated/scipy.stats.pmean.html#scipy.stats.pmean "scipy.stats.pmean") to calculate the weighted power mean also called + generalized mean. + +## [Deprecated features](#id13)[#](#deprecated-features "Link to this heading") + +* Due to collision with the shape parameter `n` of several distributions, + use of the distribution `moment` method with keyword argument `n` is + deprecated. Keyword `n` is replaced with keyword `order`. +* Similarly, use of the distribution `interval` method with keyword arguments + `alpha` is deprecated. Keyword `alpha` is replaced with keyword + `confidence`. +* The `'simplex'`, `'revised simplex'`, and `'interior-point'` methods + of [`scipy.optimize.linprog`](../reference/generated/scipy.optimize.linprog.html#scipy.optimize.linprog "scipy.optimize.linprog") are deprecated. Methods `highs`, `highs-ds`, + or `highs-ipm` should be used in new code. +* Support for non-numeric arrays has been deprecated from `stats.mode`. + `pandas.DataFrame.mode` can be used instead. +* The function *spatial.distance.kulsinski* has been deprecated in favor + of *spatial.distance.kulczynski1*. +* The `maxiter` keyword of the truncated Newton (TNC) algorithm has been + deprecated in favour of `maxfun`. +* The `vertices` keyword of `Delauney.qhull` now raises a + DeprecationWarning, after having been deprecated in documentation only + for a long time. +* The `extradoc` keyword of `rv_continuous`, `rv_discrete` and + `rv_sample` now raises a DeprecationWarning, after having been deprecated in + documentation only for a long time. + +## [Expired Deprecations](#id14)[#](#expired-deprecations "Link to this heading") + +There is an ongoing effort to follow through on long-standing deprecations. +The following previously deprecated features are affected: + +* Object arrays in sparse matrices now raise an error. +* Inexact indices into sparse matrices now raise an error. +* Passing `radius=None` to [`scipy.spatial.SphericalVoronoi`](../reference/generated/scipy.spatial.SphericalVoronoi.html#scipy.spatial.SphericalVoronoi "scipy.spatial.SphericalVoronoi") now raises an + error (not adding `radius` defaults to 1, as before). +* Several BSpline methods now raise an error if inputs have `ndim > 1`. +* The `_rvs` method of statistical distributions now requires a `size` + parameter. +* Passing a `fillvalue` that cannot be cast to the output type in + [`scipy.signal.convolve2d`](../reference/generated/scipy.signal.convolve2d.html#scipy.signal.convolve2d "scipy.signal.convolve2d") now raises an error. +* [`scipy.spatial.distance`](../reference/spatial.distance.html#module-scipy.spatial.distance "scipy.spatial.distance") now enforces that the input vectors are + one-dimensional. +* Removed `stats.itemfreq`. +* Removed `stats.median_absolute_deviation`. +* Removed `n_jobs` keyword argument and use of `k=None` from + `kdtree.query`. +* Removed `right` keyword from `interpolate.PPoly.extend`. +* Removed `debug` keyword from `scipy.linalg.solve_*`. +* Removed class `_ppform` `scipy.interpolate`. +* Removed BSR methods `matvec` and `matmat`. +* Removed `mlab` truncation mode from `cluster.dendrogram`. +* Removed `cluster.vq.py_vq2`. +* Removed keyword arguments `ftol` and `xtol` from + `optimize.minimize(method='Nelder-Mead')`. +* Removed `signal.windows.hanning`. +* Removed LAPACK `gegv` functions from `linalg`; this raises the minimally + required LAPACK version to 3.7.1. +* Removed `spatial.distance.matching`. +* Removed the alias `scipy.random` for `numpy.random`. +* Removed docstring related functions from `scipy.misc` (`docformat`, + `inherit_docstring_from`, `extend_notes_in_docstring`, + `replace_notes_in_docstring`, `indentcount_lines`, `filldoc`, + `unindent_dict`, `unindent_string`). +* Removed `linalg.pinv2`. + +## [Backwards incompatible changes](#id15)[#](#backwards-incompatible-changes "Link to this heading") + +* Several [`scipy.stats`](../reference/stats.html#module-scipy.stats "scipy.stats") functions now convert `np.matrix` to ``` np.ndarray``s + before the calculation is performed. In this case, the output will be a scalar + or ``np.ndarray ``` of appropriate shape rather than a 2D `np.matrix`. + Similarly, while masked elements of masked arrays are still ignored, the + output will be a scalar or `np.ndarray` rather than a masked array with + `mask=False`. +* The default method of [`scipy.optimize.linprog`](../reference/generated/scipy.optimize.linprog.html#scipy.optimize.linprog "scipy.optimize.linprog") is now `'highs'`, not + `'interior-point'` (which is now deprecated), so callback functions and + some options are no longer supported with the default method. With the + default method, the `x` attribute of the returned `OptimizeResult` is + now `None` (instead of a non-optimal array) when an optimal solution + cannot be found (e.g. infeasible problem). +* For [`scipy.stats.combine_pvalues`](../reference/generated/scipy.stats.combine_pvalues.html#scipy.stats.combine_pvalues "scipy.stats.combine_pvalues"), the sign of the test statistic returned + for the method `"pearson"` has been flipped so that higher values of the + statistic now correspond to lower p-values, making the statistic more + consistent with those of the other methods and with the majority of the + literature. +* [`scipy.linalg.expm`](../reference/generated/scipy.linalg.expm.html#scipy.linalg.expm "scipy.linalg.expm") due to historical reasons was using the sparse + implementation and thus was accepting sparse arrays. Now it only works with + nDarrays. For sparse usage, [`scipy.sparse.linalg.expm`](../reference/generated/scipy.sparse.linalg.expm.html#scipy.sparse.linalg.expm "scipy.sparse.linalg.expm") needs to be used + explicitly. +* The definition of [`scipy.stats.circvar`](../reference/generated/scipy.stats.circvar.html#scipy.stats.circvar "scipy.stats.circvar") has reverted to the one that is + standard in the literature; note that this is not the same as the square of + [`scipy.stats.circstd`](../reference/generated/scipy.stats.circstd.html#scipy.stats.circstd "scipy.stats.circstd"). +* Remove inheritance to *QMCEngine* in *MultinomialQMC* and + *MultivariateNormalQMC*. It removes the methods *fast\_forward* and *reset*. +* Init of *MultinomialQMC* now require the number of trials with *n\_trials*. + Hence, *MultinomialQMC.random* output has now the correct shape `(n, pvals)`. +* Several function-specific warnings (`F_onewayConstantInputWarning`, + `F_onewayBadInputSizesWarning`, `PearsonRConstantInputWarning`, + `PearsonRNearConstantInputWarning`, `SpearmanRConstantInputWarning`, and + `BootstrapDegenerateDistributionWarning`) have been replaced with more + general warnings. + +## [Other changes](#id16)[#](#other-changes "Link to this heading") + +* A draft developer CLI is available for SciPy, leveraging the `doit`, + `click` and `rich-click` tools. For more details, see + [gh-15959]([scipy/scipy#15959](https://github.com/scipy/scipy/pull/15959)). +* The SciPy contributor guide has been reorganized and updated + (see [#15947]([scipy/scipy#15947](https://github.com/scipy/scipy/pull/15947)) for details). +* QUADPACK Fortran routines in [`scipy.integrate`](../reference/integrate.html#module-scipy.integrate "scipy.integrate"), which power + [`scipy.integrate.quad`](../reference/generated/scipy.integrate.quad.html#scipy.integrate.quad "scipy.integrate.quad"), have been marked as *recursive*. This should fix rare + issues in multivariate integration (*nquad* and friends) and obviate the need + for compiler-specific compile flags (*/recursive* for ifort etc). Please file + an issue if this change turns out problematic for you. This is also true for + `FITPACK` routines in [`scipy.interpolate`](../reference/interpolate.html#module-scipy.interpolate "scipy.interpolate"), which power `splrep`, + `splev` etc., and `*UnivariateSpline` and `*BivariateSpline` classes. +* the `USE_PROPACK` environment variable has been renamed to + `SCIPY_USE_PROPACK`; setting to a non-zero value will enable + the usage of the `PROPACK` library as before +* Building SciPy on windows with MSVC now requires at least the vc142 + toolset (available in Visual Studio 2019 and higher). + +### [Lazy access to subpackages](#id17)[#](#lazy-access-to-subpackages "Link to this heading") + +Before this release, all subpackages of SciPy (*cluster*, *fft*, *ndimage*, +etc.) had to be explicitly imported. Now, these subpackages are lazily loaded +as soon as they are accessed, so that the following is possible (if desired +for interactive use, it’s not actually recommended for code, +see [SciPy API](../reference/index.html#scipy-api)): +`import scipy as sp; sp.fft.dct([1, 2, 3])`. Advantages include: making it +easier to navigate SciPy in interactive terminals, reducing subpackage import +conflicts (which before required +`import networkx.linalg as nla; import scipy.linalg as sla`), +and avoiding repeatedly having to update imports during teaching & +experimentation. Also see +[the related community specification document](). + +### [SciPy switched to Meson as its build system](#id18)[#](#scipy-switched-to-meson-as-its-build-system "Link to this heading") + +This is the first release that ships with [Meson]() as +the build system. When installing with `pip` or `pypa/build`, Meson will be +used (invoked via the `meson-python` build hook). This change brings +significant benefits - most importantly much faster build times, but also +better support for cross-compilation and cleaner build logs. + +Note + +This release still ships with support for `numpy.distutils`-based builds +as well. Those can be invoked through the `setup.py` command-line +interface (e.g., `python setup.py install`). It is planned to remove +`numpy.distutils` support before the 1.10.0 release. + +When building from source, a number of things have changed compared to building +with `numpy.distutils`: + +* New build dependencies: `meson`, `ninja`, and `pkg-config`. + `setuptools` and `wheel` are no longer needed. +* BLAS and LAPACK libraries that are supported haven’t changed, however the + discovery mechanism has: that is now using `pkg-config` instead of hardcoded + paths or a `site.cfg` file. +* The build defaults to using OpenBLAS. See [Selecting BLAS and LAPACK libraries](../building/blas_lapack.html#blas-lapack-selection) for + details. + +The two CLIs that can be used to build wheels are `pip` and `build`. In +addition, the SciPy repo contains a `python dev.py` CLI for any kind of +development task (see its `--help` for details). For a comparison between old +(`distutils`) and new (`meson`) build commands, see [Meson and distutils ways of doing things](../building/distutils_equivalents.html#distutils-meson-equivalents). + +For more information on the introduction of Meson support in SciPy, see +[gh-13615](https://github.com/scipy/scipy/issues/13615) and +[this blog post](https://labs.quansight.org/blog/2021/07/moving-scipy-to-meson/). + +## [Authors](#id19)[#](#authors "Link to this heading") + +* endolith (12) +* h-vetinari (11) +* Caio Agiani (2) + +* Emmy Albert (1) + +* Joseph Albert (1) +* Tania Allard (3) +* Carsten Allefeld (1) + +* Kartik Anand (1) + +* Virgile Andreani (2) + +* Weh Andreas (1) + +* Francesco Andreuzzi (5) + +* Kian-Meng Ang (2) + +* Gerrit Ansmann (1) +* Ar-Kareem (1) + +* Shehan Atukorala (1) + +* avishai231 (1) + +* Blair Azzopardi (1) +* Sayantika Banik (2) + +* Ross Barnowski (9) +* Christoph Baumgarten (3) +* Nickolai Belakovski (1) +* Peter Bell (9) +* Sebastian Berg (3) +* Bharath (1) + +* bobcatCA (2) + +* boussoffara (2) + +* Islem BOUZENIA (1) + +* Jake Bowhay (41) + +* Matthew Brett (11) +* Dietrich Brunn (2) + +* Michael Burkhart (2) + +* Evgeni Burovski (96) +* Matthias Bussonnier (20) +* Dominic C (1) +* Cameron (1) + +* CJ Carey (3) +* Thomas A Caswell (2) +* Ali Cetin (2) + +* Hood Chatham (5) + +* Klesk Chonkin (1) +* Craig Citro (1) + +* Dan Cogswell (1) + +* Luigi Cruz (1) + +* Anirudh Dagar (5) +* Brandon David (1) +* deepakdinesh1123 (1) + +* Denton DeLoss (1) + +* derbuihan (2) + +* Sameer Deshmukh (13) + +* Niels Doucet (1) + +* DWesl (8) +* eytanadler (30) + +* Thomas J. Fan (5) +* Isuru Fernando (3) +* Joseph Fox-Rabinovitz (1) +* Ryan Gibson (4) + +* Ralf Gommers (327) +* Srinivas Gorur-Shandilya (1) + +* Alex Griffing (2) +* Matt Haberland (461) +* Tristan Hearn (1) + +* Jonathan Helgert (1) + +* Samuel Hinton (1) + +* Jake (1) + +* Stewart Jamieson (1) + +* Jan-Hendrik Müller (1) +* Yikun Jiang (1) + +* JuliaMelle01 (1) + +* jyuv (12) + +* Toshiki Kataoka (1) +* Chris Keefe (1) + +* Robert Kern (4) +* Andrew Knyazev (11) +* Matthias Koeppe (4) + +* Sergey Koposov (1) +* Volodymyr Kozachynskyi (1) + +* Yotaro Kubo (2) + +* Jacob Lapenna (1) + +* Peter Mahler Larsen (8) +* Eric Larson (4) +* Laurynas Mikšys (1) + +* Antony Lee (1) +* Gregory R. Lee (2) +* lerichi (1) + +* Tim Leslie (2) +* 16. 12. Lim (1) +* Smit Lunagariya (43) +* lutefiskhotdish (1) + +* Cong Ma (12) +* Syrtis Major (1) +* Nicholas McKibben (18) +* Melissa Weber Mendonça (10) +* Mark Mikofski (1) +* Jarrod Millman (13) +* Harsh Mishra (6) +* ML-Nielsen (3) + +* Matthew Murray (1) + +* Andrew Nelson (50) +* Dimitri Papadopoulos Orfanos (1) + +* Evgueni Ovtchinnikov (2) + +* Sambit Panda (1) +* Nick Papior (2) +* Tirth Patel (43) +* Petar Mlinarić (1) +* petroselo (1) + +* Ilhan Polat (64) +* Anthony Polloreno (1) +* Amit Portnoy (1) + +* Quentin Barthélemy (9) +* Patrick N. Raanes (1) + +* Tyler Reddy (185) +* Pamphile Roy (199) +* Vivek Roy (2) + +* sabonerune (1) + +* Niyas Sait (2) + +* Atsushi Sakai (25) +* Mazen Sayed (1) + +* Eduardo Schettino (5) + +* Daniel Schmitz (6) + +* Eli Schwartz (4) + +* SELEE (2) + +* Namami Shanker (4) +* siddhantwahal (1) + +* Gagandeep Singh (8) +* Soph (1) + +* Shivnaren Srinivasan (1) + +* Scott Staniewicz (1) + +* Leo C. Stein (4) +* Albert Steppi (7) +* Christopher Strickland (1) + +* Kai Striega (4) +* Søren Fuglede Jørgensen (1) +* Aleksandr Tagilov (1) + +* Masayuki Takagi (1) + +* Sai Teja (1) + +* Ewout ter Hoeven (2) + +* Will Tirone (2) +* Bas van Beek (7) +* Dhruv Vats (1) +* Arthur Volant (1) +* Samuel Wallan (5) +* Stefan van der Walt (8) +* Warren Weckesser (84) +* Anreas Weh (1) +* Nils Werner (1) +* Aviv Yaish (1) + +* Dowon Yi (1) +* Rory Yorke (1) +* Yosshi999 (1) + +* yuanx749 (2) + +* Gang Zhao (23) +* ZhihuiChen0903 (1) +* Pavel Zun (1) + +* David Zwicker (1) + + +A total of 154 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +## [Issues closed for 1.9.0](#id20)[#](#issues-closed-for-1-9-0 "Link to this heading") + +* [#1884](https://github.com/scipy/scipy/issues/1884): stats distributions fit problems (Trac #1359) +* [#2047](https://github.com/scipy/scipy/issues/2047): derivatives() method is missing in BivariateSpline (Trac #1522) +* [#2071](https://github.com/scipy/scipy/issues/2071): TST: stats: `check\_sample\_var` should be two-sided (Trac #1546) +* [#2414](https://github.com/scipy/scipy/issues/2414): stats binom at non-integer n (Trac #1895) +* [#2623](https://github.com/scipy/scipy/issues/2623): stats.distributions statistical power of test suite +* [#2625](https://github.com/scipy/scipy/issues/2625): wilcoxon() function does not return z-statistic +* [#2650](https://github.com/scipy/scipy/issues/2650): (2D) Interpolation functions should work with complex numbers +* [#2834](https://github.com/scipy/scipy/issues/2834): ksone fitting +* [#2868](https://github.com/scipy/scipy/issues/2868): nan and stats.percentileofscore +* [#2877](https://github.com/scipy/scipy/issues/2877): distributions.ncf numerical issues +* [#2993](https://github.com/scipy/scipy/issues/2993): optimize.approx\_fprime & jacobians +* [#3214](https://github.com/scipy/scipy/issues/3214): stats distributions ppf-cdf roundtrip +* [#3758](https://github.com/scipy/scipy/issues/3758): discrete distribution defined by `values` with non-integer… +* [#4130](https://github.com/scipy/scipy/issues/4130): BUG: stats: fisher\_exact returns incorrect p-value +* [#4897](https://github.com/scipy/scipy/issues/4897): expm is 10x as slow as matlab according to +* [#5103](https://github.com/scipy/scipy/issues/5103): Docs suggest scipy.sparse.linalg.expm\_multiply supports LinearOperator… +* [#5266](https://github.com/scipy/scipy/issues/5266): Deprecated routines in Netlib LAPACK >3.5.0 +* [#5890](https://github.com/scipy/scipy/issues/5890): Undefined behavior when using scipy.interpolate.RegularGridInterpolator… +* [#5982](https://github.com/scipy/scipy/issues/5982): Keyword collision in scipy.stats.levy\_stable.interval +* [#6472](https://github.com/scipy/scipy/issues/6472): scipy.stats.invwishart does not check if scale matrix is symmetric +* [#6551](https://github.com/scipy/scipy/issues/6551): BUG: stats: inconsistency in docs and behavior of gmean and hmean +* [#6624](https://github.com/scipy/scipy/issues/6624): incorrect handling of nan by RegularGridInterpolator +* [#6882](https://github.com/scipy/scipy/issues/6882): Certain recursive scipy.integrate.quad (e.g. dblquad and nquad)… +* [#7469](https://github.com/scipy/scipy/issues/7469): Misleading interp2d documentation +* [#7560](https://github.com/scipy/scipy/issues/7560): Should RegularGridInterpolator support length 1 dimensions? +* [#8850](https://github.com/scipy/scipy/issues/8850): Scipy.interpolate.griddata Error : Exception ignored in: ‘scipy.spatial.qhull.\_Qhull.\_\_dealloc\_\_’ +* [#8928](https://github.com/scipy/scipy/issues/8928): BUG: scipy.stats.norm wrong expected value of function when loc… +* [#9213](https://github.com/scipy/scipy/issues/9213): \_\_STDC\_VERSION\_\_ check in C++ code +* [#9231](https://github.com/scipy/scipy/issues/9231): infinite loop in stats.fisher\_exact +* [#9313](https://github.com/scipy/scipy/issues/9313): geometric distribution stats.geom returns negative values if… +* [#9524](https://github.com/scipy/scipy/issues/9524): interpn returns nan with perfectly valid data +* [#9591](https://github.com/scipy/scipy/issues/9591): scipy.interpolate.interp1d with kind=“previous” doesn’t extrapolate… +* [#9815](https://github.com/scipy/scipy/issues/9815): stats.mode’s nan\_policy ‘propagate’ not working? +* [#9944](https://github.com/scipy/scipy/issues/9944): documentation for `scipy.interpolate.RectBivariateSpline` is… +* [#9999](https://github.com/scipy/scipy/issues/9999): BUG: malloc() calls in Cython and C that are not checked for… +* [#10096](https://github.com/scipy/scipy/issues/10096): Add literature reference for circstd (and circvar?) +* [#10446](https://github.com/scipy/scipy/issues/10446): RuntimeWarning: invalid value encountered in stats.genextreme +* [#10577](https://github.com/scipy/scipy/issues/10577): Additional discussion for scipy.stats roadmap +* [#10821](https://github.com/scipy/scipy/issues/10821): Errors with the Yeo-Johnson Transform that also Appear in Scikit-Learn +* [#10983](https://github.com/scipy/scipy/issues/10983): LOBPCG inefficinet when computing > 20% of eigenvalues +* [#11145](https://github.com/scipy/scipy/issues/11145): unexpected SparseEfficiencyWarning at scipy.sparse.linalg.splu +* [#11406](https://github.com/scipy/scipy/issues/11406): scipy.sparse.linalg.svds (v1.4.1) on singular matrix does not… +* [#11447](https://github.com/scipy/scipy/issues/11447): scipy.interpolate.interpn: Handle ValueError(‘The points in dimension… +* [#11673](https://github.com/scipy/scipy/issues/11673): intlinprog: integer linear program solver +* [#11742](https://github.com/scipy/scipy/issues/11742): MAINT: stats: getting skewness alone takes 34000x longer than… +* [#11806](https://github.com/scipy/scipy/issues/11806): Unexpectedly poor results when distribution fitting with `weibull\_min`… +* [#11828](https://github.com/scipy/scipy/issues/11828): UnivariateSpline gives varying results when multithreaded on… +* [#11948](https://github.com/scipy/scipy/issues/11948): fitting discrete distributions +* [#12073](https://github.com/scipy/scipy/issues/12073): Add note in documentation +* [#12370](https://github.com/scipy/scipy/issues/12370): truncnorm.rvs is painfully slow on version 1.5.0rc2 +* [#12456](https://github.com/scipy/scipy/issues/12456): Add generalized mean calculation +* [#12480](https://github.com/scipy/scipy/issues/12480): RectBivariateSpline derivative evaluator is slow +* [#12485](https://github.com/scipy/scipy/issues/12485): linprog returns an incorrect message +* [#12506](https://github.com/scipy/scipy/issues/12506): ENH: stats: one-sided p-values for statistical tests +* [#12545](https://github.com/scipy/scipy/issues/12545): stats.pareto.fit raises RuntimeWarning +* [#12548](https://github.com/scipy/scipy/issues/12548): scipy.stats.skew returning MaskedArray +* [#12633](https://github.com/scipy/scipy/issues/12633): Offer simpler development workflow? +* [#12658](https://github.com/scipy/scipy/issues/12658): scipy.stats.levy\_stable.pdf can be inaccurate and return nan +* [#12733](https://github.com/scipy/scipy/issues/12733): scipy.stats.truncnorm.cdf slow +* [#12838](https://github.com/scipy/scipy/issues/12838): Accept multiple matrices in `scipy.linalg.expm` +* [#12848](https://github.com/scipy/scipy/issues/12848): DOC: stats: multivariate distribution documentation issues +* [#12870](https://github.com/scipy/scipy/issues/12870): Levy Stable Random Variates Code has a typo +* [#12871](https://github.com/scipy/scipy/issues/12871): Levy Stable distribution uses parameterisation that is not location… +* [#13200](https://github.com/scipy/scipy/issues/13200): Errors made by scipy.optimize.linprog +* [#13462](https://github.com/scipy/scipy/issues/13462): Too many warnings and results objects in public API for scipy.stats +* [#13582](https://github.com/scipy/scipy/issues/13582): ENH: stats: `rv\_continuous.stats` with array shapes: use `\_stats`… +* [#13615](https://github.com/scipy/scipy/issues/13615): RFC: switch to Meson as a build system +* [#13632](https://github.com/scipy/scipy/issues/13632): stats.rv\_discrete is not checking that xk values are integers +* [#13655](https://github.com/scipy/scipy/issues/13655): MAINT: stats.rv\_generic: `moment` method falls back to `\_munp`… +* [#13689](https://github.com/scipy/scipy/issues/13689): Wilcoxon does not appropriately detect ties when mode=exact. +* [#13835](https://github.com/scipy/scipy/issues/13835): Change name of `alpha` parameter in `interval()` method +* [#13872](https://github.com/scipy/scipy/issues/13872): Add method details or reference to `scipy.integrate.dblquad` +* [#13912](https://github.com/scipy/scipy/issues/13912): Adding Poisson Disc sampling to QMC +* [#13996](https://github.com/scipy/scipy/issues/13996): Fisk distribution documentation typo +* [#14035](https://github.com/scipy/scipy/issues/14035): `roots\_jacobi` support for large parameter values +* [#14081](https://github.com/scipy/scipy/issues/14081): `scipy.optimize.\_linprog\_simplex.\_apply\_pivot` relies on asymmetric… +* [#14095](https://github.com/scipy/scipy/issues/14095): scipy.stats.norm.pdf takes too much time and memory +* [#14162](https://github.com/scipy/scipy/issues/14162): Thread safety RectBivariateSpline +* [#14267](https://github.com/scipy/scipy/issues/14267): BUG: online doc returns 404 - wrong `reference` in url +* [#14313](https://github.com/scipy/scipy/issues/14313): ks\_2samp: example description does not match example output +* [#14418](https://github.com/scipy/scipy/issues/14418): `ttest\_ind` for two sampled distributions with the same single… +* [#14455](https://github.com/scipy/scipy/issues/14455): Adds Mixed Integer Linear Programming from highs +* [#14462](https://github.com/scipy/scipy/issues/14462): Shapiro test returning negative p-value +* [#14471](https://github.com/scipy/scipy/issues/14471): methods ‘revised simplex’ and ‘interior-point’ are extremely… +* [#14505](https://github.com/scipy/scipy/issues/14505): `Optimization converged to parameters that are outside the range`… +* [#14527](https://github.com/scipy/scipy/issues/14527): Segmentation fault with KDTree +* [#14548](https://github.com/scipy/scipy/issues/14548): Add convention flag to quanternion in `Scipy.spatial.transform.rotation.Rotation` +* [#14565](https://github.com/scipy/scipy/issues/14565): optimize.minimize: Presence of callback causes method TNC to… +* [#14622](https://github.com/scipy/scipy/issues/14622): BUG: (sort of) mannwhitneyu hits max recursion limit with imbalanced… +* [#14645](https://github.com/scipy/scipy/issues/14645): ENH: MemoryError when trying to bootstrap with large amounts… +* [#14716](https://github.com/scipy/scipy/issues/14716): BUG: stats: The `loguniform` distribution is overparametrized. +* [#14731](https://github.com/scipy/scipy/issues/14731): BUG: Incorrect residual graph in scipy.sparse.csgraph.maximum\_flow +* [#14745](https://github.com/scipy/scipy/issues/14745): BUG: scipy.ndimage.convolve documentation is incorrect +* [#14750](https://github.com/scipy/scipy/issues/14750): ENH: Add one more derivative-free optimization method +* [#14753](https://github.com/scipy/scipy/issues/14753): Offer to collaborate on truncated normal estimation by minimax… +* [#14777](https://github.com/scipy/scipy/issues/14777): BUG: Wrong limit and no warning in stats.t for df=np.inf +* [#14793](https://github.com/scipy/scipy/issues/14793): BUG: Missing pairs in cKDTree.query\_pairs when coordinates contain… +* [#14861](https://github.com/scipy/scipy/issues/14861): BUG: unclear error message when all bounds are all equal for… +* [#14889](https://github.com/scipy/scipy/issues/14889): BUG: NumPy’s `random` module should not be in the `scipy`… +* [#14914](https://github.com/scipy/scipy/issues/14914): CI job with code coverage is failing (yet again) +* [#14926](https://github.com/scipy/scipy/issues/14926): RegularGridInterpolator should be called RectilinearGridInterpolator +* [#14986](https://github.com/scipy/scipy/issues/14986): Prevent new Python versions from trying to install older releases… +* [#14994](https://github.com/scipy/scipy/issues/14994): BUG: Levy stable +* [#15009](https://github.com/scipy/scipy/issues/15009): BUG: scipy.stats.multiscale\_graphcorr p-values are computed differently… +* [#15059](https://github.com/scipy/scipy/issues/15059): BUG: documentation inconsistent with code for find\_peaks\_cwt +* [#15082](https://github.com/scipy/scipy/issues/15082): DOC: Sampling from the truncated normal +* [#15110](https://github.com/scipy/scipy/issues/15110): BUG: truncnorm.cdf returns incorrect values at tail +* [#15125](https://github.com/scipy/scipy/issues/15125): Deprecate `scipy.spatial.distance.kulsinski` +* [#15133](https://github.com/scipy/scipy/issues/15133): BUG: Log\_norm description is incorrect and produces incorrect… +* [#15150](https://github.com/scipy/scipy/issues/15150): BUG: RBFInterpolator is much slower than Rbf for vector data +* [#15172](https://github.com/scipy/scipy/issues/15172): BUG: special: High relative error in `log\_ndtr` +* [#15195](https://github.com/scipy/scipy/issues/15195): BUGS: stats: Tracking issue for distributions that warn and/or… +* [#15199](https://github.com/scipy/scipy/issues/15199): BUG: Error occured `spsolve\_triangular` +* [#15210](https://github.com/scipy/scipy/issues/15210): BUG: A sparse matrix raises a ValueError when `\_\_rmul\_\_` with… +* [#15245](https://github.com/scipy/scipy/issues/15245): MAINT: scipy.stats.\_levy\_stable should be treated as subpackage… +* [#15252](https://github.com/scipy/scipy/issues/15252): DOC: Multivariate normal CDF docstring typo +* [#15296](https://github.com/scipy/scipy/issues/15296): BUG: SciPy 1.7.x build failure on Cygwin +* [#15308](https://github.com/scipy/scipy/issues/15308): BUG: OpenBLAS 0.3.18 support +* [#15338](https://github.com/scipy/scipy/issues/15338): DOC: Rename `\*args` param in `f\_oneway` to `\*samples` +* [#15345](https://github.com/scipy/scipy/issues/15345): BUG: boschloo\_exact gives pvalue > 1 (and sometimes nan) +* [#15368](https://github.com/scipy/scipy/issues/15368): build warnings for `unuran\_wrapper.pyx` +* [#15373](https://github.com/scipy/scipy/issues/15373): BUG: Tippett’s and Pearson’s method for combine\_pvalues are not… +* [#15415](https://github.com/scipy/scipy/issues/15415): `integrate.quad\_vec` missing documentation for `limit` parameter +* [#15456](https://github.com/scipy/scipy/issues/15456): Segfault in HiGHS code when building with Mingw-w64 on Windows +* [#15458](https://github.com/scipy/scipy/issues/15458): DOC: Documentation inaccuracy of scipy.interpolate.bisplev +* [#15488](https://github.com/scipy/scipy/issues/15488): ENH: missing examples for scipy.optimize in docs +* [#15507](https://github.com/scipy/scipy/issues/15507): BUG: scipy.optimize.linprog: the algorithm determines the problem… +* [#15508](https://github.com/scipy/scipy/issues/15508): BUG: Incorrect error message in multivariate\_normal +* [#15541](https://github.com/scipy/scipy/issues/15541): BUG: scipy.stats.powerlaw, why should x ∈ (0,1)? x can exceed… +* [#15551](https://github.com/scipy/scipy/issues/15551): MAINT: stats: deprecating non-numeric array support in `stats.mode` +* [#15568](https://github.com/scipy/scipy/issues/15568): BENCH/CI: Benchmark timeout +* [#15572](https://github.com/scipy/scipy/issues/15572): BUG: `scipy.spatial.transform.rotation`, wrong deprecation… +* [#15575](https://github.com/scipy/scipy/issues/15575): BUG: Tests failing for initial build [arm64 machine] +* [#15589](https://github.com/scipy/scipy/issues/15589): BUG: scipy.special.factorialk docstring inconsistent with behaviour +* [#15601](https://github.com/scipy/scipy/issues/15601): BUG: Scalefactors for `signal.csd` with `average==’median’`… +* [#15617](https://github.com/scipy/scipy/issues/15617): ENH: stats: all multivariate distributions should be freezable +* [#15631](https://github.com/scipy/scipy/issues/15631): BUG: stats.fit: intermittent failure in doctest +* [#15635](https://github.com/scipy/scipy/issues/15635): CI:ASK: Remove LaTeX doc builds? +* [#15638](https://github.com/scipy/scipy/issues/15638): DEV: `dev.py` missing PYTHONPATH when building doc +* [#15644](https://github.com/scipy/scipy/issues/15644): DOC: stats.ks\_1samp: incorrect commentary in examples +* [#15666](https://github.com/scipy/scipy/issues/15666): CI: CircleCI build\_docs failure on main +* [#15670](https://github.com/scipy/scipy/issues/15670): BUG: AssertionError in test\_\_dual\_annealing.py in test\_bounds\_class +* [#15689](https://github.com/scipy/scipy/issues/15689): BUG: default value of shape parameter in fit method of rv\_continuous… +* [#15692](https://github.com/scipy/scipy/issues/15692): CI: scipy.scipy (Main refguide\_asv\_check) failure in main +* [#15696](https://github.com/scipy/scipy/issues/15696): DOC: False information in docs - scipy.stats.ttest\_1samp +* [#15700](https://github.com/scipy/scipy/issues/15700): BUG: AssertionError in test\_propack.py +* [#15730](https://github.com/scipy/scipy/issues/15730): BUG: “terminate called after throwing an instance of ‘std::out\_of\_range’”… +* [#15732](https://github.com/scipy/scipy/issues/15732): DEP: execute deprecation of inexact indices into sparse matrices +* [#15734](https://github.com/scipy/scipy/issues/15734): DEP: deal with deprecation of ndim >1 in bspline +* [#15735](https://github.com/scipy/scipy/issues/15735): DEP: add actual DeprecationWarning for sym\_pos-keyword of scipy.linalg.solve +* [#15736](https://github.com/scipy/scipy/issues/15736): DEP: Remove `debug` keyword from `scipy.linalg.solve\_\*` +* [#15737](https://github.com/scipy/scipy/issues/15737): DEP: Execute deprecation of pinv2 +* [#15739](https://github.com/scipy/scipy/issues/15739): DEP: sharpen deprecation for >1-dim inputs in optimize.minimize +* [#15740](https://github.com/scipy/scipy/issues/15740): DEP: Execute deprecation for squeezing input vectors in spatial.distance +* [#15741](https://github.com/scipy/scipy/issues/15741): DEP: remove spatial.distance.matching +* [#15742](https://github.com/scipy/scipy/issues/15742): DEP: raise if fillvalue cannot be cast to output type in `signal.convolve2d` +* [#15743](https://github.com/scipy/scipy/issues/15743): DEP: enforce radius for `spatial.SphericalVoronoi` +* [#15744](https://github.com/scipy/scipy/issues/15744): DEP: sharpen deprecation of dual\_annealing argument ‘local\_search\_options’ +* [#15745](https://github.com/scipy/scipy/issues/15745): DEP: remove signal.windows.hanning +* [#15746](https://github.com/scipy/scipy/issues/15746): DEP: remove k=None from KDTree.query +* [#15747](https://github.com/scipy/scipy/issues/15747): DEP: stats: remove support for `\_rvs` without `size` parameter +* [#15750](https://github.com/scipy/scipy/issues/15750): DEP: remove `n\_jobs` from kdtree +* [#15751](https://github.com/scipy/scipy/issues/15751): DEP: remove ftol/xtol from neldermead +* [#15752](https://github.com/scipy/scipy/issues/15752): DEP: remove right keyword from interpolate.PPoly.extend +* [#15753](https://github.com/scipy/scipy/issues/15753): DEP: remove `\_ppform` +* [#15754](https://github.com/scipy/scipy/issues/15754): DEP: Remove mlab mode from dendrogram +* [#15757](https://github.com/scipy/scipy/issues/15757): DEP: docstring-related deprecations +* [#15758](https://github.com/scipy/scipy/issues/15758): DEP: remove LAPACK \*gegv functions +* [#15759](https://github.com/scipy/scipy/issues/15759): DEP: remove old BSR methods +* [#15760](https://github.com/scipy/scipy/issues/15760): DEP: remove py\_vq2 +* [#15761](https://github.com/scipy/scipy/issues/15761): DEP: remove stats.itemfreq +* [#15762](https://github.com/scipy/scipy/issues/15762): DEP: remove stats.median\_absolute\_deviation +* [#15773](https://github.com/scipy/scipy/issues/15773): BUG: iirfilter allows Wn[1] < Wn[0] for band-pass and band-stop… +* [#15780](https://github.com/scipy/scipy/issues/15780): BUG: CI on Azure broken with PyTest 7.1 +* [#15843](https://github.com/scipy/scipy/issues/15843): BUG: scipy.stats.brunnermunzel incorrectly returns nan for undocumented… +* [#15854](https://github.com/scipy/scipy/issues/15854): CI: Windows Meson job failing sometimes on OpenBLAS binary download +* [#15866](https://github.com/scipy/scipy/issues/15866): BUG/CI: Wrong python version used for tests labeled “Linux Tests… +* [#15871](https://github.com/scipy/scipy/issues/15871): BUG: stats: Test failure of `TestTruncnorm.test\_moments` on… +* [#15899](https://github.com/scipy/scipy/issues/15899): BUG: \_calc\_uniform\_order\_statistic\_medians documentation example… +* [#15927](https://github.com/scipy/scipy/issues/15927): BUG: Inconsistent handling of INF and NAN in signal.convolve +* [#15931](https://github.com/scipy/scipy/issues/15931): BUG: scipy/io/arff/tests/test\_arffread.py::TestNoData::test\_nodata… +* [#15960](https://github.com/scipy/scipy/issues/15960): BUG: Documentation Error in scipy.signal.lfilter +* [#15961](https://github.com/scipy/scipy/issues/15961): BUG: scipy.stats.beta and bernoulli fails with float32 inputs +* [#15962](https://github.com/scipy/scipy/issues/15962): Race condition in macOS Meson build between `\_matfuncs\_expm`… +* [#15987](https://github.com/scipy/scipy/issues/15987): CI: `np.matrix` deprecation warning +* [#16007](https://github.com/scipy/scipy/issues/16007): BUG: Confusing documentation in `ttest\_ind\_from\_stats` +* [#16011](https://github.com/scipy/scipy/issues/16011): BUG: typo in documentation for scipy.optimize.basinhopping +* [#16020](https://github.com/scipy/scipy/issues/16020): BUG: dev.py FileNotFoundError +* [#16027](https://github.com/scipy/scipy/issues/16027): jc should be (n-1)/2 +* [#16031](https://github.com/scipy/scipy/issues/16031): BUG: scipy.sparse.linalg.norm does not work on sparse arrays +* [#16036](https://github.com/scipy/scipy/issues/16036): Missing `f` prefix on f-strings +* [#16054](https://github.com/scipy/scipy/issues/16054): Bug: Meson build with dev.py fails to detect SciPy with debian… +* [#16065](https://github.com/scipy/scipy/issues/16065): BUG: Gitpod build with `python runtests.py` fails; move to… +* [#16074](https://github.com/scipy/scipy/issues/16074): BUG: refguide check fails with `numpydoc==1.3` +* [#16081](https://github.com/scipy/scipy/issues/16081): CI, MAINT: minor refguide failure with stats.describe +* [#16121](https://github.com/scipy/scipy/issues/16121): DOC: scipy.interpolate.RegularGridInterpolator and interpn works… +* [#16162](https://github.com/scipy/scipy/issues/16162): BUG: curve\_fit gives wrong results with Pandas float32 +* [#16171](https://github.com/scipy/scipy/issues/16171): BUG: scipy.stats.multivariate\_hypergeom.rvs raises ValueError… +* [#16219](https://github.com/scipy/scipy/issues/16219): `TestSobol.test\_0dim` failure on 32-bit Linux job +* [#16233](https://github.com/scipy/scipy/issues/16233): BUG: Memory leak in function `sf\_error` due to new reference… +* [#16254](https://github.com/scipy/scipy/issues/16254): DEP: add deprecation warning to `maxiter` kwarg in `\_minimize\_tnc` +* [#16292](https://github.com/scipy/scipy/issues/16292): BUG: compilation error: no matching constructor for initialization… +* [#16300](https://github.com/scipy/scipy/issues/16300): BLD: pip install build issue with meson in Ubuntu virtualenv +* [#16337](https://github.com/scipy/scipy/issues/16337): TST: stats/tests/test\_axis\_nan\_policy.py::test\_axis\_nan\_policy\_full… +* [#16347](https://github.com/scipy/scipy/issues/16347): TST, MAINT: 32-bit Linux test failures in wheels repo +* [#16358](https://github.com/scipy/scipy/issues/16358): TST, MAINT: test\_theilslopes\_warnings fails on 32-bit Windows +* [#16378](https://github.com/scipy/scipy/issues/16378): DOC: pydata-sphinx-theme v0.9 defaults to darkmode depending… +* [#16381](https://github.com/scipy/scipy/issues/16381): BUG: bootstrap get ValueError for paired statistic +* [#16382](https://github.com/scipy/scipy/issues/16382): BUG: truncnorm.fit does not fit correctly +* [#16403](https://github.com/scipy/scipy/issues/16403): MAINT: NumPy main will require a few updates due to new floating… +* [#16409](https://github.com/scipy/scipy/issues/16409): BUG: SIGSEGV in qhull when array type is wrong +* [#16418](https://github.com/scipy/scipy/issues/16418): BUG: breaking change: scipy.stats.mode returned value has changed… +* [#16419](https://github.com/scipy/scipy/issues/16419): BUG: scipy.stats.nbinom.logcdf returns wrong results when some… +* [#16426](https://github.com/scipy/scipy/issues/16426): BUG: stats.shapiro inplace modification of user array +* [#16446](https://github.com/scipy/scipy/issues/16446): BUG: Issue with stripping on macOS Monterey + xcode 13.2 +* [#16465](https://github.com/scipy/scipy/issues/16465): BLD: new sdist has some metadata issues +* [#16466](https://github.com/scipy/scipy/issues/16466): BUG: linprog failure - OptimizeResult.x returns NoneType +* [#16495](https://github.com/scipy/scipy/issues/16495): HiGHS does not compile on windows (on conda-forge infra) +* [#16523](https://github.com/scipy/scipy/issues/16523): BUG: test failure in pre-release job: `TestFactorized.test\_singular\_with\_umfpack` +* [#16540](https://github.com/scipy/scipy/issues/16540): BLD: meson 0.63.0 and new CI testing failures on Linux +* [#16555](https://github.com/scipy/scipy/issues/16555): Building 1.9.x branch from source requires fix in meson-python… +* [#16609](https://github.com/scipy/scipy/issues/16609): BUG: `scipy.optimize.linprog` reports optimal for trivially… +* [#16681](https://github.com/scipy/scipy/issues/16681): BUG: linprog integrality only accepts list, not array +* [#16718](https://github.com/scipy/scipy/issues/16718): BUG: memoryview error with Cython 0.29.31 + +## [Pull requests for 1.9.0](#id21)[#](#pull-requests-for-1-9-0 "Link to this heading") + +* [#9523](https://github.com/scipy/scipy/pull/9523): ENH: improvements to the Stable distribution +* [#11829](https://github.com/scipy/scipy/pull/11829): Fixes safe handling of small singular values in svds. +* [#13490](https://github.com/scipy/scipy/pull/13490): DEV: stats: check for distribution/method keyword name collisions +* [#13572](https://github.com/scipy/scipy/pull/13572): ENH: n-D and nan\_policy support for scipy.stats.percentileofscore +* [#13918](https://github.com/scipy/scipy/pull/13918): ENH: Poisson Disk sampling for QMC +* [#13955](https://github.com/scipy/scipy/pull/13955): DOC: SciPy extensions for code style and docstring guidelines. +* [#14003](https://github.com/scipy/scipy/pull/14003): DOC: clarify the definition of the pdf of `stats.fisk` +* [#14036](https://github.com/scipy/scipy/pull/14036): ENH: fix numerical issues in roots\_jacobi and related special… +* [#14087](https://github.com/scipy/scipy/pull/14087): DOC: explain null hypotheses in ttest functions +* [#14142](https://github.com/scipy/scipy/pull/14142): DOC: Add better error message for unpacking issue +* [#14143](https://github.com/scipy/scipy/pull/14143): Support LinearOperator in expm\_multiply +* [#14300](https://github.com/scipy/scipy/pull/14300): ENH: Adding DIRECT algorithm to ``scipy.optimize`` +* [#14576](https://github.com/scipy/scipy/pull/14576): ENH: stats: add one-sample Monte Carlo hypothesis test +* [#14642](https://github.com/scipy/scipy/pull/14642): ENH: add Lloyd’s algorithm to `scipy.spatial` to improve a… +* [#14718](https://github.com/scipy/scipy/pull/14718): DOC: stats: adjust bootstrap doc to emphasize that batch controls… +* [#14781](https://github.com/scipy/scipy/pull/14781): BUG: stats: handle infinite `df` in `t` distribution +* [#14847](https://github.com/scipy/scipy/pull/14847): ENH: BLD: enable building SciPy with Meson +* [#14877](https://github.com/scipy/scipy/pull/14877): DOC: ndimage convolve origin documentation (#14745) +* [#15001](https://github.com/scipy/scipy/pull/15001): ENH: sparse.linalg: More comprehensive tests (Not only for 1-D… +* [#15026](https://github.com/scipy/scipy/pull/15026): ENH: allow approx\_fprime to work with vector-valued func +* [#15079](https://github.com/scipy/scipy/pull/15079): ENH:linalg: expm overhaul and ndarray processing +* [#15140](https://github.com/scipy/scipy/pull/15140): ENH: Make `stats.kappa3` work with array inputs +* [#15154](https://github.com/scipy/scipy/pull/15154): DOC: a small bug in docstring example of `lobpcg` +* [#15165](https://github.com/scipy/scipy/pull/15165): MAINT: Avoid using del to remove numpy symbols in scipy.\_\_init\_\_.py +* [#15168](https://github.com/scipy/scipy/pull/15168): REL: set version to 1.9.0.dev0 +* [#15169](https://github.com/scipy/scipy/pull/15169): DOC: fix formatting of Methods in multivariate distributions +* [#15171](https://github.com/scipy/scipy/pull/15171): `AttrDict` raises `AttributeError` on missing attributes,… +* [#15176](https://github.com/scipy/scipy/pull/15176): BUG: special: Clean up some private namespaces and fix `special.\_\_all\_\_` +* [#15182](https://github.com/scipy/scipy/pull/15182): MAINT: fix typos principle -> principal +* [#15184](https://github.com/scipy/scipy/pull/15184): MAINT: CI: Rename ‘Nightly CPython’ job to ‘NumPy main’ +* [#15187](https://github.com/scipy/scipy/pull/15187): BUG: special: Fix numerical precision issue of log\_ndtr +* [#15188](https://github.com/scipy/scipy/pull/15188): MAINT: sparse.linalg: Using more concise and user-friendly f-string… +* [#15190](https://github.com/scipy/scipy/pull/15190): MAINT: interpolate: speed up the RBFInterpolator evaluation with… +* [#15196](https://github.com/scipy/scipy/pull/15196): BUG: stats: Fix handling of support endpoints in two distributions. +* [#15197](https://github.com/scipy/scipy/pull/15197): MAINT: build dependency updates +* [#15202](https://github.com/scipy/scipy/pull/15202): MAINT: special: Don’t use macro for ‘extern “C”’ in strictly… +* [#15205](https://github.com/scipy/scipy/pull/15205): BUG: stats: Fix spurious warnings generated by several distributions. +* [#15207](https://github.com/scipy/scipy/pull/15207): MAINT: sparse.linalg: Using the interface with the trace of sparse… +* [#15219](https://github.com/scipy/scipy/pull/15219): DOC: Corrected docstring of ndimage.sum\_labels +* [#15223](https://github.com/scipy/scipy/pull/15223): DOC: x0->x for finite\_diff\_rel\_step docstring closes #15208 +* [#15230](https://github.com/scipy/scipy/pull/15230): ENH: expose submodules via `\_\_getattr\_\_` to allow lazy access +* [#15234](https://github.com/scipy/scipy/pull/15234): TST: stats: mark very slow tests as `xslow` +* [#15235](https://github.com/scipy/scipy/pull/15235): BUG: Fix rmul dispatch of spmatrix +* [#15243](https://github.com/scipy/scipy/pull/15243): DOC: stats: add reference for gstd +* [#15244](https://github.com/scipy/scipy/pull/15244): Added example for morphology: binary\_dilation and erosion +* [#15250](https://github.com/scipy/scipy/pull/15250): ENH: Make `stats.kappa4` work with array +* [#15251](https://github.com/scipy/scipy/pull/15251): [MRG] ENH: Update `laplacian` function introducing the new… +* [#15255](https://github.com/scipy/scipy/pull/15255): MAINT: Remove `distutils` usage in `runtests.py` to fix deprecation… +* [#15259](https://github.com/scipy/scipy/pull/15259): MAINT: optimize, special, signal: Use custom warnings instead… +* [#15261](https://github.com/scipy/scipy/pull/15261): DOC: Add inline comment in Hausdorff distance calculation +* [#15265](https://github.com/scipy/scipy/pull/15265): DOC: update .mailmap +* [#15266](https://github.com/scipy/scipy/pull/15266): CI: remove coverage usage from Windows jobs +* [#15269](https://github.com/scipy/scipy/pull/15269): BLD: add setup.py for `stats/\_levy\_stable` +* [#15272](https://github.com/scipy/scipy/pull/15272): BUG: Fix owens\_t function when a tends to infinity +* [#15274](https://github.com/scipy/scipy/pull/15274): DOC: fix docstring in \_cdf() function of \_multivariate.py +* [#15284](https://github.com/scipy/scipy/pull/15284): TST: silence RuntimeWarning from `np.det` in `signal.place\_poles`… +* [#15285](https://github.com/scipy/scipy/pull/15285): CI: simplify 32-bit Linux testing +* [#15286](https://github.com/scipy/scipy/pull/15286): MAINT: Highs submodule CI issue - use shallow cloning +* [#15289](https://github.com/scipy/scipy/pull/15289): DOC: Misc numpydoc formatting. +* [#15291](https://github.com/scipy/scipy/pull/15291): DOC: some more docstring/numpydoc formatting. +* [#15294](https://github.com/scipy/scipy/pull/15294): ENH: add integrality constraints for linprog +* [#15300](https://github.com/scipy/scipy/pull/15300): DOC: Misc manual docs updates. +* [#15302](https://github.com/scipy/scipy/pull/15302): DOC: More docstring reformatting. +* [#15304](https://github.com/scipy/scipy/pull/15304): CI: fix Gitpod build by adding HiGHS submodule checkout +* [#15305](https://github.com/scipy/scipy/pull/15305): BLD: update NumPy to >=1.18.5, setuptools to <60.0 +* [#15309](https://github.com/scipy/scipy/pull/15309): CI: update OpenBLAS to 0.3.18 in Azure jobs +* [#15310](https://github.com/scipy/scipy/pull/15310): ENH: signal: Add Kaiser-Bessel derived window function +* [#15312](https://github.com/scipy/scipy/pull/15312): BUG: special: Fix loss of precision in pseudo\_huber when r/delta… +* [#15314](https://github.com/scipy/scipy/pull/15314): MAINT: changed needed after renaming `master` branch to `main` +* [#15315](https://github.com/scipy/scipy/pull/15315): MAINT: account for NumPy master -> main renaming +* [#15325](https://github.com/scipy/scipy/pull/15325): CI: reshuffle two Windows Azure CI jobs, and don’t run ‘full’… +* [#15330](https://github.com/scipy/scipy/pull/15330): ENH: optimize: support undocumented option `full\_output` for… +* [#15336](https://github.com/scipy/scipy/pull/15336): DOC: update detailed roadmap +* [#15344](https://github.com/scipy/scipy/pull/15344): MAINT:stats: Renamed `\*args` param to `\*samples` +* [#15347](https://github.com/scipy/scipy/pull/15347): ENH: stats: add weights in harmonic mean +* [#15352](https://github.com/scipy/scipy/pull/15352): BLD: put upper bound `setuptools<60.0` in conda environment… +* [#15357](https://github.com/scipy/scipy/pull/15357): ENH: interpolate: add new methods for RegularGridInterpolator. +* [#15360](https://github.com/scipy/scipy/pull/15360): MAINT: speed up rvs of nakagami in scipy.stats +* [#15361](https://github.com/scipy/scipy/pull/15361): MAINT: sparse.linalg: Remove unnecessary operations +* [#15366](https://github.com/scipy/scipy/pull/15366): Make signal functions respect input dtype. +* [#15370](https://github.com/scipy/scipy/pull/15370): DOC: governance members moved to scipy.org +* [#15371](https://github.com/scipy/scipy/pull/15371): MAINT: stats: fix unuran compile-time warnings +* [#15378](https://github.com/scipy/scipy/pull/15378): MAINT: remove version pinning on gmpy2 +* [#15380](https://github.com/scipy/scipy/pull/15380): ENH/MAINT: Version switcher from the sphinx theme +* [#15385](https://github.com/scipy/scipy/pull/15385): DOC: fix typo +* [#15387](https://github.com/scipy/scipy/pull/15387): MAINT: Fix a couple build warnings. +* [#15388](https://github.com/scipy/scipy/pull/15388): DOC: interpolate: improve `RectBivariateSpline` doc +* [#15391](https://github.com/scipy/scipy/pull/15391): ENH: graph Laplacian as LinearOperator, add dtype and symmetrized… +* [#15392](https://github.com/scipy/scipy/pull/15392): ENH: integrality constraints for differential\_evolution +* [#15394](https://github.com/scipy/scipy/pull/15394): ENH: optimize: improvements to `LinearConstraint` class +* [#15396](https://github.com/scipy/scipy/pull/15396): DOC: Git:// protocol on github pending removal. +* [#15399](https://github.com/scipy/scipy/pull/15399): ENH: stats: add `axis` tuple and `nan\_policy` to `hmean` +* [#15400](https://github.com/scipy/scipy/pull/15400): MAINT: sparse.linalg: Move the test function of GMRES to the… +* [#15401](https://github.com/scipy/scipy/pull/15401): MAINT: DOC: analytics from analytics.scientific-python +* [#15402](https://github.com/scipy/scipy/pull/15402): DOC: update pip\_quickstart (submodules) +* [#15406](https://github.com/scipy/scipy/pull/15406): MAINT: use `Rotation.Random` instead of manual generation +* [#15407](https://github.com/scipy/scipy/pull/15407): BLD: meson: split pyx->c and Python extension build +* [#15408](https://github.com/scipy/scipy/pull/15408): MAINT: check for negative weights in `Rotation.align\_vectors` +* [#15410](https://github.com/scipy/scipy/pull/15410): ENH: add `order` parameter to specify quaternion format +* [#15413](https://github.com/scipy/scipy/pull/15413): ENH: stats: add `rvs` method for `gennorm` +* [#15424](https://github.com/scipy/scipy/pull/15424): ENH: bypass LinearOperator in lobpcg for small-size cases +* [#15427](https://github.com/scipy/scipy/pull/15427): MAINT: Manage imports in `sparse.linalg` +* [#15431](https://github.com/scipy/scipy/pull/15431): Revert “ENH: add `order` parameter to specify quaternion format” +* [#15436](https://github.com/scipy/scipy/pull/15436): ENH: stats: fit: function for fitting discrete and continuous… +* [#15439](https://github.com/scipy/scipy/pull/15439): ENH: differential\_evolution vectorized kwd +* [#15440](https://github.com/scipy/scipy/pull/15440): MAINT: Try to detect scipy path in `runtests.py` while not… +* [#15442](https://github.com/scipy/scipy/pull/15442): MAINT: Fix meson build warnings on windows +* [#15443](https://github.com/scipy/scipy/pull/15443): DOC, BUG: Fix error in heading remapping for custom `scipy.optimize:function` domain directive +* [#15445](https://github.com/scipy/scipy/pull/15445): ENH: stats: add `nnlf` method for discrete distributions +* [#15451](https://github.com/scipy/scipy/pull/15451): BLD: further refinement of Cython dependencies +* [#15452](https://github.com/scipy/scipy/pull/15452): BUG/DOC/TST: combine\_pvalues: fix Tippett and Pearson +* [#15453](https://github.com/scipy/scipy/pull/15453): ENH: Make dual\_annealing work with Bounds class +* [#15454](https://github.com/scipy/scipy/pull/15454): BLD: remove dependency on libnpymath from `spatial.\_distance\_wrap` +* [#15455](https://github.com/scipy/scipy/pull/15455): ENH: Support Bounds class in shgo +* [#15459](https://github.com/scipy/scipy/pull/15459): DOC: documents parameter `limit` for function `integrate.quad\_vec`. +* [#15460](https://github.com/scipy/scipy/pull/15460): ENH: optimize: milp: mixed integer linear programming +* [#15462](https://github.com/scipy/scipy/pull/15462): CI: switch one macOS CI job from distutils to meson +* [#15464](https://github.com/scipy/scipy/pull/15464): ENH: Performance improvements for `linear\_sum\_assignment` +* [#15465](https://github.com/scipy/scipy/pull/15465): DOC: stats: add weights in formulas and examples for gmean and… +* [#15466](https://github.com/scipy/scipy/pull/15466): MAINT: fix compile errors with CPython 3.11 +* [#15469](https://github.com/scipy/scipy/pull/15469): MAINT: Remove `distutils` usage +* [#15470](https://github.com/scipy/scipy/pull/15470): ENH: `stats.qmc`: faster hypercube point comparison and scrambling… +* [#15472](https://github.com/scipy/scipy/pull/15472): ENH: stats: add `axis` tuple and `nan\_policy` to `skew` +* [#15485](https://github.com/scipy/scipy/pull/15485): BLD: updates to Meson build files for more correct linking and… +* [#15487](https://github.com/scipy/scipy/pull/15487): MAINT: typo in bsplines.py +* [#15496](https://github.com/scipy/scipy/pull/15496): DOC: signal: fixed parameter ‘order’ for butter bandpass +* [#15497](https://github.com/scipy/scipy/pull/15497): MAINT: update vendored uarray +* [#15499](https://github.com/scipy/scipy/pull/15499): CI: remove matplotlib from 32-bit linux job, it fails to build +* [#15501](https://github.com/scipy/scipy/pull/15501): MAINT: Remove unused variable warnings +* [#15502](https://github.com/scipy/scipy/pull/15502): DEV: meson: allow specifying build directory and install prefix +* [#15512](https://github.com/scipy/scipy/pull/15512): MAINT: optimize.linprog: make HiGHS default and deprecate old… +* [#15523](https://github.com/scipy/scipy/pull/15523): DOC: fixed the link for fluiddyn’s transonic vision in dev/roadmap.html. +* [#15526](https://github.com/scipy/scipy/pull/15526): MAINT: add qrvs method to NumericalInversePolynomial in scipy.stats +* [#15529](https://github.com/scipy/scipy/pull/15529): DOC: forward port 1.8.0 relnotes +* [#15532](https://github.com/scipy/scipy/pull/15532): TST: parametrize test\_ldl\_type\_size\_combinations +* [#15546](https://github.com/scipy/scipy/pull/15546): DOC: missing section for metrics +* [#15555](https://github.com/scipy/scipy/pull/15555): MAINT: make unuran clone shallow +* [#15557](https://github.com/scipy/scipy/pull/15557): DOC: fixes inaccuracy in bisplev documentation +* [#15559](https://github.com/scipy/scipy/pull/15559): BENCH: selection of linalg solvers to facilitate expansion +* [#15560](https://github.com/scipy/scipy/pull/15560): DOC: types and return values for Bessel Functions +* [#15561](https://github.com/scipy/scipy/pull/15561): MAINT: update HiGHS submodule to include fix for Windows segfault +* [#15563](https://github.com/scipy/scipy/pull/15563): CI: add a Windows CI job on GitHub Actions using Meson +* [#15564](https://github.com/scipy/scipy/pull/15564): DOC: stray backticks +* [#15565](https://github.com/scipy/scipy/pull/15565): DOC: incorrect underline lenght in section. +* [#15567](https://github.com/scipy/scipy/pull/15567): ENH: stats.pareto fit improvement for parameter combinations +* [#15569](https://github.com/scipy/scipy/pull/15569): DOC: pip quickstart: setup.py -> meson +* [#15570](https://github.com/scipy/scipy/pull/15570): MAINT: bump test tolerance in test\_linprog +* [#15571](https://github.com/scipy/scipy/pull/15571): DOC: Wrong underline length +* [#15578](https://github.com/scipy/scipy/pull/15578): Make Windows Python setup more standard +* [#15581](https://github.com/scipy/scipy/pull/15581): MAINT: clarify deprecation warning spatial.transform.rotation +* [#15583](https://github.com/scipy/scipy/pull/15583): DOC: clarify O(N) SO(N) in random rotations +* [#15586](https://github.com/scipy/scipy/pull/15586): ENH: stats: Add ‘alternative’ and confidence interval to pearsonr +* [#15590](https://github.com/scipy/scipy/pull/15590): DOC: factorialk docstring inconsistent with code +* [#15597](https://github.com/scipy/scipy/pull/15597): DOC: update `hyp2f1` docstring example based on doctest +* [#15598](https://github.com/scipy/scipy/pull/15598): BUG/ENH: `lsq\_linear`: fixed incorrect `lsmr\_tol` in first… +* [#15603](https://github.com/scipy/scipy/pull/15603): BENCH: optimize: milp: add MILP benchmarks +* [#15606](https://github.com/scipy/scipy/pull/15606): MAINT: allow multiplication sign `×` +* [#15611](https://github.com/scipy/scipy/pull/15611): BUG:signal: Fix median bias in csd(…, average=”median”) +* [#15616](https://github.com/scipy/scipy/pull/15616): CI: pin asv to avoid slowdowns in 0.5/0.5.1 +* [#15619](https://github.com/scipy/scipy/pull/15619): DOC: stats: update interval and moment method signatures +* [#15625](https://github.com/scipy/scipy/pull/15625): MAINT: Clean up `type: ignore` comments related to third-party… +* [#15626](https://github.com/scipy/scipy/pull/15626): TST, MAINT: ignore np distutils dep +* [#15629](https://github.com/scipy/scipy/pull/15629): MAINT: stats: fix `trim1` `axis` behavior +* [#15632](https://github.com/scipy/scipy/pull/15632): ENH: stats.wilcoxon: return z-statistic (as requested) +* [#15634](https://github.com/scipy/scipy/pull/15634): CI: Improve concurrency to cancel running jobs on PR update +* [#15645](https://github.com/scipy/scipy/pull/15645): DOC: Add code example to the documentation of `sparse.linalg.cg`. +* [#15646](https://github.com/scipy/scipy/pull/15646): DOC: stats.ks\_1samp: correct examples +* [#15647](https://github.com/scipy/scipy/pull/15647): ENH: add variable bits to `stats.qmc.Sobol` +* [#15648](https://github.com/scipy/scipy/pull/15648): DOC: Add examples to documentation for `scipy.special.ellipr{c,d,f,g,j}` +* [#15649](https://github.com/scipy/scipy/pull/15649): DEV/DOC: remove latex/pdf documentation +* [#15651](https://github.com/scipy/scipy/pull/15651): DOC: stats.ks\_2samp/stats.kstest: correct examples +* [#15652](https://github.com/scipy/scipy/pull/15652): DOC: stats.circstd: add reference, notes, comments +* [#15655](https://github.com/scipy/scipy/pull/15655): REL: fix small issue in pavement.py for release note writing +* [#15656](https://github.com/scipy/scipy/pull/15656): DOC: Fix example for subset\_by\_index in eigh doc +* [#15661](https://github.com/scipy/scipy/pull/15661): DOC: Additional examples for optimize user guide +* [#15662](https://github.com/scipy/scipy/pull/15662): DOC: stats.fit: fix intermittent failure in doctest +* [#15663](https://github.com/scipy/scipy/pull/15663): DOC: stats.burr12: fix typo +* [#15664](https://github.com/scipy/scipy/pull/15664): BENCH: Add benchmarks for special.factorial/factorial2/factorialk +* [#15673](https://github.com/scipy/scipy/pull/15673): DOC: fix intersphinx links +* [#15682](https://github.com/scipy/scipy/pull/15682): MAINT: sparse.linalg: Clear up unnecessary modules imported in… +* [#15684](https://github.com/scipy/scipy/pull/15684): DOC: add formula and documentation improvements for scipy.special.chndtr… +* [#15690](https://github.com/scipy/scipy/pull/15690): ENH: add uarray multimethods for fast Hankel transforms +* [#15694](https://github.com/scipy/scipy/pull/15694): MAINT,CI: signal: fix failing refguide check +* [#15699](https://github.com/scipy/scipy/pull/15699): DOC: stats.ttest\_1samp: update example +* [#15701](https://github.com/scipy/scipy/pull/15701): BUG: Fix dual\_annealing bounds test +* [#15703](https://github.com/scipy/scipy/pull/15703): BUG: fix test fail in test\_propack.py (loosen atol) +* [#15710](https://github.com/scipy/scipy/pull/15710): MAINT: sparse.linalg: `bnorm` only calculate once +* [#15712](https://github.com/scipy/scipy/pull/15712): ENH: `scipy.stats.qmc.Sobol`: allow 32 or 64 bit computation +* [#15715](https://github.com/scipy/scipy/pull/15715): ENH: stats: add \_axis\_nan\_policy\_factory to moment +* [#15718](https://github.com/scipy/scipy/pull/15718): ENH: Migration of `write\_release\_and\_log` into standalone script +* [#15723](https://github.com/scipy/scipy/pull/15723): TST: stats: make `check\_sample\_var` two-sided +* [#15724](https://github.com/scipy/scipy/pull/15724): TST: stats: simplify `check\_sample\_mean` +* [#15725](https://github.com/scipy/scipy/pull/15725): DEV: Try to detect scipy from dev installed path +* [#15728](https://github.com/scipy/scipy/pull/15728): ENH: changed vague exception messages to a more descriptive ones… +* [#15729](https://github.com/scipy/scipy/pull/15729): ENH: stats: add weighted power mean +* [#15763](https://github.com/scipy/scipy/pull/15763): ENH: stats: replace ncf with Boost non\_central\_f distribution +* [#15766](https://github.com/scipy/scipy/pull/15766): BUG: improve exceptions for private attributes in refactored… +* [#15768](https://github.com/scipy/scipy/pull/15768): [DOC] fix typo in cython optimize help example +* [#15769](https://github.com/scipy/scipy/pull/15769): MAINT: stats: check integrality in `\_argcheck` as needed +* [#15771](https://github.com/scipy/scipy/pull/15771): MAINT: stats: resolve discrete rvs dtype platform dependency +* [#15774](https://github.com/scipy/scipy/pull/15774): MAINT: stats: remove deprecated `median\_absolute\_deviation` +* [#15775](https://github.com/scipy/scipy/pull/15775): DOC: stats.lognorm: rephrase note about parameterization +* [#15776](https://github.com/scipy/scipy/pull/15776): DOC: stats.powerlaw: more explicit explanation of support +* [#15777](https://github.com/scipy/scipy/pull/15777): MAINT: stats.shapiro: subtract median from shapiro input +* [#15778](https://github.com/scipy/scipy/pull/15778): MAINT: stats: more specific error type from `rv\_continuous.fit` +* [#15779](https://github.com/scipy/scipy/pull/15779): CI: don’t run meson tests on forks and remove skip flags +* [#15782](https://github.com/scipy/scipy/pull/15782): DEPR: remove k=None in KDTree.query +* [#15783](https://github.com/scipy/scipy/pull/15783): CI:Pin pytest version to 7.0.1 on Azure +* [#15785](https://github.com/scipy/scipy/pull/15785): MAINT: stats: remove deprecated itemfreq +* [#15786](https://github.com/scipy/scipy/pull/15786): DOC: Add examples of integrals to integrate.quadpack +* [#15788](https://github.com/scipy/scipy/pull/15788): DOC: update macOS and Linux contributor docs to use Python 3.9 +* [#15789](https://github.com/scipy/scipy/pull/15789): DOC, MAINT: Remove numpydoc submodule +* [#15791](https://github.com/scipy/scipy/pull/15791): MAINT: add ShapeInfo to continuous distributions in scipy.stats +* [#15795](https://github.com/scipy/scipy/pull/15795): DEP: remove n\_jobs from cKDTree +* [#15797](https://github.com/scipy/scipy/pull/15797): scipy/\_lib/boost: Update to d8626c9d2d937abf6a38a844522714ad72e63281 +* [#15799](https://github.com/scipy/scipy/pull/15799): DEP: add warning for documented-as-deprecated extradoc +* [#15802](https://github.com/scipy/scipy/pull/15802): DOC: Import Error in examples +* [#15803](https://github.com/scipy/scipy/pull/15803): DOC: error in TransferFunctionDiscrete example +* [#15804](https://github.com/scipy/scipy/pull/15804): DEP: sharpen warning message on >1-dim for optimize.minimize +* [#15805](https://github.com/scipy/scipy/pull/15805): DEP: specify version to remove dual\_annealing argument ‘local\_search\_options’ +* [#15809](https://github.com/scipy/scipy/pull/15809): DOC,MAINT: remove `quad\_explain` that has become irrelevant. +* [#15810](https://github.com/scipy/scipy/pull/15810): DOC: stats.mood: validity only when observations are unique +* [#15811](https://github.com/scipy/scipy/pull/15811): DOC: fix evaluate\_all\_bspl example. +* [#15812](https://github.com/scipy/scipy/pull/15812): DOC: Couple of single to double backticks +* [#15813](https://github.com/scipy/scipy/pull/15813): DOC: information about skip on CircleCI +* [#15817](https://github.com/scipy/scipy/pull/15817): MAINT: stats.fisher\_exact: improve docs and fix bugs +* [#15819](https://github.com/scipy/scipy/pull/15819): DEP: docstring-related deprecations (#15757) +* [#15821](https://github.com/scipy/scipy/pull/15821): DEP: add actual DeprecationWarning for sym\_pos-keyword of scipy.linalg.solve +* [#15822](https://github.com/scipy/scipy/pull/15822): DEP: remove `right` from interpolate.PPoly.extend +* [#15823](https://github.com/scipy/scipy/pull/15823): DOC: Interpolative tutorial - wrong matrix fill var +* [#15824](https://github.com/scipy/scipy/pull/15824): BUG: Handle base case for scipy.integrate.simpson when span along… +* [#15825](https://github.com/scipy/scipy/pull/15825): TST: stats: xfail\_on\_32bit studentized\_range moment test +* [#15827](https://github.com/scipy/scipy/pull/15827): DOC: change docs that specify the SNR ratio definition for find\_peaks\_cwt(). +* [#15828](https://github.com/scipy/scipy/pull/15828): DEP: raise value error for object arrays +* [#15830](https://github.com/scipy/scipy/pull/15830): MAINT: stats: collocate bootstrap/permutation\_test/monte\_carlo\_test +* [#15831](https://github.com/scipy/scipy/pull/15831): MAINT: stats.rv\_generic: fix unnecessary call to `\_munp` in… +* [#15835](https://github.com/scipy/scipy/pull/15835): FIX: Incorect boschloo pvalue +* [#15837](https://github.com/scipy/scipy/pull/15837): DOC: Simplify conda command +* [#15840](https://github.com/scipy/scipy/pull/15840): DOC: special: Add ‘Examples’ for wrightomega. +* [#15842](https://github.com/scipy/scipy/pull/15842): DOC: Add examples for `CGS`, `GCROTMK` and `BiCGSTAB` iterative… +* [#15846](https://github.com/scipy/scipy/pull/15846): DOC: Add efficiency condition for CSC sparse matrix and remove… +* [#15847](https://github.com/scipy/scipy/pull/15847): BUG: adds warning to scipy.stats.brunnermunzel +* [#15848](https://github.com/scipy/scipy/pull/15848): DOC: fix interp2d docs showing wrong Z array ordering. +* [#15850](https://github.com/scipy/scipy/pull/15850): MAINT: sparse.linalg: Missing tfqmr in the re-entrancy test +* [#15853](https://github.com/scipy/scipy/pull/15853): DEP: remove the keyword debug from linalg.solve +* [#15855](https://github.com/scipy/scipy/pull/15855): ENH: stats.rv\_continuous.expect: split interval to improve reliability +* [#15867](https://github.com/scipy/scipy/pull/15867): CI: fix python version matrix in linux workflow +* [#15868](https://github.com/scipy/scipy/pull/15868): CI: fix Azure workflows +* [#15872](https://github.com/scipy/scipy/pull/15872): DEP: remove mlab from dendrogram +* [#15874](https://github.com/scipy/scipy/pull/15874): DEP: remove py\_vq2 +* [#15875](https://github.com/scipy/scipy/pull/15875): DEP: remove old BSR methods +* [#15876](https://github.com/scipy/scipy/pull/15876): DEP: remove \_ppform +* [#15881](https://github.com/scipy/scipy/pull/15881): DEP: remove signal.windows.hanning +* [#15882](https://github.com/scipy/scipy/pull/15882): DEP: enforced radius in spherical voronoi +* [#15885](https://github.com/scipy/scipy/pull/15885): DOC: stats: clarify truncnorm shape parameter definition +* [#15886](https://github.com/scipy/scipy/pull/15886): BUG: check that iirfilter argument Wn satisfies Wn[0] < Wn[1] +* [#15887](https://github.com/scipy/scipy/pull/15887): DEP: remove ftol/xtol from neldermead +* [#15894](https://github.com/scipy/scipy/pull/15894): [BUG] make p-values consistent with the literature +* [#15895](https://github.com/scipy/scipy/pull/15895): CI: remove pin on Jinja2 +* [#15898](https://github.com/scipy/scipy/pull/15898): DOC: stats: correct documentation of `wilcoxon`’s behavior… +* [#15900](https://github.com/scipy/scipy/pull/15900): DOC: fix import in example in \_morestats +* [#15905](https://github.com/scipy/scipy/pull/15905): MAINT: stats.\_moment: warn when catastrophic cancellation occurs +* [#15909](https://github.com/scipy/scipy/pull/15909): DEP: deal with deprecation of ndim >1 in bspline +* [#15911](https://github.com/scipy/scipy/pull/15911): MAINT: stats: fix `gibrat` name +* [#15914](https://github.com/scipy/scipy/pull/15914): MAINT: special: Clean up C style in ndtr.c +* [#15916](https://github.com/scipy/scipy/pull/15916): MAINT: stats: adjust tolerance of failing TestTruncnorm +* [#15917](https://github.com/scipy/scipy/pull/15917): MAINT: stats: remove support for `\_rvs` without `size` parameter +* [#15920](https://github.com/scipy/scipy/pull/15920): ENH: stats.mannwhitneyu: add iterative implementation +* [#15923](https://github.com/scipy/scipy/pull/15923): MAINT: stats: attempt to consolidate warnings and errors +* [#15932](https://github.com/scipy/scipy/pull/15932): MAINT: stats: fix and thoroughly test `rv\_sample` at non-integer… +* [#15933](https://github.com/scipy/scipy/pull/15933): TST: test\_nodata respect endianness +* [#15938](https://github.com/scipy/scipy/pull/15938): DOC: sparse.linalg: add citations for COLAMD +* [#15939](https://github.com/scipy/scipy/pull/15939): Update \_dual\_annealing.py +* [#15945](https://github.com/scipy/scipy/pull/15945): BUG/ENH: `MultinomialQMC.random` shape to (n, pvals) +* [#15946](https://github.com/scipy/scipy/pull/15946): DEP: remove inheritance to `QMCEngine` in `MultinomialQMC`… +* [#15947](https://github.com/scipy/scipy/pull/15947): DOC: Revamp contributor setup guides +* [#15953](https://github.com/scipy/scipy/pull/15953): DOC: Add meson docs to use gcc, clang build in parallel and optimization… +* [#15955](https://github.com/scipy/scipy/pull/15955): BUG Fix signature of D\_IIR\_forback(1,2) +* [#15959](https://github.com/scipy/scipy/pull/15959): ENH: Developer CLI for SciPy +* [#15965](https://github.com/scipy/scipy/pull/15965): MAINT: stats: ensure that `rv\_continuous.\_fitstart` shapes… +* [#15968](https://github.com/scipy/scipy/pull/15968): BUG: Fix debug and coverage arguments with dev.py +* [#15970](https://github.com/scipy/scipy/pull/15970): BLD: specify `cython\_lapack` dependency for `matfuncs\_expm` +* [#15973](https://github.com/scipy/scipy/pull/15973): DOC: Add formula renderings to integrate.nquad. +* [#15981](https://github.com/scipy/scipy/pull/15981): ENH: optimize: Add Newton-TFQMR method and some tests for Newton-Krylov +* [#15982](https://github.com/scipy/scipy/pull/15982): BENCH: stats: Distribution memory and CDF/PPF round trip benchmarks +* [#15983](https://github.com/scipy/scipy/pull/15983): TST: sparse.linalg: Add tests for the parameter `show` +* [#15991](https://github.com/scipy/scipy/pull/15991): TST: fix for np.kron matrix issue. +* [#15992](https://github.com/scipy/scipy/pull/15992): DOC: Fixed `degrees` parameter in return section +* [#15997](https://github.com/scipy/scipy/pull/15997): MAINT: integrate: add `recursive` to QUADPACK Fortran sources +* [#15998](https://github.com/scipy/scipy/pull/15998): BUG: Fix yeojohnson when transformed data has zero variance +* [#15999](https://github.com/scipy/scipy/pull/15999): MAINT: Adds doit.db.db to gitignore +* [#16004](https://github.com/scipy/scipy/pull/16004): MAINT: rename MaximumFlowResult.residual to flow +* [#16005](https://github.com/scipy/scipy/pull/16005): DOC: sparse.linalg: Fixed the description of input matrix of… +* [#16010](https://github.com/scipy/scipy/pull/16010): MAINT: Add a check to verify all `.pyi` files are installed… +* [#16012](https://github.com/scipy/scipy/pull/16012): DOC: Fix broken link and add python headers to contributing guide +* [#16015](https://github.com/scipy/scipy/pull/16015): DEP: bump version for deprecating residual to flow. +* [#16018](https://github.com/scipy/scipy/pull/16018): Doc: fix arch linux building from source local dependencies instructions +* [#16019](https://github.com/scipy/scipy/pull/16019): DOC: fix conda env name in quickstart guide [skip ci] +* [#16021](https://github.com/scipy/scipy/pull/16021): DOC: typos in basinhopping documentation +* [#16024](https://github.com/scipy/scipy/pull/16024): CI: unpin pytest and pytest-xdist +* [#16026](https://github.com/scipy/scipy/pull/16026): BUG: Allow `spsolve\_triangular` to work with matrices with… +* [#16029](https://github.com/scipy/scipy/pull/16029): BUG: Fix meson-info file errors and add more informative exception +* [#16030](https://github.com/scipy/scipy/pull/16030): MAINT: stats: more accurate error message for `multivariate\_normal` +* [#16032](https://github.com/scipy/scipy/pull/16032): FIX: show warning when passing NAN into input of convolve method +* [#16037](https://github.com/scipy/scipy/pull/16037): MAINT: fix missing `f` prefix on f-strings +* [#16042](https://github.com/scipy/scipy/pull/16042): MAINT: stats.dirichlet: fix interface inconsistency +* [#16044](https://github.com/scipy/scipy/pull/16044): DEV: do.py, adoption of pkg pydevtool (removed non SciPy specific… +* [#16045](https://github.com/scipy/scipy/pull/16045): ENH: Use circleci-artifacts-redirector-action +* [#16051](https://github.com/scipy/scipy/pull/16051): MAINT: Miscellaneous small changes to filter\_design +* [#16053](https://github.com/scipy/scipy/pull/16053): Mark fitpack sources as `recursive` +* [#16055](https://github.com/scipy/scipy/pull/16055): MAINT: stats: replace `np.var` with `\_moment(…, 2)` to… +* [#16058](https://github.com/scipy/scipy/pull/16058): DEV: Fix meson debian python build +* [#16060](https://github.com/scipy/scipy/pull/16060): MAINT: Allow all Latin-1 Unicode letters in the source code. +* [#16062](https://github.com/scipy/scipy/pull/16062): DOC: Document QUADPACK routines used in `\*quad` +* [#16067](https://github.com/scipy/scipy/pull/16067): DEP: remove spatial.distance.matching +* [#16070](https://github.com/scipy/scipy/pull/16070): ENH: interpolate: handle length-1 grid axes in RegularGridInterpolator +* [#16073](https://github.com/scipy/scipy/pull/16073): DOC: expand RegularGridInterpolator docstring +* [#16075](https://github.com/scipy/scipy/pull/16075): CI: Fix refguidecheck failures; unpin Sphinx +* [#16077](https://github.com/scipy/scipy/pull/16077): BUG: interpolate: RGI(nan) is nan +* [#16078](https://github.com/scipy/scipy/pull/16078): DEV,BLD: Use Meson in Gitpod builds +* [#16082](https://github.com/scipy/scipy/pull/16082): BUG: refguide-check: allow multiline namedtuples +* [#16083](https://github.com/scipy/scipy/pull/16083): DOC: fixing a sign issue in FFTlog function documentation +* [#16092](https://github.com/scipy/scipy/pull/16092): ENH: interpolate: Add functionality to accept descending points… +* [#16095](https://github.com/scipy/scipy/pull/16095): MAINT: Remove old filtered warnings +* [#16100](https://github.com/scipy/scipy/pull/16100): MAINT: Fix a couple compiler warnings. +* [#16104](https://github.com/scipy/scipy/pull/16104): DOC: stats: symmetry not checked for (inv)wishart distributions +* [#16111](https://github.com/scipy/scipy/pull/16111): BUG: Fix norm for sparse arrays +* [#16115](https://github.com/scipy/scipy/pull/16115): MAINT: merge `environment.yml` and `environment\_meson.yml` +* [#16117](https://github.com/scipy/scipy/pull/16117): MAINT: stats.wilcoxon: return `zstatistic` only when `method=’approx’` +* [#16118](https://github.com/scipy/scipy/pull/16118): Download openblas binary from GH repo +* [#16122](https://github.com/scipy/scipy/pull/16122): CI: Speed up ci build that keeps timing out +* [#16125](https://github.com/scipy/scipy/pull/16125): DOC: interpolate: fix typos “the the” -> “the” +* [#16126](https://github.com/scipy/scipy/pull/16126): DOC: interpolate: details rectilinear grids in docstrings +* [#16128](https://github.com/scipy/scipy/pull/16128): BUG: interpolate: fix extrapolation behaviors of `previous`… +* [#16130](https://github.com/scipy/scipy/pull/16130): Increase time to timeout on azure +* [#16134](https://github.com/scipy/scipy/pull/16134): BUG: signal: Fix calculation of extended image indices in convolve2d. +* [#16135](https://github.com/scipy/scipy/pull/16135): MAINT: sparse.linalg: A minor improvement with zero initial guess +* [#16137](https://github.com/scipy/scipy/pull/16137): Clean up fitpack smoke tests +* [#16138](https://github.com/scipy/scipy/pull/16138): TST: interpolate: mark rbf chunking tests as slow +* [#16141](https://github.com/scipy/scipy/pull/16141): DOC: Plot poles as x and zeros as o in signal +* [#16144](https://github.com/scipy/scipy/pull/16144): DEP: Execute deprecation for squeezing input vectors in spatial.distance +* [#16145](https://github.com/scipy/scipy/pull/16145): ENH: Fix signal.iircomb w0 bugs, add support for both frequency… +* [#16150](https://github.com/scipy/scipy/pull/16150): Add typing info for Rotation.concatenate +* [#16165](https://github.com/scipy/scipy/pull/16165): BUG: fix extension module initialization, needs use of `PyMODINIT\_FUNC` +* [#16166](https://github.com/scipy/scipy/pull/16166): MAINT:linalg: Expose Cython functions for generic use +* [#16167](https://github.com/scipy/scipy/pull/16167): ENH: Tweak theilslopes and siegelslopes to return a tuple\_bunch +* [#16168](https://github.com/scipy/scipy/pull/16168): BUG: special: Fix the test ‘test\_d’ that is run when SCIPY\_XSLOW… +* [#16173](https://github.com/scipy/scipy/pull/16173): Adds note to the curve\_fit() docstring to use float64. +* [#16176](https://github.com/scipy/scipy/pull/16176): MAINT: remove questionable uses of `Py\_FatalError` in module… +* [#16177](https://github.com/scipy/scipy/pull/16177): MAINT: Cleanup unused code in meson-files +* [#16180](https://github.com/scipy/scipy/pull/16180): DEV: do.py build. On setup checks if intro-buildoptions.json… +* [#16181](https://github.com/scipy/scipy/pull/16181): BUG: stats: fix multivariate\_hypergeom.rvs method +* [#16183](https://github.com/scipy/scipy/pull/16183): ENH: Simplify return names in stats.theil/siegelslopes (and fix… +* [#16184](https://github.com/scipy/scipy/pull/16184): DEP: raise if fillvalue cannot be cast to output type in signal.convolve2d +* [#16185](https://github.com/scipy/scipy/pull/16185): BUG: stats: Fix handling of float32 inputs for the boost-based… +* [#16187](https://github.com/scipy/scipy/pull/16187): BLD: default to Meson in pyproject.toml +* [#16194](https://github.com/scipy/scipy/pull/16194): BLD: add a build option to force use of the g77 ABI with Meson +* [#16198](https://github.com/scipy/scipy/pull/16198): DEP: sharpen deprecation in NumericalInverseHermite +* [#16206](https://github.com/scipy/scipy/pull/16206): CI: Test NumPy main branch also with Python 3.11 +* [#16220](https://github.com/scipy/scipy/pull/16220): Create a new spline from a partial derivative of a bivariate… +* [#16223](https://github.com/scipy/scipy/pull/16223): MAINT: interpolate: move RGI to a separate file +* [#16228](https://github.com/scipy/scipy/pull/16228): TST: interpolate: move test\_spalde\_scalar to other fitpack tests +* [#16229](https://github.com/scipy/scipy/pull/16229): REL: DOC: fix documentation URLs +* [#16230](https://github.com/scipy/scipy/pull/16230): BUG: fix extension module initialization, needs use of PyMODINIT\_FUNC,… +* [#16239](https://github.com/scipy/scipy/pull/16239): MAINT: tools: Add more output to a refguide-check error message. +* [#16241](https://github.com/scipy/scipy/pull/16241): DOC: stats: update roadmap +* [#16242](https://github.com/scipy/scipy/pull/16242): BUG: Make KDTree more robust against nans. +* [#16245](https://github.com/scipy/scipy/pull/16245): DEP: Execute deprecation of pinv2 +* [#16247](https://github.com/scipy/scipy/pull/16247): DOC:linalg: Remove references to removed pinv2 function +* [#16248](https://github.com/scipy/scipy/pull/16248): DOC: prep 1.9.0 release notes +* [#16249](https://github.com/scipy/scipy/pull/16249): Refguide check verbosity abs names +* [#16257](https://github.com/scipy/scipy/pull/16257): DEP: Deprecation follow-ups +* [#16259](https://github.com/scipy/scipy/pull/16259): Revert “CI: pin Pip to 22.0.4 to avoid issues with `–no-build-isolation`” +* [#16261](https://github.com/scipy/scipy/pull/16261): DEP: add deprecation warning to maxiter kwarg in \_minimize\_tnc +* [#16264](https://github.com/scipy/scipy/pull/16264): DOC: update the RegularGridInterpolator docstring +* [#16265](https://github.com/scipy/scipy/pull/16265): DEP: deprecate spatial.distance.kulsinski +* [#16267](https://github.com/scipy/scipy/pull/16267): DOC: broken donation link on GitHub +* [#16273](https://github.com/scipy/scipy/pull/16273): DOC: remove deprecated functions from refguide +* [#16276](https://github.com/scipy/scipy/pull/16276): MAINT: sparse.linalg: Update some docstrings. +* [#16279](https://github.com/scipy/scipy/pull/16279): MAINT: stats: override `loguniform.fit` to resolve overparameterization +* [#16282](https://github.com/scipy/scipy/pull/16282): BUG: special: DECREF scipy\_special object before exiting sf\_error(). +* [#16283](https://github.com/scipy/scipy/pull/16283): Corrections To Docs +* [#16287](https://github.com/scipy/scipy/pull/16287): BLD: sync pyproject.toml changes from oldest-supported-numpy +* [#16289](https://github.com/scipy/scipy/pull/16289): MAINT: stats: remove function-specific warning messages +* [#16290](https://github.com/scipy/scipy/pull/16290): BLD: fix issue with `python setup.py install` and `\_directmodule` +* [#16295](https://github.com/scipy/scipy/pull/16295): MAINT: move `import\_array` before module creation in module… +* [#16296](https://github.com/scipy/scipy/pull/16296): DOC: REL: fix `make dist` issue with missing dependencies +* [#16303](https://github.com/scipy/scipy/pull/16303): MAINT: revert addition of multivariate\_beta +* [#16304](https://github.com/scipy/scipy/pull/16304): MAINT: add a more informative error message for broken installs +* [#16309](https://github.com/scipy/scipy/pull/16309): BLD: CI: fix issue in wheel metadata, and add basic “build in… +* [#16316](https://github.com/scipy/scipy/pull/16316): REL: update version switcher for 1.8.1 +* [#16321](https://github.com/scipy/scipy/pull/16321): DOC: fix incorrect formatting of deprecation tags +* [#16326](https://github.com/scipy/scipy/pull/16326): REL: update version switcher for 1.9 +* [#16329](https://github.com/scipy/scipy/pull/16329): MAINT: git security shim for 1.9.x +* [#16339](https://github.com/scipy/scipy/pull/16339): MAINT, TST: bump tol for \_axis\_nan\_policy\_test +* [#16341](https://github.com/scipy/scipy/pull/16341): BLD: update Pythran requirement to 0.11.0, to support Clang >=13 +* [#16353](https://github.com/scipy/scipy/pull/16353): MAINT: version bounds 1.9.0rc1 +* [#16360](https://github.com/scipy/scipy/pull/16360): MAINT, TST: sup warning for theilslopes +* [#16361](https://github.com/scipy/scipy/pull/16361): MAINT: SCIPY\_USE\_PROPACK +* [#16370](https://github.com/scipy/scipy/pull/16370): MAINT: update Boost submodule to include Cygwin fix +* [#16374](https://github.com/scipy/scipy/pull/16374): MAINT: update pydata-sphinx-theme +* [#16379](https://github.com/scipy/scipy/pull/16379): DOC: dark theme css adjustments +* [#16390](https://github.com/scipy/scipy/pull/16390): TST, MAINT: adjust 32-bit xfails for HiGHS +* [#16393](https://github.com/scipy/scipy/pull/16393): MAINT: use correct type for element wise comparison +* [#16414](https://github.com/scipy/scipy/pull/16414): BUG: spatial: Handle integer arrays in HalfspaceIntersection. +* [#16420](https://github.com/scipy/scipy/pull/16420): MAINT: next round of 1.9.0 backports +* [#16422](https://github.com/scipy/scipy/pull/16422): TST: fix test issues with casting-related warnings with numpy… +* [#16427](https://github.com/scipy/scipy/pull/16427): MAINT: stats.shapiro: don’t modify input in place +* [#16429](https://github.com/scipy/scipy/pull/16429): MAINT: stats.mode: revert gh-15423 +* [#16436](https://github.com/scipy/scipy/pull/16436): DOC: optimize: Mark deprecated linprog methods explicitly +* [#16444](https://github.com/scipy/scipy/pull/16444): BUG: fix fail to open tempfile in messagestream.pyx (#8850) +* [#16451](https://github.com/scipy/scipy/pull/16451): MAINT: few more 1.9.0 backports +* [#16453](https://github.com/scipy/scipy/pull/16453): DOC: Copy-edit 1.9.0-notes.rst +* [#16457](https://github.com/scipy/scipy/pull/16457): TST: skip 32-bit test\_pdist\_correlation\_iris\_nonC +* [#16458](https://github.com/scipy/scipy/pull/16458): MAINT: 1.9.0 backports +* [#16473](https://github.com/scipy/scipy/pull/16473): REL: update 1.9.0 release notes +* [#16482](https://github.com/scipy/scipy/pull/16482): DOC: Update Returns section of optimize.linprog. +* [#16484](https://github.com/scipy/scipy/pull/16484): MAINT: remove raw html from README.rst +* [#16485](https://github.com/scipy/scipy/pull/16485): BLD: fix warnings from f2py templating parsing +* [#16493](https://github.com/scipy/scipy/pull/16493): BLD: clean up unwanted files in sdist, via `.gitattributes` +* [#16507](https://github.com/scipy/scipy/pull/16507): REL: more tweaks to sdist contents +* [#16512](https://github.com/scipy/scipy/pull/16512): [1.9] MAINT: skip complex128 propack tests on windows +* [#16514](https://github.com/scipy/scipy/pull/16514): DOC: reflect correctly where windows wheels are built +* [#16526](https://github.com/scipy/scipy/pull/16526): MAINT: 1.9.0rc2 backports +* [#16530](https://github.com/scipy/scipy/pull/16530): MAINT: fix umfpack test failure with numpy 1.23 +* [#16539](https://github.com/scipy/scipy/pull/16539): MAINT: more 1.9.0rc2 backports +* [#16541](https://github.com/scipy/scipy/pull/16541): BLD: fix regression in building \_lsap with symbol visibility +* [#16549](https://github.com/scipy/scipy/pull/16549): BLD: fix an outdated requirement for macOS arm64 in pyproject.toml +* [#16551](https://github.com/scipy/scipy/pull/16551): BLD: fix `\_\_STDC\_VERSION\_\_` check in `special/\_round.h` +* [#16553](https://github.com/scipy/scipy/pull/16553): BLD: raise an error with clear message for too-new Python version +* [#16556](https://github.com/scipy/scipy/pull/16556): DOC: small tweaks to 1.9.0 release notes +* [#16563](https://github.com/scipy/scipy/pull/16563): DOC: Reflect MSVC minimum toolchain requirement +* [#16570](https://github.com/scipy/scipy/pull/16570): MAINT: backports before 1.9.0rc3 +* [#16572](https://github.com/scipy/scipy/pull/16572): MAINT: update bundled licenses for removal of scipy-sphinx-theme +* [#16581](https://github.com/scipy/scipy/pull/16581): MAINT: stats: fix skew/kurtosis empty 1d input +* [#16586](https://github.com/scipy/scipy/pull/16586): MAINT: stats.truncnorm: improve CDF accuracy/speed +* [#16593](https://github.com/scipy/scipy/pull/16593): TST: stats: replace TestTruncnorm::test\_moments +* [#16599](https://github.com/scipy/scipy/pull/16599): MAINT: stats.truncnorm.rvs: improve performance +* [#16605](https://github.com/scipy/scipy/pull/16605): MAINT: stats.truncnorm: simplify remaining methods +* [#16622](https://github.com/scipy/scipy/pull/16622): ENH: FIX: update HiGHS submodule to resolve MIP infeasibility… +* [#16638](https://github.com/scipy/scipy/pull/16638): DOC: update docs on building with Meson +* [#16664](https://github.com/scipy/scipy/pull/16664): MAINT: stats.\_axis\_nan\_policy: preserve dtype of masked arrays… +* [#16671](https://github.com/scipy/scipy/pull/16671): BLD: update `meson` and `meson-python` versions for 1.9.0… +* [#16684](https://github.com/scipy/scipy/pull/16684): MAINT: optimize.linprog: ensure integrality can be an array +* [#16688](https://github.com/scipy/scipy/pull/16688): DOC: a few mailmap updates +* [#16719](https://github.com/scipy/scipy/pull/16719): MAINT: stats: Work around Cython bug. +* [#16721](https://github.com/scipy/scipy/pull/16721): MAINT: stats.monte\_carlo\_test: used biased estimate of p-value diff --git a/corpus/changelog/scipy_releases/scipy_191.md b/corpus/changelog/scipy_releases/scipy_191.md new file mode 100644 index 0000000000000000000000000000000000000000..bc49394a2f3e44914307294f49cabfe72bf5e865 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_191.md @@ -0,0 +1,57 @@ +# SciPy 1.9.1 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.9.1-notes.html +Version: 1.9.1 + +Contents + +* [SciPy 1.9.1 Release Notes](#scipy-1-9-1-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.9.1](#issues-closed-for-1-9-1) + - [Pull requests for 1.9.1](#pull-requests-for-1-9-1) + +SciPy 1.9.1 is a bug-fix release with no new features +compared to 1.9.0. Notably, some important meson build +fixes are included. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Anirudh Dagar (1) +* Ralf Gommers (12) +* Matt Haberland (2) +* Andrew Nelson (1) +* Tyler Reddy (14) +* Atsushi Sakai (1) +* Eli Schwartz (1) +* Warren Weckesser (2) + +A total of 8 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.9.1](#id3)[#](#issues-closed-for-1-9-1 "Link to this heading") + +* [#14517](https://github.com/scipy/scipy/issues/14517): scipy/linalg/tests/test\_decomp.py::TestSchur::test\_sort test… +* [#16765](https://github.com/scipy/scipy/issues/16765): DOC: `scipy.stats.skew` no longer returns 0 on constant input +* [#16787](https://github.com/scipy/scipy/issues/16787): BUG: Can’t build 1.10 with mingw-w64 toolchain and numpy 1.21.6… +* [#16813](https://github.com/scipy/scipy/issues/16813): BUG: scipy.interpolate interp1d extrapolate behaviour change… +* [#16878](https://github.com/scipy/scipy/issues/16878): BUG: optimize.milp fails to execute when given exactly 3 constraints + +### [Pull requests for 1.9.1](#id4)[#](#pull-requests-for-1-9-1 "Link to this heading") + +* [#16709](https://github.com/scipy/scipy/pull/16709): BLD: make the way we count commits for version numbering more… +* [#16736](https://github.com/scipy/scipy/pull/16736): REL: prep for SciPy 1.9.1 +* [#16749](https://github.com/scipy/scipy/pull/16749): BLD: install missing `.pxd` files, and update TODOs/FIXMEs… +* [#16750](https://github.com/scipy/scipy/pull/16750): BLD: make OpenBLAS detection work with CMake +* [#16755](https://github.com/scipy/scipy/pull/16755): TST: sparse.linalg: Loosen tolerance for the lobpcg test ‘test\_tolerance\_float32’ +* [#16760](https://github.com/scipy/scipy/pull/16760): BLD: use a bit more idiomatic approach to constructing paths… +* [#16768](https://github.com/scipy/scipy/pull/16768): DOC: stats.skew/kurtosis: returns NaN when input has only one… +* [#16794](https://github.com/scipy/scipy/pull/16794): BLD/REL: on Windows use numpy 1.22.3 as the version to build… +* [#16822](https://github.com/scipy/scipy/pull/16822): BUG/TST: linalg: Check the results of ‘schur’ more carefully. +* [#16825](https://github.com/scipy/scipy/pull/16825): BUG: interpolate: fix “previous” and “next” extrapolate logic… +* [#16862](https://github.com/scipy/scipy/pull/16862): BUG, DOC: Fix sphinx autosummary generation for `odr` and `czt` +* [#16881](https://github.com/scipy/scipy/pull/16881): MAINT: optimize.milp: fix input validation when three constraints… +* [#16901](https://github.com/scipy/scipy/pull/16901): MAINT: 1.9.1 backports +* [#16904](https://github.com/scipy/scipy/pull/16904): BLD: update dependency ranges for meson-python and pybind11 for… diff --git a/corpus/changelog/scipy_releases/scipy_192.md b/corpus/changelog/scipy_releases/scipy_192.md new file mode 100644 index 0000000000000000000000000000000000000000..90f0d79645c3769927727f1b8d6bd5e6764b7858 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_192.md @@ -0,0 +1,75 @@ +# SciPy 1.9.2 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.9.2-notes.html +Version: 1.9.2 + +Contents + +* [SciPy 1.9.2 Release Notes](#scipy-1-9-2-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.9.2](#issues-closed-for-1-9-2) + - [Pull requests for 1.9.2](#pull-requests-for-1-9-2) + +SciPy 1.9.2 is a bug-fix release with no new features +compared to 1.9.1. It also provides wheel for Python 3.11 +on several platforms. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Hood Chatham (1) +* Thomas J. Fan (1) +* Ralf Gommers (22) +* Matt Haberland (5) +* Julien Jerphanion (1) +* Loïc Estève (1) +* Nicholas McKibben (2) +* Naoto Mizuno (1) +* Andrew Nelson (3) +* Tyler Reddy (28) +* Pamphile Roy (1) +* Ewout ter Hoeven (2) +* Warren Weckesser (1) +* Meekail Zain (1) + + +A total of 14 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.9.2](#id3)[#](#issues-closed-for-1-9-2 "Link to this heading") + +* [#16545](https://github.com/scipy/scipy/issues/16545): BUG: 1.9.0rc1: `OptimizeResult` not populated when `optimize.milp`… +* [#16569](https://github.com/scipy/scipy/issues/16569): BUG: `sparse.hstack` returns incorrect result when the stack… +* [#16898](https://github.com/scipy/scipy/issues/16898): BUG: optimize.minimize backwards compatability in scipy 1.9 +* [#16935](https://github.com/scipy/scipy/issues/16935): BUG: using msvc + meson to build scipy –> cl cannot be used… +* [#16952](https://github.com/scipy/scipy/issues/16952): BUG: error from `scipy.stats.mode` with `NaN`s, `axis !=… +* [#16964](https://github.com/scipy/scipy/issues/16964): BUG: scipy 1.7.3 wheels on PyPI require numpy<1.23 in contradiction… +* [#17026](https://github.com/scipy/scipy/issues/17026): BUG: ncf\_gen::ppf(..) causes segfault +* [#17050](https://github.com/scipy/scipy/issues/17050): Pearson3 PPF does not function properly with negative skew. +* [#17124](https://github.com/scipy/scipy/issues/17124): BUG: OSX-64 Test failure test\_ppf\_against\_tables getting NaN + +### [Pull requests for 1.9.2](#id4)[#](#pull-requests-for-1-9-2 "Link to this heading") + +* [#16628](https://github.com/scipy/scipy/pull/16628): FIX: Updated dtype resolution in `\_stack\_along\_minor\_axis` +* [#16814](https://github.com/scipy/scipy/pull/16814): FIX: milp: return feasible solutions if available on time out +* [#16842](https://github.com/scipy/scipy/pull/16842): ENH: cibuildwheel infrastructure +* [#16909](https://github.com/scipy/scipy/pull/16909): MAINT: minimize, restore squeezed ((1.0)) addresses #16898 +* [#16911](https://github.com/scipy/scipy/pull/16911): REL: prep for SciPy 1.9.2 +* [#16922](https://github.com/scipy/scipy/pull/16922): DOC: update version switcher for 1.9.1 and pin theme to 0.9 +* [#16934](https://github.com/scipy/scipy/pull/16934): MAINT: cast `linear\_sum\_assignment` to PyCFunction +* [#16943](https://github.com/scipy/scipy/pull/16943): BLD: use compiler flags in a more portable way +* [#16954](https://github.com/scipy/scipy/pull/16954): MAINT: stats.mode: fix bug with `axis!=1`, `nan\_policy=’omit’`,… +* [#16966](https://github.com/scipy/scipy/pull/16966): MAINT: fix NumPy upper bound +* [#16969](https://github.com/scipy/scipy/pull/16969): BLD: fix usage of `get\_install\_data`, which defaults to purelib +* [#16975](https://github.com/scipy/scipy/pull/16975): DOC: Update numpy supported versions for 1.9.2 +* [#16991](https://github.com/scipy/scipy/pull/16991): BLD: fixes for building with MSVC and Intel Fortran +* [#17011](https://github.com/scipy/scipy/pull/17011): Rudimentary test for manylinux\_aarch64 with cibuildwheel +* [#17013](https://github.com/scipy/scipy/pull/17013): BLD: make MKL detection a little more robust, add notes on TODOs +* [#17046](https://github.com/scipy/scipy/pull/17046): CI: Update cibuildwheel to 2.10.1 +* [#17055](https://github.com/scipy/scipy/pull/17055): MAINT: stats.pearson3: fix ppf for negative skew +* [#17064](https://github.com/scipy/scipy/pull/17064): BUG: Fix numerical precision error of `truncnorm.logcdf` when… +* [#17096](https://github.com/scipy/scipy/pull/17096): FIX: ensure a hold on GIL before raising warnings/errors +* [#17127](https://github.com/scipy/scipy/pull/17127): TST: stats.studentized\_range: fix incorrect test +* [#17131](https://github.com/scipy/scipy/pull/17131): MAINT: pyproject.toml: Update build system requirements +* [#17132](https://github.com/scipy/scipy/pull/17132): MAINT: 1.9.2 backports diff --git a/corpus/changelog/scipy_releases/scipy_193.md b/corpus/changelog/scipy_releases/scipy_193.md new file mode 100644 index 0000000000000000000000000000000000000000..c804a5a2ef3ed979ce79df988cf8b25051122a86 --- /dev/null +++ b/corpus/changelog/scipy_releases/scipy_193.md @@ -0,0 +1,126 @@ +# SciPy 1.9.3 Release Notes# + +Source: https://docs.scipy.org/doc/scipy/release/1.9.3-notes.html +Version: 1.9.3 + +Contents + +* [SciPy 1.9.3 Release Notes](#scipy-1-9-3-release-notes) + + + [Authors](#authors) + + - [Issues closed for 1.9.3](#issues-closed-for-1-9-3) + - [Pull requests for 1.9.3](#pull-requests-for-1-9-3) + +SciPy 1.9.3 is a bug-fix release with no new features +compared to 1.9.2. + +## [Authors](#id2)[#](#authors "Link to this heading") + +* Jelle Aalbers (1) +* Peter Bell (1) +* Jake Bowhay (3) +* Matthew Brett (3) +* Evgeni Burovski (5) +* drpeteb (1) + +* Sebastian Ehlert (1) + +* GavinZhang (1) + +* Ralf Gommers (2) +* Matt Haberland (15) +* Lakshaya Inani (1) + +* Joseph T. Iosue (1) +* Nathan Jacobi (1) + +* jmkuebler (1) + +* Nikita Karetnikov (1) + +* Lechnio (1) + +* Nicholas McKibben (1) +* Andrew Nelson (1) +* o-alexandre-felipe (1) + +* Tirth Patel (1) +* Tyler Reddy (51) +* Martin Reinecke (1) +* Marie Roald (1) + +* Pamphile Roy (2) +* Eli Schwartz (1) +* serge-sans-paille (1) +* ehsan shirvanian (1) + +* Mamoru TASAKA (1) + +* Samuel Wallan (1) +* Warren Weckesser (7) +* Gavin Zhang (1) + + +A total of 31 people contributed to this release. +People with a “+” by their names contributed a patch for the first time. +This list of names is automatically generated, and may not be fully complete. + +### [Issues closed for 1.9.3](#id3)[#](#issues-closed-for-1-9-3 "Link to this heading") + +* [#3691](https://github.com/scipy/scipy/issues/3691): scipy.interpolate.UnivariateSpline segfault +* [#5286](https://github.com/scipy/scipy/issues/5286): BUG: multivariate\_normal returns a pdf for values outside its… +* [#6551](https://github.com/scipy/scipy/issues/6551): BUG: stats: inconsistency in docs and behavior of gmean and hmean +* [#9245](https://github.com/scipy/scipy/issues/9245): running scipy.interpolate.tests.test\_fitpack::test\_bisplev\_integer\_overflow… +* [#12471](https://github.com/scipy/scipy/issues/12471): test\_bisplev\_integer\_overflow: Segmentation fault (core dumped) +* [#13321](https://github.com/scipy/scipy/issues/13321): Bug: setting iprint=0 hides all output from fmin\_l\_bfgs\_b, but… +* [#13730](https://github.com/scipy/scipy/issues/13730): `scipy.stats.mood` does not correct for ties +* [#14019](https://github.com/scipy/scipy/issues/14019): ks\_2samp throws `RuntimeWarning: overflow encountered in double\_scalars` +* [#14589](https://github.com/scipy/scipy/issues/14589): `shgo` error since scipy 1.8.0.dev0+1529.803e52d +* [#14591](https://github.com/scipy/scipy/issues/14591): Input data validation for RectSphereBivariateSpline +* [#15101](https://github.com/scipy/scipy/issues/15101): BUG: binom.pmf - RuntimeWarning: divide by zero +* [#15342](https://github.com/scipy/scipy/issues/15342): BUG: scipy.optimize.minimize: Powell’s method function evaluated… +* [#15964](https://github.com/scipy/scipy/issues/15964): BUG: lombscargle fails if argument is a view +* [#16211](https://github.com/scipy/scipy/issues/16211): BUG: Possible bug when using winsorize on pandas data instead… +* [#16459](https://github.com/scipy/scipy/issues/16459): BUG: stats.ttest\_ind returns wrong p-values with permutations +* [#16500](https://github.com/scipy/scipy/issues/16500): odr.Model default meta value fails with \_\_getattr\_\_ +* [#16519](https://github.com/scipy/scipy/issues/16519): BUG: Error in error message for incorrect sample dimension in… +* [#16527](https://github.com/scipy/scipy/issues/16527): BUG: dimension of isuppz in syevr is mistranslated +* [#16600](https://github.com/scipy/scipy/issues/16600): BUG: `KDTree`’s optional argument `eps` seems to have no… +* [#16656](https://github.com/scipy/scipy/issues/16656): dtype not preserved with operations on sparse arrays +* [#16751](https://github.com/scipy/scipy/issues/16751): BUG: `stats.fit` on `boltzmann` expects `bound` for `lambda`,… +* [#17012](https://github.com/scipy/scipy/issues/17012): BUG: Small oversight in sparse.linalg.lsmr? +* [#17020](https://github.com/scipy/scipy/issues/17020): BUG: Build failure due to problems with shebang line in cythoner.py +* [#17088](https://github.com/scipy/scipy/issues/17088): BUG: stats.rayleigh.fit: returns `loc` that is inconsistent… +* [#17104](https://github.com/scipy/scipy/issues/17104): BUG? Incorrect branch in `LAMV` / `\_specfunc.lamv` +* [#17196](https://github.com/scipy/scipy/issues/17196): DOC: keepdims in stats.mode is incorrectly documented + +### [Pull requests for 1.9.3](#id4)[#](#pull-requests-for-1-9-3 "Link to this heading") + +* [#5288](https://github.com/scipy/scipy/pull/5288): BUG: multivariate\_normal returns a pdf for values outside its… +* [#13322](https://github.com/scipy/scipy/pull/13322): Bug: setting iprint=0 hides all output from fmin\_l\_bfgs\_b, but… +* [#13349](https://github.com/scipy/scipy/pull/13349): BUG: stats: Reformulate loggamma.\_rvs to handle c << 1. +* [#13411](https://github.com/scipy/scipy/pull/13411): BUG: fix out-of-bound evaluations in optimize.minimize, powell… +* [#15363](https://github.com/scipy/scipy/pull/15363): BUG: fix powell evaluated outside limits +* [#15381](https://github.com/scipy/scipy/pull/15381): BUG: fix stats.rv\_histogram for non-uniform bins +* [#16212](https://github.com/scipy/scipy/pull/16212): stats.mood: correct for when ties are present +* [#16288](https://github.com/scipy/scipy/pull/16288): BUG: fix a crash in `fpknot` +* [#16318](https://github.com/scipy/scipy/pull/16318): MAINT: stats: fix \_contains\_nan on Pandas Series +* [#16460](https://github.com/scipy/scipy/pull/16460): Fix ttest permutations +* [#16506](https://github.com/scipy/scipy/pull/16506): MAINT: fix SHGO extra arguments +* [#16521](https://github.com/scipy/scipy/pull/16521): BUG: Fix error in error message for incorrect sample dimension… +* [#16525](https://github.com/scipy/scipy/pull/16525): MAINT: stats.ks\_2samp: always emit warning when exact method… +* [#16528](https://github.com/scipy/scipy/pull/16528): BUG: fix syevr series segfault by explicitly specifying operator… +* [#16562](https://github.com/scipy/scipy/pull/16562): BUG: optimize: Fix differential\_evolution error message. +* [#16573](https://github.com/scipy/scipy/pull/16573): FIX: `odr.Model` error with default `meta` value +* [#16588](https://github.com/scipy/scipy/pull/16588): FIX: stats: ignore divide-by-zero warnings from Boost binom impl +* [#16590](https://github.com/scipy/scipy/pull/16590): MAINT: stats.vonmises: wrap rvs to -pi, pi interval +* [#16630](https://github.com/scipy/scipy/pull/16630): BUG: eps param no effect fixed +* [#16645](https://github.com/scipy/scipy/pull/16645): MAINT: Ensure Pythran input for lombscargle are contiguous +* [#16649](https://github.com/scipy/scipy/pull/16649): Detect integer overflow in bivariate splines in fitpackmodule.c,… +* [#16657](https://github.com/scipy/scipy/pull/16657): BUG: sparse: Fix indexing sparse matrix with empty index arguments. +* [#16669](https://github.com/scipy/scipy/pull/16669): FIX: spurious divide error with `gmean` +* [#16701](https://github.com/scipy/scipy/pull/16701): BUG: fix mutable data types as default arguments in `ord.{Data,RealData}` +* [#16752](https://github.com/scipy/scipy/pull/16752): MAINT: stats.boltzmann: correct \_shape\_info typo +* [#16780](https://github.com/scipy/scipy/pull/16780): BUG: interpolate: sanity check x and y in make\_interp\_spline(x,… +* [#16836](https://github.com/scipy/scipy/pull/16836): MAINT: avoid `func\_data`, it conflicts with system header on… +* [#16872](https://github.com/scipy/scipy/pull/16872): BUG: interpolate: work array sizes for RectSphereBivariateSpline +* [#16965](https://github.com/scipy/scipy/pull/16965): BUG: linalg: Fix the XSLOW test test\_sgesdd\_lwork\_bug\_workaround() +* [#17043](https://github.com/scipy/scipy/pull/17043): MAINT: fix small LSMR problem +* [#17090](https://github.com/scipy/scipy/pull/17090): MAINT: stats.rayleigh: enforce constraint on location +* [#17105](https://github.com/scipy/scipy/pull/17105): FIX: special: use intended branching for `lamv` implementation +* [#17166](https://github.com/scipy/scipy/pull/17166): MAINT: stats.rv\_discrete.pmf: should be zero at non-integer argument +* [#17176](https://github.com/scipy/scipy/pull/17176): REL: Prep for SciPy 1.9.3 +* [#17190](https://github.com/scipy/scipy/pull/17190): BUG: special: Fix two XSLOW test failures. +* [#17193](https://github.com/scipy/scipy/pull/17193): MAINT: update meson.build to make it work on IBM i system +* [#17200](https://github.com/scipy/scipy/pull/17200): BLD: fix issue with incomplete threads dependency handling +* [#17204](https://github.com/scipy/scipy/pull/17204): Keepdims incorrectly documneted fix +* [#17209](https://github.com/scipy/scipy/pull/17209): MAINT: Handle numpy’s deprecation of accepting out-of-bound integers. +* [#17210](https://github.com/scipy/scipy/pull/17210): BLD: fix invalid shebang for build helper script diff --git a/corpus/changelog/tensorflow_releases/tensorflow_100.md b/corpus/changelog/tensorflow_releases/tensorflow_100.md new file mode 100644 index 0000000000000000000000000000000000000000..4d4ed8316b182feaa5299d9a8ea208e901e2088c --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_100.md @@ -0,0 +1,194 @@ +# TensorFlow 1.0.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v1.0.0 +Version: 1.0.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@yifeif](https://avatars.githubusercontent.com/u/1192265?s=40&v=4) +[yifeif](/yifeif) +released this +15 Feb 17:46 + +· +[71 commits](/tensorflow/tensorflow/compare/v1.0.0...r1.0) +to r1.0 +since this release + +[v1.0.0](/tensorflow/tensorflow/tree/v1.0.0) + +[`07bb8ea`](/tensorflow/tensorflow/commit/07bb8ea2379bd459832b23951fb20ec47f3fdbd4) + +## Major Features and Improvements + +* XLA (experimental): initial release of [XLA](https://www.tensorflow.org/versions/master/experimental/xla/), a domain-specific compiler for TensorFlow graphs, that targets CPUs and GPUs. +* TensorFlow Debugger (tfdbg): command-line interface and API. +* New python 3 docker images added. +* Made pip packages pypi compliant. TensorFlow can now be installed by `pip install tensorflow` command. +* Several python API calls have been changed to resemble NumPy more closely. +* New (experimental) [Java API](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/java). +* Android: new person detection + tracking demo implementing "Scalable Object Detection using Deep Neural Networks" (with additional YOLO object detector support) +* Android: new camera-based image stylization demo based on "A Learned Representation For Artistic Style" + +## Breaking Changes to the API + +To help you upgrade your existing TensorFlow Python code to match the API changes below, we have prepared a [conversion script](https://github.com/tensorflow/tensorflow/tree/r1.0/tensorflow/tools/compatibility). + +* TensorFlow/models have been moved to a separate github repository. +* Division and modulus operators (/, //, %) now match Python (flooring) + semantics. This applies to `tf.div` and `tf.mod` as well. To obtain forced + integer truncation based behaviors you can use `tf.truncatediv` + and `tf.truncatemod`. +* `tf.divide()` is now the recommended division function. `tf.div()` will + remain, but its semantics do not respond to Python 3 or `from future` + mechanisms. +* tf.reverse() now takes indices of axes to be reversed. E.g. + `tf.reverse(a, [True, False, True])` must now be written as + `tf.reverse(a, [0, 2])`. `tf.reverse_v2()` will remain until 1.0 final. +* `tf.mul`, `tf.sub` and `tf.neg` are deprecated in favor of `tf.multiply`, + `tf.subtract` and `tf.negative`. +* `tf.pack` and `tf.unpack` are deprecated in favor of `tf.stack` and + `tf.unstack`. +* `TensorArray.pack` and `TensorArray.unpack` are getting deprecated in favor of + `TensorArray.stack` and `TensorArray.unstack`. +* The following Python functions have had their arguments changed to use `axis` + when referring to specific dimensions. We have kept the old keyword arguments + for compatibility currently, but we will be removing them well before the + final 1.0. + + `tf.argmax`: `dimension` becomes `axis` + + `tf.argmin`: `dimension` becomes `axis` + + `tf.count_nonzero`: `reduction_indices` becomes `axis` + + `tf.expand_dims`: `dim` becomes `axis` + + `tf.reduce_all`: `reduction_indices` becomes `axis` + + `tf.reduce_any`: `reduction_indices` becomes `axis` + + `tf.reduce_join`: `reduction_indices` becomes `axis` + + `tf.reduce_logsumexp`: `reduction_indices` becomes `axis` + + `tf.reduce_max`: `reduction_indices` becomes `axis` + + `tf.reduce_mean`: `reduction_indices` becomes `axis` + + `tf.reduce_min`: `reduction_indices` becomes `axis` + + `tf.reduce_prod`: `reduction_indices` becomes `axis` + + `tf.reduce_sum`: `reduction_indices` becomes `axis` + + `tf.reverse_sequence`: `batch_dim` becomes `batch_axis`, `seq_dim` becomes `seq_axis` + + `tf.sparse_concat`: `concat_dim` becomes `axis` + + `tf.sparse_reduce_sum`: `reduction_axes` becomes `axis` + + `tf.sparse_reduce_sum_sparse`: `reduction_axes` becomes `axis` + + `tf.sparse_split`: `split_dim` becomes `axis` +* `tf.listdiff` has been renamed to `tf.setdiff1d` to match NumPy naming. +* `tf.inv` has been renamed to be `tf.reciprocal` (component-wise reciprocal) + to avoid confusion with `np.inv` which is matrix inversion +* tf.round now uses banker's rounding (round to even) semantics to match NumPy. +* `tf.split` now takes arguments in a reversed order and with different + keywords. In particular, we now match NumPy order as + `tf.split(value, num_or_size_splits, axis)`. +* `tf.sparse_split` now takes arguments in reversed order and with different + keywords. In particular we now match NumPy order as + `tf.sparse_split(sp_input, num_split, axis)`. NOTE: we have temporarily + made `tf.sparse_split` require keyword arguments. +* `tf.concat` now takes arguments in reversed order and with different keywords. In particular we now match NumPy order as `tf.concat(values, axis, name)`. +* `tf.image.decode_jpeg` by default uses the faster DCT method, sacrificing + a little fidelity for improved speed. One can revert to the old + behavior by specifying the attribute `dct_method='INTEGER_ACCURATE'`. +* `tf.complex_abs` has been removed from the Python interface. `tf.abs` + supports complex tensors and should be used instead. +* Template.`var_scope` property renamed to `.variable_scope` +* SyncReplicasOptimizer is removed and SyncReplicasOptimizerV2 renamed to SyncReplicasOptimizer. +* `tf.zeros_initializer()` and `tf.ones_initializer()` now return a callable + that must be called with initializer arguments, in your code replace + `tf.zeros_initializer` with `tf.zeros_initializer()`. +* `SparseTensor.shape` has been renamed to `SparseTensor.dense_shape`. Same for + `SparseTensorValue.shape`. +* Replace tf.scalar\_summary, tf.histogram\_summary, tf.audio\_summary, tf.image\_summary with tf.summary.scalar, tf.summary.histogram, tf.summary.audio, tf.summary.image, respectively. The new summary ops take name rather than tag as their first argument, meaning summary ops now respect TensorFlow name scopes. +* Replace tf.train.SummaryWriter and tf.train.SummaryWriterCache with tf.summary.FileWriter and tf.summary.FileWriterCache. +* Removes RegisterShape from public API. Use C++ shape function registration + instead. +* Deprecated `_ref` dtypes from the python API. +* In the C++ API (in tensorflow/cc), Input, Output, etc. have moved + from the tensorflow::ops namespace to tensorflow. +* Change arg order for `{softmax,sparse_softmax,sigmoid}_cross_entropy_with_logits` to be (labels, predictions), and force use of named args. +* tf.nn.rnn\_cell.\* and most functions in tf.nn.rnn.\* (with the exception of dynamic\_rnn and raw\_rnn) are temporarily in tf.contrib.rnn. They will be moved back into core for TF 1.1. + +## Bug Fixes and Other Changes + +* Numerous C++ API updates. +* New op: `parallel_stack`. +* Introducing common tf io compression options constants for + RecordReader/RecordWriter. +* Add `sparse_column_with_vocabulary_file`, to specify a feature column that + transform string features to IDs, where the mapping is defined by a vocabulary + file. +* Added `index_to_string_table` which returns a lookup table that maps indices to + strings. +* Add `string_to_index_table`, which returns a lookup table that matches strings + to indices. +* Add a `ParallelForWithWorkerId` function. +* Add `string_to_index_table`, which returns a lookup table that matches strings + to indices. +* Support restore session from checkpoint files in v2 in `contrib/session_bundle`. +* Added a tf.contrib.image.rotate function for arbitrary angles. +* Added `tf.contrib.framework.filter_variables` as a convenience function to + filter lists of variables based on regular expressions. +* `make_template()` takes an optional `custom_getter_ param`. +* Added comment about how existing directories are handled by + `recursive_create_dir`. +* Added an op for QR factorizations. +* Divides and mods in Python API now use flooring (Python) semantics. +* Android: pre-built libs are now built nightly. +* Android: cmake/gradle build for TensorFlow Inference library under + `contrib/android/cmake` +* Android: Much more robust Session initialization code. +* Android: TF stats now exposed directly in demo and log when debug mode is + active +* Android: new/better README.md documentation +* saved\_model is available as `tf.saved_model`. +* Empty op is now stateful. +* Improve speed of scatter\_update on the cpu for ASSIGN operations. +* Change `reduce_join` to treat `reduction_indices` in the same way as other `reduce_` ops. +* Move `TensorForestEstimator` to `contrib/tensor_forest`. +* Enable compiler optimizations by default and allow configuration in configure. +* `tf.divide` now honors the name field. +* Make metrics weight broadcasting more strict. +* Add new queue-like `StagingArea` and new ops: `stage` and `unstage`. +* Enable inplace update ops for strings on CPU. Speed up string concat. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +Aaron Hu, Abhishek Aggarwal, Adam Michael, Adriano Carmezim, [@AfirSraftGarrier](https://github.com/AfirSraftGarrier), +Alexander Novikov, Alexander Rosenberg Johansen, Andrew Gibiansky, Andrew Hundt, +Anish Shah, Anton Loss, [@b0noI](https://github.com/b0noI), [@BoyuanJiang](https://github.com/BoyuanJiang), Carl Thomé, Chad Kennedy, Comic +Chang, Connor Braa, Daniel N. Lang, Daniel Trebbien, +[@danielgordon10](https://github.com/danielgordon10), Darcy Liu, Darren Garvey, Dmitri Lapin, Eron Wright, Evan +Cofer, Fabrizio Milo, Finbarr Timbers, Franck Dernoncourt, Garrett Smith, +[@guschmue](https://github.com/guschmue), Hao Wei, Henrik Holst, Huazuo Gao, [@ian](https://github.com/ian), [@issac](https://github.com/issac), Jacob Israel, +Jangsoo Park, Jin Kim, Jingtian Peng, John Pope, Kye Bostelmann, Liangliang He, +Ling Zhang, Luheng He, Luke Iwanski, [@lvli](https://github.com/lvli), Michael Basilyan, Mihir Patel, +Mikalai Drabovich, Morten Just, [@newge](https://github.com/newge), Nick Butlin, Nishant Shukla, +Pengfei Ni, Przemyslaw Tredak, [@rasbt](https://github.com/rasbt), [@ronny](https://github.com/ronny), Rudolf Rosa, [@RustingSword](https://github.com/RustingSword), +Sam Abrahams, Sam Putnam, [@seongahjo](https://github.com/seongahjo), Shi Jiaxin, [@skavulya](https://github.com/skavulya), Steffen MüLler, +[@TheUSER123](https://github.com/TheUSER123), [@tiriplicamihai](https://github.com/tiriplicamihai), [@vhasanov](https://github.com/vhasanov), Victor Costan, Vit Stepanovs, +Wangda Tan, Wenjian Huang, Xingdong Zuo, Yaroslav Bulatov, Yota Toyama, +Yuan (Terry) Tang, Yuxin Wu + +We are also grateful to all who filed issues or helped resolve them, asked and +answered questions, and were part of inspiring discussions. diff --git a/corpus/changelog/tensorflow_releases/tensorflow_110.md b/corpus/changelog/tensorflow_releases/tensorflow_110.md new file mode 100644 index 0000000000000000000000000000000000000000..f94ff96c648bb1963e8402c639bc23edea04511a --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_110.md @@ -0,0 +1,154 @@ +# TensorFlow 1.1.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v1.1.0 +Version: 1.1.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@av8ramit](https://avatars.githubusercontent.com/u/5588272?s=40&v=4) +[av8ramit](/av8ramit) +released this +26 Apr 22:25 + +· +[13 commits](/tensorflow/tensorflow/compare/v1.1.0...r1.1) +to r1.1 +since this release + +[v1.1.0](/tensorflow/tensorflow/tree/v1.1.0) + +[`1ec6ed5`](/tensorflow/tensorflow/commit/1ec6ed51182adf8f1b03a3188c16cd8a45ca6c85) + +# Release 1.1.0 + +## Major Features and Improvements + +* Added Java API support for Windows. +* Added `tf.spectral` module. Moved existing FFT ops to `tf.spectral` while + keeping an alias in the old location (`tf.*`). +* Added 1D, 2D and 3D Fourier transform ops for real signals to `tf.spectral`. +* Added a `tf.bincount` function. +* Added Keras 2 API to contrib. +* Added a new lightweight queue-like object - `RecordInput`. +* Added `tf.contrib.image.compose_transforms` function. +* Bring `tf.estimator.*` into the API. Non-deprecated functionality from `tf.contrib.learn.Estimator` is moved to `tf.estimator.Estimator` with cosmetic changes. +* Docker images: TF images on gcr.io and Docker Hub are upgraded to ubuntu:16.04. +* Added the following features to TensorFlow Debugger (tfdbg): + + Ability to inspect Python source file against TF ops and tensors (command `print_source` / `ps`) + + New navigation bar in Curses-based UI + + NodeStepper (command `invoke_stepper`) now uses intermediate tensor dumps. It also uses `TensorHandles` as direct feeds during successive `cont` calls for improved performance and reduced memory consumption. +* Initial release of installation guides for Java, C, and Go. +* Added Text Dashboard to TensorBoard. + +## Deprecations + +* TensorFlow 1.1.0 will be the last time we release a binary with Mac GPU support. Going forward, we will stop testing on Mac GPU systems. We continue to welcome patches that maintain Mac GPU support, and we will try to keep the Mac GPU build working. + +## Changes to contrib APIs + +* The behavior of RNNCells is now stricter due to the transition towards making RNNCells act more like Keras layers. + + If an RNNCell is used twice in two different variable scopes, an error is raised describing how to avoid this behavior. + + If an RNNCell is used in a variable scope with existing conflicting variables, an error is raised showing that the RNNCell must be constructed with argument `reuse=True`. +* Deprecated contrib/distributions `pmf`, `pdf`, `log_pmf`, `log_pdf`. +* Moved `bayesflow.special_math` to distributions. +* `tf.contrib.tensor_forest.python.tensor_forest.RandomForestDeviceAssigner` removed. +* Changed some MVN classes and parameters: + + `tf.contrib.distributions.MultivariateNormalFull` replaced by `tf.contrib.distributions.MultivariateNormalTriL`. + + `tf.contrib.distributions.MultivariateNormalCholesky` replaced by `tf.contrib.distributions.MultivariateNormalTriL` + + `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusStDev` replaced + by `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale` + + `tf.contrib.distributions.MultivariateNormalDiag` arguments changed from `mu`, `diag_stddev` to `log`, `scale_diag`. + + `tf.contrib.distributions.MultivariateNormalDiagPlusVDVT` removed. + + `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank` added. + +## Bug Fixes and Other Changes + +* Java: Support for loading models exported using the SavedModel API (courtesy [@EronWright](https://github.com/EronWright)). +* Go: Added support for incremental graph execution. +* Fix a bug in the WALS solver when single-threaded. +* Added support for integer sparse feature values in `tf.contrib.layers.sparse_column_with_keys`. +* Fixed `tf.set_random_seed(0)` to be deterministic for all ops. +* Stability improvements for the GCS file system support. +* Improved TensorForest performance. +* Added support for multiple filename globs in `tf.matching_files`. +* `LogMessage` now includes a timestamp as beginning of a message. +* Added MultiBox person detector example standalone binary. +* Android demo: Makefile build functionality added to build.gradle to fully support building TensorFlow demo in Android on Windows. +* Android demo: read MultiBox priors from txt file rather than protobuf. +* Added colocation constraints to `StagingArea`. +* `sparse_matmul_op` reenabled for Android builds. +* Restrict weights rank to be the same as the broadcast target, to avoid ambiguity on broadcast rules. +* Upgraded libxsmm to 1.7.1 and applied other changes for performance and memory usage. +* Fixed bfloat16 integration of LIBXSMM sparse mat-mul. +* Improved performance and reduce memory usage by allowing ops to forward input buffers to output buffers and perform computations in-place. +* Improved the performance of CPU assignment for strings. +* Speed up matrix \* vector multiplication and matrix \* matrix with unknown shapes. +* C API: Graph imports now support input remapping, control dependencies, and returning imported nodes (see `TF_GraphImportGraphDefWithReturnOutputs()`) +* Multiple C++ API updates. +* Multiple TensorBoard updates including: + + Users can now view image summaries at various sampled steps (instead of just the last step). + + Bugs involving switching runs as well as the image dashboard are fixed. + + Removed data download links from TensorBoard. + + TensorBoard uses a relative data directory, for easier embedding. + + TensorBoard automatically ignores outliers for domain calculation, and formats proportional values consistently. +* Multiple tfdbg bug fixes: + + Fixed Windows compatibility issues. + + Command history now persists across runs. + + Bug fix in graph validation related to `tf.while_loops`. +* Java Maven fixes for bugs with Windows installation. +* Backport fixes and improvements from external keras. +* Keras config file handling fix. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +A. Besir Kurtulmus, Adal Chiriliuc, [@akash](https://github.com/akash), Alec-Desouza, Alex Rothberg, Alex +Sergeev, Alexander Heinecke, Allen Guo, Andreas Madsen, Ankesh Anand, Anton +Loss, [@aravind](https://github.com/aravind), [@Arie](https://github.com/Arie), Ashutosh Das, AuréLien Geron, Bairen Yi, [@bakunyo](https://github.com/bakunyo), Ben +Visser, Brady Zhou, Calpa Liu, Changming Sun, Chih Cheng Liang, Christopher +Berner, Clark Zinzow, [@Conchylicultor](https://github.com/Conchylicultor), Dan Ellis, Dan J, Dan Jarvis, Daniel +Ylitalo, Darren Garvey, David Norman, David Truong, [@DavidNorman](https://github.com/DavidNorman), Dimitar +Pavlov, Dmitry Persiyanov, [@eddie](https://github.com/eddie), [@elirex](https://github.com/elirex), Erfan Noury, Eron Wright, Evgeny +Mazovetskiy, Fabrizio (Misto) Milo, [@fanlu](https://github.com/fanlu), Fisher Coder, Florian Courtial, +Franck Dernoncourt, Gagan Goel, Gao, Xiang, [@Gautam](https://github.com/Gautam), Gefu Tang, [@guilherme](https://github.com/guilherme), +[@guschmue](https://github.com/guschmue), Hannah Provenza, Hans Pabst, [@hartb](https://github.com/hartb), Hsiao Yi, Huazuo Gao, Igor +ChorążEwicz, Ivan Smirnov, Jakub Kolodziejczyk, Jason Gavris, Jason Morton, Jay +Young, Jayaram Bobba, Jeremy Sawruk, Jiaming Liu, Jihun Choi, [@jiqiu](https://github.com/jiqiu), Joan Thibault, +John C F, Jojy George Varghese, Jon Malmaud, Julian Berman, Julian Niedermeier, +Junpeng Lao, Kai Sasaki, @Kankroc, Karl Lessard, Kyle Bostelmann, [@lezcano](https://github.com/lezcano), Li +Yi, Luo Yun, [@lurker](https://github.com/lurker), Mahmoud-Abuzaina, Mandeep Singh, Marek Kolodziej, Mark +Szepieniec, Martial Hue, Medhat Omr, Memo Akten, Michael Gharbi, MichaëL Defferrard, +Milan Straka, [@MircoT](https://github.com/MircoT), [@mlucool](https://github.com/mlucool), Muammar Ibn Faisal, Nayana Thorat, [@nghiattran](https://github.com/nghiattran), +Nicholas Connor, Nikolaas Steenbergen, Niraj Patel, Niranjan Hasabnis, [@panmari](https://github.com/panmari), +Pavel Bulanov, Philip Pries Henningsen, Philipp Jund, [@polonez](https://github.com/polonez), Prayag Verma, Rahul +Kavi, Raphael Gontijo Lopes, [@rasbt](https://github.com/rasbt), Raven Iqqe, Reid Pryzant, Richard Shin, Rizwan +Asif, Russell Kaplan, Ryo Asakura, RüDiger Busche, Saisai Shao, Sam Abrahams, [@sanosay](https://github.com/sanosay), +Sean Papay, [@SeaOtterMan](https://github.com/SeaOtterMan), [@selay01](https://github.com/selay01), Shaurya Sharma, Sriram Narayanamoorthy, Stefano +Probst, [@taknevski](https://github.com/taknevski), [@tbonza](https://github.com/tbonza), [@teldridge11](https://github.com/teldridge11), Tim Anglade, Tomas Reimers, Tomer Gafner, +Valentin Iovene, Vamsi Sripathi, Viktor Malyi, Vit Stepanovs, Vivek Rane, Vlad Firoiu, +[@wangg12](https://github.com/wangg12), [@will](https://github.com/will), Xiaoyu Tao, Yaroslav Bulatov, Yi Liu, Yuan (Terry) Tang, [@yufeng](https://github.com/yufeng), +Yuming Wang, Yuxin Wu, Zafar Takhirov, Ziming Dong + +We are also grateful to all who filed issues or helped resolve them, asked and +answered questions, and were part of inspiring discussions. diff --git a/corpus/changelog/tensorflow_releases/tensorflow_1100.md b/corpus/changelog/tensorflow_releases/tensorflow_1100.md new file mode 100644 index 0000000000000000000000000000000000000000..185b3f0bf2702e768951a34598abd6fe71d17bf7 --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_1100.md @@ -0,0 +1,120 @@ +# TensorFlow 1.10.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v1.10.0 +Version: 1.10.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@av8ramit](https://avatars.githubusercontent.com/u/5588272?s=40&v=4) +[av8ramit](/av8ramit) +released this +08 Aug 20:25 + +· +[12 commits](/tensorflow/tensorflow/compare/v1.10.0...r1.10) +to r1.10 +since this release + +[v1.10.0](/tensorflow/tensorflow/tree/v1.10.0) + +[`656e7a2`](/tensorflow/tensorflow/commit/656e7a2b347c3c6eb76a6c130ed4b1def567b6c1) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 1.10.0 + +## Major Features And Improvements + +* The `tf.lite` runtime now supports `complex64`. +* Initial Bigtable integration for `tf.data`. +* Improved local run behavior in `tf.estimator.train_and_evaluate` which does not reload checkpoints for evaluation. +* `RunConfig` now sets device\_filters to restrict how workers and PS can communicate. This can speed up training and ensure clean shutdowns in some situations. But if you have jobs that require communication between workers, you will have to set custom session\_options in your `RunConfig`. +* Moved Distributions and Bijectors from `tf.contrib.distributions` to [Tensorflow Probability (TFP)](https://github.com/tensorflow/probability). `tf.contrib.distributions` is now deprecated and will be removed by the end of 2018. +* Adding new endpoints for existing tensorflow symbols. These endpoints are going to be the preferred endpoints going forward and may replace some of the existing endpoints in the future. See below for the complete list. New symbols have been added to the following modules: [`tf.debugging`](https://www.tensorflow.org/versions/master/api_docs/python/tf/debugging), [`tf.dtypes`](https://www.tensorflow.org/versions/master/api_docs/python/tf/dtypes), [`tf.image`](https://www.tensorflow.org/versions/master/api_docs/python/tf/image), [`tf.io`](https://www.tensorflow.org/versions/master/api_docs/python/tf/io), [`tf.linalg`](https://www.tensorflow.org/versions/master/api_docs/python/tf/linalg), [`tf.manip`](https://www.tensorflow.org/versions/master/api_docs/python/tf/manip), [`tf.math`](https://www.tensorflow.org/versions/master/api_docs/python/tf/math), [`tf.quantization`](https://www.tensorflow.org/versions/master/api_docs/python/tf/quantization), [`tf.strings`](https://www.tensorflow.org/versions/master/api_docs/python/tf/strings) + +## Breaking Changes + +* Prebuilt binaries are now (as of TensorFlow 1.10) built against NCCL 2.2 and no longer include NCCL in the binary install. TensorFlow usage with multiple GPUs and NCCL requires upgrade to [NCCL 2.2](https://developer.nvidia.com/nccl). See updated install guides: [Installing TensorFlow on Ubuntu](https://www.tensorflow.org/install/install_linux#tensorflow_gpu_support) and [Install TensorFlow from Sources](https://www.tensorflow.org/install/install_sources#optional_install_tensorflow_for_gpu_prerequisites). +* Starting from TensorFlow 1.11, Windows builds will use Bazel. Therefore, we will drop official support for cmake. + +## Bug Fixes and Other Changes + +* `tf.data`: + + `tf.contrib.data.group_by_reducer()` is now available via the public API. + + `tf.contrib.data.choose_from_datasets()` is now available via the public API. + + Adding `drop_remainder` argument to `tf.data.Dataset.batch()` and `tf.data.Dataset.padded_batch()`, deprecating `tf.contrib.data.batch_and_drop_remainder()` and `tf.contrib.data.padded_batch_and_drop_remainder()`. +* `tf.estimator`: + + `Estimator`s now use custom savers included in `EstimatorSpec` scaffolds for saving SavedModels during export. + + `EstimatorSpec` will now add a default prediction output for export if no `export_output` is provided, eliminating the need to explicitly include a `PredictOutput` object in the `model_fn` for simple use-cases. + + Support sparse\_combiner in canned Linear Estimators. + + Added batch normalization to `DNNClassifier`, `DNNRegressor`, and `DNNEstimator`. + + Adding ranking support for boosted trees. + + Adding center bias option for boosted trees. +* Add `synchronization` and `aggregation` args to get\_variable(). These args will be used for distributed variables. +* Add `synchronization` and `aggregation` args to the layer `add_weight()` API. These args will be used for distributed variables. +* `tf.losses.*` do not add to the global collection when executing eagerly (to avoid leaking memory). +* Support different summary and checkpoint directories in `tf.train.MonitoredTrainingSession()`. +* Added IndRNN, IndyGRU, and IndyLSTM cells to `tf.contrib.rnn`. +* Add safe static factory functions for SparseTensor and convert all CHECKs to DCHECKs. Using the constructor directly is unsafe and deprecated. +* Make the Bigtable client connection pool configurable & increase the default # of connections for performance. +* Added derivative of `tf.random_gamma` with respect to the alpha parameter. +* Added derivative of `tf.igamma(a, x)` and `tf.igammac(a, x)` with respect to a. +* Modified Bessel functions of order zero and one. +* Add FillTriangular Bijector to create triangular matrices. +* Added support for Type III DCT, and `tf.spectral.idct(type=2|3)`. +* Correctly handle CuDNN RNN weight loaded when nest in `TimeDistributed`. +* Adding per-element weight support for `WALSComputePartialLhsAndRhsOp`. +* ZerosLike and OnesLike ops treated as constants by Graph Transform Tool. +* Gamma distribution and the derived distributions (Beta, Dirichlet, Student's t, inverse Gamma) now fully reparameterized. +* Java: Experimental wrapper classes to make graph generation easier. Thanks [@karllessard](https://github.com/karllessard) and [@kbsriram](https://github.com/kbsriram) +* Build & link in secure gRPC components (switch from the insecure grpc dependency to secure grpc dependency). +* Adding new endpoints for existing tensorflow symbols. These endpoints are going to be the preferred endpoints going forward and may replace some of the existing endpoints in the future. List of new endpoints: + + New endpoints in `tf.image` namespace: `tf.image.extract_image_patches` + + New endpoints in `tf.debugging` namespace: `tf.debugging.check_numerics`, `tf.debugging.is_finite`, `tf.debugging.is_inf`, `tf.debugging.is_nan`. + + New endpoints in `tf.dtypes` namespace: `tf.dtypes.as_string`. + + New endpoints in `tf.io` namespace: `tf.io.decode_base64`, `tf.io.decode_compressed`, `tf.io.decode_json_example`, `tf.io.decode_raw`, `tf.io.encode_base64`, `tf.io.matching_files`, `tf.io.parse_tensor`, `tf.io.read_file,` tf.io.write\_file`. + + New endpoints in tf.linalg namespace: `tf.linalg.cross`, `tf.linalg.tensor_diag` (corresponds to `tf.diag`), `tf.linalg.tensor_diag_part` (corresponds to `tf.diag_part`). + + New endpoints in tf.manip namespace: `tf.manip.batch_to_space_nd`, `tf.manip.gather_nd`, `tf.manip.reshape`, `tf.manip.reverse`, `tf.manip.scatter_nd`, `tf.manip.space_to_batch_nd`, `tf.manip.tile` + + New endpoints in tf.math namespace: `tf.math.acos`, `tf.math.acosh`, `tf.math.add`, `tf.math.asin`, `tf.math.asinh`, `tf.math.atan`, `tf.math.atan2`, `tf.math.atanh`, `tf.math.betainc`, `tf.math.ceil`, `tf.math.cos`, `tf.math.cosh`, `tf.math.digamma`, `tf.math.equal`, `tf.math.erfc`, `tf.math.exp`, `tf.math.expm1`, `tf.math.floor`, `tf.math.greater`, `tf.math.greater_equal`, `tf.math.igamma`, `tf.math.igammac`, `tf.math.invert_permutation`, `tf.math.less`, `tf.math.less_equal`, `tf.math.lgamma`, `tf.math.log`, `tf.math.log1p`, `tf.math.logical_and`, `tf.math.logical_not`, `tf.math.logical_or`, `tf.math.maximum`, `tf.math.minimum`, `tf.math.not_equal`, `tf.math.polygamma`, `tf.math.reciprocal`, `tf.math.rint`, `tf.math.rsqrt`, `tf.math.segment_max`, `tf.math.segment_mean`, `tf.math.segment_min`, `tf.math.segment_prod`, `tf.math.segment_sum`, `tf.math.sin`, `tf.math.sinh`, `tf.math.softplus`, `tf.math.softsign`, `tf.math.squared_difference`, `tf.math.tan`, `tf.math.unsorted_segment_max`, `tf.math.unsorted_segment_min`, `tf.math.unsorted_segment_prod`, `tf.math.unsorted_segment_sum`, `tf.math.zeta`. + + New endpoints in `tf.quantization` namespace: `tf.quantization.dequantize`, `tf.quantization.fake_quant_with_min_max_args`, `tf.quantization.fake_quant_with_min_max_args_gradient`, `tf.quantization.fake_quant_with_min_max_vars`, `tf.quantization.fake_quant_with_min_max_vars_gradient`, `tf.quantization.fake_quant_with_min_max_vars_per_channel`, `tf.quantization.fake_quant_with_min_max_vars_per_channel_gradient`. + + New endpoints in tf.strings namespace: `tf.strings.join` (corresponds to `tf.string_join`), `tf.strings.regex_replace`, `tf.strings.to_number` (corresponds to `tf.string_to_number`), `tf.strings.strip` (corresponds to `tf.string_strip`), `tf.strings.substr`, `tf.strings.to_hash_bucket` (corresponds to `tf.string_to_hash_bucket`), `tf.strings.to_hash_bucket_fast` (corresponds to `tf.string_to_hash_bucket_fast`), `tf.strings.to_hash_bucket_strong` (corresponds to `tf.string_to_hash_bucket_strong`). + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +Ag Ramesh, Alex Wiltschko, Alexander Pantyukhin, Amogh Mannekote, An Jiaoyang, Andrei Nigmatulin, Andrew Ginns, BjøRn Moholt, Brett Koonce, Chengzhi Chen, Chinmay Das, Christian Ertler, Christoph Boeddeker, Clayne Robison, Courtial Florian, ctiijima, Dan Douthit, Dan J, Dan Ringwalt, EFanZh, Emanuele Ballarin, eqy, Evgeniy Zheltonozhskiy, Freedom" Koan-Sin Tan, FréDéRic Branchaud-Charron, G K, gracehoney, Guillaume Klein, Guozhong Zhuang, Hsien-Yang Li, hsm207, ImSheridan, Jayaram Bobba, Jiandong Ruan, Jie, Joel Shor, Jonas Rauber, Jongmin Baek, jsawruk, Karan Kaw, Karl Lessard, [karl@kubx.ca](mailto:karl@kubx.ca), Kb Sriram, KinmanLam, leiiwang, Li, Yiqiang, Loo Rong Jie, Mahmoud Abuzaina, Mahmoud Aslan, ManHyuk, Martin Patz, Martin Zeitler, mktozk, Mohammad Ashraf Bhuiyan, mrTsjolder, Naman Bhalla, Nick Felt, Nicolas Lopez, Niranjan Hasabnis, Nishidha Panpaliya, Nitish, nrstott, Nutti, Parag Jain, PeterLee, Philipp Jund, Rach L, Rafal Wojdyla, Roland Zimmermann, Sergei Lebedev, SneakyFish5, Soila Kavulya, Sriram Veturi, Steven Schmatz, Taehoon Lee, Tang, Wenyi, Taras Sereda, Ted Chang, Tim Zaman, Tristan Rice, tucan, vchigrin, Vikram Tiwari, Vincent, WeberXie, William D. Irons, Yan Facai (颜发才), Yong Tang, Yu Yi, Yuxin Wu, Zé ViníCius diff --git a/corpus/changelog/tensorflow_releases/tensorflow_1110.md b/corpus/changelog/tensorflow_releases/tensorflow_1110.md new file mode 100644 index 0000000000000000000000000000000000000000..d15832be8a0a50f66f02c8c0d07e5b11eda25119 --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_1110.md @@ -0,0 +1,111 @@ +# TensorFlow 1.11.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v1.11.0 +Version: 1.11.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@angerson](https://avatars.githubusercontent.com/u/32465472?s=40&v=4) +[angerson](/angerson) +released this +27 Sep 18:03 + +[v1.11.0](/tensorflow/tensorflow/tree/v1.11.0) + +[`c19e293`](/tensorflow/tensorflow/commit/c19e29306ce1777456b2dbb3a14f511edf7883a8) + +# Release 1.11.0 + +## Major Features and Improvements + +* Nvidia GPU: + + Prebuilt binaries are now (as of TensorFlow 1.11) built against cuDNN 7.2 and TensorRT 4. See updated install guides: [Installing TensorFlow on Ubuntu](https://www.tensorflow.org/install/install_linux#tensorflow_gpu_support) +* Google Cloud TPU: + + Experimental tf.data integration for Keras on Google Cloud TPUs. + + Experimental / preview support for eager execution on Google Cloud TPUs. +* DistributionStrategy: + + Add multi-GPU DistributionStrategy support in tf.keras. Users can now use `fit`, `evaluate` and `predict` to distribute their model on multiple GPUs. + + Add multi-worker DistributionStrategy and standalone client support in Estimator. See [README] () for more details. +* Add C, C++, and Python functions for querying kernels +* Starting from this release, Windows builds will use Bazel. Therefore, we will drop official support for cmake. + +## Breaking Changes + +* Keras: + + The default values for tf.keras `RandomUniform`, `RandomNormal`, and `TruncatedNormal` initializers have been changed to match those in external Keras. + + Breaking change: `model.get_config()` on a Sequential model now returns a config dictionary (consistent with other Model instances) instead of a list of configs for the underlying layers. + +## Bug Fixes and Other Changes + +* C++: + + Changed the signature of SessionFactory::NewSession so that it can return a meaningful error message on failure. +* tf.data: + + Remove `num_parallel_parser_calls` argument from `tf.contrib.data.make_csv_dataset()`. [tf.data] Remove `num_parallel_parser_calls` argument from `tf.contrib.data.make_csv_dataset()`. + + `tf.data.Dataset.list_files()` raises an exception at initialization time if the argument matches no files. + + Renamed BigTable class to BigtableTable for clarity + + Document use of the Cloud Bigtable API + + Adding `tf.contrib.data.reduce_dataset` which can be used to reduce a dataset to a single element. + + Generalization of `tf.contrib.data.sliding_window_batch`. +* INC: + + Runtime improvements to triangular solve. +* `tf.contrib`: + + Add an `implementation` argument to `tf.keras.layers.LocallyConnected2D` and `tf.keras.layers.LocallyConnected1D`. The new mode (`implementation=2`) performs forward pass as a single dense matrix multiplication, allowing dramatic speedups in certain scenarios (but worse performance in others - see docstring). The option also allows to use `padding=same`. + + Add documentation clarifying the differences between tf.fill and tf.constant. + + Add experimental IndexedDatasets. + + Add selective registration target using the lite proto runtime. + + Add simple Tensor and DataType classes to TensorFlow Lite Java + + Add support for bitcasting to/from uint32 and uint64. + + Added a subclass of Estimator that can be created from a SavedModel (SavedModelEstimator). + + Adds leaf index modes as an argument. + + Allow a different output shape from the input in tf.contrib.image.transform. + + Change the state\_size order of the StackedRNNCell to be natural order. To keep the existing behavior, user can add reverse\_state\_order=True when constructing the StackedRNNCells. + + Deprecate self.test\_session() in favor of self.session() or self.cached\_session(). + + Directly import tensor.proto.h (the transitive import will be removed from tensor.h soon) + + Estimator.train() now supports tf.contrib.summary.\* summaries out of the box; each call to .train() will now create a separate tfevents file rather than re-using a shared one. + + Fix FTRL L2-shrinkage behavior: the gradient from the L2 shrinkage term should not end up in the accumulator. + + Fix toco compilation/execution on Windows + + GoogleZoneProvider class added to detect which Google Cloud Engine zone tensorflow is running in. + + It is now safe to call any of the C API's TF\_Delete\* functions on nullptr + + Log some errors on Android to logcat + + Match FakeQuant numerics in TFLite to improve accuracy of TFLite quantized inference models. + + Optional bucket location check for the GCS Filesystem. + + Performance enhancements for StringSplitOp & StringSplitV2Op. + + Performance improvements for regex replace operations. + + TFRecordWriter now raises an error if .write() fails. + + TPU: More helpful error messages in TPUClusterResolvers. + + The legacy\_init\_op argument to SavedModelBuilder methods for adding MetaGraphs has been deprecated. Please use the equivalent main\_op argument instead. As part of this, we now explicitly check for a single main\_op or legacy\_init\_op at the time of SavedModel building, whereas the check on main\_op was previously only done at load time. + + The protocol used for Estimator training is now configurable in RunConfig. + + Triangular solve performance improvements. + + Unify RNN cell interface between TF and Keras. Add new get\_initial\_state() to Keras and TF RNN cell, which will use to replace the existing zero\_state() method. + + Update initialization of variables in Keras. + + Updates to "constrained\_optimization" in tensorflow/contrib. + + boosted trees: adding pruning mode + + tf.train.Checkpoint does not delete old checkpoints by default. + + tfdbg: Limit the total disk space occupied by dumped tensor data to 100 GBytes. Add environment variable `TFDBG_DISK_BYTES_LIMIT` to allow adjustment of this upper limit. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +Aapeli, adoda, Ag Ramesh, Amogh Mannekote, Andrew Gibiansky, Andy Craze, Anirudh Koul, Aurelien Geron, Avijit, Avijit-Nervana, Ben, Benjamin H. Myara, bhack, Brett Koonce, Cao Zongyan, cbockman, cheerss, Chikanaga Tomoyuki, Clayne Robison, cosine0, Cui Wei, Dan J, David, David Norman, Dmitry Klimenkov, Eliel Hojman, Florian Courtial, fo40225, formath, Geoffrey Irving, gracehoney, Grzegorz Pawelczak, Guoliang Hua, Guozhong Zhuang, Herman Zvonimir DošIlović, HuiyangFei, Jacker, Jan HüNnemeyer, Jason Taylor, Jason Zaman, Jesse, Jiang,Zhoulong, Jiawei Zhang, Jie, Joe Yearsley, Johannes Schmitz, Jon Perl, Jon Triebenbach, Jonathan, Jonathan Hseu, Jongmin Park, Justin Shenk, [karl@kubx.ca](mailto:karl@kubx.ca), Kate Hodesdon, Kb Sriram, Keishi Hattori, Kenneth Blomqvist, Koan-Sin Tan, Li Liangbin, Li, Yiqiang, Loo Rong Jie, Madiyar, Mahmoud Abuzaina, Mark Ryan, Matt Dodge, mbhuiyan, melvinljy96, Miguel Mota, Nafis Sadat, Nathan Luehr, naurril, Nehal J Wani, Niall Moran, Niranjan Hasabnis, Nishidha Panpaliya, npow, olicht, Pei Zhang, Peng Wang (Simpeng), Peng Yu, Philipp Jund, Pradeep Banavara, Pratik Kalshetti, qwertWZ, Rakesh Chada, Randy West, Ray Kim, Rholais Lii, Robin Richtsfeld, Rodrigo Silveira, Ruizhi, Santosh Kumar, Seb Bro, Sergei Lebedev, sfujiwara, Shaba Abhiram, Shashi, SneakyFish5, Soila Kavulya, Stefan Dyulgerov, Steven Winston, Sunitha Kambhampati, Surry Shome, Taehoon Lee, Thor Johnsen, Tristan Rice, TShapinsky, tucan, tucan9389, Vicente Reyes, Vilmar-Hillow, Vitaly Lavrukhin, wangershi, weidan.kong, weidankong, Wen-Heng (Jack) Chung, William D. Irons, Wim Glenn, XFeiF, Yan Facai (颜发才), Yanbo Liang, Yong Tang, Yoshihiro Yamazaki, Yuan (Terry) Tang, Yuan, Man, zhaoyongke, ÁRon +Ricardo Perez-Lopez, 张天启, 张晓飞 diff --git a/corpus/changelog/tensorflow_releases/tensorflow_1120.md b/corpus/changelog/tensorflow_releases/tensorflow_1120.md new file mode 100644 index 0000000000000000000000000000000000000000..02d8c7d0f10503ae68b2d9d89fcaa25a891572d2 --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_1120.md @@ -0,0 +1,105 @@ +# TensorFlow 1.12.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v1.12.0 +Version: 1.12.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@goldiegadde](https://avatars.githubusercontent.com/u/43185254?s=40&v=4) +[goldiegadde](/goldiegadde) +released this +05 Nov 23:30 + +· +[44 commits](/tensorflow/tensorflow/compare/v1.12.0...r1.12) +to r1.12 +since this release + +[v1.12.0](/tensorflow/tensorflow/tree/v1.12.0) + +[`a6d8ffa`](/tensorflow/tensorflow/commit/a6d8ffae097d0132989ae4688d224121ec6d8f35) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 1.12.0 + +## Major Features and Improvements + +* Keras models can now be directly exported to the SavedModel format(`tf.contrib.saved_model.save_keras_model()`) and used with Tensorflow Serving. +* Keras models now support evaluating with a `tf.data.Dataset`. +* TensorFlow binaries are built with XLA support linked in by default. +* Ignite Dataset added to contrib/ignite that allows to work with Apache Ignite. + +## Bug Fixes and Other Changes + +* `tf.data`: + + `tf.data` users can now represent, get, and set options of TensorFlow input pipelines using `tf.data.Options()`, `tf.data.Dataset.options()`, and `tf.data.Dataset.with_options()` respectively. + + New `tf.data.Dataset.reduce()` API allows users to reduce a finite dataset to a single element using a user-provided reduce function. + + New `tf.data.Dataset.window()` API allows users to create finite windows of input dataset; when combined with the `tf.data.Dataset.reduce()` API, this allows users to implement customized batching. + + All C++ code moves to the `tensorflow::data` namespace. + + Add support for `num_parallel_calls` to `tf.data.Dataset.interleave`. +* `tf.contrib`: + + Remove `tf.contrib.linalg`. `tf.linalg` should be used instead. + + Replace any calls to `tf.contrib.get_signature_def_by_key(metagraph_def, signature_def_key)` with `meta_graph_def.signature_def[signature_def_key]`. Catching a ValueError exception thrown by `tf.contrib.get_signature_def_by_key` should be replaced by catching a KeyError exception. +* `tf.contrib.data` + + Deprecate, and replace by tf.data.experimental. +* Other: + + Improved XLA stability and performance. + + Fix single replica TensorBoard summary stats in Cloud ML Engine. + + TPUEstimator: Initialize dataset iterators in parallel. + + Keras on TPU model quality and bug fixes. + + Instead of jemalloc, revert back to using system malloc since it simplifies build and has comparable performance. + + Remove integer types from `tf.nn.softplus` and `tf.nn.softsign` OpDefs. This is a bugfix; these ops were never meant to support integers. + + Allow subslicing Tensors with a single dimension. + + Add option to calculate string length in Unicode characters + + Add functionality to SubSlice a tensor. + + Add searchsorted (ie lower/upper\_bound) op. + + Add model explainability to Boosted Trees. + + Support negative positions for tf.substr + + There was previously a bug in the bijector\_impl where the \_reduce\_jacobian\_det\_over\_event does not handle scalar ILDJ implementations properly. + + In tf eager execution, allow re-entering a GradientTape context + + Add tf\_api\_version flag. If --define=tf\_api\_version=2 flag is passed in, then bazel will build TensorFlow API version 2.0. Note that TensorFlow 2.0 is under active development and has no guarantees at this point. + + Add additional compression options to TfRecordWriter + + Performance improvements for regex full match operations. + + Replace `tf.GraphKeys.VARIABLES` with `tf.GraphKeys.GLOBAL_VARIABLES` + + Remove unused dynamic learning rate support. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +(David) Siu-Kei Muk, Ag Ramesh, Anton Dmitriev, Artem Sobolev, Avijit-Nervana, Bairen Yi, Bruno Goncalves, By Shen, candy.dc, Cheng Chen, Clayne Robison, coder3101, Dao Zhang, Elms, Fei Hu, feiquan, Geoffrey Irving, Guozhong Zhuang, hellcom, Hoeseong Kim, imsheridan, Jason Furmanek, Jason Zaman, Jenny Sahng, jiefangxuanyan, Johannes Bannhofer, Jonathan Homer, Koan-Sin Tan, kouml, Loo Rong Jie, Lukas Geiger, manipopopo, Ming Li, Moritz KröGer, Naurril, Niranjan Hasabnis, Pan Daoxin, Peng Yu, pengwa, rasmi, Roger Xin, Roland Fernandez, Sami Kama, Samuel Matzek, Sangjung Woo, Sergei Lebedev, Sergii Khomenko, shaohua, Shaohua Zhang, Shujian2015, Sunitha Kambhampati, tomguluson92, ViníCius Camargo, wangsiyu, weidankong, Wen-Heng (Jack) Chung, William D. Irons, Xin Jin, Yan Facai (颜发才), Yanbo Liang, Yash Katariya, Yong Tang, 在原佐为 diff --git a/corpus/changelog/tensorflow_releases/tensorflow_1130.md b/corpus/changelog/tensorflow_releases/tensorflow_1130.md new file mode 100644 index 0000000000000000000000000000000000000000..3aa63e30234cd0ce06d0bc3c9b6f033d997c1b77 --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_1130.md @@ -0,0 +1,170 @@ +# TensorFlow 1.13.1 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v1.13.1 +Version: 1.13.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@gunan](https://avatars.githubusercontent.com/u/7946809?s=40&v=4) +[gunan](/gunan) +released this +25 Feb 20:44 + +· +[37 commits](/tensorflow/tensorflow/compare/v1.13.1...r1.13) +to r1.13 +since this release + +[v1.13.1](/tensorflow/tensorflow/tree/v1.13.1) + +[`6612da8`](/tensorflow/tensorflow/commit/6612da89516247503f03ef76e974b51a434fb52e) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 1.13.1 + +## Major Features and Improvements + +* TensorFlow Lite has moved from contrib to core. This means that Python modules are under `tf.lite` and source code is now under `tensorflow/lite` rather than `tensorflow/contrib/lite`. +* TensorFlow GPU binaries are now built against CUDA 10 and TensorRT 5.0. +* Support for Python3.7 on all operating systems. +* Moved NCCL to core. + +## Behavioral changes + +* Disallow conversion of python floating types to uint32/64 (matching behavior of other integer types) in `tf.constant`. +* Make the `gain` argument of convolutional orthogonal initializers (`convolutional_delta_orthogonal`, `convolutional_orthogonal_1D`, `convolutional_orthogonal_2D`, `convolutional_orthogonal_3D`) have consistent behavior with the `tf.initializers.orthogonal` initializer, i.e. scale the output l2-norm by `gain` and NOT by `sqrt(gain)`. (Note that these functions are currently in `tf.contrib` which is not guaranteed backward compatible). + +## Bug Fixes and Other Changes + +* Documentation + + Update the doc with the details about the rounding mode used in quantize\_and\_dequantize\_v2. + + Clarify that tensorflow::port::InitMain() *should* be called before using the TensorFlow library. Programs failing to do this are not portable to all platforms. +* Deprecations and Symbol renames. + + Removing deprecations for the following endpoints: `tf.acos`, `tf.acosh`, `tf.add`, `tf.as_string`, `tf.asin`, `tf.asinh`, `tf.atan`, `tf.atan2`, `tf.atanh`, `tf.cos`, `tf.cosh`, `tf.equal`, `tf.exp`, `tf.floor`, `tf.greater`, `tf.greater_equal`, `tf.less`, `tf.less_equal`, `tf.log`, `tf.logp1`, `tf.logical_and`, `tf.logical_not`, `tf.logical_or`, `tf.maximum`, `tf.minimum`, `tf.not_equal`, `tf.sin`, `tf.sinh`, `tf.tan` + + Deprecate `tf.data.Dataset.shard`. + + Deprecate `saved_model.loader.load` which is replaced by `saved_model.load` and `saved_model.main_op`, which will be replaced by `saved_model.main_op` in V2. + + Deprecate tf.QUANTIZED\_DTYPES. The official new symbol is tf.dtypes.QUANTIZED\_DTYPES. + + Update sklearn imports for deprecated packages. + + Deprecate `Variable.count_up_to` and `tf.count_up_to` in favor of `Dataset.range`. + + Export `confusion_matrix` op as `tf.math.confusion_matrix` instead of `tf.train.confusion_matrix`. + + Add `tf.dtypes.` endpoint for every constant in dtypes.py; moving endpoints in versions.py to corresponding endpoints in `tf.sysconfig.` and `tf.version.`; moving all constants under `tf.saved_model` submodules to `tf.saved_model` module. New endpoints are added in V1 and V2 but existing endpoint removals are only applied in V2. + + Deprecates behavior where device assignment overrides collocation constraints inside a collocation context manager. +* Keras & Python API + + Add to Keras functionality analogous to `tf.register_tensor_conversion_function`. + + Subclassed Keras models can now be saved through `tf.contrib.saved_model.save_keras_model`. + + `LinearOperator.matmul` now returns a new `LinearOperator`. +* New ops and improved op functionality + + Add a Nearest Neighbor Resize op. + + Add an `ignore_unknown` argument to `parse_values` which suppresses ValueError for unknown hyperparameter types. Such \* Add `tf.linalg.matvec` convenience function. + + `tf.einsum()`raises `ValueError` for unsupported equations like `"ii->"`. + + Add DCT-I and IDCT-I in `tf.signal.dct` and `tf.signal.idct`. + + Add LU decomposition op. + + Add quantile loss to gradient boosted trees in estimator. + + Add `round_mode` to `QuantizeAndDequantizeV2` op to select rounding algorithm. + + Add `unicode_encode`, `unicode_decode`, `unicode_decode_with_offsets`, `unicode_split`, `unicode_split_with_offset`, and `unicode_transcode` ops. Amongst other things, this Op adds the ability to encode, decode, and transcode a variety of input text encoding formats into the main Unicode encodings (UTF-8, UTF-16-BE, UTF-32-BE) + + Add "unit" attribute to the substr op, which allows obtaining the substring of a string containing unicode characters. + + Broadcasting support for Ragged Tensors. + + `SpaceToDepth` supports uint8 data type. + + Support multi-label quantile regression in estimator. + + We now use "div" as the default partition\_strategy in `tf.nn.safe_embedding_lookup_sparse`, `tf.nn.sampled_softmax` and `tf.nn.nce_loss`. + hyperparameter are ignored. +* Performance + + Improve performance of GPU cumsum/cumprod by up to 300x. + + Added support for weight decay in most TPU embedding optimizers, including AdamW and MomentumW. +* TensorFlow 2.0 Development + + Add a command line tool to convert to TF2.0, tf\_upgrade\_v2 + + Merge `tf.spectral` into `tf.signal` for TensorFlow 2.0. + + Change the default recurrent activation function for LSTM from 'hard\_sigmoid' to 'sigmoid' in 2.0. Historically recurrent activation is 'hard\_sigmoid' since it is fast than 'sigmoid'. With new unified backend between CPU and GPU mode, since the CuDNN kernel is using sigmoid, we change the default for CPU mode to sigmoid as well. With that, the default LSTM will be compatible with both CPU and GPU kernel. This will enable user with GPU to use CuDNN kernel by default and get a 10x performance boost in training. Note that this is checkpoint breaking change. If user want to use their 1.x pre-trained checkpoint, please construct the layer with LSTM(recurrent\_activation='hard\_sigmoid') to fallback to 1.x behavior. +* TensorFlow Lite + + Move from `tensorflow/contrib/lite` to `tensorflow/lite`. + + Add experimental Java API for injecting TensorFlow Lite delegates + + Add support for strings in TensorFlow Lite Java API. +* `tf.contrib`: + + Add Apache Ignite Filesystem plugin to support accessing Apache IGFS. + + Dropout now takes `rate` argument, `keep_prob` is deprecated. + + Estimator occurrences references `tf.contrib.estimator` were changed to `tf.estimator`: + - `tf.contrib.estimator.BaselineEstimator` with `tf.estimator.BaselineEstimator` + - `tf.contrib.estimator.DNNLinearCombinedEstimator` with `tf.estimator.DNNLinearCombinedEstimator` + - `tf.contrib.estimator.DNNEstimator` with `tf.estimator.DNNEstimator` + - `tf.contrib.estimator.LinearEstimator` with `tf.estimator.LinearEstimator` + - `tf.contrib.estimator.InMemoryEvaluatorHook` and tf.estimator.experimental.InMemoryEvaluatorHook`. + - `tf.contrib.estimator.make_stop_at_checkpoint_step_hook` with `tf.estimator.experimental.make_stop_at_checkpoint_step_hook`. + + Expose `tf.distribute.Strategy as the new name for tf.contrib.distribute.DistributionStrategy. + + Migrate linear optimizer from contrib to core. + + Move `tf.contrib.signal` to `tf.signal` (preserving aliases in tf.contrib.signal). + + Users of `tf.contrib.estimator.export_all_saved_models` and related should switch to `tf.estimator.Estimator.experimental_export_all_saved_models`. +* tf.data: + + Add `tf.data.experimental.StatsOptions()`, to configure options to collect statistics from `tf.data.Dataset` pipeline using `StatsAggregator`. Add nested option, `experimental_stats` (which takes a `tf.data.experimen tal.StatsOptions` object), to `tf.data.Options`. Deprecates `tf.data.experimental.set_stats_agregator`. + + Performance optimizations: + - Add `tf.data.experimental.OptimizationOptions()`, to configure options to enable `tf.data` performance optimizations. Add nested option, `experimental_optimization` (which takes a `tf.data.experimental.OptimizationOptions` object), to `tf.data.Options`. Remove performance optimization options from `tf.data.Options`, and add them under `tf.data.experimental.OptimizationOptions` instead. + - Enable `map_and_batch_fusion` and `noop_elimination` optimizations by default. They can be disabled by configuring `tf.data.experimental.OptimizationOptions` to set `map_and_batch = False` or `noop_elimination = False` respectively. To disable all default optimizations, set `apply_default_optimizations = False`. + - Support parallel map in `map_and_filter_fusion`. + - Disable static optimizations for input pipelines that use non-resource `tf.Variable`s. + + Add NUMA-aware MapAndBatch dataset. + + Deprecate `tf.data.Dataset.make_one_shot_iterator()` in V1, removed it from V2, and added tf.compat.v1.data.make\_one\_shot\_iterator()`. + + Deprecate `tf.data.Dataset.make_initializable_iterator()` in V1, removed it from V2, and added `tf.compat.v1.data.make_initializable_iterator()`. + + Enable nested dataset support in core `tf.data` transformations. + + For `tf.data.Dataset` implementers: Added `tf.data.Dataset._element_structured property` to replace `Dataset.output_{types,shapes,classes}`. + + Make `num_parallel_calls` of `tf.data.Dataset.interleave` and `tf.data.Dataset.map` work in Eager mode. +* Toolchains + + Fixed OpenSSL compatibility by avoiding `EVP_MD_CTX_destroy`. + + Added bounds checking to printing deprecation warnings. + + Upgraded CUDA dependency to 10.0 + + To build with Android NDK r14b, add "#include " to android-ndk-r14b/platforms/android-14/arch-\*/usr/include/linux/futex.h + + Removed `:android_tensorflow_lib_selective_registration*` targets, use `:android_tensorflow_lib_lite*` targets instead. +* XLA + + Move `RoundToEven` function to xla/client/lib/math.h. + + A new environment variable `TF_XLA_DEBUG_OPTIONS_PASSTHROUGH` set to "1" or "true" allows the debug options passed within an XRTCompile op to be passed directly to the XLA compilation backend. If such variable is not set (service side), only a restricted set will be passed through. + + Allow the XRTCompile op to return the ProgramShape resulted form the XLA compilation as a second return argument. + + XLA HLO graphs can now be rendered as SVG/HTML. +* Estimator + + Replace all occurences of `tf.contrib.estimator.BaselineEstimator` with `tf.estimator.BaselineEstimator` + + Replace all occurences of `tf.contrib.estimator.DNNLinearCombinedEstimator` with `tf.estimator.DNNLinearCombinedEstimator` + + Replace all occurrences of `tf.contrib.estimator.DNNEstimator` with `tf.estimator.DNNEstimator` + + Replace all occurrences of `tf.contrib.estimator.LinearEstimator` with `tf.estimator.LinearEstimator` + + Users of `tf.contrib.estimator.export_all_saved_models` and related should switch to `tf.estimator.Estimator.experimental_export_all_saved_models`. + + Update `regression_head` to the new Head API for Canned Estimator V2. + + Switch `multi_class_head` to Head API for Canned Estimator V2. + + Replace all occurences of `tf.contrib.estimator.InMemoryEvaluatorHook` and `tf.contrib.estimator.make_stop_at_checkpoint_step_hook` with `tf.estimator.experimental.InMemoryEvaluatorHook` and `tf.estimator.experimental.make_stop_at_checkpoint_step_hook` + + Migrate linear optimizer from contrib to core. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +Abhinav Upadhyay, Ag Ramesh, akikaaa, Alexis Louis, Anders Huss, Andreas Madsen, Andrew Banchich, Andy Craze, Anton Dmitriev, Artem Malykh, Avijit-Nervana, Balint Cristian, Benjamin Tan Wei Hao, Bhavani Subramanian, Brendan Finan, Brian Nemsick, Bryan Cutler, By Shen, Cao Zongyan, Castiel, Chris Antaki, Christian Goll, Cibifang, Clayne Robison, Codrut Grosu, Cong Xu, Dalmo Cirne, Daniel Hunter, Dougal J. Sutherland, Edvard Fagerholm, EFanZh, Erik Smistad, Evgeniy Polyakov, Feiyang Chen, franklin5, Fred Reiss, Gautam, gehring, Geoffrey Irving, George Sterpu, Gitea, Grzegorz George Pawelczak, Guozhong Zhuang, himkt, Hoeseong Kim, Huan Li (李卓桓), HuiyangFei, hyunyoung, Isaac Burbank, jackonan, Jacky Ko, Jason Furmanek, Jason Zaman, Javier Luraschi, Jiang,Zhoulong, joaak, John Lin, Jonathan Wyatt Hoech, josephyearsley, Josh Gordon, Julian Niedermeier, Karl Lessard, Keno Fischer, lanhin, Leon Graser, leondgarse, Li, Guizi, Li, Yiqiang, lxl910915, Mahmoud Abuzaina, manhyuk, Marcela Morales Quispe, margaretmz, Matt Conley, Max Pumperla, mbhuiyan, mdfaijul, Meng, Peng, Michael, Michael Gielda, mrTsjolder, Muhammad Wildan, neargye, Nehal J Wani, NEWPLAN, Niranjan Hasabnis, Nutti, olicht, Pan Daoxin, Pedro Monreal, Peng Yu, pillarpond, Pooya Davoodi, qiezi, Rholais Lii, Richard Yu, Rin Arakaki, Roger Iyengar, sahilbadyal, Sami Kama, Sandip Giri, Scott Leishman, Serge Panev, Seunghoon Park, Shafi Dayatar, shengfuintel, Shimin Guo, Siju, silent567, Stefan Dyulgerov, steven, Tao Wei, Thor Johnsen, Tingbo Lu, tomguluson92, Tongxuan Liu, Trevor Morris, Ubuntu, Vadim Borisov, vanderliang, wangsiyu, Wen Yun, Wen-Heng (Jack) Chung, wenxizhu, William D. Irons, Xiaoming (Jason) Cui, Yan Facai (颜发才), Yanbo Liang, Yaniv Blumenfeld, Yash Gaurkar, Yicheng Fan, Yong Tang, Yongjoon Lee, Yuan (Terry) Tang, Yuxin Wu, zldrobit diff --git a/corpus/changelog/tensorflow_releases/tensorflow_1140.md b/corpus/changelog/tensorflow_releases/tensorflow_1140.md new file mode 100644 index 0000000000000000000000000000000000000000..0873670ab1e01b24af1d77a854d08c819bc8d5fa --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_1140.md @@ -0,0 +1,185 @@ +# TensorFlow 1.14.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v1.14.0 +Version: 1.14.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@tensorflow-jenkins](https://avatars.githubusercontent.com/u/16359713?s=40&v=4) +[tensorflow-jenkins](/tensorflow-jenkins) +released this +19 Jun 04:45 + +· +[65 commits](/tensorflow/tensorflow/compare/v1.14.0...r1.14) +to r1.14 +since this release + +[v1.14.0](/tensorflow/tensorflow/tree/v1.14.0) + +[`87989f6`](/tensorflow/tensorflow/commit/87989f69597d6b2d60de8f112e1e3cea23be7298) + +# Release 1.14.0 + +## Major Features and Improvements + +* This is the first 1.x release containing the compat.v2 module. This module is required to allow libraries to publish code which works in both 1.x and 2.x. After this release, no backwards incompatible changes are allowed in the 2.0 Python API. +* Turn on MKL-DNN contraction kernels by default. MKL-DNN dynamically dispatches the best kernel implementation based on CPU vector architecture. To disable them, build with --define=tensorflow\_mkldnn\_contraction\_kernel=0. +* Non-Windows system libraries are now versioned. This should be a no-op for most users as it affects only system package maintainers or those building extensions to TensorFlow: + + Python wheels (Pip packages) contain one library file. + - Linux: `libtensorflow_framework.so.1` + - MacOS: `libtensorflow_framework.1.dylib` + + Our `libtensorflow` tarball archives contain the `libtensorflow` library and two symlinks. MacOS `.dylib` libraries are the same, but match MacOS library naming requirements (i.e. `libtensorflow.1.dylib`): + - `libtensorflow.so.1.14.0`, the main library + - `libtensorflow.so.1`, symlinked to the main library + - `libtensorflow.so`, symlinked to `.so.1` + +## Behavioral changes + +* Set default loss reduction as `AUTO` for improving reliability of loss scaling with distribution strategy and custom training loops. `AUTO` indicates that the reduction option will be determined by the usage context. For almost all cases this defaults to `SUM_OVER_BATCH_SIZE`. When used in distribution strategy scope, outside of built-in training loops such as `tf.keras` `compile` and `fit`, we expect reduction value to be 'None' or 'SUM'. Using other values will raise an error. +* Wraps losses passed to the `compile` API (strings and v1 losses) which are not instances of v2 `Loss` class in `LossWrapper` class. => All losses will now use `SUM_OVER_BATCH_SIZE` reduction as default. +* Disable `run_eagerly` and distribution strategy if there are symbolic tensors added to the model using `add_metric` or `add_loss`. +* tf.linspace(start, stop, num) now always uses "stop" as last value (for num > 1) +* The behavior of tf.gather is now correct when axis=None and batch\_dims<0. +* Only create a GCS directory object if the object does not already exist. +* In `map_vectorization` optimization, reduce the degree of parallelism in the vectorized map node. +* Bug fix: loss and gradients should now more reliably be correctly scaled w.r.t. the global batch size when using a tf.distribute.Strategy. +* Updating cosine similarity loss - removed the negate sign from cosine similarity. +* DType is no longer convertible to an int. Use dtype.as\_datatype\_enum instead of int(dtype) to get the same result. +* Changed default for gradient accumulation for TPU embeddings to true. +* Callbacks now log values in eager mode when a deferred build model is used. +* Transitive dependencies on :pooling\_ops were removed. Some users may need to add explicit dependencies on :pooling\_ops if they reference the operators from that library. + +## Bug Fixes and Other Changes + +* Documentation +* Deprecations and Symbol renames. + + The GPU configuration env parameter `TF_CUDA_HOST_MEM_LIMIT_IN_MB` has been changed to `TF_GPU_HOST_MEM_LIMIT_IN_MB`. + + Remove unused StringViewVariantWrapper + + Delete unused Fingerprint64Map op registration + + SignatureDef util functions have been deprecated. + + Renamed tf.image functions to remove duplicate "image" where it is redundant. + + tf.keras.experimental.export renamed to tf.keras.experimental.export\_saved\_model + + Standardize the LayerNormalization API by replacing the args `norm_axis` and `params_axis` with `axis`. + + Tensor::UnsafeCopyFromInternal deprecated in favor Tensor::BitcastFrom +* Keras & Python API + + Add v2 module aliases for: + - tf.initializers => tf.keras.initializers + - tf.losses => tf.keras.losses & tf.metrics => tf.keras.metrics + - tf.optimizers => tf.keras.optimizers + + Add tf.keras.layers.AbstractRNNCell as the preferred implementation of RNN cell for TF v2. User can use it to implement RNN cell with custom behavior. + + Adding `clear_losses` API to be able to clear losses at the end of forward pass in a custom training loop in eager. + + Add support for passing list of lists to the `metrics` param in Keras `compile`. + + Added top-k to precision and recall to keras metrics. + + Adding public APIs for `cumsum` and `cumprod` keras backend functions. + + Fix: model.add\_loss(symbolic\_tensor) should work in ambient eager. + + Add name argument to tf.string\_split and tf.strings\_split + + Minor change to SavedModels exported from Keras using tf.keras.experimental.export. (SignatureDef key for evaluation mode is now "eval" instead of "test"). This will be reverted back to "test" in the near future. + + Updates binary cross entropy logic in Keras when input is probabilities. Instead of converting probabilities to logits, we are using the cross entropy formula for probabilities. + + Raw TensorFlow functions can now be used in conjunction with the Keras Functional API during model creation. This obviates the need for users to create Lambda layers in most cases when using the Functional API. Like Lambda layers, TensorFlow functions that result in Variable creation or assign ops are not supported. + + Keras training and validation curves are shown on the same plot. + + Introduce `dynamic` constructor argument in Layer and Model, which should be set to True when using imperative control flow in the `call` method. + + Removing of dtype in the constructor of initializers and partition\_info in call. +* New ops and improved op functionality + + Add OpKernels for some stateless maps + + Add v2 APIs for AUCCurve and AUCSummationMethod enums. #tf-metrics-convergence + + Add tf.math.nextafter op. + + Add CompositeTensor base class. + + Add tf.linalg.tridiagonal\_solve op. + + Add opkernel templates for common table operations. + + Added GPU implementation of tf.linalg.tridiagonal\_solve. + + Added support for TFLite in TensorFlow 2.0. + + Adds summary trace API for collecting graph and profile information. + + Add batch\_dims argument to tf.gather. + + Add support for `add_metric` in the graph function mode. + + Add C++ Gradient for BatchMatMulV2. + + Added tf.random.binomial + + Added gradient for SparseToDense op. + + Add legacy string flat hash map op kernels + + Add a ragged size op and register it to the op dispatcher + + Add broadcasting support to tf.matmul. + + Add ellipsis (...) support for tf.einsum() + + Added LinearOperator.adjoint and LinearOperator.H (alias). + + Added GPU implementation of tf.linalg.tridiagonal\_solve. + + Added strings.byte\_split + + Add RaggedTensor.placeholder() + + Add a new "result\_type" parameter to tf.strings.split + + `add_update` can now be passed a zero-arg callable in order to support turning off the update when setting `trainable=False` on a Layer of a Model compiled with `run_eagerly=True`. + + Add variant wrapper for absl::string\_view + + Add expand\_composites argument to all nest.\* methods. + + Add pfor converter for Squeeze. + + Bug fix for tf.tile gradient + + Expose CriticalSection in core as tf.CriticalSection. + + Update Fingerprint64Map to use aliases + + ResourceVariable support for gather\_nd. + + ResourceVariable's gather op supports batch dimensions. + + Variadic reduce is supported on CPU + + Extend tf.function with basic support for CompositeTensors arguments (such as SparseTensor and RaggedTensor). + + Add templates and interfaces for creating lookup tables + + Post-training quantization tool supports quantizing weights shared by multiple operations. The models made with versions of this tool will use INT8 types for weights and will only be executable interpreters from this version onwards. + + Malformed gif images could result in an access out of bounds in the color palette of the frame. This has been fixed now + + image.resize now considers proper pixel centers and has new kernels (incl. anti-aliasing). +* Performance + + Turn on MKL-DNN contraction kernels by default. MKL-DNN dynamically dispatches the best kernel implementation based on CPU vector architecture. To disable them, build with --define=tensorflow\_mkldnn\_contraction\_kernel=0. + + Support for multi-host ncclAllReduce in Distribution Strategy. + + Expose a flag that allows the number of threads to vary across Python benchmarks. +* TensorFlow 2.0 Development + + Add v2 sparse categorical crossentropy metric. + + Allow non-Tensors through v2 losses. + + Add UnifiedGRU as the new GRU implementation for tf2.0. Change the default recurrent activation function for GRU from 'hard\_sigmoid' to 'sigmoid', and 'reset\_after' to True in 2.0. Historically recurrent activation is 'hard\_sigmoid' since it is fast than 'sigmoid'. With new unified backend between CPU and GPU mode, since the CuDNN kernel is using sigmoid, we change the default for CPU mode to sigmoid as well. With that, the default GRU will be compatible with both CPU and GPU kernel. This will enable user with GPU to use CuDNN kernel by default and get a 10x performance boost in training. Note that this is checkpoint breaking change. If user want to use their 1.x pre-trained checkpoint, please construct the layer with GRU(recurrent\_activation='hard\_sigmoid', reset\_after=False) to fallback to 1.x behavior. + + TF 2.0 - Update metric name to always reflect what the user has given in compile. Affects following cases 1. When name is given as 'accuracy'/'crossentropy' 2. When an aliased function name is used eg. 'mse' 3. Removing the `weighted` prefix from weighted metric names. + + Begin adding Go wrapper for C Eager API + + image.resize in 2.0 now supports gradients for the new resize kernels. + + removed tf.string\_split from v2 API + + Expose tf.contrib.proto.\* ops in tf.io (they will exist in TF2) + + "Updates the TFLiteConverter API in 2.0. Changes from\_concrete\_function to from\_concrete\_functions." + + Enable tf.distribute.experimental.MultiWorkerMirroredStrategy working in eager mode. + + Support both binary and -1/1 label input in v2 hinge and squared hinge losses. +* TensorFlow Lite + + "Adds support for tflite\_convert in 2.0." + + "Remove lite.OpHint, lite.experimental, and lite.constant from 2.0 API." +* tf.contrib + + Added Neural Turing Implementation as described in . + + Remove tf.contrib.timeseries dependency on TF distributions. +* tf.data + + Add num\_parallel\_reads and passing in a Dataset containing filenames into TextLineDataset and FixedLengthRecordDataset + + Going forward we operate in TF 2.0, this change is part of the effort to slowly converting XYZDataset to DatasetV2 type which is the official version going to be used in TF 2.0 and motivated by some compatibility issue found, \_BigtableXYZDataset (of type DatasetV2) does not implement the \_as\_variant\_tensor() of DatasetV1, when moving contrib.bigtable to tensorflow\_io. Converting into DatasetV2 removes the overheads to maintain V1 while we are moving into TF 2.0. + + Add dataset ops to the graph (or create kernels in Eager execution) during the python Dataset object creation instead doing it during Iterator creation time. + + Add support for TensorArrays to tf.data Dataset. + + Switching tf.data functions to use `defun`, providing an escape hatch to continue using the legacy `Defun`. +* Toolchains + + CUDNN\_INSTALL\_PATH, TENSORRT\_INSTALL\_PATH, NCCL\_INSTALL\_PATH, NCCL\_HDR\_PATH are deprecated. Use TF\_CUDA\_PATHS instead which supports a comma-separated list of base paths that are searched to find CUDA libraries and headers. + + TF code now resides in `tensorflow_core` and `tensorflow` is just a virtual pip package. No code changes are needed for projects using TensorFlow, the change is transparent +* XLA + + XLA HLO graphs can be inspected with interactive\_graphviz tool now. + + Adds Philox support to new stateful RNG's XLA path. +* Estimator + + Use `tf.compat.v1.estimator.inputs` instead of `tf.estimator.inputs` + + Replace `contrib` references with `tf.estimator.experimental.*` for APIs in `early_stopping.py` + + Determining the “correct” value of the `--iterations_per_loop` for TPUEstimator or DistributionStrategy continues to be a challenge for our users. We propose dynamically tuning the `--iterations_per_loop` variable, specifically for using TPUEstimator in training mode, based on a user target TPU execution time. Users might specify a value such as: `--iterations_per_loop=300s`, which will result in roughly 300 seconds being spent on the TPU between host side operations. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +1e100, 4d55397500, a6802739, abenmao, Adam Richter, Adam Weiss, Ag Ramesh, Alan Du, Albin Joy, Alex, Aman Patel, Amit, Amit Kumar Jaiswal, Amit Srivastava, Andreas Eberle, Andy Craze, Anthony Hsu, Anthony Platanios, Anuj Rawat, Armen Poghosov, armenpoghosov, arp95, Arpit Shah, Ashwin Ramaswami, Augustina Ragwitz, Aurelien Geron, AuréLien Geron, avasid, aweers, awesomealex1, Ayush Agrawal, Bayberry Z, Ben Barsdell, Bharat Raghunathan, Bhavani Subramanian, Bin Fan, blairhan, BléNesi Attila, Bodin-E, Brandon Carter, candy.dc, Cheng Chang, Chao Liu, chenchc, chie8842, Christian Hansen, Christian Sigg, Christoph Boeddeker, Clayne Robison, crafet, csukuangfj, ctiijima, Dan Jarvis, Dan Lazewatsky, Daniel Ingram, Daniel Rasmussen, Daniel Salvadori, Dave Airlie, David Norman, Dayananda V, Dayananda-V, delock, Denis Khalikov, Deven Desai, Dheeraj Rajaram Reddy, dmitrievanthony, Donovan Ong, Drew Szurko, Duncan Riach, Dustin Neighly, Edward Forgacs, EFanZh, Evgeniy Polyakov, Fangjun Kuang, Federico Martinez, Fei Hu, Felix Lemke, Filip Matzner, fo40225, Fred Reiss, Gautam, gehring, Geoffrey Irving, George Sterpu, Grzegorz George Pawelczak, Grzegorz Pawelczak, Gurpreet Singh, Gyoung-Yoon Ryoo, HanGuo97, Hanton Yang, Hari Shankar, hehongliang, Heungsub Lee, Hoeseong Kim, Huan Li (李卓桓), I-Hong Jhuo, Ilango R, Innovimax, Irene Dea, Jacky Ko, Jakub Lipinski, Jason Zaman, jcf94, Jeffrey Poznanovic, Jens Elofsson, Jeroen BéDorf, jhalakp, Jia Qingtong, Jiankang, Joe Q, Joe Quadrino, Joeran Beel, Jonas Rauber, Jonathan, Jonathan Kyl, Joppe Geluykens, Joseph Friedman, jtressle, jwu, K Yasaswi Sri Chandra Gandhi, K. Hodges, Kaixi Hou, Karl Lessard, Karl Weinmeister, Karthik Muthuraman, Kashif Rasul, KDR, Keno Fischer, Kevin Mader, Kilaru Yasaswi Sri Chandra Gandhi, kjopek, Koan-Sin Tan, kouml, ktaebum, Lakshay Tokas, Laurent Le Brun, Letian Kang, Li, Guizi, Loo Rong Jie, Lucas Hendren, Lukas Geiger, Luke Han, luxupu, lvli, Ma, Guokai, Mahmoud Abuzaina, Maksym Kysylov, Mandar Deshpande, manhyuk, Marco Gaido, Marek Drozdowski, Mark Collier, Mark Ryan, mars20, Mateusz Chudyk, Matt Conley, MattConley, mbhuiyan, mdfaijul, Melissa Grueter, Michael KäUfl, MickaëL Schoentgen, Miguel Morin, Mihail Salnikov, Mikalai Drabovich, Mike Arpaia, Mike Holcomb, monklof, Moses Marin, Mr. Metal, Mshr-H, nammbash, Natalia Gimelshein, Nathan Luehr, Nayana-Ibm, neargye, Neeraj Pradhan, Nehal J Wani, Nick, Nick Lewycky, Niels Ole Salscheider, Niranjan Hasabnis, nlewycky, Nuka-137, Nutti, olicht, omeir1, P Sudeepam, Palmer Lao, Pan Daoxin, Pariksheet Pinjari, Pasquale Minervini, Pavel Akhtyamov, Pavel Samolysov, PENGWA, Philipp Jund, Pooya Davoodi, Pranav Marathe, R S Nikhil Krishna, Rohit Gupta, Roland Zimmermann, Roman Soldatow, rthadur, Ruizhe, Ryan Jiang, saishruthi, Samantha Andow, Sami Kama, Sana-Damani, Saurabh Deoras, sdamani, Sean Morgan, seanshpark, Sebastien Iooss, Sergii Khomenko, Serv-Inc, Shahzad Lone, Shashank Gupta, Shashi, shashvat, Shashvat Chand Shahi, Siju, Siju Samuel, Snease-Abq, Spencer Schaber, sremedios, srinivasan.narayanamoorthy, Steve Lang, Steve Nesae, Subin, Sumesh Udayakumaran, sunway513, Supriya Rao, sxwang, Takeo Sawada, Taylor Jakobson, Taylor Thornton, Ted Chang, ThisIsPIRI, Thomas Deegan, Thomas Hagebols, tianyapiaozi, Tim Zaman, tomguluson92, Tongxuan Liu, Trent Lo, TungJerry, Tyorden, v1incent, Vagif, vcarpani, Vijay Ravichandran, Vikram Tiwari, Viktor Gal, Vincent, Vishnuvardhan Janapati, Vishwak Srinivasan, Vitor-Alves, wangsiyu, wateryzephyr, WeberXie, WeijieSun, Wen-Heng (Jack) Chung, wenxizhu, Will Battel, William D. Irons, wyzhao, Xiaoming (Jason) Cui, Xiaoquan Kong, Xin, Yasuhiro Matsumoto, ymodak, Yong Tang, Younes Khoudli, Yuan (Terry) Tang, Yuan Lin, Yves-Noel Weweler, Zantares, zhuoryin, zjjott, 卜居, 王振华 (Zhenhua Wang), 黄鑫 diff --git a/corpus/changelog/tensorflow_releases/tensorflow_1150.md b/corpus/changelog/tensorflow_releases/tensorflow_1150.md new file mode 100644 index 0000000000000000000000000000000000000000..63bc656933f9b31bd1d9999d77e9cacddaaa056f --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_1150.md @@ -0,0 +1,157 @@ +# TensorFlow 1.15.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v1.15.0 +Version: 1.15.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@goldiegadde](https://avatars.githubusercontent.com/u/43185254?s=40&v=4) +[goldiegadde](/goldiegadde) +released this +16 Oct 18:01 + +· +[229 commits](/tensorflow/tensorflow/compare/v1.15.0...r1.15) +to r1.15 +since this release + +[v1.15.0](/tensorflow/tensorflow/tree/v1.15.0) + +[`590d6ee`](/tensorflow/tensorflow/commit/590d6eef7e91a6a7392c8ffffb7b58f2e0c8bc6b) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 1.15.0 + +This is the last 1.x release for TensorFlow. We do not expect to update the 1.x branch with features, although we will issue patch releases to fix vulnerabilities for at least one year. + +## Major Features and Improvements + +* As [announced](https://groups.google.com/a/tensorflow.org/forum/#!topic/developers/iRCt5m4qUz0), `tensorflow` pip package will by default include GPU support (same as `tensorflow-gpu` now) for the platforms we currently have GPU support (Linux and Windows). It will work on machines with and without Nvidia GPUs. `tensorflow-gpu` will still be available, and CPU-only packages can be downloaded at `tensorflow-cpu` for users who are concerned about package size. +* TensorFlow 1.15 contains a complete implementation of the 2.0 API in its `compat.v2` module. It contains a copy of the 1.15 main module (without `contrib`) in the `compat.v1` module. TensorFlow 1.15 is able to emulate 2.0 behavior using the `enable_v2_behavior()` function. + This enables writing forward compatible code: by explicitly importing either `tensorflow.compat.v1` or `tensorflow.compat.v2`, you can ensure that your code works without modifications against an installation of 1.15 or 2.0. +* `EagerTensor` now supports numpy buffer interface for tensors. +* Add toggles `tf.enable_control_flow_v2()` and `tf.disable_control_flow_v2()` for enabling/disabling v2 control flow. +* Enable v2 control flow as part of `tf.enable_v2_behavior()` and `TF2_BEHAVIOR=1`. +* AutoGraph translates Python control flow into TensorFlow expressions, allowing users to write regular Python inside `tf.function`-decorated functions. AutoGraph is also applied in functions used with `tf.data`, `tf.distribute` and `tf.keras` APIS. +* Adds `enable_tensor_equality()`, which switches the behavior such that: + + Tensors are no longer hashable. + + Tensors can be compared with `==` and `!=`, yielding a Boolean Tensor with element-wise comparison results. This will be the default behavior in 2.0. +* Auto Mixed-Precision graph optimizer simplifies converting models to `float16` for acceleration on Volta and Turing Tensor Cores. This feature can be enabled by wrapping an optimizer class with `tf.train.experimental.enable_mixed_precision_graph_rewrite()`. +* Add environment variable `TF_CUDNN_DETERMINISTIC`. Setting to "true" or "1" forces the selection of deterministic cuDNN convolution and max-pooling algorithms. When this is enabled, the algorithm selection procedure itself is also deterministic. +* TensorRT + + Migrate TensorRT conversion sources from contrib to compiler directory in preparation for TF 2.0. + + Add additional, user friendly `TrtGraphConverter` API for TensorRT conversion. + + Expand support for TensorFlow operators in TensorRT conversion (e.g. + `Gather`, `Slice`, `Pack`, `Unpack`, `ArgMin`, `ArgMax`,`DepthSpaceShuffle`). + + Support TensorFlow operator `CombinedNonMaxSuppression` in TensorRT conversion which + significantly accelerates object detection models. + +## Breaking Changes + +* Tensorflow code now produces 2 different pip packages: `tensorflow_core` containing all the code (in the future it will contain only the private implementation) and `tensorflow` which is a virtual pip package doing forwarding to `tensorflow_core` (and in the future will contain only the public API of tensorflow). We don't expect this to be breaking, unless you were importing directly from the implementation. +* TensorFlow 1.15 is built using devtoolset7 (GCC7) on Ubuntu 16. This may lead to ABI incompatibilities with extensions built against earlier versions of TensorFlow. +* Deprecated the use of `constraint=` and `.constraint` with ResourceVariable. +* `tf.keras`: + + `OMP_NUM_THREADS` is no longer used by the default Keras config. To configure the number of threads, use `tf.config.threading` APIs. + + `tf.keras.model.save_model` and `model.save` now defaults to saving a TensorFlow SavedModel. + + `keras.backend.resize_images` (and consequently, `keras.layers.Upsampling2D`) behavior has changed, a bug in the resizing implementation was fixed. + + Layers now default to `float32`, and automatically cast their inputs to the layer's dtype. If you had a model that used `float64`, it will probably silently use `float32` in TensorFlow2, and a warning will be issued that starts with Layer "layer-name" is casting an input tensor from dtype float64 to the layer's dtype of float32. To fix, either set the default dtype to float64 with `tf.keras.backend.set_floatx('float64')`, or pass `dtype='float64'` to each of the Layer constructors. See `tf.keras.layers.Layer` for more information. + + Some `tf.assert_*` methods now raise assertions at operation creation time (i.e. when this Python line executes) if the input tensors' values are known at that time, not during the session.run(). When this happens, a noop is returned and the input tensors are marked non-feedable. In other words, if they are used as keys in `feed_dict` argument to `session.run()`, an error will be raised. Also, because some assert ops don't make it into the graph, the graph structure changes. A different graph can result in different per-op random seeds when they are not given explicitly (most often). + +## Bug Fixes and Other Changes + +* `tf.estimator`: + + `tf.keras.estimator.model_to_estimator` now supports exporting to `tf.train.Checkpoint` format, which allows the saved checkpoints to be compatible with `model.load_weights`. + + Fix tests in canned estimators. + + Expose Head as public API. + + Fixes critical bugs that help with `DenseFeatures` usability in TF2 +* `tf.data`: + + Promoting `unbatch` from experimental to core API. + + Adding support for datasets as inputs to `from_tensors` and `from_tensor_slices` and batching and unbatching of nested datasets. +* `tf.keras`: + + `tf.keras.estimator.model_to_estimator` now supports exporting to tf.train.Checkpoint format, which allows the saved checkpoints to be compatible with `model.load_weights`. + + Saving a Keras Model using `tf.saved_model.save` now saves the list of variables, trainable variables, regularization losses, and the call function. + + Deprecated `tf.keras.experimental.export_saved_model` and `tf.keras.experimental.function`. Please use `tf.keras.models.save_model(..., save_format='tf')` and `tf.keras.models.load_model` instead. + + Add an `implementation=3` mode for `tf.keras.layers.LocallyConnected2D` and `tf.keras.layers.LocallyConnected1D` layers using `tf.SparseTensor` to store weights, allowing a dramatic speedup for large sparse models. + + Enable the Keras compile API `experimental_run_tf_function` flag by default. This flag enables single training/eval/predict execution path. With this 1. All input types are converted to `Dataset`. 2. When distribution strategy is not specified this goes through the no-op distribution strategy path. 3. Execution is wrapped in tf.function unless `run_eagerly=True` is set in compile. + + Raise error if `batch_size` argument is used when input is dataset/generator/keras sequence. +* `tf.lite` + + Add `GATHER` support to NN API delegate. + + tflite object detection script has a debug mode. + + Add delegate support for `QUANTIZE`. + + Added evaluation script for COCO minival. + + Add delegate support for `QUANTIZED_16BIT_LSTM`. + + Converts hardswish subgraphs into atomic ops. +* Add support for defaulting the value of `cycle_length` argument of `tf.data.Dataset.interleave` to the number of schedulable CPU cores. +* `parallel_for`: Add converter for `MatrixDiag`. +* Add `narrow_range` attribute to `QuantizeAndDequantizeV2` and V3. +* Added new op: `tf.strings.unsorted_segment_join`. +* Add HW acceleration support for `topK_v2`. +* Add new `TypeSpec` classes. +* CloudBigtable version updated to v0.10.0. +* Expose `Head` as public API. +* Update docstring for gather to properly describe the non-empty `batch_dims` case. +* Added `tf.sparse.from_dense` utility function. +* Improved ragged tensor support in `TensorFlowTestCase`. +* Makes the a-normal form transformation in Pyct configurable as to which nodes are converted to variables and which are not. +* `ResizeInputTensor` now works for all delegates. +* Add `EXPAND_DIMS` support to NN API delegate TEST: expand\_dims\_test +* `tf.cond` emits a StatelessIf op if the branch functions are stateless and do not touch any resources. +* `tf.cond`, `tf.while` and `if` and `while` in AutoGraph now accept a nonscalar predicate if has a single element. This does not affect non-V2 control flow. +* `tf.while_loop` emits a StatelessWhile op if the cond and body functions are stateless and do not touch any resources. +* Refactors code in Quant8 LSTM support to reduce TFLite binary size. +* Add support of local soft device placement for eager op. +* Add HW acceleration support for `LogSoftMax`. +* Added a function `nested_value_rowids` for ragged tensors. +* Add guard to avoid acceleration of L2 Normalization with input rank != 4 +* Add `tf.math.cumulative_logsumexp operation`. +* Add `tf.ragged.stack`. +* Fix memory allocation problem when calling `AddNewInputConstantTensor`. +* Delegate application failure leaves interpreter in valid state. +* Add check for correct memory alignment to `MemoryAllocation::MemoryAllocation()`. +* Extracts `NNAPIDelegateKernel` from nnapi\_delegate.cc +* Added support for `FusedBatchNormV3` in converter. +* A ragged to dense op for directly calculating tensors. +* Fix accidental quadratic graph construction cost in graph-mode `tf.gradients()`. +* The `precision_mode` argument to `TrtGraphConverter` is now case insensitive. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +a6802739, Aaron Ma, Abdullah Selek, Abolfazl Shahbazi, Ag Ramesh, Albert Z. Guo, Albin Joy, Alex Itkes, Alex Sergeev, Alexander Pivovarov, Alexey Romanov, alhkad, Amit Srivastava, amoitra, Andrew Lihonosov, Andrii Prymostka, Anuj Rawat, Astropeak, Ayush Agrawal, Bairen Yi, Bas Aarts, Bastian Eichenberger, Ben Barsdell, Benjamin Peterson, bhack, Bharat Raghunathan, Bhavani Subramanian, Bryan Cutler, candy.dc, Cao Zongyan, Captain-Pool, Casper Da Costa-Luis, Chen Guoyin, Cheng Chang, chengchingwen, Chong Yan, Choong Yin Thong, Christopher Yeh, Clayne Robison, Coady, Patrick, Dan Ganea, David Norman, Denis Khalikov, Deven Desai, Diego Caballero, Duncan Dean, Duncan Riach, Dwight J Lyle, Eamon Ito-Fisher, eashtian3, EFanZh, ejot, Elroy Ashtian Jr, Eric Schweitz, Fangjun Kuang, Fei Hu, fo40225, formath, Fred Reiss, Frederic Bastien, Fredrik Knutsson, G. Hussain Chinoy, Gabriel, gehring, George Grzegorz Pawelczak, Gianluca Varisco, Gleb Popov, Greg Peatfield, Guillaume Klein, Gurpreet Singh, Gustavo Lima Chaves, haison, Haraldur TóMas HallgríMsson, HarikrishnanBalagopal, HåKon Sandsmark, I-Hong, Ilham Firdausi Putra, Imran Salam, Jason Zaman, Jason Zavaglia, jayhpark530, jefby, Jeff Daily, Jeffrey Poznanovic, Jekyll Lai, Jeroen BéDorf, Jerry Shih, jerryyin, jiakai, JiangXIAO, Joe Bowser, Joel Shapiro, Johan Gunnarsson, Jojimon Varghese, Joon, Josh Beal, Julian Niedermeier, Jun Wan, Junqin Zhang, Junyuan Xie, Justin Tunis, Kaixi Hou, Karl Lessard, Karthik Muthuraman, Kbhute-Ibm, khanhlvg, Koock Yoon, kstuedem, Kyuwon Kim, Lakshay Tokas, leike666666, leonard951, Leslie-Fang, Leslie-Fang-Intel, Li, Guizi, Lukas Folle, Lukas Geiger, Mahmoud Abuzaina, Manraj Singh Grover, Margaret Maynard-Reid, Mark Ryan, Matt Conley, Matthew Bentham, Matthew Denton, mbhuiyan, mdfaijul, Mei Jie, merturl, MichaelKonobeev, Michal W. Tarnowski, minds, mpppk, musikisomorphie, Nagy Mostafa, Nayana Thorat, Neil, Niels Ole Salscheider, Niklas SilfverströM, Niranjan Hasabnis, ocjosen, olramde, Pariksheet Pinjari, Patrick J. Lopresti, Patrik Gustavsson, per1234, PeterLee, Phan Van Nguyen Duc, Phillip Kravtsov, Pooya Davoodi, Pranav Marathe, Putra Manggala, Qingqing Cao, Rajeshwar Reddy T, Ramon ViñAs, Rasmus Diederichsen, Reuben Morais, richardbrks, robert, RonLek, Ryan Jiang, saishruthi, Saket Khandelwal, Saleem Abdulrasool, Sami Kama, Sana-Damani, Sergii Khomenko, Severen Redwood, Shubham Goyal, Sigrid Keydana, Siju Samuel, sleighsoft, smilu97, Son Tran, Srini511, srinivasan.narayanamoorthy, Sumesh Udayakumaran, Sungmann Cho, Tae-Hwan Jung, Taehoon Lee, Takeshi Watanabe, TengLu, terryky, TheMindVirus, ThisIsIsaac, Till Hoffmann, Timothy Liu, Tomer Gafner, Tongxuan Liu, Trent Lo, Trevor Morris, Uday Bondhugula, Vasileios Lioutas, vbvg2008, Vishnuvardhan Janapati, Vivek Suryamurthy, Wei Wang, Wen-Heng (Jack) Chung, wenxizhu, William D. Irons, winstonq, wyzhao, Xiaoming (Jason) Cui, Xinan Jiang, Xinping Wang, Yann-Yy, Yasir Modak, Yong Tang, Yongfeng Gu, Yuchen Ying, Yuxin Wu, zyeric, 王振华 (Zhenhua Wang) diff --git a/corpus/changelog/tensorflow_releases/tensorflow_120.md b/corpus/changelog/tensorflow_releases/tensorflow_120.md new file mode 100644 index 0000000000000000000000000000000000000000..3b4af1cc0404b30cbca8ea77e34776d15cb496a3 --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_120.md @@ -0,0 +1,199 @@ +# TensorFlow 1.2.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v1.2.0 +Version: 1.2.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@av8ramit](https://avatars.githubusercontent.com/u/5588272?s=40&v=4) +[av8ramit](/av8ramit) +released this +15 Jun 21:23 + +· +[21 commits](/tensorflow/tensorflow/compare/v1.2.0...r1.2) +to r1.2 +since this release + +[v1.2.0](/tensorflow/tensorflow/tree/v1.2.0) + +[`12f033d`](/tensorflow/tensorflow/commit/12f033df4c8fa3feb88ce936eb1581eaa92b303e) + +# Release 1.2.0 + +## Major Features and Improvements + +* Python 3.6 support on Windows. +* Added `tf.layers.conv3d_transpose` layer for spatio temporal deconvolution. +* Added `tf.Session.make_callable()`, which provides a lower overhead means of running a similar step multiple times. +* Added ibverbs-based RDMA support to contrib (courtesy [@junshi15](https://github.com/junshi15) from Yahoo). +* `RNNCell` objects now subclass `tf.layers.Layer`. The strictness described + in the TensorFlow 1.1 release is gone: The first time an RNNCell is used, + it caches its scope. All future uses of the RNNCell will reuse variables from + that same scope. This is a breaking change from the behavior of RNNCells + in TensorFlow versions <= 1.0.1. TensorFlow 1.1 had checks in place to + ensure old code works correctly with the new semantics; this version + allows more flexible uses of RNNCell but can lead to subtle errors if + using code meant for TensorFlow <= 1.0.1. For example, writing: + `MultiRNNCell([lstm] * 5)` will now build a 5-layer LSTM stack where each + layer shares the **same** parameters. To get 5 layers each with their own + parameters, write: `MultiRNNCell([LSTMCell(...) for _ in range(5)])`. + If at all unsure, first test your code with TF 1.1; ensure it raises no + errors, and then upgrade to TF 1.2. +* TensorForest Estimator now supports SavedModel export for serving. +* Support client-provided ClusterSpec's and propagate them to all workers to enable the creation of dynamic TensorFlow clusters. +* TensorFlow C library now available for Windows. +* We released a new open-source version of TensorBoard. +* [`SavedModel CLI`](https://www.tensorflow.org/versions/master/programmers_guide/saved_model_cli) tool available to inspect and execute MetaGraph in SavedModel +* Android releases of TensorFlow are now pushed to jcenter for easier + integration into apps. See + + for more details. +* RNNCells' variable names have been renamed for consistency with Keras layers. + Specifically, the previous variable names "weights" and "biases" have + been changed to "kernel" and "bias", respectively. + This may cause backward incompatibility with regard to your old + checkpoints containing such RNN cells, in which case you can use the tool + [checkpoint\_convert script](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/rnn/python/tools/checkpoint_convert.py) + to convert the variable names in your old checkpoints. +* Many of the RNN functions and classes that were in the `tf.nn` namespace + before the 1.0 release and which were moved to `tf.contrib.rnn` have now + been moved back to the core namespace. This includes + `RNNCell`, `LSTMCell`, `GRUCell`, and a number of other cells. These + now reside in `tf.nn.rnn_cell` (with aliases in `tf.contrib.rnn` for backwards + compatibility). The original `tf.nn.rnn` function is now `tf.nn.static_rnn`, + and the bidirectional static and state saving static rnn functions are also + now back in the `tf.nn` namespace. + + Notable exceptions are the `EmbeddingWrapper`, `InputProjectionWrapper` and + `OutputProjectionWrapper`, which will slowly be moved to deprecation + in `tf.contrib.rnn`. These are inefficient wrappers that should often + be replaced by calling `embedding_lookup` or `layers.dense` as pre- or post- + processing of the rnn. For RNN decoding, this functionality has been replaced + with an alternative API in `tf.contrib.seq2seq`. +* Intel MKL Integration (). Intel developed a number of + optimized deep learning primitives: In addition to matrix multiplication and + convolution, these building blocks include: + Direct batched convolution + Pooling: maximum, minimum, average + Normalization: LRN, batch normalization + Activation: rectified linear unit (ReLU) + Data manipulation: multi-dimensional transposition (conversion), split, + concat, sum and scale. + +## Deprecations + +* TensorFlow 1.2 may be the last time we build with cuDNN 5.1. Starting with + TensorFlow 1.3, we will try to build all our prebuilt binaries with cuDNN 6.0. + While we will try to keep our source code compatible with cuDNN 5.1, it will + be best effort. + +## Breaking Changes to the API + +* `org.tensorflow.contrib.android.TensorFlowInferenceInterface` now throws exceptions where possible and has simplified method signatures. + +## Changes to contrib APIs + +* Added `tf.contrib.util.create_example`. +* Added bilinear interpolation to `tf.contrib.image`. +* Add `tf.contrib.stateless` for random ops with custom seed control. +* MultivariateNormalFullCovariance added to contrib/distributions/ +* tensorflow/contrib/rnn undergoes RNN cell variable renaming for + consistency with Keras layers. Specifically, the previous variable names + "weights" and "biases" are changed to "kernel" and "bias", respectively. + This may cause backward incompatibility with regard to your old + checkpoints containing such RNN cells, in which case you can use the + [checkpoint\_convert script](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/rnn/python/tools/checkpoint_convert.py) + to convert the variable names in your old checkpoints. +* Added `tf.contrib.kernel_methods` module with Ops and estimators for primal + (explicit) kernel methods in TensorFlow. + +## Bug Fixes and Other Changes + +* In python, `Operation.get_attr` on type attributes returns the Python DType + version of the type to match expected get\_attr documentation rather than the + protobuf enum. +* Changed MIN\_SDK version to 8.0 when building iOS libraries. +* Fixed LIBXSMM integration. +* Make decode\_jpeg/decode\_png/decode\_gif handle all formats, since users frequently try to decode an image as the wrong type. +* Improve implicit broadcasting lowering. +* Improving stability of GCS/Bigquery clients by a faster retrying of stale transmissions. +* Remove OpKernelConstruction::op\_def() as part of minimizing proto dependencies. +* VectorLaplaceDiag distribution added. +* Android demo no longer requires libtensorflow\_demo.so to run (libtensorflow\_inference.so still required) +* Added `categorical_column_with_vocabulary_file`. +* Introduce ops for batching/unbatching tensors across Session::Run() calls. +* Add tf.log\_sigmoid(x) = tf.log(tf.sigmoid(x)) = -tf.nn.softplus(-x). +* Changed hooks lists to immutable tuples, and now allow any iterable for the associated arguments. +* Introduce TFDecorator. +* Added an Mfcc op for speech feature generation. +* Improved DirectSession::Run() overhead and error checking. Feeding a value of the wrong type will now synchronously raise an INVALID\_ARGUMENT error instead of asynchronously raising an INTERNAL error. Code that depends on the (undefined) behavior when feeding a tensor of the wrong type may need to be updated. +* Added unreduced NONE, and reduced MEAN options for losses. Removed "WEIGHTED\_" prefix from other Reduction constants. +* assertAllClose now handles dicts. +* Added Gmock matcher for HloInstructions. +* Add var name to errors on variable restore. +* Added an AudioSpectrogram op for audio feature generation. +* Added `reduction` arg to losses. +* `tf.placeholder` can represent scalar shapes and partially known. +* Remove estimator\_spec(mode) argument. +* Added an AudioSpectrogram op for audio feature generation. +* TensorBoard disables all runs by default if there are more than 40 runs. +* Removed old doc generator code. +* GCS file system integration now supports domain buckets, e.g gs://bucket.domain.com/path. +* Add `tf.summary.text` for outputting text to TensorBoard. +* The "run" command of tfdbg's command-line interface now supports filtering of tensors by node name, op type and tensor dtype. +* `tf.string_to_number` now supports int64 and float64 outputs. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +4F2E4A2E, Aaron Schumacher, Abhi Agg, admcrae, Adriano Carmezim, Adrià Arrufat, +agramesh1, Akimitsu Seo, Alan Mosca, Alex Egg, Alex Rothberg, Alexander Heinecke, +Alexander Matyasko, Alexandr Baranezky, Alexandre Caulier, Ali Siddiqui, Anand Venkat, +Andrew Hundt, Androbin, Anmol Sharma, Arie, Arno Leist, Arron Cao, AuréLien Geron, Bairen Yi, +Beomsu Kim, Carl Thomé, cfperez, Changming Sun, Corey Wharton, critiqjo, Dalei Li, Daniel +Rasmussen, Daniel Trebbien, DaríO Hereñú, David Eng, David Norman, David Y. Zhang, Davy Song, ddurham2, +Deepak Subburam, Dmytro Kyrychuk, Dominic Rossi, Dominik SchlöSser, Dustin Tran, +Eduardo Pinho, Egil Martinsson, Elliot Saba, Eric Bigelow, Erik Smistad, Evan Klitzke, +Fabrizio Milo, Falcon Dai, Fei Gao, FloopCZ, Fung Lam, Gautam, GBLin5566, Greg Peatfield, +Gu Wang, Guenther Schmuelling, Hans Pabst, Harun Gunaydin, Huaizheng, Ido Shamay, Ikaro +Silva, Ilya Edrenkin, Immexxx, James Mishra, Jamie Cooke, Jay Young, Jayaram Bobba, +Jianfei Wang, jinghua2, Joey Meyer, John Maidens, Jonghoon Jin, Julian Villella, +Jun Kim, Jun Shi, Junwei Pan, jyegerlehner, Karan Desai, Karel Van De Plassche, +Kb Sriram, KhabarlakKonstantin, Koan-Sin Tan, krivard, Kwotsin, Leandro Gracia Gil, +Li Chen, Liangliang He, Louie Helm, lspvic, Luiz Henrique Soares, LáSzló Csomor, +Mark Wong, Mathew Wicks, Matthew Rahtz, Maxwell Paul Brickner, Michael Hofmann, Miguel +Flores Ruiz De Eguino, MikeTam1021, Mortada Mehyar, Mycosynth, Namnamseo, +Nate Harada, Neven Miculinic, Nghia Tran, Nick Lyu, Niranjan Hasabnis, Nishidha, Oleksii +Kuchaiev, Oyesh Mann Singh, Panmari, Patrick, Paul Van Eck, Piyush Chaudhary, Quim Llimona, +Raingo, Richard Davies, Ruben Vereecken, Sahit Chintalapudi, Sam Abrahams, Santiago Castro, +Scott Sievert, Sean O'Keefe, Sebastian Schlecht, Shane, Shubhankar Deshpande, Spencer Schaber, +Sunyeop Lee, t13m, td2014, Thomas H. P. Andersen, Toby Petty, Umang Mehta, +Vadim Markovtsev, Valentin Iovene, Vincent Zhao, Vit Stepanovs, Vivek Rane, Vu Pham, wannabesrevenge, +weipingpku, wuhaixutab, wydwww, Xiang Gao, Xiaolin Lin, xiaoyaozhuzi, Yaroslav Bulatov, Yi Liu, +Yoshihiro Sugi, Yuan (Terry) Tang, Yuming Wang, Yuxin Wu, Zader Zheng, Zhaojun Zhang, zhengjiajin, +ZhipengShen, Ziming Dong, zjj2wry + +We are also grateful to all who filed issues or helped resolve them, asked and +answered questions, and were part of inspiring discussions. diff --git a/corpus/changelog/tensorflow_releases/tensorflow_130.md b/corpus/changelog/tensorflow_releases/tensorflow_130.md new file mode 100644 index 0000000000000000000000000000000000000000..925a2839d559b490b1971542c3bc36a15f6ba6fc --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_130.md @@ -0,0 +1,166 @@ +# TensorFlow 1.3.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v1.3.0 +Version: 1.3.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@av8ramit](https://avatars.githubusercontent.com/u/5588272?s=40&v=4) +[av8ramit](/av8ramit) +released this +17 Aug 01:30 + +· +[50 commits](/tensorflow/tensorflow/compare/v1.3.0...r1.3) +to r1.3 +since this release + +[v1.3.0](/tensorflow/tensorflow/tree/v1.3.0) + +[`9e76bf3`](/tensorflow/tensorflow/commit/9e76bf324f6bac63137a02bb6e6ec9120703ea9b) + +# Release 1.3.0 + +See also [TensorBoard 0.1.4](https://github.com/tensorflow/tensorboard/releases/tag/0.1.4) release notes. + +## Major Features and Improvements + +* Added canned estimators to Tensorflow library. List of added estimators: + + `DNNClassifier` + + `DNNRegressor` + + `LinearClassifier` + + `LinearRegressor` + + `DNNLinearCombinedClassifier` + + `DNNLinearCombinedRegressor`. +* All our prebuilt binaries have been built with cuDNN 6. We anticipate releasing TensorFlow 1.4 with cuDNN 7. +* `import tensorflow` now goes much faster. +* Adds a file cache to the GCS filesystem with configurable max staleness for file contents. This permits caching of file contents across close/open boundaries. +* Added an axis parameter to `tf.gather`. +* Added a `constant_values` keyword argument to `tf.pad`. +* Adds `Dataset.interleave` transformation. +* Add `ConcatenateDataset` to concatenate two datasets. +* Added Mobilenet support to TensorFlow for Poets training script. +* Adds a block cache to the GCS filesystem with configurable block size and count. +* SinhArcSinh bijector added. +* Added `Dataset.list_files` API. +* Introduces new operations and Python bindings for the Cloud TPU. +* Adding TensorFlow-iOS CocoaPod for symmetry with tensorflow-android. +* Introduces base implementations of ClusterResolvers. +* Unify memory representations of TensorShape and PartialTensorShape. As a consequence, tensors now have a maximum of 254 dimensions, not 255. +* Changed references to LIBXSMM to use version 1.8.1. +* TensorFlow Debugger (tfdbg): + + Display summaries of numeric tensor values with the `-s` flag to command `print_tensor` or `pt`. + + Display feed values with the `print_feed` or `pf` command and clickable links in the curses UI. + + Runtime profiler at the op level and the Python source line level with the `run -p` command. +* Initial release of the statistical distribution library `tf.distributions`. +* GPU kernels and speed improvements for for unary `tf.where` and `tf.nn.top_k`. +* Monotonic Attention wrappers added to `tf.contrib.seq2seq`. +* Added `tf.contrib.signal`, a library for signal processing primitives. +* Added `tf.contrib.resampler`, containing CPU and GPU ops for differentiable resampling of images. + +## Breaking Changes to the API + +* `tf.RewriterConfig` was removed from the Python API after being available in 1.2 release candidates (it was never in an actual release). Graph rewriting is still available, just not as `tf.RewriterConfig`. Instead add an explicit import. +* Breaking change to `tf.contrib.data.Dataset` APIs that expect a nested structure. Lists are now converted to `tf.Tensor` implicitly. You may need to change uses of lists to tuples in existing code. In addition, dicts are now supported as a nested structure. + +## Changes to contrib APIs + +* Adds tf.contrib.nn.rank\_sampled\_softmax\_loss, a sampled-softmax variant that can improve rank loss. +* `tf.contrib.metrics`.{streaming\_covariance,streaming\_pearson\_correlation} modified to return nan when they have seen less or equal to 1 unit of weight. +* Adds time series models to contrib. See contrib/timeseries/README.md for details. +* Adds FULLY\_CONNECTED Op to tensorflow/contrib/lite/schema.fbs + +## Known Issues + +* Tensorflow\_gpu compilation fails with Bazel 0.5.3. + +## Bug Fixes and Other Changes + +* Fixes `strides` and `begin` dtype mismatch when slicing using int64 Tensor index in python. +* Improved convolution padding documentation. +* Add a tag constant, gpu, to present graph with GPU support. +* `saved_model.utils` now support SparseTensors transparently. +* A more efficient implementation of non-max suppression. +* Add support for the shrinkage-type L2 to FtrlOptimizer in addition to the online L2 it already supports. +* Fix negative variance in moments calculation. +* Expand UniqueOp Benchmark Tests to cover more collision cases. +* Improves stability of GCS filesystem on Mac. +* Add time estimation to HloCostAnalysis. +* Fixed the bug in Estimator that params in constructor was not a deepcopy of the user provided one. This bugs inadvertently enabled user to mutate the params after the creation of Estimator, leading to potentially undefined behavior. +* Added None check for save\_path in `saver.restore`. +* Register devices under their legacy names in device\_mgr to ease the transition to clusterspec-propagated configurations. +* VectorExponential added to distributions. +* Add a bitwise module with bitwise\_and, bitwise\_or, bitwise\_xor, and invert functions. +* Add fixed-grid ODE integration routines. +* Allow passing bounds to ScipyOptimizerInterface. +* Correctness fixes for fft\_length parameter to `tf.spectral.rfft` & `tf.spectral.irfft`. +* Exported model signatures using the 'predict' method will no longer have their input and output keys silently ignored and rewritten to 'inputs' and 'outputs'. If a model was exported with different names before 1.2, and is now served with tensorflow/serving, it will accept requests using 'inputs' and 'outputs'. Starting at 1.2, such a model will accept the keys specified during export. Therefore, inference requests using 'inputs' and 'outputs' may start to fail. To fix this, either update any inference clients to send requests with the actual input and output keys used by the trainer code, or conversely, update the trainer code to name the input and output Tensors 'inputs' and 'outputs', respectively. Signatures using the 'classify' and 'regress' methods are not affected by this change; they will continue to standardize their input and output keys as before. +* Add in-memory caching to the Dataset API. +* Set default end\_of\_sequence variable in datasets iterators to false. +* [Performance] Increase performance of `tf.layers.con2d` when setting use\_bias=True by 2x by using nn.bias\_add. +* Update iOS examples to use CocoaPods, and moved to tensorflow/examples/ios. +* Adds a family= attribute in `tf.summary` ops to allow controlling the tab name used in Tensorboard for organizing summaries. +* When GPU is configured, do not require --config=cuda, instead, automatically build for GPU if this is requested in the configure script. +* Fix incorrect sampling of small probabilities in CPU/GPU multinomial. +* Add a list\_devices() API on sessions to list devices within a cluster. Additionally, this change augment the ListDevices master API to support specifying a session. +* Allow uses of over-parameterized separable convolution. +* TensorForest multi-regression bug fix. +* Framework now supports armv7, cocoapods.org now displays correct page. +* Script to create iOS framework for CocoaPods. +* Android releases of TensorFlow are now pushed to jcenter for easier integration into apps. See for more details. +* TensorFlow Debugger (tfdbg): + + Fixed a bug that prevented tfdbg from functioning with multi-GPU setups. + + Fixed a bug that prevented tfdbg from working with `tf.Session.make_callable`. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +4F2E4A2E, Adriano Carmezim, Adrià Arrufat, Alan Yee, Alex Lattas, Alex Rothberg, +Alexandr Baranezky, Ali Siddiqui, Andreas Solleder, Andrei Costinescu, Andrew Hundt, +Androbin, Andy Kernahan, Anish Shah, Anthony Platanios, Arvinds-Ds, b1rd, Baptiste +Arnaud, Ben Mabey, Benedikt Linse, Beomsu Kim, Bo Wang, Boyuan Deng, Brett Koonce, +Bruno Rosa, Carl Thomé, Changming Sun, Chase Roberts, Chirag Bhatia, Chris Antaki, +Chris Hoyean Song, Chris Tava, Christos Nikolaou, Croath Liu, cxx, Czxck001, Daniel +Ylitalo, Danny Goodman, Darren Garvey, David Brailovsky, David Norman, DavidNorman, +davidpham87, ddurham2, Dhruv, DimanNe, Drew Hintz, Dustin Tran, Earthson Lu, ethiraj, +Fabian Winnen, Fei Sun, Freedom" Koan-Sin Tan, Fritz Obermeyer, Gao, Xiang, Gautam, +Guenther Schmuelling, Gyu-Ho Lee, Hauke Brammer, horance, Humanity123, J Alammar, +Jayeol Chun, Jeroen BéDorf, Jianfei Wang, jiefangxuanyan, Jing Jun Yin, Joan Puigcerver, +Joel Hestness, Johannes Mayer, John Lawson, Johnson145, Jon Malmaud, Jonathan Alvarez-Gutierrez, +Juang, Yi-Lin, Julian Viereck, Kaarthik Sivashanmugam, Karl Lessard, [karl@kubx.ca](mailto:karl@kubx.ca), Kevin +Carbone, Kevin Van Der Burgt, Kongsea, ksellesk, lanhin, Lef Ioannidis, Liangliang He, +Louis Tiao, Luke Iwanski, LáSzló Csomor, magixsno, Mahmoud Abuzaina, Marcel Hlopko, Mark +Neumann, Maxwell Paul Brickner, mdfaijul, MichaëL Defferrard, Michał JastrzęBski, Michele +Colombo, Mike Brodie, Mosnoi Ion, mouradmourafiq, myPrecious, Nayana Thorat, +Neeraj Kashyap, Nelson Liu, Niranjan Hasabnis, Olivier Moindrot, orome, Pankaj Gupta, Paul +Van Eck, peeyush18, Peng Yu, Pierre, preciousdp11, qjivy, Raingo, raoqiyu, ribx, Richard S. +Imaoka, Rishabh Patel, Robert Walecki, Rockford Wei, Ryan Kung, Sahil Dua, Sandip Giri, Sayed +Hadi Hashemi, sgt101, Shitian Ni, Shuolongbj, Siim PõDer, Simon Perkins, sj6077, SOLARIS, +Spotlight0xff, Steffen Eberbach, Stephen Fox, superryanguo, Sven Mayer, Tapan Prakash, +Tiago Morais Morgado, Till Hoffmann, Tj Rana, Vadim Markovtsev, vhasanov, Wei Wu, +windead, Yan (Asta) Li, Yan Chen, Yann Henon, Yi Wang, Yong Tang, yorkie, Yuan (Terry) +Tang, Yuxin Wu, zhengjiajin, zhongzyd, 黄璞 + +We are also grateful to all who filed issues or helped resolve them, asked and +answered questions, and were part of inspiring discussions. diff --git a/corpus/changelog/tensorflow_releases/tensorflow_140.md b/corpus/changelog/tensorflow_releases/tensorflow_140.md new file mode 100644 index 0000000000000000000000000000000000000000..454b13e36330033e7ef5c08138af0b627cc418e8 --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_140.md @@ -0,0 +1,172 @@ +# TensorFlow 1.4.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v1.4.0 +Version: 1.4.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@case540](https://avatars.githubusercontent.com/u/1299636?s=40&v=4) +[case540](/case540) +released this +02 Nov 18:29 + +· +[36 commits](/tensorflow/tensorflow/compare/v1.4.0...r1.4) +to r1.4 +since this release + +[v1.4.0](/tensorflow/tensorflow/tree/v1.4.0) + +[`d752244`](/tensorflow/tensorflow/commit/d752244fbaad5e4268243355046d30990f59418f) + +# Release 1.4.0 + +## Major Features And Improvements + +* `tf.keras` is now part of the core TensorFlow API. +* [`tf.data`](http://tensorflow.org/programmers_guide/datasets) is now part of + the core TensorFlow API. + + The API is now subject to backwards compatibility guarantees. + + For a guide to migrating from the `tf.contrib.data` API, see the + [README](https://github.com/tensorflow/tensorflow/blob/r1.4/tensorflow/contrib/data/README.md). + + Major new features include `Dataset.from_generator()` (for building an input + pipeline from a Python generator), and the `Dataset.apply()` method for + applying custom transformation functions. + + Several custom transformation functions have been added, including + `tf.contrib.data.batch_and_drop_remainder()` and + `tf.contrib.data.sloppy_interleave()`. +* Add `train_and_evaluate` for simple distributed `Estimator` training. +* Add `tf.spectral.dct` for computing the DCT-II. +* Add Mel-Frequency Cepstral Coefficient support to `tf.contrib.signal` + (with GPU and gradient support). +* Add a self-check on `import tensorflow` for Windows DLL issues. +* Add NCHW support to `tf.depth_to_space` on GPU. +* TensorFlow Debugger (tfdbg): + + Add `eval` command to allow evaluation of arbitrary Python/numpy expressions + in tfdbg command-line interface. See + [Debugging TensorFlow Programs](https://www.tensorflow.org/programmers_guide/debugger) + for more details. + + Usability improvement: The frequently used tensor filter `has_inf_or_nan` is + now added to `Session` wrappers and hooks by default. So there is no need + for clients to call `.add_tensor_filter(tf_debug.has_inf_or_nan)` anymore. +* SinhArcsinh (scalar) distribution added to `contrib.distributions`. +* Make `GANEstimator` opensource. +* `Estimator.export_savedmodel()` now includes all valid serving signatures + that can be constructed from the Serving Input Receiver and all available + ExportOutputs. For instance, a classifier may provide regression- and + prediction-flavored outputs, in addition to the classification-flavored one. + Building signatures from these allows TF Serving to honor requests using the + different APIs (Classify, Regress, and Predict). Furthermore, + `serving_input_receiver_fn()` may now specify alternative subsets of nodes + that may act as inputs. This allows, for instance, producing a prediction + signature for a classifier that accepts raw `Tensors` instead of a serialized + `tf.Example`. +* Add `tf.contrib.bayesflow.hmc`. +* Add `tf.contrib.distributions.MixtureSameFamily`. +* Make `Dataset.shuffle()` always reshuffles after each iteration by default. +* Add `tf.contrib.bayesflow.metropolis_hastings`. +* Add `log_rate` parameter to `tf.contrib.distributions.Poisson`. +* Extend `tf.contrib.distributions.bijector` API to handle some non-injective + transforms. +* Java: + + Generics (e.g., `Tensor`) for improved type-safety + (courtesy [@andrewcmyers](https://github.com/andrewcmyers)). + + Support for multi-dimensional string tensors. + + Support loading of custom operations (e.g. many in `tf.contrib`) on Linux + and OS X +* All our prebuilt binaries have been built with CUDA 8 and cuDNN 6. + We anticipate releasing TensorFlow 1.5 with CUDA 9 and cuDNN 7. + +## Bug Fixes and Other Changes + +* `tf.nn.rnn_cell.DropoutWrapper` is now more careful about dropping out LSTM + states. Specifically, it no longer ever drops the `c` (memory) state of an + `LSTMStateTuple`. The new behavior leads to proper dropout behavior + for LSTMs and stacked LSTMs. This bug fix follows recommendations from + published literature, but is a behavioral change. State dropout behavior + may be customized via the new `dropout_state_filter_visitor` argument. +* Removed `tf.contrib.training.python_input`. The same behavior, in a more + flexible and reproducible package, is available via the new + `tf.contrib.data.Dataset.from_generator` method! +* Fix `tf.contrib.distributions.Affine` incorrectly computing log-det-jacobian. +* Fix `tf.random_gamma` incorrectly handling non-batch, scalar draws. +* Resolved a race condition in TensorForest TreePredictionsV4Op. +* Google Cloud Storage file system, Amazon S3 file system, and Hadoop file + system support are now default build options. +* Custom op libraries must link against libtensorflow\_framework.so + (installed at `tf.sysconfig.get_lib()`). +* Change `RunConfig` default behavior to not set a random seed, making random + behavior independently random on distributed workers. We expect this to + generally improve training performance. Models that do rely on determinism + should set a random seed explicitly. + +## Breaking Changes to the API + +* The signature of the `tf.contrib.data.rejection_resample()` function has been + changed. It now returns a function that can be used as an argument to + `Dataset.apply()`. +* Remove `tf.contrib.data.Iterator.from_dataset()` method. Use + `Dataset.make_initializable_iterator()` instead. +* Remove seldom used and unnecessary `tf.contrib.data.Iterator.dispose_op()`. +* Reorder some TFGAN loss functions in a non-backwards compatible way. + +## Known Issues + +* In Python 3, `Dataset.from_generator()` does not support Unicode strings. + You must convert any strings to bytes objects before yielding them from + the generator. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +4d55397500, Abdullah Alrasheed, abenmao, Adam Salvail, Aditya Dhulipala, Ag Ramesh, +Akimasa Kimura, Alan Du, Alan Yee, Alexander, Amit Kushwaha, Amy, Andrei Costinescu, +Andrei Nigmatulin, Andrew Erlichson, Andrew Myers, Andrew Stepanov, Androbin, AngryPowman, +Anish Shah, Anton Daitche, Artsiom Chapialiou, asdf2014, Aseem Raj Baranwal, Ash Hall, +Bart Kiers, Batchu Venkat Vishal, ben, Ben Barsdell, Bill Piel, Carl Thomé, Catalin Voss, +Changming Sun, Chengzhi Chen, Chi Zeng, Chris Antaki, Chris Donahue, Chris Oelmueller, +Chris Tava, Clayne Robison, Codrut, Courtial Florian, Dalmo Cirne, Dan J, Darren Garvey, +David Kristoffersson, David Norman, David RöThlisberger, DavidNorman, Dhruv, DimanNe, +Dorokhov, Duncan Mac-Vicar P, EdwardDixon, EMCP, error.d, FAIJUL, Fan Xia, +Francois Xavier, Fred Reiss, Freedom" Koan-Sin Tan, Fritz Obermeyer, Gao, Xiang, +Guenther Schmuelling, Guo Yejun (郭叶军), Hans Gaiser, HectorSVC, Hyungsuk Yoon, +James Pruegsanusak, Jay Young, Jean Wanka, Jeff Carpenter, Jeremy Rutman, Jeroen BéDorf, +Jett Jones, Jimmy Jia, jinghuangintel, jinze1994, JKurland, Joel Hestness, joetoth, +John B Nelson, John Impallomeni, John Lawson, Jonas, Jonathan Dekhtiar, joshkyh, Jun Luan, +Jun Mei, Kai Sasaki, Karl Lessard, [karl@kubx.ca](mailto:karl@kubx.ca), Kb Sriram, Kenichi Ueno, Kevin Slagle, +Kongsea, Lakshay Garg, lhlmgr, Lin Min, liu.guangcong, Loki Der Quaeler, Louie Helm, +lucasmoura, Luke Iwanski, Lyndon White, Mahmoud Abuzaina, Marcel Puyat, Mark Aaron Shirley, +Michele Colombo, MtDersvan, Namrata-Ibm, Nathan Luehr, Naurril, Nayana Thorat, Nicolas Lopez, +Niranjan Hasabnis, Nolan Liu, Nouce, Oliver Hennigh, osdamv, Patrik Erdes, +Patryk Chrabaszcz, Pavel Christof, Penghao Cen, postBG, Qingqing Cao, Qingying Chen, qjivy, +Raphael, Rasmi, raymondxyang, Renze Yu, resec, Roffel, Ruben Vereecken, Ryohei Kuroki, +sandipmgiri, Santiago Castro, Scott Kirkland, Sean Vig, Sebastian Raschka, Sebastian Weiss, +Sergey Kolesnikov, Sergii Khomenko, Shahid, Shivam Kotwalia, Stuart Berg, Sumit Gouthaman, +superzerg, Sven Mayer, tetris, Ti Zhou, Tiago Freitas Pereira, Tian Jin, Tomoaki Oiki, +Vaibhav Sood, vfdev, Vivek Rane, Vladimir Moskva, wangqr, Weber Xie, Will Frey, +Yan Facai (颜发才), yanivbl6, Yaroslav Bulatov, Yixing Lao, Yong Tang, youkaichao, +Yuan (Terry) Tang, Yue Zhang, Yuxin Wu, Ziming Dong, ZxYuan, 黄璞 + +We are also grateful to all who filed issues or helped resolve them, asked and +answered questions, and were part of inspiring discussions. diff --git a/corpus/changelog/tensorflow_releases/tensorflow_150.md b/corpus/changelog/tensorflow_releases/tensorflow_150.md new file mode 100644 index 0000000000000000000000000000000000000000..c4d03f4663aaf20eff0d7e1554ad0165a822425b --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_150.md @@ -0,0 +1,217 @@ +# TensorFlow 1.5.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v1.5.0 +Version: 1.5.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@angerson](https://avatars.githubusercontent.com/u/32465472?s=40&v=4) +[angerson](/angerson) +released this +26 Jan 08:30 + +· +[39 commits](/tensorflow/tensorflow/compare/v1.5.0...r1.5) +to r1.5 +since this release + +[v1.5.0](/tensorflow/tensorflow/tree/v1.5.0) + +[`37aa430`](/tensorflow/tensorflow/commit/37aa430d84ced579342a4044c89c236664be7f68) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 1.5.0 + +## Breaking Changes + +* Prebuilt binaries are now built against CUDA 9 and cuDNN 7. +* Starting from 1.6 release, our prebuilt binaries will use AVX instructions. + This may break TF on older CPUs. + +## Major Features And Improvements + +* [Eager execution](https://github.com/tensorflow/tensorflow/tree/r1.5/tensorflow/contrib/eager) + preview version is now available. +* [TensorFlow Lite](https://github.com/tensorflow/tensorflow/tree/r1.5/tensorflow/contrib/lite) + dev preview is now available. +* CUDA 9 and cuDNN 7 support. +* Accelerated Linear Algebra (XLA): + + Add `complex64` support to XLA compiler. + + `bfloat` support is now added to XLA infrastructure. + + Make `ClusterSpec` propagation work with XLA devices. + + Use a determinisitic executor to generate XLA graph. +* `tf.contrib`: + + `tf.contrib.distributions`: + - Add `tf.contrib.distributions.Autoregressive`. + - Make `tf.contrib.distributions` QuadratureCompound classes support batch + - Infer `tf.contrib.distributions.RelaxedOneHotCategorical` `dtype` from arguments. + - Make `tf.contrib.distributions` quadrature family parameterized by + `quadrature_grid_and_prob` vs `quadrature_degree`. + - `auto_correlation` added to `tf.contrib.distributions` + + Add `tf.contrib.bayesflow.layers`, a collection of probabilistic (neural) layers. + + Add `tf.contrib.bayesflow.halton_sequence`. + + Add `tf.contrib.data.make_saveable_from_iterator.` + + Add `tf.contrib.data.shuffle_and_repeat`. + + Add new custom transformation: `tf.contrib.data.scan()`. + + `tf.contrib.distributions.bijectors`: + - Add `tf.contrib.distributions.bijectors.MaskedAutoregressiveFlow`. + - Add `tf.contrib.distributions.bijectors.Permute`. + - Add `tf.contrib.distributions.bijectors.Gumbel`. + - Add `tf.contrib.distributions.bijectors.Reshape`. + - Support shape inference (i.e., shapes containing -1) in the Reshape bijector. +* Add `streaming_precision_recall_at_equal_thresholds,` a method for computing + streaming precision and recall with `O(num_thresholds + size of predictions)` + time and space complexity. +* Change `RunConfig` default behavior to not set a random seed, making random + behavior independently random on distributed workers. We expect this to + generally improve training performance. Models that do rely on determinism + should set a random seed explicitly. +* Replaced the implementation of `tf.flags` with `absl.flags`. +* Add support for `CUBLAS_TENSOR_OP_MATH` in fp16 GEMM +* Add support for CUDA on NVIDIA Tegra devices + +## Bug Fixes and Other Changes + +* Documentation updates: + + Clarified that you can only install TensorFlow on 64-bit machines. + + Added a short doc explaining how `Estimator`s save checkpoints. + + Add documentation for ops supported by the `tf2xla` bridge. + + Fix minor typos in the doc of `SpaceToDepth` and `DepthToSpace`. + + Updated documentation comments in `mfcc_mel_filterbank.h` and `mfcc.h` to + clarify that the input domain is squared magnitude spectra and the weighting + is done on linear magnitude spectra (sqrt of inputs). + + Change `tf.contrib.distributions` docstring examples to use `tfd` alias + rather than `ds`, `bs`. + + Fix docstring typos in `tf.distributions.bijectors.Bijector`. + + `tf.assert_equal` no longer raises `ValueError.` It now raises + `InvalidArgumentError,` as documented. + + Update Getting Started docs and API intro. +* Google Cloud Storage (GCS): + + Add userspace DNS caching for the GCS client. + + Customize request timeouts for the GCS filesystem. + + Improve GCS filesystem caching. +* Bug Fixes: + + Fix bug where partitioned integer variables got their wrong shapes. Before + + Fix correctness bug in CPU and GPU implementations of Adadelta. + + Fix a bug in `import_meta_graph`'s handling of partitioned variables when + importing into a scope. WARNING: This may break loading checkpoints of + graphs with partitioned variables saved after using `import_meta_graph` with + a non-empty `import_scope` argument. + + Fix bug in offline debugger which prevented viewing events. + + Added the `WorkerService.DeleteWorkerSession` method to the gRPC interface, + to fix a memory leak. Ensure that your master and worker servers are running + the same version of TensorFlow to avoid compatibility issues. + + Fix bug in peephole implementation of BlockLSTM cell. + + Fix bug by casting dtype of `log_det_jacobian` to match `log_prob` in + `TransformedDistribution`. + + Fix a bug in `import_meta_graph`'s handling of partitioned variables when + + Ensure `tf.distributions.Multinomial` doesn't underflow in `log_prob`. + Before this change, all partitions of an integer variable were initialized + with the shape of the unpartitioned variable; after this change they are + initialized correctly. +* Other: + + Add necessary shape util support for bfloat16. + + Add a way to run ops using a step function to MonitoredSession. + + Add `DenseFlipout` probabilistic layer. + + A new flag `ignore_live_threads` is available on train. If set to `True`, it + will ignore threads that remain running when tearing down infrastructure + after successfully completing training, instead of throwing a RuntimeError. + + Restandardize `DenseVariational` as simpler template for other probabilistic + layers. + + `tf.data` now supports `tf.SparseTensor` components in dataset elements. + + It is now possible to iterate over `Tensor`s. + + Allow `SparseSegmentReduction` ops to have missing segment IDs. + + Modify custom export strategy to account for multidimensional sparse float + splits. + + `Conv2D`, `Conv2DBackpropInput`, `Conv2DBackpropFilter` now supports arbitrary + dilations with GPU and cuDNNv6 support. + + `Estimator` now supports `Dataset`: `input_fn` can return a `Dataset` + instead of `Tensor`s. + + Add `RevBlock`, a memory-efficient implementation of reversible residual layers. + + Reduce BFCAllocator internal fragmentation. + + Add `cross_entropy` and `kl_divergence` to `tf.distributions.Distribution`. + + Add `tf.nn.softmax_cross_entropy_with_logits_v2` which enables backprop + w.r.t. the labels. + + GPU back-end now uses `ptxas` to compile generated PTX. + + `BufferAssignment`'s protocol buffer dump is now deterministic. + + Change embedding op to use parallel version of `DynamicStitch`. + + Add support for sparse multidimensional feature columns. + + Speed up the case for sparse float columns that have only 1 value. + + Allow sparse float splits to support multivalent feature columns. + + Add `quantile` to `tf.distributions.TransformedDistribution`. + + Add `NCHW_VECT_C` support for `tf.depth_to_space` on GPU. + + Add `NCHW_VECT_C` support for `tf.space_to_depth` on GPU. + +## API Changes + +* Rename `SqueezeDims` attribute to `Axis` in C++ API for Squeeze op. +* `Stream::BlockHostUntilDone` now returns Status rather than bool. +* Minor refactor: move stats files from `stochastic` to `common` and remove + `stochastic`. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +Adam Zahran, Ag Ramesh, Alan Lee, Alan Yee, Alex Sergeev, Alexander, Amir H. Jadidinejad, +Amy, Anastasios Doumoulakis, Andrei Costinescu, Andrei Nigmatulin, Anthony Platanios, +Anush Elangovan, arixlin, Armen Donigian, ArtëM Sobolev, Atlas7, Ben Barsdell, Bill Prin, +Bo Wang, Brett Koonce, Cameron Thomas, Carl Thomé, Cem Eteke, cglewis, Changming Sun, +Charles Shenton, Chi-Hung, Chris Donahue, Chris Filo Gorgolewski, Chris Hoyean Song, +Chris Tava, Christian Grail, Christoph Boeddeker, cinqS, Clayne Robison, codrut3, concerttttt, +CQY, Dan Becker, Dan Jarvis, Daniel Zhang, David Norman, dmaclach, Dmitry Trifonov, +Donggeon Lim, dongpilYu, Dr. Kashif Rasul, Edd Wilder-James, Eric Lv, fcharras, Felix Abecassis, +FirefoxMetzger, formath, FredZhang, Gaojin Cao, Gary Deer, Guenther Schmuelling, Hanchen Li, +Hanmin Qin, hannesa2, hyunyoung2, Ilya Edrenkin, Jackson Kontny, Jan, Javier Luraschi, +Jay Young, Jayaram Bobba, Jeff, Jeff Carpenter, Jeremy Sharpe, Jeroen BéDorf, Jimmy Jia, +Jinze Bai, Jiongyan Zhang, Joe Castagneri, Johan Ju, Josh Varty, Julian Niedermeier, +JxKing, Karl Lessard, Kb Sriram, Keven Wang, Koan-Sin Tan, Kyle Mills, lanhin, LevineHuang, +Loki Der Quaeler, Loo Rong Jie, Luke Iwanski, LáSzló Csomor, Mahdi Abavisani, Mahmoud Abuzaina, +ManHyuk, Marek ŠUppa, MathSquared, Mats Linander, Matt Wytock, Matthew Daley, Maximilian Bachl, +mdymczyk, melvyniandrag, Michael Case, Mike Traynor, miqlas, Namrata-Ibm, Nathan Luehr, +Nathan Van Doorn, Noa Ezra, Nolan Liu, Oleg Zabluda, opensourcemattress, Ouwen Huang, +Paul Van Eck, peisong, Peng Yu, PinkySan, pks, powderluv, Qiao Hai-Jun, Qiao Longfei, +Rajendra Arora, Ralph Tang, resec, Robin Richtsfeld, Rohan Varma, Ryohei Kuroki, SaintNazaire, +Samuel He, Sandeep Dcunha, sandipmgiri, Sang Han, scott, Scott Mudge, Se-Won Kim, Simon Perkins, +Simone Cirillo, Steffen Schmitz, Suvojit Manna, Sylvus, Taehoon Lee, Ted Chang, Thomas Deegan, +Till Hoffmann, Tim, Toni Kunic, Toon Verstraelen, Tristan Rice, Urs KöSter, Utkarsh Upadhyay, +Vish (Ishaya) Abrams, Winnie Tsang, Yan Chen, Yan Facai (颜发才), Yi Yang, Yong Tang, +Youssef Hesham, Yuan (Terry) Tang, Zhengsheng Wei, zxcqwe4906, 张志豪, 田传武 + +We are also grateful to all who filed issues or helped resolve them, asked and +answered questions, and were part of inspiring discussions. diff --git a/corpus/changelog/tensorflow_releases/tensorflow_160.md b/corpus/changelog/tensorflow_releases/tensorflow_160.md new file mode 100644 index 0000000000000000000000000000000000000000..c7c6151a0efa796f22d01eac4490972f2830c94b --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_160.md @@ -0,0 +1,139 @@ +# TensorFlow 1.6.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v1.6.0 +Version: 1.6.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@gunan](https://avatars.githubusercontent.com/u/7946809?s=40&v=4) +[gunan](/gunan) +released this +28 Feb 19:10 + +· +[18 commits](/tensorflow/tensorflow/compare/v1.6.0...r1.6) +to r1.6 +since this release + +[v1.6.0](/tensorflow/tensorflow/tree/v1.6.0) + +[`d2e24b6`](/tensorflow/tensorflow/commit/d2e24b6039433bd83478da8c8c2d6c58034be607) + +# Release 1.6.0 + +## Breaking Changes + +* Prebuilt binaries are now built against CUDA 9.0 and cuDNN 7. +* Prebuilt binaries will use AVX instructions. This may break TF on older CPUs. + +## Major Features And Improvements + +* New Optimizer internal API for non-slot variables. Descendants of AdamOptimizer that access \_beta[12]\_power will need to be updated. +* `tf.estimator.{FinalExporter,LatestExporter}` now export stripped SavedModels. This improves forward compatibility of the SavedModel. +* FFT support added to XLA CPU/GPU. +* Android TF can now be built with CUDA acceleration on compatible Tegra devices (see [contrib/makefile/README.md](/tensorflow/tensorflow/blob/v1.6.0/contrib/makefile/README.md) for more information) + +## Bug Fixes and Other Changes + +* Documentation updates: + + Added a second version of Getting Started, which is aimed at ML + newcomers. + + Clarified documentation on `resize_images.align_corners` parameter. + + Additional documentation for TPUs. +* Google Cloud Storage (GCS): + + Add client-side throttle. + + Add a `FlushCaches()` method to the FileSystem interface, with an implementation for GcsFileSystem. +* Other: + + Add `tf.contrib.distributions.Kumaraswamy`. + + `RetryingFileSystem::FlushCaches()` calls the base FileSystem's `FlushCaches()`. + + Add auto\_correlation to distributions. + + Add `tf.contrib.distributions.Autoregressive`. + + Add SeparableConv1D layer. + + Add convolutional Flipout layers. + + When both inputs of `tf.matmul` are bfloat16, it returns bfloat16, instead of float32. + + Added `tf.contrib.image.connected_components`. + + Add `tf.contrib.framework.CriticalSection` that allows atomic variable access. + + Output variance over trees predictions for classifications tasks. + + For `pt` and `eval` commands, allow writing tensor values to filesystem as numpy files. + + gRPC: Propagate truncated errors (instead of returning gRPC internal error). + + Augment parallel\_interleave to support 2 kinds of prefetching. + + Improved XLA support for C64-related ops log, pow, atan2, tanh. + + Add probabilistic convolutional layers. + +## API Changes + +* Introducing prepare\_variance boolean with default setting to False for backward compatibility. +* Move `layers_dense_variational_impl.py` to `layers_dense_variational.py`. + +## Known Bugs + +* Using XLA:GPU with CUDA 9 and CUDA 9.1 results in garbage results and/or + `CUDA_ILLEGAL_ADDRESS` failures. + + Google discovered in mid-December 2017 that the PTX-to-SASS compiler in CUDA 9 + and CUDA 9.1 sometimes does not properly compute the carry bit when + decomposing 64-bit address calculations with large offsets (e.g. `load [x + large_constant]`) into 32-bit arithmetic in SASS. + + As a result, these versions of `ptxas` miscompile most XLA programs which use + more than 4GB of temp memory. This results in garbage results and/or + `CUDA_ERROR_ILLEGAL_ADDRESS` failures. + + A fix in CUDA 9.1.121 is expected in late February 2018. We do not expect a + fix for CUDA 9.0.x. Until the fix is available, the only workaround is to + [downgrade](https://developer.nvidia.com/cuda-toolkit-archive) to CUDA 8.0.x + or disable XLA:GPU. + + TensorFlow will print a warning if you use XLA:GPU with a known-bad version of + CUDA; see [e00ba24](https://github.com/tensorflow/tensorflow/commit/e00ba24c4038e7644da417ddc639169b6ea59122). +* The `tensorboard` command or module may appear to be missing after certain + upgrade flows. This is due to pip package conflicts as a result of changing + the TensorBoard package name. See the [TensorBoard 1.6.0 release notes](https://github.com/tensorflow/tensorboard/releases/tag/1.6.0) for a fix. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +4d55397500, Ag Ramesh, Aiden Scandella, Akimasa Kimura, Alex Rothberg, Allen Goodman, +amilioto, Andrei Costinescu, Andrei Nigmatulin, Anjum Sayed, Anthony Platanios, +Anush Elangovan, Armando Fandango, Ashish Kumar Ram, Ashwini Shukla, Ben, Bhavani Subramanian, +Brett Koonce, Carl Thomé, cclauss, Cesc, Changming Sun, Christoph Boeddeker, Clayne Robison, +Clemens Schulz, Clint (Woonhyuk Baek), codrut3, Cole Gerdemann, Colin Raffel, Daniel Trebbien, +Daniel Ylitalo, Daniel Zhang, Daniyar, Darjan Salaj, Dave Maclachlan, David Norman, Dong--Jian, +dongsamb, dssgsra, Edward H, eladweiss, elilienstein, Eric Lilienstein, error.d, Eunji Jeong, fanlu, +Florian Courtial, fo40225, Fred, Gregg Helt, Guozhong Zhuang, Hanchen Li, hsm207, hyunyoung2, +ImSheridan, Ishant Mrinal Haloi, Jacky Ko, Jay Young, Jean Flaherty, Jerome, JerrikEph, Jesse +Kinkead, jfaath, Jian Lin, jinghuangintel, Jiongyan Zhang, Joel Hestness, Joel Shor, Johnny Chan, +Julian Niedermeier, Julian Wolff, JxKing, K-W-W, Karl Lessard, Kasper Marstal, Keiji Ariyama, +Koan-Sin Tan, Loki Der Quaeler, Loo Rong Jie, Luke Schaefer, Lynn Jackson, ManHyuk, Matt Basta, +Matt Smith, Matthew Schulkind, Michael, michaelkhan3, Miguel Piedrafita, Mikalai Drabovich, +Mike Knapp, mjwen, mktozk, Mohamed Aly, Mohammad Ashraf Bhuiyan, Myungjoo Ham, Naman Bhalla, +Namrata-Ibm, Nathan Luehr, nathansilberman, Netzeband, Niranjan Hasabnis, Omar Aflak, Ozge +Yalcinkaya, Parth P Panchal, patrickzzy, Patryk Chrabaszcz, Paul Van Eck, Paweł Kapica, Peng Yu, +Philip Yang, Pierre Blondeau, Po-Hsien Chu, powderluv, Puyu Wang, Rajendra Arora, Rasmus, Renat +Idrisov, resec, Robin Richtsfeld, Ronald Eddy Jr, Sahil Singh, Sam Matzek, Sami Kama, sandipmgiri, +Santiago Castro, Sayed Hadi Hashemi, Scott Tseng, Sergii Khomenko, Shahid, Shengpeng Liu, Shreyash +Sharma, Shrinidhi Kl, Simone Cirillo, simsicon, Stanislav Levental, starsblinking, Stephen Lumenta, +Steven Hickson, Su Tang, Taehoon Lee, Takuya Wakisaka, Ted Chang, Ted Ying, Tijmen Verhulsdonck, +Timofey Kondrashov, vade, vaibhav, Valentin Khrulkov, vchigrin, Victor Costan, Viraj Navkal, +Vivek Rane, wagonhelm, Yan Facai (颜发才), Yanbo Liang, Yaroslav Bulatov, yegord, Yong Tang, +Yoni Tsafir, yordun, Yuan (Terry) Tang, Yuxin Wu, zhengdi, Zhengsheng Wei, 田传武 diff --git a/corpus/changelog/tensorflow_releases/tensorflow_170.md b/corpus/changelog/tensorflow_releases/tensorflow_170.md new file mode 100644 index 0000000000000000000000000000000000000000..1c7c09c4a67835dd08ab372636075b168d2a4b98 --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_170.md @@ -0,0 +1,126 @@ +# TensorFlow 1.7.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v1.7.0 +Version: 1.7.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@annarev](https://avatars.githubusercontent.com/u/22060313?s=40&v=4) +[annarev](/annarev) +released this +29 Mar 20:29 + +· +[42 commits](/tensorflow/tensorflow/compare/v1.7.0...r1.7) +to r1.7 +since this release + +[v1.7.0](/tensorflow/tensorflow/tree/v1.7.0) + +[`024aecf`](/tensorflow/tensorflow/commit/024aecf414941e11eb643e29ceed3e1c47a115ad) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 1.7.0 + +## Major Features And Improvements + +* Eager mode is moving out of contrib, try `tf.enable_eager_execution()`. +* Graph rewrites emulating fixed-point quantization compatible with TensorFlow Lite, supported by new `tf.contrib.quantize` package. +* Easily customize gradient computation with `tf.custom_gradient`. +* [TensorBoard Debugger Plugin](https://github.com/tensorflow/tensorboard/blob/master/tensorboard/plugins/debugger/README.md), the graphical user interface (GUI) of TensorFlow Debugger (tfdbg), is now in alpha. +* Experimental support for reading a sqlite database as a `Dataset` with new `tf.contrib.data.SqlDataset`. +* Distributed Mutex / CriticalSection added to `tf.contrib.framework.CriticalSection`. +* Better text processing with `tf.regex_replace`. +* Easy, efficient sequence input with `tf.contrib.data.bucket_by_sequence_length` +* Initial support for `tf.contrib.tensorrt` that enables native TensorRT in TensorFlow + +## Bug Fixes and Other Changes + +* Accelerated Linear Algebra (XLA): + + Add `MaxPoolGradGrad` support for XLA + + CSE pass from Tensorflow is now disabled in XLA. +* `tf.data`: + + `tf.data.Dataset` + - Add support for building C++ Dataset op kernels as external libraries, using the `tf.load_op_library()` mechanism. + - `Dataset.list_files()` now shuffles its output by default. + - `Dataset.shuffle(..., seed=tf.constant(0, dtype=tf.int64))` now yields the same sequence of elements as `Dataset.shuffle(..., seed=0)`. + + Add `num_parallel_reads` argument to `tf.data.TFRecordDataset`. +* `tf.contrib`: + + `tf.contrib.bayesflow.halton_sequence` now supports randomization. + + Add support for scalars in `tf.contrib.all_reduce`. + + Add `effective_sample_size` to `tf.contrib.bayesflow.mcmc_diagnostics`. + + Add `potential_scale_reduction` to `tf.contrib.bayesflow.mcmc_diagnostics`. + + Add `BatchNormalization`, `Kumaraswamy` bijectors. + + Deprecate `tf.contrib.learn`. Please check contrib/learn/README.md for instructions on how to convert existing code. + + `tf.contrib.data` + - Remove deprecated `tf.contrib.data.Dataset`, `tf.contrib.data.Iterator`, `tf.contrib.data.FixedLengthRecordDataset`, `tf.contrib.data.TextLineDataset`, and `tf.contrib.data.TFRecordDataset` classes. + - Added `bucket_by_sequence_length`, `sliding_window_batch`, and `make_batched_features_dataset` + + Remove unmaintained `tf.contrib.ndlstm`. You can find it externally at . + + Moved most of `tf.contrib.bayesflow` to its own repo: `tfp` +* Other: + + tf.py\_func now reports the full stack trace if an exception occurs. + + Integrate `TPUClusterResolver` with GKE's integration for Cloud TPUs. + + Add a library for statistical testing of samplers. + + Add Helpers to stream data from the GCE VM to a Cloud TPU. + + Integrate ClusterResolvers with TPUEstimator. + + Unify metropolis\_hastings interface with HMC kernel. + + Move LIBXSMM convolutions to a separate --define flag so that they are disabled by default. + + Fix `MomentumOptimizer` lambda. + + Reduce `tfp.layers` boilerplate via programmable docstrings. + + Add `auc_with_confidence_intervals`, a method for computing the AUC and confidence interval with linearithmic time complexity. + + `regression_head` now accepts customized link function, to satisfy the usage that user can define their own link function if the `array_ops.identity` does not meet the requirement. + + Fix `initialized_value` and `initial_value` behaviors for `ResourceVariables` created from `VariableDef` protos. + + Add TensorSpec to represent the specification of Tensors. + + Constant folding pass is now deterministic. + + Support `float16` `dtype` in `tf.linalg.*`. + + Add `tf.estimator.export.TensorServingInputReceiver` that allows `tf.estimator.Estimator.export_savedmodel` to pass raw tensors to model functions. + +## Deprecations + +* TensorFlow 1.7 may be the last time we support Cuda versions below 8.0. + Starting with TensorFlow 1.8 release, 8.0 will be the minimum supported + version. +* TensorFlow 1.7 may be the last time we support cuDNN versions below 6.0. + Starting with TensorFlow 1.8 release, 6.0 will be the minimum supported + version. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +4d55397500, Abe, Alistair Low, Andy Kernahan, Appledore, Ben, Ben Barsdell, Boris Pfahringer, Brad Wannow, Brett Koonce, Carl Thomé, cclauss, Chengzhi Chen, Chris Drake, Christopher Yeh, Clayne Robison, Codrut Grosu, Daniel Trebbien, Danny Goodman, David Goodwin, David Norman, Deron Eriksson, Donggeon Lim, Donny Viszneki, DosLin, DylanDmitri, Francisco Guerrero, Fred Reiss, gdh1995, Giuseppe, Glenn Weidner, gracehoney, Guozhong Zhuang, Haichen "Hc" Li, Harald Husum, harumitsu.nobuta, Henry Spivey, hsm207, Jekyll Song, Jerome, Jiongyan Zhang, jjsjann123, John Sungjin Park, Johnson145, JoshVarty, Julian Wolff, Jun Wang, June-One, Kamil Sindi, Kb Sriram, Kdavis-Mozilla, Kenji, lazypanda1, Liang-Chi Hsieh, Loo Rong Jie, Mahesh Bhosale, MandarJKulkarni, ManHyuk, Marcus Ong, Marshal Hayes, Martin Pool, matthieudelaro, mdfaijul, mholzel, Michael Zhou, Ming Li, Minmin Sun, Myungjoo Ham, MyungsungKwak, Naman Kamra, Peng Yu, Penghao Cen, Phil, Raghuraman-K, resec, Rohin Mohanadas, Sandeep N Gupta, Scott Tseng, seaotterman, Seo Sanghyeon, Sergei Lebedev, Ted Chang, Tim H, tkunic, Tod, vihanjain, Yan Facai (颜发才), Yin Li, Yong Tang, Yuan (Terry) Tang, Yukun Chen, Yusuke Yamada diff --git a/corpus/changelog/tensorflow_releases/tensorflow_180.md b/corpus/changelog/tensorflow_releases/tensorflow_180.md new file mode 100644 index 0000000000000000000000000000000000000000..582ece16814c4e0f99968b2935a713d5ea5e59c0 --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_180.md @@ -0,0 +1,117 @@ +# TensorFlow 1.8.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v1.8.0 +Version: 1.8.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@yifeif](https://avatars.githubusercontent.com/u/1192265?s=40&v=4) +[yifeif](/yifeif) +released this +27 Apr 18:32 + +· +[8 commits](/tensorflow/tensorflow/compare/v1.8.0...r1.8) +to r1.8 +since this release + +[v1.8.0](/tensorflow/tensorflow/tree/v1.8.0) + +[`93bc2e2`](/tensorflow/tensorflow/commit/93bc2e2072e0daccbcff7a90d397b704a9e8f778) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 1.8.0 + +## Major Features And Improvements + +* Can now pass `tf.contrib.distribute.MirroredStrategy()` to `tf.estimator.RunConfig()` to run an Estimator model on multiple GPUs on one machine. +* Add `tf.contrib.data.prefetch_to_device()`, which supports prefetching to GPU memory. +* Added Gradient Boosted Trees as pre-made Estimators: BoostedTreesClassifier, BoostedTreesRegressor. +* Add 3rd generation pipeline config for Cloud TPUs which improves performance and usability. +* `tf.contrib.bayesflow` is moving out to it's own repo. +* Added `tf.contrib.{proto,rpc}` to allow generic proto parsing and RPC communication[1](#rpc-issue). + +## Bug Fixes and Other Changes + +* `tf.data`: + + Add `tf.contrib.data.prefetch_to_device`, which enables prefetching dataset elements to GPU memory. + + Add `tf.contrib.data.AUTOTUNE`, which allows the tf.data runtime to automatically tune the prefetch buffer sizes based on your system and environment. + + Add `tf.contrib.data.make_csv_dataset` for building datasets of CSV files. +* Eager Execution: + + With eager execution Datasets can now be used as standard python iterators (`for batch in dataset:`). Both `Dataset.__iter__()` and `Dataset.make_one_shot_iterator()` can now be used to create iterators when eager execution is enabled. + + Automatic device placement has been enabled (i.e., use a GPU if available automatically, without requiring an explicit `with tf.device(“/gpu:0”)`) (Fixes [#14133](https://github.com/tensorflow/tensorflow/issues/14133)) + + `tf.GradientTape` has moved out of contrib. +* `tf.keras`: + + Added the fashion mnist dataset. + + New data preprocessing functions: `image/random_brightness`, `sequence/TimeseriesGenerator`, and `text/hashing_trick`. +* Accelerated Linear Algebra (XLA): + + Select and scatter in reference util and evaluator now use lexicographical order to break ties. +* TensorFlow Debugger (tfdbg) CLI: + + During tensor-filter operations, allow exclusion of nodes by regular expressions. + + Fix spurious background colors in some text terminals. +* `tf.contrib`: + + Add meta-distribution BatchReshape which reshapes batch dimensions. + + `tf.contrib.layers.recompute_grad` works for explicit gradient checkpointing on TPU. + + Add `tf.contrib.framework.argsort`. + + Allow `DNNBoostedTreeCombinedEstimator` to work with core versions of feature columns and losses. + + Add non-linear image warping ops: `tf.contrib.image.sparse_image_warp`, `tf.contrib.image.dense_image_warp`, and `tf.contrib.image.interpolate_spline`. + + Fix bug in `tf.contrib.opt.MultitaskOptimizerWrapper` where types of tensors were mismatched. +* Other: + + Low-level graph construction now calls the TensorFlow C API. This change should be invisible to most users, but can be disabled by setting the environment variable `TF_C_API_GRAPH_CONSTRUCTION=0` in this release. Future releases will remove the ability to disable this change. Please [file a bug](https://github.com/tensorflow/tensorflow/issues/new) if you find yourself using this escape hatch. + + Add description of shapes and a pointer to tutorial notebook in `tf.distributions.Distribution`. + + Update scatter operations: + - Add `tf.scatter_min` and `tf.scatter_max` + - Extend scatter operations to work with a scalar update parameter. + + Move cuDNN RNN ops to core for use in TensorFlow codebase only. + + Add `float64` support for `Conv2d`, `Conv2dBackpropInput`, and `Conv2dBackpropFilter`. + + Add `float64` support for `AvgPool`/`AvgPoolGrad`. + + Make graph name scope thread local so that they work correctly in multi-threaded environments. + + Update nsync synchronization library to avoid slow primitives on Linux. + + Removed need to put nsync/public on C include path when building custom ops. + + Add `tf.image.psnr`, `tf.image.ssim`, `tf.image.ssim_multiscale`, `tf.image.image_gradients`, `tf.image.sobel_edges`. + + Add links to . + + Fix non-uniformity of orthogonal matrices. + + Fix bug where multi-image Estimator eval summaries were not displayed correctly. + +1 The cancellation logic of the RPC op contains a concurrency error. A fix has been submitted to master and will be part of the next release. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +4d55397500, Aghasy, Alan Du, Alan Lee, Alan Yee, Alex Wiltschko, Animesh Karnewar, Ankit Gupta, Anton Matosov, Aris L, Ben Barsdell, Brent Yi, Brett Koonce, Carl Thomé, cbockman, Chikanaga Tomoyuki, Chris Tava, CéDric Deltheil, Dahan Gong, Dalmo Cirne, Daniel Erenrich, David Norman, DavidNorman, Edd Wilder-James, Fanjin Zeng, Felix Abecassis, fo40225, George Sterpu, Giovanni Terlingen, Gor Baghdasaryan, Guillaume Klein, Hanchen Li, Ilya Polenov, Jakub Kolodziejczyk, Jason Sadler, Jayaram Bobba, Jerry Liu, jinghuangintel, Jiongyan Zhang (张炯衍), Joel Shor, Jong Wook Kim, Julian Eisenschlos, Karl Lessard, Krish Ravindranath, Loo Rong Jie, Lukas Geiger, Luke Iwanski, Mahmoud Abuzaina, ManHyuk, Marvin Richter, Maximilian Mitchell, Mohammad Ashraf Bhuiyan, msofka, Mustafa Kasap, Nathan Burnham, Nathan Luehr, Naveen Marri, ngc92, nio1814, Oleg Zabluda, Ou Changkun, Panos Ipeirotis, Paul Van Eck, Peter Lee, Piotr Czapla, qjivy, Rholais Lii, Rodrigo Formigone, Russell Klopfer, ryantimjohn, Sang Han, SebastiáN RamíRez, shengfuintel, Siby Jose Plathottam, Silver Chan, Stanislaw Antol, Taehoon Lee, Tarang Chugh, Ted Chang, Thomas Bastiani, Xian Xu, Xiaoming (Jason) Cui, Yan Facai (颜发才), yaox12, Yashal Shakti Kanungo, Yong Tang, Yuan (Terry) Tang, Yuxin Wu, Ziyue(Louis) Lu diff --git a/corpus/changelog/tensorflow_releases/tensorflow_190.md b/corpus/changelog/tensorflow_releases/tensorflow_190.md new file mode 100644 index 0000000000000000000000000000000000000000..310f291c2d8c986f524b1e2dc3acf936b7ee989e --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_190.md @@ -0,0 +1,134 @@ +# TensorFlow 1.9.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v1.9.0 +Version: 1.9.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@case540](https://avatars.githubusercontent.com/u/1299636?s=40&v=4) +[case540](/case540) +released this +10 Jul 13:15 + +[v1.9.0](/tensorflow/tensorflow/tree/v1.9.0) + +[`25c197e`](/tensorflow/tensorflow/commit/25c197e02393bd44f50079945409009dd4d434f8) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 1.9.0 + +## Major Features And Improvements + +* Updated docs for `tf.keras`: New Keras-based [get started](http://tensorflow.org/versions/r1.9/get_started) and [programmers guide page](http://tensorflow.org/versions/r1.9/programmers_guide/keras). +* Update `tf.keras` to the Keras 2.1.6 API. +* Added [`tf.keras.layers.CuDNNGRU`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/keras/layers/CuDNNGRU) and [`tf.keras.layers.CuDNNLSTM`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/keras/layers/CuDNNLSTM) layers. [Try it](https://colab.sandbox.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb?linkId=53292082). +* Adding support of core [feature columns](https://www.tensorflow.org/get_started/feature_columns) and [losses](https://www.tensorflow.org/api_docs/python/tf/losses) to [gradient boosted trees estimators](https://github.com/tensorflow/models/tree/master/official/boosted_trees). +* The [python interface](https://tensorflow-dot-devsite.googleplex.com/versions/r1.9/api_docs/python/tf/contrib/lite) for the [TFLite Optimizing Converter](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/lite/toco/README.md) has been expanded, and the command line interface (AKA: `toco`, `tflite_convert`) is once again included in the standard `pip` installation. +* Improved data-loading and text processing with: + + [`tf.decode_compressed`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/decode_compressed) + + [`tf.string_strip`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/string_strip) + + [`tf.strings.regex_full_match`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/strings/regex_full_match) +* Added experimental support for new pre-made Estimators: + + [`tf.contrib.estimator.BaselineEstimator`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/contrib/estimator/BaselineEstimator) + + [`tf.contrib.estimator.RNNClassifier`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/contrib/estimator/RNNEstimator) + + [`tf.contrib.estimator.RNNEstimator`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/contrib/estimator/RNNClassifier) +* The [distributions.Bijector](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/contrib/distributions/bijectors/Bijector) API supports broadcasting for Bijectors with new API changes. + +## Breaking Changes + +* If you're opening empty variable scopes; replace `variable_scope('', ...)` by `variable_scope(tf.get_variable_scope(), ...)`. +* Headers used for building custom ops have been moved from site-packages/external into site-packages/tensorflow/include/external. + +## Bug Fixes and Other Changes + +* `tfe.Network` is deprecated. Please inherit from `tf.keras.Model`. +* Layered variable names have changed in the following conditions: + + + Using `tf.keras.layers` with custom variable scopes. + + Using `tf.layers` in a subclassed `tf.keras.Model` class. See [here](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/layers) for more details +* `tf.data`: + + + `Dataset.from_generator()` now accepts an `args` list, in order to create nested generators. + + `Dataset.list_files()` now produces determinstic results when `shuffle=False` or a `seed` is passed. + + `tf.contrib.data.sample_from_datasets()` and `tf.contrib.data.choose_from_datasets()` make it easier to sample or deterministically choose elements from multiple datasets. + + `tf.contrib.data.make_csv_dataset()` now supports line breaks in quoted strings, and two infrequently used arguments removed. + + (C++) `DatasetBase::DebugString()` is now `const`. + + (C++) `DatasetBase::MakeIterator()` has been renamed to `DatasetBase::MakeIteratorInternal()`. + + (C++) `IteratorBase::Initialize()` method was added to support raising errors during iterator construction. +* Eager Execution: + + + Added the ability to pause recording operations for gradient computation via `tf.GradientTape.stop_recording`. + + Updated documentation, introductory notebooks. +* `tf.keras`: + + + Move Keras code out of \_impl folder and remove API files. + + `tf.keras.Model.save_weights` now saves in TensorFlow format by default. + + Enable dataset iterators to be passed to `tf.keras.Model` training/eval methods. +* TensorFlow Debugger (tfdbg) + + + Fix an issue in which the TensorBoard Debugger Plugin could not handle total source file size exceeding gRPC message size limit (4 MB). +* `tf.contrib`: + + + `tf.contrib.framework.zero_initializer` supports ResourceVariable. + + Adding "constrained\_optimization" to tensorflow/contrib. +* Other: + + + Add GCS Configuration Ops. + + Changing signature of `MakeIterator` to enable propagating error status. + + KL divergence for two Dirichlet distributions. + + More consistent GcsFileSystem behavior for certain reads past EOF. + + Update benchmark for tf.scan to match ranges across eager and graph modes. + + Fixed bug in `tf.reduce_prod gradient` for complex dtypes. + + Allow the use of '.' in variables (e.g. "hparams.parse('a.b=1.0')"), which would previously raise an error. This will correspond to an attribute name with an embedded '.' symbol (e.g. 'a.b'), which can only be accessed indirectly (e.g. through getattr and setattr). To set this up the user will first need to explicitly add the variable to the hparam object (e.g. "hparams.add\_hparam(name='a.b', value=0.0)"). + + Benchmark for tf.scan in graph and eager modes. + + Added complex128 support to FFT, FFT2D, FFT3D, IFFT, IFFT2D, and IFFT3D. + + Making ids unique in `nn.embedding_lookup_sparse`. This helps to reduce RPC calls for looking up the embeddings when there are repeated ids in the batch. + + Support indicator column in boosted trees. + + Prevent `tf.gradients()` from backpropagating through integer tensors. + + LinearOperator[1D,2D,3D]Circulant added to `tensorflow.linalg`. + + Conv3D, Conv3DBackpropInput, Conv3DBackpropFilter now supports arbitrary. + + Added `tf.train.Checkpoint` for reading/writing object-based checkpoints. + + Added LinearOperatorKronecker, a dense-free implementation of the Kronecker Product. + + Allow LinearOperator to broadcast. + + SavedModelBuilder will now deduplicate asset names that point to files with the same basename and the same contents. Note that this may result in new asset files included in SavedModels in cases where assets with the same name but different contents were previously overwriting each other. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +Abdullah Alrasheed, Achal Shah, Ad-530, ADiegoCAlonso, Aditya Yogi, Ag Ramesh, akindyakov, Andy Kernahan, Anya Petrova, Aurelien Geron, Ben, Ben Barsdell, Bhavani-Subramanian, braincodercn, Brett Koonce, Brian Nemsick, Brian Zier, Bryan Heden, candy.dc, cclauss, Clayne Robison, ctiijima, Dalmo Cirne, David Norman, David T.H. Kao, DosLin, ekelsen, Elson Rodriguez, Erik Smistad, Felix Abecassis, Fergal Cotter, fo40225, foo0x29a, Freedom" Koan-Sin Tan, FréDéRic Branchaud-Charron, gdh1995, Geoffrey Irving, Giuseppe, gracehoney, Guido Zuidhof, Guillaume Klein, Guozhong Zhuang, Haggai, Harald Husum, imsheridan, Ivan Zhang, Jan Zikes, Jayaram Bobba, Jesse Benson, Jesse Gumz, Jiajia Li, Jie, jinghuangintel, Jingwen, jjsjann123, Joe Yearsley, Joel Hestness, Joel Shor, josephyearsley, Junpeng Lao, Karol M. Langner, Kb Sriram, krantideep95, Krish Ravindranath, Letian Feng, Loo Rong Jie, Lukas Geiger, Maciej, Mahmoud Abuzaina, ManHyuk, Mark Ryan, mbhuiyan, Michal Turek, Mostafa Alaa, Myungsung Kwak, Nand Dalal, Nehal J Wani, Neil Tenenholtz, ngc92, Nicholas Nadeau, P.Eng., Avs, Niranjan Hasabnis, P-Hidringer, Paul Van Eck, Peng Yu, Qing Zhao, Qingying Chen, Quanlong, Rajendra Arora, Rholais Lii, rmanyari, Robin Richtsfeld, Russell Klopfer, Sagi, Sam Sendelbach, Sandeep N Gupta, Sandip Giri, Sarah Edkins, Scott Tseng, Sdalbsoo, Sergii Khomenko, Seungwoo Choi (Biggie), Seyed Majid Azimi, Shaoning Zeng, shengfuintel, Siu Kei, Muk, Smit Shilu, soonson, Stefan Schweter, Sukhwan Kim, Sunitha Kambhampati, Taehoon Lee, tamimaddari82, Tang, Wenyi, Ted Chang, u2takey, Utkarsh Upadhyay, Vadim Markovtsev, voegtlel, Wai Hon Law, wangsiyu, Wenhao Hu, wenhao.hu, William D. Irons, Yan Facai (颜发才), Yanbo Liang, Yihong Wang, Yilei (Dolee) Yang, Yong Tang, Yuan (Terry) Tang diff --git a/corpus/changelog/tensorflow_releases/tensorflow_200.md b/corpus/changelog/tensorflow_releases/tensorflow_200.md new file mode 100644 index 0000000000000000000000000000000000000000..a52c031ecdfe845a461aee52c3ef73e22703b377 --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_200.md @@ -0,0 +1,355 @@ +# TensorFlow 2.0.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v2.0.0 +Version: 2.0.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@goldiegadde](https://avatars.githubusercontent.com/u/43185254?s=40&v=4) +[goldiegadde](/goldiegadde) +released this +30 Sep 17:47 + +· +[173 commits](/tensorflow/tensorflow/compare/v2.0.0...r2.0) +to r2.0 +since this release + +[v2.0.0](/tensorflow/tensorflow/tree/v2.0.0) + +[`64c3d38`](/tensorflow/tensorflow/commit/64c3d382cadf7bbe8e7e99884bede8284ff67f56) + +# Release 2.0.0 + +## Major Features and Improvements + +TensorFlow 2.0 focuses on **simplicity** and **ease of use**, featuring updates like: + +* Easy model building with Keras and eager execution. +* Robust model deployment in production on any platform. +* Powerful experimentation for research. +* API simplification by reducing duplication and removing deprecated endpoints. + +For details on best practices with 2.0, see [the Effective 2.0 guide](https://www.tensorflow.org/beta/guide/effective_tf2) + +For information on upgrading your existing TensorFlow 1.x models, please refer to our [Upgrade](https://medium.com/tensorflow/upgrading-your-code-to-tensorflow-2-0-f72c3a4d83b5) and [Migration](https://www.tensorflow.org/guide/migrate) guides. We have also released a collection of [tutorials and getting started guides](https://www.tensorflow.org/beta). + +## Highlights + +* TF 2.0 delivers Keras as the central high level API used to build and train models. Keras provides several model-building APIs such as Sequential, Functional, and Subclassing along with eager execution, for immediate iteration and intuitive debugging, and `tf.data`, for building scalable input pipelines. Checkout [guide](https://www.tensorflow.org/beta/guide/keras/overview) for additional details. +* Distribution Strategy: TF 2.0 users will be able to use the [`tf.distribute.Strategy`](https://www.tensorflow.org/beta/guide/distribute_strategy) API to distribute training with minimal code changes, yielding great out-of-the-box performance. It supports distributed training with Keras model.fit, as well as with custom training loops. Multi-GPU support is available, along with experimental support for multi worker and Cloud TPUs. Check out the [guide](https://www.tensorflow.org/beta/guide/distribute_strategy) for more details. +* Functions, not Sessions. The traditional declarative programming model of building a graph and executing it via a `tf.Session` is discouraged, and replaced with by writing regular Python functions. Using the `tf.function` decorator, such functions can be turned into graphs which can be executed remotely, serialized, and optimized for performance. +* Unification of `tf.train.Optimizers` and `tf.keras.Optimizers`. Use `tf.keras.Optimizers` for TF2.0. `compute_gradients` is removed as public API, use `GradientTape` to compute gradients. +* AutoGraph translates Python control flow into TensorFlow expressions, allowing users to write regular Python inside `tf.function`-decorated functions. AutoGraph is also applied in functions used with tf.data, tf.distribute and tf.keras APIs. +* Unification of exchange formats to SavedModel. All TensorFlow ecosystem projects (TensorFlow Lite, TensorFlow JS, TensorFlow Serving, TensorFlow Hub) accept SavedModels. Model state should be saved to and restored from SavedModels. +* API Changes: Many API symbols have been renamed or removed, and argument names have changed. Many of these changes are motivated by consistency and clarity. The 1.x API remains available in the compat.v1 module. A list of all symbol changes can be found [here](https://docs.google.com/spreadsheets/d/1FLFJLzg7WNP6JHODX5q8BDgptKafq_slHpnHVbJIteQ/edit#gid=0). +* API clean-up, included removing `tf.app`, `tf.flags`, and `tf.logging` in favor of [absl-py](https://github.com/abseil/abseil-py). +* No more global variables with helper methods like `tf.global_variables_initializer` and `tf.get_global_step`. +* Add toggles `tf.enable_control_flow_v2()` and `tf.disable_control_flow_v2()` for enabling/disabling v2 control flow. +* Enable v2 control flow as part of `tf.enable_v2_behavior()` and `TF2_BEHAVIOR=1`. +* Fixes autocomplete for most TensorFlow API references by switching to use relative imports in API `__init__.py` files. +* Auto Mixed-Precision graph optimizer simplifies converting models to `float16` for acceleration on Volta and Turing Tensor Cores. This feature can be enabled by wrapping an optimizer class with `tf.train.experimental.enable_mixed_precision_graph_rewrite()`. +* Add environment variable `TF_CUDNN_DETERMINISTIC`. Setting to `TRUE` or "1" forces the selection of deterministic cuDNN convolution and max-pooling algorithms. When this is enabled, the algorithm selection procedure itself is also deterministic. + +## Breaking Changes + +* Many backwards incompatible API changes have been made to clean up the APIs and make them more consistent. +* Toolchains: + + + TensorFlow 2.0.0 is built using devtoolset7 (GCC7) on Ubuntu 16. This may lead to ABI incompatibilities with extensions built against earlier versions of TensorFlow. + + Tensorflow code now produces 2 different pip packages: tensorflow\_core containing all the code (in the future it will contain only the private implementation) and tensorflow which is a virtual pip package doing forwarding to tensorflow\_core (and in the future will contain only the public API of tensorflow). We don't expect this to be breaking, unless you were importing directly from the implementation. + Removed the `freeze_graph` command line tool; `SavedModel` should be used in place of frozen graphs. +* `tf.contrib`: + + + `tf.contrib` has been deprecated, and functionality has been either migrated to the core TensorFlow API, to an ecosystem project such as [tensorflow/addons](https://www.github.com/tensorflow/addons) or [tensorflow/io](https://www.github.com/tensorflow/io), or removed entirely. + + Remove `tf.contrib.timeseries` dependency on TF distributions. + + Replace contrib references with `tf.estimator.experimental.*` for apis in `early_stopping.py`. +* `tf.estimator`: + + + Premade estimators in the tf.estimator.DNN/Linear/DNNLinearCombined family have been updated to use `tf.keras.optimizers` instead of the `tf.compat.v1.train.Optimizer`s. If you do not pass in an `optimizer=` arg or if you use a string, the premade estimator will use the Keras optimizer. This is checkpoint breaking, as the optimizers have separate variables. A checkpoint converter tool for converting optimizers is included with the release, but if you want to avoid any change, switch to the v1 version of the estimator: `tf.compat.v1.estimator.DNN/Linear/DNNLinearCombined*`. + + Default aggregation for canned Estimators is now `SUM_OVER_BATCH_SIZE`. To maintain previous default behavior, please pass `SUM` as the loss aggregation method. + + Canned Estimators don’t support `input_layer_partitioner` arg in the API. If you have this arg, you will have to switch to `tf.compat.v1 canned Estimators`. + + `Estimator.export_savedmodel` has been renamed to `export_saved_model`. + + When saving to SavedModel, Estimators will strip default op attributes. This is almost always the correct behavior, as it is more forwards compatible, but if you require that default attributes to be saved with the model, please use `tf.compat.v1.Estimator`. + + Feature Columns have been upgraded to be more Eager-friendly and to work with Keras. As a result, `tf.feature_column.input_layer` has been deprecated in favor of `tf.keras.layers.DenseFeatures`. v1 feature columns have direct analogues in v2 except for `shared_embedding_columns`, which are not cross-compatible with v1 and v2. Use `tf.feature_column.shared_embeddings` instead. +* `tf.keras`: + + + `OMP_NUM_THREADS` is no longer used by the default Keras config. To configure the number of threads, use `tf.config.threading` APIs. + + `tf.keras.model.save_model` and `model.save` now defaults to saving a TensorFlow SavedModel. HDF5 files are still supported. + + Deprecated `tf.keras.experimental.export_saved_model` and `tf.keras.experimental.function`. Please use `tf.keras.models.save_model(..., save_format='tf')` and `tf.keras.models.load_model` instead. + + Layers now default to float32, and automatically cast their inputs to the layer's dtype. If you had a model that used float64, it will probably silently use float32 in TensorFlow 2, and a warning will be issued that starts with `Layer ` is casting an input tensor from dtype float64 to the layer's dtype of float32. To fix, either set the default dtype to float64 with `tf.keras.backend.set_floatx('float64')`, or pass `dtype='float64'` to each of the Layer constructors. See `tf.keras.layers.Layer` for more information. +* `tf.lite`: + + + Removed `lite.OpHint`, `lite.experimental`, and `lite.constant` from 2.0 API. +* Tensors are no longer hashable, but instead compare element-wise with `==` and `!=`. Use `tf.compat.v1.disable_tensor_equality()` to return to the previous behavior. +* Performing equality operations on Tensors or Variables with incompatible shapes an exception is no longer thrown. Instead `__eq__` returns False and `__ne__` returns True. +* Removed `tf.string_split` from v2 API. +* Deprecated the use of `constraint=` and `.constraint` with ResourceVariable. +* Add `UnifiedGRU` as the new GRU implementation for tf2.0. Change the default recurrent activation function for GRU from `hard_sigmoid` to `sigmoid`, and `reset_after` to True in 2.0. Historically recurrent activation is `hard_sigmoid` since it is fast than 'sigmoid'. With new unified backend between CPU and GPU mode, since the CuDNN kernel is using sigmoid, we change the default for CPU mode to sigmoid as well. With that, the default GRU will be compatible with both CPU and GPU kernel. This will enable user with GPU to use CuDNN kernel by default and get a 10x performance boost in training. Note that this is checkpoint breaking change. If user want to use their 1.x pre-trained checkpoint, please construct the layer with GRU(recurrent\_activation='hard\_sigmoid', reset\_after=False) to fallback to 1.x behavior. +* `CUDNN_INSTALL_PATH`, `TENSORRT_INSTALL_PATH`, `NCCL_INSTALL_PATH`, `NCCL_HDR_PATH` are deprecated. Use `TF_CUDA_PATHS` instead which supports a comma-separated list of base paths that are searched to find CUDA libraries and headers. + +Refer to our [public project status tracker](https://github.com/orgs/tensorflow/projects/4) and [issues tagged with 2.0](https://github.com/tensorflow/tensorflow/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+label%3A%22TF+2.0%22+) on GitHub for insight into recent issues and development progress. + +If you experience any snags when using TF 2.0, please let us know at the [TF 2.0 Testing User Group](https://groups.google.com/a/tensorflow.org/forum/?utm_medium=email&utm_source=footer#!forum/testing). We have a support mailing list as well as weekly testing meetings, and would love to hear your migration feedback and questions. + +## Bug Fixes and Other Changes + +* `tf.contrib`: + + + Expose `tf.contrib.proto.*` ops in `tf.io` (they will exist in TF2) +* `tf.data`: + + + Add support for TensorArrays to `tf.data Dataset`. + + Integrate Ragged Tensors with `tf.data`. + + All core and experimental tf.data transformations that input user-defined functions can span multiple devices now. + + Extending the TF 2.0 support for `shuffle(..., reshuffle_each_iteration=True)` and `cache()` to work across different Python iterators for the same dataset. + + Removing the `experimental_numa_aware` option from `tf.data.Options`. + + Add `num_parallel_reads` and passing in a Dataset containing filenames into `TextLineDataset` and `FixedLengthRecordDataset`. + + Add support for defaulting the value of `cycle_length` argument of `tf.data.Dataset.interleave` to the number of schedulable CPU cores. + + Promoting `tf.data.experimental.enumerate_dataset` to core as `tf.data.Dataset.enumerate`. + + Promoting `tf.data.experimental.unbatch` to core as `tf.data.Dataset.unbatch`. + + Adds option for introducing slack in the pipeline to reduce CPU contention, via `tf.data.Options().experimental_slack = True` + + Added experimental support for parallel batching to `batch()` and `padded_batch()`. This functionality can be enabled through `tf.data.Options()`. + + Support cancellation of long-running `reduce`. + + Now we use `dataset` node name as prefix instead of the op name, to identify the component correctly in metrics, for pipelines with repeated components. + + Improve the performance of datasets using `from_tensors()`. + + Promoting `unbatch` from experimental to core API. + + Adding support for datasets as inputs to `from_tensors` and `from_tensor_slices` and batching and unbatching of nested datasets. +* `tf.distribute`: + + + Enable `tf.distribute.experimental.MultiWorkerMirroredStrategy` working in eager mode. + + Callbacks are supported in `MultiWorkerMirroredStrategy`. + + Disable `run_eagerly` and distribution strategy if there are symbolic tensors added to the model using `add_metric` or `add_loss`. + + Loss and gradients should now more reliably be correctly scaled w.r.t. the global batch size when using a `tf.distribute.Strategy`. + + Set default loss reduction as `AUTO` for improving reliability of loss scaling with distribution strategy and custom training loops. `AUTO` indicates that the reduction option will be determined by the usage context. For almost all cases this defaults to `SUM_OVER_BATCH_SIZE`. When used in distribution strategy scope, outside of built-in training loops such as `tf.keras` `compile` and `fit`, we expect reduction value to be 'None' or 'SUM'. Using other values will raise an error. + + Support for multi-host `ncclAllReduce` in Distribution Strategy. +* `tf.estimator`: + + + Replace `tf.contrib.estimator.add_metrics` with `tf.estimator.add_metrics` + + Use `tf.compat.v1.estimator.inputs` instead of `tf.estimator.inputs` + + Replace contrib references with `tf.estimator.experimental.*` for apis in early\_s in Estimator + + Canned Estimators will now use keras optimizers by default. An error will be raised if tf.train.Optimizers are used, and you will have to switch to tf.keras.optimizers or tf.compat.v1 canned Estimators. + + A checkpoint converter for canned Estimators has been provided to transition canned Estimators that are warm started from `tf.train.Optimizers` to `tf.keras.optimizers`. + + Losses are scaled in canned estimator v2 and not in the optimizers anymore. If you are using Estimator + distribution strategy + optimikzer v1 then the behavior does not change. This implies that if you are using custom estimator with optimizer v2, you have to scale losses. We have new utilities to help scale losses `tf.nn.compute_average_loss`, `tf.nn.scale_regularization_loss`. +* `tf.keras`: + + + Premade models (including Linear and WideDeep) have been introduced for the purpose of replacing Premade estimators. + + Model saving changes + + `model.save` and `tf.saved_model.save` may now save to the TensorFlow SavedModel format. The model can be restored using `tf.keras.models.load_model`. HDF5 files are still supported, and may be used by specifying `save_format="h5"` when saving. + + Raw TensorFlow functions can now be used in conjunction with the Keras Functional API during model creation. This obviates the need for users to create Lambda layers in most cases when using the Functional API. Like Lambda layers, TensorFlow functions that result in Variable creation or assign ops are not supported. + + Add support for passing list of lists to the `metrics` argument in Keras `compile`. + + Add `tf.keras.layers.AbstractRNNCell` as the preferred implementation for RNN cells in TF v2. User can use it to implement RNN cells with custom behavior. + + Keras training and validation curves are shown on the same plot when using the TensorBoard callback. + + Switched Keras `fit/evaluate/predict` execution to use only a single unified path by default unless eager execution has been explicitly disabled, regardless of input type. This unified path places an eager-friendly training step inside of a `tf.function`. With this + 1. All input types are converted to `Dataset`. + 2. The path assumes there is always a distribution strategy. when distribution strategy is not specified the path uses a no-op distribution strategy. + 3. The training step is wrapped in `tf.function` unless `run_eagerly=True` is set in compile. The single path execution code does not yet support all use cases. We fallback to the existing v1 execution paths if your model contains the following: + 4. `sample_weight_mode` in compile + 5. `weighted_metrics` in compile + 6. v1 optimizer + 7. target tensors in compile + If you are experiencing any issues because of this change, please inform us (file an issue) about your use case and you can unblock yourself by setting `experimental_run_tf_function=False` in compile meanwhile. We have seen couple of use cases where the model usage pattern is not as expected and would not work with this change. + 8. output tensors of one layer is used in the constructor of another. + 9. symbolic tensors outside the scope of the model are used in custom loss functions. + The flag can be disabled for these cases and ideally the usage pattern will need to be fixed. + + Mark Keras `set_session` as `compat.v1` only. + + `tf.keras.estimator.model_to_estimator` now supports exporting to `tf.train.Checkpoint format`, which allows the saved checkpoints to be compatible with `model.load_weights`. + + `keras.backend.resize_images` (and consequently, `keras.layers.Upsampling2D`) behavior has changed, a bug in the resizing implementation was fixed. + + Add an `implementation=3` mode for `tf.keras.layers.LocallyConnected2D` and `tf.keras.layers.LocallyConnected1D` layers using `tf.SparseTensor` to store weights, allowing a dramatic speedup for large sparse models. + + Raise error if `batch_size` argument is used when input is dataset/generator/keras sequence. + + Update TF 2.0 `keras.backend.name_scope` to use TF 2.0 `name_scope`. + + Add v2 module aliases for losses, metrics, initializers and optimizers: `tf.losses = tf.keras.losses` & `tf.metrics = tf.keras.metrics` & `tf.initializers = tf.keras.initializers` & `tf.optimizers = tf.keras.optimizers`. + + Updates binary cross entropy logic in Keras when input is probabilities. Instead of converting probabilities to logits, we are using the cross entropy formula for probabilities. + + Added public APIs for `cumsum` and `cumprod` keras backend functions. + + Add support for temporal sample weight mode in subclassed models. + + Raise `ValueError` if an integer is passed to the training APIs. + + Added fault-tolerance support for training Keras model via `model.fit()` with `MultiWorkerMirroredStrategy`, tutorial available. + + Custom Callback tutorial is now available. + + To train with `tf.distribute`, Keras API is recommended over estimator. + + `steps_per_epoch` and `steps` arguments are supported with numpy arrays. + + New error message when unexpected keys are used in sample\_weight/class\_weight dictionaries + + Losses are scaled in Keras compile/fit and not in the optimizers anymore. If you are using custom training loop, we have new utilities to help scale losses `tf.nn.compute_average_loss`, `tf.nn.scale_regularization_loss`. + + `Layer` apply and add\_variable APIs are deprecated. + + Added support for channels first data format in cross entropy losses with logits and support for tensors with unknown ranks. + + Error messages will be raised if `add_update`, `add_metric`, `add_loss`, activity regularizers are used inside of a control flow branch. + + New loss reduction types: + 1. `AUTO`: Indicates that the reduction option will be determined by the usage context. For almost all cases this defaults to `SUM_OVER_BATCH_SIZE`. When used with `tf.distribute.Strategy`, outside of built-in training loops such as `tf.keras` `compile` and `fit`, we expect reduction value to be `SUM` or `NONE`. Using `AUTO` in that case will raise an error. + 2. `NONE`: Weighted losses with one dimension reduced (axis=-1, or axis specified by loss function). When this reduction type used with built-in Keras training loops like `fit`/`evaluate`, the unreduced vector loss is passed to the optimizer but the reported loss will be a scalar value. + 3. `SUM`: Scalar sum of weighted losses. 4. `SUM_OVER_BATCH_SIZE`: Scalar `SUM` divided by number of elements in losses. This reduction type is not supported when used with `tf.distribute.Strategy` outside of built-in training loops like `tf.keras` `compile`/`fit`. + + Wraps losses passed to the `compile` API (strings and v1 losses) which are not instances of v2 `Loss` class in `LossWrapper` class. => All losses will now use `SUM_OVER_BATCH_SIZE` reduction as default. + + `model.add_loss(symbolic_tensor)` should work in ambient eager. + + Update metric name to always reflect what the user has given in compile. Affects following cases + 1. When name is given as 'accuracy'/'crossentropy' + 2. When an aliased function name is used eg. 'mse' + 3. Removing the `weighted` prefix from weighted metric names. + + Allow non-Tensors through v2 losses. + + Add v2 sparse categorical crossentropy metric. + + Add v2 APIs for `AUCCurve` and `AUCSummationMethod` enums. + + `add_update` can now be passed a zero-arg callable in order to support turning off the update when setting `trainable=False` on a Layer of a Model compiled with `run_eagerly=True`. + + Standardize the LayerNormalization API by replacing the args `norm_axis` and `params_axis` with `axis`. + + Fixed critical bugs that help with DenseFeatures usability in TF2 +* `tf.lite`: + + + Added evaluation script for `COCO` minival + + Add delegate support for `QUANTIZE`. + + Add `GATHER` support to NN API delegate. + + Added support for TFLiteConverter Python API in 2.0. Contains functions from\_saved\_model, from\_keras\_file, and from\_concrete\_functions. + + Add `EXPAND_DIMS` support to NN API delegate TEST. + + Add `narrow_range` attribute to QuantizeAndDequantizeV2 and V3. + + Added support for `tflite_convert` command line tool in 2.0. + + Post-training quantization tool supports quantizing weights shared by multiple operations. The models made with versions of this tool will use INT8 types for weights and will only be executable interpreters from this version onwards. + + Post-training quantization tool supports fp16 weights and GPU delegate acceleration for fp16. + + Add delegate support for `QUANTIZED_16BIT_LSTM`. + + Extracts `NNAPIDelegateKernel` from nnapi\_delegate.cc +* TensorRT + + + Add TensorFlow 2.0-compatible `TrtGraphConverterV2` API for TensorRT conversion. + TensorRT initialization arguments are now passed wrapped in a named-tuple, + `TrtConversionParams`, rather than as separate arguments as in `TrtGraphConverter`. + + Changed API to optimize TensorRT enginges during graph optimization. This is now + done by calling `converter.build()` where previously `is_dynamic_op=False` would + be set. + + `converter.convert()` no longer returns a `tf.function`. Now the funtion must be + accessed from the saved model. + + The `converter.calibrate()` method has been removed. To trigger calibration, a + `calibration_input_fn` should be provided to `converter.convert()`. +* Other: + + + Fix accidental quadratic graph construction cost in graph-mode `tf.gradients()`. + + ResourceVariable's gather op supports batch dimensions. + + ResourceVariable support for `gather_nd`. + + `ResourceVariable` and `Variable` no longer accepts `constraint` in the constructor, nor expose it as a [@Property](https://github.com/Property). + + Added gradient for `SparseToDense` op. + + Expose a flag that allows the number of threads to vary across Python benchmarks. + + `image.resize` in 2.0 now supports gradients for the new resize kernels. + + `image.resize` now considers proper pixel centers and has new kernels (incl. anti-aliasing). + + Renamed `tf.image` functions to remove duplicate "image" where it is redundant. + + Variadic reduce is supported on CPU Variadic reduce is supported on CPU + + Remove unused `StringViewVariantWrapper`. + + Delete unused `Fingerprint64Map` op registration + + Add broadcasting support to `tf.matmul`. + + Add C++ Gradient for `BatchMatMulV2`. + + Add `tf.math.cumulative_logsumexp` operation. + + Add ellipsis (...) support for `tf.einsum()`. + + Add expand\_composites argument to all `nest.*` methods. + + Added `strings.byte_split`. + + Add a new "result\_type" parameter to `tf.strings.split`. + + Add name argument to `tf.string_split` and `tf.strings_split`. + + Extend `tf.strings.split` to support inputs with any rank. + + Added `tf.random.binomial`. + + Added `key` and `skip` methods to `random.experimental.Generator`. + + Extend `tf.function` with basic support for CompositeTensors arguments (such as `SparseTensor` and `RaggedTensor`). + + `parallel_for.pfor`: add converters for Softmax, LogSoftmax, IsNaN, All, Any, and MatrixSetDiag. + + `parallel_for`: add converters for LowerTriangularSolve and Cholesky. + + `parallel_for`: add converters for `LogMatrixDeterminant` and `MatrixBandPart`. + + `parallel_for`: Add converter for `MatrixDiag`. + + `parallel_for`: Add converters for `OneHot`, `LowerBound`, `UpperBound`. + + `parallel_for`: add converter for `BroadcastTo`. + + Add `pfor` converter for `Squeeze`. + + Add `RaggedTensor.placeholder()`. + + Add ragged tensor support to `tf.squeeze`. + + Update RaggedTensors to support int32 row\_splits. + + Allow `LinearOperator.solve` to take a `LinearOperator`. + + Allow all dtypes for `LinearOperatorCirculant`. + + Introduce MaxParallelism method + + Add `LinearOperatorHouseholder`. + + Adds Philox support to new stateful RNG's XLA path. + + Added `TensorSpec` support for CompositeTensors. + + Added `tf.linalg.tridiagonal_solve` op. + + Added partial\_pivoting input parameter to `tf.linalg.tridiagonal_solve`. + + Added gradient to `tf.linalg.tridiagonal_solve`. + + Added `tf.linalg.tridiagonal_mul op`. + + Added GPU implementation of `tf.linalg.tridiagonal_matmul`. + + Added `LinearOperatorToeplitz`. + + Upgraded LIBXSMM to version 1.11. + + Uniform processing of quantized embeddings by Gather and EmbeddingLookup Ops. + + Correct a misstatement in the documentation of the sparse softmax cross entropy logit parameter. + + Add `tf.ragged.boolean_mask`. + + `tf.switch_case` added, which selects a branch\_fn based on a branch\_index. + + The C++ kernel of gather op supports batch dimensions. + + Fixed default value and documentation for `trainable` arg of tf.Variable. + + `EagerTensor` now supports numpy buffer interface for tensors. + + This change bumps the version number of the `FullyConnected` Op to 5. + + Added new op: `tf.strings.unsorted_segment_join`. + + Added HW acceleration support for `topK_v2`. + + CloudBigtable version updated to v0.10.0 BEGIN\_PUBLIC CloudBigtable version updated to v0.10.0. + + Expose `Head` as public API. + + Added `tf.sparse.from_dense` utility function. + + Improved ragged tensor support in `TensorFlowTestCase`. + + Added a function `nested_value_rowids` for ragged tensors. + + Added `tf.ragged.stack`. + + Makes the a-normal form transformation in Pyct configurable as to which nodes are converted to variables and which are not. + + `ResizeInputTensor` now works for all delegates. + + `tf.cond` emits a StatelessIf op if the branch functions are stateless and do not touch any resources. + + Add support of local soft device placement for eager op. + + Pass partial\_pivoting to the `_TridiagonalSolveGrad`. + + Add HW acceleration support for `LogSoftMax`. + + Add guard to avoid acceleration of L2 Normalization with input rank != 4 + + Fix memory allocation problem when calling `AddNewInputConstantTensor`. + + Delegate application failure leaves interpreter in valid state + + `tf.while_loop` emits a StatelessWhile op if the cond and body functions are stateless and do not touch any resources. + + `tf.cond`, `tf.while` and if and while in AutoGraph now accept a nonscalar predicate if has a single element. This does not affect non-V2 control flow. + + Fix potential security vulnerability where decoding variant tensors from proto could result in heap out of bounds memory access. + + Only create a GCS directory object if the object does not already exist. + + Introduce `dynamic` constructor argument in Layer and Model, which should be set to `True` when using imperative control flow in the `call` method. + + Begin adding Go wrapper for C Eager API. + + XLA HLO graphs can be inspected with interactive\_graphviz tool now. + + Add dataset ops to the graph (or create kernels in Eager execution) during the python Dataset object creation instead doing it during Iterator creation time. + + Add `batch_dims` argument to `tf.gather`. + + The behavior of `tf.gather` is now correct when `axis=None` and `batch_dims<0`. + + Update docstring for gather to properly describe the non-empty `batch_dims` case. + + Removing of dtype in the constructor of initializers and partition\_info in call. + + Add `tf.math.nextafter` op. + + Turn on MKL-DNN contraction kernels by default. MKL-DNN dynamically dispatches the best kernel implementation based on CPU vector architecture. To disable them, build with `--define=tensorflow_mkldnn_contraction_kernel=0`. + + `tf.linspace(start, stop, num)` now always uses "stop" as last value (for num > 1) + + Added top-k to precision and recall to keras metrics. + + Add a ragged size op and register it to the op dispatcher + + Transitive dependencies on :`pooling_ops` were removed. Some users may need to add explicit dependencies on :`pooling_ops` if they reference the operators from that library. + + Add `CompositeTensor` base class. + + Malformed gif images could result in an access out of bounds in the color palette of the frame. This has been fixed now + + Add templates and interfaces for creating lookup tables + + `Tensor::UnsafeCopyFromInternal` deprecated in favor `Tensor::BitcastFrom`. + + In `map_vectorization` optimization, reduce the degree of parallelism in the vectorized map node. + + Add variant wrapper for `absl::string_view`. + + Add OpKernels for some stateless maps. + + DType is no longer convertible to an int. Use `dtype.as_datatype_enum` instead of `int(dtype)` to get the same result. + + Support both binary and -1/1 label input in v2 hinge and squared hinge losses. + + Added `LinearOperator.adjoint` and `LinearOperator.H` (alias). + + Expose CriticalSection in core as `tf.CriticalSection`. + + Enhanced graphviz output. + + Add opkernel templates for common table operations. + + Fix callbacks do not log values in eager mode when a deferred build model is used. + + `SignatureDef` util functions have been deprecated. + + Update `Fingerprint64Map` to use aliases + + Add legacy string flat hash map op kernels. + + Add support for `add_metric` in the graph function mode. + + Updating cosine similarity loss - removed the negate sign from cosine similarity. + + Changed default for gradient accumulation for TPU embeddings to true. + + Adds summary trace API for collecting graph and profile information. + + The `precision_mode` argument to `TrtGraphConverter` is now case insensitive. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +1e100, a6802739, 4d55397500, a6802739, Abdullah Selek, abenmao, Abolfazl Shahbazi, Adam Richter, Adam Weiss, Ag Ramesh, Alan Du, Albin Joy, Alex, Alex Itkes, Alex Sergeev, Alexander Pivovarov, Alexey Romanov, alhkad, Aman Patel, Amit, Amit Kumar Jaiswal, Amit Srivastava, amoitra, Andreas Eberle, Andrew Lihonosov, Andy Craze, Anshuman Tripathy, Anthony Hsu, Anthony Platanios, Anuj Rawat, arp95, Arpit Shah, Armen Poghosov, armenpoghosov, Astropeak, Ashwin Ramaswami, Arpit Shah, Augustina Ragwitz, Aurelien Geron, AuréLien Geron, avasid, aweers, awesomealex1, Ayush Agrawal, Bas Aarts, Bastian Eichenberger, Bairen Yi, Bayberry Z, Ben Barsdell, Benjamin Peterson, bhack, Bharat Raghunathan, Bhavani Subramanian, Bin Fan, blairhan, BléNesi Attila, Bodin-E, Brandon Carter, Bryan Cutler, candy.dc, Cao Zongyan, Casper Da Costa-Luis, Chao Liu, Chen Guoyin, chenchc, chengchingwen, chie8842, Christian Hansen, Christoph Boeddeker, Christopher Yeh, Clayne Robison, Coady, Patrick, crafet, csukuangfj, ctiijima, Dan Jarvis, Dan Lazewatsky, Daniel Ingram, Daniel Rasmussen, Daniel Salvadori, Dave Airlie, David Norman, Dayananda V, delock, Denis Khalikov, Deven Desai, Dheeraj Rajaram Reddy, Diego Caballero, dmitrievanthony, Donovan Ong, Drew Szurko, Duncan Dean, Duncan Riach, Dustin Neighly, Dwight J Lyle, Eamon Ito-Fisher, eashtian3, Edward Forgacs, EFanZh, ejot, Elroy Ashtian Jr, Eric Schweitz, Evgeniy Polyakov, Fangjun Kuang, Federico Martinez, Fei Hu, Felix Lemke, Filip Matzner, FlashTek, fo40225, formath, FrançOis Chollet, frreiss, Fred Reiss, Frederic Bastien, Fredrik Knutsson, G. Hussain Chinoy, Gabriel, Gautam, gehring, Geoffrey Irving, George Grzegorz Pawelczak, Grzegorz Pawelczak, George Sterpu, Gianluca Varisco, Gleb Popov, Greg Peatfield, Guillaume Klein, Gurpreet Singh, Gustavo Lima Chaves, Gyoung-Yoon Ryoo, haison, Hanton Yang, HanGuo97, Haraldur TóMas HallgríMsson, Hari Shankar, hehongliang, Heungsub Lee, Hoeseong Kim, Huan Li (李卓桓), HåKon Sandsmark, I-Hong, I-Hong Jhuo, Ilham Firdausi Putra, Ilango R, Imran Salam, Innovimax, Jacky Ko, Irene Dea, Ivan Habernal, Jakub Lipinski, Jacky, Jason Zaman, Jason Zavaglia, jayhpark530, jcf94, jefby, Jeff Daily, Jeff Poznanovic, Jeffrey Poznanovic, Jekyll Lai, jer, Jeroen BéDorf, jerryyin, jhalakp, jiakai, Jia Qingtong, Jiankang, JiangXIAO, Joe Bowser, Joe Q, Joe Quadrino, Joel Shapiro, Johan Gunnarsson, Jojimon Varghese, Jonas Rauber, Jonathan Kyl, Jonathan, Joon, Joppe Geluykens, Joseph Friedman, Josh Beal, jtressle, Julian Niedermeier, Junqin Zhang, Justin Dujardin, Justin Tunis, jwu, K. Hodges, kaixih, Kaixi Hou, kjopek, Karl Lessard, Karl Weinmeister, Karthik Muthuraman, Kashif Rasul, Kay Zhu, Kbhute-Ibm, KDR, Keno Fischer, Kevin Mader, khanhlvg, Kilaru Yasaswi Sri Chandra Gandhi, Koan-Sin Tan, Koock Yoon, kouml, ktaebum, Kyuwon Kim, Lakshay Tokas, Laurent Le Brun, leike666666, leonard951, Leslie-Fang, Letian Kang, Li, Guizi, Loo Rong Jie, Lucas Hendren, Lukas Folle, Lukas Geiger, Luke Han, luxupu, lvli, Ma, Guokai, Mahmoud Abuzaina, Maksym Kysylov, Mandar Deshpande, manhyuk, Manraj Singh Grover, Marco Gaido, Marek Drozdowski, Margaret Maynard-Reid, Mark Ryan, mars20, Mateusz Chudyk, Matt Conley, mbhuiyan, mdfaijul, Mei Jie, Melissa Grueter, merturl, MichaelKonobeev, Michael KäUfl, Michal W. Tarnowski, MickaëL Schoentgen, Miguel Morin, Mihail Salnikov, Mikalai Drabovich, Mike Arpaia, Mike Holcomb, minds, monklof, Moses Marin, mpppk, Mr. Metal, Mshr-H, musikisomorphie, nammbash, Natalia Gimelshein, Nathan Luehr, Nayana-Ibm, Nayana Thorat, neargye, Neeraj Pradhan, Nehal J Wani, Neil, Nick, Nick Lewycky, Niels Ole Salscheider, Niklas SilfverströM, Niranjan Hasabnis, Nuka-137, Nutti, ocjosen, olicht, omeir1, P Sudeepam, Paige Bailey, Palmer Lao, Pan Daoxin, Pariksheet Pinjari, Pasquale Minervini, Patrick J. Lopresti, Patrik Gustavsson, Pavel Akhtyamov, Pavel Samolysov, PENGWA, per1234, PeterLee, Phan Van Nguyen Duc, Philipp Jund, Phillip Kravtsov, Pooya Davoodi, Pranav Marathe, Putra Manggala, Qingqing Cao, R S Nikhil Krishna, Rajeshwar Reddy T, Ramon ViñAs, Rasmus Diederichsen, Reuben Morais, robert, Rohit Gupta, Roland Zimmermann, Roman Soldatow, RonLek, Ruizhe, Ryan Jiang, saishruthi, Saleem Abdulrasool, Samantha Andow, Sami Kama, Sami Kama, Sana-Damani, Saurabh Deoras, sdamani, Sean Morgan, seanshpark, Sebastien Iooss, Serv-Inc, Severen Redwood, Shahzad Lone, Shashank Gupta, shashvat, Shashvat Chand Shahi, Shubham Goyal, Shashi, Sigrid Keydana, Siju, Siju Samuel, sleighsoft, smilu97, Snease-Abq, Son Tran, Spencer Schaber, sremedios, Srini511, srinivasan.narayanamoorthy, Steve Lang, Steve Nesae, Subin, Sumesh Udayakumaran, Sungmann Cho, sunway513, Supriya Rao, sxwang, Tae-Hwan Jung, Taehoon Lee, Takeo Sawada, Taylor Jakobson, Taylor Thornton, Ted Chang, TengLu, terryky, ThisIsIsaac, ThisIsPIRI, Thomas Deegan, Thomas Hagebols, tianyapiaozi, Till Hoffmann, Tim Zaman, tomguluson92, Tongxuan Liu, Trent Lo, Trevor Morris, TungJerry, Tyorden, Uday Bondhugula, v1incent, Vagif, Vasileios Lioutas, vbvg2008, vcarpani, Vijay Ravichandran, Vikram Tiwari,Viktor Gal, Vishwak Srinivasan, Vincent, Vishnuvardhan Janapati, Vitor-Alves, Vivek Suryamurthy, wangsiyu, wateryzephyr, WeberXie, Wei Wang, WeijieSun, Wen-Heng (Jack) Chung, wenxizhu, Will Battel, William D. Irons, winstonq, wyzhao, Xiaoming (Jason) Cui, Xiaoquan Kong, Xin, Xinping Wang, Yan Facai (颜发才), Yann-Yy, Yasir Modak, Yasuhiro Matsumoto, ymodak, Yong Tang, Yongfeng Gu, Younes Khoudli, Yuan Lin, Yuan (Terry) Tang, Yuchen Ying, Yves-Noel Weweler, zhangyujing, zjjott, zyeric, 王振华 (Zhenhua Wang), 黄鑫 diff --git a/corpus/changelog/tensorflow_releases/tensorflow_210.md b/corpus/changelog/tensorflow_releases/tensorflow_210.md new file mode 100644 index 0000000000000000000000000000000000000000..e53324063d8341f57e49eae8e0eb2d759b6fde7f --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_210.md @@ -0,0 +1,162 @@ +# TensorFlow 2.1.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v2.1.0 +Version: 2.1.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@tensorflow-jenkins](https://avatars.githubusercontent.com/u/16359713?s=40&v=4) +[tensorflow-jenkins](/tensorflow-jenkins) +released this +08 Jan 18:54 + +· +[420 commits](/tensorflow/tensorflow/compare/v2.1.0...r2.1) +to r2.1 +since this release + +[v2.1.0](/tensorflow/tensorflow/tree/v2.1.0) + +[`e5bf8de`](/tensorflow/tensorflow/commit/e5bf8de410005de06a7ff5393fafdf832ef1d4ad) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 2.1.0 + +TensorFlow 2.1 will be the last TF release supporting Python 2. Python 2 support [officially ends an January 1, 2020](https://www.python.org/dev/peps/pep-0373/#update). [As announced earlier](https://groups.google.com/a/tensorflow.org/d/msg/announce/gVwS5RC8mds/dCt1ka2XAAAJ), TensorFlow will also stop supporting Python 2 starting January 1, 2020, and no more releases are expected in 2019. + +## Major Features and Improvements + +* The `tensorflow` pip package now includes GPU support by default (same as `tensorflow-gpu`) for both Linux and Windows. This runs on machines with and without NVIDIA GPUs. `tensorflow-gpu` is still available, and CPU-only packages can be downloaded at `tensorflow-cpu` for users who are concerned about package size. +* **Windows users:** Officially-released `tensorflow` Pip packages are now built with Visual Studio 2019 version 16.4 in order to take advantage of the new `/d2ReducedOptimizeHugeFunctions` compiler flag. To use these new packages, you must install "Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019", available from Microsoft's website [here](https://support.microsoft.com/help/2977003/the-latest-supported-visual-c-downloads). + + This does not change the minimum required version for building TensorFlow from source on Windows, but builds enabling `EIGEN_STRONG_INLINE` can take over 48 hours to compile without this flag. Refer to `configure.py` for more information about `EIGEN_STRONG_INLINE` and `/d2ReducedOptimizeHugeFunctions`. + + If either of the required DLLs, `msvcp140.dll` (old) or `msvcp140_1.dll` (new), are missing on your machine, `import tensorflow` will print a warning message. +* The `tensorflow` pip package is built with CUDA 10.1 and cuDNN 7.6. +* `tf.keras` + + Experimental support for mixed precision is available on GPUs and Cloud TPUs. See [usage guide](https://www.tensorflow.org/guide/keras/mixed_precision). + + Introduced the `TextVectorization` layer, which takes as input raw strings and takes care of text standardization, tokenization, n-gram generation, and vocabulary indexing. See this [end-to-end text classification example](https://colab.research.google.com/drive/1RvCnR7h0_l4Ekn5vINWToI9TNJdpUZB3). + + Keras `.compile` `.fit` `.evaluate` and `.predict` are allowed to be outside of the DistributionStrategy scope, as long as the model was constructed inside of a scope. + + Experimental support for Keras `.compile`, `.fit`, `.evaluate`, and `.predict` is available for Cloud TPUs, Cloud TPU, for all types of Keras models (sequential, functional and subclassing models). + + Automatic outside compilation is now enabled for Cloud TPUs. This allows `tf.summary` to be used more conveniently with Cloud TPUs. + + Dynamic batch sizes with DistributionStrategy and Keras are supported on Cloud TPUs. + + Support for `.fit`, `.evaluate`, `.predict` on TPU using numpy data, in addition to `tf.data.Dataset`. + + Keras reference implementations for many popular models are available in the TensorFlow [Model Garden](https://github.com/tensorflow/models/tree/master/official). +* `tf.data` + + Changes rebatching for `tf.data datasets` + DistributionStrategy for better performance. Note that the dataset also behaves slightly differently, in that the rebatched dataset cardinality will always be a multiple of the number of replicas. + + `tf.data.Dataset` now supports automatic data distribution and sharding in distributed environments, including on TPU pods. + + Distribution policies for `tf.data.Dataset` can now be tuned with 1. `tf.data.experimental.AutoShardPolicy(OFF, AUTO, FILE, DATA)` 2. `tf.data.experimental.ExternalStatePolicy(WARN, IGNORE, FAIL)` +* `tf.debugging` + + Add `tf.debugging.enable_check_numerics()` and `tf.debugging.disable_check_numerics()` to help debugging the root causes of issues involving infinities and `NaN`s. +* `tf.distribute` + + Custom training loop support on TPUs and TPU pods is avaiable through `strategy.experimental_distribute_dataset`, `strategy.experimental_distribute_datasets_from_function`, `strategy.experimental_run_v2`, `strategy.reduce`. + + Support for a global distribution strategy through `tf.distribute.experimental_set_strategy(),` in addition to `strategy.scope()`. +* `TensorRT` + + [TensorRT 6.0](https://developer.nvidia.com/tensorrt#tensorrt-whats-new) is now supported and enabled by default. This adds support for more TensorFlow ops including Conv3D, Conv3DBackpropInputV2, AvgPool3D, MaxPool3D, ResizeBilinear, and ResizeNearestNeighbor. In addition, the TensorFlow-TensorRT python conversion API is exported as `tf.experimental.tensorrt.Converter`. +* Environment variable `TF_DETERMINISTIC_OPS` has been added. When set to "true" or "1", this environment variable makes `tf.nn.bias_add` operate deterministically (i.e. reproducibly), but currently only when XLA JIT compilation is *not* enabled. Setting `TF_DETERMINISTIC_OPS` to "true" or "1" also makes cuDNN convolution and max-pooling operate deterministically. This makes Keras Conv\*D and MaxPool\*D layers operate deterministically in both the forward and backward directions when running on a CUDA-enabled GPU. + +## Breaking Changes + +* Deletes `Operation.traceback_with_start_lines` for which we know of no usages. +* Removed `id` from `tf.Tensor.__repr__()` as `id` is not useful other than internal debugging. +* Some `tf.assert_*` methods now raise assertions at operation creation time if the input tensors' values are known at that time, not during the `session.run()`. This only changes behavior when the graph execution would have resulted in an error. When this happens, a noop is returned and the input tensors are marked non-feedable. In other words, if they are used as keys in `feed_dict` argument to `session.run()`, an error will be raised. Also, because some assert ops don't make it into the graph, the graph structure changes. A different graph can result in different per-op random seeds when they are not given explicitly (most often). +* The following APIs are not longer experimental: `tf.config.list_logical_devices`, `tf.config.list_physical_devices`, `tf.config.get_visible_devices`, `tf.config.set_visible_devices`, `tf.config.get_logical_device_configuration`, `tf.config.set_logical_device_configuration`. +* `tf.config.experimentalVirtualDeviceConfiguration` has been renamed to `tf.config.LogicalDeviceConfiguration`. +* `tf.config.experimental_list_devices` has been removed, please use + `tf.config.list_logical_devices`. + +## Bug Fixes and Other Changes + +* `tf.data` + + Fixes concurrency issue with `tf.data.experimental.parallel_interleave` with `sloppy=True`. + + Add `tf.data.experimental.dense_to_ragged_batch()`. + + Extend `tf.data` parsing ops to support `RaggedTensors`. +* `tf.distribute` + + Fix issue where GRU would crash or give incorrect output when a `tf.distribute.Strategy` was used. +* `tf.estimator` + + Added option in `tf.estimator.CheckpointSaverHook` to not save the `GraphDef`. + + Moving the checkpoint reader from swig to pybind11. +* `tf.keras` + + Export `depthwise_conv2d` in `tf.keras.backend`. + + In Keras Layers and Models, Variables in `trainable_weights`, `non_trainable_weights`, and `weights` are explicitly deduplicated. + + Keras `model.load_weights` now accepts `skip_mismatch` as an argument. This was available in external Keras, and has now been copied over to `tf.keras`. + + Fix the input shape caching behavior of Keras convolutional layers. + + `Model.fit_generator`, `Model.evaluate_generator`, `Model.predict_generator`, `Model.train_on_batch`, `Model.test_on_batch`, and `Model.predict_on_batch` methods now respect the `run_eagerly` property, and will correctly run using `tf.function` by default. Note that `Model.fit_generator`, `Model.evaluate_generator`, and `Model.predict_generator` are deprecated endpoints. They are subsumed by `Model.fit`, `Model.evaluate`, and `Model.predict` which now support generators and Sequences. +* `tf.lite` + + Legalization for `NMS` ops in TFLite. + + add `narrow_range` and `axis` to `quantize_v2` and `dequantize` ops. + + Added support for `FusedBatchNormV3` in converter. + + Add an `errno`-like field to `NNAPI` delegate for detecting `NNAPI` errors for fallback behaviour. + + Refactors `NNAPI` Delegate to support detailed reason why an operation is not accelerated. + + Converts hardswish subgraphs into atomic ops. +* Other + + Critical stability updates for TPUs, especially in cases where the XLA compiler produces compilation errors. + + TPUs can now be re-initialized multiple times, using `tf.tpu.experimental.initialize_tpu_system`. + + Add `RaggedTensor.merge_dims()`. + + Added new `uniform_row_length` row-partitioning tensor to `RaggedTensor`. + + Add `shape` arg to `RaggedTensor.to_tensor`; Improve speed of `RaggedTensor.to_tensor`. + + `tf.io.parse_sequence_example` and `tf.io.parse_single_sequence_example` now support ragged features. + + Fix `while_v2` with variables in custom gradient. + + Support taking gradients of V2 `tf.cond` and `tf.while_loop` using `LookupTable`. + + Fix bug where `vectorized_map` failed on inputs with unknown static shape. + + Add preliminary support for sparse CSR matrices. + + Tensor equality with `None` now behaves as expected. + + Make calls to `tf.function(f)()`, `tf.function(f).get_concrete_function` and `tf.function(f).get_initialization_function` thread-safe. + + Extend `tf.identity` to work with CompositeTensors (such as SparseTensor) + + Added more `dtypes` and zero-sized inputs to `Einsum` Op and improved its performance + + Enable multi-worker `NCCL` `all-reduce` inside functions executing eagerly. + + Added complex128 support to `RFFT`, `RFFT2D`, `RFFT3D`, `IRFFT`, `IRFFT2D`, and `IRFFT3D`. + + Add `pfor` converter for `SelfAdjointEigV2`. + + Add `tf.math.ndtri` and `tf.math.erfinv`. + + Add `tf.config.experimental.enable_mlir_bridge` to allow using MLIR compiler bridge in eager model. + + Added support for MatrixSolve on Cloud TPU / XLA. + + Added `tf.autodiff.ForwardAccumulator` for forward-mode autodiff + + Add `LinearOperatorPermutation`. + + A few performance optimizations on `tf.reduce_logsumexp`. + + Added multilabel handling to `AUC` metric + + Optimization on `zeros_like`. + + Dimension constructor now requires `None` or types with an `__index__` method. + + Add `tf.random.uniform` microbenchmark. + + Use `_protogen` suffix for proto library targets instead of `_cc_protogen` suffix. + + Moving the checkpoint reader from `swig` to `pybind11`. + + `tf.device` & `MirroredStrategy` now supports passing in a `tf.config.LogicalDevice` + + If you're building Tensorflow from source, consider using [bazelisk](https://github.com/bazelbuild/bazelisk) to automatically download and use the correct Bazel version. Bazelisk reads the `.bazelversion` file at the root of the project directory. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +8bitmp3, Aaron Ma, AbdüLhamit Yilmaz, Abhai Kollara, aflc, Ag Ramesh, Albert Z. Guo, Alex Torres, amoitra, Andrii Prymostka, angeliand, Anshuman Tripathy, Anthony Barbier, Anton Kachatkou, Anubh-V, Anuja Jakhade, Artem Ryabov, autoih, Bairen Yi, Bas Aarts, Basit Ayantunde, Ben Barsdell, Bhavani Subramanian, Brett Koonce, candy.dc, Captain-Pool, caster, cathy, Chong Yan, Choong Yin Thong, Clayne Robison, Colle, Dan Ganea, David Norman, David Refaeli, dengziming, Diego Caballero, Divyanshu, djshen, Douman, Duncan Riach, EFanZh, Elena Zhelezina, Eric Schweitz, Evgenii Zheltonozhskii, Fei Hu, fo40225, Fred Reiss, Frederic Bastien, Fredrik Knutsson, fsx950223, fwcore, George Grzegorz Pawelczak, George Sterpu, Gian Marco Iodice, Giorgio Arena, giuros01, Gomathi Ramamurthy, Guozhong Zhuang, Haifeng Jin, Haoyu Wu, HarikrishnanBalagopal, HJYOO, Huang Chen-Yi, Ilham Firdausi Putra, Imran Salam, Jared Nielsen, Jason Zaman, Jasper Vicenti, Jeff Daily, Jeff Poznanovic, Jens Elofsson, Jerry Shih, jerryyin, Jesper Dramsch, jim.meyer, Jongwon Lee, Jun Wan, Junyuan Xie, Kaixi Hou, kamalkraj, Kan Chen, Karthik Muthuraman, Keiji Ariyama, Kevin Rose, Kevin Wang, Koan-Sin Tan, kstuedem, Kwabena W. Agyeman, Lakshay Tokas, latyas, Leslie-Fang-Intel, Li, Guizi, Luciano Resende, Lukas Folle, Lukas Geiger, Mahmoud Abuzaina, Manuel Freiberger, Mark Ryan, Martin Mlostek, Masaki Kozuki, Matthew Bentham, Matthew Denton, mbhuiyan, mdfaijul, Muhwan Kim, Nagy Mostafa, nammbash, Nathan Luehr, Nathan Wells, Niranjan Hasabnis, Oleksii Volkovskyi, Olivier Moindrot, olramde, Ouyang Jin, OverLordGoldDragon, Pallavi G, Paul Andrey, Paul Wais, pkanwar23, Pooya Davoodi, Prabindh Sundareson, Rajeshwar Reddy T, Ralovich, Kristof, Refraction-Ray, Richard Barnes, richardbrks, Robert Herbig, Romeo Kienzler, Ryan Mccormick, saishruthi, Saket Khandelwal, Sami Kama, Sana Damani, Satoshi Tanaka, Sergey Mironov, Sergii Khomenko, Shahid, Shawn Presser, ShengYang1, Siddhartha Bagaria, Simon Plovyt, skeydan, srinivasan.narayanamoorthy, Stephen Mugisha, sunway513, Takeshi Watanabe, Taylor Jakobson, TengLu, TheMindVirus, ThisIsIsaac, Tim Gates, Timothy Liu, Tomer Gafner, Trent Lo, Trevor Hickey, Trevor Morris, vcarpani, Wei Wang, Wen-Heng (Jack) Chung, wenshuai, Wenshuai-Xiaomi, wenxizhu, william, William D. Irons, Xinan Jiang, Yannic, Yasir Modak, Yasuhiro Matsumoto, Yong Tang, Yongfeng Gu, Youwei Song, Zaccharie Ramzi, Zhang, Zhenyu Guo, 王振华 (Zhenhua Wang), 韩董, 이중건 Isaac Lee diff --git a/corpus/changelog/tensorflow_releases/tensorflow_2100.md b/corpus/changelog/tensorflow_releases/tensorflow_2100.md new file mode 100644 index 0000000000000000000000000000000000000000..73b42cb06c1727ccbf23d883c4064c9928b1f75b --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_2100.md @@ -0,0 +1,215 @@ +# TensorFlow 2.10.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v2.10.0 +Version: 2.10.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@tensorflow-jenkins](https://avatars.githubusercontent.com/u/16359713?s=40&v=4) +[tensorflow-jenkins](/tensorflow-jenkins) +released this +06 Sep 19:44 + +· +[77 commits](/tensorflow/tensorflow/compare/v2.10.0...r2.10) +to r2.10 +since this release + +[v2.10.0](/tensorflow/tensorflow/tree/v2.10.0) + +[`359c3cd`](/tensorflow/tensorflow/commit/359c3cdfc5fabac82b3c70b3b6de2b0a8c16874f) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 2.10.0 + +## Breaking Changes + +* Causal attention in `keras.layers.Attention` and `keras.layers.AdditiveAttention` is now specified in the `call()` method via the `use_causal_mask` argument (rather than in the constructor), for consistency with other layers. +* Some files in `tensorflow/python/training` have been moved to `tensorflow/python/tracking` and `tensorflow/python/checkpoint`. Please update your imports accordingly, the old files will be removed in Release 2.11. +* `tf.keras.optimizers.experimental.Optimizer` will graduate in Release 2.11, which means `tf.keras.optimizers.Optimizer` will be an alias of `tf.keras.optimizers.experimental.Optimizer`. The current `tf.keras.optimizers.Optimizer` will continue to be supported as `tf.keras.optimizers.legacy.Optimizer`, e.g.,`tf.keras.optimizers.legacy.Adam`. Most users won't be affected by this change, but please check the [API doc](https://www.tensorflow.org/api_docs/python/tf/keras/optimizers/experimental) if any API used in your workflow is changed or deprecated, and make adaptions. If you decide to keep using the old optimizer, please explicitly change your optimizer to `tf.keras.optimizers.legacy.Optimizer`. +* RNG behavior change for `tf.keras.initializers`. Keras initializers will now use stateless random ops to generate random numbers. + + Both seeded and unseeded initializers will always generate the same values every time they are called (for a given variable shape). For unseeded initializers (`seed=None`), a random seed will be created and assigned at initializer creation (different initializer instances get different seeds). + + An unseeded initializer will raise a warning if it is reused (called) multiple times. This is because it would produce the same values each time, which may not be intended. + +## Deprecations + +* The C++ `tensorflow::Code` and `tensorflow::Status` will become aliases of respectively `absl::StatusCode` and `absl::Status` in some future release. + + Use `tensorflow::OkStatus()` instead of `tensorflow::Status::OK()`. + + Stop constructing `Status` objects from `tensorflow::error::Code`. + + One MUST NOT access `tensorflow::errors::Code` fields. Accessing `tensorflow::error::Code` fields is fine. + - Use the constructors such as `tensorflow::errors:InvalidArgument` to create status using an error code without accessing it. + - Use the free functions such as `tensorflow::errors::IsInvalidArgument` if needed. + - In the last resort, use e.g.`static_cast(error::Code::INVALID_ARGUMENT)` or `static_cast(code)` for comparisons. +* `tensorflow::StatusOr` will also become in the future alias to `absl::StatusOr`, so use `StatusOr::value` instead of `StatusOr::ConsumeValueOrDie`. + +## Major Features and Improvements + +* `tf.lite`: + + + New operations supported: + - tflite SelectV2 now supports 5D. + - tf.einsum is supported with multiple unknown shapes. + - tf.unsortedsegmentprod op is supported. + - tf.unsortedsegmentmax op is supported. + - tf.unsortedsegmentsum op is supported. + + Updates to existing operations: + - tfl.scatter\_nd now supports I1 for update arg. + + Upgrade Flatbuffers v2.0.5 from v1.12.0 +* `tf.keras`: + + + `EinsumDense` layer is moved from experimental to core. Its import path is moved from `tf.keras.layers.experimental.EinsumDense` to `tf.keras.layers.EinsumDense`. + + Added `tf.keras.utils.audio_dataset_from_directory` utility to easily generate audio classification datasets from directories of `.wav` files. + + Added `subset="both"` support in `tf.keras.utils.image_dataset_from_directory`,`tf.keras.utils.text_dataset_from_directory`, and `audio_dataset_from_directory`, to be used with the `validation_split` argument, for returning both dataset splits at once, as a tuple. + + Added `tf.keras.utils.split_dataset` utility to split a `Dataset` object or a list/tuple of arrays into two `Dataset` objects (e.g. train/test). + + Added step granularity to `BackupAndRestore` callback for handling distributed training failures & restarts. The training state can now be restored at the exact epoch and step at which it was previously saved before failing. + + Added [`tf.keras.dtensor.experimental.optimizers.AdamW`](https://www.tensorflow.org/api_docs/python/tf/keras/dtensor/experimental/optimizers/AdamW). This optimizer is similar as the existing [`keras.optimizers.experimental.AdamW`](https://www.tensorflow.org/api_docs/python/tf/keras/optimizers/experimental/AdamW), and works in the DTensor training use case. + + Improved masking support for [`tf.keras.layers.MultiHeadAttention`](https://www.tensorflow.org/api_docs/python/tf/keras/layers/MultiHeadAttention). + - Implicit masks for `query`, `key` and `value` inputs will automatically be used to compute a correct attention mask for the layer. These padding masks will be combined with any `attention_mask` passed in directly when calling the layer. This can be used with [`tf.keras.layers.Embedding`](https://www.tensorflow.org/api_docs/python/tf/keras/layers/Embedding) with `mask_zero=True` to automatically infer a correct padding mask. + - Added a `use_causal_mask` call time arugment to the layer. Passing `use_causal_mask=True` will compute a causal attention mask, and optionally combine it with any `attention_mask` passed in directly when calling the layer. + + Added `ignore_class` argument in the loss `SparseCategoricalCrossentropy` and metrics `IoU` and `MeanIoU`, to specify a class index to be ignored during loss/metric computation (e.g. a background/void class). + + Added [`tf.keras.models.experimental.SharpnessAwareMinimization`](https://www.tensorflow.org/api_docs/python/tf/keras/models/experimental/SharpnessAwareMinimization). This class implements the sharpness-aware minimization technique, which boosts model performance on various tasks, e.g., ResNet on image classification. +* `tf.data`: + + + Added support for cross-trainer data caching in tf.data service. This saves computation resources when concurrent training jobs train from the same dataset. See () for more details. + + Added `dataset_id` to `tf.data.experimental.service.register_dataset`. If provided, `tf.data` service will use the provided ID for the dataset. If the dataset ID already exists, no new dataset will be registered. This is useful if multiple training jobs need to use the same dataset for training. In this case, users should call `register_dataset` with the same `dataset_id`. + + Added a new field, `inject_prefetch`, to `tf.data.experimental.OptimizationOptions`. If it is set to `True`,`tf.data` will now automatically add a `prefetch` transformation to datasets that end in synchronous transformations. This enables data generation to be overlapped with data consumption. This may cause a small increase in memory usage due to buffering. To enable this behavior, set `inject_prefetch=True` in `tf.data.experimental.OptimizationOptions`. + + Added a new value to `tf.data.Options.autotune.autotune_algorithm`: STAGE\_BASED. If the autotune algorithm is set to STAGE\_BASED, then it runs a new algorithm that can get the same performance with lower CPU/memory usage. + + Added [`tf.data.experimental.from_list`](https://www.tensorflow.org/api_docs/python/tf/data/experimental/from_list), a new API for creating `Dataset`s from lists of elements. +* `tf.distribute`: + + + Added [`tf.distribute.experimental.PreemptionCheckpointHandler`](https://www.tensorflow.org/api_docs/python/tf/distribute/experimental/PreemptionCheckpointHandler) to handle worker preemption/maintenance and cluster-wise consistent error reporting for `tf.distribute.MultiWorkerMirroredStrategy`. Specifically, for the type of interruption with advance notice, it automatically saves a checkpoint, exits the program without raising an unrecoverable error, and restores the progress when training restarts. +* `tf.math`: + + + Added `tf.math.approx_max_k` and `tf.math.approx_min_k` which are the optimized alternatives to `tf.math.top_k` on TPU. The performance difference range from 8 to 100 times depending on the size of k. When running on CPU and GPU, a non-optimized XLA kernel is used. +* `tf.train`: + + + Added `tf.train.TrackableView` which allows users to inspect the TensorFlow Trackable object (e.g. `tf.Module`, Keras Layers and models). +* `tf.vectorized_map`: + + + Added an optional parameter: `warn`. This parameter controls whether or not warnings will be printed when operations in the provided `fn` fall back to a while loop. +* XLA: + + + MWMS is now compilable with XLA. + + [Compute Library for the Arm® Architecture (ACL)](https://github.com/ARM-software/ComputeLibrary) is supported for aarch64 CPU XLA runtime +* CPU performance optimizations: + + + **x86 CPUs**: [oneDNN](https://github.com/tensorflow/community/blob/master/rfcs/20210930-enable-onednn-ops.md) bfloat16 auto-mixed precision grappler graph optimization pass has been renamed from `auto_mixed_precision_mkl` to `auto_mixed_precision_onednn_bfloat16`. See example usage [here](https://www.intel.com/content/www/us/en/developer/articles/guide/getting-started-with-automixedprecisionmkl.html). + + **aarch64 CPUs:** Experimental performance optimizations from [Compute Library for the Arm® Architecture (ACL)](https://github.com/ARM-software/ComputeLibrary) are available through oneDNN in the default Linux aarch64 package (`pip install tensorflow`). + - The optimizations are disabled by default. + - Set the environment variable `TF_ENABLE_ONEDNN_OPTS=1` to enable the optimizations. Setting the variable to 0 or unsetting it will disable the optimizations. + - These optimizations can yield slightly different numerical results from when they are off due to floating-point round-off errors from different computation approaches and orders. + - To verify that the optimizations are on, look for a message with "*oneDNN custom operations are on*" in the log. If the exact phrase is not there, it means they are off. + +## Bug Fixes and Other Changes + +* New argument `experimental_device_ordinal` in `LogicalDeviceConfiguration` to control the order of logical devices. (GPU only) +* `tf.keras`: + + + Changed the TensorBoard tag names produced by the `tf.keras.callbacks.TensorBoard` callback, so that summaries logged automatically for model weights now include either a `/histogram` or `/image` suffix in their tag names, in order to prevent tag name collisions across summary types. +* When running on GPU (with cuDNN version 7.6.3 or later),`tf.nn.depthwise_conv2d` backprop to `filter` (and therefore also `tf.keras.layers.DepthwiseConv2D`) now operate deterministically (and `tf.errors.UnimplementedError` is no longer thrown) when op-determinism has been enabled via `tf.config.experimental.enable_op_determinism`. This closes issue [47174](https://github.com/tensorflow/tensorflow/issues/47174). +* `tf.random` + + + Added `tf.random.experimental.stateless_shuffle`, a stateless version of `tf.random.shuffle`. + +## Security + +* Fixes a `CHECK` failure in tf.reshape caused by overflows ([CVE-2022-35934](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35934)) +* Fixes a `CHECK` failure in `SobolSample` caused by missing validation ([CVE-2022-35935](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35935)) +* Fixes an OOB read in `Gather_nd` op in TF Lite ([CVE-2022-35937](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35937)) +* Fixes a `CHECK` failure in `TensorListReserve` caused by missing validation ([CVE-2022-35960](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35960)) +* Fixes an OOB write in `Scatter_nd` op in TF Lite ([CVE-2022-35939](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35939)) +* Fixes an integer overflow in `RaggedRangeOp` ([CVE-2022-35940](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35940)) +* Fixes a `CHECK` failure in `AvgPoolOp` ([CVE-2022-35941](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35941)) +* Fixes a `CHECK` failures in `UnbatchGradOp` ([CVE-2022-35952](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35952)) +* Fixes a segfault TFLite converter on per-channel quantized transposed convolutions ([CVE-2022-36027](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36027)) +* Fixes a `CHECK` failures in `AvgPool3DGrad` ([CVE-2022-35959](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35959)) +* Fixes a `CHECK` failures in `FractionalAvgPoolGrad` ([CVE-2022-35963](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35963)) +* Fixes a segfault in `BlockLSTMGradV2` ([CVE-2022-35964](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35964)) +* Fixes a segfault in `LowerBound` and `UpperBound` ([CVE-2022-35965](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35965)) +* Fixes a segfault in `QuantizedAvgPool` ([CVE-2022-35966](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35966)) +* Fixes a segfault in `QuantizedAdd` ([CVE-2022-35967](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35967)) +* Fixes a `CHECK` fail in `AvgPoolGrad` ([CVE-2022-35968](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35968)) +* Fixes a `CHECK` fail in `Conv2DBackpropInput` ([CVE-2022-35969](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35969)) +* Fixes a segfault in `QuantizedInstanceNorm` ([CVE-2022-35970](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35970)) +* Fixes a `CHECK` fail in `FakeQuantWithMinMaxVars` ([CVE-2022-35971](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35971)) +* Fixes a segfault in `Requantize` ([CVE-2022-36017](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36017)) +* Fixes a segfault in `QuantizedBiasAdd` ([CVE-2022-35972](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35972)) +* Fixes a `CHECK` fail in `FakeQuantWithMinMaxVarsPerChannel` ([CVE-2022-36019](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36019)) +* Fixes a segfault in `QuantizedMatMul` ([CVE-2022-35973](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35973)) +* Fixes a segfault in `QuantizeDownAndShrinkRange` ([CVE-2022-35974](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35974)) +* Fixes segfaults in `QuantizedRelu` and `QuantizedRelu6` ([CVE-2022-35979](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35979)) +* Fixes a `CHECK` fail in `FractionalMaxPoolGrad` ([CVE-2022-35981](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35981)) +* Fixes a `CHECK` fail in `RaggedTensorToVariant` ([CVE-2022-36018](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36018)) +* Fixes a `CHECK` fail in `QuantizeAndDequantizeV3` ([CVE-2022-36026](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36026)) +* Fixes a segfault in `SparseBincount` ([CVE-2022-35982](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35982)) +* Fixes a `CHECK` fail in `Save` and `SaveSlices` ([CVE-2022-35983](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35983)) +* Fixes a `CHECK` fail in `ParameterizedTruncatedNormal` ([CVE-2022-35984](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35984)) +* Fixes a `CHECK` fail in `LRNGrad` ([CVE-2022-35985](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35985)) +* Fixes a segfault in `RaggedBincount` ([CVE-2022-35986](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35986)) +* Fixes a `CHECK` fail in `DenseBincount` ([CVE-2022-35987](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35987)) +* Fixes a `CHECK` fail in `tf.linalg.matrix_rank` ([CVE-2022-35988](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35988)) +* Fixes a `CHECK` fail in `MaxPool` ([CVE-2022-35989](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35989)) +* Fixes a `CHECK` fail in `Conv2DBackpropInput` ([CVE-2022-35999](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35999)) +* Fixes a `CHECK` fail in `EmptyTensorList` ([CVE-2022-35998](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35998)) +* Fixes a `CHECK` fail in `tf.sparse.cross` ([CVE-2022-35997](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35997)) +* Fixes a floating point exception in `Conv2D` ([CVE-2022-35996](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35996)) +* Fixes a `CHECK` fail in `AudioSummaryV2` ([CVE-2022-35995](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35995)) +* Fixes a `CHECK` fail in `CollectiveGather` ([CVE-2022-35994](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35994)) +* Fixes a `CHECK` fail in `SetSize` ([CVE-2022-35993](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35993)) +* Fixes a `CHECK` fail in `TensorListFromTensor` ([CVE-2022-35992](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35992)) +* Fixes a `CHECK` fail in `TensorListScatter` and `TensorListScatterV2` ([CVE-2022-35991](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35991)) +* Fixes a `CHECK` fail in `FakeQuantWithMinMaxVarsPerChannelGradient` ([CVE-2022-35990](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35990)) +* Fixes a `CHECK` fail in `FakeQuantWithMinMaxVarsGradient` ([CVE-2022-36005](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36005)) +* Fixes a `CHECK` fail in `tf.random.gamma` ([CVE-2022-36004](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36004)) +* Fixes a `CHECK` fail in `RandomPoissonV2` ([CVE-2022-36003](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36003)) +* Fixes a `CHECK` fail in `Unbatch` ([CVE-2022-36002](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36002)) +* Fixes a `CHECK` fail in `DrawBoundingBoxes` ([CVE-2022-36001](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36001)) +* Fixes a `CHECK` fail in `Eig` ([CVE-2022-36000](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36000)) +* Fixes a null dereference on MLIR on empty function attributes ([CVE-2022-36011](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36011)) +* Fixes an assertion failure on MLIR empty edge names ([CVE-2022-36012](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36012)) +* Fixes a null-dereference in `mlir::tfg::GraphDefImporter::ConvertNodeDef` ([CVE-2022-36013](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36013)) +* Fixes a null-dereference in `mlir::tfg::TFOp::nameAttr` ([CVE-2022-36014](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36014)) +* Fixes an integer overflow in math ops ([CVE-2022-36015](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36015)) +* Fixes a `CHECK`-fail in `tensorflow::full_type::SubstituteFromAttrs` ([CVE-2022-36016](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36016)) +* Fixes an OOB read in `Gather_nd` op in TF Lite Micro ([CVE-2022-35938](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35938)) + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +Abolfazl Shahbazi, Adam Lanicek, Amin Benarieb, andreii, Andrew Fitzgibbon, Andrew Goodbody, angerson, Ashiq Imran, Aurélien Geron, Banikumar Maiti (Intel Aipg), Ben Barsdell, Ben Mares, bhack, Bhavani Subramanian, Bill Schnurr, Byungsoo Oh, Chandra Sr Potula, Chengji Yao, Chris Carpita, Christopher Bate, chunduriv, Cliff Woolley, Cliffs Dover, Cloud Han, Code-Review-Doctor, DEKHTIARJonathan, Deven Desai, Djacon, Duncan Riach, fedotoff, fo40225, Frederic Bastien, gadagashwini, Gauri1 Deshpande, guozhong.zhuang, Hui Peng, James Gerity, Jason Furmanek, Jonathan Dekhtiar, Jueon Park, Kaixi Hou, Kanvi Khanna, Keith Smiley, Koan-Sin Tan, Kulin Seth, kushanam, Learning-To-Play, Li-Wen Chang, lipracer, liuyuanqiang, Louis Sugy, Lucas David, Lukas Geiger, Mahmoud Abuzaina, Marius Brehler, Maxiwell S. Garcia, mdfaijul, Meenakshi Venkataraman, Michal Szutenberg, Michele Di Giorgio, Mickaël Salamin, Nathan John Sircombe, Nathan Luehr, Neil Girdhar, Nils Reichardt, Nishidha Panpaliya, Nobuo Tsukamoto, Om Thakkar, Patrice Vignola, Philipp Hack, Pooya Jannaty, Prianka Liz Kariat, pshiko, Rajeshwar Reddy T, rdl4199, Rohit Santhanam, Rsanthanam-Amd, Sachin Muradi, Saoirse Stewart, Serge Panev, Shu Wang, Srinivasan Narayanamoorthy, Stella Stamenova, Stephan Hartmann, Sunita Nadampalli, synandi, Tamas Bela Feher, Tao Xu, Thibaut Goetghebuer-Planchon, Trevor Morris, Xiaoming (Jason) Cui, Yimei Sun, Yong Tang, Yuanqiang Liu, Yulv-Git, Zhoulong Jiang, ZihengJiang diff --git a/corpus/changelog/tensorflow_releases/tensorflow_2110.md b/corpus/changelog/tensorflow_releases/tensorflow_2110.md new file mode 100644 index 0000000000000000000000000000000000000000..a0a27d26a78139aa3945cd4788243c6e36ab36c9 --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_2110.md @@ -0,0 +1,158 @@ +# TensorFlow 2.11.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v2.11.0 +Version: 2.11.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@tensorflow-jenkins](https://avatars.githubusercontent.com/u/16359713?s=40&v=4) +[tensorflow-jenkins](/tensorflow-jenkins) +released this +18 Nov 06:01 + +· +[95 commits](/tensorflow/tensorflow/compare/v2.11.0...r2.11) +to r2.11 +since this release + +[v2.11.0](/tensorflow/tensorflow/tree/v2.11.0) + +[`d5b57ca`](/tensorflow/tensorflow/commit/d5b57ca93e506df258271ea00fc29cf98383a374) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 2.11.0 + +## Breaking Changes + +* The `tf.keras.optimizers.Optimizer` base class now points to the new Keras optimizer, while the old optimizers have been moved to the `tf.keras.optimizers.legacy` namespace. + + If you find your workflow failing due to this change, you may be facing one of the following issues: + + + **Checkpoint loading failure.** The new optimizer handles optimizer state differently from the old optimizer, which simplifies the logic of checkpoint saving/loading, but at the cost of breaking checkpoint backward compatibility in some cases. If you want to keep using an old checkpoint, please change your optimizer to `tf.keras.optimizer.legacy.XXX` (e.g. `tf.keras.optimizer.legacy.Adam`). + + **TF1 compatibility.** The new optimizer, `tf.keras.optimizers.Optimizer`, does not support TF1 any more, so please use the legacy optimizer `tf.keras.optimizer.legacy.XXX`. We highly recommend [migrating your workflow to TF2](https://www.tensorflow.org/guide/migrate) for stable support and new features. + + **Old optimizer API not found.** The new optimizer, `tf.keras.optimizers.Optimizer`, has a different set of public APIs from the old optimizer. These API changes are mostly related to getting rid of slot variables and TF1 support. Please check the API documentation to find alternatives to the missing API. If you must call the deprecated API, please change your optimizer to the legacy optimizer. + + **Learning rate schedule access.** When using a `tf.keras.optimizers.schedules.LearningRateSchedule`, the new optimizer's `learning_rate` property returns the current learning rate value instead of a `LearningRateSchedule` object as before. If you need to access the `LearningRateSchedule` object, please use `optimizer._learning_rate`. + + **If you implemented a custom optimizer based on the old optimizer.** Please set your optimizer to subclass `tf.keras.optimizer.legacy.XXX`. If you want to migrate to the new optimizer and find it does not support your optimizer, please file an issue in the [Keras GitHub repo](https://github.com/keras-team/keras/issues). + + **Errors, such as `Cannot recognize variable...`.** The new optimizer requires all optimizer variables to be created at the first `apply_gradients()` or `minimize()` call. If your workflow calls the optimizer to update different parts of the model in multiple stages, please call `optimizer.build(model.trainable_variables)` before the training loop. + + **Timeout or performance loss.** We don't anticipate this to happen, but if you see such issues, please use the legacy optimizer, and file an issue in the Keras GitHub repo. + + The old Keras optimizer will never be deleted, but will not see any new feature additions. New optimizers (for example, `tf.keras.optimizers.Adafactor`) will only be implemented based on the new `tf.keras.optimizers.Optimizer` base class. +* `tensorflow/python/keras` code is a legacy copy of Keras since the TensorFlow v2.7 release, and will be deleted in the v2.12 release. Please remove any import of `tensorflow.python.keras` and use the public API with `from tensorflow import keras` or `import tensorflow as tf; tf.keras`. + +## Major Features and Improvements + +* `tf.lite`: + + + New operations supported: `tf.math.unsorted_segment_sum`, `tf.atan2` and `tf.sign`. + + Updates to existing operations: + - `tfl.mul` now supports complex32 inputs. +* `tf.experimental.StructuredTensor`: + + + Introduced `tf.experimental.StructuredTensor`, which provides a flexible and TensorFlow-native way to encode structured data such as protocol buffers or pandas dataframes. +* `tf.keras`: + + + Added a new `get_metrics_result()` method to `tf.keras.models.Model`. + - Returns the current metrics values of the model as a dict. + + Added a new group normalization layer - `tf.keras.layers.GroupNormalization`. + + Added weight decay support for all Keras optimizers via the `weight_decay` argument. + + Added the Adafactor optimizer - `tf.keras.optimizers.Adafactor`. + + Added `warmstart_embedding_matrix` to `tf.keras.utils`. + - This utility can be used to warmstart an embedding matrix, so you reuse previously-learned word embeddings when working with a new set of words which may include previously unseen words (the embedding vectors for unseen words will be randomly initialized). +* `tf.Variable`: + + + Added `CompositeTensor` as a base class to `ResourceVariable`. + - This allows `tf.Variable`s to be nested in `tf.experimental.ExtensionType`s. + + Added a new constructor argument `experimental_enable_variable_lifting` to `tf.Variable`, defaulting to `True`. + - When it's set to `False`, the variable won't be lifted out of `tf.function`; thus it can be used as a `tf.function`-local variable: during each execution of the `tf.function`, the variable will be created and then disposed, similar to a local (that is, stack-allocated) variable in C/C++. Currently, `experimental_enable_variable_lifting=False` only works on non-XLA devices (for example, under `@tf.function(jit_compile=False)`). +* TF SavedModel: + + + Added `fingerprint.pb` to the SavedModel directory. The `fingerprint.pb` file is a protobuf containing the "fingerprint" of the SavedModel. See the [RFC](https://github.com/tensorflow/community/pull/415) for more details regarding its design and properties. +* TF pip: + + + Windows CPU-builds for x86/x64 processors are now built, maintained, tested and released by a third party: Intel. Installing the Windows-native pip packages for `tensorflow` or `tensorflow-cpu` would install Intel's `tensorflow-intel` package. These packages are provided on an as-is basis. TensorFlow will use reasonable efforts to maintain the availability and integrity of this pip package. There may be delays if the third party fails to release the pip package. For using TensorFlow GPU on Windows, you will need to install TensorFlow in WSL2. + +## Bug Fixes and Other Changes + +* `tf.image`: + + + Added an optional parameter `return_index_map` to `tf.image.ssim`, which causes the returned value to be the local SSIM map instead of the global mean. +* TF Core: + + + `tf.custom_gradient` can now be applied to functions that accept "composite" tensors, such as `tf.RaggedTensor`, as inputs. + + Fix device placement issues related to datasets with ragged tensors of strings (i.e. variant encoded data with types not supported on GPU). + + `experimental_follow_type_hints` for `tf.function` has been deprecated. Please `use input_signature` or `reduce_retracing` to minimize retracing. +* `tf.SparseTensor`: + + + Introduced `set_shape`, which sets the static dense shape of the sparse tensor and has the same semantics as `tf.Tensor.set_shape`. + +## Security + +* TF is currently using giflib 5.2.1 which has [CVE-2022-28506](https://nvd.nist.gov/vuln/detail/CVE-2022-28506). TF is not affected by the CVE as it does not use `DumpScreen2RGB` at all. +* Fixes an OOB seg fault in `DynamicStitch` due to missing validation ([CVE-2022-41883](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41883)) +* Fixes an overflow in `tf.keras.losses.poisson` ([CVE-2022-41887](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41887)) +* Fixes a heap OOB failure in `ThreadUnsafeUnigramCandidateSampler` caused by missing validation ([CVE-2022-41880](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41880)) +* Fixes a segfault in `ndarray_tensor_bridge` ([CVE-2022-41884](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41884)) +* Fixes an overflow in `FusedResizeAndPadConv2D` ([CVE-2022-41885](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41885)) +* Fixes a overflow in `ImageProjectiveTransformV2` ([CVE-2022-41886](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41886)) +* Fixes an FPE in `tf.image.generate_bounding_box_proposals` on GPU ([CVE-2022-41888](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41888)) +* Fixes a segfault in `pywrap_tfe_src` caused by invalid attributes ([CVE-2022-41889](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41889)) +* Fixes a `CHECK` fail in `BCast` ([CVE-2022-41890](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41890)) +* Fixes a segfault in `TensorListConcat` ([CVE-2022-41891](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41891)) +* Fixes a `CHECK_EQ` fail in `TensorListResize` ([CVE-2022-41893](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41893)) +* Fixes an overflow in `CONV_3D_TRANSPOSE` on TFLite ([CVE-2022-41894](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41894)) +* Fixes a heap OOB in `MirrorPadGrad` ([CVE-2022-41895](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41895)) +* Fixes a crash in `Mfcc` ([CVE-2022-41896](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41896)) +* Fixes a heap OOB in `FractionalMaxPoolGrad` ([CVE-2022-41897](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41897)) +* Fixes a `CHECK` fail in `SparseFillEmptyRowsGrad` ([CVE-2022-41898](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41898)) +* Fixes a `CHECK` fail in `SdcaOptimizer` ([CVE-2022-41899](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41899)) +* Fixes a heap OOB in `FractionalAvgPool` and `FractionalMaxPool`([CVE-2022-41900](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41900)) +* Fixes a `CHECK_EQ` in `SparseMatrixNNZ` ([CVE-2022-41901](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41901)) +* Fixes an OOB write in grappler ([CVE-2022-41902](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41902)) +* Fixes a overflow in `ResizeNearestNeighborGrad` ([CVE-2022-41907](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41907)) +* Fixes a `CHECK` fail in `PyFunc` ([CVE-2022-41908](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41908)) +* Fixes a segfault in `CompositeTensorVariantToComponents` ([CVE-2022-41909](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41909)) +* Fixes a invalid char to bool conversion in printing a tensor ([CVE-2022-41911](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41911)) +* Fixes a heap overflow in `QuantizeAndDequantizeV2` ([CVE-2022-41910](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-41910)) +* Fixes a `CHECK` failure in `SobolSample` via missing validation ([CVE-2022-35935](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35935)) +* Fixes a `CHECK` fail in `TensorListScatter` and `TensorListScatterV2` in eager mode ([CVE-2022-35935](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35935)) + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +103yiran, 8bitmp3, Aakar Dwivedi, Alexander Grund, alif\_elham, Aman Agarwal, amoitra, Andrei Ivanov, andreii, Andrew Goodbody, angerson, Ashay Rane, Azeem Shaikh, Ben Barsdell, bhack, Bhavani Subramanian, Cedric Nugteren, Chandra Kumar Ramasamy, Christopher Bate, CohenAriel, Cotarou, cramasam, Enrico Minack, Francisco Unda, Frederic Bastien, gadagashwini, Gauri1 Deshpande, george, Jake, Jeff, Jerry Ge, Jingxuan He, Jojimon Varghese, Jonathan Dekhtiar, Kaixi Hou, Kanvi Khanna, kcoul, Keith Smiley, Kevin Hu, Kun Lu, kushanam, Lianmin Zheng, liuyuanqiang, Louis Sugy, Mahmoud Abuzaina, Marius Brehler, mdfaijul, Meenakshi Venkataraman, Milos Puzovic, mohantym, Namrata-Ibm, Nathan John Sircombe, Nathan Luehr, Olaf Lipinski, Om Thakkar, Osman F Bayram, Patrice Vignola, Pavani Majety, Philipp Hack, Prianka Liz Kariat, Rahul Batra, RajeshT, Renato Golin, riestere, Roger Iyengar, Rohit Santhanam, Rsanthanam-Amd, Sadeed Pv, Samuel Marks, Shimokawa, Naoaki, Siddhesh Kothadi, Simengliu-Nv, Sindre Seppola, snadampal, Srinivasan Narayanamoorthy, sushreebarsa, syedshahbaaz, Tamas Bela Feher, Tatwai Chong, Thibaut Goetghebuer-Planchon, tilakrayal, Tom Anderson, Tomohiro Endo, Trevor Morris, vibhutisawant, Victor Zhang, Vremold, Xavier Bonaventura, Yanming Wang, Yasir Modak, Yimei Sun, Yong Tang, Yulv-Git, zhuoran.liu, zotanika diff --git a/corpus/changelog/tensorflow_releases/tensorflow_2120.md b/corpus/changelog/tensorflow_releases/tensorflow_2120.md new file mode 100644 index 0000000000000000000000000000000000000000..ff5ec1aace922367f068c46d0980ffe0e8df09b4 --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_2120.md @@ -0,0 +1,183 @@ +# TensorFlow 2.12.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v2.12.0 +Version: 2.12.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@mihaimaruseac](https://avatars.githubusercontent.com/u/323199?s=40&v=4) +[mihaimaruseac](/mihaimaruseac) +released this +23 Mar 15:50 + +· +[26 commits](/tensorflow/tensorflow/compare/v2.12.0...r2.12) +to r2.12 +since this release + +[v2.12.0](/tensorflow/tensorflow/tree/v2.12.0) + +[`0db597d`](/tensorflow/tensorflow/commit/0db597d0d758aba578783b5bf46c889700a45085) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 2.12.0 + +## TensorFlow + +### Breaking Changes + +* Build, Compilation and Packaging + + + Removed redundant packages `tensorflow-gpu` and `tf-nightly-gpu`. These packages were removed and replaced with packages that direct users to switch to `tensorflow` or `tf-nightly` respectively. Since TensorFlow 2.1, the only difference between these two sets of packages was their names, so there is no loss of functionality or GPU support. See for more details. +* `tf.function`: + + + `tf.function` now uses the Python inspect library directly for parsing the signature of the Python function it is decorated on. This change may break code where the function signature is malformed, but was ignored previously, such as: + - Using `functools.wraps` on a function with different signature + - Using `functools.partial` with an invalid `tf.function` input + + `tf.function` now enforces input parameter names to be valid Python identifiers. Incompatible names are automatically sanitized similarly to existing SavedModel signature behavior. + + Parameterless `tf.function`s are assumed to have an empty `input_signature` instead of an undefined one even if the `input_signature` is unspecified. + + `tf.types.experimental.TraceType` now requires an additional `placeholder_value` method to be defined. + + `tf.function` now traces with placeholder values generated by TraceType instead of the value itself. +* Experimental APIs `tf.config.experimental.enable_mlir_graph_optimization` and `tf.config.experimental.disable_mlir_graph_optimization` were removed. + +### Major Features and Improvements + +* Support for Python 3.11 has been added. +* Support for Python 3.7 has been removed. We are not releasing any more patches for Python 3.7. +* `tf.lite`: + + + Add 16-bit float type support for built-in op `fill`. + + Transpose now supports 6D tensors. + + Float LSTM now supports diagonal recurrent tensors: +* `tf.experimental.dtensor`: + + + Coordination service now works with `dtensor.initialize_accelerator_system`, and enabled by default. + + Add `tf.experimental.dtensor.is_dtensor` to check if a tensor is a DTensor instance. +* `tf.data`: + + + Added support for alternative checkpointing protocol which makes it possible to checkpoint the state of the input pipeline without having to store the contents of internal buffers. The new functionality can be enabled through the `experimental_symbolic_checkpoint` option of `tf.data.Options()`. + + Added a new `rerandomize_each_iteration` argument for the `tf.data.Dataset.random()` operation, which controls whether the sequence of generated random numbers should be re-randomized every epoch or not (the default behavior). If `seed` is set and `rerandomize_each_iteration=True`, the `random()` operation will produce a different (deterministic) sequence of numbers every epoch. + + Added a new `rerandomize_each_iteration` argument for the `tf.data.Dataset.sample_from_datasets()` operation, which controls whether the sequence of generated random numbers used for sampling should be re-randomized every epoch or not. If `seed` is set and `rerandomize_each_iteration=True`, the `sample_from_datasets()` operation will use a different (deterministic) sequence of numbers every epoch. +* `tf.test`: + + + Added `tf.test.experimental.sync_devices`, which is useful for accurately measuring performance in benchmarks. +* `tf.experimental.dtensor`: + + + Added experimental support to ReduceScatter fuse on GPU (NCCL). + +### Bug Fixes and Other Changes + +* `tf.SavedModel`: + + Introduced new class `tf.saved_model.experimental.Fingerprint` that contains the fingerprint of the SavedModel. See the [SavedModel Fingerprinting RFC](https://github.com/tensorflow/community/pull/415) for details. + + Introduced API `tf.saved_model.experimental.read_fingerprint(export_dir)` for reading the fingerprint of a SavedModel. +* `tf.random` + + Added non-experimental aliases for `tf.random.split` and `tf.random.fold_in`, the experimental endpoints are still available so no code changes are necessary. +* `tf.experimental.ExtensionType` + + Added function `experimental.extension_type.as_dict()`, which converts an instance of `tf.experimental.ExtensionType` to a `dict` representation. +* `stream_executor` + + Top level `stream_executor` directory has been deleted, users should use equivalent headers and targets under `compiler/xla/stream_executor`. +* `tf.nn` + + Added `tf.nn.experimental.general_dropout`, which is similar to `tf.random.experimental.stateless_dropout` but accepts a custom sampler function. +* `tf.types.experimental.GenericFunction` + + The `experimental_get_compiler_ir` method supports tf.TensorSpec compilation arguments. +* `tf.config.experimental.mlir_bridge_rollout` + + Removed enums `MLIR_BRIDGE_ROLLOUT_SAFE_MODE_ENABLED` and `MLIR_BRIDGE_ROLLOUT_SAFE_MODE_FALLBACK_ENABLED` which are no longer used by the tf2xla bridge + +## Keras + +Keras is a framework built on top of the TensorFlow. See more details on the Keras [website](https://keras.io/). + +### Breaking Changes + +`tf.keras`: + +* Moved all saving-related utilities to a new namespace, `keras.saving`, for example: `keras.saving.load_model`, `keras.saving.save_model`, `keras.saving.custom_object_scope`, `keras.saving.get_custom_objects`, `keras.saving.register_keras_serializable`,`keras.saving.get_registered_name` and `keras.saving.get_registered_object`. The previous API locations (in `keras.utils` and `keras.models`) will be available indefinitely, but we recommend you update your code to point to the new API locations. +* Improvements and fixes in Keras loss masking: + + Whether you represent a ragged tensor as a `tf.RaggedTensor` or using [keras masking](https://www.tensorflow.org/guide/keras/masking_and_padding), the returned loss values should be the identical to each other. In previous versions Keras may have silently ignored the mask. +* If you use masked losses with Keras the loss values may be different in TensorFlow `2.12` compared to previous versions. +* In cases where the mask was previously ignored, you will now get an error if you pass a mask with an incompatible shape. + +### Major Features and Improvements + +`tf.keras`: + +* The new Keras model saving format (`.keras`) is available. You can start using it via `model.save(f"{fname}.keras", save_format="keras_v3")`. In the future it will become the default for all files with the `.keras` extension. This file format targets the Python runtime only and makes it possible to reload Python objects identical to the saved originals. The format supports non-numerical state such as vocabulary files and lookup tables, and it is easy to customize in the case of custom layers with exotic elements of state (e.g. a FIFOQueue). The format does not rely on bytecode or pickling, and is safe by default. Note that as a result, Python `lambdas` are disallowed at loading time. If you want to use `lambdas`, you can pass `safe_mode=False` to the loading method (only do this if you trust the source of the model). +* Added a `model.export(filepath)` API to create a lightweight SavedModel artifact that can be used for inference (e.g. with TF-Serving). +* Added `keras.export.ExportArchive` class for low-level customization of the process of exporting SavedModel artifacts for inference. Both ways of exporting models are based on `tf.function` tracing and produce a TF program composed of TF ops. They are meant primarily for environments where the TF runtime is available, but not the Python interpreter, as is typical for production with TF Serving. +* Added utility `tf.keras.utils.FeatureSpace`, a one-stop shop for structured data preprocessing and encoding. +* Added `tf.SparseTensor` input support to `tf.keras.layers.Embedding` layer. The layer now accepts a new boolean argument `sparse`. If `sparse` is set to True, the layer returns a SparseTensor instead of a dense Tensor. Defaults to False. +* Added `jit_compile` as a settable property to `tf.keras.Model`. +* Added `synchronized` optional parameter to `layers.BatchNormalization`. +* Added deprecation warning to `layers.experimental.SyncBatchNormalization` and suggested to use `layers.BatchNormalization` with `synchronized=True` instead. +* Updated `tf.keras.layers.BatchNormalization` to support masking of the inputs (`mask` argument) when computing the mean and variance. +* Add `tf.keras.layers.Identity`, a placeholder pass-through layer. +* Add `show_trainable` option to `tf.keras.utils.model_to_dot` to display layer trainable status in model plots. +* Add ability to save a `tf.keras.utils.FeatureSpace` object, via `feature_space.save("myfeaturespace.keras")`, and reload it via `feature_space = tf.keras.models.load_model("myfeaturespace.keras")`. +* Added utility `tf.keras.utils.to_ordinal` to convert class vector to ordinal regression / classification matrix. + +### Bug Fixes and Other Changes + +* N/A + +## Security + +* Fixes an FPE in TFLite in conv kernel [CVE-2023-27579](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-27579) +* Fixes a double free in Fractional(Max/Avg)Pool [CVE-2023-25801](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25801) +* Fixes a null dereference on ParallelConcat with XLA [CVE-2023-25676](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25676) +* Fixes a segfault in Bincount with XLA [CVE-2023-25675](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25675) +* Fixes an NPE in RandomShuffle with XLA enable [CVE-2023-25674](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25674) +* Fixes an FPE in TensorListSplit with XLA [CVE-2023-25673](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25673) +* Fixes segmentation fault in tfg-translate [CVE-2023-25671](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25671) +* Fixes an NPE in QuantizedMatMulWithBiasAndDequantize [CVE-2023-25670](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25670) +* Fixes an FPE in AvgPoolGrad with XLA [CVE-2023-25669](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25669) +* Fixes a heap out-of-buffer read vulnerability in the QuantizeAndDequantize operation [CVE-2023-25668](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25668) +* Fixes a segfault when opening multiframe gif [CVE-2023-25667](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25667) +* Fixes an NPE in SparseSparseMaximum [CVE-2023-25665](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25665) +* Fixes an FPE in AudioSpectrogram [CVE-2023-25666](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25666) +* Fixes a heap-buffer-overflow in AvgPoolGrad [CVE-2023-25664](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25664) +* Fixes a NPE in TensorArrayConcatV2 [CVE-2023-25663](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25663) +* Fixes a Integer overflow in EditDistance [CVE-2023-25662](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25662) +* Fixes a Seg fault in `tf.raw_ops.Print` [CVE-2023-25660](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25660) +* Fixes a OOB read in DynamicStitch [CVE-2023-25659](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25659) +* Fixes a OOB Read in GRUBlockCellGrad [CVE-2023-25658](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25658) + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +103yiran, 8bitmp3, Aakar, Aakar Dwivedi, Abinash Satapathy, Aditya Kane, ag.ramesh, Alexander Grund, Andrei Pikas, andreii, Andrew Goodbody, angerson, Anthony\_256, Ashay Rane, Ashiq Imran, Awsaf, Balint Cristian, Banikumar Maiti (Intel Aipg), Ben Barsdell, bhack, cfRod, Chao Chen, chenchongsong, Chris Mc, Daniil Kutz, David Rubinstein, dianjiaogit, dixr, Dongfeng Yu, dongfengy, drah, Eric Kunze, Feiyue Chen, Frederic Bastien, Gauri1 Deshpande, guozhong.zhuang, hDn248, HYChou, ingkarat, James Hilliard, Jason Furmanek, Jaya, Jens Glaser, Jerry Ge, Jiao Dian'S Power Plant, Jie Fu, Jinzhe Zeng, Jukyy, Kaixi Hou, Kanvi Khanna, Karel Ha, karllessard, Koan-Sin Tan, Konstantin Beluchenko, Kulin Seth, Kun Lu, Kyle Gerard Felker, Leopold Cambier, Lianmin Zheng, linlifan, liuyuanqiang, Lukas Geiger, Luke Hutton, Mahmoud Abuzaina, Manas Mohanty, Mateo Fidabel, Maxiwell S. Garcia, Mayank Raunak, mdfaijul, meatybobby, Meenakshi Venkataraman, Michael Holman, Nathan John Sircombe, Nathan Luehr, nitins17, Om Thakkar, Patrice Vignola, Pavani Majety, per1234, Philipp Hack, pollfly, Prianka Liz Kariat, Rahul Batra, rahulbatra85, ratnam.parikh, Rickard Hallerbäck, Roger Iyengar, Rohit Santhanam, Roman Baranchuk, Sachin Muradi, sanadani, Saoirse Stewart, seanshpark, Shawn Wang, shuw, Srinivasan Narayanamoorthy, Stewart Miles, Sunita Nadampalli, SuryanarayanaY, Takahashi Shuuji, Tatwai Chong, Thibaut Goetghebuer-Planchon, tilakrayal, Tirumalesh, TJ, Tony Sung, Trevor Morris, unda, Vertexwahn, Vinila S, William Muir, Xavier Bonaventura, xiang.zhang, Xiao-Yong Jin, yleeeee, Yong Tang, Yuriy Chernyshov, Zhang, Xiangze, zhaozheng09 diff --git a/corpus/changelog/tensorflow_releases/tensorflow_2130.md b/corpus/changelog/tensorflow_releases/tensorflow_2130.md new file mode 100644 index 0000000000000000000000000000000000000000..da2649c64b23e3c05415db89ce8d96c5d0f7d156 --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_2130.md @@ -0,0 +1,163 @@ +# TensorFlow 2.13.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v2.13.0 +Version: 2.13.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@tensorflow-jenkins](https://avatars.githubusercontent.com/u/16359713?s=40&v=4) +[tensorflow-jenkins](/tensorflow-jenkins) +released this +05 Jul 17:32 + +· +[18 commits](/tensorflow/tensorflow/compare/v2.13.0...r2.13) +to r2.13 +since this release + +[v2.13.0](/tensorflow/tensorflow/tree/v2.13.0) + +[`1cb1a03`](/tensorflow/tensorflow/commit/1cb1a030a62b169d90d34c747ab9b09f332bf905) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 2.13.0 + +## TensorFlow + +### Breaking Changes + +* The LMDB kernels have been changed to return an error. This is in preparation for completely removing them from TensorFlow. The LMDB dependency that these kernels are bringing to TensorFlow has been dropped, thus making the build slightly faster and more secure. + +### Major Features and Improvements + +* `tf.lite` + + + Added 16-bit and 64-bit float type support for built-in op `cast`. + + The Python TF Lite Interpreter bindings now have an option `experimental_disable_delegate_clustering` to turn-off delegate clustering. + + Added int16x8 support for the built-in op `exp` + + Added int16x8 support for the built-in op `mirror_pad` + + Added int16x8 support for the built-in ops `space_to_batch_nd` and `batch_to_space_nd` + + Added 16-bit int type support for built-in op `less`, `greater_than`, `equal` + + Added 8-bit and 16-bit support for `floor_div` and `floor_mod`. + + Added 16-bit and 32-bit int support for the built-in op `bitcast`. + + Added 8-bit/16-bit/32-bit int/uint support for the built-in op `bitwise_xor` + + Added int16 indices support for built-in op `gather` and `gather_nd`. + + Added 8-bit/16-bit/32-bit int/uint support for the built-in op `right_shift` + + Added reference implementation for 16-bit int unquantized `add`. + + Added reference implementation for 16-bit int and 32-bit unsigned int unquantized `mul`. + + `add_op` supports broadcasting up to 6 dimensions. + + Added 16-bit support for `top_k`. +* `tf.function` + + + ConcreteFunction (`tf.types.experimental.ConcreteFunction`) as generated through `get_concrete_function` now performs holistic input validation similar to calling `tf.function` directly. This can cause breakages where existing calls pass Tensors with the wrong shape or omit certain non-Tensor arguments (including default values). +* `tf.nn` + + + `tf.nn.embedding_lookup_sparse` and `tf.nn.safe_embedding_lookup_sparse` now support ids and weights described by `tf.RaggedTensor`s. + + Added a new boolean argument `allow_fast_lookup` to `tf.nn.embedding_lookup_sparse` and `tf.nn.safe_embedding_lookup_sparse`, which enables a simplified and typically faster lookup procedure. +* `tf.data` + + + `tf.data.Dataset.zip` now supports Python-style zipping, i.e. `Dataset.zip(a, b, c)`. + + `tf.data.Dataset.shuffle` now supports `tf.data.UNKNOWN_CARDINALITY` When doing a "full shuffle" using `dataset = dataset.shuffle(dataset.cardinality())`. But remember, a "full shuffle" will load the full dataset into memory so that it can be shuffled, so make sure to only use this with small datasets or datasets of small objects (like filenames). +* `tf.math` + + + `tf.nn.top_k` now supports specifying the output index type via parameter `index_type`. Supported types are `tf.int16`, `tf.int32` (default), and `tf.int64`. +* `tf.SavedModel` + + + Introduced class method `tf.saved_model.experimental.Fingerprint.from_proto(proto)`, which can be used to construct a `Fingerprint` object directly from a protobuf. + + Introduced member method `tf.saved_model.experimental.Fingerprint.singleprint()`, which provides a convenient way to uniquely identify a SavedModel. + +### Bug Fixes and Other Changes + +* `tf.Variable` + + + Changed resource variables to inherit from `tf.compat.v2.Variable` instead of `tf.compat.v1.Variable`. Some checks for `isinstance(v, tf compat.v1.Variable)` that previously returned True may now return False. +* `tf.distribute` + + + Opened an experimental API, `tf.distribute.experimental.coordinator.get_current_worker_index`, for retrieving the worker index from within a worker, when using parameter server training with a custom training loop. +* `tf.experimental.dtensor` + + + Deprecated `dtensor.run_on` in favor of `dtensor.default_mesh` to correctly indicate that the context does not override the mesh that the ops and functions will run on, it only sets a fallback default mesh. + + List of members of `dtensor.Layout` and `dtensor.Mesh` have slightly changed as part of efforts to consolidate the C++ and Python source code with pybind11. Most notably, `dtensor.Layout.serialized_string` is removed. + + Minor API changes to represent Single Device Layout for non-distributed Tensors inside DTensor functions. Runtime support will be added soon. +* `tf.experimental.ExtensionType` + + + `tf.experimental.ExtensionType` now supports Python `tuple` as the type annotation of its fields. +* `tf.nest` + + + Deprecated API `tf.nest.is_sequence` has now been deleted. Please use `tf.nest.is_nested` instead. + +## Keras + +Keras is a framework built on top of the TensorFlow. See more details on the [Keras website](https://keras.io/). + +### Breaking Changes + +* Removed the Keras scikit-learn API wrappers (`KerasClassifier` and `KerasRegressor`), which had been deprecated in August 2021. We recommend using [SciKeras](https://github.com/adriangb/scikeras) instead. +* The default Keras model saving format is now the Keras v3 format: calling `model.save("xyz.keras")` will no longer create a H5 file, it will create a native Keras model file. This will only be breaking for you if you were manually inspecting or modifying H5 files saved by Keras under a `.keras` extension. If this breaks you, simply add `save_format="h5"` to your `.save()` call to revert back to the prior behavior. +* Added `keras.utils.TimedThread` utility to run a timed thread every x seconds. It can be used to run a threaded function alongside model training or any other snippet of code. +* In the `keras` PyPI package, accessible symbols are now restricted to symbols that are intended to be public. This may affect your code if you were using `import keras` and you used `keras` functions that were not public APIs, but were accessible in earlier versions with direct imports. In those cases, please use the following guideline: + - The API may be available in the public Keras API under a different name, so make sure to look for it on keras.io or TensorFlow docs and switch to the public version. + - It could also be a simple python or TF utility that you could easily copy over to your own codebase. In those case, just make it your own! + - If you believe it should definitely be a public Keras API, please open a feature request in keras GitHub repo. + - As a workaround, you could import the same private symbol keras `keras.src`, but keep in mind the `src` namespace is not stable and those APIs may change or be removed in the future. + +### Major Features and Improvements + +* Added F-Score metrics `tf.keras.metrics.FBetaScore`, `tf.keras.metrics.F1Score`, and `tf.keras.metrics.R2Score`. +* Added activation function `tf.keras.activations.mish`. +* Added experimental `keras.metrics.experimental.PyMetric` API for metrics that run Python code on the host CPU (compiled outside of the TensorFlow graph). This can be used for integrating metrics from external Python libraries (like sklearn or pycocotools) into Keras as first-class Keras metrics. +* Added `tf.keras.optimizers.Lion` optimizer. +* Added `tf.keras.layers.SpectralNormalization` layer wrapper to perform spectral normalization on the weights of a target layer. +* The `SidecarEvaluatorModelExport` callback has been added to Keras as `keras.callbacks.SidecarEvaluatorModelExport`. This callback allows for exporting the model the best-scoring model as evaluated by a `SidecarEvaluator` evaluator. The evaluator regularly evaluates the model and exports it if the user-defined comparison function determines that it is an improvement. +* Added warmup capabilities to `tf.keras.optimizers.schedules.CosineDecay` learning rate scheduler. You can now specify an initial and target learning rate, and our scheduler will perform a linear interpolation between the two after which it will begin a decay phase. +* Added experimental support for an exactly-once visitation guarantee for evaluating Keras models trained with `tf.distribute ParameterServerStrategy`, via the `exact_evaluation_shards` argument in `Model.fit` and `Model.evaluate`. +* Added `tf.keras.__internal__.KerasTensor`,`tf.keras.__internal__.SparseKerasTensor`, and `tf.keras.__internal__.RaggedKerasTensor` classes. You can use these classes to do instance type checking and type annotations for layer/model inputs and outputs. +* All the `tf.keras.dtensor.experimental.optimizers` classes have been merged with `tf.keras.optimizers`. You can migrate your code to use `tf.keras.optimizers` directly. The API namespace for `tf.keras.dtensor.experimental.optimizers` will be removed in future releases. +* Added support for `class_weight` for 3+ dimensional targets (e.g. image segmentation masks) in `Model.fit`. +* Added a new loss, `keras.losses.CategoricalFocalCrossentropy`. +* Remove the `tf.keras.dtensor.experimental.layout_map_scope()`. You can user the `tf.keras.dtensor.experimental.LayoutMap.scope()` instead. + +## Security + +* Fixes correct values rank in UpperBound and LowerBound [CVE-2023-33976](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-33976) + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +103yiran, 8bitmp3, Aakar, Aakar Dwivedi, Abinash Satapathy, Aditya Kane, ag.ramesh, Alexander Grund, Andrei Pikas, andreii, Andrew Goodbody, angerson, Anthony\_256, Ashay Rane, Ashiq Imran, Awsaf, Balint Cristian, Banikumar Maiti (Intel Aipg), Ben Barsdell, bhack, cfRod, Chao Chen, chenchongsong, Chris Mc, Daniil Kutz, David Rubinstein, dianjiaogit, dixr, Dongfeng Yu, dongfengy, drah, Eric Kunze, Feiyue Chen, Frederic Bastien, Gauri1 Deshpande, guozhong.zhuang, hDn248, HYChou, ingkarat, James Hilliard, Jason Furmanek, Jaya, Jens Glaser, Jerry Ge, Jiao Dian'S Power Plant, Jie Fu, Jinzhe Zeng, Jukyy, Kaixi Hou, Kanvi Khanna, Karel Ha, karllessard, Koan-Sin Tan, Konstantin Beluchenko, Kulin Seth, Kun Lu, Kyle Gerard Felker, Leopold Cambier, Lianmin Zheng, linlifan, liuyuanqiang, Lukas Geiger, Luke Hutton, Mahmoud Abuzaina, Manas Mohanty, Mateo Fidabel, Maxiwell S. Garcia, Mayank Raunak, mdfaijul, meatybobby, Meenakshi Venkataraman, Michael Holman, Nathan John Sircombe, Nathan Luehr, nitins17, Om Thakkar, Patrice Vignola, Pavani Majety, per1234, Philipp Hack, pollfly, Prianka Liz Kariat, Rahul Batra, rahulbatra85, ratnam.parikh, Rickard Hallerbäck, Roger Iyengar, Rohit Santhanam, Roman Baranchuk, Sachin Muradi, sanadani, Saoirse Stewart, seanshpark, Shawn Wang, shuw, Srinivasan Narayanamoorthy, Stewart Miles, Sunita Nadampalli, SuryanarayanaY, Takahashi Shuuji, Tatwai Chong, Thibaut Goetghebuer-Planchon, tilakrayal, Tirumalesh, TJ, Tony Sung, Trevor Morris, unda, Vertexwahn, venkat2469, William Muir, Xavier Bonaventura, xiang.zhang, Xiao-Yong Jin, yleeeee, Yong Tang, Yuriy Chernyshov, Zhang, Xiangze, zhaozheng09 diff --git a/corpus/changelog/tensorflow_releases/tensorflow_2140.md b/corpus/changelog/tensorflow_releases/tensorflow_2140.md new file mode 100644 index 0000000000000000000000000000000000000000..87a4535c80ad935530b8a5686ef69d5096d24cac --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_2140.md @@ -0,0 +1,135 @@ +# TensorFlow 2.14.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v2.14.0 +Version: 2.14.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@tensorflow-jenkins](https://avatars.githubusercontent.com/u/16359713?s=40&v=4) +[tensorflow-jenkins](/tensorflow-jenkins) +released this +26 Sep 22:45 + +· +[11 commits](/tensorflow/tensorflow/compare/v2.14.0...r2.14) +to r2.14 +since this release + +[v2.14.0](/tensorflow/tensorflow/tree/v2.14.0) + +[`4dacf3f`](/tensorflow/tensorflow/commit/4dacf3f368eb7965e9b5c3bbdd5193986081c3b2) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 2.14.0 + +## Tensorflow + +### Breaking Changes + +* Support for Python 3.8 has been removed starting with TF 2.14. The TensorFlow 2.13.1 patch release will still have Python 3.8 support. +* `tf.Tensor` + + + The class hierarchy for `tf.Tensor` has changed, and there are now explicit `EagerTensor` and `SymbolicTensor` classes for eager and tf.function respectively. Users who relied on the exact type of Tensor (e.g. `type(t) == tf.Tensor`) will need to update their code to use `isinstance(t, tf.Tensor)`. The `tf.is_symbolic_tensor` helper added in 2.13 may be used when it is necessary to determine if a value is specifically a symbolic tensor. +* `tf.compat.v1.Session` + + + `tf.compat.v1.Session.partial_run` and `tf.compat.v1.Session.partial_run_setup` will be deprecated in the next release. + +### Known Caveats + +* `tf.lite` + + when converter flag "\_experimenal\_use\_buffer\_offset" is enabled, additional metadata is automatically excluded from the generated model. The behaviour is the same as "exclude\_conversion\_metadata" is set + + If the model is larger than 2GB, then we also require "exclude\_conversion\_metadata" flag to be set + +### Major Features and Improvements + +* The `tensorflow` pip package has a new, optional installation method for Linux that installs necessary Nvidia CUDA libraries through pip. As long as the Nvidia driver is already installed on the system, you may now run `pip install tensorflow[and-cuda]` to install TensorFlow's Nvidia CUDA library dependencies in the Python environment. Aside from the Nvidia driver, no other pre-existing Nvidia CUDA packages are necessary. +* Enable JIT-compiled i64-indexed kernels on GPU for large tensors with more than 2\*\*32 elements. + + + Unary GPU kernels: Abs, Atanh, Acos, Acosh, Asin, Asinh, Atan, Cos, Cosh, Sin, Sinh, Tan, Tanh. + + Binary GPU kernels: AddV2, Sub, Div, DivNoNan, Mul, MulNoNan, FloorDiv, Equal, NotEqual, Greater, GreaterEqual, LessEqual, Less. +* `tf.lite` + + + Add experimental supports conversion of models that may be larger than 2GB before buffer deduplication + +### Bug Fixes and Other Changes + +* `tf.py_function` and `tf.numpy_function` can now be used as function decorators for clearer code: + + ```None + @tf.py_function(Tout=tf.float32) + def my_fun(x): + print("This always executes eagerly.") + return x+1 + ``` +* `tf.lite` + + + Strided\_Slice now supports `UINT32`. +* `tf.config.experimental.enable_tensor_float_32_execution` + + + Disabling TensorFloat-32 execution now causes TPUs to use float32 precision for float32 matmuls and other ops. TPUs have always used bfloat16 precision for certain ops, like matmul, when such ops had float32 inputs. Now, disabling TensorFloat-32 by calling `tf.config.experimental.enable_tensor_float_32_execution(False)` will cause TPUs to use float32 precision for such ops instead of bfloat16. +* `tf.experimental.dtensor` + + + API changes for Relayout. Added a new API, `dtensor.relayout_like`, for relayouting a tensor according to the layout of another tensor. + + Added `dtensor.get_default_mesh`, for retrieving the current default mesh under the dtensor context. + + \*fft\* ops now support dtensors with any layout. Fixed bug in 'fft2d/fft3d', 'ifft2d/ifft3d', 'rfft2d/rfft3d', and 'irfft2d/irfft3d' for sharde input. Refer to this [blog post](https://blog.tensorflow.org/2023/08/distributed-fast-fourier-transform-in-tensorflow.html) for details. +* `tf.experimental.strict_mode` + + + Added a new API, `strict_mode`, which converts all deprecation warnings into runtime errors with instructions on switching to a recommended substitute. +* TensorFlow Debugger (tfdbg) CLI: ncurses-based CLI for tfdbg v1 was removed. +* TensorFlow now supports C++ RTTI on mobile and Android. To enable this feature, pass the flag `--define=tf_force_rtti=true` to Bazel when building TensorFlow. This may be needed when linking TensorFlow into RTTI-enabled programs since mixing RTTI and non-RTTI code can cause ABI issues. +* `tf.ones`, `tf.zeros`, `tf.fill`, `tf.ones_like`, `tf.zeros_like` now take an additional Layout argument that controls the output layout of their results. +* `tf.nest` and `tf.data` now support user defined classes implementing `__tf_flatten__` and `__tf_unflatten__` methods. See [nest\_util code examples](https://github.com/tensorflow/tensorflow/blob/04869b4e63bfc03cb13627b3e1b879fdd0f69e34/tensorflow/python/util/nest_util.py#L97) + for an example. +* TensorFlow IO support is now available for Apple Silicon packages. +* Refactor CpuExecutable to propagate LLVM errors. + +## Keras + +Keras is a framework built on top of the TensorFlow. See more details on the Keras [website](https://keras.io/). + +### Major Features and Improvements + +* `tf.keras` + + `Model.compile` now support `steps_per_execution='auto'` as a parameter, allowing automatic tuning of steps per execution during `Model.fit`, + `Model.predict`, and `Model.evaluate` for a significant performance boost. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +Aakar Dwivedi, Adrian Popescu, ag.ramesh, Akhil Goel, Albert Zeyer, Alex Rosen, Alexey Vishnyakov, Andrew Goodbody, angerson, Ashiq Imran, Ayan Moitra, Ben Barsdell, Bhavani Subramanian, Boian Petkantchin, BrianWieder, Chris Mc, cloudhan, Connor Flanagan, Daniel Lang, Daniel Yudelevich, Darya Parygina, David Korczynski, David Svantesson, dingyuqing05, Dragan Mladjenovic, dskkato, Eli Kobrin, Erick Ochoa, Erik Schultheis, Frédéric Bastien, gaikwadrahul8, Gauri1 Deshpande, guozhong.zhuang, H. Vetinari, Isaac Cilia Attard, Jake Hall, Jason Furmanek, Jerry Ge, Jinzhe Zeng, JJ, johnnkp, Jonathan Albrecht, jongkweh, justkw, Kanvi Khanna, kikoxia, Koan-Sin Tan, Kun-Lu, ltsai1, Lu Teng, luliyucoordinate, Mahmoud Abuzaina, mdfaijul, Milos Puzovic, Nathan Luehr, Om Thakkar, pateldeev, Peng Sun, Philipp Hack, pjpratik, Poliorcetics, rahulbatra85, rangjiaheng, Renato Arantes, Robert Kalmar, roho, Rylan Justice, Sachin Muradi, samypr100, Saoirse Stewart, Shanbin Ke, Shivam Mishra, shuw, Song Ziming, Stephan Hartmann, Sulav, sushreebarsa, T Coxon, Tai Ly, talyz, Thibaut Goetghebuer-Planchon, Thomas Preud'Homme, tilakrayal, Tirumalesh, Tj Xu, Tom Allsop, Trevor Morris, Varghese, Jojimon, Wen Chen, Yaohui Liu, Yimei Sun, Zhoulong Jiang, Zhoulong, Jiang diff --git a/corpus/changelog/tensorflow_releases/tensorflow_2150.md b/corpus/changelog/tensorflow_releases/tensorflow_2150.md new file mode 100644 index 0000000000000000000000000000000000000000..b88a5d9a4713e28009734ffc179d36c78e8492fb --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_2150.md @@ -0,0 +1,152 @@ +# TensorFlow 2.15.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v2.15.0 +Version: 2.15.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@tensorflow-jenkins](https://avatars.githubusercontent.com/u/16359713?s=40&v=4) +[tensorflow-jenkins](/tensorflow-jenkins) +released this +14 Nov 18:46 + +· +[12 commits](/tensorflow/tensorflow/compare/v2.15.0...r2.15) +to r2.15 +since this release + +[v2.15.0](/tensorflow/tensorflow/tree/v2.15.0) + +[`6887368`](/tensorflow/tensorflow/commit/6887368d6d46223f460358323c4b76d61d1558a8) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 2.15.0 + +## TensorFlow + +### Breaking Changes + +* `tf.types.experimental.GenericFunction` has been renamed to `tf.types.experimental.PolymorphicFunction`. + +### Major Features and Improvements + +* [oneDNN CPU performance optimizations](https://github.com/tensorflow/community/blob/master/rfcs/20210930-enable-onednn-ops.md) Windows x64 & x86. + + + **Windows x64 & x86 packages:** + - oneDNN optimizations are *enabled by default* on X86 CPUs + + To explicitly enable or disable oneDNN optimizations, set the environment variable `TF_ENABLE_ONEDNN_OPTS` to `1` (enable) or `0` (disable) before running TensorFlow. To fall back to default settings, unset the environment variable. + + oneDNN optimizations can yield slightly different numerical results compared to when oneDNN optimizations are disabled due to floating-point round-off errors from + different computation approaches and orders. + + To verify if oneDNN optimizations are on, look for a message with *"oneDNN custom operations are on"* in the log. If the exact phrase is not there, it means they are off. +* Making the `tf.function` type system fully available: + + + `tf.types.experimental.TraceType` now allows custom tf.function inputs to declare Tensor decomposition and type casting support. + + Introducing `tf.types.experimental.FunctionType` as the comprehensive representation of the signature of `tf.function` callables. It can be accessed through the `function_type` property of `tf.function`s and `ConcreteFunction`s. See the `tf.types.experimental.FunctionType` documentation for more details. +* Introducing `tf.types.experimental.AtomicFunction` as the fastest way to perform TF computations in Python. + + + Can be accessed through `inference_fn` property of `ConcreteFunction`s + + Does not support gradients. + + See `tf.types.experimental.AtomicFunction` documentation for how to call and use it. +* `tf.data`: + + + Moved option `warm_start` from `tf.data.experimental.OptimizationOptions` to `tf.data.Options`. +* `tf.lite`: + + + `sub_op` and `mul_op` support broadcasting up to 6 dimensions. + + The `tflite::SignatureRunner` class, which provides support for named parameters and for multiple named computations within a single TF Lite model, is no longer considered experimental. Likewise for the following signature-related methods of `tflite::Interpreter`: + + - `tflite::Interpreter::GetSignatureRunner` + - `tflite::Interpreter::signature_keys` + - `tflite::Interpreter::signature_inputs` + - `tflite::Interpreter::signature_outputs` + - `tflite::Interpreter::input_tensor_by_signature` + - `tflite::Interpreter::output_tensor_by_signature` + + Similarly, the following signature runner functions in the TF Lite C API are no longer considered experimental: + + - `TfLiteInterpreterGetSignatureCount` + - `TfLiteInterpreterGetSignatureKey` + - `TfLiteInterpreterGetSignatureRunner` + - `TfLiteSignatureRunnerAllocateTensors` + - `TfLiteSignatureRunnerGetInputCount` + - `TfLiteSignatureRunnerGetInputName` + - `TfLiteSignatureRunnerGetInputTensor` + - `TfLiteSignatureRunnerGetOutputCount` + - `TfLiteSignatureRunnerGetOutputName` + - `TfLiteSignatureRunnerGetOutputTensor` + - `TfLiteSignatureRunnerInvoke` + - `TfLiteSignatureRunnerResizeInputTensor` + + New C API function `TfLiteExtensionApisVersion` added to `tensorflow/lite/c/c_api.h`. + + Add int8 and int16x8 support for RSQRT operator +* Android NDK r25 is supported. + +### Bug Fixes and Other Changes + +* Add TensorFlow Quantizer to TensorFlow pip package. +* `tf.sparse.segment_sum` `tf.sparse.segment_mean` `tf.sparse.segment_sqrt_n` `SparseSegmentSum/Mean/SqrtN[WithNumSegments]` + + + Added `sparse_gradient` option (default=false) that makes the gradient of these functions/ops sparse (`IndexedSlices`) instead of dense (`Tensor`), using new `SparseSegmentSum/Mean/SqrtNGradV2` ops. +* `tf.nn.embedding_lookup_sparse` + + + Optimized this function for some cases by fusing internal operations. +* `tf.saved_model.SaveOptions` + + + Provided a new `experimental_skip_saver` argument which, if specified, will suppress the addition of `SavedModel`-native save and restore ops to the `SavedModel`, for cases where users already build custom save/restore ops and checkpoint formats for the model being saved, and the creation of the SavedModel-native save/restore ops simply cause longer model serialization times. +* Add ops to `tensorflow.raw_ops` that were missing. +* `tf.CheckpointOptions` + + + It now takes in a new argument called `experimental_write_callbacks`. These are callbacks that will be executed after a saving event finishes writing the checkpoint file. +* Add an option `disable_eager_executer_streaming_enqueue` to `tensorflow.ConfigProto.Experimental` to control the eager runtime's behavior around parallel remote function invocations; when set to `True`, the eager runtime will be allowed to execute multiple function invocations in parallel. +* `tf.constant_initializer` + + + It now takes a new argument called `support_partition`. If True, constant\_initializers can create sharded variables. This is disabled by default, similar to existing behavior. +* `tf.lite` + + + Added support for `stablehlo.scatter`. +* `tf.estimator` + + + The tf.estimator API removal is in progress and will be targeted for the 2.16 release. + +## Keras + +* This will be the final release before the launch of Keras 3.0, when Keras will become multi-backend. For the compatibility page and other info, please see: + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +Aiden Grossman, Akash Patel, Akhil Goel, Alexander Pivovarov, Andrew Goodbody, Ayan Moitra, Ben Barsdell, Ben Olson, Bhavani Subramanian, Boian Petkantchin, Bruce Lai, Chao Chen, Christian Steinmeyer, cjflan, David Korczynski, Donghak Park, Dragan Mladjenovic, Eli Kobrin, Fadi Arafeh, Feiyue Chen, Frédéric Bastien, guozhong.zhuang, halseycamilla, Harshavardhan Bellamkonda, James Ward, jameshollyer, Jane Liu, johnnkp, jswag180, justkw, Kanvi Khanna, Keith Smiley, Koan-Sin Tan, Kulin Seth, Kun-Lu, kushanam, Lu Teng, mdfaijul, Mehdi Drissi, mgokulkrish, mraunak, Mustafa Uzun, Namrata Bhave, Pavel Emeliyanenko, pemeliya, Peng Sun, Philipp Hack, Pratik Joshi, Rahul Batra, Raunak, redwrasse, Saoirse Stewart, SaoirseARM, seanshpark, Shanbin Ke, Spenser Bauman, Surya, sushreebarsa, Tai Ly, Thibaut Goetghebuer-Planchon, tilakrayal, Tirumalesh, Tj Xu, Vladislav, weihanmines, Wen Chen, wenchenvincent, wenscarl, William Muir, Zhoulong, Jiang diff --git a/corpus/changelog/tensorflow_releases/tensorflow_2170.md b/corpus/changelog/tensorflow_releases/tensorflow_2170.md new file mode 100644 index 0000000000000000000000000000000000000000..e0f6bca5d67650c7a861bf15c1e338ee5103551a --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_2170.md @@ -0,0 +1,100 @@ +# TensorFlow 2.17.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v2.17.0 +Version: 2.17.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@tensorflow-jenkins](https://avatars.githubusercontent.com/u/16359713?s=40&v=4) +[tensorflow-jenkins](/tensorflow-jenkins) +released this +11 Jul 16:28 + +· +[19 commits](/tensorflow/tensorflow/compare/v2.17.0...r2.17) +to r2.17 +since this release + +[v2.17.0](/tensorflow/tensorflow/tree/v2.17.0) + +[`ad6d8cc`](/tensorflow/tensorflow/commit/ad6d8cc177d0c868982e39e0823d0efbfb95f04c) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. + +GPG key ID: B5690EEEBB952194 + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 2.17.0 + +## TensorFlow + +### Breaking Changes + +* GPU + + Support for NVIDIA GPUs with compute capability 5.x (Maxwell generation) has been removed from TF binary distributions (Python wheels). + +### Major Features and Improvements + +* Add `is_cpu_target_available`, which indicates whether or not TensorFlow was built with support for a given CPU target. This can be useful for skipping target-specific tests if a target is not supported. +* `tf.data` + + + Support `data.experimental.distribued_save`. `distribued_save` uses tf.data service () to write distributed dataset snapshots. The call is non-blocking and returns without waiting for the snapshot to finish. Setting `wait=True` to `tf.data.Dataset.load` allows the snapshots to be read while they are being written. + +### Bug Fixes and Other Changes + +* GPU + + + Support for NVIDIA GPUs with compute capability 8.9 (e.g. L4 & L40) has been added to TF binary distributions (Python wheels). +* Replace `DebuggerOptions` of TensorFlow Quantizer, and migrate to `DebuggerConfig` of StableHLO Quantizer. +* Add TensorFlow to StableHLO converter to TensorFlow pip package. +* TensorRT support: this is the last release supporting TensorRT. It will be removed in the next release. +* NumPy 2.0 support: TensorFlow is going to support NumPy 2.0 in the next release. It may break some edge cases of TensorFlow API usage. +* `tf.lite` + + + Quantization for `FullyConnected` layer is switched from per-tensor to per-channel scales for dynamic range quantization use case (`float32` inputs / outputs and `int8` weights). The change enables new quantization schema globally in the converter and inference engine. The new behaviour can be disabled via experimental flag `converter._experimental_disable_per_channel_quantization_for_dense_layers = True`. + + C API: + - The experimental `TfLiteRegistrationExternal` type has been renamed as `TfLiteOperator`, and likewise for the corresponding API functions. + + The Python TF Lite Interpreter bindings now have an option `experimental_default_delegate_latest_features` to enable all default delegate features. + + Flatbuffer version update: + - `GetTemporaryPointer()` bug fixed. +* `tf.data` + + + Add `wait` to `tf.data.Dataset.load`. If `True`, for snapshots written with `distributed_save`, it reads the snapshot while it is being written. For snapshots written with regular `save`, it waits for the snapshot until it's finished. The default is `False` for backward compatibility. Users of `distributed_save` are recommended to set it to `True`. +* `tf.tpu.experimental.embedding.TPUEmbeddingV2` + + + Add `compute_sparse_core_stats` for sparse core users to profile the data with this API to get the `max_ids` and `max_unique_ids`. These numbers will be needed to configure the sparse core embedding mid level api. + + Remove the `preprocess_features` method since that's no longer needed. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +Abdulaziz Aloqeely, Ahmad-M-Al-Khateeb, Akhil Goel, akhilgoe, Alexander Pivovarov, Amir Samani, Andrew Goodbody, Andrey Portnoy, Ashiq Imran, Ben Olson, Chao, Chase Riley Roberts, Clemens Giuliani, dependabot[bot], Dimitris Vardoulakis, Dragan Mladjenovic, ekuznetsov139, Elfie Guo, Faijul Amin, Gauri1 Deshpande, Georg Stefan Schmid, guozhong.zhuang, Hao Wu, Haoyu (Daniel), Harsha H S, Harsha Hs, Harshit Monish, Ilia Sergachev, Jane Liu, Jaroslav Sevcik, Jinzhe Zeng, Justin Dhillon, Kaixi Hou, Kanvi Khanna, LakshmiKalaKadali, Learning-To-Play, lingzhi98, Lu Teng, Matt Bahr, Max Ren, Meekail Zain, Mmakevic-Amd, mraunak, neverlva, nhatle, Nicola Ferralis, Olli Lupton, Om Thakkar, orangekame3, ourfor, pateldeev, Pearu Peterson, pemeliya, Peng Sun, Philipp Hack, Pratik Joshi, prrathi, rahulbatra85, Raunak, redwrasse, Robert Kalmar, Robin Zhang, RoboSchmied, Ruturaj Vaidya, sachinmuradi, Shawn Wang, Sheng Yang, Surya, Thibaut Goetghebuer-Planchon, Thomas Preud'Homme, tilakrayal, Tj Xu, Trevor Morris, wenchenvincent, Yimei Sun, zahiqbal, Zhu Jianjiang, Zoranjovanovic-Ns diff --git a/corpus/changelog/tensorflow_releases/tensorflow_220.md b/corpus/changelog/tensorflow_releases/tensorflow_220.md new file mode 100644 index 0000000000000000000000000000000000000000..39c5f71dfda386d064fdc9f9e0d7d993051e2950 --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_220.md @@ -0,0 +1,189 @@ +# TensorFlow 2.2.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v2.2.0 +Version: 2.2.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@tensorflow-jenkins](https://avatars.githubusercontent.com/u/16359713?s=40&v=4) +[tensorflow-jenkins](/tensorflow-jenkins) +released this +06 May 19:14 + +· +[338 commits](/tensorflow/tensorflow/compare/v2.2.0...r2.2) +to r2.2 +since this release + +[v2.2.0](/tensorflow/tensorflow/tree/v2.2.0) + +[`2b96f36`](/tensorflow/tensorflow/commit/2b96f3662bd776e277f86997659e61046b56c315) + +# Release 2.2.0 + +TensorFlow 2.2 discontinues support for Python 2, [previously announced](https://groups.google.com/a/tensorflow.org/d/msg/announce/gVwS5RC8mds/dCt1ka2XAAAJ) as following [Python 2's EOL on January 1, 2020](https://www.python.org/dev/peps/pep-0373/#update). + +Coinciding with this change, new releases of [TensorFlow's Docker images](https://hub.docker.com/r/tensorflow/tensorflow/) provide Python 3 exclusively. Because all images now use Python 3, Docker tags containing `-py3` will no longer be provided and existing `-py3` tags like `latest-py3` will not be updated. + +## Major Features and Improvements + +* Replaced the scalar type for string tensors from `std::string` to `tensorflow::tstring` which is now ABI stable. +* A new Profiler for TF 2 for CPU/GPU/TPU. It offers both device and host performance analysis, including input pipeline and TF Ops. Optimization advisory is provided whenever possible. Please see [this tutorial](https://www.tensorflow.org/tensorboard/tensorboard_profiling_keras) and [guide](https://www.tensorflow.org/guide/profiler) for usage guidelines. +* Export C++ functions to Python using `pybind11` as opposed to `SWIG` as a part of our [deprecation of swig efforts](https://github.com/tensorflow/community/blob/master/rfcs/20190208-pybind11.md). +* `tf.distribute`: + + + Support added for global sync `BatchNormalization` by using the newly added `tf.keras.layers.experimental.SyncBatchNormalization` layer. This layer will sync `BatchNormalization` statistics every step across all replicas taking part in sync training. + + Performance improvements for GPU multi-worker distributed training using `tf.distribute.experimental.MultiWorkerMirroredStrategy` + - Update NVIDIA `NCCL` to `2.5.7-1` for better performance and performance tuning. Please see [nccl developer guide](https://docs.nvidia.com/deeplearning/sdk/nccl-developer-guide/docs/env.html) for more information on this. + - Support gradient `allreduce` in `float16`. See this [example](https://github.com/tensorflow/models/blob/master/official/staging/training/grad_utils.py) usage. + - Experimental support of [all reduce gradient packing](https://www.tensorflow.org/api_docs/python/tf/distribute/experimental/CollectiveHints) to allow overlapping gradient aggregation with backward path computation. + - Deprecated `experimental_run_v2` method for distribution strategies and renamed the method `run` as it is no longer experimental. + - Add CompositeTensor support for DistributedIterators. This should help prevent unnecessary function retracing and memory leaks. +* `tf.keras`: + + + `Model.fit` major improvements: + - You can now use custom training logic with `Model.fit` by overriding `Model.train_step`. + - Easily write state-of-the-art training loops without worrying about all of the features `Model.fit` handles for you (distribution strategies, callbacks, data formats, looping logic, etc) + - See the default [`Model.train_step`](https://github.com/tensorflow/tensorflow/blob/1381fc8e15e22402417b98e3881dfd409998daea/tensorflow/python/keras/engine/training.py#L540) for an example of what this function should look like. Same applies for validation and inference via `Model.test_step` and `Model.predict_step`. + - SavedModel uses its own `Model._saved_model_inputs_spec` attr now instead of + relying on `Model.inputs` and `Model.input_names`, which are no longer set for subclass Models. + This attr is set in eager, `tf.function`, and graph modes. This gets rid of the need for users to + manually call `Model._set_inputs` when using Custom Training Loops(CTLs). + - Dynamic shapes are supported for generators by calling the Model on the first batch we "peek" from the generator. + This used to happen implicitly in `Model._standardize_user_data`. Long-term, a solution where the + `DataAdapter` doesn't need to call the Model is probably preferable. + + The SavedModel format now supports all Keras built-in layers (including metrics, preprocessing layers, and stateful RNN layers) + + Update Keras batch normalization layer to use the running mean and average computation in the `fused_batch_norm`. You should see significant performance improvements when using `fused_batch_norm` in Eager mode. +* `tf.lite`: + + + Enable TFLite experimental new converter by default. +* XLA + + + XLA now builds and works on windows. All prebuilt packages come with XLA available. + + XLA can be [enabled for a `tf.function`](https://www.tensorflow.org/xla#explicit_compilation_with_tffunction) with “compile or throw exception” semantics on CPU and GPU. + +## Breaking Changes + +* `tf.keras`: + + In `tf.keras.applications` the name of the "top" layer has been standardized to "predictions". This is only a problem if your code relies on the exact name of the layer. + + Huber loss function has been updated to be consistent with other Keras losses. It now computes mean over the last axis of per-sample losses before applying the reduction function. +* AutoGraph no longer converts functions passed to `tf.py_function`, `tf.py_func` and `tf.numpy_function`. +* Deprecating `XLA_CPU` and `XLA_GPU` devices with this release. +* Increasing the minimum bazel version to build TF to 2.0.0 to use Bazel's `cc_experimental_shared_library`. +* Keras compile/fit behavior for functional and subclassed models have been unified. Model properties such as `metrics`, `metrics_names` will now be available only after **training/evaluating the model on actual data** for functional models. `metrics` will **now include** model `loss` and output losses.`loss_functions` property has been removed from the model. This was an undocumented property that was accidentally public and has now been removed. + +## Known Caveats + +* The current TensorFlow release now **requires** [gast](https://pypi.org/project/gast/) version 0.3.3. + +## Bug Fixes and Other Changes + +* `tf.data`: + + Removed `autotune_algorithm` from experimental optimization options. +* TF Core: + + `tf.constant` always creates CPU tensors irrespective of the current device context. + + Eager `TensorHandles` maintain a list of mirrors for any copies to local or remote devices. This avoids any redundant copies due to op execution. + + For `tf.Tensor` & `tf.Variable`, `.experimental_ref()` is no longer experimental and is available as simply `.ref()`. + + `pfor/vectorized_map`: Added support for vectorizing 56 more ops. Vectorizing `tf.cond` is also supported now. + + Set as much partial shape as we can infer statically within the gradient impl of the gather op. + + Gradient of `tf.while_loop` emits `StatelessWhile` op if `cond` and body functions are stateless. This allows multiple gradients while ops to run in parallel under distribution strategy. + + Speed up `GradientTape` in eager mode by auto-generating list of op inputs/outputs which are unused and hence not cached for gradient functions. + + Support `back_prop=False` in `while_v2` but mark it as deprecated. + + Improve error message when attempting to use `None` in data-dependent control flow. + + Add `RaggedTensor.numpy()`. + + Update `RaggedTensor.__getitem__` to preserve uniform dimensions & allow indexing into uniform dimensions. + + Update `tf.expand_dims` to always insert the new dimension as a non-ragged dimension. + + Update `tf.embedding_lookup` to use `partition_strategy` and `max_norm` when `ids` is ragged. + + Allow `batch_dims==rank(indices)` in `tf.gather`. + + Add support for bfloat16 in `tf.print`. +* `tf.distribute`: + + Support `embedding_column` with variable-length input features for `MultiWorkerMirroredStrategy`. +* `tf.keras`: + + Added `experimental_aggregate_gradients` argument to `tf.keras.optimizer.Optimizer.apply_gradients`. This allows custom gradient aggregation and processing aggregated gradients in custom training loop. + + Allow `pathlib.Path` paths for loading models via Keras API. +* `tf.function`/AutoGraph: + + AutoGraph is now available in `ReplicaContext.merge_call`, `Strategy.extended.update` and `Strategy.extended.update_non_slot`. + + Experimental support for shape invariants has been enabled in `tf.function`. See the API docs for `tf.autograph.experimental.set_loop_options` for additonal info. + + AutoGraph error messages now exclude frames corresponding to APIs internal to AutoGraph. + + Improve shape inference for `tf.function` input arguments to unlock more Grappler optimizations in TensorFlow 2.x. + + Improve automatic control dependency management of resources by allowing resource reads to occur in parallel and synchronizing only on writes. + + Fix execution order of multiple stateful calls to `experimental_run_v2` in `tf.function`. + + You can now iterate over `RaggedTensors` using a for loop inside `tf.function`. +* `tf.lite`: + + Migrated the `tf.lite` C inference API out of experimental into lite/c. + + Add an option to disallow `NNAPI` CPU / partial acceleration on Android 10 + + TFLite Android AARs now include the C headers and APIs are required to use TFLite from native code. + + Refactors the delegate and delegate kernel sources to allow usage in the linter. + + Limit delegated ops to actually supported ones if a device name is specified or `NNAPI` CPU Fallback is disabled. + + TFLite now supports `tf.math.reciprocal1` op by lowering to `tf.div op`. + + TFLite's unpack op now supports boolean tensor inputs. + + Microcontroller and embedded code moved from experimental to main TensorFlow Lite folder + + Check for large TFLite tensors. + + Fix GPU delegate crash with C++17. + + Add 5D support to TFLite `strided_slice`. + + Fix error in delegation of `DEPTH_TO_SPACE` to `NNAPI` causing op not to be accelerated. + + Fix segmentation fault when running a model with LSTM nodes using `NNAPI` Delegate + + Fix `NNAPI` delegate failure when an operand for Maximum/Minimum operation is a scalar. + + Fix `NNAPI` delegate failure when Axis input for reduce operation is a scalar. + + Expose option to limit the number of partitions that will be delegated to `NNAPI`. + + If a target accelerator is specified, use its feature level to determine operations to delegate instead of SDK version. +* `tf.random`: + + Various random number generation improvements: + - Add a fast path for default `random_uniform` + - `random_seed` documentation improvement. + - `RandomBinomial` broadcasts and appends the sample shape to the left rather than the right. + + Added `tf.random.stateless_binomial`, `tf.random.stateless_gamma`, `tf.random.stateless_poisson` + + `tf.random.stateless_uniform` now supports unbounded sampling of `int` types. +* Math and Linear Algebra: + + Add `tf.linalg.LinearOperatorTridiag`. + + Add `LinearOperatorBlockLowerTriangular` + + Add broadcasting support to tf.linalg.triangular\_solve[#26204](https://github.com/tensorflow/tensorflow/issues/26204), tf.math.invert\_permutation. + + Add `tf.math.sobol_sample` op. + + Add `tf.math.xlog1py`. + + Add `tf.math.special.{dawsn,expi,fresnel_cos,fresnel_sin,spence}`. + + Add a Modified Discrete Cosine Transform (MDCT) and its inverse to `tf.signal`. +* TPU Enhancements: + + Refactor `TpuClusterResolver` to move shared logic to a separate pip package. + + Support configuring TPU software version from cloud tpu client. + + Allowed TPU embedding weight decay factor to be multiplied by learning rate. +* XLA Support: + + Add standalone XLA AOT runtime target + relevant .cc sources to pip package. + + Add check for memory alignment to MemoryAllocation::MemoryAllocation() on 32-bit ARM. This ensures a deterministic early exit instead of a hard to debug bus error later. + + `saved_model_cli aot_compile_cpu` allows you to compile saved models to XLA header+object files and include them in your C++ programs. + + Enable `Igamma`, `Igammac` for XLA. +* Deterministic Op Functionality: + + XLA reduction emitter is deterministic when the environment variable `TF_DETERMINISTIC_OPS` is set to "true" or "1". This extends deterministic `tf.nn.bias_add` back-prop functionality (and therefore also deterministic back-prop of bias-addition in Keras layers) to include when XLA JIT complilation is enabled. + + Fix problem, when running on a CUDA GPU and when either environment variable `TF_DETERMINSTIC_OPS` or environment variable `TF_CUDNN_DETERMINISTIC` is set to "true" or "1", in which some layer configurations led to an exception with the message "No algorithm worked!" +* Tracing and Debugging: + + Add source, destination name to `_send` traceme to allow easier debugging. + + Add traceme event to `fastpathexecute`. +* Other: + + Fix an issue with AUC.reset\_states for multi-label AUC [#35852](https://github.com/tensorflow/tensorflow/issues/35852) + + Fix the TF upgrade script to not delete files when there is a parsing error and the output mode is `in-place`. + + Move `tensorflow/core:framework/*_pyclif` rules to `tensorflow/core/framework:*_pyclif`. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +372046933, 8bitmp3, aaronhma, Abin Shahab, Aditya Patwardhan, Agoniii, Ahti Kitsik, Alan Yee, Albin Joy, Alex Hoffman, Alexander Grund, Alexandre E. Eichenberger, Amit Kumar Jaiswal, amoitra, Andrew Anderson, Angus-Luo, Anthony Barbier, Anton Kachatkou, Anuj Rawat, archis, Arpan-Dhatt, Arvind Sundararajan, Ashutosh Hathidara, autoih, Bairen Yi, Balint Cristian, Bas Aarts, BashirSbaiti, Basit Ayantunde, Ben Barsdell, Benjamin Gaillard, boron, Brett Koonce, Bryan Cutler, Christian Goll, Christian Sachs, Clayne Robison, comet, Daniel Falbel, Daria Zhuravleva, darsh8200, David Truby, Dayananda-V, deepakm, Denis Khalikov, Devansh Singh, Dheeraj R Reddy, Diederik Van Liere, Diego Caballero, Dominic Jack, dothinking, Douman, Drake Gens, Duncan Riach, Ehsan Toosi, ekuznetsov139, Elena Zhelezina, elzino, Ending2015a, Eric Schweitz, Erik Zettel, Ethan Saadia, Eugene Kuznetsov, Evgeniy Zheltonozhskiy, Ewout Ter Hoeven, exfalso, FAIJUL, Fangjun Kuang, Fei Hu, Frank Laub, Frederic Bastien, Fredrik Knutsson, frreiss, Frédéric Rechtenstein, fsx950223, Gaurav Singh, gbaned, George Grzegorz Pawelczak, George Sterpu, Gian Marco Iodice, Giorgio Arena, Hans Gaiser, Hans Pabst, Haoyu Wu, Harry Slatyer, hsahovic, Hugo, Hugo Sjöberg, IrinaM21, jacco, Jake Tae, Jean-Denis Lesage, Jean-Michel Gorius, Jeff Daily, Jens Elofsson, Jerry Shih, jerryyin, Jin Mingjian, Jinjing Zhou, JKIsaacLee, jojimonv, Jonathan Dekhtiar, Jose Ignacio Gomez, Joseph-Rance, Judd, Julian Gross, Kaixi Hou, Kaustubh Maske Patil, Keunwoo Choi, Kevin Hanselman, Khor Chean Wei, Kilaru Yasaswi Sri Chandra Gandhi, Koan-Sin Tan, Koki Ibukuro, Kristian Holsheimer, kurileo, Lakshay Tokas, Lee Netherton, leike666666, Leslie-Fang-Intel, Li, Guizi, LIUJIAN435, Lukas Geiger, Lyo Nguyen, madisetti, Maher Jendoubi, Mahmoud Abuzaina, Manuel Freiberger, Marcel Koester, Marco Jacopo Ferrarotti, Markus Franke, marload, Mbah-Javis, mbhuiyan, Meng Zhang, Michael Liao, MichaelKonobeev, Michal Tarnowski, Milan Straka, minoring, Mohamed Nour Abouelseoud, MoussaMM, Mrinal Jain, mrTsjolder, Måns Nilsson, Namrata Bhave, Nicholas Gao, Niels Ole Salscheider, nikochiko, Niranjan Hasabnis, Nishidha Panpaliya, nmostafa, Noah Trenaman, nuka137, Officium, Owen L - Sfe, Pallavi G, Paul Andrey, Peng Sun, Peng Wu, Phil Pearl, PhilipMay, pingsutw, Pooya Davoodi, PragmaTwice, pshiko, Qwerty71, R Gomathi, Rahul Huilgol, Richard Xiao, Rick Wierenga, Roberto Rosmaninho, ruchit2801, Rushabh Vasani, Sami, Sana Damani, Sarvesh Dubey, Sasan Jafarnejad, Sergii Khomenko, Shane Smiskol, Shaochen Shi, sharkdtu, Shawn Presser, ShengYang1, Shreyash Patodia, Shyam Sundar Dhanabalan, Siju Samuel, Somyajit Chakraborty Sam, Srihari Humbarwadi, srinivasan.narayanamoorthy, Srishti Yadav, Steph-En-M, Stephan Uphoff, Stephen Mugisha, SumanSudhir, Taehun Kim, Tamas Bela Feher, TengLu, Tetragramm, Thierry Herrmann, Tian Jin, tigertang, Tom Carchrae, Tom Forbes, Trent Lo, Victor Peng, vijayphoenix, Vincent Abriou, Vishal Bhola, Vishnuvardhan Janapati, vladbataev, VoVAllen, Wallyss Lima, Wen-Heng (Jack) Chung, wenxizhu, William D. Irons, William Zhang, Xiaoming (Jason) Cui, Xiaoquan Kong, Xinan Jiang, Yasir Modak, Yasuhiro Matsumoto, Yaxun (Sam) Liu, Yong Tang, Ytyt-Yt, yuan, Yuan Mingshuai, Yuan Tang, Yuki Ueda, Yusup, zhangshijin, zhuwenxi diff --git a/corpus/changelog/tensorflow_releases/tensorflow_230.md b/corpus/changelog/tensorflow_releases/tensorflow_230.md new file mode 100644 index 0000000000000000000000000000000000000000..b9ddb5e62b0b2a5c30c47a99bec6772bac8d296f --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_230.md @@ -0,0 +1,267 @@ +# TensorFlow 2.3.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v2.3.0 +Version: 2.3.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@tensorflow-jenkins](https://avatars.githubusercontent.com/u/16359713?s=40&v=4) +[tensorflow-jenkins](/tensorflow-jenkins) +released this +27 Jul 18:37 + +· +[479 commits](/tensorflow/tensorflow/compare/v2.3.0...r2.3) +to r2.3 +since this release + +[v2.3.0](/tensorflow/tensorflow/tree/v2.3.0) + +[`b36436b`](/tensorflow/tensorflow/commit/b36436b087bd8e8701ef51718179037cccdfc26e) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 2.3.0 + +## Major Features and Improvements + +* `tf.data` adds two new mechanisms to solve input pipeline bottlenecks and save resources: + + [snapshot](https://www.tensorflow.org/api_docs/python/tf/data/experimental/snapshot) + + [tf.data service](https://www.tensorflow.org/api_docs/python/tf/data/experimental/service). + +In addition checkout the detailed [guide](https://www.tensorflow.org/guide/data_performance_analysis) for analyzing input pipeline performance with TF Profiler. + +* [`tf.distribute.TPUStrategy`](https://www.tensorflow.org/api_docs/python/tf/distribute/TPUStrategy) is now a stable API and no longer considered experimental for TensorFlow. (earlier `tf.distribute.experimental.TPUStrategy`). +* [TF Profiler](https://www.tensorflow.org/guide/profiler) introduces two new tools: a memory profiler to visualize your model’s memory usage over time and a [python tracer](https://www.tensorflow.org/guide/profiler#events) which allows you to trace python function calls in your model. Usability improvements include better diagnostic messages and [profile options](https://tensorflow.org/guide/profiler#collect_performance_data) to customize the host and device trace verbosity level. +* Introduces experimental support for Keras Preprocessing Layers API ([`tf.keras.layers.experimental.preprocessing.*`](https://www.tensorflow.org/api_docs/python/tf/keras/layers/experimental/preprocessing?version=nightly)) to handle data preprocessing operations, with support for composite tensor inputs. Please see below for additional details on these layers. +* TFLite now properly supports dynamic shapes during conversion and inference. We’ve also added opt-in support on Android and iOS for [XNNPACK](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/delegates/xnnpack), a highly optimized set of CPU kernels, as well as opt-in support for [executing quantized models on the GPU](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/g3doc/performance/gpu_advanced.md#running-quantized-models-experimental). +* Libtensorflow packages are available in GCS starting this release. We have also started to [release a nightly version of these packages](https://github.com/tensorflow/tensorflow#official-builds). +* The experimental Python API [`tf.debugging.experimental.enable_dump_debug_info()`](https://www.tensorflow.org/api_docs/python/tf/debugging/experimental/enable_dump_debug_info) now allows you to instrument a TensorFlow program and dump debugging information to a directory on the file system. The directory can be read and visualized by a new interactive dashboard in TensorBoard 2.3 called [Debugger V2](https://www.tensorflow.org/tensorboard/debugger_v2), which reveals the details of the TensorFlow program including graph structures, history of op executions at the Python (eager) and intra-graph levels, the runtime dtype, shape, and numerical composistion of tensors, as well as their code locations. + +## Breaking Changes + +* Increases the **minimum bazel version** required to build TF to **3.1.0**. +* `tf.data` + + Makes the following (breaking) changes to the `tf.data`. + + C++ API: - `IteratorBase::RestoreInternal`, `IteratorBase::SaveInternal`, and `DatasetBase::CheckExternalState` become pure-virtual and subclasses are now expected to provide an implementation. + + The deprecated `DatasetBase::IsStateful` method is removed in favor of `DatasetBase::CheckExternalState`. + + Deprecated overrides of `DatasetBase::MakeIterator` and `MakeIteratorFromInputElement` are removed. + + The signature of `tensorflow::data::IteratorBase::SaveInternal` and `tensorflow::data::IteratorBase::SaveInput` has been extended with `SerializationContext` argument to enable overriding the default policy for the handling external state during iterator checkpointing. This is not a backwards compatible change and all subclasses of `IteratorBase` *need to be updated* accordingly. +* `tf.keras` + + Add a new `BackupAndRestore` callback for handling distributed training failures & restarts. Please take a look at this [tutorial](https://www.tensorflow.org/tutorials/distribute/multi_worker_with_keras) for details on how to use the callback. +* `tf.image.extract_glimpse` has been updated to correctly process the case + where `centered=False` and `normalized=False`. This is a breaking change as + the output is different from (incorrect) previous versions. Note this + breaking change only impacts `tf.image.extract_glimpse` and + `tf.compat.v2.image.extract_glimpse` API endpoints. The behavior of + `tf.compat.v1.image.extract_glimpse` does not change. The behavior of + exsiting C++ kernel `ExtractGlimpse` does not change either, so saved + models using `tf.raw_ops.ExtractGlimpse` will not be impacted. + +## Known Caveats + +* `tf.lite` + + Keras-based LSTM models must be converted with an explicit batch size in the input layer. + +## Bug Fixes and Other Changes + +### TF Core: + +* Set `tf2_behavior` to 1 to enable V2 for early loading cases. +* Add `execute_fn_for_device function` to dynamically choose the implementation based on underlying device placement. +* Eager: + + Add `reduce_logsumexp` benchmark with experiment compile. + + Give `EagerTensor`s a meaningful `__array__` implementation. + + Add another version of defun matmul for performance analysis. +* `tf.function`/AutoGraph: + + `AutoGraph` now includes into TensorFlow loops any variables that are closed over by local functions. Previously, such variables were sometimes incorrectly ignored. + + functions returned by the `get_concrete_function` method of `tf.function` objects can now be called with arguments consistent with the original arguments or type specs passed to `get_concrete_function`. This calling convention is now the preferred way to use concrete functions with nested values and composite tensors. Please check the [guide](https://www.tensorflow.org/guide/concrete_function) for more details on `concrete_ function`. + + Update `tf.function`'s `experimental_relax_shapes` to handle composite tensors appropriately. + + Optimize `tf.function` invocation, by removing redundant list converter. + + `tf.function` will retrace when called with a different variable instead of simply using the `dtype` & `shape`. + + [Improve support](https://github.com/tensorflow/tensorflow/issues/33862) for dynamically-sized TensorArray inside `tf.function`. +* `tf.math`: + + Narrow down `argmin`/`argmax` contract to always return the smallest index for ties. + + `tf.math.reduce_variance` and `tf.math.reduce_std` return correct computation for complex types and no longer support integer types. + + Add Bessel functions of order 0,1 to `tf.math.special`. + + `tf.divide` now always returns a tensor to be consistent with documentation and other APIs. +* `tf.image`: + + Replaced [`tf.image.non_max_suppression_padded`](https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/image/non_max_suppression_padded?hl=en) with a new implementation that supports batched inputs, which is considerably faster on TPUs and GPUs. Boxes with area=0 will be ignored. Existing usage with single inputs should still work as before. +* `tf.linalg` + + Add `tf.linalg.banded_triangular_solve`. +* `tf.random`: + + Add `tf.random.stateless_parameterized_truncated_normal`. +* `tf.ragged`: + + Add `tf.ragged.cross` and `tf.ragged.cross_hashed` operations. +* `tf.RaggedTensor`: + + `RaggedTensor.to_tensor()` now preserves static shape. + + Add `tf.strings.format()` and `tf.print()` to support RaggedTensors. +* `tf.saved_model`: + + `@tf.function` from SavedModel no longer ignores args after a `RaggedTensor` when selecting the concrete function to run. + + Fix save model issue for ops with a list of functions. + + Add `tf.saved_model.LoadOptions` with [`experimental_io_device`](https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/saved_model/LoadOptions?hl=en) as arg with default value `None` to choose the I/O device for loading models and weights. + + Update `tf.saved_model.SaveOptions` with [`experimental_io_device`](https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/saved_model/SaveOptions?hl=en) as arg with default value `None` to choose the I/O device for saving models and weights. + + Mutable tables now restore checkpointed values when loaded from SavedModel. +* GPU + + TF 2.3 includes PTX kernels only for [compute capability](https://developer.nvidia.com/cuda-gpus) 7.0 to reduce the TF pip binary size. Earlier releases included PTX for a variety of older compute capabilities. +* Others + + Retain parent namescope for ops added inside `tf.while_loop`/`tf.cond`/`tf.switch_case`. + + Update `tf.vectorized_map` to support vectorizing `tf.while_loop` and TensorList operations. + + `tf.custom_gradient` can now be applied to functions that accept nested structures of `tensors` as inputs (instead of just a list of tensors). Note that Python structures such as tuples and lists now won't be treated as tensors, so if you still want them to be treated that way, you need to wrap them with `tf.convert_to_tensor`. + + No lowering on gradient case op when input is `DeviceIndex` op. + + Extend the ragged version of `tf.gather` to support `batch_dims` and `axis` args. + + Update `tf.map_fn` to support RaggedTensors and SparseTensors. + + Deprecate `tf.group`. It is not useful in eager mode. + + Add CPU and GPU implementation of modified variation of [`FTRL`](https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/raw_ops/ApplyFtrl)/[`FTRLV2`](https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/raw_ops/ApplyFtrlV2) that can triggerred by `multiply_linear_by_lr` allowing a learning rate of zero. + +### `tf.data`: + +* `tf.data.experimental.dense_to_ragged_batch` works correctly with tuples. +* `tf.data.experimental.dense_to_ragged_batch` to output variable ragged rank. +* `tf.data.experimental.cardinality` is now a method on `tf.data.Dataset`. +* `tf.data.Dataset` now supports `len(Dataset)` when the cardinality is finite. + +### `tf.distribute`: + +* Expose experimental [`tf.distribute.DistributedDataset`](https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/distribute/DistributedDataset?hl=en) and [`tf.distribute.DistributedIterator`](https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/distribute/DistributedIterator) to distribute input data when using `tf.distribute` to scale training on multiple devices. + + Added a [`get_next_as_optional`](https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/distribute/DistributedIterator?hl=en#get_next_as_optional) method for [`tf.distribute.DistributedIterator`](https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/distribute/DistributedIterator?hl=en) class to return a `tf.experimental.Optional` instance that contains the next value for all replicas or none instead of raising an out of range error. Also see *new* [guide on input distribution](https://www.tensorflow.org/tutorials/distribute/input). +* Allow var.assign on MirroredVariables with aggregation=NONE in replica context. Previously this would raise an error. We now allow this because many users and library writers find using `.assign` in replica context to be more convenient, instead of having to use `Strategy.extended.update` which was the previous way of updating variables in this situation. +* `tf.distribute.experimental.MultiWorkerMirroredStrategy` adds support for partial batches. Workers running out of data now continue to participate in the training with empty inputs, instead of raising an error. Learn more about [partial batches here](https://www.tensorflow.org/tutorials/distribute/input#partial_batches). +* Improve the performance of reading metrics eagerly under `tf.distribute.experimental.MultiWorkerMirroredStrategy`. +* Fix the issue that `strategy.reduce()` inside `tf.function` may raise exceptions when the values to reduce are from loops or if-clauses. +* Fix the issue that `tf.distribute.MirroredStrategy` cannot be used together with `tf.distribute.experimental.MultiWorkerMirroredStrategy`. +* Add a `tf.distribute.cluster_resolver.TPUClusterResolver.connect` API to simplify TPU initialization. + +### `tf.keras`: + +* Introduces experimental preprocessing layers API (`tf.keras.layers.experimental.preprocessing`) to handle data preprocessing operations such as categorical feature encoding, text vectorization, data normalization, and data discretization (binning). The newly added layers provide a replacement for the legacy feature column API, and support composite tensor inputs. +* Added **categorical data** processing layers: + + `IntegerLookup` & `StringLookup`: build an index of categorical feature values + + `CategoryEncoding`: turn integer-encoded categories into one-hot, multi-hot, or tf-idf encoded representations + + `CategoryCrossing`: create new categorical features representing co-occurrences of previous categorical feature values + + `Hashing`: the hashing trick, for large-vocabulary categorical features + + `Discretization`: turn continuous numerical features into categorical features by binning their values +* Improved **image preprocessing** layers: `CenterCrop`, `Rescaling` +* Improved **image augmentation** layers: `RandomCrop`, `RandomFlip`, `RandomTranslation`, `RandomRotation`, `RandomHeight`, `RandomWidth`, `RandomZoom`, `RandomContrast` +* Improved **`TextVectorization`** layer, which handles string tokenization, n-gram generation, and token encoding + + The `TextVectorization` layer now accounts for the mask\_token as part of the vocabulary size when output\_mode='int'. This means that, if you have a max\_tokens value of 5000, your output will have 5000 unique values (not 5001 as before). + + Change the return value of `TextVectorization.get_vocabulary()` from `byte` to `string`. Users who previously were calling 'decode' on the output of this method should no longer need to do so. +* Introduce new Keras dataset generation utilities : + + **[`image_dataset_from_directory`](https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image_dataset_from_directory)** is a utility based on `tf.data.Dataset`, meant to replace the legacy `ImageDataGenerator`. It takes you from a structured directory of images to a labeled dataset, in one function call. Note that it doesn't perform image data augmentation (which is meant to be done using preprocessing layers). + + **[`text_dataset_from_directory`](https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/text_dataset_from_directory)** takes you from a structured directory of text files to a labeled dataset, in one function call. + + **[`timeseries_dataset_from_array`](https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/timeseries_dataset_from_array)** is a `tf.data.Dataset`-based replacement of the legacy `TimeseriesGenerator`. It takes you from an array of timeseries data to a dataset of shifting windows with their targets. +* Added [`experimental_steps_per_execution`](https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/keras/Model?hl=en#compile) + arg to `model.compile` to indicate the number of batches to run per `tf.function` call. This can speed up Keras Models on TPUs up to 3x. +* Extends `tf.keras.layers.Lambda` layers to support multi-argument lambdas, and keyword arguments when calling the layer. +* Functional models now get constructed if *any* tensor in a layer call's arguments/keyword arguments comes from a keras input. Previously the functional api would only work if all of the elements in the first argument to the layer came from a keras input. +* Clean up `BatchNormalization` layer's `trainable` property to act like standard python state when it's used inside `tf.functions` (frozen at tracing time), instead of acting like a pseudo-variable whose updates *kind of sometimes* get reflected in already-traced `tf.function` traces. +* Add the `Conv1DTranspose` layer. +* Refine the semantics of `SensitivitySpecificityBase` derived metrics. See the updated API docstrings for [`tf.keras.metrics.SensitivityAtSpecificity`](https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/keras/metrics/SensitivityAtSpecificity) and [`tf.keras.metrics.SpecificityAtSensitivty`](https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/keras/metrics/SpecificityAtSensitivity). + +### `tf.lite`: + +* Converter + + Restored `inference_input_type` and `inference_output_type` flags in TF 2.x TFLiteConverter (backward compatible with TF 1.x) to support integer (tf.int8, tf.uint8) input and output types in post training full integer quantized models. + + Added support for converting and resizing models with dynamic (placeholder) dimensions. Previously, there was only limited support for dynamic batch size, and even that did not guarantee that the model could be properly resized at runtime. + + Enabled experimental support for a new quantization mode with 16-bit activations and 8-bit weights. See `lite.OpsSet.EXPERIMENTAL_TFLITE_BUILTINS_ACTIVATIONS_INT16_WEIGHTS_INT8`. +* CPU + + Fix an issue w/ dynamic weights and `Conv2D` on x86. + + Add a runtime Android flag for enabling `XNNPACK` for optimized CPU performance. + + Add a runtime iOS flag for enabling `XNNPACK` for optimized CPU performance. + + Add a compiler flag to enable building a TFLite library that applies `XNNPACK` delegate automatically when the model has a `fp32` operation. +* GPU + + Allow GPU acceleration starting with internal graph nodes + + Experimental support for quantized models with the Android GPU delegate + + Add GPU delegate whitelist. + + Rename GPU whitelist -> compatibility (list). + + Improve GPU compatibility list entries from crash reports. +* NNAPI + + Set default value for `StatefulNnApiDelegate::Options::max_number_delegated_partitions` to 3. + + Add capability to disable `NNAPI` CPU and check `NNAPI` Errno. + + Fix crashes when using `NNAPI` with target accelerator specified with model containing Conv2d or FullyConnected or LSTM nodes with quantized weights. + + Fix `ANEURALNETWORKS_BAD_DATA` execution failures with `sum`/`max`/`min`/`reduce` operations with `scalar` inputs. +* Hexagon + + TFLite Hexagon Delegate out of experimental. + + Experimental `int8` support for most hexagon ops. + + Experimental per-channel quant support for `conv` in Hexagon delegate. + + Support dynamic batch size in C++ API. +* CoreML + + Opensource CoreML delegate +* Misc + + Enable building Android TFLite targets on Windows + + Add support for `BatchMatMul`. + + Add support for `half_pixel_centers` with `ResizeNearestNeighbor`. + + Add 3D support for `BatchToSpaceND`. + + Add 5D support for `BroadcastSub`, `Maximum`, `Minimum`, `Transpose` and `BroadcastDiv`. + + Rename `kTfLiteActRelu1` to `kTfLiteActReluN1To1`. + + Enable flex delegate on tensorflow.lite.Interpreter Python package. + + Add `Buckettize`, `SparseCross` and `BoostedTreesBucketize` to the flex whitelist. + + Add support for selective registration of flex ops. + + Add missing kernels for flex delegate whitelisted ops. + + Fix issue when using direct `ByteBuffer` inputs with graphs that have dynamic shapes. + + Fix error checking supported operations in a model containing `HardSwish`. + +### Packaging Support + +* Added `tf.sysconfig.get_build_info()`. Returns a dict that describes the build environment of the currently installed TensorFlow package, e.g. the NVIDIA CUDA and NVIDIA CuDNN versions used when TensorFlow was built. + +### Profiler + +* Fix a subtle use-after-free issue in `XStatVisitor::RefValue()`. + +### TPU Enhancements + +* Adds 3D mesh support in TPU configurations ops. +* Added TPU code for `FTRL` with `multiply_linear_by_lr`. +* Silently adds a new file system registry at `gstpu`. +* Support `restartType` in cloud tpu client. +* Depend on a specific version of google-api-python-client. +* Fixes apiclient import. + +### Tracing and Debugging + +* Add a `TFE_Py_Execute` traceme. + +### XLA Support + +* Implement stable `argmin` and `argmax` + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +902449@58880@bigcat\_chen@ASIC, Abdul Baseer Khan, Abhineet Choudhary, Abolfazl Shahbazi, Adam Hillier, ag.ramesh, Agoniii, Ajay P, Alex Hoffman, Alexander Bayandin, Alexander Grund, Alexandre Abadie, Alexey Rogachevskiy, amoitra, Andrew Stevens, Angus-Luo, Anshuman Tripathy, Anush Elangovan, Artem Mavrin, Ashutosh Hathidara, autoih, Ayushman Kumar, ayushmankumar7, Bairen Yi, Bas Aarts, Bastian Eichenberger, Ben Barsdell, bhack, Bharat Raghunathan, Biagio Montaruli, Bigcat-Himax, blueyi, Bryan Cutler, Byambaa, Carlos Hernandez-Vaquero, Chen Lei, Chris Knorowski, Christian Clauss, chuanqiw, CuiYifeng, Daniel Situnayake, Daria Zhuravleva, Dayananda-V, Deven Desai, Devi Sandeep Endluri, Dmitry Zakharov, Dominic Jack, Duncan Riach, Edgar Liberis, Ehsan Toosi, ekuznetsov139, Elena Zhelezina, Eugene Kuznetsov, Eugene Mikhantiev, Evgenii Zheltonozhskii, Fabio Di Domenico, Fausto Morales, Fei Sun, feihugis, Felix E. Klee, flyingcat, Frederic Bastien, Fredrik Knutsson, frreiss, fsx950223, ganler, Gaurav Singh, Georgios Pinitas, Gian Marco Iodice, Giorgio Arena, Giuseppe Rossini, Gregory Keith, Guozhong Zhuang, gurushantj, Hahn Anselm, Harald Husum, Harjyot Bagga, Hristo Vrigazov, Ilya Persky, Ir1d, Itamar Turner-Trauring, jacco, Jake Tae, Janosh Riebesell, Jason Zaman, jayanth, Jeff Daily, Jens Elofsson, Jinzhe Zeng, JLZ, Jonas Skog, Jonathan Dekhtiar, Josh Meyer, Joshua Chia, Judd, justkw, Kaixi Hou, Kam D Kasravi, Kamil Rakoczy, Karol Gugala, Kayou, Kazuaki Ishizaki, Keith Smiley, Khaled Besrour, Kilaru Yasaswi Sri Chandra Gandhi, Kim, Young Soo, Kristian Hartikainen, Kwabena W. Agyeman, Leslie-Fang, Leslie-Fang-Intel, Li, Guizi, Lukas Geiger, Lutz Roeder, M\U00E5Ns Nilsson, Mahmoud Abuzaina, Manish, Marcel Koester, Marcin Sielski, marload, Martin Jul, Matt Conley, mdfaijul, Meng, Peng, Meteorix, Michael Käufl, Michael137, Milan Straka, Mitchell Vitez, Ml-0, Mokke Meguru, Mshr-H, nammbash, Nathan Luehr, naumkin, Neeraj Bhadani, ngc92, Nick Morgan, nihui, Niranjan Hasabnis, Niranjan Yadla, Nishidha Panpaliya, Oceania2018, oclyke, Ouyang Jin, OverLordGoldDragon, Owen Lyke, Patrick Hemmer, Paul Andrey, Peng Sun, periannath, Phil Pearl, Prashant Dandriyal, Prashant Kumar, Rahul Huilgol, Rajan Singh, Rajeshwar Reddy T, rangjiaheng, Rishit Dagli, Rohan Reddy, rpalakkal, rposts, Ruan Kunliang, Rushabh Vasani, Ryohei Ikegami, Semun Lee, Seo-Inyoung, Sergey Mironov, Sharada Shiddibhavi, ShengYang1, Shraiysh Vaishay, Shunya Ueta, shwetaoj, Siyavash Najafzade, Srinivasan Narayanamoorthy, Stephan Uphoff, storypku, sunchenggen, sunway513, Sven-Hendrik Haase, Swapnil Parekh, Tamas Bela Feher, Teng Lu, tigertang, tomas, Tomohiro Ubukata, tongxuan.ltx, Tony Tonev, Tzu-Wei Huang, Téo Bouvard, Uday Bondhugula, Vaibhav Jade, Vijay Tadikamalla, Vikram Dattu, Vincent Abriou, Vishnuvardhan Janapati, Vo Van Nghia, VoVAllen, Will Battel, William D. Irons, wyzhao, Xiaoming (Jason) Cui, Xiaoquan Kong, Xinan Jiang, xutianming, Yair Ehrenwald, Yasir Modak, Yasuhiro Matsumoto, Yixing Fu, Yong Tang, Yuan Tang, zhaozheng09, Zilin Zhu, zilinzhu, 张志豪 diff --git a/corpus/changelog/tensorflow_releases/tensorflow_240.md b/corpus/changelog/tensorflow_releases/tensorflow_240.md new file mode 100644 index 0000000000000000000000000000000000000000..94c39b746a7f5c2870c5924d98273267e2d9676b --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_240.md @@ -0,0 +1,315 @@ +# TensorFlow 2.4.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v2.4.0 +Version: 2.4.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@tensorflow-jenkins](https://avatars.githubusercontent.com/u/16359713?s=40&v=4) +[tensorflow-jenkins](/tensorflow-jenkins) +released this +14 Dec 18:16 + +· +[569 commits](/tensorflow/tensorflow/compare/v2.4.0...r2.4) +to r2.4 +since this release + +[v2.4.0](/tensorflow/tensorflow/tree/v2.4.0) + +[`582c8d2`](/tensorflow/tensorflow/commit/582c8d236cb079023657287c318ff26adb239002) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 2.4.0 + +## Major Features and Improvements + +* `tf.distribute` introduces experimental support for asynchronous training of models via the [`tf.distribute.experimental.ParameterServerStrategy`](https://www.tensorflow.org/api_docs/python/tf/distribute/experimental/ParameterServerStrategy) API. Please see the [tutorial](https://www.tensorflow.org/tutorials/distribute/parameter_server_training) to learn more. +* [`MultiWorkerMirroredStrategy`](https://www.tensorflow.org/api_docs/python/tf/distribute/MultiWorkerMirroredStrategy) is now a stable API and is no longer considered experimental. Some of the major improvements involve handling peer failure and many bug fixes. Please check out the detailed tutorial on [Multi-worker training with Keras](https://www.tensorflow.org/tutorials/distribute/multi_worker_with_keras). +* Introduces experimental support for a new module named [`tf.experimental.numpy`](https://www.tensorflow.org/api_docs/python/tf/experimental/numpy) which is a NumPy-compatible API for writing TF programs. See the [detailed guide](https://www.tensorflow.org/guide/tf_numpy) to learn more. Additional details below. +* Adds Support for + [TensorFloat-32](https://blogs.nvidia.com/blog/2020/05/14/tensorfloat-32-precision-format/) on Ampere based GPUs. TensorFloat-32, or TF32 for short, is a math mode for NVIDIA Ampere based GPUs and is enabled by default. +* A major refactoring of the internals of the Keras Functional API has been completed, that should improve the reliability, stability, and performance of constructing Functional models. +* Keras mixed precision API [`tf.keras.mixed_precision`](https://www.tensorflow.org/api_docs/python/tf/keras/mixed_precision?version=nightly) is no longer experimental and allows the use of 16-bit floating point formats during training, improving performance by up to 3x on GPUs and 60% on TPUs. Please see below for additional details. +* TensorFlow Profiler now supports profiling `MultiWorkerMirroredStrategy` and tracing multiple workers using the [sampling mode API](https://www.tensorflow.org/guide/profiler#profiling_apis). +* TFLite Profiler for Android is available. See the detailed [guide](https://www.tensorflow.org/lite/performance/measurement#trace_tensorflow_lite_internals_in_android) to learn more. +* TensorFlow pip packages are now built with CUDA11 and cuDNN 8.0.2. + +## Breaking Changes + +* TF Core: + + + Certain float32 ops run in lower precsion on Ampere based GPUs, including matmuls and convolutions, due to the use of [TensorFloat-32](https://blogs.nvidia.com/blog/2020/05/14/tensorfloat-32-precision-format/). Specifically, inputs to such ops are rounded from 23 bits of precision to 10 + bits of precision. This is unlikely to cause issues in practice for deep learning models. In some cases, TensorFloat-32 is also used for complex64 ops. + TensorFloat-32 can be disabled by running `tf.config.experimental.enable_tensor_float_32_execution(False)`. + + The byte layout for string tensors across the C-API has been updated to match TF Core/C++; i.e., a contiguous array of `tensorflow::tstring`/`TF_TString`s. + + C-API functions `TF_StringDecode`, `TF_StringEncode`, and `TF_StringEncodedSize` are no longer relevant and have been removed; see `core/platform/ctstring.h` for string access/modification in C. + + `tensorflow.python`, `tensorflow.core` and `tensorflow.compiler` modules are now hidden. These modules are not part of TensorFlow public API. + + `tf.raw_ops.Max` and `tf.raw_ops.Min` no longer accept inputs of type `tf.complex64` or `tf.complex128`, because the behavior of these ops is not well defined for complex types. + + XLA:CPU and XLA:GPU devices are no longer registered by default. Use `TF_XLA_FLAGS=--tf_xla_enable_xla_devices` if you really need them, but this flag will eventually be removed in subsequent releases. +* `tf.keras`: + + + The `steps_per_execution` argument in `model.compile()` is no longer experimental; if you were passing `experimental_steps_per_execution`, rename it to `steps_per_execution` in your code. This argument controls the number of batches to run during each `tf.function` call when calling `model.fit()`. Running multiple batches inside a single `tf.function` call can greatly improve performance on TPUs or small models with a large Python overhead. + + A **major refactoring** of the internals of the Keras Functional API may affect code that + is relying on certain internal details: + - Code that uses `isinstance(x, tf.Tensor)` instead of `tf.is_tensor` when checking Keras symbolic inputs/outputs should switch to using `tf.is_tensor`. + - Code that is overly dependent on the exact names attached to symbolic tensors (e.g. assumes there will be ":0" at the end of the inputs, treats names as unique identifiers instead of using `tensor.ref()`, etc.) may break. + - Code that uses full path for `get_concrete_function` to trace Keras symbolic inputs directly should switch to building matching `tf.TensorSpec`s directly and tracing the `TensorSpec` objects. + - Code that relies on the exact number and names of the op layers that TensorFlow operations were converted into may have changed. + - Code that uses `tf.map_fn`/`tf.cond`/`tf.while_loop`/control flow as op layers and happens to work before TF 2.4. These will explicitly be unsupported now. Converting these ops to Functional API op layers was unreliable before TF 2.4, and prone to erroring incomprehensibly or being silently buggy. + - Code that directly asserts on a Keras symbolic value in cases where ops like `tf.rank` used to return a static or symbolic value depending on if the input had a fully static shape or not. Now these ops always return symbolic values. + - Code already susceptible to leaking tensors outside of graphs becomes slightly more likely to do so now. + - Code that tries directly getting gradients with respect to symbolic Keras inputs/outputs. Use `GradientTape` on the actual Tensors passed to the already-constructed model instead. + - Code that requires very tricky shape manipulation via converted op layers in order to work, where the Keras symbolic shape inference proves insufficient. + - Code that tries manually walking a `tf.keras.Model` layer by layer and assumes layers only ever have one positional argument. This assumption doesn't hold true before TF 2.4 either, but is more likely to cause issues now. + - Code that manually enters `keras.backend.get_graph()` before building a functional model is no longer needed. + - Start enforcing input shape assumptions when calling Functional API Keras models. This may potentially break some users, in case there is a mismatch between the shape used when creating `Input` objects in a Functional model, and the shape of the data passed to that model. You can fix this mismatch by either calling the model with correctly-shaped data, or by relaxing `Input` shape assumptions (note that you can pass shapes with `None` entries for axes + that are meant to be dynamic). You can also disable the input checking entirely by setting `model.input_spec = None`. + + Several changes have been made to `tf.keras.mixed_precision.experimental`. Note that it is now recommended to use the non-experimental `tf.keras.mixed_precision` API. + + `AutoCastVariable.dtype` now refers to the actual variable dtype, not the dtype it will be casted to. + + When mixed precision is enabled, `tf.keras.layers.Embedding` now outputs a float16 or bfloat16 tensor instead of a float32 tensor. + + The property `tf.keras.mixed_precision.experimental.LossScaleOptimizer.loss_scale` is now a tensor, not a `LossScale` object. This means to get a loss scale of a `LossScaleOptimizer` as a tensor, you must now call `opt.loss_scale`instead of `opt.loss_scale()`. + + The property `should_cast_variables` has been removed from `tf.keras.mixed_precision.experimental.Policy` + + When passing a `tf.mixed_precision.experimental.DynamicLossScale` to `tf.keras.mixed_precision.experimental.LossScaleOptimizer`, the `DynamicLossScale`'s multiplier must be 2. + + When passing a `tf.mixed_precision.experimental.DynamicLossScale` to `tf.keras.mixed_precision.experimental.LossScaleOptimizer`, the weights of + the `DynanmicLossScale` are copied into the `LossScaleOptimizer` instead of being reused. This means modifying the weights of the `DynamicLossScale` will no longer affect the weights of the LossScaleOptimizer, and vice versa. + + The global policy can no longer be set to a non-floating point policy in `tf.keras.mixed_precision.experimental.set_policy` + + In `Layer.call`, `AutoCastVariable`s will no longer be casted within `MirroredStrategy.run` or `ReplicaContext.merge_call`. This is because a thread local variable is used to determine whether `AutoCastVariable`s are casted, and those two functions run with a different thread. Note this only applies if one of these two functions is called within `Layer.call`; if one of those two functions calls `Layer.call`, `AutoCastVariable`s will still be casted. +* `tf.data`: + + + `tf.data.experimental.service.DispatchServer` now takes a config tuple instead of individual arguments. Usages should be updated to `tf.data.experimental.service.DispatchServer(dispatcher_config)`. + + `tf.data.experimental.service.WorkerServer` now takes a config tuple instead of individual arguments. Usages should be updated to `tf.data.experimental.service.WorkerServer(worker_config)`. +* `tf.distribute`: + + + Removes `tf.distribute.Strategy.experimental_make_numpy_dataset`. Please use `tf.data.Dataset.from_tensor_slices` instead. + + Renames `experimental_hints` in `tf.distribute.StrategyExtended.reduce_to`, `tf.distribute.StrategyExtended.batch_reduce_to`, `tf.distribute.ReplicaContext.all_reduce` to `options`. + + Renames `tf.distribute.experimental.CollectiveHints` to `tf.distribute.experimental.CommunicationOptions`. + + Renames `tf.distribute.experimental.CollectiveCommunication` to `tf.distribute.experimental.CommunicationImplementation`. + + Renames `tf.distribute.Strategy.experimental_distribute_datasets_from_function` to `distribute_datasets_from_function` as it is no longer experimental. + + Removes `tf.distribute.Strategy.experimental_run_v2` method, which was deprecated in TF 2.2. +* `tf.lite`: + + + `tf.quantization.quantize_and_dequantize_v2` has been introduced, which updates the gradient definition for quantization which is outside the range + to be 0. To simulate the V1 the behavior of `tf.quantization.quantize_and_dequantize(...)` use `tf.grad_pass_through(tf.quantization.quantize_and_dequantize_v2)(...)`. +* Building TensorFlow: + + + Windows platform builds: TensorFlow on Windows under MSVC is now built with `--copt=/experimental:preprocessor --host_copt=/experimental:preprocessor` (see `.bazelrc` for more details). Builds including TensorFlow may fail with unexpected syntax errors if these flags are absent. See also [this thread on SIG Build](https://groups.google.com/a/tensorflow.org/g/build/c/LbAw8RILvTg/m/ttnuhYU2BgAJ). + +## Known Caveats + +* `tf.keras.mixed_precision` + + When using mixed precision, calling `RMSprop.apply_gradients` or `Nadam.apply_gradients` outside a `tf.function` does not work and will raise the AttributeError "Tensor.op is meaningless when eager execution is enabled". See this [issue](https://github.com/tensorflow/tensorflow/issues/45536) for details and a workaround. + +## Bug Fixes and Other Changes + +### TF Core: + +* Introduces experimental support for a new module named [`tf.experimental.numpy`](https://www.tensorflow.org/api_docs/python/tf/experimental/numpy), which + is a NumPy-compatible API for writing TF programs. This module provides class `ndarray`, which mimics the `ndarray` class in NumPy, and wraps an immutable `tf.Tensor` under the hood. A subset of NumPy functions (e.g. `numpy.add`) are provided. Their inter-operation with TF facilities is seamless in most cases. + See [tensorflow/python/ops/numpy\_ops/README.md](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/ops/numpy_ops/README.md) + for details of what operations are supported and what are the differences from NumPy. +* `tf.types.experimental.TensorLike` is a new `Union` type that can be used as type annotation for variables representing a Tensor or a value + that can be converted to Tensor by `tf.convert_to_tensor`. +* Calling ops with a python constants or numpy values is now consistent with tf.convert\_to\_tensor behavior. This avoids operations like + tf.reshape truncating inputs such as from int64 to int32. +* Adds `tf.sparse.map_values` to apply a function to the `.value`s of `SparseTensor` arguments. +* The Python bitwise operators for `Tensor` (`__and__`, `__or__`, `__xor__` and `__invert__` now support non-`bool` arguments and apply + the corresponding bitwise ops. `bool` arguments continue to be supported and dispatch to logical ops. This brings them more in line with + Python and NumPy behavior. +* Adds `tf.SparseTensor.with_values`. This returns a new SparseTensor with the same sparsity pattern, but with new provided values. It is + similar to the `with_values` function of `RaggedTensor`. +* Adds `StatelessCase` op, and uses it if none of case branches has stateful ops. +* Adds `tf.config.experimental.get_memory_usage` to return total memory usage of the device. +* Adds gradients for `RaggedTensorToVariant` and `RaggedTensorFromVariant`. +* Improve shape inference of nested function calls by supporting constant folding across Arg nodes which makes more static values available to shape inference functions. +* `tf.debugging`: + + `tf.debugging.assert_shapes()` now works on `SparseTensor`s (Fixes [#36268](https://github.com/tensorflow/tensorflow/issues/36268)). +* GPU + + Adds Support for [TensorFloat-32](https://blogs.nvidia.com/blog/2020/05/14/tensorfloat-32-precision-format/) on Ampere based GPUs. + TensorFloat-32, or TF32 for short, is a math mode for NVIDIA Ampere based GPUs which causes certain float32 ops, such as matrix + multiplications and convolutions, to run much faster on Ampere GPUs but with reduced precision. This reduced precision has not been found + to effect convergence quality of deep learning models in practice. TensorFloat-32 is enabled by default, but can be disabled with `tf.config.experimental.enable_tensor_float_32_execution`. +* `tf.math`: + + Adds `tf.math.erfcinv`, the inverse to `tf.math.erfc`. +* `tf.nn`: + + `tf.nn.max_pool2d` now supports explicit padding. +* `tf.image`: + + Adds deterministic `tf.image.stateless_random_*` functions for each `tf.image.random_*` function. Added a new op `stateless_sample_distorted_bounding_box` which is a deterministic version of `sample_distorted_bounding_box` op. Given the same seed, these stateless functions/ops produce the same results independent of how many times the function is called, and independent of global seed settings. + + Adds deterministic `tf.image.resize` backprop CUDA kernels for `method=ResizeMethod.BILINEAR` (the default method). Enable by setting the environment variable `TF_DETERMINISTIC_OPS` to `"true"` or `"1"`. +* `tf.print`: + + Bug fix in `tf.print()` with `OrderedDict` where if an `OrderedDict` didn't have the keys sorted, the keys and values were not being printed + in accordance with their correct mapping. +* `tf.train.Checkpoint`: + + Now accepts a `root` argument in the initialization, which generates a checkpoint with a root object. This allows users to create a `Checkpoint` object that is compatible with Keras `model.save_weights()` and `model.load_weights`. The checkpoint is also compatible with the checkpoint saved in the `variables/` folder in the SavedModel. + + When restoring, `save_path` can be a path to a SavedModel. The function will automatically find the checkpoint in the SavedModel. + +### `tf.data`: + +* Adds new `tf.data.experimental.service.register_dataset` and `tf.data.experimental.service.from_dataset_id` APIs to enable one + process to register a dataset with the tf.data service, and another process to consume data from the dataset. +* Adds support for dispatcher fault tolerance. To enable fault tolerance, configure a `work_dir` when running your dispatcher server and set + `dispatcher_fault_tolerance=True`. The dispatcher will store its state to `work_dir`, so that on restart it can continue from its previous + state after restart. +* Adds support for sharing dataset graphs via shared filesystem instead of over RPC. This reduces load on the dispatcher, improving performance + of distributing datasets. For this to work, the dispatcher's `work_dir` must be accessible from workers. If the worker fails to read from the + `work_dir`, it falls back to using RPC for dataset graph transfer. +* Adds support for a new "distributed\_epoch" processing mode. This processing mode distributes a dataset across all tf.data workers, + instead of having each worker process the full dataset. See [the tf.data service docs](https://www.tensorflow.org/api_docs/python/tf/data/experimental/service#understand_processing_mode) to learn more. +* Adds optional `exclude_cols` parameter to CsvDataset. This parameter is the complement of `select_cols`; at most one of these should be specified. +* We have implemented an optimization which reorders data-discarding transformations such as `take` and `shard` to happen earlier in the dataset when it is safe to do so. The optimization can be disabled via the `experimental_optimization.reorder_data_discarding_ops` dataset option. +* `tf.data.Options` were previously immutable and can now be overridden. +* `tf.data.Dataset.from_generator` now supports Ragged and Sparse tensors with a new `output_signature` argument, which allows `from_generator` to + produce any type describable by a `tf.TypeSpec`. +* `tf.data.experimental.AUTOTUNE` is now available in the core API as `tf.data.AUTOTUNE`. + +### `tf.distribute`: + +* Introduces experimental support for asynchronous training of models via `tf.distribute.experimental.ParameterServerStrategy`: + + Replaces the existing `tf.distribute.experimental.ParameterServerStrategy` symbol with a new class that is for parameter server training in TF2. Usage of + the old symbol, usually with Estimator API, should be **replaced** with [`tf.compat.v1.distribute.experimental.ParameterServerStrategy`]. + + Added `tf.distribute.experimental.coordinator.*` namespace, including the main API `ClusterCoordinator` for coordinating the training cluster, the related data structure `RemoteValue` and `PerWorkerValue`. +* `MultiWorkerMirroredStrategy`]() is now a stable API and is no longer considered experimental. Some of the major improvements involve handling peer failure and many bug fixes. Please check out the detailed tutorial on + [Multi-worer training with Keras](https://www.tensorflow.org/tutorials/distribute/multi_worker_with_keras). +* Adds `tf.distribute.Strategy.gather` and `tf.distribute.ReplicaContext.all_gather` APIs to support gathering dense distributed values. +* Fixes various issues with saving a distributed model. + +### `tf.keras`: + +* Improvements from the Functional API refactoring: + + Functional model construction does not need to maintain a global workspace graph, removing memory leaks especially when building many + models or very large models. + + Functional model construction should be ~8-10% faster on average. + + Functional models can now contain non-symbolic values in their call inputs inside of the first positional argument. + + Several classes of TF ops that were not reliably converted to Keras layers during functional API construction should now work, e.g. + `tf.image.ssim_multiscale` + + Error messages when Functional API construction goes wrong (and when ops cannot be converted to Keras layers automatically) should be + clearer and easier to understand. +* `Optimizer.minimize` can now accept a loss `Tensor` and a `GradientTape` as an alternative to accepting a `callable` loss. +* Adds `beta` hyperparameter to [FTRL](https://www.tensorflow.org/api_docs/python/tf/keras/optimizers/Ftrl) optimizer classes (Keras and others) to match [FTRL paper](https://research.google.com/pubs/archive/41159.pdf). +* `Optimizer.__init__` now accepts a `gradient_aggregator` to allow for customization of how gradients are aggregated across devices, as well as `gradients_transformers` to allow for custom gradient transformations (such as gradient clipping). +* Improvements to Keras preprocessing layers: + + TextVectorization can now accept a vocabulary list or file as an init arg. + + Normalization can now accept mean and variance values as init args. +* In `Attention` and `AdditiveAttention` layers, the `call()` method now accepts a `return_attention_scores` argument. When set to + True, the layer returns the attention scores as an additional output argument. +* Adds `tf.metrics.log_cosh` and `tf.metrics.logcosh` API entrypoints with the same implementation as their `tf.losses` equivalent. +* For Keras model, the individual call of `Model.evaluate` uses no cached data for evaluation, while `Model.fit` uses cached data when `validation_data` arg is provided for better performance. +* Adds a `save_traces` argument to `model.save`/ `tf.keras.models.save_model` which determines whether the SavedModel format stores the Keras model/layer call functions. The traced functions allow Keras to revive custom models and layers without the original class definition, but if this isn't required the tracing can be disabled with the added option. +* The `tf.keras.mixed_precision` API is now non-experimental. The non-experimental API differs from the experimental API in several ways. + + `tf.keras.mixed_precision.Policy` no longer takes in a `tf.mixed_precision.experimental.LossScale` in the constructor, and no longer has a `LossScale` associated with it. Instead, `Model.compile` will automatically wrap the optimizer with a `LossScaleOptimizer` using dynamic loss scaling if `Policy.name` is "mixed\_float16". + + `tf.keras.mixed_precision.LossScaleOptimizer`'s constructor takes in different arguments. In particular, it no longer takes in a `LossScale`, and there is no longer a `LossScale` associated with the `LossScaleOptimizer`. Instead, `LossScaleOptimizer` directly implements fixed or dynamic loss scaling. See the documentation of [`tf.keras.mixed_precision.experimental.LossScaleOptimizer`](https://www.tensorflow.org/api_docs/python/tf/keras/mixed_precision/experimental/LossScaleOptimizer?version=nightly) for details on the differences between the experimental `LossScaleOptimizer` and the new non-experimental `LossScaleOptimizer`. + + `tf.mixed_precision.experimental.LossScale` and its subclasses are deprecated, as all of its functionality now exists within `tf.keras.mixed_precision.LossScaleOptimizer` + +### `tf.lite`: + +* `TFLiteConverter`: + + Support optional flags `inference_input_type` and `inference_output_type` for full integer quantized models. This allows users to modify the model input and output type to integer types (`tf.int8`, `tf.uint8`) instead of defaulting to float type (`tf.float32`). +* NNAPI + + Adds NNAPI Delegation support for requantization use cases by converting the operation into a dequantize-quantize pair. + + Removes deprecated `Interpreter.setUseNNAPI(boolean)` Java API. Use `Interpreter.Options.setUseNNAPI` instead. + + Deprecates `Interpreter::UseNNAPI(bool)` C++ API. Use `NnApiDelegate()` and related delegate configuration methods directly. + + Deprecates `Interpreter::SetAllowFp16PrecisionForFp32(bool)` C++ API. Prefer controlling this via delegate options, e.g. `tflite::StatefulNnApiDelegate::Options::allow_fp16' or` TfLiteGpuDelegateOptionsV2::is\_precision\_loss\_allowed`. +* GPU + + GPU acceleration now supports quantized models by default +* `DynamicBuffer::AddJoinedString()` will now add a separator if the first string to be joined is empty. +* Adds support for cumulative sum (cumsum), both as builtin op and MLIR conversion. + +### `TensorRT` + +* Issues a warning when the `session_config` parameter for the TF1 converter is used or the `rewrite_config_template` field in the TF2 + converter parameter object is used. + +### TPU Enhancements: + +* Adds support for the `beta` parameter of the FTRL optimizer for TPU embeddings. Users of other TensorFlow platforms can implement equivalent + behavior by adjusting the `l2` parameter. + +### XLA Support: + +* xla.experimental.compile is deprecated, use `tf.function(experimental_compile=True)` instead. +* Adds `tf.function.experimental_get_compiler_ir` which returns compiler IR (currently 'hlo' and 'optimized\_hlo') for given input for given function. + +### Security: + +* Fixes an undefined behavior causing a segfault in `tf.raw_ops.Switch`, ([CVE-2020-15190](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15190)) +* Fixes three vulnerabilities in conversion to DLPack format + + [CVE-2020-15191](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15191), + + [CVE-2020-15192](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15192), + + [CVE-2020-15193](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15193) +* Fixes two vulnerabilities in `SparseFillEmptyRowsGrad` + + [CVE-2020-15194](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15194), + + [CVE-2020-15195](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15195) +* Fixes several vulnerabilities in `RaggedCountSparseOutput` and `SparseCountSparseOutput` operations + + [CVE-2020-15196](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15196), + + [CVE-2020-15197](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15197), + + [CVE-2020-15198](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15198), + + [CVE-2020-15199](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15199), + + [CVE-2020-15200](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15200), + + [CVE-2020-15201](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15201) +* Fixes an integer truncation vulnerability in code using the work sharder API, ([CVE-2020-15202](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15202)) +* Fixes a format string vulnerability in `tf.strings.as_string`, ([CVE-2020-15203](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15203)) +* Fixes segfault raised by calling session-only ops in eager mode, ([CVE-2020-15204](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15204)) +* Fixes data leak and potential ASLR violation from `tf.raw_ops.StringNGrams`, ([CVE-2020-15205](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15205)) +* Fixes segfaults caused by incomplete `SavedModel` validation, ([CVE-2020-15206](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15206)) +* Fixes a data corruption due to a bug in negative indexing support in TFLite, ([CVE-2020-15207](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15207)) +* Fixes a data corruption due to dimension mismatch in TFLite, ([CVE-2020-15208](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15208)) +* Fixes several vulnerabilities in TFLite saved model format + + [CVE-2020-15209](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15209), + + [CVE-2020-15210](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15210), + + [CVE-2020-15211](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15211) +* Fixes several vulnerabilities in TFLite implementation of segment sum + + [CVE-2020-15212](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15212), + + [CVE-2020-15213](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15213), + + [CVE-2020-15214](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15214) +* Fixes a segfault in `tf.quantization.quantize_and_dequantize`, ([CVE-2020-15265](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15265)) +* Fixes an undefined behavior float cast causing a crash, ([CVE-2020-15266](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15266)) +* Fixes a lack of validation in `tf.raw_ops.DataFormatVecPermute` and `tf.raw_ops.DataFormatDimMap` which can cause uninitialized memory access, read outside bounds of arrays, data corruption and segmentation faults ([CVE-2020-26267](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-26267)) +* Fixes a crash caused by writing to read only memory region ([CVE-2020-26268](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-26268)) +* Fixes a heap out of bounds access in filesystem globbing implementation ([CVE-2020-26269](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-26269)) + +### Other: + +* We have replaced uses of "whitelist" and "blacklist" with "allowlist" and "denylist" where possible. Please see [this list](https://developers.google.com/style/word-list#blacklist) for more context. +* Adds `tf.config.experimental.mlir_bridge_rollout` which will help us rollout the new MLIR TPU bridge. +* Adds `tf.experimental.register_filesystem_plugin` to load modular filesystem plugins from Python + +## Thanks to our Contributors + +This release contains contributions from many people at Google as well as the following external contributors: + +8bitmp3, aaa.jq, Abhineet Choudhary, Abolfazl Shahbazi, acxz, Adam Hillier, Adrian Garcia Badaracco, Ag Ramesh, ahmedsabie, Alan Anderson, Alexander Grund, Alexandre Lissy, Alexey Ivanov, Amedeo Cavallo, anencore94, Aniket Kumar Singh, Anthony Platanios, Ashwin Phadke, Balint Cristian, Basit Ayantunde, bbbboom, Ben Barsdell, Benjamin Chetioui, Benjamin Peterson, bhack, Bhanu Prakash Bandaru Venkata, Biagio Montaruli, Brent M. Spell, bubblebooy, bzhao, cfRod, Cheng Chen, Cheng(Kit) Chen, Chris Tessum, Christian, chuanqiw, codeadmin\_peritiae, COTASPAR, CuiYifeng, danielknobe, danielyou0230, dannyfriar, daria, DarrenZhang01, Denisa Roberts, dependabot[bot], Deven Desai, Dmitry Volodin, Dmitry Zakharov, drebain, Duncan Riach, Eduard Feicho, Ehsan Toosi, Elena Zhelezina, emlaprise2358, Eugene Kuznetsov, Evaderan-Lab, Evgeniy Polyakov, Fausto Morales, Felix Johnny, fo40225, Frederic Bastien, Fredrik Knutsson, fsx950223, Gaurav Singh, Gauri1 Deshpande, George Grzegorz Pawelczak, gerbauz, Gianluca Baratti, Giorgio Arena, Gmc2, Guozhong Zhuang, Hannes Achleitner, Harirai, HarisWang, Harsh188, hedgehog91, Hemal Mamtora, Hideto Ueno, Hugh Ku, Ian Beauregard, Ilya Persky, jacco, Jakub Beránek, Jan Jongboom, Javier Montalt Tordera, Jens Elofsson, Jerry Shih, jerryyin, jgehw, Jinjing Zhou, jma, jmsmdy, Johan Nordström, John Poole, Jonah Kohn, Jonathan Dekhtiar, jpodivin, Jung Daun, Kai Katsumata, Kaixi Hou, Kamil Rakoczy, Kaustubh Maske Patil, Kazuaki Ishizaki, Kedar Sovani, Koan-Sin Tan, Koki Ibukuro, Krzysztof Laskowski, Kushagra Sharma, Kushan Ahmadian, Lakshay Tokas, Leicong Li, levinxo, Lukas Geiger, Maderator, Mahmoud Abuzaina, Mao Yunfei, Marius Brehler, markf, Martin Hwasser, Martin Kubovčík, Matt Conley, Matthias, mazharul, mdfaijul, Michael137, MichelBr, Mikhail Startsev, Milan Straka, Ml-0, Myung-Hyun Kim, Måns Nilsson, Nathan Luehr, ngc92, nikochiko, Niranjan Hasabnis, nyagato\_00, Oceania2018, Oleg Guba, Ongun Kanat, OscarVanL, Patrik Laurell, Paul Tanger, Peter Sobot, Phil Pearl, PlusPlusUltra, Poedator, Prasad Nikam, Rahul-Kamat, Rajeshwar Reddy T, redwrasse, Rickard, Robert Szczepanski, Rohan Lekhwani, Sam Holt, Sami Kama, Samuel Holt, Sandeep Giri, sboshin, Sean Settle, settle, Sharada Shiddibhavi, Shawn Presser, ShengYang1, Shi,Guangyong, Shuxiang Gao, Sicong Li, Sidong-Wei, Srihari Humbarwadi, Srinivasan Narayanamoorthy, Steenu Johnson, Steven Clarkson, stjohnso98, Tamas Bela Feher, Tamas Nyiri, Tarandeep Singh, Teng Lu, Thibaut Goetghebuer-Planchon, Tim Bradley, Tomasz Strejczek, Tongzhou Wang, Torsten Rudolf, Trent Lo, Ty Mick, Tzu-Wei Sung, Varghese, Jojimon, Vignesh Kothapalli, Vishakha Agrawal, Vividha, Vladimir Menshakov, Vladimir Silyaev, VoVAllen, Võ Văn Nghĩa, wondertx, xiaohong1031, Xiaoming (Jason) Cui, Xinan Jiang, Yair Ehrenwald, Yasir Modak, Yasuhiro Matsumoto, Yimei Sun, Yiwen Li, Yixing, Yoav Ramon, Yong Tang, Yong Wu, yuanbopeng, Yunmo Koo, Zhangqiang, Zhou Peng, ZhuBaohe, zilinzhu, zmx diff --git a/corpus/changelog/tensorflow_releases/tensorflow_250.md b/corpus/changelog/tensorflow_releases/tensorflow_250.md new file mode 100644 index 0000000000000000000000000000000000000000..e776ccedbd9874072eaa984a002eb3422d7788ef --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_250.md @@ -0,0 +1,303 @@ +# TensorFlow 2.5.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v2.5.0 +Version: 2.5.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@tensorflow-jenkins](https://avatars.githubusercontent.com/u/16359713?s=40&v=4) +[tensorflow-jenkins](/tensorflow-jenkins) +released this +13 May 18:18 + +· +[452 commits](/tensorflow/tensorflow/compare/v2.5.0...r2.5) +to r2.5 +since this release + +[v2.5.0](/tensorflow/tensorflow/tree/v2.5.0) + +[`a4dfb8d`](/tensorflow/tensorflow/commit/a4dfb8d1a71385bd6d122e4f27f86dcebb96712d) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 2.5.0 + +## Major Features and Improvements + +* Support for Python3.9 has been added. +* `tf.data`: + + `tf.data` service now supports strict round-robin reads, which is useful for synchronous training workloads where example sizes vary. With strict round robin reads, users can guarantee that consumers get similar-sized examples in the same step. + + tf.data service now supports optional compression. Previously data would always be compressed, but now you can disable compression by passing `compression=None` to `tf.data.experimental.service.distribute(...)`. + + `tf.data.Dataset.batch()` now supports `num_parallel_calls` and `deterministic` arguments. `num_parallel_calls` is used to indicate that multiple input batches should be computed in parallel. With `num_parallel_calls` set, `deterministic` is used to indicate that outputs can be obtained in the non-deterministic order. + + Options returned by `tf.data.Dataset.options()` are no longer mutable. + + tf.data input pipelines can now be executed in debug mode, which disables any asynchrony, parallelism, or non-determinism and forces Python execution (as opposed to trace-compiled graph execution) of user-defined functions passed into transformations such as `map`. The debug mode can be enabled through `tf.data.experimental.enable_debug_mode()`. +* `tf.lite` + + Enabled the new MLIR-based quantization backend by default + - The new backend is used for 8 bits full integer post-training quantization + - The new backend removes the redundant rescales and fixes some bugs (shared weight/bias, extremely small scales, etc) + - Set `experimental_new_quantizer` in tf.lite.TFLiteConverter to False to disable this change +* `tf.keras` + + `tf.keras.metrics.AUC` now support logit predictions. + + Enabled a new supported input type in `Model.fit`, `tf.keras.utils.experimental.DatasetCreator`, which takes a callable, `dataset_fn`. `DatasetCreator` is intended to work across all `tf.distribute` strategies, and is the only input type supported for Parameter Server strategy. +* `tf.distribute` + + `tf.distribute.experimental.ParameterServerStrategy` now supports training with Keras `Model.fit` when used with `DatasetCreator`. + + Creating `tf.random.Generator` under `tf.distribute.Strategy` scopes is now allowed (except for `tf.distribute.experimental.CentralStorageStrategy` and `tf.distribute.experimental.ParameterServerStrategy`). Different replicas will get different random-number streams. +* TPU embedding support + + Added `profile_data_directory` to `EmbeddingConfigSpec` in `_tpu_estimator_embedding.py`. This allows embedding lookup statistics gathered at runtime to be used in embedding layer partitioning decisions. +* PluggableDevice + + Third-party devices can now connect to TensorFlow as plug-ins through [StreamExecutor C API](https://github.com/tensorflow/community/blob/master/rfcs/20200612-stream-executor-c-api.md). + and [PluggableDevice](https://github.com/tensorflow/community/blob/master/rfcs/20200624-pluggable-device-for-tensorflow.md) interface. + - Add custom ops and kernels through [kernel and op registration C API](https://github.com/tensorflow/community/blob/master/rfcs/20190814-kernel-and-op-registration.md). + - Register custom graph optimization passes with [graph optimization C API](https://github.com/tensorflow/community/blob/master/rfcs/20201027-modular-tensorflow-graph-c-api.md). +* [oneAPI Deep Neural Network Library (oneDNN)](https://github.com/oneapi-src/oneDNN) CPU performance optimizations from [Intel-optimized TensorFlow](https://software.intel.com/content/www/us/en/develop/articles/intel-optimization-for-tensorflow-installation-guide.html) are now available in the official x86-64 Linux and Windows builds. + + They are off by default. Enable them by setting the environment variable `TF_ENABLE_ONEDNN_OPTS=1`. + + We do not recommend using them in GPU systems, as they have not been sufficiently tested with GPUs yet. +* TensorFlow pip packages are now built with CUDA11.2 and cuDNN 8.1.0 + +## Breaking Changes + +* The `TF_CPP_MIN_VLOG_LEVEL` environment variable has been renamed to to `TF_CPP_MAX_VLOG_LEVEL` which correctly describes its effect. + +## Bug Fixes and Other Changes + +* `tf.keras`: + + + Preprocessing layers API consistency changes: + - `StringLookup` added `output_mode`, `sparse`, and `pad_to_max_tokens` arguments with same semantics as `TextVectorization`. + - `IntegerLookup` added `output_mode`, `sparse`, and `pad_to_max_tokens` arguments with same semantics as `TextVectorization`. Renamed `max_values`, `oov_value` and `mask_value` to `max_tokens`, `oov_token` and `mask_token` to align with `StringLookup` and `TextVectorization`. + - `TextVectorization` default for `pad_to_max_tokens` switched to False. + - `CategoryEncoding` no longer supports `adapt`, `IntegerLookup` now supports equivalent functionality. `max_tokens` argument renamed to `num_tokens`. + - `Discretization` added `num_bins` argument for learning bins boundaries through calling `adapt` on a dataset. Renamed `bins` argument to `bin_boundaries` for specifying bins without `adapt`. + + Improvements to model saving/loading: + - `model.load_weights` now accepts paths to saved models. + + Keras inputs can now be created directly from arbitrary `tf.TypeSpecs`. + + Two new learning rate schedules added: `tf.keras.optimizers.schedules.CosineDecay` and`tf.keras.optimizers.schedules.CosineDecayRestarts`. +* `tf.data`: + + + Exposing `tf.data.experimental.ExternalStatePolicy`, which can be used to control how external state should be handled during dataset serialization or iterator checkpointing. + + Changing `tf.data.experimental.save` to store the type specification of the dataset elements. This avoids the need for explicitly specifying the `element_spec` argument of `tf.data.experimental.load` when loading the previously saved dataset. + + Add `.element_spec` property to `tf.data.DatasetSpec` to access the inner spec. This can be used to extract the structure of nested + datasets. + + Add `tf.data.experimental.AutoShardingPolicy.HINT` which can be used to provide hints to tf.distribute-based auto-sharding as to where in the input pipeline to insert sharding transformations. + + Make tf.data.Options persistent across `tf.function` and `GraphDef` boundaries. +* XLA compilation: + + + `tf.function(experimental_compile=True)` has become a stable API, renamed `tf.function(jit_compile=True)`. + + XLA can now compile MirroredStrategy: the step function passed to`strategy.run` can now be annoted with `jit_compile=True`. +* `tf.distribute`: + + + Rename `experimental_prefetch_to_device` in `tf.distribute.InputOptions` to `experimental_fetch_to_device` to better reflect the purpose. +* `tf.lite`: + + + class `tflite::Subgraph`: + - Removed the `tensors()` method and the non-const overload of the `nodes_and_registration()` method, both of which were previously documented as temporary and to be removed. + * Uses of `tensors()` can be replaced by calling the existing methods `tensors_size()` and `tensor(int)`. + * Uses of the non-const overload of `nodes_and_registration` can be replaced by calling the existing methods `nodes_size()` and `context()`, and then calling the `GetNodeAndRegistration` method in the `TfLiteContext` returned by `context()`. + + NNAPI + - Removed deprecated `Interpreter::UseNNAPI(bool)` C++ API. + * Use `NnApiDelegate()` and related delegate configuration methods directly. + - Replaced the model cache key for models computation algorithm with one guaranteed to be stable across runs. + + 16 bits quantization + - Added int16x8 support for ABS, REDUCE\_MAX and REDUCE\_MIN operators. + - Additional tests and fixes for ADD and SUB operators. + + Added support for saved model's session initializer through `TFLiteConverter.from_saved_model`. + + Added DEPTH\_TO\_SPACE support in Post training quantization. + + Added dynamic range quantization support for the BatchMatMul op. + - Both symmetric and asymmetric quantized input tensor are supported. + + Add `RFFT2D` as builtin op. (`RFFT2D` also supports `RFFTD`.) Currently only supports float32 input. + + Add 5D support to `SLICE` op. + + TFLite Supports SingatureDef: + - TFLiteConverter exports models with SignatureDef + - Interpreter supports getting a list of signatures and getting callable function for a given signaturedef. + + Add int8 support for `ReshapeV2`. + + Add experimental support for optimization with sparsity. + + Add nominal support for unsigned 32-bit integer tensor types. Note that very few TFLite kernels support this type natively, so its use in mobile ML authoring is generally discouraged. + + Add support for static hash tables through `TFLiteConverter.from_saved_model`. + + The Python TF Lite Interpreter bindings now has an option `experimental_preserve_all_tensors` to aid in debugging conversion. + + Quantized x86 execution defaults to Ruy GEMM library for platforms with AVX support. + + Deprecate `tf.compat.v1.lite.experimental.get_potentially_supported_ops`. Use `tf.lite.TFLiteConverter` directly to check whether a model is convertible. + + Add support to select one of three different built-in op resolvers + + Enabled post training with calibrations for models that require user provided TensorFlow Lite custom op libraries via `converter.target_spec._experimental_custom_op_registerers`. used in Python Interpreter API. +* TF Core: + + + Corrected higher-order gradients of control flow constructs (`tf.cond`, `tf.while_loop`, and compositions like `tf.foldl`) computed with `tf.GradientTape` inside a `tf.function`. + + Changed the default step size in `gradient_checker_v2.compute_gradients` to be exactly representable as a binary floating point numbers. This avoids poluting gradient approximations needlessly, which is some cases leads to false negatives in op gradient tests. + + Added `tf.config.experimental.get_memory_info`, returning a dict with the current and peak memory usage. Deprecated `tf.config.experimental.get_memory_usage` in favor of this new function. + + Extended `tf.config.experimental.enable_tensor_float_32_execution` to control Tensor-Float-32 evaluation in RNNs. + + Added a 'experimental\_payloads' field to tf.errors.OpError and its subclasses to support more detailed error reporting. This is inspired from Abseil Status payloads: +* `tf.summary`: + + + New `tf.summary.graph` allows manual write of TensorFlow graph (`tf.Graph` or `tf.compat.v1.GraphDef`) as a summary. This is not a replacement for the trace-based API. +* Set `/d2ReducedOptimizeHugeFunctions` by default for Windows builds. This provides a big compile-time speedup, and effectively raises the minimum supported MSVC version to 16.4 (current: 16.8). + + + See: +* TensorRT + + + Removed the deprecated `session_config` parameter for the TF1-TRT converter `TrtGraphConverter`. Previously, we issued a warning when the value of the parameter is not None. + + The TF2-TRT converter `TrtGraphConverterV2` takes an object of class TrtConversionParams as a parameter. Removed three deprecated fields from this class: `rewriter_config_template`, `is_dynamic_op`, and `max_batch_size`. Previously, we issued a warning when the value of `rewriter_config_template` is not None. We issued an error when the value of `is_dynamic_op` is not True. We didn't use the value for `max_batch_size` for building TensorRT engines. Add parameters `use_dynamic_shape` to enable dynamic shape support. The default is to disable dynamic shape support. Add `dynamic_shape_profile_strategy` for selecting a dynamic shape profile strategy. The default is profile strategy is `Range`. + + Issue a warning when function get\_tensorrt\_rewriter\_config is used. +* TF XLA + + + Add new enum value `MLIR_BRIDGE_ROLLOUT_SAFE_MODE_ENABLED` to `tf.config.experimental.mlir_bridge_rollout` to enable a "safe" mode. This runs the MLIR bridge only when an analysis of the graph only when an analysis of the graph determines that it is safe to run. + + Add new enum value `MLIR_BRIDGE_ROLLOUT_SAFE_MODE_FALLBACK_ENABLED' to` tf.config.experimental.mlir\_bridge\_rollout` to enable a fallback for the MLIR bridge in a "safe" mode. This runs the MLIR bridge in a FallbackEnabled mode when an analysis of the graph determines that the graph does not have unsupported features. +* Deterministic Op Functionality: + + + Add determinism-unimplemented exception-throwing to the segment-sum ops. When the environment variable `TF_DETERMINISTIC_OPS` is set to `"true"` or `"1"` (when op-determinism is expected), an attempt to run the following ops on a GPU will throw `tf.errors.UnimplementedError` (with an understandable message) when `data` is a floating-point type, including complex types (if supported): `tf.math.segment_prod`, `tf.math.segment_sum`, `tf.math.unsorted_segment_mean`, `tf.math.unsorted_segment_sqrt_n`, `tf.math.unsorted_segment_prod`, `tf.math.unsorted_segment_sum`, and therefore also `tf.convert_to_tensor` when `value` is of type `tf.IndexedSlices` (such as in the back prop though `tf.gather` into a dense embedding). See issue [39751](https://github.com/tensorflow/tensorflow/issues/39751) which this change addresses, but does not solve. This exception-throwing behavior can be disabled by setting the environment variable `TF_DISABLE_SEGMENT_REDUCTION_OP_DETERMINISM_EXCEPTIONS` to `"true"` or + `"1"`. For more information about these changes, see the description in pull request [47772](https://github.com/tensorflow/tensorflow/pull/47772). + + In previous versions of TensorFlow, when a GPU was available, `tf.sparse.sparse_dense_matmul` introduced truly random noise in the forward path for data of type `tf.float32` but not for data of type `tf.float64` (for which there was no GPU implementation). In this current release, GPU support for other floating-point types (`tf.float16`, `tf.float64`, `tf.complex64`, and `tf.complex128`) has been added for this op. If you were relying on the determinism of the `tf.float64` CPU implementation being automatically selected because of the absence of the `tf.float64` GPU implementation, you with either need to force the op to run on the CPU or use a different data type. +* Security + + + Fixes a heap buffer overflow in `RaggedBinCount` ([CVE-2021-29512](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29512)) + + Fixes a heap out of bounds write in `RaggedBinCount` ([CVE-2021-29514](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29514)) + + Fixes a type confusion during tensor casts which leads to dereferencing null pointers ([CVE-2021-29513](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29513)) + + Fixes a reference binding to null pointer in `MatrixDiag*` ops ([CVE-2021-29515](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29515)) + + Fixes a null pointer dereference via invalid Ragged Tensors ([CVE-2021-29516](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29516)) + + Fixes a division by zero in `Conv3D` ([CVE-2021-29517](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29517)) + + Fixes vulnerabilities where session operations in eager mode lead to null pointer dereferences ([CVE-2021-29518](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29518)) + + Fixes a `CHECK`-fail in `SparseCross` caused by type confusion ([CVE-2021-29519](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29519)) + + Fixes a segfault in `SparseCountSparseOutput` ([CVE-2021-29521](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29521)) + + Fixes a heap buffer overflow in `Conv3DBackprop*` ([CVE-2021-29520](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29520)) + + Fixes a division by 0 in `Conv3DBackprop*` ([CVE-2021-29522](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29522)) + + Fixes a `CHECK`-fail in `AddManySparseToTensorsMap` ([CVE-2021-29523](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29523)) + + Fixes a division by 0 in `Conv2DBackpropFilter` ([CVE-2021-29524](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29524)) + + Fixes a division by 0 in `Conv2DBackpropInput` ([CVE-2021-29525](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29525)) + + Fixes a division by 0 in `Conv2D` ([CVE-2021-29526](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29526)) + + Fixes a division by 0 in `QuantizedConv2D` ([CVE-2021-29527](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29527)) + + Fixes a division by 0 in `QuantizedMul` ([CVE-2021-29528](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29528)) + + Fixes vulnerabilities caused by invalid validation in `SparseMatrixSparseCholesky` ([CVE-2021-29530](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29530)) + + Fixes a heap buffer overflow caused by rounding ([CVE-2021-29529](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29529)) + + Fixes a `CHECK`-fail in `tf.raw_ops.EncodePng` ([CVE-2021-29531](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29531)) + + Fixes a heap out of bounds read in `RaggedCross` ([CVE-2021-29532](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29532)) + + Fixes a `CHECK`-fail in `DrawBoundingBoxes` ([CVE-2021-29533](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29533)) + + Fixes a heap buffer overflow in `QuantizedMul` ([CVE-2021-29535](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29535)) + + Fixes a `CHECK`-fail in `SparseConcat` ([CVE-2021-29534](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29534)) + + Fixes a heap buffer overflow in `QuantizedResizeBilinear` ([CVE-2021-29537](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29537)) + + Fixes a heap buffer overflow in `QuantizedReshape` ([CVE-2021-29536](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29536)) + + Fixes a division by zero in `Conv2DBackpropFilter` ([CVE-2021-29538](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29538)) + + Fixes a heap buffer overflow in `Conv2DBackpropFilter` ([CVE-2021-29540](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29540)) + + Fixes a heap buffer overflow in `StringNGrams` ([CVE-2021-29542](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29542)) + + Fixes a null pointer dereference in `StringNGrams` ([CVE-2021-29541](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29541)) + + Fixes a `CHECK`-fail in `QuantizeAndDequantizeV4Grad` ([CVE-2021-29544](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29544)) + + Fixes a `CHECK`-fail in `CTCGreedyDecoder` ([CVE-2021-29543](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29543)) + + Fixes a heap buffer overflow in `SparseTensorToCSRSparseMatrix` ([CVE-2021-29545](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29545)) + + Fixes a division by 0 in `QuantizedBiasAdd` ([CVE-2021-29546](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29546)) + + Fixes a heap out of bounds in `QuantizedBatchNormWithGlobalNormalization` ([CVE-2021-29547](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29547)) + + Fixes a division by 0 in `QuantizedBatchNormWithGlobalNormalization` ([CVE-2021-29548](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29548)) + + Fixes a division by 0 in `QuantizedAdd` ([CVE-2021-29549](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29549)) + + Fixes a division by 0 in `FractionalAvgPool` ([CVE-2021-29550](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29550)) + + Fixes an OOB read in `MatrixTriangularSolve` ([CVE-2021-29551](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29551)) + + Fixes a heap OOB in `QuantizeAndDequantizeV3` ([CVE-2021-29553](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29553)) + + Fixes a `CHECK`-failure in `UnsortedSegmentJoin` ([CVE-2021-29552](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29552)) + + Fixes a division by 0 in `DenseCountSparseOutput` ([CVE-2021-29554](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29554)) + + Fixes a division by 0 in `FusedBatchNorm` ([CVE-2021-29555](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29555)) + + Fixes a division by 0 in `SparseMatMul` ([CVE-2021-29557](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29557)) + + Fixes a division by 0 in `Reverse` ([CVE-2021-29556](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29556)) + + Fixes a heap buffer overflow in `SparseSplit` ([CVE-2021-29558](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29558)) + + Fixes a heap OOB access in unicode ops ([CVE-2021-29559](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29559)) + + Fixes a heap buffer overflow in `RaggedTensorToTensor` ([CVE-2021-29560](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29560)) + + Fixes a `CHECK`-fail in `LoadAndRemapMatrix` ([CVE-2021-29561](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29561)) + + Fixes a `CHECK`-fail in `tf.raw_ops.IRFFT` ([CVE-2021-29562](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29562)) + + Fixes a `CHECK`-fail in `tf.raw_ops.RFFT` ([CVE-2021-29563](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29563)) + + Fixes a null pointer dereference in `EditDistance` ([CVE-2021-29564](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29564)) + + Fixes a null pointer dereference in `SparseFillEmptyRows` ([CVE-2021-29565](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29565)) + + Fixes a heap OOB access in `Dilation2DBackpropInput` ([CVE-2021-29566](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29566)) + + Fixes a reference binding to null in `ParameterizedTruncatedNormal` ([CVE-2021-29568](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29568)) + + Fixes a set of vulnerabilities caused by lack of validation in `SparseDenseCwiseMul` ([CVE-2021-29567](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29567)) + + Fixes a heap out of bounds read in `MaxPoolGradWithArgmax` ([CVE-2021-29570](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29570)) + + Fixes a heap out of bounds read in `RequantizationRange` ([CVE-2021-29569](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29569)) + + Fixes a memory corruption in `DrawBoundingBoxesV2` ([CVE-2021-29571](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29571)) + + Fixes a reference binding to nullptr in `SdcaOptimizer` ([CVE-2021-29572](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29572)) + + Fixes an overflow and a denial of service in `tf.raw_ops.ReverseSequence` ([CVE-2021-29575](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29575)) + + Fixes a division by 0 in `MaxPoolGradWithArgmax` ([CVE-2021-29573](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29573)) + + Fixes an undefined behavior in `MaxPool3DGradGrad` ([CVE-2021-29574](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29574)) + + Fixes a heap buffer overflow in `MaxPool3DGradGrad` ([CVE-2021-29576](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29576)) + + Fixes a heap buffer overflow in `AvgPool3DGrad` ([CVE-2021-29577](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29577)) + + Fixes an undefined behavior and a `CHECK`-fail in `FractionalMaxPoolGrad` ([CVE-2021-29580](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29580)) + + Fixes a heap buffer overflow in `FractionalAvgPoolGrad` ([CVE-2021-29578](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29578)) + + Fixes a heap buffer overflow in `MaxPoolGrad` ([CVE-2021-29579](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29579)) + + Fixes a segfault in `CTCBeamSearchDecoder` ([CVE-2021-29581](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29581)) + + Fixes a heap OOB read in `tf.raw_ops.Dequantize` ([CVE-2021-29582](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29582)) + + Fixes a `CHECK`-fail due to integer overflow ([CVE-2021-29584](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29584)) + + Fixes a heap buffer overflow and undefined behavior in `FusedBatchNorm` ([CVE-2021-29583](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29583)) + + Fixes a division by zero in padding computation in TFLite ([CVE-2021-29585](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29585)) + + Fixes a division by zero in optimized pooling implementations in TFLite ([CVE-2021-29586](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29586)) + + Fixes a division by zero in TFLite's implementation of `SpaceToDepth` ([CVE-2021-29587](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29587)) + + Fixes a division by zero in TFLite's implementation of `GatherNd` ([CVE-2021-29589](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29589)) + + Fixes a division by zero in TFLite's implementation of `TransposeConv` ([CVE-2021-29588](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29588)) + + Fixes a heap OOB read in TFLite's implementation of `Minimum` or `Maximum` ([CVE-2021-29590](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29590)) + + Fixes a null pointer dereference in TFLite's `Reshape` operator ([CVE-2021-29592](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29592)) + + Fixes a stack overflow due to looping TFLite subgraph ([CVE-2021-29591](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29591)) + + Fixes a division by zero in TFLite's implementation of `DepthToSpace` ([CVE-2021-29595](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29595)) + + Fixes a division by zero in TFLite's convolution code ([CVE-2021-29594](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29594)) + + Fixes a division by zero in TFLite's implementation of `EmbeddingLookup` ([CVE-2021-29596](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29596)) + + Fixes a division by zero in TFLite's implementation of `BatchToSpaceNd` ([CVE-2021-29593](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29593)) + + Fixes a division by zero in TFLite's implementation of `SpaceToBatchNd` ([CVE-2021-29597](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29597)) + + Fixes a division by zero in TFLite's implementation of `SVDF` ([CVE-2021-29598](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29598)) + + Fixes a division by zero in TFLite's implementation of `Split` ([CVE-2021-29599](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29599)) + + Fixes a division by zero in TFLite's implementation of `OneHot` ([CVE-2021-29600](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29600)) + + Fixes a division by zero in TFLite's implementation of `DepthwiseConv` ([CVE-2021-29602](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29602)) + + Fixes a division by zero in TFLite's implementation of hashtable lookup ([CVE-2021-29604](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29604)) + + Fixes a integer overflow in TFLite concatentation ([CVE-2021-29601](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29601)) + + Fixes a integer overflow in TFLite memory allocation ([CVE-2021-29605](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29605)) + + Fixes a heap OOB write in TFLite ([CVE-2021-29603](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29603)) + + Fixes a heap OOB read in TFLite ([CVE-2021-29606](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29606)) + + Fixes a heap OOB and null pointer dereference in `RaggedTensorToTensor` ([CVE-2021-29608](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29608)) + + Fixes vulnerabilities caused by incomplete validation in `SparseAdd` ([CVE-2021-29609](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29609)) + + Fixes vulnerabilities caused by incomplete validation in `SparseSparseMinimum` ([CVE-2021-29607](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29607)) + + Fixes vulnerabilities caused by incomplete validation in `SparseReshape` ([CVE-2021-29611](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29611)) + + Fixes vulnerabilities caused by invalid validation in `QuantizeAndDequantizeV2` ([CVE-2021-29610](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29610)) + + Fixes a heap buffer overflow in `BandedTriangularSolve` ([CVE-2021-29612](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29612)) + + Fixes vulnerabilities caused by incomplete validation in `tf.raw_ops.CTCLoss` ([CVE-2021-29613](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29613)) + + Fixes an interpreter crash from vulnerabilities in `tf.io.decode_raw` ([CVE-2021-29614](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29614)) + + Fixes a stack overflow in `ParseAttrValue` with nested tensors ([CVE-2021-29615](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29615)) + + Fixes a null dereference in Grappler's `TrySimplify` ([CVE-2021-29616](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29616)) + + Fixes a crash in `tf.transpose` with complex inputs ([CVE-2021-29618](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29618)) + + Fixes a crash in `tf.strings.substr` due to `CHECK`-fail ([CVE-2021-29617](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29617)) + + Fixes a segfault in `tf.raw_ops.SparseCountSparseOutput` ([CVE-2021-29619](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29619)) + + Fixes a segfault in `tf.raw_ops.ImmutableConst` ([CVE-2021-29539](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29539)) + + Updates `curl` to `7.76.0` to handle [CVE-2020-8169](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-8169), [CVE-2020-8177](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-8177), [CVE-2020-8231](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-8231), [CVE-2020-8284](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-8284), [CVE-2020-8285](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-8285) and [CVE-2020-8286](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-8286). +* Other + + + Added `show_debug_info` to `mlir.convert_graph_def` and `mlir.convert_function`. + + Added [Arm Compute Library (ACL)](https://github.com/ARM-software/ComputeLibrary) support to `--config=mkl_aarch64` build. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +8bitmp3, Aaron S. Mondal, Abhilash Mahendrakar, Abhinav Upadhyay, Abhishek Kulkarni, Abolfazl Shahbazi, Adam Hillier, Aditya Kane, Ag Ramesh, ahmedsabie, Albert Villanova Del Moral, Aleksey Vitebskiy, Alex Hoffman, Alexander Bayandin, Alfie Edwards, Aman Kishore, Amogh Joshi, andreABbauer, Andrew Goodbody, Andrzej Pomirski, Artemiy Ryabinkov, Ashish Jha, ather, Ayan Moitra, Bairen Yi, Bart Ribbers, Bas Aarts, Behzad Abghari, Ben Arnao, Ben Barsdell, Benjamin Klimczak, bhack, Brendan Collins, Can Wang, Cheng Ren, Chris Leary, Chris Olivier, Clemens Giuliani, Cloud Han, Corey Cole, Cui, Yifeng, Cuong V. Nguyen, Daniel Moore, Dawid Wojciechowski, Ddavis-2015, Dean Wyatte, Denisa Roberts, dependabot[bot], Dmitry Volodin, Dominic Jack, Duncan Riach, dushuai, Elena Zhelezina, Eli Osherovich, Erik Smistad, ewsn1593, Felix Fent, fo40225, François Chollet, Frederic Bastien, Freedom" Koan-Sin Tan, fsx950223, ganand1, gbaned, Georgiy Manuilov, gerbauz, Guillaume Klein, Guozhong Zhuang, Harry Slatyer, Harsh188, henri, Henri Woodcock, Hiran Sarkar, Hollow Man, Håkon Sandsmark, I Wayan Dharmana, icysapphire, Ikko Ashimine, Jab Hofmeier, Jack Hessel, Jacob Valdez, Jakub Jatczak, James Bernardi, Jared Smolens, Jason Zaman, jedlimlx, Jenny Plunkett, Jens Elofsson, Jerry Shih, jgehw, Jia Fu Low, Jim Fisher, jpodivin, Julien Stephan, Jungsub Lim, Junha Park, Junhyuk So, justkw, Kaixi Hou, kashyapraval, Kasra Bigdeli, Kazuaki Ishizaki, Keith Mok, Kevin Cheng, kopytjuk, Kristian Hartikainen, ksood12345, Kulin Seth, kushanam, latyas, Lequn Chen, Leslie-Fang, Long M. Lưu, Lukas Geiger, machineko, Mahmoud Abuzaina, Manish, Mao Yunfei, Maozhou, Ge, Marcin Juszkiewicz, Marcin Owsiany, Marconi Jiang, Marcos Pereira, Maria Romanenko Vexlard, Maria Vexlard, Marius Brehler, marload, Martin Kubovčík, Matej, Mateusz Holenko, Maxiwell S. Garcia, Mazhar, mazharul, mbhuiyan, mdfaijul, Michael Gielda, Michael Kuchnik, Michal Szutenberg, Mikhail Stepanov, Milan Straka, Mitchel Humpherys, Mohamed Moselhy, Mohamed Nour Abouelseoud, Måns Bermell, Måns Nilsson, Nathan Luehr, Nico Jahn, Niroop Ammbashankar, Oceania2018, Omri Steiner, Orivej Desh, Oskar Flordal, oujiafan, Patrik Laurell, Paul B. Isaac'S, Paul Klinger, Pawel Piskorski, Pedro Marques, Phat Tran, Piotr Zierhoffer, piyushdatta, Pnikam-Cad, Prashant Kumar, Prateek Gupta, PratsBhatt, Pravin Karandikar, qqq.jq, QQ喵, Quintin, Rama Ketineni, ravikyram, Rehan Guha, rhdong, rmothukuru, Roger Cheng, Rohit Santhanam, rposts, Rsanthanam-Amd, rsun, Rsun-Bdti, Ryan Kuester, ryanking13, Saduf2019, Sami Kama, Samuel Marks, Scott Tseng, Sean Moriarity, Sergey Popov, Sergii Khomenko, Sheng, Yang, shwetaoj, Sidong-Wei, Simon Maurer, Simrit Kaur, Srini511, Srinivasan Narayanamoorthy, Stephan, Stephen Matthews, Sungmann Cho, Sunoru, Suraj Sudhir, Suraj Upadhyay, Taebum Kim, Takayoshi Koizumi, Tamas Bela Feher, Teng Lu, Thibaut Goetghebuer-Planchon, Tomwildenhain-Microsoft, Tony, Traun Leyden, Trent Lo, TVLIgnacy, Tzu-Wei Sung, vaibhav, Vignesh Kothapalli, Vikram Dattu, viktprog, Vinayaka Bandishti, Vincent Abriou, Vishakha Agrawal, Vivek Panyam, Vladimir Silyaev, Võ Văn Nghĩa, wamuir, Wang, Yanzhang, wangsiyu, Waqar Hameed, wxinix, Xiao Yang, xiaohong1031, Xiaoming (Jason) Cui, Xinan Jiang, Yair Ehrenwald, Yajush Vyas, Yasir Modak, Yimei Sun, Yong Tang, Yosshi999, youshenmebutuo, yqtianust, Yuan Tang, yuanbopeng, Yuriy Chernyshov, Yuta Fukasawa, Zachary Deane-Mayer, Zeno Gantner, Zhoulong Jiang, zhuyie, zilinzhu, 彭震东 diff --git a/corpus/changelog/tensorflow_releases/tensorflow_260.md b/corpus/changelog/tensorflow_releases/tensorflow_260.md new file mode 100644 index 0000000000000000000000000000000000000000..e93afe52b2a1d8842bfd500cc0788ec839fa17c0 --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_260.md @@ -0,0 +1,242 @@ +# TensorFlow 2.6.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v2.6.0 +Version: 2.6.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@tensorflow-jenkins](https://avatars.githubusercontent.com/u/16359713?s=40&v=4) +[tensorflow-jenkins](/tensorflow-jenkins) +released this +11 Aug 17:11 + +· +[384 commits](/tensorflow/tensorflow/compare/v2.6.0...r2.6) +to r2.6 +since this release + +[v2.6.0](/tensorflow/tensorflow/tree/v2.6.0) + +[`919f693`](/tensorflow/tensorflow/commit/919f693420e35d00c8d0a42100837ae3718f7927) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 2.6.0 + +## Breaking Changes + +* `tf.train.experimental.enable_mixed_precision_graph_rewrite` is removed, as the API only works in graph mode and is not customizable. The function is still accessible under `tf.compat.v1.mixed_precision.enable_mixed_precision_graph_rewrite`, but it is recommended to use the [Keras mixed precision API](https://www.tensorflow.org/guide/mixed_precision) instead. +* `tf.lite`: + + + Remove `experimental.nn.dynamic_rnn`, `experimental.nn.TfLiteRNNCell` and `experimental.nn.TfLiteLSTMCell` since they're no longersupported. It's recommended to just use [keras lstm](https://www.tensorflow.org/api_docs/python/tf/keras/layers/LSTM) instead. +* `tf.keras`: + + + Keras been split into a separate PIP package (`keras`), and its code has been moved to the GitHub repository[keras-team/keras](https://github.com/keras-team/keras). The API endpoints for `tf.keras` stay unchanged, but are now backed by the `keras` PIP package. The existing code in tensorflow/python/keras is a staled copy and will be removed in future release (2.7). Please remove any imports to `tensorflow.python.keras` and replace them with public tf.keras API instead. + + The methods `Model.to_yaml()` and `keras.models.model_from_yaml` have been replaced to raise a `RuntimeError` as they can be abused to cause arbitrary code execution. It is recommended to use JSON serialization instead of YAML, or, a better alternative, serialize to H5. + +## Known Caveats + +* TF Core: + + A longstanding bug in `tf.while_loop`, which caused it to execute sequentially, even when `parallel_iterations>1`, has now been fixed. However, the increased parallelism may result in increased memory use. Users who experience unwanted regressions should reset their `while_loop`'s `parallel_iterations` value to 1, which is consistent with prior behavior. + +## Major Features and Improvements + +* `tf.keras`: + + + Keras has been split into a separate PIP package (`keras`), and its code has been moved to the GitHub repository [keras-team/keras](https://github.com/keras-team/keras). + The API endpoints for `tf.keras` stay unchanged, but are now backed by the `keras` PIP package. All Keras-related PRs and issues should now be directed to the GitHub repository [keras-team/keras](https://github.com/keras-team/keras). + + `tf.keras.utils.experimental.DatasetCreator` now takes an optional `tf.distribute.InputOptions` for specific options when used with distribution. + + `tf.keras.experimental.SidecarEvaluator` is now available for a program intended to be run on an evaluator task, which is commonly used to supplement a training cluster running with `tf.distribute.experimental.ParameterServerStrategy` (see `). It can also be used with single-worker training or other strategies. See docstring for more info. + + Preprocessing layers moved from experimental to core. + - Import paths moved from `tf.keras.layers.preprocessing.experimental` to `tf.keras.layers`. + + Updates to Preprocessing layers API for consistency and clarity: + - `StringLookup` and `IntegerLookup` default for `mask_token` changed to `None`. This matches the default masking behavior of `Hashing` and `Embedding` layers. To keep existing behavior, pass `mask_token=""` during layer creation. + - Renamed `"binary"` output mode to `"multi_hot"` for `CategoryEncoding`, `StringLookup`, `IntegerLookup`, and `TextVectorization`. Multi-hot encoding will no longer automatically uprank rank 1 inputs, so these layers can now multi-hot encode unbatched multi-dimensional samples. + - Added a new output mode `"one_hot"` for `CategoryEncoding`, `StringLookup`, `IntegerLookup`, which will encode each element in an input batch individually, and automatically append a new output dimension if necessary. Use this mode on rank 1 inputs for the old `"binary"` behavior of one-hot encoding a batch of scalars. + - `Normalization` will no longer automatically uprank rank 1 inputs, allowing normalization of unbatched multi-dimensional samples. +* `tf.lite`: + + + The recommended Android NDK version for building TensorFlow Lite has been changed from r18b to r19c. + + Supports int64 for mul. + + Supports native variable builtin ops - ReadVariable, AssignVariable. + + Converter: + - Experimental support for variables in TFLite. To enable through conversion, users need to set `experimental_enable_resource_variables` on tf.lite.TFLiteConverter to True. + Note: mutable variables is only available using `from_saved_model` in this release, support for other methods is coming soon. + - Old Converter (TOCO) is getting removed from next release. It's been deprecated for few releases already. +* `tf.saved_model`: + + + SavedModels can now save custom gradients. Use the option `tf.saved_model.SaveOption(experimental_custom_gradients=True)` to enable this feature. The documentation in [Advanced autodiff](https://www.tensorflow.org/guide/advanced_autodiff#custom_gradients) has been updated. + + Object metadata has now been deprecated and no longer saved to the SavedModel. +* TF Core: + + + Added `tf.config.experimental.reset_memory_stats` to reset the tracked peak memory returned by `tf.config.experimental.get_memory_info`. +* `tf.data`: + + + Added `target_workers` param to `data_service_ops.from_dataset_id` and `data_service_ops.distribute`. Users can specify `"AUTO"`, `"ANY"`, or `"LOCAL"` (case insensitive). If `"AUTO"`, tf.data service runtime decides which workers to read from. If `"ANY"`, TF workers read from any tf.data service workers. If `"LOCAL"`, TF workers will only read from local in-processs tf.data service workers. `"AUTO"` works well for most cases, while users can specify other targets. For example, `"LOCAL"` would help avoid RPCs and data copy if every TF worker colocates with a tf.data service worker. Currently, `"AUTO"` reads from any tf.data service workers to preserve existing behavior. The default value is `"AUTO"`. + +## Bug Fixes and Other Changes + +* TF Core: + + Added `tf.lookup.experimental.MutableHashTable`, which provides a generic mutable hash table implementation. + - Compared to `tf.lookup.experimental.DenseHashTable` this offers lower overall memory usage, and a cleaner API. It does not require specifying a `delete_key` and `empty_key` that cannot be inserted into the table. + + Added support for specifying number of subdivisions in all reduce host collective. This parallelizes work on CPU and speeds up the collective performance. Default behavior is unchanged. + + Add an option `perturb_singular` to `tf.linalg.tridiagonal_solve` that allows solving linear systems with a numerically singular tridiagonal matrix, e.g. for use in inverse iteration. + + Added `tf.linalg.eigh_tridiagonal` that computes the eigenvalues of a Hermitian tridiagonal matrix. + + `tf.constant` now places its output on the current default device. + + SavedModel + - Added `tf.saved_model.experimental.TrackableResource`, which allows the creation of custom wrapper objects for resource tensors. + - Added a SavedModel load option to allow restoring partial checkpoints into the SavedModel. See [`tf.saved_model.LoadOptions`] + () for details. + + Added a new op `SparseSegmentSumGrad` to match the other sparse segment gradient ops and avoid an extra gather operation that was in the previous gradient implementation. + + Added a new session config setting `internal_fragmentation_fraction`, which controls when the BFC Allocator needs to split an oversized chunk to satisfy an allocation request. + + Added `tf.get_current_name_scope()` which returns the current full name scope string that will be prepended to op names. +* `tf.data`: + + Promoting `tf.data.experimental.bucket_by_sequence_length` API to `tf.data.Dataset.bucket_by_sequence_length` and deprecating the experimental endpoint. + + Promoting `tf.data.experimental.get_single_element` API to `tf.data.Dataset.get_single_element` and deprecating the experimental endpoint. + + Promoting `tf.data.experimental.group_by_window` API to `tf.data.Dataset.group_by_window` and deprecating the experimental endpoint. + + Promoting `tf.data.experimental.RandomDataset` API to `tf.data.Dataset.random` and deprecating the experimental endpoint. + + Promoting `tf.data.experimental.scan` API to `tf.data.Dataset.scan` and deprecating the experimental endpoint. + + Promoting `tf.data.experimental.snapshot` API to `tf.data.Dataset.shapshot` and deprecating the experimental endpoint. + + Promoting `tf.data.experimental.take_while` API to `tf.data.Dataset.take_while` and deprecating the experimental endpoint. + + Promoting `tf.data.experimental.ThreadingOptions` API to `tf.data.ThreadingOptions` and deprecating the experimental endpoint. + + Promoting `tf.data.experimental.unique` API to `tf.data.Dataset.unique` and deprecating the experimental endpoint. + + Added `stop_on_empty_dataset` parameter to `sample_from_datasets` and `choose_from_datasets`. Setting `stop_on_empty_dataset=True` will stop sampling if it encounters an empty dataset. This preserves the sampling ratio throughout training. The prior behavior was to continue sampling, skipping over exhausted datasets, until all datasets are exhausted. By default, the original behavior (`stop_on_empty_dataset=False`) is preserved. + + Removed previously deprecated tf.data statistics related APIs: + - `tf.data.Options.experimental_stats` + - `tf.data.experimental.StatsAggregator` + - `tf.data.experimental.StatsOptions.*` + - `tf.data.experimental.bytes_produced_stats` + - `tf.data.experimental.latency_stats` + + Removed the following experimental tf.data optimization APIs: + - `tf.data.experimental.MapVectorizationOptions.*` + - `tf.data.experimental.OptimizationOptions.filter_with_random_uniform_fusion` + - `tf.data.experimental.OptimizationOptions.hoist_random_uniform` + - `tf.data.experimental.OptimizationOptions.map_vectorization` \* `tf.data.experimental.OptimizationOptions.reorder_data_discarding_ops` +* `tf.keras`: + + Fix usage of `__getitem__` slicing in Keras Functional APIs when the inputs are `RaggedTensor` objects. + + Add `keepdims` argument to all `GlobalPooling` layers. + + Add `include_preprocessing` argument to `MobileNetV3` architectures to control the inclusion of `Rescaling` layer in the model. + + Add optional argument (`force`) to `make_(train|test|predict)_funtion` methods to skip the cached function and generate a new one. This is useful to regenerate in a single call the compiled training function when any `.trainable` attribute of any model's layer has changed. + + Models now have a `save_spec` property which contains the `TensorSpec` specs for calling the model. This spec is automatically saved when the model is called for the first time. +* `tf.linalg`: + + Add `CompositeTensor` as a base class to `LinearOperator`. +* `tf.lite`: + + Fix mean op reference quantization rounding issue. + + Added `framework_stable` BUILD target, which links in only the non-experimental TF Lite APIs. + + Remove deprecated Java `Interpreter` methods: + - `modifyGraphWithDelegate` - Use `Interpreter.Options.addDelegate` + - `setNumThreads` - Use `Interpreter.Options.setNumThreads` + + Add Conv3DTranspose as a builtin op. +* `tf.summary`: + + Fix `tf.summary.should_record_summaries()` so it correctly reflects when summaries will be written, even when `tf.summary.record_if()` is not n effect, by returning True tensor if default writer is present. +* Grappler: + + Disable default Grappler optimization timeout to make the optimization pipeline deterministic. This may lead to increased model loading time, because time spent in graph optimizations is now unbounded (was 20 minutes). +* Deterministic Op Functionality (enabled by setting `TF_DETERMINISTIC_OPS` to `"true"` or `"1"`): + + Add a deterministic GPU implementation of `tf.nn.softmax_cross_entropy_with_logits`. See PR [49178](https://github.com/tensorflow/tensorflow/pull/49178). + + Add a deterministic CPU implementation of `tf.image.crop_and_resize`. See PR [48905](https://github.com/tensorflow/tensorflow/pull/48905). + + Add determinism-unimplemented exception-throwing to the following ops. When op-determinism is expected, an attempt to use the specified paths through the following ops on a GPU will cause `tf.errors.UnimplementedError` (with an understandable message) to be thrown. + - `tf.nn.sparse_softmax_cross_entropy_with_logits` forwards and/or backwards. See PR [47925](https://github.com/tensorflow/tensorflow/pull/47925). + - `tf.image.crop_and_resize` gradient w.r.t. either `image` or `boxes`. See PR [48905](https://github.com/tensorflow/tensorflow/pull/48905). + - `tf.sparse.sparse_dense_matmul` forwards. See PR [50355](https://github.com/tensorflow/tensorflow/pull/50355). + +## Security + +* Fixes a heap out of bounds access in sparse reduction operations ([CVE-2021-37635](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37635)) +* Fixes a floating point exception in `SparseDenseCwiseDiv` ([CVE-2021-37636](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37636)) +* Fixes a null pointer dereference in `CompressElement` ([CVE-2021-37637](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37637)) +* Fixes a null pointer dereference in `RaggedTensorToTensor` ([CVE-2021-37638](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37638)) +* Fixes a null pointer dereference and a heap OOB read arising from operations restoring tensors ([CVE-2021-37639](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37639)) +* Fixes an integer division by 0 in sparse reshaping ([CVE-2021-37640](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37640)) +* Fixes a division by 0 in `ResourceScatterDiv` ([CVE-2021-37642](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37642)) +* Fixes a heap OOB in `RaggedGather` ([CVE-2021-37641](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37641)) +* Fixes a `std::abort` raised from `TensorListReserve` ([CVE-2021-37644](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37644)) +* Fixes a null pointer dereference in `MatrixDiagPartOp` ([CVE-2021-37643](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37643)) +* Fixes an integer overflow due to conversion to unsigned ([CVE-2021-37645](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37645)) +* Fixes a bad allocation error in `StringNGrams` caused by integer conversion ([CVE-2021-37646](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37646)) +* Fixes a null pointer dereference in `SparseTensorSliceDataset` ([CVE-2021-37647](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37647)) +* Fixes an incorrect validation of `SaveV2` inputs ([CVE-2021-37648](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37648)) +* Fixes a null pointer dereference in `UncompressElement` ([CVE-2021-37649](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37649)) +* Fixes a segfault and a heap buffer overflow in `{Experimental,}DatasetToTFRecord` ([CVE-2021-37650](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37650)) +* Fixes a heap buffer overflow in `FractionalAvgPoolGrad` ([CVE-2021-37651](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37651)) +* Fixes a use after free in boosted trees creation ([CVE-2021-37652](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37652)) +* Fixes a division by 0 in `ResourceGather` ([CVE-2021-37653](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37653)) +* Fixes a heap OOB and a `CHECK` fail in `ResourceGather` ([CVE-2021-37654](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37654)) +* Fixes a heap OOB in `ResourceScatterUpdate` ([CVE-2021-37655](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37655)) +* Fixes an undefined behavior arising from reference binding to nullptr in `RaggedTensorToSparse` ([CVE-2021-37656](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37656)) +* Fixes an undefined behavior arising from reference binding to nullptr in `MatrixDiagV*` ops ([CVE-2021-37657](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37657)) +* Fixes an undefined behavior arising from reference binding to nullptr in `MatrixSetDiagV*` ops ([CVE-2021-37658](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37658)) +* Fixes an undefined behavior arising from reference binding to nullptr and heap OOB in binary cwise ops ([CVE-2021-37659](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37659)) +* Fixes a division by 0 in inplace operations ([CVE-2021-37660](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37660)) +* Fixes a crash caused by integer conversion to unsigned ([CVE-2021-37661](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37661)) +* Fixes an undefined behavior arising from reference binding to nullptr in boosted trees ([CVE-2021-37662](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37662)) +* Fixes a heap OOB in boosted trees ([CVE-2021-37664](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37664)) +* Fixes vulnerabilities arising from incomplete validation in `QuantizeV2` ([CVE-2021-37663](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37663)) +* Fixes vulnerabilities arising from incomplete validation in MKL requantization ([CVE-2021-37665](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37665)) +* Fixes an undefined behavior arising from reference binding to nullptr in `RaggedTensorToVariant` ([CVE-2021-37666](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37666)) +* Fixes an undefined behavior arising from reference binding to nullptr in unicode encoding ([CVE-2021-37667](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37667)) +* Fixes an FPE in `tf.raw_ops.UnravelIndex` ([CVE-2021-37668](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37668)) +* Fixes a crash in NMS ops caused by integer conversion to unsigned ([CVE-2021-37669](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37669)) +* Fixes a heap OOB in `UpperBound` and `LowerBound` ([CVE-2021-37670](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37670)) +* Fixes an undefined behavior arising from reference binding to nullptr in map operations ([CVE-2021-37671](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37671)) +* Fixes a heap OOB in `SdcaOptimizerV2` ([CVE-2021-37672](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37672)) +* Fixes a `CHECK`-fail in `MapStage` ([CVE-2021-37673](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37673)) +* Fixes a vulnerability arising from incomplete validation in `MaxPoolGrad` ([CVE-2021-37674](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37674)) +* Fixes an undefined behavior arising from reference binding to nullptr in shape inference ([CVE-2021-37676](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37676)) +* Fixes a division by 0 in most convolution operators ([CVE-2021-37675](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37675)) +* Fixes vulnerabilities arising from missing validation in shape inference for `Dequantize` ([CVE-2021-37677](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37677)) +* Fixes an arbitrary code execution due to YAML deserialization ([CVE-2021-37678](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37678)) +* Fixes a heap OOB in nested `tf.map_fn` with `RaggedTensor`s ([CVE-2021-37679](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37679)) +* Fixes a division by zero in TFLite ([CVE-2021-37680](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37680)) +* Fixes an NPE in TFLite ([CVE-2021-37681](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37681)) +* Fixes a vulnerability arising from use of unitialized value in TFLite ([CVE-2021-37682](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37682)) +* Fixes an FPE in TFLite division operations ([CVE-2021-37683](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37683)) +* Fixes an FPE in TFLite pooling operations ([CVE-2021-37684](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37684)) +* Fixes an infinite loop in TFLite ([CVE-2021-37686](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37686)) +* Fixes a heap OOB in TFLite ([CVE-2021-37685](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37685)) +* Fixes a heap OOB in TFLite's `Gather*` implementations ([CVE-2021-37687](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37687)) +* Fixes an undefined behavior arising from null pointer dereference in TFLite ([CVE-2021-37688](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37688)) +* Fixes an undefined behavior arising from null pointer dereference in TFLite MLIR optimizations ([CVE-2021-37689](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37689)) +* Fixes a FPE in LSH in TFLite ([CVE-2021-37691](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37691)) +* Fixes a segfault on strings tensors with mismatched dimensions, arising in Go code ([CVE-2021-37692](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37692)) +* Fixes a use after free and a potential segfault in shape inference functions ([CVE-2021-37690](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-37690)) +* Updates `curl` to `7.77.0` to handle [CVE-2021-22876](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22876), [CVE-2021-22897](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22897), [CVE-2021-22898](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22898), and [CVE-2021-22901](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22901). + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +Aadhitya A, Abhilash Mahendrakar, Abhishek Varma, Abin Shahab, Adam Hillier, Aditya Kane, AdityaKane2001, ag.ramesh, Amogh Joshi, Armen Poghosov, armkevincheng, Avrosh K, Ayan Moitra, azazhu, Banikumar Maiti, Bas Aarts, bhack, Bhanu Prakash Bandaru Venkata, Billy Cao, Bohumir Zamecnik, Bradley Reece, CyanXu, Daniel Situnayake, David Pal, Ddavis-2015, DEKHTIARJonathan, Deven Desai, Duncan Riach, Edward, Eli Osherovich, Eugene Kuznetsov, europeanplaice, evelynmitchell, Evgeniy Polyakov, Felix Vollmer, Florentin Hennecker, François Chollet, Frederic Bastien, Fredrik Knutsson, Gabriele Macchi, Gaurav Shukla, Gauri1 Deshpande, geetachavan1, Georgiy Manuilov, H, Hengwen Tong, Henri Woodcock, Hiran Sarkar, Ilya Arzhannikov, Janghoo Lee, jdematos, Jens Meder, Jerry Shih, jgehw, Jim Fisher, Jingbei Li, Jiri Podivin, Joachim Gehweiler, Johannes Lade, Jonas I. Liechti, Jonas Liechti, Jonas Ohlsson, Jonathan Dekhtiar, Julian Gross, Kaixi Hou, Kevin Cheng, Koan-Sin Tan, Kulin Seth, linzewen, Liubov Batanina, luisleee, Lukas Geiger, Mahmoud Abuzaina, mathgaming, Matt Conley, Max H. Gerlach, mdfaijul, Mh Kwon, Michael Martis, Michal Szutenberg, Måns Nilsson, nammbash, Neil Girdhar, Nicholas Vadivelu, Nick Kreeger, Nirjas Jakilim, okyanusoz, Patrice Vignola, Patrik Laurell, Pedro Marques, Philipp Hack, Phillip Cloud, Piergiacomo De Marchi, Prashant Kumar, puneeshkhanna, pvarouktsis, QQ喵, Rajeshwar Reddy T, Rama Ketineni, Reza Rahimi, Robert Kalmar, rsun, Ryan Kuester, Saduf2019, Sean Morgan, Sean Moriarity, Shaochen Shi, Sheng, Yang, Shu Wang, Shuai Zhang, Soojeong, Stanley-Nod, Steven I Reeves, stevenireeves, Suraj Sudhir, Sven Mayer, Tamas Bela Feher, tashuang.zk, tcervi, Teng Lu, Thales Elero Cervi, Thibaut Goetghebuer-Planchon, Thomas Walther, Till Brychcy, Trent Lo, Uday Bondhugula, vishakha.agrawal, Vishnuvardhan Janapati, wamuir, Wenwen Ouyang, wenwu, Williard Joshua Jose, xiaohong1031, Xiaoming (Jason) Cui, Xinan Jiang, Yasir Modak, Yi Li, Yong Tang, zilinzhu, 박상준, 이장 diff --git a/corpus/changelog/tensorflow_releases/tensorflow_270.md b/corpus/changelog/tensorflow_releases/tensorflow_270.md new file mode 100644 index 0000000000000000000000000000000000000000..7695c54f96c0eb963b4ed2a237f365dadaf19444 --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_270.md @@ -0,0 +1,278 @@ +# TensorFlow 2.7.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v2.7.0 +Version: 2.7.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@tensorflow-jenkins](https://avatars.githubusercontent.com/u/16359713?s=40&v=4) +[tensorflow-jenkins](/tensorflow-jenkins) +released this +04 Nov 21:39 + +· +[429 commits](/tensorflow/tensorflow/compare/v2.7.0...r2.7) +to r2.7 +since this release + +[v2.7.0](/tensorflow/tensorflow/tree/v2.7.0) + +[`c256c07`](/tensorflow/tensorflow/commit/c256c071bb26e1e13b4666d1b3e229e110bc914a) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 2.7.0 + +## Breaking Changes + +* `tf.keras`: + + + The methods `Model.fit()`, `Model.predict()`, and `Model.evaluate()` will no longer uprank input data of shape `(batch_size,)` to become `(batch_size, 1)`. This enables `Model` subclasses to process scalar data in their `train_step()`/`test_step()`/`predict_step()` methods. + Note that this change may break certain subclassed models. You can revert back to the previous behavior by adding upranking yourself in the `train_step()`/`test_step()`/`predict_step()` methods, e.g. `if x.shape.rank == 1: x = tf.expand_dims(x, axis=-1)`. Functional models as well as Sequential models built with an explicit input shape are not affected. + + The methods `Model.to_yaml()` and `keras.models.model_from_yaml` have been replaced to raise a `RuntimeError` as they can be abused to cause arbitrary code execution. It is recommended to use JSON serialization instead of YAML, or, a better alternative, serialize to H5. + + `LinearModel` and `WideDeepModel` are moved to the `tf.compat.v1.keras.models.` namespace (`tf.compat.v1.keras.models.LinearModel` and `tf.compat.v1.keras.models.WideDeepModel`), and their `experimental` endpoints (`tf.keras.experimental.models.LinearModel` and `tf.keras.experimental.models.WideDeepModel`) are being deprecated. + + RNG behavior change for all `tf.keras.initializers` classes. For any class constructed with a fixed seed, it will no longer generate same value when invoked multiple times. Instead, it will return different value, but a determinisitic sequence. This change will make the initialize behavior align between v1 and v2. +* `tf.lite`: + + + Rename fields `SignatureDef` table in schema to maximize the parity with TF SavedModel's Signature concept. + + Deprecate Makefile builds. Makefile users need to migrate their builds to CMake or Bazel. Please refer to the [Build TensorFlow Lite with CMake](https://www.tensorflow.org/lite/guide/build_cmake) and [Build TensorFlow Lite for ARM boards](https://www.tensorflow.org/lite/guide/build_arm) for the migration. + + Deprecate `tflite::OpResolver::GetDelegates`. The list returned by TfLite's `BuiltinOpResolver::GetDelegates` is now always empty. Instead, recommend using new method `tflite::OpResolver::GetDelegateCreators` in order to achieve lazy initialization on TfLite delegate instances. +* TF Core: + + + `tf.Graph.get_name_scope()` now always returns a string, as documented. Previously, when called within `name_scope("")` or `name_scope(None)` contexts, it returned `None`; now it returns the empty string. + + `tensorflow/core/ir/` contains a new MLIR-based Graph dialect that is isomorphic to GraphDef and will be used to replace GraphDef-based (e.g., Grappler) optimizations. + + Deprecated and removed `attrs()` function in shape inference. All attributes should be queried by name now (rather than range returned) to enable changing the underlying storage there. + + The following Python symbols were accidentally added in earlier versions of TensorFlow and now are removed. Each symbol has a replacement that should be used instead, but note the replacement's argument names are different. + - `tf.quantize_and_dequantize_v4` (accidentally introduced in TensorFlow 2.4): Use `tf.quantization.quantize_and_dequantize_v2` instead. + - `tf.batch_mat_mul_v3` (accidentally introduced in TensorFlow 2.6): Use `tf.linalg.matmul` instead. + - `tf.sparse_segment_sum_grad` (accidentally introduced in TensorFlow 2.6): Use `tf.raw_ops.SparseSegmentSumGrad` instead. Directly calling this op is typically not necessary, as it is automatically used when computing the gradient of `tf.sparse.segment_sum`. + + Renaming of tensorflow::int64 to int\_64\_t in numerous places (the former is an alias for the latter) which could result in needing to regenerate selective op registration headers else execution would fail with unregistered kernels error. +* Modular File System Migration: + + + Support for S3 and HDFS file systems has been migrated to a modular file systems based approach and is now available in . The `tensorflow-io` python package should be installed for S3 and HDFS support with tensorflow. + +## Major Features and Improvements + +* Improvements to the TensorFlow debugging experience: + + + Previously, TensorFlow error stack traces involved many internal frames, which could be challenging to read through, while not being actionable for end users. As of TF 2.7, TensorFlow filters internal frames in most errors that it raises, to keep stack traces short, readable, and focused on what's actionable for end users (their own code). + + This behavior can be disabled by calling `tf.debugging.disable_traceback_filtering()`, and can be re-enabled via `tf.debugging.enable_traceback_filtering()`. If you are debugging a TensorFlow-internal issue (e.g. to prepare a TensorFlow PR), make sure to disable traceback filtering. You can check whether this feature is currently enabled by calling `tf.debugging.is_traceback_filtering_enabled()`. + + Note that this feature is only available with Python 3.7 or higher. + + Improve the informativeness of error messages raised by Keras `Layer.__call__()`, by adding the full list of argument values passed to the layer in every exception. +* Introduce the `tf.compat.v1.keras.utils.track_tf1_style_variables` decorator, which enables using large classes of tf1-style variable\_scope, `get_variable`, and `compat.v1.layer`-based components from within TF2 models running with TF2 behavior enabled. +* `tf.data`: + + + tf.data service now supports auto-sharding. Users specify the sharding policy with `tf.data.experimental.service.ShardingPolicy` enum. It can be one of `OFF` (equivalent to today's `"parallel_epochs"` mode), `DYNAMIC` (equivalent to today's `"distributed_epoch"` mode), or one of the static sharding policies: `FILE`, `DATA`, `FILE_OR_DATA`, or `HINT` (corresponding to values of `tf.data.experimental.AutoShardPolicy`). + + Static sharding (auto-sharding) requires the number of tf.data service workers be fixed. Users need to specify the worker addresses in `tensorflow.data.experimental.DispatcherConfig`. + + `tf.data.experimental.service.register_dataset` now accepts optional `compression` argument. +* Keras: + + + `tf.keras.layers.Conv` now includes a public `convolution_op` method. This method can be used to simplify the implementation of Conv subclasses. There are two primary ways to use this new method. The first is to use the method directly in your own `call` method: + + ```None + class StandardizedConv2D(tf.keras.layers.Conv2D): + def call(self, inputs): + mean, var = tf.nn.moments(self.kernel, axes=[0, 1, 2], keepdims=True) + return self.convolution_op(inputs, (self.kernel - mean) / tf.sqrt(var + 1e-10)) + ``` + + Alternatively, you can override `convolution_op`: + + ```None + class StandardizedConv2D(tf.keras.Layer): + def convolution_op(self, inputs, kernel): + mean, var = tf.nn.moments(kernel, axes=[0, 1, 2], keepdims=True) + # Author code uses std + 1e-5 + return super().convolution_op(inputs, (kernel - mean) / tf.sqrt(var + 1e-10)) + ``` + + Added `merge_state()` method to `tf.keras.metrics.Metric` for use in distributed computations. + + Added `sparse` and `ragged` options to `tf.keras.layers.TextVectorization` to allow for `SparseTensor` and `RaggedTensor` outputs from the layer. +* distribute.experimental.rpc package: + + + distribute.experimental.rpc package introduces APIs to create a GRPC based server to register tf.function methods and a GRPC client to invoke remote registered methods. RPC APIs are intended for multi-client setups i.e. server and clients are started in separate binaries independently. + + Example usage to create server: + + ```None + server = tf.distribute.experimental.rpc.Server.create("grpc", + "127.0.0.1:1234") + @tf.function(input_signature=[ + tf.TensorSpec([], tf.int32), + tf.TensorSpec([], dtypes.int32) + ]) + def _remote_multiply(a, b): + return tf.math.multiply(a, b) + + server.register("multiply", _remote_multiply) + ``` + + Example usage to create client: + + ```None + client = tf.distribute.experimental.rpc.Client.create("grpc", address) + a = tf.constant(2, dtype=tf.int32) + b = tf.constant(3, dtype=tf.int32) + result = client.multiply(a, b) + ``` +* `tf.lite`: + + + Add experimental API `experimental_from_jax` to support conversion from Jax models to TensorFlow Lite. + + Support uint32 data type for cast op. + + Add experimental quantization debugger `tf.lite.QuantizationDebugger` +* Extension Types + + + Add experimental API to define new Python classes that can be handled by TensorFlow APIs. To create an extension type, simply define a Python class with `tf.experimental.ExtensionType` as its base, and use type annotations to specify the type for each field. E.g.: + + ```None + class MaskedTensor(tf.experimental.ExtensionType): + values: tf.Tensor + mask: tf.Tensor + ``` + + The `tf.ExtensionType` base class works similarly to [`typing.NamedTuple`](https://docs.python.org/3/library/typing.html#typing.NamedTuple) and [`@dataclasses.dataclass`](https://docs.python.org/3/library/dataclasses.html#dataclasses.dataclass) from the standard Python library. + + Extension types are supported by Keras, tf.data, TF-hub, SavedModel, tf.function, control flow ops, py\_function, and distribution strategy. + + Add "dispatch decorators" that can be used to override the default behavior of TensorFlow ops (such as `tf.add` or `tf.concat`) when they are applied to ExtensionType values. + + The `BatchableExtensionType` API can be used to define extension types that support APIs that make use of batching, such as `tf.data.Dataset` and `tf.map_fn`. + + For more information, see the [Extension types guide](https://www.tensorflow.org/guide/extension_type). + +## Bug Fixes and Other Changes + +* TF Core: + + Random number generation (RNG) system + - Add argument `alg` to `tf.random.stateless_*` functions to explicitly select the RNG algorithm. + - Add `tf.nn.experimental.stateless_dropout`, a stateless version of `tf.nn.dropout`. + - `tf.random.Generator` now can be created inside the scope of `tf.distribute.experimental.ParameterServerStrategy` and `tf.distribute.experimental.CentralStorageStrategy`. + + Add an experimental session config `tf.experimental.disable_functional_ops_lowering` which disables functional control flow op lowering optimization. This is useful when executing within a portable runtime where control flow op kernels may not be loaded due to selective registration. + + Add a new experimental argument `experimental_is_anonymous` to `tf.lookup.StaticHashTable.__init__` to create the table in anonymous mode. In this mode, the table resource can only be accessed via resource handles (not resource names) and will be deleted automatically when all resource handles pointing to it are gone. +* `tf.data`: + + Introduce the `tf.data.experimental.at` API which provides random access for input pipelines that consist of transformations that support random access. The initial set of transformations that support random access includes: `tf.data.Dataset.from_tensor_slices`,`tf.data.Dataset.shuffle`, `tf.data.Dataset.batch`, `tf.data.Dataset.shard`, `tf.data.Dataset.map`, and `tf.data.Dataset.range`. + + Promote `tf.data.Options.experimental_deterministic` API to `tf.data.Options.deterministic` and deprecate the experimental endpoint. + + Move autotuning options from`tf.data.Options.experimental_optimization.autotune*` to a newly created `tf.data.Options.autotune.*` and remove support for `tf.data.Options.experimental_optimization.autotune_buffers`. + + Add support for user-defined names of tf.data core Python API, which can be used to disambiguate tf.data events in TF Profiler Trace Viewer. + + Promote `tf.data.experimental.sample_from_datasets` API to `tf.data.Dataset.sample_from_datasets` and deprecate the experimental endpoint. + + Added `TF_GPU_ALLOCATOR=cuda_malloc_async` that use cudaMallocAsync from CUDA 11.2. This could become the default in the future. +* TF SavedModel: + + Custom gradients are now saved by default. See `tf.saved_model.SaveOptions` to disable this. + + The saved\_model\_cli's `--input_examples` inputs are now restricted to + python literals to avoid code injection. +* XLA: + + Add a new API that allows custom call functions to signal errors. The old API will be deprecated in a future release. See for details. + + XLA:GPU reductions are deterministic by default (reductions within `jit_compile=True` are now deterministic). + + XLA:GPU works with Horovod (OSS contribution by Trent Lo from NVidia) +* `tf.saved_model.save`: + + When saving a model, not specifying a namespace whitelist for custom ops with a namespace will now default to allowing rather than rejecting them all. +* Deterministic Op Functionality (enabled by setting the environment variable `TF_DETERMINISTIC_OPS` to `"true"` or `"1"`): + + Add determinsitic GPU implementations of: + - `tf.math.segment_sum` + - `tf.math.segment_prod` + - `tf.math.segment_mean` + - `tf.math.unsorted_segment_sum` + - `tf.math.unsorted_segment_prod` + - `tf.math.unsorted_segment_sqrt` + - `tf.math.unsorted_segment_mean` + - `tf.gather` backprop + - `tf.convert_to_tensor` when fed with (sparse) `tf.IndexedSlices` + - `tf.nn.sparse_softmax_crossentropy_with_logits` + - `tf.nn.ctc_loss` (resolved, possibly in prior release, and confirmed with tests) + - stateful ops used in `tf.data.Dataset` + + Run the following ops on CPU (with significant performance penalty): + - `tf.scatter_nd` and other related scatter functions, such as `tf.tensor_scatter_nd_update` + + Add determinism-unimplemented exception-throwing to the following ops. When op-determinism is expected (i.e. when the environment variable `TF_DETERMINISTIC_OPS` is set to `"true"` or `"1"`), an attempt to use the specified paths through the following ops on a GPU will cause `tf.errors.UnimplementedError` (with an understandable message), unless otherwise specified, to be thrown. + - `tf.compat.v1.nn.fused_batch_norm` backprop to `offset` when `is_training=False` + - `tf.image.adjust_contrast` forward + - `tf.nn.depthwise_conv2d` backprop to `filter` when not using cuDNN convolution + - `tf.image.resize` with `method=ResizeMethod.NEAREST` backprop + - `tf.math.bincount` - TODO: confirm exception added + - `tf.raw_ops.DebugNumericSummary` and `tf.raw_ops.DebugNumericSummaryV2` + - `tf.Variable.scatter_add` (and other scatter methods, both on ref and resource variables) + - `tf.linalg.svd` + - `tf.nn.dilation2d` gradient + - `tf.nn.max_pool_with_argmax` gradient + - `tf.timestamp`. Throws `FailedPrecondition` + - The random-number-generating ops in the `tf.random` module when the global random seed has not yet been set (via `tf.random.set_seed`). Throws `RuntimeError` from Python or `InvalidArgument` from C++ + - `tf.compat.v1.get_seed` if the global random seed has not yet been set (via `tf.random.set_seed`). Throws `RuntimeError` from Python or `InvalidArgument` from C++ + +## Security + +* Fixes a code injection issue in `saved_model_cli` ([CVE-2021-41228](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41228)) +* Fixes a vulnerability due to use of uninitialized value in Tensorflow ([CVE-2021-41225](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41225)) +* Fixes a heap OOB in `FusedBatchNorm` kernels ([CVE-2021-41223](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41223)) +* Fixes an arbitrary memory read in `ImmutableConst` ([CVE-2021-41227](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41227)) +* Fixes a heap OOB in `SparseBinCount` ([CVE-2021-41226](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41226)) +* Fixes a heap OOB in `SparseFillEmptyRows` ([CVE-2021-41224](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41224)) +* Fixes a segfault due to negative splits in `SplitV` ([CVE-2021-41222](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41222)) +* Fixes segfaults and vulnerabilities caused by accesses to invalid memory during shape inference in `Cudnn*` ops ([CVE-2021-41221](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41221)) +* Fixes a null pointer exception when `Exit` node is not preceded by `Enter` op ([CVE-2021-41217](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41217)) +* Fixes an integer division by 0 in `tf.raw_ops.AllToAll` ([CVE-2021-41218](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41218)) +* Fixes a use after free and a memory leak in `CollectiveReduceV2` ([CVE-2021-41220](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41220)) +* Fixes an undefined behavior via `nullptr` reference binding in sparse matrix multiplication ([CVE-2021-41219](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41219)) +* Fixes a heap buffer overflow in `Transpose` ([CVE-2021-41216](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41216)) +* Prevents deadlocks arising from mutually recursive `tf.function` objects ([CVE-2021-41213](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41213)) +* Fixes a null pointer exception in `DeserializeSparse` ([CVE-2021-41215](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41215)) +* Fixes an undefined behavior arising from reference binding to `nullptr` in `tf.ragged.cross` ([CVE-2021-41214](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41214)) +* Fixes a heap OOB read in `tf.ragged.cross` ([CVE-2021-41212](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41212)) +* Fixes a heap OOB in shape inference for `QuantizeV2` ([CVE-2021-41211](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41211)) +* Fixes a heap OOB read in all `tf.raw_ops.QuantizeAndDequantizeV*` ops ([CVE-2021-41205](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41205)) +* Fixes an FPE in `ParallelConcat` ([CVE-2021-41207](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41207)) +* Fixes FPE issues in convolutions with zero size filters ([CVE-2021-41209](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41209)) +* Fixes a heap OOB read in `tf.raw_ops.SparseCountSparseOutput` ([CVE-2021-41210](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41210)) +* Fixes vulnerabilities caused by incomplete validation in boosted trees code ([CVE-2021-41208](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41208)) +* Fixes vulnerabilities caused by incomplete validation of shapes in multiple TF ops ([CVE-2021-41206](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41206)) +* Fixes a segfault produced while copying constant resource tensor ([CVE-2021-41204](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41204)) +* Fixes a vulnerability caused by unitialized access in `EinsumHelper::ParseEquation` ([CVE-2021-41201](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41201)) +* Fixes several vulnerabilities and segfaults caused by missing validation during checkpoint loading ([CVE-2021-41203](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41203)) +* Fixes an overflow producing a crash in `tf.range` ([CVE-2021-41202](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41202)) +* Fixes an overflow producing a crash in `tf.image.resize` when size is large ([CVE-2021-41199](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41199)) +* Fixes an overflow producing a crash in `tf.tile` when tiling tensor is large ([CVE-2021-41198](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41198)) +* Fixes a vulnerability produced due to incomplete validation in `tf.summary.create_file_writer` ([CVE-2021-41200](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41200)) +* Fixes multiple crashes due to overflow and `CHECK`-fail in ops with large tensor shapes ([CVE-2021-41197](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41197)) +* Fixes a crash in `max_pool3d` when size argument is 0 or negative ([CVE-2021-41196](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41196)) +* Fixes a crash in `tf.math.segment_*` operations ([CVE-2021-41195](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41195)) +* Updates `curl` to `7.78.0` to handle + [CVE-2021-22922](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22922), + [CVE-2021-22923](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22923), + [CVE-2021-22924](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22924), + [CVE-2021-22925](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22925), + and + [CVE-2021-22926](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22926). + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +8bitmp3, Abhilash Majumder, abhilash1910, AdeshChoudhar, Adrian Garcia Badaracco, Adrian Ratiu, ag.ramesh, Aleksandr Nikolaev, Alexander Bosch, Alexander Grund, Annie Tallund, Anush Elangovan, Artem Sokolovskii, azazhu, Balint Cristian, Bas Aarts, Ben Barsdell, bhack, cfRod, Cheney-Wang, Cheng Ren, Christopher Bate, collin, Danila Bespalov, David Datascientist, Deven Desai, Duncan Riach, Ehsan Kia, Ellie, Fan Du, fo40225, Frederic Bastien, fsx950223, Gauri1 Deshpande, geetachavan1, Guillaume Klein, guozhong.zhuang, helen, Håkon Sandsmark, japm48, jgehw, Jinzhe Zeng, Jonathan Dekhtiar, Kai Zhu, Kaixi Hou, Kanvi Khanna, Koan-Sin Tan, Koki Ibukuro, Kulin Seth, KumaTea, Kun-Lu, Lemo, lipracer, liuyuanqiang, Mahmoud Abuzaina, Marius Brehler, Maxiwell S. Garcia, mdfaijul, metarutaiga, Michal Szutenberg, nammbash, Neil Girdhar, Nishidha Panpaliya, Nyadla-Sys, Patrice Vignola, Peter Kasting, Philipp Hack, PINTO0309, Prateek Gupta, puneeshkhanna, Rahul Butani, Rajeshwar Reddy T, Reza Rahimi, RinozaJiffry, rmothukuru, Rohit Santhanam, Saduf2019, Samuel Marks, sclarkson, Sergii Khomenko, Sheng, Yang, Sidong-Wei, slowy07, Srinivasan Narayanamoorthy, Srishti Srivastava, stanley, Stella Alice Schlotter, Steven I Reeves, stevenireeves, svobora, Takayoshi Koizumi, Tamas Bela Feher, Thibaut Goetghebuer-Planchon, Trent Lo, Twice, Varghese, Jojimon, Vishnuvardhan Janapati, Wang Yanzhang, Wang,Quintin, William Muir, William Raveane, Yasir Modak, Yasuhiro Matsumoto, Yi Li, Yong Tang, zhaozheng09, Zhoulong Jiang, zzpmiracle diff --git a/corpus/changelog/tensorflow_releases/tensorflow_280.md b/corpus/changelog/tensorflow_releases/tensorflow_280.md new file mode 100644 index 0000000000000000000000000000000000000000..fd56d2fcb07bb2bc8d0f0408d4efa8cff2214282 --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_280.md @@ -0,0 +1,216 @@ +# TensorFlow 2.8.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v2.8.0 +Version: 2.8.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@tensorflow-jenkins](https://avatars.githubusercontent.com/u/16359713?s=40&v=4) +[tensorflow-jenkins](/tensorflow-jenkins) +released this +02 Feb 16:54 + +· +[311 commits](/tensorflow/tensorflow/compare/v2.8.0...r2.8) +to r2.8 +since this release + +[v2.8.0](/tensorflow/tensorflow/tree/v2.8.0) + +[`3f878cf`](/tensorflow/tensorflow/commit/3f878cff5b698b82eea85db2b60d65a2e320850e) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 2.8.0 + +## Major Features and Improvements + +* `tf.lite`: + + + Added TFLite builtin op support for the following TF ops: + - `tf.raw_ops.Bucketize` op on CPU. + - `tf.where` op for data types `tf.int32`/`tf.uint32`/`tf.int8`/`tf.uint8`/`tf.int64`. + - `tf.random.normal` op for output data type `tf.float32` on CPU. + - `tf.random.uniform` op for output data type `tf.float32` on CPU. + - `tf.random.categorical` op for output data type `tf.int64` on CPU. +* `tensorflow.experimental.tensorrt`: + + + `conversion_params` is now deprecated inside `TrtGraphConverterV2` in favor of direct arguments: `max_workspace_size_bytes`, `precision_mode`, `minimum_segment_size`, `maximum_cached_engines`, `use_calibration` and `allow_build_at_runtime`. + + Added a new parameter called `save_gpu_specific_engines` to the `.save()` function inside `TrtGraphConverterV2`. When `False`, the `.save()` function won't save any TRT engines that have been built. When `True` (default), the original behavior is preserved. + + `TrtGraphConverterV2` provides a new API called `.summary()` which outputs a summary of the inference converted by TF-TRT. It namely shows each `TRTEngineOp` with their input(s)' and output(s)' shape and dtype. A detailed version of the summary is available which prints additionally all the TensorFlow OPs included in each of the `TRTEngineOp`s. +* `tf.tpu.experimental.embedding`: + + + `tf.tpu.experimental.embedding.FeatureConfig` now takes an additional argument `output_shape` which can specify the shape of the output activation for the feature. + + `tf.tpu.experimental.embedding.TPUEmbedding` now has the same behavior as `tf.tpu.experimental.embedding.serving_embedding_lookup` which can take arbitrary rank of dense and sparse tensor. For ragged tensor, though the input tensor remains to be rank 2, the activations now can be rank 2 or above by specifying the output shape in the feature config or via the build method. +* Add [`tf.config.experimental.enable_op_determinism`](https://www.tensorflow.org/api_docs/python/tf/config/experimental/enable_op_determinism), which makes TensorFlow ops run deterministically at the cost of performance. Replaces the `TF_DETERMINISTIC_OPS` environmental variable, which is now deprecated. The "Bug Fixes and Other Changes" section lists more determinism-related changes. +* (Since TF 2.7) Add [PluggableDevice](https://blog.tensorflow.org/2021/06/pluggabledevice-device-plugins-for-TensorFlow.html) support to [TensorFlow Profiler](https://github.com/tensorflow/community/blob/master/rfcs/20210513-pluggable-profiler-for-tensorflow.md). + +## Bug Fixes and Other Changes + +* `tf.data`: + + + The optimization `parallel_batch` now becomes default if not disabled by users, which will parallelize copying of batch elements. + + Added the ability for `TensorSliceDataset` to identify and handle inputs that are files. This enables creating hermetic SavedModels when using datasets created from files. + - The optimization `parallel_batch` now becomes default if not disabled by users, which will parallelize copying of batch elements. + - Added the ability for `TensorSliceDataset` to identify and handle inputs that are files. This enables creating hermetic SavedModels when using datasets created from files. +* `tf.lite`: + + + Adds GPU Delegation support for serialization to Java API. This boosts initialization time up to 90% when OpenCL is available. + + Deprecated `Interpreter::SetNumThreads`, in favor of `InterpreterBuilder::SetNumThreads`. +* `tf.keras`: + + + Adds `tf.compat.v1.keras.utils.get_or_create_layer` to aid migration to TF2 by enabling tracking of nested keras models created in TF1-style, when used with the `tf.compat.v1.keras.utils.track_tf1_style_variables` decorator. + + Added a `tf.keras.layers.experimental.preprocessing.HashedCrossing` layer which applies the hashing trick to the concatenation of crossed scalar inputs. This provides a stateless way to try adding feature crosses of integer or string data to a model. + + Removed `keras.layers.experimental.preprocessing.CategoryCrossing`. Users should migrate to the `HashedCrossing` layer or use `tf.sparse.cross`/`tf.ragged.cross` directly. + + Added additional `standardize` and `split` modes to `TextVectorization`: + - `standardize="lower"` will lowercase inputs. + - `standardize="string_punctuation"` will remove all puncuation. + - `split="character"` will split on every unicode character. + + Added an `output_mode` argument to the `Discretization` and `Hashing` layers with the same semantics as other preprocessing layers. All categorical preprocessing layers now support `output_mode`. + + All preprocessing layer output will follow the compute dtype of a `tf.keras.mixed_precision.Policy`, unless constructed with `output_mode="int"` in which case output will be `tf.int64`. The output type of any preprocessing layer can be controlled individually by passing a `dtype` argument to the layer. + + `tf.random.Generator` for keras initializers and all RNG code. + + Added 3 new APIs for enable/disable/check the usage of `tf.random.Generator` in keras backend, which will be the new backend for all the RNG in Keras. We plan to switch on the new code path by default in tf 2.8, and the behavior change will likely to cause some breakage on user side (eg if the test is checking against some golden nubmer). These 3 APIs will allow user to disable and switch back to legacy behavior if they prefer. In future (eg TF 2.10), we expect to totally remove the legacy code path (stateful random Ops), and these 3 APIs will be removed as well. + + `tf.keras.callbacks.experimental.BackupAndRestore` is now available as `tf.keras.callbacks.BackupAndRestore`. The experimental endpoint is deprecated and will be removed in a future release. + + `tf.keras.experimental.SidecarEvaluator` is now available as `tf.keras.utils.SidecarEvaluator`. The experimental endpoint is deprecated and will be removed in a future release. + + Metrics update and collection logic in default `Model.train_step()` is now customizable via overriding `Model.compute_metrics()`. + + Losses computation logic in default `Model.train_step()` is now customizable via overriding `Model.compute_loss()`. + + `jit_compile` added to `Model.compile()` on an opt-in basis to compile the model's training step with [XLA](https://www.tensorflow.org/xla). Note that `jit_compile=True` may not necessarily work for all models. +* Deterministic Op Functionality: + + + Fix regression in deterministic selection of deterministic cuDNN convolution algorithms, a regression that was introduced in v2.5. Note that nondeterministic out-of-memory events while selecting algorithms could still lead to nondeterminism, although this is very unlikely. This additional, unlikely source will be eliminated in a later version. + + Add determinsitic GPU implementations of: + - `tf.function(jit_compile=True)`'s that use `Scatter`. + - (since v2.7) Stateful ops used in `tf.data.Dataset` + - (since v2.7) `tf.convert_to_tensor` when fed with (sparse) `tf.IndexedSlices` (because it uses `tf.math.unsorted_segment_sum`) + - (since v2.7) `tf.gather` backprop (because `tf.convert_to_tensor` reduces `tf.gather`'s (sparse) `tf.IndexedSlices` gradients into its dense `params` input) + - (since v2.7) `tf.math.segment_mean` + - (since v2.7) `tf.math.segment_prod` + - (since v2.7) `tf.math.segment_sum` + - (since v2.7) `tf.math.unsorted_segment_mean` + - (since v2.7) `tf.math.unsorted_segment_prod` + - (since v2.7) `tf.math.unsorted_segment_sum` + - (since v2.7) `tf.math.unsorted_segment_sqrt` + - (since v2.7) `tf.nn.ctc_loss` (resolved, possibly in prior release, and confirmed with tests) + - (since v2.7)`tf.nn.sparse_softmax_crossentropy_with_logits` + + (since v2.7) Run `tf.scatter_nd` and other related scatter functions, such as `tf.tensor_scatter_nd_update`, on CPU (with significant performance penalty). + + Add determinism-unimplemented exception-throwing to the following ops. When op-determinism is expected (i.e. after `tf.config.experimental.enable_op_determinism` has been called), an attempt to use the specified paths through the following ops on a GPU will cause `tf.errors.UnimplementedError` (with an understandable message), unless otherwise specified, to be thrown. + - `FakeQuantWithMinMaxVarsGradient` and `FakeQuantWithMinMaxVarsPerChannelGradient` + - (since v2.7) `tf.compat.v1.get_seed` if the global random seed has not yet been set (via `tf.random.set_seed`). Throws `RuntimeError` from Python or `InvalidArgument` from C++ + - (since v2.7) `tf.compat.v1.nn.fused_batch_norm` backprop to `offset` when `is_training=False` + - (since v2.7) `tf.image.adjust_contrast` forward + - (since v2.7) `tf.image.resize` with `method=ResizeMethod.NEAREST` backprop + - (since v2.7) `tf.linalg.svd` + - (since v2.7) `tf.math.bincount` + - (since v2.7) `tf.nn.depthwise_conv2d` backprop to `filter` when not using cuDNN convolution + - (since v2.7) `tf.nn.dilation2d` gradient + - (since v2.7) `tf.nn.max_pool_with_argmax` gradient + - (since v2.7) `tf.raw_ops.DebugNumericSummary` and `tf.raw_ops.DebugNumericSummaryV2` + - (since v2.7) `tf.timestamp`. Throws `FailedPrecondition` + - (since v2.7) `tf.Variable.scatter_add` (and other scatter methods, both on ref and resource variables) + - (since v2.7) The random-number-generating ops in the `tf.random` module when the global random seed has not yet been set (via `tf.random.set_seed`). Throws `RuntimeError` from Python or `InvalidArgument` from C++ +* TensorFlow-oneDNN no longer supports [explicit use of oneDNN blocked tensor format](https://github.com/tensorflow/tensorflow/pull/53288), e.g., setting the environment variable `TF_ENABLE_MKL_NATIVE_FORMAT` will not have any effect. +* TensorFlow has been validated on Windows Subsystem for Linux 2 (aka WSL 2) for both GPUs and CPUs. +* Due to security issues (see section below), all boosted trees code has been deprecated. Users should switch to [TensorFlow Decision Forests](https://github.com/tensorflow/decision-forests). TF's boosted trees code will be eliminated before the branch cut for TF 2.9 and will no longer be present since that release. + +## Security + +* Fixes a floating point division by 0 when executing convolution operators ([CVE-2022-21725](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21725)) +* Fixes a heap OOB read in shape inference for `ReverseSequence` ([CVE-2022-21728](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21728)) +* Fixes a heap OOB access in `Dequantize` ([CVE-2022-21726](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21726)) +* Fixes an integer overflow in shape inference for `Dequantize` ([CVE-2022-21727](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21727)) +* Fixes a heap OOB access in `FractionalAvgPoolGrad` ([CVE-2022-21730](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21730)) +* Fixes an overflow and divide by zero in `UnravelIndex` ([CVE-2022-21729](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21729)) +* Fixes a type confusion in shape inference for `ConcatV2` ([CVE-2022-21731](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21731)) +* Fixes an OOM in `ThreadPoolHandle` ([CVE-2022-21732](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21732)) +* Fixes an OOM due to integer overflow in `StringNGrams` ([CVE-2022-21733](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21733)) +* Fixes more issues caused by incomplete validation in boosted trees code ([CVE-2021-41208](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41208)) +* Fixes an integer overflows in most sparse component-wise ops ([CVE-2022-23567](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23567)) +* Fixes an integer overflows in `AddManySparseToTensorsMap` ([CVE-2022-23568](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23568)) +* Fixes a number of `CHECK`-failures in `MapStage` ([CVE-2022-21734](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21734)) +* Fixes a division by zero in `FractionalMaxPool` ([CVE-2022-21735](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21735)) +* Fixes a number of `CHECK`-fails when building invalid/overflowing tensor shapes ([CVE-2022-23569](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23569)) +* Fixes an undefined behavior in `SparseTensorSliceDataset` ([CVE-2022-21736](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21736)) +* Fixes an assertion failure based denial of service via faulty bin count operations ([CVE-2022-21737](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21737)) +* Fixes a reference binding to null pointer in `QuantizedMaxPool` ([CVE-2022-21739](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21739)) +* Fixes an integer overflow leading to crash in `SparseCountSparseOutput` ([CVE-2022-21738](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21738)) +* Fixes a heap overflow in `SparseCountSparseOutput` ([CVE-2022-21740](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21740)) +* Fixes an FPE in `BiasAndClamp` in TFLite ([CVE-2022-23557](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23557)) +* Fixes an FPE in depthwise convolutions in TFLite ([CVE-2022-21741](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21741)) +* Fixes an integer overflow in TFLite array creation ([CVE-2022-23558](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23558)) +* Fixes an integer overflow in TFLite ([CVE-2022-23559](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23559)) +* Fixes a dangerous OOB write in TFLite ([CVE-2022-23561](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23561)) +* Fixes a vulnerability leading to read and write outside of bounds in TFLite ([CVE-2022-23560](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23560)) +* Fixes a set of vulnerabilities caused by using insecure temporary files ([CVE-2022-23563](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23563)) +* Fixes an integer overflow in Range resulting in undefined behavior and OOM ([CVE-2022-23562](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23562)) +* Fixes a vulnerability where missing validation causes `tf.sparse.split` to crash when `axis` is a tuple ([CVE-2021-41206](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41206)) +* Fixes a `CHECK`-fail when decoding resource handles from proto ([CVE-2022-23564](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23564)) +* Fixes a `CHECK`-fail with repeated `AttrDef` ([CVE-2022-23565](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23565)) +* Fixes a heap OOB write in Grappler ([CVE-2022-23566](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23566)) +* Fixes a `CHECK`-fail when decoding invalid tensors from proto ([CVE-2022-23571](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23571)) +* Fixes a null-dereference when specializing tensor type ([CVE-2022-23570](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23570)) +* Fixes a crash when type cannot be specialized ([CVE-2022-23572](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23572)) +* Fixes a heap OOB read/write in `SpecializeType` ([CVE-2022-23574](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23574)) +* Fixes an unitialized variable access in `AssignOp` ([CVE-2022-23573](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23573)) +* Fixes an integer overflow in `OpLevelCostEstimator::CalculateTensorSize` ([CVE-2022-23575](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23575)) +* Fixes an integer overflow in `OpLevelCostEstimator::CalculateOutputSize` ([CVE-2022-23576](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23576)) +* Fixes a null dereference in `GetInitOp` ([CVE-2022-23577](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23577)) +* Fixes a memory leak when a graph node is invalid ([CVE-2022-23578](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23578)) +* Fixes an abort caused by allocating a vector that is too large ([CVE-2022-23580](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23580)) +* Fixes multiple `CHECK`-failures during Grappler's `IsSimplifiableReshape` ([CVE-2022-23581](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23581)) +* Fixes multiple `CHECK`-failures during Grappler's `SafeToRemoveIdentity` ([CVE-2022-23579](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23579)) +* Fixes multiple `CHECK`-failures in `TensorByteSize` ([CVE-2022-23582](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23582)) +* Fixes multiple `CHECK`-failures in binary ops due to type confusion ([CVE-2022-23583](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23583)) +* Fixes a use after free in `DecodePng` kernel ([CVE-2022-23584](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23584)) +* Fixes a memory leak in decoding PNG images ([CVE-2022-23585](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23585)) +* Fixes multiple `CHECK`-fails in `function.cc` ([CVE-2022-23586](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23586)) +* Fixes multiple `CHECK`-fails due to attempting to build a reference tensor ([CVE-2022-23588](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23588)) +* Fixes an integer overflow in Grappler cost estimation of crop and resize operation ([CVE-2022-23587](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23587)) +* Fixes a null pointer dereference in Grappler's `IsConstant` ([CVE-2022-23589](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23589)) +* Fixes a `CHECK` failure in constant folding ([CVE-2021-41197](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41197)) +* Fixes a stack overflow due to self-recursive function in `GraphDef` ([CVE-2022-23591](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23591)) +* Fixes a heap OOB access in `RunForwardTypeInference` ([CVE-2022-23592](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23592)) +* Fixes a crash due to erroneous `StatusOr` ([CVE-2022-23590](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23590)) +* Fixes multiple crashes and heap OOB accesses in TFG dialect (MLIR) ([CVE-2022-23594](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23594)) +* Fixes a segfault in `simplifyBroadcast` (MLIR) ([CVE-2022-23593](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23593)) +* Fixes a null pointer dereference in `BuildXlaCompilationCache` (XLA) ([CVE-2022-23595](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23595)) +* Updates `icu` to `69.1` to handle [CVE-2020-10531](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-10531) + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +8bitmp3, Adam Lanicek, ag.ramesh, alesapin, Andrew Goodbody, annasuheyla, Ariel Elkin, Arnab Dutta, Ben Barsdell, bhack, cfRod, Chengji Yao, Christopher Bate, dan, Dan F-M, David Korczynski, DEKHTIARJonathan, dengzhiyuan, Deven Desai, Duncan Riach, Eli Osherovich, Ewout Ter Hoeven, ez2take, Faijul Amin, fo40225, Frederic Bastien, gadagashwini, Gauri1 Deshpande, Georgiy Manuilov, Guilherme De Lázari, Guozhong Zhuang, H1Gdev, homuler, Hongxu Jia, Jacky\_Yin, jayfurmanek, jgehw, Jhalak Patel, Jinzhe Zeng, Johan Gunnarsson, Jonathan Dekhtiar, Kaixi Hou, Kanvi Khanna, Kevin Cheng, Koan-Sin Tan, Kruglov-Dmitry, Kun Lu, Lemo, Lequn Chen, long.chen, Louis Sugy, Mahmoud Abuzaina, Mao, Marius Brehler, Mark Harfouche, Martin Patz, Maxiwell S. Garcia, Meenakshi Venkataraman, Michael Melesse, Mrinal Tyagi, Måns Nilsson, Nathan John Sircombe, Nathan Luehr, Nilesh Agarwalla, Oktay Ozturk, Patrice Vignola, Pawel-Polyai, Rama Ketineni, Ramesh Sampath, Reza Rahimi, Rob Suderman, Robert Kalmar, Rohit Santhanam, Sachin Muradi, Saduf2019, Samuel Marks, Shi,Guangyong, Sidong-Wei, Srinivasan Narayanamoorthy, Srishti Srivastava, Steven I Reeves, stevenireeves, Supernovae, Tamas Bela Feher, Tao Xu, Thibaut Goetghebuer-Planchon, Thomas Schmeyer, tilakrayal, Valery Mironov, Victor Guo, Vignesh Kothapalli, Vishnuvardhan Janapati, wamuir, Wang,Quintin, William Muir, William Raveane, Yash Goel, Yimei Sun, Yong Tang, Yuduo Wu diff --git a/corpus/changelog/tensorflow_releases/tensorflow_290.md b/corpus/changelog/tensorflow_releases/tensorflow_290.md new file mode 100644 index 0000000000000000000000000000000000000000..e1da7d4776239f85f9616f7dea2f28625ce729f0 --- /dev/null +++ b/corpus/changelog/tensorflow_releases/tensorflow_290.md @@ -0,0 +1,188 @@ +# TensorFlow 2.9.0 + +Source: https://github.com/tensorflow/tensorflow/releases/tag/v2.9.0 +Version: 2.9.0 + +Compare + + + +# Choose a tag to compare + +## Sorry, something went wrong. + +Filter + +Loading + +## Sorry, something went wrong. + +### Uh oh! + +There was an error while loading. Please reload this page. + +## No results found + +[View all tags](/tensorflow/tensorflow/tags) + +![@tensorflow-jenkins](https://avatars.githubusercontent.com/u/16359713?s=40&v=4) +[tensorflow-jenkins](/tensorflow-jenkins) +released this +16 May 21:12 + +· +[258 commits](/tensorflow/tensorflow/compare/v2.9.0...r2.9) +to r2.9 +since this release + +[v2.9.0](/tensorflow/tensorflow/tree/v2.9.0) + +[`8a20d54`](/tensorflow/tensorflow/commit/8a20d54a3c1bfa38c03ea99a2ad3c1b0a45dfa95) + + + + + + +This commit was created on GitHub.com and signed with GitHub’s **verified signature**. +The key has expired. + +GPG key ID: 4AEE18F83AFDEB23 + +Expired + +Verified + +[Learn about vigilant mode](https://docs.github.com/github/authenticating-to-github/displaying-verification-statuses-for-all-of-your-commits). + +# Release 2.9.0 + +# Breaking Changes + +* Due to security issues in TF 2.8, all boosted trees code has now been removed (after being deprecated in TF 2.8). Users should switch to [TensorFlow Decision Forests](https://github.com/tensorflow/decision-forests). +* Build, Compilation and Packaging + + TensorFlow is now compiled with `_GLIBCXX_USE_CXX11_ABI=1`. Downstream projects that encounter `std::__cxx11` or `[abi:cxx11]` linker errors will need to adopt this compiler option. See [the GNU C++ Library docs on Dual ABI](https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html). + + TensorFlow Python wheels now specifically conform to [manylinux2014](https://peps.python.org/pep-0599/), an upgrade from manylinux2010. The minimum Pip version supporting manylinux2014 is Pip 19.3 (see [pypa/manylinux](https://github.com/pypa/manylinux). This change may affect you if you have been using TensorFlow on a very old platform equivalent to CentOS 6, as manylinux2014 targets CentOS 7 as a compatibility base. Note that TensorFlow does not officially support either platform. + + Discussion for these changes can be found on SIG Build's [TensorFlow Community Forum thread](https://discuss.tensorflow.org/t/tensorflow-linux-wheels-are-being-upgraded-to-manylinux2014/8339) +* The `tf.keras.mixed_precision.experimental` API has been removed. The non-experimental symbols under `tf.keras.mixed_precision` have been available since TensorFlow 2.4 and should be used instead. + + The non-experimental API has some minor differences from the experimental API. In most cases, you only need to make three minor changes: + - Remove the word "experimental" from `tf.keras.mixed_precision` symbols. E.g., replace `tf.keras.mixed_precision.experimental.global_policy` with `tf.keras.mixed_precision.global_policy`. + - Replace `tf.keras.mixed_precision.experimental.set_policy` with `tf.keras.mixed_precision.set_global_policy`. The experimental symbol `set_policy` was renamed to `set_global_policy` in the non-experimental API. + - Replace `LossScaleOptimizer(opt, "dynamic")` with `LossScaleOptimizer(opt)`. If you pass anything other than `"dynamic"` to the second argument, see (1) of the next section. + + In the following rare cases, you need to make more changes when switching to the non-experimental API: + - If you passed anything other than `"dynamic"` to the `loss_scale` argument (the second argument) of `LossScaleOptimizer`: + * The LossScaleOptimizer constructor takes in different arguments. See the [TF 2.7 documentation of tf.keras.mixed\_precision.experimental.LossScaleOptimizer](https://www.tensorflow.org/versions/r2.7/api_docs/python/tf/keras/mixed_precision/experimental/LossScaleOptimizer) for details on the differences, which has examples on how to convert to the non-experimental LossScaleOptimizer. + - If you passed a value to the `loss_scale` argument (the second argument) of `Policy`: + * The experimental version of `Policy` optionally took in a `tf.compat.v1.mixed_precision.LossScale` in the constructor, which defaulted to a dynamic loss scale for the `"mixed_float16"` policy and no loss scale for other policies. In `Model.compile`, if the model's policy had a loss scale, the optimizer would be wrapped with a `LossScaleOptimizer`. With the non-experimental `Policy`, there is no loss scale associated with the `Policy`, and `Model.compile` wraps the optimizer with a `LossScaleOptimizer` if and only if the policy is a `"mixed_float16"` policy. If you previously passed a `LossScale` to the experimental `Policy`, consider just removing it, as the default loss scaling behavior is usually what you want. If you really want to customize the loss scaling behavior, you can wrap your optimizer with a `LossScaleOptimizer` before passing it to `Model.compile`. + - If you use the very rarely-used function `tf.keras.mixed_precision.experimental.get_layer_policy`: + * Replace `tf.keras.mixed_precision.experimental.get_layer_policy(layer)` with `layer.dtype_policy`. +* `tf.mixed_precision.experimental.LossScale` and its subclasses have been removed from the TF2 namespace. This symbols were very rarely used and were only useful in TF2 for use in the now-removed `tf.keras.mixed_precision.experimental` API. The symbols are still available under `tf.compat.v1.mixed_precision`. +* The `experimental_relax_shapes` heuristic for `tf.function` has been deprecated and replaced with `reduce_retracing` which encompasses broader heuristics to reduce the number of retraces (see below) + +# Major Features and Improvements + +* `tf.keras`: + + + Added `tf.keras.applications.resnet_rs` models. This includes the `ResNetRS50`, `ResNetRS101`, `ResNetRS152`, `ResNetRS200`, `ResNetRS270`, `ResNetRS350` and `ResNetRS420` model architectures. The ResNetRS models are based on the architecture described in [Revisiting ResNets: Improved Training and Scaling Strategies](https://arxiv.org/pdf/2103.07579.pdf) + + Added `tf.keras.optimizers.experimental.Optimizer`. The reworked optimizer gives more control over different phases of optimizer calls, and is easier to customize. We provide Adam, SGD, Adadelta, AdaGrad and RMSprop optimizers based on `tf.keras.optimizers.experimental.Optimizer`. Generally the new optimizers work in the same way as the old ones, but support new constructor arguments. In the future, the symbols `tf.keras.optimizers.Optimizer`/`Adam`/etc will point to the new optimizers, and the previous generation of optimizers will be moved to `tf.keras.optimizers.legacy.Optimizer`/`Adam`/etc. + + Added L2 unit normalization layer `tf.keras.layers.UnitNormalization`. + + Added `tf.keras.regularizers.OrthogonalRegularizer`, a new regularizer that encourages orthogonality between the rows (or columns) or a weight matrix. + + Added `tf.keras.layers.RandomBrightness` layer for image preprocessing. + + Added APIs for switching between interactive logging and absl logging. By default, Keras always writes the logs to stdout. However, this is not optimal in a non-interactive environment, where you don't have access to stdout, but can only view the logs. You can use `tf.keras.utils.disable_interactive_logging()` to write the logs to ABSL logging. You can also use `tf.keras.utils.enable_interactive_logging()` to change it back to stdout, or `tf.keras.utils.is_interactive_logging_enabled()` to check if interactive logging is enabled. + + Changed default value for the `verbose` argument of `Model.evaluate()` and `Model.predict()` to `"auto"`, which defaults to `verbose=1` for most cases and defaults to `verbose=2` when used with `ParameterServerStrategy` or with interactive logging disabled. + + Argument `jit_compile` in `Model.compile()` now applies to `Model.evaluate()` and `Model.predict()`. Setting `jit_compile=True` in `compile()` compiles the model's training, evaluation, and inference steps to [XLA](https://www.tensorflow.org/xla). Note that `jit_compile=True` may not necessarily work for all models. + + Added DTensor-related Keras APIs under `tf.keras.dtensor` namespace. The APIs are still classified as experimental. You are welcome to try it out. Please check the tutoral and guide on for more details about DTensor. +* `tf.lite`: + + + Added TFLite builtin op support for the following TF ops: + - `tf.math.argmin`/`tf.math.argmax` for input data type `tf.bool` on CPU. + - `tf.nn.gelu` op for output data type `tf.float32` and quantization on CPU. + + Add nominal support for unsigned 16-bit integer tensor types. Note that very few TFLite kernels support this type natively, so its use in mobile ML authoring is generally discouraged. + + Add support for unsigned 16-bit integer tensor types in cast op. + + Experimental support for lowering `list_ops.tensor_list_set_item` with `DynamicUpdateSlice`. + + Enabled a new MLIR-based dynamic range quantization backend by default + - The new backend is used for post-training int8 dynamic range quantization and post-training float16 quantization. + - Set `experimental_new_dynamic_range_quantizer` in tf.lite.TFLiteConverter to False to disable this change + + Native TF Lite variables are now enabled during conversion by default on all v2 TfLiteConverter entry points. `experimental_enable_resource_variables` on tf.lite.TFLiteConverter is now True by default and will be removed in the future. +* `tf.function`: + + + Custom classes used as arguments for `tf.function` can now specify rules regarding when retracing needs to occur by implementing the Tracing Protocol available through `tf.types.experimental.SupportsTracingProtocol`. + + `TypeSpec` classes (as associated with `ExtensionTypes`) also implement the Tracing Protocol which can be overriden if necessary. + + The newly introduced `reduce_retracing` option also uses the Tracing Protocol to proactively generate generalized traces similar to `experimental_relax_shapes` (which has now been deprecated). +* Unified eager and `tf.function` execution: + + + Eager mode can now execute each op as a `tf.function`, allowing for more consistent feature support in future releases. + + It is available for immediate use. + - See the `TF_RUN_EAGER_OP_AS_FUNCTION` environment variable in [eager context](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/eager/context.py). + - Eager performance should be similar with this feature enabled. + * A roughly 5us per-op overhead may be observed when running many small functions. + * Note a [known issue](https://github.com/tensorflow/tensorflow/issues/55414) with GPU performance. + - The behavior of `tf.function` itself is unaffected. + + Note: This feature will be enabled by default in an upcoming version of TensorFlow. +* `tf.experimental.dtensor`: Added DTensor, an extension to TensorFlow for large-scale modeling with minimal changes to user code. You are welcome to try it out, though be aware that the DTensor API is experimental and up-to backward-incompatible changes. DTensor and Keras integration is published under `tf.keras.dtensor` in this release (refer to the `tf.keras` entry). The tutoral and guide for DTensor will be published on . Please stay tuned. +* [oneDNN CPU performance optimizations](https://github.com/tensorflow/community/blob/master/rfcs/20210930-enable-onednn-ops.md) are available in Linux x86, Windows x86, and Linux aarch64 packages. + + + **Linux x86 packages:** + - oneDNN optimizations are *enabled by default* on CPUs with neural-network-focused hardware features such as AVX512\_VNNI, AVX512\_BF16, AMX, etc. ([Intel Cascade Lake](https://www.intel.com/content/www/us/en/products/platforms/details/cascade-lake.html) and newer CPUs.) + * [Example performance speedups.](https://medium.com/intel-analytics-software/leverage-intel-deep-learning-optimizations-in-tensorflow-129faa80ee07) + - For older CPUs, oneDNN optimizations are disabled by default. + + **Windows x86 package:** oneDNN optimizations are disabled by default. + + **Linux aach64 (`--config=mkl_aarch64`) package:** + - Experimental oneDNN optimizations are disabled by default. + - If you experience issues with oneDNN optimizations on, we recommend turning them off. + + To explicitly enable or disable oneDNN optimizations, set the environment variable `TF_ENABLE_ONEDNN_OPTS` to `1` (enable) or `0` (disable) before running TensorFlow. (The variable is checked during `import tensorflow`.) To fall back to default settings, unset the environment variable. + + These optimizations can yield slightly different numerical results from when they are off due to floating-point round-off errors from different computation approaches and orders. + + To verify that the optimizations are on, look for a message with *"oneDNN custom operations are on"* in the log. If the exact phrase is not there, it means they are off. + +# Bug Fixes and Other Changes + +* `tf.data`: + + + Fixed bug in `tf.data.experimental.parse_example_dataset` when `tf.io.RaggedFeatures` would specify `value_key` but no `partitions`. Before the fix, setting `value_key` but no `partitions` would result in the feature key being replaced by the value key, e.g. `{'value_key': }` instead of `{'key': }`. Now the correct feature key will be used. This aligns the behavior of `tf.data.experimental.parse_example_dataset` to match the behavior of `tf.io.parse_example`. + + Added a new field, `filter_parallelization`, to `tf.data.experimental.OptimizationOptions`. If it is set to `True`, tf.data will run `Filter` transformation with multiple threads. Its default value is `False` if not specified. +* `tf.keras`: + + + Fixed bug in optimizers that prevented them from properly checkpointing slot variables when they are `ShardedVariable`s (used for training with `tf.distribute.experimental.ParameterServerStrategy`). +* `tf.random`: + + + Added `tf.random.experimental.index_shuffle`, for shuffling a sequence without materializing the sequence in memory. +* `tf.RaggedTensor`: + + + Introduced `tf.experimental.RowPartition`, which encodes how one dimension in a RaggedTensor relates to another, into the public API. + + Introduced `tf.experimental.DynamicRaggedShape`, which represents the shape of a RaggedTensor. + +## Security + +* Fixes a code injection in `saved_model_cli` ([CVE-2022-29216](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29216)) +* Fixes a missing validation which causes `TensorSummaryV2` to crash ([CVE-2022-29193](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29193)) +* Fixes a missing validation which crashes `QuantizeAndDequantizeV4Grad` ([CVE-2022-29192](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29192)) +* Fixes a missing validation which causes denial of service via `DeleteSessionTensor` ([CVE-2022-29194](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29194)) +* Fixes a missing validation which causes denial of service via `GetSessionTensor` ([CVE-2022-29191](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29191)) +* Fixes a missing validation which causes denial of service via `StagePeek` ([CVE-2022-29195](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29195)) +* Fixes a missing validation which causes denial of service via `UnsortedSegmentJoin` ([CVE-2022-29197](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29197)) +* Fixes a missing validation which causes denial of service via `LoadAndRemapMatrix` ([CVE-2022-29199](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29199)) +* Fixes a missing validation which causes denial of service via `SparseTensorToCSRSparseMatrix` ([CVE-2022-29198](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29198)) +* Fixes a missing validation which causes denial of service via `LSTMBlockCell` ([CVE-2022-29200](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29200)) +* Fixes a missing validation which causes denial of service via `Conv3DBackpropFilterV2` ([CVE-2022-29196](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29196)) +* Fixes a `CHECK` failure in depthwise ops via overflows ([CVE-2021-41197](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41197)) +* Fixes issues arising from undefined behavior stemming from users supplying invalid resource handles ([CVE-2022-29207](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29207)) +* Fixes a segfault due to missing support for quantized types ([CVE-2022-29205](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29205)) +* Fixes a missing validation which results in undefined behavior in `SparseTensorDenseAdd` ([CVE-2022-29206](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29206)) +* Fixes a missing validation which results in undefined behavior in `QuantizedConv2D` ([CVE-2022-29201](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29201)) +* Fixes an integer overflow in `SpaceToBatchND` ([CVE-2022-29203](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29203)) +* Fixes a segfault and OOB write due to incomplete validation in `EditDistance` ([CVE-2022-29208](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29208)) +* Fixes a missing validation which causes denial of service via `Conv3DBackpropFilterV2` ([CVE-2022-29204](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29204)) +* Fixes a denial of service in `tf.ragged.constant` due to lack of validation ([CVE-2022-29202](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29202)) +* Fixes a segfault when `tf.histogram_fixed_width` is called with NaN values ([CVE-2022-29211](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29211)) +* Fixes a core dump when loading TFLite models with quantization ([CVE-2022-29212](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29212)) +* Fixes crashes stemming from incomplete validation in signal ops ([CVE-2022-29213](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29213)) +* Fixes a type confusion leading to `CHECK`-failure based denial of service ([CVE-2022-29209](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29209)) +* Fixes a heap buffer overflow due to incorrect hash function ([CVE-2022-29210](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29210)) +* Updates `curl` to `7.83.1` to handle ([CVE-2022-22576](https://cve.mitre.org/cgi-bin/cvename.cgi?name=VE-2022-22576), ([CVE-2022-27774](https://cve.mitre.org/cgi-bin/cvename.cgi?name=VE-2022-27774), ([CVE-2022-27775](https://cve.mitre.org/cgi-bin/cvename.cgi?name=VE-2022-27775), ([CVE-2022-27776](https://cve.mitre.org/cgi-bin/cvename.cgi?name=VE-2022-27776), ([CVE-2022-27778](https://cve.mitre.org/cgi-bin/cvename.cgi?name=VE-2022-27778), ([CVE-2022-27779](https://cve.mitre.org/cgi-bin/cvename.cgi?name=VE-2022-27779), ([CVE-2022-27780](https://cve.mitre.org/cgi-bin/cvename.cgi?name=VE-2022-27780), ([CVE-2022-27781](https://cve.mitre.org/cgi-bin/cvename.cgi?name=VE-2022-27781), ([CVE-2022-27782](https://cve.mitre.org/cgi-bin/cvename.cgi?name=VE-2022-27782) and ([CVE-2022-30115](https://cve.mitre.org/cgi-bin/cvename.cgi?name=VE-2022-30115) +* Updates `zlib` to `1.2.12` after `1.2.11` was pulled due to [security issue](https://www.openwall.com/lists/oss-security/2022/03/28/1) + +# Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +Aaron Debattista, Abel Soares Siqueira, Abhishek Varma, Andrei Ivanov, andreii, Andrew Goodbody, apeltop, Arnab Dutta, Ashiq Imran, Banikumar Maiti (Intel Aipg), Ben Greiner, Benjamin Peterson, bhack, Christopher Bate, chunduriv, Copybara-Service, DEKHTIARJonathan, Deven Desai, Duncan Riach, Eric Kunze, Everton Constantino, Faruk D, Fredrik Knutsson, gadagashwini, Gauri1 Deshpande, gtiHibGele, Guozhong Zhuang, Islem-Esi, Ivanov Viktor, Jason Furmanek, Jason Zaman, Jim, Jinzhe Zeng, John Laxson, Jonas Eschle, Jonas Eschle 'Mayou36, Jonathan Dekhtiar, Kaixi Hou, Kanvi Khanna, KaurkerDevourer, Koan-Sin Tan, kushanam, Laramie Leavitt, Li-Wen Chang, lipracer, Louis Sugy, Lu Teng, Mahmoud Abuzaina, Malcolm Slaney, Malik Shahzad Muzaffar, Marek Šuppa, Matt Conley, Michael Melesse, Milos Puzovic, mohantym, Nathan John Sircombe, Nathan Luehr, Nilesh Agarwalla, Patrice Vignola, peterjc123, Philip Turner, Rajeshwar Reddy T, Robert Kalmar, Rodrigo Formigone, Rohit Santhanam, rui, Sachin Muradi, Saduf2019, sandip, Scott Leishman, Serge Panev, Shi,Guangyong, Srinivasan Narayanamoorthy, stanley, Steven I Reeves, stevenireeves, sushreebarsa, Tamas Bela Feher, Tao He, Thomas Schmeyer, Tiago Almeida, Trevor Morris, Uday Bondhugula, Uwe L. Korn, Varghese, Jojimon, Vishnuvardhan Janapati, William Muir, William Raveane, xutianming, Yasuhiro Matsumoto, Yimei Sun, Yong Tang, Yu Feng, Yuriy Chernyshov, zhaozheng09 diff --git a/corpus/changelog/wireshark_releases/wireshark_400.md b/corpus/changelog/wireshark_releases/wireshark_400.md new file mode 100644 index 0000000000000000000000000000000000000000..22afab29a9e34f03b6521f3181aba30c59cdf3d2 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_400.md @@ -0,0 +1,267 @@ +# Wireshark 4.0.0 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.0.0.html +Version: 4.0.0 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +## What’s New + +*We no longer ship official 32-bit Windows packages starting with this release*. +If you need to use Wireshark on that platform, we recommend using the latest 3.6 release. +[Issue 17779](https://gitlab.com/wireshark/wireshark/-/issues/17779) + +The display filter syntax is more powerful with many new extensions. +See below for details. + +The Conversation and Endpoint dialogs have been redesigned. +See below for details. + +The default main window layout has been changed so that the Packet Detail and Packet Bytes are side by side underneath the Packet List pane. + +Hex dump imports from Wireshark and from `text2pcap` have been improved. +See below for details. + +Speed when using MaxMind geolocation has been greatly improved. + +The tools and libraries required to build Wireshark have changed. +See “Other Development Changes” below for more details. + +Many other improvements have been made. +See the “New and Updated Features” section below for more details. + +### New and Updated Features + +The following features are new (or have been significantly updated) since version 4.0.0rc2: + +Nothing of note. + +The following features are new (or have been significantly updated) since version 4.0.0rc1: + +* The macOS packages now ship with Qt 6.2.4 and require macOS 10.14. + They previously shipped with Qt 5.15.3. +* The Windows installers now ship with Npcap 1.71. + They previously shipped with Npcap 1.70. + +The following features are new (or have been significantly updated) since version 3.7.2: + +* The Windows installers now ship with Npcap 1.70. + They previously shipped with Npcap 1.60. + +The following features are new (or have been significantly updated) since version 3.7.1: + +* The 'v' (lower case) and 'V' (upper case) switches have been swapped for editcap and mergecap to + match the other command line utilities. +* The ip.flags field is now only the three high bits, not the full byte. + Display filters and Coloring rules using the field will need to be adjusted. +* New address type AT\_NUMERIC allows simple numeric addresses for protocols which do not have + a more common-style address approach, analog to AT\_STRINGZ. + +The following features are new (or have been significantly updated) since version 3.7.0: + +* The Windows installers now ship with Qt 6.2.3. + They previously shipped with Qt 6.2.4. +* The Conversation and Endpoint dialogs have been redesigned with the following improvements: + + + The context menu now includes the option to resize all columns, as well as copying elements. + + Data may be exported as JSON. + + Tabs may be detached and reattached from the dialog. + + Adding and removing tabs will keep them in the same order all the time. + + If a filter is applied, two columns are shown in either dialog detailing the difference between + unmatched and matched packets. + + Columns are now sorted via secondary properties if an identical entry is found. + + Conversations are sorted via second address and first port number. + + Endpoints are sorted via port numbers. + + IPv6 addresses are sorted correctly after IPv4 addresses. + + The dialog elements have been moved to make it easier to handle for new users. + + Selection of tap elements is done via a list. + + All configurations and options are done via a left side button row. + + Columns for the Conversations and Endpoint dialogs can be hidden by a context menu. + + TCP and UDP conversations now include the stream ID and allow filtering on it. + +The following features are new (or have been significantly updated) since version 3.6.0: + +* The Windows installers now ship with Npcap 1.60. + They previously shipped with Npcap 1.55. +* The Windows installers now ship with Qt 6.2.4. + They previously shipped with Qt 5.12.2. +* The display filter syntax has been updated and enhanced: + + + A syntax to match a specific layer in the protocol stack has been added. + For example in an IP-over-IP packet “ip.addr#1 == 1.1.1.1” matches the outer layer addresses and “ip.addr#2 == 1.1.1.2” matches the inner layer addresses. + + Universal quantifiers "any" and "all" have been added to any relational operator. + For example the expression "all tcp.port > 1024" is true if and only if all tcp.port fields match the condition. + Previously only the default behaviour to return true if any one field matches was supported. + + Field references, of the form ${some.field}, are now part of the syntax of display filters. Previously they were implemented as macros. + The new implementation is more efficient and has the same properties as protocol fields, like matching on multiple values + using quantifiers and support for layer filtering. + + Arithmetic is supported for numeric fields with the usual operators “+”, “-”, “\*”, “/”, and “%”. + Arithmetic expressions must be grouped using curly brackets (not parenthesis). + + New display filter functions max(), min() and abs() have been added. + + Functions can accept expressions as arguments, including other functions. + Previously only protocol fields and slices were syntactically valid function arguments. + + A new syntax to disambiguate literals from identifiers has been added. + Every value with a leading dot is a protocol or protocol field. + Every value in between angle brackets is a literal value. + See the [User’s Guide](https://www.wireshark.org/docs/wsug_html_chunked/ChWorkBuildDisplayFilterSection.html#_some_protocol_names_can_be_ambiguous) for details. + + The "bitwise and" operator is now a first-class bit operator, not a boolean operator. + In particular this means it is now possible to mask bits, e.g.: frame[0] & 0x0F == 3. + + Dates and times can be given in UTC using ISO 8601 (with 'Z' timezone) or by appending the suffix "UTC" to the legacy formats. + Otherwise local time is used. + + Integer literal constants may be written in binary (in addition to decimal/octal/hexadecimal) using the prefix "0b" or "0B". + + Logical AND now has higher precedence than logical OR, in line with most programming languages. + + It is now possible to index protocol fields from the end using negative indexes. For example the + following expression tests the last two bytes of the TCP protocol field: tcp[-2:] == AA:BB. + This was a longstanding bug that has been fixed in this release. + + Set elements must be separated using a comma, e.g: {1, 2, "foo"}. + Using only whitespace as a separator was deprecated in 3.6 and is now a syntax error. + + Support for some additional character escape sequences in double quoted strings has been added. + Along with octal (\) and hex (\x) encoding, the following C escape sequences are now supported with the same meaning: \a, \b, \f, \n, \r, \t, \v. + Previously they were only supported with character constants. + + Unicode universal character names are now supported with the escape sequences \uNNNN or \UNNNNNNNN, where N is a hexadecimal digit. + + Unrecognized escape sequences are now treated as a syntax error. + Previously they were treated as a literal character. + In addition to the sequences indicated above, backslash, single quotation and double quotation mark are also valid sequences: \\, \', \". + + A new strict equality operator "===" or "all\_eq" has been added. + The expression "a === b" is true if and only if all a’s are equal to b. + The negation of "===" can now be written as "!==" (any\_ne). + + The aliases "any\_eq" for "==" and "all\_ne" for "!=" have been added. + + The operator "~=" is deprecated and will be removed in a future version. + Use "!==", which has the same meaning instead. + + Floats must be written with a leading and ending digit. + For example the values ".7" and "7." are now invalid as floats. + They must be written "0.7" and "7.0" respectively. + + The display filter engine now uses PCRE2 instead of GRegex (GLib’s bindings to the older and end-of-life PCRE library). + PCRE2 is compatible with PCRE so any user-visible changes should be minimal. + Some exotic patterns may now be invalid and require rewriting. + + Literal strings can handle embedded null bytes (the value '\0') correctly. This includes regular expression patterns. + For example the double-quoted string "\0 is a null byte" is a legal literal value. + This may be useful to match byte patterns but note that in general protocol fields with a string type still cannot contain embedded null bytes. + + Booleans can be written as True/TRUE or False/FALSE. Previously they could only be written as 1 or 0. + + It is now possible to test for the existence of a slice. + + All integer sizes are now compatible. Unless overflow occurs any integer field can be compared with any other. +* The `text2pcap` command and the “Import from Hex Dump” feature have been updated and enhanced: + + + `text2pcap` supports writing the output file in all the capture file formats that wiretap library supports, using the same `-F` option as `editcap`, `mergecap`, and `tshark`. + + Consistent with the other command line tools like `editcap`, `mergecap`, `tshark`, and the "Import from Hex Dump" option within Wireshark, the default capture file format for `text2pcap` is now **pcapng**. The `-n` flag to select pcapng (instead of the previous default, pcap) has been deprecated and will be removed in a future release. + + `text2pcap` supports selecting the encapsulation type of the output file format using the wiretap library short names with an `-E` option, similar to the `-T` option of `editcap`. + + `text2pcap` has been updated to use the new logging output options and the `-d` flag has been removed. + The "debug" log level corresponds to the old `-d` flag, and the "noisy" log level corresponds to using `-d` multiple times. + + `text2pcap` and “Import from Hex Dump” support writing fake IP, TCP, UDP, and SCTP headers to files with Raw IP, Raw IPv4, and Raw IPv6 encapsulations, in addition to Ethernet encapsulation available in previous versions. + + `text2pcap` supports scanning the input file using a custom regular expression, as supported in “Import from Hex Dump” in Wireshark 3.6.x. + + In general, `text2pcap` and wireshark’s “Import from Hex Dump” have feature parity. +* The default main window layout has been changed so that the Packet Detail and Packet Bytes are side by side underneath the Packet List pane. +* The HTTP2 dissector now supports using fake headers to parse the DATAs of streams captured without first HEADERS frames of a long-lived stream (such as a gRPC streaming call which allows sending many request or response messages in one HTTP2 stream). + Users can specify fake headers using an existing stream’s server port, stream id and direction. +* The IEEE 802.11 dissector supports Mesh Connex (MCX). +* The “Capture Options” dialog contains the same configuration icon as the Welcome Screen. + It is now possible to configure interfaces there. +* The “Extcap” dialog remembers password items during runtime, which makes it possible to run extcaps multiple times in row without having to reenter the password each time. + Passwords are never stored on disk. +* It is possible to set extcap passwords in `tshark` and other CLI tools. +* The extcap configuration dialog now supports and remembers empty strings. + There are new buttons to reset values back to their defaults. +* Support to display JSON mapping for Protobuf message has been added. +* macOS debugging symbols are now shipped in separate packages, similar to Windows packages. +* In the ZigBee ZCL Messaging dissector the zbee\_zcl\_se.msg.msg\_ctrl.depreciated field has been renamed to zbee\_zcl\_se.msg.msg\_ctrl.deprecated +* The interface list on the welcome page sorts active interfaces first and only displays sparklines for active interfaces. + Additionally, the interfaces can now be hidden and shown via the context menu in the interface list +* The Event Tracing for Windows (ETW) file reader now supports displaying IP packets from an event trace logfile or an event trace live session. +* ciscodump now supports IOS, IOS-XE and ASA remote capturing + +### Removed Features and Support + +* The CMake options starting with DISABLE\_something were renamed ENABLE\_something for consistency. + For example DISABLE\_WERROR=On became ENABLE\_WERROR=Off. + The default values are unchanged. + +### New Protocol Support + +Allied Telesis Loop Detection (AT LDF), AUTOSAR I-PDU Multiplexer (AUTOSAR I-PduM), DTN Bundle Protocol Security (BPSec), DTN Bundle Protocol Version 7 (BPv7), DTN TCP Convergence Layer Protocol (TCPCL), DVB Selection Information Table (DVB SIT), Enhanced Cash Trading Interface 10.0 (XTI), Enhanced Order Book Interface 10.0 (EOBI), Enhanced Trading Interface 10.0 (ETI), FiveCo’s Legacy Register Access Protocol (5co-legacy), Generic Data Transfer Protocol (GDT), gRPC Web (gRPC-Web), Host IP Configuration Protocol (HICP), Huawei GRE bonding (GREbond), Locamation Interface Module (IDENT, CALIBRATION, SAMPLES - IM1, SAMPLES - IM2R0), Mesh Connex (MCX), Microsoft Cluster Remote Control Protocol (RCP), Open Control Protocol for OCA/AES70 (OCP.1), Protected Extensible Authentication Protocol (PEAP), Realtek, REdis Serialization Protocol v2 (RESP), Roon Discovery (RoonDisco), Secure File Transfer Protocol (sftp), Secure Host IP Configuration Protocol (SHICP), SSH File Transfer Protocol (SFTP), USB Attached SCSI (UASP), and ZBOSS Network Coprocessor product (ZB NCP) + +### Updated Protocol Support + +Too many protocols have been updated to list here. + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### Major API Changes + +* proto.h: The field display types "STR\_ASCII" and "STR\_UNICODE" have been removed. + Use "BASE\_NONE" instead. +* proto.h: The field display types for floats have been extended and refactored. + The type BASE\_FLOAT has been removed. Use BASE\_NONE instead. New display + types for floats are BASE\_DEC, BASE\_HEX, BASE\_EXP and BASE\_CUSTOM. +* The Wireshark Lua API now uses the [lrexlib](https://github.com/rrthomas/lrexlib) bindings to PCRE2. + Code using the Lua GRegex module will have to be updated to use lrexlib-pcre2 instead. + In most cases the API should be compatible and the conversion just requires a module name change. +* The tap registration system has been updated and the list of arguments for tap\_packet\_cb has changed. + All taps registered through register\_tap\_listener have to be updated. + +### Other Development Changes + +* The [PCRE2 library](https://www.pcre.org/) is now required to build Wireshark. +* You must now have a compiler with C11 support in order to build Wireshark. +* The following libraries and tools have had their minimum required version increased: + + + CMake 3.10 is required on macOS and Linux. + + Qt version 5.12 (was 5.6.0), although compilation with 5.10 and 5.11 is still possible, but will trigger a warning during configuration. + + Windows SDK 10.0.18362.0 is required due to issues with C11 support. + + macOS version 10.11 to 10.14 (was 10.8) is required depending on the version of Qt: + + Qt 5.10 or higher requires macOS version 10.11 + + Qt 5.12 or higher requires macOS version 10.12 + + Qt 5.14 or higher requires macOS version 10.13 + + Qt 6.0 or higher requires macOS version 10.14 + + GLib version 2.50.0 (was 2.38.0) is required. + + Libgcrypt version 1.8.0 (was 1.5.0) is required. + + c-ares version 1.13.0 (was 1.5.0). + + Python version 3.6.0 (was 3.4.0). + + GnuTLS version 3.5.8 (was 3.3.0). + + Nghttp2 minimum version has been set to 1.11.0 (none previous). +* Perl is no longer required to build Wireshark, but may be required to build some source code files and run code analysis checks. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_401.md b/corpus/changelog/wireshark_releases/wireshark_401.md new file mode 100644 index 0000000000000000000000000000000000000000..118ccbec2b84586e2d07c7bd7b7becebe29490bf --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_401.md @@ -0,0 +1,104 @@ +# Wireshark 4.0.1 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.0.1.html +Version: 4.0.1 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +## What’s New + +*We do not ship official 32-bit Windows packages for Wireshark 4.0 and later*. +If you need to use Wireshark on that platform, we recommend using the latest 3.6 release. +[Issue 17779](https://gitlab.com/wireshark/wireshark/-/issues/17779) + +* The Windows installers now ship with Qt 5.12.2. + They previously shipped with Qt 6.2.3. + +### Bug Fixes + +The following bugs have been fixed: + +* Comparing a boolean field against 1 always succeeds on big-endian machines. [Issue 12236](https://gitlab.com/wireshark/wireshark/-/issues/12236). +* Qt: MaxMind GeoIP columns not added to Endpoints table. [Issue 18320](https://gitlab.com/wireshark/wireshark/-/issues/18320). +* Fuzz job crash output: fuzz-2022-10-04-7131.pcap. [Issue 18402](https://gitlab.com/wireshark/wireshark/-/issues/18402). +* The RTP player might not play audio on Windows. [Issue 18413](https://gitlab.com/wireshark/wireshark/-/issues/18413). +* Wireshark 4.0 breaks display filter expression with > sign. [Issue 18418](https://gitlab.com/wireshark/wireshark/-/issues/18418). +* Capture filters not working when using SSH capture and dumpcap. [Issue 18420](https://gitlab.com/wireshark/wireshark/-/issues/18420). +* Packet diagram field values are not terminated. [Issue 18428](https://gitlab.com/wireshark/wireshark/-/issues/18428). +* Packet bytes not displayed completely if scrolling. [Issue 18438](https://gitlab.com/wireshark/wireshark/-/issues/18438). +* Fuzz job crash output: fuzz-2022-10-13-7166.pcap. [Issue 18467](https://gitlab.com/wireshark/wireshark/-/issues/18467). +* Decoding bug H.245 userInput Signal. [Issue 18468](https://gitlab.com/wireshark/wireshark/-/issues/18468). +* CFDP dissector doesn’t handle "destination filename" only. [Issue 18495](https://gitlab.com/wireshark/wireshark/-/issues/18495). +* Home page capture button doesn’t pop up capture options dialog. [Issue 18506](https://gitlab.com/wireshark/wireshark/-/issues/18506). +* Missing dot in H.248 protocol name. [Issue 18513](https://gitlab.com/wireshark/wireshark/-/issues/18513). +* Missing dot for protocol H.264 in protocol column. [Issue 18524](https://gitlab.com/wireshark/wireshark/-/issues/18524). +* Fuzz job crash output: fuzz-2022-10-23-7240.pcap. [Issue 18534](https://gitlab.com/wireshark/wireshark/-/issues/18534). + +### New and Updated Features + +### Removed Features and Support + +* The experimental display filter syntax for literals using angle brackets <…​> + that was introduced in Wireshark 4.0.0 has been removed. For byte arrays a colon prefix + can be used instead. + See the [User’s Guide](https://www.wireshark.org/docs/wsug_html_chunked/ChWorkBuildDisplayFilterSection.html#_some_protocol_names_can_be_ambiguous) for details. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +ASN.1 PER, CFDP, Diameter, DirectPlay, F5 Ethernet Trailer, GTP, H.223, H.248, H.264, H.265, IEEE 802.11, IPv4, MBIM, O-RAN FH CUS, PFCP, RTCP, SCTP, SMB, TCP, and TRANSUM + +### New and Updated Capture File Support + +BLF + +### New File Format Decoding Support + +There is no new or updated file format support in this release. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_4010.md b/corpus/changelog/wireshark_releases/wireshark_4010.md new file mode 100644 index 0000000000000000000000000000000000000000..a3879c170622e4be3dac77d28b5ccf9f0081e8a0 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_4010.md @@ -0,0 +1,90 @@ +# Wireshark 4.0.10 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.0.10.html +Version: 4.0.10 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +## What’s New + +*We do not ship official 32-bit Windows packages for Wireshark 4.0 and later*. +If you need to use Wireshark on that platform, we recommend using the latest 3.6 release. +[Issue 17779](https://gitlab.com/wireshark/wireshark/-/issues/17779) + +If you’re running Wireshark on macOS and upgraded to macOS 13 from an earlier version, you might have to open and run the “Uninstall ChmodBPF” package, then open and run “Install ChmodBPF” in order to reset the ChmodBPF Launch Daemon. +[Issue 18734](https://gitlab.com/wireshark/wireshark/-/issues/18734). + +### Bug Fixes + +The following bugs have been fixed: + +* Error loading g729.so plugin with Wireshark 4.0.9 and 3.6.17 on macOS. [Issue 19374](https://gitlab.com/wireshark/wireshark/-/issues/19374). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +There are no updated protocols in this release. + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### New File Format Decoding Support + +There is no new or updated file format support in this release. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_4011.md b/corpus/changelog/wireshark_releases/wireshark_4011.md new file mode 100644 index 0000000000000000000000000000000000000000..424296254e5b971a6c6883a79fa5a0b88f83bcac --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_4011.md @@ -0,0 +1,107 @@ +# Wireshark 4.0.11 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.0.11.html +Version: 4.0.11 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +## What’s New + +*We do not ship official 32-bit Windows packages for Wireshark 4.0 and later*. +If you need to use Wireshark on that platform, we recommend using the latest 3.6 release. +[Issue 17779](https://gitlab.com/wireshark/wireshark/-/issues/17779) + +If you’re running Wireshark on macOS and upgraded to macOS 13 from an earlier version, you might have to open and run the “Uninstall ChmodBPF” package, then open and run “Install ChmodBPF” in order to reset the ChmodBPF Launch Daemon. +[Issue 18734](https://gitlab.com/wireshark/wireshark/-/issues/18734). + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2023-28](https://www.wireshark.org/security/wnpa-sec-2023-28) + SSH dissector crash. + [Issue 19369](https://gitlab.com/wireshark/wireshark/-/issues/19369). + +* [wnpa-sec-2023-29](https://www.wireshark.org/security/wnpa-sec-2023-29) + NetScreen file parser crash. + [Issue 19404](https://gitlab.com/wireshark/wireshark/-/issues/19404). + +The following bugs have been fixed: + +* First ZigBee APS packet is not decrypted. [Issue 16507](https://gitlab.com/wireshark/wireshark/-/issues/16507). +* Problem with decoding OpenFlow actions in OFPT\_FLOW\_MOD message. [Issue 17072](https://gitlab.com/wireshark/wireshark/-/issues/17072). +* The "frames" method in sharkd does not consider time references and displays incorrect delta time. [Issue 17923](https://gitlab.com/wireshark/wireshark/-/issues/17923). +* Wireshark and TShark throw packet-wireguard-WARNING when running on systems with FIPS enabled. [Issue 18441](https://gitlab.com/wireshark/wireshark/-/issues/18441). +* Wireshark interprets If\_fcslen option in the Interface Description Block as byte instead of bit. [Issue 19174](https://gitlab.com/wireshark/wireshark/-/issues/19174). +* Flathub’s Wireshark page shows wrong version number. [Issue 19382](https://gitlab.com/wireshark/wireshark/-/issues/19382). +* OSPFv3 RI decode error. [Issue 19444](https://gitlab.com/wireshark/wireshark/-/issues/19444). +* GSM SIM READ / UPDATE BINARY command has wrong offset. [Issue 19472](https://gitlab.com/wireshark/wireshark/-/issues/19472). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +DHCP, GSM SIM, IEEE 1722, ISDN SUP, ISO 15765, OpenFlow v1, OSPF, SSH, TCP, TECMP, Wi-SUN, WireGuard, and ZigBee + +### New and Updated Capture File Support + +NetScreen and pcapng + +### New File Format Decoding Support + +There is no new or updated file format support in this release. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_4012.md b/corpus/changelog/wireshark_releases/wireshark_4012.md new file mode 100644 index 0000000000000000000000000000000000000000..e153fb4df7802c5fa58de409a15a9f5f1cbf28e9 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_4012.md @@ -0,0 +1,126 @@ +# Wireshark 4.0.12 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.0.12.html +Version: 4.0.12 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +## What’s New + +*We do not ship official 32-bit Windows packages for Wireshark 4.0 and later*. +If you need to use Wireshark on that platform, we recommend using the latest 3.6 release. +[Issue 17779](https://gitlab.com/wireshark/wireshark/-/issues/17779) + +If you’re running Wireshark on macOS and upgraded to macOS 13 from an earlier version, you might have to open and run the “Uninstall ChmodBPF” package, then open and run “Install ChmodBPF” in order to reset the ChmodBPF Launch Daemon. +[Issue 18734](https://gitlab.com/wireshark/wireshark/-/issues/18734). + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2024-01](https://www.wireshark.org/security/wnpa-sec-2024-01) + GVCP dissector crash. + [Issue 19496](https://gitlab.com/wireshark/wireshark/-/issues/19496). + [CVE-2024-0208](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-0208). +* [wnpa-sec-2024-02](https://www.wireshark.org/security/wnpa-sec-2024-02) + IEEE 1609.2 dissector crash. + [Issue 19501](https://gitlab.com/wireshark/wireshark/-/issues/19501). + [CVE-2024-0209](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-0209). + +The following bugs have been fixed: + +* Capture filters not saved to recently used list. [Issue 12918](https://gitlab.com/wireshark/wireshark/-/issues/12918). +* OSS-Fuzz 64290: wireshark:fuzzshark\_ip: Global-buffer-overflow in dissect\_zcl\_read\_attr\_struct. [Issue 19490](https://gitlab.com/wireshark/wireshark/-/issues/19490). +* Segfault when enabling monitor mode on wireless card that falsely claims to support it. [Issue 16693](https://gitlab.com/wireshark/wireshark/-/issues/16693). +* Selection highlight lost when interface list is sorted. [Issue 19133](https://gitlab.com/wireshark/wireshark/-/issues/19133). +* Capture filter compilation fails with obscure error message. [Issue 19480](https://gitlab.com/wireshark/wireshark/-/issues/19480). +* GigE-vision: Control Protocol shows "unknown" as value for ASCII character set. [Issue 19494](https://gitlab.com/wireshark/wireshark/-/issues/19494). +* NFLOG timestamp is incorrect. [Issue 19525](https://gitlab.com/wireshark/wireshark/-/issues/19525). +* Qt6 Crash (Double Free) When Attempting to Save TCP Stream Graph. [Issue 19529](https://gitlab.com/wireshark/wireshark/-/issues/19529). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +pcapng: the if\_tsoffset option is now supported. + +### New File Format Decoding Support + +There is no new or updated file format support in this release. + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.0.12. +You can find release notes for prior versions at the following locations: + +* [Wireshark 4.0.11](https://www.wireshark.org/docs/relnotes/wireshark-4.0.11.html) +* [Wireshark 4.0.10](https://www.wireshark.org/docs/relnotes/wireshark-4.0.10.html) +* [Wireshark 4.0.9](https://www.wireshark.org/docs/relnotes/wireshark-4.0.9.html) +* [Wireshark 4.0.8](https://www.wireshark.org/docs/relnotes/wireshark-4.0.8.html) +* [Wireshark 4.0.7](https://www.wireshark.org/docs/relnotes/wireshark-4.0.7.html) +* [Wireshark 4.0.6](https://www.wireshark.org/docs/relnotes/wireshark-4.0.6.html) +* [Wireshark 4.0.5](https://www.wireshark.org/docs/relnotes/wireshark-4.0.5.html) +* [Wireshark 4.0.4](https://www.wireshark.org/docs/relnotes/wireshark-4.0.4.html) +* [Wireshark 4.0.3](https://www.wireshark.org/docs/relnotes/wireshark-4.0.3.html) +* [Wireshark 4.0.2](https://www.wireshark.org/docs/relnotes/wireshark-4.0.2.html) +* [Wireshark 4.0.1](https://www.wireshark.org/docs/relnotes/wireshark-4.0.1.html) +* [Wireshark 4.0.0](https://www.wireshark.org/docs/relnotes/wireshark-4.0.0.html) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_4013.md b/corpus/changelog/wireshark_releases/wireshark_4013.md new file mode 100644 index 0000000000000000000000000000000000000000..e7a27ac6bb2a0435ec9dcfeef23ee104b6a08c01 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_4013.md @@ -0,0 +1,117 @@ +# Wireshark 4.0.13 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.0.13.html +Version: 4.0.13 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +## What’s New + +*We do not ship official 32-bit Windows packages for Wireshark 4.0 and later*. +If you need to use Wireshark on that platform, we recommend using the latest 3.6 release. +[Issue 17779](https://gitlab.com/wireshark/wireshark/-/issues/17779) + +If you’re running Wireshark on macOS and upgraded to macOS 13 from an earlier version, you might have to open and run the “Uninstall ChmodBPF” package, then open and run “Install ChmodBPF” in order to reset the ChmodBPF Launch Daemon. +[Issue 18734](https://gitlab.com/wireshark/wireshark/-/issues/18734). + +### Bug Fixes + +The following vulnerabilities have been fixed: + +The following bugs have been fixed: + +* Capture start fails when file set enabled and file extension not supplied if directory contains a period. [Issue 14614](https://gitlab.com/wireshark/wireshark/-/issues/14614). +* Cannot drag and move custom filter buttons in toolbar. [Issue 19447](https://gitlab.com/wireshark/wireshark/-/issues/19447). +* sshdump fails to connect with private key (ssh-rsa) [Issue 19510](https://gitlab.com/wireshark/wireshark/-/issues/19510). +* Can’t open a snoop file from the Open dialog box unless I select "All files" as the file type. [Issue 19565](https://gitlab.com/wireshark/wireshark/-/issues/19565). +* Updater for 4.2.1 hangs. [Issue 19568](https://gitlab.com/wireshark/wireshark/-/issues/19568). +* Incorrect recursion depth assert failure when dissecting a legitimate GOOSE message. [Issue 19580](https://gitlab.com/wireshark/wireshark/-/issues/19580). +* TFTP dissector bug type listed as netscii instead of netascii doesn’t show all TFTP packets including TFTP blocks. [Issue 19589](https://gitlab.com/wireshark/wireshark/-/issues/19589). +* ciscodump - older SSH key exchange algorithms not supported. [Issue 19594](https://gitlab.com/wireshark/wireshark/-/issues/19594). +* CFLOW: failure to decode 0 length data fields of IPFIX variable length data types. [Issue 19605](https://gitlab.com/wireshark/wireshark/-/issues/19605). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +CFLOW, CMIP, DAP, DISP, GLOW, GOOSE, H.225, H.245, H.248, IEEE 1609.2, IPv4, IPv6, ISUP, ITS, Kerberos, LDAP, MMS, P22, P7, PARLAY, RSVP, RTMPT, SOME/IP, TCP, TFTP, X.509if, X.509sat, X11, Z39.50, and ZigBee Green Power + +### New and Updated Capture File Support + +### New File Format Decoding Support + +There is no new or updated file format support in this release. + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.0.13. +You can find release notes for prior versions at the following locations: + +* [Wireshark 4.0.12](https://www.wireshark.org/docs/relnotes/wireshark-4.0.12.html) +* [Wireshark 4.0.11](https://www.wireshark.org/docs/relnotes/wireshark-4.0.11.html) +* [Wireshark 4.0.10](https://www.wireshark.org/docs/relnotes/wireshark-4.0.10.html) +* [Wireshark 4.0.9](https://www.wireshark.org/docs/relnotes/wireshark-4.0.9.html) +* [Wireshark 4.0.8](https://www.wireshark.org/docs/relnotes/wireshark-4.0.8.html) +* [Wireshark 4.0.7](https://www.wireshark.org/docs/relnotes/wireshark-4.0.7.html) +* [Wireshark 4.0.6](https://www.wireshark.org/docs/relnotes/wireshark-4.0.6.html) +* [Wireshark 4.0.5](https://www.wireshark.org/docs/relnotes/wireshark-4.0.5.html) +* [Wireshark 4.0.4](https://www.wireshark.org/docs/relnotes/wireshark-4.0.4.html) +* [Wireshark 4.0.3](https://www.wireshark.org/docs/relnotes/wireshark-4.0.3.html) +* [Wireshark 4.0.2](https://www.wireshark.org/docs/relnotes/wireshark-4.0.2.html) +* [Wireshark 4.0.1](https://www.wireshark.org/docs/relnotes/wireshark-4.0.1.html) +* [Wireshark 4.0.0](https://www.wireshark.org/docs/relnotes/wireshark-4.0.0.html) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_4014.md b/corpus/changelog/wireshark_releases/wireshark_4014.md new file mode 100644 index 0000000000000000000000000000000000000000..0499fd50a719fd1433d495114501e56a011224d3 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_4014.md @@ -0,0 +1,119 @@ +# Wireshark 4.0.14 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.0.14.html +Version: 4.0.14 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +## What’s New + +*We do not ship official 32-bit Windows packages for Wireshark 4.0 and later*. +If you need to use Wireshark on that platform, we recommend using the latest 3.6 release. +[Issue 17779](https://gitlab.com/wireshark/wireshark/-/issues/17779) + +If you’re running Wireshark on macOS and upgraded to macOS 13 from an earlier version, you might have to open and run the “Uninstall ChmodBPF” package, then open and run “Install ChmodBPF” in order to reset the ChmodBPF Launch Daemon. +[Issue 18734](https://gitlab.com/wireshark/wireshark/-/issues/18734). + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2024-06](https://www.wireshark.org/security/wnpa-sec-2024-06) + T.38 dissector crash. + [Issue 19695](https://gitlab.com/wireshark/wireshark/-/issues/19695). + [CVE-2024-2955](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-2955). + +The following bugs have been fixed: + +* Packet Dissection CSV Export includes last column even if hidden. [Issue 19666](https://gitlab.com/wireshark/wireshark/-/issues/19666). +* Fuzz job issue: fuzz-2024-03-03-7204.pcap. [Issue 19685](https://gitlab.com/wireshark/wireshark/-/issues/19685). +* Fuzz job issue: randpkt-2024-03-05-8004.pcap. [Issue 19688](https://gitlab.com/wireshark/wireshark/-/issues/19688). +* '--export-objects' does not work as expected on tshark version later than 3.2.10. [Issue 19715](https://gitlab.com/wireshark/wireshark/-/issues/19715). +* Fuzz job issue: fuzz-2024-03-21-7215.pcap. [Issue 19717](https://gitlab.com/wireshark/wireshark/-/issues/19717). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +5GLI, 6LoWPAN, AFP, AllJoyn, AMQP, ASAP, Babel, BACnet, Banana, BEEP, Bencode, BFCP, BGP, BT BNEP, BT SDP, BT-DHT, BVLC, CFLOW, CIP, CMIP, CMP, COROSYNC/TOTEMSRP, COSE, CQL, CSN.1, DAP, DCOM, DHCPv6, DICOM, DISP, DOCSIS MAC MGMT, DOF, DVB-S2, EDONKEY, ErlDP, Etch, EXTREME MESH, FC-SWILS, GIOP, GLOW, GNW, GOOSE, GQUIC, Gryphon, GSM A-bis OML, GSUP, GTPv2, H.223, H.225.0, H.245, H.248, H.264, H.265, HSMS, ICMPv6, ICQ, IEEE1609dot2, IPP, IPPUSB, ISAKMP, iSCSI, ISIS LSP, ISO 7816, ISUP, ITS, JXTA, Kafka, KINK, KNX/IP, LDAP, LDP, LISP, LISP TCP, LLRP, LwM2M-TLV, M2UA, M3UA, MBIM, MMS, MONGO, MPEG PES, MPLS Echo, MQ PCF, MQTT-SN, MS-WSP, MSDP, MsgPack, NAS-5GS, NETLINK, NHRP, OpenFlow, OpenWire, OPSI, OSC, P22, P7, PANA, PIM, PNIO, ProtoBuf, PROXY, Q.2931, QNET, RDP, RESP, RPL, RSL, RSVP, RTLS, RTMPT, RTPS, S7COMM, SCTP, SIMULCRYPT, SMB2, SML, SNA, SNMP, Socks, SolarEdge, SOME/IP, SoulSeek, SUA, T.38, TCAP, TEAP, TFTP, Thread, TN5250, USBHID, USBVIDEO, VP9, WASSP, WiMAX ASN CP, WLCCP, WTP, X.509IF, X.509SAT, XML, XMPP, YAMI, Z39.50, and ZigBee ZCL + +### New and Updated Capture File Support + +### Updated File Format Decoding Support + +BLF, JPEG, and RBM + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.0.14. +You can find release notes for prior versions at the following locations: + +* [Wireshark 4.0.13](https://www.wireshark.org/docs/relnotes/wireshark-4.0.12.html) +* [Wireshark 4.0.12](https://www.wireshark.org/docs/relnotes/wireshark-4.0.12.html) +* [Wireshark 4.0.11](https://www.wireshark.org/docs/relnotes/wireshark-4.0.11.html) +* [Wireshark 4.0.10](https://www.wireshark.org/docs/relnotes/wireshark-4.0.10.html) +* [Wireshark 4.0.9](https://www.wireshark.org/docs/relnotes/wireshark-4.0.9.html) +* [Wireshark 4.0.8](https://www.wireshark.org/docs/relnotes/wireshark-4.0.8.html) +* [Wireshark 4.0.7](https://www.wireshark.org/docs/relnotes/wireshark-4.0.7.html) +* [Wireshark 4.0.6](https://www.wireshark.org/docs/relnotes/wireshark-4.0.6.html) +* [Wireshark 4.0.5](https://www.wireshark.org/docs/relnotes/wireshark-4.0.5.html) +* [Wireshark 4.0.4](https://www.wireshark.org/docs/relnotes/wireshark-4.0.4.html) +* [Wireshark 4.0.3](https://www.wireshark.org/docs/relnotes/wireshark-4.0.3.html) +* [Wireshark 4.0.2](https://www.wireshark.org/docs/relnotes/wireshark-4.0.2.html) +* [Wireshark 4.0.1](https://www.wireshark.org/docs/relnotes/wireshark-4.0.1.html) +* [Wireshark 4.0.0](https://www.wireshark.org/docs/relnotes/wireshark-4.0.0.html) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_4015.md b/corpus/changelog/wireshark_releases/wireshark_4015.md new file mode 100644 index 0000000000000000000000000000000000000000..3d1415d3303a273a56c18b5b16570bc007220185 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_4015.md @@ -0,0 +1,130 @@ +# Wireshark 4.0.15 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.0.15.html +Version: 4.0.15 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +## What’s New + +*We do not ship official 32-bit Windows packages for Wireshark 4.0 and later*. +If you need to use Wireshark on that platform, we recommend using the latest 3.6 release. +[Issue 17779](https://gitlab.com/wireshark/wireshark/-/issues/17779) + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2024-07](https://www.wireshark.org/security/wnpa-sec-2024-07) + MONGO and ZigBee TLV dissector infinite loops. + [Issue 19726](https://gitlab.com/wireshark/wireshark/-/issues/19726). + [CVE-2024-4854](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-4854). +* [wnpa-sec-2024-08](https://www.wireshark.org/security/wnpa-sec-2024-08) + The editcap command line utility could crash when chopping bytes from the beginning of a packet. + [Issue 19724](https://gitlab.com/wireshark/wireshark/-/issues/19724). + [CVE-2024-4853](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-4853). +* [wnpa-sec-2024-09](https://www.wireshark.org/security/wnpa-sec-2024-09) + The editcap command line utility could crash when injecting secrets while writing multiple files. + [Issue 19782](https://gitlab.com/wireshark/wireshark/-/issues/19782). + [CVE-2024-4855](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-4855). + +The following bugs have been fixed: + +* Flow Graph scrolls in the wrong direction vertically when pressing Up/Down. [Issue 12932](https://gitlab.com/wireshark/wireshark/-/issues/12932). +* TCP Stream Window Scaling not working in version 2.6.1 and later. [Issue 15016](https://gitlab.com/wireshark/wireshark/-/issues/15016). +* TCP stream graphs (Window scaling) axis display is confusing. [Issue 17425](https://gitlab.com/wireshark/wireshark/-/issues/17425). +* LUA get\_dissector does not give the correct dissector under 32-bit version. [Issue 18367](https://gitlab.com/wireshark/wireshark/-/issues/18367). +* Lua: Segfault when registering a field or expert info twice. [Issue 19194](https://gitlab.com/wireshark/wireshark/-/issues/19194). +* SSH can not decrypt when KEX is [[email protected]](/cdn-cgi/l/email-protection#8deef8fffbe8bfb8b8bcb4a0fee5ecbfb8bbcde1e4effefee5a3e2ffea). [Issue 19240](https://gitlab.com/wireshark/wireshark/-/issues/19240). +* Win64 4.1.0rc0: Crash in Capture Options after closing Manage Interfaces. [Issue 19287](https://gitlab.com/wireshark/wireshark/-/issues/19287). +* NAS 5G message container dissection. [Issue 19793](https://gitlab.com/wireshark/wireshark/-/issues/19793). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +5co\_legacy, DOCSIS MAC MGMT, FC FZS, GQUIC, IPARS, MONGO, NAS-5GS, PTP, SSH, and TIPC + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.0.15. +You can find release notes for prior versions at the following locations: + +* [Wireshark 4.0.14](https://www.wireshark.org/docs/relnotes/wireshark-4.0.14.html) +* [Wireshark 4.0.13](https://www.wireshark.org/docs/relnotes/wireshark-4.0.13.html) +* [Wireshark 4.0.12](https://www.wireshark.org/docs/relnotes/wireshark-4.0.12.html) +* [Wireshark 4.0.11](https://www.wireshark.org/docs/relnotes/wireshark-4.0.11.html) +* [Wireshark 4.0.10](https://www.wireshark.org/docs/relnotes/wireshark-4.0.10.html) +* [Wireshark 4.0.9](https://www.wireshark.org/docs/relnotes/wireshark-4.0.9.html) +* [Wireshark 4.0.8](https://www.wireshark.org/docs/relnotes/wireshark-4.0.8.html) +* [Wireshark 4.0.7](https://www.wireshark.org/docs/relnotes/wireshark-4.0.7.html) +* [Wireshark 4.0.6](https://www.wireshark.org/docs/relnotes/wireshark-4.0.6.html) +* [Wireshark 4.0.5](https://www.wireshark.org/docs/relnotes/wireshark-4.0.5.html) +* [Wireshark 4.0.4](https://www.wireshark.org/docs/relnotes/wireshark-4.0.4.html) +* [Wireshark 4.0.3](https://www.wireshark.org/docs/relnotes/wireshark-4.0.3.html) +* [Wireshark 4.0.2](https://www.wireshark.org/docs/relnotes/wireshark-4.0.2.html) +* [Wireshark 4.0.1](https://www.wireshark.org/docs/relnotes/wireshark-4.0.1.html) +* [Wireshark 4.0.0](https://www.wireshark.org/docs/relnotes/wireshark-4.0.0.html) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_4016.md b/corpus/changelog/wireshark_releases/wireshark_4016.md new file mode 100644 index 0000000000000000000000000000000000000000..e18d91373cd503daefc72c898f0824b4fc401443 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_4016.md @@ -0,0 +1,119 @@ +# Wireshark 4.0.16 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.0.16.html +Version: 4.0.16 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +## What’s New + +### Bug Fixes + +A regression in the TCP Stream Graph "Time Sequence (tcptrace)" receive window line behavior introduced in 4.0.15 and 4.2.5 has been fixed. [Issue 19846](https://gitlab.com/wireshark/wireshark/-/issues/19846) + +The following vulnerability has been fixed: + +* [wnpa-sec-2024-10](https://www.wireshark.org/security/wnpa-sec-2024-10) + SPRT dissector crash. + [Issue 19559](https://gitlab.com/wireshark/wireshark/-/issues/19559). + +The following bugs have been fixed: + +* RADIUS dissector’s dictionary loading broken in many ways. [Issue 6466](https://gitlab.com/wireshark/wireshark/-/issues/6466). +* 3.4 → 3.6.5 ASCII display is broken on CentOS 7. [Issue 18096](https://gitlab.com/wireshark/wireshark/-/issues/18096). +* Funnel/Lua: Closing child window disconnects buttons of parent. [Issue 18386](https://gitlab.com/wireshark/wireshark/-/issues/18386). +* SPRT parser crash. [Issue 19559](https://gitlab.com/wireshark/wireshark/-/issues/19559). +* TCP Stream Graphs green sliding window line not displayed correctly. [Issue 19846](https://gitlab.com/wireshark/wireshark/-/issues/19846). +* Wireshark window doesn’t fully fit on screen on small resolutions and can’t be resized properly on Russian language. [Issue 19861](https://gitlab.com/wireshark/wireshark/-/issues/19861). +* Wireshark expects wrong length for DHCP Relay Agent Information Source Port Suboption. [Issue 19909](https://gitlab.com/wireshark/wireshark/-/issues/19909). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +DHCP, NAS-5GS, PKT CCC, RLC-LTE, SPRT, and Wi-SUN + +### New and Updated Capture File Support + +log3gpp + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.0.16. +You can find release notes for prior versions at the following locations: + +* [Wireshark 4.0.15](https://www.wireshark.org/docs/relnotes/wireshark-4.0.15.html) +* [Wireshark 4.0.14](https://www.wireshark.org/docs/relnotes/wireshark-4.0.14.html) +* [Wireshark 4.0.13](https://www.wireshark.org/docs/relnotes/wireshark-4.0.13.html) +* [Wireshark 4.0.12](https://www.wireshark.org/docs/relnotes/wireshark-4.0.12.html) +* [Wireshark 4.0.11](https://www.wireshark.org/docs/relnotes/wireshark-4.0.11.html) +* [Wireshark 4.0.10](https://www.wireshark.org/docs/relnotes/wireshark-4.0.10.html) +* [Wireshark 4.0.9](https://www.wireshark.org/docs/relnotes/wireshark-4.0.9.html) +* [Wireshark 4.0.8](https://www.wireshark.org/docs/relnotes/wireshark-4.0.8.html) +* [Wireshark 4.0.7](https://www.wireshark.org/docs/relnotes/wireshark-4.0.7.html) +* [Wireshark 4.0.6](https://www.wireshark.org/docs/relnotes/wireshark-4.0.6.html) +* [Wireshark 4.0.5](https://www.wireshark.org/docs/relnotes/wireshark-4.0.5.html) +* [Wireshark 4.0.4](https://www.wireshark.org/docs/relnotes/wireshark-4.0.4.html) +* [Wireshark 4.0.3](https://www.wireshark.org/docs/relnotes/wireshark-4.0.3.html) +* [Wireshark 4.0.2](https://www.wireshark.org/docs/relnotes/wireshark-4.0.2.html) +* [Wireshark 4.0.1](https://www.wireshark.org/docs/relnotes/wireshark-4.0.1.html) +* [Wireshark 4.0.0](https://www.wireshark.org/docs/relnotes/wireshark-4.0.0.html) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://www.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_4017.md b/corpus/changelog/wireshark_releases/wireshark_4017.md new file mode 100644 index 0000000000000000000000000000000000000000..e9a1c008a6fcce06acff459e3d0002460b9e1f23 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_4017.md @@ -0,0 +1,127 @@ +# Wireshark 4.0.17 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.0.17.html +Version: 4.0.17 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +This is expected to be the final release of the 4.0 branch. + +This is the last release to support Windows 8.1 and Windows Server 2012. + +### Bug Fixes + +A regression in the TCP Stream Graph "Time Sequence (tcptrace)" receive window line behavior introduced in 4.0.15 and 4.2.5 has been fixed. [Issue 19846](https://gitlab.com/wireshark/wireshark/-/issues/19846) + +The following vulnerability has been fixed: + +* [wnpa-sec-2024-11](https://www.wireshark.org/security/wnpa-sec-2024-11) + NTLMSSP dissector crash. + [Issue 19943](https://gitlab.com/wireshark/wireshark/-/issues/19943). + [CVE-2024-8250](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-8250). + +The following bugs have been fixed: + +* Fuzz job issue: fuzz-2024-01-31-7745.pcap. [Issue 19627](https://gitlab.com/wireshark/wireshark/-/issues/19627). +* OSS-Fuzz 70534: wireshark:fuzzshark\_ip\_proto-udp: Stack-overflow in dissect\_cbor\_main\_type. [Issue 19935](https://gitlab.com/wireshark/wireshark/-/issues/19935). +* 6loWPAN: Page Number Field Incorrect Registration. [Issue 19934](https://gitlab.com/wireshark/wireshark/-/issues/19934). +* Fuzz job issue: fuzz-2024-07-28-7314.pcap. [Issue 19964](https://gitlab.com/wireshark/wireshark/-/issues/19964). +* PacketBB incorrectly reports "Malformed Packet" [Issue 19972](https://gitlab.com/wireshark/wireshark/-/issues/19972). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +6LoWPAN, CAN-ETH, CBOR, LBMSRS, NTLMSSP, PacketBB, and PN-MRP + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.0.17. +You can find release notes for prior versions at the following locations: + +* [Wireshark 4.0.16](https://www.wireshark.org/docs/relnotes/wireshark-4.0.16.html) +* [Wireshark 4.0.15](https://www.wireshark.org/docs/relnotes/wireshark-4.0.15.html) +* [Wireshark 4.0.14](https://www.wireshark.org/docs/relnotes/wireshark-4.0.14.html) +* [Wireshark 4.0.13](https://www.wireshark.org/docs/relnotes/wireshark-4.0.13.html) +* [Wireshark 4.0.12](https://www.wireshark.org/docs/relnotes/wireshark-4.0.12.html) +* [Wireshark 4.0.11](https://www.wireshark.org/docs/relnotes/wireshark-4.0.11.html) +* [Wireshark 4.0.10](https://www.wireshark.org/docs/relnotes/wireshark-4.0.10.html) +* [Wireshark 4.0.9](https://www.wireshark.org/docs/relnotes/wireshark-4.0.9.html) +* [Wireshark 4.0.8](https://www.wireshark.org/docs/relnotes/wireshark-4.0.8.html) +* [Wireshark 4.0.7](https://www.wireshark.org/docs/relnotes/wireshark-4.0.7.html) +* [Wireshark 4.0.6](https://www.wireshark.org/docs/relnotes/wireshark-4.0.6.html) +* [Wireshark 4.0.5](https://www.wireshark.org/docs/relnotes/wireshark-4.0.5.html) +* [Wireshark 4.0.4](https://www.wireshark.org/docs/relnotes/wireshark-4.0.4.html) +* [Wireshark 4.0.3](https://www.wireshark.org/docs/relnotes/wireshark-4.0.3.html) +* [Wireshark 4.0.2](https://www.wireshark.org/docs/relnotes/wireshark-4.0.2.html) +* [Wireshark 4.0.1](https://www.wireshark.org/docs/relnotes/wireshark-4.0.1.html) +* [Wireshark 4.0.0](https://www.wireshark.org/docs/relnotes/wireshark-4.0.0.html) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://www.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_402.md b/corpus/changelog/wireshark_releases/wireshark_402.md new file mode 100644 index 0000000000000000000000000000000000000000..b494d9304f2ca5537e4ebcd2bd2e63f27e0991b1 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_402.md @@ -0,0 +1,106 @@ +# Wireshark 4.0.2 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.0.2.html +Version: 4.0.2 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +## What’s New + +*We do not ship official 32-bit Windows packages for Wireshark 4.0 and later*. +If you need to use Wireshark on that platform, we recommend using the latest 3.6 release. +[Issue 17779](https://gitlab.com/wireshark/wireshark/-/issues/17779) + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2022-09](https://www.wireshark.org/security/wnpa-sec-2022-09) + Multiple dissector infinite loops. +* [wnpa-sec-2022-10](https://www.wireshark.org/security/wnpa-sec-2022-10) + Kafka dissector memory exhaustion. + +The following bugs have been fixed: + +* Qt: Endpoints dialog - unexpected byte unit suffixes in packet columns. [Issue 18229](https://gitlab.com/wireshark/wireshark/-/issues/18229). +* GOOSE: field "floating\_point" not working anymore. [Issue 18491](https://gitlab.com/wireshark/wireshark/-/issues/18491). +* EVS Header-Full format padding issues. [Issue 18498](https://gitlab.com/wireshark/wireshark/-/issues/18498). +* Wireshark 4.0.0 VOIP playback has no sound and can’t resume after pausing. [Issue 18510](https://gitlab.com/wireshark/wireshark/-/issues/18510). +* Wireshark crashes when exporting a profile on Mac OSX if there is no extension. [Issue 18525](https://gitlab.com/wireshark/wireshark/-/issues/18525). +* EVS dissector missing value description. [Issue 18550](https://gitlab.com/wireshark/wireshark/-/issues/18550). +* Qt 6 font descriptions not backward compatible with Qt 5. [Issue 18553](https://gitlab.com/wireshark/wireshark/-/issues/18553). +* Wireshark, wrong TCP ACKed unseen segment message. [Issue 18558](https://gitlab.com/wireshark/wireshark/-/issues/18558). +* Invalid Cyrillic symbol in timezone at "Arrival Time" field in frame. [Issue 18562](https://gitlab.com/wireshark/wireshark/-/issues/18562). +* ProtoBuf parse extension definitions failed. [Issue 18599](https://gitlab.com/wireshark/wireshark/-/issues/18599). +* Fuzz job crash output: fuzz-2022-11-09-11134.pcap. [Issue 18613](https://gitlab.com/wireshark/wireshark/-/issues/18613). +* Fuzz job crash output: fuzz-2022-11-14-11111.pcap. [Issue 18632](https://gitlab.com/wireshark/wireshark/-/issues/18632). +* Wireshark is using old version of ASN (ETSI TS 125 453 V11.2.0) which is imapacting length of param in the messages. [Issue 18646](https://gitlab.com/wireshark/wireshark/-/issues/18646). +* BGP: False IGMP flags value in EVPN routes (type 6,7,8) [Issue 18660](https://gitlab.com/wireshark/wireshark/-/issues/18660). +* wslog assumes stderr and stdout exist. [Issue 18684](https://gitlab.com/wireshark/wireshark/-/issues/18684). +* Editing packet comments, with non-ASCII characters, on Windows saves them in the local code page, not in UTF-8. [Issue 18698](https://gitlab.com/wireshark/wireshark/-/issues/18698). +* Unable to decrypt PSK based DTLS traffic which uses Connection ID. [Issue 18705](https://gitlab.com/wireshark/wireshark/-/issues/18705). +* HTTP2 tests fail when built without nghttp2. [Issue 18707](https://gitlab.com/wireshark/wireshark/-/issues/18707). + +### New and Updated Features + +### Removed Features and Support + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +ASN.1 PER, ASTERIX, BGP, BPv6, DTLS, EVS, GOOSE, GSM Osmux, IPv6, Kafka, Locamation IM, MONGO, NXP 802.15.4, OpenFlow v6, PCAP, Protobuf, RTP, S1AP, SKINNY, TCP, and WASSP + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### New File Format Decoding Support + +There is no new or updated file format support in this release. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_403.md b/corpus/changelog/wireshark_releases/wireshark_403.md new file mode 100644 index 0000000000000000000000000000000000000000..792dddd3de8f28fef7600b33bf9d7ab1d59c4733 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_403.md @@ -0,0 +1,125 @@ +# Wireshark 4.0.3 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.0.3.html +Version: 4.0.3 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +## What’s New + +*We do not ship official 32-bit Windows packages for Wireshark 4.0 and later*. +If you need to use Wireshark on that platform, we recommend using the latest 3.6 release. +[Issue 17779](https://gitlab.com/wireshark/wireshark/-/issues/17779) + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2023-01](https://www.wireshark.org/security/wnpa-sec-2023-01) + EAP dissector crash. + [Issue 18622](https://gitlab.com/wireshark/wireshark/-/issues/18622). +* [wnpa-sec-2023-02](https://www.wireshark.org/security/wnpa-sec-2023-02) + NFS dissector memory leak. + [Issue 18628](https://gitlab.com/wireshark/wireshark/-/issues/18628). +* [wnpa-sec-2023-03](https://www.wireshark.org/security/wnpa-sec-2023-03) + Dissection engine crash. + [Issue 18766](https://gitlab.com/wireshark/wireshark/-/issues/18766). +* [wnpa-sec-2023-04](https://www.wireshark.org/security/wnpa-sec-2023-04) + GNW dissector crash. + [Issue 18779](https://gitlab.com/wireshark/wireshark/-/issues/18779). +* [wnpa-sec-2023-05](https://www.wireshark.org/security/wnpa-sec-2023-05) + iSCSI dissector crash. + [Issue 18796](https://gitlab.com/wireshark/wireshark/-/issues/18796). +* [wnpa-sec-2023-06](https://www.wireshark.org/security/wnpa-sec-2023-06) + Multiple dissector excessive loops. + [Issue 18711](https://gitlab.com/wireshark/wireshark/-/issues/18711). [Issue 18720](https://gitlab.com/wireshark/wireshark/-/issues/18720), [Issue 18737](https://gitlab.com/wireshark/wireshark/-/issues/18737). +* [wnpa-sec-2023-07](https://www.wireshark.org/security/wnpa-sec-2023-07) + TIPC dissector crash. + [Issue 18770](https://gitlab.com/wireshark/wireshark/-/issues/18770). + +The following bugs have been fixed: + +* Qt: After modifying coloring rules, the coloring rule applied to the first packet reflects the coloring rules previously in effect. [Issue 12475](https://gitlab.com/wireshark/wireshark/-/issues/12475). +* Help file doesn’t display for extcap interfaces. [Issue 15592](https://gitlab.com/wireshark/wireshark/-/issues/15592). +* For USB traffic on XHC20 interface destination is always given as Host. [Issue 16768](https://gitlab.com/wireshark/wireshark/-/issues/16768). +* Wireshark Expert Info - cannot deselect the limit to display filter tick box. [Issue 18461](https://gitlab.com/wireshark/wireshark/-/issues/18461). +* Wrong pointer conversion in get\_data\_source\_tvb\_by\_name() [Issue 18517](https://gitlab.com/wireshark/wireshark/-/issues/18517). +* Wrong number of bits skipped while decoding an empty UTF8String on UPER packet. [Issue 18702](https://gitlab.com/wireshark/wireshark/-/issues/18702). +* Crash when analyzing protobuf packets. [Issue 18730](https://gitlab.com/wireshark/wireshark/-/issues/18730). +* Uninitialized values in various dissectors. [Issue 18742](https://gitlab.com/wireshark/wireshark/-/issues/18742). +* String (GeoIP country/city) ordering doesn’t work in Endpoints. [Issue 18749](https://gitlab.com/wireshark/wireshark/-/issues/18749). +* Wireshark crashes with an assertion failure on stray minus in filter. [Issue 18750](https://gitlab.com/wireshark/wireshark/-/issues/18750). +* IO Graph: Add new graph only works until the 10th graph. [Issue 18762](https://gitlab.com/wireshark/wireshark/-/issues/18762). +* Fuzz job crash output: fuzz-2022-12-30-11007.pcap. [Issue 18770](https://gitlab.com/wireshark/wireshark/-/issues/18770). +* Q.850 - error in label for cause 0x7F. [Issue 18780](https://gitlab.com/wireshark/wireshark/-/issues/18780). +* Uninitialized values in CoAP and RTPS dissectors. [Issue 18785](https://gitlab.com/wireshark/wireshark/-/issues/18785). +* Screenshots in AppStream metainfo.xml file not available. [Issue 18801](https://gitlab.com/wireshark/wireshark/-/issues/18801). + +### New and Updated Features + +### Removed Features and Support + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +ASTERIX, BEEP, BGP, BPv6, CoAP, EAP, GNW, GSM A-bis P-GSL, iSCSI, ISUP, LwM2M-TLV, MBIM, NBAP, NFS, OBD-II, OPUS, ProtoBuf, RLC, ROHC, RTPS, Telnet, TIPC, and USB + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### New File Format Decoding Support + +There is no new or updated file format support in this release. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_404.md b/corpus/changelog/wireshark_releases/wireshark_404.md new file mode 100644 index 0000000000000000000000000000000000000000..deb6c289be392c571c64a529b365a4212fc3fd8f --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_404.md @@ -0,0 +1,120 @@ +# Wireshark 4.0.4 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.0.4.html +Version: 4.0.4 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +## What’s New + +*We do not ship official 32-bit Windows packages for Wireshark 4.0 and later*. +If you need to use Wireshark on that platform, we recommend using the latest 3.6 release. +[Issue 17779](https://gitlab.com/wireshark/wireshark/-/issues/17779) + +If you’re running Wireshark on macOS and upgraded to macOS 13 from an earlier version, you will likely have to open and run the “Uninstall ChmodBPF” package, then open and run “Install ChmodBPF” in order to reset the ChmodBPF Launch Daemon. +[Issue 18734](https://gitlab.com/wireshark/wireshark/-/issues/18734). + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2023-08](https://www.wireshark.org/security/wnpa-sec-2023-08) + ISO 15765 and ISO 10681 dissector crash. + [Issue 18839](https://gitlab.com/wireshark/wireshark/-/issues/18839). + +The following bugs have been fixed: + +* UTF-8 characters end up escaped in PSML output. [Issue 10445](https://gitlab.com/wireshark/wireshark/-/issues/10445). +* Export filtered displayed packets won’t save IP fragments of SCTP fragments needed to reassemble a displayed frame. [Issue 12597](https://gitlab.com/wireshark/wireshark/-/issues/12597). +* DICOM dissection in reassembled PDV goes wrong. [Issue 13388](https://gitlab.com/wireshark/wireshark/-/issues/13388). +* "Export Objects - IMF" produces incorrect file, TCP reassembly fails with retransmissions that have additional data. [Issue 13523](https://gitlab.com/wireshark/wireshark/-/issues/13523). +* The intelligent scroll bar or minimap is not predictable on locating and scrolling. [Issue 13989](https://gitlab.com/wireshark/wireshark/-/issues/13989). +* If you mark (or unmark) the currently-selected frame, the packet details still say it’s not marked (or it is marked) [Issue 14330](https://gitlab.com/wireshark/wireshark/-/issues/14330). +* An out-of-order packet incorrectly detected as retransmission breaks desegmentation of TCP stream. [Issue 15993](https://gitlab.com/wireshark/wireshark/-/issues/15993). +* Sorting Packet Loss Column is not sorting correct. [Issue 16785](https://gitlab.com/wireshark/wireshark/-/issues/16785). +* Some HTTPS packets cannot be decrypted. [Issue 17406](https://gitlab.com/wireshark/wireshark/-/issues/17406). +* SIP TCP decoding regression from Wireshark 1.99.0 to 3.6.8. [Issue 18411](https://gitlab.com/wireshark/wireshark/-/issues/18411). +* Frame comments not preserved when using filter to write new pcap from tshark. [Issue 18693](https://gitlab.com/wireshark/wireshark/-/issues/18693). +* ChmodBPF not working on macOS Ventura 13.1. [Issue 18734](https://gitlab.com/wireshark/wireshark/-/issues/18734). +* Wireshark GUI and window manager stuck after setting display filter. [Issue 18809](https://gitlab.com/wireshark/wireshark/-/issues/18809). +* Dissector bug, protocol H.261. [Issue 18812](https://gitlab.com/wireshark/wireshark/-/issues/18812). +* File extension heuristics are case-sensitive. [Issue 18821](https://gitlab.com/wireshark/wireshark/-/issues/18821). +* Symbolic links to packages in macOS dmg can’t be double-clicked to install on macOS 13.2. [Issue 18830](https://gitlab.com/wireshark/wireshark/-/issues/18830). +* Potential memory leak in tshark.c. [Issue 18837](https://gitlab.com/wireshark/wireshark/-/issues/18837). +* Fuzz job crash output: fuzz-2023-02-05-7303.pcap. [Issue 18842](https://gitlab.com/wireshark/wireshark/-/issues/18842). +* f5fileinfo: Hardware platforms missing descriptions. [Issue 18848](https://gitlab.com/wireshark/wireshark/-/issues/18848). +* The lines in the intelligent scrollbar are off by one. [Issue 18850](https://gitlab.com/wireshark/wireshark/-/issues/18850). +* Wireshark crashes on invalid UDS packet in Lua context. [Issue 18865](https://gitlab.com/wireshark/wireshark/-/issues/18865). +* TECMP dissector shows the wrong Voltage in Vendor Data. [Issue 18871](https://gitlab.com/wireshark/wireshark/-/issues/18871). +* UDS: Names of RDTCI subfunctions 0x0b …​ 0x0e are not correct. [Issue 18873](https://gitlab.com/wireshark/wireshark/-/issues/18873). + +### New and Updated Features + +There are no new or updated features in this release. + +### Removed Features and Support + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +ASTERIX, BGP, DHCP, ERF, F5 Ethernet trailer, GMR-1 RR, Gryphon, GSM SMS, H.261, H.450, ISO 10681, ISO 15765, MIPv6, NAS-5gs, NR RRC, NS Trace, OptoMMP, PDCP-LTE, PDCP-NR, QSIG, ROHC, RSVP, RTCP, SCTP, SIP, TCP, TECMP, TWAMP, UDS, and UMTS RLC + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### New File Format Decoding Support + +There is no new or updated file format support in this release. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_405.md b/corpus/changelog/wireshark_releases/wireshark_405.md new file mode 100644 index 0000000000000000000000000000000000000000..e2710d5bea777552918a934058fac1eed91e1fe2 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_405.md @@ -0,0 +1,116 @@ +# Wireshark 4.0.5 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.0.5.html +Version: 4.0.5 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +## What’s New + +*We do not ship official 32-bit Windows packages for Wireshark 4.0 and later*. +If you need to use Wireshark on that platform, we recommend using the latest 3.6 release. +[Issue 17779](https://gitlab.com/wireshark/wireshark/-/issues/17779) + +If you’re running Wireshark on macOS and upgraded to macOS 13 from an earlier version, you will likely have to open and run the “Uninstall ChmodBPF” package, then open and run “Install ChmodBPF” in order to reset the ChmodBPF Launch Daemon. +[Issue 18734](https://gitlab.com/wireshark/wireshark/-/issues/18734). + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2023-09](https://www.wireshark.org/security/wnpa-sec-2023-09) + RPCoRDMA dissector crash. + [Issue 18852](https://gitlab.com/wireshark/wireshark/-/issues/18852). +* [wnpa-sec-2023-10](https://www.wireshark.org/security/wnpa-sec-2023-10) + LISP dissector large loop. + [Issue 18900](https://gitlab.com/wireshark/wireshark/-/issues/18900). +* [wnpa-sec-2023-11](https://www.wireshark.org/security/wnpa-sec-2023-11) + GQUIC dissector crash + [Issue 18947](https://gitlab.com/wireshark/wireshark/-/issues/18947). + +The following bugs have been fixed: + +* Wireshark ITS Dissector RTCMEM wrong protocol version selector 2 - should use 1. [Issue 18862](https://gitlab.com/wireshark/wireshark/-/issues/18862). +* Wireshark treats the letter E in SSRC as an exponential representation of a number. [Issue 18879](https://gitlab.com/wireshark/wireshark/-/issues/18879). +* VNC RRE Parser skips over data. [Issue 18883](https://gitlab.com/wireshark/wireshark/-/issues/18883). +* sshdump coredump when --remote-interface is left empty. [Issue 18904](https://gitlab.com/wireshark/wireshark/-/issues/18904). +* Fuzz job crash output: fuzz-2023-03-17-7298.pcap. [Issue 18917](https://gitlab.com/wireshark/wireshark/-/issues/18917). +* Fuzz job crash output: fuzz-2023-03-27-7564.pcap. [Issue 18934](https://gitlab.com/wireshark/wireshark/-/issues/18934). +* RFC8925 support (dhcp option 108) [Issue 18943](https://gitlab.com/wireshark/wireshark/-/issues/18943). +* DIS dissector shows an incorrect state in the packet list info column. [Issue 18967](https://gitlab.com/wireshark/wireshark/-/issues/18967). +* RTP analysis shows incorrect timestamp error when timestamp is rolled over. [Issue 18973](https://gitlab.com/wireshark/wireshark/-/issues/18973). +* Asterisk (\*) key crash on Endpoint/Conversation dialog. [Issue 18975](https://gitlab.com/wireshark/wireshark/-/issues/18975). +* The RTP player waveform now synchronizes better with audio. + +### New and Updated Features + +There are no new or updated features in this release. + +### Removed Features and Support + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +DHCP, DIS, DNS, ERF, FF, genl, GQUIC, GSM A-bis OML, HL7, IEEE 802.11, ITS, LAPD, netfilter, netlink-route, netlink-sock\_diag, nl80211, RLC, RPCoRDMA, RTPS, SCTP, SMB, UDS, VNC, and WCP + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +Netmon and NetScaler + +### New File Format Decoding Support + +There is no new or updated file format support in this release. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_406.md b/corpus/changelog/wireshark_releases/wireshark_406.md new file mode 100644 index 0000000000000000000000000000000000000000..bb5b9c6a156a817331593f1f1bd51ff1d52350a7 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_406.md @@ -0,0 +1,145 @@ +# Wireshark 4.0.6 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.0.6.html +Version: 4.0.6 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +## What’s New + +*We do not ship official 32-bit Windows packages for Wireshark 4.0 and later*. +If you need to use Wireshark on that platform, we recommend using the latest 3.6 release. +[Issue 17779](https://gitlab.com/wireshark/wireshark/-/issues/17779) + +If you’re running Wireshark on macOS and upgraded to macOS 13 from an earlier version, you will likely have to open and run the “Uninstall ChmodBPF” package, then open and run “Install ChmodBPF” in order to reset the ChmodBPF Launch Daemon. +[Issue 18734](https://gitlab.com/wireshark/wireshark/-/issues/18734). + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2023-12](https://www.wireshark.org/security/wnpa-sec-2023-12) + Candump log file parser crash. + [Issue 19062](https://gitlab.com/wireshark/wireshark/-/issues/19062). + [CVE-2023-2855](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-2855). +* [wnpa-sec-2023-13](https://www.wireshark.org/security/wnpa-sec-2023-13) + BLF file parser crash. + [Issue 19063](https://gitlab.com/wireshark/wireshark/-/issues/19063). + [CVE-2023-2857](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-2857). +* [wnpa-sec-2023-14](https://www.wireshark.org/security/wnpa-sec-2023-14) + GDSDB dissector infinite loop. + [Issue 19068](https://gitlab.com/wireshark/wireshark/-/issues/19068). +* [wnpa-sec-2023-15](https://www.wireshark.org/security/wnpa-sec-2023-15) + NetScaler file parser crash. + [Issue 19081](https://gitlab.com/wireshark/wireshark/-/issues/19081). + [CVE-2023-2858](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-2858). +* [wnpa-sec-2023-16](https://www.wireshark.org/security/wnpa-sec-2023-16) + VMS TCPIPtrace file parser crash. + [Issue 19083](https://gitlab.com/wireshark/wireshark/-/issues/19083). + [CVE-2023-2856](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-2856). +* [wnpa-sec-2023-17](https://www.wireshark.org/security/wnpa-sec-2023-17) + BLF file parser crash. + [Issue 19084](https://gitlab.com/wireshark/wireshark/-/issues/19084). + [CVE-2023-2854](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-2854). +* [wnpa-sec-2023-18](https://www.wireshark.org/security/wnpa-sec-2023-18) + RTPS dissector crash. + [Issue 19085](https://gitlab.com/wireshark/wireshark/-/issues/19085). + [CVE-2023-0666](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-0666). +* [wnpa-sec-2023-19](https://www.wireshark.org/security/wnpa-sec-2023-19) + IEEE C37.118 Synchrophasor dissector crash. + [Issue 19087](https://gitlab.com/wireshark/wireshark/-/issues/19087). + [CVE-2023-0668](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-0668). +* [wnpa-sec-2023-20](https://www.wireshark.org/security/wnpa-sec-2023-20) + XRA dissector infinite loop. + [Issue 19100](https://gitlab.com/wireshark/wireshark/-/issues/19100). + +The following bugs have been fixed: + +* Conversations list has incorrect unit (bytes) in bit speed columns in the 3.7 development versions. [Issue 18211](https://gitlab.com/wireshark/wireshark/-/issues/18211). +* The media\_type table should treat media types, e.g. application/3gppHal+json, as case-insensitive. [Issue 18611](https://gitlab.com/wireshark/wireshark/-/issues/18611). +* NNTP dissector bug. [Issue 18981](https://gitlab.com/wireshark/wireshark/-/issues/18981). +* Incorrect padding in BFCP decoder. [Issue 18890](https://gitlab.com/wireshark/wireshark/-/issues/18890). +* SPNEGO dissector bug. [Issue 18991](https://gitlab.com/wireshark/wireshark/-/issues/18991). +* SRT values are incorrect when applying a time shift. [Issue 18999](https://gitlab.com/wireshark/wireshark/-/issues/18999). +* Add warning that capturing is not supported in Wireshark installed from flatpak. [Issue 19008](https://gitlab.com/wireshark/wireshark/-/issues/19008). +* Opening Wireshark with -z io,stat option. [Issue 19042](https://gitlab.com/wireshark/wireshark/-/issues/19042). +* batadv dissector bug. [Issue 19047](https://gitlab.com/wireshark/wireshark/-/issues/19047). +* radiotap-gen build fails if pcap is not found. [Issue 19059](https://gitlab.com/wireshark/wireshark/-/issues/19059). +* [UDS] When filtering the uds.wdbi.data\_identifier or uds.iocbi.data\_identifier field is interpreted as 1 byte whereas it consists of 2 bytes. [Issue 19078](https://gitlab.com/wireshark/wireshark/-/issues/19078). +* Wireshark can’t save this capture in that format. [Issue 19080](https://gitlab.com/wireshark/wireshark/-/issues/19080). +* MSMMS parsing buffer overflow. [Issue 19086](https://gitlab.com/wireshark/wireshark/-/issues/19086). +* USB HID parser shows wrong label for usages Rx/Vx/Vbrx of usage page Generic Desktop Control. [Issue 19095](https://gitlab.com/wireshark/wireshark/-/issues/19095). +* "Follow → QUIC Stream" mixes data between streams. [Issue 19102](https://gitlab.com/wireshark/wireshark/-/issues/19102). + +### New and Updated Features + +The media type dissector table now properly treats media types and subtypes +as case-insensitive automatically, per RFC 6838. Media types no longer need +to be lower cased before registering or looking up in the table. + +### Removed Features and Support + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +batadv, BFCP, CommunityID, COSE, GDSDB, H.265, HTTP, ILP, ISAKMP, MSMMS, NNTP, NR RRC, NTLMSSP, QUIC, RTPS, SPNEGO, Synphasor, TCP, UDS, ULP, USB HID, and XRA + +### New and Updated Capture File Support + +BLF, Candump, NetScaler, and VMS TCPIPtrace + +### New File Format Decoding Support + +There is no new or updated file format support in this release. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_407.md b/corpus/changelog/wireshark_releases/wireshark_407.md new file mode 100644 index 0000000000000000000000000000000000000000..05436b3393f2a66acf6f243820e09c5e2270bbf6 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_407.md @@ -0,0 +1,122 @@ +# Wireshark 4.0.7 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.0.7.html +Version: 4.0.7 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +## What’s New + +*We do not ship official 32-bit Windows packages for Wireshark 4.0 and later*. +If you need to use Wireshark on that platform, we recommend using the latest 3.6 release. +[Issue 17779](https://gitlab.com/wireshark/wireshark/-/issues/17779) + +If you’re running Wireshark on macOS and upgraded to macOS 13 from an earlier version, you might have to open and run the “Uninstall ChmodBPF” package, then open and run “Install ChmodBPF” in order to reset the ChmodBPF Launch Daemon. +[Issue 18734](https://gitlab.com/wireshark/wireshark/-/issues/18734). + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2023-21](https://www.wireshark.org/security/wnpa-sec-2023-21) + Kafka dissector crash. + [Issue 19105](https://gitlab.com/wireshark/wireshark/-/issues/19105). +* [wnpa-sec-2023-22](https://www.wireshark.org/security/wnpa-sec-2023-22) + iSCSI dissector crash. + [Issue 19164](https://gitlab.com/wireshark/wireshark/-/issues/19164). + +The following bugs have been fixed: + +* Crash when (re)loading a capture file after renaming a dfilter macro. [Issue 13753](https://gitlab.com/wireshark/wireshark/-/issues/13753). +* Moving a column deselects selected packet and moves to beginning of packet list. [Issue 16251](https://gitlab.com/wireshark/wireshark/-/issues/16251). +* If you set the default interface in the preferences, it doesn’t work with TShark. [Issue 16593](https://gitlab.com/wireshark/wireshark/-/issues/16593). +* Severe performance issues in Follow → Save As raw workflow. [Issue 17313](https://gitlab.com/wireshark/wireshark/-/issues/17313). +* TShark doesn’t support the tab character as an aggregator character in "-T fields" [Issue 18002](https://gitlab.com/wireshark/wireshark/-/issues/18002). +* On Windows clicking on a link in the 'Software Update' window launches, now unsupported, MS Internet Explorer. [Issue 18488](https://gitlab.com/wireshark/wireshark/-/issues/18488). +* Wireshark 4.x.x on Win10-x64 crashes after saving a file with a name already in use. [Issue 18679](https://gitlab.com/wireshark/wireshark/-/issues/18679). +* NAS-5GS Operator-defined Access Category: Multiple Criteria values not displayed in dissected packet display. [Issue 18941](https://gitlab.com/wireshark/wireshark/-/issues/18941). +* Server Hello Packet Invisible - during 802.1x Authentication- from Wireshark App Version 4.0.3 (v4.0.3-0-gc552f74cdc23) & above. [Issue 19071](https://gitlab.com/wireshark/wireshark/-/issues/19071). +* TShark reassembled data is incomplete/truncated. [Issue 19107](https://gitlab.com/wireshark/wireshark/-/issues/19107). +* CQL protocol parsing issues with `Result` frames from open source Cassandra. [Issue 19119](https://gitlab.com/wireshark/wireshark/-/issues/19119). +* TLS 1.3 second Key Update doesn’t work. [Issue 19120](https://gitlab.com/wireshark/wireshark/-/issues/19120). +* HTTP2 dissector reports an assertion error on large data frames. [Issue 19121](https://gitlab.com/wireshark/wireshark/-/issues/19121). +* epan: Single letter hostnames aren’t displayed correctly. [Issue 19137](https://gitlab.com/wireshark/wireshark/-/issues/19137). +* BLF: CAN-FD-Message format is missing a field. [Issue 19146](https://gitlab.com/wireshark/wireshark/-/issues/19146). +* BLF: last parameter of LIN-Message is not mandatory (BUGFIX) [Issue 19147](https://gitlab.com/wireshark/wireshark/-/issues/19147). +* PPP IPv6CP: Incorrect payload length warning. [Issue 19149](https://gitlab.com/wireshark/wireshark/-/issues/19149). +* INSTALL file needs to be updated for Debian. [Issue 19167](https://gitlab.com/wireshark/wireshark/-/issues/19167). +* Some RTP streams make Wireshark crash when trying to play stream. [Issue 19170](https://gitlab.com/wireshark/wireshark/-/issues/19170). +* Wrong ordering in OpenFlow 1.0 Datapath unique ID. [Issue 19172](https://gitlab.com/wireshark/wireshark/-/issues/19172). +* Incorrect mask in RTCP slice picture ID. [Issue 19182](https://gitlab.com/wireshark/wireshark/-/issues/19182). +* Dissection error in AMQP 1.0. [Issue 19191](https://gitlab.com/wireshark/wireshark/-/issues/19191). + +### New and Updated Features + +There are no new or updated features in this release. + +### Removed Features and Support + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +9P, AMQP, BGP, CQL, DHCPFO, EAP, GlusterFS, GSM MAP, HTTP2, iSCSI, Kafka, Kerberos, NAN, NAS-5GS, OCP.1, OpenFlow 1.0, PDCP-NR, PEAP, PPPoE, RSL, RTCP, rtnetlink, and XMPP + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### New File Format Decoding Support + +There is no new or updated file format support in this release. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_408.md b/corpus/changelog/wireshark_releases/wireshark_408.md new file mode 100644 index 0000000000000000000000000000000000000000..c46d646b932822301a05d530a20eaa40ea6309bb --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_408.md @@ -0,0 +1,120 @@ +# Wireshark 4.0.8 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.0.8.html +Version: 4.0.8 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +## What’s New + +*We do not ship official 32-bit Windows packages for Wireshark 4.0 and later*. +If you need to use Wireshark on that platform, we recommend using the latest 3.6 release. +[Issue 17779](https://gitlab.com/wireshark/wireshark/-/issues/17779) + +If you’re running Wireshark on macOS and upgraded to macOS 13 from an earlier version, you might have to open and run the “Uninstall ChmodBPF” package, then open and run “Install ChmodBPF” in order to reset the ChmodBPF Launch Daemon. +[Issue 18734](https://gitlab.com/wireshark/wireshark/-/issues/18734). + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2023-23](https://www.wireshark.org/security/wnpa-sec-2023-23) + CBOR dissector crash. + [Issue 19144](https://gitlab.com/wireshark/wireshark/-/issues/19144). +* [wnpa-sec-2023-24](https://www.wireshark.org/security/wnpa-sec-2023-24) + BT SDP dissector infinite loop. + [Issue 19258](https://gitlab.com/wireshark/wireshark/-/issues/19258). +* [wnpa-sec-2023-25](https://www.wireshark.org/security/wnpa-sec-2023-25) + BT SDP dissector memory leak. + [Issue 19259](https://gitlab.com/wireshark/wireshark/-/issues/19259). +* [wnpa-sec-2023-26](https://www.wireshark.org/security/wnpa-sec-2023-26) + CP2179 dissector crash. + [Issue 19229](https://gitlab.com/wireshark/wireshark/-/issues/19229). + +The following bugs have been fixed: + +* TShark cannot capture to pipe on Windows correctly. [Issue 17900](https://gitlab.com/wireshark/wireshark/-/issues/17900). +* Wireshark wrongly blames group membership when pcap capabilities are removed. [Issue 18279](https://gitlab.com/wireshark/wireshark/-/issues/18279). +* Packet bytes window broken layout. [Issue 18326](https://gitlab.com/wireshark/wireshark/-/issues/18326). +* RTP Player only shows waveform until sequence rollover. [Issue 18829](https://gitlab.com/wireshark/wireshark/-/issues/18829). +* Valid Ethernet CFM DMM packets are shown as malformed. [Issue 19198](https://gitlab.com/wireshark/wireshark/-/issues/19198). +* Crash on DICOM Export Objects window close. [Issue 19207](https://gitlab.com/wireshark/wireshark/-/issues/19207). +* The QUIC dissector is reporting the quic\_transport\_parameters max\_ack\_delay with the title "GREASE" [Issue 19209](https://gitlab.com/wireshark/wireshark/-/issues/19209). +* Preferences: Folder name editing behaves weirdly, cursor jumps. [Issue 19213](https://gitlab.com/wireshark/wireshark/-/issues/19213). +* DHCPFO: Expert info list does not show all expert infos. [Issue 19216](https://gitlab.com/wireshark/wireshark/-/issues/19216). +* Websocket packets not decoded and displayed for Field type=Custom and Field name websocket.payload.text. [Issue 19220](https://gitlab.com/wireshark/wireshark/-/issues/19220). +* Cannot read pcapng file captured on OpenBSD and read on FreeBSD. [Issue 19230](https://gitlab.com/wireshark/wireshark/-/issues/19230). +* UI: While capturing the Wireshark icon changes from green to blue when new file is created. [Issue 19252](https://gitlab.com/wireshark/wireshark/-/issues/19252). +* Conversation: heap-use-after-free after wmem\_leave\_file\_scope. [Issue 19265](https://gitlab.com/wireshark/wireshark/-/issues/19265). +* IP Packets with DSCP 44 does not indicate "Voice-Admit" [Issue 19270](https://gitlab.com/wireshark/wireshark/-/issues/19270). +* NAS 5GS Malformed Packet Decoding SOR transparent container PLMN ID and access technology list. [Issue 19273](https://gitlab.com/wireshark/wireshark/-/issues/19273). +* UI: Auto scroll button in the toolbar is turned on when manually scrolling to the end of packet list. [Issue 19274](https://gitlab.com/wireshark/wireshark/-/issues/19274). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +BT SDP, CBOR, CFM, CP2179, CQL, DHCPFO, DICOM, F1AP, GSM DTAP, IEEE 802.11, IPv4, NAS-5GS, PFCP, PKT CCC, QUIC, RTP, TFTP, WebSocket, and XnAP + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### New File Format Decoding Support + +There is no new or updated file format support in this release. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_409.md b/corpus/changelog/wireshark_releases/wireshark_409.md new file mode 100644 index 0000000000000000000000000000000000000000..e261baa716931f78bd9086cb9a5b798cffcf8eb7 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_409.md @@ -0,0 +1,107 @@ +# Wireshark 4.0.9 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.0.9.html +Version: 4.0.9 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +## What’s New + +*We do not ship official 32-bit Windows packages for Wireshark 4.0 and later*. +If you need to use Wireshark on that platform, we recommend using the latest 3.6 release. +[Issue 17779](https://gitlab.com/wireshark/wireshark/-/issues/17779) + +If you’re running Wireshark on macOS and upgraded to macOS 13 from an earlier version, you might have to open and run the “Uninstall ChmodBPF” package, then open and run “Install ChmodBPF” in order to reset the ChmodBPF Launch Daemon. +[Issue 18734](https://gitlab.com/wireshark/wireshark/-/issues/18734). + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2023-27](https://www.wireshark.org/security/wnpa-sec-2023-27) + RTPS dissector memory leak. + [Issue 19322](https://gitlab.com/wireshark/wireshark/-/issues/19322). + [CVE-2023-5371](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-5371). + +The following bugs have been fixed: + +* Updating from within Wireshark if a file is open fails because it can’t close Wireshark. [Issue 17658](https://gitlab.com/wireshark/wireshark/-/issues/17658). +* ESL timestamp provided by ET2000 not displayed. [Issue 18308](https://gitlab.com/wireshark/wireshark/-/issues/18308). +* Kafka: dissect\_kafka\_sync\_group\_request missing version check for instance\_id. [Issue 19290](https://gitlab.com/wireshark/wireshark/-/issues/19290). +* Start Capture via context menu crashes on macOS with an older Qt version. [Issue 19299](https://gitlab.com/wireshark/wireshark/-/issues/19299). +* Delta time displayed is incorrect after unsetting time reference. [Issue 19324](https://gitlab.com/wireshark/wireshark/-/issues/19324). +* Fuzz job crash output: randpkt-2023-09-09-7060.pcap. [Issue 19332](https://gitlab.com/wireshark/wireshark/-/issues/19332). +* Missing one bit in SCCP::sequencing/segmenting. [Issue 19336](https://gitlab.com/wireshark/wireshark/-/issues/19336). +* Protobuf field malformed packet for last byte of 'repeated fixed32' [Issue 19342](https://gitlab.com/wireshark/wireshark/-/issues/19342). +* RTP/RFC 4571: Wrong desegmentation/reassembly in RTP over TCP packets. [Issue 19345](https://gitlab.com/wireshark/wireshark/-/issues/19345). +* Sparklines not working on macOS Sonoma with both native OS and Homebrew pcap. [Issue 19349](https://gitlab.com/wireshark/wireshark/-/issues/19349). +* Incorrect bit values and namings in BSS Configuration Report TLV. [Issue 19352](https://gitlab.com/wireshark/wireshark/-/issues/19352). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +ESL, GNW, IDN, IEEE 1722, IEEE 1905.1a, ITS, Kafka, ProtoBuf, RTP, RTPS, SCCP, TACACS, and Tibia + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### New File Format Decoding Support + +There is no new or updated file format support in this release. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_420.md b/corpus/changelog/wireshark_releases/wireshark_420.md new file mode 100644 index 0000000000000000000000000000000000000000..6e03aee7de4a36af40f6fed07f18eec568575fc9 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_420.md @@ -0,0 +1,299 @@ +# Wireshark 4.2.0 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.2.0.html +Version: 4.2.0 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +## What’s New + +This is the first major Wireshark release under the Wireshark Foundation, a nonprofit which hosts Wireshark and promotes protocol analysis education. +The foundation depends on your contributions in order to do its work. +If you or your employer would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +Wireshark supports dark mode on Windows. + +A Windows installer for Arm64 has been added. + +Packet list sorting has been improved. + +Wireshark and TShark are now better about generating valid UTF-8 output. + +A new display filter feature for filtering raw bytes has been added. + +Display filter autocomplete is smarter about not suggesting invalid syntax. + +**Tools** **›** **MAC Address Blocks** can lookup a MAC address in the IEEE OUI registry. + +The *enterprises*, *manuf*, and *services* configuration files have been compiled in for improved start-up times. +These files are no longer available in the master branch in our source code repository. +You can download the [manuf file](https://www.wireshark.org/download/automated/data/manuf) from our automated build directory. + +The installation target no longer installs development headers by default. + +The Wireshark installation is relocatable on Linux (and other ELF platforms +with support for relative RPATHs). + +Wireshark can be compiled on Windows using [MSYS2](https://www.msys2.org/). +Check the Developer’s guide for instructions. + +Wireshark can be cross-compiled for Windows using Linux. +Check the Developer’s guide for instructions. + +**Tools** **›** **Browser (SSL Keylog)** can launch your web browser with the +SSLKEYLOGFILE environment variable set to the appropriate value. + +Windows installer file names now have the format Wireshark--.exe. + +Wireshark now supports the Korean language. + +Many other improvements have been made. +See the “New and Updated Features” section below for more details. + +### Bug Fixes + +The following bugs have been fixed: + +* [Issue 18413](https://gitlab.com/wireshark/wireshark/-/issues/18413) - RTP player do not play audio frequently on Windows builds with Qt6. +* [Issue 18510](https://gitlab.com/wireshark/wireshark/-/issues/18510) - Playback marker does not move after resume with Qt6. + +### New and Updated Features + +The following features are new (or have been significantly updated) since version 4.2.0rc3: + +* Nothing of note. + +The following features are new (or have been significantly updated) since version 4.2.0rc2: + +* The Windows installers now ship with Npcap 1.78. + They previously shipped with Npcap 1.77. + +The following features are new (or have been significantly updated) since version 4.2.0rc1: + +* The Windows installers now ship with Npcap 1.77. + They previously shipped with Npcap 1.71. + +The following features are new (or have been significantly updated) since version 4.1.0: + +* Improved dark mode support. +* The Windows installers now ship with Qt 6.5.3. + They previously shipped with Qt 6.2.3. + +The following features are new (or have been significantly updated) since version 4.0.0: + +* The API has been updated to ensure that the dissection engine produces valid UTF-8 strings. +* Wireshark now builds with Qt6 by default. To use Qt5 instead pass USE\_qt6=OFF to CMake. +* The "ciscodump" extcap supports Cisco IOS XE 17.x. +* The default interval between GUI updates when capturing has been decreased + from 500ms to 100ms, and is now configurable. +* The **-n** option also now disables IP address geolocation information lookup + in configured MaxMind databases (and geolocation lookup can be enabled with + **-Ng**.) This is most relevant for TShark, where geolocation lookups are + synchronous. +* The display filter drop-down list is now sorted by "most recently used" instead + of "most recently created". +* Display filter syntax-related changes: + + + It is now possible to filter on raw packet data for any field by using the syntax `@some.field == `. + This can be useful to filter on malformed UTF-8 strings, among other use cases where it is necessary to + look at the field’s raw data. + + Negation (unary minus) now works with any display filter arithmetic expression. + + Using the slice operator with strings produces a string. Previously it + would produce a byte array. This is useful to index/slice UTF-8 multibyte strings. + String byte slices can still be obtained using the "@" (raw operator) prefix. + + Arithmetic expressions are allowed as set elements. + + Absolute date and time values can be written as Unix time. + + The limitation where a minus sign needed to be preceded by a space character + has been removed. + + Added XOR logical operator. + + Fixed the implementation of `all …​ in` membership operator + ([#19188](https://gitlab.com/wireshark/wireshark/-/issues/19188)). + + When parsing absolute time values the display filter engine has learned + to understand timezones as specified in + [strptime(3)](https://man.netbsd.org/strptime.3), including some common + North American designations. Arbitrary timezone names are not supported + however. Previously only ISO8601 offsets and the "UTC" designation was understood. + + Writing value strings without double quotes is deprecated and will generate + a warning. Value strings are integer or boolean values that can be represented + using a user-friendly textual format, such as "Set"/"Unset" instead of numerical + values like 1 and 0. It is now a requirement that value strings need to be + written enclosed in double-quotes. + + The deprecated ~≃ operator symbol has been removed. It was replaced by !== in version 4.0. +* Running the test suite requires the [pytest](https://pypi.org/project/pytest/) + Python module. The emulation layer that allowed running tests without pytest + installed has been removed. +* When saving files or exporting packets after changing their time with the + "Time Shift" dialog, the shifted time is written to the new file. +* TLS secrets used in decrypting packets can be embedded (or discarded) from + the capture file via the GUI, similar to the options --inject-secrets and + --discard-all-secrets in editcap. +* The text of any configured column (displayed or hidden) can be filtered + anywhere that filters are used - in display filters, filters in taps, coloring + rules, Wireshark read filters, and the -Y, -R, and -e options to TShark, + the "Apply as Filter" GUI option, etc. + + + The filter field names are prefixed by "\_ws.col", followed by a lowercase + version of the COL\_ name found in epan/column-utils.h, e.g. "\_ws.col.info" + or "\_ws.col.protocol" + + Using the column names as a filter is slower than other filter types + because the columns must be constructed, so when the same filtering + can be achieved via other fields, prefer that. +* The external name resolution text files "manuf", "enterprises" and "services" + have been removed and replaced with static binary data. You can dump the + respective internal data using `tshark -G manuf|enterprises|services`. +* The "manuf" file is now also read from the personal configuration folder, + and is profile-based. +* The Lua console dialogs under the **Tools** menu were refactored and redesigned. + It now consists of a single dialog window for input and output. +* Wireshark now shows byte units in the statistics in the user-selected language + (uses the system default language by default). +* Packet list sorting has been improved: + + + When sorting packet list with a filter applied, only the visible packets are + sorted, which greatly increases sorting speed. + + The cache size for column text is limited to a default of 10000 rows, + which limits the maximum memory usage. The maximum value can be changed in + Preferences→Appearance→Layout + + Due to the above, columns that require packet dissection can only be sorted + if the number of visible rows is less than the cache size. If there are + more rows visible, a warning will appear. Columns that do not require packet + dissection (those that calculated directly from the capture file frame + headers, such as packet number, time, and frame length) can be sorted with + any number of visible rows. + + Sorting can be interrupted. +* When changing the dissector via the "Decode As" table for values that + have default dissectors registered, selecting "(none)" will select + no dissection (while still allowing heuristic dissectors to attempt to + dissect.) The previous behavior was to reset the dissector to the default. + To facilitate resetting the dissector, the default dissector is now sorted + at the top of the list of possible dissector options. +* The personal extcap plugin folder location on Unix has been changed to + follow existing conventions for architecture-dependent files. + The extcap personal folder is now `$HOME/.local/lib/wireshark/extcap`. + Previously it was `$XDG_CONFIG_HOME/wireshark/extcap`. +* The "init.lua" file is now loaded from any of the Lua plugin directories. + Previously it was loaded from the personal configuration directory. (For + backward-compatibility this is still allowed; note that deprecated features + may be removed in a future release). +* Installation of development headers must be done explicitly using the CMake + command `cmake --install --component Development`. +* The Windows build has a new SpeexDSP external dependency (). + The speex code that was previously bundled has been removed. +* New `--print-timers` option added to TShark. + +### Removed Features and Support + +* With the addition of the universal and consistent filtering support for + column text, the previous support in the -e option to TShark for displaying + column text via the column title has been removed in general. Those field names + cannot be used elsewhere (as they may not be legal filter names) and create + confusion if more than one column has the same title or if a column is renamed. + Prefer the column format instead, e.g. "\_ws.col.info" for "\_ws.col.Info". + However, for backwards compatibility with existing tools and scripts, the + titles of the default columns can continue to be used with `tshark -e` + (but not elsewhere.) +* The bundled script "dtd\_gen.lua" that was disabled by default has been removed + from the installation. [It can be found in the Wireshark Wiki under "Contrib"](https://wiki.wireshark.org/Contrib). +* The Wi-Fi NAN dissector filter name has been changed from 'nan' to 'wifi\_nan'. + +### New File Format Decoding Support + +RTPDump + +### New Protocol Support + +Aruba UBT, ASAM Capture Module Protocol (CMP), ATSC Link-Layer Protocol (ALP), DECT DLC protocol layer (DECT-DLC), DECT NWK protocol layer (DECT-NWK), DECT proprietary Mitel OMM/RFP Protocol (also named AaMiDe), Digital Object Identifier Resolution Protocol (DO-IRP), Discard Protocol, FiRa UWB Controller Interface (UCI), FiveCo’s Register Access Protocol (5CoRAP), Fortinet FortiGate Cluster Protocol (FGCP), GPS L1 C/A LNAV navigation messages, GSM Radio Link Protocol (RLP), H.224, High Speed Fahrzeugzugang (HSFZ), Hypertext Transfer Protocol version 3 (HTTP/3), ID3v2, IEEE 802.1CB (R-TAG), Iperf3, JSON 3GPP, Low Level Signalling (ATSC3 LLS), Management Component Transport Protocol (MCTP), Management Component Transport Protocol - Control Protocol (MCTP CP), Matter home automation protocol, Microsoft Delivery Optimization, Multi-Drop Bus (MDB), Non-volatile Memory Express - Management Interface (NVMe-MI) over MCTP, RDP audio output virtual channel Protocol (rdpsnd), RDP clipboard redirection channel Protocol (cliprdr), RDP Program virtual channel Protocol (RAIL), SAP Enqueue Server (SAPEnqueue), SAP GUI (SAPDiag), SAP HANA SQL Command Network Protocol (SAPHDB), SAP Internet Graphic Server (SAP IGS), SAP Message Server (SAPMS), SAP Network Interface (SAPNI), SAP Router (SAPROUTER), SAP Secure Network Connection (SNC), SBAS L1 Navigation Messages (SBAS L1), SINEC AP1 Protocol (SINEC AP), SMPTE ST2110-20 (Uncompressed Active Video), Train Real-Time Data Protocol (TRDP), UBX protocol of u-blox GNSS receivers (UBX), UDP Tracker Protocol for BitTorrent (BT-Tracker), UWB UCI Protocol, Video Protocol 9 (VP9), VMware HeartBeat, Windows Delivery Optimization (MS-DO), Z21 LAN Protocol (Z21), Zabbix, ZigBee Direct (ZBD), and Zigbee TLV + +### Updated Protocol Support + +* JSON: The dissector now has a preference to enable/disable "unescaping" + of string values. By default it is off. Previously it was always on. +* JSON: The dissector now supports "Display JSON in raw form". +* IPv6: The dissector has a new preference to show some semantic details + about addresses (default off). +* IPv6: The dissector now supports dissecting the + [Application-aware IPv6 Networking (APN6) option](https://www.ipv6plus.net/Phase3/apn6/) + in the Hop-by-Hop Options Header (HBH) and Destination Options Header (DOH), + including all three types of APN ID, + which are 32-bit, 64-bit and 128-bit in length. +* XML: The dissector now supports display character according to the "encoding" + attribute of the XML declaration, and has a new preference to set default + character encoding for some XML document without "encoding" attribute. +* SIP: The dissector now has a new preference to set default charset for + displaying the body of SIP messages in raw text view. +* HTTP: The dissector now supports dissecting chunked data in streaming reassembly + mode. Subdissectors of HTTP can register itself in "streaming\_content\_type" + subdissector table for enabling streaming reassembly mode while transferring in + chunked encoding. This feature ensures the server stream messages of GRPC-Web + over HTTP/1.1 can be dissected even if the last chunk is absent. +* The media type dissector table now properly treats media types and subtypes + as case-insensitive automatically, per RFC 6838. Media types no longer need + to be lower cased before registering or looking up in the table. +* CFM: The dissector has been overhauled and updated to the level of IEEE std + 802.1Q-2022 and ITU-T Rec. G.8013/Y.1371 (08/2015). This includes dissection + of additional PDU types and TLVs as well as deeper dissection of existing PDUs + and TLVs. + +Too many other protocol updates have been made to list them all here. + +### New and Updated Codec support + +Adaptive Multi-Rate (AMR), if compiled with [opencore-amr](https://sourceforge.net/projects/opencore-amr/). + +### Major API Changes + +* Lua function "package.prepend\_path" has been removed. If you need it please + consider adding your own package.path customization code or installing your + dependencies in Wireshark’s default paths. +* The reassemble\_streaming\_data\_and\_call\_subdissector() API has been added to provide a simpler way to + reassemble the streaming data of a high level protocol that is not on top of TCP. +* Some of the API now uses C99 types instead of GLib types. [Issue 19116](https://gitlab.com/wireshark/wireshark/-/issues/19116) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_421.md b/corpus/changelog/wireshark_releases/wireshark_421.md new file mode 100644 index 0000000000000000000000000000000000000000..6ab284cfb8bbed0946899e1513f43b836c44cebd --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_421.md @@ -0,0 +1,135 @@ +# Wireshark 4.2.1 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.2.1.html +Version: 4.2.1 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your employer would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2024-01](https://www.wireshark.org/security/wnpa-sec-2024-01) + GVCP dissector crash. + [Issue 19496](https://gitlab.com/wireshark/wireshark/-/issues/19496). + [CVE-2024-0208](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-0208). +* [wnpa-sec-2024-02](https://www.wireshark.org/security/wnpa-sec-2024-02) + IEEE 1609.2 dissector crash. + [Issue 19501](https://gitlab.com/wireshark/wireshark/-/issues/19501). + [CVE-2024-0209](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-0209). +* [wnpa-sec-2024-03](https://www.wireshark.org/security/wnpa-sec-2024-03) + HTTP3 dissector crash. + [Issue 19502](https://gitlab.com/wireshark/wireshark/-/issues/19502). + [CVE-2024-0207](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-0207). +* [wnpa-sec-2024-04](https://www.wireshark.org/security/wnpa-sec-2024-04) + Zigbee TLV dissector crash. + [Issue 19504](https://gitlab.com/wireshark/wireshark/-/issues/19504). + [CVE-2024-0210](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-0210). +* [wnpa-sec-2024-05](https://www.wireshark.org/security/wnpa-sec-2024-05) + DOCSIS dissector crash. + [Issue 19557](https://gitlab.com/wireshark/wireshark/-/issues/19557). + [CVE-2024-0211](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-0211). + +The following bugs have been fixed: + +* Capture filters not saved to recently used list. [Issue 12918](https://gitlab.com/wireshark/wireshark/-/issues/12918). +* CFM dissector does not handle Sender ID TLV correctly when Chassis ID Length is zero. [Issue 13720](https://gitlab.com/wireshark/wireshark/-/issues/13720). +* OSS-Fuzz 64290: wireshark:fuzzshark\_ip: Global-buffer-overflow in dissect\_zcl\_read\_attr\_struct. [Issue 19490](https://gitlab.com/wireshark/wireshark/-/issues/19490). +* Overriding capture options set by preference by command line arguments (like -S) doesn’t work. [Issue 14549](https://gitlab.com/wireshark/wireshark/-/issues/14549). +* Segfault when enabling monitor mode on wireless card that falsely claims to support it. [Issue 16693](https://gitlab.com/wireshark/wireshark/-/issues/16693). +* Documented format of temporary file name is out of date in the Wireshark User’s Guide. [Issue 18464](https://gitlab.com/wireshark/wireshark/-/issues/18464). +* Selection highlight lost when interface list is sorted. [Issue 19133](https://gitlab.com/wireshark/wireshark/-/issues/19133). +* HTTP3 malformed packets. [Issue 19475](https://gitlab.com/wireshark/wireshark/-/issues/19475). +* Capture filter compilation fails with obscure error message. [Issue 19480](https://gitlab.com/wireshark/wireshark/-/issues/19480). +* XML: Parsing encoding attribute failed when standalone attribute exists. [Issue 19485](https://gitlab.com/wireshark/wireshark/-/issues/19485). +* Display filter expressions where the protocol name starts with digit and contains a hyphen are rejected. [Issue 19489](https://gitlab.com/wireshark/wireshark/-/issues/19489). +* diameter.3GPP-**\*** display filters not working after upgrade to version 4.2.0. [Issue 19493](https://gitlab.com/wireshark/wireshark/-/issues/19493). +* GigE-vision: Control Protocol shows "unknown" as value for ASCII character set. [Issue 19494](https://gitlab.com/wireshark/wireshark/-/issues/19494). +* The HTTP/3 Request Header URI is not correct. [Issue 19497](https://gitlab.com/wireshark/wireshark/-/issues/19497). +* QUIC/TLS not extracting "h3" from ALPN in a capture. [Issue 19503](https://gitlab.com/wireshark/wireshark/-/issues/19503). +* Documentation on system requirements should be updated. [Issue 19512](https://gitlab.com/wireshark/wireshark/-/issues/19512). +* 4.2.0: init.lua in subdirectories not loaded anymore. [Issue 19516](https://gitlab.com/wireshark/wireshark/-/issues/19516). +* Malformed SIP/SDP messages: components are not decoded properly. [Issue 19518](https://gitlab.com/wireshark/wireshark/-/issues/19518). +* heuristic\_protos do not reset on profile swap. [Issue 19520](https://gitlab.com/wireshark/wireshark/-/issues/19520). +* Wireshark 4.2 crashes on Apply As Column. [Issue 19521](https://gitlab.com/wireshark/wireshark/-/issues/19521). +* NFLOG timestamp is incorrect. [Issue 19525](https://gitlab.com/wireshark/wireshark/-/issues/19525). +* Qt6 Crash (Double Free) When Attempting to Save TCP Stream Graph. [Issue 19529](https://gitlab.com/wireshark/wireshark/-/issues/19529). +* Fixed parsing display filter expressions containing literal OID values, e.g. `snmp.name == 1.3.6.1.2.1.1.3.0`. + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +pcapng: the if\_tsoffset option is now supported. + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.2.1. +You can find release notes for prior versions at the following locations: + +* [Wireshark 4.2.0](https://www.wireshark.org/docs/relnotes/wireshark-4.2.0.html) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_4210.md b/corpus/changelog/wireshark_releases/wireshark_4210.md new file mode 100644 index 0000000000000000000000000000000000000000..803a1bad0b602fb5f7817c618a9392ee7f2e7dea --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_4210.md @@ -0,0 +1,104 @@ +# Wireshark 4.2.10 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.2.10.html +Version: 4.2.10 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +The following bugs have been fixed: + +* Macro eNodeB ID and Extended Macro eNodeB ID not decoded by User Location Information. [Issue 20276](https://gitlab.com/wireshark/wireshark/-/issues/20276). +* CMake discovers Strawberry Perl’s zlib DLL when it shouldn’t. [Issue 20304](https://gitlab.com/wireshark/wireshark/-/issues/20304). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +BBLog, GTPv2, ICMPv6, IEEE 802.11, LTE RRC, MBIM, and NR RRC + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.2.10. +You can find release notes for prior versions at the following locations: + +* [Wireshark 4.2.9](https://www.wireshark.org/docs/relnotes/wireshark-4.2.9.html) +* [Wireshark 4.2.8](https://www.wireshark.org/docs/relnotes/wireshark-4.2.8.html) +* [Wireshark 4.2.7](https://www.wireshark.org/docs/relnotes/wireshark-4.2.7.html) +* [Wireshark 4.2.6](https://www.wireshark.org/docs/relnotes/wireshark-4.2.6.html) +* [Wireshark 4.2.5](https://www.wireshark.org/docs/relnotes/wireshark-4.2.5.html) +* [Wireshark 4.2.4](https://www.wireshark.org/docs/relnotes/wireshark-4.2.4.html) +* [Wireshark 4.2.3](https://www.wireshark.org/docs/relnotes/wireshark-4.2.3.html) +* [Wireshark 4.2.2](https://www.wireshark.org/docs/relnotes/wireshark-4.2.2.html) +* [Wireshark 4.2.1](https://www.wireshark.org/docs/relnotes/wireshark-4.2.1.html) +* [Wireshark 4.2.0](https://www.wireshark.org/docs/relnotes/wireshark-4.2.0.html) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://www.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_4211.md b/corpus/changelog/wireshark_releases/wireshark_4211.md new file mode 100644 index 0000000000000000000000000000000000000000..3c773e358bdf4485eb0b61223188262ca13975d1 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_4211.md @@ -0,0 +1,116 @@ +# Wireshark 4.2.11 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.2.11.html +Version: 4.2.11 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2025-01](https://www.wireshark.org/security/wnpa-sec-2025-01) + Bundle Protocol and CBOR dissector crash. + [Issue 20373](https://gitlab.com/wireshark/wireshark/-/issues/20373). + +The following bugs have been fixed: + +* Fuzz job UTF-8 encoding issue: fuzz-2024-08-13-11845.pcap. [Issue 19987](https://gitlab.com/wireshark/wireshark/-/issues/19987). +* Test failure in 4.4.2/4.4.3: test\_sharkd\_req\_follow\_http2. [Issue 20330](https://gitlab.com/wireshark/wireshark/-/issues/20330). +* Regression in extcap interface toolbar. [Issue 20354](https://gitlab.com/wireshark/wireshark/-/issues/20354). +* TECMP: Calculation of lifecycle start in Status message is wrong. [Issue 20387](https://gitlab.com/wireshark/wireshark/-/issues/20387). +* MQTT v5.0 properties total length presentation is incorrect. [Issue 20389](https://gitlab.com/wireshark/wireshark/-/issues/20389). +* TShark doesn’t resolve addresses in custom "hosts" files. [Issue 20391](https://gitlab.com/wireshark/wireshark/-/issues/20391). +* Incorrect JA4 fingerprint with empty ciphers. [Issue 20394](https://gitlab.com/wireshark/wireshark/-/issues/20394). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +ISOBUS, MQTT, R3, TCP, TECMP, and WebSocket + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.2.11. +You can find release notes for prior versions at the following locations: + +* [Wireshark 4.2.10](https://www.wireshark.org/docs/relnotes/wireshark-4.2.10.html) +* [Wireshark 4.2.9](https://www.wireshark.org/docs/relnotes/wireshark-4.2.9.html) +* [Wireshark 4.2.8](https://www.wireshark.org/docs/relnotes/wireshark-4.2.8.html) +* [Wireshark 4.2.7](https://www.wireshark.org/docs/relnotes/wireshark-4.2.7.html) +* [Wireshark 4.2.6](https://www.wireshark.org/docs/relnotes/wireshark-4.2.6.html) +* [Wireshark 4.2.5](https://www.wireshark.org/docs/relnotes/wireshark-4.2.5.html) +* [Wireshark 4.2.4](https://www.wireshark.org/docs/relnotes/wireshark-4.2.4.html) +* [Wireshark 4.2.3](https://www.wireshark.org/docs/relnotes/wireshark-4.2.3.html) +* [Wireshark 4.2.2](https://www.wireshark.org/docs/relnotes/wireshark-4.2.2.html) +* [Wireshark 4.2.1](https://www.wireshark.org/docs/relnotes/wireshark-4.2.1.html) +* [Wireshark 4.2.0](https://www.wireshark.org/docs/relnotes/wireshark-4.2.0.html) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://www.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_4212.md b/corpus/changelog/wireshark_releases/wireshark_4212.md new file mode 100644 index 0000000000000000000000000000000000000000..e1f9921db174a7f71262a2d4fd53999f421ccf44 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_4212.md @@ -0,0 +1,116 @@ +# Wireshark 4.2.12 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.2.12.html +Version: 4.2.12 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +* [wnpa-sec-2025-02](https://www.wireshark.org/security/wnpa-sec-2025-02) {notable} + Dissection engine crash. + [Issue 20509](https://gitlab.com/wireshark/wireshark/-/issues/20509). + [CVE-2025-5601](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-5601). + +The following bugs have been fixed: + +* GRPC: protobuf\_json only displays the truncated string value. [Issue 20392](https://gitlab.com/wireshark/wireshark/-/issues/20392). +* Trailing octet after IPv4 packet end is not detected or displayed in raw bytes. [Issue 20423](https://gitlab.com/wireshark/wireshark/-/issues/20423). +* Wireshark does not correctly decode LIN "go to sleep" in TECMP and CMP. [Issue 20463](https://gitlab.com/wireshark/wireshark/-/issues/20463). +* Fuzz job crash: fuzz-2025-04-25-7554.pcap. [Issue 20509](https://gitlab.com/wireshark/wireshark/-/issues/20509). +* WebSocket per-message compression extentions: fail to decompress server messages (from the 2nd) due to parameter handling. [Issue 20531](https://gitlab.com/wireshark/wireshark/-/issues/20531). +* null. [Issue 20539](https://gitlab.com/wireshark/wireshark/-/issues/20539). +* The LL\_PERIODIC\_SYNC\_WR\_IND packet is not properly dissected (packet-btle.c) [Issue 20554](https://gitlab.com/wireshark/wireshark/-/issues/20554). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +ASAM CMP, F1AP, genl, LIN, Logcat Text, net\_dm, netfilter, nvme, ProtoBuf, Quake, TECMP, and WebSocket + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.2.12. +You can find release notes for prior versions at the following locations: + +* [Wireshark 4.2.11](https://www.wireshark.org/docs/relnotes/wireshark-4.2.11.html) +* [Wireshark 4.2.10](https://www.wireshark.org/docs/relnotes/wireshark-4.2.10.html) +* [Wireshark 4.2.9](https://www.wireshark.org/docs/relnotes/wireshark-4.2.9.html) +* [Wireshark 4.2.8](https://www.wireshark.org/docs/relnotes/wireshark-4.2.8.html) +* [Wireshark 4.2.7](https://www.wireshark.org/docs/relnotes/wireshark-4.2.7.html) +* [Wireshark 4.2.6](https://www.wireshark.org/docs/relnotes/wireshark-4.2.6.html) +* [Wireshark 4.2.5](https://www.wireshark.org/docs/relnotes/wireshark-4.2.5.html) +* [Wireshark 4.2.4](https://www.wireshark.org/docs/relnotes/wireshark-4.2.4.html) +* [Wireshark 4.2.3](https://www.wireshark.org/docs/relnotes/wireshark-4.2.3.html) +* [Wireshark 4.2.2](https://www.wireshark.org/docs/relnotes/wireshark-4.2.2.html) +* [Wireshark 4.2.1](https://www.wireshark.org/docs/relnotes/wireshark-4.2.1.html) +* [Wireshark 4.2.0](https://www.wireshark.org/docs/relnotes/wireshark-4.2.0.html) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://www.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_4213.md b/corpus/changelog/wireshark_releases/wireshark_4213.md new file mode 100644 index 0000000000000000000000000000000000000000..22199d53054d5628283c43d357bd32275e71e944 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_4213.md @@ -0,0 +1,111 @@ +# Wireshark 4.2.13 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.2.13.html +Version: 4.2.13 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +The following vulnerabilities have been fixed: + +The following bugs have been fixed: + +* Bug in UDS dissector with Service ReadDataByPeriodicIdentifier Response. [Issue 20589](https://gitlab.com/wireshark/wireshark/-/issues/20589). +* application/x-www-form-urlencoded key parsed incorrectly following a name-value byte sequence with no '=' [Issue 20615](https://gitlab.com/wireshark/wireshark/-/issues/20615). +* DNP3 time stamp was unable to work after epoch time (year 2038) [Issue 20618](https://gitlab.com/wireshark/wireshark/-/issues/20618). +* Bug in LZ77 decoder; reads a 16-bit length when it should read a 32-bit length. [Issue 20671](https://gitlab.com/wireshark/wireshark/-/issues/20671). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +ASTERIX, DLT, DOF, ETSI CAT, Gryphon, LIN, MBIM, MySQL, SABP, SLL, TETRA, UDS, and URL Encoded Form Data + +### New and Updated Capture File Support + +pcapng + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.2.13. +You can find release notes for prior versions at the following locations: + +* [Wireshark 4.2.12](https://www.wireshark.org/docs/relnotes/wireshark-4.2.12.html) +* [Wireshark 4.2.11](https://www.wireshark.org/docs/relnotes/wireshark-4.2.11.html) +* [Wireshark 4.2.10](https://www.wireshark.org/docs/relnotes/wireshark-4.2.10.html) +* [Wireshark 4.2.9](https://www.wireshark.org/docs/relnotes/wireshark-4.2.9.html) +* [Wireshark 4.2.8](https://www.wireshark.org/docs/relnotes/wireshark-4.2.8.html) +* [Wireshark 4.2.7](https://www.wireshark.org/docs/relnotes/wireshark-4.2.7.html) +* [Wireshark 4.2.6](https://www.wireshark.org/docs/relnotes/wireshark-4.2.6.html) +* [Wireshark 4.2.5](https://www.wireshark.org/docs/relnotes/wireshark-4.2.5.html) +* [Wireshark 4.2.4](https://www.wireshark.org/docs/relnotes/wireshark-4.2.4.html) +* [Wireshark 4.2.3](https://www.wireshark.org/docs/relnotes/wireshark-4.2.3.html) +* [Wireshark 4.2.2](https://www.wireshark.org/docs/relnotes/wireshark-4.2.2.html) +* [Wireshark 4.2.1](https://www.wireshark.org/docs/relnotes/wireshark-4.2.1.html) +* [Wireshark 4.2.0](https://www.wireshark.org/docs/relnotes/wireshark-4.2.0.html) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://www.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_4214.md b/corpus/changelog/wireshark_releases/wireshark_4214.md new file mode 100644 index 0000000000000000000000000000000000000000..a2280ff79b166f1fd3d44c131a2b381087f3dedc --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_4214.md @@ -0,0 +1,122 @@ +# Wireshark 4.2.14 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.2.14.html +Version: 4.2.14 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +This is expected to be the final release of the 4.2 branch. + +This is the last release branch with official support for macOS 10.14 and 10.15. + +### Bug Fixes + +* [wnpa-sec-2025-04](https://www.wireshark.org/security/wnpa-sec-2025-04) {notable} + MONGO dissector infinite loop. + [Issue 20724](https://gitlab.com/wireshark/wireshark/-/issues/20724). + [CVE-2025-xxx](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-xxx). + +The following bugs have been fixed: + +* Using wslog parameters in command line applications leads to freeing invalid memory. [Issue 20500](https://gitlab.com/wireshark/wireshark/-/issues/20500). +* On macOS a lower resolution Wireshark icon is displayed in the App Switcher and Launchpad. [Issue 20544](https://gitlab.com/wireshark/wireshark/-/issues/20544). +* Fuzz job crash: fuzz-2025-08-06-10932469456.pcap. [Issue 20666](https://gitlab.com/wireshark/wireshark/-/issues/20666). +* Encoding on NAS5GS- NASDL Transport Message-Multiple Container contains inconsistencies. [Issue 20679](https://gitlab.com/wireshark/wireshark/-/issues/20679). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +H.248E, HTTP2, IAX2, MONGO, NAS-5GS, and XML + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.2.14. +You can find release notes for prior versions at the following locations: + +* [Wireshark 4.2.13](https://www.wireshark.org/docs/relnotes/wireshark-4.2.13.html) +* [Wireshark 4.2.12](https://www.wireshark.org/docs/relnotes/wireshark-4.2.12.html) +* [Wireshark 4.2.11](https://www.wireshark.org/docs/relnotes/wireshark-4.2.11.html) +* [Wireshark 4.2.10](https://www.wireshark.org/docs/relnotes/wireshark-4.2.10.html) +* [Wireshark 4.2.9](https://www.wireshark.org/docs/relnotes/wireshark-4.2.9.html) +* [Wireshark 4.2.8](https://www.wireshark.org/docs/relnotes/wireshark-4.2.8.html) +* [Wireshark 4.2.7](https://www.wireshark.org/docs/relnotes/wireshark-4.2.7.html) +* [Wireshark 4.2.6](https://www.wireshark.org/docs/relnotes/wireshark-4.2.6.html) +* [Wireshark 4.2.5](https://www.wireshark.org/docs/relnotes/wireshark-4.2.5.html) +* [Wireshark 4.2.4](https://www.wireshark.org/docs/relnotes/wireshark-4.2.4.html) +* [Wireshark 4.2.3](https://www.wireshark.org/docs/relnotes/wireshark-4.2.3.html) +* [Wireshark 4.2.2](https://www.wireshark.org/docs/relnotes/wireshark-4.2.2.html) +* [Wireshark 4.2.1](https://www.wireshark.org/docs/relnotes/wireshark-4.2.1.html) +* [Wireshark 4.2.0](https://www.wireshark.org/docs/relnotes/wireshark-4.2.0.html) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://www.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +Official Wireshark training and certification are available from +[the Wireshark Foundation](https://www.wireshark.org/certifications). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_422.md b/corpus/changelog/wireshark_releases/wireshark_422.md new file mode 100644 index 0000000000000000000000000000000000000000..4e17461dc2c74b08ff21337c3e963f5f55eb5c31 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_422.md @@ -0,0 +1,98 @@ +# Wireshark 4.2.2 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.2.2.html +Version: 4.2.2 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your employer would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +This release fixes a software update issue on Windows which causes Wireshark to hang if you are upgrading from version 4.2.0 or 4.2.1. +If you are experiencing this issue you will need to [download and install](https://www.wireshark.org/download.html) Wireshark 4.2.2 or later. + +The following bugs have been fixed: + +* sharkd is not installed by the Windows installer. [Issue 19556](https://gitlab.com/wireshark/wireshark/-/issues/19556). +* Fuzz job crash output: fuzz-2024-01-01-7740.pcap. [Issue 19558](https://gitlab.com/wireshark/wireshark/-/issues/19558). +* Can’t open a snoop file from the Open dialog box unless I select "All files" as the file type. [Issue 19565](https://gitlab.com/wireshark/wireshark/-/issues/19565). +* Add s4607 dissector to "decode as" [Issue 19566](https://gitlab.com/wireshark/wireshark/-/issues/19566). +* Updater for 4.2.1 hangs. [Issue 19568](https://gitlab.com/wireshark/wireshark/-/issues/19568). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +RSVP, RTPS, and STANAG 4607 + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.2.2. +You can find release notes for prior versions at the following locations: + +* [Wireshark 4.2.1](https://www.wireshark.org/docs/relnotes/wireshark-4.2.1.html) +* [Wireshark 4.2.0](https://www.wireshark.org/docs/relnotes/wireshark-4.2.0.html) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_423.md b/corpus/changelog/wireshark_releases/wireshark_423.md new file mode 100644 index 0000000000000000000000000000000000000000..615d88eabd5192bbda47236a0fd53ee429826611 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_423.md @@ -0,0 +1,113 @@ +# Wireshark 4.2.3 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.2.3.html +Version: 4.2.3 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +If you are upgrading Wireshark 4.2.0 or 4.2.1 on Windows you will need to [download and install](https://www.wireshark.org/download.html) Wireshark 4.2.3 or later by hand. + +The following bugs have been fixed: + +* Capture start fails when file set enabled and file extension not supplied if directory contains a period. [Issue 14614](https://gitlab.com/wireshark/wireshark/-/issues/14614). +* Cannot drag and move custom filter buttons in toolbar. [Issue 19447](https://gitlab.com/wireshark/wireshark/-/issues/19447). +* Not equal won’t work when used with wlan.addr. [Issue 19449](https://gitlab.com/wireshark/wireshark/-/issues/19449). +* sshdump fails to connect with private key (ssh-rsa) [Issue 19510](https://gitlab.com/wireshark/wireshark/-/issues/19510). +* ChmodBPF installation fails on macOS Sonoma 14.1.2. [Issue 19527](https://gitlab.com/wireshark/wireshark/-/issues/19527). +* Windows installers should check for Windows 8.1. [Issue 19569](https://gitlab.com/wireshark/wireshark/-/issues/19569). +* Fuzz job crash output: fuzz-2024-01-05-7725.pcap. [Issue 19570](https://gitlab.com/wireshark/wireshark/-/issues/19570). +* Fuzz job crash output: fuzz-2024-01-06-7734.pcap. [Issue 19578](https://gitlab.com/wireshark/wireshark/-/issues/19578). +* Incorrect recursion depth assert failure when dissecting a legitimate GOOSE message. [Issue 19580](https://gitlab.com/wireshark/wireshark/-/issues/19580). +* OPC UA - large read request is reported as malformed in 4.2.1 but not in 4.0.12. [Issue 19581](https://gitlab.com/wireshark/wireshark/-/issues/19581). +* TFTP dissector bug type listed as netscii instead of netascii doesn’t show all TFTP packets including TFTP blocks. [Issue 19589](https://gitlab.com/wireshark/wireshark/-/issues/19589). +* SMB1 replies from LAN Drive app only show up as NBSS Continuation Message. [Issue 19593](https://gitlab.com/wireshark/wireshark/-/issues/19593). +* ciscodump - older SSH key exchange algorithms not supported. [Issue 19594](https://gitlab.com/wireshark/wireshark/-/issues/19594). +* Problem decoding LAPB/X.25/FTAM after adding X.75 decoding. [Issue 19595](https://gitlab.com/wireshark/wireshark/-/issues/19595). +* Wireshark Filter not working. [Issue 19604](https://gitlab.com/wireshark/wireshark/-/issues/19604). +* CFLOW: failure to decode 0 length data fields of IPFIX variable length data types. [Issue 19605](https://gitlab.com/wireshark/wireshark/-/issues/19605). +* Copy …​as Printable Text Feature Missing in 4.1/4.2. [Issue 19607](https://gitlab.com/wireshark/wireshark/-/issues/19607). +* Export Objects - HTTP is missing some HTTP/2 files in a two-pass analysis. [Issue 19609](https://gitlab.com/wireshark/wireshark/-/issues/19609). +* ASAM-CMP Plugin: Malformed message, length mismatch if vendor defined data of status messages has odd length. [Issue 19626](https://gitlab.com/wireshark/wireshark/-/issues/19626). +* OSS-Fuzz 66561: wireshark:fuzzshark\_ip\_proto-udp: Null-dereference READ in wmem\_map\_lookup. [Issue 19642](https://gitlab.com/wireshark/wireshark/-/issues/19642). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +ASAM CMP, CAN, CFLOW, CMIP, CMP, DAP, DICOM, DISP, E2AP, GLOW, GOOSE, GTP, GTPv2, H.225, H.245, H.248, HTTP2, IEEE 1609.2, IEEE 1722, IPv4, IPv6, ISO 15765, ISUP, ITS, Kerberos, LDAP, MMS, NBT, NRUP, openSAFETY, P22, P7, PARLAY, RTMPT, RTP, SCSI, SOME/IP, T.38, TCP, TECMP, TFTP, WOW, X.509if, X.509sat, X.75, X11, Z39.50, and ZigBee Green Power + +### New and Updated Capture File Support + +pcap and pcapng + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.2.3. +You can find release notes for prior versions at the following locations: + +* [Wireshark 4.2.2](https://www.wireshark.org/docs/relnotes/wireshark-4.2.2.html) +* [Wireshark 4.2.1](https://www.wireshark.org/docs/relnotes/wireshark-4.2.1.html) +* [Wireshark 4.2.0](https://www.wireshark.org/docs/relnotes/wireshark-4.2.0.html) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_424.md b/corpus/changelog/wireshark_releases/wireshark_424.md new file mode 100644 index 0000000000000000000000000000000000000000..ba6cf66629643a18fda1e60c2b1b546da21f1747 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_424.md @@ -0,0 +1,118 @@ +# Wireshark 4.2.4 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.2.4.html +Version: 4.2.4 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +If you are upgrading Wireshark 4.2.0 or 4.2.1 on Windows you will need to [download and install](https://www.wireshark.org/download.html) Wireshark 4.2.4 or later by hand. + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2024-06](https://www.wireshark.org/security/wnpa-sec-2024-06) + T.38 dissector crash. + [Issue 19695](https://gitlab.com/wireshark/wireshark/-/issues/19695). + [CVE-2024-2955](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-2955). + +Additionally, CVE-2024-24478, CVE-2024-24479, and CVE-2024-24476 were recently assigned to Wireshark without any coordination with the Wireshark project. +As far as we can determine, each one is based on invalid assumptions and we have requested that they be rejected. + +The following bugs have been fixed: + +* Extcap with configuration never starts; "Configure all extcaps before start of capture." is shown instead. [Issue 18487](https://gitlab.com/wireshark/wireshark/-/issues/18487). +* Packet Dissection CSV Export includes last column even if hidden. [Issue 19666](https://gitlab.com/wireshark/wireshark/-/issues/19666). +* Inject TLS secrets closes Wireshark on Windows. [Issue 19667](https://gitlab.com/wireshark/wireshark/-/issues/19667). +* Fuzz job issue: fuzz-2024-02-27-7196.pcap. [Issue 19674](https://gitlab.com/wireshark/wireshark/-/issues/19674). +* Wireshark crashes when adding another port to the HTTP dissector. [Issue 19677](https://gitlab.com/wireshark/wireshark/-/issues/19677). +* Fuzz job issue: fuzz-2024-03-03-7204.pcap. [Issue 19685](https://gitlab.com/wireshark/wireshark/-/issues/19685). +* Fuzz job issue: randpkt-2024-03-05-8004.pcap. [Issue 19688](https://gitlab.com/wireshark/wireshark/-/issues/19688). +* When adding a new row to a table an error report may be inserted. [Issue 19705](https://gitlab.com/wireshark/wireshark/-/issues/19705). +* '--export-objects' does not work as expected on tshark version later than 3.2.10. [Issue 19715](https://gitlab.com/wireshark/wireshark/-/issues/19715). +* Fuzz job issue: fuzz-2024-03-21-7215.pcap. [Issue 19717](https://gitlab.com/wireshark/wireshark/-/issues/19717). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +5GLI, 6LoWPAN, AFP, AllJoyn, AMQP, ASAP, Babel, BACnet, Banana, BEEP, Bencode, BFCP, BGP, BT BNEP, BT SDP, BT-DHT, BVLC, CFLOW, CIP, CMIP, CMP, COROSYNC/TOTEMSRP, COSE, CQL, CSN.1, DAP, DCCP, DCOM, DHCPv6, DICOM, DISP, DOCSIS MAC MGMT, DOF, DVB-S2, E2AP, EDONKEY, ENRP, ErlDP, Etch, EXTREME MESH, FC-SWILS, GIOP, GLOW, GNW, GOOSE, GQUIC, Gryphon, GSM A-bis OML, GSUP, GTPv2, H.223, H.225.0, H.245, H.248, H.264, H.265, HSMS, ICMPv6, ICQ, IEEE1609dot2, IPP, IPPUSB, ISAKMP, iSCSI, ISIS LSP, ISO 7816, ISUP, ITS, JSON 3GPP, JXTA, Kafka, KINK, KNX/IP, LDAP, LDP, LISP, LISP TCP, LLRP, LwM2M-TLV, M2UA, M3UA, MAC-LTE, MBIM, MMS, MONGO, MPEG PES, MPLS Echo, MQ PCF, MQTT-SN, MS-WSP, MSDP, MsgPack, NAS-5GS, NETLINK, NHRP, OpenFlow, OpenWire, OPSI, OSC, P22, P7, PANA, PIM, PNIO, ProtoBuf, PROXY, Q.2931, QNET, RDP, RESP, RPL, RSL, RSVP, RTLS, RTMPT, RTPS, S7COMM, SCTP, SIMULCRYPT, SMB2, SML, SNA, SNMP, Socks, SolarEdge, SOME/IP, SoulSeek, SUA, T.38, TCAP, TEAP, TFTP, Thread, Thrift, TN5250, USBHID, USBVIDEO, VP9, WASSP, WiMAX ASN CP, WLCCP, WTP, X.509IF, X.509SAT, XML, XMPP, YAMI, Z39.50, and ZigBee ZCL + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### Updated File Format Decoding Support + +BLF, JPEG, and RBM + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.2.4. +You can find release notes for prior versions at the following locations: + +* [Wireshark 4.2.3](https://www.wireshark.org/docs/relnotes/wireshark-4.2.2.html) +* [Wireshark 4.2.2](https://www.wireshark.org/docs/relnotes/wireshark-4.2.2.html) +* [Wireshark 4.2.1](https://www.wireshark.org/docs/relnotes/wireshark-4.2.1.html) +* [Wireshark 4.2.0](https://www.wireshark.org/docs/relnotes/wireshark-4.2.0.html) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_425.md b/corpus/changelog/wireshark_releases/wireshark_425.md new file mode 100644 index 0000000000000000000000000000000000000000..1d4bd1d76040392d2d69c850fcc7533124c7abdf --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_425.md @@ -0,0 +1,133 @@ +# Wireshark 4.2.5 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.2.5.html +Version: 4.2.5 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +If you are upgrading Wireshark 4.2.0 or 4.2.1 on Windows you will need to [download and install](https://www.wireshark.org/download.html) Wireshark 4.2.5 or later by hand. + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2024-07](https://www.wireshark.org/security/wnpa-sec-2024-07) + MONGO and ZigBee TLV dissector infinite loops. + [Issue 19726](https://gitlab.com/wireshark/wireshark/-/issues/19726). + [CVE-2024-4854](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-4854). +* [wnpa-sec-2024-08](https://www.wireshark.org/security/wnpa-sec-2024-08) + The editcap command line utility could crash when chopping bytes from the beginning of a packet. + [Issue 19724](https://gitlab.com/wireshark/wireshark/-/issues/19724). + [CVE-2024-4853](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-4853). +* [wnpa-sec-2024-09](https://www.wireshark.org/security/wnpa-sec-2024-09) + The editcap command line utility could crash when injecting secrets while writing multiple files. + [Issue 19782](https://gitlab.com/wireshark/wireshark/-/issues/19782). + [CVE-2024-4855](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-4855). + +The following bugs have been fixed: + +* Flow Graph scrolls in the wrong direction vertically when pressing Up/Down. [Issue 12932](https://gitlab.com/wireshark/wireshark/-/issues/12932). +* TCP Stream Window Scaling not working in version 2.6.1 and later. [Issue 15016](https://gitlab.com/wireshark/wireshark/-/issues/15016). +* TCP stream graphs (Window scaling) axis display is confusing. [Issue 17425](https://gitlab.com/wireshark/wireshark/-/issues/17425). +* LUA get\_dissector does not give the correct dissector under 32-bit version. [Issue 18367](https://gitlab.com/wireshark/wireshark/-/issues/18367). +* Lua: Segfault when registering a field or expert info twice. [Issue 19194](https://gitlab.com/wireshark/wireshark/-/issues/19194). +* SSH can not decrypt when KEX is [[email protected]](/cdn-cgi/l/email-protection#d6b5a3a4a0b3e4e3e3e7effba5beb7e4e3e096babfb4a5a5bef8b9a4b1). [Issue 19240](https://gitlab.com/wireshark/wireshark/-/issues/19240). +* Wireshark crash related to Lua `DissectorTable.heuristic_new()` [Issue 19603](https://gitlab.com/wireshark/wireshark/-/issues/19603). +* MATE fails to extract HTTP2 User-Agent header. [Issue 19619](https://gitlab.com/wireshark/wireshark/-/issues/19619). +* Fuzz job issue: fuzz-2024-02-29-7169.pcap. [Issue 19679](https://gitlab.com/wireshark/wireshark/-/issues/19679). +* Fuzz job issue: fuzz-2024-03-02-7158.pcap. [Issue 19684](https://gitlab.com/wireshark/wireshark/-/issues/19684). +* Problem to Decode 5GC-N7 HTTP for payload Application/JSON. [Issue 19723](https://gitlab.com/wireshark/wireshark/-/issues/19723). +* Copying data as C String produces incorrect string. [Issue 19735](https://gitlab.com/wireshark/wireshark/-/issues/19735). +* Incorrect decoding of supported Tx HE-MCS. [Issue 19737](https://gitlab.com/wireshark/wireshark/-/issues/19737). +* reordercap: Fix packet reordering with multiple IDB’s not at the beginning of a pcapng file. [Issue 19740](https://gitlab.com/wireshark/wireshark/-/issues/19740). +* Wrong EPB lengths written if existing pcapng file has epb\_hash options. [Issue 19766](https://gitlab.com/wireshark/wireshark/-/issues/19766). +* On Windows, Export Displayed Packets dialog does not have "include depended upon packets" checkbox. [Issue 19772](https://gitlab.com/wireshark/wireshark/-/issues/19772). +* vnd.3gpp.sms binary payload NOT decoded inside HTTP2 5GC. [Issue 19773](https://gitlab.com/wireshark/wireshark/-/issues/19773). +* NAS 5G message container dissection. [Issue 19793](https://gitlab.com/wireshark/wireshark/-/issues/19793). +* Incorrect interpretation of algorithm name in packet-tls-utils.c. [Issue 19801](https://gitlab.com/wireshark/wireshark/-/issues/19801). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +5co\_legacy, 5co\_rap, BT Mesh, CQL, DOCSIS MAC MGMT, E.212, EPL, FC FZS, GQUIC, GRPC, GSM RP, HTTP2, ICMPv6, IEEE 1905, IEEE 802.11, IPARS, JSON-3GPP, LAPD, LLDP, MATE, MONGO, NAS 5GS, NR-RRC, PER, PFCP, PTP, QUIC, SSH, TIPC, and ZBD + +### New and Updated Capture File Support + +BLF and pcapng + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.2.5. +You can find release notes for prior versions at the following locations: + +* [Wireshark 4.2.4](https://www.wireshark.org/docs/relnotes/wireshark-4.2.4.html) +* [Wireshark 4.2.3](https://www.wireshark.org/docs/relnotes/wireshark-4.2.3.html) +* [Wireshark 4.2.2](https://www.wireshark.org/docs/relnotes/wireshark-4.2.2.html) +* [Wireshark 4.2.1](https://www.wireshark.org/docs/relnotes/wireshark-4.2.1.html) +* [Wireshark 4.2.0](https://www.wireshark.org/docs/relnotes/wireshark-4.2.0.html) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://lists.wireshark.org/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_426.md b/corpus/changelog/wireshark_releases/wireshark_426.md new file mode 100644 index 0000000000000000000000000000000000000000..244667f19bc2631b484d5516ab028b4881bd7a7b --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_426.md @@ -0,0 +1,118 @@ +# Wireshark 4.2.6 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.2.6.html +Version: 4.2.6 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +If you are upgrading Wireshark 4.2.0 or 4.2.1 on Windows you will need to [download and install](https://www.wireshark.org/download.html) Wireshark 4.2.6 or later by hand. + +A regression in the TCP Stream Graph "Time Sequence (tcptrace)" receive window line behavior introduced in 4.2.5 and 4.0.15 has been fixed. [Issue 19846](https://gitlab.com/wireshark/wireshark/-/issues/19846) + +The following vulnerability has been fixed: + +* [wnpa-sec-2024-10](https://www.wireshark.org/security/wnpa-sec-2024-10) + SPRT dissector crash. + [Issue 19559](https://gitlab.com/wireshark/wireshark/-/issues/19559). + +The following bugs have been fixed: + +* RADIUS dissector’s dictionary loading broken in many ways. [Issue 6466](https://gitlab.com/wireshark/wireshark/-/issues/6466). +* 3.4 → 3.6.5 ASCII display is broken on CentOS 7. [Issue 18096](https://gitlab.com/wireshark/wireshark/-/issues/18096). +* Funnel/Lua: Closing child window disconnects buttons of parent. [Issue 18386](https://gitlab.com/wireshark/wireshark/-/issues/18386). +* Lua detection fails with Alpine Linux: missing: LUA\_LIBRARIES. [Issue 19841](https://gitlab.com/wireshark/wireshark/-/issues/19841). +* vnd.3gpp.5gnas payloads of type SMS not decoded inside HTTP2 5GC. [Issue 19845](https://gitlab.com/wireshark/wireshark/-/issues/19845). +* TCP Stream Graphs green sliding window line not displayed correctly. [Issue 19846](https://gitlab.com/wireshark/wireshark/-/issues/19846). +* Wireshark window doesn’t fully fit on screen on small resolutions and can’t be resized properly on Russian language. [Issue 19861](https://gitlab.com/wireshark/wireshark/-/issues/19861). +* Wireshark started from command line doesn’t set gui.fileopen\_remembered\_dir correctly on Windows. [Issue 19891](https://gitlab.com/wireshark/wireshark/-/issues/19891). +* Wireshark expects wrong length for DHCP Relay Agent Information Source Port Suboption. [Issue 19909](https://gitlab.com/wireshark/wireshark/-/issues/19909). +* SIP P-Access-Network-Info header not correctly decoded. [Issue 19917](https://gitlab.com/wireshark/wireshark/-/issues/19917). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +DHCP, E.212, MySQL, NAS-5GS, PKT CCC, ProtoBuf, RADIUS, RLC-LTE, RTP, SIP, SPRT, Thrift, and Wi-SUN + +### New and Updated Capture File Support + +log3gpp + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.2.6. +You can find release notes for prior versions at the following locations: + +* [Wireshark 4.2.5](https://www.wireshark.org/docs/relnotes/wireshark-4.2.5.html) +* [Wireshark 4.2.4](https://www.wireshark.org/docs/relnotes/wireshark-4.2.4.html) +* [Wireshark 4.2.3](https://www.wireshark.org/docs/relnotes/wireshark-4.2.3.html) +* [Wireshark 4.2.2](https://www.wireshark.org/docs/relnotes/wireshark-4.2.2.html) +* [Wireshark 4.2.1](https://www.wireshark.org/docs/relnotes/wireshark-4.2.1.html) +* [Wireshark 4.2.0](https://www.wireshark.org/docs/relnotes/wireshark-4.2.0.html) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://www.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_427.md b/corpus/changelog/wireshark_releases/wireshark_427.md new file mode 100644 index 0000000000000000000000000000000000000000..275eef150af5797b0aa6cb4d45f0f7eddbe0bdc1 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_427.md @@ -0,0 +1,111 @@ +# Wireshark 4.2.7 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.2.7.html +Version: 4.2.7 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +The following vulnerability has been fixed: + +* [wnpa-sec-2024-11](https://www.wireshark.org/security/wnpa-sec-2024-11) + NTLMSSP dissector crash. + [Issue 19943](https://gitlab.com/wireshark/wireshark/-/issues/19943). + [CVE-2024-8250](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-8250). + +The following bugs have been fixed: + +* Fuzz job issue: fuzz-2024-01-31-7745.pcap. [Issue 19627](https://gitlab.com/wireshark/wireshark/-/issues/19627). +* OSS-Fuzz 70534: wireshark:fuzzshark\_ip\_proto-udp: Stack-overflow in dissect\_cbor\_main\_type. [Issue 19935](https://gitlab.com/wireshark/wireshark/-/issues/19935). +* SOME/IP Protocol heuristic dissector fails to parse. [Issue 19670](https://gitlab.com/wireshark/wireshark/-/issues/19670). +* 6loWPAN: Page Number Field Incorrect Registration. [Issue 19934](https://gitlab.com/wireshark/wireshark/-/issues/19934). +* PacketBB incorrectly reports "Malformed Packet" [Issue 19972](https://gitlab.com/wireshark/wireshark/-/issues/19972). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +6LoWPAN, BGP, CAN-ETH, CBOR, IEEE 802.11, LBMSRS, NTLMSSP, PacketBB, PN-MRP, SOME/IP, USBLL, X.75, and Zabbix + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.2.7. +You can find release notes for prior versions at the following locations: + +* [Wireshark 4.2.6](https://www.wireshark.org/docs/relnotes/wireshark-4.2.6.html) +* [Wireshark 4.2.5](https://www.wireshark.org/docs/relnotes/wireshark-4.2.5.html) +* [Wireshark 4.2.4](https://www.wireshark.org/docs/relnotes/wireshark-4.2.4.html) +* [Wireshark 4.2.3](https://www.wireshark.org/docs/relnotes/wireshark-4.2.3.html) +* [Wireshark 4.2.2](https://www.wireshark.org/docs/relnotes/wireshark-4.2.2.html) +* [Wireshark 4.2.1](https://www.wireshark.org/docs/relnotes/wireshark-4.2.1.html) +* [Wireshark 4.2.0](https://www.wireshark.org/docs/relnotes/wireshark-4.2.0.html) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://www.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_428.md b/corpus/changelog/wireshark_releases/wireshark_428.md new file mode 100644 index 0000000000000000000000000000000000000000..1a0cd134fb78d90e46fa427df0493093f8ea8ba1 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_428.md @@ -0,0 +1,108 @@ +# Wireshark 4.2.8 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.2.8.html +Version: 4.2.8 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2024-13](https://www.wireshark.org/security/wnpa-sec-2024-13) + AppleTalk and RELOAD Framing dissector crashes. + [Issue 20114](https://gitlab.com/wireshark/wireshark/-/issues/20114). + +The following bugs have been fixed: + +* html2text.py doesn’t handle the `` tag. [Issue 20020](https://gitlab.com/wireshark/wireshark/-/issues/20020). +* Fuzz job assertion: randpkt-2024-10-05-7200.pcap. [Issue 20110](https://gitlab.com/wireshark/wireshark/-/issues/20110). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +AppleTalk, DMP, GTP, HTTP, LwM2M-TLV, RELOAD Framing, SSyncP, TCP, and Thrift + +### New and Updated Capture File Support + +BLF, ERF, and pcap + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.2.8. +You can find release notes for prior versions at the following locations: + +* [Wireshark 4.2.7](https://www.wireshark.org/docs/relnotes/wireshark-4.2.7.html) +* [Wireshark 4.2.6](https://www.wireshark.org/docs/relnotes/wireshark-4.2.6.html) +* [Wireshark 4.2.5](https://www.wireshark.org/docs/relnotes/wireshark-4.2.5.html) +* [Wireshark 4.2.4](https://www.wireshark.org/docs/relnotes/wireshark-4.2.4.html) +* [Wireshark 4.2.3](https://www.wireshark.org/docs/relnotes/wireshark-4.2.3.html) +* [Wireshark 4.2.2](https://www.wireshark.org/docs/relnotes/wireshark-4.2.2.html) +* [Wireshark 4.2.1](https://www.wireshark.org/docs/relnotes/wireshark-4.2.1.html) +* [Wireshark 4.2.0](https://www.wireshark.org/docs/relnotes/wireshark-4.2.0.html) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://www.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_429.md b/corpus/changelog/wireshark_releases/wireshark_429.md new file mode 100644 index 0000000000000000000000000000000000000000..32f2585f6c3d75ac1572f205a176f89dd484d006 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_429.md @@ -0,0 +1,122 @@ +# Wireshark 4.2.9 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.2.9.html +Version: 4.2.9 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2024-14](https://www.wireshark.org/security/wnpa-sec-2024-14) + FiveCo RAP dissector infinite loop. + [Issue 20176](https://gitlab.com/wireshark/wireshark/-/issues/20176). +* [wnpa-sec-2024-15](https://www.wireshark.org/security/wnpa-sec-2024-15) + ECMP dissector crash. + [Issue 20214](https://gitlab.com/wireshark/wireshark/-/issues/20214). + +The following bugs have been fixed: + +* JA4\_c hashes an empty field to e3b0c44298fc when it should be 000000000000. [Issue 20066](https://gitlab.com/wireshark/wireshark/-/issues/20066). +* SRT dissector: The StreamID (SID) in the handshake extension is displayed without regarding the control characters and with NUL as terminating. [Issue 20113](https://gitlab.com/wireshark/wireshark/-/issues/20113). +* Ghost error message on POP3 packets. [Issue 20124](https://gitlab.com/wireshark/wireshark/-/issues/20124). +* Building against c-ares 1.34 fails. [Issue 20125](https://gitlab.com/wireshark/wireshark/-/issues/20125). +* Wi-Fi: 256 Block Ack (BA) is not parsed properly. [Issue 20156](https://gitlab.com/wireshark/wireshark/-/issues/20156). +* HTTP2 body decompression fails on DATA with a single padded frame. [Issue 20167](https://gitlab.com/wireshark/wireshark/-/issues/20167). +* SIP dissector bug due to "be-route" param in VIA header. [Issue 20173](https://gitlab.com/wireshark/wireshark/-/issues/20173). +* Coredump after trying to open 'Follow TCP stream' [Issue 20174](https://gitlab.com/wireshark/wireshark/-/issues/20174). +* Protobuf JSON mapping error. [Issue 20182](https://gitlab.com/wireshark/wireshark/-/issues/20182). +* IEEE 802.11be: Wrong regulatory info in HE Operation IE in Beacon frame. [Issue 20187](https://gitlab.com/wireshark/wireshark/-/issues/20187). +* Wireshark crashes when a field is dragged from packet details towards the find input. [Issue 20204](https://gitlab.com/wireshark/wireshark/-/issues/20204). +* Lua DissectorTable("") : set ("10,11") unexpected behavior in locales with comma as decimal separator. [Issue 20216](https://gitlab.com/wireshark/wireshark/-/issues/20216). + +### New and Updated Features + +There are no new or updated features in this release. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +ASN.1 PER, ECMP, FiveCo RAP, HSRP, HTTP/2, IEEE 802.11, MPEG PES, PN-DCP, POP, ProtoBuf, SIP, SRT, TCP, and UMTS RLC + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.2.9. +You can find release notes for prior versions at the following locations: + +* [Wireshark 4.2.8](https://www.wireshark.org/docs/relnotes/wireshark-4.2.8.html) +* [Wireshark 4.2.7](https://www.wireshark.org/docs/relnotes/wireshark-4.2.7.html) +* [Wireshark 4.2.6](https://www.wireshark.org/docs/relnotes/wireshark-4.2.6.html) +* [Wireshark 4.2.5](https://www.wireshark.org/docs/relnotes/wireshark-4.2.5.html) +* [Wireshark 4.2.4](https://www.wireshark.org/docs/relnotes/wireshark-4.2.4.html) +* [Wireshark 4.2.3](https://www.wireshark.org/docs/relnotes/wireshark-4.2.3.html) +* [Wireshark 4.2.2](https://www.wireshark.org/docs/relnotes/wireshark-4.2.2.html) +* [Wireshark 4.2.1](https://www.wireshark.org/docs/relnotes/wireshark-4.2.1.html) +* [Wireshark 4.2.0](https://www.wireshark.org/docs/relnotes/wireshark-4.2.0.html) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on +[the web site](https://www.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_440.md b/corpus/changelog/wireshark_releases/wireshark_440.md new file mode 100644 index 0000000000000000000000000000000000000000..5c642ff09a60462be384db8b93014cf18c59fd29 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_440.md @@ -0,0 +1,383 @@ +# Wireshark 4.4.0 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.4.0.html +Version: 4.4.0 + +This is the first release of the 4.4 branch. + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +Many improvements and fixes to the graphing dialogs, including +I/O Graphs, Flow Graph / VoIP Calls, and TCP Stream Graphs. + +Wireshark now supports automatic profile switching. +You can associate a display filter with a configuration profile, and when you open a capture file that matches the filter, Wireshark will automatically switch to that profile. + +Support for Lua 5.3 and 5.4 has been added, and support for Lua 5.1 and 5.2 has been removed. +The Windows and macOS installers now ship with Lua 5.4.6. + +Improved display filter support for value strings (optional string representations for numeric fields). + +Display filter functions can be implemented as plugins, similar to protocol dissectors and file parsers. + +Display filters can be translated to pcap filters using **Edit** **›** **Copy** **›** **Display filter as pcap filter** if each display filter field has a corresponding pcap filter equivalent. + +Custom columns can be defined using any valid field expression, such as +display filter functions, packet slices, arithmetic calculations, logical tests, +raw byte addressing, and protocol layer modifiers. + +Custom output fields for `tshark -e` can also be defined using any +valid field expression. + +Wireshark can be built with the zlib-ng instead of zlib for compressed file support. +Zlib-ng is substantially faster than zlib. +The official Windows and macOS packages include this feature. + +Many other improvements have been made. +See the “New and Updated Features” section below for more details. + +### New and Updated Features + +The following features are either new or have been significantly updated since version 4.2.0: + +* The Windows installers now ship with Npcap 1.79. + They previously shipped with Npcap 1.78. + +* Improvements to the "I/O Graphs" dialog: + + + A number of crasher bugs have been fixed. + + The protocol tree context menu can open a I/O graph of the currently + selected field. [Issue 11362](https://gitlab.com/wireshark/wireshark/-/issues/11362) + + Smaller intervals can be used, down to 1 microsecond. [Issue 13682](https://gitlab.com/wireshark/wireshark/-/issues/13682) + + A larger number of I/O Graph item buckets can be used, up to 225 (33 million) + items. [Issue 8460](https://gitlab.com/wireshark/wireshark/-/issues/8460) + + The size of individual graph items has been reduced, which reduces memory utilization. + + When the Y field or Y axis changes, the graph displays the new graph + correctly, retapping if necessary, instead of displaying information + based on stale data. + + The graph is smarter about choosing whether to retap (expensive), + recalculate (moderately intensive), or replot (cheap) in order to + display the newly chosen options correctly with the least amount of + calculations. For instance, a graph that has previously been + plotted and is disabled and then reenabled without any other changes + will not require a new retap. [Issue 15822](https://gitlab.com/wireshark/wireshark/-/issues/15822) + + LOAD graphs are graphed properly again. [Issue 18450](https://gitlab.com/wireshark/wireshark/-/issues/18450) + + Y axes have human readable units with SI prefixes. + [Issue 12827](https://gitlab.com/wireshark/wireshark/-/issues/12827) + + Bar widths are scaled to the size of the interval. + + Bar border colors are a slightly darker color than that + of the graph itself, instead of always black. [Issue 17422](https://gitlab.com/wireshark/wireshark/-/issues/17422) + + Time values have the correct width when axes are automatically reset. + + The precision of the interval time shown in the hint message depends + on the interval. + + The tracer follows the currently selected row on the table of graphs, + and does not appear on an invisible graph. + + The tracer moves to the frame selected in the main window. + [Issue 12909](https://gitlab.com/wireshark/wireshark/-/issues/12909) + + Pending graph changes are saved when changing profiles when the + I/O Graphs dialog is open. + + I/O Graph dialog windows for closed capture files are no longer affected + by changing the list of graphs (either in that dialogs or in other dialogs + for the currently open file.) + + Newly created temporary graphs, which will not be saved + unless the configuration has changed, are more clearly marked with + italics. + + When "Time of Day" is selected for a graph, the absolute time will be + saved to CSV exports instead of the relative time. [Issue 13717](https://gitlab.com/wireshark/wireshark/-/issues/13717) + + Graphs can be reordered by dragging and dropping their list entries. [Issue 13855](https://gitlab.com/wireshark/wireshark/-/issues/13855) + + The graph layer order and legend order always matches the + order in the graph list. Legends also appear properly. [Issue 13854](https://gitlab.com/wireshark/wireshark/-/issues/13854) + + The legend can be moved to other corners of the graph by right-clicking + on it and selecting its new location from a menu. + + For purposes of displaying zero values, graphs with both lines and data point symbols are treated as line graphs, not scatter plots. + + Logarithmic ticks are used when the Y axis is logarithmic. + + The graph crosshairs context menu option works. + + You can resize the graph list columns to their contents by right clicking on the list header. + [Issue 18102](https://gitlab.com/wireshark/wireshark/-/issues/18102) + + The graph is more responsive to mouse movement, especially on Linux Wayland. +* Improvements to the Sequence Diagram (Flow Graphs and VoIP Calls): + + + When exporting the graph as an image, the entire graph is shown + with up to 1000 items instead of only what was visible on-screen. + This value can be increased in the preferences. [Issue 13504](https://gitlab.com/wireshark/wireshark/-/issues/13504) + + Endpoints that share the same address now have two distinct nodes + with a line between them. [Issue 12038](https://gitlab.com/wireshark/wireshark/-/issues/12038) + + The "Comment" column can be resized by selecting the axis between the + "Comment" column and the graph and dragging, and auto-resized by + double-clicking the column. [Issue 4972](https://gitlab.com/wireshark/wireshark/-/issues/4972) + + Tooltips are shown for elided comments. + + The scroll direction via keyboard is no longer reversed. [Issue 12932](https://gitlab.com/wireshark/wireshark/-/issues/12932) + + The column widths are fixed instead of resizing slightly depending + on the visible entries. [Issue 12931](https://gitlab.com/wireshark/wireshark/-/issues/12931) + + The Y axis labels stay in the correct position without having to + click the **Reset** button. + + The progress bar appears correctly in the Flow Graph (non VoIP Calls). + + The behavior of the "Any" and "Network" combobox is corrected. + [Issue 19818](https://gitlab.com/wireshark/wireshark/-/issues/19818) + + "Limit to Display Filter" is checked if a display filter is applied + when the Flow Graph is opened, per the documentation. +* TCP Stream Graphs: + + + A better decision is made about which side is the server and thus + the initially chosen direction in the graph. + + The "Window Scaling" graph axis labels are corrected and show both graphs. + + The graph crosshairs context menu option works. + + Switching between relative and absolute sequence numbers works again. +* The "Follow Stream" dialog can now show delta times between turns and all packets and events. +* A number of graphs using the QCustomPlot widget ("I/O Graphs", "Flow Graph", + "TCP Stream Graphs", and "RTP Player") are more responsive to mouse + movement, especially on Linux when Wayland is used. +* The "Find Packet" dialog can search backwards and find additional occurrences + of a string, hex value, or regular expression in a single frame. +* When using "Go To Packet" with an undisplayed frame, the window goes to + nearest displayed frame by number. [Issue 2988](https://gitlab.com/wireshark/wireshark/-/issues/2988) +* Display filter syntax enhancements: + + + Better handling of comparisons with value strings. Now the display filter engine can + correctly handle cases where multiple different numeric values map to the same value + string, including but not limited to range-type value strings. + + Fields with value strings now support regular expression matching. + + Date and time values now support arithmetic, with some restrictions: + the multiplier/divisor must be an integer or floating point number and appear on the right-hand + side of the operator. + + The keyword "bitand" can be used as an alternative syntax for the bitwise-and operator. + + Functions alone can now be used as an entire logical expression. + The result of the expression is the truthiness of the function return + value (or of all values if more than one). This is useful for example to write + "len(something)" instead of "len(something) != 0". Even more so if a function + returns itself a boolean value, it is now possible to write + "bool\_test(some.field)" instead of having to write "bool\_test(some.field) == True". + Both forms are now valid. + + Display filter references can be written without curly braces. It + is now possible to write `$frame.number` instead of `${frame.number}` for example. + + There are new display filter functions which test various IP address properties. + Check the + [wireshark-filter](https://www.wireshark.org/docs/man-pages/wireshark-filter.html)(5) + man page for more information. + + There are new display filter functions which convert unsigned integer types to + decimal or hexadecimal, and convert fields with value strings into the + associated string for their value, which can be used to produce results similar to + custom columns. Check the + [wireshark-filter](https://www.wireshark.org/docs/man-pages/wireshark-filter.html)(5) + man page for more information. + + Display filter macros can be written with a semicolon after the macro + name before the argument list, e.g. `${mymacro;arg1;…​;argN}`, instead + of `${mymacro:arg1;…​;argN}`. The version with semicolons works better + with pop-up suggestions when editing the display filter, so the version + with the colon might be removed in the future. + + Display filter macros can be written using a function-like notation. + The macro `${mymacro:arg1;…​;argN}` can be written + `$mymacro(arg1,…​,argN)`. + + AX.25 addresses are now filtered using the "CALLSIGN-SSID" string syntax. + Filtering based on the raw bytes values is still possible, like other + field types, with the `@` operator. [Issue 17973](https://gitlab.com/wireshark/wireshark/-/issues/17973) +* Display filter functions can be implemented as libwireshark plugins. Plugins are loaded + during startup from the usual binary plugin configuration directories. See the + `ipaddr.c` source file in the distribution for an example of a display filter C plugin + and the doc/plugins.example folder for generic instructions how to build a plugin. +* Display filter autocompletions now also include display filter functions. +* The display filter macro configuration file has changed format. It now uses + the same format as the "dfilters" file and has been renamed accordingly to + "dmacros". Internally it no longer uses the UAT API and the display filter macro + GUI dialog has been updated. There is some basic migration logic implemented + but it is advisable to check that the "dfilter\_macros" (old) and + "dmacros" (new) files in the profile directory are consistent. +* Custom columns can be defined using any valid field expression: + + + Display filter functions, like `len(tcp.payload)`, including nested functions + like `min(len(tcp.payload), len(udp.payload))` and newly defined functions + using the plugin system mentioned above. [Issue 15990](https://gitlab.com/wireshark/wireshark/-/issues/15990) [Issue 16181](https://gitlab.com/wireshark/wireshark/-/issues/16181) + + Arithmetic calculations, like `ip.len * 8` or `tcp.srcport + tcp.dstport`. + [Issue 7752](https://gitlab.com/wireshark/wireshark/-/issues/7752) + + Slices, like `tcp.payload[4:4]`. [Issue 10154](https://gitlab.com/wireshark/wireshark/-/issues/10154) + + The layer operator, like `ip.proto#1`, which will return the protocol field in the + first IPv4 layer if there is tunneling. [Issue 18588](https://gitlab.com/wireshark/wireshark/-/issues/18588) + + Raw byte addressing, like `@ip`, which will return the bytes of protocol + or FT\_NONE fields, among others. [Issue 19076](https://gitlab.com/wireshark/wireshark/-/issues/19076) + + Logical tests, like `tcp.port == 443`, which produce a check mark if + the test matches (similar to protocol and FT\_NONE fields without `@`.) + This works with all logical operators, including e.g. regular expression + matching (`matches` or `~`.) + + Defined display filter macros. + + Any combination of the above also works. + + Multifield columns are still available. For backwards compatibility, + `X or Y` is interpreted as a multifield column as before. To represent a + logical test for the presence of multiple fields instead of concatenating + values, use parenthesis, e.g. `(tcp.options.timestamp or tcp.options.nop)`. + + Field references are not implemented because there’s no sense of a + currently selected frame. "Resolved" column values (such as host name + resolution or value string lookup) are not supported for any of the new + expressions yet. +* Custom output fields for `tshark -e ` can also be defined using any + valid field expression as above. + + + For custom output fields, `X or Y` is the usual logical test; to output + multiple fields use multiple `-e` terms as before. + + The various `-E` options, including `-E occurrence`, all work as expected. +* When selecting "Manage Interfaces" from "Capture Options", Wireshark only + attempts to reconnect to rpcap hosts that were active in the + last session, instead of every remote host that the current profile has ever + connected to. [Issue 17484](https://gitlab.com/wireshark/wireshark/-/issues/17484) +* The "Resolved Addresses" dialog only shows what addresses and ports are + present in the file (not including information from static files), and + selected rows or the entire table can be saved or copied to the clipboard + in several formats. [Issue 16419](https://gitlab.com/wireshark/wireshark/-/issues/16419) +* Dumpcap and Wireshark support the `-F` option when capturing a file + on the command line. [Issue 18009](https://gitlab.com/wireshark/wireshark/-/issues/18009) +* When capturing on the command line dumpcap accepts a `-Q` option that is + quieter than `-q` and prints only errors to standard error, similar to tshark. + [Issue 14491](https://gitlab.com/wireshark/wireshark/-/issues/14491) +* When capturing a file and requesting the `pcap` format, nanosecond resolution + time stamps will be written if the device and version of libpcap supports it. +* When capturing using a file size autostop or ring buffer condition, + the maximum value is now 2 TB, up from 2GiB. Note that you may + have problems when the number of packets gets larger than 231 or 232, + though that is also true when no limit is set. +* When capturing files in multiple file mode, a pattern that places the date and time + before the index number can be used (e.g., foo\_20240714110102\_00001.pcap instead of + foo\_00001\_20240714110102.pcap). This makes file names sortable in chronological order + across file sets from different captures. The "File Set" dialog has been updated to + handle the new pattern, which has been capable of being produced by tshark since + version 3.6.0. +* Adding interfaces at startup is about twice as fast, and has many fewer + UAC pop-ups when Npcap is installed with access restricted to Administrators + on Windows. +* The Lua version included with the Windows and macOS installers has been updated to 5.4. + While we have tried to help with backward compatibility by including lua\_bitop library with + Lua 5.3 and 5.4 in addition to the native Lua support for bit operations + present in those versions, different versions of Lua are not guaranteed to + be compatible. If a Lua dissector has issues, check the manuals for + [Lua 5.4](https://www.lua.org/manual/5.4/manual.html#8), + [Lua 5.3](https://www.lua.org/manual/5.3/manual.html#8), and + [Lua 5.2](https://www.lua.org/manual/5.2/manual.html#8) for + incompatibilities and suggested workarounds. Note that features marked as + deprecated in one version are removed in the subsequent version without + additional notice, so it can be worth checking the manual for previous versions. +* Lua scripts in the plugins directories are now initially loaded via the same + internal Lua methods as `require()`. This avoids errors from loading plugins + twice, once by scanning the directory initially, and once by `require()`, + and also results in globals defined in plugins entering the global namespace. + Previously globals defined in plugins only entered the global namespace when + placed in the global plugins directory, but not the personal plugins directory. + Using globals in plugins remains deprecated style (both by Wireshark and in Lua + generally), that should be avoided via using other methods. [Issue 18589](https://gitlab.com/wireshark/wireshark/-/issues/18589) +* Lua functions have been added to decompress and decode TvbRanges with other + compression types besides zlib, such as Brotli, Snappy, Zstd, and others, + matching the support in the C API. tvbrange:uncompress() has been deprecated + in favor of tvbrange:uncompress\_zlib(). +* Lua Dumper now defaults to the pcapng file type, and to per-packet + encapsulation (creating interfaces on demand as necessary) when writing + pcapng [Issue 16403](https://gitlab.com/wireshark/wireshark/-/issues/16403) +* Editcap has an `--extract-secrets` option to extract embedded decryption + secrets from a capture file. [Issue 18197](https://gitlab.com/wireshark/wireshark/-/issues/18197) +* Global profiles can be used in tshark by using `--global-profile` option. +* Capture files can be saved with LZ4 compression. LZ4 has an emphasis on + speed and may be particularly useful for large files. +* Fast random access is supported with LZ4 compressed files when compressed + with independent blocks, which is the default. This provides much more + responsive GUI performance when jumping to different packets. Fast random + access has been supported with gzip compressed files since version 1.8.0, + but this is not supported for Zstd compressed files. +* Mergecap, Editcap, TShark and Text2pcap have an `--compress` option to + compress output to different formats. For now, it supports the gzip + and LZ4 compression formats. When the option is not given, the desired + compression format can also be deduced from the output filename + extension, e.g. gzip for .gz. +* Wireshark’s Git repostory tags are now signed using SSH. + See + [the Developer’s Guide](https://www.wireshark.org/docs/wsdg_html_chunked/ChSrcGitRepository.html#ChSrcWebInterface) + for more details. + +### Removed Features and Support + +* The tshark `-G` option with no argument is deprecated and will be removed in + a future version. Use `tshark -G fields` to produce the same report. + +### Removed Dissectors + +The Parlay dissector has been removed. + +### New Protocol Support + +Allied Telesis Resiliency Link (AT RL), ATN Security Label, Bit Index Explicit Replication (BIER), Bus Mirroring Protocol, EGNOS Message Server (EMS) file format, Galileo E1-B I/NAV navigation messages, IBM i RDMA Endpoint (iRDMA-EDP), IWBEMSERVICES, MAC NR Framed (mac-nr-framed), Matter Bluetooth Transport Protocol (MatterBTP), MiWi P2P Star, Monero, NMEA 0183, PLDM, RDP authentication redirection virtual channel protocol (rdpear), RF4CE Network Layer (RF4CE), RF4CE Profile (RF4CE Profile), RK512, SAP Remote Function Call (SAPRFC), SBAS L1 Navigation Message, Scanner Access Now Easy (SANE), TREL, WMIO, and ZeroMQ Message Transport Protocol (ZMTP) + +### Updated Protocol Support + +IPv6: The "show address detail" preference is now enabled by default. The +address details provided have been extended to include more special purpose address +block properties (forwardable, globally-routable, etc). + +Too many other protocol updates have been made to list them all here. + +### New and Updated Capture File Support + +EGNOS Messager Server (EMS) files + +### New and Updated Capture Interfaces support + +u-blox GNSS receivers + +### Major API Changes + +* The entire code base has been updated to use C99 types instead of GLib types. + This includes changing occurrences `gboolean`, which is an integer, to C99’s native `bool` type in many places. + See [issue 19116](https://gitlab.com/wireshark/wireshark/-/issues/19116) for more details. +* The `tvb_get_guintX` and `tvb_get_gintX` functions in the tvbuff API have been renamed to `tvb_get_uintX` and `tvb_get_intX` (the GLib-style "g" has been removed). + You can still use the old-style names, but they have been deprecated. +* Plugins should provide a `plugin_describe()` function that returns an ORed + list of flags consisting of the plugin types used. + See *wsutil/plugins.h* for details. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on [the mailing list site](https://lists.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_441.md b/corpus/changelog/wireshark_releases/wireshark_441.md new file mode 100644 index 0000000000000000000000000000000000000000..15da55521cb20af38acb71f5f8eca746fa4f3718 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_441.md @@ -0,0 +1,159 @@ +# Wireshark 4.4.1 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.4.1.html +Version: 4.4.1 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2024-12](https://www.wireshark.org/security/wnpa-sec-2024-12) + ITS dissector crash. + [Issue 20026](https://gitlab.com/wireshark/wireshark/-/issues/20026). +* [wnpa-sec-2024-13](https://www.wireshark.org/security/wnpa-sec-2024-13) + AppleTalk and RELOAD Framing dissector crashes. + [Issue 20114](https://gitlab.com/wireshark/wireshark/-/issues/20114). + +The following bugs have been fixed: + +* Refresh interface during live-capture leads to corrupt interface handling. [Issue 11176](https://gitlab.com/wireshark/wireshark/-/issues/11176). +* Media type "application/octet-stream" registered for both Thread and UASIP. [Issue 14729](https://gitlab.com/wireshark/wireshark/-/issues/14729). +* Extcap toolbar stops working when new interface is added. [Issue 19854](https://gitlab.com/wireshark/wireshark/-/issues/19854). +* Decoding error ITS CPM version 2.1.1. [Issue 19886](https://gitlab.com/wireshark/wireshark/-/issues/19886). +* Build error in 4.3.0: sync\_pipe\_run\_command\_actual error: argument 2 is null but the corresponding size argument 3 value is 512004 [-Werror=nonnull] [Issue 19930](https://gitlab.com/wireshark/wireshark/-/issues/19930). +* html2text.py doesn’t handle the `` tag. [Issue 20020](https://gitlab.com/wireshark/wireshark/-/issues/20020). +* Incorrect NetFlow v8 TOS AS aggregation dissection. [Issue 20021](https://gitlab.com/wireshark/wireshark/-/issues/20021). +* The Windows packages don’t ship with the IP address plugin. [Issue 20030](https://gitlab.com/wireshark/wireshark/-/issues/20030). +* O\_PATH is Linux-and-FreeBSD-specific. [Issue 20031](https://gitlab.com/wireshark/wireshark/-/issues/20031). +* Wireshark 4.4.0 doesn’t install USBcap USBcapCMD.exe in the correct directory. [Issue 20040](https://gitlab.com/wireshark/wireshark/-/issues/20040). +* OER dissector is not considering the preamble if ASN.1 SEQUENCE definition includes extension marker but no OPTIONAL items. [Issue 20044](https://gitlab.com/wireshark/wireshark/-/issues/20044). +* Bluetooth classic L2CAP incorrect dissection with connectionless reception channel. [Issue 20047](https://gitlab.com/wireshark/wireshark/-/issues/20047). +* Profile auto switch filters : Grayed Display Filter Expression dialog box when opened from Configuration Profiles dialog box. [Issue 20049](https://gitlab.com/wireshark/wireshark/-/issues/20049). +* Wireshark 4.4.0 / macOS 14.6.1 wifi if monitor mode. [Issue 20051](https://gitlab.com/wireshark/wireshark/-/issues/20051). +* TECMP Data Type passes too much data to sub dissectors. [Issue 20052](https://gitlab.com/wireshark/wireshark/-/issues/20052). +* Wireshark and tshark 4.4.0 ignore extcap options specified on the command line. [Issue 20054](https://gitlab.com/wireshark/wireshark/-/issues/20054). +* Cannot open release notes due to incorrect path with duplicated directory components. [Issue 20055](https://gitlab.com/wireshark/wireshark/-/issues/20055). +* Unable to open "Release Notes" from the "Help" menu. [Issue 20056](https://gitlab.com/wireshark/wireshark/-/issues/20056). +* No capture interfaces if Wireshark is started from command line with certain paths. [Issue 20057](https://gitlab.com/wireshark/wireshark/-/issues/20057). +* Wireshark 4.4.0 extcap path change breaks third party extcap installers. [Issue 20069](https://gitlab.com/wireshark/wireshark/-/issues/20069). +* Fuzz job UTF-8 encoding issue: fuzz-2024-09-10-7618.pcap. [Issue 20071](https://gitlab.com/wireshark/wireshark/-/issues/20071). +* Unable to create larger files than 99 size units. [Issue 20079](https://gitlab.com/wireshark/wireshark/-/issues/20079). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PRP trailer not shown for L2 IEC 61850 GOOSE packets in 4.4.0 (was working in 4.2.7) [Issue 20088](https://gitlab.com/wireshark/wireshark/-/issues/20088). +* GUI lags because NetworkManager keeps turning 802.11 monitor mode off. [Issue 20090](https://gitlab.com/wireshark/wireshark/-/issues/20090). +* Error while getting Bluetooth application process id by [Issue 20100](https://gitlab.com/wireshark/wireshark/-/issues/20100). +* Fuzz job assertion: randpkt-2024-10-05-7200.pcap. [Issue 20110](https://gitlab.com/wireshark/wireshark/-/issues/20110). + +### New and Updated Features + +* The TShark syntax for dumping only fields with a certain prefix has changed + from `-G fields prefix` to `-G fields,prefix`. This allows `tshark -G fields` + to again support also specifying the configuration profile to use. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +AppleTalk, ARTNET, BGP, BT L2CAP, CIGI, CIP Motion, CoAP, COSE, DISTCC, DMP, Ethernet OAM PDU, F5 FILEINFO, GIOP, GOOSE, GSM Management, GSM SIM, GTP, HTTP, HTTP2, ID3v2, IDN, IEEE 1609.2, IEEE 802.11, IPPUSB, iRDMA, ISystemActivator, ITS, Kerberos, LwM2M-TLV, MMS, MQ, MySQL, NCP SSS, NetFlow, OER, OWAMP, QNET, RELOAD Framing, RTCP, RTLS, SANE, SMB2, SSyncP, Sysdig Event, T.124, TECMP, Thread, Thrift, and TWAMP + +### New and Updated Capture File Support + +BLF, CLLOG, CommView, ERF, and pcap + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +This document only describes the changes introduced in Wireshark 4.4.1. +You can find release notes for prior versions at the following locations: + +Wireshark 4.4.0 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.0.html) +for details: + +Many improvements and fixes to the graphing dialogs, including +I/O Graphs, Flow Graph / VoIP Calls, and TCP Stream Graphs. + +Wireshark now supports automatic profile switching. +You can associate a display filter with a configuration profile, and when you open a capture file that matches the filter, Wireshark will automatically switch to that profile. + +Support for Lua 5.3 and 5.4 has been added, and support for Lua 5.1 and 5.2 has been removed. +The Windows and macOS installers now ship with Lua 5.4.6. + +Improved display filter support for value strings (optional string representations for numeric fields). + +Display filter functions can be implemented as plugins, similar to protocol dissectors and file parsers. + +Display filters can be translated to pcap filters using **Edit** **›** **Copy** **›** **Display filter as pcap filter** if each display filter field has a corresponding pcap filter equivalent. + +Custom columns can be defined using any valid field expression, such as +display filter functions, packet slices, arithmetic calculations, logical tests, +raw byte addressing, and protocol layer modifiers. + +Custom output fields for `tshark -e` can also be defined using any +valid field expression. + +Wireshark can be built with the zlib-ng instead of zlib for compressed file support. +Zlib-ng is substantially faster than zlib. +The official Windows and macOS packages include this feature. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on [the mailing list site](https://lists.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_4410.md b/corpus/changelog/wireshark_releases/wireshark_4410.md new file mode 100644 index 0000000000000000000000000000000000000000..5608ab2fc958509253116bb548dda7ae70e1a02b --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_4410.md @@ -0,0 +1,333 @@ +# Wireshark 4.4.10 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.4.10.html +Version: 4.4.10 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work! +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +* [wnpa-sec-2025-04](https://www.wireshark.org/security/wnpa-sec-2025-04) + MONGO dissector infinite loop. + [Issue 20724](https://gitlab.com/wireshark/wireshark/-/issues/20724). + [CVE-2025-xxx](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-xxx). + +The following bugs have been fixed: + +* Using wslog parameters in command line applications leads to freeing invalid memory. [Issue 20500](https://gitlab.com/wireshark/wireshark/-/issues/20500). +* On macOS a lower resolution Wireshark icon is displayed in the App Switcher and Launchpad. [Issue 20544](https://gitlab.com/wireshark/wireshark/-/issues/20544). +* Fuzz job crash: fuzz-2025-08-06-10932469456.pcap. [Issue 20666](https://gitlab.com/wireshark/wireshark/-/issues/20666). +* Encoding on NAS5GS- NASDL Transport Message-Multiple Container contains inconsistencies. [Issue 20679](https://gitlab.com/wireshark/wireshark/-/issues/20679). +* Bad resolver in Delegated Credential (RFC 9345) of TLS 1.3 CertificateRequest message. [Issue 20728](https://gitlab.com/wireshark/wireshark/-/issues/20728). +* Fuzz job UTF-8 encoding issue: fuzz-2025-10-03-11586692659.pcap. [Issue 20744](https://gitlab.com/wireshark/wireshark/-/issues/20744). + +### New and Updated Features + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +CFM, CQL, DOF, H.248E, HTTP2, IAX2, IEEE 802.11, LTP, MONGO, NAS-5GS, and XML + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +Wireshark 4.4.9 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.9.html) +for details: + +* RDM Product Detail List ID Disect incorrect. [Issue 20612](https://gitlab.com/wireshark/wireshark/-/issues/20612). +* SCCP LUDT segmentation decoding fails. [Issue 20647](https://gitlab.com/wireshark/wireshark/-/issues/20647). +* Ciscodump fails to start capture on Cisco IOS. [Issue 20655](https://gitlab.com/wireshark/wireshark/-/issues/20655). +* [BACnet] WritePropertyMultiple closing context tag 1 not showing. [Issue 20665](https://gitlab.com/wireshark/wireshark/-/issues/20665). +* Bug in LZ77 decoder; reads a 16-bit length when it should read a 32-bit length. [Issue 20671](https://gitlab.com/wireshark/wireshark/-/issues/20671). + +Wireshark 4.4.8 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.8.html) +for details: + +* Renegotiated DTLS session is not being decrypted. [Issue 20362](https://gitlab.com/wireshark/wireshark/-/issues/20362). +* Wireshark is completely stuck in initialization because androiddump recv() is blocked. [Issue 20526](https://gitlab.com/wireshark/wireshark/-/issues/20526). +* Fuzz job UTF-8 encoding issue: fuzz-2025-06-20-7318.pcap. [Issue 20585](https://gitlab.com/wireshark/wireshark/-/issues/20585). +* Crash when showing packet in new window after reloading Lua plugins with a certain gui.column.format preference. [Issue 20588](https://gitlab.com/wireshark/wireshark/-/issues/20588). +* Bug in UDS dissector with Service ReadDataByPeriodicIdentifier Response. [Issue 20589](https://gitlab.com/wireshark/wireshark/-/issues/20589). +* Packet diagram doesn’t show non-standard field value representations. [Issue 20590](https://gitlab.com/wireshark/wireshark/-/issues/20590). +* Packet diagram shows representation twice when field type is FT\_NONE. [Issue 20601](https://gitlab.com/wireshark/wireshark/-/issues/20601). +* application/x-www-form-urlencoded key parsed incorrectly following a name-value byte sequence with no '=' [Issue 20615](https://gitlab.com/wireshark/wireshark/-/issues/20615). +* DNP3 time stamp was unable to work after epoch time(year 2038) [Issue 20618](https://gitlab.com/wireshark/wireshark/-/issues/20618). + +Wireshark 4.4.7 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.7.html) +for details: + +* [wnpa-sec-2025-02](https://www.wireshark.org/security/wnpa-sec-2025-02) + Dissection engine crash. + [Issue 20509](https://gitlab.com/wireshark/wireshark/-/issues/20509). + [CVE-2025-5601](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-5601). +* Wireshark does not correctly decode LIN "go to sleep" in TECMP and CMP. [Issue 20463](https://gitlab.com/wireshark/wireshark/-/issues/20463). +* Dissector bug, Protocol CIGI. [Issue 20496](https://gitlab.com/wireshark/wireshark/-/issues/20496). +* Green power packets are not dissected when proto\_version == ZBEE\_VERSION\_GREEN\_POWER. [Issue 20497](https://gitlab.com/wireshark/wireshark/-/issues/20497). +* Packet diagrams misalign or drop bitfields. [Issue 20507](https://gitlab.com/wireshark/wireshark/-/issues/20507). +* Corruption when setting heuristic dissector table UI name from Lua. [Issue 20523](https://gitlab.com/wireshark/wireshark/-/issues/20523). +* LDAP dissector incorrectly displays filters with singleton "&" [Issue 20527](https://gitlab.com/wireshark/wireshark/-/issues/20527). +* WebSocket per-message compression extentions: fail to decompress server messages (from the 2nd) due to parameter handling. [Issue 20531](https://gitlab.com/wireshark/wireshark/-/issues/20531). +* The LL\_PERIODIC\_SYNC\_WR\_IND packet is not properly dissected (packet-btle.c) [Issue 20554](https://gitlab.com/wireshark/wireshark/-/issues/20554). + +Wireshark 4.4.6 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.6.html) +for details: + +* Bug in EtherCAT dissector with ECS order. [Issue 13718](https://gitlab.com/wireshark/wireshark/-/issues/13718). +* Conversation dialog columns return to default width on each new packet in live capture. [Issue 15978](https://gitlab.com/wireshark/wireshark/-/issues/15978). +* Tests fail in LTO-enabled builds in Ubuntu/Debian. [Issue 18216](https://gitlab.com/wireshark/wireshark/-/issues/18216). +* Incorrect conditions in BFCP dissector. [Issue 18717](https://gitlab.com/wireshark/wireshark/-/issues/18717). +* Static build fails on Ubuntu 24.04 because the c-ares library isn’t found. [Issue 20343](https://gitlab.com/wireshark/wireshark/-/issues/20343). +* Flutter’s Image Picker Generated JPEG Files Detected as Malformed Packet. [Issue 20355](https://gitlab.com/wireshark/wireshark/-/issues/20355). +* QUIC dissector breaks when src and dst change. [Issue 20371](https://gitlab.com/wireshark/wireshark/-/issues/20371). +* s390x: build fail on Ubuntu PPA nighty build. [Issue 20372](https://gitlab.com/wireshark/wireshark/-/issues/20372). +* Trailing octet after IPv4 packet end is not detected or displayed in raw bytes. [Issue 20423](https://gitlab.com/wireshark/wireshark/-/issues/20423). +* [packet-ax25-nol3.c] Only call APRS dissector on UI Frames. [Issue 20429](https://gitlab.com/wireshark/wireshark/-/issues/20429). +* Wireshark hangs when refreshing interfaces with the debug console preference set to "always" and a file open (Windows) [Issue 20434](https://gitlab.com/wireshark/wireshark/-/issues/20434). +* BGP EVPN - Type-8 route not correctly read after addition of Max. Response Time field. [Issue 20459](https://gitlab.com/wireshark/wireshark/-/issues/20459). +* Wireshark does not correctly decode LIN "go to sleep" in TECMP and CMP. [Issue 20463](https://gitlab.com/wireshark/wireshark/-/issues/20463). +* MQTT-SN: WILLTOPIC message not decoded correctly (missing some flags) [Issue 20476](https://gitlab.com/wireshark/wireshark/-/issues/20476). + +Wireshark 4.4.5 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.5.html) +for details: + +* GRPC: protobuf\_json only displays the truncated string value. [Issue 20392](https://gitlab.com/wireshark/wireshark/-/issues/20392). +* Wireshark crashes when clicking on a column title/header. [Issue 20403](https://gitlab.com/wireshark/wireshark/-/issues/20403). + +Wireshark 4.4.4 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.4.html) +for details: + +* [wnpa-sec-2025-01](https://www.wireshark.org/security/wnpa-sec-2025-01) + Bundle Protocol and CBOR dissector {crash,infinite loop,memory leak}. + [Issue 20373](https://gitlab.com/wireshark/wireshark/-/issues/20373). +* Crash when sorting columns during capture with display filter active. [Issue 20263](https://gitlab.com/wireshark/wireshark/-/issues/20263). +* OSS-Fuzz 384757274: Invalid-bool-value in dissect\_tcp. [Issue 20300](https://gitlab.com/wireshark/wireshark/-/issues/20300). +* Test failure in 4.4.2/4.4.3: test\_sharkd\_req\_follow\_http2. [Issue 20330](https://gitlab.com/wireshark/wireshark/-/issues/20330). +* Regression in extcap interface toolbar. [Issue 20354](https://gitlab.com/wireshark/wireshark/-/issues/20354). +* Clicking outside columns in TCP tab of Statistics → Conversations window causes crash. [Issue 20357](https://gitlab.com/wireshark/wireshark/-/issues/20357). +* FTBFS with Ubuntu development (25.04) release. [Issue 20359](https://gitlab.com/wireshark/wireshark/-/issues/20359). +* DNS enable\_qname\_stats crash Wireshark when QDCOUNT == 0. [Issue 20367](https://gitlab.com/wireshark/wireshark/-/issues/20367). +* Windows: Android extcap plugin fails with "Broken socket connection" if there are no new packets for 2sec. [Issue 20386](https://gitlab.com/wireshark/wireshark/-/issues/20386). +* TECMP: Calculation of lifecycle start in Status message is wrong. [Issue 20387](https://gitlab.com/wireshark/wireshark/-/issues/20387). +* MQTT v5.0 properties total length presentation is incorrect. [Issue 20389](https://gitlab.com/wireshark/wireshark/-/issues/20389). +* TShark doesn’t resolve addresses in custom "hosts" files. [Issue 20391](https://gitlab.com/wireshark/wireshark/-/issues/20391). +* Incorrect JA4 fingerprint with empty ciphers. [Issue 20394](https://gitlab.com/wireshark/wireshark/-/issues/20394). + +Wireshark 4.4.3 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.3.html) +for details: + +* Potential mis-match in GSM MAP dissector for uncertainty radius and its filter key. [Issue 20247](https://gitlab.com/wireshark/wireshark/-/issues/20247). +* Macro eNodeB ID and Extended Macro eNodeB ID not decoded by User Location Information. [Issue 20276](https://gitlab.com/wireshark/wireshark/-/issues/20276). +* The NFSv2 Dissector appears to be swapping Character Special File and Directory in mode decoding. [Issue 20290](https://gitlab.com/wireshark/wireshark/-/issues/20290). +* CMake discovers Strawberry Perl’s zlib DLL when it shouldn’t. [Issue 20304](https://gitlab.com/wireshark/wireshark/-/issues/20304). +* VOIP Calls call flow displaying hours. [Issue 20311](https://gitlab.com/wireshark/wireshark/-/issues/20311). +* Fuzz job issue: fuzz-2024-12-26-7898.pcap. [Issue 20313](https://gitlab.com/wireshark/wireshark/-/issues/20313). +* sFlow: Incorrect length passed to header sample dissector. [Issue 20320](https://gitlab.com/wireshark/wireshark/-/issues/20320). +* wsutil: Should link against -lm due to missing fabs() when built with -fno-builtin. [Issue 20326](https://gitlab.com/wireshark/wireshark/-/issues/20326). + +Wireshark 4.4.2 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.2.html) +for details: + +* [wnpa-sec-2024-14](https://www.wireshark.org/security/wnpa-sec-2024-14) + FiveCo RAP dissector infinite loop. + [Issue 20176](https://gitlab.com/wireshark/wireshark/-/issues/20176). +* [wnpa-sec-2024-15](https://www.wireshark.org/security/wnpa-sec-2024-15) + ECMP dissector crash. + [Issue 20214](https://gitlab.com/wireshark/wireshark/-/issues/20214). +* CIP I/O is not detected by "enip" filter anymore. [Issue 19517](https://gitlab.com/wireshark/wireshark/-/issues/19517). +* Fuzz job issue: fuzz-2024-09-03-7550.pcap. [Issue 20041](https://gitlab.com/wireshark/wireshark/-/issues/20041). +* OSS-Fuzz 71476: wireshark:fuzzshark\_ip\_proto-udp: Index-out-of-bounds in DOFObjectID\_Create\_Unmarshal. [Issue 20065](https://gitlab.com/wireshark/wireshark/-/issues/20065). +* JA4\_c hashes an empty field to e3b0c44298fc when it should be 000000000000. [Issue 20066](https://gitlab.com/wireshark/wireshark/-/issues/20066). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PTP analysis loses track of message associations in case of sequence number resets. [Issue 20099](https://gitlab.com/wireshark/wireshark/-/issues/20099). +* USB CCID: response packet in case SetParameters command is unsupported is flagged as malformed. [Issue 20107](https://gitlab.com/wireshark/wireshark/-/issues/20107). +* dumpcap crashes when run from TShark with a capture filter. [Issue 20108](https://gitlab.com/wireshark/wireshark/-/issues/20108). +* SRT dissector: The StreamID (SID) in the handshake extension is displayed without regarding the control characters and with NUL as terminating. [Issue 20113](https://gitlab.com/wireshark/wireshark/-/issues/20113). +* Ghost error message on POP3 packets. [Issue 20124](https://gitlab.com/wireshark/wireshark/-/issues/20124). +* Building against c-ares 1.34 fails. [Issue 20125](https://gitlab.com/wireshark/wireshark/-/issues/20125). +* D-Bus is not optional anymore. [Issue 20126](https://gitlab.com/wireshark/wireshark/-/issues/20126). +* macOS Intel DMGs aren’t fully notarized. [Issue 20129](https://gitlab.com/wireshark/wireshark/-/issues/20129). +* Incorrect name for MLD Capabilities and Operations Present flag in dissection of MLD Capabilities for MLO wifi-7 capture. [Issue 20134](https://gitlab.com/wireshark/wireshark/-/issues/20134). +* CQL Malformed Packet v4 S → C Type RESULT: Prepared[Malformed Packet] [Issue 20142](https://gitlab.com/wireshark/wireshark/-/issues/20142). +* Wi-Fi: 256 Block Ack (BA) is not parsed properly. [Issue 20156](https://gitlab.com/wireshark/wireshark/-/issues/20156). +* BACnet ReadPropertyMultiple request Maximum allowed recursion depth reached. [Issue 20159](https://gitlab.com/wireshark/wireshark/-/issues/20159). +* Statistics→I/O Graph crashes when using simple moving average. [Issue 20163](https://gitlab.com/wireshark/wireshark/-/issues/20163). +* HTTP2 body decompression fails on DATA with a single padded frame. [Issue 20167](https://gitlab.com/wireshark/wireshark/-/issues/20167). +* Compiler warning for ui/tap-rtp-common.c (ignoring return value) [Issue 20169](https://gitlab.com/wireshark/wireshark/-/issues/20169). +* SIP dissector bug due to "be-route" param in VIA header. [Issue 20173](https://gitlab.com/wireshark/wireshark/-/issues/20173). +* Coredump after trying to open 'Follow TCP stream' [Issue 20174](https://gitlab.com/wireshark/wireshark/-/issues/20174). +* Protobuf JSON mapping error. [Issue 20182](https://gitlab.com/wireshark/wireshark/-/issues/20182). +* Display filter "!stp.pvst.origvlan in { vlan.id }" causes a crash (Version 4.4.1) [Issue 20183](https://gitlab.com/wireshark/wireshark/-/issues/20183). +* Extcap plugins shipped with Wireshark Portable are not found in version 4.4.1. [Issue 20184](https://gitlab.com/wireshark/wireshark/-/issues/20184). +* IEEE 802.11be: Wrong regulatory info in HE Operation IE in Beacon frame. [Issue 20187](https://gitlab.com/wireshark/wireshark/-/issues/20187). +* Wireshark 4.4.1 does not decode RTCP packets. [Issue 20188](https://gitlab.com/wireshark/wireshark/-/issues/20188). +* Qt: Display filter sub-menu can only be opened on the triangle, not the full name. [Issue 20190](https://gitlab.com/wireshark/wireshark/-/issues/20190). +* Qt: Changing the display filter does not update the Conversations or Endpoints dialogs. [Issue 20191](https://gitlab.com/wireshark/wireshark/-/issues/20191). +* MODBUS Dissector bug. [Issue 20192](https://gitlab.com/wireshark/wireshark/-/issues/20192). +* Modbus dissector bug - Field Occurence and Layer Operator modbus.bitval field. [Issue 20193](https://gitlab.com/wireshark/wireshark/-/issues/20193). +* Wireshark crashes when a field is dragged from packet details towards the find input. [Issue 20204](https://gitlab.com/wireshark/wireshark/-/issues/20204). +* Lua DissectorTable("") : set ("10,11") unexpected behavior in locales with comma as decimal separator. [Issue 20216](https://gitlab.com/wireshark/wireshark/-/issues/20216). + +The TCP dissector no longer falls back to using the client port as a criterion for selecting a payload dissector when the server port does not select a payload dissector (except for port 20, active FTP). +This behavior can be changed using the "Client port dissectors" preference. + +Display filters now correctly handle floating point conversion errors. + +The Lua API now has better support for comma-separated ranges in different locales. + +Wireshark 4.4.1 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.1.html) +for details: + +* [wnpa-sec-2024-12](https://www.wireshark.org/security/wnpa-sec-2024-12) + ITS dissector crash. + [Issue 20026](https://gitlab.com/wireshark/wireshark/-/issues/20026). +* [wnpa-sec-2024-13](https://www.wireshark.org/security/wnpa-sec-2024-13) + AppleTalk and RELOAD Framing dissector crashes. + [Issue 20114](https://gitlab.com/wireshark/wireshark/-/issues/20114). +* Refresh interface during live-capture leads to corrupt interface handling. [Issue 11176](https://gitlab.com/wireshark/wireshark/-/issues/11176). +* Media type "application/octet-stream" registered for both Thread and UASIP. [Issue 14729](https://gitlab.com/wireshark/wireshark/-/issues/14729). +* Extcap toolbar stops working when new interface is added. [Issue 19854](https://gitlab.com/wireshark/wireshark/-/issues/19854). +* Decoding error ITS CPM version 2.1.1. [Issue 19886](https://gitlab.com/wireshark/wireshark/-/issues/19886). +* Build error in 4.3.0: sync\_pipe\_run\_command\_actual error: argument 2 is null but the corresponding size argument 3 value is 512004 [-Werror=nonnull] [Issue 19930](https://gitlab.com/wireshark/wireshark/-/issues/19930). +* html2text.py doesn’t handle the `` tag. [Issue 20020](https://gitlab.com/wireshark/wireshark/-/issues/20020). +* Incorrect NetFlow v8 TOS AS aggregation dissection. [Issue 20021](https://gitlab.com/wireshark/wireshark/-/issues/20021). +* The Windows packages don’t ship with the IP address plugin. [Issue 20030](https://gitlab.com/wireshark/wireshark/-/issues/20030). +* O\_PATH is Linux-and-FreeBSD-specific. [Issue 20031](https://gitlab.com/wireshark/wireshark/-/issues/20031). +* Wireshark 4.4.0 doesn’t install USBcap USBcapCMD.exe in the correct directory. [Issue 20040](https://gitlab.com/wireshark/wireshark/-/issues/20040). +* OER dissector is not considering the preamble if ASN.1 SEQUENCE definition includes extension marker but no OPTIONAL items. [Issue 20044](https://gitlab.com/wireshark/wireshark/-/issues/20044). +* Bluetooth classic L2CAP incorrect dissection with connectionless reception channel. [Issue 20047](https://gitlab.com/wireshark/wireshark/-/issues/20047). +* Profile auto switch filters : Grayed Display Filter Expression dialog box when opened from Configuration Profiles dialog box. [Issue 20049](https://gitlab.com/wireshark/wireshark/-/issues/20049). +* Wireshark 4.4.0 / macOS 14.6.1 wifi if monitor mode. [Issue 20051](https://gitlab.com/wireshark/wireshark/-/issues/20051). +* TECMP Data Type passes too much data to sub dissectors. [Issue 20052](https://gitlab.com/wireshark/wireshark/-/issues/20052). +* Wireshark and tshark 4.4.0 ignore extcap options specified on the command line. [Issue 20054](https://gitlab.com/wireshark/wireshark/-/issues/20054). +* Cannot open release notes due to incorrect path with duplicated directory components. [Issue 20055](https://gitlab.com/wireshark/wireshark/-/issues/20055). +* Unable to open "Release Notes" from the "Help" menu. [Issue 20056](https://gitlab.com/wireshark/wireshark/-/issues/20056). +* No capture interfaces if Wireshark is started from command line with certain paths. [Issue 20057](https://gitlab.com/wireshark/wireshark/-/issues/20057). +* Wireshark 4.4.0 extcap path change breaks third party extcap installers. [Issue 20069](https://gitlab.com/wireshark/wireshark/-/issues/20069). +* Fuzz job UTF-8 encoding issue: fuzz-2024-09-10-7618.pcap. [Issue 20071](https://gitlab.com/wireshark/wireshark/-/issues/20071). +* Unable to create larger files than 99 size units. [Issue 20079](https://gitlab.com/wireshark/wireshark/-/issues/20079). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PRP trailer not shown for L2 IEC 61850 GOOSE packets in 4.4.0 (was working in 4.2.7) [Issue 20088](https://gitlab.com/wireshark/wireshark/-/issues/20088). +* GUI lags because NetworkManager keeps turning 802.11 monitor mode off. [Issue 20090](https://gitlab.com/wireshark/wireshark/-/issues/20090). +* Error while getting Bluetooth application process id by [Issue 20100](https://gitlab.com/wireshark/wireshark/-/issues/20100). +* Fuzz job assertion: randpkt-2024-10-05-7200.pcap. [Issue 20110](https://gitlab.com/wireshark/wireshark/-/issues/20110). + +Wireshark 4.4.0 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.0.html) +for details: + +Many improvements and fixes to the graphing dialogs, including +I/O Graphs, Flow Graph / VoIP Calls, and TCP Stream Graphs. + +Wireshark now supports automatic profile switching. +You can associate a display filter with a configuration profile, and when you open a capture file that matches the filter, Wireshark will automatically switch to that profile. + +Support for Lua 5.3 and 5.4 has been added, and support for Lua 5.1 and 5.2 has been removed. +The Windows and macOS installers now ship with Lua 5.4.6. + +Improved display filter support for value strings (optional string representations for numeric fields). + +Display filter functions can be implemented as plugins, similar to protocol dissectors and file parsers. + +Display filters can be translated to pcap filters using **Edit** **›** **Copy** **›** **Display filter as pcap filter** if each display filter field has a corresponding pcap filter equivalent. + +Custom columns can be defined using any valid field expression, such as +display filter functions, packet slices, arithmetic calculations, logical tests, +raw byte addressing, and protocol layer modifiers. + +Custom output fields for `tshark -e` can also be defined using any +valid field expression. + +Wireshark can be built with the zlib-ng instead of zlib for compressed file support. +Zlib-ng is substantially faster than zlib. +The official Windows and macOS packages include this feature. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on [the mailing list site](https://lists.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +Official Wireshark training and certification are available from +[the Wireshark Foundation](https://www.wireshark.org/certifications). + +## Getting Certified + +You can become a Wireshark Certified Analyst! +Learn more at + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_4411.md b/corpus/changelog/wireshark_releases/wireshark_4411.md new file mode 100644 index 0000000000000000000000000000000000000000..fe25275953bb15778e1d0c450fd3c5460264155f --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_4411.md @@ -0,0 +1,343 @@ +# Wireshark 4.4.11 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.4.11.html +Version: 4.4.11 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work! +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +* [wnpa-sec-2025-06](https://www.wireshark.org/security/wnpa-sec-2025-06) + Kafka dissector crash. + [Issue 20823](https://gitlab.com/wireshark/wireshark/-/issues/20823). + +The following bugs have been fixed: + +* L2CAP dissector doesn’t understand retransmission mode. [Issue 2241](https://gitlab.com/wireshark/wireshark/-/issues/2241). +* DNS HIP dissector labels PK algorithm as HIT length. [Issue 20768](https://gitlab.com/wireshark/wireshark/-/issues/20768). +* TLS Abbreviated Handshake Using New Session Ticket. [Issue 20802](https://gitlab.com/wireshark/wireshark/-/issues/20802). +* Apply As Filter for field with FT\_NONE and BASE\_NONE for a single byte does not use the hex value. [Issue 20818](https://gitlab.com/wireshark/wireshark/-/issues/20818). +* TCP dissector creates invalid packet diagram. [Issue 20820](https://gitlab.com/wireshark/wireshark/-/issues/20820). +* Support UTF-16 strings in the IsoBus dissector for the string operations. [Issue 20845](https://gitlab.com/wireshark/wireshark/-/issues/20845). +* Fuzz job issue: fuzz-2025-11-12-12064814316.pcap. [Issue 20852](https://gitlab.com/wireshark/wireshark/-/issues/20852). + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +AC DR, BT L2CAP, CFM, DNS, ISObus VT, Kafka, LTP, and NETDFS + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### New and Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +Wireshark 4.4.10 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.10.html) +for details: + +* Using wslog parameters in command line applications leads to freeing invalid memory. [Issue 20500](https://gitlab.com/wireshark/wireshark/-/issues/20500). +* On macOS a lower resolution Wireshark icon is displayed in the App Switcher and Launchpad. sbug<20544>. +* Fuzz job crash: fuzz-2025-08-06-10932469456.pcap. [Issue 20666](https://gitlab.com/wireshark/wireshark/-/issues/20666). +* Encoding on NAS5GS- NASDL Transport Message-Multiple Container contains inconsistencies. wsbuglink:20679]. +* Bad resolver in Delegated Credential (RFC 9345) of TLS 1.3 CertificateRequest message. wsbuglink:20728]. +* Fuzz job UTF-8 encoding issue: fuzz-2025-10-03-11586692659.pcap. [Issue 20744](https://gitlab.com/wireshark/wireshark/-/issues/20744). + +Wireshark 4.4.9 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.9.html) +for details: + +* RDM Product Detail List ID Disect incorrect. [Issue 20612](https://gitlab.com/wireshark/wireshark/-/issues/20612). +* SCCP LUDT segmentation decoding fails. [Issue 20647](https://gitlab.com/wireshark/wireshark/-/issues/20647). +* Ciscodump fails to start capture on Cisco IOS. [Issue 20655](https://gitlab.com/wireshark/wireshark/-/issues/20655). +* [BACnet] WritePropertyMultiple closing context tag 1 not showing. [Issue 20665](https://gitlab.com/wireshark/wireshark/-/issues/20665). +* Bug in LZ77 decoder; reads a 16-bit length when it should read a 32-bit length. [Issue 20671](https://gitlab.com/wireshark/wireshark/-/issues/20671). + +Wireshark 4.4.8 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.8.html) +for details: + +* Renegotiated DTLS session is not being decrypted. [Issue 20362](https://gitlab.com/wireshark/wireshark/-/issues/20362). +* Wireshark is completely stuck in initialization because androiddump recv() is blocked. [Issue 20526](https://gitlab.com/wireshark/wireshark/-/issues/20526). +* Fuzz job UTF-8 encoding issue: fuzz-2025-06-20-7318.pcap. [Issue 20585](https://gitlab.com/wireshark/wireshark/-/issues/20585). +* Crash when showing packet in new window after reloading Lua plugins with a certain gui.column.format preference. [Issue 20588](https://gitlab.com/wireshark/wireshark/-/issues/20588). +* Bug in UDS dissector with Service ReadDataByPeriodicIdentifier Response. [Issue 20589](https://gitlab.com/wireshark/wireshark/-/issues/20589). +* Packet diagram doesn’t show non-standard field value representations. [Issue 20590](https://gitlab.com/wireshark/wireshark/-/issues/20590). +* Packet diagram shows representation twice when field type is FT\_NONE. [Issue 20601](https://gitlab.com/wireshark/wireshark/-/issues/20601). +* application/x-www-form-urlencoded key parsed incorrectly following a name-value byte sequence with no '=' [Issue 20615](https://gitlab.com/wireshark/wireshark/-/issues/20615). +* DNP3 time stamp was unable to work after epoch time(year 2038) [Issue 20618](https://gitlab.com/wireshark/wireshark/-/issues/20618). + +Wireshark 4.4.7 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.7.html) +for details: + +* [wnpa-sec-2025-02](https://www.wireshark.org/security/wnpa-sec-2025-02) + Dissection engine crash. + [Issue 20509](https://gitlab.com/wireshark/wireshark/-/issues/20509). + [CVE-2025-5601](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-5601). +* Wireshark does not correctly decode LIN "go to sleep" in TECMP and CMP. [Issue 20463](https://gitlab.com/wireshark/wireshark/-/issues/20463). +* Dissector bug, Protocol CIGI. [Issue 20496](https://gitlab.com/wireshark/wireshark/-/issues/20496). +* Green power packets are not dissected when proto\_version == ZBEE\_VERSION\_GREEN\_POWER. [Issue 20497](https://gitlab.com/wireshark/wireshark/-/issues/20497). +* Packet diagrams misalign or drop bitfields. [Issue 20507](https://gitlab.com/wireshark/wireshark/-/issues/20507). +* Corruption when setting heuristic dissector table UI name from Lua. [Issue 20523](https://gitlab.com/wireshark/wireshark/-/issues/20523). +* LDAP dissector incorrectly displays filters with singleton "&" [Issue 20527](https://gitlab.com/wireshark/wireshark/-/issues/20527). +* WebSocket per-message compression extentions: fail to decompress server messages (from the 2nd) due to parameter handling. [Issue 20531](https://gitlab.com/wireshark/wireshark/-/issues/20531). +* The LL\_PERIODIC\_SYNC\_WR\_IND packet is not properly dissected (packet-btle.c) [Issue 20554](https://gitlab.com/wireshark/wireshark/-/issues/20554). + +Wireshark 4.4.6 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.6.html) +for details: + +* Bug in EtherCAT dissector with ECS order. [Issue 13718](https://gitlab.com/wireshark/wireshark/-/issues/13718). +* Conversation dialog columns return to default width on each new packet in live capture. [Issue 15978](https://gitlab.com/wireshark/wireshark/-/issues/15978). +* Tests fail in LTO-enabled builds in Ubuntu/Debian. [Issue 18216](https://gitlab.com/wireshark/wireshark/-/issues/18216). +* Incorrect conditions in BFCP dissector. [Issue 18717](https://gitlab.com/wireshark/wireshark/-/issues/18717). +* Static build fails on Ubuntu 24.04 because the c-ares library isn’t found. [Issue 20343](https://gitlab.com/wireshark/wireshark/-/issues/20343). +* Flutter’s Image Picker Generated JPEG Files Detected as Malformed Packet. [Issue 20355](https://gitlab.com/wireshark/wireshark/-/issues/20355). +* QUIC dissector breaks when src and dst change. [Issue 20371](https://gitlab.com/wireshark/wireshark/-/issues/20371). +* s390x: build fail on Ubuntu PPA nighty build. [Issue 20372](https://gitlab.com/wireshark/wireshark/-/issues/20372). +* Trailing octet after IPv4 packet end is not detected or displayed in raw bytes. [Issue 20423](https://gitlab.com/wireshark/wireshark/-/issues/20423). +* [packet-ax25-nol3.c] Only call APRS dissector on UI Frames. [Issue 20429](https://gitlab.com/wireshark/wireshark/-/issues/20429). +* Wireshark hangs when refreshing interfaces with the debug console preference set to "always" and a file open (Windows) [Issue 20434](https://gitlab.com/wireshark/wireshark/-/issues/20434). +* BGP EVPN - Type-8 route not correctly read after addition of Max. Response Time field. [Issue 20459](https://gitlab.com/wireshark/wireshark/-/issues/20459). +* Wireshark does not correctly decode LIN "go to sleep" in TECMP and CMP. [Issue 20463](https://gitlab.com/wireshark/wireshark/-/issues/20463). +* MQTT-SN: WILLTOPIC message not decoded correctly (missing some flags) [Issue 20476](https://gitlab.com/wireshark/wireshark/-/issues/20476). + +Wireshark 4.4.5 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.5.html) +for details: + +* GRPC: protobuf\_json only displays the truncated string value. [Issue 20392](https://gitlab.com/wireshark/wireshark/-/issues/20392). +* Wireshark crashes when clicking on a column title/header. [Issue 20403](https://gitlab.com/wireshark/wireshark/-/issues/20403). + +Wireshark 4.4.4 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.4.html) +for details: + +* [wnpa-sec-2025-01](https://www.wireshark.org/security/wnpa-sec-2025-01) + Bundle Protocol and CBOR dissector {crash,infinite loop,memory leak}. + [Issue 20373](https://gitlab.com/wireshark/wireshark/-/issues/20373). +* Crash when sorting columns during capture with display filter active. [Issue 20263](https://gitlab.com/wireshark/wireshark/-/issues/20263). +* OSS-Fuzz 384757274: Invalid-bool-value in dissect\_tcp. [Issue 20300](https://gitlab.com/wireshark/wireshark/-/issues/20300). +* Test failure in 4.4.2/4.4.3: test\_sharkd\_req\_follow\_http2. [Issue 20330](https://gitlab.com/wireshark/wireshark/-/issues/20330). +* Regression in extcap interface toolbar. [Issue 20354](https://gitlab.com/wireshark/wireshark/-/issues/20354). +* Clicking outside columns in TCP tab of Statistics → Conversations window causes crash. [Issue 20357](https://gitlab.com/wireshark/wireshark/-/issues/20357). +* FTBFS with Ubuntu development (25.04) release. [Issue 20359](https://gitlab.com/wireshark/wireshark/-/issues/20359). +* DNS enable\_qname\_stats crash Wireshark when QDCOUNT == 0. [Issue 20367](https://gitlab.com/wireshark/wireshark/-/issues/20367). +* Windows: Android extcap plugin fails with "Broken socket connection" if there are no new packets for 2sec. [Issue 20386](https://gitlab.com/wireshark/wireshark/-/issues/20386). +* TECMP: Calculation of lifecycle start in Status message is wrong. [Issue 20387](https://gitlab.com/wireshark/wireshark/-/issues/20387). +* MQTT v5.0 properties total length presentation is incorrect. [Issue 20389](https://gitlab.com/wireshark/wireshark/-/issues/20389). +* TShark doesn’t resolve addresses in custom "hosts" files. [Issue 20391](https://gitlab.com/wireshark/wireshark/-/issues/20391). +* Incorrect JA4 fingerprint with empty ciphers. [Issue 20394](https://gitlab.com/wireshark/wireshark/-/issues/20394). + +Wireshark 4.4.3 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.3.html) +for details: + +* Potential mis-match in GSM MAP dissector for uncertainty radius and its filter key. [Issue 20247](https://gitlab.com/wireshark/wireshark/-/issues/20247). +* Macro eNodeB ID and Extended Macro eNodeB ID not decoded by User Location Information. [Issue 20276](https://gitlab.com/wireshark/wireshark/-/issues/20276). +* The NFSv2 Dissector appears to be swapping Character Special File and Directory in mode decoding. [Issue 20290](https://gitlab.com/wireshark/wireshark/-/issues/20290). +* CMake discovers Strawberry Perl’s zlib DLL when it shouldn’t. [Issue 20304](https://gitlab.com/wireshark/wireshark/-/issues/20304). +* VOIP Calls call flow displaying hours. [Issue 20311](https://gitlab.com/wireshark/wireshark/-/issues/20311). +* Fuzz job issue: fuzz-2024-12-26-7898.pcap. [Issue 20313](https://gitlab.com/wireshark/wireshark/-/issues/20313). +* sFlow: Incorrect length passed to header sample dissector. [Issue 20320](https://gitlab.com/wireshark/wireshark/-/issues/20320). +* wsutil: Should link against -lm due to missing fabs() when built with -fno-builtin. [Issue 20326](https://gitlab.com/wireshark/wireshark/-/issues/20326). + +Wireshark 4.4.2 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.2.html) +for details: + +* [wnpa-sec-2024-14](https://www.wireshark.org/security/wnpa-sec-2024-14) + FiveCo RAP dissector infinite loop. + [Issue 20176](https://gitlab.com/wireshark/wireshark/-/issues/20176). +* [wnpa-sec-2024-15](https://www.wireshark.org/security/wnpa-sec-2024-15) + ECMP dissector crash. + [Issue 20214](https://gitlab.com/wireshark/wireshark/-/issues/20214). +* CIP I/O is not detected by "enip" filter anymore. [Issue 19517](https://gitlab.com/wireshark/wireshark/-/issues/19517). +* Fuzz job issue: fuzz-2024-09-03-7550.pcap. [Issue 20041](https://gitlab.com/wireshark/wireshark/-/issues/20041). +* OSS-Fuzz 71476: wireshark:fuzzshark\_ip\_proto-udp: Index-out-of-bounds in DOFObjectID\_Create\_Unmarshal. [Issue 20065](https://gitlab.com/wireshark/wireshark/-/issues/20065). +* JA4\_c hashes an empty field to e3b0c44298fc when it should be 000000000000. [Issue 20066](https://gitlab.com/wireshark/wireshark/-/issues/20066). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PTP analysis loses track of message associations in case of sequence number resets. [Issue 20099](https://gitlab.com/wireshark/wireshark/-/issues/20099). +* USB CCID: response packet in case SetParameters command is unsupported is flagged as malformed. [Issue 20107](https://gitlab.com/wireshark/wireshark/-/issues/20107). +* dumpcap crashes when run from TShark with a capture filter. [Issue 20108](https://gitlab.com/wireshark/wireshark/-/issues/20108). +* SRT dissector: The StreamID (SID) in the handshake extension is displayed without regarding the control characters and with NUL as terminating. [Issue 20113](https://gitlab.com/wireshark/wireshark/-/issues/20113). +* Ghost error message on POP3 packets. [Issue 20124](https://gitlab.com/wireshark/wireshark/-/issues/20124). +* Building against c-ares 1.34 fails. [Issue 20125](https://gitlab.com/wireshark/wireshark/-/issues/20125). +* D-Bus is not optional anymore. [Issue 20126](https://gitlab.com/wireshark/wireshark/-/issues/20126). +* macOS Intel DMGs aren’t fully notarized. [Issue 20129](https://gitlab.com/wireshark/wireshark/-/issues/20129). +* Incorrect name for MLD Capabilities and Operations Present flag in dissection of MLD Capabilities for MLO wifi-7 capture. [Issue 20134](https://gitlab.com/wireshark/wireshark/-/issues/20134). +* CQL Malformed Packet v4 S → C Type RESULT: Prepared[Malformed Packet] [Issue 20142](https://gitlab.com/wireshark/wireshark/-/issues/20142). +* Wi-Fi: 256 Block Ack (BA) is not parsed properly. [Issue 20156](https://gitlab.com/wireshark/wireshark/-/issues/20156). +* BACnet ReadPropertyMultiple request Maximum allowed recursion depth reached. [Issue 20159](https://gitlab.com/wireshark/wireshark/-/issues/20159). +* Statistics→I/O Graph crashes when using simple moving average. [Issue 20163](https://gitlab.com/wireshark/wireshark/-/issues/20163). +* HTTP2 body decompression fails on DATA with a single padded frame. [Issue 20167](https://gitlab.com/wireshark/wireshark/-/issues/20167). +* Compiler warning for ui/tap-rtp-common.c (ignoring return value) [Issue 20169](https://gitlab.com/wireshark/wireshark/-/issues/20169). +* SIP dissector bug due to "be-route" param in VIA header. [Issue 20173](https://gitlab.com/wireshark/wireshark/-/issues/20173). +* Coredump after trying to open 'Follow TCP stream' [Issue 20174](https://gitlab.com/wireshark/wireshark/-/issues/20174). +* Protobuf JSON mapping error. [Issue 20182](https://gitlab.com/wireshark/wireshark/-/issues/20182). +* Display filter "!stp.pvst.origvlan in { vlan.id }" causes a crash (Version 4.4.1) [Issue 20183](https://gitlab.com/wireshark/wireshark/-/issues/20183). +* Extcap plugins shipped with Wireshark Portable are not found in version 4.4.1. [Issue 20184](https://gitlab.com/wireshark/wireshark/-/issues/20184). +* IEEE 802.11be: Wrong regulatory info in HE Operation IE in Beacon frame. [Issue 20187](https://gitlab.com/wireshark/wireshark/-/issues/20187). +* Wireshark 4.4.1 does not decode RTCP packets. [Issue 20188](https://gitlab.com/wireshark/wireshark/-/issues/20188). +* Qt: Display filter sub-menu can only be opened on the triangle, not the full name. [Issue 20190](https://gitlab.com/wireshark/wireshark/-/issues/20190). +* Qt: Changing the display filter does not update the Conversations or Endpoints dialogs. [Issue 20191](https://gitlab.com/wireshark/wireshark/-/issues/20191). +* MODBUS Dissector bug. [Issue 20192](https://gitlab.com/wireshark/wireshark/-/issues/20192). +* Modbus dissector bug - Field Occurence and Layer Operator modbus.bitval field. [Issue 20193](https://gitlab.com/wireshark/wireshark/-/issues/20193). +* Wireshark crashes when a field is dragged from packet details towards the find input. [Issue 20204](https://gitlab.com/wireshark/wireshark/-/issues/20204). +* Lua DissectorTable("") : set ("10,11") unexpected behavior in locales with comma as decimal separator. [Issue 20216](https://gitlab.com/wireshark/wireshark/-/issues/20216). + +The TCP dissector no longer falls back to using the client port as a criterion for selecting a payload dissector when the server port does not select a payload dissector (except for port 20, active FTP). +This behavior can be changed using the "Client port dissectors" preference. + +Display filters now correctly handle floating point conversion errors. + +The Lua API now has better support for comma-separated ranges in different locales. + +Wireshark 4.4.1 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.1.html) +for details: + +* [wnpa-sec-2024-12](https://www.wireshark.org/security/wnpa-sec-2024-12) + ITS dissector crash. + [Issue 20026](https://gitlab.com/wireshark/wireshark/-/issues/20026). +* [wnpa-sec-2024-13](https://www.wireshark.org/security/wnpa-sec-2024-13) + AppleTalk and RELOAD Framing dissector crashes. + [Issue 20114](https://gitlab.com/wireshark/wireshark/-/issues/20114). +* Refresh interface during live-capture leads to corrupt interface handling. [Issue 11176](https://gitlab.com/wireshark/wireshark/-/issues/11176). +* Media type "application/octet-stream" registered for both Thread and UASIP. [Issue 14729](https://gitlab.com/wireshark/wireshark/-/issues/14729). +* Extcap toolbar stops working when new interface is added. [Issue 19854](https://gitlab.com/wireshark/wireshark/-/issues/19854). +* Decoding error ITS CPM version 2.1.1. [Issue 19886](https://gitlab.com/wireshark/wireshark/-/issues/19886). +* Build error in 4.3.0: sync\_pipe\_run\_command\_actual error: argument 2 is null but the corresponding size argument 3 value is 512004 [-Werror=nonnull] [Issue 19930](https://gitlab.com/wireshark/wireshark/-/issues/19930). +* html2text.py doesn’t handle the `` tag. [Issue 20020](https://gitlab.com/wireshark/wireshark/-/issues/20020). +* Incorrect NetFlow v8 TOS AS aggregation dissection. [Issue 20021](https://gitlab.com/wireshark/wireshark/-/issues/20021). +* The Windows packages don’t ship with the IP address plugin. [Issue 20030](https://gitlab.com/wireshark/wireshark/-/issues/20030). +* O\_PATH is Linux-and-FreeBSD-specific. [Issue 20031](https://gitlab.com/wireshark/wireshark/-/issues/20031). +* Wireshark 4.4.0 doesn’t install USBcap USBcapCMD.exe in the correct directory. [Issue 20040](https://gitlab.com/wireshark/wireshark/-/issues/20040). +* OER dissector is not considering the preamble if ASN.1 SEQUENCE definition includes extension marker but no OPTIONAL items. [Issue 20044](https://gitlab.com/wireshark/wireshark/-/issues/20044). +* Bluetooth classic L2CAP incorrect dissection with connectionless reception channel. [Issue 20047](https://gitlab.com/wireshark/wireshark/-/issues/20047). +* Profile auto switch filters : Grayed Display Filter Expression dialog box when opened from Configuration Profiles dialog box. [Issue 20049](https://gitlab.com/wireshark/wireshark/-/issues/20049). +* Wireshark 4.4.0 / macOS 14.6.1 wifi if monitor mode. [Issue 20051](https://gitlab.com/wireshark/wireshark/-/issues/20051). +* TECMP Data Type passes too much data to sub dissectors. [Issue 20052](https://gitlab.com/wireshark/wireshark/-/issues/20052). +* Wireshark and tshark 4.4.0 ignore extcap options specified on the command line. [Issue 20054](https://gitlab.com/wireshark/wireshark/-/issues/20054). +* Cannot open release notes due to incorrect path with duplicated directory components. [Issue 20055](https://gitlab.com/wireshark/wireshark/-/issues/20055). +* Unable to open "Release Notes" from the "Help" menu. [Issue 20056](https://gitlab.com/wireshark/wireshark/-/issues/20056). +* No capture interfaces if Wireshark is started from command line with certain paths. [Issue 20057](https://gitlab.com/wireshark/wireshark/-/issues/20057). +* Wireshark 4.4.0 extcap path change breaks third party extcap installers. [Issue 20069](https://gitlab.com/wireshark/wireshark/-/issues/20069). +* Fuzz job UTF-8 encoding issue: fuzz-2024-09-10-7618.pcap. [Issue 20071](https://gitlab.com/wireshark/wireshark/-/issues/20071). +* Unable to create larger files than 99 size units. [Issue 20079](https://gitlab.com/wireshark/wireshark/-/issues/20079). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PRP trailer not shown for L2 IEC 61850 GOOSE packets in 4.4.0 (was working in 4.2.7) [Issue 20088](https://gitlab.com/wireshark/wireshark/-/issues/20088). +* GUI lags because NetworkManager keeps turning 802.11 monitor mode off. [Issue 20090](https://gitlab.com/wireshark/wireshark/-/issues/20090). +* Error while getting Bluetooth application process id by [Issue 20100](https://gitlab.com/wireshark/wireshark/-/issues/20100). +* Fuzz job assertion: randpkt-2024-10-05-7200.pcap. [Issue 20110](https://gitlab.com/wireshark/wireshark/-/issues/20110). + +Wireshark 4.4.0 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.0.html) +for details: + +Many improvements and fixes to the graphing dialogs, including +I/O Graphs, Flow Graph / VoIP Calls, and TCP Stream Graphs. + +Wireshark now supports automatic profile switching. +You can associate a display filter with a configuration profile, and when you open a capture file that matches the filter, Wireshark will automatically switch to that profile. + +Support for Lua 5.3 and 5.4 has been added, and support for Lua 5.1 and 5.2 has been removed. +The Windows and macOS installers now ship with Lua 5.4.6. + +Improved display filter support for value strings (optional string representations for numeric fields). + +Display filter functions can be implemented as plugins, similar to protocol dissectors and file parsers. + +Display filters can be translated to pcap filters using **Edit** **›** **Copy** **›** **Display filter as pcap filter** if each display filter field has a corresponding pcap filter equivalent. + +Custom columns can be defined using any valid field expression, such as +display filter functions, packet slices, arithmetic calculations, logical tests, +raw byte addressing, and protocol layer modifiers. + +Custom output fields for `tshark -e` can also be defined using any +valid field expression. + +Wireshark can be built with the zlib-ng instead of zlib for compressed file support. +Zlib-ng is substantially faster than zlib. +The official Windows and macOS packages include this feature. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on [the mailing list site](https://lists.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +Official Wireshark training and certification are available from +[the Wireshark Foundation](https://www.wireshark.org/certifications). + +## Getting Certified + +You can become a Wireshark Certified Analyst! +Learn more at + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_4412.md b/corpus/changelog/wireshark_releases/wireshark_4412.md new file mode 100644 index 0000000000000000000000000000000000000000..14727aa3f4f8c74cbb030d79c80ba892aaf7376e --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_4412.md @@ -0,0 +1,361 @@ +# Wireshark 4.4.12 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.4.12.html +Version: 4.4.12 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work! +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2025-07](https://www.wireshark.org/security/wnpa-sec-2025-07) + HTTP3 dissector crash. + [Issue 20860](https://gitlab.com/wireshark/wireshark/-/issues/20860). + [CVE-2025-13945](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-13945). +* [wnpa-sec-2025-08](https://www.wireshark.org/security/wnpa-sec-2025-08) + MEGACO dissector infinite loop. + [Issue 20884](https://gitlab.com/wireshark/wireshark/-/issues/20884). + [CVE-2025-13945](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-13945). + +The following bugs have been fixed: + +* ws\_base32\_decode should be named \*\_encode ? [Issue 20754](https://gitlab.com/wireshark/wireshark/-/issues/20754). +* Stack buffer overflow in wiretap/ber.c (ber\_open) [Issue 20878](https://gitlab.com/wireshark/wireshark/-/issues/20878). +* Fuzz job crash: fuzz-2025-11-30-12266121180.pcap. [Issue 20883](https://gitlab.com/wireshark/wireshark/-/issues/20883). +* Missing data in pinfo→cinfo in HomePlug message CM\_ATTEN\_CHAR.IND. [Issue 20893](https://gitlab.com/wireshark/wireshark/-/issues/20893). + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +Fc00, HomePlug AV, MEGACO, and SMTP + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### New and Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +Wireshark 4.4.11 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.11.html) +for details: + +* [wnpa-sec-2025-06](https://www.wireshark.org/security/wnpa-sec-2025-06) Kafka dissector crash. [Issue 20823](https://gitlab.com/wireshark/wireshark/-/issues/20823). +* L2CAP dissector doesn’t understand retransmission mode. [Issue 2241](https://gitlab.com/wireshark/wireshark/-/issues/2241). +* DNS HIP dissector labels PK algorithm as HIT length. [Issue 20768](https://gitlab.com/wireshark/wireshark/-/issues/20768). +* TLS Abbreviated Handshake Using New Session Ticket. [Issue 20802](https://gitlab.com/wireshark/wireshark/-/issues/20802). +* Apply As Filter for field with FT\_NONE and BASE\_NONE for a single byte does not use the hex value. [Issue 20818](https://gitlab.com/wireshark/wireshark/-/issues/20818). +* TCP dissector creates invalid packet diagram. [Issue 20820](https://gitlab.com/wireshark/wireshark/-/issues/20820). +* Support UTF-16 strings in the IsoBus dissector for the string operations. [Issue 20845](https://gitlab.com/wireshark/wireshark/-/issues/20845). +* Fuzz job issue: fuzz-2025-11-12-12064814316.pcap. [Issue 20852](https://gitlab.com/wireshark/wireshark/-/issues/20852). + +Wireshark 4.4.10 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.10.html) +for details: + +* Using wslog parameters in command line applications leads to freeing invalid memory. [Issue 20500](https://gitlab.com/wireshark/wireshark/-/issues/20500). +* On macOS a lower resolution Wireshark icon is displayed in the App Switcher and Launchpad. sbug<20544>. +* Fuzz job crash: fuzz-2025-08-06-10932469456.pcap. [Issue 20666](https://gitlab.com/wireshark/wireshark/-/issues/20666). +* Encoding on NAS5GS- NASDL Transport Message-Multiple Container contains inconsistencies. wsbuglink:20679]. +* Bad resolver in Delegated Credential (RFC 9345) of TLS 1.3 CertificateRequest message. wsbuglink:20728]. +* Fuzz job UTF-8 encoding issue: fuzz-2025-10-03-11586692659.pcap. [Issue 20744](https://gitlab.com/wireshark/wireshark/-/issues/20744). + +Wireshark 4.4.9 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.9.html) +for details: + +* RDM Product Detail List ID Disect incorrect. [Issue 20612](https://gitlab.com/wireshark/wireshark/-/issues/20612). +* SCCP LUDT segmentation decoding fails. [Issue 20647](https://gitlab.com/wireshark/wireshark/-/issues/20647). +* Ciscodump fails to start capture on Cisco IOS. [Issue 20655](https://gitlab.com/wireshark/wireshark/-/issues/20655). +* [BACnet] WritePropertyMultiple closing context tag 1 not showing. [Issue 20665](https://gitlab.com/wireshark/wireshark/-/issues/20665). +* Bug in LZ77 decoder; reads a 16-bit length when it should read a 32-bit length. [Issue 20671](https://gitlab.com/wireshark/wireshark/-/issues/20671). + +Wireshark 4.4.8 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.8.html) +for details: + +* Renegotiated DTLS session is not being decrypted. [Issue 20362](https://gitlab.com/wireshark/wireshark/-/issues/20362). +* Wireshark is completely stuck in initialization because androiddump recv() is blocked. [Issue 20526](https://gitlab.com/wireshark/wireshark/-/issues/20526). +* Fuzz job UTF-8 encoding issue: fuzz-2025-06-20-7318.pcap. [Issue 20585](https://gitlab.com/wireshark/wireshark/-/issues/20585). +* Crash when showing packet in new window after reloading Lua plugins with a certain gui.column.format preference. [Issue 20588](https://gitlab.com/wireshark/wireshark/-/issues/20588). +* Bug in UDS dissector with Service ReadDataByPeriodicIdentifier Response. [Issue 20589](https://gitlab.com/wireshark/wireshark/-/issues/20589). +* Packet diagram doesn’t show non-standard field value representations. [Issue 20590](https://gitlab.com/wireshark/wireshark/-/issues/20590). +* Packet diagram shows representation twice when field type is FT\_NONE. [Issue 20601](https://gitlab.com/wireshark/wireshark/-/issues/20601). +* application/x-www-form-urlencoded key parsed incorrectly following a name-value byte sequence with no '=' [Issue 20615](https://gitlab.com/wireshark/wireshark/-/issues/20615). +* DNP3 time stamp was unable to work after epoch time(year 2038) [Issue 20618](https://gitlab.com/wireshark/wireshark/-/issues/20618). + +Wireshark 4.4.7 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.7.html) +for details: + +* [wnpa-sec-2025-02](https://www.wireshark.org/security/wnpa-sec-2025-02) + Dissection engine crash. + [Issue 20509](https://gitlab.com/wireshark/wireshark/-/issues/20509). + [CVE-2025-5601](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-5601). +* Wireshark does not correctly decode LIN "go to sleep" in TECMP and CMP. [Issue 20463](https://gitlab.com/wireshark/wireshark/-/issues/20463). +* Dissector bug, Protocol CIGI. [Issue 20496](https://gitlab.com/wireshark/wireshark/-/issues/20496). +* Green power packets are not dissected when proto\_version == ZBEE\_VERSION\_GREEN\_POWER. [Issue 20497](https://gitlab.com/wireshark/wireshark/-/issues/20497). +* Packet diagrams misalign or drop bitfields. [Issue 20507](https://gitlab.com/wireshark/wireshark/-/issues/20507). +* Corruption when setting heuristic dissector table UI name from Lua. [Issue 20523](https://gitlab.com/wireshark/wireshark/-/issues/20523). +* LDAP dissector incorrectly displays filters with singleton "&" [Issue 20527](https://gitlab.com/wireshark/wireshark/-/issues/20527). +* WebSocket per-message compression extentions: fail to decompress server messages (from the 2nd) due to parameter handling. [Issue 20531](https://gitlab.com/wireshark/wireshark/-/issues/20531). +* The LL\_PERIODIC\_SYNC\_WR\_IND packet is not properly dissected (packet-btle.c) [Issue 20554](https://gitlab.com/wireshark/wireshark/-/issues/20554). + +Wireshark 4.4.6 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.6.html) +for details: + +* Bug in EtherCAT dissector with ECS order. [Issue 13718](https://gitlab.com/wireshark/wireshark/-/issues/13718). +* Conversation dialog columns return to default width on each new packet in live capture. [Issue 15978](https://gitlab.com/wireshark/wireshark/-/issues/15978). +* Tests fail in LTO-enabled builds in Ubuntu/Debian. [Issue 18216](https://gitlab.com/wireshark/wireshark/-/issues/18216). +* Incorrect conditions in BFCP dissector. [Issue 18717](https://gitlab.com/wireshark/wireshark/-/issues/18717). +* Static build fails on Ubuntu 24.04 because the c-ares library isn’t found. [Issue 20343](https://gitlab.com/wireshark/wireshark/-/issues/20343). +* Flutter’s Image Picker Generated JPEG Files Detected as Malformed Packet. [Issue 20355](https://gitlab.com/wireshark/wireshark/-/issues/20355). +* QUIC dissector breaks when src and dst change. [Issue 20371](https://gitlab.com/wireshark/wireshark/-/issues/20371). +* s390x: build fail on Ubuntu PPA nighty build. [Issue 20372](https://gitlab.com/wireshark/wireshark/-/issues/20372). +* Trailing octet after IPv4 packet end is not detected or displayed in raw bytes. [Issue 20423](https://gitlab.com/wireshark/wireshark/-/issues/20423). +* [packet-ax25-nol3.c] Only call APRS dissector on UI Frames. [Issue 20429](https://gitlab.com/wireshark/wireshark/-/issues/20429). +* Wireshark hangs when refreshing interfaces with the debug console preference set to "always" and a file open (Windows) [Issue 20434](https://gitlab.com/wireshark/wireshark/-/issues/20434). +* BGP EVPN - Type-8 route not correctly read after addition of Max. Response Time field. [Issue 20459](https://gitlab.com/wireshark/wireshark/-/issues/20459). +* Wireshark does not correctly decode LIN "go to sleep" in TECMP and CMP. [Issue 20463](https://gitlab.com/wireshark/wireshark/-/issues/20463). +* MQTT-SN: WILLTOPIC message not decoded correctly (missing some flags) [Issue 20476](https://gitlab.com/wireshark/wireshark/-/issues/20476). + +Wireshark 4.4.5 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.5.html) +for details: + +* GRPC: protobuf\_json only displays the truncated string value. [Issue 20392](https://gitlab.com/wireshark/wireshark/-/issues/20392). +* Wireshark crashes when clicking on a column title/header. [Issue 20403](https://gitlab.com/wireshark/wireshark/-/issues/20403). + +Wireshark 4.4.4 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.4.html) +for details: + +* [wnpa-sec-2025-01](https://www.wireshark.org/security/wnpa-sec-2025-01) + Bundle Protocol and CBOR dissector {crash,infinite loop,memory leak}. + [Issue 20373](https://gitlab.com/wireshark/wireshark/-/issues/20373). +* Crash when sorting columns during capture with display filter active. [Issue 20263](https://gitlab.com/wireshark/wireshark/-/issues/20263). +* OSS-Fuzz 384757274: Invalid-bool-value in dissect\_tcp. [Issue 20300](https://gitlab.com/wireshark/wireshark/-/issues/20300). +* Test failure in 4.4.2/4.4.3: test\_sharkd\_req\_follow\_http2. [Issue 20330](https://gitlab.com/wireshark/wireshark/-/issues/20330). +* Regression in extcap interface toolbar. [Issue 20354](https://gitlab.com/wireshark/wireshark/-/issues/20354). +* Clicking outside columns in TCP tab of Statistics → Conversations window causes crash. [Issue 20357](https://gitlab.com/wireshark/wireshark/-/issues/20357). +* FTBFS with Ubuntu development (25.04) release. [Issue 20359](https://gitlab.com/wireshark/wireshark/-/issues/20359). +* DNS enable\_qname\_stats crash Wireshark when QDCOUNT == 0. [Issue 20367](https://gitlab.com/wireshark/wireshark/-/issues/20367). +* Windows: Android extcap plugin fails with "Broken socket connection" if there are no new packets for 2sec. [Issue 20386](https://gitlab.com/wireshark/wireshark/-/issues/20386). +* TECMP: Calculation of lifecycle start in Status message is wrong. [Issue 20387](https://gitlab.com/wireshark/wireshark/-/issues/20387). +* MQTT v5.0 properties total length presentation is incorrect. [Issue 20389](https://gitlab.com/wireshark/wireshark/-/issues/20389). +* TShark doesn’t resolve addresses in custom "hosts" files. [Issue 20391](https://gitlab.com/wireshark/wireshark/-/issues/20391). +* Incorrect JA4 fingerprint with empty ciphers. [Issue 20394](https://gitlab.com/wireshark/wireshark/-/issues/20394). + +Wireshark 4.4.3 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.3.html) +for details: + +* Potential mis-match in GSM MAP dissector for uncertainty radius and its filter key. [Issue 20247](https://gitlab.com/wireshark/wireshark/-/issues/20247). +* Macro eNodeB ID and Extended Macro eNodeB ID not decoded by User Location Information. [Issue 20276](https://gitlab.com/wireshark/wireshark/-/issues/20276). +* The NFSv2 Dissector appears to be swapping Character Special File and Directory in mode decoding. [Issue 20290](https://gitlab.com/wireshark/wireshark/-/issues/20290). +* CMake discovers Strawberry Perl’s zlib DLL when it shouldn’t. [Issue 20304](https://gitlab.com/wireshark/wireshark/-/issues/20304). +* VOIP Calls call flow displaying hours. [Issue 20311](https://gitlab.com/wireshark/wireshark/-/issues/20311). +* Fuzz job issue: fuzz-2024-12-26-7898.pcap. [Issue 20313](https://gitlab.com/wireshark/wireshark/-/issues/20313). +* sFlow: Incorrect length passed to header sample dissector. [Issue 20320](https://gitlab.com/wireshark/wireshark/-/issues/20320). +* wsutil: Should link against -lm due to missing fabs() when built with -fno-builtin. [Issue 20326](https://gitlab.com/wireshark/wireshark/-/issues/20326). + +Wireshark 4.4.2 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.2.html) +for details: + +* [wnpa-sec-2024-14](https://www.wireshark.org/security/wnpa-sec-2024-14) + FiveCo RAP dissector infinite loop. + [Issue 20176](https://gitlab.com/wireshark/wireshark/-/issues/20176). +* [wnpa-sec-2024-15](https://www.wireshark.org/security/wnpa-sec-2024-15) + ECMP dissector crash. + [Issue 20214](https://gitlab.com/wireshark/wireshark/-/issues/20214). +* CIP I/O is not detected by "enip" filter anymore. [Issue 19517](https://gitlab.com/wireshark/wireshark/-/issues/19517). +* Fuzz job issue: fuzz-2024-09-03-7550.pcap. [Issue 20041](https://gitlab.com/wireshark/wireshark/-/issues/20041). +* OSS-Fuzz 71476: wireshark:fuzzshark\_ip\_proto-udp: Index-out-of-bounds in DOFObjectID\_Create\_Unmarshal. [Issue 20065](https://gitlab.com/wireshark/wireshark/-/issues/20065). +* JA4\_c hashes an empty field to e3b0c44298fc when it should be 000000000000. [Issue 20066](https://gitlab.com/wireshark/wireshark/-/issues/20066). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PTP analysis loses track of message associations in case of sequence number resets. [Issue 20099](https://gitlab.com/wireshark/wireshark/-/issues/20099). +* USB CCID: response packet in case SetParameters command is unsupported is flagged as malformed. [Issue 20107](https://gitlab.com/wireshark/wireshark/-/issues/20107). +* dumpcap crashes when run from TShark with a capture filter. [Issue 20108](https://gitlab.com/wireshark/wireshark/-/issues/20108). +* SRT dissector: The StreamID (SID) in the handshake extension is displayed without regarding the control characters and with NUL as terminating. [Issue 20113](https://gitlab.com/wireshark/wireshark/-/issues/20113). +* Ghost error message on POP3 packets. [Issue 20124](https://gitlab.com/wireshark/wireshark/-/issues/20124). +* Building against c-ares 1.34 fails. [Issue 20125](https://gitlab.com/wireshark/wireshark/-/issues/20125). +* D-Bus is not optional anymore. [Issue 20126](https://gitlab.com/wireshark/wireshark/-/issues/20126). +* macOS Intel DMGs aren’t fully notarized. [Issue 20129](https://gitlab.com/wireshark/wireshark/-/issues/20129). +* Incorrect name for MLD Capabilities and Operations Present flag in dissection of MLD Capabilities for MLO wifi-7 capture. [Issue 20134](https://gitlab.com/wireshark/wireshark/-/issues/20134). +* CQL Malformed Packet v4 S → C Type RESULT: Prepared[Malformed Packet] [Issue 20142](https://gitlab.com/wireshark/wireshark/-/issues/20142). +* Wi-Fi: 256 Block Ack (BA) is not parsed properly. [Issue 20156](https://gitlab.com/wireshark/wireshark/-/issues/20156). +* BACnet ReadPropertyMultiple request Maximum allowed recursion depth reached. [Issue 20159](https://gitlab.com/wireshark/wireshark/-/issues/20159). +* Statistics→I/O Graph crashes when using simple moving average. [Issue 20163](https://gitlab.com/wireshark/wireshark/-/issues/20163). +* HTTP2 body decompression fails on DATA with a single padded frame. [Issue 20167](https://gitlab.com/wireshark/wireshark/-/issues/20167). +* Compiler warning for ui/tap-rtp-common.c (ignoring return value) [Issue 20169](https://gitlab.com/wireshark/wireshark/-/issues/20169). +* SIP dissector bug due to "be-route" param in VIA header. [Issue 20173](https://gitlab.com/wireshark/wireshark/-/issues/20173). +* Coredump after trying to open 'Follow TCP stream' [Issue 20174](https://gitlab.com/wireshark/wireshark/-/issues/20174). +* Protobuf JSON mapping error. [Issue 20182](https://gitlab.com/wireshark/wireshark/-/issues/20182). +* Display filter "!stp.pvst.origvlan in { vlan.id }" causes a crash (Version 4.4.1) [Issue 20183](https://gitlab.com/wireshark/wireshark/-/issues/20183). +* Extcap plugins shipped with Wireshark Portable are not found in version 4.4.1. [Issue 20184](https://gitlab.com/wireshark/wireshark/-/issues/20184). +* IEEE 802.11be: Wrong regulatory info in HE Operation IE in Beacon frame. [Issue 20187](https://gitlab.com/wireshark/wireshark/-/issues/20187). +* Wireshark 4.4.1 does not decode RTCP packets. [Issue 20188](https://gitlab.com/wireshark/wireshark/-/issues/20188). +* Qt: Display filter sub-menu can only be opened on the triangle, not the full name. [Issue 20190](https://gitlab.com/wireshark/wireshark/-/issues/20190). +* Qt: Changing the display filter does not update the Conversations or Endpoints dialogs. [Issue 20191](https://gitlab.com/wireshark/wireshark/-/issues/20191). +* MODBUS Dissector bug. [Issue 20192](https://gitlab.com/wireshark/wireshark/-/issues/20192). +* Modbus dissector bug - Field Occurence and Layer Operator modbus.bitval field. [Issue 20193](https://gitlab.com/wireshark/wireshark/-/issues/20193). +* Wireshark crashes when a field is dragged from packet details towards the find input. [Issue 20204](https://gitlab.com/wireshark/wireshark/-/issues/20204). +* Lua DissectorTable("") : set ("10,11") unexpected behavior in locales with comma as decimal separator. [Issue 20216](https://gitlab.com/wireshark/wireshark/-/issues/20216). + +The TCP dissector no longer falls back to using the client port as a criterion for selecting a payload dissector when the server port does not select a payload dissector (except for port 20, active FTP). +This behavior can be changed using the "Client port dissectors" preference. + +Display filters now correctly handle floating point conversion errors. + +The Lua API now has better support for comma-separated ranges in different locales. + +Wireshark 4.4.1 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.1.html) +for details: + +* [wnpa-sec-2024-12](https://www.wireshark.org/security/wnpa-sec-2024-12) + ITS dissector crash. + [Issue 20026](https://gitlab.com/wireshark/wireshark/-/issues/20026). +* [wnpa-sec-2024-13](https://www.wireshark.org/security/wnpa-sec-2024-13) + AppleTalk and RELOAD Framing dissector crashes. + [Issue 20114](https://gitlab.com/wireshark/wireshark/-/issues/20114). +* Refresh interface during live-capture leads to corrupt interface handling. [Issue 11176](https://gitlab.com/wireshark/wireshark/-/issues/11176). +* Media type "application/octet-stream" registered for both Thread and UASIP. [Issue 14729](https://gitlab.com/wireshark/wireshark/-/issues/14729). +* Extcap toolbar stops working when new interface is added. [Issue 19854](https://gitlab.com/wireshark/wireshark/-/issues/19854). +* Decoding error ITS CPM version 2.1.1. [Issue 19886](https://gitlab.com/wireshark/wireshark/-/issues/19886). +* Build error in 4.3.0: sync\_pipe\_run\_command\_actual error: argument 2 is null but the corresponding size argument 3 value is 512004 [-Werror=nonnull] [Issue 19930](https://gitlab.com/wireshark/wireshark/-/issues/19930). +* html2text.py doesn’t handle the `` tag. [Issue 20020](https://gitlab.com/wireshark/wireshark/-/issues/20020). +* Incorrect NetFlow v8 TOS AS aggregation dissection. [Issue 20021](https://gitlab.com/wireshark/wireshark/-/issues/20021). +* The Windows packages don’t ship with the IP address plugin. [Issue 20030](https://gitlab.com/wireshark/wireshark/-/issues/20030). +* O\_PATH is Linux-and-FreeBSD-specific. [Issue 20031](https://gitlab.com/wireshark/wireshark/-/issues/20031). +* Wireshark 4.4.0 doesn’t install USBcap USBcapCMD.exe in the correct directory. [Issue 20040](https://gitlab.com/wireshark/wireshark/-/issues/20040). +* OER dissector is not considering the preamble if ASN.1 SEQUENCE definition includes extension marker but no OPTIONAL items. [Issue 20044](https://gitlab.com/wireshark/wireshark/-/issues/20044). +* Bluetooth classic L2CAP incorrect dissection with connectionless reception channel. [Issue 20047](https://gitlab.com/wireshark/wireshark/-/issues/20047). +* Profile auto switch filters : Grayed Display Filter Expression dialog box when opened from Configuration Profiles dialog box. [Issue 20049](https://gitlab.com/wireshark/wireshark/-/issues/20049). +* Wireshark 4.4.0 / macOS 14.6.1 wifi if monitor mode. [Issue 20051](https://gitlab.com/wireshark/wireshark/-/issues/20051). +* TECMP Data Type passes too much data to sub dissectors. [Issue 20052](https://gitlab.com/wireshark/wireshark/-/issues/20052). +* Wireshark and tshark 4.4.0 ignore extcap options specified on the command line. [Issue 20054](https://gitlab.com/wireshark/wireshark/-/issues/20054). +* Cannot open release notes due to incorrect path with duplicated directory components. [Issue 20055](https://gitlab.com/wireshark/wireshark/-/issues/20055). +* Unable to open "Release Notes" from the "Help" menu. [Issue 20056](https://gitlab.com/wireshark/wireshark/-/issues/20056). +* No capture interfaces if Wireshark is started from command line with certain paths. [Issue 20057](https://gitlab.com/wireshark/wireshark/-/issues/20057). +* Wireshark 4.4.0 extcap path change breaks third party extcap installers. [Issue 20069](https://gitlab.com/wireshark/wireshark/-/issues/20069). +* Fuzz job UTF-8 encoding issue: fuzz-2024-09-10-7618.pcap. [Issue 20071](https://gitlab.com/wireshark/wireshark/-/issues/20071). +* Unable to create larger files than 99 size units. [Issue 20079](https://gitlab.com/wireshark/wireshark/-/issues/20079). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PRP trailer not shown for L2 IEC 61850 GOOSE packets in 4.4.0 (was working in 4.2.7) [Issue 20088](https://gitlab.com/wireshark/wireshark/-/issues/20088). +* GUI lags because NetworkManager keeps turning 802.11 monitor mode off. [Issue 20090](https://gitlab.com/wireshark/wireshark/-/issues/20090). +* Error while getting Bluetooth application process id by [Issue 20100](https://gitlab.com/wireshark/wireshark/-/issues/20100). +* Fuzz job assertion: randpkt-2024-10-05-7200.pcap. [Issue 20110](https://gitlab.com/wireshark/wireshark/-/issues/20110). + +Wireshark 4.4.0 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.0.html) +for details: + +Many improvements and fixes to the graphing dialogs, including +I/O Graphs, Flow Graph / VoIP Calls, and TCP Stream Graphs. + +Wireshark now supports automatic profile switching. +You can associate a display filter with a configuration profile, and when you open a capture file that matches the filter, Wireshark will automatically switch to that profile. + +Support for Lua 5.3 and 5.4 has been added, and support for Lua 5.1 and 5.2 has been removed. +The Windows and macOS installers now ship with Lua 5.4.6. + +Improved display filter support for value strings (optional string representations for numeric fields). + +Display filter functions can be implemented as plugins, similar to protocol dissectors and file parsers. + +Display filters can be translated to pcap filters using **Edit** **›** **Copy** **›** **Display filter as pcap filter** if each display filter field has a corresponding pcap filter equivalent. + +Custom columns can be defined using any valid field expression, such as +display filter functions, packet slices, arithmetic calculations, logical tests, +raw byte addressing, and protocol layer modifiers. + +Custom output fields for `tshark -e` can also be defined using any +valid field expression. + +Wireshark can be built with the zlib-ng instead of zlib for compressed file support. +Zlib-ng is substantially faster than zlib. +The official Windows and macOS packages include this feature. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on [the mailing list site](https://lists.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +Official Wireshark training and certification are available from +[the Wireshark Foundation](https://www.wireshark.org/certifications). + +## Getting Certified + +You can become a Wireshark Certified Analyst! +Learn more at + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_4413.md b/corpus/changelog/wireshark_releases/wireshark_4413.md new file mode 100644 index 0000000000000000000000000000000000000000..d36a24680ca294e36188c10317a63f2fb73fc26b --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_4413.md @@ -0,0 +1,377 @@ +# Wireshark 4.4.13 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.4.13.html +Version: 4.4.13 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work! +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2026-01](https://www.wireshark.org/security/wnpa-sec-2026-01) + BLF file parser crash. + [Issue 20880](https://gitlab.com/wireshark/wireshark/-/issues/20880). +* [wnpa-sec-2026-02](https://www.wireshark.org/security/wnpa-sec-2026-02) + IEEE 802.11 dissector crash. + [Issue 20939](https://gitlab.com/wireshark/wireshark/-/issues/20939). +* [wnpa-sec-2026-03](https://www.wireshark.org/security/wnpa-sec-2026-03) + SOME/IP-SD dissector crash. + [Issue 20945](https://gitlab.com/wireshark/wireshark/-/issues/20945). + +The following bugs have been fixed: + +* Bug in decoding 5G NAS message - Extended CAG information list IE. [Issue 20946](https://gitlab.com/wireshark/wireshark/-/issues/20946). + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +DCT2000, H.248, H.265, IDN, IEEE 802.11, NAS-5GS, QUIC, SOME/IP-SD, and Thrift + +### New and Updated Capture File Support + +BLF, NetScreen, and Viavi Observer + +### New and Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +Wireshark 4.4.12 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.12.html) +for details: + +* [wnpa-sec-2025-07](https://www.wireshark.org/security/wnpa-sec-2025-07) + HTTP3 dissector crash. + [Issue 20860](https://gitlab.com/wireshark/wireshark/-/issues/20860). + [CVE-2025-13945](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-13945). +* [wnpa-sec-2025-08](https://www.wireshark.org/security/wnpa-sec-2025-08) + MEGACO dissector infinite loop. + [Issue 20884](https://gitlab.com/wireshark/wireshark/-/issues/20884). + [CVE-2025-13945](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-13945). +* ws\_base32\_decode should be named \*\_encode ? [Issue 20754](https://gitlab.com/wireshark/wireshark/-/issues/20754). +* Stack buffer overflow in wiretap/ber.c (ber\_open) [Issue 20878](https://gitlab.com/wireshark/wireshark/-/issues/20878). +* Fuzz job crash: fuzz-2025-11-30-12266121180.pcap. [Issue 20883](https://gitlab.com/wireshark/wireshark/-/issues/20883). +* Missing data in pinfo→cinfo in HomePlug message CM\_ATTEN\_CHAR.IND. [Issue 20893](https://gitlab.com/wireshark/wireshark/-/issues/20893). + +Wireshark 4.4.11 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.11.html) +for details: + +* [wnpa-sec-2025-06](https://www.wireshark.org/security/wnpa-sec-2025-06) Kafka dissector crash. [Issue 20823](https://gitlab.com/wireshark/wireshark/-/issues/20823). +* L2CAP dissector doesn’t understand retransmission mode. [Issue 2241](https://gitlab.com/wireshark/wireshark/-/issues/2241). +* DNS HIP dissector labels PK algorithm as HIT length. [Issue 20768](https://gitlab.com/wireshark/wireshark/-/issues/20768). +* TLS Abbreviated Handshake Using New Session Ticket. [Issue 20802](https://gitlab.com/wireshark/wireshark/-/issues/20802). +* Apply As Filter for field with FT\_NONE and BASE\_NONE for a single byte does not use the hex value. [Issue 20818](https://gitlab.com/wireshark/wireshark/-/issues/20818). +* TCP dissector creates invalid packet diagram. [Issue 20820](https://gitlab.com/wireshark/wireshark/-/issues/20820). +* Support UTF-16 strings in the IsoBus dissector for the string operations. [Issue 20845](https://gitlab.com/wireshark/wireshark/-/issues/20845). +* Fuzz job issue: fuzz-2025-11-12-12064814316.pcap. [Issue 20852](https://gitlab.com/wireshark/wireshark/-/issues/20852). + +Wireshark 4.4.10 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.10.html) +for details: + +* Using wslog parameters in command line applications leads to freeing invalid memory. [Issue 20500](https://gitlab.com/wireshark/wireshark/-/issues/20500). +* On macOS a lower resolution Wireshark icon is displayed in the App Switcher and Launchpad. sbug<20544>. +* Fuzz job crash: fuzz-2025-08-06-10932469456.pcap. [Issue 20666](https://gitlab.com/wireshark/wireshark/-/issues/20666). +* Encoding on NAS5GS- NASDL Transport Message-Multiple Container contains inconsistencies. wsbuglink:20679]. +* Bad resolver in Delegated Credential (RFC 9345) of TLS 1.3 CertificateRequest message. wsbuglink:20728]. +* Fuzz job UTF-8 encoding issue: fuzz-2025-10-03-11586692659.pcap. [Issue 20744](https://gitlab.com/wireshark/wireshark/-/issues/20744). + +Wireshark 4.4.9 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.9.html) +for details: + +* RDM Product Detail List ID Disect incorrect. [Issue 20612](https://gitlab.com/wireshark/wireshark/-/issues/20612). +* SCCP LUDT segmentation decoding fails. [Issue 20647](https://gitlab.com/wireshark/wireshark/-/issues/20647). +* Ciscodump fails to start capture on Cisco IOS. [Issue 20655](https://gitlab.com/wireshark/wireshark/-/issues/20655). +* [BACnet] WritePropertyMultiple closing context tag 1 not showing. [Issue 20665](https://gitlab.com/wireshark/wireshark/-/issues/20665). +* Bug in LZ77 decoder; reads a 16-bit length when it should read a 32-bit length. [Issue 20671](https://gitlab.com/wireshark/wireshark/-/issues/20671). + +Wireshark 4.4.8 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.8.html) +for details: + +* Renegotiated DTLS session is not being decrypted. [Issue 20362](https://gitlab.com/wireshark/wireshark/-/issues/20362). +* Wireshark is completely stuck in initialization because androiddump recv() is blocked. [Issue 20526](https://gitlab.com/wireshark/wireshark/-/issues/20526). +* Fuzz job UTF-8 encoding issue: fuzz-2025-06-20-7318.pcap. [Issue 20585](https://gitlab.com/wireshark/wireshark/-/issues/20585). +* Crash when showing packet in new window after reloading Lua plugins with a certain gui.column.format preference. [Issue 20588](https://gitlab.com/wireshark/wireshark/-/issues/20588). +* Bug in UDS dissector with Service ReadDataByPeriodicIdentifier Response. [Issue 20589](https://gitlab.com/wireshark/wireshark/-/issues/20589). +* Packet diagram doesn’t show non-standard field value representations. [Issue 20590](https://gitlab.com/wireshark/wireshark/-/issues/20590). +* Packet diagram shows representation twice when field type is FT\_NONE. [Issue 20601](https://gitlab.com/wireshark/wireshark/-/issues/20601). +* application/x-www-form-urlencoded key parsed incorrectly following a name-value byte sequence with no '=' [Issue 20615](https://gitlab.com/wireshark/wireshark/-/issues/20615). +* DNP3 time stamp was unable to work after epoch time(year 2038) [Issue 20618](https://gitlab.com/wireshark/wireshark/-/issues/20618). + +Wireshark 4.4.7 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.7.html) +for details: + +* [wnpa-sec-2025-02](https://www.wireshark.org/security/wnpa-sec-2025-02) + Dissection engine crash. + [Issue 20509](https://gitlab.com/wireshark/wireshark/-/issues/20509). + [CVE-2025-5601](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-5601). +* Wireshark does not correctly decode LIN "go to sleep" in TECMP and CMP. [Issue 20463](https://gitlab.com/wireshark/wireshark/-/issues/20463). +* Dissector bug, Protocol CIGI. [Issue 20496](https://gitlab.com/wireshark/wireshark/-/issues/20496). +* Green power packets are not dissected when proto\_version == ZBEE\_VERSION\_GREEN\_POWER. [Issue 20497](https://gitlab.com/wireshark/wireshark/-/issues/20497). +* Packet diagrams misalign or drop bitfields. [Issue 20507](https://gitlab.com/wireshark/wireshark/-/issues/20507). +* Corruption when setting heuristic dissector table UI name from Lua. [Issue 20523](https://gitlab.com/wireshark/wireshark/-/issues/20523). +* LDAP dissector incorrectly displays filters with singleton "&" [Issue 20527](https://gitlab.com/wireshark/wireshark/-/issues/20527). +* WebSocket per-message compression extentions: fail to decompress server messages (from the 2nd) due to parameter handling. [Issue 20531](https://gitlab.com/wireshark/wireshark/-/issues/20531). +* The LL\_PERIODIC\_SYNC\_WR\_IND packet is not properly dissected (packet-btle.c) [Issue 20554](https://gitlab.com/wireshark/wireshark/-/issues/20554). + +Wireshark 4.4.6 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.6.html) +for details: + +* Bug in EtherCAT dissector with ECS order. [Issue 13718](https://gitlab.com/wireshark/wireshark/-/issues/13718). +* Conversation dialog columns return to default width on each new packet in live capture. [Issue 15978](https://gitlab.com/wireshark/wireshark/-/issues/15978). +* Tests fail in LTO-enabled builds in Ubuntu/Debian. [Issue 18216](https://gitlab.com/wireshark/wireshark/-/issues/18216). +* Incorrect conditions in BFCP dissector. [Issue 18717](https://gitlab.com/wireshark/wireshark/-/issues/18717). +* Static build fails on Ubuntu 24.04 because the c-ares library isn’t found. [Issue 20343](https://gitlab.com/wireshark/wireshark/-/issues/20343). +* Flutter’s Image Picker Generated JPEG Files Detected as Malformed Packet. [Issue 20355](https://gitlab.com/wireshark/wireshark/-/issues/20355). +* QUIC dissector breaks when src and dst change. [Issue 20371](https://gitlab.com/wireshark/wireshark/-/issues/20371). +* s390x: build fail on Ubuntu PPA nighty build. [Issue 20372](https://gitlab.com/wireshark/wireshark/-/issues/20372). +* Trailing octet after IPv4 packet end is not detected or displayed in raw bytes. [Issue 20423](https://gitlab.com/wireshark/wireshark/-/issues/20423). +* [packet-ax25-nol3.c] Only call APRS dissector on UI Frames. [Issue 20429](https://gitlab.com/wireshark/wireshark/-/issues/20429). +* Wireshark hangs when refreshing interfaces with the debug console preference set to "always" and a file open (Windows) [Issue 20434](https://gitlab.com/wireshark/wireshark/-/issues/20434). +* BGP EVPN - Type-8 route not correctly read after addition of Max. Response Time field. [Issue 20459](https://gitlab.com/wireshark/wireshark/-/issues/20459). +* Wireshark does not correctly decode LIN "go to sleep" in TECMP and CMP. [Issue 20463](https://gitlab.com/wireshark/wireshark/-/issues/20463). +* MQTT-SN: WILLTOPIC message not decoded correctly (missing some flags) [Issue 20476](https://gitlab.com/wireshark/wireshark/-/issues/20476). + +Wireshark 4.4.5 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.5.html) +for details: + +* GRPC: protobuf\_json only displays the truncated string value. [Issue 20392](https://gitlab.com/wireshark/wireshark/-/issues/20392). +* Wireshark crashes when clicking on a column title/header. [Issue 20403](https://gitlab.com/wireshark/wireshark/-/issues/20403). + +Wireshark 4.4.4 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.4.html) +for details: + +* [wnpa-sec-2025-01](https://www.wireshark.org/security/wnpa-sec-2025-01) + Bundle Protocol and CBOR dissector {crash,infinite loop,memory leak}. + [Issue 20373](https://gitlab.com/wireshark/wireshark/-/issues/20373). +* Crash when sorting columns during capture with display filter active. [Issue 20263](https://gitlab.com/wireshark/wireshark/-/issues/20263). +* OSS-Fuzz 384757274: Invalid-bool-value in dissect\_tcp. [Issue 20300](https://gitlab.com/wireshark/wireshark/-/issues/20300). +* Test failure in 4.4.2/4.4.3: test\_sharkd\_req\_follow\_http2. [Issue 20330](https://gitlab.com/wireshark/wireshark/-/issues/20330). +* Regression in extcap interface toolbar. [Issue 20354](https://gitlab.com/wireshark/wireshark/-/issues/20354). +* Clicking outside columns in TCP tab of Statistics → Conversations window causes crash. [Issue 20357](https://gitlab.com/wireshark/wireshark/-/issues/20357). +* FTBFS with Ubuntu development (25.04) release. [Issue 20359](https://gitlab.com/wireshark/wireshark/-/issues/20359). +* DNS enable\_qname\_stats crash Wireshark when QDCOUNT == 0. [Issue 20367](https://gitlab.com/wireshark/wireshark/-/issues/20367). +* Windows: Android extcap plugin fails with "Broken socket connection" if there are no new packets for 2sec. [Issue 20386](https://gitlab.com/wireshark/wireshark/-/issues/20386). +* TECMP: Calculation of lifecycle start in Status message is wrong. [Issue 20387](https://gitlab.com/wireshark/wireshark/-/issues/20387). +* MQTT v5.0 properties total length presentation is incorrect. [Issue 20389](https://gitlab.com/wireshark/wireshark/-/issues/20389). +* TShark doesn’t resolve addresses in custom "hosts" files. [Issue 20391](https://gitlab.com/wireshark/wireshark/-/issues/20391). +* Incorrect JA4 fingerprint with empty ciphers. [Issue 20394](https://gitlab.com/wireshark/wireshark/-/issues/20394). + +Wireshark 4.4.3 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.3.html) +for details: + +* Potential mis-match in GSM MAP dissector for uncertainty radius and its filter key. [Issue 20247](https://gitlab.com/wireshark/wireshark/-/issues/20247). +* Macro eNodeB ID and Extended Macro eNodeB ID not decoded by User Location Information. [Issue 20276](https://gitlab.com/wireshark/wireshark/-/issues/20276). +* The NFSv2 Dissector appears to be swapping Character Special File and Directory in mode decoding. [Issue 20290](https://gitlab.com/wireshark/wireshark/-/issues/20290). +* CMake discovers Strawberry Perl’s zlib DLL when it shouldn’t. [Issue 20304](https://gitlab.com/wireshark/wireshark/-/issues/20304). +* VOIP Calls call flow displaying hours. [Issue 20311](https://gitlab.com/wireshark/wireshark/-/issues/20311). +* Fuzz job issue: fuzz-2024-12-26-7898.pcap. [Issue 20313](https://gitlab.com/wireshark/wireshark/-/issues/20313). +* sFlow: Incorrect length passed to header sample dissector. [Issue 20320](https://gitlab.com/wireshark/wireshark/-/issues/20320). +* wsutil: Should link against -lm due to missing fabs() when built with -fno-builtin. [Issue 20326](https://gitlab.com/wireshark/wireshark/-/issues/20326). + +Wireshark 4.4.2 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.2.html) +for details: + +* [wnpa-sec-2024-14](https://www.wireshark.org/security/wnpa-sec-2024-14) + FiveCo RAP dissector infinite loop. + [Issue 20176](https://gitlab.com/wireshark/wireshark/-/issues/20176). +* [wnpa-sec-2024-15](https://www.wireshark.org/security/wnpa-sec-2024-15) + ECMP dissector crash. + [Issue 20214](https://gitlab.com/wireshark/wireshark/-/issues/20214). +* CIP I/O is not detected by "enip" filter anymore. [Issue 19517](https://gitlab.com/wireshark/wireshark/-/issues/19517). +* Fuzz job issue: fuzz-2024-09-03-7550.pcap. [Issue 20041](https://gitlab.com/wireshark/wireshark/-/issues/20041). +* OSS-Fuzz 71476: wireshark:fuzzshark\_ip\_proto-udp: Index-out-of-bounds in DOFObjectID\_Create\_Unmarshal. [Issue 20065](https://gitlab.com/wireshark/wireshark/-/issues/20065). +* JA4\_c hashes an empty field to e3b0c44298fc when it should be 000000000000. [Issue 20066](https://gitlab.com/wireshark/wireshark/-/issues/20066). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PTP analysis loses track of message associations in case of sequence number resets. [Issue 20099](https://gitlab.com/wireshark/wireshark/-/issues/20099). +* USB CCID: response packet in case SetParameters command is unsupported is flagged as malformed. [Issue 20107](https://gitlab.com/wireshark/wireshark/-/issues/20107). +* dumpcap crashes when run from TShark with a capture filter. [Issue 20108](https://gitlab.com/wireshark/wireshark/-/issues/20108). +* SRT dissector: The StreamID (SID) in the handshake extension is displayed without regarding the control characters and with NUL as terminating. [Issue 20113](https://gitlab.com/wireshark/wireshark/-/issues/20113). +* Ghost error message on POP3 packets. [Issue 20124](https://gitlab.com/wireshark/wireshark/-/issues/20124). +* Building against c-ares 1.34 fails. [Issue 20125](https://gitlab.com/wireshark/wireshark/-/issues/20125). +* D-Bus is not optional anymore. [Issue 20126](https://gitlab.com/wireshark/wireshark/-/issues/20126). +* macOS Intel DMGs aren’t fully notarized. [Issue 20129](https://gitlab.com/wireshark/wireshark/-/issues/20129). +* Incorrect name for MLD Capabilities and Operations Present flag in dissection of MLD Capabilities for MLO wifi-7 capture. [Issue 20134](https://gitlab.com/wireshark/wireshark/-/issues/20134). +* CQL Malformed Packet v4 S → C Type RESULT: Prepared[Malformed Packet] [Issue 20142](https://gitlab.com/wireshark/wireshark/-/issues/20142). +* Wi-Fi: 256 Block Ack (BA) is not parsed properly. [Issue 20156](https://gitlab.com/wireshark/wireshark/-/issues/20156). +* BACnet ReadPropertyMultiple request Maximum allowed recursion depth reached. [Issue 20159](https://gitlab.com/wireshark/wireshark/-/issues/20159). +* Statistics→I/O Graph crashes when using simple moving average. [Issue 20163](https://gitlab.com/wireshark/wireshark/-/issues/20163). +* HTTP2 body decompression fails on DATA with a single padded frame. [Issue 20167](https://gitlab.com/wireshark/wireshark/-/issues/20167). +* Compiler warning for ui/tap-rtp-common.c (ignoring return value) [Issue 20169](https://gitlab.com/wireshark/wireshark/-/issues/20169). +* SIP dissector bug due to "be-route" param in VIA header. [Issue 20173](https://gitlab.com/wireshark/wireshark/-/issues/20173). +* Coredump after trying to open 'Follow TCP stream' [Issue 20174](https://gitlab.com/wireshark/wireshark/-/issues/20174). +* Protobuf JSON mapping error. [Issue 20182](https://gitlab.com/wireshark/wireshark/-/issues/20182). +* Display filter "!stp.pvst.origvlan in { vlan.id }" causes a crash (Version 4.4.1) [Issue 20183](https://gitlab.com/wireshark/wireshark/-/issues/20183). +* Extcap plugins shipped with Wireshark Portable are not found in version 4.4.1. [Issue 20184](https://gitlab.com/wireshark/wireshark/-/issues/20184). +* IEEE 802.11be: Wrong regulatory info in HE Operation IE in Beacon frame. [Issue 20187](https://gitlab.com/wireshark/wireshark/-/issues/20187). +* Wireshark 4.4.1 does not decode RTCP packets. [Issue 20188](https://gitlab.com/wireshark/wireshark/-/issues/20188). +* Qt: Display filter sub-menu can only be opened on the triangle, not the full name. [Issue 20190](https://gitlab.com/wireshark/wireshark/-/issues/20190). +* Qt: Changing the display filter does not update the Conversations or Endpoints dialogs. [Issue 20191](https://gitlab.com/wireshark/wireshark/-/issues/20191). +* MODBUS Dissector bug. [Issue 20192](https://gitlab.com/wireshark/wireshark/-/issues/20192). +* Modbus dissector bug - Field Occurence and Layer Operator modbus.bitval field. [Issue 20193](https://gitlab.com/wireshark/wireshark/-/issues/20193). +* Wireshark crashes when a field is dragged from packet details towards the find input. [Issue 20204](https://gitlab.com/wireshark/wireshark/-/issues/20204). +* Lua DissectorTable("") : set ("10,11") unexpected behavior in locales with comma as decimal separator. [Issue 20216](https://gitlab.com/wireshark/wireshark/-/issues/20216). + +The TCP dissector no longer falls back to using the client port as a criterion for selecting a payload dissector when the server port does not select a payload dissector (except for port 20, active FTP). +This behavior can be changed using the "Client port dissectors" preference. + +Display filters now correctly handle floating point conversion errors. + +The Lua API now has better support for comma-separated ranges in different locales. + +Wireshark 4.4.1 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.1.html) +for details: + +* [wnpa-sec-2024-12](https://www.wireshark.org/security/wnpa-sec-2024-12) + ITS dissector crash. + [Issue 20026](https://gitlab.com/wireshark/wireshark/-/issues/20026). +* [wnpa-sec-2024-13](https://www.wireshark.org/security/wnpa-sec-2024-13) + AppleTalk and RELOAD Framing dissector crashes. + [Issue 20114](https://gitlab.com/wireshark/wireshark/-/issues/20114). +* Refresh interface during live-capture leads to corrupt interface handling. [Issue 11176](https://gitlab.com/wireshark/wireshark/-/issues/11176). +* Media type "application/octet-stream" registered for both Thread and UASIP. [Issue 14729](https://gitlab.com/wireshark/wireshark/-/issues/14729). +* Extcap toolbar stops working when new interface is added. [Issue 19854](https://gitlab.com/wireshark/wireshark/-/issues/19854). +* Decoding error ITS CPM version 2.1.1. [Issue 19886](https://gitlab.com/wireshark/wireshark/-/issues/19886). +* Build error in 4.3.0: sync\_pipe\_run\_command\_actual error: argument 2 is null but the corresponding size argument 3 value is 512004 [-Werror=nonnull] [Issue 19930](https://gitlab.com/wireshark/wireshark/-/issues/19930). +* html2text.py doesn’t handle the `` tag. [Issue 20020](https://gitlab.com/wireshark/wireshark/-/issues/20020). +* Incorrect NetFlow v8 TOS AS aggregation dissection. [Issue 20021](https://gitlab.com/wireshark/wireshark/-/issues/20021). +* The Windows packages don’t ship with the IP address plugin. [Issue 20030](https://gitlab.com/wireshark/wireshark/-/issues/20030). +* O\_PATH is Linux-and-FreeBSD-specific. [Issue 20031](https://gitlab.com/wireshark/wireshark/-/issues/20031). +* Wireshark 4.4.0 doesn’t install USBcap USBcapCMD.exe in the correct directory. [Issue 20040](https://gitlab.com/wireshark/wireshark/-/issues/20040). +* OER dissector is not considering the preamble if ASN.1 SEQUENCE definition includes extension marker but no OPTIONAL items. [Issue 20044](https://gitlab.com/wireshark/wireshark/-/issues/20044). +* Bluetooth classic L2CAP incorrect dissection with connectionless reception channel. [Issue 20047](https://gitlab.com/wireshark/wireshark/-/issues/20047). +* Profile auto switch filters : Grayed Display Filter Expression dialog box when opened from Configuration Profiles dialog box. [Issue 20049](https://gitlab.com/wireshark/wireshark/-/issues/20049). +* Wireshark 4.4.0 / macOS 14.6.1 wifi if monitor mode. [Issue 20051](https://gitlab.com/wireshark/wireshark/-/issues/20051). +* TECMP Data Type passes too much data to sub dissectors. [Issue 20052](https://gitlab.com/wireshark/wireshark/-/issues/20052). +* Wireshark and tshark 4.4.0 ignore extcap options specified on the command line. [Issue 20054](https://gitlab.com/wireshark/wireshark/-/issues/20054). +* Cannot open release notes due to incorrect path with duplicated directory components. [Issue 20055](https://gitlab.com/wireshark/wireshark/-/issues/20055). +* Unable to open "Release Notes" from the "Help" menu. [Issue 20056](https://gitlab.com/wireshark/wireshark/-/issues/20056). +* No capture interfaces if Wireshark is started from command line with certain paths. [Issue 20057](https://gitlab.com/wireshark/wireshark/-/issues/20057). +* Wireshark 4.4.0 extcap path change breaks third party extcap installers. [Issue 20069](https://gitlab.com/wireshark/wireshark/-/issues/20069). +* Fuzz job UTF-8 encoding issue: fuzz-2024-09-10-7618.pcap. [Issue 20071](https://gitlab.com/wireshark/wireshark/-/issues/20071). +* Unable to create larger files than 99 size units. [Issue 20079](https://gitlab.com/wireshark/wireshark/-/issues/20079). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PRP trailer not shown for L2 IEC 61850 GOOSE packets in 4.4.0 (was working in 4.2.7) [Issue 20088](https://gitlab.com/wireshark/wireshark/-/issues/20088). +* GUI lags because NetworkManager keeps turning 802.11 monitor mode off. [Issue 20090](https://gitlab.com/wireshark/wireshark/-/issues/20090). +* Error while getting Bluetooth application process id by [Issue 20100](https://gitlab.com/wireshark/wireshark/-/issues/20100). +* Fuzz job assertion: randpkt-2024-10-05-7200.pcap. [Issue 20110](https://gitlab.com/wireshark/wireshark/-/issues/20110). + +Wireshark 4.4.0 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.0.html) +for details: + +Many improvements and fixes to the graphing dialogs, including +I/O Graphs, Flow Graph / VoIP Calls, and TCP Stream Graphs. + +Wireshark now supports automatic profile switching. +You can associate a display filter with a configuration profile, and when you open a capture file that matches the filter, Wireshark will automatically switch to that profile. + +Support for Lua 5.3 and 5.4 has been added, and support for Lua 5.1 and 5.2 has been removed. +The Windows and macOS installers now ship with Lua 5.4.6. + +Improved display filter support for value strings (optional string representations for numeric fields). + +Display filter functions can be implemented as plugins, similar to protocol dissectors and file parsers. + +Display filters can be translated to pcap filters using **Edit** **›** **Copy** **›** **Display filter as pcap filter** if each display filter field has a corresponding pcap filter equivalent. + +Custom columns can be defined using any valid field expression, such as +display filter functions, packet slices, arithmetic calculations, logical tests, +raw byte addressing, and protocol layer modifiers. + +Custom output fields for `tshark -e` can also be defined using any +valid field expression. + +Wireshark can be built with the zlib-ng instead of zlib for compressed file support. +Zlib-ng is substantially faster than zlib. +The official Windows and macOS packages include this feature. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on [the mailing list site](https://lists.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +Official Wireshark training and certification are available from +[the Wireshark Foundation](https://www.wireshark.org/certifications). + +## Getting Certified + +You can become a Wireshark Certified Analyst! +Learn more at + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_442.md b/corpus/changelog/wireshark_releases/wireshark_442.md new file mode 100644 index 0000000000000000000000000000000000000000..4255517b466884025b7e9e92e3c9daa3ed637117 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_442.md @@ -0,0 +1,208 @@ +# Wireshark 4.4.2 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.4.2.html +Version: 4.4.2 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2024-14](https://www.wireshark.org/security/wnpa-sec-2024-14) + FiveCo RAP dissector infinite loop. + [Issue 20176](https://gitlab.com/wireshark/wireshark/-/issues/20176). +* [wnpa-sec-2024-15](https://www.wireshark.org/security/wnpa-sec-2024-15) + ECMP dissector crash. + [Issue 20214](https://gitlab.com/wireshark/wireshark/-/issues/20214). + +The following bugs have been fixed: + +* CIP I/O is not detected by "enip" filter anymore. [Issue 19517](https://gitlab.com/wireshark/wireshark/-/issues/19517). +* Fuzz job issue: fuzz-2024-09-03-7550.pcap. [Issue 20041](https://gitlab.com/wireshark/wireshark/-/issues/20041). +* OSS-Fuzz 71476: wireshark:fuzzshark\_ip\_proto-udp: Index-out-of-bounds in DOFObjectID\_Create\_Unmarshal. [Issue 20065](https://gitlab.com/wireshark/wireshark/-/issues/20065). +* JA4\_c hashes an empty field to e3b0c44298fc when it should be 000000000000. [Issue 20066](https://gitlab.com/wireshark/wireshark/-/issues/20066). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PTP analysis loses track of message associations in case of sequence number resets. [Issue 20099](https://gitlab.com/wireshark/wireshark/-/issues/20099). +* USB CCID: response packet in case SetParameters command is unsupported is flagged as malformed. [Issue 20107](https://gitlab.com/wireshark/wireshark/-/issues/20107). +* dumpcap crashes when run from TShark with a capture filter. [Issue 20108](https://gitlab.com/wireshark/wireshark/-/issues/20108). +* SRT dissector: The StreamID (SID) in the handshake extension is displayed without regarding the control characters and with NUL as terminating. [Issue 20113](https://gitlab.com/wireshark/wireshark/-/issues/20113). +* Ghost error message on POP3 packets. [Issue 20124](https://gitlab.com/wireshark/wireshark/-/issues/20124). +* Building against c-ares 1.34 fails. [Issue 20125](https://gitlab.com/wireshark/wireshark/-/issues/20125). +* D-Bus is not optional anymore. [Issue 20126](https://gitlab.com/wireshark/wireshark/-/issues/20126). +* macOS Intel DMGs aren’t fully notarized. [Issue 20129](https://gitlab.com/wireshark/wireshark/-/issues/20129). +* Incorrect name for MLD Capabilities and Operations Present flag in dissection of MLD Capabilities for MLO wifi-7 capture. [Issue 20134](https://gitlab.com/wireshark/wireshark/-/issues/20134). +* CQL Malformed Packet v4 S → C Type RESULT: Prepared[Malformed Packet] [Issue 20142](https://gitlab.com/wireshark/wireshark/-/issues/20142). +* Wi-Fi: 256 Block Ack (BA) is not parsed properly. [Issue 20156](https://gitlab.com/wireshark/wireshark/-/issues/20156). +* BACnet ReadPropertyMultiple request Maximum allowed recursion depth reached. [Issue 20159](https://gitlab.com/wireshark/wireshark/-/issues/20159). +* Statistics→I/O Graph crashes when using simple moving average. [Issue 20163](https://gitlab.com/wireshark/wireshark/-/issues/20163). +* HTTP2 body decompression fails on DATA with a single padded frame. [Issue 20167](https://gitlab.com/wireshark/wireshark/-/issues/20167). +* Compiler warning for ui/tap-rtp-common.c (ignoring return value) [Issue 20169](https://gitlab.com/wireshark/wireshark/-/issues/20169). +* SIP dissector bug due to "be-route" param in VIA header. [Issue 20173](https://gitlab.com/wireshark/wireshark/-/issues/20173). +* Coredump after trying to open 'Follow TCP stream' [Issue 20174](https://gitlab.com/wireshark/wireshark/-/issues/20174). +* Protobuf JSON mapping error. [Issue 20182](https://gitlab.com/wireshark/wireshark/-/issues/20182). +* Display filter "!stp.pvst.origvlan in { vlan.id }" causes a crash (Version 4.4.1) [Issue 20183](https://gitlab.com/wireshark/wireshark/-/issues/20183). +* Extcap plugins shipped with Wireshark Portable are not found in version 4.4.1. [Issue 20184](https://gitlab.com/wireshark/wireshark/-/issues/20184). +* IEEE 802.11be: Wrong regulatory info in HE Operation IE in Beacon frame. [Issue 20187](https://gitlab.com/wireshark/wireshark/-/issues/20187). +* Wireshark 4.4.1 does not decode RTCP packets. [Issue 20188](https://gitlab.com/wireshark/wireshark/-/issues/20188). +* Qt: Display filter sub-menu can only be opened on the triangle, not the full name. [Issue 20190](https://gitlab.com/wireshark/wireshark/-/issues/20190). +* Qt: Changing the display filter does not update the Conversations or Endpoints dialogs. [Issue 20191](https://gitlab.com/wireshark/wireshark/-/issues/20191). +* MODBUS Dissector bug. [Issue 20192](https://gitlab.com/wireshark/wireshark/-/issues/20192). +* Modbus dissector bug - Field Occurence and Layer Operator modbus.bitval field. [Issue 20193](https://gitlab.com/wireshark/wireshark/-/issues/20193). +* Wireshark crashes when a field is dragged from packet details towards the find input. [Issue 20204](https://gitlab.com/wireshark/wireshark/-/issues/20204). +* Lua DissectorTable("") : set ("10,11") unexpected behavior in locales with comma as decimal separator. [Issue 20216](https://gitlab.com/wireshark/wireshark/-/issues/20216). + +The TCP dissector no longer falls back to using the client port as a criterion for selecting a payload dissector when the server port does not select a payload dissector (except for port 20, active FTP). +This behavior can be changed using the "Client port dissectors" preference. + +Display filters now correctly handle floating point conversion errors. + +The Lua API now has better support for comma-separated ranges in different locales. + +### New and Updated Features + +* The TShark syntax for dumping only fields with a certain prefix has changed + from `-G fields prefix` to `-G fields,prefix`. This allows `tshark -G fields` + to again support also specifying the configuration profile to use. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +ARTNET, ASN.1 PER, BACapp, BT BR/EDR, CQL, DOF, ECMP, ENIP, FiveCo RAP, Frame, FTDI FT, HSRP, HTTP/2, ICMPv6, IEEE 802.11, MBTCP, MMS, MPEG PES, PN-DCP, POP, ProtoBuf, PTP, RPC, RTCP, SIP, SRT, Syslog, TCP, UMTS RLC, USB CCID, Wi-SUN, and ZigBee ZCL + +### New and Updated Capture File Support + +BLF + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +Wireshark 4.4.1 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.1.html) +for details: + +* [wnpa-sec-2024-12](https://www.wireshark.org/security/wnpa-sec-2024-12) + ITS dissector crash. + [Issue 20026](https://gitlab.com/wireshark/wireshark/-/issues/20026). +* [wnpa-sec-2024-13](https://www.wireshark.org/security/wnpa-sec-2024-13) + AppleTalk and RELOAD Framing dissector crashes. + [Issue 20114](https://gitlab.com/wireshark/wireshark/-/issues/20114). +* Refresh interface during live-capture leads to corrupt interface handling. [Issue 11176](https://gitlab.com/wireshark/wireshark/-/issues/11176). +* Media type "application/octet-stream" registered for both Thread and UASIP. [Issue 14729](https://gitlab.com/wireshark/wireshark/-/issues/14729). +* Extcap toolbar stops working when new interface is added. [Issue 19854](https://gitlab.com/wireshark/wireshark/-/issues/19854). +* Decoding error ITS CPM version 2.1.1. [Issue 19886](https://gitlab.com/wireshark/wireshark/-/issues/19886). +* Build error in 4.3.0: sync\_pipe\_run\_command\_actual error: argument 2 is null but the corresponding size argument 3 value is 512004 [-Werror=nonnull] [Issue 19930](https://gitlab.com/wireshark/wireshark/-/issues/19930). +* html2text.py doesn’t handle the `` tag. [Issue 20020](https://gitlab.com/wireshark/wireshark/-/issues/20020). +* Incorrect NetFlow v8 TOS AS aggregation dissection. [Issue 20021](https://gitlab.com/wireshark/wireshark/-/issues/20021). +* The Windows packages don’t ship with the IP address plugin. [Issue 20030](https://gitlab.com/wireshark/wireshark/-/issues/20030). +* O\_PATH is Linux-and-FreeBSD-specific. [Issue 20031](https://gitlab.com/wireshark/wireshark/-/issues/20031). +* Wireshark 4.4.0 doesn’t install USBcap USBcapCMD.exe in the correct directory. [Issue 20040](https://gitlab.com/wireshark/wireshark/-/issues/20040). +* OER dissector is not considering the preamble if ASN.1 SEQUENCE definition includes extension marker but no OPTIONAL items. [Issue 20044](https://gitlab.com/wireshark/wireshark/-/issues/20044). +* Bluetooth classic L2CAP incorrect dissection with connectionless reception channel. [Issue 20047](https://gitlab.com/wireshark/wireshark/-/issues/20047). +* Profile auto switch filters : Grayed Display Filter Expression dialog box when opened from Configuration Profiles dialog box. [Issue 20049](https://gitlab.com/wireshark/wireshark/-/issues/20049). +* Wireshark 4.4.0 / macOS 14.6.1 wifi if monitor mode. [Issue 20051](https://gitlab.com/wireshark/wireshark/-/issues/20051). +* TECMP Data Type passes too much data to sub dissectors. [Issue 20052](https://gitlab.com/wireshark/wireshark/-/issues/20052). +* Wireshark and tshark 4.4.0 ignore extcap options specified on the command line. [Issue 20054](https://gitlab.com/wireshark/wireshark/-/issues/20054). +* Cannot open release notes due to incorrect path with duplicated directory components. [Issue 20055](https://gitlab.com/wireshark/wireshark/-/issues/20055). +* Unable to open "Release Notes" from the "Help" menu. [Issue 20056](https://gitlab.com/wireshark/wireshark/-/issues/20056). +* No capture interfaces if Wireshark is started from command line with certain paths. [Issue 20057](https://gitlab.com/wireshark/wireshark/-/issues/20057). +* Wireshark 4.4.0 extcap path change breaks third party extcap installers. [Issue 20069](https://gitlab.com/wireshark/wireshark/-/issues/20069). +* Fuzz job UTF-8 encoding issue: fuzz-2024-09-10-7618.pcap. [Issue 20071](https://gitlab.com/wireshark/wireshark/-/issues/20071). +* Unable to create larger files than 99 size units. [Issue 20079](https://gitlab.com/wireshark/wireshark/-/issues/20079). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PRP trailer not shown for L2 IEC 61850 GOOSE packets in 4.4.0 (was working in 4.2.7) [Issue 20088](https://gitlab.com/wireshark/wireshark/-/issues/20088). +* GUI lags because NetworkManager keeps turning 802.11 monitor mode off. [Issue 20090](https://gitlab.com/wireshark/wireshark/-/issues/20090). +* Error while getting Bluetooth application process id by [Issue 20100](https://gitlab.com/wireshark/wireshark/-/issues/20100). +* Fuzz job assertion: randpkt-2024-10-05-7200.pcap. [Issue 20110](https://gitlab.com/wireshark/wireshark/-/issues/20110). + +Wireshark 4.4.0 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.0.html) +for details: + +Many improvements and fixes to the graphing dialogs, including +I/O Graphs, Flow Graph / VoIP Calls, and TCP Stream Graphs. + +Wireshark now supports automatic profile switching. +You can associate a display filter with a configuration profile, and when you open a capture file that matches the filter, Wireshark will automatically switch to that profile. + +Support for Lua 5.3 and 5.4 has been added, and support for Lua 5.1 and 5.2 has been removed. +The Windows and macOS installers now ship with Lua 5.4.6. + +Improved display filter support for value strings (optional string representations for numeric fields). + +Display filter functions can be implemented as plugins, similar to protocol dissectors and file parsers. + +Display filters can be translated to pcap filters using **Edit** **›** **Copy** **›** **Display filter as pcap filter** if each display filter field has a corresponding pcap filter equivalent. + +Custom columns can be defined using any valid field expression, such as +display filter functions, packet slices, arithmetic calculations, logical tests, +raw byte addressing, and protocol layer modifiers. + +Custom output fields for `tshark -e` can also be defined using any +valid field expression. + +Wireshark can be built with the zlib-ng instead of zlib for compressed file support. +Zlib-ng is substantially faster than zlib. +The official Windows and macOS packages include this feature. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on [the mailing list site](https://lists.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_443.md b/corpus/changelog/wireshark_releases/wireshark_443.md new file mode 100644 index 0000000000000000000000000000000000000000..d56d06d5030a2b4876c43f2be9bf8c4776a05ef0 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_443.md @@ -0,0 +1,217 @@ +# Wireshark 4.4.3 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.4.3.html +Version: 4.4.3 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +The following bugs have been fixed: + +* Potential mis-match in GSM MAP dissector for uncertainty radius and its filter key. [Issue 20247](https://gitlab.com/wireshark/wireshark/-/issues/20247). +* Macro eNodeB ID and Extended Macro eNodeB ID not decoded by User Location Information. [Issue 20276](https://gitlab.com/wireshark/wireshark/-/issues/20276). +* The NFSv2 Dissector appears to be swapping Character Special File and Directory in mode decoding. [Issue 20290](https://gitlab.com/wireshark/wireshark/-/issues/20290). +* CMake discovers Strawberry Perl’s zlib DLL when it shouldn’t. [Issue 20304](https://gitlab.com/wireshark/wireshark/-/issues/20304). +* VOIP Calls call flow displaying hours. [Issue 20311](https://gitlab.com/wireshark/wireshark/-/issues/20311). +* Fuzz job issue: fuzz-2024-12-26-7898.pcap. [Issue 20313](https://gitlab.com/wireshark/wireshark/-/issues/20313). +* sFlow: Incorrect length passed to header sample dissector. [Issue 20320](https://gitlab.com/wireshark/wireshark/-/issues/20320). +* wsutil: Should link against -lm due to missing fabs() when built with -fno-builtin. [Issue 20326](https://gitlab.com/wireshark/wireshark/-/issues/20326). + +### New and Updated Features + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +ARTNET, ASN.1 PER, BACapp, BBLog, BT BR/EDR RF, CQL, Diameter, DOF, ECMP, FiveCo RAP, FTDI FT, GSM COMMON, GTPv2, HCI\_MON, HSRP, HTTP2, ICMPv6, IEEE 802.11, Kafka, LTE RRC, MBIM, MMS, Modbus/TCP, MPEG PES, NAS-EPS, NFS, NGAP, NR RRC, PLDM, PN-DCP, POP, ProtoBuf, PTP, RLC, RPC, RTCP, sFlow, SIP, SRT, TCP, UCP, USBCCID, Wi-SUN, and ZigBee ZCL + +### New and Updated Capture File Support + +CLLog +EMS +ERF + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +Wireshark 4.4.2 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.2.html) +for details: + +* [wnpa-sec-2024-14](https://www.wireshark.org/security/wnpa-sec-2024-14) + FiveCo RAP dissector infinite loop. + [Issue 20176](https://gitlab.com/wireshark/wireshark/-/issues/20176). +* [wnpa-sec-2024-15](https://www.wireshark.org/security/wnpa-sec-2024-15) + ECMP dissector crash. + [Issue 20214](https://gitlab.com/wireshark/wireshark/-/issues/20214). +* CIP I/O is not detected by "enip" filter anymore. [Issue 19517](https://gitlab.com/wireshark/wireshark/-/issues/19517). +* Fuzz job issue: fuzz-2024-09-03-7550.pcap. [Issue 20041](https://gitlab.com/wireshark/wireshark/-/issues/20041). +* OSS-Fuzz 71476: wireshark:fuzzshark\_ip\_proto-udp: Index-out-of-bounds in DOFObjectID\_Create\_Unmarshal. [Issue 20065](https://gitlab.com/wireshark/wireshark/-/issues/20065). +* JA4\_c hashes an empty field to e3b0c44298fc when it should be 000000000000. [Issue 20066](https://gitlab.com/wireshark/wireshark/-/issues/20066). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PTP analysis loses track of message associations in case of sequence number resets. [Issue 20099](https://gitlab.com/wireshark/wireshark/-/issues/20099). +* USB CCID: response packet in case SetParameters command is unsupported is flagged as malformed. [Issue 20107](https://gitlab.com/wireshark/wireshark/-/issues/20107). +* dumpcap crashes when run from TShark with a capture filter. [Issue 20108](https://gitlab.com/wireshark/wireshark/-/issues/20108). +* SRT dissector: The StreamID (SID) in the handshake extension is displayed without regarding the control characters and with NUL as terminating. [Issue 20113](https://gitlab.com/wireshark/wireshark/-/issues/20113). +* Ghost error message on POP3 packets. [Issue 20124](https://gitlab.com/wireshark/wireshark/-/issues/20124). +* Building against c-ares 1.34 fails. [Issue 20125](https://gitlab.com/wireshark/wireshark/-/issues/20125). +* D-Bus is not optional anymore. [Issue 20126](https://gitlab.com/wireshark/wireshark/-/issues/20126). +* macOS Intel DMGs aren’t fully notarized. [Issue 20129](https://gitlab.com/wireshark/wireshark/-/issues/20129). +* Incorrect name for MLD Capabilities and Operations Present flag in dissection of MLD Capabilities for MLO wifi-7 capture. [Issue 20134](https://gitlab.com/wireshark/wireshark/-/issues/20134). +* CQL Malformed Packet v4 S → C Type RESULT: Prepared[Malformed Packet] [Issue 20142](https://gitlab.com/wireshark/wireshark/-/issues/20142). +* Wi-Fi: 256 Block Ack (BA) is not parsed properly. [Issue 20156](https://gitlab.com/wireshark/wireshark/-/issues/20156). +* BACnet ReadPropertyMultiple request Maximum allowed recursion depth reached. [Issue 20159](https://gitlab.com/wireshark/wireshark/-/issues/20159). +* Statistics→I/O Graph crashes when using simple moving average. [Issue 20163](https://gitlab.com/wireshark/wireshark/-/issues/20163). +* HTTP2 body decompression fails on DATA with a single padded frame. [Issue 20167](https://gitlab.com/wireshark/wireshark/-/issues/20167). +* Compiler warning for ui/tap-rtp-common.c (ignoring return value) [Issue 20169](https://gitlab.com/wireshark/wireshark/-/issues/20169). +* SIP dissector bug due to "be-route" param in VIA header. [Issue 20173](https://gitlab.com/wireshark/wireshark/-/issues/20173). +* Coredump after trying to open 'Follow TCP stream' [Issue 20174](https://gitlab.com/wireshark/wireshark/-/issues/20174). +* Protobuf JSON mapping error. [Issue 20182](https://gitlab.com/wireshark/wireshark/-/issues/20182). +* Display filter "!stp.pvst.origvlan in { vlan.id }" causes a crash (Version 4.4.1) [Issue 20183](https://gitlab.com/wireshark/wireshark/-/issues/20183). +* Extcap plugins shipped with Wireshark Portable are not found in version 4.4.1. [Issue 20184](https://gitlab.com/wireshark/wireshark/-/issues/20184). +* IEEE 802.11be: Wrong regulatory info in HE Operation IE in Beacon frame. [Issue 20187](https://gitlab.com/wireshark/wireshark/-/issues/20187). +* Wireshark 4.4.1 does not decode RTCP packets. [Issue 20188](https://gitlab.com/wireshark/wireshark/-/issues/20188). +* Qt: Display filter sub-menu can only be opened on the triangle, not the full name. [Issue 20190](https://gitlab.com/wireshark/wireshark/-/issues/20190). +* Qt: Changing the display filter does not update the Conversations or Endpoints dialogs. [Issue 20191](https://gitlab.com/wireshark/wireshark/-/issues/20191). +* MODBUS Dissector bug. [Issue 20192](https://gitlab.com/wireshark/wireshark/-/issues/20192). +* Modbus dissector bug - Field Occurence and Layer Operator modbus.bitval field. [Issue 20193](https://gitlab.com/wireshark/wireshark/-/issues/20193). +* Wireshark crashes when a field is dragged from packet details towards the find input. [Issue 20204](https://gitlab.com/wireshark/wireshark/-/issues/20204). +* Lua DissectorTable("") : set ("10,11") unexpected behavior in locales with comma as decimal separator. [Issue 20216](https://gitlab.com/wireshark/wireshark/-/issues/20216). + +The TCP dissector no longer falls back to using the client port as a criterion for selecting a payload dissector when the server port does not select a payload dissector (except for port 20, active FTP). +This behavior can be changed using the "Client port dissectors" preference. + +Display filters now correctly handle floating point conversion errors. + +The Lua API now has better support for comma-separated ranges in different locales. + +Wireshark 4.4.1 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.1.html) +for details: + +* [wnpa-sec-2024-12](https://www.wireshark.org/security/wnpa-sec-2024-12) + ITS dissector crash. + [Issue 20026](https://gitlab.com/wireshark/wireshark/-/issues/20026). +* [wnpa-sec-2024-13](https://www.wireshark.org/security/wnpa-sec-2024-13) + AppleTalk and RELOAD Framing dissector crashes. + [Issue 20114](https://gitlab.com/wireshark/wireshark/-/issues/20114). +* Refresh interface during live-capture leads to corrupt interface handling. [Issue 11176](https://gitlab.com/wireshark/wireshark/-/issues/11176). +* Media type "application/octet-stream" registered for both Thread and UASIP. [Issue 14729](https://gitlab.com/wireshark/wireshark/-/issues/14729). +* Extcap toolbar stops working when new interface is added. [Issue 19854](https://gitlab.com/wireshark/wireshark/-/issues/19854). +* Decoding error ITS CPM version 2.1.1. [Issue 19886](https://gitlab.com/wireshark/wireshark/-/issues/19886). +* Build error in 4.3.0: sync\_pipe\_run\_command\_actual error: argument 2 is null but the corresponding size argument 3 value is 512004 [-Werror=nonnull] [Issue 19930](https://gitlab.com/wireshark/wireshark/-/issues/19930). +* html2text.py doesn’t handle the `` tag. [Issue 20020](https://gitlab.com/wireshark/wireshark/-/issues/20020). +* Incorrect NetFlow v8 TOS AS aggregation dissection. [Issue 20021](https://gitlab.com/wireshark/wireshark/-/issues/20021). +* The Windows packages don’t ship with the IP address plugin. [Issue 20030](https://gitlab.com/wireshark/wireshark/-/issues/20030). +* O\_PATH is Linux-and-FreeBSD-specific. [Issue 20031](https://gitlab.com/wireshark/wireshark/-/issues/20031). +* Wireshark 4.4.0 doesn’t install USBcap USBcapCMD.exe in the correct directory. [Issue 20040](https://gitlab.com/wireshark/wireshark/-/issues/20040). +* OER dissector is not considering the preamble if ASN.1 SEQUENCE definition includes extension marker but no OPTIONAL items. [Issue 20044](https://gitlab.com/wireshark/wireshark/-/issues/20044). +* Bluetooth classic L2CAP incorrect dissection with connectionless reception channel. [Issue 20047](https://gitlab.com/wireshark/wireshark/-/issues/20047). +* Profile auto switch filters : Grayed Display Filter Expression dialog box when opened from Configuration Profiles dialog box. [Issue 20049](https://gitlab.com/wireshark/wireshark/-/issues/20049). +* Wireshark 4.4.0 / macOS 14.6.1 wifi if monitor mode. [Issue 20051](https://gitlab.com/wireshark/wireshark/-/issues/20051). +* TECMP Data Type passes too much data to sub dissectors. [Issue 20052](https://gitlab.com/wireshark/wireshark/-/issues/20052). +* Wireshark and tshark 4.4.0 ignore extcap options specified on the command line. [Issue 20054](https://gitlab.com/wireshark/wireshark/-/issues/20054). +* Cannot open release notes due to incorrect path with duplicated directory components. [Issue 20055](https://gitlab.com/wireshark/wireshark/-/issues/20055). +* Unable to open "Release Notes" from the "Help" menu. [Issue 20056](https://gitlab.com/wireshark/wireshark/-/issues/20056). +* No capture interfaces if Wireshark is started from command line with certain paths. [Issue 20057](https://gitlab.com/wireshark/wireshark/-/issues/20057). +* Wireshark 4.4.0 extcap path change breaks third party extcap installers. [Issue 20069](https://gitlab.com/wireshark/wireshark/-/issues/20069). +* Fuzz job UTF-8 encoding issue: fuzz-2024-09-10-7618.pcap. [Issue 20071](https://gitlab.com/wireshark/wireshark/-/issues/20071). +* Unable to create larger files than 99 size units. [Issue 20079](https://gitlab.com/wireshark/wireshark/-/issues/20079). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PRP trailer not shown for L2 IEC 61850 GOOSE packets in 4.4.0 (was working in 4.2.7) [Issue 20088](https://gitlab.com/wireshark/wireshark/-/issues/20088). +* GUI lags because NetworkManager keeps turning 802.11 monitor mode off. [Issue 20090](https://gitlab.com/wireshark/wireshark/-/issues/20090). +* Error while getting Bluetooth application process id by [Issue 20100](https://gitlab.com/wireshark/wireshark/-/issues/20100). +* Fuzz job assertion: randpkt-2024-10-05-7200.pcap. [Issue 20110](https://gitlab.com/wireshark/wireshark/-/issues/20110). + +Wireshark 4.4.0 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.0.html) +for details: + +Many improvements and fixes to the graphing dialogs, including +I/O Graphs, Flow Graph / VoIP Calls, and TCP Stream Graphs. + +Wireshark now supports automatic profile switching. +You can associate a display filter with a configuration profile, and when you open a capture file that matches the filter, Wireshark will automatically switch to that profile. + +Support for Lua 5.3 and 5.4 has been added, and support for Lua 5.1 and 5.2 has been removed. +The Windows and macOS installers now ship with Lua 5.4.6. + +Improved display filter support for value strings (optional string representations for numeric fields). + +Display filter functions can be implemented as plugins, similar to protocol dissectors and file parsers. + +Display filters can be translated to pcap filters using **Edit** **›** **Copy** **›** **Display filter as pcap filter** if each display filter field has a corresponding pcap filter equivalent. + +Custom columns can be defined using any valid field expression, such as +display filter functions, packet slices, arithmetic calculations, logical tests, +raw byte addressing, and protocol layer modifiers. + +Custom output fields for `tshark -e` can also be defined using any +valid field expression. + +Wireshark can be built with the zlib-ng instead of zlib for compressed file support. +Zlib-ng is substantially faster than zlib. +The official Windows and macOS packages include this feature. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on [the mailing list site](https://lists.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_444.md b/corpus/changelog/wireshark_releases/wireshark_444.md new file mode 100644 index 0000000000000000000000000000000000000000..8898897def979ee30d059ed252b3f10e0878e75c --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_444.md @@ -0,0 +1,239 @@ +# Wireshark 4.4.4 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.4.4.html +Version: 4.4.4 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2025-01](https://www.wireshark.org/security/wnpa-sec-2025-01) + Bundle Protocol and CBOR dissector crash. + [Issue 20373](https://gitlab.com/wireshark/wireshark/-/issues/20373). + +The following bugs have been fixed: + +* Crash when sorting columns during capture with display filter active. [Issue 20263](https://gitlab.com/wireshark/wireshark/-/issues/20263). +* OSS-Fuzz 384757274: Invalid-bool-value in dissect\_tcp. [Issue 20300](https://gitlab.com/wireshark/wireshark/-/issues/20300). +* Test failure in 4.4.2/4.4.3: test\_sharkd\_req\_follow\_http2. [Issue 20330](https://gitlab.com/wireshark/wireshark/-/issues/20330). +* Regression in extcap interface toolbar. [Issue 20354](https://gitlab.com/wireshark/wireshark/-/issues/20354). +* Clicking outside columns in TCP tab of Statistics → Conversations window causes crash. [Issue 20357](https://gitlab.com/wireshark/wireshark/-/issues/20357). +* FTBFS with Ubuntu development (25.04) release. [Issue 20359](https://gitlab.com/wireshark/wireshark/-/issues/20359). +* DNS enable\_qname\_stats crash Wireshark when QDCOUNT == 0. [Issue 20367](https://gitlab.com/wireshark/wireshark/-/issues/20367). +* Windows: Android extcap plugin fails with "Broken socket connection" if there are no new packets for 2sec. [Issue 20386](https://gitlab.com/wireshark/wireshark/-/issues/20386). +* TECMP: Calculation of lifecycle start in Status message is wrong. [Issue 20387](https://gitlab.com/wireshark/wireshark/-/issues/20387). +* MQTT v5.0 properties total length presentation is incorrect. [Issue 20389](https://gitlab.com/wireshark/wireshark/-/issues/20389). +* TShark doesn’t resolve addresses in custom "hosts" files. [Issue 20391](https://gitlab.com/wireshark/wireshark/-/issues/20391). +* Incorrect JA4 fingerprint with empty ciphers. [Issue 20394](https://gitlab.com/wireshark/wireshark/-/issues/20394). + +### New and Updated Features + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +CESoETH, DNS, IEEE 1609.2, ISOBUS, ITS, MPLS, MQTT, PDU Transport, RTP, TCP, TECMP, WebSocket, and WSMP + +### New and Updated Capture File Support + +CLLog, EMS, and ERF + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +Wireshark 4.4.3 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.3.html) +for details: + +* Potential mis-match in GSM MAP dissector for uncertainty radius and its filter key. [Issue 20247](https://gitlab.com/wireshark/wireshark/-/issues/20247). +* Macro eNodeB ID and Extended Macro eNodeB ID not decoded by User Location Information. [Issue 20276](https://gitlab.com/wireshark/wireshark/-/issues/20276). +* The NFSv2 Dissector appears to be swapping Character Special File and Directory in mode decoding. [Issue 20290](https://gitlab.com/wireshark/wireshark/-/issues/20290). +* CMake discovers Strawberry Perl’s zlib DLL when it shouldn’t. [Issue 20304](https://gitlab.com/wireshark/wireshark/-/issues/20304). +* VOIP Calls call flow displaying hours. [Issue 20311](https://gitlab.com/wireshark/wireshark/-/issues/20311). +* Fuzz job issue: fuzz-2024-12-26-7898.pcap. [Issue 20313](https://gitlab.com/wireshark/wireshark/-/issues/20313). +* sFlow: Incorrect length passed to header sample dissector. [Issue 20320](https://gitlab.com/wireshark/wireshark/-/issues/20320). +* wsutil: Should link against -lm due to missing fabs() when built with -fno-builtin. [Issue 20326](https://gitlab.com/wireshark/wireshark/-/issues/20326). + +Wireshark 4.4.2 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.2.html) +for details: + +* [wnpa-sec-2024-14](https://www.wireshark.org/security/wnpa-sec-2024-14) + FiveCo RAP dissector infinite loop. + [Issue 20176](https://gitlab.com/wireshark/wireshark/-/issues/20176). +* [wnpa-sec-2024-15](https://www.wireshark.org/security/wnpa-sec-2024-15) + ECMP dissector crash. + [Issue 20214](https://gitlab.com/wireshark/wireshark/-/issues/20214). +* CIP I/O is not detected by "enip" filter anymore. [Issue 19517](https://gitlab.com/wireshark/wireshark/-/issues/19517). +* Fuzz job issue: fuzz-2024-09-03-7550.pcap. [Issue 20041](https://gitlab.com/wireshark/wireshark/-/issues/20041). +* OSS-Fuzz 71476: wireshark:fuzzshark\_ip\_proto-udp: Index-out-of-bounds in DOFObjectID\_Create\_Unmarshal. [Issue 20065](https://gitlab.com/wireshark/wireshark/-/issues/20065). +* JA4\_c hashes an empty field to e3b0c44298fc when it should be 000000000000. [Issue 20066](https://gitlab.com/wireshark/wireshark/-/issues/20066). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PTP analysis loses track of message associations in case of sequence number resets. [Issue 20099](https://gitlab.com/wireshark/wireshark/-/issues/20099). +* USB CCID: response packet in case SetParameters command is unsupported is flagged as malformed. [Issue 20107](https://gitlab.com/wireshark/wireshark/-/issues/20107). +* dumpcap crashes when run from TShark with a capture filter. [Issue 20108](https://gitlab.com/wireshark/wireshark/-/issues/20108). +* SRT dissector: The StreamID (SID) in the handshake extension is displayed without regarding the control characters and with NUL as terminating. [Issue 20113](https://gitlab.com/wireshark/wireshark/-/issues/20113). +* Ghost error message on POP3 packets. [Issue 20124](https://gitlab.com/wireshark/wireshark/-/issues/20124). +* Building against c-ares 1.34 fails. [Issue 20125](https://gitlab.com/wireshark/wireshark/-/issues/20125). +* D-Bus is not optional anymore. [Issue 20126](https://gitlab.com/wireshark/wireshark/-/issues/20126). +* macOS Intel DMGs aren’t fully notarized. [Issue 20129](https://gitlab.com/wireshark/wireshark/-/issues/20129). +* Incorrect name for MLD Capabilities and Operations Present flag in dissection of MLD Capabilities for MLO wifi-7 capture. [Issue 20134](https://gitlab.com/wireshark/wireshark/-/issues/20134). +* CQL Malformed Packet v4 S → C Type RESULT: Prepared[Malformed Packet] [Issue 20142](https://gitlab.com/wireshark/wireshark/-/issues/20142). +* Wi-Fi: 256 Block Ack (BA) is not parsed properly. [Issue 20156](https://gitlab.com/wireshark/wireshark/-/issues/20156). +* BACnet ReadPropertyMultiple request Maximum allowed recursion depth reached. [Issue 20159](https://gitlab.com/wireshark/wireshark/-/issues/20159). +* Statistics→I/O Graph crashes when using simple moving average. [Issue 20163](https://gitlab.com/wireshark/wireshark/-/issues/20163). +* HTTP2 body decompression fails on DATA with a single padded frame. [Issue 20167](https://gitlab.com/wireshark/wireshark/-/issues/20167). +* Compiler warning for ui/tap-rtp-common.c (ignoring return value) [Issue 20169](https://gitlab.com/wireshark/wireshark/-/issues/20169). +* SIP dissector bug due to "be-route" param in VIA header. [Issue 20173](https://gitlab.com/wireshark/wireshark/-/issues/20173). +* Coredump after trying to open 'Follow TCP stream' [Issue 20174](https://gitlab.com/wireshark/wireshark/-/issues/20174). +* Protobuf JSON mapping error. [Issue 20182](https://gitlab.com/wireshark/wireshark/-/issues/20182). +* Display filter "!stp.pvst.origvlan in { vlan.id }" causes a crash (Version 4.4.1) [Issue 20183](https://gitlab.com/wireshark/wireshark/-/issues/20183). +* Extcap plugins shipped with Wireshark Portable are not found in version 4.4.1. [Issue 20184](https://gitlab.com/wireshark/wireshark/-/issues/20184). +* IEEE 802.11be: Wrong regulatory info in HE Operation IE in Beacon frame. [Issue 20187](https://gitlab.com/wireshark/wireshark/-/issues/20187). +* Wireshark 4.4.1 does not decode RTCP packets. [Issue 20188](https://gitlab.com/wireshark/wireshark/-/issues/20188). +* Qt: Display filter sub-menu can only be opened on the triangle, not the full name. [Issue 20190](https://gitlab.com/wireshark/wireshark/-/issues/20190). +* Qt: Changing the display filter does not update the Conversations or Endpoints dialogs. [Issue 20191](https://gitlab.com/wireshark/wireshark/-/issues/20191). +* MODBUS Dissector bug. [Issue 20192](https://gitlab.com/wireshark/wireshark/-/issues/20192). +* Modbus dissector bug - Field Occurence and Layer Operator modbus.bitval field. [Issue 20193](https://gitlab.com/wireshark/wireshark/-/issues/20193). +* Wireshark crashes when a field is dragged from packet details towards the find input. [Issue 20204](https://gitlab.com/wireshark/wireshark/-/issues/20204). +* Lua DissectorTable("") : set ("10,11") unexpected behavior in locales with comma as decimal separator. [Issue 20216](https://gitlab.com/wireshark/wireshark/-/issues/20216). + +The TCP dissector no longer falls back to using the client port as a criterion for selecting a payload dissector when the server port does not select a payload dissector (except for port 20, active FTP). +This behavior can be changed using the "Client port dissectors" preference. + +Display filters now correctly handle floating point conversion errors. + +The Lua API now has better support for comma-separated ranges in different locales. + +Wireshark 4.4.1 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.1.html) +for details: + +* [wnpa-sec-2024-12](https://www.wireshark.org/security/wnpa-sec-2024-12) + ITS dissector crash. + [Issue 20026](https://gitlab.com/wireshark/wireshark/-/issues/20026). +* [wnpa-sec-2024-13](https://www.wireshark.org/security/wnpa-sec-2024-13) + AppleTalk and RELOAD Framing dissector crashes. + [Issue 20114](https://gitlab.com/wireshark/wireshark/-/issues/20114). +* Refresh interface during live-capture leads to corrupt interface handling. [Issue 11176](https://gitlab.com/wireshark/wireshark/-/issues/11176). +* Media type "application/octet-stream" registered for both Thread and UASIP. [Issue 14729](https://gitlab.com/wireshark/wireshark/-/issues/14729). +* Extcap toolbar stops working when new interface is added. [Issue 19854](https://gitlab.com/wireshark/wireshark/-/issues/19854). +* Decoding error ITS CPM version 2.1.1. [Issue 19886](https://gitlab.com/wireshark/wireshark/-/issues/19886). +* Build error in 4.3.0: sync\_pipe\_run\_command\_actual error: argument 2 is null but the corresponding size argument 3 value is 512004 [-Werror=nonnull] [Issue 19930](https://gitlab.com/wireshark/wireshark/-/issues/19930). +* html2text.py doesn’t handle the `` tag. [Issue 20020](https://gitlab.com/wireshark/wireshark/-/issues/20020). +* Incorrect NetFlow v8 TOS AS aggregation dissection. [Issue 20021](https://gitlab.com/wireshark/wireshark/-/issues/20021). +* The Windows packages don’t ship with the IP address plugin. [Issue 20030](https://gitlab.com/wireshark/wireshark/-/issues/20030). +* O\_PATH is Linux-and-FreeBSD-specific. [Issue 20031](https://gitlab.com/wireshark/wireshark/-/issues/20031). +* Wireshark 4.4.0 doesn’t install USBcap USBcapCMD.exe in the correct directory. [Issue 20040](https://gitlab.com/wireshark/wireshark/-/issues/20040). +* OER dissector is not considering the preamble if ASN.1 SEQUENCE definition includes extension marker but no OPTIONAL items. [Issue 20044](https://gitlab.com/wireshark/wireshark/-/issues/20044). +* Bluetooth classic L2CAP incorrect dissection with connectionless reception channel. [Issue 20047](https://gitlab.com/wireshark/wireshark/-/issues/20047). +* Profile auto switch filters : Grayed Display Filter Expression dialog box when opened from Configuration Profiles dialog box. [Issue 20049](https://gitlab.com/wireshark/wireshark/-/issues/20049). +* Wireshark 4.4.0 / macOS 14.6.1 wifi if monitor mode. [Issue 20051](https://gitlab.com/wireshark/wireshark/-/issues/20051). +* TECMP Data Type passes too much data to sub dissectors. [Issue 20052](https://gitlab.com/wireshark/wireshark/-/issues/20052). +* Wireshark and tshark 4.4.0 ignore extcap options specified on the command line. [Issue 20054](https://gitlab.com/wireshark/wireshark/-/issues/20054). +* Cannot open release notes due to incorrect path with duplicated directory components. [Issue 20055](https://gitlab.com/wireshark/wireshark/-/issues/20055). +* Unable to open "Release Notes" from the "Help" menu. [Issue 20056](https://gitlab.com/wireshark/wireshark/-/issues/20056). +* No capture interfaces if Wireshark is started from command line with certain paths. [Issue 20057](https://gitlab.com/wireshark/wireshark/-/issues/20057). +* Wireshark 4.4.0 extcap path change breaks third party extcap installers. [Issue 20069](https://gitlab.com/wireshark/wireshark/-/issues/20069). +* Fuzz job UTF-8 encoding issue: fuzz-2024-09-10-7618.pcap. [Issue 20071](https://gitlab.com/wireshark/wireshark/-/issues/20071). +* Unable to create larger files than 99 size units. [Issue 20079](https://gitlab.com/wireshark/wireshark/-/issues/20079). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PRP trailer not shown for L2 IEC 61850 GOOSE packets in 4.4.0 (was working in 4.2.7) [Issue 20088](https://gitlab.com/wireshark/wireshark/-/issues/20088). +* GUI lags because NetworkManager keeps turning 802.11 monitor mode off. [Issue 20090](https://gitlab.com/wireshark/wireshark/-/issues/20090). +* Error while getting Bluetooth application process id by [Issue 20100](https://gitlab.com/wireshark/wireshark/-/issues/20100). +* Fuzz job assertion: randpkt-2024-10-05-7200.pcap. [Issue 20110](https://gitlab.com/wireshark/wireshark/-/issues/20110). + +Wireshark 4.4.0 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.0.html) +for details: + +Many improvements and fixes to the graphing dialogs, including +I/O Graphs, Flow Graph / VoIP Calls, and TCP Stream Graphs. + +Wireshark now supports automatic profile switching. +You can associate a display filter with a configuration profile, and when you open a capture file that matches the filter, Wireshark will automatically switch to that profile. + +Support for Lua 5.3 and 5.4 has been added, and support for Lua 5.1 and 5.2 has been removed. +The Windows and macOS installers now ship with Lua 5.4.6. + +Improved display filter support for value strings (optional string representations for numeric fields). + +Display filter functions can be implemented as plugins, similar to protocol dissectors and file parsers. + +Display filters can be translated to pcap filters using **Edit** **›** **Copy** **›** **Display filter as pcap filter** if each display filter field has a corresponding pcap filter equivalent. + +Custom columns can be defined using any valid field expression, such as +display filter functions, packet slices, arithmetic calculations, logical tests, +raw byte addressing, and protocol layer modifiers. + +Custom output fields for `tshark -e` can also be defined using any +valid field expression. + +Wireshark can be built with the zlib-ng instead of zlib for compressed file support. +Zlib-ng is substantially faster than zlib. +The official Windows and macOS packages include this feature. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on [the mailing list site](https://lists.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_445.md b/corpus/changelog/wireshark_releases/wireshark_445.md new file mode 100644 index 0000000000000000000000000000000000000000..3976732c76609153c67a031b0ed504812f767141 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_445.md @@ -0,0 +1,244 @@ +# Wireshark 4.4.5 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.4.5.html +Version: 4.4.5 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work! +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +The following bugs have been fixed: + +* GRPC: protobuf\_json only displays the truncated string value. [Issue 20392](https://gitlab.com/wireshark/wireshark/-/issues/20392). +* Wireshark crashes when clicking on a column title/header. [Issue 20403](https://gitlab.com/wireshark/wireshark/-/issues/20403). + +### New and Updated Features + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +GNW, IPv4, NFAPI, and ProtoBuf + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +Wireshark 4.4.4 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.4.html) +for details: + +* [wnpa-sec-2025-01](https://www.wireshark.org/security/wnpa-sec-2025-01) + Bundle Protocol and CBOR dissector {crash,infinite loop,memory leak}. + [Issue 20373](https://gitlab.com/wireshark/wireshark/-/issues/20373). +* Crash when sorting columns during capture with display filter active. [Issue 20263](https://gitlab.com/wireshark/wireshark/-/issues/20263). +* OSS-Fuzz 384757274: Invalid-bool-value in dissect\_tcp. [Issue 20300](https://gitlab.com/wireshark/wireshark/-/issues/20300). +* Test failure in 4.4.2/4.4.3: test\_sharkd\_req\_follow\_http2. [Issue 20330](https://gitlab.com/wireshark/wireshark/-/issues/20330). +* Regression in extcap interface toolbar. [Issue 20354](https://gitlab.com/wireshark/wireshark/-/issues/20354). +* Clicking outside columns in TCP tab of Statistics → Conversations window causes crash. [Issue 20357](https://gitlab.com/wireshark/wireshark/-/issues/20357). +* FTBFS with Ubuntu development (25.04) release. [Issue 20359](https://gitlab.com/wireshark/wireshark/-/issues/20359). +* DNS enable\_qname\_stats crash Wireshark when QDCOUNT == 0. [Issue 20367](https://gitlab.com/wireshark/wireshark/-/issues/20367). +* Windows: Android extcap plugin fails with "Broken socket connection" if there are no new packets for 2sec. [Issue 20386](https://gitlab.com/wireshark/wireshark/-/issues/20386). +* TECMP: Calculation of lifecycle start in Status message is wrong. [Issue 20387](https://gitlab.com/wireshark/wireshark/-/issues/20387). +* MQTT v5.0 properties total length presentation is incorrect. [Issue 20389](https://gitlab.com/wireshark/wireshark/-/issues/20389). +* TShark doesn’t resolve addresses in custom "hosts" files. [Issue 20391](https://gitlab.com/wireshark/wireshark/-/issues/20391). +* Incorrect JA4 fingerprint with empty ciphers. [Issue 20394](https://gitlab.com/wireshark/wireshark/-/issues/20394). + +Wireshark 4.4.3 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.3.html) +for details: + +* Potential mis-match in GSM MAP dissector for uncertainty radius and its filter key. [Issue 20247](https://gitlab.com/wireshark/wireshark/-/issues/20247). +* Macro eNodeB ID and Extended Macro eNodeB ID not decoded by User Location Information. [Issue 20276](https://gitlab.com/wireshark/wireshark/-/issues/20276). +* The NFSv2 Dissector appears to be swapping Character Special File and Directory in mode decoding. [Issue 20290](https://gitlab.com/wireshark/wireshark/-/issues/20290). +* CMake discovers Strawberry Perl’s zlib DLL when it shouldn’t. [Issue 20304](https://gitlab.com/wireshark/wireshark/-/issues/20304). +* VOIP Calls call flow displaying hours. [Issue 20311](https://gitlab.com/wireshark/wireshark/-/issues/20311). +* Fuzz job issue: fuzz-2024-12-26-7898.pcap. [Issue 20313](https://gitlab.com/wireshark/wireshark/-/issues/20313). +* sFlow: Incorrect length passed to header sample dissector. [Issue 20320](https://gitlab.com/wireshark/wireshark/-/issues/20320). +* wsutil: Should link against -lm due to missing fabs() when built with -fno-builtin. [Issue 20326](https://gitlab.com/wireshark/wireshark/-/issues/20326). + +Wireshark 4.4.2 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.2.html) +for details: + +* [wnpa-sec-2024-14](https://www.wireshark.org/security/wnpa-sec-2024-14) + FiveCo RAP dissector infinite loop. + [Issue 20176](https://gitlab.com/wireshark/wireshark/-/issues/20176). +* [wnpa-sec-2024-15](https://www.wireshark.org/security/wnpa-sec-2024-15) + ECMP dissector crash. + [Issue 20214](https://gitlab.com/wireshark/wireshark/-/issues/20214). +* CIP I/O is not detected by "enip" filter anymore. [Issue 19517](https://gitlab.com/wireshark/wireshark/-/issues/19517). +* Fuzz job issue: fuzz-2024-09-03-7550.pcap. [Issue 20041](https://gitlab.com/wireshark/wireshark/-/issues/20041). +* OSS-Fuzz 71476: wireshark:fuzzshark\_ip\_proto-udp: Index-out-of-bounds in DOFObjectID\_Create\_Unmarshal. [Issue 20065](https://gitlab.com/wireshark/wireshark/-/issues/20065). +* JA4\_c hashes an empty field to e3b0c44298fc when it should be 000000000000. [Issue 20066](https://gitlab.com/wireshark/wireshark/-/issues/20066). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PTP analysis loses track of message associations in case of sequence number resets. [Issue 20099](https://gitlab.com/wireshark/wireshark/-/issues/20099). +* USB CCID: response packet in case SetParameters command is unsupported is flagged as malformed. [Issue 20107](https://gitlab.com/wireshark/wireshark/-/issues/20107). +* dumpcap crashes when run from TShark with a capture filter. [Issue 20108](https://gitlab.com/wireshark/wireshark/-/issues/20108). +* SRT dissector: The StreamID (SID) in the handshake extension is displayed without regarding the control characters and with NUL as terminating. [Issue 20113](https://gitlab.com/wireshark/wireshark/-/issues/20113). +* Ghost error message on POP3 packets. [Issue 20124](https://gitlab.com/wireshark/wireshark/-/issues/20124). +* Building against c-ares 1.34 fails. [Issue 20125](https://gitlab.com/wireshark/wireshark/-/issues/20125). +* D-Bus is not optional anymore. [Issue 20126](https://gitlab.com/wireshark/wireshark/-/issues/20126). +* macOS Intel DMGs aren’t fully notarized. [Issue 20129](https://gitlab.com/wireshark/wireshark/-/issues/20129). +* Incorrect name for MLD Capabilities and Operations Present flag in dissection of MLD Capabilities for MLO wifi-7 capture. [Issue 20134](https://gitlab.com/wireshark/wireshark/-/issues/20134). +* CQL Malformed Packet v4 S → C Type RESULT: Prepared[Malformed Packet] [Issue 20142](https://gitlab.com/wireshark/wireshark/-/issues/20142). +* Wi-Fi: 256 Block Ack (BA) is not parsed properly. [Issue 20156](https://gitlab.com/wireshark/wireshark/-/issues/20156). +* BACnet ReadPropertyMultiple request Maximum allowed recursion depth reached. [Issue 20159](https://gitlab.com/wireshark/wireshark/-/issues/20159). +* Statistics→I/O Graph crashes when using simple moving average. [Issue 20163](https://gitlab.com/wireshark/wireshark/-/issues/20163). +* HTTP2 body decompression fails on DATA with a single padded frame. [Issue 20167](https://gitlab.com/wireshark/wireshark/-/issues/20167). +* Compiler warning for ui/tap-rtp-common.c (ignoring return value) [Issue 20169](https://gitlab.com/wireshark/wireshark/-/issues/20169). +* SIP dissector bug due to "be-route" param in VIA header. [Issue 20173](https://gitlab.com/wireshark/wireshark/-/issues/20173). +* Coredump after trying to open 'Follow TCP stream' [Issue 20174](https://gitlab.com/wireshark/wireshark/-/issues/20174). +* Protobuf JSON mapping error. [Issue 20182](https://gitlab.com/wireshark/wireshark/-/issues/20182). +* Display filter "!stp.pvst.origvlan in { vlan.id }" causes a crash (Version 4.4.1) [Issue 20183](https://gitlab.com/wireshark/wireshark/-/issues/20183). +* Extcap plugins shipped with Wireshark Portable are not found in version 4.4.1. [Issue 20184](https://gitlab.com/wireshark/wireshark/-/issues/20184). +* IEEE 802.11be: Wrong regulatory info in HE Operation IE in Beacon frame. [Issue 20187](https://gitlab.com/wireshark/wireshark/-/issues/20187). +* Wireshark 4.4.1 does not decode RTCP packets. [Issue 20188](https://gitlab.com/wireshark/wireshark/-/issues/20188). +* Qt: Display filter sub-menu can only be opened on the triangle, not the full name. [Issue 20190](https://gitlab.com/wireshark/wireshark/-/issues/20190). +* Qt: Changing the display filter does not update the Conversations or Endpoints dialogs. [Issue 20191](https://gitlab.com/wireshark/wireshark/-/issues/20191). +* MODBUS Dissector bug. [Issue 20192](https://gitlab.com/wireshark/wireshark/-/issues/20192). +* Modbus dissector bug - Field Occurence and Layer Operator modbus.bitval field. [Issue 20193](https://gitlab.com/wireshark/wireshark/-/issues/20193). +* Wireshark crashes when a field is dragged from packet details towards the find input. [Issue 20204](https://gitlab.com/wireshark/wireshark/-/issues/20204). +* Lua DissectorTable("") : set ("10,11") unexpected behavior in locales with comma as decimal separator. [Issue 20216](https://gitlab.com/wireshark/wireshark/-/issues/20216). + +The TCP dissector no longer falls back to using the client port as a criterion for selecting a payload dissector when the server port does not select a payload dissector (except for port 20, active FTP). +This behavior can be changed using the "Client port dissectors" preference. + +Display filters now correctly handle floating point conversion errors. + +The Lua API now has better support for comma-separated ranges in different locales. + +Wireshark 4.4.1 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.1.html) +for details: + +* [wnpa-sec-2024-12](https://www.wireshark.org/security/wnpa-sec-2024-12) + ITS dissector crash. + [Issue 20026](https://gitlab.com/wireshark/wireshark/-/issues/20026). +* [wnpa-sec-2024-13](https://www.wireshark.org/security/wnpa-sec-2024-13) + AppleTalk and RELOAD Framing dissector crashes. + [Issue 20114](https://gitlab.com/wireshark/wireshark/-/issues/20114). +* Refresh interface during live-capture leads to corrupt interface handling. [Issue 11176](https://gitlab.com/wireshark/wireshark/-/issues/11176). +* Media type "application/octet-stream" registered for both Thread and UASIP. [Issue 14729](https://gitlab.com/wireshark/wireshark/-/issues/14729). +* Extcap toolbar stops working when new interface is added. [Issue 19854](https://gitlab.com/wireshark/wireshark/-/issues/19854). +* Decoding error ITS CPM version 2.1.1. [Issue 19886](https://gitlab.com/wireshark/wireshark/-/issues/19886). +* Build error in 4.3.0: sync\_pipe\_run\_command\_actual error: argument 2 is null but the corresponding size argument 3 value is 512004 [-Werror=nonnull] [Issue 19930](https://gitlab.com/wireshark/wireshark/-/issues/19930). +* html2text.py doesn’t handle the `` tag. [Issue 20020](https://gitlab.com/wireshark/wireshark/-/issues/20020). +* Incorrect NetFlow v8 TOS AS aggregation dissection. [Issue 20021](https://gitlab.com/wireshark/wireshark/-/issues/20021). +* The Windows packages don’t ship with the IP address plugin. [Issue 20030](https://gitlab.com/wireshark/wireshark/-/issues/20030). +* O\_PATH is Linux-and-FreeBSD-specific. [Issue 20031](https://gitlab.com/wireshark/wireshark/-/issues/20031). +* Wireshark 4.4.0 doesn’t install USBcap USBcapCMD.exe in the correct directory. [Issue 20040](https://gitlab.com/wireshark/wireshark/-/issues/20040). +* OER dissector is not considering the preamble if ASN.1 SEQUENCE definition includes extension marker but no OPTIONAL items. [Issue 20044](https://gitlab.com/wireshark/wireshark/-/issues/20044). +* Bluetooth classic L2CAP incorrect dissection with connectionless reception channel. [Issue 20047](https://gitlab.com/wireshark/wireshark/-/issues/20047). +* Profile auto switch filters : Grayed Display Filter Expression dialog box when opened from Configuration Profiles dialog box. [Issue 20049](https://gitlab.com/wireshark/wireshark/-/issues/20049). +* Wireshark 4.4.0 / macOS 14.6.1 wifi if monitor mode. [Issue 20051](https://gitlab.com/wireshark/wireshark/-/issues/20051). +* TECMP Data Type passes too much data to sub dissectors. [Issue 20052](https://gitlab.com/wireshark/wireshark/-/issues/20052). +* Wireshark and tshark 4.4.0 ignore extcap options specified on the command line. [Issue 20054](https://gitlab.com/wireshark/wireshark/-/issues/20054). +* Cannot open release notes due to incorrect path with duplicated directory components. [Issue 20055](https://gitlab.com/wireshark/wireshark/-/issues/20055). +* Unable to open "Release Notes" from the "Help" menu. [Issue 20056](https://gitlab.com/wireshark/wireshark/-/issues/20056). +* No capture interfaces if Wireshark is started from command line with certain paths. [Issue 20057](https://gitlab.com/wireshark/wireshark/-/issues/20057). +* Wireshark 4.4.0 extcap path change breaks third party extcap installers. [Issue 20069](https://gitlab.com/wireshark/wireshark/-/issues/20069). +* Fuzz job UTF-8 encoding issue: fuzz-2024-09-10-7618.pcap. [Issue 20071](https://gitlab.com/wireshark/wireshark/-/issues/20071). +* Unable to create larger files than 99 size units. [Issue 20079](https://gitlab.com/wireshark/wireshark/-/issues/20079). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PRP trailer not shown for L2 IEC 61850 GOOSE packets in 4.4.0 (was working in 4.2.7) [Issue 20088](https://gitlab.com/wireshark/wireshark/-/issues/20088). +* GUI lags because NetworkManager keeps turning 802.11 monitor mode off. [Issue 20090](https://gitlab.com/wireshark/wireshark/-/issues/20090). +* Error while getting Bluetooth application process id by [Issue 20100](https://gitlab.com/wireshark/wireshark/-/issues/20100). +* Fuzz job assertion: randpkt-2024-10-05-7200.pcap. [Issue 20110](https://gitlab.com/wireshark/wireshark/-/issues/20110). + +Wireshark 4.4.0 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.0.html) +for details: + +Many improvements and fixes to the graphing dialogs, including +I/O Graphs, Flow Graph / VoIP Calls, and TCP Stream Graphs. + +Wireshark now supports automatic profile switching. +You can associate a display filter with a configuration profile, and when you open a capture file that matches the filter, Wireshark will automatically switch to that profile. + +Support for Lua 5.3 and 5.4 has been added, and support for Lua 5.1 and 5.2 has been removed. +The Windows and macOS installers now ship with Lua 5.4.6. + +Improved display filter support for value strings (optional string representations for numeric fields). + +Display filter functions can be implemented as plugins, similar to protocol dissectors and file parsers. + +Display filters can be translated to pcap filters using **Edit** **›** **Copy** **›** **Display filter as pcap filter** if each display filter field has a corresponding pcap filter equivalent. + +Custom columns can be defined using any valid field expression, such as +display filter functions, packet slices, arithmetic calculations, logical tests, +raw byte addressing, and protocol layer modifiers. + +Custom output fields for `tshark -e` can also be defined using any +valid field expression. + +Wireshark can be built with the zlib-ng instead of zlib for compressed file support. +Zlib-ng is substantially faster than zlib. +The official Windows and macOS packages include this feature. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on [the mailing list site](https://lists.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_446.md b/corpus/changelog/wireshark_releases/wireshark_446.md new file mode 100644 index 0000000000000000000000000000000000000000..c097643789924fc9b2735ddb2f36dcce703789d3 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_446.md @@ -0,0 +1,264 @@ +# Wireshark 4.4.6 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.4.6.html +Version: 4.4.6 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work! +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +The following bugs have been fixed: + +* Bug in EtherCAT dissector with ECS order. [Issue 13718](https://gitlab.com/wireshark/wireshark/-/issues/13718). +* Conversation dialog columns return to default width on each new packet in live capture. [Issue 15978](https://gitlab.com/wireshark/wireshark/-/issues/15978). +* Tests fail in LTO-enabled builds in Ubuntu/Debian. [Issue 18216](https://gitlab.com/wireshark/wireshark/-/issues/18216). +* Incorrect conditions in BFCP dissector. [Issue 18717](https://gitlab.com/wireshark/wireshark/-/issues/18717). +* Static build fails on Ubuntu 24.04 because the c-ares library isn’t found. [Issue 20343](https://gitlab.com/wireshark/wireshark/-/issues/20343). +* Flutter’s Image Picker Generated JPEG Files Detected as Malformed Packet. [Issue 20355](https://gitlab.com/wireshark/wireshark/-/issues/20355). +* QUIC dissector breaks when src and dst change. [Issue 20371](https://gitlab.com/wireshark/wireshark/-/issues/20371). +* s390x: build fail on Ubuntu PPA nighty build. [Issue 20372](https://gitlab.com/wireshark/wireshark/-/issues/20372). +* Trailing octet after IPv4 packet end is not detected or displayed in raw bytes. [Issue 20423](https://gitlab.com/wireshark/wireshark/-/issues/20423). +* [packet-ax25-nol3.c] Only call APRS dissector on UI Frames. [Issue 20429](https://gitlab.com/wireshark/wireshark/-/issues/20429). +* Wireshark hangs when refreshing interfaces with the debug console preference set to "always" and a file open (Windows) [Issue 20434](https://gitlab.com/wireshark/wireshark/-/issues/20434). +* BGP EVPN - Type-8 route not correctly read after addition of Max. Response Time field. [Issue 20459](https://gitlab.com/wireshark/wireshark/-/issues/20459). +* Wireshark does not correctly decode LIN "go to sleep" in TECMP and CMP. [Issue 20463](https://gitlab.com/wireshark/wireshark/-/issues/20463). +* MQTT-SN: WILLTOPIC message not decoded correctly (missing some flags) [Issue 20476](https://gitlab.com/wireshark/wireshark/-/issues/20476). + +### New and Updated Features + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +ADB, ASAM CMP, AX.25, BACapp, BFCP, BGP, CP2179, DCERPC WKSSVC, DCT2000, DECT-NWK, DHCP, DOF, EAPOL-MKA, ECAT, ErlDP, Ethertype, F1AP, GSM BSSMAP, GSM DTAP, HomePlug AV, ICMP, IEEE 802.11, ITS, LDP, MQTT-SN, NAS-EPS, NR RRC, OER, PCEP, PNIO, PPP, QUAKE, QUIC, Raw, Signal PDU, TCP, TECMP, TLS, and USB DFU + +### New and Updated Capture File Support + +3GPP and pcapng + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +Wireshark 4.4.5 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.5.html) +for details: + +* GRPC: protobuf\_json only displays the truncated string value. [Issue 20392](https://gitlab.com/wireshark/wireshark/-/issues/20392). +* Wireshark crashes when clicking on a column title/header. [Issue 20403](https://gitlab.com/wireshark/wireshark/-/issues/20403). + +Wireshark 4.4.4 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.4.html) +for details: + +* [wnpa-sec-2025-01](https://www.wireshark.org/security/wnpa-sec-2025-01) + Bundle Protocol and CBOR dissector {crash,infinite loop,memory leak}. + [Issue 20373](https://gitlab.com/wireshark/wireshark/-/issues/20373). +* Crash when sorting columns during capture with display filter active. [Issue 20263](https://gitlab.com/wireshark/wireshark/-/issues/20263). +* OSS-Fuzz 384757274: Invalid-bool-value in dissect\_tcp. [Issue 20300](https://gitlab.com/wireshark/wireshark/-/issues/20300). +* Test failure in 4.4.2/4.4.3: test\_sharkd\_req\_follow\_http2. [Issue 20330](https://gitlab.com/wireshark/wireshark/-/issues/20330). +* Regression in extcap interface toolbar. [Issue 20354](https://gitlab.com/wireshark/wireshark/-/issues/20354). +* Clicking outside columns in TCP tab of Statistics → Conversations window causes crash. [Issue 20357](https://gitlab.com/wireshark/wireshark/-/issues/20357). +* FTBFS with Ubuntu development (25.04) release. [Issue 20359](https://gitlab.com/wireshark/wireshark/-/issues/20359). +* DNS enable\_qname\_stats crash Wireshark when QDCOUNT == 0. [Issue 20367](https://gitlab.com/wireshark/wireshark/-/issues/20367). +* Windows: Android extcap plugin fails with "Broken socket connection" if there are no new packets for 2sec. [Issue 20386](https://gitlab.com/wireshark/wireshark/-/issues/20386). +* TECMP: Calculation of lifecycle start in Status message is wrong. [Issue 20387](https://gitlab.com/wireshark/wireshark/-/issues/20387). +* MQTT v5.0 properties total length presentation is incorrect. [Issue 20389](https://gitlab.com/wireshark/wireshark/-/issues/20389). +* TShark doesn’t resolve addresses in custom "hosts" files. [Issue 20391](https://gitlab.com/wireshark/wireshark/-/issues/20391). +* Incorrect JA4 fingerprint with empty ciphers. [Issue 20394](https://gitlab.com/wireshark/wireshark/-/issues/20394). + +Wireshark 4.4.3 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.3.html) +for details: + +* Potential mis-match in GSM MAP dissector for uncertainty radius and its filter key. [Issue 20247](https://gitlab.com/wireshark/wireshark/-/issues/20247). +* Macro eNodeB ID and Extended Macro eNodeB ID not decoded by User Location Information. [Issue 20276](https://gitlab.com/wireshark/wireshark/-/issues/20276). +* The NFSv2 Dissector appears to be swapping Character Special File and Directory in mode decoding. [Issue 20290](https://gitlab.com/wireshark/wireshark/-/issues/20290). +* CMake discovers Strawberry Perl’s zlib DLL when it shouldn’t. [Issue 20304](https://gitlab.com/wireshark/wireshark/-/issues/20304). +* VOIP Calls call flow displaying hours. [Issue 20311](https://gitlab.com/wireshark/wireshark/-/issues/20311). +* Fuzz job issue: fuzz-2024-12-26-7898.pcap. [Issue 20313](https://gitlab.com/wireshark/wireshark/-/issues/20313). +* sFlow: Incorrect length passed to header sample dissector. [Issue 20320](https://gitlab.com/wireshark/wireshark/-/issues/20320). +* wsutil: Should link against -lm due to missing fabs() when built with -fno-builtin. [Issue 20326](https://gitlab.com/wireshark/wireshark/-/issues/20326). + +Wireshark 4.4.2 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.2.html) +for details: + +* [wnpa-sec-2024-14](https://www.wireshark.org/security/wnpa-sec-2024-14) + FiveCo RAP dissector infinite loop. + [Issue 20176](https://gitlab.com/wireshark/wireshark/-/issues/20176). +* [wnpa-sec-2024-15](https://www.wireshark.org/security/wnpa-sec-2024-15) + ECMP dissector crash. + [Issue 20214](https://gitlab.com/wireshark/wireshark/-/issues/20214). +* CIP I/O is not detected by "enip" filter anymore. [Issue 19517](https://gitlab.com/wireshark/wireshark/-/issues/19517). +* Fuzz job issue: fuzz-2024-09-03-7550.pcap. [Issue 20041](https://gitlab.com/wireshark/wireshark/-/issues/20041). +* OSS-Fuzz 71476: wireshark:fuzzshark\_ip\_proto-udp: Index-out-of-bounds in DOFObjectID\_Create\_Unmarshal. [Issue 20065](https://gitlab.com/wireshark/wireshark/-/issues/20065). +* JA4\_c hashes an empty field to e3b0c44298fc when it should be 000000000000. [Issue 20066](https://gitlab.com/wireshark/wireshark/-/issues/20066). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PTP analysis loses track of message associations in case of sequence number resets. [Issue 20099](https://gitlab.com/wireshark/wireshark/-/issues/20099). +* USB CCID: response packet in case SetParameters command is unsupported is flagged as malformed. [Issue 20107](https://gitlab.com/wireshark/wireshark/-/issues/20107). +* dumpcap crashes when run from TShark with a capture filter. [Issue 20108](https://gitlab.com/wireshark/wireshark/-/issues/20108). +* SRT dissector: The StreamID (SID) in the handshake extension is displayed without regarding the control characters and with NUL as terminating. [Issue 20113](https://gitlab.com/wireshark/wireshark/-/issues/20113). +* Ghost error message on POP3 packets. [Issue 20124](https://gitlab.com/wireshark/wireshark/-/issues/20124). +* Building against c-ares 1.34 fails. [Issue 20125](https://gitlab.com/wireshark/wireshark/-/issues/20125). +* D-Bus is not optional anymore. [Issue 20126](https://gitlab.com/wireshark/wireshark/-/issues/20126). +* macOS Intel DMGs aren’t fully notarized. [Issue 20129](https://gitlab.com/wireshark/wireshark/-/issues/20129). +* Incorrect name for MLD Capabilities and Operations Present flag in dissection of MLD Capabilities for MLO wifi-7 capture. [Issue 20134](https://gitlab.com/wireshark/wireshark/-/issues/20134). +* CQL Malformed Packet v4 S → C Type RESULT: Prepared[Malformed Packet] [Issue 20142](https://gitlab.com/wireshark/wireshark/-/issues/20142). +* Wi-Fi: 256 Block Ack (BA) is not parsed properly. [Issue 20156](https://gitlab.com/wireshark/wireshark/-/issues/20156). +* BACnet ReadPropertyMultiple request Maximum allowed recursion depth reached. [Issue 20159](https://gitlab.com/wireshark/wireshark/-/issues/20159). +* Statistics→I/O Graph crashes when using simple moving average. [Issue 20163](https://gitlab.com/wireshark/wireshark/-/issues/20163). +* HTTP2 body decompression fails on DATA with a single padded frame. [Issue 20167](https://gitlab.com/wireshark/wireshark/-/issues/20167). +* Compiler warning for ui/tap-rtp-common.c (ignoring return value) [Issue 20169](https://gitlab.com/wireshark/wireshark/-/issues/20169). +* SIP dissector bug due to "be-route" param in VIA header. [Issue 20173](https://gitlab.com/wireshark/wireshark/-/issues/20173). +* Coredump after trying to open 'Follow TCP stream' [Issue 20174](https://gitlab.com/wireshark/wireshark/-/issues/20174). +* Protobuf JSON mapping error. [Issue 20182](https://gitlab.com/wireshark/wireshark/-/issues/20182). +* Display filter "!stp.pvst.origvlan in { vlan.id }" causes a crash (Version 4.4.1) [Issue 20183](https://gitlab.com/wireshark/wireshark/-/issues/20183). +* Extcap plugins shipped with Wireshark Portable are not found in version 4.4.1. [Issue 20184](https://gitlab.com/wireshark/wireshark/-/issues/20184). +* IEEE 802.11be: Wrong regulatory info in HE Operation IE in Beacon frame. [Issue 20187](https://gitlab.com/wireshark/wireshark/-/issues/20187). +* Wireshark 4.4.1 does not decode RTCP packets. [Issue 20188](https://gitlab.com/wireshark/wireshark/-/issues/20188). +* Qt: Display filter sub-menu can only be opened on the triangle, not the full name. [Issue 20190](https://gitlab.com/wireshark/wireshark/-/issues/20190). +* Qt: Changing the display filter does not update the Conversations or Endpoints dialogs. [Issue 20191](https://gitlab.com/wireshark/wireshark/-/issues/20191). +* MODBUS Dissector bug. [Issue 20192](https://gitlab.com/wireshark/wireshark/-/issues/20192). +* Modbus dissector bug - Field Occurence and Layer Operator modbus.bitval field. [Issue 20193](https://gitlab.com/wireshark/wireshark/-/issues/20193). +* Wireshark crashes when a field is dragged from packet details towards the find input. [Issue 20204](https://gitlab.com/wireshark/wireshark/-/issues/20204). +* Lua DissectorTable("") : set ("10,11") unexpected behavior in locales with comma as decimal separator. [Issue 20216](https://gitlab.com/wireshark/wireshark/-/issues/20216). + +The TCP dissector no longer falls back to using the client port as a criterion for selecting a payload dissector when the server port does not select a payload dissector (except for port 20, active FTP). +This behavior can be changed using the "Client port dissectors" preference. + +Display filters now correctly handle floating point conversion errors. + +The Lua API now has better support for comma-separated ranges in different locales. + +Wireshark 4.4.1 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.1.html) +for details: + +* [wnpa-sec-2024-12](https://www.wireshark.org/security/wnpa-sec-2024-12) + ITS dissector crash. + [Issue 20026](https://gitlab.com/wireshark/wireshark/-/issues/20026). +* [wnpa-sec-2024-13](https://www.wireshark.org/security/wnpa-sec-2024-13) + AppleTalk and RELOAD Framing dissector crashes. + [Issue 20114](https://gitlab.com/wireshark/wireshark/-/issues/20114). +* Refresh interface during live-capture leads to corrupt interface handling. [Issue 11176](https://gitlab.com/wireshark/wireshark/-/issues/11176). +* Media type "application/octet-stream" registered for both Thread and UASIP. [Issue 14729](https://gitlab.com/wireshark/wireshark/-/issues/14729). +* Extcap toolbar stops working when new interface is added. [Issue 19854](https://gitlab.com/wireshark/wireshark/-/issues/19854). +* Decoding error ITS CPM version 2.1.1. [Issue 19886](https://gitlab.com/wireshark/wireshark/-/issues/19886). +* Build error in 4.3.0: sync\_pipe\_run\_command\_actual error: argument 2 is null but the corresponding size argument 3 value is 512004 [-Werror=nonnull] [Issue 19930](https://gitlab.com/wireshark/wireshark/-/issues/19930). +* html2text.py doesn’t handle the `` tag. [Issue 20020](https://gitlab.com/wireshark/wireshark/-/issues/20020). +* Incorrect NetFlow v8 TOS AS aggregation dissection. [Issue 20021](https://gitlab.com/wireshark/wireshark/-/issues/20021). +* The Windows packages don’t ship with the IP address plugin. [Issue 20030](https://gitlab.com/wireshark/wireshark/-/issues/20030). +* O\_PATH is Linux-and-FreeBSD-specific. [Issue 20031](https://gitlab.com/wireshark/wireshark/-/issues/20031). +* Wireshark 4.4.0 doesn’t install USBcap USBcapCMD.exe in the correct directory. [Issue 20040](https://gitlab.com/wireshark/wireshark/-/issues/20040). +* OER dissector is not considering the preamble if ASN.1 SEQUENCE definition includes extension marker but no OPTIONAL items. [Issue 20044](https://gitlab.com/wireshark/wireshark/-/issues/20044). +* Bluetooth classic L2CAP incorrect dissection with connectionless reception channel. [Issue 20047](https://gitlab.com/wireshark/wireshark/-/issues/20047). +* Profile auto switch filters : Grayed Display Filter Expression dialog box when opened from Configuration Profiles dialog box. [Issue 20049](https://gitlab.com/wireshark/wireshark/-/issues/20049). +* Wireshark 4.4.0 / macOS 14.6.1 wifi if monitor mode. [Issue 20051](https://gitlab.com/wireshark/wireshark/-/issues/20051). +* TECMP Data Type passes too much data to sub dissectors. [Issue 20052](https://gitlab.com/wireshark/wireshark/-/issues/20052). +* Wireshark and tshark 4.4.0 ignore extcap options specified on the command line. [Issue 20054](https://gitlab.com/wireshark/wireshark/-/issues/20054). +* Cannot open release notes due to incorrect path with duplicated directory components. [Issue 20055](https://gitlab.com/wireshark/wireshark/-/issues/20055). +* Unable to open "Release Notes" from the "Help" menu. [Issue 20056](https://gitlab.com/wireshark/wireshark/-/issues/20056). +* No capture interfaces if Wireshark is started from command line with certain paths. [Issue 20057](https://gitlab.com/wireshark/wireshark/-/issues/20057). +* Wireshark 4.4.0 extcap path change breaks third party extcap installers. [Issue 20069](https://gitlab.com/wireshark/wireshark/-/issues/20069). +* Fuzz job UTF-8 encoding issue: fuzz-2024-09-10-7618.pcap. [Issue 20071](https://gitlab.com/wireshark/wireshark/-/issues/20071). +* Unable to create larger files than 99 size units. [Issue 20079](https://gitlab.com/wireshark/wireshark/-/issues/20079). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PRP trailer not shown for L2 IEC 61850 GOOSE packets in 4.4.0 (was working in 4.2.7) [Issue 20088](https://gitlab.com/wireshark/wireshark/-/issues/20088). +* GUI lags because NetworkManager keeps turning 802.11 monitor mode off. [Issue 20090](https://gitlab.com/wireshark/wireshark/-/issues/20090). +* Error while getting Bluetooth application process id by [Issue 20100](https://gitlab.com/wireshark/wireshark/-/issues/20100). +* Fuzz job assertion: randpkt-2024-10-05-7200.pcap. [Issue 20110](https://gitlab.com/wireshark/wireshark/-/issues/20110). + +Wireshark 4.4.0 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.0.html) +for details: + +Many improvements and fixes to the graphing dialogs, including +I/O Graphs, Flow Graph / VoIP Calls, and TCP Stream Graphs. + +Wireshark now supports automatic profile switching. +You can associate a display filter with a configuration profile, and when you open a capture file that matches the filter, Wireshark will automatically switch to that profile. + +Support for Lua 5.3 and 5.4 has been added, and support for Lua 5.1 and 5.2 has been removed. +The Windows and macOS installers now ship with Lua 5.4.6. + +Improved display filter support for value strings (optional string representations for numeric fields). + +Display filter functions can be implemented as plugins, similar to protocol dissectors and file parsers. + +Display filters can be translated to pcap filters using **Edit** **›** **Copy** **›** **Display filter as pcap filter** if each display filter field has a corresponding pcap filter equivalent. + +Custom columns can be defined using any valid field expression, such as +display filter functions, packet slices, arithmetic calculations, logical tests, +raw byte addressing, and protocol layer modifiers. + +Custom output fields for `tshark -e` can also be defined using any +valid field expression. + +Wireshark can be built with the zlib-ng instead of zlib for compressed file support. +Zlib-ng is substantially faster than zlib. +The official Windows and macOS packages include this feature. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on [the mailing list site](https://lists.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_447.md b/corpus/changelog/wireshark_releases/wireshark_447.md new file mode 100644 index 0000000000000000000000000000000000000000..eaac80eaf21e53e7cb3703072848ff56f3f876d9 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_447.md @@ -0,0 +1,290 @@ +# Wireshark 4.4.7 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.4.7.html +Version: 4.4.7 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work! +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2025-02](https://www.wireshark.org/security/wnpa-sec-2025-02) + Dissection engine crash. + [Issue 20509](https://gitlab.com/wireshark/wireshark/-/issues/20509). + [CVE-2025-5601](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-5601). + +The following bugs have been fixed: + +* Wireshark does not correctly decode LIN "go to sleep" in TECMP and CMP. [Issue 20463](https://gitlab.com/wireshark/wireshark/-/issues/20463). +* Dissector bug, Protocol CIGI. [Issue 20496](https://gitlab.com/wireshark/wireshark/-/issues/20496). +* Green power packets are not dissected when proto\_version == ZBEE\_VERSION\_GREEN\_POWER. [Issue 20497](https://gitlab.com/wireshark/wireshark/-/issues/20497). +* Packet diagrams misalign or drop bitfields. [Issue 20507](https://gitlab.com/wireshark/wireshark/-/issues/20507). +* Corruption when setting heuristic dissector table UI name from Lua. [Issue 20523](https://gitlab.com/wireshark/wireshark/-/issues/20523). +* LDAP dissector incorrectly displays filters with singleton "&" [Issue 20527](https://gitlab.com/wireshark/wireshark/-/issues/20527). +* WebSocket per-message compression extentions: fail to decompress server messages (from the 2nd) due to parameter handling. [Issue 20531](https://gitlab.com/wireshark/wireshark/-/issues/20531). +* The LL\_PERIODIC\_SYNC\_WR\_IND packet is not properly dissected (packet-btle.c) [Issue 20554](https://gitlab.com/wireshark/wireshark/-/issues/20554). + +### New and Updated Features + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +AT, BT LE LL, CIGI, genl, LDAP, LIN, Logcat Text, net\_dm, netfilter, nvme, SSH, TCPCL, TLS, WebSocket, ZigBee, and ZigBee ZCL + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +Wireshark 4.4.6 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.6.html) +for details: + +* Bug in EtherCAT dissector with ECS order. [Issue 13718](https://gitlab.com/wireshark/wireshark/-/issues/13718). +* Conversation dialog columns return to default width on each new packet in live capture. [Issue 15978](https://gitlab.com/wireshark/wireshark/-/issues/15978). +* Tests fail in LTO-enabled builds in Ubuntu/Debian. [Issue 18216](https://gitlab.com/wireshark/wireshark/-/issues/18216). +* Incorrect conditions in BFCP dissector. [Issue 18717](https://gitlab.com/wireshark/wireshark/-/issues/18717). +* Static build fails on Ubuntu 24.04 because the c-ares library isn’t found. [Issue 20343](https://gitlab.com/wireshark/wireshark/-/issues/20343). +* Flutter’s Image Picker Generated JPEG Files Detected as Malformed Packet. [Issue 20355](https://gitlab.com/wireshark/wireshark/-/issues/20355). +* QUIC dissector breaks when src and dst change. [Issue 20371](https://gitlab.com/wireshark/wireshark/-/issues/20371). +* s390x: build fail on Ubuntu PPA nighty build. [Issue 20372](https://gitlab.com/wireshark/wireshark/-/issues/20372). +* Trailing octet after IPv4 packet end is not detected or displayed in raw bytes. [Issue 20423](https://gitlab.com/wireshark/wireshark/-/issues/20423). +* [packet-ax25-nol3.c] Only call APRS dissector on UI Frames. [Issue 20429](https://gitlab.com/wireshark/wireshark/-/issues/20429). +* Wireshark hangs when refreshing interfaces with the debug console preference set to "always" and a file open (Windows) [Issue 20434](https://gitlab.com/wireshark/wireshark/-/issues/20434). +* BGP EVPN - Type-8 route not correctly read after addition of Max. Response Time field. [Issue 20459](https://gitlab.com/wireshark/wireshark/-/issues/20459). +* Wireshark does not correctly decode LIN "go to sleep" in TECMP and CMP. [Issue 20463](https://gitlab.com/wireshark/wireshark/-/issues/20463). +* MQTT-SN: WILLTOPIC message not decoded correctly (missing some flags) [Issue 20476](https://gitlab.com/wireshark/wireshark/-/issues/20476). + +Wireshark 4.4.5 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.5.html) +for details: + +* GRPC: protobuf\_json only displays the truncated string value. [Issue 20392](https://gitlab.com/wireshark/wireshark/-/issues/20392). +* Wireshark crashes when clicking on a column title/header. [Issue 20403](https://gitlab.com/wireshark/wireshark/-/issues/20403). + +Wireshark 4.4.4 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.4.html) +for details: + +* [wnpa-sec-2025-01](https://www.wireshark.org/security/wnpa-sec-2025-01) + Bundle Protocol and CBOR dissector {crash,infinite loop,memory leak}. + [Issue 20373](https://gitlab.com/wireshark/wireshark/-/issues/20373). +* Crash when sorting columns during capture with display filter active. [Issue 20263](https://gitlab.com/wireshark/wireshark/-/issues/20263). +* OSS-Fuzz 384757274: Invalid-bool-value in dissect\_tcp. [Issue 20300](https://gitlab.com/wireshark/wireshark/-/issues/20300). +* Test failure in 4.4.2/4.4.3: test\_sharkd\_req\_follow\_http2. [Issue 20330](https://gitlab.com/wireshark/wireshark/-/issues/20330). +* Regression in extcap interface toolbar. [Issue 20354](https://gitlab.com/wireshark/wireshark/-/issues/20354). +* Clicking outside columns in TCP tab of Statistics → Conversations window causes crash. [Issue 20357](https://gitlab.com/wireshark/wireshark/-/issues/20357). +* FTBFS with Ubuntu development (25.04) release. [Issue 20359](https://gitlab.com/wireshark/wireshark/-/issues/20359). +* DNS enable\_qname\_stats crash Wireshark when QDCOUNT == 0. [Issue 20367](https://gitlab.com/wireshark/wireshark/-/issues/20367). +* Windows: Android extcap plugin fails with "Broken socket connection" if there are no new packets for 2sec. [Issue 20386](https://gitlab.com/wireshark/wireshark/-/issues/20386). +* TECMP: Calculation of lifecycle start in Status message is wrong. [Issue 20387](https://gitlab.com/wireshark/wireshark/-/issues/20387). +* MQTT v5.0 properties total length presentation is incorrect. [Issue 20389](https://gitlab.com/wireshark/wireshark/-/issues/20389). +* TShark doesn’t resolve addresses in custom "hosts" files. [Issue 20391](https://gitlab.com/wireshark/wireshark/-/issues/20391). +* Incorrect JA4 fingerprint with empty ciphers. [Issue 20394](https://gitlab.com/wireshark/wireshark/-/issues/20394). + +Wireshark 4.4.3 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.3.html) +for details: + +* Potential mis-match in GSM MAP dissector for uncertainty radius and its filter key. [Issue 20247](https://gitlab.com/wireshark/wireshark/-/issues/20247). +* Macro eNodeB ID and Extended Macro eNodeB ID not decoded by User Location Information. [Issue 20276](https://gitlab.com/wireshark/wireshark/-/issues/20276). +* The NFSv2 Dissector appears to be swapping Character Special File and Directory in mode decoding. [Issue 20290](https://gitlab.com/wireshark/wireshark/-/issues/20290). +* CMake discovers Strawberry Perl’s zlib DLL when it shouldn’t. [Issue 20304](https://gitlab.com/wireshark/wireshark/-/issues/20304). +* VOIP Calls call flow displaying hours. [Issue 20311](https://gitlab.com/wireshark/wireshark/-/issues/20311). +* Fuzz job issue: fuzz-2024-12-26-7898.pcap. [Issue 20313](https://gitlab.com/wireshark/wireshark/-/issues/20313). +* sFlow: Incorrect length passed to header sample dissector. [Issue 20320](https://gitlab.com/wireshark/wireshark/-/issues/20320). +* wsutil: Should link against -lm due to missing fabs() when built with -fno-builtin. [Issue 20326](https://gitlab.com/wireshark/wireshark/-/issues/20326). + +Wireshark 4.4.2 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.2.html) +for details: + +* [wnpa-sec-2024-14](https://www.wireshark.org/security/wnpa-sec-2024-14) + FiveCo RAP dissector infinite loop. + [Issue 20176](https://gitlab.com/wireshark/wireshark/-/issues/20176). +* [wnpa-sec-2024-15](https://www.wireshark.org/security/wnpa-sec-2024-15) + ECMP dissector crash. + [Issue 20214](https://gitlab.com/wireshark/wireshark/-/issues/20214). +* CIP I/O is not detected by "enip" filter anymore. [Issue 19517](https://gitlab.com/wireshark/wireshark/-/issues/19517). +* Fuzz job issue: fuzz-2024-09-03-7550.pcap. [Issue 20041](https://gitlab.com/wireshark/wireshark/-/issues/20041). +* OSS-Fuzz 71476: wireshark:fuzzshark\_ip\_proto-udp: Index-out-of-bounds in DOFObjectID\_Create\_Unmarshal. [Issue 20065](https://gitlab.com/wireshark/wireshark/-/issues/20065). +* JA4\_c hashes an empty field to e3b0c44298fc when it should be 000000000000. [Issue 20066](https://gitlab.com/wireshark/wireshark/-/issues/20066). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PTP analysis loses track of message associations in case of sequence number resets. [Issue 20099](https://gitlab.com/wireshark/wireshark/-/issues/20099). +* USB CCID: response packet in case SetParameters command is unsupported is flagged as malformed. [Issue 20107](https://gitlab.com/wireshark/wireshark/-/issues/20107). +* dumpcap crashes when run from TShark with a capture filter. [Issue 20108](https://gitlab.com/wireshark/wireshark/-/issues/20108). +* SRT dissector: The StreamID (SID) in the handshake extension is displayed without regarding the control characters and with NUL as terminating. [Issue 20113](https://gitlab.com/wireshark/wireshark/-/issues/20113). +* Ghost error message on POP3 packets. [Issue 20124](https://gitlab.com/wireshark/wireshark/-/issues/20124). +* Building against c-ares 1.34 fails. [Issue 20125](https://gitlab.com/wireshark/wireshark/-/issues/20125). +* D-Bus is not optional anymore. [Issue 20126](https://gitlab.com/wireshark/wireshark/-/issues/20126). +* macOS Intel DMGs aren’t fully notarized. [Issue 20129](https://gitlab.com/wireshark/wireshark/-/issues/20129). +* Incorrect name for MLD Capabilities and Operations Present flag in dissection of MLD Capabilities for MLO wifi-7 capture. [Issue 20134](https://gitlab.com/wireshark/wireshark/-/issues/20134). +* CQL Malformed Packet v4 S → C Type RESULT: Prepared[Malformed Packet] [Issue 20142](https://gitlab.com/wireshark/wireshark/-/issues/20142). +* Wi-Fi: 256 Block Ack (BA) is not parsed properly. [Issue 20156](https://gitlab.com/wireshark/wireshark/-/issues/20156). +* BACnet ReadPropertyMultiple request Maximum allowed recursion depth reached. [Issue 20159](https://gitlab.com/wireshark/wireshark/-/issues/20159). +* Statistics→I/O Graph crashes when using simple moving average. [Issue 20163](https://gitlab.com/wireshark/wireshark/-/issues/20163). +* HTTP2 body decompression fails on DATA with a single padded frame. [Issue 20167](https://gitlab.com/wireshark/wireshark/-/issues/20167). +* Compiler warning for ui/tap-rtp-common.c (ignoring return value) [Issue 20169](https://gitlab.com/wireshark/wireshark/-/issues/20169). +* SIP dissector bug due to "be-route" param in VIA header. [Issue 20173](https://gitlab.com/wireshark/wireshark/-/issues/20173). +* Coredump after trying to open 'Follow TCP stream' [Issue 20174](https://gitlab.com/wireshark/wireshark/-/issues/20174). +* Protobuf JSON mapping error. [Issue 20182](https://gitlab.com/wireshark/wireshark/-/issues/20182). +* Display filter "!stp.pvst.origvlan in { vlan.id }" causes a crash (Version 4.4.1) [Issue 20183](https://gitlab.com/wireshark/wireshark/-/issues/20183). +* Extcap plugins shipped with Wireshark Portable are not found in version 4.4.1. [Issue 20184](https://gitlab.com/wireshark/wireshark/-/issues/20184). +* IEEE 802.11be: Wrong regulatory info in HE Operation IE in Beacon frame. [Issue 20187](https://gitlab.com/wireshark/wireshark/-/issues/20187). +* Wireshark 4.4.1 does not decode RTCP packets. [Issue 20188](https://gitlab.com/wireshark/wireshark/-/issues/20188). +* Qt: Display filter sub-menu can only be opened on the triangle, not the full name. [Issue 20190](https://gitlab.com/wireshark/wireshark/-/issues/20190). +* Qt: Changing the display filter does not update the Conversations or Endpoints dialogs. [Issue 20191](https://gitlab.com/wireshark/wireshark/-/issues/20191). +* MODBUS Dissector bug. [Issue 20192](https://gitlab.com/wireshark/wireshark/-/issues/20192). +* Modbus dissector bug - Field Occurence and Layer Operator modbus.bitval field. [Issue 20193](https://gitlab.com/wireshark/wireshark/-/issues/20193). +* Wireshark crashes when a field is dragged from packet details towards the find input. [Issue 20204](https://gitlab.com/wireshark/wireshark/-/issues/20204). +* Lua DissectorTable("") : set ("10,11") unexpected behavior in locales with comma as decimal separator. [Issue 20216](https://gitlab.com/wireshark/wireshark/-/issues/20216). + +The TCP dissector no longer falls back to using the client port as a criterion for selecting a payload dissector when the server port does not select a payload dissector (except for port 20, active FTP). +This behavior can be changed using the "Client port dissectors" preference. + +Display filters now correctly handle floating point conversion errors. + +The Lua API now has better support for comma-separated ranges in different locales. + +Wireshark 4.4.1 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.1.html) +for details: + +* [wnpa-sec-2024-12](https://www.wireshark.org/security/wnpa-sec-2024-12) + ITS dissector crash. + [Issue 20026](https://gitlab.com/wireshark/wireshark/-/issues/20026). +* [wnpa-sec-2024-13](https://www.wireshark.org/security/wnpa-sec-2024-13) + AppleTalk and RELOAD Framing dissector crashes. + [Issue 20114](https://gitlab.com/wireshark/wireshark/-/issues/20114). +* Refresh interface during live-capture leads to corrupt interface handling. [Issue 11176](https://gitlab.com/wireshark/wireshark/-/issues/11176). +* Media type "application/octet-stream" registered for both Thread and UASIP. [Issue 14729](https://gitlab.com/wireshark/wireshark/-/issues/14729). +* Extcap toolbar stops working when new interface is added. [Issue 19854](https://gitlab.com/wireshark/wireshark/-/issues/19854). +* Decoding error ITS CPM version 2.1.1. [Issue 19886](https://gitlab.com/wireshark/wireshark/-/issues/19886). +* Build error in 4.3.0: sync\_pipe\_run\_command\_actual error: argument 2 is null but the corresponding size argument 3 value is 512004 [-Werror=nonnull] [Issue 19930](https://gitlab.com/wireshark/wireshark/-/issues/19930). +* html2text.py doesn’t handle the `` tag. [Issue 20020](https://gitlab.com/wireshark/wireshark/-/issues/20020). +* Incorrect NetFlow v8 TOS AS aggregation dissection. [Issue 20021](https://gitlab.com/wireshark/wireshark/-/issues/20021). +* The Windows packages don’t ship with the IP address plugin. [Issue 20030](https://gitlab.com/wireshark/wireshark/-/issues/20030). +* O\_PATH is Linux-and-FreeBSD-specific. [Issue 20031](https://gitlab.com/wireshark/wireshark/-/issues/20031). +* Wireshark 4.4.0 doesn’t install USBcap USBcapCMD.exe in the correct directory. [Issue 20040](https://gitlab.com/wireshark/wireshark/-/issues/20040). +* OER dissector is not considering the preamble if ASN.1 SEQUENCE definition includes extension marker but no OPTIONAL items. [Issue 20044](https://gitlab.com/wireshark/wireshark/-/issues/20044). +* Bluetooth classic L2CAP incorrect dissection with connectionless reception channel. [Issue 20047](https://gitlab.com/wireshark/wireshark/-/issues/20047). +* Profile auto switch filters : Grayed Display Filter Expression dialog box when opened from Configuration Profiles dialog box. [Issue 20049](https://gitlab.com/wireshark/wireshark/-/issues/20049). +* Wireshark 4.4.0 / macOS 14.6.1 wifi if monitor mode. [Issue 20051](https://gitlab.com/wireshark/wireshark/-/issues/20051). +* TECMP Data Type passes too much data to sub dissectors. [Issue 20052](https://gitlab.com/wireshark/wireshark/-/issues/20052). +* Wireshark and tshark 4.4.0 ignore extcap options specified on the command line. [Issue 20054](https://gitlab.com/wireshark/wireshark/-/issues/20054). +* Cannot open release notes due to incorrect path with duplicated directory components. [Issue 20055](https://gitlab.com/wireshark/wireshark/-/issues/20055). +* Unable to open "Release Notes" from the "Help" menu. [Issue 20056](https://gitlab.com/wireshark/wireshark/-/issues/20056). +* No capture interfaces if Wireshark is started from command line with certain paths. [Issue 20057](https://gitlab.com/wireshark/wireshark/-/issues/20057). +* Wireshark 4.4.0 extcap path change breaks third party extcap installers. [Issue 20069](https://gitlab.com/wireshark/wireshark/-/issues/20069). +* Fuzz job UTF-8 encoding issue: fuzz-2024-09-10-7618.pcap. [Issue 20071](https://gitlab.com/wireshark/wireshark/-/issues/20071). +* Unable to create larger files than 99 size units. [Issue 20079](https://gitlab.com/wireshark/wireshark/-/issues/20079). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PRP trailer not shown for L2 IEC 61850 GOOSE packets in 4.4.0 (was working in 4.2.7) [Issue 20088](https://gitlab.com/wireshark/wireshark/-/issues/20088). +* GUI lags because NetworkManager keeps turning 802.11 monitor mode off. [Issue 20090](https://gitlab.com/wireshark/wireshark/-/issues/20090). +* Error while getting Bluetooth application process id by [Issue 20100](https://gitlab.com/wireshark/wireshark/-/issues/20100). +* Fuzz job assertion: randpkt-2024-10-05-7200.pcap. [Issue 20110](https://gitlab.com/wireshark/wireshark/-/issues/20110). + +Wireshark 4.4.0 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.0.html) +for details: + +Many improvements and fixes to the graphing dialogs, including +I/O Graphs, Flow Graph / VoIP Calls, and TCP Stream Graphs. + +Wireshark now supports automatic profile switching. +You can associate a display filter with a configuration profile, and when you open a capture file that matches the filter, Wireshark will automatically switch to that profile. + +Support for Lua 5.3 and 5.4 has been added, and support for Lua 5.1 and 5.2 has been removed. +The Windows and macOS installers now ship with Lua 5.4.6. + +Improved display filter support for value strings (optional string representations for numeric fields). + +Display filter functions can be implemented as plugins, similar to protocol dissectors and file parsers. + +Display filters can be translated to pcap filters using **Edit** **›** **Copy** **›** **Display filter as pcap filter** if each display filter field has a corresponding pcap filter equivalent. + +Custom columns can be defined using any valid field expression, such as +display filter functions, packet slices, arithmetic calculations, logical tests, +raw byte addressing, and protocol layer modifiers. + +Custom output fields for `tshark -e` can also be defined using any +valid field expression. + +Wireshark can be built with the zlib-ng instead of zlib for compressed file support. +Zlib-ng is substantially faster than zlib. +The official Windows and macOS packages include this feature. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on [the mailing list site](https://lists.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## Getting Certified + +You can become a Wireshark Certified Analyst! +Learn more at + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_448.md b/corpus/changelog/wireshark_releases/wireshark_448.md new file mode 100644 index 0000000000000000000000000000000000000000..b368cd909b2f880ffb2dc1b39118577c53483bbe --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_448.md @@ -0,0 +1,302 @@ +# Wireshark 4.4.8 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.4.8.html +Version: 4.4.8 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work! +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +The following bugs have been fixed: + +* Renegotiated DTLS session is not being decrypted. [Issue 20362](https://gitlab.com/wireshark/wireshark/-/issues/20362). +* Wireshark is completely stuck in initialization because androiddump recv() is blocked. [Issue 20526](https://gitlab.com/wireshark/wireshark/-/issues/20526). +* Fuzz job UTF-8 encoding issue: fuzz-2025-06-20-7318.pcap. [Issue 20585](https://gitlab.com/wireshark/wireshark/-/issues/20585). +* Crash when showing packet in new window after reloading Lua plugins with a certain gui.column.format preference. [Issue 20588](https://gitlab.com/wireshark/wireshark/-/issues/20588). +* Bug in UDS dissector with Service ReadDataByPeriodicIdentifier Response. [Issue 20589](https://gitlab.com/wireshark/wireshark/-/issues/20589). +* Packet diagram doesn’t show non-standard field value representations. [Issue 20590](https://gitlab.com/wireshark/wireshark/-/issues/20590). +* Packet diagram shows representation twice when field type is FT\_NONE. [Issue 20601](https://gitlab.com/wireshark/wireshark/-/issues/20601). +* application/x-www-form-urlencoded key parsed incorrectly following a name-value byte sequence with no '=' [Issue 20615](https://gitlab.com/wireshark/wireshark/-/issues/20615). +* DNP3 time stamp was unable to work after epoch time(year 2038) [Issue 20618](https://gitlab.com/wireshark/wireshark/-/issues/20618). + +### New and Updated Features + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +ASTERIX, DLT, DNP 3.0, DOF, DTLS, ETSI CAT, Gryphon, IPsec, ISObus VT, KRB5, MBIM, RTCP, SLL, STCSIG, TETRA, UDS, and URL Encoded Form Data + +### New and Updated Capture File Support + +pcapng + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +Wireshark 4.4.7 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.7.html) +for details: + +* [wnpa-sec-2025-02](https://www.wireshark.org/security/wnpa-sec-2025-02) + Dissection engine crash. + [Issue 20509](https://gitlab.com/wireshark/wireshark/-/issues/20509). + [CVE-2025-5601](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-5601). +* Wireshark does not correctly decode LIN "go to sleep" in TECMP and CMP. [Issue 20463](https://gitlab.com/wireshark/wireshark/-/issues/20463). +* Dissector bug, Protocol CIGI. [Issue 20496](https://gitlab.com/wireshark/wireshark/-/issues/20496). +* Green power packets are not dissected when proto\_version == ZBEE\_VERSION\_GREEN\_POWER. [Issue 20497](https://gitlab.com/wireshark/wireshark/-/issues/20497). +* Packet diagrams misalign or drop bitfields. [Issue 20507](https://gitlab.com/wireshark/wireshark/-/issues/20507). +* Corruption when setting heuristic dissector table UI name from Lua. [Issue 20523](https://gitlab.com/wireshark/wireshark/-/issues/20523). +* LDAP dissector incorrectly displays filters with singleton "&" [Issue 20527](https://gitlab.com/wireshark/wireshark/-/issues/20527). +* WebSocket per-message compression extentions: fail to decompress server messages (from the 2nd) due to parameter handling. [Issue 20531](https://gitlab.com/wireshark/wireshark/-/issues/20531). +* The LL\_PERIODIC\_SYNC\_WR\_IND packet is not properly dissected (packet-btle.c) [Issue 20554](https://gitlab.com/wireshark/wireshark/-/issues/20554). + +Wireshark 4.4.6 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.6.html) +for details: + +* Bug in EtherCAT dissector with ECS order. [Issue 13718](https://gitlab.com/wireshark/wireshark/-/issues/13718). +* Conversation dialog columns return to default width on each new packet in live capture. [Issue 15978](https://gitlab.com/wireshark/wireshark/-/issues/15978). +* Tests fail in LTO-enabled builds in Ubuntu/Debian. [Issue 18216](https://gitlab.com/wireshark/wireshark/-/issues/18216). +* Incorrect conditions in BFCP dissector. [Issue 18717](https://gitlab.com/wireshark/wireshark/-/issues/18717). +* Static build fails on Ubuntu 24.04 because the c-ares library isn’t found. [Issue 20343](https://gitlab.com/wireshark/wireshark/-/issues/20343). +* Flutter’s Image Picker Generated JPEG Files Detected as Malformed Packet. [Issue 20355](https://gitlab.com/wireshark/wireshark/-/issues/20355). +* QUIC dissector breaks when src and dst change. [Issue 20371](https://gitlab.com/wireshark/wireshark/-/issues/20371). +* s390x: build fail on Ubuntu PPA nighty build. [Issue 20372](https://gitlab.com/wireshark/wireshark/-/issues/20372). +* Trailing octet after IPv4 packet end is not detected or displayed in raw bytes. [Issue 20423](https://gitlab.com/wireshark/wireshark/-/issues/20423). +* [packet-ax25-nol3.c] Only call APRS dissector on UI Frames. [Issue 20429](https://gitlab.com/wireshark/wireshark/-/issues/20429). +* Wireshark hangs when refreshing interfaces with the debug console preference set to "always" and a file open (Windows) [Issue 20434](https://gitlab.com/wireshark/wireshark/-/issues/20434). +* BGP EVPN - Type-8 route not correctly read after addition of Max. Response Time field. [Issue 20459](https://gitlab.com/wireshark/wireshark/-/issues/20459). +* Wireshark does not correctly decode LIN "go to sleep" in TECMP and CMP. [Issue 20463](https://gitlab.com/wireshark/wireshark/-/issues/20463). +* MQTT-SN: WILLTOPIC message not decoded correctly (missing some flags) [Issue 20476](https://gitlab.com/wireshark/wireshark/-/issues/20476). + +Wireshark 4.4.5 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.5.html) +for details: + +* GRPC: protobuf\_json only displays the truncated string value. [Issue 20392](https://gitlab.com/wireshark/wireshark/-/issues/20392). +* Wireshark crashes when clicking on a column title/header. [Issue 20403](https://gitlab.com/wireshark/wireshark/-/issues/20403). + +Wireshark 4.4.4 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.4.html) +for details: + +* [wnpa-sec-2025-01](https://www.wireshark.org/security/wnpa-sec-2025-01) + Bundle Protocol and CBOR dissector {crash,infinite loop,memory leak}. + [Issue 20373](https://gitlab.com/wireshark/wireshark/-/issues/20373). +* Crash when sorting columns during capture with display filter active. [Issue 20263](https://gitlab.com/wireshark/wireshark/-/issues/20263). +* OSS-Fuzz 384757274: Invalid-bool-value in dissect\_tcp. [Issue 20300](https://gitlab.com/wireshark/wireshark/-/issues/20300). +* Test failure in 4.4.2/4.4.3: test\_sharkd\_req\_follow\_http2. [Issue 20330](https://gitlab.com/wireshark/wireshark/-/issues/20330). +* Regression in extcap interface toolbar. [Issue 20354](https://gitlab.com/wireshark/wireshark/-/issues/20354). +* Clicking outside columns in TCP tab of Statistics → Conversations window causes crash. [Issue 20357](https://gitlab.com/wireshark/wireshark/-/issues/20357). +* FTBFS with Ubuntu development (25.04) release. [Issue 20359](https://gitlab.com/wireshark/wireshark/-/issues/20359). +* DNS enable\_qname\_stats crash Wireshark when QDCOUNT == 0. [Issue 20367](https://gitlab.com/wireshark/wireshark/-/issues/20367). +* Windows: Android extcap plugin fails with "Broken socket connection" if there are no new packets for 2sec. [Issue 20386](https://gitlab.com/wireshark/wireshark/-/issues/20386). +* TECMP: Calculation of lifecycle start in Status message is wrong. [Issue 20387](https://gitlab.com/wireshark/wireshark/-/issues/20387). +* MQTT v5.0 properties total length presentation is incorrect. [Issue 20389](https://gitlab.com/wireshark/wireshark/-/issues/20389). +* TShark doesn’t resolve addresses in custom "hosts" files. [Issue 20391](https://gitlab.com/wireshark/wireshark/-/issues/20391). +* Incorrect JA4 fingerprint with empty ciphers. [Issue 20394](https://gitlab.com/wireshark/wireshark/-/issues/20394). + +Wireshark 4.4.3 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.3.html) +for details: + +* Potential mis-match in GSM MAP dissector for uncertainty radius and its filter key. [Issue 20247](https://gitlab.com/wireshark/wireshark/-/issues/20247). +* Macro eNodeB ID and Extended Macro eNodeB ID not decoded by User Location Information. [Issue 20276](https://gitlab.com/wireshark/wireshark/-/issues/20276). +* The NFSv2 Dissector appears to be swapping Character Special File and Directory in mode decoding. [Issue 20290](https://gitlab.com/wireshark/wireshark/-/issues/20290). +* CMake discovers Strawberry Perl’s zlib DLL when it shouldn’t. [Issue 20304](https://gitlab.com/wireshark/wireshark/-/issues/20304). +* VOIP Calls call flow displaying hours. [Issue 20311](https://gitlab.com/wireshark/wireshark/-/issues/20311). +* Fuzz job issue: fuzz-2024-12-26-7898.pcap. [Issue 20313](https://gitlab.com/wireshark/wireshark/-/issues/20313). +* sFlow: Incorrect length passed to header sample dissector. [Issue 20320](https://gitlab.com/wireshark/wireshark/-/issues/20320). +* wsutil: Should link against -lm due to missing fabs() when built with -fno-builtin. [Issue 20326](https://gitlab.com/wireshark/wireshark/-/issues/20326). + +Wireshark 4.4.2 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.2.html) +for details: + +* [wnpa-sec-2024-14](https://www.wireshark.org/security/wnpa-sec-2024-14) + FiveCo RAP dissector infinite loop. + [Issue 20176](https://gitlab.com/wireshark/wireshark/-/issues/20176). +* [wnpa-sec-2024-15](https://www.wireshark.org/security/wnpa-sec-2024-15) + ECMP dissector crash. + [Issue 20214](https://gitlab.com/wireshark/wireshark/-/issues/20214). +* CIP I/O is not detected by "enip" filter anymore. [Issue 19517](https://gitlab.com/wireshark/wireshark/-/issues/19517). +* Fuzz job issue: fuzz-2024-09-03-7550.pcap. [Issue 20041](https://gitlab.com/wireshark/wireshark/-/issues/20041). +* OSS-Fuzz 71476: wireshark:fuzzshark\_ip\_proto-udp: Index-out-of-bounds in DOFObjectID\_Create\_Unmarshal. [Issue 20065](https://gitlab.com/wireshark/wireshark/-/issues/20065). +* JA4\_c hashes an empty field to e3b0c44298fc when it should be 000000000000. [Issue 20066](https://gitlab.com/wireshark/wireshark/-/issues/20066). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PTP analysis loses track of message associations in case of sequence number resets. [Issue 20099](https://gitlab.com/wireshark/wireshark/-/issues/20099). +* USB CCID: response packet in case SetParameters command is unsupported is flagged as malformed. [Issue 20107](https://gitlab.com/wireshark/wireshark/-/issues/20107). +* dumpcap crashes when run from TShark with a capture filter. [Issue 20108](https://gitlab.com/wireshark/wireshark/-/issues/20108). +* SRT dissector: The StreamID (SID) in the handshake extension is displayed without regarding the control characters and with NUL as terminating. [Issue 20113](https://gitlab.com/wireshark/wireshark/-/issues/20113). +* Ghost error message on POP3 packets. [Issue 20124](https://gitlab.com/wireshark/wireshark/-/issues/20124). +* Building against c-ares 1.34 fails. [Issue 20125](https://gitlab.com/wireshark/wireshark/-/issues/20125). +* D-Bus is not optional anymore. [Issue 20126](https://gitlab.com/wireshark/wireshark/-/issues/20126). +* macOS Intel DMGs aren’t fully notarized. [Issue 20129](https://gitlab.com/wireshark/wireshark/-/issues/20129). +* Incorrect name for MLD Capabilities and Operations Present flag in dissection of MLD Capabilities for MLO wifi-7 capture. [Issue 20134](https://gitlab.com/wireshark/wireshark/-/issues/20134). +* CQL Malformed Packet v4 S → C Type RESULT: Prepared[Malformed Packet] [Issue 20142](https://gitlab.com/wireshark/wireshark/-/issues/20142). +* Wi-Fi: 256 Block Ack (BA) is not parsed properly. [Issue 20156](https://gitlab.com/wireshark/wireshark/-/issues/20156). +* BACnet ReadPropertyMultiple request Maximum allowed recursion depth reached. [Issue 20159](https://gitlab.com/wireshark/wireshark/-/issues/20159). +* Statistics→I/O Graph crashes when using simple moving average. [Issue 20163](https://gitlab.com/wireshark/wireshark/-/issues/20163). +* HTTP2 body decompression fails on DATA with a single padded frame. [Issue 20167](https://gitlab.com/wireshark/wireshark/-/issues/20167). +* Compiler warning for ui/tap-rtp-common.c (ignoring return value) [Issue 20169](https://gitlab.com/wireshark/wireshark/-/issues/20169). +* SIP dissector bug due to "be-route" param in VIA header. [Issue 20173](https://gitlab.com/wireshark/wireshark/-/issues/20173). +* Coredump after trying to open 'Follow TCP stream' [Issue 20174](https://gitlab.com/wireshark/wireshark/-/issues/20174). +* Protobuf JSON mapping error. [Issue 20182](https://gitlab.com/wireshark/wireshark/-/issues/20182). +* Display filter "!stp.pvst.origvlan in { vlan.id }" causes a crash (Version 4.4.1) [Issue 20183](https://gitlab.com/wireshark/wireshark/-/issues/20183). +* Extcap plugins shipped with Wireshark Portable are not found in version 4.4.1. [Issue 20184](https://gitlab.com/wireshark/wireshark/-/issues/20184). +* IEEE 802.11be: Wrong regulatory info in HE Operation IE in Beacon frame. [Issue 20187](https://gitlab.com/wireshark/wireshark/-/issues/20187). +* Wireshark 4.4.1 does not decode RTCP packets. [Issue 20188](https://gitlab.com/wireshark/wireshark/-/issues/20188). +* Qt: Display filter sub-menu can only be opened on the triangle, not the full name. [Issue 20190](https://gitlab.com/wireshark/wireshark/-/issues/20190). +* Qt: Changing the display filter does not update the Conversations or Endpoints dialogs. [Issue 20191](https://gitlab.com/wireshark/wireshark/-/issues/20191). +* MODBUS Dissector bug. [Issue 20192](https://gitlab.com/wireshark/wireshark/-/issues/20192). +* Modbus dissector bug - Field Occurence and Layer Operator modbus.bitval field. [Issue 20193](https://gitlab.com/wireshark/wireshark/-/issues/20193). +* Wireshark crashes when a field is dragged from packet details towards the find input. [Issue 20204](https://gitlab.com/wireshark/wireshark/-/issues/20204). +* Lua DissectorTable("") : set ("10,11") unexpected behavior in locales with comma as decimal separator. [Issue 20216](https://gitlab.com/wireshark/wireshark/-/issues/20216). + +The TCP dissector no longer falls back to using the client port as a criterion for selecting a payload dissector when the server port does not select a payload dissector (except for port 20, active FTP). +This behavior can be changed using the "Client port dissectors" preference. + +Display filters now correctly handle floating point conversion errors. + +The Lua API now has better support for comma-separated ranges in different locales. + +Wireshark 4.4.1 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.1.html) +for details: + +* [wnpa-sec-2024-12](https://www.wireshark.org/security/wnpa-sec-2024-12) + ITS dissector crash. + [Issue 20026](https://gitlab.com/wireshark/wireshark/-/issues/20026). +* [wnpa-sec-2024-13](https://www.wireshark.org/security/wnpa-sec-2024-13) + AppleTalk and RELOAD Framing dissector crashes. + [Issue 20114](https://gitlab.com/wireshark/wireshark/-/issues/20114). +* Refresh interface during live-capture leads to corrupt interface handling. [Issue 11176](https://gitlab.com/wireshark/wireshark/-/issues/11176). +* Media type "application/octet-stream" registered for both Thread and UASIP. [Issue 14729](https://gitlab.com/wireshark/wireshark/-/issues/14729). +* Extcap toolbar stops working when new interface is added. [Issue 19854](https://gitlab.com/wireshark/wireshark/-/issues/19854). +* Decoding error ITS CPM version 2.1.1. [Issue 19886](https://gitlab.com/wireshark/wireshark/-/issues/19886). +* Build error in 4.3.0: sync\_pipe\_run\_command\_actual error: argument 2 is null but the corresponding size argument 3 value is 512004 [-Werror=nonnull] [Issue 19930](https://gitlab.com/wireshark/wireshark/-/issues/19930). +* html2text.py doesn’t handle the `` tag. [Issue 20020](https://gitlab.com/wireshark/wireshark/-/issues/20020). +* Incorrect NetFlow v8 TOS AS aggregation dissection. [Issue 20021](https://gitlab.com/wireshark/wireshark/-/issues/20021). +* The Windows packages don’t ship with the IP address plugin. [Issue 20030](https://gitlab.com/wireshark/wireshark/-/issues/20030). +* O\_PATH is Linux-and-FreeBSD-specific. [Issue 20031](https://gitlab.com/wireshark/wireshark/-/issues/20031). +* Wireshark 4.4.0 doesn’t install USBcap USBcapCMD.exe in the correct directory. [Issue 20040](https://gitlab.com/wireshark/wireshark/-/issues/20040). +* OER dissector is not considering the preamble if ASN.1 SEQUENCE definition includes extension marker but no OPTIONAL items. [Issue 20044](https://gitlab.com/wireshark/wireshark/-/issues/20044). +* Bluetooth classic L2CAP incorrect dissection with connectionless reception channel. [Issue 20047](https://gitlab.com/wireshark/wireshark/-/issues/20047). +* Profile auto switch filters : Grayed Display Filter Expression dialog box when opened from Configuration Profiles dialog box. [Issue 20049](https://gitlab.com/wireshark/wireshark/-/issues/20049). +* Wireshark 4.4.0 / macOS 14.6.1 wifi if monitor mode. [Issue 20051](https://gitlab.com/wireshark/wireshark/-/issues/20051). +* TECMP Data Type passes too much data to sub dissectors. [Issue 20052](https://gitlab.com/wireshark/wireshark/-/issues/20052). +* Wireshark and tshark 4.4.0 ignore extcap options specified on the command line. [Issue 20054](https://gitlab.com/wireshark/wireshark/-/issues/20054). +* Cannot open release notes due to incorrect path with duplicated directory components. [Issue 20055](https://gitlab.com/wireshark/wireshark/-/issues/20055). +* Unable to open "Release Notes" from the "Help" menu. [Issue 20056](https://gitlab.com/wireshark/wireshark/-/issues/20056). +* No capture interfaces if Wireshark is started from command line with certain paths. [Issue 20057](https://gitlab.com/wireshark/wireshark/-/issues/20057). +* Wireshark 4.4.0 extcap path change breaks third party extcap installers. [Issue 20069](https://gitlab.com/wireshark/wireshark/-/issues/20069). +* Fuzz job UTF-8 encoding issue: fuzz-2024-09-10-7618.pcap. [Issue 20071](https://gitlab.com/wireshark/wireshark/-/issues/20071). +* Unable to create larger files than 99 size units. [Issue 20079](https://gitlab.com/wireshark/wireshark/-/issues/20079). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PRP trailer not shown for L2 IEC 61850 GOOSE packets in 4.4.0 (was working in 4.2.7) [Issue 20088](https://gitlab.com/wireshark/wireshark/-/issues/20088). +* GUI lags because NetworkManager keeps turning 802.11 monitor mode off. [Issue 20090](https://gitlab.com/wireshark/wireshark/-/issues/20090). +* Error while getting Bluetooth application process id by [Issue 20100](https://gitlab.com/wireshark/wireshark/-/issues/20100). +* Fuzz job assertion: randpkt-2024-10-05-7200.pcap. [Issue 20110](https://gitlab.com/wireshark/wireshark/-/issues/20110). + +Wireshark 4.4.0 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.0.html) +for details: + +Many improvements and fixes to the graphing dialogs, including +I/O Graphs, Flow Graph / VoIP Calls, and TCP Stream Graphs. + +Wireshark now supports automatic profile switching. +You can associate a display filter with a configuration profile, and when you open a capture file that matches the filter, Wireshark will automatically switch to that profile. + +Support for Lua 5.3 and 5.4 has been added, and support for Lua 5.1 and 5.2 has been removed. +The Windows and macOS installers now ship with Lua 5.4.6. + +Improved display filter support for value strings (optional string representations for numeric fields). + +Display filter functions can be implemented as plugins, similar to protocol dissectors and file parsers. + +Display filters can be translated to pcap filters using **Edit** **›** **Copy** **›** **Display filter as pcap filter** if each display filter field has a corresponding pcap filter equivalent. + +Custom columns can be defined using any valid field expression, such as +display filter functions, packet slices, arithmetic calculations, logical tests, +raw byte addressing, and protocol layer modifiers. + +Custom output fields for `tshark -e` can also be defined using any +valid field expression. + +Wireshark can be built with the zlib-ng instead of zlib for compressed file support. +Zlib-ng is substantially faster than zlib. +The official Windows and macOS packages include this feature. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on [the mailing list site](https://lists.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## Getting Certified + +You can become a Wireshark Certified Analyst! +Learn more at + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_449.md b/corpus/changelog/wireshark_releases/wireshark_449.md new file mode 100644 index 0000000000000000000000000000000000000000..adec54eb0ee239ff4832a14c1d2cadf7e545e642 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_449.md @@ -0,0 +1,317 @@ +# Wireshark 4.4.9 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.4.9.html +Version: 4.4.9 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work! +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## What’s New + +### Bug Fixes + +* [wnpa-sec-2025-03](https://www.wireshark.org/security/wnpa-sec-2025-03) + SSH dissector crash. + [Issue 20642](https://gitlab.com/wireshark/wireshark/-/issues/20642). + +The following bugs have been fixed: + +* RDM Product Detail List ID Disect incorrect. [Issue 20612](https://gitlab.com/wireshark/wireshark/-/issues/20612). +* SCCP LUDT segmentation decoding fails. [Issue 20647](https://gitlab.com/wireshark/wireshark/-/issues/20647). +* Ciscodump fails to start capture on Cisco IOS. [Issue 20655](https://gitlab.com/wireshark/wireshark/-/issues/20655). +* [BACnet] WritePropertyMultiple closing context tag 1 not showing. [Issue 20665](https://gitlab.com/wireshark/wireshark/-/issues/20665). +* Bug in LZ77 decoder; reads a 16-bit length when it should read a 32-bit length. [Issue 20671](https://gitlab.com/wireshark/wireshark/-/issues/20671). + +### New and Updated Features + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +BACapp, LIN, MySQL, RDM, SABP, SCCP, sFlow, and SSH + +### New and Updated Capture File Support + +There is no new or updated capture file support in this release. + +### Updated File Format Decoding Support + +There is no updated file format support in this release. + +## Prior Versions + +Wireshark 4.4.8 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.8.html) +for details: + +* Renegotiated DTLS session is not being decrypted. [Issue 20362](https://gitlab.com/wireshark/wireshark/-/issues/20362). +* Wireshark is completely stuck in initialization because androiddump recv() is blocked. [Issue 20526](https://gitlab.com/wireshark/wireshark/-/issues/20526). +* Fuzz job UTF-8 encoding issue: fuzz-2025-06-20-7318.pcap. [Issue 20585](https://gitlab.com/wireshark/wireshark/-/issues/20585). +* Crash when showing packet in new window after reloading Lua plugins with a certain gui.column.format preference. [Issue 20588](https://gitlab.com/wireshark/wireshark/-/issues/20588). +* Bug in UDS dissector with Service ReadDataByPeriodicIdentifier Response. [Issue 20589](https://gitlab.com/wireshark/wireshark/-/issues/20589). +* Packet diagram doesn’t show non-standard field value representations. [Issue 20590](https://gitlab.com/wireshark/wireshark/-/issues/20590). +* Packet diagram shows representation twice when field type is FT\_NONE. [Issue 20601](https://gitlab.com/wireshark/wireshark/-/issues/20601). +* application/x-www-form-urlencoded key parsed incorrectly following a name-value byte sequence with no '=' [Issue 20615](https://gitlab.com/wireshark/wireshark/-/issues/20615). +* DNP3 time stamp was unable to work after epoch time(year 2038) [Issue 20618](https://gitlab.com/wireshark/wireshark/-/issues/20618). + +Wireshark 4.4.7 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.7.html) +for details: + +* [wnpa-sec-2025-02](https://www.wireshark.org/security/wnpa-sec-2025-02) + Dissection engine crash. + [Issue 20509](https://gitlab.com/wireshark/wireshark/-/issues/20509). + [CVE-2025-5601](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-5601). +* Wireshark does not correctly decode LIN "go to sleep" in TECMP and CMP. [Issue 20463](https://gitlab.com/wireshark/wireshark/-/issues/20463). +* Dissector bug, Protocol CIGI. [Issue 20496](https://gitlab.com/wireshark/wireshark/-/issues/20496). +* Green power packets are not dissected when proto\_version == ZBEE\_VERSION\_GREEN\_POWER. [Issue 20497](https://gitlab.com/wireshark/wireshark/-/issues/20497). +* Packet diagrams misalign or drop bitfields. [Issue 20507](https://gitlab.com/wireshark/wireshark/-/issues/20507). +* Corruption when setting heuristic dissector table UI name from Lua. [Issue 20523](https://gitlab.com/wireshark/wireshark/-/issues/20523). +* LDAP dissector incorrectly displays filters with singleton "&" [Issue 20527](https://gitlab.com/wireshark/wireshark/-/issues/20527). +* WebSocket per-message compression extentions: fail to decompress server messages (from the 2nd) due to parameter handling. [Issue 20531](https://gitlab.com/wireshark/wireshark/-/issues/20531). +* The LL\_PERIODIC\_SYNC\_WR\_IND packet is not properly dissected (packet-btle.c) [Issue 20554](https://gitlab.com/wireshark/wireshark/-/issues/20554). + +Wireshark 4.4.6 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.6.html) +for details: + +* Bug in EtherCAT dissector with ECS order. [Issue 13718](https://gitlab.com/wireshark/wireshark/-/issues/13718). +* Conversation dialog columns return to default width on each new packet in live capture. [Issue 15978](https://gitlab.com/wireshark/wireshark/-/issues/15978). +* Tests fail in LTO-enabled builds in Ubuntu/Debian. [Issue 18216](https://gitlab.com/wireshark/wireshark/-/issues/18216). +* Incorrect conditions in BFCP dissector. [Issue 18717](https://gitlab.com/wireshark/wireshark/-/issues/18717). +* Static build fails on Ubuntu 24.04 because the c-ares library isn’t found. [Issue 20343](https://gitlab.com/wireshark/wireshark/-/issues/20343). +* Flutter’s Image Picker Generated JPEG Files Detected as Malformed Packet. [Issue 20355](https://gitlab.com/wireshark/wireshark/-/issues/20355). +* QUIC dissector breaks when src and dst change. [Issue 20371](https://gitlab.com/wireshark/wireshark/-/issues/20371). +* s390x: build fail on Ubuntu PPA nighty build. [Issue 20372](https://gitlab.com/wireshark/wireshark/-/issues/20372). +* Trailing octet after IPv4 packet end is not detected or displayed in raw bytes. [Issue 20423](https://gitlab.com/wireshark/wireshark/-/issues/20423). +* [packet-ax25-nol3.c] Only call APRS dissector on UI Frames. [Issue 20429](https://gitlab.com/wireshark/wireshark/-/issues/20429). +* Wireshark hangs when refreshing interfaces with the debug console preference set to "always" and a file open (Windows) [Issue 20434](https://gitlab.com/wireshark/wireshark/-/issues/20434). +* BGP EVPN - Type-8 route not correctly read after addition of Max. Response Time field. [Issue 20459](https://gitlab.com/wireshark/wireshark/-/issues/20459). +* Wireshark does not correctly decode LIN "go to sleep" in TECMP and CMP. [Issue 20463](https://gitlab.com/wireshark/wireshark/-/issues/20463). +* MQTT-SN: WILLTOPIC message not decoded correctly (missing some flags) [Issue 20476](https://gitlab.com/wireshark/wireshark/-/issues/20476). + +Wireshark 4.4.5 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.5.html) +for details: + +* GRPC: protobuf\_json only displays the truncated string value. [Issue 20392](https://gitlab.com/wireshark/wireshark/-/issues/20392). +* Wireshark crashes when clicking on a column title/header. [Issue 20403](https://gitlab.com/wireshark/wireshark/-/issues/20403). + +Wireshark 4.4.4 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.4.html) +for details: + +* [wnpa-sec-2025-01](https://www.wireshark.org/security/wnpa-sec-2025-01) + Bundle Protocol and CBOR dissector {crash,infinite loop,memory leak}. + [Issue 20373](https://gitlab.com/wireshark/wireshark/-/issues/20373). +* Crash when sorting columns during capture with display filter active. [Issue 20263](https://gitlab.com/wireshark/wireshark/-/issues/20263). +* OSS-Fuzz 384757274: Invalid-bool-value in dissect\_tcp. [Issue 20300](https://gitlab.com/wireshark/wireshark/-/issues/20300). +* Test failure in 4.4.2/4.4.3: test\_sharkd\_req\_follow\_http2. [Issue 20330](https://gitlab.com/wireshark/wireshark/-/issues/20330). +* Regression in extcap interface toolbar. [Issue 20354](https://gitlab.com/wireshark/wireshark/-/issues/20354). +* Clicking outside columns in TCP tab of Statistics → Conversations window causes crash. [Issue 20357](https://gitlab.com/wireshark/wireshark/-/issues/20357). +* FTBFS with Ubuntu development (25.04) release. [Issue 20359](https://gitlab.com/wireshark/wireshark/-/issues/20359). +* DNS enable\_qname\_stats crash Wireshark when QDCOUNT == 0. [Issue 20367](https://gitlab.com/wireshark/wireshark/-/issues/20367). +* Windows: Android extcap plugin fails with "Broken socket connection" if there are no new packets for 2sec. [Issue 20386](https://gitlab.com/wireshark/wireshark/-/issues/20386). +* TECMP: Calculation of lifecycle start in Status message is wrong. [Issue 20387](https://gitlab.com/wireshark/wireshark/-/issues/20387). +* MQTT v5.0 properties total length presentation is incorrect. [Issue 20389](https://gitlab.com/wireshark/wireshark/-/issues/20389). +* TShark doesn’t resolve addresses in custom "hosts" files. [Issue 20391](https://gitlab.com/wireshark/wireshark/-/issues/20391). +* Incorrect JA4 fingerprint with empty ciphers. [Issue 20394](https://gitlab.com/wireshark/wireshark/-/issues/20394). + +Wireshark 4.4.3 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.3.html) +for details: + +* Potential mis-match in GSM MAP dissector for uncertainty radius and its filter key. [Issue 20247](https://gitlab.com/wireshark/wireshark/-/issues/20247). +* Macro eNodeB ID and Extended Macro eNodeB ID not decoded by User Location Information. [Issue 20276](https://gitlab.com/wireshark/wireshark/-/issues/20276). +* The NFSv2 Dissector appears to be swapping Character Special File and Directory in mode decoding. [Issue 20290](https://gitlab.com/wireshark/wireshark/-/issues/20290). +* CMake discovers Strawberry Perl’s zlib DLL when it shouldn’t. [Issue 20304](https://gitlab.com/wireshark/wireshark/-/issues/20304). +* VOIP Calls call flow displaying hours. [Issue 20311](https://gitlab.com/wireshark/wireshark/-/issues/20311). +* Fuzz job issue: fuzz-2024-12-26-7898.pcap. [Issue 20313](https://gitlab.com/wireshark/wireshark/-/issues/20313). +* sFlow: Incorrect length passed to header sample dissector. [Issue 20320](https://gitlab.com/wireshark/wireshark/-/issues/20320). +* wsutil: Should link against -lm due to missing fabs() when built with -fno-builtin. [Issue 20326](https://gitlab.com/wireshark/wireshark/-/issues/20326). + +Wireshark 4.4.2 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.2.html) +for details: + +* [wnpa-sec-2024-14](https://www.wireshark.org/security/wnpa-sec-2024-14) + FiveCo RAP dissector infinite loop. + [Issue 20176](https://gitlab.com/wireshark/wireshark/-/issues/20176). +* [wnpa-sec-2024-15](https://www.wireshark.org/security/wnpa-sec-2024-15) + ECMP dissector crash. + [Issue 20214](https://gitlab.com/wireshark/wireshark/-/issues/20214). +* CIP I/O is not detected by "enip" filter anymore. [Issue 19517](https://gitlab.com/wireshark/wireshark/-/issues/19517). +* Fuzz job issue: fuzz-2024-09-03-7550.pcap. [Issue 20041](https://gitlab.com/wireshark/wireshark/-/issues/20041). +* OSS-Fuzz 71476: wireshark:fuzzshark\_ip\_proto-udp: Index-out-of-bounds in DOFObjectID\_Create\_Unmarshal. [Issue 20065](https://gitlab.com/wireshark/wireshark/-/issues/20065). +* JA4\_c hashes an empty field to e3b0c44298fc when it should be 000000000000. [Issue 20066](https://gitlab.com/wireshark/wireshark/-/issues/20066). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PTP analysis loses track of message associations in case of sequence number resets. [Issue 20099](https://gitlab.com/wireshark/wireshark/-/issues/20099). +* USB CCID: response packet in case SetParameters command is unsupported is flagged as malformed. [Issue 20107](https://gitlab.com/wireshark/wireshark/-/issues/20107). +* dumpcap crashes when run from TShark with a capture filter. [Issue 20108](https://gitlab.com/wireshark/wireshark/-/issues/20108). +* SRT dissector: The StreamID (SID) in the handshake extension is displayed without regarding the control characters and with NUL as terminating. [Issue 20113](https://gitlab.com/wireshark/wireshark/-/issues/20113). +* Ghost error message on POP3 packets. [Issue 20124](https://gitlab.com/wireshark/wireshark/-/issues/20124). +* Building against c-ares 1.34 fails. [Issue 20125](https://gitlab.com/wireshark/wireshark/-/issues/20125). +* D-Bus is not optional anymore. [Issue 20126](https://gitlab.com/wireshark/wireshark/-/issues/20126). +* macOS Intel DMGs aren’t fully notarized. [Issue 20129](https://gitlab.com/wireshark/wireshark/-/issues/20129). +* Incorrect name for MLD Capabilities and Operations Present flag in dissection of MLD Capabilities for MLO wifi-7 capture. [Issue 20134](https://gitlab.com/wireshark/wireshark/-/issues/20134). +* CQL Malformed Packet v4 S → C Type RESULT: Prepared[Malformed Packet] [Issue 20142](https://gitlab.com/wireshark/wireshark/-/issues/20142). +* Wi-Fi: 256 Block Ack (BA) is not parsed properly. [Issue 20156](https://gitlab.com/wireshark/wireshark/-/issues/20156). +* BACnet ReadPropertyMultiple request Maximum allowed recursion depth reached. [Issue 20159](https://gitlab.com/wireshark/wireshark/-/issues/20159). +* Statistics→I/O Graph crashes when using simple moving average. [Issue 20163](https://gitlab.com/wireshark/wireshark/-/issues/20163). +* HTTP2 body decompression fails on DATA with a single padded frame. [Issue 20167](https://gitlab.com/wireshark/wireshark/-/issues/20167). +* Compiler warning for ui/tap-rtp-common.c (ignoring return value) [Issue 20169](https://gitlab.com/wireshark/wireshark/-/issues/20169). +* SIP dissector bug due to "be-route" param in VIA header. [Issue 20173](https://gitlab.com/wireshark/wireshark/-/issues/20173). +* Coredump after trying to open 'Follow TCP stream' [Issue 20174](https://gitlab.com/wireshark/wireshark/-/issues/20174). +* Protobuf JSON mapping error. [Issue 20182](https://gitlab.com/wireshark/wireshark/-/issues/20182). +* Display filter "!stp.pvst.origvlan in { vlan.id }" causes a crash (Version 4.4.1) [Issue 20183](https://gitlab.com/wireshark/wireshark/-/issues/20183). +* Extcap plugins shipped with Wireshark Portable are not found in version 4.4.1. [Issue 20184](https://gitlab.com/wireshark/wireshark/-/issues/20184). +* IEEE 802.11be: Wrong regulatory info in HE Operation IE in Beacon frame. [Issue 20187](https://gitlab.com/wireshark/wireshark/-/issues/20187). +* Wireshark 4.4.1 does not decode RTCP packets. [Issue 20188](https://gitlab.com/wireshark/wireshark/-/issues/20188). +* Qt: Display filter sub-menu can only be opened on the triangle, not the full name. [Issue 20190](https://gitlab.com/wireshark/wireshark/-/issues/20190). +* Qt: Changing the display filter does not update the Conversations or Endpoints dialogs. [Issue 20191](https://gitlab.com/wireshark/wireshark/-/issues/20191). +* MODBUS Dissector bug. [Issue 20192](https://gitlab.com/wireshark/wireshark/-/issues/20192). +* Modbus dissector bug - Field Occurence and Layer Operator modbus.bitval field. [Issue 20193](https://gitlab.com/wireshark/wireshark/-/issues/20193). +* Wireshark crashes when a field is dragged from packet details towards the find input. [Issue 20204](https://gitlab.com/wireshark/wireshark/-/issues/20204). +* Lua DissectorTable("") : set ("10,11") unexpected behavior in locales with comma as decimal separator. [Issue 20216](https://gitlab.com/wireshark/wireshark/-/issues/20216). + +The TCP dissector no longer falls back to using the client port as a criterion for selecting a payload dissector when the server port does not select a payload dissector (except for port 20, active FTP). +This behavior can be changed using the "Client port dissectors" preference. + +Display filters now correctly handle floating point conversion errors. + +The Lua API now has better support for comma-separated ranges in different locales. + +Wireshark 4.4.1 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.1.html) +for details: + +* [wnpa-sec-2024-12](https://www.wireshark.org/security/wnpa-sec-2024-12) + ITS dissector crash. + [Issue 20026](https://gitlab.com/wireshark/wireshark/-/issues/20026). +* [wnpa-sec-2024-13](https://www.wireshark.org/security/wnpa-sec-2024-13) + AppleTalk and RELOAD Framing dissector crashes. + [Issue 20114](https://gitlab.com/wireshark/wireshark/-/issues/20114). +* Refresh interface during live-capture leads to corrupt interface handling. [Issue 11176](https://gitlab.com/wireshark/wireshark/-/issues/11176). +* Media type "application/octet-stream" registered for both Thread and UASIP. [Issue 14729](https://gitlab.com/wireshark/wireshark/-/issues/14729). +* Extcap toolbar stops working when new interface is added. [Issue 19854](https://gitlab.com/wireshark/wireshark/-/issues/19854). +* Decoding error ITS CPM version 2.1.1. [Issue 19886](https://gitlab.com/wireshark/wireshark/-/issues/19886). +* Build error in 4.3.0: sync\_pipe\_run\_command\_actual error: argument 2 is null but the corresponding size argument 3 value is 512004 [-Werror=nonnull] [Issue 19930](https://gitlab.com/wireshark/wireshark/-/issues/19930). +* html2text.py doesn’t handle the `` tag. [Issue 20020](https://gitlab.com/wireshark/wireshark/-/issues/20020). +* Incorrect NetFlow v8 TOS AS aggregation dissection. [Issue 20021](https://gitlab.com/wireshark/wireshark/-/issues/20021). +* The Windows packages don’t ship with the IP address plugin. [Issue 20030](https://gitlab.com/wireshark/wireshark/-/issues/20030). +* O\_PATH is Linux-and-FreeBSD-specific. [Issue 20031](https://gitlab.com/wireshark/wireshark/-/issues/20031). +* Wireshark 4.4.0 doesn’t install USBcap USBcapCMD.exe in the correct directory. [Issue 20040](https://gitlab.com/wireshark/wireshark/-/issues/20040). +* OER dissector is not considering the preamble if ASN.1 SEQUENCE definition includes extension marker but no OPTIONAL items. [Issue 20044](https://gitlab.com/wireshark/wireshark/-/issues/20044). +* Bluetooth classic L2CAP incorrect dissection with connectionless reception channel. [Issue 20047](https://gitlab.com/wireshark/wireshark/-/issues/20047). +* Profile auto switch filters : Grayed Display Filter Expression dialog box when opened from Configuration Profiles dialog box. [Issue 20049](https://gitlab.com/wireshark/wireshark/-/issues/20049). +* Wireshark 4.4.0 / macOS 14.6.1 wifi if monitor mode. [Issue 20051](https://gitlab.com/wireshark/wireshark/-/issues/20051). +* TECMP Data Type passes too much data to sub dissectors. [Issue 20052](https://gitlab.com/wireshark/wireshark/-/issues/20052). +* Wireshark and tshark 4.4.0 ignore extcap options specified on the command line. [Issue 20054](https://gitlab.com/wireshark/wireshark/-/issues/20054). +* Cannot open release notes due to incorrect path with duplicated directory components. [Issue 20055](https://gitlab.com/wireshark/wireshark/-/issues/20055). +* Unable to open "Release Notes" from the "Help" menu. [Issue 20056](https://gitlab.com/wireshark/wireshark/-/issues/20056). +* No capture interfaces if Wireshark is started from command line with certain paths. [Issue 20057](https://gitlab.com/wireshark/wireshark/-/issues/20057). +* Wireshark 4.4.0 extcap path change breaks third party extcap installers. [Issue 20069](https://gitlab.com/wireshark/wireshark/-/issues/20069). +* Fuzz job UTF-8 encoding issue: fuzz-2024-09-10-7618.pcap. [Issue 20071](https://gitlab.com/wireshark/wireshark/-/issues/20071). +* Unable to create larger files than 99 size units. [Issue 20079](https://gitlab.com/wireshark/wireshark/-/issues/20079). +* Opening Wireshark 4.4.0 on macOS 15.0 disconnects iPhone Mirroring. [Issue 20082](https://gitlab.com/wireshark/wireshark/-/issues/20082). +* PRP trailer not shown for L2 IEC 61850 GOOSE packets in 4.4.0 (was working in 4.2.7) [Issue 20088](https://gitlab.com/wireshark/wireshark/-/issues/20088). +* GUI lags because NetworkManager keeps turning 802.11 monitor mode off. [Issue 20090](https://gitlab.com/wireshark/wireshark/-/issues/20090). +* Error while getting Bluetooth application process id by [Issue 20100](https://gitlab.com/wireshark/wireshark/-/issues/20100). +* Fuzz job assertion: randpkt-2024-10-05-7200.pcap. [Issue 20110](https://gitlab.com/wireshark/wireshark/-/issues/20110). + +Wireshark 4.4.0 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.4.0.html) +for details: + +Many improvements and fixes to the graphing dialogs, including +I/O Graphs, Flow Graph / VoIP Calls, and TCP Stream Graphs. + +Wireshark now supports automatic profile switching. +You can associate a display filter with a configuration profile, and when you open a capture file that matches the filter, Wireshark will automatically switch to that profile. + +Support for Lua 5.3 and 5.4 has been added, and support for Lua 5.1 and 5.2 has been removed. +The Windows and macOS installers now ship with Lua 5.4.6. + +Improved display filter support for value strings (optional string representations for numeric fields). + +Display filter functions can be implemented as plugins, similar to protocol dissectors and file parsers. + +Display filters can be translated to pcap filters using **Edit** **›** **Copy** **›** **Display filter as pcap filter** if each display filter field has a corresponding pcap filter equivalent. + +Custom columns can be defined using any valid field expression, such as +display filter functions, packet slices, arithmetic calculations, logical tests, +raw byte addressing, and protocol layer modifiers. + +Custom output fields for `tshark -e` can also be defined using any +valid field expression. + +Wireshark can be built with the zlib-ng instead of zlib for compressed file support. +Zlib-ng is substantially faster than zlib. +The official Windows and macOS packages include this feature. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on [the mailing list site](https://lists.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## Getting Certified + +You can become a Wireshark Certified Analyst! +Learn more at + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_460.md b/corpus/changelog/wireshark_releases/wireshark_460.md new file mode 100644 index 0000000000000000000000000000000000000000..f3d7d02c3d509dc9ced95b370539ce2105060031 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_460.md @@ -0,0 +1,244 @@ +# Wireshark 4.6.0 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.6.0.html +Version: 4.6.0 + +This is the first release of the 4.6 branch. + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +Official Wireshark training and certification are available from +[the Wireshark Foundation](https://www.wireshark.org/certifications). + +## What’s New + +Many other improvements have been made. +See the “New and Updated Features” section below for more details. + +### New and Updated Features + +The following features are new (or have been significantly updated) since version 4.6.0rc1: + +* Wireshark can dissect process information, packet metadata, flow IDs, drop information, and other information provided by `tcpdump` on macOS. + +The following features are either new or have been significantly updated since version 4.4.0: + +* The Windows installers now ship with Npcap 1.83. + They previously shipped with Npcap 1.79. +* The Windows and macOS installers now ship with Qt 6.9.3. + They previously shipped with Qt 6.5.3. +* We now ship universal macOS installers instead of separate packages for Arm64 and Intel. [Issue 17294](https://gitlab.com/wireshark/wireshark/-/issues/17294) +* WinPcap is no longer supported. On Windows, use Npcap instead, uninstalling WinPcap if necessary. + The final release of WinPcap was version 4.1.3 in 2013. + It only supports up to Windows 8, which is no longer supported by Microsoft or Wireshark. +* A new “Plots” dialog has been added, which provides scatter plots in contrast to the “I/O Graphs” dialog, which provides histograms. + The Plots dialog window supports multiple plots, markers, and automatic scrolling. +* Live captures can be compressed while writing. (Previously there was + support for compressing when performing multiple file capture, at file + rotation time.) The `--compress` option in TShark works on live captures + as well. [Issue 9311](https://gitlab.com/wireshark/wireshark/-/issues/9311) +* Absolute time fields, regardless of field display in the Packet Details, + are always written in ISO 8601 format in UTC with -T json. This was already + the case for -T ek since version 4.2.0. JSON is primarily a data interchange + format read by software, so a standard format is desirable. +* When absolute times field are output with -T fields, the "show" field of -T + pdml, or in custom columns (including CSV output of columns), the formatting + similar to asctime (e.g., Dec 18, 2017 05:28:39.071704055 EST) has been + deprecated in favor of ISO 8601. For backwards compatibility, a preference + has been added, protocols.display\_abs\_time\_ascii, which can be set to continue + to format times as before. This preference can also be set to never use ASCII + time and to use ISO 8601 time formatting in the protocol tree (Packet Details) + as well. It is possible that a future release will remove the ascitime style + formatting entirely. +* UTC frame time column formats (including "Time (format as specified)" when + a UTC time display format is selected) have a "Z" suffix per ISO 8601. Local + time formats remain unqualified (including if the local time zone is UTC.) + Custom columns displaying FT\_ABSOLUTE\_TIME already had time zone indication. +* The TShark `-G` option for generating glossary reports does not need to be the + first option given on the command line anymore. In addition, the reports now + are affected by other command line options such as `-o`, `-d`, and + `--disable-protocol`, in addition to the `-C` option, which was already supported. + (The `defaultprefs` report remains unaffected by any other options.) + As a part of this change, `-G` with no argument, which was previously deprecated, + is no longer supported. Use `tshark -G fields` to produce the same report. + Also, the syntax for only listing fields with a certain prefix has changed to + `tshark -G fields,prefix`. +* The underlying type of EUI-64 fields has been switched to bytes when packet + matching, similar to most other address formats. This means that EUI-64 + addresses can be sliced and compared to other bytes types, e.g. the filter + `wpan.src64[:3] == eth.src[:3]`. Fields can still be specified using 64-bit + unsigned integer literals, though arithmetic with other integers is no longer + supported. +* Wireshark can now decrypt NTP packets using NTS (Network Time Security). To decrypt packets, + the NTS-KE (Network Time Security Key Establishment Protocol) packets need to be present, + alongside the TLS client and exporter secrets. Additionally, the parts of a NTP packet which + can be cryptographically authenticated (from NTP packet header until the end of the last + extension field that precedes the NTS Authenticator and Encrypted Extension Fields + extension field) are checked for validity. +* Wireshark’s ability to decrypt MACsec packets has been expanded to either + use the SAK unwrapped by the MKA dissector, or the PSK configured in the + MACsec dissector. To enable the MKA dissector to unwrap the SAK, the CAK for + the applicable CKN can be entered in the extended CKN/CAK Info UAT in the + MKA dissector preferences. The ability of the MACsec dissector to decrypt + packets using a PSK has been extended to a list of PSKs, which can entered + through a new UAT. +* The TCP Stream Graph axes now use units with SI prefixes. [Issue 20197](https://gitlab.com/wireshark/wireshark/-/issues/20197) +* Custom columns have an option to show the values using the same format as + in Packet Details. +* Custom column complex expressions (e.g., with arithmetic, filter functions, + etc.) that return numeric results are sorted numerically instead of + lexicographically. +* Display filter functions `float` and `double` are added to allow explicitly + converting field types like integers and times to single and double precision + floats. They can be used to perform further arithmetic operations on fields + of different types, including in custom column definitions. +* The minimum width of the I/O Graph dialog window has been reduced, so it should + work better on small resolution desktops, especially in certain languages. + To enable this, some checkbox controls were moved to the graph right-click + context menu. [Issue 20147](https://gitlab.com/wireshark/wireshark/-/issues/20147) +* X.509 certificates, used in TLS and elsewhere, can be exported via the + **File** **›** **Export Objects** menu in Wireshark (under the name "X509AF") and + `--export-objects` in TShark (with the protocol name `x509af`.) +* Zstandard Content-Encoding is supported in the HTTP and HTTP/2 dissectors. +* Follow Stream is supported for MPEG 2 Transport Stream PIDs, and for + Packetized Elementary Streams contained within MPEG 2 TS. The latter + can be used to extract audio or video for playback with other tools. +* DNP 3 (Distributed Network Protocol 3) is now supported in the Conversations + and Endpoints table dialogs. +* The Lua supplied preloaded libraries `bit` and `rex_pcre2` are loaded in + a way that adds them to the `package.loaded` table, as though through + `require`, so that `require("bit")` and `require("rex_pcre2")` statements + in Lua dissectors, while usually superfluous, behave as expected. [Issue 20213](https://gitlab.com/wireshark/wireshark/-/issues/20213) +* The packet list (Wireshark) and event list (Stratoshark) no longer support rows with multiple lines. + [Issue 14424](https://gitlab.com/wireshark/wireshark/-/issues/14424) +* The *ethers* file can also contain EUI-64 to name mappings. [Issue 15487](https://gitlab.com/wireshark/wireshark/-/issues/15487) +* Wireshark’s "Import from Hex Dump" feature and text2pcap now support byte groups with 2 to + 4 bytes (with an option for little-endian byte order), and support hexadecimal + offsets with a `0x` or `0X` prefix (as produced by `tcpdump -x`, among others). + [Issue 16193](https://gitlab.com/wireshark/wireshark/-/issues/16193) +* Frame timestamps can be added as preamble to hex dumps in Wireshark from + the "Print" and "Export Packet Dissection" dialogs, and in TShark with + the `--hexdump time` option. [Issue 17132](https://gitlab.com/wireshark/wireshark/-/issues/17132) +* Lua now has a `Conversation` object, which exposes conversations and conversation + data to Lua. [Issue 15396](https://gitlab.com/wireshark/wireshark/-/issues/15396) +* An **Edit** **›** **Copy** **›** **as HTML** menu item has been added, along with associated context menu items and a keyboard + shortcut. It provides an option (via knobs in preferences) to copy plain + text with aligned columns along with an ability to select a copy format to be + used when copied via keyboard shortcut. +* The "no duplicate keys" version of JSON output that tshark has supported + since 2.6.0 is available through the GUI Export Dissections Dialog. + Note that this format does not necessarily preserve the ordering of all + children in a tree, if sibling with identical keys are not consecutive. +* The GUI Export Dissections Dialog can output raw hex bytes of the frame + data for each field with or without exporting the field values, the same + formats as the "-T json -x" and "-T jsonraw" output modes, respectively, + of TShark. +* The Conversations and Endpoints dialogs have an option to display byte counts + and bit rates in exact counts instead of human-readable numbers with SI units. + The default setting when opening a dialog is controlled by a Statistics + preference, "conv.machine\_readable". The same preference controls whether + precise byte counts are used in the TShark "-z conv" and "-z endpoints" taps. +* The output format for some TShark statistics taps (those selected with + "-z ,tree", which use the stats\_tree system) can be controlled via + a preference "-o statistics.output\_format". +* The color scheme can be set to Light or Dark mode independently of the + current OS default on Windows and macOS, if Wireshark is built with + Qt 6.8 or later as the official installers are. [Issue 19328](https://gitlab.com/wireshark/wireshark/-/issues/19328) +* libxml2 is now a required dependency. + Note that Wireshark will not build with libxml2 2.15.0, but other versions should work. +* The **View** menu has an option to Redissect Packets manually, which can be useful + when address resolution or decryption secrets have changed. +* HTTP2 tracking of 3GPP session over 5G Service Based Interfaces is now optional + available. When enabled "Associate IMSI" will be add on HTTP2 streams which + has been found belong to a session. +* Building the documentation on Windows no longer requires Java. +* On Linux, capture filters that use BPF extensions like "inbound", "outbound", + and "ifindex" can be used for capturing (and compiled by the Compiled Filter + dialog). Instead of always being rejected by the syntax checker, they will be + marked as unknown. + +### Removed Features and Support + +Wireshark no longer supports AirPcap and WinPcap. + +Wireshark no longer supports libnl versions 1 or 2. + +The `ENABLE_STATIC` CMake option has been deprecated in favor of `BUILD_SHARED_LIBS` + +### New File Format Decoding Support + +Resource Interchange File Format (RIFF) and TTL File Format + +### New Protocol Support + +Asymmetric Key Packages (AKP), Binary HTTP, BIST TotalView-ITCH protocol (BIST-ITCH), BIST TotalView-OUCH protocol (BIST-OUCH), Bluetooth Android HCI (HCI ANDROID), Bluetooth Intel HCI (HCI INTEL), BPSec COSE Context, BPSec Default SC, Commsignia Capture Protocol (C2P), DECT NR+ (DECT-2020 New Radio), DLMS/COSEM, Ephemeral Diffie-Hellman Over COSE, Identifier-Locator Network Protocol (ILNP), LDA Neo Device trailer (LDA\_NEO\_TRAILER), Lenbrook Service Discovery Protocol (LSDP), LLC V1, Navitrol messaging, Network Time Security Key Establishment Protocol (NTS-KE), Ouster VLP-16, Private Line Emulation (PLE), RC V3, RCG, Roughtime, SBAS L5 Navigation Message, SGP.22 GSMA Remote SIM Provisioning (SGP.22), SGP.32 GSMA Remote SIM Provisioning (SGP.32), SICK CoLA Ascii and CoLA Binary protocols, Silabs Debug Channel, Universal Measurement and Calibration Protocol (XCP), USB Picture Transfer Protocol (USB-PTP), VLP-16 Data and Position messaging, and vSomeIP Internal Protocol (vSomeIP) + +### Updated Protocol Support + +Too many protocol updates have been made to list them all here. + +## New and Updated Capture File Support + +BLF is now improved (including writing to BLF) + +### New and Updated Capture Interfaces support + +* On Windows, etwdump’s user-friendliness has been greatly improved + thanks to various extcap changes. It should also now display the + raw bytes of unknown events. + +### Major API Changes + +The Lua API now supports Libgcrypt symmetric cipher functions. + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on [the mailing list site](https://lists.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_461.md b/corpus/changelog/wireshark_releases/wireshark_461.md new file mode 100644 index 0000000000000000000000000000000000000000..15123a9381021cf0defa8c36a605ad33136b3733 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_461.md @@ -0,0 +1,158 @@ +# Wireshark 4.6.1 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.6.1.html +Version: 4.6.1 + +This is the first release of the 4.6 branch. + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +If you use Wireshark professionally or you just want to learn more about protocol analysis, you should join us at [SharkFest](https://sharkfest.wireshark.org/), the Wireshark developer and user conference. + +You can also become a Wireshark Certified Analyst! Official Wireshark training and certification are available from +[the Wireshark Foundation](https://www.wireshark.org/certifications). + +## What’s New + +### Bug Fixes + +* [wnpa-sec-2025-05](https://www.wireshark.org/security/wnpa-sec-2025-05) + BPv7 dissector crash. + [Issue 20770](https://gitlab.com/wireshark/wireshark/-/issues/20770). +* [wnpa-sec-2025-06](https://www.wireshark.org/security/wnpa-sec-2025-06) + Kafka dissector crash. + [Issue 20823](https://gitlab.com/wireshark/wireshark/-/issues/20823). + +The following bugs have been fixed: + +* L2CAP dissector doesn’t understand retransmission mode. [Issue 2241](https://gitlab.com/wireshark/wireshark/-/issues/2241). +* DNS HIP dissector labels PK algorithm as HIT length. [Issue 20768](https://gitlab.com/wireshark/wireshark/-/issues/20768). +* clang-cl error in "packet-zbee-direct.c" [Issue 20776](https://gitlab.com/wireshark/wireshark/-/issues/20776). +* Writing to an LZ4-compressed output file might fail. [Issue 20779](https://gitlab.com/wireshark/wireshark/-/issues/20779). +* endian.h conflics with libc for building plugins. [Issue 20786](https://gitlab.com/wireshark/wireshark/-/issues/20786). +* TShark crash caused by Lua plugin. [Issue 20794](https://gitlab.com/wireshark/wireshark/-/issues/20794). +* Wireshark stalls for a few seconds when selecting specific messages. [Issue 20797](https://gitlab.com/wireshark/wireshark/-/issues/20797). +* TLS Abbreviated Handshake Using New Session Ticket. [Issue 20802](https://gitlab.com/wireshark/wireshark/-/issues/20802). +* Custom websocket dissector does not run. [Issue 20803](https://gitlab.com/wireshark/wireshark/-/issues/20803). +* WINREG QueryValue triggers dissector bug in packet-dcerpc.c. [Issue 20813](https://gitlab.com/wireshark/wireshark/-/issues/20813). +* Lua: FileHandler causing crash when reading packets. [Issue 20817](https://gitlab.com/wireshark/wireshark/-/issues/20817). +* Apply As Filter for field with FT\_NONE and BASE\_NONE for a single byte does not use the hex value. [Issue 20818](https://gitlab.com/wireshark/wireshark/-/issues/20818). +* Layout preference Pane 3 problem with selecting Packet Diagram or None. [Issue 20819](https://gitlab.com/wireshark/wireshark/-/issues/20819). +* TCP dissector creates invalid packet diagram. [Issue 20820](https://gitlab.com/wireshark/wireshark/-/issues/20820). +* Too many nested VLAN tags when opening as File Format. [Issue 20831](https://gitlab.com/wireshark/wireshark/-/issues/20831). +* Omnipeek files not working in 4.6.0. [Issue 20842](https://gitlab.com/wireshark/wireshark/-/issues/20842). +* Support UTF-16 strings in the IsoBus dissector for the string operations. [Issue 20845](https://gitlab.com/wireshark/wireshark/-/issues/20845). +* SNMP getBulkRequest request-id does not get filtered for correctly. [Issue 20849](https://gitlab.com/wireshark/wireshark/-/issues/20849). +* Fuzz job issue: fuzz-2025-11-12-12064814316.pcap. [Issue 20852](https://gitlab.com/wireshark/wireshark/-/issues/20852). +* UDP Port 853 (DoQ) should be decoded as QUIC. [Issue 20856](https://gitlab.com/wireshark/wireshark/-/issues/20856). + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +802.11 Radiotap, AC DR, ASN.1 BER, ASN.1 PER, BPv7, BT L2CAP, CFM, Darwin, DNS, DTLS, EAPOL-MKA, HTTP, HTTP3, ISObus VT, KRB5, LTP, NAS-EPS, NETDFS, NMEA 0183, P1, RPC\_NETLOGON, RTSE, SGP.22, SGP.32, SMB, SNMP, TCP, TECMP, TFTP, VLAN, WINREG, X509AF, X509SAT, and ZBD + +### New and Updated Capture File Support + +Peektagged + +### New and Updated File Format Decoding Support + +There is no new or updated file format support in this release. + +## Prior Versions + +Wireshark 4.6.0 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.6.0.html) +for details: + +Wireshark can dissect process information, packet metadata, flow IDs, drop information, and other information provided by `tcpdump` on macOS. + +We now ship universal macOS installers instead of separate packages for Arm64 and Intel. [Issue 17294](https://gitlab.com/wireshark/wireshark/-/issues/17294) + +WinPcap is no longer supported. On Windows, use Npcap instead, uninstalling WinPcap if necessary. +The final release of WinPcap was version 4.1.3 in 2013. +It only supports up to Windows 8, which is no longer supported by Microsoft or Wireshark. + +A new “Plots” dialog has been added, which provides scatter plots in contrast to the “I/O Graphs” dialog, which provides histograms. +The Plots dialog window supports multiple plots, markers, and automatic scrolling. + +Live captures can be compressed while writing. (Previously there was +support for compressing when performing multiple file capture, at file +rotation time.) The `--compress` option in TShark works on live captures +as well. [Issue 9311](https://gitlab.com/wireshark/wireshark/-/issues/9311) + +Wireshark can now decrypt NTP packets using NTS (Network Time Security). To decrypt packets, +the NTS-KE (Network Time Security Key Establishment Protocol) packets need to be present, +alongside the TLS client and exporter secrets. + +Wireshark’s ability to decrypt MACsec packets has been expanded to either +use the SAK unwrapped by the MKA dissector, or the PSK configured in the +MACsec dissector. + +The TCP Stream Graph axes now use units with SI prefixes. [Issue 20197](https://gitlab.com/wireshark/wireshark/-/issues/20197) + +Display filter functions `float` and `double` are added to allow explicitly +converting field types like integers and times to single and double precision +floats. + +A **Edit** **›** **Copy** **›** **as HTML** menu item has been added, along with associated context menu items and a keyboard shortcut. + +The Conversations and Endpoints dialogs have an option to display byte counts and bit rates in exact counts instead of human-readable numbers with SI units. + +The color scheme can be set to Light or Dark mode independently of the current OS default on Windows and macOS, if Wireshark is built with Qt 6.8 or later as the official installers are. [Issue 19328](https://gitlab.com/wireshark/wireshark/-/issues/19328) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on [the mailing list site](https://lists.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_462.md b/corpus/changelog/wireshark_releases/wireshark_462.md new file mode 100644 index 0000000000000000000000000000000000000000..694caec77b209618bb9c41e4416b5ac99bc589d6 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_462.md @@ -0,0 +1,178 @@ +# Wireshark 4.6.2 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.6.2.html +Version: 4.6.2 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +If you use Wireshark professionally or you just want to learn more about protocol analysis, you should join us at [SharkFest](https://sharkfest.wireshark.org/), the Wireshark developer and user conference. + +You can also become a Wireshark Certified Analyst! Official Wireshark training and certification are available from +[the Wireshark Foundation](https://www.wireshark.org/certifications). + +## What’s New + +### Bug Fixes + +This release fixes an API/ABI change that was introduced in Wireshark 4.6.1, which caused a compatibility issue with plugins built for Wireshark 4.6.0. [Issue 20881](https://gitlab.com/wireshark/wireshark/-/issues/20881). + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2025-07](https://www.wireshark.org/security/wnpa-sec-2025-07) + HTTP3 dissector crash. + [Issue 20860](https://gitlab.com/wireshark/wireshark/-/issues/20860). +* [wnpa-sec-2025-08](https://www.wireshark.org/security/wnpa-sec-2025-08) + MEGACO dissector infinite loop. + [Issue 20884](https://gitlab.com/wireshark/wireshark/-/issues/20884). + +The following bugs have been fixed: + +* ws\_base32\_decode should be named \*\_encode ? [Issue 20754](https://gitlab.com/wireshark/wireshark/-/issues/20754). +* Omnipeek files not working in 4.6.1. [Issue 20876](https://gitlab.com/wireshark/wireshark/-/issues/20876). +* Stack buffer overflow in wiretap/ber.c (ber\_open) [Issue 20878](https://gitlab.com/wireshark/wireshark/-/issues/20878). +* Plugins incompatibility between 4.6.0 & 4.6.1. [Issue 20881](https://gitlab.com/wireshark/wireshark/-/issues/20881). +* Fuzz job crash: fuzz-2025-11-30-12266121180.pcap. [Issue 20883](https://gitlab.com/wireshark/wireshark/-/issues/20883). + +### New and Updated Features + +* The Windows installers now ship with the Visual C++ Redistributable version 14.44.35112. + They previously shipped with 14.40.33807. + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +ATM PW, COSEM, COTP, DECT NR+, DMP, Fc00, GTP, HTTP3, IEEE 802.15.4, ISIS HELLO, ISOBUS, MAC-LTE, MAUSB, MEGACO, MPEG DSM-CC, OsmoTRXD, PTP, RLC, SAPDIAG, and SMTP + +### New and Updated Capture File Support + +Peektagged + +### New and Updated File Format Decoding Support + +There is no new or updated file format support in this release. + +## Prior Versions + +Wireshark 4.6.1 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.6.1.html) +for details: + +* [wnpa-sec-2025-05](https://www.wireshark.org/security/wnpa-sec-2025-05) BPv7 dissector crash. [Issue 20770](https://gitlab.com/wireshark/wireshark/-/issues/20770). +* [wnpa-sec-2025-06](https://www.wireshark.org/security/wnpa-sec-2025-06) Kafka dissector crash. [Issue 20823](https://gitlab.com/wireshark/wireshark/-/issues/20823). +* L2CAP dissector doesn’t understand retransmission mode. [Issue 2241](https://gitlab.com/wireshark/wireshark/-/issues/2241). +* DNS HIP dissector labels PK algorithm as HIT length. [Issue 20768](https://gitlab.com/wireshark/wireshark/-/issues/20768). +* clang-cl error in "packet-zbee-direct.c" [Issue 20776](https://gitlab.com/wireshark/wireshark/-/issues/20776). +* Writing to an LZ4-compressed output file might fail. [Issue 20779](https://gitlab.com/wireshark/wireshark/-/issues/20779). +* endian.h conflics with libc for building plugins. [Issue 20786](https://gitlab.com/wireshark/wireshark/-/issues/20786). +* TShark crash caused by Lua plugin. [Issue 20794](https://gitlab.com/wireshark/wireshark/-/issues/20794). +* Wireshark stalls for a few seconds when selecting specific messages. [Issue 20797](https://gitlab.com/wireshark/wireshark/-/issues/20797). +* TLS Abbreviated Handshake Using New Session Ticket. [Issue 20802](https://gitlab.com/wireshark/wireshark/-/issues/20802). +* Custom websocket dissector does not run. [Issue 20803](https://gitlab.com/wireshark/wireshark/-/issues/20803). +* WINREG QueryValue triggers dissector bug in packet-dcerpc.c. [Issue 20813](https://gitlab.com/wireshark/wireshark/-/issues/20813). +* Lua: FileHandler causing crash when reading packets. [Issue 20817](https://gitlab.com/wireshark/wireshark/-/issues/20817). +* Apply As Filter for field with FT\_NONE and BASE\_NONE for a single byte does not use the hex value. [Issue 20818](https://gitlab.com/wireshark/wireshark/-/issues/20818). +* Layout preference Pane 3 problem with selecting Packet Diagram or None. [Issue 20819](https://gitlab.com/wireshark/wireshark/-/issues/20819). +* TCP dissector creates invalid packet diagram. [Issue 20820](https://gitlab.com/wireshark/wireshark/-/issues/20820). +* Too many nested VLAN tags when opening as File Format. [Issue 20831](https://gitlab.com/wireshark/wireshark/-/issues/20831). +* Omnipeek files not working in 4.6.0. [Issue 20842](https://gitlab.com/wireshark/wireshark/-/issues/20842). +* Support UTF-16 strings in the IsoBus dissector for the string operations. [Issue 20845](https://gitlab.com/wireshark/wireshark/-/issues/20845). +* SNMP getBulkRequest request-id does not get filtered for correctly. [Issue 20849](https://gitlab.com/wireshark/wireshark/-/issues/20849). +* Fuzz job issue: fuzz-2025-11-12-12064814316.pcap. [Issue 20852](https://gitlab.com/wireshark/wireshark/-/issues/20852). +* UDP Port 853 (DoQ) should be decoded as QUIC. [Issue 20856](https://gitlab.com/wireshark/wireshark/-/issues/20856). + +Wireshark 4.6.0 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.6.0.html) +for details: + +Wireshark can dissect process information, packet metadata, flow IDs, drop information, and other information provided by `tcpdump` on macOS. + +We now ship universal macOS installers instead of separate packages for Arm64 and Intel. [Issue 17294](https://gitlab.com/wireshark/wireshark/-/issues/17294) + +WinPcap is no longer supported. On Windows, use Npcap instead, uninstalling WinPcap if necessary. +The final release of WinPcap was version 4.1.3 in 2013. +It only supports up to Windows 8, which is no longer supported by Microsoft or Wireshark. + +A new “Plots” dialog has been added, which provides scatter plots in contrast to the “I/O Graphs” dialog, which provides histograms. +The Plots dialog window supports multiple plots, markers, and automatic scrolling. + +Live captures can be compressed while writing. (Previously there was +support for compressing when performing multiple file capture, at file +rotation time.) The `--compress` option in TShark works on live captures +as well. [Issue 9311](https://gitlab.com/wireshark/wireshark/-/issues/9311) + +Wireshark can now decrypt NTP packets using NTS (Network Time Security). To decrypt packets, +the NTS-KE (Network Time Security Key Establishment Protocol) packets need to be present, +alongside the TLS client and exporter secrets. + +Wireshark’s ability to decrypt MACsec packets has been expanded to either +use the SAK unwrapped by the MKA dissector, or the PSK configured in the +MACsec dissector. + +The TCP Stream Graph axes now use units with SI prefixes. [Issue 20197](https://gitlab.com/wireshark/wireshark/-/issues/20197) + +Display filter functions `float` and `double` are added to allow explicitly +converting field types like integers and times to single and double precision +floats. + +A **Edit** **›** **Copy** **›** **as HTML** menu item has been added, along with associated context menu items and a keyboard shortcut. + +The Conversations and Endpoints dialogs have an option to display byte counts and bit rates in exact counts instead of human-readable numbers with SI units. + +The color scheme can be set to Light or Dark mode independently of the current OS default on Windows and macOS, if Wireshark is built with Qt 6.8 or later as the official installers are. [Issue 19328](https://gitlab.com/wireshark/wireshark/-/issues/19328) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on [the mailing list site](https://lists.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/changelog/wireshark_releases/wireshark_463.md b/corpus/changelog/wireshark_releases/wireshark_463.md new file mode 100644 index 0000000000000000000000000000000000000000..9ba4be96d34e62d009a593490267458cfa8c4fa6 --- /dev/null +++ b/corpus/changelog/wireshark_releases/wireshark_463.md @@ -0,0 +1,202 @@ +# Wireshark 4.6.3 Release Notes + +Source: https://www.wireshark.org/docs/relnotes/wireshark-4.6.3.html +Version: 4.6.3 + +## What is Wireshark? + +Wireshark is the world’s most popular network protocol analyzer. +It is used for troubleshooting, analysis, development and education. + +Wireshark is hosted by the Wireshark Foundation, a nonprofit which promotes protocol analysis education. +Wireshark and the foundation depend on your contributions in order to do their work. +If you or your organization would like to contribute or become a sponsor, please visit [wiresharkfoundation.org](https://wiresharkfoundation.org). + +If you use Wireshark professionally or you just want to learn more about protocol analysis, you should join us at [SharkFest](https://sharkfest.wireshark.org/), the Wireshark developer and user conference. + +You can also become a Wireshark Certified Analyst! Official Wireshark training and certification are available from +[the Wireshark Foundation](https://www.wireshark.org/certifications). + +## What’s New + +### Bug Fixes + +The following vulnerabilities have been fixed: + +* [wnpa-sec-2026-01](https://www.wireshark.org/security/wnpa-sec-2026-01) + BLF file parser crash. + [Issue 20880](https://gitlab.com/wireshark/wireshark/-/issues/20880). +* [wnpa-sec-2026-02](https://www.wireshark.org/security/wnpa-sec-2026-02) + IEEE 802.11 dissector crash. + [Issue 20939](https://gitlab.com/wireshark/wireshark/-/issues/20939). +* [wnpa-sec-2026-03](https://www.wireshark.org/security/wnpa-sec-2026-03) + SOME/IP-SD dissector crash. + [Issue 20945](https://gitlab.com/wireshark/wireshark/-/issues/20945). +* [wnpa-sec-2026-04](https://www.wireshark.org/security/wnpa-sec-2026-04) + HTTP3 dissector infinite loop. + [Issue 20944](https://gitlab.com/wireshark/wireshark/-/issues/20944). + +The following bugs have been fixed: + +* Wireshark 4.6.0 build fails on Solaris: pcapio.c:441:21: error: request for member '\_flag' in something not a structure or union. [Issue 20773](https://gitlab.com/wireshark/wireshark/-/issues/20773). +* RTP Player streams cannot be stopped. [Issue 20879](https://gitlab.com/wireshark/wireshark/-/issues/20879). +* Additional ABI/API compatibility fixes. [Issue 20881](https://gitlab.com/wireshark/wireshark/-/issues/20881). +* Missing data in pinfo→cinfo in HomePlug message CM\_ATTEN\_CHAR.IND. [Issue 20893](https://gitlab.com/wireshark/wireshark/-/issues/20893). +* maxmind\_db: crash when switching from a profile where it’s disabled to one where it’s enabled. [Issue 20903](https://gitlab.com/wireshark/wireshark/-/issues/20903). +* Compilation warning or error if CFLAGS defines \_FORTIFY\_SOURCE to other than 3 without first undefining it. [Issue 20904](https://gitlab.com/wireshark/wireshark/-/issues/20904). +* IEEE 802.11: Incorrect parsing of QoS and Mesh Control Field when the frame body contains an A-MSDU. [Issue 20905](https://gitlab.com/wireshark/wireshark/-/issues/20905). +* OSS-Fuzz 473164101: Heap-buffer-overflow in dissect\_idn\_laser\_data. [Issue 20936](https://gitlab.com/wireshark/wireshark/-/issues/20936). +* Bug in decoding 5G NAS message - Extended CAG information list IE. [Issue 20946](https://gitlab.com/wireshark/wireshark/-/issues/20946). + +### New Protocol Support + +There are no new protocols in this release. + +### Updated Protocol Support + +DCT2000, DHCP, H.248, H.265, HomePlug AV, HTTP3, IDN, IEEE 802.11, LTE RRC, NAS-5GS, PKCS12, QUIC, RTPS, SOME/IP-SD, SSH, and Thrift + +### New and Updated Capture File Support + +3GPP TS 32.423 Trace, BLF, NetScreen, and Viavi Observer + +### New and Updated File Format Decoding Support + +There is no new or updated file format support in this release. + +## Prior Versions + +Wireshark 4.6.2 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.6.2.html) +for details: + +This release fixes an API/ABI change that was introduced in Wireshark 4.6.1, which caused a compatibility issue with plugins built for Wireshark 4.6.0. [Issue 20881](https://gitlab.com/wireshark/wireshark/-/issues/20881). + +* [wnpa-sec-2025-07](https://www.wireshark.org/security/wnpa-sec-2025-07) + HTTP3 dissector crash. + [Issue 20860](https://gitlab.com/wireshark/wireshark/-/issues/20860). +* [wnpa-sec-2025-08](https://www.wireshark.org/security/wnpa-sec-2025-08) + MEGACO dissector infinite loop. + [Issue 20884](https://gitlab.com/wireshark/wireshark/-/issues/20884). +* ws\_base32\_decode should be named \*\_encode ? [Issue 20754](https://gitlab.com/wireshark/wireshark/-/issues/20754). +* Omnipeek files not working in 4.6.1. [Issue 20876](https://gitlab.com/wireshark/wireshark/-/issues/20876). +* Stack buffer overflow in wiretap/ber.c (ber\_open) [Issue 20878](https://gitlab.com/wireshark/wireshark/-/issues/20878). +* Plugins incompatibility between 4.6.0 & 4.6.1. [Issue 20881](https://gitlab.com/wireshark/wireshark/-/issues/20881). +* Fuzz job crash: fuzz-2025-11-30-12266121180.pcap. [Issue 20883](https://gitlab.com/wireshark/wireshark/-/issues/20883). +* The Windows installers now ship with the Visual C++ Redistributable version 14.44.35112. + They previously shipped with 14.40.33807. + +Wireshark 4.6.1 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.6.1.html) +for details: + +* [wnpa-sec-2025-05](https://www.wireshark.org/security/wnpa-sec-2025-05) BPv7 dissector crash. [Issue 20770](https://gitlab.com/wireshark/wireshark/-/issues/20770). +* [wnpa-sec-2025-06](https://www.wireshark.org/security/wnpa-sec-2025-06) Kafka dissector crash. [Issue 20823](https://gitlab.com/wireshark/wireshark/-/issues/20823). +* L2CAP dissector doesn’t understand retransmission mode. [Issue 2241](https://gitlab.com/wireshark/wireshark/-/issues/2241). +* DNS HIP dissector labels PK algorithm as HIT length. [Issue 20768](https://gitlab.com/wireshark/wireshark/-/issues/20768). +* clang-cl error in "packet-zbee-direct.c" [Issue 20776](https://gitlab.com/wireshark/wireshark/-/issues/20776). +* Writing to an LZ4-compressed output file might fail. [Issue 20779](https://gitlab.com/wireshark/wireshark/-/issues/20779). +* endian.h conflics with libc for building plugins. [Issue 20786](https://gitlab.com/wireshark/wireshark/-/issues/20786). +* TShark crash caused by Lua plugin. [Issue 20794](https://gitlab.com/wireshark/wireshark/-/issues/20794). +* Wireshark stalls for a few seconds when selecting specific messages. [Issue 20797](https://gitlab.com/wireshark/wireshark/-/issues/20797). +* TLS Abbreviated Handshake Using New Session Ticket. [Issue 20802](https://gitlab.com/wireshark/wireshark/-/issues/20802). +* Custom websocket dissector does not run. [Issue 20803](https://gitlab.com/wireshark/wireshark/-/issues/20803). +* WINREG QueryValue triggers dissector bug in packet-dcerpc.c. [Issue 20813](https://gitlab.com/wireshark/wireshark/-/issues/20813). +* Lua: FileHandler causing crash when reading packets. [Issue 20817](https://gitlab.com/wireshark/wireshark/-/issues/20817). +* Apply As Filter for field with FT\_NONE and BASE\_NONE for a single byte does not use the hex value. [Issue 20818](https://gitlab.com/wireshark/wireshark/-/issues/20818). +* Layout preference Pane 3 problem with selecting Packet Diagram or None. [Issue 20819](https://gitlab.com/wireshark/wireshark/-/issues/20819). +* TCP dissector creates invalid packet diagram. [Issue 20820](https://gitlab.com/wireshark/wireshark/-/issues/20820). +* Too many nested VLAN tags when opening as File Format. [Issue 20831](https://gitlab.com/wireshark/wireshark/-/issues/20831). +* Omnipeek files not working in 4.6.0. [Issue 20842](https://gitlab.com/wireshark/wireshark/-/issues/20842). +* Support UTF-16 strings in the IsoBus dissector for the string operations. [Issue 20845](https://gitlab.com/wireshark/wireshark/-/issues/20845). +* SNMP getBulkRequest request-id does not get filtered for correctly. [Issue 20849](https://gitlab.com/wireshark/wireshark/-/issues/20849). +* Fuzz job issue: fuzz-2025-11-12-12064814316.pcap. [Issue 20852](https://gitlab.com/wireshark/wireshark/-/issues/20852). +* UDP Port 853 (DoQ) should be decoded as QUIC. [Issue 20856](https://gitlab.com/wireshark/wireshark/-/issues/20856). + +Wireshark 4.6.0 included the following changes. +See the +[release notes](https://www.wireshark.org/docs/relnotes/wireshark-4.6.0.html) +for details: + +Wireshark can dissect process information, packet metadata, flow IDs, drop information, and other information provided by `tcpdump` on macOS. + +We now ship universal macOS installers instead of separate packages for Arm64 and Intel. [Issue 17294](https://gitlab.com/wireshark/wireshark/-/issues/17294) + +WinPcap is no longer supported. On Windows, use Npcap instead, uninstalling WinPcap if necessary. +The final release of WinPcap was version 4.1.3 in 2013. +It only supports up to Windows 8, which is no longer supported by Microsoft or Wireshark. + +A new “Plots” dialog has been added, which provides scatter plots in contrast to the “I/O Graphs” dialog, which provides histograms. +The Plots dialog window supports multiple plots, markers, and automatic scrolling. + +Live captures can be compressed while writing. (Previously there was +support for compressing when performing multiple file capture, at file +rotation time.) The `--compress` option in TShark works on live captures +as well. [Issue 9311](https://gitlab.com/wireshark/wireshark/-/issues/9311) + +Wireshark can now decrypt NTP packets using NTS (Network Time Security). To decrypt packets, +the NTS-KE (Network Time Security Key Establishment Protocol) packets need to be present, +alongside the TLS client and exporter secrets. + +Wireshark’s ability to decrypt MACsec packets has been expanded to either +use the SAK unwrapped by the MKA dissector, or the PSK configured in the +MACsec dissector. + +The TCP Stream Graph axes now use units with SI prefixes. [Issue 20197](https://gitlab.com/wireshark/wireshark/-/issues/20197) + +Display filter functions `float` and `double` are added to allow explicitly +converting field types like integers and times to single and double precision +floats. + +A **Edit** **›** **Copy** **›** **as HTML** menu item has been added, along with associated context menu items and a keyboard shortcut. + +The Conversations and Endpoints dialogs have an option to display byte counts and bit rates in exact counts instead of human-readable numbers with SI units. + +The color scheme can be set to Light or Dark mode independently of the current OS default on Windows and macOS, if Wireshark is built with Qt 6.8 or later as the official installers are. [Issue 19328](https://gitlab.com/wireshark/wireshark/-/issues/19328) + +## Getting Wireshark + +Wireshark source code and installation packages are available from +. + +### Vendor-supplied Packages + +Most Linux and Unix vendors supply their own Wireshark packages. +You can usually install or upgrade Wireshark using the package management system specific to that platform. +A list of third-party packages can be found on the +[download page](https://www.wireshark.org/download.html) +on the Wireshark web site. + +## File Locations + +Wireshark and TShark look in several different locations for preference files, plugins, SNMP MIBS, and RADIUS dictionaries. +These locations vary from platform to platform. +You can use **Help** **›** **About Wireshark** **›** **Folders** or `tshark -G folders` to find the default locations on your system. + +## Getting Help + +The User’s Guide, manual pages and various other documentation can be found at + + +Community support is available on +[Wireshark’s Q&A site](https://ask.wireshark.org/) +and on the wireshark-users mailing list. +Subscription information and archives for all of Wireshark’s mailing lists can be found on [the mailing list site](https://lists.wireshark.org/lists/). + +Bugs and feature requests can be reported on +[the issue tracker](https://gitlab.com/wireshark/wireshark/-/issues). + +You can learn protocol analysis and meet Wireshark’s developers at +[SharkFest](https://sharkfest.wireshark.org). + +## How You Can Help + +The Wireshark Foundation helps as many people as possible understand their networks as much as possible. +You can find out more and donate at [wiresharkfoundation.org](https://wiresharkfoundation.org). + +## Frequently Asked Questions + +A complete FAQ is available on the +[Wireshark web site](https://www.wireshark.org/faq.html). diff --git a/corpus/docs/golang/errors/errors_go118.md b/corpus/docs/golang/errors/errors_go118.md new file mode 100644 index 0000000000000000000000000000000000000000..139a2b074256999c3b350742fbcea238a8b069b3 --- /dev/null +++ b/corpus/docs/golang/errors/errors_go118.md @@ -0,0 +1,365 @@ +# Golang - errors + +Source: https://pkg.go.dev/errors@go1.18 +Version: go1.18 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package errors implements functions to manipulate errors. + +The New function creates errors whose only content is a text message. + +The Unwrap, Is and As functions work on errors that may wrap other errors. +An error wraps another error if its type has the method + +```None +Unwrap() error +``` + +If e.Unwrap() returns a non-nil error w, then we say that e wraps w. + +Unwrap unpacks wrapped errors. If its argument's type has an +Unwrap method, it calls the method once. Otherwise, it returns nil. + +A simple way to create wrapped errors is to call fmt.Errorf and apply the %w verb +to the error argument: + +```None +errors.Unwrap(fmt.Errorf("... %w ...", ..., err, ...)) +``` + +returns err. + +Is unwraps its first argument sequentially looking for an error that matches the +second. It reports whether it finds a match. It should be used in preference to +simple equality checks: + +```None +if errors.Is(err, fs.ErrExist) +``` + +is preferable to + +```None +if err == fs.ErrExist +``` + +because the former will succeed if err wraps fs.ErrExist. + +As unwraps its first argument sequentially looking for an error that can be +assigned to its second argument, which must be a pointer. If it succeeds, it +performs the assignment and returns true. Otherwise, it returns false. The form + +```None +var perr *fs.PathError +if errors.As(err, &perr) { + fmt.Println(perr.Path) +} +``` + +is preferable to + +```None +if perr, ok := err.(*fs.PathError); ok { + fmt.Println(perr.Path) +} +``` + +because the former will succeed if err wraps an \*fs.PathError. + +Example [¶](#example-package "Go to Example") + +```None +package main + +import ( + "fmt" + "time" +) + +// MyError is an error implementation that includes a time and message. +type MyError struct { + When time.Time + What string +} + +func (e MyError) Error() string { + return fmt.Sprintf("%v: %v", e.When, e.What) +} + +func oops() error { + return MyError{ + time.Date(1989, 3, 15, 22, 30, 0, 0, time.UTC), + "the file system has gone away", + } +} + +func main() { + if err := oops(); err != nil { + fmt.Println(err) + } +} +``` + +```None +Output: + +1989-03-15 22:30:00 +0000 UTC: the file system has gone away +``` + +Share +Format +Run + +### Index [¶](#pkg-index "Go to Index") + +* [func As(err error, target any) bool](#As) +* [func Is(err, target error) bool](#Is) +* [func New(text string) error](#New) +* [func Unwrap(err error) error](#Unwrap) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Package](#example-package) +* [As](#example-As) +* [Is](#example-Is) +* [New](#example-New) +* [New (Errorf)](#example-New-Errorf) +* [Unwrap](#example-Unwrap) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [As](https://cs.opensource.google/go/go/+/go1.18:src/errors/wrap.go;l=78) [¶](#As "Go to As") added in go1.13 + +```None +func As(err error, target any) bool +``` + +As finds the first error in err's chain that matches target, and if one is found, sets +target to that error value and returns true. Otherwise, it returns false. + +The chain consists of err itself followed by the sequence of errors obtained by +repeatedly calling Unwrap. + +An error matches target if the error's concrete value is assignable to the value +pointed to by target, or if the error has a method As(interface{}) bool such that +As(target) returns true. In the latter case, the As method is responsible for +setting target. + +An error type might provide an As method so it can be treated as if it were a +different error type. + +As panics if target is not a non-nil pointer to either a type that implements +error, or to any interface type. + +Example [¶](#example-As "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" + "io/fs" + "os" +) + +func main() { + if _, err := os.Open("non-existing"); err != nil { + var pathError *fs.PathError + if errors.As(err, &pathError) { + fmt.Println("Failed at path:", pathError.Path) + } else { + fmt.Println(err) + } + } + +} +``` + +```None +Output: + +Failed at path: non-existing +``` + +Share +Format +Run + +#### func [Is](https://cs.opensource.google/go/go/+/go1.18:src/errors/wrap.go;l=40) [¶](#Is "Go to Is") added in go1.13 + +```None +func Is(err, target error) bool +``` + +Is reports whether any error in err's chain matches target. + +The chain consists of err itself followed by the sequence of errors obtained by +repeatedly calling Unwrap. + +An error is considered to match a target if it is equal to that target or if +it implements a method Is(error) bool such that Is(target) returns true. + +An error type might provide an Is method so it can be treated as equivalent +to an existing error. For example, if MyError defines + +```None +func (m MyError) Is(target error) bool { return target == fs.ErrExist } +``` + +then Is(MyError{}, fs.ErrExist) returns true. See syscall.Errno.Is for +an example in the standard library. An Is method should only shallowly +compare err and the target and not call Unwrap on either. + +Example [¶](#example-Is "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" + "io/fs" + "os" +) + +func main() { + if _, err := os.Open("non-existing"); err != nil { + if errors.Is(err, fs.ErrNotExist) { + fmt.Println("file does not exist") + } else { + fmt.Println(err) + } + } + +} +``` + +```None +Output: + +file does not exist +``` + +Share +Format +Run + +#### func [New](https://cs.opensource.google/go/go/+/go1.18:src/errors/errors.go;l=58) [¶](#New "Go to New") + +```None +func New(text string) error +``` + +New returns an error that formats as the given text. +Each call to New returns a distinct error value even if the text is identical. + +Example [¶](#example-New "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" +) + +func main() { + err := errors.New("emit macho dwarf: elf header corrupted") + if err != nil { + fmt.Print(err) + } +} +``` + +```None +Output: + +emit macho dwarf: elf header corrupted +``` + +Share +Format +Run + + +Example (Errorf) [¶](#example-New-Errorf "Go to Example (Errorf)") + +The fmt package's Errorf function lets us use the package's formatting +features to create descriptive error messages. + +```None +package main + +import ( + "fmt" +) + +func main() { + const name, id = "bimmler", 17 + err := fmt.Errorf("user %q (id %d) not found", name, id) + if err != nil { + fmt.Print(err) + } +} +``` + +```None +Output: + +user "bimmler" (id 17) not found +``` + +Share +Format +Run + +#### func [Unwrap](https://cs.opensource.google/go/go/+/go1.18:src/errors/wrap.go;l=14) [¶](#Unwrap "Go to Unwrap") added in go1.13 + +```None +func Unwrap(err error) error +``` + +Unwrap returns the result of calling the Unwrap method on err, if err's +type contains an Unwrap method returning error. +Otherwise, Unwrap returns nil. + +Example [¶](#example-Unwrap "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" +) + +func main() { + err1 := errors.New("error1") + err2 := fmt.Errorf("error2: [%w]", err1) + fmt.Println(err2) + fmt.Println(errors.Unwrap(err2)) + // Output + // error2: [error1] + // error1 +} +``` + +Share +Format +Run + +### Types [¶](#pkg-types "Go to Types") + +This section is empty. diff --git a/corpus/docs/golang/errors/errors_go119.md b/corpus/docs/golang/errors/errors_go119.md new file mode 100644 index 0000000000000000000000000000000000000000..06a98f985bad3576041379c217dc456a2d1fb970 --- /dev/null +++ b/corpus/docs/golang/errors/errors_go119.md @@ -0,0 +1,365 @@ +# Golang - errors + +Source: https://pkg.go.dev/errors@go1.19 +Version: go1.19 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package errors implements functions to manipulate errors. + +The New function creates errors whose only content is a text message. + +The Unwrap, Is and As functions work on errors that may wrap other errors. +An error wraps another error if its type has the method + +```None +Unwrap() error +``` + +If e.Unwrap() returns a non-nil error w, then we say that e wraps w. + +Unwrap unpacks wrapped errors. If its argument's type has an +Unwrap method, it calls the method once. Otherwise, it returns nil. + +A simple way to create wrapped errors is to call fmt.Errorf and apply the %w verb +to the error argument: + +```None +errors.Unwrap(fmt.Errorf("... %w ...", ..., err, ...)) +``` + +returns err. + +Is unwraps its first argument sequentially looking for an error that matches the +second. It reports whether it finds a match. It should be used in preference to +simple equality checks: + +```None +if errors.Is(err, fs.ErrExist) +``` + +is preferable to + +```None +if err == fs.ErrExist +``` + +because the former will succeed if err wraps fs.ErrExist. + +As unwraps its first argument sequentially looking for an error that can be +assigned to its second argument, which must be a pointer. If it succeeds, it +performs the assignment and returns true. Otherwise, it returns false. The form + +```None +var perr *fs.PathError +if errors.As(err, &perr) { + fmt.Println(perr.Path) +} +``` + +is preferable to + +```None +if perr, ok := err.(*fs.PathError); ok { + fmt.Println(perr.Path) +} +``` + +because the former will succeed if err wraps an \*fs.PathError. + +Example [¶](#example-package "Go to Example") + +```None +package main + +import ( + "fmt" + "time" +) + +// MyError is an error implementation that includes a time and message. +type MyError struct { + When time.Time + What string +} + +func (e MyError) Error() string { + return fmt.Sprintf("%v: %v", e.When, e.What) +} + +func oops() error { + return MyError{ + time.Date(1989, 3, 15, 22, 30, 0, 0, time.UTC), + "the file system has gone away", + } +} + +func main() { + if err := oops(); err != nil { + fmt.Println(err) + } +} +``` + +```None +Output: + +1989-03-15 22:30:00 +0000 UTC: the file system has gone away +``` + +Share +Format +Run + +### Index [¶](#pkg-index "Go to Index") + +* [func As(err error, target any) bool](#As) +* [func Is(err, target error) bool](#Is) +* [func New(text string) error](#New) +* [func Unwrap(err error) error](#Unwrap) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Package](#example-package) +* [As](#example-As) +* [Is](#example-Is) +* [New](#example-New) +* [New (Errorf)](#example-New-Errorf) +* [Unwrap](#example-Unwrap) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [As](https://cs.opensource.google/go/go/+/go1.19:src/errors/wrap.go;l=78) [¶](#As "Go to As") added in go1.13 + +```None +func As(err error, target any) bool +``` + +As finds the first error in err's chain that matches target, and if one is found, sets +target to that error value and returns true. Otherwise, it returns false. + +The chain consists of err itself followed by the sequence of errors obtained by +repeatedly calling Unwrap. + +An error matches target if the error's concrete value is assignable to the value +pointed to by target, or if the error has a method As(interface{}) bool such that +As(target) returns true. In the latter case, the As method is responsible for +setting target. + +An error type might provide an As method so it can be treated as if it were a +different error type. + +As panics if target is not a non-nil pointer to either a type that implements +error, or to any interface type. + +Example [¶](#example-As "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" + "io/fs" + "os" +) + +func main() { + if _, err := os.Open("non-existing"); err != nil { + var pathError *fs.PathError + if errors.As(err, &pathError) { + fmt.Println("Failed at path:", pathError.Path) + } else { + fmt.Println(err) + } + } + +} +``` + +```None +Output: + +Failed at path: non-existing +``` + +Share +Format +Run + +#### func [Is](https://cs.opensource.google/go/go/+/go1.19:src/errors/wrap.go;l=40) [¶](#Is "Go to Is") added in go1.13 + +```None +func Is(err, target error) bool +``` + +Is reports whether any error in err's chain matches target. + +The chain consists of err itself followed by the sequence of errors obtained by +repeatedly calling Unwrap. + +An error is considered to match a target if it is equal to that target or if +it implements a method Is(error) bool such that Is(target) returns true. + +An error type might provide an Is method so it can be treated as equivalent +to an existing error. For example, if MyError defines + +```None +func (m MyError) Is(target error) bool { return target == fs.ErrExist } +``` + +then Is(MyError{}, fs.ErrExist) returns true. See syscall.Errno.Is for +an example in the standard library. An Is method should only shallowly +compare err and the target and not call Unwrap on either. + +Example [¶](#example-Is "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" + "io/fs" + "os" +) + +func main() { + if _, err := os.Open("non-existing"); err != nil { + if errors.Is(err, fs.ErrNotExist) { + fmt.Println("file does not exist") + } else { + fmt.Println(err) + } + } + +} +``` + +```None +Output: + +file does not exist +``` + +Share +Format +Run + +#### func [New](https://cs.opensource.google/go/go/+/go1.19:src/errors/errors.go;l=58) [¶](#New "Go to New") + +```None +func New(text string) error +``` + +New returns an error that formats as the given text. +Each call to New returns a distinct error value even if the text is identical. + +Example [¶](#example-New "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" +) + +func main() { + err := errors.New("emit macho dwarf: elf header corrupted") + if err != nil { + fmt.Print(err) + } +} +``` + +```None +Output: + +emit macho dwarf: elf header corrupted +``` + +Share +Format +Run + + +Example (Errorf) [¶](#example-New-Errorf "Go to Example (Errorf)") + +The fmt package's Errorf function lets us use the package's formatting +features to create descriptive error messages. + +```None +package main + +import ( + "fmt" +) + +func main() { + const name, id = "bimmler", 17 + err := fmt.Errorf("user %q (id %d) not found", name, id) + if err != nil { + fmt.Print(err) + } +} +``` + +```None +Output: + +user "bimmler" (id 17) not found +``` + +Share +Format +Run + +#### func [Unwrap](https://cs.opensource.google/go/go/+/go1.19:src/errors/wrap.go;l=14) [¶](#Unwrap "Go to Unwrap") added in go1.13 + +```None +func Unwrap(err error) error +``` + +Unwrap returns the result of calling the Unwrap method on err, if err's +type contains an Unwrap method returning error. +Otherwise, Unwrap returns nil. + +Example [¶](#example-Unwrap "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" +) + +func main() { + err1 := errors.New("error1") + err2 := fmt.Errorf("error2: [%w]", err1) + fmt.Println(err2) + fmt.Println(errors.Unwrap(err2)) + // Output + // error2: [error1] + // error1 +} +``` + +Share +Format +Run + +### Types [¶](#pkg-types "Go to Types") + +This section is empty. diff --git a/corpus/docs/golang/errors/errors_go120.md b/corpus/docs/golang/errors/errors_go120.md new file mode 100644 index 0000000000000000000000000000000000000000..f5b64e0e03f6d7ac58a529d7b1a520e7e3d80468 --- /dev/null +++ b/corpus/docs/golang/errors/errors_go120.md @@ -0,0 +1,424 @@ +# Golang - errors + +Source: https://pkg.go.dev/errors@go1.20 +Version: go1.20 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package errors implements functions to manipulate errors. + +The New function creates errors whose only content is a text message. + +An error e wraps another error if e's type has one of the methods + +```None +Unwrap() error +Unwrap() []error +``` + +If e.Unwrap() returns a non-nil error w or a slice containing w, +then we say that e wraps w. A nil error returned from e.Unwrap() +indicates that e does not wrap any error. It is invalid for an +Unwrap method to return an []error containing a nil error value. + +An easy way to create wrapped errors is to call fmt.Errorf and apply +the %w verb to the error argument: + +```None +wrapsErr := fmt.Errorf("... %w ...", ..., err, ...) +``` + +Successive unwrapping of an error creates a tree. The Is and As +functions inspect an error's tree by examining first the error +itself followed by the tree of each of its children in turn +(pre-order, depth-first traversal). + +Is examines the tree of its first argument looking for an error that +matches the second. It reports whether it finds a match. It should be +used in preference to simple equality checks: + +```None +if errors.Is(err, fs.ErrExist) +``` + +is preferable to + +```None +if err == fs.ErrExist +``` + +because the former will succeed if err wraps fs.ErrExist. + +As examines the tree of its first argument looking for an error that can be +assigned to its second argument, which must be a pointer. If it succeeds, it +performs the assignment and returns true. Otherwise, it returns false. The form + +```None +var perr *fs.PathError +if errors.As(err, &perr) { + fmt.Println(perr.Path) +} +``` + +is preferable to + +```None +if perr, ok := err.(*fs.PathError); ok { + fmt.Println(perr.Path) +} +``` + +because the former will succeed if err wraps an \*fs.PathError. + +Example [¶](#example-package "Go to Example") + +```None +package main + +import ( + "fmt" + "time" +) + +// MyError is an error implementation that includes a time and message. +type MyError struct { + When time.Time + What string +} + +func (e MyError) Error() string { + return fmt.Sprintf("%v: %v", e.When, e.What) +} + +func oops() error { + return MyError{ + time.Date(1989, 3, 15, 22, 30, 0, 0, time.UTC), + "the file system has gone away", + } +} + +func main() { + if err := oops(); err != nil { + fmt.Println(err) + } +} +``` + +```None +Output: + +1989-03-15 22:30:00 +0000 UTC: the file system has gone away +``` + +Share +Format +Run + +### Index [¶](#pkg-index "Go to Index") + +* [func As(err error, target any) bool](#As) +* [func Is(err, target error) bool](#Is) +* [func Join(errs ...error) error](#Join) +* [func New(text string) error](#New) +* [func Unwrap(err error) error](#Unwrap) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Package](#example-package) +* [As](#example-As) +* [Is](#example-Is) +* [Join](#example-Join) +* [New](#example-New) +* [New (Errorf)](#example-New-Errorf) +* [Unwrap](#example-Unwrap) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [As](https://cs.opensource.google/go/go/+/go1.20:src/errors/wrap.go;l=92) [¶](#As "Go to As") added in go1.13 + +```None +func As(err error, target any) bool +``` + +As finds the first error in err's tree that matches target, and if one is found, sets +target to that error value and returns true. Otherwise, it returns false. + +The tree consists of err itself, followed by the errors obtained by repeatedly +calling Unwrap. When err wraps multiple errors, As examines err followed by a +depth-first traversal of its children. + +An error matches target if the error's concrete value is assignable to the value +pointed to by target, or if the error has a method As(interface{}) bool such that +As(target) returns true. In the latter case, the As method is responsible for +setting target. + +An error type might provide an As method so it can be treated as if it were a +different error type. + +As panics if target is not a non-nil pointer to either a type that implements +error, or to any interface type. + +Example [¶](#example-As "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" + "io/fs" + "os" +) + +func main() { + if _, err := os.Open("non-existing"); err != nil { + var pathError *fs.PathError + if errors.As(err, &pathError) { + fmt.Println("Failed at path:", pathError.Path) + } else { + fmt.Println(err) + } + } + +} +``` + +```None +Output: + +Failed at path: non-existing +``` + +Share +Format +Run + +#### func [Is](https://cs.opensource.google/go/go/+/go1.20:src/errors/wrap.go;l=43) [¶](#Is "Go to Is") added in go1.13 + +```None +func Is(err, target error) bool +``` + +Is reports whether any error in err's tree matches target. + +The tree consists of err itself, followed by the errors obtained by repeatedly +calling Unwrap. When err wraps multiple errors, Is examines err followed by a +depth-first traversal of its children. + +An error is considered to match a target if it is equal to that target or if +it implements a method Is(error) bool such that Is(target) returns true. + +An error type might provide an Is method so it can be treated as equivalent +to an existing error. For example, if MyError defines + +```None +func (m MyError) Is(target error) bool { return target == fs.ErrExist } +``` + +then Is(MyError{}, fs.ErrExist) returns true. See syscall.Errno.Is for +an example in the standard library. An Is method should only shallowly +compare err and the target and not call Unwrap on either. + +Example [¶](#example-Is "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" + "io/fs" + "os" +) + +func main() { + if _, err := os.Open("non-existing"); err != nil { + if errors.Is(err, fs.ErrNotExist) { + fmt.Println("file does not exist") + } else { + fmt.Println(err) + } + } + +} +``` + +```None +Output: + +file does not exist +``` + +Share +Format +Run + +#### func [Join](https://cs.opensource.google/go/go/+/go1.20:src/errors/join.go;l=13) [¶](#Join "Go to Join") added in go1.20 + +```None +func Join(errs ...error) error +``` + +Join returns an error that wraps the given errors. +Any nil error values are discarded. +Join returns nil if errs contains no non-nil values. +The error formats as the concatenation of the strings obtained +by calling the Error method of each element of errs, with a newline +between each string. + +Example [¶](#example-Join "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" +) + +func main() { + err1 := errors.New("err1") + err2 := errors.New("err2") + err := errors.Join(err1, err2) + fmt.Println(err) + if errors.Is(err, err1) { + fmt.Println("err is err1") + } + if errors.Is(err, err2) { + fmt.Println("err is err2") + } +} +``` + +```None +Output: + +err1 +err2 +err is err1 +err is err2 +``` + +Share +Format +Run + +#### func [New](https://cs.opensource.google/go/go/+/go1.20:src/errors/errors.go;l=61) [¶](#New "Go to New") + +```None +func New(text string) error +``` + +New returns an error that formats as the given text. +Each call to New returns a distinct error value even if the text is identical. + +Example [¶](#example-New "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" +) + +func main() { + err := errors.New("emit macho dwarf: elf header corrupted") + if err != nil { + fmt.Print(err) + } +} +``` + +```None +Output: + +emit macho dwarf: elf header corrupted +``` + +Share +Format +Run + + +Example (Errorf) [¶](#example-New-Errorf "Go to Example (Errorf)") + +The fmt package's Errorf function lets us use the package's formatting +features to create descriptive error messages. + +```None +package main + +import ( + "fmt" +) + +func main() { + const name, id = "bimmler", 17 + err := fmt.Errorf("user %q (id %d) not found", name, id) + if err != nil { + fmt.Print(err) + } +} +``` + +```None +Output: + +user "bimmler" (id 17) not found +``` + +Share +Format +Run + +#### func [Unwrap](https://cs.opensource.google/go/go/+/go1.20:src/errors/wrap.go;l=16) [¶](#Unwrap "Go to Unwrap") added in go1.13 + +```None +func Unwrap(err error) error +``` + +Unwrap returns the result of calling the Unwrap method on err, if err's +type contains an Unwrap method returning error. +Otherwise, Unwrap returns nil. + +Unwrap returns nil if the Unwrap method returns []error. + +Example [¶](#example-Unwrap "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" +) + +func main() { + err1 := errors.New("error1") + err2 := fmt.Errorf("error2: [%w]", err1) + fmt.Println(err2) + fmt.Println(errors.Unwrap(err2)) + // Output + // error2: [error1] + // error1 +} +``` + +Share +Format +Run + +### Types [¶](#pkg-types "Go to Types") + +This section is empty. diff --git a/corpus/docs/golang/errors/errors_go1210.md b/corpus/docs/golang/errors/errors_go1210.md new file mode 100644 index 0000000000000000000000000000000000000000..f7135331a47aa12673603d850a66f49d27309c7f --- /dev/null +++ b/corpus/docs/golang/errors/errors_go1210.md @@ -0,0 +1,448 @@ +# Golang - errors + +Source: https://pkg.go.dev/errors@go1.21.0 +Version: go1.21.0 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package errors implements functions to manipulate errors. + +The [New](#New) function creates errors whose only content is a text message. + +An error e wraps another error if e's type has one of the methods + +```None +Unwrap() error +Unwrap() []error +``` + +If e.Unwrap() returns a non-nil error w or a slice containing w, +then we say that e wraps w. A nil error returned from e.Unwrap() +indicates that e does not wrap any error. It is invalid for an +Unwrap method to return an []error containing a nil error value. + +An easy way to create wrapped errors is to call [fmt.Errorf](/fmt#Errorf) and apply +the %w verb to the error argument: + +```None +wrapsErr := fmt.Errorf("... %w ...", ..., err, ...) +``` + +Successive unwrapping of an error creates a tree. The [Is](#Is) and [As](#As) +functions inspect an error's tree by examining first the error +itself followed by the tree of each of its children in turn +(pre-order, depth-first traversal). + +Is examines the tree of its first argument looking for an error that +matches the second. It reports whether it finds a match. It should be +used in preference to simple equality checks: + +```None +if errors.Is(err, fs.ErrExist) +``` + +is preferable to + +```None +if err == fs.ErrExist +``` + +because the former will succeed if err wraps [io/fs.ErrExist](/io/fs#ErrExist). + +As examines the tree of its first argument looking for an error that can be +assigned to its second argument, which must be a pointer. If it succeeds, it +performs the assignment and returns true. Otherwise, it returns false. The form + +```None +var perr *fs.PathError +if errors.As(err, &perr) { + fmt.Println(perr.Path) +} +``` + +is preferable to + +```None +if perr, ok := err.(*fs.PathError); ok { + fmt.Println(perr.Path) +} +``` + +because the former will succeed if err wraps an [\*io/fs.PathError](/io/fs#PathError). + +Example [¶](#example-package "Go to Example") + +```None +package main + +import ( + "fmt" + "time" +) + +// MyError is an error implementation that includes a time and message. +type MyError struct { + When time.Time + What string +} + +func (e MyError) Error() string { + return fmt.Sprintf("%v: %v", e.When, e.What) +} + +func oops() error { + return MyError{ + time.Date(1989, 3, 15, 22, 30, 0, 0, time.UTC), + "the file system has gone away", + } +} + +func main() { + if err := oops(); err != nil { + fmt.Println(err) + } +} +``` + +```None +Output: + +1989-03-15 22:30:00 +0000 UTC: the file system has gone away +``` + +Share +Format +Run + +### Index [¶](#pkg-index "Go to Index") + +* [Variables](#pkg-variables) +* [func As(err error, target any) bool](#As) +* [func Is(err, target error) bool](#Is) +* [func Join(errs ...error) error](#Join) +* [func New(text string) error](#New) +* [func Unwrap(err error) error](#Unwrap) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Package](#example-package) +* [As](#example-As) +* [Is](#example-Is) +* [Join](#example-Join) +* [New](#example-New) +* [New (Errorf)](#example-New-Errorf) +* [Unwrap](#example-Unwrap) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +[View Source](https://cs.opensource.google/go/go/+/go1.21.0:src/errors/errors.go;l=87) + +```None +var ErrUnsupported = New("unsupported operation") +``` + +ErrUnsupported indicates that a requested operation cannot be performed, +because it is unsupported. For example, a call to [os.Link](/os#Link) when using a +file system that does not support hard links. + +Functions and methods should not return this error but should instead +return an error including appropriate context that satisfies + +```None +errors.Is(err, errors.ErrUnsupported) +``` + +either by directly wrapping ErrUnsupported or by implementing an Is method. + +Functions and methods should document the cases in which an error +wrapping this will be returned. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [As](https://cs.opensource.google/go/go/+/go1.21.0:src/errors/wrap.go;l=93) [¶](#As "Go to As") added in go1.13 + +```None +func As(err error, target any) bool +``` + +As finds the first error in err's tree that matches target, and if one is found, sets +target to that error value and returns true. Otherwise, it returns false. + +The tree consists of err itself, followed by the errors obtained by repeatedly +calling Unwrap. When err wraps multiple errors, As examines err followed by a +depth-first traversal of its children. + +An error matches target if the error's concrete value is assignable to the value +pointed to by target, or if the error has a method As(interface{}) bool such that +As(target) returns true. In the latter case, the As method is responsible for +setting target. + +An error type might provide an As method so it can be treated as if it were a +different error type. + +As panics if target is not a non-nil pointer to either a type that implements +error, or to any interface type. + +Example [¶](#example-As "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" + "io/fs" + "os" +) + +func main() { + if _, err := os.Open("non-existing"); err != nil { + var pathError *fs.PathError + if errors.As(err, &pathError) { + fmt.Println("Failed at path:", pathError.Path) + } else { + fmt.Println(err) + } + } + +} +``` + +```None +Output: + +Failed at path: non-existing +``` + +Share +Format +Run + +#### func [Is](https://cs.opensource.google/go/go/+/go1.21.0:src/errors/wrap.go;l=44) [¶](#Is "Go to Is") added in go1.13 + +```None +func Is(err, target error) bool +``` + +Is reports whether any error in err's tree matches target. + +The tree consists of err itself, followed by the errors obtained by repeatedly +calling Unwrap. When err wraps multiple errors, Is examines err followed by a +depth-first traversal of its children. + +An error is considered to match a target if it is equal to that target or if +it implements a method Is(error) bool such that Is(target) returns true. + +An error type might provide an Is method so it can be treated as equivalent +to an existing error. For example, if MyError defines + +```None +func (m MyError) Is(target error) bool { return target == fs.ErrExist } +``` + +then Is(MyError{}, fs.ErrExist) returns true. See [syscall.Errno.Is](/syscall#Errno.Is) for +an example in the standard library. An Is method should only shallowly +compare err and the target and not call Unwrap on either. + +Example [¶](#example-Is "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" + "io/fs" + "os" +) + +func main() { + if _, err := os.Open("non-existing"); err != nil { + if errors.Is(err, fs.ErrNotExist) { + fmt.Println("file does not exist") + } else { + fmt.Println(err) + } + } + +} +``` + +```None +Output: + +file does not exist +``` + +Share +Format +Run + +#### func [Join](https://cs.opensource.google/go/go/+/go1.21.0:src/errors/join.go;l=15) [¶](#Join "Go to Join") added in go1.20 + +```None +func Join(errs ...error) error +``` + +Join returns an error that wraps the given errors. +Any nil error values are discarded. +Join returns nil if every value in errs is nil. +The error formats as the concatenation of the strings obtained +by calling the Error method of each element of errs, with a newline +between each string. + +A non-nil error returned by Join implements the Unwrap() []error method. + +Example [¶](#example-Join "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" +) + +func main() { + err1 := errors.New("err1") + err2 := errors.New("err2") + err := errors.Join(err1, err2) + fmt.Println(err) + if errors.Is(err, err1) { + fmt.Println("err is err1") + } + if errors.Is(err, err2) { + fmt.Println("err is err2") + } +} +``` + +```None +Output: + +err1 +err2 +err is err1 +err is err2 +``` + +Share +Format +Run + +#### func [New](https://cs.opensource.google/go/go/+/go1.21.0:src/errors/errors.go;l=61) [¶](#New "Go to New") + +```None +func New(text string) error +``` + +New returns an error that formats as the given text. +Each call to New returns a distinct error value even if the text is identical. + +Example [¶](#example-New "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" +) + +func main() { + err := errors.New("emit macho dwarf: elf header corrupted") + if err != nil { + fmt.Print(err) + } +} +``` + +```None +Output: + +emit macho dwarf: elf header corrupted +``` + +Share +Format +Run + + +Example (Errorf) [¶](#example-New-Errorf "Go to Example (Errorf)") + +The fmt package's Errorf function lets us use the package's formatting +features to create descriptive error messages. + +```None +package main + +import ( + "fmt" +) + +func main() { + const name, id = "bimmler", 17 + err := fmt.Errorf("user %q (id %d) not found", name, id) + if err != nil { + fmt.Print(err) + } +} +``` + +```None +Output: + +user "bimmler" (id 17) not found +``` + +Share +Format +Run + +#### func [Unwrap](https://cs.opensource.google/go/go/+/go1.21.0:src/errors/wrap.go;l=17) [¶](#Unwrap "Go to Unwrap") added in go1.13 + +```None +func Unwrap(err error) error +``` + +Unwrap returns the result of calling the Unwrap method on err, if err's +type contains an Unwrap method returning error. +Otherwise, Unwrap returns nil. + +Unwrap only calls a method of the form "Unwrap() error". +In particular Unwrap does not unwrap errors returned by [Join](#Join). + +Example [¶](#example-Unwrap "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" +) + +func main() { + err1 := errors.New("error1") + err2 := fmt.Errorf("error2: [%w]", err1) + fmt.Println(err2) + fmt.Println(errors.Unwrap(err2)) + // Output + // error2: [error1] + // error1 +} +``` + +Share +Format +Run + +### Types [¶](#pkg-types "Go to Types") + +This section is empty. diff --git a/corpus/docs/golang/errors/errors_go1220.md b/corpus/docs/golang/errors/errors_go1220.md new file mode 100644 index 0000000000000000000000000000000000000000..611067000227b6661e86e983a22200224c46feac --- /dev/null +++ b/corpus/docs/golang/errors/errors_go1220.md @@ -0,0 +1,452 @@ +# Golang - errors + +Source: https://pkg.go.dev/errors@go1.22.0 +Version: go1.22.0 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package errors implements functions to manipulate errors. + +The [New](#New) function creates errors whose only content is a text message. + +An error e wraps another error if e's type has one of the methods + +```None +Unwrap() error +Unwrap() []error +``` + +If e.Unwrap() returns a non-nil error w or a slice containing w, +then we say that e wraps w. A nil error returned from e.Unwrap() +indicates that e does not wrap any error. It is invalid for an +Unwrap method to return an []error containing a nil error value. + +An easy way to create wrapped errors is to call [fmt.Errorf](/fmt#Errorf) and apply +the %w verb to the error argument: + +```None +wrapsErr := fmt.Errorf("... %w ...", ..., err, ...) +``` + +Successive unwrapping of an error creates a tree. The [Is](#Is) and [As](#As) +functions inspect an error's tree by examining first the error +itself followed by the tree of each of its children in turn +(pre-order, depth-first traversal). + +[Is](#Is) examines the tree of its first argument looking for an error that +matches the second. It reports whether it finds a match. It should be +used in preference to simple equality checks: + +```None +if errors.Is(err, fs.ErrExist) +``` + +is preferable to + +```None +if err == fs.ErrExist +``` + +because the former will succeed if err wraps [io/fs.ErrExist](/io/fs#ErrExist). + +[As](#As) examines the tree of its first argument looking for an error that can be +assigned to its second argument, which must be a pointer. If it succeeds, it +performs the assignment and returns true. Otherwise, it returns false. The form + +```None +var perr *fs.PathError +if errors.As(err, &perr) { + fmt.Println(perr.Path) +} +``` + +is preferable to + +```None +if perr, ok := err.(*fs.PathError); ok { + fmt.Println(perr.Path) +} +``` + +because the former will succeed if err wraps an [\*io/fs.PathError](/io/fs#PathError). + +Example [¶](#example-package "Go to Example") + +```None +package main + +import ( + "fmt" + "time" +) + +// MyError is an error implementation that includes a time and message. +type MyError struct { + When time.Time + What string +} + +func (e MyError) Error() string { + return fmt.Sprintf("%v: %v", e.When, e.What) +} + +func oops() error { + return MyError{ + time.Date(1989, 3, 15, 22, 30, 0, 0, time.UTC), + "the file system has gone away", + } +} + +func main() { + if err := oops(); err != nil { + fmt.Println(err) + } +} +``` + +```None +Output: + +1989-03-15 22:30:00 +0000 UTC: the file system has gone away +``` + +Share +Format +Run + +### Index [¶](#pkg-index "Go to Index") + +* [Variables](#pkg-variables) +* [func As(err error, target any) bool](#As) +* [func Is(err, target error) bool](#Is) +* [func Join(errs ...error) error](#Join) +* [func New(text string) error](#New) +* [func Unwrap(err error) error](#Unwrap) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Package](#example-package) +* [As](#example-As) +* [Is](#example-Is) +* [Join](#example-Join) +* [New](#example-New) +* [New (Errorf)](#example-New-Errorf) +* [Unwrap](#example-Unwrap) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +[View Source](https://cs.opensource.google/go/go/+/go1.22.0:src/errors/errors.go;l=87) + +```None +var ErrUnsupported = New("unsupported operation") +``` + +ErrUnsupported indicates that a requested operation cannot be performed, +because it is unsupported. For example, a call to [os.Link](/os#Link) when using a +file system that does not support hard links. + +Functions and methods should not return this error but should instead +return an error including appropriate context that satisfies + +```None +errors.Is(err, errors.ErrUnsupported) +``` + +either by directly wrapping ErrUnsupported or by implementing an [Is](#Is) method. + +Functions and methods should document the cases in which an error +wrapping this will be returned. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [As](https://cs.opensource.google/go/go/+/go1.22.0:src/errors/wrap.go;l=97) [¶](#As "Go to As") added in go1.13 + +```None +func As(err error, target any) bool +``` + +As finds the first error in err's tree that matches target, and if one is found, sets +target to that error value and returns true. Otherwise, it returns false. + +The tree consists of err itself, followed by the errors obtained by repeatedly +calling its Unwrap() error or Unwrap() []error method. When err wraps multiple +errors, As examines err followed by a depth-first traversal of its children. + +An error matches target if the error's concrete value is assignable to the value +pointed to by target, or if the error has a method As(interface{}) bool such that +As(target) returns true. In the latter case, the As method is responsible for +setting target. + +An error type might provide an As method so it can be treated as if it were a +different error type. + +As panics if target is not a non-nil pointer to either a type that implements +error, or to any interface type. + +Example [¶](#example-As "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" + "io/fs" + "os" +) + +func main() { + if _, err := os.Open("non-existing"); err != nil { + var pathError *fs.PathError + if errors.As(err, &pathError) { + fmt.Println("Failed at path:", pathError.Path) + } else { + fmt.Println(err) + } + } + +} +``` + +```None +Output: + +Failed at path: non-existing +``` + +Share +Format +Run + +#### func [Is](https://cs.opensource.google/go/go/+/go1.22.0:src/errors/wrap.go;l=44) [¶](#Is "Go to Is") added in go1.13 + +```None +func Is(err, target error) bool +``` + +Is reports whether any error in err's tree matches target. + +The tree consists of err itself, followed by the errors obtained by repeatedly +calling its Unwrap() error or Unwrap() []error method. When err wraps multiple +errors, Is examines err followed by a depth-first traversal of its children. + +An error is considered to match a target if it is equal to that target or if +it implements a method Is(error) bool such that Is(target) returns true. + +An error type might provide an Is method so it can be treated as equivalent +to an existing error. For example, if MyError defines + +```None +func (m MyError) Is(target error) bool { return target == fs.ErrExist } +``` + +then Is(MyError{}, fs.ErrExist) returns true. See [syscall.Errno.Is](/syscall#Errno.Is) for +an example in the standard library. An Is method should only shallowly +compare err and the target and not call [Unwrap](#Unwrap) on either. + +Example [¶](#example-Is "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" + "io/fs" + "os" +) + +func main() { + if _, err := os.Open("non-existing"); err != nil { + if errors.Is(err, fs.ErrNotExist) { + fmt.Println("file does not exist") + } else { + fmt.Println(err) + } + } + +} +``` + +```None +Output: + +file does not exist +``` + +Share +Format +Run + +#### func [Join](https://cs.opensource.google/go/go/+/go1.22.0:src/errors/join.go;l=19) [¶](#Join "Go to Join") added in go1.20 + +```None +func Join(errs ...error) error +``` + +Join returns an error that wraps the given errors. +Any nil error values are discarded. +Join returns nil if every value in errs is nil. +The error formats as the concatenation of the strings obtained +by calling the Error method of each element of errs, with a newline +between each string. + +A non-nil error returned by Join implements the Unwrap() []error method. + +Example [¶](#example-Join "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" +) + +func main() { + err1 := errors.New("err1") + err2 := errors.New("err2") + err := errors.Join(err1, err2) + fmt.Println(err) + if errors.Is(err, err1) { + fmt.Println("err is err1") + } + if errors.Is(err, err2) { + fmt.Println("err is err2") + } +} +``` + +```None +Output: + +err1 +err2 +err is err1 +err is err2 +``` + +Share +Format +Run + +#### func [New](https://cs.opensource.google/go/go/+/go1.22.0:src/errors/errors.go;l=61) [¶](#New "Go to New") + +```None +func New(text string) error +``` + +New returns an error that formats as the given text. +Each call to New returns a distinct error value even if the text is identical. + +Example [¶](#example-New "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" +) + +func main() { + err := errors.New("emit macho dwarf: elf header corrupted") + if err != nil { + fmt.Print(err) + } +} +``` + +```None +Output: + +emit macho dwarf: elf header corrupted +``` + +Share +Format +Run + + +Example (Errorf) [¶](#example-New-Errorf "Go to Example (Errorf)") + +The fmt package's Errorf function lets us use the package's formatting +features to create descriptive error messages. + +```None +package main + +import ( + "fmt" +) + +func main() { + const name, id = "bimmler", 17 + err := fmt.Errorf("user %q (id %d) not found", name, id) + if err != nil { + fmt.Print(err) + } +} +``` + +```None +Output: + +user "bimmler" (id 17) not found +``` + +Share +Format +Run + +#### func [Unwrap](https://cs.opensource.google/go/go/+/go1.22.0:src/errors/wrap.go;l=17) [¶](#Unwrap "Go to Unwrap") added in go1.13 + +```None +func Unwrap(err error) error +``` + +Unwrap returns the result of calling the Unwrap method on err, if err's +type contains an Unwrap method returning error. +Otherwise, Unwrap returns nil. + +Unwrap only calls a method of the form "Unwrap() error". +In particular Unwrap does not unwrap errors returned by [Join](#Join). + +Example [¶](#example-Unwrap "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" +) + +func main() { + err1 := errors.New("error1") + err2 := fmt.Errorf("error2: [%w]", err1) + fmt.Println(err2) + fmt.Println(errors.Unwrap(err2)) +} +``` + +```None +Output: + +error2: [error1] +error1 +``` + +Share +Format +Run + +### Types [¶](#pkg-types "Go to Types") + +This section is empty. diff --git a/corpus/docs/golang/errors/errors_go1230.md b/corpus/docs/golang/errors/errors_go1230.md new file mode 100644 index 0000000000000000000000000000000000000000..0f7625867772b48025c6bfb47eba205201328cdd --- /dev/null +++ b/corpus/docs/golang/errors/errors_go1230.md @@ -0,0 +1,452 @@ +# Golang - errors + +Source: https://pkg.go.dev/errors@go1.23.0 +Version: go1.23.0 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package errors implements functions to manipulate errors. + +The [New](#New) function creates errors whose only content is a text message. + +An error e wraps another error if e's type has one of the methods + +```None +Unwrap() error +Unwrap() []error +``` + +If e.Unwrap() returns a non-nil error w or a slice containing w, +then we say that e wraps w. A nil error returned from e.Unwrap() +indicates that e does not wrap any error. It is invalid for an +Unwrap method to return an []error containing a nil error value. + +An easy way to create wrapped errors is to call [fmt.Errorf](/fmt#Errorf) and apply +the %w verb to the error argument: + +```None +wrapsErr := fmt.Errorf("... %w ...", ..., err, ...) +``` + +Successive unwrapping of an error creates a tree. The [Is](#Is) and [As](#As) +functions inspect an error's tree by examining first the error +itself followed by the tree of each of its children in turn +(pre-order, depth-first traversal). + +[Is](#Is) examines the tree of its first argument looking for an error that +matches the second. It reports whether it finds a match. It should be +used in preference to simple equality checks: + +```None +if errors.Is(err, fs.ErrExist) +``` + +is preferable to + +```None +if err == fs.ErrExist +``` + +because the former will succeed if err wraps [io/fs.ErrExist](/io/fs#ErrExist). + +[As](#As) examines the tree of its first argument looking for an error that can be +assigned to its second argument, which must be a pointer. If it succeeds, it +performs the assignment and returns true. Otherwise, it returns false. The form + +```None +var perr *fs.PathError +if errors.As(err, &perr) { + fmt.Println(perr.Path) +} +``` + +is preferable to + +```None +if perr, ok := err.(*fs.PathError); ok { + fmt.Println(perr.Path) +} +``` + +because the former will succeed if err wraps an [\*io/fs.PathError](/io/fs#PathError). + +Example [¶](#example-package "Go to Example") + +```None +package main + +import ( + "fmt" + "time" +) + +// MyError is an error implementation that includes a time and message. +type MyError struct { + When time.Time + What string +} + +func (e MyError) Error() string { + return fmt.Sprintf("%v: %v", e.When, e.What) +} + +func oops() error { + return MyError{ + time.Date(1989, 3, 15, 22, 30, 0, 0, time.UTC), + "the file system has gone away", + } +} + +func main() { + if err := oops(); err != nil { + fmt.Println(err) + } +} +``` + +```None +Output: + +1989-03-15 22:30:00 +0000 UTC: the file system has gone away +``` + +Share +Format +Run + +### Index [¶](#pkg-index "Go to Index") + +* [Variables](#pkg-variables) +* [func As(err error, target any) bool](#As) +* [func Is(err, target error) bool](#Is) +* [func Join(errs ...error) error](#Join) +* [func New(text string) error](#New) +* [func Unwrap(err error) error](#Unwrap) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Package](#example-package) +* [As](#example-As) +* [Is](#example-Is) +* [Join](#example-Join) +* [New](#example-New) +* [New (Errorf)](#example-New-Errorf) +* [Unwrap](#example-Unwrap) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +[View Source](https://cs.opensource.google/go/go/+/go1.23.0:src/errors/errors.go;l=87) + +```None +var ErrUnsupported = New("unsupported operation") +``` + +ErrUnsupported indicates that a requested operation cannot be performed, +because it is unsupported. For example, a call to [os.Link](/os#Link) when using a +file system that does not support hard links. + +Functions and methods should not return this error but should instead +return an error including appropriate context that satisfies + +```None +errors.Is(err, errors.ErrUnsupported) +``` + +either by directly wrapping ErrUnsupported or by implementing an [Is](#Is) method. + +Functions and methods should document the cases in which an error +wrapping this will be returned. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [As](https://cs.opensource.google/go/go/+/go1.23.0:src/errors/wrap.go;l=97) [¶](#As "Go to As") added in go1.13 + +```None +func As(err error, target any) bool +``` + +As finds the first error in err's tree that matches target, and if one is found, sets +target to that error value and returns true. Otherwise, it returns false. + +The tree consists of err itself, followed by the errors obtained by repeatedly +calling its Unwrap() error or Unwrap() []error method. When err wraps multiple +errors, As examines err followed by a depth-first traversal of its children. + +An error matches target if the error's concrete value is assignable to the value +pointed to by target, or if the error has a method As(any) bool such that +As(target) returns true. In the latter case, the As method is responsible for +setting target. + +An error type might provide an As method so it can be treated as if it were a +different error type. + +As panics if target is not a non-nil pointer to either a type that implements +error, or to any interface type. + +Example [¶](#example-As "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" + "io/fs" + "os" +) + +func main() { + if _, err := os.Open("non-existing"); err != nil { + var pathError *fs.PathError + if errors.As(err, &pathError) { + fmt.Println("Failed at path:", pathError.Path) + } else { + fmt.Println(err) + } + } + +} +``` + +```None +Output: + +Failed at path: non-existing +``` + +Share +Format +Run + +#### func [Is](https://cs.opensource.google/go/go/+/go1.23.0:src/errors/wrap.go;l=44) [¶](#Is "Go to Is") added in go1.13 + +```None +func Is(err, target error) bool +``` + +Is reports whether any error in err's tree matches target. + +The tree consists of err itself, followed by the errors obtained by repeatedly +calling its Unwrap() error or Unwrap() []error method. When err wraps multiple +errors, Is examines err followed by a depth-first traversal of its children. + +An error is considered to match a target if it is equal to that target or if +it implements a method Is(error) bool such that Is(target) returns true. + +An error type might provide an Is method so it can be treated as equivalent +to an existing error. For example, if MyError defines + +```None +func (m MyError) Is(target error) bool { return target == fs.ErrExist } +``` + +then Is(MyError{}, fs.ErrExist) returns true. See [syscall.Errno.Is](/syscall#Errno.Is) for +an example in the standard library. An Is method should only shallowly +compare err and the target and not call [Unwrap](#Unwrap) on either. + +Example [¶](#example-Is "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" + "io/fs" + "os" +) + +func main() { + if _, err := os.Open("non-existing"); err != nil { + if errors.Is(err, fs.ErrNotExist) { + fmt.Println("file does not exist") + } else { + fmt.Println(err) + } + } + +} +``` + +```None +Output: + +file does not exist +``` + +Share +Format +Run + +#### func [Join](https://cs.opensource.google/go/go/+/go1.23.0:src/errors/join.go;l=19) [¶](#Join "Go to Join") added in go1.20 + +```None +func Join(errs ...error) error +``` + +Join returns an error that wraps the given errors. +Any nil error values are discarded. +Join returns nil if every value in errs is nil. +The error formats as the concatenation of the strings obtained +by calling the Error method of each element of errs, with a newline +between each string. + +A non-nil error returned by Join implements the Unwrap() []error method. + +Example [¶](#example-Join "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" +) + +func main() { + err1 := errors.New("err1") + err2 := errors.New("err2") + err := errors.Join(err1, err2) + fmt.Println(err) + if errors.Is(err, err1) { + fmt.Println("err is err1") + } + if errors.Is(err, err2) { + fmt.Println("err is err2") + } +} +``` + +```None +Output: + +err1 +err2 +err is err1 +err is err2 +``` + +Share +Format +Run + +#### func [New](https://cs.opensource.google/go/go/+/go1.23.0:src/errors/errors.go;l=61) [¶](#New "Go to New") + +```None +func New(text string) error +``` + +New returns an error that formats as the given text. +Each call to New returns a distinct error value even if the text is identical. + +Example [¶](#example-New "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" +) + +func main() { + err := errors.New("emit macho dwarf: elf header corrupted") + if err != nil { + fmt.Print(err) + } +} +``` + +```None +Output: + +emit macho dwarf: elf header corrupted +``` + +Share +Format +Run + + +Example (Errorf) [¶](#example-New-Errorf "Go to Example (Errorf)") + +The fmt package's Errorf function lets us use the package's formatting +features to create descriptive error messages. + +```None +package main + +import ( + "fmt" +) + +func main() { + const name, id = "bimmler", 17 + err := fmt.Errorf("user %q (id %d) not found", name, id) + if err != nil { + fmt.Print(err) + } +} +``` + +```None +Output: + +user "bimmler" (id 17) not found +``` + +Share +Format +Run + +#### func [Unwrap](https://cs.opensource.google/go/go/+/go1.23.0:src/errors/wrap.go;l=17) [¶](#Unwrap "Go to Unwrap") added in go1.13 + +```None +func Unwrap(err error) error +``` + +Unwrap returns the result of calling the Unwrap method on err, if err's +type contains an Unwrap method returning error. +Otherwise, Unwrap returns nil. + +Unwrap only calls a method of the form "Unwrap() error". +In particular Unwrap does not unwrap errors returned by [Join](#Join). + +Example [¶](#example-Unwrap "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" +) + +func main() { + err1 := errors.New("error1") + err2 := fmt.Errorf("error2: [%w]", err1) + fmt.Println(err2) + fmt.Println(errors.Unwrap(err2)) +} +``` + +```None +Output: + +error2: [error1] +error1 +``` + +Share +Format +Run + +### Types [¶](#pkg-types "Go to Types") + +This section is empty. diff --git a/corpus/docs/golang/errors/errors_go1240.md b/corpus/docs/golang/errors/errors_go1240.md new file mode 100644 index 0000000000000000000000000000000000000000..334d1c45c5061e204c5e72e949d5b27c5dff9ae9 --- /dev/null +++ b/corpus/docs/golang/errors/errors_go1240.md @@ -0,0 +1,455 @@ +# Golang - errors + +Source: https://pkg.go.dev/errors@go1.24.0 +Version: go1.24.0 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package errors implements functions to manipulate errors. + +The [New](#New) function creates errors whose only content is a text message. + +An error e wraps another error if e's type has one of the methods + +```None +Unwrap() error +Unwrap() []error +``` + +If e.Unwrap() returns a non-nil error w or a slice containing w, +then we say that e wraps w. A nil error returned from e.Unwrap() +indicates that e does not wrap any error. It is invalid for an +Unwrap method to return an []error containing a nil error value. + +An easy way to create wrapped errors is to call [fmt.Errorf](/fmt#Errorf) and apply +the %w verb to the error argument: + +```None +wrapsErr := fmt.Errorf("... %w ...", ..., err, ...) +``` + +Successive unwrapping of an error creates a tree. The [Is](#Is) and [As](#As) +functions inspect an error's tree by examining first the error +itself followed by the tree of each of its children in turn +(pre-order, depth-first traversal). + +See for a deeper discussion of the +philosophy of wrapping and when to wrap. + +[Is](#Is) examines the tree of its first argument looking for an error that +matches the second. It reports whether it finds a match. It should be +used in preference to simple equality checks: + +```None +if errors.Is(err, fs.ErrExist) +``` + +is preferable to + +```None +if err == fs.ErrExist +``` + +because the former will succeed if err wraps [io/fs.ErrExist](/io/fs#ErrExist). + +[As](#As) examines the tree of its first argument looking for an error that can be +assigned to its second argument, which must be a pointer. If it succeeds, it +performs the assignment and returns true. Otherwise, it returns false. The form + +```None +var perr *fs.PathError +if errors.As(err, &perr) { + fmt.Println(perr.Path) +} +``` + +is preferable to + +```None +if perr, ok := err.(*fs.PathError); ok { + fmt.Println(perr.Path) +} +``` + +because the former will succeed if err wraps an [\*io/fs.PathError](/io/fs#PathError). + +Example [¶](#example-package "Go to Example") + +```None +package main + +import ( + "fmt" + "time" +) + +// MyError is an error implementation that includes a time and message. +type MyError struct { + When time.Time + What string +} + +func (e MyError) Error() string { + return fmt.Sprintf("%v: %v", e.When, e.What) +} + +func oops() error { + return MyError{ + time.Date(1989, 3, 15, 22, 30, 0, 0, time.UTC), + "the file system has gone away", + } +} + +func main() { + if err := oops(); err != nil { + fmt.Println(err) + } +} +``` + +```None +Output: + +1989-03-15 22:30:00 +0000 UTC: the file system has gone away +``` + +Share +Format +Run + +### Index [¶](#pkg-index "Go to Index") + +* [Variables](#pkg-variables) +* [func As(err error, target any) bool](#As) +* [func Is(err, target error) bool](#Is) +* [func Join(errs ...error) error](#Join) +* [func New(text string) error](#New) +* [func Unwrap(err error) error](#Unwrap) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Package](#example-package) +* [As](#example-As) +* [Is](#example-Is) +* [Join](#example-Join) +* [New](#example-New) +* [New (Errorf)](#example-New-Errorf) +* [Unwrap](#example-Unwrap) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +[View Source](https://cs.opensource.google/go/go/+/go1.24.0:src/errors/errors.go;l=90) + +```None +var ErrUnsupported = New("unsupported operation") +``` + +ErrUnsupported indicates that a requested operation cannot be performed, +because it is unsupported. For example, a call to [os.Link](/os#Link) when using a +file system that does not support hard links. + +Functions and methods should not return this error but should instead +return an error including appropriate context that satisfies + +```None +errors.Is(err, errors.ErrUnsupported) +``` + +either by directly wrapping ErrUnsupported or by implementing an [Is](#Is) method. + +Functions and methods should document the cases in which an error +wrapping this will be returned. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [As](https://cs.opensource.google/go/go/+/go1.24.0:src/errors/wrap.go;l=97) [¶](#As "Go to As") added in go1.13 + +```None +func As(err error, target any) bool +``` + +As finds the first error in err's tree that matches target, and if one is found, sets +target to that error value and returns true. Otherwise, it returns false. + +The tree consists of err itself, followed by the errors obtained by repeatedly +calling its Unwrap() error or Unwrap() []error method. When err wraps multiple +errors, As examines err followed by a depth-first traversal of its children. + +An error matches target if the error's concrete value is assignable to the value +pointed to by target, or if the error has a method As(any) bool such that +As(target) returns true. In the latter case, the As method is responsible for +setting target. + +An error type might provide an As method so it can be treated as if it were a +different error type. + +As panics if target is not a non-nil pointer to either a type that implements +error, or to any interface type. + +Example [¶](#example-As "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" + "io/fs" + "os" +) + +func main() { + if _, err := os.Open("non-existing"); err != nil { + var pathError *fs.PathError + if errors.As(err, &pathError) { + fmt.Println("Failed at path:", pathError.Path) + } else { + fmt.Println(err) + } + } + +} +``` + +```None +Output: + +Failed at path: non-existing +``` + +Share +Format +Run + +#### func [Is](https://cs.opensource.google/go/go/+/go1.24.0:src/errors/wrap.go;l=44) [¶](#Is "Go to Is") added in go1.13 + +```None +func Is(err, target error) bool +``` + +Is reports whether any error in err's tree matches target. + +The tree consists of err itself, followed by the errors obtained by repeatedly +calling its Unwrap() error or Unwrap() []error method. When err wraps multiple +errors, Is examines err followed by a depth-first traversal of its children. + +An error is considered to match a target if it is equal to that target or if +it implements a method Is(error) bool such that Is(target) returns true. + +An error type might provide an Is method so it can be treated as equivalent +to an existing error. For example, if MyError defines + +```None +func (m MyError) Is(target error) bool { return target == fs.ErrExist } +``` + +then Is(MyError{}, fs.ErrExist) returns true. See [syscall.Errno.Is](/syscall#Errno.Is) for +an example in the standard library. An Is method should only shallowly +compare err and the target and not call [Unwrap](#Unwrap) on either. + +Example [¶](#example-Is "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" + "io/fs" + "os" +) + +func main() { + if _, err := os.Open("non-existing"); err != nil { + if errors.Is(err, fs.ErrNotExist) { + fmt.Println("file does not exist") + } else { + fmt.Println(err) + } + } + +} +``` + +```None +Output: + +file does not exist +``` + +Share +Format +Run + +#### func [Join](https://cs.opensource.google/go/go/+/go1.24.0:src/errors/join.go;l=19) [¶](#Join "Go to Join") added in go1.20 + +```None +func Join(errs ...error) error +``` + +Join returns an error that wraps the given errors. +Any nil error values are discarded. +Join returns nil if every value in errs is nil. +The error formats as the concatenation of the strings obtained +by calling the Error method of each element of errs, with a newline +between each string. + +A non-nil error returned by Join implements the Unwrap() []error method. + +Example [¶](#example-Join "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" +) + +func main() { + err1 := errors.New("err1") + err2 := errors.New("err2") + err := errors.Join(err1, err2) + fmt.Println(err) + if errors.Is(err, err1) { + fmt.Println("err is err1") + } + if errors.Is(err, err2) { + fmt.Println("err is err2") + } +} +``` + +```None +Output: + +err1 +err2 +err is err1 +err is err2 +``` + +Share +Format +Run + +#### func [New](https://cs.opensource.google/go/go/+/go1.24.0:src/errors/errors.go;l=64) [¶](#New "Go to New") + +```None +func New(text string) error +``` + +New returns an error that formats as the given text. +Each call to New returns a distinct error value even if the text is identical. + +Example [¶](#example-New "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" +) + +func main() { + err := errors.New("emit macho dwarf: elf header corrupted") + if err != nil { + fmt.Print(err) + } +} +``` + +```None +Output: + +emit macho dwarf: elf header corrupted +``` + +Share +Format +Run + + +Example (Errorf) [¶](#example-New-Errorf "Go to Example (Errorf)") + +The fmt package's Errorf function lets us use the package's formatting +features to create descriptive error messages. + +```None +package main + +import ( + "fmt" +) + +func main() { + const name, id = "bimmler", 17 + err := fmt.Errorf("user %q (id %d) not found", name, id) + if err != nil { + fmt.Print(err) + } +} +``` + +```None +Output: + +user "bimmler" (id 17) not found +``` + +Share +Format +Run + +#### func [Unwrap](https://cs.opensource.google/go/go/+/go1.24.0:src/errors/wrap.go;l=17) [¶](#Unwrap "Go to Unwrap") added in go1.13 + +```None +func Unwrap(err error) error +``` + +Unwrap returns the result of calling the Unwrap method on err, if err's +type contains an Unwrap method returning error. +Otherwise, Unwrap returns nil. + +Unwrap only calls a method of the form "Unwrap() error". +In particular Unwrap does not unwrap errors returned by [Join](#Join). + +Example [¶](#example-Unwrap "Go to Example") + +```None +package main + +import ( + "errors" + "fmt" +) + +func main() { + err1 := errors.New("error1") + err2 := fmt.Errorf("error2: [%w]", err1) + fmt.Println(err2) + fmt.Println(errors.Unwrap(err2)) +} +``` + +```None +Output: + +error2: [error1] +error1 +``` + +Share +Format +Run + +### Types [¶](#pkg-types "Go to Types") + +This section is empty. diff --git a/corpus/docs/golang/hash/hash_go118.md b/corpus/docs/golang/hash/hash_go118.md new file mode 100644 index 0000000000000000000000000000000000000000..6365d7cf562e2bf204c545da92c5be6d7aea6278 --- /dev/null +++ b/corpus/docs/golang/hash/hash_go118.md @@ -0,0 +1,159 @@ +# Golang - hash + +Source: https://pkg.go.dev/hash@go1.18 +Version: go1.18 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package hash provides interfaces for hash functions. + +Example (BinaryMarshaler) [¶](#example-package-BinaryMarshaler "Go to Example (BinaryMarshaler)") + +```None +package main + +import ( + "bytes" + "crypto/sha256" + "encoding" + "fmt" + "log" +) + +func main() { + const ( + input1 = "The tunneling gopher digs downwards, " + input2 = "unaware of what he will find." + ) + + first := sha256.New() + first.Write([]byte(input1)) + + marshaler, ok := first.(encoding.BinaryMarshaler) + if !ok { + log.Fatal("first does not implement encoding.BinaryMarshaler") + } + state, err := marshaler.MarshalBinary() + if err != nil { + log.Fatal("unable to marshal hash:", err) + } + + second := sha256.New() + + unmarshaler, ok := second.(encoding.BinaryUnmarshaler) + if !ok { + log.Fatal("second does not implement encoding.BinaryUnmarshaler") + } + if err := unmarshaler.UnmarshalBinary(state); err != nil { + log.Fatal("unable to unmarshal hash:", err) + } + + first.Write([]byte(input2)) + second.Write([]byte(input2)) + + fmt.Printf("%x\n", first.Sum(nil)) + fmt.Println(bytes.Equal(first.Sum(nil), second.Sum(nil))) +} +``` + +```None +Output: + +57d51a066f3a39942649cd9a76c77e97ceab246756ff3888659e6aa5a07f4a52 +true +``` + +Share +Format +Run + +### Index [¶](#pkg-index "Go to Index") + +* [type Hash](#Hash) +* [type Hash32](#Hash32) +* [type Hash64](#Hash64) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Package (BinaryMarshaler)](#example-package-BinaryMarshaler) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +This section is empty. + +### Types [¶](#pkg-types "Go to Types") + +#### type [Hash](https://cs.opensource.google/go/go/+/go1.18:src/hash/hash.go;l=26) [¶](#Hash "Go to Hash") + +```None +type Hash interface { + // Write (via the embedded io.Writer interface) adds more data to the running hash. + // It never returns an error. + io.Writer + + // Sum appends the current hash to b and returns the resulting slice. + // It does not change the underlying hash state. + Sum(b []byte) []byte + + // Reset resets the Hash to its initial state. + Reset() + + // Size returns the number of bytes Sum will return. + Size() int + + // BlockSize returns the hash's underlying block size. + // The Write method must be able to accept any amount + // of data, but it may operate more efficiently if all writes + // are a multiple of the block size. + BlockSize() int +} +``` + +Hash is the common interface implemented by all hash functions. + +Hash implementations in the standard library (e.g. hash/crc32 and +crypto/sha256) implement the encoding.BinaryMarshaler and +encoding.BinaryUnmarshaler interfaces. Marshaling a hash implementation +allows its internal state to be saved and used for additional processing +later, without having to re-write the data previously written to the hash. +The hash state may contain portions of the input in its original form, +which users are expected to handle for any possible security implications. + +Compatibility: Any future changes to hash or crypto packages will endeavor +to maintain compatibility with state encoded using previous versions. +That is, any released versions of the packages should be able to +decode data written with any previously released version, +subject to issues such as security fixes. +See the Go compatibility document for background: + +#### type [Hash32](https://cs.opensource.google/go/go/+/go1.18:src/hash/hash.go;l=49) [¶](#Hash32 "Go to Hash32") + +```None +type Hash32 interface { + Hash + Sum32() uint32 +} +``` + +Hash32 is the common interface implemented by all 32-bit hash functions. + +#### type [Hash64](https://cs.opensource.google/go/go/+/go1.18:src/hash/hash.go;l=55) [¶](#Hash64 "Go to Hash64") + +```None +type Hash64 interface { + Hash + Sum64() uint64 +} +``` + +Hash64 is the common interface implemented by all 64-bit hash functions. diff --git a/corpus/docs/golang/hash/hash_go119.md b/corpus/docs/golang/hash/hash_go119.md new file mode 100644 index 0000000000000000000000000000000000000000..efeeaecb4d8f5e75deebd83bf203ae9205c30b20 --- /dev/null +++ b/corpus/docs/golang/hash/hash_go119.md @@ -0,0 +1,159 @@ +# Golang - hash + +Source: https://pkg.go.dev/hash@go1.19 +Version: go1.19 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package hash provides interfaces for hash functions. + +Example (BinaryMarshaler) [¶](#example-package-BinaryMarshaler "Go to Example (BinaryMarshaler)") + +```None +package main + +import ( + "bytes" + "crypto/sha256" + "encoding" + "fmt" + "log" +) + +func main() { + const ( + input1 = "The tunneling gopher digs downwards, " + input2 = "unaware of what he will find." + ) + + first := sha256.New() + first.Write([]byte(input1)) + + marshaler, ok := first.(encoding.BinaryMarshaler) + if !ok { + log.Fatal("first does not implement encoding.BinaryMarshaler") + } + state, err := marshaler.MarshalBinary() + if err != nil { + log.Fatal("unable to marshal hash:", err) + } + + second := sha256.New() + + unmarshaler, ok := second.(encoding.BinaryUnmarshaler) + if !ok { + log.Fatal("second does not implement encoding.BinaryUnmarshaler") + } + if err := unmarshaler.UnmarshalBinary(state); err != nil { + log.Fatal("unable to unmarshal hash:", err) + } + + first.Write([]byte(input2)) + second.Write([]byte(input2)) + + fmt.Printf("%x\n", first.Sum(nil)) + fmt.Println(bytes.Equal(first.Sum(nil), second.Sum(nil))) +} +``` + +```None +Output: + +57d51a066f3a39942649cd9a76c77e97ceab246756ff3888659e6aa5a07f4a52 +true +``` + +Share +Format +Run + +### Index [¶](#pkg-index "Go to Index") + +* [type Hash](#Hash) +* [type Hash32](#Hash32) +* [type Hash64](#Hash64) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Package (BinaryMarshaler)](#example-package-BinaryMarshaler) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +This section is empty. + +### Types [¶](#pkg-types "Go to Types") + +#### type [Hash](https://cs.opensource.google/go/go/+/go1.19:src/hash/hash.go;l=26) [¶](#Hash "Go to Hash") + +```None +type Hash interface { + // Write (via the embedded io.Writer interface) adds more data to the running hash. + // It never returns an error. + io.Writer + + // Sum appends the current hash to b and returns the resulting slice. + // It does not change the underlying hash state. + Sum(b []byte) []byte + + // Reset resets the Hash to its initial state. + Reset() + + // Size returns the number of bytes Sum will return. + Size() int + + // BlockSize returns the hash's underlying block size. + // The Write method must be able to accept any amount + // of data, but it may operate more efficiently if all writes + // are a multiple of the block size. + BlockSize() int +} +``` + +Hash is the common interface implemented by all hash functions. + +Hash implementations in the standard library (e.g. hash/crc32 and +crypto/sha256) implement the encoding.BinaryMarshaler and +encoding.BinaryUnmarshaler interfaces. Marshaling a hash implementation +allows its internal state to be saved and used for additional processing +later, without having to re-write the data previously written to the hash. +The hash state may contain portions of the input in its original form, +which users are expected to handle for any possible security implications. + +Compatibility: Any future changes to hash or crypto packages will endeavor +to maintain compatibility with state encoded using previous versions. +That is, any released versions of the packages should be able to +decode data written with any previously released version, +subject to issues such as security fixes. +See the Go compatibility document for background: + +#### type [Hash32](https://cs.opensource.google/go/go/+/go1.19:src/hash/hash.go;l=49) [¶](#Hash32 "Go to Hash32") + +```None +type Hash32 interface { + Hash + Sum32() uint32 +} +``` + +Hash32 is the common interface implemented by all 32-bit hash functions. + +#### type [Hash64](https://cs.opensource.google/go/go/+/go1.19:src/hash/hash.go;l=55) [¶](#Hash64 "Go to Hash64") + +```None +type Hash64 interface { + Hash + Sum64() uint64 +} +``` + +Hash64 is the common interface implemented by all 64-bit hash functions. diff --git a/corpus/docs/golang/hash/hash_go120.md b/corpus/docs/golang/hash/hash_go120.md new file mode 100644 index 0000000000000000000000000000000000000000..32d9d7b0edd9b234bfcb40058617fcf10be376eb --- /dev/null +++ b/corpus/docs/golang/hash/hash_go120.md @@ -0,0 +1,159 @@ +# Golang - hash + +Source: https://pkg.go.dev/hash@go1.20 +Version: go1.20 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package hash provides interfaces for hash functions. + +Example (BinaryMarshaler) [¶](#example-package-BinaryMarshaler "Go to Example (BinaryMarshaler)") + +```None +package main + +import ( + "bytes" + "crypto/sha256" + "encoding" + "fmt" + "log" +) + +func main() { + const ( + input1 = "The tunneling gopher digs downwards, " + input2 = "unaware of what he will find." + ) + + first := sha256.New() + first.Write([]byte(input1)) + + marshaler, ok := first.(encoding.BinaryMarshaler) + if !ok { + log.Fatal("first does not implement encoding.BinaryMarshaler") + } + state, err := marshaler.MarshalBinary() + if err != nil { + log.Fatal("unable to marshal hash:", err) + } + + second := sha256.New() + + unmarshaler, ok := second.(encoding.BinaryUnmarshaler) + if !ok { + log.Fatal("second does not implement encoding.BinaryUnmarshaler") + } + if err := unmarshaler.UnmarshalBinary(state); err != nil { + log.Fatal("unable to unmarshal hash:", err) + } + + first.Write([]byte(input2)) + second.Write([]byte(input2)) + + fmt.Printf("%x\n", first.Sum(nil)) + fmt.Println(bytes.Equal(first.Sum(nil), second.Sum(nil))) +} +``` + +```None +Output: + +57d51a066f3a39942649cd9a76c77e97ceab246756ff3888659e6aa5a07f4a52 +true +``` + +Share +Format +Run + +### Index [¶](#pkg-index "Go to Index") + +* [type Hash](#Hash) +* [type Hash32](#Hash32) +* [type Hash64](#Hash64) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Package (BinaryMarshaler)](#example-package-BinaryMarshaler) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +This section is empty. + +### Types [¶](#pkg-types "Go to Types") + +#### type [Hash](https://cs.opensource.google/go/go/+/go1.20:src/hash/hash.go;l=26) [¶](#Hash "Go to Hash") + +```None +type Hash interface { + // Write (via the embedded io.Writer interface) adds more data to the running hash. + // It never returns an error. + io.Writer + + // Sum appends the current hash to b and returns the resulting slice. + // It does not change the underlying hash state. + Sum(b []byte) []byte + + // Reset resets the Hash to its initial state. + Reset() + + // Size returns the number of bytes Sum will return. + Size() int + + // BlockSize returns the hash's underlying block size. + // The Write method must be able to accept any amount + // of data, but it may operate more efficiently if all writes + // are a multiple of the block size. + BlockSize() int +} +``` + +Hash is the common interface implemented by all hash functions. + +Hash implementations in the standard library (e.g. hash/crc32 and +crypto/sha256) implement the encoding.BinaryMarshaler and +encoding.BinaryUnmarshaler interfaces. Marshaling a hash implementation +allows its internal state to be saved and used for additional processing +later, without having to re-write the data previously written to the hash. +The hash state may contain portions of the input in its original form, +which users are expected to handle for any possible security implications. + +Compatibility: Any future changes to hash or crypto packages will endeavor +to maintain compatibility with state encoded using previous versions. +That is, any released versions of the packages should be able to +decode data written with any previously released version, +subject to issues such as security fixes. +See the Go compatibility document for background: + +#### type [Hash32](https://cs.opensource.google/go/go/+/go1.20:src/hash/hash.go;l=49) [¶](#Hash32 "Go to Hash32") + +```None +type Hash32 interface { + Hash + Sum32() uint32 +} +``` + +Hash32 is the common interface implemented by all 32-bit hash functions. + +#### type [Hash64](https://cs.opensource.google/go/go/+/go1.20:src/hash/hash.go;l=55) [¶](#Hash64 "Go to Hash64") + +```None +type Hash64 interface { + Hash + Sum64() uint64 +} +``` + +Hash64 is the common interface implemented by all 64-bit hash functions. diff --git a/corpus/docs/golang/hash/hash_go1210.md b/corpus/docs/golang/hash/hash_go1210.md new file mode 100644 index 0000000000000000000000000000000000000000..5e9537806ae1c5d325850e612ab20b50af1e1d46 --- /dev/null +++ b/corpus/docs/golang/hash/hash_go1210.md @@ -0,0 +1,159 @@ +# Golang - hash + +Source: https://pkg.go.dev/hash@go1.21.0 +Version: go1.21.0 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package hash provides interfaces for hash functions. + +Example (BinaryMarshaler) [¶](#example-package-BinaryMarshaler "Go to Example (BinaryMarshaler)") + +```None +package main + +import ( + "bytes" + "crypto/sha256" + "encoding" + "fmt" + "log" +) + +func main() { + const ( + input1 = "The tunneling gopher digs downwards, " + input2 = "unaware of what he will find." + ) + + first := sha256.New() + first.Write([]byte(input1)) + + marshaler, ok := first.(encoding.BinaryMarshaler) + if !ok { + log.Fatal("first does not implement encoding.BinaryMarshaler") + } + state, err := marshaler.MarshalBinary() + if err != nil { + log.Fatal("unable to marshal hash:", err) + } + + second := sha256.New() + + unmarshaler, ok := second.(encoding.BinaryUnmarshaler) + if !ok { + log.Fatal("second does not implement encoding.BinaryUnmarshaler") + } + if err := unmarshaler.UnmarshalBinary(state); err != nil { + log.Fatal("unable to unmarshal hash:", err) + } + + first.Write([]byte(input2)) + second.Write([]byte(input2)) + + fmt.Printf("%x\n", first.Sum(nil)) + fmt.Println(bytes.Equal(first.Sum(nil), second.Sum(nil))) +} +``` + +```None +Output: + +57d51a066f3a39942649cd9a76c77e97ceab246756ff3888659e6aa5a07f4a52 +true +``` + +Share +Format +Run + +### Index [¶](#pkg-index "Go to Index") + +* [type Hash](#Hash) +* [type Hash32](#Hash32) +* [type Hash64](#Hash64) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Package (BinaryMarshaler)](#example-package-BinaryMarshaler) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +This section is empty. + +### Types [¶](#pkg-types "Go to Types") + +#### type [Hash](https://cs.opensource.google/go/go/+/go1.21.0:src/hash/hash.go;l=26) [¶](#Hash "Go to Hash") + +```None +type Hash interface { + // Write (via the embedded io.Writer interface) adds more data to the running hash. + // It never returns an error. + io.Writer + + // Sum appends the current hash to b and returns the resulting slice. + // It does not change the underlying hash state. + Sum(b []byte) []byte + + // Reset resets the Hash to its initial state. + Reset() + + // Size returns the number of bytes Sum will return. + Size() int + + // BlockSize returns the hash's underlying block size. + // The Write method must be able to accept any amount + // of data, but it may operate more efficiently if all writes + // are a multiple of the block size. + BlockSize() int +} +``` + +Hash is the common interface implemented by all hash functions. + +Hash implementations in the standard library (e.g. hash/crc32 and +crypto/sha256) implement the encoding.BinaryMarshaler and +encoding.BinaryUnmarshaler interfaces. Marshaling a hash implementation +allows its internal state to be saved and used for additional processing +later, without having to re-write the data previously written to the hash. +The hash state may contain portions of the input in its original form, +which users are expected to handle for any possible security implications. + +Compatibility: Any future changes to hash or crypto packages will endeavor +to maintain compatibility with state encoded using previous versions. +That is, any released versions of the packages should be able to +decode data written with any previously released version, +subject to issues such as security fixes. +See the Go compatibility document for background: + +#### type [Hash32](https://cs.opensource.google/go/go/+/go1.21.0:src/hash/hash.go;l=49) [¶](#Hash32 "Go to Hash32") + +```None +type Hash32 interface { + Hash + Sum32() uint32 +} +``` + +Hash32 is the common interface implemented by all 32-bit hash functions. + +#### type [Hash64](https://cs.opensource.google/go/go/+/go1.21.0:src/hash/hash.go;l=55) [¶](#Hash64 "Go to Hash64") + +```None +type Hash64 interface { + Hash + Sum64() uint64 +} +``` + +Hash64 is the common interface implemented by all 64-bit hash functions. diff --git a/corpus/docs/golang/hash/hash_go1220.md b/corpus/docs/golang/hash/hash_go1220.md new file mode 100644 index 0000000000000000000000000000000000000000..fe0d5a81b83e543284faa423459a98439e4e2ecb --- /dev/null +++ b/corpus/docs/golang/hash/hash_go1220.md @@ -0,0 +1,159 @@ +# Golang - hash + +Source: https://pkg.go.dev/hash@go1.22.0 +Version: go1.22.0 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package hash provides interfaces for hash functions. + +Example (BinaryMarshaler) [¶](#example-package-BinaryMarshaler "Go to Example (BinaryMarshaler)") + +```None +package main + +import ( + "bytes" + "crypto/sha256" + "encoding" + "fmt" + "log" +) + +func main() { + const ( + input1 = "The tunneling gopher digs downwards, " + input2 = "unaware of what he will find." + ) + + first := sha256.New() + first.Write([]byte(input1)) + + marshaler, ok := first.(encoding.BinaryMarshaler) + if !ok { + log.Fatal("first does not implement encoding.BinaryMarshaler") + } + state, err := marshaler.MarshalBinary() + if err != nil { + log.Fatal("unable to marshal hash:", err) + } + + second := sha256.New() + + unmarshaler, ok := second.(encoding.BinaryUnmarshaler) + if !ok { + log.Fatal("second does not implement encoding.BinaryUnmarshaler") + } + if err := unmarshaler.UnmarshalBinary(state); err != nil { + log.Fatal("unable to unmarshal hash:", err) + } + + first.Write([]byte(input2)) + second.Write([]byte(input2)) + + fmt.Printf("%x\n", first.Sum(nil)) + fmt.Println(bytes.Equal(first.Sum(nil), second.Sum(nil))) +} +``` + +```None +Output: + +57d51a066f3a39942649cd9a76c77e97ceab246756ff3888659e6aa5a07f4a52 +true +``` + +Share +Format +Run + +### Index [¶](#pkg-index "Go to Index") + +* [type Hash](#Hash) +* [type Hash32](#Hash32) +* [type Hash64](#Hash64) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Package (BinaryMarshaler)](#example-package-BinaryMarshaler) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +This section is empty. + +### Types [¶](#pkg-types "Go to Types") + +#### type [Hash](https://cs.opensource.google/go/go/+/go1.22.0:src/hash/hash.go;l=26) [¶](#Hash "Go to Hash") + +```None +type Hash interface { + // Write (via the embedded io.Writer interface) adds more data to the running hash. + // It never returns an error. + io.Writer + + // Sum appends the current hash to b and returns the resulting slice. + // It does not change the underlying hash state. + Sum(b []byte) []byte + + // Reset resets the Hash to its initial state. + Reset() + + // Size returns the number of bytes Sum will return. + Size() int + + // BlockSize returns the hash's underlying block size. + // The Write method must be able to accept any amount + // of data, but it may operate more efficiently if all writes + // are a multiple of the block size. + BlockSize() int +} +``` + +Hash is the common interface implemented by all hash functions. + +Hash implementations in the standard library (e.g. [hash/crc32](/hash/crc32) and +[crypto/sha256](/crypto/sha256)) implement the [encoding.BinaryMarshaler](/encoding#BinaryMarshaler) and +[encoding.BinaryUnmarshaler](/encoding#BinaryUnmarshaler) interfaces. Marshaling a hash implementation +allows its internal state to be saved and used for additional processing +later, without having to re-write the data previously written to the hash. +The hash state may contain portions of the input in its original form, +which users are expected to handle for any possible security implications. + +Compatibility: Any future changes to hash or crypto packages will endeavor +to maintain compatibility with state encoded using previous versions. +That is, any released versions of the packages should be able to +decode data written with any previously released version, +subject to issues such as security fixes. +See the Go compatibility document for background: + +#### type [Hash32](https://cs.opensource.google/go/go/+/go1.22.0:src/hash/hash.go;l=49) [¶](#Hash32 "Go to Hash32") + +```None +type Hash32 interface { + Hash + Sum32() uint32 +} +``` + +Hash32 is the common interface implemented by all 32-bit hash functions. + +#### type [Hash64](https://cs.opensource.google/go/go/+/go1.22.0:src/hash/hash.go;l=55) [¶](#Hash64 "Go to Hash64") + +```None +type Hash64 interface { + Hash + Sum64() uint64 +} +``` + +Hash64 is the common interface implemented by all 64-bit hash functions. diff --git a/corpus/docs/golang/hash/hash_go1230.md b/corpus/docs/golang/hash/hash_go1230.md new file mode 100644 index 0000000000000000000000000000000000000000..874b86ca15c2bb05f4e3f19a7e75516600980674 --- /dev/null +++ b/corpus/docs/golang/hash/hash_go1230.md @@ -0,0 +1,159 @@ +# Golang - hash + +Source: https://pkg.go.dev/hash@go1.23.0 +Version: go1.23.0 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package hash provides interfaces for hash functions. + +Example (BinaryMarshaler) [¶](#example-package-BinaryMarshaler "Go to Example (BinaryMarshaler)") + +```None +package main + +import ( + "bytes" + "crypto/sha256" + "encoding" + "fmt" + "log" +) + +func main() { + const ( + input1 = "The tunneling gopher digs downwards, " + input2 = "unaware of what he will find." + ) + + first := sha256.New() + first.Write([]byte(input1)) + + marshaler, ok := first.(encoding.BinaryMarshaler) + if !ok { + log.Fatal("first does not implement encoding.BinaryMarshaler") + } + state, err := marshaler.MarshalBinary() + if err != nil { + log.Fatal("unable to marshal hash:", err) + } + + second := sha256.New() + + unmarshaler, ok := second.(encoding.BinaryUnmarshaler) + if !ok { + log.Fatal("second does not implement encoding.BinaryUnmarshaler") + } + if err := unmarshaler.UnmarshalBinary(state); err != nil { + log.Fatal("unable to unmarshal hash:", err) + } + + first.Write([]byte(input2)) + second.Write([]byte(input2)) + + fmt.Printf("%x\n", first.Sum(nil)) + fmt.Println(bytes.Equal(first.Sum(nil), second.Sum(nil))) +} +``` + +```None +Output: + +57d51a066f3a39942649cd9a76c77e97ceab246756ff3888659e6aa5a07f4a52 +true +``` + +Share +Format +Run + +### Index [¶](#pkg-index "Go to Index") + +* [type Hash](#Hash) +* [type Hash32](#Hash32) +* [type Hash64](#Hash64) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Package (BinaryMarshaler)](#example-package-BinaryMarshaler) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +This section is empty. + +### Types [¶](#pkg-types "Go to Types") + +#### type [Hash](https://cs.opensource.google/go/go/+/go1.23.0:src/hash/hash.go;l=26) [¶](#Hash "Go to Hash") + +```None +type Hash interface { + // Write (via the embedded io.Writer interface) adds more data to the running hash. + // It never returns an error. + io.Writer + + // Sum appends the current hash to b and returns the resulting slice. + // It does not change the underlying hash state. + Sum(b []byte) []byte + + // Reset resets the Hash to its initial state. + Reset() + + // Size returns the number of bytes Sum will return. + Size() int + + // BlockSize returns the hash's underlying block size. + // The Write method must be able to accept any amount + // of data, but it may operate more efficiently if all writes + // are a multiple of the block size. + BlockSize() int +} +``` + +Hash is the common interface implemented by all hash functions. + +Hash implementations in the standard library (e.g. [hash/crc32](/hash/crc32) and +[crypto/sha256](/crypto/sha256)) implement the [encoding.BinaryMarshaler](/encoding#BinaryMarshaler) and +[encoding.BinaryUnmarshaler](/encoding#BinaryUnmarshaler) interfaces. Marshaling a hash implementation +allows its internal state to be saved and used for additional processing +later, without having to re-write the data previously written to the hash. +The hash state may contain portions of the input in its original form, +which users are expected to handle for any possible security implications. + +Compatibility: Any future changes to hash or crypto packages will endeavor +to maintain compatibility with state encoded using previous versions. +That is, any released versions of the packages should be able to +decode data written with any previously released version, +subject to issues such as security fixes. +See the Go compatibility document for background: + +#### type [Hash32](https://cs.opensource.google/go/go/+/go1.23.0:src/hash/hash.go;l=49) [¶](#Hash32 "Go to Hash32") + +```None +type Hash32 interface { + Hash + Sum32() uint32 +} +``` + +Hash32 is the common interface implemented by all 32-bit hash functions. + +#### type [Hash64](https://cs.opensource.google/go/go/+/go1.23.0:src/hash/hash.go;l=55) [¶](#Hash64 "Go to Hash64") + +```None +type Hash64 interface { + Hash + Sum64() uint64 +} +``` + +Hash64 is the common interface implemented by all 64-bit hash functions. diff --git a/corpus/docs/golang/hash/hash_go1240.md b/corpus/docs/golang/hash/hash_go1240.md new file mode 100644 index 0000000000000000000000000000000000000000..82148e70216f8611dc0c386e1adc1d08663c2ac4 --- /dev/null +++ b/corpus/docs/golang/hash/hash_go1240.md @@ -0,0 +1,159 @@ +# Golang - hash + +Source: https://pkg.go.dev/hash@go1.24.0 +Version: go1.24.0 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package hash provides interfaces for hash functions. + +Example (BinaryMarshaler) [¶](#example-package-BinaryMarshaler "Go to Example (BinaryMarshaler)") + +```None +package main + +import ( + "bytes" + "crypto/sha256" + "encoding" + "fmt" + "log" +) + +func main() { + const ( + input1 = "The tunneling gopher digs downwards, " + input2 = "unaware of what he will find." + ) + + first := sha256.New() + first.Write([]byte(input1)) + + marshaler, ok := first.(encoding.BinaryMarshaler) + if !ok { + log.Fatal("first does not implement encoding.BinaryMarshaler") + } + state, err := marshaler.MarshalBinary() + if err != nil { + log.Fatal("unable to marshal hash:", err) + } + + second := sha256.New() + + unmarshaler, ok := second.(encoding.BinaryUnmarshaler) + if !ok { + log.Fatal("second does not implement encoding.BinaryUnmarshaler") + } + if err := unmarshaler.UnmarshalBinary(state); err != nil { + log.Fatal("unable to unmarshal hash:", err) + } + + first.Write([]byte(input2)) + second.Write([]byte(input2)) + + fmt.Printf("%x\n", first.Sum(nil)) + fmt.Println(bytes.Equal(first.Sum(nil), second.Sum(nil))) +} +``` + +```None +Output: + +57d51a066f3a39942649cd9a76c77e97ceab246756ff3888659e6aa5a07f4a52 +true +``` + +Share +Format +Run + +### Index [¶](#pkg-index "Go to Index") + +* [type Hash](#Hash) +* [type Hash32](#Hash32) +* [type Hash64](#Hash64) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Package (BinaryMarshaler)](#example-package-BinaryMarshaler) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +This section is empty. + +### Types [¶](#pkg-types "Go to Types") + +#### type [Hash](https://cs.opensource.google/go/go/+/go1.24.0:src/hash/hash.go;l=26) [¶](#Hash "Go to Hash") + +```None +type Hash interface { + // Write (via the embedded io.Writer interface) adds more data to the running hash. + // It never returns an error. + io.Writer + + // Sum appends the current hash to b and returns the resulting slice. + // It does not change the underlying hash state. + Sum(b []byte) []byte + + // Reset resets the Hash to its initial state. + Reset() + + // Size returns the number of bytes Sum will return. + Size() int + + // BlockSize returns the hash's underlying block size. + // The Write method must be able to accept any amount + // of data, but it may operate more efficiently if all writes + // are a multiple of the block size. + BlockSize() int +} +``` + +Hash is the common interface implemented by all hash functions. + +Hash implementations in the standard library (e.g. [hash/crc32](/hash/crc32) and +[crypto/sha256](/crypto/sha256)) implement the [encoding.BinaryMarshaler](/encoding#BinaryMarshaler), [encoding.BinaryAppender](/encoding#BinaryAppender) +and [encoding.BinaryUnmarshaler](/encoding#BinaryUnmarshaler) interfaces. Marshaling a hash implementation +allows its internal state to be saved and used for additional processing +later, without having to re-write the data previously written to the hash. +The hash state may contain portions of the input in its original form, +which users are expected to handle for any possible security implications. + +Compatibility: Any future changes to hash or crypto packages will endeavor +to maintain compatibility with state encoded using previous versions. +That is, any released versions of the packages should be able to +decode data written with any previously released version, +subject to issues such as security fixes. +See the Go compatibility document for background: + +#### type [Hash32](https://cs.opensource.google/go/go/+/go1.24.0:src/hash/hash.go;l=49) [¶](#Hash32 "Go to Hash32") + +```None +type Hash32 interface { + Hash + Sum32() uint32 +} +``` + +Hash32 is the common interface implemented by all 32-bit hash functions. + +#### type [Hash64](https://cs.opensource.google/go/go/+/go1.24.0:src/hash/hash.go;l=55) [¶](#Hash64 "Go to Hash64") + +```None +type Hash64 interface { + Hash + Sum64() uint64 +} +``` + +Hash64 is the common interface implemented by all 64-bit hash functions. diff --git a/corpus/docs/golang/maps/maps_go1210.md b/corpus/docs/golang/maps/maps_go1210.md new file mode 100644 index 0000000000000000000000000000000000000000..b87eb006aa7774af8d4813e21f07958ce4c113fa --- /dev/null +++ b/corpus/docs/golang/maps/maps_go1210.md @@ -0,0 +1,156 @@ +# Golang - maps + +Source: https://pkg.go.dev/maps@go1.21.0 +Version: go1.21.0 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package maps defines various functions useful with maps of any type. + +### Index [¶](#pkg-index "Go to Index") + +* [func Clone[M ~map[K]V, K comparable, V any](m M) M](#Clone) +* [func Copy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2)](#Copy) +* [func DeleteFunc[M ~map[K]V, K comparable, V any](m M, del func(K, V) bool)](#DeleteFunc) +* [func Equal[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool](#Equal) +* [func EqualFunc[M1 ~map[K]V1, M2 ~map[K]V2, K comparable, V1, V2 any](m1 M1, m2 M2, eq func(V1, V2) bool) bool](#EqualFunc) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [DeleteFunc](#example-DeleteFunc) +* [EqualFunc](#example-EqualFunc) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [Clone](https://cs.opensource.google/go/go/+/go1.21.0:src/maps/maps.go;l=41) [¶](#Clone "Go to Clone") + +```None +func Clone[M ~map[K]V, K comparable, V any](m M) M +``` + +Clone returns a copy of m. This is a shallow clone: +the new keys and values are set using ordinary assignment. + +#### func [Copy](https://cs.opensource.google/go/go/+/go1.21.0:src/maps/maps.go;l=53) [¶](#Copy "Go to Copy") + +```None +func Copy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) +``` + +Copy copies all key/value pairs in src adding them to dst. +When a key in src is already present in dst, +the value in dst will be overwritten by the value associated +with the key in src. + +#### func [DeleteFunc](https://cs.opensource.google/go/go/+/go1.21.0:src/maps/maps.go;l=60) [¶](#DeleteFunc "Go to DeleteFunc") + +```None +func DeleteFunc[M ~map[K]V, K comparable, V any](m M, del func(K, V) bool) +``` + +DeleteFunc deletes any key/value pairs from m for which del returns true. + +Example [¶](#example-DeleteFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" +) + +func main() { + m := map[string]int{ + "one": 1, + "two": 2, + "three": 3, + "four": 4, + } + maps.DeleteFunc(m, func(k string, v int) bool { + return v%2 != 0 // delete odd values + }) + fmt.Println(m) +} +``` + +```None +Output: + +map[four:4 two:2] +``` + +Share +Format +Run + +#### func [Equal](https://cs.opensource.google/go/go/+/go1.21.0:src/maps/maps.go;l=10) [¶](#Equal "Go to Equal") + +```None +func Equal[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool +``` + +Equal reports whether two maps contain the same key/value pairs. +Values are compared using ==. + +#### func [EqualFunc](https://cs.opensource.google/go/go/+/go1.21.0:src/maps/maps.go;l=24) [¶](#EqualFunc "Go to EqualFunc") + +```None +func EqualFunc[M1 ~map[K]V1, M2 ~map[K]V2, K comparable, V1, V2 any](m1 M1, m2 M2, eq func(V1, V2) bool) bool +``` + +EqualFunc is like Equal, but compares values using eq. +Keys are still compared with ==. + +Example [¶](#example-EqualFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" + "strings" +) + +func main() { + m1 := map[int]string{ + 1: "one", + 10: "Ten", + 1000: "THOUSAND", + } + m2 := map[int][]byte{ + 1: []byte("One"), + 10: []byte("Ten"), + 1000: []byte("Thousand"), + } + eq := maps.EqualFunc(m1, m2, func(v1 string, v2 []byte) bool { + return strings.ToLower(v1) == strings.ToLower(string(v2)) + }) + fmt.Println(eq) +} +``` + +```None +Output: + +true +``` + +Share +Format +Run + +### Types [¶](#pkg-types "Go to Types") + +This section is empty. diff --git a/corpus/docs/golang/maps/maps_go1220.md b/corpus/docs/golang/maps/maps_go1220.md new file mode 100644 index 0000000000000000000000000000000000000000..507ed66b67638d3d684a466a7727d566986991ba --- /dev/null +++ b/corpus/docs/golang/maps/maps_go1220.md @@ -0,0 +1,306 @@ +# Golang - maps + +Source: https://pkg.go.dev/maps@go1.22.0 +Version: go1.22.0 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package maps defines various functions useful with maps of any type. + +### Index [¶](#pkg-index "Go to Index") + +* [func Clone[M ~map[K]V, K comparable, V any](m M) M](#Clone) +* [func Copy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2)](#Copy) +* [func DeleteFunc[M ~map[K]V, K comparable, V any](m M, del func(K, V) bool)](#DeleteFunc) +* [func Equal[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool](#Equal) +* [func EqualFunc[M1 ~map[K]V1, M2 ~map[K]V2, K comparable, V1, V2 any](m1 M1, m2 M2, eq func(V1, V2) bool) bool](#EqualFunc) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Clone](#example-Clone) +* [Copy](#example-Copy) +* [DeleteFunc](#example-DeleteFunc) +* [Equal](#example-Equal) +* [EqualFunc](#example-EqualFunc) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [Clone](https://cs.opensource.google/go/go/+/go1.22.0:src/maps/maps.go;l=41) [¶](#Clone "Go to Clone") + +```None +func Clone[M ~map[K]V, K comparable, V any](m M) M +``` + +Clone returns a copy of m. This is a shallow clone: +the new keys and values are set using ordinary assignment. + +Example [¶](#example-Clone "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" +) + +func main() { + m1 := map[string]int{ + "key": 1, + } + m2 := maps.Clone(m1) + m2["key"] = 100 + fmt.Println(m1["key"]) + fmt.Println(m2["key"]) + + m3 := map[string][]int{ + "key": {1, 2, 3}, + } + m4 := maps.Clone(m3) + fmt.Println(m4["key"][0]) + m4["key"][0] = 100 + fmt.Println(m3["key"][0]) + fmt.Println(m4["key"][0]) + +} +``` + +```None +Output: + +1 +100 +1 +100 +100 +``` + +Share +Format +Run + +#### func [Copy](https://cs.opensource.google/go/go/+/go1.22.0:src/maps/maps.go;l=53) [¶](#Copy "Go to Copy") + +```None +func Copy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) +``` + +Copy copies all key/value pairs in src adding them to dst. +When a key in src is already present in dst, +the value in dst will be overwritten by the value associated +with the key in src. + +Example [¶](#example-Copy "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" +) + +func main() { + m1 := map[string]int{ + "one": 1, + "two": 2, + } + m2 := map[string]int{ + "one": 10, + } + + maps.Copy(m2, m1) + fmt.Println("m2 is:", m2) + + m2["one"] = 100 + fmt.Println("m1 is:", m1) + fmt.Println("m2 is:", m2) + + m3 := map[string][]int{ + "one": {1, 2, 3}, + "two": {4, 5, 6}, + } + m4 := map[string][]int{ + "one": {7, 8, 9}, + } + + maps.Copy(m4, m3) + fmt.Println("m4 is:", m4) + + m4["one"][0] = 100 + fmt.Println("m3 is:", m3) + fmt.Println("m4 is:", m4) + +} +``` + +```None +Output: + +m2 is: map[one:1 two:2] +m1 is: map[one:1 two:2] +m2 is: map[one:100 two:2] +m4 is: map[one:[1 2 3] two:[4 5 6]] +m3 is: map[one:[100 2 3] two:[4 5 6]] +m4 is: map[one:[100 2 3] two:[4 5 6]] +``` + +Share +Format +Run + +#### func [DeleteFunc](https://cs.opensource.google/go/go/+/go1.22.0:src/maps/maps.go;l=60) [¶](#DeleteFunc "Go to DeleteFunc") + +```None +func DeleteFunc[M ~map[K]V, K comparable, V any](m M, del func(K, V) bool) +``` + +DeleteFunc deletes any key/value pairs from m for which del returns true. + +Example [¶](#example-DeleteFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" +) + +func main() { + m := map[string]int{ + "one": 1, + "two": 2, + "three": 3, + "four": 4, + } + maps.DeleteFunc(m, func(k string, v int) bool { + return v%2 != 0 // delete odd values + }) + fmt.Println(m) +} +``` + +```None +Output: + +map[four:4 two:2] +``` + +Share +Format +Run + +#### func [Equal](https://cs.opensource.google/go/go/+/go1.22.0:src/maps/maps.go;l=10) [¶](#Equal "Go to Equal") + +```None +func Equal[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool +``` + +Equal reports whether two maps contain the same key/value pairs. +Values are compared using ==. + +Example [¶](#example-Equal "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" +) + +func main() { + m1 := map[int]string{ + 1: "one", + 10: "Ten", + 1000: "THOUSAND", + } + m2 := map[int]string{ + 1: "one", + 10: "Ten", + 1000: "THOUSAND", + } + m3 := map[int]string{ + 1: "one", + 10: "ten", + 1000: "thousand", + } + + fmt.Println(maps.Equal(m1, m2)) + fmt.Println(maps.Equal(m1, m3)) +} +``` + +```None +Output: + +true +false +``` + +Share +Format +Run + +#### func [EqualFunc](https://cs.opensource.google/go/go/+/go1.22.0:src/maps/maps.go;l=24) [¶](#EqualFunc "Go to EqualFunc") + +```None +func EqualFunc[M1 ~map[K]V1, M2 ~map[K]V2, K comparable, V1, V2 any](m1 M1, m2 M2, eq func(V1, V2) bool) bool +``` + +EqualFunc is like Equal, but compares values using eq. +Keys are still compared with ==. + +Example [¶](#example-EqualFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" + "strings" +) + +func main() { + m1 := map[int]string{ + 1: "one", + 10: "Ten", + 1000: "THOUSAND", + } + m2 := map[int][]byte{ + 1: []byte("One"), + 10: []byte("Ten"), + 1000: []byte("Thousand"), + } + eq := maps.EqualFunc(m1, m2, func(v1 string, v2 []byte) bool { + return strings.ToLower(v1) == strings.ToLower(string(v2)) + }) + fmt.Println(eq) +} +``` + +```None +Output: + +true +``` + +Share +Format +Run + +### Types [¶](#pkg-types "Go to Types") + +This section is empty. diff --git a/corpus/docs/golang/maps/maps_go1230.md b/corpus/docs/golang/maps/maps_go1230.md new file mode 100644 index 0000000000000000000000000000000000000000..91c9d9bb4f76b9f85680e682bb800c1ff913973e --- /dev/null +++ b/corpus/docs/golang/maps/maps_go1230.md @@ -0,0 +1,362 @@ +# Golang - maps + +Source: https://pkg.go.dev/maps@go1.23.0 +Version: go1.23.0 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package maps defines various functions useful with maps of any type. + +This package does not have any special handling for non-reflexive keys +(keys k where k != k), such as floating-point NaNs. + +### Index [¶](#pkg-index "Go to Index") + +* [func All[Map ~map[K]V, K comparable, V any](m Map) iter.Seq2[K, V]](#All) +* [func Clone[M ~map[K]V, K comparable, V any](m M) M](#Clone) +* [func Collect[K comparable, V any](seq iter.Seq2[K, V]) map[K]V](#Collect) +* [func Copy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2)](#Copy) +* [func DeleteFunc[M ~map[K]V, K comparable, V any](m M, del func(K, V) bool)](#DeleteFunc) +* [func Equal[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool](#Equal) +* [func EqualFunc[M1 ~map[K]V1, M2 ~map[K]V2, K comparable, V1, V2 any](m1 M1, m2 M2, eq func(V1, V2) bool) bool](#EqualFunc) +* [func Insert[Map ~map[K]V, K comparable, V any](m Map, seq iter.Seq2[K, V])](#Insert) +* [func Keys[Map ~map[K]V, K comparable, V any](m Map) iter.Seq[K]](#Keys) +* [func Values[Map ~map[K]V, K comparable, V any](m Map) iter.Seq[V]](#Values) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Clone](#example-Clone) +* [Copy](#example-Copy) +* [DeleteFunc](#example-DeleteFunc) +* [Equal](#example-Equal) +* [EqualFunc](#example-EqualFunc) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [All](https://cs.opensource.google/go/go/+/go1.23.0:src/maps/iter.go;l=12) [¶](#All "Go to All") added in go1.23.0 + +```None +func All[Map ~map[K]V, K comparable, V any](m Map) iter.Seq2[K, V] +``` + +All returns an iterator over key-value pairs from m. +The iteration order is not specified and is not guaranteed +to be the same from one call to the next. + +#### func [Clone](https://cs.opensource.google/go/go/+/go1.23.0:src/maps/maps.go;l=50) [¶](#Clone "Go to Clone") + +```None +func Clone[M ~map[K]V, K comparable, V any](m M) M +``` + +Clone returns a copy of m. This is a shallow clone: +the new keys and values are set using ordinary assignment. + +Example [¶](#example-Clone "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" +) + +func main() { + m1 := map[string]int{ + "key": 1, + } + m2 := maps.Clone(m1) + m2["key"] = 100 + fmt.Println(m1["key"]) + fmt.Println(m2["key"]) + + m3 := map[string][]int{ + "key": {1, 2, 3}, + } + m4 := maps.Clone(m3) + fmt.Println(m4["key"][0]) + m4["key"][0] = 100 + fmt.Println(m3["key"][0]) + fmt.Println(m4["key"][0]) + +} +``` + +```None +Output: + +1 +100 +1 +100 +100 +``` + +Share +Format +Run + +#### func [Collect](https://cs.opensource.google/go/go/+/go1.23.0:src/maps/iter.go;l=58) [¶](#Collect "Go to Collect") added in go1.23.0 + +```None +func Collect[K comparable, V any](seq iter.Seq2[K, V]) map[K]V +``` + +Collect collects key-value pairs from seq into a new map +and returns it. + +#### func [Copy](https://cs.opensource.google/go/go/+/go1.23.0:src/maps/maps.go;l=62) [¶](#Copy "Go to Copy") + +```None +func Copy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) +``` + +Copy copies all key/value pairs in src adding them to dst. +When a key in src is already present in dst, +the value in dst will be overwritten by the value associated +with the key in src. + +Example [¶](#example-Copy "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" +) + +func main() { + m1 := map[string]int{ + "one": 1, + "two": 2, + } + m2 := map[string]int{ + "one": 10, + } + + maps.Copy(m2, m1) + fmt.Println("m2 is:", m2) + + m2["one"] = 100 + fmt.Println("m1 is:", m1) + fmt.Println("m2 is:", m2) + + m3 := map[string][]int{ + "one": {1, 2, 3}, + "two": {4, 5, 6}, + } + m4 := map[string][]int{ + "one": {7, 8, 9}, + } + + maps.Copy(m4, m3) + fmt.Println("m4 is:", m4) + + m4["one"][0] = 100 + fmt.Println("m3 is:", m3) + fmt.Println("m4 is:", m4) + +} +``` + +```None +Output: + +m2 is: map[one:1 two:2] +m1 is: map[one:1 two:2] +m2 is: map[one:100 two:2] +m4 is: map[one:[1 2 3] two:[4 5 6]] +m3 is: map[one:[100 2 3] two:[4 5 6]] +m4 is: map[one:[100 2 3] two:[4 5 6]] +``` + +Share +Format +Run + +#### func [DeleteFunc](https://cs.opensource.google/go/go/+/go1.23.0:src/maps/maps.go;l=69) [¶](#DeleteFunc "Go to DeleteFunc") + +```None +func DeleteFunc[M ~map[K]V, K comparable, V any](m M, del func(K, V) bool) +``` + +DeleteFunc deletes any key/value pairs from m for which del returns true. + +Example [¶](#example-DeleteFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" +) + +func main() { + m := map[string]int{ + "one": 1, + "two": 2, + "three": 3, + "four": 4, + } + maps.DeleteFunc(m, func(k string, v int) bool { + return v%2 != 0 // delete odd values + }) + fmt.Println(m) +} +``` + +```None +Output: + +map[four:4 two:2] +``` + +Share +Format +Run + +#### func [Equal](https://cs.opensource.google/go/go/+/go1.23.0:src/maps/maps.go;l=17) [¶](#Equal "Go to Equal") + +```None +func Equal[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool +``` + +Equal reports whether two maps contain the same key/value pairs. +Values are compared using ==. + +Example [¶](#example-Equal "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" +) + +func main() { + m1 := map[int]string{ + 1: "one", + 10: "Ten", + 1000: "THOUSAND", + } + m2 := map[int]string{ + 1: "one", + 10: "Ten", + 1000: "THOUSAND", + } + m3 := map[int]string{ + 1: "one", + 10: "ten", + 1000: "thousand", + } + + fmt.Println(maps.Equal(m1, m2)) + fmt.Println(maps.Equal(m1, m3)) +} +``` + +```None +Output: + +true +false +``` + +Share +Format +Run + +#### func [EqualFunc](https://cs.opensource.google/go/go/+/go1.23.0:src/maps/maps.go;l=31) [¶](#EqualFunc "Go to EqualFunc") + +```None +func EqualFunc[M1 ~map[K]V1, M2 ~map[K]V2, K comparable, V1, V2 any](m1 M1, m2 M2, eq func(V1, V2) bool) bool +``` + +EqualFunc is like Equal, but compares values using eq. +Keys are still compared with ==. + +Example [¶](#example-EqualFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" + "strings" +) + +func main() { + m1 := map[int]string{ + 1: "one", + 10: "Ten", + 1000: "THOUSAND", + } + m2 := map[int][]byte{ + 1: []byte("One"), + 10: []byte("Ten"), + 1000: []byte("Thousand"), + } + eq := maps.EqualFunc(m1, m2, func(v1 string, v2 []byte) bool { + return strings.ToLower(v1) == strings.ToLower(string(v2)) + }) + fmt.Println(eq) +} +``` + +```None +Output: + +true +``` + +Share +Format +Run + +#### func [Insert](https://cs.opensource.google/go/go/+/go1.23.0:src/maps/iter.go;l=50) [¶](#Insert "Go to Insert") added in go1.23.0 + +```None +func Insert[Map ~map[K]V, K comparable, V any](m Map, seq iter.Seq2[K, V]) +``` + +Insert adds the key-value pairs from seq to m. +If a key in seq already exists in m, its value will be overwritten. + +#### func [Keys](https://cs.opensource.google/go/go/+/go1.23.0:src/maps/iter.go;l=25) [¶](#Keys "Go to Keys") added in go1.23.0 + +```None +func Keys[Map ~map[K]V, K comparable, V any](m Map) iter.Seq[K] +``` + +Keys returns an iterator over keys in m. +The iteration order is not specified and is not guaranteed +to be the same from one call to the next. + +#### func [Values](https://cs.opensource.google/go/go/+/go1.23.0:src/maps/iter.go;l=38) [¶](#Values "Go to Values") added in go1.23.0 + +```None +func Values[Map ~map[K]V, K comparable, V any](m Map) iter.Seq[V] +``` + +Values returns an iterator over values in m. +The iteration order is not specified and is not guaranteed +to be the same from one call to the next. + +### Types [¶](#pkg-types "Go to Types") + +This section is empty. diff --git a/corpus/docs/golang/maps/maps_go1240.md b/corpus/docs/golang/maps/maps_go1240.md new file mode 100644 index 0000000000000000000000000000000000000000..7b8ed450d3cba5ce878979450c2a7766794e8115 --- /dev/null +++ b/corpus/docs/golang/maps/maps_go1240.md @@ -0,0 +1,523 @@ +# Golang - maps + +Source: https://pkg.go.dev/maps@go1.24.0 +Version: go1.24.0 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package maps defines various functions useful with maps of any type. + +This package does not have any special handling for non-reflexive keys +(keys k where k != k), such as floating-point NaNs. + +### Index [¶](#pkg-index "Go to Index") + +* [func All[Map ~map[K]V, K comparable, V any](m Map) iter.Seq2[K, V]](#All) +* [func Clone[M ~map[K]V, K comparable, V any](m M) M](#Clone) +* [func Collect[K comparable, V any](seq iter.Seq2[K, V]) map[K]V](#Collect) +* [func Copy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2)](#Copy) +* [func DeleteFunc[M ~map[K]V, K comparable, V any](m M, del func(K, V) bool)](#DeleteFunc) +* [func Equal[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool](#Equal) +* [func EqualFunc[M1 ~map[K]V1, M2 ~map[K]V2, K comparable, V1, V2 any](m1 M1, m2 M2, eq func(V1, V2) bool) bool](#EqualFunc) +* [func Insert[Map ~map[K]V, K comparable, V any](m Map, seq iter.Seq2[K, V])](#Insert) +* [func Keys[Map ~map[K]V, K comparable, V any](m Map) iter.Seq[K]](#Keys) +* [func Values[Map ~map[K]V, K comparable, V any](m Map) iter.Seq[V]](#Values) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [All](#example-All) +* [Clone](#example-Clone) +* [Collect](#example-Collect) +* [Copy](#example-Copy) +* [DeleteFunc](#example-DeleteFunc) +* [Equal](#example-Equal) +* [EqualFunc](#example-EqualFunc) +* [Insert](#example-Insert) +* [Keys](#example-Keys) +* [Values](#example-Values) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [All](https://cs.opensource.google/go/go/+/go1.24.0:src/maps/iter.go;l=12) [¶](#All "Go to All") added in go1.23.0 + +```None +func All[Map ~map[K]V, K comparable, V any](m Map) iter.Seq2[K, V] +``` + +All returns an iterator over key-value pairs from m. +The iteration order is not specified and is not guaranteed +to be the same from one call to the next. + +Example [¶](#example-All "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" +) + +func main() { + m1 := map[string]int{ + "one": 1, + "two": 2, + } + m2 := map[string]int{ + "one": 10, + } + maps.Insert(m2, maps.All(m1)) + fmt.Println("m2 is:", m2) +} +``` + +```None +Output: + +m2 is: map[one:1 two:2] +``` + +Share +Format +Run + +#### func [Clone](https://cs.opensource.google/go/go/+/go1.24.0:src/maps/maps.go;l=50) [¶](#Clone "Go to Clone") + +```None +func Clone[M ~map[K]V, K comparable, V any](m M) M +``` + +Clone returns a copy of m. This is a shallow clone: +the new keys and values are set using ordinary assignment. + +Example [¶](#example-Clone "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" +) + +func main() { + m1 := map[string]int{ + "key": 1, + } + m2 := maps.Clone(m1) + m2["key"] = 100 + fmt.Println(m1["key"]) + fmt.Println(m2["key"]) + + m3 := map[string][]int{ + "key": {1, 2, 3}, + } + m4 := maps.Clone(m3) + fmt.Println(m4["key"][0]) + m4["key"][0] = 100 + fmt.Println(m3["key"][0]) + fmt.Println(m4["key"][0]) + +} +``` + +```None +Output: + +1 +100 +1 +100 +100 +``` + +Share +Format +Run + +#### func [Collect](https://cs.opensource.google/go/go/+/go1.24.0:src/maps/iter.go;l=58) [¶](#Collect "Go to Collect") added in go1.23.0 + +```None +func Collect[K comparable, V any](seq iter.Seq2[K, V]) map[K]V +``` + +Collect collects key-value pairs from seq into a new map +and returns it. + +Example [¶](#example-Collect "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" + "slices" +) + +func main() { + s1 := []string{"zero", "one", "two", "three"} + m1 := maps.Collect(slices.All(s1)) + fmt.Println("m1 is:", m1) +} +``` + +```None +Output: + +m1 is: map[0:zero 1:one 2:two 3:three] +``` + +Share +Format +Run + +#### func [Copy](https://cs.opensource.google/go/go/+/go1.24.0:src/maps/maps.go;l=62) [¶](#Copy "Go to Copy") + +```None +func Copy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) +``` + +Copy copies all key/value pairs in src adding them to dst. +When a key in src is already present in dst, +the value in dst will be overwritten by the value associated +with the key in src. + +Example [¶](#example-Copy "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" +) + +func main() { + m1 := map[string]int{ + "one": 1, + "two": 2, + } + m2 := map[string]int{ + "one": 10, + } + + maps.Copy(m2, m1) + fmt.Println("m2 is:", m2) + + m2["one"] = 100 + fmt.Println("m1 is:", m1) + fmt.Println("m2 is:", m2) + + m3 := map[string][]int{ + "one": {1, 2, 3}, + "two": {4, 5, 6}, + } + m4 := map[string][]int{ + "one": {7, 8, 9}, + } + + maps.Copy(m4, m3) + fmt.Println("m4 is:", m4) + + m4["one"][0] = 100 + fmt.Println("m3 is:", m3) + fmt.Println("m4 is:", m4) + +} +``` + +```None +Output: + +m2 is: map[one:1 two:2] +m1 is: map[one:1 two:2] +m2 is: map[one:100 two:2] +m4 is: map[one:[1 2 3] two:[4 5 6]] +m3 is: map[one:[100 2 3] two:[4 5 6]] +m4 is: map[one:[100 2 3] two:[4 5 6]] +``` + +Share +Format +Run + +#### func [DeleteFunc](https://cs.opensource.google/go/go/+/go1.24.0:src/maps/maps.go;l=69) [¶](#DeleteFunc "Go to DeleteFunc") + +```None +func DeleteFunc[M ~map[K]V, K comparable, V any](m M, del func(K, V) bool) +``` + +DeleteFunc deletes any key/value pairs from m for which del returns true. + +Example [¶](#example-DeleteFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" +) + +func main() { + m := map[string]int{ + "one": 1, + "two": 2, + "three": 3, + "four": 4, + } + maps.DeleteFunc(m, func(k string, v int) bool { + return v%2 != 0 // delete odd values + }) + fmt.Println(m) +} +``` + +```None +Output: + +map[four:4 two:2] +``` + +Share +Format +Run + +#### func [Equal](https://cs.opensource.google/go/go/+/go1.24.0:src/maps/maps.go;l=17) [¶](#Equal "Go to Equal") + +```None +func Equal[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool +``` + +Equal reports whether two maps contain the same key/value pairs. +Values are compared using ==. + +Example [¶](#example-Equal "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" +) + +func main() { + m1 := map[int]string{ + 1: "one", + 10: "Ten", + 1000: "THOUSAND", + } + m2 := map[int]string{ + 1: "one", + 10: "Ten", + 1000: "THOUSAND", + } + m3 := map[int]string{ + 1: "one", + 10: "ten", + 1000: "thousand", + } + + fmt.Println(maps.Equal(m1, m2)) + fmt.Println(maps.Equal(m1, m3)) +} +``` + +```None +Output: + +true +false +``` + +Share +Format +Run + +#### func [EqualFunc](https://cs.opensource.google/go/go/+/go1.24.0:src/maps/maps.go;l=31) [¶](#EqualFunc "Go to EqualFunc") + +```None +func EqualFunc[M1 ~map[K]V1, M2 ~map[K]V2, K comparable, V1, V2 any](m1 M1, m2 M2, eq func(V1, V2) bool) bool +``` + +EqualFunc is like Equal, but compares values using eq. +Keys are still compared with ==. + +Example [¶](#example-EqualFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" + "strings" +) + +func main() { + m1 := map[int]string{ + 1: "one", + 10: "Ten", + 1000: "THOUSAND", + } + m2 := map[int][]byte{ + 1: []byte("One"), + 10: []byte("Ten"), + 1000: []byte("Thousand"), + } + eq := maps.EqualFunc(m1, m2, func(v1 string, v2 []byte) bool { + return strings.ToLower(v1) == strings.ToLower(string(v2)) + }) + fmt.Println(eq) +} +``` + +```None +Output: + +true +``` + +Share +Format +Run + +#### func [Insert](https://cs.opensource.google/go/go/+/go1.24.0:src/maps/iter.go;l=50) [¶](#Insert "Go to Insert") added in go1.23.0 + +```None +func Insert[Map ~map[K]V, K comparable, V any](m Map, seq iter.Seq2[K, V]) +``` + +Insert adds the key-value pairs from seq to m. +If a key in seq already exists in m, its value will be overwritten. + +Example [¶](#example-Insert "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" + "slices" +) + +func main() { + m1 := map[int]string{ + 1000: "THOUSAND", + } + s1 := []string{"zero", "one", "two", "three"} + maps.Insert(m1, slices.All(s1)) + fmt.Println("m1 is:", m1) +} +``` + +```None +Output: + +m1 is: map[0:zero 1:one 2:two 3:three 1000:THOUSAND] +``` + +Share +Format +Run + +#### func [Keys](https://cs.opensource.google/go/go/+/go1.24.0:src/maps/iter.go;l=25) [¶](#Keys "Go to Keys") added in go1.23.0 + +```None +func Keys[Map ~map[K]V, K comparable, V any](m Map) iter.Seq[K] +``` + +Keys returns an iterator over keys in m. +The iteration order is not specified and is not guaranteed +to be the same from one call to the next. + +Example [¶](#example-Keys "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" + "slices" +) + +func main() { + m1 := map[int]string{ + 1: "one", + 10: "Ten", + 1000: "THOUSAND", + } + keys := slices.Sorted(maps.Keys(m1)) + fmt.Println(keys) +} +``` + +```None +Output: + +[1 10 1000] +``` + +Share +Format +Run + +#### func [Values](https://cs.opensource.google/go/go/+/go1.24.0:src/maps/iter.go;l=38) [¶](#Values "Go to Values") added in go1.23.0 + +```None +func Values[Map ~map[K]V, K comparable, V any](m Map) iter.Seq[V] +``` + +Values returns an iterator over values in m. +The iteration order is not specified and is not guaranteed +to be the same from one call to the next. + +Example [¶](#example-Values "Go to Example") + +```None +package main + +import ( + "fmt" + "maps" + "slices" +) + +func main() { + m1 := map[int]string{ + 1: "one", + 10: "Ten", + 1000: "THOUSAND", + } + values := slices.Sorted(maps.Values(m1)) + fmt.Println(values) +} +``` + +```None +Output: + +[THOUSAND Ten one] +``` + +Share +Format +Run + +### Types [¶](#pkg-types "Go to Types") + +This section is empty. diff --git a/corpus/docs/golang/strings/strings_go118.md b/corpus/docs/golang/strings/strings_go118.md new file mode 100644 index 0000000000000000000000000000000000000000..0b8313c4be715a2ca77ef2349504185715834116 --- /dev/null +++ b/corpus/docs/golang/strings/strings_go118.md @@ -0,0 +1,2205 @@ +# Golang - strings + +Source: https://pkg.go.dev/strings@go1.18 +Version: go1.18 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package strings implements simple functions to manipulate UTF-8 encoded strings. + +For information about UTF-8 strings in Go, see . + +### Index [¶](#pkg-index "Go to Index") + +* [func Clone(s string) string](#Clone) +* [func Compare(a, b string) int](#Compare) +* [func Contains(s, substr string) bool](#Contains) +* [func ContainsAny(s, chars string) bool](#ContainsAny) +* [func ContainsRune(s string, r rune) bool](#ContainsRune) +* [func Count(s, substr string) int](#Count) +* [func Cut(s, sep string) (before, after string, found bool)](#Cut) +* [func EqualFold(s, t string) bool](#EqualFold) +* [func Fields(s string) []string](#Fields) +* [func FieldsFunc(s string, f func(rune) bool) []string](#FieldsFunc) +* [func HasPrefix(s, prefix string) bool](#HasPrefix) +* [func HasSuffix(s, suffix string) bool](#HasSuffix) +* [func Index(s, substr string) int](#Index) +* [func IndexAny(s, chars string) int](#IndexAny) +* [func IndexByte(s string, c byte) int](#IndexByte) +* [func IndexFunc(s string, f func(rune) bool) int](#IndexFunc) +* [func IndexRune(s string, r rune) int](#IndexRune) +* [func Join(elems []string, sep string) string](#Join) +* [func LastIndex(s, substr string) int](#LastIndex) +* [func LastIndexAny(s, chars string) int](#LastIndexAny) +* [func LastIndexByte(s string, c byte) int](#LastIndexByte) +* [func LastIndexFunc(s string, f func(rune) bool) int](#LastIndexFunc) +* [func Map(mapping func(rune) rune, s string) string](#Map) +* [func Repeat(s string, count int) string](#Repeat) +* [func Replace(s, old, new string, n int) string](#Replace) +* [func ReplaceAll(s, old, new string) string](#ReplaceAll) +* [func Split(s, sep string) []string](#Split) +* [func SplitAfter(s, sep string) []string](#SplitAfter) +* [func SplitAfterN(s, sep string, n int) []string](#SplitAfterN) +* [func SplitN(s, sep string, n int) []string](#SplitN) +* [func Title(s string) string](#Title)deprecated +* [func ToLower(s string) string](#ToLower) +* [func ToLowerSpecial(c unicode.SpecialCase, s string) string](#ToLowerSpecial) +* [func ToTitle(s string) string](#ToTitle) +* [func ToTitleSpecial(c unicode.SpecialCase, s string) string](#ToTitleSpecial) +* [func ToUpper(s string) string](#ToUpper) +* [func ToUpperSpecial(c unicode.SpecialCase, s string) string](#ToUpperSpecial) +* [func ToValidUTF8(s, replacement string) string](#ToValidUTF8) +* [func Trim(s, cutset string) string](#Trim) +* [func TrimFunc(s string, f func(rune) bool) string](#TrimFunc) +* [func TrimLeft(s, cutset string) string](#TrimLeft) +* [func TrimLeftFunc(s string, f func(rune) bool) string](#TrimLeftFunc) +* [func TrimPrefix(s, prefix string) string](#TrimPrefix) +* [func TrimRight(s, cutset string) string](#TrimRight) +* [func TrimRightFunc(s string, f func(rune) bool) string](#TrimRightFunc) +* [func TrimSpace(s string) string](#TrimSpace) +* [func TrimSuffix(s, suffix string) string](#TrimSuffix) +* [type Builder](#Builder) +* + [func (b \*Builder) Cap() int](#Builder.Cap) + + [func (b \*Builder) Grow(n int)](#Builder.Grow) + + [func (b \*Builder) Len() int](#Builder.Len) + + [func (b \*Builder) Reset()](#Builder.Reset) + + [func (b \*Builder) String() string](#Builder.String) + + [func (b \*Builder) Write(p []byte) (int, error)](#Builder.Write) + + [func (b \*Builder) WriteByte(c byte) error](#Builder.WriteByte) + + [func (b \*Builder) WriteRune(r rune) (int, error)](#Builder.WriteRune) + + [func (b \*Builder) WriteString(s string) (int, error)](#Builder.WriteString) +* [type Reader](#Reader) +* + [func NewReader(s string) \*Reader](#NewReader) +* + [func (r \*Reader) Len() int](#Reader.Len) + + [func (r \*Reader) Read(b []byte) (n int, err error)](#Reader.Read) + + [func (r \*Reader) ReadAt(b []byte, off int64) (n int, err error)](#Reader.ReadAt) + + [func (r \*Reader) ReadByte() (byte, error)](#Reader.ReadByte) + + [func (r \*Reader) ReadRune() (ch rune, size int, err error)](#Reader.ReadRune) + + [func (r \*Reader) Reset(s string)](#Reader.Reset) + + [func (r \*Reader) Seek(offset int64, whence int) (int64, error)](#Reader.Seek) + + [func (r \*Reader) Size() int64](#Reader.Size) + + [func (r \*Reader) UnreadByte() error](#Reader.UnreadByte) + + [func (r \*Reader) UnreadRune() error](#Reader.UnreadRune) + + [func (r \*Reader) WriteTo(w io.Writer) (n int64, err error)](#Reader.WriteTo) +* [type Replacer](#Replacer) +* + [func NewReplacer(oldnew ...string) \*Replacer](#NewReplacer) +* + [func (r \*Replacer) Replace(s string) string](#Replacer.Replace) + + [func (r \*Replacer) WriteString(w io.Writer, s string) (n int, err error)](#Replacer.WriteString) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Builder](#example-Builder) +* [Compare](#example-Compare) +* [Contains](#example-Contains) +* [ContainsAny](#example-ContainsAny) +* [ContainsRune](#example-ContainsRune) +* [Count](#example-Count) +* [Cut](#example-Cut) +* [EqualFold](#example-EqualFold) +* [Fields](#example-Fields) +* [FieldsFunc](#example-FieldsFunc) +* [HasPrefix](#example-HasPrefix) +* [HasSuffix](#example-HasSuffix) +* [Index](#example-Index) +* [IndexAny](#example-IndexAny) +* [IndexByte](#example-IndexByte) +* [IndexFunc](#example-IndexFunc) +* [IndexRune](#example-IndexRune) +* [Join](#example-Join) +* [LastIndex](#example-LastIndex) +* [LastIndexAny](#example-LastIndexAny) +* [LastIndexByte](#example-LastIndexByte) +* [LastIndexFunc](#example-LastIndexFunc) +* [Map](#example-Map) +* [NewReplacer](#example-NewReplacer) +* [Repeat](#example-Repeat) +* [Replace](#example-Replace) +* [ReplaceAll](#example-ReplaceAll) +* [Split](#example-Split) +* [SplitAfter](#example-SplitAfter) +* [SplitAfterN](#example-SplitAfterN) +* [SplitN](#example-SplitN) +* [Title](#example-Title) +* [ToLower](#example-ToLower) +* [ToLowerSpecial](#example-ToLowerSpecial) +* [ToTitle](#example-ToTitle) +* [ToTitleSpecial](#example-ToTitleSpecial) +* [ToUpper](#example-ToUpper) +* [ToUpperSpecial](#example-ToUpperSpecial) +* [Trim](#example-Trim) +* [TrimFunc](#example-TrimFunc) +* [TrimLeft](#example-TrimLeft) +* [TrimLeftFunc](#example-TrimLeftFunc) +* [TrimPrefix](#example-TrimPrefix) +* [TrimRight](#example-TrimRight) +* [TrimRightFunc](#example-TrimRightFunc) +* [TrimSpace](#example-TrimSpace) +* [TrimSuffix](#example-TrimSuffix) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [Clone](https://cs.opensource.google/go/go/+/go1.18:src/strings/clone.go;l=21) [¶](#Clone "Go to Clone") added in go1.18 + +```None +func Clone(s string) string +``` + +Clone returns a fresh copy of s. +It guarantees to make a copy of s into a new allocation, +which can be important when retaining only a small substring +of a much larger string. Using Clone can help such programs +use less memory. Of course, since using Clone makes a copy, +overuse of Clone can make programs use more memory. +Clone should typically be used only rarely, and only when +profiling indicates that it is needed. +For strings of length zero the string "" will be returned +and no allocation is made. + +#### func [Compare](https://cs.opensource.google/go/go/+/go1.18:src/strings/compare.go;l=13) [¶](#Compare "Go to Compare") added in go1.5 + +```None +func Compare(a, b string) int +``` + +Compare returns an integer comparing two strings lexicographically. +The result will be 0 if a == b, -1 if a < b, and +1 if a > b. + +Compare is included only for symmetry with package bytes. +It is usually clearer and always faster to use the built-in +string comparison operators ==, <, >, and so on. + +Example [¶](#example-Compare "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Compare("a", "b")) + fmt.Println(strings.Compare("a", "a")) + fmt.Println(strings.Compare("b", "a")) +} +``` + +```None +Output: + +-1 +0 +1 +``` + +Share +Format +Run + +#### func [Contains](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=61) [¶](#Contains "Go to Contains") + +```None +func Contains(s, substr string) bool +``` + +Contains reports whether substr is within s. + +Example [¶](#example-Contains "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Contains("seafood", "foo")) + fmt.Println(strings.Contains("seafood", "bar")) + fmt.Println(strings.Contains("seafood", "")) + fmt.Println(strings.Contains("", "")) +} +``` + +```None +Output: + +true +false +true +true +``` + +Share +Format +Run + +#### func [ContainsAny](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=66) [¶](#ContainsAny "Go to ContainsAny") + +```None +func ContainsAny(s, chars string) bool +``` + +ContainsAny reports whether any Unicode code points in chars are within s. + +Example [¶](#example-ContainsAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ContainsAny("team", "i")) + fmt.Println(strings.ContainsAny("fail", "ui")) + fmt.Println(strings.ContainsAny("ure", "ui")) + fmt.Println(strings.ContainsAny("failure", "ui")) + fmt.Println(strings.ContainsAny("foo", "")) + fmt.Println(strings.ContainsAny("", "")) +} +``` + +```None +Output: + +false +true +true +true +false +false +``` + +Share +Format +Run + +#### func [ContainsRune](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=71) [¶](#ContainsRune "Go to ContainsRune") + +```None +func ContainsRune(s string, r rune) bool +``` + +ContainsRune reports whether the Unicode code point r is within s. + +Example [¶](#example-ContainsRune "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Finds whether a string contains a particular Unicode code point. + // The code point for the lowercase letter "a", for example, is 97. + fmt.Println(strings.ContainsRune("aardvark", 97)) + fmt.Println(strings.ContainsRune("timeout", 97)) +} +``` + +```None +Output: + +true +false +``` + +Share +Format +Run + +#### func [Count](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=41) [¶](#Count "Go to Count") + +```None +func Count(s, substr string) int +``` + +Count counts the number of non-overlapping instances of substr in s. +If substr is an empty string, Count returns 1 + the number of Unicode code points in s. + +Example [¶](#example-Count "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Count("cheese", "e")) + fmt.Println(strings.Count("five", "")) // before & after each rune +} +``` + +```None +Output: + +3 +5 +``` + +Share +Format +Run + +#### func [Cut](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=1181) [¶](#Cut "Go to Cut") added in go1.18 + +```None +func Cut(s, sep string) (before, after string, found bool) +``` + +Cut slices s around the first instance of sep, +returning the text before and after sep. +The found result reports whether sep appears in s. +If sep does not appear in s, cut returns s, "", false. + +Example [¶](#example-Cut "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + show := func(s, sep string) { + before, after, found := strings.Cut(s, sep) + fmt.Printf("Cut(%q, %q) = %q, %q, %v\n", s, sep, before, after, found) + } + show("Gopher", "Go") + show("Gopher", "ph") + show("Gopher", "er") + show("Gopher", "Badger") +} +``` + +```None +Output: + +Cut("Gopher", "Go") = "", "pher", true +Cut("Gopher", "ph") = "Go", "er", true +Cut("Gopher", "er") = "Goph", "", true +Cut("Gopher", "Badger") = "Gopher", "", false +``` + +Share +Format +Run + +#### func [EqualFold](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=1043) [¶](#EqualFold "Go to EqualFold") + +```None +func EqualFold(s, t string) bool +``` + +EqualFold reports whether s and t, interpreted as UTF-8 strings, +are equal under Unicode case-folding, which is a more general +form of case-insensitivity. + +Example [¶](#example-EqualFold "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.EqualFold("Go", "go")) +} +``` + +```None +Output: + +true +``` + +Share +Format +Run + +#### func [Fields](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=324) [¶](#Fields "Go to Fields") + +```None +func Fields(s string) []string +``` + +Fields splits the string s around each instance of one or more consecutive white space +characters, as defined by unicode.IsSpace, returning a slice of substrings of s or an +empty slice if s contains only white space. + +Example [¶](#example-Fields "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("Fields are: %q", strings.Fields(" foo bar baz ")) +} +``` + +```None +Output: + +Fields are: ["foo" "bar" "baz"] +``` + +Share +Format +Run + +#### func [FieldsFunc](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=379) [¶](#FieldsFunc "Go to FieldsFunc") + +```None +func FieldsFunc(s string, f func(rune) bool) []string +``` + +FieldsFunc splits the string s at each run of Unicode code points c satisfying f(c) +and returns an array of slices of s. If all code points in s satisfy f(c) or the +string is empty, an empty slice is returned. + +FieldsFunc makes no guarantees about the order in which it calls f(c) +and assumes that f always returns the same value for a given c. + +Example [¶](#example-FieldsFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + f := func(c rune) bool { + return !unicode.IsLetter(c) && !unicode.IsNumber(c) + } + fmt.Printf("Fields are: %q", strings.FieldsFunc(" foo1;bar2,baz3...", f)) +} +``` + +```None +Output: + +Fields are: ["foo1" "bar2" "baz3"] +``` + +Share +Format +Run + +#### func [HasPrefix](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=448) [¶](#HasPrefix "Go to HasPrefix") + +```None +func HasPrefix(s, prefix string) bool +``` + +HasPrefix tests whether the string s begins with prefix. + +Example [¶](#example-HasPrefix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.HasPrefix("Gopher", "Go")) + fmt.Println(strings.HasPrefix("Gopher", "C")) + fmt.Println(strings.HasPrefix("Gopher", "")) +} +``` + +```None +Output: + +true +false +true +``` + +Share +Format +Run + +#### func [HasSuffix](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=453) [¶](#HasSuffix "Go to HasSuffix") + +```None +func HasSuffix(s, suffix string) bool +``` + +HasSuffix tests whether the string s ends with suffix. + +Example [¶](#example-HasSuffix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.HasSuffix("Amigo", "go")) + fmt.Println(strings.HasSuffix("Amigo", "O")) + fmt.Println(strings.HasSuffix("Amigo", "Ami")) + fmt.Println(strings.HasSuffix("Amigo", "")) +} +``` + +```None +Output: + +true +false +false +true +``` + +Share +Format +Run + +#### func [Index](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=1097) [¶](#Index "Go to Index") + +```None +func Index(s, substr string) int +``` + +Index returns the index of the first instance of substr in s, or -1 if substr is not present in s. + +Example [¶](#example-Index "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Index("chicken", "ken")) + fmt.Println(strings.Index("chicken", "dmr")) +} +``` + +```None +Output: + +4 +-1 +``` + +Share +Format +Run + +#### func [IndexAny](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=141) [¶](#IndexAny "Go to IndexAny") + +```None +func IndexAny(s, chars string) int +``` + +IndexAny returns the index of the first instance of any Unicode code point +from chars in s, or -1 if no Unicode code point from chars is present in s. + +Example [¶](#example-IndexAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexAny("chicken", "aeiouy")) + fmt.Println(strings.IndexAny("crwth", "aeiouy")) +} +``` + +```None +Output: + +2 +-1 +``` + +Share +Format +Run + +#### func [IndexByte](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=113) [¶](#IndexByte "Go to IndexByte") added in go1.2 + +```None +func IndexByte(s string, c byte) int +``` + +IndexByte returns the index of the first instance of c in s, or -1 if c is not present in s. + +Example [¶](#example-IndexByte "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexByte("golang", 'g')) + fmt.Println(strings.IndexByte("gophers", 'h')) + fmt.Println(strings.IndexByte("golang", 'x')) +} +``` + +```None +Output: + +0 +3 +-1 +``` + +Share +Format +Run + +#### func [IndexFunc](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=763) [¶](#IndexFunc "Go to IndexFunc") + +```None +func IndexFunc(s string, f func(rune) bool) int +``` + +IndexFunc returns the index into s of the first Unicode +code point satisfying f(c), or -1 if none do. + +Example [¶](#example-IndexFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + f := func(c rune) bool { + return unicode.Is(unicode.Han, c) + } + fmt.Println(strings.IndexFunc("Hello, 世界", f)) + fmt.Println(strings.IndexFunc("Hello, world", f)) +} +``` + +```None +Output: + +7 +-1 +``` + +Share +Format +Run + +#### func [IndexRune](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=121) [¶](#IndexRune "Go to IndexRune") + +```None +func IndexRune(s string, r rune) int +``` + +IndexRune returns the index of the first instance of the Unicode code point +r, or -1 if rune is not present in s. +If r is utf8.RuneError, it returns the first instance of any +invalid UTF-8 byte sequence. + +Example [¶](#example-IndexRune "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexRune("chicken", 'k')) + fmt.Println(strings.IndexRune("chicken", 'd')) +} +``` + +```None +Output: + +4 +-1 +``` + +Share +Format +Run + +#### func [Join](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=425) [¶](#Join "Go to Join") + +```None +func Join(elems []string, sep string) string +``` + +Join concatenates the elements of its first argument to create a single string. The separator +string sep is placed between elements in the resulting string. + +Example [¶](#example-Join "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + s := []string{"foo", "bar", "baz"} + fmt.Println(strings.Join(s, ", ")) +} +``` + +```None +Output: + +foo, bar, baz +``` + +Share +Format +Run + +#### func [LastIndex](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=76) [¶](#LastIndex "Go to LastIndex") + +```None +func LastIndex(s, substr string) int +``` + +LastIndex returns the index of the last instance of substr in s, or -1 if substr is not present in s. + +Example [¶](#example-LastIndex "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Index("go gopher", "go")) + fmt.Println(strings.LastIndex("go gopher", "go")) + fmt.Println(strings.LastIndex("go gopher", "rodent")) +} +``` + +```None +Output: + +0 +3 +-1 +``` + +Share +Format +Run + +#### func [LastIndexAny](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=175) [¶](#LastIndexAny "Go to LastIndexAny") + +```None +func LastIndexAny(s, chars string) int +``` + +LastIndexAny returns the index of the last instance of any Unicode code +point from chars in s, or -1 if no Unicode code point from chars is +present in s. + +Example [¶](#example-LastIndexAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.LastIndexAny("go gopher", "go")) + fmt.Println(strings.LastIndexAny("go gopher", "rodent")) + fmt.Println(strings.LastIndexAny("go gopher", "fail")) +} +``` + +```None +Output: + +4 +8 +-1 +``` + +Share +Format +Run + +#### func [LastIndexByte](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=225) [¶](#LastIndexByte "Go to LastIndexByte") added in go1.5 + +```None +func LastIndexByte(s string, c byte) int +``` + +LastIndexByte returns the index of the last instance of c in s, or -1 if c is not present in s. + +Example [¶](#example-LastIndexByte "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.LastIndexByte("Hello, world", 'l')) + fmt.Println(strings.LastIndexByte("Hello, world", 'o')) + fmt.Println(strings.LastIndexByte("Hello, world", 'x')) +} +``` + +```None +Output: + +10 +8 +-1 +``` + +Share +Format +Run + +#### func [LastIndexFunc](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=769) [¶](#LastIndexFunc "Go to LastIndexFunc") + +```None +func LastIndexFunc(s string, f func(rune) bool) int +``` + +LastIndexFunc returns the index into s of the last +Unicode code point satisfying f(c), or -1 if none do. + +Example [¶](#example-LastIndexFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.LastIndexFunc("go 123", unicode.IsNumber)) + fmt.Println(strings.LastIndexFunc("123 go", unicode.IsNumber)) + fmt.Println(strings.LastIndexFunc("go", unicode.IsNumber)) +} +``` + +```None +Output: + +5 +2 +-1 +``` + +Share +Format +Run + +#### func [Map](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=460) [¶](#Map "Go to Map") + +```None +func Map(mapping func(rune) rune, s string) string +``` + +Map returns a copy of the string s with all its characters modified +according to the mapping function. If mapping returns a negative value, the character is +dropped from the string with no replacement. + +Example [¶](#example-Map "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + rot13 := func(r rune) rune { + switch { + case r >= 'A' && r <= 'Z': + return 'A' + (r-'A'+13)%26 + case r >= 'a' && r <= 'z': + return 'a' + (r-'a'+13)%26 + } + return r + } + fmt.Println(strings.Map(rot13, "'Twas brillig and the slithy gopher...")) +} +``` + +```None +Output: + +'Gjnf oevyyvt naq gur fyvgul tbcure... +``` + +Share +Format +Run + +#### func [Repeat](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=523) [¶](#Repeat "Go to Repeat") + +```None +func Repeat(s string, count int) string +``` + +Repeat returns a new string consisting of count copies of the string s. + +It panics if count is negative or if +the result of (len(s) \* count) overflows. + +Example [¶](#example-Repeat "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println("ba" + strings.Repeat("na", 2)) +} +``` + +```None +Output: + +banana +``` + +Share +Format +Run + +#### func [Replace](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=997) [¶](#Replace "Go to Replace") + +```None +func Replace(s, old, new string, n int) string +``` + +Replace returns a copy of the string s with the first n +non-overlapping instances of old replaced by new. +If old is empty, it matches at the beginning of the string +and after each UTF-8 sequence, yielding up to k+1 replacements +for a k-rune string. +If n < 0, there is no limit on the number of replacements. + +Example [¶](#example-Replace "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Replace("oink oink oink", "k", "ky", 2)) + fmt.Println(strings.Replace("oink oink oink", "oink", "moo", -1)) +} +``` + +```None +Output: + +oinky oinky oink +moo moo moo +``` + +Share +Format +Run + +#### func [ReplaceAll](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=1036) [¶](#ReplaceAll "Go to ReplaceAll") added in go1.12 + +```None +func ReplaceAll(s, old, new string) string +``` + +ReplaceAll returns a copy of the string s with all +non-overlapping instances of old replaced by new. +If old is empty, it matches at the beginning of the string +and after each UTF-8 sequence, yielding up to k+1 replacements +for a k-rune string. + +Example [¶](#example-ReplaceAll "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ReplaceAll("oink oink oink", "oink", "moo")) +} +``` + +```None +Output: + +moo moo moo +``` + +Share +Format +Run + +#### func [Split](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=303) [¶](#Split "Go to Split") + +```None +func Split(s, sep string) []string +``` + +Split slices s into all substrings separated by sep and returns a slice of +the substrings between those separators. + +If s does not contain sep and sep is not empty, Split returns a +slice of length 1 whose only element is s. + +If sep is empty, Split splits after each UTF-8 sequence. If both s +and sep are empty, Split returns an empty slice. + +It is equivalent to SplitN with a count of -1. + +To split around the first instance of a separator, see Cut. + +Example [¶](#example-Split "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.Split("a,b,c", ",")) + fmt.Printf("%q\n", strings.Split("a man a plan a canal panama", "a ")) + fmt.Printf("%q\n", strings.Split(" xyz ", "")) + fmt.Printf("%q\n", strings.Split("", "Bernardo O'Higgins")) +} +``` + +```None +Output: + +["a" "b" "c"] +["" "man " "plan " "canal panama"] +[" " "x" "y" "z" " "] +[""] +``` + +Share +Format +Run + +#### func [SplitAfter](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=315) [¶](#SplitAfter "Go to SplitAfter") + +```None +func SplitAfter(s, sep string) []string +``` + +SplitAfter slices s into all substrings after each instance of sep and +returns a slice of those substrings. + +If s does not contain sep and sep is not empty, SplitAfter returns +a slice of length 1 whose only element is s. + +If sep is empty, SplitAfter splits after each UTF-8 sequence. If +both s and sep are empty, SplitAfter returns an empty slice. + +It is equivalent to SplitAfterN with a count of -1. + +Example [¶](#example-SplitAfter "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitAfter("a,b,c", ",")) +} +``` + +```None +Output: + +["a," "b," "c"] +``` + +Share +Format +Run + +#### func [SplitAfterN](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=287) [¶](#SplitAfterN "Go to SplitAfterN") + +```None +func SplitAfterN(s, sep string, n int) []string +``` + +SplitAfterN slices s into substrings after each instance of sep and +returns a slice of those substrings. + +The count determines the number of substrings to return: + +```None +n > 0: at most n substrings; the last substring will be the unsplit remainder. +n == 0: the result is nil (zero substrings) +n < 0: all substrings +``` + +Edge cases for s and sep (for example, empty strings) are handled +as described in the documentation for SplitAfter. + +Example [¶](#example-SplitAfterN "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitAfterN("a,b,c", ",", 2)) +} +``` + +```None +Output: + +["a," "b,c"] +``` + +Share +Format +Run + +#### func [SplitN](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=275) [¶](#SplitN "Go to SplitN") + +```None +func SplitN(s, sep string, n int) []string +``` + +SplitN slices s into substrings separated by sep and returns a slice of +the substrings between those separators. + +The count determines the number of substrings to return: + +```None +n > 0: at most n substrings; the last substring will be the unsplit remainder. +n == 0: the result is nil (zero substrings) +n < 0: all substrings +``` + +Edge cases for s and sep (for example, empty strings) are handled +as described in the documentation for Split. + +To split around the first instance of a separator, see Cut. + +Example [¶](#example-SplitN "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitN("a,b,c", ",", 2)) + z := strings.SplitN("a,b,c", ",", 0) + fmt.Printf("%q (nil = %v)\n", z, z == nil) +} +``` + +```None +Output: + +["a" "b,c"] +[] (nil = true) +``` + +Share +Format +Run + +#### func [Title](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=715) deprecated + +```None +func Title(s string) string +``` + +Title returns a copy of the string s with all Unicode letters that begin words +mapped to their Unicode title case. + +Deprecated: The rule Title uses for word boundaries does not handle Unicode +punctuation properly. Use golang.org/x/text/cases instead. + +Example [¶](#example-Title "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Compare this example to the ToTitle example. + fmt.Println(strings.Title("her royal highness")) + fmt.Println(strings.Title("loud noises")) + fmt.Println(strings.Title("хлеб")) +} +``` + +```None +Output: + +Her Royal Highness +Loud Noises +Хлеб +``` + +Share +Format +Run + +#### func [ToLower](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=584) [¶](#ToLower "Go to ToLower") + +```None +func ToLower(s string) string +``` + +ToLower returns s with all Unicode letters mapped to their lower case. + +Example [¶](#example-ToLower "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ToLower("Gopher")) +} +``` + +```None +Output: + +gopher +``` + +Share +Format +Run + +#### func [ToLowerSpecial](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=625) [¶](#ToLowerSpecial "Go to ToLowerSpecial") + +```None +func ToLowerSpecial(c unicode.SpecialCase, s string) string +``` + +ToLowerSpecial returns a copy of the string s with all Unicode letters mapped to their +lower case using the case mapping specified by c. + +Example [¶](#example-ToLowerSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToLowerSpecial(unicode.TurkishCase, "Önnek İş")) +} +``` + +```None +Output: + +önnek iş +``` + +Share +Format +Run + +#### func [ToTitle](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=615) [¶](#ToTitle "Go to ToTitle") + +```None +func ToTitle(s string) string +``` + +ToTitle returns a copy of the string s with all Unicode letters mapped to +their Unicode title case. + +Example [¶](#example-ToTitle "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Compare this example to the Title example. + fmt.Println(strings.ToTitle("her royal highness")) + fmt.Println(strings.ToTitle("loud noises")) + fmt.Println(strings.ToTitle("хлеб")) +} +``` + +```None +Output: + +HER ROYAL HIGHNESS +LOUD NOISES +ХЛЕБ +``` + +Share +Format +Run + +#### func [ToTitleSpecial](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=631) [¶](#ToTitleSpecial "Go to ToTitleSpecial") + +```None +func ToTitleSpecial(c unicode.SpecialCase, s string) string +``` + +ToTitleSpecial returns a copy of the string s with all Unicode letters mapped to their +Unicode title case, giving priority to the special casing rules. + +Example [¶](#example-ToTitleSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToTitleSpecial(unicode.TurkishCase, "dünyanın ilk borsa yapısı Aizonai kabul edilir")) +} +``` + +```None +Output: + +DÜNYANIN İLK BORSA YAPISI AİZONAİ KABUL EDİLİR +``` + +Share +Format +Run + +#### func [ToUpper](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=554) [¶](#ToUpper "Go to ToUpper") + +```None +func ToUpper(s string) string +``` + +ToUpper returns s with all Unicode letters mapped to their upper case. + +Example [¶](#example-ToUpper "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ToUpper("Gopher")) +} +``` + +```None +Output: + +GOPHER +``` + +Share +Format +Run + +#### func [ToUpperSpecial](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=619) [¶](#ToUpperSpecial "Go to ToUpperSpecial") + +```None +func ToUpperSpecial(c unicode.SpecialCase, s string) string +``` + +ToUpperSpecial returns a copy of the string s with all Unicode letters mapped to their +upper case using the case mapping specified by c. + +Example [¶](#example-ToUpperSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToUpperSpecial(unicode.TurkishCase, "örnek iş")) +} +``` + +```None +Output: + +ÖRNEK İŞ +``` + +Share +Format +Run + +#### func [ToValidUTF8](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=637) [¶](#ToValidUTF8 "Go to ToValidUTF8") added in go1.13 + +```None +func ToValidUTF8(s, replacement string) string +``` + +ToValidUTF8 returns a copy of the string s with each run of invalid UTF-8 byte sequences +replaced by the replacement string, which may be empty. + +#### func [Trim](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=829) [¶](#Trim "Go to Trim") + +```None +func Trim(s, cutset string) string +``` + +Trim returns a slice of the string s with all leading and +trailing Unicode code points contained in cutset removed. + +Example [¶](#example-Trim "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.Trim("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimFunc](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=757) [¶](#TrimFunc "Go to TrimFunc") + +```None +func TrimFunc(s string, f func(rune) bool) string +``` + +TrimFunc returns a slice of the string s with all leading +and trailing Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimLeft](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=846) [¶](#TrimLeft "Go to TrimLeft") + +```None +func TrimLeft(s, cutset string) string +``` + +TrimLeft returns a slice of the string s with all leading +Unicode code points contained in cutset removed. + +To remove a prefix, use TrimPrefix instead. + +Example [¶](#example-TrimLeft "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.TrimLeft("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +Hello, Gophers!!! +``` + +Share +Format +Run + +#### func [TrimLeftFunc](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=734) [¶](#TrimLeftFunc "Go to TrimLeftFunc") + +```None +func TrimLeftFunc(s string, f func(rune) bool) string +``` + +TrimLeftFunc returns a slice of the string s with all leading +Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimLeftFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimLeftFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +Hello, Gophers!!! +``` + +Share +Format +Run + +#### func [TrimPrefix](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=975) [¶](#TrimPrefix "Go to TrimPrefix") added in go1.1 + +```None +func TrimPrefix(s, prefix string) string +``` + +TrimPrefix returns s without the provided leading prefix string. +If s doesn't start with prefix, s is returned unchanged. + +Example [¶](#example-TrimPrefix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var s = "¡¡¡Hello, Gophers!!!" + s = strings.TrimPrefix(s, "¡¡¡Hello, ") + s = strings.TrimPrefix(s, "¡¡¡Howdy, ") + fmt.Print(s) +} +``` + +```None +Output: + +Gophers!!! +``` + +Share +Format +Run + +#### func [TrimRight](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=894) [¶](#TrimRight "Go to TrimRight") + +```None +func TrimRight(s, cutset string) string +``` + +TrimRight returns a slice of the string s, with all trailing +Unicode code points contained in cutset removed. + +To remove a suffix, use TrimSuffix instead. + +Example [¶](#example-TrimRight "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.TrimRight("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +¡¡¡Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimRightFunc](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=744) [¶](#TrimRightFunc "Go to TrimRightFunc") + +```None +func TrimRightFunc(s string, f func(rune) bool) string +``` + +TrimRightFunc returns a slice of the string s with all trailing +Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimRightFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimRightFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +¡¡¡Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimSpace](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=940) [¶](#TrimSpace "Go to TrimSpace") + +```None +func TrimSpace(s string) string +``` + +TrimSpace returns a slice of the string s, with all leading +and trailing white space removed, as defined by Unicode. + +Example [¶](#example-TrimSpace "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.TrimSpace(" \t\n Hello, Gophers \n\t\r\n")) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimSuffix](https://cs.opensource.google/go/go/+/go1.18:src/strings/strings.go;l=984) [¶](#TrimSuffix "Go to TrimSuffix") added in go1.1 + +```None +func TrimSuffix(s, suffix string) string +``` + +TrimSuffix returns s without the provided trailing suffix string. +If s doesn't end with suffix, s is returned unchanged. + +Example [¶](#example-TrimSuffix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var s = "¡¡¡Hello, Gophers!!!" + s = strings.TrimSuffix(s, ", Gophers!!!") + s = strings.TrimSuffix(s, ", Marmots!!!") + fmt.Print(s) +} +``` + +```None +Output: + +¡¡¡Hello +``` + +Share +Format +Run + +### Types [¶](#pkg-types "Go to Types") + +#### type [Builder](https://cs.opensource.google/go/go/+/go1.18:src/strings/builder.go;l=15) [¶](#Builder "Go to Builder") added in go1.10 + +```None +type Builder struct { + // contains filtered or unexported fields +} +``` + +A Builder is used to efficiently build a string using Write methods. +It minimizes memory copying. The zero value is ready to use. +Do not copy a non-zero Builder. + +Example [¶](#example-Builder "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var b strings.Builder + for i := 3; i >= 1; i-- { + fmt.Fprintf(&b, "%d...", i) + } + b.WriteString("ignition") + fmt.Println(b.String()) + +} +``` + +```None +Output: + +3...2...1...ignition +``` + +Share +Format +Run + +#### func (\*Builder) [Cap](https://cs.opensource.google/go/go/+/go1.18:src/strings/builder.go;l=56) [¶](#Builder.Cap "Go to Builder.Cap") added in go1.12 + +```None +func (b *Builder) Cap() int +``` + +Cap returns the capacity of the builder's underlying byte slice. It is the +total space allocated for the string being built and includes any bytes +already written. + +#### func (\*Builder) [Grow](https://cs.opensource.google/go/go/+/go1.18:src/strings/builder.go;l=75) [¶](#Builder.Grow "Go to Builder.Grow") added in go1.10 + +```None +func (b *Builder) Grow(n int) +``` + +Grow grows b's capacity, if necessary, to guarantee space for +another n bytes. After Grow(n), at least n bytes can be written to b +without another allocation. If n is negative, Grow panics. + +#### func (\*Builder) [Len](https://cs.opensource.google/go/go/+/go1.18:src/strings/builder.go;l=51) [¶](#Builder.Len "Go to Builder.Len") added in go1.10 + +```None +func (b *Builder) Len() int +``` + +Len returns the number of accumulated bytes; b.Len() == len(b.String()). + +#### func (\*Builder) [Reset](https://cs.opensource.google/go/go/+/go1.18:src/strings/builder.go;l=59) [¶](#Builder.Reset "Go to Builder.Reset") added in go1.10 + +```None +func (b *Builder) Reset() +``` + +Reset resets the Builder to be empty. + +#### func (\*Builder) [String](https://cs.opensource.google/go/go/+/go1.18:src/strings/builder.go;l=46) [¶](#Builder.String "Go to Builder.String") added in go1.10 + +```None +func (b *Builder) String() string +``` + +String returns the accumulated string. + +#### func (\*Builder) [Write](https://cs.opensource.google/go/go/+/go1.18:src/strings/builder.go;l=87) [¶](#Builder.Write "Go to Builder.Write") added in go1.10 + +```None +func (b *Builder) Write(p []byte) (int, error) +``` + +Write appends the contents of p to b's buffer. +Write always returns len(p), nil. + +#### func (\*Builder) [WriteByte](https://cs.opensource.google/go/go/+/go1.18:src/strings/builder.go;l=95) [¶](#Builder.WriteByte "Go to Builder.WriteByte") added in go1.10 + +```None +func (b *Builder) WriteByte(c byte) error +``` + +WriteByte appends the byte c to b's buffer. +The returned error is always nil. + +#### func (\*Builder) [WriteRune](https://cs.opensource.google/go/go/+/go1.18:src/strings/builder.go;l=103) [¶](#Builder.WriteRune "Go to Builder.WriteRune") added in go1.10 + +```None +func (b *Builder) WriteRune(r rune) (int, error) +``` + +WriteRune appends the UTF-8 encoding of Unicode code point r to b's buffer. +It returns the length of r and a nil error. + +#### func (\*Builder) [WriteString](https://cs.opensource.google/go/go/+/go1.18:src/strings/builder.go;l=121) [¶](#Builder.WriteString "Go to Builder.WriteString") added in go1.10 + +```None +func (b *Builder) WriteString(s string) (int, error) +``` + +WriteString appends the contents of s to b's buffer. +It returns the length of s and a nil error. + +#### type [Reader](https://cs.opensource.google/go/go/+/go1.18:src/strings/reader.go;l=17) [¶](#Reader "Go to Reader") + +```None +type Reader struct { + // contains filtered or unexported fields +} +``` + +A Reader implements the io.Reader, io.ReaderAt, io.ByteReader, io.ByteScanner, +io.RuneReader, io.RuneScanner, io.Seeker, and io.WriterTo interfaces by reading +from a string. +The zero value for Reader operates like a Reader of an empty string. + +#### func [NewReader](https://cs.opensource.google/go/go/+/go1.18:src/strings/reader.go;l=160) [¶](#NewReader "Go to NewReader") + +```None +func NewReader(s string) *Reader +``` + +NewReader returns a new Reader reading from s. +It is similar to bytes.NewBufferString but more efficient and read-only. + +#### func (\*Reader) [Len](https://cs.opensource.google/go/go/+/go1.18:src/strings/reader.go;l=25) [¶](#Reader.Len "Go to Reader.Len") + +```None +func (r *Reader) Len() int +``` + +Len returns the number of bytes of the unread portion of the +string. + +#### func (\*Reader) [Read](https://cs.opensource.google/go/go/+/go1.18:src/strings/reader.go;l=39) [¶](#Reader.Read "Go to Reader.Read") + +```None +func (r *Reader) Read(b []byte) (n int, err error) +``` + +Read implements the io.Reader interface. + +#### func (\*Reader) [ReadAt](https://cs.opensource.google/go/go/+/go1.18:src/strings/reader.go;l=50) [¶](#Reader.ReadAt "Go to Reader.ReadAt") + +```None +func (r *Reader) ReadAt(b []byte, off int64) (n int, err error) +``` + +ReadAt implements the io.ReaderAt interface. + +#### func (\*Reader) [ReadByte](https://cs.opensource.google/go/go/+/go1.18:src/strings/reader.go;l=66) [¶](#Reader.ReadByte "Go to Reader.ReadByte") + +```None +func (r *Reader) ReadByte() (byte, error) +``` + +ReadByte implements the io.ByteReader interface. + +#### func (\*Reader) [ReadRune](https://cs.opensource.google/go/go/+/go1.18:src/strings/reader.go;l=87) [¶](#Reader.ReadRune "Go to Reader.ReadRune") + +```None +func (r *Reader) ReadRune() (ch rune, size int, err error) +``` + +ReadRune implements the io.RuneReader interface. + +#### func (\*Reader) [Reset](https://cs.opensource.google/go/go/+/go1.18:src/strings/reader.go;l=156) [¶](#Reader.Reset "Go to Reader.Reset") added in go1.7 + +```None +func (r *Reader) Reset(s string) +``` + +Reset resets the Reader to be reading from s. + +#### func (\*Reader) [Seek](https://cs.opensource.google/go/go/+/go1.18:src/strings/reader.go;l=116) [¶](#Reader.Seek "Go to Reader.Seek") + +```None +func (r *Reader) Seek(offset int64, whence int) (int64, error) +``` + +Seek implements the io.Seeker interface. + +#### func (\*Reader) [Size](https://cs.opensource.google/go/go/+/go1.18:src/strings/reader.go;l=36) [¶](#Reader.Size "Go to Reader.Size") added in go1.5 + +```None +func (r *Reader) Size() int64 +``` + +Size returns the original length of the underlying string. +Size is the number of bytes available for reading via ReadAt. +The returned value is always the same and is not affected by calls +to any other method. + +#### func (\*Reader) [UnreadByte](https://cs.opensource.google/go/go/+/go1.18:src/strings/reader.go;l=77) [¶](#Reader.UnreadByte "Go to Reader.UnreadByte") + +```None +func (r *Reader) UnreadByte() error +``` + +UnreadByte implements the io.ByteScanner interface. + +#### func (\*Reader) [UnreadRune](https://cs.opensource.google/go/go/+/go1.18:src/strings/reader.go;l=103) [¶](#Reader.UnreadRune "Go to Reader.UnreadRune") + +```None +func (r *Reader) UnreadRune() error +``` + +UnreadRune implements the io.RuneScanner interface. + +#### func (\*Reader) [WriteTo](https://cs.opensource.google/go/go/+/go1.18:src/strings/reader.go;l=137) [¶](#Reader.WriteTo "Go to Reader.WriteTo") added in go1.1 + +```None +func (r *Reader) WriteTo(w io.Writer) (n int64, err error) +``` + +WriteTo implements the io.WriterTo interface. + +#### type [Replacer](https://cs.opensource.google/go/go/+/go1.18:src/strings/replace.go;l=14) [¶](#Replacer "Go to Replacer") + +```None +type Replacer struct { + // contains filtered or unexported fields +} +``` + +Replacer replaces a list of strings with replacements. +It is safe for concurrent use by multiple goroutines. + +#### func [NewReplacer](https://cs.opensource.google/go/go/+/go1.18:src/strings/replace.go;l=32) [¶](#NewReplacer "Go to NewReplacer") + +```None +func NewReplacer(oldnew ...string) *Replacer +``` + +NewReplacer returns a new Replacer from a list of old, new string +pairs. Replacements are performed in the order they appear in the +target string, without overlapping matches. The old string +comparisons are done in argument order. + +NewReplacer panics if given an odd number of arguments. + +Example [¶](#example-NewReplacer "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + r := strings.NewReplacer("<", "<", ">", ">") + fmt.Println(r.Replace("This is HTML!")) +} +``` + +```None +Output: + +This is <b>HTML</b>! +``` + +Share +Format +Run + +#### func (\*Replacer) [Replace](https://cs.opensource.google/go/go/+/go1.18:src/strings/replace.go;l=95) [¶](#Replacer.Replace "Go to Replacer.Replace") + +```None +func (r *Replacer) Replace(s string) string +``` + +Replace returns a copy of s with all replacements performed. + +#### func (\*Replacer) [WriteString](https://cs.opensource.google/go/go/+/go1.18:src/strings/replace.go;l=101) [¶](#Replacer.WriteString "Go to Replacer.WriteString") + +```None +func (r *Replacer) WriteString(w io.Writer, s string) (n int, err error) +``` + +WriteString writes s to w with all replacements performed. diff --git a/corpus/docs/golang/strings/strings_go119.md b/corpus/docs/golang/strings/strings_go119.md new file mode 100644 index 0000000000000000000000000000000000000000..07bcbd12600336356a33d95d7e6e0762beb4a038 --- /dev/null +++ b/corpus/docs/golang/strings/strings_go119.md @@ -0,0 +1,2209 @@ +# Golang - strings + +Source: https://pkg.go.dev/strings@go1.19 +Version: go1.19 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package strings implements simple functions to manipulate UTF-8 encoded strings. + +For information about UTF-8 strings in Go, see . + +### Index [¶](#pkg-index "Go to Index") + +* [func Clone(s string) string](#Clone) +* [func Compare(a, b string) int](#Compare) +* [func Contains(s, substr string) bool](#Contains) +* [func ContainsAny(s, chars string) bool](#ContainsAny) +* [func ContainsRune(s string, r rune) bool](#ContainsRune) +* [func Count(s, substr string) int](#Count) +* [func Cut(s, sep string) (before, after string, found bool)](#Cut) +* [func EqualFold(s, t string) bool](#EqualFold) +* [func Fields(s string) []string](#Fields) +* [func FieldsFunc(s string, f func(rune) bool) []string](#FieldsFunc) +* [func HasPrefix(s, prefix string) bool](#HasPrefix) +* [func HasSuffix(s, suffix string) bool](#HasSuffix) +* [func Index(s, substr string) int](#Index) +* [func IndexAny(s, chars string) int](#IndexAny) +* [func IndexByte(s string, c byte) int](#IndexByte) +* [func IndexFunc(s string, f func(rune) bool) int](#IndexFunc) +* [func IndexRune(s string, r rune) int](#IndexRune) +* [func Join(elems []string, sep string) string](#Join) +* [func LastIndex(s, substr string) int](#LastIndex) +* [func LastIndexAny(s, chars string) int](#LastIndexAny) +* [func LastIndexByte(s string, c byte) int](#LastIndexByte) +* [func LastIndexFunc(s string, f func(rune) bool) int](#LastIndexFunc) +* [func Map(mapping func(rune) rune, s string) string](#Map) +* [func Repeat(s string, count int) string](#Repeat) +* [func Replace(s, old, new string, n int) string](#Replace) +* [func ReplaceAll(s, old, new string) string](#ReplaceAll) +* [func Split(s, sep string) []string](#Split) +* [func SplitAfter(s, sep string) []string](#SplitAfter) +* [func SplitAfterN(s, sep string, n int) []string](#SplitAfterN) +* [func SplitN(s, sep string, n int) []string](#SplitN) +* [func Title(s string) string](#Title)deprecated +* [func ToLower(s string) string](#ToLower) +* [func ToLowerSpecial(c unicode.SpecialCase, s string) string](#ToLowerSpecial) +* [func ToTitle(s string) string](#ToTitle) +* [func ToTitleSpecial(c unicode.SpecialCase, s string) string](#ToTitleSpecial) +* [func ToUpper(s string) string](#ToUpper) +* [func ToUpperSpecial(c unicode.SpecialCase, s string) string](#ToUpperSpecial) +* [func ToValidUTF8(s, replacement string) string](#ToValidUTF8) +* [func Trim(s, cutset string) string](#Trim) +* [func TrimFunc(s string, f func(rune) bool) string](#TrimFunc) +* [func TrimLeft(s, cutset string) string](#TrimLeft) +* [func TrimLeftFunc(s string, f func(rune) bool) string](#TrimLeftFunc) +* [func TrimPrefix(s, prefix string) string](#TrimPrefix) +* [func TrimRight(s, cutset string) string](#TrimRight) +* [func TrimRightFunc(s string, f func(rune) bool) string](#TrimRightFunc) +* [func TrimSpace(s string) string](#TrimSpace) +* [func TrimSuffix(s, suffix string) string](#TrimSuffix) +* [type Builder](#Builder) +* + [func (b \*Builder) Cap() int](#Builder.Cap) + + [func (b \*Builder) Grow(n int)](#Builder.Grow) + + [func (b \*Builder) Len() int](#Builder.Len) + + [func (b \*Builder) Reset()](#Builder.Reset) + + [func (b \*Builder) String() string](#Builder.String) + + [func (b \*Builder) Write(p []byte) (int, error)](#Builder.Write) + + [func (b \*Builder) WriteByte(c byte) error](#Builder.WriteByte) + + [func (b \*Builder) WriteRune(r rune) (int, error)](#Builder.WriteRune) + + [func (b \*Builder) WriteString(s string) (int, error)](#Builder.WriteString) +* [type Reader](#Reader) +* + [func NewReader(s string) \*Reader](#NewReader) +* + [func (r \*Reader) Len() int](#Reader.Len) + + [func (r \*Reader) Read(b []byte) (n int, err error)](#Reader.Read) + + [func (r \*Reader) ReadAt(b []byte, off int64) (n int, err error)](#Reader.ReadAt) + + [func (r \*Reader) ReadByte() (byte, error)](#Reader.ReadByte) + + [func (r \*Reader) ReadRune() (ch rune, size int, err error)](#Reader.ReadRune) + + [func (r \*Reader) Reset(s string)](#Reader.Reset) + + [func (r \*Reader) Seek(offset int64, whence int) (int64, error)](#Reader.Seek) + + [func (r \*Reader) Size() int64](#Reader.Size) + + [func (r \*Reader) UnreadByte() error](#Reader.UnreadByte) + + [func (r \*Reader) UnreadRune() error](#Reader.UnreadRune) + + [func (r \*Reader) WriteTo(w io.Writer) (n int64, err error)](#Reader.WriteTo) +* [type Replacer](#Replacer) +* + [func NewReplacer(oldnew ...string) \*Replacer](#NewReplacer) +* + [func (r \*Replacer) Replace(s string) string](#Replacer.Replace) + + [func (r \*Replacer) WriteString(w io.Writer, s string) (n int, err error)](#Replacer.WriteString) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Builder](#example-Builder) +* [Compare](#example-Compare) +* [Contains](#example-Contains) +* [ContainsAny](#example-ContainsAny) +* [ContainsRune](#example-ContainsRune) +* [Count](#example-Count) +* [Cut](#example-Cut) +* [EqualFold](#example-EqualFold) +* [Fields](#example-Fields) +* [FieldsFunc](#example-FieldsFunc) +* [HasPrefix](#example-HasPrefix) +* [HasSuffix](#example-HasSuffix) +* [Index](#example-Index) +* [IndexAny](#example-IndexAny) +* [IndexByte](#example-IndexByte) +* [IndexFunc](#example-IndexFunc) +* [IndexRune](#example-IndexRune) +* [Join](#example-Join) +* [LastIndex](#example-LastIndex) +* [LastIndexAny](#example-LastIndexAny) +* [LastIndexByte](#example-LastIndexByte) +* [LastIndexFunc](#example-LastIndexFunc) +* [Map](#example-Map) +* [NewReplacer](#example-NewReplacer) +* [Repeat](#example-Repeat) +* [Replace](#example-Replace) +* [ReplaceAll](#example-ReplaceAll) +* [Split](#example-Split) +* [SplitAfter](#example-SplitAfter) +* [SplitAfterN](#example-SplitAfterN) +* [SplitN](#example-SplitN) +* [Title](#example-Title) +* [ToLower](#example-ToLower) +* [ToLowerSpecial](#example-ToLowerSpecial) +* [ToTitle](#example-ToTitle) +* [ToTitleSpecial](#example-ToTitleSpecial) +* [ToUpper](#example-ToUpper) +* [ToUpperSpecial](#example-ToUpperSpecial) +* [Trim](#example-Trim) +* [TrimFunc](#example-TrimFunc) +* [TrimLeft](#example-TrimLeft) +* [TrimLeftFunc](#example-TrimLeftFunc) +* [TrimPrefix](#example-TrimPrefix) +* [TrimRight](#example-TrimRight) +* [TrimRightFunc](#example-TrimRightFunc) +* [TrimSpace](#example-TrimSpace) +* [TrimSuffix](#example-TrimSuffix) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [Clone](https://cs.opensource.google/go/go/+/go1.19:src/strings/clone.go;l=21) [¶](#Clone "Go to Clone") added in go1.18 + +```None +func Clone(s string) string +``` + +Clone returns a fresh copy of s. +It guarantees to make a copy of s into a new allocation, +which can be important when retaining only a small substring +of a much larger string. Using Clone can help such programs +use less memory. Of course, since using Clone makes a copy, +overuse of Clone can make programs use more memory. +Clone should typically be used only rarely, and only when +profiling indicates that it is needed. +For strings of length zero the string "" will be returned +and no allocation is made. + +#### func [Compare](https://cs.opensource.google/go/go/+/go1.19:src/strings/compare.go;l=13) [¶](#Compare "Go to Compare") added in go1.5 + +```None +func Compare(a, b string) int +``` + +Compare returns an integer comparing two strings lexicographically. +The result will be 0 if a == b, -1 if a < b, and +1 if a > b. + +Compare is included only for symmetry with package bytes. +It is usually clearer and always faster to use the built-in +string comparison operators ==, <, >, and so on. + +Example [¶](#example-Compare "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Compare("a", "b")) + fmt.Println(strings.Compare("a", "a")) + fmt.Println(strings.Compare("b", "a")) +} +``` + +```None +Output: + +-1 +0 +1 +``` + +Share +Format +Run + +#### func [Contains](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=61) [¶](#Contains "Go to Contains") + +```None +func Contains(s, substr string) bool +``` + +Contains reports whether substr is within s. + +Example [¶](#example-Contains "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Contains("seafood", "foo")) + fmt.Println(strings.Contains("seafood", "bar")) + fmt.Println(strings.Contains("seafood", "")) + fmt.Println(strings.Contains("", "")) +} +``` + +```None +Output: + +true +false +true +true +``` + +Share +Format +Run + +#### func [ContainsAny](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=66) [¶](#ContainsAny "Go to ContainsAny") + +```None +func ContainsAny(s, chars string) bool +``` + +ContainsAny reports whether any Unicode code points in chars are within s. + +Example [¶](#example-ContainsAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ContainsAny("team", "i")) + fmt.Println(strings.ContainsAny("fail", "ui")) + fmt.Println(strings.ContainsAny("ure", "ui")) + fmt.Println(strings.ContainsAny("failure", "ui")) + fmt.Println(strings.ContainsAny("foo", "")) + fmt.Println(strings.ContainsAny("", "")) +} +``` + +```None +Output: + +false +true +true +true +false +false +``` + +Share +Format +Run + +#### func [ContainsRune](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=71) [¶](#ContainsRune "Go to ContainsRune") + +```None +func ContainsRune(s string, r rune) bool +``` + +ContainsRune reports whether the Unicode code point r is within s. + +Example [¶](#example-ContainsRune "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Finds whether a string contains a particular Unicode code point. + // The code point for the lowercase letter "a", for example, is 97. + fmt.Println(strings.ContainsRune("aardvark", 97)) + fmt.Println(strings.ContainsRune("timeout", 97)) +} +``` + +```None +Output: + +true +false +``` + +Share +Format +Run + +#### func [Count](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=41) [¶](#Count "Go to Count") + +```None +func Count(s, substr string) int +``` + +Count counts the number of non-overlapping instances of substr in s. +If substr is an empty string, Count returns 1 + the number of Unicode code points in s. + +Example [¶](#example-Count "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Count("cheese", "e")) + fmt.Println(strings.Count("five", "")) // before & after each rune +} +``` + +```None +Output: + +3 +5 +``` + +Share +Format +Run + +#### func [Cut](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=1187) [¶](#Cut "Go to Cut") added in go1.18 + +```None +func Cut(s, sep string) (before, after string, found bool) +``` + +Cut slices s around the first instance of sep, +returning the text before and after sep. +The found result reports whether sep appears in s. +If sep does not appear in s, cut returns s, "", false. + +Example [¶](#example-Cut "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + show := func(s, sep string) { + before, after, found := strings.Cut(s, sep) + fmt.Printf("Cut(%q, %q) = %q, %q, %v\n", s, sep, before, after, found) + } + show("Gopher", "Go") + show("Gopher", "ph") + show("Gopher", "er") + show("Gopher", "Badger") +} +``` + +```None +Output: + +Cut("Gopher", "Go") = "", "pher", true +Cut("Gopher", "ph") = "Go", "er", true +Cut("Gopher", "er") = "Goph", "", true +Cut("Gopher", "Badger") = "Gopher", "", false +``` + +Share +Format +Run + +#### func [EqualFold](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=1049) [¶](#EqualFold "Go to EqualFold") + +```None +func EqualFold(s, t string) bool +``` + +EqualFold reports whether s and t, interpreted as UTF-8 strings, +are equal under simple Unicode case-folding, which is a more general +form of case-insensitivity. + +Example [¶](#example-EqualFold "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.EqualFold("Go", "go")) + fmt.Println(strings.EqualFold("AB", "ab")) // true because comparison uses simple case-folding + fmt.Println(strings.EqualFold("ß", "ss")) // false because comparison does not use full case-folding +} +``` + +```None +Output: + +true +true +false +``` + +Share +Format +Run + +#### func [Fields](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=329) [¶](#Fields "Go to Fields") + +```None +func Fields(s string) []string +``` + +Fields splits the string s around each instance of one or more consecutive white space +characters, as defined by unicode.IsSpace, returning a slice of substrings of s or an +empty slice if s contains only white space. + +Example [¶](#example-Fields "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("Fields are: %q", strings.Fields(" foo bar baz ")) +} +``` + +```None +Output: + +Fields are: ["foo" "bar" "baz"] +``` + +Share +Format +Run + +#### func [FieldsFunc](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=384) [¶](#FieldsFunc "Go to FieldsFunc") + +```None +func FieldsFunc(s string, f func(rune) bool) []string +``` + +FieldsFunc splits the string s at each run of Unicode code points c satisfying f(c) +and returns an array of slices of s. If all code points in s satisfy f(c) or the +string is empty, an empty slice is returned. + +FieldsFunc makes no guarantees about the order in which it calls f(c) +and assumes that f always returns the same value for a given c. + +Example [¶](#example-FieldsFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + f := func(c rune) bool { + return !unicode.IsLetter(c) && !unicode.IsNumber(c) + } + fmt.Printf("Fields are: %q", strings.FieldsFunc(" foo1;bar2,baz3...", f)) +} +``` + +```None +Output: + +Fields are: ["foo1" "bar2" "baz3"] +``` + +Share +Format +Run + +#### func [HasPrefix](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=453) [¶](#HasPrefix "Go to HasPrefix") + +```None +func HasPrefix(s, prefix string) bool +``` + +HasPrefix tests whether the string s begins with prefix. + +Example [¶](#example-HasPrefix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.HasPrefix("Gopher", "Go")) + fmt.Println(strings.HasPrefix("Gopher", "C")) + fmt.Println(strings.HasPrefix("Gopher", "")) +} +``` + +```None +Output: + +true +false +true +``` + +Share +Format +Run + +#### func [HasSuffix](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=458) [¶](#HasSuffix "Go to HasSuffix") + +```None +func HasSuffix(s, suffix string) bool +``` + +HasSuffix tests whether the string s ends with suffix. + +Example [¶](#example-HasSuffix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.HasSuffix("Amigo", "go")) + fmt.Println(strings.HasSuffix("Amigo", "O")) + fmt.Println(strings.HasSuffix("Amigo", "Ami")) + fmt.Println(strings.HasSuffix("Amigo", "")) +} +``` + +```None +Output: + +true +false +false +true +``` + +Share +Format +Run + +#### func [Index](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=1103) [¶](#Index "Go to Index") + +```None +func Index(s, substr string) int +``` + +Index returns the index of the first instance of substr in s, or -1 if substr is not present in s. + +Example [¶](#example-Index "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Index("chicken", "ken")) + fmt.Println(strings.Index("chicken", "dmr")) +} +``` + +```None +Output: + +4 +-1 +``` + +Share +Format +Run + +#### func [IndexAny](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=141) [¶](#IndexAny "Go to IndexAny") + +```None +func IndexAny(s, chars string) int +``` + +IndexAny returns the index of the first instance of any Unicode code point +from chars in s, or -1 if no Unicode code point from chars is present in s. + +Example [¶](#example-IndexAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexAny("chicken", "aeiouy")) + fmt.Println(strings.IndexAny("crwth", "aeiouy")) +} +``` + +```None +Output: + +2 +-1 +``` + +Share +Format +Run + +#### func [IndexByte](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=113) [¶](#IndexByte "Go to IndexByte") added in go1.2 + +```None +func IndexByte(s string, c byte) int +``` + +IndexByte returns the index of the first instance of c in s, or -1 if c is not present in s. + +Example [¶](#example-IndexByte "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexByte("golang", 'g')) + fmt.Println(strings.IndexByte("gophers", 'h')) + fmt.Println(strings.IndexByte("golang", 'x')) +} +``` + +```None +Output: + +0 +3 +-1 +``` + +Share +Format +Run + +#### func [IndexFunc](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=768) [¶](#IndexFunc "Go to IndexFunc") + +```None +func IndexFunc(s string, f func(rune) bool) int +``` + +IndexFunc returns the index into s of the first Unicode +code point satisfying f(c), or -1 if none do. + +Example [¶](#example-IndexFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + f := func(c rune) bool { + return unicode.Is(unicode.Han, c) + } + fmt.Println(strings.IndexFunc("Hello, 世界", f)) + fmt.Println(strings.IndexFunc("Hello, world", f)) +} +``` + +```None +Output: + +7 +-1 +``` + +Share +Format +Run + +#### func [IndexRune](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=121) [¶](#IndexRune "Go to IndexRune") + +```None +func IndexRune(s string, r rune) int +``` + +IndexRune returns the index of the first instance of the Unicode code point +r, or -1 if rune is not present in s. +If r is utf8.RuneError, it returns the first instance of any +invalid UTF-8 byte sequence. + +Example [¶](#example-IndexRune "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexRune("chicken", 'k')) + fmt.Println(strings.IndexRune("chicken", 'd')) +} +``` + +```None +Output: + +4 +-1 +``` + +Share +Format +Run + +#### func [Join](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=430) [¶](#Join "Go to Join") + +```None +func Join(elems []string, sep string) string +``` + +Join concatenates the elements of its first argument to create a single string. The separator +string sep is placed between elements in the resulting string. + +Example [¶](#example-Join "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + s := []string{"foo", "bar", "baz"} + fmt.Println(strings.Join(s, ", ")) +} +``` + +```None +Output: + +foo, bar, baz +``` + +Share +Format +Run + +#### func [LastIndex](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=76) [¶](#LastIndex "Go to LastIndex") + +```None +func LastIndex(s, substr string) int +``` + +LastIndex returns the index of the last instance of substr in s, or -1 if substr is not present in s. + +Example [¶](#example-LastIndex "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Index("go gopher", "go")) + fmt.Println(strings.LastIndex("go gopher", "go")) + fmt.Println(strings.LastIndex("go gopher", "rodent")) +} +``` + +```None +Output: + +0 +3 +-1 +``` + +Share +Format +Run + +#### func [LastIndexAny](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=175) [¶](#LastIndexAny "Go to LastIndexAny") + +```None +func LastIndexAny(s, chars string) int +``` + +LastIndexAny returns the index of the last instance of any Unicode code +point from chars in s, or -1 if no Unicode code point from chars is +present in s. + +Example [¶](#example-LastIndexAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.LastIndexAny("go gopher", "go")) + fmt.Println(strings.LastIndexAny("go gopher", "rodent")) + fmt.Println(strings.LastIndexAny("go gopher", "fail")) +} +``` + +```None +Output: + +4 +8 +-1 +``` + +Share +Format +Run + +#### func [LastIndexByte](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=225) [¶](#LastIndexByte "Go to LastIndexByte") added in go1.5 + +```None +func LastIndexByte(s string, c byte) int +``` + +LastIndexByte returns the index of the last instance of c in s, or -1 if c is not present in s. + +Example [¶](#example-LastIndexByte "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.LastIndexByte("Hello, world", 'l')) + fmt.Println(strings.LastIndexByte("Hello, world", 'o')) + fmt.Println(strings.LastIndexByte("Hello, world", 'x')) +} +``` + +```None +Output: + +10 +8 +-1 +``` + +Share +Format +Run + +#### func [LastIndexFunc](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=774) [¶](#LastIndexFunc "Go to LastIndexFunc") + +```None +func LastIndexFunc(s string, f func(rune) bool) int +``` + +LastIndexFunc returns the index into s of the last +Unicode code point satisfying f(c), or -1 if none do. + +Example [¶](#example-LastIndexFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.LastIndexFunc("go 123", unicode.IsNumber)) + fmt.Println(strings.LastIndexFunc("123 go", unicode.IsNumber)) + fmt.Println(strings.LastIndexFunc("go", unicode.IsNumber)) +} +``` + +```None +Output: + +5 +2 +-1 +``` + +Share +Format +Run + +#### func [Map](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=465) [¶](#Map "Go to Map") + +```None +func Map(mapping func(rune) rune, s string) string +``` + +Map returns a copy of the string s with all its characters modified +according to the mapping function. If mapping returns a negative value, the character is +dropped from the string with no replacement. + +Example [¶](#example-Map "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + rot13 := func(r rune) rune { + switch { + case r >= 'A' && r <= 'Z': + return 'A' + (r-'A'+13)%26 + case r >= 'a' && r <= 'z': + return 'a' + (r-'a'+13)%26 + } + return r + } + fmt.Println(strings.Map(rot13, "'Twas brillig and the slithy gopher...")) +} +``` + +```None +Output: + +'Gjnf oevyyvt naq gur fyvgul tbcure... +``` + +Share +Format +Run + +#### func [Repeat](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=528) [¶](#Repeat "Go to Repeat") + +```None +func Repeat(s string, count int) string +``` + +Repeat returns a new string consisting of count copies of the string s. + +It panics if count is negative or if +the result of (len(s) \* count) overflows. + +Example [¶](#example-Repeat "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println("ba" + strings.Repeat("na", 2)) +} +``` + +```None +Output: + +banana +``` + +Share +Format +Run + +#### func [Replace](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=1003) [¶](#Replace "Go to Replace") + +```None +func Replace(s, old, new string, n int) string +``` + +Replace returns a copy of the string s with the first n +non-overlapping instances of old replaced by new. +If old is empty, it matches at the beginning of the string +and after each UTF-8 sequence, yielding up to k+1 replacements +for a k-rune string. +If n < 0, there is no limit on the number of replacements. + +Example [¶](#example-Replace "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Replace("oink oink oink", "k", "ky", 2)) + fmt.Println(strings.Replace("oink oink oink", "oink", "moo", -1)) +} +``` + +```None +Output: + +oinky oinky oink +moo moo moo +``` + +Share +Format +Run + +#### func [ReplaceAll](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=1042) [¶](#ReplaceAll "Go to ReplaceAll") added in go1.12 + +```None +func ReplaceAll(s, old, new string) string +``` + +ReplaceAll returns a copy of the string s with all +non-overlapping instances of old replaced by new. +If old is empty, it matches at the beginning of the string +and after each UTF-8 sequence, yielding up to k+1 replacements +for a k-rune string. + +Example [¶](#example-ReplaceAll "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ReplaceAll("oink oink oink", "oink", "moo")) +} +``` + +```None +Output: + +moo moo moo +``` + +Share +Format +Run + +#### func [Split](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=308) [¶](#Split "Go to Split") + +```None +func Split(s, sep string) []string +``` + +Split slices s into all substrings separated by sep and returns a slice of +the substrings between those separators. + +If s does not contain sep and sep is not empty, Split returns a +slice of length 1 whose only element is s. + +If sep is empty, Split splits after each UTF-8 sequence. If both s +and sep are empty, Split returns an empty slice. + +It is equivalent to SplitN with a count of -1. + +To split around the first instance of a separator, see Cut. + +Example [¶](#example-Split "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.Split("a,b,c", ",")) + fmt.Printf("%q\n", strings.Split("a man a plan a canal panama", "a ")) + fmt.Printf("%q\n", strings.Split(" xyz ", "")) + fmt.Printf("%q\n", strings.Split("", "Bernardo O'Higgins")) +} +``` + +```None +Output: + +["a" "b" "c"] +["" "man " "plan " "canal panama"] +[" " "x" "y" "z" " "] +[""] +``` + +Share +Format +Run + +#### func [SplitAfter](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=320) [¶](#SplitAfter "Go to SplitAfter") + +```None +func SplitAfter(s, sep string) []string +``` + +SplitAfter slices s into all substrings after each instance of sep and +returns a slice of those substrings. + +If s does not contain sep and sep is not empty, SplitAfter returns +a slice of length 1 whose only element is s. + +If sep is empty, SplitAfter splits after each UTF-8 sequence. If +both s and sep are empty, SplitAfter returns an empty slice. + +It is equivalent to SplitAfterN with a count of -1. + +Example [¶](#example-SplitAfter "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitAfter("a,b,c", ",")) +} +``` + +```None +Output: + +["a," "b," "c"] +``` + +Share +Format +Run + +#### func [SplitAfterN](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=292) [¶](#SplitAfterN "Go to SplitAfterN") + +```None +func SplitAfterN(s, sep string, n int) []string +``` + +SplitAfterN slices s into substrings after each instance of sep and +returns a slice of those substrings. + +The count determines the number of substrings to return: + +```None +n > 0: at most n substrings; the last substring will be the unsplit remainder. +n == 0: the result is nil (zero substrings) +n < 0: all substrings +``` + +Edge cases for s and sep (for example, empty strings) are handled +as described in the documentation for SplitAfter. + +Example [¶](#example-SplitAfterN "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitAfterN("a,b,c", ",", 2)) +} +``` + +```None +Output: + +["a," "b,c"] +``` + +Share +Format +Run + +#### func [SplitN](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=279) [¶](#SplitN "Go to SplitN") + +```None +func SplitN(s, sep string, n int) []string +``` + +SplitN slices s into substrings separated by sep and returns a slice of +the substrings between those separators. + +The count determines the number of substrings to return: + +```None +n > 0: at most n substrings; the last substring will be the unsplit remainder. +n == 0: the result is nil (zero substrings) +n < 0: all substrings +``` + +Edge cases for s and sep (for example, empty strings) are handled +as described in the documentation for Split. + +To split around the first instance of a separator, see Cut. + +Example [¶](#example-SplitN "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitN("a,b,c", ",", 2)) + z := strings.SplitN("a,b,c", ",", 0) + fmt.Printf("%q (nil = %v)\n", z, z == nil) +} +``` + +```None +Output: + +["a" "b,c"] +[] (nil = true) +``` + +Share +Format +Run + +#### func [Title](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=720) deprecated + +```None +func Title(s string) string +``` + +Title returns a copy of the string s with all Unicode letters that begin words +mapped to their Unicode title case. + +Deprecated: The rule Title uses for word boundaries does not handle Unicode +punctuation properly. Use golang.org/x/text/cases instead. + +Example [¶](#example-Title "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Compare this example to the ToTitle example. + fmt.Println(strings.Title("her royal highness")) + fmt.Println(strings.Title("loud noises")) + fmt.Println(strings.Title("хлеб")) +} +``` + +```None +Output: + +Her Royal Highness +Loud Noises +Хлеб +``` + +Share +Format +Run + +#### func [ToLower](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=589) [¶](#ToLower "Go to ToLower") + +```None +func ToLower(s string) string +``` + +ToLower returns s with all Unicode letters mapped to their lower case. + +Example [¶](#example-ToLower "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ToLower("Gopher")) +} +``` + +```None +Output: + +gopher +``` + +Share +Format +Run + +#### func [ToLowerSpecial](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=630) [¶](#ToLowerSpecial "Go to ToLowerSpecial") + +```None +func ToLowerSpecial(c unicode.SpecialCase, s string) string +``` + +ToLowerSpecial returns a copy of the string s with all Unicode letters mapped to their +lower case using the case mapping specified by c. + +Example [¶](#example-ToLowerSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToLowerSpecial(unicode.TurkishCase, "Önnek İş")) +} +``` + +```None +Output: + +önnek iş +``` + +Share +Format +Run + +#### func [ToTitle](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=620) [¶](#ToTitle "Go to ToTitle") + +```None +func ToTitle(s string) string +``` + +ToTitle returns a copy of the string s with all Unicode letters mapped to +their Unicode title case. + +Example [¶](#example-ToTitle "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Compare this example to the Title example. + fmt.Println(strings.ToTitle("her royal highness")) + fmt.Println(strings.ToTitle("loud noises")) + fmt.Println(strings.ToTitle("хлеб")) +} +``` + +```None +Output: + +HER ROYAL HIGHNESS +LOUD NOISES +ХЛЕБ +``` + +Share +Format +Run + +#### func [ToTitleSpecial](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=636) [¶](#ToTitleSpecial "Go to ToTitleSpecial") + +```None +func ToTitleSpecial(c unicode.SpecialCase, s string) string +``` + +ToTitleSpecial returns a copy of the string s with all Unicode letters mapped to their +Unicode title case, giving priority to the special casing rules. + +Example [¶](#example-ToTitleSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToTitleSpecial(unicode.TurkishCase, "dünyanın ilk borsa yapısı Aizonai kabul edilir")) +} +``` + +```None +Output: + +DÜNYANIN İLK BORSA YAPISI AİZONAİ KABUL EDİLİR +``` + +Share +Format +Run + +#### func [ToUpper](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=559) [¶](#ToUpper "Go to ToUpper") + +```None +func ToUpper(s string) string +``` + +ToUpper returns s with all Unicode letters mapped to their upper case. + +Example [¶](#example-ToUpper "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ToUpper("Gopher")) +} +``` + +```None +Output: + +GOPHER +``` + +Share +Format +Run + +#### func [ToUpperSpecial](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=624) [¶](#ToUpperSpecial "Go to ToUpperSpecial") + +```None +func ToUpperSpecial(c unicode.SpecialCase, s string) string +``` + +ToUpperSpecial returns a copy of the string s with all Unicode letters mapped to their +upper case using the case mapping specified by c. + +Example [¶](#example-ToUpperSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToUpperSpecial(unicode.TurkishCase, "örnek iş")) +} +``` + +```None +Output: + +ÖRNEK İŞ +``` + +Share +Format +Run + +#### func [ToValidUTF8](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=642) [¶](#ToValidUTF8 "Go to ToValidUTF8") added in go1.13 + +```None +func ToValidUTF8(s, replacement string) string +``` + +ToValidUTF8 returns a copy of the string s with each run of invalid UTF-8 byte sequences +replaced by the replacement string, which may be empty. + +#### func [Trim](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=834) [¶](#Trim "Go to Trim") + +```None +func Trim(s, cutset string) string +``` + +Trim returns a slice of the string s with all leading and +trailing Unicode code points contained in cutset removed. + +Example [¶](#example-Trim "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.Trim("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimFunc](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=762) [¶](#TrimFunc "Go to TrimFunc") + +```None +func TrimFunc(s string, f func(rune) bool) string +``` + +TrimFunc returns a slice of the string s with all leading +and trailing Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimLeft](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=851) [¶](#TrimLeft "Go to TrimLeft") + +```None +func TrimLeft(s, cutset string) string +``` + +TrimLeft returns a slice of the string s with all leading +Unicode code points contained in cutset removed. + +To remove a prefix, use TrimPrefix instead. + +Example [¶](#example-TrimLeft "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.TrimLeft("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +Hello, Gophers!!! +``` + +Share +Format +Run + +#### func [TrimLeftFunc](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=739) [¶](#TrimLeftFunc "Go to TrimLeftFunc") + +```None +func TrimLeftFunc(s string, f func(rune) bool) string +``` + +TrimLeftFunc returns a slice of the string s with all leading +Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimLeftFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimLeftFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +Hello, Gophers!!! +``` + +Share +Format +Run + +#### func [TrimPrefix](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=981) [¶](#TrimPrefix "Go to TrimPrefix") added in go1.1 + +```None +func TrimPrefix(s, prefix string) string +``` + +TrimPrefix returns s without the provided leading prefix string. +If s doesn't start with prefix, s is returned unchanged. + +Example [¶](#example-TrimPrefix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var s = "¡¡¡Hello, Gophers!!!" + s = strings.TrimPrefix(s, "¡¡¡Hello, ") + s = strings.TrimPrefix(s, "¡¡¡Howdy, ") + fmt.Print(s) +} +``` + +```None +Output: + +Gophers!!! +``` + +Share +Format +Run + +#### func [TrimRight](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=899) [¶](#TrimRight "Go to TrimRight") + +```None +func TrimRight(s, cutset string) string +``` + +TrimRight returns a slice of the string s, with all trailing +Unicode code points contained in cutset removed. + +To remove a suffix, use TrimSuffix instead. + +Example [¶](#example-TrimRight "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.TrimRight("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +¡¡¡Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimRightFunc](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=749) [¶](#TrimRightFunc "Go to TrimRightFunc") + +```None +func TrimRightFunc(s string, f func(rune) bool) string +``` + +TrimRightFunc returns a slice of the string s with all trailing +Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimRightFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimRightFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +¡¡¡Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimSpace](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=945) [¶](#TrimSpace "Go to TrimSpace") + +```None +func TrimSpace(s string) string +``` + +TrimSpace returns a slice of the string s, with all leading +and trailing white space removed, as defined by Unicode. + +Example [¶](#example-TrimSpace "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.TrimSpace(" \t\n Hello, Gophers \n\t\r\n")) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimSuffix](https://cs.opensource.google/go/go/+/go1.19:src/strings/strings.go;l=990) [¶](#TrimSuffix "Go to TrimSuffix") added in go1.1 + +```None +func TrimSuffix(s, suffix string) string +``` + +TrimSuffix returns s without the provided trailing suffix string. +If s doesn't end with suffix, s is returned unchanged. + +Example [¶](#example-TrimSuffix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var s = "¡¡¡Hello, Gophers!!!" + s = strings.TrimSuffix(s, ", Gophers!!!") + s = strings.TrimSuffix(s, ", Marmots!!!") + fmt.Print(s) +} +``` + +```None +Output: + +¡¡¡Hello +``` + +Share +Format +Run + +### Types [¶](#pkg-types "Go to Types") + +#### type [Builder](https://cs.opensource.google/go/go/+/go1.19:src/strings/builder.go;l=15) [¶](#Builder "Go to Builder") added in go1.10 + +```None +type Builder struct { + // contains filtered or unexported fields +} +``` + +A Builder is used to efficiently build a string using Write methods. +It minimizes memory copying. The zero value is ready to use. +Do not copy a non-zero Builder. + +Example [¶](#example-Builder "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var b strings.Builder + for i := 3; i >= 1; i-- { + fmt.Fprintf(&b, "%d...", i) + } + b.WriteString("ignition") + fmt.Println(b.String()) + +} +``` + +```None +Output: + +3...2...1...ignition +``` + +Share +Format +Run + +#### func (\*Builder) [Cap](https://cs.opensource.google/go/go/+/go1.19:src/strings/builder.go;l=57) [¶](#Builder.Cap "Go to Builder.Cap") added in go1.12 + +```None +func (b *Builder) Cap() int +``` + +Cap returns the capacity of the builder's underlying byte slice. It is the +total space allocated for the string being built and includes any bytes +already written. + +#### func (\*Builder) [Grow](https://cs.opensource.google/go/go/+/go1.19:src/strings/builder.go;l=76) [¶](#Builder.Grow "Go to Builder.Grow") added in go1.10 + +```None +func (b *Builder) Grow(n int) +``` + +Grow grows b's capacity, if necessary, to guarantee space for +another n bytes. After Grow(n), at least n bytes can be written to b +without another allocation. If n is negative, Grow panics. + +#### func (\*Builder) [Len](https://cs.opensource.google/go/go/+/go1.19:src/strings/builder.go;l=52) [¶](#Builder.Len "Go to Builder.Len") added in go1.10 + +```None +func (b *Builder) Len() int +``` + +Len returns the number of accumulated bytes; b.Len() == len(b.String()). + +#### func (\*Builder) [Reset](https://cs.opensource.google/go/go/+/go1.19:src/strings/builder.go;l=60) [¶](#Builder.Reset "Go to Builder.Reset") added in go1.10 + +```None +func (b *Builder) Reset() +``` + +Reset resets the Builder to be empty. + +#### func (\*Builder) [String](https://cs.opensource.google/go/go/+/go1.19:src/strings/builder.go;l=47) [¶](#Builder.String "Go to Builder.String") added in go1.10 + +```None +func (b *Builder) String() string +``` + +String returns the accumulated string. + +#### func (\*Builder) [Write](https://cs.opensource.google/go/go/+/go1.19:src/strings/builder.go;l=88) [¶](#Builder.Write "Go to Builder.Write") added in go1.10 + +```None +func (b *Builder) Write(p []byte) (int, error) +``` + +Write appends the contents of p to b's buffer. +Write always returns len(p), nil. + +#### func (\*Builder) [WriteByte](https://cs.opensource.google/go/go/+/go1.19:src/strings/builder.go;l=96) [¶](#Builder.WriteByte "Go to Builder.WriteByte") added in go1.10 + +```None +func (b *Builder) WriteByte(c byte) error +``` + +WriteByte appends the byte c to b's buffer. +The returned error is always nil. + +#### func (\*Builder) [WriteRune](https://cs.opensource.google/go/go/+/go1.19:src/strings/builder.go;l=104) [¶](#Builder.WriteRune "Go to Builder.WriteRune") added in go1.10 + +```None +func (b *Builder) WriteRune(r rune) (int, error) +``` + +WriteRune appends the UTF-8 encoding of Unicode code point r to b's buffer. +It returns the length of r and a nil error. + +#### func (\*Builder) [WriteString](https://cs.opensource.google/go/go/+/go1.19:src/strings/builder.go;l=122) [¶](#Builder.WriteString "Go to Builder.WriteString") added in go1.10 + +```None +func (b *Builder) WriteString(s string) (int, error) +``` + +WriteString appends the contents of s to b's buffer. +It returns the length of s and a nil error. + +#### type [Reader](https://cs.opensource.google/go/go/+/go1.19:src/strings/reader.go;l=17) [¶](#Reader "Go to Reader") + +```None +type Reader struct { + // contains filtered or unexported fields +} +``` + +A Reader implements the io.Reader, io.ReaderAt, io.ByteReader, io.ByteScanner, +io.RuneReader, io.RuneScanner, io.Seeker, and io.WriterTo interfaces by reading +from a string. +The zero value for Reader operates like a Reader of an empty string. + +#### func [NewReader](https://cs.opensource.google/go/go/+/go1.19:src/strings/reader.go;l=160) [¶](#NewReader "Go to NewReader") + +```None +func NewReader(s string) *Reader +``` + +NewReader returns a new Reader reading from s. +It is similar to bytes.NewBufferString but more efficient and read-only. + +#### func (\*Reader) [Len](https://cs.opensource.google/go/go/+/go1.19:src/strings/reader.go;l=25) [¶](#Reader.Len "Go to Reader.Len") + +```None +func (r *Reader) Len() int +``` + +Len returns the number of bytes of the unread portion of the +string. + +#### func (\*Reader) [Read](https://cs.opensource.google/go/go/+/go1.19:src/strings/reader.go;l=39) [¶](#Reader.Read "Go to Reader.Read") + +```None +func (r *Reader) Read(b []byte) (n int, err error) +``` + +Read implements the io.Reader interface. + +#### func (\*Reader) [ReadAt](https://cs.opensource.google/go/go/+/go1.19:src/strings/reader.go;l=50) [¶](#Reader.ReadAt "Go to Reader.ReadAt") + +```None +func (r *Reader) ReadAt(b []byte, off int64) (n int, err error) +``` + +ReadAt implements the io.ReaderAt interface. + +#### func (\*Reader) [ReadByte](https://cs.opensource.google/go/go/+/go1.19:src/strings/reader.go;l=66) [¶](#Reader.ReadByte "Go to Reader.ReadByte") + +```None +func (r *Reader) ReadByte() (byte, error) +``` + +ReadByte implements the io.ByteReader interface. + +#### func (\*Reader) [ReadRune](https://cs.opensource.google/go/go/+/go1.19:src/strings/reader.go;l=87) [¶](#Reader.ReadRune "Go to Reader.ReadRune") + +```None +func (r *Reader) ReadRune() (ch rune, size int, err error) +``` + +ReadRune implements the io.RuneReader interface. + +#### func (\*Reader) [Reset](https://cs.opensource.google/go/go/+/go1.19:src/strings/reader.go;l=156) [¶](#Reader.Reset "Go to Reader.Reset") added in go1.7 + +```None +func (r *Reader) Reset(s string) +``` + +Reset resets the Reader to be reading from s. + +#### func (\*Reader) [Seek](https://cs.opensource.google/go/go/+/go1.19:src/strings/reader.go;l=116) [¶](#Reader.Seek "Go to Reader.Seek") + +```None +func (r *Reader) Seek(offset int64, whence int) (int64, error) +``` + +Seek implements the io.Seeker interface. + +#### func (\*Reader) [Size](https://cs.opensource.google/go/go/+/go1.19:src/strings/reader.go;l=36) [¶](#Reader.Size "Go to Reader.Size") added in go1.5 + +```None +func (r *Reader) Size() int64 +``` + +Size returns the original length of the underlying string. +Size is the number of bytes available for reading via ReadAt. +The returned value is always the same and is not affected by calls +to any other method. + +#### func (\*Reader) [UnreadByte](https://cs.opensource.google/go/go/+/go1.19:src/strings/reader.go;l=77) [¶](#Reader.UnreadByte "Go to Reader.UnreadByte") + +```None +func (r *Reader) UnreadByte() error +``` + +UnreadByte implements the io.ByteScanner interface. + +#### func (\*Reader) [UnreadRune](https://cs.opensource.google/go/go/+/go1.19:src/strings/reader.go;l=103) [¶](#Reader.UnreadRune "Go to Reader.UnreadRune") + +```None +func (r *Reader) UnreadRune() error +``` + +UnreadRune implements the io.RuneScanner interface. + +#### func (\*Reader) [WriteTo](https://cs.opensource.google/go/go/+/go1.19:src/strings/reader.go;l=137) [¶](#Reader.WriteTo "Go to Reader.WriteTo") added in go1.1 + +```None +func (r *Reader) WriteTo(w io.Writer) (n int64, err error) +``` + +WriteTo implements the io.WriterTo interface. + +#### type [Replacer](https://cs.opensource.google/go/go/+/go1.19:src/strings/replace.go;l=14) [¶](#Replacer "Go to Replacer") + +```None +type Replacer struct { + // contains filtered or unexported fields +} +``` + +Replacer replaces a list of strings with replacements. +It is safe for concurrent use by multiple goroutines. + +#### func [NewReplacer](https://cs.opensource.google/go/go/+/go1.19:src/strings/replace.go;l=32) [¶](#NewReplacer "Go to NewReplacer") + +```None +func NewReplacer(oldnew ...string) *Replacer +``` + +NewReplacer returns a new Replacer from a list of old, new string +pairs. Replacements are performed in the order they appear in the +target string, without overlapping matches. The old string +comparisons are done in argument order. + +NewReplacer panics if given an odd number of arguments. + +Example [¶](#example-NewReplacer "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + r := strings.NewReplacer("<", "<", ">", ">") + fmt.Println(r.Replace("This is HTML!")) +} +``` + +```None +Output: + +This is <b>HTML</b>! +``` + +Share +Format +Run + +#### func (\*Replacer) [Replace](https://cs.opensource.google/go/go/+/go1.19:src/strings/replace.go;l=95) [¶](#Replacer.Replace "Go to Replacer.Replace") + +```None +func (r *Replacer) Replace(s string) string +``` + +Replace returns a copy of s with all replacements performed. + +#### func (\*Replacer) [WriteString](https://cs.opensource.google/go/go/+/go1.19:src/strings/replace.go;l=101) [¶](#Replacer.WriteString "Go to Replacer.WriteString") + +```None +func (r *Replacer) WriteString(w io.Writer, s string) (n int, err error) +``` + +WriteString writes s to w with all replacements performed. diff --git a/corpus/docs/golang/strings/strings_go120.md b/corpus/docs/golang/strings/strings_go120.md new file mode 100644 index 0000000000000000000000000000000000000000..77135975e182e6a6ecc1129effcc39e13c53a3b3 --- /dev/null +++ b/corpus/docs/golang/strings/strings_go120.md @@ -0,0 +1,2233 @@ +# Golang - strings + +Source: https://pkg.go.dev/strings@go1.20 +Version: go1.20 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package strings implements simple functions to manipulate UTF-8 encoded strings. + +For information about UTF-8 strings in Go, see . + +### Index [¶](#pkg-index "Go to Index") + +* [func Clone(s string) string](#Clone) +* [func Compare(a, b string) int](#Compare) +* [func Contains(s, substr string) bool](#Contains) +* [func ContainsAny(s, chars string) bool](#ContainsAny) +* [func ContainsRune(s string, r rune) bool](#ContainsRune) +* [func Count(s, substr string) int](#Count) +* [func Cut(s, sep string) (before, after string, found bool)](#Cut) +* [func CutPrefix(s, prefix string) (after string, found bool)](#CutPrefix) +* [func CutSuffix(s, suffix string) (before string, found bool)](#CutSuffix) +* [func EqualFold(s, t string) bool](#EqualFold) +* [func Fields(s string) []string](#Fields) +* [func FieldsFunc(s string, f func(rune) bool) []string](#FieldsFunc) +* [func HasPrefix(s, prefix string) bool](#HasPrefix) +* [func HasSuffix(s, suffix string) bool](#HasSuffix) +* [func Index(s, substr string) int](#Index) +* [func IndexAny(s, chars string) int](#IndexAny) +* [func IndexByte(s string, c byte) int](#IndexByte) +* [func IndexFunc(s string, f func(rune) bool) int](#IndexFunc) +* [func IndexRune(s string, r rune) int](#IndexRune) +* [func Join(elems []string, sep string) string](#Join) +* [func LastIndex(s, substr string) int](#LastIndex) +* [func LastIndexAny(s, chars string) int](#LastIndexAny) +* [func LastIndexByte(s string, c byte) int](#LastIndexByte) +* [func LastIndexFunc(s string, f func(rune) bool) int](#LastIndexFunc) +* [func Map(mapping func(rune) rune, s string) string](#Map) +* [func Repeat(s string, count int) string](#Repeat) +* [func Replace(s, old, new string, n int) string](#Replace) +* [func ReplaceAll(s, old, new string) string](#ReplaceAll) +* [func Split(s, sep string) []string](#Split) +* [func SplitAfter(s, sep string) []string](#SplitAfter) +* [func SplitAfterN(s, sep string, n int) []string](#SplitAfterN) +* [func SplitN(s, sep string, n int) []string](#SplitN) +* [func Title(s string) string](#Title)deprecated +* [func ToLower(s string) string](#ToLower) +* [func ToLowerSpecial(c unicode.SpecialCase, s string) string](#ToLowerSpecial) +* [func ToTitle(s string) string](#ToTitle) +* [func ToTitleSpecial(c unicode.SpecialCase, s string) string](#ToTitleSpecial) +* [func ToUpper(s string) string](#ToUpper) +* [func ToUpperSpecial(c unicode.SpecialCase, s string) string](#ToUpperSpecial) +* [func ToValidUTF8(s, replacement string) string](#ToValidUTF8) +* [func Trim(s, cutset string) string](#Trim) +* [func TrimFunc(s string, f func(rune) bool) string](#TrimFunc) +* [func TrimLeft(s, cutset string) string](#TrimLeft) +* [func TrimLeftFunc(s string, f func(rune) bool) string](#TrimLeftFunc) +* [func TrimPrefix(s, prefix string) string](#TrimPrefix) +* [func TrimRight(s, cutset string) string](#TrimRight) +* [func TrimRightFunc(s string, f func(rune) bool) string](#TrimRightFunc) +* [func TrimSpace(s string) string](#TrimSpace) +* [func TrimSuffix(s, suffix string) string](#TrimSuffix) +* [type Builder](#Builder) +* + [func (b \*Builder) Cap() int](#Builder.Cap) + + [func (b \*Builder) Grow(n int)](#Builder.Grow) + + [func (b \*Builder) Len() int](#Builder.Len) + + [func (b \*Builder) Reset()](#Builder.Reset) + + [func (b \*Builder) String() string](#Builder.String) + + [func (b \*Builder) Write(p []byte) (int, error)](#Builder.Write) + + [func (b \*Builder) WriteByte(c byte) error](#Builder.WriteByte) + + [func (b \*Builder) WriteRune(r rune) (int, error)](#Builder.WriteRune) + + [func (b \*Builder) WriteString(s string) (int, error)](#Builder.WriteString) +* [type Reader](#Reader) +* + [func NewReader(s string) \*Reader](#NewReader) +* + [func (r \*Reader) Len() int](#Reader.Len) + + [func (r \*Reader) Read(b []byte) (n int, err error)](#Reader.Read) + + [func (r \*Reader) ReadAt(b []byte, off int64) (n int, err error)](#Reader.ReadAt) + + [func (r \*Reader) ReadByte() (byte, error)](#Reader.ReadByte) + + [func (r \*Reader) ReadRune() (ch rune, size int, err error)](#Reader.ReadRune) + + [func (r \*Reader) Reset(s string)](#Reader.Reset) + + [func (r \*Reader) Seek(offset int64, whence int) (int64, error)](#Reader.Seek) + + [func (r \*Reader) Size() int64](#Reader.Size) + + [func (r \*Reader) UnreadByte() error](#Reader.UnreadByte) + + [func (r \*Reader) UnreadRune() error](#Reader.UnreadRune) + + [func (r \*Reader) WriteTo(w io.Writer) (n int64, err error)](#Reader.WriteTo) +* [type Replacer](#Replacer) +* + [func NewReplacer(oldnew ...string) \*Replacer](#NewReplacer) +* + [func (r \*Replacer) Replace(s string) string](#Replacer.Replace) + + [func (r \*Replacer) WriteString(w io.Writer, s string) (n int, err error)](#Replacer.WriteString) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Builder](#example-Builder) +* [Compare](#example-Compare) +* [Contains](#example-Contains) +* [ContainsAny](#example-ContainsAny) +* [ContainsRune](#example-ContainsRune) +* [Count](#example-Count) +* [Cut](#example-Cut) +* [EqualFold](#example-EqualFold) +* [Fields](#example-Fields) +* [FieldsFunc](#example-FieldsFunc) +* [HasPrefix](#example-HasPrefix) +* [HasSuffix](#example-HasSuffix) +* [Index](#example-Index) +* [IndexAny](#example-IndexAny) +* [IndexByte](#example-IndexByte) +* [IndexFunc](#example-IndexFunc) +* [IndexRune](#example-IndexRune) +* [Join](#example-Join) +* [LastIndex](#example-LastIndex) +* [LastIndexAny](#example-LastIndexAny) +* [LastIndexByte](#example-LastIndexByte) +* [LastIndexFunc](#example-LastIndexFunc) +* [Map](#example-Map) +* [NewReplacer](#example-NewReplacer) +* [Repeat](#example-Repeat) +* [Replace](#example-Replace) +* [ReplaceAll](#example-ReplaceAll) +* [Split](#example-Split) +* [SplitAfter](#example-SplitAfter) +* [SplitAfterN](#example-SplitAfterN) +* [SplitN](#example-SplitN) +* [Title](#example-Title) +* [ToLower](#example-ToLower) +* [ToLowerSpecial](#example-ToLowerSpecial) +* [ToTitle](#example-ToTitle) +* [ToTitleSpecial](#example-ToTitleSpecial) +* [ToUpper](#example-ToUpper) +* [ToUpperSpecial](#example-ToUpperSpecial) +* [Trim](#example-Trim) +* [TrimFunc](#example-TrimFunc) +* [TrimLeft](#example-TrimLeft) +* [TrimLeftFunc](#example-TrimLeftFunc) +* [TrimPrefix](#example-TrimPrefix) +* [TrimRight](#example-TrimRight) +* [TrimRightFunc](#example-TrimRightFunc) +* [TrimSpace](#example-TrimSpace) +* [TrimSuffix](#example-TrimSuffix) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [Clone](https://cs.opensource.google/go/go/+/go1.20:src/strings/clone.go;l=21) [¶](#Clone "Go to Clone") added in go1.18 + +```None +func Clone(s string) string +``` + +Clone returns a fresh copy of s. +It guarantees to make a copy of s into a new allocation, +which can be important when retaining only a small substring +of a much larger string. Using Clone can help such programs +use less memory. Of course, since using Clone makes a copy, +overuse of Clone can make programs use more memory. +Clone should typically be used only rarely, and only when +profiling indicates that it is needed. +For strings of length zero the string "" will be returned +and no allocation is made. + +#### func [Compare](https://cs.opensource.google/go/go/+/go1.20:src/strings/compare.go;l=13) [¶](#Compare "Go to Compare") added in go1.5 + +```None +func Compare(a, b string) int +``` + +Compare returns an integer comparing two strings lexicographically. +The result will be 0 if a == b, -1 if a < b, and +1 if a > b. + +Compare is included only for symmetry with package bytes. +It is usually clearer and always faster to use the built-in +string comparison operators ==, <, >, and so on. + +Example [¶](#example-Compare "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Compare("a", "b")) + fmt.Println(strings.Compare("a", "a")) + fmt.Println(strings.Compare("b", "a")) +} +``` + +```None +Output: + +-1 +0 +1 +``` + +Share +Format +Run + +#### func [Contains](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=58) [¶](#Contains "Go to Contains") + +```None +func Contains(s, substr string) bool +``` + +Contains reports whether substr is within s. + +Example [¶](#example-Contains "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Contains("seafood", "foo")) + fmt.Println(strings.Contains("seafood", "bar")) + fmt.Println(strings.Contains("seafood", "")) + fmt.Println(strings.Contains("", "")) +} +``` + +```None +Output: + +true +false +true +true +``` + +Share +Format +Run + +#### func [ContainsAny](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=63) [¶](#ContainsAny "Go to ContainsAny") + +```None +func ContainsAny(s, chars string) bool +``` + +ContainsAny reports whether any Unicode code points in chars are within s. + +Example [¶](#example-ContainsAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ContainsAny("team", "i")) + fmt.Println(strings.ContainsAny("fail", "ui")) + fmt.Println(strings.ContainsAny("ure", "ui")) + fmt.Println(strings.ContainsAny("failure", "ui")) + fmt.Println(strings.ContainsAny("foo", "")) + fmt.Println(strings.ContainsAny("", "")) +} +``` + +```None +Output: + +false +true +true +true +false +false +``` + +Share +Format +Run + +#### func [ContainsRune](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=68) [¶](#ContainsRune "Go to ContainsRune") + +```None +func ContainsRune(s string, r rune) bool +``` + +ContainsRune reports whether the Unicode code point r is within s. + +Example [¶](#example-ContainsRune "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Finds whether a string contains a particular Unicode code point. + // The code point for the lowercase letter "a", for example, is 97. + fmt.Println(strings.ContainsRune("aardvark", 97)) + fmt.Println(strings.ContainsRune("timeout", 97)) +} +``` + +```None +Output: + +true +false +``` + +Share +Format +Run + +#### func [Count](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=38) [¶](#Count "Go to Count") + +```None +func Count(s, substr string) int +``` + +Count counts the number of non-overlapping instances of substr in s. +If substr is an empty string, Count returns 1 + the number of Unicode code points in s. + +Example [¶](#example-Count "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Count("cheese", "e")) + fmt.Println(strings.Count("five", "")) // before & after each rune +} +``` + +```None +Output: + +3 +5 +``` + +Share +Format +Run + +#### func [Cut](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=1262) [¶](#Cut "Go to Cut") added in go1.18 + +```None +func Cut(s, sep string) (before, after string, found bool) +``` + +Cut slices s around the first instance of sep, +returning the text before and after sep. +The found result reports whether sep appears in s. +If sep does not appear in s, cut returns s, "", false. + +Example [¶](#example-Cut "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + show := func(s, sep string) { + before, after, found := strings.Cut(s, sep) + fmt.Printf("Cut(%q, %q) = %q, %q, %v\n", s, sep, before, after, found) + } + show("Gopher", "Go") + show("Gopher", "ph") + show("Gopher", "er") + show("Gopher", "Badger") +} +``` + +```None +Output: + +Cut("Gopher", "Go") = "", "pher", true +Cut("Gopher", "ph") = "Go", "er", true +Cut("Gopher", "er") = "Goph", "", true +Cut("Gopher", "Badger") = "Gopher", "", false +``` + +Share +Format +Run + +#### func [CutPrefix](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=1273) [¶](#CutPrefix "Go to CutPrefix") added in go1.20 + +```None +func CutPrefix(s, prefix string) (after string, found bool) +``` + +CutPrefix returns s without the provided leading prefix string +and reports whether it found the prefix. +If s doesn't start with prefix, CutPrefix returns s, false. +If prefix is the empty string, CutPrefix returns s, true. + +#### func [CutSuffix](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=1284) [¶](#CutSuffix "Go to CutSuffix") added in go1.20 + +```None +func CutSuffix(s, suffix string) (before string, found bool) +``` + +CutSuffix returns s without the provided ending suffix string +and reports whether it found the suffix. +If s doesn't end with suffix, CutSuffix returns s, false. +If suffix is the empty string, CutSuffix returns s, true. + +#### func [EqualFold](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=1095) [¶](#EqualFold "Go to EqualFold") + +```None +func EqualFold(s, t string) bool +``` + +EqualFold reports whether s and t, interpreted as UTF-8 strings, +are equal under simple Unicode case-folding, which is a more general +form of case-insensitivity. + +Example [¶](#example-EqualFold "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.EqualFold("Go", "go")) + fmt.Println(strings.EqualFold("AB", "ab")) // true because comparison uses simple case-folding + fmt.Println(strings.EqualFold("ß", "ss")) // false because comparison does not use full case-folding +} +``` + +```None +Output: + +true +true +false +``` + +Share +Format +Run + +#### func [Fields](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=326) [¶](#Fields "Go to Fields") + +```None +func Fields(s string) []string +``` + +Fields splits the string s around each instance of one or more consecutive white space +characters, as defined by unicode.IsSpace, returning a slice of substrings of s or an +empty slice if s contains only white space. + +Example [¶](#example-Fields "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("Fields are: %q", strings.Fields(" foo bar baz ")) +} +``` + +```None +Output: + +Fields are: ["foo" "bar" "baz"] +``` + +Share +Format +Run + +#### func [FieldsFunc](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=381) [¶](#FieldsFunc "Go to FieldsFunc") + +```None +func FieldsFunc(s string, f func(rune) bool) []string +``` + +FieldsFunc splits the string s at each run of Unicode code points c satisfying f(c) +and returns an array of slices of s. If all code points in s satisfy f(c) or the +string is empty, an empty slice is returned. + +FieldsFunc makes no guarantees about the order in which it calls f(c) +and assumes that f always returns the same value for a given c. + +Example [¶](#example-FieldsFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + f := func(c rune) bool { + return !unicode.IsLetter(c) && !unicode.IsNumber(c) + } + fmt.Printf("Fields are: %q", strings.FieldsFunc(" foo1;bar2,baz3...", f)) +} +``` + +```None +Output: + +Fields are: ["foo1" "bar2" "baz3"] +``` + +Share +Format +Run + +#### func [HasPrefix](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=450) [¶](#HasPrefix "Go to HasPrefix") + +```None +func HasPrefix(s, prefix string) bool +``` + +HasPrefix tests whether the string s begins with prefix. + +Example [¶](#example-HasPrefix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.HasPrefix("Gopher", "Go")) + fmt.Println(strings.HasPrefix("Gopher", "C")) + fmt.Println(strings.HasPrefix("Gopher", "")) +} +``` + +```None +Output: + +true +false +true +``` + +Share +Format +Run + +#### func [HasSuffix](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=455) [¶](#HasSuffix "Go to HasSuffix") + +```None +func HasSuffix(s, suffix string) bool +``` + +HasSuffix tests whether the string s ends with suffix. + +Example [¶](#example-HasSuffix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.HasSuffix("Amigo", "go")) + fmt.Println(strings.HasSuffix("Amigo", "O")) + fmt.Println(strings.HasSuffix("Amigo", "Ami")) + fmt.Println(strings.HasSuffix("Amigo", "")) +} +``` + +```None +Output: + +true +false +false +true +``` + +Share +Format +Run + +#### func [Index](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=1178) [¶](#Index "Go to Index") + +```None +func Index(s, substr string) int +``` + +Index returns the index of the first instance of substr in s, or -1 if substr is not present in s. + +Example [¶](#example-Index "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Index("chicken", "ken")) + fmt.Println(strings.Index("chicken", "dmr")) +} +``` + +```None +Output: + +4 +-1 +``` + +Share +Format +Run + +#### func [IndexAny](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=138) [¶](#IndexAny "Go to IndexAny") + +```None +func IndexAny(s, chars string) int +``` + +IndexAny returns the index of the first instance of any Unicode code point +from chars in s, or -1 if no Unicode code point from chars is present in s. + +Example [¶](#example-IndexAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexAny("chicken", "aeiouy")) + fmt.Println(strings.IndexAny("crwth", "aeiouy")) +} +``` + +```None +Output: + +2 +-1 +``` + +Share +Format +Run + +#### func [IndexByte](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=110) [¶](#IndexByte "Go to IndexByte") added in go1.2 + +```None +func IndexByte(s string, c byte) int +``` + +IndexByte returns the index of the first instance of c in s, or -1 if c is not present in s. + +Example [¶](#example-IndexByte "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexByte("golang", 'g')) + fmt.Println(strings.IndexByte("gophers", 'h')) + fmt.Println(strings.IndexByte("golang", 'x')) +} +``` + +```None +Output: + +0 +3 +-1 +``` + +Share +Format +Run + +#### func [IndexFunc](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=814) [¶](#IndexFunc "Go to IndexFunc") + +```None +func IndexFunc(s string, f func(rune) bool) int +``` + +IndexFunc returns the index into s of the first Unicode +code point satisfying f(c), or -1 if none do. + +Example [¶](#example-IndexFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + f := func(c rune) bool { + return unicode.Is(unicode.Han, c) + } + fmt.Println(strings.IndexFunc("Hello, 世界", f)) + fmt.Println(strings.IndexFunc("Hello, world", f)) +} +``` + +```None +Output: + +7 +-1 +``` + +Share +Format +Run + +#### func [IndexRune](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=118) [¶](#IndexRune "Go to IndexRune") + +```None +func IndexRune(s string, r rune) int +``` + +IndexRune returns the index of the first instance of the Unicode code point +r, or -1 if rune is not present in s. +If r is utf8.RuneError, it returns the first instance of any +invalid UTF-8 byte sequence. + +Example [¶](#example-IndexRune "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexRune("chicken", 'k')) + fmt.Println(strings.IndexRune("chicken", 'd')) +} +``` + +```None +Output: + +4 +-1 +``` + +Share +Format +Run + +#### func [Join](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=427) [¶](#Join "Go to Join") + +```None +func Join(elems []string, sep string) string +``` + +Join concatenates the elements of its first argument to create a single string. The separator +string sep is placed between elements in the resulting string. + +Example [¶](#example-Join "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + s := []string{"foo", "bar", "baz"} + fmt.Println(strings.Join(s, ", ")) +} +``` + +```None +Output: + +foo, bar, baz +``` + +Share +Format +Run + +#### func [LastIndex](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=73) [¶](#LastIndex "Go to LastIndex") + +```None +func LastIndex(s, substr string) int +``` + +LastIndex returns the index of the last instance of substr in s, or -1 if substr is not present in s. + +Example [¶](#example-LastIndex "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Index("go gopher", "go")) + fmt.Println(strings.LastIndex("go gopher", "go")) + fmt.Println(strings.LastIndex("go gopher", "rodent")) +} +``` + +```None +Output: + +0 +3 +-1 +``` + +Share +Format +Run + +#### func [LastIndexAny](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=172) [¶](#LastIndexAny "Go to LastIndexAny") + +```None +func LastIndexAny(s, chars string) int +``` + +LastIndexAny returns the index of the last instance of any Unicode code +point from chars in s, or -1 if no Unicode code point from chars is +present in s. + +Example [¶](#example-LastIndexAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.LastIndexAny("go gopher", "go")) + fmt.Println(strings.LastIndexAny("go gopher", "rodent")) + fmt.Println(strings.LastIndexAny("go gopher", "fail")) +} +``` + +```None +Output: + +4 +8 +-1 +``` + +Share +Format +Run + +#### func [LastIndexByte](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=222) [¶](#LastIndexByte "Go to LastIndexByte") added in go1.5 + +```None +func LastIndexByte(s string, c byte) int +``` + +LastIndexByte returns the index of the last instance of c in s, or -1 if c is not present in s. + +Example [¶](#example-LastIndexByte "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.LastIndexByte("Hello, world", 'l')) + fmt.Println(strings.LastIndexByte("Hello, world", 'o')) + fmt.Println(strings.LastIndexByte("Hello, world", 'x')) +} +``` + +```None +Output: + +10 +8 +-1 +``` + +Share +Format +Run + +#### func [LastIndexFunc](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=820) [¶](#LastIndexFunc "Go to LastIndexFunc") + +```None +func LastIndexFunc(s string, f func(rune) bool) int +``` + +LastIndexFunc returns the index into s of the last +Unicode code point satisfying f(c), or -1 if none do. + +Example [¶](#example-LastIndexFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.LastIndexFunc("go 123", unicode.IsNumber)) + fmt.Println(strings.LastIndexFunc("123 go", unicode.IsNumber)) + fmt.Println(strings.LastIndexFunc("go", unicode.IsNumber)) +} +``` + +```None +Output: + +5 +2 +-1 +``` + +Share +Format +Run + +#### func [Map](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=462) [¶](#Map "Go to Map") + +```None +func Map(mapping func(rune) rune, s string) string +``` + +Map returns a copy of the string s with all its characters modified +according to the mapping function. If mapping returns a negative value, the character is +dropped from the string with no replacement. + +Example [¶](#example-Map "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + rot13 := func(r rune) rune { + switch { + case r >= 'A' && r <= 'Z': + return 'A' + (r-'A'+13)%26 + case r >= 'a' && r <= 'z': + return 'a' + (r-'a'+13)%26 + } + return r + } + fmt.Println(strings.Map(rot13, "'Twas brillig and the slithy gopher...")) +} +``` + +```None +Output: + +'Gjnf oevyyvt naq gur fyvgul tbcure... +``` + +Share +Format +Run + +#### func [Repeat](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=525) [¶](#Repeat "Go to Repeat") + +```None +func Repeat(s string, count int) string +``` + +Repeat returns a new string consisting of count copies of the string s. + +It panics if count is negative or if the result of (len(s) \* count) +overflows. + +Example [¶](#example-Repeat "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println("ba" + strings.Repeat("na", 2)) +} +``` + +```None +Output: + +banana +``` + +Share +Format +Run + +#### func [Replace](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=1049) [¶](#Replace "Go to Replace") + +```None +func Replace(s, old, new string, n int) string +``` + +Replace returns a copy of the string s with the first n +non-overlapping instances of old replaced by new. +If old is empty, it matches at the beginning of the string +and after each UTF-8 sequence, yielding up to k+1 replacements +for a k-rune string. +If n < 0, there is no limit on the number of replacements. + +Example [¶](#example-Replace "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Replace("oink oink oink", "k", "ky", 2)) + fmt.Println(strings.Replace("oink oink oink", "oink", "moo", -1)) +} +``` + +```None +Output: + +oinky oinky oink +moo moo moo +``` + +Share +Format +Run + +#### func [ReplaceAll](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=1088) [¶](#ReplaceAll "Go to ReplaceAll") added in go1.12 + +```None +func ReplaceAll(s, old, new string) string +``` + +ReplaceAll returns a copy of the string s with all +non-overlapping instances of old replaced by new. +If old is empty, it matches at the beginning of the string +and after each UTF-8 sequence, yielding up to k+1 replacements +for a k-rune string. + +Example [¶](#example-ReplaceAll "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ReplaceAll("oink oink oink", "oink", "moo")) +} +``` + +```None +Output: + +moo moo moo +``` + +Share +Format +Run + +#### func [Split](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=305) [¶](#Split "Go to Split") + +```None +func Split(s, sep string) []string +``` + +Split slices s into all substrings separated by sep and returns a slice of +the substrings between those separators. + +If s does not contain sep and sep is not empty, Split returns a +slice of length 1 whose only element is s. + +If sep is empty, Split splits after each UTF-8 sequence. If both s +and sep are empty, Split returns an empty slice. + +It is equivalent to SplitN with a count of -1. + +To split around the first instance of a separator, see Cut. + +Example [¶](#example-Split "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.Split("a,b,c", ",")) + fmt.Printf("%q\n", strings.Split("a man a plan a canal panama", "a ")) + fmt.Printf("%q\n", strings.Split(" xyz ", "")) + fmt.Printf("%q\n", strings.Split("", "Bernardo O'Higgins")) +} +``` + +```None +Output: + +["a" "b" "c"] +["" "man " "plan " "canal panama"] +[" " "x" "y" "z" " "] +[""] +``` + +Share +Format +Run + +#### func [SplitAfter](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=317) [¶](#SplitAfter "Go to SplitAfter") + +```None +func SplitAfter(s, sep string) []string +``` + +SplitAfter slices s into all substrings after each instance of sep and +returns a slice of those substrings. + +If s does not contain sep and sep is not empty, SplitAfter returns +a slice of length 1 whose only element is s. + +If sep is empty, SplitAfter splits after each UTF-8 sequence. If +both s and sep are empty, SplitAfter returns an empty slice. + +It is equivalent to SplitAfterN with a count of -1. + +Example [¶](#example-SplitAfter "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitAfter("a,b,c", ",")) +} +``` + +```None +Output: + +["a," "b," "c"] +``` + +Share +Format +Run + +#### func [SplitAfterN](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=289) [¶](#SplitAfterN "Go to SplitAfterN") + +```None +func SplitAfterN(s, sep string, n int) []string +``` + +SplitAfterN slices s into substrings after each instance of sep and +returns a slice of those substrings. + +The count determines the number of substrings to return: + +```None +n > 0: at most n substrings; the last substring will be the unsplit remainder. +n == 0: the result is nil (zero substrings) +n < 0: all substrings +``` + +Edge cases for s and sep (for example, empty strings) are handled +as described in the documentation for SplitAfter. + +Example [¶](#example-SplitAfterN "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitAfterN("a,b,c", ",", 2)) +} +``` + +```None +Output: + +["a," "b,c"] +``` + +Share +Format +Run + +#### func [SplitN](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=276) [¶](#SplitN "Go to SplitN") + +```None +func SplitN(s, sep string, n int) []string +``` + +SplitN slices s into substrings separated by sep and returns a slice of +the substrings between those separators. + +The count determines the number of substrings to return: + +```None +n > 0: at most n substrings; the last substring will be the unsplit remainder. +n == 0: the result is nil (zero substrings) +n < 0: all substrings +``` + +Edge cases for s and sep (for example, empty strings) are handled +as described in the documentation for Split. + +To split around the first instance of a separator, see Cut. + +Example [¶](#example-SplitN "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitN("a,b,c", ",", 2)) + z := strings.SplitN("a,b,c", ",", 0) + fmt.Printf("%q (nil = %v)\n", z, z == nil) +} +``` + +```None +Output: + +["a" "b,c"] +[] (nil = true) +``` + +Share +Format +Run + +#### func [Title](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=766) deprecated + +```None +func Title(s string) string +``` + +Title returns a copy of the string s with all Unicode letters that begin words +mapped to their Unicode title case. + +Deprecated: The rule Title uses for word boundaries does not handle Unicode +punctuation properly. Use golang.org/x/text/cases instead. + +Example [¶](#example-Title "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Compare this example to the ToTitle example. + fmt.Println(strings.Title("her royal highness")) + fmt.Println(strings.Title("loud noises")) + fmt.Println(strings.Title("хлеб")) +} +``` + +```None +Output: + +Her Royal Highness +Loud Noises +Хлеб +``` + +Share +Format +Run + +#### func [ToLower](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=625) [¶](#ToLower "Go to ToLower") + +```None +func ToLower(s string) string +``` + +ToLower returns s with all Unicode letters mapped to their lower case. + +Example [¶](#example-ToLower "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ToLower("Gopher")) +} +``` + +```None +Output: + +gopher +``` + +Share +Format +Run + +#### func [ToLowerSpecial](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=676) [¶](#ToLowerSpecial "Go to ToLowerSpecial") + +```None +func ToLowerSpecial(c unicode.SpecialCase, s string) string +``` + +ToLowerSpecial returns a copy of the string s with all Unicode letters mapped to their +lower case using the case mapping specified by c. + +Example [¶](#example-ToLowerSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToLowerSpecial(unicode.TurkishCase, "Önnek İş")) +} +``` + +```None +Output: + +önnek iş +``` + +Share +Format +Run + +#### func [ToTitle](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=666) [¶](#ToTitle "Go to ToTitle") + +```None +func ToTitle(s string) string +``` + +ToTitle returns a copy of the string s with all Unicode letters mapped to +their Unicode title case. + +Example [¶](#example-ToTitle "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Compare this example to the Title example. + fmt.Println(strings.ToTitle("her royal highness")) + fmt.Println(strings.ToTitle("loud noises")) + fmt.Println(strings.ToTitle("хлеб")) +} +``` + +```None +Output: + +HER ROYAL HIGHNESS +LOUD NOISES +ХЛЕБ +``` + +Share +Format +Run + +#### func [ToTitleSpecial](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=682) [¶](#ToTitleSpecial "Go to ToTitleSpecial") + +```None +func ToTitleSpecial(c unicode.SpecialCase, s string) string +``` + +ToTitleSpecial returns a copy of the string s with all Unicode letters mapped to their +Unicode title case, giving priority to the special casing rules. + +Example [¶](#example-ToTitleSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToTitleSpecial(unicode.TurkishCase, "dünyanın ilk borsa yapısı Aizonai kabul edilir")) +} +``` + +```None +Output: + +DÜNYANIN İLK BORSA YAPISI AİZONAİ KABUL EDİLİR +``` + +Share +Format +Run + +#### func [ToUpper](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=585) [¶](#ToUpper "Go to ToUpper") + +```None +func ToUpper(s string) string +``` + +ToUpper returns s with all Unicode letters mapped to their upper case. + +Example [¶](#example-ToUpper "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ToUpper("Gopher")) +} +``` + +```None +Output: + +GOPHER +``` + +Share +Format +Run + +#### func [ToUpperSpecial](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=670) [¶](#ToUpperSpecial "Go to ToUpperSpecial") + +```None +func ToUpperSpecial(c unicode.SpecialCase, s string) string +``` + +ToUpperSpecial returns a copy of the string s with all Unicode letters mapped to their +upper case using the case mapping specified by c. + +Example [¶](#example-ToUpperSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToUpperSpecial(unicode.TurkishCase, "örnek iş")) +} +``` + +```None +Output: + +ÖRNEK İŞ +``` + +Share +Format +Run + +#### func [ToValidUTF8](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=688) [¶](#ToValidUTF8 "Go to ToValidUTF8") added in go1.13 + +```None +func ToValidUTF8(s, replacement string) string +``` + +ToValidUTF8 returns a copy of the string s with each run of invalid UTF-8 byte sequences +replaced by the replacement string, which may be empty. + +#### func [Trim](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=880) [¶](#Trim "Go to Trim") + +```None +func Trim(s, cutset string) string +``` + +Trim returns a slice of the string s with all leading and +trailing Unicode code points contained in cutset removed. + +Example [¶](#example-Trim "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.Trim("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimFunc](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=808) [¶](#TrimFunc "Go to TrimFunc") + +```None +func TrimFunc(s string, f func(rune) bool) string +``` + +TrimFunc returns a slice of the string s with all leading +and trailing Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimLeft](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=897) [¶](#TrimLeft "Go to TrimLeft") + +```None +func TrimLeft(s, cutset string) string +``` + +TrimLeft returns a slice of the string s with all leading +Unicode code points contained in cutset removed. + +To remove a prefix, use TrimPrefix instead. + +Example [¶](#example-TrimLeft "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.TrimLeft("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +Hello, Gophers!!! +``` + +Share +Format +Run + +#### func [TrimLeftFunc](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=785) [¶](#TrimLeftFunc "Go to TrimLeftFunc") + +```None +func TrimLeftFunc(s string, f func(rune) bool) string +``` + +TrimLeftFunc returns a slice of the string s with all leading +Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimLeftFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimLeftFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +Hello, Gophers!!! +``` + +Share +Format +Run + +#### func [TrimPrefix](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=1027) [¶](#TrimPrefix "Go to TrimPrefix") added in go1.1 + +```None +func TrimPrefix(s, prefix string) string +``` + +TrimPrefix returns s without the provided leading prefix string. +If s doesn't start with prefix, s is returned unchanged. + +Example [¶](#example-TrimPrefix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var s = "¡¡¡Hello, Gophers!!!" + s = strings.TrimPrefix(s, "¡¡¡Hello, ") + s = strings.TrimPrefix(s, "¡¡¡Howdy, ") + fmt.Print(s) +} +``` + +```None +Output: + +Gophers!!! +``` + +Share +Format +Run + +#### func [TrimRight](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=945) [¶](#TrimRight "Go to TrimRight") + +```None +func TrimRight(s, cutset string) string +``` + +TrimRight returns a slice of the string s, with all trailing +Unicode code points contained in cutset removed. + +To remove a suffix, use TrimSuffix instead. + +Example [¶](#example-TrimRight "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.TrimRight("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +¡¡¡Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimRightFunc](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=795) [¶](#TrimRightFunc "Go to TrimRightFunc") + +```None +func TrimRightFunc(s string, f func(rune) bool) string +``` + +TrimRightFunc returns a slice of the string s with all trailing +Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimRightFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimRightFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +¡¡¡Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimSpace](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=991) [¶](#TrimSpace "Go to TrimSpace") + +```None +func TrimSpace(s string) string +``` + +TrimSpace returns a slice of the string s, with all leading +and trailing white space removed, as defined by Unicode. + +Example [¶](#example-TrimSpace "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.TrimSpace(" \t\n Hello, Gophers \n\t\r\n")) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimSuffix](https://cs.opensource.google/go/go/+/go1.20:src/strings/strings.go;l=1036) [¶](#TrimSuffix "Go to TrimSuffix") added in go1.1 + +```None +func TrimSuffix(s, suffix string) string +``` + +TrimSuffix returns s without the provided trailing suffix string. +If s doesn't end with suffix, s is returned unchanged. + +Example [¶](#example-TrimSuffix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var s = "¡¡¡Hello, Gophers!!!" + s = strings.TrimSuffix(s, ", Gophers!!!") + s = strings.TrimSuffix(s, ", Marmots!!!") + fmt.Print(s) +} +``` + +```None +Output: + +¡¡¡Hello +``` + +Share +Format +Run + +### Types [¶](#pkg-types "Go to Types") + +#### type [Builder](https://cs.opensource.google/go/go/+/go1.20:src/strings/builder.go;l=15) [¶](#Builder "Go to Builder") added in go1.10 + +```None +type Builder struct { + // contains filtered or unexported fields +} +``` + +A Builder is used to efficiently build a string using Write methods. +It minimizes memory copying. The zero value is ready to use. +Do not copy a non-zero Builder. + +Example [¶](#example-Builder "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var b strings.Builder + for i := 3; i >= 1; i-- { + fmt.Fprintf(&b, "%d...", i) + } + b.WriteString("ignition") + fmt.Println(b.String()) + +} +``` + +```None +Output: + +3...2...1...ignition +``` + +Share +Format +Run + +#### func (\*Builder) [Cap](https://cs.opensource.google/go/go/+/go1.20:src/strings/builder.go;l=57) [¶](#Builder.Cap "Go to Builder.Cap") added in go1.12 + +```None +func (b *Builder) Cap() int +``` + +Cap returns the capacity of the builder's underlying byte slice. It is the +total space allocated for the string being built and includes any bytes +already written. + +#### func (\*Builder) [Grow](https://cs.opensource.google/go/go/+/go1.20:src/strings/builder.go;l=76) [¶](#Builder.Grow "Go to Builder.Grow") added in go1.10 + +```None +func (b *Builder) Grow(n int) +``` + +Grow grows b's capacity, if necessary, to guarantee space for +another n bytes. After Grow(n), at least n bytes can be written to b +without another allocation. If n is negative, Grow panics. + +#### func (\*Builder) [Len](https://cs.opensource.google/go/go/+/go1.20:src/strings/builder.go;l=52) [¶](#Builder.Len "Go to Builder.Len") added in go1.10 + +```None +func (b *Builder) Len() int +``` + +Len returns the number of accumulated bytes; b.Len() == len(b.String()). + +#### func (\*Builder) [Reset](https://cs.opensource.google/go/go/+/go1.20:src/strings/builder.go;l=60) [¶](#Builder.Reset "Go to Builder.Reset") added in go1.10 + +```None +func (b *Builder) Reset() +``` + +Reset resets the Builder to be empty. + +#### func (\*Builder) [String](https://cs.opensource.google/go/go/+/go1.20:src/strings/builder.go;l=47) [¶](#Builder.String "Go to Builder.String") added in go1.10 + +```None +func (b *Builder) String() string +``` + +String returns the accumulated string. + +#### func (\*Builder) [Write](https://cs.opensource.google/go/go/+/go1.20:src/strings/builder.go;l=88) [¶](#Builder.Write "Go to Builder.Write") added in go1.10 + +```None +func (b *Builder) Write(p []byte) (int, error) +``` + +Write appends the contents of p to b's buffer. +Write always returns len(p), nil. + +#### func (\*Builder) [WriteByte](https://cs.opensource.google/go/go/+/go1.20:src/strings/builder.go;l=96) [¶](#Builder.WriteByte "Go to Builder.WriteByte") added in go1.10 + +```None +func (b *Builder) WriteByte(c byte) error +``` + +WriteByte appends the byte c to b's buffer. +The returned error is always nil. + +#### func (\*Builder) [WriteRune](https://cs.opensource.google/go/go/+/go1.20:src/strings/builder.go;l=104) [¶](#Builder.WriteRune "Go to Builder.WriteRune") added in go1.10 + +```None +func (b *Builder) WriteRune(r rune) (int, error) +``` + +WriteRune appends the UTF-8 encoding of Unicode code point r to b's buffer. +It returns the length of r and a nil error. + +#### func (\*Builder) [WriteString](https://cs.opensource.google/go/go/+/go1.20:src/strings/builder.go;l=113) [¶](#Builder.WriteString "Go to Builder.WriteString") added in go1.10 + +```None +func (b *Builder) WriteString(s string) (int, error) +``` + +WriteString appends the contents of s to b's buffer. +It returns the length of s and a nil error. + +#### type [Reader](https://cs.opensource.google/go/go/+/go1.20:src/strings/reader.go;l=17) [¶](#Reader "Go to Reader") + +```None +type Reader struct { + // contains filtered or unexported fields +} +``` + +A Reader implements the io.Reader, io.ReaderAt, io.ByteReader, io.ByteScanner, +io.RuneReader, io.RuneScanner, io.Seeker, and io.WriterTo interfaces by reading +from a string. +The zero value for Reader operates like a Reader of an empty string. + +#### func [NewReader](https://cs.opensource.google/go/go/+/go1.20:src/strings/reader.go;l=160) [¶](#NewReader "Go to NewReader") + +```None +func NewReader(s string) *Reader +``` + +NewReader returns a new Reader reading from s. +It is similar to bytes.NewBufferString but more efficient and read-only. + +#### func (\*Reader) [Len](https://cs.opensource.google/go/go/+/go1.20:src/strings/reader.go;l=25) [¶](#Reader.Len "Go to Reader.Len") + +```None +func (r *Reader) Len() int +``` + +Len returns the number of bytes of the unread portion of the +string. + +#### func (\*Reader) [Read](https://cs.opensource.google/go/go/+/go1.20:src/strings/reader.go;l=39) [¶](#Reader.Read "Go to Reader.Read") + +```None +func (r *Reader) Read(b []byte) (n int, err error) +``` + +Read implements the io.Reader interface. + +#### func (\*Reader) [ReadAt](https://cs.opensource.google/go/go/+/go1.20:src/strings/reader.go;l=50) [¶](#Reader.ReadAt "Go to Reader.ReadAt") + +```None +func (r *Reader) ReadAt(b []byte, off int64) (n int, err error) +``` + +ReadAt implements the io.ReaderAt interface. + +#### func (\*Reader) [ReadByte](https://cs.opensource.google/go/go/+/go1.20:src/strings/reader.go;l=66) [¶](#Reader.ReadByte "Go to Reader.ReadByte") + +```None +func (r *Reader) ReadByte() (byte, error) +``` + +ReadByte implements the io.ByteReader interface. + +#### func (\*Reader) [ReadRune](https://cs.opensource.google/go/go/+/go1.20:src/strings/reader.go;l=87) [¶](#Reader.ReadRune "Go to Reader.ReadRune") + +```None +func (r *Reader) ReadRune() (ch rune, size int, err error) +``` + +ReadRune implements the io.RuneReader interface. + +#### func (\*Reader) [Reset](https://cs.opensource.google/go/go/+/go1.20:src/strings/reader.go;l=156) [¶](#Reader.Reset "Go to Reader.Reset") added in go1.7 + +```None +func (r *Reader) Reset(s string) +``` + +Reset resets the Reader to be reading from s. + +#### func (\*Reader) [Seek](https://cs.opensource.google/go/go/+/go1.20:src/strings/reader.go;l=116) [¶](#Reader.Seek "Go to Reader.Seek") + +```None +func (r *Reader) Seek(offset int64, whence int) (int64, error) +``` + +Seek implements the io.Seeker interface. + +#### func (\*Reader) [Size](https://cs.opensource.google/go/go/+/go1.20:src/strings/reader.go;l=36) [¶](#Reader.Size "Go to Reader.Size") added in go1.5 + +```None +func (r *Reader) Size() int64 +``` + +Size returns the original length of the underlying string. +Size is the number of bytes available for reading via ReadAt. +The returned value is always the same and is not affected by calls +to any other method. + +#### func (\*Reader) [UnreadByte](https://cs.opensource.google/go/go/+/go1.20:src/strings/reader.go;l=77) [¶](#Reader.UnreadByte "Go to Reader.UnreadByte") + +```None +func (r *Reader) UnreadByte() error +``` + +UnreadByte implements the io.ByteScanner interface. + +#### func (\*Reader) [UnreadRune](https://cs.opensource.google/go/go/+/go1.20:src/strings/reader.go;l=103) [¶](#Reader.UnreadRune "Go to Reader.UnreadRune") + +```None +func (r *Reader) UnreadRune() error +``` + +UnreadRune implements the io.RuneScanner interface. + +#### func (\*Reader) [WriteTo](https://cs.opensource.google/go/go/+/go1.20:src/strings/reader.go;l=137) [¶](#Reader.WriteTo "Go to Reader.WriteTo") added in go1.1 + +```None +func (r *Reader) WriteTo(w io.Writer) (n int64, err error) +``` + +WriteTo implements the io.WriterTo interface. + +#### type [Replacer](https://cs.opensource.google/go/go/+/go1.20:src/strings/replace.go;l=14) [¶](#Replacer "Go to Replacer") + +```None +type Replacer struct { + // contains filtered or unexported fields +} +``` + +Replacer replaces a list of strings with replacements. +It is safe for concurrent use by multiple goroutines. + +#### func [NewReplacer](https://cs.opensource.google/go/go/+/go1.20:src/strings/replace.go;l=32) [¶](#NewReplacer "Go to NewReplacer") + +```None +func NewReplacer(oldnew ...string) *Replacer +``` + +NewReplacer returns a new Replacer from a list of old, new string +pairs. Replacements are performed in the order they appear in the +target string, without overlapping matches. The old string +comparisons are done in argument order. + +NewReplacer panics if given an odd number of arguments. + +Example [¶](#example-NewReplacer "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + r := strings.NewReplacer("<", "<", ">", ">") + fmt.Println(r.Replace("This is HTML!")) +} +``` + +```None +Output: + +This is <b>HTML</b>! +``` + +Share +Format +Run + +#### func (\*Replacer) [Replace](https://cs.opensource.google/go/go/+/go1.20:src/strings/replace.go;l=95) [¶](#Replacer.Replace "Go to Replacer.Replace") + +```None +func (r *Replacer) Replace(s string) string +``` + +Replace returns a copy of s with all replacements performed. + +#### func (\*Replacer) [WriteString](https://cs.opensource.google/go/go/+/go1.20:src/strings/replace.go;l=101) [¶](#Replacer.WriteString "Go to Replacer.WriteString") + +```None +func (r *Replacer) WriteString(w io.Writer, s string) (n int, err error) +``` + +WriteString writes s to w with all replacements performed. diff --git a/corpus/docs/golang/strings/strings_go1210.md b/corpus/docs/golang/strings/strings_go1210.md new file mode 100644 index 0000000000000000000000000000000000000000..62cc026bb4cc5fa206cd87a40eea0714701a8ba0 --- /dev/null +++ b/corpus/docs/golang/strings/strings_go1210.md @@ -0,0 +1,2367 @@ +# Golang - strings + +Source: https://pkg.go.dev/strings@go1.21.0 +Version: go1.21.0 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package strings implements simple functions to manipulate UTF-8 encoded strings. + +For information about UTF-8 strings in Go, see . + +### Index [¶](#pkg-index "Go to Index") + +* [func Clone(s string) string](#Clone) +* [func Compare(a, b string) int](#Compare) +* [func Contains(s, substr string) bool](#Contains) +* [func ContainsAny(s, chars string) bool](#ContainsAny) +* [func ContainsFunc(s string, f func(rune) bool) bool](#ContainsFunc) +* [func ContainsRune(s string, r rune) bool](#ContainsRune) +* [func Count(s, substr string) int](#Count) +* [func Cut(s, sep string) (before, after string, found bool)](#Cut) +* [func CutPrefix(s, prefix string) (after string, found bool)](#CutPrefix) +* [func CutSuffix(s, suffix string) (before string, found bool)](#CutSuffix) +* [func EqualFold(s, t string) bool](#EqualFold) +* [func Fields(s string) []string](#Fields) +* [func FieldsFunc(s string, f func(rune) bool) []string](#FieldsFunc) +* [func HasPrefix(s, prefix string) bool](#HasPrefix) +* [func HasSuffix(s, suffix string) bool](#HasSuffix) +* [func Index(s, substr string) int](#Index) +* [func IndexAny(s, chars string) int](#IndexAny) +* [func IndexByte(s string, c byte) int](#IndexByte) +* [func IndexFunc(s string, f func(rune) bool) int](#IndexFunc) +* [func IndexRune(s string, r rune) int](#IndexRune) +* [func Join(elems []string, sep string) string](#Join) +* [func LastIndex(s, substr string) int](#LastIndex) +* [func LastIndexAny(s, chars string) int](#LastIndexAny) +* [func LastIndexByte(s string, c byte) int](#LastIndexByte) +* [func LastIndexFunc(s string, f func(rune) bool) int](#LastIndexFunc) +* [func Map(mapping func(rune) rune, s string) string](#Map) +* [func Repeat(s string, count int) string](#Repeat) +* [func Replace(s, old, new string, n int) string](#Replace) +* [func ReplaceAll(s, old, new string) string](#ReplaceAll) +* [func Split(s, sep string) []string](#Split) +* [func SplitAfter(s, sep string) []string](#SplitAfter) +* [func SplitAfterN(s, sep string, n int) []string](#SplitAfterN) +* [func SplitN(s, sep string, n int) []string](#SplitN) +* [func Title(s string) string](#Title)deprecated +* [func ToLower(s string) string](#ToLower) +* [func ToLowerSpecial(c unicode.SpecialCase, s string) string](#ToLowerSpecial) +* [func ToTitle(s string) string](#ToTitle) +* [func ToTitleSpecial(c unicode.SpecialCase, s string) string](#ToTitleSpecial) +* [func ToUpper(s string) string](#ToUpper) +* [func ToUpperSpecial(c unicode.SpecialCase, s string) string](#ToUpperSpecial) +* [func ToValidUTF8(s, replacement string) string](#ToValidUTF8) +* [func Trim(s, cutset string) string](#Trim) +* [func TrimFunc(s string, f func(rune) bool) string](#TrimFunc) +* [func TrimLeft(s, cutset string) string](#TrimLeft) +* [func TrimLeftFunc(s string, f func(rune) bool) string](#TrimLeftFunc) +* [func TrimPrefix(s, prefix string) string](#TrimPrefix) +* [func TrimRight(s, cutset string) string](#TrimRight) +* [func TrimRightFunc(s string, f func(rune) bool) string](#TrimRightFunc) +* [func TrimSpace(s string) string](#TrimSpace) +* [func TrimSuffix(s, suffix string) string](#TrimSuffix) +* [type Builder](#Builder) +* + [func (b \*Builder) Cap() int](#Builder.Cap) + + [func (b \*Builder) Grow(n int)](#Builder.Grow) + + [func (b \*Builder) Len() int](#Builder.Len) + + [func (b \*Builder) Reset()](#Builder.Reset) + + [func (b \*Builder) String() string](#Builder.String) + + [func (b \*Builder) Write(p []byte) (int, error)](#Builder.Write) + + [func (b \*Builder) WriteByte(c byte) error](#Builder.WriteByte) + + [func (b \*Builder) WriteRune(r rune) (int, error)](#Builder.WriteRune) + + [func (b \*Builder) WriteString(s string) (int, error)](#Builder.WriteString) +* [type Reader](#Reader) +* + [func NewReader(s string) \*Reader](#NewReader) +* + [func (r \*Reader) Len() int](#Reader.Len) + + [func (r \*Reader) Read(b []byte) (n int, err error)](#Reader.Read) + + [func (r \*Reader) ReadAt(b []byte, off int64) (n int, err error)](#Reader.ReadAt) + + [func (r \*Reader) ReadByte() (byte, error)](#Reader.ReadByte) + + [func (r \*Reader) ReadRune() (ch rune, size int, err error)](#Reader.ReadRune) + + [func (r \*Reader) Reset(s string)](#Reader.Reset) + + [func (r \*Reader) Seek(offset int64, whence int) (int64, error)](#Reader.Seek) + + [func (r \*Reader) Size() int64](#Reader.Size) + + [func (r \*Reader) UnreadByte() error](#Reader.UnreadByte) + + [func (r \*Reader) UnreadRune() error](#Reader.UnreadRune) + + [func (r \*Reader) WriteTo(w io.Writer) (n int64, err error)](#Reader.WriteTo) +* [type Replacer](#Replacer) +* + [func NewReplacer(oldnew ...string) \*Replacer](#NewReplacer) +* + [func (r \*Replacer) Replace(s string) string](#Replacer.Replace) + + [func (r \*Replacer) WriteString(w io.Writer, s string) (n int, err error)](#Replacer.WriteString) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Builder](#example-Builder) +* [Clone](#example-Clone) +* [Compare](#example-Compare) +* [Contains](#example-Contains) +* [ContainsAny](#example-ContainsAny) +* [ContainsRune](#example-ContainsRune) +* [Count](#example-Count) +* [Cut](#example-Cut) +* [CutPrefix](#example-CutPrefix) +* [CutSuffix](#example-CutSuffix) +* [EqualFold](#example-EqualFold) +* [Fields](#example-Fields) +* [FieldsFunc](#example-FieldsFunc) +* [HasPrefix](#example-HasPrefix) +* [HasSuffix](#example-HasSuffix) +* [Index](#example-Index) +* [IndexAny](#example-IndexAny) +* [IndexByte](#example-IndexByte) +* [IndexFunc](#example-IndexFunc) +* [IndexRune](#example-IndexRune) +* [Join](#example-Join) +* [LastIndex](#example-LastIndex) +* [LastIndexAny](#example-LastIndexAny) +* [LastIndexByte](#example-LastIndexByte) +* [LastIndexFunc](#example-LastIndexFunc) +* [Map](#example-Map) +* [NewReplacer](#example-NewReplacer) +* [Repeat](#example-Repeat) +* [Replace](#example-Replace) +* [ReplaceAll](#example-ReplaceAll) +* [Split](#example-Split) +* [SplitAfter](#example-SplitAfter) +* [SplitAfterN](#example-SplitAfterN) +* [SplitN](#example-SplitN) +* [Title](#example-Title) +* [ToLower](#example-ToLower) +* [ToLowerSpecial](#example-ToLowerSpecial) +* [ToTitle](#example-ToTitle) +* [ToTitleSpecial](#example-ToTitleSpecial) +* [ToUpper](#example-ToUpper) +* [ToUpperSpecial](#example-ToUpperSpecial) +* [ToValidUTF8](#example-ToValidUTF8) +* [Trim](#example-Trim) +* [TrimFunc](#example-TrimFunc) +* [TrimLeft](#example-TrimLeft) +* [TrimLeftFunc](#example-TrimLeftFunc) +* [TrimPrefix](#example-TrimPrefix) +* [TrimRight](#example-TrimRight) +* [TrimRightFunc](#example-TrimRightFunc) +* [TrimSpace](#example-TrimSpace) +* [TrimSuffix](#example-TrimSuffix) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [Clone](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/clone.go;l=21) [¶](#Clone "Go to Clone") added in go1.18 + +```None +func Clone(s string) string +``` + +Clone returns a fresh copy of s. +It guarantees to make a copy of s into a new allocation, +which can be important when retaining only a small substring +of a much larger string. Using Clone can help such programs +use less memory. Of course, since using Clone makes a copy, +overuse of Clone can make programs use more memory. +Clone should typically be used only rarely, and only when +profiling indicates that it is needed. +For strings of length zero the string "" will be returned +and no allocation is made. + +Example [¶](#example-Clone "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unsafe" +) + +func main() { + s := "abc" + clone := strings.Clone(s) + fmt.Println(s == clone) + fmt.Println(unsafe.StringData(s) == unsafe.StringData(clone)) +} +``` + +```None +Output: + +true +false +``` + +Share +Format +Run + +#### func [Compare](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/compare.go;l=13) [¶](#Compare "Go to Compare") added in go1.5 + +```None +func Compare(a, b string) int +``` + +Compare returns an integer comparing two strings lexicographically. +The result will be 0 if a == b, -1 if a < b, and +1 if a > b. + +Compare is included only for symmetry with package bytes. +It is usually clearer and always faster to use the built-in +string comparison operators ==, <, >, and so on. + +Example [¶](#example-Compare "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Compare("a", "b")) + fmt.Println(strings.Compare("a", "a")) + fmt.Println(strings.Compare("b", "a")) +} +``` + +```None +Output: + +-1 +0 +1 +``` + +Share +Format +Run + +#### func [Contains](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=60) [¶](#Contains "Go to Contains") + +```None +func Contains(s, substr string) bool +``` + +Contains reports whether substr is within s. + +Example [¶](#example-Contains "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Contains("seafood", "foo")) + fmt.Println(strings.Contains("seafood", "bar")) + fmt.Println(strings.Contains("seafood", "")) + fmt.Println(strings.Contains("", "")) +} +``` + +```None +Output: + +true +false +true +true +``` + +Share +Format +Run + +#### func [ContainsAny](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=65) [¶](#ContainsAny "Go to ContainsAny") + +```None +func ContainsAny(s, chars string) bool +``` + +ContainsAny reports whether any Unicode code points in chars are within s. + +Example [¶](#example-ContainsAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ContainsAny("team", "i")) + fmt.Println(strings.ContainsAny("fail", "ui")) + fmt.Println(strings.ContainsAny("ure", "ui")) + fmt.Println(strings.ContainsAny("failure", "ui")) + fmt.Println(strings.ContainsAny("foo", "")) + fmt.Println(strings.ContainsAny("", "")) +} +``` + +```None +Output: + +false +true +true +true +false +false +``` + +Share +Format +Run + +#### func [ContainsFunc](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=75) [¶](#ContainsFunc "Go to ContainsFunc") added in go1.21.0 + +```None +func ContainsFunc(s string, f func(rune) bool) bool +``` + +ContainsFunc reports whether any Unicode code points r within s satisfy f(r). + +#### func [ContainsRune](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=70) [¶](#ContainsRune "Go to ContainsRune") + +```None +func ContainsRune(s string, r rune) bool +``` + +ContainsRune reports whether the Unicode code point r is within s. + +Example [¶](#example-ContainsRune "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Finds whether a string contains a particular Unicode code point. + // The code point for the lowercase letter "a", for example, is 97. + fmt.Println(strings.ContainsRune("aardvark", 97)) + fmt.Println(strings.ContainsRune("timeout", 97)) +} +``` + +```None +Output: + +true +false +``` + +Share +Format +Run + +#### func [Count](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=40) [¶](#Count "Go to Count") + +```None +func Count(s, substr string) int +``` + +Count counts the number of non-overlapping instances of substr in s. +If substr is an empty string, Count returns 1 + the number of Unicode code points in s. + +Example [¶](#example-Count "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Count("cheese", "e")) + fmt.Println(strings.Count("five", "")) // before & after each rune +} +``` + +```None +Output: + +3 +5 +``` + +Share +Format +Run + +#### func [Cut](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=1278) [¶](#Cut "Go to Cut") added in go1.18 + +```None +func Cut(s, sep string) (before, after string, found bool) +``` + +Cut slices s around the first instance of sep, +returning the text before and after sep. +The found result reports whether sep appears in s. +If sep does not appear in s, cut returns s, "", false. + +Example [¶](#example-Cut "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + show := func(s, sep string) { + before, after, found := strings.Cut(s, sep) + fmt.Printf("Cut(%q, %q) = %q, %q, %v\n", s, sep, before, after, found) + } + show("Gopher", "Go") + show("Gopher", "ph") + show("Gopher", "er") + show("Gopher", "Badger") +} +``` + +```None +Output: + +Cut("Gopher", "Go") = "", "pher", true +Cut("Gopher", "ph") = "Go", "er", true +Cut("Gopher", "er") = "Goph", "", true +Cut("Gopher", "Badger") = "Gopher", "", false +``` + +Share +Format +Run + +#### func [CutPrefix](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=1289) [¶](#CutPrefix "Go to CutPrefix") added in go1.20 + +```None +func CutPrefix(s, prefix string) (after string, found bool) +``` + +CutPrefix returns s without the provided leading prefix string +and reports whether it found the prefix. +If s doesn't start with prefix, CutPrefix returns s, false. +If prefix is the empty string, CutPrefix returns s, true. + +Example [¶](#example-CutPrefix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + show := func(s, sep string) { + after, found := strings.CutPrefix(s, sep) + fmt.Printf("CutPrefix(%q, %q) = %q, %v\n", s, sep, after, found) + } + show("Gopher", "Go") + show("Gopher", "ph") +} +``` + +```None +Output: + +CutPrefix("Gopher", "Go") = "pher", true +CutPrefix("Gopher", "ph") = "Gopher", false +``` + +Share +Format +Run + +#### func [CutSuffix](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=1300) [¶](#CutSuffix "Go to CutSuffix") added in go1.20 + +```None +func CutSuffix(s, suffix string) (before string, found bool) +``` + +CutSuffix returns s without the provided ending suffix string +and reports whether it found the suffix. +If s doesn't end with suffix, CutSuffix returns s, false. +If suffix is the empty string, CutSuffix returns s, true. + +Example [¶](#example-CutSuffix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + show := func(s, sep string) { + before, found := strings.CutSuffix(s, sep) + fmt.Printf("CutSuffix(%q, %q) = %q, %v\n", s, sep, before, found) + } + show("Gopher", "Go") + show("Gopher", "er") +} +``` + +```None +Output: + +CutSuffix("Gopher", "Go") = "Gopher", false +CutSuffix("Gopher", "er") = "Goph", true +``` + +Share +Format +Run + +#### func [EqualFold](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=1111) [¶](#EqualFold "Go to EqualFold") + +```None +func EqualFold(s, t string) bool +``` + +EqualFold reports whether s and t, interpreted as UTF-8 strings, +are equal under simple Unicode case-folding, which is a more general +form of case-insensitivity. + +Example [¶](#example-EqualFold "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.EqualFold("Go", "go")) + fmt.Println(strings.EqualFold("AB", "ab")) // true because comparison uses simple case-folding + fmt.Println(strings.EqualFold("ß", "ss")) // false because comparison does not use full case-folding +} +``` + +```None +Output: + +true +true +false +``` + +Share +Format +Run + +#### func [Fields](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=333) [¶](#Fields "Go to Fields") + +```None +func Fields(s string) []string +``` + +Fields splits the string s around each instance of one or more consecutive white space +characters, as defined by unicode.IsSpace, returning a slice of substrings of s or an +empty slice if s contains only white space. + +Example [¶](#example-Fields "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("Fields are: %q", strings.Fields(" foo bar baz ")) +} +``` + +```None +Output: + +Fields are: ["foo" "bar" "baz"] +``` + +Share +Format +Run + +#### func [FieldsFunc](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=388) [¶](#FieldsFunc "Go to FieldsFunc") + +```None +func FieldsFunc(s string, f func(rune) bool) []string +``` + +FieldsFunc splits the string s at each run of Unicode code points c satisfying f(c) +and returns an array of slices of s. If all code points in s satisfy f(c) or the +string is empty, an empty slice is returned. + +FieldsFunc makes no guarantees about the order in which it calls f(c) +and assumes that f always returns the same value for a given c. + +Example [¶](#example-FieldsFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + f := func(c rune) bool { + return !unicode.IsLetter(c) && !unicode.IsNumber(c) + } + fmt.Printf("Fields are: %q", strings.FieldsFunc(" foo1;bar2,baz3...", f)) +} +``` + +```None +Output: + +Fields are: ["foo1" "bar2" "baz3"] +``` + +Share +Format +Run + +#### func [HasPrefix](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=467) [¶](#HasPrefix "Go to HasPrefix") + +```None +func HasPrefix(s, prefix string) bool +``` + +HasPrefix tests whether the string s begins with prefix. + +Example [¶](#example-HasPrefix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.HasPrefix("Gopher", "Go")) + fmt.Println(strings.HasPrefix("Gopher", "C")) + fmt.Println(strings.HasPrefix("Gopher", "")) +} +``` + +```None +Output: + +true +false +true +``` + +Share +Format +Run + +#### func [HasSuffix](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=472) [¶](#HasSuffix "Go to HasSuffix") + +```None +func HasSuffix(s, suffix string) bool +``` + +HasSuffix tests whether the string s ends with suffix. + +Example [¶](#example-HasSuffix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.HasSuffix("Amigo", "go")) + fmt.Println(strings.HasSuffix("Amigo", "O")) + fmt.Println(strings.HasSuffix("Amigo", "Ami")) + fmt.Println(strings.HasSuffix("Amigo", "")) +} +``` + +```None +Output: + +true +false +false +true +``` + +Share +Format +Run + +#### func [Index](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=1194) [¶](#Index "Go to Index") + +```None +func Index(s, substr string) int +``` + +Index returns the index of the first instance of substr in s, or -1 if substr is not present in s. + +Example [¶](#example-Index "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Index("chicken", "ken")) + fmt.Println(strings.Index("chicken", "dmr")) +} +``` + +```None +Output: + +4 +-1 +``` + +Share +Format +Run + +#### func [IndexAny](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=145) [¶](#IndexAny "Go to IndexAny") + +```None +func IndexAny(s, chars string) int +``` + +IndexAny returns the index of the first instance of any Unicode code point +from chars in s, or -1 if no Unicode code point from chars is present in s. + +Example [¶](#example-IndexAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexAny("chicken", "aeiouy")) + fmt.Println(strings.IndexAny("crwth", "aeiouy")) +} +``` + +```None +Output: + +2 +-1 +``` + +Share +Format +Run + +#### func [IndexByte](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=117) [¶](#IndexByte "Go to IndexByte") added in go1.2 + +```None +func IndexByte(s string, c byte) int +``` + +IndexByte returns the index of the first instance of c in s, or -1 if c is not present in s. + +Example [¶](#example-IndexByte "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexByte("golang", 'g')) + fmt.Println(strings.IndexByte("gophers", 'h')) + fmt.Println(strings.IndexByte("golang", 'x')) +} +``` + +```None +Output: + +0 +3 +-1 +``` + +Share +Format +Run + +#### func [IndexFunc](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=830) [¶](#IndexFunc "Go to IndexFunc") + +```None +func IndexFunc(s string, f func(rune) bool) int +``` + +IndexFunc returns the index into s of the first Unicode +code point satisfying f(c), or -1 if none do. + +Example [¶](#example-IndexFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + f := func(c rune) bool { + return unicode.Is(unicode.Han, c) + } + fmt.Println(strings.IndexFunc("Hello, 世界", f)) + fmt.Println(strings.IndexFunc("Hello, world", f)) +} +``` + +```None +Output: + +7 +-1 +``` + +Share +Format +Run + +#### func [IndexRune](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=125) [¶](#IndexRune "Go to IndexRune") + +```None +func IndexRune(s string, r rune) int +``` + +IndexRune returns the index of the first instance of the Unicode code point +r, or -1 if rune is not present in s. +If r is utf8.RuneError, it returns the first instance of any +invalid UTF-8 byte sequence. + +Example [¶](#example-IndexRune "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexRune("chicken", 'k')) + fmt.Println(strings.IndexRune("chicken", 'd')) +} +``` + +```None +Output: + +4 +-1 +``` + +Share +Format +Run + +#### func [Join](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=434) [¶](#Join "Go to Join") + +```None +func Join(elems []string, sep string) string +``` + +Join concatenates the elements of its first argument to create a single string. The separator +string sep is placed between elements in the resulting string. + +Example [¶](#example-Join "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + s := []string{"foo", "bar", "baz"} + fmt.Println(strings.Join(s, ", ")) +} +``` + +```None +Output: + +foo, bar, baz +``` + +Share +Format +Run + +#### func [LastIndex](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=80) [¶](#LastIndex "Go to LastIndex") + +```None +func LastIndex(s, substr string) int +``` + +LastIndex returns the index of the last instance of substr in s, or -1 if substr is not present in s. + +Example [¶](#example-LastIndex "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Index("go gopher", "go")) + fmt.Println(strings.LastIndex("go gopher", "go")) + fmt.Println(strings.LastIndex("go gopher", "rodent")) +} +``` + +```None +Output: + +0 +3 +-1 +``` + +Share +Format +Run + +#### func [LastIndexAny](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=179) [¶](#LastIndexAny "Go to LastIndexAny") + +```None +func LastIndexAny(s, chars string) int +``` + +LastIndexAny returns the index of the last instance of any Unicode code +point from chars in s, or -1 if no Unicode code point from chars is +present in s. + +Example [¶](#example-LastIndexAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.LastIndexAny("go gopher", "go")) + fmt.Println(strings.LastIndexAny("go gopher", "rodent")) + fmt.Println(strings.LastIndexAny("go gopher", "fail")) +} +``` + +```None +Output: + +4 +8 +-1 +``` + +Share +Format +Run + +#### func [LastIndexByte](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=229) [¶](#LastIndexByte "Go to LastIndexByte") added in go1.5 + +```None +func LastIndexByte(s string, c byte) int +``` + +LastIndexByte returns the index of the last instance of c in s, or -1 if c is not present in s. + +Example [¶](#example-LastIndexByte "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.LastIndexByte("Hello, world", 'l')) + fmt.Println(strings.LastIndexByte("Hello, world", 'o')) + fmt.Println(strings.LastIndexByte("Hello, world", 'x')) +} +``` + +```None +Output: + +10 +8 +-1 +``` + +Share +Format +Run + +#### func [LastIndexFunc](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=836) [¶](#LastIndexFunc "Go to LastIndexFunc") + +```None +func LastIndexFunc(s string, f func(rune) bool) int +``` + +LastIndexFunc returns the index into s of the last +Unicode code point satisfying f(c), or -1 if none do. + +Example [¶](#example-LastIndexFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.LastIndexFunc("go 123", unicode.IsNumber)) + fmt.Println(strings.LastIndexFunc("123 go", unicode.IsNumber)) + fmt.Println(strings.LastIndexFunc("go", unicode.IsNumber)) +} +``` + +```None +Output: + +5 +2 +-1 +``` + +Share +Format +Run + +#### func [Map](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=479) [¶](#Map "Go to Map") + +```None +func Map(mapping func(rune) rune, s string) string +``` + +Map returns a copy of the string s with all its characters modified +according to the mapping function. If mapping returns a negative value, the character is +dropped from the string with no replacement. + +Example [¶](#example-Map "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + rot13 := func(r rune) rune { + switch { + case r >= 'A' && r <= 'Z': + return 'A' + (r-'A'+13)%26 + case r >= 'a' && r <= 'z': + return 'a' + (r-'a'+13)%26 + } + return r + } + fmt.Println(strings.Map(rot13, "'Twas brillig and the slithy gopher...")) +} +``` + +```None +Output: + +'Gjnf oevyyvt naq gur fyvgul tbcure... +``` + +Share +Format +Run + +#### func [Repeat](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=542) [¶](#Repeat "Go to Repeat") + +```None +func Repeat(s string, count int) string +``` + +Repeat returns a new string consisting of count copies of the string s. + +It panics if count is negative or if the result of (len(s) \* count) +overflows. + +Example [¶](#example-Repeat "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println("ba" + strings.Repeat("na", 2)) +} +``` + +```None +Output: + +banana +``` + +Share +Format +Run + +#### func [Replace](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=1065) [¶](#Replace "Go to Replace") + +```None +func Replace(s, old, new string, n int) string +``` + +Replace returns a copy of the string s with the first n +non-overlapping instances of old replaced by new. +If old is empty, it matches at the beginning of the string +and after each UTF-8 sequence, yielding up to k+1 replacements +for a k-rune string. +If n < 0, there is no limit on the number of replacements. + +Example [¶](#example-Replace "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Replace("oink oink oink", "k", "ky", 2)) + fmt.Println(strings.Replace("oink oink oink", "oink", "moo", -1)) +} +``` + +```None +Output: + +oinky oinky oink +moo moo moo +``` + +Share +Format +Run + +#### func [ReplaceAll](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=1104) [¶](#ReplaceAll "Go to ReplaceAll") added in go1.12 + +```None +func ReplaceAll(s, old, new string) string +``` + +ReplaceAll returns a copy of the string s with all +non-overlapping instances of old replaced by new. +If old is empty, it matches at the beginning of the string +and after each UTF-8 sequence, yielding up to k+1 replacements +for a k-rune string. + +Example [¶](#example-ReplaceAll "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ReplaceAll("oink oink oink", "oink", "moo")) +} +``` + +```None +Output: + +moo moo moo +``` + +Share +Format +Run + +#### func [Split](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=312) [¶](#Split "Go to Split") + +```None +func Split(s, sep string) []string +``` + +Split slices s into all substrings separated by sep and returns a slice of +the substrings between those separators. + +If s does not contain sep and sep is not empty, Split returns a +slice of length 1 whose only element is s. + +If sep is empty, Split splits after each UTF-8 sequence. If both s +and sep are empty, Split returns an empty slice. + +It is equivalent to SplitN with a count of -1. + +To split around the first instance of a separator, see Cut. + +Example [¶](#example-Split "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.Split("a,b,c", ",")) + fmt.Printf("%q\n", strings.Split("a man a plan a canal panama", "a ")) + fmt.Printf("%q\n", strings.Split(" xyz ", "")) + fmt.Printf("%q\n", strings.Split("", "Bernardo O'Higgins")) +} +``` + +```None +Output: + +["a" "b" "c"] +["" "man " "plan " "canal panama"] +[" " "x" "y" "z" " "] +[""] +``` + +Share +Format +Run + +#### func [SplitAfter](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=324) [¶](#SplitAfter "Go to SplitAfter") + +```None +func SplitAfter(s, sep string) []string +``` + +SplitAfter slices s into all substrings after each instance of sep and +returns a slice of those substrings. + +If s does not contain sep and sep is not empty, SplitAfter returns +a slice of length 1 whose only element is s. + +If sep is empty, SplitAfter splits after each UTF-8 sequence. If +both s and sep are empty, SplitAfter returns an empty slice. + +It is equivalent to SplitAfterN with a count of -1. + +Example [¶](#example-SplitAfter "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitAfter("a,b,c", ",")) +} +``` + +```None +Output: + +["a," "b," "c"] +``` + +Share +Format +Run + +#### func [SplitAfterN](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=296) [¶](#SplitAfterN "Go to SplitAfterN") + +```None +func SplitAfterN(s, sep string, n int) []string +``` + +SplitAfterN slices s into substrings after each instance of sep and +returns a slice of those substrings. + +The count determines the number of substrings to return: + +```None +n > 0: at most n substrings; the last substring will be the unsplit remainder. +n == 0: the result is nil (zero substrings) +n < 0: all substrings +``` + +Edge cases for s and sep (for example, empty strings) are handled +as described in the documentation for SplitAfter. + +Example [¶](#example-SplitAfterN "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitAfterN("a,b,c", ",", 2)) +} +``` + +```None +Output: + +["a," "b,c"] +``` + +Share +Format +Run + +#### func [SplitN](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=283) [¶](#SplitN "Go to SplitN") + +```None +func SplitN(s, sep string, n int) []string +``` + +SplitN slices s into substrings separated by sep and returns a slice of +the substrings between those separators. + +The count determines the number of substrings to return: + +```None +n > 0: at most n substrings; the last substring will be the unsplit remainder. +n == 0: the result is nil (zero substrings) +n < 0: all substrings +``` + +Edge cases for s and sep (for example, empty strings) are handled +as described in the documentation for Split. + +To split around the first instance of a separator, see Cut. + +Example [¶](#example-SplitN "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitN("a,b,c", ",", 2)) + z := strings.SplitN("a,b,c", ",", 0) + fmt.Printf("%q (nil = %v)\n", z, z == nil) +} +``` + +```None +Output: + +["a" "b,c"] +[] (nil = true) +``` + +Share +Format +Run + +#### func [Title](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=782) deprecated + +```None +func Title(s string) string +``` + +Title returns a copy of the string s with all Unicode letters that begin words +mapped to their Unicode title case. + +Deprecated: The rule Title uses for word boundaries does not handle Unicode +punctuation properly. Use golang.org/x/text/cases instead. + +Example [¶](#example-Title "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Compare this example to the ToTitle example. + fmt.Println(strings.Title("her royal highness")) + fmt.Println(strings.Title("loud noises")) + fmt.Println(strings.Title("хлеб")) +} +``` + +```None +Output: + +Her Royal Highness +Loud Noises +Хлеб +``` + +Share +Format +Run + +#### func [ToLower](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=641) [¶](#ToLower "Go to ToLower") + +```None +func ToLower(s string) string +``` + +ToLower returns s with all Unicode letters mapped to their lower case. + +Example [¶](#example-ToLower "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ToLower("Gopher")) +} +``` + +```None +Output: + +gopher +``` + +Share +Format +Run + +#### func [ToLowerSpecial](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=692) [¶](#ToLowerSpecial "Go to ToLowerSpecial") + +```None +func ToLowerSpecial(c unicode.SpecialCase, s string) string +``` + +ToLowerSpecial returns a copy of the string s with all Unicode letters mapped to their +lower case using the case mapping specified by c. + +Example [¶](#example-ToLowerSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToLowerSpecial(unicode.TurkishCase, "Önnek İş")) +} +``` + +```None +Output: + +önnek iş +``` + +Share +Format +Run + +#### func [ToTitle](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=682) [¶](#ToTitle "Go to ToTitle") + +```None +func ToTitle(s string) string +``` + +ToTitle returns a copy of the string s with all Unicode letters mapped to +their Unicode title case. + +Example [¶](#example-ToTitle "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Compare this example to the Title example. + fmt.Println(strings.ToTitle("her royal highness")) + fmt.Println(strings.ToTitle("loud noises")) + fmt.Println(strings.ToTitle("хлеб")) +} +``` + +```None +Output: + +HER ROYAL HIGHNESS +LOUD NOISES +ХЛЕБ +``` + +Share +Format +Run + +#### func [ToTitleSpecial](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=698) [¶](#ToTitleSpecial "Go to ToTitleSpecial") + +```None +func ToTitleSpecial(c unicode.SpecialCase, s string) string +``` + +ToTitleSpecial returns a copy of the string s with all Unicode letters mapped to their +Unicode title case, giving priority to the special casing rules. + +Example [¶](#example-ToTitleSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToTitleSpecial(unicode.TurkishCase, "dünyanın ilk borsa yapısı Aizonai kabul edilir")) +} +``` + +```None +Output: + +DÜNYANIN İLK BORSA YAPISI AİZONAİ KABUL EDİLİR +``` + +Share +Format +Run + +#### func [ToUpper](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=601) [¶](#ToUpper "Go to ToUpper") + +```None +func ToUpper(s string) string +``` + +ToUpper returns s with all Unicode letters mapped to their upper case. + +Example [¶](#example-ToUpper "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ToUpper("Gopher")) +} +``` + +```None +Output: + +GOPHER +``` + +Share +Format +Run + +#### func [ToUpperSpecial](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=686) [¶](#ToUpperSpecial "Go to ToUpperSpecial") + +```None +func ToUpperSpecial(c unicode.SpecialCase, s string) string +``` + +ToUpperSpecial returns a copy of the string s with all Unicode letters mapped to their +upper case using the case mapping specified by c. + +Example [¶](#example-ToUpperSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToUpperSpecial(unicode.TurkishCase, "örnek iş")) +} +``` + +```None +Output: + +ÖRNEK İŞ +``` + +Share +Format +Run + +#### func [ToValidUTF8](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=704) [¶](#ToValidUTF8 "Go to ToValidUTF8") added in go1.13 + +```None +func ToValidUTF8(s, replacement string) string +``` + +ToValidUTF8 returns a copy of the string s with each run of invalid UTF-8 byte sequences +replaced by the replacement string, which may be empty. + +Example [¶](#example-ToValidUTF8 "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%s\n", strings.ToValidUTF8("abc", "\uFFFD")) + fmt.Printf("%s\n", strings.ToValidUTF8("a\xffb\xC0\xAFc\xff", "")) + fmt.Printf("%s\n", strings.ToValidUTF8("\xed\xa0\x80", "abc")) +} +``` + +```None +Output: + +abc +abc +abc +``` + +Share +Format +Run + +#### func [Trim](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=896) [¶](#Trim "Go to Trim") + +```None +func Trim(s, cutset string) string +``` + +Trim returns a slice of the string s with all leading and +trailing Unicode code points contained in cutset removed. + +Example [¶](#example-Trim "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.Trim("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimFunc](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=824) [¶](#TrimFunc "Go to TrimFunc") + +```None +func TrimFunc(s string, f func(rune) bool) string +``` + +TrimFunc returns a slice of the string s with all leading +and trailing Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimLeft](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=913) [¶](#TrimLeft "Go to TrimLeft") + +```None +func TrimLeft(s, cutset string) string +``` + +TrimLeft returns a slice of the string s with all leading +Unicode code points contained in cutset removed. + +To remove a prefix, use TrimPrefix instead. + +Example [¶](#example-TrimLeft "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.TrimLeft("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +Hello, Gophers!!! +``` + +Share +Format +Run + +#### func [TrimLeftFunc](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=801) [¶](#TrimLeftFunc "Go to TrimLeftFunc") + +```None +func TrimLeftFunc(s string, f func(rune) bool) string +``` + +TrimLeftFunc returns a slice of the string s with all leading +Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimLeftFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimLeftFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +Hello, Gophers!!! +``` + +Share +Format +Run + +#### func [TrimPrefix](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=1043) [¶](#TrimPrefix "Go to TrimPrefix") added in go1.1 + +```None +func TrimPrefix(s, prefix string) string +``` + +TrimPrefix returns s without the provided leading prefix string. +If s doesn't start with prefix, s is returned unchanged. + +Example [¶](#example-TrimPrefix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var s = "¡¡¡Hello, Gophers!!!" + s = strings.TrimPrefix(s, "¡¡¡Hello, ") + s = strings.TrimPrefix(s, "¡¡¡Howdy, ") + fmt.Print(s) +} +``` + +```None +Output: + +Gophers!!! +``` + +Share +Format +Run + +#### func [TrimRight](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=961) [¶](#TrimRight "Go to TrimRight") + +```None +func TrimRight(s, cutset string) string +``` + +TrimRight returns a slice of the string s, with all trailing +Unicode code points contained in cutset removed. + +To remove a suffix, use TrimSuffix instead. + +Example [¶](#example-TrimRight "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.TrimRight("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +¡¡¡Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimRightFunc](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=811) [¶](#TrimRightFunc "Go to TrimRightFunc") + +```None +func TrimRightFunc(s string, f func(rune) bool) string +``` + +TrimRightFunc returns a slice of the string s with all trailing +Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimRightFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimRightFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +¡¡¡Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimSpace](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=1007) [¶](#TrimSpace "Go to TrimSpace") + +```None +func TrimSpace(s string) string +``` + +TrimSpace returns a slice of the string s, with all leading +and trailing white space removed, as defined by Unicode. + +Example [¶](#example-TrimSpace "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.TrimSpace(" \t\n Hello, Gophers \n\t\r\n")) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimSuffix](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/strings.go;l=1052) [¶](#TrimSuffix "Go to TrimSuffix") added in go1.1 + +```None +func TrimSuffix(s, suffix string) string +``` + +TrimSuffix returns s without the provided trailing suffix string. +If s doesn't end with suffix, s is returned unchanged. + +Example [¶](#example-TrimSuffix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var s = "¡¡¡Hello, Gophers!!!" + s = strings.TrimSuffix(s, ", Gophers!!!") + s = strings.TrimSuffix(s, ", Marmots!!!") + fmt.Print(s) +} +``` + +```None +Output: + +¡¡¡Hello +``` + +Share +Format +Run + +### Types [¶](#pkg-types "Go to Types") + +#### type [Builder](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/builder.go;l=16) [¶](#Builder "Go to Builder") added in go1.10 + +```None +type Builder struct { + // contains filtered or unexported fields +} +``` + +A Builder is used to efficiently build a string using Write methods. +It minimizes memory copying. The zero value is ready to use. +Do not copy a non-zero Builder. + +Example [¶](#example-Builder "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var b strings.Builder + for i := 3; i >= 1; i-- { + fmt.Fprintf(&b, "%d...", i) + } + b.WriteString("ignition") + fmt.Println(b.String()) + +} +``` + +```None +Output: + +3...2...1...ignition +``` + +Share +Format +Run + +#### func (\*Builder) [Cap](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/builder.go;l=58) [¶](#Builder.Cap "Go to Builder.Cap") added in go1.12 + +```None +func (b *Builder) Cap() int +``` + +Cap returns the capacity of the builder's underlying byte slice. It is the +total space allocated for the string being built and includes any bytes +already written. + +#### func (\*Builder) [Grow](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/builder.go;l=77) [¶](#Builder.Grow "Go to Builder.Grow") added in go1.10 + +```None +func (b *Builder) Grow(n int) +``` + +Grow grows b's capacity, if necessary, to guarantee space for +another n bytes. After Grow(n), at least n bytes can be written to b +without another allocation. If n is negative, Grow panics. + +#### func (\*Builder) [Len](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/builder.go;l=53) [¶](#Builder.Len "Go to Builder.Len") added in go1.10 + +```None +func (b *Builder) Len() int +``` + +Len returns the number of accumulated bytes; b.Len() == len(b.String()). + +#### func (\*Builder) [Reset](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/builder.go;l=61) [¶](#Builder.Reset "Go to Builder.Reset") added in go1.10 + +```None +func (b *Builder) Reset() +``` + +Reset resets the Builder to be empty. + +#### func (\*Builder) [String](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/builder.go;l=48) [¶](#Builder.String "Go to Builder.String") added in go1.10 + +```None +func (b *Builder) String() string +``` + +String returns the accumulated string. + +#### func (\*Builder) [Write](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/builder.go;l=89) [¶](#Builder.Write "Go to Builder.Write") added in go1.10 + +```None +func (b *Builder) Write(p []byte) (int, error) +``` + +Write appends the contents of p to b's buffer. +Write always returns len(p), nil. + +#### func (\*Builder) [WriteByte](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/builder.go;l=97) [¶](#Builder.WriteByte "Go to Builder.WriteByte") added in go1.10 + +```None +func (b *Builder) WriteByte(c byte) error +``` + +WriteByte appends the byte c to b's buffer. +The returned error is always nil. + +#### func (\*Builder) [WriteRune](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/builder.go;l=105) [¶](#Builder.WriteRune "Go to Builder.WriteRune") added in go1.10 + +```None +func (b *Builder) WriteRune(r rune) (int, error) +``` + +WriteRune appends the UTF-8 encoding of Unicode code point r to b's buffer. +It returns the length of r and a nil error. + +#### func (\*Builder) [WriteString](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/builder.go;l=114) [¶](#Builder.WriteString "Go to Builder.WriteString") added in go1.10 + +```None +func (b *Builder) WriteString(s string) (int, error) +``` + +WriteString appends the contents of s to b's buffer. +It returns the length of s and a nil error. + +#### type [Reader](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/reader.go;l=17) [¶](#Reader "Go to Reader") + +```None +type Reader struct { + // contains filtered or unexported fields +} +``` + +A Reader implements the io.Reader, io.ReaderAt, io.ByteReader, io.ByteScanner, +io.RuneReader, io.RuneScanner, io.Seeker, and io.WriterTo interfaces by reading +from a string. +The zero value for Reader operates like a Reader of an empty string. + +#### func [NewReader](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/reader.go;l=160) [¶](#NewReader "Go to NewReader") + +```None +func NewReader(s string) *Reader +``` + +NewReader returns a new Reader reading from s. +It is similar to bytes.NewBufferString but more efficient and non-writable. + +#### func (\*Reader) [Len](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/reader.go;l=25) [¶](#Reader.Len "Go to Reader.Len") + +```None +func (r *Reader) Len() int +``` + +Len returns the number of bytes of the unread portion of the +string. + +#### func (\*Reader) [Read](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/reader.go;l=39) [¶](#Reader.Read "Go to Reader.Read") + +```None +func (r *Reader) Read(b []byte) (n int, err error) +``` + +Read implements the io.Reader interface. + +#### func (\*Reader) [ReadAt](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/reader.go;l=50) [¶](#Reader.ReadAt "Go to Reader.ReadAt") + +```None +func (r *Reader) ReadAt(b []byte, off int64) (n int, err error) +``` + +ReadAt implements the io.ReaderAt interface. + +#### func (\*Reader) [ReadByte](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/reader.go;l=66) [¶](#Reader.ReadByte "Go to Reader.ReadByte") + +```None +func (r *Reader) ReadByte() (byte, error) +``` + +ReadByte implements the io.ByteReader interface. + +#### func (\*Reader) [ReadRune](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/reader.go;l=87) [¶](#Reader.ReadRune "Go to Reader.ReadRune") + +```None +func (r *Reader) ReadRune() (ch rune, size int, err error) +``` + +ReadRune implements the io.RuneReader interface. + +#### func (\*Reader) [Reset](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/reader.go;l=156) [¶](#Reader.Reset "Go to Reader.Reset") added in go1.7 + +```None +func (r *Reader) Reset(s string) +``` + +Reset resets the Reader to be reading from s. + +#### func (\*Reader) [Seek](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/reader.go;l=116) [¶](#Reader.Seek "Go to Reader.Seek") + +```None +func (r *Reader) Seek(offset int64, whence int) (int64, error) +``` + +Seek implements the io.Seeker interface. + +#### func (\*Reader) [Size](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/reader.go;l=36) [¶](#Reader.Size "Go to Reader.Size") added in go1.5 + +```None +func (r *Reader) Size() int64 +``` + +Size returns the original length of the underlying string. +Size is the number of bytes available for reading via ReadAt. +The returned value is always the same and is not affected by calls +to any other method. + +#### func (\*Reader) [UnreadByte](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/reader.go;l=77) [¶](#Reader.UnreadByte "Go to Reader.UnreadByte") + +```None +func (r *Reader) UnreadByte() error +``` + +UnreadByte implements the io.ByteScanner interface. + +#### func (\*Reader) [UnreadRune](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/reader.go;l=103) [¶](#Reader.UnreadRune "Go to Reader.UnreadRune") + +```None +func (r *Reader) UnreadRune() error +``` + +UnreadRune implements the io.RuneScanner interface. + +#### func (\*Reader) [WriteTo](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/reader.go;l=137) [¶](#Reader.WriteTo "Go to Reader.WriteTo") added in go1.1 + +```None +func (r *Reader) WriteTo(w io.Writer) (n int64, err error) +``` + +WriteTo implements the io.WriterTo interface. + +#### type [Replacer](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/replace.go;l=14) [¶](#Replacer "Go to Replacer") + +```None +type Replacer struct { + // contains filtered or unexported fields +} +``` + +Replacer replaces a list of strings with replacements. +It is safe for concurrent use by multiple goroutines. + +#### func [NewReplacer](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/replace.go;l=32) [¶](#NewReplacer "Go to NewReplacer") + +```None +func NewReplacer(oldnew ...string) *Replacer +``` + +NewReplacer returns a new Replacer from a list of old, new string +pairs. Replacements are performed in the order they appear in the +target string, without overlapping matches. The old string +comparisons are done in argument order. + +NewReplacer panics if given an odd number of arguments. + +Example [¶](#example-NewReplacer "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + r := strings.NewReplacer("<", "<", ">", ">") + fmt.Println(r.Replace("This is HTML!")) +} +``` + +```None +Output: + +This is <b>HTML</b>! +``` + +Share +Format +Run + +#### func (\*Replacer) [Replace](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/replace.go;l=95) [¶](#Replacer.Replace "Go to Replacer.Replace") + +```None +func (r *Replacer) Replace(s string) string +``` + +Replace returns a copy of s with all replacements performed. + +#### func (\*Replacer) [WriteString](https://cs.opensource.google/go/go/+/go1.21.0:src/strings/replace.go;l=101) [¶](#Replacer.WriteString "Go to Replacer.WriteString") + +```None +func (r *Replacer) WriteString(w io.Writer, s string) (n int, err error) +``` + +WriteString writes s to w with all replacements performed. diff --git a/corpus/docs/golang/strings/strings_go1220.md b/corpus/docs/golang/strings/strings_go1220.md new file mode 100644 index 0000000000000000000000000000000000000000..16e3c3bee291e791a4ede5e4a92e1f7a37332f13 --- /dev/null +++ b/corpus/docs/golang/strings/strings_go1220.md @@ -0,0 +1,2398 @@ +# Golang - strings + +Source: https://pkg.go.dev/strings@go1.22.0 +Version: go1.22.0 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package strings implements simple functions to manipulate UTF-8 encoded strings. + +For information about UTF-8 strings in Go, see . + +### Index [¶](#pkg-index "Go to Index") + +* [func Clone(s string) string](#Clone) +* [func Compare(a, b string) int](#Compare) +* [func Contains(s, substr string) bool](#Contains) +* [func ContainsAny(s, chars string) bool](#ContainsAny) +* [func ContainsFunc(s string, f func(rune) bool) bool](#ContainsFunc) +* [func ContainsRune(s string, r rune) bool](#ContainsRune) +* [func Count(s, substr string) int](#Count) +* [func Cut(s, sep string) (before, after string, found bool)](#Cut) +* [func CutPrefix(s, prefix string) (after string, found bool)](#CutPrefix) +* [func CutSuffix(s, suffix string) (before string, found bool)](#CutSuffix) +* [func EqualFold(s, t string) bool](#EqualFold) +* [func Fields(s string) []string](#Fields) +* [func FieldsFunc(s string, f func(rune) bool) []string](#FieldsFunc) +* [func HasPrefix(s, prefix string) bool](#HasPrefix) +* [func HasSuffix(s, suffix string) bool](#HasSuffix) +* [func Index(s, substr string) int](#Index) +* [func IndexAny(s, chars string) int](#IndexAny) +* [func IndexByte(s string, c byte) int](#IndexByte) +* [func IndexFunc(s string, f func(rune) bool) int](#IndexFunc) +* [func IndexRune(s string, r rune) int](#IndexRune) +* [func Join(elems []string, sep string) string](#Join) +* [func LastIndex(s, substr string) int](#LastIndex) +* [func LastIndexAny(s, chars string) int](#LastIndexAny) +* [func LastIndexByte(s string, c byte) int](#LastIndexByte) +* [func LastIndexFunc(s string, f func(rune) bool) int](#LastIndexFunc) +* [func Map(mapping func(rune) rune, s string) string](#Map) +* [func Repeat(s string, count int) string](#Repeat) +* [func Replace(s, old, new string, n int) string](#Replace) +* [func ReplaceAll(s, old, new string) string](#ReplaceAll) +* [func Split(s, sep string) []string](#Split) +* [func SplitAfter(s, sep string) []string](#SplitAfter) +* [func SplitAfterN(s, sep string, n int) []string](#SplitAfterN) +* [func SplitN(s, sep string, n int) []string](#SplitN) +* [func Title(s string) string](#Title)deprecated +* [func ToLower(s string) string](#ToLower) +* [func ToLowerSpecial(c unicode.SpecialCase, s string) string](#ToLowerSpecial) +* [func ToTitle(s string) string](#ToTitle) +* [func ToTitleSpecial(c unicode.SpecialCase, s string) string](#ToTitleSpecial) +* [func ToUpper(s string) string](#ToUpper) +* [func ToUpperSpecial(c unicode.SpecialCase, s string) string](#ToUpperSpecial) +* [func ToValidUTF8(s, replacement string) string](#ToValidUTF8) +* [func Trim(s, cutset string) string](#Trim) +* [func TrimFunc(s string, f func(rune) bool) string](#TrimFunc) +* [func TrimLeft(s, cutset string) string](#TrimLeft) +* [func TrimLeftFunc(s string, f func(rune) bool) string](#TrimLeftFunc) +* [func TrimPrefix(s, prefix string) string](#TrimPrefix) +* [func TrimRight(s, cutset string) string](#TrimRight) +* [func TrimRightFunc(s string, f func(rune) bool) string](#TrimRightFunc) +* [func TrimSpace(s string) string](#TrimSpace) +* [func TrimSuffix(s, suffix string) string](#TrimSuffix) +* [type Builder](#Builder) +* + [func (b \*Builder) Cap() int](#Builder.Cap) + + [func (b \*Builder) Grow(n int)](#Builder.Grow) + + [func (b \*Builder) Len() int](#Builder.Len) + + [func (b \*Builder) Reset()](#Builder.Reset) + + [func (b \*Builder) String() string](#Builder.String) + + [func (b \*Builder) Write(p []byte) (int, error)](#Builder.Write) + + [func (b \*Builder) WriteByte(c byte) error](#Builder.WriteByte) + + [func (b \*Builder) WriteRune(r rune) (int, error)](#Builder.WriteRune) + + [func (b \*Builder) WriteString(s string) (int, error)](#Builder.WriteString) +* [type Reader](#Reader) +* + [func NewReader(s string) \*Reader](#NewReader) +* + [func (r \*Reader) Len() int](#Reader.Len) + + [func (r \*Reader) Read(b []byte) (n int, err error)](#Reader.Read) + + [func (r \*Reader) ReadAt(b []byte, off int64) (n int, err error)](#Reader.ReadAt) + + [func (r \*Reader) ReadByte() (byte, error)](#Reader.ReadByte) + + [func (r \*Reader) ReadRune() (ch rune, size int, err error)](#Reader.ReadRune) + + [func (r \*Reader) Reset(s string)](#Reader.Reset) + + [func (r \*Reader) Seek(offset int64, whence int) (int64, error)](#Reader.Seek) + + [func (r \*Reader) Size() int64](#Reader.Size) + + [func (r \*Reader) UnreadByte() error](#Reader.UnreadByte) + + [func (r \*Reader) UnreadRune() error](#Reader.UnreadRune) + + [func (r \*Reader) WriteTo(w io.Writer) (n int64, err error)](#Reader.WriteTo) +* [type Replacer](#Replacer) +* + [func NewReplacer(oldnew ...string) \*Replacer](#NewReplacer) +* + [func (r \*Replacer) Replace(s string) string](#Replacer.Replace) + + [func (r \*Replacer) WriteString(w io.Writer, s string) (n int, err error)](#Replacer.WriteString) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Builder](#example-Builder) +* [Clone](#example-Clone) +* [Compare](#example-Compare) +* [Contains](#example-Contains) +* [ContainsAny](#example-ContainsAny) +* [ContainsFunc](#example-ContainsFunc) +* [ContainsRune](#example-ContainsRune) +* [Count](#example-Count) +* [Cut](#example-Cut) +* [CutPrefix](#example-CutPrefix) +* [CutSuffix](#example-CutSuffix) +* [EqualFold](#example-EqualFold) +* [Fields](#example-Fields) +* [FieldsFunc](#example-FieldsFunc) +* [HasPrefix](#example-HasPrefix) +* [HasSuffix](#example-HasSuffix) +* [Index](#example-Index) +* [IndexAny](#example-IndexAny) +* [IndexByte](#example-IndexByte) +* [IndexFunc](#example-IndexFunc) +* [IndexRune](#example-IndexRune) +* [Join](#example-Join) +* [LastIndex](#example-LastIndex) +* [LastIndexAny](#example-LastIndexAny) +* [LastIndexByte](#example-LastIndexByte) +* [LastIndexFunc](#example-LastIndexFunc) +* [Map](#example-Map) +* [NewReplacer](#example-NewReplacer) +* [Repeat](#example-Repeat) +* [Replace](#example-Replace) +* [ReplaceAll](#example-ReplaceAll) +* [Split](#example-Split) +* [SplitAfter](#example-SplitAfter) +* [SplitAfterN](#example-SplitAfterN) +* [SplitN](#example-SplitN) +* [Title](#example-Title) +* [ToLower](#example-ToLower) +* [ToLowerSpecial](#example-ToLowerSpecial) +* [ToTitle](#example-ToTitle) +* [ToTitleSpecial](#example-ToTitleSpecial) +* [ToUpper](#example-ToUpper) +* [ToUpperSpecial](#example-ToUpperSpecial) +* [ToValidUTF8](#example-ToValidUTF8) +* [Trim](#example-Trim) +* [TrimFunc](#example-TrimFunc) +* [TrimLeft](#example-TrimLeft) +* [TrimLeftFunc](#example-TrimLeftFunc) +* [TrimPrefix](#example-TrimPrefix) +* [TrimRight](#example-TrimRight) +* [TrimRightFunc](#example-TrimRightFunc) +* [TrimSpace](#example-TrimSpace) +* [TrimSuffix](#example-TrimSuffix) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [Clone](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/clone.go;l=21) [¶](#Clone "Go to Clone") added in go1.18 + +```None +func Clone(s string) string +``` + +Clone returns a fresh copy of s. +It guarantees to make a copy of s into a new allocation, +which can be important when retaining only a small substring +of a much larger string. Using Clone can help such programs +use less memory. Of course, since using Clone makes a copy, +overuse of Clone can make programs use more memory. +Clone should typically be used only rarely, and only when +profiling indicates that it is needed. +For strings of length zero the string "" will be returned +and no allocation is made. + +Example [¶](#example-Clone "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unsafe" +) + +func main() { + s := "abc" + clone := strings.Clone(s) + fmt.Println(s == clone) + fmt.Println(unsafe.StringData(s) == unsafe.StringData(clone)) +} +``` + +```None +Output: + +true +false +``` + +Share +Format +Run + +#### func [Compare](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/compare.go;l=13) [¶](#Compare "Go to Compare") added in go1.5 + +```None +func Compare(a, b string) int +``` + +Compare returns an integer comparing two strings lexicographically. +The result will be 0 if a == b, -1 if a < b, and +1 if a > b. + +Compare is included only for symmetry with package bytes. +It is usually clearer and always faster to use the built-in +string comparison operators ==, <, >, and so on. + +Example [¶](#example-Compare "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Compare("a", "b")) + fmt.Println(strings.Compare("a", "a")) + fmt.Println(strings.Compare("b", "a")) +} +``` + +```None +Output: + +-1 +0 +1 +``` + +Share +Format +Run + +#### func [Contains](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=60) [¶](#Contains "Go to Contains") + +```None +func Contains(s, substr string) bool +``` + +Contains reports whether substr is within s. + +Example [¶](#example-Contains "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Contains("seafood", "foo")) + fmt.Println(strings.Contains("seafood", "bar")) + fmt.Println(strings.Contains("seafood", "")) + fmt.Println(strings.Contains("", "")) +} +``` + +```None +Output: + +true +false +true +true +``` + +Share +Format +Run + +#### func [ContainsAny](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=65) [¶](#ContainsAny "Go to ContainsAny") + +```None +func ContainsAny(s, chars string) bool +``` + +ContainsAny reports whether any Unicode code points in chars are within s. + +Example [¶](#example-ContainsAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ContainsAny("team", "i")) + fmt.Println(strings.ContainsAny("fail", "ui")) + fmt.Println(strings.ContainsAny("ure", "ui")) + fmt.Println(strings.ContainsAny("failure", "ui")) + fmt.Println(strings.ContainsAny("foo", "")) + fmt.Println(strings.ContainsAny("", "")) +} +``` + +```None +Output: + +false +true +true +true +false +false +``` + +Share +Format +Run + +#### func [ContainsFunc](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=75) [¶](#ContainsFunc "Go to ContainsFunc") added in go1.21.0 + +```None +func ContainsFunc(s string, f func(rune) bool) bool +``` + +ContainsFunc reports whether any Unicode code points r within s satisfy f(r). + +Example [¶](#example-ContainsFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + f := func(r rune) bool { + return r == 'a' || r == 'e' || r == 'i' || r == 'o' || r == 'u' + } + fmt.Println(strings.ContainsFunc("hello", f)) + fmt.Println(strings.ContainsFunc("rhythms", f)) +} +``` + +```None +Output: + +true +false +``` + +Share +Format +Run + +#### func [ContainsRune](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=70) [¶](#ContainsRune "Go to ContainsRune") + +```None +func ContainsRune(s string, r rune) bool +``` + +ContainsRune reports whether the Unicode code point r is within s. + +Example [¶](#example-ContainsRune "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Finds whether a string contains a particular Unicode code point. + // The code point for the lowercase letter "a", for example, is 97. + fmt.Println(strings.ContainsRune("aardvark", 97)) + fmt.Println(strings.ContainsRune("timeout", 97)) +} +``` + +```None +Output: + +true +false +``` + +Share +Format +Run + +#### func [Count](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=40) [¶](#Count "Go to Count") + +```None +func Count(s, substr string) int +``` + +Count counts the number of non-overlapping instances of substr in s. +If substr is an empty string, Count returns 1 + the number of Unicode code points in s. + +Example [¶](#example-Count "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Count("cheese", "e")) + fmt.Println(strings.Count("five", "")) // before & after each rune +} +``` + +```None +Output: + +3 +5 +``` + +Share +Format +Run + +#### func [Cut](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=1273) [¶](#Cut "Go to Cut") added in go1.18 + +```None +func Cut(s, sep string) (before, after string, found bool) +``` + +Cut slices s around the first instance of sep, +returning the text before and after sep. +The found result reports whether sep appears in s. +If sep does not appear in s, cut returns s, "", false. + +Example [¶](#example-Cut "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + show := func(s, sep string) { + before, after, found := strings.Cut(s, sep) + fmt.Printf("Cut(%q, %q) = %q, %q, %v\n", s, sep, before, after, found) + } + show("Gopher", "Go") + show("Gopher", "ph") + show("Gopher", "er") + show("Gopher", "Badger") +} +``` + +```None +Output: + +Cut("Gopher", "Go") = "", "pher", true +Cut("Gopher", "ph") = "Go", "er", true +Cut("Gopher", "er") = "Goph", "", true +Cut("Gopher", "Badger") = "Gopher", "", false +``` + +Share +Format +Run + +#### func [CutPrefix](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=1284) [¶](#CutPrefix "Go to CutPrefix") added in go1.20 + +```None +func CutPrefix(s, prefix string) (after string, found bool) +``` + +CutPrefix returns s without the provided leading prefix string +and reports whether it found the prefix. +If s doesn't start with prefix, CutPrefix returns s, false. +If prefix is the empty string, CutPrefix returns s, true. + +Example [¶](#example-CutPrefix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + show := func(s, sep string) { + after, found := strings.CutPrefix(s, sep) + fmt.Printf("CutPrefix(%q, %q) = %q, %v\n", s, sep, after, found) + } + show("Gopher", "Go") + show("Gopher", "ph") +} +``` + +```None +Output: + +CutPrefix("Gopher", "Go") = "pher", true +CutPrefix("Gopher", "ph") = "Gopher", false +``` + +Share +Format +Run + +#### func [CutSuffix](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=1295) [¶](#CutSuffix "Go to CutSuffix") added in go1.20 + +```None +func CutSuffix(s, suffix string) (before string, found bool) +``` + +CutSuffix returns s without the provided ending suffix string +and reports whether it found the suffix. +If s doesn't end with suffix, CutSuffix returns s, false. +If suffix is the empty string, CutSuffix returns s, true. + +Example [¶](#example-CutSuffix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + show := func(s, sep string) { + before, found := strings.CutSuffix(s, sep) + fmt.Printf("CutSuffix(%q, %q) = %q, %v\n", s, sep, before, found) + } + show("Gopher", "Go") + show("Gopher", "er") +} +``` + +```None +Output: + +CutSuffix("Gopher", "Go") = "Gopher", false +CutSuffix("Gopher", "er") = "Goph", true +``` + +Share +Format +Run + +#### func [EqualFold](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=1106) [¶](#EqualFold "Go to EqualFold") + +```None +func EqualFold(s, t string) bool +``` + +EqualFold reports whether s and t, interpreted as UTF-8 strings, +are equal under simple Unicode case-folding, which is a more general +form of case-insensitivity. + +Example [¶](#example-EqualFold "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.EqualFold("Go", "go")) + fmt.Println(strings.EqualFold("AB", "ab")) // true because comparison uses simple case-folding + fmt.Println(strings.EqualFold("ß", "ss")) // false because comparison does not use full case-folding +} +``` + +```None +Output: + +true +true +false +``` + +Share +Format +Run + +#### func [Fields](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=328) [¶](#Fields "Go to Fields") + +```None +func Fields(s string) []string +``` + +Fields splits the string s around each instance of one or more consecutive white space +characters, as defined by unicode.IsSpace, returning a slice of substrings of s or an +empty slice if s contains only white space. + +Example [¶](#example-Fields "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("Fields are: %q", strings.Fields(" foo bar baz ")) +} +``` + +```None +Output: + +Fields are: ["foo" "bar" "baz"] +``` + +Share +Format +Run + +#### func [FieldsFunc](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=383) [¶](#FieldsFunc "Go to FieldsFunc") + +```None +func FieldsFunc(s string, f func(rune) bool) []string +``` + +FieldsFunc splits the string s at each run of Unicode code points c satisfying f(c) +and returns an array of slices of s. If all code points in s satisfy f(c) or the +string is empty, an empty slice is returned. + +FieldsFunc makes no guarantees about the order in which it calls f(c) +and assumes that f always returns the same value for a given c. + +Example [¶](#example-FieldsFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + f := func(c rune) bool { + return !unicode.IsLetter(c) && !unicode.IsNumber(c) + } + fmt.Printf("Fields are: %q", strings.FieldsFunc(" foo1;bar2,baz3...", f)) +} +``` + +```None +Output: + +Fields are: ["foo1" "bar2" "baz3"] +``` + +Share +Format +Run + +#### func [HasPrefix](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=462) [¶](#HasPrefix "Go to HasPrefix") + +```None +func HasPrefix(s, prefix string) bool +``` + +HasPrefix reports whether the string s begins with prefix. + +Example [¶](#example-HasPrefix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.HasPrefix("Gopher", "Go")) + fmt.Println(strings.HasPrefix("Gopher", "C")) + fmt.Println(strings.HasPrefix("Gopher", "")) +} +``` + +```None +Output: + +true +false +true +``` + +Share +Format +Run + +#### func [HasSuffix](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=467) [¶](#HasSuffix "Go to HasSuffix") + +```None +func HasSuffix(s, suffix string) bool +``` + +HasSuffix reports whether the string s ends with suffix. + +Example [¶](#example-HasSuffix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.HasSuffix("Amigo", "go")) + fmt.Println(strings.HasSuffix("Amigo", "O")) + fmt.Println(strings.HasSuffix("Amigo", "Ami")) + fmt.Println(strings.HasSuffix("Amigo", "")) +} +``` + +```None +Output: + +true +false +false +true +``` + +Share +Format +Run + +#### func [Index](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=1189) [¶](#Index "Go to Index") + +```None +func Index(s, substr string) int +``` + +Index returns the index of the first instance of substr in s, or -1 if substr is not present in s. + +Example [¶](#example-Index "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Index("chicken", "ken")) + fmt.Println(strings.Index("chicken", "dmr")) +} +``` + +```None +Output: + +4 +-1 +``` + +Share +Format +Run + +#### func [IndexAny](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=145) [¶](#IndexAny "Go to IndexAny") + +```None +func IndexAny(s, chars string) int +``` + +IndexAny returns the index of the first instance of any Unicode code point +from chars in s, or -1 if no Unicode code point from chars is present in s. + +Example [¶](#example-IndexAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexAny("chicken", "aeiouy")) + fmt.Println(strings.IndexAny("crwth", "aeiouy")) +} +``` + +```None +Output: + +2 +-1 +``` + +Share +Format +Run + +#### func [IndexByte](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=117) [¶](#IndexByte "Go to IndexByte") added in go1.2 + +```None +func IndexByte(s string, c byte) int +``` + +IndexByte returns the index of the first instance of c in s, or -1 if c is not present in s. + +Example [¶](#example-IndexByte "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexByte("golang", 'g')) + fmt.Println(strings.IndexByte("gophers", 'h')) + fmt.Println(strings.IndexByte("golang", 'x')) +} +``` + +```None +Output: + +0 +3 +-1 +``` + +Share +Format +Run + +#### func [IndexFunc](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=825) [¶](#IndexFunc "Go to IndexFunc") + +```None +func IndexFunc(s string, f func(rune) bool) int +``` + +IndexFunc returns the index into s of the first Unicode +code point satisfying f(c), or -1 if none do. + +Example [¶](#example-IndexFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + f := func(c rune) bool { + return unicode.Is(unicode.Han, c) + } + fmt.Println(strings.IndexFunc("Hello, 世界", f)) + fmt.Println(strings.IndexFunc("Hello, world", f)) +} +``` + +```None +Output: + +7 +-1 +``` + +Share +Format +Run + +#### func [IndexRune](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=125) [¶](#IndexRune "Go to IndexRune") + +```None +func IndexRune(s string, r rune) int +``` + +IndexRune returns the index of the first instance of the Unicode code point +r, or -1 if rune is not present in s. +If r is utf8.RuneError, it returns the first instance of any +invalid UTF-8 byte sequence. + +Example [¶](#example-IndexRune "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexRune("chicken", 'k')) + fmt.Println(strings.IndexRune("chicken", 'd')) +} +``` + +```None +Output: + +4 +-1 +``` + +Share +Format +Run + +#### func [Join](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=429) [¶](#Join "Go to Join") + +```None +func Join(elems []string, sep string) string +``` + +Join concatenates the elements of its first argument to create a single string. The separator +string sep is placed between elements in the resulting string. + +Example [¶](#example-Join "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + s := []string{"foo", "bar", "baz"} + fmt.Println(strings.Join(s, ", ")) +} +``` + +```None +Output: + +foo, bar, baz +``` + +Share +Format +Run + +#### func [LastIndex](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=80) [¶](#LastIndex "Go to LastIndex") + +```None +func LastIndex(s, substr string) int +``` + +LastIndex returns the index of the last instance of substr in s, or -1 if substr is not present in s. + +Example [¶](#example-LastIndex "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Index("go gopher", "go")) + fmt.Println(strings.LastIndex("go gopher", "go")) + fmt.Println(strings.LastIndex("go gopher", "rodent")) +} +``` + +```None +Output: + +0 +3 +-1 +``` + +Share +Format +Run + +#### func [LastIndexAny](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=179) [¶](#LastIndexAny "Go to LastIndexAny") + +```None +func LastIndexAny(s, chars string) int +``` + +LastIndexAny returns the index of the last instance of any Unicode code +point from chars in s, or -1 if no Unicode code point from chars is +present in s. + +Example [¶](#example-LastIndexAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.LastIndexAny("go gopher", "go")) + fmt.Println(strings.LastIndexAny("go gopher", "rodent")) + fmt.Println(strings.LastIndexAny("go gopher", "fail")) +} +``` + +```None +Output: + +4 +8 +-1 +``` + +Share +Format +Run + +#### func [LastIndexByte](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=229) [¶](#LastIndexByte "Go to LastIndexByte") added in go1.5 + +```None +func LastIndexByte(s string, c byte) int +``` + +LastIndexByte returns the index of the last instance of c in s, or -1 if c is not present in s. + +Example [¶](#example-LastIndexByte "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.LastIndexByte("Hello, world", 'l')) + fmt.Println(strings.LastIndexByte("Hello, world", 'o')) + fmt.Println(strings.LastIndexByte("Hello, world", 'x')) +} +``` + +```None +Output: + +10 +8 +-1 +``` + +Share +Format +Run + +#### func [LastIndexFunc](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=831) [¶](#LastIndexFunc "Go to LastIndexFunc") + +```None +func LastIndexFunc(s string, f func(rune) bool) int +``` + +LastIndexFunc returns the index into s of the last +Unicode code point satisfying f(c), or -1 if none do. + +Example [¶](#example-LastIndexFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.LastIndexFunc("go 123", unicode.IsNumber)) + fmt.Println(strings.LastIndexFunc("123 go", unicode.IsNumber)) + fmt.Println(strings.LastIndexFunc("go", unicode.IsNumber)) +} +``` + +```None +Output: + +5 +2 +-1 +``` + +Share +Format +Run + +#### func [Map](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=474) [¶](#Map "Go to Map") + +```None +func Map(mapping func(rune) rune, s string) string +``` + +Map returns a copy of the string s with all its characters modified +according to the mapping function. If mapping returns a negative value, the character is +dropped from the string with no replacement. + +Example [¶](#example-Map "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + rot13 := func(r rune) rune { + switch { + case r >= 'A' && r <= 'Z': + return 'A' + (r-'A'+13)%26 + case r >= 'a' && r <= 'z': + return 'a' + (r-'a'+13)%26 + } + return r + } + fmt.Println(strings.Map(rot13, "'Twas brillig and the slithy gopher...")) +} +``` + +```None +Output: + +'Gjnf oevyyvt naq gur fyvgul tbcure... +``` + +Share +Format +Run + +#### func [Repeat](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=537) [¶](#Repeat "Go to Repeat") + +```None +func Repeat(s string, count int) string +``` + +Repeat returns a new string consisting of count copies of the string s. + +It panics if count is negative or if the result of (len(s) \* count) +overflows. + +Example [¶](#example-Repeat "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println("ba" + strings.Repeat("na", 2)) +} +``` + +```None +Output: + +banana +``` + +Share +Format +Run + +#### func [Replace](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=1060) [¶](#Replace "Go to Replace") + +```None +func Replace(s, old, new string, n int) string +``` + +Replace returns a copy of the string s with the first n +non-overlapping instances of old replaced by new. +If old is empty, it matches at the beginning of the string +and after each UTF-8 sequence, yielding up to k+1 replacements +for a k-rune string. +If n < 0, there is no limit on the number of replacements. + +Example [¶](#example-Replace "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Replace("oink oink oink", "k", "ky", 2)) + fmt.Println(strings.Replace("oink oink oink", "oink", "moo", -1)) +} +``` + +```None +Output: + +oinky oinky oink +moo moo moo +``` + +Share +Format +Run + +#### func [ReplaceAll](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=1099) [¶](#ReplaceAll "Go to ReplaceAll") added in go1.12 + +```None +func ReplaceAll(s, old, new string) string +``` + +ReplaceAll returns a copy of the string s with all +non-overlapping instances of old replaced by new. +If old is empty, it matches at the beginning of the string +and after each UTF-8 sequence, yielding up to k+1 replacements +for a k-rune string. + +Example [¶](#example-ReplaceAll "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ReplaceAll("oink oink oink", "oink", "moo")) +} +``` + +```None +Output: + +moo moo moo +``` + +Share +Format +Run + +#### func [Split](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=307) [¶](#Split "Go to Split") + +```None +func Split(s, sep string) []string +``` + +Split slices s into all substrings separated by sep and returns a slice of +the substrings between those separators. + +If s does not contain sep and sep is not empty, Split returns a +slice of length 1 whose only element is s. + +If sep is empty, Split splits after each UTF-8 sequence. If both s +and sep are empty, Split returns an empty slice. + +It is equivalent to [SplitN](#SplitN) with a count of -1. + +To split around the first instance of a separator, see Cut. + +Example [¶](#example-Split "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.Split("a,b,c", ",")) + fmt.Printf("%q\n", strings.Split("a man a plan a canal panama", "a ")) + fmt.Printf("%q\n", strings.Split(" xyz ", "")) + fmt.Printf("%q\n", strings.Split("", "Bernardo O'Higgins")) +} +``` + +```None +Output: + +["a" "b" "c"] +["" "man " "plan " "canal panama"] +[" " "x" "y" "z" " "] +[""] +``` + +Share +Format +Run + +#### func [SplitAfter](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=319) [¶](#SplitAfter "Go to SplitAfter") + +```None +func SplitAfter(s, sep string) []string +``` + +SplitAfter slices s into all substrings after each instance of sep and +returns a slice of those substrings. + +If s does not contain sep and sep is not empty, SplitAfter returns +a slice of length 1 whose only element is s. + +If sep is empty, SplitAfter splits after each UTF-8 sequence. If +both s and sep are empty, SplitAfter returns an empty slice. + +It is equivalent to [SplitAfterN](#SplitAfterN) with a count of -1. + +Example [¶](#example-SplitAfter "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitAfter("a,b,c", ",")) +} +``` + +```None +Output: + +["a," "b," "c"] +``` + +Share +Format +Run + +#### func [SplitAfterN](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=291) [¶](#SplitAfterN "Go to SplitAfterN") + +```None +func SplitAfterN(s, sep string, n int) []string +``` + +SplitAfterN slices s into substrings after each instance of sep and +returns a slice of those substrings. + +The count determines the number of substrings to return: + +```None +n > 0: at most n substrings; the last substring will be the unsplit remainder. +n == 0: the result is nil (zero substrings) +n < 0: all substrings +``` + +Edge cases for s and sep (for example, empty strings) are handled +as described in the documentation for SplitAfter. + +Example [¶](#example-SplitAfterN "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitAfterN("a,b,c", ",", 2)) +} +``` + +```None +Output: + +["a," "b,c"] +``` + +Share +Format +Run + +#### func [SplitN](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=278) [¶](#SplitN "Go to SplitN") + +```None +func SplitN(s, sep string, n int) []string +``` + +SplitN slices s into substrings separated by sep and returns a slice of +the substrings between those separators. + +The count determines the number of substrings to return: + +```None +n > 0: at most n substrings; the last substring will be the unsplit remainder. +n == 0: the result is nil (zero substrings) +n < 0: all substrings +``` + +Edge cases for s and sep (for example, empty strings) are handled +as described in the documentation for [Split](#Split). + +To split around the first instance of a separator, see Cut. + +Example [¶](#example-SplitN "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitN("a,b,c", ",", 2)) + z := strings.SplitN("a,b,c", ",", 0) + fmt.Printf("%q (nil = %v)\n", z, z == nil) +} +``` + +```None +Output: + +["a" "b,c"] +[] (nil = true) +``` + +Share +Format +Run + +#### func [Title](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=777) deprecated + +```None +func Title(s string) string +``` + +Title returns a copy of the string s with all Unicode letters that begin words +mapped to their Unicode title case. + +Deprecated: The rule Title uses for word boundaries does not handle Unicode +punctuation properly. Use golang.org/x/text/cases instead. + +Example [¶](#example-Title "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Compare this example to the ToTitle example. + fmt.Println(strings.Title("her royal highness")) + fmt.Println(strings.Title("loud noises")) + fmt.Println(strings.Title("хлеб")) +} +``` + +```None +Output: + +Her Royal Highness +Loud Noises +Хлеб +``` + +Share +Format +Run + +#### func [ToLower](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=636) [¶](#ToLower "Go to ToLower") + +```None +func ToLower(s string) string +``` + +ToLower returns s with all Unicode letters mapped to their lower case. + +Example [¶](#example-ToLower "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ToLower("Gopher")) +} +``` + +```None +Output: + +gopher +``` + +Share +Format +Run + +#### func [ToLowerSpecial](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=687) [¶](#ToLowerSpecial "Go to ToLowerSpecial") + +```None +func ToLowerSpecial(c unicode.SpecialCase, s string) string +``` + +ToLowerSpecial returns a copy of the string s with all Unicode letters mapped to their +lower case using the case mapping specified by c. + +Example [¶](#example-ToLowerSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToLowerSpecial(unicode.TurkishCase, "Önnek İş")) +} +``` + +```None +Output: + +önnek iş +``` + +Share +Format +Run + +#### func [ToTitle](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=677) [¶](#ToTitle "Go to ToTitle") + +```None +func ToTitle(s string) string +``` + +ToTitle returns a copy of the string s with all Unicode letters mapped to +their Unicode title case. + +Example [¶](#example-ToTitle "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Compare this example to the Title example. + fmt.Println(strings.ToTitle("her royal highness")) + fmt.Println(strings.ToTitle("loud noises")) + fmt.Println(strings.ToTitle("хлеб")) +} +``` + +```None +Output: + +HER ROYAL HIGHNESS +LOUD NOISES +ХЛЕБ +``` + +Share +Format +Run + +#### func [ToTitleSpecial](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=693) [¶](#ToTitleSpecial "Go to ToTitleSpecial") + +```None +func ToTitleSpecial(c unicode.SpecialCase, s string) string +``` + +ToTitleSpecial returns a copy of the string s with all Unicode letters mapped to their +Unicode title case, giving priority to the special casing rules. + +Example [¶](#example-ToTitleSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToTitleSpecial(unicode.TurkishCase, "dünyanın ilk borsa yapısı Aizonai kabul edilir")) +} +``` + +```None +Output: + +DÜNYANIN İLK BORSA YAPISI AİZONAİ KABUL EDİLİR +``` + +Share +Format +Run + +#### func [ToUpper](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=596) [¶](#ToUpper "Go to ToUpper") + +```None +func ToUpper(s string) string +``` + +ToUpper returns s with all Unicode letters mapped to their upper case. + +Example [¶](#example-ToUpper "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ToUpper("Gopher")) +} +``` + +```None +Output: + +GOPHER +``` + +Share +Format +Run + +#### func [ToUpperSpecial](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=681) [¶](#ToUpperSpecial "Go to ToUpperSpecial") + +```None +func ToUpperSpecial(c unicode.SpecialCase, s string) string +``` + +ToUpperSpecial returns a copy of the string s with all Unicode letters mapped to their +upper case using the case mapping specified by c. + +Example [¶](#example-ToUpperSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToUpperSpecial(unicode.TurkishCase, "örnek iş")) +} +``` + +```None +Output: + +ÖRNEK İŞ +``` + +Share +Format +Run + +#### func [ToValidUTF8](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=699) [¶](#ToValidUTF8 "Go to ToValidUTF8") added in go1.13 + +```None +func ToValidUTF8(s, replacement string) string +``` + +ToValidUTF8 returns a copy of the string s with each run of invalid UTF-8 byte sequences +replaced by the replacement string, which may be empty. + +Example [¶](#example-ToValidUTF8 "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%s\n", strings.ToValidUTF8("abc", "\uFFFD")) + fmt.Printf("%s\n", strings.ToValidUTF8("a\xffb\xC0\xAFc\xff", "")) + fmt.Printf("%s\n", strings.ToValidUTF8("\xed\xa0\x80", "abc")) +} +``` + +```None +Output: + +abc +abc +abc +``` + +Share +Format +Run + +#### func [Trim](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=891) [¶](#Trim "Go to Trim") + +```None +func Trim(s, cutset string) string +``` + +Trim returns a slice of the string s with all leading and +trailing Unicode code points contained in cutset removed. + +Example [¶](#example-Trim "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.Trim("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimFunc](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=819) [¶](#TrimFunc "Go to TrimFunc") + +```None +func TrimFunc(s string, f func(rune) bool) string +``` + +TrimFunc returns a slice of the string s with all leading +and trailing Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimLeft](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=908) [¶](#TrimLeft "Go to TrimLeft") + +```None +func TrimLeft(s, cutset string) string +``` + +TrimLeft returns a slice of the string s with all leading +Unicode code points contained in cutset removed. + +To remove a prefix, use [TrimPrefix](#TrimPrefix) instead. + +Example [¶](#example-TrimLeft "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.TrimLeft("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +Hello, Gophers!!! +``` + +Share +Format +Run + +#### func [TrimLeftFunc](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=796) [¶](#TrimLeftFunc "Go to TrimLeftFunc") + +```None +func TrimLeftFunc(s string, f func(rune) bool) string +``` + +TrimLeftFunc returns a slice of the string s with all leading +Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimLeftFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimLeftFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +Hello, Gophers!!! +``` + +Share +Format +Run + +#### func [TrimPrefix](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=1038) [¶](#TrimPrefix "Go to TrimPrefix") added in go1.1 + +```None +func TrimPrefix(s, prefix string) string +``` + +TrimPrefix returns s without the provided leading prefix string. +If s doesn't start with prefix, s is returned unchanged. + +Example [¶](#example-TrimPrefix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var s = "¡¡¡Hello, Gophers!!!" + s = strings.TrimPrefix(s, "¡¡¡Hello, ") + s = strings.TrimPrefix(s, "¡¡¡Howdy, ") + fmt.Print(s) +} +``` + +```None +Output: + +Gophers!!! +``` + +Share +Format +Run + +#### func [TrimRight](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=956) [¶](#TrimRight "Go to TrimRight") + +```None +func TrimRight(s, cutset string) string +``` + +TrimRight returns a slice of the string s, with all trailing +Unicode code points contained in cutset removed. + +To remove a suffix, use [TrimSuffix](#TrimSuffix) instead. + +Example [¶](#example-TrimRight "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.TrimRight("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +¡¡¡Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimRightFunc](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=806) [¶](#TrimRightFunc "Go to TrimRightFunc") + +```None +func TrimRightFunc(s string, f func(rune) bool) string +``` + +TrimRightFunc returns a slice of the string s with all trailing +Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimRightFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimRightFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +¡¡¡Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimSpace](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=1002) [¶](#TrimSpace "Go to TrimSpace") + +```None +func TrimSpace(s string) string +``` + +TrimSpace returns a slice of the string s, with all leading +and trailing white space removed, as defined by Unicode. + +Example [¶](#example-TrimSpace "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.TrimSpace(" \t\n Hello, Gophers \n\t\r\n")) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimSuffix](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/strings.go;l=1047) [¶](#TrimSuffix "Go to TrimSuffix") added in go1.1 + +```None +func TrimSuffix(s, suffix string) string +``` + +TrimSuffix returns s without the provided trailing suffix string. +If s doesn't end with suffix, s is returned unchanged. + +Example [¶](#example-TrimSuffix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var s = "¡¡¡Hello, Gophers!!!" + s = strings.TrimSuffix(s, ", Gophers!!!") + s = strings.TrimSuffix(s, ", Marmots!!!") + fmt.Print(s) +} +``` + +```None +Output: + +¡¡¡Hello +``` + +Share +Format +Run + +### Types [¶](#pkg-types "Go to Types") + +#### type [Builder](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/builder.go;l=16) [¶](#Builder "Go to Builder") added in go1.10 + +```None +type Builder struct { + // contains filtered or unexported fields +} +``` + +A Builder is used to efficiently build a string using [Builder.Write](#Builder.Write) methods. +It minimizes memory copying. The zero value is ready to use. +Do not copy a non-zero Builder. + +Example [¶](#example-Builder "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var b strings.Builder + for i := 3; i >= 1; i-- { + fmt.Fprintf(&b, "%d...", i) + } + b.WriteString("ignition") + fmt.Println(b.String()) + +} +``` + +```None +Output: + +3...2...1...ignition +``` + +Share +Format +Run + +#### func (\*Builder) [Cap](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/builder.go;l=58) [¶](#Builder.Cap "Go to Builder.Cap") added in go1.12 + +```None +func (b *Builder) Cap() int +``` + +Cap returns the capacity of the builder's underlying byte slice. It is the +total space allocated for the string being built and includes any bytes +already written. + +#### func (\*Builder) [Grow](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/builder.go;l=77) [¶](#Builder.Grow "Go to Builder.Grow") added in go1.10 + +```None +func (b *Builder) Grow(n int) +``` + +Grow grows b's capacity, if necessary, to guarantee space for +another n bytes. After Grow(n), at least n bytes can be written to b +without another allocation. If n is negative, Grow panics. + +#### func (\*Builder) [Len](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/builder.go;l=53) [¶](#Builder.Len "Go to Builder.Len") added in go1.10 + +```None +func (b *Builder) Len() int +``` + +Len returns the number of accumulated bytes; b.Len() == len(b.String()). + +#### func (\*Builder) [Reset](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/builder.go;l=61) [¶](#Builder.Reset "Go to Builder.Reset") added in go1.10 + +```None +func (b *Builder) Reset() +``` + +Reset resets the [Builder](#Builder) to be empty. + +#### func (\*Builder) [String](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/builder.go;l=48) [¶](#Builder.String "Go to Builder.String") added in go1.10 + +```None +func (b *Builder) String() string +``` + +String returns the accumulated string. + +#### func (\*Builder) [Write](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/builder.go;l=89) [¶](#Builder.Write "Go to Builder.Write") added in go1.10 + +```None +func (b *Builder) Write(p []byte) (int, error) +``` + +Write appends the contents of p to b's buffer. +Write always returns len(p), nil. + +#### func (\*Builder) [WriteByte](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/builder.go;l=97) [¶](#Builder.WriteByte "Go to Builder.WriteByte") added in go1.10 + +```None +func (b *Builder) WriteByte(c byte) error +``` + +WriteByte appends the byte c to b's buffer. +The returned error is always nil. + +#### func (\*Builder) [WriteRune](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/builder.go;l=105) [¶](#Builder.WriteRune "Go to Builder.WriteRune") added in go1.10 + +```None +func (b *Builder) WriteRune(r rune) (int, error) +``` + +WriteRune appends the UTF-8 encoding of Unicode code point r to b's buffer. +It returns the length of r and a nil error. + +#### func (\*Builder) [WriteString](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/builder.go;l=114) [¶](#Builder.WriteString "Go to Builder.WriteString") added in go1.10 + +```None +func (b *Builder) WriteString(s string) (int, error) +``` + +WriteString appends the contents of s to b's buffer. +It returns the length of s and a nil error. + +#### type [Reader](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/reader.go;l=17) [¶](#Reader "Go to Reader") + +```None +type Reader struct { + // contains filtered or unexported fields +} +``` + +A Reader implements the [io.Reader](/io#Reader), [io.ReaderAt](/io#ReaderAt), [io.ByteReader](/io#ByteReader), [io.ByteScanner](/io#ByteScanner), +[io.RuneReader](/io#RuneReader), [io.RuneScanner](/io#RuneScanner), [io.Seeker](/io#Seeker), and [io.WriterTo](/io#WriterTo) interfaces by reading +from a string. +The zero value for Reader operates like a Reader of an empty string. + +#### func [NewReader](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/reader.go;l=160) [¶](#NewReader "Go to NewReader") + +```None +func NewReader(s string) *Reader +``` + +NewReader returns a new [Reader](#Reader) reading from s. +It is similar to [bytes.NewBufferString](/bytes#NewBufferString) but more efficient and non-writable. + +#### func (\*Reader) [Len](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/reader.go;l=25) [¶](#Reader.Len "Go to Reader.Len") + +```None +func (r *Reader) Len() int +``` + +Len returns the number of bytes of the unread portion of the +string. + +#### func (\*Reader) [Read](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/reader.go;l=39) [¶](#Reader.Read "Go to Reader.Read") + +```None +func (r *Reader) Read(b []byte) (n int, err error) +``` + +Read implements the [io.Reader](/io#Reader) interface. + +#### func (\*Reader) [ReadAt](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/reader.go;l=50) [¶](#Reader.ReadAt "Go to Reader.ReadAt") + +```None +func (r *Reader) ReadAt(b []byte, off int64) (n int, err error) +``` + +ReadAt implements the [io.ReaderAt](/io#ReaderAt) interface. + +#### func (\*Reader) [ReadByte](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/reader.go;l=66) [¶](#Reader.ReadByte "Go to Reader.ReadByte") + +```None +func (r *Reader) ReadByte() (byte, error) +``` + +ReadByte implements the [io.ByteReader](/io#ByteReader) interface. + +#### func (\*Reader) [ReadRune](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/reader.go;l=87) [¶](#Reader.ReadRune "Go to Reader.ReadRune") + +```None +func (r *Reader) ReadRune() (ch rune, size int, err error) +``` + +ReadRune implements the [io.RuneReader](/io#RuneReader) interface. + +#### func (\*Reader) [Reset](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/reader.go;l=156) [¶](#Reader.Reset "Go to Reader.Reset") added in go1.7 + +```None +func (r *Reader) Reset(s string) +``` + +Reset resets the [Reader](#Reader) to be reading from s. + +#### func (\*Reader) [Seek](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/reader.go;l=116) [¶](#Reader.Seek "Go to Reader.Seek") + +```None +func (r *Reader) Seek(offset int64, whence int) (int64, error) +``` + +Seek implements the [io.Seeker](/io#Seeker) interface. + +#### func (\*Reader) [Size](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/reader.go;l=36) [¶](#Reader.Size "Go to Reader.Size") added in go1.5 + +```None +func (r *Reader) Size() int64 +``` + +Size returns the original length of the underlying string. +Size is the number of bytes available for reading via [Reader.ReadAt](#Reader.ReadAt). +The returned value is always the same and is not affected by calls +to any other method. + +#### func (\*Reader) [UnreadByte](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/reader.go;l=77) [¶](#Reader.UnreadByte "Go to Reader.UnreadByte") + +```None +func (r *Reader) UnreadByte() error +``` + +UnreadByte implements the [io.ByteScanner](/io#ByteScanner) interface. + +#### func (\*Reader) [UnreadRune](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/reader.go;l=103) [¶](#Reader.UnreadRune "Go to Reader.UnreadRune") + +```None +func (r *Reader) UnreadRune() error +``` + +UnreadRune implements the [io.RuneScanner](/io#RuneScanner) interface. + +#### func (\*Reader) [WriteTo](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/reader.go;l=137) [¶](#Reader.WriteTo "Go to Reader.WriteTo") added in go1.1 + +```None +func (r *Reader) WriteTo(w io.Writer) (n int64, err error) +``` + +WriteTo implements the [io.WriterTo](/io#WriterTo) interface. + +#### type [Replacer](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/replace.go;l=14) [¶](#Replacer "Go to Replacer") + +```None +type Replacer struct { + // contains filtered or unexported fields +} +``` + +Replacer replaces a list of strings with replacements. +It is safe for concurrent use by multiple goroutines. + +#### func [NewReplacer](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/replace.go;l=32) [¶](#NewReplacer "Go to NewReplacer") + +```None +func NewReplacer(oldnew ...string) *Replacer +``` + +NewReplacer returns a new [Replacer](#Replacer) from a list of old, new string +pairs. Replacements are performed in the order they appear in the +target string, without overlapping matches. The old string +comparisons are done in argument order. + +NewReplacer panics if given an odd number of arguments. + +Example [¶](#example-NewReplacer "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + r := strings.NewReplacer("<", "<", ">", ">") + fmt.Println(r.Replace("This is HTML!")) +} +``` + +```None +Output: + +This is <b>HTML</b>! +``` + +Share +Format +Run + +#### func (\*Replacer) [Replace](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/replace.go;l=95) [¶](#Replacer.Replace "Go to Replacer.Replace") + +```None +func (r *Replacer) Replace(s string) string +``` + +Replace returns a copy of s with all replacements performed. + +#### func (\*Replacer) [WriteString](https://cs.opensource.google/go/go/+/go1.22.0:src/strings/replace.go;l=101) [¶](#Replacer.WriteString "Go to Replacer.WriteString") + +```None +func (r *Replacer) WriteString(w io.Writer, s string) (n int, err error) +``` + +WriteString writes s to w with all replacements performed. diff --git a/corpus/docs/golang/strings/strings_go1230.md b/corpus/docs/golang/strings/strings_go1230.md new file mode 100644 index 0000000000000000000000000000000000000000..57d7d47d7e677e7d0a3528840252ccebcf705fbf --- /dev/null +++ b/corpus/docs/golang/strings/strings_go1230.md @@ -0,0 +1,2394 @@ +# Golang - strings + +Source: https://pkg.go.dev/strings@go1.23.0 +Version: go1.23.0 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package strings implements simple functions to manipulate UTF-8 encoded strings. + +For information about UTF-8 strings in Go, see . + +### Index [¶](#pkg-index "Go to Index") + +* [func Clone(s string) string](#Clone) +* [func Compare(a, b string) int](#Compare) +* [func Contains(s, substr string) bool](#Contains) +* [func ContainsAny(s, chars string) bool](#ContainsAny) +* [func ContainsFunc(s string, f func(rune) bool) bool](#ContainsFunc) +* [func ContainsRune(s string, r rune) bool](#ContainsRune) +* [func Count(s, substr string) int](#Count) +* [func Cut(s, sep string) (before, after string, found bool)](#Cut) +* [func CutPrefix(s, prefix string) (after string, found bool)](#CutPrefix) +* [func CutSuffix(s, suffix string) (before string, found bool)](#CutSuffix) +* [func EqualFold(s, t string) bool](#EqualFold) +* [func Fields(s string) []string](#Fields) +* [func FieldsFunc(s string, f func(rune) bool) []string](#FieldsFunc) +* [func HasPrefix(s, prefix string) bool](#HasPrefix) +* [func HasSuffix(s, suffix string) bool](#HasSuffix) +* [func Index(s, substr string) int](#Index) +* [func IndexAny(s, chars string) int](#IndexAny) +* [func IndexByte(s string, c byte) int](#IndexByte) +* [func IndexFunc(s string, f func(rune) bool) int](#IndexFunc) +* [func IndexRune(s string, r rune) int](#IndexRune) +* [func Join(elems []string, sep string) string](#Join) +* [func LastIndex(s, substr string) int](#LastIndex) +* [func LastIndexAny(s, chars string) int](#LastIndexAny) +* [func LastIndexByte(s string, c byte) int](#LastIndexByte) +* [func LastIndexFunc(s string, f func(rune) bool) int](#LastIndexFunc) +* [func Map(mapping func(rune) rune, s string) string](#Map) +* [func Repeat(s string, count int) string](#Repeat) +* [func Replace(s, old, new string, n int) string](#Replace) +* [func ReplaceAll(s, old, new string) string](#ReplaceAll) +* [func Split(s, sep string) []string](#Split) +* [func SplitAfter(s, sep string) []string](#SplitAfter) +* [func SplitAfterN(s, sep string, n int) []string](#SplitAfterN) +* [func SplitN(s, sep string, n int) []string](#SplitN) +* [func Title(s string) string](#Title)deprecated +* [func ToLower(s string) string](#ToLower) +* [func ToLowerSpecial(c unicode.SpecialCase, s string) string](#ToLowerSpecial) +* [func ToTitle(s string) string](#ToTitle) +* [func ToTitleSpecial(c unicode.SpecialCase, s string) string](#ToTitleSpecial) +* [func ToUpper(s string) string](#ToUpper) +* [func ToUpperSpecial(c unicode.SpecialCase, s string) string](#ToUpperSpecial) +* [func ToValidUTF8(s, replacement string) string](#ToValidUTF8) +* [func Trim(s, cutset string) string](#Trim) +* [func TrimFunc(s string, f func(rune) bool) string](#TrimFunc) +* [func TrimLeft(s, cutset string) string](#TrimLeft) +* [func TrimLeftFunc(s string, f func(rune) bool) string](#TrimLeftFunc) +* [func TrimPrefix(s, prefix string) string](#TrimPrefix) +* [func TrimRight(s, cutset string) string](#TrimRight) +* [func TrimRightFunc(s string, f func(rune) bool) string](#TrimRightFunc) +* [func TrimSpace(s string) string](#TrimSpace) +* [func TrimSuffix(s, suffix string) string](#TrimSuffix) +* [type Builder](#Builder) +* + [func (b \*Builder) Cap() int](#Builder.Cap) + + [func (b \*Builder) Grow(n int)](#Builder.Grow) + + [func (b \*Builder) Len() int](#Builder.Len) + + [func (b \*Builder) Reset()](#Builder.Reset) + + [func (b \*Builder) String() string](#Builder.String) + + [func (b \*Builder) Write(p []byte) (int, error)](#Builder.Write) + + [func (b \*Builder) WriteByte(c byte) error](#Builder.WriteByte) + + [func (b \*Builder) WriteRune(r rune) (int, error)](#Builder.WriteRune) + + [func (b \*Builder) WriteString(s string) (int, error)](#Builder.WriteString) +* [type Reader](#Reader) +* + [func NewReader(s string) \*Reader](#NewReader) +* + [func (r \*Reader) Len() int](#Reader.Len) + + [func (r \*Reader) Read(b []byte) (n int, err error)](#Reader.Read) + + [func (r \*Reader) ReadAt(b []byte, off int64) (n int, err error)](#Reader.ReadAt) + + [func (r \*Reader) ReadByte() (byte, error)](#Reader.ReadByte) + + [func (r \*Reader) ReadRune() (ch rune, size int, err error)](#Reader.ReadRune) + + [func (r \*Reader) Reset(s string)](#Reader.Reset) + + [func (r \*Reader) Seek(offset int64, whence int) (int64, error)](#Reader.Seek) + + [func (r \*Reader) Size() int64](#Reader.Size) + + [func (r \*Reader) UnreadByte() error](#Reader.UnreadByte) + + [func (r \*Reader) UnreadRune() error](#Reader.UnreadRune) + + [func (r \*Reader) WriteTo(w io.Writer) (n int64, err error)](#Reader.WriteTo) +* [type Replacer](#Replacer) +* + [func NewReplacer(oldnew ...string) \*Replacer](#NewReplacer) +* + [func (r \*Replacer) Replace(s string) string](#Replacer.Replace) + + [func (r \*Replacer) WriteString(w io.Writer, s string) (n int, err error)](#Replacer.WriteString) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Builder](#example-Builder) +* [Clone](#example-Clone) +* [Compare](#example-Compare) +* [Contains](#example-Contains) +* [ContainsAny](#example-ContainsAny) +* [ContainsFunc](#example-ContainsFunc) +* [ContainsRune](#example-ContainsRune) +* [Count](#example-Count) +* [Cut](#example-Cut) +* [CutPrefix](#example-CutPrefix) +* [CutSuffix](#example-CutSuffix) +* [EqualFold](#example-EqualFold) +* [Fields](#example-Fields) +* [FieldsFunc](#example-FieldsFunc) +* [HasPrefix](#example-HasPrefix) +* [HasSuffix](#example-HasSuffix) +* [Index](#example-Index) +* [IndexAny](#example-IndexAny) +* [IndexByte](#example-IndexByte) +* [IndexFunc](#example-IndexFunc) +* [IndexRune](#example-IndexRune) +* [Join](#example-Join) +* [LastIndex](#example-LastIndex) +* [LastIndexAny](#example-LastIndexAny) +* [LastIndexByte](#example-LastIndexByte) +* [LastIndexFunc](#example-LastIndexFunc) +* [Map](#example-Map) +* [NewReplacer](#example-NewReplacer) +* [Repeat](#example-Repeat) +* [Replace](#example-Replace) +* [ReplaceAll](#example-ReplaceAll) +* [Split](#example-Split) +* [SplitAfter](#example-SplitAfter) +* [SplitAfterN](#example-SplitAfterN) +* [SplitN](#example-SplitN) +* [Title](#example-Title) +* [ToLower](#example-ToLower) +* [ToLowerSpecial](#example-ToLowerSpecial) +* [ToTitle](#example-ToTitle) +* [ToTitleSpecial](#example-ToTitleSpecial) +* [ToUpper](#example-ToUpper) +* [ToUpperSpecial](#example-ToUpperSpecial) +* [ToValidUTF8](#example-ToValidUTF8) +* [Trim](#example-Trim) +* [TrimFunc](#example-TrimFunc) +* [TrimLeft](#example-TrimLeft) +* [TrimLeftFunc](#example-TrimLeftFunc) +* [TrimPrefix](#example-TrimPrefix) +* [TrimRight](#example-TrimRight) +* [TrimRightFunc](#example-TrimRightFunc) +* [TrimSpace](#example-TrimSpace) +* [TrimSuffix](#example-TrimSuffix) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [Clone](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/clone.go;l=21) [¶](#Clone "Go to Clone") added in go1.18 + +```None +func Clone(s string) string +``` + +Clone returns a fresh copy of s. +It guarantees to make a copy of s into a new allocation, +which can be important when retaining only a small substring +of a much larger string. Using Clone can help such programs +use less memory. Of course, since using Clone makes a copy, +overuse of Clone can make programs use more memory. +Clone should typically be used only rarely, and only when +profiling indicates that it is needed. +For strings of length zero the string "" will be returned +and no allocation is made. + +Example [¶](#example-Clone "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unsafe" +) + +func main() { + s := "abc" + clone := strings.Clone(s) + fmt.Println(s == clone) + fmt.Println(unsafe.StringData(s) == unsafe.StringData(clone)) +} +``` + +```None +Output: + +true +false +``` + +Share +Format +Run + +#### func [Compare](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/compare.go;l=15) [¶](#Compare "Go to Compare") added in go1.5 + +```None +func Compare(a, b string) int +``` + +Compare returns an integer comparing two strings lexicographically. +The result will be 0 if a == b, -1 if a < b, and +1 if a > b. + +Use Compare when you need to perform a three-way comparison (with +[slices.SortFunc](/slices#SortFunc), for example). It is usually clearer and always faster +to use the built-in string comparison operators ==, <, >, and so on. + +Example [¶](#example-Compare "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Compare("a", "b")) + fmt.Println(strings.Compare("a", "a")) + fmt.Println(strings.Compare("b", "a")) +} +``` + +```None +Output: + +-1 +0 +1 +``` + +Share +Format +Run + +#### func [Contains](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=61) [¶](#Contains "Go to Contains") + +```None +func Contains(s, substr string) bool +``` + +Contains reports whether substr is within s. + +Example [¶](#example-Contains "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Contains("seafood", "foo")) + fmt.Println(strings.Contains("seafood", "bar")) + fmt.Println(strings.Contains("seafood", "")) + fmt.Println(strings.Contains("", "")) +} +``` + +```None +Output: + +true +false +true +true +``` + +Share +Format +Run + +#### func [ContainsAny](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=66) [¶](#ContainsAny "Go to ContainsAny") + +```None +func ContainsAny(s, chars string) bool +``` + +ContainsAny reports whether any Unicode code points in chars are within s. + +Example [¶](#example-ContainsAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ContainsAny("team", "i")) + fmt.Println(strings.ContainsAny("fail", "ui")) + fmt.Println(strings.ContainsAny("ure", "ui")) + fmt.Println(strings.ContainsAny("failure", "ui")) + fmt.Println(strings.ContainsAny("foo", "")) + fmt.Println(strings.ContainsAny("", "")) +} +``` + +```None +Output: + +false +true +true +true +false +false +``` + +Share +Format +Run + +#### func [ContainsFunc](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=76) [¶](#ContainsFunc "Go to ContainsFunc") added in go1.21.0 + +```None +func ContainsFunc(s string, f func(rune) bool) bool +``` + +ContainsFunc reports whether any Unicode code points r within s satisfy f(r). + +Example [¶](#example-ContainsFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + f := func(r rune) bool { + return r == 'a' || r == 'e' || r == 'i' || r == 'o' || r == 'u' + } + fmt.Println(strings.ContainsFunc("hello", f)) + fmt.Println(strings.ContainsFunc("rhythms", f)) +} +``` + +```None +Output: + +true +false +``` + +Share +Format +Run + +#### func [ContainsRune](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=71) [¶](#ContainsRune "Go to ContainsRune") + +```None +func ContainsRune(s string, r rune) bool +``` + +ContainsRune reports whether the Unicode code point r is within s. + +Example [¶](#example-ContainsRune "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Finds whether a string contains a particular Unicode code point. + // The code point for the lowercase letter "a", for example, is 97. + fmt.Println(strings.ContainsRune("aardvark", 97)) + fmt.Println(strings.ContainsRune("timeout", 97)) +} +``` + +```None +Output: + +true +false +``` + +Share +Format +Run + +#### func [Count](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=41) [¶](#Count "Go to Count") + +```None +func Count(s, substr string) int +``` + +Count counts the number of non-overlapping instances of substr in s. +If substr is an empty string, Count returns 1 + the number of Unicode code points in s. + +Example [¶](#example-Count "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Count("cheese", "e")) + fmt.Println(strings.Count("five", "")) // before & after each rune +} +``` + +```None +Output: + +3 +5 +``` + +Share +Format +Run + +#### func [Cut](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=1228) [¶](#Cut "Go to Cut") added in go1.18 + +```None +func Cut(s, sep string) (before, after string, found bool) +``` + +Cut slices s around the first instance of sep, +returning the text before and after sep. +The found result reports whether sep appears in s. +If sep does not appear in s, cut returns s, "", false. + +Example [¶](#example-Cut "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + show := func(s, sep string) { + before, after, found := strings.Cut(s, sep) + fmt.Printf("Cut(%q, %q) = %q, %q, %v\n", s, sep, before, after, found) + } + show("Gopher", "Go") + show("Gopher", "ph") + show("Gopher", "er") + show("Gopher", "Badger") +} +``` + +```None +Output: + +Cut("Gopher", "Go") = "", "pher", true +Cut("Gopher", "ph") = "Go", "er", true +Cut("Gopher", "er") = "Goph", "", true +Cut("Gopher", "Badger") = "Gopher", "", false +``` + +Share +Format +Run + +#### func [CutPrefix](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=1236) [¶](#CutPrefix "Go to CutPrefix") added in go1.20 + +```None +func CutPrefix(s, prefix string) (after string, found bool) +``` + +CutPrefix returns s without the provided leading prefix string +and reports whether it found the prefix. +If s doesn't start with prefix, CutPrefix returns s, false. +If prefix is the empty string, CutPrefix returns s, true. + +Example [¶](#example-CutPrefix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + show := func(s, sep string) { + after, found := strings.CutPrefix(s, sep) + fmt.Printf("CutPrefix(%q, %q) = %q, %v\n", s, sep, after, found) + } + show("Gopher", "Go") + show("Gopher", "ph") +} +``` + +```None +Output: + +CutPrefix("Gopher", "Go") = "pher", true +CutPrefix("Gopher", "ph") = "Gopher", false +``` + +Share +Format +Run + +#### func [CutSuffix](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=1244) [¶](#CutSuffix "Go to CutSuffix") added in go1.20 + +```None +func CutSuffix(s, suffix string) (before string, found bool) +``` + +CutSuffix returns s without the provided ending suffix string +and reports whether it found the suffix. +If s doesn't end with suffix, CutSuffix returns s, false. +If suffix is the empty string, CutSuffix returns s, true. + +Example [¶](#example-CutSuffix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + show := func(s, sep string) { + before, found := strings.CutSuffix(s, sep) + fmt.Printf("CutSuffix(%q, %q) = %q, %v\n", s, sep, before, found) + } + show("Gopher", "Go") + show("Gopher", "er") +} +``` + +```None +Output: + +CutSuffix("Gopher", "Go") = "Gopher", false +CutSuffix("Gopher", "er") = "Goph", true +``` + +Share +Format +Run + +#### func [EqualFold](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=1137) [¶](#EqualFold "Go to EqualFold") + +```None +func EqualFold(s, t string) bool +``` + +EqualFold reports whether s and t, interpreted as UTF-8 strings, +are equal under simple Unicode case-folding, which is a more general +form of case-insensitivity. + +Example [¶](#example-EqualFold "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.EqualFold("Go", "go")) + fmt.Println(strings.EqualFold("AB", "ab")) // true because comparison uses simple case-folding + fmt.Println(strings.EqualFold("ß", "ss")) // false because comparison does not use full case-folding +} +``` + +```None +Output: + +true +true +false +``` + +Share +Format +Run + +#### func [Fields](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=327) [¶](#Fields "Go to Fields") + +```None +func Fields(s string) []string +``` + +Fields splits the string s around each instance of one or more consecutive white space +characters, as defined by [unicode.IsSpace](/unicode#IsSpace), returning a slice of substrings of s or an +empty slice if s contains only white space. + +Example [¶](#example-Fields "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("Fields are: %q", strings.Fields(" foo bar baz ")) +} +``` + +```None +Output: + +Fields are: ["foo" "bar" "baz"] +``` + +Share +Format +Run + +#### func [FieldsFunc](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=382) [¶](#FieldsFunc "Go to FieldsFunc") + +```None +func FieldsFunc(s string, f func(rune) bool) []string +``` + +FieldsFunc splits the string s at each run of Unicode code points c satisfying f(c) +and returns an array of slices of s. If all code points in s satisfy f(c) or the +string is empty, an empty slice is returned. + +FieldsFunc makes no guarantees about the order in which it calls f(c) +and assumes that f always returns the same value for a given c. + +Example [¶](#example-FieldsFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + f := func(c rune) bool { + return !unicode.IsLetter(c) && !unicode.IsNumber(c) + } + fmt.Printf("Fields are: %q", strings.FieldsFunc(" foo1;bar2,baz3...", f)) +} +``` + +```None +Output: + +Fields are: ["foo1" "bar2" "baz3"] +``` + +Share +Format +Run + +#### func [HasPrefix](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=461) [¶](#HasPrefix "Go to HasPrefix") + +```None +func HasPrefix(s, prefix string) bool +``` + +HasPrefix reports whether the string s begins with prefix. + +Example [¶](#example-HasPrefix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.HasPrefix("Gopher", "Go")) + fmt.Println(strings.HasPrefix("Gopher", "C")) + fmt.Println(strings.HasPrefix("Gopher", "")) +} +``` + +```None +Output: + +true +false +true +``` + +Share +Format +Run + +#### func [HasSuffix](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=466) [¶](#HasSuffix "Go to HasSuffix") + +```None +func HasSuffix(s, suffix string) bool +``` + +HasSuffix reports whether the string s ends with suffix. + +Example [¶](#example-HasSuffix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.HasSuffix("Amigo", "go")) + fmt.Println(strings.HasSuffix("Amigo", "O")) + fmt.Println(strings.HasSuffix("Amigo", "Ami")) + fmt.Println(strings.HasSuffix("Amigo", "")) +} +``` + +```None +Output: + +true +false +false +true +``` + +Share +Format +Run + +#### func [Index](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=1220) [¶](#Index "Go to Index") + +```None +func Index(s, substr string) int +``` + +Index returns the index of the first instance of substr in s, or -1 if substr is not present in s. + +Example [¶](#example-Index "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Index("chicken", "ken")) + fmt.Println(strings.Index("chicken", "dmr")) +} +``` + +```None +Output: + +4 +-1 +``` + +Share +Format +Run + +#### func [IndexAny](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=146) [¶](#IndexAny "Go to IndexAny") + +```None +func IndexAny(s, chars string) int +``` + +IndexAny returns the index of the first instance of any Unicode code point +from chars in s, or -1 if no Unicode code point from chars is present in s. + +Example [¶](#example-IndexAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexAny("chicken", "aeiouy")) + fmt.Println(strings.IndexAny("crwth", "aeiouy")) +} +``` + +```None +Output: + +2 +-1 +``` + +Share +Format +Run + +#### func [IndexByte](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=118) [¶](#IndexByte "Go to IndexByte") added in go1.2 + +```None +func IndexByte(s string, c byte) int +``` + +IndexByte returns the index of the first instance of c in s, or -1 if c is not present in s. + +Example [¶](#example-IndexByte "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexByte("golang", 'g')) + fmt.Println(strings.IndexByte("gophers", 'h')) + fmt.Println(strings.IndexByte("golang", 'x')) +} +``` + +```None +Output: + +0 +3 +-1 +``` + +Share +Format +Run + +#### func [IndexFunc](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=862) [¶](#IndexFunc "Go to IndexFunc") + +```None +func IndexFunc(s string, f func(rune) bool) int +``` + +IndexFunc returns the index into s of the first Unicode +code point satisfying f(c), or -1 if none do. + +Example [¶](#example-IndexFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + f := func(c rune) bool { + return unicode.Is(unicode.Han, c) + } + fmt.Println(strings.IndexFunc("Hello, 世界", f)) + fmt.Println(strings.IndexFunc("Hello, world", f)) +} +``` + +```None +Output: + +7 +-1 +``` + +Share +Format +Run + +#### func [IndexRune](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=126) [¶](#IndexRune "Go to IndexRune") + +```None +func IndexRune(s string, r rune) int +``` + +IndexRune returns the index of the first instance of the Unicode code point +r, or -1 if rune is not present in s. +If r is [utf8.RuneError](/unicode/utf8#RuneError), it returns the first instance of any +invalid UTF-8 byte sequence. + +Example [¶](#example-IndexRune "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexRune("chicken", 'k')) + fmt.Println(strings.IndexRune("chicken", 'd')) +} +``` + +```None +Output: + +4 +-1 +``` + +Share +Format +Run + +#### func [Join](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=428) [¶](#Join "Go to Join") + +```None +func Join(elems []string, sep string) string +``` + +Join concatenates the elements of its first argument to create a single string. The separator +string sep is placed between elements in the resulting string. + +Example [¶](#example-Join "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + s := []string{"foo", "bar", "baz"} + fmt.Println(strings.Join(s, ", ")) +} +``` + +```None +Output: + +foo, bar, baz +``` + +Share +Format +Run + +#### func [LastIndex](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=81) [¶](#LastIndex "Go to LastIndex") + +```None +func LastIndex(s, substr string) int +``` + +LastIndex returns the index of the last instance of substr in s, or -1 if substr is not present in s. + +Example [¶](#example-LastIndex "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Index("go gopher", "go")) + fmt.Println(strings.LastIndex("go gopher", "go")) + fmt.Println(strings.LastIndex("go gopher", "rodent")) +} +``` + +```None +Output: + +0 +3 +-1 +``` + +Share +Format +Run + +#### func [LastIndexAny](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=180) [¶](#LastIndexAny "Go to LastIndexAny") + +```None +func LastIndexAny(s, chars string) int +``` + +LastIndexAny returns the index of the last instance of any Unicode code +point from chars in s, or -1 if no Unicode code point from chars is +present in s. + +Example [¶](#example-LastIndexAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.LastIndexAny("go gopher", "go")) + fmt.Println(strings.LastIndexAny("go gopher", "rodent")) + fmt.Println(strings.LastIndexAny("go gopher", "fail")) +} +``` + +```None +Output: + +4 +8 +-1 +``` + +Share +Format +Run + +#### func [LastIndexByte](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=230) [¶](#LastIndexByte "Go to LastIndexByte") added in go1.5 + +```None +func LastIndexByte(s string, c byte) int +``` + +LastIndexByte returns the index of the last instance of c in s, or -1 if c is not present in s. + +Example [¶](#example-LastIndexByte "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.LastIndexByte("Hello, world", 'l')) + fmt.Println(strings.LastIndexByte("Hello, world", 'o')) + fmt.Println(strings.LastIndexByte("Hello, world", 'x')) +} +``` + +```None +Output: + +10 +8 +-1 +``` + +Share +Format +Run + +#### func [LastIndexFunc](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=868) [¶](#LastIndexFunc "Go to LastIndexFunc") + +```None +func LastIndexFunc(s string, f func(rune) bool) int +``` + +LastIndexFunc returns the index into s of the last +Unicode code point satisfying f(c), or -1 if none do. + +Example [¶](#example-LastIndexFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.LastIndexFunc("go 123", unicode.IsNumber)) + fmt.Println(strings.LastIndexFunc("123 go", unicode.IsNumber)) + fmt.Println(strings.LastIndexFunc("go", unicode.IsNumber)) +} +``` + +```None +Output: + +5 +2 +-1 +``` + +Share +Format +Run + +#### func [Map](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=473) [¶](#Map "Go to Map") + +```None +func Map(mapping func(rune) rune, s string) string +``` + +Map returns a copy of the string s with all its characters modified +according to the mapping function. If mapping returns a negative value, the character is +dropped from the string with no replacement. + +Example [¶](#example-Map "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + rot13 := func(r rune) rune { + switch { + case r >= 'A' && r <= 'Z': + return 'A' + (r-'A'+13)%26 + case r >= 'a' && r <= 'z': + return 'a' + (r-'a'+13)%26 + } + return r + } + fmt.Println(strings.Map(rot13, "'Twas brillig and the slithy gopher...")) +} +``` + +```None +Output: + +'Gjnf oevyyvt naq gur fyvgul tbcure... +``` + +Share +Format +Run + +#### func [Repeat](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=557) [¶](#Repeat "Go to Repeat") + +```None +func Repeat(s string, count int) string +``` + +Repeat returns a new string consisting of count copies of the string s. + +It panics if count is negative or if the result of (len(s) \* count) +overflows. + +Example [¶](#example-Repeat "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println("ba" + strings.Repeat("na", 2)) +} +``` + +```None +Output: + +banana +``` + +Share +Format +Run + +#### func [Replace](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=1091) [¶](#Replace "Go to Replace") + +```None +func Replace(s, old, new string, n int) string +``` + +Replace returns a copy of the string s with the first n +non-overlapping instances of old replaced by new. +If old is empty, it matches at the beginning of the string +and after each UTF-8 sequence, yielding up to k+1 replacements +for a k-rune string. +If n < 0, there is no limit on the number of replacements. + +Example [¶](#example-Replace "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Replace("oink oink oink", "k", "ky", 2)) + fmt.Println(strings.Replace("oink oink oink", "oink", "moo", -1)) +} +``` + +```None +Output: + +oinky oinky oink +moo moo moo +``` + +Share +Format +Run + +#### func [ReplaceAll](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=1130) [¶](#ReplaceAll "Go to ReplaceAll") added in go1.12 + +```None +func ReplaceAll(s, old, new string) string +``` + +ReplaceAll returns a copy of the string s with all +non-overlapping instances of old replaced by new. +If old is empty, it matches at the beginning of the string +and after each UTF-8 sequence, yielding up to k+1 replacements +for a k-rune string. + +Example [¶](#example-ReplaceAll "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ReplaceAll("oink oink oink", "oink", "moo")) +} +``` + +```None +Output: + +moo moo moo +``` + +Share +Format +Run + +#### func [Split](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=306) [¶](#Split "Go to Split") + +```None +func Split(s, sep string) []string +``` + +Split slices s into all substrings separated by sep and returns a slice of +the substrings between those separators. + +If s does not contain sep and sep is not empty, Split returns a +slice of length 1 whose only element is s. + +If sep is empty, Split splits after each UTF-8 sequence. If both s +and sep are empty, Split returns an empty slice. + +It is equivalent to [SplitN](#SplitN) with a count of -1. + +To split around the first instance of a separator, see [Cut](#Cut). + +Example [¶](#example-Split "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.Split("a,b,c", ",")) + fmt.Printf("%q\n", strings.Split("a man a plan a canal panama", "a ")) + fmt.Printf("%q\n", strings.Split(" xyz ", "")) + fmt.Printf("%q\n", strings.Split("", "Bernardo O'Higgins")) +} +``` + +```None +Output: + +["a" "b" "c"] +["" "man " "plan " "canal panama"] +[" " "x" "y" "z" " "] +[""] +``` + +Share +Format +Run + +#### func [SplitAfter](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=318) [¶](#SplitAfter "Go to SplitAfter") + +```None +func SplitAfter(s, sep string) []string +``` + +SplitAfter slices s into all substrings after each instance of sep and +returns a slice of those substrings. + +If s does not contain sep and sep is not empty, SplitAfter returns +a slice of length 1 whose only element is s. + +If sep is empty, SplitAfter splits after each UTF-8 sequence. If +both s and sep are empty, SplitAfter returns an empty slice. + +It is equivalent to [SplitAfterN](#SplitAfterN) with a count of -1. + +Example [¶](#example-SplitAfter "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitAfter("a,b,c", ",")) +} +``` + +```None +Output: + +["a," "b," "c"] +``` + +Share +Format +Run + +#### func [SplitAfterN](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=290) [¶](#SplitAfterN "Go to SplitAfterN") + +```None +func SplitAfterN(s, sep string, n int) []string +``` + +SplitAfterN slices s into substrings after each instance of sep and +returns a slice of those substrings. + +The count determines the number of substrings to return: + +* n > 0: at most n substrings; the last substring will be the unsplit remainder; +* n == 0: the result is nil (zero substrings); +* n < 0: all substrings. + +Edge cases for s and sep (for example, empty strings) are handled +as described in the documentation for [SplitAfter](#SplitAfter). + +Example [¶](#example-SplitAfterN "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitAfterN("a,b,c", ",", 2)) +} +``` + +```None +Output: + +["a," "b,c"] +``` + +Share +Format +Run + +#### func [SplitN](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=278) [¶](#SplitN "Go to SplitN") + +```None +func SplitN(s, sep string, n int) []string +``` + +SplitN slices s into substrings separated by sep and returns a slice of +the substrings between those separators. + +The count determines the number of substrings to return: + +* n > 0: at most n substrings; the last substring will be the unsplit remainder; +* n == 0: the result is nil (zero substrings); +* n < 0: all substrings. + +Edge cases for s and sep (for example, empty strings) are handled +as described in the documentation for [Split](#Split). + +To split around the first instance of a separator, see [Cut](#Cut). + +Example [¶](#example-SplitN "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitN("a,b,c", ",", 2)) + z := strings.SplitN("a,b,c", ",", 0) + fmt.Printf("%q (nil = %v)\n", z, z == nil) +} +``` + +```None +Output: + +["a" "b,c"] +[] (nil = true) +``` + +Share +Format +Run + +#### func [Title](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=814) deprecated + +```None +func Title(s string) string +``` + +Title returns a copy of the string s with all Unicode letters that begin words +mapped to their Unicode title case. + +Deprecated: The rule Title uses for word boundaries does not handle Unicode +punctuation properly. Use golang.org/x/text/cases instead. + +Example [¶](#example-Title "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Compare this example to the ToTitle example. + fmt.Println(strings.Title("her royal highness")) + fmt.Println(strings.Title("loud noises")) + fmt.Println(strings.Title("хлеб")) +} +``` + +```None +Output: + +Her Royal Highness +Loud Noises +Хлеб +``` + +Share +Format +Run + +#### func [ToLower](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=673) [¶](#ToLower "Go to ToLower") + +```None +func ToLower(s string) string +``` + +ToLower returns s with all Unicode letters mapped to their lower case. + +Example [¶](#example-ToLower "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ToLower("Gopher")) +} +``` + +```None +Output: + +gopher +``` + +Share +Format +Run + +#### func [ToLowerSpecial](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=724) [¶](#ToLowerSpecial "Go to ToLowerSpecial") + +```None +func ToLowerSpecial(c unicode.SpecialCase, s string) string +``` + +ToLowerSpecial returns a copy of the string s with all Unicode letters mapped to their +lower case using the case mapping specified by c. + +Example [¶](#example-ToLowerSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToLowerSpecial(unicode.TurkishCase, "Önnek İş")) +} +``` + +```None +Output: + +önnek iş +``` + +Share +Format +Run + +#### func [ToTitle](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=714) [¶](#ToTitle "Go to ToTitle") + +```None +func ToTitle(s string) string +``` + +ToTitle returns a copy of the string s with all Unicode letters mapped to +their Unicode title case. + +Example [¶](#example-ToTitle "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Compare this example to the Title example. + fmt.Println(strings.ToTitle("her royal highness")) + fmt.Println(strings.ToTitle("loud noises")) + fmt.Println(strings.ToTitle("хлеб")) +} +``` + +```None +Output: + +HER ROYAL HIGHNESS +LOUD NOISES +ХЛЕБ +``` + +Share +Format +Run + +#### func [ToTitleSpecial](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=730) [¶](#ToTitleSpecial "Go to ToTitleSpecial") + +```None +func ToTitleSpecial(c unicode.SpecialCase, s string) string +``` + +ToTitleSpecial returns a copy of the string s with all Unicode letters mapped to their +Unicode title case, giving priority to the special casing rules. + +Example [¶](#example-ToTitleSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToTitleSpecial(unicode.TurkishCase, "dünyanın ilk borsa yapısı Aizonai kabul edilir")) +} +``` + +```None +Output: + +DÜNYANIN İLK BORSA YAPISI AİZONAİ KABUL EDİLİR +``` + +Share +Format +Run + +#### func [ToUpper](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=633) [¶](#ToUpper "Go to ToUpper") + +```None +func ToUpper(s string) string +``` + +ToUpper returns s with all Unicode letters mapped to their upper case. + +Example [¶](#example-ToUpper "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ToUpper("Gopher")) +} +``` + +```None +Output: + +GOPHER +``` + +Share +Format +Run + +#### func [ToUpperSpecial](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=718) [¶](#ToUpperSpecial "Go to ToUpperSpecial") + +```None +func ToUpperSpecial(c unicode.SpecialCase, s string) string +``` + +ToUpperSpecial returns a copy of the string s with all Unicode letters mapped to their +upper case using the case mapping specified by c. + +Example [¶](#example-ToUpperSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToUpperSpecial(unicode.TurkishCase, "örnek iş")) +} +``` + +```None +Output: + +ÖRNEK İŞ +``` + +Share +Format +Run + +#### func [ToValidUTF8](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=736) [¶](#ToValidUTF8 "Go to ToValidUTF8") added in go1.13 + +```None +func ToValidUTF8(s, replacement string) string +``` + +ToValidUTF8 returns a copy of the string s with each run of invalid UTF-8 byte sequences +replaced by the replacement string, which may be empty. + +Example [¶](#example-ToValidUTF8 "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%s\n", strings.ToValidUTF8("abc", "\uFFFD")) + fmt.Printf("%s\n", strings.ToValidUTF8("a\xffb\xC0\xAFc\xff", "")) + fmt.Printf("%s\n", strings.ToValidUTF8("\xed\xa0\x80", "abc")) +} +``` + +```None +Output: + +abc +abc +abc +``` + +Share +Format +Run + +#### func [Trim](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=928) [¶](#Trim "Go to Trim") + +```None +func Trim(s, cutset string) string +``` + +Trim returns a slice of the string s with all leading and +trailing Unicode code points contained in cutset removed. + +Example [¶](#example-Trim "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.Trim("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimFunc](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=856) [¶](#TrimFunc "Go to TrimFunc") + +```None +func TrimFunc(s string, f func(rune) bool) string +``` + +TrimFunc returns a slice of the string s with all leading +and trailing Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimLeft](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=945) [¶](#TrimLeft "Go to TrimLeft") + +```None +func TrimLeft(s, cutset string) string +``` + +TrimLeft returns a slice of the string s with all leading +Unicode code points contained in cutset removed. + +To remove a prefix, use [TrimPrefix](#TrimPrefix) instead. + +Example [¶](#example-TrimLeft "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.TrimLeft("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +Hello, Gophers!!! +``` + +Share +Format +Run + +#### func [TrimLeftFunc](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=833) [¶](#TrimLeftFunc "Go to TrimLeftFunc") + +```None +func TrimLeftFunc(s string, f func(rune) bool) string +``` + +TrimLeftFunc returns a slice of the string s with all leading +Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimLeftFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimLeftFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +Hello, Gophers!!! +``` + +Share +Format +Run + +#### func [TrimPrefix](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=1075) [¶](#TrimPrefix "Go to TrimPrefix") added in go1.1 + +```None +func TrimPrefix(s, prefix string) string +``` + +TrimPrefix returns s without the provided leading prefix string. +If s doesn't start with prefix, s is returned unchanged. + +Example [¶](#example-TrimPrefix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var s = "¡¡¡Hello, Gophers!!!" + s = strings.TrimPrefix(s, "¡¡¡Hello, ") + s = strings.TrimPrefix(s, "¡¡¡Howdy, ") + fmt.Print(s) +} +``` + +```None +Output: + +Gophers!!! +``` + +Share +Format +Run + +#### func [TrimRight](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=993) [¶](#TrimRight "Go to TrimRight") + +```None +func TrimRight(s, cutset string) string +``` + +TrimRight returns a slice of the string s, with all trailing +Unicode code points contained in cutset removed. + +To remove a suffix, use [TrimSuffix](#TrimSuffix) instead. + +Example [¶](#example-TrimRight "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.TrimRight("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +¡¡¡Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimRightFunc](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=843) [¶](#TrimRightFunc "Go to TrimRightFunc") + +```None +func TrimRightFunc(s string, f func(rune) bool) string +``` + +TrimRightFunc returns a slice of the string s with all trailing +Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimRightFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimRightFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +¡¡¡Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimSpace](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=1039) [¶](#TrimSpace "Go to TrimSpace") + +```None +func TrimSpace(s string) string +``` + +TrimSpace returns a slice of the string s, with all leading +and trailing white space removed, as defined by Unicode. + +Example [¶](#example-TrimSpace "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.TrimSpace(" \t\n Hello, Gophers \n\t\r\n")) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimSuffix](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/strings.go;l=1081) [¶](#TrimSuffix "Go to TrimSuffix") added in go1.1 + +```None +func TrimSuffix(s, suffix string) string +``` + +TrimSuffix returns s without the provided trailing suffix string. +If s doesn't end with suffix, s is returned unchanged. + +Example [¶](#example-TrimSuffix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var s = "¡¡¡Hello, Gophers!!!" + s = strings.TrimSuffix(s, ", Gophers!!!") + s = strings.TrimSuffix(s, ", Marmots!!!") + fmt.Print(s) +} +``` + +```None +Output: + +¡¡¡Hello +``` + +Share +Format +Run + +### Types [¶](#pkg-types "Go to Types") + +#### type [Builder](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/builder.go;l=17) [¶](#Builder "Go to Builder") added in go1.10 + +```None +type Builder struct { + // contains filtered or unexported fields +} +``` + +A Builder is used to efficiently build a string using [Builder.Write](#Builder.Write) methods. +It minimizes memory copying. The zero value is ready to use. +Do not copy a non-zero Builder. + +Example [¶](#example-Builder "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var b strings.Builder + for i := 3; i >= 1; i-- { + fmt.Fprintf(&b, "%d...", i) + } + b.WriteString("ignition") + fmt.Println(b.String()) + +} +``` + +```None +Output: + +3...2...1...ignition +``` + +Share +Format +Run + +#### func (\*Builder) [Cap](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/builder.go;l=50) [¶](#Builder.Cap "Go to Builder.Cap") added in go1.12 + +```None +func (b *Builder) Cap() int +``` + +Cap returns the capacity of the builder's underlying byte slice. It is the +total space allocated for the string being built and includes any bytes +already written. + +#### func (\*Builder) [Grow](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/builder.go;l=69) [¶](#Builder.Grow "Go to Builder.Grow") added in go1.10 + +```None +func (b *Builder) Grow(n int) +``` + +Grow grows b's capacity, if necessary, to guarantee space for +another n bytes. After Grow(n), at least n bytes can be written to b +without another allocation. If n is negative, Grow panics. + +#### func (\*Builder) [Len](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/builder.go;l=45) [¶](#Builder.Len "Go to Builder.Len") added in go1.10 + +```None +func (b *Builder) Len() int +``` + +Len returns the number of accumulated bytes; b.Len() == len(b.String()). + +#### func (\*Builder) [Reset](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/builder.go;l=53) [¶](#Builder.Reset "Go to Builder.Reset") added in go1.10 + +```None +func (b *Builder) Reset() +``` + +Reset resets the [Builder](#Builder) to be empty. + +#### func (\*Builder) [String](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/builder.go;l=40) [¶](#Builder.String "Go to Builder.String") added in go1.10 + +```None +func (b *Builder) String() string +``` + +String returns the accumulated string. + +#### func (\*Builder) [Write](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/builder.go;l=81) [¶](#Builder.Write "Go to Builder.Write") added in go1.10 + +```None +func (b *Builder) Write(p []byte) (int, error) +``` + +Write appends the contents of p to b's buffer. +Write always returns len(p), nil. + +#### func (\*Builder) [WriteByte](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/builder.go;l=89) [¶](#Builder.WriteByte "Go to Builder.WriteByte") added in go1.10 + +```None +func (b *Builder) WriteByte(c byte) error +``` + +WriteByte appends the byte c to b's buffer. +The returned error is always nil. + +#### func (\*Builder) [WriteRune](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/builder.go;l=97) [¶](#Builder.WriteRune "Go to Builder.WriteRune") added in go1.10 + +```None +func (b *Builder) WriteRune(r rune) (int, error) +``` + +WriteRune appends the UTF-8 encoding of Unicode code point r to b's buffer. +It returns the length of r and a nil error. + +#### func (\*Builder) [WriteString](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/builder.go;l=106) [¶](#Builder.WriteString "Go to Builder.WriteString") added in go1.10 + +```None +func (b *Builder) WriteString(s string) (int, error) +``` + +WriteString appends the contents of s to b's buffer. +It returns the length of s and a nil error. + +#### type [Reader](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/reader.go;l=17) [¶](#Reader "Go to Reader") + +```None +type Reader struct { + // contains filtered or unexported fields +} +``` + +A Reader implements the [io.Reader](/io#Reader), [io.ReaderAt](/io#ReaderAt), [io.ByteReader](/io#ByteReader), [io.ByteScanner](/io#ByteScanner), +[io.RuneReader](/io#RuneReader), [io.RuneScanner](/io#RuneScanner), [io.Seeker](/io#Seeker), and [io.WriterTo](/io#WriterTo) interfaces by reading +from a string. +The zero value for Reader operates like a Reader of an empty string. + +#### func [NewReader](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/reader.go;l=160) [¶](#NewReader "Go to NewReader") + +```None +func NewReader(s string) *Reader +``` + +NewReader returns a new [Reader](#Reader) reading from s. +It is similar to [bytes.NewBufferString](/bytes#NewBufferString) but more efficient and non-writable. + +#### func (\*Reader) [Len](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/reader.go;l=25) [¶](#Reader.Len "Go to Reader.Len") + +```None +func (r *Reader) Len() int +``` + +Len returns the number of bytes of the unread portion of the +string. + +#### func (\*Reader) [Read](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/reader.go;l=39) [¶](#Reader.Read "Go to Reader.Read") + +```None +func (r *Reader) Read(b []byte) (n int, err error) +``` + +Read implements the [io.Reader](/io#Reader) interface. + +#### func (\*Reader) [ReadAt](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/reader.go;l=50) [¶](#Reader.ReadAt "Go to Reader.ReadAt") + +```None +func (r *Reader) ReadAt(b []byte, off int64) (n int, err error) +``` + +ReadAt implements the [io.ReaderAt](/io#ReaderAt) interface. + +#### func (\*Reader) [ReadByte](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/reader.go;l=66) [¶](#Reader.ReadByte "Go to Reader.ReadByte") + +```None +func (r *Reader) ReadByte() (byte, error) +``` + +ReadByte implements the [io.ByteReader](/io#ByteReader) interface. + +#### func (\*Reader) [ReadRune](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/reader.go;l=87) [¶](#Reader.ReadRune "Go to Reader.ReadRune") + +```None +func (r *Reader) ReadRune() (ch rune, size int, err error) +``` + +ReadRune implements the [io.RuneReader](/io#RuneReader) interface. + +#### func (\*Reader) [Reset](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/reader.go;l=156) [¶](#Reader.Reset "Go to Reader.Reset") added in go1.7 + +```None +func (r *Reader) Reset(s string) +``` + +Reset resets the [Reader](#Reader) to be reading from s. + +#### func (\*Reader) [Seek](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/reader.go;l=116) [¶](#Reader.Seek "Go to Reader.Seek") + +```None +func (r *Reader) Seek(offset int64, whence int) (int64, error) +``` + +Seek implements the [io.Seeker](/io#Seeker) interface. + +#### func (\*Reader) [Size](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/reader.go;l=36) [¶](#Reader.Size "Go to Reader.Size") added in go1.5 + +```None +func (r *Reader) Size() int64 +``` + +Size returns the original length of the underlying string. +Size is the number of bytes available for reading via [Reader.ReadAt](#Reader.ReadAt). +The returned value is always the same and is not affected by calls +to any other method. + +#### func (\*Reader) [UnreadByte](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/reader.go;l=77) [¶](#Reader.UnreadByte "Go to Reader.UnreadByte") + +```None +func (r *Reader) UnreadByte() error +``` + +UnreadByte implements the [io.ByteScanner](/io#ByteScanner) interface. + +#### func (\*Reader) [UnreadRune](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/reader.go;l=103) [¶](#Reader.UnreadRune "Go to Reader.UnreadRune") + +```None +func (r *Reader) UnreadRune() error +``` + +UnreadRune implements the [io.RuneScanner](/io#RuneScanner) interface. + +#### func (\*Reader) [WriteTo](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/reader.go;l=137) [¶](#Reader.WriteTo "Go to Reader.WriteTo") added in go1.1 + +```None +func (r *Reader) WriteTo(w io.Writer) (n int64, err error) +``` + +WriteTo implements the [io.WriterTo](/io#WriterTo) interface. + +#### type [Replacer](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/replace.go;l=14) [¶](#Replacer "Go to Replacer") + +```None +type Replacer struct { + // contains filtered or unexported fields +} +``` + +Replacer replaces a list of strings with replacements. +It is safe for concurrent use by multiple goroutines. + +#### func [NewReplacer](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/replace.go;l=32) [¶](#NewReplacer "Go to NewReplacer") + +```None +func NewReplacer(oldnew ...string) *Replacer +``` + +NewReplacer returns a new [Replacer](#Replacer) from a list of old, new string +pairs. Replacements are performed in the order they appear in the +target string, without overlapping matches. The old string +comparisons are done in argument order. + +NewReplacer panics if given an odd number of arguments. + +Example [¶](#example-NewReplacer "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + r := strings.NewReplacer("<", "<", ">", ">") + fmt.Println(r.Replace("This is HTML!")) +} +``` + +```None +Output: + +This is <b>HTML</b>! +``` + +Share +Format +Run + +#### func (\*Replacer) [Replace](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/replace.go;l=95) [¶](#Replacer.Replace "Go to Replacer.Replace") + +```None +func (r *Replacer) Replace(s string) string +``` + +Replace returns a copy of s with all replacements performed. + +#### func (\*Replacer) [WriteString](https://cs.opensource.google/go/go/+/go1.23.0:src/strings/replace.go;l=101) [¶](#Replacer.WriteString "Go to Replacer.WriteString") + +```None +func (r *Replacer) WriteString(w io.Writer, s string) (n int, err error) +``` + +WriteString writes s to w with all replacements performed. diff --git a/corpus/docs/golang/strings/strings_go1240.md b/corpus/docs/golang/strings/strings_go1240.md new file mode 100644 index 0000000000000000000000000000000000000000..de40a7ff9e73d321d8243c46e788e5e7993e2161 --- /dev/null +++ b/corpus/docs/golang/strings/strings_go1240.md @@ -0,0 +1,2455 @@ +# Golang - strings + +Source: https://pkg.go.dev/strings@go1.24.0 +Version: go1.24.0 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package strings implements simple functions to manipulate UTF-8 encoded strings. + +For information about UTF-8 strings in Go, see . + +### Index [¶](#pkg-index "Go to Index") + +* [func Clone(s string) string](#Clone) +* [func Compare(a, b string) int](#Compare) +* [func Contains(s, substr string) bool](#Contains) +* [func ContainsAny(s, chars string) bool](#ContainsAny) +* [func ContainsFunc(s string, f func(rune) bool) bool](#ContainsFunc) +* [func ContainsRune(s string, r rune) bool](#ContainsRune) +* [func Count(s, substr string) int](#Count) +* [func Cut(s, sep string) (before, after string, found bool)](#Cut) +* [func CutPrefix(s, prefix string) (after string, found bool)](#CutPrefix) +* [func CutSuffix(s, suffix string) (before string, found bool)](#CutSuffix) +* [func EqualFold(s, t string) bool](#EqualFold) +* [func Fields(s string) []string](#Fields) +* [func FieldsFunc(s string, f func(rune) bool) []string](#FieldsFunc) +* [func FieldsFuncSeq(s string, f func(rune) bool) iter.Seq[string]](#FieldsFuncSeq) +* [func FieldsSeq(s string) iter.Seq[string]](#FieldsSeq) +* [func HasPrefix(s, prefix string) bool](#HasPrefix) +* [func HasSuffix(s, suffix string) bool](#HasSuffix) +* [func Index(s, substr string) int](#Index) +* [func IndexAny(s, chars string) int](#IndexAny) +* [func IndexByte(s string, c byte) int](#IndexByte) +* [func IndexFunc(s string, f func(rune) bool) int](#IndexFunc) +* [func IndexRune(s string, r rune) int](#IndexRune) +* [func Join(elems []string, sep string) string](#Join) +* [func LastIndex(s, substr string) int](#LastIndex) +* [func LastIndexAny(s, chars string) int](#LastIndexAny) +* [func LastIndexByte(s string, c byte) int](#LastIndexByte) +* [func LastIndexFunc(s string, f func(rune) bool) int](#LastIndexFunc) +* [func Lines(s string) iter.Seq[string]](#Lines) +* [func Map(mapping func(rune) rune, s string) string](#Map) +* [func Repeat(s string, count int) string](#Repeat) +* [func Replace(s, old, new string, n int) string](#Replace) +* [func ReplaceAll(s, old, new string) string](#ReplaceAll) +* [func Split(s, sep string) []string](#Split) +* [func SplitAfter(s, sep string) []string](#SplitAfter) +* [func SplitAfterN(s, sep string, n int) []string](#SplitAfterN) +* [func SplitAfterSeq(s, sep string) iter.Seq[string]](#SplitAfterSeq) +* [func SplitN(s, sep string, n int) []string](#SplitN) +* [func SplitSeq(s, sep string) iter.Seq[string]](#SplitSeq) +* [func Title(s string) string](#Title)deprecated +* [func ToLower(s string) string](#ToLower) +* [func ToLowerSpecial(c unicode.SpecialCase, s string) string](#ToLowerSpecial) +* [func ToTitle(s string) string](#ToTitle) +* [func ToTitleSpecial(c unicode.SpecialCase, s string) string](#ToTitleSpecial) +* [func ToUpper(s string) string](#ToUpper) +* [func ToUpperSpecial(c unicode.SpecialCase, s string) string](#ToUpperSpecial) +* [func ToValidUTF8(s, replacement string) string](#ToValidUTF8) +* [func Trim(s, cutset string) string](#Trim) +* [func TrimFunc(s string, f func(rune) bool) string](#TrimFunc) +* [func TrimLeft(s, cutset string) string](#TrimLeft) +* [func TrimLeftFunc(s string, f func(rune) bool) string](#TrimLeftFunc) +* [func TrimPrefix(s, prefix string) string](#TrimPrefix) +* [func TrimRight(s, cutset string) string](#TrimRight) +* [func TrimRightFunc(s string, f func(rune) bool) string](#TrimRightFunc) +* [func TrimSpace(s string) string](#TrimSpace) +* [func TrimSuffix(s, suffix string) string](#TrimSuffix) +* [type Builder](#Builder) +* + [func (b \*Builder) Cap() int](#Builder.Cap) + + [func (b \*Builder) Grow(n int)](#Builder.Grow) + + [func (b \*Builder) Len() int](#Builder.Len) + + [func (b \*Builder) Reset()](#Builder.Reset) + + [func (b \*Builder) String() string](#Builder.String) + + [func (b \*Builder) Write(p []byte) (int, error)](#Builder.Write) + + [func (b \*Builder) WriteByte(c byte) error](#Builder.WriteByte) + + [func (b \*Builder) WriteRune(r rune) (int, error)](#Builder.WriteRune) + + [func (b \*Builder) WriteString(s string) (int, error)](#Builder.WriteString) +* [type Reader](#Reader) +* + [func NewReader(s string) \*Reader](#NewReader) +* + [func (r \*Reader) Len() int](#Reader.Len) + + [func (r \*Reader) Read(b []byte) (n int, err error)](#Reader.Read) + + [func (r \*Reader) ReadAt(b []byte, off int64) (n int, err error)](#Reader.ReadAt) + + [func (r \*Reader) ReadByte() (byte, error)](#Reader.ReadByte) + + [func (r \*Reader) ReadRune() (ch rune, size int, err error)](#Reader.ReadRune) + + [func (r \*Reader) Reset(s string)](#Reader.Reset) + + [func (r \*Reader) Seek(offset int64, whence int) (int64, error)](#Reader.Seek) + + [func (r \*Reader) Size() int64](#Reader.Size) + + [func (r \*Reader) UnreadByte() error](#Reader.UnreadByte) + + [func (r \*Reader) UnreadRune() error](#Reader.UnreadRune) + + [func (r \*Reader) WriteTo(w io.Writer) (n int64, err error)](#Reader.WriteTo) +* [type Replacer](#Replacer) +* + [func NewReplacer(oldnew ...string) \*Replacer](#NewReplacer) +* + [func (r \*Replacer) Replace(s string) string](#Replacer.Replace) + + [func (r \*Replacer) WriteString(w io.Writer, s string) (n int, err error)](#Replacer.WriteString) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Builder](#example-Builder) +* [Clone](#example-Clone) +* [Compare](#example-Compare) +* [Contains](#example-Contains) +* [ContainsAny](#example-ContainsAny) +* [ContainsFunc](#example-ContainsFunc) +* [ContainsRune](#example-ContainsRune) +* [Count](#example-Count) +* [Cut](#example-Cut) +* [CutPrefix](#example-CutPrefix) +* [CutSuffix](#example-CutSuffix) +* [EqualFold](#example-EqualFold) +* [Fields](#example-Fields) +* [FieldsFunc](#example-FieldsFunc) +* [HasPrefix](#example-HasPrefix) +* [HasSuffix](#example-HasSuffix) +* [Index](#example-Index) +* [IndexAny](#example-IndexAny) +* [IndexByte](#example-IndexByte) +* [IndexFunc](#example-IndexFunc) +* [IndexRune](#example-IndexRune) +* [Join](#example-Join) +* [LastIndex](#example-LastIndex) +* [LastIndexAny](#example-LastIndexAny) +* [LastIndexByte](#example-LastIndexByte) +* [LastIndexFunc](#example-LastIndexFunc) +* [Map](#example-Map) +* [NewReplacer](#example-NewReplacer) +* [Repeat](#example-Repeat) +* [Replace](#example-Replace) +* [ReplaceAll](#example-ReplaceAll) +* [Split](#example-Split) +* [SplitAfter](#example-SplitAfter) +* [SplitAfterN](#example-SplitAfterN) +* [SplitN](#example-SplitN) +* [Title](#example-Title) +* [ToLower](#example-ToLower) +* [ToLowerSpecial](#example-ToLowerSpecial) +* [ToTitle](#example-ToTitle) +* [ToTitleSpecial](#example-ToTitleSpecial) +* [ToUpper](#example-ToUpper) +* [ToUpperSpecial](#example-ToUpperSpecial) +* [ToValidUTF8](#example-ToValidUTF8) +* [Trim](#example-Trim) +* [TrimFunc](#example-TrimFunc) +* [TrimLeft](#example-TrimLeft) +* [TrimLeftFunc](#example-TrimLeftFunc) +* [TrimPrefix](#example-TrimPrefix) +* [TrimRight](#example-TrimRight) +* [TrimRightFunc](#example-TrimRightFunc) +* [TrimSpace](#example-TrimSpace) +* [TrimSuffix](#example-TrimSuffix) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [Clone](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/clone.go;l=21) [¶](#Clone "Go to Clone") added in go1.18 + +```None +func Clone(s string) string +``` + +Clone returns a fresh copy of s. +It guarantees to make a copy of s into a new allocation, +which can be important when retaining only a small substring +of a much larger string. Using Clone can help such programs +use less memory. Of course, since using Clone makes a copy, +overuse of Clone can make programs use more memory. +Clone should typically be used only rarely, and only when +profiling indicates that it is needed. +For strings of length zero the string "" will be returned +and no allocation is made. + +Example [¶](#example-Clone "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unsafe" +) + +func main() { + s := "abc" + clone := strings.Clone(s) + fmt.Println(s == clone) + fmt.Println(unsafe.StringData(s) == unsafe.StringData(clone)) +} +``` + +```None +Output: + +true +false +``` + +Share +Format +Run + +#### func [Compare](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/compare.go;l=15) [¶](#Compare "Go to Compare") added in go1.5 + +```None +func Compare(a, b string) int +``` + +Compare returns an integer comparing two strings lexicographically. +The result will be 0 if a == b, -1 if a < b, and +1 if a > b. + +Use Compare when you need to perform a three-way comparison (with +[slices.SortFunc](/slices#SortFunc), for example). It is usually clearer and always faster +to use the built-in string comparison operators ==, <, >, and so on. + +Example [¶](#example-Compare "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Compare("a", "b")) + fmt.Println(strings.Compare("a", "a")) + fmt.Println(strings.Compare("b", "a")) +} +``` + +```None +Output: + +-1 +0 +1 +``` + +Share +Format +Run + +#### func [Contains](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=62) [¶](#Contains "Go to Contains") + +```None +func Contains(s, substr string) bool +``` + +Contains reports whether substr is within s. + +Example [¶](#example-Contains "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Contains("seafood", "foo")) + fmt.Println(strings.Contains("seafood", "bar")) + fmt.Println(strings.Contains("seafood", "")) + fmt.Println(strings.Contains("", "")) +} +``` + +```None +Output: + +true +false +true +true +``` + +Share +Format +Run + +#### func [ContainsAny](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=67) [¶](#ContainsAny "Go to ContainsAny") + +```None +func ContainsAny(s, chars string) bool +``` + +ContainsAny reports whether any Unicode code points in chars are within s. + +Example [¶](#example-ContainsAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ContainsAny("team", "i")) + fmt.Println(strings.ContainsAny("fail", "ui")) + fmt.Println(strings.ContainsAny("ure", "ui")) + fmt.Println(strings.ContainsAny("failure", "ui")) + fmt.Println(strings.ContainsAny("foo", "")) + fmt.Println(strings.ContainsAny("", "")) +} +``` + +```None +Output: + +false +true +true +true +false +false +``` + +Share +Format +Run + +#### func [ContainsFunc](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=77) [¶](#ContainsFunc "Go to ContainsFunc") added in go1.21.0 + +```None +func ContainsFunc(s string, f func(rune) bool) bool +``` + +ContainsFunc reports whether any Unicode code points r within s satisfy f(r). + +Example [¶](#example-ContainsFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + f := func(r rune) bool { + return r == 'a' || r == 'e' || r == 'i' || r == 'o' || r == 'u' + } + fmt.Println(strings.ContainsFunc("hello", f)) + fmt.Println(strings.ContainsFunc("rhythms", f)) +} +``` + +```None +Output: + +true +false +``` + +Share +Format +Run + +#### func [ContainsRune](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=72) [¶](#ContainsRune "Go to ContainsRune") + +```None +func ContainsRune(s string, r rune) bool +``` + +ContainsRune reports whether the Unicode code point r is within s. + +Example [¶](#example-ContainsRune "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Finds whether a string contains a particular Unicode code point. + // The code point for the lowercase letter "a", for example, is 97. + fmt.Println(strings.ContainsRune("aardvark", 97)) + fmt.Println(strings.ContainsRune("timeout", 97)) +} +``` + +```None +Output: + +true +false +``` + +Share +Format +Run + +#### func [Count](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=42) [¶](#Count "Go to Count") + +```None +func Count(s, substr string) int +``` + +Count counts the number of non-overlapping instances of substr in s. +If substr is an empty string, Count returns 1 + the number of Unicode code points in s. + +Example [¶](#example-Count "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Count("cheese", "e")) + fmt.Println(strings.Count("five", "")) // before & after each rune +} +``` + +```None +Output: + +3 +5 +``` + +Share +Format +Run + +#### func [Cut](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=1278) [¶](#Cut "Go to Cut") added in go1.18 + +```None +func Cut(s, sep string) (before, after string, found bool) +``` + +Cut slices s around the first instance of sep, +returning the text before and after sep. +The found result reports whether sep appears in s. +If sep does not appear in s, cut returns s, "", false. + +Example [¶](#example-Cut "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + show := func(s, sep string) { + before, after, found := strings.Cut(s, sep) + fmt.Printf("Cut(%q, %q) = %q, %q, %v\n", s, sep, before, after, found) + } + show("Gopher", "Go") + show("Gopher", "ph") + show("Gopher", "er") + show("Gopher", "Badger") +} +``` + +```None +Output: + +Cut("Gopher", "Go") = "", "pher", true +Cut("Gopher", "ph") = "Go", "er", true +Cut("Gopher", "er") = "Goph", "", true +Cut("Gopher", "Badger") = "Gopher", "", false +``` + +Share +Format +Run + +#### func [CutPrefix](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=1286) [¶](#CutPrefix "Go to CutPrefix") added in go1.20 + +```None +func CutPrefix(s, prefix string) (after string, found bool) +``` + +CutPrefix returns s without the provided leading prefix string +and reports whether it found the prefix. +If s doesn't start with prefix, CutPrefix returns s, false. +If prefix is the empty string, CutPrefix returns s, true. + +Example [¶](#example-CutPrefix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + show := func(s, sep string) { + after, found := strings.CutPrefix(s, sep) + fmt.Printf("CutPrefix(%q, %q) = %q, %v\n", s, sep, after, found) + } + show("Gopher", "Go") + show("Gopher", "ph") +} +``` + +```None +Output: + +CutPrefix("Gopher", "Go") = "pher", true +CutPrefix("Gopher", "ph") = "Gopher", false +``` + +Share +Format +Run + +#### func [CutSuffix](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=1294) [¶](#CutSuffix "Go to CutSuffix") added in go1.20 + +```None +func CutSuffix(s, suffix string) (before string, found bool) +``` + +CutSuffix returns s without the provided ending suffix string +and reports whether it found the suffix. +If s doesn't end with suffix, CutSuffix returns s, false. +If suffix is the empty string, CutSuffix returns s, true. + +Example [¶](#example-CutSuffix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + show := func(s, sep string) { + before, found := strings.CutSuffix(s, sep) + fmt.Printf("CutSuffix(%q, %q) = %q, %v\n", s, sep, before, found) + } + show("Gopher", "Go") + show("Gopher", "er") +} +``` + +```None +Output: + +CutSuffix("Gopher", "Go") = "Gopher", false +CutSuffix("Gopher", "er") = "Goph", true +``` + +Share +Format +Run + +#### func [EqualFold](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=1187) [¶](#EqualFold "Go to EqualFold") + +```None +func EqualFold(s, t string) bool +``` + +EqualFold reports whether s and t, interpreted as UTF-8 strings, +are equal under simple Unicode case-folding, which is a more general +form of case-insensitivity. + +Example [¶](#example-EqualFold "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.EqualFold("Go", "go")) + fmt.Println(strings.EqualFold("AB", "ab")) // true because comparison uses simple case-folding + fmt.Println(strings.EqualFold("ß", "ss")) // false because comparison does not use full case-folding +} +``` + +```None +Output: + +true +true +false +``` + +Share +Format +Run + +#### func [Fields](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=382) [¶](#Fields "Go to Fields") + +```None +func Fields(s string) []string +``` + +Fields splits the string s around each instance of one or more consecutive white space +characters, as defined by [unicode.IsSpace](/unicode#IsSpace), returning a slice of substrings of s or an +empty slice if s contains only white space. + +Example [¶](#example-Fields "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("Fields are: %q", strings.Fields(" foo bar baz ")) +} +``` + +```None +Output: + +Fields are: ["foo" "bar" "baz"] +``` + +Share +Format +Run + +#### func [FieldsFunc](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=437) [¶](#FieldsFunc "Go to FieldsFunc") + +```None +func FieldsFunc(s string, f func(rune) bool) []string +``` + +FieldsFunc splits the string s at each run of Unicode code points c satisfying f(c) +and returns an array of slices of s. If all code points in s satisfy f(c) or the +string is empty, an empty slice is returned. + +FieldsFunc makes no guarantees about the order in which it calls f(c) +and assumes that f always returns the same value for a given c. + +Example [¶](#example-FieldsFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + f := func(c rune) bool { + return !unicode.IsLetter(c) && !unicode.IsNumber(c) + } + fmt.Printf("Fields are: %q", strings.FieldsFunc(" foo1;bar2,baz3...", f)) +} +``` + +```None +Output: + +Fields are: ["foo1" "bar2" "baz3"] +``` + +Share +Format +Run + +#### func [FieldsFuncSeq](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/iter.go;l=123) [¶](#FieldsFuncSeq "Go to FieldsFuncSeq") added in go1.24.0 + +```None +func FieldsFuncSeq(s string, f func(rune) bool) iter.Seq[string] +``` + +FieldsFuncSeq returns an iterator over substrings of s split around runs of +Unicode code points satisfying f(c). +The iterator yields the same strings that would be returned by [FieldsFunc](#FieldsFunc)(s), +but without constructing the slice. + +#### func [FieldsSeq](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/iter.go;l=90) [¶](#FieldsSeq "Go to FieldsSeq") added in go1.24.0 + +```None +func FieldsSeq(s string) iter.Seq[string] +``` + +FieldsSeq returns an iterator over substrings of s split around runs of +whitespace characters, as defined by [unicode.IsSpace](/unicode#IsSpace). +The iterator yields the same strings that would be returned by [Fields](#Fields)(s), +but without constructing the slice. + +#### func [HasPrefix](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=516) [¶](#HasPrefix "Go to HasPrefix") + +```None +func HasPrefix(s, prefix string) bool +``` + +HasPrefix reports whether the string s begins with prefix. + +Example [¶](#example-HasPrefix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.HasPrefix("Gopher", "Go")) + fmt.Println(strings.HasPrefix("Gopher", "C")) + fmt.Println(strings.HasPrefix("Gopher", "")) +} +``` + +```None +Output: + +true +false +true +``` + +Share +Format +Run + +#### func [HasSuffix](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=521) [¶](#HasSuffix "Go to HasSuffix") + +```None +func HasSuffix(s, suffix string) bool +``` + +HasSuffix reports whether the string s ends with suffix. + +Example [¶](#example-HasSuffix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.HasSuffix("Amigo", "go")) + fmt.Println(strings.HasSuffix("Amigo", "O")) + fmt.Println(strings.HasSuffix("Amigo", "Ami")) + fmt.Println(strings.HasSuffix("Amigo", "")) +} +``` + +```None +Output: + +true +false +false +true +``` + +Share +Format +Run + +#### func [Index](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=1270) [¶](#Index "Go to Index") + +```None +func Index(s, substr string) int +``` + +Index returns the index of the first instance of substr in s, or -1 if substr is not present in s. + +Example [¶](#example-Index "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Index("chicken", "ken")) + fmt.Println(strings.Index("chicken", "dmr")) +} +``` + +```None +Output: + +4 +-1 +``` + +Share +Format +Run + +#### func [IndexAny](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=201) [¶](#IndexAny "Go to IndexAny") + +```None +func IndexAny(s, chars string) int +``` + +IndexAny returns the index of the first instance of any Unicode code point +from chars in s, or -1 if no Unicode code point from chars is present in s. + +Example [¶](#example-IndexAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexAny("chicken", "aeiouy")) + fmt.Println(strings.IndexAny("crwth", "aeiouy")) +} +``` + +```None +Output: + +2 +-1 +``` + +Share +Format +Run + +#### func [IndexByte](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=119) [¶](#IndexByte "Go to IndexByte") added in go1.2 + +```None +func IndexByte(s string, c byte) int +``` + +IndexByte returns the index of the first instance of c in s, or -1 if c is not present in s. + +Example [¶](#example-IndexByte "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexByte("golang", 'g')) + fmt.Println(strings.IndexByte("gophers", 'h')) + fmt.Println(strings.IndexByte("golang", 'x')) +} +``` + +```None +Output: + +0 +3 +-1 +``` + +Share +Format +Run + +#### func [IndexFunc](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=912) [¶](#IndexFunc "Go to IndexFunc") + +```None +func IndexFunc(s string, f func(rune) bool) int +``` + +IndexFunc returns the index into s of the first Unicode +code point satisfying f(c), or -1 if none do. + +Example [¶](#example-IndexFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + f := func(c rune) bool { + return unicode.Is(unicode.Han, c) + } + fmt.Println(strings.IndexFunc("Hello, 世界", f)) + fmt.Println(strings.IndexFunc("Hello, world", f)) +} +``` + +```None +Output: + +7 +-1 +``` + +Share +Format +Run + +#### func [IndexRune](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=127) [¶](#IndexRune "Go to IndexRune") + +```None +func IndexRune(s string, r rune) int +``` + +IndexRune returns the index of the first instance of the Unicode code point +r, or -1 if rune is not present in s. +If r is [utf8.RuneError](/unicode/utf8#RuneError), it returns the first instance of any +invalid UTF-8 byte sequence. + +Example [¶](#example-IndexRune "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.IndexRune("chicken", 'k')) + fmt.Println(strings.IndexRune("chicken", 'd')) +} +``` + +```None +Output: + +4 +-1 +``` + +Share +Format +Run + +#### func [Join](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=483) [¶](#Join "Go to Join") + +```None +func Join(elems []string, sep string) string +``` + +Join concatenates the elements of its first argument to create a single string. The separator +string sep is placed between elements in the resulting string. + +Example [¶](#example-Join "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + s := []string{"foo", "bar", "baz"} + fmt.Println(strings.Join(s, ", ")) +} +``` + +```None +Output: + +foo, bar, baz +``` + +Share +Format +Run + +#### func [LastIndex](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=82) [¶](#LastIndex "Go to LastIndex") + +```None +func LastIndex(s, substr string) int +``` + +LastIndex returns the index of the last instance of substr in s, or -1 if substr is not present in s. + +Example [¶](#example-LastIndex "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Index("go gopher", "go")) + fmt.Println(strings.LastIndex("go gopher", "go")) + fmt.Println(strings.LastIndex("go gopher", "rodent")) +} +``` + +```None +Output: + +0 +3 +-1 +``` + +Share +Format +Run + +#### func [LastIndexAny](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=235) [¶](#LastIndexAny "Go to LastIndexAny") + +```None +func LastIndexAny(s, chars string) int +``` + +LastIndexAny returns the index of the last instance of any Unicode code +point from chars in s, or -1 if no Unicode code point from chars is +present in s. + +Example [¶](#example-LastIndexAny "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.LastIndexAny("go gopher", "go")) + fmt.Println(strings.LastIndexAny("go gopher", "rodent")) + fmt.Println(strings.LastIndexAny("go gopher", "fail")) +} +``` + +```None +Output: + +4 +8 +-1 +``` + +Share +Format +Run + +#### func [LastIndexByte](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=285) [¶](#LastIndexByte "Go to LastIndexByte") added in go1.5 + +```None +func LastIndexByte(s string, c byte) int +``` + +LastIndexByte returns the index of the last instance of c in s, or -1 if c is not present in s. + +Example [¶](#example-LastIndexByte "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.LastIndexByte("Hello, world", 'l')) + fmt.Println(strings.LastIndexByte("Hello, world", 'o')) + fmt.Println(strings.LastIndexByte("Hello, world", 'x')) +} +``` + +```None +Output: + +10 +8 +-1 +``` + +Share +Format +Run + +#### func [LastIndexFunc](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=918) [¶](#LastIndexFunc "Go to LastIndexFunc") + +```None +func LastIndexFunc(s string, f func(rune) bool) int +``` + +LastIndexFunc returns the index into s of the last +Unicode code point satisfying f(c), or -1 if none do. + +Example [¶](#example-LastIndexFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.LastIndexFunc("go 123", unicode.IsNumber)) + fmt.Println(strings.LastIndexFunc("123 go", unicode.IsNumber)) + fmt.Println(strings.LastIndexFunc("go", unicode.IsNumber)) +} +``` + +```None +Output: + +5 +2 +-1 +``` + +Share +Format +Run + +#### func [Lines](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/iter.go;l=18) [¶](#Lines "Go to Lines") added in go1.24.0 + +```None +func Lines(s string) iter.Seq[string] +``` + +Lines returns an iterator over the newline-terminated lines in the string s. +The lines yielded by the iterator include their terminating newlines. +If s is empty, the iterator yields no lines at all. +If s does not end in a newline, the final yielded line will not end in a newline. +It returns a single-use iterator. + +#### func [Map](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=528) [¶](#Map "Go to Map") + +```None +func Map(mapping func(rune) rune, s string) string +``` + +Map returns a copy of the string s with all its characters modified +according to the mapping function. If mapping returns a negative value, the character is +dropped from the string with no replacement. + +Example [¶](#example-Map "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + rot13 := func(r rune) rune { + switch { + case r >= 'A' && r <= 'Z': + return 'A' + (r-'A'+13)%26 + case r >= 'a' && r <= 'z': + return 'a' + (r-'a'+13)%26 + } + return r + } + fmt.Println(strings.Map(rot13, "'Twas brillig and the slithy gopher...")) +} +``` + +```None +Output: + +'Gjnf oevyyvt naq gur fyvgul tbcure... +``` + +Share +Format +Run + +#### func [Repeat](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=612) [¶](#Repeat "Go to Repeat") + +```None +func Repeat(s string, count int) string +``` + +Repeat returns a new string consisting of count copies of the string s. + +It panics if count is negative or if the result of (len(s) \* count) +overflows. + +Example [¶](#example-Repeat "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println("ba" + strings.Repeat("na", 2)) +} +``` + +```None +Output: + +banana +``` + +Share +Format +Run + +#### func [Replace](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=1141) [¶](#Replace "Go to Replace") + +```None +func Replace(s, old, new string, n int) string +``` + +Replace returns a copy of the string s with the first n +non-overlapping instances of old replaced by new. +If old is empty, it matches at the beginning of the string +and after each UTF-8 sequence, yielding up to k+1 replacements +for a k-rune string. +If n < 0, there is no limit on the number of replacements. + +Example [¶](#example-Replace "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.Replace("oink oink oink", "k", "ky", 2)) + fmt.Println(strings.Replace("oink oink oink", "oink", "moo", -1)) +} +``` + +```None +Output: + +oinky oinky oink +moo moo moo +``` + +Share +Format +Run + +#### func [ReplaceAll](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=1180) [¶](#ReplaceAll "Go to ReplaceAll") added in go1.12 + +```None +func ReplaceAll(s, old, new string) string +``` + +ReplaceAll returns a copy of the string s with all +non-overlapping instances of old replaced by new. +If old is empty, it matches at the beginning of the string +and after each UTF-8 sequence, yielding up to k+1 replacements +for a k-rune string. + +Example [¶](#example-ReplaceAll "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ReplaceAll("oink oink oink", "oink", "moo")) +} +``` + +```None +Output: + +moo moo moo +``` + +Share +Format +Run + +#### func [Split](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=361) [¶](#Split "Go to Split") + +```None +func Split(s, sep string) []string +``` + +Split slices s into all substrings separated by sep and returns a slice of +the substrings between those separators. + +If s does not contain sep and sep is not empty, Split returns a +slice of length 1 whose only element is s. + +If sep is empty, Split splits after each UTF-8 sequence. If both s +and sep are empty, Split returns an empty slice. + +It is equivalent to [SplitN](#SplitN) with a count of -1. + +To split around the first instance of a separator, see [Cut](#Cut). + +Example [¶](#example-Split "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.Split("a,b,c", ",")) + fmt.Printf("%q\n", strings.Split("a man a plan a canal panama", "a ")) + fmt.Printf("%q\n", strings.Split(" xyz ", "")) + fmt.Printf("%q\n", strings.Split("", "Bernardo O'Higgins")) +} +``` + +```None +Output: + +["a" "b" "c"] +["" "man " "plan " "canal panama"] +[" " "x" "y" "z" " "] +[""] +``` + +Share +Format +Run + +#### func [SplitAfter](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=373) [¶](#SplitAfter "Go to SplitAfter") + +```None +func SplitAfter(s, sep string) []string +``` + +SplitAfter slices s into all substrings after each instance of sep and +returns a slice of those substrings. + +If s does not contain sep and sep is not empty, SplitAfter returns +a slice of length 1 whose only element is s. + +If sep is empty, SplitAfter splits after each UTF-8 sequence. If +both s and sep are empty, SplitAfter returns an empty slice. + +It is equivalent to [SplitAfterN](#SplitAfterN) with a count of -1. + +Example [¶](#example-SplitAfter "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitAfter("a,b,c", ",")) +} +``` + +```None +Output: + +["a," "b," "c"] +``` + +Share +Format +Run + +#### func [SplitAfterN](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=345) [¶](#SplitAfterN "Go to SplitAfterN") + +```None +func SplitAfterN(s, sep string, n int) []string +``` + +SplitAfterN slices s into substrings after each instance of sep and +returns a slice of those substrings. + +The count determines the number of substrings to return: + +* n > 0: at most n substrings; the last substring will be the unsplit remainder; +* n == 0: the result is nil (zero substrings); +* n < 0: all substrings. + +Edge cases for s and sep (for example, empty strings) are handled +as described in the documentation for [SplitAfter](#SplitAfter). + +Example [¶](#example-SplitAfterN "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitAfterN("a,b,c", ",", 2)) +} +``` + +```None +Output: + +["a," "b,c"] +``` + +Share +Format +Run + +#### func [SplitAfterSeq](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/iter.go;l=82) [¶](#SplitAfterSeq "Go to SplitAfterSeq") added in go1.24.0 + +```None +func SplitAfterSeq(s, sep string) iter.Seq[string] +``` + +SplitAfterSeq returns an iterator over substrings of s split after each instance of sep. +The iterator yields the same strings that would be returned by [SplitAfter](#SplitAfter)(s, sep), +but without constructing the slice. +It returns a single-use iterator. + +#### func [SplitN](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=333) [¶](#SplitN "Go to SplitN") + +```None +func SplitN(s, sep string, n int) []string +``` + +SplitN slices s into substrings separated by sep and returns a slice of +the substrings between those separators. + +The count determines the number of substrings to return: + +* n > 0: at most n substrings; the last substring will be the unsplit remainder; +* n == 0: the result is nil (zero substrings); +* n < 0: all substrings. + +Edge cases for s and sep (for example, empty strings) are handled +as described in the documentation for [Split](#Split). + +To split around the first instance of a separator, see [Cut](#Cut). + +Example [¶](#example-SplitN "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%q\n", strings.SplitN("a,b,c", ",", 2)) + z := strings.SplitN("a,b,c", ",", 0) + fmt.Printf("%q (nil = %v)\n", z, z == nil) +} +``` + +```None +Output: + +["a" "b,c"] +[] (nil = true) +``` + +Share +Format +Run + +#### func [SplitSeq](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/iter.go;l=74) [¶](#SplitSeq "Go to SplitSeq") added in go1.24.0 + +```None +func SplitSeq(s, sep string) iter.Seq[string] +``` + +SplitSeq returns an iterator over all substrings of s separated by sep. +The iterator yields the same strings that would be returned by [Split](#Split)(s, sep), +but without constructing the slice. +It returns a single-use iterator. + +#### func [Title](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=864) deprecated + +```None +func Title(s string) string +``` + +Title returns a copy of the string s with all Unicode letters that begin words +mapped to their Unicode title case. + +Deprecated: The rule Title uses for word boundaries does not handle Unicode +punctuation properly. Use golang.org/x/text/cases instead. + +Example [¶](#example-Title "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Compare this example to the ToTitle example. + fmt.Println(strings.Title("her royal highness")) + fmt.Println(strings.Title("loud noises")) + fmt.Println(strings.Title("брат")) +} +``` + +```None +Output: + +Her Royal Highness +Loud Noises +Брат +``` + +Share +Format +Run + +#### func [ToLower](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=723) [¶](#ToLower "Go to ToLower") + +```None +func ToLower(s string) string +``` + +ToLower returns s with all Unicode letters mapped to their lower case. + +Example [¶](#example-ToLower "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ToLower("Gopher")) +} +``` + +```None +Output: + +gopher +``` + +Share +Format +Run + +#### func [ToLowerSpecial](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=774) [¶](#ToLowerSpecial "Go to ToLowerSpecial") + +```None +func ToLowerSpecial(c unicode.SpecialCase, s string) string +``` + +ToLowerSpecial returns a copy of the string s with all Unicode letters mapped to their +lower case using the case mapping specified by c. + +Example [¶](#example-ToLowerSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToLowerSpecial(unicode.TurkishCase, "Örnek İş")) +} +``` + +```None +Output: + +örnek iş +``` + +Share +Format +Run + +#### func [ToTitle](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=764) [¶](#ToTitle "Go to ToTitle") + +```None +func ToTitle(s string) string +``` + +ToTitle returns a copy of the string s with all Unicode letters mapped to +their Unicode title case. + +Example [¶](#example-ToTitle "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + // Compare this example to the Title example. + fmt.Println(strings.ToTitle("her royal highness")) + fmt.Println(strings.ToTitle("loud noises")) + fmt.Println(strings.ToTitle("брат")) +} +``` + +```None +Output: + +HER ROYAL HIGHNESS +LOUD NOISES +БРАТ +``` + +Share +Format +Run + +#### func [ToTitleSpecial](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=780) [¶](#ToTitleSpecial "Go to ToTitleSpecial") + +```None +func ToTitleSpecial(c unicode.SpecialCase, s string) string +``` + +ToTitleSpecial returns a copy of the string s with all Unicode letters mapped to their +Unicode title case, giving priority to the special casing rules. + +Example [¶](#example-ToTitleSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToTitleSpecial(unicode.TurkishCase, "dünyanın ilk borsa yapısı Aizonai kabul edilir")) +} +``` + +```None +Output: + +DÜNYANIN İLK BORSA YAPISI AİZONAİ KABUL EDİLİR +``` + +Share +Format +Run + +#### func [ToUpper](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=683) [¶](#ToUpper "Go to ToUpper") + +```None +func ToUpper(s string) string +``` + +ToUpper returns s with all Unicode letters mapped to their upper case. + +Example [¶](#example-ToUpper "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.ToUpper("Gopher")) +} +``` + +```None +Output: + +GOPHER +``` + +Share +Format +Run + +#### func [ToUpperSpecial](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=768) [¶](#ToUpperSpecial "Go to ToUpperSpecial") + +```None +func ToUpperSpecial(c unicode.SpecialCase, s string) string +``` + +ToUpperSpecial returns a copy of the string s with all Unicode letters mapped to their +upper case using the case mapping specified by c. + +Example [¶](#example-ToUpperSpecial "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Println(strings.ToUpperSpecial(unicode.TurkishCase, "örnek iş")) +} +``` + +```None +Output: + +ÖRNEK İŞ +``` + +Share +Format +Run + +#### func [ToValidUTF8](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=786) [¶](#ToValidUTF8 "Go to ToValidUTF8") added in go1.13 + +```None +func ToValidUTF8(s, replacement string) string +``` + +ToValidUTF8 returns a copy of the string s with each run of invalid UTF-8 byte sequences +replaced by the replacement string, which may be empty. + +Example [¶](#example-ToValidUTF8 "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Printf("%s\n", strings.ToValidUTF8("abc", "\uFFFD")) + fmt.Printf("%s\n", strings.ToValidUTF8("a\xffb\xC0\xAFc\xff", "")) + fmt.Printf("%s\n", strings.ToValidUTF8("\xed\xa0\x80", "abc")) +} +``` + +```None +Output: + +abc +abc +abc +``` + +Share +Format +Run + +#### func [Trim](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=978) [¶](#Trim "Go to Trim") + +```None +func Trim(s, cutset string) string +``` + +Trim returns a slice of the string s with all leading and +trailing Unicode code points contained in cutset removed. + +Example [¶](#example-Trim "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.Trim("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimFunc](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=906) [¶](#TrimFunc "Go to TrimFunc") + +```None +func TrimFunc(s string, f func(rune) bool) string +``` + +TrimFunc returns a slice of the string s with all leading +and trailing Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimLeft](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=995) [¶](#TrimLeft "Go to TrimLeft") + +```None +func TrimLeft(s, cutset string) string +``` + +TrimLeft returns a slice of the string s with all leading +Unicode code points contained in cutset removed. + +To remove a prefix, use [TrimPrefix](#TrimPrefix) instead. + +Example [¶](#example-TrimLeft "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.TrimLeft("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +Hello, Gophers!!! +``` + +Share +Format +Run + +#### func [TrimLeftFunc](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=883) [¶](#TrimLeftFunc "Go to TrimLeftFunc") + +```None +func TrimLeftFunc(s string, f func(rune) bool) string +``` + +TrimLeftFunc returns a slice of the string s with all leading +Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimLeftFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimLeftFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +Hello, Gophers!!! +``` + +Share +Format +Run + +#### func [TrimPrefix](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=1125) [¶](#TrimPrefix "Go to TrimPrefix") added in go1.1 + +```None +func TrimPrefix(s, prefix string) string +``` + +TrimPrefix returns s without the provided leading prefix string. +If s doesn't start with prefix, s is returned unchanged. + +Example [¶](#example-TrimPrefix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var s = "¡¡¡Hello, Gophers!!!" + s = strings.TrimPrefix(s, "¡¡¡Hello, ") + s = strings.TrimPrefix(s, "¡¡¡Howdy, ") + fmt.Print(s) +} +``` + +```None +Output: + +Gophers!!! +``` + +Share +Format +Run + +#### func [TrimRight](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=1043) [¶](#TrimRight "Go to TrimRight") + +```None +func TrimRight(s, cutset string) string +``` + +TrimRight returns a slice of the string s, with all trailing +Unicode code points contained in cutset removed. + +To remove a suffix, use [TrimSuffix](#TrimSuffix) instead. + +Example [¶](#example-TrimRight "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Print(strings.TrimRight("¡¡¡Hello, Gophers!!!", "!¡")) +} +``` + +```None +Output: + +¡¡¡Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimRightFunc](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=893) [¶](#TrimRightFunc "Go to TrimRightFunc") + +```None +func TrimRightFunc(s string, f func(rune) bool) string +``` + +TrimRightFunc returns a slice of the string s with all trailing +Unicode code points c satisfying f(c) removed. + +Example [¶](#example-TrimRightFunc "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" + "unicode" +) + +func main() { + fmt.Print(strings.TrimRightFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { + return !unicode.IsLetter(r) && !unicode.IsNumber(r) + })) +} +``` + +```None +Output: + +¡¡¡Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimSpace](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=1089) [¶](#TrimSpace "Go to TrimSpace") + +```None +func TrimSpace(s string) string +``` + +TrimSpace returns a slice of the string s, with all leading +and trailing white space removed, as defined by Unicode. + +Example [¶](#example-TrimSpace "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + fmt.Println(strings.TrimSpace(" \t\n Hello, Gophers \n\t\r\n")) +} +``` + +```None +Output: + +Hello, Gophers +``` + +Share +Format +Run + +#### func [TrimSuffix](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/strings.go;l=1131) [¶](#TrimSuffix "Go to TrimSuffix") added in go1.1 + +```None +func TrimSuffix(s, suffix string) string +``` + +TrimSuffix returns s without the provided trailing suffix string. +If s doesn't end with suffix, s is returned unchanged. + +Example [¶](#example-TrimSuffix "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var s = "¡¡¡Hello, Gophers!!!" + s = strings.TrimSuffix(s, ", Gophers!!!") + s = strings.TrimSuffix(s, ", Marmots!!!") + fmt.Print(s) +} +``` + +```None +Output: + +¡¡¡Hello +``` + +Share +Format +Run + +### Types [¶](#pkg-types "Go to Types") + +#### type [Builder](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/builder.go;l=17) [¶](#Builder "Go to Builder") added in go1.10 + +```None +type Builder struct { + // contains filtered or unexported fields +} +``` + +A Builder is used to efficiently build a string using [Builder.Write](#Builder.Write) methods. +It minimizes memory copying. The zero value is ready to use. +Do not copy a non-zero Builder. + +Example [¶](#example-Builder "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + var b strings.Builder + for i := 3; i >= 1; i-- { + fmt.Fprintf(&b, "%d...", i) + } + b.WriteString("ignition") + fmt.Println(b.String()) + +} +``` + +```None +Output: + +3...2...1...ignition +``` + +Share +Format +Run + +#### func (\*Builder) [Cap](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/builder.go;l=50) [¶](#Builder.Cap "Go to Builder.Cap") added in go1.12 + +```None +func (b *Builder) Cap() int +``` + +Cap returns the capacity of the builder's underlying byte slice. It is the +total space allocated for the string being built and includes any bytes +already written. + +#### func (\*Builder) [Grow](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/builder.go;l=69) [¶](#Builder.Grow "Go to Builder.Grow") added in go1.10 + +```None +func (b *Builder) Grow(n int) +``` + +Grow grows b's capacity, if necessary, to guarantee space for +another n bytes. After Grow(n), at least n bytes can be written to b +without another allocation. If n is negative, Grow panics. + +#### func (\*Builder) [Len](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/builder.go;l=45) [¶](#Builder.Len "Go to Builder.Len") added in go1.10 + +```None +func (b *Builder) Len() int +``` + +Len returns the number of accumulated bytes; b.Len() == len(b.String()). + +#### func (\*Builder) [Reset](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/builder.go;l=53) [¶](#Builder.Reset "Go to Builder.Reset") added in go1.10 + +```None +func (b *Builder) Reset() +``` + +Reset resets the [Builder](#Builder) to be empty. + +#### func (\*Builder) [String](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/builder.go;l=40) [¶](#Builder.String "Go to Builder.String") added in go1.10 + +```None +func (b *Builder) String() string +``` + +String returns the accumulated string. + +#### func (\*Builder) [Write](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/builder.go;l=81) [¶](#Builder.Write "Go to Builder.Write") added in go1.10 + +```None +func (b *Builder) Write(p []byte) (int, error) +``` + +Write appends the contents of p to b's buffer. +Write always returns len(p), nil. + +#### func (\*Builder) [WriteByte](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/builder.go;l=89) [¶](#Builder.WriteByte "Go to Builder.WriteByte") added in go1.10 + +```None +func (b *Builder) WriteByte(c byte) error +``` + +WriteByte appends the byte c to b's buffer. +The returned error is always nil. + +#### func (\*Builder) [WriteRune](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/builder.go;l=97) [¶](#Builder.WriteRune "Go to Builder.WriteRune") added in go1.10 + +```None +func (b *Builder) WriteRune(r rune) (int, error) +``` + +WriteRune appends the UTF-8 encoding of Unicode code point r to b's buffer. +It returns the length of r and a nil error. + +#### func (\*Builder) [WriteString](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/builder.go;l=106) [¶](#Builder.WriteString "Go to Builder.WriteString") added in go1.10 + +```None +func (b *Builder) WriteString(s string) (int, error) +``` + +WriteString appends the contents of s to b's buffer. +It returns the length of s and a nil error. + +#### type [Reader](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/reader.go;l=17) [¶](#Reader "Go to Reader") + +```None +type Reader struct { + // contains filtered or unexported fields +} +``` + +A Reader implements the [io.Reader](/io#Reader), [io.ReaderAt](/io#ReaderAt), [io.ByteReader](/io#ByteReader), [io.ByteScanner](/io#ByteScanner), +[io.RuneReader](/io#RuneReader), [io.RuneScanner](/io#RuneScanner), [io.Seeker](/io#Seeker), and [io.WriterTo](/io#WriterTo) interfaces by reading +from a string. +The zero value for Reader operates like a Reader of an empty string. + +#### func [NewReader](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/reader.go;l=160) [¶](#NewReader "Go to NewReader") + +```None +func NewReader(s string) *Reader +``` + +NewReader returns a new [Reader](#Reader) reading from s. +It is similar to [bytes.NewBufferString](/bytes#NewBufferString) but more efficient and non-writable. + +#### func (\*Reader) [Len](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/reader.go;l=25) [¶](#Reader.Len "Go to Reader.Len") + +```None +func (r *Reader) Len() int +``` + +Len returns the number of bytes of the unread portion of the +string. + +#### func (\*Reader) [Read](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/reader.go;l=39) [¶](#Reader.Read "Go to Reader.Read") + +```None +func (r *Reader) Read(b []byte) (n int, err error) +``` + +Read implements the [io.Reader](/io#Reader) interface. + +#### func (\*Reader) [ReadAt](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/reader.go;l=50) [¶](#Reader.ReadAt "Go to Reader.ReadAt") + +```None +func (r *Reader) ReadAt(b []byte, off int64) (n int, err error) +``` + +ReadAt implements the [io.ReaderAt](/io#ReaderAt) interface. + +#### func (\*Reader) [ReadByte](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/reader.go;l=66) [¶](#Reader.ReadByte "Go to Reader.ReadByte") + +```None +func (r *Reader) ReadByte() (byte, error) +``` + +ReadByte implements the [io.ByteReader](/io#ByteReader) interface. + +#### func (\*Reader) [ReadRune](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/reader.go;l=87) [¶](#Reader.ReadRune "Go to Reader.ReadRune") + +```None +func (r *Reader) ReadRune() (ch rune, size int, err error) +``` + +ReadRune implements the [io.RuneReader](/io#RuneReader) interface. + +#### func (\*Reader) [Reset](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/reader.go;l=156) [¶](#Reader.Reset "Go to Reader.Reset") added in go1.7 + +```None +func (r *Reader) Reset(s string) +``` + +Reset resets the [Reader](#Reader) to be reading from s. + +#### func (\*Reader) [Seek](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/reader.go;l=116) [¶](#Reader.Seek "Go to Reader.Seek") + +```None +func (r *Reader) Seek(offset int64, whence int) (int64, error) +``` + +Seek implements the [io.Seeker](/io#Seeker) interface. + +#### func (\*Reader) [Size](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/reader.go;l=36) [¶](#Reader.Size "Go to Reader.Size") added in go1.5 + +```None +func (r *Reader) Size() int64 +``` + +Size returns the original length of the underlying string. +Size is the number of bytes available for reading via [Reader.ReadAt](#Reader.ReadAt). +The returned value is always the same and is not affected by calls +to any other method. + +#### func (\*Reader) [UnreadByte](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/reader.go;l=77) [¶](#Reader.UnreadByte "Go to Reader.UnreadByte") + +```None +func (r *Reader) UnreadByte() error +``` + +UnreadByte implements the [io.ByteScanner](/io#ByteScanner) interface. + +#### func (\*Reader) [UnreadRune](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/reader.go;l=103) [¶](#Reader.UnreadRune "Go to Reader.UnreadRune") + +```None +func (r *Reader) UnreadRune() error +``` + +UnreadRune implements the [io.RuneScanner](/io#RuneScanner) interface. + +#### func (\*Reader) [WriteTo](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/reader.go;l=137) [¶](#Reader.WriteTo "Go to Reader.WriteTo") added in go1.1 + +```None +func (r *Reader) WriteTo(w io.Writer) (n int64, err error) +``` + +WriteTo implements the [io.WriterTo](/io#WriterTo) interface. + +#### type [Replacer](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/replace.go;l=14) [¶](#Replacer "Go to Replacer") + +```None +type Replacer struct { + // contains filtered or unexported fields +} +``` + +Replacer replaces a list of strings with replacements. +It is safe for concurrent use by multiple goroutines. + +#### func [NewReplacer](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/replace.go;l=32) [¶](#NewReplacer "Go to NewReplacer") + +```None +func NewReplacer(oldnew ...string) *Replacer +``` + +NewReplacer returns a new [Replacer](#Replacer) from a list of old, new string +pairs. Replacements are performed in the order they appear in the +target string, without overlapping matches. The old string +comparisons are done in argument order. + +NewReplacer panics if given an odd number of arguments. + +Example [¶](#example-NewReplacer "Go to Example") + +```None +package main + +import ( + "fmt" + "strings" +) + +func main() { + r := strings.NewReplacer("<", "<", ">", ">") + fmt.Println(r.Replace("This is HTML!")) +} +``` + +```None +Output: + +This is <b>HTML</b>! +``` + +Share +Format +Run + +#### func (\*Replacer) [Replace](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/replace.go;l=95) [¶](#Replacer.Replace "Go to Replacer.Replace") + +```None +func (r *Replacer) Replace(s string) string +``` + +Replace returns a copy of s with all replacements performed. + +#### func (\*Replacer) [WriteString](https://cs.opensource.google/go/go/+/go1.24.0:src/strings/replace.go;l=101) [¶](#Replacer.WriteString "Go to Replacer.WriteString") + +```None +func (r *Replacer) WriteString(w io.Writer, s string) (n int, err error) +``` + +WriteString writes s to w with all replacements performed. diff --git a/corpus/docs/golang/sync/sync_go118.md b/corpus/docs/golang/sync/sync_go118.md new file mode 100644 index 0000000000000000000000000000000000000000..d70f61e329f568183a87701e56d7b2e051ed7ca4 --- /dev/null +++ b/corpus/docs/golang/sync/sync_go118.md @@ -0,0 +1,693 @@ +# Golang - sync + +Source: https://pkg.go.dev/sync@go1.18 +Version: go1.18 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package sync provides basic synchronization primitives such as mutual +exclusion locks. Other than the Once and WaitGroup types, most are intended +for use by low-level library routines. Higher-level synchronization is +better done via channels and communication. + +Values containing the types defined in this package should not be copied. + +### Index [¶](#pkg-index "Go to Index") + +* [type Cond](#Cond) +* + [func NewCond(l Locker) \*Cond](#NewCond) +* + [func (c \*Cond) Broadcast()](#Cond.Broadcast) + + [func (c \*Cond) Signal()](#Cond.Signal) + + [func (c \*Cond) Wait()](#Cond.Wait) +* [type Locker](#Locker) +* [type Map](#Map) +* + [func (m \*Map) Delete(key any)](#Map.Delete) + + [func (m \*Map) Load(key any) (value any, ok bool)](#Map.Load) + + [func (m \*Map) LoadAndDelete(key any) (value any, loaded bool)](#Map.LoadAndDelete) + + [func (m \*Map) LoadOrStore(key, value any) (actual any, loaded bool)](#Map.LoadOrStore) + + [func (m \*Map) Range(f func(key, value any) bool)](#Map.Range) + + [func (m \*Map) Store(key, value any)](#Map.Store) +* [type Mutex](#Mutex) +* + [func (m \*Mutex) Lock()](#Mutex.Lock) + + [func (m \*Mutex) TryLock() bool](#Mutex.TryLock) + + [func (m \*Mutex) Unlock()](#Mutex.Unlock) +* [type Once](#Once) +* + [func (o \*Once) Do(f func())](#Once.Do) +* [type Pool](#Pool) +* + [func (p \*Pool) Get() any](#Pool.Get) + + [func (p \*Pool) Put(x any)](#Pool.Put) +* [type RWMutex](#RWMutex) +* + [func (rw \*RWMutex) Lock()](#RWMutex.Lock) + + [func (rw \*RWMutex) RLock()](#RWMutex.RLock) + + [func (rw \*RWMutex) RLocker() Locker](#RWMutex.RLocker) + + [func (rw \*RWMutex) RUnlock()](#RWMutex.RUnlock) + + [func (rw \*RWMutex) TryLock() bool](#RWMutex.TryLock) + + [func (rw \*RWMutex) TryRLock() bool](#RWMutex.TryRLock) + + [func (rw \*RWMutex) Unlock()](#RWMutex.Unlock) +* [type WaitGroup](#WaitGroup) +* + [func (wg \*WaitGroup) Add(delta int)](#WaitGroup.Add) + + [func (wg \*WaitGroup) Done()](#WaitGroup.Done) + + [func (wg \*WaitGroup) Wait()](#WaitGroup.Wait) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Once](#example-Once) +* [Pool](#example-Pool) +* [WaitGroup](#example-WaitGroup) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +This section is empty. + +### Types [¶](#pkg-types "Go to Types") + +#### type [Cond](https://cs.opensource.google/go/go/+/go1.18:src/sync/cond.go;l=21) [¶](#Cond "Go to Cond") + +```None +type Cond struct { + + // L is held while observing or changing the condition + L Locker + // contains filtered or unexported fields +} +``` + +Cond implements a condition variable, a rendezvous point +for goroutines waiting for or announcing the occurrence +of an event. + +Each Cond has an associated Locker L (often a \*Mutex or \*RWMutex), +which must be held when changing the condition and +when calling the Wait method. + +A Cond must not be copied after first use. + +#### func [NewCond](https://cs.opensource.google/go/go/+/go1.18:src/sync/cond.go;l=32) [¶](#NewCond "Go to NewCond") + +```None +func NewCond(l Locker) *Cond +``` + +NewCond returns a new Cond with Locker l. + +#### func (\*Cond) [Broadcast](https://cs.opensource.google/go/go/+/go1.18:src/sync/cond.go;l=73) [¶](#Cond.Broadcast "Go to Cond.Broadcast") + +```None +func (c *Cond) Broadcast() +``` + +Broadcast wakes all goroutines waiting on c. + +It is allowed but not required for the caller to hold c.L +during the call. + +#### func (\*Cond) [Signal](https://cs.opensource.google/go/go/+/go1.18:src/sync/cond.go;l=64) [¶](#Cond.Signal "Go to Cond.Signal") + +```None +func (c *Cond) Signal() +``` + +Signal wakes one goroutine waiting on c, if there is any. + +It is allowed but not required for the caller to hold c.L +during the call. + +#### func (\*Cond) [Wait](https://cs.opensource.google/go/go/+/go1.18:src/sync/cond.go;l=52) [¶](#Cond.Wait "Go to Cond.Wait") + +```None +func (c *Cond) Wait() +``` + +Wait atomically unlocks c.L and suspends execution +of the calling goroutine. After later resuming execution, +Wait locks c.L before returning. Unlike in other systems, +Wait cannot return unless awoken by Broadcast or Signal. + +Because c.L is not locked when Wait first resumes, the caller +typically cannot assume that the condition is true when +Wait returns. Instead, the caller should Wait in a loop: + +```None +c.L.Lock() +for !condition() { + c.Wait() +} +... make use of condition ... +c.L.Unlock() +``` + +#### type [Locker](https://cs.opensource.google/go/go/+/go1.18:src/sync/mutex.go;l=31) [¶](#Locker "Go to Locker") + +```None +type Locker interface { + Lock() + Unlock() +} +``` + +A Locker represents an object that can be locked and unlocked. + +#### type [Map](https://cs.opensource.google/go/go/+/go1.18:src/sync/map.go;l=27) [¶](#Map "Go to Map") added in go1.9 + +```None +type Map struct { + // contains filtered or unexported fields +} +``` + +Map is like a Go map[interface{}]interface{} but is safe for concurrent use +by multiple goroutines without additional locking or coordination. +Loads, stores, and deletes run in amortized constant time. + +The Map type is specialized. Most code should use a plain Go map instead, +with separate locking or coordination, for better type safety and to make it +easier to maintain other invariants along with the map content. + +The Map type is optimized for two common use cases: (1) when the entry for a given +key is only ever written once but read many times, as in caches that only grow, +or (2) when multiple goroutines read, write, and overwrite entries for disjoint +sets of keys. In these two cases, use of a Map may significantly reduce lock +contention compared to a Go map paired with a separate Mutex or RWMutex. + +The zero Map is empty and ready for use. A Map must not be copied after first use. + +#### func (\*Map) [Delete](https://cs.opensource.google/go/go/+/go1.18:src/sync/map.go;l=293) [¶](#Map.Delete "Go to Map.Delete") added in go1.9 + +```None +func (m *Map) Delete(key any) +``` + +Delete deletes the value for a key. + +#### func (\*Map) [Load](https://cs.opensource.google/go/go/+/go1.18:src/sync/map.go;l=103) [¶](#Map.Load "Go to Map.Load") added in go1.9 + +```None +func (m *Map) Load(key any) (value any, ok bool) +``` + +Load returns the value stored in the map for a key, or nil if no +value is present. +The ok result indicates whether value was found in the map. + +#### func (\*Map) [LoadAndDelete](https://cs.opensource.google/go/go/+/go1.18:src/sync/map.go;l=269) [¶](#Map.LoadAndDelete "Go to Map.LoadAndDelete") added in go1.15 + +```None +func (m *Map) LoadAndDelete(key any) (value any, loaded bool) +``` + +LoadAndDelete deletes the value for a key, returning the previous value if any. +The loaded result reports whether the key was present. + +#### func (\*Map) [LoadOrStore](https://cs.opensource.google/go/go/+/go1.18:src/sync/map.go;l=200) [¶](#Map.LoadOrStore "Go to Map.LoadOrStore") added in go1.9 + +```None +func (m *Map) LoadOrStore(key, value any) (actual any, loaded bool) +``` + +LoadOrStore returns the existing value for the key if present. +Otherwise, it stores and returns the given value. +The loaded result is true if the value was loaded, false if stored. + +#### func (\*Map) [Range](https://cs.opensource.google/go/go/+/go1.18:src/sync/map.go;l=320) [¶](#Map.Range "Go to Map.Range") added in go1.9 + +```None +func (m *Map) Range(f func(key, value any) bool) +``` + +Range calls f sequentially for each key and value present in the map. +If f returns false, range stops the iteration. + +Range does not necessarily correspond to any consistent snapshot of the Map's +contents: no key will be visited more than once, but if the value for any key +is stored or deleted concurrently (including by f), Range may reflect any +mapping for that key from any point during the Range call. Range does not +block other methods on the receiver; even f itself may call any method on m. + +Range may be O(N) with the number of elements in the map even if f returns +false after a constant number of calls. + +#### func (\*Map) [Store](https://cs.opensource.google/go/go/+/go1.18:src/sync/map.go;l=137) [¶](#Map.Store "Go to Map.Store") added in go1.9 + +```None +func (m *Map) Store(key, value any) +``` + +Store sets the value for a key. + +#### type [Mutex](https://cs.opensource.google/go/go/+/go1.18:src/sync/mutex.go;l=25) [¶](#Mutex "Go to Mutex") + +```None +type Mutex struct { + // contains filtered or unexported fields +} +``` + +A Mutex is a mutual exclusion lock. +The zero value for a Mutex is an unlocked mutex. + +A Mutex must not be copied after first use. + +#### func (\*Mutex) [Lock](https://cs.opensource.google/go/go/+/go1.18:src/sync/mutex.go;l=72) [¶](#Mutex.Lock "Go to Mutex.Lock") + +```None +func (m *Mutex) Lock() +``` + +Lock locks m. +If the lock is already in use, the calling goroutine +blocks until the mutex is available. + +#### func (\*Mutex) [TryLock](https://cs.opensource.google/go/go/+/go1.18:src/sync/mutex.go;l=89) [¶](#Mutex.TryLock "Go to Mutex.TryLock") added in go1.18 + +```None +func (m *Mutex) TryLock() bool +``` + +TryLock tries to lock m and reports whether it succeeded. + +Note that while correct uses of TryLock do exist, they are rare, +and use of TryLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*Mutex) [Unlock](https://cs.opensource.google/go/go/+/go1.18:src/sync/mutex.go;l=203) [¶](#Mutex.Unlock "Go to Mutex.Unlock") + +```None +func (m *Mutex) Unlock() +``` + +Unlock unlocks m. +It is a run-time error if m is not locked on entry to Unlock. + +A locked Mutex is not associated with a particular goroutine. +It is allowed for one goroutine to lock a Mutex and then +arrange for another goroutine to unlock it. + +#### type [Once](https://cs.opensource.google/go/go/+/go1.18:src/sync/once.go;l=14) [¶](#Once "Go to Once") + +```None +type Once struct { + // contains filtered or unexported fields +} +``` + +Once is an object that will perform exactly one action. + +A Once must not be copied after first use. + +Example [¶](#example-Once "Go to Example") + +```None +package main + +import ( + "fmt" + "sync" +) + +func main() { + var once sync.Once + onceBody := func() { + fmt.Println("Only once") + } + done := make(chan bool) + for i := 0; i < 10; i++ { + go func() { + once.Do(onceBody) + done <- true + }() + } + for i := 0; i < 10; i++ { + <-done + } +} +``` + +```None +Output: + +Only once +``` + +Share +Format +Run + +#### func (\*Once) [Do](https://cs.opensource.google/go/go/+/go1.18:src/sync/once.go;l=42) [¶](#Once.Do "Go to Once.Do") + +```None +func (o *Once) Do(f func()) +``` + +Do calls the function f if and only if Do is being called for the +first time for this instance of Once. In other words, given + +```None +var once Once +``` + +if once.Do(f) is called multiple times, only the first call will invoke f, +even if f has a different value in each invocation. A new instance of +Once is required for each function to execute. + +Do is intended for initialization that must be run exactly once. Since f +is niladic, it may be necessary to use a function literal to capture the +arguments to a function to be invoked by Do: + +```None +config.once.Do(func() { config.init(filename) }) +``` + +Because no call to Do returns until the one call to f returns, if f causes +Do to be called, it will deadlock. + +If f panics, Do considers it to have returned; future calls of Do return +without calling f. + +#### type [Pool](https://cs.opensource.google/go/go/+/go1.18:src/sync/pool.go;l=44) [¶](#Pool "Go to Pool") added in go1.3 + +```None +type Pool struct { + + // New optionally specifies a function to generate + // a value when Get would otherwise return nil. + // It may not be changed concurrently with calls to Get. + New func() any + // contains filtered or unexported fields +} +``` + +A Pool is a set of temporary objects that may be individually saved and +retrieved. + +Any item stored in the Pool may be removed automatically at any time without +notification. If the Pool holds the only reference when this happens, the +item might be deallocated. + +A Pool is safe for use by multiple goroutines simultaneously. + +Pool's purpose is to cache allocated but unused items for later reuse, +relieving pressure on the garbage collector. That is, it makes it easy to +build efficient, thread-safe free lists. However, it is not suitable for all +free lists. + +An appropriate use of a Pool is to manage a group of temporary items +silently shared among and potentially reused by concurrent independent +clients of a package. Pool provides a way to amortize allocation overhead +across many clients. + +An example of good use of a Pool is in the fmt package, which maintains a +dynamically-sized store of temporary output buffers. The store scales under +load (when many goroutines are actively printing) and shrinks when +quiescent. + +On the other hand, a free list maintained as part of a short-lived object is +not a suitable use for a Pool, since the overhead does not amortize well in +that scenario. It is more efficient to have such objects implement their own +free list. + +A Pool must not be copied after first use. + +Example [¶](#example-Pool "Go to Example") + +```None +package main + +import ( + "bytes" + "io" + "os" + "sync" + "time" +) + +var bufPool = sync.Pool{ + New: func() any { + // The Pool's New function should generally only return pointer + // types, since a pointer can be put into the return interface + // value without an allocation: + return new(bytes.Buffer) + }, +} + +// timeNow is a fake version of time.Now for tests. +func timeNow() time.Time { + return time.Unix(1136214245, 0) +} + +func Log(w io.Writer, key, val string) { + b := bufPool.Get().(*bytes.Buffer) + b.Reset() + // Replace this with time.Now() in a real logger. + b.WriteString(timeNow().UTC().Format(time.RFC3339)) + b.WriteByte(' ') + b.WriteString(key) + b.WriteByte('=') + b.WriteString(val) + w.Write(b.Bytes()) + bufPool.Put(b) +} + +func main() { + Log(os.Stdout, "path", "/search?q=flowers") +} +``` + +```None +Output: + +2006-01-02T15:04:05Z path=/search?q=flowers +``` + +Share +Format +Run + +#### func (\*Pool) [Get](https://cs.opensource.google/go/go/+/go1.18:src/sync/pool.go;l=124) [¶](#Pool.Get "Go to Pool.Get") added in go1.3 + +```None +func (p *Pool) Get() any +``` + +Get selects an arbitrary item from the Pool, removes it from the +Pool, and returns it to the caller. +Get may choose to ignore the pool and treat it as empty. +Callers should not assume any relation between values passed to Put and +the values returned by Get. + +If Get would otherwise return nil and p.New is non-nil, Get returns +the result of calling p.New. + +#### func (\*Pool) [Put](https://cs.opensource.google/go/go/+/go1.18:src/sync/pool.go;l=90) [¶](#Pool.Put "Go to Pool.Put") added in go1.3 + +```None +func (p *Pool) Put(x any) +``` + +Put adds x to the pool. + +#### type [RWMutex](https://cs.opensource.google/go/go/+/go1.18:src/sync/rwmutex.go;l=28) [¶](#RWMutex "Go to RWMutex") + +```None +type RWMutex struct { + // contains filtered or unexported fields +} +``` + +A RWMutex is a reader/writer mutual exclusion lock. +The lock can be held by an arbitrary number of readers or a single writer. +The zero value for a RWMutex is an unlocked mutex. + +A RWMutex must not be copied after first use. + +If a goroutine holds a RWMutex for reading and another goroutine might +call Lock, no goroutine should expect to be able to acquire a read lock +until the initial read lock is released. In particular, this prohibits +recursive read locking. This is to ensure that the lock eventually becomes +available; a blocked Lock call excludes new readers from acquiring the +lock. + +#### func (\*RWMutex) [Lock](https://cs.opensource.google/go/go/+/go1.18:src/sync/rwmutex.go;l=133) [¶](#RWMutex.Lock "Go to RWMutex.Lock") + +```None +func (rw *RWMutex) Lock() +``` + +Lock locks rw for writing. +If the lock is already locked for reading or writing, +Lock blocks until the lock is available. + +#### func (\*RWMutex) [RLock](https://cs.opensource.google/go/go/+/go1.18:src/sync/rwmutex.go;l=56) [¶](#RWMutex.RLock "Go to RWMutex.RLock") + +```None +func (rw *RWMutex) RLock() +``` + +RLock locks rw for reading. + +It should not be used for recursive read locking; a blocked Lock +call excludes new readers from acquiring the lock. See the +documentation on the RWMutex type. + +#### func (\*RWMutex) [RLocker](https://cs.opensource.google/go/go/+/go1.18:src/sync/rwmutex.go;l=216) [¶](#RWMutex.RLocker "Go to RWMutex.RLocker") + +```None +func (rw *RWMutex) RLocker() Locker +``` + +RLocker returns a Locker interface that implements +the Lock and Unlock methods by calling rw.RLock and rw.RUnlock. + +#### func (\*RWMutex) [RUnlock](https://cs.opensource.google/go/go/+/go1.18:src/sync/rwmutex.go;l=103) [¶](#RWMutex.RUnlock "Go to RWMutex.RUnlock") + +```None +func (rw *RWMutex) RUnlock() +``` + +RUnlock undoes a single RLock call; +it does not affect other simultaneous readers. +It is a run-time error if rw is not locked for reading +on entry to RUnlock. + +#### func (\*RWMutex) [TryLock](https://cs.opensource.google/go/go/+/go1.18:src/sync/rwmutex.go;l=158) [¶](#RWMutex.TryLock "Go to RWMutex.TryLock") added in go1.18 + +```None +func (rw *RWMutex) TryLock() bool +``` + +TryLock tries to lock rw for writing and reports whether it succeeded. + +Note that while correct uses of TryLock do exist, they are rare, +and use of TryLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*RWMutex) [TryRLock](https://cs.opensource.google/go/go/+/go1.18:src/sync/rwmutex.go;l=76) [¶](#RWMutex.TryRLock "Go to RWMutex.TryRLock") added in go1.18 + +```None +func (rw *RWMutex) TryRLock() bool +``` + +TryRLock tries to lock rw for reading and reports whether it succeeded. + +Note that while correct uses of TryRLock do exist, they are rare, +and use of TryRLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*RWMutex) [Unlock](https://cs.opensource.google/go/go/+/go1.18:src/sync/rwmutex.go;l=190) [¶](#RWMutex.Unlock "Go to RWMutex.Unlock") + +```None +func (rw *RWMutex) Unlock() +``` + +Unlock unlocks rw for writing. It is a run-time error if rw is +not locked for writing on entry to Unlock. + +As with Mutexes, a locked RWMutex is not associated with a particular +goroutine. One goroutine may RLock (Lock) a RWMutex and then +arrange for another goroutine to RUnlock (Unlock) it. + +#### type [WaitGroup](https://cs.opensource.google/go/go/+/go1.18:src/sync/waitgroup.go;l=20) [¶](#WaitGroup "Go to WaitGroup") + +```None +type WaitGroup struct { + // contains filtered or unexported fields +} +``` + +A WaitGroup waits for a collection of goroutines to finish. +The main goroutine calls Add to set the number of +goroutines to wait for. Then each of the goroutines +runs and calls Done when finished. At the same time, +Wait can be used to block until all goroutines have finished. + +A WaitGroup must not be copied after first use. + +Example [¶](#example-WaitGroup "Go to Example") + +This example fetches several URLs concurrently, +using a WaitGroup to block until all the fetches are complete. + +```None +package main + +import ( + "sync" +) + +type httpPkg struct{} + +func (httpPkg) Get(url string) {} + +var http httpPkg + +func main() { + var wg sync.WaitGroup + var urls = []string{ + "http://www.golang.org/", + "http://www.google.com/", + "http://www.example.com/", + } + for _, url := range urls { + // Increment the WaitGroup counter. + wg.Add(1) + // Launch a goroutine to fetch the URL. + go func(url string) { + // Decrement the counter when the goroutine completes. + defer wg.Done() + // Fetch the URL. + http.Get(url) + }(url) + } + // Wait for all HTTP fetches to complete. + wg.Wait() +} +``` + +Share +Format +Run + +#### func (\*WaitGroup) [Add](https://cs.opensource.google/go/go/+/go1.18:src/sync/waitgroup.go;l=59) [¶](#WaitGroup.Add "Go to WaitGroup.Add") + +```None +func (wg *WaitGroup) Add(delta int) +``` + +Add adds delta, which may be negative, to the WaitGroup counter. +If the counter becomes zero, all goroutines blocked on Wait are released. +If the counter goes negative, Add panics. + +Note that calls with a positive delta that occur when the counter is zero +must happen before a Wait. Calls with a negative delta, or calls with a +positive delta that start when the counter is greater than zero, may happen +at any time. +Typically this means the calls to Add should execute before the statement +creating the goroutine or other event to be waited for. +If a WaitGroup is reused to wait for several independent sets of events, +new Add calls must happen after all previous Wait calls have returned. +See the WaitGroup example. + +#### func (\*WaitGroup) [Done](https://cs.opensource.google/go/go/+/go1.18:src/sync/waitgroup.go;l=104) [¶](#WaitGroup.Done "Go to WaitGroup.Done") + +```None +func (wg *WaitGroup) Done() +``` + +Done decrements the WaitGroup counter by one. + +#### func (\*WaitGroup) [Wait](https://cs.opensource.google/go/go/+/go1.18:src/sync/waitgroup.go;l=109) [¶](#WaitGroup.Wait "Go to WaitGroup.Wait") + +```None +func (wg *WaitGroup) Wait() +``` + +Wait blocks until the WaitGroup counter is zero. diff --git a/corpus/docs/golang/sync/sync_go119.md b/corpus/docs/golang/sync/sync_go119.md new file mode 100644 index 0000000000000000000000000000000000000000..4ab0b699d55f5b8fb681ee31a8b97bf04c343db2 --- /dev/null +++ b/corpus/docs/golang/sync/sync_go119.md @@ -0,0 +1,742 @@ +# Golang - sync + +Source: https://pkg.go.dev/sync@go1.19 +Version: go1.19 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package sync provides basic synchronization primitives such as mutual +exclusion locks. Other than the Once and WaitGroup types, most are intended +for use by low-level library routines. Higher-level synchronization is +better done via channels and communication. + +Values containing the types defined in this package should not be copied. + +### Index [¶](#pkg-index "Go to Index") + +* [type Cond](#Cond) +* + [func NewCond(l Locker) \*Cond](#NewCond) +* + [func (c \*Cond) Broadcast()](#Cond.Broadcast) + + [func (c \*Cond) Signal()](#Cond.Signal) + + [func (c \*Cond) Wait()](#Cond.Wait) +* [type Locker](#Locker) +* [type Map](#Map) +* + [func (m \*Map) Delete(key any)](#Map.Delete) + + [func (m \*Map) Load(key any) (value any, ok bool)](#Map.Load) + + [func (m \*Map) LoadAndDelete(key any) (value any, loaded bool)](#Map.LoadAndDelete) + + [func (m \*Map) LoadOrStore(key, value any) (actual any, loaded bool)](#Map.LoadOrStore) + + [func (m \*Map) Range(f func(key, value any) bool)](#Map.Range) + + [func (m \*Map) Store(key, value any)](#Map.Store) +* [type Mutex](#Mutex) +* + [func (m \*Mutex) Lock()](#Mutex.Lock) + + [func (m \*Mutex) TryLock() bool](#Mutex.TryLock) + + [func (m \*Mutex) Unlock()](#Mutex.Unlock) +* [type Once](#Once) +* + [func (o \*Once) Do(f func())](#Once.Do) +* [type Pool](#Pool) +* + [func (p \*Pool) Get() any](#Pool.Get) + + [func (p \*Pool) Put(x any)](#Pool.Put) +* [type RWMutex](#RWMutex) +* + [func (rw \*RWMutex) Lock()](#RWMutex.Lock) + + [func (rw \*RWMutex) RLock()](#RWMutex.RLock) + + [func (rw \*RWMutex) RLocker() Locker](#RWMutex.RLocker) + + [func (rw \*RWMutex) RUnlock()](#RWMutex.RUnlock) + + [func (rw \*RWMutex) TryLock() bool](#RWMutex.TryLock) + + [func (rw \*RWMutex) TryRLock() bool](#RWMutex.TryRLock) + + [func (rw \*RWMutex) Unlock()](#RWMutex.Unlock) +* [type WaitGroup](#WaitGroup) +* + [func (wg \*WaitGroup) Add(delta int)](#WaitGroup.Add) + + [func (wg \*WaitGroup) Done()](#WaitGroup.Done) + + [func (wg \*WaitGroup) Wait()](#WaitGroup.Wait) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Once](#example-Once) +* [Pool](#example-Pool) +* [WaitGroup](#example-WaitGroup) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +This section is empty. + +### Types [¶](#pkg-types "Go to Types") + +#### type [Cond](https://cs.opensource.google/go/go/+/go1.19:src/sync/cond.go;l=36) [¶](#Cond "Go to Cond") + +```None +type Cond struct { + + // L is held while observing or changing the condition + L Locker + // contains filtered or unexported fields +} +``` + +Cond implements a condition variable, a rendezvous point +for goroutines waiting for or announcing the occurrence +of an event. + +Each Cond has an associated Locker L (often a \*Mutex or \*RWMutex), +which must be held when changing the condition and +when calling the Wait method. + +A Cond must not be copied after first use. + +In the terminology of the Go memory model, Cond arranges that +a call to Broadcast or Signal “synchronizes before” any Wait call +that it unblocks. + +For many simple use cases, users will be better off using channels than a +Cond (Broadcast corresponds to closing a channel, and Signal corresponds to +sending on a channel). + +For more on replacements for sync.Cond, see [Roberto Clapis's series on +advanced concurrency patterns](https://blogtitle.github.io/categories/concurrency/), as well as [Bryan Mills's talk on concurrency +patterns](https://drive.google.com/file/d/1nPdvhB0PutEJzdCq5ms6UI58dp50fcAN/view). + +#### func [NewCond](https://cs.opensource.google/go/go/+/go1.19:src/sync/cond.go;l=47) [¶](#NewCond "Go to NewCond") + +```None +func NewCond(l Locker) *Cond +``` + +NewCond returns a new Cond with Locker l. + +#### func (\*Cond) [Broadcast](https://cs.opensource.google/go/go/+/go1.19:src/sync/cond.go;l=90) [¶](#Cond.Broadcast "Go to Cond.Broadcast") + +```None +func (c *Cond) Broadcast() +``` + +Broadcast wakes all goroutines waiting on c. + +It is allowed but not required for the caller to hold c.L +during the call. + +#### func (\*Cond) [Signal](https://cs.opensource.google/go/go/+/go1.19:src/sync/cond.go;l=81) [¶](#Cond.Signal "Go to Cond.Signal") + +```None +func (c *Cond) Signal() +``` + +Signal wakes one goroutine waiting on c, if there is any. + +It is allowed but not required for the caller to hold c.L +during the call. + +Signal() does not affect goroutine scheduling priority; if other goroutines +are attempting to lock c.L, they may be awoken before a "waiting" goroutine. + +#### func (\*Cond) [Wait](https://cs.opensource.google/go/go/+/go1.19:src/sync/cond.go;l=66) [¶](#Cond.Wait "Go to Cond.Wait") + +```None +func (c *Cond) Wait() +``` + +Wait atomically unlocks c.L and suspends execution +of the calling goroutine. After later resuming execution, +Wait locks c.L before returning. Unlike in other systems, +Wait cannot return unless awoken by Broadcast or Signal. + +Because c.L is not locked when Wait first resumes, the caller +typically cannot assume that the condition is true when +Wait returns. Instead, the caller should Wait in a loop: + +```None +c.L.Lock() +for !condition() { + c.Wait() +} +... make use of condition ... +c.L.Unlock() +``` + +#### type [Locker](https://cs.opensource.google/go/go/+/go1.19:src/sync/mutex.go;l=40) [¶](#Locker "Go to Locker") + +```None +type Locker interface { + Lock() + Unlock() +} +``` + +A Locker represents an object that can be locked and unlocked. + +#### type [Map](https://cs.opensource.google/go/go/+/go1.19:src/sync/map.go;l=34) [¶](#Map "Go to Map") added in go1.9 + +```None +type Map struct { + // contains filtered or unexported fields +} +``` + +Map is like a Go map[interface{}]interface{} but is safe for concurrent use +by multiple goroutines without additional locking or coordination. +Loads, stores, and deletes run in amortized constant time. + +The Map type is specialized. Most code should use a plain Go map instead, +with separate locking or coordination, for better type safety and to make it +easier to maintain other invariants along with the map content. + +The Map type is optimized for two common use cases: (1) when the entry for a given +key is only ever written once but read many times, as in caches that only grow, +or (2) when multiple goroutines read, write, and overwrite entries for disjoint +sets of keys. In these two cases, use of a Map may significantly reduce lock +contention compared to a Go map paired with a separate Mutex or RWMutex. + +The zero Map is empty and ready for use. A Map must not be copied after first use. + +In the terminology of the Go memory model, Map arranges that a write operation +“synchronizes before” any read operation that observes the effect of the write, where +read and write operations are defined as follows. +Load, LoadAndDelete, LoadOrStore are read operations; +Delete, LoadAndDelete, and Store are write operations; +and LoadOrStore is a write operation when it returns loaded set to false. + +#### func (\*Map) [Delete](https://cs.opensource.google/go/go/+/go1.19:src/sync/map.go;l=300) [¶](#Map.Delete "Go to Map.Delete") added in go1.9 + +```None +func (m *Map) Delete(key any) +``` + +Delete deletes the value for a key. + +#### func (\*Map) [Load](https://cs.opensource.google/go/go/+/go1.19:src/sync/map.go;l=110) [¶](#Map.Load "Go to Map.Load") added in go1.9 + +```None +func (m *Map) Load(key any) (value any, ok bool) +``` + +Load returns the value stored in the map for a key, or nil if no +value is present. +The ok result indicates whether value was found in the map. + +#### func (\*Map) [LoadAndDelete](https://cs.opensource.google/go/go/+/go1.19:src/sync/map.go;l=276) [¶](#Map.LoadAndDelete "Go to Map.LoadAndDelete") added in go1.15 + +```None +func (m *Map) LoadAndDelete(key any) (value any, loaded bool) +``` + +LoadAndDelete deletes the value for a key, returning the previous value if any. +The loaded result reports whether the key was present. + +#### func (\*Map) [LoadOrStore](https://cs.opensource.google/go/go/+/go1.19:src/sync/map.go;l=207) [¶](#Map.LoadOrStore "Go to Map.LoadOrStore") added in go1.9 + +```None +func (m *Map) LoadOrStore(key, value any) (actual any, loaded bool) +``` + +LoadOrStore returns the existing value for the key if present. +Otherwise, it stores and returns the given value. +The loaded result is true if the value was loaded, false if stored. + +#### func (\*Map) [Range](https://cs.opensource.google/go/go/+/go1.19:src/sync/map.go;l=327) [¶](#Map.Range "Go to Map.Range") added in go1.9 + +```None +func (m *Map) Range(f func(key, value any) bool) +``` + +Range calls f sequentially for each key and value present in the map. +If f returns false, range stops the iteration. + +Range does not necessarily correspond to any consistent snapshot of the Map's +contents: no key will be visited more than once, but if the value for any key +is stored or deleted concurrently (including by f), Range may reflect any +mapping for that key from any point during the Range call. Range does not +block other methods on the receiver; even f itself may call any method on m. + +Range may be O(N) with the number of elements in the map even if f returns +false after a constant number of calls. + +#### func (\*Map) [Store](https://cs.opensource.google/go/go/+/go1.19:src/sync/map.go;l=144) [¶](#Map.Store "Go to Map.Store") added in go1.9 + +```None +func (m *Map) Store(key, value any) +``` + +Store sets the value for a key. + +#### type [Mutex](https://cs.opensource.google/go/go/+/go1.19:src/sync/mutex.go;l=34) [¶](#Mutex "Go to Mutex") + +```None +type Mutex struct { + // contains filtered or unexported fields +} +``` + +A Mutex is a mutual exclusion lock. +The zero value for a Mutex is an unlocked mutex. + +A Mutex must not be copied after first use. + +In the terminology of the Go memory model, +the n'th call to Unlock “synchronizes before” the m'th call to Lock +for any n < m. +A successful call to TryLock is equivalent to a call to Lock. +A failed call to TryLock does not establish any “synchronizes before” +relation at all. + +#### func (\*Mutex) [Lock](https://cs.opensource.google/go/go/+/go1.19:src/sync/mutex.go;l=81) [¶](#Mutex.Lock "Go to Mutex.Lock") + +```None +func (m *Mutex) Lock() +``` + +Lock locks m. +If the lock is already in use, the calling goroutine +blocks until the mutex is available. + +#### func (\*Mutex) [TryLock](https://cs.opensource.google/go/go/+/go1.19:src/sync/mutex.go;l=98) [¶](#Mutex.TryLock "Go to Mutex.TryLock") added in go1.18 + +```None +func (m *Mutex) TryLock() bool +``` + +TryLock tries to lock m and reports whether it succeeded. + +Note that while correct uses of TryLock do exist, they are rare, +and use of TryLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*Mutex) [Unlock](https://cs.opensource.google/go/go/+/go1.19:src/sync/mutex.go;l=212) [¶](#Mutex.Unlock "Go to Mutex.Unlock") + +```None +func (m *Mutex) Unlock() +``` + +Unlock unlocks m. +It is a run-time error if m is not locked on entry to Unlock. + +A locked Mutex is not associated with a particular goroutine. +It is allowed for one goroutine to lock a Mutex and then +arrange for another goroutine to unlock it. + +#### type [Once](https://cs.opensource.google/go/go/+/go1.19:src/sync/once.go;l=18) [¶](#Once "Go to Once") + +```None +type Once struct { + // contains filtered or unexported fields +} +``` + +Once is an object that will perform exactly one action. + +A Once must not be copied after first use. + +In the terminology of the Go memory model, +the return from f “synchronizes before” +the return from any call of once.Do(f). + +Example [¶](#example-Once "Go to Example") + +```None +package main + +import ( + "fmt" + "sync" +) + +func main() { + var once sync.Once + onceBody := func() { + fmt.Println("Only once") + } + done := make(chan bool) + for i := 0; i < 10; i++ { + go func() { + once.Do(onceBody) + done <- true + }() + } + for i := 0; i < 10; i++ { + <-done + } +} +``` + +```None +Output: + +Only once +``` + +Share +Format +Run + +#### func (\*Once) [Do](https://cs.opensource.google/go/go/+/go1.19:src/sync/once.go;l=48) [¶](#Once.Do "Go to Once.Do") + +```None +func (o *Once) Do(f func()) +``` + +Do calls the function f if and only if Do is being called for the +first time for this instance of Once. In other words, given + +```None +var once Once +``` + +if once.Do(f) is called multiple times, only the first call will invoke f, +even if f has a different value in each invocation. A new instance of +Once is required for each function to execute. + +Do is intended for initialization that must be run exactly once. Since f +is niladic, it may be necessary to use a function literal to capture the +arguments to a function to be invoked by Do: + +```None +config.once.Do(func() { config.init(filename) }) +``` + +Because no call to Do returns until the one call to f returns, if f causes +Do to be called, it will deadlock. + +If f panics, Do considers it to have returned; future calls of Do return +without calling f. + +#### type [Pool](https://cs.opensource.google/go/go/+/go1.19:src/sync/pool.go;l=49) [¶](#Pool "Go to Pool") added in go1.3 + +```None +type Pool struct { + + // New optionally specifies a function to generate + // a value when Get would otherwise return nil. + // It may not be changed concurrently with calls to Get. + New func() any + // contains filtered or unexported fields +} +``` + +A Pool is a set of temporary objects that may be individually saved and +retrieved. + +Any item stored in the Pool may be removed automatically at any time without +notification. If the Pool holds the only reference when this happens, the +item might be deallocated. + +A Pool is safe for use by multiple goroutines simultaneously. + +Pool's purpose is to cache allocated but unused items for later reuse, +relieving pressure on the garbage collector. That is, it makes it easy to +build efficient, thread-safe free lists. However, it is not suitable for all +free lists. + +An appropriate use of a Pool is to manage a group of temporary items +silently shared among and potentially reused by concurrent independent +clients of a package. Pool provides a way to amortize allocation overhead +across many clients. + +An example of good use of a Pool is in the fmt package, which maintains a +dynamically-sized store of temporary output buffers. The store scales under +load (when many goroutines are actively printing) and shrinks when +quiescent. + +On the other hand, a free list maintained as part of a short-lived object is +not a suitable use for a Pool, since the overhead does not amortize well in +that scenario. It is more efficient to have such objects implement their own +free list. + +A Pool must not be copied after first use. + +In the terminology of the Go memory model, a call to Put(x) “synchronizes before” +a call to Get returning that same value x. +Similarly, a call to New returning x “synchronizes before” +a call to Get returning that same value x. + +Example [¶](#example-Pool "Go to Example") + +```None +package main + +import ( + "bytes" + "io" + "os" + "sync" + "time" +) + +var bufPool = sync.Pool{ + New: func() any { + // The Pool's New function should generally only return pointer + // types, since a pointer can be put into the return interface + // value without an allocation: + return new(bytes.Buffer) + }, +} + +// timeNow is a fake version of time.Now for tests. +func timeNow() time.Time { + return time.Unix(1136214245, 0) +} + +func Log(w io.Writer, key, val string) { + b := bufPool.Get().(*bytes.Buffer) + b.Reset() + // Replace this with time.Now() in a real logger. + b.WriteString(timeNow().UTC().Format(time.RFC3339)) + b.WriteByte(' ') + b.WriteString(key) + b.WriteByte('=') + b.WriteString(val) + w.Write(b.Bytes()) + bufPool.Put(b) +} + +func main() { + Log(os.Stdout, "path", "/search?q=flowers") +} +``` + +```None +Output: + +2006-01-02T15:04:05Z path=/search?q=flowers +``` + +Share +Format +Run + +#### func (\*Pool) [Get](https://cs.opensource.google/go/go/+/go1.19:src/sync/pool.go;l=127) [¶](#Pool.Get "Go to Pool.Get") added in go1.3 + +```None +func (p *Pool) Get() any +``` + +Get selects an arbitrary item from the Pool, removes it from the +Pool, and returns it to the caller. +Get may choose to ignore the pool and treat it as empty. +Callers should not assume any relation between values passed to Put and +the values returned by Get. + +If Get would otherwise return nil and p.New is non-nil, Get returns +the result of calling p.New. + +#### func (\*Pool) [Put](https://cs.opensource.google/go/go/+/go1.19:src/sync/pool.go;l=95) [¶](#Pool.Put "Go to Pool.Put") added in go1.3 + +```None +func (p *Pool) Put(x any) +``` + +Put adds x to the pool. + +#### type [RWMutex](https://cs.opensource.google/go/go/+/go1.19:src/sync/rwmutex.go;l=36) [¶](#RWMutex "Go to RWMutex") + +```None +type RWMutex struct { + // contains filtered or unexported fields +} +``` + +A RWMutex is a reader/writer mutual exclusion lock. +The lock can be held by an arbitrary number of readers or a single writer. +The zero value for a RWMutex is an unlocked mutex. + +A RWMutex must not be copied after first use. + +If a goroutine holds a RWMutex for reading and another goroutine might +call Lock, no goroutine should expect to be able to acquire a read lock +until the initial read lock is released. In particular, this prohibits +recursive read locking. This is to ensure that the lock eventually becomes +available; a blocked Lock call excludes new readers from acquiring the +lock. + +In the terminology of the Go memory model, +the n'th call to Unlock “synchronizes before” the m'th call to Lock +for any n < m, just as for Mutex. +For any call to RLock, there exists an n such that +the n'th call to Unlock “synchronizes before” that call to RLock, +and the corresponding call to RUnlock “synchronizes before” +the n+1'th call to Lock. + +#### func (\*RWMutex) [Lock](https://cs.opensource.google/go/go/+/go1.19:src/sync/rwmutex.go;l=141) [¶](#RWMutex.Lock "Go to RWMutex.Lock") + +```None +func (rw *RWMutex) Lock() +``` + +Lock locks rw for writing. +If the lock is already locked for reading or writing, +Lock blocks until the lock is available. + +#### func (\*RWMutex) [RLock](https://cs.opensource.google/go/go/+/go1.19:src/sync/rwmutex.go;l=64) [¶](#RWMutex.RLock "Go to RWMutex.RLock") + +```None +func (rw *RWMutex) RLock() +``` + +RLock locks rw for reading. + +It should not be used for recursive read locking; a blocked Lock +call excludes new readers from acquiring the lock. See the +documentation on the RWMutex type. + +#### func (\*RWMutex) [RLocker](https://cs.opensource.google/go/go/+/go1.19:src/sync/rwmutex.go;l=224) [¶](#RWMutex.RLocker "Go to RWMutex.RLocker") + +```None +func (rw *RWMutex) RLocker() Locker +``` + +RLocker returns a Locker interface that implements +the Lock and Unlock methods by calling rw.RLock and rw.RUnlock. + +#### func (\*RWMutex) [RUnlock](https://cs.opensource.google/go/go/+/go1.19:src/sync/rwmutex.go;l=111) [¶](#RWMutex.RUnlock "Go to RWMutex.RUnlock") + +```None +func (rw *RWMutex) RUnlock() +``` + +RUnlock undoes a single RLock call; +it does not affect other simultaneous readers. +It is a run-time error if rw is not locked for reading +on entry to RUnlock. + +#### func (\*RWMutex) [TryLock](https://cs.opensource.google/go/go/+/go1.19:src/sync/rwmutex.go;l=166) [¶](#RWMutex.TryLock "Go to RWMutex.TryLock") added in go1.18 + +```None +func (rw *RWMutex) TryLock() bool +``` + +TryLock tries to lock rw for writing and reports whether it succeeded. + +Note that while correct uses of TryLock do exist, they are rare, +and use of TryLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*RWMutex) [TryRLock](https://cs.opensource.google/go/go/+/go1.19:src/sync/rwmutex.go;l=84) [¶](#RWMutex.TryRLock "Go to RWMutex.TryRLock") added in go1.18 + +```None +func (rw *RWMutex) TryRLock() bool +``` + +TryRLock tries to lock rw for reading and reports whether it succeeded. + +Note that while correct uses of TryRLock do exist, they are rare, +and use of TryRLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*RWMutex) [Unlock](https://cs.opensource.google/go/go/+/go1.19:src/sync/rwmutex.go;l=198) [¶](#RWMutex.Unlock "Go to RWMutex.Unlock") + +```None +func (rw *RWMutex) Unlock() +``` + +Unlock unlocks rw for writing. It is a run-time error if rw is +not locked for writing on entry to Unlock. + +As with Mutexes, a locked RWMutex is not associated with a particular +goroutine. One goroutine may RLock (Lock) a RWMutex and then +arrange for another goroutine to RUnlock (Unlock) it. + +#### type [WaitGroup](https://cs.opensource.google/go/go/+/go1.19:src/sync/waitgroup.go;l=23) [¶](#WaitGroup "Go to WaitGroup") + +```None +type WaitGroup struct { + // contains filtered or unexported fields +} +``` + +A WaitGroup waits for a collection of goroutines to finish. +The main goroutine calls Add to set the number of +goroutines to wait for. Then each of the goroutines +runs and calls Done when finished. At the same time, +Wait can be used to block until all goroutines have finished. + +A WaitGroup must not be copied after first use. + +In the terminology of the Go memory model, a call to Done +“synchronizes before” the return of any Wait call that it unblocks. + +Example [¶](#example-WaitGroup "Go to Example") + +This example fetches several URLs concurrently, +using a WaitGroup to block until all the fetches are complete. + +```None +package main + +import ( + "sync" +) + +type httpPkg struct{} + +func (httpPkg) Get(url string) {} + +var http httpPkg + +func main() { + var wg sync.WaitGroup + var urls = []string{ + "http://www.golang.org/", + "http://www.google.com/", + "http://www.example.com/", + } + for _, url := range urls { + // Increment the WaitGroup counter. + wg.Add(1) + // Launch a goroutine to fetch the URL. + go func(url string) { + // Decrement the counter when the goroutine completes. + defer wg.Done() + // Fetch the URL. + http.Get(url) + }(url) + } + // Wait for all HTTP fetches to complete. + wg.Wait() +} +``` + +Share +Format +Run + +#### func (\*WaitGroup) [Add](https://cs.opensource.google/go/go/+/go1.19:src/sync/waitgroup.go;l=62) [¶](#WaitGroup.Add "Go to WaitGroup.Add") + +```None +func (wg *WaitGroup) Add(delta int) +``` + +Add adds delta, which may be negative, to the WaitGroup counter. +If the counter becomes zero, all goroutines blocked on Wait are released. +If the counter goes negative, Add panics. + +Note that calls with a positive delta that occur when the counter is zero +must happen before a Wait. Calls with a negative delta, or calls with a +positive delta that start when the counter is greater than zero, may happen +at any time. +Typically this means the calls to Add should execute before the statement +creating the goroutine or other event to be waited for. +If a WaitGroup is reused to wait for several independent sets of events, +new Add calls must happen after all previous Wait calls have returned. +See the WaitGroup example. + +#### func (\*WaitGroup) [Done](https://cs.opensource.google/go/go/+/go1.19:src/sync/waitgroup.go;l=107) [¶](#WaitGroup.Done "Go to WaitGroup.Done") + +```None +func (wg *WaitGroup) Done() +``` + +Done decrements the WaitGroup counter by one. + +#### func (\*WaitGroup) [Wait](https://cs.opensource.google/go/go/+/go1.19:src/sync/waitgroup.go;l=112) [¶](#WaitGroup.Wait "Go to WaitGroup.Wait") + +```None +func (wg *WaitGroup) Wait() +``` + +Wait blocks until the WaitGroup counter is zero. diff --git a/corpus/docs/golang/sync/sync_go120.md b/corpus/docs/golang/sync/sync_go120.md new file mode 100644 index 0000000000000000000000000000000000000000..e69c7de66bf26a40f88a5a729ffeb94e2e7dd0d7 --- /dev/null +++ b/corpus/docs/golang/sync/sync_go120.md @@ -0,0 +1,778 @@ +# Golang - sync + +Source: https://pkg.go.dev/sync@go1.20 +Version: go1.20 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package sync provides basic synchronization primitives such as mutual +exclusion locks. Other than the Once and WaitGroup types, most are intended +for use by low-level library routines. Higher-level synchronization is +better done via channels and communication. + +Values containing the types defined in this package should not be copied. + +### Index [¶](#pkg-index "Go to Index") + +* [type Cond](#Cond) +* + [func NewCond(l Locker) \*Cond](#NewCond) +* + [func (c \*Cond) Broadcast()](#Cond.Broadcast) + + [func (c \*Cond) Signal()](#Cond.Signal) + + [func (c \*Cond) Wait()](#Cond.Wait) +* [type Locker](#Locker) +* [type Map](#Map) +* + [func (m \*Map) CompareAndDelete(key, old any) (deleted bool)](#Map.CompareAndDelete) + + [func (m \*Map) CompareAndSwap(key, old, new any) bool](#Map.CompareAndSwap) + + [func (m \*Map) Delete(key any)](#Map.Delete) + + [func (m \*Map) Load(key any) (value any, ok bool)](#Map.Load) + + [func (m \*Map) LoadAndDelete(key any) (value any, loaded bool)](#Map.LoadAndDelete) + + [func (m \*Map) LoadOrStore(key, value any) (actual any, loaded bool)](#Map.LoadOrStore) + + [func (m \*Map) Range(f func(key, value any) bool)](#Map.Range) + + [func (m \*Map) Store(key, value any)](#Map.Store) + + [func (m \*Map) Swap(key, value any) (previous any, loaded bool)](#Map.Swap) +* [type Mutex](#Mutex) +* + [func (m \*Mutex) Lock()](#Mutex.Lock) + + [func (m \*Mutex) TryLock() bool](#Mutex.TryLock) + + [func (m \*Mutex) Unlock()](#Mutex.Unlock) +* [type Once](#Once) +* + [func (o \*Once) Do(f func())](#Once.Do) +* [type Pool](#Pool) +* + [func (p \*Pool) Get() any](#Pool.Get) + + [func (p \*Pool) Put(x any)](#Pool.Put) +* [type RWMutex](#RWMutex) +* + [func (rw \*RWMutex) Lock()](#RWMutex.Lock) + + [func (rw \*RWMutex) RLock()](#RWMutex.RLock) + + [func (rw \*RWMutex) RLocker() Locker](#RWMutex.RLocker) + + [func (rw \*RWMutex) RUnlock()](#RWMutex.RUnlock) + + [func (rw \*RWMutex) TryLock() bool](#RWMutex.TryLock) + + [func (rw \*RWMutex) TryRLock() bool](#RWMutex.TryRLock) + + [func (rw \*RWMutex) Unlock()](#RWMutex.Unlock) +* [type WaitGroup](#WaitGroup) +* + [func (wg \*WaitGroup) Add(delta int)](#WaitGroup.Add) + + [func (wg \*WaitGroup) Done()](#WaitGroup.Done) + + [func (wg \*WaitGroup) Wait()](#WaitGroup.Wait) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Once](#example-Once) +* [Pool](#example-Pool) +* [WaitGroup](#example-WaitGroup) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +This section is empty. + +### Types [¶](#pkg-types "Go to Types") + +#### type [Cond](https://cs.opensource.google/go/go/+/go1.20:src/sync/cond.go;l=36) [¶](#Cond "Go to Cond") + +```None +type Cond struct { + + // L is held while observing or changing the condition + L Locker + // contains filtered or unexported fields +} +``` + +Cond implements a condition variable, a rendezvous point +for goroutines waiting for or announcing the occurrence +of an event. + +Each Cond has an associated Locker L (often a \*Mutex or \*RWMutex), +which must be held when changing the condition and +when calling the Wait method. + +A Cond must not be copied after first use. + +In the terminology of the Go memory model, Cond arranges that +a call to Broadcast or Signal “synchronizes before” any Wait call +that it unblocks. + +For many simple use cases, users will be better off using channels than a +Cond (Broadcast corresponds to closing a channel, and Signal corresponds to +sending on a channel). + +For more on replacements for sync.Cond, see [Roberto Clapis's series on +advanced concurrency patterns](https://blogtitle.github.io/categories/concurrency/), as well as [Bryan Mills's talk on concurrency +patterns](https://drive.google.com/file/d/1nPdvhB0PutEJzdCq5ms6UI58dp50fcAN/view). + +#### func [NewCond](https://cs.opensource.google/go/go/+/go1.20:src/sync/cond.go;l=47) [¶](#NewCond "Go to NewCond") + +```None +func NewCond(l Locker) *Cond +``` + +NewCond returns a new Cond with Locker l. + +#### func (\*Cond) [Broadcast](https://cs.opensource.google/go/go/+/go1.20:src/sync/cond.go;l=90) [¶](#Cond.Broadcast "Go to Cond.Broadcast") + +```None +func (c *Cond) Broadcast() +``` + +Broadcast wakes all goroutines waiting on c. + +It is allowed but not required for the caller to hold c.L +during the call. + +#### func (\*Cond) [Signal](https://cs.opensource.google/go/go/+/go1.20:src/sync/cond.go;l=81) [¶](#Cond.Signal "Go to Cond.Signal") + +```None +func (c *Cond) Signal() +``` + +Signal wakes one goroutine waiting on c, if there is any. + +It is allowed but not required for the caller to hold c.L +during the call. + +Signal() does not affect goroutine scheduling priority; if other goroutines +are attempting to lock c.L, they may be awoken before a "waiting" goroutine. + +#### func (\*Cond) [Wait](https://cs.opensource.google/go/go/+/go1.20:src/sync/cond.go;l=66) [¶](#Cond.Wait "Go to Cond.Wait") + +```None +func (c *Cond) Wait() +``` + +Wait atomically unlocks c.L and suspends execution +of the calling goroutine. After later resuming execution, +Wait locks c.L before returning. Unlike in other systems, +Wait cannot return unless awoken by Broadcast or Signal. + +Because c.L is not locked while Wait is waiting, the caller +typically cannot assume that the condition is true when +Wait returns. Instead, the caller should Wait in a loop: + +```None +c.L.Lock() +for !condition() { + c.Wait() +} +... make use of condition ... +c.L.Unlock() +``` + +#### type [Locker](https://cs.opensource.google/go/go/+/go1.20:src/sync/mutex.go;l=40) [¶](#Locker "Go to Locker") + +```None +type Locker interface { + Lock() + Unlock() +} +``` + +A Locker represents an object that can be locked and unlocked. + +#### type [Map](https://cs.opensource.google/go/go/+/go1.20:src/sync/map.go;l=35) [¶](#Map "Go to Map") added in go1.9 + +```None +type Map struct { + // contains filtered or unexported fields +} +``` + +Map is like a Go map[interface{}]interface{} but is safe for concurrent use +by multiple goroutines without additional locking or coordination. +Loads, stores, and deletes run in amortized constant time. + +The Map type is specialized. Most code should use a plain Go map instead, +with separate locking or coordination, for better type safety and to make it +easier to maintain other invariants along with the map content. + +The Map type is optimized for two common use cases: (1) when the entry for a given +key is only ever written once but read many times, as in caches that only grow, +or (2) when multiple goroutines read, write, and overwrite entries for disjoint +sets of keys. In these two cases, use of a Map may significantly reduce lock +contention compared to a Go map paired with a separate Mutex or RWMutex. + +The zero Map is empty and ready for use. A Map must not be copied after first use. + +In the terminology of the Go memory model, Map arranges that a write operation +“synchronizes before” any read operation that observes the effect of the write, where +read and write operations are defined as follows. +Load, LoadAndDelete, LoadOrStore, Swap, CompareAndSwap, and CompareAndDelete +are read operations; Delete, LoadAndDelete, Store, and Swap are write operations; +LoadOrStore is a write operation when it returns loaded set to false; +CompareAndSwap is a write operation when it returns swapped set to true; +and CompareAndDelete is a write operation when it returns deleted set to true. + +#### func (\*Map) [CompareAndDelete](https://cs.opensource.google/go/go/+/go1.20:src/sync/map.go;l=406) [¶](#Map.CompareAndDelete "Go to Map.CompareAndDelete") added in go1.20 + +```None +func (m *Map) CompareAndDelete(key, old any) (deleted bool) +``` + +CompareAndDelete deletes the entry for key if its value is equal to old. +The old value must be of a comparable type. + +If there is no current value for key in the map, CompareAndDelete +returns false (even if the old value is the nil interface value). + +#### func (\*Map) [CompareAndSwap](https://cs.opensource.google/go/go/+/go1.20:src/sync/map.go;l=374) [¶](#Map.CompareAndSwap "Go to Map.CompareAndSwap") added in go1.20 + +```None +func (m *Map) CompareAndSwap(key, old, new any) bool +``` + +CompareAndSwap swaps the old and new values for key +if the value stored in the map is equal to old. +The old value must be of a comparable type. + +#### func (\*Map) [Delete](https://cs.opensource.google/go/go/+/go1.20:src/sync/map.go;l=296) [¶](#Map.Delete "Go to Map.Delete") added in go1.9 + +```None +func (m *Map) Delete(key any) +``` + +Delete deletes the value for a key. + +#### func (\*Map) [Load](https://cs.opensource.google/go/go/+/go1.20:src/sync/map.go;l=120) [¶](#Map.Load "Go to Map.Load") added in go1.9 + +```None +func (m *Map) Load(key any) (value any, ok bool) +``` + +Load returns the value stored in the map for a key, or nil if no +value is present. +The ok result indicates whether value was found in the map. + +#### func (\*Map) [LoadAndDelete](https://cs.opensource.google/go/go/+/go1.20:src/sync/map.go;l=272) [¶](#Map.LoadAndDelete "Go to Map.LoadAndDelete") added in go1.15 + +```None +func (m *Map) LoadAndDelete(key any) (value any, loaded bool) +``` + +LoadAndDelete deletes the value for a key, returning the previous value if any. +The loaded result reports whether the key was present. + +#### func (\*Map) [LoadOrStore](https://cs.opensource.google/go/go/+/go1.20:src/sync/map.go;l=203) [¶](#Map.LoadOrStore "Go to Map.LoadOrStore") added in go1.9 + +```None +func (m *Map) LoadOrStore(key, value any) (actual any, loaded bool) +``` + +LoadOrStore returns the existing value for the key if present. +Otherwise, it stores and returns the given value. +The loaded result is true if the value was loaded, false if stored. + +#### func (\*Map) [Range](https://cs.opensource.google/go/go/+/go1.20:src/sync/map.go;l=449) [¶](#Map.Range "Go to Map.Range") added in go1.9 + +```None +func (m *Map) Range(f func(key, value any) bool) +``` + +Range calls f sequentially for each key and value present in the map. +If f returns false, range stops the iteration. + +Range does not necessarily correspond to any consistent snapshot of the Map's +contents: no key will be visited more than once, but if the value for any key +is stored or deleted concurrently (including by f), Range may reflect any +mapping for that key from any point during the Range call. Range does not +block other methods on the receiver; even f itself may call any method on m. + +Range may be O(N) with the number of elements in the map even if f returns +false after a constant number of calls. + +#### func (\*Map) [Store](https://cs.opensource.google/go/go/+/go1.20:src/sync/map.go;l=154) [¶](#Map.Store "Go to Map.Store") added in go1.9 + +```None +func (m *Map) Store(key, value any) +``` + +Store sets the value for a key. + +#### func (\*Map) [Swap](https://cs.opensource.google/go/go/+/go1.20:src/sync/map.go;l=330) [¶](#Map.Swap "Go to Map.Swap") added in go1.20 + +```None +func (m *Map) Swap(key, value any) (previous any, loaded bool) +``` + +Swap swaps the value for a key and returns the previous value if any. +The loaded result reports whether the key was present. + +#### type [Mutex](https://cs.opensource.google/go/go/+/go1.20:src/sync/mutex.go;l=34) [¶](#Mutex "Go to Mutex") + +```None +type Mutex struct { + // contains filtered or unexported fields +} +``` + +A Mutex is a mutual exclusion lock. +The zero value for a Mutex is an unlocked mutex. + +A Mutex must not be copied after first use. + +In the terminology of the Go memory model, +the n'th call to Unlock “synchronizes before” the m'th call to Lock +for any n < m. +A successful call to TryLock is equivalent to a call to Lock. +A failed call to TryLock does not establish any “synchronizes before” +relation at all. + +#### func (\*Mutex) [Lock](https://cs.opensource.google/go/go/+/go1.20:src/sync/mutex.go;l=81) [¶](#Mutex.Lock "Go to Mutex.Lock") + +```None +func (m *Mutex) Lock() +``` + +Lock locks m. +If the lock is already in use, the calling goroutine +blocks until the mutex is available. + +#### func (\*Mutex) [TryLock](https://cs.opensource.google/go/go/+/go1.20:src/sync/mutex.go;l=98) [¶](#Mutex.TryLock "Go to Mutex.TryLock") added in go1.18 + +```None +func (m *Mutex) TryLock() bool +``` + +TryLock tries to lock m and reports whether it succeeded. + +Note that while correct uses of TryLock do exist, they are rare, +and use of TryLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*Mutex) [Unlock](https://cs.opensource.google/go/go/+/go1.20:src/sync/mutex.go;l=212) [¶](#Mutex.Unlock "Go to Mutex.Unlock") + +```None +func (m *Mutex) Unlock() +``` + +Unlock unlocks m. +It is a run-time error if m is not locked on entry to Unlock. + +A locked Mutex is not associated with a particular goroutine. +It is allowed for one goroutine to lock a Mutex and then +arrange for another goroutine to unlock it. + +#### type [Once](https://cs.opensource.google/go/go/+/go1.20:src/sync/once.go;l=18) [¶](#Once "Go to Once") + +```None +type Once struct { + // contains filtered or unexported fields +} +``` + +Once is an object that will perform exactly one action. + +A Once must not be copied after first use. + +In the terminology of the Go memory model, +the return from f “synchronizes before” +the return from any call of once.Do(f). + +Example [¶](#example-Once "Go to Example") + +```None +package main + +import ( + "fmt" + "sync" +) + +func main() { + var once sync.Once + onceBody := func() { + fmt.Println("Only once") + } + done := make(chan bool) + for i := 0; i < 10; i++ { + go func() { + once.Do(onceBody) + done <- true + }() + } + for i := 0; i < 10; i++ { + <-done + } +} +``` + +```None +Output: + +Only once +``` + +Share +Format +Run + +#### func (\*Once) [Do](https://cs.opensource.google/go/go/+/go1.20:src/sync/once.go;l=48) [¶](#Once.Do "Go to Once.Do") + +```None +func (o *Once) Do(f func()) +``` + +Do calls the function f if and only if Do is being called for the +first time for this instance of Once. In other words, given + +```None +var once Once +``` + +if once.Do(f) is called multiple times, only the first call will invoke f, +even if f has a different value in each invocation. A new instance of +Once is required for each function to execute. + +Do is intended for initialization that must be run exactly once. Since f +is niladic, it may be necessary to use a function literal to capture the +arguments to a function to be invoked by Do: + +```None +config.once.Do(func() { config.init(filename) }) +``` + +Because no call to Do returns until the one call to f returns, if f causes +Do to be called, it will deadlock. + +If f panics, Do considers it to have returned; future calls of Do return +without calling f. + +#### type [Pool](https://cs.opensource.google/go/go/+/go1.20:src/sync/pool.go;l=49) [¶](#Pool "Go to Pool") added in go1.3 + +```None +type Pool struct { + + // New optionally specifies a function to generate + // a value when Get would otherwise return nil. + // It may not be changed concurrently with calls to Get. + New func() any + // contains filtered or unexported fields +} +``` + +A Pool is a set of temporary objects that may be individually saved and +retrieved. + +Any item stored in the Pool may be removed automatically at any time without +notification. If the Pool holds the only reference when this happens, the +item might be deallocated. + +A Pool is safe for use by multiple goroutines simultaneously. + +Pool's purpose is to cache allocated but unused items for later reuse, +relieving pressure on the garbage collector. That is, it makes it easy to +build efficient, thread-safe free lists. However, it is not suitable for all +free lists. + +An appropriate use of a Pool is to manage a group of temporary items +silently shared among and potentially reused by concurrent independent +clients of a package. Pool provides a way to amortize allocation overhead +across many clients. + +An example of good use of a Pool is in the fmt package, which maintains a +dynamically-sized store of temporary output buffers. The store scales under +load (when many goroutines are actively printing) and shrinks when +quiescent. + +On the other hand, a free list maintained as part of a short-lived object is +not a suitable use for a Pool, since the overhead does not amortize well in +that scenario. It is more efficient to have such objects implement their own +free list. + +A Pool must not be copied after first use. + +In the terminology of the Go memory model, a call to Put(x) “synchronizes before” +a call to Get returning that same value x. +Similarly, a call to New returning x “synchronizes before” +a call to Get returning that same value x. + +Example [¶](#example-Pool "Go to Example") + +```None +package main + +import ( + "bytes" + "io" + "os" + "sync" + "time" +) + +var bufPool = sync.Pool{ + New: func() any { + // The Pool's New function should generally only return pointer + // types, since a pointer can be put into the return interface + // value without an allocation: + return new(bytes.Buffer) + }, +} + +// timeNow is a fake version of time.Now for tests. +func timeNow() time.Time { + return time.Unix(1136214245, 0) +} + +func Log(w io.Writer, key, val string) { + b := bufPool.Get().(*bytes.Buffer) + b.Reset() + // Replace this with time.Now() in a real logger. + b.WriteString(timeNow().UTC().Format(time.RFC3339)) + b.WriteByte(' ') + b.WriteString(key) + b.WriteByte('=') + b.WriteString(val) + w.Write(b.Bytes()) + bufPool.Put(b) +} + +func main() { + Log(os.Stdout, "path", "/search?q=flowers") +} +``` + +```None +Output: + +2006-01-02T15:04:05Z path=/search?q=flowers +``` + +Share +Format +Run + +#### func (\*Pool) [Get](https://cs.opensource.google/go/go/+/go1.20:src/sync/pool.go;l=127) [¶](#Pool.Get "Go to Pool.Get") added in go1.3 + +```None +func (p *Pool) Get() any +``` + +Get selects an arbitrary item from the Pool, removes it from the +Pool, and returns it to the caller. +Get may choose to ignore the pool and treat it as empty. +Callers should not assume any relation between values passed to Put and +the values returned by Get. + +If Get would otherwise return nil and p.New is non-nil, Get returns +the result of calling p.New. + +#### func (\*Pool) [Put](https://cs.opensource.google/go/go/+/go1.20:src/sync/pool.go;l=95) [¶](#Pool.Put "Go to Pool.Put") added in go1.3 + +```None +func (p *Pool) Put(x any) +``` + +Put adds x to the pool. + +#### type [RWMutex](https://cs.opensource.google/go/go/+/go1.20:src/sync/rwmutex.go;l=36) [¶](#RWMutex "Go to RWMutex") + +```None +type RWMutex struct { + // contains filtered or unexported fields +} +``` + +A RWMutex is a reader/writer mutual exclusion lock. +The lock can be held by an arbitrary number of readers or a single writer. +The zero value for a RWMutex is an unlocked mutex. + +A RWMutex must not be copied after first use. + +If a goroutine holds a RWMutex for reading and another goroutine might +call Lock, no goroutine should expect to be able to acquire a read lock +until the initial read lock is released. In particular, this prohibits +recursive read locking. This is to ensure that the lock eventually becomes +available; a blocked Lock call excludes new readers from acquiring the +lock. + +In the terminology of the Go memory model, +the n'th call to Unlock “synchronizes before” the m'th call to Lock +for any n < m, just as for Mutex. +For any call to RLock, there exists an n such that +the n'th call to Unlock “synchronizes before” that call to RLock, +and the corresponding call to RUnlock “synchronizes before” +the n+1'th call to Lock. + +#### func (\*RWMutex) [Lock](https://cs.opensource.google/go/go/+/go1.20:src/sync/rwmutex.go;l=141) [¶](#RWMutex.Lock "Go to RWMutex.Lock") + +```None +func (rw *RWMutex) Lock() +``` + +Lock locks rw for writing. +If the lock is already locked for reading or writing, +Lock blocks until the lock is available. + +#### func (\*RWMutex) [RLock](https://cs.opensource.google/go/go/+/go1.20:src/sync/rwmutex.go;l=64) [¶](#RWMutex.RLock "Go to RWMutex.RLock") + +```None +func (rw *RWMutex) RLock() +``` + +RLock locks rw for reading. + +It should not be used for recursive read locking; a blocked Lock +call excludes new readers from acquiring the lock. See the +documentation on the RWMutex type. + +#### func (\*RWMutex) [RLocker](https://cs.opensource.google/go/go/+/go1.20:src/sync/rwmutex.go;l=224) [¶](#RWMutex.RLocker "Go to RWMutex.RLocker") + +```None +func (rw *RWMutex) RLocker() Locker +``` + +RLocker returns a Locker interface that implements +the Lock and Unlock methods by calling rw.RLock and rw.RUnlock. + +#### func (\*RWMutex) [RUnlock](https://cs.opensource.google/go/go/+/go1.20:src/sync/rwmutex.go;l=111) [¶](#RWMutex.RUnlock "Go to RWMutex.RUnlock") + +```None +func (rw *RWMutex) RUnlock() +``` + +RUnlock undoes a single RLock call; +it does not affect other simultaneous readers. +It is a run-time error if rw is not locked for reading +on entry to RUnlock. + +#### func (\*RWMutex) [TryLock](https://cs.opensource.google/go/go/+/go1.20:src/sync/rwmutex.go;l=166) [¶](#RWMutex.TryLock "Go to RWMutex.TryLock") added in go1.18 + +```None +func (rw *RWMutex) TryLock() bool +``` + +TryLock tries to lock rw for writing and reports whether it succeeded. + +Note that while correct uses of TryLock do exist, they are rare, +and use of TryLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*RWMutex) [TryRLock](https://cs.opensource.google/go/go/+/go1.20:src/sync/rwmutex.go;l=84) [¶](#RWMutex.TryRLock "Go to RWMutex.TryRLock") added in go1.18 + +```None +func (rw *RWMutex) TryRLock() bool +``` + +TryRLock tries to lock rw for reading and reports whether it succeeded. + +Note that while correct uses of TryRLock do exist, they are rare, +and use of TryRLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*RWMutex) [Unlock](https://cs.opensource.google/go/go/+/go1.20:src/sync/rwmutex.go;l=198) [¶](#RWMutex.Unlock "Go to RWMutex.Unlock") + +```None +func (rw *RWMutex) Unlock() +``` + +Unlock unlocks rw for writing. It is a run-time error if rw is +not locked for writing on entry to Unlock. + +As with Mutexes, a locked RWMutex is not associated with a particular +goroutine. One goroutine may RLock (Lock) a RWMutex and then +arrange for another goroutine to RUnlock (Unlock) it. + +#### type [WaitGroup](https://cs.opensource.google/go/go/+/go1.20:src/sync/waitgroup.go;l=23) [¶](#WaitGroup "Go to WaitGroup") + +```None +type WaitGroup struct { + // contains filtered or unexported fields +} +``` + +A WaitGroup waits for a collection of goroutines to finish. +The main goroutine calls Add to set the number of +goroutines to wait for. Then each of the goroutines +runs and calls Done when finished. At the same time, +Wait can be used to block until all goroutines have finished. + +A WaitGroup must not be copied after first use. + +In the terminology of the Go memory model, a call to Done +“synchronizes before” the return of any Wait call that it unblocks. + +Example [¶](#example-WaitGroup "Go to Example") + +This example fetches several URLs concurrently, +using a WaitGroup to block until all the fetches are complete. + +```None +package main + +import ( + "sync" +) + +type httpPkg struct{} + +func (httpPkg) Get(url string) {} + +var http httpPkg + +func main() { + var wg sync.WaitGroup + var urls = []string{ + "http://www.golang.org/", + "http://www.google.com/", + "http://www.example.com/", + } + for _, url := range urls { + // Increment the WaitGroup counter. + wg.Add(1) + // Launch a goroutine to fetch the URL. + go func(url string) { + // Decrement the counter when the goroutine completes. + defer wg.Done() + // Fetch the URL. + http.Get(url) + }(url) + } + // Wait for all HTTP fetches to complete. + wg.Wait() +} +``` + +Share +Format +Run + +#### func (\*WaitGroup) [Add](https://cs.opensource.google/go/go/+/go1.20:src/sync/waitgroup.go;l=43) [¶](#WaitGroup.Add "Go to WaitGroup.Add") + +```None +func (wg *WaitGroup) Add(delta int) +``` + +Add adds delta, which may be negative, to the WaitGroup counter. +If the counter becomes zero, all goroutines blocked on Wait are released. +If the counter goes negative, Add panics. + +Note that calls with a positive delta that occur when the counter is zero +must happen before a Wait. Calls with a negative delta, or calls with a +positive delta that start when the counter is greater than zero, may happen +at any time. +Typically this means the calls to Add should execute before the statement +creating the goroutine or other event to be waited for. +If a WaitGroup is reused to wait for several independent sets of events, +new Add calls must happen after all previous Wait calls have returned. +See the WaitGroup example. + +#### func (\*WaitGroup) [Done](https://cs.opensource.google/go/go/+/go1.20:src/sync/waitgroup.go;l=86) [¶](#WaitGroup.Done "Go to WaitGroup.Done") + +```None +func (wg *WaitGroup) Done() +``` + +Done decrements the WaitGroup counter by one. + +#### func (\*WaitGroup) [Wait](https://cs.opensource.google/go/go/+/go1.20:src/sync/waitgroup.go;l=91) [¶](#WaitGroup.Wait "Go to WaitGroup.Wait") + +```None +func (wg *WaitGroup) Wait() +``` + +Wait blocks until the WaitGroup counter is zero. diff --git a/corpus/docs/golang/sync/sync_go1210.md b/corpus/docs/golang/sync/sync_go1210.md new file mode 100644 index 0000000000000000000000000000000000000000..eb581e5d8573e6c6b158399fdedc0f80ccd6c43a --- /dev/null +++ b/corpus/docs/golang/sync/sync_go1210.md @@ -0,0 +1,812 @@ +# Golang - sync + +Source: https://pkg.go.dev/sync@go1.21.0 +Version: go1.21.0 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package sync provides basic synchronization primitives such as mutual +exclusion locks. Other than the Once and WaitGroup types, most are intended +for use by low-level library routines. Higher-level synchronization is +better done via channels and communication. + +Values containing the types defined in this package should not be copied. + +### Index [¶](#pkg-index "Go to Index") + +* [func OnceFunc(f func()) func()](#OnceFunc) +* [func OnceValue[T any](f func() T) func() T](#OnceValue) +* [func OnceValues[T1, T2 any](f func() (T1, T2)) func() (T1, T2)](#OnceValues) +* [type Cond](#Cond) +* + [func NewCond(l Locker) \*Cond](#NewCond) +* + [func (c \*Cond) Broadcast()](#Cond.Broadcast) + + [func (c \*Cond) Signal()](#Cond.Signal) + + [func (c \*Cond) Wait()](#Cond.Wait) +* [type Locker](#Locker) +* [type Map](#Map) +* + [func (m \*Map) CompareAndDelete(key, old any) (deleted bool)](#Map.CompareAndDelete) + + [func (m \*Map) CompareAndSwap(key, old, new any) bool](#Map.CompareAndSwap) + + [func (m \*Map) Delete(key any)](#Map.Delete) + + [func (m \*Map) Load(key any) (value any, ok bool)](#Map.Load) + + [func (m \*Map) LoadAndDelete(key any) (value any, loaded bool)](#Map.LoadAndDelete) + + [func (m \*Map) LoadOrStore(key, value any) (actual any, loaded bool)](#Map.LoadOrStore) + + [func (m \*Map) Range(f func(key, value any) bool)](#Map.Range) + + [func (m \*Map) Store(key, value any)](#Map.Store) + + [func (m \*Map) Swap(key, value any) (previous any, loaded bool)](#Map.Swap) +* [type Mutex](#Mutex) +* + [func (m \*Mutex) Lock()](#Mutex.Lock) + + [func (m \*Mutex) TryLock() bool](#Mutex.TryLock) + + [func (m \*Mutex) Unlock()](#Mutex.Unlock) +* [type Once](#Once) +* + [func (o \*Once) Do(f func())](#Once.Do) +* [type Pool](#Pool) +* + [func (p \*Pool) Get() any](#Pool.Get) + + [func (p \*Pool) Put(x any)](#Pool.Put) +* [type RWMutex](#RWMutex) +* + [func (rw \*RWMutex) Lock()](#RWMutex.Lock) + + [func (rw \*RWMutex) RLock()](#RWMutex.RLock) + + [func (rw \*RWMutex) RLocker() Locker](#RWMutex.RLocker) + + [func (rw \*RWMutex) RUnlock()](#RWMutex.RUnlock) + + [func (rw \*RWMutex) TryLock() bool](#RWMutex.TryLock) + + [func (rw \*RWMutex) TryRLock() bool](#RWMutex.TryRLock) + + [func (rw \*RWMutex) Unlock()](#RWMutex.Unlock) +* [type WaitGroup](#WaitGroup) +* + [func (wg \*WaitGroup) Add(delta int)](#WaitGroup.Add) + + [func (wg \*WaitGroup) Done()](#WaitGroup.Done) + + [func (wg \*WaitGroup) Wait()](#WaitGroup.Wait) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Once](#example-Once) +* [Pool](#example-Pool) +* [WaitGroup](#example-WaitGroup) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [OnceFunc](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/oncefunc.go;l=11) [¶](#OnceFunc "Go to OnceFunc") added in go1.21.0 + +```None +func OnceFunc(f func()) func() +``` + +OnceFunc returns a function that invokes f only once. The returned function +may be called concurrently. + +If f panics, the returned function will panic with the same value on every call. + +#### func [OnceValue](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/oncefunc.go;l=42) [¶](#OnceValue "Go to OnceValue") added in go1.21.0 + +```None +func OnceValue[T any](f func() T) func() T +``` + +OnceValue returns a function that invokes f only once and returns the value +returned by f. The returned function may be called concurrently. + +If f panics, the returned function will panic with the same value on every call. + +#### func [OnceValues](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/oncefunc.go;l=72) [¶](#OnceValues "Go to OnceValues") added in go1.21.0 + +```None +func OnceValues[T1, T2 any](f func() (T1, T2)) func() (T1, T2) +``` + +OnceValues returns a function that invokes f only once and returns the values +returned by f. The returned function may be called concurrently. + +If f panics, the returned function will panic with the same value on every call. + +### Types [¶](#pkg-types "Go to Types") + +#### type [Cond](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/cond.go;l=36) [¶](#Cond "Go to Cond") + +```None +type Cond struct { + + // L is held while observing or changing the condition + L Locker + // contains filtered or unexported fields +} +``` + +Cond implements a condition variable, a rendezvous point +for goroutines waiting for or announcing the occurrence +of an event. + +Each Cond has an associated Locker L (often a \*Mutex or \*RWMutex), +which must be held when changing the condition and +when calling the Wait method. + +A Cond must not be copied after first use. + +In the terminology of the Go memory model, Cond arranges that +a call to Broadcast or Signal “synchronizes before” any Wait call +that it unblocks. + +For many simple use cases, users will be better off using channels than a +Cond (Broadcast corresponds to closing a channel, and Signal corresponds to +sending on a channel). + +For more on replacements for sync.Cond, see [Roberto Clapis's series on +advanced concurrency patterns](https://blogtitle.github.io/categories/concurrency/), as well as [Bryan Mills's talk on concurrency +patterns](https://drive.google.com/file/d/1nPdvhB0PutEJzdCq5ms6UI58dp50fcAN/view). + +#### func [NewCond](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/cond.go;l=47) [¶](#NewCond "Go to NewCond") + +```None +func NewCond(l Locker) *Cond +``` + +NewCond returns a new Cond with Locker l. + +#### func (\*Cond) [Broadcast](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/cond.go;l=90) [¶](#Cond.Broadcast "Go to Cond.Broadcast") + +```None +func (c *Cond) Broadcast() +``` + +Broadcast wakes all goroutines waiting on c. + +It is allowed but not required for the caller to hold c.L +during the call. + +#### func (\*Cond) [Signal](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/cond.go;l=81) [¶](#Cond.Signal "Go to Cond.Signal") + +```None +func (c *Cond) Signal() +``` + +Signal wakes one goroutine waiting on c, if there is any. + +It is allowed but not required for the caller to hold c.L +during the call. + +Signal() does not affect goroutine scheduling priority; if other goroutines +are attempting to lock c.L, they may be awoken before a "waiting" goroutine. + +#### func (\*Cond) [Wait](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/cond.go;l=66) [¶](#Cond.Wait "Go to Cond.Wait") + +```None +func (c *Cond) Wait() +``` + +Wait atomically unlocks c.L and suspends execution +of the calling goroutine. After later resuming execution, +Wait locks c.L before returning. Unlike in other systems, +Wait cannot return unless awoken by Broadcast or Signal. + +Because c.L is not locked while Wait is waiting, the caller +typically cannot assume that the condition is true when +Wait returns. Instead, the caller should Wait in a loop: + +```None +c.L.Lock() +for !condition() { + c.Wait() +} +... make use of condition ... +c.L.Unlock() +``` + +#### type [Locker](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/mutex.go;l=40) [¶](#Locker "Go to Locker") + +```None +type Locker interface { + Lock() + Unlock() +} +``` + +A Locker represents an object that can be locked and unlocked. + +#### type [Map](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/map.go;l=35) [¶](#Map "Go to Map") added in go1.9 + +```None +type Map struct { + // contains filtered or unexported fields +} +``` + +Map is like a Go map[interface{}]interface{} but is safe for concurrent use +by multiple goroutines without additional locking or coordination. +Loads, stores, and deletes run in amortized constant time. + +The Map type is specialized. Most code should use a plain Go map instead, +with separate locking or coordination, for better type safety and to make it +easier to maintain other invariants along with the map content. + +The Map type is optimized for two common use cases: (1) when the entry for a given +key is only ever written once but read many times, as in caches that only grow, +or (2) when multiple goroutines read, write, and overwrite entries for disjoint +sets of keys. In these two cases, use of a Map may significantly reduce lock +contention compared to a Go map paired with a separate Mutex or RWMutex. + +The zero Map is empty and ready for use. A Map must not be copied after first use. + +In the terminology of the Go memory model, Map arranges that a write operation +“synchronizes before” any read operation that observes the effect of the write, where +read and write operations are defined as follows. +Load, LoadAndDelete, LoadOrStore, Swap, CompareAndSwap, and CompareAndDelete +are read operations; Delete, LoadAndDelete, Store, and Swap are write operations; +LoadOrStore is a write operation when it returns loaded set to false; +CompareAndSwap is a write operation when it returns swapped set to true; +and CompareAndDelete is a write operation when it returns deleted set to true. + +#### func (\*Map) [CompareAndDelete](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/map.go;l=406) [¶](#Map.CompareAndDelete "Go to Map.CompareAndDelete") added in go1.20 + +```None +func (m *Map) CompareAndDelete(key, old any) (deleted bool) +``` + +CompareAndDelete deletes the entry for key if its value is equal to old. +The old value must be of a comparable type. + +If there is no current value for key in the map, CompareAndDelete +returns false (even if the old value is the nil interface value). + +#### func (\*Map) [CompareAndSwap](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/map.go;l=374) [¶](#Map.CompareAndSwap "Go to Map.CompareAndSwap") added in go1.20 + +```None +func (m *Map) CompareAndSwap(key, old, new any) bool +``` + +CompareAndSwap swaps the old and new values for key +if the value stored in the map is equal to old. +The old value must be of a comparable type. + +#### func (\*Map) [Delete](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/map.go;l=296) [¶](#Map.Delete "Go to Map.Delete") added in go1.9 + +```None +func (m *Map) Delete(key any) +``` + +Delete deletes the value for a key. + +#### func (\*Map) [Load](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/map.go;l=120) [¶](#Map.Load "Go to Map.Load") added in go1.9 + +```None +func (m *Map) Load(key any) (value any, ok bool) +``` + +Load returns the value stored in the map for a key, or nil if no +value is present. +The ok result indicates whether value was found in the map. + +#### func (\*Map) [LoadAndDelete](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/map.go;l=272) [¶](#Map.LoadAndDelete "Go to Map.LoadAndDelete") added in go1.15 + +```None +func (m *Map) LoadAndDelete(key any) (value any, loaded bool) +``` + +LoadAndDelete deletes the value for a key, returning the previous value if any. +The loaded result reports whether the key was present. + +#### func (\*Map) [LoadOrStore](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/map.go;l=203) [¶](#Map.LoadOrStore "Go to Map.LoadOrStore") added in go1.9 + +```None +func (m *Map) LoadOrStore(key, value any) (actual any, loaded bool) +``` + +LoadOrStore returns the existing value for the key if present. +Otherwise, it stores and returns the given value. +The loaded result is true if the value was loaded, false if stored. + +#### func (\*Map) [Range](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/map.go;l=449) [¶](#Map.Range "Go to Map.Range") added in go1.9 + +```None +func (m *Map) Range(f func(key, value any) bool) +``` + +Range calls f sequentially for each key and value present in the map. +If f returns false, range stops the iteration. + +Range does not necessarily correspond to any consistent snapshot of the Map's +contents: no key will be visited more than once, but if the value for any key +is stored or deleted concurrently (including by f), Range may reflect any +mapping for that key from any point during the Range call. Range does not +block other methods on the receiver; even f itself may call any method on m. + +Range may be O(N) with the number of elements in the map even if f returns +false after a constant number of calls. + +#### func (\*Map) [Store](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/map.go;l=154) [¶](#Map.Store "Go to Map.Store") added in go1.9 + +```None +func (m *Map) Store(key, value any) +``` + +Store sets the value for a key. + +#### func (\*Map) [Swap](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/map.go;l=330) [¶](#Map.Swap "Go to Map.Swap") added in go1.20 + +```None +func (m *Map) Swap(key, value any) (previous any, loaded bool) +``` + +Swap swaps the value for a key and returns the previous value if any. +The loaded result reports whether the key was present. + +#### type [Mutex](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/mutex.go;l=34) [¶](#Mutex "Go to Mutex") + +```None +type Mutex struct { + // contains filtered or unexported fields +} +``` + +A Mutex is a mutual exclusion lock. +The zero value for a Mutex is an unlocked mutex. + +A Mutex must not be copied after first use. + +In the terminology of the Go memory model, +the n'th call to Unlock “synchronizes before” the m'th call to Lock +for any n < m. +A successful call to TryLock is equivalent to a call to Lock. +A failed call to TryLock does not establish any “synchronizes before” +relation at all. + +#### func (\*Mutex) [Lock](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/mutex.go;l=81) [¶](#Mutex.Lock "Go to Mutex.Lock") + +```None +func (m *Mutex) Lock() +``` + +Lock locks m. +If the lock is already in use, the calling goroutine +blocks until the mutex is available. + +#### func (\*Mutex) [TryLock](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/mutex.go;l=98) [¶](#Mutex.TryLock "Go to Mutex.TryLock") added in go1.18 + +```None +func (m *Mutex) TryLock() bool +``` + +TryLock tries to lock m and reports whether it succeeded. + +Note that while correct uses of TryLock do exist, they are rare, +and use of TryLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*Mutex) [Unlock](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/mutex.go;l=212) [¶](#Mutex.Unlock "Go to Mutex.Unlock") + +```None +func (m *Mutex) Unlock() +``` + +Unlock unlocks m. +It is a run-time error if m is not locked on entry to Unlock. + +A locked Mutex is not associated with a particular goroutine. +It is allowed for one goroutine to lock a Mutex and then +arrange for another goroutine to unlock it. + +#### type [Once](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/once.go;l=18) [¶](#Once "Go to Once") + +```None +type Once struct { + // contains filtered or unexported fields +} +``` + +Once is an object that will perform exactly one action. + +A Once must not be copied after first use. + +In the terminology of the Go memory model, +the return from f “synchronizes before” +the return from any call of once.Do(f). + +Example [¶](#example-Once "Go to Example") + +```None +package main + +import ( + "fmt" + "sync" +) + +func main() { + var once sync.Once + onceBody := func() { + fmt.Println("Only once") + } + done := make(chan bool) + for i := 0; i < 10; i++ { + go func() { + once.Do(onceBody) + done <- true + }() + } + for i := 0; i < 10; i++ { + <-done + } +} +``` + +```None +Output: + +Only once +``` + +Share +Format +Run + +#### func (\*Once) [Do](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/once.go;l=48) [¶](#Once.Do "Go to Once.Do") + +```None +func (o *Once) Do(f func()) +``` + +Do calls the function f if and only if Do is being called for the +first time for this instance of Once. In other words, given + +```None +var once Once +``` + +if once.Do(f) is called multiple times, only the first call will invoke f, +even if f has a different value in each invocation. A new instance of +Once is required for each function to execute. + +Do is intended for initialization that must be run exactly once. Since f +is niladic, it may be necessary to use a function literal to capture the +arguments to a function to be invoked by Do: + +```None +config.once.Do(func() { config.init(filename) }) +``` + +Because no call to Do returns until the one call to f returns, if f causes +Do to be called, it will deadlock. + +If f panics, Do considers it to have returned; future calls of Do return +without calling f. + +#### type [Pool](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/pool.go;l=49) [¶](#Pool "Go to Pool") added in go1.3 + +```None +type Pool struct { + + // New optionally specifies a function to generate + // a value when Get would otherwise return nil. + // It may not be changed concurrently with calls to Get. + New func() any + // contains filtered or unexported fields +} +``` + +A Pool is a set of temporary objects that may be individually saved and +retrieved. + +Any item stored in the Pool may be removed automatically at any time without +notification. If the Pool holds the only reference when this happens, the +item might be deallocated. + +A Pool is safe for use by multiple goroutines simultaneously. + +Pool's purpose is to cache allocated but unused items for later reuse, +relieving pressure on the garbage collector. That is, it makes it easy to +build efficient, thread-safe free lists. However, it is not suitable for all +free lists. + +An appropriate use of a Pool is to manage a group of temporary items +silently shared among and potentially reused by concurrent independent +clients of a package. Pool provides a way to amortize allocation overhead +across many clients. + +An example of good use of a Pool is in the fmt package, which maintains a +dynamically-sized store of temporary output buffers. The store scales under +load (when many goroutines are actively printing) and shrinks when +quiescent. + +On the other hand, a free list maintained as part of a short-lived object is +not a suitable use for a Pool, since the overhead does not amortize well in +that scenario. It is more efficient to have such objects implement their own +free list. + +A Pool must not be copied after first use. + +In the terminology of the Go memory model, a call to Put(x) “synchronizes before” +a call to Get returning that same value x. +Similarly, a call to New returning x “synchronizes before” +a call to Get returning that same value x. + +Example [¶](#example-Pool "Go to Example") + +```None +package main + +import ( + "bytes" + "io" + "os" + "sync" + "time" +) + +var bufPool = sync.Pool{ + New: func() any { + // The Pool's New function should generally only return pointer + // types, since a pointer can be put into the return interface + // value without an allocation: + return new(bytes.Buffer) + }, +} + +// timeNow is a fake version of time.Now for tests. +func timeNow() time.Time { + return time.Unix(1136214245, 0) +} + +func Log(w io.Writer, key, val string) { + b := bufPool.Get().(*bytes.Buffer) + b.Reset() + // Replace this with time.Now() in a real logger. + b.WriteString(timeNow().UTC().Format(time.RFC3339)) + b.WriteByte(' ') + b.WriteString(key) + b.WriteByte('=') + b.WriteString(val) + w.Write(b.Bytes()) + bufPool.Put(b) +} + +func main() { + Log(os.Stdout, "path", "/search?q=flowers") +} +``` + +```None +Output: + +2006-01-02T15:04:05Z path=/search?q=flowers +``` + +Share +Format +Run + +#### func (\*Pool) [Get](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/pool.go;l=127) [¶](#Pool.Get "Go to Pool.Get") added in go1.3 + +```None +func (p *Pool) Get() any +``` + +Get selects an arbitrary item from the Pool, removes it from the +Pool, and returns it to the caller. +Get may choose to ignore the pool and treat it as empty. +Callers should not assume any relation between values passed to Put and +the values returned by Get. + +If Get would otherwise return nil and p.New is non-nil, Get returns +the result of calling p.New. + +#### func (\*Pool) [Put](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/pool.go;l=95) [¶](#Pool.Put "Go to Pool.Put") added in go1.3 + +```None +func (p *Pool) Put(x any) +``` + +Put adds x to the pool. + +#### type [RWMutex](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/rwmutex.go;l=36) [¶](#RWMutex "Go to RWMutex") + +```None +type RWMutex struct { + // contains filtered or unexported fields +} +``` + +A RWMutex is a reader/writer mutual exclusion lock. +The lock can be held by an arbitrary number of readers or a single writer. +The zero value for a RWMutex is an unlocked mutex. + +A RWMutex must not be copied after first use. + +If a goroutine holds a RWMutex for reading and another goroutine might +call Lock, no goroutine should expect to be able to acquire a read lock +until the initial read lock is released. In particular, this prohibits +recursive read locking. This is to ensure that the lock eventually becomes +available; a blocked Lock call excludes new readers from acquiring the +lock. + +In the terminology of the Go memory model, +the n'th call to Unlock “synchronizes before” the m'th call to Lock +for any n < m, just as for Mutex. +For any call to RLock, there exists an n such that +the n'th call to Unlock “synchronizes before” that call to RLock, +and the corresponding call to RUnlock “synchronizes before” +the n+1'th call to Lock. + +#### func (\*RWMutex) [Lock](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/rwmutex.go;l=141) [¶](#RWMutex.Lock "Go to RWMutex.Lock") + +```None +func (rw *RWMutex) Lock() +``` + +Lock locks rw for writing. +If the lock is already locked for reading or writing, +Lock blocks until the lock is available. + +#### func (\*RWMutex) [RLock](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/rwmutex.go;l=64) [¶](#RWMutex.RLock "Go to RWMutex.RLock") + +```None +func (rw *RWMutex) RLock() +``` + +RLock locks rw for reading. + +It should not be used for recursive read locking; a blocked Lock +call excludes new readers from acquiring the lock. See the +documentation on the RWMutex type. + +#### func (\*RWMutex) [RLocker](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/rwmutex.go;l=237) [¶](#RWMutex.RLocker "Go to RWMutex.RLocker") + +```None +func (rw *RWMutex) RLocker() Locker +``` + +RLocker returns a Locker interface that implements +the Lock and Unlock methods by calling rw.RLock and rw.RUnlock. + +#### func (\*RWMutex) [RUnlock](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/rwmutex.go;l=111) [¶](#RWMutex.RUnlock "Go to RWMutex.RUnlock") + +```None +func (rw *RWMutex) RUnlock() +``` + +RUnlock undoes a single RLock call; +it does not affect other simultaneous readers. +It is a run-time error if rw is not locked for reading +on entry to RUnlock. + +#### func (\*RWMutex) [TryLock](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/rwmutex.go;l=166) [¶](#RWMutex.TryLock "Go to RWMutex.TryLock") added in go1.18 + +```None +func (rw *RWMutex) TryLock() bool +``` + +TryLock tries to lock rw for writing and reports whether it succeeded. + +Note that while correct uses of TryLock do exist, they are rare, +and use of TryLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*RWMutex) [TryRLock](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/rwmutex.go;l=84) [¶](#RWMutex.TryRLock "Go to RWMutex.TryRLock") added in go1.18 + +```None +func (rw *RWMutex) TryRLock() bool +``` + +TryRLock tries to lock rw for reading and reports whether it succeeded. + +Note that while correct uses of TryRLock do exist, they are rare, +and use of TryRLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*RWMutex) [Unlock](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/rwmutex.go;l=198) [¶](#RWMutex.Unlock "Go to RWMutex.Unlock") + +```None +func (rw *RWMutex) Unlock() +``` + +Unlock unlocks rw for writing. It is a run-time error if rw is +not locked for writing on entry to Unlock. + +As with Mutexes, a locked RWMutex is not associated with a particular +goroutine. One goroutine may RLock (Lock) a RWMutex and then +arrange for another goroutine to RUnlock (Unlock) it. + +#### type [WaitGroup](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/waitgroup.go;l=23) [¶](#WaitGroup "Go to WaitGroup") + +```None +type WaitGroup struct { + // contains filtered or unexported fields +} +``` + +A WaitGroup waits for a collection of goroutines to finish. +The main goroutine calls Add to set the number of +goroutines to wait for. Then each of the goroutines +runs and calls Done when finished. At the same time, +Wait can be used to block until all goroutines have finished. + +A WaitGroup must not be copied after first use. + +In the terminology of the Go memory model, a call to Done +“synchronizes before” the return of any Wait call that it unblocks. + +Example [¶](#example-WaitGroup "Go to Example") + +This example fetches several URLs concurrently, +using a WaitGroup to block until all the fetches are complete. + +```None +package main + +import ( + "sync" +) + +type httpPkg struct{} + +func (httpPkg) Get(url string) {} + +var http httpPkg + +func main() { + var wg sync.WaitGroup + var urls = []string{ + "http://www.golang.org/", + "http://www.google.com/", + "http://www.example.com/", + } + for _, url := range urls { + // Increment the WaitGroup counter. + wg.Add(1) + // Launch a goroutine to fetch the URL. + go func(url string) { + // Decrement the counter when the goroutine completes. + defer wg.Done() + // Fetch the URL. + http.Get(url) + }(url) + } + // Wait for all HTTP fetches to complete. + wg.Wait() +} +``` + +Share +Format +Run + +#### func (\*WaitGroup) [Add](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/waitgroup.go;l=43) [¶](#WaitGroup.Add "Go to WaitGroup.Add") + +```None +func (wg *WaitGroup) Add(delta int) +``` + +Add adds delta, which may be negative, to the WaitGroup counter. +If the counter becomes zero, all goroutines blocked on Wait are released. +If the counter goes negative, Add panics. + +Note that calls with a positive delta that occur when the counter is zero +must happen before a Wait. Calls with a negative delta, or calls with a +positive delta that start when the counter is greater than zero, may happen +at any time. +Typically this means the calls to Add should execute before the statement +creating the goroutine or other event to be waited for. +If a WaitGroup is reused to wait for several independent sets of events, +new Add calls must happen after all previous Wait calls have returned. +See the WaitGroup example. + +#### func (\*WaitGroup) [Done](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/waitgroup.go;l=86) [¶](#WaitGroup.Done "Go to WaitGroup.Done") + +```None +func (wg *WaitGroup) Done() +``` + +Done decrements the WaitGroup counter by one. + +#### func (\*WaitGroup) [Wait](https://cs.opensource.google/go/go/+/go1.21.0:src/sync/waitgroup.go;l=91) [¶](#WaitGroup.Wait "Go to WaitGroup.Wait") + +```None +func (wg *WaitGroup) Wait() +``` + +Wait blocks until the WaitGroup counter is zero. diff --git a/corpus/docs/golang/sync/sync_go1220.md b/corpus/docs/golang/sync/sync_go1220.md new file mode 100644 index 0000000000000000000000000000000000000000..f25f7c5aa0b80ffe05c1a61722878f35d2f6b383 --- /dev/null +++ b/corpus/docs/golang/sync/sync_go1220.md @@ -0,0 +1,811 @@ +# Golang - sync + +Source: https://pkg.go.dev/sync@go1.22.0 +Version: go1.22.0 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package sync provides basic synchronization primitives such as mutual +exclusion locks. Other than the Once and WaitGroup types, most are intended +for use by low-level library routines. Higher-level synchronization is +better done via channels and communication. + +Values containing the types defined in this package should not be copied. + +### Index [¶](#pkg-index "Go to Index") + +* [func OnceFunc(f func()) func()](#OnceFunc) +* [func OnceValue[T any](f func() T) func() T](#OnceValue) +* [func OnceValues[T1, T2 any](f func() (T1, T2)) func() (T1, T2)](#OnceValues) +* [type Cond](#Cond) +* + [func NewCond(l Locker) \*Cond](#NewCond) +* + [func (c \*Cond) Broadcast()](#Cond.Broadcast) + + [func (c \*Cond) Signal()](#Cond.Signal) + + [func (c \*Cond) Wait()](#Cond.Wait) +* [type Locker](#Locker) +* [type Map](#Map) +* + [func (m \*Map) CompareAndDelete(key, old any) (deleted bool)](#Map.CompareAndDelete) + + [func (m \*Map) CompareAndSwap(key, old, new any) bool](#Map.CompareAndSwap) + + [func (m \*Map) Delete(key any)](#Map.Delete) + + [func (m \*Map) Load(key any) (value any, ok bool)](#Map.Load) + + [func (m \*Map) LoadAndDelete(key any) (value any, loaded bool)](#Map.LoadAndDelete) + + [func (m \*Map) LoadOrStore(key, value any) (actual any, loaded bool)](#Map.LoadOrStore) + + [func (m \*Map) Range(f func(key, value any) bool)](#Map.Range) + + [func (m \*Map) Store(key, value any)](#Map.Store) + + [func (m \*Map) Swap(key, value any) (previous any, loaded bool)](#Map.Swap) +* [type Mutex](#Mutex) +* + [func (m \*Mutex) Lock()](#Mutex.Lock) + + [func (m \*Mutex) TryLock() bool](#Mutex.TryLock) + + [func (m \*Mutex) Unlock()](#Mutex.Unlock) +* [type Once](#Once) +* + [func (o \*Once) Do(f func())](#Once.Do) +* [type Pool](#Pool) +* + [func (p \*Pool) Get() any](#Pool.Get) + + [func (p \*Pool) Put(x any)](#Pool.Put) +* [type RWMutex](#RWMutex) +* + [func (rw \*RWMutex) Lock()](#RWMutex.Lock) + + [func (rw \*RWMutex) RLock()](#RWMutex.RLock) + + [func (rw \*RWMutex) RLocker() Locker](#RWMutex.RLocker) + + [func (rw \*RWMutex) RUnlock()](#RWMutex.RUnlock) + + [func (rw \*RWMutex) TryLock() bool](#RWMutex.TryLock) + + [func (rw \*RWMutex) TryRLock() bool](#RWMutex.TryRLock) + + [func (rw \*RWMutex) Unlock()](#RWMutex.Unlock) +* [type WaitGroup](#WaitGroup) +* + [func (wg \*WaitGroup) Add(delta int)](#WaitGroup.Add) + + [func (wg \*WaitGroup) Done()](#WaitGroup.Done) + + [func (wg \*WaitGroup) Wait()](#WaitGroup.Wait) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Once](#example-Once) +* [Pool](#example-Pool) +* [WaitGroup](#example-WaitGroup) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [OnceFunc](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/oncefunc.go;l=11) [¶](#OnceFunc "Go to OnceFunc") added in go1.21.0 + +```None +func OnceFunc(f func()) func() +``` + +OnceFunc returns a function that invokes f only once. The returned function +may be called concurrently. + +If f panics, the returned function will panic with the same value on every call. + +#### func [OnceValue](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/oncefunc.go;l=43) [¶](#OnceValue "Go to OnceValue") added in go1.21.0 + +```None +func OnceValue[T any](f func() T) func() T +``` + +OnceValue returns a function that invokes f only once and returns the value +returned by f. The returned function may be called concurrently. + +If f panics, the returned function will panic with the same value on every call. + +#### func [OnceValues](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/oncefunc.go;l=74) [¶](#OnceValues "Go to OnceValues") added in go1.21.0 + +```None +func OnceValues[T1, T2 any](f func() (T1, T2)) func() (T1, T2) +``` + +OnceValues returns a function that invokes f only once and returns the values +returned by f. The returned function may be called concurrently. + +If f panics, the returned function will panic with the same value on every call. + +### Types [¶](#pkg-types "Go to Types") + +#### type [Cond](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/cond.go;l=36) [¶](#Cond "Go to Cond") + +```None +type Cond struct { + + // L is held while observing or changing the condition + L Locker + // contains filtered or unexported fields +} +``` + +Cond implements a condition variable, a rendezvous point +for goroutines waiting for or announcing the occurrence +of an event. + +Each Cond has an associated Locker L (often a \*Mutex or \*RWMutex), +which must be held when changing the condition and +when calling the Wait method. + +A Cond must not be copied after first use. + +In the terminology of the Go memory model, Cond arranges that +a call to Broadcast or Signal “synchronizes before” any Wait call +that it unblocks. + +For many simple use cases, users will be better off using channels than a +Cond (Broadcast corresponds to closing a channel, and Signal corresponds to +sending on a channel). + +For more on replacements for sync.Cond, see [Roberto Clapis's series on +advanced concurrency patterns](https://blogtitle.github.io/categories/concurrency/), as well as [Bryan Mills's talk on concurrency +patterns](https://drive.google.com/file/d/1nPdvhB0PutEJzdCq5ms6UI58dp50fcAN/view). + +#### func [NewCond](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/cond.go;l=47) [¶](#NewCond "Go to NewCond") + +```None +func NewCond(l Locker) *Cond +``` + +NewCond returns a new Cond with Locker l. + +#### func (\*Cond) [Broadcast](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/cond.go;l=90) [¶](#Cond.Broadcast "Go to Cond.Broadcast") + +```None +func (c *Cond) Broadcast() +``` + +Broadcast wakes all goroutines waiting on c. + +It is allowed but not required for the caller to hold c.L +during the call. + +#### func (\*Cond) [Signal](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/cond.go;l=81) [¶](#Cond.Signal "Go to Cond.Signal") + +```None +func (c *Cond) Signal() +``` + +Signal wakes one goroutine waiting on c, if there is any. + +It is allowed but not required for the caller to hold c.L +during the call. + +Signal() does not affect goroutine scheduling priority; if other goroutines +are attempting to lock c.L, they may be awoken before a "waiting" goroutine. + +#### func (\*Cond) [Wait](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/cond.go;l=66) [¶](#Cond.Wait "Go to Cond.Wait") + +```None +func (c *Cond) Wait() +``` + +Wait atomically unlocks c.L and suspends execution +of the calling goroutine. After later resuming execution, +Wait locks c.L before returning. Unlike in other systems, +Wait cannot return unless awoken by Broadcast or Signal. + +Because c.L is not locked while Wait is waiting, the caller +typically cannot assume that the condition is true when +Wait returns. Instead, the caller should Wait in a loop: + +```None +c.L.Lock() +for !condition() { + c.Wait() +} +... make use of condition ... +c.L.Unlock() +``` + +#### type [Locker](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/mutex.go;l=40) [¶](#Locker "Go to Locker") + +```None +type Locker interface { + Lock() + Unlock() +} +``` + +A Locker represents an object that can be locked and unlocked. + +#### type [Map](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/map.go;l=35) [¶](#Map "Go to Map") added in go1.9 + +```None +type Map struct { + // contains filtered or unexported fields +} +``` + +Map is like a Go map[any]any but is safe for concurrent use +by multiple goroutines without additional locking or coordination. +Loads, stores, and deletes run in amortized constant time. + +The Map type is specialized. Most code should use a plain Go map instead, +with separate locking or coordination, for better type safety and to make it +easier to maintain other invariants along with the map content. + +The Map type is optimized for two common use cases: (1) when the entry for a given +key is only ever written once but read many times, as in caches that only grow, +or (2) when multiple goroutines read, write, and overwrite entries for disjoint +sets of keys. In these two cases, use of a Map may significantly reduce lock +contention compared to a Go map paired with a separate Mutex or RWMutex. + +The zero Map is empty and ready for use. A Map must not be copied after first use. + +In the terminology of the Go memory model, Map arranges that a write operation +“synchronizes before” any read operation that observes the effect of the write, where +read and write operations are defined as follows. +Load, LoadAndDelete, LoadOrStore, Swap, CompareAndSwap, and CompareAndDelete +are read operations; Delete, LoadAndDelete, Store, and Swap are write operations; +LoadOrStore is a write operation when it returns loaded set to false; +CompareAndSwap is a write operation when it returns swapped set to true; +and CompareAndDelete is a write operation when it returns deleted set to true. + +#### func (\*Map) [CompareAndDelete](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/map.go;l=406) [¶](#Map.CompareAndDelete "Go to Map.CompareAndDelete") added in go1.20 + +```None +func (m *Map) CompareAndDelete(key, old any) (deleted bool) +``` + +CompareAndDelete deletes the entry for key if its value is equal to old. +The old value must be of a comparable type. + +If there is no current value for key in the map, CompareAndDelete +returns false (even if the old value is the nil interface value). + +#### func (\*Map) [CompareAndSwap](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/map.go;l=374) [¶](#Map.CompareAndSwap "Go to Map.CompareAndSwap") added in go1.20 + +```None +func (m *Map) CompareAndSwap(key, old, new any) bool +``` + +CompareAndSwap swaps the old and new values for key +if the value stored in the map is equal to old. +The old value must be of a comparable type. + +#### func (\*Map) [Delete](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/map.go;l=296) [¶](#Map.Delete "Go to Map.Delete") added in go1.9 + +```None +func (m *Map) Delete(key any) +``` + +Delete deletes the value for a key. + +#### func (\*Map) [Load](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/map.go;l=120) [¶](#Map.Load "Go to Map.Load") added in go1.9 + +```None +func (m *Map) Load(key any) (value any, ok bool) +``` + +Load returns the value stored in the map for a key, or nil if no +value is present. +The ok result indicates whether value was found in the map. + +#### func (\*Map) [LoadAndDelete](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/map.go;l=272) [¶](#Map.LoadAndDelete "Go to Map.LoadAndDelete") added in go1.15 + +```None +func (m *Map) LoadAndDelete(key any) (value any, loaded bool) +``` + +LoadAndDelete deletes the value for a key, returning the previous value if any. +The loaded result reports whether the key was present. + +#### func (\*Map) [LoadOrStore](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/map.go;l=203) [¶](#Map.LoadOrStore "Go to Map.LoadOrStore") added in go1.9 + +```None +func (m *Map) LoadOrStore(key, value any) (actual any, loaded bool) +``` + +LoadOrStore returns the existing value for the key if present. +Otherwise, it stores and returns the given value. +The loaded result is true if the value was loaded, false if stored. + +#### func (\*Map) [Range](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/map.go;l=449) [¶](#Map.Range "Go to Map.Range") added in go1.9 + +```None +func (m *Map) Range(f func(key, value any) bool) +``` + +Range calls f sequentially for each key and value present in the map. +If f returns false, range stops the iteration. + +Range does not necessarily correspond to any consistent snapshot of the Map's +contents: no key will be visited more than once, but if the value for any key +is stored or deleted concurrently (including by f), Range may reflect any +mapping for that key from any point during the Range call. Range does not +block other methods on the receiver; even f itself may call any method on m. + +Range may be O(N) with the number of elements in the map even if f returns +false after a constant number of calls. + +#### func (\*Map) [Store](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/map.go;l=154) [¶](#Map.Store "Go to Map.Store") added in go1.9 + +```None +func (m *Map) Store(key, value any) +``` + +Store sets the value for a key. + +#### func (\*Map) [Swap](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/map.go;l=330) [¶](#Map.Swap "Go to Map.Swap") added in go1.20 + +```None +func (m *Map) Swap(key, value any) (previous any, loaded bool) +``` + +Swap swaps the value for a key and returns the previous value if any. +The loaded result reports whether the key was present. + +#### type [Mutex](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/mutex.go;l=34) [¶](#Mutex "Go to Mutex") + +```None +type Mutex struct { + // contains filtered or unexported fields +} +``` + +A Mutex is a mutual exclusion lock. +The zero value for a Mutex is an unlocked mutex. + +A Mutex must not be copied after first use. + +In the terminology of the Go memory model, +the n'th call to Unlock “synchronizes before” the m'th call to Lock +for any n < m. +A successful call to TryLock is equivalent to a call to Lock. +A failed call to TryLock does not establish any “synchronizes before” +relation at all. + +#### func (\*Mutex) [Lock](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/mutex.go;l=81) [¶](#Mutex.Lock "Go to Mutex.Lock") + +```None +func (m *Mutex) Lock() +``` + +Lock locks m. +If the lock is already in use, the calling goroutine +blocks until the mutex is available. + +#### func (\*Mutex) [TryLock](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/mutex.go;l=98) [¶](#Mutex.TryLock "Go to Mutex.TryLock") added in go1.18 + +```None +func (m *Mutex) TryLock() bool +``` + +TryLock tries to lock m and reports whether it succeeded. + +Note that while correct uses of TryLock do exist, they are rare, +and use of TryLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*Mutex) [Unlock](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/mutex.go;l=212) [¶](#Mutex.Unlock "Go to Mutex.Unlock") + +```None +func (m *Mutex) Unlock() +``` + +Unlock unlocks m. +It is a run-time error if m is not locked on entry to Unlock. + +A locked Mutex is not associated with a particular goroutine. +It is allowed for one goroutine to lock a Mutex and then +arrange for another goroutine to unlock it. + +#### type [Once](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/once.go;l=18) [¶](#Once "Go to Once") + +```None +type Once struct { + // contains filtered or unexported fields +} +``` + +Once is an object that will perform exactly one action. + +A Once must not be copied after first use. + +In the terminology of the Go memory model, +the return from f “synchronizes before” +the return from any call of once.Do(f). + +Example [¶](#example-Once "Go to Example") + +```None +package main + +import ( + "fmt" + "sync" +) + +func main() { + var once sync.Once + onceBody := func() { + fmt.Println("Only once") + } + done := make(chan bool) + for i := 0; i < 10; i++ { + go func() { + once.Do(onceBody) + done <- true + }() + } + for i := 0; i < 10; i++ { + <-done + } +} +``` + +```None +Output: + +Only once +``` + +Share +Format +Run + +#### func (\*Once) [Do](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/once.go;l=48) [¶](#Once.Do "Go to Once.Do") + +```None +func (o *Once) Do(f func()) +``` + +Do calls the function f if and only if Do is being called for the +first time for this instance of Once. In other words, given + +```None +var once Once +``` + +if once.Do(f) is called multiple times, only the first call will invoke f, +even if f has a different value in each invocation. A new instance of +Once is required for each function to execute. + +Do is intended for initialization that must be run exactly once. Since f +is niladic, it may be necessary to use a function literal to capture the +arguments to a function to be invoked by Do: + +```None +config.once.Do(func() { config.init(filename) }) +``` + +Because no call to Do returns until the one call to f returns, if f causes +Do to be called, it will deadlock. + +If f panics, Do considers it to have returned; future calls of Do return +without calling f. + +#### type [Pool](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/pool.go;l=49) [¶](#Pool "Go to Pool") added in go1.3 + +```None +type Pool struct { + + // New optionally specifies a function to generate + // a value when Get would otherwise return nil. + // It may not be changed concurrently with calls to Get. + New func() any + // contains filtered or unexported fields +} +``` + +A Pool is a set of temporary objects that may be individually saved and +retrieved. + +Any item stored in the Pool may be removed automatically at any time without +notification. If the Pool holds the only reference when this happens, the +item might be deallocated. + +A Pool is safe for use by multiple goroutines simultaneously. + +Pool's purpose is to cache allocated but unused items for later reuse, +relieving pressure on the garbage collector. That is, it makes it easy to +build efficient, thread-safe free lists. However, it is not suitable for all +free lists. + +An appropriate use of a Pool is to manage a group of temporary items +silently shared among and potentially reused by concurrent independent +clients of a package. Pool provides a way to amortize allocation overhead +across many clients. + +An example of good use of a Pool is in the fmt package, which maintains a +dynamically-sized store of temporary output buffers. The store scales under +load (when many goroutines are actively printing) and shrinks when +quiescent. + +On the other hand, a free list maintained as part of a short-lived object is +not a suitable use for a Pool, since the overhead does not amortize well in +that scenario. It is more efficient to have such objects implement their own +free list. + +A Pool must not be copied after first use. + +In the terminology of the Go memory model, a call to Put(x) “synchronizes before” +a call to Get returning that same value x. +Similarly, a call to New returning x “synchronizes before” +a call to Get returning that same value x. + +Example [¶](#example-Pool "Go to Example") + +```None +package main + +import ( + "bytes" + "io" + "os" + "sync" + "time" +) + +var bufPool = sync.Pool{ + New: func() any { + // The Pool's New function should generally only return pointer + // types, since a pointer can be put into the return interface + // value without an allocation: + return new(bytes.Buffer) + }, +} + +// timeNow is a fake version of time.Now for tests. +func timeNow() time.Time { + return time.Unix(1136214245, 0) +} + +func Log(w io.Writer, key, val string) { + b := bufPool.Get().(*bytes.Buffer) + b.Reset() + // Replace this with time.Now() in a real logger. + b.WriteString(timeNow().UTC().Format(time.RFC3339)) + b.WriteByte(' ') + b.WriteString(key) + b.WriteByte('=') + b.WriteString(val) + w.Write(b.Bytes()) + bufPool.Put(b) +} + +func main() { + Log(os.Stdout, "path", "/search?q=flowers") +} +``` + +```None +Output: + +2006-01-02T15:04:05Z path=/search?q=flowers +``` + +Share +Format +Run + +#### func (\*Pool) [Get](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/pool.go;l=128) [¶](#Pool.Get "Go to Pool.Get") added in go1.3 + +```None +func (p *Pool) Get() any +``` + +Get selects an arbitrary item from the Pool, removes it from the +Pool, and returns it to the caller. +Get may choose to ignore the pool and treat it as empty. +Callers should not assume any relation between values passed to Put and +the values returned by Get. + +If Get would otherwise return nil and p.New is non-nil, Get returns +the result of calling p.New. + +#### func (\*Pool) [Put](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/pool.go;l=96) [¶](#Pool.Put "Go to Pool.Put") added in go1.3 + +```None +func (p *Pool) Put(x any) +``` + +Put adds x to the pool. + +#### type [RWMutex](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/rwmutex.go;l=35) [¶](#RWMutex "Go to RWMutex") + +```None +type RWMutex struct { + // contains filtered or unexported fields +} +``` + +A RWMutex is a reader/writer mutual exclusion lock. +The lock can be held by an arbitrary number of readers or a single writer. +The zero value for a RWMutex is an unlocked mutex. + +A RWMutex must not be copied after first use. + +If any goroutine calls Lock while the lock is already held by +one or more readers, concurrent calls to RLock will block until +the writer has acquired (and released) the lock, to ensure that +the lock eventually becomes available to the writer. +Note that this prohibits recursive read-locking. + +In the terminology of the Go memory model, +the n'th call to Unlock “synchronizes before” the m'th call to Lock +for any n < m, just as for Mutex. +For any call to RLock, there exists an n such that +the n'th call to Unlock “synchronizes before” that call to RLock, +and the corresponding call to RUnlock “synchronizes before” +the n+1'th call to Lock. + +#### func (\*RWMutex) [Lock](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/rwmutex.go;l=140) [¶](#RWMutex.Lock "Go to RWMutex.Lock") + +```None +func (rw *RWMutex) Lock() +``` + +Lock locks rw for writing. +If the lock is already locked for reading or writing, +Lock blocks until the lock is available. + +#### func (\*RWMutex) [RLock](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/rwmutex.go;l=63) [¶](#RWMutex.RLock "Go to RWMutex.RLock") + +```None +func (rw *RWMutex) RLock() +``` + +RLock locks rw for reading. + +It should not be used for recursive read locking; a blocked Lock +call excludes new readers from acquiring the lock. See the +documentation on the RWMutex type. + +#### func (\*RWMutex) [RLocker](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/rwmutex.go;l=236) [¶](#RWMutex.RLocker "Go to RWMutex.RLocker") + +```None +func (rw *RWMutex) RLocker() Locker +``` + +RLocker returns a Locker interface that implements +the Lock and Unlock methods by calling rw.RLock and rw.RUnlock. + +#### func (\*RWMutex) [RUnlock](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/rwmutex.go;l=110) [¶](#RWMutex.RUnlock "Go to RWMutex.RUnlock") + +```None +func (rw *RWMutex) RUnlock() +``` + +RUnlock undoes a single RLock call; +it does not affect other simultaneous readers. +It is a run-time error if rw is not locked for reading +on entry to RUnlock. + +#### func (\*RWMutex) [TryLock](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/rwmutex.go;l=165) [¶](#RWMutex.TryLock "Go to RWMutex.TryLock") added in go1.18 + +```None +func (rw *RWMutex) TryLock() bool +``` + +TryLock tries to lock rw for writing and reports whether it succeeded. + +Note that while correct uses of TryLock do exist, they are rare, +and use of TryLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*RWMutex) [TryRLock](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/rwmutex.go;l=83) [¶](#RWMutex.TryRLock "Go to RWMutex.TryRLock") added in go1.18 + +```None +func (rw *RWMutex) TryRLock() bool +``` + +TryRLock tries to lock rw for reading and reports whether it succeeded. + +Note that while correct uses of TryRLock do exist, they are rare, +and use of TryRLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*RWMutex) [Unlock](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/rwmutex.go;l=197) [¶](#RWMutex.Unlock "Go to RWMutex.Unlock") + +```None +func (rw *RWMutex) Unlock() +``` + +Unlock unlocks rw for writing. It is a run-time error if rw is +not locked for writing on entry to Unlock. + +As with Mutexes, a locked RWMutex is not associated with a particular +goroutine. One goroutine may RLock (Lock) a RWMutex and then +arrange for another goroutine to RUnlock (Unlock) it. + +#### type [WaitGroup](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/waitgroup.go;l=23) [¶](#WaitGroup "Go to WaitGroup") + +```None +type WaitGroup struct { + // contains filtered or unexported fields +} +``` + +A WaitGroup waits for a collection of goroutines to finish. +The main goroutine calls Add to set the number of +goroutines to wait for. Then each of the goroutines +runs and calls Done when finished. At the same time, +Wait can be used to block until all goroutines have finished. + +A WaitGroup must not be copied after first use. + +In the terminology of the Go memory model, a call to Done +“synchronizes before” the return of any Wait call that it unblocks. + +Example [¶](#example-WaitGroup "Go to Example") + +This example fetches several URLs concurrently, +using a WaitGroup to block until all the fetches are complete. + +```None +package main + +import ( + "sync" +) + +type httpPkg struct{} + +func (httpPkg) Get(url string) {} + +var http httpPkg + +func main() { + var wg sync.WaitGroup + var urls = []string{ + "http://www.golang.org/", + "http://www.google.com/", + "http://www.example.com/", + } + for _, url := range urls { + // Increment the WaitGroup counter. + wg.Add(1) + // Launch a goroutine to fetch the URL. + go func(url string) { + // Decrement the counter when the goroutine completes. + defer wg.Done() + // Fetch the URL. + http.Get(url) + }(url) + } + // Wait for all HTTP fetches to complete. + wg.Wait() +} +``` + +Share +Format +Run + +#### func (\*WaitGroup) [Add](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/waitgroup.go;l=43) [¶](#WaitGroup.Add "Go to WaitGroup.Add") + +```None +func (wg *WaitGroup) Add(delta int) +``` + +Add adds delta, which may be negative, to the WaitGroup counter. +If the counter becomes zero, all goroutines blocked on Wait are released. +If the counter goes negative, Add panics. + +Note that calls with a positive delta that occur when the counter is zero +must happen before a Wait. Calls with a negative delta, or calls with a +positive delta that start when the counter is greater than zero, may happen +at any time. +Typically this means the calls to Add should execute before the statement +creating the goroutine or other event to be waited for. +If a WaitGroup is reused to wait for several independent sets of events, +new Add calls must happen after all previous Wait calls have returned. +See the WaitGroup example. + +#### func (\*WaitGroup) [Done](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/waitgroup.go;l=86) [¶](#WaitGroup.Done "Go to WaitGroup.Done") + +```None +func (wg *WaitGroup) Done() +``` + +Done decrements the WaitGroup counter by one. + +#### func (\*WaitGroup) [Wait](https://cs.opensource.google/go/go/+/go1.22.0:src/sync/waitgroup.go;l=91) [¶](#WaitGroup.Wait "Go to WaitGroup.Wait") + +```None +func (wg *WaitGroup) Wait() +``` + +Wait blocks until the WaitGroup counter is zero. diff --git a/corpus/docs/golang/sync/sync_go1230.md b/corpus/docs/golang/sync/sync_go1230.md new file mode 100644 index 0000000000000000000000000000000000000000..e229e04685abb46d704298d1485b61682d4dcc72 --- /dev/null +++ b/corpus/docs/golang/sync/sync_go1230.md @@ -0,0 +1,917 @@ +# Golang - sync + +Source: https://pkg.go.dev/sync@go1.23.0 +Version: go1.23.0 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package sync provides basic synchronization primitives such as mutual +exclusion locks. Other than the [Once](#Once) and [WaitGroup](#WaitGroup) types, most are intended +for use by low-level library routines. Higher-level synchronization is +better done via channels and communication. + +Values containing the types defined in this package should not be copied. + +### Index [¶](#pkg-index "Go to Index") + +* [func OnceFunc(f func()) func()](#OnceFunc) +* [func OnceValue[T any](f func() T) func() T](#OnceValue) +* [func OnceValues[T1, T2 any](f func() (T1, T2)) func() (T1, T2)](#OnceValues) +* [type Cond](#Cond) +* + [func NewCond(l Locker) \*Cond](#NewCond) +* + [func (c \*Cond) Broadcast()](#Cond.Broadcast) + + [func (c \*Cond) Signal()](#Cond.Signal) + + [func (c \*Cond) Wait()](#Cond.Wait) +* [type Locker](#Locker) +* [type Map](#Map) +* + [func (m \*Map) Clear()](#Map.Clear) + + [func (m \*Map) CompareAndDelete(key, old any) (deleted bool)](#Map.CompareAndDelete) + + [func (m \*Map) CompareAndSwap(key, old, new any) (swapped bool)](#Map.CompareAndSwap) + + [func (m \*Map) Delete(key any)](#Map.Delete) + + [func (m \*Map) Load(key any) (value any, ok bool)](#Map.Load) + + [func (m \*Map) LoadAndDelete(key any) (value any, loaded bool)](#Map.LoadAndDelete) + + [func (m \*Map) LoadOrStore(key, value any) (actual any, loaded bool)](#Map.LoadOrStore) + + [func (m \*Map) Range(f func(key, value any) bool)](#Map.Range) + + [func (m \*Map) Store(key, value any)](#Map.Store) + + [func (m \*Map) Swap(key, value any) (previous any, loaded bool)](#Map.Swap) +* [type Mutex](#Mutex) +* + [func (m \*Mutex) Lock()](#Mutex.Lock) + + [func (m \*Mutex) TryLock() bool](#Mutex.TryLock) + + [func (m \*Mutex) Unlock()](#Mutex.Unlock) +* [type Once](#Once) +* + [func (o \*Once) Do(f func())](#Once.Do) +* [type Pool](#Pool) +* + [func (p \*Pool) Get() any](#Pool.Get) + + [func (p \*Pool) Put(x any)](#Pool.Put) +* [type RWMutex](#RWMutex) +* + [func (rw \*RWMutex) Lock()](#RWMutex.Lock) + + [func (rw \*RWMutex) RLock()](#RWMutex.RLock) + + [func (rw \*RWMutex) RLocker() Locker](#RWMutex.RLocker) + + [func (rw \*RWMutex) RUnlock()](#RWMutex.RUnlock) + + [func (rw \*RWMutex) TryLock() bool](#RWMutex.TryLock) + + [func (rw \*RWMutex) TryRLock() bool](#RWMutex.TryRLock) + + [func (rw \*RWMutex) Unlock()](#RWMutex.Unlock) +* [type WaitGroup](#WaitGroup) +* + [func (wg \*WaitGroup) Add(delta int)](#WaitGroup.Add) + + [func (wg \*WaitGroup) Done()](#WaitGroup.Done) + + [func (wg \*WaitGroup) Wait()](#WaitGroup.Wait) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Once](#example-Once) +* [OnceValue](#example-OnceValue) +* [OnceValues](#example-OnceValues) +* [Pool](#example-Pool) +* [WaitGroup](#example-WaitGroup) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [OnceFunc](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/oncefunc.go;l=11) [¶](#OnceFunc "Go to OnceFunc") added in go1.21.0 + +```None +func OnceFunc(f func()) func() +``` + +OnceFunc returns a function that invokes f only once. The returned function +may be called concurrently. + +If f panics, the returned function will panic with the same value on every call. + +#### func [OnceValue](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/oncefunc.go;l=43) [¶](#OnceValue "Go to OnceValue") added in go1.21.0 + +```None +func OnceValue[T any](f func() T) func() T +``` + +OnceValue returns a function that invokes f only once and returns the value +returned by f. The returned function may be called concurrently. + +If f panics, the returned function will panic with the same value on every call. + +Example [¶](#example-OnceValue "Go to Example") + +This example uses OnceValue to perform an "expensive" computation just once, +even when used concurrently. + +```None +package main + +import ( + "fmt" + "sync" +) + +func main() { + once := sync.OnceValue(func() int { + sum := 0 + for i := 0; i < 1000; i++ { + sum += i + } + fmt.Println("Computed once:", sum) + return sum + }) + done := make(chan bool) + for i := 0; i < 10; i++ { + go func() { + const want = 499500 + got := once() + if got != want { + fmt.Println("want", want, "got", got) + } + done <- true + }() + } + for i := 0; i < 10; i++ { + <-done + } +} +``` + +```None +Output: + +Computed once: 499500 +``` + +Share +Format +Run + +#### func [OnceValues](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/oncefunc.go;l=74) [¶](#OnceValues "Go to OnceValues") added in go1.21.0 + +```None +func OnceValues[T1, T2 any](f func() (T1, T2)) func() (T1, T2) +``` + +OnceValues returns a function that invokes f only once and returns the values +returned by f. The returned function may be called concurrently. + +If f panics, the returned function will panic with the same value on every call. + +Example [¶](#example-OnceValues "Go to Example") + +This example uses OnceValues to read a file just once. + +```None +package main + +import ( + "fmt" + "os" + "sync" +) + +func main() { + once := sync.OnceValues(func() ([]byte, error) { + fmt.Println("Reading file once") + return os.ReadFile("example_test.go") + }) + done := make(chan bool) + for i := 0; i < 10; i++ { + go func() { + data, err := once() + if err != nil { + fmt.Println("error:", err) + } + _ = data // Ignore the data for this example + done <- true + }() + } + for i := 0; i < 10; i++ { + <-done + } +} +``` + +```None +Output: + +Reading file once +``` + +Share +Format +Run + +### Types [¶](#pkg-types "Go to Types") + +#### type [Cond](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/cond.go;l=37) [¶](#Cond "Go to Cond") + +```None +type Cond struct { + + // L is held while observing or changing the condition + L Locker + // contains filtered or unexported fields +} +``` + +Cond implements a condition variable, a rendezvous point +for goroutines waiting for or announcing the occurrence +of an event. + +Each Cond has an associated Locker L (often a [\*Mutex](#Mutex) or [\*RWMutex](#RWMutex)), +which must be held when changing the condition and +when calling the [Cond.Wait](#Cond.Wait) method. + +A Cond must not be copied after first use. + +In the terminology of [the Go memory model](https://go.dev/ref/mem), Cond arranges that +a call to [Cond.Broadcast](#Cond.Broadcast) or [Cond.Signal](#Cond.Signal) “synchronizes before” any Wait call +that it unblocks. + +For many simple use cases, users will be better off using channels than a +Cond (Broadcast corresponds to closing a channel, and Signal corresponds to +sending on a channel). + +For more on replacements for [sync.Cond](#Cond), see [Roberto Clapis's series on +advanced concurrency patterns](https://blogtitle.github.io/categories/concurrency/), as well as [Bryan Mills's talk on concurrency +patterns](https://drive.google.com/file/d/1nPdvhB0PutEJzdCq5ms6UI58dp50fcAN/view). + +#### func [NewCond](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/cond.go;l=48) [¶](#NewCond "Go to NewCond") + +```None +func NewCond(l Locker) *Cond +``` + +NewCond returns a new Cond with Locker l. + +#### func (\*Cond) [Broadcast](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/cond.go;l=91) [¶](#Cond.Broadcast "Go to Cond.Broadcast") + +```None +func (c *Cond) Broadcast() +``` + +Broadcast wakes all goroutines waiting on c. + +It is allowed but not required for the caller to hold c.L +during the call. + +#### func (\*Cond) [Signal](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/cond.go;l=82) [¶](#Cond.Signal "Go to Cond.Signal") + +```None +func (c *Cond) Signal() +``` + +Signal wakes one goroutine waiting on c, if there is any. + +It is allowed but not required for the caller to hold c.L +during the call. + +Signal() does not affect goroutine scheduling priority; if other goroutines +are attempting to lock c.L, they may be awoken before a "waiting" goroutine. + +#### func (\*Cond) [Wait](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/cond.go;l=67) [¶](#Cond.Wait "Go to Cond.Wait") + +```None +func (c *Cond) Wait() +``` + +Wait atomically unlocks c.L and suspends execution +of the calling goroutine. After later resuming execution, +Wait locks c.L before returning. Unlike in other systems, +Wait cannot return unless awoken by [Cond.Broadcast](#Cond.Broadcast) or [Cond.Signal](#Cond.Signal). + +Because c.L is not locked while Wait is waiting, the caller +typically cannot assume that the condition is true when +Wait returns. Instead, the caller should Wait in a loop: + +```None +c.L.Lock() +for !condition() { + c.Wait() +} +... make use of condition ... +c.L.Unlock() +``` + +#### type [Locker](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/mutex.go;l=42) [¶](#Locker "Go to Locker") + +```None +type Locker interface { + Lock() + Unlock() +} +``` + +A Locker represents an object that can be locked and unlocked. + +#### type [Map](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/map.go;l=38) [¶](#Map "Go to Map") added in go1.9 + +```None +type Map struct { + // contains filtered or unexported fields +} +``` + +Map is like a Go map[any]any but is safe for concurrent use +by multiple goroutines without additional locking or coordination. +Loads, stores, and deletes run in amortized constant time. + +The Map type is specialized. Most code should use a plain Go map instead, +with separate locking or coordination, for better type safety and to make it +easier to maintain other invariants along with the map content. + +The Map type is optimized for two common use cases: (1) when the entry for a given +key is only ever written once but read many times, as in caches that only grow, +or (2) when multiple goroutines read, write, and overwrite entries for disjoint +sets of keys. In these two cases, use of a Map may significantly reduce lock +contention compared to a Go map paired with a separate [Mutex](#Mutex) or [RWMutex](#RWMutex). + +The zero Map is empty and ready for use. A Map must not be copied after first use. + +In the terminology of [the Go memory model](https://go.dev/ref/mem), Map arranges that a write operation +“synchronizes before” any read operation that observes the effect of the write, where +read and write operations are defined as follows. +[Map.Load](#Map.Load), [Map.LoadAndDelete](#Map.LoadAndDelete), [Map.LoadOrStore](#Map.LoadOrStore), [Map.Swap](#Map.Swap), [Map.CompareAndSwap](#Map.CompareAndSwap), +and [Map.CompareAndDelete](#Map.CompareAndDelete) are read operations; +[Map.Delete](#Map.Delete), [Map.LoadAndDelete](#Map.LoadAndDelete), [Map.Store](#Map.Store), and [Map.Swap](#Map.Swap) are write operations; +[Map.LoadOrStore](#Map.LoadOrStore) is a write operation when it returns loaded set to false; +[Map.CompareAndSwap](#Map.CompareAndSwap) is a write operation when it returns swapped set to true; +and [Map.CompareAndDelete](#Map.CompareAndDelete) is a write operation when it returns deleted set to true. + +#### func (\*Map) [Clear](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/map.go;l=162) [¶](#Map.Clear "Go to Map.Clear") added in go1.23.0 + +```None +func (m *Map) Clear() +``` + +Clear deletes all the entries, resulting in an empty Map. + +#### func (\*Map) [CompareAndDelete](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/map.go;l=430) [¶](#Map.CompareAndDelete "Go to Map.CompareAndDelete") added in go1.20 + +```None +func (m *Map) CompareAndDelete(key, old any) (deleted bool) +``` + +CompareAndDelete deletes the entry for key if its value is equal to old. +The old value must be of a comparable type. + +If there is no current value for key in the map, CompareAndDelete +returns false (even if the old value is the nil interface value). + +#### func (\*Map) [CompareAndSwap](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/map.go;l=398) [¶](#Map.CompareAndSwap "Go to Map.CompareAndSwap") added in go1.20 + +```None +func (m *Map) CompareAndSwap(key, old, new any) (swapped bool) +``` + +CompareAndSwap swaps the old and new values for key +if the value stored in the map is equal to old. +The old value must be of a comparable type. + +#### func (\*Map) [Delete](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/map.go;l=320) [¶](#Map.Delete "Go to Map.Delete") added in go1.9 + +```None +func (m *Map) Delete(key any) +``` + +Delete deletes the value for a key. + +#### func (\*Map) [Load](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/map.go;l=123) [¶](#Map.Load "Go to Map.Load") added in go1.9 + +```None +func (m *Map) Load(key any) (value any, ok bool) +``` + +Load returns the value stored in the map for a key, or nil if no +value is present. +The ok result indicates whether value was found in the map. + +#### func (\*Map) [LoadAndDelete](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/map.go;l=296) [¶](#Map.LoadAndDelete "Go to Map.LoadAndDelete") added in go1.15 + +```None +func (m *Map) LoadAndDelete(key any) (value any, loaded bool) +``` + +LoadAndDelete deletes the value for a key, returning the previous value if any. +The loaded result reports whether the key was present. + +#### func (\*Map) [LoadOrStore](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/map.go;l=227) [¶](#Map.LoadOrStore "Go to Map.LoadOrStore") added in go1.9 + +```None +func (m *Map) LoadOrStore(key, value any) (actual any, loaded bool) +``` + +LoadOrStore returns the existing value for the key if present. +Otherwise, it stores and returns the given value. +The loaded result is true if the value was loaded, false if stored. + +#### func (\*Map) [Range](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/map.go;l=473) [¶](#Map.Range "Go to Map.Range") added in go1.9 + +```None +func (m *Map) Range(f func(key, value any) bool) +``` + +Range calls f sequentially for each key and value present in the map. +If f returns false, range stops the iteration. + +Range does not necessarily correspond to any consistent snapshot of the Map's +contents: no key will be visited more than once, but if the value for any key +is stored or deleted concurrently (including by f), Range may reflect any +mapping for that key from any point during the Range call. Range does not +block other methods on the receiver; even f itself may call any method on m. + +Range may be O(N) with the number of elements in the map even if f returns +false after a constant number of calls. + +#### func (\*Map) [Store](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/map.go;l=157) [¶](#Map.Store "Go to Map.Store") added in go1.9 + +```None +func (m *Map) Store(key, value any) +``` + +Store sets the value for a key. + +#### func (\*Map) [Swap](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/map.go;l=354) [¶](#Map.Swap "Go to Map.Swap") added in go1.20 + +```None +func (m *Map) Swap(key, value any) (previous any, loaded bool) +``` + +Swap swaps the value for a key and returns the previous value if any. +The loaded result reports whether the key was present. + +#### type [Mutex](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/mutex.go;l=36) [¶](#Mutex "Go to Mutex") + +```None +type Mutex struct { + // contains filtered or unexported fields +} +``` + +A Mutex is a mutual exclusion lock. +The zero value for a Mutex is an unlocked mutex. + +A Mutex must not be copied after first use. + +In the terminology of [the Go memory model](https://go.dev/ref/mem), +the n'th call to [Mutex.Unlock](#Mutex.Unlock) “synchronizes before” the m'th call to [Mutex.Lock](#Mutex.Lock) +for any n < m. +A successful call to [Mutex.TryLock](#Mutex.TryLock) is equivalent to a call to Lock. +A failed call to TryLock does not establish any “synchronizes before” +relation at all. + +#### func (\*Mutex) [Lock](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/mutex.go;l=83) [¶](#Mutex.Lock "Go to Mutex.Lock") + +```None +func (m *Mutex) Lock() +``` + +Lock locks m. +If the lock is already in use, the calling goroutine +blocks until the mutex is available. + +#### func (\*Mutex) [TryLock](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/mutex.go;l=100) [¶](#Mutex.TryLock "Go to Mutex.TryLock") added in go1.18 + +```None +func (m *Mutex) TryLock() bool +``` + +TryLock tries to lock m and reports whether it succeeded. + +Note that while correct uses of TryLock do exist, they are rare, +and use of TryLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*Mutex) [Unlock](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/mutex.go;l=214) [¶](#Mutex.Unlock "Go to Mutex.Unlock") + +```None +func (m *Mutex) Unlock() +``` + +Unlock unlocks m. +It is a run-time error if m is not locked on entry to Unlock. + +A locked [Mutex](#Mutex) is not associated with a particular goroutine. +It is allowed for one goroutine to lock a Mutex and then +arrange for another goroutine to unlock it. + +#### type [Once](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/once.go;l=20) [¶](#Once "Go to Once") + +```None +type Once struct { + // contains filtered or unexported fields +} +``` + +Once is an object that will perform exactly one action. + +A Once must not be copied after first use. + +In the terminology of [the Go memory model](https://go.dev/ref/mem), +the return from f “synchronizes before” +the return from any call of once.Do(f). + +Example [¶](#example-Once "Go to Example") + +```None +package main + +import ( + "fmt" + "sync" +) + +func main() { + var once sync.Once + onceBody := func() { + fmt.Println("Only once") + } + done := make(chan bool) + for i := 0; i < 10; i++ { + go func() { + once.Do(onceBody) + done <- true + }() + } + for i := 0; i < 10; i++ { + <-done + } +} +``` + +```None +Output: + +Only once +``` + +Share +Format +Run + +#### func (\*Once) [Do](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/once.go;l=50) [¶](#Once.Do "Go to Once.Do") + +```None +func (o *Once) Do(f func()) +``` + +Do calls the function f if and only if Do is being called for the +first time for this instance of [Once](#Once). In other words, given + +```None +var once Once +``` + +if once.Do(f) is called multiple times, only the first call will invoke f, +even if f has a different value in each invocation. A new instance of +Once is required for each function to execute. + +Do is intended for initialization that must be run exactly once. Since f +is niladic, it may be necessary to use a function literal to capture the +arguments to a function to be invoked by Do: + +```None +config.once.Do(func() { config.init(filename) }) +``` + +Because no call to Do returns until the one call to f returns, if f causes +Do to be called, it will deadlock. + +If f panics, Do considers it to have returned; future calls of Do return +without calling f. + +#### type [Pool](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/pool.go;l=51) [¶](#Pool "Go to Pool") added in go1.3 + +```None +type Pool struct { + + // New optionally specifies a function to generate + // a value when Get would otherwise return nil. + // It may not be changed concurrently with calls to Get. + New func() any + // contains filtered or unexported fields +} +``` + +A Pool is a set of temporary objects that may be individually saved and +retrieved. + +Any item stored in the Pool may be removed automatically at any time without +notification. If the Pool holds the only reference when this happens, the +item might be deallocated. + +A Pool is safe for use by multiple goroutines simultaneously. + +Pool's purpose is to cache allocated but unused items for later reuse, +relieving pressure on the garbage collector. That is, it makes it easy to +build efficient, thread-safe free lists. However, it is not suitable for all +free lists. + +An appropriate use of a Pool is to manage a group of temporary items +silently shared among and potentially reused by concurrent independent +clients of a package. Pool provides a way to amortize allocation overhead +across many clients. + +An example of good use of a Pool is in the fmt package, which maintains a +dynamically-sized store of temporary output buffers. The store scales under +load (when many goroutines are actively printing) and shrinks when +quiescent. + +On the other hand, a free list maintained as part of a short-lived object is +not a suitable use for a Pool, since the overhead does not amortize well in +that scenario. It is more efficient to have such objects implement their own +free list. + +A Pool must not be copied after first use. + +In the terminology of [the Go memory model](https://go.dev/ref/mem), a call to Put(x) “synchronizes before” +a call to [Pool.Get](#Pool.Get) returning that same value x. +Similarly, a call to New returning x “synchronizes before” +a call to Get returning that same value x. + +Example [¶](#example-Pool "Go to Example") + +```None +package main + +import ( + "bytes" + "io" + "os" + "sync" + "time" +) + +var bufPool = sync.Pool{ + New: func() any { + // The Pool's New function should generally only return pointer + // types, since a pointer can be put into the return interface + // value without an allocation: + return new(bytes.Buffer) + }, +} + +// timeNow is a fake version of time.Now for tests. +func timeNow() time.Time { + return time.Unix(1136214245, 0) +} + +func Log(w io.Writer, key, val string) { + b := bufPool.Get().(*bytes.Buffer) + b.Reset() + // Replace this with time.Now() in a real logger. + b.WriteString(timeNow().UTC().Format(time.RFC3339)) + b.WriteByte(' ') + b.WriteString(key) + b.WriteByte('=') + b.WriteString(val) + w.Write(b.Bytes()) + bufPool.Put(b) +} + +func main() { + Log(os.Stdout, "path", "/search?q=flowers") +} +``` + +```None +Output: + +2006-01-02T15:04:05Z path=/search?q=flowers +``` + +Share +Format +Run + +#### func (\*Pool) [Get](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/pool.go;l=131) [¶](#Pool.Get "Go to Pool.Get") added in go1.3 + +```None +func (p *Pool) Get() any +``` + +Get selects an arbitrary item from the [Pool](#Pool), removes it from the +Pool, and returns it to the caller. +Get may choose to ignore the pool and treat it as empty. +Callers should not assume any relation between values passed to [Pool.Put](#Pool.Put) and +the values returned by Get. + +If Get would otherwise return nil and p.New is non-nil, Get returns +the result of calling p.New. + +#### func (\*Pool) [Put](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/pool.go;l=99) [¶](#Pool.Put "Go to Pool.Put") added in go1.3 + +```None +func (p *Pool) Put(x any) +``` + +Put adds x to the pool. + +#### type [RWMutex](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/rwmutex.go;l=37) [¶](#RWMutex "Go to RWMutex") + +```None +type RWMutex struct { + // contains filtered or unexported fields +} +``` + +A RWMutex is a reader/writer mutual exclusion lock. +The lock can be held by an arbitrary number of readers or a single writer. +The zero value for a RWMutex is an unlocked mutex. + +A RWMutex must not be copied after first use. + +If any goroutine calls [RWMutex.Lock](#RWMutex.Lock) while the lock is already held by +one or more readers, concurrent calls to [RWMutex.RLock](#RWMutex.RLock) will block until +the writer has acquired (and released) the lock, to ensure that +the lock eventually becomes available to the writer. +Note that this prohibits recursive read-locking. + +In the terminology of [the Go memory model](https://go.dev/ref/mem), +the n'th call to [RWMutex.Unlock](#RWMutex.Unlock) “synchronizes before” the m'th call to Lock +for any n < m, just as for [Mutex](#Mutex). +For any call to RLock, there exists an n such that +the n'th call to Unlock “synchronizes before” that call to RLock, +and the corresponding call to [RWMutex.RUnlock](#RWMutex.RUnlock) “synchronizes before” +the n+1'th call to Lock. + +#### func (\*RWMutex) [Lock](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/rwmutex.go;l=142) [¶](#RWMutex.Lock "Go to RWMutex.Lock") + +```None +func (rw *RWMutex) Lock() +``` + +Lock locks rw for writing. +If the lock is already locked for reading or writing, +Lock blocks until the lock is available. + +#### func (\*RWMutex) [RLock](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/rwmutex.go;l=65) [¶](#RWMutex.RLock "Go to RWMutex.RLock") + +```None +func (rw *RWMutex) RLock() +``` + +RLock locks rw for reading. + +It should not be used for recursive read locking; a blocked Lock +call excludes new readers from acquiring the lock. See the +documentation on the [RWMutex](#RWMutex) type. + +#### func (\*RWMutex) [RLocker](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/rwmutex.go;l=238) [¶](#RWMutex.RLocker "Go to RWMutex.RLocker") + +```None +func (rw *RWMutex) RLocker() Locker +``` + +RLocker returns a [Locker](#Locker) interface that implements +the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. + +#### func (\*RWMutex) [RUnlock](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/rwmutex.go;l=112) [¶](#RWMutex.RUnlock "Go to RWMutex.RUnlock") + +```None +func (rw *RWMutex) RUnlock() +``` + +RUnlock undoes a single [RWMutex.RLock](#RWMutex.RLock) call; +it does not affect other simultaneous readers. +It is a run-time error if rw is not locked for reading +on entry to RUnlock. + +#### func (\*RWMutex) [TryLock](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/rwmutex.go;l=167) [¶](#RWMutex.TryLock "Go to RWMutex.TryLock") added in go1.18 + +```None +func (rw *RWMutex) TryLock() bool +``` + +TryLock tries to lock rw for writing and reports whether it succeeded. + +Note that while correct uses of TryLock do exist, they are rare, +and use of TryLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*RWMutex) [TryRLock](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/rwmutex.go;l=85) [¶](#RWMutex.TryRLock "Go to RWMutex.TryRLock") added in go1.18 + +```None +func (rw *RWMutex) TryRLock() bool +``` + +TryRLock tries to lock rw for reading and reports whether it succeeded. + +Note that while correct uses of TryRLock do exist, they are rare, +and use of TryRLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*RWMutex) [Unlock](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/rwmutex.go;l=199) [¶](#RWMutex.Unlock "Go to RWMutex.Unlock") + +```None +func (rw *RWMutex) Unlock() +``` + +Unlock unlocks rw for writing. It is a run-time error if rw is +not locked for writing on entry to Unlock. + +As with Mutexes, a locked [RWMutex](#RWMutex) is not associated with a particular +goroutine. One goroutine may [RWMutex.RLock](#RWMutex.RLock) ([RWMutex.Lock](#RWMutex.Lock)) a RWMutex and then +arrange for another goroutine to [RWMutex.RUnlock](#RWMutex.RUnlock) ([RWMutex.Unlock](#RWMutex.Unlock)) it. + +#### type [WaitGroup](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/waitgroup.go;l=25) [¶](#WaitGroup "Go to WaitGroup") + +```None +type WaitGroup struct { + // contains filtered or unexported fields +} +``` + +A WaitGroup waits for a collection of goroutines to finish. +The main goroutine calls [WaitGroup.Add](#WaitGroup.Add) to set the number of +goroutines to wait for. Then each of the goroutines +runs and calls [WaitGroup.Done](#WaitGroup.Done) when finished. At the same time, +[WaitGroup.Wait](#WaitGroup.Wait) can be used to block until all goroutines have finished. + +A WaitGroup must not be copied after first use. + +In the terminology of [the Go memory model](https://go.dev/ref/mem), a call to [WaitGroup.Done](#WaitGroup.Done) +“synchronizes before” the return of any Wait call that it unblocks. + +Example [¶](#example-WaitGroup "Go to Example") + +This example fetches several URLs concurrently, +using a WaitGroup to block until all the fetches are complete. + +```None +package main + +import ( + "sync" +) + +type httpPkg struct{} + +func (httpPkg) Get(url string) {} + +var http httpPkg + +func main() { + var wg sync.WaitGroup + var urls = []string{ + "http://www.golang.org/", + "http://www.google.com/", + "http://www.example.com/", + } + for _, url := range urls { + // Increment the WaitGroup counter. + wg.Add(1) + // Launch a goroutine to fetch the URL. + go func(url string) { + // Decrement the counter when the goroutine completes. + defer wg.Done() + // Fetch the URL. + http.Get(url) + }(url) + } + // Wait for all HTTP fetches to complete. + wg.Wait() +} +``` + +Share +Format +Run + +#### func (\*WaitGroup) [Add](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/waitgroup.go;l=45) [¶](#WaitGroup.Add "Go to WaitGroup.Add") + +```None +func (wg *WaitGroup) Add(delta int) +``` + +Add adds delta, which may be negative, to the [WaitGroup](#WaitGroup) counter. +If the counter becomes zero, all goroutines blocked on [WaitGroup.Wait](#WaitGroup.Wait) are released. +If the counter goes negative, Add panics. + +Note that calls with a positive delta that occur when the counter is zero +must happen before a Wait. Calls with a negative delta, or calls with a +positive delta that start when the counter is greater than zero, may happen +at any time. +Typically this means the calls to Add should execute before the statement +creating the goroutine or other event to be waited for. +If a WaitGroup is reused to wait for several independent sets of events, +new Add calls must happen after all previous Wait calls have returned. +See the WaitGroup example. + +#### func (\*WaitGroup) [Done](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/waitgroup.go;l=88) [¶](#WaitGroup.Done "Go to WaitGroup.Done") + +```None +func (wg *WaitGroup) Done() +``` + +Done decrements the [WaitGroup](#WaitGroup) counter by one. + +#### func (\*WaitGroup) [Wait](https://cs.opensource.google/go/go/+/go1.23.0:src/sync/waitgroup.go;l=93) [¶](#WaitGroup.Wait "Go to WaitGroup.Wait") + +```None +func (wg *WaitGroup) Wait() +``` + +Wait blocks until the [WaitGroup](#WaitGroup) counter is zero. diff --git a/corpus/docs/golang/sync/sync_go1240.md b/corpus/docs/golang/sync/sync_go1240.md new file mode 100644 index 0000000000000000000000000000000000000000..f6c3f183f29c0c71641614703c5b47c744e44039 --- /dev/null +++ b/corpus/docs/golang/sync/sync_go1240.md @@ -0,0 +1,919 @@ +# Golang - sync + +Source: https://pkg.go.dev/sync@go1.24.0 +Version: go1.24.0 + +## Documentation [¶](#section-documentation "Go to Documentation") + +### Overview [¶](#pkg-overview "Go to Overview") + +Package sync provides basic synchronization primitives such as mutual +exclusion locks. Other than the [Once](#Once) and [WaitGroup](#WaitGroup) types, most are intended +for use by low-level library routines. Higher-level synchronization is +better done via channels and communication. + +Values containing the types defined in this package should not be copied. + +### Index [¶](#pkg-index "Go to Index") + +* [func OnceFunc(f func()) func()](#OnceFunc) +* [func OnceValue[T any](f func() T) func() T](#OnceValue) +* [func OnceValues[T1, T2 any](f func() (T1, T2)) func() (T1, T2)](#OnceValues) +* [type Cond](#Cond) +* + [func NewCond(l Locker) \*Cond](#NewCond) +* + [func (c \*Cond) Broadcast()](#Cond.Broadcast) + + [func (c \*Cond) Signal()](#Cond.Signal) + + [func (c \*Cond) Wait()](#Cond.Wait) +* [type Locker](#Locker) +* [type Map](#Map) +* + [func (m \*Map) Clear()](#Map.Clear) + + [func (m \*Map) CompareAndDelete(key, old any) (deleted bool)](#Map.CompareAndDelete) + + [func (m \*Map) CompareAndSwap(key, old, new any) (swapped bool)](#Map.CompareAndSwap) + + [func (m \*Map) Delete(key any)](#Map.Delete) + + [func (m \*Map) Load(key any) (value any, ok bool)](#Map.Load) + + [func (m \*Map) LoadAndDelete(key any) (value any, loaded bool)](#Map.LoadAndDelete) + + [func (m \*Map) LoadOrStore(key, value any) (actual any, loaded bool)](#Map.LoadOrStore) + + [func (m \*Map) Range(f func(key, value any) bool)](#Map.Range) + + [func (m \*Map) Store(key, value any)](#Map.Store) + + [func (m \*Map) Swap(key, value any) (previous any, loaded bool)](#Map.Swap) +* [type Mutex](#Mutex) +* + [func (m \*Mutex) Lock()](#Mutex.Lock) + + [func (m \*Mutex) TryLock() bool](#Mutex.TryLock) + + [func (m \*Mutex) Unlock()](#Mutex.Unlock) +* [type Once](#Once) +* + [func (o \*Once) Do(f func())](#Once.Do) +* [type Pool](#Pool) +* + [func (p \*Pool) Get() any](#Pool.Get) + + [func (p \*Pool) Put(x any)](#Pool.Put) +* [type RWMutex](#RWMutex) +* + [func (rw \*RWMutex) Lock()](#RWMutex.Lock) + + [func (rw \*RWMutex) RLock()](#RWMutex.RLock) + + [func (rw \*RWMutex) RLocker() Locker](#RWMutex.RLocker) + + [func (rw \*RWMutex) RUnlock()](#RWMutex.RUnlock) + + [func (rw \*RWMutex) TryLock() bool](#RWMutex.TryLock) + + [func (rw \*RWMutex) TryRLock() bool](#RWMutex.TryRLock) + + [func (rw \*RWMutex) Unlock()](#RWMutex.Unlock) +* [type WaitGroup](#WaitGroup) +* + [func (wg \*WaitGroup) Add(delta int)](#WaitGroup.Add) + + [func (wg \*WaitGroup) Done()](#WaitGroup.Done) + + [func (wg \*WaitGroup) Wait()](#WaitGroup.Wait) + +### Examples [¶](#pkg-examples "Go to Examples") + +* [Once](#example-Once) +* [OnceValue](#example-OnceValue) +* [OnceValues](#example-OnceValues) +* [Pool](#example-Pool) +* [WaitGroup](#example-WaitGroup) + +### Constants [¶](#pkg-constants "Go to Constants") + +This section is empty. + +### Variables [¶](#pkg-variables "Go to Variables") + +This section is empty. + +### Functions [¶](#pkg-functions "Go to Functions") + +#### func [OnceFunc](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/oncefunc.go;l=11) [¶](#OnceFunc "Go to OnceFunc") added in go1.21.0 + +```None +func OnceFunc(f func()) func() +``` + +OnceFunc returns a function that invokes f only once. The returned function +may be called concurrently. + +If f panics, the returned function will panic with the same value on every call. + +#### func [OnceValue](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/oncefunc.go;l=43) [¶](#OnceValue "Go to OnceValue") added in go1.21.0 + +```None +func OnceValue[T any](f func() T) func() T +``` + +OnceValue returns a function that invokes f only once and returns the value +returned by f. The returned function may be called concurrently. + +If f panics, the returned function will panic with the same value on every call. + +Example [¶](#example-OnceValue "Go to Example") + +This example uses OnceValue to perform an "expensive" computation just once, +even when used concurrently. + +```None +package main + +import ( + "fmt" + "sync" +) + +func main() { + once := sync.OnceValue(func() int { + sum := 0 + for i := 0; i < 1000; i++ { + sum += i + } + fmt.Println("Computed once:", sum) + return sum + }) + done := make(chan bool) + for i := 0; i < 10; i++ { + go func() { + const want = 499500 + got := once() + if got != want { + fmt.Println("want", want, "got", got) + } + done <- true + }() + } + for i := 0; i < 10; i++ { + <-done + } +} +``` + +```None +Output: + +Computed once: 499500 +``` + +Share +Format +Run + +#### func [OnceValues](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/oncefunc.go;l=74) [¶](#OnceValues "Go to OnceValues") added in go1.21.0 + +```None +func OnceValues[T1, T2 any](f func() (T1, T2)) func() (T1, T2) +``` + +OnceValues returns a function that invokes f only once and returns the values +returned by f. The returned function may be called concurrently. + +If f panics, the returned function will panic with the same value on every call. + +Example [¶](#example-OnceValues "Go to Example") + +This example uses OnceValues to read a file just once. + +```None +package main + +import ( + "fmt" + "os" + "sync" +) + +func main() { + once := sync.OnceValues(func() ([]byte, error) { + fmt.Println("Reading file once") + return os.ReadFile("example_test.go") + }) + done := make(chan bool) + for i := 0; i < 10; i++ { + go func() { + data, err := once() + if err != nil { + fmt.Println("error:", err) + } + _ = data // Ignore the data for this example + done <- true + }() + } + for i := 0; i < 10; i++ { + <-done + } +} +``` + +```None +Output: + +Reading file once +``` + +Share +Format +Run + +### Types [¶](#pkg-types "Go to Types") + +#### type [Cond](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/cond.go;l=37) [¶](#Cond "Go to Cond") + +```None +type Cond struct { + + // L is held while observing or changing the condition + L Locker + // contains filtered or unexported fields +} +``` + +Cond implements a condition variable, a rendezvous point +for goroutines waiting for or announcing the occurrence +of an event. + +Each Cond has an associated Locker L (often a [\*Mutex](#Mutex) or [\*RWMutex](#RWMutex)), +which must be held when changing the condition and +when calling the [Cond.Wait](#Cond.Wait) method. + +A Cond must not be copied after first use. + +In the terminology of [the Go memory model](https://go.dev/ref/mem), Cond arranges that +a call to [Cond.Broadcast](#Cond.Broadcast) or [Cond.Signal](#Cond.Signal) “synchronizes before” any Wait call +that it unblocks. + +For many simple use cases, users will be better off using channels than a +Cond (Broadcast corresponds to closing a channel, and Signal corresponds to +sending on a channel). + +For more on replacements for [sync.Cond](#Cond), see [Roberto Clapis's series on +advanced concurrency patterns](https://blogtitle.github.io/categories/concurrency/), as well as [Bryan Mills's talk on concurrency +patterns](https://drive.google.com/file/d/1nPdvhB0PutEJzdCq5ms6UI58dp50fcAN/view). + +#### func [NewCond](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/cond.go;l=48) [¶](#NewCond "Go to NewCond") + +```None +func NewCond(l Locker) *Cond +``` + +NewCond returns a new Cond with Locker l. + +#### func (\*Cond) [Broadcast](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/cond.go;l=91) [¶](#Cond.Broadcast "Go to Cond.Broadcast") + +```None +func (c *Cond) Broadcast() +``` + +Broadcast wakes all goroutines waiting on c. + +It is allowed but not required for the caller to hold c.L +during the call. + +#### func (\*Cond) [Signal](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/cond.go;l=82) [¶](#Cond.Signal "Go to Cond.Signal") + +```None +func (c *Cond) Signal() +``` + +Signal wakes one goroutine waiting on c, if there is any. + +It is allowed but not required for the caller to hold c.L +during the call. + +Signal() does not affect goroutine scheduling priority; if other goroutines +are attempting to lock c.L, they may be awoken before a "waiting" goroutine. + +#### func (\*Cond) [Wait](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/cond.go;l=67) [¶](#Cond.Wait "Go to Cond.Wait") + +```None +func (c *Cond) Wait() +``` + +Wait atomically unlocks c.L and suspends execution +of the calling goroutine. After later resuming execution, +Wait locks c.L before returning. Unlike in other systems, +Wait cannot return unless awoken by [Cond.Broadcast](#Cond.Broadcast) or [Cond.Signal](#Cond.Signal). + +Because c.L is not locked while Wait is waiting, the caller +typically cannot assume that the condition is true when +Wait returns. Instead, the caller should Wait in a loop: + +```None +c.L.Lock() +for !condition() { + c.Wait() +} +... make use of condition ... +c.L.Unlock() +``` + +#### type [Locker](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/mutex.go;l=37) [¶](#Locker "Go to Locker") + +```None +type Locker interface { + Lock() + Unlock() +} +``` + +A Locker represents an object that can be locked and unlocked. + +#### type [Map](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/map.go;l=40) [¶](#Map "Go to Map") added in go1.9 + +```None +type Map struct { + // contains filtered or unexported fields +} +``` + +Map is like a Go map[any]any but is safe for concurrent use +by multiple goroutines without additional locking or coordination. +Loads, stores, and deletes run in amortized constant time. + +The Map type is specialized. Most code should use a plain Go map instead, +with separate locking or coordination, for better type safety and to make it +easier to maintain other invariants along with the map content. + +The Map type is optimized for two common use cases: (1) when the entry for a given +key is only ever written once but read many times, as in caches that only grow, +or (2) when multiple goroutines read, write, and overwrite entries for disjoint +sets of keys. In these two cases, use of a Map may significantly reduce lock +contention compared to a Go map paired with a separate [Mutex](#Mutex) or [RWMutex](#RWMutex). + +The zero Map is empty and ready for use. A Map must not be copied after first use. + +In the terminology of [the Go memory model](https://go.dev/ref/mem), Map arranges that a write operation +“synchronizes before” any read operation that observes the effect of the write, where +read and write operations are defined as follows. +[Map.Load](#Map.Load), [Map.LoadAndDelete](#Map.LoadAndDelete), [Map.LoadOrStore](#Map.LoadOrStore), [Map.Swap](#Map.Swap), [Map.CompareAndSwap](#Map.CompareAndSwap), +and [Map.CompareAndDelete](#Map.CompareAndDelete) are read operations; +[Map.Delete](#Map.Delete), [Map.LoadAndDelete](#Map.LoadAndDelete), [Map.Store](#Map.Store), and [Map.Swap](#Map.Swap) are write operations; +[Map.LoadOrStore](#Map.LoadOrStore) is a write operation when it returns loaded set to false; +[Map.CompareAndSwap](#Map.CompareAndSwap) is a write operation when it returns swapped set to true; +and [Map.CompareAndDelete](#Map.CompareAndDelete) is a write operation when it returns deleted set to true. + +#### func (\*Map) [Clear](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/map.go;l=166) [¶](#Map.Clear "Go to Map.Clear") added in go1.23.0 + +```None +func (m *Map) Clear() +``` + +Clear deletes all the entries, resulting in an empty Map. + +#### func (\*Map) [CompareAndDelete](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/map.go;l=434) [¶](#Map.CompareAndDelete "Go to Map.CompareAndDelete") added in go1.20 + +```None +func (m *Map) CompareAndDelete(key, old any) (deleted bool) +``` + +CompareAndDelete deletes the entry for key if its value is equal to old. +The old value must be of a comparable type. + +If there is no current value for key in the map, CompareAndDelete +returns false (even if the old value is the nil interface value). + +#### func (\*Map) [CompareAndSwap](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/map.go;l=402) [¶](#Map.CompareAndSwap "Go to Map.CompareAndSwap") added in go1.20 + +```None +func (m *Map) CompareAndSwap(key, old, new any) (swapped bool) +``` + +CompareAndSwap swaps the old and new values for key +if the value stored in the map is equal to old. +The old value must be of a comparable type. + +#### func (\*Map) [Delete](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/map.go;l=324) [¶](#Map.Delete "Go to Map.Delete") added in go1.9 + +```None +func (m *Map) Delete(key any) +``` + +Delete deletes the value for a key. + +#### func (\*Map) [Load](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/map.go;l=127) [¶](#Map.Load "Go to Map.Load") added in go1.9 + +```None +func (m *Map) Load(key any) (value any, ok bool) +``` + +Load returns the value stored in the map for a key, or nil if no +value is present. +The ok result indicates whether value was found in the map. + +#### func (\*Map) [LoadAndDelete](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/map.go;l=300) [¶](#Map.LoadAndDelete "Go to Map.LoadAndDelete") added in go1.15 + +```None +func (m *Map) LoadAndDelete(key any) (value any, loaded bool) +``` + +LoadAndDelete deletes the value for a key, returning the previous value if any. +The loaded result reports whether the key was present. + +#### func (\*Map) [LoadOrStore](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/map.go;l=231) [¶](#Map.LoadOrStore "Go to Map.LoadOrStore") added in go1.9 + +```None +func (m *Map) LoadOrStore(key, value any) (actual any, loaded bool) +``` + +LoadOrStore returns the existing value for the key if present. +Otherwise, it stores and returns the given value. +The loaded result is true if the value was loaded, false if stored. + +#### func (\*Map) [Range](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/map.go;l=477) [¶](#Map.Range "Go to Map.Range") added in go1.9 + +```None +func (m *Map) Range(f func(key, value any) bool) +``` + +Range calls f sequentially for each key and value present in the map. +If f returns false, range stops the iteration. + +Range does not necessarily correspond to any consistent snapshot of the Map's +contents: no key will be visited more than once, but if the value for any key +is stored or deleted concurrently (including by f), Range may reflect any +mapping for that key from any point during the Range call. Range does not +block other methods on the receiver; even f itself may call any method on m. + +Range may be O(N) with the number of elements in the map even if f returns +false after a constant number of calls. + +#### func (\*Map) [Store](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/map.go;l=161) [¶](#Map.Store "Go to Map.Store") added in go1.9 + +```None +func (m *Map) Store(key, value any) +``` + +Store sets the value for a key. + +#### func (\*Map) [Swap](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/map.go;l=358) [¶](#Map.Swap "Go to Map.Swap") added in go1.20 + +```None +func (m *Map) Swap(key, value any) (previous any, loaded bool) +``` + +Swap swaps the value for a key and returns the previous value if any. +The loaded result reports whether the key was present. + +#### type [Mutex](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/mutex.go;l=30) [¶](#Mutex "Go to Mutex") + +```None +type Mutex struct { + // contains filtered or unexported fields +} +``` + +A Mutex is a mutual exclusion lock. +The zero value for a Mutex is an unlocked mutex. + +A Mutex must not be copied after first use. + +In the terminology of [the Go memory model](https://go.dev/ref/mem), +the n'th call to [Mutex.Unlock](#Mutex.Unlock) “synchronizes before” the m'th call to [Mutex.Lock](#Mutex.Lock) +for any n < m. +A successful call to [Mutex.TryLock](#Mutex.TryLock) is equivalent to a call to Lock. +A failed call to TryLock does not establish any “synchronizes before” +relation at all. + +#### func (\*Mutex) [Lock](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/mutex.go;l=45) [¶](#Mutex.Lock "Go to Mutex.Lock") + +```None +func (m *Mutex) Lock() +``` + +Lock locks m. +If the lock is already in use, the calling goroutine +blocks until the mutex is available. + +#### func (\*Mutex) [TryLock](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/mutex.go;l=54) [¶](#Mutex.TryLock "Go to Mutex.TryLock") added in go1.18 + +```None +func (m *Mutex) TryLock() bool +``` + +TryLock tries to lock m and reports whether it succeeded. + +Note that while correct uses of TryLock do exist, they are rare, +and use of TryLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*Mutex) [Unlock](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/mutex.go;l=64) [¶](#Mutex.Unlock "Go to Mutex.Unlock") + +```None +func (m *Mutex) Unlock() +``` + +Unlock unlocks m. +It is a run-time error if m is not locked on entry to Unlock. + +A locked [Mutex](#Mutex) is not associated with a particular goroutine. +It is allowed for one goroutine to lock a Mutex and then +arrange for another goroutine to unlock it. + +#### type [Once](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/once.go;l=20) [¶](#Once "Go to Once") + +```None +type Once struct { + // contains filtered or unexported fields +} +``` + +Once is an object that will perform exactly one action. + +A Once must not be copied after first use. + +In the terminology of [the Go memory model](https://go.dev/ref/mem), +the return from f “synchronizes before” +the return from any call of once.Do(f). + +Example [¶](#example-Once "Go to Example") + +```None +package main + +import ( + "fmt" + "sync" +) + +func main() { + var once sync.Once + onceBody := func() { + fmt.Println("Only once") + } + done := make(chan bool) + for i := 0; i < 10; i++ { + go func() { + once.Do(onceBody) + done <- true + }() + } + for i := 0; i < 10; i++ { + <-done + } +} +``` + +```None +Output: + +Only once +``` + +Share +Format +Run + +#### func (\*Once) [Do](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/once.go;l=52) [¶](#Once.Do "Go to Once.Do") + +```None +func (o *Once) Do(f func()) +``` + +Do calls the function f if and only if Do is being called for the +first time for this instance of [Once](#Once). In other words, given + +```None +var once Once +``` + +if once.Do(f) is called multiple times, only the first call will invoke f, +even if f has a different value in each invocation. A new instance of +Once is required for each function to execute. + +Do is intended for initialization that must be run exactly once. Since f +is niladic, it may be necessary to use a function literal to capture the +arguments to a function to be invoked by Do: + +```None +config.once.Do(func() { config.init(filename) }) +``` + +Because no call to Do returns until the one call to f returns, if f causes +Do to be called, it will deadlock. + +If f panics, Do considers it to have returned; future calls of Do return +without calling f. + +#### type [Pool](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/pool.go;l=51) [¶](#Pool "Go to Pool") added in go1.3 + +```None +type Pool struct { + + // New optionally specifies a function to generate + // a value when Get would otherwise return nil. + // It may not be changed concurrently with calls to Get. + New func() any + // contains filtered or unexported fields +} +``` + +A Pool is a set of temporary objects that may be individually saved and +retrieved. + +Any item stored in the Pool may be removed automatically at any time without +notification. If the Pool holds the only reference when this happens, the +item might be deallocated. + +A Pool is safe for use by multiple goroutines simultaneously. + +Pool's purpose is to cache allocated but unused items for later reuse, +relieving pressure on the garbage collector. That is, it makes it easy to +build efficient, thread-safe free lists. However, it is not suitable for all +free lists. + +An appropriate use of a Pool is to manage a group of temporary items +silently shared among and potentially reused by concurrent independent +clients of a package. Pool provides a way to amortize allocation overhead +across many clients. + +An example of good use of a Pool is in the fmt package, which maintains a +dynamically-sized store of temporary output buffers. The store scales under +load (when many goroutines are actively printing) and shrinks when +quiescent. + +On the other hand, a free list maintained as part of a short-lived object is +not a suitable use for a Pool, since the overhead does not amortize well in +that scenario. It is more efficient to have such objects implement their own +free list. + +A Pool must not be copied after first use. + +In the terminology of [the Go memory model](https://go.dev/ref/mem), a call to Put(x) “synchronizes before” +a call to [Pool.Get](#Pool.Get) returning that same value x. +Similarly, a call to New returning x “synchronizes before” +a call to Get returning that same value x. + +Example [¶](#example-Pool "Go to Example") + +```None +package main + +import ( + "bytes" + "io" + "os" + "sync" + "time" +) + +var bufPool = sync.Pool{ + New: func() any { + // The Pool's New function should generally only return pointer + // types, since a pointer can be put into the return interface + // value without an allocation: + return new(bytes.Buffer) + }, +} + +// timeNow is a fake version of time.Now for tests. +func timeNow() time.Time { + return time.Unix(1136214245, 0) +} + +func Log(w io.Writer, key, val string) { + b := bufPool.Get().(*bytes.Buffer) + b.Reset() + // Replace this with time.Now() in a real logger. + b.WriteString(timeNow().UTC().Format(time.RFC3339)) + b.WriteByte(' ') + b.WriteString(key) + b.WriteByte('=') + b.WriteString(val) + w.Write(b.Bytes()) + bufPool.Put(b) +} + +func main() { + Log(os.Stdout, "path", "/search?q=flowers") +} +``` + +```None +Output: + +2006-01-02T15:04:05Z path=/search?q=flowers +``` + +Share +Format +Run + +#### func (\*Pool) [Get](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/pool.go;l=131) [¶](#Pool.Get "Go to Pool.Get") added in go1.3 + +```None +func (p *Pool) Get() any +``` + +Get selects an arbitrary item from the [Pool](#Pool), removes it from the +Pool, and returns it to the caller. +Get may choose to ignore the pool and treat it as empty. +Callers should not assume any relation between values passed to [Pool.Put](#Pool.Put) and +the values returned by Get. + +If Get would otherwise return nil and p.New is non-nil, Get returns +the result of calling p.New. + +#### func (\*Pool) [Put](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/pool.go;l=99) [¶](#Pool.Put "Go to Pool.Put") added in go1.3 + +```None +func (p *Pool) Put(x any) +``` + +Put adds x to the pool. + +#### type [RWMutex](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/rwmutex.go;l=39) [¶](#RWMutex "Go to RWMutex") + +```None +type RWMutex struct { + // contains filtered or unexported fields +} +``` + +A RWMutex is a reader/writer mutual exclusion lock. +The lock can be held by an arbitrary number of readers or a single writer. +The zero value for a RWMutex is an unlocked mutex. + +A RWMutex must not be copied after first use. + +If any goroutine calls [RWMutex.Lock](#RWMutex.Lock) while the lock is already held by +one or more readers, concurrent calls to [RWMutex.RLock](#RWMutex.RLock) will block until +the writer has acquired (and released) the lock, to ensure that +the lock eventually becomes available to the writer. +Note that this prohibits recursive read-locking. +A [RWMutex.RLock](#RWMutex.RLock) cannot be upgraded into a [RWMutex.Lock](#RWMutex.Lock), +nor can a [RWMutex.Lock](#RWMutex.Lock) be downgraded into a [RWMutex.RLock](#RWMutex.RLock). + +In the terminology of [the Go memory model](https://go.dev/ref/mem), +the n'th call to [RWMutex.Unlock](#RWMutex.Unlock) “synchronizes before” the m'th call to Lock +for any n < m, just as for [Mutex](#Mutex). +For any call to RLock, there exists an n such that +the n'th call to Unlock “synchronizes before” that call to RLock, +and the corresponding call to [RWMutex.RUnlock](#RWMutex.RUnlock) “synchronizes before” +the n+1'th call to Lock. + +#### func (\*RWMutex) [Lock](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/rwmutex.go;l=144) [¶](#RWMutex.Lock "Go to RWMutex.Lock") + +```None +func (rw *RWMutex) Lock() +``` + +Lock locks rw for writing. +If the lock is already locked for reading or writing, +Lock blocks until the lock is available. + +#### func (\*RWMutex) [RLock](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/rwmutex.go;l=67) [¶](#RWMutex.RLock "Go to RWMutex.RLock") + +```None +func (rw *RWMutex) RLock() +``` + +RLock locks rw for reading. + +It should not be used for recursive read locking; a blocked Lock +call excludes new readers from acquiring the lock. See the +documentation on the [RWMutex](#RWMutex) type. + +#### func (\*RWMutex) [RLocker](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/rwmutex.go;l=240) [¶](#RWMutex.RLocker "Go to RWMutex.RLocker") + +```None +func (rw *RWMutex) RLocker() Locker +``` + +RLocker returns a [Locker](#Locker) interface that implements +the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. + +#### func (\*RWMutex) [RUnlock](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/rwmutex.go;l=114) [¶](#RWMutex.RUnlock "Go to RWMutex.RUnlock") + +```None +func (rw *RWMutex) RUnlock() +``` + +RUnlock undoes a single [RWMutex.RLock](#RWMutex.RLock) call; +it does not affect other simultaneous readers. +It is a run-time error if rw is not locked for reading +on entry to RUnlock. + +#### func (\*RWMutex) [TryLock](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/rwmutex.go;l=169) [¶](#RWMutex.TryLock "Go to RWMutex.TryLock") added in go1.18 + +```None +func (rw *RWMutex) TryLock() bool +``` + +TryLock tries to lock rw for writing and reports whether it succeeded. + +Note that while correct uses of TryLock do exist, they are rare, +and use of TryLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*RWMutex) [TryRLock](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/rwmutex.go;l=87) [¶](#RWMutex.TryRLock "Go to RWMutex.TryRLock") added in go1.18 + +```None +func (rw *RWMutex) TryRLock() bool +``` + +TryRLock tries to lock rw for reading and reports whether it succeeded. + +Note that while correct uses of TryRLock do exist, they are rare, +and use of TryRLock is often a sign of a deeper problem +in a particular use of mutexes. + +#### func (\*RWMutex) [Unlock](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/rwmutex.go;l=201) [¶](#RWMutex.Unlock "Go to RWMutex.Unlock") + +```None +func (rw *RWMutex) Unlock() +``` + +Unlock unlocks rw for writing. It is a run-time error if rw is +not locked for writing on entry to Unlock. + +As with Mutexes, a locked [RWMutex](#RWMutex) is not associated with a particular +goroutine. One goroutine may [RWMutex.RLock](#RWMutex.RLock) ([RWMutex.Lock](#RWMutex.Lock)) a RWMutex and then +arrange for another goroutine to [RWMutex.RUnlock](#RWMutex.RUnlock) ([RWMutex.Unlock](#RWMutex.Unlock)) it. + +#### type [WaitGroup](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/waitgroup.go;l=25) [¶](#WaitGroup "Go to WaitGroup") + +```None +type WaitGroup struct { + // contains filtered or unexported fields +} +``` + +A WaitGroup waits for a collection of goroutines to finish. +The main goroutine calls [WaitGroup.Add](#WaitGroup.Add) to set the number of +goroutines to wait for. Then each of the goroutines +runs and calls [WaitGroup.Done](#WaitGroup.Done) when finished. At the same time, +[WaitGroup.Wait](#WaitGroup.Wait) can be used to block until all goroutines have finished. + +A WaitGroup must not be copied after first use. + +In the terminology of [the Go memory model](https://go.dev/ref/mem), a call to [WaitGroup.Done](#WaitGroup.Done) +“synchronizes before” the return of any Wait call that it unblocks. + +Example [¶](#example-WaitGroup "Go to Example") + +This example fetches several URLs concurrently, +using a WaitGroup to block until all the fetches are complete. + +```None +package main + +import ( + "sync" +) + +type httpPkg struct{} + +func (httpPkg) Get(url string) {} + +var http httpPkg + +func main() { + var wg sync.WaitGroup + var urls = []string{ + "http://www.golang.org/", + "http://www.google.com/", + "http://www.example.com/", + } + for _, url := range urls { + // Increment the WaitGroup counter. + wg.Add(1) + // Launch a goroutine to fetch the URL. + go func(url string) { + // Decrement the counter when the goroutine completes. + defer wg.Done() + // Fetch the URL. + http.Get(url) + }(url) + } + // Wait for all HTTP fetches to complete. + wg.Wait() +} +``` + +Share +Format +Run + +#### func (\*WaitGroup) [Add](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/waitgroup.go;l=45) [¶](#WaitGroup.Add "Go to WaitGroup.Add") + +```None +func (wg *WaitGroup) Add(delta int) +``` + +Add adds delta, which may be negative, to the [WaitGroup](#WaitGroup) counter. +If the counter becomes zero, all goroutines blocked on [WaitGroup.Wait](#WaitGroup.Wait) are released. +If the counter goes negative, Add panics. + +Note that calls with a positive delta that occur when the counter is zero +must happen before a Wait. Calls with a negative delta, or calls with a +positive delta that start when the counter is greater than zero, may happen +at any time. +Typically this means the calls to Add should execute before the statement +creating the goroutine or other event to be waited for. +If a WaitGroup is reused to wait for several independent sets of events, +new Add calls must happen after all previous Wait calls have returned. +See the WaitGroup example. + +#### func (\*WaitGroup) [Done](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/waitgroup.go;l=88) [¶](#WaitGroup.Done "Go to WaitGroup.Done") + +```None +func (wg *WaitGroup) Done() +``` + +Done decrements the [WaitGroup](#WaitGroup) counter by one. + +#### func (\*WaitGroup) [Wait](https://cs.opensource.google/go/go/+/go1.24.0:src/sync/waitgroup.go;l=93) [¶](#WaitGroup.Wait "Go to WaitGroup.Wait") + +```None +func (wg *WaitGroup) Wait() +``` + +Wait blocks until the [WaitGroup](#WaitGroup) counter is zero. diff --git a/corpus/docs/kubernetes/gateway/gateway_v131.md b/corpus/docs/kubernetes/gateway/gateway_v131.md new file mode 100644 index 0000000000000000000000000000000000000000..d2265ff899efed7921ac1790c8839bfc633827d9 --- /dev/null +++ b/corpus/docs/kubernetes/gateway/gateway_v131.md @@ -0,0 +1,224 @@ +# Gateway API + +Source: https://v1-31.docs.kubernetes.io/docs/concepts/services-networking/gateway/ +Version: v1.31 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Concepts](https://kubernetes.io/docs/concepts/) +3. [Services, Load Balancing, and Networking](https://kubernetes.io/docs/concepts/services-networking/) +4. [Gateway API](https://kubernetes.io/docs/concepts/services-networking/gateway/) + +### You are viewing documentation for Kubernetes version: v1.31 + +Kubernetes v1.31 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date information, see the +[latest version.](https://kubernetes.io/docs/home/) + +Gateway API is a family of API kinds that provide dynamic infrastructure provisioning and advanced traffic routing. + +Make network services available by using an extensible, role-oriented, protocol-aware configuration +mechanism. [Gateway API](https://gateway-api.sigs.k8s.io/) is an [add-on](/docs/concepts/cluster-administration/addons/ "Resources that extend the functionality of Kubernetes.") +containing API [kinds](https://gateway-api.sigs.k8s.io/references/spec/) that provide dynamic infrastructure +provisioning and advanced traffic routing. + +## Design principles + +The following principles shaped the design and architecture of Gateway API: + +* **Role-oriented:** Gateway API kinds are modeled after organizational roles that are + responsible for managing Kubernetes service networking: + + **Infrastructure Provider:** Manages infrastructure that allows multiple isolated clusters + to serve multiple tenants, e.g. a cloud provider. + + **Cluster Operator:** Manages clusters and is typically concerned with policies, network + access, application permissions, etc. + + **Application Developer:** Manages an application running in a cluster and is typically + concerned with application-level configuration and [Service](/docs/concepts/services-networking/service/) + composition. +* **Portable:** Gateway API specifications are defined as [custom resources](/docs/concepts/extend-kubernetes/api-extension/custom-resources/) + and are supported by many [implementations](https://gateway-api.sigs.k8s.io/implementations/). +* **Expressive:** Gateway API kinds support functionality for common traffic routing use cases + such as header-based matching, traffic weighting, and others that were only possible in + [Ingress](/docs/concepts/services-networking/ingress/) by using custom annotations. +* **Extensible:** Gateway allows for custom resources to be linked at various layers of the API. + This makes granular customization possible at the appropriate places within the API structure. + +## Resource model + +Gateway API has three stable API kinds: + +* **GatewayClass:** Defines a set of gateways with common configuration and managed by a controller + that implements the class. +* **Gateway:** Defines an instance of traffic handling infrastructure, such as cloud load balancer. +* **HTTPRoute:** Defines HTTP-specific rules for mapping traffic from a Gateway listener to a + representation of backend network endpoints. These endpoints are often represented as a + [Service](/docs/concepts/services-networking/service/ "A way to expose an application running on a set of Pods as a network service."). + +Gateway API is organized into different API kinds that have interdependent relationships to support +the role-oriented nature of organizations. A Gateway object is associated with exactly one GatewayClass; +the GatewayClass describes the gateway controller responsible for managing Gateways of this class. +One or more route kinds such as HTTPRoute, are then associated to Gateways. A Gateway can filter the routes +that may be attached to its `listeners`, forming a bidirectional trust model with routes. + +The following figure illustrates the relationships of the three stable Gateway API kinds: + +![A figure illustrating the relationships of the three stable Gateway API kinds](/docs/images/gateway-kind-relationships.svg) + +### GatewayClass + +Gateways can be implemented by different controllers, often with different configurations. A Gateway +must reference a GatewayClass that contains the name of the controller that implements the +class. + +A minimal GatewayClass example: + +```None +apiVersion: gateway.networking.k8s.io/v1 +kind: GatewayClass +metadata: + name: example-class +spec: + controllerName: example.com/gateway-controller +``` + +In this example, a controller that has implemented Gateway API is configured to manage GatewayClasses +with the controller name `example.com/gateway-controller`. Gateways of this class will be managed by +the implementation's controller. + +See the [GatewayClass](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1.GatewayClass) +reference for a full definition of this API kind. + +### Gateway + +A Gateway describes an instance of traffic handling infrastructure. It defines a network endpoint +that can be used for processing traffic, i.e. filtering, balancing, splitting, etc. for backends +such as a Service. For example, a Gateway may represent a cloud load balancer or an in-cluster proxy +server that is configured to accept HTTP traffic. + +A minimal Gateway resource example: + +```None +apiVersion: gateway.networking.k8s.io/v1 +kind: Gateway +metadata: + name: example-gateway +spec: + gatewayClassName: example-class + listeners: + - name: http + protocol: HTTP + port: 80 +``` + +In this example, an instance of traffic handling infrastructure is programmed to listen for HTTP +traffic on port 80. Since the `addresses` field is unspecified, an address or hostname is assigned +to the Gateway by the implementation's controller. This address is used as a network endpoint for +processing traffic of backend network endpoints defined in routes. + +See the [Gateway](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1.Gateway) +reference for a full definition of this API kind. + +### HTTPRoute + +The HTTPRoute kind specifies routing behavior of HTTP requests from a Gateway listener to backend network +endpoints. For a Service backend, an implementation may represent the backend network endpoint as a Service +IP or the backing Endpoints of the Service. An HTTPRoute represents configuration that is applied to the +underlying Gateway implementation. For example, defining a new HTTPRoute may result in configuring additional +traffic routes in a cloud load balancer or in-cluster proxy server. + +A minimal HTTPRoute example: + +```None +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: example-httproute +spec: + parentRefs: + - name: example-gateway + hostnames: + - "www.example.com" + rules: + - matches: + - path: + type: PathPrefix + value: /login + backendRefs: + - name: example-svc + port: 8080 +``` + +In this example, HTTP traffic from Gateway `example-gateway` with the Host: header set to `www.example.com` +and the request path specified as `/login` will be routed to Service `example-svc` on port `8080`. + +See the [HTTPRoute](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1.HTTPRoute) +reference for a full definition of this API kind. + +## Request flow + +Here is a simple example of HTTP traffic being routed to a Service by using a Gateway and an HTTPRoute: + +![A diagram that provides an example of HTTP traffic being routed to a Service by using a Gateway and an HTTPRoute](/docs/images/gateway-request-flow.svg) + +In this example, the request flow for a Gateway implemented as a reverse proxy is: + +1. The client starts to prepare an HTTP request for the URL `http://www.example.com` +2. The client's DNS resolver queries for the destination name and learns a mapping to + one or more IP addresses associated with the Gateway. +3. The client sends a request to the Gateway IP address; the reverse proxy receives the HTTP + request and uses the Host: header to match a configuration that was derived from the Gateway + and attached HTTPRoute. +4. Optionally, the reverse proxy can perform request header and/or path matching based + on match rules of the HTTPRoute. +5. Optionally, the reverse proxy can modify the request; for example, to add or remove headers, + based on filter rules of the HTTPRoute. +6. Lastly, the reverse proxy forwards the request to one or more backends. + +## Conformance + +Gateway API covers a broad set of features and is widely implemented. This combination requires +clear conformance definitions and tests to ensure that the API provides a consistent experience +wherever it is used. + +See the [conformance](https://gateway-api.sigs.k8s.io/concepts/conformance/) documentation to +understand details such as release channels, support levels, and running conformance tests. + +## Migrating from Ingress + +Gateway API is the successor to the [Ingress](/docs/concepts/services-networking/ingress/) API. +However, it does not include the Ingress kind. As a result, a one-time conversion from your existing +Ingress resources to Gateway API resources is necessary. + +Refer to the [ingress migration](https://gateway-api.sigs.k8s.io/guides/migrating-from-ingress/#migrating-from-ingress) +guide for details on migrating Ingress resources to Gateway API resources. + +## What's next + +Instead of Gateway API resources being natively implemented by Kubernetes, the specifications +are defined as [Custom Resources](/docs/concepts/extend-kubernetes/api-extension/custom-resources/) +supported by a wide range of [implementations](https://gateway-api.sigs.k8s.io/implementations/). +[Install](https://gateway-api.sigs.k8s.io/guides/#installing-gateway-api) the Gateway API CRDs or +follow the installation instructions of your selected implementation. After installing an +implementation, use the [Getting Started](https://gateway-api.sigs.k8s.io/guides/) guide to help +you quickly start working with Gateway API. + +#### Note: + +Make sure to review the documentation of your selected implementation to understand any caveats. + +Refer to the [API specification](https://gateway-api.sigs.k8s.io/reference/spec/) for additional +details of all Gateway API kinds. + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified January 01, 2024 at 9:15 PM PST: [Fix several link errors (8b46ec4047)](https://github.com/kubernetes/website/commit/8b46ec4047d2a928fe608401905d7702acdc3cfd) diff --git a/corpus/docs/kubernetes/gateway/gateway_v132.md b/corpus/docs/kubernetes/gateway/gateway_v132.md new file mode 100644 index 0000000000000000000000000000000000000000..90ac1c5591a52fa2ea18fc1551be4d9a5519f456 --- /dev/null +++ b/corpus/docs/kubernetes/gateway/gateway_v132.md @@ -0,0 +1,224 @@ +# Gateway API + +Source: https://v1-32.docs.kubernetes.io/docs/concepts/services-networking/gateway/ +Version: v1.32 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Concepts](https://kubernetes.io/docs/concepts/) +3. [Services, Load Balancing, and Networking](https://kubernetes.io/docs/concepts/services-networking/) +4. [Gateway API](https://kubernetes.io/docs/concepts/services-networking/gateway/) + +### You are viewing documentation for Kubernetes version: v1.32 + +Kubernetes v1.32 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date information, see the +[latest version.](https://kubernetes.io/docs/home/) + +Gateway API is a family of API kinds that provide dynamic infrastructure provisioning and advanced traffic routing. + +Make network services available by using an extensible, role-oriented, protocol-aware configuration +mechanism. [Gateway API](https://gateway-api.sigs.k8s.io/) is an [add-on](/docs/concepts/cluster-administration/addons/ "Resources that extend the functionality of Kubernetes.") +containing API [kinds](https://gateway-api.sigs.k8s.io/references/spec/) that provide dynamic infrastructure +provisioning and advanced traffic routing. + +## Design principles + +The following principles shaped the design and architecture of Gateway API: + +* **Role-oriented:** Gateway API kinds are modeled after organizational roles that are + responsible for managing Kubernetes service networking: + + **Infrastructure Provider:** Manages infrastructure that allows multiple isolated clusters + to serve multiple tenants, e.g. a cloud provider. + + **Cluster Operator:** Manages clusters and is typically concerned with policies, network + access, application permissions, etc. + + **Application Developer:** Manages an application running in a cluster and is typically + concerned with application-level configuration and [Service](/docs/concepts/services-networking/service/) + composition. +* **Portable:** Gateway API specifications are defined as [custom resources](/docs/concepts/extend-kubernetes/api-extension/custom-resources/) + and are supported by many [implementations](https://gateway-api.sigs.k8s.io/implementations/). +* **Expressive:** Gateway API kinds support functionality for common traffic routing use cases + such as header-based matching, traffic weighting, and others that were only possible in + [Ingress](/docs/concepts/services-networking/ingress/) by using custom annotations. +* **Extensible:** Gateway allows for custom resources to be linked at various layers of the API. + This makes granular customization possible at the appropriate places within the API structure. + +## Resource model + +Gateway API has three stable API kinds: + +* **GatewayClass:** Defines a set of gateways with common configuration and managed by a controller + that implements the class. +* **Gateway:** Defines an instance of traffic handling infrastructure, such as cloud load balancer. +* **HTTPRoute:** Defines HTTP-specific rules for mapping traffic from a Gateway listener to a + representation of backend network endpoints. These endpoints are often represented as a + [Service](/docs/concepts/services-networking/service/ "A way to expose an application running on a set of Pods as a network service."). + +Gateway API is organized into different API kinds that have interdependent relationships to support +the role-oriented nature of organizations. A Gateway object is associated with exactly one GatewayClass; +the GatewayClass describes the gateway controller responsible for managing Gateways of this class. +One or more route kinds such as HTTPRoute, are then associated to Gateways. A Gateway can filter the routes +that may be attached to its `listeners`, forming a bidirectional trust model with routes. + +The following figure illustrates the relationships of the three stable Gateway API kinds: + +![A figure illustrating the relationships of the three stable Gateway API kinds](/docs/images/gateway-kind-relationships.svg) + +### GatewayClass + +Gateways can be implemented by different controllers, often with different configurations. A Gateway +must reference a GatewayClass that contains the name of the controller that implements the +class. + +A minimal GatewayClass example: + +```None +apiVersion: gateway.networking.k8s.io/v1 +kind: GatewayClass +metadata: + name: example-class +spec: + controllerName: example.com/gateway-controller +``` + +In this example, a controller that has implemented Gateway API is configured to manage GatewayClasses +with the controller name `example.com/gateway-controller`. Gateways of this class will be managed by +the implementation's controller. + +See the [GatewayClass](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1.GatewayClass) +reference for a full definition of this API kind. + +### Gateway + +A Gateway describes an instance of traffic handling infrastructure. It defines a network endpoint +that can be used for processing traffic, i.e. filtering, balancing, splitting, etc. for backends +such as a Service. For example, a Gateway may represent a cloud load balancer or an in-cluster proxy +server that is configured to accept HTTP traffic. + +A minimal Gateway resource example: + +```None +apiVersion: gateway.networking.k8s.io/v1 +kind: Gateway +metadata: + name: example-gateway +spec: + gatewayClassName: example-class + listeners: + - name: http + protocol: HTTP + port: 80 +``` + +In this example, an instance of traffic handling infrastructure is programmed to listen for HTTP +traffic on port 80. Since the `addresses` field is unspecified, an address or hostname is assigned +to the Gateway by the implementation's controller. This address is used as a network endpoint for +processing traffic of backend network endpoints defined in routes. + +See the [Gateway](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1.Gateway) +reference for a full definition of this API kind. + +### HTTPRoute + +The HTTPRoute kind specifies routing behavior of HTTP requests from a Gateway listener to backend network +endpoints. For a Service backend, an implementation may represent the backend network endpoint as a Service +IP or the backing Endpoints of the Service. An HTTPRoute represents configuration that is applied to the +underlying Gateway implementation. For example, defining a new HTTPRoute may result in configuring additional +traffic routes in a cloud load balancer or in-cluster proxy server. + +A minimal HTTPRoute example: + +```None +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: example-httproute +spec: + parentRefs: + - name: example-gateway + hostnames: + - "www.example.com" + rules: + - matches: + - path: + type: PathPrefix + value: /login + backendRefs: + - name: example-svc + port: 8080 +``` + +In this example, HTTP traffic from Gateway `example-gateway` with the Host: header set to `www.example.com` +and the request path specified as `/login` will be routed to Service `example-svc` on port `8080`. + +See the [HTTPRoute](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1.HTTPRoute) +reference for a full definition of this API kind. + +## Request flow + +Here is a simple example of HTTP traffic being routed to a Service by using a Gateway and an HTTPRoute: + +![A diagram that provides an example of HTTP traffic being routed to a Service by using a Gateway and an HTTPRoute](/docs/images/gateway-request-flow.svg) + +In this example, the request flow for a Gateway implemented as a reverse proxy is: + +1. The client starts to prepare an HTTP request for the URL `http://www.example.com` +2. The client's DNS resolver queries for the destination name and learns a mapping to + one or more IP addresses associated with the Gateway. +3. The client sends a request to the Gateway IP address; the reverse proxy receives the HTTP + request and uses the Host: header to match a configuration that was derived from the Gateway + and attached HTTPRoute. +4. Optionally, the reverse proxy can perform request header and/or path matching based + on match rules of the HTTPRoute. +5. Optionally, the reverse proxy can modify the request; for example, to add or remove headers, + based on filter rules of the HTTPRoute. +6. Lastly, the reverse proxy forwards the request to one or more backends. + +## Conformance + +Gateway API covers a broad set of features and is widely implemented. This combination requires +clear conformance definitions and tests to ensure that the API provides a consistent experience +wherever it is used. + +See the [conformance](https://gateway-api.sigs.k8s.io/concepts/conformance/) documentation to +understand details such as release channels, support levels, and running conformance tests. + +## Migrating from Ingress + +Gateway API is the successor to the [Ingress](/docs/concepts/services-networking/ingress/) API. +However, it does not include the Ingress kind. As a result, a one-time conversion from your existing +Ingress resources to Gateway API resources is necessary. + +Refer to the [ingress migration](https://gateway-api.sigs.k8s.io/guides/migrating-from-ingress/#migrating-from-ingress) +guide for details on migrating Ingress resources to Gateway API resources. + +## What's next + +Instead of Gateway API resources being natively implemented by Kubernetes, the specifications +are defined as [Custom Resources](/docs/concepts/extend-kubernetes/api-extension/custom-resources/) +supported by a wide range of [implementations](https://gateway-api.sigs.k8s.io/implementations/). +[Install](https://gateway-api.sigs.k8s.io/guides/#installing-gateway-api) the Gateway API CRDs or +follow the installation instructions of your selected implementation. After installing an +implementation, use the [Getting Started](https://gateway-api.sigs.k8s.io/guides/) guide to help +you quickly start working with Gateway API. + +#### Note: + +Make sure to review the documentation of your selected implementation to understand any caveats. + +Refer to the [API specification](https://gateway-api.sigs.k8s.io/reference/spec/) for additional +details of all Gateway API kinds. + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified January 01, 2024 at 9:15 PM PST: [Fix several link errors (8b46ec4047)](https://github.com/kubernetes/website/commit/8b46ec4047d2a928fe608401905d7702acdc3cfd) diff --git a/corpus/docs/kubernetes/gateway/gateway_v133.md b/corpus/docs/kubernetes/gateway/gateway_v133.md new file mode 100644 index 0000000000000000000000000000000000000000..bb9974afdff3424f09297f8ed41159442d6a5dd9 --- /dev/null +++ b/corpus/docs/kubernetes/gateway/gateway_v133.md @@ -0,0 +1,224 @@ +# Gateway API + +Source: https://v1-33.docs.kubernetes.io/docs/concepts/services-networking/gateway/ +Version: v1.33 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Concepts](https://kubernetes.io/docs/concepts/) +3. [Services, Load Balancing, and Networking](https://kubernetes.io/docs/concepts/services-networking/) +4. [Gateway API](https://kubernetes.io/docs/concepts/services-networking/gateway/) + +### You are viewing documentation for Kubernetes version: v1.33 + +Kubernetes v1.33 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date information, see the +[latest version.](https://kubernetes.io/docs/home/) + +Gateway API is a family of API kinds that provide dynamic infrastructure provisioning and advanced traffic routing. + +Make network services available by using an extensible, role-oriented, protocol-aware configuration +mechanism. [Gateway API](https://gateway-api.sigs.k8s.io/) is an [add-on](/docs/concepts/cluster-administration/addons/ "Resources that extend the functionality of Kubernetes.") +containing API [kinds](https://gateway-api.sigs.k8s.io/references/spec/) that provide dynamic infrastructure +provisioning and advanced traffic routing. + +## Design principles + +The following principles shaped the design and architecture of Gateway API: + +* **Role-oriented:** Gateway API kinds are modeled after organizational roles that are + responsible for managing Kubernetes service networking: + + **Infrastructure Provider:** Manages infrastructure that allows multiple isolated clusters + to serve multiple tenants, e.g. a cloud provider. + + **Cluster Operator:** Manages clusters and is typically concerned with policies, network + access, application permissions, etc. + + **Application Developer:** Manages an application running in a cluster and is typically + concerned with application-level configuration and [Service](/docs/concepts/services-networking/service/) + composition. +* **Portable:** Gateway API specifications are defined as [custom resources](/docs/concepts/extend-kubernetes/api-extension/custom-resources/) + and are supported by many [implementations](https://gateway-api.sigs.k8s.io/implementations/). +* **Expressive:** Gateway API kinds support functionality for common traffic routing use cases + such as header-based matching, traffic weighting, and others that were only possible in + [Ingress](/docs/concepts/services-networking/ingress/) by using custom annotations. +* **Extensible:** Gateway allows for custom resources to be linked at various layers of the API. + This makes granular customization possible at the appropriate places within the API structure. + +## Resource model + +Gateway API has three stable API kinds: + +* **GatewayClass:** Defines a set of gateways with common configuration and managed by a controller + that implements the class. +* **Gateway:** Defines an instance of traffic handling infrastructure, such as cloud load balancer. +* **HTTPRoute:** Defines HTTP-specific rules for mapping traffic from a Gateway listener to a + representation of backend network endpoints. These endpoints are often represented as a + [Service](/docs/concepts/services-networking/service/ "A way to expose an application running on a set of Pods as a network service."). + +Gateway API is organized into different API kinds that have interdependent relationships to support +the role-oriented nature of organizations. A Gateway object is associated with exactly one GatewayClass; +the GatewayClass describes the gateway controller responsible for managing Gateways of this class. +One or more route kinds such as HTTPRoute, are then associated to Gateways. A Gateway can filter the routes +that may be attached to its `listeners`, forming a bidirectional trust model with routes. + +The following figure illustrates the relationships of the three stable Gateway API kinds: + +![A figure illustrating the relationships of the three stable Gateway API kinds](/docs/images/gateway-kind-relationships.svg) + +### GatewayClass + +Gateways can be implemented by different controllers, often with different configurations. A Gateway +must reference a GatewayClass that contains the name of the controller that implements the +class. + +A minimal GatewayClass example: + +```None +apiVersion: gateway.networking.k8s.io/v1 +kind: GatewayClass +metadata: + name: example-class +spec: + controllerName: example.com/gateway-controller +``` + +In this example, a controller that has implemented Gateway API is configured to manage GatewayClasses +with the controller name `example.com/gateway-controller`. Gateways of this class will be managed by +the implementation's controller. + +See the [GatewayClass](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1.GatewayClass) +reference for a full definition of this API kind. + +### Gateway + +A Gateway describes an instance of traffic handling infrastructure. It defines a network endpoint +that can be used for processing traffic, i.e. filtering, balancing, splitting, etc. for backends +such as a Service. For example, a Gateway may represent a cloud load balancer or an in-cluster proxy +server that is configured to accept HTTP traffic. + +A minimal Gateway resource example: + +```None +apiVersion: gateway.networking.k8s.io/v1 +kind: Gateway +metadata: + name: example-gateway +spec: + gatewayClassName: example-class + listeners: + - name: http + protocol: HTTP + port: 80 +``` + +In this example, an instance of traffic handling infrastructure is programmed to listen for HTTP +traffic on port 80. Since the `addresses` field is unspecified, an address or hostname is assigned +to the Gateway by the implementation's controller. This address is used as a network endpoint for +processing traffic of backend network endpoints defined in routes. + +See the [Gateway](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1.Gateway) +reference for a full definition of this API kind. + +### HTTPRoute + +The HTTPRoute kind specifies routing behavior of HTTP requests from a Gateway listener to backend network +endpoints. For a Service backend, an implementation may represent the backend network endpoint as a Service +IP or the backing EndpointSlices of the Service. An HTTPRoute represents configuration that is applied to the +underlying Gateway implementation. For example, defining a new HTTPRoute may result in configuring additional +traffic routes in a cloud load balancer or in-cluster proxy server. + +A minimal HTTPRoute example: + +```None +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: example-httproute +spec: + parentRefs: + - name: example-gateway + hostnames: + - "www.example.com" + rules: + - matches: + - path: + type: PathPrefix + value: /login + backendRefs: + - name: example-svc + port: 8080 +``` + +In this example, HTTP traffic from Gateway `example-gateway` with the Host: header set to `www.example.com` +and the request path specified as `/login` will be routed to Service `example-svc` on port `8080`. + +See the [HTTPRoute](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1.HTTPRoute) +reference for a full definition of this API kind. + +## Request flow + +Here is a simple example of HTTP traffic being routed to a Service by using a Gateway and an HTTPRoute: + +![A diagram that provides an example of HTTP traffic being routed to a Service by using a Gateway and an HTTPRoute](/docs/images/gateway-request-flow.svg) + +In this example, the request flow for a Gateway implemented as a reverse proxy is: + +1. The client starts to prepare an HTTP request for the URL `http://www.example.com` +2. The client's DNS resolver queries for the destination name and learns a mapping to + one or more IP addresses associated with the Gateway. +3. The client sends a request to the Gateway IP address; the reverse proxy receives the HTTP + request and uses the Host: header to match a configuration that was derived from the Gateway + and attached HTTPRoute. +4. Optionally, the reverse proxy can perform request header and/or path matching based + on match rules of the HTTPRoute. +5. Optionally, the reverse proxy can modify the request; for example, to add or remove headers, + based on filter rules of the HTTPRoute. +6. Lastly, the reverse proxy forwards the request to one or more backends. + +## Conformance + +Gateway API covers a broad set of features and is widely implemented. This combination requires +clear conformance definitions and tests to ensure that the API provides a consistent experience +wherever it is used. + +See the [conformance](https://gateway-api.sigs.k8s.io/concepts/conformance/) documentation to +understand details such as release channels, support levels, and running conformance tests. + +## Migrating from Ingress + +Gateway API is the successor to the [Ingress](/docs/concepts/services-networking/ingress/) API. +However, it does not include the Ingress kind. As a result, a one-time conversion from your existing +Ingress resources to Gateway API resources is necessary. + +Refer to the [ingress migration](https://gateway-api.sigs.k8s.io/guides/migrating-from-ingress/#migrating-from-ingress) +guide for details on migrating Ingress resources to Gateway API resources. + +## What's next + +Instead of Gateway API resources being natively implemented by Kubernetes, the specifications +are defined as [Custom Resources](/docs/concepts/extend-kubernetes/api-extension/custom-resources/) +supported by a wide range of [implementations](https://gateway-api.sigs.k8s.io/implementations/). +[Install](https://gateway-api.sigs.k8s.io/guides/#installing-gateway-api) the Gateway API CRDs or +follow the installation instructions of your selected implementation. After installing an +implementation, use the [Getting Started](https://gateway-api.sigs.k8s.io/guides/) guide to help +you quickly start working with Gateway API. + +#### Note: + +Make sure to review the documentation of your selected implementation to understand any caveats. + +Refer to the [API specification](https://gateway-api.sigs.k8s.io/reference/spec/) for additional +details of all Gateway API kinds. + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified April 09, 2025 at 5:08 AM PST: [Update docs for deprecation of Endpoints API (#49831) (649bda2cbd)](https://github.com/kubernetes/website/commit/649bda2cbda386043d3e2af07fcb84806243c828) diff --git a/corpus/docs/kubernetes/gateway/gateway_v134.md b/corpus/docs/kubernetes/gateway/gateway_v134.md new file mode 100644 index 0000000000000000000000000000000000000000..37440472e0e8e9812f59189d7b9523ee3efcd8fa --- /dev/null +++ b/corpus/docs/kubernetes/gateway/gateway_v134.md @@ -0,0 +1,289 @@ +# Gateway API + +Source: https://v1-34.docs.kubernetes.io/docs/concepts/services-networking/gateway/ +Version: v1.34 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Concepts](https://kubernetes.io/docs/concepts/) +3. [Services, Load Balancing, and Networking](https://kubernetes.io/docs/concepts/services-networking/) +4. [Gateway API](https://kubernetes.io/docs/concepts/services-networking/gateway/) + +### You are viewing documentation for Kubernetes version: v1.34 + +Kubernetes v1.34 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date information, see the +[latest version.](https://kubernetes.io/docs/home/) + +Gateway API is a family of API kinds that provide dynamic infrastructure provisioning and advanced traffic routing. + +Make network services available by using an extensible, role-oriented, protocol-aware configuration +mechanism. [Gateway API](https://gateway-api.sigs.k8s.io/) is an [add-on](/docs/concepts/cluster-administration/addons/ "Resources that extend the functionality of Kubernetes.") +containing API [kinds](https://gateway-api.sigs.k8s.io/references/spec/) that provide dynamic infrastructure +provisioning and advanced traffic routing. + +## Design principles + +The following principles shaped the design and architecture of Gateway API: + +* **Role-oriented:** Gateway API kinds are modeled after organizational roles that are + responsible for managing Kubernetes service networking: + + **Infrastructure Provider:** Manages infrastructure that allows multiple isolated clusters + to serve multiple tenants, e.g. a cloud provider. + + **Cluster Operator:** Manages clusters and is typically concerned with policies, network + access, application permissions, etc. + + **Application Developer:** Manages an application running in a cluster and is typically + concerned with application-level configuration and [Service](/docs/concepts/services-networking/service/) + composition. +* **Portable:** Gateway API specifications are defined as [custom resources](/docs/concepts/extend-kubernetes/api-extension/custom-resources/) + and are supported by many [implementations](https://gateway-api.sigs.k8s.io/implementations/). +* **Expressive:** Gateway API kinds support functionality for common traffic routing use cases + such as header-based matching, traffic weighting, and others that were only possible in + [Ingress](/docs/concepts/services-networking/ingress/) by using custom annotations. +* **Extensible:** Gateway allows for custom resources to be linked at various layers of the API. + This makes granular customization possible at the appropriate places within the API structure. + +## Resource model + +Gateway API has four stable API kinds: + +* **GatewayClass:** Defines a set of gateways with common configuration and managed by a controller + that implements the class. +* **Gateway:** Defines an instance of traffic handling infrastructure, such as cloud load balancer. +* **HTTPRoute:** Defines HTTP-specific rules for mapping traffic from a Gateway listener to a + representation of backend network endpoints. These endpoints are often represented as a + [Service](/docs/concepts/services-networking/service/ "A way to expose an application running on a set of Pods as a network service."). +* **GRPCRoute:** Defines gRPC-specific rules for mapping traffic from a Gateway listener to a + representation of backend network endpoints. These endpoints are often represented as a + [Service](/docs/concepts/services-networking/service/ "A way to expose an application running on a set of Pods as a network service."). + +Gateway API is organized into different API kinds that have interdependent relationships to support +the role-oriented nature of organizations. A Gateway object is associated with exactly one GatewayClass; +the GatewayClass describes the gateway controller responsible for managing Gateways of this class. +One or more route kinds such as HTTPRoute, are then associated to Gateways. A Gateway can filter the routes +that may be attached to its `listeners`, forming a bidirectional trust model with routes. + +The following figure illustrates the relationships of the three stable Gateway API kinds: + +![A figure illustrating the relationships of the three stable Gateway API kinds](/docs/images/gateway-kind-relationships.svg) + +### GatewayClass + +Gateways can be implemented by different controllers, often with different configurations. A Gateway +must reference a GatewayClass that contains the name of the controller that implements the +class. + +A minimal GatewayClass example: + +```None +apiVersion: gateway.networking.k8s.io/v1 +kind: GatewayClass +metadata: + name: example-class +spec: + controllerName: example.com/gateway-controller +``` + +In this example, a controller that has implemented Gateway API is configured to manage GatewayClasses +with the controller name `example.com/gateway-controller`. Gateways of this class will be managed by +the implementation's controller. + +See the [GatewayClass](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1.GatewayClass) +reference for a full definition of this API kind. + +### Gateway + +A Gateway describes an instance of traffic handling infrastructure. It defines a network endpoint +that can be used for processing traffic, i.e. filtering, balancing, splitting, etc. for backends +such as a Service. For example, a Gateway may represent a cloud load balancer or an in-cluster proxy +server that is configured to accept HTTP traffic. + +A minimal Gateway resource example: + +```None +apiVersion: gateway.networking.k8s.io/v1 +kind: Gateway +metadata: + name: example-gateway +spec: + gatewayClassName: example-class + listeners: + - name: http + protocol: HTTP + port: 80 +``` + +In this example, an instance of traffic handling infrastructure is programmed to listen for HTTP +traffic on port 80. Since the `addresses` field is unspecified, an address or hostname is assigned +to the Gateway by the implementation's controller. This address is used as a network endpoint for +processing traffic of backend network endpoints defined in routes. + +See the [Gateway](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1.Gateway) +reference for a full definition of this API kind. + +### HTTPRoute + +The HTTPRoute kind specifies routing behavior of HTTP requests from a Gateway listener to backend network +endpoints. For a Service backend, an implementation may represent the backend network endpoint as a Service +IP or the backing EndpointSlices of the Service. An HTTPRoute represents configuration that is applied to the +underlying Gateway implementation. For example, defining a new HTTPRoute may result in configuring additional +traffic routes in a cloud load balancer or in-cluster proxy server. + +A minimal HTTPRoute example: + +```None +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: example-httproute +spec: + parentRefs: + - name: example-gateway + hostnames: + - "www.example.com" + rules: + - matches: + - path: + type: PathPrefix + value: /login + backendRefs: + - name: example-svc + port: 8080 +``` + +In this example, HTTP traffic from Gateway `example-gateway` with the Host: header set to `www.example.com` +and the request path specified as `/login` will be routed to Service `example-svc` on port `8080`. + +See the [HTTPRoute](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1.HTTPRoute) +reference for a full definition of this API kind. + +### GRPCRoute + +The GRPCRoute kind specifies routing behavior of gRPC requests from a Gateway listener to backend network +endpoints. For a Service backend, an implementation may represent the backend network endpoint as a Service +IP or the backing EndpointSlices of the Service. A GRPCRoute represents configuration that is applied to the +underlying Gateway implementation. For example, defining a new GRPCRoute may result in configuring additional +traffic routes in a cloud load balancer or in-cluster proxy server. + +Gateways supporting GRPCRoute are required to support HTTP/2 without an initial upgrade from HTTP/1, +so gRPC traffic is guaranteed to flow properly. + +A minimal GRPCRoute example: + +```None +apiVersion: gateway.networking.k8s.io/v1 +kind: GRPCRoute +metadata: + name: example-grpcroute +spec: + parentRefs: + - name: example-gateway + hostnames: + - "svc.example.com" + rules: + - backendRefs: + - name: example-svc + port: 50051 +``` + +In this example, gRPC traffic from Gateway `example-gateway` with the host set to `svc.example.com` +will be directed to the service `example-svc` on port `50051` from the same namespace. + +GRPCRoute allows matching specific gRPC services, as per the following example: + +```None +apiVersion: gateway.networking.k8s.io/v1 +kind: GRPCRoute +metadata: + name: example-grpcroute +spec: + parentRefs: + - name: example-gateway + hostnames: + - "svc.example.com" + rules: + - matches: + - method: + service: com.example + method: Login + backendRefs: + - name: foo-svc + port: 50051 +``` + +In this case, the GRPCRoute will match any traffic for svc.example.com and apply its routing rules +to forward the traffic to the correct backend. Since there is only one match specified,only requests +for the com.example.User.Login method to svc.example.com will be forwarded. +RPCs of any other method` will not be matched by this Route. + +See the [GRPCRoute](https://gateway-api.sigs.k8s.io/reference/spec/#grpcroute) +reference for a full definition of this API kind. + +## Request flow + +Here is a simple example of HTTP traffic being routed to a Service by using a Gateway and an HTTPRoute: + +![A diagram that provides an example of HTTP traffic being routed to a Service by using a Gateway and an HTTPRoute](/docs/images/gateway-request-flow.svg) + +In this example, the request flow for a Gateway implemented as a reverse proxy is: + +1. The client starts to prepare an HTTP request for the URL `http://www.example.com` +2. The client's DNS resolver queries for the destination name and learns a mapping to + one or more IP addresses associated with the Gateway. +3. The client sends a request to the Gateway IP address; the reverse proxy receives the HTTP + request and uses the Host: header to match a configuration that was derived from the Gateway + and attached HTTPRoute. +4. Optionally, the reverse proxy can perform request header and/or path matching based + on match rules of the HTTPRoute. +5. Optionally, the reverse proxy can modify the request; for example, to add or remove headers, + based on filter rules of the HTTPRoute. +6. Lastly, the reverse proxy forwards the request to one or more backends. + +## Conformance + +Gateway API covers a broad set of features and is widely implemented. This combination requires +clear conformance definitions and tests to ensure that the API provides a consistent experience +wherever it is used. + +See the [conformance](https://gateway-api.sigs.k8s.io/concepts/conformance/) documentation to +understand details such as release channels, support levels, and running conformance tests. + +## Migrating from Ingress + +Gateway API is the successor to the [Ingress](/docs/concepts/services-networking/ingress/) API. +However, it does not include the Ingress kind. As a result, a one-time conversion from your existing +Ingress resources to Gateway API resources is necessary. + +Refer to the [ingress migration](https://gateway-api.sigs.k8s.io/guides/getting-started/migrating-from-ingress) +guide for details on migrating Ingress resources to Gateway API resources. + +## What's next + +Instead of Gateway API resources being natively implemented by Kubernetes, the specifications +are defined as [Custom Resources](/docs/concepts/extend-kubernetes/api-extension/custom-resources/) +supported by a wide range of [implementations](https://gateway-api.sigs.k8s.io/implementations/). +[Install](https://gateway-api.sigs.k8s.io/guides/#installing-gateway-api) the Gateway API CRDs or +follow the installation instructions of your selected implementation. After installing an +implementation, use the [Getting Started](https://gateway-api.sigs.k8s.io/guides/) guide to help +you quickly start working with Gateway API. + +#### Note: + +Make sure to review the documentation of your selected implementation to understand any caveats. + +Refer to the [API specification](https://gateway-api.sigs.k8s.io/reference/spec/) for additional +details of all Gateway API kinds. + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified December 14, 2025 at 10:11 AM PST: [migrating-from-ingress link not working in k8s docs (cbb9abee89)](https://github.com/kubernetes/website/commit/cbb9abee893eb0154815351ab1b28639f3289aaa) diff --git a/corpus/docs/kubernetes/gateway/gateway_v135.md b/corpus/docs/kubernetes/gateway/gateway_v135.md new file mode 100644 index 0000000000000000000000000000000000000000..bdc59851c7ac767528db3cc5cc9e235eed6f0393 --- /dev/null +++ b/corpus/docs/kubernetes/gateway/gateway_v135.md @@ -0,0 +1,293 @@ +# Gateway API + +Source: https://kubernetes.io/docs/concepts/services-networking/gateway/ +Version: v1.35 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Concepts](https://kubernetes.io/docs/concepts/) +3. [Services, Load Balancing, and Networking](https://kubernetes.io/docs/concepts/services-networking/) +4. [Gateway API](https://kubernetes.io/docs/concepts/services-networking/gateway/) + +Gateway API is a family of API kinds that provide dynamic infrastructure provisioning and advanced traffic routing. + +Make network services available by using an extensible, role-oriented, protocol-aware configuration +mechanism. [Gateway API](https://gateway-api.sigs.k8s.io/) is an [add-on](/docs/concepts/cluster-administration/addons/ "Resources that extend the functionality of Kubernetes.") +containing API [kinds](https://gateway-api.sigs.k8s.io/references/spec/) that provide dynamic infrastructure +provisioning and advanced traffic routing. + +## Design principles + +The following principles shaped the design and architecture of Gateway API: + +* **Role-oriented:** Gateway API kinds are modeled after organizational roles that are + responsible for managing Kubernetes service networking: + + **Infrastructure Provider:** Manages infrastructure that allows multiple isolated clusters + to serve multiple tenants, e.g. a cloud provider. + + **Cluster Operator:** Manages clusters and is typically concerned with policies, network + access, application permissions, etc. + + **Application Developer:** Manages an application running in a cluster and is typically + concerned with application-level configuration and [Service](/docs/concepts/services-networking/service/) + composition. +* **Portable:** Gateway API specifications are defined as [custom resources](/docs/concepts/extend-kubernetes/api-extension/custom-resources/) + and are supported by many [implementations](https://gateway-api.sigs.k8s.io/implementations/). +* **Expressive:** Gateway API kinds support functionality for common traffic routing use cases + such as header-based matching, traffic weighting, and others that were only possible in + [Ingress](/docs/concepts/services-networking/ingress/) by using custom annotations. +* **Extensible:** Gateway allows for custom resources to be linked at various layers of the API. + This makes granular customization possible at the appropriate places within the API structure. + +## Resource model + +Gateway API has four stable API kinds: + +* **GatewayClass:** Defines a set of gateways with common configuration and managed by a controller + that implements the class. +* **Gateway:** Defines an instance of traffic handling infrastructure, such as cloud load balancer. +* **HTTPRoute:** Defines HTTP-specific rules for mapping traffic from a Gateway listener to a + representation of backend network endpoints. These endpoints are often represented as a + [Service](/docs/concepts/services-networking/service/ "A way to expose an application running on a set of Pods as a network service."). +* **GRPCRoute:** Defines gRPC-specific rules for mapping traffic from a Gateway listener to a + representation of backend network endpoints. These endpoints are often represented as a + [Service](/docs/concepts/services-networking/service/ "A way to expose an application running on a set of Pods as a network service."). + +Gateway API is organized into different API kinds that have interdependent relationships to support +the role-oriented nature of organizations. A Gateway object is associated with exactly one GatewayClass; +the GatewayClass describes the gateway controller responsible for managing Gateways of this class. +One or more route kinds such as HTTPRoute, are then associated to Gateways. A Gateway can filter the routes +that may be attached to its `listeners`, forming a bidirectional trust model with routes. + +The following figure illustrates the relationships of the three stable Gateway API kinds: + +![A figure illustrating the relationships of the three stable Gateway API kinds](/docs/images/gateway-kind-relationships.svg) + +### GatewayClass + +Gateways can be implemented by different controllers, often with different configurations. A Gateway +must reference a GatewayClass that contains the name of the controller that implements the +class. + +A minimal GatewayClass example: + +```None +apiVersion: gateway.networking.k8s.io/v1 +kind: GatewayClass +metadata: + name: example-class +spec: + controllerName: example.com/gateway-controller +``` + +In this example, a controller that has implemented Gateway API is configured to manage GatewayClasses +with the controller name `example.com/gateway-controller`. Gateways of this class will be managed by +the implementation's controller. + +See the [GatewayClass](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1.GatewayClass) +reference for a full definition of this API kind. + +### Gateway + +A Gateway describes an instance of traffic handling infrastructure. It defines a network endpoint +that can be used for processing traffic, i.e. filtering, balancing, splitting, etc. for backends +such as a Service. For example, a Gateway may represent a cloud load balancer or an in-cluster proxy +server that is configured to accept HTTP traffic. + +A typical Gateway resource example: + +```None +apiVersion: gateway.networking.k8s.io/v1 +kind: Gateway +metadata: + name: example-gateway + namespace: example-namespace +spec: + gatewayClassName: example-class + listeners: + - name: http + protocol: HTTP + port: 80 + hostname: "www.example.com" + allowedRoutes: + namespaces: + from: Same +``` + +In this example, an instance of traffic handling infrastructure is programmed to listen for HTTP +traffic on port 80. Since the `addresses` field is unspecified, an address or hostname is assigned +to the Gateway by the implementation's controller. This address is used as a network endpoint for +processing traffic of backend network endpoints defined in routes. + +See the [Gateway](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1.Gateway) +reference for a full definition of this API kind. + +#### Note: + +By default, a Gateway only accepts Routes from the same namespace. Cross-namespace Routes require configuring `allowedRoutes`. + +### HTTPRoute + +The HTTPRoute kind specifies routing behavior of HTTP requests from a Gateway listener to backend network +endpoints. For a Service backend, an implementation may represent the backend network endpoint as a Service +IP or the backing EndpointSlices of the Service. An HTTPRoute represents configuration that is applied to the +underlying Gateway implementation. For example, defining a new HTTPRoute may result in configuring additional +traffic routes in a cloud load balancer or in-cluster proxy server. + +A typical HTTPRoute example: + +```None +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: example-httproute +spec: + parentRefs: + - name: example-gateway + hostnames: + - "www.example.com" + rules: + - matches: + - path: + type: PathPrefix + value: /login + backendRefs: + - name: example-svc + port: 8080 +``` + +In this example, HTTP traffic from Gateway `example-gateway` with the Host: header set to `www.example.com` +and the request path specified as `/login` will be routed to Service `example-svc` on port `8080`. + +See the [HTTPRoute](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1.HTTPRoute) +reference for a full definition of this API kind. + +### GRPCRoute + +The GRPCRoute kind specifies routing behavior of gRPC requests from a Gateway listener to backend network +endpoints. For a Service backend, an implementation may represent the backend network endpoint as a Service +IP or the backing EndpointSlices of the Service. A GRPCRoute represents configuration that is applied to the +underlying Gateway implementation. For example, defining a new GRPCRoute may result in configuring additional +traffic routes in a cloud load balancer or in-cluster proxy server. + +Gateways supporting GRPCRoute are required to support HTTP/2 without an initial upgrade from HTTP/1, +so gRPC traffic is guaranteed to flow properly. + +A typical GRPCRoute example: + +```None +apiVersion: gateway.networking.k8s.io/v1 +kind: GRPCRoute +metadata: + name: example-grpcroute +spec: + parentRefs: + - name: example-gateway + hostnames: + - "svc.example.com" + rules: + - backendRefs: + - name: example-svc + port: 50051 +``` + +In this example, gRPC traffic from Gateway `example-gateway` with the host set to `svc.example.com` +will be directed to the service `example-svc` on port `50051` from the same namespace. + +GRPCRoute allows matching specific gRPC services, as per the following example: + +```None +apiVersion: gateway.networking.k8s.io/v1 +kind: GRPCRoute +metadata: + name: example-grpcroute +spec: + parentRefs: + - name: example-gateway + hostnames: + - "svc.example.com" + rules: + - matches: + - method: + service: com.example + method: Login + backendRefs: + - name: foo-svc + port: 50051 +``` + +In this case, the GRPCRoute will match any traffic for svc.example.com and apply its routing rules +to forward the traffic to the correct backend. Since there is only one match specified,only requests +for the com.example.User.Login method to svc.example.com will be forwarded. +RPCs of any other method` will not be matched by this Route. + +See the [GRPCRoute](https://gateway-api.sigs.k8s.io/reference/spec/#grpcroute) +reference for a full definition of this API kind. + +## Request flow + +Here is a simple example of HTTP traffic being routed to a Service by using a Gateway and an HTTPRoute: + +![A diagram that provides an example of HTTP traffic being routed to a Service by using a Gateway and an HTTPRoute](/docs/images/gateway-request-flow.svg) + +In this example, the request flow for a Gateway implemented as a reverse proxy is: + +1. The client starts to prepare an HTTP request for the URL `http://www.example.com` +2. The client's DNS resolver queries for the destination name and learns a mapping to + one or more IP addresses associated with the Gateway. +3. The client sends a request to the Gateway IP address; the reverse proxy receives the HTTP + request and uses the Host: header to match a configuration that was derived from the Gateway + and attached HTTPRoute. +4. Optionally, the reverse proxy can perform request header and/or path matching based + on match rules of the HTTPRoute. +5. Optionally, the reverse proxy can modify the request; for example, to add or remove headers, + based on filter rules of the HTTPRoute. +6. Lastly, the reverse proxy forwards the request to one or more backends. + +## Conformance + +Gateway API covers a broad set of features and is widely implemented. This combination requires +clear conformance definitions and tests to ensure that the API provides a consistent experience +wherever it is used. + +See the [conformance](https://gateway-api.sigs.k8s.io/concepts/conformance/) documentation to +understand details such as release channels, support levels, and running conformance tests. + +## Migrating from Ingress + +Gateway API is the successor to the [Ingress](/docs/concepts/services-networking/ingress/) API. +However, it does not include the Ingress kind. As a result, a one-time conversion from your existing +Ingress resources to Gateway API resources is necessary. + +Refer to the [ingress migration](https://gateway-api.sigs.k8s.io/guides/getting-started/migrating-from-ingress) +guide for details on migrating Ingress resources to Gateway API resources. + +## What's next + +Instead of Gateway API resources being natively implemented by Kubernetes, the specifications +are defined as [Custom Resources](/docs/concepts/extend-kubernetes/api-extension/custom-resources/) +supported by a wide range of [implementations](https://gateway-api.sigs.k8s.io/implementations/). +[Install](https://gateway-api.sigs.k8s.io/guides/#installing-gateway-api) the Gateway API CRDs or +follow the installation instructions of your selected implementation. After installing an +implementation, use the [Getting Started](https://gateway-api.sigs.k8s.io/guides/) guide to help +you quickly start working with Gateway API. + +#### Note: + +Make sure to review the documentation of your selected implementation to understand any caveats. + +Refer to the [API specification](https://gateway-api.sigs.k8s.io/reference/spec/) for additional +details of all Gateway API kinds. + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified December 15, 2025 at 10:46 PM PST: [docs: clarify default same-namespace behavior for Gateway Routes (6c6b705299)](https://github.com/kubernetes/website/commit/6c6b70529907c08cae46c874a5d6bc3bd3be59c8) diff --git a/corpus/docs/kubernetes/kubernetes-api/kubernetes-api_v131.md b/corpus/docs/kubernetes/kubernetes-api/kubernetes-api_v131.md new file mode 100644 index 0000000000000000000000000000000000000000..855fdde256457bd0b69674c5d2627b8111290162 --- /dev/null +++ b/corpus/docs/kubernetes/kubernetes-api/kubernetes-api_v131.md @@ -0,0 +1,332 @@ +# The Kubernetes API + +Source: https://v1-31.docs.kubernetes.io/docs/concepts/overview/kubernetes-api/ +Version: v1.31 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Concepts](https://kubernetes.io/docs/concepts/) +3. [Overview](https://kubernetes.io/docs/concepts/overview/) +4. [The Kubernetes API](https://kubernetes.io/docs/concepts/overview/kubernetes-api/) + +### You are viewing documentation for Kubernetes version: v1.31 + +Kubernetes v1.31 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date information, see the +[latest version.](https://kubernetes.io/docs/home/) + +The Kubernetes API lets you query and manipulate the state of objects in Kubernetes. The core of Kubernetes' control plane is the API server and the HTTP API that it exposes. Users, the different parts of your cluster, and external components all communicate with one another through the API server. + +The core of Kubernetes' [control plane](/docs/reference/glossary/?all=true#term-control-plane "The container orchestration layer that exposes the API and interfaces to define, deploy, and manage the lifecycle of containers.") +is the [API server](/docs/concepts/architecture/#kube-apiserver "Control plane component that serves the Kubernetes API."). The API server +exposes an HTTP API that lets end users, different parts of your cluster, and +external components communicate with one another. + +The Kubernetes API lets you query and manipulate the state of API objects in Kubernetes +(for example: Pods, Namespaces, ConfigMaps, and Events). + +Most operations can be performed through the [kubectl](/docs/reference/kubectl/) +command-line interface or other command-line tools, such as +[kubeadm](/docs/reference/setup-tools/kubeadm/), which in turn use the API. +However, you can also access the API directly using REST calls. Kubernetes +provides a set of [client libraries](/docs/reference/using-api/client-libraries/) +for those looking to +write applications using the Kubernetes API. + +Each Kubernetes cluster publishes the specification of the APIs that the cluster serves. +There are two mechanisms that Kubernetes uses to publish these API specifications; both are useful +to enable automatic interoperability. For example, the `kubectl` tool fetches and caches the API +specification for enabling command-line completion and other features. +The two supported mechanisms are as follows: + +* [The Discovery API](#discovery-api) provides information about the Kubernetes APIs: + API names, resources, versions, and supported operations. This is a Kubernetes + specific term as it is a separate API from the Kubernetes OpenAPI. + It is intended to be a brief summary of the available resources and it does not + detail specific schema for the resources. For reference about resource schemas, + please refer to the OpenAPI document. +* The [Kubernetes OpenAPI Document](#openapi-interface-definition) provides (full) + [OpenAPI v2.0 and 3.0 schemas](https://www.openapis.org/) for all Kubernetes API + endpoints. + The OpenAPI v3 is the preferred method for accessing OpenAPI as it + provides + a more comprehensive and accurate view of the API. It includes all the available + API paths, as well as all resources consumed and produced for every operations + on every endpoints. It also includes any extensibility components that a cluster supports. + The data is a complete specification and is significantly larger than that from the + Discovery API. + +## Discovery API + +Kubernetes publishes a list of all group versions and resources supported via +the Discovery API. This includes the following for each resource: + +* Name +* Cluster or namespaced scope +* Endpoint URL and supported verbs +* Alternative names +* Group, version, kind + +The API is available in both aggregated and unaggregated form. The aggregated +discovery serves two endpoints, while the unaggregated discovery serves a +separate endpoint for each group version. + +### Aggregated discovery + +FEATURE STATE: +`Kubernetes v1.30 [stable]` (enabled by default: true) + +Kubernetes offers stable support for *aggregated discovery*, publishing +all resources supported by a cluster through two endpoints (`/api` and +`/apis`). Requesting this +endpoint drastically reduces the number of requests sent to fetch the +discovery data from the cluster. You can access the data by +requesting the respective endpoints with an `Accept` header indicating +the aggregated discovery resource: +`Accept: application/json;v=v2;g=apidiscovery.k8s.io;as=APIGroupDiscoveryList`. + +Without indicating the resource type using the `Accept` header, the default +response for the `/api` and `/apis` endpoint is an unaggregated discovery +document. + +The [discovery document](https://github.com/kubernetes/kubernetes/blob/release-1.31/api/discovery/aggregated_v2beta1.json) +for the built-in resources can be found in the Kubernetes GitHub repository. +This Github document can be used as a reference of the base set of the available resources +if a Kubernetes cluster is not available to query. + +The endpoint also supports ETag and protobuf encoding. + +### Unaggregated discovery + +Without discovery aggregation, discovery is published in levels, with the root +endpoints publishing discovery information for downstream documents. + +A list of all group versions supported by a cluster is published at +the `/api` and `/apis` endpoints. Example: + +```None +{ + "kind": "APIGroupList", + "apiVersion": "v1", + "groups": [ + { + "name": "apiregistration.k8s.io", + "versions": [ + { + "groupVersion": "apiregistration.k8s.io/v1", + "version": "v1" + } + ], + "preferredVersion": { + "groupVersion": "apiregistration.k8s.io/v1", + "version": "v1" + } + }, + { + "name": "apps", + "versions": [ + { + "groupVersion": "apps/v1", + "version": "v1" + } + ], + "preferredVersion": { + "groupVersion": "apps/v1", + "version": "v1" + } + }, + ... +} +``` + +Additional requests are needed to obtain the discovery document for each group version at +`/apis//` (for example: +`/apis/rbac.authorization.k8s.io/v1alpha1`), which advertises the list of +resources served under a particular group version. These endpoints are used by +kubectl to fetch the list of resources supported by a cluster. + + + +## OpenAPI interface definition + +For details about the OpenAPI specifications, see the [OpenAPI documentation](https://www.openapis.org/). + +Kubernetes serves both OpenAPI v2.0 and OpenAPI v3.0. OpenAPI v3 is the +preferred method of accessing the OpenAPI because it offers a more comprehensive +(lossless) representation of Kubernetes resources. Due to limitations of OpenAPI +version 2, certain fields are dropped from the published OpenAPI including but not +limited to `default`, `nullable`, `oneOf`. + +### OpenAPI V2 + +The Kubernetes API server serves an aggregated OpenAPI v2 spec via the +`/openapi/v2` endpoint. You can request the response format using +request headers as follows: + +Valid request header values for OpenAPI v2 queries + +| Header | Possible values | Notes | +| --- | --- | --- | +| `Accept-Encoding` | `gzip` | *not supplying this header is also acceptable* | +| `Accept` | `application/com.github.proto-openapi.spec.v2@v1.0+protobuf` | *mainly for intra-cluster use* | +| `application/json` | *default* | +| `*` | *serves* `application/json` | + +### OpenAPI V3 + +FEATURE STATE: +`Kubernetes v1.27 [stable]` (enabled by default: true) + +Kubernetes supports publishing a description of its APIs as OpenAPI v3. + +A discovery endpoint `/openapi/v3` is provided to see a list of all +group/versions available. This endpoint only returns JSON. These +group/versions are provided in the following format: + +```None +{ + "paths": { + ..., + "api/v1": { + "serverRelativeURL": "/openapi/v3/api/v1?hash=CC0E9BFD992D8C59AEC98A1E2336F899E8318D3CF4C68944C3DEC640AF5AB52D864AC50DAA8D145B3494F75FA3CFF939FCBDDA431DAD3CA79738B297795818CF" + }, + "apis/admissionregistration.k8s.io/v1": { + "serverRelativeURL": "/openapi/v3/apis/admissionregistration.k8s.io/v1?hash=E19CC93A116982CE5422FC42B590A8AFAD92CDE9AE4D59B5CAAD568F083AD07946E6CB5817531680BCE6E215C16973CD39003B0425F3477CFD854E89A9DB6597" + }, + .... + } +} +``` + +The relative URLs are pointing to immutable OpenAPI descriptions, in +order to improve client-side caching. The proper HTTP caching headers +are also set by the API server for that purpose (`Expires` to 1 year in +the future, and `Cache-Control` to `immutable`). When an obsolete URL is +used, the API server returns a redirect to the newest URL. + +The Kubernetes API server publishes an OpenAPI v3 spec per Kubernetes +group version at the `/openapi/v3/apis//?hash=` +endpoint. + +Refer to the table below for accepted request headers. + +Valid request header values for OpenAPI v3 queries + +| Header | Possible values | Notes | +| --- | --- | --- | +| `Accept-Encoding` | `gzip` | *not supplying this header is also acceptable* | +| `Accept` | `application/com.github.proto-openapi.spec.v3@v1.0+protobuf` | *mainly for intra-cluster use* | +| `application/json` | *default* | +| `*` | *serves* `application/json` | + +A Golang implementation to fetch the OpenAPI V3 is provided in the package +[`k8s.io/client-go/openapi3`](https://pkg.go.dev/k8s.io/client-go/openapi3). + +Kubernetes 1.31 publishes +OpenAPI v2.0 and v3.0; there are no plans to support 3.1 in the near future. + +### Protobuf serialization + +Kubernetes implements an alternative Protobuf based serialization format that +is primarily intended for intra-cluster communication. For more information +about this format, see the [Kubernetes Protobuf serialization](https://git.k8s.io/design-proposals-archive/api-machinery/protobuf.md) +design proposal and the +Interface Definition Language (IDL) files for each schema located in the Go +packages that define the API objects. + +## Persistence + +Kubernetes stores the serialized state of objects by writing them into +[etcd](/docs/tasks/administer-cluster/configure-upgrade-etcd/ "Consistent and highly-available key value store used as backing store of Kubernetes for all cluster data."). + +## API groups and versioning + +To make it easier to eliminate fields or restructure resource representations, +Kubernetes supports multiple API versions, each at a different API path, such +as `/api/v1` or `/apis/rbac.authorization.k8s.io/v1alpha1`. + +Versioning is done at the API level rather than at the resource or field level +to ensure that the API presents a clear, consistent view of system resources +and behavior, and to enable controlling access to end-of-life and/or +experimental APIs. + +To make it easier to evolve and to extend its API, Kubernetes implements +[API groups](/docs/reference/using-api/#api-groups) that can be +[enabled or disabled](/docs/reference/using-api/#enabling-or-disabling). + +API resources are distinguished by their API group, resource type, namespace +(for namespaced resources), and name. The API server handles the conversion between +API versions transparently: all the different versions are actually representations +of the same persisted data. The API server may serve the same underlying data +through multiple API versions. + +For example, suppose there are two API versions, `v1` and `v1beta1`, for the same +resource. If you originally created an object using the `v1beta1` version of its +API, you can later read, update, or delete that object using either the `v1beta1` +or the `v1` API version, until the `v1beta1` version is deprecated and removed. +At that point you can continue accessing and modifying the object using the `v1` API. + +### API changes + +Any system that is successful needs to grow and change as new use cases emerge or existing ones change. +Therefore, Kubernetes has designed the Kubernetes API to continuously change and grow. +The Kubernetes project aims to *not* break compatibility with existing clients, and to maintain that +compatibility for a length of time so that other projects have an opportunity to adapt. + +In general, new API resources and new resource fields can be added often and frequently. +Elimination of resources or fields requires following the +[API deprecation policy](/docs/reference/using-api/deprecation-policy/). + +Kubernetes makes a strong commitment to maintain compatibility for official Kubernetes APIs +once they reach general availability (GA), typically at API version `v1`. Additionally, +Kubernetes maintains compatibility with data persisted via *beta* API versions of official Kubernetes APIs, +and ensures that data can be converted and accessed via GA API versions when the feature goes stable. + +If you adopt a beta API version, you will need to transition to a subsequent beta or stable API version +once the API graduates. The best time to do this is while the beta API is in its deprecation period, +since objects are simultaneously accessible via both API versions. Once the beta API completes its +deprecation period and is no longer served, the replacement API version must be used. + +#### Note: + +Although Kubernetes also aims to maintain compatibility for *alpha* APIs versions, in some +circumstances this is not possible. If you use any alpha API versions, check the release notes +for Kubernetes when upgrading your cluster, in case the API did change in incompatible +ways that require deleting all existing alpha objects prior to upgrade. + +Refer to [API versions reference](/docs/reference/using-api/#api-versioning) +for more details on the API version level definitions. + +## API Extension + +The Kubernetes API can be extended in one of two ways: + +1. [Custom resources](/docs/concepts/extend-kubernetes/api-extension/custom-resources/) + let you declaratively define how the API server should provide your chosen resource API. +2. You can also extend the Kubernetes API by implementing an + [aggregation layer](/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation/). + +## What's next + +* Learn how to extend the Kubernetes API by adding your own + [CustomResourceDefinition](/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/). +* [Controlling Access To The Kubernetes API](/docs/concepts/security/controlling-access/) describes + how the cluster manages authentication and authorization for API access. +* Learn about API endpoints, resource types and samples by reading + [API Reference](/docs/reference/kubernetes-api/). +* Learn about what constitutes a compatible change, and how to change the API, from + [API changes](https://git.k8s.io/community/contributors/devel/sig-architecture/api_changes.md#readme). + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified September 10, 2024 at 7:15 AM PST: [Update kubernetes-api.md (b1cc8f7b3d)](https://github.com/kubernetes/website/commit/b1cc8f7b3d22d6b18ff10bd326dd66a6cff24589) diff --git a/corpus/docs/kubernetes/kubernetes-api/kubernetes-api_v132.md b/corpus/docs/kubernetes/kubernetes-api/kubernetes-api_v132.md new file mode 100644 index 0000000000000000000000000000000000000000..50bd13131c8245f4825ea161f772ca442abd4bb1 --- /dev/null +++ b/corpus/docs/kubernetes/kubernetes-api/kubernetes-api_v132.md @@ -0,0 +1,337 @@ +# The Kubernetes API + +Source: https://v1-32.docs.kubernetes.io/docs/concepts/overview/kubernetes-api/ +Version: v1.32 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Concepts](https://kubernetes.io/docs/concepts/) +3. [Overview](https://kubernetes.io/docs/concepts/overview/) +4. [The Kubernetes API](https://kubernetes.io/docs/concepts/overview/kubernetes-api/) + +### You are viewing documentation for Kubernetes version: v1.32 + +Kubernetes v1.32 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date information, see the +[latest version.](https://kubernetes.io/docs/home/) + +The Kubernetes API lets you query and manipulate the state of objects in Kubernetes. The core of Kubernetes' control plane is the API server and the HTTP API that it exposes. Users, the different parts of your cluster, and external components all communicate with one another through the API server. + +The core of Kubernetes' [control plane](/docs/reference/glossary/?all=true#term-control-plane "The container orchestration layer that exposes the API and interfaces to define, deploy, and manage the lifecycle of containers.") +is the [API server](/docs/concepts/architecture/#kube-apiserver "Control plane component that serves the Kubernetes API."). The API server +exposes an HTTP API that lets end users, different parts of your cluster, and +external components communicate with one another. + +The Kubernetes API lets you query and manipulate the state of API objects in Kubernetes +(for example: Pods, Namespaces, ConfigMaps, and Events). + +Most operations can be performed through the [kubectl](/docs/reference/kubectl/) +command-line interface or other command-line tools, such as +[kubeadm](/docs/reference/setup-tools/kubeadm/), which in turn use the API. +However, you can also access the API directly using REST calls. Kubernetes +provides a set of [client libraries](/docs/reference/using-api/client-libraries/) +for those looking to +write applications using the Kubernetes API. + +Each Kubernetes cluster publishes the specification of the APIs that the cluster serves. +There are two mechanisms that Kubernetes uses to publish these API specifications; both are useful +to enable automatic interoperability. For example, the `kubectl` tool fetches and caches the API +specification for enabling command-line completion and other features. +The two supported mechanisms are as follows: + +* [The Discovery API](#discovery-api) provides information about the Kubernetes APIs: + API names, resources, versions, and supported operations. This is a Kubernetes + specific term as it is a separate API from the Kubernetes OpenAPI. + It is intended to be a brief summary of the available resources and it does not + detail specific schema for the resources. For reference about resource schemas, + please refer to the OpenAPI document. +* The [Kubernetes OpenAPI Document](#openapi-interface-definition) provides (full) + [OpenAPI v2.0 and 3.0 schemas](https://www.openapis.org/) for all Kubernetes API + endpoints. + The OpenAPI v3 is the preferred method for accessing OpenAPI as it + provides + a more comprehensive and accurate view of the API. It includes all the available + API paths, as well as all resources consumed and produced for every operations + on every endpoints. It also includes any extensibility components that a cluster supports. + The data is a complete specification and is significantly larger than that from the + Discovery API. + +## Discovery API + +Kubernetes publishes a list of all group versions and resources supported via +the Discovery API. This includes the following for each resource: + +* Name +* Cluster or namespaced scope +* Endpoint URL and supported verbs +* Alternative names +* Group, version, kind + +The API is available in both aggregated and unaggregated form. The aggregated +discovery serves two endpoints, while the unaggregated discovery serves a +separate endpoint for each group version. + +### Aggregated discovery + +FEATURE STATE: +`Kubernetes v1.30 [stable]` (enabled by default: true) + +Kubernetes offers stable support for *aggregated discovery*, publishing +all resources supported by a cluster through two endpoints (`/api` and +`/apis`). Requesting this +endpoint drastically reduces the number of requests sent to fetch the +discovery data from the cluster. You can access the data by +requesting the respective endpoints with an `Accept` header indicating +the aggregated discovery resource: +`Accept: application/json;v=v2;g=apidiscovery.k8s.io;as=APIGroupDiscoveryList`. + +Without indicating the resource type using the `Accept` header, the default +response for the `/api` and `/apis` endpoint is an unaggregated discovery +document. + +The [discovery document](https://github.com/kubernetes/kubernetes/blob/release-1.32/api/discovery/aggregated_v2.json) +for the built-in resources can be found in the Kubernetes GitHub repository. +This Github document can be used as a reference of the base set of the available resources +if a Kubernetes cluster is not available to query. + +The endpoint also supports ETag and protobuf encoding. + +### Unaggregated discovery + +Without discovery aggregation, discovery is published in levels, with the root +endpoints publishing discovery information for downstream documents. + +A list of all group versions supported by a cluster is published at +the `/api` and `/apis` endpoints. Example: + +```None +{ + "kind": "APIGroupList", + "apiVersion": "v1", + "groups": [ + { + "name": "apiregistration.k8s.io", + "versions": [ + { + "groupVersion": "apiregistration.k8s.io/v1", + "version": "v1" + } + ], + "preferredVersion": { + "groupVersion": "apiregistration.k8s.io/v1", + "version": "v1" + } + }, + { + "name": "apps", + "versions": [ + { + "groupVersion": "apps/v1", + "version": "v1" + } + ], + "preferredVersion": { + "groupVersion": "apps/v1", + "version": "v1" + } + }, + ... +} +``` + +Additional requests are needed to obtain the discovery document for each group version at +`/apis//` (for example: +`/apis/rbac.authorization.k8s.io/v1alpha1`), which advertises the list of +resources served under a particular group version. These endpoints are used by +kubectl to fetch the list of resources supported by a cluster. + +## OpenAPI interface definition + +For details about the OpenAPI specifications, see the [OpenAPI documentation](https://www.openapis.org/). + +Kubernetes serves both OpenAPI v2.0 and OpenAPI v3.0. OpenAPI v3 is the +preferred method of accessing the OpenAPI because it offers a more comprehensive +(lossless) representation of Kubernetes resources. Due to limitations of OpenAPI +version 2, certain fields are dropped from the published OpenAPI including but not +limited to `default`, `nullable`, `oneOf`. + +### OpenAPI V2 + +The Kubernetes API server serves an aggregated OpenAPI v2 spec via the +`/openapi/v2` endpoint. You can request the response format using +request headers as follows: + +Valid request header values for OpenAPI v2 queries + +| Header | Possible values | Notes | +| --- | --- | --- | +| `Accept-Encoding` | `gzip` | *not supplying this header is also acceptable* | +| `Accept` | `application/com.github.proto-openapi.spec.v2@v1.0+protobuf` | *mainly for intra-cluster use* | +| `application/json` | *default* | +| `*` | *serves* `application/json` | + +#### Warning: + +The validation rules published as part of OpenAPI schemas may not be complete, and usually aren't. +Additional validation occurs within the API server. If you want precise and complete verification, +a `kubectl apply --dry-run=server` runs all the applicable validation (and also activates admission-time +checks). + +### OpenAPI V3 + +FEATURE STATE: +`Kubernetes v1.27 [stable]` (enabled by default: true) + +Kubernetes supports publishing a description of its APIs as OpenAPI v3. + +A discovery endpoint `/openapi/v3` is provided to see a list of all +group/versions available. This endpoint only returns JSON. These +group/versions are provided in the following format: + +```None +{ + "paths": { + ..., + "api/v1": { + "serverRelativeURL": "/openapi/v3/api/v1?hash=CC0E9BFD992D8C59AEC98A1E2336F899E8318D3CF4C68944C3DEC640AF5AB52D864AC50DAA8D145B3494F75FA3CFF939FCBDDA431DAD3CA79738B297795818CF" + }, + "apis/admissionregistration.k8s.io/v1": { + "serverRelativeURL": "/openapi/v3/apis/admissionregistration.k8s.io/v1?hash=E19CC93A116982CE5422FC42B590A8AFAD92CDE9AE4D59B5CAAD568F083AD07946E6CB5817531680BCE6E215C16973CD39003B0425F3477CFD854E89A9DB6597" + }, + .... + } +} +``` + +The relative URLs are pointing to immutable OpenAPI descriptions, in +order to improve client-side caching. The proper HTTP caching headers +are also set by the API server for that purpose (`Expires` to 1 year in +the future, and `Cache-Control` to `immutable`). When an obsolete URL is +used, the API server returns a redirect to the newest URL. + +The Kubernetes API server publishes an OpenAPI v3 spec per Kubernetes +group version at the `/openapi/v3/apis//?hash=` +endpoint. + +Refer to the table below for accepted request headers. + +Valid request header values for OpenAPI v3 queries + +| Header | Possible values | Notes | +| --- | --- | --- | +| `Accept-Encoding` | `gzip` | *not supplying this header is also acceptable* | +| `Accept` | `application/com.github.proto-openapi.spec.v3@v1.0+protobuf` | *mainly for intra-cluster use* | +| `application/json` | *default* | +| `*` | *serves* `application/json` | + +A Golang implementation to fetch the OpenAPI V3 is provided in the package +[`k8s.io/client-go/openapi3`](https://pkg.go.dev/k8s.io/client-go/openapi3). + +Kubernetes 1.32 publishes +OpenAPI v2.0 and v3.0; there are no plans to support 3.1 in the near future. + +### Protobuf serialization + +Kubernetes implements an alternative Protobuf based serialization format that +is primarily intended for intra-cluster communication. For more information +about this format, see the [Kubernetes Protobuf serialization](https://git.k8s.io/design-proposals-archive/api-machinery/protobuf.md) +design proposal and the +Interface Definition Language (IDL) files for each schema located in the Go +packages that define the API objects. + +## Persistence + +Kubernetes stores the serialized state of objects by writing them into +[etcd](/docs/tasks/administer-cluster/configure-upgrade-etcd/ "Consistent and highly-available key value store used as backing store of Kubernetes for all cluster data."). + +## API groups and versioning + +To make it easier to eliminate fields or restructure resource representations, +Kubernetes supports multiple API versions, each at a different API path, such +as `/api/v1` or `/apis/rbac.authorization.k8s.io/v1alpha1`. + +Versioning is done at the API level rather than at the resource or field level +to ensure that the API presents a clear, consistent view of system resources +and behavior, and to enable controlling access to end-of-life and/or +experimental APIs. + +To make it easier to evolve and to extend its API, Kubernetes implements +[API groups](/docs/reference/using-api/#api-groups) that can be +[enabled or disabled](/docs/reference/using-api/#enabling-or-disabling). + +API resources are distinguished by their API group, resource type, namespace +(for namespaced resources), and name. The API server handles the conversion between +API versions transparently: all the different versions are actually representations +of the same persisted data. The API server may serve the same underlying data +through multiple API versions. + +For example, suppose there are two API versions, `v1` and `v1beta1`, for the same +resource. If you originally created an object using the `v1beta1` version of its +API, you can later read, update, or delete that object using either the `v1beta1` +or the `v1` API version, until the `v1beta1` version is deprecated and removed. +At that point you can continue accessing and modifying the object using the `v1` API. + +### API changes + +Any system that is successful needs to grow and change as new use cases emerge or existing ones change. +Therefore, Kubernetes has designed the Kubernetes API to continuously change and grow. +The Kubernetes project aims to *not* break compatibility with existing clients, and to maintain that +compatibility for a length of time so that other projects have an opportunity to adapt. + +In general, new API resources and new resource fields can be added often and frequently. +Elimination of resources or fields requires following the +[API deprecation policy](/docs/reference/using-api/deprecation-policy/). + +Kubernetes makes a strong commitment to maintain compatibility for official Kubernetes APIs +once they reach general availability (GA), typically at API version `v1`. Additionally, +Kubernetes maintains compatibility with data persisted via *beta* API versions of official Kubernetes APIs, +and ensures that data can be converted and accessed via GA API versions when the feature goes stable. + +If you adopt a beta API version, you will need to transition to a subsequent beta or stable API version +once the API graduates. The best time to do this is while the beta API is in its deprecation period, +since objects are simultaneously accessible via both API versions. Once the beta API completes its +deprecation period and is no longer served, the replacement API version must be used. + +#### Note: + +Although Kubernetes also aims to maintain compatibility for *alpha* APIs versions, in some +circumstances this is not possible. If you use any alpha API versions, check the release notes +for Kubernetes when upgrading your cluster, in case the API did change in incompatible +ways that require deleting all existing alpha objects prior to upgrade. + +Refer to [API versions reference](/docs/reference/using-api/#api-versioning) +for more details on the API version level definitions. + +## API Extension + +The Kubernetes API can be extended in one of two ways: + +1. [Custom resources](/docs/concepts/extend-kubernetes/api-extension/custom-resources/) + let you declaratively define how the API server should provide your chosen resource API. +2. You can also extend the Kubernetes API by implementing an + [aggregation layer](/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation/). + +## What's next + +* Learn how to extend the Kubernetes API by adding your own + [CustomResourceDefinition](/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/). +* [Controlling Access To The Kubernetes API](/docs/concepts/security/controlling-access/) describes + how the cluster manages authentication and authorization for API access. +* Learn about API endpoints, resource types and samples by reading + [API Reference](/docs/reference/kubernetes-api/). +* Learn about what constitutes a compatible change, and how to change the API, from + [API changes](https://git.k8s.io/community/contributors/devel/sig-architecture/api_changes.md#readme). + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified January 08, 2025 at 10:50 AM PST: [Fix feature gate name conflicts (2/2) (3782732ce4)](https://github.com/kubernetes/website/commit/3782732ce415e1008ba589954371332b67993a66) diff --git a/corpus/docs/kubernetes/kubernetes-api/kubernetes-api_v133.md b/corpus/docs/kubernetes/kubernetes-api/kubernetes-api_v133.md new file mode 100644 index 0000000000000000000000000000000000000000..f3cba7d7b896c7b0ada466e33ee4ec3d0fbe8ce4 --- /dev/null +++ b/corpus/docs/kubernetes/kubernetes-api/kubernetes-api_v133.md @@ -0,0 +1,337 @@ +# The Kubernetes API + +Source: https://v1-33.docs.kubernetes.io/docs/concepts/overview/kubernetes-api/ +Version: v1.33 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Concepts](https://kubernetes.io/docs/concepts/) +3. [Overview](https://kubernetes.io/docs/concepts/overview/) +4. [The Kubernetes API](https://kubernetes.io/docs/concepts/overview/kubernetes-api/) + +### You are viewing documentation for Kubernetes version: v1.33 + +Kubernetes v1.33 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date information, see the +[latest version.](https://kubernetes.io/docs/home/) + +The Kubernetes API lets you query and manipulate the state of objects in Kubernetes. The core of Kubernetes' control plane is the API server and the HTTP API that it exposes. Users, the different parts of your cluster, and external components all communicate with one another through the API server. + +The core of Kubernetes' [control plane](/docs/reference/glossary/?all=true#term-control-plane "The container orchestration layer that exposes the API and interfaces to define, deploy, and manage the lifecycle of containers.") +is the [API server](/docs/concepts/architecture/#kube-apiserver "Control plane component that serves the Kubernetes API."). The API server +exposes an HTTP API that lets end users, different parts of your cluster, and +external components communicate with one another. + +The Kubernetes API lets you query and manipulate the state of API objects in Kubernetes +(for example: Pods, Namespaces, ConfigMaps, and Events). + +Most operations can be performed through the [kubectl](/docs/reference/kubectl/) +command-line interface or other command-line tools, such as +[kubeadm](/docs/reference/setup-tools/kubeadm/), which in turn use the API. +However, you can also access the API directly using REST calls. Kubernetes +provides a set of [client libraries](/docs/reference/using-api/client-libraries/) +for those looking to +write applications using the Kubernetes API. + +Each Kubernetes cluster publishes the specification of the APIs that the cluster serves. +There are two mechanisms that Kubernetes uses to publish these API specifications; both are useful +to enable automatic interoperability. For example, the `kubectl` tool fetches and caches the API +specification for enabling command-line completion and other features. +The two supported mechanisms are as follows: + +* [The Discovery API](#discovery-api) provides information about the Kubernetes APIs: + API names, resources, versions, and supported operations. This is a Kubernetes + specific term as it is a separate API from the Kubernetes OpenAPI. + It is intended to be a brief summary of the available resources and it does not + detail specific schema for the resources. For reference about resource schemas, + please refer to the OpenAPI document. +* The [Kubernetes OpenAPI Document](#openapi-interface-definition) provides (full) + [OpenAPI v2.0 and 3.0 schemas](https://www.openapis.org/) for all Kubernetes API + endpoints. + The OpenAPI v3 is the preferred method for accessing OpenAPI as it + provides + a more comprehensive and accurate view of the API. It includes all the available + API paths, as well as all resources consumed and produced for every operations + on every endpoints. It also includes any extensibility components that a cluster supports. + The data is a complete specification and is significantly larger than that from the + Discovery API. + +## Discovery API + +Kubernetes publishes a list of all group versions and resources supported via +the Discovery API. This includes the following for each resource: + +* Name +* Cluster or namespaced scope +* Endpoint URL and supported verbs +* Alternative names +* Group, version, kind + +The API is available in both aggregated and unaggregated form. The aggregated +discovery serves two endpoints, while the unaggregated discovery serves a +separate endpoint for each group version. + +### Aggregated discovery + +FEATURE STATE: +`Kubernetes v1.30 [stable]` (enabled by default: true) + +Kubernetes offers stable support for *aggregated discovery*, publishing +all resources supported by a cluster through two endpoints (`/api` and +`/apis`). Requesting this +endpoint drastically reduces the number of requests sent to fetch the +discovery data from the cluster. You can access the data by +requesting the respective endpoints with an `Accept` header indicating +the aggregated discovery resource: +`Accept: application/json;v=v2;g=apidiscovery.k8s.io;as=APIGroupDiscoveryList`. + +Without indicating the resource type using the `Accept` header, the default +response for the `/api` and `/apis` endpoint is an unaggregated discovery +document. + +The [discovery document](https://github.com/kubernetes/kubernetes/blob/release-1.33/api/discovery/aggregated_v2.json) +for the built-in resources can be found in the Kubernetes GitHub repository. +This Github document can be used as a reference of the base set of the available resources +if a Kubernetes cluster is not available to query. + +The endpoint also supports ETag and protobuf encoding. + +### Unaggregated discovery + +Without discovery aggregation, discovery is published in levels, with the root +endpoints publishing discovery information for downstream documents. + +A list of all group versions supported by a cluster is published at +the `/api` and `/apis` endpoints. Example: + +```None +{ + "kind": "APIGroupList", + "apiVersion": "v1", + "groups": [ + { + "name": "apiregistration.k8s.io", + "versions": [ + { + "groupVersion": "apiregistration.k8s.io/v1", + "version": "v1" + } + ], + "preferredVersion": { + "groupVersion": "apiregistration.k8s.io/v1", + "version": "v1" + } + }, + { + "name": "apps", + "versions": [ + { + "groupVersion": "apps/v1", + "version": "v1" + } + ], + "preferredVersion": { + "groupVersion": "apps/v1", + "version": "v1" + } + }, + ... +} +``` + +Additional requests are needed to obtain the discovery document for each group version at +`/apis//` (for example: +`/apis/rbac.authorization.k8s.io/v1alpha1`), which advertises the list of +resources served under a particular group version. These endpoints are used by +kubectl to fetch the list of resources supported by a cluster. + +## OpenAPI interface definition + +For details about the OpenAPI specifications, see the [OpenAPI documentation](https://www.openapis.org/). + +Kubernetes serves both OpenAPI v2.0 and OpenAPI v3.0. OpenAPI v3 is the +preferred method of accessing the OpenAPI because it offers a more comprehensive +(lossless) representation of Kubernetes resources. Due to limitations of OpenAPI +version 2, certain fields are dropped from the published OpenAPI including but not +limited to `default`, `nullable`, `oneOf`. + +### OpenAPI V2 + +The Kubernetes API server serves an aggregated OpenAPI v2 spec via the +`/openapi/v2` endpoint. You can request the response format using +request headers as follows: + +Valid request header values for OpenAPI v2 queries + +| Header | Possible values | Notes | +| --- | --- | --- | +| `Accept-Encoding` | `gzip` | *not supplying this header is also acceptable* | +| `Accept` | `application/com.github.proto-openapi.spec.v2@v1.0+protobuf` | *mainly for intra-cluster use* | +| `application/json` | *default* | +| `*` | *serves* `application/json` | + +#### Warning: + +The validation rules published as part of OpenAPI schemas may not be complete, and usually aren't. +Additional validation occurs within the API server. If you want precise and complete verification, +a `kubectl apply --dry-run=server` runs all the applicable validation (and also activates admission-time +checks). + +### OpenAPI V3 + +FEATURE STATE: +`Kubernetes v1.27 [stable]` (enabled by default: true) + +Kubernetes supports publishing a description of its APIs as OpenAPI v3. + +A discovery endpoint `/openapi/v3` is provided to see a list of all +group/versions available. This endpoint only returns JSON. These +group/versions are provided in the following format: + +```None +{ + "paths": { + ..., + "api/v1": { + "serverRelativeURL": "/openapi/v3/api/v1?hash=CC0E9BFD992D8C59AEC98A1E2336F899E8318D3CF4C68944C3DEC640AF5AB52D864AC50DAA8D145B3494F75FA3CFF939FCBDDA431DAD3CA79738B297795818CF" + }, + "apis/admissionregistration.k8s.io/v1": { + "serverRelativeURL": "/openapi/v3/apis/admissionregistration.k8s.io/v1?hash=E19CC93A116982CE5422FC42B590A8AFAD92CDE9AE4D59B5CAAD568F083AD07946E6CB5817531680BCE6E215C16973CD39003B0425F3477CFD854E89A9DB6597" + }, + .... + } +} +``` + +The relative URLs are pointing to immutable OpenAPI descriptions, in +order to improve client-side caching. The proper HTTP caching headers +are also set by the API server for that purpose (`Expires` to 1 year in +the future, and `Cache-Control` to `immutable`). When an obsolete URL is +used, the API server returns a redirect to the newest URL. + +The Kubernetes API server publishes an OpenAPI v3 spec per Kubernetes +group version at the `/openapi/v3/apis//?hash=` +endpoint. + +Refer to the table below for accepted request headers. + +Valid request header values for OpenAPI v3 queries + +| Header | Possible values | Notes | +| --- | --- | --- | +| `Accept-Encoding` | `gzip` | *not supplying this header is also acceptable* | +| `Accept` | `application/com.github.proto-openapi.spec.v3@v1.0+protobuf` | *mainly for intra-cluster use* | +| `application/json` | *default* | +| `*` | *serves* `application/json` | + +A Golang implementation to fetch the OpenAPI V3 is provided in the package +[`k8s.io/client-go/openapi3`](https://pkg.go.dev/k8s.io/client-go/openapi3). + +Kubernetes 1.33 publishes +OpenAPI v2.0 and v3.0; there are no plans to support 3.1 in the near future. + +### Protobuf serialization + +Kubernetes implements an alternative Protobuf based serialization format that +is primarily intended for intra-cluster communication. For more information +about this format, see the [Kubernetes Protobuf serialization](https://git.k8s.io/design-proposals-archive/api-machinery/protobuf.md) +design proposal and the +Interface Definition Language (IDL) files for each schema located in the Go +packages that define the API objects. + +## Persistence + +Kubernetes stores the serialized state of objects by writing them into +[etcd](/docs/tasks/administer-cluster/configure-upgrade-etcd/ "Consistent and highly-available key value store used as backing store of Kubernetes for all cluster data."). + +## API groups and versioning + +To make it easier to eliminate fields or restructure resource representations, +Kubernetes supports multiple API versions, each at a different API path, such +as `/api/v1` or `/apis/rbac.authorization.k8s.io/v1alpha1`. + +Versioning is done at the API level rather than at the resource or field level +to ensure that the API presents a clear, consistent view of system resources +and behavior, and to enable controlling access to end-of-life and/or +experimental APIs. + +To make it easier to evolve and to extend its API, Kubernetes implements +[API groups](/docs/reference/using-api/#api-groups) that can be +[enabled or disabled](/docs/reference/using-api/#enabling-or-disabling). + +API resources are distinguished by their API group, resource type, namespace +(for namespaced resources), and name. The API server handles the conversion between +API versions transparently: all the different versions are actually representations +of the same persisted data. The API server may serve the same underlying data +through multiple API versions. + +For example, suppose there are two API versions, `v1` and `v1beta1`, for the same +resource. If you originally created an object using the `v1beta1` version of its +API, you can later read, update, or delete that object using either the `v1beta1` +or the `v1` API version, until the `v1beta1` version is deprecated and removed. +At that point you can continue accessing and modifying the object using the `v1` API. + +### API changes + +Any system that is successful needs to grow and change as new use cases emerge or existing ones change. +Therefore, Kubernetes has designed the Kubernetes API to continuously change and grow. +The Kubernetes project aims to *not* break compatibility with existing clients, and to maintain that +compatibility for a length of time so that other projects have an opportunity to adapt. + +In general, new API resources and new resource fields can be added often and frequently. +Elimination of resources or fields requires following the +[API deprecation policy](/docs/reference/using-api/deprecation-policy/). + +Kubernetes makes a strong commitment to maintain compatibility for official Kubernetes APIs +once they reach general availability (GA), typically at API version `v1`. Additionally, +Kubernetes maintains compatibility with data persisted via *beta* API versions of official Kubernetes APIs, +and ensures that data can be converted and accessed via GA API versions when the feature goes stable. + +If you adopt a beta API version, you will need to transition to a subsequent beta or stable API version +once the API graduates. The best time to do this is while the beta API is in its deprecation period, +since objects are simultaneously accessible via both API versions. Once the beta API completes its +deprecation period and is no longer served, the replacement API version must be used. + +#### Note: + +Although Kubernetes also aims to maintain compatibility for *alpha* APIs versions, in some +circumstances this is not possible. If you use any alpha API versions, check the release notes +for Kubernetes when upgrading your cluster, in case the API did change in incompatible +ways that require deleting all existing alpha objects prior to upgrade. + +Refer to [API versions reference](/docs/reference/using-api/#api-versioning) +for more details on the API version level definitions. + +## API Extension + +The Kubernetes API can be extended in one of two ways: + +1. [Custom resources](/docs/concepts/extend-kubernetes/api-extension/custom-resources/) + let you declaratively define how the API server should provide your chosen resource API. +2. You can also extend the Kubernetes API by implementing an + [aggregation layer](/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation/). + +## What's next + +* Learn how to extend the Kubernetes API by adding your own + [CustomResourceDefinition](/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/). +* [Controlling Access To The Kubernetes API](/docs/concepts/security/controlling-access/) describes + how the cluster manages authentication and authorization for API access. +* Learn about API endpoints, resource types and samples by reading + [API Reference](/docs/reference/kubernetes-api/). +* Learn about what constitutes a compatible change, and how to change the API, from + [API changes](https://git.k8s.io/community/contributors/devel/sig-architecture/api_changes.md#readme). + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified January 08, 2025 at 10:50 AM PST: [Fix feature gate name conflicts (2/2) (3782732ce4)](https://github.com/kubernetes/website/commit/3782732ce415e1008ba589954371332b67993a66) diff --git a/corpus/docs/kubernetes/kubernetes-api/kubernetes-api_v134.md b/corpus/docs/kubernetes/kubernetes-api/kubernetes-api_v134.md new file mode 100644 index 0000000000000000000000000000000000000000..00b2c871d7e160f24b0a512c300bc7114e6054f8 --- /dev/null +++ b/corpus/docs/kubernetes/kubernetes-api/kubernetes-api_v134.md @@ -0,0 +1,337 @@ +# The Kubernetes API + +Source: https://v1-34.docs.kubernetes.io/docs/concepts/overview/kubernetes-api/ +Version: v1.34 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Concepts](https://kubernetes.io/docs/concepts/) +3. [Overview](https://kubernetes.io/docs/concepts/overview/) +4. [The Kubernetes API](https://kubernetes.io/docs/concepts/overview/kubernetes-api/) + +### You are viewing documentation for Kubernetes version: v1.34 + +Kubernetes v1.34 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date information, see the +[latest version.](https://kubernetes.io/docs/home/) + +The Kubernetes API lets you query and manipulate the state of objects in Kubernetes. The core of Kubernetes' control plane is the API server and the HTTP API that it exposes. Users, the different parts of your cluster, and external components all communicate with one another through the API server. + +The core of Kubernetes' [control plane](/docs/reference/glossary/?all=true#term-control-plane "The container orchestration layer that exposes the API and interfaces to define, deploy, and manage the lifecycle of containers.") +is the [API server](/docs/concepts/architecture/#kube-apiserver "Control plane component that serves the Kubernetes API."). The API server +exposes an HTTP API that lets end users, different parts of your cluster, and +external components communicate with one another. + +The Kubernetes API lets you query and manipulate the state of API objects in Kubernetes +(for example: Pods, Namespaces, ConfigMaps, and Events). + +Most operations can be performed through the [kubectl](/docs/reference/kubectl/) +command-line interface or other command-line tools, such as +[kubeadm](/docs/reference/setup-tools/kubeadm/), which in turn use the API. +However, you can also access the API directly using REST calls. Kubernetes +provides a set of [client libraries](/docs/reference/using-api/client-libraries/) +for those looking to +write applications using the Kubernetes API. + +Each Kubernetes cluster publishes the specification of the APIs that the cluster serves. +There are two mechanisms that Kubernetes uses to publish these API specifications; both are useful +to enable automatic interoperability. For example, the `kubectl` tool fetches and caches the API +specification for enabling command-line completion and other features. +The two supported mechanisms are as follows: + +* [The Discovery API](#discovery-api) provides information about the Kubernetes APIs: + API names, resources, versions, and supported operations. This is a Kubernetes + specific term as it is a separate API from the Kubernetes OpenAPI. + It is intended to be a brief summary of the available resources and it does not + detail specific schema for the resources. For reference about resource schemas, + please refer to the OpenAPI document. +* The [Kubernetes OpenAPI Document](#openapi-interface-definition) provides (full) + [OpenAPI v2.0 and 3.0 schemas](https://www.openapis.org/) for all Kubernetes API + endpoints. + The OpenAPI v3 is the preferred method for accessing OpenAPI as it + provides + a more comprehensive and accurate view of the API. It includes all the available + API paths, as well as all resources consumed and produced for every operations + on every endpoints. It also includes any extensibility components that a cluster supports. + The data is a complete specification and is significantly larger than that from the + Discovery API. + +## Discovery API + +Kubernetes publishes a list of all group versions and resources supported via +the Discovery API. This includes the following for each resource: + +* Name +* Cluster or namespaced scope +* Endpoint URL and supported verbs +* Alternative names +* Group, version, kind + +The API is available in both aggregated and unaggregated form. The aggregated +discovery serves two endpoints, while the unaggregated discovery serves a +separate endpoint for each group version. + +### Aggregated discovery + +FEATURE STATE: +`Kubernetes v1.30 [stable]`(enabled by default) + +Kubernetes offers stable support for *aggregated discovery*, publishing +all resources supported by a cluster through two endpoints (`/api` and +`/apis`). Requesting this +endpoint drastically reduces the number of requests sent to fetch the +discovery data from the cluster. You can access the data by +requesting the respective endpoints with an `Accept` header indicating +the aggregated discovery resource: +`Accept: application/json;v=v2;g=apidiscovery.k8s.io;as=APIGroupDiscoveryList`. + +Without indicating the resource type using the `Accept` header, the default +response for the `/api` and `/apis` endpoint is an unaggregated discovery +document. + +The [discovery document](https://github.com/kubernetes/kubernetes/blob/release-1.34/api/discovery/aggregated_v2.json) +for the built-in resources can be found in the Kubernetes GitHub repository. +This Github document can be used as a reference of the base set of the available resources +if a Kubernetes cluster is not available to query. + +The endpoint also supports ETag and protobuf encoding. + +### Unaggregated discovery + +Without discovery aggregation, discovery is published in levels, with the root +endpoints publishing discovery information for downstream documents. + +A list of all group versions supported by a cluster is published at +the `/api` and `/apis` endpoints. Example: + +```None +{ + "kind": "APIGroupList", + "apiVersion": "v1", + "groups": [ + { + "name": "apiregistration.k8s.io", + "versions": [ + { + "groupVersion": "apiregistration.k8s.io/v1", + "version": "v1" + } + ], + "preferredVersion": { + "groupVersion": "apiregistration.k8s.io/v1", + "version": "v1" + } + }, + { + "name": "apps", + "versions": [ + { + "groupVersion": "apps/v1", + "version": "v1" + } + ], + "preferredVersion": { + "groupVersion": "apps/v1", + "version": "v1" + } + }, + ... +} +``` + +Additional requests are needed to obtain the discovery document for each group version at +`/apis//` (for example: +`/apis/rbac.authorization.k8s.io/v1alpha1`), which advertises the list of +resources served under a particular group version. These endpoints are used by +kubectl to fetch the list of resources supported by a cluster. + +## OpenAPI interface definition + +For details about the OpenAPI specifications, see the [OpenAPI documentation](https://www.openapis.org/). + +Kubernetes serves both OpenAPI v2.0 and OpenAPI v3.0. OpenAPI v3 is the +preferred method of accessing the OpenAPI because it offers a more comprehensive +(lossless) representation of Kubernetes resources. Due to limitations of OpenAPI +version 2, certain fields are dropped from the published OpenAPI including but not +limited to `default`, `nullable`, `oneOf`. + +### OpenAPI V2 + +The Kubernetes API server serves an aggregated OpenAPI v2 spec via the +`/openapi/v2` endpoint. You can request the response format using +request headers as follows: + +Valid request header values for OpenAPI v2 queries + +| Header | Possible values | Notes | +| --- | --- | --- | +| `Accept-Encoding` | `gzip` | *not supplying this header is also acceptable* | +| `Accept` | `application/com.github.proto-openapi.spec.v2@v1.0+protobuf` | *mainly for intra-cluster use* | +| `application/json` | *default* | +| `*` | *serves* `application/json` | + +#### Warning: + +The validation rules published as part of OpenAPI schemas may not be complete, and usually aren't. +Additional validation occurs within the API server. If you want precise and complete verification, +a `kubectl apply --dry-run=server` runs all the applicable validation (and also activates admission-time +checks). + +### OpenAPI V3 + +FEATURE STATE: +`Kubernetes v1.27 [stable]`(enabled by default) + +Kubernetes supports publishing a description of its APIs as OpenAPI v3. + +A discovery endpoint `/openapi/v3` is provided to see a list of all +group/versions available. This endpoint only returns JSON. These +group/versions are provided in the following format: + +```None +{ + "paths": { + ..., + "api/v1": { + "serverRelativeURL": "/openapi/v3/api/v1?hash=CC0E9BFD992D8C59AEC98A1E2336F899E8318D3CF4C68944C3DEC640AF5AB52D864AC50DAA8D145B3494F75FA3CFF939FCBDDA431DAD3CA79738B297795818CF" + }, + "apis/admissionregistration.k8s.io/v1": { + "serverRelativeURL": "/openapi/v3/apis/admissionregistration.k8s.io/v1?hash=E19CC93A116982CE5422FC42B590A8AFAD92CDE9AE4D59B5CAAD568F083AD07946E6CB5817531680BCE6E215C16973CD39003B0425F3477CFD854E89A9DB6597" + }, + .... + } +} +``` + +The relative URLs are pointing to immutable OpenAPI descriptions, in +order to improve client-side caching. The proper HTTP caching headers +are also set by the API server for that purpose (`Expires` to 1 year in +the future, and `Cache-Control` to `immutable`). When an obsolete URL is +used, the API server returns a redirect to the newest URL. + +The Kubernetes API server publishes an OpenAPI v3 spec per Kubernetes +group version at the `/openapi/v3/apis//?hash=` +endpoint. + +Refer to the table below for accepted request headers. + +Valid request header values for OpenAPI v3 queries + +| Header | Possible values | Notes | +| --- | --- | --- | +| `Accept-Encoding` | `gzip` | *not supplying this header is also acceptable* | +| `Accept` | `application/com.github.proto-openapi.spec.v3@v1.0+protobuf` | *mainly for intra-cluster use* | +| `application/json` | *default* | +| `*` | *serves* `application/json` | + +A Golang implementation to fetch the OpenAPI V3 is provided in the package +[`k8s.io/client-go/openapi3`](https://pkg.go.dev/k8s.io/client-go/openapi3). + +Kubernetes 1.34 publishes +OpenAPI v2.0 and v3.0; there are no plans to support 3.1 in the near future. + +### Protobuf serialization + +Kubernetes implements an alternative Protobuf based serialization format that +is primarily intended for intra-cluster communication. For more information +about this format, see the [Kubernetes Protobuf serialization](https://git.k8s.io/design-proposals-archive/api-machinery/protobuf.md) +design proposal and the +Interface Definition Language (IDL) files for each schema located in the Go +packages that define the API objects. + +## Persistence + +Kubernetes stores the serialized state of objects by writing them into +[etcd](/docs/tasks/administer-cluster/configure-upgrade-etcd/ "Consistent and highly-available key value store used as backing store of Kubernetes for all cluster data."). + +## API groups and versioning + +To make it easier to eliminate fields or restructure resource representations, +Kubernetes supports multiple API versions, each at a different API path, such +as `/api/v1` or `/apis/rbac.authorization.k8s.io/v1alpha1`. + +Versioning is done at the API level rather than at the resource or field level +to ensure that the API presents a clear, consistent view of system resources +and behavior, and to enable controlling access to end-of-life and/or +experimental APIs. + +To make it easier to evolve and to extend its API, Kubernetes implements +[API groups](/docs/reference/using-api/#api-groups) that can be +[enabled or disabled](/docs/reference/using-api/#enabling-or-disabling). + +API resources are distinguished by their API group, resource type, namespace +(for namespaced resources), and name. The API server handles the conversion between +API versions transparently: all the different versions are actually representations +of the same persisted data. The API server may serve the same underlying data +through multiple API versions. + +For example, suppose there are two API versions, `v1` and `v1beta1`, for the same +resource. If you originally created an object using the `v1beta1` version of its +API, you can later read, update, or delete that object using either the `v1beta1` +or the `v1` API version, until the `v1beta1` version is deprecated and removed. +At that point you can continue accessing and modifying the object using the `v1` API. + +### API changes + +Any system that is successful needs to grow and change as new use cases emerge or existing ones change. +Therefore, Kubernetes has designed the Kubernetes API to continuously change and grow. +The Kubernetes project aims to *not* break compatibility with existing clients, and to maintain that +compatibility for a length of time so that other projects have an opportunity to adapt. + +In general, new API resources and new resource fields can be added often and frequently. +Elimination of resources or fields requires following the +[API deprecation policy](/docs/reference/using-api/deprecation-policy/). + +Kubernetes makes a strong commitment to maintain compatibility for official Kubernetes APIs +once they reach general availability (GA), typically at API version `v1`. Additionally, +Kubernetes maintains compatibility with data persisted via *beta* API versions of official Kubernetes APIs, +and ensures that data can be converted and accessed via GA API versions when the feature goes stable. + +If you adopt a beta API version, you will need to transition to a subsequent beta or stable API version +once the API graduates. The best time to do this is while the beta API is in its deprecation period, +since objects are simultaneously accessible via both API versions. Once the beta API completes its +deprecation period and is no longer served, the replacement API version must be used. + +#### Note: + +Although Kubernetes also aims to maintain compatibility for *alpha* APIs versions, in some +circumstances this is not possible. If you use any alpha API versions, check the release notes +for Kubernetes when upgrading your cluster, in case the API did change in incompatible +ways that require deleting all existing alpha objects prior to upgrade. + +Refer to [API versions reference](/docs/reference/using-api/#api-versioning) +for more details on the API version level definitions. + +## API Extension + +The Kubernetes API can be extended in one of two ways: + +1. [Custom resources](/docs/concepts/extend-kubernetes/api-extension/custom-resources/) + let you declaratively define how the API server should provide your chosen resource API. +2. You can also extend the Kubernetes API by implementing an + [aggregation layer](/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation/). + +## What's next + +* Learn how to extend the Kubernetes API by adding your own + [CustomResourceDefinition](/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/). +* [Controlling Access To The Kubernetes API](/docs/concepts/security/controlling-access/) describes + how the cluster manages authentication and authorization for API access. +* Learn about API endpoints, resource types and samples by reading + [API Reference](/docs/reference/kubernetes-api/). +* Learn about what constitutes a compatible change, and how to change the API, from + [API changes](https://git.k8s.io/community/contributors/devel/sig-architecture/api_changes.md#readme). + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified January 08, 2025 at 10:50 AM PST: [Fix feature gate name conflicts (2/2) (3782732ce4)](https://github.com/kubernetes/website/commit/3782732ce415e1008ba589954371332b67993a66) diff --git a/corpus/docs/kubernetes/kubernetes-api/kubernetes-api_v135.md b/corpus/docs/kubernetes/kubernetes-api/kubernetes-api_v135.md new file mode 100644 index 0000000000000000000000000000000000000000..de0c0083f5d9f8a0e20b37d155b3173848bc565c --- /dev/null +++ b/corpus/docs/kubernetes/kubernetes-api/kubernetes-api_v135.md @@ -0,0 +1,332 @@ +# The Kubernetes API + +Source: https://kubernetes.io/docs/concepts/overview/kubernetes-api/ +Version: v1.35 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Concepts](https://kubernetes.io/docs/concepts/) +3. [Overview](https://kubernetes.io/docs/concepts/overview/) +4. [The Kubernetes API](https://kubernetes.io/docs/concepts/overview/kubernetes-api/) + +The Kubernetes API lets you query and manipulate the state of objects in Kubernetes. The core of Kubernetes' control plane is the API server and the HTTP API that it exposes. Users, the different parts of your cluster, and external components all communicate with one another through the API server. + +The core of Kubernetes' [control plane](/docs/reference/glossary/?all=true#term-control-plane "The container orchestration layer that exposes the API and interfaces to define, deploy, and manage the lifecycle of containers.") +is the [API server](/docs/concepts/architecture/#kube-apiserver "Control plane component that serves the Kubernetes API."). The API server +exposes an HTTP API that lets end users, different parts of your cluster, and +external components communicate with one another. + +The Kubernetes API lets you query and manipulate the state of API objects in Kubernetes +(for example: Pods, Namespaces, ConfigMaps, and Events). + +Most operations can be performed through the [kubectl](/docs/reference/kubectl/) +command-line interface or other command-line tools, such as +[kubeadm](/docs/reference/setup-tools/kubeadm/), which in turn use the API. +However, you can also access the API directly using REST calls. Kubernetes +provides a set of [client libraries](/docs/reference/using-api/client-libraries/) +for those looking to +write applications using the Kubernetes API. + +Each Kubernetes cluster publishes the specification of the APIs that the cluster serves. +There are two mechanisms that Kubernetes uses to publish these API specifications; both are useful +to enable automatic interoperability. For example, the `kubectl` tool fetches and caches the API +specification for enabling command-line completion and other features. +The two supported mechanisms are as follows: + +* [The Discovery API](#discovery-api) provides information about the Kubernetes APIs: + API names, resources, versions, and supported operations. This is a Kubernetes + specific term as it is a separate API from the Kubernetes OpenAPI. + It is intended to be a brief summary of the available resources and it does not + detail specific schema for the resources. For reference about resource schemas, + please refer to the OpenAPI document. +* The [Kubernetes OpenAPI Document](#openapi-interface-definition) provides (full) + [OpenAPI v2.0 and 3.0 schemas](https://www.openapis.org/) for all Kubernetes API + endpoints. + The OpenAPI v3 is the preferred method for accessing OpenAPI as it + provides + a more comprehensive and accurate view of the API. It includes all the available + API paths, as well as all resources consumed and produced for every operations + on every endpoints. It also includes any extensibility components that a cluster supports. + The data is a complete specification and is significantly larger than that from the + Discovery API. + +## Discovery API + +Kubernetes publishes a list of all group versions and resources supported via +the Discovery API. This includes the following for each resource: + +* Name +* Cluster or namespaced scope +* Endpoint URL and supported verbs +* Alternative names +* Group, version, kind + +The API is available in both aggregated and unaggregated form. The aggregated +discovery serves two endpoints, while the unaggregated discovery serves a +separate endpoint for each group version. + +### Aggregated discovery + +FEATURE STATE: +`Kubernetes v1.30 [stable]`(enabled by default) + +Kubernetes offers stable support for *aggregated discovery*, publishing +all resources supported by a cluster through two endpoints (`/api` and +`/apis`). Requesting this +endpoint drastically reduces the number of requests sent to fetch the +discovery data from the cluster. You can access the data by +requesting the respective endpoints with an `Accept` header indicating +the aggregated discovery resource: +`Accept: application/json;v=v2;g=apidiscovery.k8s.io;as=APIGroupDiscoveryList`. + +Without indicating the resource type using the `Accept` header, the default +response for the `/api` and `/apis` endpoint is an unaggregated discovery +document. + +The [discovery document](https://github.com/kubernetes/kubernetes/blob/release-1.35/api/discovery/aggregated_v2.json) +for the built-in resources can be found in the Kubernetes GitHub repository. +This Github document can be used as a reference of the base set of the available resources +if a Kubernetes cluster is not available to query. + +The endpoint also supports ETag and protobuf encoding. + +### Unaggregated discovery + +Without discovery aggregation, discovery is published in levels, with the root +endpoints publishing discovery information for downstream documents. + +A list of all group versions supported by a cluster is published at +the `/api` and `/apis` endpoints. Example: + +```None +{ + "kind": "APIGroupList", + "apiVersion": "v1", + "groups": [ + { + "name": "apiregistration.k8s.io", + "versions": [ + { + "groupVersion": "apiregistration.k8s.io/v1", + "version": "v1" + } + ], + "preferredVersion": { + "groupVersion": "apiregistration.k8s.io/v1", + "version": "v1" + } + }, + { + "name": "apps", + "versions": [ + { + "groupVersion": "apps/v1", + "version": "v1" + } + ], + "preferredVersion": { + "groupVersion": "apps/v1", + "version": "v1" + } + }, + ... +} +``` + +Additional requests are needed to obtain the discovery document for each group version at +`/apis//` (for example: +`/apis/rbac.authorization.k8s.io/v1alpha1`), which advertises the list of +resources served under a particular group version. These endpoints are used by +kubectl to fetch the list of resources supported by a cluster. + +## OpenAPI interface definition + +For details about the OpenAPI specifications, see the [OpenAPI documentation](https://www.openapis.org/). + +Kubernetes serves both OpenAPI v2.0 and OpenAPI v3.0. OpenAPI v3 is the +preferred method of accessing the OpenAPI because it offers a more comprehensive +(lossless) representation of Kubernetes resources. Due to limitations of OpenAPI +version 2, certain fields are dropped from the published OpenAPI including but not +limited to `default`, `nullable`, `oneOf`. + +### OpenAPI V2 + +The Kubernetes API server serves an aggregated OpenAPI v2 spec via the +`/openapi/v2` endpoint. You can request the response format using +request headers as follows: + +Valid request header values for OpenAPI v2 queries + +| Header | Possible values | Notes | +| --- | --- | --- | +| `Accept-Encoding` | `gzip` | *not supplying this header is also acceptable* | +| `Accept` | `application/com.github.proto-openapi.spec.v2@v1.0+protobuf` | *mainly for intra-cluster use* | +| `application/json` | *default* | +| `*` | *serves* `application/json` | + +#### Warning: + +The validation rules published as part of OpenAPI schemas may not be complete, and usually aren't. +Additional validation occurs within the API server. If you want precise and complete verification, +a `kubectl apply --dry-run=server` runs all the applicable validation (and also activates admission-time +checks). + +### OpenAPI V3 + +FEATURE STATE: +`Kubernetes v1.27 [stable]`(enabled by default) + +Kubernetes supports publishing a description of its APIs as OpenAPI v3. + +A discovery endpoint `/openapi/v3` is provided to see a list of all +group/versions available. This endpoint only returns JSON. These +group/versions are provided in the following format: + +```None +{ + "paths": { + ..., + "api/v1": { + "serverRelativeURL": "/openapi/v3/api/v1?hash=CC0E9BFD992D8C59AEC98A1E2336F899E8318D3CF4C68944C3DEC640AF5AB52D864AC50DAA8D145B3494F75FA3CFF939FCBDDA431DAD3CA79738B297795818CF" + }, + "apis/admissionregistration.k8s.io/v1": { + "serverRelativeURL": "/openapi/v3/apis/admissionregistration.k8s.io/v1?hash=E19CC93A116982CE5422FC42B590A8AFAD92CDE9AE4D59B5CAAD568F083AD07946E6CB5817531680BCE6E215C16973CD39003B0425F3477CFD854E89A9DB6597" + }, + .... + } +} +``` + +The relative URLs are pointing to immutable OpenAPI descriptions, in +order to improve client-side caching. The proper HTTP caching headers +are also set by the API server for that purpose (`Expires` to 1 year in +the future, and `Cache-Control` to `immutable`). When an obsolete URL is +used, the API server returns a redirect to the newest URL. + +The Kubernetes API server publishes an OpenAPI v3 spec per Kubernetes +group version at the `/openapi/v3/apis//?hash=` +endpoint. + +Refer to the table below for accepted request headers. + +Valid request header values for OpenAPI v3 queries + +| Header | Possible values | Notes | +| --- | --- | --- | +| `Accept-Encoding` | `gzip` | *not supplying this header is also acceptable* | +| `Accept` | `application/com.github.proto-openapi.spec.v3@v1.0+protobuf` | *mainly for intra-cluster use* | +| `application/json` | *default* | +| `*` | *serves* `application/json` | + +A Golang implementation to fetch the OpenAPI V3 is provided in the package +[`k8s.io/client-go/openapi3`](https://pkg.go.dev/k8s.io/client-go/openapi3). + +Kubernetes 1.35 publishes +OpenAPI v2.0 and v3.0; there are no plans to support 3.1 in the near future. + +### Protobuf serialization + +Kubernetes implements an alternative Protobuf based serialization format that +is primarily intended for intra-cluster communication. For more information +about this format, see the [Kubernetes Protobuf serialization](https://git.k8s.io/design-proposals-archive/api-machinery/protobuf.md) +design proposal and the +Interface Definition Language (IDL) files for each schema located in the Go +packages that define the API objects. + +## Persistence + +Kubernetes stores the serialized state of objects by writing them into +[etcd](/docs/tasks/administer-cluster/configure-upgrade-etcd/ "Consistent and highly-available key value store used as backing store of Kubernetes for all cluster data."). + +## API groups and versioning + +To make it easier to eliminate fields or restructure resource representations, +Kubernetes supports multiple API versions, each at a different API path, such +as `/api/v1` or `/apis/rbac.authorization.k8s.io/v1alpha1`. + +Versioning is done at the API level rather than at the resource or field level +to ensure that the API presents a clear, consistent view of system resources +and behavior, and to enable controlling access to end-of-life and/or +experimental APIs. + +To make it easier to evolve and to extend its API, Kubernetes implements +[API groups](/docs/reference/using-api/#api-groups) that can be +[enabled or disabled](/docs/reference/using-api/#enabling-or-disabling). + +API resources are distinguished by their API group, resource type, namespace +(for namespaced resources), and name. The API server handles the conversion between +API versions transparently: all the different versions are actually representations +of the same persisted data. The API server may serve the same underlying data +through multiple API versions. + +For example, suppose there are two API versions, `v1` and `v1beta1`, for the same +resource. If you originally created an object using the `v1beta1` version of its +API, you can later read, update, or delete that object using either the `v1beta1` +or the `v1` API version, until the `v1beta1` version is deprecated and removed. +At that point you can continue accessing and modifying the object using the `v1` API. + +### API changes + +Any system that is successful needs to grow and change as new use cases emerge or existing ones change. +Therefore, Kubernetes has designed the Kubernetes API to continuously change and grow. +The Kubernetes project aims to *not* break compatibility with existing clients, and to maintain that +compatibility for a length of time so that other projects have an opportunity to adapt. + +In general, new API resources and new resource fields can be added often and frequently. +Elimination of resources or fields requires following the +[API deprecation policy](/docs/reference/using-api/deprecation-policy/). + +Kubernetes makes a strong commitment to maintain compatibility for official Kubernetes APIs +once they reach general availability (GA), typically at API version `v1`. Additionally, +Kubernetes maintains compatibility with data persisted via *beta* API versions of official Kubernetes APIs, +and ensures that data can be converted and accessed via GA API versions when the feature goes stable. + +If you adopt a beta API version, you will need to transition to a subsequent beta or stable API version +once the API graduates. The best time to do this is while the beta API is in its deprecation period, +since objects are simultaneously accessible via both API versions. Once the beta API completes its +deprecation period and is no longer served, the replacement API version must be used. + +#### Note: + +Although Kubernetes also aims to maintain compatibility for *alpha* APIs versions, in some +circumstances this is not possible. If you use any alpha API versions, check the release notes +for Kubernetes when upgrading your cluster, in case the API did change in incompatible +ways that require deleting all existing alpha objects prior to upgrade. + +Refer to [API versions reference](/docs/reference/using-api/#api-versioning) +for more details on the API version level definitions. + +## API Extension + +The Kubernetes API can be extended in one of two ways: + +1. [Custom resources](/docs/concepts/extend-kubernetes/api-extension/custom-resources/) + let you declaratively define how the API server should provide your chosen resource API. +2. You can also extend the Kubernetes API by implementing an + [aggregation layer](/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation/). + +## What's next + +* Learn how to extend the Kubernetes API by adding your own + [CustomResourceDefinition](/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/). +* [Controlling Access To The Kubernetes API](/docs/concepts/security/controlling-access/) describes + how the cluster manages authentication and authorization for API access. +* Learn about API endpoints, resource types and samples by reading + [API Reference](/docs/reference/kubernetes-api/). +* Learn about what constitutes a compatible change, and how to change the API, from + [API changes](https://git.k8s.io/community/contributors/devel/sig-architecture/api_changes.md#readme). + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified January 08, 2025 at 10:50 AM PST: [Fix feature gate name conflicts (2/2) (3782732ce4)](https://github.com/kubernetes/website/commit/3782732ce415e1008ba589954371332b67993a66) diff --git a/corpus/docs/kubernetes/node-overprovisioning/node-overprovisioning_v131.md b/corpus/docs/kubernetes/node-overprovisioning/node-overprovisioning_v131.md new file mode 100644 index 0000000000000000000000000000000000000000..d5fc58243587a36839990664dbf958acd446c10c --- /dev/null +++ b/corpus/docs/kubernetes/node-overprovisioning/node-overprovisioning_v131.md @@ -0,0 +1,206 @@ +# Overprovision Node Capacity For A Cluster + +Source: https://v1-31.docs.kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/ +Version: v1.31 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Tasks](https://kubernetes.io/docs/tasks/) +3. [Administer a Cluster](https://kubernetes.io/docs/tasks/administer-cluster/) +4. [Overprovision Node Capacity For A Cluster](https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/) + +### You are viewing documentation for Kubernetes version: v1.31 + +Kubernetes v1.31 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date information, see the +[latest version.](https://kubernetes.io/docs/home/) + +This page guides you through configuring [Node](/docs/concepts/architecture/nodes/ "A node is a worker machine in Kubernetes.") +overprovisioning in your Kubernetes cluster. Node overprovisioning is a strategy that proactively +reserves a portion of your cluster's compute resources. This reservation helps reduce the time +required to schedule new pods during scaling events, enhancing your cluster's responsiveness +to sudden spikes in traffic or workload demands. + +By maintaining some unused capacity, you ensure that resources are immediately available when +new pods are created, preventing them from entering a pending state while the cluster scales up. + +## Before you begin + +* You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with + your cluster. +* You should already have a basic understanding of + [Deployments](/docs/concepts/workloads/controllers/deployment/), + Pod [priority](/docs/concepts/scheduling-eviction/pod-priority-preemption/#pod-priority "Pod Priority indicates the importance of a Pod relative to other Pods."), + and [PriorityClasses](/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass "A mapping from a class name to the scheduling priority that a Pod should have."). +* Your cluster must be set up with an [autoscaler](/docs/concepts/cluster-administration/cluster-autoscaling/) + that manages nodes based on demand. + +## Create a PriorityClass + +Begin by defining a PriorityClass for the placeholder Pods. First, create a PriorityClass with a +negative priority value, that you will shortly assign to the placeholder pods. +Later, you will set up a Deployment that uses this PriorityClass + +[`priorityclass/low-priority-class.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.31/content/en/examples/priorityclass/low-priority-class.yaml)![](/images/copycode.svg "Copy priorityclass/low-priority-class.yaml to clipboard") + +```None +apiVersion: scheduling.k8s.io/v1 +kind: PriorityClass +metadata: + name: placeholder # these Pods represent placeholder capacity +value: -1000 +globalDefault: false +description: "Negative priority for placeholder pods to enable overprovisioning." +``` + +Then create the PriorityClass: + +```None +kubectl apply -f https://k8s.io/examples/priorityclass/low-priority-class.yaml +``` + +You will next define a Deployment that uses the negative-priority PriorityClass and runs a minimal container. +When you add this to your cluster, Kubernetes runs those placeholder pods to reserve capacity. Any time there +is a capacity shortage, the control plane will pick one these placeholder pods as the first candidate to +[preempt](/docs/concepts/scheduling-eviction/pod-priority-preemption/#preemption "Preemption logic in Kubernetes helps a pending Pod to find a suitable Node by evicting low priority Pods existing on that Node."). + +## Run Pods that request node capacity + +Review the sample manifest: + +[`deployments/deployment-with-capacity-reservation.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.31/content/en/examples/deployments/deployment-with-capacity-reservation.yaml)![](/images/copycode.svg "Copy deployments/deployment-with-capacity-reservation.yaml to clipboard") + +```None +apiVersion: apps/v1 +kind: Deployment +metadata: + name: capacity-reservation + # You should decide what namespace to deploy this into +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: capacity-placeholder + template: + metadata: + labels: + app.kubernetes.io/name: capacity-placeholder + annotations: + kubernetes.io/description: "Capacity reservation" + spec: + priorityClassName: placeholder + affinity: # Try to place these overhead Pods on different nodes + # if possible + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchLabels: + app: placeholder + topologyKey: "kubernetes.io/hostname" + containers: + - name: pause + image: registry.k8s.io/pause:3.6 + resources: + requests: + cpu: "50m" + memory: "512Mi" + limits: + memory: "512Mi" +``` + +### Pick a namespace for the placeholder pods + +You should select, or create, a [namespace](/docs/concepts/overview/working-with-objects/namespaces "An abstraction used by Kubernetes to support isolation of groups of resources within a single cluster.") +that the placeholder Pods will go into. + +### Create the placeholder deployment + +Create a Deployment based on that manifest: + +```None +# Change the namespace name "example" +kubectl --namespace example apply -f https://k8s.io/examples/deployments/deployment-with-capacity-reservation.yaml +``` + +## Adjust placeholder resource requests + +Configure the resource requests and limits for the placeholder pods to define the amount of overprovisioned resources you want to maintain. This reservation ensures that a specific amount of CPU and memory is kept available for new pods. + +To edit the Deployment, modify the `resources` section in the Deployment manifest file +to set appropriate requests and limits. You can download that file locally and then edit it +with whichever text editor you prefer. + +You can also edit the Deployment using kubectl: + +```None +kubectl edit deployment capacity-reservation +``` + +For example, to reserve a total of a 0.5 CPU and 1GiB of memory across 5 placeholder pods, +define the resource requests and limits for a single placeholder pod as follows: + +```None + resources: + requests: + cpu: "100m" + memory: "200Mi" + limits: + cpu: "100m" +``` + +## Set the desired replica count + +### Calculate the total reserved resources + +For example, with 5 replicas each reserving 0.1 CPU and 200MiB of memory: +Total CPU reserved: 5 × 0.1 = 0.5 (in the Pod specification, you'll write the quantity `500m`) +Total memory reserved: 5 × 200MiB = 1GiB (in the Pod specification, you'll write `1 Gi`) + +To scale the Deployment, adjust the number of replicas based on your cluster's size and expected workload: + +```None +kubectl scale deployment capacity-reservation --replicas=5 +``` + +Verify the scaling: + +```None +kubectl get deployment capacity-reservation +``` + +The output should reflect the updated number of replicas: + +```None +NAME READY UP-TO-DATE AVAILABLE AGE +capacity-reservation 5/5 5 5 2m +``` + +#### Note: + +Some autoscalers, notably [Karpenter](/docs/concepts/cluster-administration/cluster-autoscaling/#autoscaler-karpenter), +treat preferred affinity rules as hard rules when considering node scaling. +If you use Karpenter or another node autoscaler that uses the same heuristic, +the replica count you set here also sets a minimum node count for your cluster. + +## What's next + +* Learn more about [PriorityClasses](/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass) and how they affect pod scheduling. +* Explore [node autoscaling](/docs/concepts/cluster-administration/cluster-autoscaling/) to dynamically adjust your cluster's size based on workload demands. +* Understand [Pod preemption](/docs/concepts/scheduling-eviction/pod-priority-preemption/), a + key mechanism for Kubernetes to handle resource contention. The same page covers *eviction*, + which is less relevant to the placeholder Pod approach, but is also a mechanism for Kubernetes + to react when resources are contended. + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified November 18, 2024 at 5:22 PM PST: [Tweak node capacity overprovisioning task (d34ee98252)](https://github.com/kubernetes/website/commit/d34ee98252817ba2e8bd604ac57fa11770366901) diff --git a/corpus/docs/kubernetes/node-overprovisioning/node-overprovisioning_v132.md b/corpus/docs/kubernetes/node-overprovisioning/node-overprovisioning_v132.md new file mode 100644 index 0000000000000000000000000000000000000000..116bd55d94bf1dbb0a67d6ce9e12a968d27c0edf --- /dev/null +++ b/corpus/docs/kubernetes/node-overprovisioning/node-overprovisioning_v132.md @@ -0,0 +1,206 @@ +# Overprovision Node Capacity For A Cluster + +Source: https://v1-32.docs.kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/ +Version: v1.32 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Tasks](https://kubernetes.io/docs/tasks/) +3. [Administer a Cluster](https://kubernetes.io/docs/tasks/administer-cluster/) +4. [Overprovision Node Capacity For A Cluster](https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/) + +### You are viewing documentation for Kubernetes version: v1.32 + +Kubernetes v1.32 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date information, see the +[latest version.](https://kubernetes.io/docs/home/) + +This page guides you through configuring [Node](/docs/concepts/architecture/nodes/ "A node is a worker machine in Kubernetes.") +overprovisioning in your Kubernetes cluster. Node overprovisioning is a strategy that proactively +reserves a portion of your cluster's compute resources. This reservation helps reduce the time +required to schedule new pods during scaling events, enhancing your cluster's responsiveness +to sudden spikes in traffic or workload demands. + +By maintaining some unused capacity, you ensure that resources are immediately available when +new pods are created, preventing them from entering a pending state while the cluster scales up. + +## Before you begin + +* You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with + your cluster. +* You should already have a basic understanding of + [Deployments](/docs/concepts/workloads/controllers/deployment/), + Pod [priority](/docs/concepts/scheduling-eviction/pod-priority-preemption/#pod-priority "Pod Priority indicates the importance of a Pod relative to other Pods."), + and [PriorityClasses](/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass "A mapping from a class name to the scheduling priority that a Pod should have."). +* Your cluster must be set up with an [autoscaler](/docs/concepts/cluster-administration/cluster-autoscaling/) + that manages nodes based on demand. + +## Create a PriorityClass + +Begin by defining a PriorityClass for the placeholder Pods. First, create a PriorityClass with a +negative priority value, that you will shortly assign to the placeholder pods. +Later, you will set up a Deployment that uses this PriorityClass + +[`priorityclass/low-priority-class.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.32/content/en/examples/priorityclass/low-priority-class.yaml)![](/images/copycode.svg "Copy priorityclass/low-priority-class.yaml to clipboard") + +```None +apiVersion: scheduling.k8s.io/v1 +kind: PriorityClass +metadata: + name: placeholder # these Pods represent placeholder capacity +value: -1000 +globalDefault: false +description: "Negative priority for placeholder pods to enable overprovisioning." +``` + +Then create the PriorityClass: + +```None +kubectl apply -f https://k8s.io/examples/priorityclass/low-priority-class.yaml +``` + +You will next define a Deployment that uses the negative-priority PriorityClass and runs a minimal container. +When you add this to your cluster, Kubernetes runs those placeholder pods to reserve capacity. Any time there +is a capacity shortage, the control plane will pick one these placeholder pods as the first candidate to +[preempt](/docs/concepts/scheduling-eviction/pod-priority-preemption/#preemption "Preemption logic in Kubernetes helps a pending Pod to find a suitable Node by evicting low priority Pods existing on that Node."). + +## Run Pods that request node capacity + +Review the sample manifest: + +[`deployments/deployment-with-capacity-reservation.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.32/content/en/examples/deployments/deployment-with-capacity-reservation.yaml)![](/images/copycode.svg "Copy deployments/deployment-with-capacity-reservation.yaml to clipboard") + +```None +apiVersion: apps/v1 +kind: Deployment +metadata: + name: capacity-reservation + # You should decide what namespace to deploy this into +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: capacity-placeholder + template: + metadata: + labels: + app.kubernetes.io/name: capacity-placeholder + annotations: + kubernetes.io/description: "Capacity reservation" + spec: + priorityClassName: placeholder + affinity: # Try to place these overhead Pods on different nodes + # if possible + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchLabels: + app: placeholder + topologyKey: "kubernetes.io/hostname" + containers: + - name: pause + image: registry.k8s.io/pause:3.6 + resources: + requests: + cpu: "50m" + memory: "512Mi" + limits: + memory: "512Mi" +``` + +### Pick a namespace for the placeholder pods + +You should select, or create, a [namespace](/docs/concepts/overview/working-with-objects/namespaces "An abstraction used by Kubernetes to support isolation of groups of resources within a single cluster.") +that the placeholder Pods will go into. + +### Create the placeholder deployment + +Create a Deployment based on that manifest: + +```None +# Change the namespace name "example" +kubectl --namespace example apply -f https://k8s.io/examples/deployments/deployment-with-capacity-reservation.yaml +``` + +## Adjust placeholder resource requests + +Configure the resource requests and limits for the placeholder pods to define the amount of overprovisioned resources you want to maintain. This reservation ensures that a specific amount of CPU and memory is kept available for new pods. + +To edit the Deployment, modify the `resources` section in the Deployment manifest file +to set appropriate requests and limits. You can download that file locally and then edit it +with whichever text editor you prefer. + +You can also edit the Deployment using kubectl: + +```None +kubectl edit deployment capacity-reservation +``` + +For example, to reserve a total of a 0.5 CPU and 1GiB of memory across 5 placeholder pods, +define the resource requests and limits for a single placeholder pod as follows: + +```None + resources: + requests: + cpu: "100m" + memory: "200Mi" + limits: + cpu: "100m" +``` + +## Set the desired replica count + +### Calculate the total reserved resources + +For example, with 5 replicas each reserving 0.1 CPU and 200MiB of memory: +Total CPU reserved: 5 × 0.1 = 0.5 (in the Pod specification, you'll write the quantity `500m`) +Total memory reserved: 5 × 200MiB = 1GiB (in the Pod specification, you'll write `1 Gi`) + +To scale the Deployment, adjust the number of replicas based on your cluster's size and expected workload: + +```None +kubectl scale deployment capacity-reservation --replicas=5 +``` + +Verify the scaling: + +```None +kubectl get deployment capacity-reservation +``` + +The output should reflect the updated number of replicas: + +```None +NAME READY UP-TO-DATE AVAILABLE AGE +capacity-reservation 5/5 5 5 2m +``` + +#### Note: + +Some autoscalers, notably [Karpenter](/docs/concepts/cluster-administration/cluster-autoscaling/#autoscaler-karpenter), +treat preferred affinity rules as hard rules when considering node scaling. +If you use Karpenter or another node autoscaler that uses the same heuristic, +the replica count you set here also sets a minimum node count for your cluster. + +## What's next + +* Learn more about [PriorityClasses](/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass) and how they affect pod scheduling. +* Explore [node autoscaling](/docs/concepts/cluster-administration/cluster-autoscaling/) to dynamically adjust your cluster's size based on workload demands. +* Understand [Pod preemption](/docs/concepts/scheduling-eviction/pod-priority-preemption/), a + key mechanism for Kubernetes to handle resource contention. The same page covers *eviction*, + which is less relevant to the placeholder Pod approach, but is also a mechanism for Kubernetes + to react when resources are contended. + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified November 18, 2024 at 5:22 PM PST: [Tweak node capacity overprovisioning task (d34ee98252)](https://github.com/kubernetes/website/commit/d34ee98252817ba2e8bd604ac57fa11770366901) diff --git a/corpus/docs/kubernetes/node-overprovisioning/node-overprovisioning_v133.md b/corpus/docs/kubernetes/node-overprovisioning/node-overprovisioning_v133.md new file mode 100644 index 0000000000000000000000000000000000000000..a56ad2569e1569fc4c6cf128e0e2494430e1d7a3 --- /dev/null +++ b/corpus/docs/kubernetes/node-overprovisioning/node-overprovisioning_v133.md @@ -0,0 +1,208 @@ +# Overprovision Node Capacity For A Cluster + +Source: https://v1-33.docs.kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/ +Version: v1.33 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Tasks](https://kubernetes.io/docs/tasks/) +3. [Administer a Cluster](https://kubernetes.io/docs/tasks/administer-cluster/) +4. [Overprovision Node Capacity For A Cluster](https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/) + +### You are viewing documentation for Kubernetes version: v1.33 + +Kubernetes v1.33 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date information, see the +[latest version.](https://kubernetes.io/docs/home/) + +This page guides you through configuring [Node](/docs/concepts/architecture/nodes/ "A node is a worker machine in Kubernetes.") +overprovisioning in your Kubernetes cluster. Node overprovisioning is a strategy that proactively +reserves a portion of your cluster's compute resources. This reservation helps reduce the time +required to schedule new pods during scaling events, enhancing your cluster's responsiveness +to sudden spikes in traffic or workload demands. + +By maintaining some unused capacity, you ensure that resources are immediately available when +new pods are created, preventing them from entering a pending state while the cluster scales up. + +## Before you begin + +* You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with + your cluster. +* You should already have a basic understanding of + [Deployments](/docs/concepts/workloads/controllers/deployment/), + Pod [priority](/docs/concepts/scheduling-eviction/pod-priority-preemption/#pod-priority "Pod Priority indicates the importance of a Pod relative to other Pods."), + and [PriorityClasses](/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass "A mapping from a class name to the scheduling priority that a Pod should have."). +* Your cluster must be set up with an [autoscaler](/docs/concepts/cluster-administration/cluster-autoscaling/) + that manages nodes based on demand. + +## Create a PriorityClass + +Begin by defining a PriorityClass for the placeholder Pods. First, create a PriorityClass with a +negative priority value, that you will shortly assign to the placeholder pods. +Later, you will set up a Deployment that uses this PriorityClass + +[`priorityclass/low-priority-class.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.33/content/en/examples/priorityclass/low-priority-class.yaml)![](/images/copycode.svg "Copy priorityclass/low-priority-class.yaml to clipboard") + +```None +apiVersion: scheduling.k8s.io/v1 +kind: PriorityClass +metadata: + name: placeholder # these Pods represent placeholder capacity +value: -1000 +globalDefault: false +description: "Negative priority for placeholder pods to enable overprovisioning." +``` + +Then create the PriorityClass: + +```None +kubectl apply -f https://k8s.io/examples/priorityclass/low-priority-class.yaml +``` + +You will next define a Deployment that uses the negative-priority PriorityClass and runs a minimal container. +When you add this to your cluster, Kubernetes runs those placeholder pods to reserve capacity. Any time there +is a capacity shortage, the control plane will pick one these placeholder pods as the first candidate to +[preempt](/docs/concepts/scheduling-eviction/pod-priority-preemption/#preemption "Preemption logic in Kubernetes helps a pending Pod to find a suitable Node by evicting low priority Pods existing on that Node."). + +## Run Pods that request node capacity + +Review the sample manifest: + +[`deployments/deployment-with-capacity-reservation.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.33/content/en/examples/deployments/deployment-with-capacity-reservation.yaml)![](/images/copycode.svg "Copy deployments/deployment-with-capacity-reservation.yaml to clipboard") + +```None +apiVersion: apps/v1 +kind: Deployment +metadata: + name: capacity-reservation + # You should decide what namespace to deploy this into +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: capacity-placeholder + template: + metadata: + labels: + app.kubernetes.io/name: capacity-placeholder + annotations: + kubernetes.io/description: "Capacity reservation" + spec: + priorityClassName: placeholder + affinity: # Try to place these overhead Pods on different nodes + # if possible + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchLabels: + app.kubernetes.io/name: capacity-placeholder + topologyKey: topology.kubernetes.io/hostname + containers: + - name: pause + image: registry.k8s.io/pause:3.6 + resources: + requests: + cpu: "50m" + memory: "512Mi" + limits: + memory: "512Mi" +``` + +### Pick a namespace for the placeholder pods + +You should select, or create, a [namespace](/docs/concepts/overview/working-with-objects/namespaces "An abstraction used by Kubernetes to support isolation of groups of resources within a single cluster.") +that the placeholder Pods will go into. + +### Create the placeholder deployment + +Create a Deployment based on that manifest: + +```None +# Change the namespace name "example" +kubectl --namespace example apply -f https://k8s.io/examples/deployments/deployment-with-capacity-reservation.yaml +``` + +## Adjust placeholder resource requests + +Configure the resource requests and limits for the placeholder pods to define the amount of overprovisioned resources you want to maintain. This reservation ensures that a specific amount of CPU and memory is kept available for new pods. + +To edit the Deployment, modify the `resources` section in the Deployment manifest file +to set appropriate requests and limits. You can download that file locally and then edit it +with whichever text editor you prefer. + +You can also edit the Deployment using kubectl: + +```None +kubectl edit deployment capacity-reservation +``` + +For example, to reserve a total of a 0.5 CPU and 1GiB of memory across 5 placeholder pods, +define the resource requests and limits for a single placeholder pod as follows: + +```None + resources: + requests: + cpu: "100m" + memory: "200Mi" + limits: + cpu: "100m" +``` + +## Set the desired replica count + +### Calculate the total reserved resources + +For example, with 5 replicas each reserving 0.1 CPU and 200MiB of memory: +Total CPU reserved: 5 × 0.1 = 0.5 (in the Pod specification, you'll write the quantity `500m`) +Total memory reserved: 5 × 200MiB = 1GiB (in the Pod specification, you'll write `1 Gi`) + +To scale the Deployment, adjust the number of replicas based on your cluster's size and expected workload: + +```None +kubectl scale deployment capacity-reservation --replicas=5 +``` + +Verify the scaling: + +```None +kubectl get deployment capacity-reservation +``` + +The output should reflect the updated number of replicas: + +```None +NAME READY UP-TO-DATE AVAILABLE AGE +capacity-reservation 5/5 5 5 2m +``` + +#### Note: + +Some autoscalers, notably [Karpenter](/docs/concepts/cluster-administration/cluster-autoscaling/#autoscaler-karpenter), +treat preferred affinity rules as hard rules when considering node scaling. +If you use Karpenter or another node autoscaler that uses the same heuristic, +the replica count you set here also sets a minimum node count for your cluster. + +## What's next + +* Learn more about [PriorityClasses](/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass) and how they affect pod scheduling. +* Explore [node autoscaling](/docs/concepts/cluster-administration/cluster-autoscaling/) to dynamically adjust your cluster's size based on workload demands. +* Understand [Pod preemption](/docs/concepts/scheduling-eviction/pod-priority-preemption/), a + key mechanism for Kubernetes to handle resource contention. The same page covers *eviction*, + which is less relevant to the placeholder Pod approach, but is also a mechanism for Kubernetes + to react when resources are contended. + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified November 18, 2024 at 5:22 PM PST: [Tweak node capacity overprovisioning task (d34ee98252)](https://github.com/kubernetes/website/commit/d34ee98252817ba2e8bd604ac57fa11770366901) diff --git a/corpus/docs/kubernetes/node-overprovisioning/node-overprovisioning_v134.md b/corpus/docs/kubernetes/node-overprovisioning/node-overprovisioning_v134.md new file mode 100644 index 0000000000000000000000000000000000000000..7446c3000cf6e4833f125e73706c424645e1242c --- /dev/null +++ b/corpus/docs/kubernetes/node-overprovisioning/node-overprovisioning_v134.md @@ -0,0 +1,208 @@ +# Overprovision Node Capacity For A Cluster + +Source: https://v1-34.docs.kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/ +Version: v1.34 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Tasks](https://kubernetes.io/docs/tasks/) +3. [Administer a Cluster](https://kubernetes.io/docs/tasks/administer-cluster/) +4. [Overprovision Node Capacity For A Cluster](https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/) + +### You are viewing documentation for Kubernetes version: v1.34 + +Kubernetes v1.34 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date information, see the +[latest version.](https://kubernetes.io/docs/home/) + +This page guides you through configuring [Node](/docs/concepts/architecture/nodes/ "A node is a worker machine in Kubernetes.") +overprovisioning in your Kubernetes cluster. Node overprovisioning is a strategy that proactively +reserves a portion of your cluster's compute resources. This reservation helps reduce the time +required to schedule new pods during scaling events, enhancing your cluster's responsiveness +to sudden spikes in traffic or workload demands. + +By maintaining some unused capacity, you ensure that resources are immediately available when +new pods are created, preventing them from entering a pending state while the cluster scales up. + +## Before you begin + +* You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with + your cluster. +* You should already have a basic understanding of + [Deployments](/docs/concepts/workloads/controllers/deployment/), + Pod [priority](/docs/concepts/scheduling-eviction/pod-priority-preemption/#pod-priority "Pod Priority indicates the importance of a Pod relative to other Pods."), + and [PriorityClasses](/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass "A mapping from a class name to the scheduling priority that a Pod should have."). +* Your cluster must be set up with an [autoscaler](/docs/concepts/cluster-administration/cluster-autoscaling/) + that manages nodes based on demand. + +## Create a PriorityClass + +Begin by defining a PriorityClass for the placeholder Pods. First, create a PriorityClass with a +negative priority value, that you will shortly assign to the placeholder pods. +Later, you will set up a Deployment that uses this PriorityClass + +[`priorityclass/low-priority-class.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.34/content/en/examples/priorityclass/low-priority-class.yaml)![](/images/copycode.svg "Copy priorityclass/low-priority-class.yaml to clipboard") + +```None +apiVersion: scheduling.k8s.io/v1 +kind: PriorityClass +metadata: + name: placeholder # these Pods represent placeholder capacity +value: -1000 +globalDefault: false +description: "Negative priority for placeholder pods to enable overprovisioning." +``` + +Then create the PriorityClass: + +```None +kubectl apply -f https://k8s.io/examples/priorityclass/low-priority-class.yaml +``` + +You will next define a Deployment that uses the negative-priority PriorityClass and runs a minimal container. +When you add this to your cluster, Kubernetes runs those placeholder pods to reserve capacity. Any time there +is a capacity shortage, the control plane will pick one these placeholder pods as the first candidate to +[preempt](/docs/concepts/scheduling-eviction/pod-priority-preemption/#preemption "Preemption logic in Kubernetes helps a pending Pod to find a suitable Node by evicting low priority Pods existing on that Node."). + +## Run Pods that request node capacity + +Review the sample manifest: + +[`deployments/deployment-with-capacity-reservation.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.34/content/en/examples/deployments/deployment-with-capacity-reservation.yaml)![](/images/copycode.svg "Copy deployments/deployment-with-capacity-reservation.yaml to clipboard") + +```None +apiVersion: apps/v1 +kind: Deployment +metadata: + name: capacity-reservation + # You should decide what namespace to deploy this into +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: capacity-placeholder + template: + metadata: + labels: + app.kubernetes.io/name: capacity-placeholder + annotations: + kubernetes.io/description: "Capacity reservation" + spec: + priorityClassName: placeholder + affinity: # Try to place these overhead Pods on different nodes + # if possible + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchLabels: + app.kubernetes.io/name: capacity-placeholder + topologyKey: topology.kubernetes.io/hostname + containers: + - name: pause + image: registry.k8s.io/pause:3.6 + resources: + requests: + cpu: "50m" + memory: "512Mi" + limits: + memory: "512Mi" +``` + +### Pick a namespace for the placeholder pods + +You should select, or create, a [namespace](/docs/concepts/overview/working-with-objects/namespaces "An abstraction used by Kubernetes to support isolation of groups of resources within a single cluster.") +that the placeholder Pods will go into. + +### Create the placeholder deployment + +Create a Deployment based on that manifest: + +```None +# Change the namespace name "example" +kubectl --namespace example apply -f https://k8s.io/examples/deployments/deployment-with-capacity-reservation.yaml +``` + +## Adjust placeholder resource requests + +Configure the resource requests and limits for the placeholder pods to define the amount of overprovisioned resources you want to maintain. This reservation ensures that a specific amount of CPU and memory is kept available for new pods. + +To edit the Deployment, modify the `resources` section in the Deployment manifest file +to set appropriate requests and limits. You can download that file locally and then edit it +with whichever text editor you prefer. + +You can also edit the Deployment using kubectl: + +```None +kubectl edit deployment capacity-reservation +``` + +For example, to reserve a total of a 0.5 CPU and 1GiB of memory across 5 placeholder pods, +define the resource requests and limits for a single placeholder pod as follows: + +```None + resources: + requests: + cpu: "100m" + memory: "200Mi" + limits: + cpu: "100m" +``` + +## Set the desired replica count + +### Calculate the total reserved resources + +For example, with 5 replicas each reserving 0.1 CPU and 200MiB of memory: +Total CPU reserved: 5 × 0.1 = 0.5 (in the Pod specification, you'll write the quantity `500m`) +Total memory reserved: 5 × 200MiB = 1GiB (in the Pod specification, you'll write `1 Gi`) + +To scale the Deployment, adjust the number of replicas based on your cluster's size and expected workload: + +```None +kubectl scale deployment capacity-reservation --replicas=5 +``` + +Verify the scaling: + +```None +kubectl get deployment capacity-reservation +``` + +The output should reflect the updated number of replicas: + +```None +NAME READY UP-TO-DATE AVAILABLE AGE +capacity-reservation 5/5 5 5 2m +``` + +#### Note: + +Some autoscalers, notably [Karpenter](/docs/concepts/cluster-administration/cluster-autoscaling/#autoscaler-karpenter), +treat preferred affinity rules as hard rules when considering node scaling. +If you use Karpenter or another node autoscaler that uses the same heuristic, +the replica count you set here also sets a minimum node count for your cluster. + +## What's next + +* Learn more about [PriorityClasses](/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass) and how they affect pod scheduling. +* Explore [node autoscaling](/docs/concepts/cluster-administration/cluster-autoscaling/) to dynamically adjust your cluster's size based on workload demands. +* Understand [Pod preemption](/docs/concepts/scheduling-eviction/pod-priority-preemption/), a + key mechanism for Kubernetes to handle resource contention. The same page covers *eviction*, + which is less relevant to the placeholder Pod approach, but is also a mechanism for Kubernetes + to react when resources are contended. + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified November 18, 2024 at 5:22 PM PST: [Tweak node capacity overprovisioning task (d34ee98252)](https://github.com/kubernetes/website/commit/d34ee98252817ba2e8bd604ac57fa11770366901) diff --git a/corpus/docs/kubernetes/node-overprovisioning/node-overprovisioning_v135.md b/corpus/docs/kubernetes/node-overprovisioning/node-overprovisioning_v135.md new file mode 100644 index 0000000000000000000000000000000000000000..4080a4895c196243dd6f2b6e888c60457fd26510 --- /dev/null +++ b/corpus/docs/kubernetes/node-overprovisioning/node-overprovisioning_v135.md @@ -0,0 +1,203 @@ +# Overprovision Node Capacity For A Cluster + +Source: https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/ +Version: v1.35 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Tasks](https://kubernetes.io/docs/tasks/) +3. [Administer a Cluster](https://kubernetes.io/docs/tasks/administer-cluster/) +4. [Overprovision Node Capacity For A Cluster](https://kubernetes.io/docs/tasks/administer-cluster/node-overprovisioning/) + +This page guides you through configuring [Node](/docs/concepts/architecture/nodes/ "A node is a worker machine in Kubernetes.") +overprovisioning in your Kubernetes cluster. Node overprovisioning is a strategy that proactively +reserves a portion of your cluster's compute resources. This reservation helps reduce the time +required to schedule new pods during scaling events, enhancing your cluster's responsiveness +to sudden spikes in traffic or workload demands. + +By maintaining some unused capacity, you ensure that resources are immediately available when +new pods are created, preventing them from entering a pending state while the cluster scales up. + +## Before you begin + +* You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with + your cluster. +* You should already have a basic understanding of + [Deployments](/docs/concepts/workloads/controllers/deployment/), + Pod [priority](/docs/concepts/scheduling-eviction/pod-priority-preemption/#pod-priority "Pod Priority indicates the importance of a Pod relative to other Pods."), + and [PriorityClasses](/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass "A mapping from a class name to the scheduling priority that a Pod should have."). +* Your cluster must be set up with an [autoscaler](/docs/concepts/cluster-administration/cluster-autoscaling/) + that manages nodes based on demand. + +## Create a PriorityClass + +Begin by defining a PriorityClass for the placeholder Pods. First, create a PriorityClass with a +negative priority value, that you will shortly assign to the placeholder pods. +Later, you will set up a Deployment that uses this PriorityClass + +[`priorityclass/low-priority-class.yaml`](https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/priorityclass/low-priority-class.yaml)![](/images/copycode.svg "Copy priorityclass/low-priority-class.yaml to clipboard") + +```None +apiVersion: scheduling.k8s.io/v1 +kind: PriorityClass +metadata: + name: placeholder # these Pods represent placeholder capacity +value: -1000 +globalDefault: false +description: "Negative priority for placeholder pods to enable overprovisioning." +``` + +Then create the PriorityClass: + +```None +kubectl apply -f https://k8s.io/examples/priorityclass/low-priority-class.yaml +``` + +You will next define a Deployment that uses the negative-priority PriorityClass and runs a minimal container. +When you add this to your cluster, Kubernetes runs those placeholder pods to reserve capacity. Any time there +is a capacity shortage, the control plane will pick one these placeholder pods as the first candidate to +[preempt](/docs/concepts/scheduling-eviction/pod-priority-preemption/#preemption "Preemption logic in Kubernetes helps a pending Pod to find a suitable Node by evicting low priority Pods existing on that Node."). + +## Run Pods that request node capacity + +Review the sample manifest: + +[`deployments/deployment-with-capacity-reservation.yaml`](https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/deployments/deployment-with-capacity-reservation.yaml)![](/images/copycode.svg "Copy deployments/deployment-with-capacity-reservation.yaml to clipboard") + +```None +apiVersion: apps/v1 +kind: Deployment +metadata: + name: capacity-reservation + # You should decide what namespace to deploy this into +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: capacity-placeholder + template: + metadata: + labels: + app.kubernetes.io/name: capacity-placeholder + annotations: + kubernetes.io/description: "Capacity reservation" + spec: + priorityClassName: placeholder + affinity: # Try to place these overhead Pods on different nodes + # if possible + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchLabels: + app.kubernetes.io/name: capacity-placeholder + topologyKey: topology.kubernetes.io/hostname + containers: + - name: pause + image: registry.k8s.io/pause:3.6 + resources: + requests: + cpu: "50m" + memory: "512Mi" + limits: + memory: "512Mi" +``` + +### Pick a namespace for the placeholder pods + +You should select, or create, a [namespace](/docs/concepts/overview/working-with-objects/namespaces "An abstraction used by Kubernetes to support isolation of groups of resources within a single cluster.") +that the placeholder Pods will go into. + +### Create the placeholder deployment + +Create a Deployment based on that manifest: + +```None +# Change the namespace name "example" +kubectl --namespace example apply -f https://k8s.io/examples/deployments/deployment-with-capacity-reservation.yaml +``` + +## Adjust placeholder resource requests + +Configure the resource requests and limits for the placeholder pods to define the amount of overprovisioned resources you want to maintain. This reservation ensures that a specific amount of CPU and memory is kept available for new pods. + +To edit the Deployment, modify the `resources` section in the Deployment manifest file +to set appropriate requests and limits. You can download that file locally and then edit it +with whichever text editor you prefer. + +You can also edit the Deployment using kubectl: + +```None +kubectl edit deployment capacity-reservation +``` + +For example, to reserve a total of a 0.5 CPU and 1GiB of memory across 5 placeholder pods, +define the resource requests and limits for a single placeholder pod as follows: + +```None + resources: + requests: + cpu: "100m" + memory: "200Mi" + limits: + cpu: "100m" +``` + +## Set the desired replica count + +### Calculate the total reserved resources + +For example, with 5 replicas each reserving 0.1 CPU and 200MiB of memory: +Total CPU reserved: 5 × 0.1 = 0.5 (in the Pod specification, you'll write the quantity `500m`) +Total memory reserved: 5 × 200MiB = 1GiB (in the Pod specification, you'll write `1 Gi`) + +To scale the Deployment, adjust the number of replicas based on your cluster's size and expected workload: + +```None +kubectl scale deployment capacity-reservation --replicas=5 +``` + +Verify the scaling: + +```None +kubectl get deployment capacity-reservation +``` + +The output should reflect the updated number of replicas: + +```None +NAME READY UP-TO-DATE AVAILABLE AGE +capacity-reservation 5/5 5 5 2m +``` + +#### Note: + +Some autoscalers, notably [Karpenter](/docs/concepts/cluster-administration/cluster-autoscaling/#autoscaler-karpenter), +treat preferred affinity rules as hard rules when considering node scaling. +If you use Karpenter or another node autoscaler that uses the same heuristic, +the replica count you set here also sets a minimum node count for your cluster. + +## What's next + +* Learn more about [PriorityClasses](/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass) and how they affect pod scheduling. +* Explore [node autoscaling](/docs/concepts/cluster-administration/cluster-autoscaling/) to dynamically adjust your cluster's size based on workload demands. +* Understand [Pod preemption](/docs/concepts/scheduling-eviction/pod-priority-preemption/), a + key mechanism for Kubernetes to handle resource contention. The same page covers *eviction*, + which is less relevant to the placeholder Pod approach, but is also a mechanism for Kubernetes + to react when resources are contended. + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified November 18, 2024 at 5:22 PM PST: [Tweak node capacity overprovisioning task (d34ee98252)](https://github.com/kubernetes/website/commit/d34ee98252817ba2e8bd604ac57fa11770366901) diff --git a/corpus/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v131.md b/corpus/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v131.md new file mode 100644 index 0000000000000000000000000000000000000000..68286ef0421b2d16d37067b0cda991b5d05fadcd --- /dev/null +++ b/corpus/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v131.md @@ -0,0 +1,394 @@ +# Configure a Pod to Use a PersistentVolume for Storage + +Source: https://v1-31.docs.kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/ +Version: v1.31 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Tasks](https://kubernetes.io/docs/tasks/) +3. [Configure Pods and Containers](https://kubernetes.io/docs/tasks/configure-pod-container/) +4. [Configure a Pod to Use a PersistentVolume for Storage](https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/) + +### You are viewing documentation for Kubernetes version: v1.31 + +Kubernetes v1.31 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date information, see the +[latest version.](https://kubernetes.io/docs/home/) + +This page shows you how to configure a Pod to use a +[PersistentVolumeClaim](/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims "Claims storage resources defined in a PersistentVolume so that it can be mounted as a volume in a container.") +for storage. +Here is a summary of the process: + +1. You, as cluster administrator, create a PersistentVolume backed by physical + storage. You do not associate the volume with any Pod. +2. You, now taking the role of a developer / cluster user, create a + PersistentVolumeClaim that is automatically bound to a suitable + PersistentVolume. +3. You create a Pod that uses the above PersistentVolumeClaim for storage. + +## Before you begin + +* You need to have a Kubernetes cluster that has only one Node, and the + [kubectl](/docs/reference/kubectl/ "A command line tool for communicating with a Kubernetes cluster.") + command-line tool must be configured to communicate with your cluster. If you + do not already have a single-node cluster, you can create one by using + [Minikube](https://minikube.sigs.k8s.io/docs/). +* Familiarize yourself with the material in + [Persistent Volumes](/docs/concepts/storage/persistent-volumes/). + +## Create an index.html file on your Node + +Open a shell to the single Node in your cluster. How you open a shell depends +on how you set up your cluster. For example, if you are using Minikube, you +can open a shell to your Node by entering `minikube ssh`. + +In your shell on that Node, create a `/mnt/data` directory: + +```None +# This assumes that your Node uses "sudo" to run commands +# as the superuser +sudo mkdir /mnt/data +``` + +In the `/mnt/data` directory, create an `index.html` file: + +```None +# This again assumes that your Node uses "sudo" to run commands +# as the superuser +sudo sh -c "echo 'Hello from Kubernetes storage' > /mnt/data/index.html" +``` + +#### Note: + +If your Node uses a tool for superuser access other than `sudo`, you can +usually make this work if you replace `sudo` with the name of the other tool. + +Test that the `index.html` file exists: + +```None +cat /mnt/data/index.html +``` + +The output should be: + +```None +Hello from Kubernetes storage +``` + +You can now close the shell to your Node. + +## Create a PersistentVolume + +In this exercise, you create a *hostPath* PersistentVolume. Kubernetes supports +hostPath for development and testing on a single-node cluster. A hostPath +PersistentVolume uses a file or directory on the Node to emulate network-attached storage. + +In a production cluster, you would not use hostPath. Instead a cluster administrator +would provision a network resource like a Google Compute Engine persistent disk, +an NFS share, or an Amazon Elastic Block Store volume. Cluster administrators can also +use [StorageClasses](/docs/reference/generated/kubernetes-api/v1.31/#storageclass-v1-storage-k8s-io) +to set up +[dynamic provisioning](/docs/concepts/storage/dynamic-provisioning/). + +Here is the configuration file for the hostPath PersistentVolume: + +[`pods/storage/pv-volume.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.31/content/en/examples/pods/storage/pv-volume.yaml)![](/images/copycode.svg "Copy pods/storage/pv-volume.yaml to clipboard") + +```None +apiVersion: v1 +kind: PersistentVolume +metadata: + name: task-pv-volume + labels: + type: local +spec: + storageClassName: manual + capacity: + storage: 10Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/data" +``` + +The configuration file specifies that the volume is at `/mnt/data` on the +cluster's Node. The configuration also specifies a size of 10 gibibytes and +an access mode of `ReadWriteOnce`, which means the volume can be mounted as +read-write by a single Node. It defines the [StorageClass name](/docs/concepts/storage/persistent-volumes/#class) +`manual` for the PersistentVolume, which will be used to bind +PersistentVolumeClaim requests to this PersistentVolume. + +#### Note: + +This example uses the `ReadWriteOnce` access mode, for simplicity. For +production use, the Kubernetes project recommends using the `ReadWriteOncePod` +access mode instead. + +Create the PersistentVolume: + +```None +kubectl apply -f https://k8s.io/examples/pods/storage/pv-volume.yaml +``` + +View information about the PersistentVolume: + +```None +kubectl get pv task-pv-volume +``` + +The output shows that the PersistentVolume has a `STATUS` of `Available`. This +means it has not yet been bound to a PersistentVolumeClaim. + +```None +NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE +task-pv-volume 10Gi RWO Retain Available manual 4s +``` + +## Create a PersistentVolumeClaim + +The next step is to create a PersistentVolumeClaim. Pods use PersistentVolumeClaims +to request physical storage. In this exercise, you create a PersistentVolumeClaim +that requests a volume of at least three gibibytes that can provide read-write +access for at most one Node at a time. + +Here is the configuration file for the PersistentVolumeClaim: + +[`pods/storage/pv-claim.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.31/content/en/examples/pods/storage/pv-claim.yaml)![](/images/copycode.svg "Copy pods/storage/pv-claim.yaml to clipboard") + +```None +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: task-pv-claim +spec: + storageClassName: manual + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 3Gi +``` + +Create the PersistentVolumeClaim: + +```None +kubectl apply -f https://k8s.io/examples/pods/storage/pv-claim.yaml +``` + +After you create the PersistentVolumeClaim, the Kubernetes control plane looks +for a PersistentVolume that satisfies the claim's requirements. If the control +plane finds a suitable PersistentVolume with the same StorageClass, it binds the +claim to the volume. + +Look again at the PersistentVolume: + +```None +kubectl get pv task-pv-volume +``` + +Now the output shows a `STATUS` of `Bound`. + +```None +NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE +task-pv-volume 10Gi RWO Retain Bound default/task-pv-claim manual 2m +``` + +Look at the PersistentVolumeClaim: + +```None +kubectl get pvc task-pv-claim +``` + +The output shows that the PersistentVolumeClaim is bound to your PersistentVolume, +`task-pv-volume`. + +```None +NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE +task-pv-claim Bound task-pv-volume 10Gi RWO manual 30s +``` + +## Create a Pod + +The next step is to create a Pod that uses your PersistentVolumeClaim as a volume. + +Here is the configuration file for the Pod: + +[`pods/storage/pv-pod.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.31/content/en/examples/pods/storage/pv-pod.yaml)![](/images/copycode.svg "Copy pods/storage/pv-pod.yaml to clipboard") + +```None +apiVersion: v1 +kind: Pod +metadata: + name: task-pv-pod +spec: + volumes: + - name: task-pv-storage + persistentVolumeClaim: + claimName: task-pv-claim + containers: + - name: task-pv-container + image: nginx + ports: + - containerPort: 80 + name: "http-server" + volumeMounts: + - mountPath: "/usr/share/nginx/html" + name: task-pv-storage +``` + +Notice that the Pod's configuration file specifies a PersistentVolumeClaim, but +it does not specify a PersistentVolume. From the Pod's point of view, the claim +is a volume. + +Create the Pod: + +```None +kubectl apply -f https://k8s.io/examples/pods/storage/pv-pod.yaml +``` + +Verify that the container in the Pod is running; + +```None +kubectl get pod task-pv-pod +``` + +Get a shell to the container running in your Pod: + +```None +kubectl exec -it task-pv-pod -- /bin/bash +``` + +In your shell, verify that nginx is serving the `index.html` file from the +hostPath volume: + +```None +# Be sure to run these 3 commands inside the root shell that comes from +# running "kubectl exec" in the previous step +apt update +apt install curl +curl http://localhost/ +``` + +The output shows the text that you wrote to the `index.html` file on the +hostPath volume: + +```None +Hello from Kubernetes storage +``` + +If you see that message, you have successfully configured a Pod to +use storage from a PersistentVolumeClaim. + +## Clean up + +Delete the Pod, the PersistentVolumeClaim and the PersistentVolume: + +```None +kubectl delete pod task-pv-pod +kubectl delete pvc task-pv-claim +kubectl delete pv task-pv-volume +``` + +If you don't already have a shell open to the Node in your cluster, +open a new shell the same way that you did earlier. + +In the shell on your Node, remove the file and directory that you created: + +```None +# This assumes that your Node uses "sudo" to run commands +# as the superuser +sudo rm /mnt/data/index.html +sudo rmdir /mnt/data +``` + +You can now close the shell to your Node. + +## Mounting the same persistentVolume in two places + +[`pods/storage/pv-duplicate.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.31/content/en/examples/pods/storage/pv-duplicate.yaml)![](/images/copycode.svg "Copy pods/storage/pv-duplicate.yaml to clipboard") + +```None +apiVersion: v1 +kind: Pod +metadata: + name: test +spec: + containers: + - name: test + image: nginx + volumeMounts: + # a mount for site-data + - name: config + mountPath: /usr/share/nginx/html + subPath: html + # another mount for nginx config + - name: config + mountPath: /etc/nginx/nginx.conf + subPath: nginx.conf + volumes: + - name: config + persistentVolumeClaim: + claimName: test-nfs-claim +``` + +You can perform 2 volume mounts on your nginx container: + +* `/usr/share/nginx/html` for the static website +* `/etc/nginx/nginx.conf` for the default config + +## Access control + +Storage configured with a group ID (GID) allows writing only by Pods using the same +GID. Mismatched or missing GIDs cause permission denied errors. To reduce the +need for coordination with users, an administrator can annotate a PersistentVolume +with a GID. Then the GID is automatically added to any Pod that uses the +PersistentVolume. + +Use the `pv.beta.kubernetes.io/gid` annotation as follows: + +```None +apiVersion: v1 +kind: PersistentVolume +metadata: + name: pv1 + annotations: + pv.beta.kubernetes.io/gid: "1234" +``` + +When a Pod consumes a PersistentVolume that has a GID annotation, the annotated GID +is applied to all containers in the Pod in the same way that GIDs specified in the +Pod's security context are. Every GID, whether it originates from a PersistentVolume +annotation or the Pod's specification, is applied to the first process run in +each container. + +#### Note: + +When a Pod consumes a PersistentVolume, the GIDs associated with the +PersistentVolume are not present on the Pod resource itself. + +## What's next + +* Learn more about [PersistentVolumes](/docs/concepts/storage/persistent-volumes/). +* Read the [Persistent Storage design document](https://git.k8s.io/design-proposals-archive/storage/persistent-storage.md). + +### Reference + +* [PersistentVolume](/docs/reference/generated/kubernetes-api/v1.31/#persistentvolume-v1-core) +* [PersistentVolumeSpec](/docs/reference/generated/kubernetes-api/v1.31/#persistentvolumespec-v1-core) +* [PersistentVolumeClaim](/docs/reference/generated/kubernetes-api/v1.31/#persistentvolumeclaim-v1-core) +* [PersistentVolumeClaimSpec](/docs/reference/generated/kubernetes-api/v1.31/#persistentvolumeclaimspec-v1-core) + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified October 10, 2023 at 7:55 AM PST: [Graduate ReadWriteOncePod to GA (c07ce392e4)](https://github.com/kubernetes/website/commit/c07ce392e4cabebd147b8fd22982c507c5d9ac0a) diff --git a/corpus/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v132.md b/corpus/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v132.md new file mode 100644 index 0000000000000000000000000000000000000000..f371d81ecb7deba037ea01551a760281231986a7 --- /dev/null +++ b/corpus/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v132.md @@ -0,0 +1,587 @@ +# Configure a Pod to Use a PersistentVolume for Storage + +Source: https://v1-32.docs.kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/ +Version: v1.32 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Tasks](https://kubernetes.io/docs/tasks/) +3. [Configure Pods and Containers](https://kubernetes.io/docs/tasks/configure-pod-container/) +4. [Configure a Pod to Use a PersistentVolume for Storage](https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/) + +### You are viewing documentation for Kubernetes version: v1.32 + +Kubernetes v1.32 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date information, see the +[latest version.](https://kubernetes.io/docs/home/) + +This page shows you how to configure a Pod to use a +[PersistentVolumeClaim](/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims "Claims storage resources defined in a PersistentVolume so that it can be mounted as a volume in a container.") +for storage. +Here is a summary of the process: + +1. You, as cluster administrator, create a PersistentVolume backed by physical + storage. You do not associate the volume with any Pod. +2. You, now taking the role of a developer / cluster user, create a + PersistentVolumeClaim that is automatically bound to a suitable + PersistentVolume. +3. You create a Pod that uses the above PersistentVolumeClaim for storage. + +## Before you begin + +* You need to have a Kubernetes cluster that has only one Node, and the + [kubectl](/docs/reference/kubectl/ "A command line tool for communicating with a Kubernetes cluster.") + command-line tool must be configured to communicate with your cluster. If you + do not already have a single-node cluster, you can create one by using + [Minikube](https://minikube.sigs.k8s.io/docs/). +* Familiarize yourself with the material in + [Persistent Volumes](/docs/concepts/storage/persistent-volumes/). + +## Create an index.html file on your Node + +Open a shell to the single Node in your cluster. How you open a shell depends +on how you set up your cluster. For example, if you are using Minikube, you +can open a shell to your Node by entering `minikube ssh`. + +In your shell on that Node, create a `/mnt/data` directory: + +```None +# This assumes that your Node uses "sudo" to run commands +# as the superuser +sudo mkdir /mnt/data +``` + +In the `/mnt/data` directory, create an `index.html` file: + +```None +# This again assumes that your Node uses "sudo" to run commands +# as the superuser +sudo sh -c "echo 'Hello from Kubernetes storage' > /mnt/data/index.html" +``` + +#### Note: + +If your Node uses a tool for superuser access other than `sudo`, you can +usually make this work if you replace `sudo` with the name of the other tool. + +Test that the `index.html` file exists: + +```None +cat /mnt/data/index.html +``` + +The output should be: + +```None +Hello from Kubernetes storage +``` + +You can now close the shell to your Node. + +## Create a PersistentVolume + +In this exercise, you create a *hostPath* PersistentVolume. Kubernetes supports +hostPath for development and testing on a single-node cluster. A hostPath +PersistentVolume uses a file or directory on the Node to emulate network-attached storage. + +In a production cluster, you would not use hostPath. Instead a cluster administrator +would provision a network resource like a Google Compute Engine persistent disk, +an NFS share, or an Amazon Elastic Block Store volume. Cluster administrators can also +use [StorageClasses](/docs/reference/generated/kubernetes-api/v1.32/#storageclass-v1-storage-k8s-io) +to set up +[dynamic provisioning](/docs/concepts/storage/dynamic-provisioning/). + +Here is the configuration file for the hostPath PersistentVolume: + +[`pods/storage/pv-volume.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.32/content/en/examples/pods/storage/pv-volume.yaml)![](/images/copycode.svg "Copy pods/storage/pv-volume.yaml to clipboard") + +```None +apiVersion: v1 +kind: PersistentVolume +metadata: + name: task-pv-volume + labels: + type: local +spec: + storageClassName: manual + capacity: + storage: 10Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/data" +``` + +The configuration file specifies that the volume is at `/mnt/data` on the +cluster's Node. The configuration also specifies a size of 10 gibibytes and +an access mode of `ReadWriteOnce`, which means the volume can be mounted as +read-write by a single Node. It defines the [StorageClass name](/docs/concepts/storage/persistent-volumes/#class) +`manual` for the PersistentVolume, which will be used to bind +PersistentVolumeClaim requests to this PersistentVolume. + +#### Note: + +This example uses the `ReadWriteOnce` access mode, for simplicity. For +production use, the Kubernetes project recommends using the `ReadWriteOncePod` +access mode instead. + +Create the PersistentVolume: + +```None +kubectl apply -f https://k8s.io/examples/pods/storage/pv-volume.yaml +``` + +View information about the PersistentVolume: + +```None +kubectl get pv task-pv-volume +``` + +The output shows that the PersistentVolume has a `STATUS` of `Available`. This +means it has not yet been bound to a PersistentVolumeClaim. + +```None +NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE +task-pv-volume 10Gi RWO Retain Available manual 4s +``` + +## Create a PersistentVolumeClaim + +The next step is to create a PersistentVolumeClaim. Pods use PersistentVolumeClaims +to request physical storage. In this exercise, you create a PersistentVolumeClaim +that requests a volume of at least three gibibytes that can provide read-write +access for at most one Node at a time. + +Here is the configuration file for the PersistentVolumeClaim: + +[`pods/storage/pv-claim.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.32/content/en/examples/pods/storage/pv-claim.yaml)![](/images/copycode.svg "Copy pods/storage/pv-claim.yaml to clipboard") + +```None +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: task-pv-claim +spec: + storageClassName: manual + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 3Gi +``` + +Create the PersistentVolumeClaim: + +```None +kubectl apply -f https://k8s.io/examples/pods/storage/pv-claim.yaml +``` + +After you create the PersistentVolumeClaim, the Kubernetes control plane looks +for a PersistentVolume that satisfies the claim's requirements. If the control +plane finds a suitable PersistentVolume with the same StorageClass, it binds the +claim to the volume. + +Look again at the PersistentVolume: + +```None +kubectl get pv task-pv-volume +``` + +Now the output shows a `STATUS` of `Bound`. + +```None +NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE +task-pv-volume 10Gi RWO Retain Bound default/task-pv-claim manual 2m +``` + +Look at the PersistentVolumeClaim: + +```None +kubectl get pvc task-pv-claim +``` + +The output shows that the PersistentVolumeClaim is bound to your PersistentVolume, +`task-pv-volume`. + +```None +NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE +task-pv-claim Bound task-pv-volume 10Gi RWO manual 30s +``` + +## Create a Pod + +The next step is to create a Pod that uses your PersistentVolumeClaim as a volume. + +Here is the configuration file for the Pod: + +[`pods/storage/pv-pod.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.32/content/en/examples/pods/storage/pv-pod.yaml)![](/images/copycode.svg "Copy pods/storage/pv-pod.yaml to clipboard") + +```None +apiVersion: v1 +kind: Pod +metadata: + name: task-pv-pod +spec: + volumes: + - name: task-pv-storage + persistentVolumeClaim: + claimName: task-pv-claim + containers: + - name: task-pv-container + image: nginx + ports: + - containerPort: 80 + name: "http-server" + volumeMounts: + - mountPath: "/usr/share/nginx/html" + name: task-pv-storage +``` + +Notice that the Pod's configuration file specifies a PersistentVolumeClaim, but +it does not specify a PersistentVolume. From the Pod's point of view, the claim +is a volume. + +Create the Pod: + +```None +kubectl apply -f https://k8s.io/examples/pods/storage/pv-pod.yaml +``` + +Verify that the container in the Pod is running: + +```None +kubectl get pod task-pv-pod +``` + +Get a shell to the container running in your Pod: + +```None +kubectl exec -it task-pv-pod -- /bin/bash +``` + +In your shell, verify that nginx is serving the `index.html` file from the +hostPath volume: + +```None +# Be sure to run these 3 commands inside the root shell that comes from +# running "kubectl exec" in the previous step +apt update +apt install curl +curl http://localhost/ +``` + +The output shows the text that you wrote to the `index.html` file on the +hostPath volume: + +```None +Hello from Kubernetes storage +``` + +If you see that message, you have successfully configured a Pod to +use storage from a PersistentVolumeClaim. + +## Clean up + +Delete the Pod: + +```None +kubectl delete pod task-pv-pod +``` + +## Mounting the same PersistentVolume in two places + +You have understood how to create a PersistentVolume & PersistentVolumeClaim, and how to mount +the volume to a single location in a container. Let's explore how you can mount the same PersistentVolume +at two different locations in a container. Below is an example: + +[`pods/storage/pv-duplicate.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.32/content/en/examples/pods/storage/pv-duplicate.yaml)![](/images/copycode.svg "Copy pods/storage/pv-duplicate.yaml to clipboard") + +```None +apiVersion: v1 +kind: Pod +metadata: + name: test +spec: + containers: + - name: test + image: nginx + volumeMounts: + # a mount for site-data + - name: config + mountPath: /usr/share/nginx/html + subPath: html + # another mount for nginx config + - name: config + mountPath: /etc/nginx/nginx.conf + subPath: nginx.conf + volumes: + - name: config + persistentVolumeClaim: + claimName: task-pv-storage +``` + +Here: + +* `subPath`: This field allows specific files or directories from the mounted PersistentVolume to be exposed at + different locations within the container. In this example: + + `subPath: html` mounts the html directory. + + `subPath: nginx.conf` mounts a specific file, nginx.conf. + +Since the first subPath is `html`, an `html` directory has to be created within `/mnt/data/` +on the node. + +The second subPath `nginx.conf` means that a file within the `/mnt/data/` directory will be used. No other directory +needs to be created. + +Two volume mounts will be made on your nginx container: + +* `/usr/share/nginx/html` for the static website +* `/etc/nginx/nginx.conf` for the default config + +### Move the index.html file on your Node to a new folder + +The `index.html` file mentioned here refers to the one created in the "[Create an index.html file on your Node](#create-an-index-html-file-on-your-node)" section. + +Open a shell to the single Node in your cluster. How you open a shell depends on how you set up your cluster. +For example, if you are using Minikube, you can open a shell to your Node by entering `minikube ssh`. + +Create a `/mnt/data/html` directory: + +```None +# This assumes that your Node uses "sudo" to run commands +# as the superuser +sudo mkdir /mnt/data/html +``` + +Move index.html into the directory: + +```None +# Move index.html from its current location to the html sub-directory +sudo mv /mnt/data/index.html html +``` + +### Create a new nginx.conf file + +[`pods/storage/nginx.conf`](https://raw.githubusercontent.com/kubernetes/website/release-1.32/content/en/examples/pods/storage/nginx.conf)![](/images/copycode.svg "Copy pods/storage/nginx.conf to clipboard") + +```None +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + + + +events { +worker_connections 1024; +} + + + +http { +include /etc/nginx/mime.types; +default_type application/octet-stream; + + + +```None +log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + +access_log /var/log/nginx/access.log main; + +sendfile on; +#tcp_nopush on; + +keepalive_timeout 60; + +#gzip on; + +include /etc/nginx/conf.d/*.conf; +``` + + + +} +``` + +This is a modified version of the default `nginx.conf` file. Here, the default `keepalive_timeout` has been +modified to `60` + +Create the nginx.conf file: + +```None +cat < /mnt/data/nginx.conf +user nginx; +worker_processes auto; +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '\$remote_addr - \$remote_user [\$time_local] "\$request" ' + '\$status \$body_bytes_sent "\$http_referer" ' + '"\$http_user_agent" "\$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 60; + + #gzip on; + + include /etc/nginx/conf.d/*.conf; +} +EOF +``` + +### Create a Pod + +Here we will create a pod that uses the existing persistentVolume and persistentVolumeClaim. +However, the pod mounts only a specific file, `nginx.conf`, and directory, `html`, to the container. + +Create the Pod: + +```None +kubectl apply -f https://k8s.io/examples/pods/storage/pv-duplicate.yaml +``` + +Verify that the container in the Pod is running: + +```None +kubectl get pod test +``` + +Get a shell to the container running in your Pod: + +```None +kubectl exec -it test -- /bin/bash +``` + +In your shell, verify that nginx is serving the `index.html` file from the +hostPath volume: + +```None +# Be sure to run these 3 commands inside the root shell that comes from +# running "kubectl exec" in the previous step +apt update +apt install curl +curl http://localhost/ +``` + +The output shows the text that you wrote to the `index.html` file on the +hostPath volume: + +```None +Hello from Kubernetes storage +``` + +In your shell, also verify that nginx is serving the `nginx.conf` file from the +hostPath volume: + +```None +# Be sure to run these commands inside the root shell that comes from +# running "kubectl exec" in the previous step +cat /etc/nginx/nginx.conf | grep keepalive_timeout +``` + +The output shows the modified text that you wrote to the `nginx.conf` file on the +hostPath volume: + +```None +keepalive_timeout 60; +``` + +If you see these messages, you have successfully configured a Pod to +use a specific file and directory in a storage from a PersistentVolumeClaim. + +## Clean up + +Delete the Pod: + +```None +kubectl delete pod test +kubectl delete pvc task-pv-claim +kubectl delete pv task-pv-volume +``` + +If you don't already have a shell open to the Node in your cluster, +open a new shell the same way that you did earlier. + +In the shell on your Node, remove the file and directory that you created: + +```None +# This assumes that your Node uses "sudo" to run commands +# as the superuser +sudo rm /mnt/data/html/index.html +sudo rm /mnt/data/nginx.conf +sudo rmdir /mnt/data +``` + +You can now close the shell to your Node. + +## Access control + +Storage configured with a group ID (GID) allows writing only by Pods using the same +GID. Mismatched or missing GIDs cause permission denied errors. To reduce the +need for coordination with users, an administrator can annotate a PersistentVolume +with a GID. Then the GID is automatically added to any Pod that uses the +PersistentVolume. + +Use the `pv.beta.kubernetes.io/gid` annotation as follows: + +```None +apiVersion: v1 +kind: PersistentVolume +metadata: + name: pv1 + annotations: + pv.beta.kubernetes.io/gid: "1234" +``` + +When a Pod consumes a PersistentVolume that has a GID annotation, the annotated GID +is applied to all containers in the Pod in the same way that GIDs specified in the +Pod's security context are. Every GID, whether it originates from a PersistentVolume +annotation or the Pod's specification, is applied to the first process run in +each container. + +#### Note: + +When a Pod consumes a PersistentVolume, the GIDs associated with the +PersistentVolume are not present on the Pod resource itself. + +## What's next + +* Learn more about [PersistentVolumes](/docs/concepts/storage/persistent-volumes/). +* Read the [Persistent Storage design document](https://git.k8s.io/design-proposals-archive/storage/persistent-storage.md). + +### Reference + +* [PersistentVolume](/docs/reference/generated/kubernetes-api/v1.32/#persistentvolume-v1-core) +* [PersistentVolumeSpec](/docs/reference/generated/kubernetes-api/v1.32/#persistentvolumespec-v1-core) +* [PersistentVolumeClaim](/docs/reference/generated/kubernetes-api/v1.32/#persistentvolumeclaim-v1-core) +* [PersistentVolumeClaimSpec](/docs/reference/generated/kubernetes-api/v1.32/#persistentvolumeclaimspec-v1-core) + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified December 17, 2024 at 5:46 AM PST: [improve pv storage task (f31a75226e)](https://github.com/kubernetes/website/commit/f31a75226efdd03b034fc9fb120e586e07cdc3d4) diff --git a/corpus/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v133.md b/corpus/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v133.md new file mode 100644 index 0000000000000000000000000000000000000000..541a1d46cafa3e80189e840c6a617cd5635108ac --- /dev/null +++ b/corpus/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v133.md @@ -0,0 +1,587 @@ +# Configure a Pod to Use a PersistentVolume for Storage + +Source: https://v1-33.docs.kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/ +Version: v1.33 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Tasks](https://kubernetes.io/docs/tasks/) +3. [Configure Pods and Containers](https://kubernetes.io/docs/tasks/configure-pod-container/) +4. [Configure a Pod to Use a PersistentVolume for Storage](https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/) + +### You are viewing documentation for Kubernetes version: v1.33 + +Kubernetes v1.33 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date information, see the +[latest version.](https://kubernetes.io/docs/home/) + +This page shows you how to configure a Pod to use a +[PersistentVolumeClaim](/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims "Claims storage resources defined in a PersistentVolume so that it can be mounted as a volume in a container.") +for storage. +Here is a summary of the process: + +1. You, as cluster administrator, create a PersistentVolume backed by physical + storage. You do not associate the volume with any Pod. +2. You, now taking the role of a developer / cluster user, create a + PersistentVolumeClaim that is automatically bound to a suitable + PersistentVolume. +3. You create a Pod that uses the above PersistentVolumeClaim for storage. + +## Before you begin + +* You need to have a Kubernetes cluster that has only one Node, and the + [kubectl](/docs/reference/kubectl/ "A command line tool for communicating with a Kubernetes cluster.") + command-line tool must be configured to communicate with your cluster. If you + do not already have a single-node cluster, you can create one by using + [Minikube](https://minikube.sigs.k8s.io/docs/). +* Familiarize yourself with the material in + [Persistent Volumes](/docs/concepts/storage/persistent-volumes/). + +## Create an index.html file on your Node + +Open a shell to the single Node in your cluster. How you open a shell depends +on how you set up your cluster. For example, if you are using Minikube, you +can open a shell to your Node by entering `minikube ssh`. + +In your shell on that Node, create a `/mnt/data` directory: + +```None +# This assumes that your Node uses "sudo" to run commands +# as the superuser +sudo mkdir /mnt/data +``` + +In the `/mnt/data` directory, create an `index.html` file: + +```None +# This again assumes that your Node uses "sudo" to run commands +# as the superuser +sudo sh -c "echo 'Hello from Kubernetes storage' > /mnt/data/index.html" +``` + +#### Note: + +If your Node uses a tool for superuser access other than `sudo`, you can +usually make this work if you replace `sudo` with the name of the other tool. + +Test that the `index.html` file exists: + +```None +cat /mnt/data/index.html +``` + +The output should be: + +```None +Hello from Kubernetes storage +``` + +You can now close the shell to your Node. + +## Create a PersistentVolume + +In this exercise, you create a *hostPath* PersistentVolume. Kubernetes supports +hostPath for development and testing on a single-node cluster. A hostPath +PersistentVolume uses a file or directory on the Node to emulate network-attached storage. + +In a production cluster, you would not use hostPath. Instead a cluster administrator +would provision a network resource like a Google Compute Engine persistent disk, +an NFS share, or an Amazon Elastic Block Store volume. Cluster administrators can also +use [StorageClasses](/docs/reference/generated/kubernetes-api/v1.33/#storageclass-v1-storage-k8s-io) +to set up +[dynamic provisioning](/docs/concepts/storage/dynamic-provisioning/). + +Here is the configuration file for the hostPath PersistentVolume: + +[`pods/storage/pv-volume.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.33/content/en/examples/pods/storage/pv-volume.yaml)![](/images/copycode.svg "Copy pods/storage/pv-volume.yaml to clipboard") + +```None +apiVersion: v1 +kind: PersistentVolume +metadata: + name: task-pv-volume + labels: + type: local +spec: + storageClassName: manual + capacity: + storage: 10Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/data" +``` + +The configuration file specifies that the volume is at `/mnt/data` on the +cluster's Node. The configuration also specifies a size of 10 gibibytes and +an access mode of `ReadWriteOnce`, which means the volume can be mounted as +read-write by a single Node. It defines the [StorageClass name](/docs/concepts/storage/persistent-volumes/#class) +`manual` for the PersistentVolume, which will be used to bind +PersistentVolumeClaim requests to this PersistentVolume. + +#### Note: + +This example uses the `ReadWriteOnce` access mode, for simplicity. For +production use, the Kubernetes project recommends using the `ReadWriteOncePod` +access mode instead. + +Create the PersistentVolume: + +```None +kubectl apply -f https://k8s.io/examples/pods/storage/pv-volume.yaml +``` + +View information about the PersistentVolume: + +```None +kubectl get pv task-pv-volume +``` + +The output shows that the PersistentVolume has a `STATUS` of `Available`. This +means it has not yet been bound to a PersistentVolumeClaim. + +```None +NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE +task-pv-volume 10Gi RWO Retain Available manual 4s +``` + +## Create a PersistentVolumeClaim + +The next step is to create a PersistentVolumeClaim. Pods use PersistentVolumeClaims +to request physical storage. In this exercise, you create a PersistentVolumeClaim +that requests a volume of at least three gibibytes that can provide read-write +access for at most one Node at a time. + +Here is the configuration file for the PersistentVolumeClaim: + +[`pods/storage/pv-claim.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.33/content/en/examples/pods/storage/pv-claim.yaml)![](/images/copycode.svg "Copy pods/storage/pv-claim.yaml to clipboard") + +```None +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: task-pv-claim +spec: + storageClassName: manual + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 3Gi +``` + +Create the PersistentVolumeClaim: + +```None +kubectl apply -f https://k8s.io/examples/pods/storage/pv-claim.yaml +``` + +After you create the PersistentVolumeClaim, the Kubernetes control plane looks +for a PersistentVolume that satisfies the claim's requirements. If the control +plane finds a suitable PersistentVolume with the same StorageClass, it binds the +claim to the volume. + +Look again at the PersistentVolume: + +```None +kubectl get pv task-pv-volume +``` + +Now the output shows a `STATUS` of `Bound`. + +```None +NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE +task-pv-volume 10Gi RWO Retain Bound default/task-pv-claim manual 2m +``` + +Look at the PersistentVolumeClaim: + +```None +kubectl get pvc task-pv-claim +``` + +The output shows that the PersistentVolumeClaim is bound to your PersistentVolume, +`task-pv-volume`. + +```None +NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE +task-pv-claim Bound task-pv-volume 10Gi RWO manual 30s +``` + +## Create a Pod + +The next step is to create a Pod that uses your PersistentVolumeClaim as a volume. + +Here is the configuration file for the Pod: + +[`pods/storage/pv-pod.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.33/content/en/examples/pods/storage/pv-pod.yaml)![](/images/copycode.svg "Copy pods/storage/pv-pod.yaml to clipboard") + +```None +apiVersion: v1 +kind: Pod +metadata: + name: task-pv-pod +spec: + volumes: + - name: task-pv-storage + persistentVolumeClaim: + claimName: task-pv-claim + containers: + - name: task-pv-container + image: nginx + ports: + - containerPort: 80 + name: "http-server" + volumeMounts: + - mountPath: "/usr/share/nginx/html" + name: task-pv-storage +``` + +Notice that the Pod's configuration file specifies a PersistentVolumeClaim, but +it does not specify a PersistentVolume. From the Pod's point of view, the claim +is a volume. + +Create the Pod: + +```None +kubectl apply -f https://k8s.io/examples/pods/storage/pv-pod.yaml +``` + +Verify that the container in the Pod is running: + +```None +kubectl get pod task-pv-pod +``` + +Get a shell to the container running in your Pod: + +```None +kubectl exec -it task-pv-pod -- /bin/bash +``` + +In your shell, verify that nginx is serving the `index.html` file from the +hostPath volume: + +```None +# Be sure to run these 3 commands inside the root shell that comes from +# running "kubectl exec" in the previous step +apt update +apt install curl +curl http://localhost/ +``` + +The output shows the text that you wrote to the `index.html` file on the +hostPath volume: + +```None +Hello from Kubernetes storage +``` + +If you see that message, you have successfully configured a Pod to +use storage from a PersistentVolumeClaim. + +## Clean up + +Delete the Pod: + +```None +kubectl delete pod task-pv-pod +``` + +## Mounting the same PersistentVolume in two places + +You have understood how to create a PersistentVolume & PersistentVolumeClaim, and how to mount +the volume to a single location in a container. Let's explore how you can mount the same PersistentVolume +at two different locations in a container. Below is an example: + +[`pods/storage/pv-duplicate.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.33/content/en/examples/pods/storage/pv-duplicate.yaml)![](/images/copycode.svg "Copy pods/storage/pv-duplicate.yaml to clipboard") + +```None +apiVersion: v1 +kind: Pod +metadata: + name: test +spec: + containers: + - name: test + image: nginx + volumeMounts: + # a mount for site-data + - name: config + mountPath: /usr/share/nginx/html + subPath: html + # another mount for nginx config + - name: config + mountPath: /etc/nginx/nginx.conf + subPath: nginx.conf + volumes: + - name: config + persistentVolumeClaim: + claimName: task-pv-storage +``` + +Here: + +* `subPath`: This field allows specific files or directories from the mounted PersistentVolume to be exposed at + different locations within the container. In this example: + + `subPath: html` mounts the html directory. + + `subPath: nginx.conf` mounts a specific file, nginx.conf. + +Since the first subPath is `html`, an `html` directory has to be created within `/mnt/data/` +on the node. + +The second subPath `nginx.conf` means that a file within the `/mnt/data/` directory will be used. No other directory +needs to be created. + +Two volume mounts will be made on your nginx container: + +* `/usr/share/nginx/html` for the static website +* `/etc/nginx/nginx.conf` for the default config + +### Move the index.html file on your Node to a new folder + +The `index.html` file mentioned here refers to the one created in the "[Create an index.html file on your Node](#create-an-index-html-file-on-your-node)" section. + +Open a shell to the single Node in your cluster. How you open a shell depends on how you set up your cluster. +For example, if you are using Minikube, you can open a shell to your Node by entering `minikube ssh`. + +Create a `/mnt/data/html` directory: + +```None +# This assumes that your Node uses "sudo" to run commands +# as the superuser +sudo mkdir /mnt/data/html +``` + +Move index.html into the directory: + +```None +# Move index.html from its current location to the html sub-directory +sudo mv /mnt/data/index.html html +``` + +### Create a new nginx.conf file + +[`pods/storage/nginx.conf`](https://raw.githubusercontent.com/kubernetes/website/release-1.33/content/en/examples/pods/storage/nginx.conf)![](/images/copycode.svg "Copy pods/storage/nginx.conf to clipboard") + +```None +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + + + +events { +worker_connections 1024; +} + + + +http { +include /etc/nginx/mime.types; +default_type application/octet-stream; + + + +```None +log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + +access_log /var/log/nginx/access.log main; + +sendfile on; +#tcp_nopush on; + +keepalive_timeout 60; + +#gzip on; + +include /etc/nginx/conf.d/*.conf; +``` + + + +} +``` + +This is a modified version of the default `nginx.conf` file. Here, the default `keepalive_timeout` has been +modified to `60` + +Create the nginx.conf file: + +```None +cat < /mnt/data/nginx.conf +user nginx; +worker_processes auto; +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '\$remote_addr - \$remote_user [\$time_local] "\$request" ' + '\$status \$body_bytes_sent "\$http_referer" ' + '"\$http_user_agent" "\$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 60; + + #gzip on; + + include /etc/nginx/conf.d/*.conf; +} +EOF +``` + +### Create a Pod + +Here we will create a pod that uses the existing persistentVolume and persistentVolumeClaim. +However, the pod mounts only a specific file, `nginx.conf`, and directory, `html`, to the container. + +Create the Pod: + +```None +kubectl apply -f https://k8s.io/examples/pods/storage/pv-duplicate.yaml +``` + +Verify that the container in the Pod is running: + +```None +kubectl get pod test +``` + +Get a shell to the container running in your Pod: + +```None +kubectl exec -it test -- /bin/bash +``` + +In your shell, verify that nginx is serving the `index.html` file from the +hostPath volume: + +```None +# Be sure to run these 3 commands inside the root shell that comes from +# running "kubectl exec" in the previous step +apt update +apt install curl +curl http://localhost/ +``` + +The output shows the text that you wrote to the `index.html` file on the +hostPath volume: + +```None +Hello from Kubernetes storage +``` + +In your shell, also verify that nginx is serving the `nginx.conf` file from the +hostPath volume: + +```None +# Be sure to run these commands inside the root shell that comes from +# running "kubectl exec" in the previous step +cat /etc/nginx/nginx.conf | grep keepalive_timeout +``` + +The output shows the modified text that you wrote to the `nginx.conf` file on the +hostPath volume: + +```None +keepalive_timeout 60; +``` + +If you see these messages, you have successfully configured a Pod to +use a specific file and directory in a storage from a PersistentVolumeClaim. + +## Clean up + +Delete the Pod: + +```None +kubectl delete pod test +kubectl delete pvc task-pv-claim +kubectl delete pv task-pv-volume +``` + +If you don't already have a shell open to the Node in your cluster, +open a new shell the same way that you did earlier. + +In the shell on your Node, remove the file and directory that you created: + +```None +# This assumes that your Node uses "sudo" to run commands +# as the superuser +sudo rm /mnt/data/html/index.html +sudo rm /mnt/data/nginx.conf +sudo rmdir /mnt/data +``` + +You can now close the shell to your Node. + +## Access control + +Storage configured with a group ID (GID) allows writing only by Pods using the same +GID. Mismatched or missing GIDs cause permission denied errors. To reduce the +need for coordination with users, an administrator can annotate a PersistentVolume +with a GID. Then the GID is automatically added to any Pod that uses the +PersistentVolume. + +Use the `pv.beta.kubernetes.io/gid` annotation as follows: + +```None +apiVersion: v1 +kind: PersistentVolume +metadata: + name: pv1 + annotations: + pv.beta.kubernetes.io/gid: "1234" +``` + +When a Pod consumes a PersistentVolume that has a GID annotation, the annotated GID +is applied to all containers in the Pod in the same way that GIDs specified in the +Pod's security context are. Every GID, whether it originates from a PersistentVolume +annotation or the Pod's specification, is applied to the first process run in +each container. + +#### Note: + +When a Pod consumes a PersistentVolume, the GIDs associated with the +PersistentVolume are not present on the Pod resource itself. + +## What's next + +* Learn more about [PersistentVolumes](/docs/concepts/storage/persistent-volumes/). +* Read the [Persistent Storage design document](https://git.k8s.io/design-proposals-archive/storage/persistent-storage.md). + +### Reference + +* [PersistentVolume](/docs/reference/generated/kubernetes-api/v1.33/#persistentvolume-v1-core) +* [PersistentVolumeSpec](/docs/reference/generated/kubernetes-api/v1.33/#persistentvolumespec-v1-core) +* [PersistentVolumeClaim](/docs/reference/generated/kubernetes-api/v1.33/#persistentvolumeclaim-v1-core) +* [PersistentVolumeClaimSpec](/docs/reference/generated/kubernetes-api/v1.33/#persistentvolumeclaimspec-v1-core) + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified December 17, 2024 at 5:46 AM PST: [improve pv storage task (f31a75226e)](https://github.com/kubernetes/website/commit/f31a75226efdd03b034fc9fb120e586e07cdc3d4) diff --git a/corpus/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md b/corpus/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md new file mode 100644 index 0000000000000000000000000000000000000000..d888d2ef3770ed2e9d144f243a25b4cda4f2112f --- /dev/null +++ b/corpus/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v134.md @@ -0,0 +1,587 @@ +# Configure a Pod to Use a PersistentVolume for Storage + +Source: https://v1-34.docs.kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/ +Version: v1.34 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Tasks](https://kubernetes.io/docs/tasks/) +3. [Configure Pods and Containers](https://kubernetes.io/docs/tasks/configure-pod-container/) +4. [Configure a Pod to Use a PersistentVolume for Storage](https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/) + +### You are viewing documentation for Kubernetes version: v1.34 + +Kubernetes v1.34 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date information, see the +[latest version.](https://kubernetes.io/docs/home/) + +This page shows you how to configure a Pod to use a +[PersistentVolumeClaim](/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims "Claims storage resources defined in a PersistentVolume so that it can be mounted as a volume in a container.") +for storage. +Here is a summary of the process: + +1. You, as cluster administrator, create a PersistentVolume backed by physical + storage. You do not associate the volume with any Pod. +2. You, now taking the role of a developer / cluster user, create a + PersistentVolumeClaim that is automatically bound to a suitable + PersistentVolume. +3. You create a Pod that uses the above PersistentVolumeClaim for storage. + +## Before you begin + +* You need to have a Kubernetes cluster that has only one Node, and the + [kubectl](/docs/reference/kubectl/ "A command line tool for communicating with a Kubernetes cluster.") + command-line tool must be configured to communicate with your cluster. If you + do not already have a single-node cluster, you can create one by using + [Minikube](https://minikube.sigs.k8s.io/docs/). +* Familiarize yourself with the material in + [Persistent Volumes](/docs/concepts/storage/persistent-volumes/). + +## Create an index.html file on your Node + +Open a shell to the single Node in your cluster. How you open a shell depends +on how you set up your cluster. For example, if you are using Minikube, you +can open a shell to your Node by entering `minikube ssh`. + +In your shell on that Node, create a `/mnt/data` directory: + +```None +# This assumes that your Node uses "sudo" to run commands +# as the superuser +sudo mkdir /mnt/data +``` + +In the `/mnt/data` directory, create an `index.html` file: + +```None +# This again assumes that your Node uses "sudo" to run commands +# as the superuser +sudo sh -c "echo 'Hello from Kubernetes storage' > /mnt/data/index.html" +``` + +#### Note: + +If your Node uses a tool for superuser access other than `sudo`, you can +usually make this work if you replace `sudo` with the name of the other tool. + +Test that the `index.html` file exists: + +```None +cat /mnt/data/index.html +``` + +The output should be: + +```None +Hello from Kubernetes storage +``` + +You can now close the shell to your Node. + +## Create a PersistentVolume + +In this exercise, you create a *hostPath* PersistentVolume. Kubernetes supports +hostPath for development and testing on a single-node cluster. A hostPath +PersistentVolume uses a file or directory on the Node to emulate network-attached storage. + +In a production cluster, you would not use hostPath. Instead a cluster administrator +would provision a network resource like a Google Compute Engine persistent disk, +an NFS share, or an Amazon Elastic Block Store volume. Cluster administrators can also +use [StorageClasses](/docs/reference/generated/kubernetes-api/v1.34/#storageclass-v1-storage-k8s-io) +to set up +[dynamic provisioning](/docs/concepts/storage/dynamic-provisioning/). + +Here is the configuration file for the hostPath PersistentVolume: + +[`pods/storage/pv-volume.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.34/content/en/examples/pods/storage/pv-volume.yaml)![](/images/copycode.svg "Copy pods/storage/pv-volume.yaml to clipboard") + +```None +apiVersion: v1 +kind: PersistentVolume +metadata: + name: task-pv-volume + labels: + type: local +spec: + storageClassName: manual + capacity: + storage: 10Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/data" +``` + +The configuration file specifies that the volume is at `/mnt/data` on the +cluster's Node. The configuration also specifies a size of 10 gibibytes and +an access mode of `ReadWriteOnce`, which means the volume can be mounted as +read-write by a single Node. It defines the [StorageClass name](/docs/concepts/storage/persistent-volumes/#class) +`manual` for the PersistentVolume, which will be used to bind +PersistentVolumeClaim requests to this PersistentVolume. + +#### Note: + +This example uses the `ReadWriteOnce` access mode, for simplicity. For +production use, the Kubernetes project recommends using the `ReadWriteOncePod` +access mode instead. + +Create the PersistentVolume: + +```None +kubectl apply -f https://k8s.io/examples/pods/storage/pv-volume.yaml +``` + +View information about the PersistentVolume: + +```None +kubectl get pv task-pv-volume +``` + +The output shows that the PersistentVolume has a `STATUS` of `Available`. This +means it has not yet been bound to a PersistentVolumeClaim. + +```None +NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE +task-pv-volume 10Gi RWO Retain Available manual 4s +``` + +## Create a PersistentVolumeClaim + +The next step is to create a PersistentVolumeClaim. Pods use PersistentVolumeClaims +to request physical storage. In this exercise, you create a PersistentVolumeClaim +that requests a volume of at least three gibibytes that can provide read-write +access for at most one Node at a time. + +Here is the configuration file for the PersistentVolumeClaim: + +[`pods/storage/pv-claim.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.34/content/en/examples/pods/storage/pv-claim.yaml)![](/images/copycode.svg "Copy pods/storage/pv-claim.yaml to clipboard") + +```None +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: task-pv-claim +spec: + storageClassName: manual + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 3Gi +``` + +Create the PersistentVolumeClaim: + +```None +kubectl apply -f https://k8s.io/examples/pods/storage/pv-claim.yaml +``` + +After you create the PersistentVolumeClaim, the Kubernetes control plane looks +for a PersistentVolume that satisfies the claim's requirements. If the control +plane finds a suitable PersistentVolume with the same StorageClass, it binds the +claim to the volume. + +Look again at the PersistentVolume: + +```None +kubectl get pv task-pv-volume +``` + +Now the output shows a `STATUS` of `Bound`. + +```None +NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE +task-pv-volume 10Gi RWO Retain Bound default/task-pv-claim manual 2m +``` + +Look at the PersistentVolumeClaim: + +```None +kubectl get pvc task-pv-claim +``` + +The output shows that the PersistentVolumeClaim is bound to your PersistentVolume, +`task-pv-volume`. + +```None +NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE +task-pv-claim Bound task-pv-volume 10Gi RWO manual 30s +``` + +## Create a Pod + +The next step is to create a Pod that uses your PersistentVolumeClaim as a volume. + +Here is the configuration file for the Pod: + +[`pods/storage/pv-pod.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.34/content/en/examples/pods/storage/pv-pod.yaml)![](/images/copycode.svg "Copy pods/storage/pv-pod.yaml to clipboard") + +```None +apiVersion: v1 +kind: Pod +metadata: + name: task-pv-pod +spec: + volumes: + - name: task-pv-storage + persistentVolumeClaim: + claimName: task-pv-claim + containers: + - name: task-pv-container + image: nginx + ports: + - containerPort: 80 + name: "http-server" + volumeMounts: + - mountPath: "/usr/share/nginx/html" + name: task-pv-storage +``` + +Notice that the Pod's configuration file specifies a PersistentVolumeClaim, but +it does not specify a PersistentVolume. From the Pod's point of view, the claim +is a volume. + +Create the Pod: + +```None +kubectl apply -f https://k8s.io/examples/pods/storage/pv-pod.yaml +``` + +Verify that the container in the Pod is running: + +```None +kubectl get pod task-pv-pod +``` + +Get a shell to the container running in your Pod: + +```None +kubectl exec -it task-pv-pod -- /bin/bash +``` + +In your shell, verify that nginx is serving the `index.html` file from the +hostPath volume: + +```None +# Be sure to run these 3 commands inside the root shell that comes from +# running "kubectl exec" in the previous step +apt update +apt install curl +curl http://localhost/ +``` + +The output shows the text that you wrote to the `index.html` file on the +hostPath volume: + +```None +Hello from Kubernetes storage +``` + +If you see that message, you have successfully configured a Pod to +use storage from a PersistentVolumeClaim. + +## Clean up + +Delete the Pod: + +```None +kubectl delete pod task-pv-pod +``` + +## Mounting the same PersistentVolume in two places + +You have understood how to create a PersistentVolume & PersistentVolumeClaim, and how to mount +the volume to a single location in a container. Let's explore how you can mount the same PersistentVolume +at two different locations in a container. Below is an example: + +[`pods/storage/pv-duplicate.yaml`](https://raw.githubusercontent.com/kubernetes/website/release-1.34/content/en/examples/pods/storage/pv-duplicate.yaml)![](/images/copycode.svg "Copy pods/storage/pv-duplicate.yaml to clipboard") + +```None +apiVersion: v1 +kind: Pod +metadata: + name: test +spec: + containers: + - name: test + image: nginx + volumeMounts: + # a mount for site-data + - name: config + mountPath: /usr/share/nginx/html + subPath: html + # another mount for nginx config + - name: config + mountPath: /etc/nginx/nginx.conf + subPath: nginx.conf + volumes: + - name: config + persistentVolumeClaim: + claimName: task-pv-storage +``` + +Here: + +* `subPath`: This field allows specific files or directories from the mounted PersistentVolume to be exposed at + different locations within the container. In this example: + + `subPath: html` mounts the html directory. + + `subPath: nginx.conf` mounts a specific file, nginx.conf. + +Since the first subPath is `html`, an `html` directory has to be created within `/mnt/data/` +on the node. + +The second subPath `nginx.conf` means that a file within the `/mnt/data/` directory will be used. No other directory +needs to be created. + +Two volume mounts will be made on your nginx container: + +* `/usr/share/nginx/html` for the static website +* `/etc/nginx/nginx.conf` for the default config + +### Move the index.html file on your Node to a new folder + +The `index.html` file mentioned here refers to the one created in the "[Create an index.html file on your Node](#create-an-index-html-file-on-your-node)" section. + +Open a shell to the single Node in your cluster. How you open a shell depends on how you set up your cluster. +For example, if you are using Minikube, you can open a shell to your Node by entering `minikube ssh`. + +Create a `/mnt/data/html` directory: + +```None +# This assumes that your Node uses "sudo" to run commands +# as the superuser +sudo mkdir /mnt/data/html +``` + +Move index.html into the directory: + +```None +# Move index.html from its current location to the html sub-directory +sudo mv /mnt/data/index.html html +``` + +### Create a new nginx.conf file + +[`pods/storage/nginx.conf`](https://raw.githubusercontent.com/kubernetes/website/release-1.34/content/en/examples/pods/storage/nginx.conf)![](/images/copycode.svg "Copy pods/storage/nginx.conf to clipboard") + +```None +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + + + +events { +worker_connections 1024; +} + + + +http { +include /etc/nginx/mime.types; +default_type application/octet-stream; + + + +```None +log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + +access_log /var/log/nginx/access.log main; + +sendfile on; +#tcp_nopush on; + +keepalive_timeout 60; + +#gzip on; + +include /etc/nginx/conf.d/*.conf; +``` + + + +} +``` + +This is a modified version of the default `nginx.conf` file. Here, the default `keepalive_timeout` has been +modified to `60` + +Create the nginx.conf file: + +```None +cat < /mnt/data/nginx.conf +user nginx; +worker_processes auto; +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '\$remote_addr - \$remote_user [\$time_local] "\$request" ' + '\$status \$body_bytes_sent "\$http_referer" ' + '"\$http_user_agent" "\$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 60; + + #gzip on; + + include /etc/nginx/conf.d/*.conf; +} +EOF +``` + +### Create a Pod + +Here we will create a pod that uses the existing persistentVolume and persistentVolumeClaim. +However, the pod mounts only a specific file, `nginx.conf`, and directory, `html`, to the container. + +Create the Pod: + +```None +kubectl apply -f https://k8s.io/examples/pods/storage/pv-duplicate.yaml +``` + +Verify that the container in the Pod is running: + +```None +kubectl get pod test +``` + +Get a shell to the container running in your Pod: + +```None +kubectl exec -it test -- /bin/bash +``` + +In your shell, verify that nginx is serving the `index.html` file from the +hostPath volume: + +```None +# Be sure to run these 3 commands inside the root shell that comes from +# running "kubectl exec" in the previous step +apt update +apt install curl +curl http://localhost/ +``` + +The output shows the text that you wrote to the `index.html` file on the +hostPath volume: + +```None +Hello from Kubernetes storage +``` + +In your shell, also verify that nginx is serving the `nginx.conf` file from the +hostPath volume: + +```None +# Be sure to run these commands inside the root shell that comes from +# running "kubectl exec" in the previous step +cat /etc/nginx/nginx.conf | grep keepalive_timeout +``` + +The output shows the modified text that you wrote to the `nginx.conf` file on the +hostPath volume: + +```None +keepalive_timeout 60; +``` + +If you see these messages, you have successfully configured a Pod to +use a specific file and directory in a storage from a PersistentVolumeClaim. + +## Clean up + +Delete the Pod: + +```None +kubectl delete pod test +kubectl delete pvc task-pv-claim +kubectl delete pv task-pv-volume +``` + +If you don't already have a shell open to the Node in your cluster, +open a new shell the same way that you did earlier. + +In the shell on your Node, remove the file and directory that you created: + +```None +# This assumes that your Node uses "sudo" to run commands +# as the superuser +sudo rm /mnt/data/html/index.html +sudo rm /mnt/data/nginx.conf +sudo rmdir /mnt/data +``` + +You can now close the shell to your Node. + +## Access control + +Storage configured with a group ID (GID) allows writing only by Pods using the same +GID. Mismatched or missing GIDs cause permission denied errors. To reduce the +need for coordination with users, an administrator can annotate a PersistentVolume +with a GID. Then the GID is automatically added to any Pod that uses the +PersistentVolume. + +Use the `pv.beta.kubernetes.io/gid` annotation as follows: + +```None +apiVersion: v1 +kind: PersistentVolume +metadata: + name: pv1 + annotations: + pv.beta.kubernetes.io/gid: "1234" +``` + +When a Pod consumes a PersistentVolume that has a GID annotation, the annotated GID +is applied to all containers in the Pod in the same way that GIDs specified in the +Pod's security context are. Every GID, whether it originates from a PersistentVolume +annotation or the Pod's specification, is applied to the first process run in +each container. + +#### Note: + +When a Pod consumes a PersistentVolume, the GIDs associated with the +PersistentVolume are not present on the Pod resource itself. + +## What's next + +* Learn more about [PersistentVolumes](/docs/concepts/storage/persistent-volumes/). +* Read the [Persistent Storage design document](https://git.k8s.io/design-proposals-archive/storage/persistent-storage.md). + +### Reference + +* [PersistentVolume](/docs/reference/generated/kubernetes-api/v1.34/#persistentvolume-v1-core) +* [PersistentVolumeSpec](/docs/reference/generated/kubernetes-api/v1.34/#persistentvolumespec-v1-core) +* [PersistentVolumeClaim](/docs/reference/generated/kubernetes-api/v1.34/#persistentvolumeclaim-v1-core) +* [PersistentVolumeClaimSpec](/docs/reference/generated/kubernetes-api/v1.34/#persistentvolumeclaimspec-v1-core) + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified December 17, 2024 at 5:46 AM PST: [improve pv storage task (f31a75226e)](https://github.com/kubernetes/website/commit/f31a75226efdd03b034fc9fb120e586e07cdc3d4) diff --git a/corpus/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md b/corpus/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md new file mode 100644 index 0000000000000000000000000000000000000000..bac36d400a7af8560adc66ec486200e6625a21c3 --- /dev/null +++ b/corpus/docs/kubernetes/persistent-volume-storage/persistent-volume-storage_v135.md @@ -0,0 +1,582 @@ +# Configure a Pod to Use a PersistentVolume for Storage + +Source: https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/ +Version: v1.35 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Tasks](https://kubernetes.io/docs/tasks/) +3. [Configure Pods and Containers](https://kubernetes.io/docs/tasks/configure-pod-container/) +4. [Configure a Pod to Use a PersistentVolume for Storage](https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/) + +This page shows you how to configure a Pod to use a +[PersistentVolumeClaim](/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims "Claims storage resources defined in a PersistentVolume so that it can be mounted as a volume in a container.") +for storage. +Here is a summary of the process: + +1. You, as cluster administrator, create a PersistentVolume backed by physical + storage. You do not associate the volume with any Pod. +2. You, now taking the role of a developer / cluster user, create a + PersistentVolumeClaim that is automatically bound to a suitable + PersistentVolume. +3. You create a Pod that uses the above PersistentVolumeClaim for storage. + +## Before you begin + +* You need to have a Kubernetes cluster that has only one Node, and the + [kubectl](/docs/reference/kubectl/ "A command line tool for communicating with a Kubernetes cluster.") + command-line tool must be configured to communicate with your cluster. If you + do not already have a single-node cluster, you can create one by using + [Minikube](https://minikube.sigs.k8s.io/docs/). +* Familiarize yourself with the material in + [Persistent Volumes](/docs/concepts/storage/persistent-volumes/). + +## Create an index.html file on your Node + +Open a shell to the single Node in your cluster. How you open a shell depends +on how you set up your cluster. For example, if you are using Minikube, you +can open a shell to your Node by entering `minikube ssh`. + +In your shell on that Node, create a `/mnt/data` directory: + +```None +# This assumes that your Node uses "sudo" to run commands +# as the superuser +sudo mkdir /mnt/data +``` + +In the `/mnt/data` directory, create an `index.html` file: + +```None +# This again assumes that your Node uses "sudo" to run commands +# as the superuser +sudo sh -c "echo 'Hello from Kubernetes storage' > /mnt/data/index.html" +``` + +#### Note: + +If your Node uses a tool for superuser access other than `sudo`, you can +usually make this work if you replace `sudo` with the name of the other tool. + +Test that the `index.html` file exists: + +```None +cat /mnt/data/index.html +``` + +The output should be: + +```None +Hello from Kubernetes storage +``` + +You can now close the shell to your Node. + +## Create a PersistentVolume + +In this exercise, you create a *hostPath* PersistentVolume. Kubernetes supports +hostPath for development and testing on a single-node cluster. A hostPath +PersistentVolume uses a file or directory on the Node to emulate network-attached storage. + +In a production cluster, you would not use hostPath. Instead a cluster administrator +would provision a network resource like a Google Compute Engine persistent disk, +an NFS share, or an Amazon Elastic Block Store volume. Cluster administrators can also +use [StorageClasses](/docs/reference/generated/kubernetes-api/v1.35/#storageclass-v1-storage-k8s-io) +to set up +[dynamic provisioning](/docs/concepts/storage/dynamic-provisioning/). + +Here is the configuration file for the hostPath PersistentVolume: + +[`pods/storage/pv-volume.yaml`](https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/storage/pv-volume.yaml)![](/images/copycode.svg "Copy pods/storage/pv-volume.yaml to clipboard") + +```None +apiVersion: v1 +kind: PersistentVolume +metadata: + name: task-pv-volume + labels: + type: local +spec: + storageClassName: manual + capacity: + storage: 10Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/data" +``` + +The configuration file specifies that the volume is at `/mnt/data` on the +cluster's Node. The configuration also specifies a size of 10 gibibytes and +an access mode of `ReadWriteOnce`, which means the volume can be mounted as +read-write by a single Node. It defines the [StorageClass name](/docs/concepts/storage/persistent-volumes/#class) +`manual` for the PersistentVolume, which will be used to bind +PersistentVolumeClaim requests to this PersistentVolume. + +#### Note: + +This example uses the `ReadWriteOnce` access mode, for simplicity. For +production use, the Kubernetes project recommends using the `ReadWriteOncePod` +access mode instead. + +Create the PersistentVolume: + +```None +kubectl apply -f https://k8s.io/examples/pods/storage/pv-volume.yaml +``` + +View information about the PersistentVolume: + +```None +kubectl get pv task-pv-volume +``` + +The output shows that the PersistentVolume has a `STATUS` of `Available`. This +means it has not yet been bound to a PersistentVolumeClaim. + +```None +NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE +task-pv-volume 10Gi RWO Retain Available manual 4s +``` + +## Create a PersistentVolumeClaim + +The next step is to create a PersistentVolumeClaim. Pods use PersistentVolumeClaims +to request physical storage. In this exercise, you create a PersistentVolumeClaim +that requests a volume of at least three gibibytes that can provide read-write +access for at most one Node at a time. + +Here is the configuration file for the PersistentVolumeClaim: + +[`pods/storage/pv-claim.yaml`](https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/storage/pv-claim.yaml)![](/images/copycode.svg "Copy pods/storage/pv-claim.yaml to clipboard") + +```None +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: task-pv-claim +spec: + storageClassName: manual + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 3Gi +``` + +Create the PersistentVolumeClaim: + +```None +kubectl apply -f https://k8s.io/examples/pods/storage/pv-claim.yaml +``` + +After you create the PersistentVolumeClaim, the Kubernetes control plane looks +for a PersistentVolume that satisfies the claim's requirements. If the control +plane finds a suitable PersistentVolume with the same StorageClass, it binds the +claim to the volume. + +Look again at the PersistentVolume: + +```None +kubectl get pv task-pv-volume +``` + +Now the output shows a `STATUS` of `Bound`. + +```None +NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE +task-pv-volume 10Gi RWO Retain Bound default/task-pv-claim manual 2m +``` + +Look at the PersistentVolumeClaim: + +```None +kubectl get pvc task-pv-claim +``` + +The output shows that the PersistentVolumeClaim is bound to your PersistentVolume, +`task-pv-volume`. + +```None +NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE +task-pv-claim Bound task-pv-volume 10Gi RWO manual 30s +``` + +## Create a Pod + +The next step is to create a Pod that uses your PersistentVolumeClaim as a volume. + +Here is the configuration file for the Pod: + +[`pods/storage/pv-pod.yaml`](https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/storage/pv-pod.yaml)![](/images/copycode.svg "Copy pods/storage/pv-pod.yaml to clipboard") + +```None +apiVersion: v1 +kind: Pod +metadata: + name: task-pv-pod +spec: + volumes: + - name: task-pv-storage + persistentVolumeClaim: + claimName: task-pv-claim + containers: + - name: task-pv-container + image: nginx + ports: + - containerPort: 80 + name: "http-server" + volumeMounts: + - mountPath: "/usr/share/nginx/html" + name: task-pv-storage +``` + +Notice that the Pod's configuration file specifies a PersistentVolumeClaim, but +it does not specify a PersistentVolume. From the Pod's point of view, the claim +is a volume. + +Create the Pod: + +```None +kubectl apply -f https://k8s.io/examples/pods/storage/pv-pod.yaml +``` + +Verify that the container in the Pod is running: + +```None +kubectl get pod task-pv-pod +``` + +Get a shell to the container running in your Pod: + +```None +kubectl exec -it task-pv-pod -- /bin/bash +``` + +In your shell, verify that nginx is serving the `index.html` file from the +hostPath volume: + +```None +# Be sure to run these 3 commands inside the root shell that comes from +# running "kubectl exec" in the previous step +apt update +apt install curl +curl http://localhost/ +``` + +The output shows the text that you wrote to the `index.html` file on the +hostPath volume: + +```None +Hello from Kubernetes storage +``` + +If you see that message, you have successfully configured a Pod to +use storage from a PersistentVolumeClaim. + +## Clean up + +Delete the Pod: + +```None +kubectl delete pod task-pv-pod +``` + +## Mounting the same PersistentVolume in two places + +You have understood how to create a PersistentVolume & PersistentVolumeClaim, and how to mount +the volume to a single location in a container. Let's explore how you can mount the same PersistentVolume +at two different locations in a container. Below is an example: + +[`pods/storage/pv-duplicate.yaml`](https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/storage/pv-duplicate.yaml)![](/images/copycode.svg "Copy pods/storage/pv-duplicate.yaml to clipboard") + +```None +apiVersion: v1 +kind: Pod +metadata: + name: test +spec: + containers: + - name: test + image: nginx + volumeMounts: + # a mount for site-data + - name: config + mountPath: /usr/share/nginx/html + subPath: html + # another mount for nginx config + - name: config + mountPath: /etc/nginx/nginx.conf + subPath: nginx.conf + volumes: + - name: config + persistentVolumeClaim: + claimName: task-pv-claim +``` + +Here: + +* `subPath`: This field allows specific files or directories from the mounted PersistentVolume to be exposed at + different locations within the container. In this example: + + `subPath: html` mounts the html directory. + + `subPath: nginx.conf` mounts a specific file, nginx.conf. + +Since the first subPath is `html`, an `html` directory has to be created within `/mnt/data/` +on the node. + +The second subPath `nginx.conf` means that a file within the `/mnt/data/` directory will be used. No other directory +needs to be created. + +Two volume mounts will be made on your nginx container: + +* `/usr/share/nginx/html` for the static website +* `/etc/nginx/nginx.conf` for the default config + +### Move the index.html file on your Node to a new folder + +The `index.html` file mentioned here refers to the one created in the "[Create an index.html file on your Node](#create-an-index-html-file-on-your-node)" section. + +Open a shell to the single Node in your cluster. How you open a shell depends on how you set up your cluster. +For example, if you are using Minikube, you can open a shell to your Node by entering `minikube ssh`. + +Create a `/mnt/data/html` directory: + +```None +# This assumes that your Node uses "sudo" to run commands +# as the superuser +sudo mkdir /mnt/data/html +``` + +Move index.html into the directory: + +```None +# Move index.html from its current location to the html sub-directory +sudo mv /mnt/data/index.html html +``` + +### Create a new nginx.conf file + +[`pods/storage/nginx.conf`](https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/storage/nginx.conf)![](/images/copycode.svg "Copy pods/storage/nginx.conf to clipboard") + +```None +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + + + +events { +worker_connections 1024; +} + + + +http { +include /etc/nginx/mime.types; +default_type application/octet-stream; + + + +```None +log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + +access_log /var/log/nginx/access.log main; + +sendfile on; +#tcp_nopush on; + +keepalive_timeout 60; + +#gzip on; + +include /etc/nginx/conf.d/*.conf; +``` + + + +} +``` + +This is a modified version of the default `nginx.conf` file. Here, the default `keepalive_timeout` has been +modified to `60` + +Create the nginx.conf file: + +```None +cat < /mnt/data/nginx.conf +user nginx; +worker_processes auto; +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '\$remote_addr - \$remote_user [\$time_local] "\$request" ' + '\$status \$body_bytes_sent "\$http_referer" ' + '"\$http_user_agent" "\$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 60; + + #gzip on; + + include /etc/nginx/conf.d/*.conf; +} +EOF +``` + +### Create a Pod + +Here we will create a pod that uses the existing persistentVolume and persistentVolumeClaim. +However, the pod mounts only a specific file, `nginx.conf`, and directory, `html`, to the container. + +Create the Pod: + +```None +kubectl apply -f https://k8s.io/examples/pods/storage/pv-duplicate.yaml +``` + +Verify that the container in the Pod is running: + +```None +kubectl get pod test +``` + +Get a shell to the container running in your Pod: + +```None +kubectl exec -it test -- /bin/bash +``` + +In your shell, verify that nginx is serving the `index.html` file from the +hostPath volume: + +```None +# Be sure to run these 3 commands inside the root shell that comes from +# running "kubectl exec" in the previous step +apt update +apt install curl +curl http://localhost/ +``` + +The output shows the text that you wrote to the `index.html` file on the +hostPath volume: + +```None +Hello from Kubernetes storage +``` + +In your shell, also verify that nginx is serving the `nginx.conf` file from the +hostPath volume: + +```None +# Be sure to run these commands inside the root shell that comes from +# running "kubectl exec" in the previous step +cat /etc/nginx/nginx.conf | grep keepalive_timeout +``` + +The output shows the modified text that you wrote to the `nginx.conf` file on the +hostPath volume: + +```None +keepalive_timeout 60; +``` + +If you see these messages, you have successfully configured a Pod to +use a specific file and directory in a storage from a PersistentVolumeClaim. + +## Clean up + +Delete the Pod: + +```None +kubectl delete pod test +kubectl delete pvc task-pv-claim +kubectl delete pv task-pv-volume +``` + +If you don't already have a shell open to the Node in your cluster, +open a new shell the same way that you did earlier. + +In the shell on your Node, remove the file and directory that you created: + +```None +# This assumes that your Node uses "sudo" to run commands +# as the superuser +sudo rm /mnt/data/html/index.html +sudo rm /mnt/data/nginx.conf +sudo rmdir /mnt/data +``` + +You can now close the shell to your Node. + +## Access control + +Storage configured with a group ID (GID) allows writing only by Pods using the same +GID. Mismatched or missing GIDs cause permission denied errors. To reduce the +need for coordination with users, an administrator can annotate a PersistentVolume +with a GID. Then the GID is automatically added to any Pod that uses the +PersistentVolume. + +Use the `pv.beta.kubernetes.io/gid` annotation as follows: + +```None +apiVersion: v1 +kind: PersistentVolume +metadata: + name: pv1 + annotations: + pv.beta.kubernetes.io/gid: "1234" +``` + +When a Pod consumes a PersistentVolume that has a GID annotation, the annotated GID +is applied to all containers in the Pod in the same way that GIDs specified in the +Pod's security context are. Every GID, whether it originates from a PersistentVolume +annotation or the Pod's specification, is applied to the first process run in +each container. + +#### Note: + +When a Pod consumes a PersistentVolume, the GIDs associated with the +PersistentVolume are not present on the Pod resource itself. + +## What's next + +* Learn more about [PersistentVolumes](/docs/concepts/storage/persistent-volumes/). +* Read the [Persistent Storage design document](https://git.k8s.io/design-proposals-archive/storage/persistent-storage.md). + +### Reference + +* [PersistentVolume](/docs/reference/generated/kubernetes-api/v1.35/#persistentvolume-v1-core) +* [PersistentVolumeSpec](/docs/reference/generated/kubernetes-api/v1.35/#persistentvolumespec-v1-core) +* [PersistentVolumeClaim](/docs/reference/generated/kubernetes-api/v1.35/#persistentvolumeclaim-v1-core) +* [PersistentVolumeClaimSpec](/docs/reference/generated/kubernetes-api/v1.35/#persistentvolumeclaimspec-v1-core) + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified December 17, 2024 at 5:46 AM PST: [improve pv storage task (f31a75226e)](https://github.com/kubernetes/website/commit/f31a75226efdd03b034fc9fb120e586e07cdc3d4) diff --git a/corpus/docs/kubernetes/tools/tools_v131.md b/corpus/docs/kubernetes/tools/tools_v131.md new file mode 100644 index 0000000000000000000000000000000000000000..6511902932e5b91bb8d5c7eba590aa9ccf550b41 --- /dev/null +++ b/corpus/docs/kubernetes/tools/tools_v131.md @@ -0,0 +1,83 @@ +# Install Tools + +Source: https://v1-31.docs.kubernetes.io/docs/tasks/tools/ +Version: v1.31 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Tasks](https://kubernetes.io/docs/tasks/) +3. [Install Tools](https://kubernetes.io/docs/tasks/tools/) + +### You are viewing documentation for Kubernetes version: v1.31 + +Kubernetes v1.31 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date information, see the +[latest version.](https://kubernetes.io/docs/home/) + +Set up Kubernetes tools on your computer. + +## kubectl + +The Kubernetes command-line tool, [kubectl](/docs/reference/kubectl/kubectl/), allows +you to run commands against Kubernetes clusters. +You can use kubectl to deploy applications, inspect and manage cluster resources, +and view logs. For more information including a complete list of kubectl operations, see the +[`kubectl` reference documentation](/docs/reference/kubectl/). + +kubectl is installable on a variety of Linux platforms, macOS and Windows. +Find your preferred operating system below. + +* [Install kubectl on Linux](/docs/tasks/tools/install-kubectl-linux/) +* [Install kubectl on macOS](/docs/tasks/tools/install-kubectl-macos/) +* [Install kubectl on Windows](/docs/tasks/tools/install-kubectl-windows/) + +## kind + +[`kind`](https://kind.sigs.k8s.io/) lets you run Kubernetes on +your local computer. This tool requires that you have either +[Docker](https://www.docker.com/) or [Podman](https://podman.io/) installed. + +The kind [Quick Start](https://kind.sigs.k8s.io/docs/user/quick-start/) page +shows you what you need to do to get up and running with kind. + +[View kind Quick Start Guide](https://kind.sigs.k8s.io/docs/user/quick-start/) + +## minikube + +Like `kind`, [`minikube`](https://minikube.sigs.k8s.io/) is a tool that lets you run Kubernetes +locally. `minikube` runs an all-in-one or a multi-node local Kubernetes cluster on your personal +computer (including Windows, macOS and Linux PCs) so that you can try out +Kubernetes, or for daily development work. + +You can follow the official +[Get Started!](https://minikube.sigs.k8s.io/docs/start/) guide if your focus is +on getting the tool installed. + +[View minikube Get Started! Guide](https://minikube.sigs.k8s.io/docs/start/) + +Once you have `minikube` working, you can use it to +[run a sample application](/docs/tutorials/hello-minikube/). + +## kubeadm + +You can use the [kubeadm](/docs/reference/setup-tools/kubeadm/ "A tool for quickly installing Kubernetes and setting up a secure cluster.") tool to create and manage Kubernetes clusters. +It performs the actions necessary to get a minimum viable, secure cluster up and running in a user friendly way. + +[Installing kubeadm](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/) shows you how to install kubeadm. +Once installed, you can use it to [create a cluster](/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/). + +[View kubeadm Install Guide](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/) + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified July 12, 2023 at 1:25 AM PST: [Revise docs home page (9520b96a61)](https://github.com/kubernetes/website/commit/9520b96a6162d4af841da63227d2a8710596b975) diff --git a/corpus/docs/kubernetes/tools/tools_v132.md b/corpus/docs/kubernetes/tools/tools_v132.md new file mode 100644 index 0000000000000000000000000000000000000000..b97ddb07b0d05295ea12cc54b4cc79b2822391cf --- /dev/null +++ b/corpus/docs/kubernetes/tools/tools_v132.md @@ -0,0 +1,83 @@ +# Install Tools + +Source: https://v1-32.docs.kubernetes.io/docs/tasks/tools/ +Version: v1.32 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Tasks](https://kubernetes.io/docs/tasks/) +3. [Install Tools](https://kubernetes.io/docs/tasks/tools/) + +### You are viewing documentation for Kubernetes version: v1.32 + +Kubernetes v1.32 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date information, see the +[latest version.](https://kubernetes.io/docs/home/) + +Set up Kubernetes tools on your computer. + +## kubectl + +The Kubernetes command-line tool, [kubectl](/docs/reference/kubectl/kubectl/), allows +you to run commands against Kubernetes clusters. +You can use kubectl to deploy applications, inspect and manage cluster resources, +and view logs. For more information including a complete list of kubectl operations, see the +[`kubectl` reference documentation](/docs/reference/kubectl/). + +kubectl is installable on a variety of Linux platforms, macOS and Windows. +Find your preferred operating system below. + +* [Install kubectl on Linux](/docs/tasks/tools/install-kubectl-linux/) +* [Install kubectl on macOS](/docs/tasks/tools/install-kubectl-macos/) +* [Install kubectl on Windows](/docs/tasks/tools/install-kubectl-windows/) + +## kind + +[`kind`](https://kind.sigs.k8s.io/) lets you run Kubernetes on +your local computer. This tool requires that you have either +[Docker](https://www.docker.com/) or [Podman](https://podman.io/) installed. + +The kind [Quick Start](https://kind.sigs.k8s.io/docs/user/quick-start/) page +shows you what you need to do to get up and running with kind. + +[View kind Quick Start Guide](https://kind.sigs.k8s.io/docs/user/quick-start/) + +## minikube + +Like `kind`, [`minikube`](https://minikube.sigs.k8s.io/) is a tool that lets you run Kubernetes +locally. `minikube` runs an all-in-one or a multi-node local Kubernetes cluster on your personal +computer (including Windows, macOS and Linux PCs) so that you can try out +Kubernetes, or for daily development work. + +You can follow the official +[Get Started!](https://minikube.sigs.k8s.io/docs/start/) guide if your focus is +on getting the tool installed. + +[View minikube Get Started! Guide](https://minikube.sigs.k8s.io/docs/start/) + +Once you have `minikube` working, you can use it to +[run a sample application](/docs/tutorials/hello-minikube/). + +## kubeadm + +You can use the [kubeadm](/docs/reference/setup-tools/kubeadm/ "A tool for quickly installing Kubernetes and setting up a secure cluster.") tool to create and manage Kubernetes clusters. +It performs the actions necessary to get a minimum viable, secure cluster up and running in a user friendly way. + +[Installing kubeadm](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/) shows you how to install kubeadm. +Once installed, you can use it to [create a cluster](/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/). + +[View kubeadm Install Guide](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/) + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified July 12, 2023 at 1:25 AM PST: [Revise docs home page (9520b96a61)](https://github.com/kubernetes/website/commit/9520b96a6162d4af841da63227d2a8710596b975) diff --git a/corpus/docs/kubernetes/tools/tools_v133.md b/corpus/docs/kubernetes/tools/tools_v133.md new file mode 100644 index 0000000000000000000000000000000000000000..80f51f097a8908a63644fe454b4b423e11e15d3f --- /dev/null +++ b/corpus/docs/kubernetes/tools/tools_v133.md @@ -0,0 +1,83 @@ +# Install Tools + +Source: https://v1-33.docs.kubernetes.io/docs/tasks/tools/ +Version: v1.33 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Tasks](https://kubernetes.io/docs/tasks/) +3. [Install Tools](https://kubernetes.io/docs/tasks/tools/) + +### You are viewing documentation for Kubernetes version: v1.33 + +Kubernetes v1.33 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date information, see the +[latest version.](https://kubernetes.io/docs/home/) + +Set up Kubernetes tools on your computer. + +## kubectl + +The Kubernetes command-line tool, [kubectl](/docs/reference/kubectl/kubectl/), allows +you to run commands against Kubernetes clusters. +You can use kubectl to deploy applications, inspect and manage cluster resources, +and view logs. For more information including a complete list of kubectl operations, see the +[`kubectl` reference documentation](/docs/reference/kubectl/). + +kubectl is installable on a variety of Linux platforms, macOS and Windows. +Find your preferred operating system below. + +* [Install kubectl on Linux](/docs/tasks/tools/install-kubectl-linux/) +* [Install kubectl on macOS](/docs/tasks/tools/install-kubectl-macos/) +* [Install kubectl on Windows](/docs/tasks/tools/install-kubectl-windows/) + +## kind + +[`kind`](https://kind.sigs.k8s.io/) lets you run Kubernetes on +your local computer. This tool requires that you have either +[Docker](https://www.docker.com/) or [Podman](https://podman.io/) installed. + +The kind [Quick Start](https://kind.sigs.k8s.io/docs/user/quick-start/) page +shows you what you need to do to get up and running with kind. + +[View kind Quick Start Guide](https://kind.sigs.k8s.io/docs/user/quick-start/) + +## minikube + +Like `kind`, [`minikube`](https://minikube.sigs.k8s.io/) is a tool that lets you run Kubernetes +locally. `minikube` runs an all-in-one or a multi-node local Kubernetes cluster on your personal +computer (including Windows, macOS and Linux PCs) so that you can try out +Kubernetes, or for daily development work. + +You can follow the official +[Get Started!](https://minikube.sigs.k8s.io/docs/start/) guide if your focus is +on getting the tool installed. + +[View minikube Get Started! Guide](https://minikube.sigs.k8s.io/docs/start/) + +Once you have `minikube` working, you can use it to +[run a sample application](/docs/tutorials/hello-minikube/). + +## kubeadm + +You can use the [kubeadm](/docs/reference/setup-tools/kubeadm/ "A tool for quickly installing Kubernetes and setting up a secure cluster.") tool to create and manage Kubernetes clusters. +It performs the actions necessary to get a minimum viable, secure cluster up and running in a user friendly way. + +[Installing kubeadm](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/) shows you how to install kubeadm. +Once installed, you can use it to [create a cluster](/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/). + +[View kubeadm Install Guide](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/) + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified July 12, 2023 at 1:25 AM PST: [Revise docs home page (9520b96a61)](https://github.com/kubernetes/website/commit/9520b96a6162d4af841da63227d2a8710596b975) diff --git a/corpus/docs/kubernetes/tools/tools_v134.md b/corpus/docs/kubernetes/tools/tools_v134.md new file mode 100644 index 0000000000000000000000000000000000000000..1f3af91c11a692aefbc10eea1b44ceb0a7e7d811 --- /dev/null +++ b/corpus/docs/kubernetes/tools/tools_v134.md @@ -0,0 +1,83 @@ +# Install Tools + +Source: https://v1-34.docs.kubernetes.io/docs/tasks/tools/ +Version: v1.34 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Tasks](https://kubernetes.io/docs/tasks/) +3. [Install Tools](https://kubernetes.io/docs/tasks/tools/) + +### You are viewing documentation for Kubernetes version: v1.34 + +Kubernetes v1.34 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date information, see the +[latest version.](https://kubernetes.io/docs/home/) + +Set up Kubernetes tools on your computer. + +## kubectl + +The Kubernetes command-line tool, [kubectl](/docs/reference/kubectl/kubectl/), allows +you to run commands against Kubernetes clusters. +You can use kubectl to deploy applications, inspect and manage cluster resources, +and view logs. For more information including a complete list of kubectl operations, see the +[`kubectl` reference documentation](/docs/reference/kubectl/). + +kubectl is installable on a variety of Linux platforms, macOS and Windows. +Find your preferred operating system below. + +* [Install kubectl on Linux](/docs/tasks/tools/install-kubectl-linux/) +* [Install kubectl on macOS](/docs/tasks/tools/install-kubectl-macos/) +* [Install kubectl on Windows](/docs/tasks/tools/install-kubectl-windows/) + +## kind + +[`kind`](https://kind.sigs.k8s.io/) lets you run Kubernetes on +your local computer. This tool requires that you have either +[Docker](https://www.docker.com/) or [Podman](https://podman.io/) installed. + +The kind [Quick Start](https://kind.sigs.k8s.io/docs/user/quick-start/) page +shows you what you need to do to get up and running with kind. + +[View kind Quick Start Guide](https://kind.sigs.k8s.io/docs/user/quick-start/) + +## minikube + +Like `kind`, [`minikube`](https://minikube.sigs.k8s.io/) is a tool that lets you run Kubernetes +locally. `minikube` runs an all-in-one or a multi-node local Kubernetes cluster on your personal +computer (including Windows, macOS and Linux PCs) so that you can try out +Kubernetes, or for daily development work. + +You can follow the official +[Get Started!](https://minikube.sigs.k8s.io/docs/start/) guide if your focus is +on getting the tool installed. + +[View minikube Get Started! Guide](https://minikube.sigs.k8s.io/docs/start/) + +Once you have `minikube` working, you can use it to +[run a sample application](/docs/tutorials/hello-minikube/). + +## kubeadm + +You can use the [kubeadm](/docs/reference/setup-tools/kubeadm/ "A tool for quickly installing Kubernetes and setting up a secure cluster.") tool to create and manage Kubernetes clusters. +It performs the actions necessary to get a minimum viable, secure cluster up and running in a user friendly way. + +[Installing kubeadm](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/) shows you how to install kubeadm. +Once installed, you can use it to [create a cluster](/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/). + +[View kubeadm Install Guide](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/) + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified July 12, 2023 at 1:25 AM PST: [Revise docs home page (9520b96a61)](https://github.com/kubernetes/website/commit/9520b96a6162d4af841da63227d2a8710596b975) diff --git a/corpus/docs/kubernetes/tools/tools_v135.md b/corpus/docs/kubernetes/tools/tools_v135.md new file mode 100644 index 0000000000000000000000000000000000000000..c78f8db4f1ef363ac3625f184427763617e8046a --- /dev/null +++ b/corpus/docs/kubernetes/tools/tools_v135.md @@ -0,0 +1,82 @@ +# Install Tools + +Source: https://kubernetes.io/docs/tasks/tools/ +Version: v1.35 + +1. [Kubernetes Documentation](https://kubernetes.io/docs/) +2. [Tasks](https://kubernetes.io/docs/tasks/) +3. [Install Tools](https://kubernetes.io/docs/tasks/tools/) + +Set up Kubernetes tools on your computer. + +#### Note: + +See the [Learning environment](/docs/setup/learning-environment/) page to set up a practice environment. + +## kubectl + +The Kubernetes command-line tool, [kubectl](/docs/reference/kubectl/kubectl/), allows +you to run commands against Kubernetes clusters. +You can use kubectl to deploy applications, inspect and manage cluster resources, +and view logs. For more information including a complete list of kubectl operations, see the +[`kubectl` reference documentation](/docs/reference/kubectl/). + +kubectl is installable on a variety of Linux platforms, macOS and Windows. +Find your preferred operating system below. + +* [Install kubectl on Linux](/docs/tasks/tools/install-kubectl-linux/) +* [Install kubectl on macOS](/docs/tasks/tools/install-kubectl-macos/) +* [Install kubectl on Windows](/docs/tasks/tools/install-kubectl-windows/) + +## kind + +[`kind`](https://kind.sigs.k8s.io/) lets you run Kubernetes on +your local computer. This tool requires that you have either +[Docker](https://www.docker.com/) or [Podman](https://podman.io/) installed. + +The kind [Quick Start](https://kind.sigs.k8s.io/docs/user/quick-start/) page +shows you what you need to do to get up and running with kind. + +[View kind Quick Start Guide](https://kind.sigs.k8s.io/docs/user/quick-start/) + +## minikube + +Like `kind`, [`minikube`](https://minikube.sigs.k8s.io/) is a tool that lets you run Kubernetes +locally. `minikube` runs an all-in-one or a multi-node local Kubernetes cluster on your personal +computer (including Windows, macOS and Linux PCs) so that you can try out +Kubernetes, or for daily development work. + +You can follow the official +[Get Started!](https://minikube.sigs.k8s.io/docs/start/) guide if your focus is +on getting the tool installed. + +[View minikube Get Started! Guide](https://minikube.sigs.k8s.io/docs/start/) + +Once you have `minikube` working, you can use it to +[run a sample application](/docs/tutorials/hello-minikube/). + +## kubeadm + +You can use the [kubeadm](/docs/reference/setup-tools/kubeadm/ "A tool for quickly installing Kubernetes and setting up a secure cluster.") tool to create and manage Kubernetes clusters. +It performs the actions necessary to get a minimum viable, secure cluster up and running in a user friendly way. + +[Installing kubeadm](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/) shows you how to install kubeadm. +Once installed, you can use it to [create a cluster](/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/). + +[View kubeadm Install Guide](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/) + +## Feedback + +Was this page helpful? + +Yes +No + +Thanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on +[Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes). +Open an issue in the [GitHub Repository](https://www.github.com/kubernetes/website/) if you want to +[report a problem](https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io) +or +[suggest an improvement](https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io). + +Last modified January 12, 2026 at 11:29 PM PST: [Add note to guide users to the Learning environment page for practice setup (39536f1ccd)](https://github.com/kubernetes/website/commit/39536f1ccdab714195e1b6bb4d90280bc321f98e) diff --git a/corpus/docs/nodejs/addons/addons_010x.md b/corpus/docs/nodejs/addons/addons_010x.md new file mode 100644 index 0000000000000000000000000000000000000000..c0e64fece54159f9406ae35f0547b8cbd1b220ff --- /dev/null +++ b/corpus/docs/nodejs/addons/addons_010x.md @@ -0,0 +1,715 @@ +# Addons# + +Source: https://nodejs.org/docs/latest-v0.10.x/api/addons.html +Version: 0.10.x + +Addons are dynamically linked shared objects. They can provide glue to C and +C++ libraries. The API (at the moment) is rather complex, involving +knowledge of several libraries: + +* V8 JavaScript, a C++ library. Used for interfacing with JavaScript: + creating objects, calling functions, etc. Documented mostly in the + `v8.h` header file (`deps/v8/include/v8.h` in the Node source + tree), which is also available + [online](http://izs.me/v8-docs/main.html). +* [libuv](https://github.com/joyent/libuv), C event loop library. + Anytime one needs to wait for a file descriptor to become readable, + wait for a timer, or wait for a signal to be received one will need + to interface with libuv. That is, if you perform any I/O, libuv will + need to be used. +* Internal Node libraries. Most importantly is the `node::ObjectWrap` + class which you will likely want to derive from. +* Others. Look in `deps/` for what else is available. + +Node statically compiles all its dependencies into the executable. +When compiling your module, you don't need to worry about linking to +any of these libraries. + +All of the following examples are available for +[download](https://github.com/rvagg/node-addon-examples) and may be +used as a starting-point for your own Addon. + +## Hello world[#](#addons_hello_world) + +To get started let's make a small Addon which is the C++ equivalent of +the following JavaScript code: + +```None +module.exports.hello = function() { return 'world'; }; +``` + +First we create a file `hello.cc`: + +```None +#include +#include + +using namespace v8; + +Handle Method(const Arguments& args) { + HandleScope scope; + return scope.Close(String::New("world")); +} + +void init(Handle exports) { + exports->Set(String::NewSymbol("hello"), + FunctionTemplate::New(Method)->GetFunction()); +} + +NODE_MODULE(hello, init) +``` + +Note that all Node addons must export an initialization function: + +```None +void Initialize (Handle exports); +NODE_MODULE(module_name, Initialize) +``` + +There is no semi-colon after `NODE_MODULE` as it's not a function (see `node.h`). + +The `module_name` needs to match the filename of the final binary (minus the +.node suffix). + +The source code needs to be built into `hello.node`, the binary Addon. To +do this we create a file called `binding.gyp` which describes the configuration +to build your module in a JSON-like format. This file gets compiled by +[node-gyp](https://github.com/TooTallNate/node-gyp). + +```None +{ + "targets": [ + { + "target_name": "hello", + "sources": [ "hello.cc" ] + } + ] +} +``` + +The next step is to generate the appropriate project build files for the +current platform. Use `node-gyp configure` for that. + +Now you will have either a `Makefile` (on Unix platforms) or a `vcxproj` file +(on Windows) in the `build/` directory. Next invoke the `node-gyp build` +command. + +Now you have your compiled `.node` bindings file! The compiled bindings end up +in `build/Release/`. + +You can now use the binary addon in a Node project `hello.js` by pointing `require` to +the recently built `hello.node` module: + +```None +var addon = require('./build/Release/hello'); + +console.log(addon.hello()); // 'world' +``` + +Please see patterns below for further information or + + for an example in production. + +## Addon patterns[#](#addons_addon_patterns) + +Below are some addon patterns to help you get started. Consult the online +[v8 reference](http://izs.me/v8-docs/main.html) for help with the various v8 +calls, and v8's [Embedder's Guide](http://code.google.com/apis/v8/embed.html) +for an explanation of several concepts used such as handles, scopes, +function templates, etc. + +In order to use these examples you need to compile them using `node-gyp`. +Create the following `binding.gyp` file: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "addon.cc" ] + } + ] +} +``` + +In cases where there is more than one `.cc` file, simply add the file name to the +`sources` array, e.g.: + +```None +"sources": ["addon.cc", "myexample.cc"] +``` + +Now that you have your `binding.gyp` ready, you can configure and build the +addon: + +```None +$ node-gyp configure build +``` + +### Function arguments[#](#addons_function_arguments) + +The following pattern illustrates how to read arguments from JavaScript +function calls and return a result. This is the main and only needed source +`addon.cc`: + +```None +#define BUILDING_NODE_EXTENSION +#include + +using namespace v8; + +Handle Add(const Arguments& args) { + HandleScope scope; + + if (args.Length() < 2) { + ThrowException(Exception::TypeError(String::New("Wrong number of arguments"))); + return scope.Close(Undefined()); + } + + if (!args[0]->IsNumber() || !args[1]->IsNumber()) { + ThrowException(Exception::TypeError(String::New("Wrong arguments"))); + return scope.Close(Undefined()); + } + + Local num = Number::New(args[0]->NumberValue() + + args[1]->NumberValue()); + return scope.Close(num); +} + +void Init(Handle exports) { + exports->Set(String::NewSymbol("add"), + FunctionTemplate::New(Add)->GetFunction()); +} + +NODE_MODULE(addon, Init) +``` + +You can test it with the following JavaScript snippet: + +```None +var addon = require('./build/Release/addon'); + +console.log( 'This should be eight:', addon.add(3,5) ); +``` + +### Callbacks[#](#addons_callbacks) + +You can pass JavaScript functions to a C++ function and execute them from +there. Here's `addon.cc`: + +```None +#define BUILDING_NODE_EXTENSION +#include + +using namespace v8; + +Handle RunCallback(const Arguments& args) { + HandleScope scope; + + Local cb = Local::Cast(args[0]); + const unsigned argc = 1; + Local argv[argc] = { Local::New(String::New("hello world")) }; + cb->Call(Context::GetCurrent()->Global(), argc, argv); + + return scope.Close(Undefined()); +} + +void Init(Handle exports, Handle module) { + module->Set(String::NewSymbol("exports"), + FunctionTemplate::New(RunCallback)->GetFunction()); +} + +NODE_MODULE(addon, Init) +``` + +Note that this example uses a two-argument form of `Init()` that receives +the full `module` object as the second argument. This allows the addon +to completely overwrite `exports` with a single function instead of +adding the function as a property of `exports`. + +To test it run the following JavaScript snippet: + +```None +var addon = require('./build/Release/addon'); + +addon(function(msg){ + console.log(msg); // 'hello world' +}); +``` + +### Object factory[#](#addons_object_factory) + +You can create and return new objects from within a C++ function with this +`addon.cc` pattern, which returns an object with property `msg` that echoes +the string passed to `createObject()`: + +```None +#define BUILDING_NODE_EXTENSION +#include + +using namespace v8; + +Handle CreateObject(const Arguments& args) { + HandleScope scope; + + Local obj = Object::New(); + obj->Set(String::NewSymbol("msg"), args[0]->ToString()); + + return scope.Close(obj); +} + +void Init(Handle exports, Handle module) { + module->Set(String::NewSymbol("exports"), + FunctionTemplate::New(CreateObject)->GetFunction()); +} + +NODE_MODULE(addon, Init) +``` + +To test it in JavaScript: + +```None +var addon = require('./build/Release/addon'); + +var obj1 = addon('hello'); +var obj2 = addon('world'); +console.log(obj1.msg+' '+obj2.msg); // 'hello world' +``` + +### Function factory[#](#addons_function_factory) + +This pattern illustrates how to create and return a JavaScript function that +wraps a C++ function: + +```None +#define BUILDING_NODE_EXTENSION +#include + +using namespace v8; + +Handle MyFunction(const Arguments& args) { + HandleScope scope; + return scope.Close(String::New("hello world")); +} + +Handle CreateFunction(const Arguments& args) { + HandleScope scope; + + Local tpl = FunctionTemplate::New(MyFunction); + Local fn = tpl->GetFunction(); + fn->SetName(String::NewSymbol("theFunction")); // omit this to make it anonymous + + return scope.Close(fn); +} + +void Init(Handle exports, Handle module) { + module->Set(String::NewSymbol("exports"), + FunctionTemplate::New(CreateFunction)->GetFunction()); +} + +NODE_MODULE(addon, Init) +``` + +To test: + +```None +var addon = require('./build/Release/addon'); + +var fn = addon(); +console.log(fn()); // 'hello world' +``` + +### Wrapping C++ objects[#](#addons_wrapping_c_objects) + +Here we will create a wrapper for a C++ object/class `MyObject` that can be +instantiated in JavaScript through the `new` operator. First prepare the main +module `addon.cc`: + +```None +#define BUILDING_NODE_EXTENSION +#include +#include "myobject.h" + +using namespace v8; + +void InitAll(Handle exports) { + MyObject::Init(exports); +} + +NODE_MODULE(addon, InitAll) +``` + +Then in `myobject.h` make your wrapper inherit from `node::ObjectWrap`: + +```None +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Handle exports); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static v8::Handle New(const v8::Arguments& args); + static v8::Handle PlusOne(const v8::Arguments& args); + static v8::Persistent constructor; + double value_; +}; + +#endif +``` + +And in `myobject.cc` implement the various methods that you want to expose. +Here we expose the method `plusOne` by adding it to the constructor's +prototype: + +```None +#define BUILDING_NODE_EXTENSION +#include +#include "myobject.h" + +using namespace v8; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Handle exports) { + // Prepare constructor template + Local tpl = FunctionTemplate::New(New); + tpl->SetClassName(String::NewSymbol("MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + // Prototype + tpl->PrototypeTemplate()->Set(String::NewSymbol("plusOne"), + FunctionTemplate::New(PlusOne)->GetFunction()); + constructor = Persistent::New(tpl->GetFunction()); + exports->Set(String::NewSymbol("MyObject"), constructor); +} + +Handle MyObject::New(const Arguments& args) { + HandleScope scope; + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + return args.This(); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + return scope.Close(constructor->NewInstance(argc, argv)); + } +} + +Handle MyObject::PlusOne(const Arguments& args) { + HandleScope scope; + + MyObject* obj = ObjectWrap::Unwrap(args.This()); + obj->value_ += 1; + + return scope.Close(Number::New(obj->value_)); +} +``` + +Test it with: + +```None +var addon = require('./build/Release/addon'); + +var obj = new addon.MyObject(10); +console.log( obj.plusOne() ); // 11 +console.log( obj.plusOne() ); // 12 +console.log( obj.plusOne() ); // 13 +``` + +### Factory of wrapped objects[#](#addons_factory_of_wrapped_objects) + +This is useful when you want to be able to create native objects without +explicitly instantiating them with the `new` operator in JavaScript, e.g. + +```None +var obj = addon.createObject(); +// instead of: +// var obj = new addon.Object(); +``` + +Let's register our `createObject` method in `addon.cc`: + +```None +#define BUILDING_NODE_EXTENSION +#include +#include "myobject.h" + +using namespace v8; + +Handle CreateObject(const Arguments& args) { + HandleScope scope; + return scope.Close(MyObject::NewInstance(args)); +} + +void InitAll(Handle exports, Handle module) { + MyObject::Init(); + + module->Set(String::NewSymbol("exports"), + FunctionTemplate::New(CreateObject)->GetFunction()); +} + +NODE_MODULE(addon, InitAll) +``` + +In `myobject.h` we now introduce the static method `NewInstance` that takes +care of instantiating the object (i.e. it does the job of `new` in JavaScript): + +```None +#define BUILDING_NODE_EXTENSION +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include + +class MyObject : public node::ObjectWrap { + public: + static void Init(); + static v8::Handle NewInstance(const v8::Arguments& args); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static v8::Handle New(const v8::Arguments& args); + static v8::Handle PlusOne(const v8::Arguments& args); + static v8::Persistent constructor; + double value_; +}; + +#endif +``` + +The implementation is similar to the above in `myobject.cc`: + +```None +#define BUILDING_NODE_EXTENSION +#include +#include "myobject.h" + +using namespace v8; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init() { + // Prepare constructor template + Local tpl = FunctionTemplate::New(New); + tpl->SetClassName(String::NewSymbol("MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + // Prototype + tpl->PrototypeTemplate()->Set(String::NewSymbol("plusOne"), + FunctionTemplate::New(PlusOne)->GetFunction()); + constructor = Persistent::New(tpl->GetFunction()); +} + +Handle MyObject::New(const Arguments& args) { + HandleScope scope; + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + return args.This(); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + return scope.Close(constructor->NewInstance(argc, argv)); + } +} + +Handle MyObject::NewInstance(const Arguments& args) { + HandleScope scope; + + const unsigned argc = 1; + Handle argv[argc] = { args[0] }; + Local instance = constructor->NewInstance(argc, argv); + + return scope.Close(instance); +} + +Handle MyObject::PlusOne(const Arguments& args) { + HandleScope scope; + + MyObject* obj = ObjectWrap::Unwrap(args.This()); + obj->value_ += 1; + + return scope.Close(Number::New(obj->value_)); +} +``` + +Test it with: + +```None +var createObject = require('./build/Release/addon'); + +var obj = createObject(10); +console.log( obj.plusOne() ); // 11 +console.log( obj.plusOne() ); // 12 +console.log( obj.plusOne() ); // 13 + +var obj2 = createObject(20); +console.log( obj2.plusOne() ); // 21 +console.log( obj2.plusOne() ); // 22 +console.log( obj2.plusOne() ); // 23 +``` + +### Passing wrapped objects around[#](#addons_passing_wrapped_objects_around) + +In addition to wrapping and returning C++ objects, you can pass them around +by unwrapping them with Node's `node::ObjectWrap::Unwrap` helper function. +In the following `addon.cc` we introduce a function `add()` that can take on two +`MyObject` objects: + +```None +#define BUILDING_NODE_EXTENSION +#include +#include "myobject.h" + +using namespace v8; + +Handle CreateObject(const Arguments& args) { + HandleScope scope; + return scope.Close(MyObject::NewInstance(args)); +} + +Handle Add(const Arguments& args) { + HandleScope scope; + + MyObject* obj1 = node::ObjectWrap::Unwrap( + args[0]->ToObject()); + MyObject* obj2 = node::ObjectWrap::Unwrap( + args[1]->ToObject()); + + double sum = obj1->Value() + obj2->Value(); + return scope.Close(Number::New(sum)); +} + +void InitAll(Handle exports) { + MyObject::Init(); + + exports->Set(String::NewSymbol("createObject"), + FunctionTemplate::New(CreateObject)->GetFunction()); + + exports->Set(String::NewSymbol("add"), + FunctionTemplate::New(Add)->GetFunction()); +} + +NODE_MODULE(addon, InitAll) +``` + +To make things interesting we introduce a public method in `myobject.h` so we +can probe private values after unwrapping the object: + +```None +#define BUILDING_NODE_EXTENSION +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include + +class MyObject : public node::ObjectWrap { + public: + static void Init(); + static v8::Handle NewInstance(const v8::Arguments& args); + double Value() const { return value_; } + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static v8::Handle New(const v8::Arguments& args); + static v8::Persistent constructor; + double value_; +}; + +#endif +``` + +The implementation of `myobject.cc` is similar as before: + +```None +#define BUILDING_NODE_EXTENSION +#include +#include "myobject.h" + +using namespace v8; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init() { + // Prepare constructor template + Local tpl = FunctionTemplate::New(New); + tpl->SetClassName(String::NewSymbol("MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + constructor = Persistent::New(tpl->GetFunction()); +} + +Handle MyObject::New(const Arguments& args) { + HandleScope scope; + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + return args.This(); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + return scope.Close(constructor->NewInstance(argc, argv)); + } +} + +Handle MyObject::NewInstance(const Arguments& args) { + HandleScope scope; + + const unsigned argc = 1; + Handle argv[argc] = { args[0] }; + Local instance = constructor->NewInstance(argc, argv); + + return scope.Close(instance); +} +``` + +Test it with: + +```None +var addon = require('./build/Release/addon'); + +var obj1 = addon.createObject(10); +var obj2 = addon.createObject(20); +var result = addon.add(obj1, obj2); + +console.log(result); // 30 +``` diff --git a/corpus/docs/nodejs/addons/addons_012x.md b/corpus/docs/nodejs/addons/addons_012x.md new file mode 100644 index 0000000000000000000000000000000000000000..0a2b6c777fbba8020fb803de6f36bfa230865a3e --- /dev/null +++ b/corpus/docs/nodejs/addons/addons_012x.md @@ -0,0 +1,752 @@ +# Addons# + +Source: https://nodejs.org/docs/latest-v0.12.x/api/addons.html +Version: 0.12.x + +Addons are dynamically linked shared objects. They can provide glue to C and +C++ libraries. The API (at the moment) is rather complex, involving +knowledge of several libraries: + +* V8 JavaScript, a C++ library. Used for interfacing with JavaScript: + creating objects, calling functions, etc. Documented mostly in the + `v8.h` header file (`deps/v8/include/v8.h` in the Node source + tree), which is also available + [online](http://v8dox.com/). +* [libuv](https://github.com/libuv/libuv), C event loop library. + Anytime one needs to wait for a file descriptor to become readable, + wait for a timer, or wait for a signal to be received one will need + to interface with libuv. That is, if you perform any I/O, libuv will + need to be used. +* Internal Node libraries. Most importantly is the `node::ObjectWrap` + class which you will likely want to derive from. +* Others. Look in `deps/` for what else is available. + +Node statically compiles all its dependencies into the executable. +When compiling your module, you don't need to worry about linking to +any of these libraries. + +All of the following examples are available for +[download](https://github.com/rvagg/node-addon-examples) and may be +used as a starting-point for your own Addon. + +## Hello world[#](#addons_hello_world) + +To get started let's make a small Addon which is the C++ equivalent of +the following JavaScript code: + +```None +module.exports.hello = function() { return 'world'; }; +``` + +First we create a file `hello.cc`: + +```None +// hello.cc +#include + +using namespace v8; + +void Method(const FunctionCallbackInfo& args) { + Isolate* isolate = Isolate::GetCurrent(); + HandleScope scope(isolate); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world")); +} + +void init(Handle exports) { + NODE_SET_METHOD(exports, "hello", Method); +} + +NODE_MODULE(addon, init) +``` + +Note that all Node addons must export an initialization function: + +```None +void Initialize (Handle exports); +NODE_MODULE(module_name, Initialize) +``` + +There is no semi-colon after `NODE_MODULE` as it's not a function (see +`node.h`). + +The `module_name` needs to match the filename of the final binary (minus the +.node suffix). + +The source code needs to be built into `addon.node`, the binary Addon. To +do this we create a file called `binding.gyp` which describes the configuration +to build your module in a JSON-like format. This file gets compiled by +[node-gyp](https://github.com/TooTallNate/node-gyp). + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "hello.cc" ] + } + ] +} +``` + +The next step is to generate the appropriate project build files for the +current platform. Use `node-gyp configure` for that. + +Now you will have either a `Makefile` (on Unix platforms) or a `vcxproj` file +(on Windows) in the `build/` directory. Next invoke the `node-gyp build` +command. + +Now you have your compiled `.node` bindings file! The compiled bindings end up +in `build/Release/`. + +You can now use the binary addon in a Node project `hello.js` by pointing +`require` to the recently built `hello.node` module: + +```None +// hello.js +var addon = require('./build/Release/addon'); + +console.log(addon.hello()); // 'world' +``` + +Please see patterns below for further information or + + for an example in production. + +## Addon patterns[#](#addons_addon_patterns) + +Below are some addon patterns to help you get started. Consult the online +[v8 reference](http://izs.me/v8-docs/main.html) for help with the various v8 +calls, and v8's [Embedder's Guide](http://code.google.com/apis/v8/embed.html) +for an explanation of several concepts used such as handles, scopes, +function templates, etc. + +In order to use these examples you need to compile them using `node-gyp`. +Create the following `binding.gyp` file: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "addon.cc" ] + } + ] +} +``` + +In cases where there is more than one `.cc` file, simply add the file name to +the `sources` array, e.g.: + +```None +"sources": ["addon.cc", "myexample.cc"] +``` + +Now that you have your `binding.gyp` ready, you can configure and build the +addon: + +```None +$ node-gyp configure build +``` + +### Function arguments[#](#addons_function_arguments) + +The following pattern illustrates how to read arguments from JavaScript +function calls and return a result. This is the main and only needed source +`addon.cc`: + +```None +// addon.cc +#include + +using namespace v8; + +void Add(const FunctionCallbackInfo& args) { + Isolate* isolate = Isolate::GetCurrent(); + HandleScope scope(isolate); + + if (args.Length() < 2) { + isolate->ThrowException(Exception::TypeError( + String::NewFromUtf8(isolate, "Wrong number of arguments"))); + return; + } + + if (!args[0]->IsNumber() || !args[1]->IsNumber()) { + isolate->ThrowException(Exception::TypeError( + String::NewFromUtf8(isolate, "Wrong arguments"))); + return; + } + + double value = args[0]->NumberValue() + args[1]->NumberValue(); + Local num = Number::New(isolate, value); + + args.GetReturnValue().Set(num); +} + +void Init(Handle exports) { + NODE_SET_METHOD(exports, "add", Add); +} + +NODE_MODULE(addon, Init) +``` + +You can test it with the following JavaScript snippet: + +```None +// test.js +var addon = require('./build/Release/addon'); + +console.log( 'This should be eight:', addon.add(3,5) ); +``` + +### Callbacks[#](#addons_callbacks) + +You can pass JavaScript functions to a C++ function and execute them from +there. Here's `addon.cc`: + +```None +// addon.cc +#include + +using namespace v8; + +void RunCallback(const FunctionCallbackInfo& args) { + Isolate* isolate = Isolate::GetCurrent(); + HandleScope scope(isolate); + + Local cb = Local::Cast(args[0]); + const unsigned argc = 1; + Local argv[argc] = { String::NewFromUtf8(isolate, "hello world") }; + cb->Call(isolate->GetCurrentContext()->Global(), argc, argv); +} + +void Init(Handle exports, Handle module) { + NODE_SET_METHOD(module, "exports", RunCallback); +} + +NODE_MODULE(addon, Init) +``` + +Note that this example uses a two-argument form of `Init()` that receives +the full `module` object as the second argument. This allows the addon +to completely overwrite `exports` with a single function instead of +adding the function as a property of `exports`. + +To test it run the following JavaScript snippet: + +```None +// test.js +var addon = require('./build/Release/addon'); + +addon(function(msg){ + console.log(msg); // 'hello world' +}); +``` + +### Object factory[#](#addons_object_factory) + +You can create and return new objects from within a C++ function with this +`addon.cc` pattern, which returns an object with property `msg` that echoes +the string passed to `createObject()`: + +```None +// addon.cc +#include + +using namespace v8; + +void CreateObject(const FunctionCallbackInfo& args) { + Isolate* isolate = Isolate::GetCurrent(); + HandleScope scope(isolate); + + Local obj = Object::New(isolate); + obj->Set(String::NewFromUtf8(isolate, "msg"), args[0]->ToString()); + + args.GetReturnValue().Set(obj); +} + +void Init(Handle exports, Handle module) { + NODE_SET_METHOD(module, "exports", CreateObject); +} + +NODE_MODULE(addon, Init) +``` + +To test it in JavaScript: + +```None +// test.js +var addon = require('./build/Release/addon'); + +var obj1 = addon('hello'); +var obj2 = addon('world'); +console.log(obj1.msg+' '+obj2.msg); // 'hello world' +``` + +### Function factory[#](#addons_function_factory) + +This pattern illustrates how to create and return a JavaScript function that +wraps a C++ function: + +```None +// addon.cc +#include + +using namespace v8; + +void MyFunction(const FunctionCallbackInfo& args) { + Isolate* isolate = Isolate::GetCurrent(); + HandleScope scope(isolate); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, "hello world")); +} + +void CreateFunction(const FunctionCallbackInfo& args) { + Isolate* isolate = Isolate::GetCurrent(); + HandleScope scope(isolate); + + Local tpl = FunctionTemplate::New(isolate, MyFunction); + Local fn = tpl->GetFunction(); + + // omit this to make it anonymous + fn->SetName(String::NewFromUtf8(isolate, "theFunction")); + + args.GetReturnValue().Set(fn); +} + +void Init(Handle exports, Handle module) { + NODE_SET_METHOD(module, "exports", CreateFunction); +} + +NODE_MODULE(addon, Init) +``` + +To test: + +```None +// test.js +var addon = require('./build/Release/addon'); + +var fn = addon(); +console.log(fn()); // 'hello world' +``` + +### Wrapping C++ objects[#](#addons_wrapping_c_objects) + +Here we will create a wrapper for a C++ object/class `MyObject` that can be +instantiated in JavaScript through the `new` operator. First prepare the main +module `addon.cc`: + +```None +// addon.cc +#include +#include "myobject.h" + +using namespace v8; + +void InitAll(Handle exports) { + MyObject::Init(exports); +} + +NODE_MODULE(addon, InitAll) +``` + +Then in `myobject.h` make your wrapper inherit from `node::ObjectWrap`: + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Handle exports); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static void PlusOne(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +#endif +``` + +And in `myobject.cc` implement the various methods that you want to expose. +Here we expose the method `plusOne` by adding it to the constructor's +prototype: + +```None +// myobject.cc +#include "myobject.h" + +using namespace v8; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Handle exports) { + Isolate* isolate = Isolate::GetCurrent(); + + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); + + constructor.Reset(isolate, tpl->GetFunction()); + exports->Set(String::NewFromUtf8(isolate, "MyObject"), + tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = Isolate::GetCurrent(); + HandleScope scope(isolate); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + args.GetReturnValue().Set(cons->NewInstance(argc, argv)); + } +} + +void MyObject::PlusOne(const FunctionCallbackInfo& args) { + Isolate* isolate = Isolate::GetCurrent(); + HandleScope scope(isolate); + + MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + obj->value_ += 1; + + args.GetReturnValue().Set(Number::New(isolate, obj->value_)); +} +``` + +Test it with: + +```None +// test.js +var addon = require('./build/Release/addon'); + +var obj = new addon.MyObject(10); +console.log( obj.plusOne() ); // 11 +console.log( obj.plusOne() ); // 12 +console.log( obj.plusOne() ); // 13 +``` + +### Factory of wrapped objects[#](#addons_factory_of_wrapped_objects) + +This is useful when you want to be able to create native objects without +explicitly instantiating them with the `new` operator in JavaScript, e.g. + +```None +var obj = addon.createObject(); +// instead of: +// var obj = new addon.Object(); +``` + +Let's register our `createObject` method in `addon.cc`: + +```None +// addon.cc +#include +#include "myobject.h" + +using namespace v8; + +void CreateObject(const FunctionCallbackInfo& args) { + Isolate* isolate = Isolate::GetCurrent(); + HandleScope scope(isolate); + MyObject::NewInstance(args); +} + +void InitAll(Handle exports, Handle module) { + MyObject::Init(); + + NODE_SET_METHOD(module, "exports", CreateObject); +} + +NODE_MODULE(addon, InitAll) +``` + +In `myobject.h` we now introduce the static method `NewInstance` that takes +care of instantiating the object (i.e. it does the job of `new` in JavaScript): + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +class MyObject : public node::ObjectWrap { + public: + static void Init(); + static void NewInstance(const v8::FunctionCallbackInfo& args); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static void PlusOne(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +#endif +``` + +The implementation is similar to the above in `myobject.cc`: + +```None +// myobject.cc +#include +#include "myobject.h" + +using namespace v8; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init() { + Isolate* isolate = Isolate::GetCurrent(); + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); + + constructor.Reset(isolate, tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = Isolate::GetCurrent(); + HandleScope scope(isolate); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + args.GetReturnValue().Set(cons->NewInstance(argc, argv)); + } +} + +void MyObject::NewInstance(const FunctionCallbackInfo& args) { + Isolate* isolate = Isolate::GetCurrent(); + HandleScope scope(isolate); + + const unsigned argc = 1; + Handle argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local instance = cons->NewInstance(argc, argv); + + args.GetReturnValue().Set(instance); +} + +void MyObject::PlusOne(const FunctionCallbackInfo& args) { + Isolate* isolate = Isolate::GetCurrent(); + HandleScope scope(isolate); + + MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + obj->value_ += 1; + + args.GetReturnValue().Set(Number::New(isolate, obj->value_)); +} +``` + +Test it with: + +```None +// test.js +var createObject = require('./build/Release/addon'); + +var obj = createObject(10); +console.log( obj.plusOne() ); // 11 +console.log( obj.plusOne() ); // 12 +console.log( obj.plusOne() ); // 13 + +var obj2 = createObject(20); +console.log( obj2.plusOne() ); // 21 +console.log( obj2.plusOne() ); // 22 +console.log( obj2.plusOne() ); // 23 +``` + +### Passing wrapped objects around[#](#addons_passing_wrapped_objects_around) + +In addition to wrapping and returning C++ objects, you can pass them around +by unwrapping them with Node's `node::ObjectWrap::Unwrap` helper function. +In the following `addon.cc` we introduce a function `add()` that can take on two +`MyObject` objects: + +```None +// addon.cc +#include +#include +#include "myobject.h" + +using namespace v8; + +void CreateObject(const FunctionCallbackInfo& args) { + Isolate* isolate = Isolate::GetCurrent(); + HandleScope scope(isolate); + MyObject::NewInstance(args); +} + +void Add(const FunctionCallbackInfo& args) { + Isolate* isolate = Isolate::GetCurrent(); + HandleScope scope(isolate); + + MyObject* obj1 = node::ObjectWrap::Unwrap( + args[0]->ToObject()); + MyObject* obj2 = node::ObjectWrap::Unwrap( + args[1]->ToObject()); + + double sum = obj1->value() + obj2->value(); + args.GetReturnValue().Set(Number::New(isolate, sum)); +} + +void InitAll(Handle exports) { + MyObject::Init(); + + NODE_SET_METHOD(exports, "createObject", CreateObject); + NODE_SET_METHOD(exports, "add", Add); +} + +NODE_MODULE(addon, InitAll) +``` + +To make things interesting we introduce a public method in `myobject.h` so we +can probe private values after unwrapping the object: + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +class MyObject : public node::ObjectWrap { + public: + static void Init(); + static void NewInstance(const v8::FunctionCallbackInfo& args); + inline double value() const { return value_; } + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +#endif +``` + +The implementation of `myobject.cc` is similar as before: + +```None +// myobject.cc +#include +#include "myobject.h" + +using namespace v8; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init() { + Isolate* isolate = Isolate::GetCurrent(); + + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + constructor.Reset(isolate, tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = Isolate::GetCurrent(); + HandleScope scope(isolate); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + args.GetReturnValue().Set(cons->NewInstance(argc, argv)); + } +} + +void MyObject::NewInstance(const FunctionCallbackInfo& args) { + Isolate* isolate = Isolate::GetCurrent(); + HandleScope scope(isolate); + + const unsigned argc = 1; + Handle argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local instance = cons->NewInstance(argc, argv); + + args.GetReturnValue().Set(instance); +} +``` + +Test it with: + +```None +// test.js +var addon = require('./build/Release/addon'); + +var obj1 = addon.createObject(10); +var obj2 = addon.createObject(20); +var result = addon.add(obj1, obj2); + +console.log(result); // 30 +``` diff --git a/corpus/docs/nodejs/addons/addons_10x.md b/corpus/docs/nodejs/addons/addons_10x.md new file mode 100644 index 0000000000000000000000000000000000000000..55a67c92a6ad5b94aac732152fcab1fe15928b33 --- /dev/null +++ b/corpus/docs/nodejs/addons/addons_10x.md @@ -0,0 +1,1348 @@ +# C++ Addons# + +Source: https://nodejs.org/docs/latest-v10.x/api/addons.html +Version: 10.x + +Node.js Addons are dynamically-linked shared objects, written in C++, that +can be loaded into Node.js using the [`require()`](modules.html#modules_require) function, and used +just as if they were an ordinary Node.js module. They are used primarily to +provide an interface between JavaScript running in Node.js and C/C++ libraries. + +At the moment, the method for implementing Addons is rather complicated, +involving knowledge of several components and APIs: + +* V8: the C++ library Node.js currently uses to provide the + JavaScript implementation. V8 provides the mechanisms for creating objects, + calling functions, etc. V8's API is documented mostly in the + `v8.h` header file (`deps/v8/include/v8.h` in the Node.js source + tree), which is also available [online](https://v8docs.nodesource.com/). +* [libuv](https://github.com/libuv/libuv): The C library that implements the Node.js event loop, its worker + threads and all of the asynchronous behaviors of the platform. It also + serves as a cross-platform abstraction library, giving easy, POSIX-like + access across all major operating systems to many common system tasks, such + as interacting with the filesystem, sockets, timers, and system events. libuv + also provides a pthreads-like threading abstraction that may be used to + power more sophisticated asynchronous Addons that need to move beyond the + standard event loop. Addon authors are encouraged to think about how to + avoid blocking the event loop with I/O or other time-intensive tasks by + off-loading work via libuv to non-blocking system operations, worker threads + or a custom use of libuv's threads. +* Internal Node.js libraries. Node.js itself exports a number of C++ APIs + that Addons can use — the most important of which is the + `node::ObjectWrap` class. +* Node.js includes a number of other statically linked libraries including + OpenSSL. These other libraries are located in the `deps/` directory in the + Node.js source tree. Only the libuv, OpenSSL, V8 and zlib symbols are + purposefully re-exported by Node.js and may be used to various extents by + Addons. + See [Linking to Node.js' own dependencies](#addons_linking_to_node_js_own_dependencies) for additional information. + +All of the following examples are available for [download](https://github.com/nodejs/node-addon-examples) and may +be used as the starting-point for an Addon. + +## Hello world[#](#addons_hello_world) + +This "Hello world" example is a simple Addon, written in C++, that is the +equivalent of the following JavaScript code: + +```None +module.exports.hello = () => 'world'; +``` + +First, create the file `hello.cc`: + +```None +// hello.cc +#include + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::NewStringType; +using v8::Object; +using v8::String; +using v8::Value; + +void Method(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + args.GetReturnValue().Set(String::NewFromUtf8( + isolate, "world", NewStringType::kNormal).ToLocalChecked()); +} + +void Initialize(Local exports) { + NODE_SET_METHOD(exports, "hello", Method); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, Initialize) + +} // namespace demo +``` + +Note that all Node.js Addons must export an initialization function following +the pattern: + +```None +void Initialize(Local exports); +NODE_MODULE(NODE_GYP_MODULE_NAME, Initialize) +``` + +There is no semi-colon after `NODE_MODULE` as it's not a function (see +`node.h`). + +The `module_name` must match the filename of the final binary (excluding +the `.node` suffix). + +In the `hello.cc` example, then, the initialization function is `Initialize` +and the addon module name is `addon`. + +When building addons with `node-gyp`, using the macro `NODE_GYP_MODULE_NAME` as +the first parameter of `NODE_MODULE()` will ensure that the name of the final +binary will be passed to `NODE_MODULE()`. + +### Context-aware addons[#](#addons_context_aware_addons) + +There are environments in which Node.js addons may need to be loaded multiple +times in multiple contexts. For example, the [Electron](https://electronjs.org/) runtime runs multiple +instances of Node.js in a single process. Each instance will have its own +`require()` cache, and thus each instance will need a native addon to behave +correctly when loaded via `require()`. From the addon's perspective, this means +that it must support multiple initializations. + +A context-aware addon can be constructed by using the macro +`NODE_MODULE_INITIALIZER`, which expands to the name of a function which Node.js +will expect to find when it loads an addon. An addon can thus be initialized as +in the following example: + +```None +using namespace v8; + +extern "C" NODE_MODULE_EXPORT void +NODE_MODULE_INITIALIZER(Local exports, + Local module, + Local context) { + /* Perform addon initialization steps here. */ +} +``` + +Another option is to use the macro `NODE_MODULE_INIT()`, which will also +construct a context-aware addon. Unlike `NODE_MODULE()`, which is used to +construct an addon around a given addon initializer function, +`NODE_MODULE_INIT()` serves as the declaration of such an initializer to be +followed by a function body. + +The following three variables may be used inside the function body following an +invocation of `NODE_MODULE_INIT()`: + +* `Local exports`, +* `Local module`, and +* `Local context` + +The choice to build a context-aware addon carries with it the responsibility of +carefully managing global static data. Since the addon may be loaded multiple +times, potentially even from different threads, any global static data stored +in the addon must be properly protected, and must not contain any persistent +references to JavaScript objects. The reason for this is that JavaScript +objects are only valid in one context, and will likely cause a crash when +accessed from the wrong context or from a different thread than the one on which +they were created. + +The context-aware addon can be structured to avoid global static data by +performing the following steps: + +* defining a class which will hold per-addon-instance data. Such + a class should include a `v8::Persistent` which will hold a weak + reference to the addon's `exports` object. The callback associated with the weak + reference will then destroy the instance of the class. +* constructing an instance of this class in the addon initializer such that the + `v8::Persistent` is set to the `exports` object. +* storing the instance of the class in a `v8::External`, and +* passing the `v8::External` to all methods exposed to JavaScript by passing it + to the `v8::FunctionTemplate` constructor which creates the native-backed + JavaScript functions. The `v8::FunctionTemplate` constructor's third parameter + accepts the `v8::External`. + +This will ensure that the per-addon-instance data reaches each binding that can +be called from JavaScript. The per-addon-instance data must also be passed into +any asynchronous callbacks the addon may create. + +The following example illustrates the implementation of a context-aware addon: + +```None +#include + +using namespace v8; + +class AddonData { + public: + AddonData(Isolate* isolate, Local exports): + call_count(0) { + // Link the existence of this object instance to the existence of exports. + exports_.Reset(isolate, exports); + exports_.SetWeak(this, DeleteMe, WeakCallbackType::kParameter); + } + + ~AddonData() { + if (!exports_.IsEmpty()) { + // Reset the reference to avoid leaking data. + exports_.ClearWeak(); + exports_.Reset(); + } + } + + // Per-addon data. + int call_count; + + private: + // Method to call when "exports" is about to be garbage-collected. + static void DeleteMe(const WeakCallbackInfo& info) { + delete info.GetParameter(); + } + + // Weak handle to the "exports" object. An instance of this class will be + // destroyed along with the exports object to which it is weakly bound. + v8::Persistent exports_; +}; + +static void Method(const v8::FunctionCallbackInfo& info) { + // Retrieve the per-addon-instance data. + AddonData* data = + reinterpret_cast(info.Data().As()->Value()); + data->call_count++; + info.GetReturnValue().Set((double)data->call_count); +} + +// Initialize this addon to be context-aware. +NODE_MODULE_INIT(/* exports, module, context */) { + Isolate* isolate = context->GetIsolate(); + + // Create a new instance of AddonData for this instance of the addon. + AddonData* data = new AddonData(isolate, exports); + // Wrap the data in a v8::External so we can pass it to the method we expose. + Local external = External::New(isolate, data); + + // Expose the method "Method" to JavaScript, and make sure it receives the + // per-addon-instance data we created above by passing `external` as the + // third parameter to the FunctionTemplate constructor. + exports->Set(context, + String::NewFromUtf8(isolate, "method", NewStringType::kNormal) + .ToLocalChecked(), + FunctionTemplate::New(isolate, Method, external) + ->GetFunction(context).ToLocalChecked()).FromJust(); +} +``` + +### Building[#](#addons_building) + +Once the source code has been written, it must be compiled into the binary +`addon.node` file. To do so, create a file called `binding.gyp` in the +top-level of the project describing the build configuration of the module +using a JSON-like format. This file is used by [node-gyp](https://github.com/nodejs/node-gyp), a tool written +specifically to compile Node.js Addons. + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "hello.cc" ] + } + ] +} +``` + +A version of the `node-gyp` utility is bundled and distributed with +Node.js as part of `npm`. This version is not made directly available for +developers to use and is intended only to support the ability to use the +`npm install` command to compile and install Addons. Developers who wish to +use `node-gyp` directly can install it using the command +`npm install -g node-gyp`. See the `node-gyp` [installation instructions](https://github.com/nodejs/node-gyp#installation) for +more information, including platform-specific requirements. + +Once the `binding.gyp` file has been created, use `node-gyp configure` to +generate the appropriate project build files for the current platform. This +will generate either a `Makefile` (on Unix platforms) or a `vcxproj` file +(on Windows) in the `build/` directory. + +Next, invoke the `node-gyp build` command to generate the compiled `addon.node` +file. This will be put into the `build/Release/` directory. + +When using `npm install` to install a Node.js Addon, npm uses its own bundled +version of `node-gyp` to perform this same set of actions, generating a +compiled version of the Addon for the user's platform on demand. + +Once built, the binary Addon can be used from within Node.js by pointing +[`require()`](modules.html#modules_require) to the built `addon.node` module: + +```None +// hello.js +const addon = require('./build/Release/addon'); + +console.log(addon.hello()); +// Prints: 'world' +``` + +Please see the examples below for further information or + for an example in production. + +Because the exact path to the compiled Addon binary can vary depending on how +it is compiled (i.e. sometimes it may be in `./build/Debug/`), Addons can use +the [bindings](https://github.com/TooTallNate/node-bindings) package to load the compiled module. + +Note that while the `bindings` package implementation is more sophisticated +in how it locates Addon modules, it is essentially using a try-catch pattern +similar to: + +```None +try { + return require('./build/Release/addon.node'); +} catch (err) { + return require('./build/Debug/addon.node'); +} +``` + +### Linking to Node.js' own dependencies[#](#addons_linking_to_node_js_own_dependencies) + +Node.js uses a number of statically linked libraries such as V8, libuv and +OpenSSL. All Addons are required to link to V8 and may link to any of the +other dependencies as well. Typically, this is as simple as including +the appropriate `#include <...>` statements (e.g. `#include `) and +`node-gyp` will locate the appropriate headers automatically. However, there +are a few caveats to be aware of: + +* When `node-gyp` runs, it will detect the specific release version of Node.js + and download either the full source tarball or just the headers. If the full + source is downloaded, Addons will have complete access to the full set of + Node.js dependencies. However, if only the Node.js headers are downloaded, then + only the symbols exported by Node.js will be available. +* `node-gyp` can be run using the `--nodedir` flag pointing at a local Node.js + source image. Using this option, the Addon will have access to the full set of + dependencies. + +### Loading Addons using require()[#](#addons_loading_addons_using_require) + +The filename extension of the compiled Addon binary is `.node` (as opposed +to `.dll` or `.so`). The [`require()`](modules.html#modules_require) function is written to look for +files with the `.node` file extension and initialize those as dynamically-linked +libraries. + +When calling [`require()`](modules.html#modules_require), the `.node` extension can usually be +omitted and Node.js will still find and initialize the Addon. One caveat, +however, is that Node.js will first attempt to locate and load modules or +JavaScript files that happen to share the same base name. For instance, if +there is a file `addon.js` in the same directory as the binary `addon.node`, +then [`require('addon')`](modules.html#modules_require) will give precedence to the `addon.js` file +and load it instead. + +## Native Abstractions for Node.js[#](#addons_native_abstractions_for_node_js) + +Each of the examples illustrated in this document make direct use of the +Node.js and V8 APIs for implementing Addons. It is important to understand +that the V8 API can, and has, changed dramatically from one V8 release to the +next (and one major Node.js release to the next). With each change, Addons may +need to be updated and recompiled in order to continue functioning. The Node.js +release schedule is designed to minimize the frequency and impact of such +changes but there is little that Node.js can do currently to ensure stability +of the V8 APIs. + +The [Native Abstractions for Node.js](https://github.com/nodejs/nan) (or `nan`) provide a set of tools that +Addon developers are recommended to use to keep compatibility between past and +future releases of V8 and Node.js. See the `nan` [examples](https://github.com/nodejs/nan/tree/master/examples/) for an +illustration of how it can be used. + +## N-API[#](#addons_n_api) + +[Stability: 2](documentation.html#documentation_stability_index) - Stable + +N-API is an API for building native Addons. It is independent from +the underlying JavaScript runtime (e.g. V8) and is maintained as part of +Node.js itself. This API will be Application Binary Interface (ABI) stable +across versions of Node.js. It is intended to insulate Addons from +changes in the underlying JavaScript engine and allow modules +compiled for one version to run on later versions of Node.js without +recompilation. Addons are built/packaged with the same approach/tools +outlined in this document (node-gyp, etc.). The only difference is the +set of APIs that are used by the native code. Instead of using the V8 +or [Native Abstractions for Node.js](https://github.com/nodejs/nan) APIs, the functions available +in the N-API are used. + +Creating and maintaining an addon that benefits from the ABI stability +provided by N-API carries with it certain +[implementation considerations](n-api.html#n_api_implications_of_abi_stability). + +To use N-API in the above "Hello world" example, replace the content of +`hello.cc` with the following. All other instructions remain the same. + +```None +// hello.cc using N-API +#include + +namespace demo { + +napi_value Method(napi_env env, napi_callback_info args) { + napi_value greeting; + napi_status status; + + status = napi_create_string_utf8(env, "world", NAPI_AUTO_LENGTH, &greeting); + if (status != napi_ok) return nullptr; + return greeting; +} + +napi_value init(napi_env env, napi_value exports) { + napi_status status; + napi_value fn; + + status = napi_create_function(env, nullptr, 0, Method, nullptr, &fn); + if (status != napi_ok) return nullptr; + + status = napi_set_named_property(env, exports, "hello", fn); + if (status != napi_ok) return nullptr; + return exports; +} + +NAPI_MODULE(NODE_GYP_MODULE_NAME, init) + +} // namespace demo +``` + +The functions available and how to use them are documented in the +section titled [C/C++ Addons - N-API](n-api.html). + +## Addon examples[#](#addons_addon_examples) + +Following are some example Addons intended to help developers get started. The +examples make use of the V8 APIs. Refer to the online [V8 reference](https://v8docs.nodesource.com/) +for help with the various V8 calls, and V8's [Embedder's Guide](https://github.com/v8/v8/wiki/Embedder's%20Guide) for an +explanation of several concepts used such as handles, scopes, function +templates, etc. + +Each of these examples using the following `binding.gyp` file: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "addon.cc" ] + } + ] +} +``` + +In cases where there is more than one `.cc` file, simply add the additional +filename to the `sources` array: + +```None +"sources": ["addon.cc", "myexample.cc"] +``` + +Once the `binding.gyp` file is ready, the example Addons can be configured and +built using `node-gyp`: + +```None +$ node-gyp configure build +``` + +### Function arguments[#](#addons_function_arguments) + +Addons will typically expose objects and functions that can be accessed from +JavaScript running within Node.js. When functions are invoked from JavaScript, +the input arguments and return value must be mapped to and from the C/C++ +code. + +The following example illustrates how to read function arguments passed from +JavaScript and how to return a result: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Exception; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::NewStringType; +using v8::Number; +using v8::Object; +using v8::String; +using v8::Value; + +// This is the implementation of the "add" method +// Input arguments are passed using the +// const FunctionCallbackInfo& args struct +void Add(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + // Check the number of arguments passed. + if (args.Length() < 2) { + // Throw an Error that is passed back to JavaScript + isolate->ThrowException(Exception::TypeError( + String::NewFromUtf8(isolate, + "Wrong number of arguments", + NewStringType::kNormal).ToLocalChecked())); + return; + } + + // Check the argument types + if (!args[0]->IsNumber() || !args[1]->IsNumber()) { + isolate->ThrowException(Exception::TypeError( + String::NewFromUtf8(isolate, + "Wrong arguments", + NewStringType::kNormal).ToLocalChecked())); + return; + } + + // Perform the operation + double value = + args[0].As()->Value() + args[1].As()->Value(); + Local num = Number::New(isolate, value); + + // Set the return value (using the passed in + // FunctionCallbackInfo&) + args.GetReturnValue().Set(num); +} + +void Init(Local exports) { + NODE_SET_METHOD(exports, "add", Add); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, Init) + +} // namespace demo +``` + +Once compiled, the example Addon can be required and used from within Node.js: + +```None +// test.js +const addon = require('./build/Release/addon'); + +console.log('This should be eight:', addon.add(3, 5)); +``` + +### Callbacks[#](#addons_callbacks) + +It is common practice within Addons to pass JavaScript functions to a C++ +function and execute them from there. The following example illustrates how +to invoke such callbacks: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::NewStringType; +using v8::Null; +using v8::Object; +using v8::String; +using v8::Value; + +void RunCallback(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local context = isolate->GetCurrentContext(); + Local cb = Local::Cast(args[0]); + const unsigned argc = 1; + Local argv[argc] = { + String::NewFromUtf8(isolate, + "hello world", + NewStringType::kNormal).ToLocalChecked() }; + cb->Call(context, Null(isolate), argc, argv).ToLocalChecked(); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", RunCallback); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, Init) + +} // namespace demo +``` + +Note that this example uses a two-argument form of `Init()` that receives +the full `module` object as the second argument. This allows the Addon +to completely overwrite `exports` with a single function instead of +adding the function as a property of `exports`. + +To test it, run the following JavaScript: + +```None +// test.js +const addon = require('./build/Release/addon'); + +addon((msg) => { + console.log(msg); +// Prints: 'hello world' +}); +``` + +Note that, in this example, the callback function is invoked synchronously. + +### Object factory[#](#addons_object_factory) + +Addons can create and return new objects from within a C++ function as +illustrated in the following example. An object is created and returned with a +property `msg` that echoes the string passed to `createObject()`: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Context; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::NewStringType; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local context = isolate->GetCurrentContext(); + + Local obj = Object::New(isolate); + obj->Set(context, + String::NewFromUtf8(isolate, + "msg", + NewStringType::kNormal).ToLocalChecked(), + args[0]->ToString(context).ToLocalChecked()) + .FromJust(); + + args.GetReturnValue().Set(obj); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", CreateObject); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, Init) + +} // namespace demo +``` + +To test it in JavaScript: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const obj1 = addon('hello'); +const obj2 = addon('world'); +console.log(obj1.msg, obj2.msg); +// Prints: 'hello world' +``` + +### Function factory[#](#addons_function_factory) + +Another common scenario is creating JavaScript functions that wrap C++ +functions and returning those back to JavaScript: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::NewStringType; +using v8::Object; +using v8::String; +using v8::Value; + +void MyFunction(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + args.GetReturnValue().Set(String::NewFromUtf8( + isolate, "hello world", NewStringType::kNormal).ToLocalChecked()); +} + +void CreateFunction(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + Local context = isolate->GetCurrentContext(); + Local tpl = FunctionTemplate::New(isolate, MyFunction); + Local fn = tpl->GetFunction(context).ToLocalChecked(); + + // omit this to make it anonymous + fn->SetName(String::NewFromUtf8( + isolate, "theFunction", NewStringType::kNormal).ToLocalChecked()); + + args.GetReturnValue().Set(fn); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", CreateFunction); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, Init) + +} // namespace demo +``` + +To test: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const fn = addon(); +console.log(fn()); +// Prints: 'hello world' +``` + +### Wrapping C++ objects[#](#addons_wrapping_c_objects) + +It is also possible to wrap C++ objects/classes in a way that allows new +instances to be created using the JavaScript `new` operator: + +```None +// addon.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Local; +using v8::Object; + +void InitAll(Local exports) { + MyObject::Init(exports); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, InitAll) + +} // namespace demo +``` + +Then, in `myobject.h`, the wrapper class inherits from `node::ObjectWrap`: + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Local exports); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static void PlusOne(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +In `myobject.cc`, implement the various methods that are to be exposed. +Below, the method `plusOne()` is exposed by adding it to the constructor's +prototype: + +```None +// myobject.cc +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::NewStringType; +using v8::Number; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Local exports) { + Isolate* isolate = exports->GetIsolate(); + + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8( + isolate, "MyObject", NewStringType::kNormal).ToLocalChecked()); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); + + Local context = isolate->GetCurrentContext(); + constructor.Reset(isolate, tpl->GetFunction(context).ToLocalChecked()); + exports->Set(context, String::NewFromUtf8( + isolate, "MyObject", NewStringType::kNormal).ToLocalChecked(), + tpl->GetFunction(context).ToLocalChecked()).FromJust(); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local context = isolate->GetCurrentContext(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? + 0 : args[0]->NumberValue(context).FromMaybe(0); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local result = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(result); + } +} + +void MyObject::PlusOne(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + obj->value_ += 1; + + args.GetReturnValue().Set(Number::New(isolate, obj->value_)); +} + +} // namespace demo +``` + +To build this example, the `myobject.cc` file must be added to the +`binding.gyp`: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ + "addon.cc", + "myobject.cc" + ] + } + ] +} +``` + +Test it with: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const obj = new addon.MyObject(10); +console.log(obj.plusOne()); +// Prints: 11 +console.log(obj.plusOne()); +// Prints: 12 +console.log(obj.plusOne()); +// Prints: 13 +``` + +The destructor for a wrapper object will run when the object is +garbage-collected. For destructor testing, there are command-line flags that +can be used to make it possible to force garbage collection. These flags are +provided by the underlying V8 JavaScript engine. They are subject to change +or removal at any time. They are not documented by Node.js or V8, and they +should never be used outside of testing. + +### Factory of wrapped objects[#](#addons_factory_of_wrapped_objects) + +Alternatively, it is possible to use a factory pattern to avoid explicitly +creating object instances using the JavaScript `new` operator: + +```None +const obj = addon.createObject(); +// instead of: +// const obj = new addon.Object(); +``` + +First, the `createObject()` method is implemented in `addon.cc`: + +```None +// addon.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + MyObject::NewInstance(args); +} + +void InitAll(Local exports, Local module) { + MyObject::Init(exports->GetIsolate()); + + NODE_SET_METHOD(module, "exports", CreateObject); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, InitAll) + +} // namespace demo +``` + +In `myobject.h`, the static method `NewInstance()` is added to handle +instantiating the object. This method takes the place of using `new` in +JavaScript: + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Isolate* isolate); + static void NewInstance(const v8::FunctionCallbackInfo& args); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static void PlusOne(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +The implementation in `myobject.cc` is similar to the previous example: + +```None +// myobject.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::NewStringType; +using v8::Number; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Isolate* isolate) { + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8( + isolate, "MyObject", NewStringType::kNormal).ToLocalChecked()); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); + + Local context = isolate->GetCurrentContext(); + constructor.Reset(isolate, tpl->GetFunction(context).ToLocalChecked()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local context = isolate->GetCurrentContext(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? + 0 : args[0]->NumberValue(context).FromMaybe(0); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(instance); + } +} + +void MyObject::NewInstance(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + const unsigned argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local context = isolate->GetCurrentContext(); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + + args.GetReturnValue().Set(instance); +} + +void MyObject::PlusOne(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + obj->value_ += 1; + + args.GetReturnValue().Set(Number::New(isolate, obj->value_)); +} + +} // namespace demo +``` + +Once again, to build this example, the `myobject.cc` file must be added to the +`binding.gyp`: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ + "addon.cc", + "myobject.cc" + ] + } + ] +} +``` + +Test it with: + +```None +// test.js +const createObject = require('./build/Release/addon'); + +const obj = createObject(10); +console.log(obj.plusOne()); +// Prints: 11 +console.log(obj.plusOne()); +// Prints: 12 +console.log(obj.plusOne()); +// Prints: 13 + +const obj2 = createObject(20); +console.log(obj2.plusOne()); +// Prints: 21 +console.log(obj2.plusOne()); +// Prints: 22 +console.log(obj2.plusOne()); +// Prints: 23 +``` + +### Passing wrapped objects around[#](#addons_passing_wrapped_objects_around) + +In addition to wrapping and returning C++ objects, it is possible to pass +wrapped objects around by unwrapping them with the Node.js helper function +`node::ObjectWrap::Unwrap`. The following examples shows a function `add()` +that can take two `MyObject` objects as input arguments: + +```None +// addon.cc +#include +#include +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + MyObject::NewInstance(args); +} + +void Add(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local context = isolate->GetCurrentContext(); + + MyObject* obj1 = node::ObjectWrap::Unwrap( + args[0]->ToObject(context).ToLocalChecked()); + MyObject* obj2 = node::ObjectWrap::Unwrap( + args[1]->ToObject(context).ToLocalChecked()); + + double sum = obj1->value() + obj2->value(); + args.GetReturnValue().Set(Number::New(isolate, sum)); +} + +void InitAll(Local exports) { + MyObject::Init(exports->GetIsolate()); + + NODE_SET_METHOD(exports, "createObject", CreateObject); + NODE_SET_METHOD(exports, "add", Add); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, InitAll) + +} // namespace demo +``` + +In `myobject.h`, a new public method is added to allow access to private values +after unwrapping the object. + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Isolate* isolate); + static void NewInstance(const v8::FunctionCallbackInfo& args); + inline double value() const { return value_; } + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +The implementation of `myobject.cc` is similar to before: + +```None +// myobject.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::NewStringType; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Isolate* isolate) { + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8( + isolate, "MyObject", NewStringType::kNormal).ToLocalChecked()); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + Local context = isolate->GetCurrentContext(); + constructor.Reset(isolate, tpl->GetFunction(context).ToLocalChecked()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local context = isolate->GetCurrentContext(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? + 0 : args[0]->NumberValue(context).FromMaybe(0); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(instance); + } +} + +void MyObject::NewInstance(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + const unsigned argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local context = isolate->GetCurrentContext(); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + + args.GetReturnValue().Set(instance); +} + +} // namespace demo +``` + +Test it with: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const obj1 = addon.createObject(10); +const obj2 = addon.createObject(20); +const result = addon.add(obj1, obj2); + +console.log(result); +// Prints: 30 +``` + +### AtExit hooks[#](#addons_atexit_hooks) + +An `AtExit` hook is a function that is invoked after the Node.js event loop +has ended but before the JavaScript VM is terminated and Node.js shuts down. +`AtExit` hooks are registered using the `node::AtExit` API. + +#### void AtExit(callback, args)[#](#addons_void_atexit_callback_args) + +* `callback` + A pointer to the function to call at exit. +* `args` + A pointer to pass to the callback at exit. + +Registers exit hooks that run after the event loop has ended but before the VM +is killed. + +`AtExit` takes two parameters: a pointer to a callback function to run at exit, +and a pointer to untyped context data to be passed to that callback. + +Callbacks are run in last-in first-out order. + +The following `addon.cc` implements `AtExit`: + +```None +// addon.cc +#include +#include +#include + +namespace demo { + +using node::AtExit; +using v8::HandleScope; +using v8::Isolate; +using v8::Local; +using v8::Object; + +static char cookie[] = "yum yum"; +static int at_exit_cb1_called = 0; +static int at_exit_cb2_called = 0; + +static void at_exit_cb1(void* arg) { + Isolate* isolate = static_cast(arg); + HandleScope scope(isolate); + Local obj = Object::New(isolate); + assert(!obj.IsEmpty()); // assert VM is still alive + assert(obj->IsObject()); + at_exit_cb1_called++; +} + +static void at_exit_cb2(void* arg) { + assert(arg == static_cast(cookie)); + at_exit_cb2_called++; +} + +static void sanity_check(void*) { + assert(at_exit_cb1_called == 1); + assert(at_exit_cb2_called == 2); +} + +void init(Local exports) { + AtExit(at_exit_cb2, cookie); + AtExit(at_exit_cb2, cookie); + AtExit(at_exit_cb1, exports->GetIsolate()); + AtExit(sanity_check); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, init) + +} // namespace demo +``` + +Test in JavaScript by running: + +```None +// test.js +require('./build/Release/addon'); +``` diff --git a/corpus/docs/nodejs/addons/addons_11x.md b/corpus/docs/nodejs/addons/addons_11x.md new file mode 100644 index 0000000000000000000000000000000000000000..e6c58bbbfd9b2ad2c37ba8155cf9e9b4241d0a5c --- /dev/null +++ b/corpus/docs/nodejs/addons/addons_11x.md @@ -0,0 +1,1371 @@ +# C++ Addons# + +Source: https://nodejs.org/docs/latest-v11.x/api/addons.html +Version: 11.x + +Node.js Addons are dynamically-linked shared objects, written in C++, that +can be loaded into Node.js using the [`require()`](modules.html#modules_require_id) function, and used +just as if they were an ordinary Node.js module. They are used primarily to +provide an interface between JavaScript running in Node.js and C/C++ libraries. + +At the moment, the method for implementing Addons is rather complicated, +involving knowledge of several components and APIs: + +* V8: the C++ library Node.js currently uses to provide the + JavaScript implementation. V8 provides the mechanisms for creating objects, + calling functions, etc. V8's API is documented mostly in the + `v8.h` header file (`deps/v8/include/v8.h` in the Node.js source + tree), which is also available [online](https://v8docs.nodesource.com/). +* [libuv](https://github.com/libuv/libuv): The C library that implements the Node.js event loop, its worker + threads and all of the asynchronous behaviors of the platform. It also + serves as a cross-platform abstraction library, giving easy, POSIX-like + access across all major operating systems to many common system tasks, such + as interacting with the filesystem, sockets, timers, and system events. libuv + also provides a pthreads-like threading abstraction that may be used to + power more sophisticated asynchronous Addons that need to move beyond the + standard event loop. Addon authors are encouraged to think about how to + avoid blocking the event loop with I/O or other time-intensive tasks by + off-loading work via libuv to non-blocking system operations, worker threads + or a custom use of libuv's threads. +* Internal Node.js libraries. Node.js itself exports a number of C++ APIs + that Addons can use — the most important of which is the + `node::ObjectWrap` class. +* Node.js includes a number of other statically linked libraries including + OpenSSL. These other libraries are located in the `deps/` directory in the + Node.js source tree. Only the libuv, OpenSSL, V8 and zlib symbols are + purposefully re-exported by Node.js and may be used to various extents by + Addons. + See [Linking to Node.js' own dependencies](#addons_linking_to_node_js_own_dependencies) for additional information. + +All of the following examples are available for [download](https://github.com/nodejs/node-addon-examples) and may +be used as the starting-point for an Addon. + +## Hello world[#](#addons_hello_world) + +This "Hello world" example is a simple Addon, written in C++, that is the +equivalent of the following JavaScript code: + +```None +module.exports.hello = () => 'world'; +``` + +First, create the file `hello.cc`: + +```None +// hello.cc +#include + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::NewStringType; +using v8::Object; +using v8::String; +using v8::Value; + +void Method(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + args.GetReturnValue().Set(String::NewFromUtf8( + isolate, "world", NewStringType::kNormal).ToLocalChecked()); +} + +void Initialize(Local exports) { + NODE_SET_METHOD(exports, "hello", Method); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, Initialize) + +} // namespace demo +``` + +Note that all Node.js Addons must export an initialization function following +the pattern: + +```None +void Initialize(Local exports); +NODE_MODULE(NODE_GYP_MODULE_NAME, Initialize) +``` + +There is no semi-colon after `NODE_MODULE` as it's not a function (see +`node.h`). + +The `module_name` must match the filename of the final binary (excluding +the `.node` suffix). + +In the `hello.cc` example, then, the initialization function is `Initialize` +and the addon module name is `addon`. + +When building addons with `node-gyp`, using the macro `NODE_GYP_MODULE_NAME` as +the first parameter of `NODE_MODULE()` will ensure that the name of the final +binary will be passed to `NODE_MODULE()`. + +### Context-aware addons[#](#addons_context_aware_addons) + +There are environments in which Node.js addons may need to be loaded multiple +times in multiple contexts. For example, the [Electron](https://electronjs.org/) runtime runs multiple +instances of Node.js in a single process. Each instance will have its own +`require()` cache, and thus each instance will need a native addon to behave +correctly when loaded via `require()`. From the addon's perspective, this means +that it must support multiple initializations. + +A context-aware addon can be constructed by using the macro +`NODE_MODULE_INITIALIZER`, which expands to the name of a function which Node.js +will expect to find when it loads an addon. An addon can thus be initialized as +in the following example: + +```None +using namespace v8; + +extern "C" NODE_MODULE_EXPORT void +NODE_MODULE_INITIALIZER(Local exports, + Local module, + Local context) { + /* Perform addon initialization steps here. */ +} +``` + +Another option is to use the macro `NODE_MODULE_INIT()`, which will also +construct a context-aware addon. Unlike `NODE_MODULE()`, which is used to +construct an addon around a given addon initializer function, +`NODE_MODULE_INIT()` serves as the declaration of such an initializer to be +followed by a function body. + +The following three variables may be used inside the function body following an +invocation of `NODE_MODULE_INIT()`: + +* `Local exports`, +* `Local module`, and +* `Local context` + +The choice to build a context-aware addon carries with it the responsibility of +carefully managing global static data. Since the addon may be loaded multiple +times, potentially even from different threads, any global static data stored +in the addon must be properly protected, and must not contain any persistent +references to JavaScript objects. The reason for this is that JavaScript +objects are only valid in one context, and will likely cause a crash when +accessed from the wrong context or from a different thread than the one on which +they were created. + +The context-aware addon can be structured to avoid global static data by +performing the following steps: + +* defining a class which will hold per-addon-instance data. Such + a class should include a `v8::Persistent` which will hold a weak + reference to the addon's `exports` object. The callback associated with the weak + reference will then destroy the instance of the class. +* constructing an instance of this class in the addon initializer such that the + `v8::Persistent` is set to the `exports` object. +* storing the instance of the class in a `v8::External`, and +* passing the `v8::External` to all methods exposed to JavaScript by passing it + to the `v8::FunctionTemplate` constructor which creates the native-backed + JavaScript functions. The `v8::FunctionTemplate` constructor's third parameter + accepts the `v8::External`. + +This will ensure that the per-addon-instance data reaches each binding that can +be called from JavaScript. The per-addon-instance data must also be passed into +any asynchronous callbacks the addon may create. + +The following example illustrates the implementation of a context-aware addon: + +```None +#include + +using namespace v8; + +class AddonData { + public: + AddonData(Isolate* isolate, Local exports): + call_count(0) { + // Link the existence of this object instance to the existence of exports. + exports_.Reset(isolate, exports); + exports_.SetWeak(this, DeleteMe, WeakCallbackType::kParameter); + } + + ~AddonData() { + if (!exports_.IsEmpty()) { + // Reset the reference to avoid leaking data. + exports_.ClearWeak(); + exports_.Reset(); + } + } + + // Per-addon data. + int call_count; + + private: + // Method to call when "exports" is about to be garbage-collected. + static void DeleteMe(const WeakCallbackInfo& info) { + delete info.GetParameter(); + } + + // Weak handle to the "exports" object. An instance of this class will be + // destroyed along with the exports object to which it is weakly bound. + v8::Persistent exports_; +}; + +static void Method(const v8::FunctionCallbackInfo& info) { + // Retrieve the per-addon-instance data. + AddonData* data = + reinterpret_cast(info.Data().As()->Value()); + data->call_count++; + info.GetReturnValue().Set((double)data->call_count); +} + +// Initialize this addon to be context-aware. +NODE_MODULE_INIT(/* exports, module, context */) { + Isolate* isolate = context->GetIsolate(); + + // Create a new instance of AddonData for this instance of the addon. + AddonData* data = new AddonData(isolate, exports); + // Wrap the data in a v8::External so we can pass it to the method we expose. + Local external = External::New(isolate, data); + + // Expose the method "Method" to JavaScript, and make sure it receives the + // per-addon-instance data we created above by passing `external` as the + // third parameter to the FunctionTemplate constructor. + exports->Set(context, + String::NewFromUtf8(isolate, "method", NewStringType::kNormal) + .ToLocalChecked(), + FunctionTemplate::New(isolate, Method, external) + ->GetFunction(context).ToLocalChecked()).FromJust(); +} +``` + +#### Worker support[#](#addons_worker_support) + +In order to support [`Worker`](worker_threads.html#worker_threads_class_worker) threads, addons need to clean up any resources +they may have allocated when such a thread exists. This can be achieved through +the usage of the `AddEnvironmentCleanupHook()` function: + +```None +void AddEnvironmentCleanupHook(v8::Isolate* isolate, + void (*fun)(void* arg), + void* arg); +``` + +This function adds a hook that will run before a given Node.js instance shuts +down. If necessary, such hooks can be removed using +`RemoveEnvironmentCleanupHook()` before they are run, which has the same +signature. + +In order to be loaded from multiple Node.js environments, +such as a main thread and a Worker thread, an add-on needs to either: + +* Be an N-API addon, or +* Be declared as context-aware using `NODE_MODULE_INIT()` as described above + +### Building[#](#addons_building) + +Once the source code has been written, it must be compiled into the binary +`addon.node` file. To do so, create a file called `binding.gyp` in the +top-level of the project describing the build configuration of the module +using a JSON-like format. This file is used by [node-gyp](https://github.com/nodejs/node-gyp) — a tool written +specifically to compile Node.js Addons. + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "hello.cc" ] + } + ] +} +``` + +A version of the `node-gyp` utility is bundled and distributed with +Node.js as part of `npm`. This version is not made directly available for +developers to use and is intended only to support the ability to use the +`npm install` command to compile and install Addons. Developers who wish to +use `node-gyp` directly can install it using the command +`npm install -g node-gyp`. See the `node-gyp` [installation instructions](https://github.com/nodejs/node-gyp#installation) for +more information, including platform-specific requirements. + +Once the `binding.gyp` file has been created, use `node-gyp configure` to +generate the appropriate project build files for the current platform. This +will generate either a `Makefile` (on Unix platforms) or a `vcxproj` file +(on Windows) in the `build/` directory. + +Next, invoke the `node-gyp build` command to generate the compiled `addon.node` +file. This will be put into the `build/Release/` directory. + +When using `npm install` to install a Node.js Addon, npm uses its own bundled +version of `node-gyp` to perform this same set of actions, generating a +compiled version of the Addon for the user's platform on demand. + +Once built, the binary Addon can be used from within Node.js by pointing +[`require()`](modules.html#modules_require_id) to the built `addon.node` module: + +```None +// hello.js +const addon = require('./build/Release/addon'); + +console.log(addon.hello()); +// Prints: 'world' +``` + +Please see the examples below for further information or + for an example in production. + +Because the exact path to the compiled Addon binary can vary depending on how +it is compiled (i.e. sometimes it may be in `./build/Debug/`), Addons can use +the [bindings](https://github.com/TooTallNate/node-bindings) package to load the compiled module. + +Note that while the `bindings` package implementation is more sophisticated +in how it locates Addon modules, it is essentially using a try-catch pattern +similar to: + +```None +try { + return require('./build/Release/addon.node'); +} catch (err) { + return require('./build/Debug/addon.node'); +} +``` + +### Linking to Node.js' own dependencies[#](#addons_linking_to_node_js_own_dependencies) + +Node.js uses a number of statically linked libraries such as V8, libuv and +OpenSSL. All Addons are required to link to V8 and may link to any of the +other dependencies as well. Typically, this is as simple as including +the appropriate `#include <...>` statements (e.g. `#include `) and +`node-gyp` will locate the appropriate headers automatically. However, there +are a few caveats to be aware of: + +* When `node-gyp` runs, it will detect the specific release version of Node.js + and download either the full source tarball or just the headers. If the full + source is downloaded, Addons will have complete access to the full set of + Node.js dependencies. However, if only the Node.js headers are downloaded, then + only the symbols exported by Node.js will be available. +* `node-gyp` can be run using the `--nodedir` flag pointing at a local Node.js + source image. Using this option, the Addon will have access to the full set of + dependencies. + +### Loading Addons using require()[#](#addons_loading_addons_using_require) + +The filename extension of the compiled Addon binary is `.node` (as opposed +to `.dll` or `.so`). The [`require()`](modules.html#modules_require_id) function is written to look for +files with the `.node` file extension and initialize those as dynamically-linked +libraries. + +When calling [`require()`](modules.html#modules_require_id), the `.node` extension can usually be +omitted and Node.js will still find and initialize the Addon. One caveat, +however, is that Node.js will first attempt to locate and load modules or +JavaScript files that happen to share the same base name. For instance, if +there is a file `addon.js` in the same directory as the binary `addon.node`, +then [`require('addon')`](modules.html#modules_require_id) will give precedence to the `addon.js` file +and load it instead. + +## Native Abstractions for Node.js[#](#addons_native_abstractions_for_node_js) + +Each of the examples illustrated in this document make direct use of the +Node.js and V8 APIs for implementing Addons. It is important to understand +that the V8 API can, and has, changed dramatically from one V8 release to the +next (and one major Node.js release to the next). With each change, Addons may +need to be updated and recompiled in order to continue functioning. The Node.js +release schedule is designed to minimize the frequency and impact of such +changes but there is little that Node.js can do currently to ensure stability +of the V8 APIs. + +The [Native Abstractions for Node.js](https://github.com/nodejs/nan) (or `nan`) provide a set of tools that +Addon developers are recommended to use to keep compatibility between past and +future releases of V8 and Node.js. See the `nan` [examples](https://github.com/nodejs/nan/tree/master/examples/) for an +illustration of how it can be used. + +## N-API[#](#addons_n_api) + +[Stability: 2](documentation.html#documentation_stability_index) - Stable + +N-API is an API for building native Addons. It is independent from +the underlying JavaScript runtime (e.g. V8) and is maintained as part of +Node.js itself. This API will be Application Binary Interface (ABI) stable +across versions of Node.js. It is intended to insulate Addons from +changes in the underlying JavaScript engine and allow modules +compiled for one version to run on later versions of Node.js without +recompilation. Addons are built/packaged with the same approach/tools +outlined in this document (node-gyp, etc.). The only difference is the +set of APIs that are used by the native code. Instead of using the V8 +or [Native Abstractions for Node.js](https://github.com/nodejs/nan) APIs, the functions available +in the N-API are used. + +Creating and maintaining an addon that benefits from the ABI stability +provided by N-API carries with it certain +[implementation considerations](n-api.html#n_api_implications_of_abi_stability). + +To use N-API in the above "Hello world" example, replace the content of +`hello.cc` with the following. All other instructions remain the same. + +```None +// hello.cc using N-API +#include + +namespace demo { + +napi_value Method(napi_env env, napi_callback_info args) { + napi_value greeting; + napi_status status; + + status = napi_create_string_utf8(env, "world", NAPI_AUTO_LENGTH, &greeting); + if (status != napi_ok) return nullptr; + return greeting; +} + +napi_value init(napi_env env, napi_value exports) { + napi_status status; + napi_value fn; + + status = napi_create_function(env, nullptr, 0, Method, nullptr, &fn); + if (status != napi_ok) return nullptr; + + status = napi_set_named_property(env, exports, "hello", fn); + if (status != napi_ok) return nullptr; + return exports; +} + +NAPI_MODULE(NODE_GYP_MODULE_NAME, init) + +} // namespace demo +``` + +The functions available and how to use them are documented in the +section titled [C/C++ Addons - N-API](n-api.html). + +## Addon examples[#](#addons_addon_examples) + +Following are some example Addons intended to help developers get started. The +examples make use of the V8 APIs. Refer to the online [V8 reference](https://v8docs.nodesource.com/) +for help with the various V8 calls, and V8's [Embedder's Guide](https://github.com/v8/v8/wiki/Embedder's%20Guide) for an +explanation of several concepts used such as handles, scopes, function +templates, etc. + +Each of these examples using the following `binding.gyp` file: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "addon.cc" ] + } + ] +} +``` + +In cases where there is more than one `.cc` file, simply add the additional +filename to the `sources` array: + +```None +"sources": ["addon.cc", "myexample.cc"] +``` + +Once the `binding.gyp` file is ready, the example Addons can be configured and +built using `node-gyp`: + +```None +$ node-gyp configure build +``` + +### Function arguments[#](#addons_function_arguments) + +Addons will typically expose objects and functions that can be accessed from +JavaScript running within Node.js. When functions are invoked from JavaScript, +the input arguments and return value must be mapped to and from the C/C++ +code. + +The following example illustrates how to read function arguments passed from +JavaScript and how to return a result: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Exception; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::NewStringType; +using v8::Number; +using v8::Object; +using v8::String; +using v8::Value; + +// This is the implementation of the "add" method +// Input arguments are passed using the +// const FunctionCallbackInfo& args struct +void Add(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + // Check the number of arguments passed. + if (args.Length() < 2) { + // Throw an Error that is passed back to JavaScript + isolate->ThrowException(Exception::TypeError( + String::NewFromUtf8(isolate, + "Wrong number of arguments", + NewStringType::kNormal).ToLocalChecked())); + return; + } + + // Check the argument types + if (!args[0]->IsNumber() || !args[1]->IsNumber()) { + isolate->ThrowException(Exception::TypeError( + String::NewFromUtf8(isolate, + "Wrong arguments", + NewStringType::kNormal).ToLocalChecked())); + return; + } + + // Perform the operation + double value = + args[0].As()->Value() + args[1].As()->Value(); + Local num = Number::New(isolate, value); + + // Set the return value (using the passed in + // FunctionCallbackInfo&) + args.GetReturnValue().Set(num); +} + +void Init(Local exports) { + NODE_SET_METHOD(exports, "add", Add); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, Init) + +} // namespace demo +``` + +Once compiled, the example Addon can be required and used from within Node.js: + +```None +// test.js +const addon = require('./build/Release/addon'); + +console.log('This should be eight:', addon.add(3, 5)); +``` + +### Callbacks[#](#addons_callbacks) + +It is common practice within Addons to pass JavaScript functions to a C++ +function and execute them from there. The following example illustrates how +to invoke such callbacks: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::NewStringType; +using v8::Null; +using v8::Object; +using v8::String; +using v8::Value; + +void RunCallback(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local context = isolate->GetCurrentContext(); + Local cb = Local::Cast(args[0]); + const unsigned argc = 1; + Local argv[argc] = { + String::NewFromUtf8(isolate, + "hello world", + NewStringType::kNormal).ToLocalChecked() }; + cb->Call(context, Null(isolate), argc, argv).ToLocalChecked(); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", RunCallback); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, Init) + +} // namespace demo +``` + +Note that this example uses a two-argument form of `Init()` that receives +the full `module` object as the second argument. This allows the Addon +to completely overwrite `exports` with a single function instead of +adding the function as a property of `exports`. + +To test it, run the following JavaScript: + +```None +// test.js +const addon = require('./build/Release/addon'); + +addon((msg) => { + console.log(msg); +// Prints: 'hello world' +}); +``` + +Note that, in this example, the callback function is invoked synchronously. + +### Object factory[#](#addons_object_factory) + +Addons can create and return new objects from within a C++ function as +illustrated in the following example. An object is created and returned with a +property `msg` that echoes the string passed to `createObject()`: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Context; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::NewStringType; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local context = isolate->GetCurrentContext(); + + Local obj = Object::New(isolate); + obj->Set(context, + String::NewFromUtf8(isolate, + "msg", + NewStringType::kNormal).ToLocalChecked(), + args[0]->ToString(context).ToLocalChecked()) + .FromJust(); + + args.GetReturnValue().Set(obj); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", CreateObject); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, Init) + +} // namespace demo +``` + +To test it in JavaScript: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const obj1 = addon('hello'); +const obj2 = addon('world'); +console.log(obj1.msg, obj2.msg); +// Prints: 'hello world' +``` + +### Function factory[#](#addons_function_factory) + +Another common scenario is creating JavaScript functions that wrap C++ +functions and returning those back to JavaScript: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::NewStringType; +using v8::Object; +using v8::String; +using v8::Value; + +void MyFunction(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + args.GetReturnValue().Set(String::NewFromUtf8( + isolate, "hello world", NewStringType::kNormal).ToLocalChecked()); +} + +void CreateFunction(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + Local context = isolate->GetCurrentContext(); + Local tpl = FunctionTemplate::New(isolate, MyFunction); + Local fn = tpl->GetFunction(context).ToLocalChecked(); + + // omit this to make it anonymous + fn->SetName(String::NewFromUtf8( + isolate, "theFunction", NewStringType::kNormal).ToLocalChecked()); + + args.GetReturnValue().Set(fn); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", CreateFunction); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, Init) + +} // namespace demo +``` + +To test: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const fn = addon(); +console.log(fn()); +// Prints: 'hello world' +``` + +### Wrapping C++ objects[#](#addons_wrapping_c_objects) + +It is also possible to wrap C++ objects/classes in a way that allows new +instances to be created using the JavaScript `new` operator: + +```None +// addon.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Local; +using v8::Object; + +void InitAll(Local exports) { + MyObject::Init(exports); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, InitAll) + +} // namespace demo +``` + +Then, in `myobject.h`, the wrapper class inherits from `node::ObjectWrap`: + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Local exports); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static void PlusOne(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +In `myobject.cc`, implement the various methods that are to be exposed. +Below, the method `plusOne()` is exposed by adding it to the constructor's +prototype: + +```None +// myobject.cc +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::NewStringType; +using v8::Number; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Local exports) { + Isolate* isolate = exports->GetIsolate(); + + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8( + isolate, "MyObject", NewStringType::kNormal).ToLocalChecked()); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); + + Local context = isolate->GetCurrentContext(); + constructor.Reset(isolate, tpl->GetFunction(context).ToLocalChecked()); + exports->Set(context, String::NewFromUtf8( + isolate, "MyObject", NewStringType::kNormal).ToLocalChecked(), + tpl->GetFunction(context).ToLocalChecked()).FromJust(); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local context = isolate->GetCurrentContext(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? + 0 : args[0]->NumberValue(context).FromMaybe(0); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local result = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(result); + } +} + +void MyObject::PlusOne(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + obj->value_ += 1; + + args.GetReturnValue().Set(Number::New(isolate, obj->value_)); +} + +} // namespace demo +``` + +To build this example, the `myobject.cc` file must be added to the +`binding.gyp`: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ + "addon.cc", + "myobject.cc" + ] + } + ] +} +``` + +Test it with: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const obj = new addon.MyObject(10); +console.log(obj.plusOne()); +// Prints: 11 +console.log(obj.plusOne()); +// Prints: 12 +console.log(obj.plusOne()); +// Prints: 13 +``` + +The destructor for a wrapper object will run when the object is +garbage-collected. For destructor testing, there are command-line flags that +can be used to make it possible to force garbage collection. These flags are +provided by the underlying V8 JavaScript engine. They are subject to change +or removal at any time. They are not documented by Node.js or V8, and they +should never be used outside of testing. + +### Factory of wrapped objects[#](#addons_factory_of_wrapped_objects) + +Alternatively, it is possible to use a factory pattern to avoid explicitly +creating object instances using the JavaScript `new` operator: + +```None +const obj = addon.createObject(); +// instead of: +// const obj = new addon.Object(); +``` + +First, the `createObject()` method is implemented in `addon.cc`: + +```None +// addon.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + MyObject::NewInstance(args); +} + +void InitAll(Local exports, Local module) { + MyObject::Init(exports->GetIsolate()); + + NODE_SET_METHOD(module, "exports", CreateObject); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, InitAll) + +} // namespace demo +``` + +In `myobject.h`, the static method `NewInstance()` is added to handle +instantiating the object. This method takes the place of using `new` in +JavaScript: + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Isolate* isolate); + static void NewInstance(const v8::FunctionCallbackInfo& args); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static void PlusOne(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +The implementation in `myobject.cc` is similar to the previous example: + +```None +// myobject.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::NewStringType; +using v8::Number; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Isolate* isolate) { + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8( + isolate, "MyObject", NewStringType::kNormal).ToLocalChecked()); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); + + Local context = isolate->GetCurrentContext(); + constructor.Reset(isolate, tpl->GetFunction(context).ToLocalChecked()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local context = isolate->GetCurrentContext(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? + 0 : args[0]->NumberValue(context).FromMaybe(0); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(instance); + } +} + +void MyObject::NewInstance(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + const unsigned argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local context = isolate->GetCurrentContext(); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + + args.GetReturnValue().Set(instance); +} + +void MyObject::PlusOne(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + obj->value_ += 1; + + args.GetReturnValue().Set(Number::New(isolate, obj->value_)); +} + +} // namespace demo +``` + +Once again, to build this example, the `myobject.cc` file must be added to the +`binding.gyp`: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ + "addon.cc", + "myobject.cc" + ] + } + ] +} +``` + +Test it with: + +```None +// test.js +const createObject = require('./build/Release/addon'); + +const obj = createObject(10); +console.log(obj.plusOne()); +// Prints: 11 +console.log(obj.plusOne()); +// Prints: 12 +console.log(obj.plusOne()); +// Prints: 13 + +const obj2 = createObject(20); +console.log(obj2.plusOne()); +// Prints: 21 +console.log(obj2.plusOne()); +// Prints: 22 +console.log(obj2.plusOne()); +// Prints: 23 +``` + +### Passing wrapped objects around[#](#addons_passing_wrapped_objects_around) + +In addition to wrapping and returning C++ objects, it is possible to pass +wrapped objects around by unwrapping them with the Node.js helper function +`node::ObjectWrap::Unwrap`. The following examples shows a function `add()` +that can take two `MyObject` objects as input arguments: + +```None +// addon.cc +#include +#include +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + MyObject::NewInstance(args); +} + +void Add(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local context = isolate->GetCurrentContext(); + + MyObject* obj1 = node::ObjectWrap::Unwrap( + args[0]->ToObject(context).ToLocalChecked()); + MyObject* obj2 = node::ObjectWrap::Unwrap( + args[1]->ToObject(context).ToLocalChecked()); + + double sum = obj1->value() + obj2->value(); + args.GetReturnValue().Set(Number::New(isolate, sum)); +} + +void InitAll(Local exports) { + MyObject::Init(exports->GetIsolate()); + + NODE_SET_METHOD(exports, "createObject", CreateObject); + NODE_SET_METHOD(exports, "add", Add); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, InitAll) + +} // namespace demo +``` + +In `myobject.h`, a new public method is added to allow access to private values +after unwrapping the object. + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Isolate* isolate); + static void NewInstance(const v8::FunctionCallbackInfo& args); + inline double value() const { return value_; } + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +The implementation of `myobject.cc` is similar to before: + +```None +// myobject.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::NewStringType; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Isolate* isolate) { + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8( + isolate, "MyObject", NewStringType::kNormal).ToLocalChecked()); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + Local context = isolate->GetCurrentContext(); + constructor.Reset(isolate, tpl->GetFunction(context).ToLocalChecked()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local context = isolate->GetCurrentContext(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? + 0 : args[0]->NumberValue(context).FromMaybe(0); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(instance); + } +} + +void MyObject::NewInstance(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + const unsigned argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local context = isolate->GetCurrentContext(); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + + args.GetReturnValue().Set(instance); +} + +} // namespace demo +``` + +Test it with: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const obj1 = addon.createObject(10); +const obj2 = addon.createObject(20); +const result = addon.add(obj1, obj2); + +console.log(result); +// Prints: 30 +``` + +### AtExit hooks[#](#addons_atexit_hooks) + +An `AtExit` hook is a function that is invoked after the Node.js event loop +has ended but before the JavaScript VM is terminated and Node.js shuts down. +`AtExit` hooks are registered using the `node::AtExit` API. + +#### void AtExit(callback, args)[#](#addons_void_atexit_callback_args) + +* `callback` + A pointer to the function to call at exit. +* `args` + A pointer to pass to the callback at exit. + +Registers exit hooks that run after the event loop has ended but before the VM +is killed. + +`AtExit` takes two parameters: a pointer to a callback function to run at exit, +and a pointer to untyped context data to be passed to that callback. + +Callbacks are run in last-in first-out order. + +The following `addon.cc` implements `AtExit`: + +```None +// addon.cc +#include +#include +#include + +namespace demo { + +using node::AtExit; +using v8::HandleScope; +using v8::Isolate; +using v8::Local; +using v8::Object; + +static char cookie[] = "yum yum"; +static int at_exit_cb1_called = 0; +static int at_exit_cb2_called = 0; + +static void at_exit_cb1(void* arg) { + Isolate* isolate = static_cast(arg); + HandleScope scope(isolate); + Local obj = Object::New(isolate); + assert(!obj.IsEmpty()); // assert VM is still alive + assert(obj->IsObject()); + at_exit_cb1_called++; +} + +static void at_exit_cb2(void* arg) { + assert(arg == static_cast(cookie)); + at_exit_cb2_called++; +} + +static void sanity_check(void*) { + assert(at_exit_cb1_called == 1); + assert(at_exit_cb2_called == 2); +} + +void init(Local exports) { + AtExit(at_exit_cb2, cookie); + AtExit(at_exit_cb2, cookie); + AtExit(at_exit_cb1, exports->GetIsolate()); + AtExit(sanity_check); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, init) + +} // namespace demo +``` + +Test in JavaScript by running: + +```None +// test.js +require('./build/Release/addon'); +``` diff --git a/corpus/docs/nodejs/addons/addons_4x.md b/corpus/docs/nodejs/addons/addons_4x.md new file mode 100644 index 0000000000000000000000000000000000000000..0820575e30fbf031e0093bc6f54b1855bf934e7f --- /dev/null +++ b/corpus/docs/nodejs/addons/addons_4x.md @@ -0,0 +1,1089 @@ +# C/C++ Addons# + +Source: https://nodejs.org/docs/latest-v4.x/api/addons.html +Version: 4.x + +Node.js Addons are dynamically-linked shared objects, written in C or C++, that +can be loaded into Node.js using the [`require()`](globals.html#globals_require) function, and used +just as if they were an ordinary Node.js module. They are used primarily to +provide an interface between JavaScript running in Node.js and C/C++ libraries. + +At the moment, the method for implementing Addons is rather complicated, +involving knowledge of several components and APIs : + +* V8: the C++ library Node.js currently uses to provide the + JavaScript implementation. V8 provides the mechanisms for creating objects, + calling functions, etc. V8's API is documented mostly in the + `v8.h` header file (`deps/v8/include/v8.h` in the Node.js source + tree), which is also available [online](https://v8docs.nodesource.com/). +* [libuv](https://github.com/libuv/libuv): The C library that implements the Node.js event loop, its worker + threads and all of the asynchronous behaviors of the platform. It also + serves as a cross-platform abstraction library, giving easy, POSIX-like + access across all major operating systems to many common system tasks, such + as interacting with the filesystem, sockets, timers and system events. libuv + also provides a pthreads-like threading abstraction that may be used to + power more sophisticated asynchronous Addons that need to move beyond the + standard event loop. Addon authors are encouraged to think about how to + avoid blocking the event loop with I/O or other time-intensive tasks by + off-loading work via libuv to non-blocking system operations, worker threads + or a custom use of libuv's threads. +* Internal Node.js libraries. Node.js itself exports a number of C/C++ APIs + that Addons can use — the most important of which is the + `node::ObjectWrap` class. +* Node.js includes a number of other statically linked libraries including + OpenSSL. These other libraries are located in the `deps/` directory in the + Node.js source tree. Only the V8 and OpenSSL symbols are purposefully + re-exported by Node.js and may be used to various extents by Addons. + See [Linking to Node.js' own dependencies](#linking-to-nodejs-own-dependencies) for additional information. + +All of the following examples are available for [download](https://github.com/nodejs/node-addon-examples) and may +be used as a starting-point for your own Addon. + +## Hello world[#](#addons_hello_world) + +This "Hello world" example is a simple Addon, written in C++, that is the +equivalent of the following JavaScript code: + +```None +module.exports.hello = () => 'world'; +``` + +First, create the file `hello.cc`: + +```None +// hello.cc +#include + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void Method(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world")); +} + +void init(Local exports) { + NODE_SET_METHOD(exports, "hello", Method); +} + +NODE_MODULE(addon, init) + +} // namespace demo +``` + +Note that all Node.js Addons must export an initialization function following +the pattern: + +```None +void Initialize(Local exports); +NODE_MODULE(module_name, Initialize) +``` + +There is no semi-colon after `NODE_MODULE` as it's not a function (see +`node.h`). + +The `module_name` must match the filename of the final binary (excluding +the .node suffix). + +In the `hello.cc` example, then, the initialization function is `init` and the +Addon module name is `addon`. + +### Building[#](#addons_building) + +Once the source code has been written, it must be compiled into the binary +`addon.node` file. To do so, create a file called `binding.gyp` in the +top-level of the project describing the build configuration of your module +using a JSON-like format. This file is used by [node-gyp](https://github.com/nodejs/node-gyp) -- a tool written +specifically to compile Node.js Addons. + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "hello.cc" ] + } + ] +} +``` + +*Note: A version of the `node-gyp` utility is bundled and distributed with +Node.js as part of `npm`. This version is not made directly available for +developers to use and is intended only to support the ability to use the +`npm install` command to compile and install Addons. Developers who wish to +use `node-gyp` directly can install it using the command +`npm install -g node-gyp`. See the `node-gyp` [installation instructions](https://github.com/nodejs/node-gyp#installation) for +more information, including platform-specific requirements.* + +Once the `binding.gyp` file has been created, use `node-gyp configure` to +generate the appropriate project build files for the current platform. This +will generate either a `Makefile` (on Unix platforms) or a `vcxproj` file +(on Windows) in the `build/` directory. + +Next, invoke the `node-gyp build` command to generate the compiled `addon.node` +file. This will be put into the `build/Release/` directory. + +When using `npm install` to install a Node.js Addon, npm uses its own bundled +version of `node-gyp` to perform this same set of actions, generating a +compiled version of the Addon for the user's platform on demand. + +Once built, the binary Addon can be used from within Node.js by pointing +[`require()`](globals.html#globals_require) to the built `addon.node` module: + +```None +// hello.js +const addon = require('./build/Release/addon'); + +console.log(addon.hello()); // 'world' +``` + +Please see the examples below for further information or + for an example in production. + +Because the exact path to the compiled Addon binary can vary depending on how +it is compiled (i.e. sometimes it may be in `./build/Debug/`), Addons can use +the [bindings](https://github.com/TooTallNate/node-bindings) package to load the compiled module. + +Note that while the `bindings` package implementation is more sophisticated +in how it locates Addon modules, it is essentially using a try-catch pattern +similar to: + +```None +try { + return require('./build/Release/addon.node'); +} catch (err) { + return require('./build/Debug/addon.node'); +} +``` + +### Linking to Node.js' own dependencies[#](#addons_linking_to_node_js_own_dependencies) + +Node.js uses a number of statically linked libraries such as V8, libuv and +OpenSSL. All Addons are required to link to V8 and may link to any of the +other dependencies as well. Typically, this is as simple as including +the appropriate `#include <...>` statements (e.g. `#include `) and +`node-gyp` will locate the appropriate headers automatically. However, there +are a few caveats to be aware of: + +* When `node-gyp` runs, it will detect the specific release version of Node.js + and download either the full source tarball or just the headers. If the full + source is downloaded, Addons will have complete access to the full set of + Node.js dependencies. However, if only the Node.js headers are downloaded, then + only the symbols exported by Node.js will be available. +* `node-gyp` can be run using the `--nodedir` flag pointing at a local Node.js + source image. Using this option, the Addon will have access to the full set of + dependencies. + +### Loading Addons using require()[#](#addons_loading_addons_using_require) + +The filename extension of the compiled Addon binary is `.node` (as opposed +to `.dll` or `.so`). The [`require()`](globals.html#globals_require) function is written to look for +files with the `.node` file extension and initialize those as dynamically-linked +libraries. + +When calling [`require()`](globals.html#globals_require), the `.node` extension can usually be +omitted and Node.js will still find and initialize the Addon. One caveat, +however, is that Node.js will first attempt to locate and load modules or +JavaScript files that happen to share the same base name. For instance, if +there is a file `addon.js` in the same directory as the binary `addon.node`, +then [`require('addon')`](globals.html#globals_require) will give precedence to the `addon.js` file +and load it instead. + +## Native Abstractions for Node.js[#](#addons_native_abstractions_for_node_js) + +Each of the examples illustrated in this document make direct use of the +Node.js and V8 APIs for implementing Addons. It is important to understand +that the V8 API can, and has, changed dramatically from one V8 release to the +next (and one major Node.js release to the next). With each change, Addons may +need to be updated and recompiled in order to continue functioning. The Node.js +release schedule is designed to minimize the frequency and impact of such +changes but there is little that Node.js can do currently to ensure stability +of the V8 APIs. + +The [Native Abstractions for Node.js](https://github.com/nodejs/nan) (or `nan`) provide a set of tools that +Addon developers are recommended to use to keep compatibility between past and +future releases of V8 and Node.js. See the `nan` [examples](https://github.com/nodejs/nan/tree/master/examples/) for an +illustration of how it can be used. + +## Addon examples[#](#addons_addon_examples) + +Following are some example Addons intended to help developers get started. The +examples make use of the V8 APIs. Refer to the online [V8 reference](https://v8docs.nodesource.com/) +for help with the various V8 calls, and V8's [Embedder's Guide](https://developers.google.com/v8/embed) for an +explanation of several concepts used such as handles, scopes, function +templates, etc. + +Each of these examples using the following `binding.gyp` file: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "addon.cc" ] + } + ] +} +``` + +In cases where there is more than one `.cc` file, simply add the additional +filename to the `sources` array. For example: + +```None +"sources": ["addon.cc", "myexample.cc"] +``` + +Once the `binding.gyp` file is ready, the example Addons can be configured and +built using `node-gyp`: + +```None +$ node-gyp configure build +``` + +### Function arguments[#](#addons_function_arguments) + +Addons will typically expose objects and functions that can be accessed from +JavaScript running within Node.js. When functions are invoked from JavaScript, +the input arguments and return value must be mapped to and from the C/C++ +code. + +The following example illustrates how to read function arguments passed from +JavaScript and how to return a result: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Exception; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::String; +using v8::Value; + +// This is the implementation of the "add" method +// Input arguments are passed using the +// const FunctionCallbackInfo& args struct +void Add(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + // Check the number of arguments passed. + if (args.Length() < 2) { + // Throw an Error that is passed back to JavaScript + isolate->ThrowException(Exception::TypeError( + String::NewFromUtf8(isolate, "Wrong number of arguments"))); + return; + } + + // Check the argument types + if (!args[0]->IsNumber() || !args[1]->IsNumber()) { + isolate->ThrowException(Exception::TypeError( + String::NewFromUtf8(isolate, "Wrong arguments"))); + return; + } + + // Perform the operation + double value = args[0]->NumberValue() + args[1]->NumberValue(); + Local num = Number::New(isolate, value); + + // Set the return value (using the passed in + // FunctionCallbackInfo&) + args.GetReturnValue().Set(num); +} + +void Init(Local exports) { + NODE_SET_METHOD(exports, "add", Add); +} + +NODE_MODULE(addon, Init) + +} // namespace demo +``` + +Once compiled, the example Addon can be required and used from within Node.js: + +```None +// test.js +const addon = require('./build/Release/addon'); + +console.log('This should be eight:', addon.add(3, 5)); +``` + +### Callbacks[#](#addons_callbacks) + +It is common practice within Addons to pass JavaScript functions to a C++ +function and execute them from there. The following example illustrates how +to invoke such callbacks: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Null; +using v8::Object; +using v8::String; +using v8::Value; + +void RunCallback(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local cb = Local::Cast(args[0]); + const unsigned argc = 1; + Local argv[argc] = { String::NewFromUtf8(isolate, "hello world") }; + cb->Call(Null(isolate), argc, argv); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", RunCallback); +} + +NODE_MODULE(addon, Init) + +} // namespace demo +``` + +Note that this example uses a two-argument form of `Init()` that receives +the full `module` object as the second argument. This allows the Addon +to completely overwrite `exports` with a single function instead of +adding the function as a property of `exports`. + +To test it, run the following JavaScript: + +```None +// test.js +const addon = require('./build/Release/addon'); + +addon((msg) => { + console.log(msg); // 'hello world' +}); +``` + +Note that, in this example, the callback function is invoked synchronously. + +### Object factory[#](#addons_object_factory) + +Addons can create and return new objects from within a C++ function as +illustrated in the following example. An object is created and returned with a +property `msg` that echoes the string passed to `createObject()`: + +```None +// addon.cc +#include + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + Local obj = Object::New(isolate); + obj->Set(String::NewFromUtf8(isolate, "msg"), args[0]->ToString()); + + args.GetReturnValue().Set(obj); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", CreateObject); +} + +NODE_MODULE(addon, Init) + +} // namespace demo +``` + +To test it in JavaScript: + +```None +// test.js +const addon = require('./build/Release/addon'); + +var obj1 = addon('hello'); +var obj2 = addon('world'); +console.log(obj1.msg, obj2.msg); // 'hello world' +``` + +### Function factory[#](#addons_function_factory) + +Another common scenario is creating JavaScript functions that wrap C++ +functions and returning those back to JavaScript: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void MyFunction(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, "hello world")); +} + +void CreateFunction(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + Local tpl = FunctionTemplate::New(isolate, MyFunction); + Local fn = tpl->GetFunction(); + + // omit this to make it anonymous + fn->SetName(String::NewFromUtf8(isolate, "theFunction")); + + args.GetReturnValue().Set(fn); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", CreateFunction); +} + +NODE_MODULE(addon, Init) + +} // namespace demo +``` + +To test: + +```None +// test.js +const addon = require('./build/Release/addon'); + +var fn = addon(); +console.log(fn()); // 'hello world' +``` + +### Wrapping C++ objects[#](#addons_wrapping_c_objects) + +It is also possible to wrap C++ objects/classes in a way that allows new +instances to be created using the JavaScript `new` operator: + +```None +// addon.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Local; +using v8::Object; + +void InitAll(Local exports) { + MyObject::Init(exports); +} + +NODE_MODULE(addon, InitAll) + +} // namespace demo +``` + +Then, in `myobject.h`, the wrapper class inherits from `node::ObjectWrap`: + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Local exports); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static void PlusOne(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +In `myobject.cc`, implement the various methods that are to be exposed. +Below, the method `plusOne()` is exposed by adding it to the constructor's +prototype: + +```None +// myobject.cc +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Local exports) { + Isolate* isolate = exports->GetIsolate(); + + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); + + constructor.Reset(isolate, tpl->GetFunction()); + exports->Set(String::NewFromUtf8(isolate, "MyObject"), + tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local context = isolate->GetCurrentContext(); + Local cons = Local::New(isolate, constructor); + Local result = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(result); + } +} + +void MyObject::PlusOne(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + obj->value_ += 1; + + args.GetReturnValue().Set(Number::New(isolate, obj->value_)); +} + +} // namespace demo +``` + +To build this example, the `myobject.cc` file must be added to the +`binding.gyp`: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ + "addon.cc", + "myobject.cc" + ] + } + ] +} +``` + +Test it with: + +```None +// test.js +const addon = require('./build/Release/addon'); + +var obj = new addon.MyObject(10); +console.log(obj.plusOne()); // 11 +console.log(obj.plusOne()); // 12 +console.log(obj.plusOne()); // 13 +``` + +### Factory of wrapped objects[#](#addons_factory_of_wrapped_objects) + +Alternatively, it is possible to use a factory pattern to avoid explicitly +creating object instances using the JavaScript `new` operator: + +```None +var obj = addon.createObject(); +// instead of: +// var obj = new addon.Object(); +``` + +First, the `createObject()` method is implemented in `addon.cc`: + +```None +// addon.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + MyObject::NewInstance(args); +} + +void InitAll(Local exports, Local module) { + MyObject::Init(exports->GetIsolate()); + + NODE_SET_METHOD(module, "exports", CreateObject); +} + +NODE_MODULE(addon, InitAll) + +} // namespace demo +``` + +In `myobject.h`, the static method `NewInstance()` is added to handle +instantiating the object. This method takes the place of using `new` in +JavaScript: + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Isolate* isolate); + static void NewInstance(const v8::FunctionCallbackInfo& args); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static void PlusOne(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +The implementation in `myobject.cc` is similar to the previous example: + +```None +// myobject.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Isolate* isolate) { + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); + + constructor.Reset(isolate, tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local context = isolate->GetCurrentContext(); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(instance); + } +} + +void MyObject::NewInstance(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + const unsigned argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local context = isolate->GetCurrentContext(); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + + args.GetReturnValue().Set(instance); +} + +void MyObject::PlusOne(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + obj->value_ += 1; + + args.GetReturnValue().Set(Number::New(isolate, obj->value_)); +} + +} // namespace demo +``` + +Once again, to build this example, the `myobject.cc` file must be added to the +`binding.gyp`: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ + "addon.cc", + "myobject.cc" + ] + } + ] +} +``` + +Test it with: + +```None +// test.js +const createObject = require('./build/Release/addon'); + +var obj = createObject(10); +console.log(obj.plusOne()); // 11 +console.log(obj.plusOne()); // 12 +console.log(obj.plusOne()); // 13 + +var obj2 = createObject(20); +console.log(obj2.plusOne()); // 21 +console.log(obj2.plusOne()); // 22 +console.log(obj2.plusOne()); // 23 +``` + +### Passing wrapped objects around[#](#addons_passing_wrapped_objects_around) + +In addition to wrapping and returning C++ objects, it is possible to pass +wrapped objects around by unwrapping them with the Node.js helper function +`node::ObjectWrap::Unwrap`. The following examples shows a function `add()` +that can take two `MyObject` objects as input arguments: + +```None +// addon.cc +#include +#include +#include "myobject.h" + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + MyObject::NewInstance(args); +} + +void Add(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj1 = node::ObjectWrap::Unwrap( + args[0]->ToObject()); + MyObject* obj2 = node::ObjectWrap::Unwrap( + args[1]->ToObject()); + + double sum = obj1->value() + obj2->value(); + args.GetReturnValue().Set(Number::New(isolate, sum)); +} + +void InitAll(Local exports) { + MyObject::Init(exports->GetIsolate()); + + NODE_SET_METHOD(exports, "createObject", CreateObject); + NODE_SET_METHOD(exports, "add", Add); +} + +NODE_MODULE(addon, InitAll) + +} // namespace demo +``` + +In `myobject.h`, a new public method is added to allow access to private values +after unwrapping the object. + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Isolate* isolate); + static void NewInstance(const v8::FunctionCallbackInfo& args); + inline double value() const { return value_; } + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +The implementation of `myobject.cc` is similar to before: + +```None +// myobject.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Isolate* isolate) { + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + constructor.Reset(isolate, tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local context = isolate->GetCurrentContext(); + Local cons = Local::New(isolate, constructor); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(instance); + } +} + +void MyObject::NewInstance(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + const unsigned argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local context = isolate->GetCurrentContext(); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + + args.GetReturnValue().Set(instance); +} + +} // namespace demo +``` + +Test it with: + +```None +// test.js +const addon = require('./build/Release/addon'); + +var obj1 = addon.createObject(10); +var obj2 = addon.createObject(20); +var result = addon.add(obj1, obj2); + +console.log(result); // 30 +``` + +### AtExit hooks[#](#addons_atexit_hooks) + +An "AtExit" hook is a function that is invoked after the Node.js event loop +has ended but before the JavaScript VM is terminated and Node.js shuts down. +"AtExit" hooks are registered using the `node::AtExit` API. + +#### void AtExit(callback, args)[#](#addons_void_atexit_callback_args) + +* `callback`: `void (*)(void*)` - A pointer to the function to call at exit. +* `args`: `void*` - A pointer to pass to the callback at exit. + +Registers exit hooks that run after the event loop has ended but before the VM +is killed. + +AtExit takes two parameters: a pointer to a callback function to run at exit, +and a pointer to untyped context data to be passed to that callback. + +Callbacks are run in last-in first-out order. + +The following `addon.cc` implements AtExit: + +```None +// addon.cc +#undef NDEBUG +#include +#include +#include + +namespace demo { + +using node::AtExit; +using v8::HandleScope; +using v8::Isolate; +using v8::Local; +using v8::Object; + +static char cookie[] = "yum yum"; +static int at_exit_cb1_called = 0; +static int at_exit_cb2_called = 0; + +static void at_exit_cb1(void* arg) { + Isolate* isolate = static_cast(arg); + HandleScope scope(isolate); + Local obj = Object::New(isolate); + assert(!obj.IsEmpty()); // assert VM is still alive + assert(obj->IsObject()); + at_exit_cb1_called++; +} + +static void at_exit_cb2(void* arg) { + assert(arg == static_cast(cookie)); + at_exit_cb2_called++; +} + +static void sanity_check(void*) { + assert(at_exit_cb1_called == 1); + assert(at_exit_cb2_called == 2); +} + +void init(Local exports) { + AtExit(sanity_check); + AtExit(at_exit_cb2, cookie); + AtExit(at_exit_cb2, cookie); + AtExit(at_exit_cb1, exports->GetIsolate()); +} + +NODE_MODULE(addon, init); + +} // namespace demo +``` + +Test in JavaScript by running: + +```None +// test.js +const addon = require('./build/Release/addon'); +``` diff --git a/corpus/docs/nodejs/addons/addons_5x.md b/corpus/docs/nodejs/addons/addons_5x.md new file mode 100644 index 0000000000000000000000000000000000000000..e73691f857236c4a14d982d9474c1e8eaf4f8f87 --- /dev/null +++ b/corpus/docs/nodejs/addons/addons_5x.md @@ -0,0 +1,1074 @@ +# Addons# + +Source: https://nodejs.org/docs/latest-v5.x/api/addons.html +Version: 5.x + +Node.js Addons are dynamically-linked shared objects, written in C or C++, that +can be loaded into Node.js using the [`require()`](globals.html#globals_require) function, and used +just as if they were an ordinary Node.js module. They are used primarily to +provide an interface between JavaScript running in Node.js and C/C++ libraries. + +At the moment, the method for implementing Addons is rather complicated, +involving knowledge of several components and APIs : + +* V8: the C++ library Node.js currently uses to provide the + JavaScript implementation. V8 provides the mechanisms for creating objects, + calling functions, etc. V8's API is documented mostly in the + `v8.h` header file (`deps/v8/include/v8.h` in the Node.js source + tree), which is also available [online](https://v8docs.nodesource.com/). +* [libuv](https://github.com/libuv/libuv): The C library that implements the Node.js event loop, its worker + threads and all of the asynchronous behaviors of the platform. It also + serves as a cross-platform abstraction library, giving easy, POSIX-like + access across all major operating systems to many common system tasks, such + as interacting with the filesystem, sockets, timers and system events. libuv + also provides a pthreads-like threading abstraction that may be used to + power more sophisticated asynchronous Addons that need to move beyond the + standard event loop. Addon authors are encouraged to think about how to + avoid blocking the event loop with I/O or other time-intensive tasks by + off-loading work via libuv to non-blocking system operations, worker threads + or a custom use of libuv's threads. +* Internal Node.js libraries. Node.js itself exports a number of C/C++ APIs + that Addons can use — the most important of which is the + `node::ObjectWrap` class. +* Node.js includes a number of other statically linked libraries including + OpenSSL. These other libraries are located in the `deps/` directory in the + Node.js source tree. Only the V8 and OpenSSL symbols are purposefully + re-exported by Node.js and may be used to various extents by Addons. + See [Linking to Node.js' own dependencies](#addons_linking_to_node_js_own_dependencies) for additional information. + +All of the following examples are available for [download](https://github.com/nodejs/node-addon-examples) and may +be used as a starting-point for your own Addon. + +## Hello world[#](#addons_hello_world) + +This "Hello world" example is a simple Addon, written in C++, that is the +equivalent of the following JavaScript code: + +```None +module.exports.hello = () => 'world'; +``` + +First, create the file `hello.cc`: + +```None +// hello.cc +#include + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void Method(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world")); +} + +void init(Local exports) { + NODE_SET_METHOD(exports, "hello", Method); +} + +NODE_MODULE(addon, init) + +} // namespace demo +``` + +Note that all Node.js Addons must export an initialization function following +the pattern: + +```None +void Initialize(Local exports); +NODE_MODULE(module_name, Initialize) +``` + +There is no semi-colon after `NODE_MODULE` as it's not a function (see +`node.h`). + +The `module_name` must match the filename of the final binary (excluding +the .node suffix). + +In the `hello.cc` example, then, the initialization function is `init` and the +Addon module name is `addon`. + +### Building[#](#addons_building) + +Once the source code has been written, it must be compiled into the binary +`addon.node` file. To do so, create a file called `binding.gyp` in the +top-level of the project describing the build configuration of your module +using a JSON-like format. This file is used by [node-gyp](https://github.com/nodejs/node-gyp) -- a tool written +specifically to compile Node.js Addons. + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "hello.cc" ] + } + ] +} +``` + +*Note: A version of the `node-gyp` utility is bundled and distributed with +Node.js as part of `npm`. This version is not made directly available for +developers to use and is intended only to support the ability to use the +`npm install` command to compile and install Addons. Developers who wish to +use `node-gyp` directly can install it using the command +`npm install -g node-gyp`. See the `node-gyp` [installation instructions](https://github.com/nodejs/node-gyp#installation) for +more information, including platform-specific requirements.* + +Once the `binding.gyp` file has been created, use `node-gyp configure` to +generate the appropriate project build files for the current platform. This +will generate either a `Makefile` (on Unix platforms) or a `vcxproj` file +(on Windows) in the `build/` directory. + +Next, invoke the `node-gyp build` command to generate the compiled `addon.node` +file. This will be put into the `build/Release/` directory. + +When using `npm install` to install a Node.js Addon, npm uses its own bundled +version of `node-gyp` to perform this same set of actions, generating a +compiled version of the Addon for the user's platform on demand. + +Once built, the binary Addon can be used from within Node.js by pointing +[`require()`](globals.html#globals_require) to the built `addon.node` module: + +```None +// hello.js +const addon = require('./build/Release/addon'); + +console.log(addon.hello()); // 'world' +``` + +Please see the examples below for further information or + + for an example in production. + +Because the exact path to the compiled Addon binary can vary depending on how +it is compiled (i.e. sometimes it may be in `./build/Debug/`), Addons can use +the [bindings](https://github.com/TooTallNate/node-bindings) package to load the compiled module. + +Note that while the `bindings` package implementation is more sophisticated +in how it locates Addon modules, it is essentially using a try-catch pattern +similar to: + +```None +try { + return require('./build/Release/addon.node'); +} catch (err) { + return require('./build/Debug/addon.node'); +} +``` + +### Linking to Node.js' own dependencies[#](#addons_linking_to_node_js_own_dependencies) + +Node.js uses a number of statically linked libraries such as V8, libuv and +OpenSSL. All Addons are required to link to V8 and may link to any of the +other dependencies as well. Typically, this is as simple as including +the appropriate `#include <...>` statements (e.g. `#include `) and +`node-gyp` will locate the appropriate headers automatically. However, there +are a few caveats to be aware of: + +* When `node-gyp` runs, it will detect the specific release version of Node.js + and download either the full source tarball or just the headers. If the full + source is downloaded, Addons will have complete access to the full set of + Node.js dependencies. However, if only the Node.js headers are downloaded, then + only the symbols exported by Node.js will be available. +* `node-gyp` can be run using the `--nodedir` flag pointing at a local Node.js + source image. Using this option, the Addon will have access to the full set of + dependencies. + +### Loading Addons using require()[#](#addons_loading_addons_using_require) + +The filename extension of the compiled Addon binary is `.node` (as opposed +to `.dll` or `.so`). The [`require()`](globals.html#globals_require) function is written to look for +files with the `.node` file extension and initialize those as dynamically-linked +libraries. + +When calling [`require()`](globals.html#globals_require), the `.node` extension can usually be +omitted and Node.js will still find and initialize the Addon. One caveat, +however, is that Node.js will first attempt to locate and load modules or +JavaScript files that happen to share the same base name. For instance, if +there is a file `addon.js` in the same directory as the binary `addon.node`, +then [`require('addon')`](globals.html#globals_require) will give precedence to the `addon.js` file +and load it instead. + +## Native Abstractions for Node.js[#](#addons_native_abstractions_for_node_js) + +Each of the examples illustrated in this document make direct use of the +Node.js and V8 APIs for implementing Addons. It is important to understand +that the V8 API can, and has, changed dramatically from one V8 release to the +next (and one major Node.js release to the next). With each change, Addons may +need to be updated and recompiled in order to continue functioning. The Node.js +release schedule is designed to minimize the frequency and impact of such +changes but there is little that Node.js can do currently to ensure stability +of the V8 APIs. + +The [Native Abstractions for Node.js](https://github.com/nodejs/nan) (or `nan`) provide a set of tools that +Addon developers are recommended to use to keep compatibility between past and +future releases of V8 and Node.js. See the `nan` [examples](https://github.com/nodejs/nan/tree/master/examples/) for an +illustration of how it can be used. + +## Addon examples[#](#addons_addon_examples) + +Following are some example Addons intended to help developers get started. The +examples make use of the V8 APIs. Refer to the online [V8 reference](https://v8docs.nodesource.com/) +for help with the various V8 calls, and V8's [Embedder's Guide](https://developers.google.com/v8/embed) for an +explanation of several concepts used such as handles, scopes, function +templates, etc. + +Each of these examples using the following `binding.gyp` file: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "addon.cc" ] + } + ] +} +``` + +In cases where there is more than one `.cc` file, simply add the additional +filename to the `sources` array. For example: + +```None +"sources": ["addon.cc", "myexample.cc"] +``` + +Once the `binding.gyp` file is ready, the example Addons can be configured and +built using `node-gyp`: + +```None +$ node-gyp configure build +``` + +### Function arguments[#](#addons_function_arguments) + +Addons will typically expose objects and functions that can be accessed from +JavaScript running within Node.js. When functions are invoked from JavaScript, +the input arguments and return value must be mapped to and from the C/C++ +code. + +The following example illustrates how to read function arguments passed from +JavaScript and how to return a result: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Exception; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::String; +using v8::Value; + +// This is the implementation of the "add" method +// Input arguments are passed using the +// const FunctionCallbackInfo& args struct +void Add(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + // Check the number of arguments passed. + if (args.Length() < 2) { + // Throw an Error that is passed back to JavaScript + isolate->ThrowException(Exception::TypeError( + String::NewFromUtf8(isolate, "Wrong number of arguments"))); + return; + } + + // Check the argument types + if (!args[0]->IsNumber() || !args[1]->IsNumber()) { + isolate->ThrowException(Exception::TypeError( + String::NewFromUtf8(isolate, "Wrong arguments"))); + return; + } + + // Perform the operation + double value = args[0]->NumberValue() + args[1]->NumberValue(); + Local num = Number::New(isolate, value); + + // Set the return value (using the passed in + // FunctionCallbackInfo&) + args.GetReturnValue().Set(num); +} + +void Init(Local exports) { + NODE_SET_METHOD(exports, "add", Add); +} + +NODE_MODULE(addon, Init) + +} // namespace demo +``` + +Once compiled, the example Addon can be required and used from within Node.js: + +```None +// test.js +const addon = require('./build/Release/addon'); + +console.log('This should be eight:', addon.add(3, 5)); +``` + +### Callbacks[#](#addons_callbacks) + +It is common practice within Addons to pass JavaScript functions to a C++ +function and execute them from there. The following example illustrates how +to invoke such callbacks: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Null; +using v8::Object; +using v8::String; +using v8::Value; + +void RunCallback(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local cb = Local::Cast(args[0]); + const unsigned argc = 1; + Local argv[argc] = { String::NewFromUtf8(isolate, "hello world") }; + cb->Call(Null(isolate), argc, argv); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", RunCallback); +} + +NODE_MODULE(addon, Init) + +} // namespace demo +``` + +Note that this example uses a two-argument form of `Init()` that receives +the full `module` object as the second argument. This allows the Addon +to completely overwrite `exports` with a single function instead of +adding the function as a property of `exports`. + +To test it, run the following JavaScript: + +```None +// test.js +const addon = require('./build/Release/addon'); + +addon((msg) => { + console.log(msg); // 'hello world' +}); +``` + +Note that, in this example, the callback function is invoked synchronously. + +### Object factory[#](#addons_object_factory) + +Addons can create and return new objects from within a C++ function as +illustrated in the following example. An object is created and returned with a +property `msg` that echoes the string passed to `createObject()`: + +```None +// addon.cc +#include + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + Local obj = Object::New(isolate); + obj->Set(String::NewFromUtf8(isolate, "msg"), args[0]->ToString()); + + args.GetReturnValue().Set(obj); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", CreateObject); +} + +NODE_MODULE(addon, Init) + +} // namespace demo +``` + +To test it in JavaScript: + +```None +// test.js +const addon = require('./build/Release/addon'); + +var obj1 = addon('hello'); +var obj2 = addon('world'); +console.log(obj1.msg + ' ' + obj2.msg); // 'hello world' +``` + +### Function factory[#](#addons_function_factory) + +Another common scenario is creating JavaScript functions that wrap C++ +functions and returning those back to JavaScript: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void MyFunction(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, "hello world")); +} + +void CreateFunction(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + Local tpl = FunctionTemplate::New(isolate, MyFunction); + Local fn = tpl->GetFunction(); + + // omit this to make it anonymous + fn->SetName(String::NewFromUtf8(isolate, "theFunction")); + + args.GetReturnValue().Set(fn); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", CreateFunction); +} + +NODE_MODULE(addon, Init) + +} // namespace demo +``` + +To test: + +```None +// test.js +const addon = require('./build/Release/addon'); + +var fn = addon(); +console.log(fn()); // 'hello world' +``` + +### Wrapping C++ objects[#](#addons_wrapping_c_objects) + +It is also possible to wrap C++ objects/classes in a way that allows new +instances to be created using the JavaScript `new` operator: + +```None +// addon.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Local; +using v8::Object; + +void InitAll(Local exports) { + MyObject::Init(exports); +} + +NODE_MODULE(addon, InitAll) + +} // namespace demo +``` + +Then, in `myobject.h`, the wrapper class inherits from `node::ObjectWrap`: + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Local exports); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static void PlusOne(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +In `myobject.cc`, implement the various methods that are to be exposed. +Below, the method `plusOne()` is exposed by adding it to the constructor's +prototype: + +```None +// myobject.cc +#include "myobject.h" + +namespace demo { + +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Local exports) { + Isolate* isolate = exports->GetIsolate(); + + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); + + constructor.Reset(isolate, tpl->GetFunction()); + exports->Set(String::NewFromUtf8(isolate, "MyObject"), + tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + args.GetReturnValue().Set(cons->NewInstance(argc, argv)); + } +} + +void MyObject::PlusOne(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + obj->value_ += 1; + + args.GetReturnValue().Set(Number::New(isolate, obj->value_)); +} + +} // namespace demo +``` + +To build this example, the `myobject.cc` file must be added to the +`binding.gyp`: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ + "addon.cc", + "myobject.cc" + ] + } + ] +} +``` + +Test it with: + +```None +// test.js +const addon = require('./build/Release/addon'); + +var obj = new addon.MyObject(10); +console.log(obj.plusOne()); // 11 +console.log(obj.plusOne()); // 12 +console.log(obj.plusOne()); // 13 +``` + +### Factory of wrapped objects[#](#addons_factory_of_wrapped_objects) + +Alternatively, it is possible to use a factory pattern to avoid explicitly +creating object instances using the JavaScript `new` operator: + +```None +var obj = addon.createObject(); +// instead of: +// var obj = new addon.Object(); +``` + +First, the `createObject()` method is implemented in `addon.cc`: + +```None +// addon.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + MyObject::NewInstance(args); +} + +void InitAll(Local exports, Local module) { + MyObject::Init(exports->GetIsolate()); + + NODE_SET_METHOD(module, "exports", CreateObject); +} + +NODE_MODULE(addon, InitAll) + +} // namespace demo +``` + +In `myobject.h`, the static method `NewInstance()` is added to handle +instantiating the object. This method takes the place of using `new` in +JavaScript: + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Isolate* isolate); + static void NewInstance(const v8::FunctionCallbackInfo& args); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static void PlusOne(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +The implementation in `myobject.cc` is similar to the previous example: + +```None +// myobject.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Isolate* isolate) { + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); + + constructor.Reset(isolate, tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + args.GetReturnValue().Set(cons->NewInstance(argc, argv)); + } +} + +void MyObject::NewInstance(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + const unsigned argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local instance = cons->NewInstance(argc, argv); + + args.GetReturnValue().Set(instance); +} + +void MyObject::PlusOne(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + obj->value_ += 1; + + args.GetReturnValue().Set(Number::New(isolate, obj->value_)); +} + +} // namespace demo +``` + +Once again, to build this example, the `myobject.cc` file must be added to the +`binding.gyp`: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ + "addon.cc", + "myobject.cc" + ] + } + ] +} +``` + +Test it with: + +```None +// test.js +const createObject = require('./build/Release/addon'); + +var obj = createObject(10); +console.log(obj.plusOne()); // 11 +console.log(obj.plusOne()); // 12 +console.log(obj.plusOne()); // 13 + +var obj2 = createObject(20); +console.log(obj2.plusOne()); // 21 +console.log(obj2.plusOne()); // 22 +console.log(obj2.plusOne()); // 23 +``` + +### Passing wrapped objects around[#](#addons_passing_wrapped_objects_around) + +In addition to wrapping and returning C++ objects, it is possible to pass +wrapped objects around by unwrapping them with the Node.js helper function +`node::ObjectWrap::Unwrap`. The following examples shows a function `add()` +that can take two `MyObject` objects as input arguments: + +```None +// addon.cc +#include +#include +#include "myobject.h" + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + MyObject::NewInstance(args); +} + +void Add(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj1 = node::ObjectWrap::Unwrap( + args[0]->ToObject()); + MyObject* obj2 = node::ObjectWrap::Unwrap( + args[1]->ToObject()); + + double sum = obj1->value() + obj2->value(); + args.GetReturnValue().Set(Number::New(isolate, sum)); +} + +void InitAll(Local exports) { + MyObject::Init(exports->GetIsolate()); + + NODE_SET_METHOD(exports, "createObject", CreateObject); + NODE_SET_METHOD(exports, "add", Add); +} + +NODE_MODULE(addon, InitAll) + +} // namespace demo +``` + +In `myobject.h`, a new public method is added to allow access to private values +after unwrapping the object. + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Isolate* isolate); + static void NewInstance(const v8::FunctionCallbackInfo& args); + inline double value() const { return value_; } + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +The implementation of `myobject.cc` is similar to before: + +```None +// myobject.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Isolate* isolate) { + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + constructor.Reset(isolate, tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + args.GetReturnValue().Set(cons->NewInstance(argc, argv)); + } +} + +void MyObject::NewInstance(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + const unsigned argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local instance = cons->NewInstance(argc, argv); + + args.GetReturnValue().Set(instance); +} + +} // namespace demo +``` + +Test it with: + +```None +// test.js +const addon = require('./build/Release/addon'); + +var obj1 = addon.createObject(10); +var obj2 = addon.createObject(20); +var result = addon.add(obj1, obj2); + +console.log(result); // 30 +``` + +### AtExit hooks[#](#addons_atexit_hooks) + +An "AtExit" hook is a function that is invoked after the Node.js event loop +has ended by before the JavaScript VM is terminated and Node.js shuts down. +"AtExit" hooks are registered using the `node::AtExit` API. + +#### void AtExit(callback, args)[#](#addons_void_atexit_callback_args) + +* `callback`: `void (*)(void*)` - A pointer to the function to call at exit. +* `args`: `void*` - A pointer to pass to the callback at exit. + +Registers exit hooks that run after the event loop has ended but before the VM +is killed. + +AtExit takes two parameters: a pointer to a callback function to run at exit, +and a pointer to untyped context data to be passed to that callback. + +Callbacks are run in last-in first-out order. + +The following `addon.cc` implements AtExit: + +```None +// addon.cc +#undef NDEBUG +#include +#include +#include + +namespace demo { + +using node::AtExit; +using v8::HandleScope; +using v8::Isolate; +using v8::Local; +using v8::Object; + +static char cookie[] = "yum yum"; +static int at_exit_cb1_called = 0; +static int at_exit_cb2_called = 0; + +static void at_exit_cb1(void* arg) { + Isolate* isolate = static_cast(arg); + HandleScope scope(isolate); + Local obj = Object::New(isolate); + assert(!obj.IsEmpty()); // assert VM is still alive + assert(obj->IsObject()); + at_exit_cb1_called++; +} + +static void at_exit_cb2(void* arg) { + assert(arg == static_cast(cookie)); + at_exit_cb2_called++; +} + +static void sanity_check(void*) { + assert(at_exit_cb1_called == 1); + assert(at_exit_cb2_called == 2); +} + +void init(Local exports) { + AtExit(sanity_check); + AtExit(at_exit_cb2, cookie); + AtExit(at_exit_cb2, cookie); + AtExit(at_exit_cb1, exports->GetIsolate()); +} + +NODE_MODULE(addon, init); + +} // namespace demo +``` + +Test in JavaScript by running: + +```None +// test.js +const addon = require('./build/Release/addon'); +``` diff --git a/corpus/docs/nodejs/addons/addons_6x.md b/corpus/docs/nodejs/addons/addons_6x.md new file mode 100644 index 0000000000000000000000000000000000000000..11b7cddf68e6b0cfa3b4a4680df37aae5098f119 --- /dev/null +++ b/corpus/docs/nodejs/addons/addons_6x.md @@ -0,0 +1,1121 @@ +# C++ Addons# + +Source: https://nodejs.org/docs/latest-v6.x/api/addons.html +Version: 6.x + +Node.js Addons are dynamically-linked shared objects, written in C++, that +can be loaded into Node.js using the [`require()`](globals.html#globals_require) function, and used +just as if they were an ordinary Node.js module. They are used primarily to +provide an interface between JavaScript running in Node.js and C/C++ libraries. + +At the moment, the method for implementing Addons is rather complicated, +involving knowledge of several components and APIs : + +* V8: the C++ library Node.js currently uses to provide the + JavaScript implementation. V8 provides the mechanisms for creating objects, + calling functions, etc. V8's API is documented mostly in the + `v8.h` header file (`deps/v8/include/v8.h` in the Node.js source + tree), which is also available [online](https://v8docs.nodesource.com/). +* [libuv](https://github.com/libuv/libuv): The C library that implements the Node.js event loop, its worker + threads and all of the asynchronous behaviors of the platform. It also + serves as a cross-platform abstraction library, giving easy, POSIX-like + access across all major operating systems to many common system tasks, such + as interacting with the filesystem, sockets, timers and system events. libuv + also provides a pthreads-like threading abstraction that may be used to + power more sophisticated asynchronous Addons that need to move beyond the + standard event loop. Addon authors are encouraged to think about how to + avoid blocking the event loop with I/O or other time-intensive tasks by + off-loading work via libuv to non-blocking system operations, worker threads + or a custom use of libuv's threads. +* Internal Node.js libraries. Node.js itself exports a number of C++ APIs + that Addons can use — the most important of which is the + `node::ObjectWrap` class. +* Node.js includes a number of other statically linked libraries including + OpenSSL. These other libraries are located in the `deps/` directory in the + Node.js source tree. Only the V8 and OpenSSL symbols are purposefully + re-exported by Node.js and may be used to various extents by Addons. + See [Linking to Node.js' own dependencies](#addons_linking_to_node_js_own_dependencies) for additional information. + +All of the following examples are available for [download](https://github.com/nodejs/node-addon-examples) and may +be used as a starting-point for your own Addon. + +## Hello world[#](#addons_hello_world) + +This "Hello world" example is a simple Addon, written in C++, that is the +equivalent of the following JavaScript code: + +```None +module.exports.hello = () => 'world'; +``` + +First, create the file `hello.cc`: + +```None +// hello.cc +#include + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void Method(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world")); +} + +void init(Local exports) { + NODE_SET_METHOD(exports, "hello", Method); +} + +NODE_MODULE(addon, init) + +} // namespace demo +``` + +Note that all Node.js Addons must export an initialization function following +the pattern: + +```None +void Initialize(Local exports); +NODE_MODULE(module_name, Initialize) +``` + +There is no semi-colon after `NODE_MODULE` as it's not a function (see +`node.h`). + +The `module_name` must match the filename of the final binary (excluding +the .node suffix). + +In the `hello.cc` example, then, the initialization function is `init` and the +Addon module name is `addon`. + +### Building[#](#addons_building) + +Once the source code has been written, it must be compiled into the binary +`addon.node` file. To do so, create a file called `binding.gyp` in the +top-level of the project describing the build configuration of your module +using a JSON-like format. This file is used by [node-gyp](https://github.com/nodejs/node-gyp) — a tool written +specifically to compile Node.js Addons. + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "hello.cc" ] + } + ] +} +``` + +*Note: A version of the `node-gyp` utility is bundled and distributed with +Node.js as part of `npm`. This version is not made directly available for +developers to use and is intended only to support the ability to use the +`npm install` command to compile and install Addons. Developers who wish to +use `node-gyp` directly can install it using the command +`npm install -g node-gyp`. See the `node-gyp` [installation instructions](https://github.com/nodejs/node-gyp#installation) for +more information, including platform-specific requirements.* + +Once the `binding.gyp` file has been created, use `node-gyp configure` to +generate the appropriate project build files for the current platform. This +will generate either a `Makefile` (on Unix platforms) or a `vcxproj` file +(on Windows) in the `build/` directory. + +Next, invoke the `node-gyp build` command to generate the compiled `addon.node` +file. This will be put into the `build/Release/` directory. + +When using `npm install` to install a Node.js Addon, npm uses its own bundled +version of `node-gyp` to perform this same set of actions, generating a +compiled version of the Addon for the user's platform on demand. + +Once built, the binary Addon can be used from within Node.js by pointing +[`require()`](globals.html#globals_require) to the built `addon.node` module: + +```None +// hello.js +const addon = require('./build/Release/addon'); + +console.log(addon.hello()); +// Prints: 'world' +``` + +Please see the examples below for further information or + for an example in production. + +Because the exact path to the compiled Addon binary can vary depending on how +it is compiled (i.e. sometimes it may be in `./build/Debug/`), Addons can use +the [bindings](https://github.com/TooTallNate/node-bindings) package to load the compiled module. + +Note that while the `bindings` package implementation is more sophisticated +in how it locates Addon modules, it is essentially using a try-catch pattern +similar to: + +```None +try { + return require('./build/Release/addon.node'); +} catch (err) { + return require('./build/Debug/addon.node'); +} +``` + +### Linking to Node.js' own dependencies[#](#addons_linking_to_node_js_own_dependencies) + +Node.js uses a number of statically linked libraries such as V8, libuv and +OpenSSL. All Addons are required to link to V8 and may link to any of the +other dependencies as well. Typically, this is as simple as including +the appropriate `#include <...>` statements (e.g. `#include `) and +`node-gyp` will locate the appropriate headers automatically. However, there +are a few caveats to be aware of: + +* When `node-gyp` runs, it will detect the specific release version of Node.js + and download either the full source tarball or just the headers. If the full + source is downloaded, Addons will have complete access to the full set of + Node.js dependencies. However, if only the Node.js headers are downloaded, then + only the symbols exported by Node.js will be available. +* `node-gyp` can be run using the `--nodedir` flag pointing at a local Node.js + source image. Using this option, the Addon will have access to the full set of + dependencies. + +### Loading Addons using require()[#](#addons_loading_addons_using_require) + +The filename extension of the compiled Addon binary is `.node` (as opposed +to `.dll` or `.so`). The [`require()`](globals.html#globals_require) function is written to look for +files with the `.node` file extension and initialize those as dynamically-linked +libraries. + +When calling [`require()`](globals.html#globals_require), the `.node` extension can usually be +omitted and Node.js will still find and initialize the Addon. One caveat, +however, is that Node.js will first attempt to locate and load modules or +JavaScript files that happen to share the same base name. For instance, if +there is a file `addon.js` in the same directory as the binary `addon.node`, +then [`require('addon')`](globals.html#globals_require) will give precedence to the `addon.js` file +and load it instead. + +## Native Abstractions for Node.js[#](#addons_native_abstractions_for_node_js) + +Each of the examples illustrated in this document make direct use of the +Node.js and V8 APIs for implementing Addons. It is important to understand +that the V8 API can, and has, changed dramatically from one V8 release to the +next (and one major Node.js release to the next). With each change, Addons may +need to be updated and recompiled in order to continue functioning. The Node.js +release schedule is designed to minimize the frequency and impact of such +changes but there is little that Node.js can do currently to ensure stability +of the V8 APIs. + +The [Native Abstractions for Node.js](https://github.com/nodejs/nan) (or `nan`) provide a set of tools that +Addon developers are recommended to use to keep compatibility between past and +future releases of V8 and Node.js. See the `nan` [examples](https://github.com/nodejs/nan/tree/master/examples/) for an +illustration of how it can be used. + +## N-API[#](#addons_n_api) + +[Stability: 1](documentation.html#documentation_stability_index) - Experimental + +N-API is an API for building native Addons. It is independent from +the underlying JavaScript runtime (ex V8) and is maintained as part of +Node.js itself. This API will be Application Binary Interface (ABI) stable +across version of Node.js. It is intended to insulate Addons from +changes in the underlying JavaScript engine and allow modules +compiled for one version to run on later versions of Node.js without +recompilation. Addons are built/packaged with the same approach/tools +outlined in this document (node-gyp, etc.). The only difference is the +set of APIs that are used by the native code. Instead of using the V8 +or [Native Abstractions for Node.js](https://github.com/nodejs/nan) APIs, the functions available +in the N-API are used. + +The functions available and how to use them are documented in the +section titled [C/C++ Addons - N-API](n-api.html). + +## Addon examples[#](#addons_addon_examples) + +Following are some example Addons intended to help developers get started. The +examples make use of the V8 APIs. Refer to the online [V8 reference](https://v8docs.nodesource.com/) +for help with the various V8 calls, and V8's [Embedder's Guide](https://github.com/v8/v8/wiki/Embedder's%20Guide) for an +explanation of several concepts used such as handles, scopes, function +templates, etc. + +Each of these examples using the following `binding.gyp` file: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "addon.cc" ] + } + ] +} +``` + +In cases where there is more than one `.cc` file, simply add the additional +filename to the `sources` array. For example: + +```None +"sources": ["addon.cc", "myexample.cc"] +``` + +Once the `binding.gyp` file is ready, the example Addons can be configured and +built using `node-gyp`: + +```None +$ node-gyp configure build +``` + +### Function arguments[#](#addons_function_arguments) + +Addons will typically expose objects and functions that can be accessed from +JavaScript running within Node.js. When functions are invoked from JavaScript, +the input arguments and return value must be mapped to and from the C/C++ +code. + +The following example illustrates how to read function arguments passed from +JavaScript and how to return a result: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Exception; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::String; +using v8::Value; + +// This is the implementation of the "add" method +// Input arguments are passed using the +// const FunctionCallbackInfo& args struct +void Add(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + // Check the number of arguments passed. + if (args.Length() < 2) { + // Throw an Error that is passed back to JavaScript + isolate->ThrowException(Exception::TypeError( + String::NewFromUtf8(isolate, "Wrong number of arguments"))); + return; + } + + // Check the argument types + if (!args[0]->IsNumber() || !args[1]->IsNumber()) { + isolate->ThrowException(Exception::TypeError( + String::NewFromUtf8(isolate, "Wrong arguments"))); + return; + } + + // Perform the operation + double value = args[0]->NumberValue() + args[1]->NumberValue(); + Local num = Number::New(isolate, value); + + // Set the return value (using the passed in + // FunctionCallbackInfo&) + args.GetReturnValue().Set(num); +} + +void Init(Local exports) { + NODE_SET_METHOD(exports, "add", Add); +} + +NODE_MODULE(addon, Init) + +} // namespace demo +``` + +Once compiled, the example Addon can be required and used from within Node.js: + +```None +// test.js +const addon = require('./build/Release/addon'); + +console.log('This should be eight:', addon.add(3, 5)); +``` + +### Callbacks[#](#addons_callbacks) + +It is common practice within Addons to pass JavaScript functions to a C++ +function and execute them from there. The following example illustrates how +to invoke such callbacks: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Null; +using v8::Object; +using v8::String; +using v8::Value; + +void RunCallback(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local cb = Local::Cast(args[0]); + const unsigned argc = 1; + Local argv[argc] = { String::NewFromUtf8(isolate, "hello world") }; + cb->Call(Null(isolate), argc, argv); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", RunCallback); +} + +NODE_MODULE(addon, Init) + +} // namespace demo +``` + +Note that this example uses a two-argument form of `Init()` that receives +the full `module` object as the second argument. This allows the Addon +to completely overwrite `exports` with a single function instead of +adding the function as a property of `exports`. + +To test it, run the following JavaScript: + +```None +// test.js +const addon = require('./build/Release/addon'); + +addon((msg) => { + console.log(msg); +// Prints: 'hello world' +}); +``` + +Note that, in this example, the callback function is invoked synchronously. + +### Object factory[#](#addons_object_factory) + +Addons can create and return new objects from within a C++ function as +illustrated in the following example. An object is created and returned with a +property `msg` that echoes the string passed to `createObject()`: + +```None +// addon.cc +#include + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + Local obj = Object::New(isolate); + obj->Set(String::NewFromUtf8(isolate, "msg"), args[0]->ToString()); + + args.GetReturnValue().Set(obj); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", CreateObject); +} + +NODE_MODULE(addon, Init) + +} // namespace demo +``` + +To test it in JavaScript: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const obj1 = addon('hello'); +const obj2 = addon('world'); +console.log(obj1.msg, obj2.msg); +// Prints: 'hello world' +``` + +### Function factory[#](#addons_function_factory) + +Another common scenario is creating JavaScript functions that wrap C++ +functions and returning those back to JavaScript: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void MyFunction(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, "hello world")); +} + +void CreateFunction(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + Local tpl = FunctionTemplate::New(isolate, MyFunction); + Local fn = tpl->GetFunction(); + + // omit this to make it anonymous + fn->SetName(String::NewFromUtf8(isolate, "theFunction")); + + args.GetReturnValue().Set(fn); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", CreateFunction); +} + +NODE_MODULE(addon, Init) + +} // namespace demo +``` + +To test: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const fn = addon(); +console.log(fn()); +// Prints: 'hello world' +``` + +### Wrapping C++ objects[#](#addons_wrapping_c_objects) + +It is also possible to wrap C++ objects/classes in a way that allows new +instances to be created using the JavaScript `new` operator: + +```None +// addon.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Local; +using v8::Object; + +void InitAll(Local exports) { + MyObject::Init(exports); +} + +NODE_MODULE(addon, InitAll) + +} // namespace demo +``` + +Then, in `myobject.h`, the wrapper class inherits from `node::ObjectWrap`: + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Local exports); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static void PlusOne(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +In `myobject.cc`, implement the various methods that are to be exposed. +Below, the method `plusOne()` is exposed by adding it to the constructor's +prototype: + +```None +// myobject.cc +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Local exports) { + Isolate* isolate = exports->GetIsolate(); + + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); + + constructor.Reset(isolate, tpl->GetFunction()); + exports->Set(String::NewFromUtf8(isolate, "MyObject"), + tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local context = isolate->GetCurrentContext(); + Local cons = Local::New(isolate, constructor); + Local result = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(result); + } +} + +void MyObject::PlusOne(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + obj->value_ += 1; + + args.GetReturnValue().Set(Number::New(isolate, obj->value_)); +} + +} // namespace demo +``` + +To build this example, the `myobject.cc` file must be added to the +`binding.gyp`: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ + "addon.cc", + "myobject.cc" + ] + } + ] +} +``` + +Test it with: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const obj = new addon.MyObject(10); +console.log(obj.plusOne()); +// Prints: 11 +console.log(obj.plusOne()); +// Prints: 12 +console.log(obj.plusOne()); +// Prints: 13 +``` + +### Factory of wrapped objects[#](#addons_factory_of_wrapped_objects) + +Alternatively, it is possible to use a factory pattern to avoid explicitly +creating object instances using the JavaScript `new` operator: + +```None +const obj = addon.createObject(); +// instead of: +// const obj = new addon.Object(); +``` + +First, the `createObject()` method is implemented in `addon.cc`: + +```None +// addon.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + MyObject::NewInstance(args); +} + +void InitAll(Local exports, Local module) { + MyObject::Init(exports->GetIsolate()); + + NODE_SET_METHOD(module, "exports", CreateObject); +} + +NODE_MODULE(addon, InitAll) + +} // namespace demo +``` + +In `myobject.h`, the static method `NewInstance()` is added to handle +instantiating the object. This method takes the place of using `new` in +JavaScript: + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Isolate* isolate); + static void NewInstance(const v8::FunctionCallbackInfo& args); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static void PlusOne(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +The implementation in `myobject.cc` is similar to the previous example: + +```None +// myobject.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Isolate* isolate) { + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); + + constructor.Reset(isolate, tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local context = isolate->GetCurrentContext(); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(instance); + } +} + +void MyObject::NewInstance(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + const unsigned argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local context = isolate->GetCurrentContext(); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + + args.GetReturnValue().Set(instance); +} + +void MyObject::PlusOne(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + obj->value_ += 1; + + args.GetReturnValue().Set(Number::New(isolate, obj->value_)); +} + +} // namespace demo +``` + +Once again, to build this example, the `myobject.cc` file must be added to the +`binding.gyp`: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ + "addon.cc", + "myobject.cc" + ] + } + ] +} +``` + +Test it with: + +```None +// test.js +const createObject = require('./build/Release/addon'); + +const obj = createObject(10); +console.log(obj.plusOne()); +// Prints: 11 +console.log(obj.plusOne()); +// Prints: 12 +console.log(obj.plusOne()); +// Prints: 13 + +const obj2 = createObject(20); +console.log(obj2.plusOne()); +// Prints: 21 +console.log(obj2.plusOne()); +// Prints: 22 +console.log(obj2.plusOne()); +// Prints: 23 +``` + +### Passing wrapped objects around[#](#addons_passing_wrapped_objects_around) + +In addition to wrapping and returning C++ objects, it is possible to pass +wrapped objects around by unwrapping them with the Node.js helper function +`node::ObjectWrap::Unwrap`. The following examples shows a function `add()` +that can take two `MyObject` objects as input arguments: + +```None +// addon.cc +#include +#include +#include "myobject.h" + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + MyObject::NewInstance(args); +} + +void Add(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj1 = node::ObjectWrap::Unwrap( + args[0]->ToObject()); + MyObject* obj2 = node::ObjectWrap::Unwrap( + args[1]->ToObject()); + + double sum = obj1->value() + obj2->value(); + args.GetReturnValue().Set(Number::New(isolate, sum)); +} + +void InitAll(Local exports) { + MyObject::Init(exports->GetIsolate()); + + NODE_SET_METHOD(exports, "createObject", CreateObject); + NODE_SET_METHOD(exports, "add", Add); +} + +NODE_MODULE(addon, InitAll) + +} // namespace demo +``` + +In `myobject.h`, a new public method is added to allow access to private values +after unwrapping the object. + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Isolate* isolate); + static void NewInstance(const v8::FunctionCallbackInfo& args); + inline double value() const { return value_; } + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +The implementation of `myobject.cc` is similar to before: + +```None +// myobject.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Isolate* isolate) { + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + constructor.Reset(isolate, tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local context = isolate->GetCurrentContext(); + Local cons = Local::New(isolate, constructor); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(instance); + } +} + +void MyObject::NewInstance(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + const unsigned argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local context = isolate->GetCurrentContext(); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + + args.GetReturnValue().Set(instance); +} + +} // namespace demo +``` + +Test it with: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const obj1 = addon.createObject(10); +const obj2 = addon.createObject(20); +const result = addon.add(obj1, obj2); + +console.log(result); +// Prints: 30 +``` + +### AtExit hooks[#](#addons_atexit_hooks) + +An "AtExit" hook is a function that is invoked after the Node.js event loop +has ended but before the JavaScript VM is terminated and Node.js shuts down. +"AtExit" hooks are registered using the `node::AtExit` API. + +#### void AtExit(callback, args)[#](#addons_void_atexit_callback_args) + +* `callback` A pointer to the function to call at exit. +* `args` A pointer to pass to the callback at exit. + +Registers exit hooks that run after the event loop has ended but before the VM +is killed. + +AtExit takes two parameters: a pointer to a callback function to run at exit, +and a pointer to untyped context data to be passed to that callback. + +Callbacks are run in last-in first-out order. + +The following `addon.cc` implements AtExit: + +```None +// addon.cc +#include +#include +#include + +namespace demo { + +using node::AtExit; +using v8::HandleScope; +using v8::Isolate; +using v8::Local; +using v8::Object; + +static char cookie[] = "yum yum"; +static int at_exit_cb1_called = 0; +static int at_exit_cb2_called = 0; + +static void at_exit_cb1(void* arg) { + Isolate* isolate = static_cast(arg); + HandleScope scope(isolate); + Local obj = Object::New(isolate); + assert(!obj.IsEmpty()); // assert VM is still alive + assert(obj->IsObject()); + at_exit_cb1_called++; +} + +static void at_exit_cb2(void* arg) { + assert(arg == static_cast(cookie)); + at_exit_cb2_called++; +} + +static void sanity_check(void*) { + assert(at_exit_cb1_called == 1); + assert(at_exit_cb2_called == 2); +} + +void init(Local exports) { + AtExit(at_exit_cb2, cookie); + AtExit(at_exit_cb2, cookie); + AtExit(at_exit_cb1, exports->GetIsolate()); + AtExit(sanity_check); +} + +NODE_MODULE(addon, init) + +} // namespace demo +``` + +Test in JavaScript by running: + +```None +// test.js +require('./build/Release/addon'); +``` diff --git a/corpus/docs/nodejs/addons/addons_7x.md b/corpus/docs/nodejs/addons/addons_7x.md new file mode 100644 index 0000000000000000000000000000000000000000..3ebfa27a270e1cb2de0a6d95009b6e4381410695 --- /dev/null +++ b/corpus/docs/nodejs/addons/addons_7x.md @@ -0,0 +1,1103 @@ +# C/C++ Addons# + +Source: https://nodejs.org/docs/latest-v7.x/api/addons.html +Version: 7.x + +Node.js Addons are dynamically-linked shared objects, written in C or C++, that +can be loaded into Node.js using the [`require()`](globals.html#globals_require) function, and used +just as if they were an ordinary Node.js module. They are used primarily to +provide an interface between JavaScript running in Node.js and C/C++ libraries. + +At the moment, the method for implementing Addons is rather complicated, +involving knowledge of several components and APIs : + +* V8: the C++ library Node.js currently uses to provide the + JavaScript implementation. V8 provides the mechanisms for creating objects, + calling functions, etc. V8's API is documented mostly in the + `v8.h` header file (`deps/v8/include/v8.h` in the Node.js source + tree), which is also available [online](https://v8docs.nodesource.com/). +* [libuv](https://github.com/libuv/libuv): The C library that implements the Node.js event loop, its worker + threads and all of the asynchronous behaviors of the platform. It also + serves as a cross-platform abstraction library, giving easy, POSIX-like + access across all major operating systems to many common system tasks, such + as interacting with the filesystem, sockets, timers and system events. libuv + also provides a pthreads-like threading abstraction that may be used to + power more sophisticated asynchronous Addons that need to move beyond the + standard event loop. Addon authors are encouraged to think about how to + avoid blocking the event loop with I/O or other time-intensive tasks by + off-loading work via libuv to non-blocking system operations, worker threads + or a custom use of libuv's threads. +* Internal Node.js libraries. Node.js itself exports a number of C/C++ APIs + that Addons can use — the most important of which is the + `node::ObjectWrap` class. +* Node.js includes a number of other statically linked libraries including + OpenSSL. These other libraries are located in the `deps/` directory in the + Node.js source tree. Only the V8 and OpenSSL symbols are purposefully + re-exported by Node.js and may be used to various extents by Addons. + See [Linking to Node.js' own dependencies](#addons_linking_to_node_js_own_dependencies) for additional information. + +All of the following examples are available for [download](https://github.com/nodejs/node-addon-examples) and may +be used as a starting-point for your own Addon. + +## Hello world[#](#addons_hello_world) + +This "Hello world" example is a simple Addon, written in C++, that is the +equivalent of the following JavaScript code: + +```None +module.exports.hello = () => 'world'; +``` + +First, create the file `hello.cc`: + +```None +// hello.cc +#include + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void Method(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world")); +} + +void init(Local exports) { + NODE_SET_METHOD(exports, "hello", Method); +} + +NODE_MODULE(addon, init) + +} // namespace demo +``` + +Note that all Node.js Addons must export an initialization function following +the pattern: + +```None +void Initialize(Local exports); +NODE_MODULE(module_name, Initialize) +``` + +There is no semi-colon after `NODE_MODULE` as it's not a function (see +`node.h`). + +The `module_name` must match the filename of the final binary (excluding +the .node suffix). + +In the `hello.cc` example, then, the initialization function is `init` and the +Addon module name is `addon`. + +### Building[#](#addons_building) + +Once the source code has been written, it must be compiled into the binary +`addon.node` file. To do so, create a file called `binding.gyp` in the +top-level of the project describing the build configuration of your module +using a JSON-like format. This file is used by [node-gyp](https://github.com/nodejs/node-gyp) -- a tool written +specifically to compile Node.js Addons. + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "hello.cc" ] + } + ] +} +``` + +*Note: A version of the `node-gyp` utility is bundled and distributed with +Node.js as part of `npm`. This version is not made directly available for +developers to use and is intended only to support the ability to use the +`npm install` command to compile and install Addons. Developers who wish to +use `node-gyp` directly can install it using the command +`npm install -g node-gyp`. See the `node-gyp` [installation instructions](https://github.com/nodejs/node-gyp#installation) for +more information, including platform-specific requirements.* + +Once the `binding.gyp` file has been created, use `node-gyp configure` to +generate the appropriate project build files for the current platform. This +will generate either a `Makefile` (on Unix platforms) or a `vcxproj` file +(on Windows) in the `build/` directory. + +Next, invoke the `node-gyp build` command to generate the compiled `addon.node` +file. This will be put into the `build/Release/` directory. + +When using `npm install` to install a Node.js Addon, npm uses its own bundled +version of `node-gyp` to perform this same set of actions, generating a +compiled version of the Addon for the user's platform on demand. + +Once built, the binary Addon can be used from within Node.js by pointing +[`require()`](globals.html#globals_require) to the built `addon.node` module: + +```None +// hello.js +const addon = require('./build/Release/addon'); + +console.log(addon.hello()); +// Prints: 'world' +``` + +Please see the examples below for further information or + for an example in production. + +Because the exact path to the compiled Addon binary can vary depending on how +it is compiled (i.e. sometimes it may be in `./build/Debug/`), Addons can use +the [bindings](https://github.com/TooTallNate/node-bindings) package to load the compiled module. + +Note that while the `bindings` package implementation is more sophisticated +in how it locates Addon modules, it is essentially using a try-catch pattern +similar to: + +```None +try { + return require('./build/Release/addon.node'); +} catch (err) { + return require('./build/Debug/addon.node'); +} +``` + +### Linking to Node.js' own dependencies[#](#addons_linking_to_node_js_own_dependencies) + +Node.js uses a number of statically linked libraries such as V8, libuv and +OpenSSL. All Addons are required to link to V8 and may link to any of the +other dependencies as well. Typically, this is as simple as including +the appropriate `#include <...>` statements (e.g. `#include `) and +`node-gyp` will locate the appropriate headers automatically. However, there +are a few caveats to be aware of: + +* When `node-gyp` runs, it will detect the specific release version of Node.js + and download either the full source tarball or just the headers. If the full + source is downloaded, Addons will have complete access to the full set of + Node.js dependencies. However, if only the Node.js headers are downloaded, then + only the symbols exported by Node.js will be available. +* `node-gyp` can be run using the `--nodedir` flag pointing at a local Node.js + source image. Using this option, the Addon will have access to the full set of + dependencies. + +### Loading Addons using require()[#](#addons_loading_addons_using_require) + +The filename extension of the compiled Addon binary is `.node` (as opposed +to `.dll` or `.so`). The [`require()`](globals.html#globals_require) function is written to look for +files with the `.node` file extension and initialize those as dynamically-linked +libraries. + +When calling [`require()`](globals.html#globals_require), the `.node` extension can usually be +omitted and Node.js will still find and initialize the Addon. One caveat, +however, is that Node.js will first attempt to locate and load modules or +JavaScript files that happen to share the same base name. For instance, if +there is a file `addon.js` in the same directory as the binary `addon.node`, +then [`require('addon')`](globals.html#globals_require) will give precedence to the `addon.js` file +and load it instead. + +## Native Abstractions for Node.js[#](#addons_native_abstractions_for_node_js) + +Each of the examples illustrated in this document make direct use of the +Node.js and V8 APIs for implementing Addons. It is important to understand +that the V8 API can, and has, changed dramatically from one V8 release to the +next (and one major Node.js release to the next). With each change, Addons may +need to be updated and recompiled in order to continue functioning. The Node.js +release schedule is designed to minimize the frequency and impact of such +changes but there is little that Node.js can do currently to ensure stability +of the V8 APIs. + +The [Native Abstractions for Node.js](https://github.com/nodejs/nan) (or `nan`) provide a set of tools that +Addon developers are recommended to use to keep compatibility between past and +future releases of V8 and Node.js. See the `nan` [examples](https://github.com/nodejs/nan/tree/master/examples/) for an +illustration of how it can be used. + +## Addon examples[#](#addons_addon_examples) + +Following are some example Addons intended to help developers get started. The +examples make use of the V8 APIs. Refer to the online [V8 reference](https://v8docs.nodesource.com/) +for help with the various V8 calls, and V8's [Embedder's Guide](https://github.com/v8/v8/wiki/Embedder's%20Guide) for an +explanation of several concepts used such as handles, scopes, function +templates, etc. + +Each of these examples using the following `binding.gyp` file: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "addon.cc" ] + } + ] +} +``` + +In cases where there is more than one `.cc` file, simply add the additional +filename to the `sources` array. For example: + +```None +"sources": ["addon.cc", "myexample.cc"] +``` + +Once the `binding.gyp` file is ready, the example Addons can be configured and +built using `node-gyp`: + +```None +$ node-gyp configure build +``` + +### Function arguments[#](#addons_function_arguments) + +Addons will typically expose objects and functions that can be accessed from +JavaScript running within Node.js. When functions are invoked from JavaScript, +the input arguments and return value must be mapped to and from the C/C++ +code. + +The following example illustrates how to read function arguments passed from +JavaScript and how to return a result: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Exception; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::String; +using v8::Value; + +// This is the implementation of the "add" method +// Input arguments are passed using the +// const FunctionCallbackInfo& args struct +void Add(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + // Check the number of arguments passed. + if (args.Length() < 2) { + // Throw an Error that is passed back to JavaScript + isolate->ThrowException(Exception::TypeError( + String::NewFromUtf8(isolate, "Wrong number of arguments"))); + return; + } + + // Check the argument types + if (!args[0]->IsNumber() || !args[1]->IsNumber()) { + isolate->ThrowException(Exception::TypeError( + String::NewFromUtf8(isolate, "Wrong arguments"))); + return; + } + + // Perform the operation + double value = args[0]->NumberValue() + args[1]->NumberValue(); + Local num = Number::New(isolate, value); + + // Set the return value (using the passed in + // FunctionCallbackInfo&) + args.GetReturnValue().Set(num); +} + +void Init(Local exports) { + NODE_SET_METHOD(exports, "add", Add); +} + +NODE_MODULE(addon, Init) + +} // namespace demo +``` + +Once compiled, the example Addon can be required and used from within Node.js: + +```None +// test.js +const addon = require('./build/Release/addon'); + +console.log('This should be eight:', addon.add(3, 5)); +``` + +### Callbacks[#](#addons_callbacks) + +It is common practice within Addons to pass JavaScript functions to a C++ +function and execute them from there. The following example illustrates how +to invoke such callbacks: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Null; +using v8::Object; +using v8::String; +using v8::Value; + +void RunCallback(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local cb = Local::Cast(args[0]); + const unsigned argc = 1; + Local argv[argc] = { String::NewFromUtf8(isolate, "hello world") }; + cb->Call(Null(isolate), argc, argv); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", RunCallback); +} + +NODE_MODULE(addon, Init) + +} // namespace demo +``` + +Note that this example uses a two-argument form of `Init()` that receives +the full `module` object as the second argument. This allows the Addon +to completely overwrite `exports` with a single function instead of +adding the function as a property of `exports`. + +To test it, run the following JavaScript: + +```None +// test.js +const addon = require('./build/Release/addon'); + +addon((msg) => { + console.log(msg); +// Prints: 'hello world' +}); +``` + +Note that, in this example, the callback function is invoked synchronously. + +### Object factory[#](#addons_object_factory) + +Addons can create and return new objects from within a C++ function as +illustrated in the following example. An object is created and returned with a +property `msg` that echoes the string passed to `createObject()`: + +```None +// addon.cc +#include + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + Local obj = Object::New(isolate); + obj->Set(String::NewFromUtf8(isolate, "msg"), args[0]->ToString()); + + args.GetReturnValue().Set(obj); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", CreateObject); +} + +NODE_MODULE(addon, Init) + +} // namespace demo +``` + +To test it in JavaScript: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const obj1 = addon('hello'); +const obj2 = addon('world'); +console.log(obj1.msg, obj2.msg); +// Prints: 'hello world' +``` + +### Function factory[#](#addons_function_factory) + +Another common scenario is creating JavaScript functions that wrap C++ +functions and returning those back to JavaScript: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void MyFunction(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, "hello world")); +} + +void CreateFunction(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + Local tpl = FunctionTemplate::New(isolate, MyFunction); + Local fn = tpl->GetFunction(); + + // omit this to make it anonymous + fn->SetName(String::NewFromUtf8(isolate, "theFunction")); + + args.GetReturnValue().Set(fn); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", CreateFunction); +} + +NODE_MODULE(addon, Init) + +} // namespace demo +``` + +To test: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const fn = addon(); +console.log(fn()); +// Prints: 'hello world' +``` + +### Wrapping C++ objects[#](#addons_wrapping_c_objects) + +It is also possible to wrap C++ objects/classes in a way that allows new +instances to be created using the JavaScript `new` operator: + +```None +// addon.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Local; +using v8::Object; + +void InitAll(Local exports) { + MyObject::Init(exports); +} + +NODE_MODULE(addon, InitAll) + +} // namespace demo +``` + +Then, in `myobject.h`, the wrapper class inherits from `node::ObjectWrap`: + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Local exports); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static void PlusOne(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +In `myobject.cc`, implement the various methods that are to be exposed. +Below, the method `plusOne()` is exposed by adding it to the constructor's +prototype: + +```None +// myobject.cc +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Local exports) { + Isolate* isolate = exports->GetIsolate(); + + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); + + constructor.Reset(isolate, tpl->GetFunction()); + exports->Set(String::NewFromUtf8(isolate, "MyObject"), + tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local context = isolate->GetCurrentContext(); + Local cons = Local::New(isolate, constructor); + Local result = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(result); + } +} + +void MyObject::PlusOne(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + obj->value_ += 1; + + args.GetReturnValue().Set(Number::New(isolate, obj->value_)); +} + +} // namespace demo +``` + +To build this example, the `myobject.cc` file must be added to the +`binding.gyp`: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ + "addon.cc", + "myobject.cc" + ] + } + ] +} +``` + +Test it with: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const obj = new addon.MyObject(10); +console.log(obj.plusOne()); +// Prints: 11 +console.log(obj.plusOne()); +// Prints: 12 +console.log(obj.plusOne()); +// Prints: 13 +``` + +### Factory of wrapped objects[#](#addons_factory_of_wrapped_objects) + +Alternatively, it is possible to use a factory pattern to avoid explicitly +creating object instances using the JavaScript `new` operator: + +```None +const obj = addon.createObject(); +// instead of: +// const obj = new addon.Object(); +``` + +First, the `createObject()` method is implemented in `addon.cc`: + +```None +// addon.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + MyObject::NewInstance(args); +} + +void InitAll(Local exports, Local module) { + MyObject::Init(exports->GetIsolate()); + + NODE_SET_METHOD(module, "exports", CreateObject); +} + +NODE_MODULE(addon, InitAll) + +} // namespace demo +``` + +In `myobject.h`, the static method `NewInstance()` is added to handle +instantiating the object. This method takes the place of using `new` in +JavaScript: + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Isolate* isolate); + static void NewInstance(const v8::FunctionCallbackInfo& args); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static void PlusOne(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +The implementation in `myobject.cc` is similar to the previous example: + +```None +// myobject.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Isolate* isolate) { + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); + + constructor.Reset(isolate, tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local context = isolate->GetCurrentContext(); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(instance); + } +} + +void MyObject::NewInstance(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + const unsigned argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local context = isolate->GetCurrentContext(); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + + args.GetReturnValue().Set(instance); +} + +void MyObject::PlusOne(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + obj->value_ += 1; + + args.GetReturnValue().Set(Number::New(isolate, obj->value_)); +} + +} // namespace demo +``` + +Once again, to build this example, the `myobject.cc` file must be added to the +`binding.gyp`: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ + "addon.cc", + "myobject.cc" + ] + } + ] +} +``` + +Test it with: + +```None +// test.js +const createObject = require('./build/Release/addon'); + +const obj = createObject(10); +console.log(obj.plusOne()); +// Prints: 11 +console.log(obj.plusOne()); +// Prints: 12 +console.log(obj.plusOne()); +// Prints: 13 + +const obj2 = createObject(20); +console.log(obj2.plusOne()); +// Prints: 21 +console.log(obj2.plusOne()); +// Prints: 22 +console.log(obj2.plusOne()); +// Prints: 23 +``` + +### Passing wrapped objects around[#](#addons_passing_wrapped_objects_around) + +In addition to wrapping and returning C++ objects, it is possible to pass +wrapped objects around by unwrapping them with the Node.js helper function +`node::ObjectWrap::Unwrap`. The following examples shows a function `add()` +that can take two `MyObject` objects as input arguments: + +```None +// addon.cc +#include +#include +#include "myobject.h" + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + MyObject::NewInstance(args); +} + +void Add(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj1 = node::ObjectWrap::Unwrap( + args[0]->ToObject()); + MyObject* obj2 = node::ObjectWrap::Unwrap( + args[1]->ToObject()); + + double sum = obj1->value() + obj2->value(); + args.GetReturnValue().Set(Number::New(isolate, sum)); +} + +void InitAll(Local exports) { + MyObject::Init(exports->GetIsolate()); + + NODE_SET_METHOD(exports, "createObject", CreateObject); + NODE_SET_METHOD(exports, "add", Add); +} + +NODE_MODULE(addon, InitAll) + +} // namespace demo +``` + +In `myobject.h`, a new public method is added to allow access to private values +after unwrapping the object. + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Isolate* isolate); + static void NewInstance(const v8::FunctionCallbackInfo& args); + inline double value() const { return value_; } + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +The implementation of `myobject.cc` is similar to before: + +```None +// myobject.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Isolate* isolate) { + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + constructor.Reset(isolate, tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local context = isolate->GetCurrentContext(); + Local cons = Local::New(isolate, constructor); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(instance); + } +} + +void MyObject::NewInstance(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + const unsigned argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local context = isolate->GetCurrentContext(); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + + args.GetReturnValue().Set(instance); +} + +} // namespace demo +``` + +Test it with: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const obj1 = addon.createObject(10); +const obj2 = addon.createObject(20); +const result = addon.add(obj1, obj2); + +console.log(result); +// Prints: 30 +``` + +### AtExit hooks[#](#addons_atexit_hooks) + +An "AtExit" hook is a function that is invoked after the Node.js event loop +has ended but before the JavaScript VM is terminated and Node.js shuts down. +"AtExit" hooks are registered using the `node::AtExit` API. + +#### void AtExit(callback, args)[#](#addons_void_atexit_callback_args) + +* `callback`: `void (*)(void*)` - A pointer to the function to call at exit. +* `args`: `void*` - A pointer to pass to the callback at exit. + +Registers exit hooks that run after the event loop has ended but before the VM +is killed. + +AtExit takes two parameters: a pointer to a callback function to run at exit, +and a pointer to untyped context data to be passed to that callback. + +Callbacks are run in last-in first-out order. + +The following `addon.cc` implements AtExit: + +```None +// addon.cc +#undef NDEBUG +#include +#include +#include + +namespace demo { + +using node::AtExit; +using v8::HandleScope; +using v8::Isolate; +using v8::Local; +using v8::Object; + +static char cookie[] = "yum yum"; +static int at_exit_cb1_called = 0; +static int at_exit_cb2_called = 0; + +static void at_exit_cb1(void* arg) { + Isolate* isolate = static_cast(arg); + HandleScope scope(isolate); + Local obj = Object::New(isolate); + assert(!obj.IsEmpty()); // assert VM is still alive + assert(obj->IsObject()); + at_exit_cb1_called++; +} + +static void at_exit_cb2(void* arg) { + assert(arg == static_cast(cookie)); + at_exit_cb2_called++; +} + +static void sanity_check(void*) { + assert(at_exit_cb1_called == 1); + assert(at_exit_cb2_called == 2); +} + +void init(Local exports) { + AtExit(sanity_check); + AtExit(at_exit_cb2, cookie); + AtExit(at_exit_cb2, cookie); + AtExit(at_exit_cb1, exports->GetIsolate()); +} + +NODE_MODULE(addon, init); + +} // namespace demo +``` + +Test in JavaScript by running: + +```None +// test.js +const addon = require('./build/Release/addon'); +``` diff --git a/corpus/docs/nodejs/addons/addons_8x.md b/corpus/docs/nodejs/addons/addons_8x.md new file mode 100644 index 0000000000000000000000000000000000000000..597e171fe3fab4f15f14541201d6a5f4d81026d9 --- /dev/null +++ b/corpus/docs/nodejs/addons/addons_8x.md @@ -0,0 +1,1157 @@ +# C++ Addons# + +Source: https://nodejs.org/docs/latest-v8.x/api/addons.html +Version: 8.x + +Node.js Addons are dynamically-linked shared objects, written in C++, that +can be loaded into Node.js using the [`require()`](modules.html#modules_require) function, and used +just as if they were an ordinary Node.js module. They are used primarily to +provide an interface between JavaScript running in Node.js and C/C++ libraries. + +At the moment, the method for implementing Addons is rather complicated, +involving knowledge of several components and APIs : + +* V8: the C++ library Node.js currently uses to provide the + JavaScript implementation. V8 provides the mechanisms for creating objects, + calling functions, etc. V8's API is documented mostly in the + `v8.h` header file (`deps/v8/include/v8.h` in the Node.js source + tree), which is also available [online](https://v8docs.nodesource.com/). +* [libuv](https://github.com/libuv/libuv): The C library that implements the Node.js event loop, its worker + threads and all of the asynchronous behaviors of the platform. It also + serves as a cross-platform abstraction library, giving easy, POSIX-like + access across all major operating systems to many common system tasks, such + as interacting with the filesystem, sockets, timers, and system events. libuv + also provides a pthreads-like threading abstraction that may be used to + power more sophisticated asynchronous Addons that need to move beyond the + standard event loop. Addon authors are encouraged to think about how to + avoid blocking the event loop with I/O or other time-intensive tasks by + off-loading work via libuv to non-blocking system operations, worker threads + or a custom use of libuv's threads. +* Internal Node.js libraries. Node.js itself exports a number of C++ APIs + that Addons can use — the most important of which is the + `node::ObjectWrap` class. +* Node.js includes a number of other statically linked libraries including + OpenSSL. These other libraries are located in the `deps/` directory in the + Node.js source tree. Only the libuv, OpenSSL, V8 and zlib symbols are + purposefully re-exported by Node.js and may be used to various extents by + Addons. + See [Linking to Node.js' own dependencies](#addons_linking_to_node_js_own_dependencies) for additional information. + +All of the following examples are available for [download](https://github.com/nodejs/node-addon-examples) and may +be used as the starting-point for an Addon. + +## Hello world[#](#addons_hello_world) + +This "Hello world" example is a simple Addon, written in C++, that is the +equivalent of the following JavaScript code: + +```None +module.exports.hello = () => 'world'; +``` + +First, create the file `hello.cc`: + +```None +// hello.cc +#include + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void Method(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world")); +} + +void init(Local exports) { + NODE_SET_METHOD(exports, "hello", Method); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, init) + +} // namespace demo +``` + +Note that all Node.js Addons must export an initialization function following +the pattern: + +```None +void Initialize(Local exports); +NODE_MODULE(NODE_GYP_MODULE_NAME, Initialize) +``` + +There is no semi-colon after `NODE_MODULE` as it's not a function (see +`node.h`). + +The `module_name` must match the filename of the final binary (excluding +the .node suffix). + +In the `hello.cc` example, then, the initialization function is `init` and the +Addon module name is `addon`. + +### Building[#](#addons_building) + +Once the source code has been written, it must be compiled into the binary +`addon.node` file. To do so, create a file called `binding.gyp` in the +top-level of the project describing the build configuration of the module +using a JSON-like format. This file is used by [node-gyp](https://github.com/nodejs/node-gyp) — a tool written +specifically to compile Node.js Addons. + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "hello.cc" ] + } + ] +} +``` + +*Note*: A version of the `node-gyp` utility is bundled and distributed with +Node.js as part of `npm`. This version is not made directly available for +developers to use and is intended only to support the ability to use the +`npm install` command to compile and install Addons. Developers who wish to +use `node-gyp` directly can install it using the command +`npm install -g node-gyp`. See the `node-gyp` [installation instructions](https://github.com/nodejs/node-gyp#installation) for +more information, including platform-specific requirements. + +Once the `binding.gyp` file has been created, use `node-gyp configure` to +generate the appropriate project build files for the current platform. This +will generate either a `Makefile` (on Unix platforms) or a `vcxproj` file +(on Windows) in the `build/` directory. + +Next, invoke the `node-gyp build` command to generate the compiled `addon.node` +file. This will be put into the `build/Release/` directory. + +When using `npm install` to install a Node.js Addon, npm uses its own bundled +version of `node-gyp` to perform this same set of actions, generating a +compiled version of the Addon for the user's platform on demand. + +Once built, the binary Addon can be used from within Node.js by pointing +[`require()`](modules.html#modules_require) to the built `addon.node` module: + +```None +// hello.js +const addon = require('./build/Release/addon'); + +console.log(addon.hello()); +// Prints: 'world' +``` + +Please see the examples below for further information or + for an example in production. + +Because the exact path to the compiled Addon binary can vary depending on how +it is compiled (i.e. sometimes it may be in `./build/Debug/`), Addons can use +the [bindings](https://github.com/TooTallNate/node-bindings) package to load the compiled module. + +Note that while the `bindings` package implementation is more sophisticated +in how it locates Addon modules, it is essentially using a try-catch pattern +similar to: + +```None +try { + return require('./build/Release/addon.node'); +} catch (err) { + return require('./build/Debug/addon.node'); +} +``` + +### Linking to Node.js' own dependencies[#](#addons_linking_to_node_js_own_dependencies) + +Node.js uses a number of statically linked libraries such as V8, libuv and +OpenSSL. All Addons are required to link to V8 and may link to any of the +other dependencies as well. Typically, this is as simple as including +the appropriate `#include <...>` statements (e.g. `#include `) and +`node-gyp` will locate the appropriate headers automatically. However, there +are a few caveats to be aware of: + +* When `node-gyp` runs, it will detect the specific release version of Node.js + and download either the full source tarball or just the headers. If the full + source is downloaded, Addons will have complete access to the full set of + Node.js dependencies. However, if only the Node.js headers are downloaded, then + only the symbols exported by Node.js will be available. +* `node-gyp` can be run using the `--nodedir` flag pointing at a local Node.js + source image. Using this option, the Addon will have access to the full set of + dependencies. + +### Loading Addons using require()[#](#addons_loading_addons_using_require) + +The filename extension of the compiled Addon binary is `.node` (as opposed +to `.dll` or `.so`). The [`require()`](modules.html#modules_require) function is written to look for +files with the `.node` file extension and initialize those as dynamically-linked +libraries. + +When calling [`require()`](modules.html#modules_require), the `.node` extension can usually be +omitted and Node.js will still find and initialize the Addon. One caveat, +however, is that Node.js will first attempt to locate and load modules or +JavaScript files that happen to share the same base name. For instance, if +there is a file `addon.js` in the same directory as the binary `addon.node`, +then [`require('addon')`](modules.html#modules_require) will give precedence to the `addon.js` file +and load it instead. + +## Native Abstractions for Node.js[#](#addons_native_abstractions_for_node_js) + +Each of the examples illustrated in this document make direct use of the +Node.js and V8 APIs for implementing Addons. It is important to understand +that the V8 API can, and has, changed dramatically from one V8 release to the +next (and one major Node.js release to the next). With each change, Addons may +need to be updated and recompiled in order to continue functioning. The Node.js +release schedule is designed to minimize the frequency and impact of such +changes but there is little that Node.js can do currently to ensure stability +of the V8 APIs. + +The [Native Abstractions for Node.js](https://github.com/nodejs/nan) (or `nan`) provide a set of tools that +Addon developers are recommended to use to keep compatibility between past and +future releases of V8 and Node.js. See the `nan` [examples](https://github.com/nodejs/nan/tree/master/examples/) for an +illustration of how it can be used. + +## N-API[#](#addons_n_api) + +[Stability: 1](documentation.html#documentation_stability_index) - Experimental + +N-API is an API for building native Addons. It is independent from +the underlying JavaScript runtime (e.g. V8) and is maintained as part of +Node.js itself. This API will be Application Binary Interface (ABI) stable +across version of Node.js. It is intended to insulate Addons from +changes in the underlying JavaScript engine and allow modules +compiled for one version to run on later versions of Node.js without +recompilation. Addons are built/packaged with the same approach/tools +outlined in this document (node-gyp, etc.). The only difference is the +set of APIs that are used by the native code. Instead of using the V8 +or [Native Abstractions for Node.js](https://github.com/nodejs/nan) APIs, the functions available +in the N-API are used. + +To use N-API in the above "Hello world" example, replace the content of +`hello.cc` with the following. All other instructions remain the same. + +```None +// hello.cc using N-API +#include + +namespace demo { + +napi_value Method(napi_env env, napi_callback_info args) { + napi_value greeting; + napi_status status; + + status = napi_create_string_utf8(env, "hello", NAPI_AUTO_LENGTH, &greeting); + if (status != napi_ok) return nullptr; + return greeting; +} + +napi_value init(napi_env env, napi_value exports) { + napi_status status; + napi_value fn; + + status = napi_create_function(env, nullptr, 0, Method, nullptr, &fn); + if (status != napi_ok) return nullptr; + + status = napi_set_named_property(env, exports, "hello", fn); + if (status != napi_ok) return nullptr; + return exports; +} + +NAPI_MODULE(NODE_GYP_MODULE_NAME, init) + +} // namespace demo +``` + +The functions available and how to use them are documented in the +section titled [C/C++ Addons - N-API](n-api.html). + +## Addon examples[#](#addons_addon_examples) + +Following are some example Addons intended to help developers get started. The +examples make use of the V8 APIs. Refer to the online [V8 reference](https://v8docs.nodesource.com/) +for help with the various V8 calls, and V8's [Embedder's Guide](https://github.com/v8/v8/wiki/Embedder's%20Guide) for an +explanation of several concepts used such as handles, scopes, function +templates, etc. + +Each of these examples using the following `binding.gyp` file: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "addon.cc" ] + } + ] +} +``` + +In cases where there is more than one `.cc` file, simply add the additional +filename to the `sources` array. For example: + +```None +"sources": ["addon.cc", "myexample.cc"] +``` + +Once the `binding.gyp` file is ready, the example Addons can be configured and +built using `node-gyp`: + +```None +$ node-gyp configure build +``` + +### Function arguments[#](#addons_function_arguments) + +Addons will typically expose objects and functions that can be accessed from +JavaScript running within Node.js. When functions are invoked from JavaScript, +the input arguments and return value must be mapped to and from the C/C++ +code. + +The following example illustrates how to read function arguments passed from +JavaScript and how to return a result: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Exception; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::String; +using v8::Value; + +// This is the implementation of the "add" method +// Input arguments are passed using the +// const FunctionCallbackInfo& args struct +void Add(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + // Check the number of arguments passed. + if (args.Length() < 2) { + // Throw an Error that is passed back to JavaScript + isolate->ThrowException(Exception::TypeError( + String::NewFromUtf8(isolate, "Wrong number of arguments"))); + return; + } + + // Check the argument types + if (!args[0]->IsNumber() || !args[1]->IsNumber()) { + isolate->ThrowException(Exception::TypeError( + String::NewFromUtf8(isolate, "Wrong arguments"))); + return; + } + + // Perform the operation + double value = args[0]->NumberValue() + args[1]->NumberValue(); + Local num = Number::New(isolate, value); + + // Set the return value (using the passed in + // FunctionCallbackInfo&) + args.GetReturnValue().Set(num); +} + +void Init(Local exports) { + NODE_SET_METHOD(exports, "add", Add); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, Init) + +} // namespace demo +``` + +Once compiled, the example Addon can be required and used from within Node.js: + +```None +// test.js +const addon = require('./build/Release/addon'); + +console.log('This should be eight:', addon.add(3, 5)); +``` + +### Callbacks[#](#addons_callbacks) + +It is common practice within Addons to pass JavaScript functions to a C++ +function and execute them from there. The following example illustrates how +to invoke such callbacks: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Null; +using v8::Object; +using v8::String; +using v8::Value; + +void RunCallback(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local cb = Local::Cast(args[0]); + const unsigned argc = 1; + Local argv[argc] = { String::NewFromUtf8(isolate, "hello world") }; + cb->Call(Null(isolate), argc, argv); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", RunCallback); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, Init) + +} // namespace demo +``` + +Note that this example uses a two-argument form of `Init()` that receives +the full `module` object as the second argument. This allows the Addon +to completely overwrite `exports` with a single function instead of +adding the function as a property of `exports`. + +To test it, run the following JavaScript: + +```None +// test.js +const addon = require('./build/Release/addon'); + +addon((msg) => { + console.log(msg); +// Prints: 'hello world' +}); +``` + +Note that, in this example, the callback function is invoked synchronously. + +### Object factory[#](#addons_object_factory) + +Addons can create and return new objects from within a C++ function as +illustrated in the following example. An object is created and returned with a +property `msg` that echoes the string passed to `createObject()`: + +```None +// addon.cc +#include + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + Local obj = Object::New(isolate); + obj->Set(String::NewFromUtf8(isolate, "msg"), args[0]->ToString()); + + args.GetReturnValue().Set(obj); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", CreateObject); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, Init) + +} // namespace demo +``` + +To test it in JavaScript: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const obj1 = addon('hello'); +const obj2 = addon('world'); +console.log(obj1.msg, obj2.msg); +// Prints: 'hello world' +``` + +### Function factory[#](#addons_function_factory) + +Another common scenario is creating JavaScript functions that wrap C++ +functions and returning those back to JavaScript: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void MyFunction(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, "hello world")); +} + +void CreateFunction(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + Local tpl = FunctionTemplate::New(isolate, MyFunction); + Local fn = tpl->GetFunction(); + + // omit this to make it anonymous + fn->SetName(String::NewFromUtf8(isolate, "theFunction")); + + args.GetReturnValue().Set(fn); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", CreateFunction); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, Init) + +} // namespace demo +``` + +To test: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const fn = addon(); +console.log(fn()); +// Prints: 'hello world' +``` + +### Wrapping C++ objects[#](#addons_wrapping_c_objects) + +It is also possible to wrap C++ objects/classes in a way that allows new +instances to be created using the JavaScript `new` operator: + +```None +// addon.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Local; +using v8::Object; + +void InitAll(Local exports) { + MyObject::Init(exports); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, InitAll) + +} // namespace demo +``` + +Then, in `myobject.h`, the wrapper class inherits from `node::ObjectWrap`: + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Local exports); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static void PlusOne(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +In `myobject.cc`, implement the various methods that are to be exposed. +Below, the method `plusOne()` is exposed by adding it to the constructor's +prototype: + +```None +// myobject.cc +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Local exports) { + Isolate* isolate = exports->GetIsolate(); + + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); + + constructor.Reset(isolate, tpl->GetFunction()); + exports->Set(String::NewFromUtf8(isolate, "MyObject"), + tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local context = isolate->GetCurrentContext(); + Local cons = Local::New(isolate, constructor); + Local result = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(result); + } +} + +void MyObject::PlusOne(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + obj->value_ += 1; + + args.GetReturnValue().Set(Number::New(isolate, obj->value_)); +} + +} // namespace demo +``` + +To build this example, the `myobject.cc` file must be added to the +`binding.gyp`: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ + "addon.cc", + "myobject.cc" + ] + } + ] +} +``` + +Test it with: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const obj = new addon.MyObject(10); +console.log(obj.plusOne()); +// Prints: 11 +console.log(obj.plusOne()); +// Prints: 12 +console.log(obj.plusOne()); +// Prints: 13 +``` + +### Factory of wrapped objects[#](#addons_factory_of_wrapped_objects) + +Alternatively, it is possible to use a factory pattern to avoid explicitly +creating object instances using the JavaScript `new` operator: + +```None +const obj = addon.createObject(); +// instead of: +// const obj = new addon.Object(); +``` + +First, the `createObject()` method is implemented in `addon.cc`: + +```None +// addon.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + MyObject::NewInstance(args); +} + +void InitAll(Local exports, Local module) { + MyObject::Init(exports->GetIsolate()); + + NODE_SET_METHOD(module, "exports", CreateObject); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, InitAll) + +} // namespace demo +``` + +In `myobject.h`, the static method `NewInstance()` is added to handle +instantiating the object. This method takes the place of using `new` in +JavaScript: + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Isolate* isolate); + static void NewInstance(const v8::FunctionCallbackInfo& args); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static void PlusOne(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +The implementation in `myobject.cc` is similar to the previous example: + +```None +// myobject.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Isolate* isolate) { + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); + + constructor.Reset(isolate, tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local context = isolate->GetCurrentContext(); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(instance); + } +} + +void MyObject::NewInstance(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + const unsigned argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local context = isolate->GetCurrentContext(); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + + args.GetReturnValue().Set(instance); +} + +void MyObject::PlusOne(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + obj->value_ += 1; + + args.GetReturnValue().Set(Number::New(isolate, obj->value_)); +} + +} // namespace demo +``` + +Once again, to build this example, the `myobject.cc` file must be added to the +`binding.gyp`: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ + "addon.cc", + "myobject.cc" + ] + } + ] +} +``` + +Test it with: + +```None +// test.js +const createObject = require('./build/Release/addon'); + +const obj = createObject(10); +console.log(obj.plusOne()); +// Prints: 11 +console.log(obj.plusOne()); +// Prints: 12 +console.log(obj.plusOne()); +// Prints: 13 + +const obj2 = createObject(20); +console.log(obj2.plusOne()); +// Prints: 21 +console.log(obj2.plusOne()); +// Prints: 22 +console.log(obj2.plusOne()); +// Prints: 23 +``` + +### Passing wrapped objects around[#](#addons_passing_wrapped_objects_around) + +In addition to wrapping and returning C++ objects, it is possible to pass +wrapped objects around by unwrapping them with the Node.js helper function +`node::ObjectWrap::Unwrap`. The following examples shows a function `add()` +that can take two `MyObject` objects as input arguments: + +```None +// addon.cc +#include +#include +#include "myobject.h" + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + MyObject::NewInstance(args); +} + +void Add(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj1 = node::ObjectWrap::Unwrap( + args[0]->ToObject()); + MyObject* obj2 = node::ObjectWrap::Unwrap( + args[1]->ToObject()); + + double sum = obj1->value() + obj2->value(); + args.GetReturnValue().Set(Number::New(isolate, sum)); +} + +void InitAll(Local exports) { + MyObject::Init(exports->GetIsolate()); + + NODE_SET_METHOD(exports, "createObject", CreateObject); + NODE_SET_METHOD(exports, "add", Add); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, InitAll) + +} // namespace demo +``` + +In `myobject.h`, a new public method is added to allow access to private values +after unwrapping the object. + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Isolate* isolate); + static void NewInstance(const v8::FunctionCallbackInfo& args); + inline double value() const { return value_; } + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +The implementation of `myobject.cc` is similar to before: + +```None +// myobject.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Isolate* isolate) { + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + constructor.Reset(isolate, tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local context = isolate->GetCurrentContext(); + Local cons = Local::New(isolate, constructor); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(instance); + } +} + +void MyObject::NewInstance(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + const unsigned argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local context = isolate->GetCurrentContext(); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + + args.GetReturnValue().Set(instance); +} + +} // namespace demo +``` + +Test it with: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const obj1 = addon.createObject(10); +const obj2 = addon.createObject(20); +const result = addon.add(obj1, obj2); + +console.log(result); +// Prints: 30 +``` + +### AtExit hooks[#](#addons_atexit_hooks) + +An "AtExit" hook is a function that is invoked after the Node.js event loop +has ended but before the JavaScript VM is terminated and Node.js shuts down. +"AtExit" hooks are registered using the `node::AtExit` API. + +#### void AtExit(callback, args)[#](#addons_void_atexit_callback_args) + +* `callback` A pointer to the function to call at exit. +* `args` A pointer to pass to the callback at exit. + +Registers exit hooks that run after the event loop has ended but before the VM +is killed. + +AtExit takes two parameters: a pointer to a callback function to run at exit, +and a pointer to untyped context data to be passed to that callback. + +Callbacks are run in last-in first-out order. + +The following `addon.cc` implements AtExit: + +```None +// addon.cc +#include +#include +#include + +namespace demo { + +using node::AtExit; +using v8::HandleScope; +using v8::Isolate; +using v8::Local; +using v8::Object; + +static char cookie[] = "yum yum"; +static int at_exit_cb1_called = 0; +static int at_exit_cb2_called = 0; + +static void at_exit_cb1(void* arg) { + Isolate* isolate = static_cast(arg); + HandleScope scope(isolate); + Local obj = Object::New(isolate); + assert(!obj.IsEmpty()); // assert VM is still alive + assert(obj->IsObject()); + at_exit_cb1_called++; +} + +static void at_exit_cb2(void* arg) { + assert(arg == static_cast(cookie)); + at_exit_cb2_called++; +} + +static void sanity_check(void*) { + assert(at_exit_cb1_called == 1); + assert(at_exit_cb2_called == 2); +} + +void init(Local exports) { + AtExit(at_exit_cb2, cookie); + AtExit(at_exit_cb2, cookie); + AtExit(at_exit_cb1, exports->GetIsolate()); + AtExit(sanity_check); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, init) + +} // namespace demo +``` + +Test in JavaScript by running: + +```None +// test.js +require('./build/Release/addon'); +``` diff --git a/corpus/docs/nodejs/addons/addons_9x.md b/corpus/docs/nodejs/addons/addons_9x.md new file mode 100644 index 0000000000000000000000000000000000000000..18fae2adcbe82514655ae999127fedbb19dd5895 --- /dev/null +++ b/corpus/docs/nodejs/addons/addons_9x.md @@ -0,0 +1,1157 @@ +# C++ Addons# + +Source: https://nodejs.org/docs/latest-v9.x/api/addons.html +Version: 9.x + +Node.js Addons are dynamically-linked shared objects, written in C++, that +can be loaded into Node.js using the [`require()`](modules.html#modules_require) function, and used +just as if they were an ordinary Node.js module. They are used primarily to +provide an interface between JavaScript running in Node.js and C/C++ libraries. + +At the moment, the method for implementing Addons is rather complicated, +involving knowledge of several components and APIs : + +* V8: the C++ library Node.js currently uses to provide the + JavaScript implementation. V8 provides the mechanisms for creating objects, + calling functions, etc. V8's API is documented mostly in the + `v8.h` header file (`deps/v8/include/v8.h` in the Node.js source + tree), which is also available [online](https://v8docs.nodesource.com/). +* [libuv](https://github.com/libuv/libuv): The C library that implements the Node.js event loop, its worker + threads and all of the asynchronous behaviors of the platform. It also + serves as a cross-platform abstraction library, giving easy, POSIX-like + access across all major operating systems to many common system tasks, such + as interacting with the filesystem, sockets, timers, and system events. libuv + also provides a pthreads-like threading abstraction that may be used to + power more sophisticated asynchronous Addons that need to move beyond the + standard event loop. Addon authors are encouraged to think about how to + avoid blocking the event loop with I/O or other time-intensive tasks by + off-loading work via libuv to non-blocking system operations, worker threads + or a custom use of libuv's threads. +* Internal Node.js libraries. Node.js itself exports a number of C++ APIs + that Addons can use — the most important of which is the + `node::ObjectWrap` class. +* Node.js includes a number of other statically linked libraries including + OpenSSL. These other libraries are located in the `deps/` directory in the + Node.js source tree. Only the libuv, OpenSSL, V8 and zlib symbols are + purposefully re-exported by Node.js and may be used to various extents by + Addons. + See [Linking to Node.js' own dependencies](#addons_linking_to_node_js_own_dependencies) for additional information. + +All of the following examples are available for [download](https://github.com/nodejs/node-addon-examples) and may +be used as the starting-point for an Addon. + +## Hello world[#](#addons_hello_world) + +This "Hello world" example is a simple Addon, written in C++, that is the +equivalent of the following JavaScript code: + +```None +module.exports.hello = () => 'world'; +``` + +First, create the file `hello.cc`: + +```None +// hello.cc +#include + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void Method(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world")); +} + +void init(Local exports) { + NODE_SET_METHOD(exports, "hello", Method); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, init) + +} // namespace demo +``` + +Note that all Node.js Addons must export an initialization function following +the pattern: + +```None +void Initialize(Local exports); +NODE_MODULE(NODE_GYP_MODULE_NAME, Initialize) +``` + +There is no semi-colon after `NODE_MODULE` as it's not a function (see +`node.h`). + +The `module_name` must match the filename of the final binary (excluding +the .node suffix). + +In the `hello.cc` example, then, the initialization function is `init` and the +Addon module name is `addon`. + +### Building[#](#addons_building) + +Once the source code has been written, it must be compiled into the binary +`addon.node` file. To do so, create a file called `binding.gyp` in the +top-level of the project describing the build configuration of the module +using a JSON-like format. This file is used by [node-gyp](https://github.com/nodejs/node-gyp) — a tool written +specifically to compile Node.js Addons. + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "hello.cc" ] + } + ] +} +``` + +A version of the `node-gyp` utility is bundled and distributed with +Node.js as part of `npm`. This version is not made directly available for +developers to use and is intended only to support the ability to use the +`npm install` command to compile and install Addons. Developers who wish to +use `node-gyp` directly can install it using the command +`npm install -g node-gyp`. See the `node-gyp` [installation instructions](https://github.com/nodejs/node-gyp#installation) for +more information, including platform-specific requirements. + +Once the `binding.gyp` file has been created, use `node-gyp configure` to +generate the appropriate project build files for the current platform. This +will generate either a `Makefile` (on Unix platforms) or a `vcxproj` file +(on Windows) in the `build/` directory. + +Next, invoke the `node-gyp build` command to generate the compiled `addon.node` +file. This will be put into the `build/Release/` directory. + +When using `npm install` to install a Node.js Addon, npm uses its own bundled +version of `node-gyp` to perform this same set of actions, generating a +compiled version of the Addon for the user's platform on demand. + +Once built, the binary Addon can be used from within Node.js by pointing +[`require()`](modules.html#modules_require) to the built `addon.node` module: + +```None +// hello.js +const addon = require('./build/Release/addon'); + +console.log(addon.hello()); +// Prints: 'world' +``` + +Please see the examples below for further information or + for an example in production. + +Because the exact path to the compiled Addon binary can vary depending on how +it is compiled (i.e. sometimes it may be in `./build/Debug/`), Addons can use +the [bindings](https://github.com/TooTallNate/node-bindings) package to load the compiled module. + +Note that while the `bindings` package implementation is more sophisticated +in how it locates Addon modules, it is essentially using a try-catch pattern +similar to: + +```None +try { + return require('./build/Release/addon.node'); +} catch (err) { + return require('./build/Debug/addon.node'); +} +``` + +### Linking to Node.js' own dependencies[#](#addons_linking_to_node_js_own_dependencies) + +Node.js uses a number of statically linked libraries such as V8, libuv and +OpenSSL. All Addons are required to link to V8 and may link to any of the +other dependencies as well. Typically, this is as simple as including +the appropriate `#include <...>` statements (e.g. `#include `) and +`node-gyp` will locate the appropriate headers automatically. However, there +are a few caveats to be aware of: + +* When `node-gyp` runs, it will detect the specific release version of Node.js + and download either the full source tarball or just the headers. If the full + source is downloaded, Addons will have complete access to the full set of + Node.js dependencies. However, if only the Node.js headers are downloaded, then + only the symbols exported by Node.js will be available. +* `node-gyp` can be run using the `--nodedir` flag pointing at a local Node.js + source image. Using this option, the Addon will have access to the full set of + dependencies. + +### Loading Addons using require()[#](#addons_loading_addons_using_require) + +The filename extension of the compiled Addon binary is `.node` (as opposed +to `.dll` or `.so`). The [`require()`](modules.html#modules_require) function is written to look for +files with the `.node` file extension and initialize those as dynamically-linked +libraries. + +When calling [`require()`](modules.html#modules_require), the `.node` extension can usually be +omitted and Node.js will still find and initialize the Addon. One caveat, +however, is that Node.js will first attempt to locate and load modules or +JavaScript files that happen to share the same base name. For instance, if +there is a file `addon.js` in the same directory as the binary `addon.node`, +then [`require('addon')`](modules.html#modules_require) will give precedence to the `addon.js` file +and load it instead. + +## Native Abstractions for Node.js[#](#addons_native_abstractions_for_node_js) + +Each of the examples illustrated in this document make direct use of the +Node.js and V8 APIs for implementing Addons. It is important to understand +that the V8 API can, and has, changed dramatically from one V8 release to the +next (and one major Node.js release to the next). With each change, Addons may +need to be updated and recompiled in order to continue functioning. The Node.js +release schedule is designed to minimize the frequency and impact of such +changes but there is little that Node.js can do currently to ensure stability +of the V8 APIs. + +The [Native Abstractions for Node.js](https://github.com/nodejs/nan) (or `nan`) provide a set of tools that +Addon developers are recommended to use to keep compatibility between past and +future releases of V8 and Node.js. See the `nan` [examples](https://github.com/nodejs/nan/tree/master/examples/) for an +illustration of how it can be used. + +## N-API[#](#addons_n_api) + +[Stability: 1](documentation.html#documentation_stability_index) - Experimental + +N-API is an API for building native Addons. It is independent from +the underlying JavaScript runtime (e.g. V8) and is maintained as part of +Node.js itself. This API will be Application Binary Interface (ABI) stable +across version of Node.js. It is intended to insulate Addons from +changes in the underlying JavaScript engine and allow modules +compiled for one version to run on later versions of Node.js without +recompilation. Addons are built/packaged with the same approach/tools +outlined in this document (node-gyp, etc.). The only difference is the +set of APIs that are used by the native code. Instead of using the V8 +or [Native Abstractions for Node.js](https://github.com/nodejs/nan) APIs, the functions available +in the N-API are used. + +To use N-API in the above "Hello world" example, replace the content of +`hello.cc` with the following. All other instructions remain the same. + +```None +// hello.cc using N-API +#include + +namespace demo { + +napi_value Method(napi_env env, napi_callback_info args) { + napi_value greeting; + napi_status status; + + status = napi_create_string_utf8(env, "hello", NAPI_AUTO_LENGTH, &greeting); + if (status != napi_ok) return nullptr; + return greeting; +} + +napi_value init(napi_env env, napi_value exports) { + napi_status status; + napi_value fn; + + status = napi_create_function(env, nullptr, 0, Method, nullptr, &fn); + if (status != napi_ok) return nullptr; + + status = napi_set_named_property(env, exports, "hello", fn); + if (status != napi_ok) return nullptr; + return exports; +} + +NAPI_MODULE(NODE_GYP_MODULE_NAME, init) + +} // namespace demo +``` + +The functions available and how to use them are documented in the +section titled [C/C++ Addons - N-API](n-api.html). + +## Addon examples[#](#addons_addon_examples) + +Following are some example Addons intended to help developers get started. The +examples make use of the V8 APIs. Refer to the online [V8 reference](https://v8docs.nodesource.com/) +for help with the various V8 calls, and V8's [Embedder's Guide](https://github.com/v8/v8/wiki/Embedder's%20Guide) for an +explanation of several concepts used such as handles, scopes, function +templates, etc. + +Each of these examples using the following `binding.gyp` file: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ "addon.cc" ] + } + ] +} +``` + +In cases where there is more than one `.cc` file, simply add the additional +filename to the `sources` array: + +```None +"sources": ["addon.cc", "myexample.cc"] +``` + +Once the `binding.gyp` file is ready, the example Addons can be configured and +built using `node-gyp`: + +```None +$ node-gyp configure build +``` + +### Function arguments[#](#addons_function_arguments) + +Addons will typically expose objects and functions that can be accessed from +JavaScript running within Node.js. When functions are invoked from JavaScript, +the input arguments and return value must be mapped to and from the C/C++ +code. + +The following example illustrates how to read function arguments passed from +JavaScript and how to return a result: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Exception; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::String; +using v8::Value; + +// This is the implementation of the "add" method +// Input arguments are passed using the +// const FunctionCallbackInfo& args struct +void Add(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + // Check the number of arguments passed. + if (args.Length() < 2) { + // Throw an Error that is passed back to JavaScript + isolate->ThrowException(Exception::TypeError( + String::NewFromUtf8(isolate, "Wrong number of arguments"))); + return; + } + + // Check the argument types + if (!args[0]->IsNumber() || !args[1]->IsNumber()) { + isolate->ThrowException(Exception::TypeError( + String::NewFromUtf8(isolate, "Wrong arguments"))); + return; + } + + // Perform the operation + double value = args[0]->NumberValue() + args[1]->NumberValue(); + Local num = Number::New(isolate, value); + + // Set the return value (using the passed in + // FunctionCallbackInfo&) + args.GetReturnValue().Set(num); +} + +void Init(Local exports) { + NODE_SET_METHOD(exports, "add", Add); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, Init) + +} // namespace demo +``` + +Once compiled, the example Addon can be required and used from within Node.js: + +```None +// test.js +const addon = require('./build/Release/addon'); + +console.log('This should be eight:', addon.add(3, 5)); +``` + +### Callbacks[#](#addons_callbacks) + +It is common practice within Addons to pass JavaScript functions to a C++ +function and execute them from there. The following example illustrates how +to invoke such callbacks: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Null; +using v8::Object; +using v8::String; +using v8::Value; + +void RunCallback(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + Local cb = Local::Cast(args[0]); + const unsigned argc = 1; + Local argv[argc] = { String::NewFromUtf8(isolate, "hello world") }; + cb->Call(Null(isolate), argc, argv); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", RunCallback); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, Init) + +} // namespace demo +``` + +Note that this example uses a two-argument form of `Init()` that receives +the full `module` object as the second argument. This allows the Addon +to completely overwrite `exports` with a single function instead of +adding the function as a property of `exports`. + +To test it, run the following JavaScript: + +```None +// test.js +const addon = require('./build/Release/addon'); + +addon((msg) => { + console.log(msg); +// Prints: 'hello world' +}); +``` + +Note that, in this example, the callback function is invoked synchronously. + +### Object factory[#](#addons_object_factory) + +Addons can create and return new objects from within a C++ function as +illustrated in the following example. An object is created and returned with a +property `msg` that echoes the string passed to `createObject()`: + +```None +// addon.cc +#include + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + Local obj = Object::New(isolate); + obj->Set(String::NewFromUtf8(isolate, "msg"), args[0]->ToString()); + + args.GetReturnValue().Set(obj); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", CreateObject); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, Init) + +} // namespace demo +``` + +To test it in JavaScript: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const obj1 = addon('hello'); +const obj2 = addon('world'); +console.log(obj1.msg, obj2.msg); +// Prints: 'hello world' +``` + +### Function factory[#](#addons_function_factory) + +Another common scenario is creating JavaScript functions that wrap C++ +functions and returning those back to JavaScript: + +```None +// addon.cc +#include + +namespace demo { + +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void MyFunction(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, "hello world")); +} + +void CreateFunction(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + Local tpl = FunctionTemplate::New(isolate, MyFunction); + Local fn = tpl->GetFunction(); + + // omit this to make it anonymous + fn->SetName(String::NewFromUtf8(isolate, "theFunction")); + + args.GetReturnValue().Set(fn); +} + +void Init(Local exports, Local module) { + NODE_SET_METHOD(module, "exports", CreateFunction); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, Init) + +} // namespace demo +``` + +To test: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const fn = addon(); +console.log(fn()); +// Prints: 'hello world' +``` + +### Wrapping C++ objects[#](#addons_wrapping_c_objects) + +It is also possible to wrap C++ objects/classes in a way that allows new +instances to be created using the JavaScript `new` operator: + +```None +// addon.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Local; +using v8::Object; + +void InitAll(Local exports) { + MyObject::Init(exports); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, InitAll) + +} // namespace demo +``` + +Then, in `myobject.h`, the wrapper class inherits from `node::ObjectWrap`: + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Local exports); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static void PlusOne(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +In `myobject.cc`, implement the various methods that are to be exposed. +Below, the method `plusOne()` is exposed by adding it to the constructor's +prototype: + +```None +// myobject.cc +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Local exports) { + Isolate* isolate = exports->GetIsolate(); + + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); + + constructor.Reset(isolate, tpl->GetFunction()); + exports->Set(String::NewFromUtf8(isolate, "MyObject"), + tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local context = isolate->GetCurrentContext(); + Local cons = Local::New(isolate, constructor); + Local result = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(result); + } +} + +void MyObject::PlusOne(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + obj->value_ += 1; + + args.GetReturnValue().Set(Number::New(isolate, obj->value_)); +} + +} // namespace demo +``` + +To build this example, the `myobject.cc` file must be added to the +`binding.gyp`: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ + "addon.cc", + "myobject.cc" + ] + } + ] +} +``` + +Test it with: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const obj = new addon.MyObject(10); +console.log(obj.plusOne()); +// Prints: 11 +console.log(obj.plusOne()); +// Prints: 12 +console.log(obj.plusOne()); +// Prints: 13 +``` + +### Factory of wrapped objects[#](#addons_factory_of_wrapped_objects) + +Alternatively, it is possible to use a factory pattern to avoid explicitly +creating object instances using the JavaScript `new` operator: + +```None +const obj = addon.createObject(); +// instead of: +// const obj = new addon.Object(); +``` + +First, the `createObject()` method is implemented in `addon.cc`: + +```None +// addon.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + MyObject::NewInstance(args); +} + +void InitAll(Local exports, Local module) { + MyObject::Init(exports->GetIsolate()); + + NODE_SET_METHOD(module, "exports", CreateObject); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, InitAll) + +} // namespace demo +``` + +In `myobject.h`, the static method `NewInstance()` is added to handle +instantiating the object. This method takes the place of using `new` in +JavaScript: + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Isolate* isolate); + static void NewInstance(const v8::FunctionCallbackInfo& args); + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static void PlusOne(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +The implementation in `myobject.cc` is similar to the previous example: + +```None +// myobject.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Isolate* isolate) { + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne); + + constructor.Reset(isolate, tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local context = isolate->GetCurrentContext(); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(instance); + } +} + +void MyObject::NewInstance(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + const unsigned argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local context = isolate->GetCurrentContext(); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + + args.GetReturnValue().Set(instance); +} + +void MyObject::PlusOne(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj = ObjectWrap::Unwrap(args.Holder()); + obj->value_ += 1; + + args.GetReturnValue().Set(Number::New(isolate, obj->value_)); +} + +} // namespace demo +``` + +Once again, to build this example, the `myobject.cc` file must be added to the +`binding.gyp`: + +```None +{ + "targets": [ + { + "target_name": "addon", + "sources": [ + "addon.cc", + "myobject.cc" + ] + } + ] +} +``` + +Test it with: + +```None +// test.js +const createObject = require('./build/Release/addon'); + +const obj = createObject(10); +console.log(obj.plusOne()); +// Prints: 11 +console.log(obj.plusOne()); +// Prints: 12 +console.log(obj.plusOne()); +// Prints: 13 + +const obj2 = createObject(20); +console.log(obj2.plusOne()); +// Prints: 21 +console.log(obj2.plusOne()); +// Prints: 22 +console.log(obj2.plusOne()); +// Prints: 23 +``` + +### Passing wrapped objects around[#](#addons_passing_wrapped_objects_around) + +In addition to wrapping and returning C++ objects, it is possible to pass +wrapped objects around by unwrapping them with the Node.js helper function +`node::ObjectWrap::Unwrap`. The following examples shows a function `add()` +that can take two `MyObject` objects as input arguments: + +```None +// addon.cc +#include +#include +#include "myobject.h" + +namespace demo { + +using v8::FunctionCallbackInfo; +using v8::Isolate; +using v8::Local; +using v8::Number; +using v8::Object; +using v8::String; +using v8::Value; + +void CreateObject(const FunctionCallbackInfo& args) { + MyObject::NewInstance(args); +} + +void Add(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + MyObject* obj1 = node::ObjectWrap::Unwrap( + args[0]->ToObject()); + MyObject* obj2 = node::ObjectWrap::Unwrap( + args[1]->ToObject()); + + double sum = obj1->value() + obj2->value(); + args.GetReturnValue().Set(Number::New(isolate, sum)); +} + +void InitAll(Local exports) { + MyObject::Init(exports->GetIsolate()); + + NODE_SET_METHOD(exports, "createObject", CreateObject); + NODE_SET_METHOD(exports, "add", Add); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, InitAll) + +} // namespace demo +``` + +In `myobject.h`, a new public method is added to allow access to private values +after unwrapping the object. + +```None +// myobject.h +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include +#include + +namespace demo { + +class MyObject : public node::ObjectWrap { + public: + static void Init(v8::Isolate* isolate); + static void NewInstance(const v8::FunctionCallbackInfo& args); + inline double value() const { return value_; } + + private: + explicit MyObject(double value = 0); + ~MyObject(); + + static void New(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + double value_; +}; + +} // namespace demo + +#endif +``` + +The implementation of `myobject.cc` is similar to before: + +```None +// myobject.cc +#include +#include "myobject.h" + +namespace demo { + +using v8::Context; +using v8::Function; +using v8::FunctionCallbackInfo; +using v8::FunctionTemplate; +using v8::Isolate; +using v8::Local; +using v8::Object; +using v8::Persistent; +using v8::String; +using v8::Value; + +Persistent MyObject::constructor; + +MyObject::MyObject(double value) : value_(value) { +} + +MyObject::~MyObject() { +} + +void MyObject::Init(Isolate* isolate) { + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject")); + tpl->InstanceTemplate()->SetInternalFieldCount(1); + + constructor.Reset(isolate, tpl->GetFunction()); +} + +void MyObject::New(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + if (args.IsConstructCall()) { + // Invoked as constructor: `new MyObject(...)` + double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue(); + MyObject* obj = new MyObject(value); + obj->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + // Invoked as plain function `MyObject(...)`, turn into construct call. + const int argc = 1; + Local argv[argc] = { args[0] }; + Local context = isolate->GetCurrentContext(); + Local cons = Local::New(isolate, constructor); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + args.GetReturnValue().Set(instance); + } +} + +void MyObject::NewInstance(const FunctionCallbackInfo& args) { + Isolate* isolate = args.GetIsolate(); + + const unsigned argc = 1; + Local argv[argc] = { args[0] }; + Local cons = Local::New(isolate, constructor); + Local context = isolate->GetCurrentContext(); + Local instance = + cons->NewInstance(context, argc, argv).ToLocalChecked(); + + args.GetReturnValue().Set(instance); +} + +} // namespace demo +``` + +Test it with: + +```None +// test.js +const addon = require('./build/Release/addon'); + +const obj1 = addon.createObject(10); +const obj2 = addon.createObject(20); +const result = addon.add(obj1, obj2); + +console.log(result); +// Prints: 30 +``` + +### AtExit hooks[#](#addons_atexit_hooks) + +An "AtExit" hook is a function that is invoked after the Node.js event loop +has ended but before the JavaScript VM is terminated and Node.js shuts down. +"AtExit" hooks are registered using the `node::AtExit` API. + +#### void AtExit(callback, args)[#](#addons_void_atexit_callback_args) + +* `callback` A pointer to the function to call at exit. +* `args` A pointer to pass to the callback at exit. + +Registers exit hooks that run after the event loop has ended but before the VM +is killed. + +AtExit takes two parameters: a pointer to a callback function to run at exit, +and a pointer to untyped context data to be passed to that callback. + +Callbacks are run in last-in first-out order. + +The following `addon.cc` implements AtExit: + +```None +// addon.cc +#include +#include +#include + +namespace demo { + +using node::AtExit; +using v8::HandleScope; +using v8::Isolate; +using v8::Local; +using v8::Object; + +static char cookie[] = "yum yum"; +static int at_exit_cb1_called = 0; +static int at_exit_cb2_called = 0; + +static void at_exit_cb1(void* arg) { + Isolate* isolate = static_cast(arg); + HandleScope scope(isolate); + Local obj = Object::New(isolate); + assert(!obj.IsEmpty()); // assert VM is still alive + assert(obj->IsObject()); + at_exit_cb1_called++; +} + +static void at_exit_cb2(void* arg) { + assert(arg == static_cast(cookie)); + at_exit_cb2_called++; +} + +static void sanity_check(void*) { + assert(at_exit_cb1_called == 1); + assert(at_exit_cb2_called == 2); +} + +void init(Local exports) { + AtExit(at_exit_cb2, cookie); + AtExit(at_exit_cb2, cookie); + AtExit(at_exit_cb1, exports->GetIsolate()); + AtExit(sanity_check); +} + +NODE_MODULE(NODE_GYP_MODULE_NAME, init) + +} // namespace demo +``` + +Test in JavaScript by running: + +```None +// test.js +require('./build/Release/addon'); +``` diff --git a/corpus/docs/nodejs/async_hooks/async_hooks_10x.md b/corpus/docs/nodejs/async_hooks/async_hooks_10x.md new file mode 100644 index 0000000000000000000000000000000000000000..75d4031e25011a127e002e8508891ca309e9cf4d --- /dev/null +++ b/corpus/docs/nodejs/async_hooks/async_hooks_10x.md @@ -0,0 +1,713 @@ +# Async Hooks# + +Source: https://nodejs.org/docs/latest-v10.x/api/async_hooks.html +Version: 10.x + +[Stability: 1](documentation.html#documentation_stability_index) - Experimental + +The `async_hooks` module provides an API to register callbacks tracking the +lifetime of asynchronous resources created inside a Node.js application. +It can be accessed using: + +```None +const async_hooks = require('async_hooks'); +``` + +## Terminology[#](#async_hooks_terminology) + +An asynchronous resource represents an object with an associated callback. +This callback may be called multiple times, for example, the `'connection'` +event in `net.createServer()`, or just a single time like in `fs.open()`. +A resource can also be closed before the callback is called. `AsyncHook` does +not explicitly distinguish between these different cases but will represent them +as the abstract concept that is a resource. + +If [`Worker`](worker_threads.html#worker_threads_class_worker)s are used, each thread has an independent `async_hooks` +interface, and each thread will use a new set of async IDs. + +## Public API[#](#async_hooks_public_api) + +### Overview[#](#async_hooks_overview) + +Following is a simple overview of the public API. + +```None +const async_hooks = require('async_hooks'); + +// Return the ID of the current execution context. +const eid = async_hooks.executionAsyncId(); + +// Return the ID of the handle responsible for triggering the callback of the +// current execution scope to call. +const tid = async_hooks.triggerAsyncId(); + +// Create a new AsyncHook instance. All of these callbacks are optional. +const asyncHook = + async_hooks.createHook({ init, before, after, destroy, promiseResolve }); + +// Allow callbacks of this AsyncHook instance to call. This is not an implicit +// action after running the constructor, and must be explicitly run to begin +// executing callbacks. +asyncHook.enable(); + +// Disable listening for new asynchronous events. +asyncHook.disable(); + +// +// The following are the callbacks that can be passed to createHook(). +// + +// init is called during object construction. The resource may not have +// completed construction when this callback runs, therefore all fields of the +// resource referenced by "asyncId" may not have been populated. +function init(asyncId, type, triggerAsyncId, resource) { } + +// before is called just before the resource's callback is called. It can be +// called 0-N times for handles (e.g. TCPWrap), and will be called exactly 1 +// time for requests (e.g. FSReqWrap). +function before(asyncId) { } + +// after is called just after the resource's callback has finished. +function after(asyncId) { } + +// destroy is called when an AsyncWrap instance is destroyed. +function destroy(asyncId) { } + +// promiseResolve is called only for promise resources, when the +// `resolve` function passed to the `Promise` constructor is invoked +// (either directly or through other means of resolving a promise). +function promiseResolve(asyncId) { } +``` + +#### async\_hooks.createHook(callbacks)[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/async_hooks.js#L121)[#](#async_hooks_async_hooks_createhook_callbacks) + +Added in: v8.1.0 + +* `callbacks` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) The [Hook Callbacks](#async_hooks_hook_callbacks) to register + + + `init` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The [`init` callback](#async_hooks_init_asyncid_type_triggerasyncid_resource). + + `before` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The [`before` callback](#async_hooks_before_asyncid). + + `after` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The [`after` callback](#async_hooks_after_asyncid). + + `destroy` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The [`destroy` callback](#async_hooks_destroy_asyncid). +* Returns: [](async_hooks.html#async_hooks_async_hooks_createhook_callbacks) Instance used for disabling and enabling hooks + +Registers functions to be called for different lifetime events of each async +operation. + +The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the +respective asynchronous event during a resource's lifetime. + +All callbacks are optional. For example, if only resource cleanup needs to +be tracked, then only the `destroy` callback needs to be passed. The +specifics of all functions that can be passed to `callbacks` is in the +[Hook Callbacks](#async_hooks_hook_callbacks) section. + +```None +const async_hooks = require('async_hooks'); + +const asyncHook = async_hooks.createHook({ + init(asyncId, type, triggerAsyncId, resource) { }, + destroy(asyncId) { } +}); +``` + +Note that the callbacks will be inherited via the prototype chain: + +```None +class MyAsyncCallbacks { + init(asyncId, type, triggerAsyncId, resource) { } + destroy(asyncId) {} +} + +class MyAddedCallbacks extends MyAsyncCallbacks { + before(asyncId) { } + after(asyncId) { } +} + +const asyncHook = async_hooks.createHook(new MyAddedCallbacks()); +``` + +##### Error Handling[#](#async_hooks_error_handling) + +If any `AsyncHook` callbacks throw, the application will print the stack trace +and exit. The exit path does follow that of an uncaught exception, but +all `'uncaughtException'` listeners are removed, thus forcing the process to +exit. The `'exit'` callbacks will still be called unless the application is run +with `--abort-on-uncaught-exception`, in which case a stack trace will be +printed and the application exits, leaving a core file. + +The reason for this error handling behavior is that these callbacks are running +at potentially volatile points in an object's lifetime, for example during +class construction and destruction. Because of this, it is deemed necessary to +bring down the process quickly in order to prevent an unintentional abort in the +future. This is subject to change in the future if a comprehensive analysis is +performed to ensure an exception can follow the normal control flow without +unintentional side effects. + +##### Printing in AsyncHooks callbacks[#](#async_hooks_printing_in_asynchooks_callbacks) + +Because printing to the console is an asynchronous operation, `console.log()` +will cause the AsyncHooks callbacks to be called. Using `console.log()` or +similar asynchronous operations inside an AsyncHooks callback function will thus +cause an infinite recursion. An easy solution to this when debugging is to use a +synchronous logging operation such as `fs.writeFileSync(file, msg, flag)`. +This will print to the file and will not invoke AsyncHooks recursively because +it is synchronous. + +```None +const fs = require('fs'); +const util = require('util'); + +function debug(...args) { + // use a function like this one when debugging inside an AsyncHooks callback + fs.writeFileSync('log.out', `${util.format(...args)}\n`, { flag: 'a' }); +} +``` + +If an asynchronous operation is needed for logging, it is possible to keep +track of what caused the asynchronous operation using the information +provided by AsyncHooks itself. The logging should then be skipped when +it was the logging itself that caused AsyncHooks callback to call. By +doing this the otherwise infinite recursion is broken. + +#### asyncHook.enable()[#](#async_hooks_asynchook_enable) + +* Returns: [](async_hooks.html#async_hooks_async_hooks_createhook_callbacks) A reference to `asyncHook`. + +Enable the callbacks for a given `AsyncHook` instance. If no callbacks are +provided enabling is a noop. + +The `AsyncHook` instance is disabled by default. If the `AsyncHook` instance +should be enabled immediately after creation, the following pattern can be used. + +```None +const async_hooks = require('async_hooks'); + +const hook = async_hooks.createHook(callbacks).enable(); +``` + +#### asyncHook.disable()[#](#async_hooks_asynchook_disable) + +* Returns: [](async_hooks.html#async_hooks_async_hooks_createhook_callbacks) A reference to `asyncHook`. + +Disable the callbacks for a given `AsyncHook` instance from the global pool of +`AsyncHook` callbacks to be executed. Once a hook has been disabled it will not +be called again until enabled. + +For API consistency `disable()` also returns the `AsyncHook` instance. + +#### Hook Callbacks[#](#async_hooks_hook_callbacks) + +Key events in the lifetime of asynchronous events have been categorized into +four areas: instantiation, before/after the callback is called, and when the +instance is destroyed. + +##### init(asyncId, type, triggerAsyncId, resource)[#](#async_hooks_init_asyncid_type_triggerasyncid_resource) + +* `asyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) A unique ID for the async resource. +* `type` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The type of the async resource. +* `triggerAsyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The unique ID of the async resource in whose + execution context this async resource was created. +* `resource` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Reference to the resource representing the async + operation, needs to be released during *destroy*. + +Called when a class is constructed that has the *possibility* to emit an +asynchronous event. This *does not* mean the instance must call +`before`/`after` before `destroy` is called, only that the possibility +exists. + +This behavior can be observed by doing something like opening a resource then +closing it before the resource can be used. The following snippet demonstrates +this. + +```None +require('net').createServer().listen(function() { this.close(); }); +// OR +clearTimeout(setTimeout(() => {}, 10)); +``` + +Every new resource is assigned an ID that is unique within the scope of the +current Node.js instance. + +###### `type`[#](#async_hooks_type) + +The `type` is a string identifying the type of resource that caused +`init` to be called. Generally, it will correspond to the name of the +resource's constructor. + +```None +FSEVENTWRAP, FSREQWRAP, GETADDRINFOREQWRAP, GETNAMEINFOREQWRAP, HTTPPARSER, +JSSTREAM, PIPECONNECTWRAP, PIPEWRAP, PROCESSWRAP, QUERYWRAP, SHUTDOWNWRAP, +SIGNALWRAP, STATWATCHER, TCPCONNECTWRAP, TCPSERVERWRAP, TCPWRAP, TIMERWRAP, +TTYWRAP, UDPSENDWRAP, UDPWRAP, WRITEWRAP, ZLIB, SSLCONNECTION, PBKDF2REQUEST, +RANDOMBYTESREQUEST, TLSWRAP, Timeout, Immediate, TickObject +``` + +There is also the `PROMISE` resource type, which is used to track `Promise` +instances and asynchronous work scheduled by them. + +Users are able to define their own `type` when using the public embedder API. + +It is possible to have type name collisions. Embedders are encouraged to use +unique prefixes, such as the npm package name, to prevent collisions when +listening to the hooks. + +###### `triggerAsyncId`[#](#async_hooks_triggerasyncid) + +`triggerAsyncId` is the `asyncId` of the resource that caused (or "triggered") +the new resource to initialize and that caused `init` to call. This is different +from `async_hooks.executionAsyncId()` that only shows *when* a resource was +created, while `triggerAsyncId` shows *why* a resource was created. + +The following is a simple demonstration of `triggerAsyncId`: + +```None +async_hooks.createHook({ + init(asyncId, type, triggerAsyncId) { + const eid = async_hooks.executionAsyncId(); + fs.writeSync( + 1, `${type}(${asyncId}): trigger: ${triggerAsyncId} execution: ${eid}\n`); + } +}).enable(); + +require('net').createServer((conn) => {}).listen(8080); +``` + +Output when hitting the server with `nc localhost 8080`: + +```None +TCPSERVERWRAP(5): trigger: 1 execution: 1 +TCPWRAP(7): trigger: 5 execution: 0 +``` + +The `TCPSERVERWRAP` is the server which receives the connections. + +The `TCPWRAP` is the new connection from the client. When a new +connection is made, the `TCPWrap` instance is immediately constructed. This +happens outside of any JavaScript stack. (An `executionAsyncId()` of `0` means +that it is being executed from C++ with no JavaScript stack above it.) With only +that information, it would be impossible to link resources together in +terms of what caused them to be created, so `triggerAsyncId` is given the task +of propagating what resource is responsible for the new resource's existence. + +###### `resource`[#](#async_hooks_resource) + +`resource` is an object that represents the actual async resource that has +been initialized. This can contain useful information that can vary based on +the value of `type`. For instance, for the `GETADDRINFOREQWRAP` resource type, +`resource` provides the hostname used when looking up the IP address for the +host in `net.Server.listen()`. The API for accessing this information is +currently not considered public, but using the Embedder API, users can provide +and document their own resource objects. For example, such a resource object +could contain the SQL query being executed. + +In the case of Promises, the `resource` object will have `promise` property +that refers to the `Promise` that is being initialized, and an +`isChainedPromise` property, set to `true` if the promise has a parent promise, +and `false` otherwise. For example, in the case of `b = a.then(handler)`, `a` is +considered a parent `Promise` of `b`. Here, `b` is considered a chained promise. + +In some cases the resource object is reused for performance reasons, it is +thus not safe to use it as a key in a `WeakMap` or add properties to it. + +###### Asynchronous context example[#](#async_hooks_asynchronous_context_example) + +The following is an example with additional information about the calls to +`init` between the `before` and `after` calls, specifically what the +callback to `listen()` will look like. The output formatting is slightly more +elaborate to make calling context easier to see. + +```None +let indent = 0; +async_hooks.createHook({ + init(asyncId, type, triggerAsyncId) { + const eid = async_hooks.executionAsyncId(); + const indentStr = ' '.repeat(indent); + fs.writeSync( + 1, + `${indentStr}${type}(${asyncId}):` + + ` trigger: ${triggerAsyncId} execution: ${eid}\n`); + }, + before(asyncId) { + const indentStr = ' '.repeat(indent); + fs.writeFileSync('log.out', + `${indentStr}before: ${asyncId}\n`, { flag: 'a' }); + indent += 2; + }, + after(asyncId) { + indent -= 2; + const indentStr = ' '.repeat(indent); + fs.writeFileSync('log.out', + `${indentStr}after: ${asyncId}\n`, { flag: 'a' }); + }, + destroy(asyncId) { + const indentStr = ' '.repeat(indent); + fs.writeFileSync('log.out', + `${indentStr}destroy: ${asyncId}\n`, { flag: 'a' }); + }, +}).enable(); + +require('net').createServer(() => {}).listen(8080, () => { + // Let's wait 10ms before logging the server started. + setTimeout(() => { + console.log('>>>', async_hooks.executionAsyncId()); + }, 10); +}); +``` + +Output from only starting the server: + +```None +TCPSERVERWRAP(5): trigger: 1 execution: 1 +TickObject(6): trigger: 5 execution: 1 +before: 6 + Timeout(7): trigger: 6 execution: 6 +after: 6 +destroy: 6 +before: 7 +>>> 7 + TickObject(8): trigger: 7 execution: 7 +after: 7 +before: 8 +after: 8 +``` + +As illustrated in the example, `executionAsyncId()` and `execution` each specify +the value of the current execution context; which is delineated by calls to +`before` and `after`. + +Only using `execution` to graph resource allocation results in the following: + +```None +Timeout(7) -> TickObject(6) -> root(1) +``` + +The `TCPSERVERWRAP` is not part of this graph, even though it was the reason for +`console.log()` being called. This is because binding to a port without a +hostname is a *synchronous* operation, but to maintain a completely asynchronous +API the user's callback is placed in a `process.nextTick()`. + +The graph only shows *when* a resource was created, not *why*, so to track +the *why* use `triggerAsyncId`. + +##### before(asyncId)[#](#async_hooks_before_asyncid) + +* `asyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +When an asynchronous operation is initiated (such as a TCP server receiving a +new connection) or completes (such as writing data to disk) a callback is +called to notify the user. The `before` callback is called just before said +callback is executed. `asyncId` is the unique identifier assigned to the +resource about to execute the callback. + +The `before` callback will be called 0 to N times. The `before` callback +will typically be called 0 times if the asynchronous operation was cancelled +or, for example, if no connections are received by a TCP server. Persistent +asynchronous resources like a TCP server will typically call the `before` +callback multiple times, while other operations like `fs.open()` will call +it only once. + +##### after(asyncId)[#](#async_hooks_after_asyncid) + +* `asyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Called immediately after the callback specified in `before` is completed. + +If an uncaught exception occurs during execution of the callback, then `after` +will run *after* the `'uncaughtException'` event is emitted or a `domain`'s +handler runs. + +##### destroy(asyncId)[#](#async_hooks_destroy_asyncid) + +* `asyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Called after the resource corresponding to `asyncId` is destroyed. It is also +called asynchronously from the embedder API `emitDestroy()`. + +Some resources depend on garbage collection for cleanup, so if a reference is +made to the `resource` object passed to `init` it is possible that `destroy` +will never be called, causing a memory leak in the application. If the resource +does not depend on garbage collection, then this will not be an issue. + +##### promiseResolve(asyncId)[#](#async_hooks_promiseresolve_asyncid) + +* `asyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Called when the `resolve` function passed to the `Promise` constructor is +invoked (either directly or through other means of resolving a promise). + +Note that `resolve()` does not do any observable synchronous work. + +The `Promise` is not necessarily fulfilled or rejected at this point if the +`Promise` was resolved by assuming the state of another `Promise`. + +```None +new Promise((resolve) => resolve(true)).then((a) => {}); +``` + +calls the following callbacks: + +```None +init for PROMISE with id 5, trigger id: 1 + promise resolve 5 # corresponds to resolve(true) +init for PROMISE with id 6, trigger id: 5 # the Promise returned by then() + before 6 # the then() callback is entered + promise resolve 6 # the then() callback resolves the promise by returning + after 6 +``` + +#### async\_hooks.executionAsyncId()[#](#async_hooks_async_hooks_executionasyncid) + +History + +| Version | Changes | +| --- | --- | +| v8.2.0 | Renamed from `currentId` | +| v8.1.0 | Added in: v8.1.0 | + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The `asyncId` of the current execution context. Useful to + track when something calls. + +```None +const async_hooks = require('async_hooks'); + +console.log(async_hooks.executionAsyncId()); // 1 - bootstrap +fs.open(path, 'r', (err, fd) => { + console.log(async_hooks.executionAsyncId()); // 6 - open() +}); +``` + +The ID returned from `executionAsyncId()` is related to execution timing, not +causality (which is covered by `triggerAsyncId()`): + +```None +const server = net.createServer((conn) => { + // Returns the ID of the server, not of the new connection, because the + // callback runs in the execution scope of the server's MakeCallback(). + async_hooks.executionAsyncId(); + +}).listen(port, () => { + // Returns the ID of a TickObject (i.e. process.nextTick()) because all + // callbacks passed to .listen() are wrapped in a nextTick(). + async_hooks.executionAsyncId(); +}); +``` + +Note that promise contexts may not get precise `executionAsyncIds` by default. +See the section on [promise execution tracking](#async_hooks_promise_execution_tracking). + +#### async\_hooks.triggerAsyncId()[#](#async_hooks_async_hooks_triggerasyncid) + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The ID of the resource responsible for calling the callback + that is currently being executed. + +```None +const server = net.createServer((conn) => { + // The resource that caused (or triggered) this callback to be called + // was that of the new connection. Thus the return value of triggerAsyncId() + // is the asyncId of "conn". + async_hooks.triggerAsyncId(); + +}).listen(port, () => { + // Even though all callbacks passed to .listen() are wrapped in a nextTick() + // the callback itself exists because the call to the server's .listen() + // was made. So the return value would be the ID of the server. + async_hooks.triggerAsyncId(); +}); +``` + +Note that promise contexts may not get valid `triggerAsyncId`s by default. See +the section on [promise execution tracking](#async_hooks_promise_execution_tracking). + +## Promise execution tracking[#](#async_hooks_promise_execution_tracking) + +By default, promise executions are not assigned `asyncId`s due to the relatively +expensive nature of the [promise introspection API](https://docs.google.com/document/d/1rda3yKGHimKIhg5YeoAmCOtyURgsbTH_qaYR79FELlk/edit) provided by +V8. This means that programs using promises or `async`/`await` will not get +correct execution and trigger ids for promise callback contexts by default. + +```None +const ah = require('async_hooks'); +Promise.resolve(1729).then(() => { + console.log(`eid ${ah.executionAsyncId()} tid ${ah.triggerAsyncId()}`); +}); +// produces: +// eid 1 tid 0 +``` + +Observe that the `then()` callback claims to have executed in the context of the +outer scope even though there was an asynchronous hop involved. Also note that +the `triggerAsyncId` value is `0`, which means that we are missing context about +the resource that caused (triggered) the `then()` callback to be executed. + +Installing async hooks via `async_hooks.createHook` enables promise execution +tracking: + +```None +const ah = require('async_hooks'); +ah.createHook({ init() {} }).enable(); // forces PromiseHooks to be enabled. +Promise.resolve(1729).then(() => { + console.log(`eid ${ah.executionAsyncId()} tid ${ah.triggerAsyncId()}`); +}); +// produces: +// eid 7 tid 6 +``` + +In this example, adding any actual hook function enabled the tracking of +promises. There are two promises in the example above; the promise created by +`Promise.resolve()` and the promise returned by the call to `then()`. In the +example above, the first promise got the `asyncId` `6` and the latter got +`asyncId` `7`. During the execution of the `then()` callback, we are executing +in the context of promise with `asyncId` `7`. This promise was triggered by +async resource `6`. + +Another subtlety with promises is that `before` and `after` callbacks are run +only on chained promises. That means promises not created by `then()`/`catch()` +will not have the `before` and `after` callbacks fired on them. For more details +see the details of the V8 [PromiseHooks](https://docs.google.com/document/d/1rda3yKGHimKIhg5YeoAmCOtyURgsbTH_qaYR79FELlk/edit) API. + +## JavaScript Embedder API[#](#async_hooks_javascript_embedder_api) + +Library developers that handle their own asynchronous resources performing tasks +like I/O, connection pooling, or managing callback queues may use the +`AsyncWrap` JavaScript API so that all the appropriate callbacks are called. + +### Class: AsyncResource[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/async_hooks.js#L141)[#](#async_hooks_class_asyncresource) + +The class `AsyncResource` is designed to be extended by the embedder's async +resources. Using this, users can easily trigger the lifetime events of their +own resources. + +The `init` hook will trigger when an `AsyncResource` is instantiated. + +The following is an overview of the `AsyncResource` API. + +```None +const { AsyncResource, executionAsyncId } = require('async_hooks'); + +// AsyncResource() is meant to be extended. Instantiating a +// new AsyncResource() also triggers init. If triggerAsyncId is omitted then +// async_hook.executionAsyncId() is used. +const asyncResource = new AsyncResource( + type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false } +); + +// Run a function in the execution context of the resource. This will +// * establish the context of the resource +// * trigger the AsyncHooks before callbacks +// * call the provided function `fn` with the supplied arguments +// * trigger the AsyncHooks after callbacks +// * restore the original execution context +asyncResource.runInAsyncScope(fn, thisArg, ...args); + +// Call AsyncHooks destroy callbacks. +asyncResource.emitDestroy(); + +// Return the unique ID assigned to the AsyncResource instance. +asyncResource.asyncId(); + +// Return the trigger ID for the AsyncResource instance. +asyncResource.triggerAsyncId(); +``` + +#### new AsyncResource(type[, options])[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/async_hooks.js#L142)[#](#async_hooks_new_asyncresource_type_options) + +* `type` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The type of async event. +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `triggerAsyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The ID of the execution context that created this + async event. **Default:** `executionAsyncId()`. + + `requireManualDestroy` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Disables automatic `emitDestroy` when the + object is garbage collected. This usually does not need to be set (even if + `emitDestroy` is called manually), unless the resource's `asyncId` is + retrieved and the sensitive API's `emitDestroy` is called with it. + **Default:** `false`. + +Example usage: + +```None +class DBQuery extends AsyncResource { + constructor(db) { + super('DBQuery'); + this.db = db; + } + + getInfo(query, callback) { + this.db.get(query, (err, data) => { + this.runInAsyncScope(callback, null, err, data); + }); + } + + close() { + this.db = null; + this.emitDestroy(); + } +} +``` + +#### asyncResource.runInAsyncScope(fn[, thisArg, ...args])[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/async_hooks.js#L184)[#](#async_hooks_asyncresource_runinasyncscope_fn_thisarg_args) + +Added in: v9.6.0 + +* `fn` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The function to call in the execution context of this async + resource. +* `thisArg` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) The receiver to be used for the function call. +* `...args` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) Optional arguments to pass to the function. + +Call the provided function with the provided arguments in the execution context +of the async resource. This will establish the context, trigger the AsyncHooks +before callbacks, call the function, trigger the AsyncHooks after callbacks, and +then restore the original execution context. + +#### asyncResource.emitBefore()[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/async_hooks.js#L172)[#](#async_hooks_asyncresource_emitbefore) + +Deprecated since: v9.6.0 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`asyncResource.runInAsyncScope()`](#async_hooks_asyncresource_runinasyncscope_fn_thisarg_args) instead. + +Call all `before` callbacks to notify that a new asynchronous execution context +is being entered. If nested calls to `emitBefore()` are made, the stack of +`asyncId`s will be tracked and properly unwound. + +`before` and `after` calls must be unwound in the same order that they +are called. Otherwise, an unrecoverable exception will occur and the process +will abort. For this reason, the `emitBefore` and `emitAfter` APIs are +considered deprecated. Please use `runInAsyncScope`, as it provides a much safer +alternative. + +#### asyncResource.emitAfter()[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/async_hooks.js#L178)[#](#async_hooks_asyncresource_emitafter) + +Deprecated since: v9.6.0 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`asyncResource.runInAsyncScope()`](#async_hooks_asyncresource_runinasyncscope_fn_thisarg_args) instead. + +Call all `after` callbacks. If nested calls to `emitBefore()` were made, then +make sure the stack is unwound properly. Otherwise an error will be thrown. + +If the user's callback throws an exception, `emitAfter()` will automatically be +called for all `asyncId`s on the stack if the error is handled by a domain or +`'uncaughtException'` handler. + +`before` and `after` calls must be unwound in the same order that they +are called. Otherwise, an unrecoverable exception will occur and the process +will abort. For this reason, the `emitBefore` and `emitAfter` APIs are +considered deprecated. Please use `runInAsyncScope`, as it provides a much safer +alternative. + +#### asyncResource.emitDestroy()[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/async_hooks.js#L195)[#](#async_hooks_asyncresource_emitdestroy) + +* Returns: [](async_hooks.html#async_hooks_class_asyncresource) A reference to `asyncResource`. + +Call all `destroy` hooks. This should only ever be called once. An error will +be thrown if it is called more than once. This **must** be manually called. If +the resource is left to be collected by the GC then the `destroy` hooks will +never be called. + +#### asyncResource.asyncId()[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/async_hooks.js#L201)[#](#async_hooks_asyncresource_asyncid) + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The unique `asyncId` assigned to the resource. + +#### asyncResource.triggerAsyncId()[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/async_hooks.js#L205)[#](#async_hooks_asyncresource_triggerasyncid) + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The same `triggerAsyncId` that is passed to the + `AsyncResource` constructor. diff --git a/corpus/docs/nodejs/async_hooks/async_hooks_11x.md b/corpus/docs/nodejs/async_hooks/async_hooks_11x.md new file mode 100644 index 0000000000000000000000000000000000000000..52c701ee61364b551a619f2eb0af4cb00ea94e4a --- /dev/null +++ b/corpus/docs/nodejs/async_hooks/async_hooks_11x.md @@ -0,0 +1,715 @@ +# Async Hooks# + +Source: https://nodejs.org/docs/latest-v11.x/api/async_hooks.html +Version: 11.x + +[Stability: 1](documentation.html#documentation_stability_index) - Experimental + +The `async_hooks` module provides an API to register callbacks tracking the +lifetime of asynchronous resources created inside a Node.js application. +It can be accessed using: + +```None +const async_hooks = require('async_hooks'); +``` + +## Terminology[#](#async_hooks_terminology) + +An asynchronous resource represents an object with an associated callback. +This callback may be called multiple times, for example, the `'connection'` +event in `net.createServer()`, or just a single time like in `fs.open()`. +A resource can also be closed before the callback is called. `AsyncHook` does +not explicitly distinguish between these different cases but will represent them +as the abstract concept that is a resource. + +If [`Worker`](worker_threads.html#worker_threads_class_worker)s are used, each thread has an independent `async_hooks` +interface, and each thread will use a new set of async IDs. + +## Public API[#](#async_hooks_public_api) + +### Overview[#](#async_hooks_overview) + +Following is a simple overview of the public API. + +```None +const async_hooks = require('async_hooks'); + +// Return the ID of the current execution context. +const eid = async_hooks.executionAsyncId(); + +// Return the ID of the handle responsible for triggering the callback of the +// current execution scope to call. +const tid = async_hooks.triggerAsyncId(); + +// Create a new AsyncHook instance. All of these callbacks are optional. +const asyncHook = + async_hooks.createHook({ init, before, after, destroy, promiseResolve }); + +// Allow callbacks of this AsyncHook instance to call. This is not an implicit +// action after running the constructor, and must be explicitly run to begin +// executing callbacks. +asyncHook.enable(); + +// Disable listening for new asynchronous events. +asyncHook.disable(); + +// +// The following are the callbacks that can be passed to createHook(). +// + +// init is called during object construction. The resource may not have +// completed construction when this callback runs, therefore all fields of the +// resource referenced by "asyncId" may not have been populated. +function init(asyncId, type, triggerAsyncId, resource) { } + +// Before is called just before the resource's callback is called. It can be +// called 0-N times for handles (e.g. TCPWrap), and will be called exactly 1 +// time for requests (e.g. FSReqCallback). +function before(asyncId) { } + +// After is called just after the resource's callback has finished. +function after(asyncId) { } + +// Destroy is called when an AsyncWrap instance is destroyed. +function destroy(asyncId) { } + +// promiseResolve is called only for promise resources, when the +// `resolve` function passed to the `Promise` constructor is invoked +// (either directly or through other means of resolving a promise). +function promiseResolve(asyncId) { } +``` + +#### async\_hooks.createHook(callbacks)[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/async_hooks.js#L121)[#](#async_hooks_async_hooks_createhook_callbacks) + +Added in: v8.1.0 + +* `callbacks` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) The [Hook Callbacks](#async_hooks_hook_callbacks) to register + + + `init` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The [`init` callback](#async_hooks_init_asyncid_type_triggerasyncid_resource). + + `before` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The [`before` callback](#async_hooks_before_asyncid). + + `after` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The [`after` callback](#async_hooks_after_asyncid). + + `destroy` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The [`destroy` callback](#async_hooks_destroy_asyncid). +* Returns: [](async_hooks.html#async_hooks_async_hooks_createhook_callbacks) Instance used for disabling and enabling hooks + +Registers functions to be called for different lifetime events of each async +operation. + +The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the +respective asynchronous event during a resource's lifetime. + +All callbacks are optional. For example, if only resource cleanup needs to +be tracked, then only the `destroy` callback needs to be passed. The +specifics of all functions that can be passed to `callbacks` is in the +[Hook Callbacks](#async_hooks_hook_callbacks) section. + +```None +const async_hooks = require('async_hooks'); + +const asyncHook = async_hooks.createHook({ + init(asyncId, type, triggerAsyncId, resource) { }, + destroy(asyncId) { } +}); +``` + +Note that the callbacks will be inherited via the prototype chain: + +```None +class MyAsyncCallbacks { + init(asyncId, type, triggerAsyncId, resource) { } + destroy(asyncId) {} +} + +class MyAddedCallbacks extends MyAsyncCallbacks { + before(asyncId) { } + after(asyncId) { } +} + +const asyncHook = async_hooks.createHook(new MyAddedCallbacks()); +``` + +##### Error Handling[#](#async_hooks_error_handling) + +If any `AsyncHook` callbacks throw, the application will print the stack trace +and exit. The exit path does follow that of an uncaught exception, but +all `'uncaughtException'` listeners are removed, thus forcing the process to +exit. The `'exit'` callbacks will still be called unless the application is run +with `--abort-on-uncaught-exception`, in which case a stack trace will be +printed and the application exits, leaving a core file. + +The reason for this error handling behavior is that these callbacks are running +at potentially volatile points in an object's lifetime, for example during +class construction and destruction. Because of this, it is deemed necessary to +bring down the process quickly in order to prevent an unintentional abort in the +future. This is subject to change in the future if a comprehensive analysis is +performed to ensure an exception can follow the normal control flow without +unintentional side effects. + +##### Printing in AsyncHooks callbacks[#](#async_hooks_printing_in_asynchooks_callbacks) + +Because printing to the console is an asynchronous operation, `console.log()` +will cause the AsyncHooks callbacks to be called. Using `console.log()` or +similar asynchronous operations inside an AsyncHooks callback function will thus +cause an infinite recursion. An easy solution to this when debugging is to use a +synchronous logging operation such as `fs.writeFileSync(file, msg, flag)`. +This will print to the file and will not invoke AsyncHooks recursively because +it is synchronous. + +```None +const fs = require('fs'); +const util = require('util'); + +function debug(...args) { + // Use a function like this one when debugging inside an AsyncHooks callback + fs.writeFileSync('log.out', `${util.format(...args)}\n`, { flag: 'a' }); +} +``` + +If an asynchronous operation is needed for logging, it is possible to keep +track of what caused the asynchronous operation using the information +provided by AsyncHooks itself. The logging should then be skipped when +it was the logging itself that caused AsyncHooks callback to call. By +doing this the otherwise infinite recursion is broken. + +#### asyncHook.enable()[#](#async_hooks_asynchook_enable) + +* Returns: [](async_hooks.html#async_hooks_async_hooks_createhook_callbacks) A reference to `asyncHook`. + +Enable the callbacks for a given `AsyncHook` instance. If no callbacks are +provided enabling is a noop. + +The `AsyncHook` instance is disabled by default. If the `AsyncHook` instance +should be enabled immediately after creation, the following pattern can be used. + +```None +const async_hooks = require('async_hooks'); + +const hook = async_hooks.createHook(callbacks).enable(); +``` + +#### asyncHook.disable()[#](#async_hooks_asynchook_disable) + +* Returns: [](async_hooks.html#async_hooks_async_hooks_createhook_callbacks) A reference to `asyncHook`. + +Disable the callbacks for a given `AsyncHook` instance from the global pool of +`AsyncHook` callbacks to be executed. Once a hook has been disabled it will not +be called again until enabled. + +For API consistency `disable()` also returns the `AsyncHook` instance. + +#### Hook Callbacks[#](#async_hooks_hook_callbacks) + +Key events in the lifetime of asynchronous events have been categorized into +four areas: instantiation, before/after the callback is called, and when the +instance is destroyed. + +##### init(asyncId, type, triggerAsyncId, resource)[#](#async_hooks_init_asyncid_type_triggerasyncid_resource) + +* `asyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) A unique ID for the async resource. +* `type` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The type of the async resource. +* `triggerAsyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The unique ID of the async resource in whose + execution context this async resource was created. +* `resource` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Reference to the resource representing the async + operation, needs to be released during *destroy*. + +Called when a class is constructed that has the *possibility* to emit an +asynchronous event. This *does not* mean the instance must call +`before`/`after` before `destroy` is called, only that the possibility +exists. + +This behavior can be observed by doing something like opening a resource then +closing it before the resource can be used. The following snippet demonstrates +this. + +```None +require('net').createServer().listen(function() { this.close(); }); +// OR +clearTimeout(setTimeout(() => {}, 10)); +``` + +Every new resource is assigned an ID that is unique within the scope of the +current Node.js instance. + +###### `type`[#](#async_hooks_type) + +The `type` is a string identifying the type of resource that caused +`init` to be called. Generally, it will correspond to the name of the +resource's constructor. + +```None +FSEVENTWRAP, FSREQCALLBACK, GETADDRINFOREQWRAP, GETNAMEINFOREQWRAP, HTTPPARSER, +JSSTREAM, PIPECONNECTWRAP, PIPEWRAP, PROCESSWRAP, QUERYWRAP, SHUTDOWNWRAP, +SIGNALWRAP, STATWATCHER, TCPCONNECTWRAP, TCPSERVERWRAP, TCPWRAP, TTYWRAP, +UDPSENDWRAP, UDPWRAP, WRITEWRAP, ZLIB, SSLCONNECTION, PBKDF2REQUEST, +RANDOMBYTESREQUEST, TLSWRAP, Microtask, Timeout, Immediate, TickObject +``` + +There is also the `PROMISE` resource type, which is used to track `Promise` +instances and asynchronous work scheduled by them. + +Users are able to define their own `type` when using the public embedder API. + +It is possible to have type name collisions. Embedders are encouraged to use +unique prefixes, such as the npm package name, to prevent collisions when +listening to the hooks. + +###### `triggerAsyncId`[#](#async_hooks_triggerasyncid) + +`triggerAsyncId` is the `asyncId` of the resource that caused (or "triggered") +the new resource to initialize and that caused `init` to call. This is different +from `async_hooks.executionAsyncId()` that only shows *when* a resource was +created, while `triggerAsyncId` shows *why* a resource was created. + +The following is a simple demonstration of `triggerAsyncId`: + +```None +async_hooks.createHook({ + init(asyncId, type, triggerAsyncId) { + const eid = async_hooks.executionAsyncId(); + fs.writeSync( + 1, `${type}(${asyncId}): trigger: ${triggerAsyncId} execution: ${eid}\n`); + } +}).enable(); + +require('net').createServer((conn) => {}).listen(8080); +``` + +Output when hitting the server with `nc localhost 8080`: + +```None +TCPSERVERWRAP(5): trigger: 1 execution: 1 +TCPWRAP(7): trigger: 5 execution: 0 +``` + +The `TCPSERVERWRAP` is the server which receives the connections. + +The `TCPWRAP` is the new connection from the client. When a new +connection is made, the `TCPWrap` instance is immediately constructed. This +happens outside of any JavaScript stack. (An `executionAsyncId()` of `0` means +that it is being executed from C++ with no JavaScript stack above it.) With only +that information, it would be impossible to link resources together in +terms of what caused them to be created, so `triggerAsyncId` is given the task +of propagating what resource is responsible for the new resource's existence. + +###### `resource`[#](#async_hooks_resource) + +`resource` is an object that represents the actual async resource that has +been initialized. This can contain useful information that can vary based on +the value of `type`. For instance, for the `GETADDRINFOREQWRAP` resource type, +`resource` provides the hostname used when looking up the IP address for the +host in `net.Server.listen()`. The API for accessing this information is +currently not considered public, but using the Embedder API, users can provide +and document their own resource objects. For example, such a resource object +could contain the SQL query being executed. + +In the case of Promises, the `resource` object will have `promise` property +that refers to the `Promise` that is being initialized, and an +`isChainedPromise` property, set to `true` if the promise has a parent promise, +and `false` otherwise. For example, in the case of `b = a.then(handler)`, `a` is +considered a parent `Promise` of `b`. Here, `b` is considered a chained promise. + +In some cases the resource object is reused for performance reasons, it is +thus not safe to use it as a key in a `WeakMap` or add properties to it. + +###### Asynchronous context example[#](#async_hooks_asynchronous_context_example) + +The following is an example with additional information about the calls to +`init` between the `before` and `after` calls, specifically what the +callback to `listen()` will look like. The output formatting is slightly more +elaborate to make calling context easier to see. + +```None +let indent = 0; +async_hooks.createHook({ + init(asyncId, type, triggerAsyncId) { + const eid = async_hooks.executionAsyncId(); + const indentStr = ' '.repeat(indent); + fs.writeSync( + 1, + `${indentStr}${type}(${asyncId}):` + + ` trigger: ${triggerAsyncId} execution: ${eid}\n`); + }, + before(asyncId) { + const indentStr = ' '.repeat(indent); + fs.writeFileSync('log.out', + `${indentStr}before: ${asyncId}\n`, { flag: 'a' }); + indent += 2; + }, + after(asyncId) { + indent -= 2; + const indentStr = ' '.repeat(indent); + fs.writeFileSync('log.out', + `${indentStr}after: ${asyncId}\n`, { flag: 'a' }); + }, + destroy(asyncId) { + const indentStr = ' '.repeat(indent); + fs.writeFileSync('log.out', + `${indentStr}destroy: ${asyncId}\n`, { flag: 'a' }); + }, +}).enable(); + +require('net').createServer(() => {}).listen(8080, () => { + // Let's wait 10ms before logging the server started. + setTimeout(() => { + console.log('>>>', async_hooks.executionAsyncId()); + }, 10); +}); +``` + +Output from only starting the server: + +```None +TCPSERVERWRAP(5): trigger: 1 execution: 1 +TickObject(6): trigger: 5 execution: 1 +before: 6 + Timeout(7): trigger: 6 execution: 6 +after: 6 +destroy: 6 +before: 7 +>>> 7 + TickObject(8): trigger: 7 execution: 7 +after: 7 +before: 8 +after: 8 +``` + +As illustrated in the example, `executionAsyncId()` and `execution` each specify +the value of the current execution context; which is delineated by calls to +`before` and `after`. + +Only using `execution` to graph resource allocation results in the following: + +```None +Timeout(7) -> TickObject(6) -> root(1) +``` + +The `TCPSERVERWRAP` is not part of this graph, even though it was the reason for +`console.log()` being called. This is because binding to a port without a +hostname is a *synchronous* operation, but to maintain a completely asynchronous +API the user's callback is placed in a `process.nextTick()`. + +The graph only shows *when* a resource was created, not *why*, so to track +the *why* use `triggerAsyncId`. + +##### before(asyncId)[#](#async_hooks_before_asyncid) + +* `asyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +When an asynchronous operation is initiated (such as a TCP server receiving a +new connection) or completes (such as writing data to disk) a callback is +called to notify the user. The `before` callback is called just before said +callback is executed. `asyncId` is the unique identifier assigned to the +resource about to execute the callback. + +The `before` callback will be called 0 to N times. The `before` callback +will typically be called 0 times if the asynchronous operation was cancelled +or, for example, if no connections are received by a TCP server. Persistent +asynchronous resources like a TCP server will typically call the `before` +callback multiple times, while other operations like `fs.open()` will call +it only once. + +##### after(asyncId)[#](#async_hooks_after_asyncid) + +* `asyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Called immediately after the callback specified in `before` is completed. + +If an uncaught exception occurs during execution of the callback, then `after` +will run *after* the `'uncaughtException'` event is emitted or a `domain`'s +handler runs. + +##### destroy(asyncId)[#](#async_hooks_destroy_asyncid) + +* `asyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Called after the resource corresponding to `asyncId` is destroyed. It is also +called asynchronously from the embedder API `emitDestroy()`. + +Some resources depend on garbage collection for cleanup, so if a reference is +made to the `resource` object passed to `init` it is possible that `destroy` +will never be called, causing a memory leak in the application. If the resource +does not depend on garbage collection, then this will not be an issue. + +##### promiseResolve(asyncId)[#](#async_hooks_promiseresolve_asyncid) + +Added in: v8.6.0 + +* `asyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Called when the `resolve` function passed to the `Promise` constructor is +invoked (either directly or through other means of resolving a promise). + +Note that `resolve()` does not do any observable synchronous work. + +The `Promise` is not necessarily fulfilled or rejected at this point if the +`Promise` was resolved by assuming the state of another `Promise`. + +```None +new Promise((resolve) => resolve(true)).then((a) => {}); +``` + +calls the following callbacks: + +```None +init for PROMISE with id 5, trigger id: 1 + promise resolve 5 # corresponds to resolve(true) +init for PROMISE with id 6, trigger id: 5 # the Promise returned by then() + before 6 # the then() callback is entered + promise resolve 6 # the then() callback resolves the promise by returning + after 6 +``` + +#### async\_hooks.executionAsyncId()[#](#async_hooks_async_hooks_executionasyncid) + +History + +| Version | Changes | +| --- | --- | +| v8.2.0 | Renamed from `currentId` | +| v8.1.0 | Added in: v8.1.0 | + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The `asyncId` of the current execution context. Useful to + track when something calls. + +```None +const async_hooks = require('async_hooks'); + +console.log(async_hooks.executionAsyncId()); // 1 - bootstrap +fs.open(path, 'r', (err, fd) => { + console.log(async_hooks.executionAsyncId()); // 6 - open() +}); +``` + +The ID returned from `executionAsyncId()` is related to execution timing, not +causality (which is covered by `triggerAsyncId()`): + +```None +const server = net.createServer((conn) => { + // Returns the ID of the server, not of the new connection, because the + // callback runs in the execution scope of the server's MakeCallback(). + async_hooks.executionAsyncId(); + +}).listen(port, () => { + // Returns the ID of a TickObject (i.e. process.nextTick()) because all + // callbacks passed to .listen() are wrapped in a nextTick(). + async_hooks.executionAsyncId(); +}); +``` + +Note that promise contexts may not get precise `executionAsyncIds` by default. +See the section on [promise execution tracking](#async_hooks_promise_execution_tracking). + +#### async\_hooks.triggerAsyncId()[#](#async_hooks_async_hooks_triggerasyncid) + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The ID of the resource responsible for calling the callback + that is currently being executed. + +```None +const server = net.createServer((conn) => { + // The resource that caused (or triggered) this callback to be called + // was that of the new connection. Thus the return value of triggerAsyncId() + // is the asyncId of "conn". + async_hooks.triggerAsyncId(); + +}).listen(port, () => { + // Even though all callbacks passed to .listen() are wrapped in a nextTick() + // the callback itself exists because the call to the server's .listen() + // was made. So the return value would be the ID of the server. + async_hooks.triggerAsyncId(); +}); +``` + +Note that promise contexts may not get valid `triggerAsyncId`s by default. See +the section on [promise execution tracking](#async_hooks_promise_execution_tracking). + +## Promise execution tracking[#](#async_hooks_promise_execution_tracking) + +By default, promise executions are not assigned `asyncId`s due to the relatively +expensive nature of the [promise introspection API](https://docs.google.com/document/d/1rda3yKGHimKIhg5YeoAmCOtyURgsbTH_qaYR79FELlk/edit) provided by +V8. This means that programs using promises or `async`/`await` will not get +correct execution and trigger ids for promise callback contexts by default. + +```None +const ah = require('async_hooks'); +Promise.resolve(1729).then(() => { + console.log(`eid ${ah.executionAsyncId()} tid ${ah.triggerAsyncId()}`); +}); +// produces: +// eid 1 tid 0 +``` + +Observe that the `then()` callback claims to have executed in the context of the +outer scope even though there was an asynchronous hop involved. Also note that +the `triggerAsyncId` value is `0`, which means that we are missing context about +the resource that caused (triggered) the `then()` callback to be executed. + +Installing async hooks via `async_hooks.createHook` enables promise execution +tracking: + +```None +const ah = require('async_hooks'); +ah.createHook({ init() {} }).enable(); // forces PromiseHooks to be enabled. +Promise.resolve(1729).then(() => { + console.log(`eid ${ah.executionAsyncId()} tid ${ah.triggerAsyncId()}`); +}); +// produces: +// eid 7 tid 6 +``` + +In this example, adding any actual hook function enabled the tracking of +promises. There are two promises in the example above; the promise created by +`Promise.resolve()` and the promise returned by the call to `then()`. In the +example above, the first promise got the `asyncId` `6` and the latter got +`asyncId` `7`. During the execution of the `then()` callback, we are executing +in the context of promise with `asyncId` `7`. This promise was triggered by +async resource `6`. + +Another subtlety with promises is that `before` and `after` callbacks are run +only on chained promises. That means promises not created by `then()`/`catch()` +will not have the `before` and `after` callbacks fired on them. For more details +see the details of the V8 [PromiseHooks](https://docs.google.com/document/d/1rda3yKGHimKIhg5YeoAmCOtyURgsbTH_qaYR79FELlk/edit) API. + +## JavaScript Embedder API[#](#async_hooks_javascript_embedder_api) + +Library developers that handle their own asynchronous resources performing tasks +like I/O, connection pooling, or managing callback queues may use the +`AsyncWrap` JavaScript API so that all the appropriate callbacks are called. + +### Class: AsyncResource[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/async_hooks.js#L141)[#](#async_hooks_class_asyncresource) + +The class `AsyncResource` is designed to be extended by the embedder's async +resources. Using this, users can easily trigger the lifetime events of their +own resources. + +The `init` hook will trigger when an `AsyncResource` is instantiated. + +The following is an overview of the `AsyncResource` API. + +```None +const { AsyncResource, executionAsyncId } = require('async_hooks'); + +// AsyncResource() is meant to be extended. Instantiating a +// new AsyncResource() also triggers init. If triggerAsyncId is omitted then +// async_hook.executionAsyncId() is used. +const asyncResource = new AsyncResource( + type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false } +); + +// Run a function in the execution context of the resource. This will +// * establish the context of the resource +// * trigger the AsyncHooks before callbacks +// * call the provided function `fn` with the supplied arguments +// * trigger the AsyncHooks after callbacks +// * restore the original execution context +asyncResource.runInAsyncScope(fn, thisArg, ...args); + +// Call AsyncHooks destroy callbacks. +asyncResource.emitDestroy(); + +// Return the unique ID assigned to the AsyncResource instance. +asyncResource.asyncId(); + +// Return the trigger ID for the AsyncResource instance. +asyncResource.triggerAsyncId(); +``` + +#### new AsyncResource(type[, options])[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/async_hooks.js#L142)[#](#async_hooks_new_asyncresource_type_options) + +* `type` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The type of async event. +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `triggerAsyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The ID of the execution context that created this + async event. **Default:** `executionAsyncId()`. + + `requireManualDestroy` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Disables automatic `emitDestroy` when the + object is garbage collected. This usually does not need to be set (even if + `emitDestroy` is called manually), unless the resource's `asyncId` is + retrieved and the sensitive API's `emitDestroy` is called with it. + **Default:** `false`. + +Example usage: + +```None +class DBQuery extends AsyncResource { + constructor(db) { + super('DBQuery'); + this.db = db; + } + + getInfo(query, callback) { + this.db.get(query, (err, data) => { + this.runInAsyncScope(callback, null, err, data); + }); + } + + close() { + this.db = null; + this.emitDestroy(); + } +} +``` + +#### asyncResource.runInAsyncScope(fn[, thisArg, ...args])[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/async_hooks.js#L184)[#](#async_hooks_asyncresource_runinasyncscope_fn_thisarg_args) + +Added in: v9.6.0 + +* `fn` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The function to call in the execution context of this async + resource. +* `thisArg` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) The receiver to be used for the function call. +* `...args` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) Optional arguments to pass to the function. + +Call the provided function with the provided arguments in the execution context +of the async resource. This will establish the context, trigger the AsyncHooks +before callbacks, call the function, trigger the AsyncHooks after callbacks, and +then restore the original execution context. + +#### asyncResource.emitBefore()[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/async_hooks.js#L172)[#](#async_hooks_asyncresource_emitbefore) + +Deprecated since: v9.6.0 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`asyncResource.runInAsyncScope()`](#async_hooks_asyncresource_runinasyncscope_fn_thisarg_args) instead. + +Call all `before` callbacks to notify that a new asynchronous execution context +is being entered. If nested calls to `emitBefore()` are made, the stack of +`asyncId`s will be tracked and properly unwound. + +`before` and `after` calls must be unwound in the same order that they +are called. Otherwise, an unrecoverable exception will occur and the process +will abort. For this reason, the `emitBefore` and `emitAfter` APIs are +considered deprecated. Please use `runInAsyncScope`, as it provides a much safer +alternative. + +#### asyncResource.emitAfter()[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/async_hooks.js#L178)[#](#async_hooks_asyncresource_emitafter) + +Deprecated since: v9.6.0 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`asyncResource.runInAsyncScope()`](#async_hooks_asyncresource_runinasyncscope_fn_thisarg_args) instead. + +Call all `after` callbacks. If nested calls to `emitBefore()` were made, then +make sure the stack is unwound properly. Otherwise an error will be thrown. + +If the user's callback throws an exception, `emitAfter()` will automatically be +called for all `asyncId`s on the stack if the error is handled by a domain or +`'uncaughtException'` handler. + +`before` and `after` calls must be unwound in the same order that they +are called. Otherwise, an unrecoverable exception will occur and the process +will abort. For this reason, the `emitBefore` and `emitAfter` APIs are +considered deprecated. Please use `runInAsyncScope`, as it provides a much safer +alternative. + +#### asyncResource.emitDestroy()[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/async_hooks.js#L195)[#](#async_hooks_asyncresource_emitdestroy) + +* Returns: [](async_hooks.html#async_hooks_class_asyncresource) A reference to `asyncResource`. + +Call all `destroy` hooks. This should only ever be called once. An error will +be thrown if it is called more than once. This **must** be manually called. If +the resource is left to be collected by the GC then the `destroy` hooks will +never be called. + +#### asyncResource.asyncId()[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/async_hooks.js#L201)[#](#async_hooks_asyncresource_asyncid) + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The unique `asyncId` assigned to the resource. + +#### asyncResource.triggerAsyncId()[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/async_hooks.js#L205)[#](#async_hooks_asyncresource_triggerasyncid) + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The same `triggerAsyncId` that is passed to the + `AsyncResource` constructor. diff --git a/corpus/docs/nodejs/async_hooks/async_hooks_8x.md b/corpus/docs/nodejs/async_hooks/async_hooks_8x.md new file mode 100644 index 0000000000000000000000000000000000000000..6009e9c32cef06d586028dcaefb3b1faf95a5dda --- /dev/null +++ b/corpus/docs/nodejs/async_hooks/async_hooks_8x.md @@ -0,0 +1,735 @@ +# Async Hooks# + +Source: https://nodejs.org/docs/latest-v8.x/api/async_hooks.html +Version: 8.x + +[Stability: 1](documentation.html#documentation_stability_index) - Experimental + +The `async_hooks` module provides an API to register callbacks tracking the +lifetime of asynchronous resources created inside a Node.js application. +It can be accessed using: + +```None +const async_hooks = require('async_hooks'); +``` + +## Terminology[#](#async_hooks_terminology) + +An asynchronous resource represents an object with an associated callback. +This callback may be called multiple times, for example, the `connection` event +in `net.createServer`, or just a single time like in `fs.open`. A resource +can also be closed before the callback is called. AsyncHook does not +explicitly distinguish between these different cases but will represent them +as the abstract concept that is a resource. + +## Public API[#](#async_hooks_public_api) + +### Overview[#](#async_hooks_overview) + +Following is a simple overview of the public API. + +```None +const async_hooks = require('async_hooks'); + +// Return the ID of the current execution context. +const eid = async_hooks.executionAsyncId(); + +// Return the ID of the handle responsible for triggering the callback of the +// current execution scope to call. +const tid = async_hooks.triggerAsyncId(); + +// Create a new AsyncHook instance. All of these callbacks are optional. +const asyncHook = + async_hooks.createHook({ init, before, after, destroy, promiseResolve }); + +// Allow callbacks of this AsyncHook instance to call. This is not an implicit +// action after running the constructor, and must be explicitly run to begin +// executing callbacks. +asyncHook.enable(); + +// Disable listening for new asynchronous events. +asyncHook.disable(); + +// +// The following are the callbacks that can be passed to createHook(). +// + +// init is called during object construction. The resource may not have +// completed construction when this callback runs, therefore all fields of the +// resource referenced by "asyncId" may not have been populated. +function init(asyncId, type, triggerAsyncId, resource) { } + +// before is called just before the resource's callback is called. It can be +// called 0-N times for handles (e.g. TCPWrap), and will be called exactly 1 +// time for requests (e.g. FSReqWrap). +function before(asyncId) { } + +// after is called just after the resource's callback has finished. +function after(asyncId) { } + +// destroy is called when an AsyncWrap instance is destroyed. +function destroy(asyncId) { } + +// promiseResolve is called only for promise resources, when the +// `resolve` function passed to the `Promise` constructor is invoked +// (either directly or through other means of resolving a promise). +function promiseResolve(asyncId) { } +``` + +#### `async_hooks.createHook(callbacks)`[#](#async_hooks_async_hooks_createhook_callbacks) + +Added in: v8.1.0 + +* `callbacks` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) The [Hook Callbacks](#async_hooks_hook_callbacks) to register + + `init` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The [`init` callback](#async_hooks_init_asyncid_type_triggerasyncid_resource). + + `before` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The [`before` callback](#async_hooks_before_asyncid). + + `after` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The [`after` callback](#async_hooks_after_asyncid). + + `destroy` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The [`destroy` callback](#async_hooks_destroy_asyncid). +* Returns: [](async_hooks.html#async_hooks_async_hooks_createhook_callbacks) Instance used for disabling and enabling hooks + +Registers functions to be called for different lifetime events of each async +operation. + +The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the +respective asynchronous event during a resource's lifetime. + +All callbacks are optional. For example, if only resource cleanup needs to +be tracked, then only the `destroy` callback needs to be passed. The +specifics of all functions that can be passed to `callbacks` is in the +[Hook Callbacks](#async_hooks_hook_callbacks) section. + +```None +const async_hooks = require('async_hooks'); + +const asyncHook = async_hooks.createHook({ + init(asyncId, type, triggerAsyncId, resource) { }, + destroy(asyncId) { } +}); +``` + +Note that the callbacks will be inherited via the prototype chain: + +```None +class MyAsyncCallbacks { + init(asyncId, type, triggerAsyncId, resource) { } + destroy(asyncId) {} +} + +class MyAddedCallbacks extends MyAsyncCallbacks { + before(asyncId) { } + after(asyncId) { } +} + +const asyncHook = async_hooks.createHook(new MyAddedCallbacks()); +``` + +##### Error Handling[#](#async_hooks_error_handling) + +If any `AsyncHook` callbacks throw, the application will print the stack trace +and exit. The exit path does follow that of an uncaught exception, but +all `uncaughtException` listeners are removed, thus forcing the process to +exit. The `'exit'` callbacks will still be called unless the application is run +with `--abort-on-uncaught-exception`, in which case a stack trace will be +printed and the application exits, leaving a core file. + +The reason for this error handling behavior is that these callbacks are running +at potentially volatile points in an object's lifetime, for example during +class construction and destruction. Because of this, it is deemed necessary to +bring down the process quickly in order to prevent an unintentional abort in the +future. This is subject to change in the future if a comprehensive analysis is +performed to ensure an exception can follow the normal control flow without +unintentional side effects. + +##### Printing in AsyncHooks callbacks[#](#async_hooks_printing_in_asynchooks_callbacks) + +Because printing to the console is an asynchronous operation, `console.log()` +will cause the AsyncHooks callbacks to be called. Using `console.log()` or +similar asynchronous operations inside an AsyncHooks callback function will thus +cause an infinite recursion. An easy solution to this when debugging is to use a +synchronous logging operation such as `fs.writeSync(1, msg)`. This will print to +stdout because `1` is the file descriptor for stdout and will not invoke +AsyncHooks recursively because it is synchronous. + +```None +const fs = require('fs'); +const util = require('util'); + +function debug(...args) { + // use a function like this one when debugging inside an AsyncHooks callback + fs.writeSync(1, `${util.format(...args)}\n`); +} +``` + +If an asynchronous operation is needed for logging, it is possible to keep +track of what caused the asynchronous operation using the information +provided by AsyncHooks itself. The logging should then be skipped when +it was the logging itself that caused AsyncHooks callback to call. By +doing this the otherwise infinite recursion is broken. + +#### `asyncHook.enable()`[#](#async_hooks_asynchook_enable) + +* Returns: [](async_hooks.html#async_hooks_async_hooks_createhook_callbacks) A reference to `asyncHook`. + +Enable the callbacks for a given `AsyncHook` instance. If no callbacks are +provided enabling is a noop. + +The `AsyncHook` instance is disabled by default. If the `AsyncHook` instance +should be enabled immediately after creation, the following pattern can be used. + +```None +const async_hooks = require('async_hooks'); + +const hook = async_hooks.createHook(callbacks).enable(); +``` + +#### `asyncHook.disable()`[#](#async_hooks_asynchook_disable) + +* Returns: [](async_hooks.html#async_hooks_async_hooks_createhook_callbacks) A reference to `asyncHook`. + +Disable the callbacks for a given `AsyncHook` instance from the global pool of +AsyncHook callbacks to be executed. Once a hook has been disabled it will not +be called again until enabled. + +For API consistency `disable()` also returns the `AsyncHook` instance. + +#### Hook Callbacks[#](#async_hooks_hook_callbacks) + +Key events in the lifetime of asynchronous events have been categorized into +four areas: instantiation, before/after the callback is called, and when the +instance is destroyed. + +##### `init(asyncId, type, triggerAsyncId, resource)`[#](#async_hooks_init_asyncid_type_triggerasyncid_resource) + +* `asyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) A unique ID for the async resource. +* `type` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The type of the async resource. +* `triggerAsyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The unique ID of the async resource in whose + execution context this async resource was created. +* `resource` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Reference to the resource representing the async operation, + needs to be released during *destroy*. + +Called when a class is constructed that has the *possibility* to emit an +asynchronous event. This *does not* mean the instance must call +`before`/`after` before `destroy` is called, only that the possibility +exists. + +This behavior can be observed by doing something like opening a resource then +closing it before the resource can be used. The following snippet demonstrates +this. + +```None +require('net').createServer().listen(function() { this.close(); }); +// OR +clearTimeout(setTimeout(() => {}, 10)); +``` + +Every new resource is assigned an ID that is unique within the scope of the +current process. + +###### `type`[#](#async_hooks_type) + +The `type` is a string identifying the type of resource that caused +`init` to be called. Generally, it will correspond to the name of the +resource's constructor. + +```None +FSEVENTWRAP, FSREQWRAP, GETADDRINFOREQWRAP, GETNAMEINFOREQWRAP, HTTPPARSER, +JSSTREAM, PIPECONNECTWRAP, PIPEWRAP, PROCESSWRAP, QUERYWRAP, SHUTDOWNWRAP, +SIGNALWRAP, STATWATCHER, TCPCONNECTWRAP, TCPSERVERWRAP, TCPWRAP, TIMERWRAP, +TTYWRAP, UDPSENDWRAP, UDPWRAP, WRITEWRAP, ZLIB, SSLCONNECTION, PBKDF2REQUEST, +RANDOMBYTESREQUEST, TLSWRAP, Timeout, Immediate, TickObject +``` + +There is also the `PROMISE` resource type, which is used to track `Promise` +instances and asynchronous work scheduled by them. + +Users are able to define their own `type` when using the public embedder API. + +*Note:* It is possible to have type name collisions. Embedders are encouraged +to use unique prefixes, such as the npm package name, to prevent collisions +when listening to the hooks. + +###### `triggerId`[#](#async_hooks_triggerid) + +`triggerAsyncId` is the `asyncId` of the resource that caused (or "triggered") +the new resource to initialize and that caused `init` to call. This is different +from `async_hooks.executionAsyncId()` that only shows *when* a resource was +created, while `triggerAsyncId` shows *why* a resource was created. + +The following is a simple demonstration of `triggerAsyncId`: + +```None +async_hooks.createHook({ + init(asyncId, type, triggerAsyncId) { + const eid = async_hooks.executionAsyncId(); + fs.writeSync( + 1, `${type}(${asyncId}): trigger: ${triggerAsyncId} execution: ${eid}\n`); + } +}).enable(); + +require('net').createServer((conn) => {}).listen(8080); +``` + +Output when hitting the server with `nc localhost 8080`: + +```None +TCPSERVERWRAP(2): trigger: 1 execution: 1 +TCPWRAP(4): trigger: 2 execution: 0 +``` + +The `TCPSERVERWRAP` is the server which receives the connections. + +The `TCPWRAP` is the new connection from the client. When a new +connection is made the `TCPWrap` instance is immediately constructed. This +happens outside of any JavaScript stack (side note: a `executionAsyncId()` of `0` +means it's being executed from C++, with no JavaScript stack above it). +With only that information, it would be impossible to link resources together in +terms of what caused them to be created, so `triggerAsyncId` is given the task of +propagating what resource is responsible for the new resource's existence. + +###### `resource`[#](#async_hooks_resource) + +`resource` is an object that represents the actual async resource that has +been initialized. This can contain useful information that can vary based on +the value of `type`. For instance, for the `GETADDRINFOREQWRAP` resource type, +`resource` provides the hostname used when looking up the IP address for the +hostname in `net.Server.listen()`. The API for accessing this information is +currently not considered public, but using the Embedder API, users can provide +and document their own resource objects. For example, such a resource object +could contain the SQL query being executed. + +In the case of Promises, the `resource` object will have `promise` property +that refers to the Promise that is being initialized, and a `isChainedPromise` +property, set to `true` if the promise has a parent promise, and `false` +otherwise. For example, in the case of `b = a.then(handler)`, `a` is considered +a parent Promise of `b`. Here, `b` is considered a chained promise. + +*Note*: In some cases the resource object is reused for performance reasons, +it is thus not safe to use it as a key in a `WeakMap` or add properties to it. + +###### Asynchronous context example[#](#async_hooks_asynchronous_context_example) + +The following is an example with additional information about the calls to +`init` between the `before` and `after` calls, specifically what the +callback to `listen()` will look like. The output formatting is slightly more +elaborate to make calling context easier to see. + +```None +let indent = 0; +async_hooks.createHook({ + init(asyncId, type, triggerAsyncId) { + const eid = async_hooks.executionAsyncId(); + const indentStr = ' '.repeat(indent); + fs.writeSync( + 1, + `${indentStr}${type}(${asyncId}):` + + ` trigger: ${triggerAsyncId} execution: ${eid}\n`); + }, + before(asyncId) { + const indentStr = ' '.repeat(indent); + fs.writeSync(1, `${indentStr}before: ${asyncId}\n`); + indent += 2; + }, + after(asyncId) { + indent -= 2; + const indentStr = ' '.repeat(indent); + fs.writeSync(1, `${indentStr}after: ${asyncId}\n`); + }, + destroy(asyncId) { + const indentStr = ' '.repeat(indent); + fs.writeSync(1, `${indentStr}destroy: ${asyncId}\n`); + }, +}).enable(); + +require('net').createServer(() => {}).listen(8080, () => { + // Let's wait 10ms before logging the server started. + setTimeout(() => { + console.log('>>>', async_hooks.executionAsyncId()); + }, 10); +}); +``` + +Output from only starting the server: + +```None +TCPSERVERWRAP(2): trigger: 1 execution: 1 +TickObject(3): trigger: 2 execution: 1 +before: 3 + Timeout(4): trigger: 3 execution: 3 + TIMERWRAP(5): trigger: 3 execution: 3 +after: 3 +destroy: 3 +before: 5 + before: 4 + TTYWRAP(6): trigger: 4 execution: 4 + SIGNALWRAP(7): trigger: 4 execution: 4 + TTYWRAP(8): trigger: 4 execution: 4 +>>> 4 + TickObject(9): trigger: 4 execution: 4 + after: 4 +after: 5 +before: 9 +after: 9 +destroy: 4 +destroy: 9 +destroy: 5 +``` + +*Note*: As illustrated in the example, `executionAsyncId()` and `execution` +each specify the value of the current execution context; which is delineated by +calls to `before` and `after`. + +Only using `execution` to graph resource allocation results in the following: + +```None +TTYWRAP(6) -> Timeout(4) -> TIMERWRAP(5) -> TickObject(3) -> root(1) +``` + +The `TCPSERVERWRAP` is not part of this graph, even though it was the reason for +`console.log()` being called. This is because binding to a port without a +hostname is a *synchronous* operation, but to maintain a completely asynchronous +API the user's callback is placed in a `process.nextTick()`. + +The graph only shows *when* a resource was created, not *why*, so to track +the *why* use `triggerAsyncId`. + +##### `before(asyncId)`[#](#async_hooks_before_asyncid) + +* `asyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +When an asynchronous operation is initiated (such as a TCP server receiving a +new connection) or completes (such as writing data to disk) a callback is +called to notify the user. The `before` callback is called just before said +callback is executed. `asyncId` is the unique identifier assigned to the +resource about to execute the callback. + +The `before` callback will be called 0 to N times. The `before` callback +will typically be called 0 times if the asynchronous operation was cancelled +or, for example, if no connections are received by a TCP server. Persistent +asynchronous resources like a TCP server will typically call the `before` +callback multiple times, while other operations like `fs.open()` will call +it only once. + +##### `after(asyncId)`[#](#async_hooks_after_asyncid) + +* `asyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Called immediately after the callback specified in `before` is completed. + +*Note:* If an uncaught exception occurs during execution of the callback, then +`after` will run *after* the `'uncaughtException'` event is emitted or a +`domain`'s handler runs. + +##### `destroy(asyncId)`[#](#async_hooks_destroy_asyncid) + +* `asyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Called after the resource corresponding to `asyncId` is destroyed. It is also +called asynchronously from the embedder API `emitDestroy()`. + +*Note:* Some resources depend on garbage collection for cleanup, so if a +reference is made to the `resource` object passed to `init` it is possible that +`destroy` will never be called, causing a memory leak in the application. If +the resource does not depend on garbage collection, then this will not be an +issue. + +##### `promiseResolve(asyncId)`[#](#async_hooks_promiseresolve_asyncid) + +* `asyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Called when the `resolve` function passed to the `Promise` constructor is +invoked (either directly or through other means of resolving a promise). + +Note that `resolve()` does not do any observable synchronous work. + +*Note:* This does not necessarily mean that the `Promise` is fulfilled or +rejected at this point, if the `Promise` was resolved by assuming the state +of another `Promise`. + +For example: + +```None +new Promise((resolve) => resolve(true)).then((a) => {}); +``` + +calls the following callbacks: + +```None +init for PROMISE with id 5, trigger id: 1 + promise resolve 5 # corresponds to resolve(true) +init for PROMISE with id 6, trigger id: 5 # the Promise returned by then() + before 6 # the then() callback is entered + promise resolve 6 # the then() callback resolves the promise by returning + after 6 +``` + +#### `async_hooks.executionAsyncId()`[#](#async_hooks_async_hooks_executionasyncid) + +History + +| Version | Changes | +| --- | --- | +| v8.2.0 | Renamed from currentId | +| v8.1.0 | Added in: v8.1.0 | + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The `asyncId` of the current execution context. Useful to + track when something calls. + +For example: + +```None +const async_hooks = require('async_hooks'); + +console.log(async_hooks.executionAsyncId()); // 1 - bootstrap +fs.open(path, 'r', (err, fd) => { + console.log(async_hooks.executionAsyncId()); // 6 - open() +}); +``` + +The ID returned from `executionAsyncId()` is related to execution timing, not +causality (which is covered by `triggerAsyncId()`). For example: + +```None +const server = net.createServer(function onConnection(conn) { + // Returns the ID of the server, not of the new connection, because the + // onConnection callback runs in the execution scope of the server's + // MakeCallback(). + async_hooks.executionAsyncId(); + +}).listen(port, function onListening() { + // Returns the ID of a TickObject (i.e. process.nextTick()) because all + // callbacks passed to .listen() are wrapped in a nextTick(). + async_hooks.executionAsyncId(); +}); +``` + +Note that promise contexts may not get precise executionAsyncIds by default. +See the section on [promise execution tracking](#async_hooks_promise_execution_tracking). + +#### `async_hooks.triggerAsyncId()`[#](#async_hooks_async_hooks_triggerasyncid) + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The ID of the resource responsible for calling the callback + that is currently being executed. + +For example: + +```None +const server = net.createServer((conn) => { + // The resource that caused (or triggered) this callback to be called + // was that of the new connection. Thus the return value of triggerAsyncId() + // is the asyncId of "conn". + async_hooks.triggerAsyncId(); + +}).listen(port, () => { + // Even though all callbacks passed to .listen() are wrapped in a nextTick() + // the callback itself exists because the call to the server's .listen() + // was made. So the return value would be the ID of the server. + async_hooks.triggerAsyncId(); +}); +``` + +Note that promise contexts may not get valid triggerAsyncIds by default. See +the section on [promise execution tracking](#async_hooks_promise_execution_tracking). + +## Promise execution tracking[#](#async_hooks_promise_execution_tracking) + +By default, promise executions are not assigned asyncIds due to the relatively +expensive nature of the [promise introspection API](https://docs.google.com/document/d/1rda3yKGHimKIhg5YeoAmCOtyURgsbTH_qaYR79FELlk) provided by +V8. This means that programs using promises or `async`/`await` will not get +correct execution and trigger ids for promise callback contexts by default. + +Here's an example: + +```None +const ah = require('async_hooks'); +Promise.resolve(1729).then(() => { + console.log(`eid ${ah.executionAsyncId()} tid ${ah.triggerAsyncId()}`); +}); +// produces: +// eid 1 tid 0 +``` + +Observe that the `then` callback claims to have executed in the context of the +outer scope even though there was an asynchronous hop involved. Also note that +the triggerAsyncId value is 0, which means that we are missing context about the +resource that caused (triggered) the `then` callback to be executed. + +Installing async hooks via `async_hooks.createHook` enables promise execution +tracking. Example: + +```None +const ah = require('async_hooks'); +ah.createHook({ init() {} }).enable(); // forces PromiseHooks to be enabled. +Promise.resolve(1729).then(() => { + console.log(`eid ${ah.executionAsyncId()} tid ${ah.triggerAsyncId()}`); +}); +// produces: +// eid 7 tid 6 +``` + +In this example, adding any actual hook function enabled the tracking of +promises. There are two promises in the example above; the promise created by +`Promise.resolve()` and the promise returned by the call to `then`. In the +example above, the first promise got the asyncId 6 and the latter got asyncId 7. +During the execution of the `then` callback, we are executing in the context of +promise with asyncId 7. This promise was triggered by async resource 6. + +Another subtlety with promises is that `before` and `after` callbacks are run +only on chained promises. That means promises not created by `then`/`catch` will +not have the `before` and `after` callbacks fired on them. For more details see +the details of the V8 [PromiseHooks](https://docs.google.com/document/d/1rda3yKGHimKIhg5YeoAmCOtyURgsbTH_qaYR79FELlk) API. + +## JavaScript Embedder API[#](#async_hooks_javascript_embedder_api) + +Library developers that handle their own asynchronous resources performing tasks +like I/O, connection pooling, or managing callback queues may use the `AsyncWrap` +JavaScript API so that all the appropriate callbacks are called. + +### `class AsyncResource()`[#](#async_hooks_class_asyncresource) + +The class `AsyncResource` is designed to be extended by the embedder's async +resources. Using this, users can easily trigger the lifetime events of their +own resources. + +The `init` hook will trigger when an `AsyncResource` is instantiated. + +The following is an overview of the `AsyncResource` API. + +```None +const { AsyncResource, executionAsyncId } = require('async_hooks'); + +// AsyncResource() is meant to be extended. Instantiating a +// new AsyncResource() also triggers init. If triggerAsyncId is omitted then +// async_hook.executionAsyncId() is used. +const asyncResource = new AsyncResource( + type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false } +); + +// Run a function in the execution context of the resource. This will +// * establish the context of the resource +// * trigger the AsyncHooks before callbacks +// * call the provided function `fn` with the supplied arguments +// * trigger the AsyncHooks after callbacks +// * restore the original execution context +asyncResource.runInAsyncScope(fn, thisArg, ...args); + +// Call AsyncHooks destroy callbacks. +asyncResource.emitDestroy(); + +// Return the unique ID assigned to the AsyncResource instance. +asyncResource.asyncId(); + +// Return the trigger ID for the AsyncResource instance. +asyncResource.triggerAsyncId(); + +// Call AsyncHooks before callbacks. +// Deprecated: Use asyncResource.runInAsyncScope instead. +asyncResource.emitBefore(); + +// Call AsyncHooks after callbacks. +// Deprecated: Use asyncResource.runInAsyncScope instead. +asyncResource.emitAfter(); +``` + +#### `AsyncResource(type[, options])`[#](#async_hooks_asyncresource_type_options) + +* `type` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The type of async event. +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `triggerAsyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The ID of the execution context that created this + async event. **Default:** `executionAsyncId()`. + + `requireManualDestroy` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Disables automatic `emitDestroy` when the + object is garbage collected. This usually does not need to be set (even if + `emitDestroy` is called manually), unless the resource's asyncId is retrieved + and the sensitive API's `emitDestroy` is called with it. **Default:** `false`. + +Example usage: + +```None +class DBQuery extends AsyncResource { + constructor(db) { + super('DBQuery'); + this.db = db; + } + + getInfo(query, callback) { + this.db.get(query, (err, data) => { + this.runInAsyncScope(callback, null, err, data); + }); + } + + close() { + this.db = null; + this.emitDestroy(); + } +} +``` + +#### `asyncResource.runInAsyncScope(fn[, thisArg, ...args])`[#](#async_hooks_asyncresource_runinasyncscope_fn_thisarg_args) + +Added in: v8.12.0 + +* `fn` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The function to call in the execution context of this async + resource. +* `thisArg` The receiver to be used for the function call. +* `...args` Optional arguments to pass to the function. + +Call the provided function with the provided arguments in the execution context +of the async resource. This will establish the context, trigger the AsyncHooks +before callbacks, call the function, trigger the AsyncHooks after callbacks, and +then restore the original execution context. + +#### `asyncResource.emitBefore()`[#](#async_hooks_asyncresource_emitbefore) + +Deprecated since: v8.12.0 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`asyncResource.runInAsyncScope()`](#async_hooks_asyncresource_runinasyncscope_fn_thisarg_args) instead. + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type) + +Call all `before` callbacks to notify that a new asynchronous execution context +is being entered. If nested calls to `emitBefore()` are made, the stack of +`asyncId`s will be tracked and properly unwound. + +`before` and `after` calls must be unwound in the same order that they +are called. Otherwise, an unrecoverable exception will occur and the process +will abort. For this reason, the `emitBefore` and `emitAfter` APIs are +considered deprecated. Please use `runInAsyncScope`, as it provides a much safer +alternative. + +#### `asyncResource.emitAfter()`[#](#async_hooks_asyncresource_emitafter) + +Deprecated since: v8.12.0 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`asyncResource.runInAsyncScope()`](#async_hooks_asyncresource_runinasyncscope_fn_thisarg_args) instead. + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type) + +Call all `after` callbacks. If nested calls to `emitBefore()` were made, then +make sure the stack is unwound properly. Otherwise an error will be thrown. + +If the user's callback throws an exception, `emitAfter()` will automatically be +called for all `asyncId`s on the stack if the error is handled by a domain or +`'uncaughtException'` handler. + +`before` and `after` calls must be unwound in the same order that they +are called. Otherwise, an unrecoverable exception will occur and the process +will abort. For this reason, the `emitBefore` and `emitAfter` APIs are +considered deprecated. Please use `runInAsyncScope`, as it provides a much safer +alternative. + +#### `asyncResource.emitDestroy()`[#](#async_hooks_asyncresource_emitdestroy) + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type) + +Call all `destroy` hooks. This should only ever be called once. An error will +be thrown if it is called more than once. This **must** be manually called. If +the resource is left to be collected by the GC then the `destroy` hooks will +never be called. + +#### `asyncResource.asyncId()`[#](#async_hooks_asyncresource_asyncid) + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The unique `asyncId` assigned to the resource. + +#### `asyncResource.triggerAsyncId()`[#](#async_hooks_asyncresource_triggerasyncid) + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The same `triggerAsyncId` that is passed to the `AsyncResource` + constructor. diff --git a/corpus/docs/nodejs/async_hooks/async_hooks_9x.md b/corpus/docs/nodejs/async_hooks/async_hooks_9x.md new file mode 100644 index 0000000000000000000000000000000000000000..c0dc8efdfc3500502659471a0ccdc3ea24b36703 --- /dev/null +++ b/corpus/docs/nodejs/async_hooks/async_hooks_9x.md @@ -0,0 +1,724 @@ +# Async Hooks# + +Source: https://nodejs.org/docs/latest-v9.x/api/async_hooks.html +Version: 9.x + +[Stability: 1](documentation.html#documentation_stability_index) - Experimental + +The `async_hooks` module provides an API to register callbacks tracking the +lifetime of asynchronous resources created inside a Node.js application. +It can be accessed using: + +```None +const async_hooks = require('async_hooks'); +``` + +## Terminology[#](#async_hooks_terminology) + +An asynchronous resource represents an object with an associated callback. +This callback may be called multiple times, for example, the `connection` event +in `net.createServer`, or just a single time like in `fs.open`. A resource +can also be closed before the callback is called. AsyncHook does not +explicitly distinguish between these different cases but will represent them +as the abstract concept that is a resource. + +## Public API[#](#async_hooks_public_api) + +### Overview[#](#async_hooks_overview) + +Following is a simple overview of the public API. + +```None +const async_hooks = require('async_hooks'); + +// Return the ID of the current execution context. +const eid = async_hooks.executionAsyncId(); + +// Return the ID of the handle responsible for triggering the callback of the +// current execution scope to call. +const tid = async_hooks.triggerAsyncId(); + +// Create a new AsyncHook instance. All of these callbacks are optional. +const asyncHook = + async_hooks.createHook({ init, before, after, destroy, promiseResolve }); + +// Allow callbacks of this AsyncHook instance to call. This is not an implicit +// action after running the constructor, and must be explicitly run to begin +// executing callbacks. +asyncHook.enable(); + +// Disable listening for new asynchronous events. +asyncHook.disable(); + +// +// The following are the callbacks that can be passed to createHook(). +// + +// init is called during object construction. The resource may not have +// completed construction when this callback runs, therefore all fields of the +// resource referenced by "asyncId" may not have been populated. +function init(asyncId, type, triggerAsyncId, resource) { } + +// before is called just before the resource's callback is called. It can be +// called 0-N times for handles (e.g. TCPWrap), and will be called exactly 1 +// time for requests (e.g. FSReqWrap). +function before(asyncId) { } + +// after is called just after the resource's callback has finished. +function after(asyncId) { } + +// destroy is called when an AsyncWrap instance is destroyed. +function destroy(asyncId) { } + +// promiseResolve is called only for promise resources, when the +// `resolve` function passed to the `Promise` constructor is invoked +// (either directly or through other means of resolving a promise). +function promiseResolve(asyncId) { } +``` + +#### `async_hooks.createHook(callbacks)`[#](#async_hooks_async_hooks_createhook_callbacks) + +Added in: v8.1.0 + +* `callbacks` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) The [Hook Callbacks](#async_hooks_hook_callbacks) to register + + `init` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The [`init` callback](#async_hooks_init_asyncid_type_triggerasyncid_resource). + + `before` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The [`before` callback](#async_hooks_before_asyncid). + + `after` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The [`after` callback](#async_hooks_after_asyncid). + + `destroy` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The [`destroy` callback](#async_hooks_destroy_asyncid). +* Returns: [](async_hooks.html#async_hooks_async_hooks_createhook_callbacks) Instance used for disabling and enabling hooks + +Registers functions to be called for different lifetime events of each async +operation. + +The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the +respective asynchronous event during a resource's lifetime. + +All callbacks are optional. For example, if only resource cleanup needs to +be tracked, then only the `destroy` callback needs to be passed. The +specifics of all functions that can be passed to `callbacks` is in the +[Hook Callbacks](#async_hooks_hook_callbacks) section. + +```None +const async_hooks = require('async_hooks'); + +const asyncHook = async_hooks.createHook({ + init(asyncId, type, triggerAsyncId, resource) { }, + destroy(asyncId) { } +}); +``` + +Note that the callbacks will be inherited via the prototype chain: + +```None +class MyAsyncCallbacks { + init(asyncId, type, triggerAsyncId, resource) { } + destroy(asyncId) {} +} + +class MyAddedCallbacks extends MyAsyncCallbacks { + before(asyncId) { } + after(asyncId) { } +} + +const asyncHook = async_hooks.createHook(new MyAddedCallbacks()); +``` + +##### Error Handling[#](#async_hooks_error_handling) + +If any `AsyncHook` callbacks throw, the application will print the stack trace +and exit. The exit path does follow that of an uncaught exception, but +all `uncaughtException` listeners are removed, thus forcing the process to +exit. The `'exit'` callbacks will still be called unless the application is run +with `--abort-on-uncaught-exception`, in which case a stack trace will be +printed and the application exits, leaving a core file. + +The reason for this error handling behavior is that these callbacks are running +at potentially volatile points in an object's lifetime, for example during +class construction and destruction. Because of this, it is deemed necessary to +bring down the process quickly in order to prevent an unintentional abort in the +future. This is subject to change in the future if a comprehensive analysis is +performed to ensure an exception can follow the normal control flow without +unintentional side effects. + +##### Printing in AsyncHooks callbacks[#](#async_hooks_printing_in_asynchooks_callbacks) + +Because printing to the console is an asynchronous operation, `console.log()` +will cause the AsyncHooks callbacks to be called. Using `console.log()` or +similar asynchronous operations inside an AsyncHooks callback function will thus +cause an infinite recursion. An easy solution to this when debugging is to use a +synchronous logging operation such as `fs.writeSync(1, msg)`. This will print to +stdout because `1` is the file descriptor for stdout and will not invoke +AsyncHooks recursively because it is synchronous. + +```None +const fs = require('fs'); +const util = require('util'); + +function debug(...args) { + // use a function like this one when debugging inside an AsyncHooks callback + fs.writeSync(1, `${util.format(...args)}\n`); +} +``` + +If an asynchronous operation is needed for logging, it is possible to keep +track of what caused the asynchronous operation using the information +provided by AsyncHooks itself. The logging should then be skipped when +it was the logging itself that caused AsyncHooks callback to call. By +doing this the otherwise infinite recursion is broken. + +#### `asyncHook.enable()`[#](#async_hooks_asynchook_enable) + +* Returns: [](async_hooks.html#async_hooks_async_hooks_createhook_callbacks) A reference to `asyncHook`. + +Enable the callbacks for a given `AsyncHook` instance. If no callbacks are +provided enabling is a noop. + +The `AsyncHook` instance is disabled by default. If the `AsyncHook` instance +should be enabled immediately after creation, the following pattern can be used. + +```None +const async_hooks = require('async_hooks'); + +const hook = async_hooks.createHook(callbacks).enable(); +``` + +#### `asyncHook.disable()`[#](#async_hooks_asynchook_disable) + +* Returns: [](async_hooks.html#async_hooks_async_hooks_createhook_callbacks) A reference to `asyncHook`. + +Disable the callbacks for a given `AsyncHook` instance from the global pool of +AsyncHook callbacks to be executed. Once a hook has been disabled it will not +be called again until enabled. + +For API consistency `disable()` also returns the `AsyncHook` instance. + +#### Hook Callbacks[#](#async_hooks_hook_callbacks) + +Key events in the lifetime of asynchronous events have been categorized into +four areas: instantiation, before/after the callback is called, and when the +instance is destroyed. + +##### `init(asyncId, type, triggerAsyncId, resource)`[#](#async_hooks_init_asyncid_type_triggerasyncid_resource) + +* `asyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) A unique ID for the async resource. +* `type` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The type of the async resource. +* `triggerAsyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The unique ID of the async resource in whose + execution context this async resource was created. +* `resource` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Reference to the resource representing the async + operation, needs to be released during *destroy*. + +Called when a class is constructed that has the *possibility* to emit an +asynchronous event. This *does not* mean the instance must call +`before`/`after` before `destroy` is called, only that the possibility +exists. + +This behavior can be observed by doing something like opening a resource then +closing it before the resource can be used. The following snippet demonstrates +this. + +```None +require('net').createServer().listen(function() { this.close(); }); +// OR +clearTimeout(setTimeout(() => {}, 10)); +``` + +Every new resource is assigned an ID that is unique within the scope of the +current process. + +###### `type`[#](#async_hooks_type) + +The `type` is a string identifying the type of resource that caused +`init` to be called. Generally, it will correspond to the name of the +resource's constructor. + +```None +FSEVENTWRAP, FSREQWRAP, GETADDRINFOREQWRAP, GETNAMEINFOREQWRAP, HTTPPARSER, +JSSTREAM, PIPECONNECTWRAP, PIPEWRAP, PROCESSWRAP, QUERYWRAP, SHUTDOWNWRAP, +SIGNALWRAP, STATWATCHER, TCPCONNECTWRAP, TCPSERVER, TCPWRAP, TIMERWRAP, TTYWRAP, +UDPSENDWRAP, UDPWRAP, WRITEWRAP, ZLIB, SSLCONNECTION, PBKDF2REQUEST, +RANDOMBYTESREQUEST, TLSWRAP, Timeout, Immediate, TickObject +``` + +There is also the `PROMISE` resource type, which is used to track `Promise` +instances and asynchronous work scheduled by them. + +Users are able to define their own `type` when using the public embedder API. + +*Note:* It is possible to have type name collisions. Embedders are encouraged +to use unique prefixes, such as the npm package name, to prevent collisions +when listening to the hooks. + +###### `triggerId`[#](#async_hooks_triggerid) + +`triggerAsyncId` is the `asyncId` of the resource that caused (or "triggered") +the new resource to initialize and that caused `init` to call. This is different +from `async_hooks.executionAsyncId()` that only shows *when* a resource was +created, while `triggerAsyncId` shows *why* a resource was created. + +The following is a simple demonstration of `triggerAsyncId`: + +```None +async_hooks.createHook({ + init(asyncId, type, triggerAsyncId) { + const eid = async_hooks.executionAsyncId(); + fs.writeSync( + 1, `${type}(${asyncId}): trigger: ${triggerAsyncId} execution: ${eid}\n`); + } +}).enable(); + +require('net').createServer((conn) => {}).listen(8080); +``` + +Output when hitting the server with `nc localhost 8080`: + +```None +TCPSERVERWRAP(2): trigger: 1 execution: 1 +TCPWRAP(4): trigger: 2 execution: 0 +``` + +The `TCPSERVERWRAP` is the server which receives the connections. + +The `TCPWRAP` is the new connection from the client. When a new +connection is made the `TCPWrap` instance is immediately constructed. This +happens outside of any JavaScript stack (side note: a `executionAsyncId()` of +`0` means it's being executed from C++, with no JavaScript stack above it). +With only that information, it would be impossible to link resources together in +terms of what caused them to be created, so `triggerAsyncId` is given the task +of propagating what resource is responsible for the new resource's existence. + +###### `resource`[#](#async_hooks_resource) + +`resource` is an object that represents the actual async resource that has +been initialized. This can contain useful information that can vary based on +the value of `type`. For instance, for the `GETADDRINFOREQWRAP` resource type, +`resource` provides the hostname used when looking up the IP address for the +hostname in `net.Server.listen()`. The API for accessing this information is +currently not considered public, but using the Embedder API, users can provide +and document their own resource objects. For example, such a resource object +could contain the SQL query being executed. + +In the case of Promises, the `resource` object will have `promise` property +that refers to the Promise that is being initialized, and a `isChainedPromise` +property, set to `true` if the promise has a parent promise, and `false` +otherwise. For example, in the case of `b = a.then(handler)`, `a` is considered +a parent Promise of `b`. Here, `b` is considered a chained promise. + +In some cases the resource object is reused for performance reasons, it is +thus not safe to use it as a key in a `WeakMap` or add properties to it. + +###### Asynchronous context example[#](#async_hooks_asynchronous_context_example) + +The following is an example with additional information about the calls to +`init` between the `before` and `after` calls, specifically what the +callback to `listen()` will look like. The output formatting is slightly more +elaborate to make calling context easier to see. + +```None +let indent = 0; +async_hooks.createHook({ + init(asyncId, type, triggerAsyncId) { + const eid = async_hooks.executionAsyncId(); + const indentStr = ' '.repeat(indent); + fs.writeSync( + 1, + `${indentStr}${type}(${asyncId}):` + + ` trigger: ${triggerAsyncId} execution: ${eid}\n`); + }, + before(asyncId) { + const indentStr = ' '.repeat(indent); + fs.writeSync(1, `${indentStr}before: ${asyncId}\n`); + indent += 2; + }, + after(asyncId) { + indent -= 2; + const indentStr = ' '.repeat(indent); + fs.writeSync(1, `${indentStr}after: ${asyncId}\n`); + }, + destroy(asyncId) { + const indentStr = ' '.repeat(indent); + fs.writeSync(1, `${indentStr}destroy: ${asyncId}\n`); + }, +}).enable(); + +require('net').createServer(() => {}).listen(8080, () => { + // Let's wait 10ms before logging the server started. + setTimeout(() => { + console.log('>>>', async_hooks.executionAsyncId()); + }, 10); +}); +``` + +Output from only starting the server: + +```None +TCPSERVERWRAP(2): trigger: 1 execution: 1 +TickObject(3): trigger: 2 execution: 1 +before: 3 + Timeout(4): trigger: 3 execution: 3 + TIMERWRAP(5): trigger: 3 execution: 3 +after: 3 +destroy: 3 +before: 5 + before: 4 + TTYWRAP(6): trigger: 4 execution: 4 + SIGNALWRAP(7): trigger: 4 execution: 4 + TTYWRAP(8): trigger: 4 execution: 4 +>>> 4 + TickObject(9): trigger: 4 execution: 4 + after: 4 +after: 5 +before: 9 +after: 9 +destroy: 4 +destroy: 9 +destroy: 5 +``` + +As illustrated in the example, `executionAsyncId()` and `execution` each specify +the value of the current execution context; which is delineated by calls to +`before` and `after`. + +Only using `execution` to graph resource allocation results in the following: + +```None +TTYWRAP(6) -> Timeout(4) -> TIMERWRAP(5) -> TickObject(3) -> root(1) +``` + +The `TCPSERVERWRAP` is not part of this graph, even though it was the reason for +`console.log()` being called. This is because binding to a port without a +hostname is a *synchronous* operation, but to maintain a completely asynchronous +API the user's callback is placed in a `process.nextTick()`. + +The graph only shows *when* a resource was created, not *why*, so to track +the *why* use `triggerAsyncId`. + +##### `before(asyncId)`[#](#async_hooks_before_asyncid) + +* `asyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +When an asynchronous operation is initiated (such as a TCP server receiving a +new connection) or completes (such as writing data to disk) a callback is +called to notify the user. The `before` callback is called just before said +callback is executed. `asyncId` is the unique identifier assigned to the +resource about to execute the callback. + +The `before` callback will be called 0 to N times. The `before` callback +will typically be called 0 times if the asynchronous operation was cancelled +or, for example, if no connections are received by a TCP server. Persistent +asynchronous resources like a TCP server will typically call the `before` +callback multiple times, while other operations like `fs.open()` will call +it only once. + +##### `after(asyncId)`[#](#async_hooks_after_asyncid) + +* `asyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Called immediately after the callback specified in `before` is completed. + +*Note:* If an uncaught exception occurs during execution of the callback, then +`after` will run *after* the `'uncaughtException'` event is emitted or a +`domain`'s handler runs. + +##### `destroy(asyncId)`[#](#async_hooks_destroy_asyncid) + +* `asyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Called after the resource corresponding to `asyncId` is destroyed. It is also +called asynchronously from the embedder API `emitDestroy()`. + +*Note:* Some resources depend on garbage collection for cleanup, so if a +reference is made to the `resource` object passed to `init` it is possible that +`destroy` will never be called, causing a memory leak in the application. If +the resource does not depend on garbage collection, then this will not be an +issue. + +##### `promiseResolve(asyncId)`[#](#async_hooks_promiseresolve_asyncid) + +* `asyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Called when the `resolve` function passed to the `Promise` constructor is +invoked (either directly or through other means of resolving a promise). + +Note that `resolve()` does not do any observable synchronous work. + +*Note:* This does not necessarily mean that the `Promise` is fulfilled or +rejected at this point, if the `Promise` was resolved by assuming the state +of another `Promise`. + +```None +new Promise((resolve) => resolve(true)).then((a) => {}); +``` + +calls the following callbacks: + +```None +init for PROMISE with id 5, trigger id: 1 + promise resolve 5 # corresponds to resolve(true) +init for PROMISE with id 6, trigger id: 5 # the Promise returned by then() + before 6 # the then() callback is entered + promise resolve 6 # the then() callback resolves the promise by returning + after 6 +``` + +#### `async_hooks.executionAsyncId()`[#](#async_hooks_async_hooks_executionasyncid) + +History + +| Version | Changes | +| --- | --- | +| v8.2.0 | Renamed from currentId | +| v8.1.0 | Added in: v8.1.0 | + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The `asyncId` of the current execution context. Useful to + track when something calls. + +```None +const async_hooks = require('async_hooks'); + +console.log(async_hooks.executionAsyncId()); // 1 - bootstrap +fs.open(path, 'r', (err, fd) => { + console.log(async_hooks.executionAsyncId()); // 6 - open() +}); +``` + +The ID returned from `executionAsyncId()` is related to execution timing, not +causality (which is covered by `triggerAsyncId()`): + +```None +const server = net.createServer(function onConnection(conn) { + // Returns the ID of the server, not of the new connection, because the + // onConnection callback runs in the execution scope of the server's + // MakeCallback(). + async_hooks.executionAsyncId(); + +}).listen(port, function onListening() { + // Returns the ID of a TickObject (i.e. process.nextTick()) because all + // callbacks passed to .listen() are wrapped in a nextTick(). + async_hooks.executionAsyncId(); +}); +``` + +Note that promise contexts may not get precise executionAsyncIds by default. +See the section on [promise execution tracking](#async_hooks_promise_execution_tracking). + +#### `async_hooks.triggerAsyncId()`[#](#async_hooks_async_hooks_triggerasyncid) + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The ID of the resource responsible for calling the callback + that is currently being executed. + +```None +const server = net.createServer((conn) => { + // The resource that caused (or triggered) this callback to be called + // was that of the new connection. Thus the return value of triggerAsyncId() + // is the asyncId of "conn". + async_hooks.triggerAsyncId(); + +}).listen(port, () => { + // Even though all callbacks passed to .listen() are wrapped in a nextTick() + // the callback itself exists because the call to the server's .listen() + // was made. So the return value would be the ID of the server. + async_hooks.triggerAsyncId(); +}); +``` + +Note that promise contexts may not get valid triggerAsyncIds by default. See +the section on [promise execution tracking](#async_hooks_promise_execution_tracking). + +## Promise execution tracking[#](#async_hooks_promise_execution_tracking) + +By default, promise executions are not assigned asyncIds due to the relatively +expensive nature of the [promise introspection API](https://docs.google.com/document/d/1rda3yKGHimKIhg5YeoAmCOtyURgsbTH_qaYR79FELlk) provided by +V8. This means that programs using promises or `async`/`await` will not get +correct execution and trigger ids for promise callback contexts by default. + +Here's an example: + +```None +const ah = require('async_hooks'); +Promise.resolve(1729).then(() => { + console.log(`eid ${ah.executionAsyncId()} tid ${ah.triggerAsyncId()}`); +}); +// produces: +// eid 1 tid 0 +``` + +Observe that the `then` callback claims to have executed in the context of the +outer scope even though there was an asynchronous hop involved. Also note that +the triggerAsyncId value is 0, which means that we are missing context about the +resource that caused (triggered) the `then` callback to be executed. + +Installing async hooks via `async_hooks.createHook` enables promise execution +tracking. Example: + +```None +const ah = require('async_hooks'); +ah.createHook({ init() {} }).enable(); // forces PromiseHooks to be enabled. +Promise.resolve(1729).then(() => { + console.log(`eid ${ah.executionAsyncId()} tid ${ah.triggerAsyncId()}`); +}); +// produces: +// eid 7 tid 6 +``` + +In this example, adding any actual hook function enabled the tracking of +promises. There are two promises in the example above; the promise created by +`Promise.resolve()` and the promise returned by the call to `then`. In the +example above, the first promise got the asyncId 6 and the latter got asyncId 7. +During the execution of the `then` callback, we are executing in the context of +promise with asyncId 7. This promise was triggered by async resource 6. + +Another subtlety with promises is that `before` and `after` callbacks are run +only on chained promises. That means promises not created by `then`/`catch` will +not have the `before` and `after` callbacks fired on them. For more details see +the details of the V8 [PromiseHooks](https://docs.google.com/document/d/1rda3yKGHimKIhg5YeoAmCOtyURgsbTH_qaYR79FELlk) API. + +## JavaScript Embedder API[#](#async_hooks_javascript_embedder_api) + +Library developers that handle their own asynchronous resources performing tasks +like I/O, connection pooling, or managing callback queues may use the +`AsyncWrap` JavaScript API so that all the appropriate callbacks are called. + +### `class AsyncResource()`[#](#async_hooks_class_asyncresource) + +The class `AsyncResource` is designed to be extended by the embedder's async +resources. Using this, users can easily trigger the lifetime events of their +own resources. + +The `init` hook will trigger when an `AsyncResource` is instantiated. + +The following is an overview of the `AsyncResource` API. + +```None +const { AsyncResource, executionAsyncId } = require('async_hooks'); + +// AsyncResource() is meant to be extended. Instantiating a +// new AsyncResource() also triggers init. If triggerAsyncId is omitted then +// async_hook.executionAsyncId() is used. +const asyncResource = new AsyncResource( + type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false } +); + +// Run a function in the execution context of the resource. This will +// * establish the context of the resource +// * trigger the AsyncHooks before callbacks +// * call the provided function `fn` with the supplied arguments +// * trigger the AsyncHooks after callbacks +// * restore the original execution context +asyncResource.runInAsyncScope(fn, thisArg, ...args); + +// Call AsyncHooks destroy callbacks. +asyncResource.emitDestroy(); + +// Return the unique ID assigned to the AsyncResource instance. +asyncResource.asyncId(); + +// Return the trigger ID for the AsyncResource instance. +asyncResource.triggerAsyncId(); + +// Call AsyncHooks before callbacks. +// Deprecated: Use asyncResource.runInAsyncScope instead. +asyncResource.emitBefore(); + +// Call AsyncHooks after callbacks. +// Deprecated: Use asyncResource.runInAsyncScope instead. +asyncResource.emitAfter(); +``` + +#### `AsyncResource(type[, options])`[#](#async_hooks_asyncresource_type_options) + +* `type` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The type of async event. +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `triggerAsyncId` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The ID of the execution context that created this + async event. **Default:** `executionAsyncId()`. + + `requireManualDestroy` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Disables automatic `emitDestroy` when the + object is garbage collected. This usually does not need to be set (even if + `emitDestroy` is called manually), unless the resource's asyncId is retrieved + and the sensitive API's `emitDestroy` is called with it. + **Default:** `false` + +Example usage: + +```None +class DBQuery extends AsyncResource { + constructor(db) { + super('DBQuery'); + this.db = db; + } + + getInfo(query, callback) { + this.db.get(query, (err, data) => { + this.runInAsyncScope(callback, null, err, data); + }); + } + + close() { + this.db = null; + this.emitDestroy(); + } +} +``` + +#### `asyncResource.runInAsyncScope(fn[, thisArg, ...args])`[#](#async_hooks_asyncresource_runinasyncscope_fn_thisarg_args) + +Added in: v9.6.0 + +* `fn` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The function to call in the execution context of this async + resource. +* `thisArg` The receiver to be used for the function call. +* `...args` Optional arguments to pass to the function. + +Call the provided function with the provided arguments in the execution context +of the async resource. This will establish the context, trigger the AsyncHooks +before callbacks, call the function, trigger the AsyncHooks after callbacks, and +then restore the original execution context. + +#### `asyncResource.emitBefore()`[#](#async_hooks_asyncresource_emitbefore) + +Deprecated since: v9.6.0 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`asyncResource.runInAsyncScope()`](#async_hooks_asyncresource_runinasyncscope_fn_thisarg_args) instead. + +Call all `before` callbacks to notify that a new asynchronous execution context +is being entered. If nested calls to `emitBefore()` are made, the stack of +`asyncId`s will be tracked and properly unwound. + +`before` and `after` calls must be unwound in the same order that they +are called. Otherwise, an unrecoverable exception will occur and the process +will abort. For this reason, the `emitBefore` and `emitAfter` APIs are +considered deprecated. Please use `runInAsyncScope`, as it provides a much safer +alternative. + +#### `asyncResource.emitAfter()`[#](#async_hooks_asyncresource_emitafter) + +Deprecated since: v9.6.0 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`asyncResource.runInAsyncScope()`](#async_hooks_asyncresource_runinasyncscope_fn_thisarg_args) instead. + +Call all `after` callbacks. If nested calls to `emitBefore()` were made, then +make sure the stack is unwound properly. Otherwise an error will be thrown. + +If the user's callback throws an exception, `emitAfter()` will automatically be +called for all `asyncId`s on the stack if the error is handled by a domain or +`'uncaughtException'` handler. + +`before` and `after` calls must be unwound in the same order that they +are called. Otherwise, an unrecoverable exception will occur and the process +will abort. For this reason, the `emitBefore` and `emitAfter` APIs are +considered deprecated. Please use `runInAsyncScope`, as it provides a much safer +alternative. + +#### `asyncResource.emitDestroy()`[#](#async_hooks_asyncresource_emitdestroy) + +Call all `destroy` hooks. This should only ever be called once. An error will +be thrown if it is called more than once. This **must** be manually called. If +the resource is left to be collected by the GC then the `destroy` hooks will +never be called. + +#### `asyncResource.asyncId()`[#](#async_hooks_asyncresource_asyncid) + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The unique `asyncId` assigned to the resource. + +#### `asyncResource.triggerAsyncId()`[#](#async_hooks_asyncresource_triggerasyncid) + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The same `triggerAsyncId` that is passed to the + `AsyncResource` constructor. diff --git a/corpus/docs/nodejs/crypto/crypto_010x.md b/corpus/docs/nodejs/crypto/crypto_010x.md new file mode 100644 index 0000000000000000000000000000000000000000..847c07ed551ab3b0fe26fba7e8ac6b6fe8cf871e --- /dev/null +++ b/corpus/docs/nodejs/crypto/crypto_010x.md @@ -0,0 +1,545 @@ +# Crypto# + +Source: https://nodejs.org/docs/latest-v0.10.x/api/crypto.html +Version: 0.10.x + +```None +Stability: 2 - Unstable; API changes are being discussed for +future versions. Breaking changes will be minimized. See below. +``` + +Use `require('crypto')` to access this module. + +The crypto module offers a way of encapsulating secure credentials to be +used as part of a secure HTTPS net or http connection. + +It also offers a set of wrappers for OpenSSL's hash, hmac, cipher, +decipher, sign and verify methods. + +## crypto.getCiphers()[#](#crypto_crypto_getciphers) + +Returns an array with the names of the supported ciphers. + +Example: + +```None +var ciphers = crypto.getCiphers(); +console.log(ciphers); // ['AES-128-CBC', 'AES-128-CBC-HMAC-SHA1', ...] +``` + +## crypto.getHashes()[#](#crypto_crypto_gethashes) + +Returns an array with the names of the supported hash algorithms. + +Example: + +```None +var hashes = crypto.getHashes(); +console.log(hashes); // ['sha', 'sha1', 'sha1WithRSAEncryption', ...] +``` + +## crypto.createCredentials(details)[#](#crypto_crypto_createcredentials_details) + +Creates a credentials object, with the optional details being a +dictionary with keys: + +* `pfx` : A string or buffer holding the PFX or PKCS12 encoded private + key, certificate and CA certificates +* `key` : A string holding the PEM encoded private key +* `passphrase` : A string of passphrase for the private key or pfx +* `cert` : A string holding the PEM encoded certificate +* `ca` : Either a string or list of strings of PEM encoded CA + certificates to trust. +* `crl` : Either a string or list of strings of PEM encoded CRLs + (Certificate Revocation List) +* `ciphers`: A string describing the ciphers to use or exclude. + Consult + + for details on the format. + +If no 'ca' details are given, then node.js will use the default +publicly trusted list of CAs as given in + +. + +## crypto.createHash(algorithm)[#](#crypto_crypto_createhash_algorithm) + +Creates and returns a hash object, a cryptographic hash with the given +algorithm which can be used to generate hash digests. + +`algorithm` is dependent on the available algorithms supported by the +version of OpenSSL on the platform. Examples are `'sha1'`, `'md5'`, +`'sha256'`, `'sha512'`, etc. On recent releases, `openssl +list-message-digest-algorithms` will display the available digest +algorithms. + +Example: this program that takes the sha1 sum of a file + +```None +var filename = process.argv[2]; +var crypto = require('crypto'); +var fs = require('fs'); + +var shasum = crypto.createHash('sha1'); + +var s = fs.ReadStream(filename); +s.on('data', function(d) { + shasum.update(d); +}); + +s.on('end', function() { + var d = shasum.digest('hex'); + console.log(d + ' ' + filename); +}); +``` + +## Class: Hash[#](#crypto_class_hash) + +The class for creating hash digests of data. + +It is a [stream](stream.html) that is both readable and writable. The +written data is used to compute the hash. Once the writable side of +the stream is ended, use the `read()` method to get the computed hash +digest. The legacy `update` and `digest` methods are also supported. + +Returned by `crypto.createHash`. + +### hash.update(data, [input\_encoding])[#](#crypto_hash_update_data_input_encoding) + +Updates the hash content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'binary'`. If no encoding is provided and the input is a string an +encoding of `'binary'` is enforced. If `data` is a `Buffer` then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +### hash.digest([encoding])[#](#crypto_hash_digest_encoding) + +Calculates the digest of all of the passed data to be hashed. The +`encoding` can be `'hex'`, `'binary'` or `'base64'`. If no encoding +is provided, then a buffer is returned. + +Note: `hash` object can not be used after `digest()` method has been +called. + +## crypto.createHmac(algorithm, key)[#](#crypto_crypto_createhmac_algorithm_key) + +Creates and returns a hmac object, a cryptographic hmac with the given +algorithm and key. + +It is a [stream](stream.html) that is both readable and writable. The +written data is used to compute the hmac. Once the writable side of +the stream is ended, use the `read()` method to get the computed +digest. The legacy `update` and `digest` methods are also supported. + +`algorithm` is dependent on the available algorithms supported by +OpenSSL - see createHash above. `key` is the hmac key to be used. + +## Class: Hmac[#](#crypto_class_hmac) + +Class for creating cryptographic hmac content. + +Returned by `crypto.createHmac`. + +### hmac.update(data)[#](#crypto_hmac_update_data) + +Update the hmac content with the given `data`. This can be called +many times with new data as it is streamed. + +### hmac.digest([encoding])[#](#crypto_hmac_digest_encoding) + +Calculates the digest of all of the passed data to the hmac. The +`encoding` can be `'hex'`, `'binary'` or `'base64'`. If no encoding +is provided, then a buffer is returned. + +Note: `hmac` object can not be used after `digest()` method has been +called. + +## crypto.createCipher(algorithm, password)[#](#crypto_crypto_createcipher_algorithm_password) + +Creates and returns a cipher object, with the given algorithm and +password. + +`algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. `password` is used to derive key and IV, +which must be a `'binary'` encoded string or a [buffer](buffer.html). + +It is a [stream](stream.html) that is both readable and writable. The +written data is used to compute the hash. Once the writable side of +the stream is ended, use the `read()` method to get the enciphered +contents. The legacy `update` and `final` methods are also supported. + +Note: `createCipher` derives keys with the OpenSSL function [EVP\_BytesToKey](https://www.openssl.org/docs/crypto/EVP_BytesToKey.html) +with the digest algorithm set to MD5, one iteration, and no salt. The lack of +salt allows dictionary attacks as the same password always creates the same key. +The low iteration count and non-cryptographically secure hash algorithm allow +passwords to be tested very rapidly. + +In line with OpenSSL's recommendation to use pbkdf2 instead of EVP\_BytesToKey it +is recommended you derive a key and iv yourself with [crypto.pbkdf2](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_callback) and to +then use [createCipheriv()](#crypto_crypto_createcipheriv_algorithm_key_iv) to create the cipher stream. + +## crypto.createCipheriv(algorithm, key, iv)[#](#crypto_crypto_createcipheriv_algorithm_key_iv) + +Creates and returns a cipher object, with the given algorithm, key and +iv. + +`algorithm` is the same as the argument to `createCipher()`. `key` is +the raw key used by the algorithm. `iv` is an [initialization +vector](http://en.wikipedia.org/wiki/Initialization_vector). + +`key` and `iv` must be `'binary'` encoded strings or +[buffers](buffer.html). + +## Class: Cipher[#](#crypto_class_cipher) + +Class for encrypting data. + +Returned by `crypto.createCipher` and `crypto.createCipheriv`. + +Cipher objects are [streams](stream.html) that are both readable and +writable. The written plain text data is used to produce the +encrypted data on the readable side. The legacy `update` and `final` +methods are also supported. + +### cipher.update(data, [input\_encoding], [output\_encoding])[#](#crypto_cipher_update_data_input_encoding_output_encoding) + +Updates the cipher with `data`, the encoding of which is given in +`input_encoding` and can be `'utf8'`, `'ascii'` or `'binary'`. If no +encoding is provided, then a buffer is expected. +If `data` is a `Buffer` then `input_encoding` is ignored. + +The `output_encoding` specifies the output format of the enciphered +data, and can be `'binary'`, `'base64'` or `'hex'`. If no encoding is +provided, then a buffer is returned. + +Returns the enciphered contents, and can be called many times with new +data as it is streamed. + +### cipher.final([output\_encoding])[#](#crypto_cipher_final_output_encoding) + +Returns any remaining enciphered contents, with `output_encoding` +being one of: `'binary'`, `'base64'` or `'hex'`. If no encoding is +provided, then a buffer is returned. + +Note: `cipher` object can not be used after `final()` method has been +called. + +### cipher.setAutoPadding(auto\_padding=true)[#](#crypto_cipher_setautopadding_auto_padding_true) + +You can disable automatic padding of the input data to block size. If +`auto_padding` is false, the length of the entire input data must be a +multiple of the cipher's block size or `final` will fail. Useful for +non-standard padding, e.g. using `0x0` instead of PKCS padding. You +must call this before `cipher.final`. + +## crypto.createDecipher(algorithm, password)[#](#crypto_crypto_createdecipher_algorithm_password) + +Creates and returns a decipher object, with the given algorithm and +key. This is the mirror of the [createCipher()](#crypto_crypto_createcipher_algorithm_password) above. + +## crypto.createDecipheriv(algorithm, key, iv)[#](#crypto_crypto_createdecipheriv_algorithm_key_iv) + +Creates and returns a decipher object, with the given algorithm, key +and iv. This is the mirror of the [createCipheriv()](#crypto_crypto_createcipheriv_algorithm_key_iv) above. + +## Class: Decipher[#](#crypto_class_decipher) + +Class for decrypting data. + +Returned by `crypto.createDecipher` and `crypto.createDecipheriv`. + +Decipher objects are [streams](stream.html) that are both readable and +writable. The written enciphered data is used to produce the +plain-text data on the the readable side. The legacy `update` and +`final` methods are also supported. + +### decipher.update(data, [input\_encoding], [output\_encoding])[#](#crypto_decipher_update_data_input_encoding_output_encoding) + +Updates the decipher with `data`, which is encoded in `'binary'`, +`'base64'` or `'hex'`. If no encoding is provided, then a buffer is +expected. +If `data` is a `Buffer` then `input_encoding` is ignored. + +The `output_decoding` specifies in what format to return the +deciphered plaintext: `'binary'`, `'ascii'` or `'utf8'`. If no +encoding is provided, then a buffer is returned. + +### decipher.final([output\_encoding])[#](#crypto_decipher_final_output_encoding) + +Returns any remaining plaintext which is deciphered, with +`output_encoding` being one of: `'binary'`, `'ascii'` or `'utf8'`. If +no encoding is provided, then a buffer is returned. + +Note: `decipher` object can not be used after `final()` method has been +called. + +### decipher.setAutoPadding(auto\_padding=true)[#](#crypto_decipher_setautopadding_auto_padding_true) + +You can disable auto padding if the data has been encrypted without +standard block padding to prevent `decipher.final` from checking and +removing it. Can only work if the input data's length is a multiple of +the ciphers block size. You must call this before streaming data to +`decipher.update`. + +## crypto.createSign(algorithm)[#](#crypto_crypto_createsign_algorithm) + +Creates and returns a signing object, with the given algorithm. On +recent OpenSSL releases, `openssl list-public-key-algorithms` will +display the available signing algorithms. Examples are `'RSA-SHA256'`. + +## Class: Sign[#](#crypto_class_sign) + +Class for generating signatures. + +Returned by `crypto.createSign`. + +Sign objects are writable [streams](stream.html). The written data is +used to generate the signature. Once all of the data has been +written, the `sign` method will return the signature. The legacy +`update` method is also supported. + +### sign.update(data)[#](#crypto_sign_update_data) + +Updates the sign object with data. This can be called many times +with new data as it is streamed. + +### sign.sign(private\_key, [output\_format])[#](#crypto_sign_sign_private_key_output_format) + +Calculates the signature on all the updated data passed through the +sign. `private_key` is a string containing the PEM encoded private +key for signing. + +Returns the signature in `output_format` which can be `'binary'`, +`'hex'` or `'base64'`. If no encoding is provided, then a buffer is +returned. + +Note: `sign` object can not be used after `sign()` method has been +called. + +## crypto.createVerify(algorithm)[#](#crypto_crypto_createverify_algorithm) + +Creates and returns a verification object, with the given algorithm. +This is the mirror of the signing object above. + +## Class: Verify[#](#crypto_class_verify) + +Class for verifying signatures. + +Returned by `crypto.createVerify`. + +Verify objects are writable [streams](stream.html). The written data +is used to validate against the supplied signature. Once all of the +data has been written, the `verify` method will return true if the +supplied signature is valid. The legacy `update` method is also +supported. + +### verifier.update(data)[#](#crypto_verifier_update_data) + +Updates the verifier object with data. This can be called many times +with new data as it is streamed. + +### verifier.verify(object, signature, [signature\_format])[#](#crypto_verifier_verify_object_signature_signature_format) + +Verifies the signed data by using the `object` and `signature`. +`object` is a string containing a PEM encoded object, which can be +one of RSA public key, DSA public key, or X.509 certificate. +`signature` is the previously calculated signature for the data, in +the `signature_format` which can be `'binary'`, `'hex'` or `'base64'`. +If no encoding is specified, then a buffer is expected. + +Returns true or false depending on the validity of the signature for +the data and public key. + +Note: `verifier` object can not be used after `verify()` method has been +called. + +## crypto.createDiffieHellman(prime\_length)[#](#crypto_crypto_creatediffiehellman_prime_length) + +Creates a Diffie-Hellman key exchange object and generates a prime of +the given bit length. The generator used is `2`. + +## crypto.createDiffieHellman(prime, [encoding])[#](#crypto_crypto_creatediffiehellman_prime_encoding) + +Creates a Diffie-Hellman key exchange object using the supplied prime. +The generator used is `2`. Encoding can be `'binary'`, `'hex'`, or +`'base64'`. If no encoding is specified, then a buffer is expected. + +## Class: DiffieHellman[#](#crypto_class_diffiehellman) + +The class for creating Diffie-Hellman key exchanges. + +Returned by `crypto.createDiffieHellman`. + +### diffieHellman.generateKeys([encoding])[#](#crypto_diffiehellman_generatekeys_encoding) + +Generates private and public Diffie-Hellman key values, and returns +the public key in the specified encoding. This key should be +transferred to the other party. Encoding can be `'binary'`, `'hex'`, +or `'base64'`. If no encoding is provided, then a buffer is returned. + +### diffieHellman.computeSecret(other\_public\_key, [input\_encoding], [output\_encoding])[#](#crypto_diffiehellman_computesecret_other_public_key_input_encoding_output_encoding) + +Computes the shared secret using `other_public_key` as the other +party's public key and returns the computed shared secret. Supplied +key is interpreted using specified `input_encoding`, and secret is +encoded using specified `output_encoding`. Encodings can be +`'binary'`, `'hex'`, or `'base64'`. If the input encoding is not +provided, then a buffer is expected. + +If no output encoding is given, then a buffer is returned. + +### diffieHellman.getPrime([encoding])[#](#crypto_diffiehellman_getprime_encoding) + +Returns the Diffie-Hellman prime in the specified encoding, which can +be `'binary'`, `'hex'`, or `'base64'`. If no encoding is provided, +then a buffer is returned. + +### diffieHellman.getGenerator([encoding])[#](#crypto_diffiehellman_getgenerator_encoding) + +Returns the Diffie-Hellman generator in the specified encoding, which can +be `'binary'`, `'hex'`, or `'base64'`. If no encoding is provided, +then a buffer is returned. + +### diffieHellman.getPublicKey([encoding])[#](#crypto_diffiehellman_getpublickey_encoding) + +Returns the Diffie-Hellman public key in the specified encoding, which +can be `'binary'`, `'hex'`, or `'base64'`. If no encoding is provided, +then a buffer is returned. + +### diffieHellman.getPrivateKey([encoding])[#](#crypto_diffiehellman_getprivatekey_encoding) + +Returns the Diffie-Hellman private key in the specified encoding, +which can be `'binary'`, `'hex'`, or `'base64'`. If no encoding is +provided, then a buffer is returned. + +### diffieHellman.setPublicKey(public\_key, [encoding])[#](#crypto_diffiehellman_setpublickey_public_key_encoding) + +Sets the Diffie-Hellman public key. Key encoding can be `'binary'`, +`'hex'` or `'base64'`. If no encoding is provided, then a buffer is +expected. + +### diffieHellman.setPrivateKey(private\_key, [encoding])[#](#crypto_diffiehellman_setprivatekey_private_key_encoding) + +Sets the Diffie-Hellman private key. Key encoding can be `'binary'`, +`'hex'` or `'base64'`. If no encoding is provided, then a buffer is +expected. + +## crypto.getDiffieHellman(group\_name)[#](#crypto_crypto_getdiffiehellman_group_name) + +Creates a predefined Diffie-Hellman key exchange object. The +supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in [RFC +2412](http://www.rfc-editor.org/rfc/rfc2412.txt)) and `'modp14'`, `'modp15'`, `'modp16'`, `'modp17'`, +`'modp18'` (defined in [RFC 3526](http://www.rfc-editor.org/rfc/rfc3526.txt)). The returned object mimics the +interface of objects created by [crypto.createDiffieHellman()](#crypto_crypto_creatediffiehellman_prime_encoding) +above, but will not allow to change the keys (with +[diffieHellman.setPublicKey()](#crypto_diffiehellman_setpublickey_public_key_encoding) for example). The advantage of using +this routine is that the parties don't have to generate nor exchange +group modulus beforehand, saving both processor and communication +time. + +Example (obtaining a shared secret): + +```None +var crypto = require('crypto'); +var alice = crypto.getDiffieHellman('modp5'); +var bob = crypto.getDiffieHellman('modp5'); + +alice.generateKeys(); +bob.generateKeys(); + +var alice_secret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +var bob_secret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +/* alice_secret and bob_secret should be the same */ +console.log(alice_secret == bob_secret); +``` + +## crypto.pbkdf2(password, salt, iterations, keylen, callback)[#](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_callback) + +Asynchronous PBKDF2 applies pseudorandom function HMAC-SHA1 to derive +a key of given length from the given password, salt and iterations. +The callback gets two arguments `(err, derivedKey)`. + +## crypto.pbkdf2Sync(password, salt, iterations, keylen)[#](#crypto_crypto_pbkdf2sync_password_salt_iterations_keylen) + +Synchronous PBKDF2 function. Returns derivedKey or throws error. + +## crypto.randomBytes(size, [callback])[#](#crypto_crypto_randombytes_size_callback) + +Generates cryptographically strong pseudo-random data. Usage: + +```None +// async +crypto.randomBytes(256, function(ex, buf) { + if (ex) throw ex; + console.log('Have %d bytes of random data: %s', buf.length, buf); +}); + +// sync +try { + var buf = crypto.randomBytes(256); + console.log('Have %d bytes of random data: %s', buf.length, buf); +} catch (ex) { + // handle error + // most likely, entropy sources are drained +} +``` + +NOTE: Will throw error or invoke callback with error, if there is not enough +accumulated entropy to generate cryptographically strong data. In other words, +`crypto.randomBytes` without callback will not block even if all entropy sources +are drained. + +## crypto.pseudoRandomBytes(size, [callback])[#](#crypto_crypto_pseudorandombytes_size_callback) + +Generates *non*-cryptographically strong pseudo-random data. The data +returned will be unique if it is sufficiently long, but is not +necessarily unpredictable. For this reason, the output of this +function should never be used where unpredictability is important, +such as in the generation of encryption keys. + +Usage is otherwise identical to `crypto.randomBytes`. + +## crypto.DEFAULT\_ENCODING[#](#crypto_crypto_default_encoding) + +The default encoding to use for functions that can take either strings +or buffers. The default value is `'buffer'`, which makes it default +to using Buffer objects. This is here to make the crypto module more +easily compatible with legacy programs that expected `'binary'` to be +the default encoding. + +Note that new programs will probably expect buffers, so only use this +as a temporary measure. + +## Recent API Changes[#](#crypto_recent_api_changes) + +The Crypto module was added to Node before there was the concept of a +unified Stream API, and before there were Buffer objects for handling +binary data. + +As such, the streaming classes don't have the typical methods found on +other Node classes, and many methods accepted and returned +Binary-encoded strings by default rather than Buffers. This was +changed to use Buffers by default instead. + +This is a breaking change for some use cases, but not all. + +For example, if you currently use the default arguments to the Sign +class, and then pass the results to the Verify class, without ever +inspecting the data, then it will continue to work as before. Where +you once got a binary string and then presented the binary string to +the Verify object, you'll now get a Buffer, and present the Buffer to +the Verify object. + +However, if you were doing things with the string data that will not +work properly on Buffers (such as, concatenating them, storing in +databases, etc.), or you are passing binary strings to the crypto +functions without an encoding argument, then you will need to start +providing encoding arguments to specify which encoding you'd like to +use. To switch to the previous style of using binary strings by +default, set the `crypto.DEFAULT_ENCODING` field to 'binary'. Note +that new programs will probably expect buffers, so only use this as a +temporary measure. diff --git a/corpus/docs/nodejs/crypto/crypto_012x.md b/corpus/docs/nodejs/crypto/crypto_012x.md new file mode 100644 index 0000000000000000000000000000000000000000..7818164acfa3b58233484fe35f5c850d5826112e --- /dev/null +++ b/corpus/docs/nodejs/crypto/crypto_012x.md @@ -0,0 +1,772 @@ +# Crypto# + +Source: https://nodejs.org/docs/latest-v0.12.x/api/crypto.html +Version: 0.12.x + +```None +Stability: 2 - Unstable; API changes are being discussed for +future versions. Breaking changes will be minimized. See below. +``` + +Use `require('crypto')` to access this module. + +The crypto module offers a way of encapsulating secure credentials to be +used as part of a secure HTTPS net or http connection. + +It also offers a set of wrappers for OpenSSL's hash, hmac, cipher, +decipher, sign and verify methods. + +## crypto.setEngine(engine[, flags])[#](#crypto_crypto_setengine_engine_flags) + +Load and set engine for some/all OpenSSL functions (selected by flags). + +`engine` could be either an id or a path to the to the engine's shared library. + +`flags` is optional and has `ENGINE_METHOD_ALL` value by default. It could take +one of or mix of following flags (defined in `constants` module): + +* `ENGINE_METHOD_RSA` +* `ENGINE_METHOD_DSA` +* `ENGINE_METHOD_DH` +* `ENGINE_METHOD_RAND` +* `ENGINE_METHOD_ECDH` +* `ENGINE_METHOD_ECDSA` +* `ENGINE_METHOD_CIPHERS` +* `ENGINE_METHOD_DIGESTS` +* `ENGINE_METHOD_STORE` +* `ENGINE_METHOD_PKEY_METH` +* `ENGINE_METHOD_PKEY_ASN1_METH` +* `ENGINE_METHOD_ALL` +* `ENGINE_METHOD_NONE` + +## crypto.getCiphers()[#](#crypto_crypto_getciphers) + +Returns an array with the names of the supported ciphers. + +Example: + +```None +var ciphers = crypto.getCiphers(); +console.log(ciphers); // ['AES-128-CBC', 'AES-128-CBC-HMAC-SHA1', ...] +``` + +## crypto.getHashes()[#](#crypto_crypto_gethashes) + +Returns an array with the names of the supported hash algorithms. + +Example: + +```None +var hashes = crypto.getHashes(); +console.log(hashes); // ['sha', 'sha1', 'sha1WithRSAEncryption', ...] +``` + +## crypto.createCredentials(details)[#](#crypto_crypto_createcredentials_details) + +```None +Stability: 0 - Deprecated. Use tls.createSecureContext instead. +``` + +Creates a credentials object, with the optional details being a +dictionary with keys: + +* `pfx` : A string or buffer holding the PFX or PKCS12 encoded private + key, certificate and CA certificates +* `key` : A string holding the PEM encoded private key +* `passphrase` : A string of passphrase for the private key or pfx +* `cert` : A string holding the PEM encoded certificate +* `ca` : Either a string or list of strings of PEM encoded CA + certificates to trust. +* `crl` : Either a string or list of strings of PEM encoded CRLs + (Certificate Revocation List) +* `ciphers`: A string describing the ciphers to use or exclude. + Consult + + for details on the format. + +If no 'ca' details are given, then node.js will use the default +publicly trusted list of CAs as given in + +. + +## crypto.createHash(algorithm)[#](#crypto_crypto_createhash_algorithm) + +Creates and returns a hash object, a cryptographic hash with the given +algorithm which can be used to generate hash digests. + +`algorithm` is dependent on the available algorithms supported by the +version of OpenSSL on the platform. Examples are `'sha1'`, `'md5'`, +`'sha256'`, `'sha512'`, etc. On recent releases, `openssl +list-message-digest-algorithms` will display the available digest +algorithms. + +Example: this program that takes the sha1 sum of a file + +```None +var filename = process.argv[2]; +var crypto = require('crypto'); +var fs = require('fs'); + +var shasum = crypto.createHash('sha1'); + +var s = fs.ReadStream(filename); +s.on('data', function(d) { + shasum.update(d); +}); + +s.on('end', function() { + var d = shasum.digest('hex'); + console.log(d + ' ' + filename); +}); +``` + +## Class: Hash[#](#crypto_class_hash) + +The class for creating hash digests of data. + +It is a [stream](stream.html) that is both readable and writable. The +written data is used to compute the hash. Once the writable side of +the stream is ended, use the `read()` method to get the computed hash +digest. The legacy `update` and `digest` methods are also supported. + +Returned by `crypto.createHash`. + +### hash.update(data[, input\_encoding])[#](#crypto_hash_update_data_input_encoding) + +Updates the hash content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'binary'`. If no encoding is provided and the input is a string an +encoding of `'binary'` is enforced. If `data` is a `Buffer` then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +### hash.digest([encoding])[#](#crypto_hash_digest_encoding) + +Calculates the digest of all of the passed data to be hashed. The +`encoding` can be `'hex'`, `'binary'` or `'base64'`. If no encoding +is provided, then a buffer is returned. + +Note: `hash` object can not be used after `digest()` method has been +called. + +## crypto.createHmac(algorithm, key)[#](#crypto_crypto_createhmac_algorithm_key) + +Creates and returns a hmac object, a cryptographic hmac with the given +algorithm and key. + +It is a [stream](stream.html) that is both readable and writable. The +written data is used to compute the hmac. Once the writable side of +the stream is ended, use the `read()` method to get the computed +digest. The legacy `update` and `digest` methods are also supported. + +`algorithm` is dependent on the available algorithms supported by +OpenSSL - see createHash above. `key` is the hmac key to be used. + +## Class: Hmac[#](#crypto_class_hmac) + +Class for creating cryptographic hmac content. + +Returned by `crypto.createHmac`. + +### hmac.update(data)[#](#crypto_hmac_update_data) + +Update the hmac content with the given `data`. This can be called +many times with new data as it is streamed. + +### hmac.digest([encoding])[#](#crypto_hmac_digest_encoding) + +Calculates the digest of all of the passed data to the hmac. The +`encoding` can be `'hex'`, `'binary'` or `'base64'`. If no encoding +is provided, then a buffer is returned. + +Note: `hmac` object can not be used after `digest()` method has been +called. + +## crypto.createCipher(algorithm, password)[#](#crypto_crypto_createcipher_algorithm_password) + +Creates and returns a cipher object, with the given algorithm and +password. + +`algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. `password` is used to derive key and IV, +which must be a `'binary'` encoded string or a [buffer](buffer.html). + +It is a [stream](stream.html) that is both readable and writable. The +written data is used to compute the hash. Once the writable side of +the stream is ended, use the `read()` method to get the enciphered +contents. The legacy `update` and `final` methods are also supported. + +Note: `createCipher` derives keys with the OpenSSL function [EVP\_BytesToKey](https://www.openssl.org/docs/crypto/EVP_BytesToKey.html) +with the digest algorithm set to MD5, one iteration, and no salt. The lack of +salt allows dictionary attacks as the same password always creates the same key. +The low iteration count and non-cryptographically secure hash algorithm allow +passwords to be tested very rapidly. + +In line with OpenSSL's recommendation to use pbkdf2 instead of EVP\_BytesToKey it +is recommended you derive a key and iv yourself with [crypto.pbkdf2](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_callback) and to +then use [createCipheriv()](#crypto_crypto_createcipheriv_algorithm_key_iv) to create the cipher stream. + +## crypto.createCipheriv(algorithm, key, iv)[#](#crypto_crypto_createcipheriv_algorithm_key_iv) + +Creates and returns a cipher object, with the given algorithm, key and +iv. + +`algorithm` is the same as the argument to `createCipher()`. `key` is +the raw key used by the algorithm. `iv` is an [initialization +vector](http://en.wikipedia.org/wiki/Initialization_vector). + +`key` and `iv` must be `'binary'` encoded strings or +[buffers](buffer.html). + +## Class: Cipher[#](#crypto_class_cipher) + +Class for encrypting data. + +Returned by `crypto.createCipher` and `crypto.createCipheriv`. + +Cipher objects are [streams](stream.html) that are both readable and +writable. The written plain text data is used to produce the +encrypted data on the readable side. The legacy `update` and `final` +methods are also supported. + +### cipher.update(data[, input\_encoding][, output\_encoding])[#](#crypto_cipher_update_data_input_encoding_output_encoding) + +Updates the cipher with `data`, the encoding of which is given in +`input_encoding` and can be `'utf8'`, `'ascii'` or `'binary'`. If no +encoding is provided, then a buffer is expected. +If `data` is a `Buffer` then `input_encoding` is ignored. + +The `output_encoding` specifies the output format of the enciphered +data, and can be `'binary'`, `'base64'` or `'hex'`. If no encoding is +provided, then a buffer is returned. + +Returns the enciphered contents, and can be called many times with new +data as it is streamed. + +### cipher.final([output\_encoding])[#](#crypto_cipher_final_output_encoding) + +Returns any remaining enciphered contents, with `output_encoding` +being one of: `'binary'`, `'base64'` or `'hex'`. If no encoding is +provided, then a buffer is returned. + +Note: `cipher` object can not be used after `final()` method has been +called. + +### cipher.setAutoPadding(auto\_padding=true)[#](#crypto_cipher_setautopadding_auto_padding_true) + +You can disable automatic padding of the input data to block size. If +`auto_padding` is false, the length of the entire input data must be a +multiple of the cipher's block size or `final` will fail. Useful for +non-standard padding, e.g. using `0x0` instead of PKCS padding. You +must call this before `cipher.final`. + +### cipher.getAuthTag()[#](#crypto_cipher_getauthtag) + +For authenticated encryption modes (currently supported: GCM), this +method returns a `Buffer` that represents the *authentication tag* that +has been computed from the given data. Should be called after +encryption has been completed using the `final` method! + +### cipher.setAAD(buffer)[#](#crypto_cipher_setaad_buffer) + +For authenticated encryption modes (currently supported: GCM), this +method sets the value used for the additional authenticated data (AAD) input +parameter. + +## crypto.createDecipher(algorithm, password)[#](#crypto_crypto_createdecipher_algorithm_password) + +Creates and returns a decipher object, with the given algorithm and +key. This is the mirror of the [createCipher()](#crypto_crypto_createcipher_algorithm_password) above. + +## crypto.createDecipheriv(algorithm, key, iv)[#](#crypto_crypto_createdecipheriv_algorithm_key_iv) + +Creates and returns a decipher object, with the given algorithm, key +and iv. This is the mirror of the [createCipheriv()](#crypto_crypto_createcipheriv_algorithm_key_iv) above. + +## Class: Decipher[#](#crypto_class_decipher) + +Class for decrypting data. + +Returned by `crypto.createDecipher` and `crypto.createDecipheriv`. + +Decipher objects are [streams](stream.html) that are both readable and +writable. The written enciphered data is used to produce the +plain-text data on the the readable side. The legacy `update` and +`final` methods are also supported. + +### decipher.update(data[, input\_encoding][, output\_encoding])[#](#crypto_decipher_update_data_input_encoding_output_encoding) + +Updates the decipher with `data`, which is encoded in `'binary'`, +`'base64'` or `'hex'`. If no encoding is provided, then a buffer is +expected. +If `data` is a `Buffer` then `input_encoding` is ignored. + +The `output_decoding` specifies in what format to return the +deciphered plaintext: `'binary'`, `'ascii'` or `'utf8'`. If no +encoding is provided, then a buffer is returned. + +### decipher.final([output\_encoding])[#](#crypto_decipher_final_output_encoding) + +Returns any remaining plaintext which is deciphered, with +`output_encoding` being one of: `'binary'`, `'ascii'` or `'utf8'`. If +no encoding is provided, then a buffer is returned. + +Note: `decipher` object can not be used after `final()` method has been +called. + +### decipher.setAutoPadding(auto\_padding=true)[#](#crypto_decipher_setautopadding_auto_padding_true) + +You can disable auto padding if the data has been encrypted without +standard block padding to prevent `decipher.final` from checking and +removing it. Can only work if the input data's length is a multiple of +the ciphers block size. You must call this before streaming data to +`decipher.update`. + +### decipher.setAuthTag(buffer)[#](#crypto_decipher_setauthtag_buffer) + +For authenticated encryption modes (currently supported: GCM), this +method must be used to pass in the received *authentication tag*. +If no tag is provided or if the ciphertext has been tampered with, +`final` will throw, thus indicating that the ciphertext should +be discarded due to failed authentication. + +### decipher.setAAD(buffer)[#](#crypto_decipher_setaad_buffer) + +For authenticated encryption modes (currently supported: GCM), this +method sets the value used for the additional authenticated data (AAD) input +parameter. + +## crypto.createSign(algorithm)[#](#crypto_crypto_createsign_algorithm) + +Creates and returns a signing object, with the given algorithm. On +recent OpenSSL releases, `openssl list-public-key-algorithms` will +display the available signing algorithms. Examples are `'RSA-SHA256'`. + +## Class: Sign[#](#crypto_class_sign) + +Class for generating signatures. + +Returned by `crypto.createSign`. + +Sign objects are writable [streams](stream.html). The written data is +used to generate the signature. Once all of the data has been +written, the `sign` method will return the signature. The legacy +`update` method is also supported. + +### sign.update(data)[#](#crypto_sign_update_data) + +Updates the sign object with data. This can be called many times +with new data as it is streamed. + +### sign.sign(private\_key[, output\_format])[#](#crypto_sign_sign_private_key_output_format) + +Calculates the signature on all the updated data passed through the +sign. + +`private_key` can be an object or a string. If `private_key` is a string, it is +treated as the key with no passphrase. + +`private_key`: + +* `key` : A string holding the PEM encoded private key +* `passphrase` : A string of passphrase for the private key + +Returns the signature in `output_format` which can be `'binary'`, +`'hex'` or `'base64'`. If no encoding is provided, then a buffer is +returned. + +Note: `sign` object can not be used after `sign()` method has been +called. + +## crypto.createVerify(algorithm)[#](#crypto_crypto_createverify_algorithm) + +Creates and returns a verification object, with the given algorithm. +This is the mirror of the signing object above. + +## Class: Verify[#](#crypto_class_verify) + +Class for verifying signatures. + +Returned by `crypto.createVerify`. + +Verify objects are writable [streams](stream.html). The written data +is used to validate against the supplied signature. Once all of the +data has been written, the `verify` method will return true if the +supplied signature is valid. The legacy `update` method is also +supported. + +### verifier.update(data)[#](#crypto_verifier_update_data) + +Updates the verifier object with data. This can be called many times +with new data as it is streamed. + +### verifier.verify(object, signature[, signature\_format])[#](#crypto_verifier_verify_object_signature_signature_format) + +Verifies the signed data by using the `object` and `signature`. +`object` is a string containing a PEM encoded object, which can be +one of RSA public key, DSA public key, or X.509 certificate. +`signature` is the previously calculated signature for the data, in +the `signature_format` which can be `'binary'`, `'hex'` or `'base64'`. +If no encoding is specified, then a buffer is expected. + +Returns true or false depending on the validity of the signature for +the data and public key. + +Note: `verifier` object can not be used after `verify()` method has been +called. + +## crypto.createDiffieHellman(prime\_length[, generator])[#](#crypto_crypto_creatediffiehellman_prime_length_generator) + +Creates a Diffie-Hellman key exchange object and generates a prime of +`prime_length` bits and using an optional specific numeric `generator`. +If no `generator` is specified, then `2` is used. + +## crypto.createDiffieHellman(prime[, prime\_encoding][, generator][, generator\_encoding])[#](#crypto_crypto_creatediffiehellman_prime_prime_encoding_generator_generator_encoding) + +Creates a Diffie-Hellman key exchange object using the supplied `prime` and an +optional specific `generator`. +`generator` can be a number, string, or Buffer. +If no `generator` is specified, then `2` is used. +`prime_encoding` and `generator_encoding` can be `'binary'`, `'hex'`, or `'base64'`. +If no `prime_encoding` is specified, then a Buffer is expected for `prime`. +If no `generator_encoding` is specified, then a Buffer is expected for `generator`. + +## Class: DiffieHellman[#](#crypto_class_diffiehellman) + +The class for creating Diffie-Hellman key exchanges. + +Returned by `crypto.createDiffieHellman`. + +### diffieHellman.verifyError[#](#crypto_diffiehellman_verifyerror) + +A bit field containing any warnings and/or errors as a result of a check performed +during initialization. The following values are valid for this property +(defined in `constants` module): + +* `DH_CHECK_P_NOT_SAFE_PRIME` +* `DH_CHECK_P_NOT_PRIME` +* `DH_UNABLE_TO_CHECK_GENERATOR` +* `DH_NOT_SUITABLE_GENERATOR` + +### diffieHellman.generateKeys([encoding])[#](#crypto_diffiehellman_generatekeys_encoding) + +Generates private and public Diffie-Hellman key values, and returns +the public key in the specified encoding. This key should be +transferred to the other party. Encoding can be `'binary'`, `'hex'`, +or `'base64'`. If no encoding is provided, then a buffer is returned. + +### diffieHellman.computeSecret(other\_public\_key[, input\_encoding][, output\_encoding])[#](#crypto_diffiehellman_computesecret_other_public_key_input_encoding_output_encoding) + +Computes the shared secret using `other_public_key` as the other +party's public key and returns the computed shared secret. Supplied +key is interpreted using specified `input_encoding`, and secret is +encoded using specified `output_encoding`. Encodings can be +`'binary'`, `'hex'`, or `'base64'`. If the input encoding is not +provided, then a buffer is expected. + +If no output encoding is given, then a buffer is returned. + +### diffieHellman.getPrime([encoding])[#](#crypto_diffiehellman_getprime_encoding) + +Returns the Diffie-Hellman prime in the specified encoding, which can +be `'binary'`, `'hex'`, or `'base64'`. If no encoding is provided, +then a buffer is returned. + +### diffieHellman.getGenerator([encoding])[#](#crypto_diffiehellman_getgenerator_encoding) + +Returns the Diffie-Hellman generator in the specified encoding, which can +be `'binary'`, `'hex'`, or `'base64'`. If no encoding is provided, +then a buffer is returned. + +### diffieHellman.getPublicKey([encoding])[#](#crypto_diffiehellman_getpublickey_encoding) + +Returns the Diffie-Hellman public key in the specified encoding, which +can be `'binary'`, `'hex'`, or `'base64'`. If no encoding is provided, +then a buffer is returned. + +### diffieHellman.getPrivateKey([encoding])[#](#crypto_diffiehellman_getprivatekey_encoding) + +Returns the Diffie-Hellman private key in the specified encoding, +which can be `'binary'`, `'hex'`, or `'base64'`. If no encoding is +provided, then a buffer is returned. + +### diffieHellman.setPublicKey(public\_key[, encoding])[#](#crypto_diffiehellman_setpublickey_public_key_encoding) + +Sets the Diffie-Hellman public key. Key encoding can be `'binary'`, +`'hex'` or `'base64'`. If no encoding is provided, then a buffer is +expected. + +### diffieHellman.setPrivateKey(private\_key[, encoding])[#](#crypto_diffiehellman_setprivatekey_private_key_encoding) + +Sets the Diffie-Hellman private key. Key encoding can be `'binary'`, +`'hex'` or `'base64'`. If no encoding is provided, then a buffer is +expected. + +## crypto.getDiffieHellman(group\_name)[#](#crypto_crypto_getdiffiehellman_group_name) + +Creates a predefined Diffie-Hellman key exchange object. The +supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in [RFC +2412](http://www.rfc-editor.org/rfc/rfc2412.txt)) and `'modp14'`, `'modp15'`, `'modp16'`, `'modp17'`, +`'modp18'` (defined in [RFC 3526](http://www.rfc-editor.org/rfc/rfc3526.txt)). The returned object mimics the +interface of objects created by [crypto.createDiffieHellman()](#crypto_crypto_creatediffiehellman_prime_encoding) +above, but will not allow to change the keys (with +[diffieHellman.setPublicKey()](#crypto_diffiehellman_setpublickey_public_key_encoding) for example). The advantage of using +this routine is that the parties don't have to generate nor exchange +group modulus beforehand, saving both processor and communication +time. + +Example (obtaining a shared secret): + +```None +var crypto = require('crypto'); +var alice = crypto.getDiffieHellman('modp5'); +var bob = crypto.getDiffieHellman('modp5'); + +alice.generateKeys(); +bob.generateKeys(); + +var alice_secret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +var bob_secret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +/* alice_secret and bob_secret should be the same */ +console.log(alice_secret == bob_secret); +``` + +## crypto.createECDH(curve\_name)[#](#crypto_crypto_createecdh_curve_name) + +Creates an Elliptic Curve (EC) Diffie-Hellman key exchange object using a +predefined curve specified by `curve_name` string. + +## Class: ECDH[#](#crypto_class_ecdh) + +The class for creating EC Diffie-Hellman key exchanges. + +Returned by `crypto.createECDH`. + +### ECDH.generateKeys([encoding[, format]])[#](#crypto_ecdh_generatekeys_encoding_format) + +Generates private and public EC Diffie-Hellman key values, and returns +the public key in the specified format and encoding. This key should be +transferred to the other party. + +Format specifies point encoding and can be `'compressed'`, `'uncompressed'`, or +`'hybrid'`. If no format is provided - the point will be returned in +`'uncompressed'` format. + +Encoding can be `'binary'`, `'hex'`, or `'base64'`. If no encoding is provided, +then a buffer is returned. + +### ECDH.computeSecret(other\_public\_key[, input\_encoding][, output\_encoding])[#](#crypto_ecdh_computesecret_other_public_key_input_encoding_output_encoding) + +Computes the shared secret using `other_public_key` as the other +party's public key and returns the computed shared secret. Supplied +key is interpreted using specified `input_encoding`, and secret is +encoded using specified `output_encoding`. Encodings can be +`'binary'`, `'hex'`, or `'base64'`. If the input encoding is not +provided, then a buffer is expected. + +If no output encoding is given, then a buffer is returned. + +### ECDH.getPublicKey([encoding[, format]])[#](#crypto_ecdh_getpublickey_encoding_format) + +Returns the EC Diffie-Hellman public key in the specified encoding and format. + +Format specifies point encoding and can be `'compressed'`, `'uncompressed'`, or +`'hybrid'`. If no format is provided - the point will be returned in +`'uncompressed'` format. + +Encoding can be `'binary'`, `'hex'`, or `'base64'`. If no encoding is provided, +then a buffer is returned. + +### ECDH.getPrivateKey([encoding])[#](#crypto_ecdh_getprivatekey_encoding) + +Returns the EC Diffie-Hellman private key in the specified encoding, +which can be `'binary'`, `'hex'`, or `'base64'`. If no encoding is +provided, then a buffer is returned. + +### ECDH.setPublicKey(public\_key[, encoding])[#](#crypto_ecdh_setpublickey_public_key_encoding) + +Sets the EC Diffie-Hellman public key. Key encoding can be `'binary'`, +`'hex'` or `'base64'`. If no encoding is provided, then a buffer is +expected. + +### ECDH.setPrivateKey(private\_key[, encoding])[#](#crypto_ecdh_setprivatekey_private_key_encoding) + +Sets the EC Diffie-Hellman private key. Key encoding can be `'binary'`, +`'hex'` or `'base64'`. If no encoding is provided, then a buffer is +expected. + +Example (obtaining a shared secret): + +```None +var crypto = require('crypto'); +var alice = crypto.createECDH('secp256k1'); +var bob = crypto.createECDH('secp256k1'); + +alice.generateKeys(); +bob.generateKeys(); + +var alice_secret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +var bob_secret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +/* alice_secret and bob_secret should be the same */ +console.log(alice_secret == bob_secret); +``` + +## crypto.pbkdf2(password, salt, iterations, keylen[, digest], callback)[#](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) + +Asynchronous PBKDF2 function. Applies the selected HMAC digest function +(default: SHA1) to derive a key of the requested length from the password, +salt and number of iterations. The callback gets two arguments: +`(err, derivedKey)`. + +Example: + +```None +crypto.pbkdf2('secret', 'salt', 4096, 512, 'sha256', function(err, key) { + if (err) + throw err; + console.log(key.toString('hex')); // 'c5e478d...1469e50' +}); +``` + +You can get a list of supported digest functions with +[crypto.getHashes()](#crypto_crypto_gethashes). + +## crypto.pbkdf2Sync(password, salt, iterations, keylen[, digest])[#](#crypto_crypto_pbkdf2sync_password_salt_iterations_keylen_digest) + +Synchronous PBKDF2 function. Returns derivedKey or throws error. + +## crypto.randomBytes(size[, callback])[#](#crypto_crypto_randombytes_size_callback) + +Generates cryptographically strong pseudo-random data. Usage: + +```None +// async +crypto.randomBytes(256, function(ex, buf) { + if (ex) throw ex; + console.log('Have %d bytes of random data: %s', buf.length, buf); +}); + +// sync +try { + var buf = crypto.randomBytes(256); + console.log('Have %d bytes of random data: %s', buf.length, buf); +} catch (ex) { + // handle error + // most likely, entropy sources are drained +} +``` + +NOTE: Will throw error or invoke callback with error, if there is not enough +accumulated entropy to generate cryptographically strong data. In other words, +`crypto.randomBytes` without callback will not block even if all entropy sources +are drained. + +## crypto.pseudoRandomBytes(size[, callback])[#](#crypto_crypto_pseudorandombytes_size_callback) + +Generates *non*-cryptographically strong pseudo-random data. The data +returned will be unique if it is sufficiently long, but is not +necessarily unpredictable. For this reason, the output of this +function should never be used where unpredictability is important, +such as in the generation of encryption keys. + +Usage is otherwise identical to `crypto.randomBytes`. + +## Class: Certificate[#](#crypto_class_certificate) + +The class used for working with signed public key & challenges. The most +common usage for this series of functions is when dealing with the `` +element. + +Returned by `crypto.Certificate`. + +### Certificate.verifySpkac(spkac)[#](#crypto_certificate_verifyspkac_spkac) + +Returns true of false based on the validity of the SPKAC. + +### Certificate.exportChallenge(spkac)[#](#crypto_certificate_exportchallenge_spkac) + +Exports the encoded public key from the supplied SPKAC. + +### Certificate.exportPublicKey(spkac)[#](#crypto_certificate_exportpublickey_spkac) + +Exports the encoded challenge associated with the SPKAC. + +## crypto.publicEncrypt(public\_key, buffer)[#](#crypto_crypto_publicencrypt_public_key_buffer) + +Encrypts `buffer` with `public_key`. Only RSA is currently supported. + +`public_key` can be an object or a string. If `public_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. + +`public_key`: + +* `key` : A string holding the PEM encoded private key +* `padding` : An optional padding value, one of the following: + + `constants.RSA_NO_PADDING` + + `constants.RSA_PKCS1_PADDING` + + `constants.RSA_PKCS1_OAEP_PADDING` + +NOTE: All paddings are defined in `constants` module. + +## crypto.privateDecrypt(private\_key, buffer)[#](#crypto_crypto_privatedecrypt_private_key_buffer) + +Decrypts `buffer` with `private_key`. + +`private_key` can be an object or a string. If `private_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. + +`private_key`: + +* `key` : A string holding the PEM encoded private key +* `passphrase` : An optional string of passphrase for the private key +* `padding` : An optional padding value, one of the following: + + `constants.RSA_NO_PADDING` + + `constants.RSA_PKCS1_PADDING` + + `constants.RSA_PKCS1_OAEP_PADDING` + +NOTE: All paddings are defined in `constants` module. + +## crypto.DEFAULT\_ENCODING[#](#crypto_crypto_default_encoding) + +The default encoding to use for functions that can take either strings +or buffers. The default value is `'buffer'`, which makes it default +to using Buffer objects. This is here to make the crypto module more +easily compatible with legacy programs that expected `'binary'` to be +the default encoding. + +Note that new programs will probably expect buffers, so only use this +as a temporary measure. + +## Recent API Changes[#](#crypto_recent_api_changes) + +The Crypto module was added to Node before there was the concept of a +unified Stream API, and before there were Buffer objects for handling +binary data. + +As such, the streaming classes don't have the typical methods found on +other Node classes, and many methods accepted and returned +Binary-encoded strings by default rather than Buffers. This was +changed to use Buffers by default instead. + +This is a breaking change for some use cases, but not all. + +For example, if you currently use the default arguments to the Sign +class, and then pass the results to the Verify class, without ever +inspecting the data, then it will continue to work as before. Where +you once got a binary string and then presented the binary string to +the Verify object, you'll now get a Buffer, and present the Buffer to +the Verify object. + +However, if you were doing things with the string data that will not +work properly on Buffers (such as, concatenating them, storing in +databases, etc.), or you are passing binary strings to the crypto +functions without an encoding argument, then you will need to start +providing encoding arguments to specify which encoding you'd like to +use. To switch to the previous style of using binary strings by +default, set the `crypto.DEFAULT_ENCODING` field to 'binary'. Note +that new programs will probably expect buffers, so only use this as a +temporary measure. diff --git a/corpus/docs/nodejs/crypto/crypto_10x.md b/corpus/docs/nodejs/crypto/crypto_10x.md new file mode 100644 index 0000000000000000000000000000000000000000..66d95850d00ed47f2433afb27daa1c4c5d0a14c3 --- /dev/null +++ b/corpus/docs/nodejs/crypto/crypto_10x.md @@ -0,0 +1,2706 @@ +# Crypto# + +Source: https://nodejs.org/docs/latest-v10.x/api/crypto.html +Version: 10.x + +[Stability: 2](documentation.html#documentation_stability_index) - Stable + +The `crypto` module provides cryptographic functionality that includes a set of +wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify functions. + +Use `require('crypto')` to access this module. + +```None +const crypto = require('crypto'); + +const secret = 'abcdefg'; +const hash = crypto.createHmac('sha256', secret) + .update('I love cupcakes') + .digest('hex'); +console.log(hash); +// Prints: +// c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e +``` + +## Determining if crypto support is unavailable[#](#crypto_determining_if_crypto_support_is_unavailable) + +It is possible for Node.js to be built without including support for the +`crypto` module. In such cases, calling `require('crypto')` will result in an +error being thrown. + +```None +let crypto; +try { + crypto = require('crypto'); +} catch (err) { + console.log('crypto support is disabled!'); +} +``` + +## Class: Certificate[#](#crypto_class_certificate) + +Added in: v0.11.8 + +SPKAC is a Certificate Signing Request mechanism originally implemented by +Netscape and was specified formally as part of [HTML5's `keygen` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/keygen). + +Note that `` is deprecated since [HTML 5.2](https://www.w3.org/TR/html52/changes.html#features-removed) and new projects +should not use this element anymore. + +The `crypto` module provides the `Certificate` class for working with SPKAC +data. The most common usage is handling output generated by the HTML5 +`` element. Node.js uses [OpenSSL's SPKAC implementation](https://www.openssl.org/docs/man1.1.0/apps/openssl-spkac.html) internally. + +### Certificate.exportChallenge(spkac)[#](#crypto_certificate_exportchallenge_spkac) + +Added in: v9.0.0 + +* `spkac` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) The challenge component of the `spkac` data structure, which + includes a public key and a challenge. + +```None +const { Certificate } = require('crypto'); +const spkac = getSpkacSomehow(); +const challenge = Certificate.exportChallenge(spkac); +console.log(challenge.toString('utf8')); +// Prints: the challenge as a UTF8 string +``` + +### Certificate.exportPublicKey(spkac[, encoding])[#](#crypto_certificate_exportpublickey_spkac_encoding) + +Added in: v9.0.0 + +* `spkac` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `spkac` string. +* Returns: [](buffer.html#buffer_class_buffer) The public key component of the `spkac` data structure, + which includes a public key and a challenge. + +```None +const { Certificate } = require('crypto'); +const spkac = getSpkacSomehow(); +const publicKey = Certificate.exportPublicKey(spkac); +console.log(publicKey); +// Prints: the public key as +``` + +### Certificate.verifySpkac(spkac)[#](#crypto_certificate_verifyspkac_spkac) + +Added in: v9.0.0 + +* `spkac` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` if the given `spkac` data structure is valid, + `false` otherwise. + +```None +const { Certificate } = require('crypto'); +const spkac = getSpkacSomehow(); +console.log(Certificate.verifySpkac(Buffer.from(spkac))); +// Prints: true or false +``` + +### Legacy API[#](#crypto_legacy_api) + +As a still supported legacy interface, it is possible (but not recommended) to +create new instances of the `crypto.Certificate` class as illustrated in the +examples below. + +#### new crypto.Certificate()[#](#crypto_new_crypto_certificate) + +Instances of the `Certificate` class can be created using the `new` keyword +or by calling `crypto.Certificate()` as a function: + +```None +const crypto = require('crypto'); + +const cert1 = new crypto.Certificate(); +const cert2 = crypto.Certificate(); +``` + +#### certificate.exportChallenge(spkac)[#](#crypto_certificate_exportchallenge_spkac_1) + +Added in: v0.11.8 + +* `spkac` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) The challenge component of the `spkac` data structure, which + includes a public key and a challenge. + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +const challenge = cert.exportChallenge(spkac); +console.log(challenge.toString('utf8')); +// Prints: the challenge as a UTF8 string +``` + +#### certificate.exportPublicKey(spkac)[#](#crypto_certificate_exportpublickey_spkac) + +Added in: v0.11.8 + +* `spkac` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) The public key component of the `spkac` data structure, + which includes a public key and a challenge. + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +const publicKey = cert.exportPublicKey(spkac); +console.log(publicKey); +// Prints: the public key as +``` + +#### certificate.verifySpkac(spkac)[#](#crypto_certificate_verifyspkac_spkac_1) + +Added in: v0.11.8 + +* `spkac` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` if the given `spkac` data structure is valid, + `false` otherwise. + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +console.log(cert.verifySpkac(Buffer.from(spkac))); +// Prints: true or false +``` + +## Class: Cipher[#](#crypto_class_cipher) + +Added in: v0.1.94 + +Instances of the `Cipher` class are used to encrypt data. The class can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where plain unencrypted + data is written to produce encrypted data on the readable side, or +* Using the [`cipher.update()`](#crypto_cipher_update_data_inputencoding_outputencoding) and [`cipher.final()`](#crypto_cipher_final_outputencoding) methods to produce + the encrypted data. + +The [`crypto.createCipher()`](#crypto_crypto_createcipher_algorithm_password_options) or [`crypto.createCipheriv()`](#crypto_crypto_createcipheriv_algorithm_key_iv_options) methods are +used to create `Cipher` instances. `Cipher` objects are not to be created +directly using the `new` keyword. + +Example: Using `Cipher` objects as streams: + +```None +const crypto = require('crypto'); + +const algorithm = 'aes-192-cbc'; +const password = 'Password used to generate key'; +// Key length is dependent on the algorithm. In this case for aes192, it is +// 24 bytes (192 bits). +// Use async `crypto.scrypt()` instead. +const key = crypto.scryptSync(password, 'salt', 24); +// Use `crypto.randomBytes()` to generate a random iv instead of the static iv +// shown here. +const iv = Buffer.alloc(16, 0); // Initialization vector. + +const cipher = crypto.createCipheriv(algorithm, key, iv); + +let encrypted = ''; +cipher.on('readable', () => { + let chunk; + while (null !== (chunk = cipher.read())) { + encrypted += chunk.toString('hex'); + } +}); +cipher.on('end', () => { + console.log(encrypted); + // Prints: e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa +}); + +cipher.write('some clear text data'); +cipher.end(); +``` + +Example: Using `Cipher` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); + +const algorithm = 'aes-192-cbc'; +const password = 'Password used to generate key'; +// Use the async `crypto.scrypt()` instead. +const key = crypto.scryptSync(password, 'salt', 24); +// Use `crypto.randomBytes()` to generate a random iv instead of the static iv +// shown here. +const iv = Buffer.alloc(16, 0); // Initialization vector. + +const cipher = crypto.createCipheriv(algorithm, key, iv); + +const input = fs.createReadStream('test.js'); +const output = fs.createWriteStream('test.enc'); + +input.pipe(cipher).pipe(output); +``` + +Example: Using the [`cipher.update()`](#crypto_cipher_update_data_inputencoding_outputencoding) and [`cipher.final()`](#crypto_cipher_final_outputencoding) methods: + +```None +const crypto = require('crypto'); + +const algorithm = 'aes-192-cbc'; +const password = 'Password used to generate key'; +// Use the async `crypto.scrypt()` instead. +const key = crypto.scryptSync(password, 'salt', 24); +// Use `crypto.randomBytes` to generate a random iv instead of the static iv +// shown here. +const iv = Buffer.alloc(16, 0); // Initialization vector. + +const cipher = crypto.createCipheriv(algorithm, key, iv); + +let encrypted = cipher.update('some clear text data', 'utf8', 'hex'); +encrypted += cipher.final('hex'); +console.log(encrypted); +// Prints: e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa +``` + +### cipher.final([outputEncoding])[#](#crypto_cipher_final_outputencoding) + +Added in: v0.1.94 + +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Any remaining enciphered contents. + If `outputEncoding` is specified, a string is + returned. If an `outputEncoding` is not provided, a [`Buffer`](buffer.html) is returned. + +Once the `cipher.final()` method has been called, the `Cipher` object can no +longer be used to encrypt data. Attempts to call `cipher.final()` more than +once will result in an error being thrown. + +### cipher.setAAD(buffer[, options])[#](#crypto_cipher_setaad_buffer_options) + +Added in: v1.0.0 + +* `buffer` [](buffer.html#buffer_class_buffer) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) + + + `plaintextLength` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* Returns: [](crypto.html#crypto_class_cipher) for method chaining. + +When using an authenticated encryption mode (`GCM`, `CCM` and `OCB` are +currently supported), the `cipher.setAAD()` method sets the value used for the +*additional authenticated data* (AAD) input parameter. + +The `options` argument is optional for `GCM` and `OCB`. When using `CCM`, the +`plaintextLength` option must be specified and its value must match the length +of the plaintext in bytes. See [CCM mode](#crypto_ccm_mode). + +The `cipher.setAAD()` method must be called before [`cipher.update()`](#crypto_cipher_update_data_inputencoding_outputencoding). + +### cipher.getAuthTag()[#](#crypto_cipher_getauthtag) + +Added in: v1.0.0 + +* Returns: [](buffer.html#buffer_class_buffer) When using an authenticated encryption mode (`GCM`, `CCM` + and `OCB` are currently supported), the `cipher.getAuthTag()` method returns a + [`Buffer`](buffer.html) containing the *authentication tag* that has been computed from + the given data. + +The `cipher.getAuthTag()` method should only be called after encryption has +been completed using the [`cipher.final()`](#crypto_cipher_final_outputencoding) method. + +### cipher.setAutoPadding([autoPadding])[#](#crypto_cipher_setautopadding_autopadding) + +Added in: v0.7.1 + +* `autoPadding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) **Default:** `true` +* Returns: [](crypto.html#crypto_class_cipher) for method chaining. + +When using block encryption algorithms, the `Cipher` class will automatically +add padding to the input data to the appropriate block size. To disable the +default padding call `cipher.setAutoPadding(false)`. + +When `autoPadding` is `false`, the length of the entire input data must be a +multiple of the cipher's block size or [`cipher.final()`](#crypto_cipher_final_outputencoding) will throw an error. +Disabling automatic padding is useful for non-standard padding, for instance +using `0x0` instead of PKCS padding. + +The `cipher.setAutoPadding()` method must be called before +[`cipher.final()`](#crypto_cipher_final_outputencoding). + +### cipher.update(data[, inputEncoding][, outputencoding])[#](#crypto_cipher_update_data_inputencoding_outputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.94 | Added in: v0.1.94 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the data. +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Updates the cipher with `data`. If the `inputEncoding` argument is given, +the `data` +argument is a string using the specified encoding. If the `inputEncoding` +argument is not given, `data` must be a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or `DataView`, then +`inputEncoding` is ignored. + +The `outputEncoding` specifies the output format of the enciphered +data. If the `outputEncoding` +is specified, a string using the specified encoding is returned. If no +`outputEncoding` is provided, a [`Buffer`](buffer.html) is returned. + +The `cipher.update()` method can be called multiple times with new data until +[`cipher.final()`](#crypto_cipher_final_outputencoding) is called. Calling `cipher.update()` after +[`cipher.final()`](#crypto_cipher_final_outputencoding) will result in an error being thrown. + +## Class: Decipher[#](#crypto_class_decipher) + +Added in: v0.1.94 + +Instances of the `Decipher` class are used to decrypt data. The class can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where plain encrypted + data is written to produce unencrypted data on the readable side, or +* Using the [`decipher.update()`](#crypto_decipher_update_data_inputencoding_outputencoding) and [`decipher.final()`](#crypto_decipher_final_outputencoding) methods to + produce the unencrypted data. + +The [`crypto.createDecipher()`](#crypto_crypto_createdecipher_algorithm_password_options) or [`crypto.createDecipheriv()`](#crypto_crypto_createdecipheriv_algorithm_key_iv_options) methods are +used to create `Decipher` instances. `Decipher` objects are not to be created +directly using the `new` keyword. + +Example: Using `Decipher` objects as streams: + +```None +const crypto = require('crypto'); + +const algorithm = 'aes-192-cbc'; +const password = 'Password used to generate key'; +// Key length is dependent on the algorithm. In this case for aes192, it is +// 24 bytes (192 bits). +// Use the async `crypto.scrypt()` instead. +const key = crypto.scryptSync(password, 'salt', 24); +// The IV is usually passed along with the ciphertext. +const iv = Buffer.alloc(16, 0); // Initialization vector. + +const decipher = crypto.createDecipheriv(algorithm, key, iv); + +let decrypted = ''; +decipher.on('readable', () => { + while (null !== (chunk = decipher.read())) { + decrypted += chunk.toString('utf8'); + } +}); +decipher.on('end', () => { + console.log(decrypted); + // Prints: some clear text data +}); + +// Encrypted with same algorithm, key and iv. +const encrypted = + 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; +decipher.write(encrypted, 'hex'); +decipher.end(); +``` + +Example: Using `Decipher` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); + +const algorithm = 'aes-192-cbc'; +const password = 'Password used to generate key'; +// Use the async `crypto.scrypt()` instead. +const key = crypto.scryptSync(password, 'salt', 24); +// The IV is usually passed along with the ciphertext. +const iv = Buffer.alloc(16, 0); // Initialization vector. + +const decipher = crypto.createDecipheriv(algorithm, key, iv); + +const input = fs.createReadStream('test.enc'); +const output = fs.createWriteStream('test.js'); + +input.pipe(decipher).pipe(output); +``` + +Example: Using the [`decipher.update()`](#crypto_decipher_update_data_inputencoding_outputencoding) and [`decipher.final()`](#crypto_decipher_final_outputencoding) methods: + +```None +const crypto = require('crypto'); + +const algorithm = 'aes-192-cbc'; +const password = 'Password used to generate key'; +// Use the async `crypto.scrypt()` instead. +const key = crypto.scryptSync(password, 'salt', 24); +// The IV is usually passed along with the ciphertext. +const iv = Buffer.alloc(16, 0); // Initialization vector. + +const decipher = crypto.createDecipheriv(algorithm, key, iv); + +// Encrypted using same algorithm, key and iv. +const encrypted = + 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; +let decrypted = decipher.update(encrypted, 'hex', 'utf8'); +decrypted += decipher.final('utf8'); +console.log(decrypted); +// Prints: some clear text data +``` + +### decipher.final([outputEncoding])[#](#crypto_decipher_final_outputencoding) + +Added in: v0.1.94 + +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Any remaining deciphered contents. + If `outputEncoding` is specified, a string is + returned. If an `outputEncoding` is not provided, a [`Buffer`](buffer.html) is returned. + +Once the `decipher.final()` method has been called, the `Decipher` object can +no longer be used to decrypt data. Attempts to call `decipher.final()` more +than once will result in an error being thrown. + +### decipher.setAAD(buffer[, options])[#](#crypto_decipher_setaad_buffer_options) + +History + +| Version | Changes | +| --- | --- | +| v7.2.0 | This method now returns a reference to `decipher`. | +| v1.0.0 | Added in: v1.0.0 | + +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) + + + `plaintextLength` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* Returns: [](crypto.html#crypto_class_decipher) for method chaining. + +When using an authenticated encryption mode (`GCM`, `CCM` and `OCB` are +currently supported), the `decipher.setAAD()` method sets the value used for the +*additional authenticated data* (AAD) input parameter. + +The `options` argument is optional for `GCM`. When using `CCM`, the +`plaintextLength` option must be specified and its value must match the length +of the plaintext in bytes. See [CCM mode](#crypto_ccm_mode). + +The `decipher.setAAD()` method must be called before [`decipher.update()`](#crypto_decipher_update_data_inputencoding_outputencoding). + +### decipher.setAuthTag(buffer)[#](#crypto_decipher_setauthtag_buffer) + +History + +| Version | Changes | +| --- | --- | +| v7.2.0 | This method now returns a reference to `decipher`. | +| v1.0.0 | Added in: v1.0.0 | + +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](crypto.html#crypto_class_decipher) for method chaining. + +When using an authenticated encryption mode (`GCM`, `CCM` and `OCB` are +currently supported), the `decipher.setAuthTag()` method is used to pass in the +received *authentication tag*. If no tag is provided, or if the cipher text +has been tampered with, [`decipher.final()`](#crypto_decipher_final_outputencoding) will throw, indicating that the +cipher text should be discarded due to failed authentication. + +Note that this Node.js version does not verify the length of GCM authentication +tags. Such a check *must* be implemented by applications and is crucial to the +authenticity of the encrypted data, otherwise, an attacker can use an +arbitrarily short authentication tag to increase the chances of successfully +passing authentication (up to 0.39%). It is highly recommended to associate one +of the values 16, 15, 14, 13, 12, 8 or 4 bytes with each key, and to only permit +authentication tags of that length, see [NIST SP 800-38D](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf). + +The `decipher.setAuthTag()` method must be called before +[`decipher.final()`](#crypto_decipher_final_outputencoding). + +### decipher.setAutoPadding([autoPadding])[#](#crypto_decipher_setautopadding_autopadding) + +Added in: v0.7.1 + +* `autoPadding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) **Default:** `true` +* Returns: [](crypto.html#crypto_class_decipher) for method chaining. + +When data has been encrypted without standard block padding, calling +`decipher.setAutoPadding(false)` will disable automatic padding to prevent +[`decipher.final()`](#crypto_decipher_final_outputencoding) from checking for and removing padding. + +Turning auto padding off will only work if the input data's length is a +multiple of the ciphers block size. + +The `decipher.setAutoPadding()` method must be called before +[`decipher.final()`](#crypto_decipher_final_outputencoding). + +### decipher.update(data[, inputEncoding][, outputencoding])[#](#crypto_decipher_update_data_inputencoding_outputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.94 | Added in: v0.1.94 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `data` string. +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Updates the decipher with `data`. If the `inputEncoding` argument is given, +the `data` +argument is a string using the specified encoding. If the `inputEncoding` +argument is not given, `data` must be a [`Buffer`](buffer.html). If `data` is a +[`Buffer`](buffer.html) then `inputEncoding` is ignored. + +The `outputEncoding` specifies the output format of the enciphered +data. If the `outputEncoding` +is specified, a string using the specified encoding is returned. If no +`outputEncoding` is provided, a [`Buffer`](buffer.html) is returned. + +The `decipher.update()` method can be called multiple times with new data until +[`decipher.final()`](#crypto_decipher_final_outputencoding) is called. Calling `decipher.update()` after +[`decipher.final()`](#crypto_decipher_final_outputencoding) will result in an error being thrown. + +## Class: DiffieHellman[#](#crypto_class_diffiehellman) + +Added in: v0.5.0 + +The `DiffieHellman` class is a utility for creating Diffie-Hellman key +exchanges. + +Instances of the `DiffieHellman` class can be created using the +[`crypto.createDiffieHellman()`](#crypto_crypto_creatediffiehellman_prime_primeencoding_generator_generatorencoding) function. + +```None +const crypto = require('crypto'); +const assert = require('assert'); + +// Generate Alice's keys... +const alice = crypto.createDiffieHellman(2048); +const aliceKey = alice.generateKeys(); + +// Generate Bob's keys... +const bob = crypto.createDiffieHellman(alice.getPrime(), alice.getGenerator()); +const bobKey = bob.generateKeys(); + +// Exchange and generate the secret... +const aliceSecret = alice.computeSecret(bobKey); +const bobSecret = bob.computeSecret(aliceKey); + +// OK +assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); +``` + +### diffieHellman.computeSecret(otherPublicKey[, inputEncoding][, outputencoding])[#](#crypto_diffiehellman_computesecret_otherpublickey_inputencoding_outputencoding) + +Added in: v0.5.0 + +* `otherPublicKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of an `otherPublicKey` string. +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Computes the shared secret using `otherPublicKey` as the other +party's public key and returns the computed shared secret. The supplied +key is interpreted using the specified `inputEncoding`, and secret is +encoded using specified `outputEncoding`. +If the `inputEncoding` is not +provided, `otherPublicKey` is expected to be a [`Buffer`](buffer.html), +`TypedArray`, or `DataView`. + +If `outputEncoding` is given a string is returned; otherwise, a +[`Buffer`](buffer.html) is returned. + +### diffieHellman.generateKeys([encoding](buffer.html#buffer_buffers_and_character_encodings))[#](#crypto_diffiehellman_generatekeys_encoding) + +Added in: v0.5.0 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Generates private and public Diffie-Hellman key values, and returns +the public key in the specified `encoding`. This key should be +transferred to the other party. +If `encoding` is provided a string is returned; otherwise a +[`Buffer`](buffer.html) is returned. + +### diffieHellman.getGenerator([encoding](buffer.html#buffer_buffers_and_character_encodings))[#](#crypto_diffiehellman_getgenerator_encoding) + +Added in: v0.5.0 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the Diffie-Hellman generator in the specified `encoding`. +If `encoding` is provided a string is +returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPrime([encoding](buffer.html#buffer_buffers_and_character_encodings))[#](#crypto_diffiehellman_getprime_encoding) + +Added in: v0.5.0 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the Diffie-Hellman prime in the specified `encoding`. +If `encoding` is provided a string is +returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPrivateKey([encoding](buffer.html#buffer_buffers_and_character_encodings))[#](#crypto_diffiehellman_getprivatekey_encoding) + +Added in: v0.5.0 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the Diffie-Hellman private key in the specified `encoding`. +If `encoding` is provided a +string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPublicKey([encoding](buffer.html#buffer_buffers_and_character_encodings))[#](#crypto_diffiehellman_getpublickey_encoding) + +Added in: v0.5.0 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the Diffie-Hellman public key in the specified `encoding`. +If `encoding` is provided a +string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.setPrivateKey(privateKey[, encoding])[#](#crypto_diffiehellman_setprivatekey_privatekey_encoding) + +Added in: v0.5.0 + +* `privateKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `privateKey` string. + +Sets the Diffie-Hellman private key. If the `encoding` argument is provided, +`privateKey` is expected +to be a string. If no `encoding` is provided, `privateKey` is expected +to be a [`Buffer`](buffer.html), `TypedArray`, or `DataView`. + +### diffieHellman.setPublicKey(publicKey[, encoding])[#](#crypto_diffiehellman_setpublickey_publickey_encoding) + +Added in: v0.5.0 + +* `publicKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `publicKey` string. + +Sets the Diffie-Hellman public key. If the `encoding` argument is provided, +`publicKey` is expected +to be a string. If no `encoding` is provided, `publicKey` is expected +to be a [`Buffer`](buffer.html), `TypedArray`, or `DataView`. + +### diffieHellman.verifyError[#](#crypto_diffiehellman_verifyerror) + +Added in: v0.11.12 + +A bit field containing any warnings and/or errors resulting from a check +performed during initialization of the `DiffieHellman` object. + +The following values are valid for this property (as defined in `constants` +module): + +* `DH_CHECK_P_NOT_SAFE_PRIME` +* `DH_CHECK_P_NOT_PRIME` +* `DH_UNABLE_TO_CHECK_GENERATOR` +* `DH_NOT_SUITABLE_GENERATOR` + +## Class: ECDH[#](#crypto_class_ecdh) + +Added in: v0.11.14 + +The `ECDH` class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH) +key exchanges. + +Instances of the `ECDH` class can be created using the +[`crypto.createECDH()`](#crypto_crypto_createecdh_curvename) function. + +```None +const crypto = require('crypto'); +const assert = require('assert'); + +// Generate Alice's keys... +const alice = crypto.createECDH('secp521r1'); +const aliceKey = alice.generateKeys(); + +// Generate Bob's keys... +const bob = crypto.createECDH('secp521r1'); +const bobKey = bob.generateKeys(); + +// Exchange and generate the secret... +const aliceSecret = alice.computeSecret(bobKey); +const bobSecret = bob.computeSecret(aliceKey); + +assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); +// OK +``` + +### Class Method: ECDH.convertKey(key, curve[, inputEncoding[, outputEncoding[, format]]])[#](#crypto_class_method_ecdh_convertkey_key_curve_inputencoding_outputencoding_format) + +Added in: v10.0.0 + +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `curve` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `key` string. +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* `format` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) **Default:** `'uncompressed'` +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Converts the EC Diffie-Hellman public key specified by `key` and `curve` to the +format specified by `format`. The `format` argument specifies point encoding +and can be `'compressed'`, `'uncompressed'` or `'hybrid'`. The supplied key is +interpreted using the specified `inputEncoding`, and the returned key is encoded +using the specified `outputEncoding`. + +Use [`crypto.getCurves()`](#crypto_crypto_getcurves) to obtain a list of available curve names. +On recent OpenSSL releases, `openssl ecparam -list_curves` will also display +the name and description of each available elliptic curve. + +If `format` is not specified the point will be returned in `'uncompressed'` +format. + +If the `inputEncoding` is not provided, `key` is expected to be a [`Buffer`](buffer.html), +`TypedArray`, or `DataView`. + +Example (uncompressing a key): + +```None +const { createECDH, ECDH } = require('crypto'); + +const ecdh = createECDH('secp256k1'); +ecdh.generateKeys(); + +const compressedKey = ecdh.getPublicKey('hex', 'compressed'); + +const uncompressedKey = ECDH.convertKey(compressedKey, + 'secp256k1', + 'hex', + 'hex', + 'uncompressed'); + +// the converted key and the uncompressed public key should be the same +console.log(uncompressedKey === ecdh.getPublicKey('hex')); +``` + +### ecdh.computeSecret(otherPublicKey[, inputEncoding][, outputencoding])[#](#crypto_ecdh_computesecret_otherpublickey_inputencoding_outputencoding) + +History + +| Version | Changes | +| --- | --- | +| v10.0.0 | Changed error format to better support invalid public key error | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8` | +| v0.11.14 | Added in: v0.11.14 | + +* `otherPublicKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `otherPublicKey` string. +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Computes the shared secret using `otherPublicKey` as the other +party's public key and returns the computed shared secret. The supplied +key is interpreted using specified `inputEncoding`, and the returned secret +is encoded using the specified `outputEncoding`. +If the `inputEncoding` is not +provided, `otherPublicKey` is expected to be a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`. + +If `outputEncoding` is given a string will be returned; otherwise a +[`Buffer`](buffer.html) is returned. + +`ecdh.computeSecret` will throw an +`ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY` error when `otherPublicKey` +lies outside of the elliptic curve. Since `otherPublicKey` is +usually supplied from a remote user over an insecure network, +its recommended for developers to handle this exception accordingly. + +### ecdh.generateKeys([encoding[, format]])[#](#crypto_ecdh_generatekeys_encoding_format) + +Added in: v0.11.14 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* `format` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) **Default:** `'uncompressed'` +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Generates private and public EC Diffie-Hellman key values, and returns +the public key in the specified `format` and `encoding`. This key should be +transferred to the other party. + +The `format` argument specifies point encoding and can be `'compressed'` or +`'uncompressed'`. If `format` is not specified, the point will be returned in +`'uncompressed'` format. + +If `encoding` is provided a string is returned; otherwise a [`Buffer`](buffer.html) +is returned. + +### ecdh.getPrivateKey([encoding](buffer.html#buffer_buffers_and_character_encodings))[#](#crypto_ecdh_getprivatekey_encoding) + +Added in: v0.11.14 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The EC Diffie-Hellman in the specified `encoding`. + +If `encoding` is specified, a string is returned; otherwise a [`Buffer`](buffer.html) is +returned. + +### ecdh.getPublicKey([encoding][, format])[#](#crypto_ecdh_getpublickey_encoding_format) + +Added in: v0.11.14 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* `format` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) **Default:** `'uncompressed'` +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The EC Diffie-Hellman public key in the specified + `encoding` and `format`. + +The `format` argument specifies point encoding and can be `'compressed'` or +`'uncompressed'`. If `format` is not specified the point will be returned in +`'uncompressed'` format. + +If `encoding` is specified, a string is returned; otherwise a [`Buffer`](buffer.html) is +returned. + +### ecdh.setPrivateKey(privateKey[, encoding])[#](#crypto_ecdh_setprivatekey_privatekey_encoding) + +Added in: v0.11.14 + +* `privateKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `privateKey` string. + +Sets the EC Diffie-Hellman private key. +If `encoding` is provided, `privateKey` is expected +to be a string; otherwise `privateKey` is expected to be a [`Buffer`](buffer.html), +`TypedArray`, or `DataView`. + +If `privateKey` is not valid for the curve specified when the `ECDH` object was +created, an error is thrown. Upon setting the private key, the associated +public point (key) is also generated and set in the `ECDH` object. + +### ecdh.setPublicKey(publicKey[, encoding])[#](#crypto_ecdh_setpublickey_publickey_encoding) + +Added in: v0.11.14Deprecated since: v5.2.0 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated + +* `publicKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `publicKey` string. + +Sets the EC Diffie-Hellman public key. +If `encoding` is provided `publicKey` is expected to +be a string; otherwise a [`Buffer`](buffer.html), `TypedArray`, or `DataView` is expected. + +Note that there is not normally a reason to call this method because `ECDH` +only requires a private key and the other party's public key to compute the +shared secret. Typically either [`ecdh.generateKeys()`](#crypto_ecdh_generatekeys_encoding_format) or +[`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_privatekey_encoding) will be called. The [`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_privatekey_encoding) method +attempts to generate the public point/key associated with the private key being +set. + +Example (obtaining a shared secret): + +```None +const crypto = require('crypto'); +const alice = crypto.createECDH('secp256k1'); +const bob = crypto.createECDH('secp256k1'); + +// This is a shortcut way of specifying one of Alice's previous private +// keys. It would be unwise to use such a predictable private key in a real +// application. +alice.setPrivateKey( + crypto.createHash('sha256').update('alice', 'utf8').digest() +); + +// Bob uses a newly generated cryptographically strong +// pseudorandom key pair +bob.generateKeys(); + +const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +// aliceSecret and bobSecret should be the same shared secret value +console.log(aliceSecret === bobSecret); +``` + +## Class: Hash[#](#crypto_class_hash) + +Added in: v0.1.92 + +The `Hash` class is a utility for creating hash digests of data. It can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where data is written + to produce a computed hash digest on the readable side, or +* Using the [`hash.update()`](#crypto_hash_update_data_inputencoding) and [`hash.digest()`](#crypto_hash_digest_encoding) methods to produce the + computed hash. + +The [`crypto.createHash()`](#crypto_crypto_createhash_algorithm_options) method is used to create `Hash` instances. `Hash` +objects are not to be created directly using the `new` keyword. + +Example: Using `Hash` objects as streams: + +```None +const crypto = require('crypto'); +const hash = crypto.createHash('sha256'); + +hash.on('readable', () => { + // Only one element is going to be produced by the + // hash stream. + const data = hash.read(); + if (data) { + console.log(data.toString('hex')); + // Prints: + // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 + } +}); + +hash.write('some data to hash'); +hash.end(); +``` + +Example: Using `Hash` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const hash = crypto.createHash('sha256'); + +const input = fs.createReadStream('test.js'); +input.pipe(hash).pipe(process.stdout); +``` + +Example: Using the [`hash.update()`](#crypto_hash_update_data_inputencoding) and [`hash.digest()`](#crypto_hash_digest_encoding) methods: + +```None +const crypto = require('crypto'); +const hash = crypto.createHash('sha256'); + +hash.update('some data to hash'); +console.log(hash.digest('hex')); +// Prints: +// 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 +``` + +### hash.digest([encoding](buffer.html#buffer_buffers_and_character_encodings))[#](#crypto_hash_digest_encoding) + +Added in: v0.1.92 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Calculates the digest of all of the data passed to be hashed (using the +[`hash.update()`](#crypto_hash_update_data_inputencoding) method). +If `encoding` is provided a string will be returned; otherwise +a [`Buffer`](buffer.html) is returned. + +The `Hash` object can not be used again after `hash.digest()` method has been +called. Multiple calls will cause an error to be thrown. + +### hash.update(data[, inputEncoding])[#](#crypto_hash_update_data_inputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.92 | Added in: v0.1.92 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `data` string. + +Updates the hash content with the given `data`, the encoding of which +is given in `inputEncoding`. +If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`, then `inputEncoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Hmac[#](#crypto_class_hmac) + +Added in: v0.1.94 + +The `Hmac` Class is a utility for creating cryptographic HMAC digests. It can +be used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where data is written + to produce a computed HMAC digest on the readable side, or +* Using the [`hmac.update()`](#crypto_hmac_update_data_inputencoding) and [`hmac.digest()`](#crypto_hmac_digest_encoding) methods to produce the + computed HMAC digest. + +The [`crypto.createHmac()`](#crypto_crypto_createhmac_algorithm_key_options) method is used to create `Hmac` instances. `Hmac` +objects are not to be created directly using the `new` keyword. + +Example: Using `Hmac` objects as streams: + +```None +const crypto = require('crypto'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +hmac.on('readable', () => { + // Only one element is going to be produced by the + // hash stream. + const data = hmac.read(); + if (data) { + console.log(data.toString('hex')); + // Prints: + // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e + } +}); + +hmac.write('some data to hash'); +hmac.end(); +``` + +Example: Using `Hmac` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +const input = fs.createReadStream('test.js'); +input.pipe(hmac).pipe(process.stdout); +``` + +Example: Using the [`hmac.update()`](#crypto_hmac_update_data_inputencoding) and [`hmac.digest()`](#crypto_hmac_digest_encoding) methods: + +```None +const crypto = require('crypto'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +hmac.update('some data to hash'); +console.log(hmac.digest('hex')); +// Prints: +// 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e +``` + +### hmac.digest([encoding](buffer.html#buffer_buffers_and_character_encodings))[#](#crypto_hmac_digest_encoding) + +Added in: v0.1.94 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Calculates the HMAC digest of all of the data passed using [`hmac.update()`](#crypto_hmac_update_data_inputencoding). +If `encoding` is +provided a string is returned; otherwise a [`Buffer`](buffer.html) is returned; + +The `Hmac` object can not be used again after `hmac.digest()` has been +called. Multiple calls to `hmac.digest()` will result in an error being thrown. + +### hmac.update(data[, inputEncoding])[#](#crypto_hmac_update_data_inputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.94 | Added in: v0.1.94 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `data` string. + +Updates the `Hmac` content with the given `data`, the encoding of which +is given in `inputEncoding`. +If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`, then `inputEncoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Sign[#](#crypto_class_sign) + +Added in: v0.1.92 + +The `Sign` Class is a utility for generating signatures. It can be used in one +of two ways: + +* As a writable [stream](stream.html), where data to be signed is written and the + [`sign.sign()`](#crypto_sign_sign_privatekey_outputencoding) method is used to generate and return the signature, or +* Using the [`sign.update()`](#crypto_sign_update_data_inputencoding) and [`sign.sign()`](#crypto_sign_sign_privatekey_outputencoding) methods to produce the + signature. + +The [`crypto.createSign()`](#crypto_crypto_createsign_algorithm_options) method is used to create `Sign` instances. The +argument is the string name of the hash function to use. `Sign` objects are not +to be created directly using the `new` keyword. + +Example: Using `Sign` objects as streams: + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('SHA256'); + +sign.write('some data to sign'); +sign.end(); + +const privateKey = getPrivateKeySomehow(); +console.log(sign.sign(privateKey, 'hex')); +// Prints: the calculated signature using the specified private key and +// SHA-256. For RSA keys, the algorithm is RSASSA-PKCS1-v1_5 (see padding +// parameter below for RSASSA-PSS). For EC keys, the algorithm is ECDSA. +``` + +Example: Using the [`sign.update()`](#crypto_sign_update_data_inputencoding) and [`sign.sign()`](#crypto_sign_sign_privatekey_outputencoding) methods: + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('SHA256'); + +sign.update('some data to sign'); + +const privateKey = getPrivateKeySomehow(); +console.log(sign.sign(privateKey, 'hex')); +// Prints: the calculated signature +``` + +In some cases, a `Sign` instance can also be created by passing in a signature +algorithm name, such as 'RSA-SHA256'. This will use the corresponding digest +algorithm. This does not work for all signature algorithms, such as +'ecdsa-with-SHA256'. Use digest names instead. + +Example: signing using legacy signature algorithm name + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('RSA-SHA256'); + +sign.update('some data to sign'); + +const privateKey = getPrivateKeySomehow(); +console.log(sign.sign(privateKey, 'hex')); +// Prints: the calculated signature +``` + +### sign.sign(privateKey[, outputEncoding])[#](#crypto_sign_sign_privatekey_outputencoding) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | Support for RSASSA-PSS and additional options was added. | +| v0.1.92 | Added in: v0.1.92 | + +* `privateKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + + `padding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + + `saltLength` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Calculates the signature on all the data passed through using either +[`sign.update()`](#crypto_sign_update_data_inputencoding) or [`sign.write()`](stream.html#stream_writable_write_chunk_encoding_callback). + +The `privateKey` argument can be an object or a string. If `privateKey` is a +string, it is treated as a raw key with no passphrase. If `privateKey` is an +object, it must contain one or more of the following properties: + +* `key`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded private key (required) +* `passphrase`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - passphrase for the private key +* `padding`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - Optional padding value for RSA, one of the following: + + + `crypto.constants.RSA_PKCS1_PADDING` (default) + + `crypto.constants.RSA_PKCS1_PSS_PADDING` + + Note that `RSA_PKCS1_PSS_PADDING` will use MGF1 with the same hash function + used to sign the message as specified in section 3.1 of [RFC 4055](https://www.rfc-editor.org/rfc/rfc4055.txt). +* `saltLength`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - salt length for when padding is + `RSA_PKCS1_PSS_PADDING`. The special value + `crypto.constants.RSA_PSS_SALTLEN_DIGEST` sets the salt length to the digest + size, `crypto.constants.RSA_PSS_SALTLEN_MAX_SIGN` (default) sets it to the + maximum permissible value. + +If `outputEncoding` is provided a string is returned; otherwise a [`Buffer`](buffer.html) +is returned. + +The `Sign` object can not be again used after `sign.sign()` method has been +called. Multiple calls to `sign.sign()` will result in an error being thrown. + +### sign.update(data[, inputEncoding])[#](#crypto_sign_update_data_inputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.92 | Added in: v0.1.92 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `data` string. + +Updates the `Sign` content with the given `data`, the encoding of which +is given in `inputEncoding`. +If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`, then `inputEncoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Verify[#](#crypto_class_verify) + +Added in: v0.1.92 + +The `Verify` class is a utility for verifying signatures. It can be used in one +of two ways: + +* As a writable [stream](stream.html) where written data is used to validate against the + supplied signature, or +* Using the [`verify.update()`](#crypto_verify_update_data_inputencoding) and [`verify.verify()`](#crypto_verify_verify_object_signature_signatureencoding) methods to verify + the signature. + +The [`crypto.createVerify()`](#crypto_crypto_createverify_algorithm_options) method is used to create `Verify` instances. +`Verify` objects are not to be created directly using the `new` keyword. + +Example: Using `Verify` objects as streams: + +```None +const crypto = require('crypto'); +const verify = crypto.createVerify('SHA256'); + +verify.write('some data to sign'); +verify.end(); + +const publicKey = getPublicKeySomehow(); +const signature = getSignatureToVerify(); +console.log(verify.verify(publicKey, signature)); +// Prints: true or false +``` + +Example: Using the [`verify.update()`](#crypto_verify_update_data_inputencoding) and [`verify.verify()`](#crypto_verify_verify_object_signature_signatureencoding) methods: + +```None +const crypto = require('crypto'); +const verify = crypto.createVerify('SHA256'); + +verify.update('some data to sign'); + +const publicKey = getPublicKeySomehow(); +const signature = getSignatureToVerify(); +console.log(verify.verify(publicKey, signature)); +// Prints: true or false +``` + +### verify.update(data[, inputEncoding])[#](#crypto_verify_update_data_inputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.92 | Added in: v0.1.92 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `data` string. + +Updates the `Verify` content with the given `data`, the encoding of which +is given in `inputEncoding`. +If `inputEncoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`, then `inputEncoding` is ignored. + +This can be called many times with new data as it is streamed. + +### verify.verify(object, signature[, signatureEncoding])[#](#crypto_verify_verify_object_signature_signatureencoding) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | Support for RSASSA-PSS and additional options was added. | +| v0.1.92 | Added in: v0.1.92 | + +* `object` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) +* `signature` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `signatureEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `signature` string. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` or `false` depending on the validity of the + signature for the data and public key. + +Verifies the provided data using the given `object` and `signature`. +The `object` argument can be either a string containing a PEM encoded object, +which can be an RSA public key, a DSA public key, or an X.509 certificate, +or an object with one or more of the following properties: + +* `key`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded public key (required) +* `padding`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - Optional padding value for RSA, one of the following: + + + `crypto.constants.RSA_PKCS1_PADDING` (default) + + `crypto.constants.RSA_PKCS1_PSS_PADDING` + + Note that `RSA_PKCS1_PSS_PADDING` will use MGF1 with the same hash function + used to verify the message as specified in section 3.1 of [RFC 4055](https://www.rfc-editor.org/rfc/rfc4055.txt). +* `saltLength`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - salt length for when padding is + `RSA_PKCS1_PSS_PADDING`. The special value + `crypto.constants.RSA_PSS_SALTLEN_DIGEST` sets the salt length to the digest + size, `crypto.constants.RSA_PSS_SALTLEN_AUTO` (default) causes it to be + determined automatically. + +The `signature` argument is the previously calculated signature for the data, in +the `signatureEncoding`. +If a `signatureEncoding` is specified, the `signature` is expected to be a +string; otherwise `signature` is expected to be a [`Buffer`](buffer.html), +`TypedArray`, or `DataView`. + +The `verify` object can not be used again after `verify.verify()` has been +called. Multiple calls to `verify.verify()` will result in an error being +thrown. + +## `crypto` module methods and properties[#](#crypto_crypto_module_methods_and_properties) + +### crypto.constants[#](#crypto_crypto_constants) + +Added in: v6.3.0 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) An object containing commonly used constants for crypto and + security related operations. The specific constants currently defined are + described in [Crypto Constants](#crypto_crypto_constants_1). + +### crypto.DEFAULT\_ENCODING[#](#crypto_crypto_default_encoding) + +Added in: v0.9.3Deprecated since: v10.0.0 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated + +The default encoding to use for functions that can take either strings +or [buffers](buffer.html). The default value is `'buffer'`, which makes methods +default to [`Buffer`](buffer.html) objects. + +The `crypto.DEFAULT_ENCODING` mechanism is provided for backwards compatibility +with legacy programs that expect `'latin1'` to be the default encoding. + +New applications should expect the default to be `'buffer'`. + +This property is deprecated. + +### crypto.fips[#](#crypto_crypto_fips) + +Added in: v6.0.0Deprecated since: v10.0.0 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated + +Property for checking and controlling whether a FIPS compliant crypto provider +is currently in use. Setting to true requires a FIPS build of Node.js. + +This property is deprecated. Please use `crypto.setFips()` and +`crypto.getFips()` instead. + +### crypto.createCipher(algorithm, password[, options])[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/crypto.js#L104)[#](#crypto_crypto_createcipher_algorithm_password_options) + +History + +| Version | Changes | +| --- | --- | +| v10.10.0 | Ciphers in OCB mode are now supported. | +| v10.2.0 | The `authTagLength` option can now be used to produce shorter authentication tags in GCM mode and defaults to 16 bytes. | +| v10.0.0 | Deprecated since: v10.0.0 | +| v0.1.94 | Added in: v0.1.94 | + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`crypto.createCipheriv()`](#crypto_crypto_createcipheriv_algorithm_key_iv_options) instead. + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `password` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) +* Returns: [](crypto.html#crypto_class_cipher) + +Creates and returns a `Cipher` object that uses the given `algorithm` and +`password`. + +The `options` argument controls stream behavior and is optional except when a +cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the +`authTagLength` option is required and specifies the length of the +authentication tag in bytes, see [CCM mode](#crypto_ccm_mode). In GCM mode, the `authTagLength` +option is not required but can be used to set the length of the authentication +tag that will be returned by `getAuthTag()` and defaults to 16 bytes. + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list -cipher-algorithms` +(`openssl list-cipher-algorithms` for older versions of OpenSSL) will +display the available cipher algorithms. + +The `password` is used to derive the cipher key and initialization vector (IV). +The value must be either a `'latin1'` encoded string, a [`Buffer`](buffer.html), a +`TypedArray`, or a `DataView`. + +The implementation of `crypto.createCipher()` derives keys using the OpenSSL +function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one +iteration, and no salt. The lack of salt allows dictionary attacks as the same +password always creates the same key. The low iteration count and +non-cryptographically secure hash algorithm allow passwords to be tested very +rapidly. + +In line with OpenSSL's recommendation to use a more modern algorithm instead of +[`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) it is recommended that developers derive a key and IV on +their own using [`crypto.scrypt()`](#crypto_crypto_scrypt_password_salt_keylen_options_callback) and to use [`crypto.createCipheriv()`](#crypto_crypto_createcipheriv_algorithm_key_iv_options) +to create the `Cipher` object. Users should not use ciphers with counter mode +(e.g. CTR, GCM, or CCM) in `crypto.createCipher()`. A warning is emitted when +they are used in order to avoid the risk of IV reuse that causes +vulnerabilities. For the case when IV is reused in GCM, see [Nonce-Disrespecting +Adversaries](https://github.com/nonce-disrespect/nonce-disrespect) for details. + +### crypto.createCipheriv(algorithm, key, iv[, options])[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/crypto.js#L108)[#](#crypto_crypto_createcipheriv_algorithm_key_iv_options) + +History + +| Version | Changes | +| --- | --- | +| v10.17.0 | The cipher `chacha20-poly1305` is now supported. | +| v10.10.0 | Ciphers in OCB mode are now supported. | +| v10.2.0 | The `authTagLength` option can now be used to produce shorter authentication tags in GCM mode and defaults to 16 bytes. | +| v9.9.0 | The `iv` parameter may now be `null` for ciphers which do not need an initialization vector. | +| v0.1.94 | Added in: v0.1.94 | + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `iv` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) +* Returns: [](crypto.html#crypto_class_cipher) + +Creates and returns a `Cipher` object, with the given `algorithm`, `key` and +initialization vector (`iv`). + +The `options` argument controls stream behavior and is optional except when a +cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the +`authTagLength` option is required and specifies the length of the +authentication tag in bytes, see [CCM mode](#crypto_ccm_mode). In GCM mode, the `authTagLength` +option is not required but can be used to set the length of the authentication +tag that will be returned by `getAuthTag()` and defaults to 16 bytes. + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list -cipher-algorithms` +(`openssl list-cipher-algorithms` for older versions of OpenSSL) will +display the available cipher algorithms. + +The `key` is the raw key used by the `algorithm` and `iv` is an +[initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded strings, +[Buffers](buffer.html), `TypedArray`, or `DataView`s. If the cipher does not need +an initialization vector, `iv` may be `null`. + +Initialization vectors should be unpredictable and unique; ideally, they will be +cryptographically random. They do not have to be secret: IVs are typically just +added to ciphertext messages unencrypted. It may sound contradictory that +something has to be unpredictable and unique, but does not have to be secret; +it is important to remember that an attacker must not be able to predict ahead +of time what a given IV will be. + +### crypto.createCredentials(details)[#](#crypto_crypto_createcredentials_details) + +Added in: v0.1.92Deprecated since: v0.11.13 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options) instead. + +* `details` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Identical to [`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options). +* Returns: [](tls.html#tls_tls_createsecurecontext_options) + +The `crypto.createCredentials()` method is a deprecated function for creating +and returning a `tls.SecureContext`. It should not be used. Replace it with +[`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options) which has the exact same arguments and return +value. + +Returns a `tls.SecureContext`, as-if [`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options) had been +called. + +### crypto.createDecipher(algorithm, password[, options])[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/crypto.js#L112)[#](#crypto_crypto_createdecipher_algorithm_password_options) + +History + +| Version | Changes | +| --- | --- | +| v10.10.0 | Ciphers in OCB mode are now supported. | +| v10.0.0 | Deprecated since: v10.0.0 | +| v0.1.94 | Added in: v0.1.94 | + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`crypto.createDecipheriv()`](#crypto_crypto_createdecipheriv_algorithm_key_iv_options) instead. + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `password` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) +* Returns: [](crypto.html#crypto_class_decipher) + +Creates and returns a `Decipher` object that uses the given `algorithm` and +`password` (key). + +The `options` argument controls stream behavior and is optional except when a +cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the +`authTagLength` option is required and specifies the length of the +authentication tag in bytes, see [CCM mode](#crypto_ccm_mode). + +The implementation of `crypto.createDecipher()` derives keys using the OpenSSL +function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one +iteration, and no salt. The lack of salt allows dictionary attacks as the same +password always creates the same key. The low iteration count and +non-cryptographically secure hash algorithm allow passwords to be tested very +rapidly. + +In line with OpenSSL's recommendation to use a more modern algorithm instead of +[`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) it is recommended that developers derive a key and IV on +their own using [`crypto.scrypt()`](#crypto_crypto_scrypt_password_salt_keylen_options_callback) and to use [`crypto.createDecipheriv()`](#crypto_crypto_createdecipheriv_algorithm_key_iv_options) +to create the `Decipher` object. + +### crypto.createDecipheriv(algorithm, key, iv[, options])[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/crypto.js#L116)[#](#crypto_crypto_createdecipheriv_algorithm_key_iv_options) + +History + +| Version | Changes | +| --- | --- | +| v10.17.0 | The cipher `chacha20-poly1305` is now supported. | +| v10.10.0 | Ciphers in OCB mode are now supported. | +| v10.2.0 | The `authTagLength` option can now be used to restrict accepted GCM authentication tag lengths. | +| v9.9.0 | The `iv` parameter may now be `null` for ciphers which do not need an initialization vector. | +| v0.1.94 | Added in: v0.1.94 | + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `iv` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) +* Returns: [](crypto.html#crypto_class_decipher) + +Creates and returns a `Decipher` object that uses the given `algorithm`, `key` +and initialization vector (`iv`). + +The `options` argument controls stream behavior and is optional except when a +cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the +`authTagLength` option is required and specifies the length of the +authentication tag in bytes, see [CCM mode](#crypto_ccm_mode). In GCM mode, the `authTagLength` +option is not required but can be used to restrict accepted authentication tags +to those with the specified length. + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list -cipher-algorithms` +(`openssl list-cipher-algorithms` for older versions of OpenSSL) will +display the available cipher algorithms. + +The `key` is the raw key used by the `algorithm` and `iv` is an +[initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded strings, +[Buffers](buffer.html), `TypedArray`, or `DataView`s. If the cipher does not need +an initialization vector, `iv` may be `null`. + +Initialization vectors should be unpredictable and unique; ideally, they will be +cryptographically random. They do not have to be secret: IVs are typically just +added to ciphertext messages unencrypted. It may sound contradictory that +something has to be unpredictable and unique, but does not have to be secret; +it is important to remember that an attacker must not be able to predict ahead +of time what a given IV will be. + +### crypto.createDiffieHellman(prime[, primeEncoding][, generator][, generatorEncoding])[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/crypto.js#L120)[#](#crypto_crypto_creatediffiehellman_prime_primeencoding_generator_generatorencoding) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `prime` argument can be any `TypedArray` or `DataView` now. | +| v8.0.0 | The `prime` argument can be a `Uint8Array` now. | +| v6.0.0 | The default for the encoding parameters changed from `binary` to `utf8`. | +| v0.11.12 | Added in: v0.11.12 | + +* `prime` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `primeEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `prime` string. +* `generator` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) **Default:** + `2` +* `generatorEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `generator` string. +* Returns: [](crypto.html#crypto_class_diffiehellman) + +Creates a `DiffieHellman` key exchange object using the supplied `prime` and an +optional specific `generator`. + +The `generator` argument can be a number, string, or [`Buffer`](buffer.html). If +`generator` is not specified, the value `2` is used. + +If `primeEncoding` is specified, `prime` is expected to be a string; otherwise +a [`Buffer`](buffer.html), `TypedArray`, or `DataView` is expected. + +If `generatorEncoding` is specified, `generator` is expected to be a string; +otherwise a number, [`Buffer`](buffer.html), `TypedArray`, or `DataView` is expected. + +### crypto.createDiffieHellman(primeLength[, generator])[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/crypto.js#L120)[#](#crypto_crypto_creatediffiehellman_primelength_generator) + +Added in: v0.5.0 + +* `primeLength` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `generator` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) **Default:** + `2` +* Returns: [](crypto.html#crypto_class_diffiehellman) + +Creates a `DiffieHellman` key exchange object and generates a prime of +`primeLength` bits using an optional specific numeric `generator`. +If `generator` is not specified, the value `2` is used. + +### crypto.createECDH(curveName)[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/crypto.js#L128)[#](#crypto_crypto_createecdh_curvename) + +Added in: v0.11.14 + +* `curveName` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](crypto.html#crypto_class_ecdh) + +Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a +predefined curve specified by the `curveName` string. Use +[`crypto.getCurves()`](#crypto_crypto_getcurves) to obtain a list of available curve names. On recent +OpenSSL releases, `openssl ecparam -list_curves` will also display the name +and description of each available elliptic curve. + +### crypto.createHash(algorithm[, options])[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/crypto.js#L100)[#](#crypto_crypto_createhash_algorithm_options) + +Added in: v0.1.92 + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) +* Returns: [](crypto.html#crypto_class_hash) + +Creates and returns a `Hash` object that can be used to generate hash digests +using the given `algorithm`. Optional `options` argument controls stream +behavior. + +The `algorithm` is dependent on the available algorithms supported by the +version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. +On recent releases of OpenSSL, `openssl list -digest-algorithms` +(`openssl list-message-digest-algorithms` for older versions of OpenSSL) will +display the available digest algorithms. + +Example: generating the sha256 sum of a file + +```None +const filename = process.argv[2]; +const crypto = require('crypto'); +const fs = require('fs'); + +const hash = crypto.createHash('sha256'); + +const input = fs.createReadStream(filename); +input.on('readable', () => { + // Only one element is going to be produced by the + // hash stream. + const data = input.read(); + if (data) + hash.update(data); + else { + console.log(`${hash.digest('hex')} ${filename}`); + } +}); +``` + +### crypto.createHmac(algorithm, key[, options])[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/crypto.js#L132)[#](#crypto_crypto_createhmac_algorithm_key_options) + +Added in: v0.1.94 + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) +* Returns: [](crypto.html#crypto_class_hmac) + +Creates and returns an `Hmac` object that uses the given `algorithm` and `key`. +Optional `options` argument controls stream behavior. + +The `algorithm` is dependent on the available algorithms supported by the +version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. +On recent releases of OpenSSL, `openssl list -digest-algorithms` +(`openssl list-message-digest-algorithms` for older versions of OpenSSL) will +display the available digest algorithms. + +The `key` is the HMAC key used to generate the cryptographic HMAC hash. + +Example: generating the sha256 HMAC of a file + +```None +const filename = process.argv[2]; +const crypto = require('crypto'); +const fs = require('fs'); + +const hmac = crypto.createHmac('sha256', 'a secret'); + +const input = fs.createReadStream(filename); +input.on('readable', () => { + // Only one element is going to be produced by the + // hash stream. + const data = input.read(); + if (data) + hmac.update(data); + else { + console.log(`${hmac.digest('hex')} ${filename}`); + } +}); +``` + +### crypto.createSign(algorithm[, options])[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/crypto.js#L136)[#](#crypto_crypto_createsign_algorithm_options) + +Added in: v0.1.92 + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.Writable` options](stream.html#stream_constructor_new_stream_writable_options) +* Returns: [](crypto.html#crypto_class_sign) + +Creates and returns a `Sign` object that uses the given `algorithm`. +Use [`crypto.getHashes()`](#crypto_crypto_gethashes) to obtain an array of names of the available +signing algorithms. Optional `options` argument controls the +`stream.Writable` behavior. + +### crypto.createVerify(algorithm[, options])[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/crypto.js#L140)[#](#crypto_crypto_createverify_algorithm_options) + +Added in: v0.1.92 + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.Writable` options](stream.html#stream_constructor_new_stream_writable_options) +* Returns: [](crypto.html#crypto_class_verify) + +Creates and returns a `Verify` object that uses the given algorithm. +Use [`crypto.getHashes()`](#crypto_crypto_gethashes) to obtain an array of names of the available +signing algorithms. Optional `options` argument controls the +`stream.Writable` behavior. + +### crypto.generateKeyPair(type, options, callback)[#](#crypto_crypto_generatekeypair_type_options_callback) + +Added in: v10.12.0 + +* `type`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Must be `'rsa'`, `'dsa'` or `'ec'`. +* `options`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `modulusLength`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Key size in bits (RSA, DSA). + + `publicExponent`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Public exponent (RSA). **Default:** `0x10001`. + + `divisorLength`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Size of `q` in bits (DSA). + + `namedCurve`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Name of the curve to use (EC). + + `publicKeyEncoding`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + - `type`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Must be one of `'pkcs1'` (RSA only) or `'spki'`. + - `format`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Must be `'pem'` or `'der'`. + + `privateKeyEncoding`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + - `type`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Must be one of `'pkcs1'` (RSA only), `'pkcs8'` or + `'sec1'` (EC only). + - `format`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Must be `'pem'` or `'der'`. + - `cipher`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If specified, the private key will be encrypted with + the given `cipher` and `passphrase` using PKCS#5 v2.0 password based + encryption. + - `passphrase`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The passphrase to use for encryption, see `cipher`. +* `callback`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + + + `err`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + + `publicKey`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) + + `privateKey`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) + +Generates a new asymmetric key pair of the given `type`. Only RSA, DSA and EC +are currently supported. + +It is recommended to encode public keys as `'spki'` and private keys as +`'pkcs8'` with encryption: + +```None +const { generateKeyPair } = require('crypto'); +generateKeyPair('rsa', { + modulusLength: 4096, + publicKeyEncoding: { + type: 'spki', + format: 'pem' + }, + privateKeyEncoding: { + type: 'pkcs8', + format: 'pem', + cipher: 'aes-256-cbc', + passphrase: 'top secret' + } +}, (err, publicKey, privateKey) => { + // Handle errors and use the generated key pair. +}); +``` + +On completion, `callback` will be called with `err` set to `undefined` and +`publicKey` / `privateKey` representing the generated key pair. When PEM +encoding was selected, the result will be a string, otherwise it will be a +buffer containing the data encoded as DER. Note that Node.js itself does not +accept DER, it is supported for interoperability with other libraries such as +WebCrypto only. + +If this method is invoked as its [`util.promisify()`](util.html#util_util_promisify_original)ed version, it returns +a `Promise` for an `Object` with `publicKey` and `privateKey` properties. + +### crypto.generateKeyPairSync(type, options)[#](#crypto_crypto_generatekeypairsync_type_options) + +Added in: v10.12.0 + +* `type`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Must be `'rsa'`, `'dsa'` or `'ec'`. +* `options`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `modulusLength`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Key size in bits (RSA, DSA). + + `publicExponent`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Public exponent (RSA). **Default:** `0x10001`. + + `divisorLength`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Size of `q` in bits (DSA). + + `namedCurve`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Name of the curve to use (EC). + + `publicKeyEncoding`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + - `type`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Must be one of `'pkcs1'` (RSA only) or `'spki'`. + - `format`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Must be `'pem'` or `'der'`. + + `privateKeyEncoding`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + - `type`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Must be one of `'pkcs1'` (RSA only), `'pkcs8'` or + `'sec1'` (EC only). + - `format`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Must be `'pem'` or `'der'`. + - `cipher`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If specified, the private key will be encrypted with + the given `cipher` and `passphrase` using PKCS#5 v2.0 password based + encryption. + - `passphrase`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The passphrase to use for encryption, see `cipher`. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `publicKey`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) + + `privateKey`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) + +Generates a new asymmetric key pair of the given `type`. Only RSA, DSA and EC +are currently supported. + +It is recommended to encode public keys as `'spki'` and private keys as +`'pkcs8'` with encryption: + +```None +const { generateKeyPairSync } = require('crypto'); +const { publicKey, privateKey } = generateKeyPairSync('rsa', { + modulusLength: 4096, + publicKeyEncoding: { + type: 'spki', + format: 'pem' + }, + privateKeyEncoding: { + type: 'pkcs8', + format: 'pem', + cipher: 'aes-256-cbc', + passphrase: 'top secret' + } +}); +``` + +The return value `{ publicKey, privateKey }` represents the generated key pair. +When PEM encoding was selected, the respective key will be a string, otherwise +it will be a buffer containing the data encoded as DER. + +### crypto.getCiphers()[#](#crypto_crypto_getciphers) + +Added in: v0.9.3 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An array with the names of the supported cipher + algorithms. + +```None +const ciphers = crypto.getCiphers(); +console.log(ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...] +``` + +### crypto.getCurves()[#](#crypto_crypto_getcurves) + +Added in: v2.3.0 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An array with the names of the supported elliptic curves. + +```None +const curves = crypto.getCurves(); +console.log(curves); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...] +``` + +### crypto.getDiffieHellman(groupName)[#](#crypto_crypto_getdiffiehellman_groupname) + +Added in: v0.7.5 + +* `groupName` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](crypto.html#crypto_class_diffiehellman) + +Creates a predefined `DiffieHellman` key exchange object. The +supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in +[RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt), but see [Caveats](#crypto_support_for_weak_or_compromised_algorithms)) and `'modp14'`, `'modp15'`, +`'modp16'`, `'modp17'`, `'modp18'` (defined in [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt)). The +returned object mimics the interface of objects created by +[`crypto.createDiffieHellman()`](#crypto_crypto_creatediffiehellman_prime_primeencoding_generator_generatorencoding), but will not allow changing +the keys (with [`diffieHellman.setPublicKey()`](#crypto_diffiehellman_setpublickey_publickey_encoding), for example). The +advantage of using this method is that the parties do not have to +generate nor exchange a group modulus beforehand, saving both processor +and communication time. + +Example (obtaining a shared secret): + +```None +const crypto = require('crypto'); +const alice = crypto.getDiffieHellman('modp14'); +const bob = crypto.getDiffieHellman('modp14'); + +alice.generateKeys(); +bob.generateKeys(); + +const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +/* aliceSecret and bobSecret should be the same */ +console.log(aliceSecret === bobSecret); +``` + +### crypto.getFips()[#](#crypto_crypto_getfips) + +Added in: v10.0.0 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` if and only if a FIPS compliant crypto provider is + currently in use. + +### crypto.getHashes()[#](#crypto_crypto_gethashes) + +Added in: v0.9.3 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An array of the names of the supported hash algorithms, + such as `'RSA-SHA256'`. + +```None +const hashes = crypto.getHashes(); +console.log(hashes); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...] +``` + +### crypto.pbkdf2(password, salt, iterations, keylen, digest, callback)[#](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `digest` parameter is always required now. | +| v6.0.0 | Calling this function without passing the `digest` parameter is deprecated now and will emit a warning. | +| v6.0.0 | The default encoding for `password` if it is a string changed from `binary` to `utf8`. | +| v0.5.5 | Added in: v0.5.5 | + +* `password` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `salt` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `iterations` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `keylen` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `digest` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + + + `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + + `derivedKey` [](buffer.html#buffer_class_buffer) + +Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2) +implementation. A selected HMAC digest algorithm specified by `digest` is +applied to derive a key of the requested byte length (`keylen`) from the +`password`, `salt` and `iterations`. + +The supplied `callback` function is called with two arguments: `err` and +`derivedKey`. If an error occurs while deriving the key, `err` will be set; +otherwise `err` will be `null`. By default, the successfully generated +`derivedKey` will be passed to the callback as a [`Buffer`](buffer.html). An error will be +thrown if any of the input arguments specify invalid values or types. + +If `digest` is `null`, `'sha1'` will be used. This behavior will be deprecated +in a future version of Node.js. + +The `iterations` argument must be a number set as high as possible. The +higher the number of iterations, the more secure the derived key will be, +but will take a longer amount of time to complete. + +The `salt` should be as unique as possible. It is recommended that a salt is +random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + +```None +const crypto = require('crypto'); +crypto.pbkdf2('secret', 'salt', 100000, 64, 'sha512', (err, derivedKey) => { + if (err) throw err; + console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' +}); +``` + +The `crypto.DEFAULT_ENCODING` property can be used to change the way the +`derivedKey` is passed to the callback. This property, however, has been +deprecated and use should be avoided. + +```None +const crypto = require('crypto'); +crypto.DEFAULT_ENCODING = 'hex'; +crypto.pbkdf2('secret', 'salt', 100000, 512, 'sha512', (err, derivedKey) => { + if (err) throw err; + console.log(derivedKey); // '3745e48...aa39b34' +}); +``` + +An array of supported digest functions can be retrieved using +[`crypto.getHashes()`](#crypto_crypto_gethashes). + +Note that this API uses libuv's threadpool, which can have surprising and +negative performance implications for some applications, see the +[`UV_THREADPOOL_SIZE`](cli.html#cli_uv_threadpool_size_size) documentation for more information. + +### crypto.pbkdf2Sync(password, salt, iterations, keylen, digest)[#](#crypto_crypto_pbkdf2sync_password_salt_iterations_keylen_digest) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | Calling this function without passing the `digest` parameter is deprecated now and will emit a warning. | +| v6.0.0 | The default encoding for `password` if it is a string changed from `binary` to `utf8`. | +| v0.9.3 | Added in: v0.9.3 | + +* `password` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `salt` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `iterations` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `keylen` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `digest` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](buffer.html#buffer_class_buffer) + +Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) +implementation. A selected HMAC digest algorithm specified by `digest` is +applied to derive a key of the requested byte length (`keylen`) from the +`password`, `salt` and `iterations`. + +If an error occurs an `Error` will be thrown, otherwise the derived key will be +returned as a [`Buffer`](buffer.html). + +If `digest` is `null`, `'sha1'` will be used. This behavior will be deprecated +in a future version of Node.js. + +The `iterations` argument must be a number set as high as possible. The +higher the number of iterations, the more secure the derived key will be, +but will take a longer amount of time to complete. + +The `salt` should be as unique as possible. It is recommended that a salt is +random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + +```None +const crypto = require('crypto'); +const key = crypto.pbkdf2Sync('secret', 'salt', 100000, 64, 'sha512'); +console.log(key.toString('hex')); // '3745e48...08d59ae' +``` + +The `crypto.DEFAULT_ENCODING` property may be used to change the way the +`derivedKey` is returned. This property, however, is deprecated and use +should be avoided. + +```None +const crypto = require('crypto'); +crypto.DEFAULT_ENCODING = 'hex'; +const key = crypto.pbkdf2Sync('secret', 'salt', 100000, 512, 'sha512'); +console.log(key); // '3745e48...aa39b34' +``` + +An array of supported digest functions can be retrieved using +[`crypto.getHashes()`](#crypto_crypto_gethashes). + +### crypto.privateDecrypt(privateKey, buffer)[#](#crypto_crypto_privatedecrypt_privatekey_buffer) + +Added in: v0.11.14 + +* `privateKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A PEM encoded private key. + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An optional passphrase for the private key. + + `padding` [](crypto.html#crypto_crypto_constants_1) An optional padding value defined in + `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING`, + `crypto.constants.RSA_PKCS1_PADDING`, or + `crypto.constants.RSA_PKCS1_OAEP_PADDING`. +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) A new `Buffer` with the decrypted content. + +Decrypts `buffer` with `privateKey`. `buffer` was previously encrypted using +the corresponding public key, for example using [`crypto.publicEncrypt()`](#crypto_crypto_publicencrypt_key_buffer). + +`privateKey` can be an object or a string. If `privateKey` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. + +### crypto.privateEncrypt(privateKey, buffer)[#](#crypto_crypto_privateencrypt_privatekey_buffer) + +Added in: v1.1.0 + +* `privateKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A PEM encoded private key. + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An optional passphrase for the private key. + + `padding` [](crypto.html#crypto_crypto_constants_1) An optional padding value defined in + `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING` or + `crypto.constants.RSA_PKCS1_PADDING`. +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) A new `Buffer` with the encrypted content. + +Encrypts `buffer` with `privateKey`. The returned data can be decrypted using +the corresponding public key, for example using [`crypto.publicDecrypt()`](#crypto_crypto_publicdecrypt_key_buffer). + +`privateKey` can be an object or a string. If `privateKey` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. + +### crypto.publicDecrypt(key, buffer)[#](#crypto_crypto_publicdecrypt_key_buffer) + +Added in: v1.1.0 + +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A PEM encoded public or private key. + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An optional passphrase for the private key. + + `padding` [](crypto.html#crypto_crypto_constants_1) An optional padding value defined in + `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING` or + `crypto.constants.RSA_PKCS1_PADDING`. +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) A new `Buffer` with the decrypted content. + +Decrypts `buffer` with `key`.`buffer` was previously encrypted using +the corresponding private key, for example using [`crypto.privateEncrypt()`](#crypto_crypto_privateencrypt_privatekey_buffer). + +`key` can be an object or a string. If `key` is a string, it is treated as +the key with no passphrase and will use `RSA_PKCS1_PADDING`. + +Because RSA public keys can be derived from private keys, a private key may +be passed instead of a public key. + +### crypto.publicEncrypt(key, buffer)[#](#crypto_crypto_publicencrypt_key_buffer) + +Added in: v0.11.14 + +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A PEM encoded public or private key. + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An optional passphrase for the private key. + + `padding` [](crypto.html#crypto_crypto_constants_1) An optional padding value defined in + `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING`, + `crypto.constants.RSA_PKCS1_PADDING`, or + `crypto.constants.RSA_PKCS1_OAEP_PADDING`. +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) A new `Buffer` with the encrypted content. + +Encrypts the content of `buffer` with `key` and returns a new +[`Buffer`](buffer.html) with encrypted content. The returned data can be decrypted using +the corresponding private key, for example using [`crypto.privateDecrypt()`](#crypto_crypto_privatedecrypt_privatekey_buffer). + +`key` can be an object or a string. If `key` is a string, it is treated as +the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. + +Because RSA public keys can be derived from private keys, a private key may +be passed instead of a public key. + +### crypto.randomBytes(size[, callback])[#](#crypto_crypto_randombytes_size_callback) + +History + +| Version | Changes | +| --- | --- | +| v9.0.0 | Passing `null` as the `callback` argument now throws `ERR_INVALID_CALLBACK`. | +| v0.5.8 | Added in: v0.5.8 | + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + + + `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + + `buf` [](buffer.html#buffer_class_buffer) +* Returns: [](buffer.html#buffer_class_buffer) if the `callback` function is not provided. + +Generates cryptographically strong pseudo-random data. The `size` argument +is a number indicating the number of bytes to generate. + +If a `callback` function is provided, the bytes are generated asynchronously +and the `callback` function is invoked with two arguments: `err` and `buf`. +If an error occurs, `err` will be an `Error` object; otherwise it is `null`. The +`buf` argument is a [`Buffer`](buffer.html) containing the generated bytes. + +```None +// Asynchronous +const crypto = require('crypto'); +crypto.randomBytes(256, (err, buf) => { + if (err) throw err; + console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`); +}); +``` + +If the `callback` function is not provided, the random bytes are generated +synchronously and returned as a [`Buffer`](buffer.html). An error will be thrown if +there is a problem generating the bytes. + +```None +// Synchronous +const buf = crypto.randomBytes(256); +console.log( + `${buf.length} bytes of random data: ${buf.toString('hex')}`); +``` + +The `crypto.randomBytes()` method will not complete until there is +sufficient entropy available. +This should normally never take longer than a few milliseconds. The only time +when generating the random bytes may conceivably block for a longer period of +time is right after boot, when the whole system is still low on entropy. + +Note that this API uses libuv's threadpool, which can have surprising and +negative performance implications for some applications, see the +[`UV_THREADPOOL_SIZE`](cli.html#cli_uv_threadpool_size_size) documentation for more information. + +The asynchronous version of `crypto.randomBytes()` is carried out in a single +threadpool request. To minimize threadpool task length variation, partition +large `randomBytes` requests when doing so as part of fulfilling a client +request. + +### crypto.randomFillSync(buffer[, offset][, size])[#](#crypto_crypto_randomfillsync_buffer_offset_size) + +History + +| Version | Changes | +| --- | --- | +| v9.0.0 | The `buffer` argument may be any `TypedArray` or `DataView`. | +| v7.10.0, v6.13.0 | Added in: v7.10.0, v6.13.0 | + +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) Must be supplied. +* `offset` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) **Default:** `0` +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) **Default:** `buffer.length - offset` +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) The object passed as `buffer` argument. + +Synchronous version of [`crypto.randomFill()`](#crypto_crypto_randomfill_buffer_offset_size_callback). + +```None +const buf = Buffer.alloc(10); +console.log(crypto.randomFillSync(buf).toString('hex')); + +crypto.randomFillSync(buf, 5); +console.log(buf.toString('hex')); + +// The above is equivalent to the following: +crypto.randomFillSync(buf, 5, 5); +console.log(buf.toString('hex')); +``` + +Any `TypedArray` or `DataView` instance may be passed as `buffer`. + +```None +const a = new Uint32Array(10); +console.log(Buffer.from(crypto.randomFillSync(a).buffer, + a.byteOffset, a.byteLength).toString('hex')); + +const b = new Float64Array(10); +console.log(Buffer.from(crypto.randomFillSync(b).buffer, + b.byteOffset, b.byteLength).toString('hex')); + +const c = new DataView(new ArrayBuffer(10)); +console.log(Buffer.from(crypto.randomFillSync(c).buffer, + c.byteOffset, c.byteLength).toString('hex')); +``` + +### crypto.randomFill(buffer[, offset][, size], callback)[#](#crypto_crypto_randomfill_buffer_offset_size_callback) + +History + +| Version | Changes | +| --- | --- | +| v9.0.0 | The `buffer` argument may be any `TypedArray` or `DataView`. | +| v7.10.0, v6.13.0 | Added in: v7.10.0, v6.13.0 | + +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) Must be supplied. +* `offset` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) **Default:** `0` +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) **Default:** `buffer.length - offset` +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) `function(err, buf) {}`. + +This function is similar to [`crypto.randomBytes()`](#crypto_crypto_randombytes_size_callback) but requires the first +argument to be a [`Buffer`](buffer.html) that will be filled. It also +requires that a callback is passed in. + +If the `callback` function is not provided, an error will be thrown. + +```None +const buf = Buffer.alloc(10); +crypto.randomFill(buf, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); + +crypto.randomFill(buf, 5, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); + +// The above is equivalent to the following: +crypto.randomFill(buf, 5, 5, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); +``` + +Any `TypedArray` or `DataView` instance may be passed as `buffer`. + +```None +const a = new Uint32Array(10); +crypto.randomFill(a, (err, buf) => { + if (err) throw err; + console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) + .toString('hex')); +}); + +const b = new Float64Array(10); +crypto.randomFill(b, (err, buf) => { + if (err) throw err; + console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) + .toString('hex')); +}); + +const c = new DataView(new ArrayBuffer(10)); +crypto.randomFill(c, (err, buf) => { + if (err) throw err; + console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) + .toString('hex')); +}); +``` + +Note that this API uses libuv's threadpool, which can have surprising and +negative performance implications for some applications, see the +[`UV_THREADPOOL_SIZE`](cli.html#cli_uv_threadpool_size_size) documentation for more information. + +The asynchronous version of `crypto.randomFill()` is carried out in a single +threadpool request. To minimize threadpool task length variation, partition +large `randomFill` requests when doing so as part of fulfilling a client +request. + +### crypto.scrypt(password, salt, keylen[, options], callback)[#](#crypto_crypto_scrypt_password_salt_keylen_options_callback) + +History + +| Version | Changes | +| --- | --- | +| v10.17.0 | The `maxmem` value can now be any safe integer. | +| v10.9.0 | The `cost`, `blockSize` and `parallelization` option names have been added. | +| v10.5.0 | Added in: v10.5.0 | + +* `password` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `salt` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `keylen` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `cost` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) CPU/memory cost parameter. Must be a power of two greater + + `N` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) CPU/memory cost parameter. Must be a power of two greater + than one. **Default:** `16384`. + + `blockSize` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Block size parameter. **Default:** `8`. + + `parallelization` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Parallelization parameter. **Default:** `1`. + + `N` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Alias for `cost`. Only one of both may be specified. + + `r` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Alias for `blockSize`. Only one of both may be specified. + + `p` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Alias for `parallelization`. Only one of both may be specified. + + `maxmem` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Memory upper bound. It is an error when (approximately) + `128 * N * r > maxmem`. **Default:** `32 * 1024 * 1024`. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + + + `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + + `derivedKey` [](buffer.html#buffer_class_buffer) + +Provides an asynchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based +key derivation function that is designed to be expensive computationally and +memory-wise in order to make brute-force attacks unrewarding. + +The `salt` should be as unique as possible. It is recommended that a salt is +random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + +The `callback` function is called with two arguments: `err` and `derivedKey`. +`err` is an exception object when key derivation fails, otherwise `err` is +`null`. `derivedKey` is passed to the callback as a [`Buffer`](buffer.html). + +An exception is thrown when any of the input arguments specify invalid values +or types. + +```None +const crypto = require('crypto'); +// Using the factory defaults. +crypto.scrypt('secret', 'salt', 64, (err, derivedKey) => { + if (err) throw err; + console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' +}); +// Using a custom N parameter. Must be a power of two. +crypto.scrypt('secret', 'salt', 64, { N: 1024 }, (err, derivedKey) => { + if (err) throw err; + console.log(derivedKey.toString('hex')); // '3745e48...aa39b34' +}); +``` + +### crypto.scryptSync(password, salt, keylen[, options])[#](#crypto_crypto_scryptsync_password_salt_keylen_options) + +History + +| Version | Changes | +| --- | --- | +| v10.17.0 | The `maxmem` value can now be any safe integer. | +| v10.9.0 | The `cost`, `blockSize` and `parallelization` option names have been added. | +| v10.5.0 | Added in: v10.5.0 | + +* `password` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `salt` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `keylen` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `cost` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) CPU/memory cost parameter. Must be a power of two greater + + `N` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) CPU/memory cost parameter. Must be a power of two greater + than one. **Default:** `16384`. + + `blockSize` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Block size parameter. **Default:** `8`. + + `parallelization` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Parallelization parameter. **Default:** `1`. + + `N` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Alias for `cost`. Only one of both may be specified. + + `r` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Alias for `blockSize`. Only one of both may be specified. + + `p` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Alias for `parallelization`. Only one of both may be specified. + + `maxmem` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Memory upper bound. It is an error when (approximately) + `128 * N * r > maxmem`. **Default:** `32 * 1024 * 1024`. +* Returns: [](buffer.html#buffer_class_buffer) + +Provides a synchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based +key derivation function that is designed to be expensive computationally and +memory-wise in order to make brute-force attacks unrewarding. + +The `salt` should be as unique as possible. It is recommended that a salt is +random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + +An exception is thrown when key derivation fails, otherwise the derived key is +returned as a [`Buffer`](buffer.html). + +An exception is thrown when any of the input arguments specify invalid values +or types. + +```None +const crypto = require('crypto'); +// Using the factory defaults. +const key1 = crypto.scryptSync('secret', 'salt', 64); +console.log(key1.toString('hex')); // '3745e48...08d59ae' +// Using a custom N parameter. Must be a power of two. +const key2 = crypto.scryptSync('secret', 'salt', 64, { N: 1024 }); +console.log(key2.toString('hex')); // '3745e48...aa39b34' +``` + +### crypto.setEngine(engine[, flags])[#](#crypto_crypto_setengine_engine_flags) + +Added in: v0.11.11 + +* `engine` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `flags` [](crypto.html#crypto_crypto_constants_1) **Default:** `crypto.constants.ENGINE_METHOD_ALL` + +Load and set the `engine` for some or all OpenSSL functions (selected by flags). + +`engine` could be either an id or a path to the engine's shared library. + +The optional `flags` argument uses `ENGINE_METHOD_ALL` by default. The `flags` +is a bit field taking one of or a mix of the following flags (defined in +`crypto.constants`): + +* `crypto.constants.ENGINE_METHOD_RSA` +* `crypto.constants.ENGINE_METHOD_DSA` +* `crypto.constants.ENGINE_METHOD_DH` +* `crypto.constants.ENGINE_METHOD_RAND` +* `crypto.constants.ENGINE_METHOD_EC` +* `crypto.constants.ENGINE_METHOD_CIPHERS` +* `crypto.constants.ENGINE_METHOD_DIGESTS` +* `crypto.constants.ENGINE_METHOD_PKEY_METHS` +* `crypto.constants.ENGINE_METHOD_PKEY_ASN1_METHS` +* `crypto.constants.ENGINE_METHOD_ALL` +* `crypto.constants.ENGINE_METHOD_NONE` + +The flags below are deprecated in OpenSSL-1.1.0. + +* `crypto.constants.ENGINE_METHOD_ECDH` +* `crypto.constants.ENGINE_METHOD_ECDSA` +* `crypto.constants.ENGINE_METHOD_STORE` + +### crypto.setFips(bool)[#](#crypto_crypto_setfips_bool) + +Added in: v10.0.0 + +* `bool` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` to enable FIPS mode. + +Enables the FIPS compliant crypto provider in a FIPS-enabled Node.js build. +Throws an error if FIPS mode is not available. + +### crypto.timingSafeEqual(a, b)[#](#crypto_crypto_timingsafeequal_a_b) + +Added in: v6.6.0 + +* `a` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `b` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +This function is based on a constant-time algorithm. +Returns true if `a` is equal to `b`, without leaking timing information that +would allow an attacker to guess one of the values. This is suitable for +comparing HMAC digests or secret values like authentication cookies or +[capability urls](https://www.w3.org/TR/capability-urls/). + +`a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they +must have the same length. + +Use of `crypto.timingSafeEqual` does not guarantee that the *surrounding* code +is timing-safe. Care should be taken to ensure that the surrounding code does +not introduce timing vulnerabilities. + +## Notes[#](#crypto_notes) + +### Legacy Streams API (pre Node.js v0.10)[#](#crypto_legacy_streams_api_pre_node_js_v0_10) + +The Crypto module was added to Node.js before there was the concept of a +unified Stream API, and before there were [`Buffer`](buffer.html) objects for handling +binary data. As such, the many of the `crypto` defined classes have methods not +typically found on other Node.js classes that implement the [streams](stream.html) +API (e.g. `update()`, `final()`, or `digest()`). Also, many methods accepted +and returned `'latin1'` encoded strings by default rather than `Buffer`s. This +default was changed after Node.js v0.8 to use [`Buffer`](buffer.html) objects by default +instead. + +### Recent ECDH Changes[#](#crypto_recent_ecdh_changes) + +Usage of `ECDH` with non-dynamically generated key pairs has been simplified. +Now, [`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_privatekey_encoding) can be called with a preselected private key +and the associated public point (key) will be computed and stored in the object. +This allows code to only store and provide the private part of the EC key pair. +[`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_privatekey_encoding) now also validates that the private key is valid for +the selected curve. + +The [`ecdh.setPublicKey()`](#crypto_ecdh_setpublickey_publickey_encoding) method is now deprecated as its inclusion in the +API is not useful. Either a previously stored private key should be set, which +automatically generates the associated public key, or [`ecdh.generateKeys()`](#crypto_ecdh_generatekeys_encoding_format) +should be called. The main drawback of using [`ecdh.setPublicKey()`](#crypto_ecdh_setpublickey_publickey_encoding) is that +it can be used to put the ECDH key pair into an inconsistent state. + +### Support for weak or compromised algorithms[#](#crypto_support_for_weak_or_compromised_algorithms) + +The `crypto` module still supports some algorithms which are already +compromised and are not currently recommended for use. The API also allows +the use of ciphers and hashes with a small key size that are considered to be +too weak for safe use. + +Users should take full responsibility for selecting the crypto +algorithm and key size according to their security requirements. + +Based on the recommendations of [NIST SP 800-131A](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar1.pdf): + +* MD5 and SHA-1 are no longer acceptable where collision resistance is + required such as digital signatures. +* The key used with RSA, DSA, and DH algorithms is recommended to have + at least 2048 bits and that of the curve of ECDSA and ECDH at least + 224 bits, to be safe to use for several years. +* The DH groups of `modp1`, `modp2` and `modp5` have a key size + smaller than 2048 bits and are not recommended. + +See the reference for other recommendations and details. + +### CCM mode[#](#crypto_ccm_mode) + +CCM is one of the supported [AEAD algorithms](https://en.wikipedia.org/wiki/Authenticated_encryption). Applications which use this +mode must adhere to certain restrictions when using the cipher API: + +* The authentication tag length must be specified during cipher creation by + setting the `authTagLength` option and must be one of 4, 6, 8, 10, 12, 14 or + 16 bytes. +* The length of the initialization vector (nonce) `N` must be between 7 and 13 + bytes (`7 ≤ N ≤ 13`). +* The length of the plaintext is limited to `2 ** (8 * (15 - N))` bytes. +* When decrypting, the authentication tag must be set via `setAuthTag()` before + specifying additional authenticated data or calling `update()`. + Otherwise, decryption will fail and `final()` will throw an error in + compliance with section 2.6 of [RFC 3610](https://www.rfc-editor.org/rfc/rfc3610.txt). +* Using stream methods such as `write(data)`, `end(data)` or `pipe()` in CCM + mode might fail as CCM cannot handle more than one chunk of data per instance. +* When passing additional authenticated data (AAD), the length of the actual + message in bytes must be passed to `setAAD()` via the `plaintextLength` + option. This is not necessary if no AAD is used. +* As CCM processes the whole message at once, `update()` can only be called + once. +* Even though calling `update()` is sufficient to encrypt/decrypt the message, + applications *must* call `final()` to compute or verify the + authentication tag. + +```None +const crypto = require('crypto'); + +const key = 'keykeykeykeykeykeykeykey'; +const nonce = crypto.randomBytes(12); + +const aad = Buffer.from('0123456789', 'hex'); + +const cipher = crypto.createCipheriv('aes-192-ccm', key, nonce, { + authTagLength: 16 +}); +const plaintext = 'Hello world'; +cipher.setAAD(aad, { + plaintextLength: Buffer.byteLength(plaintext) +}); +const ciphertext = cipher.update(plaintext, 'utf8'); +cipher.final(); +const tag = cipher.getAuthTag(); + +// Now transmit { ciphertext, nonce, tag }. + +const decipher = crypto.createDecipheriv('aes-192-ccm', key, nonce, { + authTagLength: 16 +}); +decipher.setAuthTag(tag); +decipher.setAAD(aad, { + plaintextLength: ciphertext.length +}); +const receivedPlaintext = decipher.update(ciphertext, null, 'utf8'); + +try { + decipher.final(); +} catch (err) { + console.error('Authentication failed!'); +} + +console.log(receivedPlaintext); +``` + +## Crypto Constants[#](#crypto_crypto_constants_1) + +The following constants exported by `crypto.constants` apply to various uses of +the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL. + +### OpenSSL Options[#](#crypto_openssl_options) + +| Constant | Description | +| --- | --- | +| `SSL_OP_ALL` | Applies multiple bug workarounds within OpenSSL. See for detail. | +| `SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION` | Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See . | +| `SSL_OP_CIPHER_SERVER_PREFERENCE` | Attempts to use the server's preferences instead of the client's when selecting a cipher. Behavior depends on protocol version. See . | +| `SSL_OP_CISCO_ANYCONNECT` | Instructs OpenSSL to use Cisco's "speshul" version of DTLS\_BAD\_VER. | +| `SSL_OP_COOKIE_EXCHANGE` | Instructs OpenSSL to turn on cookie exchange. | +| `SSL_OP_CRYPTOPRO_TLSEXT_BUG` | Instructs OpenSSL to add server-hello extension from an early version of the cryptopro draft. | +| `SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS` | Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. | +| `SSL_OP_EPHEMERAL_RSA` | Instructs OpenSSL to always use the tmp\_rsa key when performing RSA operations. | +| `SSL_OP_LEGACY_SERVER_CONNECT` | Allows initial connection to servers that do not support RI. | +| `SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER` | | +| `SSL_OP_MICROSOFT_SESS_ID_BUG` | | +| `SSL_OP_MSIE_SSLV2_RSA_PADDING` | Instructs OpenSSL to disable the workaround for a man-in-the-middle protocol-version vulnerability in the SSL 2.0 server implementation. | +| `SSL_OP_NETSCAPE_CA_DN_BUG` | | +| `SSL_OP_NETSCAPE_CHALLENGE_BUG` | | +| `SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG` | | +| `SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG` | | +| `SSL_OP_NO_COMPRESSION` | Instructs OpenSSL to disable support for SSL/TLS compression. | +| `SSL_OP_NO_QUERY_MTU` | | +| `SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION` | Instructs OpenSSL to always start a new session when performing renegotiation. | +| `SSL_OP_NO_SSLv2` | Instructs OpenSSL to turn off SSL v2 | +| `SSL_OP_NO_SSLv3` | Instructs OpenSSL to turn off SSL v3 | +| `SSL_OP_NO_TICKET` | Instructs OpenSSL to disable use of RFC4507bis tickets. | +| `SSL_OP_NO_TLSv1` | Instructs OpenSSL to turn off TLS v1 | +| `SSL_OP_NO_TLSv1_1` | Instructs OpenSSL to turn off TLS v1.1 | +| `SSL_OP_NO_TLSv1_2` | Instructs OpenSSL to turn off TLS v1.2 | +| `SSL_OP_PKCS1_CHECK_1` | | +| `SSL_OP_PKCS1_CHECK_2` | | +| `SSL_OP_SINGLE_DH_USE` | Instructs OpenSSL to always create a new key when using temporary/ephemeral DH parameters. | +| `SSL_OP_SINGLE_ECDH_USE` | Instructs OpenSSL to always create a new key when using temporary/ephemeral ECDH parameters. | +| `SSL_OP_SSLEAY_080_CLIENT_DH_BUG` | | +| `SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG` | | +| `SSL_OP_TLS_BLOCK_PADDING_BUG` | | +| `SSL_OP_TLS_D5_BUG` | | +| `SSL_OP_TLS_ROLLBACK_BUG` | Instructs OpenSSL to disable version rollback attack detection. | + +### OpenSSL Engine Constants[#](#crypto_openssl_engine_constants) + +| Constant | Description | +| --- | --- | +| `ENGINE_METHOD_RSA` | Limit engine usage to RSA | +| `ENGINE_METHOD_DSA` | Limit engine usage to DSA | +| `ENGINE_METHOD_DH` | Limit engine usage to DH | +| `ENGINE_METHOD_RAND` | Limit engine usage to RAND | +| `ENGINE_METHOD_EC` | Limit engine usage to EC | +| `ENGINE_METHOD_CIPHERS` | Limit engine usage to CIPHERS | +| `ENGINE_METHOD_DIGESTS` | Limit engine usage to DIGESTS | +| `ENGINE_METHOD_PKEY_METHS` | Limit engine usage to PKEY\_METHDS | +| `ENGINE_METHOD_PKEY_ASN1_METHS` | Limit engine usage to PKEY\_ASN1\_METHS | +| `ENGINE_METHOD_ALL` | | +| `ENGINE_METHOD_NONE` | | + +### Other OpenSSL Constants[#](#crypto_other_openssl_constants) + +| Constant | Description | +| --- | --- | +| `DH_CHECK_P_NOT_SAFE_PRIME` | | +| `DH_CHECK_P_NOT_PRIME` | | +| `DH_UNABLE_TO_CHECK_GENERATOR` | | +| `DH_NOT_SUITABLE_GENERATOR` | | +| `ALPN_ENABLED` | | +| `RSA_PKCS1_PADDING` | | +| `RSA_SSLV23_PADDING` | | +| `RSA_NO_PADDING` | | +| `RSA_PKCS1_OAEP_PADDING` | | +| `RSA_X931_PADDING` | | +| `RSA_PKCS1_PSS_PADDING` | | +| `RSA_PSS_SALTLEN_DIGEST` | Sets the salt length for `RSA_PKCS1_PSS_PADDING` to the digest size when signing or verifying. | +| `RSA_PSS_SALTLEN_MAX_SIGN` | Sets the salt length for `RSA_PKCS1_PSS_PADDING` to the maximum permissible value when signing data. | +| `RSA_PSS_SALTLEN_AUTO` | Causes the salt length for `RSA_PKCS1_PSS_PADDING` to be determined automatically when verifying a signature. | +| `POINT_CONVERSION_COMPRESSED` | | +| `POINT_CONVERSION_UNCOMPRESSED` | | +| `POINT_CONVERSION_HYBRID` | | + +### Node.js Crypto Constants[#](#crypto_node_js_crypto_constants) + +| Constant | Description | +| --- | --- | +| `defaultCoreCipherList` | Specifies the built-in default cipher list used by Node.js. | +| `defaultCipherList` | Specifies the active default cipher list used by the current Node.js process. | diff --git a/corpus/docs/nodejs/crypto/crypto_11x.md b/corpus/docs/nodejs/crypto/crypto_11x.md new file mode 100644 index 0000000000000000000000000000000000000000..b934c8c702c79852a5b53f603110624da9c8fd79 --- /dev/null +++ b/corpus/docs/nodejs/crypto/crypto_11x.md @@ -0,0 +1,2840 @@ +# Crypto# + +Source: https://nodejs.org/docs/latest-v11.x/api/crypto.html +Version: 11.x + +[Stability: 2](documentation.html#documentation_stability_index) - Stable + +The `crypto` module provides cryptographic functionality that includes a set of +wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify functions. + +Use `require('crypto')` to access this module. + +```None +const crypto = require('crypto'); + +const secret = 'abcdefg'; +const hash = crypto.createHmac('sha256', secret) + .update('I love cupcakes') + .digest('hex'); +console.log(hash); +// Prints: +// c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e +``` + +## Determining if crypto support is unavailable[#](#crypto_determining_if_crypto_support_is_unavailable) + +It is possible for Node.js to be built without including support for the +`crypto` module. In such cases, calling `require('crypto')` will result in an +error being thrown. + +```None +let crypto; +try { + crypto = require('crypto'); +} catch (err) { + console.log('crypto support is disabled!'); +} +``` + +## Class: Certificate[#](#crypto_class_certificate) + +Added in: v0.11.8 + +SPKAC is a Certificate Signing Request mechanism originally implemented by +Netscape and was specified formally as part of [HTML5's `keygen` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/keygen). + +Note that `` is deprecated since [HTML 5.2](https://www.w3.org/TR/html52/changes.html#features-removed) and new projects +should not use this element anymore. + +The `crypto` module provides the `Certificate` class for working with SPKAC +data. The most common usage is handling output generated by the HTML5 +`` element. Node.js uses [OpenSSL's SPKAC implementation](https://www.openssl.org/docs/man1.1.0/apps/openssl-spkac.html) internally. + +### Certificate.exportChallenge(spkac)[#](#crypto_certificate_exportchallenge_spkac) + +Added in: v9.0.0 + +* `spkac` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) The challenge component of the `spkac` data structure, which + includes a public key and a challenge. + +```None +const { Certificate } = require('crypto'); +const spkac = getSpkacSomehow(); +const challenge = Certificate.exportChallenge(spkac); +console.log(challenge.toString('utf8')); +// Prints: the challenge as a UTF8 string +``` + +### Certificate.exportPublicKey(spkac[, encoding])[#](#crypto_certificate_exportpublickey_spkac_encoding) + +Added in: v9.0.0 + +* `spkac` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `spkac` string. +* Returns: [](buffer.html#buffer_class_buffer) The public key component of the `spkac` data structure, + which includes a public key and a challenge. + +```None +const { Certificate } = require('crypto'); +const spkac = getSpkacSomehow(); +const publicKey = Certificate.exportPublicKey(spkac); +console.log(publicKey); +// Prints: the public key as +``` + +### Certificate.verifySpkac(spkac)[#](#crypto_certificate_verifyspkac_spkac) + +Added in: v9.0.0 + +* `spkac` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` if the given `spkac` data structure is valid, + `false` otherwise. + +```None +const { Certificate } = require('crypto'); +const spkac = getSpkacSomehow(); +console.log(Certificate.verifySpkac(Buffer.from(spkac))); +// Prints: true or false +``` + +### Legacy API[#](#crypto_legacy_api) + +As a still supported legacy interface, it is possible (but not recommended) to +create new instances of the `crypto.Certificate` class as illustrated in the +examples below. + +#### new crypto.Certificate()[#](#crypto_new_crypto_certificate) + +Instances of the `Certificate` class can be created using the `new` keyword +or by calling `crypto.Certificate()` as a function: + +```None +const crypto = require('crypto'); + +const cert1 = new crypto.Certificate(); +const cert2 = crypto.Certificate(); +``` + +#### certificate.exportChallenge(spkac)[#](#crypto_certificate_exportchallenge_spkac_1) + +Added in: v0.11.8 + +* `spkac` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) The challenge component of the `spkac` data structure, which + includes a public key and a challenge. + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +const challenge = cert.exportChallenge(spkac); +console.log(challenge.toString('utf8')); +// Prints: the challenge as a UTF8 string +``` + +#### certificate.exportPublicKey(spkac)[#](#crypto_certificate_exportpublickey_spkac) + +Added in: v0.11.8 + +* `spkac` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) The public key component of the `spkac` data structure, + which includes a public key and a challenge. + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +const publicKey = cert.exportPublicKey(spkac); +console.log(publicKey); +// Prints: the public key as +``` + +#### certificate.verifySpkac(spkac)[#](#crypto_certificate_verifyspkac_spkac_1) + +Added in: v0.11.8 + +* `spkac` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` if the given `spkac` data structure is valid, + `false` otherwise. + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +console.log(cert.verifySpkac(Buffer.from(spkac))); +// Prints: true or false +``` + +## Class: Cipher[#](#crypto_class_cipher) + +Added in: v0.1.94 + +Instances of the `Cipher` class are used to encrypt data. The class can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where plain unencrypted + data is written to produce encrypted data on the readable side, or +* Using the [`cipher.update()`](#crypto_cipher_update_data_inputencoding_outputencoding) and [`cipher.final()`](#crypto_cipher_final_outputencoding) methods to produce + the encrypted data. + +The [`crypto.createCipher()`](#crypto_crypto_createcipher_algorithm_password_options) or [`crypto.createCipheriv()`](#crypto_crypto_createcipheriv_algorithm_key_iv_options) methods are +used to create `Cipher` instances. `Cipher` objects are not to be created +directly using the `new` keyword. + +Example: Using `Cipher` objects as streams: + +```None +const crypto = require('crypto'); + +const algorithm = 'aes-192-cbc'; +const password = 'Password used to generate key'; +// Key length is dependent on the algorithm. In this case for aes192, it is +// 24 bytes (192 bits). +// Use async `crypto.scrypt()` instead. +const key = crypto.scryptSync(password, 'salt', 24); +// Use `crypto.randomBytes()` to generate a random iv instead of the static iv +// shown here. +const iv = Buffer.alloc(16, 0); // Initialization vector. + +const cipher = crypto.createCipheriv(algorithm, key, iv); + +let encrypted = ''; +cipher.on('readable', () => { + let chunk; + while (null !== (chunk = cipher.read())) { + encrypted += chunk.toString('hex'); + } +}); +cipher.on('end', () => { + console.log(encrypted); + // Prints: e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa +}); + +cipher.write('some clear text data'); +cipher.end(); +``` + +Example: Using `Cipher` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); + +const algorithm = 'aes-192-cbc'; +const password = 'Password used to generate key'; +// Use the async `crypto.scrypt()` instead. +const key = crypto.scryptSync(password, 'salt', 24); +// Use `crypto.randomBytes()` to generate a random iv instead of the static iv +// shown here. +const iv = Buffer.alloc(16, 0); // Initialization vector. + +const cipher = crypto.createCipheriv(algorithm, key, iv); + +const input = fs.createReadStream('test.js'); +const output = fs.createWriteStream('test.enc'); + +input.pipe(cipher).pipe(output); +``` + +Example: Using the [`cipher.update()`](#crypto_cipher_update_data_inputencoding_outputencoding) and [`cipher.final()`](#crypto_cipher_final_outputencoding) methods: + +```None +const crypto = require('crypto'); + +const algorithm = 'aes-192-cbc'; +const password = 'Password used to generate key'; +// Use the async `crypto.scrypt()` instead. +const key = crypto.scryptSync(password, 'salt', 24); +// Use `crypto.randomBytes` to generate a random iv instead of the static iv +// shown here. +const iv = Buffer.alloc(16, 0); // Initialization vector. + +const cipher = crypto.createCipheriv(algorithm, key, iv); + +let encrypted = cipher.update('some clear text data', 'utf8', 'hex'); +encrypted += cipher.final('hex'); +console.log(encrypted); +// Prints: e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa +``` + +### cipher.final([outputEncoding])[#](#crypto_cipher_final_outputencoding) + +Added in: v0.1.94 + +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Any remaining enciphered contents. + If `outputEncoding` is specified, a string is + returned. If an `outputEncoding` is not provided, a [`Buffer`](buffer.html) is returned. + +Once the `cipher.final()` method has been called, the `Cipher` object can no +longer be used to encrypt data. Attempts to call `cipher.final()` more than +once will result in an error being thrown. + +### cipher.setAAD(buffer[, options])[#](#crypto_cipher_setaad_buffer_options) + +Added in: v1.0.0 + +* `buffer` [](buffer.html#buffer_class_buffer) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) + + + `plaintextLength` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* Returns: [](crypto.html#crypto_class_cipher) for method chaining. + +When using an authenticated encryption mode (`GCM`, `CCM` and `OCB` are +currently supported), the `cipher.setAAD()` method sets the value used for the +*additional authenticated data* (AAD) input parameter. + +The `options` argument is optional for `GCM` and `OCB`. When using `CCM`, the +`plaintextLength` option must be specified and its value must match the length +of the plaintext in bytes. See [CCM mode](#crypto_ccm_mode). + +The `cipher.setAAD()` method must be called before [`cipher.update()`](#crypto_cipher_update_data_inputencoding_outputencoding). + +### cipher.getAuthTag()[#](#crypto_cipher_getauthtag) + +Added in: v1.0.0 + +* Returns: [](buffer.html#buffer_class_buffer) When using an authenticated encryption mode (`GCM`, `CCM` + and `OCB` are currently supported), the `cipher.getAuthTag()` method returns a + [`Buffer`](buffer.html) containing the *authentication tag* that has been computed from + the given data. + +The `cipher.getAuthTag()` method should only be called after encryption has +been completed using the [`cipher.final()`](#crypto_cipher_final_outputencoding) method. + +### cipher.setAutoPadding([autoPadding])[#](#crypto_cipher_setautopadding_autopadding) + +Added in: v0.7.1 + +* `autoPadding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) **Default:** `true` +* Returns: [](crypto.html#crypto_class_cipher) for method chaining. + +When using block encryption algorithms, the `Cipher` class will automatically +add padding to the input data to the appropriate block size. To disable the +default padding call `cipher.setAutoPadding(false)`. + +When `autoPadding` is `false`, the length of the entire input data must be a +multiple of the cipher's block size or [`cipher.final()`](#crypto_cipher_final_outputencoding) will throw an error. +Disabling automatic padding is useful for non-standard padding, for instance +using `0x0` instead of PKCS padding. + +The `cipher.setAutoPadding()` method must be called before +[`cipher.final()`](#crypto_cipher_final_outputencoding). + +### cipher.update(data[, inputEncoding][, outputencoding])[#](#crypto_cipher_update_data_inputencoding_outputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.94 | Added in: v0.1.94 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the data. +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Updates the cipher with `data`. If the `inputEncoding` argument is given, +the `data` +argument is a string using the specified encoding. If the `inputEncoding` +argument is not given, `data` must be a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or `DataView`, then +`inputEncoding` is ignored. + +The `outputEncoding` specifies the output format of the enciphered +data. If the `outputEncoding` +is specified, a string using the specified encoding is returned. If no +`outputEncoding` is provided, a [`Buffer`](buffer.html) is returned. + +The `cipher.update()` method can be called multiple times with new data until +[`cipher.final()`](#crypto_cipher_final_outputencoding) is called. Calling `cipher.update()` after +[`cipher.final()`](#crypto_cipher_final_outputencoding) will result in an error being thrown. + +## Class: Decipher[#](#crypto_class_decipher) + +Added in: v0.1.94 + +Instances of the `Decipher` class are used to decrypt data. The class can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where plain encrypted + data is written to produce unencrypted data on the readable side, or +* Using the [`decipher.update()`](#crypto_decipher_update_data_inputencoding_outputencoding) and [`decipher.final()`](#crypto_decipher_final_outputencoding) methods to + produce the unencrypted data. + +The [`crypto.createDecipher()`](#crypto_crypto_createdecipher_algorithm_password_options) or [`crypto.createDecipheriv()`](#crypto_crypto_createdecipheriv_algorithm_key_iv_options) methods are +used to create `Decipher` instances. `Decipher` objects are not to be created +directly using the `new` keyword. + +Example: Using `Decipher` objects as streams: + +```None +const crypto = require('crypto'); + +const algorithm = 'aes-192-cbc'; +const password = 'Password used to generate key'; +// Key length is dependent on the algorithm. In this case for aes192, it is +// 24 bytes (192 bits). +// Use the async `crypto.scrypt()` instead. +const key = crypto.scryptSync(password, 'salt', 24); +// The IV is usually passed along with the ciphertext. +const iv = Buffer.alloc(16, 0); // Initialization vector. + +const decipher = crypto.createDecipheriv(algorithm, key, iv); + +let decrypted = ''; +decipher.on('readable', () => { + while (null !== (chunk = decipher.read())) { + decrypted += chunk.toString('utf8'); + } +}); +decipher.on('end', () => { + console.log(decrypted); + // Prints: some clear text data +}); + +// Encrypted with same algorithm, key and iv. +const encrypted = + 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; +decipher.write(encrypted, 'hex'); +decipher.end(); +``` + +Example: Using `Decipher` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); + +const algorithm = 'aes-192-cbc'; +const password = 'Password used to generate key'; +// Use the async `crypto.scrypt()` instead. +const key = crypto.scryptSync(password, 'salt', 24); +// The IV is usually passed along with the ciphertext. +const iv = Buffer.alloc(16, 0); // Initialization vector. + +const decipher = crypto.createDecipheriv(algorithm, key, iv); + +const input = fs.createReadStream('test.enc'); +const output = fs.createWriteStream('test.js'); + +input.pipe(decipher).pipe(output); +``` + +Example: Using the [`decipher.update()`](#crypto_decipher_update_data_inputencoding_outputencoding) and [`decipher.final()`](#crypto_decipher_final_outputencoding) methods: + +```None +const crypto = require('crypto'); + +const algorithm = 'aes-192-cbc'; +const password = 'Password used to generate key'; +// Use the async `crypto.scrypt()` instead. +const key = crypto.scryptSync(password, 'salt', 24); +// The IV is usually passed along with the ciphertext. +const iv = Buffer.alloc(16, 0); // Initialization vector. + +const decipher = crypto.createDecipheriv(algorithm, key, iv); + +// Encrypted using same algorithm, key and iv. +const encrypted = + 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; +let decrypted = decipher.update(encrypted, 'hex', 'utf8'); +decrypted += decipher.final('utf8'); +console.log(decrypted); +// Prints: some clear text data +``` + +### decipher.final([outputEncoding])[#](#crypto_decipher_final_outputencoding) + +Added in: v0.1.94 + +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Any remaining deciphered contents. + If `outputEncoding` is specified, a string is + returned. If an `outputEncoding` is not provided, a [`Buffer`](buffer.html) is returned. + +Once the `decipher.final()` method has been called, the `Decipher` object can +no longer be used to decrypt data. Attempts to call `decipher.final()` more +than once will result in an error being thrown. + +### decipher.setAAD(buffer[, options])[#](#crypto_decipher_setaad_buffer_options) + +History + +| Version | Changes | +| --- | --- | +| v7.2.0 | This method now returns a reference to `decipher`. | +| v1.0.0 | Added in: v1.0.0 | + +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) + + + `plaintextLength` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* Returns: [](crypto.html#crypto_class_decipher) for method chaining. + +When using an authenticated encryption mode (`GCM`, `CCM` and `OCB` are +currently supported), the `decipher.setAAD()` method sets the value used for the +*additional authenticated data* (AAD) input parameter. + +The `options` argument is optional for `GCM`. When using `CCM`, the +`plaintextLength` option must be specified and its value must match the length +of the plaintext in bytes. See [CCM mode](#crypto_ccm_mode). + +The `decipher.setAAD()` method must be called before [`decipher.update()`](#crypto_decipher_update_data_inputencoding_outputencoding). + +### decipher.setAuthTag(buffer)[#](#crypto_decipher_setauthtag_buffer) + +History + +| Version | Changes | +| --- | --- | +| v11.0.0 | This method now throws if the GCM tag length is invalid. | +| v7.2.0 | This method now returns a reference to `decipher`. | +| v1.0.0 | Added in: v1.0.0 | + +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](crypto.html#crypto_class_decipher) for method chaining. + +When using an authenticated encryption mode (`GCM`, `CCM` and `OCB` are +currently supported), the `decipher.setAuthTag()` method is used to pass in the +received *authentication tag*. If no tag is provided, or if the cipher text +has been tampered with, [`decipher.final()`](#crypto_decipher_final_outputencoding) will throw, indicating that the +cipher text should be discarded due to failed authentication. If the tag length +is invalid according to [NIST SP 800-38D](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf) or does not match the value of the +`authTagLength` option, `decipher.setAuthTag()` will throw an error. + +The `decipher.setAuthTag()` method must be called before +[`decipher.final()`](#crypto_decipher_final_outputencoding) and can only be called once. + +### decipher.setAutoPadding([autoPadding])[#](#crypto_decipher_setautopadding_autopadding) + +Added in: v0.7.1 + +* `autoPadding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) **Default:** `true` +* Returns: [](crypto.html#crypto_class_decipher) for method chaining. + +When data has been encrypted without standard block padding, calling +`decipher.setAutoPadding(false)` will disable automatic padding to prevent +[`decipher.final()`](#crypto_decipher_final_outputencoding) from checking for and removing padding. + +Turning auto padding off will only work if the input data's length is a +multiple of the ciphers block size. + +The `decipher.setAutoPadding()` method must be called before +[`decipher.final()`](#crypto_decipher_final_outputencoding). + +### decipher.update(data[, inputEncoding][, outputencoding])[#](#crypto_decipher_update_data_inputencoding_outputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.94 | Added in: v0.1.94 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `data` string. +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Updates the decipher with `data`. If the `inputEncoding` argument is given, +the `data` +argument is a string using the specified encoding. If the `inputEncoding` +argument is not given, `data` must be a [`Buffer`](buffer.html). If `data` is a +[`Buffer`](buffer.html) then `inputEncoding` is ignored. + +The `outputEncoding` specifies the output format of the enciphered +data. If the `outputEncoding` +is specified, a string using the specified encoding is returned. If no +`outputEncoding` is provided, a [`Buffer`](buffer.html) is returned. + +The `decipher.update()` method can be called multiple times with new data until +[`decipher.final()`](#crypto_decipher_final_outputencoding) is called. Calling `decipher.update()` after +[`decipher.final()`](#crypto_decipher_final_outputencoding) will result in an error being thrown. + +## Class: DiffieHellman[#](#crypto_class_diffiehellman) + +Added in: v0.5.0 + +The `DiffieHellman` class is a utility for creating Diffie-Hellman key +exchanges. + +Instances of the `DiffieHellman` class can be created using the +[`crypto.createDiffieHellman()`](#crypto_crypto_creatediffiehellman_prime_primeencoding_generator_generatorencoding) function. + +```None +const crypto = require('crypto'); +const assert = require('assert'); + +// Generate Alice's keys... +const alice = crypto.createDiffieHellman(2048); +const aliceKey = alice.generateKeys(); + +// Generate Bob's keys... +const bob = crypto.createDiffieHellman(alice.getPrime(), alice.getGenerator()); +const bobKey = bob.generateKeys(); + +// Exchange and generate the secret... +const aliceSecret = alice.computeSecret(bobKey); +const bobSecret = bob.computeSecret(aliceKey); + +// OK +assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); +``` + +### diffieHellman.computeSecret(otherPublicKey[, inputEncoding][, outputencoding])[#](#crypto_diffiehellman_computesecret_otherpublickey_inputencoding_outputencoding) + +Added in: v0.5.0 + +* `otherPublicKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of an `otherPublicKey` string. +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Computes the shared secret using `otherPublicKey` as the other +party's public key and returns the computed shared secret. The supplied +key is interpreted using the specified `inputEncoding`, and secret is +encoded using specified `outputEncoding`. +If the `inputEncoding` is not +provided, `otherPublicKey` is expected to be a [`Buffer`](buffer.html), +`TypedArray`, or `DataView`. + +If `outputEncoding` is given a string is returned; otherwise, a +[`Buffer`](buffer.html) is returned. + +### diffieHellman.generateKeys([encoding](buffer.html#buffer_buffers_and_character_encodings))[#](#crypto_diffiehellman_generatekeys_encoding) + +Added in: v0.5.0 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Generates private and public Diffie-Hellman key values, and returns +the public key in the specified `encoding`. This key should be +transferred to the other party. +If `encoding` is provided a string is returned; otherwise a +[`Buffer`](buffer.html) is returned. + +### diffieHellman.getGenerator([encoding](buffer.html#buffer_buffers_and_character_encodings))[#](#crypto_diffiehellman_getgenerator_encoding) + +Added in: v0.5.0 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the Diffie-Hellman generator in the specified `encoding`. +If `encoding` is provided a string is +returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPrime([encoding](buffer.html#buffer_buffers_and_character_encodings))[#](#crypto_diffiehellman_getprime_encoding) + +Added in: v0.5.0 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the Diffie-Hellman prime in the specified `encoding`. +If `encoding` is provided a string is +returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPrivateKey([encoding](buffer.html#buffer_buffers_and_character_encodings))[#](#crypto_diffiehellman_getprivatekey_encoding) + +Added in: v0.5.0 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the Diffie-Hellman private key in the specified `encoding`. +If `encoding` is provided a +string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPublicKey([encoding](buffer.html#buffer_buffers_and_character_encodings))[#](#crypto_diffiehellman_getpublickey_encoding) + +Added in: v0.5.0 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the Diffie-Hellman public key in the specified `encoding`. +If `encoding` is provided a +string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.setPrivateKey(privateKey[, encoding])[#](#crypto_diffiehellman_setprivatekey_privatekey_encoding) + +Added in: v0.5.0 + +* `privateKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `privateKey` string. + +Sets the Diffie-Hellman private key. If the `encoding` argument is provided, +`privateKey` is expected +to be a string. If no `encoding` is provided, `privateKey` is expected +to be a [`Buffer`](buffer.html), `TypedArray`, or `DataView`. + +### diffieHellman.setPublicKey(publicKey[, encoding])[#](#crypto_diffiehellman_setpublickey_publickey_encoding) + +Added in: v0.5.0 + +* `publicKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `publicKey` string. + +Sets the Diffie-Hellman public key. If the `encoding` argument is provided, +`publicKey` is expected +to be a string. If no `encoding` is provided, `publicKey` is expected +to be a [`Buffer`](buffer.html), `TypedArray`, or `DataView`. + +### diffieHellman.verifyError[#](#crypto_diffiehellman_verifyerror) + +Added in: v0.11.12 + +A bit field containing any warnings and/or errors resulting from a check +performed during initialization of the `DiffieHellman` object. + +The following values are valid for this property (as defined in `constants` +module): + +* `DH_CHECK_P_NOT_SAFE_PRIME` +* `DH_CHECK_P_NOT_PRIME` +* `DH_UNABLE_TO_CHECK_GENERATOR` +* `DH_NOT_SUITABLE_GENERATOR` + +## Class: ECDH[#](#crypto_class_ecdh) + +Added in: v0.11.14 + +The `ECDH` class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH) +key exchanges. + +Instances of the `ECDH` class can be created using the +[`crypto.createECDH()`](#crypto_crypto_createecdh_curvename) function. + +```None +const crypto = require('crypto'); +const assert = require('assert'); + +// Generate Alice's keys... +const alice = crypto.createECDH('secp521r1'); +const aliceKey = alice.generateKeys(); + +// Generate Bob's keys... +const bob = crypto.createECDH('secp521r1'); +const bobKey = bob.generateKeys(); + +// Exchange and generate the secret... +const aliceSecret = alice.computeSecret(bobKey); +const bobSecret = bob.computeSecret(aliceKey); + +assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); +// OK +``` + +### Class Method: ECDH.convertKey(key, curve[, inputEncoding[, outputEncoding[, format]]])[#](#crypto_class_method_ecdh_convertkey_key_curve_inputencoding_outputencoding_format) + +Added in: v10.0.0 + +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `curve` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `key` string. +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* `format` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) **Default:** `'uncompressed'` +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Converts the EC Diffie-Hellman public key specified by `key` and `curve` to the +format specified by `format`. The `format` argument specifies point encoding +and can be `'compressed'`, `'uncompressed'` or `'hybrid'`. The supplied key is +interpreted using the specified `inputEncoding`, and the returned key is encoded +using the specified `outputEncoding`. + +Use [`crypto.getCurves()`](#crypto_crypto_getcurves) to obtain a list of available curve names. +On recent OpenSSL releases, `openssl ecparam -list_curves` will also display +the name and description of each available elliptic curve. + +If `format` is not specified the point will be returned in `'uncompressed'` +format. + +If the `inputEncoding` is not provided, `key` is expected to be a [`Buffer`](buffer.html), +`TypedArray`, or `DataView`. + +Example (uncompressing a key): + +```None +const { createECDH, ECDH } = require('crypto'); + +const ecdh = createECDH('secp256k1'); +ecdh.generateKeys(); + +const compressedKey = ecdh.getPublicKey('hex', 'compressed'); + +const uncompressedKey = ECDH.convertKey(compressedKey, + 'secp256k1', + 'hex', + 'hex', + 'uncompressed'); + +// The converted key and the uncompressed public key should be the same +console.log(uncompressedKey === ecdh.getPublicKey('hex')); +``` + +### ecdh.computeSecret(otherPublicKey[, inputEncoding][, outputencoding])[#](#crypto_ecdh_computesecret_otherpublickey_inputencoding_outputencoding) + +History + +| Version | Changes | +| --- | --- | +| v10.0.0 | Changed error format to better support invalid public key error | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8` | +| v0.11.14 | Added in: v0.11.14 | + +* `otherPublicKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `otherPublicKey` string. +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Computes the shared secret using `otherPublicKey` as the other +party's public key and returns the computed shared secret. The supplied +key is interpreted using specified `inputEncoding`, and the returned secret +is encoded using the specified `outputEncoding`. +If the `inputEncoding` is not +provided, `otherPublicKey` is expected to be a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`. + +If `outputEncoding` is given a string will be returned; otherwise a +[`Buffer`](buffer.html) is returned. + +`ecdh.computeSecret` will throw an +`ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY` error when `otherPublicKey` +lies outside of the elliptic curve. Since `otherPublicKey` is +usually supplied from a remote user over an insecure network, +its recommended for developers to handle this exception accordingly. + +### ecdh.generateKeys([encoding[, format]])[#](#crypto_ecdh_generatekeys_encoding_format) + +Added in: v0.11.14 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* `format` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) **Default:** `'uncompressed'` +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Generates private and public EC Diffie-Hellman key values, and returns +the public key in the specified `format` and `encoding`. This key should be +transferred to the other party. + +The `format` argument specifies point encoding and can be `'compressed'` or +`'uncompressed'`. If `format` is not specified, the point will be returned in +`'uncompressed'` format. + +If `encoding` is provided a string is returned; otherwise a [`Buffer`](buffer.html) +is returned. + +### ecdh.getPrivateKey([encoding](buffer.html#buffer_buffers_and_character_encodings))[#](#crypto_ecdh_getprivatekey_encoding) + +Added in: v0.11.14 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The EC Diffie-Hellman in the specified `encoding`. + +If `encoding` is specified, a string is returned; otherwise a [`Buffer`](buffer.html) is +returned. + +### ecdh.getPublicKey([encoding][, format])[#](#crypto_ecdh_getpublickey_encoding_format) + +Added in: v0.11.14 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* `format` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) **Default:** `'uncompressed'` +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The EC Diffie-Hellman public key in the specified + `encoding` and `format`. + +The `format` argument specifies point encoding and can be `'compressed'` or +`'uncompressed'`. If `format` is not specified the point will be returned in +`'uncompressed'` format. + +If `encoding` is specified, a string is returned; otherwise a [`Buffer`](buffer.html) is +returned. + +### ecdh.setPrivateKey(privateKey[, encoding])[#](#crypto_ecdh_setprivatekey_privatekey_encoding) + +Added in: v0.11.14 + +* `privateKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `privateKey` string. + +Sets the EC Diffie-Hellman private key. +If `encoding` is provided, `privateKey` is expected +to be a string; otherwise `privateKey` is expected to be a [`Buffer`](buffer.html), +`TypedArray`, or `DataView`. + +If `privateKey` is not valid for the curve specified when the `ECDH` object was +created, an error is thrown. Upon setting the private key, the associated +public point (key) is also generated and set in the `ECDH` object. + +### ecdh.setPublicKey(publicKey[, encoding])[#](#crypto_ecdh_setpublickey_publickey_encoding) + +Added in: v0.11.14Deprecated since: v5.2.0 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated + +* `publicKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `publicKey` string. + +Sets the EC Diffie-Hellman public key. +If `encoding` is provided `publicKey` is expected to +be a string; otherwise a [`Buffer`](buffer.html), `TypedArray`, or `DataView` is expected. + +Note that there is not normally a reason to call this method because `ECDH` +only requires a private key and the other party's public key to compute the +shared secret. Typically either [`ecdh.generateKeys()`](#crypto_ecdh_generatekeys_encoding_format) or +[`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_privatekey_encoding) will be called. The [`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_privatekey_encoding) method +attempts to generate the public point/key associated with the private key being +set. + +Example (obtaining a shared secret): + +```None +const crypto = require('crypto'); +const alice = crypto.createECDH('secp256k1'); +const bob = crypto.createECDH('secp256k1'); + +// This is a shortcut way of specifying one of Alice's previous private +// keys. It would be unwise to use such a predictable private key in a real +// application. +alice.setPrivateKey( + crypto.createHash('sha256').update('alice', 'utf8').digest() +); + +// Bob uses a newly generated cryptographically strong +// pseudorandom key pair +bob.generateKeys(); + +const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +// aliceSecret and bobSecret should be the same shared secret value +console.log(aliceSecret === bobSecret); +``` + +## Class: Hash[#](#crypto_class_hash) + +Added in: v0.1.92 + +The `Hash` class is a utility for creating hash digests of data. It can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where data is written + to produce a computed hash digest on the readable side, or +* Using the [`hash.update()`](#crypto_hash_update_data_inputencoding) and [`hash.digest()`](#crypto_hash_digest_encoding) methods to produce the + computed hash. + +The [`crypto.createHash()`](#crypto_crypto_createhash_algorithm_options) method is used to create `Hash` instances. `Hash` +objects are not to be created directly using the `new` keyword. + +Example: Using `Hash` objects as streams: + +```None +const crypto = require('crypto'); +const hash = crypto.createHash('sha256'); + +hash.on('readable', () => { + // Only one element is going to be produced by the + // hash stream. + const data = hash.read(); + if (data) { + console.log(data.toString('hex')); + // Prints: + // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 + } +}); + +hash.write('some data to hash'); +hash.end(); +``` + +Example: Using `Hash` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const hash = crypto.createHash('sha256'); + +const input = fs.createReadStream('test.js'); +input.pipe(hash).pipe(process.stdout); +``` + +Example: Using the [`hash.update()`](#crypto_hash_update_data_inputencoding) and [`hash.digest()`](#crypto_hash_digest_encoding) methods: + +```None +const crypto = require('crypto'); +const hash = crypto.createHash('sha256'); + +hash.update('some data to hash'); +console.log(hash.digest('hex')); +// Prints: +// 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 +``` + +### hash.digest([encoding](buffer.html#buffer_buffers_and_character_encodings))[#](#crypto_hash_digest_encoding) + +Added in: v0.1.92 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Calculates the digest of all of the data passed to be hashed (using the +[`hash.update()`](#crypto_hash_update_data_inputencoding) method). +If `encoding` is provided a string will be returned; otherwise +a [`Buffer`](buffer.html) is returned. + +The `Hash` object can not be used again after `hash.digest()` method has been +called. Multiple calls will cause an error to be thrown. + +### hash.update(data[, inputEncoding])[#](#crypto_hash_update_data_inputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.92 | Added in: v0.1.92 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `data` string. + +Updates the hash content with the given `data`, the encoding of which +is given in `inputEncoding`. +If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`, then `inputEncoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Hmac[#](#crypto_class_hmac) + +Added in: v0.1.94 + +The `Hmac` class is a utility for creating cryptographic HMAC digests. It can +be used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where data is written + to produce a computed HMAC digest on the readable side, or +* Using the [`hmac.update()`](#crypto_hmac_update_data_inputencoding) and [`hmac.digest()`](#crypto_hmac_digest_encoding) methods to produce the + computed HMAC digest. + +The [`crypto.createHmac()`](#crypto_crypto_createhmac_algorithm_key_options) method is used to create `Hmac` instances. `Hmac` +objects are not to be created directly using the `new` keyword. + +Example: Using `Hmac` objects as streams: + +```None +const crypto = require('crypto'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +hmac.on('readable', () => { + // Only one element is going to be produced by the + // hash stream. + const data = hmac.read(); + if (data) { + console.log(data.toString('hex')); + // Prints: + // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e + } +}); + +hmac.write('some data to hash'); +hmac.end(); +``` + +Example: Using `Hmac` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +const input = fs.createReadStream('test.js'); +input.pipe(hmac).pipe(process.stdout); +``` + +Example: Using the [`hmac.update()`](#crypto_hmac_update_data_inputencoding) and [`hmac.digest()`](#crypto_hmac_digest_encoding) methods: + +```None +const crypto = require('crypto'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +hmac.update('some data to hash'); +console.log(hmac.digest('hex')); +// Prints: +// 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e +``` + +### hmac.digest([encoding](buffer.html#buffer_buffers_and_character_encodings))[#](#crypto_hmac_digest_encoding) + +Added in: v0.1.94 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Calculates the HMAC digest of all of the data passed using [`hmac.update()`](#crypto_hmac_update_data_inputencoding). +If `encoding` is +provided a string is returned; otherwise a [`Buffer`](buffer.html) is returned; + +The `Hmac` object can not be used again after `hmac.digest()` has been +called. Multiple calls to `hmac.digest()` will result in an error being thrown. + +### hmac.update(data[, inputEncoding])[#](#crypto_hmac_update_data_inputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.94 | Added in: v0.1.94 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `data` string. + +Updates the `Hmac` content with the given `data`, the encoding of which +is given in `inputEncoding`. +If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`, then `inputEncoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: KeyObject[#](#crypto_class_keyobject) + +History + +| Version | Changes | +| --- | --- | +| v11.13.0 | This class is now exported. | +| v11.6.0 | Added in: v11.6.0 | + +Node.js uses a `KeyObject` class to represent a symmetric or asymmetric key, +and each kind of key exposes different functions. The +[`crypto.createSecretKey()`](#crypto_crypto_createsecretkey_key), [`crypto.createPublicKey()`](#crypto_crypto_createpublickey_key) and +[`crypto.createPrivateKey()`](#crypto_crypto_createprivatekey_key) methods are used to create `KeyObject` +instances. `KeyObject` objects are not to be created directly using the `new` +keyword. + +Most applications should consider using the new `KeyObject` API instead of +passing keys as strings or `Buffer`s due to improved security features. + +### keyObject.asymmetricKeyType[#](#crypto_keyobject_asymmetrickeytype) + +Added in: v11.6.0 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +For asymmetric keys, this property represents the type of the embedded key +(`'rsa'`, `'dsa'` or `'ec'`). This property is `undefined` for symmetric keys. + +### keyObject.export([options])[#](#crypto_keyobject_export_options) + +Added in: v11.6.0 + +* `options`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) + +For symmetric keys, this function allocates a `Buffer` containing the key +material and ignores any options. + +For asymmetric keys, the `options` parameter is used to determine the export +format. + +For public keys, the following encoding options can be used: + +* `type`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Must be one of `'pkcs1'` (RSA only) or `'spki'`. +* `format`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Must be `'pem'` or `'der'`. + +For private keys, the following encoding options can be used: + +* `type`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Must be one of `'pkcs1'` (RSA only), `'pkcs8'` or + `'sec1'` (EC only). +* `format`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Must be `'pem'` or `'der'`. +* `cipher`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If specified, the private key will be encrypted with + the given `cipher` and `passphrase` using PKCS#5 v2.0 password based + encryption. +* `passphrase`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) The passphrase to use for encryption, see + `cipher`. + +When PEM encoding was selected, the result will be a string, otherwise it will +be a buffer containing the data encoded as DER. + +PKCS#1, SEC1, and PKCS#8 type keys can be encrypted by using a combination of +the `cipher` and `format` options. The PKCS#8 `type` can be used with any +`format` to encrypt any key algorithm (RSA, EC, or DH) by specifying a +`cipher`. PKCS#1 and SEC1 can only be encrypted by specifying a `cipher` +when the PEM `format` is used. For maximum compatibility, use PKCS#8 for +encrypted private keys. Since PKCS#8 defines its own +encryption mechanism, PEM-level encryption is not supported when encrypting +a PKCS#8 key. See [RFC 5208](https://www.rfc-editor.org/rfc/rfc5208.txt) for PKCS#8 encryption and [RFC 1421](https://www.rfc-editor.org/rfc/rfc1421.txt) for +PKCS#1 and SEC1 encryption. + +### keyObject.symmetricKeySize[#](#crypto_keyobject_symmetrickeysize) + +Added in: v11.6.0 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +For secret keys, this property represents the size of the key in bytes. This +property is `undefined` for asymmetric keys. + +### keyObject.type[#](#crypto_keyobject_type) + +Added in: v11.6.0 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Depending on the type of this `KeyObject`, this property is either +`'secret'` for secret (symmetric) keys, `'public'` for public (asymmetric) keys +or `'private'` for private (asymmetric) keys. + +## Class: Sign[#](#crypto_class_sign) + +Added in: v0.1.92 + +The `Sign` class is a utility for generating signatures. It can be used in one +of two ways: + +* As a writable [stream](stream.html), where data to be signed is written and the + [`sign.sign()`](#crypto_sign_sign_privatekey_outputencoding) method is used to generate and return the signature, or +* Using the [`sign.update()`](#crypto_sign_update_data_inputencoding) and [`sign.sign()`](#crypto_sign_sign_privatekey_outputencoding) methods to produce the + signature. + +The [`crypto.createSign()`](#crypto_crypto_createsign_algorithm_options) method is used to create `Sign` instances. The +argument is the string name of the hash function to use. `Sign` objects are not +to be created directly using the `new` keyword. + +Example: Using `Sign` and [`Verify`](#crypto_class_verify) objects as streams: + +```None +const crypto = require('crypto'); + +const { privateKey, publicKey } = crypto.generateKeyPairSync('ec', { + namedCurve: 'sect239k1' +}); + +const sign = crypto.createSign('SHA256'); +sign.write('some data to sign'); +sign.end(); +const signature = sign.sign(privateKey, 'hex'); + +const verify = crypto.createVerify('SHA256'); +verify.write('some data to sign'); +verify.end(); +console.log(verify.verify(publicKey, signature)); +// Prints: true or false +``` + +Example: Using the [`sign.update()`](#crypto_sign_update_data_inputencoding) and [`verify.update()`](#crypto_verify_update_data_inputencoding) methods: + +```None +const crypto = require('crypto'); + +const { privateKey, publicKey } = crypto.generateKeyPairSync('rsa', { + modulusLength: 2048, +}); + +const sign = crypto.createSign('SHA256'); +sign.update('some data to sign'); +sign.end(); +const signature = sign.sign(privateKey); + +const verify = crypto.createVerify('SHA256'); +verify.update('some data to sign'); +verify.end(); +console.log(verify.verify(publicKey, signature)); +// Prints: true +``` + +### sign.sign(privateKey[, outputEncoding])[#](#crypto_sign_sign_privatekey_outputencoding) + +History + +| Version | Changes | +| --- | --- | +| v11.6.0 | This function now supports key objects. | +| v8.0.0 | Support for RSASSA-PSS and additional options was added. | +| v0.1.92 | Added in: v0.1.92 | + +* `privateKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](crypto.html#crypto_class_keyobject) + + + `padding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + + `saltLength` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value. +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Calculates the signature on all the data passed through using either +[`sign.update()`](#crypto_sign_update_data_inputencoding) or [`sign.write()`](stream.html#stream_writable_write_chunk_encoding_callback). + +If `privateKey` is not a [`KeyObject`](#crypto_class_keyobject), this function behaves as if +`privateKey` had been passed to [`crypto.createPrivateKey()`](#crypto_crypto_createprivatekey_key). If it is an +object, the following additional properties can be passed: + +* `padding`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - Optional padding value for RSA, one of the following: + + + `crypto.constants.RSA_PKCS1_PADDING` (default) + + `crypto.constants.RSA_PKCS1_PSS_PADDING` + + Note that `RSA_PKCS1_PSS_PADDING` will use MGF1 with the same hash function + used to sign the message as specified in section 3.1 of [RFC 4055](https://www.rfc-editor.org/rfc/rfc4055.txt). +* `saltLength`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - salt length for when padding is + `RSA_PKCS1_PSS_PADDING`. The special value + `crypto.constants.RSA_PSS_SALTLEN_DIGEST` sets the salt length to the digest + size, `crypto.constants.RSA_PSS_SALTLEN_MAX_SIGN` (default) sets it to the + maximum permissible value. + +If `outputEncoding` is provided a string is returned; otherwise a [`Buffer`](buffer.html) +is returned. + +The `Sign` object can not be again used after `sign.sign()` method has been +called. Multiple calls to `sign.sign()` will result in an error being thrown. + +### sign.update(data[, inputEncoding])[#](#crypto_sign_update_data_inputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.92 | Added in: v0.1.92 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `data` string. + +Updates the `Sign` content with the given `data`, the encoding of which +is given in `inputEncoding`. +If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`, then `inputEncoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Verify[#](#crypto_class_verify) + +Added in: v0.1.92 + +The `Verify` class is a utility for verifying signatures. It can be used in one +of two ways: + +* As a writable [stream](stream.html) where written data is used to validate against the + supplied signature, or +* Using the [`verify.update()`](#crypto_verify_update_data_inputencoding) and [`verify.verify()`](#crypto_verify_verify_object_signature_signatureencoding) methods to verify + the signature. + +The [`crypto.createVerify()`](#crypto_crypto_createverify_algorithm_options) method is used to create `Verify` instances. +`Verify` objects are not to be created directly using the `new` keyword. + +See [`Sign`](#crypto_class_sign) for examples. + +### verify.update(data[, inputEncoding])[#](#crypto_verify_update_data_inputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.92 | Added in: v0.1.92 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `data` string. + +Updates the `Verify` content with the given `data`, the encoding of which +is given in `inputEncoding`. +If `inputEncoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`, then `inputEncoding` is ignored. + +This can be called many times with new data as it is streamed. + +### verify.verify(object, signature[, signatureEncoding])[#](#crypto_verify_verify_object_signature_signatureencoding) + +History + +| Version | Changes | +| --- | --- | +| v11.7.0 | The key can now be a private key. | +| v8.0.0 | Support for RSASSA-PSS and additional options was added. | +| v0.1.92 | Added in: v0.1.92 | + +* `object` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](crypto.html#crypto_class_keyobject) + + + `padding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + + `saltLength` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `signature` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `signatureEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `signature` string. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` or `false` depending on the validity of the + signature for the data and public key. + +Verifies the provided data using the given `object` and `signature`. + +If `object` is not a [`KeyObject`](#crypto_class_keyobject), this function behaves as if +`object` had been passed to [`crypto.createPublicKey()`](#crypto_crypto_createpublickey_key). If it is an +object, the following additional properties can be passed: + +* `padding`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - Optional padding value for RSA, one of the following: + + + `crypto.constants.RSA_PKCS1_PADDING` (default) + + `crypto.constants.RSA_PKCS1_PSS_PADDING` + + Note that `RSA_PKCS1_PSS_PADDING` will use MGF1 with the same hash function + used to verify the message as specified in section 3.1 of [RFC 4055](https://www.rfc-editor.org/rfc/rfc4055.txt). +* `saltLength`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - salt length for when padding is + `RSA_PKCS1_PSS_PADDING`. The special value + `crypto.constants.RSA_PSS_SALTLEN_DIGEST` sets the salt length to the digest + size, `crypto.constants.RSA_PSS_SALTLEN_AUTO` (default) causes it to be + determined automatically. + +The `signature` argument is the previously calculated signature for the data, in +the `signatureEncoding`. +If a `signatureEncoding` is specified, the `signature` is expected to be a +string; otherwise `signature` is expected to be a [`Buffer`](buffer.html), +`TypedArray`, or `DataView`. + +The `verify` object can not be used again after `verify.verify()` has been +called. Multiple calls to `verify.verify()` will result in an error being +thrown. + +Because public keys can be derived from private keys, a private key may +be passed instead of a public key. + +## `crypto` module methods and properties[#](#crypto_crypto_module_methods_and_properties) + +### crypto.constants[#](#crypto_crypto_constants) + +Added in: v6.3.0 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) An object containing commonly used constants for crypto and + security related operations. The specific constants currently defined are + described in [Crypto Constants](#crypto_crypto_constants_1). + +### crypto.DEFAULT\_ENCODING[#](#crypto_crypto_default_encoding) + +Added in: v0.9.3Deprecated since: v10.0.0 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated + +The default encoding to use for functions that can take either strings +or [buffers](buffer.html). The default value is `'buffer'`, which makes methods +default to [`Buffer`](buffer.html) objects. + +The `crypto.DEFAULT_ENCODING` mechanism is provided for backwards compatibility +with legacy programs that expect `'latin1'` to be the default encoding. + +New applications should expect the default to be `'buffer'`. + +This property is deprecated. + +### crypto.fips[#](#crypto_crypto_fips) + +Added in: v6.0.0Deprecated since: v10.0.0 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated + +Property for checking and controlling whether a FIPS compliant crypto provider +is currently in use. Setting to true requires a FIPS build of Node.js. + +This property is deprecated. Please use `crypto.setFips()` and +`crypto.getFips()` instead. + +### crypto.createCipher(algorithm, password[, options])[#](#crypto_crypto_createcipher_algorithm_password_options) + +History + +| Version | Changes | +| --- | --- | +| v10.10.0 | Ciphers in OCB mode are now supported. | +| v10.2.0 | The `authTagLength` option can now be used to produce shorter authentication tags in GCM mode and defaults to 16 bytes. | +| v10.0.0 | Deprecated since: v10.0.0 | +| v0.1.94 | Added in: v0.1.94 | + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`crypto.createCipheriv()`](#crypto_crypto_createcipheriv_algorithm_key_iv_options) instead. + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `password` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) +* Returns: [](crypto.html#crypto_class_cipher) + +Creates and returns a `Cipher` object that uses the given `algorithm` and +`password`. + +The `options` argument controls stream behavior and is optional except when a +cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the +`authTagLength` option is required and specifies the length of the +authentication tag in bytes, see [CCM mode](#crypto_ccm_mode). In GCM mode, the `authTagLength` +option is not required but can be used to set the length of the authentication +tag that will be returned by `getAuthTag()` and defaults to 16 bytes. + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list -cipher-algorithms` +(`openssl list-cipher-algorithms` for older versions of OpenSSL) will +display the available cipher algorithms. + +The `password` is used to derive the cipher key and initialization vector (IV). +The value must be either a `'latin1'` encoded string, a [`Buffer`](buffer.html), a +`TypedArray`, or a `DataView`. + +The implementation of `crypto.createCipher()` derives keys using the OpenSSL +function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one +iteration, and no salt. The lack of salt allows dictionary attacks as the same +password always creates the same key. The low iteration count and +non-cryptographically secure hash algorithm allow passwords to be tested very +rapidly. + +In line with OpenSSL's recommendation to use a more modern algorithm instead of +[`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) it is recommended that developers derive a key and IV on +their own using [`crypto.scrypt()`](#crypto_crypto_scrypt_password_salt_keylen_options_callback) and to use [`crypto.createCipheriv()`](#crypto_crypto_createcipheriv_algorithm_key_iv_options) +to create the `Cipher` object. Users should not use ciphers with counter mode +(e.g. CTR, GCM, or CCM) in `crypto.createCipher()`. A warning is emitted when +they are used in order to avoid the risk of IV reuse that causes +vulnerabilities. For the case when IV is reused in GCM, see [Nonce-Disrespecting +Adversaries](https://github.com/nonce-disrespect/nonce-disrespect) for details. + +### crypto.createCipheriv(algorithm, key, iv[, options])[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/crypto.js#L111)[#](#crypto_crypto_createcipheriv_algorithm_key_iv_options) + +History + +| Version | Changes | +| --- | --- | +| v11.6.0 | The `key` argument can now be a `KeyObject`. | +| v11.2.0 | The cipher `chacha20-poly1305` is now supported. | +| v10.10.0 | Ciphers in OCB mode are now supported. | +| v10.2.0 | The `authTagLength` option can now be used to produce shorter authentication tags in GCM mode and defaults to 16 bytes. | +| v9.9.0 | The `iv` parameter may now be `null` for ciphers which do not need an initialization vector. | +| v0.1.94 | Added in: v0.1.94 | + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) | [](crypto.html#crypto_class_keyobject) +* `iv` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) +* Returns: [](crypto.html#crypto_class_cipher) + +Creates and returns a `Cipher` object, with the given `algorithm`, `key` and +initialization vector (`iv`). + +The `options` argument controls stream behavior and is optional except when a +cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the +`authTagLength` option is required and specifies the length of the +authentication tag in bytes, see [CCM mode](#crypto_ccm_mode). In GCM mode, the `authTagLength` +option is not required but can be used to set the length of the authentication +tag that will be returned by `getAuthTag()` and defaults to 16 bytes. + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list -cipher-algorithms` +(`openssl list-cipher-algorithms` for older versions of OpenSSL) will +display the available cipher algorithms. + +The `key` is the raw key used by the `algorithm` and `iv` is an +[initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded strings, +[Buffers](buffer.html), `TypedArray`, or `DataView`s. The `key` may optionally be +a [`KeyObject`](#crypto_class_keyobject) of type `secret`. If the cipher does not need +an initialization vector, `iv` may be `null`. + +Initialization vectors should be unpredictable and unique; ideally, they will be +cryptographically random. They do not have to be secret: IVs are typically just +added to ciphertext messages unencrypted. It may sound contradictory that +something has to be unpredictable and unique, but does not have to be secret; +it is important to remember that an attacker must not be able to predict ahead +of time what a given IV will be. + +### crypto.createDecipher(algorithm, password[, options])[#](#crypto_crypto_createdecipher_algorithm_password_options) + +History + +| Version | Changes | +| --- | --- | +| v10.10.0 | Ciphers in OCB mode are now supported. | +| v10.0.0 | Deprecated since: v10.0.0 | +| v0.1.94 | Added in: v0.1.94 | + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`crypto.createDecipheriv()`](#crypto_crypto_createdecipheriv_algorithm_key_iv_options) instead. + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `password` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) +* Returns: [](crypto.html#crypto_class_decipher) + +Creates and returns a `Decipher` object that uses the given `algorithm` and +`password` (key). + +The `options` argument controls stream behavior and is optional except when a +cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the +`authTagLength` option is required and specifies the length of the +authentication tag in bytes, see [CCM mode](#crypto_ccm_mode). + +The implementation of `crypto.createDecipher()` derives keys using the OpenSSL +function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one +iteration, and no salt. The lack of salt allows dictionary attacks as the same +password always creates the same key. The low iteration count and +non-cryptographically secure hash algorithm allow passwords to be tested very +rapidly. + +In line with OpenSSL's recommendation to use a more modern algorithm instead of +[`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) it is recommended that developers derive a key and IV on +their own using [`crypto.scrypt()`](#crypto_crypto_scrypt_password_salt_keylen_options_callback) and to use [`crypto.createDecipheriv()`](#crypto_crypto_createdecipheriv_algorithm_key_iv_options) +to create the `Decipher` object. + +### crypto.createDecipheriv(algorithm, key, iv[, options])[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/crypto.js#L119)[#](#crypto_crypto_createdecipheriv_algorithm_key_iv_options) + +History + +| Version | Changes | +| --- | --- | +| v11.6.0 | The `key` argument can now be a `KeyObject`. | +| v11.2.0 | The cipher `chacha20-poly1305` is now supported. | +| v10.10.0 | Ciphers in OCB mode are now supported. | +| v10.2.0 | The `authTagLength` option can now be used to restrict accepted GCM authentication tag lengths. | +| v9.9.0 | The `iv` parameter may now be `null` for ciphers which do not need an initialization vector. | +| v0.1.94 | Added in: v0.1.94 | + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `iv` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) +* Returns: [](crypto.html#crypto_class_decipher) + +Creates and returns a `Decipher` object that uses the given `algorithm`, `key` +and initialization vector (`iv`). + +The `options` argument controls stream behavior and is optional except when a +cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the +`authTagLength` option is required and specifies the length of the +authentication tag in bytes, see [CCM mode](#crypto_ccm_mode). In GCM mode, the `authTagLength` +option is not required but can be used to restrict accepted authentication tags +to those with the specified length. + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list -cipher-algorithms` +(`openssl list-cipher-algorithms` for older versions of OpenSSL) will +display the available cipher algorithms. + +The `key` is the raw key used by the `algorithm` and `iv` is an +[initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded strings, +[Buffers](buffer.html), `TypedArray`, or `DataView`s. The `key` may optionally be +a [`KeyObject`](#crypto_class_keyobject) of type `secret`. If the cipher does not need +an initialization vector, `iv` may be `null`. + +Initialization vectors should be unpredictable and unique; ideally, they will be +cryptographically random. They do not have to be secret: IVs are typically just +added to ciphertext messages unencrypted. It may sound contradictory that +something has to be unpredictable and unique, but does not have to be secret; +it is important to remember that an attacker must not be able to predict ahead +of time what a given IV will be. + +### crypto.createDiffieHellman(prime[, primeEncoding][, generator][, generatorEncoding])[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/crypto.js#L123)[#](#crypto_crypto_creatediffiehellman_prime_primeencoding_generator_generatorencoding) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `prime` argument can be any `TypedArray` or `DataView` now. | +| v8.0.0 | The `prime` argument can be a `Uint8Array` now. | +| v6.0.0 | The default for the encoding parameters changed from `binary` to `utf8`. | +| v0.11.12 | Added in: v0.11.12 | + +* `prime` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `primeEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `prime` string. +* `generator` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) **Default:** + `2` +* `generatorEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the `generator` string. +* Returns: [](crypto.html#crypto_class_diffiehellman) + +Creates a `DiffieHellman` key exchange object using the supplied `prime` and an +optional specific `generator`. + +The `generator` argument can be a number, string, or [`Buffer`](buffer.html). If +`generator` is not specified, the value `2` is used. + +If `primeEncoding` is specified, `prime` is expected to be a string; otherwise +a [`Buffer`](buffer.html), `TypedArray`, or `DataView` is expected. + +If `generatorEncoding` is specified, `generator` is expected to be a string; +otherwise a number, [`Buffer`](buffer.html), `TypedArray`, or `DataView` is expected. + +### crypto.createDiffieHellman(primeLength[, generator])[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/crypto.js#L123)[#](#crypto_crypto_creatediffiehellman_primelength_generator) + +Added in: v0.5.0 + +* `primeLength` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `generator` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) **Default:** + `2` +* Returns: [](crypto.html#crypto_class_diffiehellman) + +Creates a `DiffieHellman` key exchange object and generates a prime of +`primeLength` bits using an optional specific numeric `generator`. +If `generator` is not specified, the value `2` is used. + +### crypto.createECDH(curveName)[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/crypto.js#L131)[#](#crypto_crypto_createecdh_curvename) + +Added in: v0.11.14 + +* `curveName` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](crypto.html#crypto_class_ecdh) + +Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a +predefined curve specified by the `curveName` string. Use +[`crypto.getCurves()`](#crypto_crypto_getcurves) to obtain a list of available curve names. On recent +OpenSSL releases, `openssl ecparam -list_curves` will also display the name +and description of each available elliptic curve. + +### crypto.createHash(algorithm[, options])[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/crypto.js#L103)[#](#crypto_crypto_createhash_algorithm_options) + +Added in: v0.1.92 + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) +* Returns: [](crypto.html#crypto_class_hash) + +Creates and returns a `Hash` object that can be used to generate hash digests +using the given `algorithm`. Optional `options` argument controls stream +behavior. + +The `algorithm` is dependent on the available algorithms supported by the +version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. +On recent releases of OpenSSL, `openssl list -digest-algorithms` +(`openssl list-message-digest-algorithms` for older versions of OpenSSL) will +display the available digest algorithms. + +Example: generating the sha256 sum of a file + +```None +const filename = process.argv[2]; +const crypto = require('crypto'); +const fs = require('fs'); + +const hash = crypto.createHash('sha256'); + +const input = fs.createReadStream(filename); +input.on('readable', () => { + // Only one element is going to be produced by the + // hash stream. + const data = input.read(); + if (data) + hash.update(data); + else { + console.log(`${hash.digest('hex')} ${filename}`); + } +}); +``` + +### crypto.createHmac(algorithm, key[, options])[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/crypto.js#L135)[#](#crypto_crypto_createhmac_algorithm_key_options) + +History + +| Version | Changes | +| --- | --- | +| v11.6.0 | The `key` argument can now be a `KeyObject`. | +| v0.1.94 | Added in: v0.1.94 | + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) | [](crypto.html#crypto_class_keyobject) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) +* Returns: [](crypto.html#crypto_class_hmac) + +Creates and returns an `Hmac` object that uses the given `algorithm` and `key`. +Optional `options` argument controls stream behavior. + +The `algorithm` is dependent on the available algorithms supported by the +version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. +On recent releases of OpenSSL, `openssl list -digest-algorithms` +(`openssl list-message-digest-algorithms` for older versions of OpenSSL) will +display the available digest algorithms. + +The `key` is the HMAC key used to generate the cryptographic HMAC hash. If it is +a [`KeyObject`](#crypto_class_keyobject), its type must be `secret`. + +Example: generating the sha256 HMAC of a file + +```None +const filename = process.argv[2]; +const crypto = require('crypto'); +const fs = require('fs'); + +const hmac = crypto.createHmac('sha256', 'a secret'); + +const input = fs.createReadStream(filename); +input.on('readable', () => { + // Only one element is going to be produced by the + // hash stream. + const data = input.read(); + if (data) + hmac.update(data); + else { + console.log(`${hmac.digest('hex')} ${filename}`); + } +}); +``` + +### crypto.createPrivateKey(key)[#](#crypto_crypto_createprivatekey_key) + +Added in: v11.6.0 + +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) + + + `key`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) The key material, either in PEM or DER format. + + `format`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Must be `'pem'` or `'der'`. **Default:** `'pem'`. + + `type`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Must be `'pkcs1'`, `'pkcs8'` or `'sec1'`. This option is + required only if the `format` is `'der'` and ignored if it is `'pem'`. + + `passphrase`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) The passphrase to use for decryption. +* Returns: [](crypto.html#crypto_class_keyobject) + +Creates and returns a new key object containing a private key. If `key` is a +string or `Buffer`, `format` is assumed to be `'pem'`; otherwise, `key` +must be an object with the properties described above. + +### crypto.createPublicKey(key)[#](#crypto_crypto_createpublickey_key) + +History + +| Version | Changes | +| --- | --- | +| v11.13.0 | The `key` argument can now be a `KeyObject` with type `private`. | +| v11.7.0 | The `key` argument can now be a private key. | +| v11.6.0 | Added in: v11.6.0 | + +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](crypto.html#crypto_class_keyobject) + + + `key`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) + + `format`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Must be `'pem'` or `'der'`. **Default:** `'pem'`. + + `type`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Must be `'pkcs1'` or `'spki'`. This option is required + only if the `format` is `'der'`. +* Returns: [](crypto.html#crypto_class_keyobject) + +Creates and returns a new key object containing a public key. If `key` is a +string or `Buffer`, `format` is assumed to be `'pem'`; if `key` is a `KeyObject` +with type `'private'`, the public key is derived from the given private key; +otherwise, `key` must be an object with the properties described above. + +If the format is `'pem'`, the `'key'` may also be an X.509 certificate. + +Because public keys can be derived from private keys, a private key may be +passed instead of a public key. In that case, this function behaves as if +[`crypto.createPrivateKey()`](#crypto_crypto_createprivatekey_key) had been called, except that the type of the +returned `KeyObject` will be `'public'` and that the private key cannot be +extracted from the returned `KeyObject`. Similarly, if a `KeyObject` with type +`'private'` is given, a new `KeyObject` with type `'public'` will be returned +and it will be impossible to extract the private key from the returned object. + +### crypto.createSecretKey(key)[#](#crypto_crypto_createsecretkey_key) + +Added in: v11.6.0 + +* `key` [](buffer.html#buffer_class_buffer) +* Returns: [](crypto.html#crypto_class_keyobject) + +Creates and returns a new key object containing a secret key for symmetric +encryption or `Hmac`. + +### crypto.createSign(algorithm[, options])[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/crypto.js#L139)[#](#crypto_crypto_createsign_algorithm_options) + +Added in: v0.1.92 + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.Writable` options](stream.html#stream_constructor_new_stream_writable_options) +* Returns: [](crypto.html#crypto_class_sign) + +Creates and returns a `Sign` object that uses the given `algorithm`. Use +[`crypto.getHashes()`](#crypto_crypto_gethashes) to obtain the names of the available digest algorithms. +Optional `options` argument controls the `stream.Writable` behavior. + +In some cases, a `Sign` instance can be created using the name of a signature +algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use +the corresponding digest algorithm. This does not work for all signature +algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest +algorithm names. + +### crypto.createVerify(algorithm[, options])[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/crypto.js#L143)[#](#crypto_crypto_createverify_algorithm_options) + +Added in: v0.1.92 + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.Writable` options](stream.html#stream_constructor_new_stream_writable_options) +* Returns: [](crypto.html#crypto_class_verify) + +Creates and returns a `Verify` object that uses the given algorithm. +Use [`crypto.getHashes()`](#crypto_crypto_gethashes) to obtain an array of names of the available +signing algorithms. Optional `options` argument controls the +`stream.Writable` behavior. + +In some cases, a `Verify` instance can be created using the name of a signature +algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use +the corresponding digest algorithm. This does not work for all signature +algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest +algorithm names. + +### crypto.generateKeyPair(type, options, callback)[#](#crypto_crypto_generatekeypair_type_options_callback) + +History + +| Version | Changes | +| --- | --- | +| v11.6.0 | The `generateKeyPair` and `generateKeyPairSync` functions now produce key objects if no encoding was specified. | +| v10.12.0 | Added in: v10.12.0 | + +* `type`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Must be `'rsa'`, `'dsa'` or `'ec'`. +* `options`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `modulusLength`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Key size in bits (RSA, DSA). + + `publicExponent`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Public exponent (RSA). **Default:** `0x10001`. + + `divisorLength`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Size of `q` in bits (DSA). + + `namedCurve`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Name of the curve to use (EC). + + `publicKeyEncoding`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) See [`keyObject.export()`](#crypto_keyobject_export_options). + + `privateKeyEncoding`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) See [`keyObject.export()`](#crypto_keyobject_export_options). +* `callback`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + + + `err`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + + `publicKey`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](crypto.html#crypto_class_keyobject) + + `privateKey`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](crypto.html#crypto_class_keyobject) + +Generates a new asymmetric key pair of the given `type`. Only RSA, DSA and EC +are currently supported. + +If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function +behaves as if [`keyObject.export()`](#crypto_keyobject_export_options) had been called on its result. Otherwise, +the respective part of the key is returned as a [`KeyObject`](#crypto_class_keyobject). + +It is recommended to encode public keys as `'spki'` and private keys as +`'pkcs8'` with encryption for long-term storage: + +```None +const { generateKeyPair } = require('crypto'); +generateKeyPair('rsa', { + modulusLength: 4096, + publicKeyEncoding: { + type: 'spki', + format: 'pem' + }, + privateKeyEncoding: { + type: 'pkcs8', + format: 'pem', + cipher: 'aes-256-cbc', + passphrase: 'top secret' + } +}, (err, publicKey, privateKey) => { + // Handle errors and use the generated key pair. +}); +``` + +On completion, `callback` will be called with `err` set to `undefined` and +`publicKey` / `privateKey` representing the generated key pair. + +If this method is invoked as its [`util.promisify()`](util.html#util_util_promisify_original)ed version, it returns +a `Promise` for an `Object` with `publicKey` and `privateKey` properties. + +### crypto.generateKeyPairSync(type, options)[#](#crypto_crypto_generatekeypairsync_type_options) + +History + +| Version | Changes | +| --- | --- | +| v11.6.0 | The `generateKeyPair` and `generateKeyPairSync` functions now produce key objects if no encoding was specified. | +| v10.12.0 | Added in: v10.12.0 | + +* `type`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Must be `'rsa'`, `'dsa'` or `'ec'`. +* `options`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `modulusLength`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Key size in bits (RSA, DSA). + + `publicExponent`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Public exponent (RSA). **Default:** `0x10001`. + + `divisorLength`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Size of `q` in bits (DSA). + + `namedCurve`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Name of the curve to use (EC). + + `publicKeyEncoding`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) See [`keyObject.export()`](#crypto_keyobject_export_options). + + `privateKeyEncoding`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) See [`keyObject.export()`](#crypto_keyobject_export_options). +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `publicKey`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](crypto.html#crypto_class_keyobject) + + `privateKey`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](crypto.html#crypto_class_keyobject) + +Generates a new asymmetric key pair of the given `type`. Only RSA, DSA and EC +are currently supported. + +If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function +behaves as if [`keyObject.export()`](#crypto_keyobject_export_options) had been called on its result. Otherwise, +the respective part of the key is returned as a [`KeyObject`](#crypto_class_keyobject). + +When encoding public keys, it is recommended to use `'spki'`. When encoding +private keys, it is recommended to use `'pks8'` with a strong passphrase, and to +keep the passphrase confidential. + +```None +const { generateKeyPairSync } = require('crypto'); +const { publicKey, privateKey } = generateKeyPairSync('rsa', { + modulusLength: 4096, + publicKeyEncoding: { + type: 'spki', + format: 'pem' + }, + privateKeyEncoding: { + type: 'pkcs8', + format: 'pem', + cipher: 'aes-256-cbc', + passphrase: 'top secret' + } +}); +``` + +The return value `{ publicKey, privateKey }` represents the generated key pair. +When PEM encoding was selected, the respective key will be a string, otherwise +it will be a buffer containing the data encoded as DER. + +### crypto.getCiphers()[#](#crypto_crypto_getciphers) + +Added in: v0.9.3 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An array with the names of the supported cipher + algorithms. + +```None +const ciphers = crypto.getCiphers(); +console.log(ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...] +``` + +### crypto.getCurves()[#](#crypto_crypto_getcurves) + +Added in: v2.3.0 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An array with the names of the supported elliptic curves. + +```None +const curves = crypto.getCurves(); +console.log(curves); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...] +``` + +### crypto.getDiffieHellman(groupName)[#](#crypto_crypto_getdiffiehellman_groupname) + +Added in: v0.7.5 + +* `groupName` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](crypto.html#crypto_class_diffiehellman) + +Creates a predefined `DiffieHellman` key exchange object. The +supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in +[RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt), but see [Caveats](#crypto_support_for_weak_or_compromised_algorithms)) and `'modp14'`, `'modp15'`, +`'modp16'`, `'modp17'`, `'modp18'` (defined in [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt)). The +returned object mimics the interface of objects created by +[`crypto.createDiffieHellman()`](#crypto_crypto_creatediffiehellman_prime_primeencoding_generator_generatorencoding), but will not allow changing +the keys (with [`diffieHellman.setPublicKey()`](#crypto_diffiehellman_setpublickey_publickey_encoding), for example). The +advantage of using this method is that the parties do not have to +generate nor exchange a group modulus beforehand, saving both processor +and communication time. + +Example (obtaining a shared secret): + +```None +const crypto = require('crypto'); +const alice = crypto.getDiffieHellman('modp14'); +const bob = crypto.getDiffieHellman('modp14'); + +alice.generateKeys(); +bob.generateKeys(); + +const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +/* aliceSecret and bobSecret should be the same */ +console.log(aliceSecret === bobSecret); +``` + +### crypto.getFips()[#](#crypto_crypto_getfips) + +Added in: v10.0.0 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` if and only if a FIPS compliant crypto provider is + currently in use. + +### crypto.getHashes()[#](#crypto_crypto_gethashes) + +Added in: v0.9.3 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An array of the names of the supported hash algorithms, + such as `'RSA-SHA256'`. Hash algorithms are also called "digest" algorithms. + +```None +const hashes = crypto.getHashes(); +console.log(hashes); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...] +``` + +### crypto.pbkdf2(password, salt, iterations, keylen, digest, callback)[#](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `digest` parameter is always required now. | +| v6.0.0 | Calling this function without passing the `digest` parameter is deprecated now and will emit a warning. | +| v6.0.0 | The default encoding for `password` if it is a string changed from `binary` to `utf8`. | +| v0.5.5 | Added in: v0.5.5 | + +* `password` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `salt` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `iterations` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `keylen` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `digest` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + + + `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + + `derivedKey` [](buffer.html#buffer_class_buffer) + +Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2) +implementation. A selected HMAC digest algorithm specified by `digest` is +applied to derive a key of the requested byte length (`keylen`) from the +`password`, `salt` and `iterations`. + +The supplied `callback` function is called with two arguments: `err` and +`derivedKey`. If an error occurs while deriving the key, `err` will be set; +otherwise `err` will be `null`. By default, the successfully generated +`derivedKey` will be passed to the callback as a [`Buffer`](buffer.html). An error will be +thrown if any of the input arguments specify invalid values or types. + +If `digest` is `null`, `'sha1'` will be used. This behavior is deprecated, +please specify a `digest` explicitly. + +The `iterations` argument must be a number set as high as possible. The +higher the number of iterations, the more secure the derived key will be, +but will take a longer amount of time to complete. + +The `salt` should be as unique as possible. It is recommended that a salt is +random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + +```None +const crypto = require('crypto'); +crypto.pbkdf2('secret', 'salt', 100000, 64, 'sha512', (err, derivedKey) => { + if (err) throw err; + console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' +}); +``` + +The `crypto.DEFAULT_ENCODING` property can be used to change the way the +`derivedKey` is passed to the callback. This property, however, has been +deprecated and use should be avoided. + +```None +const crypto = require('crypto'); +crypto.DEFAULT_ENCODING = 'hex'; +crypto.pbkdf2('secret', 'salt', 100000, 512, 'sha512', (err, derivedKey) => { + if (err) throw err; + console.log(derivedKey); // '3745e48...aa39b34' +}); +``` + +An array of supported digest functions can be retrieved using +[`crypto.getHashes()`](#crypto_crypto_gethashes). + +Note that this API uses libuv's threadpool, which can have surprising and +negative performance implications for some applications, see the +[`UV_THREADPOOL_SIZE`](cli.html#cli_uv_threadpool_size_size) documentation for more information. + +### crypto.pbkdf2Sync(password, salt, iterations, keylen, digest)[#](#crypto_crypto_pbkdf2sync_password_salt_iterations_keylen_digest) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | Calling this function without passing the `digest` parameter is deprecated now and will emit a warning. | +| v6.0.0 | The default encoding for `password` if it is a string changed from `binary` to `utf8`. | +| v0.9.3 | Added in: v0.9.3 | + +* `password` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `salt` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `iterations` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `keylen` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `digest` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](buffer.html#buffer_class_buffer) + +Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) +implementation. A selected HMAC digest algorithm specified by `digest` is +applied to derive a key of the requested byte length (`keylen`) from the +`password`, `salt` and `iterations`. + +If an error occurs an `Error` will be thrown, otherwise the derived key will be +returned as a [`Buffer`](buffer.html). + +If `digest` is `null`, `'sha1'` will be used. This behavior is deprecated, +please specify a `digest` explicitly. + +The `iterations` argument must be a number set as high as possible. The +higher the number of iterations, the more secure the derived key will be, +but will take a longer amount of time to complete. + +The `salt` should be as unique as possible. It is recommended that a salt is +random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + +```None +const crypto = require('crypto'); +const key = crypto.pbkdf2Sync('secret', 'salt', 100000, 64, 'sha512'); +console.log(key.toString('hex')); // '3745e48...08d59ae' +``` + +The `crypto.DEFAULT_ENCODING` property may be used to change the way the +`derivedKey` is returned. This property, however, is deprecated and use +should be avoided. + +```None +const crypto = require('crypto'); +crypto.DEFAULT_ENCODING = 'hex'; +const key = crypto.pbkdf2Sync('secret', 'salt', 100000, 512, 'sha512'); +console.log(key); // '3745e48...aa39b34' +``` + +An array of supported digest functions can be retrieved using +[`crypto.getHashes()`](#crypto_crypto_gethashes). + +### crypto.privateDecrypt(privateKey, buffer)[#](#crypto_crypto_privatedecrypt_privatekey_buffer) + +History + +| Version | Changes | +| --- | --- | +| v11.6.0 | This function now supports key objects. | +| v0.11.14 | Added in: v0.11.14 | + +* `privateKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](crypto.html#crypto_class_keyobject) + + + `padding` [](crypto.html#crypto_crypto_constants_1) An optional padding value defined in + `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING`, + `crypto.constants.RSA_PKCS1_PADDING`, or + `crypto.constants.RSA_PKCS1_OAEP_PADDING`. +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) A new `Buffer` with the decrypted content. + +Decrypts `buffer` with `privateKey`. `buffer` was previously encrypted using +the corresponding public key, for example using [`crypto.publicEncrypt()`](#crypto_crypto_publicencrypt_key_buffer). + +If `privateKey` is not a [`KeyObject`](#crypto_class_keyobject), this function behaves as if +`privateKey` had been passed to [`crypto.createPrivateKey()`](#crypto_crypto_createprivatekey_key). If it is an +object, the `padding` property can be passed. Otherwise, this function uses +`RSA_PKCS1_OAEP_PADDING`. + +### crypto.privateEncrypt(privateKey, buffer)[#](#crypto_crypto_privateencrypt_privatekey_buffer) + +History + +| Version | Changes | +| --- | --- | +| v11.6.0 | This function now supports key objects. | +| v1.1.0 | Added in: v1.1.0 | + +* `privateKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](crypto.html#crypto_class_keyobject) + + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](crypto.html#crypto_class_keyobject) A PEM encoded private key. + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) An optional passphrase for the private key. + + `padding` [](crypto.html#crypto_crypto_constants_1) An optional padding value defined in + `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING` or + `crypto.constants.RSA_PKCS1_PADDING`. +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) A new `Buffer` with the encrypted content. + +Encrypts `buffer` with `privateKey`. The returned data can be decrypted using +the corresponding public key, for example using [`crypto.publicDecrypt()`](#crypto_crypto_publicdecrypt_key_buffer). + +If `privateKey` is not a [`KeyObject`](#crypto_class_keyobject), this function behaves as if +`privateKey` had been passed to [`crypto.createPrivateKey()`](#crypto_crypto_createprivatekey_key). If it is an +object, the `padding` property can be passed. Otherwise, this function uses +`RSA_PKCS1_PADDING`. + +### crypto.publicDecrypt(key, buffer)[#](#crypto_crypto_publicdecrypt_key_buffer) + +History + +| Version | Changes | +| --- | --- | +| v11.6.0 | This function now supports key objects. | +| v1.1.0 | Added in: v1.1.0 | + +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](crypto.html#crypto_class_keyobject) + + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) An optional passphrase for the private key. + + `padding` [](crypto.html#crypto_crypto_constants_1) An optional padding value defined in + `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING` or + `crypto.constants.RSA_PKCS1_PADDING`. +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) A new `Buffer` with the decrypted content. + +Decrypts `buffer` with `key`.`buffer` was previously encrypted using +the corresponding private key, for example using [`crypto.privateEncrypt()`](#crypto_crypto_privateencrypt_privatekey_buffer). + +If `key` is not a [`KeyObject`](#crypto_class_keyobject), this function behaves as if +`key` had been passed to [`crypto.createPublicKey()`](#crypto_crypto_createpublickey_key). If it is an +object, the `padding` property can be passed. Otherwise, this function uses +`RSA_PKCS1_PADDING`. + +Because RSA public keys can be derived from private keys, a private key may +be passed instead of a public key. + +### crypto.publicEncrypt(key, buffer)[#](#crypto_crypto_publicencrypt_key_buffer) + +History + +| Version | Changes | +| --- | --- | +| v11.6.0 | This function now supports key objects. | +| v0.11.14 | Added in: v0.11.14 | + +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](crypto.html#crypto_class_keyobject) + + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](crypto.html#crypto_class_keyobject) A PEM encoded public or private key. + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) An optional passphrase for the private key. + + `padding` [](crypto.html#crypto_crypto_constants_1) An optional padding value defined in + `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING`, + `crypto.constants.RSA_PKCS1_PADDING`, or + `crypto.constants.RSA_PKCS1_OAEP_PADDING`. +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) A new `Buffer` with the encrypted content. + +Encrypts the content of `buffer` with `key` and returns a new +[`Buffer`](buffer.html) with encrypted content. The returned data can be decrypted using +the corresponding private key, for example using [`crypto.privateDecrypt()`](#crypto_crypto_privatedecrypt_privatekey_buffer). + +If `key` is not a [`KeyObject`](#crypto_class_keyobject), this function behaves as if +`key` had been passed to [`crypto.createPublicKey()`](#crypto_crypto_createpublickey_key). If it is an +object, the `padding` property can be passed. Otherwise, this function uses +`RSA_PKCS1_OAEP_PADDING`. + +Because RSA public keys can be derived from private keys, a private key may +be passed instead of a public key. + +### crypto.randomBytes(size[, callback])[#](#crypto_crypto_randombytes_size_callback) + +History + +| Version | Changes | +| --- | --- | +| v9.0.0 | Passing `null` as the `callback` argument now throws `ERR_INVALID_CALLBACK`. | +| v0.5.8 | Added in: v0.5.8 | + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + + + `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + + `buf` [](buffer.html#buffer_class_buffer) +* Returns: [](buffer.html#buffer_class_buffer) if the `callback` function is not provided. + +Generates cryptographically strong pseudo-random data. The `size` argument +is a number indicating the number of bytes to generate. + +If a `callback` function is provided, the bytes are generated asynchronously +and the `callback` function is invoked with two arguments: `err` and `buf`. +If an error occurs, `err` will be an `Error` object; otherwise it is `null`. The +`buf` argument is a [`Buffer`](buffer.html) containing the generated bytes. + +```None +// Asynchronous +const crypto = require('crypto'); +crypto.randomBytes(256, (err, buf) => { + if (err) throw err; + console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`); +}); +``` + +If the `callback` function is not provided, the random bytes are generated +synchronously and returned as a [`Buffer`](buffer.html). An error will be thrown if +there is a problem generating the bytes. + +```None +// Synchronous +const buf = crypto.randomBytes(256); +console.log( + `${buf.length} bytes of random data: ${buf.toString('hex')}`); +``` + +The `crypto.randomBytes()` method will not complete until there is +sufficient entropy available. +This should normally never take longer than a few milliseconds. The only time +when generating the random bytes may conceivably block for a longer period of +time is right after boot, when the whole system is still low on entropy. + +Note that this API uses libuv's threadpool, which can have surprising and +negative performance implications for some applications, see the +[`UV_THREADPOOL_SIZE`](cli.html#cli_uv_threadpool_size_size) documentation for more information. + +The asynchronous version of `crypto.randomBytes()` is carried out in a single +threadpool request. To minimize threadpool task length variation, partition +large `randomBytes` requests when doing so as part of fulfilling a client +request. + +### crypto.randomFillSync(buffer[, offset][, size])[#](#crypto_crypto_randomfillsync_buffer_offset_size) + +History + +| Version | Changes | +| --- | --- | +| v9.0.0 | The `buffer` argument may be any `TypedArray` or `DataView`. | +| v7.10.0, v6.13.0 | Added in: v7.10.0, v6.13.0 | + +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) Must be supplied. +* `offset` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) **Default:** `0` +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) **Default:** `buffer.length - offset` +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) The object passed as `buffer` argument. + +Synchronous version of [`crypto.randomFill()`](#crypto_crypto_randomfill_buffer_offset_size_callback). + +```None +const buf = Buffer.alloc(10); +console.log(crypto.randomFillSync(buf).toString('hex')); + +crypto.randomFillSync(buf, 5); +console.log(buf.toString('hex')); + +// The above is equivalent to the following: +crypto.randomFillSync(buf, 5, 5); +console.log(buf.toString('hex')); +``` + +Any `TypedArray` or `DataView` instance may be passed as `buffer`. + +```None +const a = new Uint32Array(10); +console.log(Buffer.from(crypto.randomFillSync(a).buffer, + a.byteOffset, a.byteLength).toString('hex')); + +const b = new Float64Array(10); +console.log(Buffer.from(crypto.randomFillSync(b).buffer, + b.byteOffset, b.byteLength).toString('hex')); + +const c = new DataView(new ArrayBuffer(10)); +console.log(Buffer.from(crypto.randomFillSync(c).buffer, + c.byteOffset, c.byteLength).toString('hex')); +``` + +### crypto.randomFill(buffer[, offset][, size], callback)[#](#crypto_crypto_randomfill_buffer_offset_size_callback) + +History + +| Version | Changes | +| --- | --- | +| v9.0.0 | The `buffer` argument may be any `TypedArray` or `DataView`. | +| v7.10.0, v6.13.0 | Added in: v7.10.0, v6.13.0 | + +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) Must be supplied. +* `offset` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) **Default:** `0` +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) **Default:** `buffer.length - offset` +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) `function(err, buf) {}`. + +This function is similar to [`crypto.randomBytes()`](#crypto_crypto_randombytes_size_callback) but requires the first +argument to be a [`Buffer`](buffer.html) that will be filled. It also +requires that a callback is passed in. + +If the `callback` function is not provided, an error will be thrown. + +```None +const buf = Buffer.alloc(10); +crypto.randomFill(buf, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); + +crypto.randomFill(buf, 5, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); + +// The above is equivalent to the following: +crypto.randomFill(buf, 5, 5, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); +``` + +Any `TypedArray` or `DataView` instance may be passed as `buffer`. + +```None +const a = new Uint32Array(10); +crypto.randomFill(a, (err, buf) => { + if (err) throw err; + console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) + .toString('hex')); +}); + +const b = new Float64Array(10); +crypto.randomFill(b, (err, buf) => { + if (err) throw err; + console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) + .toString('hex')); +}); + +const c = new DataView(new ArrayBuffer(10)); +crypto.randomFill(c, (err, buf) => { + if (err) throw err; + console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) + .toString('hex')); +}); +``` + +Note that this API uses libuv's threadpool, which can have surprising and +negative performance implications for some applications, see the +[`UV_THREADPOOL_SIZE`](cli.html#cli_uv_threadpool_size_size) documentation for more information. + +The asynchronous version of `crypto.randomFill()` is carried out in a single +threadpool request. To minimize threadpool task length variation, partition +large `randomFill` requests when doing so as part of fulfilling a client +request. + +### crypto.scrypt(password, salt, keylen[, options], callback)[#](#crypto_crypto_scrypt_password_salt_keylen_options_callback) + +History + +| Version | Changes | +| --- | --- | +| v10.9.0 | The `cost`, `blockSize` and `parallelization` option names have been added. | +| v10.5.0 | Added in: v10.5.0 | + +* `password` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `salt` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `keylen` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `cost` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) CPU/memory cost parameter. Must be a power of two greater + than one. **Default:** `16384`. + + `blockSize` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Block size parameter. **Default:** `8`. + + `parallelization` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Parallelization parameter. **Default:** `1`. + + `N` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Alias for `cost`. Only one of both may be specified. + + `r` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Alias for `blockSize`. Only one of both may be specified. + + `p` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Alias for `parallelization`. Only one of both may be specified. + + `maxmem` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Memory upper bound. It is an error when (approximately) + `128 * N * r > maxmem`. **Default:** `32 * 1024 * 1024`. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + + + `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + + `derivedKey` [](buffer.html#buffer_class_buffer) + +Provides an asynchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based +key derivation function that is designed to be expensive computationally and +memory-wise in order to make brute-force attacks unrewarding. + +The `salt` should be as unique as possible. It is recommended that a salt is +random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + +The `callback` function is called with two arguments: `err` and `derivedKey`. +`err` is an exception object when key derivation fails, otherwise `err` is +`null`. `derivedKey` is passed to the callback as a [`Buffer`](buffer.html). + +An exception is thrown when any of the input arguments specify invalid values +or types. + +```None +const crypto = require('crypto'); +// Using the factory defaults. +crypto.scrypt('secret', 'salt', 64, (err, derivedKey) => { + if (err) throw err; + console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' +}); +// Using a custom N parameter. Must be a power of two. +crypto.scrypt('secret', 'salt', 64, { N: 1024 }, (err, derivedKey) => { + if (err) throw err; + console.log(derivedKey.toString('hex')); // '3745e48...aa39b34' +}); +``` + +### crypto.scryptSync(password, salt, keylen[, options])[#](#crypto_crypto_scryptsync_password_salt_keylen_options) + +History + +| Version | Changes | +| --- | --- | +| v10.9.0 | The `cost`, `blockSize` and `parallelization` option names have been added. | +| v10.5.0 | Added in: v10.5.0 | + +* `password` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `salt` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `keylen` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `cost` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) CPU/memory cost parameter. Must be a power of two greater + than one. **Default:** `16384`. + + `blockSize` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Block size parameter. **Default:** `8`. + + `parallelization` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Parallelization parameter. **Default:** `1`. + + `N` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Alias for `cost`. Only one of both may be specified. + + `r` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Alias for `blockSize`. Only one of both may be specified. + + `p` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Alias for `parallelization`. Only one of both may be specified. + + `maxmem` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Memory upper bound. It is an error when (approximately) + `128 * N * r > maxmem`. **Default:** `32 * 1024 * 1024`. +* Returns: [](buffer.html#buffer_class_buffer) + +Provides a synchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based +key derivation function that is designed to be expensive computationally and +memory-wise in order to make brute-force attacks unrewarding. + +The `salt` should be as unique as possible. It is recommended that a salt is +random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + +An exception is thrown when key derivation fails, otherwise the derived key is +returned as a [`Buffer`](buffer.html). + +An exception is thrown when any of the input arguments specify invalid values +or types. + +```None +const crypto = require('crypto'); +// Using the factory defaults. +const key1 = crypto.scryptSync('secret', 'salt', 64); +console.log(key1.toString('hex')); // '3745e48...08d59ae' +// Using a custom N parameter. Must be a power of two. +const key2 = crypto.scryptSync('secret', 'salt', 64, { N: 1024 }); +console.log(key2.toString('hex')); // '3745e48...aa39b34' +``` + +### crypto.setEngine(engine[, flags])[#](#crypto_crypto_setengine_engine_flags) + +Added in: v0.11.11 + +* `engine` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `flags` [](crypto.html#crypto_crypto_constants_1) **Default:** `crypto.constants.ENGINE_METHOD_ALL` + +Load and set the `engine` for some or all OpenSSL functions (selected by flags). + +`engine` could be either an id or a path to the engine's shared library. + +The optional `flags` argument uses `ENGINE_METHOD_ALL` by default. The `flags` +is a bit field taking one of or a mix of the following flags (defined in +`crypto.constants`): + +* `crypto.constants.ENGINE_METHOD_RSA` +* `crypto.constants.ENGINE_METHOD_DSA` +* `crypto.constants.ENGINE_METHOD_DH` +* `crypto.constants.ENGINE_METHOD_RAND` +* `crypto.constants.ENGINE_METHOD_EC` +* `crypto.constants.ENGINE_METHOD_CIPHERS` +* `crypto.constants.ENGINE_METHOD_DIGESTS` +* `crypto.constants.ENGINE_METHOD_PKEY_METHS` +* `crypto.constants.ENGINE_METHOD_PKEY_ASN1_METHS` +* `crypto.constants.ENGINE_METHOD_ALL` +* `crypto.constants.ENGINE_METHOD_NONE` + +The flags below are deprecated in OpenSSL-1.1.0. + +* `crypto.constants.ENGINE_METHOD_ECDH` +* `crypto.constants.ENGINE_METHOD_ECDSA` +* `crypto.constants.ENGINE_METHOD_STORE` + +### crypto.setFips(bool)[#](#crypto_crypto_setfips_bool) + +Added in: v10.0.0 + +* `bool` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` to enable FIPS mode. + +Enables the FIPS compliant crypto provider in a FIPS-enabled Node.js build. +Throws an error if FIPS mode is not available. + +### crypto.timingSafeEqual(a, b)[#](#crypto_crypto_timingsafeequal_a_b) + +Added in: v6.6.0 + +* `a` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `b` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +This function is based on a constant-time algorithm. +Returns true if `a` is equal to `b`, without leaking timing information that +would allow an attacker to guess one of the values. This is suitable for +comparing HMAC digests or secret values like authentication cookies or +[capability urls](https://www.w3.org/TR/capability-urls/). + +`a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they +must have the same length. + +Use of `crypto.timingSafeEqual` does not guarantee that the *surrounding* code +is timing-safe. Care should be taken to ensure that the surrounding code does +not introduce timing vulnerabilities. + +## Notes[#](#crypto_notes) + +### Legacy Streams API (pre Node.js v0.10)[#](#crypto_legacy_streams_api_pre_node_js_v0_10) + +The Crypto module was added to Node.js before there was the concept of a +unified Stream API, and before there were [`Buffer`](buffer.html) objects for handling +binary data. As such, the many of the `crypto` defined classes have methods not +typically found on other Node.js classes that implement the [streams](stream.html) +API (e.g. `update()`, `final()`, or `digest()`). Also, many methods accepted +and returned `'latin1'` encoded strings by default rather than `Buffer`s. This +default was changed after Node.js v0.8 to use [`Buffer`](buffer.html) objects by default +instead. + +### Recent ECDH Changes[#](#crypto_recent_ecdh_changes) + +Usage of `ECDH` with non-dynamically generated key pairs has been simplified. +Now, [`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_privatekey_encoding) can be called with a preselected private key +and the associated public point (key) will be computed and stored in the object. +This allows code to only store and provide the private part of the EC key pair. +[`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_privatekey_encoding) now also validates that the private key is valid for +the selected curve. + +The [`ecdh.setPublicKey()`](#crypto_ecdh_setpublickey_publickey_encoding) method is now deprecated as its inclusion in the +API is not useful. Either a previously stored private key should be set, which +automatically generates the associated public key, or [`ecdh.generateKeys()`](#crypto_ecdh_generatekeys_encoding_format) +should be called. The main drawback of using [`ecdh.setPublicKey()`](#crypto_ecdh_setpublickey_publickey_encoding) is that +it can be used to put the ECDH key pair into an inconsistent state. + +### Support for weak or compromised algorithms[#](#crypto_support_for_weak_or_compromised_algorithms) + +The `crypto` module still supports some algorithms which are already +compromised and are not currently recommended for use. The API also allows +the use of ciphers and hashes with a small key size that are considered to be +too weak for safe use. + +Users should take full responsibility for selecting the crypto +algorithm and key size according to their security requirements. + +Based on the recommendations of [NIST SP 800-131A](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar1.pdf): + +* MD5 and SHA-1 are no longer acceptable where collision resistance is + required such as digital signatures. +* The key used with RSA, DSA, and DH algorithms is recommended to have + at least 2048 bits and that of the curve of ECDSA and ECDH at least + 224 bits, to be safe to use for several years. +* The DH groups of `modp1`, `modp2` and `modp5` have a key size + smaller than 2048 bits and are not recommended. + +See the reference for other recommendations and details. + +### CCM mode[#](#crypto_ccm_mode) + +CCM is one of the supported [AEAD algorithms](https://en.wikipedia.org/wiki/Authenticated_encryption). Applications which use this +mode must adhere to certain restrictions when using the cipher API: + +* The authentication tag length must be specified during cipher creation by + setting the `authTagLength` option and must be one of 4, 6, 8, 10, 12, 14 or + 16 bytes. +* The length of the initialization vector (nonce) `N` must be between 7 and 13 + bytes (`7 ≤ N ≤ 13`). +* The length of the plaintext is limited to `2 ** (8 * (15 - N))` bytes. +* When decrypting, the authentication tag must be set via `setAuthTag()` before + specifying additional authenticated data or calling `update()`. + Otherwise, decryption will fail and `final()` will throw an error in + compliance with section 2.6 of [RFC 3610](https://www.rfc-editor.org/rfc/rfc3610.txt). +* Using stream methods such as `write(data)`, `end(data)` or `pipe()` in CCM + mode might fail as CCM cannot handle more than one chunk of data per instance. +* When passing additional authenticated data (AAD), the length of the actual + message in bytes must be passed to `setAAD()` via the `plaintextLength` + option. This is not necessary if no AAD is used. +* As CCM processes the whole message at once, `update()` can only be called + once. +* Even though calling `update()` is sufficient to encrypt/decrypt the message, + applications *must* call `final()` to compute or verify the + authentication tag. + +```None +const crypto = require('crypto'); + +const key = 'keykeykeykeykeykeykeykey'; +const nonce = crypto.randomBytes(12); + +const aad = Buffer.from('0123456789', 'hex'); + +const cipher = crypto.createCipheriv('aes-192-ccm', key, nonce, { + authTagLength: 16 +}); +const plaintext = 'Hello world'; +cipher.setAAD(aad, { + plaintextLength: Buffer.byteLength(plaintext) +}); +const ciphertext = cipher.update(plaintext, 'utf8'); +cipher.final(); +const tag = cipher.getAuthTag(); + +// Now transmit { ciphertext, nonce, tag }. + +const decipher = crypto.createDecipheriv('aes-192-ccm', key, nonce, { + authTagLength: 16 +}); +decipher.setAuthTag(tag); +decipher.setAAD(aad, { + plaintextLength: ciphertext.length +}); +const receivedPlaintext = decipher.update(ciphertext, null, 'utf8'); + +try { + decipher.final(); +} catch (err) { + console.error('Authentication failed!'); +} + +console.log(receivedPlaintext); +``` + +## Crypto Constants[#](#crypto_crypto_constants_1) + +The following constants exported by `crypto.constants` apply to various uses of +the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL. + +### OpenSSL Options[#](#crypto_openssl_options) + +| Constant | Description | +| --- | --- | +| `SSL_OP_ALL` | Applies multiple bug workarounds within OpenSSL. See for detail. | +| `SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION` | Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See . | +| `SSL_OP_CIPHER_SERVER_PREFERENCE` | Attempts to use the server's preferences instead of the client's when selecting a cipher. Behavior depends on protocol version. See . | +| `SSL_OP_CISCO_ANYCONNECT` | Instructs OpenSSL to use Cisco's "speshul" version of DTLS\_BAD\_VER. | +| `SSL_OP_COOKIE_EXCHANGE` | Instructs OpenSSL to turn on cookie exchange. | +| `SSL_OP_CRYPTOPRO_TLSEXT_BUG` | Instructs OpenSSL to add server-hello extension from an early version of the cryptopro draft. | +| `SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS` | Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. | +| `SSL_OP_EPHEMERAL_RSA` | Instructs OpenSSL to always use the tmp\_rsa key when performing RSA operations. | +| `SSL_OP_LEGACY_SERVER_CONNECT` | Allows initial connection to servers that do not support RI. | +| `SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER` | | +| `SSL_OP_MICROSOFT_SESS_ID_BUG` | | +| `SSL_OP_MSIE_SSLV2_RSA_PADDING` | Instructs OpenSSL to disable the workaround for a man-in-the-middle protocol-version vulnerability in the SSL 2.0 server implementation. | +| `SSL_OP_NETSCAPE_CA_DN_BUG` | | +| `SSL_OP_NETSCAPE_CHALLENGE_BUG` | | +| `SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG` | | +| `SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG` | | +| `SSL_OP_NO_COMPRESSION` | Instructs OpenSSL to disable support for SSL/TLS compression. | +| `SSL_OP_NO_QUERY_MTU` | | +| `SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION` | Instructs OpenSSL to always start a new session when performing renegotiation. | +| `SSL_OP_NO_SSLv2` | Instructs OpenSSL to turn off SSL v2 | +| `SSL_OP_NO_SSLv3` | Instructs OpenSSL to turn off SSL v3 | +| `SSL_OP_NO_TICKET` | Instructs OpenSSL to disable use of RFC4507bis tickets. | +| `SSL_OP_NO_TLSv1` | Instructs OpenSSL to turn off TLS v1 | +| `SSL_OP_NO_TLSv1_1` | Instructs OpenSSL to turn off TLS v1.1 | +| `SSL_OP_NO_TLSv1_2` | Instructs OpenSSL to turn off TLS v1.2 | +| `SSL_OP_PKCS1_CHECK_1` | | +| `SSL_OP_PKCS1_CHECK_2` | | +| `SSL_OP_SINGLE_DH_USE` | Instructs OpenSSL to always create a new key when using temporary/ephemeral DH parameters. | +| `SSL_OP_SINGLE_ECDH_USE` | Instructs OpenSSL to always create a new key when using temporary/ephemeral ECDH parameters. | +| `SSL_OP_SSLEAY_080_CLIENT_DH_BUG` | | +| `SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG` | | +| `SSL_OP_TLS_BLOCK_PADDING_BUG` | | +| `SSL_OP_TLS_D5_BUG` | | +| `SSL_OP_TLS_ROLLBACK_BUG` | Instructs OpenSSL to disable version rollback attack detection. | + +### OpenSSL Engine Constants[#](#crypto_openssl_engine_constants) + +| Constant | Description | +| --- | --- | +| `ENGINE_METHOD_RSA` | Limit engine usage to RSA | +| `ENGINE_METHOD_DSA` | Limit engine usage to DSA | +| `ENGINE_METHOD_DH` | Limit engine usage to DH | +| `ENGINE_METHOD_RAND` | Limit engine usage to RAND | +| `ENGINE_METHOD_EC` | Limit engine usage to EC | +| `ENGINE_METHOD_CIPHERS` | Limit engine usage to CIPHERS | +| `ENGINE_METHOD_DIGESTS` | Limit engine usage to DIGESTS | +| `ENGINE_METHOD_PKEY_METHS` | Limit engine usage to PKEY\_METHDS | +| `ENGINE_METHOD_PKEY_ASN1_METHS` | Limit engine usage to PKEY\_ASN1\_METHS | +| `ENGINE_METHOD_ALL` | | +| `ENGINE_METHOD_NONE` | | + +### Other OpenSSL Constants[#](#crypto_other_openssl_constants) + +| Constant | Description | +| --- | --- | +| `DH_CHECK_P_NOT_SAFE_PRIME` | | +| `DH_CHECK_P_NOT_PRIME` | | +| `DH_UNABLE_TO_CHECK_GENERATOR` | | +| `DH_NOT_SUITABLE_GENERATOR` | | +| `ALPN_ENABLED` | | +| `RSA_PKCS1_PADDING` | | +| `RSA_SSLV23_PADDING` | | +| `RSA_NO_PADDING` | | +| `RSA_PKCS1_OAEP_PADDING` | | +| `RSA_X931_PADDING` | | +| `RSA_PKCS1_PSS_PADDING` | | +| `RSA_PSS_SALTLEN_DIGEST` | Sets the salt length for `RSA_PKCS1_PSS_PADDING` to the digest size when signing or verifying. | +| `RSA_PSS_SALTLEN_MAX_SIGN` | Sets the salt length for `RSA_PKCS1_PSS_PADDING` to the maximum permissible value when signing data. | +| `RSA_PSS_SALTLEN_AUTO` | Causes the salt length for `RSA_PKCS1_PSS_PADDING` to be determined automatically when verifying a signature. | +| `POINT_CONVERSION_COMPRESSED` | | +| `POINT_CONVERSION_UNCOMPRESSED` | | +| `POINT_CONVERSION_HYBRID` | | + +### Node.js Crypto Constants[#](#crypto_node_js_crypto_constants) + +| Constant | Description | +| --- | --- | +| `defaultCoreCipherList` | Specifies the built-in default cipher list used by Node.js. | +| `defaultCipherList` | Specifies the active default cipher list used by the current Node.js process. | diff --git a/corpus/docs/nodejs/crypto/crypto_4x.md b/corpus/docs/nodejs/crypto/crypto_4x.md new file mode 100644 index 0000000000000000000000000000000000000000..9edecd6f3c881f46200512fbe41619ad8b783c6a --- /dev/null +++ b/corpus/docs/nodejs/crypto/crypto_4x.md @@ -0,0 +1,1512 @@ +# Crypto# + +Source: https://nodejs.org/docs/latest-v4.x/api/crypto.html +Version: 4.x + +```None +Stability: 2 - Stable +``` + +The `crypto` module provides cryptographic functionality that includes a set of +wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign and verify functions. + +Use `require('crypto')` to access this module. + +```None +const crypto = require('crypto'); + +const secret = 'abcdefg'; +const hash = crypto.createHmac('sha256', secret) + .update('I love cupcakes') + .digest('hex'); +console.log(hash); + // Prints: + // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e +``` + +## Class: Certificate[#](#crypto_class_certificate) + +Added in: v0.11.8 + +SPKAC is a Certificate Signing Request mechanism originally implemented by +Netscape and now specified formally as part of [HTML5's `keygen` element](http://www.w3.org/TR/html5/forms.html#the-keygen-element). + +The `crypto` module provides the `Certificate` class for working with SPKAC +data. The most common usage is handling output generated by the HTML5 +`` element. Node.js uses [OpenSSL's SPKAC implementation](https://www.openssl.org/docs/man1.0.2/apps/spkac.html) internally. + +### new crypto.Certificate()[#](#crypto_new_crypto_certificate) + +Instances of the `Certificate` class can be created using the `new` keyword +or by calling `crypto.Certificate()` as a function: + +```None +const crypto = require('crypto'); + +const cert1 = new crypto.Certificate(); +const cert2 = crypto.Certificate(); +``` + +### certificate.exportChallenge(spkac)[#](#crypto_certificate_exportchallenge_spkac) + +Added in: v0.11.8 + +The `spkac` data structure includes a public key and a challenge. The +`certificate.exportChallenge()` returns the challenge component in the +form of a Node.js [`Buffer`](buffer.html). The `spkac` argument can be either a string +or a [`Buffer`](buffer.html). + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +const challenge = cert.exportChallenge(spkac); +console.log(challenge.toString('utf8')); + // Prints the challenge as a UTF8 string +``` + +### certificate.exportPublicKey(spkac)[#](#crypto_certificate_exportpublickey_spkac) + +Added in: v0.11.8 + +The `spkac` data structure includes a public key and a challenge. The +`certificate.exportPublicKey()` returns the public key component in the +form of a Node.js [`Buffer`](buffer.html). The `spkac` argument can be either a string +or a [`Buffer`](buffer.html). + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +const publicKey = cert.exportPublicKey(spkac); +console.log(publicKey); + // Prints the public key as +``` + +### certificate.verifySpkac(spkac)[#](#crypto_certificate_verifyspkac_spkac) + +Added in: v0.11.8 + +Returns `true` if the given `spkac` data structure is valid, `false` otherwise. +The `spkac` argument must be a Node.js [`Buffer`](buffer.html). + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +console.log(cert.verifySpkac(new Buffer(spkac))); + // Prints true or false +``` + +## Class: Cipher[#](#crypto_class_cipher) + +Added in: v0.1.94 + +Instances of the `Cipher` class are used to encrypt data. The class can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where plain unencrypted + data is written to produce encrypted data on the readable side, or +* Using the [`cipher.update()`](#crypto_cipher_update_data_input_encoding_output_encoding) and [`cipher.final()`](#crypto_cipher_final_output_encoding) methods to produce + the encrypted data. + +The [`crypto.createCipher()`](#crypto_crypto_createcipher_algorithm_password) or [`crypto.createCipheriv()`](#crypto_crypto_createcipheriv_algorithm_key_iv) methods are +used to create `Cipher` instances. `Cipher` objects are not to be created +directly using the `new` keyword. + +Example: Using `Cipher` objects as streams: + +```None +const crypto = require('crypto'); +const cipher = crypto.createCipher('aes192', 'a password'); + +var encrypted = ''; +cipher.on('readable', () => { + var data = cipher.read(); + if (data) + encrypted += data.toString('hex'); +}); +cipher.on('end', () => { + console.log(encrypted); + // Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 +}); + +cipher.write('some clear text data'); +cipher.end(); +``` + +Example: Using `Cipher` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const cipher = crypto.createCipher('aes192', 'a password'); + +const input = fs.createReadStream('test.js'); +const output = fs.createWriteStream('test.enc'); + +input.pipe(cipher).pipe(output); +``` + +Example: Using the [`cipher.update()`](#crypto_cipher_update_data_input_encoding_output_encoding) and [`cipher.final()`](#crypto_cipher_final_output_encoding) methods: + +```None +const crypto = require('crypto'); +const cipher = crypto.createCipher('aes192', 'a password'); + +var encrypted = cipher.update('some clear text data', 'utf8', 'hex'); +encrypted += cipher.final('hex'); +console.log(encrypted); + // Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 +``` + +### cipher.final([output\_encoding])[#](#crypto_cipher_final_output_encoding) + +Added in: v0.1.94 + +Returns any remaining enciphered contents. If `output_encoding` +parameter is one of `'binary'`, `'base64'` or `'hex'`, a string is returned. +If an `output_encoding` is not provided, a [`Buffer`](buffer.html) is returned. + +Once the `cipher.final()` method has been called, the `Cipher` object can no +longer be used to encrypt data. Attempts to call `cipher.final()` more than +once will result in an error being thrown. + +### cipher.setAAD(buffer)[#](#crypto_cipher_setaad_buffer) + +Added in: v1.0.0 + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `cipher.setAAD()` method sets the value used for the +*additional authenticated data* (AAD) input parameter. + +### cipher.getAuthTag()[#](#crypto_cipher_getauthtag) + +Added in: v1.0.0 + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `cipher.getAuthTag()` method returns a [`Buffer`](buffer.html) containing +the *authentication tag* that has been computed from the given data. + +The `cipher.getAuthTag()` method should only be called after encryption has +been completed using the [`cipher.final()`](#crypto_cipher_final_output_encoding) method. + +### cipher.setAutoPadding(auto\_padding=true)[#](#crypto_cipher_setautopadding_auto_padding_true) + +Added in: v0.7.1 + +When using block encryption algorithms, the `Cipher` class will automatically +add padding to the input data to the appropriate block size. To disable the +default padding call `cipher.setAutoPadding(false)`. + +When `auto_padding` is `false`, the length of the entire input data must be a +multiple of the cipher's block size or [`cipher.final()`](#crypto_cipher_final_output_encoding) will throw an Error. +Disabling automatic padding is useful for non-standard padding, for instance +using `0x0` instead of PKCS padding. + +The `cipher.setAutoPadding()` method must be called before [`cipher.final()`](#crypto_cipher_final_output_encoding). + +### cipher.update(data[, input\_encoding][, output\_encoding])[#](#crypto_cipher_update_data_input_encoding_output_encoding) + +Added in: v0.1.94 + +Updates the cipher with `data`. If the `input_encoding` argument is given, +it's value must be one of `'utf8'`, `'ascii'`, or `'binary'` and the `data` +argument is a string using the specified encoding. If the `input_encoding` +argument is not given, `data` must be a [`Buffer`](buffer.html). If `data` is a +[`Buffer`](buffer.html) then `input_encoding` is ignored. + +The `output_encoding` specifies the output format of the enciphered +data, and can be `'binary'`, `'base64'` or `'hex'`. If the `output_encoding` +is specified, a string using the specified encoding is returned. If no +`output_encoding` is provided, a [`Buffer`](buffer.html) is returned. + +The `cipher.update()` method can be called multiple times with new data until +[`cipher.final()`](#crypto_cipher_final_output_encoding) is called. Calling `cipher.update()` after +[`cipher.final()`](#crypto_cipher_final_output_encoding) will result in an error being thrown. + +## Class: Decipher[#](#crypto_class_decipher) + +Added in: v0.1.94 + +Instances of the `Decipher` class are used to decrypt data. The class can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where plain encrypted + data is written to produce unencrypted data on the readable side, or +* Using the [`decipher.update()`](#crypto_decipher_update_data_input_encoding_output_encoding) and [`decipher.final()`](#crypto_decipher_final_output_encoding) methods to + produce the unencrypted data. + +The [`crypto.createDecipher()`](#crypto_crypto_createdecipher_algorithm_password) or [`crypto.createDecipheriv()`](#crypto_crypto_createdecipheriv_algorithm_key_iv) methods are +used to create `Decipher` instances. `Decipher` objects are not to be created +directly using the `new` keyword. + +Example: Using `Decipher` objects as streams: + +```None +const crypto = require('crypto'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +var decrypted = ''; +decipher.on('readable', () => { + var data = decipher.read(); + if (data) + decrypted += data.toString('utf8'); +}); +decipher.on('end', () => { + console.log(decrypted); + // Prints: some clear text data +}); + +var encrypted = 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; +decipher.write(encrypted, 'hex'); +decipher.end(); +``` + +Example: Using `Decipher` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +const input = fs.createReadStream('test.enc'); +const output = fs.createWriteStream('test.js'); + +input.pipe(decipher).pipe(output); +``` + +Example: Using the [`decipher.update()`](#crypto_decipher_update_data_input_encoding_output_encoding) and [`decipher.final()`](#crypto_decipher_final_output_encoding) methods: + +```None +const crypto = require('crypto'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +var encrypted = 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; +var decrypted = decipher.update(encrypted, 'hex', 'utf8'); +decrypted += decipher.final('utf8'); +console.log(decrypted); + // Prints: some clear text data +``` + +### decipher.final([output\_encoding])[#](#crypto_decipher_final_output_encoding) + +Added in: v0.1.94 + +Returns any remaining deciphered contents. If `output_encoding` +parameter is one of `'binary'`, `'base64'` or `'hex'`, a string is returned. +If an `output_encoding` is not provided, a [`Buffer`](buffer.html) is returned. + +Once the `decipher.final()` method has been called, the `Decipher` object can +no longer be used to decrypt data. Attempts to call `decipher.final()` more +than once will result in an error being thrown. + +### decipher.setAAD(buffer)[#](#crypto_decipher_setaad_buffer) + +Added in: v1.0.0 + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `decipher.setAAD()` method sets the value used for the +*additional authenticated data* (AAD) input parameter. + +### decipher.setAuthTag(buffer)[#](#crypto_decipher_setauthtag_buffer) + +Added in: v1.0.0 + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `decipher.setAuthTag()` method is used to pass in the +received *authentication tag*. If no tag is provided, or if the cipher text +has been tampered with, [`decipher.final()`](#crypto_decipher_final_output_encoding) with throw, indicating that the +cipher text should be discarded due to failed authentication. + +### decipher.setAutoPadding(auto\_padding=true)[#](#crypto_decipher_setautopadding_auto_padding_true) + +Added in: v0.7.1 + +When data has been encrypted without standard block padding, calling +`decipher.setAutoPadding(false)` will disable automatic padding to prevent +[`decipher.final()`](#crypto_decipher_final_output_encoding) from checking for and removing padding. + +Turning auto padding off will only work if the input data's length is a +multiple of the ciphers block size. + +The `decipher.setAutoPadding()` method must be called before +[`decipher.update()`](#crypto_decipher_update_data_input_encoding_output_encoding). + +### decipher.update(data[, input\_encoding][, output\_encoding])[#](#crypto_decipher_update_data_input_encoding_output_encoding) + +Added in: v0.1.94 + +Updates the decipher with `data`. If the `input_encoding` argument is given, +it's value must be one of `'binary'`, `'base64'`, or `'hex'` and the `data` +argument is a string using the specified encoding. If the `input_encoding` +argument is not given, `data` must be a [`Buffer`](buffer.html). If `data` is a +[`Buffer`](buffer.html) then `input_encoding` is ignored. + +The `output_encoding` specifies the output format of the enciphered +data, and can be `'binary'`, `'ascii'` or `'utf8'`. If the `output_encoding` +is specified, a string using the specified encoding is returned. If no +`output_encoding` is provided, a [`Buffer`](buffer.html) is returned. + +The `decipher.update()` method can be called multiple times with new data until +[`decipher.final()`](#crypto_decipher_final_output_encoding) is called. Calling `decipher.update()` after +[`decipher.final()`](#crypto_decipher_final_output_encoding) will result in an error being thrown. + +## Class: DiffieHellman[#](#crypto_class_diffiehellman) + +Added in: v0.5.0 + +The `DiffieHellman` class is a utility for creating Diffie-Hellman key +exchanges. + +Instances of the `DiffieHellman` class can be created using the +[`crypto.createDiffieHellman()`](#crypto_crypto_creatediffiehellman_prime_prime_encoding_generator_generator_encoding) function. + +```None +const crypto = require('crypto'); +const assert = require('assert'); + +// Generate Alice's keys... +const alice = crypto.createDiffieHellman(2048); +const alice_key = alice.generateKeys(); + +// Generate Bob's keys... +const bob = crypto.createDiffieHellman(alice.getPrime(), alice.getGenerator()); +const bob_key = bob.generateKeys(); + +// Exchange and generate the secret... +const alice_secret = alice.computeSecret(bob_key); +const bob_secret = bob.computeSecret(alice_key); + +// OK +assert.equal(alice_secret.toString('hex'), bob_secret.toString('hex')); +``` + +### diffieHellman.computeSecret(other\_public\_key[, input\_encoding][, output\_encoding])[#](#crypto_diffiehellman_computesecret_other_public_key_input_encoding_output_encoding) + +Added in: v0.5.0 + +Computes the shared secret using `other_public_key` as the other +party's public key and returns the computed shared secret. The supplied +key is interpreted using the specified `input_encoding`, and secret is +encoded using specified `output_encoding`. Encodings can be +`'binary'`, `'hex'`, or `'base64'`. If the `input_encoding` is not +provided, `other_public_key` is expected to be a [`Buffer`](buffer.html). + +If `output_encoding` is given a string is returned; otherwise, a +[`Buffer`](buffer.html) is returned. + +### diffieHellman.generateKeys([encoding])[#](#crypto_diffiehellman_generatekeys_encoding) + +Added in: v0.5.0 + +Generates private and public Diffie-Hellman key values, and returns +the public key in the specified `encoding`. This key should be +transferred to the other party. Encoding can be `'binary'`, `'hex'`, +or `'base64'`. If `encoding` is provided a string is returned; otherwise a +[`Buffer`](buffer.html) is returned. + +### diffieHellman.getGenerator([encoding])[#](#crypto_diffiehellman_getgenerator_encoding) + +Added in: v0.5.0 + +Returns the Diffie-Hellman generator in the specified `encoding`, which can +be `'binary'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is +returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPrime([encoding])[#](#crypto_diffiehellman_getprime_encoding) + +Added in: v0.5.0 + +Returns the Diffie-Hellman prime in the specified `encoding`, which can +be `'binary'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is +returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPrivateKey([encoding])[#](#crypto_diffiehellman_getprivatekey_encoding) + +Added in: v0.5.0 + +Returns the Diffie-Hellman private key in the specified `encoding`, +which can be `'binary'`, `'hex'`, or `'base64'`. If `encoding` is provided a +string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPublicKey([encoding])[#](#crypto_diffiehellman_getpublickey_encoding) + +Added in: v0.5.0 + +Returns the Diffie-Hellman public key in the specified `encoding`, which +can be `'binary'`, `'hex'`, or `'base64'`. If `encoding` is provided a +string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.setPrivateKey(private\_key[, encoding])[#](#crypto_diffiehellman_setprivatekey_private_key_encoding) + +Added in: v0.5.0 + +Sets the Diffie-Hellman private key. If the `encoding` argument is provided +and is either `'binary'`, `'hex'`, or `'base64'`, `private_key` is expected +to be a string. If no `encoding` is provided, `private_key` is expected +to be a [`Buffer`](buffer.html). + +### diffieHellman.setPublicKey(public\_key[, encoding])[#](#crypto_diffiehellman_setpublickey_public_key_encoding) + +Added in: v0.5.0 + +Sets the Diffie-Hellman public key. If the `encoding` argument is provided +and is either `'binary'`, `'hex'` or `'base64'`, `public_key` is expected +to be a string. If no `encoding` is provided, `public_key` is expected +to be a [`Buffer`](buffer.html). + +### diffieHellman.verifyError[#](#crypto_diffiehellman_verifyerror) + +Added in: v0.11.12 + +A bit field containing any warnings and/or errors resulting from a check +performed during initialization of the `DiffieHellman` object. + +The following values are valid for this property (as defined in `constants` +module): + +* `DH_CHECK_P_NOT_SAFE_PRIME` +* `DH_CHECK_P_NOT_PRIME` +* `DH_UNABLE_TO_CHECK_GENERATOR` +* `DH_NOT_SUITABLE_GENERATOR` + +## Class: ECDH[#](#crypto_class_ecdh) + +Added in: v0.11.14 + +The `ECDH` class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH) +key exchanges. + +Instances of the `ECDH` class can be created using the +[`crypto.createECDH()`](#crypto_crypto_createecdh_curve_name) function. + +```None +const crypto = require('crypto'); +const assert = require('assert'); + +// Generate Alice's keys... +const alice = crypto.createECDH('secp521r1'); +const alice_key = alice.generateKeys(); + +// Generate Bob's keys... +const bob = crypto.createECDH('secp521r1'); +const bob_key = bob.generateKeys(); + +// Exchange and generate the secret... +const alice_secret = alice.computeSecret(bob_key); +const bob_secret = bob.computeSecret(alice_key); + +assert(alice_secret, bob_secret); + // OK +``` + +### ecdh.computeSecret(other\_public\_key[, input\_encoding][, output\_encoding])[#](#crypto_ecdh_computesecret_other_public_key_input_encoding_output_encoding) + +Added in: v0.11.14 + +Computes the shared secret using `other_public_key` as the other +party's public key and returns the computed shared secret. The supplied +key is interpreted using specified `input_encoding`, and the returned secret +is encoded using the specified `output_encoding`. Encodings can be +`'binary'`, `'hex'`, or `'base64'`. If the `input_encoding` is not +provided, `other_public_key` is expected to be a [`Buffer`](buffer.html). + +If `output_encoding` is given a string will be returned; otherwise a +[`Buffer`](buffer.html) is returned. + +### ecdh.generateKeys([encoding[, format]])[#](#crypto_ecdh_generatekeys_encoding_format) + +Added in: v0.11.14 + +Generates private and public EC Diffie-Hellman key values, and returns +the public key in the specified `format` and `encoding`. This key should be +transferred to the other party. + +The `format` arguments specifies point encoding and can be `'compressed'`, +`'uncompressed'`, or `'hybrid'`. If `format` is not specified, the point will +be returned in `'uncompressed'` format. + +The `encoding` argument can be `'binary'`, `'hex'`, or `'base64'`. If +`encoding` is provided a string is returned; otherwise a [`Buffer`](buffer.html) +is returned. + +### ecdh.getPrivateKey([encoding])[#](#crypto_ecdh_getprivatekey_encoding) + +Added in: v0.11.14 + +Returns the EC Diffie-Hellman private key in the specified `encoding`, +which can be `'binary'`, `'hex'`, or `'base64'`. If `encoding` is provided +a string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### ecdh.getPublicKey([encoding[, format]])[#](#crypto_ecdh_getpublickey_encoding_format) + +Added in: v0.11.14 + +Returns the EC Diffie-Hellman public key in the specified `encoding` and +`format`. + +The `format` argument specifies point encoding and can be `'compressed'`, +`'uncompressed'`, or `'hybrid'`. If `format` is not specified the point will be +returned in `'uncompressed'` format. + +The `encoding` argument can be `'binary'`, `'hex'`, or `'base64'`. If +`encoding` is specified, a string is returned; otherwise a [`Buffer`](buffer.html) is +returned. + +### ecdh.setPrivateKey(private\_key[, encoding])[#](#crypto_ecdh_setprivatekey_private_key_encoding) + +Added in: v0.11.14 + +Sets the EC Diffie-Hellman private key. The `encoding` can be `'binary'`, +`'hex'` or `'base64'`. If `encoding` is provided, `private_key` is expected +to be a string; otherwise `private_key` is expected to be a [`Buffer`](buffer.html). If +`private_key` is not valid for the curve specified when the `ECDH` object was +created, an error is thrown. Upon setting the private key, the associated +public point (key) is also generated and set in the ECDH object. + +### ecdh.setPublicKey(public\_key[, encoding])[#](#crypto_ecdh_setpublickey_public_key_encoding) + +Added in: v0.11.14 +Deprecated since: v5.2.0 + +```None +Stability: 0 - Deprecated +``` + +Sets the EC Diffie-Hellman public key. Key encoding can be `'binary'`, +`'hex'` or `'base64'`. If `encoding` is provided `public_key` is expected to +be a string; otherwise a [`Buffer`](buffer.html) is expected. + +Note that there is not normally a reason to call this method because `ECDH` +only requires a private key and the other party's public key to compute the +shared secret. Typically either [`ecdh.generateKeys()`](#crypto_ecdh_generatekeys_encoding_format) or +[`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_private_key_encoding) will be called. The [`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_private_key_encoding) method +attempts to generate the public point/key associated with the private key being +set. + +Example (obtaining a shared secret): + +```None +const crypto = require('crypto'); +const alice = crypto.createECDH('secp256k1'); +const bob = crypto.createECDH('secp256k1'); + +// Note: This is a shortcut way to specify one of Alice's previous private +// keys. It would be unwise to use such a predictable private key in a real +// application. +alice.setPrivateKey( + crypto.createHash('sha256').update('alice', 'utf8').digest() +); + +// Bob uses a newly generated cryptographically strong +// pseudorandom key pair bob.generateKeys(); + +const alice_secret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +const bob_secret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +// alice_secret and bob_secret should be the same shared secret value +console.log(alice_secret === bob_secret); +``` + +## Class: Hash[#](#crypto_class_hash) + +Added in: v0.1.92 + +The `Hash` class is a utility for creating hash digests of data. It can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where data is written + to produce a computed hash digest on the readable side, or +* Using the [`hash.update()`](#crypto_hash_update_data_input_encoding) and [`hash.digest()`](#crypto_hash_digest_encoding) methods to produce the + computed hash. + +The [`crypto.createHash()`](#crypto_crypto_createhash_algorithm) method is used to create `Hash` instances. `Hash` +objects are not to be created directly using the `new` keyword. + +Example: Using `Hash` objects as streams: + +```None +const crypto = require('crypto'); +const hash = crypto.createHash('sha256'); + +hash.on('readable', () => { + var data = hash.read(); + if (data) + console.log(data.toString('hex')); + // Prints: + // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 +}); + +hash.write('some data to hash'); +hash.end(); +``` + +Example: Using `Hash` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const hash = crypto.createHash('sha256'); + +const input = fs.createReadStream('test.js'); +input.pipe(hash).pipe(process.stdout); +``` + +Example: Using the [`hash.update()`](#crypto_hash_update_data_input_encoding) and [`hash.digest()`](#crypto_hash_digest_encoding) methods: + +```None +const crypto = require('crypto'); +const hash = crypto.createHash('sha256'); + +hash.update('some data to hash'); +console.log(hash.digest('hex')); + // Prints: + // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 +``` + +### hash.digest([encoding])[#](#crypto_hash_digest_encoding) + +Added in: v0.1.92 + +Calculates the digest of all of the data passed to be hashed (using the +[`hash.update()`](#crypto_hash_update_data_input_encoding) method). The `encoding` can be `'hex'`, `'binary'` or +`'base64'`. If `encoding` is provided a string will be returned; otherwise +a [`Buffer`](buffer.html) is returned. + +The `Hash` object can not be used again after `hash.digest()` method has been +called. Multiple calls will cause an error to be thrown. + +### hash.update(data[, input\_encoding])[#](#crypto_hash_update_data_input_encoding) + +Added in: v0.1.92 + +Updates the hash content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'binary'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'binary'` is enforced. If `data` is a [`Buffer`](buffer.html) then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Hmac[#](#crypto_class_hmac) + +Added in: v0.1.94 + +The `Hmac` Class is a utility for creating cryptographic HMAC digests. It can +be used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where data is written + to produce a computed HMAC digest on the readable side, or +* Using the [`hmac.update()`](#crypto_hmac_update_data) and [`hmac.digest()`](#crypto_hmac_digest_encoding) methods to produce the + computed HMAC digest. + +The [`crypto.createHmac()`](#crypto_crypto_createhmac_algorithm_key) method is used to create `Hmac` instances. `Hmac` +objects are not to be created directly using the `new` keyword. + +Example: Using `Hmac` objects as streams: + +```None +const crypto = require('crypto'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +hmac.on('readable', () => { + var data = hmac.read(); + if (data) + console.log(data.toString('hex')); + // Prints: + // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e +}); + +hmac.write('some data to hash'); +hmac.end(); +``` + +Example: Using `Hmac` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +const input = fs.createReadStream('test.js'); +input.pipe(hmac).pipe(process.stdout); +``` + +Example: Using the [`hmac.update()`](#crypto_hmac_update_data) and [`hmac.digest()`](#crypto_hmac_digest_encoding) methods: + +```None +const crypto = require('crypto'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +hmac.update('some data to hash'); +console.log(hmac.digest('hex')); + // Prints: + // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e +``` + +### hmac.digest([encoding])[#](#crypto_hmac_digest_encoding) + +Added in: v0.1.94 + +Calculates the HMAC digest of all of the data passed using [`hmac.update()`](#crypto_hmac_update_data). +The `encoding` can be `'hex'`, `'binary'` or `'base64'`. If `encoding` is +provided a string is returned; otherwise a [`Buffer`](buffer.html) is returned; + +The `Hmac` object can not be used again after `hmac.digest()` has been +called. Multiple calls to `hmac.digest()` will result in an error being thrown. + +### hmac.update(data[, input\_encoding])[#](#crypto_hmac_update_data_input_encoding) + +Added in: v0.1.94 + +Updates the `Hmac` content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'binary'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html) then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Sign[#](#crypto_class_sign) + +Added in: v0.1.92 + +The `Sign` Class is a utility for generating signatures. It can be used in one +of two ways: + +* As a writable [stream](stream.html), where data to be signed is written and the + [`sign.sign()`](#crypto_sign_sign_private_key_output_format) method is used to generate and return the signature, or +* Using the [`sign.update()`](#crypto_sign_update_data) and [`sign.sign()`](#crypto_sign_sign_private_key_output_format) methods to produce the + signature. + +The [`crypto.createSign()`](#crypto_crypto_createsign_algorithm) method is used to create `Sign` instances. `Sign` +objects are not to be created directly using the `new` keyword. + +Example: Using `Sign` objects as streams: + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('RSA-SHA256'); + +sign.write('some data to sign'); +sign.end(); + +const private_key = getPrivateKeySomehow(); +console.log(sign.sign(private_key, 'hex')); + // Prints the calculated signature +``` + +Example: Using the [`sign.update()`](#crypto_sign_update_data) and [`sign.sign()`](#crypto_sign_sign_private_key_output_format) methods: + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('RSA-SHA256'); + +sign.update('some data to sign'); + +const private_key = getPrivateKeySomehow(); +console.log(sign.sign(private_key, 'hex')); + // Prints the calculated signature +``` + +A `Sign` instance can also be created by just passing in the digest +algorithm name, in which case OpenSSL will infer the full signature algorithm +from the type of the PEM-formatted private key, including algorithms that +do not have directly exposed name constants, e.g. 'ecdsa-with-SHA256'. + +Example: signing using ECDSA with SHA256 + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('sha256'); + +sign.update('some data to sign'); + +const private_key = '-----BEGIN EC PRIVATE KEY-----\n' + + 'MHcCAQEEIF+jnWY1D5kbVYDNvxxo/Y+ku2uJPDwS0r/VuPZQrjjVoAoGCCqGSM49\n' + + 'AwEHoUQDQgAEurOxfSxmqIRYzJVagdZfMMSjRNNhB8i3mXyIMq704m2m52FdfKZ2\n' + + 'pQhByd5eyj3lgZ7m7jbchtdgyOF8Io/1ng==\n' + + '-----END EC PRIVATE KEY-----\n'; + +console.log(sign.sign(private_key).toString('hex')); +``` + +### sign.sign(private\_key[, output\_format])[#](#crypto_sign_sign_private_key_output_format) + +Added in: v0.1.92 + +Calculates the signature on all the data passed through using either +[`sign.update()`](#crypto_sign_update_data) or [`sign.write()`](stream.html#stream_writable_write_chunk_encoding_callback). + +The `private_key` argument can be an object or a string. If `private_key` is a +string, it is treated as a raw key with no passphrase. If `private_key` is an +object, it is interpreted as a hash containing two properties: + +* `key` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded private key +* `passphrase` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - passphrase for the private key + +The `output_format` can specify one of `'binary'`, `'hex'` or `'base64'`. If +`output_format` is provided a string is returned; otherwise a [`Buffer`](buffer.html) is +returned. + +The `Sign` object can not be again used after `sign.sign()` method has been +called. Multiple calls to `sign.sign()` will result in an error being thrown. + +### sign.update(data[, input\_encoding])[#](#crypto_sign_update_data_input_encoding) + +Added in: v0.1.92 + +Updates the `Sign` content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'binary'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html) then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Verify[#](#crypto_class_verify) + +Added in: v0.1.92 + +The `Verify` class is a utility for verifying signatures. It can be used in one +of two ways: + +* As a writable [stream](stream.html) where written data is used to validate against the + supplied signature, or +* Using the [`verify.update()`](#crypto_verifier_update_data) and [`verify.verify()`](#crypto_verifier_verify_object_signature_signature_format) methods to verify + the signature. + +The [`crypto.createVerify()`][] method is used to create `Verify` instances. +`Verify` objects are not to be created directly using the `new` keyword. + +Example: Using `Verify` objects as streams: + +```None +const crypto = require('crypto'); +const verify = crypto.createVerify('RSA-SHA256'); + +verify.write('some data to sign'); +verify.end(); + +const public_key = getPublicKeySomehow(); +const signature = getSignatureToVerify(); +console.log(verify.verify(public_key, signature)); + // Prints true or false +``` + +Example: Using the [`verify.update()`](#crypto_verifier_update_data) and [`verify.verify()`](#crypto_verifier_verify_object_signature_signature_format) methods: + +```None +const crypto = require('crypto'); +const verify = crypto.createVerify('RSA-SHA256'); + +verify.update('some data to sign'); + +const public_key = getPublicKeySomehow(); +const signature = getSignatureToVerify(); +console.log(verify.verify(public_key, signature)); + // Prints true or false +``` + +### verifier.update(data[, input\_encoding])[#](#crypto_verifier_update_data_input_encoding) + +Added in: v0.1.92 + +Updates the `Verify` content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'binary'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html) then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +### verifier.verify(object, signature[, signature\_format])[#](#crypto_verifier_verify_object_signature_signature_format) + +Added in: v0.1.92 + +Verifies the provided data using the given `object` and `signature`. +The `object` argument is a string containing a PEM encoded object, which can be +one an RSA public key, a DSA public key, or an X.509 certificate. +The `signature` argument is the previously calculated signature for the data, in +the `signature_format` which can be `'binary'`, `'hex'` or `'base64'`. +If a `signature_format` is specified, the `signature` is expected to be a +string; otherwise `signature` is expected to be a [`Buffer`](buffer.html). + +Returns `true` or `false` depending on the validity of the signature for +the data and public key. + +The `verifier` object can not be used again after `verify.verify()` has been +called. Multiple calls to `verify.verify()` will result in an error being +thrown. + +## `crypto` module methods and properties[#](#crypto_crypto_module_methods_and_properties) + +### crypto.DEFAULT\_ENCODING[#](#crypto_crypto_default_encoding) + +Added in: v0.9.3 + +The default encoding to use for functions that can take either strings +or [buffers](buffer.html). The default value is `'buffer'`, which makes methods +default to [`Buffer`](buffer.html) objects. + +The `crypto.DEFAULT_ENCODING` mechanism is provided for backwards compatibility +with legacy programs that expect `'binary'` to be the default encoding. + +New applications should expect the default to be `'buffer'`. This property may +become deprecated in a future Node.js release. + +### crypto.createCipher(algorithm, password)[#](#crypto_crypto_createcipher_algorithm_password) + +Added in: v0.1.94 + +Creates and returns a `Cipher` object that uses the given `algorithm` and +`password`. + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `password` is used to derive the cipher key and initialization vector (IV). +The value must be either a `'binary'` encoded string or a [`Buffer`](buffer.html). + +The implementation of `crypto.createCipher()` derives keys using the OpenSSL +function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one +iteration, and no salt. The lack of salt allows dictionary attacks as the same +password always creates the same key. The low iteration count and +non-cryptographically secure hash algorithm allow passwords to be tested very +rapidly. + +In line with OpenSSL's recommendation to use pbkdf2 instead of +[`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) it is recommended that developers derive a key and IV on +their own using [`crypto.pbkdf2()`](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) and to use [`crypto.createCipheriv()`](#crypto_crypto_createcipheriv_algorithm_key_iv) +to create the `Cipher` object. + +### crypto.createCipheriv(algorithm, key, iv)[#](#crypto_crypto_createcipheriv_algorithm_key_iv) + +Creates and returns a `Cipher` object, with the given `algorithm`, `key` and +initialization vector (`iv`). + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `key` is the raw key used by the `algorithm` and `iv` is an +[initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'binary'` encoded strings or +[buffers](buffer.html). + +### crypto.createCredentials(details)[#](#crypto_crypto_createcredentials_details) + +Added in: v0.1.92 +Deprecated since: v0.11.13 + +```None +Stability: 0 - Deprecated: Use tls.createSecureContext() instead. +``` + +The `crypto.createCredentials()` method is a deprecated alias for creating +and returning a `tls.SecureContext` object. The `crypto.createCredentials()` +method should not be used. + +The optional `details` argument is a hash object with keys: + +* `pfx` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) - PFX or PKCS12 encoded private + key, certificate and CA certificates +* `key` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded private key +* `passphrase` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - passphrase for the private key or PFX +* `cert` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded certificate +* `ca` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) - Either a string or array of strings of PEM encoded CA + certificates to trust. +* `crl` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) - Either a string or array of strings of PEM encoded CRLs + (Certificate Revocation List) +* `ciphers`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) using the [OpenSSL cipher list format](https://www.openssl.org/docs/man1.0.2/apps/ciphers.html#CIPHER-LIST-FORMAT) describing the + cipher algorithms to use or exclude. + +If no 'ca' details are given, Node.js will use Mozilla's default +[publicly trusted list of CAs](https://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt). + +### crypto.createDecipher(algorithm, password)[#](#crypto_crypto_createdecipher_algorithm_password) + +Added in: v0.1.94 + +Creates and returns a `Decipher` object that uses the given `algorithm` and +`password` (key). + +The implementation of `crypto.createDecipher()` derives keys using the OpenSSL +function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one +iteration, and no salt. The lack of salt allows dictionary attacks as the same +password always creates the same key. The low iteration count and +non-cryptographically secure hash algorithm allow passwords to be tested very +rapidly. + +In line with OpenSSL's recommendation to use pbkdf2 instead of +[`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) it is recommended that developers derive a key and IV on +their own using [`crypto.pbkdf2()`](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) and to use [`crypto.createDecipheriv()`](#crypto_crypto_createdecipheriv_algorithm_key_iv) +to create the `Decipher` object. + +### crypto.createDecipheriv(algorithm, key, iv)[#](#crypto_crypto_createdecipheriv_algorithm_key_iv) + +Added in: v0.1.94 + +Creates and returns a `Decipher` object that uses the given `algorithm`, `key` +and initialization vector (`iv`). + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `key` is the raw key used by the `algorithm` and `iv` is an +[initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'binary'` encoded strings or +[buffers](buffer.html). + +### crypto.createDiffieHellman(prime[, prime\_encoding][, generator][, generator\_encoding])[#](#crypto_crypto_creatediffiehellman_prime_prime_encoding_generator_generator_encoding) + +Added in: v0.11.12 + +Creates a `DiffieHellman` key exchange object using the supplied `prime` and an +optional specific `generator`. + +The `generator` argument can be a number, string, or [`Buffer`](buffer.html). If +`generator` is not specified, the value `2` is used. + +The `prime_encoding` and `generator_encoding` arguments can be `'binary'`, +`'hex'`, or `'base64'`. + +If `prime_encoding` is specified, `prime` is expected to be a string; otherwise +a [`Buffer`](buffer.html) is expected. + +If `generator_encoding` is specified, `generator` is expected to be a string; +otherwise either a number or [`Buffer`](buffer.html) is expected. + +### crypto.createDiffieHellman(prime\_length[, generator])[#](#crypto_crypto_creatediffiehellman_prime_length_generator) + +Added in: v0.5.0 + +Creates a `DiffieHellman` key exchange object and generates a prime of +`prime_length` bits using an optional specific numeric `generator`. +If `generator` is not specified, the value `2` is used. + +### crypto.createECDH(curve\_name)[#](#crypto_crypto_createecdh_curve_name) + +Added in: v0.11.14 + +Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a +predefined curve specified by the `curve_name` string. Use +[`crypto.getCurves()`](#crypto_crypto_getcurves) to obtain a list of available curve names. On recent +OpenSSL releases, `openssl ecparam -list_curves` will also display the name +and description of each available elliptic curve. + +### crypto.createHash(algorithm)[#](#crypto_crypto_createhash_algorithm) + +Added in: v0.1.92 + +Creates and returns a `Hash` object that can be used to generate hash digests +using the given `algorithm`. + +The `algorithm` is dependent on the available algorithms supported by the +version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. +On recent releases of OpenSSL, `openssl list-message-digest-algorithms` will +display the available digest algorithms. + +Example: generating the sha256 sum of a file + +```None +const filename = process.argv[2]; +const crypto = require('crypto'); +const fs = require('fs'); + +const hash = crypto.createHash('sha256'); + +const input = fs.createReadStream(filename); +input.on('readable', () => { + var data = input.read(); + if (data) + hash.update(data); + else { + console.log(`${hash.digest('hex')} ${filename}`); + } +}); +``` + +### crypto.createHmac(algorithm, key)[#](#crypto_crypto_createhmac_algorithm_key) + +Added in: v0.1.94 + +Creates and returns an `Hmac` object that uses the given `algorithm` and `key`. + +The `algorithm` is dependent on the available algorithms supported by the +version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. +On recent releases of OpenSSL, `openssl list-message-digest-algorithms` will +display the available digest algorithms. + +The `key` is the HMAC key used to generate the cryptographic HMAC hash. + +Example: generating the sha256 HMAC of a file + +```None +const filename = process.argv[2]; +const crypto = require('crypto'); +const fs = require('fs'); + +const hmac = crypto.createHmac('sha256', 'a secret'); + +const input = fs.createReadStream(filename); +input.on('readable', () => { + var data = input.read(); + if (data) + hmac.update(data); + else { + console.log(`${hmac.digest('hex')} ${filename}`); + } +}); +``` + +### crypto.createSign(algorithm)[#](#crypto_crypto_createsign_algorithm) + +Added in: v0.1.92 + +Creates and returns a `Sign` object that uses the given `algorithm`. +Use [`crypto.getHashes()`](#crypto_crypto_gethashes) to obtain an array of names of the available +signing algorithms. + +### crypto.createVerify(algorithm)[#](#crypto_crypto_createverify_algorithm) + +Added in: v0.1.92 + +Creates and returns a `Verify` object that uses the given algorithm. +Use [`crypto.getHashes()`](#crypto_crypto_gethashes) to obtain an array of names of the available +signing algorithms. + +### crypto.getCiphers()[#](#crypto_crypto_getciphers) + +Added in: v0.9.3 + +Returns an array with the names of the supported cipher algorithms. + +Example: + +```None +const ciphers = crypto.getCiphers(); +console.log(ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...] +``` + +### crypto.getCurves()[#](#crypto_crypto_getcurves) + +Added in: v2.3.0 + +Returns an array with the names of the supported elliptic curves. + +Example: + +```None +const curves = crypto.getCurves(); +console.log(curves); // ['secp256k1', 'secp384r1', ...] +``` + +### crypto.getDiffieHellman(group\_name)[#](#crypto_crypto_getdiffiehellman_group_name) + +Added in: v0.7.5 + +Creates a predefined `DiffieHellman` key exchange object. The +supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in +[RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt), but see [Caveats](#crypto_support_for_weak_or_compromised_algorithms)) and `'modp14'`, `'modp15'`, +`'modp16'`, `'modp17'`, `'modp18'` (defined in [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt)). The +returned object mimics the interface of objects created by +[`crypto.createDiffieHellman()`](#crypto_crypto_creatediffiehellman_prime_prime_encoding_generator_generator_encoding), but will not allow changing +the keys (with [`diffieHellman.setPublicKey()`](#crypto_diffiehellman_setpublickey_public_key_encoding) for example). The +advantage of using this method is that the parties do not have to +generate nor exchange a group modulus beforehand, saving both processor +and communication time. + +Example (obtaining a shared secret): + +```None +const crypto = require('crypto'); +const alice = crypto.getDiffieHellman('modp14'); +const bob = crypto.getDiffieHellman('modp14'); + +alice.generateKeys(); +bob.generateKeys(); + +const alice_secret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +const bob_secret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +/* alice_secret and bob_secret should be the same */ +console.log(alice_secret == bob_secret); +``` + +### crypto.getHashes()[#](#crypto_crypto_gethashes) + +Added in: v0.9.3 + +Returns an array of the names of the supported hash algorithms, +such as `RSA-SHA256`. + +Example: + +```None +const hashes = crypto.getHashes(); +console.log(hashes); // ['sha', 'sha1', 'sha1WithRSAEncryption', ...] +``` + +### crypto.pbkdf2(password, salt, iterations, keylen[, digest], callback)[#](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) + +Added in: v0.5.5 + +Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2) +implementation. A selected HMAC digest algorithm specified by `digest` is +applied to derive a key of the requested byte length (`keylen`) from the +`password`, `salt` and `iterations`. If the `digest` algorithm is not specified, +a default of `'sha1'` is used. + +The supplied `callback` function is called with two arguments: `err` and +`derivedKey`. If an error occurs, `err` will be set; otherwise `err` will be +null. The successfully generated `derivedKey` will be passed as a [`Buffer`](buffer.html). + +The `iterations` argument must be a number set as high as possible. The +higher the number of iterations, the more secure the derived key will be, +but will take a longer amount of time to complete. + +The `salt` should also be as unique as possible. It is recommended that the +salts are random and their lengths are greater than 16 bytes. See +[NIST SP 800-132](http://csrc.nist.gov/publications/nistpubs/800-132/nist-sp800-132.pdf) for details. + +Example: + +```None +const crypto = require('crypto'); +crypto.pbkdf2('secret', 'salt', 100000, 512, 'sha512', (err, key) => { + if (err) throw err; + console.log(key.toString('hex')); // 'c5e478d...1469e50' +}); +``` + +An array of supported digest functions can be retrieved using +[`crypto.getHashes()`](#crypto_crypto_gethashes). + +### crypto.pbkdf2Sync(password, salt, iterations, keylen[, digest])[#](#crypto_crypto_pbkdf2sync_password_salt_iterations_keylen_digest) + +Added in: v0.9.3 + +Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) +implementation. A selected HMAC digest algorithm specified by `digest` is +applied to derive a key of the requested byte length (`keylen`) from the +`password`, `salt` and `iterations`. If the `digest` algorithm is not specified, +a default of `'sha1'` is used. + +If an error occurs an Error will be thrown, otherwise the derived key will be +returned as a [`Buffer`](buffer.html). + +The `iterations` argument must be a number set as high as possible. The +higher the number of iterations, the more secure the derived key will be, +but will take a longer amount of time to complete. + +The `salt` should also be as unique as possible. It is recommended that the +salts are random and their lengths are greater than 16 bytes. See +[NIST SP 800-132](http://csrc.nist.gov/publications/nistpubs/800-132/nist-sp800-132.pdf) for details. + +Example: + +```None +const crypto = require('crypto'); +const key = crypto.pbkdf2Sync('secret', 'salt', 100000, 512, 'sha512'); +console.log(key.toString('hex')); // 'c5e478d...1469e50' +``` + +An array of supported digest functions can be retrieved using +[`crypto.getHashes()`](#crypto_crypto_gethashes). + +### crypto.privateDecrypt(private\_key, buffer)[#](#crypto_crypto_privatedecrypt_private_key_buffer) + +Added in: v0.11.14 + +Decrypts `buffer` with `private_key`. + +`private_key` can be an object or a string. If `private_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. +If `private_key` is an object, it is interpreted as a hash object with the +keys: + +* `key` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded private key +* `passphrase` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - Optional passphrase for the private key +* `padding` : An optional padding value, one of the following: + + `constants.RSA_NO_PADDING` + + `constants.RSA_PKCS1_PADDING` + + `constants.RSA_PKCS1_OAEP_PADDING` + +All paddings are defined in the `constants` module. + +### crypto.privateEncrypt(private\_key, buffer)[#](#crypto_crypto_privateencrypt_private_key_buffer) + +Added in: v1.1.0 + +Encrypts `buffer` with `private_key`. + +`private_key` can be an object or a string. If `private_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. +If `private_key` is an object, it is interpreted as a hash object with the +keys: + +* `key` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded private key +* `passphrase` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - Optional passphrase for the private key +* `padding` : An optional padding value, one of the following: + + `constants.RSA_NO_PADDING` + + `constants.RSA_PKCS1_PADDING` + +All paddings are defined in the `constants` module. + +### crypto.publicDecrypt(public\_key, buffer)[#](#crypto_crypto_publicdecrypt_public_key_buffer) + +Added in: v1.1.0 + +Decrypts `buffer` with `public_key`. + +`public_key` can be an object or a string. If `public_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. +If `public_key` is an object, it is interpreted as a hash object with the +keys: + +* `key` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded public key +* `passphrase` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - Optional passphrase for the private key +* `padding` : An optional padding value, one of the following: + + `constants.RSA_NO_PADDING` + + `constants.RSA_PKCS1_PADDING` + + `constants.RSA_PKCS1_OAEP_PADDING` + +Because RSA public keys can be derived from private keys, a private key may +be passed instead of a public key. + +All paddings are defined in the `constants` module. + +### crypto.publicEncrypt(public\_key, buffer)[#](#crypto_crypto_publicencrypt_public_key_buffer) + +Added in: v0.11.14 + +Encrypts `buffer` with `public_key`. + +`public_key` can be an object or a string. If `public_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. +If `public_key` is an object, it is interpreted as a hash object with the +keys: + +* `key` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded public key +* `passphrase` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - Optional passphrase for the private key +* `padding` : An optional padding value, one of the following: + + `constants.RSA_NO_PADDING` + + `constants.RSA_PKCS1_PADDING` + + `constants.RSA_PKCS1_OAEP_PADDING` + +Because RSA public keys can be derived from private keys, a private key may +be passed instead of a public key. + +All paddings are defined in the `constants` module. + +### crypto.randomBytes(size[, callback])[#](#crypto_crypto_randombytes_size_callback) + +Added in: v0.5.8 + +Generates cryptographically strong pseudo-random data. The `size` argument +is a number indicating the number of bytes to generate. + +If a `callback` function is provided, the bytes are generated asynchronously +and the `callback` function is invoked with two arguments: `err` and `buf`. +If an error occurs, `err` will be an Error object; otherwise it is null. The +`buf` argument is a [`Buffer`](buffer.html) containing the generated bytes. + +```None +// Asynchronous +const crypto = require('crypto'); +crypto.randomBytes(256, (err, buf) => { + if (err) throw err; + console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`); +}); +``` + +If the `callback` function is not provided, the random bytes are generated +synchronously and returned as a [`Buffer`](buffer.html). An error will be thrown if +there is a problem generating the bytes. + +```None +// Synchronous +const buf = crypto.randomBytes(256); +console.log( + `${buf.length} bytes of random data: ${buf.toString('hex')}`); +``` + +The `crypto.randomBytes()` method will block until there is sufficient entropy. +This should normally never take longer than a few milliseconds. The only time +when generating the random bytes may conceivably block for a longer period of +time is right after boot, when the whole system is still low on entropy. + +### crypto.setEngine(engine[, flags])[#](#crypto_crypto_setengine_engine_flags) + +Added in: v0.11.11 + +Load and set the `engine` for some or all OpenSSL functions (selected by flags). + +`engine` could be either an id or a path to the engine's shared library. + +The optional `flags` argument uses `ENGINE_METHOD_ALL` by default. The `flags` +is a bit field taking one of or a mix of the following flags (defined in the +`constants` module): + +* `ENGINE_METHOD_RSA` +* `ENGINE_METHOD_DSA` +* `ENGINE_METHOD_DH` +* `ENGINE_METHOD_RAND` +* `ENGINE_METHOD_ECDH` +* `ENGINE_METHOD_ECDSA` +* `ENGINE_METHOD_CIPHERS` +* `ENGINE_METHOD_DIGESTS` +* `ENGINE_METHOD_STORE` +* `ENGINE_METHOD_PKEY_METH` +* `ENGINE_METHOD_PKEY_ASN1_METH` +* `ENGINE_METHOD_ALL` +* `ENGINE_METHOD_NONE` + +## Notes[#](#crypto_notes) + +### Legacy Streams API (pre Node.js v0.10)[#](#crypto_legacy_streams_api_pre_node_js_v0_10) + +The Crypto module was added to Node.js before there was the concept of a +unified Stream API, and before there were [`Buffer`](buffer.html) objects for handling +binary data. As such, the many of the `crypto` defined classes have methods not +typically found on other Node.js classes that implement the [streams](stream.html) +API (e.g. `update()`, `final()`, or `digest()`). Also, many methods accepted +and returned `'binary'` encoded strings by default rather than Buffers. This +default was changed after Node.js v0.8 to use [`Buffer`](buffer.html) objects by default +instead. + +### Recent ECDH Changes[#](#crypto_recent_ecdh_changes) + +Usage of `ECDH` with non-dynamically generated key pairs has been simplified. +Now, [`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_private_key_encoding) can be called with a preselected private key +and the associated public point (key) will be computed and stored in the object. +This allows code to only store and provide the private part of the EC key pair. +[`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_private_key_encoding) now also validates that the private key is valid for +the selected curve. + +The [`ecdh.setPublicKey()`](#crypto_ecdh_setpublickey_public_key_encoding) method is now deprecated as its inclusion in the +API is not useful. Either a previously stored private key should be set, which +automatically generates the associated public key, or [`ecdh.generateKeys()`](#crypto_ecdh_generatekeys_encoding_format) +should be called. The main drawback of using [`ecdh.setPublicKey()`](#crypto_ecdh_setpublickey_public_key_encoding) is that +it can be used to put the ECDH key pair into an inconsistent state. + +### Support for weak or compromised algorithms[#](#crypto_support_for_weak_or_compromised_algorithms) + +The `crypto` module still supports some algorithms which are already +compromised and are not currently recommended for use. The API also allows +the use of ciphers and hashes with a small key size that are considered to be +too weak for safe use. + +Users should take full responsibility for selecting the crypto +algorithm and key size according to their security requirements. + +Based on the recommendations of [NIST SP 800-131A](http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar1.pdf): + +* MD5 and SHA-1 are no longer acceptable where collision resistance is + required such as digital signatures. +* The key used with RSA, DSA and DH algorithms is recommended to have + at least 2048 bits and that of the curve of ECDSA and ECDH at least + 224 bits, to be safe to use for several years. +* The DH groups of `modp1`, `modp2` and `modp5` have a key size + smaller than 2048 bits and are not recommended. + +See the reference for other recommendations and details. diff --git a/corpus/docs/nodejs/crypto/crypto_5x.md b/corpus/docs/nodejs/crypto/crypto_5x.md new file mode 100644 index 0000000000000000000000000000000000000000..8a4a9e1258c32daad751ba7610d988a33e2898f9 --- /dev/null +++ b/corpus/docs/nodejs/crypto/crypto_5x.md @@ -0,0 +1,1372 @@ +# Crypto# + +Source: https://nodejs.org/docs/latest-v5.x/api/crypto.html +Version: 5.x + +```None +Stability: 2 - Stable +``` + +The `crypto` module provides cryptographic functionality that includes a set of +wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign and verify functions. + +Use `require('crypto')` to access this module. + +```None +const crypto = require('crypto'); + +const secret = 'abcdefg'; +const hash = crypto.createHmac('sha256', secret) + .update('I love cupcakes') + .digest('hex'); +console.log(hash); + // Prints: + // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e +``` + +## Class: Certificate[#](#crypto_class_certificate) + +SPKAC is a Certificate Signing Request mechanism originally implemented by +Netscape and now specified formally as part of [HTML5's `keygen` element](http://www.w3.org/TR/html5/forms.html#the-keygen-element). + +The `crypto` module provides the `Certificate` class for working with SPKAC +data. The most common usage is handling output generated by the HTML5 +`` element. Node.js uses [OpenSSL's SPKAC implementation](https://www.openssl.org/docs/apps/spkac.html) internally. + +### new crypto.Certificate()[#](#crypto_new_crypto_certificate) + +Instances of the `Certificate` class can be created using the `new` keyword +or by calling `crypto.Certificate()` as a function: + +```None +const crypto = require('crypto'); + +const cert1 = new crypto.Certificate(); +const cert2 = crypto.Certificate(); +``` + +### certificate.exportChallenge(spkac)[#](#crypto_certificate_exportchallenge_spkac) + +The `spkac` data structure includes a public key and a challenge. The +`certificate.exportChallenge()` returns the challenge component in the +form of a Node.js [`Buffer`](buffer.html). The `spkac` argument can be either a string +or a [`Buffer`](buffer.html). + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +const challenge = cert.exportChallenge(spkac); +console.log(challenge.toString('utf8')); + // Prints the challenge as a UTF8 string +``` + +### certificate.exportPublicKey(spkac)[#](#crypto_certificate_exportpublickey_spkac) + +The `spkac` data structure includes a public key and a challenge. The +`certificate.exportPublicKey()` returns the public key component in the +form of a Node.js [`Buffer`](buffer.html). The `spkac` argument can be either a string +or a [`Buffer`](buffer.html). + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +const publicKey = cert.exportPublicKey(spkac); +console.log(publicKey); + // Prints the public key as +``` + +### certificate.verifySpkac(spkac)[#](#crypto_certificate_verifyspkac_spkac) + +Returns `true` if the given `spkac` data structure is valid, `false` otherwise. +The `spkac` argument must be a Node.js [`Buffer`](buffer.html). + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +console.log(cert.verifySpkac(new Buffer(spkac))); + // Prints true or false +``` + +## Class: Cipher[#](#crypto_class_cipher) + +Instances of the `Cipher` class are used to encrypt data. The class can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where plain unencrypted + data is written to produce encrypted data on the readable side, or +* Using the [`cipher.update()`](#crypto_cipher_update_data_input_encoding_output_encoding) and [`cipher.final()`](#crypto_cipher_final_output_encoding) methods to produce + the encrypted data. + +The [`crypto.createCipher()`](#crypto_crypto_createcipher_algorithm_password) or [`crypto.createCipheriv()`](#crypto_crypto_createcipheriv_algorithm_key_iv) methods are +used to create `Cipher` instances. `Cipher` objects are not to be created +directly using the `new` keyword. + +Example: Using `Cipher` objects as streams: + +```None +const crypto = require('crypto'); +const cipher = crypto.createCipher('aes192', 'a password'); + +var encrypted = ''; +cipher.on('readable', () => { + var data = cipher.read(); + if (data) + encrypted += data.toString('hex'); +}); +cipher.on('end', () => { + console.log(encrypted); + // Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 +}); + +cipher.write('some clear text data'); +cipher.end(); +``` + +Example: Using `Cipher` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const cipher = crypto.createCipher('aes192', 'a password'); + +const input = fs.createReadStream('test.js'); +const output = fs.createWriteStream('test.enc'); + +input.pipe(cipher).pipe(output); +``` + +Example: Using the [`cipher.update()`](#crypto_cipher_update_data_input_encoding_output_encoding) and [`cipher.final()`](#crypto_cipher_final_output_encoding) methods: + +```None +const crypto = require('crypto'); +const cipher = crypto.createCipher('aes192', 'a password'); + +var encrypted = cipher.update('some clear text data', 'utf8', 'hex'); +encrypted += cipher.final('hex'); +console.log(encrypted); + // Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 +``` + +### cipher.final([output\_encoding])[#](#crypto_cipher_final_output_encoding) + +Returns any remaining enciphered contents. If `output_encoding` +parameter is one of `'binary'`, `'base64'` or `'hex'`, a string is returned. +If an `output_encoding` is not provided, a [`Buffer`](buffer.html) is returned. + +Once the `cipher.final()` method has been called, the `Cipher` object can no +longer be used to encrypt data. Attempts to call `cipher.final()` more than +once will result in an error being thrown. + +### cipher.setAAD(buffer)[#](#crypto_cipher_setaad_buffer) + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `cipher.setAAD()` method sets the value used for the +*additional authenticated data* (AAD) input parameter. + +### cipher.getAuthTag()[#](#crypto_cipher_getauthtag) + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `cipher.getAuthTag()` method returns a [`Buffer`](buffer.html) containing +the *authentication tag* that has been computed from the given data. + +The `cipher.getAuthTag()` method should only be called after encryption has +been completed using the [`cipher.final()`](#crypto_cipher_final_output_encoding) method. + +### cipher.setAutoPadding(auto\_padding=true)[#](#crypto_cipher_setautopadding_auto_padding_true) + +When using block encryption algorithms, the `Cipher` class will automatically +add padding to the input data to the appropriate block size. To disable the +default padding call `cipher.setAutoPadding(false)`. + +When `auto_padding` is `false`, the length of the entire input data must be a +multiple of the cipher's block size or [`cipher.final()`](#crypto_cipher_final_output_encoding) will throw an Error. +Disabling automatic padding is useful for non-standard padding, for instance +using `0x0` instead of PKCS padding. + +The `cipher.setAutoPadding()` method must be called before [`cipher.final()`](#crypto_cipher_final_output_encoding). + +### cipher.update(data[, input\_encoding][, output\_encoding])[#](#crypto_cipher_update_data_input_encoding_output_encoding) + +Updates the cipher with `data`. If the `input_encoding` argument is given, +it's value must be one of `'utf8'`, `'ascii'`, or `'binary'` and the `data` +argument is a string using the specified encoding. If the `input_encoding` +argument is not given, `data` must be a [`Buffer`](buffer.html). If `data` is a +[`Buffer`](buffer.html) then `input_encoding` is ignored. + +The `output_encoding` specifies the output format of the enciphered +data, and can be `'binary'`, `'base64'` or `'hex'`. If the `output_encoding` +is specified, a string using the specified encoding is returned. If no +`output_encoding` is provided, a [`Buffer`](buffer.html) is returned. + +The `cipher.update()` method can be called multiple times with new data until +[`cipher.final()`](#crypto_cipher_final_output_encoding) is called. Calling `cipher.update()` after +[`cipher.final()`](#crypto_cipher_final_output_encoding) will result in an error being thrown. + +## Class: Decipher[#](#crypto_class_decipher) + +Instances of the `Decipher` class are used to decrypt data. The class can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where plain encrypted + data is written to produce unencrypted data on the readable side, or +* Using the [`decipher.update()`](#crypto_decipher_update_data_input_encoding_output_encoding) and [`decipher.final()`](#crypto_decipher_final_output_encoding) methods to + produce the unencrypted data. + +The [`crypto.createDecipher()`](#crypto_crypto_createdecipher_algorithm_password) or [`crypto.createDecipheriv()`](#crypto_crypto_createdecipheriv_algorithm_key_iv) methods are +used to create `Decipher` instances. `Decipher` objects are not to be created +directly using the `new` keyword. + +Example: Using `Decipher` objects as streams: + +```None +const crypto = require('crypto'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +var decrypted = ''; +decipher.on('readable', () => { + var data = decipher.read(); + if (data) + decrypted += data.toString('utf8'); +}); +decipher.on('end', () => { + console.log(decrypted); + // Prints: some clear text data +}); + +var encrypted = 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; +decipher.write(encrypted, 'hex'); +decipher.end(); +``` + +Example: Using `Decipher` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +const input = fs.createReadStream('test.enc'); +const output = fs.createWriteStream('test.js'); + +input.pipe(decipher).pipe(output); +``` + +Example: Using the [`decipher.update()`](#crypto_decipher_update_data_input_encoding_output_encoding) and [`decipher.final()`](#crypto_decipher_final_output_encoding) methods: + +```None +const crypto = require('crypto'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +var encrypted = 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; +var decrypted = decipher.update(encrypted, 'hex', 'utf8'); +decrypted += decipher.final('utf8'); +console.log(decrypted); + // Prints: some clear text data +``` + +### decipher.final([output\_encoding])[#](#crypto_decipher_final_output_encoding) + +Returns any remaining deciphered contents. If `output_encoding` +parameter is one of `'binary'`, `'base64'` or `'hex'`, a string is returned. +If an `output_encoding` is not provided, a [`Buffer`](buffer.html) is returned. + +Once the `decipher.final()` method has been called, the `Decipher` object can +no longer be used to decrypt data. Attempts to call `decipher.final()` more +than once will result in an error being thrown. + +### decipher.setAAD(buffer)[#](#crypto_decipher_setaad_buffer) + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `cipher.setAAD()` method sets the value used for the +*additional authenticated data* (AAD) input parameter. + +### decipher.setAuthTag(buffer)[#](#crypto_decipher_setauthtag_buffer) + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `decipher.setAuthTag()` method is used to pass in the +received *authentication tag*. If no tag is provided, or if the cipher text +has been tampered with, [`decipher.final()`](#crypto_decipher_final_output_encoding) with throw, indicating that the +cipher text should be discarded due to failed authentication. + +### decipher.setAutoPadding(auto\_padding=true)[#](#crypto_decipher_setautopadding_auto_padding_true) + +When data has been encrypted without standard block padding, calling +`decipher.setAutoPadding(false)` will disable automatic padding to prevent +[`decipher.final()`](#crypto_decipher_final_output_encoding) from checking for and removing padding. + +Turning auto padding off will only work if the input data's length is a +multiple of the ciphers block size. + +The `decipher.setAutoPadding()` method must be called before +[`decipher.update()`](#crypto_decipher_update_data_input_encoding_output_encoding). + +### decipher.update(data[, input\_encoding][, output\_encoding])[#](#crypto_decipher_update_data_input_encoding_output_encoding) + +Updates the decipher with `data`. If the `input_encoding` argument is given, +it's value must be one of `'binary'`, `'base64'`, or `'hex'` and the `data` +argument is a string using the specified encoding. If the `input_encoding` +argument is not given, `data` must be a [`Buffer`](buffer.html). If `data` is a +[`Buffer`](buffer.html) then `input_encoding` is ignored. + +The `output_encoding` specifies the output format of the enciphered +data, and can be `'binary'`, `'ascii'` or `'utf8'`. If the `output_encoding` +is specified, a string using the specified encoding is returned. If no +`output_encoding` is provided, a [`Buffer`](buffer.html) is returned. + +The `decipher.update()` method can be called multiple times with new data until +[`decipher.final()`](#crypto_decipher_final_output_encoding) is called. Calling `decipher.update()` after +[`decipher.final()`](#crypto_decipher_final_output_encoding) will result in an error being thrown. + +## Class: DiffieHellman[#](#crypto_class_diffiehellman) + +The `DiffieHellman` class is a utility for creating Diffie-Hellman key +exchanges. + +Instances of the `DiffieHellman` class can be created using the +[`crypto.createDiffieHellman()`](#crypto_crypto_creatediffiehellman_prime_prime_encoding_generator_generator_encoding) function. + +```None +const crypto = require('crypto'); +const assert = require('assert'); + +// Generate Alice's keys... +const alice = crypto.createDiffieHellman(2048); +const alice_key = alice.generateKeys(); + +// Generate Bob's keys... +const bob = crypto.createDiffieHellman(alice.getPrime(), alice.getGenerator()); +const bob_key = bob.generateKeys(); + +// Exchange and generate the secret... +const alice_secret = alice.computeSecret(bob_key); +const bob_secret = bob.computeSecret(alice_key); + +// OK +assert.equal(alice_secret.toString('hex'), bob_secret.toString('hex')); +``` + +### diffieHellman.computeSecret(other\_public\_key[, input\_encoding][, output\_encoding])[#](#crypto_diffiehellman_computesecret_other_public_key_input_encoding_output_encoding) + +Computes the shared secret using `other_public_key` as the other +party's public key and returns the computed shared secret. The supplied +key is interpreted using the specified `input_encoding`, and secret is +encoded using specified `output_encoding`. Encodings can be +`'binary'`, `'hex'`, or `'base64'`. If the `input_encoding` is not +provided, `other_public_key` is expected to be a [`Buffer`](buffer.html). + +If `output_encoding` is given a string is returned; otherwise, a +[`Buffer`](buffer.html) is returned. + +### diffieHellman.generateKeys([encoding])[#](#crypto_diffiehellman_generatekeys_encoding) + +Generates private and public Diffie-Hellman key values, and returns +the public key in the specified `encoding`. This key should be +transferred to the other party. Encoding can be `'binary'`, `'hex'`, +or `'base64'`. If `encoding` is provided a string is returned; otherwise a +[`Buffer`](buffer.html) is returned. + +### diffieHellman.getGenerator([encoding])[#](#crypto_diffiehellman_getgenerator_encoding) + +Returns the Diffie-Hellman generator in the specified `encoding`, which can +be `'binary'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is +returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPrime([encoding])[#](#crypto_diffiehellman_getprime_encoding) + +Returns the Diffie-Hellman prime in the specified `encoding`, which can +be `'binary'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is +returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPrivateKey([encoding])[#](#crypto_diffiehellman_getprivatekey_encoding) + +Returns the Diffie-Hellman private key in the specified `encoding`, +which can be `'binary'`, `'hex'`, or `'base64'`. If `encoding` is provided a +string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPublicKey([encoding])[#](#crypto_diffiehellman_getpublickey_encoding) + +Returns the Diffie-Hellman public key in the specified `encoding`, which +can be `'binary'`, `'hex'`, or `'base64'`. If `encoding` is provided a +string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.setPrivateKey(private\_key[, encoding])[#](#crypto_diffiehellman_setprivatekey_private_key_encoding) + +Sets the Diffie-Hellman private key. If the `encoding` argument is provided +and is either `'binary'`, `'hex'`, or `'base64'`, `private_key` is expected +to be a string. If no `encoding` is provided, `private_key` is expected +to be a [`Buffer`](buffer.html). + +### diffieHellman.setPublicKey(public\_key[, encoding])[#](#crypto_diffiehellman_setpublickey_public_key_encoding) + +Sets the Diffie-Hellman public key. If the `encoding` argument is provided +and is either `'binary'`, `'hex'` or `'base64'`, `public_key` is expected +to be a string. If no `encoding` is provided, `public_key` is expected +to be a [`Buffer`](buffer.html). + +### diffieHellman.verifyError[#](#crypto_diffiehellman_verifyerror) + +A bit field containing any warnings and/or errors resulting from a check +performed during initialization of the `DiffieHellman` object. + +The following values are valid for this property (as defined in `constants` +module): + +* `DH_CHECK_P_NOT_SAFE_PRIME` +* `DH_CHECK_P_NOT_PRIME` +* `DH_UNABLE_TO_CHECK_GENERATOR` +* `DH_NOT_SUITABLE_GENERATOR` + +## Class: ECDH[#](#crypto_class_ecdh) + +The `ECDH` class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH) +key exchanges. + +Instances of the `ECDH` class can be created using the +[`crypto.createECDH()`](#crypto_crypto_createecdh_curve_name) function. + +```None +const crypto = require('crypto'); +const assert = require('assert'); + +// Generate Alice's keys... +const alice = crypto.createECDH('secp521r1'); +const alice_key = alice.generateKeys(); + +// Generate Bob's keys... +const bob = crypto.createECDH('secp521r1'); +const bob_key = bob.generateKeys(); + +// Exchange and generate the secret... +const alice_secret = alice.computeSecret(bob_key); +const bob_secret = bob.computeSecret(alice_key); + +assert(alice_secret, bob_secret); + // OK +``` + +### ecdh.computeSecret(other\_public\_key[, input\_encoding][, output\_encoding])[#](#crypto_ecdh_computesecret_other_public_key_input_encoding_output_encoding) + +Computes the shared secret using `other_public_key` as the other +party's public key and returns the computed shared secret. The supplied +key is interpreted using specified `input_encoding`, and the returned secret +is encoded using the specified `output_encoding`. Encodings can be +`'binary'`, `'hex'`, or `'base64'`. If the `input_encoding` is not +provided, `other_public_key` is expected to be a [`Buffer`](buffer.html). + +If `output_encoding` is given a string will be returned; otherwise a +[`Buffer`](buffer.html) is returned. + +### ecdh.generateKeys([encoding[, format]])[#](#crypto_ecdh_generatekeys_encoding_format) + +Generates private and public EC Diffie-Hellman key values, and returns +the public key in the specified `format` and `encoding`. This key should be +transferred to the other party. + +The `format` arguments specifies point encoding and can be `'compressed'`, +`'uncompressed'`, or `'hybrid'`. If `format` is not specified, the point will +be returned in `'uncompressed'` format. + +The `encoding` argument can be `'binary'`, `'hex'`, or `'base64'`. If +`encoding` is provided a string is returned; otherwise a [`Buffer`](buffer.html) +is returned. + +### ecdh.getPrivateKey([encoding])[#](#crypto_ecdh_getprivatekey_encoding) + +Returns the EC Diffie-Hellman private key in the specified `encoding`, +which can be `'binary'`, `'hex'`, or `'base64'`. If `encoding` is provided +a string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### ecdh.getPublicKey([encoding[, format]])[#](#crypto_ecdh_getpublickey_encoding_format) + +Returns the EC Diffie-Hellman public key in the specified `encoding` and +`format`. + +The `format` argument specifies point encoding and can be `'compressed'`, +`'uncompressed'`, or `'hybrid'`. If `format` is not specified the point will be +returned in `'uncompressed'` format. + +The `encoding` argument can be `'binary'`, `'hex'`, or `'base64'`. If +`encoding` is specified, a string is returned; otherwise a [`Buffer`](buffer.html) is +returned. + +### ecdh.setPrivateKey(private\_key[, encoding])[#](#crypto_ecdh_setprivatekey_private_key_encoding) + +Sets the EC Diffie-Hellman private key. The `encoding` can be `'binary'`, +`'hex'` or `'base64'`. If `encoding` is provided, `private_key` is expected +to be a string; otherwise `private_key` is expected to be a [`Buffer`](buffer.html). If +`private_key` is not valid for the curve specified when the `ECDH` object was +created, an error is thrown. Upon setting the private key, the associated +public point (key) is also generated and set in the ECDH object. + +### ecdh.setPublicKey(public\_key[, encoding])[#](#crypto_ecdh_setpublickey_public_key_encoding) + +```None +Stability: 0 - Deprecated +``` + +Sets the EC Diffie-Hellman public key. Key encoding can be `'binary'`, +`'hex'` or `'base64'`. If `encoding` is provided `public_key` is expected to +be a string; otherwise a [`Buffer`](buffer.html) is expected. + +Note that there is not normally a reason to call this method because `ECDH` +only requires a private key and the other party's public key to compute the +shared secret. Typically either [`ecdh.generateKeys()`](#crypto_ecdh_generatekeys_encoding_format) or +[`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_private_key_encoding) will be called. The [`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_private_key_encoding) method +attempts to generate the public point/key associated with the private key being +set. + +Example (obtaining a shared secret): + +```None +const crypto = require('crypto'); +const alice = crypto.createECDH('secp256k1'); +const bob = crypto.createECDH('secp256k1'); + +// Note: This is a shortcut way to specify one of Alice's previous private +// keys. It would be unwise to use such a predictable private key in a real +// application. +alice.setPrivateKey( + crypto.createHash('sha256').update('alice', 'utf8').digest() +); + +// Bob uses a newly generated cryptographically strong +// pseudorandom key pair bob.generateKeys(); + +const alice_secret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +const bob_secret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +// alice_secret and bob_secret should be the same shared secret value +console.log(alice_secret === bob_secret); +``` + +## Class: Hash[#](#crypto_class_hash) + +The `Hash` class is a utility for creating hash digests of data. It can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where data is written + to produce a computed hash digest on the readable side, or +* Using the [`hash.update()`](#crypto_hash_update_data_input_encoding) and [`hash.digest()`](#crypto_hash_digest_encoding) methods to produce the + computed hash. + +The [`crypto.createHash()`](#crypto_crypto_createhash_algorithm) method is used to create `Hash` instances. `Hash` +objects are not to be created directly using the `new` keyword. + +Example: Using `Hash` objects as streams: + +```None +const crypto = require('crypto'); +const hash = crypto.createHash('sha256'); + +hash.on('readable', () => { + var data = hash.read(); + if (data) + console.log(data.toString('hex')); + // Prints: + // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 +}); + +hash.write('some data to hash'); +hash.end(); +``` + +Example: Using `Hash` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const hash = crypto.createHash('sha256'); + +const input = fs.createReadStream('test.js'); +input.pipe(hash).pipe(process.stdout); +``` + +Example: Using the [`hash.update()`](#crypto_hash_update_data_input_encoding) and [`hash.digest()`](#crypto_hash_digest_encoding) methods: + +```None +const crypto = require('crypto'); +const hash = crypto.createHash('sha256'); + +hash.update('some data to hash'); +console.log(hash.digest('hex')); + // Prints: + // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 +``` + +### hash.digest([encoding])[#](#crypto_hash_digest_encoding) + +Calculates the digest of all of the data passed to be hashed (using the +[`hash.update()`](#crypto_hash_update_data_input_encoding) method). The `encoding` can be `'hex'`, `'binary'` or +`'base64'`. If `encoding` is provided a string will be returned; otherwise +a [`Buffer`](buffer.html) is returned. + +The `Hash` object can not be used again after `hash.digest()` method has been +called. Multiple calls will cause an error to be thrown. + +### hash.update(data[, input\_encoding])[#](#crypto_hash_update_data_input_encoding) + +Updates the hash content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'binary'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'binary'` is enforced. If `data` is a [`Buffer`](buffer.html) then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Hmac[#](#crypto_class_hmac) + +The `Hmac` Class is a utility for creating cryptographic HMAC digests. It can +be used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where data is written + to produce a computed HMAC digest on the readable side, or +* Using the [`hmac.update()`](#crypto_hmac_update_data_input_encoding) and [`hmac.digest()`](#crypto_hmac_digest_encoding) methods to produce the + computed HMAC digest. + +The [`crypto.createHmac()`](#crypto_crypto_createhmac_algorithm_key) method is used to create `Hmac` instances. `Hmac` +objects are not to be created directly using the `new` keyword. + +Example: Using `Hmac` objects as streams: + +```None +const crypto = require('crypto'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +hmac.on('readable', () => { + var data = hmac.read(); + if (data) + console.log(data.toString('hex')); + // Prints: + // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e +}); + +hmac.write('some data to hash'); +hmac.end(); +``` + +Example: Using `Hmac` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +const input = fs.createReadStream('test.js'); +input.pipe(hmac).pipe(process.stdout); +``` + +Example: Using the [`hmac.update()`](#crypto_hmac_update_data_input_encoding) and [`hmac.digest()`](#crypto_hmac_digest_encoding) methods: + +```None +const crypto = require('crypto'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +hmac.update('some data to hash'); +console.log(hmac.digest('hex')); + // Prints: + // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e +``` + +### hmac.digest([encoding])[#](#crypto_hmac_digest_encoding) + +Calculates the HMAC digest of all of the data passed using [`hmac.update()`](#crypto_hmac_update_data_input_encoding). +The `encoding` can be `'hex'`, `'binary'` or `'base64'`. If `encoding` is +provided a string is returned; otherwise a [`Buffer`](buffer.html) is returned; + +The `Hmac` object can not be used again after `hmac.digest()` has been +called. Multiple calls to `hmac.digest()` will result in an error being thrown. + +### hmac.update(data[, input\_encoding])[#](#crypto_hmac_update_data_input_encoding) + +Updates the `Hmac` content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'binary'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html) then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Sign[#](#crypto_class_sign) + +The `Sign` Class is a utility for generating signatures. It can be used in one +of two ways: + +* As a writable [stream](stream.html), where data to be signed is written and the + [`sign.sign()`](#crypto_sign_sign_private_key_output_format) method is used to generate and return the signature, or +* Using the [`sign.update()`](#crypto_sign_update_data_input_encoding) and [`sign.sign()`](#crypto_sign_sign_private_key_output_format) methods to produce the + signature. + +The [`crypto.createSign()`](#crypto_crypto_createsign_algorithm) method is used to create `Sign` instances. `Sign` +objects are not to be created directly using the `new` keyword. + +Example: Using `Sign` objects as streams: + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('RSA-SHA256'); + +sign.write('some data to sign'); +sign.end(); + +const private_key = getPrivateKeySomehow(); +console.log(sign.sign(private_key, 'hex')); + // Prints the calculated signature +``` + +Example: Using the [`sign.update()`](#crypto_sign_update_data_input_encoding) and [`sign.sign()`](#crypto_sign_sign_private_key_output_format) methods: + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('RSA-SHA256'); + +sign.update('some data to sign'); + +const private_key = getPrivateKeySomehow(); +console.log(sign.sign(private_key, 'hex')); + // Prints the calculated signature +``` + +A [`sign`][] instance can also be created by just passing in the digest +algorithm name, in which case OpenSSL will infer the full signature algorithm +from the type of the PEM-formatted private key, including algorithms that +do not have directly exposed name constants, e.g. 'ecdsa-with-SHA256'. + +Example: signing using ECDSA with SHA256 + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('sha256'); + +sign.update('some data to sign'); + +const private_key = '-----BEGIN EC PRIVATE KEY-----\n' + + 'MHcCAQEEIF+jnWY1D5kbVYDNvxxo/Y+ku2uJPDwS0r/VuPZQrjjVoAoGCCqGSM49\n' + + 'AwEHoUQDQgAEurOxfSxmqIRYzJVagdZfMMSjRNNhB8i3mXyIMq704m2m52FdfKZ2\n' + + 'pQhByd5eyj3lgZ7m7jbchtdgyOF8Io/1ng==\n' + + '-----END EC PRIVATE KEY-----\n'; + +console.log(sign.sign(private_key).toString('hex')); +``` + +### sign.sign(private\_key[, output\_format])[#](#crypto_sign_sign_private_key_output_format) + +Calculates the signature on all the data passed through using either +[`sign.update()`](#crypto_sign_update_data_input_encoding) or [`sign.write()`](stream.html#stream_writable_write_chunk_encoding_callback). + +The `private_key` argument can be an object or a string. If `private_key` is a +string, it is treated as a raw key with no passphrase. If `private_key` is an +object, it is interpreted as a hash containing two properties: + +* `key` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded private key +* `passphrase` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - passphrase for the private key + +The `output_format` can specify one of `'binary'`, `'hex'` or `'base64'`. If +`output_format` is provided a string is returned; otherwise a [`Buffer`](buffer.html) is +returned. + +The `Sign` object can not be again used after `sign.sign()` method has been +called. Multiple calls to `sign.sign()` will result in an error being thrown. + +### sign.update(data[, input\_encoding])[#](#crypto_sign_update_data_input_encoding) + +Updates the `Sign` content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'binary'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html) then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Verify[#](#crypto_class_verify) + +The `Verify` class is a utility for verifying signatures. It can be used in one +of two ways: + +* As a writable [stream](stream.html) where written data is used to validate against the + supplied signature, or +* Using the [`verify.update()`](#crypto_verifier_update_data_input_encoding) and [`verify.verify()`](#crypto_verifier_verify_object_signature_signature_format) methods to verify + the signature. + + The [`crypto.createSign()`](#crypto_crypto_createsign_algorithm) method is used to create `Sign` instances. + `Sign` objects are not to be created directly using the `new` keyword. + +Example: Using `Verify` objects as streams: + +```None +const crypto = require('crypto'); +const verify = crypto.createVerify('RSA-SHA256'); + +verify.write('some data to sign'); +verify.end(); + +const public_key = getPublicKeySomehow(); +const signature = getSignatureToVerify(); +console.log(sign.verify(public_key, signature)); + // Prints true or false +``` + +Example: Using the [`verify.update()`](#crypto_verifier_update_data_input_encoding) and [`verify.verify()`](#crypto_verifier_verify_object_signature_signature_format) methods: + +```None +const crypto = require('crypto'); +const verify = crypto.createVerify('RSA-SHA256'); + +verify.update('some data to sign'); + +const public_key = getPublicKeySomehow(); +const signature = getSignatureToVerify(); +console.log(verify.verify(public_key, signature)); + // Prints true or false +``` + +### verifier.update(data[, input\_encoding])[#](#crypto_verifier_update_data_input_encoding) + +Updates the `Verify` content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'binary'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html) then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +### verifier.verify(object, signature[, signature\_format])[#](#crypto_verifier_verify_object_signature_signature_format) + +Verifies the provided data using the given `object` and `signature`. +The `object` argument is a string containing a PEM encoded object, which can be +one an RSA public key, a DSA public key, or an X.509 certificate. +The `signature` argument is the previously calculated signature for the data, in +the `signature_format` which can be `'binary'`, `'hex'` or `'base64'`. +If a `signature_format` is specified, the `signature` is expected to be a +string; otherwise `signature` is expected to be a [`Buffer`](buffer.html). + +Returns `true` or `false` depending on the validity of the signature for +the data and public key. + +The `verifier` object can not be used again after `verify.verify()` has been +called. Multiple calls to `verify.verify()` will result in an error being +thrown. + +## `crypto` module methods and properties[#](#crypto_crypto_module_methods_and_properties) + +### crypto.DEFAULT\_ENCODING[#](#crypto_crypto_default_encoding) + +The default encoding to use for functions that can take either strings +or [buffers](buffer.html). The default value is `'buffer'`, which makes methods +default to [`Buffer`](buffer.html) objects. + +The `crypto.DEFAULT_ENCODING` mechanism is provided for backwards compatibility +with legacy programs that expect `'binary'` to be the default encoding. + +New applications should expect the default to be `'buffer'`. This property may +become deprecated in a future Node.js release. + +### crypto.createCipher(algorithm, password)[#](#crypto_crypto_createcipher_algorithm_password) + +Creates and returns a `Cipher` object that uses the given `algorithm` and +`password`. + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `password` is used to derive the cipher key and initialization vector (IV). +The value must be either a `'binary'` encoded string or a [`Buffer`](buffer.html). + +The implementation of `crypto.createCipher()` derives keys using the OpenSSL +function [`EVP_BytesToKey`](https://www.openssl.org/docs/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one +iteration, and no salt. The lack of salt allows dictionary attacks as the same +password always creates the same key. The low iteration count and +non-cryptographically secure hash algorithm allow passwords to be tested very +rapidly. + +In line with OpenSSL's recommendation to use pbkdf2 instead of +[`EVP_BytesToKey`](https://www.openssl.org/docs/crypto/EVP_BytesToKey.html) it is recommended that developers derive a key and IV on +their own using [`crypto.pbkdf2()`](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) and to use [`crypto.createCipheriv()`](#crypto_crypto_createcipheriv_algorithm_key_iv) +to create the `Cipher` object. + +### crypto.createCipheriv(algorithm, key, iv)[#](#crypto_crypto_createcipheriv_algorithm_key_iv) + +Creates and returns a `Cipher` object, with the given `algorithm`, `key` and +initialization vector (`iv`). + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `key` is the raw key used by the `algorithm` and `iv` is an +[initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'binary'` encoded strings or +[buffers](buffer.html). + +### crypto.createCredentials(details)[#](#crypto_crypto_createcredentials_details) + +```None +Stability: 0 - Deprecated: Use tls.createSecureContext() instead. +``` + +The `crypto.createCredentials()` method is a deprecated alias for creating +and returning a `tls.SecureContext` object. The `crypto.createCredentials()` +method should not be used. + +The optional `details` argument is a hash object with keys: + +* `pfx` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) - PFX or PKCS12 encoded private + key, certificate and CA certificates +* `key` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded private key +* `passphrase` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - passphrase for the private key or PFX +* `cert` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded certificate +* `ca` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) - Either a string or array of strings of PEM encoded CA + certificates to trust. +* `crl` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) - Either a string or array of strings of PEM encoded CRLs + (Certificate Revocation List) +* `ciphers`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) using the [OpenSSL cipher list format](https://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT) describing the + cipher algorithms to use or exclude. + +If no 'ca' details are given, Node.js will use Mozilla's default +[publicly trusted list of CAs](https://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt). + +### crypto.createDecipher(algorithm, password)[#](#crypto_crypto_createdecipher_algorithm_password) + +Creates and returns a `Decipher` object that uses the given `algorithm` and +`password` (key). + +The implementation of `crypto.createDecipher()` derives keys using the OpenSSL +function [`EVP_BytesToKey`](https://www.openssl.org/docs/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one +iteration, and no salt. The lack of salt allows dictionary attacks as the same +password always creates the same key. The low iteration count and +non-cryptographically secure hash algorithm allow passwords to be tested very +rapidly. + +In line with OpenSSL's recommendation to use pbkdf2 instead of +[`EVP_BytesToKey`](https://www.openssl.org/docs/crypto/EVP_BytesToKey.html) it is recommended that developers derive a key and IV on +their own using [`crypto.pbkdf2()`](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) and to use [`crypto.createDecipheriv()`](#crypto_crypto_createdecipheriv_algorithm_key_iv) +to create the `Decipher` object. + +### crypto.createDecipheriv(algorithm, key, iv)[#](#crypto_crypto_createdecipheriv_algorithm_key_iv) + +Creates and returns a `Decipher` object that uses the given `algorithm`, `key` +and initialization vector (`iv`). + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `key` is the raw key used by the `algorithm` and `iv` is an +[initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'binary'` encoded strings or +[buffers](buffer.html). + +### crypto.createDiffieHellman(prime[, prime\_encoding][, generator][, generator\_encoding])[#](#crypto_crypto_creatediffiehellman_prime_prime_encoding_generator_generator_encoding) + +Creates a `DiffieHellman` key exchange object using the supplied `prime` and an +optional specific `generator`. + +The `generator` argument can be a number, string, or [`Buffer`](buffer.html). If +`generator` is not specified, the value `2` is used. + +The `prime_encoding` and `generator_encoding` arguments can be `'binary'`, +`'hex'`, or `'base64'`. + +If `prime_encoding` is specified, `prime` is expected to be a string; otherwise +a [`Buffer`](buffer.html) is expected. + +If `generator_encoding` is specified, `generator` is expected to be a string; +otherwise either a number or [`Buffer`](buffer.html) is expected. + +### crypto.createDiffieHellman(prime\_length[, generator])[#](#crypto_crypto_creatediffiehellman_prime_length_generator) + +Creates a `DiffieHellman` key exchange object and generates a prime of +`prime_length` bits using an optional specific numeric `generator`. +If `generator` is not specified, the value `2` is used. + +### crypto.createECDH(curve\_name)[#](#crypto_crypto_createecdh_curve_name) + +Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a +predefined curve specified by the `curve_name` string. Use +[`crypto.getCurves()`](#crypto_crypto_getcurves) to obtain a list of available curve names. On recent +OpenSSL releases, `openssl ecparam -list_curves` will also display the name +and description of each available elliptic curve. + +### crypto.createHash(algorithm)[#](#crypto_crypto_createhash_algorithm) + +Creates and returns a `Hash` object that can be used to generate hash digests +using the given `algorithm`. + +The `algorithm` is dependent on the available algorithms supported by the +version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. +On recent releases of OpenSSL, `openssl list-message-digest-algorithms` will +display the available digest algorithms. + +Example: generating the sha256 sum of a file + +```None +const filename = process.argv[2]; +const crypto = require('crypto'); +const fs = require('fs'); + +const hash = crypto.createHash('sha256'); + +const input = fs.createReadStream(filename); +input.on('readable', () => { + var data = input.read(); + if (data) + hash.update(data); + else { + console.log(`${hash.digest('hex')} ${filename}`); + } +}); +``` + +### crypto.createHmac(algorithm, key)[#](#crypto_crypto_createhmac_algorithm_key) + +Creates and returns an `Hmac` object that uses the given `algorithm` and `key`. + +The `algorithm` is dependent on the available algorithms supported by the +version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. +On recent releases of OpenSSL, `openssl list-message-digest-algorithms` will +display the available digest algorithms. + +The `key` is the HMAC key used to generate the cryptographic HMAC hash. + +Example: generating the sha256 HMAC of a file + +```None +const filename = process.argv[2]; +const crypto = require('crypto'); +const fs = require('fs'); + +const hmac = crypto.createHmac('sha256', 'a secret'); + +const input = fs.createReadStream(filename); +input.on('readable', () => { + var data = input.read(); + if (data) + hmac.update(data); + else { + console.log(`${hmac.digest('hex')} ${filename}`); + } +}); +``` + +### crypto.createSign(algorithm)[#](#crypto_crypto_createsign_algorithm) + +Creates and returns a `Sign` object that uses the given `algorithm`. On +recent OpenSSL releases, `openssl list-public-key-algorithms` will +display the available signing algorithms. One example is `'RSA-SHA256'`. + +### crypto.createVerify(algorithm)[#](#crypto_crypto_createverify_algorithm) + +Creates and returns a `Verify` object that uses the given algorithm. On +recent OpenSSL releases, `openssl list-public-key-algorithms` will +display the available signing algorithms. One example is `'RSA-SHA256'`. + +### crypto.getCiphers()[#](#crypto_crypto_getciphers) + +Returns an array with the names of the supported cipher algorithms. + +Example: + +```None +const ciphers = crypto.getCiphers(); +console.log(ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...] +``` + +### crypto.getCurves()[#](#crypto_crypto_getcurves) + +Returns an array with the names of the supported elliptic curves. + +Example: + +```None +const curves = crypto.getCurves(); +console.log(curves); // ['secp256k1', 'secp384r1', ...] +``` + +### crypto.getDiffieHellman(group\_name)[#](#crypto_crypto_getdiffiehellman_group_name) + +Creates a predefined `DiffieHellman` key exchange object. The +supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in +[RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt), but see [Caveats](#crypto_support_for_weak_or_compromised_algorithms)) and `'modp14'`, `'modp15'`, +`'modp16'`, `'modp17'`, `'modp18'` (defined in [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt)). The +returned object mimics the interface of objects created by +[`crypto.createDiffieHellman()`](#crypto_crypto_creatediffiehellman_prime_prime_encoding_generator_generator_encoding), but will not allow changing +the keys (with [`diffieHellman.setPublicKey()`](#crypto_diffiehellman_setpublickey_public_key_encoding) for example). The +advantage of using this method is that the parties do not have to +generate nor exchange a group modulus beforehand, saving both processor +and communication time. + +Example (obtaining a shared secret): + +```None +const crypto = require('crypto'); +const alice = crypto.getDiffieHellman('modp14'); +const bob = crypto.getDiffieHellman('modp14'); + +alice.generateKeys(); +bob.generateKeys(); + +const alice_secret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +const bob_secret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +/* alice_secret and bob_secret should be the same */ +console.log(alice_secret == bob_secret); +``` + +### crypto.getHashes()[#](#crypto_crypto_gethashes) + +Returns an array with the names of the supported hash algorithms. + +Example: + +```None +const hashes = crypto.getHashes(); +console.log(hashes); // ['sha', 'sha1', 'sha1WithRSAEncryption', ...] +``` + +### crypto.pbkdf2(password, salt, iterations, keylen[, digest], callback)[#](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) + +Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2) +implementation. A selected HMAC digest algorithm specified by `digest` is +applied to derive a key of the requested byte length (`keylen`) from the +`password`, `salt` and `iterations`. If the `digest` algorithm is not specified, +a default of `'sha1'` is used. + +The supplied `callback` function is called with two arguments: `err` and +`derivedKey`. If an error occurs, `err` will be set; otherwise `err` will be +null. The successfully generated `derivedKey` will be passed as a [`Buffer`](buffer.html). + +The `iterations` argument must be a number set as high as possible. The +higher the number of iterations, the more secure the derived key will be, +but will take a longer amount of time to complete. + +The `salt` should also be as unique as possible. It is recommended that the +salts are random and their lengths are greater than 16 bytes. See +[NIST SP 800-132](http://csrc.nist.gov/publications/nistpubs/800-132/nist-sp800-132.pdf) for details. + +Example: + +```None +const crypto = require('crypto'); +crypto.pbkdf2('secret', 'salt', 100000, 512, 'sha512', (err, key) => { + if (err) throw err; + console.log(key.toString('hex')); // 'c5e478d...1469e50' +}); +``` + +An array of supported digest functions can be retrieved using +[`crypto.getHashes()`](#crypto_crypto_gethashes). + +### crypto.pbkdf2Sync(password, salt, iterations, keylen[, digest])[#](#crypto_crypto_pbkdf2sync_password_salt_iterations_keylen_digest) + +Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) +implementation. A selected HMAC digest algorithm specified by `digest` is +applied to derive a key of the requested byte length (`keylen`) from the +`password`, `salt` and `iterations`. If the `digest` algorithm is not specified, +a default of `'sha1'` is used. + +If an error occurs an Error will be thrown, otherwise the derived key will be +returned as a [`Buffer`](buffer.html). + +The `iterations` argument must be a number set as high as possible. The +higher the number of iterations, the more secure the derived key will be, +but will take a longer amount of time to complete. + +The `salt` should also be as unique as possible. It is recommended that the +salts are random and their lengths are greater than 16 bytes. See +[NIST SP 800-132](http://csrc.nist.gov/publications/nistpubs/800-132/nist-sp800-132.pdf) for details. + +Example: + +```None +const crypto = require('crypto'); +const key = crypto.pbkdf2Sync('secret', 'salt', 100000, 512, 'sha512'); +console.log(key.toString('hex')); // 'c5e478d...1469e50' +``` + +An array of supported digest functions can be retrieved using +[`crypto.getHashes()`](#crypto_crypto_gethashes). + +### crypto.privateDecrypt(private\_key, buffer)[#](#crypto_crypto_privatedecrypt_private_key_buffer) + +Decrypts `buffer` with `private_key`. + +`private_key` can be an object or a string. If `private_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. +If `private_key` is an object, it is interpreted as a hash object with the +keys: + +* `key` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded private key +* `passphrase` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - Optional passphrase for the private key +* `padding` : An optional padding value, one of the following: + + `constants.RSA_NO_PADDING` + + `constants.RSA_PKCS1_PADDING` + + `constants.RSA_PKCS1_OAEP_PADDING` + +All paddings are defined in the `constants` module. + +### crypto.privateEncrypt(private\_key, buffer)[#](#crypto_crypto_privateencrypt_private_key_buffer) + +Encrypts `buffer` with `private_key`. + +`private_key` can be an object or a string. If `private_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. +If `private_key` is an object, it is interpreted as a hash object with the +keys: + +* `key` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded private key +* `passphrase` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - Optional passphrase for the private key +* `padding` : An optional padding value, one of the following: + + `constants.RSA_NO_PADDING` + + `constants.RSA_PKCS1_PADDING` + + `constants.RSA_PKCS1_OAEP_PADDING` + +All paddings are defined in the `constants` module. + +### crypto.publicDecrypt(public\_key, buffer)[#](#crypto_crypto_publicdecrypt_public_key_buffer) + +Decrypts `buffer` with `public_key`. + +`public_key` can be an object or a string. If `public_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. +If `public_key` is an object, it is interpreted as a hash object with the +keys: + +* `key` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded public key +* `passphrase` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - Optional passphrase for the private key +* `padding` : An optional padding value, one of the following: + + `constants.RSA_NO_PADDING` + + `constants.RSA_PKCS1_PADDING` + + `constants.RSA_PKCS1_OAEP_PADDING` + +Because RSA public keys can be derived from private keys, a private key may +be passed instead of a public key. + +All paddings are defined in the `constants` module. + +### crypto.publicEncrypt(public\_key, buffer)[#](#crypto_crypto_publicencrypt_public_key_buffer) + +Encrypts `buffer` with `public_key`. + +`public_key` can be an object or a string. If `public_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. +If `public_key` is an object, it is interpreted as a hash object with the +keys: + +* `key` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded public key +* `passphrase` : [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - Optional passphrase for the private key +* `padding` : An optional padding value, one of the following: + + `constants.RSA_NO_PADDING` + + `constants.RSA_PKCS1_PADDING` + + `constants.RSA_PKCS1_OAEP_PADDING` + +Because RSA public keys can be derived from private keys, a private key may +be passed instead of a public key. + +All paddings are defined in the `constants` module. + +### crypto.randomBytes(size[, callback])[#](#crypto_crypto_randombytes_size_callback) + +Generates cryptographically strong pseudo-random data. The `size` argument +is a number indicating the number of bytes to generate. + +If a `callback` function is provided, the bytes are generated asynchronously +and the `callback` function is invoked with two arguments: `err` and `buf`. +If an error occurs, `err` will be an Error object; otherwise it is null. The +`buf` argument is a [`Buffer`](buffer.html) containing the generated bytes. + +```None +// Asynchronous +const crypto = require('crypto'); +crypto.randomBytes(256, (err, buf) => { + if (err) throw err; + console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`); +}); +``` + +If the `callback` function is not provided, the random bytes are generated +synchronously and returned as a [`Buffer`](buffer.html). An error will be thrown if +there is a problem generating the bytes. + +```None +// Synchronous +const buf = crypto.randomBytes(256); +console.log( + `${buf.length} bytes of random data: ${buf.toString('hex')}`); +``` + +The `crypto.randomBytes()` method will block until there is sufficient entropy. +This should normally never take longer than a few milliseconds. The only time +when generating the random bytes may conceivably block for a longer period of +time is right after boot, when the whole system is still low on entropy. + +### crypto.setEngine(engine[, flags])[#](#crypto_crypto_setengine_engine_flags) + +Load and set the `engine` for some or all OpenSSL functions (selected by flags). + +`engine` could be either an id or a path to the engine's shared library. + +The optional `flags` argument uses `ENGINE_METHOD_ALL` by default. The `flags` +is a bit field taking one of or a mix of the following flags (defined in the +`constants` module): + +* `ENGINE_METHOD_RSA` +* `ENGINE_METHOD_DSA` +* `ENGINE_METHOD_DH` +* `ENGINE_METHOD_RAND` +* `ENGINE_METHOD_ECDH` +* `ENGINE_METHOD_ECDSA` +* `ENGINE_METHOD_CIPHERS` +* `ENGINE_METHOD_DIGESTS` +* `ENGINE_METHOD_STORE` +* `ENGINE_METHOD_PKEY_METHS` +* `ENGINE_METHOD_PKEY_ASN1_METHS` +* `ENGINE_METHOD_ALL` +* `ENGINE_METHOD_NONE` + +## Notes[#](#crypto_notes) + +### Legacy Streams API (pre Node.js v0.10)[#](#crypto_legacy_streams_api_pre_node_js_v0_10) + +The Crypto module was added to Node.js before there was the concept of a +unified Stream API, and before there were [`Buffer`](buffer.html) objects for handling +binary data. As such, the many of the `crypto` defined classes have methods not +typically found on other Node.js classes that implement the [streams](stream.html) +API (e.g. `update()`, `final()`, or `digest()`). Also, many methods accepted +and returned `'binary'` encoded strings by default rather than Buffers. This +default was changed after Node.js v0.8 to use [`Buffer`](buffer.html) objects by default +instead. + +### Recent ECDH Changes[#](#crypto_recent_ecdh_changes) + +Usage of `ECDH` with non-dynamically generated key pairs has been simplified. +Now, [`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_private_key_encoding) can be called with a preselected private key +and the associated public point (key) will be computed and stored in the object. +This allows code to only store and provide the private part of the EC key pair. +[`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_private_key_encoding) now also validates that the private key is valid for +the selected curve. + +The [`ecdh.setPublicKey()`](#crypto_ecdh_setpublickey_public_key_encoding) method is now deprecated as its inclusion in the +API is not useful. Either a previously stored private key should be set, which +automatically generates the associated public key, or [`ecdh.generateKeys()`](#crypto_ecdh_generatekeys_encoding_format) +should be called. The main drawback of using [`ecdh.setPublicKey()`](#crypto_ecdh_setpublickey_public_key_encoding) is that +it can be used to put the ECDH key pair into an inconsistent state. + +### Support for weak or compromised algorithms[#](#crypto_support_for_weak_or_compromised_algorithms) + +The `crypto` module still supports some algorithms which are already +compromised and are not currently recommended for use. The API also allows +the use of ciphers and hashes with a small key size that are considered to be +too weak for safe use. + +Users should take full responsibility for selecting the crypto +algorithm and key size according to their security requirements. + +Based on the recommendations of [NIST SP 800-131A](http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar1.pdf): + +* MD5 and SHA-1 are no longer acceptable where collision resistance is + required such as digital signatures. +* The key used with RSA, DSA and DH algorithms is recommended to have + at least 2048 bits and that of the curve of ECDSA and ECDH at least + 224 bits, to be safe to use for several years. +* The DH groups of `modp1`, `modp2` and `modp5` have a key size + smaller than 2048 bits and are not recommended. + +See the reference for other recommendations and details. diff --git a/corpus/docs/nodejs/crypto/crypto_6x.md b/corpus/docs/nodejs/crypto/crypto_6x.md new file mode 100644 index 0000000000000000000000000000000000000000..d2c9dca43b69458cf383b0189fe214d90ad25d71 --- /dev/null +++ b/corpus/docs/nodejs/crypto/crypto_6x.md @@ -0,0 +1,1738 @@ +# Crypto# + +Source: https://nodejs.org/docs/latest-v6.x/api/crypto.html +Version: 6.x + +[Stability: 2](documentation.html#documentation_stability_index) - Stable + +The `crypto` module provides cryptographic functionality that includes a set of +wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign and verify functions. + +Use `require('crypto')` to access this module. + +```None +const crypto = require('crypto'); + +const secret = 'abcdefg'; +const hash = crypto.createHmac('sha256', secret) + .update('I love cupcakes') + .digest('hex'); +console.log(hash); +// Prints: +// c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e +``` + +## Determining if crypto support is unavailable[#](#crypto_determining_if_crypto_support_is_unavailable) + +It is possible for Node.js to be built without including support for the +`crypto` module. In such cases, calling `require('crypto')` will result in an +error being thrown. + +```None +let crypto; +try { + crypto = require('crypto'); +} catch (err) { + console.log('crypto support is disabled!'); +} +``` + +## Class: Certificate[#](#crypto_class_certificate) + +Added in: v0.11.8 + +SPKAC is a Certificate Signing Request mechanism originally implemented by +Netscape and now specified formally as part of [HTML5's `keygen` element](http://www.w3.org/TR/html5/forms.html#the-keygen-element). + +The `crypto` module provides the `Certificate` class for working with SPKAC +data. The most common usage is handling output generated by the HTML5 +`` element. Node.js uses [OpenSSL's SPKAC implementation](https://www.openssl.org/docs/man1.0.2/apps/spkac.html) internally. + +### new crypto.Certificate()[#](#crypto_new_crypto_certificate) + +Instances of the `Certificate` class can be created using the `new` keyword +or by calling `crypto.Certificate()` as a function: + +```None +const crypto = require('crypto'); + +const cert1 = new crypto.Certificate(); +const cert2 = crypto.Certificate(); +``` + +### certificate.exportChallenge(spkac)[#](#crypto_certificate_exportchallenge_spkac) + +Added in: v0.11.8 + +The `spkac` data structure includes a public key and a challenge. The +`certificate.exportChallenge()` returns the challenge component in the +form of a Node.js [`Buffer`](buffer.html). The `spkac` argument can be either a string +or a [`Buffer`](buffer.html). + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +const challenge = cert.exportChallenge(spkac); +console.log(challenge.toString('utf8')); +// Prints: the challenge as a UTF8 string +``` + +### certificate.exportPublicKey(spkac)[#](#crypto_certificate_exportpublickey_spkac) + +Added in: v0.11.8 + +The `spkac` data structure includes a public key and a challenge. The +`certificate.exportPublicKey()` returns the public key component in the +form of a Node.js [`Buffer`](buffer.html). The `spkac` argument can be either a string +or a [`Buffer`](buffer.html). + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +const publicKey = cert.exportPublicKey(spkac); +console.log(publicKey); +// Prints: the public key as +``` + +### certificate.verifySpkac(spkac)[#](#crypto_certificate_verifyspkac_spkac) + +Added in: v0.11.8 + +Returns `true` if the given `spkac` data structure is valid, `false` otherwise. +The `spkac` argument must be a Node.js [`Buffer`](buffer.html). + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +console.log(cert.verifySpkac(Buffer.from(spkac))); +// Prints: true or false +``` + +## Class: Cipher[#](#crypto_class_cipher) + +Added in: v0.1.94 + +Instances of the `Cipher` class are used to encrypt data. The class can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where plain unencrypted + data is written to produce encrypted data on the readable side, or +* Using the [`cipher.update()`](#crypto_cipher_update_data_input_encoding_output_encoding) and [`cipher.final()`](#crypto_cipher_final_output_encoding) methods to produce + the encrypted data. + +The [`crypto.createCipher()`](#crypto_crypto_createcipher_algorithm_password) or [`crypto.createCipheriv()`](#crypto_crypto_createcipheriv_algorithm_key_iv) methods are +used to create `Cipher` instances. `Cipher` objects are not to be created +directly using the `new` keyword. + +Example: Using `Cipher` objects as streams: + +```None +const crypto = require('crypto'); +const cipher = crypto.createCipher('aes192', 'a password'); + +let encrypted = ''; +cipher.on('readable', () => { + const data = cipher.read(); + if (data) + encrypted += data.toString('hex'); +}); +cipher.on('end', () => { + console.log(encrypted); + // Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 +}); + +cipher.write('some clear text data'); +cipher.end(); +``` + +Example: Using `Cipher` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const cipher = crypto.createCipher('aes192', 'a password'); + +const input = fs.createReadStream('test.js'); +const output = fs.createWriteStream('test.enc'); + +input.pipe(cipher).pipe(output); +``` + +Example: Using the [`cipher.update()`](#crypto_cipher_update_data_input_encoding_output_encoding) and [`cipher.final()`](#crypto_cipher_final_output_encoding) methods: + +```None +const crypto = require('crypto'); +const cipher = crypto.createCipher('aes192', 'a password'); + +let encrypted = cipher.update('some clear text data', 'utf8', 'hex'); +encrypted += cipher.final('hex'); +console.log(encrypted); +// Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 +``` + +### cipher.final([output\_encoding])[#](#crypto_cipher_final_output_encoding) + +Added in: v0.1.94 + +Returns any remaining enciphered contents. If `output_encoding` +parameter is one of `'latin1'`, `'base64'` or `'hex'`, a string is returned. +If an `output_encoding` is not provided, a [`Buffer`](buffer.html) is returned. + +Once the `cipher.final()` method has been called, the `Cipher` object can no +longer be used to encrypt data. Attempts to call `cipher.final()` more than +once will result in an error being thrown. + +### cipher.setAAD(buffer)[#](#crypto_cipher_setaad_buffer) + +Added in: v1.0.0 + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `cipher.setAAD()` method sets the value used for the +*additional authenticated data* (AAD) input parameter. + +Returns `this` for method chaining. + +### cipher.getAuthTag()[#](#crypto_cipher_getauthtag) + +Added in: v1.0.0 + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `cipher.getAuthTag()` method returns a [`Buffer`](buffer.html) containing +the *authentication tag* that has been computed from the given data. + +The `cipher.getAuthTag()` method should only be called after encryption has +been completed using the [`cipher.final()`](#crypto_cipher_final_output_encoding) method. + +### cipher.setAutoPadding(auto\_padding=true)[#](#crypto_cipher_setautopadding_auto_padding_true) + +Added in: v0.7.1 + +When using block encryption algorithms, the `Cipher` class will automatically +add padding to the input data to the appropriate block size. To disable the +default padding call `cipher.setAutoPadding(false)`. + +When `auto_padding` is `false`, the length of the entire input data must be a +multiple of the cipher's block size or [`cipher.final()`](#crypto_cipher_final_output_encoding) will throw an Error. +Disabling automatic padding is useful for non-standard padding, for instance +using `0x0` instead of PKCS padding. + +The `cipher.setAutoPadding()` method must be called before [`cipher.final()`](#crypto_cipher_final_output_encoding). + +Returns `this` for method chaining. + +### cipher.update(data[, input\_encoding][, output\_encoding])[#](#crypto_cipher_update_data_input_encoding_output_encoding) + +Added in: v0.1.94 + +Updates the cipher with `data`. If the `input_encoding` argument is given, +its value must be one of `'utf8'`, `'ascii'`, or `'latin1'` and the `data` +argument is a string using the specified encoding. If the `input_encoding` +argument is not given, `data` must be a [`Buffer`](buffer.html). If `data` is a +[`Buffer`](buffer.html) then `input_encoding` is ignored. + +The `output_encoding` specifies the output format of the enciphered +data, and can be `'latin1'`, `'base64'` or `'hex'`. If the `output_encoding` +is specified, a string using the specified encoding is returned. If no +`output_encoding` is provided, a [`Buffer`](buffer.html) is returned. + +The `cipher.update()` method can be called multiple times with new data until +[`cipher.final()`](#crypto_cipher_final_output_encoding) is called. Calling `cipher.update()` after +[`cipher.final()`](#crypto_cipher_final_output_encoding) will result in an error being thrown. + +## Class: Decipher[#](#crypto_class_decipher) + +Added in: v0.1.94 + +Instances of the `Decipher` class are used to decrypt data. The class can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where plain encrypted + data is written to produce unencrypted data on the readable side, or +* Using the [`decipher.update()`](#crypto_decipher_update_data_input_encoding_output_encoding) and [`decipher.final()`](#crypto_decipher_final_output_encoding) methods to + produce the unencrypted data. + +The [`crypto.createDecipher()`](#crypto_crypto_createdecipher_algorithm_password) or [`crypto.createDecipheriv()`](#crypto_crypto_createdecipheriv_algorithm_key_iv) methods are +used to create `Decipher` instances. `Decipher` objects are not to be created +directly using the `new` keyword. + +Example: Using `Decipher` objects as streams: + +```None +const crypto = require('crypto'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +let decrypted = ''; +decipher.on('readable', () => { + const data = decipher.read(); + if (data) + decrypted += data.toString('utf8'); +}); +decipher.on('end', () => { + console.log(decrypted); + // Prints: some clear text data +}); + +const encrypted = + 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; +decipher.write(encrypted, 'hex'); +decipher.end(); +``` + +Example: Using `Decipher` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +const input = fs.createReadStream('test.enc'); +const output = fs.createWriteStream('test.js'); + +input.pipe(decipher).pipe(output); +``` + +Example: Using the [`decipher.update()`](#crypto_decipher_update_data_input_encoding_output_encoding) and [`decipher.final()`](#crypto_decipher_final_output_encoding) methods: + +```None +const crypto = require('crypto'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +const encrypted = + 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; +let decrypted = decipher.update(encrypted, 'hex', 'utf8'); +decrypted += decipher.final('utf8'); +console.log(decrypted); +// Prints: some clear text data +``` + +### decipher.final([output\_encoding])[#](#crypto_decipher_final_output_encoding) + +Added in: v0.1.94 + +Returns any remaining deciphered contents. If `output_encoding` +parameter is one of `'latin1'`, `'ascii'` or `'utf8'`, a string is returned. +If an `output_encoding` is not provided, a [`Buffer`](buffer.html) is returned. + +Once the `decipher.final()` method has been called, the `Decipher` object can +no longer be used to decrypt data. Attempts to call `decipher.final()` more +than once will result in an error being thrown. + +### decipher.setAAD(buffer)[#](#crypto_decipher_setaad_buffer) + +Added in: v1.0.0 + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `decipher.setAAD()` method sets the value used for the +*additional authenticated data* (AAD) input parameter. + +Returns `this` for method chaining. + +### decipher.setAuthTag(buffer)[#](#crypto_decipher_setauthtag_buffer) + +Added in: v1.0.0 + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `decipher.setAuthTag()` method is used to pass in the +received *authentication tag*. If no tag is provided, or if the cipher text +has been tampered with, [`decipher.final()`](#crypto_decipher_final_output_encoding) will throw, indicating that the +cipher text should be discarded due to failed authentication. + +Returns `this` for method chaining. + +### decipher.setAutoPadding(auto\_padding=true)[#](#crypto_decipher_setautopadding_auto_padding_true) + +Added in: v0.7.1 + +When data has been encrypted without standard block padding, calling +`decipher.setAutoPadding(false)` will disable automatic padding to prevent +[`decipher.final()`](#crypto_decipher_final_output_encoding) from checking for and removing padding. + +Turning auto padding off will only work if the input data's length is a +multiple of the ciphers block size. + +The `decipher.setAutoPadding()` method must be called before +[`decipher.update()`](#crypto_decipher_update_data_input_encoding_output_encoding). + +Returns `this` for method chaining. + +### decipher.update(data[, input\_encoding][, output\_encoding])[#](#crypto_decipher_update_data_input_encoding_output_encoding) + +Added in: v0.1.94 + +Updates the decipher with `data`. If the `input_encoding` argument is given, +its value must be one of `'latin1'`, `'base64'`, or `'hex'` and the `data` +argument is a string using the specified encoding. If the `input_encoding` +argument is not given, `data` must be a [`Buffer`](buffer.html). If `data` is a +[`Buffer`](buffer.html) then `input_encoding` is ignored. + +The `output_encoding` specifies the output format of the enciphered +data, and can be `'latin1'`, `'ascii'` or `'utf8'`. If the `output_encoding` +is specified, a string using the specified encoding is returned. If no +`output_encoding` is provided, a [`Buffer`](buffer.html) is returned. + +The `decipher.update()` method can be called multiple times with new data until +[`decipher.final()`](#crypto_decipher_final_output_encoding) is called. Calling `decipher.update()` after +[`decipher.final()`](#crypto_decipher_final_output_encoding) will result in an error being thrown. + +## Class: DiffieHellman[#](#crypto_class_diffiehellman) + +Added in: v0.5.0 + +The `DiffieHellman` class is a utility for creating Diffie-Hellman key +exchanges. + +Instances of the `DiffieHellman` class can be created using the +[`crypto.createDiffieHellman()`](#crypto_crypto_creatediffiehellman_prime_prime_encoding_generator_generator_encoding) function. + +```None +const crypto = require('crypto'); +const assert = require('assert'); + +// Generate Alice's keys... +const alice = crypto.createDiffieHellman(2048); +const aliceKey = alice.generateKeys(); + +// Generate Bob's keys... +const bob = crypto.createDiffieHellman(alice.getPrime(), alice.getGenerator()); +const bobKey = bob.generateKeys(); + +// Exchange and generate the secret... +const aliceSecret = alice.computeSecret(bobKey); +const bobSecret = bob.computeSecret(aliceKey); + +// OK +assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); +``` + +### diffieHellman.computeSecret(other\_public\_key[, input\_encoding][, output\_encoding])[#](#crypto_diffiehellman_computesecret_other_public_key_input_encoding_output_encoding) + +Added in: v0.5.0 + +Computes the shared secret using `other_public_key` as the other +party's public key and returns the computed shared secret. The supplied +key is interpreted using the specified `input_encoding`, and secret is +encoded using specified `output_encoding`. Encodings can be +`'latin1'`, `'hex'`, or `'base64'`. If the `input_encoding` is not +provided, `other_public_key` is expected to be a [`Buffer`](buffer.html). + +If `output_encoding` is given a string is returned; otherwise, a +[`Buffer`](buffer.html) is returned. + +### diffieHellman.generateKeys([encoding])[#](#crypto_diffiehellman_generatekeys_encoding) + +Added in: v0.5.0 + +Generates private and public Diffie-Hellman key values, and returns +the public key in the specified `encoding`. This key should be +transferred to the other party. Encoding can be `'latin1'`, `'hex'`, +or `'base64'`. If `encoding` is provided a string is returned; otherwise a +[`Buffer`](buffer.html) is returned. + +### diffieHellman.getGenerator([encoding])[#](#crypto_diffiehellman_getgenerator_encoding) + +Added in: v0.5.0 + +Returns the Diffie-Hellman generator in the specified `encoding`, which can +be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is +returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPrime([encoding])[#](#crypto_diffiehellman_getprime_encoding) + +Added in: v0.5.0 + +Returns the Diffie-Hellman prime in the specified `encoding`, which can +be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is +returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPrivateKey([encoding])[#](#crypto_diffiehellman_getprivatekey_encoding) + +Added in: v0.5.0 + +Returns the Diffie-Hellman private key in the specified `encoding`, +which can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a +string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPublicKey([encoding])[#](#crypto_diffiehellman_getpublickey_encoding) + +Added in: v0.5.0 + +Returns the Diffie-Hellman public key in the specified `encoding`, which +can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a +string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.setPrivateKey(private\_key[, encoding])[#](#crypto_diffiehellman_setprivatekey_private_key_encoding) + +Added in: v0.5.0 + +Sets the Diffie-Hellman private key. If the `encoding` argument is provided +and is either `'latin1'`, `'hex'`, or `'base64'`, `private_key` is expected +to be a string. If no `encoding` is provided, `private_key` is expected +to be a [`Buffer`](buffer.html). + +### diffieHellman.setPublicKey(public\_key[, encoding])[#](#crypto_diffiehellman_setpublickey_public_key_encoding) + +Added in: v0.5.0 + +Sets the Diffie-Hellman public key. If the `encoding` argument is provided +and is either `'latin1'`, `'hex'` or `'base64'`, `public_key` is expected +to be a string. If no `encoding` is provided, `public_key` is expected +to be a [`Buffer`](buffer.html). + +### diffieHellman.verifyError[#](#crypto_diffiehellman_verifyerror) + +Added in: v0.11.12 + +A bit field containing any warnings and/or errors resulting from a check +performed during initialization of the `DiffieHellman` object. + +The following values are valid for this property (as defined in `constants` +module): + +* `DH_CHECK_P_NOT_SAFE_PRIME` +* `DH_CHECK_P_NOT_PRIME` +* `DH_UNABLE_TO_CHECK_GENERATOR` +* `DH_NOT_SUITABLE_GENERATOR` + +## Class: ECDH[#](#crypto_class_ecdh) + +Added in: v0.11.14 + +The `ECDH` class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH) +key exchanges. + +Instances of the `ECDH` class can be created using the +[`crypto.createECDH()`](#crypto_crypto_createecdh_curve_name) function. + +```None +const crypto = require('crypto'); +const assert = require('assert'); + +// Generate Alice's keys... +const alice = crypto.createECDH('secp521r1'); +const aliceKey = alice.generateKeys(); + +// Generate Bob's keys... +const bob = crypto.createECDH('secp521r1'); +const bobKey = bob.generateKeys(); + +// Exchange and generate the secret... +const aliceSecret = alice.computeSecret(bobKey); +const bobSecret = bob.computeSecret(aliceKey); + +assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); +// OK +``` + +### ecdh.computeSecret(other\_public\_key[, input\_encoding][, output\_encoding])[#](#crypto_ecdh_computesecret_other_public_key_input_encoding_output_encoding) + +Added in: v0.11.14 + +Computes the shared secret using `other_public_key` as the other +party's public key and returns the computed shared secret. The supplied +key is interpreted using specified `input_encoding`, and the returned secret +is encoded using the specified `output_encoding`. Encodings can be +`'latin1'`, `'hex'`, or `'base64'`. If the `input_encoding` is not +provided, `other_public_key` is expected to be a [`Buffer`](buffer.html). + +If `output_encoding` is given a string will be returned; otherwise a +[`Buffer`](buffer.html) is returned. + +### ecdh.generateKeys([encoding[, format]])[#](#crypto_ecdh_generatekeys_encoding_format) + +Added in: v0.11.14 + +Generates private and public EC Diffie-Hellman key values, and returns +the public key in the specified `format` and `encoding`. This key should be +transferred to the other party. + +The `format` arguments specifies point encoding and can be `'compressed'`, +`'uncompressed'`, or `'hybrid'`. If `format` is not specified, the point will +be returned in `'uncompressed'` format. + +The `encoding` argument can be `'latin1'`, `'hex'`, or `'base64'`. If +`encoding` is provided a string is returned; otherwise a [`Buffer`](buffer.html) +is returned. + +### ecdh.getPrivateKey([encoding])[#](#crypto_ecdh_getprivatekey_encoding) + +Added in: v0.11.14 + +Returns the EC Diffie-Hellman private key in the specified `encoding`, +which can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided +a string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### ecdh.getPublicKey([encoding[, format]])[#](#crypto_ecdh_getpublickey_encoding_format) + +Added in: v0.11.14 + +Returns the EC Diffie-Hellman public key in the specified `encoding` and +`format`. + +The `format` argument specifies point encoding and can be `'compressed'`, +`'uncompressed'`, or `'hybrid'`. If `format` is not specified the point will be +returned in `'uncompressed'` format. + +The `encoding` argument can be `'latin1'`, `'hex'`, or `'base64'`. If +`encoding` is specified, a string is returned; otherwise a [`Buffer`](buffer.html) is +returned. + +### ecdh.setPrivateKey(private\_key[, encoding])[#](#crypto_ecdh_setprivatekey_private_key_encoding) + +Added in: v0.11.14 + +Sets the EC Diffie-Hellman private key. The `encoding` can be `'latin1'`, +`'hex'` or `'base64'`. If `encoding` is provided, `private_key` is expected +to be a string; otherwise `private_key` is expected to be a [`Buffer`](buffer.html). If +`private_key` is not valid for the curve specified when the `ECDH` object was +created, an error is thrown. Upon setting the private key, the associated +public point (key) is also generated and set in the ECDH object. + +### ecdh.setPublicKey(public\_key[, encoding])[#](#crypto_ecdh_setpublickey_public_key_encoding) + +Added in: v0.11.14 +Deprecated since: v5.2.0 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated + +Sets the EC Diffie-Hellman public key. Key encoding can be `'latin1'`, +`'hex'` or `'base64'`. If `encoding` is provided `public_key` is expected to +be a string; otherwise a [`Buffer`](buffer.html) is expected. + +Note that there is not normally a reason to call this method because `ECDH` +only requires a private key and the other party's public key to compute the +shared secret. Typically either [`ecdh.generateKeys()`](#crypto_ecdh_generatekeys_encoding_format) or +[`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_private_key_encoding) will be called. The [`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_private_key_encoding) method +attempts to generate the public point/key associated with the private key being +set. + +Example (obtaining a shared secret): + +```None +const crypto = require('crypto'); +const alice = crypto.createECDH('secp256k1'); +const bob = crypto.createECDH('secp256k1'); + +// Note: This is a shortcut way to specify one of Alice's previous private +// keys. It would be unwise to use such a predictable private key in a real +// application. +alice.setPrivateKey( + crypto.createHash('sha256').update('alice', 'utf8').digest() +); + +// Bob uses a newly generated cryptographically strong +// pseudorandom key pair +bob.generateKeys(); + +const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +// aliceSecret and bobSecret should be the same shared secret value +console.log(aliceSecret === bobSecret); +``` + +## Class: Hash[#](#crypto_class_hash) + +Added in: v0.1.92 + +The `Hash` class is a utility for creating hash digests of data. It can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where data is written + to produce a computed hash digest on the readable side, or +* Using the [`hash.update()`](#crypto_hash_update_data_input_encoding) and [`hash.digest()`](#crypto_hash_digest_encoding) methods to produce the + computed hash. + +The [`crypto.createHash()`](#crypto_crypto_createhash_algorithm) method is used to create `Hash` instances. `Hash` +objects are not to be created directly using the `new` keyword. + +Example: Using `Hash` objects as streams: + +```None +const crypto = require('crypto'); +const hash = crypto.createHash('sha256'); + +hash.on('readable', () => { + const data = hash.read(); + if (data) { + console.log(data.toString('hex')); + // Prints: + // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 + } +}); + +hash.write('some data to hash'); +hash.end(); +``` + +Example: Using `Hash` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const hash = crypto.createHash('sha256'); + +const input = fs.createReadStream('test.js'); +input.pipe(hash).pipe(process.stdout); +``` + +Example: Using the [`hash.update()`](#crypto_hash_update_data_input_encoding) and [`hash.digest()`](#crypto_hash_digest_encoding) methods: + +```None +const crypto = require('crypto'); +const hash = crypto.createHash('sha256'); + +hash.update('some data to hash'); +console.log(hash.digest('hex')); +// Prints: +// 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 +``` + +### hash.digest([encoding])[#](#crypto_hash_digest_encoding) + +Added in: v0.1.92 + +Calculates the digest of all of the data passed to be hashed (using the +[`hash.update()`](#crypto_hash_update_data_input_encoding) method). The `encoding` can be `'hex'`, `'latin1'` or +`'base64'`. If `encoding` is provided a string will be returned; otherwise +a [`Buffer`](buffer.html) is returned. + +The `Hash` object can not be used again after `hash.digest()` method has been +called. Multiple calls will cause an error to be thrown. + +### hash.update(data[, input\_encoding])[#](#crypto_hash_update_data_input_encoding) + +Added in: v0.1.92 + +Updates the hash content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'latin1'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html) then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Hmac[#](#crypto_class_hmac) + +Added in: v0.1.94 + +The `Hmac` Class is a utility for creating cryptographic HMAC digests. It can +be used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where data is written + to produce a computed HMAC digest on the readable side, or +* Using the [`hmac.update()`](#crypto_hmac_update_data_input_encoding) and [`hmac.digest()`](#crypto_hmac_digest_encoding) methods to produce the + computed HMAC digest. + +The [`crypto.createHmac()`](#crypto_crypto_createhmac_algorithm_key) method is used to create `Hmac` instances. `Hmac` +objects are not to be created directly using the `new` keyword. + +Example: Using `Hmac` objects as streams: + +```None +const crypto = require('crypto'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +hmac.on('readable', () => { + const data = hmac.read(); + if (data) { + console.log(data.toString('hex')); + // Prints: + // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e + } +}); + +hmac.write('some data to hash'); +hmac.end(); +``` + +Example: Using `Hmac` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +const input = fs.createReadStream('test.js'); +input.pipe(hmac).pipe(process.stdout); +``` + +Example: Using the [`hmac.update()`](#crypto_hmac_update_data_input_encoding) and [`hmac.digest()`](#crypto_hmac_digest_encoding) methods: + +```None +const crypto = require('crypto'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +hmac.update('some data to hash'); +console.log(hmac.digest('hex')); +// Prints: +// 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e +``` + +### hmac.digest([encoding])[#](#crypto_hmac_digest_encoding) + +Added in: v0.1.94 + +Calculates the HMAC digest of all of the data passed using [`hmac.update()`](#crypto_hmac_update_data_input_encoding). +The `encoding` can be `'hex'`, `'latin1'` or `'base64'`. If `encoding` is +provided a string is returned; otherwise a [`Buffer`](buffer.html) is returned; + +The `Hmac` object can not be used again after `hmac.digest()` has been +called. Multiple calls to `hmac.digest()` will result in an error being thrown. + +### hmac.update(data[, input\_encoding])[#](#crypto_hmac_update_data_input_encoding) + +Added in: v0.1.94 + +Updates the `Hmac` content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'latin1'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html) then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Sign[#](#crypto_class_sign) + +Added in: v0.1.92 + +The `Sign` Class is a utility for generating signatures. It can be used in one +of two ways: + +* As a writable [stream](stream.html), where data to be signed is written and the + [`sign.sign()`](#crypto_sign_sign_private_key_output_format) method is used to generate and return the signature, or +* Using the [`sign.update()`](#crypto_sign_update_data_input_encoding) and [`sign.sign()`](#crypto_sign_sign_private_key_output_format) methods to produce the + signature. + +The [`crypto.createSign()`](#crypto_crypto_createsign_algorithm) method is used to create `Sign` instances. The +argument is the string name of the hash function to use. `Sign` objects are not +to be created directly using the `new` keyword. + +Example: Using `Sign` objects as streams: + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('SHA256'); + +sign.write('some data to sign'); +sign.end(); + +const privateKey = getPrivateKeySomehow(); +console.log(sign.sign(privateKey, 'hex')); +// Prints: the calculated signature using the specified private key and +// SHA-256. For RSA keys, the algorithm is RSASSA-PKCS1-v1_5 (see padding +// parameter below for RSASSA-PSS). For EC keys, the algorithm is ECDSA. +``` + +Example: Using the [`sign.update()`](#crypto_sign_update_data_input_encoding) and [`sign.sign()`](#crypto_sign_sign_private_key_output_format) methods: + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('SHA256'); + +sign.update('some data to sign'); + +const privateKey = getPrivateKeySomehow(); +console.log(sign.sign(privateKey, 'hex')); +// Prints: the calculated signature +``` + +In some cases, a `Sign` instance can also be created by passing in a signature +algorithm name, such as 'RSA-SHA256'. This will use the corresponding digest +algorithm. This does not work for all signature algorithms, such as +'ecdsa-with-SHA256'. Use digest names instead. + +Example: signing using legacy signature algorithm name + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('RSA-SHA256'); + +sign.update('some data to sign'); + +const privateKey = getPrivateKeySomehow(); +console.log(sign.sign(privateKey, 'hex')); +// Prints: the calculated signature +``` + +### sign.sign(private\_key[, output\_format])[#](#crypto_sign_sign_private_key_output_format) + +Added in: v0.1.92 + +Calculates the signature on all the data passed through using either +[`sign.update()`](#crypto_sign_update_data_input_encoding) or [`sign.write()`](stream.html#stream_writable_write_chunk_encoding_callback). + +The `private_key` argument can be an object or a string. If `private_key` is a +string, it is treated as a raw key with no passphrase. If `private_key` is an +object, it must contain one or more of the following properties: + +* `key`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded private key (required) +* `passphrase`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - passphrase for the private key +* `padding`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - Optional padding value for RSA, one of the following: + + + `crypto.constants.RSA_PKCS1_PADDING` (default) + + `crypto.constants.RSA_PKCS1_PSS_PADDING` + + Note that `RSA_PKCS1_PSS_PADDING` will use MGF1 with the same hash function + used to sign the message as specified in section 3.1 of [RFC 4055](https://www.rfc-editor.org/rfc/rfc4055.txt). +* `saltLength`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - salt length for when padding is + `RSA_PKCS1_PSS_PADDING`. The special value + `crypto.constants.RSA_PSS_SALTLEN_DIGEST` sets the salt length to the digest + size, `crypto.constants.RSA_PSS_SALTLEN_MAX_SIGN` (default) sets it to the + maximum permissible value. + +The `output_format` can specify one of `'latin1'`, `'hex'` or `'base64'`. If +`output_format` is provided a string is returned; otherwise a [`Buffer`](buffer.html) is +returned. + +The `Sign` object can not be again used after `sign.sign()` method has been +called. Multiple calls to `sign.sign()` will result in an error being thrown. + +### sign.update(data[, input\_encoding])[#](#crypto_sign_update_data_input_encoding) + +Added in: v0.1.92 + +Updates the `Sign` content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'latin1'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html) then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Verify[#](#crypto_class_verify) + +Added in: v0.1.92 + +The `Verify` class is a utility for verifying signatures. It can be used in one +of two ways: + +* As a writable [stream](stream.html) where written data is used to validate against the + supplied signature, or +* Using the [`verify.update()`](#crypto_verifier_update_data_input_encoding) and [`verify.verify()`](#crypto_verifier_verify_object_signature_signature_format) methods to verify + the signature. + +The [`crypto.createVerify()`](#crypto_crypto_createverify_algorithm) method is used to create `Verify` instances. +`Verify` objects are not to be created directly using the `new` keyword. + +Example: Using `Verify` objects as streams: + +```None +const crypto = require('crypto'); +const verify = crypto.createVerify('SHA256'); + +verify.write('some data to sign'); +verify.end(); + +const publicKey = getPublicKeySomehow(); +const signature = getSignatureToVerify(); +console.log(verify.verify(publicKey, signature)); +// Prints: true or false +``` + +Example: Using the [`verify.update()`](#crypto_verifier_update_data_input_encoding) and [`verify.verify()`](#crypto_verifier_verify_object_signature_signature_format) methods: + +```None +const crypto = require('crypto'); +const verify = crypto.createVerify('SHA256'); + +verify.update('some data to sign'); + +const publicKey = getPublicKeySomehow(); +const signature = getSignatureToVerify(); +console.log(verify.verify(publicKey, signature)); +// Prints: true or false +``` + +### verifier.update(data[, input\_encoding])[#](#crypto_verifier_update_data_input_encoding) + +Added in: v0.1.92 + +Updates the `Verify` content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'latin1'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html) then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +### verifier.verify(object, signature[, signature\_format])[#](#crypto_verifier_verify_object_signature_signature_format) + +Added in: v0.1.92 + +* `object` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) +* `signature` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) +* `signature_format` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Verifies the provided data using the given `object` and `signature`. +The `object` argument can be either a string containing a PEM encoded object, +which can be an RSA public key, a DSA public key, or an X.509 certificate, +or an object with one or more of the following properties: + +* `key`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded public key (required) +* `padding`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - Optional padding value for RSA, one of the following: + + + `crypto.constants.RSA_PKCS1_PADDING` (default) + + `crypto.constants.RSA_PKCS1_PSS_PADDING` + + Note that `RSA_PKCS1_PSS_PADDING` will use MGF1 with the same hash function + used to verify the message as specified in section 3.1 of [RFC 4055](https://www.rfc-editor.org/rfc/rfc4055.txt). +* `saltLength`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - salt length for when padding is + `RSA_PKCS1_PSS_PADDING`. The special value + `crypto.constants.RSA_PSS_SALTLEN_DIGEST` sets the salt length to the digest + size, `crypto.constants.RSA_PSS_SALTLEN_AUTO` (default) causes it to be + determined automatically. + +The `signature` argument is the previously calculated signature for the data, in +the `signature_format` which can be `'latin1'`, `'hex'` or `'base64'`. +If a `signature_format` is specified, the `signature` is expected to be a +string; otherwise `signature` is expected to be a [`Buffer`](buffer.html). + +Returns `true` or `false` depending on the validity of the signature for +the data and public key. + +The `verifier` object can not be used again after `verify.verify()` has been +called. Multiple calls to `verify.verify()` will result in an error being +thrown. + +## `crypto` module methods and properties[#](#crypto_crypto_module_methods_and_properties) + +### crypto.constants[#](#crypto_crypto_constants) + +Added in: v6.3.0 + +Returns an object containing commonly used constants for crypto and security +related operations. The specific constants currently defined are described in +[Crypto Constants](#crypto_crypto_constants_1). + +### crypto.DEFAULT\_ENCODING[#](#crypto_crypto_default_encoding) + +Added in: v0.9.3 + +The default encoding to use for functions that can take either strings +or [buffers](buffer.html). The default value is `'buffer'`, which makes methods +default to [`Buffer`](buffer.html) objects. + +The `crypto.DEFAULT_ENCODING` mechanism is provided for backwards compatibility +with legacy programs that expect `'latin1'` to be the default encoding. + +New applications should expect the default to be `'buffer'`. This property may +become deprecated in a future Node.js release. + +### crypto.fips[#](#crypto_crypto_fips) + +Added in: v6.0.0 + +Property for checking and controlling whether a FIPS compliant crypto provider is +currently in use. Setting to true requires a FIPS build of Node.js. + +### crypto.createCipher(algorithm, password)[#](#crypto_crypto_createcipher_algorithm_password) + +Added in: v0.1.94 + +Creates and returns a `Cipher` object that uses the given `algorithm` and +`password`. + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `password` is used to derive the cipher key and initialization vector (IV). +The value must be either a `'latin1'` encoded string or a [`Buffer`](buffer.html). + +The implementation of `crypto.createCipher()` derives keys using the OpenSSL +function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one +iteration, and no salt. The lack of salt allows dictionary attacks as the same +password always creates the same key. The low iteration count and +non-cryptographically secure hash algorithm allow passwords to be tested very +rapidly. + +In line with OpenSSL's recommendation to use PBKDF2 instead of +[`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) it is recommended that developers derive a key and IV on +their own using [`crypto.pbkdf2()`](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) and to use [`crypto.createCipheriv()`](#crypto_crypto_createcipheriv_algorithm_key_iv) +to create the `Cipher` object. Users should not use ciphers with counter mode +(e.g. CTR, GCM or CCM) in `crypto.createCipher()`. A warning is emitted when +they are used in order to avoid the risk of IV reuse that causes +vulnerabilities. For the case when IV is reused in GCM, see [Nonce-Disrespecting +Adversaries](https://github.com/nonce-disrespect/nonce-disrespect) for details. + +### crypto.createCipheriv(algorithm, key, iv)[#](#crypto_crypto_createcipheriv_algorithm_key_iv) + +Creates and returns a `Cipher` object, with the given `algorithm`, `key` and +initialization vector (`iv`). + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `key` is the raw key used by the `algorithm` and `iv` is an +[initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded strings or +[buffers](buffer.html). + +### crypto.createCredentials(details)[#](#crypto_crypto_createcredentials_details) + +Added in: v0.1.92 +Deprecated since: v0.11.13 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options) instead. + +* `details` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Identical to [`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options). + +The `crypto.createCredentials()` method is a deprecated function for creating +and returning a `tls.SecureContext`. It should not be used. Replace it with +[`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options) which has the exact same arguments and return +value. + +Returns a `tls.SecureContext`, as-if [`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options) had been +called. + +### crypto.createDecipher(algorithm, password)[#](#crypto_crypto_createdecipher_algorithm_password) + +Added in: v0.1.94 + +Creates and returns a `Decipher` object that uses the given `algorithm` and +`password` (key). + +The implementation of `crypto.createDecipher()` derives keys using the OpenSSL +function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one +iteration, and no salt. The lack of salt allows dictionary attacks as the same +password always creates the same key. The low iteration count and +non-cryptographically secure hash algorithm allow passwords to be tested very +rapidly. + +In line with OpenSSL's recommendation to use PBKDF2 instead of +[`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) it is recommended that developers derive a key and IV on +their own using [`crypto.pbkdf2()`](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) and to use [`crypto.createDecipheriv()`](#crypto_crypto_createdecipheriv_algorithm_key_iv) +to create the `Decipher` object. + +### crypto.createDecipheriv(algorithm, key, iv)[#](#crypto_crypto_createdecipheriv_algorithm_key_iv) + +Added in: v0.1.94 + +Creates and returns a `Decipher` object that uses the given `algorithm`, `key` +and initialization vector (`iv`). + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `key` is the raw key used by the `algorithm` and `iv` is an +[initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded strings, +[Buffers](buffer.html), `TypedArray`, or `DataView`s. + +### crypto.createDiffieHellman(prime[, prime\_encoding][, generator][, generator\_encoding])[#](#crypto_crypto_creatediffiehellman_prime_prime_encoding_generator_generator_encoding) + +Added in: v0.11.12 + +Creates a `DiffieHellman` key exchange object using the supplied `prime` and an +optional specific `generator`. + +The `generator` argument can be a number, string, or [`Buffer`](buffer.html). If +`generator` is not specified, the value `2` is used. + +The `prime_encoding` and `generator_encoding` arguments can be `'latin1'`, +`'hex'`, or `'base64'`. + +If `prime_encoding` is specified, `prime` is expected to be a string; otherwise +a [`Buffer`](buffer.html) is expected. + +If `generator_encoding` is specified, `generator` is expected to be a string; +otherwise either a number or [`Buffer`](buffer.html) is expected. + +### crypto.createDiffieHellman(prime\_length[, generator])[#](#crypto_crypto_creatediffiehellman_prime_length_generator) + +Added in: v0.5.0 + +Creates a `DiffieHellman` key exchange object and generates a prime of +`prime_length` bits using an optional specific numeric `generator`. +If `generator` is not specified, the value `2` is used. + +### crypto.createECDH(curve\_name)[#](#crypto_crypto_createecdh_curve_name) + +Added in: v0.11.14 + +Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a +predefined curve specified by the `curve_name` string. Use +[`crypto.getCurves()`](#crypto_crypto_getcurves) to obtain a list of available curve names. On recent +OpenSSL releases, `openssl ecparam -list_curves` will also display the name +and description of each available elliptic curve. + +### crypto.createHash(algorithm)[#](#crypto_crypto_createhash_algorithm) + +Added in: v0.1.92 + +Creates and returns a `Hash` object that can be used to generate hash digests +using the given `algorithm`. + +The `algorithm` is dependent on the available algorithms supported by the +version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. +On recent releases of OpenSSL, `openssl list-message-digest-algorithms` will +display the available digest algorithms. + +Example: generating the sha256 sum of a file + +```None +const filename = process.argv[2]; +const crypto = require('crypto'); +const fs = require('fs'); + +const hash = crypto.createHash('sha256'); + +const input = fs.createReadStream(filename); +input.on('readable', () => { + const data = input.read(); + if (data) + hash.update(data); + else { + console.log(`${hash.digest('hex')} ${filename}`); + } +}); +``` + +### crypto.createHmac(algorithm, key)[#](#crypto_crypto_createhmac_algorithm_key) + +Added in: v0.1.94 + +Creates and returns an `Hmac` object that uses the given `algorithm` and `key`. + +The `algorithm` is dependent on the available algorithms supported by the +version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. +On recent releases of OpenSSL, `openssl list-message-digest-algorithms` will +display the available digest algorithms. + +The `key` is the HMAC key used to generate the cryptographic HMAC hash. + +Example: generating the sha256 HMAC of a file + +```None +const filename = process.argv[2]; +const crypto = require('crypto'); +const fs = require('fs'); + +const hmac = crypto.createHmac('sha256', 'a secret'); + +const input = fs.createReadStream(filename); +input.on('readable', () => { + const data = input.read(); + if (data) + hmac.update(data); + else { + console.log(`${hmac.digest('hex')} ${filename}`); + } +}); +``` + +### crypto.createSign(algorithm)[#](#crypto_crypto_createsign_algorithm) + +Added in: v0.1.92 + +Creates and returns a `Sign` object that uses the given `algorithm`. +Use [`crypto.getHashes()`](#crypto_crypto_gethashes) to obtain an array of names of the available +signing algorithms. + +### crypto.createVerify(algorithm)[#](#crypto_crypto_createverify_algorithm) + +Added in: v0.1.92 + +Creates and returns a `Verify` object that uses the given algorithm. +Use [`crypto.getHashes()`](#crypto_crypto_gethashes) to obtain an array of names of the available +signing algorithms. + +### crypto.getCiphers()[#](#crypto_crypto_getciphers) + +Added in: v0.9.3 + +Returns an array with the names of the supported cipher algorithms. + +Example: + +```None +const ciphers = crypto.getCiphers(); +console.log(ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...] +``` + +### crypto.getCurves()[#](#crypto_crypto_getcurves) + +Added in: v2.3.0 + +Returns an array with the names of the supported elliptic curves. + +Example: + +```None +const curves = crypto.getCurves(); +console.log(curves); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...] +``` + +### crypto.getDiffieHellman(group\_name)[#](#crypto_crypto_getdiffiehellman_group_name) + +Added in: v0.7.5 + +Creates a predefined `DiffieHellman` key exchange object. The +supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in +[RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt), but see [Caveats](#crypto_support_for_weak_or_compromised_algorithms)) and `'modp14'`, `'modp15'`, +`'modp16'`, `'modp17'`, `'modp18'` (defined in [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt)). The +returned object mimics the interface of objects created by +[`crypto.createDiffieHellman()`](#crypto_crypto_creatediffiehellman_prime_prime_encoding_generator_generator_encoding), but will not allow changing +the keys (with [`diffieHellman.setPublicKey()`](#crypto_diffiehellman_setpublickey_public_key_encoding) for example). The +advantage of using this method is that the parties do not have to +generate nor exchange a group modulus beforehand, saving both processor +and communication time. + +Example (obtaining a shared secret): + +```None +const crypto = require('crypto'); +const alice = crypto.getDiffieHellman('modp14'); +const bob = crypto.getDiffieHellman('modp14'); + +alice.generateKeys(); +bob.generateKeys(); + +const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +/* aliceSecret and bobSecret should be the same */ +console.log(aliceSecret === bobSecret); +``` + +### crypto.getHashes()[#](#crypto_crypto_gethashes) + +Added in: v0.9.3 + +Returns an array of the names of the supported hash algorithms, +such as `RSA-SHA256`. + +Example: + +```None +const hashes = crypto.getHashes(); +console.log(hashes); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...] +``` + +### crypto.pbkdf2(password, salt, iterations, keylen, digest, callback)[#](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) + +Added in: v0.5.5 + +Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2) +implementation. A selected HMAC digest algorithm specified by `digest` is +applied to derive a key of the requested byte length (`keylen`) from the +`password`, `salt` and `iterations`. + +The supplied `callback` function is called with two arguments: `err` and +`derivedKey`. If an error occurs, `err` will be set; otherwise `err` will be +null. The successfully generated `derivedKey` will be passed as a [`Buffer`](buffer.html). + +The `iterations` argument must be a number set as high as possible. The +higher the number of iterations, the more secure the derived key will be, +but will take a longer amount of time to complete. + +The `salt` should also be as unique as possible. It is recommended that the +salts are random and their lengths are at least 16 bytes. See +[NIST SP 800-132](http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + +Example: + +```None +const crypto = require('crypto'); +crypto.pbkdf2('secret', 'salt', 100000, 512, 'sha512', (err, key) => { + if (err) throw err; + console.log(key.toString('hex')); // '3745e48...aa39b34' +}); +``` + +An array of supported digest functions can be retrieved using +[`crypto.getHashes()`](#crypto_crypto_gethashes). + +### crypto.pbkdf2Sync(password, salt, iterations, keylen, digest)[#](#crypto_crypto_pbkdf2sync_password_salt_iterations_keylen_digest) + +Added in: v0.9.3 + +Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) +implementation. A selected HMAC digest algorithm specified by `digest` is +applied to derive a key of the requested byte length (`keylen`) from the +`password`, `salt` and `iterations`. + +If an error occurs an Error will be thrown, otherwise the derived key will be +returned as a [`Buffer`](buffer.html). + +The `iterations` argument must be a number set as high as possible. The +higher the number of iterations, the more secure the derived key will be, +but will take a longer amount of time to complete. + +The `salt` should also be as unique as possible. It is recommended that the +salts are random and their lengths are at least 16 bytes. See +[NIST SP 800-132](http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + +Example: + +```None +const crypto = require('crypto'); +const key = crypto.pbkdf2Sync('secret', 'salt', 100000, 512, 'sha512'); +console.log(key.toString('hex')); // '3745e48...aa39b34' +``` + +An array of supported digest functions can be retrieved using +[`crypto.getHashes()`](#crypto_crypto_gethashes). + +### crypto.privateDecrypt(private\_key, buffer)[#](#crypto_crypto_privatedecrypt_private_key_buffer) + +Added in: v0.11.14 + +Decrypts `buffer` with `private_key`. + +`private_key` can be an object or a string. If `private_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. +If `private_key` is an object, it is interpreted as a hash object with the +keys: + +* `key`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded private key +* `passphrase`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - Optional passphrase for the private key +* `padding` : An optional padding value, one of the following: + + `crypto.constants.RSA_NO_PADDING` + + `crypto.constants.RSA_PKCS1_PADDING` + + `crypto.constants.RSA_PKCS1_OAEP_PADDING` + +All paddings are defined in `crypto.constants`. + +### crypto.timingSafeEqual(a, b)[#](#crypto_crypto_timingsafeequal_a_b) + +Added in: v6.6.0 + +This function is based on a constant-time algorithm. +Returns true if `a` is equal to `b`, without leaking timing information that +would allow an attacker to guess one of the values. This is suitable for +comparing HMAC digests or secret values like authentication cookies or +[capability urls](https://www.w3.org/TR/capability-urls/). + +`a` and `b` must both be `Buffer`s, and they must have the same length. + +**Note**: Use of `crypto.timingSafeEqual` does not guarantee that the +*surrounding* code is timing-safe. Care should be taken to ensure that the +surrounding code does not introduce timing vulnerabilities. + +### crypto.privateEncrypt(private\_key, buffer)[#](#crypto_crypto_privateencrypt_private_key_buffer) + +Added in: v1.1.0 + +Encrypts `buffer` with `private_key`. + +`private_key` can be an object or a string. If `private_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. +If `private_key` is an object, it is interpreted as a hash object with the +keys: + +* `key`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded private key +* `passphrase`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - Optional passphrase for the private key +* `padding` : An optional padding value, one of the following: + + `crypto.constants.RSA_NO_PADDING` + + `crypto.constants.RSA_PKCS1_PADDING` + +All paddings are defined in `crypto.constants`. + +### crypto.publicDecrypt(public\_key, buffer)[#](#crypto_crypto_publicdecrypt_public_key_buffer) + +Added in: v1.1.0 + +Decrypts `buffer` with `public_key`. + +`public_key` can be an object or a string. If `public_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. +If `public_key` is an object, it is interpreted as a hash object with the +keys: + +* `key`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded public key +* `passphrase`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - Optional passphrase for the private key +* `padding` : An optional padding value, one of the following: + + `crypto.constants.RSA_NO_PADDING` + + `crypto.constants.RSA_PKCS1_PADDING` + + `crypto.constants.RSA_PKCS1_OAEP_PADDING` + +Because RSA public keys can be derived from private keys, a private key may +be passed instead of a public key. + +All paddings are defined in `crypto.constants`. + +### crypto.publicEncrypt(public\_key, buffer)[#](#crypto_crypto_publicencrypt_public_key_buffer) + +Added in: v0.11.14 + +Encrypts `buffer` with `public_key`. + +`public_key` can be an object or a string. If `public_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. +If `public_key` is an object, it is interpreted as a hash object with the +keys: + +* `key`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded public key +* `passphrase`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - Optional passphrase for the private key +* `padding` : An optional padding value, one of the following: + + `crypto.constants.RSA_NO_PADDING` + + `crypto.constants.RSA_PKCS1_PADDING` + + `crypto.constants.RSA_PKCS1_OAEP_PADDING` + +Because RSA public keys can be derived from private keys, a private key may +be passed instead of a public key. + +All paddings are defined in `crypto.constants`. + +### crypto.randomBytes(size[, callback])[#](#crypto_crypto_randombytes_size_callback) + +Added in: v0.5.8 + +Generates cryptographically strong pseudo-random data. The `size` argument +is a number indicating the number of bytes to generate. + +If a `callback` function is provided, the bytes are generated asynchronously +and the `callback` function is invoked with two arguments: `err` and `buf`. +If an error occurs, `err` will be an Error object; otherwise it is null. The +`buf` argument is a [`Buffer`](buffer.html) containing the generated bytes. + +```None +// Asynchronous +const crypto = require('crypto'); +crypto.randomBytes(256, (err, buf) => { + if (err) throw err; + console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`); +}); +``` + +If the `callback` function is not provided, the random bytes are generated +synchronously and returned as a [`Buffer`](buffer.html). An error will be thrown if +there is a problem generating the bytes. + +```None +// Synchronous +const buf = crypto.randomBytes(256); +console.log( + `${buf.length} bytes of random data: ${buf.toString('hex')}`); +``` + +The `crypto.randomBytes()` method will not complete until there is +sufficient entropy available. +This should normally never take longer than a few milliseconds. The only time +when generating the random bytes may conceivably block for a longer period of +time is right after boot, when the whole system is still low on entropy. + +### crypto.randomFillSync(buffer[, offset][, size])[#](#crypto_crypto_randomfillsync_buffer_offset_size) + +Added in: v6.13.0 + +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) Must be supplied. +* `offset` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Defaults to `0`. +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Defaults to `buffer.length - offset`. + +Synchronous version of [`crypto.randomFill()`](#crypto_crypto_randomfill_buffer_offset_size_callback). + +Returns `buffer` + +```None +const buf = Buffer.alloc(10); +console.log(crypto.randomFillSync(buf).toString('hex')); + +crypto.randomFillSync(buf, 5); +console.log(buf.toString('hex')); + +// The above is equivalent to the following: +crypto.randomFillSync(buf, 5, 5); +console.log(buf.toString('hex')); +``` + +### crypto.randomFill(buffer[, offset][, size], callback)[#](#crypto_crypto_randomfill_buffer_offset_size_callback) + +Added in: v6.13.0 + +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) Must be supplied. +* `offset` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Defaults to `0`. +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Defaults to `buffer.length - offset`. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) `function(err, buf) {}`. + +This function is similar to [`crypto.randomBytes()`](#crypto_crypto_randombytes_size_callback) but requires the first +argument to be a [`Buffer`](buffer.html) that will be filled. It also +requires that a callback is passed in. + +If the `callback` function is not provided, an error will be thrown. + +```None +const buf = Buffer.alloc(10); +crypto.randomFill(buf, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); + +crypto.randomFill(buf, 5, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); + +// The above is equivalent to the following: +crypto.randomFill(buf, 5, 5, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); +``` + +### crypto.setEngine(engine[, flags])[#](#crypto_crypto_setengine_engine_flags) + +Added in: v0.11.11 + +Load and set the `engine` for some or all OpenSSL functions (selected by flags). + +`engine` could be either an id or a path to the engine's shared library. + +The optional `flags` argument uses `ENGINE_METHOD_ALL` by default. The `flags` +is a bit field taking one of or a mix of the following flags (defined in +`crypto.constants`): + +* `crypto.constants.ENGINE_METHOD_RSA` +* `crypto.constants.ENGINE_METHOD_DSA` +* `crypto.constants.ENGINE_METHOD_DH` +* `crypto.constants.ENGINE_METHOD_RAND` +* `crypto.constants.ENGINE_METHOD_ECDH` +* `crypto.constants.ENGINE_METHOD_ECDSA` +* `crypto.constants.ENGINE_METHOD_CIPHERS` +* `crypto.constants.ENGINE_METHOD_DIGESTS` +* `crypto.constants.ENGINE_METHOD_STORE` +* `crypto.constants.ENGINE_METHOD_PKEY_METHS` +* `crypto.constants.ENGINE_METHOD_PKEY_ASN1_METHS` +* `crypto.constants.ENGINE_METHOD_ALL` +* `crypto.constants.ENGINE_METHOD_NONE` + +## Notes[#](#crypto_notes) + +### Legacy Streams API (pre Node.js v0.10)[#](#crypto_legacy_streams_api_pre_node_js_v0_10) + +The Crypto module was added to Node.js before there was the concept of a +unified Stream API, and before there were [`Buffer`](buffer.html) objects for handling +binary data. As such, the many of the `crypto` defined classes have methods not +typically found on other Node.js classes that implement the [streams](stream.html) +API (e.g. `update()`, `final()`, or `digest()`). Also, many methods accepted +and returned `'latin1'` encoded strings by default rather than Buffers. This +default was changed after Node.js v0.8 to use [`Buffer`](buffer.html) objects by default +instead. + +### Recent ECDH Changes[#](#crypto_recent_ecdh_changes) + +Usage of `ECDH` with non-dynamically generated key pairs has been simplified. +Now, [`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_private_key_encoding) can be called with a preselected private key +and the associated public point (key) will be computed and stored in the object. +This allows code to only store and provide the private part of the EC key pair. +[`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_private_key_encoding) now also validates that the private key is valid for +the selected curve. + +The [`ecdh.setPublicKey()`](#crypto_ecdh_setpublickey_public_key_encoding) method is now deprecated as its inclusion in the +API is not useful. Either a previously stored private key should be set, which +automatically generates the associated public key, or [`ecdh.generateKeys()`](#crypto_ecdh_generatekeys_encoding_format) +should be called. The main drawback of using [`ecdh.setPublicKey()`](#crypto_ecdh_setpublickey_public_key_encoding) is that +it can be used to put the ECDH key pair into an inconsistent state. + +### Support for weak or compromised algorithms[#](#crypto_support_for_weak_or_compromised_algorithms) + +The `crypto` module still supports some algorithms which are already +compromised and are not currently recommended for use. The API also allows +the use of ciphers and hashes with a small key size that are considered to be +too weak for safe use. + +Users should take full responsibility for selecting the crypto +algorithm and key size according to their security requirements. + +Based on the recommendations of [NIST SP 800-131A](http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar1.pdf): + +* MD5 and SHA-1 are no longer acceptable where collision resistance is + required such as digital signatures. +* The key used with RSA, DSA and DH algorithms is recommended to have + at least 2048 bits and that of the curve of ECDSA and ECDH at least + 224 bits, to be safe to use for several years. +* The DH groups of `modp1`, `modp2` and `modp5` have a key size + smaller than 2048 bits and are not recommended. + +See the reference for other recommendations and details. + +## Crypto Constants[#](#crypto_crypto_constants_1) + +The following constants exported by `crypto.constants` apply to various uses of +the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL. + +### OpenSSL Options[#](#crypto_openssl_options) + +| Constant | Description | +| --- | --- | +| `SSL_OP_ALL` | Applies multiple bug workarounds within OpenSSL. See for detail. | +| `SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION` | Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See . | +| `SSL_OP_CIPHER_SERVER_PREFERENCE` | Attempts to use the server's preferences instead of the client's when selecting a cipher. Behavior depends on protocol version. See . | +| `SSL_OP_CISCO_ANYCONNECT` | Instructs OpenSSL to use Cisco's "speshul" version of DTLS\_BAD\_VER. | +| `SSL_OP_COOKIE_EXCHANGE` | Instructs OpenSSL to turn on cookie exchange. | +| `SSL_OP_CRYPTOPRO_TLSEXT_BUG` | Instructs OpenSSL to add server-hello extension from an early version of the cryptopro draft. | +| `SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS` | Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. | +| `SSL_OP_EPHEMERAL_RSA` | Instructs OpenSSL to always use the tmp\_rsa key when performing RSA operations. | +| `SSL_OP_LEGACY_SERVER_CONNECT` | Allows initial connection to servers that do not support RI. | +| `SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER` | | +| `SSL_OP_MICROSOFT_SESS_ID_BUG` | | +| `SSL_OP_MSIE_SSLV2_RSA_PADDING` | Instructs OpenSSL to disable the workaround for a man-in-the-middle protocol-version vulnerability in the SSL 2.0 server implementation. | +| `SSL_OP_NETSCAPE_CA_DN_BUG` | | +| `SSL_OP_NETSCAPE_CHALLENGE_BUG` | | +| `SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG` | | +| `SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG` | | +| `SSL_OP_NO_COMPRESSION` | Instructs OpenSSL to disable support for SSL/TLS compression. | +| `SSL_OP_NO_QUERY_MTU` | | +| `SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION` | Instructs OpenSSL to always start a new session when performing renegotiation. | +| `SSL_OP_NO_SSLv2` | Instructs OpenSSL to turn off SSL v2 | +| `SSL_OP_NO_SSLv3` | Instructs OpenSSL to turn off SSL v3 | +| `SSL_OP_NO_TICKET` | Instructs OpenSSL to disable use of RFC4507bis tickets. | +| `SSL_OP_NO_TLSv1` | Instructs OpenSSL to turn off TLS v1 | +| `SSL_OP_NO_TLSv1_1` | Instructs OpenSSL to turn off TLS v1.1 | +| `SSL_OP_NO_TLSv1_2` | Instructs OpenSSL to turn off TLS v1.2 | + `SSL_OP_PKCS1_CHECK_1` | || `SSL_OP_PKCS1_CHECK_2` | | +| `SSL_OP_SINGLE_DH_USE` | Instructs OpenSSL to always create a new key when using temporary/ephemeral DH parameters. | +| `SSL_OP_SINGLE_ECDH_USE` | Instructs OpenSSL to always create a new key when using temporary/ephemeral ECDH parameters. | + `SSL_OP_SSLEAY_080_CLIENT_DH_BUG` | || `SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG` | | +| `SSL_OP_TLS_BLOCK_PADDING_BUG` | | +| `SSL_OP_TLS_D5_BUG` | | +| `SSL_OP_TLS_ROLLBACK_BUG` | Instructs OpenSSL to disable version rollback attack detection. | + +### OpenSSL Engine Constants[#](#crypto_openssl_engine_constants) + +| Constant | Description | +| --- | --- | +| `ENGINE_METHOD_RSA` | Limit engine usage to RSA | +| `ENGINE_METHOD_DSA` | Limit engine usage to DSA | +| `ENGINE_METHOD_DH` | Limit engine usage to DH | +| `ENGINE_METHOD_RAND` | Limit engine usage to RAND | +| `ENGINE_METHOD_ECDH` | Limit engine usage to ECDH | +| `ENGINE_METHOD_ECDSA` | Limit engine usage to ECDSA | +| `ENGINE_METHOD_CIPHERS` | Limit engine usage to CIPHERS | +| `ENGINE_METHOD_DIGESTS` | Limit engine usage to DIGESTS | +| `ENGINE_METHOD_STORE` | Limit engine usage to STORE | +| `ENGINE_METHOD_PKEY_METHS` | Limit engine usage to PKEY\_METHDS | +| `ENGINE_METHOD_PKEY_ASN1_METHS` | Limit engine usage to PKEY\_ASN1\_METHS | +| `ENGINE_METHOD_ALL` | | +| `ENGINE_METHOD_NONE` | | + +### Other OpenSSL Constants[#](#crypto_other_openssl_constants) + +| Constant | Description | +| --- | --- | +| `DH_CHECK_P_NOT_SAFE_PRIME` | | +| `DH_CHECK_P_NOT_PRIME` | | +| `DH_UNABLE_TO_CHECK_GENERATOR` | | +| `DH_NOT_SUITABLE_GENERATOR` | | +| `NPN_ENABLED` | | +| `ALPN_ENABLED` | | +| `RSA_PKCS1_PADDING` | | +| `RSA_SSLV23_PADDING` | | +| `RSA_NO_PADDING` | | +| `RSA_PKCS1_OAEP_PADDING` | | +| `RSA_X931_PADDING` | | +| `RSA_PKCS1_PSS_PADDING` | | +| `RSA_PSS_SALTLEN_DIGEST` | Sets the salt length for `RSA_PKCS1_PSS_PADDING` to the digest size when signing or verifying. | +| `RSA_PSS_SALTLEN_MAX_SIGN` | Sets the salt length for `RSA_PKCS1_PSS_PADDING` to the maximum permissible value when signing data. | +| `RSA_PSS_SALTLEN_AUTO` | Causes the salt length for `RSA_PKCS1_PSS_PADDING` to be determined automatically when verifying a signature. | +| `POINT_CONVERSION_COMPRESSED` | | +| `POINT_CONVERSION_UNCOMPRESSED` | | +| `POINT_CONVERSION_HYBRID` | | + +### Node.js Crypto Constants[#](#crypto_node_js_crypto_constants) + +| Constant | Description | +| --- | --- | +| `defaultCoreCipherList` | Specifies the built-in default cipher list used by Node.js. | +| `defaultCipherList` | Specifies the active default cipher list used by the current Node.js process. | diff --git a/corpus/docs/nodejs/crypto/crypto_7x.md b/corpus/docs/nodejs/crypto/crypto_7x.md new file mode 100644 index 0000000000000000000000000000000000000000..00f8857075ff254187b014a20d14070fd88677e1 --- /dev/null +++ b/corpus/docs/nodejs/crypto/crypto_7x.md @@ -0,0 +1,1761 @@ +# Crypto# + +Source: https://nodejs.org/docs/latest-v7.x/api/crypto.html +Version: 7.x + +```None +Stability: 2 - Stable +``` + +The `crypto` module provides cryptographic functionality that includes a set of +wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign and verify functions. + +Use `require('crypto')` to access this module. + +```None +const crypto = require('crypto'); + +const secret = 'abcdefg'; +const hash = crypto.createHmac('sha256', secret) + .update('I love cupcakes') + .digest('hex'); +console.log(hash); +// Prints: +// c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e +``` + +## Determining if crypto support is unavailable[#](#crypto_determining_if_crypto_support_is_unavailable) + +It is possible for Node.js to be built without including support for the +`crypto` module. In such cases, calling `require('crypto')` will result in an +error being thrown. + +```None +let crypto; +try { + crypto = require('crypto'); +} catch (err) { + console.log('crypto support is disabled!'); +} +``` + +## Class: Certificate[#](#crypto_class_certificate) + +Added in: v0.11.8 + +SPKAC is a Certificate Signing Request mechanism originally implemented by +Netscape and now specified formally as part of [HTML5's `keygen` element](http://www.w3.org/TR/html5/forms.html#the-keygen-element). + +The `crypto` module provides the `Certificate` class for working with SPKAC +data. The most common usage is handling output generated by the HTML5 +`` element. Node.js uses [OpenSSL's SPKAC implementation](https://www.openssl.org/docs/man1.0.2/apps/spkac.html) internally. + +### new crypto.Certificate()[#](#crypto_new_crypto_certificate) + +Instances of the `Certificate` class can be created using the `new` keyword +or by calling `crypto.Certificate()` as a function: + +```None +const crypto = require('crypto'); + +const cert1 = new crypto.Certificate(); +const cert2 = crypto.Certificate(); +``` + +### certificate.exportChallenge(spkac)[#](#crypto_certificate_exportchallenge_spkac) + +Added in: v0.11.8 + +The `spkac` data structure includes a public key and a challenge. The +`certificate.exportChallenge()` returns the challenge component in the +form of a Node.js [`Buffer`](buffer.html). The `spkac` argument can be either a string +or a [`Buffer`](buffer.html). + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +const challenge = cert.exportChallenge(spkac); +console.log(challenge.toString('utf8')); +// Prints: the challenge as a UTF8 string +``` + +### certificate.exportPublicKey(spkac)[#](#crypto_certificate_exportpublickey_spkac) + +Added in: v0.11.8 + +The `spkac` data structure includes a public key and a challenge. The +`certificate.exportPublicKey()` returns the public key component in the +form of a Node.js [`Buffer`](buffer.html). The `spkac` argument can be either a string +or a [`Buffer`](buffer.html). + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +const publicKey = cert.exportPublicKey(spkac); +console.log(publicKey); +// Prints: the public key as +``` + +### certificate.verifySpkac(spkac)[#](#crypto_certificate_verifyspkac_spkac) + +Added in: v0.11.8 + +Returns `true` if the given `spkac` data structure is valid, `false` otherwise. +The `spkac` argument must be a Node.js [`Buffer`](buffer.html). + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +console.log(cert.verifySpkac(Buffer.from(spkac))); +// Prints: true or false +``` + +## Class: Cipher[#](#crypto_class_cipher) + +Added in: v0.1.94 + +Instances of the `Cipher` class are used to encrypt data. The class can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where plain unencrypted + data is written to produce encrypted data on the readable side, or +* Using the [`cipher.update()`](#crypto_cipher_update_data_input_encoding_output_encoding) and [`cipher.final()`](#crypto_cipher_final_output_encoding) methods to produce + the encrypted data. + +The [`crypto.createCipher()`](#crypto_crypto_createcipher_algorithm_password) or [`crypto.createCipheriv()`](#crypto_crypto_createcipheriv_algorithm_key_iv) methods are +used to create `Cipher` instances. `Cipher` objects are not to be created +directly using the `new` keyword. + +Example: Using `Cipher` objects as streams: + +```None +const crypto = require('crypto'); +const cipher = crypto.createCipher('aes192', 'a password'); + +let encrypted = ''; +cipher.on('readable', () => { + const data = cipher.read(); + if (data) + encrypted += data.toString('hex'); +}); +cipher.on('end', () => { + console.log(encrypted); + // Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 +}); + +cipher.write('some clear text data'); +cipher.end(); +``` + +Example: Using `Cipher` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const cipher = crypto.createCipher('aes192', 'a password'); + +const input = fs.createReadStream('test.js'); +const output = fs.createWriteStream('test.enc'); + +input.pipe(cipher).pipe(output); +``` + +Example: Using the [`cipher.update()`](#crypto_cipher_update_data_input_encoding_output_encoding) and [`cipher.final()`](#crypto_cipher_final_output_encoding) methods: + +```None +const crypto = require('crypto'); +const cipher = crypto.createCipher('aes192', 'a password'); + +let encrypted = cipher.update('some clear text data', 'utf8', 'hex'); +encrypted += cipher.final('hex'); +console.log(encrypted); +// Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 +``` + +### cipher.final([output\_encoding])[#](#crypto_cipher_final_output_encoding) + +Added in: v0.1.94 + +Returns any remaining enciphered contents. If `output_encoding` +parameter is one of `'latin1'`, `'base64'` or `'hex'`, a string is returned. +If an `output_encoding` is not provided, a [`Buffer`](buffer.html) is returned. + +Once the `cipher.final()` method has been called, the `Cipher` object can no +longer be used to encrypt data. Attempts to call `cipher.final()` more than +once will result in an error being thrown. + +### cipher.setAAD(buffer)[#](#crypto_cipher_setaad_buffer) + +Added in: v1.0.0 + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `cipher.setAAD()` method sets the value used for the +*additional authenticated data* (AAD) input parameter. + +Returns `this` for method chaining. + +### cipher.getAuthTag()[#](#crypto_cipher_getauthtag) + +Added in: v1.0.0 + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `cipher.getAuthTag()` method returns a [`Buffer`](buffer.html) containing +the *authentication tag* that has been computed from the given data. + +The `cipher.getAuthTag()` method should only be called after encryption has +been completed using the [`cipher.final()`](#crypto_cipher_final_output_encoding) method. + +### cipher.setAutoPadding(auto\_padding=true)[#](#crypto_cipher_setautopadding_auto_padding_true) + +Added in: v0.7.1 + +When using block encryption algorithms, the `Cipher` class will automatically +add padding to the input data to the appropriate block size. To disable the +default padding call `cipher.setAutoPadding(false)`. + +When `auto_padding` is `false`, the length of the entire input data must be a +multiple of the cipher's block size or [`cipher.final()`](#crypto_cipher_final_output_encoding) will throw an Error. +Disabling automatic padding is useful for non-standard padding, for instance +using `0x0` instead of PKCS padding. + +The `cipher.setAutoPadding()` method must be called before [`cipher.final()`](#crypto_cipher_final_output_encoding). + +Returns `this` for method chaining. + +### cipher.update(data[, input\_encoding][, output\_encoding])[#](#crypto_cipher_update_data_input_encoding_output_encoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `input_encoding` changed from `binary` to `utf8`. | +| v0.1.94 | Added in: v0.1.94 | + +Updates the cipher with `data`. If the `input_encoding` argument is given, +its value must be one of `'utf8'`, `'ascii'`, or `'latin1'` and the `data` +argument is a string using the specified encoding. If the `input_encoding` +argument is not given, `data` must be a [`Buffer`](buffer.html). If `data` is a +[`Buffer`](buffer.html) then `input_encoding` is ignored. + +The `output_encoding` specifies the output format of the enciphered +data, and can be `'latin1'`, `'base64'` or `'hex'`. If the `output_encoding` +is specified, a string using the specified encoding is returned. If no +`output_encoding` is provided, a [`Buffer`](buffer.html) is returned. + +The `cipher.update()` method can be called multiple times with new data until +[`cipher.final()`](#crypto_cipher_final_output_encoding) is called. Calling `cipher.update()` after +[`cipher.final()`](#crypto_cipher_final_output_encoding) will result in an error being thrown. + +## Class: Decipher[#](#crypto_class_decipher) + +Added in: v0.1.94 + +Instances of the `Decipher` class are used to decrypt data. The class can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where plain encrypted + data is written to produce unencrypted data on the readable side, or +* Using the [`decipher.update()`](#crypto_decipher_update_data_input_encoding_output_encoding) and [`decipher.final()`](#crypto_decipher_final_output_encoding) methods to + produce the unencrypted data. + +The [`crypto.createDecipher()`](#crypto_crypto_createdecipher_algorithm_password) or [`crypto.createDecipheriv()`](#crypto_crypto_createdecipheriv_algorithm_key_iv) methods are +used to create `Decipher` instances. `Decipher` objects are not to be created +directly using the `new` keyword. + +Example: Using `Decipher` objects as streams: + +```None +const crypto = require('crypto'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +let decrypted = ''; +decipher.on('readable', () => { + const data = decipher.read(); + if (data) + decrypted += data.toString('utf8'); +}); +decipher.on('end', () => { + console.log(decrypted); + // Prints: some clear text data +}); + +const encrypted = 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; +decipher.write(encrypted, 'hex'); +decipher.end(); +``` + +Example: Using `Decipher` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +const input = fs.createReadStream('test.enc'); +const output = fs.createWriteStream('test.js'); + +input.pipe(decipher).pipe(output); +``` + +Example: Using the [`decipher.update()`](#crypto_decipher_update_data_input_encoding_output_encoding) and [`decipher.final()`](#crypto_decipher_final_output_encoding) methods: + +```None +const crypto = require('crypto'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +const encrypted = 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; +let decrypted = decipher.update(encrypted, 'hex', 'utf8'); +decrypted += decipher.final('utf8'); +console.log(decrypted); +// Prints: some clear text data +``` + +### decipher.final([output\_encoding])[#](#crypto_decipher_final_output_encoding) + +Added in: v0.1.94 + +Returns any remaining deciphered contents. If `output_encoding` +parameter is one of `'latin1'`, `'ascii'` or `'utf8'`, a string is returned. +If an `output_encoding` is not provided, a [`Buffer`](buffer.html) is returned. + +Once the `decipher.final()` method has been called, the `Decipher` object can +no longer be used to decrypt data. Attempts to call `decipher.final()` more +than once will result in an error being thrown. + +### decipher.setAAD(buffer)[#](#crypto_decipher_setaad_buffer) + +History + +| Version | Changes | +| --- | --- | +| v7.2.0 | This method now returns a reference to `decipher`. | +| v1.0.0 | Added in: v1.0.0 | + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `decipher.setAAD()` method sets the value used for the +*additional authenticated data* (AAD) input parameter. + +Returns `this` for method chaining. + +### decipher.setAuthTag(buffer)[#](#crypto_decipher_setauthtag_buffer) + +History + +| Version | Changes | +| --- | --- | +| v7.2.0 | This method now returns a reference to `decipher`. | +| v1.0.0 | Added in: v1.0.0 | + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `decipher.setAuthTag()` method is used to pass in the +received *authentication tag*. If no tag is provided, or if the cipher text +has been tampered with, [`decipher.final()`](#crypto_decipher_final_output_encoding) with throw, indicating that the +cipher text should be discarded due to failed authentication. + +Returns `this` for method chaining. + +### decipher.setAutoPadding(auto\_padding=true)[#](#crypto_decipher_setautopadding_auto_padding_true) + +Added in: v0.7.1 + +When data has been encrypted without standard block padding, calling +`decipher.setAutoPadding(false)` will disable automatic padding to prevent +[`decipher.final()`](#crypto_decipher_final_output_encoding) from checking for and removing padding. + +Turning auto padding off will only work if the input data's length is a +multiple of the ciphers block size. + +The `decipher.setAutoPadding()` method must be called before +[`decipher.update()`](#crypto_decipher_update_data_input_encoding_output_encoding). + +Returns `this` for method chaining. + +### decipher.update(data[, input\_encoding][, output\_encoding])[#](#crypto_decipher_update_data_input_encoding_output_encoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `input_encoding` changed from `binary` to `utf8`. | +| v0.1.94 | Added in: v0.1.94 | + +Updates the decipher with `data`. If the `input_encoding` argument is given, +its value must be one of `'latin1'`, `'base64'`, or `'hex'` and the `data` +argument is a string using the specified encoding. If the `input_encoding` +argument is not given, `data` must be a [`Buffer`](buffer.html). If `data` is a +[`Buffer`](buffer.html) then `input_encoding` is ignored. + +The `output_encoding` specifies the output format of the enciphered +data, and can be `'latin1'`, `'ascii'` or `'utf8'`. If the `output_encoding` +is specified, a string using the specified encoding is returned. If no +`output_encoding` is provided, a [`Buffer`](buffer.html) is returned. + +The `decipher.update()` method can be called multiple times with new data until +[`decipher.final()`](#crypto_decipher_final_output_encoding) is called. Calling `decipher.update()` after +[`decipher.final()`](#crypto_decipher_final_output_encoding) will result in an error being thrown. + +## Class: DiffieHellman[#](#crypto_class_diffiehellman) + +Added in: v0.5.0 + +The `DiffieHellman` class is a utility for creating Diffie-Hellman key +exchanges. + +Instances of the `DiffieHellman` class can be created using the +[`crypto.createDiffieHellman()`](#crypto_crypto_creatediffiehellman_prime_prime_encoding_generator_generator_encoding) function. + +```None +const crypto = require('crypto'); +const assert = require('assert'); + +// Generate Alice's keys... +const alice = crypto.createDiffieHellman(2048); +const aliceKey = alice.generateKeys(); + +// Generate Bob's keys... +const bob = crypto.createDiffieHellman(alice.getPrime(), alice.getGenerator()); +const bobKey = bob.generateKeys(); + +// Exchange and generate the secret... +const aliceSecret = alice.computeSecret(bobKey); +const bobSecret = bob.computeSecret(aliceKey); + +// OK +assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); +``` + +### diffieHellman.computeSecret(other\_public\_key[, input\_encoding][, output\_encoding])[#](#crypto_diffiehellman_computesecret_other_public_key_input_encoding_output_encoding) + +Added in: v0.5.0 + +Computes the shared secret using `other_public_key` as the other +party's public key and returns the computed shared secret. The supplied +key is interpreted using the specified `input_encoding`, and secret is +encoded using specified `output_encoding`. Encodings can be +`'latin1'`, `'hex'`, or `'base64'`. If the `input_encoding` is not +provided, `other_public_key` is expected to be a [`Buffer`](buffer.html). + +If `output_encoding` is given a string is returned; otherwise, a +[`Buffer`](buffer.html) is returned. + +### diffieHellman.generateKeys([encoding])[#](#crypto_diffiehellman_generatekeys_encoding) + +Added in: v0.5.0 + +Generates private and public Diffie-Hellman key values, and returns +the public key in the specified `encoding`. This key should be +transferred to the other party. Encoding can be `'latin1'`, `'hex'`, +or `'base64'`. If `encoding` is provided a string is returned; otherwise a +[`Buffer`](buffer.html) is returned. + +### diffieHellman.getGenerator([encoding])[#](#crypto_diffiehellman_getgenerator_encoding) + +Added in: v0.5.0 + +Returns the Diffie-Hellman generator in the specified `encoding`, which can +be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is +returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPrime([encoding])[#](#crypto_diffiehellman_getprime_encoding) + +Added in: v0.5.0 + +Returns the Diffie-Hellman prime in the specified `encoding`, which can +be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is +returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPrivateKey([encoding])[#](#crypto_diffiehellman_getprivatekey_encoding) + +Added in: v0.5.0 + +Returns the Diffie-Hellman private key in the specified `encoding`, +which can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a +string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPublicKey([encoding])[#](#crypto_diffiehellman_getpublickey_encoding) + +Added in: v0.5.0 + +Returns the Diffie-Hellman public key in the specified `encoding`, which +can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a +string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.setPrivateKey(private\_key[, encoding])[#](#crypto_diffiehellman_setprivatekey_private_key_encoding) + +Added in: v0.5.0 + +Sets the Diffie-Hellman private key. If the `encoding` argument is provided +and is either `'latin1'`, `'hex'`, or `'base64'`, `private_key` is expected +to be a string. If no `encoding` is provided, `private_key` is expected +to be a [`Buffer`](buffer.html). + +### diffieHellman.setPublicKey(public\_key[, encoding])[#](#crypto_diffiehellman_setpublickey_public_key_encoding) + +Added in: v0.5.0 + +Sets the Diffie-Hellman public key. If the `encoding` argument is provided +and is either `'latin1'`, `'hex'` or `'base64'`, `public_key` is expected +to be a string. If no `encoding` is provided, `public_key` is expected +to be a [`Buffer`](buffer.html). + +### diffieHellman.verifyError[#](#crypto_diffiehellman_verifyerror) + +Added in: v0.11.12 + +A bit field containing any warnings and/or errors resulting from a check +performed during initialization of the `DiffieHellman` object. + +The following values are valid for this property (as defined in `constants` +module): + +* `DH_CHECK_P_NOT_SAFE_PRIME` +* `DH_CHECK_P_NOT_PRIME` +* `DH_UNABLE_TO_CHECK_GENERATOR` +* `DH_NOT_SUITABLE_GENERATOR` + +## Class: ECDH[#](#crypto_class_ecdh) + +Added in: v0.11.14 + +The `ECDH` class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH) +key exchanges. + +Instances of the `ECDH` class can be created using the +[`crypto.createECDH()`](#crypto_crypto_createecdh_curve_name) function. + +```None +const crypto = require('crypto'); +const assert = require('assert'); + +// Generate Alice's keys... +const alice = crypto.createECDH('secp521r1'); +const aliceKey = alice.generateKeys(); + +// Generate Bob's keys... +const bob = crypto.createECDH('secp521r1'); +const bobKey = bob.generateKeys(); + +// Exchange and generate the secret... +const aliceSecret = alice.computeSecret(bobKey); +const bobSecret = bob.computeSecret(aliceKey); + +assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); + // OK +``` + +### ecdh.computeSecret(other\_public\_key[, input\_encoding][, output\_encoding])[#](#crypto_ecdh_computesecret_other_public_key_input_encoding_output_encoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `input_encoding` changed from `binary` to `utf8`. | +| v0.11.14 | Added in: v0.11.14 | + +Computes the shared secret using `other_public_key` as the other +party's public key and returns the computed shared secret. The supplied +key is interpreted using specified `input_encoding`, and the returned secret +is encoded using the specified `output_encoding`. Encodings can be +`'latin1'`, `'hex'`, or `'base64'`. If the `input_encoding` is not +provided, `other_public_key` is expected to be a [`Buffer`](buffer.html). + +If `output_encoding` is given a string will be returned; otherwise a +[`Buffer`](buffer.html) is returned. + +### ecdh.generateKeys([encoding[, format]])[#](#crypto_ecdh_generatekeys_encoding_format) + +Added in: v0.11.14 + +Generates private and public EC Diffie-Hellman key values, and returns +the public key in the specified `format` and `encoding`. This key should be +transferred to the other party. + +The `format` argument specifies point encoding and can be `'compressed'` or +`'uncompressed'`. If `format` is not specified, the point will be returned in +`'uncompressed'` format. + +The `encoding` argument can be `'latin1'`, `'hex'`, or `'base64'`. If +`encoding` is provided a string is returned; otherwise a [`Buffer`](buffer.html) +is returned. + +### ecdh.getPrivateKey([encoding])[#](#crypto_ecdh_getprivatekey_encoding) + +Added in: v0.11.14 + +Returns the EC Diffie-Hellman private key in the specified `encoding`, +which can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided +a string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### ecdh.getPublicKey([encoding[, format]])[#](#crypto_ecdh_getpublickey_encoding_format) + +Added in: v0.11.14 + +Returns the EC Diffie-Hellman public key in the specified `encoding` and +`format`. + +The `format` argument specifies point encoding and can be `'compressed'` or +`'uncompressed'`. If `format` is not specified the point will be returned in +`'uncompressed'` format. + +The `encoding` argument can be `'latin1'`, `'hex'`, or `'base64'`. If +`encoding` is specified, a string is returned; otherwise a [`Buffer`](buffer.html) is +returned. + +### ecdh.setPrivateKey(private\_key[, encoding])[#](#crypto_ecdh_setprivatekey_private_key_encoding) + +Added in: v0.11.14 + +Sets the EC Diffie-Hellman private key. The `encoding` can be `'latin1'`, +`'hex'` or `'base64'`. If `encoding` is provided, `private_key` is expected +to be a string; otherwise `private_key` is expected to be a [`Buffer`](buffer.html). If +`private_key` is not valid for the curve specified when the `ECDH` object was +created, an error is thrown. Upon setting the private key, the associated +public point (key) is also generated and set in the ECDH object. + +### ecdh.setPublicKey(public\_key[, encoding])[#](#crypto_ecdh_setpublickey_public_key_encoding) + +Added in: v0.11.14Deprecated since: v5.2.0 + +```None +Stability: 0 - Deprecated +``` + +Sets the EC Diffie-Hellman public key. Key encoding can be `'latin1'`, +`'hex'` or `'base64'`. If `encoding` is provided `public_key` is expected to +be a string; otherwise a [`Buffer`](buffer.html) is expected. + +Note that there is not normally a reason to call this method because `ECDH` +only requires a private key and the other party's public key to compute the +shared secret. Typically either [`ecdh.generateKeys()`](#crypto_ecdh_generatekeys_encoding_format) or +[`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_private_key_encoding) will be called. The [`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_private_key_encoding) method +attempts to generate the public point/key associated with the private key being +set. + +Example (obtaining a shared secret): + +```None +const crypto = require('crypto'); +const alice = crypto.createECDH('secp256k1'); +const bob = crypto.createECDH('secp256k1'); + +// Note: This is a shortcut way to specify one of Alice's previous private +// keys. It would be unwise to use such a predictable private key in a real +// application. +alice.setPrivateKey( + crypto.createHash('sha256').update('alice', 'utf8').digest() +); + +// Bob uses a newly generated cryptographically strong +// pseudorandom key pair +bob.generateKeys(); + +const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +// aliceSecret and bobSecret should be the same shared secret value +console.log(aliceSecret === bobSecret); +``` + +## Class: Hash[#](#crypto_class_hash) + +Added in: v0.1.92 + +The `Hash` class is a utility for creating hash digests of data. It can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where data is written + to produce a computed hash digest on the readable side, or +* Using the [`hash.update()`](#crypto_hash_update_data_input_encoding) and [`hash.digest()`](#crypto_hash_digest_encoding) methods to produce the + computed hash. + +The [`crypto.createHash()`](#crypto_crypto_createhash_algorithm) method is used to create `Hash` instances. `Hash` +objects are not to be created directly using the `new` keyword. + +Example: Using `Hash` objects as streams: + +```None +const crypto = require('crypto'); +const hash = crypto.createHash('sha256'); + +hash.on('readable', () => { + const data = hash.read(); + if (data) + console.log(data.toString('hex')); + // Prints: + // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 +}); + +hash.write('some data to hash'); +hash.end(); +``` + +Example: Using `Hash` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const hash = crypto.createHash('sha256'); + +const input = fs.createReadStream('test.js'); +input.pipe(hash).pipe(process.stdout); +``` + +Example: Using the [`hash.update()`](#crypto_hash_update_data_input_encoding) and [`hash.digest()`](#crypto_hash_digest_encoding) methods: + +```None +const crypto = require('crypto'); +const hash = crypto.createHash('sha256'); + +hash.update('some data to hash'); +console.log(hash.digest('hex')); +// Prints: +// 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 +``` + +### hash.digest([encoding])[#](#crypto_hash_digest_encoding) + +Added in: v0.1.92 + +Calculates the digest of all of the data passed to be hashed (using the +[`hash.update()`](#crypto_hash_update_data_input_encoding) method). The `encoding` can be `'hex'`, `'latin1'` or +`'base64'`. If `encoding` is provided a string will be returned; otherwise +a [`Buffer`](buffer.html) is returned. + +The `Hash` object can not be used again after `hash.digest()` method has been +called. Multiple calls will cause an error to be thrown. + +### hash.update(data[, input\_encoding])[#](#crypto_hash_update_data_input_encoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `input_encoding` changed from `binary` to `utf8`. | +| v0.1.92 | Added in: v0.1.92 | + +Updates the hash content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'latin1'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html) then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Hmac[#](#crypto_class_hmac) + +Added in: v0.1.94 + +The `Hmac` Class is a utility for creating cryptographic HMAC digests. It can +be used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where data is written + to produce a computed HMAC digest on the readable side, or +* Using the [`hmac.update()`](#crypto_hmac_update_data_input_encoding) and [`hmac.digest()`](#crypto_hmac_digest_encoding) methods to produce the + computed HMAC digest. + +The [`crypto.createHmac()`](#crypto_crypto_createhmac_algorithm_key) method is used to create `Hmac` instances. `Hmac` +objects are not to be created directly using the `new` keyword. + +Example: Using `Hmac` objects as streams: + +```None +const crypto = require('crypto'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +hmac.on('readable', () => { + const data = hmac.read(); + if (data) + console.log(data.toString('hex')); + // Prints: + // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e +}); + +hmac.write('some data to hash'); +hmac.end(); +``` + +Example: Using `Hmac` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +const input = fs.createReadStream('test.js'); +input.pipe(hmac).pipe(process.stdout); +``` + +Example: Using the [`hmac.update()`](#crypto_hmac_update_data_input_encoding) and [`hmac.digest()`](#crypto_hmac_digest_encoding) methods: + +```None +const crypto = require('crypto'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +hmac.update('some data to hash'); +console.log(hmac.digest('hex')); +// Prints: +// 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e +``` + +### hmac.digest([encoding])[#](#crypto_hmac_digest_encoding) + +Added in: v0.1.94 + +Calculates the HMAC digest of all of the data passed using [`hmac.update()`](#crypto_hmac_update_data_input_encoding). +The `encoding` can be `'hex'`, `'latin1'` or `'base64'`. If `encoding` is +provided a string is returned; otherwise a [`Buffer`](buffer.html) is returned; + +The `Hmac` object can not be used again after `hmac.digest()` has been +called. Multiple calls to `hmac.digest()` will result in an error being thrown. + +### hmac.update(data[, input\_encoding])[#](#crypto_hmac_update_data_input_encoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `input_encoding` changed from `binary` to `utf8`. | +| v0.1.94 | Added in: v0.1.94 | + +Updates the `Hmac` content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'latin1'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html) then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Sign[#](#crypto_class_sign) + +Added in: v0.1.92 + +The `Sign` Class is a utility for generating signatures. It can be used in one +of two ways: + +* As a writable [stream](stream.html), where data to be signed is written and the + [`sign.sign()`](#crypto_sign_sign_private_key_output_format) method is used to generate and return the signature, or +* Using the [`sign.update()`](#crypto_sign_update_data_input_encoding) and [`sign.sign()`](#crypto_sign_sign_private_key_output_format) methods to produce the + signature. + +The [`crypto.createSign()`](#crypto_crypto_createsign_algorithm) method is used to create `Sign` instances. `Sign` +objects are not to be created directly using the `new` keyword. + +Example: Using `Sign` objects as streams: + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('RSA-SHA256'); + +sign.write('some data to sign'); +sign.end(); + +const privateKey = getPrivateKeySomehow(); +console.log(sign.sign(privateKey, 'hex')); +// Prints: the calculated signature +``` + +Example: Using the [`sign.update()`](#crypto_sign_update_data_input_encoding) and [`sign.sign()`](#crypto_sign_sign_private_key_output_format) methods: + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('RSA-SHA256'); + +sign.update('some data to sign'); + +const privateKey = getPrivateKeySomehow(); +console.log(sign.sign(privateKey, 'hex')); +// Prints: the calculated signature +``` + +A `Sign` instance can also be created by just passing in the digest +algorithm name, in which case OpenSSL will infer the full signature algorithm +from the type of the PEM-formatted private key, including algorithms that +do not have directly exposed name constants, e.g. 'ecdsa-with-SHA256'. + +Example: signing using ECDSA with SHA256 + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('sha256'); + +sign.update('some data to sign'); + +const privateKey = +`-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIF+jnWY1D5kbVYDNvxxo/Y+ku2uJPDwS0r/VuPZQrjjVoAoGCCqGSM49 +AwEHoUQDQgAEurOxfSxmqIRYzJVagdZfMMSjRNNhB8i3mXyIMq704m2m52FdfKZ2 +pQhByd5eyj3lgZ7m7jbchtdgyOF8Io/1ng== +-----END EC PRIVATE KEY-----`; + +console.log(sign.sign(privateKey).toString('hex')); +``` + +### sign.sign(private\_key[, output\_format])[#](#crypto_sign_sign_private_key_output_format) + +Added in: v0.1.92 + +Calculates the signature on all the data passed through using either +[`sign.update()`](#crypto_sign_update_data_input_encoding) or [`sign.write()`](stream.html#stream_writable_write_chunk_encoding_callback). + +The `private_key` argument can be an object or a string. If `private_key` is a +string, it is treated as a raw key with no passphrase. If `private_key` is an +object, it is interpreted as a hash containing two properties: + +* `key`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded private key +* `passphrase`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - passphrase for the private key + +The `output_format` can specify one of `'latin1'`, `'hex'` or `'base64'`. If +`output_format` is provided a string is returned; otherwise a [`Buffer`](buffer.html) is +returned. + +The `Sign` object can not be again used after `sign.sign()` method has been +called. Multiple calls to `sign.sign()` will result in an error being thrown. + +### sign.update(data[, input\_encoding])[#](#crypto_sign_update_data_input_encoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `input_encoding` changed from `binary` to `utf8`. | +| v0.1.92 | Added in: v0.1.92 | + +Updates the `Sign` content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'latin1'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html) then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Verify[#](#crypto_class_verify) + +Added in: v0.1.92 + +The `Verify` class is a utility for verifying signatures. It can be used in one +of two ways: + +* As a writable [stream](stream.html) where written data is used to validate against the + supplied signature, or +* Using the [`verify.update()`](#crypto_verifier_update_data_input_encoding) and [`verify.verify()`](#crypto_verifier_verify_object_signature_signature_format) methods to verify + the signature. + +The [`crypto.createVerify()`](#crypto_crypto_createverify_algorithm) method is used to create `Verify` instances. +`Verify` objects are not to be created directly using the `new` keyword. + +Example: Using `Verify` objects as streams: + +```None +const crypto = require('crypto'); +const verify = crypto.createVerify('RSA-SHA256'); + +verify.write('some data to sign'); +verify.end(); + +const publicKey = getPublicKeySomehow(); +const signature = getSignatureToVerify(); +console.log(verify.verify(publicKey, signature)); +// Prints: true or false +``` + +Example: Using the [`verify.update()`](#crypto_verifier_update_data_input_encoding) and [`verify.verify()`](#crypto_verifier_verify_object_signature_signature_format) methods: + +```None +const crypto = require('crypto'); +const verify = crypto.createVerify('RSA-SHA256'); + +verify.update('some data to sign'); + +const publicKey = getPublicKeySomehow(); +const signature = getSignatureToVerify(); +console.log(verify.verify(publicKey, signature)); +// Prints: true or false +``` + +### verifier.update(data[, input\_encoding])[#](#crypto_verifier_update_data_input_encoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `input_encoding` changed from `binary` to `utf8`. | +| v0.1.92 | Added in: v0.1.92 | + +Updates the `Verify` content with the given `data`, the encoding of which +is given in `input_encoding` and can be `'utf8'`, `'ascii'` or +`'latin1'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html) then +`input_encoding` is ignored. + +This can be called many times with new data as it is streamed. + +### verifier.verify(object, signature[, signature\_format])[#](#crypto_verifier_verify_object_signature_signature_format) + +Added in: v0.1.92 + +Verifies the provided data using the given `object` and `signature`. +The `object` argument is a string containing a PEM encoded object, which can be +one an RSA public key, a DSA public key, or an X.509 certificate. +The `signature` argument is the previously calculated signature for the data, in +the `signature_format` which can be `'latin1'`, `'hex'` or `'base64'`. +If a `signature_format` is specified, the `signature` is expected to be a +string; otherwise `signature` is expected to be a [`Buffer`](buffer.html). + +Returns `true` or `false` depending on the validity of the signature for +the data and public key. + +The `verifier` object can not be used again after `verify.verify()` has been +called. Multiple calls to `verify.verify()` will result in an error being +thrown. + +## `crypto` module methods and properties[#](#crypto_crypto_module_methods_and_properties) + +### crypto.constants[#](#crypto_crypto_constants) + +Added in: v6.3.0 + +Returns an object containing commonly used constants for crypto and security +related operations. The specific constants currently defined are described in +[Crypto Constants](#crypto_crypto_constants_1). + +### crypto.DEFAULT\_ENCODING[#](#crypto_crypto_default_encoding) + +Added in: v0.9.3 + +The default encoding to use for functions that can take either strings +or [buffers](buffer.html). The default value is `'buffer'`, which makes methods +default to [`Buffer`](buffer.html) objects. + +The `crypto.DEFAULT_ENCODING` mechanism is provided for backwards compatibility +with legacy programs that expect `'latin1'` to be the default encoding. + +New applications should expect the default to be `'buffer'`. This property may +become deprecated in a future Node.js release. + +### crypto.fips[#](#crypto_crypto_fips) + +Added in: v6.0.0 + +Property for checking and controlling whether a FIPS compliant crypto provider is +currently in use. Setting to true requires a FIPS build of Node.js. + +### crypto.createCipher(algorithm, password)[#](#crypto_crypto_createcipher_algorithm_password) + +Added in: v0.1.94 + +Creates and returns a `Cipher` object that uses the given `algorithm` and +`password`. + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `password` is used to derive the cipher key and initialization vector (IV). +The value must be either a `'latin1'` encoded string or a [`Buffer`](buffer.html). + +The implementation of `crypto.createCipher()` derives keys using the OpenSSL +function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one +iteration, and no salt. The lack of salt allows dictionary attacks as the same +password always creates the same key. The low iteration count and +non-cryptographically secure hash algorithm allow passwords to be tested very +rapidly. + +In line with OpenSSL's recommendation to use pbkdf2 instead of +[`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) it is recommended that developers derive a key and IV on +their own using [`crypto.pbkdf2()`](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) and to use [`crypto.createCipheriv()`](#crypto_crypto_createcipheriv_algorithm_key_iv) +to create the `Cipher` object. + +### crypto.createCipheriv(algorithm, key, iv)[#](#crypto_crypto_createcipheriv_algorithm_key_iv) + +Creates and returns a `Cipher` object, with the given `algorithm`, `key` and +initialization vector (`iv`). + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `key` is the raw key used by the `algorithm` and `iv` is an +[initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded strings or +[buffers](buffer.html). + +### crypto.createCredentials(details)[#](#crypto_crypto_createcredentials_details) + +Added in: v0.1.92Deprecated since: v0.11.13 + +```None +Stability: 0 - Deprecated: Use tls.createSecureContext() instead. +``` + +* `details` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Identical to [`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options). + +The `crypto.createCredentials()` method is a deprecated function for creating +and returning a `tls.SecureContext`. It should not be used. Replace it with +[`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options) which has the exact same arguments and return +value. + +Returns a `tls.SecureContext`, as-if [`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options) had been +called. + +### crypto.createDecipher(algorithm, password)[#](#crypto_crypto_createdecipher_algorithm_password) + +Added in: v0.1.94 + +Creates and returns a `Decipher` object that uses the given `algorithm` and +`password` (key). + +The implementation of `crypto.createDecipher()` derives keys using the OpenSSL +function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one +iteration, and no salt. The lack of salt allows dictionary attacks as the same +password always creates the same key. The low iteration count and +non-cryptographically secure hash algorithm allow passwords to be tested very +rapidly. + +In line with OpenSSL's recommendation to use pbkdf2 instead of +[`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) it is recommended that developers derive a key and IV on +their own using [`crypto.pbkdf2()`](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) and to use [`crypto.createDecipheriv()`](#crypto_crypto_createdecipheriv_algorithm_key_iv) +to create the `Decipher` object. + +### crypto.createDecipheriv(algorithm, key, iv)[#](#crypto_crypto_createdecipheriv_algorithm_key_iv) + +Added in: v0.1.94 + +Creates and returns a `Decipher` object that uses the given `algorithm`, `key` +and initialization vector (`iv`). + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `key` is the raw key used by the `algorithm` and `iv` is an +[initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded strings or +[buffers](buffer.html). + +### crypto.createDiffieHellman(prime[, prime\_encoding][, generator][, generator\_encoding])[#](#crypto_crypto_creatediffiehellman_prime_prime_encoding_generator_generator_encoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default for the encoding parameters changed from `binary` to `utf8`. | +| v0.11.12 | Added in: v0.11.12 | + +Creates a `DiffieHellman` key exchange object using the supplied `prime` and an +optional specific `generator`. + +The `generator` argument can be a number, string, or [`Buffer`](buffer.html). If +`generator` is not specified, the value `2` is used. + +The `prime_encoding` and `generator_encoding` arguments can be `'latin1'`, +`'hex'`, or `'base64'`. + +If `prime_encoding` is specified, `prime` is expected to be a string; otherwise +a [`Buffer`](buffer.html) is expected. + +If `generator_encoding` is specified, `generator` is expected to be a string; +otherwise either a number or [`Buffer`](buffer.html) is expected. + +### crypto.createDiffieHellman(prime\_length[, generator])[#](#crypto_crypto_creatediffiehellman_prime_length_generator) + +Added in: v0.5.0 + +Creates a `DiffieHellman` key exchange object and generates a prime of +`prime_length` bits using an optional specific numeric `generator`. +If `generator` is not specified, the value `2` is used. + +### crypto.createECDH(curve\_name)[#](#crypto_crypto_createecdh_curve_name) + +Added in: v0.11.14 + +Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a +predefined curve specified by the `curve_name` string. Use +[`crypto.getCurves()`](#crypto_crypto_getcurves) to obtain a list of available curve names. On recent +OpenSSL releases, `openssl ecparam -list_curves` will also display the name +and description of each available elliptic curve. + +### crypto.createHash(algorithm)[#](#crypto_crypto_createhash_algorithm) + +Added in: v0.1.92 + +Creates and returns a `Hash` object that can be used to generate hash digests +using the given `algorithm`. + +The `algorithm` is dependent on the available algorithms supported by the +version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. +On recent releases of OpenSSL, `openssl list-message-digest-algorithms` will +display the available digest algorithms. + +Example: generating the sha256 sum of a file + +```None +const filename = process.argv[2]; +const crypto = require('crypto'); +const fs = require('fs'); + +const hash = crypto.createHash('sha256'); + +const input = fs.createReadStream(filename); +input.on('readable', () => { + const data = input.read(); + if (data) + hash.update(data); + else { + console.log(`${hash.digest('hex')} ${filename}`); + } +}); +``` + +### crypto.createHmac(algorithm, key)[#](#crypto_crypto_createhmac_algorithm_key) + +Added in: v0.1.94 + +Creates and returns an `Hmac` object that uses the given `algorithm` and `key`. + +The `algorithm` is dependent on the available algorithms supported by the +version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. +On recent releases of OpenSSL, `openssl list-message-digest-algorithms` will +display the available digest algorithms. + +The `key` is the HMAC key used to generate the cryptographic HMAC hash. + +Example: generating the sha256 HMAC of a file + +```None +const filename = process.argv[2]; +const crypto = require('crypto'); +const fs = require('fs'); + +const hmac = crypto.createHmac('sha256', 'a secret'); + +const input = fs.createReadStream(filename); +input.on('readable', () => { + const data = input.read(); + if (data) + hmac.update(data); + else { + console.log(`${hmac.digest('hex')} ${filename}`); + } +}); +``` + +### crypto.createSign(algorithm)[#](#crypto_crypto_createsign_algorithm) + +Added in: v0.1.92 + +Creates and returns a `Sign` object that uses the given `algorithm`. +Use [`crypto.getHashes()`](#crypto_crypto_gethashes) to obtain an array of names of the available +signing algorithms. + +### crypto.createVerify(algorithm)[#](#crypto_crypto_createverify_algorithm) + +Added in: v0.1.92 + +Creates and returns a `Verify` object that uses the given algorithm. +Use [`crypto.getHashes()`](#crypto_crypto_gethashes) to obtain an array of names of the available +signing algorithms. + +### crypto.getCiphers()[#](#crypto_crypto_getciphers) + +Added in: v0.9.3 + +Returns an array with the names of the supported cipher algorithms. + +Example: + +```None +const ciphers = crypto.getCiphers(); +console.log(ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...] +``` + +### crypto.getCurves()[#](#crypto_crypto_getcurves) + +Added in: v2.3.0 + +Returns an array with the names of the supported elliptic curves. + +Example: + +```None +const curves = crypto.getCurves(); +console.log(curves); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...] +``` + +### crypto.getDiffieHellman(group\_name)[#](#crypto_crypto_getdiffiehellman_group_name) + +Added in: v0.7.5 + +Creates a predefined `DiffieHellman` key exchange object. The +supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in +[RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt), but see [Caveats](#crypto_support_for_weak_or_compromised_algorithms)) and `'modp14'`, `'modp15'`, +`'modp16'`, `'modp17'`, `'modp18'` (defined in [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt)). The +returned object mimics the interface of objects created by +[`crypto.createDiffieHellman()`](#crypto_crypto_creatediffiehellman_prime_prime_encoding_generator_generator_encoding), but will not allow changing +the keys (with [`diffieHellman.setPublicKey()`](#crypto_diffiehellman_setpublickey_public_key_encoding) for example). The +advantage of using this method is that the parties do not have to +generate nor exchange a group modulus beforehand, saving both processor +and communication time. + +Example (obtaining a shared secret): + +```None +const crypto = require('crypto'); +const alice = crypto.getDiffieHellman('modp14'); +const bob = crypto.getDiffieHellman('modp14'); + +alice.generateKeys(); +bob.generateKeys(); + +const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +/* aliceSecret and bobSecret should be the same */ +console.log(aliceSecret === bobSecret); +``` + +### crypto.getHashes()[#](#crypto_crypto_gethashes) + +Added in: v0.9.3 + +Returns an array of the names of the supported hash algorithms, +such as `RSA-SHA256`. + +Example: + +```None +const hashes = crypto.getHashes(); +console.log(hashes); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...] +``` + +### crypto.pbkdf2(password, salt, iterations, keylen, digest, callback)[#](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | Calling this function without passing the `digest` parameter is deprecated now and will emit a warning. | +| v6.0.0 | The default encoding for `password` if it is a string changed from `binary` to `utf8`. | +| v0.5.5 | Added in: v0.5.5 | + +Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2) +implementation. A selected HMAC digest algorithm specified by `digest` is +applied to derive a key of the requested byte length (`keylen`) from the +`password`, `salt` and `iterations`. + +The supplied `callback` function is called with two arguments: `err` and +`derivedKey`. If an error occurs, `err` will be set; otherwise `err` will be +null. The successfully generated `derivedKey` will be passed as a [`Buffer`](buffer.html). + +The `iterations` argument must be a number set as high as possible. The +higher the number of iterations, the more secure the derived key will be, +but will take a longer amount of time to complete. + +The `salt` should also be as unique as possible. It is recommended that the +salts are random and their lengths are greater than 16 bytes. See +[NIST SP 800-132](http://csrc.nist.gov/publications/nistpubs/800-132/nist-sp800-132.pdf) for details. + +Example: + +```None +const crypto = require('crypto'); +crypto.pbkdf2('secret', 'salt', 100000, 512, 'sha512', (err, key) => { + if (err) throw err; + console.log(key.toString('hex')); // '3745e48...aa39b34' +}); +``` + +An array of supported digest functions can be retrieved using +[`crypto.getHashes()`](#crypto_crypto_gethashes). + +### crypto.pbkdf2Sync(password, salt, iterations, keylen, digest)[#](#crypto_crypto_pbkdf2sync_password_salt_iterations_keylen_digest) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | Calling this function without passing the `digest` parameter is deprecated now and will emit a warning. | +| v6.0.0 | The default encoding for `password` if it is a string changed from `binary` to `utf8`. | +| v0.9.3 | Added in: v0.9.3 | + +Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) +implementation. A selected HMAC digest algorithm specified by `digest` is +applied to derive a key of the requested byte length (`keylen`) from the +`password`, `salt` and `iterations`. + +If an error occurs an Error will be thrown, otherwise the derived key will be +returned as a [`Buffer`](buffer.html). + +The `iterations` argument must be a number set as high as possible. The +higher the number of iterations, the more secure the derived key will be, +but will take a longer amount of time to complete. + +The `salt` should also be as unique as possible. It is recommended that the +salts are random and their lengths are greater than 16 bytes. See +[NIST SP 800-132](http://csrc.nist.gov/publications/nistpubs/800-132/nist-sp800-132.pdf) for details. + +Example: + +```None +const crypto = require('crypto'); +const key = crypto.pbkdf2Sync('secret', 'salt', 100000, 512, 'sha512'); +console.log(key.toString('hex')); // '3745e48...aa39b34' +``` + +An array of supported digest functions can be retrieved using +[`crypto.getHashes()`](#crypto_crypto_gethashes). + +### crypto.privateDecrypt(private\_key, buffer)[#](#crypto_crypto_privatedecrypt_private_key_buffer) + +Added in: v0.11.14 + +Decrypts `buffer` with `private_key`. + +`private_key` can be an object or a string. If `private_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. +If `private_key` is an object, it is interpreted as a hash object with the +keys: + +* `key`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded private key +* `passphrase`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - Optional passphrase for the private key +* `padding` : An optional padding value, one of the following: + + `crypto.constants.RSA_NO_PADDING` + + `crypto.constants.RSA_PKCS1_PADDING` + + `crypto.constants.RSA_PKCS1_OAEP_PADDING` + +All paddings are defined in `crypto.constants`. + +### crypto.privateEncrypt(private\_key, buffer)[#](#crypto_crypto_privateencrypt_private_key_buffer) + +Added in: v1.1.0 + +Encrypts `buffer` with `private_key`. + +`private_key` can be an object or a string. If `private_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. +If `private_key` is an object, it is interpreted as a hash object with the +keys: + +* `key`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded private key +* `passphrase`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - Optional passphrase for the private key +* `padding` : An optional padding value, one of the following: + + `crypto.constants.RSA_NO_PADDING` + + `crypto.constants.RSA_PKCS1_PADDING` + +All paddings are defined in `crypto.constants`. + +### crypto.publicDecrypt(public\_key, buffer)[#](#crypto_crypto_publicdecrypt_public_key_buffer) + +Added in: v1.1.0 + +Decrypts `buffer` with `public_key`. + +`public_key` can be an object or a string. If `public_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. +If `public_key` is an object, it is interpreted as a hash object with the +keys: + +* `key`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded public key +* `passphrase`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - Optional passphrase for the private key +* `padding` : An optional padding value, one of the following: + + `crypto.constants.RSA_NO_PADDING` + + `crypto.constants.RSA_PKCS1_PADDING` + + `crypto.constants.RSA_PKCS1_OAEP_PADDING` + +Because RSA public keys can be derived from private keys, a private key may +be passed instead of a public key. + +All paddings are defined in `crypto.constants`. + +### crypto.publicEncrypt(public\_key, buffer)[#](#crypto_crypto_publicencrypt_public_key_buffer) + +Added in: v0.11.14 + +Encrypts `buffer` with `public_key`. + +`public_key` can be an object or a string. If `public_key` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. +If `public_key` is an object, it is interpreted as a hash object with the +keys: + +* `key`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded public key +* `passphrase`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - Optional passphrase for the private key +* `padding` : An optional padding value, one of the following: + + `crypto.constants.RSA_NO_PADDING` + + `crypto.constants.RSA_PKCS1_PADDING` + + `crypto.constants.RSA_PKCS1_OAEP_PADDING` + +Because RSA public keys can be derived from private keys, a private key may +be passed instead of a public key. + +All paddings are defined in `crypto.constants`. + +### crypto.randomBytes(size[, callback])[#](#crypto_crypto_randombytes_size_callback) + +Added in: v0.5.8 + +Generates cryptographically strong pseudo-random data. The `size` argument +is a number indicating the number of bytes to generate. + +If a `callback` function is provided, the bytes are generated asynchronously +and the `callback` function is invoked with two arguments: `err` and `buf`. +If an error occurs, `err` will be an Error object; otherwise it is null. The +`buf` argument is a [`Buffer`](buffer.html) containing the generated bytes. + +```None +// Asynchronous +const crypto = require('crypto'); +crypto.randomBytes(256, (err, buf) => { + if (err) throw err; + console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`); +}); +``` + +If the `callback` function is not provided, the random bytes are generated +synchronously and returned as a [`Buffer`](buffer.html). An error will be thrown if +there is a problem generating the bytes. + +```None +// Synchronous +const buf = crypto.randomBytes(256); +console.log( + `${buf.length} bytes of random data: ${buf.toString('hex')}`); +``` + +The `crypto.randomBytes()` method will block until there is sufficient entropy. +This should normally never take longer than a few milliseconds. The only time +when generating the random bytes may conceivably block for a longer period of +time is right after boot, when the whole system is still low on entropy. + +### crypto.randomFillSync(buffer[, offset][, size])[#](#crypto_crypto_randomfillsync_buffer_offset_size) + +Added in: v7.10.0 + +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) Must be supplied. +* `offset` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Defaults to `0`. +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Defaults to `buffer.length - offset`. + +Synchronous version of [`crypto.randomFill()`](#crypto_crypto_randomfill_buffer_offset_size_callback). + +Returns `buffer` + +```None +const buf = Buffer.alloc(10); +console.log(crypto.randomFillSync(buf).toString('hex')); + +crypto.randomFillSync(buf, 5); +console.log(buf.toString('hex')); + +// The above is equivalent to the following: +crypto.randomFillSync(buf, 5, 5); +console.log(buf.toString('hex')); +``` + +### crypto.randomFill(buffer[, offset][, size], callback)[#](#crypto_crypto_randomfill_buffer_offset_size_callback) + +Added in: v7.10.0 + +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) Must be supplied. +* `offset` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Defaults to `0`. +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Defaults to `buffer.length - offset`. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) `function(err, buf) {}`. + +This function is similar to [`crypto.randomBytes()`](#crypto_crypto_randombytes_size_callback) but requires the first +argument to be a [`Buffer`](buffer.html) that will be filled. It also +requires that a callback is passed in. + +If the `callback` function is not provided, an error will be thrown. + +```None +const buf = Buffer.alloc(10); +crypto.randomFill(buf, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); + +crypto.randomFill(buf, 5, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); + +// The above is equivalent to the following: +crypto.randomFill(buf, 5, 5, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); +``` + +### crypto.setEngine(engine[, flags])[#](#crypto_crypto_setengine_engine_flags) + +Added in: v0.11.11 + +Load and set the `engine` for some or all OpenSSL functions (selected by flags). + +`engine` could be either an id or a path to the engine's shared library. + +The optional `flags` argument uses `ENGINE_METHOD_ALL` by default. The `flags` +is a bit field taking one of or a mix of the following flags (defined in +`crypto.constants`): + +* `crypto.constants.ENGINE_METHOD_RSA` +* `crypto.constants.ENGINE_METHOD_DSA` +* `crypto.constants.ENGINE_METHOD_DH` +* `crypto.constants.ENGINE_METHOD_RAND` +* `crypto.constants.ENGINE_METHOD_ECDH` +* `crypto.constants.ENGINE_METHOD_ECDSA` +* `crypto.constants.ENGINE_METHOD_CIPHERS` +* `crypto.constants.ENGINE_METHOD_DIGESTS` +* `crypto.constants.ENGINE_METHOD_STORE` +* `crypto.constants.ENGINE_METHOD_PKEY_METHS` +* `crypto.constants.ENGINE_METHOD_PKEY_ASN1_METHS` +* `crypto.constants.ENGINE_METHOD_ALL` +* `crypto.constants.ENGINE_METHOD_NONE` + +### crypto.timingSafeEqual(a, b)[#](#crypto_crypto_timingsafeequal_a_b) + +Added in: v6.6.0 + +Returns true if `a` is equal to `b`, without leaking timing information that +would allow an attacker to guess one of the values. This is suitable for +comparing HMAC digests or secret values like authentication cookies or +[capability urls](https://www.w3.org/TR/capability-urls/). + +`a` and `b` must both be `Buffer`s, and they must have the same length. + +**Note**: Use of `crypto.timingSafeEqual` does not guarantee that the +*surrounding* code is timing-safe. Care should be taken to ensure that the +surrounding code does not introduce timing vulnerabilities. + +## Notes[#](#crypto_notes) + +### Legacy Streams API (pre Node.js v0.10)[#](#crypto_legacy_streams_api_pre_node_js_v0_10) + +The Crypto module was added to Node.js before there was the concept of a +unified Stream API, and before there were [`Buffer`](buffer.html) objects for handling +binary data. As such, the many of the `crypto` defined classes have methods not +typically found on other Node.js classes that implement the [streams](stream.html) +API (e.g. `update()`, `final()`, or `digest()`). Also, many methods accepted +and returned `'latin1'` encoded strings by default rather than Buffers. This +default was changed after Node.js v0.8 to use [`Buffer`](buffer.html) objects by default +instead. + +### Recent ECDH Changes[#](#crypto_recent_ecdh_changes) + +Usage of `ECDH` with non-dynamically generated key pairs has been simplified. +Now, [`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_private_key_encoding) can be called with a preselected private key +and the associated public point (key) will be computed and stored in the object. +This allows code to only store and provide the private part of the EC key pair. +[`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_private_key_encoding) now also validates that the private key is valid for +the selected curve. + +The [`ecdh.setPublicKey()`](#crypto_ecdh_setpublickey_public_key_encoding) method is now deprecated as its inclusion in the +API is not useful. Either a previously stored private key should be set, which +automatically generates the associated public key, or [`ecdh.generateKeys()`](#crypto_ecdh_generatekeys_encoding_format) +should be called. The main drawback of using [`ecdh.setPublicKey()`](#crypto_ecdh_setpublickey_public_key_encoding) is that +it can be used to put the ECDH key pair into an inconsistent state. + +### Support for weak or compromised algorithms[#](#crypto_support_for_weak_or_compromised_algorithms) + +The `crypto` module still supports some algorithms which are already +compromised and are not currently recommended for use. The API also allows +the use of ciphers and hashes with a small key size that are considered to be +too weak for safe use. + +Users should take full responsibility for selecting the crypto +algorithm and key size according to their security requirements. + +Based on the recommendations of [NIST SP 800-131A](http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar1.pdf): + +* MD5 and SHA-1 are no longer acceptable where collision resistance is + required such as digital signatures. +* The key used with RSA, DSA and DH algorithms is recommended to have + at least 2048 bits and that of the curve of ECDSA and ECDH at least + 224 bits, to be safe to use for several years. +* The DH groups of `modp1`, `modp2` and `modp5` have a key size + smaller than 2048 bits and are not recommended. + +See the reference for other recommendations and details. + +## Crypto Constants[#](#crypto_crypto_constants_1) + +The following constants exported by `crypto.constants` apply to various uses of +the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL. + +### OpenSSL Options[#](#crypto_openssl_options) + +| Constant | Description | +| --- | --- | +| `SSL_OP_ALL` | Applies multiple bug workarounds within OpenSSL. See for detail. | +| `SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION` | Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See . | +| `SSL_OP_CIPHER_SERVER_PREFERENCE` | Attempts to use the server's preferences instead of the client's when selecting a cipher. Behaviour depends on protocol version. See . | +| `SSL_OP_CISCO_ANYCONNECT` | Instructs OpenSSL to use Cisco's "speshul" version of DTLS\_BAD\_VER. | +| `SSL_OP_COOKIE_EXCHANGE` | Instructs OpenSSL to turn on cookie exchange. | +| `SSL_OP_CRYPTOPRO_TLSEXT_BUG` | Instructs OpenSSL to add server-hello extension from an early version of the cryptopro draft. | +| `SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS` | Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. | +| `SSL_OP_EPHEMERAL_RSA` | Instructs OpenSSL to always use the tmp\_rsa key when performing RSA operations. | +| `SSL_OP_LEGACY_SERVER_CONNECT` | Allows initial connection to servers that do not support RI. | +| `SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER` | | +| `SSL_OP_MICROSOFT_SESS_ID_BUG` | | +| `SSL_OP_MSIE_SSLV2_RSA_PADDING` | Instructs OpenSSL to disable the workaround for a man-in-the-middle protocol-version vulnerability in the SSL 2.0 server implementation. | +| `SSL_OP_NETSCAPE_CA_DN_BUG` | | +| `SSL_OP_NETSCAPE_CHALLENGE_BUG` | | +| `SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG` | | +| `SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG` | | +| `SSL_OP_NO_COMPRESSION` | Instructs OpenSSL to disable support for SSL/TLS compression. | +| `SSL_OP_NO_QUERY_MTU` | | +| `SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION` | Instructs OpenSSL to always start a new session when performing renegotiation. | +| `SSL_OP_NO_SSLv2` | Instructs OpenSSL to turn off SSL v2 | +| `SSL_OP_NO_SSLv3` | Instructs OpenSSL to turn off SSL v3 | +| `SSL_OP_NO_TICKET` | Instructs OpenSSL to disable use of RFC4507bis tickets. | +| `SSL_OP_NO_TLSv1` | Instructs OpenSSL to turn off TLS v1 | +| `SSL_OP_NO_TLSv1_1` | Instructs OpenSSL to turn off TLS v1.1 | +| `SSL_OP_NO_TLSv1_2` | Instructs OpenSSL to turn off TLS v1.2 | + `SSL_OP_PKCS1_CHECK_1` | || `SSL_OP_PKCS1_CHECK_2` | | +| `SSL_OP_SINGLE_DH_USE` | Instructs OpenSSL to always create a new key when using temporary/ephemeral DH parameters. | +| `SSL_OP_SINGLE_ECDH_USE` | Instructs OpenSSL to always create a new key when using temporary/ephemeral ECDH parameters. | + `SSL_OP_SSLEAY_080_CLIENT_DH_BUG` | || `SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG` | | +| `SSL_OP_TLS_BLOCK_PADDING_BUG` | | +| `SSL_OP_TLS_D5_BUG` | | +| `SSL_OP_TLS_ROLLBACK_BUG` | Instructs OpenSSL to disable version rollback attack detection. | + +### OpenSSL Engine Constants[#](#crypto_openssl_engine_constants) + +| Constant | Description | +| --- | --- | +| `ENGINE_METHOD_RSA` | Limit engine usage to RSA | +| `ENGINE_METHOD_DSA` | Limit engine usage to DSA | +| `ENGINE_METHOD_DH` | Limit engine usage to DH | +| `ENGINE_METHOD_RAND` | Limit engine usage to RAND | +| `ENGINE_METHOD_ECDH` | Limit engine usage to ECDH | +| `ENGINE_METHOD_ECDSA` | Limit engine usage to ECDSA | +| `ENGINE_METHOD_CIPHERS` | Limit engine usage to CIPHERS | +| `ENGINE_METHOD_DIGESTS` | Limit engine usage to DIGESTS | +| `ENGINE_METHOD_STORE` | Limit engine usage to STORE | +| `ENGINE_METHOD_PKEY_METHS` | Limit engine usage to PKEY\_METHDS | +| `ENGINE_METHOD_PKEY_ASN1_METHS` | Limit engine usage to PKEY\_ASN1\_METHS | +| `ENGINE_METHOD_ALL` | | +| `ENGINE_METHOD_NONE` | | + +### Other OpenSSL Constants[#](#crypto_other_openssl_constants) + +| Constant | Description | +| --- | --- | +| `DH_CHECK_P_NOT_SAFE_PRIME` | | +| `DH_CHECK_P_NOT_PRIME` | | +| `DH_UNABLE_TO_CHECK_GENERATOR` | | +| `DH_NOT_SUITABLE_GENERATOR` | | +| `NPN_ENABLED` | | +| `ALPN_ENABLED` | | +| `RSA_PKCS1_PADDING` | | +| `RSA_SSLV23_PADDING` | | +| `RSA_NO_PADDING` | | +| `RSA_PKCS1_OAEP_PADDING` | | +| `RSA_X931_PADDING` | | +| `RSA_PKCS1_PSS_PADDING` | | +| `POINT_CONVERSION_COMPRESSED` | | +| `POINT_CONVERSION_UNCOMPRESSED` | | +| `POINT_CONVERSION_HYBRID` | | + +### Node.js Crypto Constants[#](#crypto_node_js_crypto_constants) + +| Constant | Description | +| --- | --- | +| `defaultCoreCipherList` | Specifies the built-in default cipher list used by Node.js. | +| `defaultCipherList` | Specifies the active default cipher list used by the current Node.js process. | diff --git a/corpus/docs/nodejs/crypto/crypto_8x.md b/corpus/docs/nodejs/crypto/crypto_8x.md new file mode 100644 index 0000000000000000000000000000000000000000..fdf1bbb0dfc89748d093c44e1403dd22291d321e --- /dev/null +++ b/corpus/docs/nodejs/crypto/crypto_8x.md @@ -0,0 +1,2042 @@ +# Crypto# + +Source: https://nodejs.org/docs/latest-v8.x/api/crypto.html +Version: 8.x + +[Stability: 2](documentation.html#documentation_stability_index) - Stable + +The `crypto` module provides cryptographic functionality that includes a set of +wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify functions. + +Use `require('crypto')` to access this module. + +```None +const crypto = require('crypto'); + +const secret = 'abcdefg'; +const hash = crypto.createHmac('sha256', secret) + .update('I love cupcakes') + .digest('hex'); +console.log(hash); +// Prints: +// c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e +``` + +## Determining if crypto support is unavailable[#](#crypto_determining_if_crypto_support_is_unavailable) + +It is possible for Node.js to be built without including support for the +`crypto` module. In such cases, calling `require('crypto')` will result in an +error being thrown. + +```None +let crypto; +try { + crypto = require('crypto'); +} catch (err) { + console.log('crypto support is disabled!'); +} +``` + +## Class: Certificate[#](#crypto_class_certificate) + +Added in: v0.11.8 + +SPKAC is a Certificate Signing Request mechanism originally implemented by +Netscape and was specified formally as part of [HTML5's `keygen` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/keygen). + +Note that `` is deprecated since [HTML 5.2](https://www.w3.org/TR/html52/changes.html#features-removed) and new projects +should not use this element anymore. + +The `crypto` module provides the `Certificate` class for working with SPKAC +data. The most common usage is handling output generated by the HTML5 +`` element. Node.js uses [OpenSSL's SPKAC implementation](https://www.openssl.org/docs/man1.0.2/apps/spkac.html) internally. + +### new crypto.Certificate()[#](#crypto_new_crypto_certificate) + +Instances of the `Certificate` class can be created using the `new` keyword +or by calling `crypto.Certificate()` as a function: + +```None +const crypto = require('crypto'); + +const cert1 = new crypto.Certificate(); +const cert2 = crypto.Certificate(); +``` + +### certificate.exportChallenge(spkac)[#](#crypto_certificate_exportchallenge_spkac) + +Added in: v0.11.8 + +* `spkac` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) The challenge component of the `spkac` data structure, which + includes a public key and a challenge. + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +const challenge = cert.exportChallenge(spkac); +console.log(challenge.toString('utf8')); +// Prints: the challenge as a UTF8 string +``` + +### certificate.exportPublicKey(spkac)[#](#crypto_certificate_exportpublickey_spkac) + +Added in: v0.11.8 + +* `spkac` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) The public key component of the `spkac` data structure, + which includes a public key and a challenge. + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +const publicKey = cert.exportPublicKey(spkac); +console.log(publicKey); +// Prints: the public key as +``` + +### certificate.verifySpkac(spkac)[#](#crypto_certificate_verifyspkac_spkac) + +Added in: v0.11.8 + +* `spkac` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` if the given `spkac` data structure is valid, + `false` otherwise. + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +console.log(cert.verifySpkac(Buffer.from(spkac))); +// Prints: true or false +``` + +## Class: Cipher[#](#crypto_class_cipher) + +Added in: v0.1.94 + +Instances of the `Cipher` class are used to encrypt data. The class can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where plain unencrypted + data is written to produce encrypted data on the readable side, or +* Using the [`cipher.update()`](#crypto_cipher_update_data_inputencoding_outputencoding) and [`cipher.final()`](#crypto_cipher_final_outputencoding) methods to produce + the encrypted data. + +The [`crypto.createCipher()`](#crypto_crypto_createcipher_algorithm_password_options) or [`crypto.createCipheriv()`](#crypto_crypto_createcipheriv_algorithm_key_iv_options) methods are +used to create `Cipher` instances. `Cipher` objects are not to be created +directly using the `new` keyword. + +Example: Using `Cipher` objects as streams: + +```None +const crypto = require('crypto'); +const cipher = crypto.createCipher('aes192', 'a password'); + +let encrypted = ''; +cipher.on('readable', () => { + const data = cipher.read(); + if (data) + encrypted += data.toString('hex'); +}); +cipher.on('end', () => { + console.log(encrypted); + // Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 +}); + +cipher.write('some clear text data'); +cipher.end(); +``` + +Example: Using `Cipher` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const cipher = crypto.createCipher('aes192', 'a password'); + +const input = fs.createReadStream('test.js'); +const output = fs.createWriteStream('test.enc'); + +input.pipe(cipher).pipe(output); +``` + +Example: Using the [`cipher.update()`](#crypto_cipher_update_data_inputencoding_outputencoding) and [`cipher.final()`](#crypto_cipher_final_outputencoding) methods: + +```None +const crypto = require('crypto'); +const cipher = crypto.createCipher('aes192', 'a password'); + +let encrypted = cipher.update('some clear text data', 'utf8', 'hex'); +encrypted += cipher.final('hex'); +console.log(encrypted); +// Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 +``` + +### cipher.final([outputEncoding])[#](#crypto_cipher_final_outputencoding) + +Added in: v0.1.94 + +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Any remaining enciphered contents. + If `outputEncoding` parameter is one of `'latin1'`, `'base64'` or `'hex'`, + a string is returned. If an `outputEncoding` is not provided, a [`Buffer`](buffer.html) + is returned. + +Once the `cipher.final()` method has been called, the `Cipher` object can no +longer be used to encrypt data. Attempts to call `cipher.final()` more than +once will result in an error being thrown. + +### cipher.setAAD(buffer)[#](#crypto_cipher_setaad_buffer) + +Added in: v1.0.0 + +* `buffer` [](buffer.html#buffer_class_buffer) +* Returns the [](crypto.html#crypto_class_cipher) for method chaining. + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `cipher.setAAD()` method sets the value used for the +*additional authenticated data* (AAD) input parameter. + +The `cipher.setAAD()` method must be called before [`cipher.update()`](#crypto_cipher_update_data_inputencoding_outputencoding). + +### cipher.getAuthTag()[#](#crypto_cipher_getauthtag) + +Added in: v1.0.0 + +* Returns: [](buffer.html#buffer_class_buffer) When using an authenticated encryption mode (only `GCM` is + currently supported), the `cipher.getAuthTag()` method returns a [`Buffer`](buffer.html) + containing the *authentication tag* that has been computed from the given + data. + +The `cipher.getAuthTag()` method should only be called after encryption has +been completed using the [`cipher.final()`](#crypto_cipher_final_outputencoding) method. + +### cipher.setAutoPadding([autoPadding])[#](#crypto_cipher_setautopadding_autopadding) + +Added in: v0.7.1 + +* `autoPadding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) **Default:** `true` +* Returns: [](crypto.html#crypto_class_cipher) for method chaining. + +When using block encryption algorithms, the `Cipher` class will automatically +add padding to the input data to the appropriate block size. To disable the +default padding call `cipher.setAutoPadding(false)`. + +When `autoPadding` is `false`, the length of the entire input data must be a +multiple of the cipher's block size or [`cipher.final()`](#crypto_cipher_final_outputencoding) will throw an Error. +Disabling automatic padding is useful for non-standard padding, for instance +using `0x0` instead of PKCS padding. + +The `cipher.setAutoPadding()` method must be called before +[`cipher.final()`](#crypto_cipher_final_outputencoding). + +### cipher.update(data[, inputEncoding][, outputEncoding])[#](#crypto_cipher_update_data_inputencoding_outputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.94 | Added in: v0.1.94 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Updates the cipher with `data`. If the `inputEncoding` argument is given, +its value must be one of `'utf8'`, `'ascii'`, or `'latin1'` and the `data` +argument is a string using the specified encoding. If the `inputEncoding` +argument is not given, `data` must be a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or `DataView`, then +`inputEncoding` is ignored. + +The `outputEncoding` specifies the output format of the enciphered +data, and can be `'latin1'`, `'base64'` or `'hex'`. If the `outputEncoding` +is specified, a string using the specified encoding is returned. If no +`outputEncoding` is provided, a [`Buffer`](buffer.html) is returned. + +The `cipher.update()` method can be called multiple times with new data until +[`cipher.final()`](#crypto_cipher_final_outputencoding) is called. Calling `cipher.update()` after +[`cipher.final()`](#crypto_cipher_final_outputencoding) will result in an error being thrown. + +## Class: Decipher[#](#crypto_class_decipher) + +Added in: v0.1.94 + +Instances of the `Decipher` class are used to decrypt data. The class can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where plain encrypted + data is written to produce unencrypted data on the readable side, or +* Using the [`decipher.update()`](#crypto_decipher_update_data_inputencoding_outputencoding) and [`decipher.final()`](#crypto_decipher_final_outputencoding) methods to + produce the unencrypted data. + +The [`crypto.createDecipher()`](#crypto_crypto_createdecipher_algorithm_password_options) or [`crypto.createDecipheriv()`](#crypto_crypto_createdecipheriv_algorithm_key_iv_options) methods are +used to create `Decipher` instances. `Decipher` objects are not to be created +directly using the `new` keyword. + +Example: Using `Decipher` objects as streams: + +```None +const crypto = require('crypto'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +let decrypted = ''; +decipher.on('readable', () => { + const data = decipher.read(); + if (data) + decrypted += data.toString('utf8'); +}); +decipher.on('end', () => { + console.log(decrypted); + // Prints: some clear text data +}); + +const encrypted = + 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; +decipher.write(encrypted, 'hex'); +decipher.end(); +``` + +Example: Using `Decipher` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +const input = fs.createReadStream('test.enc'); +const output = fs.createWriteStream('test.js'); + +input.pipe(decipher).pipe(output); +``` + +Example: Using the [`decipher.update()`](#crypto_decipher_update_data_inputencoding_outputencoding) and [`decipher.final()`](#crypto_decipher_final_outputencoding) methods: + +```None +const crypto = require('crypto'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +const encrypted = + 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; +let decrypted = decipher.update(encrypted, 'hex', 'utf8'); +decrypted += decipher.final('utf8'); +console.log(decrypted); +// Prints: some clear text data +``` + +### decipher.final([outputEncoding])[#](#crypto_decipher_final_outputencoding) + +Added in: v0.1.94 + +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Any remaining deciphered contents. + If `outputEncoding` parameter is one of `'latin1'`, `'ascii'` or `'utf8'`, + a string is returned. If an `outputEncoding` is not provided, a [`Buffer`](buffer.html) + is returned. + +Once the `decipher.final()` method has been called, the `Decipher` object can +no longer be used to decrypt data. Attempts to call `decipher.final()` more +than once will result in an error being thrown. + +### decipher.setAAD(buffer)[#](#crypto_decipher_setaad_buffer) + +History + +| Version | Changes | +| --- | --- | +| v7.2.0 | This method now returns a reference to `decipher`. | +| v1.0.0 | Added in: v1.0.0 | + +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](crypto.html#crypto_class_cipher) for method chaining. + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `decipher.setAAD()` method sets the value used for the +*additional authenticated data* (AAD) input parameter. + +The `decipher.setAAD()` method must be called before [`decipher.update()`](#crypto_decipher_update_data_inputencoding_outputencoding). + +### decipher.setAuthTag(buffer)[#](#crypto_decipher_setauthtag_buffer) + +History + +| Version | Changes | +| --- | --- | +| v7.2.0 | This method now returns a reference to `decipher`. | +| v1.0.0 | Added in: v1.0.0 | + +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](crypto.html#crypto_class_cipher) for method chaining. + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `decipher.setAuthTag()` method is used to pass in the +received *authentication tag*. If no tag is provided, or if the cipher text +has been tampered with, [`decipher.final()`](#crypto_decipher_final_outputencoding) will throw, indicating that the +cipher text should be discarded due to failed authentication. + +Note that this Node.js version does not verify the length of GCM authentication +tags. Such a check *must* be implemented by applications and is crucial to the +authenticity of the encrypted data, otherwise, an attacker can use an +arbitrarily short authentication tag to increase the chances of successfully +passing authentication (up to 0.39%). It is highly recommended to associate one +of the values 16, 15, 14, 13, 12, 8 or 4 bytes with each key, and to only permit +authentication tags of that length, see [NIST SP 800-38D](http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf). + +The `decipher.setAuthTag()` method must be called before +[`decipher.final()`](#crypto_decipher_final_outputencoding). + +### decipher.setAutoPadding([autoPadding])[#](#crypto_decipher_setautopadding_autopadding) + +Added in: v0.7.1 + +* `autoPadding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) **Default:** `true` +* Returns: [](crypto.html#crypto_class_cipher) for method chaining. + +When data has been encrypted without standard block padding, calling +`decipher.setAutoPadding(false)` will disable automatic padding to prevent +[`decipher.final()`](#crypto_decipher_final_outputencoding) from checking for and removing padding. + +Turning auto padding off will only work if the input data's length is a +multiple of the ciphers block size. + +The `decipher.setAutoPadding()` method must be called before +[`decipher.final()`](#crypto_decipher_final_outputencoding). + +### decipher.update(data[, inputEncoding][, outputEncoding])[#](#crypto_decipher_update_data_inputencoding_outputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.94 | Added in: v0.1.94 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Updates the decipher with `data`. If the `inputEncoding` argument is given, +its value must be one of `'latin1'`, `'base64'`, or `'hex'` and the `data` +argument is a string using the specified encoding. If the `inputEncoding` +argument is not given, `data` must be a [`Buffer`](buffer.html). If `data` is a +[`Buffer`](buffer.html) then `inputEncoding` is ignored. + +The `outputEncoding` specifies the output format of the enciphered +data, and can be `'latin1'`, `'ascii'` or `'utf8'`. If the `outputEncoding` +is specified, a string using the specified encoding is returned. If no +`outputEncoding` is provided, a [`Buffer`](buffer.html) is returned. + +The `decipher.update()` method can be called multiple times with new data until +[`decipher.final()`](#crypto_decipher_final_outputencoding) is called. Calling `decipher.update()` after +[`decipher.final()`](#crypto_decipher_final_outputencoding) will result in an error being thrown. + +## Class: DiffieHellman[#](#crypto_class_diffiehellman) + +Added in: v0.5.0 + +The `DiffieHellman` class is a utility for creating Diffie-Hellman key +exchanges. + +Instances of the `DiffieHellman` class can be created using the +[`crypto.createDiffieHellman()`](#crypto_crypto_creatediffiehellman_prime_primeencoding_generator_generatorencoding) function. + +```None +const crypto = require('crypto'); +const assert = require('assert'); + +// Generate Alice's keys... +const alice = crypto.createDiffieHellman(2048); +const aliceKey = alice.generateKeys(); + +// Generate Bob's keys... +const bob = crypto.createDiffieHellman(alice.getPrime(), alice.getGenerator()); +const bobKey = bob.generateKeys(); + +// Exchange and generate the secret... +const aliceSecret = alice.computeSecret(bobKey); +const bobSecret = bob.computeSecret(aliceKey); + +// OK +assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); +``` + +### diffieHellman.computeSecret(otherPublicKey[, inputEncoding][, outputEncoding])[#](#crypto_diffiehellman_computesecret_otherpublickey_inputencoding_outputencoding) + +Added in: v0.5.0 + +* `otherPublicKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Computes the shared secret using `otherPublicKey` as the other +party's public key and returns the computed shared secret. The supplied +key is interpreted using the specified `inputEncoding`, and secret is +encoded using specified `outputEncoding`. Encodings can be +`'latin1'`, `'hex'`, or `'base64'`. If the `inputEncoding` is not +provided, `otherPublicKey` is expected to be a [`Buffer`](buffer.html), +`TypedArray`, or `DataView`. + +If `outputEncoding` is given a string is returned; otherwise, a +[`Buffer`](buffer.html) is returned. + +### diffieHellman.generateKeys([encoding])[#](#crypto_diffiehellman_generatekeys_encoding) + +Added in: v0.5.0 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Generates private and public Diffie-Hellman key values, and returns +the public key in the specified `encoding`. This key should be +transferred to the other party. Encoding can be `'latin1'`, `'hex'`, +or `'base64'`. If `encoding` is provided a string is returned; otherwise a +[`Buffer`](buffer.html) is returned. + +### diffieHellman.getGenerator([encoding])[#](#crypto_diffiehellman_getgenerator_encoding) + +Added in: v0.5.0 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the Diffie-Hellman generator in the specified `encoding`, which can +be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is +returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPrime([encoding])[#](#crypto_diffiehellman_getprime_encoding) + +Added in: v0.5.0 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the Diffie-Hellman prime in the specified `encoding`, which can +be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is +returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPrivateKey([encoding])[#](#crypto_diffiehellman_getprivatekey_encoding) + +Added in: v0.5.0 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the Diffie-Hellman private key in the specified `encoding`, +which can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a +string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPublicKey([encoding])[#](#crypto_diffiehellman_getpublickey_encoding) + +Added in: v0.5.0 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the Diffie-Hellman public key in the specified `encoding`, which +can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a +string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.setPrivateKey(privateKey[, encoding])[#](#crypto_diffiehellman_setprivatekey_privatekey_encoding) + +Added in: v0.5.0 + +* `privateKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Sets the Diffie-Hellman private key. If the `encoding` argument is provided +and is either `'latin1'`, `'hex'`, or `'base64'`, `privateKey` is expected +to be a string. If no `encoding` is provided, `privateKey` is expected +to be a [`Buffer`](buffer.html), `TypedArray`, or `DataView`. + +### diffieHellman.setPublicKey(publicKey[, encoding])[#](#crypto_diffiehellman_setpublickey_publickey_encoding) + +Added in: v0.5.0 + +* `publicKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Sets the Diffie-Hellman public key. If the `encoding` argument is provided +and is either `'latin1'`, `'hex'` or `'base64'`, `publicKey` is expected +to be a string. If no `encoding` is provided, `publicKey` is expected +to be a [`Buffer`](buffer.html), `TypedArray`, or `DataView`. + +### diffieHellman.verifyError[#](#crypto_diffiehellman_verifyerror) + +Added in: v0.11.12 + +A bit field containing any warnings and/or errors resulting from a check +performed during initialization of the `DiffieHellman` object. + +The following values are valid for this property (as defined in `constants` +module): + +* `DH_CHECK_P_NOT_SAFE_PRIME` +* `DH_CHECK_P_NOT_PRIME` +* `DH_UNABLE_TO_CHECK_GENERATOR` +* `DH_NOT_SUITABLE_GENERATOR` + +## Class: ECDH[#](#crypto_class_ecdh) + +Added in: v0.11.14 + +The `ECDH` class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH) +key exchanges. + +Instances of the `ECDH` class can be created using the +[`crypto.createECDH()`](#crypto_crypto_createecdh_curvename) function. + +```None +const crypto = require('crypto'); +const assert = require('assert'); + +// Generate Alice's keys... +const alice = crypto.createECDH('secp521r1'); +const aliceKey = alice.generateKeys(); + +// Generate Bob's keys... +const bob = crypto.createECDH('secp521r1'); +const bobKey = bob.generateKeys(); + +// Exchange and generate the secret... +const aliceSecret = alice.computeSecret(bobKey); +const bobSecret = bob.computeSecret(aliceKey); + +assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); +// OK +``` + +### ecdh.computeSecret(otherPublicKey[, inputEncoding][, outputEncoding])[#](#crypto_ecdh_computesecret_otherpublickey_inputencoding_outputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.11.14 | Added in: v0.11.14 | + +* `otherPublicKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Computes the shared secret using `otherPublicKey` as the other +party's public key and returns the computed shared secret. The supplied +key is interpreted using specified `inputEncoding`, and the returned secret +is encoded using the specified `outputEncoding`. Encodings can be +`'latin1'`, `'hex'`, or `'base64'`. If the `inputEncoding` is not +provided, `otherPublicKey` is expected to be a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`. + +If `outputEncoding` is given a string will be returned; otherwise a +[`Buffer`](buffer.html) is returned. + +### ecdh.generateKeys([encoding[, format]])[#](#crypto_ecdh_generatekeys_encoding_format) + +Added in: v0.11.14 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `format` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) **Default:** `uncompressed` +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Generates private and public EC Diffie-Hellman key values, and returns +the public key in the specified `format` and `encoding`. This key should be +transferred to the other party. + +The `format` argument specifies point encoding and can be `'compressed'` or +`'uncompressed'`. If `format` is not specified, the point will be returned in +`'uncompressed'` format. + +The `encoding` argument can be `'latin1'`, `'hex'`, or `'base64'`. If +`encoding` is provided a string is returned; otherwise a [`Buffer`](buffer.html) +is returned. + +### ecdh.getPrivateKey([encoding])[#](#crypto_ecdh_getprivatekey_encoding) + +Added in: v0.11.14 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The EC Diffie-Hellman private key in the specified + `encoding`, which can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` + is provided a string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### ecdh.getPublicKey([encoding][, format])[#](#crypto_ecdh_getpublickey_encoding_format) + +Added in: v0.11.14 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `format` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) **Default:** `uncompressed` +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The EC Diffie-Hellman public key in the specified + `encoding` and `format`. + +The `format` argument specifies point encoding and can be `'compressed'` or +`'uncompressed'`. If `format` is not specified the point will be returned in +`'uncompressed'` format. + +The `encoding` argument can be `'latin1'`, `'hex'`, or `'base64'`. If +`encoding` is specified, a string is returned; otherwise a [`Buffer`](buffer.html) is +returned. + +### ecdh.setPrivateKey(privateKey[, encoding])[#](#crypto_ecdh_setprivatekey_privatekey_encoding) + +Added in: v0.11.14 + +* `privateKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Sets the EC Diffie-Hellman private key. The `encoding` can be `'latin1'`, +`'hex'` or `'base64'`. If `encoding` is provided, `privateKey` is expected +to be a string; otherwise `privateKey` is expected to be a [`Buffer`](buffer.html), +`TypedArray`, or `DataView`. + +If `privateKey` is not valid for the curve specified when the `ECDH` object was +created, an error is thrown. Upon setting the private key, the associated +public point (key) is also generated and set in the ECDH object. + +### ecdh.setPublicKey(publicKey[, encoding])[#](#crypto_ecdh_setpublickey_publickey_encoding) + +Added in: v0.11.14Deprecated since: v5.2.0 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated + +* `publicKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Sets the EC Diffie-Hellman public key. Key encoding can be `'latin1'`, +`'hex'` or `'base64'`. If `encoding` is provided `publicKey` is expected to +be a string; otherwise a [`Buffer`](buffer.html), `TypedArray`, or `DataView` is expected. + +Note that there is not normally a reason to call this method because `ECDH` +only requires a private key and the other party's public key to compute the +shared secret. Typically either [`ecdh.generateKeys()`](#crypto_ecdh_generatekeys_encoding_format) or +[`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_privatekey_encoding) will be called. The [`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_privatekey_encoding) method +attempts to generate the public point/key associated with the private key being +set. + +Example (obtaining a shared secret): + +```None +const crypto = require('crypto'); +const alice = crypto.createECDH('secp256k1'); +const bob = crypto.createECDH('secp256k1'); + +// Note: This is a shortcut way to specify one of Alice's previous private +// keys. It would be unwise to use such a predictable private key in a real +// application. +alice.setPrivateKey( + crypto.createHash('sha256').update('alice', 'utf8').digest() +); + +// Bob uses a newly generated cryptographically strong +// pseudorandom key pair +bob.generateKeys(); + +const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +// aliceSecret and bobSecret should be the same shared secret value +console.log(aliceSecret === bobSecret); +``` + +## Class: Hash[#](#crypto_class_hash) + +Added in: v0.1.92 + +The `Hash` class is a utility for creating hash digests of data. It can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where data is written + to produce a computed hash digest on the readable side, or +* Using the [`hash.update()`](#crypto_hash_update_data_inputencoding) and [`hash.digest()`](#crypto_hash_digest_encoding) methods to produce the + computed hash. + +The [`crypto.createHash()`](#crypto_crypto_createhash_algorithm_options) method is used to create `Hash` instances. `Hash` +objects are not to be created directly using the `new` keyword. + +Example: Using `Hash` objects as streams: + +```None +const crypto = require('crypto'); +const hash = crypto.createHash('sha256'); + +hash.on('readable', () => { + const data = hash.read(); + if (data) { + console.log(data.toString('hex')); + // Prints: + // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 + } +}); + +hash.write('some data to hash'); +hash.end(); +``` + +Example: Using `Hash` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const hash = crypto.createHash('sha256'); + +const input = fs.createReadStream('test.js'); +input.pipe(hash).pipe(process.stdout); +``` + +Example: Using the [`hash.update()`](#crypto_hash_update_data_inputencoding) and [`hash.digest()`](#crypto_hash_digest_encoding) methods: + +```None +const crypto = require('crypto'); +const hash = crypto.createHash('sha256'); + +hash.update('some data to hash'); +console.log(hash.digest('hex')); +// Prints: +// 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 +``` + +### hash.digest([encoding])[#](#crypto_hash_digest_encoding) + +Added in: v0.1.92 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Calculates the digest of all of the data passed to be hashed (using the +[`hash.update()`](#crypto_hash_update_data_inputencoding) method). The `encoding` can be `'hex'`, `'latin1'` or +`'base64'`. If `encoding` is provided a string will be returned; otherwise +a [`Buffer`](buffer.html) is returned. + +The `Hash` object can not be used again after `hash.digest()` method has been +called. Multiple calls will cause an error to be thrown. + +### hash.update(data[, inputEncoding])[#](#crypto_hash_update_data_inputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.92 | Added in: v0.1.92 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Updates the hash content with the given `data`, the encoding of which +is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or +`'latin1'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`, then `inputEncoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Hmac[#](#crypto_class_hmac) + +Added in: v0.1.94 + +The `Hmac` Class is a utility for creating cryptographic HMAC digests. It can +be used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where data is written + to produce a computed HMAC digest on the readable side, or +* Using the [`hmac.update()`](#crypto_hmac_update_data_inputencoding) and [`hmac.digest()`](#crypto_hmac_digest_encoding) methods to produce the + computed HMAC digest. + +The [`crypto.createHmac()`](#crypto_crypto_createhmac_algorithm_key_options) method is used to create `Hmac` instances. `Hmac` +objects are not to be created directly using the `new` keyword. + +Example: Using `Hmac` objects as streams: + +```None +const crypto = require('crypto'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +hmac.on('readable', () => { + const data = hmac.read(); + if (data) { + console.log(data.toString('hex')); + // Prints: + // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e + } +}); + +hmac.write('some data to hash'); +hmac.end(); +``` + +Example: Using `Hmac` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +const input = fs.createReadStream('test.js'); +input.pipe(hmac).pipe(process.stdout); +``` + +Example: Using the [`hmac.update()`](#crypto_hmac_update_data_inputencoding) and [`hmac.digest()`](#crypto_hmac_digest_encoding) methods: + +```None +const crypto = require('crypto'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +hmac.update('some data to hash'); +console.log(hmac.digest('hex')); +// Prints: +// 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e +``` + +### hmac.digest([encoding])[#](#crypto_hmac_digest_encoding) + +Added in: v0.1.94 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Calculates the HMAC digest of all of the data passed using [`hmac.update()`](#crypto_hmac_update_data_inputencoding). +The `encoding` can be `'hex'`, `'latin1'` or `'base64'`. If `encoding` is +provided a string is returned; otherwise a [`Buffer`](buffer.html) is returned; + +The `Hmac` object can not be used again after `hmac.digest()` has been +called. Multiple calls to `hmac.digest()` will result in an error being thrown. + +### hmac.update(data[, inputEncoding])[#](#crypto_hmac_update_data_inputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.94 | Added in: v0.1.94 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Updates the `Hmac` content with the given `data`, the encoding of which +is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or +`'latin1'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`, then `inputEncoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Sign[#](#crypto_class_sign) + +Added in: v0.1.92 + +The `Sign` Class is a utility for generating signatures. It can be used in one +of two ways: + +* As a writable [stream](stream.html), where data to be signed is written and the + [`sign.sign()`](#crypto_sign_sign_privatekey_outputformat) method is used to generate and return the signature, or +* Using the [`sign.update()`](#crypto_sign_update_data_inputencoding) and [`sign.sign()`](#crypto_sign_sign_privatekey_outputformat) methods to produce the + signature. + +The [`crypto.createSign()`](#crypto_crypto_createsign_algorithm_options) method is used to create `Sign` instances. The +argument is the string name of the hash function to use. `Sign` objects are not +to be created directly using the `new` keyword. + +Example: Using `Sign` objects as streams: + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('SHA256'); + +sign.write('some data to sign'); +sign.end(); + +const privateKey = getPrivateKeySomehow(); +console.log(sign.sign(privateKey, 'hex')); +// Prints: the calculated signature using the specified private key and +// SHA-256. For RSA keys, the algorithm is RSASSA-PKCS1-v1_5 (see padding +// parameter below for RSASSA-PSS). For EC keys, the algorithm is ECDSA. +``` + +Example: Using the [`sign.update()`](#crypto_sign_update_data_inputencoding) and [`sign.sign()`](#crypto_sign_sign_privatekey_outputformat) methods: + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('SHA256'); + +sign.update('some data to sign'); + +const privateKey = getPrivateKeySomehow(); +console.log(sign.sign(privateKey, 'hex')); +// Prints: the calculated signature +``` + +In some cases, a `Sign` instance can also be created by passing in a signature +algorithm name, such as 'RSA-SHA256'. This will use the corresponding digest +algorithm. This does not work for all signature algorithms, such as +'ecdsa-with-SHA256'. Use digest names instead. + +Example: signing using legacy signature algorithm name + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('RSA-SHA256'); + +sign.update('some data to sign'); + +const privateKey = getPrivateKeySomehow(); +console.log(sign.sign(privateKey, 'hex')); +// Prints: the calculated signature +``` + +### sign.sign(privateKey[, outputFormat])[#](#crypto_sign_sign_privatekey_outputformat) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | Support for RSASSA-PSS and additional options was added. | +| v0.1.92 | Added in: v0.1.92 | + +* `privateKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `outputFormat` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Calculates the signature on all the data passed through using either +[`sign.update()`](#crypto_sign_update_data_inputencoding) or [`sign.write()`](stream.html#stream_writable_write_chunk_encoding_callback). + +The `privateKey` argument can be an object or a string. If `privateKey` is a +string, it is treated as a raw key with no passphrase. If `privateKey` is an +object, it must contain one or more of the following properties: + +* `key`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded private key (required) +* `passphrase`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - passphrase for the private key +* `padding`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - Optional padding value for RSA, one of the following: + + + `crypto.constants.RSA_PKCS1_PADDING` (default) + + `crypto.constants.RSA_PKCS1_PSS_PADDING` + + Note that `RSA_PKCS1_PSS_PADDING` will use MGF1 with the same hash function + used to sign the message as specified in section 3.1 of [RFC 4055](https://www.rfc-editor.org/rfc/rfc4055.txt). +* `saltLength`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - salt length for when padding is + `RSA_PKCS1_PSS_PADDING`. The special value + `crypto.constants.RSA_PSS_SALTLEN_DIGEST` sets the salt length to the digest + size, `crypto.constants.RSA_PSS_SALTLEN_MAX_SIGN` (default) sets it to the + maximum permissible value. + +The `outputFormat` can specify one of `'latin1'`, `'hex'` or `'base64'`. If +`outputFormat` is provided a string is returned; otherwise a [`Buffer`](buffer.html) is +returned. + +The `Sign` object can not be again used after `sign.sign()` method has been +called. Multiple calls to `sign.sign()` will result in an error being thrown. + +### sign.update(data[, inputEncoding])[#](#crypto_sign_update_data_inputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.92 | Added in: v0.1.92 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Updates the `Sign` content with the given `data`, the encoding of which +is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or +`'latin1'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`, then `inputEncoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Verify[#](#crypto_class_verify) + +Added in: v0.1.92 + +The `Verify` class is a utility for verifying signatures. It can be used in one +of two ways: + +* As a writable [stream](stream.html) where written data is used to validate against the + supplied signature, or +* Using the [`verify.update()`](#crypto_verify_update_data_inputencoding) and [`verify.verify()`](#crypto_verify_verify_object_signature_signatureformat) methods to verify + the signature. + +The [`crypto.createVerify()`](#crypto_crypto_createverify_algorithm_options) method is used to create `Verify` instances. +`Verify` objects are not to be created directly using the `new` keyword. + +Example: Using `Verify` objects as streams: + +```None +const crypto = require('crypto'); +const verify = crypto.createVerify('SHA256'); + +verify.write('some data to sign'); +verify.end(); + +const publicKey = getPublicKeySomehow(); +const signature = getSignatureToVerify(); +console.log(verify.verify(publicKey, signature)); +// Prints: true or false +``` + +Example: Using the [`verify.update()`](#crypto_verify_update_data_inputencoding) and [`verify.verify()`](#crypto_verify_verify_object_signature_signatureformat) methods: + +```None +const crypto = require('crypto'); +const verify = crypto.createVerify('SHA256'); + +verify.update('some data to sign'); + +const publicKey = getPublicKeySomehow(); +const signature = getSignatureToVerify(); +console.log(verify.verify(publicKey, signature)); +// Prints: true or false +``` + +### verify.update(data[, inputEncoding])[#](#crypto_verify_update_data_inputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.92 | Added in: v0.1.92 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Updates the `Verify` content with the given `data`, the encoding of which +is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or +`'latin1'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`, then `inputEncoding` is ignored. + +This can be called many times with new data as it is streamed. + +### verify.verify(object, signature[, signatureFormat])[#](#crypto_verify_verify_object_signature_signatureformat) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | Support for RSASSA-PSS and additional options was added. | +| v0.1.92 | Added in: v0.1.92 | + +* `object` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) +* `signature` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `signatureFormat` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` or `false` depending on the validity of the + signature for the data and public key. + +Verifies the provided data using the given `object` and `signature`. +The `object` argument can be either a string containing a PEM encoded object, +which can be an RSA public key, a DSA public key, or an X.509 certificate, +or an object with one or more of the following properties: + +* `key`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded public key (required) +* `padding`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - Optional padding value for RSA, one of the following: + + + `crypto.constants.RSA_PKCS1_PADDING` (default) + + `crypto.constants.RSA_PKCS1_PSS_PADDING` + + Note that `RSA_PKCS1_PSS_PADDING` will use MGF1 with the same hash function + used to verify the message as specified in section 3.1 of [RFC 4055](https://www.rfc-editor.org/rfc/rfc4055.txt). +* `saltLength`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - salt length for when padding is + `RSA_PKCS1_PSS_PADDING`. The special value + `crypto.constants.RSA_PSS_SALTLEN_DIGEST` sets the salt length to the digest + size, `crypto.constants.RSA_PSS_SALTLEN_AUTO` (default) causes it to be + determined automatically. + +The `signature` argument is the previously calculated signature for the data, in +the `signatureFormat` which can be `'latin1'`, `'hex'` or `'base64'`. +If a `signatureFormat` is specified, the `signature` is expected to be a +string; otherwise `signature` is expected to be a [`Buffer`](buffer.html), +`TypedArray`, or `DataView`. + +The `verify` object can not be used again after `verify.verify()` has been +called. Multiple calls to `verify.verify()` will result in an error being +thrown. + +## `crypto` module methods and properties[#](#crypto_crypto_module_methods_and_properties) + +### crypto.constants[#](#crypto_crypto_constants) + +Added in: v6.3.0 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) An object containing commonly used constants for crypto and + security related operations. The specific constants currently defined are + described in [Crypto Constants](#crypto_crypto_constants_1). + +### crypto.DEFAULT\_ENCODING[#](#crypto_crypto_default_encoding) + +Added in: v0.9.3 + +The default encoding to use for functions that can take either strings +or [buffers](buffer.html). The default value is `'buffer'`, which makes methods +default to [`Buffer`](buffer.html) objects. + +The `crypto.DEFAULT_ENCODING` mechanism is provided for backwards compatibility +with legacy programs that expect `'latin1'` to be the default encoding. + +New applications should expect the default to be `'buffer'`. This property may +become deprecated in a future Node.js release. + +### crypto.fips[#](#crypto_crypto_fips) + +Added in: v6.0.0 + +Property for checking and controlling whether a FIPS compliant crypto provider is +currently in use. Setting to true requires a FIPS build of Node.js. + +### crypto.createCipher(algorithm, password[, options])[#](#crypto_crypto_createcipher_algorithm_password_options) + +Added in: v0.1.94 + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `password` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) +* Returns: [](crypto.html#crypto_class_cipher) + +Creates and returns a `Cipher` object that uses the given `algorithm` and +`password`. Optional `options` argument controls stream behavior. + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `password` is used to derive the cipher key and initialization vector (IV). +The value must be either a `'latin1'` encoded string, a [`Buffer`](buffer.html), a +`TypedArray`, or a `DataView`. + +The implementation of `crypto.createCipher()` derives keys using the OpenSSL +function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one +iteration, and no salt. The lack of salt allows dictionary attacks as the same +password always creates the same key. The low iteration count and +non-cryptographically secure hash algorithm allow passwords to be tested very +rapidly. + +In line with OpenSSL's recommendation to use PBKDF2 instead of +[`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) it is recommended that developers derive a key and IV on +their own using [`crypto.pbkdf2()`](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) and to use [`crypto.createCipheriv()`](#crypto_crypto_createcipheriv_algorithm_key_iv_options) +to create the `Cipher` object. Users should not use ciphers with counter mode +(e.g. CTR, GCM, or CCM) in `crypto.createCipher()`. A warning is emitted when +they are used in order to avoid the risk of IV reuse that causes +vulnerabilities. For the case when IV is reused in GCM, see [Nonce-Disrespecting +Adversaries](https://github.com/nonce-disrespect/nonce-disrespect) for details. + +### crypto.createCipheriv(algorithm, key, iv[, options])[#](#crypto_crypto_createcipheriv_algorithm_key_iv_options) + +History + +| Version | Changes | +| --- | --- | +| v8.12.0 | The `iv` parameter may now be `null` for ciphers which do not need an initialization vector. | +| v0.1.94 | Added in: v0.1.94 | + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `iv` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) +* Returns: [](crypto.html#crypto_class_cipher) + +Creates and returns a `Cipher` object, with the given `algorithm`, `key` and +initialization vector (`iv`). Optional `options` argument controls stream behavior. + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `key` is the raw key used by the `algorithm` and `iv` is an +[initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded strings, +[Buffers](buffer.html), `TypedArray`, or `DataView`s. If the cipher does not need +an initialization vector, `iv` may be `null`. + +### crypto.createCredentials(details)[#](#crypto_crypto_createcredentials_details) + +Added in: v0.1.92Deprecated since: v0.11.13 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options) instead. + +* `details` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Identical to [`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options). + +The `crypto.createCredentials()` method is a deprecated function for creating +and returning a `tls.SecureContext`. It should not be used. Replace it with +[`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options) which has the exact same arguments and return +value. + +Returns a `tls.SecureContext`, as-if [`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options) had been +called. + +### crypto.createDecipher(algorithm, password[, options])[#](#crypto_crypto_createdecipher_algorithm_password_options) + +Added in: v0.1.94 + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `password` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) +* Returns: [](crypto.html#crypto_class_decipher) + +Creates and returns a `Decipher` object that uses the given `algorithm` and +`password` (key). Optional `options` argument controls stream behavior. + +The implementation of `crypto.createDecipher()` derives keys using the OpenSSL +function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one +iteration, and no salt. The lack of salt allows dictionary attacks as the same +password always creates the same key. The low iteration count and +non-cryptographically secure hash algorithm allow passwords to be tested very +rapidly. + +In line with OpenSSL's recommendation to use PBKDF2 instead of +[`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) it is recommended that developers derive a key and IV on +their own using [`crypto.pbkdf2()`](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) and to use [`crypto.createDecipheriv()`](#crypto_crypto_createdecipheriv_algorithm_key_iv_options) +to create the `Decipher` object. + +### crypto.createDecipheriv(algorithm, key, iv[, options])[#](#crypto_crypto_createdecipheriv_algorithm_key_iv_options) + +History + +| Version | Changes | +| --- | --- | +| v8.12.0 | The `iv` parameter may now be `null` for ciphers which do not need an initialization vector. | +| v0.1.94 | Added in: v0.1.94 | + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `iv` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) +* Returns: [](crypto.html#crypto_class_decipher) + +Creates and returns a `Decipher` object that uses the given `algorithm`, `key` +and initialization vector (`iv`). Optional `options` argument controls stream +behavior. + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `key` is the raw key used by the `algorithm` and `iv` is an +[initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded strings, +[Buffers](buffer.html), `TypedArray`, or `DataView`s. If the cipher does not need +an initialization vector, `iv` may be `null`. + +### crypto.createDiffieHellman(prime[, primeEncoding][, generator][, generatorEncoding])[#](#crypto_crypto_creatediffiehellman_prime_primeencoding_generator_generatorencoding) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `prime` argument can be any `TypedArray` or `DataView` now. | +| v8.0.0 | The `prime` argument can be a `Uint8Array` now. | +| v6.0.0 | The default for the encoding parameters changed from `binary` to `utf8`. | +| v0.11.12 | Added in: v0.11.12 | + +* `prime` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `primeEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `generator` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) **Default:** + `2` +* `generatorEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Creates a `DiffieHellman` key exchange object using the supplied `prime` and an +optional specific `generator`. + +The `generator` argument can be a number, string, or [`Buffer`](buffer.html). If +`generator` is not specified, the value `2` is used. + +The `primeEncoding` and `generatorEncoding` arguments can be `'latin1'`, +`'hex'`, or `'base64'`. + +If `primeEncoding` is specified, `prime` is expected to be a string; otherwise +a [`Buffer`](buffer.html), `TypedArray`, or `DataView` is expected. + +If `generatorEncoding` is specified, `generator` is expected to be a string; +otherwise a number, [`Buffer`](buffer.html), `TypedArray`, or `DataView` is expected. + +### crypto.createDiffieHellman(primeLength[, generator])[#](#crypto_crypto_creatediffiehellman_primelength_generator) + +Added in: v0.5.0 + +* `primeLength` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `generator` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) **Default:** + `2` + +Creates a `DiffieHellman` key exchange object and generates a prime of +`primeLength` bits using an optional specific numeric `generator`. +If `generator` is not specified, the value `2` is used. + +### crypto.createECDH(curveName)[#](#crypto_crypto_createecdh_curvename) + +Added in: v0.11.14 + +* `curveName` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a +predefined curve specified by the `curveName` string. Use +[`crypto.getCurves()`](#crypto_crypto_getcurves) to obtain a list of available curve names. On recent +OpenSSL releases, `openssl ecparam -list_curves` will also display the name +and description of each available elliptic curve. + +### crypto.createHash(algorithm[, options])[#](#crypto_crypto_createhash_algorithm_options) + +Added in: v0.1.92 + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) +* Returns: [](crypto.html#crypto_class_hash) + +Creates and returns a `Hash` object that can be used to generate hash digests +using the given `algorithm`. Optional `options` argument controls stream +behavior. + +The `algorithm` is dependent on the available algorithms supported by the +version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. +On recent releases of OpenSSL, `openssl list-message-digest-algorithms` will +display the available digest algorithms. + +Example: generating the sha256 sum of a file + +```None +const filename = process.argv[2]; +const crypto = require('crypto'); +const fs = require('fs'); + +const hash = crypto.createHash('sha256'); + +const input = fs.createReadStream(filename); +input.on('readable', () => { + const data = input.read(); + if (data) + hash.update(data); + else { + console.log(`${hash.digest('hex')} ${filename}`); + } +}); +``` + +### crypto.createHmac(algorithm, key[, options])[#](#crypto_crypto_createhmac_algorithm_key_options) + +Added in: v0.1.94 + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) +* Returns: [](crypto.html#crypto_class_hmac) + +Creates and returns an `Hmac` object that uses the given `algorithm` and `key`. +Optional `options` argument controls stream behavior. + +The `algorithm` is dependent on the available algorithms supported by the +version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. +On recent releases of OpenSSL, `openssl list-message-digest-algorithms` will +display the available digest algorithms. + +The `key` is the HMAC key used to generate the cryptographic HMAC hash. + +Example: generating the sha256 HMAC of a file + +```None +const filename = process.argv[2]; +const crypto = require('crypto'); +const fs = require('fs'); + +const hmac = crypto.createHmac('sha256', 'a secret'); + +const input = fs.createReadStream(filename); +input.on('readable', () => { + const data = input.read(); + if (data) + hmac.update(data); + else { + console.log(`${hmac.digest('hex')} ${filename}`); + } +}); +``` + +### crypto.createSign(algorithm[, options])[#](#crypto_crypto_createsign_algorithm_options) + +Added in: v0.1.92 + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.Writable` options](stream.html#stream_constructor_new_stream_writable_options) +* Returns: [](crypto.html#crypto_class_sign) + +Creates and returns a `Sign` object that uses the given `algorithm`. +Use [`crypto.getHashes()`](#crypto_crypto_gethashes) to obtain an array of names of the available +signing algorithms. Optional `options` argument controls the +`stream.Writable` behavior. + +### crypto.createVerify(algorithm[, options])[#](#crypto_crypto_createverify_algorithm_options) + +Added in: v0.1.92 + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.Writable` options](stream.html#stream_constructor_new_stream_writable_options) +* Returns: [](crypto.html#crypto_class_verify) + +Creates and returns a `Verify` object that uses the given algorithm. +Use [`crypto.getHashes()`](#crypto_crypto_gethashes) to obtain an array of names of the available +signing algorithms. Optional `options` argument controls the +`stream.Writable` behavior. + +### crypto.getCiphers()[#](#crypto_crypto_getciphers) + +Added in: v0.9.3 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An array with the names of the supported cipher + algorithms. + +Example: + +```None +const ciphers = crypto.getCiphers(); +console.log(ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...] +``` + +### crypto.getCurves()[#](#crypto_crypto_getcurves) + +Added in: v2.3.0 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An array with the names of the supported elliptic curves. + +Example: + +```None +const curves = crypto.getCurves(); +console.log(curves); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...] +``` + +### crypto.getDiffieHellman(groupName)[#](#crypto_crypto_getdiffiehellman_groupname) + +Added in: v0.7.5 + +* `groupName` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + +Creates a predefined `DiffieHellman` key exchange object. The +supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in +[RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt), but see [Caveats](#crypto_support_for_weak_or_compromised_algorithms)) and `'modp14'`, `'modp15'`, +`'modp16'`, `'modp17'`, `'modp18'` (defined in [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt)). The +returned object mimics the interface of objects created by +[`crypto.createDiffieHellman()`](#crypto_crypto_creatediffiehellman_prime_primeencoding_generator_generatorencoding), but will not allow changing +the keys (with [`diffieHellman.setPublicKey()`](#crypto_diffiehellman_setpublickey_publickey_encoding) for example). The +advantage of using this method is that the parties do not have to +generate nor exchange a group modulus beforehand, saving both processor +and communication time. + +Example (obtaining a shared secret): + +```None +const crypto = require('crypto'); +const alice = crypto.getDiffieHellman('modp14'); +const bob = crypto.getDiffieHellman('modp14'); + +alice.generateKeys(); +bob.generateKeys(); + +const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +/* aliceSecret and bobSecret should be the same */ +console.log(aliceSecret === bobSecret); +``` + +### crypto.getHashes()[#](#crypto_crypto_gethashes) + +Added in: v0.9.3 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An array of the names of the supported hash algorithms, + such as `'RSA-SHA256'`. + +Example: + +```None +const hashes = crypto.getHashes(); +console.log(hashes); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...] +``` + +### crypto.pbkdf2(password, salt, iterations, keylen, digest, callback)[#](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `digest` parameter is always required now. | +| v6.0.0 | Calling this function without passing the `digest` parameter is deprecated now and will emit a warning. | +| v6.0.0 | The default encoding for `password` if it is a string changed from `binary` to `utf8`. | +| v0.5.5 | Added in: v0.5.5 | + +* `password` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `salt` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `iterations` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `keylen` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `digest` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + + `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + + `derivedKey` [](buffer.html#buffer_class_buffer) + +Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2) +implementation. A selected HMAC digest algorithm specified by `digest` is +applied to derive a key of the requested byte length (`keylen`) from the +`password`, `salt` and `iterations`. + +The supplied `callback` function is called with two arguments: `err` and +`derivedKey`. If an error occurs, `err` will be set; otherwise `err` will be +null. The successfully generated `derivedKey` will be passed as a [`Buffer`](buffer.html). + +The `iterations` argument must be a number set as high as possible. The +higher the number of iterations, the more secure the derived key will be, +but will take a longer amount of time to complete. + +The `salt` should also be as unique as possible. It is recommended that the +salts are random and their lengths are at least 16 bytes. See +[NIST SP 800-132](http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + +Example: + +```None +const crypto = require('crypto'); +crypto.pbkdf2('secret', 'salt', 100000, 64, 'sha512', (err, derivedKey) => { + if (err) throw err; + console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' +}); +``` + +An array of supported digest functions can be retrieved using +[`crypto.getHashes()`](#crypto_crypto_gethashes). + +Note that this API uses libuv's threadpool, which can have surprising and +negative performance implications for some applications, see the +[`UV_THREADPOOL_SIZE`](cli.html#cli_uv_threadpool_size_size) documentation for more information. + +### crypto.pbkdf2Sync(password, salt, iterations, keylen, digest)[#](#crypto_crypto_pbkdf2sync_password_salt_iterations_keylen_digest) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | Calling this function without passing the `digest` parameter is deprecated now and will emit a warning. | +| v6.0.0 | The default encoding for `password` if it is a string changed from `binary` to `utf8`. | +| v0.9.3 | Added in: v0.9.3 | + +* `password` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `salt` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `iterations` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `keylen` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `digest` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns: [](buffer.html#buffer_class_buffer) + +Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) +implementation. A selected HMAC digest algorithm specified by `digest` is +applied to derive a key of the requested byte length (`keylen`) from the +`password`, `salt` and `iterations`. + +If an error occurs an Error will be thrown, otherwise the derived key will be +returned as a [`Buffer`](buffer.html). + +The `iterations` argument must be a number set as high as possible. The +higher the number of iterations, the more secure the derived key will be, +but will take a longer amount of time to complete. + +The `salt` should also be as unique as possible. It is recommended that the +salts are random and their lengths are at least 16 bytes. See +[NIST SP 800-132](http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + +Example: + +```None +const crypto = require('crypto'); +const key = crypto.pbkdf2Sync('secret', 'salt', 100000, 64, 'sha512'); +console.log(key.toString('hex')); // '3745e48...08d59ae' +``` + +An array of supported digest functions can be retrieved using +[`crypto.getHashes()`](#crypto_crypto_gethashes). + +### crypto.privateDecrypt(privateKey, buffer)[#](#crypto_crypto_privatedecrypt_privatekey_buffer) + +Added in: v0.11.14 + +* `privateKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A PEM encoded private key. + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An optional passphrase for the private key. + + `padding` [](crypto.html#crypto_crypto_constants_1) An optional padding value defined in + `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING`, + `RSA_PKCS1_PADDING`, or `crypto.constants.RSA_PKCS1_OAEP_PADDING`. +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) A new `Buffer` with the decrypted content. + +Decrypts `buffer` with `privateKey`. + +`privateKey` can be an object or a string. If `privateKey` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. + +### crypto.privateEncrypt(privateKey, buffer)[#](#crypto_crypto_privateencrypt_privatekey_buffer) + +Added in: v1.1.0 + +* `privateKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A PEM encoded private key. + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An optional passphrase for the private key. + + `padding` [](crypto.html#crypto_crypto_constants_1) An optional padding value defined in + `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING` or + `RSA_PKCS1_PADDING`. +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) A new `Buffer` with the encrypted content. + +Encrypts `buffer` with `privateKey`. + +`privateKey` can be an object or a string. If `privateKey` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. + +### crypto.publicDecrypt(key, buffer)[#](#crypto_crypto_publicdecrypt_key_buffer) + +Added in: v1.1.0 + +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A PEM encoded public or private key. + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An optional passphrase for the private key. + + `padding` [](crypto.html#crypto_crypto_constants_1) An optional padding value defined in + `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING` or + `RSA_PKCS1_PADDING`. +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) A new `Buffer` with the decrypted content. + +Decrypts `buffer` with `key`. + +`key` can be an object or a string. If `key` is a string, it is treated as +the key with no passphrase and will use `RSA_PKCS1_PADDING`. + +Because RSA public keys can be derived from private keys, a private key may +be passed instead of a public key. + +### crypto.publicEncrypt(key, buffer)[#](#crypto_crypto_publicencrypt_key_buffer) + +Added in: v0.11.14 + +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A PEM encoded public or private key. + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An optional passphrase for the private key. + + `padding` [](crypto.html#crypto_crypto_constants_1) An optional padding value defined in + `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING`, + `RSA_PKCS1_PADDING`, or `crypto.constants.RSA_PKCS1_OAEP_PADDING`. +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) A new `Buffer` with the encrypted content. + +Encrypts the content of `buffer` with `key` and returns a new +[`Buffer`](buffer.html) with encrypted content. + +`key` can be an object or a string. If `key` is a string, it is treated as +the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. + +Because RSA public keys can be derived from private keys, a private key may +be passed instead of a public key. + +### crypto.randomBytes(size[, callback])[#](#crypto_crypto_randombytes_size_callback) + +Added in: v0.5.8 + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + + `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + + `buf` [](buffer.html#buffer_class_buffer) +* Returns: [](buffer.html#buffer_class_buffer) if the `callback` function is not provided. + +Generates cryptographically strong pseudo-random data. The `size` argument +is a number indicating the number of bytes to generate. + +If a `callback` function is provided, the bytes are generated asynchronously +and the `callback` function is invoked with two arguments: `err` and `buf`. +If an error occurs, `err` will be an Error object; otherwise it is null. The +`buf` argument is a [`Buffer`](buffer.html) containing the generated bytes. + +```None +// Asynchronous +const crypto = require('crypto'); +crypto.randomBytes(256, (err, buf) => { + if (err) throw err; + console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`); +}); +``` + +If the `callback` function is not provided, the random bytes are generated +synchronously and returned as a [`Buffer`](buffer.html). An error will be thrown if +there is a problem generating the bytes. + +```None +// Synchronous +const buf = crypto.randomBytes(256); +console.log( + `${buf.length} bytes of random data: ${buf.toString('hex')}`); +``` + +The `crypto.randomBytes()` method will not complete until there is +sufficient entropy available. +This should normally never take longer than a few milliseconds. The only time +when generating the random bytes may conceivably block for a longer period of +time is right after boot, when the whole system is still low on entropy. + +Note that this API uses libuv's threadpool, which can have surprising and +negative performance implications for some applications, see the +[`UV_THREADPOOL_SIZE`](cli.html#cli_uv_threadpool_size_size) documentation for more information. + +*Note*: The asynchronous version of `crypto.randomBytes()` is carried out +in a single threadpool request. To minimize threadpool task length variation, +partition large `randomBytes` requests when doing so as part of fulfilling a +client request. + +### crypto.randomFillSync(buffer[, offset][, size])[#](#crypto_crypto_randomfillsync_buffer_offset_size) + +Added in: v7.10.0 + +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) Must be supplied. +* `offset` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) **Default:** `0` +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) **Default:** `buffer.length - offset` +* Returns: [](buffer.html#buffer_class_buffer) + +Synchronous version of [`crypto.randomFill()`](#crypto_crypto_randomfill_buffer_offset_size_callback). + +```None +const buf = Buffer.alloc(10); +console.log(crypto.randomFillSync(buf).toString('hex')); + +crypto.randomFillSync(buf, 5); +console.log(buf.toString('hex')); + +// The above is equivalent to the following: +crypto.randomFillSync(buf, 5, 5); +console.log(buf.toString('hex')); +``` + +### crypto.randomFill(buffer[, offset][, size], callback)[#](#crypto_crypto_randomfill_buffer_offset_size_callback) + +Added in: v7.10.0 + +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) Must be supplied. +* `offset` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) **Default:** `0` +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) **Default:** `buffer.length - offset` +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) `function(err, buf) {}`. + +This function is similar to [`crypto.randomBytes()`](#crypto_crypto_randombytes_size_callback) but requires the first +argument to be a [`Buffer`](buffer.html) that will be filled. It also +requires that a callback is passed in. + +If the `callback` function is not provided, an error will be thrown. + +```None +const buf = Buffer.alloc(10); +crypto.randomFill(buf, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); + +crypto.randomFill(buf, 5, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); + +// The above is equivalent to the following: +crypto.randomFill(buf, 5, 5, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); +``` + +Note that this API uses libuv's threadpool, which can have surprising and +negative performance implications for some applications, see the +[`UV_THREADPOOL_SIZE`](cli.html#cli_uv_threadpool_size_size) documentation for more information. + +*Note*: The asynchronous version of `crypto.randomFill()` is carried out +in a single threadpool request. To minimize threadpool task length variation, +partition large `randomFill` requests when doing so as part of fulfilling a +client request. + +### crypto.setEngine(engine[, flags])[#](#crypto_crypto_setengine_engine_flags) + +Added in: v0.11.11 + +* `engine` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `flags` [](crypto.html#crypto_crypto_constants_1) **Default:** `crypto.constants.ENGINE_METHOD_ALL` + +Load and set the `engine` for some or all OpenSSL functions (selected by flags). + +`engine` could be either an id or a path to the engine's shared library. + +The optional `flags` argument uses `ENGINE_METHOD_ALL` by default. The `flags` +is a bit field taking one of or a mix of the following flags (defined in +`crypto.constants`): + +* `crypto.constants.ENGINE_METHOD_RSA` +* `crypto.constants.ENGINE_METHOD_DSA` +* `crypto.constants.ENGINE_METHOD_DH` +* `crypto.constants.ENGINE_METHOD_RAND` +* `crypto.constants.ENGINE_METHOD_ECDH` +* `crypto.constants.ENGINE_METHOD_ECDSA` +* `crypto.constants.ENGINE_METHOD_CIPHERS` +* `crypto.constants.ENGINE_METHOD_DIGESTS` +* `crypto.constants.ENGINE_METHOD_STORE` +* `crypto.constants.ENGINE_METHOD_PKEY_METHS` +* `crypto.constants.ENGINE_METHOD_PKEY_ASN1_METHS` +* `crypto.constants.ENGINE_METHOD_ALL` +* `crypto.constants.ENGINE_METHOD_NONE` + +### crypto.timingSafeEqual(a, b)[#](#crypto_crypto_timingsafeequal_a_b) + +Added in: v6.6.0 + +* `a` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `b` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +This function is based on a constant-time algorithm. +Returns true if `a` is equal to `b`, without leaking timing information that +would allow an attacker to guess one of the values. This is suitable for +comparing HMAC digests or secret values like authentication cookies or +[capability urls](https://www.w3.org/TR/capability-urls/). + +`a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they +must have the same length. + +*Note*: Use of `crypto.timingSafeEqual` does not guarantee that the +*surrounding* code is timing-safe. Care should be taken to ensure that the +surrounding code does not introduce timing vulnerabilities. + +## Notes[#](#crypto_notes) + +### Legacy Streams API (pre Node.js v0.10)[#](#crypto_legacy_streams_api_pre_node_js_v0_10) + +The Crypto module was added to Node.js before there was the concept of a +unified Stream API, and before there were [`Buffer`](buffer.html) objects for handling +binary data. As such, the many of the `crypto` defined classes have methods not +typically found on other Node.js classes that implement the [streams](stream.html) +API (e.g. `update()`, `final()`, or `digest()`). Also, many methods accepted +and returned `'latin1'` encoded strings by default rather than Buffers. This +default was changed after Node.js v0.8 to use [`Buffer`](buffer.html) objects by default +instead. + +### Recent ECDH Changes[#](#crypto_recent_ecdh_changes) + +Usage of `ECDH` with non-dynamically generated key pairs has been simplified. +Now, [`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_privatekey_encoding) can be called with a preselected private key +and the associated public point (key) will be computed and stored in the object. +This allows code to only store and provide the private part of the EC key pair. +[`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_privatekey_encoding) now also validates that the private key is valid for +the selected curve. + +The [`ecdh.setPublicKey()`](#crypto_ecdh_setpublickey_publickey_encoding) method is now deprecated as its inclusion in the +API is not useful. Either a previously stored private key should be set, which +automatically generates the associated public key, or [`ecdh.generateKeys()`](#crypto_ecdh_generatekeys_encoding_format) +should be called. The main drawback of using [`ecdh.setPublicKey()`](#crypto_ecdh_setpublickey_publickey_encoding) is that +it can be used to put the ECDH key pair into an inconsistent state. + +### Support for weak or compromised algorithms[#](#crypto_support_for_weak_or_compromised_algorithms) + +The `crypto` module still supports some algorithms which are already +compromised and are not currently recommended for use. The API also allows +the use of ciphers and hashes with a small key size that are considered to be +too weak for safe use. + +Users should take full responsibility for selecting the crypto +algorithm and key size according to their security requirements. + +Based on the recommendations of [NIST SP 800-131A](http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar1.pdf): + +* MD5 and SHA-1 are no longer acceptable where collision resistance is + required such as digital signatures. +* The key used with RSA, DSA, and DH algorithms is recommended to have + at least 2048 bits and that of the curve of ECDSA and ECDH at least + 224 bits, to be safe to use for several years. +* The DH groups of `modp1`, `modp2` and `modp5` have a key size + smaller than 2048 bits and are not recommended. + +See the reference for other recommendations and details. + +## Crypto Constants[#](#crypto_crypto_constants_1) + +The following constants exported by `crypto.constants` apply to various uses of +the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL. + +### OpenSSL Options[#](#crypto_openssl_options) + +| Constant | Description | +| --- | --- | +| `SSL_OP_ALL` | Applies multiple bug workarounds within OpenSSL. See for detail. | +| `SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION` | Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See . | +| `SSL_OP_CIPHER_SERVER_PREFERENCE` | Attempts to use the server's preferences instead of the client's when selecting a cipher. Behavior depends on protocol version. See . | +| `SSL_OP_CISCO_ANYCONNECT` | Instructs OpenSSL to use Cisco's "speshul" version of DTLS\_BAD\_VER. | +| `SSL_OP_COOKIE_EXCHANGE` | Instructs OpenSSL to turn on cookie exchange. | +| `SSL_OP_CRYPTOPRO_TLSEXT_BUG` | Instructs OpenSSL to add server-hello extension from an early version of the cryptopro draft. | +| `SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS` | Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. | +| `SSL_OP_EPHEMERAL_RSA` | Instructs OpenSSL to always use the tmp\_rsa key when performing RSA operations. | +| `SSL_OP_LEGACY_SERVER_CONNECT` | Allows initial connection to servers that do not support RI. | +| `SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER` | | +| `SSL_OP_MICROSOFT_SESS_ID_BUG` | | +| `SSL_OP_MSIE_SSLV2_RSA_PADDING` | Instructs OpenSSL to disable the workaround for a man-in-the-middle protocol-version vulnerability in the SSL 2.0 server implementation. | +| `SSL_OP_NETSCAPE_CA_DN_BUG` | | +| `SSL_OP_NETSCAPE_CHALLENGE_BUG` | | +| `SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG` | | +| `SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG` | | +| `SSL_OP_NO_COMPRESSION` | Instructs OpenSSL to disable support for SSL/TLS compression. | +| `SSL_OP_NO_QUERY_MTU` | | +| `SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION` | Instructs OpenSSL to always start a new session when performing renegotiation. | +| `SSL_OP_NO_SSLv2` | Instructs OpenSSL to turn off SSL v2 | +| `SSL_OP_NO_SSLv3` | Instructs OpenSSL to turn off SSL v3 | +| `SSL_OP_NO_TICKET` | Instructs OpenSSL to disable use of RFC4507bis tickets. | +| `SSL_OP_NO_TLSv1` | Instructs OpenSSL to turn off TLS v1 | +| `SSL_OP_NO_TLSv1_1` | Instructs OpenSSL to turn off TLS v1.1 | +| `SSL_OP_NO_TLSv1_2` | Instructs OpenSSL to turn off TLS v1.2 | + `SSL_OP_PKCS1_CHECK_1` | || `SSL_OP_PKCS1_CHECK_2` | | +| `SSL_OP_SINGLE_DH_USE` | Instructs OpenSSL to always create a new key when using temporary/ephemeral DH parameters. | +| `SSL_OP_SINGLE_ECDH_USE` | Instructs OpenSSL to always create a new key when using temporary/ephemeral ECDH parameters. | + `SSL_OP_SSLEAY_080_CLIENT_DH_BUG` | || `SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG` | | +| `SSL_OP_TLS_BLOCK_PADDING_BUG` | | +| `SSL_OP_TLS_D5_BUG` | | +| `SSL_OP_TLS_ROLLBACK_BUG` | Instructs OpenSSL to disable version rollback attack detection. | + +### OpenSSL Engine Constants[#](#crypto_openssl_engine_constants) + +| Constant | Description | +| --- | --- | +| `ENGINE_METHOD_RSA` | Limit engine usage to RSA | +| `ENGINE_METHOD_DSA` | Limit engine usage to DSA | +| `ENGINE_METHOD_DH` | Limit engine usage to DH | +| `ENGINE_METHOD_RAND` | Limit engine usage to RAND | +| `ENGINE_METHOD_ECDH` | Limit engine usage to ECDH | +| `ENGINE_METHOD_ECDSA` | Limit engine usage to ECDSA | +| `ENGINE_METHOD_CIPHERS` | Limit engine usage to CIPHERS | +| `ENGINE_METHOD_DIGESTS` | Limit engine usage to DIGESTS | +| `ENGINE_METHOD_STORE` | Limit engine usage to STORE | +| `ENGINE_METHOD_PKEY_METHS` | Limit engine usage to PKEY\_METHDS | +| `ENGINE_METHOD_PKEY_ASN1_METHS` | Limit engine usage to PKEY\_ASN1\_METHS | +| `ENGINE_METHOD_ALL` | | +| `ENGINE_METHOD_NONE` | | + +### Other OpenSSL Constants[#](#crypto_other_openssl_constants) + +| Constant | Description | +| --- | --- | +| `DH_CHECK_P_NOT_SAFE_PRIME` | | +| `DH_CHECK_P_NOT_PRIME` | | +| `DH_UNABLE_TO_CHECK_GENERATOR` | | +| `DH_NOT_SUITABLE_GENERATOR` | | +| `NPN_ENABLED` | | +| `ALPN_ENABLED` | | +| `RSA_PKCS1_PADDING` | | +| `RSA_SSLV23_PADDING` | | +| `RSA_NO_PADDING` | | +| `RSA_PKCS1_OAEP_PADDING` | | +| `RSA_X931_PADDING` | | +| `RSA_PKCS1_PSS_PADDING` | | +| `RSA_PSS_SALTLEN_DIGEST` | Sets the salt length for `RSA_PKCS1_PSS_PADDING` to the digest size when signing or verifying. | +| `RSA_PSS_SALTLEN_MAX_SIGN` | Sets the salt length for `RSA_PKCS1_PSS_PADDING` to the maximum permissible value when signing data. | +| `RSA_PSS_SALTLEN_AUTO` | Causes the salt length for `RSA_PKCS1_PSS_PADDING` to be determined automatically when verifying a signature. | +| `POINT_CONVERSION_COMPRESSED` | | +| `POINT_CONVERSION_UNCOMPRESSED` | | +| `POINT_CONVERSION_HYBRID` | | + +### Node.js Crypto Constants[#](#crypto_node_js_crypto_constants) + +| Constant | Description | +| --- | --- | +| `defaultCoreCipherList` | Specifies the built-in default cipher list used by Node.js. | +| `defaultCipherList` | Specifies the active default cipher list used by the current Node.js process. | diff --git a/corpus/docs/nodejs/crypto/crypto_9x.md b/corpus/docs/nodejs/crypto/crypto_9x.md new file mode 100644 index 0000000000000000000000000000000000000000..2dbfa7992f673ff2f57ca08bfb911ab01d7857e1 --- /dev/null +++ b/corpus/docs/nodejs/crypto/crypto_9x.md @@ -0,0 +1,2148 @@ +# Crypto# + +Source: https://nodejs.org/docs/latest-v9.x/api/crypto.html +Version: 9.x + +[Stability: 2](documentation.html#documentation_stability_index) - Stable + +The `crypto` module provides cryptographic functionality that includes a set of +wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify functions. + +Use `require('crypto')` to access this module. + +```None +const crypto = require('crypto'); + +const secret = 'abcdefg'; +const hash = crypto.createHmac('sha256', secret) + .update('I love cupcakes') + .digest('hex'); +console.log(hash); +// Prints: +// c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e +``` + +## Determining if crypto support is unavailable[#](#crypto_determining_if_crypto_support_is_unavailable) + +It is possible for Node.js to be built without including support for the +`crypto` module. In such cases, calling `require('crypto')` will result in an +error being thrown. + +```None +let crypto; +try { + crypto = require('crypto'); +} catch (err) { + console.log('crypto support is disabled!'); +} +``` + +## Class: Certificate[#](#crypto_class_certificate) + +Added in: v0.11.8 + +SPKAC is a Certificate Signing Request mechanism originally implemented by +Netscape and was specified formally as part of [HTML5's `keygen` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/keygen). + +Note that `` is deprecated since [HTML 5.2](https://www.w3.org/TR/html52/changes.html#features-removed) and new projects +should not use this element anymore. + +The `crypto` module provides the `Certificate` class for working with SPKAC +data. The most common usage is handling output generated by the HTML5 +`` element. Node.js uses [OpenSSL's SPKAC implementation](https://www.openssl.org/docs/man1.0.2/apps/spkac.html) internally. + +### Certificate.exportChallenge(spkac)[#](#crypto_certificate_exportchallenge_spkac) + +Added in: v9.0.0 + +* `spkac` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns [](buffer.html#buffer_class_buffer) The challenge component of the `spkac` data structure, which + includes a public key and a challenge. + +```None +const { Certificate } = require('crypto'); +const spkac = getSpkacSomehow(); +const challenge = Certificate.exportChallenge(spkac); +console.log(challenge.toString('utf8')); +// Prints: the challenge as a UTF8 string +``` + +### Certificate.exportPublicKey(spkac[, encoding])[#](#crypto_certificate_exportpublickey_spkac_encoding) + +Added in: v9.0.0 + +* `spkac` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* Returns [](buffer.html#buffer_class_buffer) The public key component of the `spkac` data structure, + which includes a public key and a challenge. + +```None +const { Certificate } = require('crypto'); +const spkac = getSpkacSomehow(); +const publicKey = Certificate.exportPublicKey(spkac); +console.log(publicKey); +// Prints: the public key as +``` + +### Certificate.verifySpkac(spkac)[#](#crypto_certificate_verifyspkac_spkac) + +Added in: v9.0.0 + +* `spkac` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` if the given `spkac` data structure is valid, `false` + otherwise. + +```None +const { Certificate } = require('crypto'); +const spkac = getSpkacSomehow(); +console.log(Certificate.verifySpkac(Buffer.from(spkac))); +// Prints: true or false +``` + +### Legacy API[#](#crypto_legacy_api) + +As a still supported legacy interface, it is possible (but not recommended) to +create new instances of the `crypto.Certificate` class as illustrated in the +examples below. + +#### new crypto.Certificate()[#](#crypto_new_crypto_certificate) + +Instances of the `Certificate` class can be created using the `new` keyword +or by calling `crypto.Certificate()` as a function: + +```None +const crypto = require('crypto'); + +const cert1 = new crypto.Certificate(); +const cert2 = crypto.Certificate(); +``` + +#### certificate.exportChallenge(spkac)[#](#crypto_certificate_exportchallenge_spkac_1) + +Added in: v0.11.8 + +* `spkac` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns [](buffer.html#buffer_class_buffer) The challenge component of the `spkac` data structure, which + includes a public key and a challenge. + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +const challenge = cert.exportChallenge(spkac); +console.log(challenge.toString('utf8')); +// Prints: the challenge as a UTF8 string +``` + +#### certificate.exportPublicKey(spkac)[#](#crypto_certificate_exportpublickey_spkac) + +Added in: v0.11.8 + +* `spkac` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns [](buffer.html#buffer_class_buffer) The public key component of the `spkac` data structure, + which includes a public key and a challenge. + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +const publicKey = cert.exportPublicKey(spkac); +console.log(publicKey); +// Prints: the public key as +``` + +#### certificate.verifySpkac(spkac)[#](#crypto_certificate_verifyspkac_spkac_1) + +Added in: v0.11.8 + +* `spkac` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` if the given `spkac` data structure is valid, `false` + otherwise. + +```None +const cert = require('crypto').Certificate(); +const spkac = getSpkacSomehow(); +console.log(cert.verifySpkac(Buffer.from(spkac))); +// Prints: true or false +``` + +## Class: Cipher[#](#crypto_class_cipher) + +Added in: v0.1.94 + +Instances of the `Cipher` class are used to encrypt data. The class can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where plain unencrypted + data is written to produce encrypted data on the readable side, or +* Using the [`cipher.update()`](#crypto_cipher_update_data_inputencoding_outputencoding) and [`cipher.final()`](#crypto_cipher_final_outputencoding) methods to produce + the encrypted data. + +The [`crypto.createCipher()`](#crypto_crypto_createcipher_algorithm_password_options) or [`crypto.createCipheriv()`](#crypto_crypto_createcipheriv_algorithm_key_iv_options) methods are +used to create `Cipher` instances. `Cipher` objects are not to be created +directly using the `new` keyword. + +Example: Using `Cipher` objects as streams: + +```None +const crypto = require('crypto'); +const cipher = crypto.createCipher('aes192', 'a password'); + +let encrypted = ''; +cipher.on('readable', () => { + const data = cipher.read(); + if (data) + encrypted += data.toString('hex'); +}); +cipher.on('end', () => { + console.log(encrypted); + // Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 +}); + +cipher.write('some clear text data'); +cipher.end(); +``` + +Example: Using `Cipher` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const cipher = crypto.createCipher('aes192', 'a password'); + +const input = fs.createReadStream('test.js'); +const output = fs.createWriteStream('test.enc'); + +input.pipe(cipher).pipe(output); +``` + +Example: Using the [`cipher.update()`](#crypto_cipher_update_data_inputencoding_outputencoding) and [`cipher.final()`](#crypto_cipher_final_outputencoding) methods: + +```None +const crypto = require('crypto'); +const cipher = crypto.createCipher('aes192', 'a password'); + +let encrypted = cipher.update('some clear text data', 'utf8', 'hex'); +encrypted += cipher.final('hex'); +console.log(encrypted); +// Prints: ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504 +``` + +### cipher.final([outputEncoding])[#](#crypto_cipher_final_outputencoding) + +Added in: v0.1.94 + +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns any remaining enciphered contents. If `outputEncoding` +parameter is one of `'latin1'`, `'base64'` or `'hex'`, a string is returned. +If an `outputEncoding` is not provided, a [`Buffer`](buffer.html) is returned. + +Once the `cipher.final()` method has been called, the `Cipher` object can no +longer be used to encrypt data. Attempts to call `cipher.final()` more than +once will result in an error being thrown. + +### cipher.setAAD(buffer)[#](#crypto_cipher_setaad_buffer) + +Added in: v1.0.0 + +* `buffer` [](buffer.html#buffer_class_buffer) +* Returns the for method chaining. + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `cipher.setAAD()` method sets the value used for the +*additional authenticated data* (AAD) input parameter. + +The `cipher.setAAD()` method must be called before [`cipher.update()`](#crypto_cipher_update_data_inputencoding_outputencoding). + +### cipher.getAuthTag()[#](#crypto_cipher_getauthtag) + +Added in: v1.0.0 + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `cipher.getAuthTag()` method returns a [`Buffer`](buffer.html) containing +the *authentication tag* that has been computed from the given data. + +The `cipher.getAuthTag()` method should only be called after encryption has +been completed using the [`cipher.final()`](#crypto_cipher_final_outputencoding) method. + +### cipher.setAutoPadding([autoPadding])[#](#crypto_cipher_setautopadding_autopadding) + +Added in: v0.7.1 + +* `autoPadding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Defaults to `true`. +* Returns the for method chaining. + +When using block encryption algorithms, the `Cipher` class will automatically +add padding to the input data to the appropriate block size. To disable the +default padding call `cipher.setAutoPadding(false)`. + +When `autoPadding` is `false`, the length of the entire input data must be a +multiple of the cipher's block size or [`cipher.final()`](#crypto_cipher_final_outputencoding) will throw an Error. +Disabling automatic padding is useful for non-standard padding, for instance +using `0x0` instead of PKCS padding. + +The `cipher.setAutoPadding()` method must be called before +[`cipher.final()`](#crypto_cipher_final_outputencoding). + +### cipher.update(data[, inputEncoding][, outputEncoding])[#](#crypto_cipher_update_data_inputencoding_outputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.94 | Added in: v0.1.94 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Updates the cipher with `data`. If the `inputEncoding` argument is given, +its value must be one of `'utf8'`, `'ascii'`, or `'latin1'` and the `data` +argument is a string using the specified encoding. If the `inputEncoding` +argument is not given, `data` must be a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or `DataView`, then +`inputEncoding` is ignored. + +The `outputEncoding` specifies the output format of the enciphered +data, and can be `'latin1'`, `'base64'` or `'hex'`. If the `outputEncoding` +is specified, a string using the specified encoding is returned. If no +`outputEncoding` is provided, a [`Buffer`](buffer.html) is returned. + +The `cipher.update()` method can be called multiple times with new data until +[`cipher.final()`](#crypto_cipher_final_outputencoding) is called. Calling `cipher.update()` after +[`cipher.final()`](#crypto_cipher_final_outputencoding) will result in an error being thrown. + +## Class: Decipher[#](#crypto_class_decipher) + +Added in: v0.1.94 + +Instances of the `Decipher` class are used to decrypt data. The class can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where plain encrypted + data is written to produce unencrypted data on the readable side, or +* Using the [`decipher.update()`](#crypto_decipher_update_data_inputencoding_outputencoding) and [`decipher.final()`](#crypto_decipher_final_outputencoding) methods to + produce the unencrypted data. + +The [`crypto.createDecipher()`](#crypto_crypto_createdecipher_algorithm_password_options) or [`crypto.createDecipheriv()`](#crypto_crypto_createdecipheriv_algorithm_key_iv_options) methods are +used to create `Decipher` instances. `Decipher` objects are not to be created +directly using the `new` keyword. + +Example: Using `Decipher` objects as streams: + +```None +const crypto = require('crypto'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +let decrypted = ''; +decipher.on('readable', () => { + const data = decipher.read(); + if (data) + decrypted += data.toString('utf8'); +}); +decipher.on('end', () => { + console.log(decrypted); + // Prints: some clear text data +}); + +const encrypted = + 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; +decipher.write(encrypted, 'hex'); +decipher.end(); +``` + +Example: Using `Decipher` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +const input = fs.createReadStream('test.enc'); +const output = fs.createWriteStream('test.js'); + +input.pipe(decipher).pipe(output); +``` + +Example: Using the [`decipher.update()`](#crypto_decipher_update_data_inputencoding_outputencoding) and [`decipher.final()`](#crypto_decipher_final_outputencoding) methods: + +```None +const crypto = require('crypto'); +const decipher = crypto.createDecipher('aes192', 'a password'); + +const encrypted = + 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; +let decrypted = decipher.update(encrypted, 'hex', 'utf8'); +decrypted += decipher.final('utf8'); +console.log(decrypted); +// Prints: some clear text data +``` + +### decipher.final([outputEncoding])[#](#crypto_decipher_final_outputencoding) + +Added in: v0.1.94 + +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns any remaining deciphered contents. If `outputEncoding` +parameter is one of `'latin1'`, `'ascii'` or `'utf8'`, a string is returned. +If an `outputEncoding` is not provided, a [`Buffer`](buffer.html) is returned. + +Once the `decipher.final()` method has been called, the `Decipher` object can +no longer be used to decrypt data. Attempts to call `decipher.final()` more +than once will result in an error being thrown. + +### decipher.setAAD(buffer)[#](#crypto_decipher_setaad_buffer) + +History + +| Version | Changes | +| --- | --- | +| v7.2.0 | This method now returns a reference to `decipher`. | +| v1.0.0 | Added in: v1.0.0 | + +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns the for method chaining. + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `decipher.setAAD()` method sets the value used for the +*additional authenticated data* (AAD) input parameter. + +The `decipher.setAAD()` method must be called before [`decipher.update()`](#crypto_decipher_update_data_inputencoding_outputencoding). + +### decipher.setAuthTag(buffer)[#](#crypto_decipher_setauthtag_buffer) + +History + +| Version | Changes | +| --- | --- | +| v7.2.0 | This method now returns a reference to `decipher`. | +| v1.0.0 | Added in: v1.0.0 | + +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns the for method chaining. + +When using an authenticated encryption mode (only `GCM` is currently +supported), the `decipher.setAuthTag()` method is used to pass in the +received *authentication tag*. If no tag is provided, or if the cipher text +has been tampered with, [`decipher.final()`](#crypto_decipher_final_outputencoding) will throw, indicating that the +cipher text should be discarded due to failed authentication. + +Note that this Node.js version does not verify the length of GCM authentication +tags. Such a check *must* be implemented by applications and is crucial to the +authenticity of the encrypted data, otherwise, an attacker can use an +arbitrarily short authentication tag to increase the chances of successfully +passing authentication (up to 0.39%). It is highly recommended to associate one +of the values 16, 15, 14, 13, 12, 8 or 4 bytes with each key, and to only permit +authentication tags of that length, see [NIST SP 800-38D](http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf). + +The `decipher.setAuthTag()` method must be called before +[`decipher.final()`](#crypto_decipher_final_outputencoding). + +### decipher.setAutoPadding([autoPadding])[#](#crypto_decipher_setautopadding_autopadding) + +Added in: v0.7.1 + +* `autoPadding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Defaults to `true`. +* Returns the for method chaining. + +When data has been encrypted without standard block padding, calling +`decipher.setAutoPadding(false)` will disable automatic padding to prevent +[`decipher.final()`](#crypto_decipher_final_outputencoding) from checking for and removing padding. + +Turning auto padding off will only work if the input data's length is a +multiple of the ciphers block size. + +The `decipher.setAutoPadding()` method must be called before +[`decipher.final()`](#crypto_decipher_final_outputencoding). + +### decipher.update(data[, inputEncoding][, outputEncoding])[#](#crypto_decipher_update_data_inputencoding_outputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.94 | Added in: v0.1.94 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Updates the decipher with `data`. If the `inputEncoding` argument is given, +its value must be one of `'latin1'`, `'base64'`, or `'hex'` and the `data` +argument is a string using the specified encoding. If the `inputEncoding` +argument is not given, `data` must be a [`Buffer`](buffer.html). If `data` is a +[`Buffer`](buffer.html) then `inputEncoding` is ignored. + +The `outputEncoding` specifies the output format of the enciphered +data, and can be `'latin1'`, `'ascii'` or `'utf8'`. If the `outputEncoding` +is specified, a string using the specified encoding is returned. If no +`outputEncoding` is provided, a [`Buffer`](buffer.html) is returned. + +The `decipher.update()` method can be called multiple times with new data until +[`decipher.final()`](#crypto_decipher_final_outputencoding) is called. Calling `decipher.update()` after +[`decipher.final()`](#crypto_decipher_final_outputencoding) will result in an error being thrown. + +## Class: DiffieHellman[#](#crypto_class_diffiehellman) + +Added in: v0.5.0 + +The `DiffieHellman` class is a utility for creating Diffie-Hellman key +exchanges. + +Instances of the `DiffieHellman` class can be created using the +[`crypto.createDiffieHellman()`](#crypto_crypto_creatediffiehellman_prime_primeencoding_generator_generatorencoding) function. + +```None +const crypto = require('crypto'); +const assert = require('assert'); + +// Generate Alice's keys... +const alice = crypto.createDiffieHellman(2048); +const aliceKey = alice.generateKeys(); + +// Generate Bob's keys... +const bob = crypto.createDiffieHellman(alice.getPrime(), alice.getGenerator()); +const bobKey = bob.generateKeys(); + +// Exchange and generate the secret... +const aliceSecret = alice.computeSecret(bobKey); +const bobSecret = bob.computeSecret(aliceKey); + +// OK +assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); +``` + +### diffieHellman.computeSecret(otherPublicKey[, inputEncoding][, outputEncoding])[#](#crypto_diffiehellman_computesecret_otherpublickey_inputencoding_outputencoding) + +Added in: v0.5.0 + +* `otherPublicKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Computes the shared secret using `otherPublicKey` as the other +party's public key and returns the computed shared secret. The supplied +key is interpreted using the specified `inputEncoding`, and secret is +encoded using specified `outputEncoding`. Encodings can be +`'latin1'`, `'hex'`, or `'base64'`. If the `inputEncoding` is not +provided, `otherPublicKey` is expected to be a [`Buffer`](buffer.html), +`TypedArray`, or `DataView`. + +If `outputEncoding` is given a string is returned; otherwise, a +[`Buffer`](buffer.html) is returned. + +### diffieHellman.generateKeys([encoding])[#](#crypto_diffiehellman_generatekeys_encoding) + +Added in: v0.5.0 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Generates private and public Diffie-Hellman key values, and returns +the public key in the specified `encoding`. This key should be +transferred to the other party. Encoding can be `'latin1'`, `'hex'`, +or `'base64'`. If `encoding` is provided a string is returned; otherwise a +[`Buffer`](buffer.html) is returned. + +### diffieHellman.getGenerator([encoding])[#](#crypto_diffiehellman_getgenerator_encoding) + +Added in: v0.5.0 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the Diffie-Hellman generator in the specified `encoding`, which can +be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is +returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPrime([encoding])[#](#crypto_diffiehellman_getprime_encoding) + +Added in: v0.5.0 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the Diffie-Hellman prime in the specified `encoding`, which can +be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is +returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPrivateKey([encoding])[#](#crypto_diffiehellman_getprivatekey_encoding) + +Added in: v0.5.0 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the Diffie-Hellman private key in the specified `encoding`, +which can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a +string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.getPublicKey([encoding])[#](#crypto_diffiehellman_getpublickey_encoding) + +Added in: v0.5.0 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the Diffie-Hellman public key in the specified `encoding`, which +can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a +string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### diffieHellman.setPrivateKey(privateKey[, encoding])[#](#crypto_diffiehellman_setprivatekey_privatekey_encoding) + +Added in: v0.5.0 + +* `privateKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Sets the Diffie-Hellman private key. If the `encoding` argument is provided +and is either `'latin1'`, `'hex'`, or `'base64'`, `privateKey` is expected +to be a string. If no `encoding` is provided, `privateKey` is expected +to be a [`Buffer`](buffer.html), `TypedArray`, or `DataView`. + +### diffieHellman.setPublicKey(publicKey[, encoding])[#](#crypto_diffiehellman_setpublickey_publickey_encoding) + +Added in: v0.5.0 + +* `publicKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Sets the Diffie-Hellman public key. If the `encoding` argument is provided +and is either `'latin1'`, `'hex'` or `'base64'`, `publicKey` is expected +to be a string. If no `encoding` is provided, `publicKey` is expected +to be a [`Buffer`](buffer.html), `TypedArray`, or `DataView`. + +### diffieHellman.verifyError[#](#crypto_diffiehellman_verifyerror) + +Added in: v0.11.12 + +A bit field containing any warnings and/or errors resulting from a check +performed during initialization of the `DiffieHellman` object. + +The following values are valid for this property (as defined in `constants` +module): + +* `DH_CHECK_P_NOT_SAFE_PRIME` +* `DH_CHECK_P_NOT_PRIME` +* `DH_UNABLE_TO_CHECK_GENERATOR` +* `DH_NOT_SUITABLE_GENERATOR` + +## Class: ECDH[#](#crypto_class_ecdh) + +Added in: v0.11.14 + +The `ECDH` class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH) +key exchanges. + +Instances of the `ECDH` class can be created using the +[`crypto.createECDH()`](#crypto_crypto_createecdh_curvename) function. + +```None +const crypto = require('crypto'); +const assert = require('assert'); + +// Generate Alice's keys... +const alice = crypto.createECDH('secp521r1'); +const aliceKey = alice.generateKeys(); + +// Generate Bob's keys... +const bob = crypto.createECDH('secp521r1'); +const bobKey = bob.generateKeys(); + +// Exchange and generate the secret... +const aliceSecret = alice.computeSecret(bobKey); +const bobSecret = bob.computeSecret(aliceKey); + +assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); +// OK +``` + +### ecdh.computeSecret(otherPublicKey[, inputEncoding][, outputEncoding])[#](#crypto_ecdh_computesecret_otherpublickey_inputencoding_outputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.11.14 | Added in: v0.11.14 | + +* `otherPublicKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `outputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Computes the shared secret using `otherPublicKey` as the other +party's public key and returns the computed shared secret. The supplied +key is interpreted using specified `inputEncoding`, and the returned secret +is encoded using the specified `outputEncoding`. Encodings can be +`'latin1'`, `'hex'`, or `'base64'`. If the `inputEncoding` is not +provided, `otherPublicKey` is expected to be a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`. + +If `outputEncoding` is given a string will be returned; otherwise a +[`Buffer`](buffer.html) is returned. + +### ecdh.generateKeys([encoding[, format]])[#](#crypto_ecdh_generatekeys_encoding_format) + +Added in: v0.11.14 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `format` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Defaults to `uncompressed`. + +Generates private and public EC Diffie-Hellman key values, and returns +the public key in the specified `format` and `encoding`. This key should be +transferred to the other party. + +The `format` argument specifies point encoding and can be `'compressed'` or +`'uncompressed'`. If `format` is not specified, the point will be returned in +`'uncompressed'` format. + +The `encoding` argument can be `'latin1'`, `'hex'`, or `'base64'`. If +`encoding` is provided a string is returned; otherwise a [`Buffer`](buffer.html) +is returned. + +### ecdh.getPrivateKey([encoding])[#](#crypto_ecdh_getprivatekey_encoding) + +Added in: v0.11.14 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the EC Diffie-Hellman private key in the specified `encoding`, +which can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided +a string is returned; otherwise a [`Buffer`](buffer.html) is returned. + +### ecdh.getPublicKey([encoding][, format])[#](#crypto_ecdh_getpublickey_encoding_format) + +Added in: v0.11.14 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `format` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Defaults to `uncompressed`. + +Returns the EC Diffie-Hellman public key in the specified `encoding` and +`format`. + +The `format` argument specifies point encoding and can be `'compressed'` or +`'uncompressed'`. If `format` is not specified the point will be returned in +`'uncompressed'` format. + +The `encoding` argument can be `'latin1'`, `'hex'`, or `'base64'`. If +`encoding` is specified, a string is returned; otherwise a [`Buffer`](buffer.html) is +returned. + +### ecdh.setPrivateKey(privateKey[, encoding])[#](#crypto_ecdh_setprivatekey_privatekey_encoding) + +Added in: v0.11.14 + +* `privateKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Sets the EC Diffie-Hellman private key. The `encoding` can be `'latin1'`, +`'hex'` or `'base64'`. If `encoding` is provided, `privateKey` is expected +to be a string; otherwise `privateKey` is expected to be a [`Buffer`](buffer.html), +`TypedArray`, or `DataView`. + +If `privateKey` is not valid for the curve specified when the `ECDH` object was +created, an error is thrown. Upon setting the private key, the associated +public point (key) is also generated and set in the ECDH object. + +### ecdh.setPublicKey(publicKey[, encoding])[#](#crypto_ecdh_setpublickey_publickey_encoding) + +Added in: v0.11.14Deprecated since: v5.2.0 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated + +* `publicKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Sets the EC Diffie-Hellman public key. Key encoding can be `'latin1'`, +`'hex'` or `'base64'`. If `encoding` is provided `publicKey` is expected to +be a string; otherwise a [`Buffer`](buffer.html), `TypedArray`, or `DataView` is expected. + +Note that there is not normally a reason to call this method because `ECDH` +only requires a private key and the other party's public key to compute the +shared secret. Typically either [`ecdh.generateKeys()`](#crypto_ecdh_generatekeys_encoding_format) or +[`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_privatekey_encoding) will be called. The [`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_privatekey_encoding) method +attempts to generate the public point/key associated with the private key being +set. + +Example (obtaining a shared secret): + +```None +const crypto = require('crypto'); +const alice = crypto.createECDH('secp256k1'); +const bob = crypto.createECDH('secp256k1'); + +// Note: This is a shortcut way to specify one of Alice's previous private +// keys. It would be unwise to use such a predictable private key in a real +// application. +alice.setPrivateKey( + crypto.createHash('sha256').update('alice', 'utf8').digest() +); + +// Bob uses a newly generated cryptographically strong +// pseudorandom key pair +bob.generateKeys(); + +const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +// aliceSecret and bobSecret should be the same shared secret value +console.log(aliceSecret === bobSecret); +``` + +## Class: Hash[#](#crypto_class_hash) + +Added in: v0.1.92 + +The `Hash` class is a utility for creating hash digests of data. It can be +used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where data is written + to produce a computed hash digest on the readable side, or +* Using the [`hash.update()`](#crypto_hash_update_data_inputencoding) and [`hash.digest()`](#crypto_hash_digest_encoding) methods to produce the + computed hash. + +The [`crypto.createHash()`](#crypto_crypto_createhash_algorithm_options) method is used to create `Hash` instances. `Hash` +objects are not to be created directly using the `new` keyword. + +Example: Using `Hash` objects as streams: + +```None +const crypto = require('crypto'); +const hash = crypto.createHash('sha256'); + +hash.on('readable', () => { + const data = hash.read(); + if (data) { + console.log(data.toString('hex')); + // Prints: + // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 + } +}); + +hash.write('some data to hash'); +hash.end(); +``` + +Example: Using `Hash` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const hash = crypto.createHash('sha256'); + +const input = fs.createReadStream('test.js'); +input.pipe(hash).pipe(process.stdout); +``` + +Example: Using the [`hash.update()`](#crypto_hash_update_data_inputencoding) and [`hash.digest()`](#crypto_hash_digest_encoding) methods: + +```None +const crypto = require('crypto'); +const hash = crypto.createHash('sha256'); + +hash.update('some data to hash'); +console.log(hash.digest('hex')); +// Prints: +// 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 +``` + +### hash.digest([encoding])[#](#crypto_hash_digest_encoding) + +Added in: v0.1.92 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Calculates the digest of all of the data passed to be hashed (using the +[`hash.update()`](#crypto_hash_update_data_inputencoding) method). The `encoding` can be `'hex'`, `'latin1'` or +`'base64'`. If `encoding` is provided a string will be returned; otherwise +a [`Buffer`](buffer.html) is returned. + +The `Hash` object can not be used again after `hash.digest()` method has been +called. Multiple calls will cause an error to be thrown. + +### hash.update(data[, inputEncoding])[#](#crypto_hash_update_data_inputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.92 | Added in: v0.1.92 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Updates the hash content with the given `data`, the encoding of which +is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or +`'latin1'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`, then `inputEncoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Hmac[#](#crypto_class_hmac) + +Added in: v0.1.94 + +The `Hmac` Class is a utility for creating cryptographic HMAC digests. It can +be used in one of two ways: + +* As a [stream](stream.html) that is both readable and writable, where data is written + to produce a computed HMAC digest on the readable side, or +* Using the [`hmac.update()`](#crypto_hmac_update_data_inputencoding) and [`hmac.digest()`](#crypto_hmac_digest_encoding) methods to produce the + computed HMAC digest. + +The [`crypto.createHmac()`](#crypto_crypto_createhmac_algorithm_key_options) method is used to create `Hmac` instances. `Hmac` +objects are not to be created directly using the `new` keyword. + +Example: Using `Hmac` objects as streams: + +```None +const crypto = require('crypto'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +hmac.on('readable', () => { + const data = hmac.read(); + if (data) { + console.log(data.toString('hex')); + // Prints: + // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e + } +}); + +hmac.write('some data to hash'); +hmac.end(); +``` + +Example: Using `Hmac` and piped streams: + +```None +const crypto = require('crypto'); +const fs = require('fs'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +const input = fs.createReadStream('test.js'); +input.pipe(hmac).pipe(process.stdout); +``` + +Example: Using the [`hmac.update()`](#crypto_hmac_update_data_inputencoding) and [`hmac.digest()`](#crypto_hmac_digest_encoding) methods: + +```None +const crypto = require('crypto'); +const hmac = crypto.createHmac('sha256', 'a secret'); + +hmac.update('some data to hash'); +console.log(hmac.digest('hex')); +// Prints: +// 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e +``` + +### hmac.digest([encoding])[#](#crypto_hmac_digest_encoding) + +Added in: v0.1.94 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Calculates the HMAC digest of all of the data passed using [`hmac.update()`](#crypto_hmac_update_data_inputencoding). +The `encoding` can be `'hex'`, `'latin1'` or `'base64'`. If `encoding` is +provided a string is returned; otherwise a [`Buffer`](buffer.html) is returned; + +The `Hmac` object can not be used again after `hmac.digest()` has been +called. Multiple calls to `hmac.digest()` will result in an error being thrown. + +### hmac.update(data[, inputEncoding])[#](#crypto_hmac_update_data_inputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.94 | Added in: v0.1.94 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Updates the `Hmac` content with the given `data`, the encoding of which +is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or +`'latin1'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`, then `inputEncoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Sign[#](#crypto_class_sign) + +Added in: v0.1.92 + +The `Sign` Class is a utility for generating signatures. It can be used in one +of two ways: + +* As a writable [stream](stream.html), where data to be signed is written and the + [`sign.sign()`](#crypto_sign_sign_privatekey_outputformat) method is used to generate and return the signature, or +* Using the [`sign.update()`](#crypto_sign_update_data_inputencoding) and [`sign.sign()`](#crypto_sign_sign_privatekey_outputformat) methods to produce the + signature. + +The [`crypto.createSign()`](#crypto_crypto_createsign_algorithm_options) method is used to create `Sign` instances. The +argument is the string name of the hash function to use. `Sign` objects are not +to be created directly using the `new` keyword. + +Example: Using `Sign` objects as streams: + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('SHA256'); + +sign.write('some data to sign'); +sign.end(); + +const privateKey = getPrivateKeySomehow(); +console.log(sign.sign(privateKey, 'hex')); +// Prints: the calculated signature using the specified private key and +// SHA-256. For RSA keys, the algorithm is RSASSA-PKCS1-v1_5 (see padding +// parameter below for RSASSA-PSS). For EC keys, the algorithm is ECDSA. +``` + +Example: Using the [`sign.update()`](#crypto_sign_update_data_inputencoding) and [`sign.sign()`](#crypto_sign_sign_privatekey_outputformat) methods: + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('SHA256'); + +sign.update('some data to sign'); + +const privateKey = getPrivateKeySomehow(); +console.log(sign.sign(privateKey, 'hex')); +// Prints: the calculated signature +``` + +In some cases, a `Sign` instance can also be created by passing in a signature +algorithm name, such as 'RSA-SHA256'. This will use the corresponding digest +algorithm. This does not work for all signature algorithms, such as +'ecdsa-with-SHA256'. Use digest names instead. + +Example: signing using legacy signature algorithm name + +```None +const crypto = require('crypto'); +const sign = crypto.createSign('RSA-SHA256'); + +sign.update('some data to sign'); + +const privateKey = getPrivateKeySomehow(); +console.log(sign.sign(privateKey, 'hex')); +// Prints: the calculated signature +``` + +### sign.sign(privateKey[, outputFormat])[#](#crypto_sign_sign_privatekey_outputformat) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | Support for RSASSA-PSS and additional options was added. | +| v0.1.92 | Added in: v0.1.92 | + +* `privateKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `outputFormat` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Calculates the signature on all the data passed through using either +[`sign.update()`](#crypto_sign_update_data_inputencoding) or [`sign.write()`](stream.html#stream_writable_write_chunk_encoding_callback). + +The `privateKey` argument can be an object or a string. If `privateKey` is a +string, it is treated as a raw key with no passphrase. If `privateKey` is an +object, it must contain one or more of the following properties: + +* `key`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded private key (required) +* `passphrase`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - passphrase for the private key +* `padding`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - Optional padding value for RSA, one of the following: + + + `crypto.constants.RSA_PKCS1_PADDING` (default) + + `crypto.constants.RSA_PKCS1_PSS_PADDING` + + Note that `RSA_PKCS1_PSS_PADDING` will use MGF1 with the same hash function + used to sign the message as specified in section 3.1 of [RFC 4055](https://www.rfc-editor.org/rfc/rfc4055.txt). +* `saltLength`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - salt length for when padding is + `RSA_PKCS1_PSS_PADDING`. The special value + `crypto.constants.RSA_PSS_SALTLEN_DIGEST` sets the salt length to the digest + size, `crypto.constants.RSA_PSS_SALTLEN_MAX_SIGN` (default) sets it to the + maximum permissible value. + +The `outputFormat` can specify one of `'latin1'`, `'hex'` or `'base64'`. If +`outputFormat` is provided a string is returned; otherwise a [`Buffer`](buffer.html) is +returned. + +The `Sign` object can not be again used after `sign.sign()` method has been +called. Multiple calls to `sign.sign()` will result in an error being thrown. + +### sign.update(data[, inputEncoding])[#](#crypto_sign_update_data_inputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.92 | Added in: v0.1.92 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Updates the `Sign` content with the given `data`, the encoding of which +is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or +`'latin1'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`, then `inputEncoding` is ignored. + +This can be called many times with new data as it is streamed. + +## Class: Verify[#](#crypto_class_verify) + +Added in: v0.1.92 + +The `Verify` class is a utility for verifying signatures. It can be used in one +of two ways: + +* As a writable [stream](stream.html) where written data is used to validate against the + supplied signature, or +* Using the [`verify.update()`](#crypto_verify_update_data_inputencoding) and [`verify.verify()`](#crypto_verify_verify_object_signature_signatureformat) methods to verify + the signature. + +The [`crypto.createVerify()`](#crypto_crypto_createverify_algorithm_options) method is used to create `Verify` instances. +`Verify` objects are not to be created directly using the `new` keyword. + +Example: Using `Verify` objects as streams: + +```None +const crypto = require('crypto'); +const verify = crypto.createVerify('SHA256'); + +verify.write('some data to sign'); +verify.end(); + +const publicKey = getPublicKeySomehow(); +const signature = getSignatureToVerify(); +console.log(verify.verify(publicKey, signature)); +// Prints: true or false +``` + +Example: Using the [`verify.update()`](#crypto_verify_update_data_inputencoding) and [`verify.verify()`](#crypto_verify_verify_object_signature_signatureformat) methods: + +```None +const crypto = require('crypto'); +const verify = crypto.createVerify('SHA256'); + +verify.update('some data to sign'); + +const publicKey = getPublicKeySomehow(); +const signature = getSignatureToVerify(); +console.log(verify.verify(publicKey, signature)); +// Prints: true or false +``` + +### verify.update(data[, inputEncoding])[#](#crypto_verify_update_data_inputencoding) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. | +| v0.1.92 | Added in: v0.1.92 | + +* `data` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `inputEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Updates the `Verify` content with the given `data`, the encoding of which +is given in `inputEncoding` and can be `'utf8'`, `'ascii'` or +`'latin1'`. If `encoding` is not provided, and the `data` is a string, an +encoding of `'utf8'` is enforced. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or +`DataView`, then `inputEncoding` is ignored. + +This can be called many times with new data as it is streamed. + +### verify.verify(object, signature[, signatureFormat])[#](#crypto_verify_verify_object_signature_signatureformat) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | Support for RSASSA-PSS and additional options was added. | +| v0.1.92 | Added in: v0.1.92 | + +* `object` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) +* `signature` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `signatureFormat` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Verifies the provided data using the given `object` and `signature`. +The `object` argument can be either a string containing a PEM encoded object, +which can be an RSA public key, a DSA public key, or an X.509 certificate, +or an object with one or more of the following properties: + +* `key`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded public key (required) +* `padding`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - Optional padding value for RSA, one of the following: + + + `crypto.constants.RSA_PKCS1_PADDING` (default) + + `crypto.constants.RSA_PKCS1_PSS_PADDING` + + Note that `RSA_PKCS1_PSS_PADDING` will use MGF1 with the same hash function + used to verify the message as specified in section 3.1 of [RFC 4055](https://www.rfc-editor.org/rfc/rfc4055.txt). +* `saltLength`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - salt length for when padding is + `RSA_PKCS1_PSS_PADDING`. The special value + `crypto.constants.RSA_PSS_SALTLEN_DIGEST` sets the salt length to the digest + size, `crypto.constants.RSA_PSS_SALTLEN_AUTO` (default) causes it to be + determined automatically. + +The `signature` argument is the previously calculated signature for the data, in +the `signatureFormat` which can be `'latin1'`, `'hex'` or `'base64'`. +If a `signatureFormat` is specified, the `signature` is expected to be a +string; otherwise `signature` is expected to be a [`Buffer`](buffer.html), +`TypedArray`, or `DataView`. + +Returns `true` or `false` depending on the validity of the signature for +the data and public key. + +The `verify` object can not be used again after `verify.verify()` has been +called. Multiple calls to `verify.verify()` will result in an error being +thrown. + +## `crypto` module methods and properties[#](#crypto_crypto_module_methods_and_properties) + +### crypto.constants[#](#crypto_crypto_constants) + +Added in: v6.3.0 + +Returns an object containing commonly used constants for crypto and security +related operations. The specific constants currently defined are described in +[Crypto Constants](#crypto_crypto_constants_1). + +### crypto.DEFAULT\_ENCODING[#](#crypto_crypto_default_encoding) + +Added in: v0.9.3 + +The default encoding to use for functions that can take either strings +or [buffers](buffer.html). The default value is `'buffer'`, which makes methods +default to [`Buffer`](buffer.html) objects. + +The `crypto.DEFAULT_ENCODING` mechanism is provided for backwards compatibility +with legacy programs that expect `'latin1'` to be the default encoding. + +New applications should expect the default to be `'buffer'`. This property may +become deprecated in a future Node.js release. + +### crypto.fips[#](#crypto_crypto_fips) + +Added in: v6.0.0 + +Property for checking and controlling whether a FIPS compliant crypto provider +is currently in use. Setting to true requires a FIPS build of Node.js. + +### crypto.createCipher(algorithm, password[, options])[#](#crypto_crypto_createcipher_algorithm_password_options) + +Added in: v0.1.94 + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `password` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) + +Creates and returns a `Cipher` object that uses the given `algorithm` and +`password`. Optional `options` argument controls stream behavior. + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `password` is used to derive the cipher key and initialization vector (IV). +The value must be either a `'latin1'` encoded string, a [`Buffer`](buffer.html), a +`TypedArray`, or a `DataView`. + +The implementation of `crypto.createCipher()` derives keys using the OpenSSL +function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one +iteration, and no salt. The lack of salt allows dictionary attacks as the same +password always creates the same key. The low iteration count and +non-cryptographically secure hash algorithm allow passwords to be tested very +rapidly. + +In line with OpenSSL's recommendation to use PBKDF2 instead of +[`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) it is recommended that developers derive a key and IV on +their own using [`crypto.pbkdf2()`](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) and to use [`crypto.createCipheriv()`](#crypto_crypto_createcipheriv_algorithm_key_iv_options) +to create the `Cipher` object. Users should not use ciphers with counter mode +(e.g. CTR, GCM, or CCM) in `crypto.createCipher()`. A warning is emitted when +they are used in order to avoid the risk of IV reuse that causes +vulnerabilities. For the case when IV is reused in GCM, see [Nonce-Disrespecting +Adversaries](https://github.com/nonce-disrespect/nonce-disrespect) for details. + +### crypto.createCipheriv(algorithm, key, iv[, options])[#](#crypto_crypto_createcipheriv_algorithm_key_iv_options) + +History + +| Version | Changes | +| --- | --- | +| v9.9.0 | The `iv` parameter may now be `null` for ciphers which do not need an initialization vector. | +| v0.1.94 | Added in: v0.1.94 | + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `iv` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) + +Creates and returns a `Cipher` object, with the given `algorithm`, `key` and +initialization vector (`iv`). Optional `options` argument controls stream +behavior. + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `key` is the raw key used by the `algorithm` and `iv` is an +[initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded strings, +[Buffers](buffer.html), `TypedArray`, or `DataView`s. If the cipher does not need +an initialization vector, `iv` may be `null`. + +### crypto.createCredentials(details)[#](#crypto_crypto_createcredentials_details) + +Added in: v0.1.92Deprecated since: v0.11.13 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options) instead. + +* `details` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Identical to [`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options). + +The `crypto.createCredentials()` method is a deprecated function for creating +and returning a `tls.SecureContext`. It should not be used. Replace it with +[`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options) which has the exact same arguments and return +value. + +Returns a `tls.SecureContext`, as-if [`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options) had been +called. + +### crypto.createDecipher(algorithm, password[, options])[#](#crypto_crypto_createdecipher_algorithm_password_options) + +Added in: v0.1.94 + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `password` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) + +Creates and returns a `Decipher` object that uses the given `algorithm` and +`password` (key). Optional `options` argument controls stream behavior. + +The implementation of `crypto.createDecipher()` derives keys using the OpenSSL +function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one +iteration, and no salt. The lack of salt allows dictionary attacks as the same +password always creates the same key. The low iteration count and +non-cryptographically secure hash algorithm allow passwords to be tested very +rapidly. + +In line with OpenSSL's recommendation to use PBKDF2 instead of +[`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) it is recommended that developers derive a key and IV on +their own using [`crypto.pbkdf2()`](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) and to use [`crypto.createDecipheriv()`](#crypto_crypto_createdecipheriv_algorithm_key_iv_options) +to create the `Decipher` object. + +### crypto.createDecipheriv(algorithm, key, iv[, options])[#](#crypto_crypto_createdecipheriv_algorithm_key_iv_options) + +History + +| Version | Changes | +| --- | --- | +| v9.9.0 | The `iv` parameter may now be `null` for ciphers which do not need an initialization vector. | +| v0.1.94 | Added in: v0.1.94 | + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `iv` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) + +Creates and returns a `Decipher` object that uses the given `algorithm`, `key` +and initialization vector (`iv`). Optional `options` argument controls stream +behavior. + +The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On +recent OpenSSL releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. + +The `key` is the raw key used by the `algorithm` and `iv` is an +[initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded strings, +[Buffers](buffer.html), `TypedArray`, or `DataView`s. If the cipher does not need +an initialization vector, `iv` may be `null`. + +### crypto.createDiffieHellman(prime[, primeEncoding][, generator][, generatorEncoding])[#](#crypto_crypto_creatediffiehellman_prime_primeencoding_generator_generatorencoding) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `prime` argument can be any `TypedArray` or `DataView` now. | +| v8.0.0 | The `prime` argument can be a `Uint8Array` now. | +| v6.0.0 | The default for the encoding parameters changed from `binary` to `utf8`. | +| v0.11.12 | Added in: v0.11.12 | + +* `prime` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `primeEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `generator` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) Defaults to + `2`. +* `generatorEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Creates a `DiffieHellman` key exchange object using the supplied `prime` and an +optional specific `generator`. + +The `generator` argument can be a number, string, or [`Buffer`](buffer.html). If +`generator` is not specified, the value `2` is used. + +The `primeEncoding` and `generatorEncoding` arguments can be `'latin1'`, +`'hex'`, or `'base64'`. + +If `primeEncoding` is specified, `prime` is expected to be a string; otherwise +a [`Buffer`](buffer.html), `TypedArray`, or `DataView` is expected. + +If `generatorEncoding` is specified, `generator` is expected to be a string; +otherwise a number, [`Buffer`](buffer.html), `TypedArray`, or `DataView` is expected. + +### crypto.createDiffieHellman(primeLength[, generator])[#](#crypto_crypto_creatediffiehellman_primelength_generator) + +Added in: v0.5.0 + +* `primeLength` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `generator` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) Defaults to + `2`. + +Creates a `DiffieHellman` key exchange object and generates a prime of +`primeLength` bits using an optional specific numeric `generator`. +If `generator` is not specified, the value `2` is used. + +### crypto.createECDH(curveName)[#](#crypto_crypto_createecdh_curvename) + +Added in: v0.11.14 + +* `curveName` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a +predefined curve specified by the `curveName` string. Use +[`crypto.getCurves()`](#crypto_crypto_getcurves) to obtain a list of available curve names. On recent +OpenSSL releases, `openssl ecparam -list_curves` will also display the name +and description of each available elliptic curve. + +### crypto.createHash(algorithm[, options])[#](#crypto_crypto_createhash_algorithm_options) + +Added in: v0.1.92 + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) + +Creates and returns a `Hash` object that can be used to generate hash digests +using the given `algorithm`. Optional `options` argument controls stream +behavior. + +The `algorithm` is dependent on the available algorithms supported by the +version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. +On recent releases of OpenSSL, `openssl list-message-digest-algorithms` will +display the available digest algorithms. + +Example: generating the sha256 sum of a file + +```None +const filename = process.argv[2]; +const crypto = require('crypto'); +const fs = require('fs'); + +const hash = crypto.createHash('sha256'); + +const input = fs.createReadStream(filename); +input.on('readable', () => { + const data = input.read(); + if (data) + hash.update(data); + else { + console.log(`${hash.digest('hex')} ${filename}`); + } +}); +``` + +### crypto.createHmac(algorithm, key[, options])[#](#crypto_crypto_createhmac_algorithm_key_options) + +Added in: v0.1.94 + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options) + +Creates and returns an `Hmac` object that uses the given `algorithm` and `key`. +Optional `options` argument controls stream behavior. + +The `algorithm` is dependent on the available algorithms supported by the +version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. +On recent releases of OpenSSL, `openssl list-message-digest-algorithms` will +display the available digest algorithms. + +The `key` is the HMAC key used to generate the cryptographic HMAC hash. + +Example: generating the sha256 HMAC of a file + +```None +const filename = process.argv[2]; +const crypto = require('crypto'); +const fs = require('fs'); + +const hmac = crypto.createHmac('sha256', 'a secret'); + +const input = fs.createReadStream(filename); +input.on('readable', () => { + const data = input.read(); + if (data) + hmac.update(data); + else { + console.log(`${hmac.digest('hex')} ${filename}`); + } +}); +``` + +### crypto.createSign(algorithm[, options])[#](#crypto_crypto_createsign_algorithm_options) + +Added in: v0.1.92 + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.Writable` options](stream.html#stream_constructor_new_stream_writable_options) + +Creates and returns a `Sign` object that uses the given `algorithm`. +Use [`crypto.getHashes()`](#crypto_crypto_gethashes) to obtain an array of names of the available +signing algorithms. Optional `options` argument controls the +`stream.Writable` behavior. + +### crypto.createVerify(algorithm[, options])[#](#crypto_crypto_createverify_algorithm_options) + +Added in: v0.1.92 + +* `algorithm` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.Writable` options](stream.html#stream_constructor_new_stream_writable_options) + +Creates and returns a `Verify` object that uses the given algorithm. +Use [`crypto.getHashes()`](#crypto_crypto_gethashes) to obtain an array of names of the available +signing algorithms. Optional `options` argument controls the +`stream.Writable` behavior. + +### crypto.getCiphers()[#](#crypto_crypto_getciphers) + +Added in: v0.9.3 + +Returns an array with the names of the supported cipher algorithms. + +Example: + +```None +const ciphers = crypto.getCiphers(); +console.log(ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...] +``` + +### crypto.getCurves()[#](#crypto_crypto_getcurves) + +Added in: v2.3.0 + +Returns an array with the names of the supported elliptic curves. + +Example: + +```None +const curves = crypto.getCurves(); +console.log(curves); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...] +``` + +### crypto.getDiffieHellman(groupName)[#](#crypto_crypto_getdiffiehellman_groupname) + +Added in: v0.7.5 + +* `groupName` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Creates a predefined `DiffieHellman` key exchange object. The +supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in +[RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt), but see [Caveats](#crypto_support_for_weak_or_compromised_algorithms)) and `'modp14'`, `'modp15'`, +`'modp16'`, `'modp17'`, `'modp18'` (defined in [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt)). The +returned object mimics the interface of objects created by +[`crypto.createDiffieHellman()`](#crypto_crypto_creatediffiehellman_prime_primeencoding_generator_generatorencoding), but will not allow changing +the keys (with [`diffieHellman.setPublicKey()`](#crypto_diffiehellman_setpublickey_publickey_encoding) for example). The +advantage of using this method is that the parties do not have to +generate nor exchange a group modulus beforehand, saving both processor +and communication time. + +Example (obtaining a shared secret): + +```None +const crypto = require('crypto'); +const alice = crypto.getDiffieHellman('modp14'); +const bob = crypto.getDiffieHellman('modp14'); + +alice.generateKeys(); +bob.generateKeys(); + +const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); +const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); + +/* aliceSecret and bobSecret should be the same */ +console.log(aliceSecret === bobSecret); +``` + +### crypto.getHashes()[#](#crypto_crypto_gethashes) + +Added in: v0.9.3 + +Returns an array of the names of the supported hash algorithms, +such as `RSA-SHA256`. + +Example: + +```None +const hashes = crypto.getHashes(); +console.log(hashes); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...] +``` + +### crypto.pbkdf2(password, salt, iterations, keylen, digest, callback)[#](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `digest` parameter is always required now. | +| v6.0.0 | Calling this function without passing the `digest` parameter is deprecated now and will emit a warning. | +| v6.0.0 | The default encoding for `password` if it is a string changed from `binary` to `utf8`. | +| v0.5.5 | Added in: v0.5.5 | + +* `password` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) +* `salt` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) +* `iterations` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `keylen` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `digest` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + + `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + + `derivedKey` [](buffer.html#buffer_class_buffer) + +Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2) +implementation. A selected HMAC digest algorithm specified by `digest` is +applied to derive a key of the requested byte length (`keylen`) from the +`password`, `salt` and `iterations`. + +The supplied `callback` function is called with two arguments: `err` and +`derivedKey`. If an error occurs while deriving the key, `err` will be set; +otherwise `err` will be null. By default, the successfully generated +`derivedKey` will be passed to the callback as a [`Buffer`](buffer.html). An error will be +thrown if any of the input arguments specify invalid values or types. + +The `iterations` argument must be a number set as high as possible. The +higher the number of iterations, the more secure the derived key will be, +but will take a longer amount of time to complete. + +The `salt` should also be as unique as possible. It is recommended that the +salts are random and their lengths are at least 16 bytes. See +[NIST SP 800-132](http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + +Example: + +```None +const crypto = require('crypto'); +crypto.pbkdf2('secret', 'salt', 100000, 64, 'sha512', (err, derivedKey) => { + if (err) throw err; + console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' +}); +``` + +The `crypto.DEFAULT_ENCODING` may be used to change the way the `derivedKey` +is passed to the callback: + +```None +const crypto = require('crypto'); +crypto.DEFAULT_ENCODING = 'hex'; +crypto.pbkdf2('secret', 'salt', 100000, 512, 'sha512', (err, derivedKey) => { + if (err) throw err; + console.log(derivedKey); // '3745e48...aa39b34' +}); +``` + +An array of supported digest functions can be retrieved using +[`crypto.getHashes()`](#crypto_crypto_gethashes). + +Note that this API uses libuv's threadpool, which can have surprising and +negative performance implications for some applications, see the +[`UV_THREADPOOL_SIZE`](cli.html#cli_uv_threadpool_size_size) documentation for more information. + +### crypto.pbkdf2Sync(password, salt, iterations, keylen, digest)[#](#crypto_crypto_pbkdf2sync_password_salt_iterations_keylen_digest) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | Calling this function without passing the `digest` parameter is deprecated now and will emit a warning. | +| v6.0.0 | The default encoding for `password` if it is a string changed from `binary` to `utf8`. | +| v0.9.3 | Added in: v0.9.3 | + +* `password` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) +* `salt` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) +* `iterations` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `keylen` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `digest` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) +implementation. A selected HMAC digest algorithm specified by `digest` is +applied to derive a key of the requested byte length (`keylen`) from the +`password`, `salt` and `iterations`. + +If an error occurs an Error will be thrown, otherwise the derived key will be +returned as a [`Buffer`](buffer.html). + +The `iterations` argument must be a number set as high as possible. The +higher the number of iterations, the more secure the derived key will be, +but will take a longer amount of time to complete. + +The `salt` should also be as unique as possible. It is recommended that the +salts are random and their lengths are at least 16 bytes. See +[NIST SP 800-132](http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. + +Example: + +```None +const crypto = require('crypto'); +const key = crypto.pbkdf2Sync('secret', 'salt', 100000, 64, 'sha512'); +console.log(key.toString('hex')); // '3745e48...08d59ae' +``` + +The `crypto.DEFAULT_ENCODING` property may be used to change the way the +`derivedKey` is returned. + +```None +const crypto = require('crypto'); +crypto.DEFAULT_ENCODING = 'hex'; +const key = crypto.pbkdf2Sync('secret', 'salt', 100000, 512, 'sha512'); +console.log(key); // '3745e48...aa39b34' +``` + +An array of supported digest functions can be retrieved using +[`crypto.getHashes()`](#crypto_crypto_gethashes). + +### crypto.privateDecrypt(privateKey, buffer)[#](#crypto_crypto_privatedecrypt_privatekey_buffer) + +Added in: v0.11.14 + +* `privateKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A PEM encoded private key. + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An optional passphrase for the private key. + + `padding` [](crypto.html#crypto_crypto_constants_1) An optional padding value defined in + `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING`, + `RSA_PKCS1_PADDING`, or `crypto.constants.RSA_PKCS1_OAEP_PADDING`. +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) A new `Buffer` with the decrypted content. + +Decrypts `buffer` with `privateKey`. + +`privateKey` can be an object or a string. If `privateKey` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. + +### crypto.privateEncrypt(privateKey, buffer)[#](#crypto_crypto_privateencrypt_privatekey_buffer) + +Added in: v1.1.0 + +* `privateKey` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A PEM encoded private key. + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An optional passphrase for the private key. + + `padding` [](crypto.html#crypto_crypto_constants_1) An optional padding value defined in + `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING` or + `RSA_PKCS1_PADDING`. +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) A new `Buffer` with the encrypted content. + +Encrypts `buffer` with `privateKey`. + +`privateKey` can be an object or a string. If `privateKey` is a string, it is +treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`. + +### crypto.publicDecrypt(key, buffer)[#](#crypto_crypto_publicdecrypt_key_buffer) + +Added in: v1.1.0 + +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A PEM encoded public or private key. + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An optional passphrase for the private key. + + `padding` [](crypto.html#crypto_crypto_constants_1) An optional padding value defined in + `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING` or + `RSA_PKCS1_PADDING`. +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) A new `Buffer` with the decrypted content. + +Decrypts `buffer` with `key`. + +`key` can be an object or a string. If `key` is a string, it is treated as +the key with no passphrase and will use `RSA_PKCS1_PADDING`. + +Because RSA public keys can be derived from private keys, a private key may +be passed instead of a public key. + +### crypto.publicEncrypt(key, buffer)[#](#crypto_crypto_publicencrypt_key_buffer) + +Added in: v0.11.14 + +* `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A PEM encoded public or private key. + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An optional passphrase for the private key. + + `padding` [](crypto.html#crypto_crypto_constants_1) An optional padding value defined in + `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING`, + `RSA_PKCS1_PADDING`, or `crypto.constants.RSA_PKCS1_OAEP_PADDING`. +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* Returns: [](buffer.html#buffer_class_buffer) A new `Buffer` with the encrypted content. + +Encrypts the content of `buffer` with `key` and returns a new +[`Buffer`](buffer.html) with encrypted content. + +`key` can be an object or a string. If `key` is a string, it is treated as +the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`. + +Because RSA public keys can be derived from private keys, a private key may +be passed instead of a public key. + +### crypto.randomBytes(size[, callback])[#](#crypto_crypto_randombytes_size_callback) + +History + +| Version | Changes | +| --- | --- | +| v9.0.0 | Passing `null` as the `callback` argument now throws `ERR_INVALID_CALLBACK`. | +| v0.5.8 | Added in: v0.5.8 | + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + + `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + + `buf` [](buffer.html#buffer_class_buffer) + +Generates cryptographically strong pseudo-random data. The `size` argument +is a number indicating the number of bytes to generate. + +If a `callback` function is provided, the bytes are generated asynchronously +and the `callback` function is invoked with two arguments: `err` and `buf`. +If an error occurs, `err` will be an Error object; otherwise it is null. The +`buf` argument is a [`Buffer`](buffer.html) containing the generated bytes. + +```None +// Asynchronous +const crypto = require('crypto'); +crypto.randomBytes(256, (err, buf) => { + if (err) throw err; + console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`); +}); +``` + +If the `callback` function is not provided, the random bytes are generated +synchronously and returned as a [`Buffer`](buffer.html). An error will be thrown if +there is a problem generating the bytes. + +```None +// Synchronous +const buf = crypto.randomBytes(256); +console.log( + `${buf.length} bytes of random data: ${buf.toString('hex')}`); +``` + +The `crypto.randomBytes()` method will not complete until there is +sufficient entropy available. +This should normally never take longer than a few milliseconds. The only time +when generating the random bytes may conceivably block for a longer period of +time is right after boot, when the whole system is still low on entropy. + +Note that this API uses libuv's threadpool, which can have surprising and +negative performance implications for some applications, see the +[`UV_THREADPOOL_SIZE`](cli.html#cli_uv_threadpool_size_size) documentation for more information. + +The asynchronous version of `crypto.randomBytes()` is carried out in a single +threadpool request. To minimize threadpool task length variation, partition +large `randomBytes` requests when doing so as part of fulfilling a client +request. + +### crypto.randomFillSync(buffer[, offset][, size])[#](#crypto_crypto_randomfillsync_buffer_offset_size) + +History + +| Version | Changes | +| --- | --- | +| v9.0.0 | The `buffer` argument may be any `TypedArray` or `DataView`. | +| v7.10.0 | Added in: v7.10.0 | + +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) Must be supplied. +* `offset` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Defaults to `0`. +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Defaults to `buffer.length - offset`. + +Synchronous version of [`crypto.randomFill()`](#crypto_crypto_randomfill_buffer_offset_size_callback). + +Returns `buffer` + +```None +const buf = Buffer.alloc(10); +console.log(crypto.randomFillSync(buf).toString('hex')); + +crypto.randomFillSync(buf, 5); +console.log(buf.toString('hex')); + +// The above is equivalent to the following: +crypto.randomFillSync(buf, 5, 5); +console.log(buf.toString('hex')); +``` + +Any `TypedArray` or `DataView` instance may be passed as `buffer`. + +```None +const a = new Uint32Array(10); +console.log(crypto.randomFillSync(a).toString('hex')); + +const b = new Float64Array(10); +console.log(crypto.randomFillSync(a).toString('hex')); + +const c = new DataView(new ArrayBuffer(10)); +console.log(crypto.randomFillSync(a).toString('hex')); +``` + +### crypto.randomFill(buffer[, offset][, size], callback)[#](#crypto_crypto_randomfill_buffer_offset_size_callback) + +History + +| Version | Changes | +| --- | --- | +| v9.0.0 | The `buffer` argument may be any `TypedArray` or `DataView`. | +| v7.10.0 | Added in: v7.10.0 | + +* `buffer` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) Must be supplied. +* `offset` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Defaults to `0`. +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Defaults to `buffer.length - offset`. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) `function(err, buf) {}`. + +This function is similar to [`crypto.randomBytes()`](#crypto_crypto_randombytes_size_callback) but requires the first +argument to be a [`Buffer`](buffer.html) that will be filled. It also +requires that a callback is passed in. + +If the `callback` function is not provided, an error will be thrown. + +```None +const buf = Buffer.alloc(10); +crypto.randomFill(buf, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); + +crypto.randomFill(buf, 5, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); + +// The above is equivalent to the following: +crypto.randomFill(buf, 5, 5, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); +``` + +Any `TypedArray` or `DataView` instance may be passed as `buffer`. + +```None +const a = new Uint32Array(10); +crypto.randomFill(a, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); + +const b = new Float64Array(10); +crypto.randomFill(b, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); + +const c = new DataView(new ArrayBuffer(10)); +crypto.randomFill(c, (err, buf) => { + if (err) throw err; + console.log(buf.toString('hex')); +}); +``` + +Note that this API uses libuv's threadpool, which can have surprising and +negative performance implications for some applications, see the +[`UV_THREADPOOL_SIZE`](cli.html#cli_uv_threadpool_size_size) documentation for more information. + +The asynchronous version of `crypto.randomFill()` is carried out in a single +threadpool request. To minimize threadpool task length variation, partition +large `randomFill` requests when doing so as part of fulfilling a client +request. + +### crypto.setEngine(engine[, flags])[#](#crypto_crypto_setengine_engine_flags) + +Added in: v0.11.11 + +* `engine` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) +* `flags` [](crypto.html#crypto_crypto_constants_1) Defaults to `crypto.constants.ENGINE_METHOD_ALL`. + +Load and set the `engine` for some or all OpenSSL functions (selected by flags). + +`engine` could be either an id or a path to the engine's shared library. + +The optional `flags` argument uses `ENGINE_METHOD_ALL` by default. The `flags` +is a bit field taking one of or a mix of the following flags (defined in +`crypto.constants`): + +* `crypto.constants.ENGINE_METHOD_RSA` +* `crypto.constants.ENGINE_METHOD_DSA` +* `crypto.constants.ENGINE_METHOD_DH` +* `crypto.constants.ENGINE_METHOD_RAND` +* `crypto.constants.ENGINE_METHOD_ECDH` +* `crypto.constants.ENGINE_METHOD_ECDSA` +* `crypto.constants.ENGINE_METHOD_CIPHERS` +* `crypto.constants.ENGINE_METHOD_DIGESTS` +* `crypto.constants.ENGINE_METHOD_STORE` +* `crypto.constants.ENGINE_METHOD_PKEY_METHS` +* `crypto.constants.ENGINE_METHOD_PKEY_ASN1_METHS` +* `crypto.constants.ENGINE_METHOD_ALL` +* `crypto.constants.ENGINE_METHOD_NONE` + +### crypto.timingSafeEqual(a, b)[#](#crypto_crypto_timingsafeequal_a_b) + +Added in: v6.6.0 + +* `a` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) +* `b` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) + +This function is based on a constant-time algorithm. +Returns true if `a` is equal to `b`, without leaking timing information that +would allow an attacker to guess one of the values. This is suitable for +comparing HMAC digests or secret values like authentication cookies or +[capability urls](https://www.w3.org/TR/capability-urls/). + +`a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they +must have the same length. + +Use of `crypto.timingSafeEqual` does not guarantee that the *surrounding* code +is timing-safe. Care should be taken to ensure that the surrounding code does +not introduce timing vulnerabilities. + +## Notes[#](#crypto_notes) + +### Legacy Streams API (pre Node.js v0.10)[#](#crypto_legacy_streams_api_pre_node_js_v0_10) + +The Crypto module was added to Node.js before there was the concept of a +unified Stream API, and before there were [`Buffer`](buffer.html) objects for handling +binary data. As such, the many of the `crypto` defined classes have methods not +typically found on other Node.js classes that implement the [streams](stream.html) +API (e.g. `update()`, `final()`, or `digest()`). Also, many methods accepted +and returned `'latin1'` encoded strings by default rather than Buffers. This +default was changed after Node.js v0.8 to use [`Buffer`](buffer.html) objects by default +instead. + +### Recent ECDH Changes[#](#crypto_recent_ecdh_changes) + +Usage of `ECDH` with non-dynamically generated key pairs has been simplified. +Now, [`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_privatekey_encoding) can be called with a preselected private key +and the associated public point (key) will be computed and stored in the object. +This allows code to only store and provide the private part of the EC key pair. +[`ecdh.setPrivateKey()`](#crypto_ecdh_setprivatekey_privatekey_encoding) now also validates that the private key is valid for +the selected curve. + +The [`ecdh.setPublicKey()`](#crypto_ecdh_setpublickey_publickey_encoding) method is now deprecated as its inclusion in the +API is not useful. Either a previously stored private key should be set, which +automatically generates the associated public key, or [`ecdh.generateKeys()`](#crypto_ecdh_generatekeys_encoding_format) +should be called. The main drawback of using [`ecdh.setPublicKey()`](#crypto_ecdh_setpublickey_publickey_encoding) is that +it can be used to put the ECDH key pair into an inconsistent state. + +### Support for weak or compromised algorithms[#](#crypto_support_for_weak_or_compromised_algorithms) + +The `crypto` module still supports some algorithms which are already +compromised and are not currently recommended for use. The API also allows +the use of ciphers and hashes with a small key size that are considered to be +too weak for safe use. + +Users should take full responsibility for selecting the crypto +algorithm and key size according to their security requirements. + +Based on the recommendations of [NIST SP 800-131A](http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar1.pdf): + +* MD5 and SHA-1 are no longer acceptable where collision resistance is + required such as digital signatures. +* The key used with RSA, DSA, and DH algorithms is recommended to have + at least 2048 bits and that of the curve of ECDSA and ECDH at least + 224 bits, to be safe to use for several years. +* The DH groups of `modp1`, `modp2` and `modp5` have a key size + smaller than 2048 bits and are not recommended. + +See the reference for other recommendations and details. + +## Crypto Constants[#](#crypto_crypto_constants_1) + +The following constants exported by `crypto.constants` apply to various uses of +the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL. + +### OpenSSL Options[#](#crypto_openssl_options) + +| Constant | Description | +| --- | --- | +| `SSL_OP_ALL` | Applies multiple bug workarounds within OpenSSL. See for detail. | +| `SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION` | Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See . | +| `SSL_OP_CIPHER_SERVER_PREFERENCE` | Attempts to use the server's preferences instead of the client's when selecting a cipher. Behavior depends on protocol version. See . | +| `SSL_OP_CISCO_ANYCONNECT` | Instructs OpenSSL to use Cisco's "speshul" version of DTLS\_BAD\_VER. | +| `SSL_OP_COOKIE_EXCHANGE` | Instructs OpenSSL to turn on cookie exchange. | +| `SSL_OP_CRYPTOPRO_TLSEXT_BUG` | Instructs OpenSSL to add server-hello extension from an early version of the cryptopro draft. | +| `SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS` | Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. | +| `SSL_OP_EPHEMERAL_RSA` | Instructs OpenSSL to always use the tmp\_rsa key when performing RSA operations. | +| `SSL_OP_LEGACY_SERVER_CONNECT` | Allows initial connection to servers that do not support RI. | +| `SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER` | | +| `SSL_OP_MICROSOFT_SESS_ID_BUG` | | +| `SSL_OP_MSIE_SSLV2_RSA_PADDING` | Instructs OpenSSL to disable the workaround for a man-in-the-middle protocol-version vulnerability in the SSL 2.0 server implementation. | +| `SSL_OP_NETSCAPE_CA_DN_BUG` | | +| `SSL_OP_NETSCAPE_CHALLENGE_BUG` | | +| `SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG` | | +| `SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG` | | +| `SSL_OP_NO_COMPRESSION` | Instructs OpenSSL to disable support for SSL/TLS compression. | +| `SSL_OP_NO_QUERY_MTU` | | +| `SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION` | Instructs OpenSSL to always start a new session when performing renegotiation. | +| `SSL_OP_NO_SSLv2` | Instructs OpenSSL to turn off SSL v2 | +| `SSL_OP_NO_SSLv3` | Instructs OpenSSL to turn off SSL v3 | +| `SSL_OP_NO_TICKET` | Instructs OpenSSL to disable use of RFC4507bis tickets. | +| `SSL_OP_NO_TLSv1` | Instructs OpenSSL to turn off TLS v1 | +| `SSL_OP_NO_TLSv1_1` | Instructs OpenSSL to turn off TLS v1.1 | +| `SSL_OP_NO_TLSv1_2` | Instructs OpenSSL to turn off TLS v1.2 | + `SSL_OP_PKCS1_CHECK_1` | || `SSL_OP_PKCS1_CHECK_2` | | +| `SSL_OP_SINGLE_DH_USE` | Instructs OpenSSL to always create a new key when using temporary/ephemeral DH parameters. | +| `SSL_OP_SINGLE_ECDH_USE` | Instructs OpenSSL to always create a new key when using temporary/ephemeral ECDH parameters. | + `SSL_OP_SSLEAY_080_CLIENT_DH_BUG` | || `SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG` | | +| `SSL_OP_TLS_BLOCK_PADDING_BUG` | | +| `SSL_OP_TLS_D5_BUG` | | +| `SSL_OP_TLS_ROLLBACK_BUG` | Instructs OpenSSL to disable version rollback attack detection. | + +### OpenSSL Engine Constants[#](#crypto_openssl_engine_constants) + +| Constant | Description | +| --- | --- | +| `ENGINE_METHOD_RSA` | Limit engine usage to RSA | +| `ENGINE_METHOD_DSA` | Limit engine usage to DSA | +| `ENGINE_METHOD_DH` | Limit engine usage to DH | +| `ENGINE_METHOD_RAND` | Limit engine usage to RAND | +| `ENGINE_METHOD_ECDH` | Limit engine usage to ECDH | +| `ENGINE_METHOD_ECDSA` | Limit engine usage to ECDSA | +| `ENGINE_METHOD_CIPHERS` | Limit engine usage to CIPHERS | +| `ENGINE_METHOD_DIGESTS` | Limit engine usage to DIGESTS | +| `ENGINE_METHOD_STORE` | Limit engine usage to STORE | +| `ENGINE_METHOD_PKEY_METHS` | Limit engine usage to PKEY\_METHDS | +| `ENGINE_METHOD_PKEY_ASN1_METHS` | Limit engine usage to PKEY\_ASN1\_METHS | +| `ENGINE_METHOD_ALL` | | +| `ENGINE_METHOD_NONE` | | + +### Other OpenSSL Constants[#](#crypto_other_openssl_constants) + +| Constant | Description | +| --- | --- | +| `DH_CHECK_P_NOT_SAFE_PRIME` | | +| `DH_CHECK_P_NOT_PRIME` | | +| `DH_UNABLE_TO_CHECK_GENERATOR` | | +| `DH_NOT_SUITABLE_GENERATOR` | | +| `NPN_ENABLED` | | +| `ALPN_ENABLED` | | +| `RSA_PKCS1_PADDING` | | +| `RSA_SSLV23_PADDING` | | +| `RSA_NO_PADDING` | | +| `RSA_PKCS1_OAEP_PADDING` | | +| `RSA_X931_PADDING` | | +| `RSA_PKCS1_PSS_PADDING` | | +| `RSA_PSS_SALTLEN_DIGEST` | Sets the salt length for `RSA_PKCS1_PSS_PADDING` to the digest size when signing or verifying. | +| `RSA_PSS_SALTLEN_MAX_SIGN` | Sets the salt length for `RSA_PKCS1_PSS_PADDING` to the maximum permissible value when signing data. | +| `RSA_PSS_SALTLEN_AUTO` | Causes the salt length for `RSA_PKCS1_PSS_PADDING` to be determined automatically when verifying a signature. | +| `POINT_CONVERSION_COMPRESSED` | | +| `POINT_CONVERSION_UNCOMPRESSED` | | +| `POINT_CONVERSION_HYBRID` | | + +### Node.js Crypto Constants[#](#crypto_node_js_crypto_constants) + +| Constant | Description | +| --- | --- | +| `defaultCoreCipherList` | Specifies the built-in default cipher list used by Node.js. | +| `defaultCipherList` | Specifies the active default cipher list used by the current Node.js process. | diff --git a/corpus/docs/nodejs/stream/stream_010x.md b/corpus/docs/nodejs/stream/stream_010x.md new file mode 100644 index 0000000000000000000000000000000000000000..9f1d95e56c8da985a6aa71b968a92cd153342050 --- /dev/null +++ b/corpus/docs/nodejs/stream/stream_010x.md @@ -0,0 +1,1387 @@ +# Stream# + +Source: https://nodejs.org/docs/latest-v0.10.x/api/stream.html +Version: 0.10.x + +```None +Stability: 2 - Unstable +``` + +A stream is an abstract interface implemented by various objects in +Node. For example a [request to an HTTP +server](http.html#http_http_incomingmessage) is a stream, as is +[stdout](process.html#process_process_stdout). Streams are readable, writable, or both. All streams are +instances of [EventEmitter](events.html#events_class_events_eventemitter) + +You can load the Stream base classes by doing `require('stream')`. +There are base classes provided for [Readable](#stream_class_stream_readable) streams, [Writable](#stream_class_stream_writable) +streams, [Duplex](#stream_class_stream_duplex) streams, and [Transform](#stream_class_stream_transform) streams. + +This document is split up into 3 sections. The first explains the +parts of the API that you need to be aware of to use streams in your +programs. If you never implement a streaming API yourself, you can +stop there. + +The second section explains the parts of the API that you need to use +if you implement your own custom streams yourself. The API is +designed to make this easy for you to do. + +The third section goes into more depth about how streams work, +including some of the internal mechanisms and functions that you +should probably not modify unless you definitely know what you are +doing. + +## API for Stream Consumers[#](#stream_api_for_stream_consumers) + +Streams can be either [Readable](#stream_class_stream_readable), [Writable](#stream_class_stream_writable), or both ([Duplex](#stream_class_stream_duplex)). + +All streams are EventEmitters, but they also have other custom methods +and properties depending on whether they are Readable, Writable, or +Duplex. + +If a stream is both Readable and Writable, then it implements all of +the methods and events below. So, a [Duplex](#stream_class_stream_duplex) or [Transform](#stream_class_stream_transform) stream is +fully described by this API, though their implementation may be +somewhat different. + +It is not necessary to implement Stream interfaces in order to consume +streams in your programs. If you **are** implementing streaming +interfaces in your own program, please also refer to +[API for Stream Implementors](#stream_api_for_stream_implementors) below. + +Almost all Node programs, no matter how simple, use Streams in some +way. Here is an example of using Streams in a Node program: + +```None +var http = require('http'); + +var server = http.createServer(function (req, res) { + // req is an http.IncomingMessage, which is a Readable Stream + // res is an http.ServerResponse, which is a Writable Stream + + var body = ''; + // we want to get the data as utf8 strings + // If you don't set an encoding, then you'll get Buffer objects + req.setEncoding('utf8'); + + // Readable streams emit 'data' events once a listener is added + req.on('data', function (chunk) { + body += chunk; + }) + + // the end event tells you that you have entire body + req.on('end', function () { + try { + var data = JSON.parse(body); + } catch (er) { + // uh oh! bad json! + res.statusCode = 400; + return res.end('error: ' + er.message); + } + + // write back something interesting to the user: + res.write(typeof data); + res.end(); + }) +}) + +server.listen(1337); + +// $ curl localhost:1337 -d '{}' +// object +// $ curl localhost:1337 -d '"foo"' +// string +// $ curl localhost:1337 -d 'not json' +// error: Unexpected token o +``` + +### Class: stream.Readable[#](#stream_class_stream_readable) + +The Readable stream interface is the abstraction for a *source* of +data that you are reading from. In other words, data comes *out* of a +Readable stream. + +A Readable stream will not start emitting data until you indicate that +you are ready to receive it. + +Readable streams have two "modes": a **flowing mode** and a **non-flowing +mode**. When in flowing mode, data is read from the underlying system +and provided to your program as fast as possible. In non-flowing +mode, you must explicitly call `stream.read()` to get chunks of data +out. + +Examples of readable streams include: + +* [http responses, on the client](http.html#http_http_incomingmessage) +* [http requests, on the server](http.html#http_http_incomingmessage) +* [fs read streams](fs.html#fs_class_fs_readstream) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) +* [tcp sockets](net.html#net_class_net_socket) +* [child process stdout and stderr](child_process.html#child_process_child_stdout) +* [process.stdin](process.html#process_process_stdin) + +#### Event: 'readable'[#](#stream_event_readable) + +When a chunk of data can be read from the stream, it will emit a +`'readable'` event. + +In some cases, listening for a `'readable'` event will cause some data +to be read into the internal buffer from the underlying system, if it +hadn't already. + +```None +var readable = getReadableStreamSomehow(); +readable.on('readable', function() { + // there is some data to read now +}) +``` + +Once the internal buffer is drained, a `readable` event will fire +again when more data is available. + +#### Event: 'data'[#](#stream_event_data) + +* `chunk` Buffer | String The chunk of data. + +If you attach a `data` event listener, then it will switch the stream +into flowing mode, and data will be passed to your handler as soon as +it is available. + +If you just want to get all the data out of the stream as fast as +possible, this is the best way to do so. + +```None +var readable = getReadableStreamSomehow(); +readable.on('data', function(chunk) { + console.log('got %d bytes of data', chunk.length); +}) +``` + +#### Event: 'end'[#](#stream_event_end) + +This event fires when there will be no more data to read. + +Note that the `end` event **will not fire** unless the data is +completely consumed. This can be done by switching into flowing mode, +or by calling `read()` repeatedly until you get to the end. + +```None +var readable = getReadableStreamSomehow(); +readable.on('data', function(chunk) { + console.log('got %d bytes of data', chunk.length); +}) +readable.on('end', function() { + console.log('there will be no more data.'); +}); +``` + +#### Event: 'close'[#](#stream_event_close) + +Emitted when the underlying resource (for example, the backing file +descriptor) has been closed. Not all streams will emit this. + +#### Event: 'error'[#](#stream_event_error) + +* Error Object + +Emitted if there was an error receiving data. + +#### readable.read([size])[#](#stream_readable_read_size) + +* `size` Number Optional argument to specify how much data to read. +* Return String | Buffer | null + +The `read()` method pulls some data out of the internal buffer and +returns it. If there is no data available, then it will return +`null`. + +If you pass in a `size` argument, then it will return that many +bytes. If `size` bytes are not available, then it will return `null`. + +If you do not specify a `size` argument, then it will return all the +data in the internal buffer. + +This method should only be called in non-flowing mode. In +flowing-mode, this method is called automatically until the internal +buffer is drained. + +```None +var readable = getReadableStreamSomehow(); +readable.on('readable', function() { + var chunk; + while (null !== (chunk = readable.read())) { + console.log('got %d bytes of data', chunk.length); + } +}); +``` + +#### readable.setEncoding(encoding)[#](#stream_readable_setencoding_encoding) + +* `encoding` String The encoding to use. + +Call this function to cause the stream to return strings of the +specified encoding instead of Buffer objects. For example, if you do +`readable.setEncoding('utf8')`, then the output data will be +interpreted as UTF-8 data, and returned as strings. If you do +`readable.setEncoding('hex')`, then the data will be encoded in +hexadecimal string format. + +This properly handles multi-byte characters that would otherwise be +potentially mangled if you simply pulled the Buffers directly and +called `buf.toString(encoding)` on them. If you want to read the data +as strings, always use this method. + +```None +var readable = getReadableStreamSomehow(); +readable.setEncoding('utf8'); +readable.on('data', function(chunk) { + assert.equal(typeof chunk, 'string'); + console.log('got %d characters of string data', chunk.length); +}) +``` + +#### readable.resume()[#](#stream_readable_resume) + +This method will cause the readable stream to resume emitting `data` +events. + +This method will switch the stream into flowing-mode. If you do *not* +want to consume the data from a stream, but you *do* want to get to +its `end` event, you can call `readable.resume()` to open the flow of +data. + +```None +var readable = getReadableStreamSomehow(); +readable.resume(); +readable.on('end', function(chunk) { + console.log('got to the end, but did not read anything'); +}) +``` + +#### readable.pause()[#](#stream_readable_pause) + +This method will cause a stream in flowing-mode to stop emitting +`data` events. Any data that becomes available will remain in the +internal buffer. + +This method is only relevant in flowing mode. When called on a +non-flowing stream, it will switch into flowing mode, but remain +paused. + +```None +var readable = getReadableStreamSomehow(); +readable.on('data', function(chunk) { + console.log('got %d bytes of data', chunk.length); + readable.pause(); + console.log('there will be no more data for 1 second'); + setTimeout(function() { + console.log('now data will start flowing again'); + readable.resume(); + }, 1000); +}) +``` + +#### readable.pipe(destination, [options])[#](#stream_readable_pipe_destination_options) + +* `destination` [Writable](#stream_class_stream_writable) Stream The destination for writing data +* `options` Object Pipe options + + `end` Boolean End the writer when the reader ends. Default = `true` + +This method pulls all the data out of a readable stream, and writes it +to the supplied destination, automatically managing the flow so that +the destination is not overwhelmed by a fast readable stream. + +Multiple destinations can be piped to safely. + +```None +var readable = getReadableStreamSomehow(); +var writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt' +readable.pipe(writable); +``` + +This function returns the destination stream, so you can set up pipe +chains like so: + +```None +var r = fs.createReadStream('file.txt'); +var z = zlib.createGzip(); +var w = fs.createWriteStream('file.txt.gz'); +r.pipe(z).pipe(w); +``` + +For example, emulating the Unix `cat` command: + +```None +process.stdin.pipe(process.stdout); +``` + +By default [`end()`](#stream_writable_end_chunk_encoding_callback) is called on the destination when the source stream +emits `end`, so that `destination` is no longer writable. Pass `{ end: +false }` as `options` to keep the destination stream open. + +This keeps `writer` open so that "Goodbye" can be written at the +end. + +```None +reader.pipe(writer, { end: false }); +reader.on('end', function() { + writer.end('Goodbye\n'); +}); +``` + +Note that `process.stderr` and `process.stdout` are never closed until +the process exits, regardless of the specified options. + +#### readable.unpipe([destination])[#](#stream_readable_unpipe_destination) + +* `destination` [Writable](#stream_class_stream_writable) Stream Optional specific stream to unpipe + +This method will remove the hooks set up for a previous `pipe()` call. + +If the destination is not specified, then all pipes are removed. + +If the destination is specified, but no pipe is set up for it, then +this is a no-op. + +```None +var readable = getReadableStreamSomehow(); +var writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt', +// but only for the first second +readable.pipe(writable); +setTimeout(function() { + console.log('stop writing to file.txt'); + readable.unpipe(writable); + console.log('manually close the file stream'); + writable.end(); +}, 1000); +``` + +#### readable.unshift(chunk)[#](#stream_readable_unshift_chunk) + +* `chunk` Buffer | String Chunk of data to unshift onto the read queue + +This is useful in certain cases where a stream is being consumed by a +parser, which needs to "un-consume" some data that it has +optimistically pulled out of the source, so that the stream can be +passed on to some other party. + +If you find that you must often call `stream.unshift(chunk)` in your +programs, consider implementing a [Transform](#stream_class_stream_transform) stream instead. (See API +for Stream Implementors, below.) + +```None +// Pull off a header delimited by \n\n +// use unshift() if we get too much +// Call the callback with (error, header, stream) +var StringDecoder = require('string_decoder').StringDecoder; +function parseHeader(stream, callback) { + stream.on('error', callback); + stream.on('readable', onReadable); + var decoder = new StringDecoder('utf8'); + var header = ''; + function onReadable() { + var chunk; + while (null !== (chunk = stream.read())) { + var str = decoder.write(chunk); + if (str.match(/\n\n/)) { + // found the header boundary + var split = str.split(/\n\n/); + header += split.shift(); + var remaining = split.join('\n\n'); + var buf = new Buffer(remaining, 'utf8'); + if (buf.length) + stream.unshift(buf); + stream.removeListener('error', callback); + stream.removeListener('readable', onReadable); + // now the body of the message can be read from the stream. + callback(null, header, stream); + } else { + // still reading the header. + header += str; + } + } + } +} +``` + +#### readable.wrap(stream)[#](#stream_readable_wrap_stream) + +* `stream` Stream An "old style" readable stream + +Versions of Node prior to v0.10 had streams that did not implement the +entire Streams API as it is today. (See "Compatibility" below for +more information.) + +If you are using an older Node library that emits `'data'` events and +has a `pause()` method that is advisory only, then you can use the +`wrap()` method to create a [Readable](#stream_class_stream_readable) stream that uses the old stream +as its data source. + +You will very rarely ever need to call this function, but it exists +as a convenience for interacting with old Node programs and libraries. + +For example: + +```None +var OldReader = require('./old-api-module.js').OldReader; +var oreader = new OldReader; +var Readable = require('stream').Readable; +var myReader = new Readable().wrap(oreader); + +myReader.on('readable', function() { + myReader.read(); // etc. +}); +``` + +### Class: stream.Writable[#](#stream_class_stream_writable) + +The Writable stream interface is an abstraction for a *destination* +that you are writing data *to*. + +Examples of writable streams include: + +* [http requests, on the client](http.html#http_class_http_clientrequest) +* [http responses, on the server](http.html#http_class_http_serverresponse) +* [fs write streams](fs.html#fs_class_fs_writestream) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) +* [tcp sockets](net.html#net_class_net_socket) +* [child process stdin](child_process.html#child_process_child_stdin) +* [process.stdout](process.html#process_process_stdout), [process.stderr](process.html#process_process_stderr) + +#### writable.write(chunk, [encoding], [callback])[#](#stream_writable_write_chunk_encoding_callback) + +* `chunk` String | Buffer The data to write +* `encoding` String The encoding, if `chunk` is a String +* `callback` Function Callback for when this chunk of data is flushed +* Returns: Boolean True if the data was handled completely. + +This method writes some data to the underlying system, and calls the +supplied callback once the data has been fully handled. + +The return value indicates if you should continue writing right now. +If the data had to be buffered internally, then it will return +`false`. Otherwise, it will return `true`. + +This return value is strictly advisory. You MAY continue to write, +even if it returns `false`. However, writes will be buffered in +memory, so it is best not to do this excessively. Instead, wait for +the `drain` event before writing more data. + +#### Event: 'drain'[#](#stream_event_drain) + +If a [`writable.write(chunk)`](#stream_writable_write_chunk_encoding_callback) call returns false, then the `drain` +event will indicate when it is appropriate to begin writing more data +to the stream. + +```None +// Write the data to the supplied writable stream 1MM times. +// Be attentive to back-pressure. +function writeOneMillionTimes(writer, data, encoding, callback) { + var i = 1000000; + write(); + function write() { + var ok = true; + do { + i -= 1; + if (i === 0) { + // last time! + writer.write(data, encoding, callback); + } else { + // see if we should continue, or wait + // don't pass the callback, because we're not done yet. + ok = writer.write(data, encoding); + } + } while (i > 0 && ok); + if (i > 0) { + // had to stop early! + // write some more once it drains + writer.once('drain', write); + } + } +} +``` + +#### writable.end([chunk], [encoding], [callback])[#](#stream_writable_end_chunk_encoding_callback) + +* `chunk` String | Buffer Optional data to write +* `encoding` String The encoding, if `chunk` is a String +* `callback` Function Optional callback for when the stream is finished + +Call this method when no more data will be written to the stream. If +supplied, the callback is attached as a listener on the `finish` event. + +```None +// write 'hello, ' and then end with 'world!' +var file = fs.createWriteStream('example.txt'); +file.write('hello, '); +file.end('world!'); +``` + +Calling [`write()`](#stream_writable_write_chunk_encoding_callback) after calling [`end()`](#stream_writable_end_chunk_encoding_callback) will raise an error: + +```None +// end with 'world!' and then write with 'hello, ' will raise an error +var file = fs.createWriteStream('example.txt'); +file.end('world!'); +file.write('hello, '); +``` + +#### Event: 'finish'[#](#stream_event_finish) + +When the [`end()`](#stream_writable_end_chunk_encoding_callback) method has been called, and all data has been flushed +to the underlying system, this event is emitted. + +```None +var writer = getWritableStreamSomehow(); +for (var i = 0; i < 100; i ++) { + writer.write('hello, #' + i + '!\n'); +} +writer.end('this is the end\n'); +writer.on('finish', function() { + console.error('all writes are now complete.'); +}); +``` + +#### Event: 'pipe'[#](#stream_event_pipe) + +* `src` [Readable](#stream_class_stream_readable) Stream source stream that is piping to this writable + +This is emitted whenever the `pipe()` method is called on a readable +stream, adding this writable to its set of destinations. + +```None +var writer = getWritableStreamSomehow(); +var reader = getReadableStreamSomehow(); +writer.on('pipe', function(src) { + console.error('something is piping into the writer'); + assert.equal(src, reader); +}); +reader.pipe(writer); +``` + +#### Event: 'unpipe'[#](#stream_event_unpipe) + +* `src` [Readable](#stream_class_stream_readable) Stream The source stream that [unpiped](#stream_readable_unpipe_destination) this writable + +This is emitted whenever the [`unpipe()`](#stream_readable_unpipe_destination) method is called on a +readable stream, removing this writable from its set of destinations. + +```None +var writer = getWritableStreamSomehow(); +var reader = getReadableStreamSomehow(); +writer.on('unpipe', function(src) { + console.error('something has stopped piping into the writer'); + assert.equal(src, reader); +}); +reader.pipe(writer); +reader.unpipe(writer); +``` + +#### Event: 'error'[#](#stream_event_error_1) + +* Error object + +Emitted if there was an error when writing or piping data. + +### Class: stream.Duplex[#](#stream_class_stream_duplex) + +Duplex streams are streams that implement both the [Readable](#stream_class_stream_readable) and +[Writable](#stream_class_stream_writable) interfaces. See above for usage. + +Examples of Duplex streams include: + +* [tcp sockets](net.html#net_class_net_socket) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) + +### Class: stream.Transform[#](#stream_class_stream_transform) + +Transform streams are [Duplex](#stream_class_stream_duplex) streams where the output is in some way +computed from the input. They implement both the [Readable](#stream_class_stream_readable) and +[Writable](#stream_class_stream_writable) interfaces. See above for usage. + +Examples of Transform streams include: + +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) + +## API for Stream Implementors[#](#stream_api_for_stream_implementors) + +To implement any sort of stream, the pattern is the same: + +1. Extend the appropriate parent class in your own subclass. (The + [`util.inherits`](util.html#util_util_inherits_constructor_superconstructor) method is particularly helpful for this.) +2. Call the appropriate parent class constructor in your constructor, + to be sure that the internal mechanisms are set up properly. +3. Implement one or more specific methods, as detailed below. + +The class to extend and the method(s) to implement depend on the sort +of stream class you are writing: + +| Use-case | Class | Method(s) to implement | +| --- | --- | --- | +| Reading only | [Readable](#stream_class_stream_readable_1) | `_read` | +| Writing only | [Writable](#stream_class_stream_writable_1) | `_write` | +| Reading and writing | [Duplex](#stream_class_stream_duplex_1) | `_read`, `_write` | +| Operate on written data, then read the result | [Transform](#stream_class_stream_transform_1) | `_transform`, `_flush` | + +In your implementation code, it is very important to never call the +methods described in [API for Stream Consumers](#stream_api_for_stream_consumers) above. Otherwise, you +can potentially cause adverse side effects in programs that consume +your streaming interfaces. + +### Class: stream.Readable[#](#stream_class_stream_readable_1) + +`stream.Readable` is an abstract class designed to be extended with an +underlying implementation of the [`_read(size)`](#stream_readable_read_size_1) method. + +Please see above under [API for Stream Consumers](#stream_api_for_stream_consumers) for how to consume +streams in your programs. What follows is an explanation of how to +implement Readable streams in your programs. + +#### Example: A Counting Stream[#](#stream_example_a_counting_stream) + +This is a basic example of a Readable stream. It emits the numerals +from 1 to 1,000,000 in ascending order, and then ends. + +```None +var Readable = require('stream').Readable; +var util = require('util'); +util.inherits(Counter, Readable); + +function Counter(opt) { + Readable.call(this, opt); + this._max = 1000000; + this._index = 1; +} + +Counter.prototype._read = function() { + var i = this._index++; + if (i > this._max) + this.push(null); + else { + var str = '' + i; + var buf = new Buffer(str, 'ascii'); + this.push(buf); + } +}; +``` + +#### Example: SimpleProtocol v1 (Sub-optimal)[#](#stream_example_simpleprotocol_v1_sub_optimal) + +This is similar to the `parseHeader` function described above, but +implemented as a custom stream. Also, note that this implementation +does not convert the incoming data to a string. + +However, this would be better implemented as a [Transform](#stream_class_stream_transform) stream. See +below for a better implementation. + +```None +// A parser for a simple data protocol. +// The "header" is a JSON object, followed by 2 \n characters, and +// then a message body. +// +// NOTE: This can be done more simply as a Transform stream! +// Using Readable directly for this is sub-optimal. See the +// alternative example below under the Transform section. + +var Readable = require('stream').Readable; +var util = require('util'); + +util.inherits(SimpleProtocol, Readable); + +function SimpleProtocol(source, options) { + if (!(this instanceof SimpleProtocol)) + return new SimpleProtocol(source, options); + + Readable.call(this, options); + this._inBody = false; + this._sawFirstCr = false; + + // source is a readable stream, such as a socket or file + this._source = source; + + var self = this; + source.on('end', function() { + self.push(null); + }); + + // give it a kick whenever the source is readable + // read(0) will not consume any bytes + source.on('readable', function() { + self.read(0); + }); + + this._rawHeader = []; + this.header = null; +} + +SimpleProtocol.prototype._read = function(n) { + if (!this._inBody) { + var chunk = this._source.read(); + + // if the source doesn't have data, we don't have data yet. + if (chunk === null) + return this.push(''); + + // check if the chunk has a \n\n + var split = -1; + for (var i = 0; i < chunk.length; i++) { + if (chunk[i] === 10) { // '\n' + if (this._sawFirstCr) { + split = i; + break; + } else { + this._sawFirstCr = true; + } + } else { + this._sawFirstCr = false; + } + } + + if (split === -1) { + // still waiting for the \n\n + // stash the chunk, and try again. + this._rawHeader.push(chunk); + this.push(''); + } else { + this._inBody = true; + var h = chunk.slice(0, split); + this._rawHeader.push(h); + var header = Buffer.concat(this._rawHeader).toString(); + try { + this.header = JSON.parse(header); + } catch (er) { + this.emit('error', new Error('invalid simple protocol data')); + return; + } + // now, because we got some extra data, unshift the rest + // back into the read queue so that our consumer will see it. + var b = chunk.slice(split); + this.unshift(b); + + // and let them know that we are done parsing the header. + this.emit('header', this.header); + } + } else { + // from there on, just provide the data to our consumer. + // careful not to push(null), since that would indicate EOF. + var chunk = this._source.read(); + if (chunk) this.push(chunk); + } +}; + +// Usage: +// var parser = new SimpleProtocol(source); +// Now parser is a readable stream that will emit 'header' +// with the parsed header data. +``` + +#### new stream.Readable([options])[#](#stream_new_stream_readable_options) + +* `options` Object + + `highWaterMark` Number The maximum number of bytes to store in + the internal buffer before ceasing to read from the underlying + resource. Default=16kb + + `encoding` String If specified, then buffers will be decoded to + strings using the specified encoding. Default=null + + `objectMode` Boolean Whether this stream should behave + as a stream of objects. Meaning that stream.read(n) returns + a single value instead of a Buffer of size n. Default=false + +In classes that extend the Readable class, make sure to call the +Readable constructor so that the buffering settings can be properly +initialized. + +#### readable.\_read(size)[#](#stream_readable_read_size_1) + +* `size` Number Number of bytes to read asynchronously + +Note: **Implement this function, but do NOT call it directly.** + +This function should NOT be called directly. It should be implemented +by child classes, and only called by the internal Readable class +methods. + +All Readable stream implementations must provide a `_read` method to +fetch data from the underlying resource. + +This method is prefixed with an underscore because it is internal to +the class that defines it, and should not be called directly by user +programs. However, you **are** expected to override this method in +your own extension classes. + +When data is available, put it into the read queue by calling +`readable.push(chunk)`. If `push` returns false, then you should stop +reading. When `_read` is called again, you should start pushing more +data. + +The `size` argument is advisory. Implementations where a "read" is a +single call that returns data can use this to know how much data to +fetch. Implementations where that is not relevant, such as TCP or +TLS, may ignore this argument, and simply provide data whenever it +becomes available. There is no need, for example to "wait" until +`size` bytes are available before calling [`stream.push(chunk)`](#stream_readable_push_chunk_encoding). + +#### readable.push(chunk, [encoding])[#](#stream_readable_push_chunk_encoding) + +* `chunk` Buffer | null | String Chunk of data to push into the read queue +* `encoding` String Encoding of String chunks. Must be a valid + Buffer encoding, such as `'utf8'` or `'ascii'` +* return Boolean Whether or not more pushes should be performed + +Note: **This function should be called by Readable implementors, NOT +by consumers of Readable streams.** + +The `_read()` function will not be called again until at least one +`push(chunk)` call is made. + +The `Readable` class works by putting data into a read queue to be +pulled out later by calling the `read()` method when the `'readable'` +event fires. + +The `push()` method will explicitly insert some data into the read +queue. If it is called with `null` then it will signal the end of the +data (EOF). + +This API is designed to be as flexible as possible. For example, +you may be wrapping a lower-level source which has some sort of +pause/resume mechanism, and a data callback. In those cases, you +could wrap the low-level source object by doing something like this: + +```None +// source is an object with readStop() and readStart() methods, +// and an `ondata` member that gets called when it has data, and +// an `onend` member that gets called when the data is over. + +util.inherits(SourceWrapper, Readable); + +function SourceWrapper(options) { + Readable.call(this, options); + + this._source = getLowlevelSourceObject(); + var self = this; + + // Every time there's data, we push it into the internal buffer. + this._source.ondata = function(chunk) { + // if push() returns false, then we need to stop reading from source + if (!self.push(chunk)) + self._source.readStop(); + }; + + // When the source ends, we push the EOF-signalling `null` chunk + this._source.onend = function() { + self.push(null); + }; +} + +// _read will be called when the stream wants to pull more data in +// the advisory size argument is ignored in this case. +SourceWrapper.prototype._read = function(size) { + this._source.readStart(); +}; +``` + +### Class: stream.Writable[#](#stream_class_stream_writable_1) + +`stream.Writable` is an abstract class designed to be extended with an +underlying implementation of the [`_write(chunk, encoding, callback)`](#stream_writable_write_chunk_encoding_callback_1) method. + +Please see above under [API for Stream Consumers](#stream_api_for_stream_consumers) for how to consume +writable streams in your programs. What follows is an explanation of +how to implement Writable streams in your programs. + +#### new stream.Writable([options])[#](#stream_new_stream_writable_options) + +* `options` Object + + `highWaterMark` Number Buffer level when [`write()`](#stream_writable_write_chunk_encoding_callback) starts + returning false. Default=16kb + + `decodeStrings` Boolean Whether or not to decode strings into + Buffers before passing them to [`_write()`](#stream_writable_write_chunk_encoding_callback_1). Default=true + + `objectMode` Boolean Whether or not the `write(anyObj)` is + a valid operation. If set you can write arbitrary data instead + of only `Buffer` / `String` data. Default=false + +In classes that extend the Writable class, make sure to call the +constructor so that the buffering settings can be properly +initialized. + +#### writable.\_write(chunk, encoding, callback)[#](#stream_writable_write_chunk_encoding_callback_1) + +* `chunk` Buffer | String The chunk to be written. Will always + be a buffer unless the `decodeStrings` option was set to `false`. +* `encoding` String If the chunk is a string, then this is the + encoding type. Ignore chunk is a buffer. Note that chunk will + **always** be a buffer unless the `decodeStrings` option is + explicitly set to `false`. +* `callback` Function Call this function (optionally with an error + argument) when you are done processing the supplied chunk. + +All Writable stream implementations must provide a [`_write()`](#stream_writable_write_chunk_encoding_callback_1) +method to send data to the underlying resource. + +Note: **This function MUST NOT be called directly.** It should be +implemented by child classes, and called by the internal Writable +class methods only. + +Call the callback using the standard `callback(error)` pattern to +signal that the write completed successfully or with an error. + +If the `decodeStrings` flag is set in the constructor options, then +`chunk` may be a string rather than a Buffer, and `encoding` will +indicate the sort of string that it is. This is to support +implementations that have an optimized handling for certain string +data encodings. If you do not explicitly set the `decodeStrings` +option to `false`, then you can safely ignore the `encoding` argument, +and assume that `chunk` will always be a Buffer. + +This method is prefixed with an underscore because it is internal to +the class that defines it, and should not be called directly by user +programs. However, you **are** expected to override this method in +your own extension classes. + +### Class: stream.Duplex[#](#stream_class_stream_duplex_1) + +A "duplex" stream is one that is both Readable and Writable, such as a +TCP socket connection. + +Note that `stream.Duplex` is an abstract class designed to be extended +with an underlying implementation of the `_read(size)` and +[`_write(chunk, encoding, callback)`](#stream_writable_write_chunk_encoding_callback_1) methods as you would with a +Readable or Writable stream class. + +Since JavaScript doesn't have multiple prototypal inheritance, this +class prototypally inherits from Readable, and then parasitically from +Writable. It is thus up to the user to implement both the lowlevel +`_read(n)` method as well as the lowlevel +[`_write(chunk, encoding, callback)`](#stream_writable_write_chunk_encoding_callback_1) method on extension duplex classes. + +#### new stream.Duplex(options)[#](#stream_new_stream_duplex_options) + +* `options` Object Passed to both Writable and Readable + constructors. Also has the following fields: + + `allowHalfOpen` Boolean Default=true. If set to `false`, then + the stream will automatically end the readable side when the + writable side ends and vice versa. + +In classes that extend the Duplex class, make sure to call the +constructor so that the buffering settings can be properly +initialized. + +### Class: stream.Transform[#](#stream_class_stream_transform_1) + +A "transform" stream is a duplex stream where the output is causally +connected in some way to the input, such as a [zlib](zlib.html) stream or a +[crypto](crypto.html) stream. + +There is no requirement that the output be the same size as the input, +the same number of chunks, or arrive at the same time. For example, a +Hash stream will only ever have a single chunk of output which is +provided when the input is ended. A zlib stream will produce output +that is either much smaller or much larger than its input. + +Rather than implement the [`_read()`](#stream_readable_read_size_1) and [`_write()`](#stream_writable_write_chunk_encoding_callback_1) methods, Transform +classes must implement the `_transform()` method, and may optionally +also implement the `_flush()` method. (See below.) + +#### new stream.Transform([options])[#](#stream_new_stream_transform_options) + +* `options` Object Passed to both Writable and Readable + constructors. + +In classes that extend the Transform class, make sure to call the +constructor so that the buffering settings can be properly +initialized. + +#### transform.\_transform(chunk, encoding, callback)[#](#stream_transform_transform_chunk_encoding_callback) + +* `chunk` Buffer | String The chunk to be transformed. Will always + be a buffer unless the `decodeStrings` option was set to `false`. +* `encoding` String If the chunk is a string, then this is the + encoding type. (Ignore if `decodeStrings` chunk is a buffer.) +* `callback` Function Call this function (optionally with an error + argument and data) when you are done processing the supplied chunk. + +Note: **This function MUST NOT be called directly.** It should be +implemented by child classes, and called by the internal Transform +class methods only. + +All Transform stream implementations must provide a `_transform` +method to accept input and produce output. + +`_transform` should do whatever has to be done in this specific +Transform class, to handle the bytes being written, and pass them off +to the readable portion of the interface. Do asynchronous I/O, +process things, and so on. + +Call `transform.push(outputChunk)` 0 or more times to generate output +from this input chunk, depending on how much data you want to output +as a result of this chunk. + +Call the callback function only when the current chunk is completely +consumed. Note that there may or may not be output as a result of any +particular input chunk. If you supply as the second argument to the +it will be passed to push method, in other words the following are +equivalent: + +```None +transform.prototype._transform = function (data, encoding, callback) { + this.push(data); + callback(); +} + +transform.prototype._transform = function (data, encoding, callback) { + callback(null, data); +} +``` + +This method is prefixed with an underscore because it is internal to +the class that defines it, and should not be called directly by user +programs. However, you **are** expected to override this method in +your own extension classes. + +#### transform.\_flush(callback)[#](#stream_transform_flush_callback) + +* `callback` Function Call this function (optionally with an error + argument) when you are done flushing any remaining data. + +Note: **This function MUST NOT be called directly.** It MAY be implemented +by child classes, and if so, will be called by the internal Transform +class methods only. + +In some cases, your transform operation may need to emit a bit more +data at the end of the stream. For example, a `Zlib` compression +stream will store up some internal state so that it can optimally +compress the output. At the end, however, it needs to do the best it +can with what is left, so that the data will be complete. + +In those cases, you can implement a `_flush` method, which will be +called at the very end, after all the written data is consumed, but +before emitting `end` to signal the end of the readable side. Just +like with `_transform`, call `transform.push(chunk)` zero or more +times, as appropriate, and call `callback` when the flush operation is +complete. + +This method is prefixed with an underscore because it is internal to +the class that defines it, and should not be called directly by user +programs. However, you **are** expected to override this method in +your own extension classes. + +#### Events: 'finish' and 'end'[#](#stream_events_finish_and_end) + +The [`finish`](#stream_event_finish) and [`end`](#stream_event_end) events are from the parent Writable +and Readable classes respectively. The `finish` event is fired after +`.end()` is called and all chunks have been processed by `_transform`, +`end` is fired after all data has been output which is after the callback +in `_flush` has been called. + +#### Example: `SimpleProtocol` parser v2[#](#stream_example_simpleprotocol_parser_v2) + +The example above of a simple protocol parser can be implemented +simply by using the higher level [Transform](#stream_class_stream_transform) stream class, similar to +the `parseHeader` and `SimpleProtocol v1` examples above. + +In this example, rather than providing the input as an argument, it +would be piped into the parser, which is a more idiomatic Node stream +approach. + +```None +var util = require('util'); +var Transform = require('stream').Transform; +util.inherits(SimpleProtocol, Transform); + +function SimpleProtocol(options) { + if (!(this instanceof SimpleProtocol)) + return new SimpleProtocol(options); + + Transform.call(this, options); + this._inBody = false; + this._sawFirstCr = false; + this._rawHeader = []; + this.header = null; +} + +SimpleProtocol.prototype._transform = function(chunk, encoding, done) { + if (!this._inBody) { + // check if the chunk has a \n\n + var split = -1; + for (var i = 0; i < chunk.length; i++) { + if (chunk[i] === 10) { // '\n' + if (this._sawFirstCr) { + split = i; + break; + } else { + this._sawFirstCr = true; + } + } else { + this._sawFirstCr = false; + } + } + + if (split === -1) { + // still waiting for the \n\n + // stash the chunk, and try again. + this._rawHeader.push(chunk); + } else { + this._inBody = true; + var h = chunk.slice(0, split); + this._rawHeader.push(h); + var header = Buffer.concat(this._rawHeader).toString(); + try { + this.header = JSON.parse(header); + } catch (er) { + this.emit('error', new Error('invalid simple protocol data')); + return; + } + // and let them know that we are done parsing the header. + this.emit('header', this.header); + + // now, because we got some extra data, emit this first. + this.push(chunk.slice(split)); + } + } else { + // from there on, just provide the data to our consumer as-is. + this.push(chunk); + } + done(); +}; + +// Usage: +// var parser = new SimpleProtocol(); +// source.pipe(parser) +// Now parser is a readable stream that will emit 'header' +// with the parsed header data. +``` + +### Class: stream.PassThrough[#](#stream_class_stream_passthrough) + +This is a trivial implementation of a [Transform](#stream_class_stream_transform) stream that simply +passes the input bytes across to the output. Its purpose is mainly +for examples and testing, but there are occasionally use cases where +it can come in handy as a building block for novel sorts of streams. + +## Streams: Under the Hood[#](#stream_streams_under_the_hood) + +### Buffering[#](#stream_buffering) + +Both Writable and Readable streams will buffer data on an internal +object called `_writableState.buffer` or `_readableState.buffer`, +respectively. + +The amount of data that will potentially be buffered depends on the +`highWaterMark` option which is passed into the constructor. + +Buffering in Readable streams happens when the implementation calls +[`stream.push(chunk)`](#stream_readable_push_chunk_encoding). If the consumer of the Stream does not call +`stream.read()`, then the data will sit in the internal queue until it +is consumed. + +Buffering in Writable streams happens when the user calls +[`stream.write(chunk)`](#stream_writable_write_chunk_encoding_callback) repeatedly, even when `write()` returns `false`. + +The purpose of streams, especially with the `pipe()` method, is to +limit the buffering of data to acceptable levels, so that sources and +destinations of varying speed will not overwhelm the available memory. + +### `stream.read(0)`[#](#stream_stream_read_0) + +There are some cases where you want to trigger a refresh of the +underlying readable stream mechanisms, without actually consuming any +data. In that case, you can call `stream.read(0)`, which will always +return null. + +If the internal read buffer is below the `highWaterMark`, and the +stream is not currently reading, then calling `read(0)` will trigger +a low-level `_read` call. + +There is almost never a need to do this. However, you will see some +cases in Node's internals where this is done, particularly in the +Readable stream class internals. + +### `stream.push('')`[#](#stream_stream_push) + +Pushing a zero-byte string or Buffer (when not in [Object mode](#stream_object_mode)) has an +interesting side effect. Because it *is* a call to +[`stream.push()`](#stream_readable_push_chunk_encoding), it will end the `reading` process. However, it +does *not* add any data to the readable buffer, so there's nothing for +a user to consume. + +Very rarely, there are cases where you have no data to provide now, +but the consumer of your stream (or, perhaps, another bit of your own +code) will know when to check again, by calling `stream.read(0)`. In +those cases, you *may* call `stream.push('')`. + +So far, the only use case for this functionality is in the +[tls.CryptoStream](tls.html#tls_class_cryptostream) class, which is deprecated in Node v0.12. If you +find that you have to use `stream.push('')`, please consider another +approach, because it almost certainly indicates that something is +horribly wrong. + +### Compatibility with Older Node Versions[#](#stream_compatibility_with_older_node_versions) + +In versions of Node prior to v0.10, the Readable stream interface was +simpler, but also less powerful and less useful. + +* Rather than waiting for you to call the `read()` method, `'data'` + events would start emitting immediately. If you needed to do some + I/O to decide how to handle data, then you had to store the chunks + in some kind of buffer so that they would not be lost. +* The `pause()` method was advisory, rather than guaranteed. This + meant that you still had to be prepared to receive `'data'` events + even when the stream was in a paused state. + +In Node v0.10, the Readable class described below was added. For +backwards compatibility with older Node programs, Readable streams +switch into "flowing mode" when a `'data'` event handler is added, or +when the `pause()` or `resume()` methods are called. The effect is +that, even if you are not using the new `read()` method and +`'readable'` event, you no longer have to worry about losing `'data'` +chunks. + +Most programs will continue to function normally. However, this +introduces an edge case in the following conditions: + +* No `'data'` event handler is added. +* The `pause()` and `resume()` methods are never called. + +For example, consider the following code: + +```None +// WARNING! BROKEN! +net.createServer(function(socket) { + + // we add an 'end' method, but never consume the data + socket.on('end', function() { + // It will never get here. + socket.end('I got your message (but didnt read it)\n'); + }); + +}).listen(1337); +``` + +In versions of node prior to v0.10, the incoming message data would be +simply discarded. However, in Node v0.10 and beyond, the socket will +remain paused forever. + +The workaround in this situation is to call the `resume()` method to +trigger "old mode" behavior: + +```None +// Workaround +net.createServer(function(socket) { + + socket.on('end', function() { + socket.end('I got your message (but didnt read it)\n'); + }); + + // start the flow of data, discarding it. + socket.resume(); + +}).listen(1337); +``` + +In addition to new Readable streams switching into flowing-mode, pre-v0.10 +style streams can be wrapped in a Readable class using the `wrap()` +method. + +### Object Mode[#](#stream_object_mode) + +Normally, Streams operate on Strings and Buffers exclusively. + +Streams that are in **object mode** can emit generic JavaScript values +other than Buffers and Strings. + +A Readable stream in object mode will always return a single item from +a call to `stream.read(size)`, regardless of what the size argument +is. + +A Writable stream in object mode will always ignore the `encoding` +argument to `stream.write(data, encoding)`. + +The special value `null` still retains its special value for object +mode streams. That is, for object mode readable streams, `null` as a +return value from `stream.read()` indicates that there is no more +data, and [`stream.push(null)`](#stream_readable_push_chunk_encoding) will signal the end of stream data +(`EOF`). + +No streams in Node core are object mode streams. This pattern is only +used by userland streaming libraries. + +You should set `objectMode` in your stream child class constructor on +the options object. Setting `objectMode` mid-stream is not safe. + +### State Objects[#](#stream_state_objects) + +[Readable](#stream_class_stream_readable) streams have a member object called `_readableState`. +[Writable](#stream_class_stream_writable) streams have a member object called `_writableState`. +[Duplex](#stream_class_stream_duplex) streams have both. + +**These objects should generally not be modified in child classes.** +However, if you have a Duplex or Transform stream that should be in +`objectMode` on the readable side, and not in `objectMode` on the +writable side, then you may do this in the constructor by setting the +flag explicitly on the appropriate state object. + +```None +var util = require('util'); +var StringDecoder = require('string_decoder').StringDecoder; +var Transform = require('stream').Transform; +util.inherits(JSONParseStream, Transform); + +// Gets \n-delimited JSON string data, and emits the parsed objects +function JSONParseStream(options) { + if (!(this instanceof JSONParseStream)) + return new JSONParseStream(options); + + Transform.call(this, options); + this._writableState.objectMode = false; + this._readableState.objectMode = true; + this._buffer = ''; + this._decoder = new StringDecoder('utf8'); +} + +JSONParseStream.prototype._transform = function(chunk, encoding, cb) { + this._buffer += this._decoder.write(chunk); + // split on newlines + var lines = this._buffer.split(/\r?\n/); + // keep the last partial line buffered + this._buffer = lines.pop(); + for (var l = 0; l < lines.length; l++) { + var line = lines[l]; + try { + var obj = JSON.parse(line); + } catch (er) { + this.emit('error', er); + return; + } + // push the parsed object out to the readable consumer + this.push(obj); + } + cb(); +}; + +JSONParseStream.prototype._flush = function(cb) { + // Just handle any leftover + var rem = this._buffer.trim(); + if (rem) { + try { + var obj = JSON.parse(rem); + } catch (er) { + this.emit('error', er); + return; + } + // push the parsed object out to the readable consumer + this.push(obj); + } + cb(); +}; +``` + +The state objects contain other useful information for debugging the +state of streams in your programs. It is safe to look at them, but +beyond setting option flags in the constructor, it is **not** safe to +modify them. diff --git a/corpus/docs/nodejs/stream/stream_012x.md b/corpus/docs/nodejs/stream/stream_012x.md new file mode 100644 index 0000000000000000000000000000000000000000..9d83837d9a54bbd50ec6da890375d122da2d0604 --- /dev/null +++ b/corpus/docs/nodejs/stream/stream_012x.md @@ -0,0 +1,1506 @@ +# Stream# + +Source: https://nodejs.org/docs/latest-v0.12.x/api/stream.html +Version: 0.12.x + +```None +Stability: 2 - Unstable +``` + +A stream is an abstract interface implemented by various objects in +Node. For example a [request to an HTTP +server](http.html#http_http_incomingmessage) is a stream, as is +[stdout](process.html#process_process_stdout). Streams are readable, writable, or both. All streams are +instances of [EventEmitter](events.html#events_class_events_eventemitter) + +You can load the Stream base classes by doing `require('stream')`. +There are base classes provided for [Readable](#stream_class_stream_readable) streams, [Writable](#stream_class_stream_writable) +streams, [Duplex](#stream_class_stream_duplex) streams, and [Transform](#stream_class_stream_transform) streams. + +This document is split up into 3 sections. The first explains the +parts of the API that you need to be aware of to use streams in your +programs. If you never implement a streaming API yourself, you can +stop there. + +The second section explains the parts of the API that you need to use +if you implement your own custom streams yourself. The API is +designed to make this easy for you to do. + +The third section goes into more depth about how streams work, +including some of the internal mechanisms and functions that you +should probably not modify unless you definitely know what you are +doing. + +## API for Stream Consumers[#](#stream_api_for_stream_consumers) + +Streams can be either [Readable](#stream_class_stream_readable), [Writable](#stream_class_stream_writable), or both ([Duplex](#stream_class_stream_duplex)). + +All streams are EventEmitters, but they also have other custom methods +and properties depending on whether they are Readable, Writable, or +Duplex. + +If a stream is both Readable and Writable, then it implements all of +the methods and events below. So, a [Duplex](#stream_class_stream_duplex) or [Transform](#stream_class_stream_transform) stream is +fully described by this API, though their implementation may be +somewhat different. + +It is not necessary to implement Stream interfaces in order to consume +streams in your programs. If you **are** implementing streaming +interfaces in your own program, please also refer to +[API for Stream Implementors](#stream_api_for_stream_implementors) below. + +Almost all Node programs, no matter how simple, use Streams in some +way. Here is an example of using Streams in a Node program: + +```None +var http = require('http'); + +var server = http.createServer(function (req, res) { + // req is an http.IncomingMessage, which is a Readable Stream + // res is an http.ServerResponse, which is a Writable Stream + + var body = ''; + // we want to get the data as utf8 strings + // If you don't set an encoding, then you'll get Buffer objects + req.setEncoding('utf8'); + + // Readable streams emit 'data' events once a listener is added + req.on('data', function (chunk) { + body += chunk; + }); + + // the end event tells you that you have entire body + req.on('end', function () { + try { + var data = JSON.parse(body); + } catch (er) { + // uh oh! bad json! + res.statusCode = 400; + return res.end('error: ' + er.message); + } + + // write back something interesting to the user: + res.write(typeof data); + res.end(); + }); +}); + +server.listen(1337); + +// $ curl localhost:1337 -d '{}' +// object +// $ curl localhost:1337 -d '"foo"' +// string +// $ curl localhost:1337 -d 'not json' +// error: Unexpected token o +``` + +### Class: stream.Readable[#](#stream_class_stream_readable) + +The Readable stream interface is the abstraction for a *source* of +data that you are reading from. In other words, data comes *out* of a +Readable stream. + +A Readable stream will not start emitting data until you indicate that +you are ready to receive it. + +Readable streams have two "modes": a **flowing mode** and a **paused +mode**. When in flowing mode, data is read from the underlying system +and provided to your program as fast as possible. In paused mode, you +must explicitly call `stream.read()` to get chunks of data out. +Streams start out in paused mode. + +**Note**: If no data event handlers are attached, and there are no +[`pipe()`](#stream_readable_pipe_destination_options) destinations, and the stream is switched into flowing +mode, then data will be lost. + +You can switch to flowing mode by doing any of the following: + +* Adding a [`'data'` event](#stream_event_data) handler to listen for data. +* Calling the [`resume()`](#stream_readable_resume) method to explicitly open the flow. +* Calling the [`pipe()`](#stream_readable_pipe_destination_options) method to send the data to a [Writable](#stream_class_stream_writable). + +You can switch back to paused mode by doing either of the following: + +* If there are no pipe destinations, by calling the [`pause()`](#stream_readable_pause) + method. +* If there are pipe destinations, by removing any [`'data'` event](#stream_event_data) + handlers, and removing all pipe destinations by calling the + [`unpipe()`](#stream_readable_unpipe_destination) method. + +Note that, for backwards compatibility reasons, removing `'data'` +event handlers will **not** automatically pause the stream. Also, if +there are piped destinations, then calling `pause()` will not +guarantee that the stream will *remain* paused once those +destinations drain and ask for more data. + +Examples of readable streams include: + +* [http responses, on the client](http.html#http_http_incomingmessage) +* [http requests, on the server](http.html#http_http_incomingmessage) +* [fs read streams](fs.html#fs_class_fs_readstream) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) +* [tcp sockets](net.html#net_class_net_socket) +* [child process stdout and stderr](child_process.html#child_process_child_stdout) +* [process.stdin](process.html#process_process_stdin) + +#### Event: 'readable'[#](#stream_event_readable) + +When a chunk of data can be read from the stream, it will emit a +`'readable'` event. + +In some cases, listening for a `'readable'` event will cause some data +to be read into the internal buffer from the underlying system, if it +hadn't already. + +```None +var readable = getReadableStreamSomehow(); +readable.on('readable', function() { + // there is some data to read now +}); +``` + +Once the internal buffer is drained, a `readable` event will fire +again when more data is available. + +The `readable` event is not emitted in the "flowing" mode with the +sole exception of the last one, on end-of-stream. + +The 'readable' event indicates that the stream has new information: +either new data is available or the end of the stream has been reached. +In the former case, `.read()` will return that data. In the latter case, +`.read()` will return null. For instance, in the following example, `foo.txt` +is an empty file: + +```None +var fs = require('fs'); +var rr = fs.createReadStream('foo.txt'); +rr.on('readable', function() { + console.log('readable:', rr.read()); +}); +rr.on('end', function() { + console.log('end'); +}); +``` + +The output of running this script is: + +```None +bash-3.2$ node test.js +readable: null +end +``` + +#### Event: 'data'[#](#stream_event_data) + +* `chunk` Buffer | String The chunk of data. + +Attaching a `data` event listener to a stream that has not been +explicitly paused will switch the stream into flowing mode. Data will +then be passed as soon as it is available. + +If you just want to get all the data out of the stream as fast as +possible, this is the best way to do so. + +```None +var readable = getReadableStreamSomehow(); +readable.on('data', function(chunk) { + console.log('got %d bytes of data', chunk.length); +}); +``` + +Note that the `readable` event should not be used together with `data` +because the assigning the latter switches the stream into "flowing" mode, +so the `readable` event will not be emitted. + +#### Event: 'end'[#](#stream_event_end) + +This event fires when there will be no more data to read. + +Note that the `end` event **will not fire** unless the data is +completely consumed. This can be done by switching into flowing mode, +or by calling `read()` repeatedly until you get to the end. + +```None +var readable = getReadableStreamSomehow(); +readable.on('data', function(chunk) { + console.log('got %d bytes of data', chunk.length); +}); +readable.on('end', function() { + console.log('there will be no more data.'); +}); +``` + +#### Event: 'close'[#](#stream_event_close) + +Emitted when the underlying resource (for example, the backing file +descriptor) has been closed. Not all streams will emit this. + +#### Event: 'error'[#](#stream_event_error) + +* Error Object + +Emitted if there was an error receiving data. + +#### readable.read([size])[#](#stream_readable_read_size) + +* `size` Number Optional argument to specify how much data to read. +* Return String | Buffer | null + +The `read()` method pulls some data out of the internal buffer and +returns it. If there is no data available, then it will return +`null`. + +If you pass in a `size` argument, then it will return that many +bytes. If `size` bytes are not available, then it will return `null`, +unless we've ended, in which case it will return the data remaining +in the buffer. + +If you do not specify a `size` argument, then it will return all the +data in the internal buffer. + +This method should only be called in paused mode. In flowing mode, +this method is called automatically until the internal buffer is +drained. + +```None +var readable = getReadableStreamSomehow(); +readable.on('readable', function() { + var chunk; + while (null !== (chunk = readable.read())) { + console.log('got %d bytes of data', chunk.length); + } +}); +``` + +If this method returns a data chunk, then it will also trigger the +emission of a [`'data'` event](#stream_event_data). + +Note that calling `readable.read([size])` after the `end` event has been +triggered will return `null`. No runtime error will be raised. + +#### readable.setEncoding(encoding)[#](#stream_readable_setencoding_encoding) + +* `encoding` String The encoding to use. +* Return: `this` + +Call this function to cause the stream to return strings of the +specified encoding instead of Buffer objects. For example, if you do +`readable.setEncoding('utf8')`, then the output data will be +interpreted as UTF-8 data, and returned as strings. If you do +`readable.setEncoding('hex')`, then the data will be encoded in +hexadecimal string format. + +This properly handles multi-byte characters that would otherwise be +potentially mangled if you simply pulled the Buffers directly and +called `buf.toString(encoding)` on them. If you want to read the data +as strings, always use this method. + +```None +var readable = getReadableStreamSomehow(); +readable.setEncoding('utf8'); +readable.on('data', function(chunk) { + assert.equal(typeof chunk, 'string'); + console.log('got %d characters of string data', chunk.length); +}); +``` + +#### readable.resume()[#](#stream_readable_resume) + +* Return: `this` + +This method will cause the readable stream to resume emitting `data` +events. + +This method will switch the stream into flowing mode. If you do *not* +want to consume the data from a stream, but you *do* want to get to +its `end` event, you can call [`readable.resume()`](#stream_readable_resume) to open the flow of +data. + +```None +var readable = getReadableStreamSomehow(); +readable.resume(); +readable.on('end', function(chunk) { + console.log('got to the end, but did not read anything'); +}); +``` + +#### readable.pause()[#](#stream_readable_pause) + +* Return: `this` + +This method will cause a stream in flowing mode to stop emitting +`data` events, switching out of flowing mode. Any data that becomes +available will remain in the internal buffer. + +```None +var readable = getReadableStreamSomehow(); +readable.on('data', function(chunk) { + console.log('got %d bytes of data', chunk.length); + readable.pause(); + console.log('there will be no more data for 1 second'); + setTimeout(function() { + console.log('now data will start flowing again'); + readable.resume(); + }, 1000); +}); +``` + +#### readable.isPaused()[#](#stream_readable_ispaused) + +* Return: `Boolean` + +This method returns whether or not the `readable` has been **explicitly** +paused by client code (using `readable.pause()` without a corresponding +`readable.resume()`). + +```None +var readable = new stream.Readable + +readable.isPaused() // === false +readable.pause() +readable.isPaused() // === true +readable.resume() +readable.isPaused() // === false +``` + +#### readable.pipe(destination[, options])[#](#stream_readable_pipe_destination_options) + +* `destination` [Writable](#stream_class_stream_writable) Stream The destination for writing data +* `options` Object Pipe options + + `end` Boolean End the writer when the reader ends. Default = `true` + +This method pulls all the data out of a readable stream, and writes it +to the supplied destination, automatically managing the flow so that +the destination is not overwhelmed by a fast readable stream. + +Multiple destinations can be piped to safely. + +```None +var readable = getReadableStreamSomehow(); +var writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt' +readable.pipe(writable); +``` + +This function returns the destination stream, so you can set up pipe +chains like so: + +```None +var r = fs.createReadStream('file.txt'); +var z = zlib.createGzip(); +var w = fs.createWriteStream('file.txt.gz'); +r.pipe(z).pipe(w); +``` + +For example, emulating the Unix `cat` command: + +```None +process.stdin.pipe(process.stdout); +``` + +By default [`end()`](#stream_writable_end_chunk_encoding_callback) is called on the destination when the source stream +emits `end`, so that `destination` is no longer writable. Pass `{ end: +false }` as `options` to keep the destination stream open. + +This keeps `writer` open so that "Goodbye" can be written at the +end. + +```None +reader.pipe(writer, { end: false }); +reader.on('end', function() { + writer.end('Goodbye\n'); +}); +``` + +Note that `process.stderr` and `process.stdout` are never closed until +the process exits, regardless of the specified options. + +#### readable.unpipe([destination])[#](#stream_readable_unpipe_destination) + +* `destination` [Writable](#stream_class_stream_writable) Stream Optional specific stream to unpipe + +This method will remove the hooks set up for a previous `pipe()` call. + +If the destination is not specified, then all pipes are removed. + +If the destination is specified, but no pipe is set up for it, then +this is a no-op. + +```None +var readable = getReadableStreamSomehow(); +var writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt', +// but only for the first second +readable.pipe(writable); +setTimeout(function() { + console.log('stop writing to file.txt'); + readable.unpipe(writable); + console.log('manually close the file stream'); + writable.end(); +}, 1000); +``` + +#### readable.unshift(chunk)[#](#stream_readable_unshift_chunk) + +* `chunk` Buffer | String Chunk of data to unshift onto the read queue + +This is useful in certain cases where a stream is being consumed by a +parser, which needs to "un-consume" some data that it has +optimistically pulled out of the source, so that the stream can be +passed on to some other party. + +Note that `stream.unshift(chunk)` cannot be called after the `end` event +has been triggered; a runtime error will be raised. + +If you find that you must often call `stream.unshift(chunk)` in your +programs, consider implementing a [Transform](#stream_class_stream_transform) stream instead. (See API +for Stream Implementors, below.) + +```None +// Pull off a header delimited by \n\n +// use unshift() if we get too much +// Call the callback with (error, header, stream) +var StringDecoder = require('string_decoder').StringDecoder; +function parseHeader(stream, callback) { + stream.on('error', callback); + stream.on('readable', onReadable); + var decoder = new StringDecoder('utf8'); + var header = ''; + function onReadable() { + var chunk; + while (null !== (chunk = stream.read())) { + var str = decoder.write(chunk); + if (str.match(/\n\n/)) { + // found the header boundary + var split = str.split(/\n\n/); + header += split.shift(); + var remaining = split.join('\n\n'); + var buf = new Buffer(remaining, 'utf8'); + if (buf.length) + stream.unshift(buf); + stream.removeListener('error', callback); + stream.removeListener('readable', onReadable); + // now the body of the message can be read from the stream. + callback(null, header, stream); + } else { + // still reading the header. + header += str; + } + } + } +} +``` + +Note that, unlike `stream.push(chunk)`, `stream.unshift(chunk)` will not +end the reading process by resetting the internal reading state of the +stream. This can cause unexpected results if `unshift` is called during a +read (i.e. from within a `_read` implementation on a custom stream). Following +the call to `unshift` with an immediate `stream.push('')` will reset the +reading state appropriately, however it is best to simply avoid calling +`unshift` while in the process of performing a read. + +#### readable.wrap(stream)[#](#stream_readable_wrap_stream) + +* `stream` Stream An "old style" readable stream + +Versions of Node prior to v0.10 had streams that did not implement the +entire Streams API as it is today. (See "Compatibility" below for +more information.) + +If you are using an older Node library that emits `'data'` events and +has a [`pause()`](#stream_readable_pause) method that is advisory only, then you can use the +`wrap()` method to create a [Readable](#stream_class_stream_readable) stream that uses the old stream +as its data source. + +You will very rarely ever need to call this function, but it exists +as a convenience for interacting with old Node programs and libraries. + +For example: + +```None +var OldReader = require('./old-api-module.js').OldReader; +var oreader = new OldReader; +var Readable = require('stream').Readable; +var myReader = new Readable().wrap(oreader); + +myReader.on('readable', function() { + myReader.read(); // etc. +}); +``` + +### Class: stream.Writable[#](#stream_class_stream_writable) + +The Writable stream interface is an abstraction for a *destination* +that you are writing data *to*. + +Examples of writable streams include: + +* [http requests, on the client](http.html#http_class_http_clientrequest) +* [http responses, on the server](http.html#http_class_http_serverresponse) +* [fs write streams](fs.html#fs_class_fs_writestream) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) +* [tcp sockets](net.html#net_class_net_socket) +* [child process stdin](child_process.html#child_process_child_stdin) +* [process.stdout](process.html#process_process_stdout), [process.stderr](process.html#process_process_stderr) + +#### writable.write(chunk[, encoding][, callback])[#](#stream_writable_write_chunk_encoding_callback) + +* `chunk` String | Buffer The data to write +* `encoding` String The encoding, if `chunk` is a String +* `callback` Function Callback for when this chunk of data is flushed +* Returns: Boolean True if the data was handled completely. + +This method writes some data to the underlying system, and calls the +supplied callback once the data has been fully handled. + +The return value indicates if you should continue writing right now. +If the data had to be buffered internally, then it will return +`false`. Otherwise, it will return `true`. + +This return value is strictly advisory. You MAY continue to write, +even if it returns `false`. However, writes will be buffered in +memory, so it is best not to do this excessively. Instead, wait for +the `drain` event before writing more data. + +#### Event: 'drain'[#](#stream_event_drain) + +If a [`writable.write(chunk)`](#stream_writable_write_chunk_encoding_callback) call returns false, then the `drain` +event will indicate when it is appropriate to begin writing more data +to the stream. + +```None +// Write the data to the supplied writable stream 1MM times. +// Be attentive to back-pressure. +function writeOneMillionTimes(writer, data, encoding, callback) { + var i = 1000000; + write(); + function write() { + var ok = true; + do { + i -= 1; + if (i === 0) { + // last time! + writer.write(data, encoding, callback); + } else { + // see if we should continue, or wait + // don't pass the callback, because we're not done yet. + ok = writer.write(data, encoding); + } + } while (i > 0 && ok); + if (i > 0) { + // had to stop early! + // write some more once it drains + writer.once('drain', write); + } + } +} +``` + +#### writable.cork()[#](#stream_writable_cork) + +Forces buffering of all writes. + +Buffered data will be flushed either at `.uncork()` or at `.end()` call. + +#### writable.uncork()[#](#stream_writable_uncork) + +Flush all data, buffered since `.cork()` call. + +#### writable.setDefaultEncoding(encoding)[#](#stream_writable_setdefaultencoding_encoding) + +* `encoding` String The new default encoding +* Return: `Boolean` + +Sets the default encoding for a writable stream. Returns `true` if the encoding +is valid and is set. Otherwise returns `false`. + +#### writable.end([chunk][, encoding][, callback])[#](#stream_writable_end_chunk_encoding_callback) + +* `chunk` String | Buffer Optional data to write +* `encoding` String The encoding, if `chunk` is a String +* `callback` Function Optional callback for when the stream is finished + +Call this method when no more data will be written to the stream. If +supplied, the callback is attached as a listener on the `finish` event. + +```None +// write 'hello, ' and then end with 'world!' +var file = fs.createWriteStream('example.txt'); +file.write('hello, '); +file.end('world!'); +``` + +Calling [`write()`](#stream_writable_write_chunk_encoding_callback) after calling [`end()`](#stream_writable_end_chunk_encoding_callback) will raise an error: + +```None +// end with 'world!' and then write with 'hello, ' will raise an error +var file = fs.createWriteStream('example.txt'); +file.end('world!'); +file.write('hello, '); +``` + +#### Event: 'finish'[#](#stream_event_finish) + +When the [`end()`](#stream_writable_end_chunk_encoding_callback) method has been called, and all data has been flushed +to the underlying system, this event is emitted. + +```None +var writer = getWritableStreamSomehow(); +for (var i = 0; i < 100; i ++) { + writer.write('hello, #' + i + '!\n'); +} +writer.end('this is the end\n'); +writer.on('finish', function() { + console.error('all writes are now complete.'); +}); +``` + +#### Event: 'pipe'[#](#stream_event_pipe) + +* `src` [Readable](#stream_class_stream_readable) Stream source stream that is piping to this writable + +This is emitted whenever the `pipe()` method is called on a readable +stream, adding this writable to its set of destinations. + +```None +var writer = getWritableStreamSomehow(); +var reader = getReadableStreamSomehow(); +writer.on('pipe', function(src) { + console.error('something is piping into the writer'); + assert.equal(src, reader); +}); +reader.pipe(writer); +``` + +#### Event: 'unpipe'[#](#stream_event_unpipe) + +* `src` [Readable](#stream_class_stream_readable) Stream The source stream that [unpiped](#stream_readable_unpipe_destination) this writable + +This is emitted whenever the [`unpipe()`](#stream_readable_unpipe_destination) method is called on a +readable stream, removing this writable from its set of destinations. + +```None +var writer = getWritableStreamSomehow(); +var reader = getReadableStreamSomehow(); +writer.on('unpipe', function(src) { + console.error('something has stopped piping into the writer'); + assert.equal(src, reader); +}); +reader.pipe(writer); +reader.unpipe(writer); +``` + +#### Event: 'error'[#](#stream_event_error_1) + +* Error object + +Emitted if there was an error when writing or piping data. + +### Class: stream.Duplex[#](#stream_class_stream_duplex) + +Duplex streams are streams that implement both the [Readable](#stream_class_stream_readable) and +[Writable](#stream_class_stream_writable) interfaces. See above for usage. + +Examples of Duplex streams include: + +* [tcp sockets](net.html#net_class_net_socket) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) + +### Class: stream.Transform[#](#stream_class_stream_transform) + +Transform streams are [Duplex](#stream_class_stream_duplex) streams where the output is in some way +computed from the input. They implement both the [Readable](#stream_class_stream_readable) and +[Writable](#stream_class_stream_writable) interfaces. See above for usage. + +Examples of Transform streams include: + +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) + +## API for Stream Implementors[#](#stream_api_for_stream_implementors) + +To implement any sort of stream, the pattern is the same: + +1. Extend the appropriate parent class in your own subclass. (The + [`util.inherits`](util.html#util_util_inherits_constructor_superconstructor) method is particularly helpful for this.) +2. Call the appropriate parent class constructor in your constructor, + to be sure that the internal mechanisms are set up properly. +3. Implement one or more specific methods, as detailed below. + +The class to extend and the method(s) to implement depend on the sort +of stream class you are writing: + +| Use-case | Class | Method(s) to implement | +| --- | --- | --- | +| Reading only | [Readable](#stream_class_stream_readable_1) | `_read` | +| Writing only | [Writable](#stream_class_stream_writable_1) | `_write` | +| Reading and writing | [Duplex](#stream_class_stream_duplex_1) | `_read`, `_write` | +| Operate on written data, then read the result | [Transform](#stream_class_stream_transform_1) | `_transform`, `_flush` | + +In your implementation code, it is very important to never call the +methods described in [API for Stream Consumers](#stream_api_for_stream_consumers) above. Otherwise, you +can potentially cause adverse side effects in programs that consume +your streaming interfaces. + +### Class: stream.Readable[#](#stream_class_stream_readable_1) + +`stream.Readable` is an abstract class designed to be extended with an +underlying implementation of the [`_read(size)`](#stream_readable_read_size_1) method. + +Please see above under [API for Stream Consumers](#stream_api_for_stream_consumers) for how to consume +streams in your programs. What follows is an explanation of how to +implement Readable streams in your programs. + +#### Example: A Counting Stream[#](#stream_example_a_counting_stream) + +This is a basic example of a Readable stream. It emits the numerals +from 1 to 1,000,000 in ascending order, and then ends. + +```None +var Readable = require('stream').Readable; +var util = require('util'); +util.inherits(Counter, Readable); + +function Counter(opt) { + Readable.call(this, opt); + this._max = 1000000; + this._index = 1; +} + +Counter.prototype._read = function() { + var i = this._index++; + if (i > this._max) + this.push(null); + else { + var str = '' + i; + var buf = new Buffer(str, 'ascii'); + this.push(buf); + } +}; +``` + +#### Example: SimpleProtocol v1 (Sub-optimal)[#](#stream_example_simpleprotocol_v1_sub_optimal) + +This is similar to the `parseHeader` function described above, but +implemented as a custom stream. Also, note that this implementation +does not convert the incoming data to a string. + +However, this would be better implemented as a [Transform](#stream_class_stream_transform) stream. See +below for a better implementation. + +```None +// A parser for a simple data protocol. +// The "header" is a JSON object, followed by 2 \n characters, and +// then a message body. +// +// NOTE: This can be done more simply as a Transform stream! +// Using Readable directly for this is sub-optimal. See the +// alternative example below under the Transform section. + +var Readable = require('stream').Readable; +var util = require('util'); + +util.inherits(SimpleProtocol, Readable); + +function SimpleProtocol(source, options) { + if (!(this instanceof SimpleProtocol)) + return new SimpleProtocol(source, options); + + Readable.call(this, options); + this._inBody = false; + this._sawFirstCr = false; + + // source is a readable stream, such as a socket or file + this._source = source; + + var self = this; + source.on('end', function() { + self.push(null); + }); + + // give it a kick whenever the source is readable + // read(0) will not consume any bytes + source.on('readable', function() { + self.read(0); + }); + + this._rawHeader = []; + this.header = null; +} + +SimpleProtocol.prototype._read = function(n) { + if (!this._inBody) { + var chunk = this._source.read(); + + // if the source doesn't have data, we don't have data yet. + if (chunk === null) + return this.push(''); + + // check if the chunk has a \n\n + var split = -1; + for (var i = 0; i < chunk.length; i++) { + if (chunk[i] === 10) { // '\n' + if (this._sawFirstCr) { + split = i; + break; + } else { + this._sawFirstCr = true; + } + } else { + this._sawFirstCr = false; + } + } + + if (split === -1) { + // still waiting for the \n\n + // stash the chunk, and try again. + this._rawHeader.push(chunk); + this.push(''); + } else { + this._inBody = true; + var h = chunk.slice(0, split); + this._rawHeader.push(h); + var header = Buffer.concat(this._rawHeader).toString(); + try { + this.header = JSON.parse(header); + } catch (er) { + this.emit('error', new Error('invalid simple protocol data')); + return; + } + // now, because we got some extra data, unshift the rest + // back into the read queue so that our consumer will see it. + var b = chunk.slice(split); + this.unshift(b); + // calling unshift by itself does not reset the reading state + // of the stream; since we're inside _read, doing an additional + // push('') will reset the state appropriately. + this.push(''); + + // and let them know that we are done parsing the header. + this.emit('header', this.header); + } + } else { + // from there on, just provide the data to our consumer. + // careful not to push(null), since that would indicate EOF. + var chunk = this._source.read(); + if (chunk) this.push(chunk); + } +}; + +// Usage: +// var parser = new SimpleProtocol(source); +// Now parser is a readable stream that will emit 'header' +// with the parsed header data. +``` + +#### new stream.Readable([options])[#](#stream_new_stream_readable_options) + +* `options` Object + + `highWaterMark` Number The maximum number of bytes to store in + the internal buffer before ceasing to read from the underlying + resource. Default=16kb, or 16 for `objectMode` streams + + `encoding` String If specified, then buffers will be decoded to + strings using the specified encoding. Default=null + + `objectMode` Boolean Whether this stream should behave + as a stream of objects. Meaning that stream.read(n) returns + a single value instead of a Buffer of size n. Default=false + +In classes that extend the Readable class, make sure to call the +Readable constructor so that the buffering settings can be properly +initialized. + +#### readable.\_read(size)[#](#stream_readable_read_size_1) + +* `size` Number Number of bytes to read asynchronously + +Note: **Implement this method, but do NOT call it directly.** + +This method is prefixed with an underscore because it is internal to the +class that defines it and should only be called by the internal Readable +class methods. All Readable stream implementations must provide a \_read +method to fetch data from the underlying resource. + +When \_read is called, if data is available from the resource, `_read` should +start pushing that data into the read queue by calling `this.push(dataChunk)`. +`_read` should continue reading from the resource and pushing data until push +returns false, at which point it should stop reading from the resource. Only +when \_read is called again after it has stopped should it start reading +more data from the resource and pushing that data onto the queue. + +Note: once the `_read()` method is called, it will not be called again until +the `push` method is called. + +The `size` argument is advisory. Implementations where a "read" is a +single call that returns data can use this to know how much data to +fetch. Implementations where that is not relevant, such as TCP or +TLS, may ignore this argument, and simply provide data whenever it +becomes available. There is no need, for example to "wait" until +`size` bytes are available before calling [`stream.push(chunk)`](#stream_readable_push_chunk_encoding). + +#### readable.push(chunk[, encoding])[#](#stream_readable_push_chunk_encoding) + +* `chunk` Buffer | null | String Chunk of data to push into the read queue +* `encoding` String Encoding of String chunks. Must be a valid + Buffer encoding, such as `'utf8'` or `'ascii'` +* return Boolean Whether or not more pushes should be performed + +Note: **This method should be called by Readable implementors, NOT +by consumers of Readable streams.** + +If a value other than null is passed, The `push()` method adds a chunk of data +into the queue for subsequent stream processors to consume. If `null` is +passed, it signals the end of the stream (EOF), after which no more data +can be written. + +The data added with `push` can be pulled out by calling the `read()` method +when the `'readable'`event fires. + +This API is designed to be as flexible as possible. For example, +you may be wrapping a lower-level source which has some sort of +pause/resume mechanism, and a data callback. In those cases, you +could wrap the low-level source object by doing something like this: + +```None +// source is an object with readStop() and readStart() methods, +// and an `ondata` member that gets called when it has data, and +// an `onend` member that gets called when the data is over. + +util.inherits(SourceWrapper, Readable); + +function SourceWrapper(options) { + Readable.call(this, options); + + this._source = getLowlevelSourceObject(); + var self = this; + + // Every time there's data, we push it into the internal buffer. + this._source.ondata = function(chunk) { + // if push() returns false, then we need to stop reading from source + if (!self.push(chunk)) + self._source.readStop(); + }; + + // When the source ends, we push the EOF-signaling `null` chunk + this._source.onend = function() { + self.push(null); + }; +} + +// _read will be called when the stream wants to pull more data in +// the advisory size argument is ignored in this case. +SourceWrapper.prototype._read = function(size) { + this._source.readStart(); +}; +``` + +### Class: stream.Writable[#](#stream_class_stream_writable_1) + +`stream.Writable` is an abstract class designed to be extended with an +underlying implementation of the [`_write(chunk, encoding, callback)`](#stream_writable_write_chunk_encoding_callback_1) method. + +Please see above under [API for Stream Consumers](#stream_api_for_stream_consumers) for how to consume +writable streams in your programs. What follows is an explanation of +how to implement Writable streams in your programs. + +#### new stream.Writable([options])[#](#stream_new_stream_writable_options) + +* `options` Object + + `highWaterMark` Number Buffer level when [`write()`](#stream_writable_write_chunk_encoding_callback) starts + returning false. Default=16kb, or 16 for `objectMode` streams + + `decodeStrings` Boolean Whether or not to decode strings into + Buffers before passing them to [`_write()`](#stream_writable_write_chunk_encoding_callback_1). Default=true + + `objectMode` Boolean Whether or not the `write(anyObj)` is + a valid operation. If set you can write arbitrary data instead + of only `Buffer` / `String` data. Default=false + +In classes that extend the Writable class, make sure to call the +constructor so that the buffering settings can be properly +initialized. + +#### writable.\_write(chunk, encoding, callback)[#](#stream_writable_write_chunk_encoding_callback_1) + +* `chunk` Buffer | String The chunk to be written. Will always + be a buffer unless the `decodeStrings` option was set to `false`. +* `encoding` String If the chunk is a string, then this is the + encoding type. Ignore if chunk is a buffer. Note that chunk will + **always** be a buffer unless the `decodeStrings` option is + explicitly set to `false`. +* `callback` Function Call this function (optionally with an error + argument) when you are done processing the supplied chunk. + +All Writable stream implementations must provide a [`_write()`](#stream_writable_write_chunk_encoding_callback_1) +method to send data to the underlying resource. + +Note: **This function MUST NOT be called directly.** It should be +implemented by child classes, and called by the internal Writable +class methods only. + +Call the callback using the standard `callback(error)` pattern to +signal that the write completed successfully or with an error. + +If the `decodeStrings` flag is set in the constructor options, then +`chunk` may be a string rather than a Buffer, and `encoding` will +indicate the sort of string that it is. This is to support +implementations that have an optimized handling for certain string +data encodings. If you do not explicitly set the `decodeStrings` +option to `false`, then you can safely ignore the `encoding` argument, +and assume that `chunk` will always be a Buffer. + +This method is prefixed with an underscore because it is internal to +the class that defines it, and should not be called directly by user +programs. However, you **are** expected to override this method in +your own extension classes. + +### writable.\_writev(chunks, callback)[#](#stream_writable_writev_chunks_callback) + +* `chunks` Array The chunks to be written. Each chunk has following + format: `{ chunk: ..., encoding: ... }`. +* `callback` Function Call this function (optionally with an error + argument) when you are done processing the supplied chunks. + +Note: **This function MUST NOT be called directly.** It may be +implemented by child classes, and called by the internal Writable +class methods only. + +This function is completely optional to implement. In most cases it is +unnecessary. If implemented, it will be called with all the chunks +that are buffered in the write queue. + +### Class: stream.Duplex[#](#stream_class_stream_duplex_1) + +A "duplex" stream is one that is both Readable and Writable, such as a +TCP socket connection. + +Note that `stream.Duplex` is an abstract class designed to be extended +with an underlying implementation of the `_read(size)` and +[`_write(chunk, encoding, callback)`](#stream_writable_write_chunk_encoding_callback_1) methods as you would with a +Readable or Writable stream class. + +Since JavaScript doesn't have multiple prototypal inheritance, this +class prototypally inherits from Readable, and then parasitically from +Writable. It is thus up to the user to implement both the lowlevel +`_read(n)` method as well as the lowlevel +[`_write(chunk, encoding, callback)`](#stream_writable_write_chunk_encoding_callback_1) method on extension duplex classes. + +#### new stream.Duplex(options)[#](#stream_new_stream_duplex_options) + +* `options` Object Passed to both Writable and Readable + constructors. Also has the following fields: + + `allowHalfOpen` Boolean Default=true. If set to `false`, then + the stream will automatically end the readable side when the + writable side ends and vice versa. + + `readableObjectMode` Boolean Default=false. Sets `objectMode` + for readable side of the stream. Has no effect if `objectMode` + is `true`. + + `writableObjectMode` Boolean Default=false. Sets `objectMode` + for writable side of the stream. Has no effect if `objectMode` + is `true`. + +In classes that extend the Duplex class, make sure to call the +constructor so that the buffering settings can be properly +initialized. + +### Class: stream.Transform[#](#stream_class_stream_transform_1) + +A "transform" stream is a duplex stream where the output is causally +connected in some way to the input, such as a [zlib](zlib.html) stream or a +[crypto](crypto.html) stream. + +There is no requirement that the output be the same size as the input, +the same number of chunks, or arrive at the same time. For example, a +Hash stream will only ever have a single chunk of output which is +provided when the input is ended. A zlib stream will produce output +that is either much smaller or much larger than its input. + +Rather than implement the [`_read()`](#stream_readable_read_size_1) and [`_write()`](#stream_writable_write_chunk_encoding_callback_1) methods, Transform +classes must implement the `_transform()` method, and may optionally +also implement the `_flush()` method. (See below.) + +#### new stream.Transform([options])[#](#stream_new_stream_transform_options) + +* `options` Object Passed to both Writable and Readable + constructors. + +In classes that extend the Transform class, make sure to call the +constructor so that the buffering settings can be properly +initialized. + +#### transform.\_transform(chunk, encoding, callback)[#](#stream_transform_transform_chunk_encoding_callback) + +* `chunk` Buffer | String The chunk to be transformed. Will always + be a buffer unless the `decodeStrings` option was set to `false`. +* `encoding` String If the chunk is a string, then this is the + encoding type. (Ignore if `decodeStrings` chunk is a buffer.) +* `callback` Function Call this function (optionally with an error + argument and data) when you are done processing the supplied chunk. + +Note: **This function MUST NOT be called directly.** It should be +implemented by child classes, and called by the internal Transform +class methods only. + +All Transform stream implementations must provide a `_transform` +method to accept input and produce output. + +`_transform` should do whatever has to be done in this specific +Transform class, to handle the bytes being written, and pass them off +to the readable portion of the interface. Do asynchronous I/O, +process things, and so on. + +Call `transform.push(outputChunk)` 0 or more times to generate output +from this input chunk, depending on how much data you want to output +as a result of this chunk. + +Call the callback function only when the current chunk is completely +consumed. Note that there may or may not be output as a result of any +particular input chunk. If you supply as the second argument to the +it will be passed to push method, in other words the following are +equivalent: + +```None +transform.prototype._transform = function (data, encoding, callback) { + this.push(data); + callback(); +} + +transform.prototype._transform = function (data, encoding, callback) { + callback(null, data); +} +``` + +This method is prefixed with an underscore because it is internal to +the class that defines it, and should not be called directly by user +programs. However, you **are** expected to override this method in +your own extension classes. + +#### transform.\_flush(callback)[#](#stream_transform_flush_callback) + +* `callback` Function Call this function (optionally with an error + argument) when you are done flushing any remaining data. + +Note: **This function MUST NOT be called directly.** It MAY be implemented +by child classes, and if so, will be called by the internal Transform +class methods only. + +In some cases, your transform operation may need to emit a bit more +data at the end of the stream. For example, a `Zlib` compression +stream will store up some internal state so that it can optimally +compress the output. At the end, however, it needs to do the best it +can with what is left, so that the data will be complete. + +In those cases, you can implement a `_flush` method, which will be +called at the very end, after all the written data is consumed, but +before emitting `end` to signal the end of the readable side. Just +like with `_transform`, call `transform.push(chunk)` zero or more +times, as appropriate, and call `callback` when the flush operation is +complete. + +This method is prefixed with an underscore because it is internal to +the class that defines it, and should not be called directly by user +programs. However, you **are** expected to override this method in +your own extension classes. + +#### Events: 'finish' and 'end'[#](#stream_events_finish_and_end) + +The [`finish`](#stream_event_finish) and [`end`](#stream_event_end) events are from the parent Writable +and Readable classes respectively. The `finish` event is fired after +`.end()` is called and all chunks have been processed by `_transform`, +`end` is fired after all data has been output which is after the callback +in `_flush` has been called. + +#### Example: `SimpleProtocol` parser v2[#](#stream_example_simpleprotocol_parser_v2) + +The example above of a simple protocol parser can be implemented +simply by using the higher level [Transform](#stream_class_stream_transform) stream class, similar to +the `parseHeader` and `SimpleProtocol v1` examples above. + +In this example, rather than providing the input as an argument, it +would be piped into the parser, which is a more idiomatic Node stream +approach. + +```None +var util = require('util'); +var Transform = require('stream').Transform; +util.inherits(SimpleProtocol, Transform); + +function SimpleProtocol(options) { + if (!(this instanceof SimpleProtocol)) + return new SimpleProtocol(options); + + Transform.call(this, options); + this._inBody = false; + this._sawFirstCr = false; + this._rawHeader = []; + this.header = null; +} + +SimpleProtocol.prototype._transform = function(chunk, encoding, done) { + if (!this._inBody) { + // check if the chunk has a \n\n + var split = -1; + for (var i = 0; i < chunk.length; i++) { + if (chunk[i] === 10) { // '\n' + if (this._sawFirstCr) { + split = i; + break; + } else { + this._sawFirstCr = true; + } + } else { + this._sawFirstCr = false; + } + } + + if (split === -1) { + // still waiting for the \n\n + // stash the chunk, and try again. + this._rawHeader.push(chunk); + } else { + this._inBody = true; + var h = chunk.slice(0, split); + this._rawHeader.push(h); + var header = Buffer.concat(this._rawHeader).toString(); + try { + this.header = JSON.parse(header); + } catch (er) { + this.emit('error', new Error('invalid simple protocol data')); + return; + } + // and let them know that we are done parsing the header. + this.emit('header', this.header); + + // now, because we got some extra data, emit this first. + this.push(chunk.slice(split)); + } + } else { + // from there on, just provide the data to our consumer as-is. + this.push(chunk); + } + done(); +}; + +// Usage: +// var parser = new SimpleProtocol(); +// source.pipe(parser) +// Now parser is a readable stream that will emit 'header' +// with the parsed header data. +``` + +### Class: stream.PassThrough[#](#stream_class_stream_passthrough) + +This is a trivial implementation of a [Transform](#stream_class_stream_transform) stream that simply +passes the input bytes across to the output. Its purpose is mainly +for examples and testing, but there are occasionally use cases where +it can come in handy as a building block for novel sorts of streams. + +## Streams: Under the Hood[#](#stream_streams_under_the_hood) + +### Buffering[#](#stream_buffering) + +Both Writable and Readable streams will buffer data on an internal +object called `_writableState.buffer` or `_readableState.buffer`, +respectively. + +The amount of data that will potentially be buffered depends on the +`highWaterMark` option which is passed into the constructor. + +Buffering in Readable streams happens when the implementation calls +[`stream.push(chunk)`](#stream_readable_push_chunk_encoding). If the consumer of the Stream does not call +`stream.read()`, then the data will sit in the internal queue until it +is consumed. + +Buffering in Writable streams happens when the user calls +[`stream.write(chunk)`](#stream_writable_write_chunk_encoding_callback) repeatedly, even when `write()` returns `false`. + +The purpose of streams, especially with the `pipe()` method, is to +limit the buffering of data to acceptable levels, so that sources and +destinations of varying speed will not overwhelm the available memory. + +### `stream.read(0)`[#](#stream_stream_read_0) + +There are some cases where you want to trigger a refresh of the +underlying readable stream mechanisms, without actually consuming any +data. In that case, you can call `stream.read(0)`, which will always +return null. + +If the internal read buffer is below the `highWaterMark`, and the +stream is not currently reading, then calling `read(0)` will trigger +a low-level `_read` call. + +There is almost never a need to do this. However, you will see some +cases in Node's internals where this is done, particularly in the +Readable stream class internals. + +### `stream.push('')`[#](#stream_stream_push) + +Pushing a zero-byte string or Buffer (when not in [Object mode](#stream_object_mode)) has an +interesting side effect. Because it *is* a call to +[`stream.push()`](#stream_readable_push_chunk_encoding), it will end the `reading` process. However, it +does *not* add any data to the readable buffer, so there's nothing for +a user to consume. + +Very rarely, there are cases where you have no data to provide now, +but the consumer of your stream (or, perhaps, another bit of your own +code) will know when to check again, by calling `stream.read(0)`. In +those cases, you *may* call `stream.push('')`. + +So far, the only use case for this functionality is in the +[tls.CryptoStream](tls.html#tls_class_cryptostream) class, which is deprecated in Node v0.12. If you +find that you have to use `stream.push('')`, please consider another +approach, because it almost certainly indicates that something is +horribly wrong. + +### Compatibility with Older Node Versions[#](#stream_compatibility_with_older_node_versions) + +In versions of Node prior to v0.10, the Readable stream interface was +simpler, but also less powerful and less useful. + +* Rather than waiting for you to call the `read()` method, `'data'` + events would start emitting immediately. If you needed to do some + I/O to decide how to handle data, then you had to store the chunks + in some kind of buffer so that they would not be lost. +* The [`pause()`](#stream_readable_pause) method was advisory, rather than guaranteed. This + meant that you still had to be prepared to receive `'data'` events + even when the stream was in a paused state. + +In Node v0.10, the Readable class described below was added. For +backwards compatibility with older Node programs, Readable streams +switch into "flowing mode" when a `'data'` event handler is added, or +when the [`resume()`](#stream_readable_resume) method is called. The effect is that, even if +you are not using the new `read()` method and `'readable'` event, you +no longer have to worry about losing `'data'` chunks. + +Most programs will continue to function normally. However, this +introduces an edge case in the following conditions: + +* No [`'data'` event](#stream_event_data) handler is added. +* The [`resume()`](#stream_readable_resume) method is never called. +* The stream is not piped to any writable destination. + +For example, consider the following code: + +```None +// WARNING! BROKEN! +net.createServer(function(socket) { + + // we add an 'end' method, but never consume the data + socket.on('end', function() { + // It will never get here. + socket.end('I got your message (but didnt read it)\n'); + }); + +}).listen(1337); +``` + +In versions of node prior to v0.10, the incoming message data would be +simply discarded. However, in Node v0.10 and beyond, the socket will +remain paused forever. + +The workaround in this situation is to call the `resume()` method to +start the flow of data: + +```None +// Workaround +net.createServer(function(socket) { + + socket.on('end', function() { + socket.end('I got your message (but didnt read it)\n'); + }); + + // start the flow of data, discarding it. + socket.resume(); + +}).listen(1337); +``` + +In addition to new Readable streams switching into flowing mode, +pre-v0.10 style streams can be wrapped in a Readable class using the +`wrap()` method. + +### Object Mode[#](#stream_object_mode) + +Normally, Streams operate on Strings and Buffers exclusively. + +Streams that are in **object mode** can emit generic JavaScript values +other than Buffers and Strings. + +A Readable stream in object mode will always return a single item from +a call to `stream.read(size)`, regardless of what the size argument +is. + +A Writable stream in object mode will always ignore the `encoding` +argument to `stream.write(data, encoding)`. + +The special value `null` still retains its special value for object +mode streams. That is, for object mode readable streams, `null` as a +return value from `stream.read()` indicates that there is no more +data, and [`stream.push(null)`](#stream_readable_push_chunk_encoding) will signal the end of stream data +(`EOF`). + +No streams in Node core are object mode streams. This pattern is only +used by userland streaming libraries. + +You should set `objectMode` in your stream child class constructor on +the options object. Setting `objectMode` mid-stream is not safe. + +For Duplex streams `objectMode` can be set exclusively for readable or +writable side with `readableObjectMode` and `writableObjectMode` +respectively. These options can be used to implement parsers and +serializers with Transform streams. + +```None +var util = require('util'); +var StringDecoder = require('string_decoder').StringDecoder; +var Transform = require('stream').Transform; +util.inherits(JSONParseStream, Transform); + +// Gets \n-delimited JSON string data, and emits the parsed objects +function JSONParseStream() { + if (!(this instanceof JSONParseStream)) + return new JSONParseStream(); + + Transform.call(this, { readableObjectMode : true }); + + this._buffer = ''; + this._decoder = new StringDecoder('utf8'); +} + +JSONParseStream.prototype._transform = function(chunk, encoding, cb) { + this._buffer += this._decoder.write(chunk); + // split on newlines + var lines = this._buffer.split(/\r?\n/); + // keep the last partial line buffered + this._buffer = lines.pop(); + for (var l = 0; l < lines.length; l++) { + var line = lines[l]; + try { + var obj = JSON.parse(line); + } catch (er) { + this.emit('error', er); + return; + } + // push the parsed object out to the readable consumer + this.push(obj); + } + cb(); +}; + +JSONParseStream.prototype._flush = function(cb) { + // Just handle any leftover + var rem = this._buffer.trim(); + if (rem) { + try { + var obj = JSON.parse(rem); + } catch (er) { + this.emit('error', er); + return; + } + // push the parsed object out to the readable consumer + this.push(obj); + } + cb(); +}; +``` diff --git a/corpus/docs/nodejs/stream/stream_10x.md b/corpus/docs/nodejs/stream/stream_10x.md new file mode 100644 index 0000000000000000000000000000000000000000..6ddebdef425c491d24ac95ded86ea8516bdc490b --- /dev/null +++ b/corpus/docs/nodejs/stream/stream_10x.md @@ -0,0 +1,2522 @@ +# Stream[src]# + +Source: https://nodejs.org/docs/latest-v10.x/api/stream.html +Version: 10.x + +[Stability: 2](documentation.html#documentation_stability_index) - Stable + +A stream is an abstract interface for working with streaming data in Node.js. +The `stream` module provides a base API that makes it easy to build objects +that implement the stream interface. + +There are many stream objects provided by Node.js. For instance, a +[request to an HTTP server](http.html#http_class_http_incomingmessage) and [`process.stdout`](process.html#process_process_stdout) +are both stream instances. + +Streams can be readable, writable, or both. All streams are instances of +[`EventEmitter`](events.html#events_class_eventemitter). + +The `stream` module can be accessed using: + +```None +const stream = require('stream'); +``` + +While it is important to understand how streams work, the `stream` module itself +is most useful for developers that are creating new types of stream instances. +Developers who are primarily *consuming* stream objects will rarely need to use +the `stream` module directly. + +## Organization of this Document[#](#stream_organization_of_this_document) + +This document is divided into two primary sections with a third section for +additional notes. The first section explains the elements of the stream API that +are required to *use* streams within an application. The second section explains +the elements of the API that are required to *implement* new types of streams. + +## Types of Streams[#](#stream_types_of_streams) + +There are four fundamental stream types within Node.js: + +* [`Writable`](#stream_class_stream_writable) - streams to which data can be written (for example, + [`fs.createWriteStream()`](fs.html#fs_fs_createwritestream_path_options)). +* [`Readable`](#stream_class_stream_readable) - streams from which data can be read (for example, + [`fs.createReadStream()`](fs.html#fs_fs_createreadstream_path_options)). +* [`Duplex`](#stream_class_stream_duplex) - streams that are both `Readable` and `Writable` (for example, + [`net.Socket`](net.html#net_class_net_socket)). +* [`Transform`](#stream_class_stream_transform) - `Duplex` streams that can modify or transform the data as it + is written and read (for example, [`zlib.createDeflate()`](zlib.html#zlib_zlib_createdeflate_options)). + +Additionally, this module includes the utility functions [pipeline](#stream_stream_pipeline_streams_callback), +[finished](#stream_stream_finished_stream_callback) and [Readable.from](#readable.from). + +### Object Mode[#](#stream_object_mode) + +All streams created by Node.js APIs operate exclusively on strings and `Buffer` +(or `Uint8Array`) objects. It is possible, however, for stream implementations +to work with other types of JavaScript values (with the exception of `null`, +which serves a special purpose within streams). Such streams are considered to +operate in "object mode". + +Stream instances are switched into object mode using the `objectMode` option +when the stream is created. Attempting to switch an existing stream into +object mode is not safe. + +### Buffering[#](#stream_buffering) + +Both [`Writable`](#stream_class_stream_writable) and [`Readable`](#stream_class_stream_readable) streams will store data in an internal +buffer that can be retrieved using `writable.writableBuffer` or +`readable.readableBuffer`, respectively. + +The amount of data potentially buffered depends on the `highWaterMark` option +passed into the stream's constructor. For normal streams, the `highWaterMark` +option specifies a [total number of bytes](#stream_highwatermark_discrepancy_after_calling_readable_setencoding). For streams operating +in object mode, the `highWaterMark` specifies a total number of objects. + +Data is buffered in `Readable` streams when the implementation calls +[`stream.push(chunk)`](#stream_readable_push_chunk_encoding). If the consumer of the Stream does not +call [`stream.read()`](#stream_readable_read_size), the data will sit in the internal +queue until it is consumed. + +Once the total size of the internal read buffer reaches the threshold specified +by `highWaterMark`, the stream will temporarily stop reading data from the +underlying resource until the data currently buffered can be consumed (that is, +the stream will stop calling the internal `readable._read()` method that is +used to fill the read buffer). + +Data is buffered in `Writable` streams when the +[`writable.write(chunk)`](#stream_writable_write_chunk_encoding_callback) method is called repeatedly. While the +total size of the internal write buffer is below the threshold set by +`highWaterMark`, calls to `writable.write()` will return `true`. Once +the size of the internal buffer reaches or exceeds the `highWaterMark`, `false` +will be returned. + +A key goal of the `stream` API, particularly the [`stream.pipe()`](#stream_readable_pipe_destination_options) method, +is to limit the buffering of data to acceptable levels such that sources and +destinations of differing speeds will not overwhelm the available memory. + +Because [`Duplex`](#stream_class_stream_duplex) and [`Transform`](#stream_class_stream_transform) streams are both `Readable` and +`Writable`, each maintains *two* separate internal buffers used for reading and +writing, allowing each side to operate independently of the other while +maintaining an appropriate and efficient flow of data. For example, +[`net.Socket`](net.html#net_class_net_socket) instances are [`Duplex`](#stream_class_stream_duplex) streams whose `Readable` side allows +consumption of data received *from* the socket and whose `Writable` side allows +writing data *to* the socket. Because data may be written to the socket at a +faster or slower rate than data is received, it is important for each side to +operate (and buffer) independently of the other. + +## API for Stream Consumers[#](#stream_api_for_stream_consumers) + +Almost all Node.js applications, no matter how simple, use streams in some +manner. The following is an example of using streams in a Node.js application +that implements an HTTP server: + +```None +const http = require('http'); + +const server = http.createServer((req, res) => { + // req is an http.IncomingMessage, which is a Readable Stream + // res is an http.ServerResponse, which is a Writable Stream + + let body = ''; + // Get the data as utf8 strings. + // If an encoding is not set, Buffer objects will be received. + req.setEncoding('utf8'); + + // Readable streams emit 'data' events once a listener is added + req.on('data', (chunk) => { + body += chunk; + }); + + // the 'end' event indicates that the entire body has been received + req.on('end', () => { + try { + const data = JSON.parse(body); + // write back something interesting to the user: + res.write(typeof data); + res.end(); + } catch (er) { + // uh oh! bad json! + res.statusCode = 400; + return res.end(`error: ${er.message}`); + } + }); +}); + +server.listen(1337); + +// $ curl localhost:1337 -d "{}" +// object +// $ curl localhost:1337 -d "\"foo\"" +// string +// $ curl localhost:1337 -d "not json" +// error: Unexpected token o in JSON at position 1 +``` + +[`Writable`](#stream_class_stream_writable) streams (such as `res` in the example) expose methods such as +`write()` and `end()` that are used to write data onto the stream. + +[`Readable`](#stream_class_stream_readable) streams use the [`EventEmitter`](events.html#events_class_eventemitter) API for notifying application +code when data is available to be read off the stream. That available data can +be read from the stream in multiple ways. + +Both [`Writable`](#stream_class_stream_writable) and [`Readable`](#stream_class_stream_readable) streams use the [`EventEmitter`](events.html#events_class_eventemitter) API in +various ways to communicate the current state of the stream. + +[`Duplex`](#stream_class_stream_duplex) and [`Transform`](#stream_class_stream_transform) streams are both [`Writable`](#stream_class_stream_writable) and +[`Readable`](#stream_class_stream_readable). + +Applications that are either writing data to or consuming data from a stream +are not required to implement the stream interfaces directly and will generally +have no reason to call `require('stream')`. + +Developers wishing to implement new types of streams should refer to the +section [API for Stream Implementers](#stream_api_for_stream_implementers). + +### Writable Streams[#](#stream_writable_streams) + +Writable streams are an abstraction for a *destination* to which data is +written. + +Examples of [`Writable`](#stream_class_stream_writable) streams include: + +* [HTTP requests, on the client](http.html#http_class_http_clientrequest) +* [HTTP responses, on the server](http.html#http_class_http_serverresponse) +* [fs write streams](fs.html#fs_class_fs_writestream) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) +* [TCP sockets](net.html#net_class_net_socket) +* [child process stdin](child_process.html#child_process_subprocess_stdin) +* [`process.stdout`](process.html#process_process_stdout), [`process.stderr`](process.html#process_process_stderr) + +Some of these examples are actually [`Duplex`](#stream_class_stream_duplex) streams that implement the +[`Writable`](#stream_class_stream_writable) interface. + +All [`Writable`](#stream_class_stream_writable) streams implement the interface defined by the +`stream.Writable` class. + +While specific instances of [`Writable`](#stream_class_stream_writable) streams may differ in various ways, +all `Writable` streams follow the same fundamental usage pattern as illustrated +in the example below: + +```None +const myStream = getWritableStreamSomehow(); +myStream.write('some data'); +myStream.write('some more data'); +myStream.end('done writing data'); +``` + +#### Class: stream.Writable[#](#stream_class_stream_writable) + +Added in: v0.9.4 + +##### Event: 'close'[#](#stream_event_close) + +History + +| Version | Changes | +| --- | --- | +| v10.0.0 | Add `emitClose` option to specify if `'close'` is emitted on destroy. | +| v0.9.4 | Added in: v0.9.4 | + +The `'close'` event is emitted when the stream and any of its underlying +resources (a file descriptor, for example) have been closed. The event indicates +that no more events will be emitted, and no further computation will occur. + +A [`Writable`](#stream_class_stream_writable) stream will always emit the `'close'` event if it is +created with the `emitClose` option. + +##### Event: 'drain'[#](#stream_event_drain) + +Added in: v0.9.4 + +If a call to [`stream.write(chunk)`](#stream_writable_write_chunk_encoding_callback) returns `false`, the +`'drain'` event will be emitted when it is appropriate to resume writing data +to the stream. + +```None +// Write the data to the supplied writable stream one million times. +// Be attentive to back-pressure. +function writeOneMillionTimes(writer, data, encoding, callback) { + let i = 1000000; + write(); + function write() { + let ok = true; + do { + i--; + if (i === 0) { + // last time! + writer.write(data, encoding, callback); + } else { + // see if we should continue, or wait + // don't pass the callback, because we're not done yet. + ok = writer.write(data, encoding); + } + } while (i > 0 && ok); + if (i > 0) { + // had to stop early! + // write some more once it drains + writer.once('drain', write); + } + } +} +``` + +##### Event: 'error'[#](#stream_event_error) + +Added in: v0.9.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + +The `'error'` event is emitted if an error occurred while writing or piping +data. The listener callback is passed a single `Error` argument when called. + +The stream is not closed when the `'error'` event is emitted. + +##### Event: 'finish'[#](#stream_event_finish) + +Added in: v0.9.4 + +The `'finish'` event is emitted after the [`stream.end()`](#stream_writable_end_chunk_encoding_callback) method +has been called, and all data has been flushed to the underlying system. + +```None +const writer = getWritableStreamSomehow(); +for (let i = 0; i < 100; i++) { + writer.write(`hello, #${i}!\n`); +} +writer.end('This is the end\n'); +writer.on('finish', () => { + console.log('All writes are now complete.'); +}); +``` + +##### Event: 'pipe'[#](#stream_event_pipe) + +Added in: v0.9.4 + +* `src` [](stream.html#stream_class_stream_readable) source stream that is piping to this writable + +The `'pipe'` event is emitted when the [`stream.pipe()`](#stream_readable_pipe_destination_options) method is called on +a readable stream, adding this writable to its set of destinations. + +```None +const writer = getWritableStreamSomehow(); +const reader = getReadableStreamSomehow(); +writer.on('pipe', (src) => { + console.log('Something is piping into the writer.'); + assert.equal(src, reader); +}); +reader.pipe(writer); +``` + +##### Event: 'unpipe'[#](#stream_event_unpipe) + +Added in: v0.9.4 + +* `src` [](stream.html#stream_class_stream_readable) The source stream that + [unpiped](#stream_readable_unpipe_destination) this writable + +The `'unpipe'` event is emitted when the [`stream.unpipe()`](#stream_readable_unpipe_destination) method is called +on a [`Readable`](#stream_class_stream_readable) stream, removing this [`Writable`](#stream_class_stream_writable) from its set of +destinations. + +This is also emitted in case this [`Writable`](#stream_class_stream_writable) stream emits an error when a +[`Readable`](#stream_class_stream_readable) stream pipes into it. + +```None +const writer = getWritableStreamSomehow(); +const reader = getReadableStreamSomehow(); +writer.on('unpipe', (src) => { + console.log('Something has stopped piping into the writer.'); + assert.equal(src, reader); +}); +reader.pipe(writer); +reader.unpipe(writer); +``` + +##### writable.cork()[#](#stream_writable_cork) + +Added in: v0.11.2 + +The `writable.cork()` method forces all written data to be buffered in memory. +The buffered data will be flushed when either the [`stream.uncork()`](#stream_writable_uncork) or +[`stream.end()`](#stream_writable_end_chunk_encoding_callback) methods are called. + +The primary intent of `writable.cork()` is to avoid a situation where writing +many small chunks of data to a stream do not cause a backup in the internal +buffer that would have an adverse impact on performance. In such situations, +implementations that implement the `writable._writev()` method can perform +buffered writes in a more optimized manner. + +See also: [`writable.uncork()`](#stream_writable_uncork). + +##### writable.destroy([error])[#](#stream_writable_destroy_error) + +Added in: v8.0.0 + +* `error` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +Destroy the stream, and emit the passed `'error'` and a `'close'` event. +After this call, the writable stream has ended and subsequent calls +to `write()` or `end()` will result in an `ERR_STREAM_DESTROYED` error. +Implementors should not override this method, +but instead implement [`writable._destroy()`](#stream_writable_destroy_err_callback). + +##### writable.end([chunk][, encoding][, callback])[#](#stream_writable_end_chunk_encoding_callback) + +History + +| Version | Changes | +| --- | --- | +| v10.0.0 | This method now returns a reference to `writable`. | +| v8.0.0 | The `chunk` argument can now be a `Uint8Array` instance. | +| v0.9.4 | Added in: v0.9.4 | + +* `chunk` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) Optional data to write. For streams + not operating in object mode, `chunk` must be a string, `Buffer` or + `Uint8Array`. For object mode streams, `chunk` may be any JavaScript value + other than `null`. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding if `chunk` is a string +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Optional callback for when the stream is finished +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +Calling the `writable.end()` method signals that no more data will be written +to the [`Writable`](#stream_class_stream_writable). The optional `chunk` and `encoding` arguments allow one +final additional chunk of data to be written immediately before closing the +stream. If provided, the optional `callback` function is attached as a listener +for the [`'finish'`](#stream_event_finish) event. + +Calling the [`stream.write()`](#stream_writable_write_chunk_encoding_callback) method after calling +[`stream.end()`](#stream_writable_end_chunk_encoding_callback) will raise an error. + +```None +// write 'hello, ' and then end with 'world!' +const fs = require('fs'); +const file = fs.createWriteStream('example.txt'); +file.write('hello, '); +file.end('world!'); +// writing more now is not allowed! +``` + +##### writable.setDefaultEncoding(encoding)[#](#stream_writable_setdefaultencoding_encoding) + +History + +| Version | Changes | +| --- | --- | +| v6.1.0 | This method now returns a reference to `writable`. | +| v0.11.15 | Added in: v0.11.15 | + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The new default encoding +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `writable.setDefaultEncoding()` method sets the default `encoding` for a +[`Writable`](#stream_class_stream_writable) stream. + +##### writable.uncork()[#](#stream_writable_uncork) + +Added in: v0.11.2 + +The `writable.uncork()` method flushes all data buffered since +[`stream.cork()`](#stream_writable_cork) was called. + +When using [`writable.cork()`](#stream_writable_cork) and `writable.uncork()` to manage the buffering +of writes to a stream, it is recommended that calls to `writable.uncork()` be +deferred using `process.nextTick()`. Doing so allows batching of all +`writable.write()` calls that occur within a given Node.js event loop phase. + +```None +stream.cork(); +stream.write('some '); +stream.write('data '); +process.nextTick(() => stream.uncork()); +``` + +If the [`writable.cork()`](#stream_writable_cork) method is called multiple times on a stream, the +same number of calls to `writable.uncork()` must be called to flush the buffered +data. + +```None +stream.cork(); +stream.write('some '); +stream.cork(); +stream.write('data '); +process.nextTick(() => { + stream.uncork(); + // The data will not be flushed until uncork() is called a second time. + stream.uncork(); +}); +``` + +See also: [`writable.cork()`](#stream_writable_cork). + +##### writable.writable[#](#stream_writable_writable) + +Added in: v0.8.0 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +Is `true` if it is safe to call [`writable.write()`][]. + +##### writable.writableHighWaterMark[#](#stream_writable_writablehighwatermark) + +Added in: v9.3.0 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Return the value of `highWaterMark` passed when constructing this +`Writable`. + +##### writable.writableLength[#](#stream_writable_writablelength) + +Added in: v9.4.0 + +This property contains the number of bytes (or objects) in the queue +ready to be written. The value provides introspection data regarding +the status of the `highWaterMark`. + +##### writable.write(chunk[, encoding][, callback])[#](#stream_writable_write_chunk_encoding_callback) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `chunk` argument can now be a `Uint8Array` instance. | +| v6.0.0 | Passing `null` as the `chunk` parameter will always be considered invalid now, even in object mode. | +| v0.9.4 | Added in: v0.9.4 | + +* `chunk` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) Optional data to write. For streams + not operating in object mode, `chunk` must be a string, `Buffer` or + `Uint8Array`. For object mode streams, `chunk` may be any JavaScript value + other than `null`. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding, if `chunk` is a string +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Callback for when this chunk of data is flushed +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `false` if the stream wishes for the calling code to + wait for the `'drain'` event to be emitted before continuing to write + additional data; otherwise `true`. + +The `writable.write()` method writes some data to the stream, and calls the +supplied `callback` once the data has been fully handled. If an error +occurs, the `callback` *may or may not* be called with the error as its +first argument. To reliably detect write errors, add a listener for the +`'error'` event. + +The return value is `true` if the internal buffer is less than the +`highWaterMark` configured when the stream was created after admitting `chunk`. +If `false` is returned, further attempts to write data to the stream should +stop until the [`'drain'`](#stream_event_drain) event is emitted. + +While a stream is not draining, calls to `write()` will buffer `chunk`, and +return false. Once all currently buffered chunks are drained (accepted for +delivery by the operating system), the `'drain'` event will be emitted. +It is recommended that once `write()` returns false, no more chunks be written +until the `'drain'` event is emitted. While calling `write()` on a stream that +is not draining is allowed, Node.js will buffer all written chunks until +maximum memory usage occurs, at which point it will abort unconditionally. +Even before it aborts, high memory usage will cause poor garbage collector +performance and high RSS (which is not typically released back to the system, +even after the memory is no longer required). Since TCP sockets may never +drain if the remote peer does not read the data, writing a socket that is +not draining may lead to a remotely exploitable vulnerability. + +Writing data while the stream is not draining is particularly +problematic for a [`Transform`](#stream_class_stream_transform), because the `Transform` streams are paused +by default until they are piped or a `'data'` or `'readable'` event handler +is added. + +If the data to be written can be generated or fetched on demand, it is +recommended to encapsulate the logic into a [`Readable`](#stream_class_stream_readable) and use +[`stream.pipe()`](#stream_readable_pipe_destination_options). However, if calling `write()` is preferred, it is +possible to respect backpressure and avoid memory issues using the +[`'drain'`](#stream_event_drain) event: + +```None +function write(data, cb) { + if (!stream.write(data)) { + stream.once('drain', cb); + } else { + process.nextTick(cb); + } +} + +// Wait for cb to be called before doing any other write. +write('hello', () => { + console.log('Write completed, do more writes now.'); +}); +``` + +A `Writable` stream in object mode will always ignore the `encoding` argument. + +### Readable Streams[#](#stream_readable_streams) + +Readable streams are an abstraction for a *source* from which data is +consumed. + +Examples of `Readable` streams include: + +* [HTTP responses, on the client](http.html#http_class_http_incomingmessage) +* [HTTP requests, on the server](http.html#http_class_http_incomingmessage) +* [fs read streams](fs.html#fs_class_fs_readstream) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) +* [TCP sockets](net.html#net_class_net_socket) +* [child process stdout and stderr](child_process.html#child_process_subprocess_stdout) +* [`process.stdin`](process.html#process_process_stdin) + +All [`Readable`](#stream_class_stream_readable) streams implement the interface defined by the +`stream.Readable` class. + +#### Two Reading Modes[#](#stream_two_reading_modes) + +`Readable` streams effectively operate in one of two modes: flowing and +paused. These modes are separate from [object mode](#stream_object_mode). +A [`Readable`](#stream_class_stream_readable) stream can be in object mode or not, regardless of whether +it is in flowing mode or paused mode. + +* In flowing mode, data is read from the underlying system automatically + and provided to an application as quickly as possible using events via the + [`EventEmitter`](events.html#events_class_eventemitter) interface. +* In paused mode, the [`stream.read()`](#stream_readable_read_size) method must be called + explicitly to read chunks of data from the stream. + +All [`Readable`](#stream_class_stream_readable) streams begin in paused mode but can be switched to flowing +mode in one of the following ways: + +* Adding a [`'data'`](#stream_event_data) event handler. +* Calling the [`stream.resume()`](#stream_readable_resume) method. +* Calling the [`stream.pipe()`](#stream_readable_pipe_destination_options) method to send the data to a [`Writable`](#stream_class_stream_writable). + +The `Readable` can switch back to paused mode using one of the following: + +* If there are no pipe destinations, by calling the + [`stream.pause()`](#stream_readable_pause) method. +* If there are pipe destinations, by removing all pipe destinations. + Multiple pipe destinations may be removed by calling the + [`stream.unpipe()`](#stream_readable_unpipe_destination) method. + +The important concept to remember is that a `Readable` will not generate data +until a mechanism for either consuming or ignoring that data is provided. If +the consuming mechanism is disabled or taken away, the `Readable` will *attempt* +to stop generating the data. + +For backward compatibility reasons, removing [`'data'`](#stream_event_data) event handlers will +**not** automatically pause the stream. Also, if there are piped destinations, +then calling [`stream.pause()`](#stream_readable_pause) will not guarantee that the +stream will *remain* paused once those destinations drain and ask for more data. + +If a [`Readable`](#stream_class_stream_readable) is switched into flowing mode and there are no consumers +available to handle the data, that data will be lost. This can occur, for +instance, when the `readable.resume()` method is called without a listener +attached to the `'data'` event, or when a `'data'` event handler is removed +from the stream. + +Adding a [`'readable'`](#stream_event_readable) event handler automatically make the stream to +stop flowing, and the data to be consumed via +[`readable.read()`](#stream_readable_read_size). If the [`'readable'`](#stream_event_readable) event handler is +removed, then the stream will start flowing again if there is a +[`'data'`](#stream_event_data) event handler. + +#### Three States[#](#stream_three_states) + +The "two modes" of operation for a `Readable` stream are a simplified +abstraction for the more complicated internal state management that is happening +within the `Readable` stream implementation. + +Specifically, at any given point in time, every `Readable` is in one of three +possible states: + +* `readable.readableFlowing === null` +* `readable.readableFlowing === false` +* `readable.readableFlowing === true` + +When `readable.readableFlowing` is `null`, no mechanism for consuming the +stream's data is provided. Therefore, the stream will not generate data. +While in this state, attaching a listener for the `'data'` event, calling the +`readable.pipe()` method, or calling the `readable.resume()` method will switch +`readable.readableFlowing` to `true`, causing the `Readable` to begin actively +emitting events as data is generated. + +Calling `readable.pause()`, `readable.unpipe()`, or receiving backpressure +will cause the `readable.readableFlowing` to be set as `false`, +temporarily halting the flowing of events but *not* halting the generation of +data. While in this state, attaching a listener for the `'data'` event +will not switch `readable.readableFlowing` to `true`. + +```None +const { PassThrough, Writable } = require('stream'); +const pass = new PassThrough(); +const writable = new Writable(); + +pass.pipe(writable); +pass.unpipe(writable); +// readableFlowing is now false + +pass.on('data', (chunk) => { console.log(chunk.toString()); }); +pass.write('ok'); // will not emit 'data' +pass.resume(); // must be called to make stream emit 'data' +``` + +While `readable.readableFlowing` is `false`, data may be accumulating +within the stream's internal buffer. + +#### Choose One API Style[#](#stream_choose_one_api_style) + +The `Readable` stream API evolved across multiple Node.js versions and provides +multiple methods of consuming stream data. In general, developers should choose +*one* of the methods of consuming data and *should never* use multiple methods +to consume data from a single stream. Specifically, using a combination +of `on('data')`, `on('readable')`, `pipe()`, or async iterators could +lead to unintuitive behavior. + +Use of the `readable.pipe()` method is recommended for most users as it has been +implemented to provide the easiest way of consuming stream data. Developers that +require more fine-grained control over the transfer and generation of data can +use the [`EventEmitter`](events.html#events_class_eventemitter) and `readable.on('readable')`/`readable.read()` +or the `readable.pause()`/`readable.resume()` APIs. + +#### Class: stream.Readable[#](#stream_class_stream_readable) + +Added in: v0.9.4 + +##### Event: 'close'[#](#stream_event_close_1) + +History + +| Version | Changes | +| --- | --- | +| v10.0.0 | Add `emitClose` option to specify if `'close'` is emitted on destroy. | +| v0.9.4 | Added in: v0.9.4 | + +The `'close'` event is emitted when the stream and any of its underlying +resources (a file descriptor, for example) have been closed. The event indicates +that no more events will be emitted, and no further computation will occur. + +A [`Readable`](#stream_class_stream_readable) stream will always emit the `'close'` event if it is +created with the `emitClose` option. + +##### Event: 'data'[#](#stream_event_data) + +Added in: v0.9.4 + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) The chunk of data. For streams that are not + operating in object mode, the chunk will be either a string or `Buffer`. + For streams that are in object mode, the chunk can be any JavaScript value + other than `null`. + +The `'data'` event is emitted whenever the stream is relinquishing ownership of +a chunk of data to a consumer. This may occur whenever the stream is switched +in flowing mode by calling `readable.pipe()`, `readable.resume()`, or by +attaching a listener callback to the `'data'` event. The `'data'` event will +also be emitted whenever the `readable.read()` method is called and a chunk of +data is available to be returned. + +Attaching a `'data'` event listener to a stream that has not been explicitly +paused will switch the stream into flowing mode. Data will then be passed as +soon as it is available. + +The listener callback will be passed the chunk of data as a string if a default +encoding has been specified for the stream using the +`readable.setEncoding()` method; otherwise the data will be passed as a +`Buffer`. + +```None +const readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log(`Received ${chunk.length} bytes of data.`); +}); +``` + +##### Event: 'end'[#](#stream_event_end) + +Added in: v0.9.4 + +The `'end'` event is emitted when there is no more data to be consumed from +the stream. + +The `'end'` event **will not be emitted** unless the data is completely +consumed. This can be accomplished by switching the stream into flowing mode, +or by calling [`stream.read()`](#stream_readable_read_size) repeatedly until all data has been +consumed. + +```None +const readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log(`Received ${chunk.length} bytes of data.`); +}); +readable.on('end', () => { + console.log('There will be no more data.'); +}); +``` + +##### Event: 'error'[#](#stream_event_error_1) + +Added in: v0.9.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + +The `'error'` event may be emitted by a `Readable` implementation at any time. +Typically, this may occur if the underlying stream is unable to generate data +due to an underlying internal failure, or when a stream implementation attempts +to push an invalid chunk of data. + +The listener callback will be passed a single `Error` object. + +##### Event: 'readable'[#](#stream_event_readable) + +History + +| Version | Changes | +| --- | --- | +| v10.0.0 | The `'readable'` is always emitted in the next tick after `.push()` is called | +| v10.0.0 | Using `'readable'` requires calling `.read()`. | +| v0.9.4 | Added in: v0.9.4 | + +The `'readable'` event is emitted when there is data available to be read from +the stream. In some cases, attaching a listener for the `'readable'` event will +cause some amount of data to be read into an internal buffer. + +```None +const readable = getReadableStreamSomehow(); +readable.on('readable', function() { + // there is some data to read now + let data; + + while (data = this.read()) { + console.log(data); + } +}); +``` + +The `'readable'` event will also be emitted once the end of the stream data +has been reached but before the `'end'` event is emitted. + +Effectively, the `'readable'` event indicates that the stream has new +information: either new data is available or the end of the stream has been +reached. In the former case, [`stream.read()`](#stream_readable_read_size) will return the +available data. In the latter case, [`stream.read()`](#stream_readable_read_size) will return +`null`. For instance, in the following example, `foo.txt` is an empty file: + +```None +const fs = require('fs'); +const rr = fs.createReadStream('foo.txt'); +rr.on('readable', () => { + console.log(`readable: ${rr.read()}`); +}); +rr.on('end', () => { + console.log('end'); +}); +``` + +The output of running this script is: + +```None +$ node test.js +readable: null +end +``` + +In general, the `readable.pipe()` and `'data'` event mechanisms are easier to +understand than the `'readable'` event. However, handling `'readable'` might +result in increased throughput. + +If both `'readable'` and [`'data'`](#stream_event_data) are used at the same time, `'readable'` +takes precedence in controlling the flow, i.e. `'data'` will be emitted +only when [`stream.read()`](#stream_readable_read_size) is called. The +`readableFlowing` property would become `false`. +If there are `'data'` listeners when `'readable'` is removed, the stream +will start flowing, i.e. `'data'` events will be emitted without calling +`.resume()`. + +##### readable.destroy([error])[#](#stream_readable_destroy_error) + +Added in: v8.0.0 + +* `error` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) Error which will be passed as payload in `'error'` event +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +Destroy the stream, and emit `'error'` and `'close'`. After this call, the +readable stream will release any internal resources and subsequent calls +to `push()` will be ignored. +Implementors should not override this method, but instead implement +[`readable._destroy()`](#stream_readable_destroy_err_callback). + +##### readable.isPaused()[#](#stream_readable_ispaused) + +Added in: v0.11.14 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +The `readable.isPaused()` method returns the current operating state of the +`Readable`. This is used primarily by the mechanism that underlies the +`readable.pipe()` method. In most typical cases, there will be no reason to +use this method directly. + +```None +const readable = new stream.Readable(); + +readable.isPaused(); // === false +readable.pause(); +readable.isPaused(); // === true +readable.resume(); +readable.isPaused(); // === false +``` + +##### readable.pause()[#](#stream_readable_pause) + +Added in: v0.9.4 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `readable.pause()` method will cause a stream in flowing mode to stop +emitting [`'data'`](#stream_event_data) events, switching out of flowing mode. Any data that +becomes available will remain in the internal buffer. + +```None +const readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log(`Received ${chunk.length} bytes of data.`); + readable.pause(); + console.log('There will be no additional data for 1 second.'); + setTimeout(() => { + console.log('Now data will start flowing again.'); + readable.resume(); + }, 1000); +}); +``` + +The `readable.pause()` method has no effect if there is a `'readable'` +event listener. + +##### readable.pipe(destination[, options])[#](#stream_readable_pipe_destination_options) + +Added in: v0.9.4 + +* `destination` [](stream.html#stream_class_stream_writable) The destination for writing data +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Pipe options + + + `end` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) End the writer when the reader ends. **Default:** `true`. +* Returns: [](stream.html#stream_class_stream_writable) The *destination*, allowing for a chain of pipes if + it is a [`Duplex`](#stream_class_stream_duplex) or a [`Transform`](#stream_class_stream_transform) stream + +The `readable.pipe()` method attaches a [`Writable`](#stream_class_stream_writable) stream to the `readable`, +causing it to switch automatically into flowing mode and push all of its data +to the attached [`Writable`](#stream_class_stream_writable). The flow of data will be automatically managed +so that the destination `Writable` stream is not overwhelmed by a faster +`Readable` stream. + +The following example pipes all of the data from the `readable` into a file +named `file.txt`: + +```None +const fs = require('fs'); +const readable = getReadableStreamSomehow(); +const writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt' +readable.pipe(writable); +``` + +It is possible to attach multiple `Writable` streams to a single `Readable` +stream. + +The `readable.pipe()` method returns a reference to the *destination* stream +making it possible to set up chains of piped streams: + +```None +const fs = require('fs'); +const r = fs.createReadStream('file.txt'); +const z = zlib.createGzip(); +const w = fs.createWriteStream('file.txt.gz'); +r.pipe(z).pipe(w); +``` + +By default, [`stream.end()`](#stream_writable_end_chunk_encoding_callback) is called on the destination `Writable` +stream when the source `Readable` stream emits [`'end'`](#stream_event_end), so that the +destination is no longer writable. To disable this default behavior, the `end` +option can be passed as `false`, causing the destination stream to remain open: + +```None +reader.pipe(writer, { end: false }); +reader.on('end', () => { + writer.end('Goodbye\n'); +}); +``` + +One important caveat is that if the `Readable` stream emits an error during +processing, the `Writable` destination *is not closed* automatically. If an +error occurs, it will be necessary to *manually* close each stream in order +to prevent memory leaks. + +The [`process.stderr`](process.html#process_process_stderr) and [`process.stdout`](process.html#process_process_stdout) `Writable` streams are never +closed until the Node.js process exits, regardless of the specified options. + +##### readable.read([size])[#](#stream_readable_read_size) + +Added in: v0.9.4 + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Optional argument to specify how much data to read. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Null_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) + +The `readable.read()` method pulls some data out of the internal buffer and +returns it. If no data available to be read, `null` is returned. By default, +the data will be returned as a `Buffer` object unless an encoding has been +specified using the `readable.setEncoding()` method or the stream is operating +in object mode. + +The optional `size` argument specifies a specific number of bytes to read. If +`size` bytes are not available to be read, `null` will be returned *unless* +the stream has ended, in which case all of the data remaining in the internal +buffer will be returned. + +If the `size` argument is not specified, all of the data contained in the +internal buffer will be returned. + +The `size` argument must be less than or equal to 1 GB. + +The `readable.read()` method should only be called on `Readable` streams +operating in paused mode. In flowing mode, `readable.read()` is called +automatically until the internal buffer is fully drained. + +```None +const readable = getReadableStreamSomehow(); +readable.on('readable', () => { + let chunk; + while (null !== (chunk = readable.read())) { + console.log(`Received ${chunk.length} bytes of data.`); + } +}); +``` + +Note that the `while` loop is necessary when processing data with +`readable.read()`. Only after `readable.read()` returns `null`, +`'readable'` will be emitted. + +A `Readable` stream in object mode will always return a single item from +a call to [`readable.read(size)`](#stream_readable_read_size), regardless of the value of the +`size` argument. + +If the `readable.read()` method returns a chunk of data, a `'data'` event will +also be emitted. + +Calling [`stream.read([size])`](#stream_readable_read_size) after the [`'end'`](#stream_event_end) event has +been emitted will return `null`. No runtime error will be raised. + +##### readable.readable[#](#stream_readable_readable) + +Added in: v0.8.0 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +Is `true` if it is safe to call [`readable.read()`][]. + +##### readable.readableFlowing[#](#stream_readable_readableflowing) + +Added in: v9.4.0 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +This property reflects the current state of a `Readable` stream as described +in the [Stream Three States](#stream_three_states) section. + +##### readable.readableHighWaterMark[#](#stream_readable_readablehighwatermark) + +Added in: v9.3.0 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Returns the value of `highWaterMark` passed when constructing this +`Readable`. + +##### readable.readableLength[#](#stream_readable_readablelength) + +Added in: v9.4.0 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +This property contains the number of bytes (or objects) in the queue +ready to be read. The value provides introspection data regarding +the status of the `highWaterMark`. + +##### readable.resume()[#](#stream_readable_resume) + +History + +| Version | Changes | +| --- | --- | +| v10.0.0 | The `resume()` has no effect if there is a `'readable'` event listening. | +| v0.9.4 | Added in: v0.9.4 | + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `readable.resume()` method causes an explicitly paused `Readable` stream to +resume emitting [`'data'`](#stream_event_data) events, switching the stream into flowing mode. + +The `readable.resume()` method can be used to fully consume the data from a +stream without actually processing any of that data: + +```None +getReadableStreamSomehow() + .resume() + .on('end', () => { + console.log('Reached the end, but did not read anything.'); + }); +``` + +The `readable.resume()` method has no effect if there is a `'readable'` +event listener. + +##### readable.setEncoding(encoding)[#](#stream_readable_setencoding_encoding) + +Added in: v0.9.4 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding to use. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `readable.setEncoding()` method sets the character encoding for +data read from the `Readable` stream. + +By default, no encoding is assigned and stream data will be returned as +`Buffer` objects. Setting an encoding causes the stream data +to be returned as strings of the specified encoding rather than as `Buffer` +objects. For instance, calling `readable.setEncoding('utf8')` will cause the +output data to be interpreted as UTF-8 data, and passed as strings. Calling +`readable.setEncoding('hex')` will cause the data to be encoded in hexadecimal +string format. + +The `Readable` stream will properly handle multi-byte characters delivered +through the stream that would otherwise become improperly decoded if simply +pulled from the stream as `Buffer` objects. + +```None +const readable = getReadableStreamSomehow(); +readable.setEncoding('utf8'); +readable.on('data', (chunk) => { + assert.equal(typeof chunk, 'string'); + console.log('Got %d characters of string data:', chunk.length); +}); +``` + +##### readable.unpipe([destination])[#](#stream_readable_unpipe_destination) + +Added in: v0.9.4 + +* `destination` [](stream.html#stream_class_stream_writable) Optional specific stream to unpipe +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `readable.unpipe()` method detaches a `Writable` stream previously attached +using the [`stream.pipe()`](#stream_readable_pipe_destination_options) method. + +If the `destination` is not specified, then *all* pipes are detached. + +If the `destination` is specified, but no pipe is set up for it, then +the method does nothing. + +```None +const fs = require('fs'); +const readable = getReadableStreamSomehow(); +const writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt', +// but only for the first second +readable.pipe(writable); +setTimeout(() => { + console.log('Stop writing to file.txt.'); + readable.unpipe(writable); + console.log('Manually close the file stream.'); + writable.end(); +}, 1000); +``` + +##### readable.unshift(chunk)[#](#stream_readable_unshift_chunk) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `chunk` argument can now be a `Uint8Array` instance. | +| v0.9.11 | Added in: v0.9.11 | + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) Chunk of data to unshift onto the + read queue. For streams not operating in object mode, `chunk` must be a + string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be + any JavaScript value other than `null`. + +The `readable.unshift()` method pushes a chunk of data back into the internal +buffer. This is useful in certain situations where a stream is being consumed by +code that needs to "un-consume" some amount of data that it has optimistically +pulled out of the source, so that the data can be passed on to some other party. + +The `stream.unshift(chunk)` method cannot be called after the [`'end'`](#stream_event_end) event +has been emitted or a runtime error will be thrown. + +Developers using `stream.unshift()` often should consider switching to +use of a [`Transform`](#stream_class_stream_transform) stream instead. See the [API for Stream Implementers](#stream_api_for_stream_implementers) +section for more information. + +```None +// Pull off a header delimited by \n\n +// use unshift() if we get too much +// Call the callback with (error, header, stream) +const { StringDecoder } = require('string_decoder'); +function parseHeader(stream, callback) { + stream.on('error', callback); + stream.on('readable', onReadable); + const decoder = new StringDecoder('utf8'); + let header = ''; + function onReadable() { + let chunk; + while (null !== (chunk = stream.read())) { + const str = decoder.write(chunk); + if (str.match(/\n\n/)) { + // found the header boundary + const split = str.split(/\n\n/); + header += split.shift(); + const remaining = split.join('\n\n'); + const buf = Buffer.from(remaining, 'utf8'); + stream.removeListener('error', callback); + // remove the 'readable' listener before unshifting + stream.removeListener('readable', onReadable); + if (buf.length) + stream.unshift(buf); + // now the body of the message can be read from the stream. + callback(null, header, stream); + } else { + // still reading the header. + header += str; + } + } + } +} +``` + +Unlike [`stream.push(chunk)`](#stream_readable_push_chunk_encoding), `stream.unshift(chunk)` will not +end the reading process by resetting the internal reading state of the stream. +This can cause unexpected results if `readable.unshift()` is called during a +read (i.e. from within a [`stream._read()`](#stream_readable_read_size_1) implementation on a +custom stream). Following the call to `readable.unshift()` with an immediate +[`stream.push('')`](#stream_readable_push_chunk_encoding) will reset the reading state appropriately, +however it is best to simply avoid calling `readable.unshift()` while in the +process of performing a read. + +##### readable.wrap(stream)[#](#stream_readable_wrap_stream) + +Added in: v0.9.4 + +* `stream` [](stream.html#stream_stream) An "old style" readable stream +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +Prior to Node.js 0.10, streams did not implement the entire `stream` module API +as it is currently defined. (See [Compatibility](#stream_compatibility_with_older_node_js_versions) for more information.) + +When using an older Node.js library that emits [`'data'`](#stream_event_data) events and has a +[`stream.pause()`](#stream_readable_pause) method that is advisory only, the +`readable.wrap()` method can be used to create a [`Readable`](#stream_class_stream_readable) stream that uses +the old stream as its data source. + +It will rarely be necessary to use `readable.wrap()` but the method has been +provided as a convenience for interacting with older Node.js applications and +libraries. + +```None +const { OldReader } = require('./old-api-module.js'); +const { Readable } = require('stream'); +const oreader = new OldReader(); +const myReader = new Readable().wrap(oreader); + +myReader.on('readable', () => { + myReader.read(); // etc. +}); +``` + +##### readable[Symbol.asyncIterator]()[#](#stream_readable_symbol_asynciterator) + +History + +| Version | Changes | +| --- | --- | +| v10.17.0 | Symbol.asyncIterator support is no longer experimental. | +| v10.0.0 | Added in: v10.0.0 | + +[Stability: 2](documentation.html#documentation_stability_index) - Stable + +* Returns: [](https://tc39.github.io/ecma262/#sec-asynciterator-interface) to fully consume the stream. + +```None +const fs = require('fs'); + +async function print(readable) { + readable.setEncoding('utf8'); + let data = ''; + for await (const k of readable) { + data += k; + } + console.log(data); +} + +print(fs.createReadStream('file')).catch(console.log); +``` + +If the loop terminates with a `break` or a `throw`, the stream will be +destroyed. In other terms, iterating over a stream will consume the stream +fully. The stream will be read in chunks of size equal to the `highWaterMark` +option. In the code example above, data will be in a single chunk if the file +has less then 64kb of data because no `highWaterMark` option is provided to +[`fs.createReadStream()`](fs.html#fs_fs_createreadstream_path_options). + +### Duplex and Transform Streams[#](#stream_duplex_and_transform_streams) + +#### Class: stream.Duplex[#](#stream_class_stream_duplex) + +History + +| Version | Changes | +| --- | --- | +| v6.8.0 | Instances of `Duplex` now return `true` when checking `instanceof stream.Writable`. | +| v0.9.4 | Added in: v0.9.4 | + +Duplex streams are streams that implement both the [`Readable`](#stream_class_stream_readable) and +[`Writable`](#stream_class_stream_writable) interfaces. + +Examples of `Duplex` streams include: + +* [TCP sockets](net.html#net_class_net_socket) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) + +#### Class: stream.Transform[#](#stream_class_stream_transform) + +Added in: v0.9.4 + +Transform streams are [`Duplex`](#stream_class_stream_duplex) streams where the output is in some way +related to the input. Like all [`Duplex`](#stream_class_stream_duplex) streams, `Transform` streams +implement both the [`Readable`](#stream_class_stream_readable) and [`Writable`](#stream_class_stream_writable) interfaces. + +Examples of `Transform` streams include: + +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) + +##### transform.destroy([error])[#](#stream_transform_destroy_error) + +Added in: v8.0.0 + +* `error` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + +Destroy the stream, and emit `'error'`. After this call, the +transform stream would release any internal resources. +Implementors should not override this method, but instead implement +[`readable._destroy()`](#stream_readable_destroy_err_callback). +The default implementation of `_destroy()` for `Transform` also emit `'close'`. + +### stream.finished(stream, callback)[#](#stream_stream_finished_stream_callback) + +Added in: v10.0.0 + +* `stream` [](stream.html#stream_stream) A readable and/or writable stream. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function that takes an optional error + argument. + +A function to get notified when a stream is no longer readable, writable +or has experienced an error or a premature close event. + +```None +const { finished } = require('stream'); + +const rs = fs.createReadStream('archive.tar'); + +finished(rs, (err) => { + if (err) { + console.error('Stream failed.', err); + } else { + console.log('Stream is done reading.'); + } +}); + +rs.resume(); // drain the stream +``` + +Especially useful in error handling scenarios where a stream is destroyed +prematurely (like an aborted HTTP request), and will not emit `'end'` +or `'finish'`. + +The `finished` API is promisify-able as well; + +```None +const finished = util.promisify(stream.finished); + +const rs = fs.createReadStream('archive.tar'); + +async function run() { + await finished(rs); + console.log('Stream is done reading.'); +} + +run().catch(console.error); +rs.resume(); // drain the stream +``` + +### stream.pipeline(...streams[, callback])[#](#stream_stream_pipeline_streams_callback) + +Added in: v10.0.0 + +* `...streams` [](stream.html#stream_stream) Two or more streams to pipe between. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function that takes an optional error + argument. + +A module method to pipe between streams forwarding errors and properly cleaning +up and provide a callback when the pipeline is complete. + +```None +const { pipeline } = require('stream'); +const fs = require('fs'); +const zlib = require('zlib'); + +// Use the pipeline API to easily pipe a series of streams +// together and get notified when the pipeline is fully done. + +// A pipeline to gzip a potentially huge tar file efficiently: + +pipeline( + fs.createReadStream('archive.tar'), + zlib.createGzip(), + fs.createWriteStream('archive.tar.gz'), + (err) => { + if (err) { + console.error('Pipeline failed.', err); + } else { + console.log('Pipeline succeeded.'); + } + } +); +``` + +The `pipeline` API is promisify-able as well: + +```None +const pipeline = util.promisify(stream.pipeline); + +async function run() { + await pipeline( + fs.createReadStream('archive.tar'), + zlib.createGzip(), + fs.createWriteStream('archive.tar.gz') + ); + console.log('Pipeline succeeded.'); +} + +run().catch(console.error); +``` + +### Readable.from(iterable, [options])[#](#stream_readable_from_iterable_options) + +Added in: v12.3.0, v10.17.0 + +* `iterable` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) Object implementing the `Symbol.asyncIterator` or + `Symbol.iterator` iterable protocol. +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Options provided to `new stream.Readable([options])`. + By default, `Readable.from()` will set `options.objectMode` to `true`, unless + this is explicitly opted out by setting `options.objectMode` to `false`. + +A utility method for creating Readable Streams out of iterators. + +```None +const { Readable } = require('stream'); + +async function * generate() { + yield 'hello'; + yield 'streams'; +} + +const readable = Readable.from(generate()); + +readable.on('data', (chunk) => { + console.log(chunk); +}); +``` + +## API for Stream Implementers[#](#stream_api_for_stream_implementers) + +The `stream` module API has been designed to make it possible to easily +implement streams using JavaScript's prototypal inheritance model. + +First, a stream developer would declare a new JavaScript class that extends one +of the four basic stream classes (`stream.Writable`, `stream.Readable`, +`stream.Duplex`, or `stream.Transform`), making sure they call the appropriate +parent class constructor: + +```None +const { Writable } = require('stream'); + +class MyWritable extends Writable { + constructor(options) { + super(options); + // ... + } +} +``` + +The new stream class must then implement one or more specific methods, depending +on the type of stream being created, as detailed in the chart below: + +| Use-case | Class | Method(s) to implement | +| --- | --- | --- | +| Reading only | [`Readable`](#stream_class_stream_readable) | `_read` | +| Writing only | [`Writable`](#stream_class_stream_writable) | `_write`, `_writev`, `_final` | +| Reading and writing | [`Duplex`](#stream_class_stream_duplex) | `_read`, `_write`, `_writev`, `_final` | +| Operate on written data, then read the result | [`Transform`](#stream_class_stream_transform) | `_transform`, `_flush`, `_final` | + +The implementation code for a stream should *never* call the "public" methods +of a stream that are intended for use by consumers (as described in the +[API for Stream Consumers](#stream_api_for_stream_consumers) section). Doing so may lead to adverse side effects +in application code consuming the stream. + +### Simplified Construction[#](#stream_simplified_construction) + +Added in: v1.2.0 + +For many simple cases, it is possible to construct a stream without relying on +inheritance. This can be accomplished by directly creating instances of the +`stream.Writable`, `stream.Readable`, `stream.Duplex` or `stream.Transform` +objects and passing appropriate methods as constructor options. + +```None +const { Writable } = require('stream'); + +const myWritable = new Writable({ + write(chunk, encoding, callback) { + // ... + } +}); +``` + +### Implementing a Writable Stream[#](#stream_implementing_a_writable_stream) + +The `stream.Writable` class is extended to implement a [`Writable`](#stream_class_stream_writable) stream. + +Custom `Writable` streams *must* call the `new stream.Writable([options])` +constructor and implement the `writable._write()` method. The +`writable._writev()` method *may* also be implemented. + +#### Constructor: new stream.Writable([options])[#](#stream_constructor_new_stream_writable_options) + +History + +| Version | Changes | +| --- | --- | +| v10.16.0 | Add `autoDestroy` option to automatically `destroy()` the stream when it emits `'finish'` or errors | +| v10.0.0 | Add `emitClose` option to specify if `'close'` is emitted on destroy | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `highWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Buffer level when + [`stream.write()`](#stream_writable_write_chunk_encoding_callback) starts returning `false`. **Default:** + `16384` (16kb), or `16` for `objectMode` streams. + + `decodeStrings` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether to encode `string`s passed to + [`stream.write()`](#stream_writable_write_chunk_encoding_callback) to `Buffer`s (with the encoding + specified in the [`stream.write()`](#stream_writable_write_chunk_encoding_callback) call) before passing + them to [`stream._write()`](#stream_writable_write_chunk_encoding_callback_1). Other types of data are not + converted (i.e. `Buffer`s are not decoded into `string`s). Setting to + false will prevent `string`s from being converted. **Default:** `true`. + + `defaultEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The default encoding that is used when no + encoding is specified as an argument to [`stream.write()`](#stream_writable_write_chunk_encoding_callback). + **Default:** `'utf8'`. + + `objectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether or not the + [`stream.write(anyObj)`](#stream_writable_write_chunk_encoding_callback) is a valid operation. When set, + it becomes possible to write JavaScript values other than string, + `Buffer` or `Uint8Array` if supported by the stream implementation. + **Default:** `false`. + + `emitClose` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether or not the stream should emit `'close'` + after it has been destroyed. **Default:** `true`. + + `write` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._write()`](#stream_writable_write_chunk_encoding_callback_1) method. + + `writev` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._writev()`](#stream_writable_writev_chunks_callback) method. + + `destroy` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._destroy()`](#stream_writable_destroy_err_callback) method. + + `final` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._final()`](#stream_writable_final_callback) method. + + `autoDestroy` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether this stream should automatically call + `.destroy()` on itself after ending. **Default:** `false`. + +```None +const { Writable } = require('stream'); + +class MyWritable extends Writable { + constructor(options) { + // Calls the stream.Writable() constructor + super(options); + // ... + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const { Writable } = require('stream'); +const util = require('util'); + +function MyWritable(options) { + if (!(this instanceof MyWritable)) + return new MyWritable(options); + Writable.call(this, options); +} +util.inherits(MyWritable, Writable); +``` + +Or, using the Simplified Constructor approach: + +```None +const { Writable } = require('stream'); + +const myWritable = new Writable({ + write(chunk, encoding, callback) { + // ... + }, + writev(chunks, callback) { + // ... + } +}); +``` + +#### writable.\_write(chunk, encoding, callback)[#](#stream_writable_write_chunk_encoding_callback_1) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) The `Buffer` to be written, converted from the + `string` passed to [`stream.write()`](#stream_writable_write_chunk_encoding_callback). If the stream's + `decodeStrings` option is `false` or the stream is operating in object mode, + the chunk will not be converted & will be whatever was passed to + [`stream.write()`](#stream_writable_write_chunk_encoding_callback). +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If the chunk is a string, then `encoding` is the + character encoding of that string. If chunk is a `Buffer`, or if the + stream is operating in object mode, `encoding` may be ignored. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Call this function (optionally with an error + argument) when processing is complete for the supplied chunk. + +All `Writable` stream implementations must provide a +[`writable._write()`](#stream_writable_write_chunk_encoding_callback_1) method to send data to the underlying +resource. + +[`Transform`](#stream_class_stream_transform) streams provide their own implementation of the +[`writable._write()`](#stream_writable_write_chunk_encoding_callback_1). + +This function MUST NOT be called by application code directly. It should be +implemented by child classes, and called by the internal `Writable` class +methods only. + +The `callback` method must be called to signal either that the write completed +successfully or failed with an error. The first argument passed to the +`callback` must be the `Error` object if the call failed or `null` if the +write succeeded. + +All calls to `writable.write()` that occur between the time `writable._write()` +is called and the `callback` is called will cause the written data to be +buffered. When the `callback` is invoked, the stream might emit a [`'drain'`](#stream_event_drain) +event. If a stream implementation is capable of processing multiple chunks of +data at once, the `writable._writev()` method should be implemented. + +If the `decodeStrings` property is explicitly set to `false` in the constructor +options, then `chunk` will remain the same object that is passed to `.write()`, +and may be a string rather than a `Buffer`. This is to support implementations +that have an optimized handling for certain string data encodings. In that case, +the `encoding` argument will indicate the character encoding of the string. +Otherwise, the `encoding` argument can be safely ignored. + +The `writable._write()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### writable.\_writev(chunks, callback)[#](#stream_writable_writev_chunks_callback) + +* `chunks` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) The chunks to be written. Each chunk has following + format: `{ chunk: ..., encoding: ... }`. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function (optionally with an error + argument) to be invoked when processing is complete for the supplied chunks. + +This function MUST NOT be called by application code directly. It should be +implemented by child classes, and called by the internal `Writable` class +methods only. + +The `writable._writev()` method may be implemented in addition to +`writable._write()` in stream implementations that are capable of processing +multiple chunks of data at once. If implemented, the method will be called with +all chunks of data currently buffered in the write queue. + +The `writable._writev()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### writable.\_destroy(err, callback)[#](#stream_writable_destroy_err_callback) + +Added in: v8.0.0 + +* `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) A possible error. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function that takes an optional error + argument. + +The `_destroy()` method is called by [`writable.destroy()`](#stream_writable_destroy_error). +It can be overridden by child classes but it **must not** be called directly. + +#### writable.\_final(callback)[#](#stream_writable_final_callback) + +Added in: v8.0.0 + +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Call this function (optionally with an error + argument) when finished writing any remaining data. + +The `_final()` method **must not** be called directly. It may be implemented +by child classes, and if so, will be called by the internal `Writable` +class methods only. + +This optional function will be called before the stream closes, delaying the +`'finish'` event until `callback` is called. This is useful to close resources +or write buffered data before a stream ends. + +#### Errors While Writing[#](#stream_errors_while_writing) + +It is recommended that errors occurring during the processing of the +`writable._write()` and `writable._writev()` methods are reported by invoking +the callback and passing the error as the first argument. This will cause an +`'error'` event to be emitted by the `Writable`. Throwing an `Error` from within +`writable._write()` can result in unexpected and inconsistent behavior depending +on how the stream is being used. Using the callback ensures consistent and +predictable handling of errors. + +If a `Readable` stream pipes into a `Writable` stream when `Writable` emits an +error, the `Readable` stream will be unpiped. + +```None +const { Writable } = require('stream'); + +const myWritable = new Writable({ + write(chunk, encoding, callback) { + if (chunk.toString().indexOf('a') >= 0) { + callback(new Error('chunk is invalid')); + } else { + callback(); + } + } +}); +``` + +#### An Example Writable Stream[#](#stream_an_example_writable_stream) + +The following illustrates a rather simplistic (and somewhat pointless) custom +`Writable` stream implementation. While this specific `Writable` stream instance +is not of any real particular usefulness, the example illustrates each of the +required elements of a custom [`Writable`](#stream_class_stream_writable) stream instance: + +```None +const { Writable } = require('stream'); + +class MyWritable extends Writable { + _write(chunk, encoding, callback) { + if (chunk.toString().indexOf('a') >= 0) { + callback(new Error('chunk is invalid')); + } else { + callback(); + } + } +} +``` + +#### Decoding buffers in a Writable Stream[#](#stream_decoding_buffers_in_a_writable_stream) + +Decoding buffers is a common task, for instance, when using transformers whose +input is a string. This is not a trivial process when using multi-byte +characters encoding, such as UTF-8. The following example shows how to decode +multi-byte strings using `StringDecoder` and [`Writable`](#stream_class_stream_writable). + +```None +const { Writable } = require('stream'); +const { StringDecoder } = require('string_decoder'); + +class StringWritable extends Writable { + constructor(options) { + super(options); + this._decoder = new StringDecoder(options && options.defaultEncoding); + this.data = ''; + } + _write(chunk, encoding, callback) { + if (encoding === 'buffer') { + chunk = this._decoder.write(chunk); + } + this.data += chunk; + callback(); + } + _final(callback) { + this.data += this._decoder.end(); + callback(); + } +} + +const euro = [[0xE2, 0x82], [0xAC]].map(Buffer.from); +const w = new StringWritable(); + +w.write('currency: '); +w.write(euro[0]); +w.end(euro[1]); + +console.log(w.data); // currency: € +``` + +### Implementing a Readable Stream[#](#stream_implementing_a_readable_stream) + +The `stream.Readable` class is extended to implement a [`Readable`](#stream_class_stream_readable) stream. + +Custom `Readable` streams *must* call the `new stream.Readable([options])` +constructor and implement the `readable._read()` method. + +#### new stream.Readable([options])[#](#stream_new_stream_readable_options) + +History + +| Version | Changes | +| --- | --- | +| v10.16.0 | Add `autoDestroy` option to automatically `destroy()` the stream when it emits `'end'` or errors | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `highWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The maximum [number of bytes](#stream_highwatermark_discrepancy_after_calling_readable_setencoding) to store + in the internal buffer before ceasing to read from the underlying resource. + **Default:** `16384` (16kb), or `16` for `objectMode` streams. + + `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If specified, then buffers will be decoded to + strings using the specified encoding. **Default:** `null`. + + `objectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether this stream should behave + as a stream of objects. Meaning that [`stream.read(n)`](#stream_readable_read_size) returns + a single value instead of a `Buffer` of size `n`. **Default:** `false`. + + `read` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the [`stream._read()`](#stream_readable_read_size_1) + method. + + `destroy` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._destroy()`](#stream_readable_destroy_err_callback) method. + + `autoDestroy` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether this stream should automatically call + `.destroy()` on itself after ending. **Default:** `false`. + +```None +const { Readable } = require('stream'); + +class MyReadable extends Readable { + constructor(options) { + // Calls the stream.Readable(options) constructor + super(options); + // ... + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const { Readable } = require('stream'); +const util = require('util'); + +function MyReadable(options) { + if (!(this instanceof MyReadable)) + return new MyReadable(options); + Readable.call(this, options); +} +util.inherits(MyReadable, Readable); +``` + +Or, using the Simplified Constructor approach: + +```None +const { Readable } = require('stream'); + +const myReadable = new Readable({ + read(size) { + // ... + } +}); +``` + +#### readable.\_read(size)[#](#stream_readable_read_size_1) + +History + +| Version | Changes | +| --- | --- | +| v10.0.0 | call `_read()` only once per microtick | +| v0.9.4 | Added in: v0.9.4 | + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Number of bytes to read asynchronously + +This function MUST NOT be called by application code directly. It should be +implemented by child classes, and called by the internal `Readable` class +methods only. + +All `Readable` stream implementations must provide an implementation of the +`readable._read()` method to fetch data from the underlying resource. + +When `readable._read()` is called, if data is available from the resource, the +implementation should begin pushing that data into the read queue using the +[`this.push(dataChunk)`](#stream_readable_push_chunk_encoding) method. `_read()` should continue reading +from the resource and pushing data until `readable.push()` returns `false`. Only +when `_read()` is called again after it has stopped should it resume pushing +additional data onto the queue. + +Once the `readable._read()` method has been called, it will not be called again +until the [`readable.push()`](#stream_readable_push_chunk_encoding) method is called. `readable._read()` +is guaranteed to be called only once within a synchronous execution, i.e. a +microtick. + +The `size` argument is advisory. For implementations where a "read" is a +single operation that returns data can use the `size` argument to determine how +much data to fetch. Other implementations may ignore this argument and simply +provide data whenever it becomes available. There is no need to "wait" until +`size` bytes are available before calling [`stream.push(chunk)`](#stream_readable_push_chunk_encoding). + +The `readable._read()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### readable.\_destroy(err, callback)[#](#stream_readable_destroy_err_callback) + +Added in: v8.0.0 + +* `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) A possible error. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function that takes an optional error + argument. + +The `_destroy()` method is called by [`readable.destroy()`](#stream_readable_destroy_error). +It can be overridden by child classes but it **must not** be called directly. + +#### readable.push(chunk[, encoding])[#](#stream_readable_push_chunk_encoding) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `chunk` argument can now be a `Uint8Array` instance. | + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Null_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) Chunk of data to push into the + read queue. For streams not operating in object mode, `chunk` must be a + string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be + any JavaScript value. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Encoding of string chunks. Must be a valid + `Buffer` encoding, such as `'utf8'` or `'ascii'`. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` if additional chunks of data may continue to be + pushed; `false` otherwise. + +When `chunk` is a `Buffer`, `Uint8Array` or `string`, the `chunk` of data will +be added to the internal queue for users of the stream to consume. +Passing `chunk` as `null` signals the end of the stream (EOF), after which no +more data can be written. + +When the `Readable` is operating in paused mode, the data added with +`readable.push()` can be read out by calling the +[`readable.read()`](#stream_readable_read_size) method when the [`'readable'`](#stream_event_readable) event is +emitted. + +When the `Readable` is operating in flowing mode, the data added with +`readable.push()` will be delivered by emitting a `'data'` event. + +The `readable.push()` method is designed to be as flexible as possible. For +example, when wrapping a lower-level source that provides some form of +pause/resume mechanism, and a data callback, the low-level source can be wrapped +by the custom `Readable` instance: + +```None +// source is an object with readStop() and readStart() methods, +// and an `ondata` member that gets called when it has data, and +// an `onend` member that gets called when the data is over. + +class SourceWrapper extends Readable { + constructor(options) { + super(options); + + this._source = getLowlevelSourceObject(); + + // Every time there's data, push it into the internal buffer. + this._source.ondata = (chunk) => { + // if push() returns false, then stop reading from source + if (!this.push(chunk)) + this._source.readStop(); + }; + + // When the source ends, push the EOF-signaling `null` chunk + this._source.onend = () => { + this.push(null); + }; + } + // _read will be called when the stream wants to pull more data in + // the advisory size argument is ignored in this case. + _read(size) { + this._source.readStart(); + } +} +``` + +The `readable.push()` method is intended be called only by `Readable` +implementers, and only from within the `readable._read()` method. + +For streams not operating in object mode, if the `chunk` parameter of +`readable.push()` is `undefined`, it will be treated as empty string or +buffer. See [`readable.push('')`](#stream_readable_push) for more information. + +#### Errors While Reading[#](#stream_errors_while_reading) + +It is recommended that errors occurring during the processing of the +`readable._read()` method are emitted using the `'error'` event rather than +being thrown. Throwing an `Error` from within `readable._read()` can result in +unexpected and inconsistent behavior depending on whether the stream is +operating in flowing or paused mode. Using the `'error'` event ensures +consistent and predictable handling of errors. + +```None +const { Readable } = require('stream'); + +const myReadable = new Readable({ + read(size) { + if (checkSomeErrorCondition()) { + process.nextTick(() => this.emit('error', err)); + return; + } + // do some work + } +}); +``` + +#### An Example Counting Stream[#](#stream_an_example_counting_stream) + +The following is a basic example of a `Readable` stream that emits the numerals +from 1 to 1,000,000 in ascending order, and then ends. + +```None +const { Readable } = require('stream'); + +class Counter extends Readable { + constructor(opt) { + super(opt); + this._max = 1000000; + this._index = 1; + } + + _read() { + const i = this._index++; + if (i > this._max) + this.push(null); + else { + const str = String(i); + const buf = Buffer.from(str, 'ascii'); + this.push(buf); + } + } +} +``` + +### Implementing a Duplex Stream[#](#stream_implementing_a_duplex_stream) + +A [`Duplex`](#stream_class_stream_duplex) stream is one that implements both [`Readable`](#stream_class_stream_readable) and +[`Writable`](#stream_class_stream_writable), such as a TCP socket connection. + +Because JavaScript does not have support for multiple inheritance, the +`stream.Duplex` class is extended to implement a [`Duplex`](#stream_class_stream_duplex) stream (as opposed +to extending the `stream.Readable` *and* `stream.Writable` classes). + +The `stream.Duplex` class prototypically inherits from `stream.Readable` and +parasitically from `stream.Writable`, but `instanceof` will work properly for +both base classes due to overriding [`Symbol.hasInstance`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/hasInstance) on +`stream.Writable`. + +Custom `Duplex` streams *must* call the `new stream.Duplex([options])` +constructor and implement *both* the `readable._read()` and +`writable._write()` methods. + +#### new stream.Duplex(options)[#](#stream_new_stream_duplex_options) + +History + +| Version | Changes | +| --- | --- | +| v8.4.0 | The `readableHighWaterMark` and `writableHighWaterMark` options are supported now. | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Passed to both `Writable` and `Readable` + constructors. Also has the following fields: + + + `allowHalfOpen` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If set to `false`, then the stream will + automatically end the writable side when the readable side ends. + **Default:** `true`. + + `readableObjectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Sets `objectMode` for readable side of the + stream. Has no effect if `objectMode` is `true`. **Default:** `false`. + + `writableObjectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Sets `objectMode` for writable side of the + stream. Has no effect if `objectMode` is `true`. **Default:** `false`. + + `readableHighWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Sets `highWaterMark` for the readable side + of the stream. Has no effect if `highWaterMark` is provided. + + `writableHighWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Sets `highWaterMark` for the writable side + of the stream. Has no effect if `highWaterMark` is provided. + +```None +const { Duplex } = require('stream'); + +class MyDuplex extends Duplex { + constructor(options) { + super(options); + // ... + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const { Duplex } = require('stream'); +const util = require('util'); + +function MyDuplex(options) { + if (!(this instanceof MyDuplex)) + return new MyDuplex(options); + Duplex.call(this, options); +} +util.inherits(MyDuplex, Duplex); +``` + +Or, using the Simplified Constructor approach: + +```None +const { Duplex } = require('stream'); + +const myDuplex = new Duplex({ + read(size) { + // ... + }, + write(chunk, encoding, callback) { + // ... + } +}); +``` + +#### An Example Duplex Stream[#](#stream_an_example_duplex_stream) + +The following illustrates a simple example of a `Duplex` stream that wraps a +hypothetical lower-level source object to which data can be written, and +from which data can be read, albeit using an API that is not compatible with +Node.js streams. +The following illustrates a simple example of a `Duplex` stream that buffers +incoming written data via the [`Writable`](#stream_class_stream_writable) interface that is read back out +via the [`Readable`](#stream_class_stream_readable) interface. + +```None +const { Duplex } = require('stream'); +const kSource = Symbol('source'); + +class MyDuplex extends Duplex { + constructor(source, options) { + super(options); + this[kSource] = source; + } + + _write(chunk, encoding, callback) { + // The underlying source only deals with strings + if (Buffer.isBuffer(chunk)) + chunk = chunk.toString(); + this[kSource].writeSomeData(chunk); + callback(); + } + + _read(size) { + this[kSource].fetchSomeData(size, (data, encoding) => { + this.push(Buffer.from(data, encoding)); + }); + } +} +``` + +The most important aspect of a `Duplex` stream is that the `Readable` and +`Writable` sides operate independently of one another despite co-existing within +a single object instance. + +#### Object Mode Duplex Streams[#](#stream_object_mode_duplex_streams) + +For `Duplex` streams, `objectMode` can be set exclusively for either the +`Readable` or `Writable` side using the `readableObjectMode` and +`writableObjectMode` options respectively. + +In the following example, for instance, a new `Transform` stream (which is a +type of [`Duplex`](#stream_class_stream_duplex) stream) is created that has an object mode `Writable` side +that accepts JavaScript numbers that are converted to hexadecimal strings on +the `Readable` side. + +```None +const { Transform } = require('stream'); + +// All Transform streams are also Duplex Streams +const myTransform = new Transform({ + writableObjectMode: true, + + transform(chunk, encoding, callback) { + // Coerce the chunk to a number if necessary + chunk |= 0; + + // Transform the chunk into something else. + const data = chunk.toString(16); + + // Push the data onto the readable queue. + callback(null, '0'.repeat(data.length % 2) + data); + } +}); + +myTransform.setEncoding('ascii'); +myTransform.on('data', (chunk) => console.log(chunk)); + +myTransform.write(1); +// Prints: 01 +myTransform.write(10); +// Prints: 0a +myTransform.write(100); +// Prints: 64 +``` + +### Implementing a Transform Stream[#](#stream_implementing_a_transform_stream) + +A [`Transform`](#stream_class_stream_transform) stream is a [`Duplex`](#stream_class_stream_duplex) stream where the output is computed +in some way from the input. Examples include [zlib](zlib.html) streams or [crypto](crypto.html) +streams that compress, encrypt, or decrypt data. + +There is no requirement that the output be the same size as the input, the same +number of chunks, or arrive at the same time. For example, a `Hash` stream will +only ever have a single chunk of output which is provided when the input is +ended. A `zlib` stream will produce output that is either much smaller or much +larger than its input. + +The `stream.Transform` class is extended to implement a [`Transform`](#stream_class_stream_transform) stream. + +The `stream.Transform` class prototypically inherits from `stream.Duplex` and +implements its own versions of the `writable._write()` and `readable._read()` +methods. Custom `Transform` implementations *must* implement the +[`transform._transform()`](#stream_transform_transform_chunk_encoding_callback) method and *may* also implement +the [`transform._flush()`](#stream_transform_flush_callback) method. + +Care must be taken when using `Transform` streams in that data written to the +stream can cause the `Writable` side of the stream to become paused if the +output on the `Readable` side is not consumed. + +#### new stream.Transform([options])[#](#stream_new_stream_transform_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Passed to both `Writable` and `Readable` + constructors. Also has the following fields: + + + `transform` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._transform()`](#stream_transform_transform_chunk_encoding_callback) method. + + `flush` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the [`stream._flush()`](#stream_transform_flush_callback) + method. + +```None +const { Transform } = require('stream'); + +class MyTransform extends Transform { + constructor(options) { + super(options); + // ... + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const { Transform } = require('stream'); +const util = require('util'); + +function MyTransform(options) { + if (!(this instanceof MyTransform)) + return new MyTransform(options); + Transform.call(this, options); +} +util.inherits(MyTransform, Transform); +``` + +Or, using the Simplified Constructor approach: + +```None +const { Transform } = require('stream'); + +const myTransform = new Transform({ + transform(chunk, encoding, callback) { + // ... + } +}); +``` + +#### Events: 'finish' and 'end'[#](#stream_events_finish_and_end) + +The [`'finish'`](#stream_event_finish) and [`'end'`](#stream_event_end) events are from the `stream.Writable` +and `stream.Readable` classes, respectively. The `'finish'` event is emitted +after [`stream.end()`](#stream_writable_end_chunk_encoding_callback) is called and all chunks have been processed +by [`stream._transform()`](#stream_transform_transform_chunk_encoding_callback). The `'end'` event is emitted +after all data has been output, which occurs after the callback in +[`transform._flush()`](#stream_transform_flush_callback) has been called. + +#### transform.\_flush(callback)[#](#stream_transform_flush_callback) + +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function (optionally with an error + argument and data) to be called when remaining data has been flushed. + +This function MUST NOT be called by application code directly. It should be +implemented by child classes, and called by the internal `Readable` class +methods only. + +In some cases, a transform operation may need to emit an additional bit of +data at the end of the stream. For example, a `zlib` compression stream will +store an amount of internal state used to optimally compress the output. When +the stream ends, however, that additional data needs to be flushed so that the +compressed data will be complete. + +Custom [`Transform`](#stream_class_stream_transform) implementations *may* implement the `transform._flush()` +method. This will be called when there is no more written data to be consumed, +but before the [`'end'`](#stream_event_end) event is emitted signaling the end of the +[`Readable`](#stream_class_stream_readable) stream. + +Within the `transform._flush()` implementation, the `readable.push()` method +may be called zero or more times, as appropriate. The `callback` function must +be called when the flush operation is complete. + +The `transform._flush()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### transform.\_transform(chunk, encoding, callback)[#](#stream_transform_transform_chunk_encoding_callback) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) The `Buffer` to be transformed, converted from + the `string` passed to [`stream.write()`](#stream_writable_write_chunk_encoding_callback). If the stream's + `decodeStrings` option is `false` or the stream is operating in object mode, + the chunk will not be converted & will be whatever was passed to + [`stream.write()`](#stream_writable_write_chunk_encoding_callback). +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If the chunk is a string, then this is the + encoding type. If chunk is a buffer, then this is the special + value - 'buffer', ignore it in this case. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function (optionally with an error + argument and data) to be called after the supplied `chunk` has been + processed. + +This function MUST NOT be called by application code directly. It should be +implemented by child classes, and called by the internal `Readable` class +methods only. + +All `Transform` stream implementations must provide a `_transform()` +method to accept input and produce output. The `transform._transform()` +implementation handles the bytes being written, computes an output, then passes +that output off to the readable portion using the `readable.push()` method. + +The `transform.push()` method may be called zero or more times to generate +output from a single input chunk, depending on how much is to be output +as a result of the chunk. + +It is possible that no output is generated from any given chunk of input data. + +The `callback` function must be called only when the current chunk is completely +consumed. The first argument passed to the `callback` must be an `Error` object +if an error occurred while processing the input or `null` otherwise. If a second +argument is passed to the `callback`, it will be forwarded on to the +`readable.push()` method. In other words, the following are equivalent: + +```None +transform.prototype._transform = function(data, encoding, callback) { + this.push(data); + callback(); +}; + +transform.prototype._transform = function(data, encoding, callback) { + callback(null, data); +}; +``` + +The `transform._transform()` method is prefixed with an underscore because it +is internal to the class that defines it, and should never be called directly by +user programs. + +`transform._transform()` is never called in parallel; streams implement a +queue mechanism, and to receive the next chunk, `callback` must be +called, either synchronously or asynchronously. + +#### Class: stream.PassThrough[#](#stream_class_stream_passthrough) + +The `stream.PassThrough` class is a trivial implementation of a [`Transform`](#stream_class_stream_transform) +stream that simply passes the input bytes across to the output. Its purpose is +primarily for examples and testing, but there are some use cases where +`stream.PassThrough` is useful as a building block for novel sorts of streams. + +## Additional Notes[#](#stream_additional_notes) + +### Streams Compatibility with Async Generators and Async Iterators[#](#stream_streams_compatibility_with_async_generators_and_async_iterators) + +With the support of async generators and iterators in JavaScript, async +generators are effectively a first-class language-level stream construct at +this point. + +Some common interop cases of using Node.js streams with async generators +and async iterators are provided below. + +#### Consuming Readable Streams with Async Iterators[#](#stream_consuming_readable_streams_with_async_iterators) + +```None +(async function() { + for await (const chunk of readable) { + console.log(chunk); + } +})(); +``` + +#### Creating Readable Streams with Async Generators[#](#stream_creating_readable_streams_with_async_generators) + +We can construct a Node.js Readable Stream from an asynchronous generator +using the `Readable.from` utility method: + +```None +const { Readable } = require('stream'); + +async function * generate() { + yield 'a'; + yield 'b'; + yield 'c'; +} + +const readable = Readable.from(generate()); + +readable.on('data', (chunk) => { + console.log(chunk); +}); +``` + +#### Piping to Writable Streams from Async Iterators[#](#stream_piping_to_writable_streams_from_async_iterators) + +In the scenario of writing to a writeable stream from an async iterator, +it is important to ensure the correct handling of backpressure and errors. + +```None +const { once } = require('events'); + +const writeable = fs.createWriteStream('./file'); + +(async function() { + for await (const chunk of iterator) { + // Handle backpressure on write + if (!writeable.write(value)) + await once(writeable, 'drain'); + } + writeable.end(); + // Ensure completion without errors + await once(writeable, 'finish'); +})(); +``` + +In the above, errors on the write stream would be caught and thrown by the two +`once` listeners, since `once` will also handle `'error'` events. + +Alternatively the readable stream could be wrapped with `Readable.from` and +then piped via `.pipe`: + +```None +const { once } = require('events'); + +const writeable = fs.createWriteStream('./file'); + +(async function() { + const readable = Readable.from(iterator); + readable.pipe(writeable); + // Ensure completion without errors + await once(writeable, 'finish'); +})(); +``` + +### Compatibility with Older Node.js Versions[#](#stream_compatibility_with_older_node_js_versions) + +Prior to Node.js 0.10, the `Readable` stream interface was simpler, but also +less powerful and less useful. + +* Rather than waiting for calls to the [`stream.read()`](#stream_readable_read_size) method, + [`'data'`](#stream_event_data) events would begin emitting immediately. Applications that + would need to perform some amount of work to decide how to handle data + were required to store read data into buffers so the data would not be lost. +* The [`stream.pause()`](#stream_readable_pause) method was advisory, rather than + guaranteed. This meant that it was still necessary to be prepared to receive + [`'data'`](#stream_event_data) events *even when the stream was in a paused state*. + +In Node.js 0.10, the [`Readable`](#stream_class_stream_readable) class was added. For backward +compatibility with older Node.js programs, `Readable` streams switch into +"flowing mode" when a [`'data'`](#stream_event_data) event handler is added, or when the +[`stream.resume()`](#stream_readable_resume) method is called. The effect is that, even +when not using the new [`stream.read()`](#stream_readable_read_size) method and +[`'readable'`](#stream_event_readable) event, it is no longer necessary to worry about losing +[`'data'`](#stream_event_data) chunks. + +While most applications will continue to function normally, this introduces an +edge case in the following conditions: + +* No [`'data'`](#stream_event_data) event listener is added. +* The [`stream.resume()`](#stream_readable_resume) method is never called. +* The stream is not piped to any writable destination. + +For example, consider the following code: + +```None +// WARNING! BROKEN! +net.createServer((socket) => { + + // we add an 'end' listener, but never consume the data + socket.on('end', () => { + // It will never get here. + socket.end('The message was received but was not processed.\n'); + }); + +}).listen(1337); +``` + +Prior to Node.js 0.10, the incoming message data would be simply discarded. +However, in Node.js 0.10 and beyond, the socket remains paused forever. + +The workaround in this situation is to call the +[`stream.resume()`](#stream_readable_resume) method to begin the flow of data: + +```None +// Workaround +net.createServer((socket) => { + socket.on('end', () => { + socket.end('The message was received but was not processed.\n'); + }); + + // start the flow of data, discarding it. + socket.resume(); +}).listen(1337); +``` + +In addition to new `Readable` streams switching into flowing mode, +pre-0.10 style streams can be wrapped in a `Readable` class using the +[`readable.wrap()`](#stream_readable_wrap_stream) method. + +### `readable.read(0)`[#](#stream_readable_read_0) + +There are some cases where it is necessary to trigger a refresh of the +underlying readable stream mechanisms, without actually consuming any +data. In such cases, it is possible to call `readable.read(0)`, which will +always return `null`. + +If the internal read buffer is below the `highWaterMark`, and the +stream is not currently reading, then calling `stream.read(0)` will trigger +a low-level [`stream._read()`](#stream_readable_read_size_1) call. + +While most applications will almost never need to do this, there are +situations within Node.js where this is done, particularly in the +`Readable` stream class internals. + +### `readable.push('')`[#](#stream_readable_push) + +Use of `readable.push('')` is not recommended. + +Pushing a zero-byte string, `Buffer` or `Uint8Array` to a stream that is not in +object mode has an interesting side effect. Because it *is* a call to +[`readable.push()`](#stream_readable_push_chunk_encoding), the call will end the reading process. +However, because the argument is an empty string, no data is added to the +readable buffer so there is nothing for a user to consume. + +### `highWaterMark` discrepancy after calling `readable.setEncoding()`[#](#stream_highwatermark_discrepancy_after_calling_readable_setencoding) + +The use of `readable.setEncoding()` will change the behavior of how the +`highWaterMark` operates in non-object mode. + +Typically, the size of the current buffer is measured against the +`highWaterMark` in *bytes*. However, after `setEncoding()` is called, the +comparison function will begin to measure the buffer's size in *characters*. + +This is not a problem in common cases with `latin1` or `ascii`. But it is +advised to be mindful about this behavior when working with strings that could +contain multi-byte characters. diff --git a/corpus/docs/nodejs/stream/stream_11x.md b/corpus/docs/nodejs/stream/stream_11x.md new file mode 100644 index 0000000000000000000000000000000000000000..4d019961b221f5b6b8febb2853c5dc6127dffbcc --- /dev/null +++ b/corpus/docs/nodejs/stream/stream_11x.md @@ -0,0 +1,2428 @@ +# Stream[src]# + +Source: https://nodejs.org/docs/latest-v11.x/api/stream.html +Version: 11.x + +[Stability: 2](documentation.html#documentation_stability_index) - Stable + +A stream is an abstract interface for working with streaming data in Node.js. +The `stream` module provides a base API that makes it easy to build objects +that implement the stream interface. + +There are many stream objects provided by Node.js. For instance, a +[request to an HTTP server](http.html#http_class_http_incomingmessage) and [`process.stdout`](process.html#process_process_stdout) +are both stream instances. + +Streams can be readable, writable, or both. All streams are instances of +[`EventEmitter`](events.html#events_class_eventemitter). + +The `stream` module can be accessed using: + +```None +const stream = require('stream'); +``` + +While it is important to understand how streams work, the `stream` module itself +is most useful for developers that are creating new types of stream instances. +Developers who are primarily *consuming* stream objects will rarely need to use +the `stream` module directly. + +## Organization of this Document[#](#stream_organization_of_this_document) + +This document is divided into two primary sections with a third section for +additional notes. The first section explains the elements of the stream API that +are required to *use* streams within an application. The second section explains +the elements of the API that are required to *implement* new types of streams. + +## Types of Streams[#](#stream_types_of_streams) + +There are four fundamental stream types within Node.js: + +* [`Writable`](#stream_class_stream_writable) - streams to which data can be written (for example, + [`fs.createWriteStream()`](fs.html#fs_fs_createwritestream_path_options)). +* [`Readable`](#stream_class_stream_readable) - streams from which data can be read (for example, + [`fs.createReadStream()`](fs.html#fs_fs_createreadstream_path_options)). +* [`Duplex`](#stream_class_stream_duplex) - streams that are both `Readable` and `Writable` (for example, + [`net.Socket`](net.html#net_class_net_socket)). +* [`Transform`](#stream_class_stream_transform) - `Duplex` streams that can modify or transform the data as it + is written and read (for example, [`zlib.createDeflate()`](zlib.html#zlib_zlib_createdeflate_options)). + +Additionally, this module includes the utility functions [pipeline](#stream_stream_pipeline_streams_callback) and +[finished](#stream_stream_finished_stream_options_callback). + +### Object Mode[#](#stream_object_mode) + +All streams created by Node.js APIs operate exclusively on strings and `Buffer` +(or `Uint8Array`) objects. It is possible, however, for stream implementations +to work with other types of JavaScript values (with the exception of `null`, +which serves a special purpose within streams). Such streams are considered to +operate in "object mode". + +Stream instances are switched into object mode using the `objectMode` option +when the stream is created. Attempting to switch an existing stream into +object mode is not safe. + +### Buffering[#](#stream_buffering) + +Both [`Writable`](#stream_class_stream_writable) and [`Readable`](#stream_class_stream_readable) streams will store data in an internal +buffer that can be retrieved using `writable.writableBuffer` or +`readable.readableBuffer`, respectively. + +The amount of data potentially buffered depends on the `highWaterMark` option +passed into the stream's constructor. For normal streams, the `highWaterMark` +option specifies a [total number of bytes](#stream_highwatermark_discrepancy_after_calling_readable_setencoding). For streams operating +in object mode, the `highWaterMark` specifies a total number of objects. + +Data is buffered in `Readable` streams when the implementation calls +[`stream.push(chunk)`](#stream_readable_push_chunk_encoding). If the consumer of the Stream does not +call [`stream.read()`](#stream_readable_read_size), the data will sit in the internal +queue until it is consumed. + +Once the total size of the internal read buffer reaches the threshold specified +by `highWaterMark`, the stream will temporarily stop reading data from the +underlying resource until the data currently buffered can be consumed (that is, +the stream will stop calling the internal `readable._read()` method that is +used to fill the read buffer). + +Data is buffered in `Writable` streams when the +[`writable.write(chunk)`](#stream_writable_write_chunk_encoding_callback) method is called repeatedly. While the +total size of the internal write buffer is below the threshold set by +`highWaterMark`, calls to `writable.write()` will return `true`. Once +the size of the internal buffer reaches or exceeds the `highWaterMark`, `false` +will be returned. + +A key goal of the `stream` API, particularly the [`stream.pipe()`](#stream_readable_pipe_destination_options) method, +is to limit the buffering of data to acceptable levels such that sources and +destinations of differing speeds will not overwhelm the available memory. + +Because [`Duplex`](#stream_class_stream_duplex) and [`Transform`](#stream_class_stream_transform) streams are both `Readable` and +`Writable`, each maintains *two* separate internal buffers used for reading and +writing, allowing each side to operate independently of the other while +maintaining an appropriate and efficient flow of data. For example, +[`net.Socket`](net.html#net_class_net_socket) instances are [`Duplex`](#stream_class_stream_duplex) streams whose `Readable` side allows +consumption of data received *from* the socket and whose `Writable` side allows +writing data *to* the socket. Because data may be written to the socket at a +faster or slower rate than data is received, it is important for each side to +operate (and buffer) independently of the other. + +## API for Stream Consumers[#](#stream_api_for_stream_consumers) + +Almost all Node.js applications, no matter how simple, use streams in some +manner. The following is an example of using streams in a Node.js application +that implements an HTTP server: + +```None +const http = require('http'); + +const server = http.createServer((req, res) => { + // `req` is an http.IncomingMessage, which is a Readable Stream + // `res` is an http.ServerResponse, which is a Writable Stream + + let body = ''; + // Get the data as utf8 strings. + // If an encoding is not set, Buffer objects will be received. + req.setEncoding('utf8'); + + // Readable streams emit 'data' events once a listener is added + req.on('data', (chunk) => { + body += chunk; + }); + + // The 'end' event indicates that the entire body has been received + req.on('end', () => { + try { + const data = JSON.parse(body); + // Write back something interesting to the user: + res.write(typeof data); + res.end(); + } catch (er) { + // uh oh! bad json! + res.statusCode = 400; + return res.end(`error: ${er.message}`); + } + }); +}); + +server.listen(1337); + +// $ curl localhost:1337 -d "{}" +// object +// $ curl localhost:1337 -d "\"foo\"" +// string +// $ curl localhost:1337 -d "not json" +// error: Unexpected token o in JSON at position 1 +``` + +[`Writable`](#stream_class_stream_writable) streams (such as `res` in the example) expose methods such as +`write()` and `end()` that are used to write data onto the stream. + +[`Readable`](#stream_class_stream_readable) streams use the [`EventEmitter`](events.html#events_class_eventemitter) API for notifying application +code when data is available to be read off the stream. That available data can +be read from the stream in multiple ways. + +Both [`Writable`](#stream_class_stream_writable) and [`Readable`](#stream_class_stream_readable) streams use the [`EventEmitter`](events.html#events_class_eventemitter) API in +various ways to communicate the current state of the stream. + +[`Duplex`](#stream_class_stream_duplex) and [`Transform`](#stream_class_stream_transform) streams are both [`Writable`](#stream_class_stream_writable) and +[`Readable`](#stream_class_stream_readable). + +Applications that are either writing data to or consuming data from a stream +are not required to implement the stream interfaces directly and will generally +have no reason to call `require('stream')`. + +Developers wishing to implement new types of streams should refer to the +section [API for Stream Implementers](#stream_api_for_stream_implementers). + +### Writable Streams[#](#stream_writable_streams) + +Writable streams are an abstraction for a *destination* to which data is +written. + +Examples of [`Writable`](#stream_class_stream_writable) streams include: + +* [HTTP requests, on the client](http.html#http_class_http_clientrequest) +* [HTTP responses, on the server](http.html#http_class_http_serverresponse) +* [fs write streams](fs.html#fs_class_fs_writestream) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) +* [TCP sockets](net.html#net_class_net_socket) +* [child process stdin](child_process.html#child_process_subprocess_stdin) +* [`process.stdout`](process.html#process_process_stdout), [`process.stderr`](process.html#process_process_stderr) + +Some of these examples are actually [`Duplex`](#stream_class_stream_duplex) streams that implement the +[`Writable`](#stream_class_stream_writable) interface. + +All [`Writable`](#stream_class_stream_writable) streams implement the interface defined by the +`stream.Writable` class. + +While specific instances of [`Writable`](#stream_class_stream_writable) streams may differ in various ways, +all `Writable` streams follow the same fundamental usage pattern as illustrated +in the example below: + +```None +const myStream = getWritableStreamSomehow(); +myStream.write('some data'); +myStream.write('some more data'); +myStream.end('done writing data'); +``` + +#### Class: stream.Writable[#](#stream_class_stream_writable) + +Added in: v0.9.4 + +##### Event: 'close'[#](#stream_event_close) + +History + +| Version | Changes | +| --- | --- | +| v10.0.0 | Add `emitClose` option to specify if `'close'` is emitted on destroy. | +| v0.9.4 | Added in: v0.9.4 | + +The `'close'` event is emitted when the stream and any of its underlying +resources (a file descriptor, for example) have been closed. The event indicates +that no more events will be emitted, and no further computation will occur. + +A [`Writable`](#stream_class_stream_writable) stream will always emit the `'close'` event if it is +created with the `emitClose` option. + +##### Event: 'drain'[#](#stream_event_drain) + +Added in: v0.9.4 + +If a call to [`stream.write(chunk)`](#stream_writable_write_chunk_encoding_callback) returns `false`, the +`'drain'` event will be emitted when it is appropriate to resume writing data +to the stream. + +```None +// Write the data to the supplied writable stream one million times. +// Be attentive to back-pressure. +function writeOneMillionTimes(writer, data, encoding, callback) { + let i = 1000000; + write(); + function write() { + let ok = true; + do { + i--; + if (i === 0) { + // last time! + writer.write(data, encoding, callback); + } else { + // See if we should continue, or wait. + // Don't pass the callback, because we're not done yet. + ok = writer.write(data, encoding); + } + } while (i > 0 && ok); + if (i > 0) { + // had to stop early! + // write some more once it drains + writer.once('drain', write); + } + } +} +``` + +##### Event: 'error'[#](#stream_event_error) + +Added in: v0.9.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + +The `'error'` event is emitted if an error occurred while writing or piping +data. The listener callback is passed a single `Error` argument when called. + +The stream is not closed when the `'error'` event is emitted. + +##### Event: 'finish'[#](#stream_event_finish) + +Added in: v0.9.4 + +The `'finish'` event is emitted after the [`stream.end()`](#stream_writable_end_chunk_encoding_callback) method +has been called, and all data has been flushed to the underlying system. + +```None +const writer = getWritableStreamSomehow(); +for (let i = 0; i < 100; i++) { + writer.write(`hello, #${i}!\n`); +} +writer.end('This is the end\n'); +writer.on('finish', () => { + console.log('All writes are now complete.'); +}); +``` + +##### Event: 'pipe'[#](#stream_event_pipe) + +Added in: v0.9.4 + +* `src` [](stream.html#stream_class_stream_readable) source stream that is piping to this writable + +The `'pipe'` event is emitted when the [`stream.pipe()`](#stream_readable_pipe_destination_options) method is called on +a readable stream, adding this writable to its set of destinations. + +```None +const writer = getWritableStreamSomehow(); +const reader = getReadableStreamSomehow(); +writer.on('pipe', (src) => { + console.log('Something is piping into the writer.'); + assert.equal(src, reader); +}); +reader.pipe(writer); +``` + +##### Event: 'unpipe'[#](#stream_event_unpipe) + +Added in: v0.9.4 + +* `src` [](stream.html#stream_class_stream_readable) The source stream that + [unpiped](#stream_readable_unpipe_destination) this writable + +The `'unpipe'` event is emitted when the [`stream.unpipe()`](#stream_readable_unpipe_destination) method is called +on a [`Readable`](#stream_class_stream_readable) stream, removing this [`Writable`](#stream_class_stream_writable) from its set of +destinations. + +This is also emitted in case this [`Writable`](#stream_class_stream_writable) stream emits an error when a +[`Readable`](#stream_class_stream_readable) stream pipes into it. + +```None +const writer = getWritableStreamSomehow(); +const reader = getReadableStreamSomehow(); +writer.on('unpipe', (src) => { + console.log('Something has stopped piping into the writer.'); + assert.equal(src, reader); +}); +reader.pipe(writer); +reader.unpipe(writer); +``` + +##### writable.cork()[#](#stream_writable_cork) + +Added in: v0.11.2 + +The `writable.cork()` method forces all written data to be buffered in memory. +The buffered data will be flushed when either the [`stream.uncork()`](#stream_writable_uncork) or +[`stream.end()`](#stream_writable_end_chunk_encoding_callback) methods are called. + +The primary intent of `writable.cork()` is to avoid a situation where writing +many small chunks of data to a stream do not cause a backup in the internal +buffer that would have an adverse impact on performance. In such situations, +implementations that implement the `writable._writev()` method can perform +buffered writes in a more optimized manner. + +See also: [`writable.uncork()`](#stream_writable_uncork). + +##### writable.destroy([error])[#](#stream_writable_destroy_error) + +Added in: v8.0.0 + +* `error` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) Optional, an error to emit with `'error'` event. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'` +event unless `emitClose` is set in `false`. After this call, the writable +stream has ended and subsequent calls to `write()` or `end()` will result in +an `ERR_STREAM_DESTROYED` error. +This is a destructive and immediate way to destroy a stream. Previous calls to +`write()` may not have drained, and may trigger an `ERR_STREAM_DESTROYED` error. +Use `end()` instead of destroy if data should flush before close, or wait for +the `'drain'` event before destroying the stream. +Implementors should not override this method, +but instead implement [`writable._destroy()`](#stream_writable_destroy_err_callback). + +##### writable.end([chunk][, encoding][, callback])[#](#stream_writable_end_chunk_encoding_callback) + +History + +| Version | Changes | +| --- | --- | +| v10.0.0 | This method now returns a reference to `writable`. | +| v8.0.0 | The `chunk` argument can now be a `Uint8Array` instance. | +| v0.9.4 | Added in: v0.9.4 | + +* `chunk` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) Optional data to write. For streams + not operating in object mode, `chunk` must be a string, `Buffer` or + `Uint8Array`. For object mode streams, `chunk` may be any JavaScript value + other than `null`. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding if `chunk` is a string +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Optional callback for when the stream is finished +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +Calling the `writable.end()` method signals that no more data will be written +to the [`Writable`](#stream_class_stream_writable). The optional `chunk` and `encoding` arguments allow one +final additional chunk of data to be written immediately before closing the +stream. If provided, the optional `callback` function is attached as a listener +for the [`'finish'`](#stream_event_finish) event. + +Calling the [`stream.write()`](#stream_writable_write_chunk_encoding_callback) method after calling +[`stream.end()`](#stream_writable_end_chunk_encoding_callback) will raise an error. + +```None +// Write 'hello, ' and then end with 'world!' +const fs = require('fs'); +const file = fs.createWriteStream('example.txt'); +file.write('hello, '); +file.end('world!'); +// Writing more now is not allowed! +``` + +##### writable.setDefaultEncoding(encoding)[#](#stream_writable_setdefaultencoding_encoding) + +History + +| Version | Changes | +| --- | --- | +| v6.1.0 | This method now returns a reference to `writable`. | +| v0.11.15 | Added in: v0.11.15 | + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The new default encoding +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `writable.setDefaultEncoding()` method sets the default `encoding` for a +[`Writable`](#stream_class_stream_writable) stream. + +##### writable.uncork()[#](#stream_writable_uncork) + +Added in: v0.11.2 + +The `writable.uncork()` method flushes all data buffered since +[`stream.cork()`](#stream_writable_cork) was called. + +When using [`writable.cork()`](#stream_writable_cork) and `writable.uncork()` to manage the buffering +of writes to a stream, it is recommended that calls to `writable.uncork()` be +deferred using `process.nextTick()`. Doing so allows batching of all +`writable.write()` calls that occur within a given Node.js event loop phase. + +```None +stream.cork(); +stream.write('some '); +stream.write('data '); +process.nextTick(() => stream.uncork()); +``` + +If the [`writable.cork()`](#stream_writable_cork) method is called multiple times on a stream, the +same number of calls to `writable.uncork()` must be called to flush the buffered +data. + +```None +stream.cork(); +stream.write('some '); +stream.cork(); +stream.write('data '); +process.nextTick(() => { + stream.uncork(); + // The data will not be flushed until uncork() is called a second time. + stream.uncork(); +}); +``` + +See also: [`writable.cork()`](#stream_writable_cork). + +##### writable.writable[#](#stream_writable_writable) + +Added in: v11.4.0 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +Is `true` if it is safe to call [`writable.write()`][]. + +##### writable.writableHighWaterMark[#](#stream_writable_writablehighwatermark) + +Added in: v9.3.0 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Return the value of `highWaterMark` passed when constructing this +`Writable`. + +##### writable.writableLength[#](#stream_writable_writablelength) + +Added in: v9.4.0 + +This property contains the number of bytes (or objects) in the queue +ready to be written. The value provides introspection data regarding +the status of the `highWaterMark`. + +##### writable.write(chunk[, encoding][, callback])[#](#stream_writable_write_chunk_encoding_callback) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `chunk` argument can now be a `Uint8Array` instance. | +| v6.0.0 | Passing `null` as the `chunk` parameter will always be considered invalid now, even in object mode. | +| v0.9.4 | Added in: v0.9.4 | + +* `chunk` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) Optional data to write. For streams + not operating in object mode, `chunk` must be a string, `Buffer` or + `Uint8Array`. For object mode streams, `chunk` may be any JavaScript value + other than `null`. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding, if `chunk` is a string +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Callback for when this chunk of data is flushed +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `false` if the stream wishes for the calling code to + wait for the `'drain'` event to be emitted before continuing to write + additional data; otherwise `true`. + +The `writable.write()` method writes some data to the stream, and calls the +supplied `callback` once the data has been fully handled. If an error +occurs, the `callback` *may or may not* be called with the error as its +first argument. To reliably detect write errors, add a listener for the +`'error'` event. + +The return value is `true` if the internal buffer is less than the +`highWaterMark` configured when the stream was created after admitting `chunk`. +If `false` is returned, further attempts to write data to the stream should +stop until the [`'drain'`](#stream_event_drain) event is emitted. + +While a stream is not draining, calls to `write()` will buffer `chunk`, and +return false. Once all currently buffered chunks are drained (accepted for +delivery by the operating system), the `'drain'` event will be emitted. +It is recommended that once `write()` returns false, no more chunks be written +until the `'drain'` event is emitted. While calling `write()` on a stream that +is not draining is allowed, Node.js will buffer all written chunks until +maximum memory usage occurs, at which point it will abort unconditionally. +Even before it aborts, high memory usage will cause poor garbage collector +performance and high RSS (which is not typically released back to the system, +even after the memory is no longer required). Since TCP sockets may never +drain if the remote peer does not read the data, writing a socket that is +not draining may lead to a remotely exploitable vulnerability. + +Writing data while the stream is not draining is particularly +problematic for a [`Transform`](#stream_class_stream_transform), because the `Transform` streams are paused +by default until they are piped or a `'data'` or `'readable'` event handler +is added. + +If the data to be written can be generated or fetched on demand, it is +recommended to encapsulate the logic into a [`Readable`](#stream_class_stream_readable) and use +[`stream.pipe()`](#stream_readable_pipe_destination_options). However, if calling `write()` is preferred, it is +possible to respect backpressure and avoid memory issues using the +[`'drain'`](#stream_event_drain) event: + +```None +function write(data, cb) { + if (!stream.write(data)) { + stream.once('drain', cb); + } else { + process.nextTick(cb); + } +} + +// Wait for cb to be called before doing any other write. +write('hello', () => { + console.log('Write completed, do more writes now.'); +}); +``` + +A `Writable` stream in object mode will always ignore the `encoding` argument. + +### Readable Streams[#](#stream_readable_streams) + +Readable streams are an abstraction for a *source* from which data is +consumed. + +Examples of `Readable` streams include: + +* [HTTP responses, on the client](http.html#http_class_http_incomingmessage) +* [HTTP requests, on the server](http.html#http_class_http_incomingmessage) +* [fs read streams](fs.html#fs_class_fs_readstream) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) +* [TCP sockets](net.html#net_class_net_socket) +* [child process stdout and stderr](child_process.html#child_process_subprocess_stdout) +* [`process.stdin`](process.html#process_process_stdin) + +All [`Readable`](#stream_class_stream_readable) streams implement the interface defined by the +`stream.Readable` class. + +#### Two Reading Modes[#](#stream_two_reading_modes) + +`Readable` streams effectively operate in one of two modes: flowing and +paused. These modes are separate from [object mode](#stream_object_mode). +A [`Readable`](#stream_class_stream_readable) stream can be in object mode or not, regardless of whether +it is in flowing mode or paused mode. + +* In flowing mode, data is read from the underlying system automatically + and provided to an application as quickly as possible using events via the + [`EventEmitter`](events.html#events_class_eventemitter) interface. +* In paused mode, the [`stream.read()`](#stream_readable_read_size) method must be called + explicitly to read chunks of data from the stream. + +All [`Readable`](#stream_class_stream_readable) streams begin in paused mode but can be switched to flowing +mode in one of the following ways: + +* Adding a [`'data'`](#stream_event_data) event handler. +* Calling the [`stream.resume()`](#stream_readable_resume) method. +* Calling the [`stream.pipe()`](#stream_readable_pipe_destination_options) method to send the data to a [`Writable`](#stream_class_stream_writable). + +The `Readable` can switch back to paused mode using one of the following: + +* If there are no pipe destinations, by calling the + [`stream.pause()`](#stream_readable_pause) method. +* If there are pipe destinations, by removing all pipe destinations. + Multiple pipe destinations may be removed by calling the + [`stream.unpipe()`](#stream_readable_unpipe_destination) method. + +The important concept to remember is that a `Readable` will not generate data +until a mechanism for either consuming or ignoring that data is provided. If +the consuming mechanism is disabled or taken away, the `Readable` will *attempt* +to stop generating the data. + +For backward compatibility reasons, removing [`'data'`](#stream_event_data) event handlers will +**not** automatically pause the stream. Also, if there are piped destinations, +then calling [`stream.pause()`](#stream_readable_pause) will not guarantee that the +stream will *remain* paused once those destinations drain and ask for more data. + +If a [`Readable`](#stream_class_stream_readable) is switched into flowing mode and there are no consumers +available to handle the data, that data will be lost. This can occur, for +instance, when the `readable.resume()` method is called without a listener +attached to the `'data'` event, or when a `'data'` event handler is removed +from the stream. + +Adding a [`'readable'`](#stream_event_readable) event handler automatically make the stream to +stop flowing, and the data to be consumed via +[`readable.read()`](#stream_readable_read_size). If the [`'readable'`](#stream_event_readable) event handler is +removed, then the stream will start flowing again if there is a +[`'data'`](#stream_event_data) event handler. + +#### Three States[#](#stream_three_states) + +The "two modes" of operation for a `Readable` stream are a simplified +abstraction for the more complicated internal state management that is happening +within the `Readable` stream implementation. + +Specifically, at any given point in time, every `Readable` is in one of three +possible states: + +* `readable.readableFlowing === null` +* `readable.readableFlowing === false` +* `readable.readableFlowing === true` + +When `readable.readableFlowing` is `null`, no mechanism for consuming the +stream's data is provided. Therefore, the stream will not generate data. +While in this state, attaching a listener for the `'data'` event, calling the +`readable.pipe()` method, or calling the `readable.resume()` method will switch +`readable.readableFlowing` to `true`, causing the `Readable` to begin actively +emitting events as data is generated. + +Calling `readable.pause()`, `readable.unpipe()`, or receiving backpressure +will cause the `readable.readableFlowing` to be set as `false`, +temporarily halting the flowing of events but *not* halting the generation of +data. While in this state, attaching a listener for the `'data'` event +will not switch `readable.readableFlowing` to `true`. + +```None +const { PassThrough, Writable } = require('stream'); +const pass = new PassThrough(); +const writable = new Writable(); + +pass.pipe(writable); +pass.unpipe(writable); +// readableFlowing is now false + +pass.on('data', (chunk) => { console.log(chunk.toString()); }); +pass.write('ok'); // will not emit 'data' +pass.resume(); // Must be called to make stream emit 'data' +``` + +While `readable.readableFlowing` is `false`, data may be accumulating +within the stream's internal buffer. + +#### Choose One API Style[#](#stream_choose_one_api_style) + +The `Readable` stream API evolved across multiple Node.js versions and provides +multiple methods of consuming stream data. In general, developers should choose +*one* of the methods of consuming data and *should never* use multiple methods +to consume data from a single stream. Specifically, using a combination +of `on('data')`, `on('readable')`, `pipe()`, or async iterators could +lead to unintuitive behavior. + +Use of the `readable.pipe()` method is recommended for most users as it has been +implemented to provide the easiest way of consuming stream data. Developers that +require more fine-grained control over the transfer and generation of data can +use the [`EventEmitter`](events.html#events_class_eventemitter) and `readable.on('readable')`/`readable.read()` +or the `readable.pause()`/`readable.resume()` APIs. + +#### Class: stream.Readable[#](#stream_class_stream_readable) + +Added in: v0.9.4 + +##### Event: 'close'[#](#stream_event_close_1) + +History + +| Version | Changes | +| --- | --- | +| v10.0.0 | Add `emitClose` option to specify if `'close'` is emitted on destroy. | +| v0.9.4 | Added in: v0.9.4 | + +The `'close'` event is emitted when the stream and any of its underlying +resources (a file descriptor, for example) have been closed. The event indicates +that no more events will be emitted, and no further computation will occur. + +A [`Readable`](#stream_class_stream_readable) stream will always emit the `'close'` event if it is +created with the `emitClose` option. + +##### Event: 'data'[#](#stream_event_data) + +Added in: v0.9.4 + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) The chunk of data. For streams that are not + operating in object mode, the chunk will be either a string or `Buffer`. + For streams that are in object mode, the chunk can be any JavaScript value + other than `null`. + +The `'data'` event is emitted whenever the stream is relinquishing ownership of +a chunk of data to a consumer. This may occur whenever the stream is switched +in flowing mode by calling `readable.pipe()`, `readable.resume()`, or by +attaching a listener callback to the `'data'` event. The `'data'` event will +also be emitted whenever the `readable.read()` method is called and a chunk of +data is available to be returned. + +Attaching a `'data'` event listener to a stream that has not been explicitly +paused will switch the stream into flowing mode. Data will then be passed as +soon as it is available. + +The listener callback will be passed the chunk of data as a string if a default +encoding has been specified for the stream using the +`readable.setEncoding()` method; otherwise the data will be passed as a +`Buffer`. + +```None +const readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log(`Received ${chunk.length} bytes of data.`); +}); +``` + +##### Event: 'end'[#](#stream_event_end) + +Added in: v0.9.4 + +The `'end'` event is emitted when there is no more data to be consumed from +the stream. + +The `'end'` event **will not be emitted** unless the data is completely +consumed. This can be accomplished by switching the stream into flowing mode, +or by calling [`stream.read()`](#stream_readable_read_size) repeatedly until all data has been +consumed. + +```None +const readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log(`Received ${chunk.length} bytes of data.`); +}); +readable.on('end', () => { + console.log('There will be no more data.'); +}); +``` + +##### Event: 'error'[#](#stream_event_error_1) + +Added in: v0.9.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + +The `'error'` event may be emitted by a `Readable` implementation at any time. +Typically, this may occur if the underlying stream is unable to generate data +due to an underlying internal failure, or when a stream implementation attempts +to push an invalid chunk of data. + +The listener callback will be passed a single `Error` object. + +##### Event: 'pause'[#](#stream_event_pause) + +Added in: v0.9.4 + +The `'pause'` event is emitted when [`stream.pause()`](#stream_readable_pause) is called +and `readableFlowing` is not `false`. + +##### Event: 'readable'[#](#stream_event_readable) + +History + +| Version | Changes | +| --- | --- | +| v10.0.0 | The `'readable'` is always emitted in the next tick after `.push()` is called. | +| v10.0.0 | Using `'readable'` requires calling `.read()`. | +| v0.9.4 | Added in: v0.9.4 | + +The `'readable'` event is emitted when there is data available to be read from +the stream. In some cases, attaching a listener for the `'readable'` event will +cause some amount of data to be read into an internal buffer. + +```None +const readable = getReadableStreamSomehow(); +readable.on('readable', function() { + // There is some data to read now + let data; + + while (data = this.read()) { + console.log(data); + } +}); +``` + +The `'readable'` event will also be emitted once the end of the stream data +has been reached but before the `'end'` event is emitted. + +Effectively, the `'readable'` event indicates that the stream has new +information: either new data is available or the end of the stream has been +reached. In the former case, [`stream.read()`](#stream_readable_read_size) will return the +available data. In the latter case, [`stream.read()`](#stream_readable_read_size) will return +`null`. For instance, in the following example, `foo.txt` is an empty file: + +```None +const fs = require('fs'); +const rr = fs.createReadStream('foo.txt'); +rr.on('readable', () => { + console.log(`readable: ${rr.read()}`); +}); +rr.on('end', () => { + console.log('end'); +}); +``` + +The output of running this script is: + +```None +$ node test.js +readable: null +end +``` + +In general, the `readable.pipe()` and `'data'` event mechanisms are easier to +understand than the `'readable'` event. However, handling `'readable'` might +result in increased throughput. + +If both `'readable'` and [`'data'`](#stream_event_data) are used at the same time, `'readable'` +takes precedence in controlling the flow, i.e. `'data'` will be emitted +only when [`stream.read()`](#stream_readable_read_size) is called. The +`readableFlowing` property would become `false`. +If there are `'data'` listeners when `'readable'` is removed, the stream +will start flowing, i.e. `'data'` events will be emitted without calling +`.resume()`. + +##### Event: 'resume'[#](#stream_event_resume) + +Added in: v0.9.4 + +The `'resume'` event is emitted when [`stream.resume()`](#stream_readable_resume) is +called and `readableFlowing` is not `true`. + +##### readable.destroy([error])[#](#stream_readable_destroy_error) + +Added in: v8.0.0 + +* `error` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) Error which will be passed as payload in `'error'` event +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'` +event unless `emitClose` is set in `false`. After this call, the readable +stream will release any internal resources and subsequent calls to `push()` +will be ignored. +Implementors should not override this method, but instead implement +[`readable._destroy()`](#stream_readable_destroy_err_callback). + +##### readable.isPaused()[#](#stream_readable_ispaused) + +Added in: v0.11.14 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +The `readable.isPaused()` method returns the current operating state of the +`Readable`. This is used primarily by the mechanism that underlies the +`readable.pipe()` method. In most typical cases, there will be no reason to +use this method directly. + +```None +const readable = new stream.Readable(); + +readable.isPaused(); // === false +readable.pause(); +readable.isPaused(); // === true +readable.resume(); +readable.isPaused(); // === false +``` + +##### readable.pause()[#](#stream_readable_pause) + +Added in: v0.9.4 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `readable.pause()` method will cause a stream in flowing mode to stop +emitting [`'data'`](#stream_event_data) events, switching out of flowing mode. Any data that +becomes available will remain in the internal buffer. + +```None +const readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log(`Received ${chunk.length} bytes of data.`); + readable.pause(); + console.log('There will be no additional data for 1 second.'); + setTimeout(() => { + console.log('Now data will start flowing again.'); + readable.resume(); + }, 1000); +}); +``` + +The `readable.pause()` method has no effect if there is a `'readable'` +event listener. + +##### readable.pipe(destination[, options])[#](#stream_readable_pipe_destination_options) + +Added in: v0.9.4 + +* `destination` [](stream.html#stream_class_stream_writable) The destination for writing data +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Pipe options + + + `end` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) End the writer when the reader ends. **Default:** `true`. +* Returns: [](stream.html#stream_class_stream_writable) The *destination*, allowing for a chain of pipes if + it is a [`Duplex`](#stream_class_stream_duplex) or a [`Transform`](#stream_class_stream_transform) stream + +The `readable.pipe()` method attaches a [`Writable`](#stream_class_stream_writable) stream to the `readable`, +causing it to switch automatically into flowing mode and push all of its data +to the attached [`Writable`](#stream_class_stream_writable). The flow of data will be automatically managed +so that the destination `Writable` stream is not overwhelmed by a faster +`Readable` stream. + +The following example pipes all of the data from the `readable` into a file +named `file.txt`: + +```None +const fs = require('fs'); +const readable = getReadableStreamSomehow(); +const writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt' +readable.pipe(writable); +``` + +It is possible to attach multiple `Writable` streams to a single `Readable` +stream. + +The `readable.pipe()` method returns a reference to the *destination* stream +making it possible to set up chains of piped streams: + +```None +const fs = require('fs'); +const r = fs.createReadStream('file.txt'); +const z = zlib.createGzip(); +const w = fs.createWriteStream('file.txt.gz'); +r.pipe(z).pipe(w); +``` + +By default, [`stream.end()`](#stream_writable_end_chunk_encoding_callback) is called on the destination `Writable` +stream when the source `Readable` stream emits [`'end'`](#stream_event_end), so that the +destination is no longer writable. To disable this default behavior, the `end` +option can be passed as `false`, causing the destination stream to remain open: + +```None +reader.pipe(writer, { end: false }); +reader.on('end', () => { + writer.end('Goodbye\n'); +}); +``` + +One important caveat is that if the `Readable` stream emits an error during +processing, the `Writable` destination *is not closed* automatically. If an +error occurs, it will be necessary to *manually* close each stream in order +to prevent memory leaks. + +The [`process.stderr`](process.html#process_process_stderr) and [`process.stdout`](process.html#process_process_stdout) `Writable` streams are never +closed until the Node.js process exits, regardless of the specified options. + +##### readable.read([size])[#](#stream_readable_read_size) + +Added in: v0.9.4 + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Optional argument to specify how much data to read. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Null_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) + +The `readable.read()` method pulls some data out of the internal buffer and +returns it. If no data available to be read, `null` is returned. By default, +the data will be returned as a `Buffer` object unless an encoding has been +specified using the `readable.setEncoding()` method or the stream is operating +in object mode. + +The optional `size` argument specifies a specific number of bytes to read. If +`size` bytes are not available to be read, `null` will be returned *unless* +the stream has ended, in which case all of the data remaining in the internal +buffer will be returned. + +If the `size` argument is not specified, all of the data contained in the +internal buffer will be returned. + +The `readable.read()` method should only be called on `Readable` streams +operating in paused mode. In flowing mode, `readable.read()` is called +automatically until the internal buffer is fully drained. + +```None +const readable = getReadableStreamSomehow(); +readable.on('readable', () => { + let chunk; + while (null !== (chunk = readable.read())) { + console.log(`Received ${chunk.length} bytes of data.`); + } +}); +``` + +Note that the `while` loop is necessary when processing data with +`readable.read()`. Only after `readable.read()` returns `null`, +`'readable'` will be emitted. + +A `Readable` stream in object mode will always return a single item from +a call to [`readable.read(size)`](#stream_readable_read_size), regardless of the value of the +`size` argument. + +If the `readable.read()` method returns a chunk of data, a `'data'` event will +also be emitted. + +Calling [`stream.read([size])`](#stream_readable_read_size) after the [`'end'`](#stream_event_end) event has +been emitted will return `null`. No runtime error will be raised. + +##### readable.readable[#](#stream_readable_readable) + +Added in: v11.4.0 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +Is `true` if it is safe to call [`readable.read()`][]. + +##### readable.readableHighWaterMark[#](#stream_readable_readablehighwatermark) + +Added in: v9.3.0 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Returns the value of `highWaterMark` passed when constructing this +`Readable`. + +##### readable.readableLength[#](#stream_readable_readablelength) + +Added in: v9.4.0 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +This property contains the number of bytes (or objects) in the queue +ready to be read. The value provides introspection data regarding +the status of the `highWaterMark`. + +##### readable.resume()[#](#stream_readable_resume) + +History + +| Version | Changes | +| --- | --- | +| v10.0.0 | The `resume()` has no effect if there is a `'readable'` event listening. | +| v0.9.4 | Added in: v0.9.4 | + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `readable.resume()` method causes an explicitly paused `Readable` stream to +resume emitting [`'data'`](#stream_event_data) events, switching the stream into flowing mode. + +The `readable.resume()` method can be used to fully consume the data from a +stream without actually processing any of that data: + +```None +getReadableStreamSomehow() + .resume() + .on('end', () => { + console.log('Reached the end, but did not read anything.'); + }); +``` + +The `readable.resume()` method has no effect if there is a `'readable'` +event listener. + +##### readable.setEncoding(encoding)[#](#stream_readable_setencoding_encoding) + +Added in: v0.9.4 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding to use. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `readable.setEncoding()` method sets the character encoding for +data read from the `Readable` stream. + +By default, no encoding is assigned and stream data will be returned as +`Buffer` objects. Setting an encoding causes the stream data +to be returned as strings of the specified encoding rather than as `Buffer` +objects. For instance, calling `readable.setEncoding('utf8')` will cause the +output data to be interpreted as UTF-8 data, and passed as strings. Calling +`readable.setEncoding('hex')` will cause the data to be encoded in hexadecimal +string format. + +The `Readable` stream will properly handle multi-byte characters delivered +through the stream that would otherwise become improperly decoded if simply +pulled from the stream as `Buffer` objects. + +```None +const readable = getReadableStreamSomehow(); +readable.setEncoding('utf8'); +readable.on('data', (chunk) => { + assert.equal(typeof chunk, 'string'); + console.log('Got %d characters of string data:', chunk.length); +}); +``` + +##### readable.unpipe([destination])[#](#stream_readable_unpipe_destination) + +Added in: v0.9.4 + +* `destination` [](stream.html#stream_class_stream_writable) Optional specific stream to unpipe +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `readable.unpipe()` method detaches a `Writable` stream previously attached +using the [`stream.pipe()`](#stream_readable_pipe_destination_options) method. + +If the `destination` is not specified, then *all* pipes are detached. + +If the `destination` is specified, but no pipe is set up for it, then +the method does nothing. + +```None +const fs = require('fs'); +const readable = getReadableStreamSomehow(); +const writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt', +// but only for the first second +readable.pipe(writable); +setTimeout(() => { + console.log('Stop writing to file.txt.'); + readable.unpipe(writable); + console.log('Manually close the file stream.'); + writable.end(); +}, 1000); +``` + +##### readable.unshift(chunk)[#](#stream_readable_unshift_chunk) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `chunk` argument can now be a `Uint8Array` instance. | +| v0.9.11 | Added in: v0.9.11 | + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) Chunk of data to unshift onto the + read queue. For streams not operating in object mode, `chunk` must be a + string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be + any JavaScript value other than `null`. + +The `readable.unshift()` method pushes a chunk of data back into the internal +buffer. This is useful in certain situations where a stream is being consumed by +code that needs to "un-consume" some amount of data that it has optimistically +pulled out of the source, so that the data can be passed on to some other party. + +The `stream.unshift(chunk)` method cannot be called after the [`'end'`](#stream_event_end) event +has been emitted or a runtime error will be thrown. + +Developers using `stream.unshift()` often should consider switching to +use of a [`Transform`](#stream_class_stream_transform) stream instead. See the [API for Stream Implementers](#stream_api_for_stream_implementers) +section for more information. + +```None +// Pull off a header delimited by \n\n +// use unshift() if we get too much +// Call the callback with (error, header, stream) +const { StringDecoder } = require('string_decoder'); +function parseHeader(stream, callback) { + stream.on('error', callback); + stream.on('readable', onReadable); + const decoder = new StringDecoder('utf8'); + let header = ''; + function onReadable() { + let chunk; + while (null !== (chunk = stream.read())) { + const str = decoder.write(chunk); + if (str.match(/\n\n/)) { + // found the header boundary + const split = str.split(/\n\n/); + header += split.shift(); + const remaining = split.join('\n\n'); + const buf = Buffer.from(remaining, 'utf8'); + stream.removeListener('error', callback); + // Remove the 'readable' listener before unshifting + stream.removeListener('readable', onReadable); + if (buf.length) + stream.unshift(buf); + // Now the body of the message can be read from the stream. + callback(null, header, stream); + } else { + // still reading the header. + header += str; + } + } + } +} +``` + +Unlike [`stream.push(chunk)`](#stream_readable_push_chunk_encoding), `stream.unshift(chunk)` will not +end the reading process by resetting the internal reading state of the stream. +This can cause unexpected results if `readable.unshift()` is called during a +read (i.e. from within a [`stream._read()`](#stream_readable_read_size_1) implementation on a +custom stream). Following the call to `readable.unshift()` with an immediate +[`stream.push('')`](#stream_readable_push_chunk_encoding) will reset the reading state appropriately, +however it is best to simply avoid calling `readable.unshift()` while in the +process of performing a read. + +##### readable.wrap(stream)[#](#stream_readable_wrap_stream) + +Added in: v0.9.4 + +* `stream` [](stream.html#stream_stream) An "old style" readable stream +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +Prior to Node.js 0.10, streams did not implement the entire `stream` module API +as it is currently defined. (See [Compatibility](#stream_compatibility_with_older_node_js_versions) for more information.) + +When using an older Node.js library that emits [`'data'`](#stream_event_data) events and has a +[`stream.pause()`](#stream_readable_pause) method that is advisory only, the +`readable.wrap()` method can be used to create a [`Readable`](#stream_class_stream_readable) stream that uses +the old stream as its data source. + +It will rarely be necessary to use `readable.wrap()` but the method has been +provided as a convenience for interacting with older Node.js applications and +libraries. + +```None +const { OldReader } = require('./old-api-module.js'); +const { Readable } = require('stream'); +const oreader = new OldReader(); +const myReader = new Readable().wrap(oreader); + +myReader.on('readable', () => { + myReader.read(); // etc. +}); +``` + +##### readable[Symbol.asyncIterator]()[#](#stream_readable_symbol_asynciterator) + +History + +| Version | Changes | +| --- | --- | +| v11.14.0 | Symbol.asyncIterator support is no longer experimental. | +| v10.0.0 | Added in: v10.0.0 | + +[Stability: 2](documentation.html#documentation_stability_index) - Stable + +* Returns: [](https://tc39.github.io/ecma262/#sec-asynciterator-interface) to fully consume the stream. + +```None +const fs = require('fs'); + +async function print(readable) { + readable.setEncoding('utf8'); + let data = ''; + for await (const k of readable) { + data += k; + } + console.log(data); +} + +print(fs.createReadStream('file')).catch(console.log); +``` + +If the loop terminates with a `break` or a `throw`, the stream will be +destroyed. In other terms, iterating over a stream will consume the stream +fully. The stream will be read in chunks of size equal to the `highWaterMark` +option. In the code example above, data will be in a single chunk if the file +has less then 64kb of data because no `highWaterMark` option is provided to +[`fs.createReadStream()`](fs.html#fs_fs_createreadstream_path_options). + +### Duplex and Transform Streams[#](#stream_duplex_and_transform_streams) + +#### Class: stream.Duplex[#](#stream_class_stream_duplex) + +History + +| Version | Changes | +| --- | --- | +| v6.8.0 | Instances of `Duplex` now return `true` when checking `instanceof stream.Writable`. | +| v0.9.4 | Added in: v0.9.4 | + +Duplex streams are streams that implement both the [`Readable`](#stream_class_stream_readable) and +[`Writable`](#stream_class_stream_writable) interfaces. + +Examples of `Duplex` streams include: + +* [TCP sockets](net.html#net_class_net_socket) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) + +#### Class: stream.Transform[#](#stream_class_stream_transform) + +Added in: v0.9.4 + +Transform streams are [`Duplex`](#stream_class_stream_duplex) streams where the output is in some way +related to the input. Like all [`Duplex`](#stream_class_stream_duplex) streams, `Transform` streams +implement both the [`Readable`](#stream_class_stream_readable) and [`Writable`](#stream_class_stream_writable) interfaces. + +Examples of `Transform` streams include: + +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) + +##### transform.destroy([error])[#](#stream_transform_destroy_error) + +Added in: v8.0.0 + +* `error` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + +Destroy the stream, and optionally emit an `'error'` event. After this call, the +transform stream would release any internal resources. +Implementors should not override this method, but instead implement +[`readable._destroy()`](#stream_readable_destroy_err_callback). +The default implementation of `_destroy()` for `Transform` also emit `'close'` +unless `emitClose` is set in false. + +### stream.finished(stream[, options], callback)[#](#stream_stream_finished_stream_options_callback) + +Added in: v10.0.0 + +* `stream` [](stream.html#stream_stream) A readable and/or writable stream. +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `error` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If set to `false`, then a call to `emit('error', err)` is + not treated as finished. **Default**: `true`. + + `readable` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) When set to `false`, the callback will be called when + the stream ends even though the stream might still be readable. + **Default**: `true`. + + `writable` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) When set to `false`, the callback will be called when + the stream ends even though the stream might still be writable. + **Default**: `true`. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function that takes an optional error + argument. + +A function to get notified when a stream is no longer readable, writable +or has experienced an error or a premature close event. + +```None +const { finished } = require('stream'); + +const rs = fs.createReadStream('archive.tar'); + +finished(rs, (err) => { + if (err) { + console.error('Stream failed.', err); + } else { + console.log('Stream is done reading.'); + } +}); + +rs.resume(); // drain the stream +``` + +Especially useful in error handling scenarios where a stream is destroyed +prematurely (like an aborted HTTP request), and will not emit `'end'` +or `'finish'`. + +The `finished` API is promisify-able as well; + +```None +const finished = util.promisify(stream.finished); + +const rs = fs.createReadStream('archive.tar'); + +async function run() { + await finished(rs); + console.log('Stream is done reading.'); +} + +run().catch(console.error); +rs.resume(); // drain the stream +``` + +### stream.pipeline(...streams, callback)[#](#stream_stream_pipeline_streams_callback) + +Added in: v10.0.0 + +* `...streams` [](stream.html#stream_stream) Two or more streams to pipe between. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Called when the pipeline is fully done. + + + `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + +A module method to pipe between streams forwarding errors and properly cleaning +up and provide a callback when the pipeline is complete. + +```None +const { pipeline } = require('stream'); +const fs = require('fs'); +const zlib = require('zlib'); + +// Use the pipeline API to easily pipe a series of streams +// together and get notified when the pipeline is fully done. + +// A pipeline to gzip a potentially huge tar file efficiently: + +pipeline( + fs.createReadStream('archive.tar'), + zlib.createGzip(), + fs.createWriteStream('archive.tar.gz'), + (err) => { + if (err) { + console.error('Pipeline failed.', err); + } else { + console.log('Pipeline succeeded.'); + } + } +); +``` + +The `pipeline` API is promisify-able as well: + +```None +const pipeline = util.promisify(stream.pipeline); + +async function run() { + await pipeline( + fs.createReadStream('archive.tar'), + zlib.createGzip(), + fs.createWriteStream('archive.tar.gz') + ); + console.log('Pipeline succeeded.'); +} + +run().catch(console.error); +``` + +## API for Stream Implementers[#](#stream_api_for_stream_implementers) + +The `stream` module API has been designed to make it possible to easily +implement streams using JavaScript's prototypal inheritance model. + +First, a stream developer would declare a new JavaScript class that extends one +of the four basic stream classes (`stream.Writable`, `stream.Readable`, +`stream.Duplex`, or `stream.Transform`), making sure they call the appropriate +parent class constructor: + +```None +const { Writable } = require('stream'); + +class MyWritable extends Writable { + constructor(options) { + super(options); + // ... + } +} +``` + +The new stream class must then implement one or more specific methods, depending +on the type of stream being created, as detailed in the chart below: + +| Use-case | Class | Method(s) to implement | +| --- | --- | --- | +| Reading only | [`Readable`](#stream_class_stream_readable) | `_read` | +| Writing only | [`Writable`](#stream_class_stream_writable) | `_write`, `_writev`, `_final` | +| Reading and writing | [`Duplex`](#stream_class_stream_duplex) | `_read`, `_write`, `_writev`, `_final` | +| Operate on written data, then read the result | [`Transform`](#stream_class_stream_transform) | `_transform`, `_flush`, `_final` | + +The implementation code for a stream should *never* call the "public" methods +of a stream that are intended for use by consumers (as described in the +[API for Stream Consumers](#stream_api_for_stream_consumers) section). Doing so may lead to adverse side effects +in application code consuming the stream. + +### Simplified Construction[#](#stream_simplified_construction) + +Added in: v1.2.0 + +For many simple cases, it is possible to construct a stream without relying on +inheritance. This can be accomplished by directly creating instances of the +`stream.Writable`, `stream.Readable`, `stream.Duplex` or `stream.Transform` +objects and passing appropriate methods as constructor options. + +```None +const { Writable } = require('stream'); + +const myWritable = new Writable({ + write(chunk, encoding, callback) { + // ... + } +}); +``` + +### Implementing a Writable Stream[#](#stream_implementing_a_writable_stream) + +The `stream.Writable` class is extended to implement a [`Writable`](#stream_class_stream_writable) stream. + +Custom `Writable` streams *must* call the `new stream.Writable([options])` +constructor and implement the `writable._write()` method. The +`writable._writev()` method *may* also be implemented. + +#### Constructor: new stream.Writable([options])[#](#stream_constructor_new_stream_writable_options) + +History + +| Version | Changes | +| --- | --- | +| v11.2.0 | Add `autoDestroy` option to automatically `destroy()` the stream when it emits `'finish'` or errors. | +| v10.0.0 | Add `emitClose` option to specify if `'close'` is emitted on destroy. | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `highWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Buffer level when + [`stream.write()`](#stream_writable_write_chunk_encoding_callback) starts returning `false`. **Default:** + `16384` (16kb), or `16` for `objectMode` streams. + + `decodeStrings` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether to encode `string`s passed to + [`stream.write()`](#stream_writable_write_chunk_encoding_callback) to `Buffer`s (with the encoding + specified in the [`stream.write()`](#stream_writable_write_chunk_encoding_callback) call) before passing + them to [`stream._write()`](#stream_writable_write_chunk_encoding_callback_1). Other types of data are not + converted (i.e. `Buffer`s are not decoded into `string`s). Setting to + false will prevent `string`s from being converted. **Default:** `true`. + + `defaultEncoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The default encoding that is used when no + encoding is specified as an argument to [`stream.write()`](#stream_writable_write_chunk_encoding_callback). + **Default:** `'utf8'`. + + `objectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether or not the + [`stream.write(anyObj)`](#stream_writable_write_chunk_encoding_callback) is a valid operation. When set, + it becomes possible to write JavaScript values other than string, + `Buffer` or `Uint8Array` if supported by the stream implementation. + **Default:** `false`. + + `emitClose` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether or not the stream should emit `'close'` + after it has been destroyed. **Default:** `true`. + + `write` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._write()`](#stream_writable_write_chunk_encoding_callback_1) method. + + `writev` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._writev()`](#stream_writable_writev_chunks_callback) method. + + `destroy` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._destroy()`](#stream_writable_destroy_err_callback) method. + + `final` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._final()`](#stream_writable_final_callback) method. + + `autoDestroy` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether this stream should automatically call + `.destroy()` on itself after ending. **Default:** `false`. + +```None +const { Writable } = require('stream'); + +class MyWritable extends Writable { + constructor(options) { + // Calls the stream.Writable() constructor + super(options); + // ... + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const { Writable } = require('stream'); +const util = require('util'); + +function MyWritable(options) { + if (!(this instanceof MyWritable)) + return new MyWritable(options); + Writable.call(this, options); +} +util.inherits(MyWritable, Writable); +``` + +Or, using the Simplified Constructor approach: + +```None +const { Writable } = require('stream'); + +const myWritable = new Writable({ + write(chunk, encoding, callback) { + // ... + }, + writev(chunks, callback) { + // ... + } +}); +``` + +#### writable.\_write(chunk, encoding, callback)[#](#stream_writable_write_chunk_encoding_callback_1) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) The `Buffer` to be written, converted from the + `string` passed to [`stream.write()`](#stream_writable_write_chunk_encoding_callback). If the stream's + `decodeStrings` option is `false` or the stream is operating in object mode, + the chunk will not be converted & will be whatever was passed to + [`stream.write()`](#stream_writable_write_chunk_encoding_callback). +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If the chunk is a string, then `encoding` is the + character encoding of that string. If chunk is a `Buffer`, or if the + stream is operating in object mode, `encoding` may be ignored. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Call this function (optionally with an error + argument) when processing is complete for the supplied chunk. + +All `Writable` stream implementations must provide a +[`writable._write()`](#stream_writable_write_chunk_encoding_callback_1) method to send data to the underlying +resource. + +[`Transform`](#stream_class_stream_transform) streams provide their own implementation of the +[`writable._write()`](#stream_writable_write_chunk_encoding_callback_1). + +This function MUST NOT be called by application code directly. It should be +implemented by child classes, and called by the internal `Writable` class +methods only. + +The `callback` method must be called to signal either that the write completed +successfully or failed with an error. The first argument passed to the +`callback` must be the `Error` object if the call failed or `null` if the +write succeeded. + +All calls to `writable.write()` that occur between the time `writable._write()` +is called and the `callback` is called will cause the written data to be +buffered. When the `callback` is invoked, the stream might emit a [`'drain'`](#stream_event_drain) +event. If a stream implementation is capable of processing multiple chunks of +data at once, the `writable._writev()` method should be implemented. + +If the `decodeStrings` property is explicitly set to `false` in the constructor +options, then `chunk` will remain the same object that is passed to `.write()`, +and may be a string rather than a `Buffer`. This is to support implementations +that have an optimized handling for certain string data encodings. In that case, +the `encoding` argument will indicate the character encoding of the string. +Otherwise, the `encoding` argument can be safely ignored. + +The `writable._write()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### writable.\_writev(chunks, callback)[#](#stream_writable_writev_chunks_callback) + +* `chunks` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) The chunks to be written. Each chunk has following + format: `{ chunk: ..., encoding: ... }`. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function (optionally with an error + argument) to be invoked when processing is complete for the supplied chunks. + +This function MUST NOT be called by application code directly. It should be +implemented by child classes, and called by the internal `Writable` class +methods only. + +The `writable._writev()` method may be implemented in addition to +`writable._write()` in stream implementations that are capable of processing +multiple chunks of data at once. If implemented, the method will be called with +all chunks of data currently buffered in the write queue. + +The `writable._writev()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### writable.\_destroy(err, callback)[#](#stream_writable_destroy_err_callback) + +Added in: v8.0.0 + +* `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) A possible error. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function that takes an optional error + argument. + +The `_destroy()` method is called by [`writable.destroy()`](#stream_writable_destroy_error). +It can be overridden by child classes but it **must not** be called directly. + +#### writable.\_final(callback)[#](#stream_writable_final_callback) + +Added in: v8.0.0 + +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Call this function (optionally with an error + argument) when finished writing any remaining data. + +The `_final()` method **must not** be called directly. It may be implemented +by child classes, and if so, will be called by the internal `Writable` +class methods only. + +This optional function will be called before the stream closes, delaying the +`'finish'` event until `callback` is called. This is useful to close resources +or write buffered data before a stream ends. + +#### Errors While Writing[#](#stream_errors_while_writing) + +It is recommended that errors occurring during the processing of the +`writable._write()` and `writable._writev()` methods are reported by invoking +the callback and passing the error as the first argument. This will cause an +`'error'` event to be emitted by the `Writable`. Throwing an `Error` from within +`writable._write()` can result in unexpected and inconsistent behavior depending +on how the stream is being used. Using the callback ensures consistent and +predictable handling of errors. + +If a `Readable` stream pipes into a `Writable` stream when `Writable` emits an +error, the `Readable` stream will be unpiped. + +```None +const { Writable } = require('stream'); + +const myWritable = new Writable({ + write(chunk, encoding, callback) { + if (chunk.toString().indexOf('a') >= 0) { + callback(new Error('chunk is invalid')); + } else { + callback(); + } + } +}); +``` + +#### An Example Writable Stream[#](#stream_an_example_writable_stream) + +The following illustrates a rather simplistic (and somewhat pointless) custom +`Writable` stream implementation. While this specific `Writable` stream instance +is not of any real particular usefulness, the example illustrates each of the +required elements of a custom [`Writable`](#stream_class_stream_writable) stream instance: + +```None +const { Writable } = require('stream'); + +class MyWritable extends Writable { + _write(chunk, encoding, callback) { + if (chunk.toString().indexOf('a') >= 0) { + callback(new Error('chunk is invalid')); + } else { + callback(); + } + } +} +``` + +#### Decoding buffers in a Writable Stream[#](#stream_decoding_buffers_in_a_writable_stream) + +Decoding buffers is a common task, for instance, when using transformers whose +input is a string. This is not a trivial process when using multi-byte +characters encoding, such as UTF-8. The following example shows how to decode +multi-byte strings using `StringDecoder` and [`Writable`](#stream_class_stream_writable). + +```None +const { Writable } = require('stream'); +const { StringDecoder } = require('string_decoder'); + +class StringWritable extends Writable { + constructor(options) { + super(options); + this._decoder = new StringDecoder(options && options.defaultEncoding); + this.data = ''; + } + _write(chunk, encoding, callback) { + if (encoding === 'buffer') { + chunk = this._decoder.write(chunk); + } + this.data += chunk; + callback(); + } + _final(callback) { + this.data += this._decoder.end(); + callback(); + } +} + +const euro = [[0xE2, 0x82], [0xAC]].map(Buffer.from); +const w = new StringWritable(); + +w.write('currency: '); +w.write(euro[0]); +w.end(euro[1]); + +console.log(w.data); // currency: € +``` + +### Implementing a Readable Stream[#](#stream_implementing_a_readable_stream) + +The `stream.Readable` class is extended to implement a [`Readable`](#stream_class_stream_readable) stream. + +Custom `Readable` streams *must* call the `new stream.Readable([options])` +constructor and implement the `readable._read()` method. + +#### new stream.Readable([options])[#](#stream_new_stream_readable_options) + +History + +| Version | Changes | +| --- | --- | +| v11.2.0 | Add `autoDestroy` option to automatically `destroy()` the stream when it emits `'end'` or errors. | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `highWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The maximum [number of bytes](#stream_highwatermark_discrepancy_after_calling_readable_setencoding) to store + in the internal buffer before ceasing to read from the underlying resource. + **Default:** `16384` (16kb), or `16` for `objectMode` streams. + + `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If specified, then buffers will be decoded to + strings using the specified encoding. **Default:** `null`. + + `objectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether this stream should behave + as a stream of objects. Meaning that [`stream.read(n)`](#stream_readable_read_size) returns + a single value instead of a `Buffer` of size `n`. **Default:** `false`. + + `read` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the [`stream._read()`](#stream_readable_read_size_1) + method. + + `destroy` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._destroy()`](#stream_readable_destroy_err_callback) method. + + `autoDestroy` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether this stream should automatically call + `.destroy()` on itself after ending. **Default:** `false`. + +```None +const { Readable } = require('stream'); + +class MyReadable extends Readable { + constructor(options) { + // Calls the stream.Readable(options) constructor + super(options); + // ... + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const { Readable } = require('stream'); +const util = require('util'); + +function MyReadable(options) { + if (!(this instanceof MyReadable)) + return new MyReadable(options); + Readable.call(this, options); +} +util.inherits(MyReadable, Readable); +``` + +Or, using the Simplified Constructor approach: + +```None +const { Readable } = require('stream'); + +const myReadable = new Readable({ + read(size) { + // ... + } +}); +``` + +#### readable.\_read(size)[#](#stream_readable_read_size_1) + +Added in: v0.9.4 + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Number of bytes to read asynchronously + +This function MUST NOT be called by application code directly. It should be +implemented by child classes, and called by the internal `Readable` class +methods only. + +All `Readable` stream implementations must provide an implementation of the +`readable._read()` method to fetch data from the underlying resource. + +When `readable._read()` is called, if data is available from the resource, the +implementation should begin pushing that data into the read queue using the +[`this.push(dataChunk)`](#stream_readable_push_chunk_encoding) method. `_read()` should continue reading +from the resource and pushing data until `readable.push()` returns `false`. Only +when `_read()` is called again after it has stopped should it resume pushing +additional data onto the queue. + +Once the `readable._read()` method has been called, it will not be called again +until the [`readable.push()`](#stream_readable_push_chunk_encoding) method is called. + +The `size` argument is advisory. For implementations where a "read" is a +single operation that returns data can use the `size` argument to determine how +much data to fetch. Other implementations may ignore this argument and simply +provide data whenever it becomes available. There is no need to "wait" until +`size` bytes are available before calling [`stream.push(chunk)`](#stream_readable_push_chunk_encoding). + +The `readable._read()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### readable.\_destroy(err, callback)[#](#stream_readable_destroy_err_callback) + +Added in: v8.0.0 + +* `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) A possible error. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function that takes an optional error + argument. + +The `_destroy()` method is called by [`readable.destroy()`](#stream_readable_destroy_error). +It can be overridden by child classes but it **must not** be called directly. + +#### readable.push(chunk[, encoding])[#](#stream_readable_push_chunk_encoding) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `chunk` argument can now be a `Uint8Array` instance. | + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Null_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) Chunk of data to push into the + read queue. For streams not operating in object mode, `chunk` must be a + string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be + any JavaScript value. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Encoding of string chunks. Must be a valid + `Buffer` encoding, such as `'utf8'` or `'ascii'`. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` if additional chunks of data may continue to be + pushed; `false` otherwise. + +When `chunk` is a `Buffer`, `Uint8Array` or `string`, the `chunk` of data will +be added to the internal queue for users of the stream to consume. +Passing `chunk` as `null` signals the end of the stream (EOF), after which no +more data can be written. + +When the `Readable` is operating in paused mode, the data added with +`readable.push()` can be read out by calling the +[`readable.read()`](#stream_readable_read_size) method when the [`'readable'`](#stream_event_readable) event is +emitted. + +When the `Readable` is operating in flowing mode, the data added with +`readable.push()` will be delivered by emitting a `'data'` event. + +The `readable.push()` method is designed to be as flexible as possible. For +example, when wrapping a lower-level source that provides some form of +pause/resume mechanism, and a data callback, the low-level source can be wrapped +by the custom `Readable` instance: + +```None +// `_source` is an object with readStop() and readStart() methods, +// and an `ondata` member that gets called when it has data, and +// an `onend` member that gets called when the data is over. + +class SourceWrapper extends Readable { + constructor(options) { + super(options); + + this._source = getLowLevelSourceObject(); + + // Every time there's data, push it into the internal buffer. + this._source.ondata = (chunk) => { + // If push() returns false, then stop reading from source + if (!this.push(chunk)) + this._source.readStop(); + }; + + // When the source ends, push the EOF-signaling `null` chunk + this._source.onend = () => { + this.push(null); + }; + } + // _read will be called when the stream wants to pull more data in + // the advisory size argument is ignored in this case. + _read(size) { + this._source.readStart(); + } +} +``` + +The `readable.push()` method is intended be called only by `Readable` +implementers, and only from within the `readable._read()` method. + +For streams not operating in object mode, if the `chunk` parameter of +`readable.push()` is `undefined`, it will be treated as empty string or +buffer. See [`readable.push('')`](#stream_readable_push) for more information. + +#### Errors While Reading[#](#stream_errors_while_reading) + +It is recommended that errors occurring during the processing of the +`readable._read()` method are emitted using the `'error'` event rather than +being thrown. Throwing an `Error` from within `readable._read()` can result in +unexpected and inconsistent behavior depending on whether the stream is +operating in flowing or paused mode. Using the `'error'` event ensures +consistent and predictable handling of errors. + +```None +const { Readable } = require('stream'); + +const myReadable = new Readable({ + read(size) { + if (checkSomeErrorCondition()) { + process.nextTick(() => this.emit('error', err)); + return; + } + // do some work + } +}); +``` + +#### An Example Counting Stream[#](#stream_an_example_counting_stream) + +The following is a basic example of a `Readable` stream that emits the numerals +from 1 to 1,000,000 in ascending order, and then ends. + +```None +const { Readable } = require('stream'); + +class Counter extends Readable { + constructor(opt) { + super(opt); + this._max = 1000000; + this._index = 1; + } + + _read() { + const i = this._index++; + if (i > this._max) + this.push(null); + else { + const str = String(i); + const buf = Buffer.from(str, 'ascii'); + this.push(buf); + } + } +} +``` + +### Implementing a Duplex Stream[#](#stream_implementing_a_duplex_stream) + +A [`Duplex`](#stream_class_stream_duplex) stream is one that implements both [`Readable`](#stream_class_stream_readable) and +[`Writable`](#stream_class_stream_writable), such as a TCP socket connection. + +Because JavaScript does not have support for multiple inheritance, the +`stream.Duplex` class is extended to implement a [`Duplex`](#stream_class_stream_duplex) stream (as opposed +to extending the `stream.Readable` *and* `stream.Writable` classes). + +The `stream.Duplex` class prototypically inherits from `stream.Readable` and +parasitically from `stream.Writable`, but `instanceof` will work properly for +both base classes due to overriding [`Symbol.hasInstance`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/hasInstance) on +`stream.Writable`. + +Custom `Duplex` streams *must* call the `new stream.Duplex([options])` +constructor and implement *both* the `readable._read()` and +`writable._write()` methods. + +#### new stream.Duplex(options)[#](#stream_new_stream_duplex_options) + +History + +| Version | Changes | +| --- | --- | +| v8.4.0 | The `readableHighWaterMark` and `writableHighWaterMark` options are supported now. | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Passed to both `Writable` and `Readable` + constructors. Also has the following fields: + + + `allowHalfOpen` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If set to `false`, then the stream will + automatically end the writable side when the readable side ends. + **Default:** `true`. + + `readableObjectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Sets `objectMode` for readable side of the + stream. Has no effect if `objectMode` is `true`. **Default:** `false`. + + `writableObjectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Sets `objectMode` for writable side of the + stream. Has no effect if `objectMode` is `true`. **Default:** `false`. + + `readableHighWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Sets `highWaterMark` for the readable side + of the stream. Has no effect if `highWaterMark` is provided. + + `writableHighWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Sets `highWaterMark` for the writable side + of the stream. Has no effect if `highWaterMark` is provided. + +```None +const { Duplex } = require('stream'); + +class MyDuplex extends Duplex { + constructor(options) { + super(options); + // ... + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const { Duplex } = require('stream'); +const util = require('util'); + +function MyDuplex(options) { + if (!(this instanceof MyDuplex)) + return new MyDuplex(options); + Duplex.call(this, options); +} +util.inherits(MyDuplex, Duplex); +``` + +Or, using the Simplified Constructor approach: + +```None +const { Duplex } = require('stream'); + +const myDuplex = new Duplex({ + read(size) { + // ... + }, + write(chunk, encoding, callback) { + // ... + } +}); +``` + +#### An Example Duplex Stream[#](#stream_an_example_duplex_stream) + +The following illustrates a simple example of a `Duplex` stream that wraps a +hypothetical lower-level source object to which data can be written, and +from which data can be read, albeit using an API that is not compatible with +Node.js streams. +The following illustrates a simple example of a `Duplex` stream that buffers +incoming written data via the [`Writable`](#stream_class_stream_writable) interface that is read back out +via the [`Readable`](#stream_class_stream_readable) interface. + +```None +const { Duplex } = require('stream'); +const kSource = Symbol('source'); + +class MyDuplex extends Duplex { + constructor(source, options) { + super(options); + this[kSource] = source; + } + + _write(chunk, encoding, callback) { + // The underlying source only deals with strings + if (Buffer.isBuffer(chunk)) + chunk = chunk.toString(); + this[kSource].writeSomeData(chunk); + callback(); + } + + _read(size) { + this[kSource].fetchSomeData(size, (data, encoding) => { + this.push(Buffer.from(data, encoding)); + }); + } +} +``` + +The most important aspect of a `Duplex` stream is that the `Readable` and +`Writable` sides operate independently of one another despite co-existing within +a single object instance. + +#### Object Mode Duplex Streams[#](#stream_object_mode_duplex_streams) + +For `Duplex` streams, `objectMode` can be set exclusively for either the +`Readable` or `Writable` side using the `readableObjectMode` and +`writableObjectMode` options respectively. + +In the following example, for instance, a new `Transform` stream (which is a +type of [`Duplex`](#stream_class_stream_duplex) stream) is created that has an object mode `Writable` side +that accepts JavaScript numbers that are converted to hexadecimal strings on +the `Readable` side. + +```None +const { Transform } = require('stream'); + +// All Transform streams are also Duplex Streams +const myTransform = new Transform({ + writableObjectMode: true, + + transform(chunk, encoding, callback) { + // Coerce the chunk to a number if necessary + chunk |= 0; + + // Transform the chunk into something else. + const data = chunk.toString(16); + + // Push the data onto the readable queue. + callback(null, '0'.repeat(data.length % 2) + data); + } +}); + +myTransform.setEncoding('ascii'); +myTransform.on('data', (chunk) => console.log(chunk)); + +myTransform.write(1); +// Prints: 01 +myTransform.write(10); +// Prints: 0a +myTransform.write(100); +// Prints: 64 +``` + +### Implementing a Transform Stream[#](#stream_implementing_a_transform_stream) + +A [`Transform`](#stream_class_stream_transform) stream is a [`Duplex`](#stream_class_stream_duplex) stream where the output is computed +in some way from the input. Examples include [zlib](zlib.html) streams or [crypto](crypto.html) +streams that compress, encrypt, or decrypt data. + +There is no requirement that the output be the same size as the input, the same +number of chunks, or arrive at the same time. For example, a `Hash` stream will +only ever have a single chunk of output which is provided when the input is +ended. A `zlib` stream will produce output that is either much smaller or much +larger than its input. + +The `stream.Transform` class is extended to implement a [`Transform`](#stream_class_stream_transform) stream. + +The `stream.Transform` class prototypically inherits from `stream.Duplex` and +implements its own versions of the `writable._write()` and `readable._read()` +methods. Custom `Transform` implementations *must* implement the +[`transform._transform()`](#stream_transform_transform_chunk_encoding_callback) method and *may* also implement +the [`transform._flush()`](#stream_transform_flush_callback) method. + +Care must be taken when using `Transform` streams in that data written to the +stream can cause the `Writable` side of the stream to become paused if the +output on the `Readable` side is not consumed. + +#### new stream.Transform([options])[#](#stream_new_stream_transform_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Passed to both `Writable` and `Readable` + constructors. Also has the following fields: + + + `transform` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._transform()`](#stream_transform_transform_chunk_encoding_callback) method. + + `flush` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the [`stream._flush()`](#stream_transform_flush_callback) + method. + +```None +const { Transform } = require('stream'); + +class MyTransform extends Transform { + constructor(options) { + super(options); + // ... + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const { Transform } = require('stream'); +const util = require('util'); + +function MyTransform(options) { + if (!(this instanceof MyTransform)) + return new MyTransform(options); + Transform.call(this, options); +} +util.inherits(MyTransform, Transform); +``` + +Or, using the Simplified Constructor approach: + +```None +const { Transform } = require('stream'); + +const myTransform = new Transform({ + transform(chunk, encoding, callback) { + // ... + } +}); +``` + +#### Events: 'finish' and 'end'[#](#stream_events_finish_and_end) + +The [`'finish'`](#stream_event_finish) and [`'end'`](#stream_event_end) events are from the `stream.Writable` +and `stream.Readable` classes, respectively. The `'finish'` event is emitted +after [`stream.end()`](#stream_writable_end_chunk_encoding_callback) is called and all chunks have been processed +by [`stream._transform()`](#stream_transform_transform_chunk_encoding_callback). The `'end'` event is emitted +after all data has been output, which occurs after the callback in +[`transform._flush()`](#stream_transform_flush_callback) has been called. + +#### transform.\_flush(callback)[#](#stream_transform_flush_callback) + +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function (optionally with an error + argument and data) to be called when remaining data has been flushed. + +This function MUST NOT be called by application code directly. It should be +implemented by child classes, and called by the internal `Readable` class +methods only. + +In some cases, a transform operation may need to emit an additional bit of +data at the end of the stream. For example, a `zlib` compression stream will +store an amount of internal state used to optimally compress the output. When +the stream ends, however, that additional data needs to be flushed so that the +compressed data will be complete. + +Custom [`Transform`](#stream_class_stream_transform) implementations *may* implement the `transform._flush()` +method. This will be called when there is no more written data to be consumed, +but before the [`'end'`](#stream_event_end) event is emitted signaling the end of the +[`Readable`](#stream_class_stream_readable) stream. + +Within the `transform._flush()` implementation, the `readable.push()` method +may be called zero or more times, as appropriate. The `callback` function must +be called when the flush operation is complete. + +The `transform._flush()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### transform.\_transform(chunk, encoding, callback)[#](#stream_transform_transform_chunk_encoding_callback) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) The `Buffer` to be transformed, converted from + the `string` passed to [`stream.write()`](#stream_writable_write_chunk_encoding_callback). If the stream's + `decodeStrings` option is `false` or the stream is operating in object mode, + the chunk will not be converted & will be whatever was passed to + [`stream.write()`](#stream_writable_write_chunk_encoding_callback). +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If the chunk is a string, then this is the + encoding type. If chunk is a buffer, then this is the special + value - 'buffer', ignore it in this case. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function (optionally with an error + argument and data) to be called after the supplied `chunk` has been + processed. + +This function MUST NOT be called by application code directly. It should be +implemented by child classes, and called by the internal `Readable` class +methods only. + +All `Transform` stream implementations must provide a `_transform()` +method to accept input and produce output. The `transform._transform()` +implementation handles the bytes being written, computes an output, then passes +that output off to the readable portion using the `readable.push()` method. + +The `transform.push()` method may be called zero or more times to generate +output from a single input chunk, depending on how much is to be output +as a result of the chunk. + +It is possible that no output is generated from any given chunk of input data. + +The `callback` function must be called only when the current chunk is completely +consumed. The first argument passed to the `callback` must be an `Error` object +if an error occurred while processing the input or `null` otherwise. If a second +argument is passed to the `callback`, it will be forwarded on to the +`readable.push()` method. In other words, the following are equivalent: + +```None +transform.prototype._transform = function(data, encoding, callback) { + this.push(data); + callback(); +}; + +transform.prototype._transform = function(data, encoding, callback) { + callback(null, data); +}; +``` + +The `transform._transform()` method is prefixed with an underscore because it +is internal to the class that defines it, and should never be called directly by +user programs. + +`transform._transform()` is never called in parallel; streams implement a +queue mechanism, and to receive the next chunk, `callback` must be +called, either synchronously or asynchronously. + +#### Class: stream.PassThrough[#](#stream_class_stream_passthrough) + +The `stream.PassThrough` class is a trivial implementation of a [`Transform`](#stream_class_stream_transform) +stream that simply passes the input bytes across to the output. Its purpose is +primarily for examples and testing, but there are some use cases where +`stream.PassThrough` is useful as a building block for novel sorts of streams. + +## Additional Notes[#](#stream_additional_notes) + +### Compatibility with Older Node.js Versions[#](#stream_compatibility_with_older_node_js_versions) + +Prior to Node.js 0.10, the `Readable` stream interface was simpler, but also +less powerful and less useful. + +* Rather than waiting for calls to the [`stream.read()`](#stream_readable_read_size) method, + [`'data'`](#stream_event_data) events would begin emitting immediately. Applications that + would need to perform some amount of work to decide how to handle data + were required to store read data into buffers so the data would not be lost. +* The [`stream.pause()`](#stream_readable_pause) method was advisory, rather than + guaranteed. This meant that it was still necessary to be prepared to receive + [`'data'`](#stream_event_data) events *even when the stream was in a paused state*. + +In Node.js 0.10, the [`Readable`](#stream_class_stream_readable) class was added. For backward +compatibility with older Node.js programs, `Readable` streams switch into +"flowing mode" when a [`'data'`](#stream_event_data) event handler is added, or when the +[`stream.resume()`](#stream_readable_resume) method is called. The effect is that, even +when not using the new [`stream.read()`](#stream_readable_read_size) method and +[`'readable'`](#stream_event_readable) event, it is no longer necessary to worry about losing +[`'data'`](#stream_event_data) chunks. + +While most applications will continue to function normally, this introduces an +edge case in the following conditions: + +* No [`'data'`](#stream_event_data) event listener is added. +* The [`stream.resume()`](#stream_readable_resume) method is never called. +* The stream is not piped to any writable destination. + +For example, consider the following code: + +```None +// WARNING! BROKEN! +net.createServer((socket) => { + + // We add an 'end' listener, but never consume the data + socket.on('end', () => { + // It will never get here. + socket.end('The message was received but was not processed.\n'); + }); + +}).listen(1337); +``` + +Prior to Node.js 0.10, the incoming message data would be simply discarded. +However, in Node.js 0.10 and beyond, the socket remains paused forever. + +The workaround in this situation is to call the +[`stream.resume()`](#stream_readable_resume) method to begin the flow of data: + +```None +// Workaround +net.createServer((socket) => { + socket.on('end', () => { + socket.end('The message was received but was not processed.\n'); + }); + + // Start the flow of data, discarding it. + socket.resume(); +}).listen(1337); +``` + +In addition to new `Readable` streams switching into flowing mode, +pre-0.10 style streams can be wrapped in a `Readable` class using the +[`readable.wrap()`](#stream_readable_wrap_stream) method. + +### `readable.read(0)`[#](#stream_readable_read_0) + +There are some cases where it is necessary to trigger a refresh of the +underlying readable stream mechanisms, without actually consuming any +data. In such cases, it is possible to call `readable.read(0)`, which will +always return `null`. + +If the internal read buffer is below the `highWaterMark`, and the +stream is not currently reading, then calling `stream.read(0)` will trigger +a low-level [`stream._read()`](#stream_readable_read_size_1) call. + +While most applications will almost never need to do this, there are +situations within Node.js where this is done, particularly in the +`Readable` stream class internals. + +### `readable.push('')`[#](#stream_readable_push) + +Use of `readable.push('')` is not recommended. + +Pushing a zero-byte string, `Buffer` or `Uint8Array` to a stream that is not in +object mode has an interesting side effect. Because it *is* a call to +[`readable.push()`](#stream_readable_push_chunk_encoding), the call will end the reading process. +However, because the argument is an empty string, no data is added to the +readable buffer so there is nothing for a user to consume. + +### `highWaterMark` discrepancy after calling `readable.setEncoding()`[#](#stream_highwatermark_discrepancy_after_calling_readable_setencoding) + +The use of `readable.setEncoding()` will change the behavior of how the +`highWaterMark` operates in non-object mode. + +Typically, the size of the current buffer is measured against the +`highWaterMark` in *bytes*. However, after `setEncoding()` is called, the +comparison function will begin to measure the buffer's size in *characters*. + +This is not a problem in common cases with `latin1` or `ascii`. But it is +advised to be mindful about this behavior when working with strings that could +contain multi-byte characters. diff --git a/corpus/docs/nodejs/stream/stream_4x.md b/corpus/docs/nodejs/stream/stream_4x.md new file mode 100644 index 0000000000000000000000000000000000000000..0600371c1bff8d946aceb4c678ee04a37737e62b --- /dev/null +++ b/corpus/docs/nodejs/stream/stream_4x.md @@ -0,0 +1,1643 @@ +# Stream# + +Source: https://nodejs.org/docs/latest-v4.x/api/stream.html +Version: 4.x + +```None +Stability: 2 - Stable +``` + +A stream is an abstract interface implemented by various objects in +Node.js. For example a [request to an HTTP server](http.html#http_class_http_incomingmessage) is a +stream, as is [`process.stdout`](process.html#process_process_stdout). Streams are readable, writable, or both. All +streams are instances of [`EventEmitter`](events.html#events_class_eventemitter). + +You can load the Stream base classes by doing `require('stream')`. +There are base classes provided for [Readable](#stream_class_stream_readable) streams, [Writable](#stream_class_stream_writable) +streams, [Duplex](#stream_class_stream_duplex) streams, and [Transform](#stream_class_stream_transform) streams. + +This document is split up into 3 sections: + +1. The first section explains the parts of the API that you need to be + aware of to use streams in your programs. +2. The second section explains the parts of the API that you need to + use if you implement your own custom streams yourself. The API is designed to + make this easy for you to do. +3. The third section goes into more depth about how streams work, + including some of the internal mechanisms and functions that you + should probably not modify unless you definitely know what you are + doing. + +## API for Stream Consumers[#](#stream_api_for_stream_consumers) + +Streams can be either [Readable](#stream_class_stream_readable), [Writable](#stream_class_stream_writable), or both ([Duplex](#stream_class_stream_duplex)). + +All streams are EventEmitters, but they also have other custom methods +and properties depending on whether they are Readable, Writable, or +Duplex. + +If a stream is both Readable and Writable, then it implements all of +the methods and events. So, a [Duplex](#stream_class_stream_duplex) or [Transform](#stream_class_stream_transform) stream is +fully described by this API, though their implementation may be +somewhat different. + +It is not necessary to implement Stream interfaces in order to consume +streams in your programs. If you **are** implementing streaming +interfaces in your own program, please also refer to +[API for Stream Implementors](#stream_api_for_stream_implementors). + +Almost all Node.js programs, no matter how simple, use Streams in some +way. Here is an example of using Streams in an Node.js program: + +```None +const http = require('http'); + +var server = http.createServer( (req, res) => { + // req is an http.IncomingMessage, which is a Readable Stream + // res is an http.ServerResponse, which is a Writable Stream + + var body = ''; + // we want to get the data as utf8 strings + // If you don't set an encoding, then you'll get Buffer objects + req.setEncoding('utf8'); + + // Readable streams emit 'data' events once a listener is added + req.on('data', (chunk) => { + body += chunk; + }); + + // the end event tells you that you have entire body + req.on('end', () => { + try { + const data = JSON.parse(body); + // write back something interesting to the user: + res.write(typeof data); + res.end(); + } catch (er) { + // uh oh! bad json! + res.statusCode = 400; + return res.end(`error: ${er.message}`); + } + }); +}); + +server.listen(1337); + +// $ curl localhost:1337 -d '{}' +// object +// $ curl localhost:1337 -d '"foo"' +// string +// $ curl localhost:1337 -d 'not json' +// error: Unexpected token o +``` + +### Class: stream.Duplex[#](#stream_class_stream_duplex) + +Duplex streams are streams that implement both the [Readable](#stream_class_stream_readable) and +[Writable](#stream_class_stream_writable) interfaces. + +Examples of Duplex streams include: + +* [TCP sockets](net.html#net_class_net_socket) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) + +### Class: stream.Readable[#](#stream_class_stream_readable) + +The Readable stream interface is the abstraction for a *source* of +data that you are reading from. In other words, data comes *out* of a +Readable stream. + +A Readable stream will not start emitting data until you indicate that +you are ready to receive it. + +Readable streams have two "modes": a **flowing mode** and a **paused +mode**. When in flowing mode, data is read from the underlying system +and provided to your program as fast as possible. In paused mode, you +must explicitly call [`stream.read()`](#stream_readable_read_size) to get chunks of data out. +Streams start out in paused mode. + +**Note**: If no data event handlers are attached, and there are no +[`stream.pipe()`](#stream_readable_pipe_destination_options) destinations, and the stream is switched into flowing +mode, then data will be lost. + +You can switch to flowing mode by doing any of the following: + +* Adding a [`'data'`](#stream_event_data) event handler to listen for data. +* Calling the [`stream.resume()`](#stream_readable_resume) method to explicitly open the + flow. +* Calling the [`stream.pipe()`](#stream_readable_pipe_destination_options) method to send the data to a [Writable](#stream_class_stream_writable). + +You can switch back to paused mode by doing either of the following: + +* If there are no pipe destinations, by calling the + [`stream.pause()`](#stream_readable_pause) method. +* If there are pipe destinations, by removing any [`'data'`](#stream_event_data) event + handlers, and removing all pipe destinations by calling the + [`stream.unpipe()`](#stream_readable_unpipe_destination) method. + +Note that, for backwards compatibility reasons, removing [`'data'`](#stream_event_data) +event handlers will **not** automatically pause the stream. Also, if +there are piped destinations, then calling [`stream.pause()`](#stream_readable_pause) will +not guarantee that the stream will *remain* paused once those +destinations drain and ask for more data. + +Examples of readable streams include: + +* [HTTP responses, on the client](http.html#http_class_http_incomingmessage) +* [HTTP requests, on the server](http.html#http_class_http_incomingmessage) +* [fs read streams](fs.html#fs_class_fs_readstream) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) +* [TCP sockets](net.html#net_class_net_socket) +* [child process stdout and stderr](child_process.html#child_process_child_stdout) +* [`process.stdin`](process.html#process_process_stdin) + +#### Event: 'close'[#](#stream_event_close) + +Emitted when the stream and any of its underlying resources (a file +descriptor, for example) have been closed. The event indicates that +no more events will be emitted, and no further computation will occur. + +Not all streams will emit the `'close'` event as the `'close'` event is +optional. + +#### Event: 'data'[#](#stream_event_data) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The chunk of data. + +Attaching a `'data'` event listener to a stream that has not been +explicitly paused will switch the stream into flowing mode. Data will +then be passed as soon as it is available. + +If you just want to get all the data out of the stream as fast as +possible, this is the best way to do so. + +```None +var readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log('got %d bytes of data', chunk.length); +}); +``` + +#### Event: 'end'[#](#stream_event_end) + +This event fires when there will be no more data to read. + +Note that the `'end'` event **will not fire** unless the data is +completely consumed. This can be done by switching into flowing mode, +or by calling [`stream.read()`](#stream_readable_read_size) repeatedly until you get to the +end. + +```None +var readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log('got %d bytes of data', chunk.length); +}); +readable.on('end', () => { + console.log('there will be no more data.'); +}); +``` + +#### Event: 'error'[#](#stream_event_error) + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + +Emitted if there was an error receiving data. + +#### Event: 'readable'[#](#stream_event_readable) + +When a chunk of data can be read from the stream, it will emit a +`'readable'` event. + +In some cases, listening for a `'readable'` event will cause some data +to be read into the internal buffer from the underlying system, if it +hadn't already. + +```None +var readable = getReadableStreamSomehow(); +readable.on('readable', () => { + // there is some data to read now +}); +``` + +Once the internal buffer is drained, a `'readable'` event will fire +again when more data is available. + +The `'readable'` event is not emitted in the "flowing" mode with the +sole exception of the last one, on end-of-stream. + +The `'readable'` event indicates that the stream has new information: +either new data is available or the end of the stream has been reached. +In the former case, [`stream.read()`](#stream_readable_read_size) will return that data. In the +latter case, [`stream.read()`](#stream_readable_read_size) will return null. For instance, in +the following example, `foo.txt` is an empty file: + +```None +const fs = require('fs'); +var rr = fs.createReadStream('foo.txt'); +rr.on('readable', () => { + console.log('readable:', rr.read()); +}); +rr.on('end', () => { + console.log('end'); +}); +``` + +The output of running this script is: + +```None +$ node test.js +readable: null +end +``` + +#### readable.isPaused()[#](#stream_readable_ispaused) + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +This method returns whether or not the `readable` has been **explicitly** +paused by client code (using [`stream.pause()`](#stream_readable_pause) without a +corresponding [`stream.resume()`](#stream_readable_resume)). + +```None +var readable = new stream.Readable + +readable.isPaused() // === false +readable.pause() +readable.isPaused() // === true +readable.resume() +readable.isPaused() // === false +``` + +#### readable.pause()[#](#stream_readable_pause) + +* Returns: `this` + +This method will cause a stream in flowing mode to stop emitting +[`'data'`](#stream_event_data) events, switching out of flowing mode. Any data that becomes +available will remain in the internal buffer. + +```None +var readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log('got %d bytes of data', chunk.length); + readable.pause(); + console.log('there will be no more data for 1 second'); + setTimeout(() => { + console.log('now data will start flowing again'); + readable.resume(); + }, 1000); +}); +``` + +#### readable.pipe(destination[, options])[#](#stream_readable_pipe_destination_options) + +* `destination` [](stream.html#stream_class_stream_writable) The destination for writing data +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Pipe options + + `end` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) End the writer when the reader ends. Default = `true` + +This method pulls all the data out of a readable stream, and writes it +to the supplied destination, automatically managing the flow so that +the destination is not overwhelmed by a fast readable stream. + +Multiple destinations can be piped to safely. + +```None +var readable = getReadableStreamSomehow(); +var writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt' +readable.pipe(writable); +``` + +This function returns the destination stream, so you can set up pipe +chains like so: + +```None +var r = fs.createReadStream('file.txt'); +var z = zlib.createGzip(); +var w = fs.createWriteStream('file.txt.gz'); +r.pipe(z).pipe(w); +``` + +For example, emulating the Unix `cat` command: + +```None +process.stdin.pipe(process.stdout); +``` + +By default [`stream.end()`](#stream_writable_end_chunk_encoding_callback) is called on the destination when the +source stream emits [`'end'`](#stream_event_end), so that `destination` is no longer writable. +Pass `{ end: false }` as `options` to keep the destination stream open. + +This keeps `writer` open so that "Goodbye" can be written at the +end. + +```None +reader.pipe(writer, { end: false }); +reader.on('end', () => { + writer.end('Goodbye\n'); +}); +``` + +Note that [`process.stderr`](process.html#process_process_stderr) and [`process.stdout`](process.html#process_process_stdout) are never closed until +the process exits, regardless of the specified options. + +#### readable.read([size])[#](#stream_readable_read_size) + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Optional argument to specify how much data to read. +* Return [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Null_type) + +The `read()` method pulls some data out of the internal buffer and +returns it. If there is no data available, then it will return +`null`. + +If you pass in a `size` argument, then it will return that many +bytes. If `size` bytes are not available, then it will return `null`, +unless we've ended, in which case it will return the data remaining +in the buffer. + +If you do not specify a `size` argument, then it will return all the +data in the internal buffer. + +This method should only be called in paused mode. In flowing mode, +this method is called automatically until the internal buffer is +drained. + +```None +var readable = getReadableStreamSomehow(); +readable.on('readable', () => { + var chunk; + while (null !== (chunk = readable.read())) { + console.log('got %d bytes of data', chunk.length); + } +}); +``` + +If this method returns a data chunk, then it will also trigger the +emission of a [`'data'`](#stream_event_data) event. + +Note that calling [`stream.read([size])`](#stream_readable_read_size) after the [`'end'`](#stream_event_end) +event has been triggered will return `null`. No runtime error will be raised. + +#### readable.resume()[#](#stream_readable_resume) + +* Returns: `this` + +This method will cause the readable stream to resume emitting [`'data'`](#stream_event_data) +events. + +This method will switch the stream into flowing mode. If you do *not* +want to consume the data from a stream, but you *do* want to get to +its [`'end'`](#stream_event_end) event, you can call [`stream.resume()`](#stream_readable_resume) to open +the flow of data. + +```None +var readable = getReadableStreamSomehow(); +readable.resume(); +readable.on('end', () => { + console.log('got to the end, but did not read anything'); +}); +``` + +#### readable.setEncoding(encoding)[#](#stream_readable_setencoding_encoding) + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding to use. +* Returns: `this` + +Call this function to cause the stream to return strings of the specified +encoding instead of Buffer objects. For example, if you do +`readable.setEncoding('utf8')`, then the output data will be interpreted as +UTF-8 data, and returned as strings. If you do `readable.setEncoding('hex')`, +then the data will be encoded in hexadecimal string format. + +This properly handles multi-byte characters that would otherwise be +potentially mangled if you simply pulled the Buffers directly and +called [`buf.toString(encoding)`](buffer.html#buffer_buf_tostring_encoding_start_end) on them. If you want to read the data +as strings, always use this method. + +Also you can disable any encoding at all with `readable.setEncoding(null)`. +This approach is very useful if you deal with binary data or with large +multi-byte strings spread out over multiple chunks. + +```None +var readable = getReadableStreamSomehow(); +readable.setEncoding('utf8'); +readable.on('data', (chunk) => { + assert.equal(typeof chunk, 'string'); + console.log('got %d characters of string data', chunk.length); +}); +``` + +#### readable.unpipe([destination])[#](#stream_readable_unpipe_destination) + +* `destination` [](stream.html#stream_class_stream_writable) Optional specific stream to unpipe + +This method will remove the hooks set up for a previous [`stream.pipe()`](#stream_readable_pipe_destination_options) +call. + +If the destination is not specified, then all pipes are removed. + +If the destination is specified, but no pipe is set up for it, then +this is a no-op. + +```None +var readable = getReadableStreamSomehow(); +var writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt', +// but only for the first second +readable.pipe(writable); +setTimeout(() => { + console.log('stop writing to file.txt'); + readable.unpipe(writable); + console.log('manually close the file stream'); + writable.end(); +}, 1000); +``` + +#### readable.unshift(chunk)[#](#stream_readable_unshift_chunk) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Chunk of data to unshift onto the read queue + +This is useful in certain cases where a stream is being consumed by a +parser, which needs to "un-consume" some data that it has +optimistically pulled out of the source, so that the stream can be +passed on to some other party. + +Note that `stream.unshift(chunk)` cannot be called after the [`'end'`](#stream_event_end) event +has been triggered; a runtime error will be raised. + +If you find that you must often call `stream.unshift(chunk)` in your +programs, consider implementing a [Transform](#stream_class_stream_transform) stream instead. (See [API +for Stream Implementors](#stream_api_for_stream_implementors).) + +```None +// Pull off a header delimited by \n\n +// use unshift() if we get too much +// Call the callback with (error, header, stream) +const StringDecoder = require('string_decoder').StringDecoder; +function parseHeader(stream, callback) { + stream.on('error', callback); + stream.on('readable', onReadable); + var decoder = new StringDecoder('utf8'); + var header = ''; + function onReadable() { + var chunk; + while (null !== (chunk = stream.read())) { + var str = decoder.write(chunk); + if (str.match(/\n\n/)) { + // found the header boundary + var split = str.split(/\n\n/); + header += split.shift(); + var remaining = split.join('\n\n'); + var buf = new Buffer(remaining, 'utf8'); + if (buf.length) + stream.unshift(buf); + stream.removeListener('error', callback); + stream.removeListener('readable', onReadable); + // now the body of the message can be read from the stream. + callback(null, header, stream); + } else { + // still reading the header. + header += str; + } + } + } +} +``` + +Note that, unlike [`stream.push(chunk)`](#stream_readable_push_chunk_encoding), `stream.unshift(chunk)` +will not end the reading process by resetting the internal reading state of the +stream. This can cause unexpected results if `unshift()` is called during a +read (i.e. from within a [`stream._read()`](#stream_readable_read_size_1) implementation on a +custom stream). Following the call to `unshift()` with an immediate +[`stream.push('')`](#stream_readable_push_chunk_encoding) will reset the reading state appropriately, +however it is best to simply avoid calling `unshift()` while in the process of +performing a read. + +#### readable.wrap(stream)[#](#stream_readable_wrap_stream) + +* `stream` [](stream.html#stream_stream) An "old style" readable stream + +Versions of Node.js prior to v0.10 had streams that did not implement the +entire Streams API as it is today. (See [Compatibility](#stream_compatibility_with_older_node_js_versions) for +more information.) + +If you are using an older Node.js library that emits [`'data'`](#stream_event_data) events and +has a [`stream.pause()`](#stream_readable_pause) method that is advisory only, then you +can use the `wrap()` method to create a [Readable](#stream_class_stream_readable) stream that uses the old +stream as its data source. + +You will very rarely ever need to call this function, but it exists +as a convenience for interacting with old Node.js programs and libraries. + +For example: + +```None +const OldReader = require('./old-api-module.js').OldReader; +const Readable = require('stream').Readable; +const oreader = new OldReader; +const myReader = new Readable().wrap(oreader); + +myReader.on('readable', () => { + myReader.read(); // etc. +}); +``` + +### Class: stream.Transform[#](#stream_class_stream_transform) + +Transform streams are [Duplex](#stream_class_stream_duplex) streams where the output is in some way +computed from the input. They implement both the [Readable](#stream_class_stream_readable) and +[Writable](#stream_class_stream_writable) interfaces. + +Examples of Transform streams include: + +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) + +### Class: stream.Writable[#](#stream_class_stream_writable) + +The Writable stream interface is an abstraction for a *destination* +that you are writing data *to*. + +Examples of writable streams include: + +* [HTTP requests, on the client](http.html#http_class_http_clientrequest) +* [HTTP responses, on the server](http.html#http_class_http_serverresponse) +* [fs write streams](fs.html#fs_class_fs_writestream) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) +* [TCP sockets](net.html#net_class_net_socket) +* [child process stdin](child_process.html#child_process_child_stdin) +* [`process.stdout`](process.html#process_process_stdout), [`process.stderr`](process.html#process_process_stderr) + +#### Event: 'close'[#](#stream_event_close_1) + +Emitted when the stream and any of its underlying resources (a file descriptor, +for example) have been closed. The event indicates that no more events will be +emitted, and no further computation will occur. + +Not all streams will emit the `'close'` event as the `'close'` event is +optional. + +#### Event: 'drain'[#](#stream_event_drain) + +If a [`stream.write(chunk)`](#stream_writable_write_chunk_encoding_callback) call returns `false`, then the +`'drain'` event will indicate when it is appropriate to begin writing more data +to the stream. + +```None +// Write the data to the supplied writable stream one million times. +// Be attentive to back-pressure. +function writeOneMillionTimes(writer, data, encoding, callback) { + var i = 1000000; + write(); + function write() { + var ok = true; + do { + i -= 1; + if (i === 0) { + // last time! + writer.write(data, encoding, callback); + } else { + // see if we should continue, or wait + // don't pass the callback, because we're not done yet. + ok = writer.write(data, encoding); + } + } while (i > 0 && ok); + if (i > 0) { + // had to stop early! + // write some more once it drains + writer.once('drain', write); + } + } +} +``` + +#### Event: 'error'[#](#stream_event_error_1) + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + +Emitted if there was an error when writing or piping data. + +#### Event: 'finish'[#](#stream_event_finish) + +When the [`stream.end()`](#stream_writable_end_chunk_encoding_callback) method has been called, and all data has +been flushed to the underlying system, this event is emitted. + +```None +var writer = getWritableStreamSomehow(); +for (var i = 0; i < 100; i ++) { + writer.write('hello, #${i}!\n'); +} +writer.end('this is the end\n'); +writer.on('finish', () => { + console.error('all writes are now complete.'); +}); +``` + +#### Event: 'pipe'[#](#stream_event_pipe) + +* `src` [](stream.html#stream_class_stream_readable) source stream that is piping to this writable + +This is emitted whenever the [`stream.pipe()`](#stream_readable_pipe_destination_options) method is called on a readable +stream, adding this writable to its set of destinations. + +```None +var writer = getWritableStreamSomehow(); +var reader = getReadableStreamSomehow(); +writer.on('pipe', (src) => { + console.error('something is piping into the writer'); + assert.equal(src, reader); +}); +reader.pipe(writer); +``` + +#### Event: 'unpipe'[#](#stream_event_unpipe) + +* `src` <[Readable](#stream_class_stream_readable) Stream> The source stream that + [unpiped](#stream_readable_unpipe_destination) this writable + +This is emitted whenever the [`stream.unpipe()`](#stream_readable_unpipe_destination) method is called on a +readable stream, removing this writable from its set of destinations. + +```None +var writer = getWritableStreamSomehow(); +var reader = getReadableStreamSomehow(); +writer.on('unpipe', (src) => { + console.error('something has stopped piping into the writer'); + assert.equal(src, reader); +}); +reader.pipe(writer); +reader.unpipe(writer); +``` + +#### writable.cork()[#](#stream_writable_cork) + +Forces buffering of all writes. + +Buffered data will be flushed either at [`stream.uncork()`](#stream_writable_uncork) or at +[`stream.end()`](#stream_writable_end_chunk_encoding_callback) call. + +#### writable.end([chunk][, encoding][, callback])[#](#stream_writable_end_chunk_encoding_callback) + +* `chunk` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) Optional data to write +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding, if `chunk` is a String +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Optional callback for when the stream is finished + +Call this method when no more data will be written to the stream. If supplied, +the callback is attached as a listener on the [`'finish'`](#stream_event_finish) event. + +Calling [`stream.write()`](#stream_writable_write_chunk_encoding_callback) after calling +[`stream.end()`](#stream_writable_end_chunk_encoding_callback) will raise an error. + +```None +// write 'hello, ' and then end with 'world!' +var file = fs.createWriteStream('example.txt'); +file.write('hello, '); +file.end('world!'); +// writing more now is not allowed! +``` + +#### writable.setDefaultEncoding(encoding)[#](#stream_writable_setdefaultencoding_encoding) + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The new default encoding + +Sets the default encoding for a writable stream. + +#### writable.uncork()[#](#stream_writable_uncork) + +Flush all data, buffered since [`stream.cork()`](#stream_writable_cork) call. + +#### writable.write(chunk[, encoding][, callback])[#](#stream_writable_write_chunk_encoding_callback) + +* `chunk` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) The data to write +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding, if `chunk` is a String +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Callback for when this chunk of data is flushed +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` if the data was handled completely. + +This method writes some data to the underlying system, and calls the +supplied callback once the data has been fully handled. If an error +occurs, the callback may or may not be called with the error as its +first argument. To detect write errors, listen for the `'error'` event. + +The return value indicates if you should continue writing right now. +If the data had to be buffered internally, then it will return +`false`. Otherwise, it will return `true`. + +This return value is strictly advisory. You MAY continue to write, +even if it returns `false`. However, writes will be buffered in +memory, so it is best not to do this excessively. Instead, wait for +the [`'drain'`](#stream_event_drain) event before writing more data. + +## API for Stream Implementors[#](#stream_api_for_stream_implementors) + +To implement any sort of stream, the pattern is the same: + +1. Extend the appropriate parent class in your own subclass. (The + [`util.inherits()`](util.html#util_util_inherits_constructor_superconstructor) method is particularly helpful for this.) +2. Call the appropriate parent class constructor in your constructor, + to be sure that the internal mechanisms are set up properly. +3. Implement one or more specific methods, as detailed below. + +The class to extend and the method(s) to implement depend on the sort +of stream class you are writing: + +| Use-case | Class | Method(s) to implement | +| --- | --- | --- | +| Reading only | [Readable](#stream_class_stream_readable_1) | `_read` | +| Writing only | [Writable](#stream_class_stream_writable_1) | `_write`, `_writev` | +| Reading and writing | [Duplex](#stream_class_stream_duplex_1) | `_read`, `_write`, `_writev` | +| Operate on written data, then read the result | [Transform](#stream_class_stream_transform_1) | `_transform`, `_flush` | + +In your implementation code, it is very important to never call the methods +described in [API for Stream Consumers](#stream_api_for_stream_consumers). Otherwise, you can potentially cause +adverse side effects in programs that consume your streaming interfaces. + +### Class: stream.Duplex[#](#stream_class_stream_duplex_1) + +A "duplex" stream is one that is both Readable and Writable, such as a TCP +socket connection. + +Note that `stream.Duplex` is an abstract class designed to be extended +with an underlying implementation of the [`stream._read(size)`](#stream_readable_read_size_1) +and [`stream._write(chunk, encoding, callback)`](#stream_writable_write_chunk_encoding_callback_1) methods as you +would with a Readable or Writable stream class. + +Since JavaScript doesn't have multiple prototypal inheritance, this class +prototypally inherits from Readable, and then parasitically from Writable. It is +thus up to the user to implement both the low-level +[`stream._read(n)`](#stream_readable_read_size_1) method as well as the low-level +[`stream._write(chunk, encoding, callback)`](#stream_writable_write_chunk_encoding_callback_1) method on extension +duplex classes. + +#### new stream.Duplex(options)[#](#stream_new_stream_duplex_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Passed to both Writable and Readable + constructors. Also has the following fields: + + `allowHalfOpen` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Default = `true`. If set to `false`, then + the stream will automatically end the readable side when the + writable side ends and vice versa. + + `readableObjectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Default = `false`. Sets `objectMode` + for readable side of the stream. Has no effect if `objectMode` + is `true`. + + `writableObjectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Default = `false`. Sets `objectMode` + for writable side of the stream. Has no effect if `objectMode` + is `true`. + +In classes that extend the Duplex class, make sure to call the +constructor so that the buffering settings can be properly +initialized. + +### Class: stream.PassThrough[#](#stream_class_stream_passthrough) + +This is a trivial implementation of a [Transform](#stream_class_stream_transform) stream that simply +passes the input bytes across to the output. Its purpose is mainly +for examples and testing, but there are occasionally use cases where +it can come in handy as a building block for novel sorts of streams. + +### Class: stream.Readable[#](#stream_class_stream_readable_1) + +`stream.Readable` is an abstract class designed to be extended with an +underlying implementation of the [`stream._read(size)`](#stream_readable_read_size_1) method. + +Please see [API for Stream Consumers](#stream_api_for_stream_consumers) for how to consume +streams in your programs. What follows is an explanation of how to +implement Readable streams in your programs. + +#### new stream.Readable([options])[#](#stream_new_stream_readable_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `highWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The maximum number of bytes to store in + the internal buffer before ceasing to read from the underlying + resource. Default = `16384` (16kb), or `16` for `objectMode` streams + + `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If specified, then buffers will be decoded to + strings using the specified encoding. Default = `null` + + `objectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether this stream should behave + as a stream of objects. Meaning that [`stream.read(n)`](#stream_readable_read_size) returns + a single value instead of a Buffer of size n. Default = `false` + + `read` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the [`stream._read()`](#stream_readable_read_size_1) + method. + +In classes that extend the Readable class, make sure to call the +Readable constructor so that the buffering settings can be properly +initialized. + +#### readable.\_read(size)[#](#stream_readable_read_size_1) + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Number of bytes to read asynchronously + +Note: **Implement this method, but do NOT call it directly.** + +This method is prefixed with an underscore because it is internal to the +class that defines it and should only be called by the internal Readable +class methods. All Readable stream implementations must provide a \_read +method to fetch data from the underlying resource. + +When `_read()` is called, if data is available from the resource, the `_read()` +implementation should start pushing that data into the read queue by calling +[`this.push(dataChunk)`](#stream_readable_push_chunk_encoding). `_read()` should continue reading from +the resource and pushing data until push returns `false`, at which point it +should stop reading from the resource. Only when `_read()` is called again after +it has stopped should it start reading more data from the resource and pushing +that data onto the queue. + +Note: once the `_read()` method is called, it will not be called again until +the [`stream.push()`](#stream_readable_push_chunk_encoding) method is called. + +The `size` argument is advisory. Implementations where a "read" is a +single call that returns data can use this to know how much data to +fetch. Implementations where that is not relevant, such as TCP or +TLS, may ignore this argument, and simply provide data whenever it +becomes available. There is no need, for example to "wait" until +`size` bytes are available before calling [`stream.push(chunk)`](#stream_readable_push_chunk_encoding). + +#### readable.push(chunk[, encoding])[#](#stream_readable_push_chunk_encoding) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Null_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Chunk of data to push into the read queue +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Encoding of String chunks. Must be a valid + Buffer encoding, such as `'utf8'` or `'ascii'` +* return [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether or not more pushes should be performed + +Note: **This method should be called by Readable implementors, NOT +by consumers of Readable streams.** + +If a value other than null is passed, The `push()` method adds a chunk of data +into the queue for subsequent stream processors to consume. If `null` is +passed, it signals the end of the stream (EOF), after which no more data +can be written. + +The data added with `push()` can be pulled out by calling the +[`stream.read()`](#stream_readable_read_size) method when the [`'readable'`](#stream_event_readable) event fires. + +This API is designed to be as flexible as possible. For example, +you may be wrapping a lower-level source which has some sort of +pause/resume mechanism, and a data callback. In those cases, you +could wrap the low-level source object by doing something like this: + +```None +// source is an object with readStop() and readStart() methods, +// and an `ondata` member that gets called when it has data, and +// an `onend` member that gets called when the data is over. + +util.inherits(SourceWrapper, Readable); + +function SourceWrapper(options) { + Readable.call(this, options); + + this._source = getLowlevelSourceObject(); + + // Every time there's data, we push it into the internal buffer. + this._source.ondata = (chunk) => { + // if push() returns false, then we need to stop reading from source + if (!this.push(chunk)) + this._source.readStop(); + }; + + // When the source ends, we push the EOF-signaling `null` chunk + this._source.onend = () => { + this.push(null); + }; +} + +// _read will be called when the stream wants to pull more data in +// the advisory size argument is ignored in this case. +SourceWrapper.prototype._read = function(size) { + this._source.readStart(); +}; +``` + +#### Example: A Counting Stream[#](#stream_example_a_counting_stream) + +This is a basic example of a Readable stream. It emits the numerals +from 1 to 1,000,000 in ascending order, and then ends. + +```None +const Readable = require('stream').Readable; +const util = require('util'); +util.inherits(Counter, Readable); + +function Counter(opt) { + Readable.call(this, opt); + this._max = 1000000; + this._index = 1; +} + +Counter.prototype._read = function() { + var i = this._index++; + if (i > this._max) + this.push(null); + else { + var str = '' + i; + var buf = new Buffer(str, 'ascii'); + this.push(buf); + } +}; +``` + +#### Example: SimpleProtocol v1 (Sub-optimal)[#](#stream_example_simpleprotocol_v1_sub_optimal) + +This is similar to the `parseHeader` function described +[here](#stream_readable_unshift_chunk), but implemented as a custom stream. +Also, note that this implementation does not convert the incoming data to a +string. + +However, this would be better implemented as a [Transform](#stream_class_stream_transform) stream. See +[SimpleProtocol v2](#stream_example_simpleprotocol_parser_v2) for a better implementation. + +```None +// A parser for a simple data protocol. +// The "header" is a JSON object, followed by 2 \n characters, and +// then a message body. +// +// NOTE: This can be done more simply as a Transform stream! +// Using Readable directly for this is sub-optimal. See the +// alternative example below under the Transform section. + +const Readable = require('stream').Readable; +const util = require('util'); + +util.inherits(SimpleProtocol, Readable); + +function SimpleProtocol(source, options) { + if (!(this instanceof SimpleProtocol)) + return new SimpleProtocol(source, options); + + Readable.call(this, options); + this._inBody = false; + this._sawFirstCr = false; + + // source is a readable stream, such as a socket or file + this._source = source; + + source.on('end', () => { + this.push(null); + }); + + // give it a kick whenever the source is readable + // read(0) will not consume any bytes + source.on('readable', () => { + this.read(0); + }); + + this._rawHeader = []; + this.header = null; +} + +SimpleProtocol.prototype._read = function(n) { + if (!this._inBody) { + var chunk = this._source.read(); + + // if the source doesn't have data, we don't have data yet. + if (chunk === null) + return this.push(''); + + // check if the chunk has a \n\n + var split = -1; + for (var i = 0; i < chunk.length; i++) { + if (chunk[i] === 10) { // '\n' + if (this._sawFirstCr) { + split = i; + break; + } else { + this._sawFirstCr = true; + } + } else { + this._sawFirstCr = false; + } + } + + if (split === -1) { + // still waiting for the \n\n + // stash the chunk, and try again. + this._rawHeader.push(chunk); + this.push(''); + } else { + this._inBody = true; + var h = chunk.slice(0, split); + this._rawHeader.push(h); + var header = Buffer.concat(this._rawHeader).toString(); + try { + this.header = JSON.parse(header); + } catch (er) { + this.emit('error', new Error('invalid simple protocol data')); + return; + } + // now, because we got some extra data, unshift the rest + // back into the read queue so that our consumer will see it. + var b = chunk.slice(split); + this.unshift(b); + // calling unshift by itself does not reset the reading state + // of the stream; since we're inside _read, doing an additional + // push('') will reset the state appropriately. + this.push(''); + + // and let them know that we are done parsing the header. + this.emit('header', this.header); + } + } else { + // from there on, just provide the data to our consumer. + // careful not to push(null), since that would indicate EOF. + var chunk = this._source.read(); + if (chunk) this.push(chunk); + } +}; + +// Usage: +// var parser = new SimpleProtocol(source); +// Now parser is a readable stream that will emit 'header' +// with the parsed header data. +``` + +### Class: stream.Transform[#](#stream_class_stream_transform_1) + +A "transform" stream is a duplex stream where the output is causally +connected in some way to the input, such as a [zlib](zlib.html) stream or a +[crypto](crypto.html) stream. + +There is no requirement that the output be the same size as the input, +the same number of chunks, or arrive at the same time. For example, a +Hash stream will only ever have a single chunk of output which is +provided when the input is ended. A zlib stream will produce output +that is either much smaller or much larger than its input. + +Rather than implement the [`stream._read()`](#stream_readable_read_size_1) and +[`stream._write()`](#stream_writable_write_chunk_encoding_callback_1) methods, Transform classes must implement the +[`stream._transform()`](#stream_transform_transform_chunk_encoding_callback) method, and may optionally +also implement the [`stream._flush()`](#stream_transform_flush_callback) method. (See below.) + +#### new stream.Transform([options])[#](#stream_new_stream_transform_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Passed to both Writable and Readable + constructors. Also has the following fields: + + `transform` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._transform()`](#stream_transform_transform_chunk_encoding_callback) method. + + `flush` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the [`stream._flush()`](#stream_transform_flush_callback) + method. + +In classes that extend the Transform class, make sure to call the +constructor so that the buffering settings can be properly +initialized. + +#### Events: 'finish' and 'end'[#](#stream_events_finish_and_end) + +The [`'finish'`](#stream_event_finish) and [`'end'`](#stream_event_end) events are from the parent Writable +and Readable classes respectively. The `'finish'` event is fired after +[`stream.end()`](#stream_writable_end_chunk_encoding_callback) is called and all chunks have been processed by +[`stream._transform()`](#stream_transform_transform_chunk_encoding_callback), `'end'` is fired after all data has +been output which is after the callback in [`stream._flush()`](#stream_transform_flush_callback) +has been called. + +#### transform.\_flush(callback)[#](#stream_transform_flush_callback) + +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Call this function (optionally with an error + argument) when you are done flushing any remaining data. + +Note: **This function MUST NOT be called directly.** It MAY be implemented +by child classes, and if so, will be called by the internal Transform +class methods only. + +In some cases, your transform operation may need to emit a bit more +data at the end of the stream. For example, a `Zlib` compression +stream will store up some internal state so that it can optimally +compress the output. At the end, however, it needs to do the best it +can with what is left, so that the data will be complete. + +In those cases, you can implement a `_flush()` method, which will be +called at the very end, after all the written data is consumed, but +before emitting [`'end'`](#stream_event_end) to signal the end of the readable side. Just +like with [`stream._transform()`](#stream_transform_transform_chunk_encoding_callback), call +`transform.push(chunk)` zero or more times, as appropriate, and call `callback` +when the flush operation is complete. + +This method is prefixed with an underscore because it is internal to +the class that defines it, and should not be called directly by user +programs. However, you **are** expected to override this method in +your own extension classes. + +#### transform.\_transform(chunk, encoding, callback)[#](#stream_transform_transform_chunk_encoding_callback) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The chunk to be transformed. Will **always** + be a buffer unless the `decodeStrings` option was set to `false`. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If the chunk is a string, then this is the + encoding type. If chunk is a buffer, then this is the special + value - 'buffer', ignore it in this case. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Call this function (optionally with an error + argument and data) when you are done processing the supplied chunk. + +Note: **This function MUST NOT be called directly.** It should be +implemented by child classes, and called by the internal Transform +class methods only. + +All Transform stream implementations must provide a `_transform()` +method to accept input and produce output. + +`_transform()` should do whatever has to be done in this specific +Transform class, to handle the bytes being written, and pass them off +to the readable portion of the interface. Do asynchronous I/O, +process things, and so on. + +Call `transform.push(outputChunk)` 0 or more times to generate output +from this input chunk, depending on how much data you want to output +as a result of this chunk. + +Call the callback function only when the current chunk is completely +consumed. Note that there may or may not be output as a result of any +particular input chunk. If you supply a second argument to the callback +it will be passed to the push method. In other words the following are +equivalent: + +```None +transform.prototype._transform = function (data, encoding, callback) { + this.push(data); + callback(); +}; + +transform.prototype._transform = function (data, encoding, callback) { + callback(null, data); +}; +``` + +This method is prefixed with an underscore because it is internal to +the class that defines it, and should not be called directly by user +programs. However, you **are** expected to override this method in +your own extension classes. + +#### Example: `SimpleProtocol` parser v2[#](#stream_example_simpleprotocol_parser_v2) + +The example [here](#stream_example_simpleprotocol_v1_sub_optimal) of a simple +protocol parser can be implemented simply by using the higher level +[Transform](#stream_class_stream_transform) stream class, similar to the `parseHeader` and `SimpleProtocol +v1` examples. + +In this example, rather than providing the input as an argument, it +would be piped into the parser, which is a more idiomatic Node.js stream +approach. + +```None +const util = require('util'); +const Transform = require('stream').Transform; +util.inherits(SimpleProtocol, Transform); + +function SimpleProtocol(options) { + if (!(this instanceof SimpleProtocol)) + return new SimpleProtocol(options); + + Transform.call(this, options); + this._inBody = false; + this._sawFirstCr = false; + this._rawHeader = []; + this.header = null; +} + +SimpleProtocol.prototype._transform = function(chunk, encoding, done) { + if (!this._inBody) { + // check if the chunk has a \n\n + var split = -1; + for (var i = 0; i < chunk.length; i++) { + if (chunk[i] === 10) { // '\n' + if (this._sawFirstCr) { + split = i; + break; + } else { + this._sawFirstCr = true; + } + } else { + this._sawFirstCr = false; + } + } + + if (split === -1) { + // still waiting for the \n\n + // stash the chunk, and try again. + this._rawHeader.push(chunk); + } else { + this._inBody = true; + var h = chunk.slice(0, split); + this._rawHeader.push(h); + var header = Buffer.concat(this._rawHeader).toString(); + try { + this.header = JSON.parse(header); + } catch (er) { + this.emit('error', new Error('invalid simple protocol data')); + return; + } + // and let them know that we are done parsing the header. + this.emit('header', this.header); + + // now, because we got some extra data, emit this first. + this.push(chunk.slice(split)); + } + } else { + // from there on, just provide the data to our consumer as-is. + this.push(chunk); + } + done(); +}; + +// Usage: +// var parser = new SimpleProtocol(); +// source.pipe(parser) +// Now parser is a readable stream that will emit 'header' +// with the parsed header data. +``` + +### Class: stream.Writable[#](#stream_class_stream_writable_1) + +`stream.Writable` is an abstract class designed to be extended with an +underlying implementation of the +[`stream._write(chunk, encoding, callback)`](#stream_writable_write_chunk_encoding_callback_1) method. + +Please see [API for Stream Consumers](#stream_api_for_stream_consumers) for how to consume +writable streams in your programs. What follows is an explanation of +how to implement Writable streams in your programs. + +#### new stream.Writable([options])[#](#stream_new_stream_writable_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `highWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Buffer level when + [`stream.write()`](#stream_writable_write_chunk_encoding_callback) starts returning `false`. Default = `16384` + (16kb), or `16` for `objectMode` streams. + + `decodeStrings` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether or not to decode strings into + Buffers before passing them to [`stream._write()`](#stream_writable_write_chunk_encoding_callback_1). + Default = `true` + + `objectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether or not the + [`stream.write(anyObj)`](#stream_writable_write_chunk_encoding_callback) is a valid operation. If set you can + write arbitrary data instead of only `Buffer` / `String` data. + Default = `false` + + `write` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._write()`](#stream_writable_write_chunk_encoding_callback_1) method. + + `writev` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._writev()`](#stream_writable_writev_chunks_callback) method. + +In classes that extend the Writable class, make sure to call the +constructor so that the buffering settings can be properly +initialized. + +#### writable.\_write(chunk, encoding, callback)[#](#stream_writable_write_chunk_encoding_callback_1) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The chunk to be written. Will **always** + be a buffer unless the `decodeStrings` option was set to `false`. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If the chunk is a string, then this is the + encoding type. If chunk is a buffer, then this is the special + value - 'buffer', ignore it in this case. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Call this function (optionally with an error + argument) when you are done processing the supplied chunk. + +All Writable stream implementations must provide a +[`stream._write()`](#stream_writable_write_chunk_encoding_callback_1) method to send data to the underlying +resource. + +Note: **This function MUST NOT be called directly.** It should be +implemented by child classes, and called by the internal Writable +class methods only. + +Call the callback using the standard `callback(error)` pattern to +signal that the write completed successfully or with an error. + +If the `decodeStrings` flag is set in the constructor options, then +`chunk` may be a string rather than a Buffer, and `encoding` will +indicate the sort of string that it is. This is to support +implementations that have an optimized handling for certain string +data encodings. If you do not explicitly set the `decodeStrings` +option to `false`, then you can safely ignore the `encoding` argument, +and assume that `chunk` will always be a Buffer. + +This method is prefixed with an underscore because it is internal to +the class that defines it, and should not be called directly by user +programs. However, you **are** expected to override this method in +your own extension classes. + +#### writable.\_writev(chunks, callback)[#](#stream_writable_writev_chunks_callback) + +* `chunks` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) The chunks to be written. Each chunk has following + format: `{ chunk: ..., encoding: ... }`. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Call this function (optionally with an error + argument) when you are done processing the supplied chunks. + +Note: **This function MUST NOT be called directly.** It may be +implemented by child classes, and called by the internal Writable +class methods only. + +This function is completely optional to implement. In most cases it is +unnecessary. If implemented, it will be called with all the chunks +that are buffered in the write queue. + +## Simplified Constructor API[#](#stream_simplified_constructor_api) + +In simple cases there is now the added benefit of being able to construct a +stream without inheritance. + +This can be done by passing the appropriate methods as constructor options: + +Examples: + +### Duplex[#](#stream_duplex) + +```None +var duplex = new stream.Duplex({ + read: function(n) { + // sets this._read under the hood + + // push data onto the read queue, passing null + // will signal the end of the stream (EOF) + this.push(chunk); + }, + write: function(chunk, encoding, next) { + // sets this._write under the hood + + // An optional error can be passed as the first argument + next() + } +}); + +// or + +var duplex = new stream.Duplex({ + read: function(n) { + // sets this._read under the hood + + // push data onto the read queue, passing null + // will signal the end of the stream (EOF) + this.push(chunk); + }, + writev: function(chunks, next) { + // sets this._writev under the hood + + // An optional error can be passed as the first argument + next() + } +}); +``` + +### Readable[#](#stream_readable) + +```None +var readable = new stream.Readable({ + read: function(n) { + // sets this._read under the hood + + // push data onto the read queue, passing null + // will signal the end of the stream (EOF) + this.push(chunk); + } +}); +``` + +### Transform[#](#stream_transform) + +```None +var transform = new stream.Transform({ + transform: function(chunk, encoding, next) { + // sets this._transform under the hood + + // generate output as many times as needed + // this.push(chunk); + + // call when the current chunk is consumed + next(); + }, + flush: function(done) { + // sets this._flush under the hood + + // generate output as many times as needed + // this.push(chunk); + + done(); + } +}); +``` + +### Writable[#](#stream_writable) + +```None +var writable = new stream.Writable({ + write: function(chunk, encoding, next) { + // sets this._write under the hood + + // An optional error can be passed as the first argument + next() + } +}); + +// or + +var writable = new stream.Writable({ + writev: function(chunks, next) { + // sets this._writev under the hood + + // An optional error can be passed as the first argument + next() + } +}); +``` + +## Streams: Under the Hood[#](#stream_streams_under_the_hood) + +### Buffering[#](#stream_buffering) + +Both Writable and Readable streams will buffer data on an internal +object which can be retrieved from `_writableState.getBuffer()` or +`_readableState.buffer`, respectively. + +The amount of data that will potentially be buffered depends on the +`highWaterMark` option which is passed into the constructor. + +Buffering in Readable streams happens when the implementation calls +[`stream.push(chunk)`](#stream_readable_push_chunk_encoding). If the consumer of the Stream does not +call [`stream.read()`](#stream_readable_read_size), then the data will sit in the internal +queue until it is consumed. + +Buffering in Writable streams happens when the user calls +[`stream.write(chunk)`](#stream_writable_write_chunk_encoding_callback) repeatedly, even when it returns `false`. + +The purpose of streams, especially with the [`stream.pipe()`](#stream_readable_pipe_destination_options) method, is to +limit the buffering of data to acceptable levels, so that sources and +destinations of varying speed will not overwhelm the available memory. + +### Compatibility with Older Node.js Versions[#](#stream_compatibility_with_older_node_js_versions) + +In versions of Node.js prior to v0.10, the Readable stream interface was +simpler, but also less powerful and less useful. + +* Rather than waiting for you to call the [`stream.read()`](#stream_readable_read_size) method, + [`'data'`](#stream_event_data) events would start emitting immediately. If you needed to do + some I/O to decide how to handle data, then you had to store the chunks + in some kind of buffer so that they would not be lost. +* The [`stream.pause()`](#stream_readable_pause) method was advisory, rather than + guaranteed. This meant that you still had to be prepared to receive + [`'data'`](#stream_event_data) events even when the stream was in a paused state. + +In Node.js v0.10, the [Readable](#stream_class_stream_readable) class was added. +For backwards compatibility with older Node.js programs, Readable streams +switch into "flowing mode" when a [`'data'`](#stream_event_data) event handler is added, or +when the [`stream.resume()`](#stream_readable_resume) method is called. The effect is +that, even if you are not using the new [`stream.read()`](#stream_readable_read_size) method +and [`'readable'`](#stream_event_readable) event, you no longer have to worry about losing +[`'data'`](#stream_event_data) chunks. + +Most programs will continue to function normally. However, this +introduces an edge case in the following conditions: + +* No [`'data'`](#stream_event_data) event handler is added. +* The [`stream.resume()`](#stream_readable_resume) method is never called. +* The stream is not piped to any writable destination. + +For example, consider the following code: + +```None +// WARNING! BROKEN! +net.createServer((socket) => { + + // we add an 'end' method, but never consume the data + socket.on('end', () => { + // It will never get here. + socket.end('I got your message (but didnt read it)\n'); + }); + +}).listen(1337); +``` + +In versions of Node.js prior to v0.10, the incoming message data would be +simply discarded. However, in Node.js v0.10 and beyond, +the socket will remain paused forever. + +The workaround in this situation is to call the +[`stream.resume()`](#stream_readable_resume) method to start the flow of data: + +```None +// Workaround +net.createServer((socket) => { + + socket.on('end', () => { + socket.end('I got your message (but didnt read it)\n'); + }); + + // start the flow of data, discarding it. + socket.resume(); + +}).listen(1337); +``` + +In addition to new Readable streams switching into flowing mode, +pre-v0.10 style streams can be wrapped in a Readable class using the +[`stream.wrap()`](#stream_readable_wrap_stream) method. + +### Object Mode[#](#stream_object_mode) + +Normally, Streams operate on Strings and Buffers exclusively. + +Streams that are in **object mode** can emit generic JavaScript values +other than Buffers and Strings. + +A Readable stream in object mode will always return a single item from +a call to [`stream.read(size)`](#stream_readable_read_size), regardless of what the size +argument is. + +A Writable stream in object mode will always ignore the `encoding` +argument to [`stream.write(data, encoding)`](#stream_writable_write_chunk_encoding_callback). + +The special value `null` still retains its special value for object +mode streams. That is, for object mode readable streams, `null` as a +return value from [`stream.read()`](#stream_readable_read_size) indicates that there is no more +data, and [`stream.push(null)`](#stream_readable_push_chunk_encoding) will signal the end of stream data +(`EOF`). + +No streams in Node.js core are object mode streams. This pattern is only +used by userland streaming libraries. + +You should set `objectMode` in your stream child class constructor on +the options object. Setting `objectMode` mid-stream is not safe. + +For Duplex streams `objectMode` can be set exclusively for readable or +writable side with `readableObjectMode` and `writableObjectMode` +respectively. These options can be used to implement parsers and +serializers with Transform streams. + +```None +const util = require('util'); +const StringDecoder = require('string_decoder').StringDecoder; +const Transform = require('stream').Transform; +util.inherits(JSONParseStream, Transform); + +// Gets \n-delimited JSON string data, and emits the parsed objects +function JSONParseStream() { + if (!(this instanceof JSONParseStream)) + return new JSONParseStream(); + + Transform.call(this, { readableObjectMode : true }); + + this._buffer = ''; + this._decoder = new StringDecoder('utf8'); +} + +JSONParseStream.prototype._transform = function(chunk, encoding, cb) { + this._buffer += this._decoder.write(chunk); + // split on newlines + var lines = this._buffer.split(/\r?\n/); + // keep the last partial line buffered + this._buffer = lines.pop(); + for (var l = 0; l < lines.length; l++) { + var line = lines[l]; + try { + var obj = JSON.parse(line); + } catch (er) { + this.emit('error', er); + return; + } + // push the parsed object out to the readable consumer + this.push(obj); + } + cb(); +}; + +JSONParseStream.prototype._flush = function(cb) { + // Just handle any leftover + var rem = this._buffer.trim(); + if (rem) { + try { + var obj = JSON.parse(rem); + } catch (er) { + this.emit('error', er); + return; + } + // push the parsed object out to the readable consumer + this.push(obj); + } + cb(); +}; +``` + +### `stream.read(0)`[#](#stream_stream_read_0) + +There are some cases where you want to trigger a refresh of the +underlying readable stream mechanisms, without actually consuming any +data. In that case, you can call `stream.read(0)`, which will always +return null. + +If the internal read buffer is below the `highWaterMark`, and the +stream is not currently reading, then calling `stream.read(0)` will trigger +a low-level [`stream._read()`](#stream_readable_read_size_1) call. + +There is almost never a need to do this. However, you will see some +cases in Node.js's internals where this is done, particularly in the +Readable stream class internals. + +### `stream.push('')`[#](#stream_stream_push) + +Pushing a zero-byte string or Buffer (when not in [Object mode](#stream_object_mode)) has an +interesting side effect. Because it *is* a call to +[`stream.push()`](#stream_readable_push_chunk_encoding), it will end the `reading` process. However, it +does *not* add any data to the readable buffer, so there's nothing for +a user to consume. + +Very rarely, there are cases where you have no data to provide now, +but the consumer of your stream (or, perhaps, another bit of your own +code) will know when to check again, by calling [`stream.read(0)`](#stream_readable_read_size). +In those cases, you *may* call `stream.push('')`. + +So far, the only use case for this functionality is in the +[`tls.CryptoStream`](tls.html#tls_class_cryptostream) class, which is deprecated in Node.js/io.js v1.0. If you +find that you have to use `stream.push('')`, please consider another +approach, because it almost certainly indicates that something is +horribly wrong. diff --git a/corpus/docs/nodejs/stream/stream_5x.md b/corpus/docs/nodejs/stream/stream_5x.md new file mode 100644 index 0000000000000000000000000000000000000000..ae987006e6a79360122f222d3cc5b1d19d09356a --- /dev/null +++ b/corpus/docs/nodejs/stream/stream_5x.md @@ -0,0 +1,1634 @@ +# Stream# + +Source: https://nodejs.org/docs/latest-v5.x/api/stream.html +Version: 5.x + +```None +Stability: 2 - Stable +``` + +A stream is an abstract interface implemented by various objects in +Node.js. For example a [request to an HTTP server](http.html#http_class_http_incomingmessage) is a +stream, as is [`process.stdout`](process.html#process_process_stdout). Streams are readable, writable, or both. All +streams are instances of [`EventEmitter`](events.html#events_class_eventemitter). + +You can load the Stream base classes by doing `require('stream')`. +There are base classes provided for [Readable](#stream_class_stream_readable) streams, [Writable](#stream_class_stream_writable) +streams, [Duplex](#stream_class_stream_duplex) streams, and [Transform](#stream_class_stream_transform) streams. + +This document is split up into 3 sections: + +1. The first section explains the parts of the API that you need to be + aware of to use streams in your programs. +2. The second section explains the parts of the API that you need to + use if you implement your own custom streams yourself. The API is designed to + make this easy for you to do. +3. The third section goes into more depth about how streams work, + including some of the internal mechanisms and functions that you + should probably not modify unless you definitely know what you are + doing. + +## API for Stream Consumers[#](#stream_api_for_stream_consumers) + +Streams can be either [Readable](#stream_class_stream_readable), [Writable](#stream_class_stream_writable), or both ([Duplex](#stream_class_stream_duplex)). + +All streams are EventEmitters, but they also have other custom methods +and properties depending on whether they are Readable, Writable, or +Duplex. + +If a stream is both Readable and Writable, then it implements all of +the methods and events. So, a [Duplex](#stream_class_stream_duplex) or [Transform](#stream_class_stream_transform) stream is +fully described by this API, though their implementation may be +somewhat different. + +It is not necessary to implement Stream interfaces in order to consume +streams in your programs. If you **are** implementing streaming +interfaces in your own program, please also refer to +[API for Stream Implementors](#stream_api_for_stream_implementors). + +Almost all Node.js programs, no matter how simple, use Streams in some +way. Here is an example of using Streams in an Node.js program: + +```None +const http = require('http'); + +var server = http.createServer( (req, res) => { + // req is an http.IncomingMessage, which is a Readable Stream + // res is an http.ServerResponse, which is a Writable Stream + + var body = ''; + // we want to get the data as utf8 strings + // If you don't set an encoding, then you'll get Buffer objects + req.setEncoding('utf8'); + + // Readable streams emit 'data' events once a listener is added + req.on('data', (chunk) => { + body += chunk; + }); + + // the end event tells you that you have entire body + req.on('end', () => { + try { + var data = JSON.parse(body); + } catch (er) { + // uh oh! bad json! + res.statusCode = 400; + return res.end(`error: ${er.message}`); + } + + // write back something interesting to the user: + res.write(typeof data); + res.end(); + }); +}); + +server.listen(1337); + +// $ curl localhost:1337 -d '{}' +// object +// $ curl localhost:1337 -d '"foo"' +// string +// $ curl localhost:1337 -d 'not json' +// error: Unexpected token o +``` + +### Class: stream.Duplex[#](#stream_class_stream_duplex) + +Duplex streams are streams that implement both the [Readable](#stream_class_stream_readable) and +[Writable](#stream_class_stream_writable) interfaces. + +Examples of Duplex streams include: + +* [TCP sockets](net.html#net_class_net_socket) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) + +### Class: stream.Readable[#](#stream_class_stream_readable) + +The Readable stream interface is the abstraction for a *source* of +data that you are reading from. In other words, data comes *out* of a +Readable stream. + +A Readable stream will not start emitting data until you indicate that +you are ready to receive it. + +Readable streams have two "modes": a **flowing mode** and a **paused +mode**. When in flowing mode, data is read from the underlying system +and provided to your program as fast as possible. In paused mode, you +must explicitly call [`stream.read()`](#stream_readable_read_size) to get chunks of data out. +Streams start out in paused mode. + +**Note**: If no data event handlers are attached, and there are no +[`stream.pipe()`](#stream_readable_pipe_destination_options) destinations, and the stream is switched into flowing +mode, then data will be lost. + +You can switch to flowing mode by doing any of the following: + +* Adding a [`'data'`](#stream_event_data) event handler to listen for data. +* Calling the [`stream.resume()`](#stream_readable_resume) method to explicitly open the + flow. +* Calling the [`stream.pipe()`](#stream_readable_pipe_destination_options) method to send the data to a [Writable](#stream_class_stream_writable). + +You can switch back to paused mode by doing either of the following: + +* If there are no pipe destinations, by calling the + [`stream.pause()`](#stream_readable_pause) method. +* If there are pipe destinations, by removing any [`'data'`](#stream_event_data) event + handlers, and removing all pipe destinations by calling the + [`stream.unpipe()`](#stream_readable_unpipe_destination) method. + +Note that, for backwards compatibility reasons, removing [`'data'`](#stream_event_data) +event handlers will **not** automatically pause the stream. Also, if +there are piped destinations, then calling [`stream.pause()`](#stream_readable_pause) will +not guarantee that the stream will *remain* paused once those +destinations drain and ask for more data. + +Examples of readable streams include: + +* [HTTP responses, on the client](http.html#http_class_http_incomingmessage) +* [HTTP requests, on the server](http.html#http_class_http_incomingmessage) +* [fs read streams](fs.html#fs_class_fs_readstream) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) +* [TCP sockets](net.html#net_class_net_socket) +* [child process stdout and stderr](child_process.html#child_process_child_stdout) +* [`process.stdin`](process.html#process_process_stdin) + +#### Event: 'close'[#](#stream_event_close) + +Emitted when the stream and any of its underlying resources (a file +descriptor, for example) have been closed. The event indicates that +no more events will be emitted, and no further computation will occur. + +Not all streams will emit the `'close'` event. + +#### Event: 'data'[#](#stream_event_data) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The chunk of data. + +Attaching a `'data'` event listener to a stream that has not been +explicitly paused will switch the stream into flowing mode. Data will +then be passed as soon as it is available. + +If you just want to get all the data out of the stream as fast as +possible, this is the best way to do so. + +```None +var readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log('got %d bytes of data', chunk.length); +}); +``` + +#### Event: 'end'[#](#stream_event_end) + +This event fires when there will be no more data to read. + +Note that the `'end'` event **will not fire** unless the data is +completely consumed. This can be done by switching into flowing mode, +or by calling [`stream.read()`](#stream_readable_read_size) repeatedly until you get to the +end. + +```None +var readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log('got %d bytes of data', chunk.length); +}); +readable.on('end', () => { + console.log('there will be no more data.'); +}); +``` + +#### Event: 'error'[#](#stream_event_error) + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + +Emitted if there was an error receiving data. + +#### Event: 'readable'[#](#stream_event_readable) + +When a chunk of data can be read from the stream, it will emit a +`'readable'` event. + +In some cases, listening for a `'readable'` event will cause some data +to be read into the internal buffer from the underlying system, if it +hadn't already. + +```None +var readable = getReadableStreamSomehow(); +readable.on('readable', () => { + // there is some data to read now +}); +``` + +Once the internal buffer is drained, a `'readable'` event will fire +again when more data is available. + +The `'readable'` event is not emitted in the "flowing" mode with the +sole exception of the last one, on end-of-stream. + +The `'readable'` event indicates that the stream has new information: +either new data is available or the end of the stream has been reached. +In the former case, [`stream.read()`](#stream_readable_read_size) will return that data. In the +latter case, [`stream.read()`](#stream_readable_read_size) will return null. For instance, in +the following example, `foo.txt` is an empty file: + +```None +const fs = require('fs'); +var rr = fs.createReadStream('foo.txt'); +rr.on('readable', () => { + console.log('readable:', rr.read()); +}); +rr.on('end', () => { + console.log('end'); +}); +``` + +The output of running this script is: + +```None +$ node test.js +readable: null +end +``` + +#### readable.isPaused()[#](#stream_readable_ispaused) + +* Return: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +This method returns whether or not the `readable` has been **explicitly** +paused by client code (using [`stream.pause()`](#stream_readable_pause) without a +corresponding [`stream.resume()`](#stream_readable_resume)). + +```None +var readable = new stream.Readable + +readable.isPaused() // === false +readable.pause() +readable.isPaused() // === true +readable.resume() +readable.isPaused() // === false +``` + +#### readable.pause()[#](#stream_readable_pause) + +* Return: `this` + +This method will cause a stream in flowing mode to stop emitting +[`'data'`](#stream_event_data) events, switching out of flowing mode. Any data that becomes +available will remain in the internal buffer. + +```None +var readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log('got %d bytes of data', chunk.length); + readable.pause(); + console.log('there will be no more data for 1 second'); + setTimeout(() => { + console.log('now data will start flowing again'); + readable.resume(); + }, 1000); +}); +``` + +#### readable.pipe(destination[, options])[#](#stream_readable_pipe_destination_options) + +* `destination` [](stream.html#stream_class_stream_writable) The destination for writing data +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Pipe options + + `end` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) End the writer when the reader ends. Default = `true` + +This method pulls all the data out of a readable stream, and writes it +to the supplied destination, automatically managing the flow so that +the destination is not overwhelmed by a fast readable stream. + +Multiple destinations can be piped to safely. + +```None +var readable = getReadableStreamSomehow(); +var writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt' +readable.pipe(writable); +``` + +This function returns the destination stream, so you can set up pipe +chains like so: + +```None +var r = fs.createReadStream('file.txt'); +var z = zlib.createGzip(); +var w = fs.createWriteStream('file.txt.gz'); +r.pipe(z).pipe(w); +``` + +For example, emulating the Unix `cat` command: + +```None +process.stdin.pipe(process.stdout); +``` + +By default [`stream.end()`](#stream_writable_end_chunk_encoding_callback) is called on the destination when the +source stream emits [`'end'`](#stream_event_end), so that `destination` is no longer writable. +Pass `{ end: false }` as `options` to keep the destination stream open. + +This keeps `writer` open so that "Goodbye" can be written at the +end. + +```None +reader.pipe(writer, { end: false }); +reader.on('end', () => { + writer.end('Goodbye\n'); +}); +``` + +Note that [`process.stderr`](process.html#process_process_stderr) and [`process.stdout`](process.html#process_process_stdout) are never closed until +the process exits, regardless of the specified options. + +#### readable.read([size])[#](#stream_readable_read_size) + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Optional argument to specify how much data to read. +* Return [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Null_type) + +The `read()` method pulls some data out of the internal buffer and +returns it. If there is no data available, then it will return +`null`. + +If you pass in a `size` argument, then it will return that many +bytes. If `size` bytes are not available, then it will return `null`, +unless we've ended, in which case it will return the data remaining +in the buffer. + +If you do not specify a `size` argument, then it will return all the +data in the internal buffer. + +This method should only be called in paused mode. In flowing mode, +this method is called automatically until the internal buffer is +drained. + +```None +var readable = getReadableStreamSomehow(); +readable.on('readable', () => { + var chunk; + while (null !== (chunk = readable.read())) { + console.log('got %d bytes of data', chunk.length); + } +}); +``` + +If this method returns a data chunk, then it will also trigger the +emission of a [`'data'`](#stream_event_data) event. + +Note that calling [`stream.read([size])`](#stream_readable_read_size) after the [`'end'`](#stream_event_end) +event has been triggered will return `null`. No runtime error will be raised. + +#### readable.resume()[#](#stream_readable_resume) + +* Return: `this` + +This method will cause the readable stream to resume emitting [`'data'`](#stream_event_data) +events. + +This method will switch the stream into flowing mode. If you do *not* +want to consume the data from a stream, but you *do* want to get to +its [`'end'`](#stream_event_end) event, you can call [`stream.resume()`](#stream_readable_resume) to open +the flow of data. + +```None +var readable = getReadableStreamSomehow(); +readable.resume(); +readable.on('end', () => { + console.log('got to the end, but did not read anything'); +}); +``` + +#### readable.setEncoding(encoding)[#](#stream_readable_setencoding_encoding) + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding to use. +* Return: `this` + +Call this function to cause the stream to return strings of the specified +encoding instead of Buffer objects. For example, if you do +`readable.setEncoding('utf8')`, then the output data will be interpreted as +UTF-8 data, and returned as strings. If you do `readable.setEncoding('hex')`, +then the data will be encoded in hexadecimal string format. + +This properly handles multi-byte characters that would otherwise be +potentially mangled if you simply pulled the Buffers directly and +called [`buf.toString(encoding)`](buffer.html#buffer_buf_tostring_encoding_start_end) on them. If you want to read the data +as strings, always use this method. + +Also you can disable any encoding at all with `readable.setEncoding(null)`. +This approach is very useful if you deal with binary data or with large +multi-byte strings spread out over multiple chunks. + +```None +var readable = getReadableStreamSomehow(); +readable.setEncoding('utf8'); +readable.on('data', (chunk) => { + assert.equal(typeof chunk, 'string'); + console.log('got %d characters of string data', chunk.length); +}); +``` + +#### readable.unpipe([destination])[#](#stream_readable_unpipe_destination) + +* `destination` [](stream.html#stream_class_stream_writable) Optional specific stream to unpipe + +This method will remove the hooks set up for a previous [`stream.pipe()`](#stream_readable_pipe_destination_options) +call. + +If the destination is not specified, then all pipes are removed. + +If the destination is specified, but no pipe is set up for it, then +this is a no-op. + +```None +var readable = getReadableStreamSomehow(); +var writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt', +// but only for the first second +readable.pipe(writable); +setTimeout(() => { + console.log('stop writing to file.txt'); + readable.unpipe(writable); + console.log('manually close the file stream'); + writable.end(); +}, 1000); +``` + +#### readable.unshift(chunk)[#](#stream_readable_unshift_chunk) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Chunk of data to unshift onto the read queue + +This is useful in certain cases where a stream is being consumed by a +parser, which needs to "un-consume" some data that it has +optimistically pulled out of the source, so that the stream can be +passed on to some other party. + +Note that `stream.unshift(chunk)` cannot be called after the [`'end'`](#stream_event_end) event +has been triggered; a runtime error will be raised. + +If you find that you must often call `stream.unshift(chunk)` in your +programs, consider implementing a [Transform](#stream_class_stream_transform) stream instead. (See [API +for Stream Implementors](#stream_api_for_stream_implementors).) + +```None +// Pull off a header delimited by \n\n +// use unshift() if we get too much +// Call the callback with (error, header, stream) +const StringDecoder = require('string_decoder').StringDecoder; +function parseHeader(stream, callback) { + stream.on('error', callback); + stream.on('readable', onReadable); + var decoder = new StringDecoder('utf8'); + var header = ''; + function onReadable() { + var chunk; + while (null !== (chunk = stream.read())) { + var str = decoder.write(chunk); + if (str.match(/\n\n/)) { + // found the header boundary + var split = str.split(/\n\n/); + header += split.shift(); + var remaining = split.join('\n\n'); + var buf = new Buffer(remaining, 'utf8'); + if (buf.length) + stream.unshift(buf); + stream.removeListener('error', callback); + stream.removeListener('readable', onReadable); + // now the body of the message can be read from the stream. + callback(null, header, stream); + } else { + // still reading the header. + header += str; + } + } + } +} +``` + +Note that, unlike [`stream.push(chunk)`](#stream_readable_push_chunk_encoding), `stream.unshift(chunk)` +will not end the reading process by resetting the internal reading state of the +stream. This can cause unexpected results if `unshift()` is called during a +read (i.e. from within a [`stream._read()`](#stream_readable_read_size_1) implementation on a +custom stream). Following the call to `unshift()` with an immediate +[`stream.push('')`](#stream_readable_push_chunk_encoding) will reset the reading state appropriately, +however it is best to simply avoid calling `unshift()` while in the process of +performing a read. + +#### readable.wrap(stream)[#](#stream_readable_wrap_stream) + +* `stream` [](stream.html#stream_stream) An "old style" readable stream + +Versions of Node.js prior to v0.10 had streams that did not implement the +entire Streams API as it is today. (See [Compatibility](#stream_compatibility_with_older_node_js_versions) for +more information.) + +If you are using an older Node.js library that emits [`'data'`](#stream_event_data) events and +has a [`stream.pause()`](#stream_readable_pause) method that is advisory only, then you +can use the `wrap()` method to create a [Readable](#stream_class_stream_readable) stream that uses the old +stream as its data source. + +You will very rarely ever need to call this function, but it exists +as a convenience for interacting with old Node.js programs and libraries. + +For example: + +```None +const OldReader = require('./old-api-module.js').OldReader; +const Readable = require('stream').Readable; +const oreader = new OldReader; +const myReader = new Readable().wrap(oreader); + +myReader.on('readable', () => { + myReader.read(); // etc. +}); +``` + +### Class: stream.Transform[#](#stream_class_stream_transform) + +Transform streams are [Duplex](#stream_class_stream_duplex) streams where the output is in some way +computed from the input. They implement both the [Readable](#stream_class_stream_readable) and +[Writable](#stream_class_stream_writable) interfaces. + +Examples of Transform streams include: + +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) + +### Class: stream.Writable[#](#stream_class_stream_writable) + +The Writable stream interface is an abstraction for a *destination* +that you are writing data *to*. + +Examples of writable streams include: + +* [HTTP requests, on the client](http.html#http_class_http_clientrequest) +* [HTTP responses, on the server](http.html#http_class_http_serverresponse) +* [fs write streams](fs.html#fs_class_fs_writestream) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) +* [TCP sockets](net.html#net_class_net_socket) +* [child process stdin](child_process.html#child_process_child_stdin) +* [`process.stdout`](process.html#process_process_stdout), [`process.stderr`](process.html#process_process_stderr) + +#### Event: 'drain'[#](#stream_event_drain) + +If a [`stream.write(chunk)`](#stream_writable_write_chunk_encoding_callback) call returns `false`, then the +`'drain'` event will indicate when it is appropriate to begin writing more data +to the stream. + +```None +// Write the data to the supplied writable stream one million times. +// Be attentive to back-pressure. +function writeOneMillionTimes(writer, data, encoding, callback) { + var i = 1000000; + write(); + function write() { + var ok = true; + do { + i -= 1; + if (i === 0) { + // last time! + writer.write(data, encoding, callback); + } else { + // see if we should continue, or wait + // don't pass the callback, because we're not done yet. + ok = writer.write(data, encoding); + } + } while (i > 0 && ok); + if (i > 0) { + // had to stop early! + // write some more once it drains + writer.once('drain', write); + } + } +} +``` + +#### Event: 'error'[#](#stream_event_error_1) + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + +Emitted if there was an error when writing or piping data. + +#### Event: 'finish'[#](#stream_event_finish) + +When the [`stream.end()`](#stream_writable_end_chunk_encoding_callback) method has been called, and all data has +been flushed to the underlying system, this event is emitted. + +```None +var writer = getWritableStreamSomehow(); +for (var i = 0; i < 100; i ++) { + writer.write('hello, #${i}!\n'); +} +writer.end('this is the end\n'); +writer.on('finish', () => { + console.error('all writes are now complete.'); +}); +``` + +#### Event: 'pipe'[#](#stream_event_pipe) + +* `src` [](stream.html#stream_class_stream_readable) source stream that is piping to this writable + +This is emitted whenever the [`stream.pipe()`](#stream_readable_pipe_destination_options) method is called on a readable +stream, adding this writable to its set of destinations. + +```None +var writer = getWritableStreamSomehow(); +var reader = getReadableStreamSomehow(); +writer.on('pipe', (src) => { + console.error('something is piping into the writer'); + assert.equal(src, reader); +}); +reader.pipe(writer); +``` + +#### Event: 'unpipe'[#](#stream_event_unpipe) + +* `src` <[Readable](#stream_class_stream_readable) Stream> The source stream that + [unpiped](#stream_readable_unpipe_destination) this writable + +This is emitted whenever the [`stream.unpipe()`](#stream_readable_unpipe_destination) method is called on a +readable stream, removing this writable from its set of destinations. + +```None +var writer = getWritableStreamSomehow(); +var reader = getReadableStreamSomehow(); +writer.on('unpipe', (src) => { + console.error('something has stopped piping into the writer'); + assert.equal(src, reader); +}); +reader.pipe(writer); +reader.unpipe(writer); +``` + +#### writable.cork()[#](#stream_writable_cork) + +Forces buffering of all writes. + +Buffered data will be flushed either at [`stream.uncork()`](#stream_writable_uncork) or at +[`stream.end()`](#stream_writable_end_chunk_encoding_callback) call. + +#### writable.end([chunk][, encoding][, callback])[#](#stream_writable_end_chunk_encoding_callback) + +* `chunk` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) Optional data to write +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding, if `chunk` is a String +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Optional callback for when the stream is finished + +Call this method when no more data will be written to the stream. If supplied, +the callback is attached as a listener on the [`'finish'`](#stream_event_finish) event. + +Calling [`stream.write()`](#stream_writable_write_chunk_encoding_callback) after calling +[`stream.end()`](#stream_writable_end_chunk_encoding_callback) will raise an error. + +```None +// write 'hello, ' and then end with 'world!' +var file = fs.createWriteStream('example.txt'); +file.write('hello, '); +file.end('world!'); +// writing more now is not allowed! +``` + +#### writable.setDefaultEncoding(encoding)[#](#stream_writable_setdefaultencoding_encoding) + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The new default encoding + +Sets the default encoding for a writable stream. + +#### writable.uncork()[#](#stream_writable_uncork) + +Flush all data, buffered since [`stream.cork()`](#stream_writable_cork) call. + +#### writable.write(chunk[, encoding][, callback])[#](#stream_writable_write_chunk_encoding_callback) + +* `chunk` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) The data to write +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding, if `chunk` is a String +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Callback for when this chunk of data is flushed +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` if the data was handled completely. + +This method writes some data to the underlying system, and calls the +supplied callback once the data has been fully handled. If an error +occurs, the callback may or may not be called with the error as its +first argument. To detect write errors, listen for the `'error'` event. + +The return value indicates if you should continue writing right now. +If the data had to be buffered internally, then it will return +`false`. Otherwise, it will return `true`. + +This return value is strictly advisory. You MAY continue to write, +even if it returns `false`. However, writes will be buffered in +memory, so it is best not to do this excessively. Instead, wait for +the [`'drain'`](#stream_event_drain) event before writing more data. + +## API for Stream Implementors[#](#stream_api_for_stream_implementors) + +To implement any sort of stream, the pattern is the same: + +1. Extend the appropriate parent class in your own subclass. (The + [`util.inherits()`](util.html#util_util_inherits_constructor_superconstructor) method is particularly helpful for this.) +2. Call the appropriate parent class constructor in your constructor, + to be sure that the internal mechanisms are set up properly. +3. Implement one or more specific methods, as detailed below. + +The class to extend and the method(s) to implement depend on the sort +of stream class you are writing: + +| Use-case | Class | Method(s) to implement | +| --- | --- | --- | +| Reading only | [Readable](#stream_class_stream_readable_1) | `_read` | +| Writing only | [Writable](#stream_class_stream_writable_1) | `_write`, `_writev` | +| Reading and writing | [Duplex](#stream_class_stream_duplex_1) | `_read`, `_write`, `_writev` | +| Operate on written data, then read the result | [Transform](#stream_class_stream_transform_1) | `_transform`, `_flush` | + +In your implementation code, it is very important to never call the methods +described in [API for Stream Consumers](#stream_api_for_stream_consumers). Otherwise, you can potentially cause +adverse side effects in programs that consume your streaming interfaces. + +### Class: stream.Duplex[#](#stream_class_stream_duplex_1) + +A "duplex" stream is one that is both Readable and Writable, such as a TCP +socket connection. + +Note that `stream.Duplex` is an abstract class designed to be extended +with an underlying implementation of the [`stream._read(size)`](#stream_readable_read_size_1) +and [`stream._write(chunk, encoding, callback)`](#stream_writable_write_chunk_encoding_callback_1) methods as you +would with a Readable or Writable stream class. + +Since JavaScript doesn't have multiple prototypal inheritance, this class +prototypally inherits from Readable, and then parasitically from Writable. It is +thus up to the user to implement both the low-level +[`stream._read(n)`](#stream_readable_read_size_1) method as well as the low-level +[`stream._write(chunk, encoding, callback)`](#stream_writable_write_chunk_encoding_callback_1) method on extension +duplex classes. + +#### new stream.Duplex(options)[#](#stream_new_stream_duplex_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Passed to both Writable and Readable + constructors. Also has the following fields: + + `allowHalfOpen` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Default = `true`. If set to `false`, then + the stream will automatically end the readable side when the + writable side ends and vice versa. + + `readableObjectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Default = `false`. Sets `objectMode` + for readable side of the stream. Has no effect if `objectMode` + is `true`. + + `writableObjectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Default = `false`. Sets `objectMode` + for writable side of the stream. Has no effect if `objectMode` + is `true`. + +In classes that extend the Duplex class, make sure to call the +constructor so that the buffering settings can be properly +initialized. + +### Class: stream.PassThrough[#](#stream_class_stream_passthrough) + +This is a trivial implementation of a [Transform](#stream_class_stream_transform) stream that simply +passes the input bytes across to the output. Its purpose is mainly +for examples and testing, but there are occasionally use cases where +it can come in handy as a building block for novel sorts of streams. + +### Class: stream.Readable[#](#stream_class_stream_readable_1) + +`stream.Readable` is an abstract class designed to be extended with an +underlying implementation of the [`stream._read(size)`](#stream_readable_read_size_1) method. + +Please see [API for Stream Consumers](#stream_api_for_stream_consumers) for how to consume +streams in your programs. What follows is an explanation of how to +implement Readable streams in your programs. + +#### new stream.Readable([options])[#](#stream_new_stream_readable_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `highWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The maximum number of bytes to store in + the internal buffer before ceasing to read from the underlying + resource. Default = `16384` (16kb), or `16` for `objectMode` streams + + `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If specified, then buffers will be decoded to + strings using the specified encoding. Default = `null` + + `objectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether this stream should behave + as a stream of objects. Meaning that [`stream.read(n)`](#stream_readable_read_size) returns + a single value instead of a Buffer of size n. Default = `false` + + `read` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the [`stream._read()`](#stream_readable_read_size_1) + method. + +In classes that extend the Readable class, make sure to call the +Readable constructor so that the buffering settings can be properly +initialized. + +#### readable.\_read(size)[#](#stream_readable_read_size_1) + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Number of bytes to read asynchronously + +Note: **Implement this method, but do NOT call it directly.** + +This method is prefixed with an underscore because it is internal to the +class that defines it and should only be called by the internal Readable +class methods. All Readable stream implementations must provide a \_read +method to fetch data from the underlying resource. + +When `_read()` is called, if data is available from the resource, the `_read()` +implementation should start pushing that data into the read queue by calling +[`this.push(dataChunk)`](#stream_readable_push_chunk_encoding). `_read()` should continue reading from +the resource and pushing data until push returns `false`, at which point it +should stop reading from the resource. Only when `_read()` is called again after +it has stopped should it start reading more data from the resource and pushing +that data onto the queue. + +Note: once the `_read()` method is called, it will not be called again until +the [`stream.push()`](#stream_readable_push_chunk_encoding) method is called. + +The `size` argument is advisory. Implementations where a "read" is a +single call that returns data can use this to know how much data to +fetch. Implementations where that is not relevant, such as TCP or +TLS, may ignore this argument, and simply provide data whenever it +becomes available. There is no need, for example to "wait" until +`size` bytes are available before calling [`stream.push(chunk)`](#stream_readable_push_chunk_encoding). + +#### readable.push(chunk[, encoding])[#](#stream_readable_push_chunk_encoding) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Null_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Chunk of data to push into the read queue +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Encoding of String chunks. Must be a valid + Buffer encoding, such as `'utf8'` or `'ascii'` +* return [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether or not more pushes should be performed + +Note: **This method should be called by Readable implementors, NOT +by consumers of Readable streams.** + +If a value other than null is passed, The `push()` method adds a chunk of data +into the queue for subsequent stream processors to consume. If `null` is +passed, it signals the end of the stream (EOF), after which no more data +can be written. + +The data added with `push()` can be pulled out by calling the +[`stream.read()`](#stream_readable_read_size) method when the [`'readable'`](#stream_event_readable) event fires. + +This API is designed to be as flexible as possible. For example, +you may be wrapping a lower-level source which has some sort of +pause/resume mechanism, and a data callback. In those cases, you +could wrap the low-level source object by doing something like this: + +```None +// source is an object with readStop() and readStart() methods, +// and an `ondata` member that gets called when it has data, and +// an `onend` member that gets called when the data is over. + +util.inherits(SourceWrapper, Readable); + +function SourceWrapper(options) { + Readable.call(this, options); + + this._source = getLowlevelSourceObject(); + + // Every time there's data, we push it into the internal buffer. + this._source.ondata = (chunk) => { + // if push() returns false, then we need to stop reading from source + if (!this.push(chunk)) + this._source.readStop(); + }; + + // When the source ends, we push the EOF-signaling `null` chunk + this._source.onend = () => { + this.push(null); + }; +} + +// _read will be called when the stream wants to pull more data in +// the advisory size argument is ignored in this case. +SourceWrapper.prototype._read = function(size) { + this._source.readStart(); +}; +``` + +#### Example: A Counting Stream[#](#stream_example_a_counting_stream) + +This is a basic example of a Readable stream. It emits the numerals +from 1 to 1,000,000 in ascending order, and then ends. + +```None +const Readable = require('stream').Readable; +const util = require('util'); +util.inherits(Counter, Readable); + +function Counter(opt) { + Readable.call(this, opt); + this._max = 1000000; + this._index = 1; +} + +Counter.prototype._read = function() { + var i = this._index++; + if (i > this._max) + this.push(null); + else { + var str = '' + i; + var buf = new Buffer(str, 'ascii'); + this.push(buf); + } +}; +``` + +#### Example: SimpleProtocol v1 (Sub-optimal)[#](#stream_example_simpleprotocol_v1_sub_optimal) + +This is similar to the `parseHeader` function described +[here](#stream_readable_unshift_chunk), but implemented as a custom stream. +Also, note that this implementation does not convert the incoming data to a +string. + +However, this would be better implemented as a [Transform](#stream_class_stream_transform) stream. See +[SimpleProtocol v2](#stream_example_simpleprotocol_parser_v2) for a better implementation. + +```None +// A parser for a simple data protocol. +// The "header" is a JSON object, followed by 2 \n characters, and +// then a message body. +// +// NOTE: This can be done more simply as a Transform stream! +// Using Readable directly for this is sub-optimal. See the +// alternative example below under the Transform section. + +const Readable = require('stream').Readable; +const util = require('util'); + +util.inherits(SimpleProtocol, Readable); + +function SimpleProtocol(source, options) { + if (!(this instanceof SimpleProtocol)) + return new SimpleProtocol(source, options); + + Readable.call(this, options); + this._inBody = false; + this._sawFirstCr = false; + + // source is a readable stream, such as a socket or file + this._source = source; + + source.on('end', () => { + this.push(null); + }); + + // give it a kick whenever the source is readable + // read(0) will not consume any bytes + source.on('readable', () => { + this.read(0); + }); + + this._rawHeader = []; + this.header = null; +} + +SimpleProtocol.prototype._read = function(n) { + if (!this._inBody) { + var chunk = this._source.read(); + + // if the source doesn't have data, we don't have data yet. + if (chunk === null) + return this.push(''); + + // check if the chunk has a \n\n + var split = -1; + for (var i = 0; i < chunk.length; i++) { + if (chunk[i] === 10) { // '\n' + if (this._sawFirstCr) { + split = i; + break; + } else { + this._sawFirstCr = true; + } + } else { + this._sawFirstCr = false; + } + } + + if (split === -1) { + // still waiting for the \n\n + // stash the chunk, and try again. + this._rawHeader.push(chunk); + this.push(''); + } else { + this._inBody = true; + var h = chunk.slice(0, split); + this._rawHeader.push(h); + var header = Buffer.concat(this._rawHeader).toString(); + try { + this.header = JSON.parse(header); + } catch (er) { + this.emit('error', new Error('invalid simple protocol data')); + return; + } + // now, because we got some extra data, unshift the rest + // back into the read queue so that our consumer will see it. + var b = chunk.slice(split); + this.unshift(b); + // calling unshift by itself does not reset the reading state + // of the stream; since we're inside _read, doing an additional + // push('') will reset the state appropriately. + this.push(''); + + // and let them know that we are done parsing the header. + this.emit('header', this.header); + } + } else { + // from there on, just provide the data to our consumer. + // careful not to push(null), since that would indicate EOF. + var chunk = this._source.read(); + if (chunk) this.push(chunk); + } +}; + +// Usage: +// var parser = new SimpleProtocol(source); +// Now parser is a readable stream that will emit 'header' +// with the parsed header data. +``` + +### Class: stream.Transform[#](#stream_class_stream_transform_1) + +A "transform" stream is a duplex stream where the output is causally +connected in some way to the input, such as a [zlib](zlib.html) stream or a +[crypto](crypto.html) stream. + +There is no requirement that the output be the same size as the input, +the same number of chunks, or arrive at the same time. For example, a +Hash stream will only ever have a single chunk of output which is +provided when the input is ended. A zlib stream will produce output +that is either much smaller or much larger than its input. + +Rather than implement the [`stream._read()`](#stream_readable_read_size_1) and +[`stream._write()`](#stream_writable_write_chunk_encoding_callback_1) methods, Transform classes must implement the +[`stream._transform()`](#stream_transform_transform_chunk_encoding_callback) method, and may optionally +also implement the [`stream._flush()`](#stream_transform_flush_callback) method. (See below.) + +#### new stream.Transform([options])[#](#stream_new_stream_transform_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Passed to both Writable and Readable + constructors. Also has the following fields: + + `transform` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._transform()`](#stream_transform_transform_chunk_encoding_callback) method. + + `flush` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the [`stream._flush()`](#stream_transform_flush_callback) + method. + +In classes that extend the Transform class, make sure to call the +constructor so that the buffering settings can be properly +initialized. + +#### Events: 'finish' and 'end'[#](#stream_events_finish_and_end) + +The [`'finish'`](#stream_event_finish) and [`'end'`](#stream_event_end) events are from the parent Writable +and Readable classes respectively. The `'finish'` event is fired after +[`stream.end()`](#stream_writable_end_chunk_encoding_callback) is called and all chunks have been processed by +[`stream._transform()`](#stream_transform_transform_chunk_encoding_callback), `'end'` is fired after all data has +been output which is after the callback in [`stream._flush()`](#stream_transform_flush_callback) +has been called. + +#### transform.\_flush(callback)[#](#stream_transform_flush_callback) + +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Call this function (optionally with an error + argument) when you are done flushing any remaining data. + +Note: **This function MUST NOT be called directly.** It MAY be implemented +by child classes, and if so, will be called by the internal Transform +class methods only. + +In some cases, your transform operation may need to emit a bit more +data at the end of the stream. For example, a `Zlib` compression +stream will store up some internal state so that it can optimally +compress the output. At the end, however, it needs to do the best it +can with what is left, so that the data will be complete. + +In those cases, you can implement a `_flush()` method, which will be +called at the very end, after all the written data is consumed, but +before emitting [`'end'`](#stream_event_end) to signal the end of the readable side. Just +like with [`stream._transform()`](#stream_transform_transform_chunk_encoding_callback), call +`transform.push(chunk)` zero or more times, as appropriate, and call `callback` +when the flush operation is complete. + +This method is prefixed with an underscore because it is internal to +the class that defines it, and should not be called directly by user +programs. However, you **are** expected to override this method in +your own extension classes. + +#### transform.\_transform(chunk, encoding, callback)[#](#stream_transform_transform_chunk_encoding_callback) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The chunk to be transformed. Will **always** + be a buffer unless the `decodeStrings` option was set to `false`. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If the chunk is a string, then this is the + encoding type. If chunk is a buffer, then this is the special + value - 'buffer', ignore it in this case. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Call this function (optionally with an error + argument and data) when you are done processing the supplied chunk. + +Note: **This function MUST NOT be called directly.** It should be +implemented by child classes, and called by the internal Transform +class methods only. + +All Transform stream implementations must provide a `_transform()` +method to accept input and produce output. + +`_transform()` should do whatever has to be done in this specific +Transform class, to handle the bytes being written, and pass them off +to the readable portion of the interface. Do asynchronous I/O, +process things, and so on. + +Call `transform.push(outputChunk)` 0 or more times to generate output +from this input chunk, depending on how much data you want to output +as a result of this chunk. + +Call the callback function only when the current chunk is completely +consumed. Note that there may or may not be output as a result of any +particular input chunk. If you supply a second argument to the callback +it will be passed to the push method. In other words the following are +equivalent: + +```None +transform.prototype._transform = function (data, encoding, callback) { + this.push(data); + callback(); +}; + +transform.prototype._transform = function (data, encoding, callback) { + callback(null, data); +}; +``` + +This method is prefixed with an underscore because it is internal to +the class that defines it, and should not be called directly by user +programs. However, you **are** expected to override this method in +your own extension classes. + +#### Example: `SimpleProtocol` parser v2[#](#stream_example_simpleprotocol_parser_v2) + +The example [here](#stream_example_simpleprotocol_v1_sub_optimal) of a simple +protocol parser can be implemented simply by using the higher level +[Transform](#stream_class_stream_transform) stream class, similar to the `parseHeader` and `SimpleProtocol +v1` examples. + +In this example, rather than providing the input as an argument, it +would be piped into the parser, which is a more idiomatic Node.js stream +approach. + +```None +const util = require('util'); +const Transform = require('stream').Transform; +util.inherits(SimpleProtocol, Transform); + +function SimpleProtocol(options) { + if (!(this instanceof SimpleProtocol)) + return new SimpleProtocol(options); + + Transform.call(this, options); + this._inBody = false; + this._sawFirstCr = false; + this._rawHeader = []; + this.header = null; +} + +SimpleProtocol.prototype._transform = function(chunk, encoding, done) { + if (!this._inBody) { + // check if the chunk has a \n\n + var split = -1; + for (var i = 0; i < chunk.length; i++) { + if (chunk[i] === 10) { // '\n' + if (this._sawFirstCr) { + split = i; + break; + } else { + this._sawFirstCr = true; + } + } else { + this._sawFirstCr = false; + } + } + + if (split === -1) { + // still waiting for the \n\n + // stash the chunk, and try again. + this._rawHeader.push(chunk); + } else { + this._inBody = true; + var h = chunk.slice(0, split); + this._rawHeader.push(h); + var header = Buffer.concat(this._rawHeader).toString(); + try { + this.header = JSON.parse(header); + } catch (er) { + this.emit('error', new Error('invalid simple protocol data')); + return; + } + // and let them know that we are done parsing the header. + this.emit('header', this.header); + + // now, because we got some extra data, emit this first. + this.push(chunk.slice(split)); + } + } else { + // from there on, just provide the data to our consumer as-is. + this.push(chunk); + } + done(); +}; + +// Usage: +// var parser = new SimpleProtocol(); +// source.pipe(parser) +// Now parser is a readable stream that will emit 'header' +// with the parsed header data. +``` + +### Class: stream.Writable[#](#stream_class_stream_writable_1) + +`stream.Writable` is an abstract class designed to be extended with an +underlying implementation of the +[`stream._write(chunk, encoding, callback)`](#stream_writable_write_chunk_encoding_callback_1) method. + +Please see [API for Stream Consumers](#stream_api_for_stream_consumers) for how to consume +writable streams in your programs. What follows is an explanation of +how to implement Writable streams in your programs. + +#### new stream.Writable([options])[#](#stream_new_stream_writable_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `highWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Buffer level when + [`stream.write()`](#stream_writable_write_chunk_encoding_callback) starts returning `false`. Default = `16384` + (16kb), or `16` for `objectMode` streams. + + `decodeStrings` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether or not to decode strings into + Buffers before passing them to [`stream._write()`](#stream_writable_write_chunk_encoding_callback_1). + Default = `true` + + `objectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether or not the + [`stream.write(anyObj)`](#stream_writable_write_chunk_encoding_callback) is a valid operation. If set you can + write arbitrary data instead of only `Buffer` / `String` data. + Default = `false` + + `write` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._write()`](#stream_writable_write_chunk_encoding_callback_1) method. + + `writev` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._writev()`](#stream_writable_writev_chunks_callback) method. + +In classes that extend the Writable class, make sure to call the +constructor so that the buffering settings can be properly +initialized. + +#### writable.\_write(chunk, encoding, callback)[#](#stream_writable_write_chunk_encoding_callback_1) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The chunk to be written. Will **always** + be a buffer unless the `decodeStrings` option was set to `false`. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If the chunk is a string, then this is the + encoding type. If chunk is a buffer, then this is the special + value - 'buffer', ignore it in this case. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Call this function (optionally with an error + argument) when you are done processing the supplied chunk. + +All Writable stream implementations must provide a +[`stream._write()`](#stream_writable_write_chunk_encoding_callback_1) method to send data to the underlying +resource. + +Note: **This function MUST NOT be called directly.** It should be +implemented by child classes, and called by the internal Writable +class methods only. + +Call the callback using the standard `callback(error)` pattern to +signal that the write completed successfully or with an error. + +If the `decodeStrings` flag is set in the constructor options, then +`chunk` may be a string rather than a Buffer, and `encoding` will +indicate the sort of string that it is. This is to support +implementations that have an optimized handling for certain string +data encodings. If you do not explicitly set the `decodeStrings` +option to `false`, then you can safely ignore the `encoding` argument, +and assume that `chunk` will always be a Buffer. + +This method is prefixed with an underscore because it is internal to +the class that defines it, and should not be called directly by user +programs. However, you **are** expected to override this method in +your own extension classes. + +#### writable.\_writev(chunks, callback)[#](#stream_writable_writev_chunks_callback) + +* `chunks` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) The chunks to be written. Each chunk has following + format: `{ chunk: ..., encoding: ... }`. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Call this function (optionally with an error + argument) when you are done processing the supplied chunks. + +Note: **This function MUST NOT be called directly.** It may be +implemented by child classes, and called by the internal Writable +class methods only. + +This function is completely optional to implement. In most cases it is +unnecessary. If implemented, it will be called with all the chunks +that are buffered in the write queue. + +## Simplified Constructor API[#](#stream_simplified_constructor_api) + +In simple cases there is now the added benefit of being able to construct a +stream without inheritance. + +This can be done by passing the appropriate methods as constructor options: + +Examples: + +### Duplex[#](#stream_duplex) + +```None +var duplex = new stream.Duplex({ + read: function(n) { + // sets this._read under the hood + + // push data onto the read queue, passing null + // will signal the end of the stream (EOF) + this.push(chunk); + }, + write: function(chunk, encoding, next) { + // sets this._write under the hood + + // An optional error can be passed as the first argument + next() + } +}); + +// or + +var duplex = new stream.Duplex({ + read: function(n) { + // sets this._read under the hood + + // push data onto the read queue, passing null + // will signal the end of the stream (EOF) + this.push(chunk); + }, + writev: function(chunks, next) { + // sets this._writev under the hood + + // An optional error can be passed as the first argument + next() + } +}); +``` + +### Readable[#](#stream_readable) + +```None +var readable = new stream.Readable({ + read: function(n) { + // sets this._read under the hood + + // push data onto the read queue, passing null + // will signal the end of the stream (EOF) + this.push(chunk); + } +}); +``` + +### Transform[#](#stream_transform) + +```None +var transform = new stream.Transform({ + transform: function(chunk, encoding, next) { + // sets this._transform under the hood + + // generate output as many times as needed + // this.push(chunk); + + // call when the current chunk is consumed + next(); + }, + flush: function(done) { + // sets this._flush under the hood + + // generate output as many times as needed + // this.push(chunk); + + done(); + } +}); +``` + +### Writable[#](#stream_writable) + +```None +var writable = new stream.Writable({ + write: function(chunk, encoding, next) { + // sets this._write under the hood + + // An optional error can be passed as the first argument + next() + } +}); + +// or + +var writable = new stream.Writable({ + writev: function(chunks, next) { + // sets this._writev under the hood + + // An optional error can be passed as the first argument + next() + } +}); +``` + +## Streams: Under the Hood[#](#stream_streams_under_the_hood) + +### Buffering[#](#stream_buffering) + +Both Writable and Readable streams will buffer data on an internal +object which can be retrieved from `_writableState.getBuffer()` or +`_readableState.buffer`, respectively. + +The amount of data that will potentially be buffered depends on the +`highWaterMark` option which is passed into the constructor. + +Buffering in Readable streams happens when the implementation calls +[`stream.push(chunk)`](#stream_readable_push_chunk_encoding). If the consumer of the Stream does not +call [`stream.read()`](#stream_readable_read_size), then the data will sit in the internal +queue until it is consumed. + +Buffering in Writable streams happens when the user calls +[`stream.write(chunk)`](#stream_writable_write_chunk_encoding_callback) repeatedly, even when it returns `false`. + +The purpose of streams, especially with the [`stream.pipe()`](#stream_readable_pipe_destination_options) method, is to +limit the buffering of data to acceptable levels, so that sources and +destinations of varying speed will not overwhelm the available memory. + +### Compatibility with Older Node.js Versions[#](#stream_compatibility_with_older_node_js_versions) + +In versions of Node.js prior to v0.10, the Readable stream interface was +simpler, but also less powerful and less useful. + +* Rather than waiting for you to call the [`stream.read()`](#stream_readable_read_size) method, + [`'data'`](#stream_event_data) events would start emitting immediately. If you needed to do + some I/O to decide how to handle data, then you had to store the chunks + in some kind of buffer so that they would not be lost. +* The [`stream.pause()`](#stream_readable_pause) method was advisory, rather than + guaranteed. This meant that you still had to be prepared to receive + [`'data'`](#stream_event_data) events even when the stream was in a paused state. + +In Node.js v0.10, the [Readable](#stream_class_stream_readable) class was added. +For backwards compatibility with older Node.js programs, Readable streams +switch into "flowing mode" when a [`'data'`](#stream_event_data) event handler is added, or +when the [`stream.resume()`](#stream_readable_resume) method is called. The effect is +that, even if you are not using the new [`stream.read()`](#stream_readable_read_size) method +and [`'readable'`](#stream_event_readable) event, you no longer have to worry about losing +[`'data'`](#stream_event_data) chunks. + +Most programs will continue to function normally. However, this +introduces an edge case in the following conditions: + +* No [`'data'`](#stream_event_data) event handler is added. +* The [`stream.resume()`](#stream_readable_resume) method is never called. +* The stream is not piped to any writable destination. + +For example, consider the following code: + +```None +// WARNING! BROKEN! +net.createServer((socket) => { + + // we add an 'end' method, but never consume the data + socket.on('end', () => { + // It will never get here. + socket.end('I got your message (but didnt read it)\n'); + }); + +}).listen(1337); +``` + +In versions of Node.js prior to v0.10, the incoming message data would be +simply discarded. However, in Node.js v0.10 and beyond, +the socket will remain paused forever. + +The workaround in this situation is to call the +[`stream.resume()`](#stream_readable_resume) method to start the flow of data: + +```None +// Workaround +net.createServer((socket) => { + + socket.on('end', () => { + socket.end('I got your message (but didnt read it)\n'); + }); + + // start the flow of data, discarding it. + socket.resume(); + +}).listen(1337); +``` + +In addition to new Readable streams switching into flowing mode, +pre-v0.10 style streams can be wrapped in a Readable class using the +[`stream.wrap()`](#stream_readable_wrap_stream) method. + +### Object Mode[#](#stream_object_mode) + +Normally, Streams operate on Strings and Buffers exclusively. + +Streams that are in **object mode** can emit generic JavaScript values +other than Buffers and Strings. + +A Readable stream in object mode will always return a single item from +a call to [`stream.read(size)`](#stream_readable_read_size), regardless of what the size +argument is. + +A Writable stream in object mode will always ignore the `encoding` +argument to [`stream.write(data, encoding)`](#stream_writable_write_chunk_encoding_callback). + +The special value `null` still retains its special value for object +mode streams. That is, for object mode readable streams, `null` as a +return value from [`stream.read()`](#stream_readable_read_size) indicates that there is no more +data, and [`stream.push(null)`](#stream_readable_push_chunk_encoding) will signal the end of stream data +(`EOF`). + +No streams in Node.js core are object mode streams. This pattern is only +used by userland streaming libraries. + +You should set `objectMode` in your stream child class constructor on +the options object. Setting `objectMode` mid-stream is not safe. + +For Duplex streams `objectMode` can be set exclusively for readable or +writable side with `readableObjectMode` and `writableObjectMode` +respectively. These options can be used to implement parsers and +serializers with Transform streams. + +```None +const util = require('util'); +const StringDecoder = require('string_decoder').StringDecoder; +const Transform = require('stream').Transform; +util.inherits(JSONParseStream, Transform); + +// Gets \n-delimited JSON string data, and emits the parsed objects +function JSONParseStream() { + if (!(this instanceof JSONParseStream)) + return new JSONParseStream(); + + Transform.call(this, { readableObjectMode : true }); + + this._buffer = ''; + this._decoder = new StringDecoder('utf8'); +} + +JSONParseStream.prototype._transform = function(chunk, encoding, cb) { + this._buffer += this._decoder.write(chunk); + // split on newlines + var lines = this._buffer.split(/\r?\n/); + // keep the last partial line buffered + this._buffer = lines.pop(); + for (var l = 0; l < lines.length; l++) { + var line = lines[l]; + try { + var obj = JSON.parse(line); + } catch (er) { + this.emit('error', er); + return; + } + // push the parsed object out to the readable consumer + this.push(obj); + } + cb(); +}; + +JSONParseStream.prototype._flush = function(cb) { + // Just handle any leftover + var rem = this._buffer.trim(); + if (rem) { + try { + var obj = JSON.parse(rem); + } catch (er) { + this.emit('error', er); + return; + } + // push the parsed object out to the readable consumer + this.push(obj); + } + cb(); +}; +``` + +### `stream.read(0)`[#](#stream_stream_read_0) + +There are some cases where you want to trigger a refresh of the +underlying readable stream mechanisms, without actually consuming any +data. In that case, you can call `stream.read(0)`, which will always +return null. + +If the internal read buffer is below the `highWaterMark`, and the +stream is not currently reading, then calling `stream.read(0)` will trigger +a low-level [`stream._read()`](#stream_readable_read_size_1) call. + +There is almost never a need to do this. However, you will see some +cases in Node.js's internals where this is done, particularly in the +Readable stream class internals. + +### `stream.push('')`[#](#stream_stream_push) + +Pushing a zero-byte string or Buffer (when not in [Object mode](#stream_object_mode)) has an +interesting side effect. Because it *is* a call to +[`stream.push()`](#stream_readable_push_chunk_encoding), it will end the `reading` process. However, it +does *not* add any data to the readable buffer, so there's nothing for +a user to consume. + +Very rarely, there are cases where you have no data to provide now, +but the consumer of your stream (or, perhaps, another bit of your own +code) will know when to check again, by calling [`stream.read(0)`](#stream_readable_read_size). +In those cases, you *may* call `stream.push('')`. + +So far, the only use case for this functionality is in the +[`tls.CryptoStream`](tls.html#tls_class_cryptostream) class, which is deprecated in Node.js/io.js v1.0. If you +find that you have to use `stream.push('')`, please consider another +approach, because it almost certainly indicates that something is +horribly wrong. diff --git a/corpus/docs/nodejs/stream/stream_6x.md b/corpus/docs/nodejs/stream/stream_6x.md new file mode 100644 index 0000000000000000000000000000000000000000..54c86ec7ae8ad43f0afdbd32d8b0c3c72c7ee0de --- /dev/null +++ b/corpus/docs/nodejs/stream/stream_6x.md @@ -0,0 +1,1987 @@ +# Stream# + +Source: https://nodejs.org/docs/latest-v6.x/api/stream.html +Version: 6.x + +[Stability: 2](documentation.html#documentation_stability_index) - Stable + +A stream is an abstract interface for working with streaming data in Node.js. +The `stream` module provides a base API that makes it easy to build objects +that implement the stream interface. + +There are many stream objects provided by Node.js. For instance, a +[request to an HTTP server](http.html#http_class_http_incomingmessage) and [`process.stdout`](process.html#process_process_stdout) +are both stream instances. + +Streams can be readable, writable, or both. All streams are instances of +[`EventEmitter`](events.html#events_class_eventemitter). + +The `stream` module can be accessed using: + +```None +const stream = require('stream'); +``` + +While it is important for all Node.js users to understand how streams work, +the `stream` module itself is most useful for developers that are creating new +types of stream instances. Developers who are primarily *consuming* stream +objects will rarely (if ever) have need to use the `stream` module directly. + +## Organization of this Document[#](#stream_organization_of_this_document) + +This document is divided into two primary sections with a third section for +additional notes. The first section explains the elements of the stream API that +are required to *use* streams within an application. The second section explains +the elements of the API that are required to *implement* new types of streams. + +## Types of Streams[#](#stream_types_of_streams) + +There are four fundamental stream types within Node.js: + +* [Readable](#stream_class_stream_readable) - streams from which data can be read (for example + [`fs.createReadStream()`](fs.html#fs_fs_createreadstream_path_options)). +* [Writable](#stream_class_stream_writable) - streams to which data can be written (for example + [`fs.createWriteStream()`](fs.html#fs_fs_createwritestream_path_options)). +* [Duplex](#stream_class_stream_duplex) - streams that are both Readable and Writable (for example + [`net.Socket`](net.html#net_class_net_socket)). +* [Transform](#stream_class_stream_transform) - Duplex streams that can modify or transform the data as it + is written and read (for example [`zlib.createDeflate()`](zlib.html#zlib_zlib_createdeflate_options)). + +### Object Mode[#](#stream_object_mode) + +All streams created by Node.js APIs operate exclusively on strings and `Buffer` +objects. It is possible, however, for stream implementations to work with other +types of JavaScript values (with the exception of `null`, which serves a special +purpose within streams). Such streams are considered to operate in "object +mode". + +Stream instances are switched into object mode using the `objectMode` option +when the stream is created. Attempting to switch an existing stream into +object mode is not safe. + +### Buffering[#](#stream_buffering) + +Both [Writable](#stream_class_stream_writable) and [Readable](#stream_class_stream_readable) streams will store data in an internal +buffer that can be retrieved using `writable._writableState.getBuffer()` or +`readable._readableState.buffer`, respectively. + +The amount of data potentially buffered depends on the `highWaterMark` option +passed into the streams constructor. For normal streams, the `highWaterMark` +option specifies a [total number of bytes](#stream_highwatermark_discrepency_after_calling_readable_setencoding). For streams operating +in object mode, the `highWaterMark` specifies a total number of objects. + +Data is buffered in Readable streams when the implementation calls +[`stream.push(chunk)`](#stream_readable_push_chunk_encoding). If the consumer of the Stream does not +call [`stream.read()`](#stream_readable_read_size), the data will sit in the internal +queue until it is consumed. + +Once the total size of the internal read buffer reaches the threshold specified +by `highWaterMark`, the stream will temporarily stop reading data from the +underlying resource until the data currently buffered can be consumed (that is, +the stream will stop calling the internal `readable._read()` method that is +used to fill the read buffer). + +Data is buffered in Writable streams when the +[`writable.write(chunk)`](#stream_writable_write_chunk_encoding_callback) method is called repeatedly. While the +total size of the internal write buffer is below the threshold set by +`highWaterMark`, calls to `writable.write()` will return `true`. Once +the size of the internal buffer reaches or exceeds the `highWaterMark`, `false` +will be returned. + +A key goal of the `stream` API, particularly the [`stream.pipe()`](#stream_readable_pipe_destination_options) method, +is to limit the buffering of data to acceptable levels such that sources and +destinations of differing speeds will not overwhelm the available memory. + +Because [Duplex](#stream_class_stream_duplex) and [Transform](#stream_class_stream_transform) streams are both Readable and Writable, +each maintain *two* separate internal buffers used for reading and writing, +allowing each side to operate independently of the other while maintaining an +appropriate and efficient flow of data. For example, [`net.Socket`](net.html#net_class_net_socket) instances +are [Duplex](#stream_class_stream_duplex) streams whose Readable side allows consumption of data received +*from* the socket and whose Writable side allows writing data *to* the socket. +Because data may be written to the socket at a faster or slower rate than data +is received, it is important for each side to operate (and buffer) independently +of the other. + +## API for Stream Consumers[#](#stream_api_for_stream_consumers) + +Almost all Node.js applications, no matter how simple, use streams in some +manner. The following is an example of using streams in a Node.js application +that implements an HTTP server: + +```None +const http = require('http'); + +const server = http.createServer((req, res) => { + // req is an http.IncomingMessage, which is a Readable Stream + // res is an http.ServerResponse, which is a Writable Stream + + let body = ''; + // Get the data as utf8 strings. + // If an encoding is not set, Buffer objects will be received. + req.setEncoding('utf8'); + + // Readable streams emit 'data' events once a listener is added + req.on('data', (chunk) => { + body += chunk; + }); + + // the end event indicates that the entire body has been received + req.on('end', () => { + try { + const data = JSON.parse(body); + // write back something interesting to the user: + res.write(typeof data); + res.end(); + } catch (er) { + // uh oh! bad json! + res.statusCode = 400; + return res.end(`error: ${er.message}`); + } + }); +}); + +server.listen(1337); + +// $ curl localhost:1337 -d "{}" +// object +// $ curl localhost:1337 -d "\"foo\"" +// string +// $ curl localhost:1337 -d "not json" +// error: Unexpected token o in JSON at position 1 +``` + +[Writable](#stream_class_stream_writable) streams (such as `res` in the example) expose methods such as +`write()` and `end()` that are used to write data onto the stream. + +[Readable](#stream_class_stream_readable) streams use the [`EventEmitter`](events.html#events_class_eventemitter) API for notifying application +code when data is available to be read off the stream. That available data can +be read from the stream in multiple ways. + +Both [Writable](#stream_class_stream_writable) and [Readable](#stream_class_stream_readable) streams use the [`EventEmitter`](events.html#events_class_eventemitter) API in +various ways to communicate the current state of the stream. + +[Duplex](#stream_class_stream_duplex) and [Transform](#stream_class_stream_transform) streams are both [Writable](#stream_class_stream_writable) and [Readable](#stream_class_stream_readable). + +Applications that are either writing data to or consuming data from a stream +are not required to implement the stream interfaces directly and will generally +have no reason to call `require('stream')`. + +Developers wishing to implement new types of streams should refer to the +section [API for Stream Implementers](#stream_api_for_stream_implementers). + +### Writable Streams[#](#stream_writable_streams) + +Writable streams are an abstraction for a *destination* to which data is +written. + +Examples of [Writable](#stream_class_stream_writable) streams include: + +* [HTTP requests, on the client](http.html#http_class_http_clientrequest) +* [HTTP responses, on the server](http.html#http_class_http_serverresponse) +* [fs write streams](fs.html#fs_class_fs_writestream) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) +* [TCP sockets](net.html#net_class_net_socket) +* [child process stdin](child_process.html#child_process_subprocess_stdin) +* [`process.stdout`](process.html#process_process_stdout), [`process.stderr`](process.html#process_process_stderr) + +*Note*: Some of these examples are actually [Duplex](#stream_class_stream_duplex) streams that implement +the [Writable](#stream_class_stream_writable) interface. + +All [Writable](#stream_class_stream_writable) streams implement the interface defined by the +`stream.Writable` class. + +While specific instances of [Writable](#stream_class_stream_writable) streams may differ in various ways, +all Writable streams follow the same fundamental usage pattern as illustrated +in the example below: + +```None +const myStream = getWritableStreamSomehow(); +myStream.write('some data'); +myStream.write('some more data'); +myStream.end('done writing data'); +``` + +#### Class: stream.Writable[#](#stream_class_stream_writable) + +Added in: v0.9.4 + +##### Event: 'close'[#](#stream_event_close) + +Added in: v0.9.4 + +The `'close'` event is emitted when the stream and any of its underlying +resources (a file descriptor, for example) have been closed. The event indicates +that no more events will be emitted, and no further computation will occur. + +Not all Writable streams will emit the `'close'` event. + +##### Event: 'drain'[#](#stream_event_drain) + +Added in: v0.9.4 + +If a call to [`stream.write(chunk)`](#stream_writable_write_chunk_encoding_callback) returns `false`, the +`'drain'` event will be emitted when it is appropriate to resume writing data +to the stream. + +```None +// Write the data to the supplied writable stream one million times. +// Be attentive to back-pressure. +function writeOneMillionTimes(writer, data, encoding, callback) { + let i = 1000000; + write(); + function write() { + let ok = true; + do { + i--; + if (i === 0) { + // last time! + writer.write(data, encoding, callback); + } else { + // see if we should continue, or wait + // don't pass the callback, because we're not done yet. + ok = writer.write(data, encoding); + } + } while (i > 0 && ok); + if (i > 0) { + // had to stop early! + // write some more once it drains + writer.once('drain', write); + } + } +} +``` + +##### Event: 'error'[#](#stream_event_error) + +Added in: v0.9.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + +The `'error'` event is emitted if an error occurred while writing or piping +data. The listener callback is passed a single `Error` argument when called. + +*Note*: The stream is not closed when the `'error'` event is emitted. + +##### Event: 'finish'[#](#stream_event_finish) + +Added in: v0.9.4 + +The `'finish'` event is emitted after the [`stream.end()`](#stream_writable_end_chunk_encoding_callback) method +has been called, and all data has been flushed to the underlying system. + +```None +const writer = getWritableStreamSomehow(); +for (let i = 0; i < 100; i++) { + writer.write(`hello, #${i}!\n`); +} +writer.end('This is the end\n'); +writer.on('finish', () => { + console.error('All writes are now complete.'); +}); +``` + +##### Event: 'pipe'[#](#stream_event_pipe) + +Added in: v0.9.4 + +* `src` [](stream.html#stream_class_stream_readable) source stream that is piping to this writable + +The `'pipe'` event is emitted when the [`stream.pipe()`](#stream_readable_pipe_destination_options) method is called on +a readable stream, adding this writable to its set of destinations. + +```None +const writer = getWritableStreamSomehow(); +const reader = getReadableStreamSomehow(); +writer.on('pipe', (src) => { + console.error('something is piping into the writer'); + assert.equal(src, reader); +}); +reader.pipe(writer); +``` + +##### Event: 'unpipe'[#](#stream_event_unpipe) + +Added in: v0.9.4 + +* `src` [](stream.html#stream_class_stream_readable) The source stream that + [unpiped](#stream_readable_unpipe_destination) this writable + +The `'unpipe'` event is emitted when the [`stream.unpipe()`](#stream_readable_unpipe_destination) method is called +on a [Readable](#stream_class_stream_readable) stream, removing this [Writable](#stream_class_stream_writable) from its set of +destinations. + +```None +const writer = getWritableStreamSomehow(); +const reader = getReadableStreamSomehow(); +writer.on('unpipe', (src) => { + console.error('Something has stopped piping into the writer.'); + assert.equal(src, reader); +}); +reader.pipe(writer); +reader.unpipe(writer); +``` + +##### writable.cork()[#](#stream_writable_cork) + +Added in: v0.11.2 + +The `writable.cork()` method forces all written data to be buffered in memory. +The buffered data will be flushed when either the [`stream.uncork()`](#stream_writable_uncork) or +[`stream.end()`](#stream_writable_end_chunk_encoding_callback) methods are called. + +The primary intent of `writable.cork()` is to avoid a situation where writing +many small chunks of data to a stream do not cause a backup in the internal +buffer that would have an adverse impact on performance. In such situations, +implementations that implement the `writable._writev()` method can perform +buffered writes in a more optimized manner. + +See also: [`writable.uncork()`](#stream_writable_uncork). + +##### writable.end([chunk][, encoding][, callback])[#](#stream_writable_end_chunk_encoding_callback) + +Added in: v0.9.4 + +* `chunk` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | Optional data to write. For streams not operating + in object mode, `chunk` must be a string or a `Buffer`. For object mode + streams, `chunk` may be any JavaScript value other than `null`. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding, if `chunk` is a String +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Optional callback for when the stream is finished + +Calling the `writable.end()` method signals that no more data will be written +to the [Writable](#stream_class_stream_writable). The optional `chunk` and `encoding` arguments allow one +final additional chunk of data to be written immediately before closing the +stream. If provided, the optional `callback` function is attached as a listener +for the [`'finish'`](#stream_event_finish) event. + +Calling the [`stream.write()`](#stream_writable_write_chunk_encoding_callback) method after calling +[`stream.end()`](#stream_writable_end_chunk_encoding_callback) will raise an error. + +```None +// write 'hello, ' and then end with 'world!' +const file = fs.createWriteStream('example.txt'); +file.write('hello, '); +file.end('world!'); +// writing more now is not allowed! +``` + +##### writable.setDefaultEncoding(encoding)[#](#stream_writable_setdefaultencoding_encoding) + +Added in: v0.11.15 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The new default encoding +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `writable.setDefaultEncoding()` method sets the default `encoding` for a +[Writable](#stream_class_stream_writable) stream. + +##### writable.uncork()[#](#stream_writable_uncork) + +Added in: v0.11.2 + +The `writable.uncork()` method flushes all data buffered since +[`stream.cork()`](#stream_writable_cork) was called. + +When using [`writable.cork()`](#stream_writable_cork) and `writable.uncork()` to manage the buffering +of writes to a stream, it is recommended that calls to `writable.uncork()` be +deferred using `process.nextTick()`. Doing so allows batching of all +`writable.write()` calls that occur within a given Node.js event loop phase. + +```None +stream.cork(); +stream.write('some '); +stream.write('data '); +process.nextTick(() => stream.uncork()); +``` + +If the [`writable.cork()`](#stream_writable_cork) method is called multiple times on a stream, the same +number of calls to `writable.uncork()` must be called to flush the buffered +data. + +```None +stream.cork(); +stream.write('some '); +stream.cork(); +stream.write('data '); +process.nextTick(() => { + stream.uncork(); + // The data will not be flushed until uncork() is called a second time. + stream.uncork(); +}); +``` + +See also: [`writable.cork()`](#stream_writable_cork). + +##### writable.write(chunk[, encoding][, callback])[#](#stream_writable_write_chunk_encoding_callback) + +Added in: v0.9.4 + +* `chunk` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) The data to write +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding, if `chunk` is a String +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Callback for when this chunk of data is flushed +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `false` if the stream wishes for the calling code to + wait for the `'drain'` event to be emitted before continuing to write + additional data; otherwise `true`. + +The `writable.write()` method writes some data to the stream, and calls the +supplied `callback` once the data has been fully handled. If an error +occurs, the `callback` *may or may not* be called with the error as its +first argument. To reliably detect write errors, add a listener for the +`'error'` event. + +The return value is `true` if the internal buffer is less than the +`highWaterMark` configured when the stream was created after admitting `chunk`. +If `false` is returned, further attempts to write data to the stream should +stop until the [`'drain'`](#stream_event_drain) event is emitted. + +While a stream is not draining, calls to `write()` will buffer `chunk`, and +return false. Once all currently buffered chunks are drained (accepted for +delivery by the operating system), the `'drain'` event will be emitted. +It is recommended that once write() returns false, no more chunks be written +until the `'drain'` event is emitted. While calling `write()` on a stream that +is not draining is allowed, Node.js will buffer all written chunks until +maximum memory usage occurs, at which point it will abort unconditionally. +Even before it aborts, high memory usage will cause poor garbage collector +performance and high RSS (which is not typically released back to the system, +even after the memory is no longer required). Since TCP sockets may never +drain if the remote peer does not read the data, writing a socket that is +not draining may lead to a remotely exploitable vulnerability. + +Writing data while the stream is not draining is particularly +problematic for a [Transform](#stream_class_stream_transform), because the `Transform` streams are paused +by default until they are piped or an `'data'` or `'readable'` event handler +is added. + +If the data to be written can be generated or fetched on demand, it is +recommended to encapsulate the logic into a [Readable](#stream_class_stream_readable) and use +[`stream.pipe()`](#stream_readable_pipe_destination_options). However, if calling `write()` is preferred, it is +possible to respect backpressure and avoid memory issues using the +[`'drain'`](#stream_event_drain) event: + +```None +function write(data, cb) { + if (!stream.write(data)) { + stream.once('drain', cb); + } else { + process.nextTick(cb); + } +} + +// Wait for cb to be called before doing any other write. +write('hello', () => { + console.log('write completed, do more writes now'); +}); +``` + +A Writable stream in object mode will always ignore the `encoding` argument. + +### Readable Streams[#](#stream_readable_streams) + +Readable streams are an abstraction for a *source* from which data is +consumed. + +Examples of Readable streams include: + +* [HTTP responses, on the client](http.html#http_class_http_incomingmessage) +* [HTTP requests, on the server](http.html#http_class_http_incomingmessage) +* [fs read streams](fs.html#fs_class_fs_readstream) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) +* [TCP sockets](net.html#net_class_net_socket) +* [child process stdout and stderr](child_process.html#child_process_subprocess_stdout) +* [`process.stdin`](process.html#process_process_stdin) + +All [Readable](#stream_class_stream_readable) streams implement the interface defined by the +`stream.Readable` class. + +#### Two Modes[#](#stream_two_modes) + +Readable streams effectively operate in one of two modes: flowing and paused. + +When in flowing mode, data is read from the underlying system automatically +and provided to an application as quickly as possible using events via the +[`EventEmitter`](events.html#events_class_eventemitter) interface. + +In paused mode, the [`stream.read()`](#stream_readable_read_size) method must be called +explicitly to read chunks of data from the stream. + +All [Readable](#stream_class_stream_readable) streams begin in paused mode but can be switched to flowing +mode in one of the following ways: + +* Adding a [`'data'`](#stream_event_data) event handler. +* Calling the [`stream.resume()`](#stream_readable_resume) method. +* Calling the [`stream.pipe()`](#stream_readable_pipe_destination_options) method to send the data to a [Writable](#stream_class_stream_writable). + +The Readable can switch back to paused mode using one of the following: + +* If there are no pipe destinations, by calling the + [`stream.pause()`](#stream_readable_pause) method. +* If there are pipe destinations, by removing any [`'data'`](#stream_event_data) event + handlers, and removing all pipe destinations by calling the + [`stream.unpipe()`](#stream_readable_unpipe_destination) method. + +The important concept to remember is that a Readable will not generate data +until a mechanism for either consuming or ignoring that data is provided. If +the consuming mechanism is disabled or taken away, the Readable will *attempt* +to stop generating the data. + +*Note*: For backwards compatibility reasons, removing [`'data'`](#stream_event_data) event +handlers will **not** automatically pause the stream. Also, if there are piped +destinations, then calling [`stream.pause()`](#stream_readable_pause) will not guarantee +that the stream will *remain* paused once those destinations drain and ask for +more data. + +*Note*: If a [Readable](#stream_class_stream_readable) is switched into flowing mode and there are no +consumers available to handle the data, that data will be lost. This can occur, +for instance, when the `readable.resume()` method is called without a listener +attached to the `'data'` event, or when a `'data'` event handler is removed +from the stream. + +#### Three States[#](#stream_three_states) + +The "two modes" of operation for a Readable stream are a simplified abstraction +for the more complicated internal state management that is happening within the +Readable stream implementation. + +Specifically, at any given point in time, every Readable is in one of three +possible states: + +* `readable._readableState.flowing = null` +* `readable._readableState.flowing = false` +* `readable._readableState.flowing = true` + +When `readable._readableState.flowing` is `null`, no mechanism for consuming the +streams data is provided so the stream will not generate its data. While in this +state, attaching a listener for the `'data'` event, calling the `readable.pipe()` +method, or calling the `readable.resume()` method will switch +`readable._readableState.flowing` to `true`, causing the Readable to begin +actively emitting events as data is generated. + +Calling `readable.pause()`, `readable.unpipe()`, or receiving "back pressure" +will cause the `readable._readableState.flowing` to be set as `false`, +temporarily halting the flowing of events but *not* halting the generation of +data. While in this state, attaching a listener for the `'data'` event +would not cause `readable._readableState.flowing` to switch to `true`. + +```None +const { PassThrough, Writable } = require('stream'); +const pass = new PassThrough(); +const writable = new Writable(); + +pass.pipe(writable); +pass.unpipe(writable); +// flowing is now false + +pass.on('data', (chunk) => { console.log(chunk.toString()); }); +pass.write('ok'); // will not emit 'data' +pass.resume(); // must be called to make 'data' being emitted +``` + +While `readable._readableState.flowing` is `false`, data may be accumulating +within the streams internal buffer. + +#### Choose One[#](#stream_choose_one) + +The Readable stream API evolved across multiple Node.js versions and provides +multiple methods of consuming stream data. In general, developers should choose +*one* of the methods of consuming data and *should never* use multiple methods +to consume data from a single stream. + +Use of the `readable.pipe()` method is recommended for most users as it has been +implemented to provide the easiest way of consuming stream data. Developers that +require more fine-grained control over the transfer and generation of data can +use the [`EventEmitter`](events.html#events_class_eventemitter) and `readable.pause()`/`readable.resume()` APIs. + +#### Class: stream.Readable[#](#stream_class_stream_readable) + +Added in: v0.9.4 + +##### Event: 'close'[#](#stream_event_close_1) + +Added in: v0.9.4 + +The `'close'` event is emitted when the stream and any of its underlying +resources (a file descriptor, for example) have been closed. The event indicates +that no more events will be emitted, and no further computation will occur. + +Not all [Readable](#stream_class_stream_readable) streams will emit the `'close'` event. + +##### Event: 'data'[#](#stream_event_data) + +Added in: v0.9.4 + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | The chunk of data. For streams that are not + operating in object mode, the chunk will be either a string or `Buffer`. + For streams that are in object mode, the chunk can be any JavaScript value + other than `null`. + +The `'data'` event is emitted whenever the stream is relinquishing ownership of +a chunk of data to a consumer. This may occur whenever the stream is switched +in flowing mode by calling `readable.pipe()`, `readable.resume()`, or by +attaching a listener callback to the `'data'` event. The `'data'` event will +also be emitted whenever the `readable.read()` method is called and a chunk of +data is available to be returned. + +Attaching a `'data'` event listener to a stream that has not been explicitly +paused will switch the stream into flowing mode. Data will then be passed as +soon as it is available. + +The listener callback will be passed the chunk of data as a string if a default +encoding has been specified for the stream using the +`readable.setEncoding()` method; otherwise the data will be passed as a +`Buffer`. + +```None +const readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log(`Received ${chunk.length} bytes of data.`); +}); +``` + +##### Event: 'end'[#](#stream_event_end) + +Added in: v0.9.4 + +The `'end'` event is emitted when there is no more data to be consumed from +the stream. + +*Note*: The `'end'` event **will not be emitted** unless the data is +completely consumed. This can be accomplished by switching the stream into +flowing mode, or by calling [`stream.read()`](#stream_readable_read_size) repeatedly until +all data has been consumed. + +```None +const readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log(`Received ${chunk.length} bytes of data.`); +}); +readable.on('end', () => { + console.log('There will be no more data.'); +}); +``` + +##### Event: 'error'[#](#stream_event_error_1) + +Added in: v0.9.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + +The `'error'` event may be emitted by a Readable implementation at any time. +Typically, this may occur if the underlying stream is unable to generate data +due to an underlying internal failure, or when a stream implementation attempts +to push an invalid chunk of data. + +The listener callback will be passed a single `Error` object. + +##### Event: 'readable'[#](#stream_event_readable) + +Added in: v0.9.4 + +The `'readable'` event is emitted when there is data available to be read from +the stream. In some cases, attaching a listener for the `'readable'` event will +cause some amount of data to be read into an internal buffer. + +```None +const readable = getReadableStreamSomehow(); +readable.on('readable', () => { + // there is some data to read now +}); +``` + +The `'readable'` event will also be emitted once the end of the stream data +has been reached but before the `'end'` event is emitted. + +Effectively, the `'readable'` event indicates that the stream has new +information: either new data is available or the end of the stream has been +reached. In the former case, [`stream.read()`](#stream_readable_read_size) will return the +available data. In the latter case, [`stream.read()`](#stream_readable_read_size) will return +`null`. For instance, in the following example, `foo.txt` is an empty file: + +```None +const fs = require('fs'); +const rr = fs.createReadStream('foo.txt'); +rr.on('readable', () => { + console.log(`readable: ${rr.read()}`); +}); +rr.on('end', () => { + console.log('end'); +}); +``` + +The output of running this script is: + +```None +$ node test.js +readable: null +end +``` + +*Note*: In general, the `readable.pipe()` and `'data'` event mechanisms are +easier to understand than the `'readable'` event. +However, handling `'readable'` might result in increased throughput. + +##### readable.isPaused()[#](#stream_readable_ispaused) + +Added in: v0.11.14 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +The `readable.isPaused()` method returns the current operating state of the +Readable. This is used primarily by the mechanism that underlies the +`readable.pipe()` method. In most typical cases, there will be no reason to +use this method directly. + +```None +const readable = new stream.Readable(); + +readable.isPaused(); // === false +readable.pause(); +readable.isPaused(); // === true +readable.resume(); +readable.isPaused(); // === false +``` + +##### readable.pause()[#](#stream_readable_pause) + +Added in: v0.9.4 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `readable.pause()` method will cause a stream in flowing mode to stop +emitting [`'data'`](#stream_event_data) events, switching out of flowing mode. Any data that +becomes available will remain in the internal buffer. + +```None +const readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log(`Received ${chunk.length} bytes of data.`); + readable.pause(); + console.log('There will be no additional data for 1 second.'); + setTimeout(() => { + console.log('Now data will start flowing again.'); + readable.resume(); + }, 1000); +}); +``` + +##### readable.pipe(destination[, options])[#](#stream_readable_pipe_destination_options) + +Added in: v0.9.4 + +* `destination` [](stream.html#stream_class_stream_writable) The destination for writing data +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Pipe options + + `end` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) End the writer when the reader ends. Defaults to `true`. + +The `readable.pipe()` method attaches a [Writable](#stream_class_stream_writable) stream to the `readable`, +causing it to switch automatically into flowing mode and push all of its data +to the attached [Writable](#stream_class_stream_writable). The flow of data will be automatically managed so +that the destination Writable stream is not overwhelmed by a faster Readable +stream. + +The following example pipes all of the data from the `readable` into a file +named `file.txt`: + +```None +const readable = getReadableStreamSomehow(); +const writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt' +readable.pipe(writable); +``` + +It is possible to attach multiple Writable streams to a single Readable stream. + +The `readable.pipe()` method returns a reference to the *destination* stream +making it possible to set up chains of piped streams: + +```None +const r = fs.createReadStream('file.txt'); +const z = zlib.createGzip(); +const w = fs.createWriteStream('file.txt.gz'); +r.pipe(z).pipe(w); +``` + +By default, [`stream.end()`](#stream_writable_end_chunk_encoding_callback) is called on the destination Writable +stream when the source Readable stream emits [`'end'`](#stream_event_end), so that the +destination is no longer writable. To disable this default behavior, the `end` +option can be passed as `false`, causing the destination stream to remain open, +as illustrated in the following example: + +```None +reader.pipe(writer, { end: false }); +reader.on('end', () => { + writer.end('Goodbye\n'); +}); +``` + +One important caveat is that if the Readable stream emits an error during +processing, the Writable destination *is not closed* automatically. If an +error occurs, it will be necessary to *manually* close each stream in order +to prevent memory leaks. + +*Note*: The [`process.stderr`](process.html#process_process_stderr) and [`process.stdout`](process.html#process_process_stdout) Writable streams are +never closed until the Node.js process exits, regardless of the specified +options. + +##### readable.read([size])[#](#stream_readable_read_size) + +Added in: v0.9.4 + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Optional argument to specify how much data to read. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Null_type) + +The `readable.read()` method pulls some data out of the internal buffer and +returns it. If no data available to be read, `null` is returned. By default, +the data will be returned as a `Buffer` object unless an encoding has been +specified using the `readable.setEncoding()` method or the stream is operating +in object mode. + +The optional `size` argument specifies a specific number of bytes to read. If +`size` bytes are not available to be read, `null` will be returned *unless* +the stream has ended, in which case all of the data remaining in the internal +buffer will be returned. + +If the `size` argument is not specified, all of the data contained in the +internal buffer will be returned. + +The `readable.read()` method should only be called on Readable streams operating +in paused mode. In flowing mode, `readable.read()` is called automatically until +the internal buffer is fully drained. + +```None +const readable = getReadableStreamSomehow(); +readable.on('readable', () => { + let chunk; + while (null !== (chunk = readable.read())) { + console.log(`Received ${chunk.length} bytes of data.`); + } +}); +``` + +In general, it is recommended that developers avoid the use of the `'readable'` +event and the `readable.read()` method in favor of using either +`readable.pipe()` or the `'data'` event. + +A Readable stream in object mode will always return a single item from +a call to [`readable.read(size)`](#stream_readable_read_size), regardless of the value of the +`size` argument. + +*Note:* If the `readable.read()` method returns a chunk of data, a `'data'` +event will also be emitted. + +*Note*: Calling [`stream.read([size])`](#stream_readable_read_size) after the [`'end'`](#stream_event_end) +event has been emitted will return `null`. No runtime error will be raised. + +##### readable.resume()[#](#stream_readable_resume) + +Added in: v0.9.4 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `readable.resume()` method causes an explicitly paused Readable stream to +resume emitting [`'data'`](#stream_event_data) events, switching the stream into flowing mode. + +The `readable.resume()` method can be used to fully consume the data from a +stream without actually processing any of that data as illustrated in the +following example: + +```None +getReadableStreamSomehow() + .resume() + .on('end', () => { + console.log('Reached the end, but did not read anything.'); + }); +``` + +##### readable.setEncoding(encoding)[#](#stream_readable_setencoding_encoding) + +Added in: v0.9.4 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding to use. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `readable.setEncoding()` method sets the character encoding for +data read from the Readable stream. + +By default, no encoding is assigned and stream data will be returned as +`Buffer` objects. Setting an encoding causes the stream data +to be returned as strings of the specified encoding rather than as `Buffer` +objects. For instance, calling `readable.setEncoding('utf8')` will cause the +output data to be interpreted as UTF-8 data, and passed as strings. Calling +`readable.setEncoding('hex')` will cause the data to be encoded in hexadecimal +string format. + +The Readable stream will properly handle multi-byte characters delivered through +the stream that would otherwise become improperly decoded if simply pulled from +the stream as `Buffer` objects. + +```None +const readable = getReadableStreamSomehow(); +readable.setEncoding('utf8'); +readable.on('data', (chunk) => { + assert.equal(typeof chunk, 'string'); + console.log('got %d characters of string data', chunk.length); +}); +``` + +##### readable.unpipe([destination])[#](#stream_readable_unpipe_destination) + +Added in: v0.9.4 + +* `destination` [](stream.html#stream_class_stream_writable) Optional specific stream to unpipe + +The `readable.unpipe()` method detaches a Writable stream previously attached +using the [`stream.pipe()`](#stream_readable_pipe_destination_options) method. + +If the `destination` is not specified, then *all* pipes are detached. + +If the `destination` is specified, but no pipe is set up for it, then +the method does nothing. + +```None +const readable = getReadableStreamSomehow(); +const writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt', +// but only for the first second +readable.pipe(writable); +setTimeout(() => { + console.log('Stop writing to file.txt'); + readable.unpipe(writable); + console.log('Manually close the file stream'); + writable.end(); +}, 1000); +``` + +##### readable.unshift(chunk)[#](#stream_readable_unshift_chunk) + +Added in: v0.9.11 + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Chunk of data to unshift onto the read queue + +The `readable.unshift()` method pushes a chunk of data back into the internal +buffer. This is useful in certain situations where a stream is being consumed by +code that needs to "un-consume" some amount of data that it has optimistically +pulled out of the source, so that the data can be passed on to some other party. + +*Note*: The `stream.unshift(chunk)` method cannot be called after the +[`'end'`](#stream_event_end) event has been emitted or a runtime error will be thrown. + +Developers using `stream.unshift()` often should consider switching to +use of a [Transform](#stream_class_stream_transform) stream instead. See the [API for Stream Implementers](#stream_api_for_stream_implementers) +section for more information. + +```None +// Pull off a header delimited by \n\n +// use unshift() if we get too much +// Call the callback with (error, header, stream) +const StringDecoder = require('string_decoder').StringDecoder; +function parseHeader(stream, callback) { + stream.on('error', callback); + stream.on('readable', onReadable); + const decoder = new StringDecoder('utf8'); + let header = ''; + function onReadable() { + let chunk; + while (null !== (chunk = stream.read())) { + const str = decoder.write(chunk); + if (str.match(/\n\n/)) { + // found the header boundary + const split = str.split(/\n\n/); + header += split.shift(); + const remaining = split.join('\n\n'); + const buf = Buffer.from(remaining, 'utf8'); + stream.removeListener('error', callback); + // remove the readable listener before unshifting + stream.removeListener('readable', onReadable); + if (buf.length) + stream.unshift(buf); + // now the body of the message can be read from the stream. + callback(null, header, stream); + } else { + // still reading the header. + header += str; + } + } + } +} +``` + +*Note*: Unlike [`stream.push(chunk)`](#stream_readable_push_chunk_encoding), `stream.unshift(chunk)` +will not end the reading process by resetting the internal reading state of the +stream. This can cause unexpected results if `readable.unshift()` is called +during a read (i.e. from within a [`stream._read()`](#stream_readable_read_size_1) +implementation on a custom stream). Following the call to `readable.unshift()` +with an immediate [`stream.push('')`](#stream_readable_push_chunk_encoding) will reset the reading state +appropriately, however it is best to simply avoid calling `readable.unshift()` +while in the process of performing a read. + +##### readable.wrap(stream)[#](#stream_readable_wrap_stream) + +Added in: v0.9.4 + +* `stream` [](stream.html#stream_stream) An "old style" readable stream + +Versions of Node.js prior to v0.10 had streams that did not implement the +entire `stream` module API as it is currently defined. (See [Compatibility](#stream_compatibility_with_older_node_js_versions) +for more information.) + +When using an older Node.js library that emits [`'data'`](#stream_event_data) events and has a +[`stream.pause()`](#stream_readable_pause) method that is advisory only, the +`readable.wrap()` method can be used to create a [Readable](#stream_class_stream_readable) stream that uses +the old stream as its data source. + +It will rarely be necessary to use `readable.wrap()` but the method has been +provided as a convenience for interacting with older Node.js applications and +libraries. + +For example: + +```None +const OldReader = require('./old-api-module.js').OldReader; +const Readable = require('stream').Readable; +const oreader = new OldReader(); +const myReader = new Readable().wrap(oreader); + +myReader.on('readable', () => { + myReader.read(); // etc. +}); +``` + +### Duplex and Transform Streams[#](#stream_duplex_and_transform_streams) + +#### Class: stream.Duplex[#](#stream_class_stream_duplex) + +Added in: v0.9.4 + +Duplex streams are streams that implement both the [Readable](#stream_class_stream_readable) and +[Writable](#stream_class_stream_writable) interfaces. + +Examples of Duplex streams include: + +* [TCP sockets](net.html#net_class_net_socket) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) + +#### Class: stream.Transform[#](#stream_class_stream_transform) + +Added in: v0.9.4 + +Transform streams are [Duplex](#stream_class_stream_duplex) streams where the output is in some way +related to the input. Like all [Duplex](#stream_class_stream_duplex) streams, Transform streams +implement both the [Readable](#stream_class_stream_readable) and [Writable](#stream_class_stream_writable) interfaces. + +Examples of Transform streams include: + +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) + +## API for Stream Implementers[#](#stream_api_for_stream_implementers) + +The `stream` module API has been designed to make it possible to easily +implement streams using JavaScript's prototypal inheritance model. + +First, a stream developer would declare a new JavaScript class that extends one +of the four basic stream classes (`stream.Writable`, `stream.Readable`, +`stream.Duplex`, or `stream.Transform`), making sure they call the appropriate +parent class constructor: + +```None +const Writable = require('stream').Writable; + +class MyWritable extends Writable { + constructor(options) { + super(options); + // ... + } +} +``` + +The new stream class must then implement one or more specific methods, depending +on the type of stream being created, as detailed in the chart below: + +| Use-case | Class | Method(s) to implement | +| --- | --- | --- | +| Reading only | [Readable](#stream_class_stream_readable) | `_read` | +| Writing only | [Writable](#stream_class_stream_writable) | `_write`, `_writev` | +| Reading and writing | [Duplex](#stream_class_stream_duplex) | `_read`, `_write`, `_writev` | +| Operate on written data, then read the result | [Transform](#stream_class_stream_transform) | `_transform`, `_flush` | + +*Note*: The implementation code for a stream should *never* call the "public" +methods of a stream that are intended for use by consumers (as described in +the [API for Stream Consumers](#stream_api_for_stream_consumers) section). Doing so may lead to adverse +side effects in application code consuming the stream. + +### Simplified Construction[#](#stream_simplified_construction) + +For many simple cases, it is possible to construct a stream without relying on +inheritance. This can be accomplished by directly creating instances of the +`stream.Writable`, `stream.Readable`, `stream.Duplex` or `stream.Transform` +objects and passing appropriate methods as constructor options. + +For example: + +```None +const Writable = require('stream').Writable; + +const myWritable = new Writable({ + write(chunk, encoding, callback) { + // ... + } +}); +``` + +### Implementing a Writable Stream[#](#stream_implementing_a_writable_stream) + +The `stream.Writable` class is extended to implement a [Writable](#stream_class_stream_writable) stream. + +Custom Writable streams *must* call the `new stream.Writable([options])` +constructor and implement the `writable._write()` method. The +`writable._writev()` method *may* also be implemented. + +#### Constructor: new stream.Writable([options])[#](#stream_constructor_new_stream_writable_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `highWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Buffer level when + [`stream.write()`](#stream_writable_write_chunk_encoding_callback) starts returning `false`. Defaults to + `16384` (16kb), or `16` for `objectMode` streams. + + `decodeStrings` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether or not to decode strings into + Buffers before passing them to [`stream._write()`](#stream_writable_write_chunk_encoding_callback_1). + Defaults to `true` + + `objectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether or not the + [`stream.write(anyObj)`](#stream_writable_write_chunk_encoding_callback) is a valid operation. When set, + it becomes possible to write JavaScript values other than string or + `Buffer` if supported by the stream implementation. Defaults to `false` + + `write` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._write()`](#stream_writable_write_chunk_encoding_callback_1) method. + + `writev` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._writev()`](#stream_writable_writev_chunks_callback) method. + +For example: + +```None +const Writable = require('stream').Writable; + +class MyWritable extends Writable { + constructor(options) { + // Calls the stream.Writable() constructor + super(options); + // ... + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const Writable = require('stream').Writable; +const util = require('util'); + +function MyWritable(options) { + if (!(this instanceof MyWritable)) + return new MyWritable(options); + Writable.call(this, options); +} +util.inherits(MyWritable, Writable); +``` + +Or, using the Simplified Constructor approach: + +```None +const Writable = require('stream').Writable; + +const myWritable = new Writable({ + write(chunk, encoding, callback) { + // ... + }, + writev(chunks, callback) { + // ... + } +}); +``` + +#### writable.\_write(chunk, encoding, callback)[#](#stream_writable_write_chunk_encoding_callback_1) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The chunk to be written. Will **always** + be a buffer unless the `decodeStrings` option was set to `false`. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If the chunk is a string, then `encoding` is the + character encoding of that string. If chunk is a `Buffer`, or if the + stream is operating in object mode, `encoding` may be ignored. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Call this function (optionally with an error + argument) when processing is complete for the supplied chunk. + +All Writable stream implementations must provide a +[`writable._write()`](#stream_writable_write_chunk_encoding_callback_1) method to send data to the underlying +resource. + +*Note*: [Transform](#stream_class_stream_transform) streams provide their own implementation of the +[`writable._write()`](#stream_writable_write_chunk_encoding_callback_1). + +*Note*: **This function MUST NOT be called by application code directly.** It +should be implemented by child classes, and called only by the internal Writable +class methods only. + +The `callback` method must be called to signal either that the write completed +successfully or failed with an error. The first argument passed to the +`callback` must be the `Error` object if the call failed or `null` if the +write succeeded. + +It is important to note that all calls to `writable.write()` that occur between +the time `writable._write()` is called and the `callback` is called will cause +the written data to be buffered. Once the `callback` is invoked, the stream will +emit a [`'drain'`](#stream_event_drain) event. If a stream implementation is capable of processing +multiple chunks of data at once, the `writable._writev()` method should be +implemented. + +If the `decodeStrings` property is set in the constructor options, then +`chunk` may be a string rather than a Buffer, and `encoding` will +indicate the character encoding of the string. This is to support +implementations that have an optimized handling for certain string +data encodings. If the `decodeStrings` property is explicitly set to `false`, +the `encoding` argument can be safely ignored, and `chunk` will remain the same +object that is passed to `.write()`. + +The `writable._write()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### writable.\_writev(chunks, callback)[#](#stream_writable_writev_chunks_callback) + +* `chunks` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) The chunks to be written. Each chunk has following + format: `{ chunk: ..., encoding: ... }`. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function (optionally with an error + argument) to be invoked when processing is complete for the supplied chunks. + +*Note*: **This function MUST NOT be called by application code directly.** It +should be implemented by child classes, and called only by the internal Writable +class methods only. + +The `writable._writev()` method may be implemented in addition to +`writable._write()` in stream implementations that are capable of processing +multiple chunks of data at once. If implemented, the method will be called with +all chunks of data currently buffered in the write queue. + +The `writable._writev()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### Errors While Writing[#](#stream_errors_while_writing) + +It is recommended that errors occurring during the processing of the +`writable._write()` and `writable._writev()` methods are reported by invoking +the callback and passing the error as the first argument. This will cause an +`'error'` event to be emitted by the Writable. Throwing an Error from within +`writable._write()` can result in unexpected and inconsistent behavior depending +on how the stream is being used. Using the callback ensures consistent and +predictable handling of errors. + +```None +const Writable = require('stream').Writable; + +const myWritable = new Writable({ + write(chunk, encoding, callback) { + if (chunk.toString().indexOf('a') >= 0) { + callback(new Error('chunk is invalid')); + } else { + callback(); + } + } +}); +``` + +#### An Example Writable Stream[#](#stream_an_example_writable_stream) + +The following illustrates a rather simplistic (and somewhat pointless) custom +Writable stream implementation. While this specific Writable stream instance +is not of any real particular usefulness, the example illustrates each of the +required elements of a custom [Writable](#stream_class_stream_writable) stream instance: + +```None +const Writable = require('stream').Writable; + +class MyWritable extends Writable { + constructor(options) { + super(options); + // ... + } + + _write(chunk, encoding, callback) { + if (chunk.toString().indexOf('a') >= 0) { + callback(new Error('chunk is invalid')); + } else { + callback(); + } + } +} +``` + +#### Decoding buffers in a Writable Stream[#](#stream_decoding_buffers_in_a_writable_stream) + +Decoding buffers is a common task, for instance, when using transformers whose +input is a string. This is not a trivial process when using multi-byte +characters encoding, such as UTF-8. The following example shows how to decode +multi-byte strings using `StringDecoder` and [Writable](#stream_class_stream_writable). + +```None +const { Writable } = require('stream'); +const { StringDecoder } = require('string_decoder'); + +class StringWritable extends Writable { + constructor(options) { + super(options); + const state = this._writableState; + this._decoder = new StringDecoder(state.defaultEncoding); + this.data = ''; + } + _write(chunk, encoding, callback) { + if (encoding === 'buffer') { + chunk = this._decoder.write(chunk); + } + this.data += chunk; + callback(); + } + _final(callback) { + this.data += this._decoder.end(); + callback(); + } +} + +const euro = [[0xE2, 0x82], [0xAC]].map(Buffer.from); +const w = new StringWritable(); + +w.write('currency: '); +w.write(euro[0]); +w.end(euro[1]); + +console.log(w.data); // currency: € +``` + +### Implementing a Readable Stream[#](#stream_implementing_a_readable_stream) + +The `stream.Readable` class is extended to implement a [Readable](#stream_class_stream_readable) stream. + +Custom Readable streams *must* call the `new stream.Readable([options])` +constructor and implement the `readable._read()` method. + +#### new stream.Readable([options])[#](#stream_new_stream_readable_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `highWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The maximum [number of bytes](#stream_highwatermark_discrepency_after_calling_readable_setencoding) to store + in the internal buffer before ceasing to read from the underlying resource. + Defaults to `16384` (16kb), or `16` for `objectMode` streams + + `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If specified, then buffers will be decoded to + strings using the specified encoding. Defaults to `null` + + `objectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether this stream should behave + as a stream of objects. Meaning that [`stream.read(n)`](#stream_readable_read_size) returns + a single value instead of a Buffer of size n. Defaults to `false` + + `read` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the [`stream._read()`](#stream_readable_read_size_1) + method. + +For example: + +```None +const Readable = require('stream').Readable; + +class MyReadable extends Readable { + constructor(options) { + // Calls the stream.Readable(options) constructor + super(options); + // ... + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const Readable = require('stream').Readable; +const util = require('util'); + +function MyReadable(options) { + if (!(this instanceof MyReadable)) + return new MyReadable(options); + Readable.call(this, options); +} +util.inherits(MyReadable, Readable); +``` + +Or, using the Simplified Constructor approach: + +```None +const Readable = require('stream').Readable; + +const myReadable = new Readable({ + read(size) { + // ... + } +}); +``` + +#### readable.\_read(size)[#](#stream_readable_read_size_1) + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Number of bytes to read asynchronously + +*Note*: **This function MUST NOT be called by application code directly.** It +should be implemented by child classes, and called only by the internal Readable +class methods only. + +All Readable stream implementations must provide an implementation of the +`readable._read()` method to fetch data from the underlying resource. + +When `readable._read()` is called, if data is available from the resource, the +implementation should begin pushing that data into the read queue using the +[`this.push(dataChunk)`](#stream_readable_push_chunk_encoding) method. `_read()` should continue reading +from the resource and pushing data until `readable.push()` returns `false`. Only +when `_read()` is called again after it has stopped should it resume pushing +additional data onto the queue. + +*Note*: Once the `readable._read()` method has been called, it will not be +called again until the [`readable.push()`](#stream_readable_push_chunk_encoding) method is called. + +The `size` argument is advisory. For implementations where a "read" is a +single operation that returns data can use the `size` argument to determine how +much data to fetch. Other implementations may ignore this argument and simply +provide data whenever it becomes available. There is no need to "wait" until +`size` bytes are available before calling [`stream.push(chunk)`](#stream_readable_push_chunk_encoding). + +The `readable._read()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### readable.push(chunk[, encoding])[#](#stream_readable_push_chunk_encoding) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Null_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Chunk of data to push into the read queue +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Encoding of String chunks. Must be a valid + Buffer encoding, such as `'utf8'` or `'ascii'` +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` if additional chunks of data may continued to be + pushed; `false` otherwise. + +When `chunk` is a `Buffer` or `string`, the `chunk` of data will be added to the +internal queue for users of the stream to consume. Passing `chunk` as `null` +signals the end of the stream (EOF), after which no more data can be written. + +When the Readable is operating in paused mode, the data added with +`readable.push()` can be read out by calling the +[`readable.read()`](#stream_readable_read_size) method when the [`'readable'`](#stream_event_readable) event is +emitted. + +When the Readable is operating in flowing mode, the data added with +`readable.push()` will be delivered by emitting a `'data'` event. + +The `readable.push()` method is designed to be as flexible as possible. For +example, when wrapping a lower-level source that provides some form of +pause/resume mechanism, and a data callback, the low-level source can be wrapped +by the custom Readable instance as illustrated in the following example: + +```None +// source is an object with readStop() and readStart() methods, +// and an `ondata` member that gets called when it has data, and +// an `onend` member that gets called when the data is over. + +class SourceWrapper extends Readable { + constructor(options) { + super(options); + + this._source = getLowlevelSourceObject(); + + // Every time there's data, push it into the internal buffer. + this._source.ondata = (chunk) => { + // if push() returns false, then stop reading from source + if (!this.push(chunk)) + this._source.readStop(); + }; + + // When the source ends, push the EOF-signaling `null` chunk + this._source.onend = () => { + this.push(null); + }; + } + // _read will be called when the stream wants to pull more data in + // the advisory size argument is ignored in this case. + _read(size) { + this._source.readStart(); + } +} +``` + +*Note*: The `readable.push()` method is intended be called only by Readable +Implementers, and only from within the `readable._read()` method. + +#### Errors While Reading[#](#stream_errors_while_reading) + +It is recommended that errors occurring during the processing of the +`readable._read()` method are emitted using the `'error'` event rather than +being thrown. Throwing an Error from within `readable._read()` can result in +unexpected and inconsistent behavior depending on whether the stream is +operating in flowing or paused mode. Using the `'error'` event ensures +consistent and predictable handling of errors. + +```None +const Readable = require('stream').Readable; + +const myReadable = new Readable({ + read(size) { + if (checkSomeErrorCondition()) { + process.nextTick(() => this.emit('error', err)); + return; + } + // do some work + } +}); +``` + +#### An Example Counting Stream[#](#stream_an_example_counting_stream) + +The following is a basic example of a Readable stream that emits the numerals +from 1 to 1,000,000 in ascending order, and then ends. + +```None +const Readable = require('stream').Readable; + +class Counter extends Readable { + constructor(opt) { + super(opt); + this._max = 1000000; + this._index = 1; + } + + _read() { + const i = this._index++; + if (i > this._max) + this.push(null); + else { + const str = '' + i; + const buf = Buffer.from(str, 'ascii'); + this.push(buf); + } + } +} +``` + +### Implementing a Duplex Stream[#](#stream_implementing_a_duplex_stream) + +A [Duplex](#stream_class_stream_duplex) stream is one that implements both [Readable](#stream_class_stream_readable) and [Writable](#stream_class_stream_writable), +such as a TCP socket connection. + +Because JavaScript does not have support for multiple inheritance, the +`stream.Duplex` class is extended to implement a [Duplex](#stream_class_stream_duplex) stream (as opposed +to extending the `stream.Readable` *and* `stream.Writable` classes). + +*Note*: The `stream.Duplex` class prototypically inherits from `stream.Readable` +and parasitically from `stream.Writable`, but `instanceof` will work properly +for both base classes due to overriding [`Symbol.hasInstance`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/hasInstance) +on `stream.Writable`. + +Custom Duplex streams *must* call the `new stream.Duplex([options])` +constructor and implement *both* the `readable._read()` and +`writable._write()` methods. + +#### new stream.Duplex(options)[#](#stream_new_stream_duplex_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Passed to both Writable and Readable + constructors. Also has the following fields: + + `allowHalfOpen` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Defaults to `true`. If set to `false`, then + the stream will automatically end the writable side when the + readable side ends. + + `readableObjectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Defaults to `false`. Sets `objectMode` + for readable side of the stream. Has no effect if `objectMode` + is `true`. + + `writableObjectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Defaults to `false`. Sets `objectMode` + for writable side of the stream. Has no effect if `objectMode` + is `true`. + +For example: + +```None +const Duplex = require('stream').Duplex; + +class MyDuplex extends Duplex { + constructor(options) { + super(options); + // ... + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const Duplex = require('stream').Duplex; +const util = require('util'); + +function MyDuplex(options) { + if (!(this instanceof MyDuplex)) + return new MyDuplex(options); + Duplex.call(this, options); +} +util.inherits(MyDuplex, Duplex); +``` + +Or, using the Simplified Constructor approach: + +```None +const Duplex = require('stream').Duplex; + +const myDuplex = new Duplex({ + read(size) { + // ... + }, + write(chunk, encoding, callback) { + // ... + } +}); +``` + +#### An Example Duplex Stream[#](#stream_an_example_duplex_stream) + +The following illustrates a simple example of a Duplex stream that wraps a +hypothetical lower-level source object to which data can be written, and +from which data can be read, albeit using an API that is not compatible with +Node.js streams. +The following illustrates a simple example of a Duplex stream that buffers +incoming written data via the [Writable](#stream_class_stream_writable) interface that is read back out +via the [Readable](#stream_class_stream_readable) interface. + +```None +const Duplex = require('stream').Duplex; +const kSource = Symbol('source'); + +class MyDuplex extends Duplex { + constructor(source, options) { + super(options); + this[kSource] = source; + } + + _write(chunk, encoding, callback) { + // The underlying source only deals with strings + if (Buffer.isBuffer(chunk)) + chunk = chunk.toString(); + this[kSource].writeSomeData(chunk); + callback(); + } + + _read(size) { + this[kSource].fetchSomeData(size, (data, encoding) => { + this.push(Buffer.from(data, encoding)); + }); + } +} +``` + +The most important aspect of a Duplex stream is that the Readable and Writable +sides operate independently of one another despite co-existing within a single +object instance. + +#### Object Mode Duplex Streams[#](#stream_object_mode_duplex_streams) + +For Duplex streams, `objectMode` can be set exclusively for either the Readable +or Writable side using the `readableObjectMode` and `writableObjectMode` options +respectively. + +In the following example, for instance, a new Transform stream (which is a +type of [Duplex](#stream_class_stream_duplex) stream) is created that has an object mode Writable side +that accepts JavaScript numbers that are converted to hexadecimal strings on +the Readable side. + +```None +const Transform = require('stream').Transform; + +// All Transform streams are also Duplex Streams +const myTransform = new Transform({ + writableObjectMode: true, + + transform(chunk, encoding, callback) { + // Coerce the chunk to a number if necessary + chunk |= 0; + + // Transform the chunk into something else. + const data = chunk.toString(16); + + // Push the data onto the readable queue. + callback(null, '0'.repeat(data.length % 2) + data); + } +}); + +myTransform.setEncoding('ascii'); +myTransform.on('data', (chunk) => console.log(chunk)); + +myTransform.write(1); +// Prints: 01 +myTransform.write(10); +// Prints: 0a +myTransform.write(100); +// Prints: 64 +``` + +### Implementing a Transform Stream[#](#stream_implementing_a_transform_stream) + +A [Transform](#stream_class_stream_transform) stream is a [Duplex](#stream_class_stream_duplex) stream where the output is computed +in some way from the input. Examples include [zlib](zlib.html) streams or [crypto](crypto.html) +streams that compress, encrypt, or decrypt data. + +*Note*: There is no requirement that the output be the same size as the input, +the same number of chunks, or arrive at the same time. For example, a +Hash stream will only ever have a single chunk of output which is +provided when the input is ended. A `zlib` stream will produce output +that is either much smaller or much larger than its input. + +The `stream.Transform` class is extended to implement a [Transform](#stream_class_stream_transform) stream. + +The `stream.Transform` class prototypically inherits from `stream.Duplex` and +implements its own versions of the `writable._write()` and `readable._read()` +methods. Custom Transform implementations *must* implement the +[`transform._transform()`](#stream_transform_transform_chunk_encoding_callback) method and *may* also implement +the [`transform._flush()`](#stream_transform_flush_callback) method. + +*Note*: Care must be taken when using Transform streams in that data written +to the stream can cause the Writable side of the stream to become paused if +the output on the Readable side is not consumed. + +#### new stream.Transform([options])[#](#stream_new_stream_transform_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Passed to both Writable and Readable + constructors. Also has the following fields: + + `transform` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._transform()`](#stream_transform_transform_chunk_encoding_callback) method. + + `flush` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the [`stream._flush()`](#stream_transform_flush_callback) + method. + +For example: + +```None +const Transform = require('stream').Transform; + +class MyTransform extends Transform { + constructor(options) { + super(options); + // ... + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const Transform = require('stream').Transform; +const util = require('util'); + +function MyTransform(options) { + if (!(this instanceof MyTransform)) + return new MyTransform(options); + Transform.call(this, options); +} +util.inherits(MyTransform, Transform); +``` + +Or, using the Simplified Constructor approach: + +```None +const Transform = require('stream').Transform; + +const myTransform = new Transform({ + transform(chunk, encoding, callback) { + // ... + } +}); +``` + +#### Events: 'finish' and 'end'[#](#stream_events_finish_and_end) + +The [`'finish'`](#stream_event_finish) and [`'end'`](#stream_event_end) events are from the `stream.Writable` +and `stream.Readable` classes, respectively. The `'finish'` event is emitted +after [`stream.end()`](#stream_writable_end_chunk_encoding_callback) is called and all chunks have been processed +by [`stream._transform()`](#stream_transform_transform_chunk_encoding_callback). The `'end'` event is emitted +after all data has been output, which occurs after the callback in +[`transform._flush()`](#stream_transform_flush_callback) has been called. + +#### transform.\_flush(callback)[#](#stream_transform_flush_callback) + +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function (optionally with an error + argument) to be called when remaining data has been flushed. + +*Note*: **This function MUST NOT be called by application code directly.** It +should be implemented by child classes, and called only by the internal Readable +class methods only. + +In some cases, a transform operation may need to emit an additional bit of +data at the end of the stream. For example, a `zlib` compression stream will +store an amount of internal state used to optimally compress the output. When +the stream ends, however, that additional data needs to be flushed so that the +compressed data will be complete. + +Custom [Transform](#stream_class_stream_transform) implementations *may* implement the `transform._flush()` +method. This will be called when there is no more written data to be consumed, +but before the [`'end'`](#stream_event_end) event is emitted signaling the end of the +[Readable](#stream_class_stream_readable) stream. + +Within the `transform._flush()` implementation, the `readable.push()` method +may be called zero or more times, as appropriate. The `callback` function must +be called when the flush operation is complete. + +The `transform._flush()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### transform.\_transform(chunk, encoding, callback)[#](#stream_transform_transform_chunk_encoding_callback) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The chunk to be transformed. Will **always** + be a buffer unless the `decodeStrings` option was set to `false`. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If the chunk is a string, then this is the + encoding type. If chunk is a buffer, then this is the special + value - 'buffer', ignore it in this case. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function (optionally with an error + argument and data) to be called after the supplied `chunk` has been + processed. + +*Note*: **This function MUST NOT be called by application code directly.** It +should be implemented by child classes, and called only by the internal Readable +class methods only. + +All Transform stream implementations must provide a `_transform()` +method to accept input and produce output. The `transform._transform()` +implementation handles the bytes being written, computes an output, then passes +that output off to the readable portion using the `readable.push()` method. + +The `transform.push()` method may be called zero or more times to generate +output from a single input chunk, depending on how much is to be output +as a result of the chunk. + +It is possible that no output is generated from any given chunk of input data. + +The `callback` function must be called only when the current chunk is completely +consumed. The first argument passed to the `callback` must be an `Error` object +if an error occurred while processing the input or `null` otherwise. If a second +argument is passed to the `callback`, it will be forwarded on to the +`readable.push()` method. In other words the following are equivalent: + +```None +transform.prototype._transform = function(data, encoding, callback) { + this.push(data); + callback(); +}; + +transform.prototype._transform = function(data, encoding, callback) { + callback(null, data); +}; +``` + +The `transform._transform()` method is prefixed with an underscore because it +is internal to the class that defines it, and should never be called directly by +user programs. + +`transform._transform()` is never called in parallel; streams implement a +queue mechanism, and to receive the next chunk, `callback` must be +called, either synchronously or asynchronously. + +#### Class: stream.PassThrough[#](#stream_class_stream_passthrough) + +The `stream.PassThrough` class is a trivial implementation of a [Transform](#stream_class_stream_transform) +stream that simply passes the input bytes across to the output. Its purpose is +primarily for examples and testing, but there are some use cases where +`stream.PassThrough` is useful as a building block for novel sorts of streams. + +## Additional Notes[#](#stream_additional_notes) + +### Compatibility with Older Node.js Versions[#](#stream_compatibility_with_older_node_js_versions) + +In versions of Node.js prior to v0.10, the Readable stream interface was +simpler, but also less powerful and less useful. + +* Rather than waiting for calls the [`stream.read()`](#stream_readable_read_size) method, + [`'data'`](#stream_event_data) events would begin emitting immediately. Applications that + would need to perform some amount of work to decide how to handle data + were required to store read data into buffers so the data would not be lost. +* The [`stream.pause()`](#stream_readable_pause) method was advisory, rather than + guaranteed. This meant that it was still necessary to be prepared to receive + [`'data'`](#stream_event_data) events *even when the stream was in a paused state*. + +In Node.js v0.10, the [Readable](#stream_class_stream_readable) class was added. For backwards compatibility +with older Node.js programs, Readable streams switch into "flowing mode" when a +[`'data'`](#stream_event_data) event handler is added, or when the +[`stream.resume()`](#stream_readable_resume) method is called. The effect is that, even +when not using the new [`stream.read()`](#stream_readable_read_size) method and +[`'readable'`](#stream_event_readable) event, it is no longer necessary to worry about losing +[`'data'`](#stream_event_data) chunks. + +While most applications will continue to function normally, this introduces an +edge case in the following conditions: + +* No [`'data'`](#stream_event_data) event listener is added. +* The [`stream.resume()`](#stream_readable_resume) method is never called. +* The stream is not piped to any writable destination. + +For example, consider the following code: + +```None +// WARNING! BROKEN! +net.createServer((socket) => { + + // we add an 'end' method, but never consume the data + socket.on('end', () => { + // It will never get here. + socket.end('The message was received but was not processed.\n'); + }); + +}).listen(1337); +``` + +In versions of Node.js prior to v0.10, the incoming message data would be +simply discarded. However, in Node.js v0.10 and beyond, the socket remains +paused forever. + +The workaround in this situation is to call the +[`stream.resume()`](#stream_readable_resume) method to begin the flow of data: + +```None +// Workaround +net.createServer((socket) => { + + socket.on('end', () => { + socket.end('The message was received but was not processed.\n'); + }); + + // start the flow of data, discarding it. + socket.resume(); + +}).listen(1337); +``` + +In addition to new Readable streams switching into flowing mode, +pre-v0.10 style streams can be wrapped in a Readable class using the +[`readable.wrap()`](#stream_readable_wrap_stream) method. + +### `readable.read(0)`[#](#stream_readable_read_0) + +There are some cases where it is necessary to trigger a refresh of the +underlying readable stream mechanisms, without actually consuming any +data. In such cases, it is possible to call `readable.read(0)`, which will +always return `null`. + +If the internal read buffer is below the `highWaterMark`, and the +stream is not currently reading, then calling `stream.read(0)` will trigger +a low-level [`stream._read()`](#stream_readable_read_size_1) call. + +While most applications will almost never need to do this, there are +situations within Node.js where this is done, particularly in the +Readable stream class internals. + +### `readable.push('')`[#](#stream_readable_push) + +Use of `readable.push('')` is not recommended. + +Pushing a zero-byte string or `Buffer` to a stream that is not in object mode +has an interesting side effect. Because it *is* a call to +[`readable.push()`](#stream_readable_push_chunk_encoding), the call will end the reading process. +However, because the argument is an empty string, no data is added to the +readable buffer so there is nothing for a user to consume. + +### `highWaterMark` discrepency after calling `readable.setEncoding()`[#](#stream_highwatermark_discrepency_after_calling_readable_setencoding) + +The use of `readable.setEncoding()` will change the behavior of how the +`highWaterMark` operates in non-object mode. + +Typically, the size of the current buffer is measured against the +`highWaterMark` in *bytes*. However, after `setEncoding()` is called, the +comparison function will begin to measure the buffer's size in *characters*. + +This is not a problem in common cases with `latin1` or `ascii`. But it is +advised to be mindful about this behavior when working with strings that could +contain multi-byte characters. diff --git a/corpus/docs/nodejs/stream/stream_7x.md b/corpus/docs/nodejs/stream/stream_7x.md new file mode 100644 index 0000000000000000000000000000000000000000..8878c430714bce441aa1aacd21943d8d708830ec --- /dev/null +++ b/corpus/docs/nodejs/stream/stream_7x.md @@ -0,0 +1,1932 @@ +# Stream# + +Source: https://nodejs.org/docs/latest-v7.x/api/stream.html +Version: 7.x + +```None +Stability: 2 - Stable +``` + +A stream is an abstract interface for working with streaming data in Node.js. +The `stream` module provides a base API that makes it easy to build objects +that implement the stream interface. + +There are many stream objects provided by Node.js. For instance, a +[request to an HTTP server](http.html#http_class_http_incomingmessage) and [`process.stdout`](process.html#process_process_stdout) +are both stream instances. + +Streams can be readable, writable, or both. All streams are instances of +[`EventEmitter`](events.html#events_class_eventemitter). + +The `stream` module can be accessed using: + +```None +const stream = require('stream'); +``` + +While it is important for all Node.js users to understand how streams work, +the `stream` module itself is most useful for developers that are creating new +types of stream instances. Developers who are primarily *consuming* stream +objects will rarely (if ever) have need to use the `stream` module directly. + +## Organization of this Document[#](#stream_organization_of_this_document) + +This document is divided into two primary sections with a third section for +additional notes. The first section explains the elements of the stream API that +are required to *use* streams within an application. The second section explains +the elements of the API that are required to *implement* new types of streams. + +## Types of Streams[#](#stream_types_of_streams) + +There are four fundamental stream types within Node.js: + +* [Readable](#stream_class_stream_readable) - streams from which data can be read (for example + [`fs.createReadStream()`](fs.html#fs_fs_createreadstream_path_options)). +* [Writable](#stream_class_stream_writable) - streams to which data can be written (for example + [`fs.createWriteStream()`](fs.html#fs_fs_createwritestream_path_options)). +* [Duplex](#stream_class_stream_duplex) - streams that are both Readable and Writable (for example + [`net.Socket`](net.html#net_class_net_socket)). +* [Transform](#stream_class_stream_transform) - Duplex streams that can modify or transform the data as it + is written and read (for example [`zlib.createDeflate()`](zlib.html#zlib_zlib_createdeflate_options)). + +### Object Mode[#](#stream_object_mode) + +All streams created by Node.js APIs operate exclusively on strings and `Buffer` +objects. It is possible, however, for stream implementations to work with other +types of JavaScript values (with the exception of `null`, which serves a special +purpose within streams). Such streams are considered to operate in "object +mode". + +Stream instances are switched into object mode using the `objectMode` option +when the stream is created. Attempting to switch an existing stream into +object mode is not safe. + +### Buffering[#](#stream_buffering) + +Both [Writable](#stream_class_stream_writable) and [Readable](#stream_class_stream_readable) streams will store data in an internal +buffer that can be retrieved using `writable._writableState.getBuffer()` or +`readable._readableState.buffer`, respectively. + +The amount of data potentially buffered depends on the `highWaterMark` option +passed into the streams constructor. For normal streams, the `highWaterMark` +option specifies a total number of bytes. For streams operating in object mode, +the `highWaterMark` specifies a total number of objects. + +Data is buffered in Readable streams when the implementation calls +[`stream.push(chunk)`](#stream_readable_push_chunk_encoding). If the consumer of the Stream does not +call [`stream.read()`](#stream_readable_read_size), the data will sit in the internal +queue until it is consumed. + +Once the total size of the internal read buffer reaches the threshold specified +by `highWaterMark`, the stream will temporarily stop reading data from the +underlying resource until the data currently buffered can be consumed (that is, +the stream will stop calling the internal `readable._read()` method that is +used to fill the read buffer). + +Data is buffered in Writable streams when the +[`writable.write(chunk)`](#stream_writable_write_chunk_encoding_callback) method is called repeatedly. While the +total size of the internal write buffer is below the threshold set by +`highWaterMark`, calls to `writable.write()` will return `true`. Once +the size of the internal buffer reaches or exceeds the `highWaterMark`, `false` +will be returned. + +A key goal of the `stream` API, particularly the [`stream.pipe()`](#stream_readable_pipe_destination_options) method, +is to limit the buffering of data to acceptable levels such that sources and +destinations of differing speeds will not overwhelm the available memory. + +Because [Duplex](#stream_class_stream_duplex) and [Transform](#stream_class_stream_transform) streams are both Readable and Writable, +each maintain *two* separate internal buffers used for reading and writing, +allowing each side to operate independently of the other while maintaining an +appropriate and efficient flow of data. For example, [`net.Socket`](net.html#net_class_net_socket) instances +are [Duplex](#stream_class_stream_duplex) streams whose Readable side allows consumption of data received +*from* the socket and whose Writable side allows writing data *to* the socket. +Because data may be written to the socket at a faster or slower rate than data +is received, it is important for each side to operate (and buffer) independently +of the other. + +## API for Stream Consumers[#](#stream_api_for_stream_consumers) + +Almost all Node.js applications, no matter how simple, use streams in some +manner. The following is an example of using streams in a Node.js application +that implements an HTTP server: + +```None +const http = require('http'); + +const server = http.createServer( (req, res) => { + // req is an http.IncomingMessage, which is a Readable Stream + // res is an http.ServerResponse, which is a Writable Stream + + let body = ''; + // Get the data as utf8 strings. + // If an encoding is not set, Buffer objects will be received. + req.setEncoding('utf8'); + + // Readable streams emit 'data' events once a listener is added + req.on('data', (chunk) => { + body += chunk; + }); + + // the end event indicates that the entire body has been received + req.on('end', () => { + try { + const data = JSON.parse(body); + // write back something interesting to the user: + res.write(typeof data); + res.end(); + } catch (er) { + // uh oh! bad json! + res.statusCode = 400; + return res.end(`error: ${er.message}`); + } + }); +}); + +server.listen(1337); + +// $ curl localhost:1337 -d '{}' +// object +// $ curl localhost:1337 -d '"foo"' +// string +// $ curl localhost:1337 -d 'not json' +// error: Unexpected token o +``` + +[Writable](#stream_class_stream_writable) streams (such as `res` in the example) expose methods such as +`write()` and `end()` that are used to write data onto the stream. + +[Readable](#stream_class_stream_readable) streams use the [`EventEmitter`](events.html#events_class_eventemitter) API for notifying application +code when data is available to be read off the stream. That available data can +be read from the stream in multiple ways. + +Both [Writable](#stream_class_stream_writable) and [Readable](#stream_class_stream_readable) streams use the [`EventEmitter`](events.html#events_class_eventemitter) API in +various ways to communicate the current state of the stream. + +[Duplex](#stream_class_stream_duplex) and [Transform](#stream_class_stream_transform) streams are both [Writable](#stream_class_stream_writable) and [Readable](#stream_class_stream_readable). + +Applications that are either writing data to or consuming data from a stream +are not required to implement the stream interfaces directly and will generally +have no reason to call `require('stream')`. + +Developers wishing to implement new types of streams should refer to the +section [API for Stream Implementers](#stream_api_for_stream_implementers). + +### Writable Streams[#](#stream_writable_streams) + +Writable streams are an abstraction for a *destination* to which data is +written. + +Examples of [Writable](#stream_class_stream_writable) streams include: + +* [HTTP requests, on the client](http.html#http_class_http_clientrequest) +* [HTTP responses, on the server](http.html#http_class_http_serverresponse) +* [fs write streams](fs.html#fs_class_fs_writestream) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) +* [TCP sockets](net.html#net_class_net_socket) +* [child process stdin](child_process.html#child_process_child_stdin) +* [`process.stdout`](process.html#process_process_stdout), [`process.stderr`](process.html#process_process_stderr) + +*Note*: Some of these examples are actually [Duplex](#stream_class_stream_duplex) streams that implement +the [Writable](#stream_class_stream_writable) interface. + +All [Writable](#stream_class_stream_writable) streams implement the interface defined by the +`stream.Writable` class. + +While specific instances of [Writable](#stream_class_stream_writable) streams may differ in various ways, +all Writable streams follow the same fundamental usage pattern as illustrated +in the example below: + +```None +const myStream = getWritableStreamSomehow(); +myStream.write('some data'); +myStream.write('some more data'); +myStream.end('done writing data'); +``` + +#### Class: stream.Writable[#](#stream_class_stream_writable) + +Added in: v0.9.4 + +##### Event: 'close'[#](#stream_event_close) + +Added in: v0.9.4 + +The `'close'` event is emitted when the stream and any of its underlying +resources (a file descriptor, for example) have been closed. The event indicates +that no more events will be emitted, and no further computation will occur. + +Not all Writable streams will emit the `'close'` event. + +##### Event: 'drain'[#](#stream_event_drain) + +Added in: v0.9.4 + +If a call to [`stream.write(chunk)`](#stream_writable_write_chunk_encoding_callback) returns `false`, the +`'drain'` event will be emitted when it is appropriate to resume writing data +to the stream. + +```None +// Write the data to the supplied writable stream one million times. +// Be attentive to back-pressure. +function writeOneMillionTimes(writer, data, encoding, callback) { + let i = 1000000; + write(); + function write() { + var ok = true; + do { + i--; + if (i === 0) { + // last time! + writer.write(data, encoding, callback); + } else { + // see if we should continue, or wait + // don't pass the callback, because we're not done yet. + ok = writer.write(data, encoding); + } + } while (i > 0 && ok); + if (i > 0) { + // had to stop early! + // write some more once it drains + writer.once('drain', write); + } + } +} +``` + +##### Event: 'error'[#](#stream_event_error) + +Added in: v0.9.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + +The `'error'` event is emitted if an error occurred while writing or piping +data. The listener callback is passed a single `Error` argument when called. + +*Note*: The stream is not closed when the `'error'` event is emitted. + +##### Event: 'finish'[#](#stream_event_finish) + +Added in: v0.9.4 + +The `'finish'` event is emitted after the [`stream.end()`](#stream_writable_end_chunk_encoding_callback) method +has been called, and all data has been flushed to the underlying system. + +```None +const writer = getWritableStreamSomehow(); +for (var i = 0; i < 100; i ++) { + writer.write(`hello, #${i}!\n`); +} +writer.end('This is the end\n'); +writer.on('finish', () => { + console.error('All writes are now complete.'); +}); +``` + +##### Event: 'pipe'[#](#stream_event_pipe) + +Added in: v0.9.4 + +* `src` [](stream.html#stream_class_stream_readable) source stream that is piping to this writable + +The `'pipe'` event is emitted when the [`stream.pipe()`](#stream_readable_pipe_destination_options) method is called on +a readable stream, adding this writable to its set of destinations. + +```None +const writer = getWritableStreamSomehow(); +const reader = getReadableStreamSomehow(); +writer.on('pipe', (src) => { + console.error('something is piping into the writer'); + assert.equal(src, reader); +}); +reader.pipe(writer); +``` + +##### Event: 'unpipe'[#](#stream_event_unpipe) + +Added in: v0.9.4 + +* `src` <[Readable](#stream_class_stream_readable) Stream> The source stream that + [unpiped](#stream_readable_unpipe_destination) this writable + +The `'unpipe'` event is emitted when the [`stream.unpipe()`](#stream_readable_unpipe_destination) method is called +on a [Readable](#stream_class_stream_readable) stream, removing this [Writable](#stream_class_stream_writable) from its set of +destinations. + +```None +const writer = getWritableStreamSomehow(); +const reader = getReadableStreamSomehow(); +writer.on('unpipe', (src) => { + console.error('Something has stopped piping into the writer.'); + assert.equal(src, reader); +}); +reader.pipe(writer); +reader.unpipe(writer); +``` + +##### writable.cork()[#](#stream_writable_cork) + +Added in: v0.11.2 + +The `writable.cork()` method forces all written data to be buffered in memory. +The buffered data will be flushed when either the [`stream.uncork()`](#stream_writable_uncork) or +[`stream.end()`](#stream_writable_end_chunk_encoding_callback) methods are called. + +The primary intent of `writable.cork()` is to avoid a situation where writing +many small chunks of data to a stream do not cause a backup in the internal +buffer that would have an adverse impact on performance. In such situations, +implementations that implement the `writable._writev()` method can perform +buffered writes in a more optimized manner. + +See also: [`writable.uncork()`](#stream_writable_uncork). + +##### writable.end([chunk][, encoding][, callback])[#](#stream_writable_end_chunk_encoding_callback) + +Added in: v0.9.4 + +* `chunk` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | Optional data to write. For streams not operating + in object mode, `chunk` must be a string or a `Buffer`. For object mode + streams, `chunk` may be any JavaScript value other than `null`. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding, if `chunk` is a String +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Optional callback for when the stream is finished + +Calling the `writable.end()` method signals that no more data will be written +to the [Writable](#stream_class_stream_writable). The optional `chunk` and `encoding` arguments allow one +final additional chunk of data to be written immediately before closing the +stream. If provided, the optional `callback` function is attached as a listener +for the [`'finish'`](#stream_event_finish) event. + +Calling the [`stream.write()`](#stream_writable_write_chunk_encoding_callback) method after calling +[`stream.end()`](#stream_writable_end_chunk_encoding_callback) will raise an error. + +```None +// write 'hello, ' and then end with 'world!' +const file = fs.createWriteStream('example.txt'); +file.write('hello, '); +file.end('world!'); +// writing more now is not allowed! +``` + +##### writable.setDefaultEncoding(encoding)[#](#stream_writable_setdefaultencoding_encoding) + +History + +| Version | Changes | +| --- | --- | +| v6.1.0 | This method now returns a reference to `writable`. | +| v0.11.15 | Added in: v0.11.15 | + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The new default encoding +* Returns: `this` + +The `writable.setDefaultEncoding()` method sets the default `encoding` for a +[Writable](#stream_class_stream_writable) stream. + +##### writable.uncork()[#](#stream_writable_uncork) + +Added in: v0.11.2 + +The `writable.uncork()` method flushes all data buffered since +[`stream.cork()`](#stream_writable_cork) was called. + +When using [`writable.cork()`](#stream_writable_cork) and `writable.uncork()` to manage the buffering +of writes to a stream, it is recommended that calls to `writable.uncork()` be +deferred using `process.nextTick()`. Doing so allows batching of all +`writable.write()` calls that occur within a given Node.js event loop phase. + +```None +stream.cork(); +stream.write('some '); +stream.write('data '); +process.nextTick(() => stream.uncork()); +``` + +If the [`writable.cork()`](#stream_writable_cork) method is called multiple times on a stream, the same +number of calls to `writable.uncork()` must be called to flush the buffered +data. + +```None +stream.cork(); +stream.write('some '); +stream.cork(); +stream.write('data '); +process.nextTick(() => { + stream.uncork(); + // The data will not be flushed until uncork() is called a second time. + stream.uncork(); +}); +``` + +See also: [`writable.cork()`](#stream_writable_cork). + +##### writable.write(chunk[, encoding][, callback])[#](#stream_writable_write_chunk_encoding_callback) + +History + +| Version | Changes | +| --- | --- | +| v6.0.0 | Passing `null` as the `chunk` parameter will always be considered invalid now, even in object mode. | +| v0.9.4 | Added in: v0.9.4 | + +* `chunk` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) The data to write +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding, if `chunk` is a String +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Callback for when this chunk of data is flushed +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `false` if the stream wishes for the calling code to + wait for the `'drain'` event to be emitted before continuing to write + additional data; otherwise `true`. + +The `writable.write()` method writes some data to the stream, and calls the +supplied `callback` once the data has been fully handled. If an error +occurs, the `callback` *may or may not* be called with the error as its +first argument. To reliably detect write errors, add a listener for the +`'error'` event. + +The return value is `true` if the internal buffer is less than the +`highWaterMark` configured when the stream was created after admitting `chunk`. +If `false` is returned, further attempts to write data to the stream should +stop until the [`'drain'`](#stream_event_drain) event is emitted. + +While a stream is not draining, calls to `write()` will buffer `chunk`, and +return false. Once all currently buffered chunks are drained (accepted for +delivery by the operating system), the `'drain'` event will be emitted. +It is recommended that once write() returns false, no more chunks be written +until the `'drain'` event is emitted. While calling `write()` on a stream that +is not draining is allowed, Node.js will buffer all written chunks until +maximum memory usage occurs, at which point it will abort unconditionally. +Even before it aborts, high memory usage will cause poor garbage collector +performance and high RSS (which is not typically released back to the system, +even after the memory is no longer required). Since TCP sockets may never +drain if the remote peer does not read the data, writing a socket that is +not draining may lead to a remotely exploitable vulnerability. + +Writing data while the stream is not draining is particularly +problematic for a [Transform](#stream_class_stream_transform), because the `Transform` streams are paused +by default until they are piped or an `'data'` or `'readable'` event handler +is added. + +If the data to be written can be generated or fetched on demand, it is +recommended to encapsulate the logic into a [Readable](#stream_class_stream_readable) and use +[`stream.pipe()`](#stream_readable_pipe_destination_options). However, if calling `write()` is preferred, it is +possible to respect backpressure and avoid memory issues using the +[`'drain'`](#stream_event_drain) event: + +```None +function write (data, cb) { + if (!stream.write(data)) { + stream.once('drain', cb) + } else { + process.nextTick(cb) + } +} + +// Wait for cb to be called before doing any other write. +write('hello', () => { + console.log('write completed, do more writes now') +}) +``` + +A Writable stream in object mode will always ignore the `encoding` argument. + +### Readable Streams[#](#stream_readable_streams) + +Readable streams are an abstraction for a *source* from which data is +consumed. + +Examples of Readable streams include: + +* [HTTP responses, on the client](http.html#http_class_http_incomingmessage) +* [HTTP requests, on the server](http.html#http_class_http_incomingmessage) +* [fs read streams](fs.html#fs_class_fs_readstream) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) +* [TCP sockets](net.html#net_class_net_socket) +* [child process stdout and stderr](child_process.html#child_process_child_stdout) +* [`process.stdin`](process.html#process_process_stdin) + +All [Readable](#stream_class_stream_readable) streams implement the interface defined by the +`stream.Readable` class. + +#### Two Modes[#](#stream_two_modes) + +Readable streams effectively operate in one of two modes: flowing and paused. + +When in flowing mode, data is read from the underlying system automatically +and provided to an application as quickly as possible using events via the +[`EventEmitter`](events.html#events_class_eventemitter) interface. + +In paused mode, the [`stream.read()`](#stream_readable_read_size) method must be called +explicitly to read chunks of data from the stream. + +All [Readable](#stream_class_stream_readable) streams begin in paused mode but can be switched to flowing +mode in one of the following ways: + +* Adding a [`'data'`](#stream_event_data) event handler. +* Calling the [`stream.resume()`](#stream_readable_resume) method. +* Calling the [`stream.pipe()`](#stream_readable_pipe_destination_options) method to send the data to a [Writable](#stream_class_stream_writable). + +The Readable can switch back to paused mode using one of the following: + +* If there are no pipe destinations, by calling the + [`stream.pause()`](#stream_readable_pause) method. +* If there are pipe destinations, by removing any [`'data'`](#stream_event_data) event + handlers, and removing all pipe destinations by calling the + [`stream.unpipe()`](#stream_readable_unpipe_destination) method. + +The important concept to remember is that a Readable will not generate data +until a mechanism for either consuming or ignoring that data is provided. If +the consuming mechanism is disabled or taken away, the Readable will *attempt* +to stop generating the data. + +*Note*: For backwards compatibility reasons, removing [`'data'`](#stream_event_data) event +handlers will **not** automatically pause the stream. Also, if there are piped +destinations, then calling [`stream.pause()`](#stream_readable_pause) will not guarantee +that the stream will *remain* paused once those destinations drain and ask for +more data. + +*Note*: If a [Readable](#stream_class_stream_readable) is switched into flowing mode and there are no +consumers available to handle the data, that data will be lost. This can occur, +for instance, when the `readable.resume()` method is called without a listener +attached to the `'data'` event, or when a `'data'` event handler is removed +from the stream. + +#### Three States[#](#stream_three_states) + +The "two modes" of operation for a Readable stream are a simplified abstraction +for the more complicated internal state management that is happening within the +Readable stream implementation. + +Specifically, at any given point in time, every Readable is in one of three +possible states: + +* `readable._readableState.flowing = null` +* `readable._readableState.flowing = false` +* `readable._readableState.flowing = true` + +When `readable._readableState.flowing` is `null`, no mechanism for consuming the +streams data is provided so the stream will not generate its data. + +Attaching a listener for the `'data'` event, calling the `readable.pipe()` +method, or calling the `readable.resume()` method will switch +`readable._readableState.flowing` to `true`, causing the Readable to begin +actively emitting events as data is generated. + +Calling `readable.pause()`, `readable.unpipe()`, or receiving "back pressure" +will cause the `readable._readableState.flowing` to be set as `false`, +temporarily halting the flowing of events but *not* halting the generation of +data. + +While `readable._readableState.flowing` is `false`, data may be accumulating +within the streams internal buffer. + +#### Choose One[#](#stream_choose_one) + +The Readable stream API evolved across multiple Node.js versions and provides +multiple methods of consuming stream data. In general, developers should choose +*one* of the methods of consuming data and *should never* use multiple methods +to consume data from a single stream. + +Use of the `readable.pipe()` method is recommended for most users as it has been +implemented to provide the easiest way of consuming stream data. Developers that +require more fine-grained control over the transfer and generation of data can +use the [`EventEmitter`](events.html#events_class_eventemitter) and `readable.pause()`/`readable.resume()` APIs. + +#### Class: stream.Readable[#](#stream_class_stream_readable) + +Added in: v0.9.4 + +##### Event: 'close'[#](#stream_event_close_1) + +Added in: v0.9.4 + +The `'close'` event is emitted when the stream and any of its underlying +resources (a file descriptor, for example) have been closed. The event indicates +that no more events will be emitted, and no further computation will occur. + +Not all [Readable](#stream_class_stream_readable) streams will emit the `'close'` event. + +##### Event: 'data'[#](#stream_event_data) + +Added in: v0.9.4 + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | The chunk of data. For streams that are not + operating in object mode, the chunk will be either a string or `Buffer`. + For streams that are in object mode, the chunk can be any JavaScript value + other than `null`. + +The `'data'` event is emitted whenever the stream is relinquishing ownership of +a chunk of data to a consumer. This may occur whenever the stream is switched +in flowing mode by calling `readable.pipe()`, `readable.resume()`, or by +attaching a listener callback to the `'data'` event. The `'data'` event will +also be emitted whenever the `readable.read()` method is called and a chunk of +data is available to be returned. + +Attaching a `'data'` event listener to a stream that has not been explicitly +paused will switch the stream into flowing mode. Data will then be passed as +soon as it is available. + +The listener callback will be passed the chunk of data as a string if a default +encoding has been specified for the stream using the +`readable.setEncoding()` method; otherwise the data will be passed as a +`Buffer`. + +```None +const readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log(`Received ${chunk.length} bytes of data.`); +}); +``` + +##### Event: 'end'[#](#stream_event_end) + +Added in: v0.9.4 + +The `'end'` event is emitted when there is no more data to be consumed from +the stream. + +*Note*: The `'end'` event **will not be emitted** unless the data is +completely consumed. This can be accomplished by switching the stream into +flowing mode, or by calling [`stream.read()`](#stream_readable_read_size) repeatedly until +all data has been consumed. + +```None +const readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log(`Received ${chunk.length} bytes of data.`); +}); +readable.on('end', () => { + console.log('There will be no more data.'); +}); +``` + +##### Event: 'error'[#](#stream_event_error_1) + +Added in: v0.9.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + +The `'error'` event may be emitted by a Readable implementation at any time. +Typically, this may occur if the underlying stream in unable to generate data +due to an underlying internal failure, or when a stream implementation attempts +to push an invalid chunk of data. + +The listener callback will be passed a single `Error` object. + +##### Event: 'readable'[#](#stream_event_readable) + +Added in: v0.9.4 + +The `'readable'` event is emitted when there is data available to be read from +the stream. In some cases, attaching a listener for the `'readable'` event will +cause some amount of data to be read into an internal buffer. + +```None +const readable = getReadableStreamSomehow(); +readable.on('readable', () => { + // there is some data to read now +}); +``` + +The `'readable'` event will also be emitted once the end of the stream data +has been reached but before the `'end'` event is emitted. + +Effectively, the `'readable'` event indicates that the stream has new +information: either new data is available or the end of the stream has been +reached. In the former case, [`stream.read()`](#stream_readable_read_size) will return the +available data. In the latter case, [`stream.read()`](#stream_readable_read_size) will return +`null`. For instance, in the following example, `foo.txt` is an empty file: + +```None +const fs = require('fs'); +const rr = fs.createReadStream('foo.txt'); +rr.on('readable', () => { + console.log('readable:', rr.read()); +}); +rr.on('end', () => { + console.log('end'); +}); +``` + +The output of running this script is: + +```None +$ node test.js +readable: null +end +``` + +*Note*: In general, the `readable.pipe()` and `'data'` event mechanisms are +preferred over the use of the `'readable'` event. + +##### readable.isPaused()[#](#stream_readable_ispaused) + +Added in: v0.11.14 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +The `readable.isPaused()` method returns the current operating state of the +Readable. This is used primarily by the mechanism that underlies the +`readable.pipe()` method. In most typical cases, there will be no reason to +use this method directly. + +```None +const readable = new stream.Readable + +readable.isPaused() // === false +readable.pause() +readable.isPaused() // === true +readable.resume() +readable.isPaused() // === false +``` + +##### readable.pause()[#](#stream_readable_pause) + +Added in: v0.9.4 + +* Returns: `this` + +The `readable.pause()` method will cause a stream in flowing mode to stop +emitting [`'data'`](#stream_event_data) events, switching out of flowing mode. Any data that +becomes available will remain in the internal buffer. + +```None +const readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log(`Received ${chunk.length} bytes of data.`); + readable.pause(); + console.log('There will be no additional data for 1 second.'); + setTimeout(() => { + console.log('Now data will start flowing again.'); + readable.resume(); + }, 1000); +}); +``` + +##### readable.pipe(destination[, options])[#](#stream_readable_pipe_destination_options) + +Added in: v0.9.4 + +* `destination` [](stream.html#stream_class_stream_writable) The destination for writing data +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Pipe options + + `end` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) End the writer when the reader ends. Defaults to `true`. + +The `readable.pipe()` method attaches a [Writable](#stream_class_stream_writable) stream to the `readable`, +causing it to switch automatically into flowing mode and push all of its data +to the attached [Writable](#stream_class_stream_writable). The flow of data will be automatically managed so +that the destination Writable stream is not overwhelmed by a faster Readable +stream. + +The following example pipes all of the data from the `readable` into a file +named `file.txt`: + +```None +const readable = getReadableStreamSomehow(); +const writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt' +readable.pipe(writable); +``` + +It is possible to attach multiple Writable streams to a single Readable stream. + +The `readable.pipe()` method returns a reference to the *destination* stream +making it possible to set up chains of piped streams: + +```None +const r = fs.createReadStream('file.txt'); +const z = zlib.createGzip(); +const w = fs.createWriteStream('file.txt.gz'); +r.pipe(z).pipe(w); +``` + +By default, [`stream.end()`](#stream_writable_end_chunk_encoding_callback) is called on the destination Writable +stream when the source Readable stream emits [`'end'`](#stream_event_end), so that the +destination is no longer writable. To disable this default behavior, the `end` +option can be passed as `false`, causing the destination stream to remain open, +as illustrated in the following example: + +```None +reader.pipe(writer, { end: false }); +reader.on('end', () => { + writer.end('Goodbye\n'); +}); +``` + +One important caveat is that if the Readable stream emits an error during +processing, the Writable destination *is not closed* automatically. If an +error occurs, it will be necessary to *manually* close each stream in order +to prevent memory leaks. + +*Note*: The [`process.stderr`](process.html#process_process_stderr) and [`process.stdout`](process.html#process_process_stdout) Writable streams are +never closed until the Node.js process exits, regardless of the specified +options. + +##### readable.read([size])[#](#stream_readable_read_size) + +Added in: v0.9.4 + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Optional argument to specify how much data to read. +* Return [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Null_type) + +The `readable.read()` method pulls some data out of the internal buffer and +returns it. If no data available to be read, `null` is returned. By default, +the data will be returned as a `Buffer` object unless an encoding has been +specified using the `readable.setEncoding()` method or the stream is operating +in object mode. + +The optional `size` argument specifies a specific number of bytes to read. If +`size` bytes are not available to be read, `null` will be returned *unless* +the stream has ended, in which case all of the data remaining in the internal +buffer will be returned (*even if it exceeds `size` bytes*). + +If the `size` argument is not specified, all of the data contained in the +internal buffer will be returned. + +The `readable.read()` method should only be called on Readable streams operating +in paused mode. In flowing mode, `readable.read()` is called automatically until +the internal buffer is fully drained. + +```None +const readable = getReadableStreamSomehow(); +readable.on('readable', () => { + var chunk; + while (null !== (chunk = readable.read())) { + console.log(`Received ${chunk.length} bytes of data.`); + } +}); +``` + +In general, it is recommended that developers avoid the use of the `'readable'` +event and the `readable.read()` method in favor of using either +`readable.pipe()` or the `'data'` event. + +A Readable stream in object mode will always return a single item from +a call to [`readable.read(size)`](#stream_readable_read_size), regardless of the value of the +`size` argument. + +*Note:* If the `readable.read()` method returns a chunk of data, a `'data'` +event will also be emitted. + +*Note*: Calling [`stream.read([size])`](#stream_readable_read_size) after the [`'end'`](#stream_event_end) +event has been emitted will return `null`. No runtime error will be raised. + +##### readable.resume()[#](#stream_readable_resume) + +Added in: v0.9.4 + +* Returns: `this` + +The `readable.resume()` method causes an explicitly paused Readable stream to +resume emitting [`'data'`](#stream_event_data) events, switching the stream into flowing mode. + +The `readable.resume()` method can be used to fully consume the data from a +stream without actually processing any of that data as illustrated in the +following example: + +```None +getReadableStreamSomehow() + .resume() + .on('end', () => { + console.log('Reached the end, but did not read anything.'); + }); +``` + +##### readable.setEncoding(encoding)[#](#stream_readable_setencoding_encoding) + +Added in: v0.9.4 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding to use. +* Returns: `this` + +The `readable.setEncoding()` method sets the default character encoding for +data read from the Readable stream. + +Setting an encoding causes the stream data +to be returned as string of the specified encoding rather than as `Buffer` +objects. For instance, calling `readable.setEncoding('utf8')` will cause the +output data will be interpreted as UTF-8 data, and passed as strings. Calling +`readable.setEncoding('hex')` will cause the data to be encoded in hexadecimal +string format. + +The Readable stream will properly handle multi-byte characters delivered through +the stream that would otherwise become improperly decoded if simply pulled from +the stream as `Buffer` objects. + +Encoding can be disabled by calling `readable.setEncoding(null)`. This approach +is useful when working with binary data or with large multi-byte strings spread +out over multiple chunks. + +```None +const readable = getReadableStreamSomehow(); +readable.setEncoding('utf8'); +readable.on('data', (chunk) => { + assert.equal(typeof chunk, 'string'); + console.log('got %d characters of string data', chunk.length); +}); +``` + +##### readable.unpipe([destination])[#](#stream_readable_unpipe_destination) + +Added in: v0.9.4 + +* `destination` [](stream.html#stream_class_stream_writable) Optional specific stream to unpipe + +The `readable.unpipe()` method detaches a Writable stream previously attached +using the [`stream.pipe()`](#stream_readable_pipe_destination_options) method. + +If the `destination` is not specified, then *all* pipes are detached. + +If the `destination` is specified, but no pipe is set up for it, then +the method does nothing. + +```None +const readable = getReadableStreamSomehow(); +const writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt', +// but only for the first second +readable.pipe(writable); +setTimeout(() => { + console.log('Stop writing to file.txt'); + readable.unpipe(writable); + console.log('Manually close the file stream'); + writable.end(); +}, 1000); +``` + +##### readable.unshift(chunk)[#](#stream_readable_unshift_chunk) + +Added in: v0.9.11 + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | Chunk of data to unshift onto the read queue + +The `readable.unshift()` method pushes a chunk of data back into the internal +buffer. This is useful in certain situations where a stream is being consumed by +code that needs to "un-consume" some amount of data that it has optimistically +pulled out of the source, so that the data can be passed on to some other party. + +*Note*: The `stream.unshift(chunk)` method cannot be called after the +[`'end'`](#stream_event_end) event has been emitted or a runtime error will be thrown. + +Developers using `stream.unshift()` often should consider switching to +use of a [Transform](#stream_class_stream_transform) stream instead. See the [API for Stream Implementers](#stream_api_for_stream_implementers) +section for more information. + +```None +// Pull off a header delimited by \n\n +// use unshift() if we get too much +// Call the callback with (error, header, stream) +const StringDecoder = require('string_decoder').StringDecoder; +function parseHeader(stream, callback) { + stream.on('error', callback); + stream.on('readable', onReadable); + const decoder = new StringDecoder('utf8'); + var header = ''; + function onReadable() { + var chunk; + while (null !== (chunk = stream.read())) { + var str = decoder.write(chunk); + if (str.match(/\n\n/)) { + // found the header boundary + var split = str.split(/\n\n/); + header += split.shift(); + const remaining = split.join('\n\n'); + const buf = Buffer.from(remaining, 'utf8'); + stream.removeListener('error', callback); + // remove the readable listener before unshifting + stream.removeListener('readable', onReadable); + if (buf.length) + stream.unshift(buf); + // now the body of the message can be read from the stream. + callback(null, header, stream); + } else { + // still reading the header. + header += str; + } + } + } +} +``` + +*Note*: Unlike [`stream.push(chunk)`](#stream_readable_push_chunk_encoding), `stream.unshift(chunk)` +will not end the reading process by resetting the internal reading state of the +stream. This can cause unexpected results if `readable.unshift()` is called +during a read (i.e. from within a [`stream._read()`](#stream_readable_read_size_1) +implementation on a custom stream). Following the call to `readable.unshift()` +with an immediate [`stream.push('')`](#stream_readable_push_chunk_encoding) will reset the reading state +appropriately, however it is best to simply avoid calling `readable.unshift()` +while in the process of performing a read. + +##### readable.wrap(stream)[#](#stream_readable_wrap_stream) + +Added in: v0.9.4 + +* `stream` [](stream.html#stream_stream) An "old style" readable stream + +Versions of Node.js prior to v0.10 had streams that did not implement the +entire `stream` module API as it is currently defined. (See [Compatibility](#stream_compatibility_with_older_node_js_versions) +for more information.) + +When using an older Node.js library that emits [`'data'`](#stream_event_data) events and has a +[`stream.pause()`](#stream_readable_pause) method that is advisory only, the +`readable.wrap()` method can be used to create a [Readable](#stream_class_stream_readable) stream that uses +the old stream as its data source. + +It will rarely be necessary to use `readable.wrap()` but the method has been +provided as a convenience for interacting with older Node.js applications and +libraries. + +For example: + +```None +const OldReader = require('./old-api-module.js').OldReader; +const Readable = require('stream').Readable; +const oreader = new OldReader; +const myReader = new Readable().wrap(oreader); + +myReader.on('readable', () => { + myReader.read(); // etc. +}); +``` + +### Duplex and Transform Streams[#](#stream_duplex_and_transform_streams) + +#### Class: stream.Duplex[#](#stream_class_stream_duplex) + +History + +| Version | Changes | +| --- | --- | +| v6.8.0 | Instances of `Duplex` now return `true` when checking `instanceof stream.Writable`. | +| v0.9.4 | Added in: v0.9.4 | + +Duplex streams are streams that implement both the [Readable](#stream_class_stream_readable) and +[Writable](#stream_class_stream_writable) interfaces. + +Examples of Duplex streams include: + +* [TCP sockets](net.html#net_class_net_socket) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) + +#### Class: stream.Transform[#](#stream_class_stream_transform) + +Added in: v0.9.4 + +Transform streams are [Duplex](#stream_class_stream_duplex) streams where the output is in some way +related to the input. Like all [Duplex](#stream_class_stream_duplex) streams, Transform streams +implement both the [Readable](#stream_class_stream_readable) and [Writable](#stream_class_stream_writable) interfaces. + +Examples of Transform streams include: + +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) + +## API for Stream Implementers[#](#stream_api_for_stream_implementers) + +The `stream` module API has been designed to make it possible to easily +implement streams using JavaScript's prototypal inheritance model. + +First, a stream developer would declare a new JavaScript class that extends one +of the four basic stream classes (`stream.Writable`, `stream.Readable`, +`stream.Duplex`, or `stream.Transform`), making sure they call the appropriate +parent class constructor: + +```None +const Writable = require('stream').Writable; + +class MyWritable extends Writable { + constructor(options) { + super(options); + } +} +``` + +The new stream class must then implement one or more specific methods, depending +on the type of stream being created, as detailed in the chart below: + +| Use-case | Class | Method(s) to implement | +| --- | --- | --- | +| Reading only | [Readable](#stream_class_stream_readable) | `_read` | +| Writing only | [Writable](#stream_class_stream_writable) | `_write`, `_writev` | +| Reading and writing | [Duplex](#stream_class_stream_duplex) | `_read`, `_write`, `_writev` | +| Operate on written data, then read the result | [Transform](#stream_class_stream_transform) | `_transform`, `_flush` | + +*Note*: The implementation code for a stream should *never* call the "public" +methods of a stream that are intended for use by consumers (as described in +the [API for Stream Consumers](#stream_api_for_stream_consumers) section). Doing so may lead to adverse +side effects in application code consuming the stream. + +### Simplified Construction[#](#stream_simplified_construction) + +Added in: v1.2.0 + +For many simple cases, it is possible to construct a stream without relying on +inheritance. This can be accomplished by directly creating instances of the +`stream.Writable`, `stream.Readable`, `stream.Duplex` or `stream.Transform` +objects and passing appropriate methods as constructor options. + +For example: + +```None +const Writable = require('stream').Writable; + +const myWritable = new Writable({ + write(chunk, encoding, callback) { + // ... + } +}); +``` + +### Implementing a Writable Stream[#](#stream_implementing_a_writable_stream) + +The `stream.Writable` class is extended to implement a [Writable](#stream_class_stream_writable) stream. + +Custom Writable streams *must* call the `new stream.Writable([options])` +constructor and implement the `writable._write()` method. The +`writable._writev()` method *may* also be implemented. + +#### Constructor: new stream.Writable([options])[#](#stream_constructor_new_stream_writable_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `highWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Buffer level when + [`stream.write()`](#stream_writable_write_chunk_encoding_callback) starts returning `false`. Defaults to + `16384` (16kb), or `16` for `objectMode` streams. + + `decodeStrings` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether or not to decode strings into + Buffers before passing them to [`stream._write()`](#stream_writable_write_chunk_encoding_callback_1). + Defaults to `true` + + `objectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether or not the + [`stream.write(anyObj)`](#stream_writable_write_chunk_encoding_callback) is a valid operation. When set, + it becomes possible to write JavaScript values other than string or + `Buffer` if supported by the stream implementation. Defaults to `false` + + `write` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._write()`](#stream_writable_write_chunk_encoding_callback_1) method. + + `writev` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._writev()`](#stream_writable_writev_chunks_callback) method. + +For example: + +```None +const Writable = require('stream').Writable; + +class MyWritable extends Writable { + constructor(options) { + // Calls the stream.Writable() constructor + super(options); + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const Writable = require('stream').Writable; +const util = require('util'); + +function MyWritable(options) { + if (!(this instanceof MyWritable)) + return new MyWritable(options); + Writable.call(this, options); +} +util.inherits(MyWritable, Writable); +``` + +Or, using the Simplified Constructor approach: + +```None +const Writable = require('stream').Writable; + +const myWritable = new Writable({ + write(chunk, encoding, callback) { + // ... + }, + writev(chunks, callback) { + // ... + } +}); +``` + +#### writable.\_write(chunk, encoding, callback)[#](#stream_writable_write_chunk_encoding_callback_1) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | The chunk to be written. Will **always** + be a buffer unless the `decodeStrings` option was set to `false` + or the stream is operating in object mode. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If the chunk is a string, then `encoding` is the + character encoding of that string. If chunk is a `Buffer`, or if the + stream is operating in object mode, `encoding` may be ignored. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Call this function (optionally with an error + argument) when processing is complete for the supplied chunk. + +All Writable stream implementations must provide a +[`writable._write()`](#stream_writable_write_chunk_encoding_callback_1) method to send data to the underlying +resource. + +*Note*: [Transform](#stream_class_stream_transform) streams provide their own implementation of the +[`writable._write()`](#stream_writable_write_chunk_encoding_callback_1). + +*Note*: **This function MUST NOT be called by application code directly.** It +should be implemented by child classes, and called only by the internal Writable +class methods only. + +The `callback` method must be called to signal either that the write completed +successfully or failed with an error. The first argument passed to the +`callback` must be the `Error` object if the call failed or `null` if the +write succeeded. + +It is important to note that all calls to `writable.write()` that occur between +the time `writable._write()` is called and the `callback` is called will cause +the written data to be buffered. Once the `callback` is invoked, the stream will +emit a [`'drain'`](#stream_event_drain) event. If a stream implementation is capable of processing +multiple chunks of data at once, the `writable._writev()` method should be +implemented. + +If the `decodeStrings` property is set in the constructor options, then +`chunk` may be a string rather than a Buffer, and `encoding` will +indicate the character encoding of the string. This is to support +implementations that have an optimized handling for certain string +data encodings. If the `decodeStrings` property is explicitly set to `false`, +the `encoding` argument can be safely ignored, and `chunk` will remain the same +object that is passed to `.write()`. + +The `writable._write()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### writable.\_writev(chunks, callback)[#](#stream_writable_writev_chunks_callback) + +* `chunks` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) The chunks to be written. Each chunk has following + format: `{ chunk: ..., encoding: ... }`. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function (optionally with an error + argument) to be invoked when processing is complete for the supplied chunks. + +*Note*: **This function MUST NOT be called by application code directly.** It +should be implemented by child classes, and called only by the internal Writable +class methods only. + +The `writable._writev()` method may be implemented in addition to +`writable._write()` in stream implementations that are capable of processing +multiple chunks of data at once. If implemented, the method will be called with +all chunks of data currently buffered in the write queue. + +The `writable._writev()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### Errors While Writing[#](#stream_errors_while_writing) + +It is recommended that errors occurring during the processing of the +`writable._write()` and `writable._writev()` methods are reported by invoking +the callback and passing the error as the first argument. This will cause an +`'error'` event to be emitted by the Writable. Throwing an Error from within +`writable._write()` can result in unexpected and inconsistent behavior depending +on how the stream is being used. Using the callback ensures consistent and +predictable handling of errors. + +```None +const Writable = require('stream').Writable; + +const myWritable = new Writable({ + write(chunk, encoding, callback) { + if (chunk.toString().indexOf('a') >= 0) { + callback(new Error('chunk is invalid')); + } else { + callback(); + } + } +}); +``` + +#### An Example Writable Stream[#](#stream_an_example_writable_stream) + +The following illustrates a rather simplistic (and somewhat pointless) custom +Writable stream implementation. While this specific Writable stream instance +is not of any real particular usefulness, the example illustrates each of the +required elements of a custom [Writable](#stream_class_stream_writable) stream instance: + +```None +const Writable = require('stream').Writable; + +class MyWritable extends Writable { + constructor(options) { + super(options); + } + + _write(chunk, encoding, callback) { + if (chunk.toString().indexOf('a') >= 0) { + callback(new Error('chunk is invalid')); + } else { + callback(); + } + } +} +``` + +### Implementing a Readable Stream[#](#stream_implementing_a_readable_stream) + +The `stream.Readable` class is extended to implement a [Readable](#stream_class_stream_readable) stream. + +Custom Readable streams *must* call the `new stream.Readable([options])` +constructor and implement the `readable._read()` method. + +#### new stream.Readable([options])[#](#stream_new_stream_readable_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `highWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The maximum number of bytes to store in + the internal buffer before ceasing to read from the underlying + resource. Defaults to `16384` (16kb), or `16` for `objectMode` streams + + `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If specified, then buffers will be decoded to + strings using the specified encoding. Defaults to `null` + + `objectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether this stream should behave + as a stream of objects. Meaning that [`stream.read(n)`](#stream_readable_read_size) returns + a single value instead of a Buffer of size n. Defaults to `false` + + `read` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the [`stream._read()`](#stream_readable_read_size_1) + method. + +For example: + +```None +const Readable = require('stream').Readable; + +class MyReadable extends Readable { + constructor(options) { + // Calls the stream.Readable(options) constructor + super(options); + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const Readable = require('stream').Readable; +const util = require('util'); + +function MyReadable(options) { + if (!(this instanceof MyReadable)) + return new MyReadable(options); + Readable.call(this, options); +} +util.inherits(MyReadable, Readable); +``` + +Or, using the Simplified Constructor approach: + +```None +const Readable = require('stream').Readable; + +const myReadable = new Readable({ + read(size) { + // ... + } +}); +``` + +#### readable.\_read(size)[#](#stream_readable_read_size_1) + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Number of bytes to read asynchronously + +*Note*: **This function MUST NOT be called by application code directly.** It +should be implemented by child classes, and called only by the internal Readable +class methods only. + +All Readable stream implementations must provide an implementation of the +`readable._read()` method to fetch data from the underlying resource. + +When `readable._read()` is called, if data is available from the resource, the +implementation should begin pushing that data into the read queue using the +[`this.push(dataChunk)`](#stream_readable_push_chunk_encoding) method. `_read()` should continue reading +from the resource and pushing data until `readable.push()` returns `false`. Only +when `_read()` is called again after it has stopped should it resume pushing +additional data onto the queue. + +*Note*: Once the `readable._read()` method has been called, it will not be +called again until the [`readable.push()`](#stream_readable_push_chunk_encoding) method is called. + +The `size` argument is advisory. For implementations where a "read" is a +single operation that returns data can use the `size` argument to determine how +much data to fetch. Other implementations may ignore this argument and simply +provide data whenever it becomes available. There is no need to "wait" until +`size` bytes are available before calling [`stream.push(chunk)`](#stream_readable_push_chunk_encoding). + +The `readable._read()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### readable.push(chunk[, encoding])[#](#stream_readable_push_chunk_encoding) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Null_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | Chunk of data to push into the read queue +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Encoding of String chunks. Must be a valid + Buffer encoding, such as `'utf8'` or `'ascii'` +* Returns [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` if additional chunks of data may continued to be + pushed; `false` otherwise. + +When `chunk` is not `null`, the `chunk` of data will be added to the +internal queue for users of the stream to consume. Passing `chunk` as `null` +signals the end of the stream (EOF), after which no more data can be written. + +When the Readable is operating in paused mode, the data added with +`readable.push()` can be read out by calling the +[`readable.read()`](#stream_readable_read_size) method when the [`'readable'`](#stream_event_readable) event is +emitted. + +When the Readable is operating in flowing mode, the data added with +`readable.push()` will be delivered by emitting a `'data'` event. + +The `readable.push()` method is designed to be as flexible as possible. For +example, when wrapping a lower-level source that provides some form of +pause/resume mechanism, and a data callback, the low-level source can be wrapped +by the custom Readable instance as illustrated in the following example: + +```None +// source is an object with readStop() and readStart() methods, +// and an `ondata` member that gets called when it has data, and +// an `onend` member that gets called when the data is over. + +class SourceWrapper extends Readable { + constructor(options) { + super(options); + + this._source = getLowlevelSourceObject(); + + // Every time there's data, push it into the internal buffer. + this._source.ondata = (chunk) => { + // if push() returns false, then stop reading from source + if (!this.push(chunk)) + this._source.readStop(); + }; + + // When the source ends, push the EOF-signaling `null` chunk + this._source.onend = () => { + this.push(null); + }; + } + // _read will be called when the stream wants to pull more data in + // the advisory size argument is ignored in this case. + _read(size) { + this._source.readStart(); + } +} +``` + +*Note*: The `readable.push()` method is intended be called only by Readable +Implementers, and only from within the `readable._read()` method. + +#### Errors While Reading[#](#stream_errors_while_reading) + +It is recommended that errors occurring during the processing of the +`readable._read()` method are emitted using the `'error'` event rather than +being thrown. Throwing an Error from within `readable._read()` can result in +unexpected and inconsistent behavior depending on whether the stream is +operating in flowing or paused mode. Using the `'error'` event ensures +consistent and predictable handling of errors. + +```None +const Readable = require('stream').Readable; + +const myReadable = new Readable({ + read(size) { + if (checkSomeErrorCondition()) { + process.nextTick(() => this.emit('error', err)); + return; + } + // do some work + } +}); +``` + +#### An Example Counting Stream[#](#stream_an_example_counting_stream) + +The following is a basic example of a Readable stream that emits the numerals +from 1 to 1,000,000 in ascending order, and then ends. + +```None +const Readable = require('stream').Readable; + +class Counter extends Readable { + constructor(opt) { + super(opt); + this._max = 1000000; + this._index = 1; + } + + _read() { + var i = this._index++; + if (i > this._max) + this.push(null); + else { + var str = '' + i; + var buf = Buffer.from(str, 'ascii'); + this.push(buf); + } + } +} +``` + +### Implementing a Duplex Stream[#](#stream_implementing_a_duplex_stream) + +A [Duplex](#stream_class_stream_duplex) stream is one that implements both [Readable](#stream_class_stream_readable) and [Writable](#stream_class_stream_writable), +such as a TCP socket connection. + +Because JavaScript does not have support for multiple inheritance, the +`stream.Duplex` class is extended to implement a [Duplex](#stream_class_stream_duplex) stream (as opposed +to extending the `stream.Readable` *and* `stream.Writable` classes). + +*Note*: The `stream.Duplex` class prototypically inherits from `stream.Readable` +and parasitically from `stream.Writable`, but `instanceof` will work properly +for both base classes due to overriding [`Symbol.hasInstance`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/hasInstance) +on `stream.Writable`. + +Custom Duplex streams *must* call the `new stream.Duplex([options])` +constructor and implement *both* the `readable._read()` and +`writable._write()` methods. + +#### new stream.Duplex(options)[#](#stream_new_stream_duplex_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Passed to both Writable and Readable + constructors. Also has the following fields: + + `allowHalfOpen` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Defaults to `true`. If set to `false`, then + the stream will automatically end the readable side when the + writable side ends and vice versa. + + `readableObjectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Defaults to `false`. Sets `objectMode` + for readable side of the stream. Has no effect if `objectMode` + is `true`. + + `writableObjectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Defaults to `false`. Sets `objectMode` + for writable side of the stream. Has no effect if `objectMode` + is `true`. + +For example: + +```None +const Duplex = require('stream').Duplex; + +class MyDuplex extends Duplex { + constructor(options) { + super(options); + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const Duplex = require('stream').Duplex; +const util = require('util'); + +function MyDuplex(options) { + if (!(this instanceof MyDuplex)) + return new MyDuplex(options); + Duplex.call(this, options); +} +util.inherits(MyDuplex, Duplex); +``` + +Or, using the Simplified Constructor approach: + +```None +const Duplex = require('stream').Duplex; + +const myDuplex = new Duplex({ + read(size) { + // ... + }, + write(chunk, encoding, callback) { + // ... + } +}); +``` + +#### An Example Duplex Stream[#](#stream_an_example_duplex_stream) + +The following illustrates a simple example of a Duplex stream that wraps a +hypothetical lower-level source object to which data can be written, and +from which data can be read, albeit using an API that is not compatible with +Node.js streams. +The following illustrates a simple example of a Duplex stream that buffers +incoming written data via the [Writable](#stream_class_stream_writable) interface that is read back out +via the [Readable](#stream_class_stream_readable) interface. + +```None +const Duplex = require('stream').Duplex; +const kSource = Symbol('source'); + +class MyDuplex extends Duplex { + constructor(source, options) { + super(options); + this[kSource] = source; + } + + _write(chunk, encoding, callback) { + // The underlying source only deals with strings + if (Buffer.isBuffer(chunk)) + chunk = chunk.toString(); + this[kSource].writeSomeData(chunk); + callback(); + } + + _read(size) { + this[kSource].fetchSomeData(size, (data, encoding) => { + this.push(Buffer.from(data, encoding)); + }); + } +} +``` + +The most important aspect of a Duplex stream is that the Readable and Writable +sides operate independently of one another despite co-existing within a single +object instance. + +#### Object Mode Duplex Streams[#](#stream_object_mode_duplex_streams) + +For Duplex streams, `objectMode` can be set exclusively for either the Readable +or Writable side using the `readableObjectMode` and `writableObjectMode` options +respectively. + +In the following example, for instance, a new Transform stream (which is a +type of [Duplex](#stream_class_stream_duplex) stream) is created that has an object mode Writable side +that accepts JavaScript numbers that are converted to hexadecimal strings on +the Readable side. + +```None +const Transform = require('stream').Transform; + +// All Transform streams are also Duplex Streams +const myTransform = new Transform({ + writableObjectMode: true, + + transform(chunk, encoding, callback) { + // Coerce the chunk to a number if necessary + chunk |= 0; + + // Transform the chunk into something else. + const data = chunk.toString(16); + + // Push the data onto the readable queue. + callback(null, '0'.repeat(data.length % 2) + data); + } +}); + +myTransform.setEncoding('ascii'); +myTransform.on('data', (chunk) => console.log(chunk)); + +myTransform.write(1); +// Prints: 01 +myTransform.write(10); +// Prints: 0a +myTransform.write(100); +// Prints: 64 +``` + +### Implementing a Transform Stream[#](#stream_implementing_a_transform_stream) + +A [Transform](#stream_class_stream_transform) stream is a [Duplex](#stream_class_stream_duplex) stream where the output is computed +in some way from the input. Examples include [zlib](zlib.html) streams or [crypto](crypto.html) +streams that compress, encrypt, or decrypt data. + +*Note*: There is no requirement that the output be the same size as the input, +the same number of chunks, or arrive at the same time. For example, a +Hash stream will only ever have a single chunk of output which is +provided when the input is ended. A `zlib` stream will produce output +that is either much smaller or much larger than its input. + +The `stream.Transform` class is extended to implement a [Transform](#stream_class_stream_transform) stream. + +The `stream.Transform` class prototypically inherits from `stream.Duplex` and +implements its own versions of the `writable._write()` and `readable._read()` +methods. Custom Transform implementations *must* implement the +[`transform._transform()`](#stream_transform_transform_chunk_encoding_callback) method and *may* also implement +the [`transform._flush()`](#stream_transform_flush_callback) method. + +*Note*: Care must be taken when using Transform streams in that data written +to the stream can cause the Writable side of the stream to become paused if +the output on the Readable side is not consumed. + +#### new stream.Transform([options])[#](#stream_new_stream_transform_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Passed to both Writable and Readable + constructors. Also has the following fields: + + `transform` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._transform()`](#stream_transform_transform_chunk_encoding_callback) method. + + `flush` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the [`stream._flush()`](#stream_transform_flush_callback) + method. + +For example: + +```None +const Transform = require('stream').Transform; + +class MyTransform extends Transform { + constructor(options) { + super(options); + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const Transform = require('stream').Transform; +const util = require('util'); + +function MyTransform(options) { + if (!(this instanceof MyTransform)) + return new MyTransform(options); + Transform.call(this, options); +} +util.inherits(MyTransform, Transform); +``` + +Or, using the Simplified Constructor approach: + +```None +const Transform = require('stream').Transform; + +const myTransform = new Transform({ + transform(chunk, encoding, callback) { + // ... + } +}); +``` + +#### Events: 'finish' and 'end'[#](#stream_events_finish_and_end) + +The [`'finish'`](#stream_event_finish) and [`'end'`](#stream_event_end) events are from the `stream.Writable` +and `stream.Readable` classes, respectively. The `'finish'` event is emitted +after [`stream.end()`](#stream_writable_end_chunk_encoding_callback) is called and all chunks have been processed +by [`stream._transform()`](#stream_transform_transform_chunk_encoding_callback). The `'end'` event is emitted +after all data has been output, which occurs after the callback in +[`transform._flush()`](#stream_transform_flush_callback) has been called. + +#### transform.\_flush(callback)[#](#stream_transform_flush_callback) + +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function (optionally with an error + argument and data) to be called when remaining data has been flushed. + +*Note*: **This function MUST NOT be called by application code directly.** It +should be implemented by child classes, and called only by the internal Readable +class methods only. + +In some cases, a transform operation may need to emit an additional bit of +data at the end of the stream. For example, a `zlib` compression stream will +store an amount of internal state used to optimally compress the output. When +the stream ends, however, that additional data needs to be flushed so that the +compressed data will be complete. + +Custom [Transform](#stream_class_stream_transform) implementations *may* implement the `transform._flush()` +method. This will be called when there is no more written data to be consumed, +but before the [`'end'`](#stream_event_end) event is emitted signaling the end of the +[Readable](#stream_class_stream_readable) stream. + +Within the `transform._flush()` implementation, the `readable.push()` method +may be called zero or more times, as appropriate. The `callback` function must +be called when the flush operation is complete. + +The `transform._flush()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### transform.\_transform(chunk, encoding, callback)[#](#stream_transform_transform_chunk_encoding_callback) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | The chunk to be transformed. Will **always** + be a buffer unless the `decodeStrings` option was set to `false` + or the stream is operating in object mode. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If the chunk is a string, then this is the + encoding type. If chunk is a buffer, then this is the special + value - 'buffer', ignore it in this case. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function (optionally with an error + argument and data) to be called after the supplied `chunk` has been + processed. + +*Note*: **This function MUST NOT be called by application code directly.** It +should be implemented by child classes, and called only by the internal Readable +class methods only. + +All Transform stream implementations must provide a `_transform()` +method to accept input and produce output. The `transform._transform()` +implementation handles the bytes being written, computes an output, then passes +that output off to the readable portion using the `readable.push()` method. + +The `transform.push()` method may be called zero or more times to generate +output from a single input chunk, depending on how much is to be output +as a result of the chunk. + +It is possible that no output is generated from any given chunk of input data. + +The `callback` function must be called only when the current chunk is completely +consumed. The first argument passed to the `callback` must be an `Error` object +if an error occurred while processing the input or `null` otherwise. If a second +argument is passed to the `callback`, it will be forwarded on to the +`readable.push()` method. In other words the following are equivalent: + +```None +transform.prototype._transform = function (data, encoding, callback) { + this.push(data); + callback(); +}; + +transform.prototype._transform = function (data, encoding, callback) { + callback(null, data); +}; +``` + +The `transform._transform()` method is prefixed with an underscore because it +is internal to the class that defines it, and should never be called directly by +user programs. + +#### Class: stream.PassThrough[#](#stream_class_stream_passthrough) + +The `stream.PassThrough` class is a trivial implementation of a [Transform](#stream_class_stream_transform) +stream that simply passes the input bytes across to the output. Its purpose is +primarily for examples and testing, but there are some use cases where +`stream.PassThrough` is useful as a building block for novel sorts of streams. + +## Additional Notes[#](#stream_additional_notes) + +### Compatibility with Older Node.js Versions[#](#stream_compatibility_with_older_node_js_versions) + +In versions of Node.js prior to v0.10, the Readable stream interface was +simpler, but also less powerful and less useful. + +* Rather than waiting for calls the [`stream.read()`](#stream_readable_read_size) method, + [`'data'`](#stream_event_data) events would begin emitting immediately. Applications that + would need to perform some amount of work to decide how to handle data + were required to store read data into buffers so the data would not be lost. +* The [`stream.pause()`](#stream_readable_pause) method was advisory, rather than + guaranteed. This meant that it was still necessary to be prepared to receive + [`'data'`](#stream_event_data) events *even when the stream was in a paused state*. + +In Node.js v0.10, the [Readable](#stream_class_stream_readable) class was added. For backwards compatibility +with older Node.js programs, Readable streams switch into "flowing mode" when a +[`'data'`](#stream_event_data) event handler is added, or when the +[`stream.resume()`](#stream_readable_resume) method is called. The effect is that, even +when not using the new [`stream.read()`](#stream_readable_read_size) method and +[`'readable'`](#stream_event_readable) event, it is no longer necessary to worry about losing +[`'data'`](#stream_event_data) chunks. + +While most applications will continue to function normally, this introduces an +edge case in the following conditions: + +* No [`'data'`](#stream_event_data) event listener is added. +* The [`stream.resume()`](#stream_readable_resume) method is never called. +* The stream is not piped to any writable destination. + +For example, consider the following code: + +```None +// WARNING! BROKEN! +net.createServer((socket) => { + + // we add an 'end' method, but never consume the data + socket.on('end', () => { + // It will never get here. + socket.end('The message was received but was not processed.\n'); + }); + +}).listen(1337); +``` + +In versions of Node.js prior to v0.10, the incoming message data would be +simply discarded. However, in Node.js v0.10 and beyond, the socket remains +paused forever. + +The workaround in this situation is to call the +[`stream.resume()`](#stream_readable_resume) method to begin the flow of data: + +```None +// Workaround +net.createServer((socket) => { + + socket.on('end', () => { + socket.end('The message was received but was not processed.\n'); + }); + + // start the flow of data, discarding it. + socket.resume(); + +}).listen(1337); +``` + +In addition to new Readable streams switching into flowing mode, +pre-v0.10 style streams can be wrapped in a Readable class using the +[`readable.wrap()`](#stream_readable_wrap_stream) method. + +### `readable.read(0)`[#](#stream_readable_read_0) + +There are some cases where it is necessary to trigger a refresh of the +underlying readable stream mechanisms, without actually consuming any +data. In such cases, it is possible to call `readable.read(0)`, which will +always return `null`. + +If the internal read buffer is below the `highWaterMark`, and the +stream is not currently reading, then calling `stream.read(0)` will trigger +a low-level [`stream._read()`](#stream_readable_read_size_1) call. + +While most applications will almost never need to do this, there are +situations within Node.js where this is done, particularly in the +Readable stream class internals. + +### `readable.push('')`[#](#stream_readable_push) + +Use of `readable.push('')` is not recommended. + +Pushing a zero-byte string or `Buffer` to a stream that is not in object mode +has an interesting side effect. Because it *is* a call to +[`readable.push()`](#stream_readable_push_chunk_encoding), the call will end the reading process. +However, because the argument is an empty string, no data is added to the +readable buffer so there is nothing for a user to consume. diff --git a/corpus/docs/nodejs/stream/stream_8x.md b/corpus/docs/nodejs/stream/stream_8x.md new file mode 100644 index 0000000000000000000000000000000000000000..f7ad5766fc49068dd43d83846558f92efd8ab191 --- /dev/null +++ b/corpus/docs/nodejs/stream/stream_8x.md @@ -0,0 +1,2134 @@ +# Stream# + +Source: https://nodejs.org/docs/latest-v8.x/api/stream.html +Version: 8.x + +[Stability: 2](documentation.html#documentation_stability_index) - Stable + +A stream is an abstract interface for working with streaming data in Node.js. +The `stream` module provides a base API that makes it easy to build objects +that implement the stream interface. + +There are many stream objects provided by Node.js. For instance, a +[request to an HTTP server](http.html#http_class_http_incomingmessage) and [`process.stdout`](process.html#process_process_stdout) +are both stream instances. + +Streams can be readable, writable, or both. All streams are instances of +[`EventEmitter`](events.html#events_class_eventemitter). + +The `stream` module can be accessed using: + +```None +const stream = require('stream'); +``` + +While it is important to understand how streams work, the `stream` module itself +is most useful for developers that are creating new types of stream instances. +Developers who are primarily *consuming* stream objects will rarely need to use +the `stream` module directly. + +## Organization of this Document[#](#stream_organization_of_this_document) + +This document is divided into two primary sections with a third section for +additional notes. The first section explains the elements of the stream API that +are required to *use* streams within an application. The second section explains +the elements of the API that are required to *implement* new types of streams. + +## Types of Streams[#](#stream_types_of_streams) + +There are four fundamental stream types within Node.js: + +* [Readable](#stream_class_stream_readable) - streams from which data can be read (for example + [`fs.createReadStream()`](fs.html#fs_fs_createreadstream_path_options)). +* [Writable](#stream_class_stream_writable) - streams to which data can be written (for example + [`fs.createWriteStream()`](fs.html#fs_fs_createwritestream_path_options)). +* [Duplex](#stream_class_stream_duplex) - streams that are both Readable and Writable (for example + [`net.Socket`](net.html#net_class_net_socket)). +* [Transform](#stream_class_stream_transform) - Duplex streams that can modify or transform the data as it + is written and read (for example [`zlib.createDeflate()`](zlib.html#zlib_zlib_createdeflate_options)). + +### Object Mode[#](#stream_object_mode) + +All streams created by Node.js APIs operate exclusively on strings and `Buffer` +(or `Uint8Array`) objects. It is possible, however, for stream implementations +to work with other types of JavaScript values (with the exception of `null`, +which serves a special purpose within streams). Such streams are considered to +operate in "object mode". + +Stream instances are switched into object mode using the `objectMode` option +when the stream is created. Attempting to switch an existing stream into +object mode is not safe. + +### Buffering[#](#stream_buffering) + +Both [Writable](#stream_class_stream_writable) and [Readable](#stream_class_stream_readable) streams will store data in an internal +buffer that can be retrieved using `writable._writableState.getBuffer()` or +`readable._readableState.buffer`, respectively. + +The amount of data potentially buffered depends on the `highWaterMark` option +passed into the streams constructor. For normal streams, the `highWaterMark` +option specifies a [total number of bytes](#stream_highwatermark_discrepancy_after_calling_readable_setencoding). For streams operating +in object mode, the `highWaterMark` specifies a total number of objects. + +Data is buffered in Readable streams when the implementation calls +[`stream.push(chunk)`](#stream_readable_push_chunk_encoding). If the consumer of the Stream does not +call [`stream.read()`](#stream_readable_read_size), the data will sit in the internal +queue until it is consumed. + +Once the total size of the internal read buffer reaches the threshold specified +by `highWaterMark`, the stream will temporarily stop reading data from the +underlying resource until the data currently buffered can be consumed (that is, +the stream will stop calling the internal `readable._read()` method that is +used to fill the read buffer). + +Data is buffered in Writable streams when the +[`writable.write(chunk)`](#stream_writable_write_chunk_encoding_callback) method is called repeatedly. While the +total size of the internal write buffer is below the threshold set by +`highWaterMark`, calls to `writable.write()` will return `true`. Once +the size of the internal buffer reaches or exceeds the `highWaterMark`, `false` +will be returned. + +A key goal of the `stream` API, particularly the [`stream.pipe()`](#stream_readable_pipe_destination_options) method, +is to limit the buffering of data to acceptable levels such that sources and +destinations of differing speeds will not overwhelm the available memory. + +Because [Duplex](#stream_class_stream_duplex) and [Transform](#stream_class_stream_transform) streams are both Readable and Writable, +each maintain *two* separate internal buffers used for reading and writing, +allowing each side to operate independently of the other while maintaining an +appropriate and efficient flow of data. For example, [`net.Socket`](net.html#net_class_net_socket) instances +are [Duplex](#stream_class_stream_duplex) streams whose Readable side allows consumption of data received +*from* the socket and whose Writable side allows writing data *to* the socket. +Because data may be written to the socket at a faster or slower rate than data +is received, it is important for each side to operate (and buffer) independently +of the other. + +## API for Stream Consumers[#](#stream_api_for_stream_consumers) + +Almost all Node.js applications, no matter how simple, use streams in some +manner. The following is an example of using streams in a Node.js application +that implements an HTTP server: + +```None +const http = require('http'); + +const server = http.createServer((req, res) => { + // req is an http.IncomingMessage, which is a Readable Stream + // res is an http.ServerResponse, which is a Writable Stream + + let body = ''; + // Get the data as utf8 strings. + // If an encoding is not set, Buffer objects will be received. + req.setEncoding('utf8'); + + // Readable streams emit 'data' events once a listener is added + req.on('data', (chunk) => { + body += chunk; + }); + + // the end event indicates that the entire body has been received + req.on('end', () => { + try { + const data = JSON.parse(body); + // write back something interesting to the user: + res.write(typeof data); + res.end(); + } catch (er) { + // uh oh! bad json! + res.statusCode = 400; + return res.end(`error: ${er.message}`); + } + }); +}); + +server.listen(1337); + +// $ curl localhost:1337 -d "{}" +// object +// $ curl localhost:1337 -d "\"foo\"" +// string +// $ curl localhost:1337 -d "not json" +// error: Unexpected token o in JSON at position 1 +``` + +[Writable](#stream_class_stream_writable) streams (such as `res` in the example) expose methods such as +`write()` and `end()` that are used to write data onto the stream. + +[Readable](#stream_class_stream_readable) streams use the [`EventEmitter`](events.html#events_class_eventemitter) API for notifying application +code when data is available to be read off the stream. That available data can +be read from the stream in multiple ways. + +Both [Writable](#stream_class_stream_writable) and [Readable](#stream_class_stream_readable) streams use the [`EventEmitter`](events.html#events_class_eventemitter) API in +various ways to communicate the current state of the stream. + +[Duplex](#stream_class_stream_duplex) and [Transform](#stream_class_stream_transform) streams are both [Writable](#stream_class_stream_writable) and [Readable](#stream_class_stream_readable). + +Applications that are either writing data to or consuming data from a stream +are not required to implement the stream interfaces directly and will generally +have no reason to call `require('stream')`. + +Developers wishing to implement new types of streams should refer to the +section [API for Stream Implementers](#stream_api_for_stream_implementers). + +### Writable Streams[#](#stream_writable_streams) + +Writable streams are an abstraction for a *destination* to which data is +written. + +Examples of [Writable](#stream_class_stream_writable) streams include: + +* [HTTP requests, on the client](http.html#http_class_http_clientrequest) +* [HTTP responses, on the server](http.html#http_class_http_serverresponse) +* [fs write streams](fs.html#fs_class_fs_writestream) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) +* [TCP sockets](net.html#net_class_net_socket) +* [child process stdin](child_process.html#child_process_subprocess_stdin) +* [`process.stdout`](process.html#process_process_stdout), [`process.stderr`](process.html#process_process_stderr) + +*Note*: Some of these examples are actually [Duplex](#stream_class_stream_duplex) streams that implement +the [Writable](#stream_class_stream_writable) interface. + +All [Writable](#stream_class_stream_writable) streams implement the interface defined by the +`stream.Writable` class. + +While specific instances of [Writable](#stream_class_stream_writable) streams may differ in various ways, +all Writable streams follow the same fundamental usage pattern as illustrated +in the example below: + +```None +const myStream = getWritableStreamSomehow(); +myStream.write('some data'); +myStream.write('some more data'); +myStream.end('done writing data'); +``` + +#### Class: stream.Writable[#](#stream_class_stream_writable) + +Added in: v0.9.4 + +##### Event: 'close'[#](#stream_event_close) + +Added in: v0.9.4 + +The `'close'` event is emitted when the stream and any of its underlying +resources (a file descriptor, for example) have been closed. The event indicates +that no more events will be emitted, and no further computation will occur. + +Not all Writable streams will emit the `'close'` event. + +##### Event: 'drain'[#](#stream_event_drain) + +Added in: v0.9.4 + +If a call to [`stream.write(chunk)`](#stream_writable_write_chunk_encoding_callback) returns `false`, the +`'drain'` event will be emitted when it is appropriate to resume writing data +to the stream. + +```None +// Write the data to the supplied writable stream one million times. +// Be attentive to back-pressure. +function writeOneMillionTimes(writer, data, encoding, callback) { + let i = 1000000; + write(); + function write() { + let ok = true; + do { + i--; + if (i === 0) { + // last time! + writer.write(data, encoding, callback); + } else { + // see if we should continue, or wait + // don't pass the callback, because we're not done yet. + ok = writer.write(data, encoding); + } + } while (i > 0 && ok); + if (i > 0) { + // had to stop early! + // write some more once it drains + writer.once('drain', write); + } + } +} +``` + +##### Event: 'error'[#](#stream_event_error) + +Added in: v0.9.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + +The `'error'` event is emitted if an error occurred while writing or piping +data. The listener callback is passed a single `Error` argument when called. + +*Note*: The stream is not closed when the `'error'` event is emitted. + +##### Event: 'finish'[#](#stream_event_finish) + +Added in: v0.9.4 + +The `'finish'` event is emitted after the [`stream.end()`](#stream_writable_end_chunk_encoding_callback) method +has been called, and all data has been flushed to the underlying system. + +```None +const writer = getWritableStreamSomehow(); +for (let i = 0; i < 100; i++) { + writer.write(`hello, #${i}!\n`); +} +writer.end('This is the end\n'); +writer.on('finish', () => { + console.error('All writes are now complete.'); +}); +``` + +##### Event: 'pipe'[#](#stream_event_pipe) + +Added in: v0.9.4 + +* `src` [](stream.html#stream_class_stream_readable) source stream that is piping to this writable + +The `'pipe'` event is emitted when the [`stream.pipe()`](#stream_readable_pipe_destination_options) method is called on +a readable stream, adding this writable to its set of destinations. + +```None +const writer = getWritableStreamSomehow(); +const reader = getReadableStreamSomehow(); +writer.on('pipe', (src) => { + console.error('something is piping into the writer'); + assert.equal(src, reader); +}); +reader.pipe(writer); +``` + +##### Event: 'unpipe'[#](#stream_event_unpipe) + +Added in: v0.9.4 + +* `src` [](stream.html#stream_class_stream_readable) The source stream that + [unpiped](#stream_readable_unpipe_destination) this writable + +The `'unpipe'` event is emitted when the [`stream.unpipe()`](#stream_readable_unpipe_destination) method is called +on a [Readable](#stream_class_stream_readable) stream, removing this [Writable](#stream_class_stream_writable) from its set of +destinations. + +This is also emitted in case this [Writable](#stream_class_stream_writable) stream emits an error when a +[Readable](#stream_class_stream_readable) stream pipes into it. + +```None +const writer = getWritableStreamSomehow(); +const reader = getReadableStreamSomehow(); +writer.on('unpipe', (src) => { + console.error('Something has stopped piping into the writer.'); + assert.equal(src, reader); +}); +reader.pipe(writer); +reader.unpipe(writer); +``` + +##### writable.cork()[#](#stream_writable_cork) + +Added in: v0.11.2 + +The `writable.cork()` method forces all written data to be buffered in memory. +The buffered data will be flushed when either the [`stream.uncork()`](#stream_writable_uncork) or +[`stream.end()`](#stream_writable_end_chunk_encoding_callback) methods are called. + +The primary intent of `writable.cork()` is to avoid a situation where writing +many small chunks of data to a stream do not cause a backup in the internal +buffer that would have an adverse impact on performance. In such situations, +implementations that implement the `writable._writev()` method can perform +buffered writes in a more optimized manner. + +See also: [`writable.uncork()`](#stream_writable_uncork). + +##### writable.end([chunk][, encoding][, callback])[#](#stream_writable_end_chunk_encoding_callback) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `chunk` argument can now be a `Uint8Array` instance. | +| v0.9.4 | Added in: v0.9.4 | + +* `chunk` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | Optional data to write. For streams + not operating in object mode, `chunk` must be a string, `Buffer` or + `Uint8Array`. For object mode streams, `chunk` may be any JavaScript value + other than `null`. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding, if `chunk` is a string +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Optional callback for when the stream is finished + +Calling the `writable.end()` method signals that no more data will be written +to the [Writable](#stream_class_stream_writable). The optional `chunk` and `encoding` arguments allow one +final additional chunk of data to be written immediately before closing the +stream. If provided, the optional `callback` function is attached as a listener +for the [`'finish'`](#stream_event_finish) event. + +Calling the [`stream.write()`](#stream_writable_write_chunk_encoding_callback) method after calling +[`stream.end()`](#stream_writable_end_chunk_encoding_callback) will raise an error. + +```None +// write 'hello, ' and then end with 'world!' +const file = fs.createWriteStream('example.txt'); +file.write('hello, '); +file.end('world!'); +// writing more now is not allowed! +``` + +##### writable.setDefaultEncoding(encoding)[#](#stream_writable_setdefaultencoding_encoding) + +History + +| Version | Changes | +| --- | --- | +| v6.1.0 | This method now returns a reference to `writable`. | +| v0.11.15 | Added in: v0.11.15 | + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The new default encoding +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `writable.setDefaultEncoding()` method sets the default `encoding` for a +[Writable](#stream_class_stream_writable) stream. + +##### writable.uncork()[#](#stream_writable_uncork) + +Added in: v0.11.2 + +The `writable.uncork()` method flushes all data buffered since +[`stream.cork()`](#stream_writable_cork) was called. + +When using [`writable.cork()`](#stream_writable_cork) and `writable.uncork()` to manage the buffering +of writes to a stream, it is recommended that calls to `writable.uncork()` be +deferred using `process.nextTick()`. Doing so allows batching of all +`writable.write()` calls that occur within a given Node.js event loop phase. + +```None +stream.cork(); +stream.write('some '); +stream.write('data '); +process.nextTick(() => stream.uncork()); +``` + +If the [`writable.cork()`](#stream_writable_cork) method is called multiple times on a stream, the same +number of calls to `writable.uncork()` must be called to flush the buffered +data. + +```None +stream.cork(); +stream.write('some '); +stream.cork(); +stream.write('data '); +process.nextTick(() => { + stream.uncork(); + // The data will not be flushed until uncork() is called a second time. + stream.uncork(); +}); +``` + +See also: [`writable.cork()`](#stream_writable_cork). + +##### writable.writableHighWaterMark[#](#stream_writable_writablehighwatermark) + +Added in: v8.10.0 + +Return the value of `highWaterMark` passed when constructing this +`Writable`. + +##### writable.write(chunk[, encoding][, callback])[#](#stream_writable_write_chunk_encoding_callback) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `chunk` argument can now be a `Uint8Array` instance. | +| v6.0.0 | Passing `null` as the `chunk` parameter will always be considered invalid now, even in object mode. | +| v0.9.4 | Added in: v0.9.4 | + +* `chunk` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | Optional data to write. For streams + not operating in object mode, `chunk` must be a string, `Buffer` or + `Uint8Array`. For object mode streams, `chunk` may be any JavaScript value + other than `null`. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding, if `chunk` is a string +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Callback for when this chunk of data is flushed +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `false` if the stream wishes for the calling code to + wait for the `'drain'` event to be emitted before continuing to write + additional data; otherwise `true`. + +The `writable.write()` method writes some data to the stream, and calls the +supplied `callback` once the data has been fully handled. If an error +occurs, the `callback` *may or may not* be called with the error as its +first argument. To reliably detect write errors, add a listener for the +`'error'` event. + +The return value is `true` if the internal buffer is less than the +`highWaterMark` configured when the stream was created after admitting `chunk`. +If `false` is returned, further attempts to write data to the stream should +stop until the [`'drain'`](#stream_event_drain) event is emitted. + +While a stream is not draining, calls to `write()` will buffer `chunk`, and +return false. Once all currently buffered chunks are drained (accepted for +delivery by the operating system), the `'drain'` event will be emitted. +It is recommended that once write() returns false, no more chunks be written +until the `'drain'` event is emitted. While calling `write()` on a stream that +is not draining is allowed, Node.js will buffer all written chunks until +maximum memory usage occurs, at which point it will abort unconditionally. +Even before it aborts, high memory usage will cause poor garbage collector +performance and high RSS (which is not typically released back to the system, +even after the memory is no longer required). Since TCP sockets may never +drain if the remote peer does not read the data, writing a socket that is +not draining may lead to a remotely exploitable vulnerability. + +Writing data while the stream is not draining is particularly +problematic for a [Transform](#stream_class_stream_transform), because the `Transform` streams are paused +by default until they are piped or an `'data'` or `'readable'` event handler +is added. + +If the data to be written can be generated or fetched on demand, it is +recommended to encapsulate the logic into a [Readable](#stream_class_stream_readable) and use +[`stream.pipe()`](#stream_readable_pipe_destination_options). However, if calling `write()` is preferred, it is +possible to respect backpressure and avoid memory issues using the +[`'drain'`](#stream_event_drain) event: + +```None +function write(data, cb) { + if (!stream.write(data)) { + stream.once('drain', cb); + } else { + process.nextTick(cb); + } +} + +// Wait for cb to be called before doing any other write. +write('hello', () => { + console.log('write completed, do more writes now'); +}); +``` + +A Writable stream in object mode will always ignore the `encoding` argument. + +##### writable.destroy([error])[#](#stream_writable_destroy_error) + +Added in: v8.0.0 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +Destroy the stream, and emit the passed error. After this call, the +writable stream has ended. Implementors should not override this method, +but instead implement [`writable._destroy`](#stream_writable_destroy_err_callback). + +### Readable Streams[#](#stream_readable_streams) + +Readable streams are an abstraction for a *source* from which data is +consumed. + +Examples of Readable streams include: + +* [HTTP responses, on the client](http.html#http_class_http_incomingmessage) +* [HTTP requests, on the server](http.html#http_class_http_incomingmessage) +* [fs read streams](fs.html#fs_class_fs_readstream) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) +* [TCP sockets](net.html#net_class_net_socket) +* [child process stdout and stderr](child_process.html#child_process_subprocess_stdout) +* [`process.stdin`](process.html#process_process_stdin) + +All [Readable](#stream_class_stream_readable) streams implement the interface defined by the +`stream.Readable` class. + +#### Two Modes[#](#stream_two_modes) + +Readable streams effectively operate in one of two modes: flowing and paused. + +When in flowing mode, data is read from the underlying system automatically +and provided to an application as quickly as possible using events via the +[`EventEmitter`](events.html#events_class_eventemitter) interface. + +In paused mode, the [`stream.read()`](#stream_readable_read_size) method must be called +explicitly to read chunks of data from the stream. + +All [Readable](#stream_class_stream_readable) streams begin in paused mode but can be switched to flowing +mode in one of the following ways: + +* Adding a [`'data'`](#stream_event_data) event handler. +* Calling the [`stream.resume()`](#stream_readable_resume) method. +* Calling the [`stream.pipe()`](#stream_readable_pipe_destination_options) method to send the data to a [Writable](#stream_class_stream_writable). + +The Readable can switch back to paused mode using one of the following: + +* If there are no pipe destinations, by calling the + [`stream.pause()`](#stream_readable_pause) method. +* If there are pipe destinations, by removing all pipe destinations. + Multiple pipe destinations may be removed by calling the + [`stream.unpipe()`](#stream_readable_unpipe_destination) method. + +The important concept to remember is that a Readable will not generate data +until a mechanism for either consuming or ignoring that data is provided. If +the consuming mechanism is disabled or taken away, the Readable will *attempt* +to stop generating the data. + +*Note*: For backwards compatibility reasons, removing [`'data'`](#stream_event_data) event +handlers will **not** automatically pause the stream. Also, if there are piped +destinations, then calling [`stream.pause()`](#stream_readable_pause) will not guarantee +that the stream will *remain* paused once those destinations drain and ask for +more data. + +*Note*: If a [Readable](#stream_class_stream_readable) is switched into flowing mode and there are no +consumers available to handle the data, that data will be lost. This can occur, +for instance, when the `readable.resume()` method is called without a listener +attached to the `'data'` event, or when a `'data'` event handler is removed +from the stream. + +#### Three States[#](#stream_three_states) + +The "two modes" of operation for a Readable stream are a simplified abstraction +for the more complicated internal state management that is happening within the +Readable stream implementation. + +Specifically, at any given point in time, every Readable is in one of three +possible states: + +* `readable._readableState.flowing = null` +* `readable._readableState.flowing = false` +* `readable._readableState.flowing = true` + +When `readable._readableState.flowing` is `null`, no mechanism for consuming the +streams data is provided so the stream will not generate its data. While in this +state, attaching a listener for the `'data'` event, calling the `readable.pipe()` +method, or calling the `readable.resume()` method will switch +`readable._readableState.flowing` to `true`, causing the Readable to begin +actively emitting events as data is generated. + +Calling `readable.pause()`, `readable.unpipe()`, or receiving "back pressure" +will cause the `readable._readableState.flowing` to be set as `false`, +temporarily halting the flowing of events but *not* halting the generation of +data. While in this state, attaching a listener for the `'data'` event +would not cause `readable._readableState.flowing` to switch to `true`. + +```None +const { PassThrough, Writable } = require('stream'); +const pass = new PassThrough(); +const writable = new Writable(); + +pass.pipe(writable); +pass.unpipe(writable); +// flowing is now false + +pass.on('data', (chunk) => { console.log(chunk.toString()); }); +pass.write('ok'); // will not emit 'data' +pass.resume(); // must be called to make 'data' being emitted +``` + +While `readable._readableState.flowing` is `false`, data may be accumulating +within the streams internal buffer. + +#### Choose One[#](#stream_choose_one) + +The Readable stream API evolved across multiple Node.js versions and provides +multiple methods of consuming stream data. In general, developers should choose +*one* of the methods of consuming data and *should never* use multiple methods +to consume data from a single stream. + +Use of the `readable.pipe()` method is recommended for most users as it has been +implemented to provide the easiest way of consuming stream data. Developers that +require more fine-grained control over the transfer and generation of data can +use the [`EventEmitter`](events.html#events_class_eventemitter) and `readable.pause()`/`readable.resume()` APIs. + +#### Class: stream.Readable[#](#stream_class_stream_readable) + +Added in: v0.9.4 + +##### Event: 'close'[#](#stream_event_close_1) + +Added in: v0.9.4 + +The `'close'` event is emitted when the stream and any of its underlying +resources (a file descriptor, for example) have been closed. The event indicates +that no more events will be emitted, and no further computation will occur. + +Not all [Readable](#stream_class_stream_readable) streams will emit the `'close'` event. + +##### Event: 'data'[#](#stream_event_data) + +Added in: v0.9.4 + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | The chunk of data. For streams that are not + operating in object mode, the chunk will be either a string or `Buffer`. + For streams that are in object mode, the chunk can be any JavaScript value + other than `null`. + +The `'data'` event is emitted whenever the stream is relinquishing ownership of +a chunk of data to a consumer. This may occur whenever the stream is switched +in flowing mode by calling `readable.pipe()`, `readable.resume()`, or by +attaching a listener callback to the `'data'` event. The `'data'` event will +also be emitted whenever the `readable.read()` method is called and a chunk of +data is available to be returned. + +Attaching a `'data'` event listener to a stream that has not been explicitly +paused will switch the stream into flowing mode. Data will then be passed as +soon as it is available. + +The listener callback will be passed the chunk of data as a string if a default +encoding has been specified for the stream using the +`readable.setEncoding()` method; otherwise the data will be passed as a +`Buffer`. + +```None +const readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log(`Received ${chunk.length} bytes of data.`); +}); +``` + +##### Event: 'end'[#](#stream_event_end) + +Added in: v0.9.4 + +The `'end'` event is emitted when there is no more data to be consumed from +the stream. + +*Note*: The `'end'` event **will not be emitted** unless the data is +completely consumed. This can be accomplished by switching the stream into +flowing mode, or by calling [`stream.read()`](#stream_readable_read_size) repeatedly until +all data has been consumed. + +```None +const readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log(`Received ${chunk.length} bytes of data.`); +}); +readable.on('end', () => { + console.log('There will be no more data.'); +}); +``` + +##### Event: 'error'[#](#stream_event_error_1) + +Added in: v0.9.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + +The `'error'` event may be emitted by a Readable implementation at any time. +Typically, this may occur if the underlying stream is unable to generate data +due to an underlying internal failure, or when a stream implementation attempts +to push an invalid chunk of data. + +The listener callback will be passed a single `Error` object. + +##### Event: 'readable'[#](#stream_event_readable) + +Added in: v0.9.4 + +The `'readable'` event is emitted when there is data available to be read from +the stream. In some cases, attaching a listener for the `'readable'` event will +cause some amount of data to be read into an internal buffer. + +```None +const readable = getReadableStreamSomehow(); +readable.on('readable', () => { + // there is some data to read now +}); +``` + +The `'readable'` event will also be emitted once the end of the stream data +has been reached but before the `'end'` event is emitted. + +Effectively, the `'readable'` event indicates that the stream has new +information: either new data is available or the end of the stream has been +reached. In the former case, [`stream.read()`](#stream_readable_read_size) will return the +available data. In the latter case, [`stream.read()`](#stream_readable_read_size) will return +`null`. For instance, in the following example, `foo.txt` is an empty file: + +```None +const fs = require('fs'); +const rr = fs.createReadStream('foo.txt'); +rr.on('readable', () => { + console.log(`readable: ${rr.read()}`); +}); +rr.on('end', () => { + console.log('end'); +}); +``` + +The output of running this script is: + +```None +$ node test.js +readable: null +end +``` + +*Note*: In general, the `readable.pipe()` and `'data'` event mechanisms are +easier to understand than the `'readable'` event. +However, handling `'readable'` might result in increased throughput. + +##### readable.isPaused()[#](#stream_readable_ispaused) + +Added in: v0.11.14 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +The `readable.isPaused()` method returns the current operating state of the +Readable. This is used primarily by the mechanism that underlies the +`readable.pipe()` method. In most typical cases, there will be no reason to +use this method directly. + +```None +const readable = new stream.Readable(); + +readable.isPaused(); // === false +readable.pause(); +readable.isPaused(); // === true +readable.resume(); +readable.isPaused(); // === false +``` + +##### readable.pause()[#](#stream_readable_pause) + +Added in: v0.9.4 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `readable.pause()` method will cause a stream in flowing mode to stop +emitting [`'data'`](#stream_event_data) events, switching out of flowing mode. Any data that +becomes available will remain in the internal buffer. + +```None +const readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log(`Received ${chunk.length} bytes of data.`); + readable.pause(); + console.log('There will be no additional data for 1 second.'); + setTimeout(() => { + console.log('Now data will start flowing again.'); + readable.resume(); + }, 1000); +}); +``` + +##### readable.pipe(destination[, options])[#](#stream_readable_pipe_destination_options) + +Added in: v0.9.4 + +* `destination` [](stream.html#stream_class_stream_writable) The destination for writing data +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Pipe options + + `end` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) End the writer when the reader ends. **Default:** `true`. + +The `readable.pipe()` method attaches a [Writable](#stream_class_stream_writable) stream to the `readable`, +causing it to switch automatically into flowing mode and push all of its data +to the attached [Writable](#stream_class_stream_writable). The flow of data will be automatically managed so +that the destination Writable stream is not overwhelmed by a faster Readable +stream. + +The following example pipes all of the data from the `readable` into a file +named `file.txt`: + +```None +const readable = getReadableStreamSomehow(); +const writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt' +readable.pipe(writable); +``` + +It is possible to attach multiple Writable streams to a single Readable stream. + +The `readable.pipe()` method returns a reference to the *destination* stream +making it possible to set up chains of piped streams: + +```None +const r = fs.createReadStream('file.txt'); +const z = zlib.createGzip(); +const w = fs.createWriteStream('file.txt.gz'); +r.pipe(z).pipe(w); +``` + +By default, [`stream.end()`](#stream_writable_end_chunk_encoding_callback) is called on the destination Writable +stream when the source Readable stream emits [`'end'`](#stream_event_end), so that the +destination is no longer writable. To disable this default behavior, the `end` +option can be passed as `false`, causing the destination stream to remain open, +as illustrated in the following example: + +```None +reader.pipe(writer, { end: false }); +reader.on('end', () => { + writer.end('Goodbye\n'); +}); +``` + +One important caveat is that if the Readable stream emits an error during +processing, the Writable destination *is not closed* automatically. If an +error occurs, it will be necessary to *manually* close each stream in order +to prevent memory leaks. + +*Note*: The [`process.stderr`](process.html#process_process_stderr) and [`process.stdout`](process.html#process_process_stdout) Writable streams are +never closed until the Node.js process exits, regardless of the specified +options. + +##### readable.readableHighWaterMark[#](#stream_readable_readablehighwatermark) + +Added in: v8.10.0 + +Return the value of `highWaterMark` passed when constructing this +`Readable`. + +##### readable.read([size])[#](#stream_readable_read_size) + +Added in: v0.9.4 + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Optional argument to specify how much data to read. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Null_type) + +The `readable.read()` method pulls some data out of the internal buffer and +returns it. If no data available to be read, `null` is returned. By default, +the data will be returned as a `Buffer` object unless an encoding has been +specified using the `readable.setEncoding()` method or the stream is operating +in object mode. + +The optional `size` argument specifies a specific number of bytes to read. If +`size` bytes are not available to be read, `null` will be returned *unless* +the stream has ended, in which case all of the data remaining in the internal +buffer will be returned. + +If the `size` argument is not specified, all of the data contained in the +internal buffer will be returned. + +The `readable.read()` method should only be called on Readable streams operating +in paused mode. In flowing mode, `readable.read()` is called automatically until +the internal buffer is fully drained. + +```None +const readable = getReadableStreamSomehow(); +readable.on('readable', () => { + let chunk; + while (null !== (chunk = readable.read())) { + console.log(`Received ${chunk.length} bytes of data.`); + } +}); +``` + +A Readable stream in object mode will always return a single item from +a call to [`readable.read(size)`](#stream_readable_read_size), regardless of the value of the +`size` argument. + +*Note*: If the `readable.read()` method returns a chunk of data, a `'data'` +event will also be emitted. + +*Note*: Calling [`stream.read([size])`](#stream_readable_read_size) after the [`'end'`](#stream_event_end) +event has been emitted will return `null`. No runtime error will be raised. + +##### readable.resume()[#](#stream_readable_resume) + +Added in: v0.9.4 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `readable.resume()` method causes an explicitly paused Readable stream to +resume emitting [`'data'`](#stream_event_data) events, switching the stream into flowing mode. + +The `readable.resume()` method can be used to fully consume the data from a +stream without actually processing any of that data as illustrated in the +following example: + +```None +getReadableStreamSomehow() + .resume() + .on('end', () => { + console.log('Reached the end, but did not read anything.'); + }); +``` + +##### readable.setEncoding(encoding)[#](#stream_readable_setencoding_encoding) + +Added in: v0.9.4 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding to use. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `readable.setEncoding()` method sets the character encoding for +data read from the Readable stream. + +By default, no encoding is assigned and stream data will be returned as +`Buffer` objects. Setting an encoding causes the stream data +to be returned as strings of the specified encoding rather than as `Buffer` +objects. For instance, calling `readable.setEncoding('utf8')` will cause the +output data to be interpreted as UTF-8 data, and passed as strings. Calling +`readable.setEncoding('hex')` will cause the data to be encoded in hexadecimal +string format. + +The Readable stream will properly handle multi-byte characters delivered through +the stream that would otherwise become improperly decoded if simply pulled from +the stream as `Buffer` objects. + +```None +const readable = getReadableStreamSomehow(); +readable.setEncoding('utf8'); +readable.on('data', (chunk) => { + assert.equal(typeof chunk, 'string'); + console.log('got %d characters of string data', chunk.length); +}); +``` + +##### readable.unpipe([destination])[#](#stream_readable_unpipe_destination) + +Added in: v0.9.4 + +* `destination` [](stream.html#stream_class_stream_writable) Optional specific stream to unpipe + +The `readable.unpipe()` method detaches a Writable stream previously attached +using the [`stream.pipe()`](#stream_readable_pipe_destination_options) method. + +If the `destination` is not specified, then *all* pipes are detached. + +If the `destination` is specified, but no pipe is set up for it, then +the method does nothing. + +```None +const readable = getReadableStreamSomehow(); +const writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt', +// but only for the first second +readable.pipe(writable); +setTimeout(() => { + console.log('Stop writing to file.txt'); + readable.unpipe(writable); + console.log('Manually close the file stream'); + writable.end(); +}, 1000); +``` + +##### readable.unshift(chunk)[#](#stream_readable_unshift_chunk) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `chunk` argument can now be a `Uint8Array` instance. | +| v0.9.11 | Added in: v0.9.11 | + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | Chunk of data to unshift onto the + read queue. For streams not operating in object mode, `chunk` must be a + string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be + any JavaScript value other than `null`. + +The `readable.unshift()` method pushes a chunk of data back into the internal +buffer. This is useful in certain situations where a stream is being consumed by +code that needs to "un-consume" some amount of data that it has optimistically +pulled out of the source, so that the data can be passed on to some other party. + +*Note*: The `stream.unshift(chunk)` method cannot be called after the +[`'end'`](#stream_event_end) event has been emitted or a runtime error will be thrown. + +Developers using `stream.unshift()` often should consider switching to +use of a [Transform](#stream_class_stream_transform) stream instead. See the [API for Stream Implementers](#stream_api_for_stream_implementers) +section for more information. + +```None +// Pull off a header delimited by \n\n +// use unshift() if we get too much +// Call the callback with (error, header, stream) +const { StringDecoder } = require('string_decoder'); +function parseHeader(stream, callback) { + stream.on('error', callback); + stream.on('readable', onReadable); + const decoder = new StringDecoder('utf8'); + let header = ''; + function onReadable() { + let chunk; + while (null !== (chunk = stream.read())) { + const str = decoder.write(chunk); + if (str.match(/\n\n/)) { + // found the header boundary + const split = str.split(/\n\n/); + header += split.shift(); + const remaining = split.join('\n\n'); + const buf = Buffer.from(remaining, 'utf8'); + stream.removeListener('error', callback); + // remove the readable listener before unshifting + stream.removeListener('readable', onReadable); + if (buf.length) + stream.unshift(buf); + // now the body of the message can be read from the stream. + callback(null, header, stream); + } else { + // still reading the header. + header += str; + } + } + } +} +``` + +*Note*: Unlike [`stream.push(chunk)`](#stream_readable_push_chunk_encoding), `stream.unshift(chunk)` +will not end the reading process by resetting the internal reading state of the +stream. This can cause unexpected results if `readable.unshift()` is called +during a read (i.e. from within a [`stream._read()`](#stream_readable_read_size_1) +implementation on a custom stream). Following the call to `readable.unshift()` +with an immediate [`stream.push('')`](#stream_readable_push_chunk_encoding) will reset the reading state +appropriately, however it is best to simply avoid calling `readable.unshift()` +while in the process of performing a read. + +##### readable.wrap(stream)[#](#stream_readable_wrap_stream) + +Added in: v0.9.4 + +* `stream` [](stream.html#stream_stream) An "old style" readable stream + +Versions of Node.js prior to v0.10 had streams that did not implement the +entire `stream` module API as it is currently defined. (See [Compatibility](#stream_compatibility_with_older_node_js_versions) +for more information.) + +When using an older Node.js library that emits [`'data'`](#stream_event_data) events and has a +[`stream.pause()`](#stream_readable_pause) method that is advisory only, the +`readable.wrap()` method can be used to create a [Readable](#stream_class_stream_readable) stream that uses +the old stream as its data source. + +It will rarely be necessary to use `readable.wrap()` but the method has been +provided as a convenience for interacting with older Node.js applications and +libraries. + +For example: + +```None +const { OldReader } = require('./old-api-module.js'); +const { Readable } = require('stream'); +const oreader = new OldReader(); +const myReader = new Readable().wrap(oreader); + +myReader.on('readable', () => { + myReader.read(); // etc. +}); +``` + +##### readable.destroy([error])[#](#stream_readable_destroy_error) + +Added in: v8.0.0 + +Destroy the stream, and emit `'error'`. After this call, the +readable stream will release any internal resources. +Implementors should not override this method, but instead implement +[`readable._destroy`](#stream_readable_destroy_err_callback). + +### Duplex and Transform Streams[#](#stream_duplex_and_transform_streams) + +#### Class: stream.Duplex[#](#stream_class_stream_duplex) + +History + +| Version | Changes | +| --- | --- | +| v6.8.0 | Instances of `Duplex` now return `true` when checking `instanceof stream.Writable`. | +| v0.9.4 | Added in: v0.9.4 | + +Duplex streams are streams that implement both the [Readable](#stream_class_stream_readable) and +[Writable](#stream_class_stream_writable) interfaces. + +Examples of Duplex streams include: + +* [TCP sockets](net.html#net_class_net_socket) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) + +#### Class: stream.Transform[#](#stream_class_stream_transform) + +Added in: v0.9.4 + +Transform streams are [Duplex](#stream_class_stream_duplex) streams where the output is in some way +related to the input. Like all [Duplex](#stream_class_stream_duplex) streams, Transform streams +implement both the [Readable](#stream_class_stream_readable) and [Writable](#stream_class_stream_writable) interfaces. + +Examples of Transform streams include: + +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) + +##### transform.destroy([error])[#](#stream_transform_destroy_error) + +Added in: v8.0.0 + +Destroy the stream, and emit `'error'`. After this call, the +transform stream would release any internal resources. +implementors should not override this method, but instead implement +[`readable._destroy`](#stream_readable_destroy_err_callback). +The default implementation of `_destroy` for `Transform` also emit `'close'`. + +## API for Stream Implementers[#](#stream_api_for_stream_implementers) + +The `stream` module API has been designed to make it possible to easily +implement streams using JavaScript's prototypal inheritance model. + +First, a stream developer would declare a new JavaScript class that extends one +of the four basic stream classes (`stream.Writable`, `stream.Readable`, +`stream.Duplex`, or `stream.Transform`), making sure they call the appropriate +parent class constructor: + +```None +const { Writable } = require('stream'); + +class MyWritable extends Writable { + constructor(options) { + super(options); + // ... + } +} +``` + +The new stream class must then implement one or more specific methods, depending +on the type of stream being created, as detailed in the chart below: + +| Use-case | Class | Method(s) to implement | +| --- | --- | --- | +| Reading only | [Readable](#stream_class_stream_readable) | `_read` | +| Writing only | [Writable](#stream_class_stream_writable) | `_write`, `_writev`, `_final` | +| Reading and writing | [Duplex](#stream_class_stream_duplex) | `_read`, `_write`, `_writev`, `_final` | +| Operate on written data, then read the result | [Transform](#stream_class_stream_transform) | `_transform`, `_flush`, `_final` | + +*Note*: The implementation code for a stream should *never* call the "public" +methods of a stream that are intended for use by consumers (as described in +the [API for Stream Consumers](#stream_api_for_stream_consumers) section). Doing so may lead to adverse +side effects in application code consuming the stream. + +### Simplified Construction[#](#stream_simplified_construction) + +Added in: v1.2.0 + +For many simple cases, it is possible to construct a stream without relying on +inheritance. This can be accomplished by directly creating instances of the +`stream.Writable`, `stream.Readable`, `stream.Duplex` or `stream.Transform` +objects and passing appropriate methods as constructor options. + +For example: + +```None +const { Writable } = require('stream'); + +const myWritable = new Writable({ + write(chunk, encoding, callback) { + // ... + } +}); +``` + +### Implementing a Writable Stream[#](#stream_implementing_a_writable_stream) + +The `stream.Writable` class is extended to implement a [Writable](#stream_class_stream_writable) stream. + +Custom Writable streams *must* call the `new stream.Writable([options])` +constructor and implement the `writable._write()` method. The +`writable._writev()` method *may* also be implemented. + +#### Constructor: new stream.Writable([options])[#](#stream_constructor_new_stream_writable_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `highWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Buffer level when + [`stream.write()`](#stream_writable_write_chunk_encoding_callback) starts returning `false`. **Default:** + `16384` (16kb), or `16` for `objectMode` streams. + + `decodeStrings` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether or not to decode strings into + Buffers before passing them to [`stream._write()`](#stream_writable_write_chunk_encoding_callback_1). + **Default:** `true`. + + `objectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether or not the + [`stream.write(anyObj)`](#stream_writable_write_chunk_encoding_callback) is a valid operation. When set, + it becomes possible to write JavaScript values other than string, + `Buffer` or `Uint8Array` if supported by the stream implementation. + **Default:** `false`. + + `write` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._write()`](#stream_writable_write_chunk_encoding_callback_1) method. + + `writev` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._writev()`](#stream_writable_writev_chunks_callback) method. + + `destroy` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._destroy()`](#stream_writable_destroy_err_callback) method. + + `final` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._final()`](#stream_writable_final_callback) method. + +For example: + +```None +const { Writable } = require('stream'); + +class MyWritable extends Writable { + constructor(options) { + // Calls the stream.Writable() constructor + super(options); + // ... + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const { Writable } = require('stream'); +const util = require('util'); + +function MyWritable(options) { + if (!(this instanceof MyWritable)) + return new MyWritable(options); + Writable.call(this, options); +} +util.inherits(MyWritable, Writable); +``` + +Or, using the Simplified Constructor approach: + +```None +const { Writable } = require('stream'); + +const myWritable = new Writable({ + write(chunk, encoding, callback) { + // ... + }, + writev(chunks, callback) { + // ... + } +}); +``` + +#### writable.\_write(chunk, encoding, callback)[#](#stream_writable_write_chunk_encoding_callback_1) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | The chunk to be written. Will **always** + be a buffer unless the `decodeStrings` option was set to `false` + or the stream is operating in object mode. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If the chunk is a string, then `encoding` is the + character encoding of that string. If chunk is a `Buffer`, or if the + stream is operating in object mode, `encoding` may be ignored. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Call this function (optionally with an error + argument) when processing is complete for the supplied chunk. + +All Writable stream implementations must provide a +[`writable._write()`](#stream_writable_write_chunk_encoding_callback_1) method to send data to the underlying +resource. + +*Note*: [Transform](#stream_class_stream_transform) streams provide their own implementation of the +[`writable._write()`](#stream_writable_write_chunk_encoding_callback_1). + +*Note*: This function MUST NOT be called by application code directly. It +should be implemented by child classes, and called by the internal Writable +class methods only. + +The `callback` method must be called to signal either that the write completed +successfully or failed with an error. The first argument passed to the +`callback` must be the `Error` object if the call failed or `null` if the +write succeeded. + +All calls to `writable.write()` that occur between the time `writable._write()` +is called and the `callback` is called will cause the written data to be +buffered. When the `callback` is invoked, the stream might emit a [`'drain'`](#stream_event_drain) +event. If a stream implementation is capable of processing multiple chunks of +data at once, the `writable._writev()` method should be implemented. + +If the `decodeStrings` property is set in the constructor options, then +`chunk` may be a string rather than a Buffer, and `encoding` will +indicate the character encoding of the string. This is to support +implementations that have an optimized handling for certain string +data encodings. If the `decodeStrings` property is explicitly set to `false`, +the `encoding` argument can be safely ignored, and `chunk` will remain the same +object that is passed to `.write()`. + +The `writable._write()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### writable.\_writev(chunks, callback)[#](#stream_writable_writev_chunks_callback) + +* `chunks` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) The chunks to be written. Each chunk has following + format: `{ chunk: ..., encoding: ... }`. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function (optionally with an error + argument) to be invoked when processing is complete for the supplied chunks. + +*Note*: This function MUST NOT be called by application code directly. It +should be implemented by child classes, and called by the internal Writable +class methods only. + +The `writable._writev()` method may be implemented in addition to +`writable._write()` in stream implementations that are capable of processing +multiple chunks of data at once. If implemented, the method will be called with +all chunks of data currently buffered in the write queue. + +The `writable._writev()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### writable.\_destroy(err, callback)[#](#stream_writable_destroy_err_callback) + +Added in: v8.0.0 + +* `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) A possible error. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function that takes an optional error + argument. + +The `_destroy()` method is called by [`writable.destroy()`](#stream_writable_destroy_error). +It can be overridden by child classes but it **must not** be called directly. + +#### writable.\_final(callback)[#](#stream_writable_final_callback) + +Added in: v8.0.0 + +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Call this function (optionally with an error + argument) when finished writing any remaining data. + +The `_final()` method **must not** be called directly. It may be implemented +by child classes, and if so, will be called by the internal Writable +class methods only. + +This optional function will be called before the stream closes, delaying the +`finish` event until `callback` is called. This is useful to close resources +or write buffered data before a stream ends. + +#### Errors While Writing[#](#stream_errors_while_writing) + +It is recommended that errors occurring during the processing of the +`writable._write()` and `writable._writev()` methods are reported by invoking +the callback and passing the error as the first argument. This will cause an +`'error'` event to be emitted by the Writable. Throwing an Error from within +`writable._write()` can result in unexpected and inconsistent behavior depending +on how the stream is being used. Using the callback ensures consistent and +predictable handling of errors. + +If a Readable stream pipes into a Writable stream when Writable emits an +error, the Readable stream will be unpiped. + +```None +const { Writable } = require('stream'); + +const myWritable = new Writable({ + write(chunk, encoding, callback) { + if (chunk.toString().indexOf('a') >= 0) { + callback(new Error('chunk is invalid')); + } else { + callback(); + } + } +}); +``` + +#### An Example Writable Stream[#](#stream_an_example_writable_stream) + +The following illustrates a rather simplistic (and somewhat pointless) custom +Writable stream implementation. While this specific Writable stream instance +is not of any real particular usefulness, the example illustrates each of the +required elements of a custom [Writable](#stream_class_stream_writable) stream instance: + +```None +const { Writable } = require('stream'); + +class MyWritable extends Writable { + constructor(options) { + super(options); + // ... + } + + _write(chunk, encoding, callback) { + if (chunk.toString().indexOf('a') >= 0) { + callback(new Error('chunk is invalid')); + } else { + callback(); + } + } +} +``` + +#### Decoding buffers in a Writable Stream[#](#stream_decoding_buffers_in_a_writable_stream) + +Decoding buffers is a common task, for instance, when using transformers whose +input is a string. This is not a trivial process when using multi-byte +characters encoding, such as UTF-8. The following example shows how to decode +multi-byte strings using `StringDecoder` and [Writable](#stream_class_stream_writable). + +```None +const { Writable } = require('stream'); +const { StringDecoder } = require('string_decoder'); + +class StringWritable extends Writable { + constructor(options) { + super(options); + const state = this._writableState; + this._decoder = new StringDecoder(state.defaultEncoding); + this.data = ''; + } + _write(chunk, encoding, callback) { + if (encoding === 'buffer') { + chunk = this._decoder.write(chunk); + } + this.data += chunk; + callback(); + } + _final(callback) { + this.data += this._decoder.end(); + callback(); + } +} + +const euro = [[0xE2, 0x82], [0xAC]].map(Buffer.from); +const w = new StringWritable(); + +w.write('currency: '); +w.write(euro[0]); +w.end(euro[1]); + +console.log(w.data); // currency: € +``` + +### Implementing a Readable Stream[#](#stream_implementing_a_readable_stream) + +The `stream.Readable` class is extended to implement a [Readable](#stream_class_stream_readable) stream. + +Custom Readable streams *must* call the `new stream.Readable([options])` +constructor and implement the `readable._read()` method. + +#### new stream.Readable([options])[#](#stream_new_stream_readable_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `highWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The maximum [number of bytes](#stream_highwatermark_discrepancy_after_calling_readable_setencoding) to store + in the internal buffer before ceasing to read from the underlying resource. + **Default:** `16384` (16kb), or `16` for `objectMode` streams. + + `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If specified, then buffers will be decoded to + strings using the specified encoding. **Default:** `null`. + + `objectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether this stream should behave + as a stream of objects. Meaning that [`stream.read(n)`](#stream_readable_read_size) returns + a single value instead of a Buffer of size n. **Default:** `false`. + + `read` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the [`stream._read()`](#stream_readable_read_size_1) + method. + + `destroy` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the [`stream._destroy()`](#stream_readable_destroy_err_callback) + method. + +For example: + +```None +const { Readable } = require('stream'); + +class MyReadable extends Readable { + constructor(options) { + // Calls the stream.Readable(options) constructor + super(options); + // ... + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const { Readable } = require('stream'); +const util = require('util'); + +function MyReadable(options) { + if (!(this instanceof MyReadable)) + return new MyReadable(options); + Readable.call(this, options); +} +util.inherits(MyReadable, Readable); +``` + +Or, using the Simplified Constructor approach: + +```None +const { Readable } = require('stream'); + +const myReadable = new Readable({ + read(size) { + // ... + } +}); +``` + +#### readable.\_read(size)[#](#stream_readable_read_size_1) + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Number of bytes to read asynchronously + +*Note*: This function MUST NOT be called by application code directly. It +should be implemented by child classes, and called by the internal Readable +class methods only. + +All Readable stream implementations must provide an implementation of the +`readable._read()` method to fetch data from the underlying resource. + +When `readable._read()` is called, if data is available from the resource, the +implementation should begin pushing that data into the read queue using the +[`this.push(dataChunk)`](#stream_readable_push_chunk_encoding) method. `_read()` should continue reading +from the resource and pushing data until `readable.push()` returns `false`. Only +when `_read()` is called again after it has stopped should it resume pushing +additional data onto the queue. + +*Note*: Once the `readable._read()` method has been called, it will not be +called again until the [`readable.push()`](#stream_readable_push_chunk_encoding) method is called. + +The `size` argument is advisory. For implementations where a "read" is a +single operation that returns data can use the `size` argument to determine how +much data to fetch. Other implementations may ignore this argument and simply +provide data whenever it becomes available. There is no need to "wait" until +`size` bytes are available before calling [`stream.push(chunk)`](#stream_readable_push_chunk_encoding). + +The `readable._read()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### readable.\_destroy(err, callback)[#](#stream_readable_destroy_err_callback) + +Added in: v8.0.0 + +* `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) A possible error. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function that takes an optional error + argument. + +The `_destroy()` method is called by [`readable.destroy()`](#stream_readable_destroy_error). +It can be overridden by child classes but it **must not** be called directly. + +#### readable.push(chunk[, encoding])[#](#stream_readable_push_chunk_encoding) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `chunk` argument can now be a `Uint8Array` instance. | + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Null_type) | Chunk of data to push into the + read queue. For streams not operating in object mode, `chunk` must be a + string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be + any JavaScript value. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Encoding of string chunks. Must be a valid + Buffer encoding, such as `'utf8'` or `'ascii'` +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` if additional chunks of data may continued to be + pushed; `false` otherwise. + +When `chunk` is a `Buffer`, `Uint8Array` or `string`, the `chunk` of data will +be added to the internal queue for users of the stream to consume. +Passing `chunk` as `null` signals the end of the stream (EOF), after which no +more data can be written. + +When the Readable is operating in paused mode, the data added with +`readable.push()` can be read out by calling the +[`readable.read()`](#stream_readable_read_size) method when the [`'readable'`](#stream_event_readable) event is +emitted. + +When the Readable is operating in flowing mode, the data added with +`readable.push()` will be delivered by emitting a `'data'` event. + +The `readable.push()` method is designed to be as flexible as possible. For +example, when wrapping a lower-level source that provides some form of +pause/resume mechanism, and a data callback, the low-level source can be wrapped +by the custom Readable instance as illustrated in the following example: + +```None +// source is an object with readStop() and readStart() methods, +// and an `ondata` member that gets called when it has data, and +// an `onend` member that gets called when the data is over. + +class SourceWrapper extends Readable { + constructor(options) { + super(options); + + this._source = getLowlevelSourceObject(); + + // Every time there's data, push it into the internal buffer. + this._source.ondata = (chunk) => { + // if push() returns false, then stop reading from source + if (!this.push(chunk)) + this._source.readStop(); + }; + + // When the source ends, push the EOF-signaling `null` chunk + this._source.onend = () => { + this.push(null); + }; + } + // _read will be called when the stream wants to pull more data in + // the advisory size argument is ignored in this case. + _read(size) { + this._source.readStart(); + } +} +``` + +*Note*: The `readable.push()` method is intended be called only by Readable +Implementers, and only from within the `readable._read()` method. + +For streams not operating in object mode, if the `chunk` parameter of +`readable.push()` is `undefined`, it will be treated as empty string or +buffer. See [`readable.push('')`](#stream_readable_push) for more information. + +#### Errors While Reading[#](#stream_errors_while_reading) + +It is recommended that errors occurring during the processing of the +`readable._read()` method are emitted using the `'error'` event rather than +being thrown. Throwing an Error from within `readable._read()` can result in +unexpected and inconsistent behavior depending on whether the stream is +operating in flowing or paused mode. Using the `'error'` event ensures +consistent and predictable handling of errors. + +```None +const { Readable } = require('stream'); + +const myReadable = new Readable({ + read(size) { + if (checkSomeErrorCondition()) { + process.nextTick(() => this.emit('error', err)); + return; + } + // do some work + } +}); +``` + +#### An Example Counting Stream[#](#stream_an_example_counting_stream) + +The following is a basic example of a Readable stream that emits the numerals +from 1 to 1,000,000 in ascending order, and then ends. + +```None +const { Readable } = require('stream'); + +class Counter extends Readable { + constructor(opt) { + super(opt); + this._max = 1000000; + this._index = 1; + } + + _read() { + const i = this._index++; + if (i > this._max) + this.push(null); + else { + const str = '' + i; + const buf = Buffer.from(str, 'ascii'); + this.push(buf); + } + } +} +``` + +### Implementing a Duplex Stream[#](#stream_implementing_a_duplex_stream) + +A [Duplex](#stream_class_stream_duplex) stream is one that implements both [Readable](#stream_class_stream_readable) and [Writable](#stream_class_stream_writable), +such as a TCP socket connection. + +Because JavaScript does not have support for multiple inheritance, the +`stream.Duplex` class is extended to implement a [Duplex](#stream_class_stream_duplex) stream (as opposed +to extending the `stream.Readable` *and* `stream.Writable` classes). + +*Note*: The `stream.Duplex` class prototypically inherits from +`stream.Readable` and parasitically from `stream.Writable`, but `instanceof` +will work properly for both base classes due to overriding +[`Symbol.hasInstance`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/hasInstance) on `stream.Writable`. + +Custom Duplex streams *must* call the `new stream.Duplex([options])` +constructor and implement *both* the `readable._read()` and +`writable._write()` methods. + +#### new stream.Duplex(options)[#](#stream_new_stream_duplex_options) + +History + +| Version | Changes | +| --- | --- | +| v8.4.0 | The `readableHighWaterMark` and `writableHighWaterMark` options are supported now. | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Passed to both Writable and Readable + constructors. Also has the following fields: + + `allowHalfOpen` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If set to `false`, then the stream will + automatically end the writable side when the readable side ends. + **Default:** `true`. + + `readableObjectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Sets `objectMode` for readable side of the + stream. Has no effect if `objectMode` is `true`. **Default:** `false`. + + `writableObjectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Sets `objectMode` for writable side of the + stream. Has no effect if `objectMode` is `true`. **Default:** `false`. + + `readableHighWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Sets `highWaterMark` for the readable side + of the stream. Has no effect if `highWaterMark` is provided. + + `writableHighWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Sets `highWaterMark` for the writable side + of the stream. Has no effect if `highWaterMark` is provided. + +For example: + +```None +const { Duplex } = require('stream'); + +class MyDuplex extends Duplex { + constructor(options) { + super(options); + // ... + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const { Duplex } = require('stream'); +const util = require('util'); + +function MyDuplex(options) { + if (!(this instanceof MyDuplex)) + return new MyDuplex(options); + Duplex.call(this, options); +} +util.inherits(MyDuplex, Duplex); +``` + +Or, using the Simplified Constructor approach: + +```None +const { Duplex } = require('stream'); + +const myDuplex = new Duplex({ + read(size) { + // ... + }, + write(chunk, encoding, callback) { + // ... + } +}); +``` + +#### An Example Duplex Stream[#](#stream_an_example_duplex_stream) + +The following illustrates a simple example of a Duplex stream that wraps a +hypothetical lower-level source object to which data can be written, and +from which data can be read, albeit using an API that is not compatible with +Node.js streams. +The following illustrates a simple example of a Duplex stream that buffers +incoming written data via the [Writable](#stream_class_stream_writable) interface that is read back out +via the [Readable](#stream_class_stream_readable) interface. + +```None +const { Duplex } = require('stream'); +const kSource = Symbol('source'); + +class MyDuplex extends Duplex { + constructor(source, options) { + super(options); + this[kSource] = source; + } + + _write(chunk, encoding, callback) { + // The underlying source only deals with strings + if (Buffer.isBuffer(chunk)) + chunk = chunk.toString(); + this[kSource].writeSomeData(chunk); + callback(); + } + + _read(size) { + this[kSource].fetchSomeData(size, (data, encoding) => { + this.push(Buffer.from(data, encoding)); + }); + } +} +``` + +The most important aspect of a Duplex stream is that the Readable and Writable +sides operate independently of one another despite co-existing within a single +object instance. + +#### Object Mode Duplex Streams[#](#stream_object_mode_duplex_streams) + +For Duplex streams, `objectMode` can be set exclusively for either the Readable +or Writable side using the `readableObjectMode` and `writableObjectMode` options +respectively. + +In the following example, for instance, a new Transform stream (which is a +type of [Duplex](#stream_class_stream_duplex) stream) is created that has an object mode Writable side +that accepts JavaScript numbers that are converted to hexadecimal strings on +the Readable side. + +```None +const { Transform } = require('stream'); + +// All Transform streams are also Duplex Streams +const myTransform = new Transform({ + writableObjectMode: true, + + transform(chunk, encoding, callback) { + // Coerce the chunk to a number if necessary + chunk |= 0; + + // Transform the chunk into something else. + const data = chunk.toString(16); + + // Push the data onto the readable queue. + callback(null, '0'.repeat(data.length % 2) + data); + } +}); + +myTransform.setEncoding('ascii'); +myTransform.on('data', (chunk) => console.log(chunk)); + +myTransform.write(1); +// Prints: 01 +myTransform.write(10); +// Prints: 0a +myTransform.write(100); +// Prints: 64 +``` + +### Implementing a Transform Stream[#](#stream_implementing_a_transform_stream) + +A [Transform](#stream_class_stream_transform) stream is a [Duplex](#stream_class_stream_duplex) stream where the output is computed +in some way from the input. Examples include [zlib](zlib.html) streams or [crypto](crypto.html) +streams that compress, encrypt, or decrypt data. + +*Note*: There is no requirement that the output be the same size as the input, +the same number of chunks, or arrive at the same time. For example, a +Hash stream will only ever have a single chunk of output which is +provided when the input is ended. A `zlib` stream will produce output +that is either much smaller or much larger than its input. + +The `stream.Transform` class is extended to implement a [Transform](#stream_class_stream_transform) stream. + +The `stream.Transform` class prototypically inherits from `stream.Duplex` and +implements its own versions of the `writable._write()` and `readable._read()` +methods. Custom Transform implementations *must* implement the +[`transform._transform()`](#stream_transform_transform_chunk_encoding_callback) method and *may* also implement +the [`transform._flush()`](#stream_transform_flush_callback) method. + +*Note*: Care must be taken when using Transform streams in that data written +to the stream can cause the Writable side of the stream to become paused if +the output on the Readable side is not consumed. + +#### new stream.Transform([options])[#](#stream_new_stream_transform_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Passed to both Writable and Readable + constructors. Also has the following fields: + + `transform` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._transform()`](#stream_transform_transform_chunk_encoding_callback) method. + + `flush` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the [`stream._flush()`](#stream_transform_flush_callback) + method. + +For example: + +```None +const { Transform } = require('stream'); + +class MyTransform extends Transform { + constructor(options) { + super(options); + // ... + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const { Transform } = require('stream'); +const util = require('util'); + +function MyTransform(options) { + if (!(this instanceof MyTransform)) + return new MyTransform(options); + Transform.call(this, options); +} +util.inherits(MyTransform, Transform); +``` + +Or, using the Simplified Constructor approach: + +```None +const { Transform } = require('stream'); + +const myTransform = new Transform({ + transform(chunk, encoding, callback) { + // ... + } +}); +``` + +#### Events: 'finish' and 'end'[#](#stream_events_finish_and_end) + +The [`'finish'`](#stream_event_finish) and [`'end'`](#stream_event_end) events are from the `stream.Writable` +and `stream.Readable` classes, respectively. The `'finish'` event is emitted +after [`stream.end()`](#stream_writable_end_chunk_encoding_callback) is called and all chunks have been processed +by [`stream._transform()`](#stream_transform_transform_chunk_encoding_callback). The `'end'` event is emitted +after all data has been output, which occurs after the callback in +[`transform._flush()`](#stream_transform_flush_callback) has been called. + +#### transform.\_flush(callback)[#](#stream_transform_flush_callback) + +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function (optionally with an error + argument and data) to be called when remaining data has been flushed. + +*Note*: This function MUST NOT be called by application code directly. It +should be implemented by child classes, and called by the internal Readable +class methods only. + +In some cases, a transform operation may need to emit an additional bit of +data at the end of the stream. For example, a `zlib` compression stream will +store an amount of internal state used to optimally compress the output. When +the stream ends, however, that additional data needs to be flushed so that the +compressed data will be complete. + +Custom [Transform](#stream_class_stream_transform) implementations *may* implement the `transform._flush()` +method. This will be called when there is no more written data to be consumed, +but before the [`'end'`](#stream_event_end) event is emitted signaling the end of the +[Readable](#stream_class_stream_readable) stream. + +Within the `transform._flush()` implementation, the `readable.push()` method +may be called zero or more times, as appropriate. The `callback` function must +be called when the flush operation is complete. + +The `transform._flush()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### transform.\_transform(chunk, encoding, callback)[#](#stream_transform_transform_chunk_encoding_callback) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | The chunk to be transformed. Will **always** + be a buffer unless the `decodeStrings` option was set to `false` + or the stream is operating in object mode. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If the chunk is a string, then this is the + encoding type. If chunk is a buffer, then this is the special + value - 'buffer', ignore it in this case. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function (optionally with an error + argument and data) to be called after the supplied `chunk` has been + processed. + +*Note*: This function MUST NOT be called by application code directly. It +should be implemented by child classes, and called by the internal Readable +class methods only. + +All Transform stream implementations must provide a `_transform()` +method to accept input and produce output. The `transform._transform()` +implementation handles the bytes being written, computes an output, then passes +that output off to the readable portion using the `readable.push()` method. + +The `transform.push()` method may be called zero or more times to generate +output from a single input chunk, depending on how much is to be output +as a result of the chunk. + +It is possible that no output is generated from any given chunk of input data. + +The `callback` function must be called only when the current chunk is completely +consumed. The first argument passed to the `callback` must be an `Error` object +if an error occurred while processing the input or `null` otherwise. If a second +argument is passed to the `callback`, it will be forwarded on to the +`readable.push()` method. In other words the following are equivalent: + +```None +transform.prototype._transform = function(data, encoding, callback) { + this.push(data); + callback(); +}; + +transform.prototype._transform = function(data, encoding, callback) { + callback(null, data); +}; +``` + +The `transform._transform()` method is prefixed with an underscore because it +is internal to the class that defines it, and should never be called directly by +user programs. + +`transform._transform()` is never called in parallel; streams implement a +queue mechanism, and to receive the next chunk, `callback` must be +called, either synchronously or asynchronously. + +#### Class: stream.PassThrough[#](#stream_class_stream_passthrough) + +The `stream.PassThrough` class is a trivial implementation of a [Transform](#stream_class_stream_transform) +stream that simply passes the input bytes across to the output. Its purpose is +primarily for examples and testing, but there are some use cases where +`stream.PassThrough` is useful as a building block for novel sorts of streams. + +## Additional Notes[#](#stream_additional_notes) + +### Compatibility with Older Node.js Versions[#](#stream_compatibility_with_older_node_js_versions) + +In versions of Node.js prior to v0.10, the Readable stream interface was +simpler, but also less powerful and less useful. + +* Rather than waiting for calls the [`stream.read()`](#stream_readable_read_size) method, + [`'data'`](#stream_event_data) events would begin emitting immediately. Applications that + would need to perform some amount of work to decide how to handle data + were required to store read data into buffers so the data would not be lost. +* The [`stream.pause()`](#stream_readable_pause) method was advisory, rather than + guaranteed. This meant that it was still necessary to be prepared to receive + [`'data'`](#stream_event_data) events *even when the stream was in a paused state*. + +In Node.js v0.10, the [Readable](#stream_class_stream_readable) class was added. For backwards compatibility +with older Node.js programs, Readable streams switch into "flowing mode" when a +[`'data'`](#stream_event_data) event handler is added, or when the +[`stream.resume()`](#stream_readable_resume) method is called. The effect is that, even +when not using the new [`stream.read()`](#stream_readable_read_size) method and +[`'readable'`](#stream_event_readable) event, it is no longer necessary to worry about losing +[`'data'`](#stream_event_data) chunks. + +While most applications will continue to function normally, this introduces an +edge case in the following conditions: + +* No [`'data'`](#stream_event_data) event listener is added. +* The [`stream.resume()`](#stream_readable_resume) method is never called. +* The stream is not piped to any writable destination. + +For example, consider the following code: + +```None +// WARNING! BROKEN! +net.createServer((socket) => { + + // we add an 'end' method, but never consume the data + socket.on('end', () => { + // It will never get here. + socket.end('The message was received but was not processed.\n'); + }); + +}).listen(1337); +``` + +In versions of Node.js prior to v0.10, the incoming message data would be +simply discarded. However, in Node.js v0.10 and beyond, the socket remains +paused forever. + +The workaround in this situation is to call the +[`stream.resume()`](#stream_readable_resume) method to begin the flow of data: + +```None +// Workaround +net.createServer((socket) => { + + socket.on('end', () => { + socket.end('The message was received but was not processed.\n'); + }); + + // start the flow of data, discarding it. + socket.resume(); + +}).listen(1337); +``` + +In addition to new Readable streams switching into flowing mode, +pre-v0.10 style streams can be wrapped in a Readable class using the +[`readable.wrap()`](#stream_readable_wrap_stream) method. + +### `readable.read(0)`[#](#stream_readable_read_0) + +There are some cases where it is necessary to trigger a refresh of the +underlying readable stream mechanisms, without actually consuming any +data. In such cases, it is possible to call `readable.read(0)`, which will +always return `null`. + +If the internal read buffer is below the `highWaterMark`, and the +stream is not currently reading, then calling `stream.read(0)` will trigger +a low-level [`stream._read()`](#stream_readable_read_size_1) call. + +While most applications will almost never need to do this, there are +situations within Node.js where this is done, particularly in the +Readable stream class internals. + +### `readable.push('')`[#](#stream_readable_push) + +Use of `readable.push('')` is not recommended. + +Pushing a zero-byte string, `Buffer` or `Uint8Array` to a stream that is not in +object mode has an interesting side effect. Because it *is* a call to +[`readable.push()`](#stream_readable_push_chunk_encoding), the call will end the reading process. +However, because the argument is an empty string, no data is added to the +readable buffer so there is nothing for a user to consume. + +### `highWaterMark` discrepancy after calling `readable.setEncoding()`[#](#stream_highwatermark_discrepancy_after_calling_readable_setencoding) + +The use of `readable.setEncoding()` will change the behavior of how the +`highWaterMark` operates in non-object mode. + +Typically, the size of the current buffer is measured against the +`highWaterMark` in *bytes*. However, after `setEncoding()` is called, the +comparison function will begin to measure the buffer's size in *characters*. + +This is not a problem in common cases with `latin1` or `ascii`. But it is +advised to be mindful about this behavior when working with strings that could +contain multi-byte characters. diff --git a/corpus/docs/nodejs/stream/stream_9x.md b/corpus/docs/nodejs/stream/stream_9x.md new file mode 100644 index 0000000000000000000000000000000000000000..7d43e68c75c740062d44b7a88cc059414e7f9761 --- /dev/null +++ b/corpus/docs/nodejs/stream/stream_9x.md @@ -0,0 +1,2142 @@ +# Stream# + +Source: https://nodejs.org/docs/latest-v9.x/api/stream.html +Version: 9.x + +[Stability: 2](documentation.html#documentation_stability_index) - Stable + +A stream is an abstract interface for working with streaming data in Node.js. +The `stream` module provides a base API that makes it easy to build objects +that implement the stream interface. + +There are many stream objects provided by Node.js. For instance, a +[request to an HTTP server](http.html#http_class_http_incomingmessage) and [`process.stdout`](process.html#process_process_stdout) +are both stream instances. + +Streams can be readable, writable, or both. All streams are instances of +[`EventEmitter`](events.html#events_class_eventemitter). + +The `stream` module can be accessed using: + +```None +const stream = require('stream'); +``` + +While it is important to understand how streams work, the `stream` module itself +is most useful for developers that are creating new types of stream instances. +Developers who are primarily *consuming* stream objects will rarely need to use +the `stream` module directly. + +## Organization of this Document[#](#stream_organization_of_this_document) + +This document is divided into two primary sections with a third section for +additional notes. The first section explains the elements of the stream API that +are required to *use* streams within an application. The second section explains +the elements of the API that are required to *implement* new types of streams. + +## Types of Streams[#](#stream_types_of_streams) + +There are four fundamental stream types within Node.js: + +* [Readable](#stream_class_stream_readable) - streams from which data can be read (for example + [`fs.createReadStream()`](fs.html#fs_fs_createreadstream_path_options)). +* [Writable](#stream_class_stream_writable) - streams to which data can be written (for example + [`fs.createWriteStream()`](fs.html#fs_fs_createwritestream_path_options)). +* [Duplex](#stream_class_stream_duplex) - streams that are both Readable and Writable (for example + [`net.Socket`](net.html#net_class_net_socket)). +* [Transform](#stream_class_stream_transform) - Duplex streams that can modify or transform the data as it + is written and read (for example [`zlib.createDeflate()`](zlib.html#zlib_zlib_createdeflate_options)). + +### Object Mode[#](#stream_object_mode) + +All streams created by Node.js APIs operate exclusively on strings and `Buffer` +(or `Uint8Array`) objects. It is possible, however, for stream implementations +to work with other types of JavaScript values (with the exception of `null`, +which serves a special purpose within streams). Such streams are considered to +operate in "object mode". + +Stream instances are switched into object mode using the `objectMode` option +when the stream is created. Attempting to switch an existing stream into +object mode is not safe. + +### Buffering[#](#stream_buffering) + +Both [Writable](#stream_class_stream_writable) and [Readable](#stream_class_stream_readable) streams will store data in an internal +buffer that can be retrieved using `writable.writableBuffer` or +`readable.readableBuffer`, respectively. + +The amount of data potentially buffered depends on the `highWaterMark` option +passed into the streams constructor. For normal streams, the `highWaterMark` +option specifies a [total number of bytes](#stream_highwatermark_discrepancy_after_calling_readable_setencoding). For streams operating +in object mode, the `highWaterMark` specifies a total number of objects. + +Data is buffered in Readable streams when the implementation calls +[`stream.push(chunk)`](#stream_readable_push_chunk_encoding). If the consumer of the Stream does not +call [`stream.read()`](#stream_readable_read_size), the data will sit in the internal +queue until it is consumed. + +Once the total size of the internal read buffer reaches the threshold specified +by `highWaterMark`, the stream will temporarily stop reading data from the +underlying resource until the data currently buffered can be consumed (that is, +the stream will stop calling the internal `readable._read()` method that is +used to fill the read buffer). + +Data is buffered in Writable streams when the +[`writable.write(chunk)`](#stream_writable_write_chunk_encoding_callback) method is called repeatedly. While the +total size of the internal write buffer is below the threshold set by +`highWaterMark`, calls to `writable.write()` will return `true`. Once +the size of the internal buffer reaches or exceeds the `highWaterMark`, `false` +will be returned. + +A key goal of the `stream` API, particularly the [`stream.pipe()`](#stream_readable_pipe_destination_options) method, +is to limit the buffering of data to acceptable levels such that sources and +destinations of differing speeds will not overwhelm the available memory. + +Because [Duplex](#stream_class_stream_duplex) and [Transform](#stream_class_stream_transform) streams are both Readable and Writable, +each maintain *two* separate internal buffers used for reading and writing, +allowing each side to operate independently of the other while maintaining an +appropriate and efficient flow of data. For example, [`net.Socket`](net.html#net_class_net_socket) instances +are [Duplex](#stream_class_stream_duplex) streams whose Readable side allows consumption of data received +*from* the socket and whose Writable side allows writing data *to* the socket. +Because data may be written to the socket at a faster or slower rate than data +is received, it is important for each side to operate (and buffer) independently +of the other. + +## API for Stream Consumers[#](#stream_api_for_stream_consumers) + +Almost all Node.js applications, no matter how simple, use streams in some +manner. The following is an example of using streams in a Node.js application +that implements an HTTP server: + +```None +const http = require('http'); + +const server = http.createServer((req, res) => { + // req is an http.IncomingMessage, which is a Readable Stream + // res is an http.ServerResponse, which is a Writable Stream + + let body = ''; + // Get the data as utf8 strings. + // If an encoding is not set, Buffer objects will be received. + req.setEncoding('utf8'); + + // Readable streams emit 'data' events once a listener is added + req.on('data', (chunk) => { + body += chunk; + }); + + // the end event indicates that the entire body has been received + req.on('end', () => { + try { + const data = JSON.parse(body); + // write back something interesting to the user: + res.write(typeof data); + res.end(); + } catch (er) { + // uh oh! bad json! + res.statusCode = 400; + return res.end(`error: ${er.message}`); + } + }); +}); + +server.listen(1337); + +// $ curl localhost:1337 -d "{}" +// object +// $ curl localhost:1337 -d "\"foo\"" +// string +// $ curl localhost:1337 -d "not json" +// error: Unexpected token o in JSON at position 1 +``` + +[Writable](#stream_class_stream_writable) streams (such as `res` in the example) expose methods such as +`write()` and `end()` that are used to write data onto the stream. + +[Readable](#stream_class_stream_readable) streams use the [`EventEmitter`](events.html#events_class_eventemitter) API for notifying application +code when data is available to be read off the stream. That available data can +be read from the stream in multiple ways. + +Both [Writable](#stream_class_stream_writable) and [Readable](#stream_class_stream_readable) streams use the [`EventEmitter`](events.html#events_class_eventemitter) API in +various ways to communicate the current state of the stream. + +[Duplex](#stream_class_stream_duplex) and [Transform](#stream_class_stream_transform) streams are both [Writable](#stream_class_stream_writable) and [Readable](#stream_class_stream_readable). + +Applications that are either writing data to or consuming data from a stream +are not required to implement the stream interfaces directly and will generally +have no reason to call `require('stream')`. + +Developers wishing to implement new types of streams should refer to the +section [API for Stream Implementers](#stream_api_for_stream_implementers). + +### Writable Streams[#](#stream_writable_streams) + +Writable streams are an abstraction for a *destination* to which data is +written. + +Examples of [Writable](#stream_class_stream_writable) streams include: + +* [HTTP requests, on the client](http.html#http_class_http_clientrequest) +* [HTTP responses, on the server](http.html#http_class_http_serverresponse) +* [fs write streams](fs.html#fs_class_fs_writestream) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) +* [TCP sockets](net.html#net_class_net_socket) +* [child process stdin](child_process.html#child_process_subprocess_stdin) +* [`process.stdout`](process.html#process_process_stdout), [`process.stderr`](process.html#process_process_stderr) + +Some of these examples are actually [Duplex](#stream_class_stream_duplex) streams that implement the +[Writable](#stream_class_stream_writable) interface. + +All [Writable](#stream_class_stream_writable) streams implement the interface defined by the +`stream.Writable` class. + +While specific instances of [Writable](#stream_class_stream_writable) streams may differ in various ways, +all Writable streams follow the same fundamental usage pattern as illustrated +in the example below: + +```None +const myStream = getWritableStreamSomehow(); +myStream.write('some data'); +myStream.write('some more data'); +myStream.end('done writing data'); +``` + +#### Class: stream.Writable[#](#stream_class_stream_writable) + +Added in: v0.9.4 + +##### Event: 'close'[#](#stream_event_close) + +Added in: v0.9.4 + +The `'close'` event is emitted when the stream and any of its underlying +resources (a file descriptor, for example) have been closed. The event indicates +that no more events will be emitted, and no further computation will occur. + +Not all Writable streams will emit the `'close'` event. + +##### Event: 'drain'[#](#stream_event_drain) + +Added in: v0.9.4 + +If a call to [`stream.write(chunk)`](#stream_writable_write_chunk_encoding_callback) returns `false`, the +`'drain'` event will be emitted when it is appropriate to resume writing data +to the stream. + +```None +// Write the data to the supplied writable stream one million times. +// Be attentive to back-pressure. +function writeOneMillionTimes(writer, data, encoding, callback) { + let i = 1000000; + write(); + function write() { + let ok = true; + do { + i--; + if (i === 0) { + // last time! + writer.write(data, encoding, callback); + } else { + // see if we should continue, or wait + // don't pass the callback, because we're not done yet. + ok = writer.write(data, encoding); + } + } while (i > 0 && ok); + if (i > 0) { + // had to stop early! + // write some more once it drains + writer.once('drain', write); + } + } +} +``` + +##### Event: 'error'[#](#stream_event_error) + +Added in: v0.9.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + +The `'error'` event is emitted if an error occurred while writing or piping +data. The listener callback is passed a single `Error` argument when called. + +The stream is not closed when the `'error'` event is emitted. + +##### Event: 'finish'[#](#stream_event_finish) + +Added in: v0.9.4 + +The `'finish'` event is emitted after the [`stream.end()`](#stream_writable_end_chunk_encoding_callback) method +has been called, and all data has been flushed to the underlying system. + +```None +const writer = getWritableStreamSomehow(); +for (let i = 0; i < 100; i++) { + writer.write(`hello, #${i}!\n`); +} +writer.end('This is the end\n'); +writer.on('finish', () => { + console.error('All writes are now complete.'); +}); +``` + +##### Event: 'pipe'[#](#stream_event_pipe) + +Added in: v0.9.4 + +* `src` [](stream.html#stream_class_stream_readable) source stream that is piping to this writable + +The `'pipe'` event is emitted when the [`stream.pipe()`](#stream_readable_pipe_destination_options) method is called on +a readable stream, adding this writable to its set of destinations. + +```None +const writer = getWritableStreamSomehow(); +const reader = getReadableStreamSomehow(); +writer.on('pipe', (src) => { + console.error('something is piping into the writer'); + assert.equal(src, reader); +}); +reader.pipe(writer); +``` + +##### Event: 'unpipe'[#](#stream_event_unpipe) + +Added in: v0.9.4 + +* `src` [](stream.html#stream_class_stream_readable) The source stream that + [unpiped](#stream_readable_unpipe_destination) this writable + +The `'unpipe'` event is emitted when the [`stream.unpipe()`](#stream_readable_unpipe_destination) method is called +on a [Readable](#stream_class_stream_readable) stream, removing this [Writable](#stream_class_stream_writable) from its set of +destinations. + +This is also emitted in case this [Writable](#stream_class_stream_writable) stream emits an error when a +[Readable](#stream_class_stream_readable) stream pipes into it. + +```None +const writer = getWritableStreamSomehow(); +const reader = getReadableStreamSomehow(); +writer.on('unpipe', (src) => { + console.error('Something has stopped piping into the writer.'); + assert.equal(src, reader); +}); +reader.pipe(writer); +reader.unpipe(writer); +``` + +##### writable.cork()[#](#stream_writable_cork) + +Added in: v0.11.2 + +The `writable.cork()` method forces all written data to be buffered in memory. +The buffered data will be flushed when either the [`stream.uncork()`](#stream_writable_uncork) or +[`stream.end()`](#stream_writable_end_chunk_encoding_callback) methods are called. + +The primary intent of `writable.cork()` is to avoid a situation where writing +many small chunks of data to a stream do not cause a backup in the internal +buffer that would have an adverse impact on performance. In such situations, +implementations that implement the `writable._writev()` method can perform +buffered writes in a more optimized manner. + +See also: [`writable.uncork()`](#stream_writable_uncork). + +##### writable.end([chunk][, encoding][, callback])[#](#stream_writable_end_chunk_encoding_callback) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `chunk` argument can now be a `Uint8Array` instance. | +| v0.9.4 | Added in: v0.9.4 | + +* `chunk` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | Optional data to write. For streams + not operating in object mode, `chunk` must be a string, `Buffer` or + `Uint8Array`. For object mode streams, `chunk` may be any JavaScript value + other than `null`. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding, if `chunk` is a string +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Optional callback for when the stream is finished + +Calling the `writable.end()` method signals that no more data will be written +to the [Writable](#stream_class_stream_writable). The optional `chunk` and `encoding` arguments allow one +final additional chunk of data to be written immediately before closing the +stream. If provided, the optional `callback` function is attached as a listener +for the [`'finish'`](#stream_event_finish) event. + +Calling the [`stream.write()`](#stream_writable_write_chunk_encoding_callback) method after calling +[`stream.end()`](#stream_writable_end_chunk_encoding_callback) will raise an error. + +```None +// write 'hello, ' and then end with 'world!' +const fs = require('fs'); +const file = fs.createWriteStream('example.txt'); +file.write('hello, '); +file.end('world!'); +// writing more now is not allowed! +``` + +##### writable.setDefaultEncoding(encoding)[#](#stream_writable_setdefaultencoding_encoding) + +History + +| Version | Changes | +| --- | --- | +| v6.1.0 | This method now returns a reference to `writable`. | +| v0.11.15 | Added in: v0.11.15 | + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The new default encoding +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `writable.setDefaultEncoding()` method sets the default `encoding` for a +[Writable](#stream_class_stream_writable) stream. + +##### writable.uncork()[#](#stream_writable_uncork) + +Added in: v0.11.2 + +The `writable.uncork()` method flushes all data buffered since +[`stream.cork()`](#stream_writable_cork) was called. + +When using [`writable.cork()`](#stream_writable_cork) and `writable.uncork()` to manage the buffering +of writes to a stream, it is recommended that calls to `writable.uncork()` be +deferred using `process.nextTick()`. Doing so allows batching of all +`writable.write()` calls that occur within a given Node.js event loop phase. + +```None +stream.cork(); +stream.write('some '); +stream.write('data '); +process.nextTick(() => stream.uncork()); +``` + +If the [`writable.cork()`](#stream_writable_cork) method is called multiple times on a stream, the +same number of calls to `writable.uncork()` must be called to flush the buffered +data. + +```None +stream.cork(); +stream.write('some '); +stream.cork(); +stream.write('data '); +process.nextTick(() => { + stream.uncork(); + // The data will not be flushed until uncork() is called a second time. + stream.uncork(); +}); +``` + +See also: [`writable.cork()`](#stream_writable_cork). + +##### writable.writableHighWaterMark[#](#stream_writable_writablehighwatermark) + +Added in: v9.3.0 + +Return the value of `highWaterMark` passed when constructing this +`Writable`. + +##### writable.writableLength[#](#stream_writable_writablelength) + +Added in: v9.4.0 + +This property contains the number of bytes (or objects) in the queue +ready to be written. The value provides introspection data regarding +the status of the `highWaterMark`. + +##### writable.write(chunk[, encoding][, callback])[#](#stream_writable_write_chunk_encoding_callback) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `chunk` argument can now be a `Uint8Array` instance. | +| v6.0.0 | Passing `null` as the `chunk` parameter will always be considered invalid now, even in object mode. | +| v0.9.4 | Added in: v0.9.4 | + +* `chunk` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | Optional data to write. For streams + not operating in object mode, `chunk` must be a string, `Buffer` or + `Uint8Array`. For object mode streams, `chunk` may be any JavaScript value + other than `null`. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding, if `chunk` is a string +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Callback for when this chunk of data is flushed +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `false` if the stream wishes for the calling code to + wait for the `'drain'` event to be emitted before continuing to write + additional data; otherwise `true`. + +The `writable.write()` method writes some data to the stream, and calls the +supplied `callback` once the data has been fully handled. If an error +occurs, the `callback` *may or may not* be called with the error as its +first argument. To reliably detect write errors, add a listener for the +`'error'` event. + +The return value is `true` if the internal buffer is less than the +`highWaterMark` configured when the stream was created after admitting `chunk`. +If `false` is returned, further attempts to write data to the stream should +stop until the [`'drain'`](#stream_event_drain) event is emitted. + +While a stream is not draining, calls to `write()` will buffer `chunk`, and +return false. Once all currently buffered chunks are drained (accepted for +delivery by the operating system), the `'drain'` event will be emitted. +It is recommended that once write() returns false, no more chunks be written +until the `'drain'` event is emitted. While calling `write()` on a stream that +is not draining is allowed, Node.js will buffer all written chunks until +maximum memory usage occurs, at which point it will abort unconditionally. +Even before it aborts, high memory usage will cause poor garbage collector +performance and high RSS (which is not typically released back to the system, +even after the memory is no longer required). Since TCP sockets may never +drain if the remote peer does not read the data, writing a socket that is +not draining may lead to a remotely exploitable vulnerability. + +Writing data while the stream is not draining is particularly +problematic for a [Transform](#stream_class_stream_transform), because the `Transform` streams are paused +by default until they are piped or an `'data'` or `'readable'` event handler +is added. + +If the data to be written can be generated or fetched on demand, it is +recommended to encapsulate the logic into a [Readable](#stream_class_stream_readable) and use +[`stream.pipe()`](#stream_readable_pipe_destination_options). However, if calling `write()` is preferred, it is +possible to respect backpressure and avoid memory issues using the +[`'drain'`](#stream_event_drain) event: + +```None +function write(data, cb) { + if (!stream.write(data)) { + stream.once('drain', cb); + } else { + process.nextTick(cb); + } +} + +// Wait for cb to be called before doing any other write. +write('hello', () => { + console.log('write completed, do more writes now'); +}); +``` + +A Writable stream in object mode will always ignore the `encoding` argument. + +##### writable.destroy([error])[#](#stream_writable_destroy_error) + +Added in: v8.0.0 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +Destroy the stream, and emit the passed error. After this call, the +writable stream has ended. Implementors should not override this method, +but instead implement [`writable._destroy`](#stream_writable_destroy_err_callback). + +### Readable Streams[#](#stream_readable_streams) + +Readable streams are an abstraction for a *source* from which data is +consumed. + +Examples of Readable streams include: + +* [HTTP responses, on the client](http.html#http_class_http_incomingmessage) +* [HTTP requests, on the server](http.html#http_class_http_incomingmessage) +* [fs read streams](fs.html#fs_class_fs_readstream) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) +* [TCP sockets](net.html#net_class_net_socket) +* [child process stdout and stderr](child_process.html#child_process_subprocess_stdout) +* [`process.stdin`](process.html#process_process_stdin) + +All [Readable](#stream_class_stream_readable) streams implement the interface defined by the +`stream.Readable` class. + +#### Two Modes[#](#stream_two_modes) + +Readable streams effectively operate in one of two modes: flowing and paused. + +When in flowing mode, data is read from the underlying system automatically +and provided to an application as quickly as possible using events via the +[`EventEmitter`](events.html#events_class_eventemitter) interface. + +In paused mode, the [`stream.read()`](#stream_readable_read_size) method must be called +explicitly to read chunks of data from the stream. + +All [Readable](#stream_class_stream_readable) streams begin in paused mode but can be switched to flowing +mode in one of the following ways: + +* Adding a [`'data'`](#stream_event_data) event handler. +* Calling the [`stream.resume()`](#stream_readable_resume) method. +* Calling the [`stream.pipe()`](#stream_readable_pipe_destination_options) method to send the data to a [Writable](#stream_class_stream_writable). + +The Readable can switch back to paused mode using one of the following: + +* If there are no pipe destinations, by calling the + [`stream.pause()`](#stream_readable_pause) method. +* If there are pipe destinations, by removing all pipe destinations. + Multiple pipe destinations may be removed by calling the + [`stream.unpipe()`](#stream_readable_unpipe_destination) method. + +The important concept to remember is that a Readable will not generate data +until a mechanism for either consuming or ignoring that data is provided. If +the consuming mechanism is disabled or taken away, the Readable will *attempt* +to stop generating the data. + +For backwards compatibility reasons, removing [`'data'`](#stream_event_data) event handlers will +**not** automatically pause the stream. Also, if there are piped destinations, +then calling [`stream.pause()`](#stream_readable_pause) will not guarantee that the +stream will *remain* paused once those destinations drain and ask for more data. + +If a [Readable](#stream_class_stream_readable) is switched into flowing mode and there are no consumers +available to handle the data, that data will be lost. This can occur, for +instance, when the `readable.resume()` method is called without a listener +attached to the `'data'` event, or when a `'data'` event handler is removed +from the stream. + +#### Three States[#](#stream_three_states) + +The "two modes" of operation for a Readable stream are a simplified abstraction +for the more complicated internal state management that is happening within the +Readable stream implementation. + +Specifically, at any given point in time, every Readable is in one of three +possible states: + +* `readable.readableFlowing = null` +* `readable.readableFlowing = false` +* `readable.readableFlowing = true` + +When `readable.readableFlowing` is `null`, no mechanism for consuming the +streams data is provided so the stream will not generate its data. While in this +state, attaching a listener for the `'data'` event, calling the +`readable.pipe()` method, or calling the `readable.resume()` method will switch +`readable.readableFlowing` to `true`, causing the Readable to begin +actively emitting events as data is generated. + +Calling `readable.pause()`, `readable.unpipe()`, or receiving "back pressure" +will cause the `readable.readableFlowing` to be set as `false`, +temporarily halting the flowing of events but *not* halting the generation of +data. While in this state, attaching a listener for the `'data'` event +would not cause `readable.readableFlowing` to switch to `true`. + +```None +const { PassThrough, Writable } = require('stream'); +const pass = new PassThrough(); +const writable = new Writable(); + +pass.pipe(writable); +pass.unpipe(writable); +// readableFlowing is now false + +pass.on('data', (chunk) => { console.log(chunk.toString()); }); +pass.write('ok'); // will not emit 'data' +pass.resume(); // must be called to make 'data' being emitted +``` + +While `readable.readableFlowing` is `false`, data may be accumulating +within the streams internal buffer. + +#### Choose One[#](#stream_choose_one) + +The Readable stream API evolved across multiple Node.js versions and provides +multiple methods of consuming stream data. In general, developers should choose +*one* of the methods of consuming data and *should never* use multiple methods +to consume data from a single stream. + +Use of the `readable.pipe()` method is recommended for most users as it has been +implemented to provide the easiest way of consuming stream data. Developers that +require more fine-grained control over the transfer and generation of data can +use the [`EventEmitter`](events.html#events_class_eventemitter) and `readable.pause()`/`readable.resume()` APIs. + +#### Class: stream.Readable[#](#stream_class_stream_readable) + +Added in: v0.9.4 + +##### Event: 'close'[#](#stream_event_close_1) + +Added in: v0.9.4 + +The `'close'` event is emitted when the stream and any of its underlying +resources (a file descriptor, for example) have been closed. The event indicates +that no more events will be emitted, and no further computation will occur. + +Not all [Readable](#stream_class_stream_readable) streams will emit the `'close'` event. + +##### Event: 'data'[#](#stream_event_data) + +Added in: v0.9.4 + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | The chunk of data. For streams that are not + operating in object mode, the chunk will be either a string or `Buffer`. + For streams that are in object mode, the chunk can be any JavaScript value + other than `null`. + +The `'data'` event is emitted whenever the stream is relinquishing ownership of +a chunk of data to a consumer. This may occur whenever the stream is switched +in flowing mode by calling `readable.pipe()`, `readable.resume()`, or by +attaching a listener callback to the `'data'` event. The `'data'` event will +also be emitted whenever the `readable.read()` method is called and a chunk of +data is available to be returned. + +Attaching a `'data'` event listener to a stream that has not been explicitly +paused will switch the stream into flowing mode. Data will then be passed as +soon as it is available. + +The listener callback will be passed the chunk of data as a string if a default +encoding has been specified for the stream using the +`readable.setEncoding()` method; otherwise the data will be passed as a +`Buffer`. + +```None +const readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log(`Received ${chunk.length} bytes of data.`); +}); +``` + +##### Event: 'end'[#](#stream_event_end) + +Added in: v0.9.4 + +The `'end'` event is emitted when there is no more data to be consumed from +the stream. + +The `'end'` event **will not be emitted** unless the data is completely +consumed. This can be accomplished by switching the stream into flowing mode, +or by calling [`stream.read()`](#stream_readable_read_size) repeatedly until all data has been +consumed. + +```None +const readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log(`Received ${chunk.length} bytes of data.`); +}); +readable.on('end', () => { + console.log('There will be no more data.'); +}); +``` + +##### Event: 'error'[#](#stream_event_error_1) + +Added in: v0.9.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + +The `'error'` event may be emitted by a Readable implementation at any time. +Typically, this may occur if the underlying stream is unable to generate data +due to an underlying internal failure, or when a stream implementation attempts +to push an invalid chunk of data. + +The listener callback will be passed a single `Error` object. + +##### Event: 'readable'[#](#stream_event_readable) + +Added in: v0.9.4 + +The `'readable'` event is emitted when there is data available to be read from +the stream. In some cases, attaching a listener for the `'readable'` event will +cause some amount of data to be read into an internal buffer. + +```None +const readable = getReadableStreamSomehow(); +readable.on('readable', () => { + // there is some data to read now +}); +``` + +The `'readable'` event will also be emitted once the end of the stream data +has been reached but before the `'end'` event is emitted. + +Effectively, the `'readable'` event indicates that the stream has new +information: either new data is available or the end of the stream has been +reached. In the former case, [`stream.read()`](#stream_readable_read_size) will return the +available data. In the latter case, [`stream.read()`](#stream_readable_read_size) will return +`null`. For instance, in the following example, `foo.txt` is an empty file: + +```None +const fs = require('fs'); +const rr = fs.createReadStream('foo.txt'); +rr.on('readable', () => { + console.log(`readable: ${rr.read()}`); +}); +rr.on('end', () => { + console.log('end'); +}); +``` + +The output of running this script is: + +```None +$ node test.js +readable: null +end +``` + +In general, the `readable.pipe()` and `'data'` event mechanisms are easier to +understand than the `'readable'` event. However, handling `'readable'` might +result in increased throughput. + +##### readable.isPaused()[#](#stream_readable_ispaused) + +Added in: v0.11.14 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +The `readable.isPaused()` method returns the current operating state of the +Readable. This is used primarily by the mechanism that underlies the +`readable.pipe()` method. In most typical cases, there will be no reason to +use this method directly. + +```None +const readable = new stream.Readable(); + +readable.isPaused(); // === false +readable.pause(); +readable.isPaused(); // === true +readable.resume(); +readable.isPaused(); // === false +``` + +##### readable.pause()[#](#stream_readable_pause) + +Added in: v0.9.4 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `readable.pause()` method will cause a stream in flowing mode to stop +emitting [`'data'`](#stream_event_data) events, switching out of flowing mode. Any data that +becomes available will remain in the internal buffer. + +```None +const readable = getReadableStreamSomehow(); +readable.on('data', (chunk) => { + console.log(`Received ${chunk.length} bytes of data.`); + readable.pause(); + console.log('There will be no additional data for 1 second.'); + setTimeout(() => { + console.log('Now data will start flowing again.'); + readable.resume(); + }, 1000); +}); +``` + +##### readable.pipe(destination[, options])[#](#stream_readable_pipe_destination_options) + +Added in: v0.9.4 + +* `destination` [](stream.html#stream_class_stream_writable) The destination for writing data +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Pipe options + + `end` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) End the writer when the reader ends. Defaults to `true`. + +The `readable.pipe()` method attaches a [Writable](#stream_class_stream_writable) stream to the `readable`, +causing it to switch automatically into flowing mode and push all of its data +to the attached [Writable](#stream_class_stream_writable). The flow of data will be automatically managed so +that the destination Writable stream is not overwhelmed by a faster Readable +stream. + +The following example pipes all of the data from the `readable` into a file +named `file.txt`: + +```None +const fs = require('fs'); +const readable = getReadableStreamSomehow(); +const writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt' +readable.pipe(writable); +``` + +It is possible to attach multiple Writable streams to a single Readable stream. + +The `readable.pipe()` method returns a reference to the *destination* stream +making it possible to set up chains of piped streams: + +```None +const fs = require('fs'); +const r = fs.createReadStream('file.txt'); +const z = zlib.createGzip(); +const w = fs.createWriteStream('file.txt.gz'); +r.pipe(z).pipe(w); +``` + +By default, [`stream.end()`](#stream_writable_end_chunk_encoding_callback) is called on the destination Writable +stream when the source Readable stream emits [`'end'`](#stream_event_end), so that the +destination is no longer writable. To disable this default behavior, the `end` +option can be passed as `false`, causing the destination stream to remain open, +as illustrated in the following example: + +```None +reader.pipe(writer, { end: false }); +reader.on('end', () => { + writer.end('Goodbye\n'); +}); +``` + +One important caveat is that if the Readable stream emits an error during +processing, the Writable destination *is not closed* automatically. If an +error occurs, it will be necessary to *manually* close each stream in order +to prevent memory leaks. + +The [`process.stderr`](process.html#process_process_stderr) and [`process.stdout`](process.html#process_process_stdout) Writable streams are never +closed until the Node.js process exits, regardless of the specified options. + +##### readable.readableHighWaterMark[#](#stream_readable_readablehighwatermark) + +Added in: v9.3.0 + +Return the value of `highWaterMark` passed when constructing this +`Readable`. + +##### readable.read([size])[#](#stream_readable_read_size) + +Added in: v0.9.4 + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Optional argument to specify how much data to read. +* Return [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Null_type) + +The `readable.read()` method pulls some data out of the internal buffer and +returns it. If no data available to be read, `null` is returned. By default, +the data will be returned as a `Buffer` object unless an encoding has been +specified using the `readable.setEncoding()` method or the stream is operating +in object mode. + +The optional `size` argument specifies a specific number of bytes to read. If +`size` bytes are not available to be read, `null` will be returned *unless* +the stream has ended, in which case all of the data remaining in the internal +buffer will be returned. + +If the `size` argument is not specified, all of the data contained in the +internal buffer will be returned. + +The `readable.read()` method should only be called on Readable streams operating +in paused mode. In flowing mode, `readable.read()` is called automatically until +the internal buffer is fully drained. + +```None +const readable = getReadableStreamSomehow(); +readable.on('readable', () => { + let chunk; + while (null !== (chunk = readable.read())) { + console.log(`Received ${chunk.length} bytes of data.`); + } +}); +``` + +A Readable stream in object mode will always return a single item from +a call to [`readable.read(size)`](#stream_readable_read_size), regardless of the value of the +`size` argument. + +If the `readable.read()` method returns a chunk of data, a `'data'` event will +also be emitted. + +Calling [`stream.read([size])`](#stream_readable_read_size) after the [`'end'`](#stream_event_end) event has +been emitted will return `null`. No runtime error will be raised. + +##### readable.readableLength[#](#stream_readable_readablelength) + +Added in: v9.4.0 + +This property contains the number of bytes (or objects) in the queue +ready to be read. The value provides introspection data regarding +the status of the `highWaterMark`. + +##### readable.resume()[#](#stream_readable_resume) + +Added in: v0.9.4 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `readable.resume()` method causes an explicitly paused Readable stream to +resume emitting [`'data'`](#stream_event_data) events, switching the stream into flowing mode. + +The `readable.resume()` method can be used to fully consume the data from a +stream without actually processing any of that data as illustrated in the +following example: + +```None +getReadableStreamSomehow() + .resume() + .on('end', () => { + console.log('Reached the end, but did not read anything.'); + }); +``` + +##### readable.setEncoding(encoding)[#](#stream_readable_setencoding_encoding) + +Added in: v0.9.4 + +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The encoding to use. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) + +The `readable.setEncoding()` method sets the character encoding for +data read from the Readable stream. + +By default, no encoding is assigned and stream data will be returned as +`Buffer` objects. Setting an encoding causes the stream data +to be returned as strings of the specified encoding rather than as `Buffer` +objects. For instance, calling `readable.setEncoding('utf8')` will cause the +output data to be interpreted as UTF-8 data, and passed as strings. Calling +`readable.setEncoding('hex')` will cause the data to be encoded in hexadecimal +string format. + +The Readable stream will properly handle multi-byte characters delivered through +the stream that would otherwise become improperly decoded if simply pulled from +the stream as `Buffer` objects. + +```None +const readable = getReadableStreamSomehow(); +readable.setEncoding('utf8'); +readable.on('data', (chunk) => { + assert.equal(typeof chunk, 'string'); + console.log('got %d characters of string data', chunk.length); +}); +``` + +##### readable.unpipe([destination])[#](#stream_readable_unpipe_destination) + +Added in: v0.9.4 + +* `destination` [](stream.html#stream_class_stream_writable) Optional specific stream to unpipe + +The `readable.unpipe()` method detaches a Writable stream previously attached +using the [`stream.pipe()`](#stream_readable_pipe_destination_options) method. + +If the `destination` is not specified, then *all* pipes are detached. + +If the `destination` is specified, but no pipe is set up for it, then +the method does nothing. + +```None +const fs = require('fs'); +const readable = getReadableStreamSomehow(); +const writable = fs.createWriteStream('file.txt'); +// All the data from readable goes into 'file.txt', +// but only for the first second +readable.pipe(writable); +setTimeout(() => { + console.log('Stop writing to file.txt'); + readable.unpipe(writable); + console.log('Manually close the file stream'); + writable.end(); +}, 1000); +``` + +##### readable.unshift(chunk)[#](#stream_readable_unshift_chunk) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `chunk` argument can now be a `Uint8Array` instance. | +| v0.9.11 | Added in: v0.9.11 | + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | Chunk of data to unshift onto the + read queue. For streams not operating in object mode, `chunk` must be a + string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be + any JavaScript value other than `null`. + +The `readable.unshift()` method pushes a chunk of data back into the internal +buffer. This is useful in certain situations where a stream is being consumed by +code that needs to "un-consume" some amount of data that it has optimistically +pulled out of the source, so that the data can be passed on to some other party. + +The `stream.unshift(chunk)` method cannot be called after the [`'end'`](#stream_event_end) event +has been emitted or a runtime error will be thrown. + +Developers using `stream.unshift()` often should consider switching to +use of a [Transform](#stream_class_stream_transform) stream instead. See the [API for Stream Implementers](#stream_api_for_stream_implementers) +section for more information. + +```None +// Pull off a header delimited by \n\n +// use unshift() if we get too much +// Call the callback with (error, header, stream) +const { StringDecoder } = require('string_decoder'); +function parseHeader(stream, callback) { + stream.on('error', callback); + stream.on('readable', onReadable); + const decoder = new StringDecoder('utf8'); + let header = ''; + function onReadable() { + let chunk; + while (null !== (chunk = stream.read())) { + const str = decoder.write(chunk); + if (str.match(/\n\n/)) { + // found the header boundary + const split = str.split(/\n\n/); + header += split.shift(); + const remaining = split.join('\n\n'); + const buf = Buffer.from(remaining, 'utf8'); + stream.removeListener('error', callback); + // remove the readable listener before unshifting + stream.removeListener('readable', onReadable); + if (buf.length) + stream.unshift(buf); + // now the body of the message can be read from the stream. + callback(null, header, stream); + } else { + // still reading the header. + header += str; + } + } + } +} +``` + +Unlike [`stream.push(chunk)`](#stream_readable_push_chunk_encoding), `stream.unshift(chunk)` will not +end the reading process by resetting the internal reading state of the stream. +This can cause unexpected results if `readable.unshift()` is called during a +read (i.e. from within a [`stream._read()`](#stream_readable_read_size_1) implementation on a +custom stream). Following the call to `readable.unshift()` with an immediate +[`stream.push('')`](#stream_readable_push_chunk_encoding) will reset the reading state appropriately, +however it is best to simply avoid calling `readable.unshift()` while in the +process of performing a read. + +##### readable.wrap(stream)[#](#stream_readable_wrap_stream) + +Added in: v0.9.4 + +* `stream` [](stream.html#stream_stream) An "old style" readable stream + +Versions of Node.js prior to v0.10 had streams that did not implement the +entire `stream` module API as it is currently defined. (See [Compatibility](#stream_compatibility_with_older_node_js_versions) +for more information.) + +When using an older Node.js library that emits [`'data'`](#stream_event_data) events and has a +[`stream.pause()`](#stream_readable_pause) method that is advisory only, the +`readable.wrap()` method can be used to create a [Readable](#stream_class_stream_readable) stream that uses +the old stream as its data source. + +It will rarely be necessary to use `readable.wrap()` but the method has been +provided as a convenience for interacting with older Node.js applications and +libraries. + +```None +const { OldReader } = require('./old-api-module.js'); +const { Readable } = require('stream'); +const oreader = new OldReader(); +const myReader = new Readable().wrap(oreader); + +myReader.on('readable', () => { + myReader.read(); // etc. +}); +``` + +##### readable.destroy([error])[#](#stream_readable_destroy_error) + +Added in: v8.0.0 + +Destroy the stream, and emit `'error'`. After this call, the +readable stream will release any internal resources. +Implementors should not override this method, but instead implement +[`readable._destroy`](#stream_readable_destroy_err_callback). + +### Duplex and Transform Streams[#](#stream_duplex_and_transform_streams) + +#### Class: stream.Duplex[#](#stream_class_stream_duplex) + +History + +| Version | Changes | +| --- | --- | +| v6.8.0 | Instances of `Duplex` now return `true` when checking `instanceof stream.Writable`. | +| v0.9.4 | Added in: v0.9.4 | + +Duplex streams are streams that implement both the [Readable](#stream_class_stream_readable) and +[Writable](#stream_class_stream_writable) interfaces. + +Examples of Duplex streams include: + +* [TCP sockets](net.html#net_class_net_socket) +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) + +#### Class: stream.Transform[#](#stream_class_stream_transform) + +Added in: v0.9.4 + +Transform streams are [Duplex](#stream_class_stream_duplex) streams where the output is in some way +related to the input. Like all [Duplex](#stream_class_stream_duplex) streams, Transform streams +implement both the [Readable](#stream_class_stream_readable) and [Writable](#stream_class_stream_writable) interfaces. + +Examples of Transform streams include: + +* [zlib streams](zlib.html) +* [crypto streams](crypto.html) + +##### transform.destroy([error])[#](#stream_transform_destroy_error) + +Added in: v8.0.0 + +Destroy the stream, and emit `'error'`. After this call, the +transform stream would release any internal resources. +implementors should not override this method, but instead implement +[`readable._destroy`](#stream_readable_destroy_err_callback). +The default implementation of `_destroy` for `Transform` also emit `'close'`. + +## API for Stream Implementers[#](#stream_api_for_stream_implementers) + +The `stream` module API has been designed to make it possible to easily +implement streams using JavaScript's prototypal inheritance model. + +First, a stream developer would declare a new JavaScript class that extends one +of the four basic stream classes (`stream.Writable`, `stream.Readable`, +`stream.Duplex`, or `stream.Transform`), making sure they call the appropriate +parent class constructor: + +```None +const { Writable } = require('stream'); + +class MyWritable extends Writable { + constructor(options) { + super(options); + // ... + } +} +``` + +The new stream class must then implement one or more specific methods, depending +on the type of stream being created, as detailed in the chart below: + +| Use-case | Class | Method(s) to implement | +| --- | --- | --- | +| Reading only | [Readable](#stream_class_stream_readable) | `_read` | +| Writing only | [Writable](#stream_class_stream_writable) | `_write`, `_writev`, `_final` | +| Reading and writing | [Duplex](#stream_class_stream_duplex) | `_read`, `_write`, `_writev`, `_final` | +| Operate on written data, then read the result | [Transform](#stream_class_stream_transform) | `_transform`, `_flush`, `_final` | + +The implementation code for a stream should *never* call the "public" methods +of a stream that are intended for use by consumers (as described in the +[API for Stream Consumers](#stream_api_for_stream_consumers) section). Doing so may lead to adverse side effects +in application code consuming the stream. + +### Simplified Construction[#](#stream_simplified_construction) + +Added in: v1.2.0 + +For many simple cases, it is possible to construct a stream without relying on +inheritance. This can be accomplished by directly creating instances of the +`stream.Writable`, `stream.Readable`, `stream.Duplex` or `stream.Transform` +objects and passing appropriate methods as constructor options. + +```None +const { Writable } = require('stream'); + +const myWritable = new Writable({ + write(chunk, encoding, callback) { + // ... + } +}); +``` + +### Implementing a Writable Stream[#](#stream_implementing_a_writable_stream) + +The `stream.Writable` class is extended to implement a [Writable](#stream_class_stream_writable) stream. + +Custom Writable streams *must* call the `new stream.Writable([options])` +constructor and implement the `writable._write()` method. The +`writable._writev()` method *may* also be implemented. + +#### Constructor: new stream.Writable([options])[#](#stream_constructor_new_stream_writable_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `highWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Buffer level when + [`stream.write()`](#stream_writable_write_chunk_encoding_callback) starts returning `false`. Defaults to + `16384` (16kb), or `16` for `objectMode` streams. + + `decodeStrings` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether or not to decode strings into + Buffers before passing them to [`stream._write()`](#stream_writable_write_chunk_encoding_callback_1). + Defaults to `true` + + `objectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether or not the + [`stream.write(anyObj)`](#stream_writable_write_chunk_encoding_callback) is a valid operation. When set, + it becomes possible to write JavaScript values other than string, + `Buffer` or `Uint8Array` if supported by the stream implementation. + Defaults to `false` + + `write` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._write()`](#stream_writable_write_chunk_encoding_callback_1) method. + + `writev` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._writev()`](#stream_writable_writev_chunks_callback) method. + + `destroy` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._destroy()`](#stream_writable_destroy_err_callback) method. + + `final` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._final()`](#stream_writable_final_callback) method. + +```None +const { Writable } = require('stream'); + +class MyWritable extends Writable { + constructor(options) { + // Calls the stream.Writable() constructor + super(options); + // ... + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const { Writable } = require('stream'); +const util = require('util'); + +function MyWritable(options) { + if (!(this instanceof MyWritable)) + return new MyWritable(options); + Writable.call(this, options); +} +util.inherits(MyWritable, Writable); +``` + +Or, using the Simplified Constructor approach: + +```None +const { Writable } = require('stream'); + +const myWritable = new Writable({ + write(chunk, encoding, callback) { + // ... + }, + writev(chunks, callback) { + // ... + } +}); +``` + +#### writable.\_write(chunk, encoding, callback)[#](#stream_writable_write_chunk_encoding_callback_1) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | The chunk to be written. Will **always** + be a buffer unless the `decodeStrings` option was set to `false` + or the stream is operating in object mode. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If the chunk is a string, then `encoding` is the + character encoding of that string. If chunk is a `Buffer`, or if the + stream is operating in object mode, `encoding` may be ignored. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Call this function (optionally with an error + argument) when processing is complete for the supplied chunk. + +All Writable stream implementations must provide a +[`writable._write()`](#stream_writable_write_chunk_encoding_callback_1) method to send data to the underlying +resource. + +[Transform](#stream_class_stream_transform) streams provide their own implementation of the +[`writable._write()`](#stream_writable_write_chunk_encoding_callback_1). + +This function MUST NOT be called by application code directly. It should be +implemented by child classes, and called by the internal Writable class methods +only. + +The `callback` method must be called to signal either that the write completed +successfully or failed with an error. The first argument passed to the +`callback` must be the `Error` object if the call failed or `null` if the +write succeeded. + +All calls to `writable.write()` that occur between the time `writable._write()` +is called and the `callback` is called will cause the written data to be +buffered. When the `callback` is invoked, the stream might emit a [`'drain'`](#stream_event_drain) +event. If a stream implementation is capable of processing multiple chunks of +data at once, the `writable._writev()` method should be implemented. + +If the `decodeStrings` property is set in the constructor options, then +`chunk` may be a string rather than a Buffer, and `encoding` will +indicate the character encoding of the string. This is to support +implementations that have an optimized handling for certain string +data encodings. If the `decodeStrings` property is explicitly set to `false`, +the `encoding` argument can be safely ignored, and `chunk` will remain the same +object that is passed to `.write()`. + +The `writable._write()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### writable.\_writev(chunks, callback)[#](#stream_writable_writev_chunks_callback) + +* `chunks` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) The chunks to be written. Each chunk has following + format: `{ chunk: ..., encoding: ... }`. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function (optionally with an error + argument) to be invoked when processing is complete for the supplied chunks. + +This function MUST NOT be called by application code directly. It should be +implemented by child classes, and called by the internal Writable class methods +only. + +The `writable._writev()` method may be implemented in addition to +`writable._write()` in stream implementations that are capable of processing +multiple chunks of data at once. If implemented, the method will be called with +all chunks of data currently buffered in the write queue. + +The `writable._writev()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### writable.\_destroy(err, callback)[#](#stream_writable_destroy_err_callback) + +Added in: v8.0.0 + +* `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) A possible error. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function that takes an optional error + argument. + +The `_destroy()` method is called by [`writable.destroy()`](#stream_writable_destroy_error). +It can be overridden by child classes but it **must not** be called directly. + +#### writable.\_final(callback)[#](#stream_writable_final_callback) + +Added in: v8.0.0 + +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Call this function (optionally with an error + argument) when finished writing any remaining data. + +The `_final()` method **must not** be called directly. It may be implemented +by child classes, and if so, will be called by the internal Writable +class methods only. + +This optional function will be called before the stream closes, delaying the +`finish` event until `callback` is called. This is useful to close resources +or write buffered data before a stream ends. + +#### Errors While Writing[#](#stream_errors_while_writing) + +It is recommended that errors occurring during the processing of the +`writable._write()` and `writable._writev()` methods are reported by invoking +the callback and passing the error as the first argument. This will cause an +`'error'` event to be emitted by the Writable. Throwing an Error from within +`writable._write()` can result in unexpected and inconsistent behavior depending +on how the stream is being used. Using the callback ensures consistent and +predictable handling of errors. + +If a Readable stream pipes into a Writable stream when Writable emits an +error, the Readable stream will be unpiped. + +```None +const { Writable } = require('stream'); + +const myWritable = new Writable({ + write(chunk, encoding, callback) { + if (chunk.toString().indexOf('a') >= 0) { + callback(new Error('chunk is invalid')); + } else { + callback(); + } + } +}); +``` + +#### An Example Writable Stream[#](#stream_an_example_writable_stream) + +The following illustrates a rather simplistic (and somewhat pointless) custom +Writable stream implementation. While this specific Writable stream instance +is not of any real particular usefulness, the example illustrates each of the +required elements of a custom [Writable](#stream_class_stream_writable) stream instance: + +```None +const { Writable } = require('stream'); + +class MyWritable extends Writable { + constructor(options) { + super(options); + // ... + } + + _write(chunk, encoding, callback) { + if (chunk.toString().indexOf('a') >= 0) { + callback(new Error('chunk is invalid')); + } else { + callback(); + } + } +} +``` + +#### Decoding buffers in a Writable Stream[#](#stream_decoding_buffers_in_a_writable_stream) + +Decoding buffers is a common task, for instance, when using transformers whose +input is a string. This is not a trivial process when using multi-byte +characters encoding, such as UTF-8. The following example shows how to decode +multi-byte strings using `StringDecoder` and [Writable](#stream_class_stream_writable). + +```None +const { Writable } = require('stream'); +const { StringDecoder } = require('string_decoder'); + +class StringWritable extends Writable { + constructor(options) { + super(options); + const state = this._writableState; + this._decoder = new StringDecoder(state.defaultEncoding); + this.data = ''; + } + _write(chunk, encoding, callback) { + if (encoding === 'buffer') { + chunk = this._decoder.write(chunk); + } + this.data += chunk; + callback(); + } + _final(callback) { + this.data += this._decoder.end(); + callback(); + } +} + +const euro = [[0xE2, 0x82], [0xAC]].map(Buffer.from); +const w = new StringWritable(); + +w.write('currency: '); +w.write(euro[0]); +w.end(euro[1]); + +console.log(w.data); // currency: € +``` + +### Implementing a Readable Stream[#](#stream_implementing_a_readable_stream) + +The `stream.Readable` class is extended to implement a [Readable](#stream_class_stream_readable) stream. + +Custom Readable streams *must* call the `new stream.Readable([options])` +constructor and implement the `readable._read()` method. + +#### new stream.Readable([options])[#](#stream_new_stream_readable_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `highWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The maximum [number of bytes](#stream_highwatermark_discrepancy_after_calling_readable_setencoding) to store + in the internal buffer before ceasing to read from the underlying resource. + Defaults to `16384` (16kb), or `16` for `objectMode` streams + + `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If specified, then buffers will be decoded to + strings using the specified encoding. Defaults to `null` + + `objectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Whether this stream should behave + as a stream of objects. Meaning that [`stream.read(n)`](#stream_readable_read_size) returns + a single value instead of a Buffer of size n. Defaults to `false` + + `read` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the [`stream._read()`](#stream_readable_read_size_1) + method. + + `destroy` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._destroy()`](#stream_readable_destroy_err_callback) method. + +```None +const { Readable } = require('stream'); + +class MyReadable extends Readable { + constructor(options) { + // Calls the stream.Readable(options) constructor + super(options); + // ... + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const { Readable } = require('stream'); +const util = require('util'); + +function MyReadable(options) { + if (!(this instanceof MyReadable)) + return new MyReadable(options); + Readable.call(this, options); +} +util.inherits(MyReadable, Readable); +``` + +Or, using the Simplified Constructor approach: + +```None +const { Readable } = require('stream'); + +const myReadable = new Readable({ + read(size) { + // ... + } +}); +``` + +#### readable.\_read(size)[#](#stream_readable_read_size_1) + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Number of bytes to read asynchronously + +This function MUST NOT be called by application code directly. It should be +implemented by child classes, and called by the internal Readable class methods +only. + +All Readable stream implementations must provide an implementation of the +`readable._read()` method to fetch data from the underlying resource. + +When `readable._read()` is called, if data is available from the resource, the +implementation should begin pushing that data into the read queue using the +[`this.push(dataChunk)`](#stream_readable_push_chunk_encoding) method. `_read()` should continue reading +from the resource and pushing data until `readable.push()` returns `false`. Only +when `_read()` is called again after it has stopped should it resume pushing +additional data onto the queue. + +Once the `readable._read()` method has been called, it will not be called again +until the [`readable.push()`](#stream_readable_push_chunk_encoding) method is called. + +The `size` argument is advisory. For implementations where a "read" is a +single operation that returns data can use the `size` argument to determine how +much data to fetch. Other implementations may ignore this argument and simply +provide data whenever it becomes available. There is no need to "wait" until +`size` bytes are available before calling [`stream.push(chunk)`](#stream_readable_push_chunk_encoding). + +The `readable._read()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### readable.\_destroy(err, callback)[#](#stream_readable_destroy_err_callback) + +Added in: v8.0.0 + +* `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) A possible error. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function that takes an optional error + argument. + +The `_destroy()` method is called by [`readable.destroy()`](#stream_readable_destroy_error). +It can be overridden by child classes but it **must not** be called directly. + +#### readable.push(chunk[, encoding])[#](#stream_readable_push_chunk_encoding) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `chunk` argument can now be a `Uint8Array` instance. | + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Null_type) | Chunk of data to push into the + read queue. For streams not operating in object mode, `chunk` must be a + string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be + any JavaScript value. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Encoding of string chunks. Must be a valid + Buffer encoding, such as `'utf8'` or `'ascii'` +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` if additional chunks of data may continued to be + pushed; `false` otherwise. + +When `chunk` is a `Buffer`, `Uint8Array` or `string`, the `chunk` of data will +be added to the internal queue for users of the stream to consume. +Passing `chunk` as `null` signals the end of the stream (EOF), after which no +more data can be written. + +When the Readable is operating in paused mode, the data added with +`readable.push()` can be read out by calling the +[`readable.read()`](#stream_readable_read_size) method when the [`'readable'`](#stream_event_readable) event is +emitted. + +When the Readable is operating in flowing mode, the data added with +`readable.push()` will be delivered by emitting a `'data'` event. + +The `readable.push()` method is designed to be as flexible as possible. For +example, when wrapping a lower-level source that provides some form of +pause/resume mechanism, and a data callback, the low-level source can be wrapped +by the custom Readable instance as illustrated in the following example: + +```None +// source is an object with readStop() and readStart() methods, +// and an `ondata` member that gets called when it has data, and +// an `onend` member that gets called when the data is over. + +class SourceWrapper extends Readable { + constructor(options) { + super(options); + + this._source = getLowlevelSourceObject(); + + // Every time there's data, push it into the internal buffer. + this._source.ondata = (chunk) => { + // if push() returns false, then stop reading from source + if (!this.push(chunk)) + this._source.readStop(); + }; + + // When the source ends, push the EOF-signaling `null` chunk + this._source.onend = () => { + this.push(null); + }; + } + // _read will be called when the stream wants to pull more data in + // the advisory size argument is ignored in this case. + _read(size) { + this._source.readStart(); + } +} +``` + +The `readable.push()` method is intended be called only by Readable +Implementers, and only from within the `readable._read()` method. + +For streams not operating in object mode, if the `chunk` parameter of +`readable.push()` is `undefined`, it will be treated as empty string or +buffer. See [`readable.push('')`](#stream_readable_push) for more information. + +#### Errors While Reading[#](#stream_errors_while_reading) + +It is recommended that errors occurring during the processing of the +`readable._read()` method are emitted using the `'error'` event rather than +being thrown. Throwing an Error from within `readable._read()` can result in +unexpected and inconsistent behavior depending on whether the stream is +operating in flowing or paused mode. Using the `'error'` event ensures +consistent and predictable handling of errors. + +```None +const { Readable } = require('stream'); + +const myReadable = new Readable({ + read(size) { + if (checkSomeErrorCondition()) { + process.nextTick(() => this.emit('error', err)); + return; + } + // do some work + } +}); +``` + +#### An Example Counting Stream[#](#stream_an_example_counting_stream) + +The following is a basic example of a Readable stream that emits the numerals +from 1 to 1,000,000 in ascending order, and then ends. + +```None +const { Readable } = require('stream'); + +class Counter extends Readable { + constructor(opt) { + super(opt); + this._max = 1000000; + this._index = 1; + } + + _read() { + const i = this._index++; + if (i > this._max) + this.push(null); + else { + const str = String(i); + const buf = Buffer.from(str, 'ascii'); + this.push(buf); + } + } +} +``` + +### Implementing a Duplex Stream[#](#stream_implementing_a_duplex_stream) + +A [Duplex](#stream_class_stream_duplex) stream is one that implements both [Readable](#stream_class_stream_readable) and [Writable](#stream_class_stream_writable), +such as a TCP socket connection. + +Because JavaScript does not have support for multiple inheritance, the +`stream.Duplex` class is extended to implement a [Duplex](#stream_class_stream_duplex) stream (as opposed +to extending the `stream.Readable` *and* `stream.Writable` classes). + +The `stream.Duplex` class prototypically inherits from `stream.Readable` and +parasitically from `stream.Writable`, but `instanceof` will work properly for +both base classes due to overriding [`Symbol.hasInstance`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/hasInstance) on +`stream.Writable`. + +Custom Duplex streams *must* call the `new stream.Duplex([options])` +constructor and implement *both* the `readable._read()` and +`writable._write()` methods. + +#### new stream.Duplex(options)[#](#stream_new_stream_duplex_options) + +History + +| Version | Changes | +| --- | --- | +| v8.4.0 | The `readableHighWaterMark` and `writableHighWaterMark` options are supported now. | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Passed to both Writable and Readable + constructors. Also has the following fields: + + `allowHalfOpen` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Defaults to `true`. If set to `false`, then + the stream will automatically end the writable side when the + readable side ends. + + `readableObjectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Defaults to `false`. Sets `objectMode` + for readable side of the stream. Has no effect if `objectMode` + is `true`. + + `writableObjectMode` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Defaults to `false`. Sets `objectMode` + for writable side of the stream. Has no effect if `objectMode` + is `true`. + + `readableHighWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Sets `highWaterMark` for the readable side + of the stream. Has no effect if `highWaterMark` is provided. + + `writableHighWaterMark` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Sets `highWaterMark` for the writable side + of the stream. Has no effect if `highWaterMark` is provided. + +```None +const { Duplex } = require('stream'); + +class MyDuplex extends Duplex { + constructor(options) { + super(options); + // ... + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const { Duplex } = require('stream'); +const util = require('util'); + +function MyDuplex(options) { + if (!(this instanceof MyDuplex)) + return new MyDuplex(options); + Duplex.call(this, options); +} +util.inherits(MyDuplex, Duplex); +``` + +Or, using the Simplified Constructor approach: + +```None +const { Duplex } = require('stream'); + +const myDuplex = new Duplex({ + read(size) { + // ... + }, + write(chunk, encoding, callback) { + // ... + } +}); +``` + +#### An Example Duplex Stream[#](#stream_an_example_duplex_stream) + +The following illustrates a simple example of a Duplex stream that wraps a +hypothetical lower-level source object to which data can be written, and +from which data can be read, albeit using an API that is not compatible with +Node.js streams. +The following illustrates a simple example of a Duplex stream that buffers +incoming written data via the [Writable](#stream_class_stream_writable) interface that is read back out +via the [Readable](#stream_class_stream_readable) interface. + +```None +const { Duplex } = require('stream'); +const kSource = Symbol('source'); + +class MyDuplex extends Duplex { + constructor(source, options) { + super(options); + this[kSource] = source; + } + + _write(chunk, encoding, callback) { + // The underlying source only deals with strings + if (Buffer.isBuffer(chunk)) + chunk = chunk.toString(); + this[kSource].writeSomeData(chunk); + callback(); + } + + _read(size) { + this[kSource].fetchSomeData(size, (data, encoding) => { + this.push(Buffer.from(data, encoding)); + }); + } +} +``` + +The most important aspect of a Duplex stream is that the Readable and Writable +sides operate independently of one another despite co-existing within a single +object instance. + +#### Object Mode Duplex Streams[#](#stream_object_mode_duplex_streams) + +For Duplex streams, `objectMode` can be set exclusively for either the Readable +or Writable side using the `readableObjectMode` and `writableObjectMode` options +respectively. + +In the following example, for instance, a new Transform stream (which is a +type of [Duplex](#stream_class_stream_duplex) stream) is created that has an object mode Writable side +that accepts JavaScript numbers that are converted to hexadecimal strings on +the Readable side. + +```None +const { Transform } = require('stream'); + +// All Transform streams are also Duplex Streams +const myTransform = new Transform({ + writableObjectMode: true, + + transform(chunk, encoding, callback) { + // Coerce the chunk to a number if necessary + chunk |= 0; + + // Transform the chunk into something else. + const data = chunk.toString(16); + + // Push the data onto the readable queue. + callback(null, '0'.repeat(data.length % 2) + data); + } +}); + +myTransform.setEncoding('ascii'); +myTransform.on('data', (chunk) => console.log(chunk)); + +myTransform.write(1); +// Prints: 01 +myTransform.write(10); +// Prints: 0a +myTransform.write(100); +// Prints: 64 +``` + +### Implementing a Transform Stream[#](#stream_implementing_a_transform_stream) + +A [Transform](#stream_class_stream_transform) stream is a [Duplex](#stream_class_stream_duplex) stream where the output is computed +in some way from the input. Examples include [zlib](zlib.html) streams or [crypto](crypto.html) +streams that compress, encrypt, or decrypt data. + +There is no requirement that the output be the same size as the input, the same +number of chunks, or arrive at the same time. For example, a Hash stream will +only ever have a single chunk of output which is provided when the input is +ended. A `zlib` stream will produce output that is either much smaller or much +larger than its input. + +The `stream.Transform` class is extended to implement a [Transform](#stream_class_stream_transform) stream. + +The `stream.Transform` class prototypically inherits from `stream.Duplex` and +implements its own versions of the `writable._write()` and `readable._read()` +methods. Custom Transform implementations *must* implement the +[`transform._transform()`](#stream_transform_transform_chunk_encoding_callback) method and *may* also implement +the [`transform._flush()`](#stream_transform_flush_callback) method. + +Care must be taken when using Transform streams in that data written to the +stream can cause the Writable side of the stream to become paused if the output +on the Readable side is not consumed. + +#### new stream.Transform([options])[#](#stream_new_stream_transform_options) + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Passed to both Writable and Readable + constructors. Also has the following fields: + + `transform` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the + [`stream._transform()`](#stream_transform_transform_chunk_encoding_callback) method. + + `flush` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Implementation for the [`stream._flush()`](#stream_transform_flush_callback) + method. + +```None +const { Transform } = require('stream'); + +class MyTransform extends Transform { + constructor(options) { + super(options); + // ... + } +} +``` + +Or, when using pre-ES6 style constructors: + +```None +const { Transform } = require('stream'); +const util = require('util'); + +function MyTransform(options) { + if (!(this instanceof MyTransform)) + return new MyTransform(options); + Transform.call(this, options); +} +util.inherits(MyTransform, Transform); +``` + +Or, using the Simplified Constructor approach: + +```None +const { Transform } = require('stream'); + +const myTransform = new Transform({ + transform(chunk, encoding, callback) { + // ... + } +}); +``` + +#### Events: 'finish' and 'end'[#](#stream_events_finish_and_end) + +The [`'finish'`](#stream_event_finish) and [`'end'`](#stream_event_end) events are from the `stream.Writable` +and `stream.Readable` classes, respectively. The `'finish'` event is emitted +after [`stream.end()`](#stream_writable_end_chunk_encoding_callback) is called and all chunks have been processed +by [`stream._transform()`](#stream_transform_transform_chunk_encoding_callback). The `'end'` event is emitted +after all data has been output, which occurs after the callback in +[`transform._flush()`](#stream_transform_flush_callback) has been called. + +#### transform.\_flush(callback)[#](#stream_transform_flush_callback) + +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function (optionally with an error + argument and data) to be called when remaining data has been flushed. + +This function MUST NOT be called by application code directly. It should be +implemented by child classes, and called by the internal Readable class methods +only. + +In some cases, a transform operation may need to emit an additional bit of +data at the end of the stream. For example, a `zlib` compression stream will +store an amount of internal state used to optimally compress the output. When +the stream ends, however, that additional data needs to be flushed so that the +compressed data will be complete. + +Custom [Transform](#stream_class_stream_transform) implementations *may* implement the `transform._flush()` +method. This will be called when there is no more written data to be consumed, +but before the [`'end'`](#stream_event_end) event is emitted signaling the end of the +[Readable](#stream_class_stream_readable) stream. + +Within the `transform._flush()` implementation, the `readable.push()` method +may be called zero or more times, as appropriate. The `callback` function must +be called when the flush operation is complete. + +The `transform._flush()` method is prefixed with an underscore because it is +internal to the class that defines it, and should never be called directly by +user programs. + +#### transform.\_transform(chunk, encoding, callback)[#](#stream_transform_transform_chunk_encoding_callback) + +* `chunk` [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | The chunk to be transformed. Will **always** + be a buffer unless the `decodeStrings` option was set to `false` + or the stream is operating in object mode. +* `encoding` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) If the chunk is a string, then this is the + encoding type. If chunk is a buffer, then this is the special + value - 'buffer', ignore it in this case. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function (optionally with an error + argument and data) to be called after the supplied `chunk` has been + processed. + +This function MUST NOT be called by application code directly. It should be +implemented by child classes, and called by the internal Readable class methods +only. + +All Transform stream implementations must provide a `_transform()` +method to accept input and produce output. The `transform._transform()` +implementation handles the bytes being written, computes an output, then passes +that output off to the readable portion using the `readable.push()` method. + +The `transform.push()` method may be called zero or more times to generate +output from a single input chunk, depending on how much is to be output +as a result of the chunk. + +It is possible that no output is generated from any given chunk of input data. + +The `callback` function must be called only when the current chunk is completely +consumed. The first argument passed to the `callback` must be an `Error` object +if an error occurred while processing the input or `null` otherwise. If a second +argument is passed to the `callback`, it will be forwarded on to the +`readable.push()` method. In other words the following are equivalent: + +```None +transform.prototype._transform = function(data, encoding, callback) { + this.push(data); + callback(); +}; + +transform.prototype._transform = function(data, encoding, callback) { + callback(null, data); +}; +``` + +The `transform._transform()` method is prefixed with an underscore because it +is internal to the class that defines it, and should never be called directly by +user programs. + +`transform._transform()` is never called in parallel; streams implement a +queue mechanism, and to receive the next chunk, `callback` must be +called, either synchronously or asynchronously. + +#### Class: stream.PassThrough[#](#stream_class_stream_passthrough) + +The `stream.PassThrough` class is a trivial implementation of a [Transform](#stream_class_stream_transform) +stream that simply passes the input bytes across to the output. Its purpose is +primarily for examples and testing, but there are some use cases where +`stream.PassThrough` is useful as a building block for novel sorts of streams. + +## Additional Notes[#](#stream_additional_notes) + +### Compatibility with Older Node.js Versions[#](#stream_compatibility_with_older_node_js_versions) + +In versions of Node.js prior to v0.10, the Readable stream interface was +simpler, but also less powerful and less useful. + +* Rather than waiting for calls the [`stream.read()`](#stream_readable_read_size) method, + [`'data'`](#stream_event_data) events would begin emitting immediately. Applications that + would need to perform some amount of work to decide how to handle data + were required to store read data into buffers so the data would not be lost. +* The [`stream.pause()`](#stream_readable_pause) method was advisory, rather than + guaranteed. This meant that it was still necessary to be prepared to receive + [`'data'`](#stream_event_data) events *even when the stream was in a paused state*. + +In Node.js v0.10, the [Readable](#stream_class_stream_readable) class was added. For backwards compatibility +with older Node.js programs, Readable streams switch into "flowing mode" when a +[`'data'`](#stream_event_data) event handler is added, or when the +[`stream.resume()`](#stream_readable_resume) method is called. The effect is that, even +when not using the new [`stream.read()`](#stream_readable_read_size) method and +[`'readable'`](#stream_event_readable) event, it is no longer necessary to worry about losing +[`'data'`](#stream_event_data) chunks. + +While most applications will continue to function normally, this introduces an +edge case in the following conditions: + +* No [`'data'`](#stream_event_data) event listener is added. +* The [`stream.resume()`](#stream_readable_resume) method is never called. +* The stream is not piped to any writable destination. + +For example, consider the following code: + +```None +// WARNING! BROKEN! +net.createServer((socket) => { + + // we add an 'end' method, but never consume the data + socket.on('end', () => { + // It will never get here. + socket.end('The message was received but was not processed.\n'); + }); + +}).listen(1337); +``` + +In versions of Node.js prior to v0.10, the incoming message data would be +simply discarded. However, in Node.js v0.10 and beyond, the socket remains +paused forever. + +The workaround in this situation is to call the +[`stream.resume()`](#stream_readable_resume) method to begin the flow of data: + +```None +// Workaround +net.createServer((socket) => { + + socket.on('end', () => { + socket.end('The message was received but was not processed.\n'); + }); + + // start the flow of data, discarding it. + socket.resume(); + +}).listen(1337); +``` + +In addition to new Readable streams switching into flowing mode, +pre-v0.10 style streams can be wrapped in a Readable class using the +[`readable.wrap()`](#stream_readable_wrap_stream) method. + +### `readable.read(0)`[#](#stream_readable_read_0) + +There are some cases where it is necessary to trigger a refresh of the +underlying readable stream mechanisms, without actually consuming any +data. In such cases, it is possible to call `readable.read(0)`, which will +always return `null`. + +If the internal read buffer is below the `highWaterMark`, and the +stream is not currently reading, then calling `stream.read(0)` will trigger +a low-level [`stream._read()`](#stream_readable_read_size_1) call. + +While most applications will almost never need to do this, there are +situations within Node.js where this is done, particularly in the +Readable stream class internals. + +### `readable.push('')`[#](#stream_readable_push) + +Use of `readable.push('')` is not recommended. + +Pushing a zero-byte string, `Buffer` or `Uint8Array` to a stream that is not in +object mode has an interesting side effect. Because it *is* a call to +[`readable.push()`](#stream_readable_push_chunk_encoding), the call will end the reading process. +However, because the argument is an empty string, no data is added to the +readable buffer so there is nothing for a user to consume. + +### `highWaterMark` discrepancy after calling `readable.setEncoding()`[#](#stream_highwatermark_discrepancy_after_calling_readable_setencoding) + +The use of `readable.setEncoding()` will change the behavior of how the +`highWaterMark` operates in non-object mode. + +Typically, the size of the current buffer is measured against the +`highWaterMark` in *bytes*. However, after `setEncoding()` is called, the +comparison function will begin to measure the buffer's size in *characters*. + +This is not a problem in common cases with `latin1` or `ascii`. But it is +advised to be mindful about this behavior when working with strings that could +contain multi-byte characters. diff --git a/corpus/docs/nodejs/tls/tls_010x.md b/corpus/docs/nodejs/tls/tls_010x.md new file mode 100644 index 0000000000000000000000000000000000000000..80edf60ef855fbf56f0512f9ed592d858ee55085 --- /dev/null +++ b/corpus/docs/nodejs/tls/tls_010x.md @@ -0,0 +1,579 @@ +# TLS (SSL)# + +Source: https://nodejs.org/docs/latest-v0.10.x/api/tls.html +Version: 0.10.x + +```None +Stability: 3 - Stable +``` + +Use `require('tls')` to access this module. + +The `tls` module uses OpenSSL to provide Transport Layer Security and/or +Secure Socket Layer: encrypted stream communication. + +TLS/SSL is a public/private key infrastructure. Each client and each +server must have a private key. A private key is created like this: + +```None +openssl genrsa -out ryans-key.pem 2048 +``` + +All servers and some clients need to have a certificate. Certificates are public +keys signed by a Certificate Authority or self-signed. The first step to +getting a certificate is to create a "Certificate Signing Request" (CSR) +file. This is done with: + +```None +openssl req -new -sha256 -key ryans-key.pem -out ryans-csr.pem +``` + +To create a self-signed certificate with the CSR, do this: + +```None +openssl x509 -req -in ryans-csr.pem -signkey ryans-key.pem -out ryans-cert.pem +``` + +Alternatively you can send the CSR to a Certificate Authority for signing. + +(TODO: docs on creating a CA, for now interested users should just look at +`test/fixtures/keys/Makefile` in the Node source code) + +To create .pfx or .p12, do this: + +```None +openssl pkcs12 -export -in agent5-cert.pem -inkey agent5-key.pem \ + -certfile ca-cert.pem -out agent5.pfx +``` + +* `in`: certificate +* `inkey`: private key +* `certfile`: all CA certs concatenated in one file like + `cat ca1-cert.pem ca2-cert.pem > ca-cert.pem` + +## Protocol support[#](#tls_protocol_support) + +Node.js is compiled with SSLv3 protocol support by default, but these +protocols are **disabled**. They are considered insecure and could be easily +compromised as was shown by [CVE-2014-3566](https://access.redhat.com/articles/1232123). However, in some situations, it +may cause problems with legacy clients/servers (such as Internet Explorer 6). +If you wish to enable SSLv3, run node with the `--enable-ssl3` flag. In future +versions of Node.js SSLv3 will not be compiled in by default. + +There is a way to force node into using SSLv3 only mode by explicitly +specifying `secureProtocol` to `'SSLv3_method'`. + +The default protocol method Node.js uses is `SSLv23_method` which would be more +accurately named `AutoNegotiate_method`. This method will try and negotiate +from the highest level down to whatever the client supports. To provide a +secure default, Node.js (since v0.10.33) explicitly disables the use of SSLv3 +by setting the `secureOptions` to be `SSL_OP_NO_SSLv3` (again, unless you have +passed `--enable-ssl3`, or `SSLv3_method` as `secureProtocol`). + +If you have set `secureOptions` to anything, we will not override your +options. + +The ramifications of this behavior change: + +* If your application is behaving as a secure server, clients who are `SSLv3` + only will now not be able to appropriately negotiate a connection and will be + refused. In this case your server will emit a `clientError` event. The error + message will include `'wrong version number'`. +* If your application is behaving as a secure client and communicating with a + server that doesn't support methods more secure than SSLv3 then your connection + won't be able to negotiate and will fail. In this case your client will emit a + an `error` event. The error message will include `'wrong version number'`. + +## Client-initiated renegotiation attack mitigation[#](#tls_client_initiated_renegotiation_attack_mitigation) + +The TLS protocol lets the client renegotiate certain aspects of the TLS session. +Unfortunately, session renegotiation requires a disproportional amount of +server-side resources, which makes it a potential vector for denial-of-service +attacks. + +To mitigate this, renegotiations are limited to three times every 10 minutes. An +error is emitted on the [CleartextStream](#tls_class_tls_cleartextstream) instance when the threshold is +exceeded. The limits are configurable: + +* `tls.CLIENT_RENEG_LIMIT`: renegotiation limit, default is 3. +* `tls.CLIENT_RENEG_WINDOW`: renegotiation window in seconds, default is + 10 minutes. + +Don't change the defaults unless you know what you are doing. + +To test your server, connect to it with `openssl s_client -connect address:port` +and tap `R` (that's the letter `R` followed by a carriage return) a few +times. + +## NPN and SNI[#](#tls_npn_and_sni) + +NPN (Next Protocol Negotiation) and SNI (Server Name Indication) are TLS +handshake extensions allowing you: + +* NPN - to use one TLS server for multiple protocols (HTTP, SPDY) +* SNI - to use one TLS server for multiple hostnames with different SSL + certificates. + +## tls.getCiphers()[#](#tls_tls_getciphers) + +Returns an array with the names of the supported SSL ciphers. + +Example: + +```None +var ciphers = tls.getCiphers(); +console.log(ciphers); // ['AES128-SHA', 'AES256-SHA', ...] +``` + +## tls.createServer(options, [secureConnectionListener])[#](#tls_tls_createserver_options_secureconnectionlistener) + +Creates a new [tls.Server](#tls_class_tls_server). The `connectionListener` argument is +automatically set as a listener for the [secureConnection](#tls_event_secureconnection) event. The +`options` object has these possibilities: + +* `pfx`: A string or `Buffer` containing the private key, certificate and + CA certs of the server in PFX or PKCS12 format. (Mutually exclusive with + the `key`, `cert` and `ca` options.) +* `key`: A string or `Buffer` containing the private key of the server in + PEM format. (Required) +* `passphrase`: A string of passphrase for the private key or pfx. +* `cert`: A string or `Buffer` containing the certificate key of the server in + PEM format. (Required) +* `ca`: An array of strings or `Buffer`s of trusted certificates in PEM + format. If this is omitted several well known "root" CAs will be used, + like VeriSign. These are used to authorize connections. +* `crl` : Either a string or list of strings of PEM encoded CRLs (Certificate + Revocation List) +* `ciphers`: A string describing the ciphers to use or exclude. + + To mitigate [BEAST attacks](http://blog.ivanristic.com/2011/10/mitigating-the-beast-attack-on-tls.html) it is recommended that you use this option in + conjunction with the `honorCipherOrder` option described below to + prioritize the non-CBC cipher. + + Defaults to `AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH`. + Consult the [OpenSSL cipher list format documentation](http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT) for details on the + format. ECDH (Elliptic Curve Diffie-Hellman) ciphers are not yet supported. + +```None +`AES128-GCM-SHA256` is used when node.js is linked against OpenSSL 1.0.1 +or newer and the client speaks TLS 1.2, RC4 is used as a secure fallback. + +**NOTE**: Previous revisions of this section suggested `AES256-SHA` as an +acceptable cipher. Unfortunately, `AES256-SHA` is a CBC cipher and therefore +susceptible to BEAST attacks. Do *not* use it. +``` + +* `handshakeTimeout`: Abort the connection if the SSL/TLS handshake does not + finish in this many milliseconds. The default is 120 seconds. + + A `'clientError'` is emitted on the `tls.Server` object whenever a handshake + times out. +* `honorCipherOrder` : When choosing a cipher, use the server's preferences + instead of the client preferences. + + Although, this option is disabled by default, it is *recommended* that you + use this option in conjunction with the `ciphers` option to mitigate + BEAST attacks. +* `requestCert`: If `true` the server will request a certificate from + clients that connect and attempt to verify that certificate. Default: + `false`. +* `rejectUnauthorized`: If `true` the server will reject any connection + which is not authorized with the list of supplied CAs. This option only + has an effect if `requestCert` is `true`. Default: `false`. +* `NPNProtocols`: An array or `Buffer` of possible NPN protocols. (Protocols + should be ordered by their priority). +* `SNICallback`: A function that will be called if client supports SNI TLS + extension. Only one argument will be passed to it: `servername`. And + `SNICallback` should return SecureContext instance. + (You can use `crypto.createCredentials(...).context` to get proper + SecureContext). If `SNICallback` wasn't provided - default callback with + high-level API will be used (see below). +* `sessionIdContext`: A string containing an opaque identifier for session + resumption. If `requestCert` is `true`, the default is MD5 hash value + generated from command-line. Otherwise, the default is not provided. +* `secureProtocol`: The SSL method to use, e.g. `SSLv3_method` to force + SSL version 3. The possible values depend on your installation of + OpenSSL and are defined in the constant [SSL\_METHODS](http://www.openssl.org/docs/ssl/ssl.html#DEALING_WITH_PROTOCOL_METHODS). +* `secureOptions`: Set server options. For example, to disable the SSLv3 + protocol set the `SSL_OP_NO_SSLv3` flag. See [SSL\_CTX\_set\_options](https://www.openssl.org/docs/ssl/SSL_CTX_set_options.html) + for all available options. + +Here is a simple example echo server: + +```None +var tls = require('tls'); +var fs = require('fs'); + +var options = { + key: fs.readFileSync('server-key.pem'), + cert: fs.readFileSync('server-cert.pem'), + + // This is necessary only if using the client certificate authentication. + requestCert: true, + + // This is necessary only if the client uses the self-signed certificate. + ca: [ fs.readFileSync('client-cert.pem') ] +}; + +var server = tls.createServer(options, function(cleartextStream) { + console.log('server connected', + cleartextStream.authorized ? 'authorized' : 'unauthorized'); + cleartextStream.write("welcome!\n"); + cleartextStream.setEncoding('utf8'); + cleartextStream.pipe(cleartextStream); +}); +server.listen(8000, function() { + console.log('server bound'); +}); +``` + +Or + +```None +var tls = require('tls'); +var fs = require('fs'); + +var options = { + pfx: fs.readFileSync('server.pfx'), + + // This is necessary only if using the client certificate authentication. + requestCert: true, + +}; + +var server = tls.createServer(options, function(cleartextStream) { + console.log('server connected', + cleartextStream.authorized ? 'authorized' : 'unauthorized'); + cleartextStream.write("welcome!\n"); + cleartextStream.setEncoding('utf8'); + cleartextStream.pipe(cleartextStream); +}); +server.listen(8000, function() { + console.log('server bound'); +}); +``` + +You can test this server by connecting to it with `openssl s_client`: + +```None +openssl s_client -connect 127.0.0.1:8000 +``` + +## tls.SLAB\_BUFFER\_SIZE[#](#tls_tls_slab_buffer_size) + +Size of slab buffer used by all tls servers and clients. +Default: `10 * 1024 * 1024`. + +Don't change the defaults unless you know what you are doing. + +## tls.connect(options, [callback])[#](#tls_tls_connect_options_callback) + +## tls.connect(port, [host], [options], [callback])[#](#tls_tls_connect_port_host_options_callback) + +Creates a new client connection to the given `port` and `host` (old API) or +`options.port` and `options.host`. (If `host` is omitted, it defaults to +`localhost`.) `options` should be an object which specifies: + +* `host`: Host the client should connect to +* `port`: Port the client should connect to +* `socket`: Establish secure connection on a given socket rather than + creating a new socket. If this option is specified, `host` and `port` + are ignored. +* `pfx`: A string or `Buffer` containing the private key, certificate and + CA certs of the client in PFX or PKCS12 format. +* `key`: A string or `Buffer` containing the private key of the client in + PEM format. +* `passphrase`: A string of passphrase for the private key or pfx. +* `cert`: A string or `Buffer` containing the certificate key of the client in + PEM format. +* `ca`: An array of strings or `Buffer`s of trusted certificates in PEM + format. If this is omitted several well known "root" CAs will be used, + like VeriSign. These are used to authorize connections. +* `rejectUnauthorized`: If `true`, the server certificate is verified against + the list of supplied CAs. An `'error'` event is emitted if verification + fails. Default: `true`. +* `NPNProtocols`: An array of strings or `Buffer`s containing supported NPN + protocols. `Buffer`s should have following format: `0x05hello0x05world`, + where first byte is next protocol name's length. (Passing array should + usually be much simpler: `['hello', 'world']`.) +* `servername`: Servername for SNI (Server Name Indication) TLS extension. +* `secureProtocol`: The SSL method to use, e.g. `SSLv3_method` to force + SSL version 3. The possible values depend on your installation of + OpenSSL and are defined in the constant [SSL\_METHODS](http://www.openssl.org/docs/ssl/ssl.html#DEALING_WITH_PROTOCOL_METHODS). + +The `callback` parameter will be added as a listener for the +['secureConnect'](#tls_event_secureconnect) event. + +`tls.connect()` returns a [CleartextStream](#tls_class_tls_cleartextstream) object. + +Here is an example of a client of echo server as described previously: + +```None +var tls = require('tls'); +var fs = require('fs'); + +var options = { + // These are necessary only if using the client certificate authentication + key: fs.readFileSync('client-key.pem'), + cert: fs.readFileSync('client-cert.pem'), + + // This is necessary only if the server uses the self-signed certificate + ca: [ fs.readFileSync('server-cert.pem') ] +}; + +var cleartextStream = tls.connect(8000, options, function() { + console.log('client connected', + cleartextStream.authorized ? 'authorized' : 'unauthorized'); + process.stdin.pipe(cleartextStream); + process.stdin.resume(); +}); +cleartextStream.setEncoding('utf8'); +cleartextStream.on('data', function(data) { + console.log(data); +}); +cleartextStream.on('end', function() { + server.close(); +}); +``` + +Or + +```None +var tls = require('tls'); +var fs = require('fs'); + +var options = { + pfx: fs.readFileSync('client.pfx') +}; + +var cleartextStream = tls.connect(8000, options, function() { + console.log('client connected', + cleartextStream.authorized ? 'authorized' : 'unauthorized'); + process.stdin.pipe(cleartextStream); + process.stdin.resume(); +}); +cleartextStream.setEncoding('utf8'); +cleartextStream.on('data', function(data) { + console.log(data); +}); +cleartextStream.on('end', function() { + server.close(); +}); +``` + +## tls.createSecurePair([credentials], [isServer], [requestCert], [rejectUnauthorized])[#](#tls_tls_createsecurepair_credentials_isserver_requestcert_rejectunauthorized) + +Creates a new secure pair object with two streams, one of which reads/writes +encrypted data, and one reads/writes cleartext data. +Generally the encrypted one is piped to/from an incoming encrypted data stream, +and the cleartext one is used as a replacement for the initial encrypted stream. + +* `credentials`: A credentials object from crypto.createCredentials( ... ) +* `isServer`: A boolean indicating whether this tls connection should be + opened as a server or a client. +* `requestCert`: A boolean indicating whether a server should request a + certificate from a connecting client. Only applies to server connections. +* `rejectUnauthorized`: A boolean indicating whether a server should + automatically reject clients with invalid certificates. Only applies to + servers with `requestCert` enabled. + +`tls.createSecurePair()` returns a SecurePair object with [cleartext][] and +`encrypted` stream properties. + +## Class: SecurePair[#](#tls_class_securepair) + +Returned by tls.createSecurePair. + +### Event: 'secure'[#](#tls_event_secure) + +The event is emitted from the SecurePair once the pair has successfully +established a secure connection. + +Similarly to the checking for the server 'secureConnection' event, +pair.cleartext.authorized should be checked to confirm whether the certificate +used properly authorized. + +## Class: tls.Server[#](#tls_class_tls_server) + +This class is a subclass of `net.Server` and has the same methods on it. +Instead of accepting just raw TCP connections, this accepts encrypted +connections using TLS or SSL. + +### Event: 'secureConnection'[#](#tls_event_secureconnection) + +`function (cleartextStream) {}` + +This event is emitted after a new connection has been successfully +handshaked. The argument is an instance of [CleartextStream](#tls_class_tls_cleartextstream). It has all the +common stream methods and events. + +`cleartextStream.authorized` is a boolean value which indicates if the +client has verified by one of the supplied certificate authorities for the +server. If `cleartextStream.authorized` is false, then +`cleartextStream.authorizationError` is set to describe how authorization +failed. Implied but worth mentioning: depending on the settings of the TLS +server, you unauthorized connections may be accepted. +`cleartextStream.npnProtocol` is a string containing selected NPN protocol. +`cleartextStream.servername` is a string containing servername requested with +SNI. + +### Event: 'clientError'[#](#tls_event_clienterror) + +`function (exception, securePair) { }` + +When a client connection emits an 'error' event before secure connection is +established - it will be forwarded here. + +`securePair` is the `tls.SecurePair` that the error originated from. + +### Event: 'newSession'[#](#tls_event_newsession) + +`function (sessionId, sessionData) { }` + +Emitted on creation of TLS session. May be used to store sessions in external +storage. + +### Event: 'resumeSession'[#](#tls_event_resumesession) + +`function (sessionId, callback) { }` + +Emitted when client wants to resume previous TLS session. Event listener may +perform lookup in external storage using given `sessionId`, and invoke +`callback(null, sessionData)` once finished. If session can't be resumed +(i.e. doesn't exist in storage) one may call `callback(null, null)`. Calling +`callback(err)` will terminate incoming connection and destroy socket. + +### server.listen(port, [host], [callback])[#](#tls_server_listen_port_host_callback) + +Begin accepting connections on the specified `port` and `host`. If the +`host` is omitted, the server will accept connections directed to any +IPv4 address (`INADDR_ANY`). + +This function is asynchronous. The last parameter `callback` will be called +when the server has been bound. + +See `net.Server` for more information. + +### server.close()[#](#tls_server_close) + +Stops the server from accepting new connections. This function is +asynchronous, the server is finally closed when the server emits a `'close'` +event. + +### server.address()[#](#tls_server_address) + +Returns the bound address, the address family name and port of the +server as reported by the operating system. See [net.Server.address()](net.html#net_server_address) for +more information. + +### server.addContext(hostname, credentials)[#](#tls_server_addcontext_hostname_credentials) + +Add secure context that will be used if client request's SNI hostname is +matching passed `hostname` (wildcards can be used). `credentials` can contain +`key`, `cert` and `ca`. + +### server.maxConnections[#](#tls_server_maxconnections) + +Set this property to reject connections when the server's connection count +gets high. + +### server.connections[#](#tls_server_connections) + +The number of concurrent connections on the server. + +## Class: CryptoStream[#](#tls_class_cryptostream) + +This is an encrypted stream. + +### cryptoStream.bytesWritten[#](#tls_cryptostream_byteswritten) + +A proxy to the underlying socket's bytesWritten accessor, this will return +the total bytes written to the socket, *including the TLS overhead*. + +## Class: tls.CleartextStream[#](#tls_class_tls_cleartextstream) + +This is a stream on top of the *Encrypted* stream that makes it possible to +read/write an encrypted data as a cleartext data. + +This instance implements a duplex [Stream](stream.html#stream_stream) interfaces. It has all the +common stream methods and events. + +A ClearTextStream is the `clear` member of a SecurePair object. + +### Event: 'secureConnect'[#](#tls_event_secureconnect) + +This event is emitted after a new connection has been successfully handshaked. +The listener will be called no matter if the server's certificate was +authorized or not. It is up to the user to test `cleartextStream.authorized` +to see if the server certificate was signed by one of the specified CAs. +If `cleartextStream.authorized === false` then the error can be found in +`cleartextStream.authorizationError`. Also if NPN was used - you can check +`cleartextStream.npnProtocol` for negotiated protocol. + +### cleartextStream.authorized[#](#tls_cleartextstream_authorized) + +A boolean that is `true` if the peer certificate was signed by one of the +specified CAs, otherwise `false` + +### cleartextStream.authorizationError[#](#tls_cleartextstream_authorizationerror) + +The reason why the peer's certificate has not been verified. This property +becomes available only when `cleartextStream.authorized === false`. + +### cleartextStream.getPeerCertificate()[#](#tls_cleartextstream_getpeercertificate) + +Returns an object representing the peer's certificate. The returned object has +some properties corresponding to the field of the certificate. + +Example: + +```None +{ subject: + { C: 'UK', + ST: 'Acknack Ltd', + L: 'Rhys Jones', + O: 'node.js', + OU: 'Test TLS Certificate', + CN: 'localhost' }, + issuer: + { C: 'UK', + ST: 'Acknack Ltd', + L: 'Rhys Jones', + O: 'node.js', + OU: 'Test TLS Certificate', + CN: 'localhost' }, + valid_from: 'Nov 11 09:52:22 2009 GMT', + valid_to: 'Nov 6 09:52:22 2029 GMT', + fingerprint: '2A:7A:C2:DD:E5:F9:CC:53:72:35:99:7A:02:5A:71:38:52:EC:8A:DF' } +``` + +If the peer does not provide a certificate, it returns `null` or an empty +object. + +### cleartextStream.getCipher()[#](#tls_cleartextstream_getcipher) + +Returns an object representing the cipher name and the SSL/TLS +protocol version of the current connection. + +Example: +{ name: 'AES256-SHA', version: 'TLSv1/SSLv3' } + +See SSL\_CIPHER\_get\_name() and SSL\_CIPHER\_get\_version() in + for more +information. + +### cleartextStream.address()[#](#tls_cleartextstream_address) + +Returns the bound address, the address family name and port of the +underlying socket as reported by the operating system. Returns an +object with three properties, e.g. +`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` + +### cleartextStream.remoteAddress[#](#tls_cleartextstream_remoteaddress) + +The string representation of the remote IP address. For example, +`'74.125.127.100'` or `'2001:4860:a005::68'`. + +### cleartextStream.remotePort[#](#tls_cleartextstream_remoteport) + +The numeric representation of the remote port. For example, `443`. diff --git a/corpus/docs/nodejs/tls/tls_012x.md b/corpus/docs/nodejs/tls/tls_012x.md new file mode 100644 index 0000000000000000000000000000000000000000..f2c69ce77fe30b95210a83440bde634f31972486 --- /dev/null +++ b/corpus/docs/nodejs/tls/tls_012x.md @@ -0,0 +1,818 @@ +# TLS (SSL)# + +Source: https://nodejs.org/docs/latest-v0.12.x/api/tls.html +Version: 0.12.x + +```None +Stability: 3 - Stable +``` + +Use `require('tls')` to access this module. + +The `tls` module uses OpenSSL to provide Transport Layer Security and/or +Secure Socket Layer: encrypted stream communication. + +TLS/SSL is a public/private key infrastructure. Each client and each +server must have a private key. A private key is created like this: + +```None +openssl genrsa -out ryans-key.pem 2048 +``` + +All servers and some clients need to have a certificate. Certificates are public +keys signed by a Certificate Authority or self-signed. The first step to +getting a certificate is to create a "Certificate Signing Request" (CSR) +file. This is done with: + +```None +openssl req -new -sha256 -key ryans-key.pem -out ryans-csr.pem +``` + +To create a self-signed certificate with the CSR, do this: + +```None +openssl x509 -req -in ryans-csr.pem -signkey ryans-key.pem -out ryans-cert.pem +``` + +Alternatively you can send the CSR to a Certificate Authority for signing. + +(TODO: docs on creating a CA, for now interested users should just look at +`test/fixtures/keys/Makefile` in the Node source code) + +To create .pfx or .p12, do this: + +```None +openssl pkcs12 -export -in agent5-cert.pem -inkey agent5-key.pem \ + -certfile ca-cert.pem -out agent5.pfx +``` + +* `in`: certificate +* `inkey`: private key +* `certfile`: all CA certs concatenated in one file like + `cat ca1-cert.pem ca2-cert.pem > ca-cert.pem` + +## Protocol support[#](#tls_protocol_support) + +Node.js is compiled with SSLv3 protocol support by default, but these +protocols are **disabled**. They are considered insecure and could be easily +compromised as was shown by [CVE-2014-3566](https://access.redhat.com/articles/1232123). However, in some situations, it +may cause problems with legacy clients/servers (such as Internet Explorer 6). +If you wish to enable SSLv3, run node with the `--enable-ssl3` flag. In future +versions of Node.js SSLv3 will not be compiled in by default. + +There is a way to force node into using SSLv3 only mode by explicitly +specifying `secureProtocol` to `'SSLv3_method'`. + +The default protocol method Node.js uses is `SSLv23_method` which would be more +accurately named `AutoNegotiate_method`. This method will try and negotiate +from the highest level down to whatever the client supports. To provide a +secure default, Node.js (since v0.10.33) explicitly disables the use of SSLv3 +by setting the `secureOptions` to be `SSL_OP_NO_SSLv3` (again, unless you have +passed `--enable-ssl3`, or `SSLv3_method` as `secureProtocol`). + +If you have set `secureOptions` to anything, we will not override your +options. + +The ramifications of this behavior change: + +* If your application is behaving as a secure server, clients who are `SSLv3` + only will now not be able to appropriately negotiate a connection and will be + refused. In this case your server will emit a `clientError` event. The error + message will include `'wrong version number'`. +* If your application is behaving as a secure client and communicating with a + server that doesn't support methods more secure than SSLv3 then your connection + won't be able to negotiate and will fail. In this case your client will emit a + an `error` event. The error message will include `'wrong version number'`. + +## Client-initiated renegotiation attack mitigation[#](#tls_client_initiated_renegotiation_attack_mitigation) + +The TLS protocol lets the client renegotiate certain aspects of the TLS session. +Unfortunately, session renegotiation requires a disproportional amount of +server-side resources, which makes it a potential vector for denial-of-service +attacks. + +To mitigate this, renegotiations are limited to three times every 10 minutes. An +error is emitted on the [tls.TLSSocket](#tls_class_tls_tlssocket) instance when the threshold is +exceeded. The limits are configurable: + +* `tls.CLIENT_RENEG_LIMIT`: renegotiation limit, default is 3. +* `tls.CLIENT_RENEG_WINDOW`: renegotiation window in seconds, default is + 10 minutes. + +Don't change the defaults unless you know what you are doing. + +To test your server, connect to it with `openssl s_client -connect address:port` +and tap `R` (that's the letter `R` followed by a carriage return) a few +times. + +## NPN and SNI[#](#tls_npn_and_sni) + +NPN (Next Protocol Negotiation) and SNI (Server Name Indication) are TLS +handshake extensions allowing you: + +* NPN - to use one TLS server for multiple protocols (HTTP, SPDY) +* SNI - to use one TLS server for multiple hostnames with different SSL + certificates. + +## Perfect Forward Secrecy[#](#tls_perfect_forward_secrecy) + +The term "[Forward Secrecy](http://en.wikipedia.org/wiki/Perfect_forward_secrecy)" or "Perfect Forward Secrecy" describes a feature of +key-agreement (i.e. key-exchange) methods. Practically it means that even if the +private key of a (your) server is compromised, communication can only be +decrypted by eavesdroppers if they manage to obtain the key-pair specifically +generated for each session. + +This is achieved by randomly generating a key pair for key-agreement on every +handshake (in contrary to the same key for all sessions). Methods implementing +this technique, thus offering Perfect Forward Secrecy, are called "ephemeral". + +Currently two methods are commonly used to achieve Perfect Forward Secrecy (note +the character "E" appended to the traditional abbreviations): + +* [DHE](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange) - An ephemeral version of the Diffie Hellman key-agreement protocol. +* [ECDHE](https://en.wikipedia.org/wiki/Elliptic_curve_Diffie%E2%80%93Hellman) - An ephemeral version of the Elliptic Curve Diffie Hellman + key-agreement protocol. + +Ephemeral methods may have some performance drawbacks, because key generation +is expensive. + +## tls.getCiphers()[#](#tls_tls_getciphers) + +Returns an array with the names of the supported SSL ciphers. + +Example: + +```None +var ciphers = tls.getCiphers(); +console.log(ciphers); // ['AES128-SHA', 'AES256-SHA', ...] +``` + +## tls.createServer(options[, secureConnectionListener])[#](#tls_tls_createserver_options_secureconnectionlistener) + +Creates a new [tls.Server](#tls_class_tls_server). The `connectionListener` argument is +automatically set as a listener for the [secureConnection](#tls_event_secureconnection) event. The +`options` object has these possibilities: + +* `pfx`: A string or `Buffer` containing the private key, certificate and + CA certs of the server in PFX or PKCS12 format. (Mutually exclusive with + the `key`, `cert` and `ca` options.) +* `key`: A string or `Buffer` containing the private key of the server in + PEM format. (Could be an array of keys). (Required) +* `passphrase`: A string of passphrase for the private key or pfx. +* `cert`: A string or `Buffer` containing the certificate key of the server in + PEM format. (Could be an array of certs). (Required) +* `ca`: An array of strings or `Buffer`s of trusted certificates in PEM + format. If this is omitted several well known "root" CAs will be used, + like VeriSign. These are used to authorize connections. +* `crl` : Either a string or list of strings of PEM encoded CRLs (Certificate + Revocation List) +* `ciphers`: A string describing the ciphers to use or exclude. + + To mitigate [BEAST attacks](http://blog.ivanristic.com/2011/10/mitigating-the-beast-attack-on-tls.html) it is recommended that you use this option in + conjunction with the `honorCipherOrder` option described below to + prioritize the non-CBC cipher. + + Defaults to + `ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL`. + Consult the [OpenSSL cipher list format documentation](http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT) for details + on the format. + + `ECDHE-RSA-AES128-SHA256`, `DHE-RSA-AES128-SHA256` and + `AES128-GCM-SHA256` are TLS v1.2 ciphers and used when Node.js is + linked against OpenSSL 1.0.1 or newer, such as the bundled version + of OpenSSL. Note that it is still possible for a TLS v1.2 client + to negotiate a weaker cipher unless `honorCipherOrder` is enabled. + + `RC4` is used as a fallback for clients that speak on older version of + the TLS protocol. `RC4` has in recent years come under suspicion and + should be considered compromised for anything that is truly sensitive. + It is speculated that state-level actors possess the ability to break it. + + **NOTE**: Previous revisions of this section suggested `AES256-SHA` as an + acceptable cipher. Unfortunately, `AES256-SHA` is a CBC cipher and therefore + susceptible to [BEAST attacks](http://blog.ivanristic.com/2011/10/mitigating-the-beast-attack-on-tls.html). Do *not* use it. +* `ecdhCurve`: A string describing a named curve to use for ECDH key agreement + or false to disable ECDH. + + Defaults to `prime256v1`. Consult [RFC 4492](http://www.rfc-editor.org/rfc/rfc4492.txt) for more details. +* `dhparam`: DH parameter file to use for DHE key agreement. Use + `openssl dhparam` command to create it. If the file is invalid to + load, it is silently discarded. Its key length should be greater + than or equal to 768 bits, otherwise an error will be thrown. +* `handshakeTimeout`: Abort the connection if the SSL/TLS handshake does not + finish in this many milliseconds. The default is 120 seconds. + + A `'clientError'` is emitted on the `tls.Server` object whenever a handshake + times out. +* `honorCipherOrder` : When choosing a cipher, use the server's preferences + instead of the client preferences. + + Although, this option is disabled by default, it is *recommended* that you + use this option in conjunction with the `ciphers` option to mitigate + BEAST attacks. + + Note: If SSLv2 is used, the server will send its list of preferences to the + client, and the client chooses the cipher. Support for SSLv2 is disabled + unless node.js was configured with `./configure --with-sslv2`. +* `requestCert`: If `true` the server will request a certificate from + clients that connect and attempt to verify that certificate. Default: + `false`. +* `rejectUnauthorized`: If `true` the server will reject any connection + which is not authorized with the list of supplied CAs. This option only + has an effect if `requestCert` is `true`. Default: `false`. +* `checkServerIdentity(servername, cert)`: Provide an override for checking + server's hostname against the certificate. Should return an error if verification + fails. Return `undefined` if passing. +* `NPNProtocols`: An array or `Buffer` of possible NPN protocols. (Protocols + should be ordered by their priority). +* `SNICallback(servername, cb)`: A function that will be called if client + supports SNI TLS extension. Two argument will be passed to it: `servername`, + and `cb`. `SNICallback` should invoke `cb(null, ctx)`, where `ctx` is a + SecureContext instance. + (You can use `tls.createSecureContext(...)` to get proper + SecureContext). If `SNICallback` wasn't provided - default callback with + high-level API will be used (see below). +* `sessionTimeout`: An integer specifying the seconds after which TLS + session identifiers and TLS session tickets created by the server are + timed out. See [SSL\_CTX\_set\_timeout](http://www.openssl.org/docs/ssl/SSL_CTX_set_timeout.html) for more details. +* `ticketKeys`: A 48-byte `Buffer` instance consisting of 16-byte prefix, + 16-byte hmac key, 16-byte AES key. You could use it to accept tls session + tickets on multiple instances of tls server. + + NOTE: Automatically shared between `cluster` module workers. +* `sessionIdContext`: A string containing an opaque identifier for session + resumption. If `requestCert` is `true`, the default is MD5 hash value + generated from command-line. Otherwise, the default is not provided. +* `secureProtocol`: The SSL method to use, e.g. `SSLv3_method` to force + SSL version 3. The possible values depend on your installation of + OpenSSL and are defined in the constant [SSL\_METHODS](http://www.openssl.org/docs/ssl/ssl.html#DEALING_WITH_PROTOCOL_METHODS). +* `secureOptions`: Set server options. For example, to disable the SSLv3 + protocol set the `SSL_OP_NO_SSLv3` flag. See [SSL\_CTX\_set\_options](https://www.openssl.org/docs/ssl/SSL_CTX_set_options.html) + for all available options. + +Here is a simple example echo server: + +```None +var tls = require('tls'); +var fs = require('fs'); + +var options = { + key: fs.readFileSync('server-key.pem'), + cert: fs.readFileSync('server-cert.pem'), + + // This is necessary only if using the client certificate authentication. + requestCert: true, + + // This is necessary only if the client uses the self-signed certificate. + ca: [ fs.readFileSync('client-cert.pem') ] +}; + +var server = tls.createServer(options, function(socket) { + console.log('server connected', + socket.authorized ? 'authorized' : 'unauthorized'); + socket.write("welcome!\n"); + socket.setEncoding('utf8'); + socket.pipe(socket); +}); +server.listen(8000, function() { + console.log('server bound'); +}); +``` + +Or + +```None +var tls = require('tls'); +var fs = require('fs'); + +var options = { + pfx: fs.readFileSync('server.pfx'), + + // This is necessary only if using the client certificate authentication. + requestCert: true, + +}; + +var server = tls.createServer(options, function(socket) { + console.log('server connected', + socket.authorized ? 'authorized' : 'unauthorized'); + socket.write("welcome!\n"); + socket.setEncoding('utf8'); + socket.pipe(socket); +}); +server.listen(8000, function() { + console.log('server bound'); +}); +``` + +You can test this server by connecting to it with `openssl s_client`: + +```None +openssl s_client -connect 127.0.0.1:8000 +``` + +## tls.connect(options[, callback])[#](#tls_tls_connect_options_callback) + +## tls.connect(port[, host][, options][, callback])[#](#tls_tls_connect_port_host_options_callback) + +Creates a new client connection to the given `port` and `host` (old API) or +`options.port` and `options.host`. (If `host` is omitted, it defaults to +`localhost`.) `options` should be an object which specifies: + +* `host`: Host the client should connect to +* `port`: Port the client should connect to +* `socket`: Establish secure connection on a given socket rather than + creating a new socket. If this option is specified, `host` and `port` + are ignored. +* `path`: Creates unix socket connection to path. If this option is + specified, `host` and `port` are ignored. +* `ciphers`: A string describing the ciphers to use or exclude. + + Defaults to + `ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:AES128-GCM-SHA256:HIGH:!RC4:!MD5:!aNULL`. + Consult the [OpenSSL cipher list format documentation](http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT) for details + on the format. + + The full list of available ciphers can be obtained via [tls.getCiphers](#tls_tls_getciphers). + + `ECDHE-RSA-AES128-SHA256`, `DHE-RSA-AES128-SHA256` and + `AES128-GCM-SHA256` are TLS v1.2 ciphers and used when Node.js is + linked against OpenSSL 1.0.1 or newer, such as the bundled version + of OpenSSL. +* `pfx`: A string or `Buffer` containing the private key, certificate and + CA certs of the client in PFX or PKCS12 format. +* `key`: A string or `Buffer` containing the private key of the client in + PEM format. (Could be an array of keys). +* `passphrase`: A string of passphrase for the private key or pfx. +* `cert`: A string or `Buffer` containing the certificate key of the client in + PEM format. (Could be an array of certs). +* `ca`: An array of strings or `Buffer`s of trusted certificates in PEM + format. If this is omitted several well known "root" CAs will be used, + like VeriSign. These are used to authorize connections. +* `rejectUnauthorized`: If `true`, the server certificate is verified against + the list of supplied CAs. An `'error'` event is emitted if verification + fails; `err.code` contains the OpenSSL error code. Default: `true`. +* `NPNProtocols`: An array of strings or `Buffer`s containing supported NPN + protocols. `Buffer`s should have following format: `0x05hello0x05world`, + where first byte is next protocol name's length. (Passing array should + usually be much simpler: `['hello', 'world']`.) +* `servername`: Servername for SNI (Server Name Indication) TLS extension. +* `secureProtocol`: The SSL method to use, e.g. `SSLv3_method` to force + SSL version 3. The possible values depend on your installation of + OpenSSL and are defined in the constant [SSL\_METHODS](http://www.openssl.org/docs/ssl/ssl.html#DEALING_WITH_PROTOCOL_METHODS). +* `session`: A `Buffer` instance, containing TLS session. + +The `callback` parameter will be added as a listener for the +['secureConnect'](#tls_event_secureconnect) event. + +`tls.connect()` returns a [tls.TLSSocket](#tls_class_tls_tlssocket) object. + +Here is an example of a client of echo server as described previously: + +```None +var tls = require('tls'); +var fs = require('fs'); + +var options = { + // These are necessary only if using the client certificate authentication + key: fs.readFileSync('client-key.pem'), + cert: fs.readFileSync('client-cert.pem'), + + // This is necessary only if the server uses the self-signed certificate + ca: [ fs.readFileSync('server-cert.pem') ] +}; + +var socket = tls.connect(8000, options, function() { + console.log('client connected', + socket.authorized ? 'authorized' : 'unauthorized'); + process.stdin.pipe(socket); + process.stdin.resume(); +}); +socket.setEncoding('utf8'); +socket.on('data', function(data) { + console.log(data); +}); +socket.on('end', function() { + server.close(); +}); +``` + +Or + +```None +var tls = require('tls'); +var fs = require('fs'); + +var options = { + pfx: fs.readFileSync('client.pfx') +}; + +var socket = tls.connect(8000, options, function() { + console.log('client connected', + socket.authorized ? 'authorized' : 'unauthorized'); + process.stdin.pipe(socket); + process.stdin.resume(); +}); +socket.setEncoding('utf8'); +socket.on('data', function(data) { + console.log(data); +}); +socket.on('end', function() { + server.close(); +}); +``` + +## Class: tls.TLSSocket[#](#tls_class_tls_tlssocket) + +Wrapper for instance of [net.Socket](net.html#net_class_net_socket), replaces internal socket read/write +routines to perform transparent encryption/decryption of incoming/outgoing data. + +## new tls.TLSSocket(socket, options)[#](#tls_new_tls_tlssocket_socket_options) + +Construct a new TLSSocket object from existing TCP socket. + +`socket` is an instance of [net.Socket](net.html#net_class_net_socket) + +`options` is an object that might contain following properties: + +* `secureContext`: An optional TLS context object from + `tls.createSecureContext( ... )` +* `isServer`: If true - TLS socket will be instantiated in server-mode +* `server`: An optional [net.Server](net.html#net_class_net_server) instance +* `requestCert`: Optional, see [tls.createSecurePair](#tls_tls_createsecurepair_credentials_isserver_requestcert_rejectunauthorized) +* `rejectUnauthorized`: Optional, see [tls.createSecurePair](#tls_tls_createsecurepair_credentials_isserver_requestcert_rejectunauthorized) +* `NPNProtocols`: Optional, see [tls.createServer](#tls_tls_createserver_options_secureconnectionlistener) +* `SNICallback`: Optional, see [tls.createServer](#tls_tls_createserver_options_secureconnectionlistener) +* `session`: Optional, a `Buffer` instance, containing TLS session +* `requestOCSP`: Optional, if `true` - OCSP status request extension would + be added to client hello, and `OCSPResponse` event will be emitted on socket + before establishing secure communication + +## tls.createSecureContext(details)[#](#tls_tls_createsecurecontext_details) + +Creates a credentials object, with the optional details being a +dictionary with keys: + +* `pfx` : A string or buffer holding the PFX or PKCS12 encoded private + key, certificate and CA certificates +* `key` : A string holding the PEM encoded private key +* `passphrase` : A string of passphrase for the private key or pfx +* `cert` : A string holding the PEM encoded certificate +* `ca` : Either a string or list of strings of PEM encoded CA + certificates to trust. +* `crl` : Either a string or list of strings of PEM encoded CRLs + (Certificate Revocation List) +* `ciphers`: A string describing the ciphers to use or exclude. + Consult + + for details on the format. +* `honorCipherOrder` : When choosing a cipher, use the server's preferences + instead of the client preferences. For further details see `tls` module + documentation. + +If no 'ca' details are given, then node.js will use the default +publicly trusted list of CAs as given in + +. + +## tls.createSecurePair([context][, isServer][, requestCert][, rejectUnauthorized])[#](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized) + +Creates a new secure pair object with two streams, one of which reads/writes +encrypted data, and one reads/writes cleartext data. +Generally the encrypted one is piped to/from an incoming encrypted data stream, +and the cleartext one is used as a replacement for the initial encrypted stream. + +* `credentials`: A secure context object from tls.createSecureContext( ... ) +* `isServer`: A boolean indicating whether this tls connection should be + opened as a server or a client. +* `requestCert`: A boolean indicating whether a server should request a + certificate from a connecting client. Only applies to server connections. +* `rejectUnauthorized`: A boolean indicating whether a server should + automatically reject clients with invalid certificates. Only applies to + servers with `requestCert` enabled. + +`tls.createSecurePair()` returns a SecurePair object with `cleartext` and +`encrypted` stream properties. + +NOTE: `cleartext` has the same APIs as [tls.TLSSocket](#tls_class_tls_tlssocket) + +## Class: SecurePair[#](#tls_class_securepair) + +Returned by tls.createSecurePair. + +### Event: 'secure'[#](#tls_event_secure) + +The event is emitted from the SecurePair once the pair has successfully +established a secure connection. + +Similarly to the checking for the server 'secureConnection' event, +pair.cleartext.authorized should be checked to confirm whether the certificate +used properly authorized. + +## Class: tls.Server[#](#tls_class_tls_server) + +This class is a subclass of `net.Server` and has the same methods on it. +Instead of accepting just raw TCP connections, this accepts encrypted +connections using TLS or SSL. + +### Event: 'secureConnection'[#](#tls_event_secureconnection) + +`function (tlsSocket) {}` + +This event is emitted after a new connection has been successfully +handshaked. The argument is an instance of [tls.TLSSocket](#tls_class_tls_tlssocket). It has all the +common stream methods and events. + +`socket.authorized` is a boolean value which indicates if the +client has verified by one of the supplied certificate authorities for the +server. If `socket.authorized` is false, then +`socket.authorizationError` is set to describe how authorization +failed. Implied but worth mentioning: depending on the settings of the TLS +server, you unauthorized connections may be accepted. +`socket.npnProtocol` is a string containing selected NPN protocol. +`socket.servername` is a string containing servername requested with +SNI. + +### Event: 'clientError'[#](#tls_event_clienterror) + +`function (exception, tlsSocket) { }` + +When a client connection emits an 'error' event before secure connection is +established - it will be forwarded here. + +`tlsSocket` is the [tls.TLSSocket](#tls_class_tls_tlssocket) that the error originated from. + +### Event: 'newSession'[#](#tls_event_newsession) + +`function (sessionId, sessionData, callback) { }` + +Emitted on creation of TLS session. May be used to store sessions in external +storage. `callback` must be invoked eventually, otherwise no data will be +sent or received from secure connection. + +NOTE: adding this event listener will have an effect only on connections +established after addition of event listener. + +### Event: 'resumeSession'[#](#tls_event_resumesession) + +`function (sessionId, callback) { }` + +Emitted when client wants to resume previous TLS session. Event listener may +perform lookup in external storage using given `sessionId`, and invoke +`callback(null, sessionData)` once finished. If session can't be resumed +(i.e. doesn't exist in storage) one may call `callback(null, null)`. Calling +`callback(err)` will terminate incoming connection and destroy socket. + +NOTE: adding this event listener will have an effect only on connections +established after addition of event listener. + +### Event: 'OCSPRequest'[#](#tls_event_ocsprequest) + +`function (certificate, issuer, callback) { }` + +Emitted when the client sends a certificate status request. You could parse +server's current certificate to obtain OCSP url and certificate id, and after +obtaining OCSP response invoke `callback(null, resp)`, where `resp` is a +`Buffer` instance. Both `certificate` and `issuer` are a `Buffer` +DER-representations of the primary and issuer's certificates. They could be used +to obtain OCSP certificate id and OCSP endpoint url. + +Alternatively, `callback(null, null)` could be called, meaning that there is no +OCSP response. + +Calling `callback(err)` will result in a `socket.destroy(err)` call. + +Typical flow: + +1. Client connects to server and sends `OCSPRequest` to it (via status info + extension in ClientHello.) +2. Server receives request and invokes `OCSPRequest` event listener if present +3. Server grabs OCSP url from either `certificate` or `issuer` and performs an + [OCSP request](http://en.wikipedia.org/wiki/OCSP_stapling) to the CA +4. Server receives `OCSPResponse` from CA and sends it back to client via + `callback` argument +5. Client validates the response and either destroys socket or performs a + handshake. + +NOTE: `issuer` could be null, if the certificate is self-signed or if the issuer +is not in the root certificates list. (You could provide an issuer via `ca` +option.) + +NOTE: adding this event listener will have an effect only on connections +established after addition of event listener. + +NOTE: you may want to use some npm module like [asn1.js](http://npmjs.org/package/asn1.js) to parse the +certificates. + +### server.listen(port[, host][, callback])[#](#tls_server_listen_port_host_callback) + +Begin accepting connections on the specified `port` and `host`. If the +`host` is omitted, the server will accept connections directed to any +IPv4 address (`INADDR_ANY`). + +This function is asynchronous. The last parameter `callback` will be called +when the server has been bound. + +See `net.Server` for more information. + +### server.close()[#](#tls_server_close) + +Stops the server from accepting new connections. This function is +asynchronous, the server is finally closed when the server emits a `'close'` +event. + +### server.address()[#](#tls_server_address) + +Returns the bound address, the address family name and port of the +server as reported by the operating system. See [net.Server.address()](net.html#net_server_address) for +more information. + +### server.addContext(hostname, context)[#](#tls_server_addcontext_hostname_context) + +Add secure context that will be used if client request's SNI hostname is +matching passed `hostname` (wildcards can be used). `context` can contain +`key`, `cert`, `ca` and/or any other properties from `tls.createSecureContext` +`options` argument. + +### server.maxConnections[#](#tls_server_maxconnections) + +Set this property to reject connections when the server's connection count +gets high. + +### server.connections[#](#tls_server_connections) + +The number of concurrent connections on the server. + +## Class: CryptoStream[#](#tls_class_cryptostream) + +```None +Stability: 0 - Deprecated. Use tls.TLSSocket instead. +``` + +This is an encrypted stream. + +### cryptoStream.bytesWritten[#](#tls_cryptostream_byteswritten) + +A proxy to the underlying socket's bytesWritten accessor, this will return +the total bytes written to the socket, *including the TLS overhead*. + +## Class: CleartextStream[#](#tls_class_cleartextstream) + +The CleartextStream class in Node.js version v0.10.x (and prior) has been +deprecated and removed. + +## Class: tls.TLSSocket[#](#tls_class_tls_tlssocket_1) + +This is a wrapped version of [net.Socket](net.html#net_class_net_socket) that does transparent encryption +of written data and all required TLS negotiation. + +This instance implements a duplex [Stream](stream.html#stream_stream) interfaces. It has all the +common stream methods and events. + +### Event: 'secureConnect'[#](#tls_event_secureconnect) + +This event is emitted after a new connection has been successfully handshaked. +The listener will be called no matter if the server's certificate was +authorized or not. It is up to the user to test `tlsSocket.authorized` +to see if the server certificate was signed by one of the specified CAs. +If `tlsSocket.authorized === false` then the error can be found in +`tlsSocket.authorizationError`. Also if NPN was used - you can check +`tlsSocket.npnProtocol` for negotiated protocol. + +### Event: 'OCSPResponse'[#](#tls_event_ocspresponse) + +`function (response) { }` + +This event will be emitted if `requestOCSP` option was set. `response` is a +buffer object, containing server's OCSP response. + +Traditionally, the `response` is a signed object from the server's CA that +contains information about server's certificate revocation status. + +### tlsSocket.encrypted[#](#tls_tlssocket_encrypted) + +Static boolean value, always `true`. May be used to distinguish TLS sockets +from regular ones. + +### tlsSocket.authorized[#](#tls_tlssocket_authorized) + +A boolean that is `true` if the peer certificate was signed by one of the +specified CAs, otherwise `false` + +### tlsSocket.authorizationError[#](#tls_tlssocket_authorizationerror) + +The reason why the peer's certificate has not been verified. This property +becomes available only when `tlsSocket.authorized === false`. + +### tlsSocket.getPeerCertificate([ detailed ])[#](#tls_tlssocket_getpeercertificate_detailed) + +Returns an object representing the peer's certificate. The returned object has +some properties corresponding to the field of the certificate. If `detailed` +argument is `true` - the full chain with `issuer` property will be returned, +if `false` - only the top certificate without `issuer` property. + +Example: + +```None +{ subject: + { C: 'UK', + ST: 'Acknack Ltd', + L: 'Rhys Jones', + O: 'node.js', + OU: 'Test TLS Certificate', + CN: 'localhost' }, + issuerInfo: + { C: 'UK', + ST: 'Acknack Ltd', + L: 'Rhys Jones', + O: 'node.js', + OU: 'Test TLS Certificate', + CN: 'localhost' }, + issuer: + { ... another certificate ... }, + raw: < RAW DER buffer >, + valid_from: 'Nov 11 09:52:22 2009 GMT', + valid_to: 'Nov 6 09:52:22 2029 GMT', + fingerprint: '2A:7A:C2:DD:E5:F9:CC:53:72:35:99:7A:02:5A:71:38:52:EC:8A:DF', + serialNumber: 'B9B0D332A1AA5635' } +``` + +If the peer does not provide a certificate, it returns `null` or an empty +object. + +### tlsSocket.getCipher()[#](#tls_tlssocket_getcipher) + +Returns an object representing the cipher name and the SSL/TLS +protocol version of the current connection. + +Example: +{ name: 'AES256-SHA', version: 'TLSv1/SSLv3' } + +See SSL\_CIPHER\_get\_name() and SSL\_CIPHER\_get\_version() in + for more +information. + +### tlsSocket.renegotiate(options, callback)[#](#tls_tlssocket_renegotiate_options_callback) + +Initiate TLS renegotiation process. The `options` may contain the following +fields: `rejectUnauthorized`, `requestCert` (See [tls.createServer](#tls_tls_createserver_options_secureconnectionlistener) +for details). `callback(err)` will be executed with `null` as `err`, +once the renegotiation is successfully completed. + +NOTE: Can be used to request peer's certificate after the secure connection +has been established. + +ANOTHER NOTE: When running as the server, socket will be destroyed +with an error after `handshakeTimeout` timeout. + +### tlsSocket.setMaxSendFragment(size)[#](#tls_tlssocket_setmaxsendfragment_size) + +Set maximum TLS fragment size (default and maximum value is: `16384`, minimum +is: `512`). Returns `true` on success, `false` otherwise. + +Smaller fragment size decreases buffering latency on the client: large +fragments are buffered by the TLS layer until the entire fragment is received +and its integrity is verified; large fragments can span multiple roundtrips, +and their processing can be delayed due to packet loss or reordering. However, +smaller fragments add extra TLS framing bytes and CPU overhead, which may +decrease overall server throughput. + +### tlsSocket.getSession()[#](#tls_tlssocket_getsession) + +Return ASN.1 encoded TLS session or `undefined` if none was negotiated. Could +be used to speed up handshake establishment when reconnecting to the server. + +### tlsSocket.getTLSTicket()[#](#tls_tlssocket_gettlsticket) + +NOTE: Works only with client TLS sockets. Useful only for debugging, for +session reuse provide `session` option to `tls.connect`. + +Return TLS session ticket or `undefined` if none was negotiated. + +### tlsSocket.address()[#](#tls_tlssocket_address) + +Returns the bound address, the address family name and port of the +underlying socket as reported by the operating system. Returns an +object with three properties, e.g. +`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` + +### tlsSocket.remoteAddress[#](#tls_tlssocket_remoteaddress) + +The string representation of the remote IP address. For example, +`'74.125.127.100'` or `'2001:4860:a005::68'`. + +### tlsSocket.remoteFamily[#](#tls_tlssocket_remotefamily) + +The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. + +### tlsSocket.remotePort[#](#tls_tlssocket_remoteport) + +The numeric representation of the remote port. For example, `443`. + +### tlsSocket.localAddress[#](#tls_tlssocket_localaddress) + +The string representation of the local IP address. + +### tlsSocket.localPort[#](#tls_tlssocket_localport) + +The numeric representation of the local port. diff --git a/corpus/docs/nodejs/tls/tls_10x.md b/corpus/docs/nodejs/tls/tls_10x.md new file mode 100644 index 0000000000000000000000000000000000000000..6042d8e33cf3ca44bbc0724672b235b65e78f53d --- /dev/null +++ b/corpus/docs/nodejs/tls/tls_10x.md @@ -0,0 +1,1463 @@ +# TLS (SSL)# + +Source: https://nodejs.org/docs/latest-v10.x/api/tls.html +Version: 10.x + +[Stability: 2](documentation.html#documentation_stability_index) - Stable + +The `tls` module provides an implementation of the Transport Layer Security +(TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL. +The module can be accessed using: + +```None +const tls = require('tls'); +``` + +## TLS/SSL Concepts[#](#tls_tls_ssl_concepts) + +The TLS/SSL is a public/private key infrastructure (PKI). For most common +cases, each client and server must have a *private key*. + +Private keys can be generated in multiple ways. The example below illustrates +use of the OpenSSL command-line interface to generate a 2048-bit RSA private +key: + +```None +openssl genrsa -out ryans-key.pem 2048 +``` + +With TLS/SSL, all servers (and some clients) must have a *certificate*. +Certificates are *public keys* that correspond to a private key, and that are +digitally signed either by a Certificate Authority or by the owner of the +private key (such certificates are referred to as "self-signed"). The first +step to obtaining a certificate is to create a *Certificate Signing Request* +(CSR) file. + +The OpenSSL command-line interface can be used to generate a CSR for a private +key: + +```None +openssl req -new -sha256 -key ryans-key.pem -out ryans-csr.pem +``` + +Once the CSR file is generated, it can either be sent to a Certificate +Authority for signing or used to generate a self-signed certificate. + +Creating a self-signed certificate using the OpenSSL command-line interface +is illustrated in the example below: + +```None +openssl x509 -req -in ryans-csr.pem -signkey ryans-key.pem -out ryans-cert.pem +``` + +Once the certificate is generated, it can be used to generate a `.pfx` or +`.p12` file: + +```None +openssl pkcs12 -export -in ryans-cert.pem -inkey ryans-key.pem \ + -certfile ca-cert.pem -out ryans.pfx +``` + +Where: + +* `in`: is the signed certificate +* `inkey`: is the associated private key +* `certfile`: is a concatenation of all Certificate Authority (CA) certs into + a single file, e.g. `cat ca1-cert.pem ca2-cert.pem > ca-cert.pem` + +### Perfect Forward Secrecy[#](#tls_perfect_forward_secrecy) + +The term "[Forward Secrecy](https://en.wikipedia.org/wiki/Perfect_forward_secrecy)" or "Perfect Forward Secrecy" describes a feature of +key-agreement (i.e., key-exchange) methods. That is, the server and client keys +are used to negotiate new temporary keys that are used specifically and only for +the current communication session. Practically, this means that even if the +server's private key is compromised, communication can only be decrypted by +eavesdroppers if the attacker manages to obtain the key-pair specifically +generated for the session. + +Perfect Forward Secrecy is achieved by randomly generating a key pair for +key-agreement on every TLS/SSL handshake (in contrast to using the same key for +all sessions). Methods implementing this technique are called "ephemeral". + +Currently two methods are commonly used to achieve Perfect Forward Secrecy (note +the character "E" appended to the traditional abbreviations): + +* [DHE](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange) - An ephemeral version of the Diffie Hellman key-agreement protocol. +* [ECDHE](https://en.wikipedia.org/wiki/Elliptic_curve_Diffie%E2%80%93Hellman) - An ephemeral version of the Elliptic Curve Diffie Hellman + key-agreement protocol. + +Ephemeral methods may have some performance drawbacks, because key generation +is expensive. + +To use Perfect Forward Secrecy using `DHE` with the `tls` module, it is required +to generate Diffie-Hellman parameters and specify them with the `dhparam` +option to [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). The following illustrates the use of +the OpenSSL command-line interface to generate such parameters: + +```None +openssl dhparam -outform PEM -out dhparam.pem 2048 +``` + +If using Perfect Forward Secrecy using `ECDHE`, Diffie-Hellman parameters are +not required and a default ECDHE curve will be used. The `ecdhCurve` property +can be used when creating a TLS Server to specify the list of names of supported +curves to use, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) for more info. + +### ALPN and SNI[#](#tls_alpn_and_sni) + +ALPN (Application-Layer Protocol Negotiation Extension) and +SNI (Server Name Indication) are TLS handshake extensions: + +* ALPN - Allows the use of one TLS server for multiple protocols (HTTP, HTTP/2) +* SNI - Allows the use of one TLS server for multiple hostnames with different + SSL certificates. + +### Client-initiated renegotiation attack mitigation[#](#tls_client_initiated_renegotiation_attack_mitigation) + +The TLS protocol allows clients to renegotiate certain aspects of the TLS +session. Unfortunately, session renegotiation requires a disproportionate amount +of server-side resources, making it a potential vector for denial-of-service +attacks. + +To mitigate the risk, renegotiation is limited to three times every ten minutes. +An `'error'` event is emitted on the [`tls.TLSSocket`](#tls_class_tls_tlssocket) instance when this +threshold is exceeded. The limits are configurable: + +* `tls.CLIENT_RENEG_LIMIT` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Specifies the number of renegotiation + requests. **Default:** `3`. +* `tls.CLIENT_RENEG_WINDOW` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Specifies the time renegotiation window + in seconds. **Default:** `600` (10 minutes). + +The default renegotiation limits should not be modified without a full +understanding of the implications and risks. + +### Session Resumption[#](#tls_session_resumption) + +Establishing a TLS session can be relatively slow. The process can be sped +up by saving and later reusing the session state. There are several mechanisms +to do so, discussed here from oldest to newest (and preferred). + +***Session Identifiers*** Servers generate a unique ID for new connections and +send it to the client. Clients and servers save the session state. When +reconnecting, clients send the ID of their saved session state and if the server +also has the state for that ID, it can agree to use it. Otherwise, the server +will create a new session. See [RFC 2246](https://www.ietf.org/rfc/rfc2246.txt) for more information, page 23 and +30. + +Resumption using session identifiers is supported by most web browsers when +making HTTPS requests. + +For Node.js, clients must call [`tls.TLSSocket.getSession()`](#tls_tlssocket_getsession) after the +[`'secureConnect'`](#tls_event_secureconnect) event to get the session data, and provide the data to the +`session` option of [`tls.connect()`](#tls_tls_connect_options_callback) to reuse the session. Servers must +implement handlers for the [`'newSession'`](#tls_event_newsession) and [`'resumeSession'`](#tls_event_resumesession) events +to save and restore the session data using the session ID as the lookup key to +reuse sessions. To reuse sessions across load balancers or cluster workers, +servers must use a shared session cache (such as Redis) in their session +handlers. + +***Session Tickets*** The servers encrypt the entire session state and send it +to the client as a "ticket". When reconnecting, the state is sent to the server +in the initial connection. This mechanism avoids the need for server-side +session cache. If the server doesn't use the ticket, for any reason (failure +to decrypt it, it's too old, etc.), it will create a new session and send a new +ticket. See [RFC 5077](https://tools.ietf.org/html/rfc5077) for more information. + +Resumption using session tickets is becoming commonly supported by many web +browsers when making HTTPS requests. + +For Node.js, clients use the same APIs for resumption with session identifiers +as for resumption with session tickets. For debugging, if +[`tls.TLSSocket.getTLSTicket()`](#tls_tlssocket_gettlsticket) returns a value, the session data contains a +ticket, otherwise it contains client-side session state. + +Single process servers need no specific implementation to use session tickets. +To use session tickets across server restarts or load balancers, servers must +all have the same ticket keys. There are three 16-byte keys internally, but the +tls API exposes them as a single 48-byte buffer for convenience. + +Its possible to get the ticket keys by calling [`server.getTicketKeys()`](#tls_server_getticketkeys) on +one server instance and then distribute them, but it is more reasonable to +securely generate 48 bytes of secure random data and set them with the +`ticketKeys` option of [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener). The keys should be regularly +regenerated and server's keys can be reset with +[`server.setTicketKeys()`](#tls_server_setticketkeys_keys). + +Session ticket keys are cryptographic keys, and they ***must be stored +securely***. With TLS 1.2 and below, if they are compromised all sessions that +used tickets encrypted with them can be decrypted. They should not be stored +on disk, and they should be regenerated regularly. + +If clients advertise support for tickets, the server will send them. The +server can disable tickets by supplying +`require('constants').SSL_OP_NO_TICKET` in `secureOptions`. + +Both session identifiers and session tickets timeout, causing the server to +create new sessions. The timeout can be configured with the `sessionTimeout` +option of [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener). + +For all the mechanisms, when resumption fails, servers will create new sessions. +Since failing to resume the session does not cause TLS/HTTPS connection +failures, it is easy to not notice unnecessarily poor TLS performance. The +OpenSSL CLI can be used to verify that servers are resuming sessions. Use the +`-reconnect` option to `openssl s_client`, for example: + +```None +$ openssl s_client -connect localhost:443 -reconnect +``` + +Read through the debug output. The first connection should say "New", for +example: + +```None +New, TLSv1.2, Cipher is ECDHE-RSA-AES128-GCM-SHA256 +``` + +Subsequent connections should say "Reused", for example: + +```None +Reused, TLSv1.2, Cipher is ECDHE-RSA-AES128-GCM-SHA256 +``` + +## Modifying the Default TLS Cipher suite[#](#tls_modifying_the_default_tls_cipher_suite) + +Node.js is built with a default suite of enabled and disabled TLS ciphers. +Currently, the default cipher suite is: + +```None +ECDHE-RSA-AES128-GCM-SHA256: +ECDHE-ECDSA-AES128-GCM-SHA256: +ECDHE-RSA-AES256-GCM-SHA384: +ECDHE-ECDSA-AES256-GCM-SHA384: +DHE-RSA-AES128-GCM-SHA256: +ECDHE-RSA-AES128-SHA256: +DHE-RSA-AES128-SHA256: +ECDHE-RSA-AES256-SHA384: +DHE-RSA-AES256-SHA384: +ECDHE-RSA-AES256-SHA256: +DHE-RSA-AES256-SHA256: +HIGH: +!aNULL: +!eNULL: +!EXPORT: +!DES: +!RC4: +!MD5: +!PSK: +!SRP: +!CAMELLIA +``` + +This default can be replaced entirely using the [`--tls-cipher-list`](cli.html#cli_tls_cipher_list_list) command +line switch (directly, or via the [`NODE_OPTIONS`](cli.html#cli_node_options_options) environment variable). For +instance, the following makes `ECDHE-RSA-AES128-GCM-SHA256:!RC4` the default TLS +cipher suite: + +```None +node --tls-cipher-list="ECDHE-RSA-AES128-GCM-SHA256:!RC4" server.js + +export NODE_OPTIONS=--tls-cipher-list="ECDHE-RSA-AES128-GCM-SHA256:!RC4" +node server.js +``` + +The default can also be replaced on a per client or server basis using the +`ciphers` option from [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options), which is also available +in [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener), [`tls.connect()`](#tls_tls_connect_options_callback), and when creating new +[`tls.TLSSocket`](#tls_class_tls_tlssocket)s. + +Consult [OpenSSL cipher list format documentation](https://www.openssl.org/docs/man1.1.0/apps/ciphers.html#CIPHER-LIST-FORMAT) for details on the format. + +The default cipher suite included within Node.js has been carefully +selected to reflect current security best practices and risk mitigation. +Changing the default cipher suite can have a significant impact on the security +of an application. The `--tls-cipher-list` switch and `ciphers` option should by +used only if absolutely necessary. + +The default cipher suite prefers GCM ciphers for [Chrome's 'modern +cryptography' setting](https://www.chromium.org/Home/chromium-security/education/tls#TOC-Cipher-Suites) and also prefers ECDHE and DHE ciphers for Perfect +Forward Secrecy, while offering *some* backward compatibility. + +128 bit AES is preferred over 192 and 256 bit AES in light of [specific +attacks affecting larger AES key sizes](https://www.schneier.com/blog/archives/2009/07/another_new_aes.html). + +Old clients that rely on insecure and deprecated RC4 or DES-based ciphers +(like Internet Explorer 6) cannot complete the handshaking process with +the default configuration. If these clients *must* be supported, the +[TLS recommendations](https://wiki.mozilla.org/Security/Server_Side_TLS) may offer a compatible cipher suite. For more details +on the format, see the [OpenSSL cipher list format documentation](https://www.openssl.org/docs/man1.1.0/apps/ciphers.html#CIPHER-LIST-FORMAT). + +## Class: tls.Server[#](#tls_class_tls_server) + +Added in: v0.3.2 + +The `tls.Server` class is a subclass of `net.Server` that accepts encrypted +connections using TLS or SSL. + +### Event: 'keylog'[#](#tls_event_keylog) + +Added in: v10.20.0 + +* `line` [](buffer.html#buffer_class_buffer) Line of ASCII text, in NSS `SSLKEYLOGFILE` format. +* `tlsSocket` [](tls.html#tls_class_tls_tlssocket) The `tls.TLSSocket` instance on which it was + generated. + +The `keylog` event is emitted when key material is generated or received by +a connection to this server (typically before handshake has completed, but not +necessarily). This keying material can be stored for debugging, as it allows +captured TLS traffic to be decrypted. It may be emitted multiple times for +each socket. + +A typical use case is to append received lines to a common text file, which +is later used by software (such as Wireshark) to decrypt the traffic: + +```None +const logFile = fs.createWriteStream('/tmp/ssl-keys.log', { flags: 'a' }); +// ... +server.on('keylog', (line, tlsSocket) => { + if (tlsSocket.remoteAddress !== '...') + return; // Only log keys for a particular IP + logFile.write(line); +}); +``` + +### Event: 'newSession'[#](#tls_event_newsession) + +Added in: v0.9.2 + +The `'newSession'` event is emitted upon creation of a new TLS session. This may +be used to store sessions in external storage. The data should be provided to +the [`'resumeSession'`](#tls_event_resumesession) callback. + +The listener callback is passed three arguments when called: + +* `sessionId` [](buffer.html#buffer_class_buffer) The TLS session identifier +* `sessionData` [](buffer.html#buffer_class_buffer) The TLS session data +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function taking no arguments that must be + invoked in order for data to be sent or received over the secure connection. + +Listening for this event will have an effect only on connections established +after the addition of the event listener. + +### Event: 'OCSPRequest'[#](#tls_event_ocsprequest) + +Added in: v0.11.13 + +The `'OCSPRequest'` event is emitted when the client sends a certificate status +request. The listener callback is passed three arguments when called: + +* `certificate` [](buffer.html#buffer_class_buffer) The server certificate +* `issuer` [](buffer.html#buffer_class_buffer) The issuer's certificate +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function that must be invoked to provide + the results of the OCSP request. + +The server's current certificate can be parsed to obtain the OCSP URL +and certificate ID; after obtaining an OCSP response, `callback(null, resp)` is +then invoked, where `resp` is a `Buffer` instance containing the OCSP response. +Both `certificate` and `issuer` are `Buffer` DER-representations of the +primary and issuer's certificates. These can be used to obtain the OCSP +certificate ID and OCSP endpoint URL. + +Alternatively, `callback(null, null)` may be called, indicating that there was +no OCSP response. + +Calling `callback(err)` will result in a `socket.destroy(err)` call. + +The typical flow of an OCSP Request is as follows: + +1. Client connects to the server and sends an `'OCSPRequest'` (via the status + info extension in ClientHello). +2. Server receives the request and emits the `'OCSPRequest'` event, calling the + listener if registered. +3. Server extracts the OCSP URL from either the `certificate` or `issuer` and + performs an [OCSP request](https://en.wikipedia.org/wiki/OCSP_stapling) to the CA. +4. Server receives `'OCSPResponse'` from the CA and sends it back to the client + via the `callback` argument +5. Client validates the response and either destroys the socket or performs a + handshake. + +The `issuer` can be `null` if the certificate is either self-signed or the +issuer is not in the root certificates list. (An issuer may be provided +via the `ca` option when establishing the TLS connection.) + +Listening for this event will have an effect only on connections established +after the addition of the event listener. + +An npm module like [asn1.js](https://www.npmjs.com/package/asn1.js) may be used to parse the certificates. + +### Event: 'resumeSession'[#](#tls_event_resumesession) + +Added in: v0.9.2 + +The `'resumeSession'` event is emitted when the client requests to resume a +previous TLS session. The listener callback is passed two arguments when +called: + +* `sessionId` [](buffer.html#buffer_class_buffer) The TLS session identifier +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function to be called when the prior session + has been recovered: `callback([err[, sessionData]])` + + + `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + + `sessionData` [](buffer.html#buffer_class_buffer) + +The event listener should perform a lookup in external storage for the +`sessionData` saved by the [`'newSession'`](#tls_event_newsession) event handler using the given +`sessionId`. If found, call `callback(null, sessionData)` to resume the session. +If not found, the session cannot be resumed. `callback()` must be called +without `sessionData` so that the handshake can continue and a new session can +be created. It is possible to call `callback(err)` to terminate the incoming +connection and destroy the socket. + +Listening for this event will have an effect only on connections established +after the addition of the event listener. + +The following illustrates resuming a TLS session: + +```None +const tlsSessionStore = {}; +server.on('newSession', (id, data, cb) => { + tlsSessionStore[id.toString('hex')] = data; + cb(); +}); +server.on('resumeSession', (id, cb) => { + cb(null, tlsSessionStore[id.toString('hex')] || null); +}); +``` + +### Event: 'secureConnection'[#](#tls_event_secureconnection) + +Added in: v0.3.2 + +The `'secureConnection'` event is emitted after the handshaking process for a +new connection has successfully completed. The listener callback is passed a +single argument when called: + +* `tlsSocket` [](tls.html#tls_class_tls_tlssocket) The established TLS socket. + +The `tlsSocket.authorized` property is a `boolean` indicating whether the +client has been verified by one of the supplied Certificate Authorities for the +server. If `tlsSocket.authorized` is `false`, then `socket.authorizationError` +is set to describe how authorization failed. Note that depending on the settings +of the TLS server, unauthorized connections may still be accepted. + +The `tlsSocket.alpnProtocol` property is a string that contains the selected +ALPN protocol. When ALPN has no selected protocol, `tlsSocket.alpnProtocol` +equals `false`. + +The `tlsSocket.servername` property is a string containing the server name +requested via SNI. + +### Event: 'tlsClientError'[#](#tls_event_tlsclienterror) + +Added in: v6.0.0 + +The `'tlsClientError'` event is emitted when an error occurs before a secure +connection is established. The listener callback is passed two arguments when +called: + +* `exception` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) The `Error` object describing the error +* `tlsSocket` [](tls.html#tls_class_tls_tlssocket) The `tls.TLSSocket` instance from which the + error originated. + +### server.addContext(hostname, context)[#](#tls_server_addcontext_hostname_context) + +Added in: v0.5.3 + +* `hostname` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A SNI hostname or wildcard (e.g. `'*'`) +* `context` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) An object containing any of the possible properties + from the [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) `options` arguments (e.g. `key`, + `cert`, `ca`, etc). + +The `server.addContext()` method adds a secure context that will be used if +the client request's SNI name matches the supplied `hostname` (or wildcard). + +### server.address()[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/net.js#L1475)[#](#tls_server_address) + +Added in: v0.6.0 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + +Returns the bound address, the address family name, and port of the +server as reported by the operating system. See [`net.Server.address()`](net.html#net_server_address) for +more information. + +### server.close([callback])[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/net.js#L1562)[#](#tls_server_close_callback) + +Added in: v0.3.2 + +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A listener callback that will be registered to listen + for the server instance's `'close'` event. +* Returns: [](tls.html#tls_class_tls_server) + +The `server.close()` method stops the server from accepting new connections. + +This function operates asynchronously. The `'close'` event will be emitted +when the server has no more open connections. + +### server.connections[#](#tls_server_connections) + +Added in: v0.3.2Deprecated since: v0.9.7 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`server.getConnections()`](net.html#net_server_getconnections_callback) instead. + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Returns the current number of concurrent connections on the server. + +### server.getTicketKeys()[#](#tls_server_getticketkeys) + +Added in: v3.0.0 + +* Returns: [](buffer.html#buffer_class_buffer) A 48-byte buffer containing the session ticket keys. + +Returns the session ticket keys. + +See [Session Resumption](#tls_session_resumption) for more information. + +### server.listen()[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/net.js#L1360)[#](#tls_server_listen) + +Starts the server listening for encrypted connections. +This method is identical to [`server.listen()`](net.html#net_server_listen) from [`net.Server`](net.html#net_class_net_server). + +### server.setTicketKeys(keys)[#](#tls_server_setticketkeys_keys) + +Added in: v3.0.0 + +* `keys` [](buffer.html#buffer_class_buffer) A 48-byte buffer containing the session ticket keys. + +Sets the session ticket keys. + +Changes to the ticket keys are effective only for future server connections. +Existing or currently pending server connections will use the previous keys. + +See [Session Resumption](#tls_session_resumption) for more information. + +## Class: tls.TLSSocket[#](#tls_class_tls_tlssocket) + +Added in: v0.11.4 + +The `tls.TLSSocket` is a subclass of [`net.Socket`](net.html#net_class_net_socket) that performs transparent +encryption of written data and all required TLS negotiation. + +Instances of `tls.TLSSocket` implement the duplex [Stream](stream.html#stream_stream) interface. + +Methods that return TLS connection metadata (e.g. +[`tls.TLSSocket.getPeerCertificate()`](#tls_tlssocket_getpeercertificate_detailed) will only return data while the +connection is open. + +### new tls.TLSSocket(socket[, options])[#](#tls_new_tls_tlssocket_socket_options) + +History + +| Version | Changes | +| --- | --- | +| v5.0.0 | ALPN options are supported now. | +| v0.11.4 | Added in: v0.11.4 | + +* `socket` [](net.html#net_class_net_socket) | [](stream.html#stream_class_stream_duplex) + On the server side, any `Duplex` stream. On the client side, any + instance of [`net.Socket`](net.html#net_class_net_socket) (for generic `Duplex` stream support + on the client side, [`tls.connect()`](#tls_tls_connect_options_callback) must be used). +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `isServer`: The SSL/TLS protocol is asymmetrical, TLSSockets must know if + they are to behave as a server or a client. If `true` the TLS socket will be + instantiated as a server. **Default:** `false`. + + `server` [](net.html#net_class_net_server) A [`net.Server`](net.html#net_class_net_server) instance. + + `requestCert`: Whether to authenticate the remote peer by requesting a + certificate. Clients always request a server certificate. Servers + (`isServer` is true) may set `requestCert` to true to request a client + certificate. + + `rejectUnauthorized`: See [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `ALPNProtocols`: See [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `SNICallback`: See [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `session` [](buffer.html#buffer_class_buffer) A `Buffer` instance containing a TLS session. + + `requestOCSP` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true`, specifies that the OCSP status request + extension will be added to the client hello and an `'OCSPResponse'` event + will be emitted on the socket before establishing a secure communication + + `secureContext`: TLS context object created with + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). If a `secureContext` is *not* provided, one + will be created by passing the entire `options` object to + `tls.createSecureContext()`. + + ...: [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) options that are used if the + `secureContext` option is missing. Otherwise, they are ignored. + +Construct a new `tls.TLSSocket` object from an existing TCP socket. + +### Event: 'keylog'[#](#tls_event_keylog_1) + +Added in: v10.20.0 + +* `line` [](buffer.html#buffer_class_buffer) Line of ASCII text, in NSS `SSLKEYLOGFILE` format. + +The `keylog` event is emitted on a client `tls.TLSSocket` when key material +is generated or received by the socket. This keying material can be stored +for debugging, as it allows captured TLS traffic to be decrypted. It may +be emitted multiple times, before or after the handshake completes. + +A typical use case is to append received lines to a common text file, which +is later used by software (such as Wireshark) to decrypt the traffic: + +```None +const logFile = fs.createWriteStream('/tmp/ssl-keys.log', { flags: 'a' }); +// ... +tlsSocket.on('keylog', (line) => logFile.write(line)); +``` + +### Event: 'OCSPResponse'[#](#tls_event_ocspresponse) + +Added in: v0.11.13 + +The `'OCSPResponse'` event is emitted if the `requestOCSP` option was set +when the `tls.TLSSocket` was created and an OCSP response has been received. +The listener callback is passed a single argument when called: + +* `response` [](buffer.html#buffer_class_buffer) The server's OCSP response + +Typically, the `response` is a digitally signed object from the server's CA that +contains information about server's certificate revocation status. + +### Event: 'secureConnect'[#](#tls_event_secureconnect) + +Added in: v0.11.4 + +The `'secureConnect'` event is emitted after the handshaking process for a new +connection has successfully completed. The listener callback will be called +regardless of whether or not the server's certificate has been authorized. It +is the client's responsibility to check the `tlsSocket.authorized` property to +determine if the server certificate was signed by one of the specified CAs. If +`tlsSocket.authorized === false`, then the error can be found by examining the +`tlsSocket.authorizationError` property. If ALPN was used, the +`tlsSocket.alpnProtocol` property can be checked to determine the negotiated +protocol. + +### tlsSocket.address()[#](#tls_tlssocket_address) + +Added in: v0.11.4 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + +Returns the bound `address`, the address `family` name, and `port` of the +underlying socket as reported by the operating system: +`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`. + +### tlsSocket.authorizationError[#](#tls_tlssocket_authorizationerror) + +Added in: v0.11.4 + +Returns the reason why the peer's certificate was not been verified. This +property is set only when `tlsSocket.authorized === false`. + +### tlsSocket.authorized[#](#tls_tlssocket_authorized) + +Added in: v0.11.4 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +Returns `true` if the peer certificate was signed by one of the CAs specified +when creating the `tls.TLSSocket` instance, otherwise `false`. + +### tlsSocket.disableRenegotiation()[#](#tls_tlssocket_disablerenegotiation) + +Added in: v8.4.0 + +Disables TLS renegotiation for this `TLSSocket` instance. Once called, attempts +to renegotiate will trigger an `'error'` event on the `TLSSocket`. + +### tlsSocket.encrypted[#](#tls_tlssocket_encrypted) + +Added in: v0.11.4 + +Always returns `true`. This may be used to distinguish TLS sockets from regular +`net.Socket` instances. + +### tlsSocket.getCipher()[#](#tls_tlssocket_getcipher) + +Added in: v0.11.4 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + +Returns an object representing the cipher name. The `version` key is a legacy +field which always contains the value `'TLSv1/SSLv3'`. + +For example: `{ name: 'AES256-SHA', version: 'TLSv1/SSLv3' }`. + +See `SSL_CIPHER_get_name()` in + for more +information. + +### tlsSocket.getEphemeralKeyInfo()[#](#tls_tlssocket_getephemeralkeyinfo) + +Added in: v5.0.0 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + +Returns an object representing the type, name, and size of parameter of +an ephemeral key exchange in [Perfect Forward Secrecy](#tls_perfect_forward_secrecy) on a client +connection. It returns an empty object when the key exchange is not +ephemeral. As this is only supported on a client socket; `null` is returned +if called on a server socket. The supported types are `'DH'` and `'ECDH'`. The +`name` property is available only when type is `'ECDH'`. + +For example: `{ type: 'ECDH', name: 'prime256v1', size: 256 }`. + +### tlsSocket.getFinished()[#](#tls_tlssocket_getfinished) + +Added in: v9.9.0 + +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type) The latest `Finished` message that has been + sent to the socket as part of a SSL/TLS handshake, or `undefined` if + no `Finished` message has been sent yet. + +As the `Finished` messages are message digests of the complete handshake +(with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can +be used for external authentication procedures when the authentication +provided by SSL/TLS is not desired or is not enough. + +Corresponds to the `SSL_get_finished` routine in OpenSSL and may be used +to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929). + +### tlsSocket.getPeerCertificate([detailed])[#](#tls_tlssocket_getpeercertificate_detailed) + +Added in: v0.11.4 + +* `detailed` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Include the full certificate chain if `true`, otherwise + include just the peer's certificate. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + +Returns an object representing the peer's certificate. The returned object has +some properties corresponding to the fields of the certificate. + +If the full certificate chain was requested, each certificate will include an +`issuerCertificate` property containing an object representing its issuer's +certificate. + +```None +{ subject: + { C: 'UK', + ST: 'Acknack Ltd', + L: 'Rhys Jones', + O: 'node.js', + OU: 'Test TLS Certificate', + CN: 'localhost' }, + issuer: + { C: 'UK', + ST: 'Acknack Ltd', + L: 'Rhys Jones', + O: 'node.js', + OU: 'Test TLS Certificate', + CN: 'localhost' }, + issuerCertificate: + { ... another certificate, possibly with an .issuerCertificate ... }, + raw: < RAW DER buffer >, + pubkey: < RAW DER buffer >, + valid_from: 'Nov 11 09:52:22 2009 GMT', + valid_to: 'Nov 6 09:52:22 2029 GMT', + fingerprint: '2A:7A:C2:DD:E5:F9:CC:53:72:35:99:7A:02:5A:71:38:52:EC:8A:DF', + fingerprint256: '2A:7A:C2:DD:E5:F9:CC:53:72:35:99:7A:02:5A:71:38:52:EC:8A:DF:00:11:22:33:44:55:66:77:88:99:AA:BB', + serialNumber: 'B9B0D332A1AA5635' } +``` + +If the peer does not provide a certificate, an empty object will be returned. + +### tlsSocket.getPeerFinished()[#](#tls_tlssocket_getpeerfinished) + +Added in: v9.9.0 + +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type) The latest `Finished` message that is expected + or has actually been received from the socket as part of a SSL/TLS handshake, + or `undefined` if there is no `Finished` message so far. + +As the `Finished` messages are message digests of the complete handshake +(with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can +be used for external authentication procedures when the authentication +provided by SSL/TLS is not desired or is not enough. + +Corresponds to the `SSL_get_peer_finished` routine in OpenSSL and may be used +to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929). + +### tlsSocket.getProtocol()[#](#tls_tlssocket_getprotocol) + +Added in: v5.7.0 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Null_type) + +Returns a string containing the negotiated SSL/TLS protocol version of the +current connection. The value `'unknown'` will be returned for connected +sockets that have not completed the handshaking process. The value `null` will +be returned for server sockets or disconnected client sockets. + +Protocol versions are: + +* `'TLSv1'` +* `'TLSv1.1'` +* `'TLSv1.2'` +* `'SSLv3'` + +See for more +information. + +### tlsSocket.getSession()[#](#tls_tlssocket_getsession) + +Added in: v0.11.4 + +* [](buffer.html#buffer_class_buffer) + +Returns the TLS session data or `undefined` if no session was +negotiated. On the client, the data can be provided to the `session` option of +[`tls.connect()`](#tls_tls_connect_options_callback) to resume the connection. On the server, it may be useful +for debugging. + +See [Session Resumption](#tls_session_resumption) for more information. + +### tlsSocket.getTLSTicket()[#](#tls_tlssocket_gettlsticket) + +Added in: v0.11.4 + +* [](buffer.html#buffer_class_buffer) + +For a client, returns the TLS session ticket if one is available, or +`undefined`. For a server, always returns `undefined`. + +It may be useful for debugging. + +See [Session Resumption](#tls_session_resumption) for more information. + +### tlsSocket.isSessionReused()[#](#tls_tlssocket_issessionreused) + +Added in: v0.5.6 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` if the session was reused, `false` otherwise. + +See [Session Resumption](#tls_session_resumption) for more information. + +### tlsSocket.localAddress[#](#tls_tlssocket_localaddress) + +Added in: v0.11.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the string representation of the local IP address. + +### tlsSocket.localPort[#](#tls_tlssocket_localport) + +Added in: v0.11.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Returns the numeric representation of the local port. + +### tlsSocket.remoteAddress[#](#tls_tlssocket_remoteaddress) + +Added in: v0.11.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the string representation of the remote IP address. For example, +`'74.125.127.100'` or `'2001:4860:a005::68'`. + +### tlsSocket.remoteFamily[#](#tls_tlssocket_remotefamily) + +Added in: v0.11.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the string representation of the remote IP family. `'IPv4'` or `'IPv6'`. + +### tlsSocket.remotePort[#](#tls_tlssocket_remoteport) + +Added in: v0.11.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Returns the numeric representation of the remote port. For example, `443`. + +### tlsSocket.renegotiate(options, callback)[#](#tls_tlssocket_renegotiate_options_callback) + +Added in: v0.11.8 + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If not `false`, the server certificate is + verified against the list of supplied CAs. An `'error'` event is emitted if + verification fails; `err.code` contains the OpenSSL error code. **Default:** + `true`. + + `requestCert` +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A function that will be called when the renegotiation + request has been completed. + +The `tlsSocket.renegotiate()` method initiates a TLS renegotiation process. +Upon completion, the `callback` function will be passed a single argument +that is either an `Error` (if the request failed) or `null`. + +This method can be used to request a peer's certificate after the secure +connection has been established. + +When running as the server, the socket will be destroyed with an error after +`handshakeTimeout` timeout. + +### tlsSocket.setMaxSendFragment(size)[#](#tls_tlssocket_setmaxsendfragment_size) + +Added in: v0.11.11 + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The maximum TLS fragment size. The maximum value is `16384`. + **Default:** `16384`. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +The `tlsSocket.setMaxSendFragment()` method sets the maximum TLS fragment size. +Returns `true` if setting the limit succeeded; `false` otherwise. + +Smaller fragment sizes decrease the buffering latency on the client: larger +fragments are buffered by the TLS layer until the entire fragment is received +and its integrity is verified; large fragments can span multiple roundtrips +and their processing can be delayed due to packet loss or reordering. However, +smaller fragments add extra TLS framing bytes and CPU overhead, which may +decrease overall server throughput. + +## tls.checkServerIdentity(hostname, cert)[[src]](https://github.com/nodejs/node/blob/5182a7ece0b71feeb9157f7aa348a15d53e32058/lib/tls.js#L192)[#](#tls_tls_checkserveridentity_hostname_cert) + +Added in: v0.8.4 + +* `hostname` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The host name or IP address to verify the certificate + against. +* `cert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) An object representing the peer's certificate. The returned + object has some properties corresponding to the fields of the certificate. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type) + +Verifies the certificate `cert` is issued to `hostname`. + +Returns [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object, populating it with `reason`, `host`, and `cert` on +failure. On success, returns [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type). + +This function can be overwritten by providing alternative function as part of +the `options.checkServerIdentity` option passed to `tls.connect()`. The +overwriting function can call `tls.checkServerIdentity()` of course, to augment +the checks done with additional verification. + +This function is only called if the certificate passed all other checks, such as +being issued by trusted CA (`options.ca`). + +The cert object contains the parsed certificate and will have a structure +similar to: + +```None +{ subject: + { OU: [ 'Domain Control Validated', 'PositiveSSL Wildcard' ], + CN: '*.nodejs.org' }, + issuer: + { C: 'GB', + ST: 'Greater Manchester', + L: 'Salford', + O: 'COMODO CA Limited', + CN: 'COMODO RSA Domain Validation Secure Server CA' }, + subjectaltname: 'DNS:*.nodejs.org, DNS:nodejs.org', + infoAccess: + { 'CA Issuers - URI': + [ 'http://crt.comodoca.com/COMODORSADomainValidationSecureServerCA.crt' ], + 'OCSP - URI': [ 'http://ocsp.comodoca.com' ] }, + modulus: 'B56CE45CB740B09A13F64AC543B712FF9EE8E4C284B542A1708A27E82A8D151CA178153E12E6DDA15BF70FFD96CB8A88618641BDFCCA03527E665B70D779C8A349A6F88FD4EF6557180BD4C98192872BCFE3AF56E863C09DDD8BC1EC58DF9D94F914F0369102B2870BECFA1348A0838C9C49BD1C20124B442477572347047506B1FCD658A80D0C44BCC16BC5C5496CFE6E4A8428EF654CD3D8972BF6E5BFAD59C93006830B5EB1056BBB38B53D1464FA6E02BFDF2FF66CD949486F0775EC43034EC2602AEFBF1703AD221DAA2A88353C3B6A688EFE8387811F645CEED7B3FE46E1F8B9F59FAD028F349B9BC14211D5830994D055EEA3D547911E07A0ADDEB8A82B9188E58720D95CD478EEC9AF1F17BE8141BE80906F1A339445A7EB5B285F68039B0F294598A7D1C0005FC22B5271B0752F58CCDEF8C8FD856FB7AE21C80B8A2CE983AE94046E53EDE4CB89F42502D31B5360771C01C80155918637490550E3F555E2EE75CC8C636DDE3633CFEDD62E91BF0F7688273694EEEBA20C2FC9F14A2A435517BC1D7373922463409AB603295CEB0BB53787A334C9CA3CA8B30005C5A62FC0715083462E00719A8FA3ED0A9828C3871360A73F8B04A4FC1E71302844E9BB9940B77E745C9D91F226D71AFCAD4B113AAF68D92B24DDB4A2136B55A1CD1ADF39605B63CB639038ED0F4C987689866743A68769CC55847E4A06D6E2E3F1', + exponent: '0x10001', + pubkey: , + valid_from: 'Aug 14 00:00:00 2017 GMT', + valid_to: 'Nov 20 23:59:59 2019 GMT', + fingerprint: '01:02:59:D9:C3:D2:0D:08:F7:82:4E:44:A4:B4:53:C5:E2:3A:87:4D', + fingerprint256: '69:AE:1A:6A:D4:3D:C6:C1:1B:EA:C6:23:DE:BA:2A:14:62:62:93:5C:7A:EA:06:41:9B:0B:BC:87:CE:48:4E:02', + ext_key_usage: [ '1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2' ], + serialNumber: '66593D57F20CBC573E433381B5FEC280', + raw: } +``` + +## tls.connect(options[, callback])[#](#tls_tls_connect_options_callback) + +History + +| Version | Changes | +| --- | --- | +| v10.16.0 | The `timeout` option is supported now. | +| v8.0.0 | The `lookup` option is supported now. | +| v8.0.0 | The `ALPNProtocols` option can be a `Uint8Array` now. | +| v5.3.0, v4.7.0 | The `secureContext` option is supported now. | +| v5.0.0 | ALPN options are supported now. | +| v0.11.3 | Added in: v0.11.3 | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `host` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Host the client should connect to. **Default:** + `'localhost'`. + + `port` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Port the client should connect to. + + `path` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Creates unix socket connection to path. If this option is + specified, `host` and `port` are ignored. + + `socket` [](stream.html#stream_class_stream_duplex) Establish secure connection on a given socket + rather than creating a new socket. Typically, this is an instance of + [`net.Socket`](net.html#net_class_net_socket), but any `Duplex` stream is allowed. + If this option is specified, `path`, `host` and `port` are ignored, + except for certificate validation. Usually, a socket is already connected + when passed to `tls.connect()`, but it can be connected later. Note that + connection/disconnection/destruction of `socket` is the user's + responsibility, calling `tls.connect()` will not cause `net.connect()` to be + called. + + `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If not `false`, the server certificate is + verified against the list of supplied CAs. An `'error'` event is emitted if + verification fails; `err.code` contains the OpenSSL error code. **Default:** + `true`. + + `ALPNProtocols`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) + An array of strings, `Buffer`s or `Uint8Array`s, or a single `Buffer` or + `Uint8Array` containing the supported ALPN protocols. `Buffer`s should have + the format `[len][name][len][name]...` e.g. `'\x08http/1.1\x08http/1.0'`, + where the `len` byte is the length of the next protocol name. Passing an + array is usually much simpler, e.g. `['http/1.1', 'http/1.0']`. + Protocols earlier in the list have higher preference than those later. + + `servername`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Server name for the SNI (Server Name Indication) TLS + extension. It is the name of the host being connected to, and must be a host + name, and not an IP address. It can be used by a multi-homed server to + choose the correct certificate to present to the client, see the + `SNICallback` option to [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener). + + `checkServerIdentity(servername, cert)` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function + to be used (instead of the builtin `tls.checkServerIdentity()` function) + when checking the server's hostname (or the provided `servername` when + explicitly set) against the certificate. This should return an [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) if + verification fails. The method should return `undefined` if the `servername` + and `cert` are verified. + + `session` [](buffer.html#buffer_class_buffer) A `Buffer` instance, containing TLS session. + + `minDHSize` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Minimum size of the DH parameter in bits to accept a + TLS connection. When a server offers a DH parameter with a size less + than `minDHSize`, the TLS connection is destroyed and an error is thrown. + **Default:** `1024`. + + `secureContext`: TLS context object created with + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). If a `secureContext` is *not* provided, one + will be created by passing the entire `options` object to + `tls.createSecureContext()`. + + `lookup`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Custom lookup function. **Default:** + [`dns.lookup()`](dns.html#dns_dns_lookup_hostname_options_callback). + + `timeout`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) If set and if a socket is created internally, will call + [`socket.setTimeout(timeout)`](#net_socket_settimeout_timeout_callback) after the socket is created, but before it + starts the connection. + + ...: [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) options that are used if the + `secureContext` option is missing, otherwise they are ignored. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) +* Returns: [](tls.html#tls_class_tls_tlssocket) + +The `callback` function, if specified, will be added as a listener for the +[`'secureConnect'`](#tls_event_secureconnect) event. + +`tls.connect()` returns a [`tls.TLSSocket`](#tls_class_tls_tlssocket) object. + +The following illustrates a client for the echo server example from +[`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener): + +```None +// Assumes an echo server that is listening on port 8000. +const tls = require('tls'); +const fs = require('fs'); + +const options = { + // Necessary only if the server requires client certificate authentication. + key: fs.readFileSync('client-key.pem'), + cert: fs.readFileSync('client-cert.pem'), + + // Necessary only if the server uses a self-signed certificate. + ca: [ fs.readFileSync('server-cert.pem') ], + + // Necessary only if the server's cert isn't for "localhost". + checkServerIdentity: () => { return null; }, +}; + +const socket = tls.connect(8000, options, () => { + console.log('client connected', + socket.authorized ? 'authorized' : 'unauthorized'); + process.stdin.pipe(socket); + process.stdin.resume(); +}); +socket.setEncoding('utf8'); +socket.on('data', (data) => { + console.log(data); +}); +socket.on('end', () => { + console.log('server ends connection'); +}); +``` + +## tls.connect(path[, options][, callback])[#](#tls_tls_connect_path_options_callback) + +Added in: v0.11.3 + +* `path` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Default value for `options.path`. +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) See [`tls.connect()`](#tls_tls_connect_options_callback). +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) See [`tls.connect()`](#tls_tls_connect_options_callback). +* Returns: [](tls.html#tls_class_tls_tlssocket) + +Same as [`tls.connect()`](#tls_tls_connect_options_callback) except that `path` can be provided +as an argument instead of an option. + +A path option, if specified, will take precedence over the path argument. + +## tls.connect(port[, host][, options][, callback])[#](#tls_tls_connect_port_host_options_callback) + +Added in: v0.11.3 + +* `port` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Default value for `options.port`. +* `host` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Default value for `options.host`. +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) See [`tls.connect()`](#tls_tls_connect_options_callback). +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) See [`tls.connect()`](#tls_tls_connect_options_callback). +* Returns: [](tls.html#tls_class_tls_tlssocket) + +Same as [`tls.connect()`](#tls_tls_connect_options_callback) except that `port` and `host` can be provided +as arguments instead of options. + +A port or host option, if specified, will take precedence over any port or host +argument. + +## tls.createSecureContext([options])[#](#tls_tls_createsecurecontext_options) + +History + +| Version | Changes | +| --- | --- | +| v10.16.0 | The `minVersion` and `maxVersion` can be used to restrict the allowed TLS protocol versions. | +| v10.0.0 | The `ecdhCurve` cannot be set to `false` anymore due to a change in OpenSSL. | +| v9.3.0 | The `options` parameter can now include `clientCertEngine`. | +| v9.0.0 | The `ecdhCurve` option can now be multiple `':'` separated curve names or `'auto'`. | +| v7.3.0 | If the `key` option is an array, individual entries do not need a `passphrase` property anymore. `Array` entries can also just be `string`s or `Buffer`s now. | +| v5.2.0 | The `ca` option can now be a single string containing multiple CA certificates. | +| v0.11.13 | Added in: v0.11.13 | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `ca` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) Optionally override the trusted CA + certificates. Default is to trust the well-known CAs curated by Mozilla. + Mozilla's CAs are completely replaced when CAs are explicitly specified + using this option. The value can be a string or `Buffer`, or an `Array` of + strings and/or `Buffer`s. Any string or `Buffer` can contain multiple PEM + CAs concatenated together. The peer's certificate must be chainable to a CA + trusted by the server for the connection to be authenticated. When using + certificates that are not chainable to a well-known CA, the certificate's CA + must be explicitly specified as a trusted or the connection will fail to + authenticate. + If the peer uses a certificate that doesn't match or chain to one of the + default CAs, use the `ca` option to provide a CA certificate that the peer's + certificate can match or chain to. + For self-signed certificates, the certificate is its own CA, and must be + provided. + For PEM encoded certificates, supported types are "X509 CERTIFICATE", and + "CERTIFICATE". + + `cert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) Cert chains in PEM format. One cert + chain should be provided per private key. Each cert chain should consist of + the PEM formatted certificate for a provided private `key`, followed by the + PEM formatted intermediate certificates (if any), in order, and not + including the root CA (the root CA must be pre-known to the peer, see `ca`). + When providing multiple cert chains, they do not have to be in the same + order as their private keys in `key`. If the intermediate certificates are + not provided, the peer will not be able to validate the certificate, and the + handshake will fail. + + `ciphers` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Cipher suite specification, replacing the default. For + more information, see [modifying the default cipher suite](#tls_modifying_the_default_tls_cipher_suite). + + `clientCertEngine` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Name of an OpenSSL engine which can provide the + client certificate. + + `crl` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) PEM formatted CRLs (Certificate + Revocation Lists). + + `dhparam` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) Diffie Hellman parameters, required for + [Perfect Forward Secrecy](#tls_perfect_forward_secrecy). Use `openssl dhparam` to create the parameters. + The key length must be greater than or equal to 1024 bits, otherwise an + error will be thrown. It is strongly recommended to use 2048 bits or larger + for stronger security. If omitted or invalid, the parameters are silently + discarded and DHE ciphers will not be available. + + `ecdhCurve` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A string describing a named curve or a colon separated + list of curve NIDs or names, for example `P-521:P-384:P-256`, to use for + ECDH key agreement. Set to `auto` to select the + curve automatically. Use [`crypto.getCurves()`](crypto.html#crypto_crypto_getcurves) to obtain a list of + available curve names. On recent releases, `openssl ecparam -list_curves` + will also display the name and description of each available elliptic curve. + **Default:** [`tls.DEFAULT_ECDH_CURVE`](#tls_tls_default_ecdh_curve). + + `honorCipherOrder` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Attempt to use the server's cipher suite + preferences instead of the client's. When `true`, causes + `SSL_OP_CIPHER_SERVER_PREFERENCE` to be set in `secureOptions`, see + [OpenSSL Options](crypto.html#crypto_openssl_options) for more information. + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Private keys in PEM format. + PEM allows the option of private keys being encrypted. Encrypted keys will + be decrypted with `options.passphrase`. Multiple keys using different + algorithms can be provided either as an array of unencrypted key strings or + buffers, or an array of objects in the form `{pem: [, passphrase: ]}`. The object form can only occur in an array. + `object.passphrase` is optional. Encrypted keys will be decrypted with + `object.passphrase` if provided, or `options.passphrase` if it is not. + + `maxVersion` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optionally set the maximum TLS version to allow. One + of `TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the + `secureProtocol` option, use one or the other. + **Default:** [`tls.DEFAULT_MAX_VERSION`](#tls_tls_default_max_version). + + `minVersion` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optionally set the minimum TLS version to allow. One + of `TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the + `secureProtocol` option, use one or the other. It is not recommended to use + less than TLSv1.2, but it may be required for interoperability. + **Default:** [`tls.DEFAULT_MIN_VERSION`](#tls_tls_default_min_version). + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Shared passphrase used for a single private key and/or + a PFX. + + `pfx` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) PFX or PKCS12 encoded + private key and certificate chain. `pfx` is an alternative to providing + `key` and `cert` individually. PFX is usually encrypted, if it is, + `passphrase` will be used to decrypt it. Multiple PFX can be provided either + as an array of unencrypted PFX buffers, or an array of objects in the form + `{buf: [, passphrase: ]}`. The object form can only + occur in an array. `object.passphrase` is optional. Encrypted PFX will be + decrypted with `object.passphrase` if provided, or `options.passphrase` if + it is not. + + `secureOptions` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Optionally affect the OpenSSL protocol behavior, + which is not usually necessary. This should be used carefully if at all! + Value is a numeric bitmask of the `SSL_OP_*` options from + [OpenSSL Options](crypto.html#crypto_openssl_options). + + `secureProtocol` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The TLS protocol version to use. The possible + values are listed as [SSL\_METHODS](https://www.openssl.org/docs/man1.1.0/ssl/ssl.html#Dealing-with-Protocol-Methods), use the function names as strings. For + example, use `'TLSv1_1_method'` to force TLS version 1.1, or `'TLS_method'` + to allow any TLS protocol version. It is not recommended to use TLS versions + less than 1.2, but it may be required for interoperability. **Default:** + none, see `minVersion`. + + `sessionIdContext` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Opaque identifier used by servers to ensure + session state is not shared between applications. Unused by clients. + +[`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) sets the default value of the `honorCipherOrder` option +to `true`, other APIs that create secure contexts leave it unset. + +[`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) uses a 128 bit truncated SHA1 hash value generated +from `process.argv` as the default value of the `sessionIdContext` option, other +APIs that create secure contexts have no default value. + +The `tls.createSecureContext()` method creates a credentials object. + +A key is *required* for ciphers that make use of certificates. Either `key` or +`pfx` can be used to provide it. + +If the 'ca' option is not given, then Node.js will use the default +publicly trusted list of CAs as given in +. + +## tls.createServer([options][, secureconnectionlistener])[#](#tls_tls_createserver_options_secureconnectionlistener) + +History + +| Version | Changes | +| --- | --- | +| v9.3.0 | The `options` parameter can now include `clientCertEngine`. | +| v8.0.0 | The `ALPNProtocols` option can be a `Uint8Array` now. | +| v5.0.0 | ALPN options are supported now. | +| v0.3.2 | Added in: v0.3.2 | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `ALPNProtocols`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) + An array of strings, `Buffer`s or `Uint8Array`s, or a single `Buffer` or + `Uint8Array` containing the supported ALPN protocols. `Buffer`s should have + the format `[len][name][len][name]...` e.g. `0x05hello0x05world`, where the + first byte is the length of the next protocol name. Passing an array is + usually much simpler, e.g. `['hello', 'world']`. + (Protocols should be ordered by their priority.) + + `clientCertEngine` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Name of an OpenSSL engine which can provide the + client certificate. + + `handshakeTimeout` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Abort the connection if the SSL/TLS handshake + does not finish in the specified number of milliseconds. + A `'tlsClientError'` is emitted on the `tls.Server` object whenever + a handshake times out. **Default:** `120000` (120 seconds). + + `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If not `false` the server will reject any + connection which is not authorized with the list of supplied CAs. This + option only has an effect if `requestCert` is `true`. **Default:** `true`. + + `requestCert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true` the server will request a certificate from + clients that connect and attempt to verify that certificate. **Default:** + `false`. + + `sessionTimeout` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The number of seconds after which a TLS session + created by the server will no longer be resumable. See + [Session Resumption](#tls_session_resumption) for more information. **Default:** `300`. + + `SNICallback(servername, cb)` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A function that will be called if + the client supports SNI TLS extension. Two arguments will be passed when + called: `servername` and `cb`. `SNICallback` should invoke `cb(null, ctx)`, + where `ctx` is a `SecureContext` instance. (`tls.createSecureContext(...)` + can be used to get a proper `SecureContext`.) If `SNICallback` wasn't + provided the default callback with high-level API will be used (see below). + + `ticketKeys`: [](buffer.html#buffer_class_buffer) 48-bytes of cryptographically strong pseudo-random + data. See [Session Resumption](#tls_session_resumption) for more information. + + ...: Any [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) option can be provided. For + servers, the identity options (`pfx` or `key`/`cert`) are usually required. +* `secureConnectionListener` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) +* Returns: [](tls.html#tls_class_tls_server) + +Creates a new [`tls.Server`](#tls_class_tls_server). The `secureConnectionListener`, if provided, is +automatically set as a listener for the [`'secureConnection'`](#tls_event_secureconnection) event. + +The `ticketKeys` options is automatically shared between `cluster` module +workers. + +The following illustrates a simple echo server: + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + key: fs.readFileSync('server-key.pem'), + cert: fs.readFileSync('server-cert.pem'), + + // This is necessary only if using client certificate authentication. + requestCert: true, + + // This is necessary only if the client uses a self-signed certificate. + ca: [ fs.readFileSync('client-cert.pem') ] +}; + +const server = tls.createServer(options, (socket) => { + console.log('server connected', + socket.authorized ? 'authorized' : 'unauthorized'); + socket.write('welcome!\n'); + socket.setEncoding('utf8'); + socket.pipe(socket); +}); +server.listen(8000, () => { + console.log('server bound'); +}); +``` + +The server can be tested by connecting to it using the example client from +[`tls.connect()`](#tls_tls_connect_options_callback). + +## tls.getCiphers()[#](#tls_tls_getciphers) + +Added in: v0.10.2 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns an array with the names of the supported SSL ciphers. + +```None +console.log(tls.getCiphers()); // ['AES128-SHA', 'AES256-SHA', ...] +``` + +## tls.DEFAULT\_ECDH\_CURVE[#](#tls_tls_default_ecdh_curve) + +History + +| Version | Changes | +| --- | --- | +| v10.0.0 | Default value changed to `'auto'`. | +| v0.11.13 | Added in: v0.11.13 | + +The default curve name to use for ECDH key agreement in a tls server. The +default value is `'auto'`. See [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) for further +information. + +## tls.DEFAULT\_MAX\_VERSION[#](#tls_tls_default_max_version) + +Added in: v10.6.0 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The default value of the `maxVersion` option of + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). It can be assigned any of the supported TLS + protocol versions, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. + **Default:** `'TLSv1.2'`. + +## tls.DEFAULT\_MIN\_VERSION[#](#tls_tls_default_min_version) + +Added in: v10.6.0 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The default value of the `minVersion` option of + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). It can be assigned any of the supported TLS + protocol versions, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. + **Default:** `'TLSv1'`, unless changed using CLI options. Using + `--tls-min-v1.0` sets the default to `'TLSv1'`. Using `--tls-min-v1.1` sets + the default to `'TLSv1.1'`. Using `--tls-min-v1.2` sets the default to + `'TLSv1.2'`. If multiple of the options are provided, the lowest minimum is + used. + +## Deprecated APIs[#](#tls_deprecated_apis) + +### Class: CryptoStream[#](#tls_class_cryptostream) + +Added in: v0.3.4Deprecated since: v0.11.3 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`tls.TLSSocket`](#tls_class_tls_tlssocket) instead. + +The `tls.CryptoStream` class represents a stream of encrypted data. This class +is deprecated and should no longer be used. + +#### cryptoStream.bytesWritten[#](#tls_cryptostream_byteswritten) + +Added in: v0.3.4Deprecated since: v0.11.3 + +The `cryptoStream.bytesWritten` property returns the total number of bytes +written to the underlying socket *including* the bytes required for the +implementation of the TLS protocol. + +### Class: SecurePair[#](#tls_class_securepair) + +Added in: v0.3.2Deprecated since: v0.11.3 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`tls.TLSSocket`](#tls_class_tls_tlssocket) instead. + +Returned by [`tls.createSecurePair()`](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options). + +#### Event: 'secure'[#](#tls_event_secure) + +Added in: v0.3.2Deprecated since: v0.11.3 + +The `'secure'` event is emitted by the `SecurePair` object once a secure +connection has been established. + +As with checking for the server +[`'secureConnection'`](#tls_event_secureconnection) +event, `pair.cleartext.authorized` should be inspected to confirm whether the +certificate used is properly authorized. + +### tls.createSecurePair([context][, isserver][, requestCert][, rejectunauthorized][, options])[#](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options) + +History + +| Version | Changes | +| --- | --- | +| v5.0.0 | ALPN options are supported now. | +| v0.11.3 | Deprecated since: v0.11.3 | +| v0.3.2 | Added in: v0.3.2 | + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`tls.TLSSocket`](#tls_class_tls_tlssocket) instead. + +* `context` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) A secure context object as returned by + `tls.createSecureContext()` +* `isServer` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` to specify that this TLS connection should be + opened as a server. +* `requestCert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` to specify whether a server should request a + certificate from a connecting client. Only applies when `isServer` is `true`. +* `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If not `false` a server automatically reject + clients with invalid certificates. Only applies when `isServer` is `true`. +* `options` + + + `secureContext`: A TLS context object from [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) + + `isServer`: If `true` the TLS socket will be instantiated in server-mode. + **Default:** `false`. + + `server` [](net.html#net_class_net_server) A [`net.Server`](net.html#net_class_net_server) instance + + `requestCert`: See [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `rejectUnauthorized`: See [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `ALPNProtocols`: See [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `SNICallback`: See [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `session` [](buffer.html#buffer_class_buffer) A `Buffer` instance containing a TLS session. + + `requestOCSP` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true`, specifies that the OCSP status request + extension will be added to the client hello and an `'OCSPResponse'` event + will be emitted on the socket before establishing a secure communication. + +Creates a new secure pair object with two streams, one of which reads and writes +the encrypted data and the other of which reads and writes the cleartext data. +Generally, the encrypted stream is piped to/from an incoming encrypted data +stream and the cleartext one is used as a replacement for the initial encrypted +stream. + +`tls.createSecurePair()` returns a `tls.SecurePair` object with `cleartext` and +`encrypted` stream properties. + +Using `cleartext` has the same API as [`tls.TLSSocket`](#tls_class_tls_tlssocket). + +The `tls.createSecurePair()` method is now deprecated in favor of +`tls.TLSSocket()`. For example, the code: + +```None +pair = tls.createSecurePair(/* ... */); +pair.encrypted.pipe(socket); +socket.pipe(pair.encrypted); +``` + +can be replaced by: + +```None +secureSocket = tls.TLSSocket(socket, options); +``` + +where `secureSocket` has the same API as `pair.cleartext`. diff --git a/corpus/docs/nodejs/tls/tls_11x.md b/corpus/docs/nodejs/tls/tls_11x.md new file mode 100644 index 0000000000000000000000000000000000000000..3a70bdbeb7083e9e2240244f7249dea0ed24e98c --- /dev/null +++ b/corpus/docs/nodejs/tls/tls_11x.md @@ -0,0 +1,1576 @@ +# TLS (SSL)# + +Source: https://nodejs.org/docs/latest-v11.x/api/tls.html +Version: 11.x + +[Stability: 2](documentation.html#documentation_stability_index) - Stable + +The `tls` module provides an implementation of the Transport Layer Security +(TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL. +The module can be accessed using: + +```None +const tls = require('tls'); +``` + +## TLS/SSL Concepts[#](#tls_tls_ssl_concepts) + +The TLS/SSL is a public/private key infrastructure (PKI). For most common +cases, each client and server must have a *private key*. + +Private keys can be generated in multiple ways. The example below illustrates +use of the OpenSSL command-line interface to generate a 2048-bit RSA private +key: + +```None +openssl genrsa -out ryans-key.pem 2048 +``` + +With TLS/SSL, all servers (and some clients) must have a *certificate*. +Certificates are *public keys* that correspond to a private key, and that are +digitally signed either by a Certificate Authority or by the owner of the +private key (such certificates are referred to as "self-signed"). The first +step to obtaining a certificate is to create a *Certificate Signing Request* +(CSR) file. + +The OpenSSL command-line interface can be used to generate a CSR for a private +key: + +```None +openssl req -new -sha256 -key ryans-key.pem -out ryans-csr.pem +``` + +Once the CSR file is generated, it can either be sent to a Certificate +Authority for signing or used to generate a self-signed certificate. + +Creating a self-signed certificate using the OpenSSL command-line interface +is illustrated in the example below: + +```None +openssl x509 -req -in ryans-csr.pem -signkey ryans-key.pem -out ryans-cert.pem +``` + +Once the certificate is generated, it can be used to generate a `.pfx` or +`.p12` file: + +```None +openssl pkcs12 -export -in ryans-cert.pem -inkey ryans-key.pem \ + -certfile ca-cert.pem -out ryans.pfx +``` + +Where: + +* `in`: is the signed certificate +* `inkey`: is the associated private key +* `certfile`: is a concatenation of all Certificate Authority (CA) certs into + a single file, e.g. `cat ca1-cert.pem ca2-cert.pem > ca-cert.pem` + +### Perfect Forward Secrecy[#](#tls_perfect_forward_secrecy) + +The term "[Forward Secrecy](https://en.wikipedia.org/wiki/Perfect_forward_secrecy)" or "Perfect Forward Secrecy" describes a feature of +key-agreement (i.e., key-exchange) methods. That is, the server and client keys +are used to negotiate new temporary keys that are used specifically and only for +the current communication session. Practically, this means that even if the +server's private key is compromised, communication can only be decrypted by +eavesdroppers if the attacker manages to obtain the key-pair specifically +generated for the session. + +Perfect Forward Secrecy is achieved by randomly generating a key pair for +key-agreement on every TLS/SSL handshake (in contrast to using the same key for +all sessions). Methods implementing this technique are called "ephemeral". + +Currently two methods are commonly used to achieve Perfect Forward Secrecy (note +the character "E" appended to the traditional abbreviations): + +* [DHE](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange) - An ephemeral version of the Diffie Hellman key-agreement protocol. +* [ECDHE](https://en.wikipedia.org/wiki/Elliptic_curve_Diffie%E2%80%93Hellman) - An ephemeral version of the Elliptic Curve Diffie Hellman + key-agreement protocol. + +Ephemeral methods may have some performance drawbacks, because key generation +is expensive. + +To use Perfect Forward Secrecy using `DHE` with the `tls` module, it is required +to generate Diffie-Hellman parameters and specify them with the `dhparam` +option to [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). The following illustrates the use of +the OpenSSL command-line interface to generate such parameters: + +```None +openssl dhparam -outform PEM -out dhparam.pem 2048 +``` + +If using Perfect Forward Secrecy using `ECDHE`, Diffie-Hellman parameters are +not required and a default ECDHE curve will be used. The `ecdhCurve` property +can be used when creating a TLS Server to specify the list of names of supported +curves to use, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) for more info. + +Perfect Forward Secrecy was optional up to TLSv1.2, but it is not optional for +TLSv1.3, because all TLSv1.3 cipher suites use ECDHE. + +### ALPN and SNI[#](#tls_alpn_and_sni) + +ALPN (Application-Layer Protocol Negotiation Extension) and +SNI (Server Name Indication) are TLS handshake extensions: + +* ALPN - Allows the use of one TLS server for multiple protocols (HTTP, HTTP/2) +* SNI - Allows the use of one TLS server for multiple hostnames with different + SSL certificates. + +### Client-initiated renegotiation attack mitigation[#](#tls_client_initiated_renegotiation_attack_mitigation) + +The TLS protocol allows clients to renegotiate certain aspects of the TLS +session. Unfortunately, session renegotiation requires a disproportionate amount +of server-side resources, making it a potential vector for denial-of-service +attacks. + +To mitigate the risk, renegotiation is limited to three times every ten minutes. +An `'error'` event is emitted on the [`tls.TLSSocket`](#tls_class_tls_tlssocket) instance when this +threshold is exceeded. The limits are configurable: + +* `tls.CLIENT_RENEG_LIMIT` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Specifies the number of renegotiation + requests. **Default:** `3`. +* `tls.CLIENT_RENEG_WINDOW` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Specifies the time renegotiation window + in seconds. **Default:** `600` (10 minutes). + +The default renegotiation limits should not be modified without a full +understanding of the implications and risks. + +TLSv1.3 does not support renegotiation. + +### Session Resumption[#](#tls_session_resumption) + +Establishing a TLS session can be relatively slow. The process can be sped +up by saving and later reusing the session state. There are several mechanisms +to do so, discussed here from oldest to newest (and preferred). + +***Session Identifiers*** Servers generate a unique ID for new connections and +send it to the client. Clients and servers save the session state. When +reconnecting, clients send the ID of their saved session state and if the server +also has the state for that ID, it can agree to use it. Otherwise, the server +will create a new session. See [RFC 2246](https://www.ietf.org/rfc/rfc2246.txt) for more information, page 23 and +30. + +Resumption using session identifiers is supported by most web browsers when +making HTTPS requests. + +For Node.js, clients wait for the [`'session'`](#tls_event_session) event to get the session data, +and provide the data to the `session` option of a subsequent [`tls.connect()`](#tls_tls_connect_options_callback) +to reuse the session. Servers must +implement handlers for the [`'newSession'`](#tls_event_newsession) and [`'resumeSession'`](#tls_event_resumesession) events +to save and restore the session data using the session ID as the lookup key to +reuse sessions. To reuse sessions across load balancers or cluster workers, +servers must use a shared session cache (such as Redis) in their session +handlers. + +***Session Tickets*** The servers encrypt the entire session state and send it +to the client as a "ticket". When reconnecting, the state is sent to the server +in the initial connection. This mechanism avoids the need for server-side +session cache. If the server doesn't use the ticket, for any reason (failure +to decrypt it, it's too old, etc.), it will create a new session and send a new +ticket. See [RFC 5077](https://tools.ietf.org/html/rfc5077) for more information. + +Resumption using session tickets is becoming commonly supported by many web +browsers when making HTTPS requests. + +For Node.js, clients use the same APIs for resumption with session identifiers +as for resumption with session tickets. For debugging, if +[`tls.TLSSocket.getTLSTicket()`](#tls_tlssocket_gettlsticket) returns a value, the session data contains a +ticket, otherwise it contains client-side session state. + +With TLSv1.3, be aware that multiple tickets may be sent by the server, +resulting in multiple `'session'` events, see [`'session'`](#tls_event_session) for more +information. + +Single process servers need no specific implementation to use session tickets. +To use session tickets across server restarts or load balancers, servers must +all have the same ticket keys. There are three 16-byte keys internally, but the +tls API exposes them as a single 48-byte buffer for convenience. + +Its possible to get the ticket keys by calling [`server.getTicketKeys()`](#tls_server_getticketkeys) on +one server instance and then distribute them, but it is more reasonable to +securely generate 48 bytes of secure random data and set them with the +`ticketKeys` option of [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener). The keys should be regularly +regenerated and server's keys can be reset with +[`server.setTicketKeys()`](#tls_server_setticketkeys_keys). + +Session ticket keys are cryptographic keys, and they ***must be stored +securely***. With TLS 1.2 and below, if they are compromised all sessions that +used tickets encrypted with them can be decrypted. They should not be stored +on disk, and they should be regenerated regularly. + +If clients advertise support for tickets, the server will send them. The +server can disable tickets by supplying +`require('constants').SSL_OP_NO_TICKET` in `secureOptions`. + +Both session identifiers and session tickets timeout, causing the server to +create new sessions. The timeout can be configured with the `sessionTimeout` +option of [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener). + +For all the mechanisms, when resumption fails, servers will create new sessions. +Since failing to resume the session does not cause TLS/HTTPS connection +failures, it is easy to not notice unnecessarily poor TLS performance. The +OpenSSL CLI can be used to verify that servers are resuming sessions. Use the +`-reconnect` option to `openssl s_client`, for example: + +```None +$ openssl s_client -connect localhost:443 -reconnect +``` + +Read through the debug output. The first connection should say "New", for +example: + +```None +New, TLSv1.2, Cipher is ECDHE-RSA-AES128-GCM-SHA256 +``` + +Subsequent connections should say "Reused", for example: + +```None +Reused, TLSv1.2, Cipher is ECDHE-RSA-AES128-GCM-SHA256 +``` + +## Modifying the Default TLS Cipher suite[#](#tls_modifying_the_default_tls_cipher_suite) + +Node.js is built with a default suite of enabled and disabled TLS ciphers. +Currently, the default cipher suite is: + +```None +TLS_AES_256_GCM_SHA384: +TLS_CHACHA20_POLY1305_SHA256: +TLS_AES_128_GCM_SHA256: +ECDHE-RSA-AES128-GCM-SHA256: +ECDHE-ECDSA-AES128-GCM-SHA256: +ECDHE-RSA-AES256-GCM-SHA384: +ECDHE-ECDSA-AES256-GCM-SHA384: +DHE-RSA-AES128-GCM-SHA256: +ECDHE-RSA-AES128-SHA256: +DHE-RSA-AES128-SHA256: +ECDHE-RSA-AES256-SHA384: +DHE-RSA-AES256-SHA384: +ECDHE-RSA-AES256-SHA256: +DHE-RSA-AES256-SHA256: +HIGH: +!aNULL: +!eNULL: +!EXPORT: +!DES: +!RC4: +!MD5: +!PSK: +!SRP: +!CAMELLIA +``` + +This default can be replaced entirely using the [`--tls-cipher-list`](cli.html#cli_tls_cipher_list_list) command +line switch (directly, or via the [`NODE_OPTIONS`](cli.html#cli_node_options_options) environment variable). For +instance, the following makes `ECDHE-RSA-AES128-GCM-SHA256:!RC4` the default TLS +cipher suite: + +```None +node --tls-cipher-list="ECDHE-RSA-AES128-GCM-SHA256:!RC4" server.js + +export NODE_OPTIONS=--tls-cipher-list="ECDHE-RSA-AES128-GCM-SHA256:!RC4" +node server.js +``` + +The default can also be replaced on a per client or server basis using the +`ciphers` option from [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options), which is also available +in [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener), [`tls.connect()`](#tls_tls_connect_options_callback), and when creating new +[`tls.TLSSocket`](#tls_class_tls_tlssocket)s. + +The ciphers list can contain a mixture of TLSv1.3 cipher suite names, the ones +that start with `'TLS_'`, and specifications for TLSv1.2 and below cipher +suites. The TLSv1.2 ciphers support a legacy specification format, consult +the OpenSSL [cipher list format](https://www.openssl.org/docs/man1.1.1/man1/ciphers.html#CIPHER-LIST-FORMAT) documentation for details, but those +specifications do *not* apply to TLSv1.3 ciphers. The TLSv1.3 suites can only +be enabled by including their full name in the cipher list. They cannot, for +example, be enabled or disabled by using the legacy TLSv1.2 `'EECDH'` or +`'!EECDH'` specification. + +Despite the relative order of TLSv1.3 and TLSv1.2 cipher suites, the TLSv1.3 +protocol is significantly more secure than TLSv1.2, and will always be chosen +over TLSv1.2 if the handshake indicates it is supported, and if any TLSv1.3 +cipher suites are enabled. + +The default cipher suite included within Node.js has been carefully +selected to reflect current security best practices and risk mitigation. +Changing the default cipher suite can have a significant impact on the security +of an application. The `--tls-cipher-list` switch and `ciphers` option should by +used only if absolutely necessary. + +The default cipher suite prefers GCM ciphers for [Chrome's 'modern +cryptography' setting](https://www.chromium.org/Home/chromium-security/education/tls#TOC-Cipher-Suites) and also prefers ECDHE and DHE ciphers for Perfect +Forward Secrecy, while offering *some* backward compatibility. + +128 bit AES is preferred over 192 and 256 bit AES in light of [specific +attacks affecting larger AES key sizes](https://www.schneier.com/blog/archives/2009/07/another_new_aes.html). + +Old clients that rely on insecure and deprecated RC4 or DES-based ciphers +(like Internet Explorer 6) cannot complete the handshaking process with +the default configuration. If these clients *must* be supported, the +[TLS recommendations](https://wiki.mozilla.org/Security/Server_Side_TLS) may offer a compatible cipher suite. For more details +on the format, see the OpenSSL [cipher list format](https://www.openssl.org/docs/man1.1.1/man1/ciphers.html#CIPHER-LIST-FORMAT) documentation. + +There are only 5 TLSv1.3 cipher suites: + +* `'TLS_AES_256_GCM_SHA384'` +* `'TLS_CHACHA20_POLY1305_SHA256'` +* `'TLS_AES_128_GCM_SHA256'` +* `'TLS_AES_128_CCM_SHA256'` +* `'TLS_AES_128_CCM_8_SHA256'` + +The first 3 are enabled by default. The last 2 `CCM`-based suites are supported +by TLSv1.3 because they may be more performant on constrained systems, but they +are not enabled by default since they offer less security. + +## Class: tls.Server[#](#tls_class_tls_server) + +Added in: v0.3.2 + +The `tls.Server` class is a subclass of `net.Server` that accepts encrypted +connections using TLS or SSL. + +### Event: 'newSession'[#](#tls_event_newsession) + +Added in: v0.9.2 + +The `'newSession'` event is emitted upon creation of a new TLS session. This may +be used to store sessions in external storage. The data should be provided to +the [`'resumeSession'`](#tls_event_resumesession) callback. + +The listener callback is passed three arguments when called: + +* `sessionId` [](buffer.html#buffer_class_buffer) The TLS session identifier +* `sessionData` [](buffer.html#buffer_class_buffer) The TLS session data +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function taking no arguments that must be + invoked in order for data to be sent or received over the secure connection. + +Listening for this event will have an effect only on connections established +after the addition of the event listener. + +### Event: 'OCSPRequest'[#](#tls_event_ocsprequest) + +Added in: v0.11.13 + +The `'OCSPRequest'` event is emitted when the client sends a certificate status +request. The listener callback is passed three arguments when called: + +* `certificate` [](buffer.html#buffer_class_buffer) The server certificate +* `issuer` [](buffer.html#buffer_class_buffer) The issuer's certificate +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function that must be invoked to provide + the results of the OCSP request. + +The server's current certificate can be parsed to obtain the OCSP URL +and certificate ID; after obtaining an OCSP response, `callback(null, resp)` is +then invoked, where `resp` is a `Buffer` instance containing the OCSP response. +Both `certificate` and `issuer` are `Buffer` DER-representations of the +primary and issuer's certificates. These can be used to obtain the OCSP +certificate ID and OCSP endpoint URL. + +Alternatively, `callback(null, null)` may be called, indicating that there was +no OCSP response. + +Calling `callback(err)` will result in a `socket.destroy(err)` call. + +The typical flow of an OCSP Request is as follows: + +1. Client connects to the server and sends an `'OCSPRequest'` (via the status + info extension in ClientHello). +2. Server receives the request and emits the `'OCSPRequest'` event, calling the + listener if registered. +3. Server extracts the OCSP URL from either the `certificate` or `issuer` and + performs an [OCSP request](https://en.wikipedia.org/wiki/OCSP_stapling) to the CA. +4. Server receives `'OCSPResponse'` from the CA and sends it back to the client + via the `callback` argument +5. Client validates the response and either destroys the socket or performs a + handshake. + +The `issuer` can be `null` if the certificate is either self-signed or the +issuer is not in the root certificates list. (An issuer may be provided +via the `ca` option when establishing the TLS connection.) + +Listening for this event will have an effect only on connections established +after the addition of the event listener. + +An npm module like [asn1.js](https://www.npmjs.com/package/asn1.js) may be used to parse the certificates. + +### Event: 'resumeSession'[#](#tls_event_resumesession) + +Added in: v0.9.2 + +The `'resumeSession'` event is emitted when the client requests to resume a +previous TLS session. The listener callback is passed two arguments when +called: + +* `sessionId` [](buffer.html#buffer_class_buffer) The TLS session identifier +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function to be called when the prior session + has been recovered: `callback([err[, sessionData]])` + + + `err` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) + + `sessionData` [](buffer.html#buffer_class_buffer) + +The event listener should perform a lookup in external storage for the +`sessionData` saved by the [`'newSession'`](#tls_event_newsession) event handler using the given +`sessionId`. If found, call `callback(null, sessionData)` to resume the session. +If not found, the session cannot be resumed. `callback()` must be called +without `sessionData` so that the handshake can continue and a new session can +be created. It is possible to call `callback(err)` to terminate the incoming +connection and destroy the socket. + +Listening for this event will have an effect only on connections established +after the addition of the event listener. + +The following illustrates resuming a TLS session: + +```None +const tlsSessionStore = {}; +server.on('newSession', (id, data, cb) => { + tlsSessionStore[id.toString('hex')] = data; + cb(); +}); +server.on('resumeSession', (id, cb) => { + cb(null, tlsSessionStore[id.toString('hex')] || null); +}); +``` + +### Event: 'secureConnection'[#](#tls_event_secureconnection) + +Added in: v0.3.2 + +The `'secureConnection'` event is emitted after the handshaking process for a +new connection has successfully completed. The listener callback is passed a +single argument when called: + +* `tlsSocket` [](tls.html#tls_class_tls_tlssocket) The established TLS socket. + +The `tlsSocket.authorized` property is a `boolean` indicating whether the +client has been verified by one of the supplied Certificate Authorities for the +server. If `tlsSocket.authorized` is `false`, then `socket.authorizationError` +is set to describe how authorization failed. Note that depending on the settings +of the TLS server, unauthorized connections may still be accepted. + +The `tlsSocket.alpnProtocol` property is a string that contains the selected +ALPN protocol. When ALPN has no selected protocol, `tlsSocket.alpnProtocol` +equals `false`. + +The `tlsSocket.servername` property is a string containing the server name +requested via SNI. + +### Event: 'tlsClientError'[#](#tls_event_tlsclienterror) + +Added in: v6.0.0 + +The `'tlsClientError'` event is emitted when an error occurs before a secure +connection is established. The listener callback is passed two arguments when +called: + +* `exception` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) The `Error` object describing the error +* `tlsSocket` [](tls.html#tls_class_tls_tlssocket) The `tls.TLSSocket` instance from which the + error originated. + +### server.addContext(hostname, context)[#](#tls_server_addcontext_hostname_context) + +Added in: v0.5.3 + +* `hostname` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A SNI hostname or wildcard (e.g. `'*'`) +* `context` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) An object containing any of the possible properties + from the [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) `options` arguments (e.g. `key`, + `cert`, `ca`, etc). + +The `server.addContext()` method adds a secure context that will be used if +the client request's SNI name matches the supplied `hostname` (or wildcard). + +### server.address()[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/net.js#L1460)[#](#tls_server_address) + +Added in: v0.6.0 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + +Returns the bound address, the address family name, and port of the +server as reported by the operating system. See [`net.Server.address()`](net.html#net_server_address) for +more information. + +### server.close([callback])[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/net.js#L1546)[#](#tls_server_close_callback) + +Added in: v0.3.2 + +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A listener callback that will be registered to listen + for the server instance's `'close'` event. +* Returns: [](tls.html#tls_class_tls_server) + +The `server.close()` method stops the server from accepting new connections. + +This function operates asynchronously. The `'close'` event will be emitted +when the server has no more open connections. + +### server.connections[#](#tls_server_connections) + +Added in: v0.3.2Deprecated since: v0.9.7 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`server.getConnections()`](net.html#net_server_getconnections_callback) instead. + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Returns the current number of concurrent connections on the server. + +### server.getTicketKeys()[#](#tls_server_getticketkeys) + +Added in: v3.0.0 + +* Returns: [](buffer.html#buffer_class_buffer) A 48-byte buffer containing the session ticket keys. + +Returns the session ticket keys. + +See [Session Resumption](#tls_session_resumption) for more information. + +### server.listen()[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/net.js#L1339)[#](#tls_server_listen) + +Starts the server listening for encrypted connections. +This method is identical to [`server.listen()`](net.html#net_server_listen) from [`net.Server`](net.html#net_class_net_server). + +### server.setSecureContext(options)[#](#tls_server_setsecurecontext_options) + +Added in: v11.0.0 + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) An object containing any of the possible properties from + the [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) `options` arguments (e.g. `key`, `cert`, + `ca`, etc). + +The `server.setSecureContext()` method replaces the secure context of an +existing server. Existing connections to the server are not interrupted. + +### server.setTicketKeys(keys)[#](#tls_server_setticketkeys_keys) + +Added in: v3.0.0 + +* `keys` [](buffer.html#buffer_class_buffer) A 48-byte buffer containing the session ticket keys. + +Sets the session ticket keys. + +Changes to the ticket keys are effective only for future server connections. +Existing or currently pending server connections will use the previous keys. + +See [Session Resumption](#tls_session_resumption) for more information. + +## Class: tls.TLSSocket[#](#tls_class_tls_tlssocket) + +Added in: v0.11.4 + +The `tls.TLSSocket` is a subclass of [`net.Socket`](net.html#net_class_net_socket) that performs transparent +encryption of written data and all required TLS negotiation. + +Instances of `tls.TLSSocket` implement the duplex [Stream](stream.html#stream_stream) interface. + +Methods that return TLS connection metadata (e.g. +[`tls.TLSSocket.getPeerCertificate()`](#tls_tlssocket_getpeercertificate_detailed) will only return data while the +connection is open. + +### new tls.TLSSocket(socket[, options])[#](#tls_new_tls_tlssocket_socket_options) + +History + +| Version | Changes | +| --- | --- | +| v5.0.0 | ALPN options are supported now. | +| v0.11.4 | Added in: v0.11.4 | + +* `socket` [](net.html#net_class_net_socket) | [](stream.html#stream_class_stream_duplex) + On the server side, any `Duplex` stream. On the client side, any + instance of [`net.Socket`](net.html#net_class_net_socket) (for generic `Duplex` stream support + on the client side, [`tls.connect()`](#tls_tls_connect_options_callback) must be used). +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `isServer`: The SSL/TLS protocol is asymmetrical, TLSSockets must know if + they are to behave as a server or a client. If `true` the TLS socket will be + instantiated as a server. **Default:** `false`. + + `server` [](net.html#net_class_net_server) A [`net.Server`](net.html#net_class_net_server) instance. + + `requestCert`: Whether to authenticate the remote peer by requesting a + certificate. Clients always request a server certificate. Servers + (`isServer` is true) may set `requestCert` to true to request a client + certificate. + + `rejectUnauthorized`: See [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `ALPNProtocols`: See [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `SNICallback`: See [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `session` [](buffer.html#buffer_class_buffer) A `Buffer` instance containing a TLS session. + + `requestOCSP` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true`, specifies that the OCSP status request + extension will be added to the client hello and an `'OCSPResponse'` event + will be emitted on the socket before establishing a secure communication + + `secureContext`: TLS context object created with + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). If a `secureContext` is *not* provided, one + will be created by passing the entire `options` object to + `tls.createSecureContext()`. + + ...: [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) options that are used if the + `secureContext` option is missing. Otherwise, they are ignored. + +Construct a new `tls.TLSSocket` object from an existing TCP socket. + +### Event: 'OCSPResponse'[#](#tls_event_ocspresponse) + +Added in: v0.11.13 + +The `'OCSPResponse'` event is emitted if the `requestOCSP` option was set +when the `tls.TLSSocket` was created and an OCSP response has been received. +The listener callback is passed a single argument when called: + +* `response` [](buffer.html#buffer_class_buffer) The server's OCSP response + +Typically, the `response` is a digitally signed object from the server's CA that +contains information about server's certificate revocation status. + +### Event: 'secureConnect'[#](#tls_event_secureconnect) + +Added in: v0.11.4 + +The `'secureConnect'` event is emitted after the handshaking process for a new +connection has successfully completed. The listener callback will be called +regardless of whether or not the server's certificate has been authorized. It +is the client's responsibility to check the `tlsSocket.authorized` property to +determine if the server certificate was signed by one of the specified CAs. If +`tlsSocket.authorized === false`, then the error can be found by examining the +`tlsSocket.authorizationError` property. If ALPN was used, the +`tlsSocket.alpnProtocol` property can be checked to determine the negotiated +protocol. + +### Event: 'session'[#](#tls_event_session) + +Added in: v11.10.0 + +* `session` [](buffer.html#buffer_class_buffer) + +The `'session'` event is emitted on a client `tls.TLSSocket` when a new session +or TLS ticket is available. This may or may not be before the handshake is +complete, depending on the TLS protocol version that was negotiated. The event +is not emitted on the server, or if a new session was not created, for example, +when the connection was resumed. For some TLS protocol versions the event may be +emitted multiple times, in which case all the sessions can be used for +resumption. + +On the client, the `session` can be provided to the `session` option of +[`tls.connect()`](#tls_tls_connect_options_callback) to resume the connection. + +See [Session Resumption](#tls_session_resumption) for more information. + +Note: For TLSv1.2 and below, [`tls.TLSSocket.getSession()`](#tls_tlssocket_getsession) can be called once +the handshake is complete. For TLSv1.3, only ticket based resumption is allowed +by the protocol, multiple tickets are sent, and the tickets aren't sent until +later, after the handshake completes, so it is necessary to wait for the +`'session'` event to get a resumable session. Applications are +recommended to use the `'session'` event instead of `getSession()` to ensure +they will work for all TLS protocol versions. Applications that only expect to +get or use 1 session should listen for this event only once: + +```None +tlsSocket.once('session', (session) => { + // The session can be used immediately or later. + tls.connect({ + session: session, + // Other connect options... + }); +}); +``` + +### tlsSocket.address()[#](#tls_tlssocket_address) + +Added in: v0.11.4 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + +Returns the bound `address`, the address `family` name, and `port` of the +underlying socket as reported by the operating system: +`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`. + +### tlsSocket.authorizationError[#](#tls_tlssocket_authorizationerror) + +Added in: v0.11.4 + +Returns the reason why the peer's certificate was not been verified. This +property is set only when `tlsSocket.authorized === false`. + +### tlsSocket.authorized[#](#tls_tlssocket_authorized) + +Added in: v0.11.4 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +Returns `true` if the peer certificate was signed by one of the CAs specified +when creating the `tls.TLSSocket` instance, otherwise `false`. + +### tlsSocket.disableRenegotiation()[#](#tls_tlssocket_disablerenegotiation) + +Added in: v8.4.0 + +Disables TLS renegotiation for this `TLSSocket` instance. Once called, attempts +to renegotiate will trigger an `'error'` event on the `TLSSocket`. + +### tlsSocket.encrypted[#](#tls_tlssocket_encrypted) + +Added in: v0.11.4 + +Always returns `true`. This may be used to distinguish TLS sockets from regular +`net.Socket` instances. + +### tlsSocket.getCertificate()[#](#tls_tlssocket_getcertificate) + +Added in: v11.2.0 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + +Returns an object representing the local certificate. The returned object has +some properties corresponding to the fields of the certificate. + +See [`tls.TLSSocket.getPeerCertificate()`](#tls_tlssocket_getpeercertificate_detailed) for an example of the certificate +structure. + +If there is no local certificate, an empty object will be returned. If the +socket has been destroyed, `null` will be returned. + +### tlsSocket.getCipher()[#](#tls_tlssocket_getcipher) + +Added in: v0.11.4 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + +Returns an object representing the cipher name. The `version` key is a legacy +field which always contains the value `'TLSv1/SSLv3'`. + +For example: `{ name: 'AES256-SHA', version: 'TLSv1.2' }`. + +See `SSL_CIPHER_get_name()` in + for more +information. + +### tlsSocket.getEphemeralKeyInfo()[#](#tls_tlssocket_getephemeralkeyinfo) + +Added in: v5.0.0 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + +Returns an object representing the type, name, and size of parameter of +an ephemeral key exchange in [Perfect Forward Secrecy](#tls_perfect_forward_secrecy) on a client +connection. It returns an empty object when the key exchange is not +ephemeral. As this is only supported on a client socket; `null` is returned +if called on a server socket. The supported types are `'DH'` and `'ECDH'`. The +`name` property is available only when type is `'ECDH'`. + +For example: `{ type: 'ECDH', name: 'prime256v1', size: 256 }`. + +### tlsSocket.getFinished()[#](#tls_tlssocket_getfinished) + +Added in: v9.9.0 + +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type) The latest `Finished` message that has been + sent to the socket as part of a SSL/TLS handshake, or `undefined` if + no `Finished` message has been sent yet. + +As the `Finished` messages are message digests of the complete handshake +(with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can +be used for external authentication procedures when the authentication +provided by SSL/TLS is not desired or is not enough. + +Corresponds to the `SSL_get_finished` routine in OpenSSL and may be used +to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929). + +### tlsSocket.getPeerCertificate([detailed])[#](#tls_tlssocket_getpeercertificate_detailed) + +Added in: v0.11.4 + +* `detailed` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Include the full certificate chain if `true`, otherwise + include just the peer's certificate. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) A certificate object. + +Returns an object representing the peer's certificate. If the peer does not +provide a certificate, an empty object will be returned. If the socket has been +destroyed, `null` will be returned. + +If the full certificate chain was requested, each certificate will include an +`issuerCertificate` property containing an object representing its issuer's +certificate. + +#### Certificate Object[#](#tls_certificate_object) + +History + +| Version | Changes | +| --- | --- | +| v11.4.0 | Support Elliptic Curve public key info. | + +A certificate object has properties corresponding to the fields of the +certificate. + +* `raw` [](buffer.html#buffer_class_buffer) The DER encoded X.509 certificate data. +* `subject` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) The certificate subject, described in terms of + Country (`C:`), StateOrProvince (`ST`), Locality (`L`), Organization (`O`), + OrganizationalUnit (`OU`), and CommonName (`CN`). The CommonName is typically + a DNS name with TLS certificates. Example: + `{C: 'UK', ST: 'BC', L: 'Metro', O: 'Node Fans', OU: 'Docs', CN: 'example.com'}`. +* `issuer` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) The certificate issuer, described in the same terms as the + `subject`. +* `valid_from` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The date-time the certificate is valid from. +* `valid_to` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The date-time the certificate is valid to. +* `serialNumber` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The certificate serial number, as a hex string. + Example: `'B9B0D332A1AA5635'`. +* `fingerprint` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The SHA-1 digest of the DER encoded certificate. It is + returned as a `:` separated hexadecimal string. Example: `'2A:7A:C2:DD:...'`. +* `fingerprint256` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The SHA-256 digest of the DER encoded certificate. + It is returned as a `:` separated hexadecimal string. Example: + `'2A:7A:C2:DD:...'`. +* `ext_key_usage` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) (Optional) The extended key usage, a set of OIDs. +* `subjectaltname` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) (Optional) An array of names for the subject, an + alternative to the `subject` names. +* `infoAccess` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) (Optional) An array describing the AuthorityInfoAccess, + used with OCSP. +* `issuerCertificate` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) (Optional) The issuer certificate object. For + self-signed certificates, this may be a circular reference. + +The certificate may contain information about the public key, depending on +the key type. + +For RSA keys, the following properties may be defined: + +* `bits` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The RSA bit size. Example: `1024`. +* `exponent` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The RSA exponent, as a string in hexadecimal number + notation. Example: `'0x010001'`. +* `modulus` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The RSA modulus, as a hexadecimal string. Example: + `'B56CE45CB7...'`. +* `pubkey` [](buffer.html#buffer_class_buffer) The public key. + +For EC keys, the following properties may be defined: + +* `pubkey` [](buffer.html#buffer_class_buffer) The public key. +* `bits` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The key size in bits. Example: `256`. +* `asn1Curve` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) (Optional) The ASN.1 name of the OID of the elliptic + curve. Well-known curves are identified by an OID. While it is unusual, it is + possible that the curve is identified by its mathematical properties, in which + case it will not have an OID. Example: `'prime256v1'`. +* `nistCurve` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) (Optional) The NIST name for the elliptic curve, if it + has one (not all well-known curves have been assigned names by NIST). Example: + `'P-256'`. + +Example certificate: + +```None +{ subject: + { OU: [ 'Domain Control Validated', 'PositiveSSL Wildcard' ], + CN: '*.nodejs.org' }, + issuer: + { C: 'GB', + ST: 'Greater Manchester', + L: 'Salford', + O: 'COMODO CA Limited', + CN: 'COMODO RSA Domain Validation Secure Server CA' }, + subjectaltname: 'DNS:*.nodejs.org, DNS:nodejs.org', + infoAccess: + { 'CA Issuers - URI': + [ 'http://crt.comodoca.com/COMODORSADomainValidationSecureServerCA.crt' ], + 'OCSP - URI': [ 'http://ocsp.comodoca.com' ] }, + modulus: 'B56CE45CB740B09A13F64AC543B712FF9EE8E4C284B542A1708A27E82A8D151CA178153E12E6DDA15BF70FFD96CB8A88618641BDFCCA03527E665B70D779C8A349A6F88FD4EF6557180BD4C98192872BCFE3AF56E863C09DDD8BC1EC58DF9D94F914F0369102B2870BECFA1348A0838C9C49BD1C20124B442477572347047506B1FCD658A80D0C44BCC16BC5C5496CFE6E4A8428EF654CD3D8972BF6E5BFAD59C93006830B5EB1056BBB38B53D1464FA6E02BFDF2FF66CD949486F0775EC43034EC2602AEFBF1703AD221DAA2A88353C3B6A688EFE8387811F645CEED7B3FE46E1F8B9F59FAD028F349B9BC14211D5830994D055EEA3D547911E07A0ADDEB8A82B9188E58720D95CD478EEC9AF1F17BE8141BE80906F1A339445A7EB5B285F68039B0F294598A7D1C0005FC22B5271B0752F58CCDEF8C8FD856FB7AE21C80B8A2CE983AE94046E53EDE4CB89F42502D31B5360771C01C80155918637490550E3F555E2EE75CC8C636DDE3633CFEDD62E91BF0F7688273694EEEBA20C2FC9F14A2A435517BC1D7373922463409AB603295CEB0BB53787A334C9CA3CA8B30005C5A62FC0715083462E00719A8FA3ED0A9828C3871360A73F8B04A4FC1E71302844E9BB9940B77E745C9D91F226D71AFCAD4B113AAF68D92B24DDB4A2136B55A1CD1ADF39605B63CB639038ED0F4C987689866743A68769CC55847E4A06D6E2E3F1', + exponent: '0x10001', + pubkey: , + valid_from: 'Aug 14 00:00:00 2017 GMT', + valid_to: 'Nov 20 23:59:59 2019 GMT', + fingerprint: '01:02:59:D9:C3:D2:0D:08:F7:82:4E:44:A4:B4:53:C5:E2:3A:87:4D', + fingerprint256: '69:AE:1A:6A:D4:3D:C6:C1:1B:EA:C6:23:DE:BA:2A:14:62:62:93:5C:7A:EA:06:41:9B:0B:BC:87:CE:48:4E:02', + ext_key_usage: [ '1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2' ], + serialNumber: '66593D57F20CBC573E433381B5FEC280', + raw: } +``` + +### tlsSocket.getPeerFinished()[#](#tls_tlssocket_getpeerfinished) + +Added in: v9.9.0 + +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type) The latest `Finished` message that is expected + or has actually been received from the socket as part of a SSL/TLS handshake, + or `undefined` if there is no `Finished` message so far. + +As the `Finished` messages are message digests of the complete handshake +(with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can +be used for external authentication procedures when the authentication +provided by SSL/TLS is not desired or is not enough. + +Corresponds to the `SSL_get_peer_finished` routine in OpenSSL and may be used +to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929). + +### tlsSocket.getProtocol()[#](#tls_tlssocket_getprotocol) + +Added in: v5.7.0 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Null_type) + +Returns a string containing the negotiated SSL/TLS protocol version of the +current connection. The value `'unknown'` will be returned for connected +sockets that have not completed the handshaking process. The value `null` will +be returned for server sockets or disconnected client sockets. + +Protocol versions are: + +* `'SSLv3'` +* `'TLSv1'` +* `'TLSv1.1'` +* `'TLSv1.2'` +* `'TLSv1.3'` + +See for more +information. + +### tlsSocket.getSession()[#](#tls_tlssocket_getsession) + +Added in: v0.11.4 + +* [](buffer.html#buffer_class_buffer) + +Returns the TLS session data or `undefined` if no session was +negotiated. On the client, the data can be provided to the `session` option of +[`tls.connect()`](#tls_tls_connect_options_callback) to resume the connection. On the server, it may be useful +for debugging. + +See [Session Resumption](#tls_session_resumption) for more information. + +Note: `getSession()` works only for TLSv1.2 and below. For TLSv1.3, applications +must use the [`'session'`](#tls_event_session) event (it also works for TLSv1.2 and below). + +### tlsSocket.getTLSTicket()[#](#tls_tlssocket_gettlsticket) + +Added in: v0.11.4 + +* [](buffer.html#buffer_class_buffer) + +For a client, returns the TLS session ticket if one is available, or +`undefined`. For a server, always returns `undefined`. + +It may be useful for debugging. + +See [Session Resumption](#tls_session_resumption) for more information. + +### tlsSocket.isSessionReused()[#](#tls_tlssocket_issessionreused) + +Added in: v0.5.6 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` if the session was reused, `false` otherwise. + +See [Session Resumption](#tls_session_resumption) for more information. + +### tlsSocket.localAddress[#](#tls_tlssocket_localaddress) + +Added in: v0.11.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the string representation of the local IP address. + +### tlsSocket.localPort[#](#tls_tlssocket_localport) + +Added in: v0.11.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Returns the numeric representation of the local port. + +### tlsSocket.remoteAddress[#](#tls_tlssocket_remoteaddress) + +Added in: v0.11.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the string representation of the remote IP address. For example, +`'74.125.127.100'` or `'2001:4860:a005::68'`. + +### tlsSocket.remoteFamily[#](#tls_tlssocket_remotefamily) + +Added in: v0.11.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns the string representation of the remote IP family. `'IPv4'` or `'IPv6'`. + +### tlsSocket.remotePort[#](#tls_tlssocket_remoteport) + +Added in: v0.11.4 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) + +Returns the numeric representation of the remote port. For example, `443`. + +### tlsSocket.renegotiate(options, callback)[#](#tls_tlssocket_renegotiate_options_callback) + +Added in: v0.11.8 + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If not `false`, the server certificate is + verified against the list of supplied CAs. An `'error'` event is emitted if + verification fails; `err.code` contains the OpenSSL error code. **Default:** + `true`. + + `requestCert` +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) If `renegotiate()` returned `true`, callback is + attached once to the `'secure'` event. If it returned `false`, it will be + called in the next tick with `ERR_TLS_RENEGOTIATE`, unless the `tlsSocket` + has been destroyed, in which case it will not be called at all. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` if renegotiation was initiated, `false` otherwise. + +The `tlsSocket.renegotiate()` method initiates a TLS renegotiation process. +Upon completion, the `callback` function will be passed a single argument +that is either an `Error` (if the request failed) or `null`. + +This method can be used to request a peer's certificate after the secure +connection has been established. + +When running as the server, the socket will be destroyed with an error after +`handshakeTimeout` timeout. + +For TLSv1.3, renegotiation cannot be initiated, it is not supported by the +protocol. + +### tlsSocket.setMaxSendFragment(size)[#](#tls_tlssocket_setmaxsendfragment_size) + +Added in: v0.11.11 + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The maximum TLS fragment size. The maximum value is `16384`. + **Default:** `16384`. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +The `tlsSocket.setMaxSendFragment()` method sets the maximum TLS fragment size. +Returns `true` if setting the limit succeeded; `false` otherwise. + +Smaller fragment sizes decrease the buffering latency on the client: larger +fragments are buffered by the TLS layer until the entire fragment is received +and its integrity is verified; large fragments can span multiple roundtrips +and their processing can be delayed due to packet loss or reordering. However, +smaller fragments add extra TLS framing bytes and CPU overhead, which may +decrease overall server throughput. + +## tls.checkServerIdentity(hostname, cert)[[src]](https://github.com/nodejs/node/blob/v11.15.0^0/lib/tls.js#L189)[#](#tls_tls_checkserveridentity_hostname_cert) + +Added in: v0.8.4 + +* `hostname` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The host name or IP address to verify the certificate + against. +* `cert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) A [certificate object](#tls_certificate_object) representing the peer's certificate. +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type) + +Verifies the certificate `cert` is issued to `hostname`. + +Returns [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object, populating it with `reason`, `host`, and `cert` on +failure. On success, returns [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type). + +This function can be overwritten by providing alternative function as part of +the `options.checkServerIdentity` option passed to `tls.connect()`. The +overwriting function can call `tls.checkServerIdentity()` of course, to augment +the checks done with additional verification. + +This function is only called if the certificate passed all other checks, such as +being issued by trusted CA (`options.ca`). + +## tls.connect(options[, callback])[#](#tls_tls_connect_options_callback) + +History + +| Version | Changes | +| --- | --- | +| v11.8.0 | The `timeout` option is supported now. | +| v8.0.0 | The `lookup` option is supported now. | +| v8.0.0 | The `ALPNProtocols` option can be a `TypedArray` or `DataView` now. | +| v5.3.0, v4.7.0 | The `secureContext` option is supported now. | +| v5.0.0 | ALPN options are supported now. | +| v0.11.3 | Added in: v0.11.3 | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `host` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Host the client should connect to. **Default:** + `'localhost'`. + + `port` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Port the client should connect to. + + `path` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Creates unix socket connection to path. If this option is + specified, `host` and `port` are ignored. + + `socket` [](stream.html#stream_class_stream_duplex) Establish secure connection on a given socket + rather than creating a new socket. Typically, this is an instance of + [`net.Socket`](net.html#net_class_net_socket), but any `Duplex` stream is allowed. + If this option is specified, `path`, `host` and `port` are ignored, + except for certificate validation. Usually, a socket is already connected + when passed to `tls.connect()`, but it can be connected later. Note that + connection/disconnection/destruction of `socket` is the user's + responsibility, calling `tls.connect()` will not cause `net.connect()` to be + called. + + `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If not `false`, the server certificate is + verified against the list of supplied CAs. An `'error'` event is emitted if + verification fails; `err.code` contains the OpenSSL error code. **Default:** + `true`. + + `ALPNProtocols`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) + An array of strings, `Buffer`s or `TypedArray`s or `DataView`s, or a + single `Buffer` or `TypedArray` or `DataView` containing the supported ALPN + protocols. `Buffer`s should have the format `[len][name][len][name]...` + e.g. `'\x08http/1.1\x08http/1.0'`, where the `len` byte is the length of the + next protocol name. Passing an array is usually much simpler, e.g. + `['http/1.1', 'http/1.0']`. Protocols earlier in the list have higher + preference than those later. + + `servername`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Server name for the SNI (Server Name Indication) TLS + extension. It is the name of the host being connected to, and must be a host + name, and not an IP address. It can be used by a multi-homed server to + choose the correct certificate to present to the client, see the + `SNICallback` option to [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener). + + `checkServerIdentity(servername, cert)` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function + to be used (instead of the builtin `tls.checkServerIdentity()` function) + when checking the server's hostname (or the provided `servername` when + explicitly set) against the certificate. This should return an [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) if + verification fails. The method should return `undefined` if the `servername` + and `cert` are verified. + + `session` [](buffer.html#buffer_class_buffer) A `Buffer` instance, containing TLS session. + + `minDHSize` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Minimum size of the DH parameter in bits to accept a + TLS connection. When a server offers a DH parameter with a size less + than `minDHSize`, the TLS connection is destroyed and an error is thrown. + **Default:** `1024`. + + `secureContext`: TLS context object created with + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). If a `secureContext` is *not* provided, one + will be created by passing the entire `options` object to + `tls.createSecureContext()`. + + `lookup`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Custom lookup function. **Default:** + [`dns.lookup()`](dns.html#dns_dns_lookup_hostname_options_callback). + + `timeout`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) If set and if a socket is created internally, will call + [`socket.setTimeout(timeout)`](#net_socket_settimeout_timeout_callback) after the socket is created, but before it + starts the connection. + + ...: [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) options that are used if the + `secureContext` option is missing, otherwise they are ignored. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) +* Returns: [](tls.html#tls_class_tls_tlssocket) + +The `callback` function, if specified, will be added as a listener for the +[`'secureConnect'`](#tls_event_secureconnect) event. + +`tls.connect()` returns a [`tls.TLSSocket`](#tls_class_tls_tlssocket) object. + +The following illustrates a client for the echo server example from +[`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener): + +```None +// Assumes an echo server that is listening on port 8000. +const tls = require('tls'); +const fs = require('fs'); + +const options = { + // Necessary only if the server requires client certificate authentication. + key: fs.readFileSync('client-key.pem'), + cert: fs.readFileSync('client-cert.pem'), + + // Necessary only if the server uses a self-signed certificate. + ca: [ fs.readFileSync('server-cert.pem') ], + + // Necessary only if the server's cert isn't for "localhost". + checkServerIdentity: () => { return null; }, +}; + +const socket = tls.connect(8000, options, () => { + console.log('client connected', + socket.authorized ? 'authorized' : 'unauthorized'); + process.stdin.pipe(socket); + process.stdin.resume(); +}); +socket.setEncoding('utf8'); +socket.on('data', (data) => { + console.log(data); +}); +socket.on('end', () => { + console.log('server ends connection'); +}); +``` + +## tls.connect(path[, options][, callback])[#](#tls_tls_connect_path_options_callback) + +Added in: v0.11.3 + +* `path` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Default value for `options.path`. +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) See [`tls.connect()`](#tls_tls_connect_options_callback). +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) See [`tls.connect()`](#tls_tls_connect_options_callback). +* Returns: [](tls.html#tls_class_tls_tlssocket) + +Same as [`tls.connect()`](#tls_tls_connect_options_callback) except that `path` can be provided +as an argument instead of an option. + +A path option, if specified, will take precedence over the path argument. + +## tls.connect(port[, host][, options][, callback])[#](#tls_tls_connect_port_host_options_callback) + +Added in: v0.11.3 + +* `port` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Default value for `options.port`. +* `host` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Default value for `options.host`. +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) See [`tls.connect()`](#tls_tls_connect_options_callback). +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) See [`tls.connect()`](#tls_tls_connect_options_callback). +* Returns: [](tls.html#tls_class_tls_tlssocket) + +Same as [`tls.connect()`](#tls_tls_connect_options_callback) except that `port` and `host` can be provided +as arguments instead of options. + +A port or host option, if specified, will take precedence over any port or host +argument. + +## tls.createSecureContext([options])[#](#tls_tls_createsecurecontext_options) + +History + +| Version | Changes | +| --- | --- | +| v11.15.0 | TLSv1.3 support added. | +| v11.5.0 | The `ca:` option now supports `BEGIN TRUSTED CERTIFICATE`. | +| v11.4.0 | The `minVersion` and `maxVersion` can be used to restrict the allowed TLS protocol versions. | +| v10.0.0 | The `ecdhCurve` cannot be set to `false` anymore due to a change in OpenSSL. | +| v9.3.0 | The `options` parameter can now include `clientCertEngine`. | +| v9.0.0 | The `ecdhCurve` option can now be multiple `':'` separated curve names or `'auto'`. | +| v7.3.0 | If the `key` option is an array, individual entries do not need a `passphrase` property anymore. `Array` entries can also just be `string`s or `Buffer`s now. | +| v5.2.0 | The `ca` option can now be a single string containing multiple CA certificates. | +| v0.11.13 | Added in: v0.11.13 | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `ca` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) Optionally override the trusted CA + certificates. Default is to trust the well-known CAs curated by Mozilla. + Mozilla's CAs are completely replaced when CAs are explicitly specified + using this option. The value can be a string or `Buffer`, or an `Array` of + strings and/or `Buffer`s. Any string or `Buffer` can contain multiple PEM + CAs concatenated together. The peer's certificate must be chainable to a CA + trusted by the server for the connection to be authenticated. When using + certificates that are not chainable to a well-known CA, the certificate's CA + must be explicitly specified as a trusted or the connection will fail to + authenticate. + If the peer uses a certificate that doesn't match or chain to one of the + default CAs, use the `ca` option to provide a CA certificate that the peer's + certificate can match or chain to. + For self-signed certificates, the certificate is its own CA, and must be + provided. + For PEM encoded certificates, supported types are "TRUSTED CERTIFICATE", + "X509 CERTIFICATE", and "CERTIFICATE". + + `cert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) Cert chains in PEM format. One cert + chain should be provided per private key. Each cert chain should consist of + the PEM formatted certificate for a provided private `key`, followed by the + PEM formatted intermediate certificates (if any), in order, and not + including the root CA (the root CA must be pre-known to the peer, see `ca`). + When providing multiple cert chains, they do not have to be in the same + order as their private keys in `key`. If the intermediate certificates are + not provided, the peer will not be able to validate the certificate, and the + handshake will fail. + + `ciphers` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Cipher suite specification, replacing the default. For + more information, see [modifying the default cipher suite](#tls_modifying_the_default_tls_cipher_suite). Permitted + ciphers can be obtained via [`tls.getCiphers()`](#tls_tls_getciphers). Cipher names must be + uppercased in order for OpenSSL to accept them. + + `clientCertEngine` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Name of an OpenSSL engine which can provide the + client certificate. + + `crl` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) PEM formatted CRLs (Certificate + Revocation Lists). + + `dhparam` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) Diffie Hellman parameters, required for + [Perfect Forward Secrecy](#tls_perfect_forward_secrecy). Use `openssl dhparam` to create the parameters. + The key length must be greater than or equal to 1024 bits, otherwise an + error will be thrown. It is strongly recommended to use 2048 bits or larger + for stronger security. If omitted or invalid, the parameters are silently + discarded and DHE ciphers will not be available. + + `ecdhCurve` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A string describing a named curve or a colon separated + list of curve NIDs or names, for example `P-521:P-384:P-256`, to use for + ECDH key agreement. Set to `auto` to select the + curve automatically. Use [`crypto.getCurves()`](crypto.html#crypto_crypto_getcurves) to obtain a list of + available curve names. On recent releases, `openssl ecparam -list_curves` + will also display the name and description of each available elliptic curve. + **Default:** [`tls.DEFAULT_ECDH_CURVE`](#tls_tls_default_ecdh_curve). + + `honorCipherOrder` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Attempt to use the server's cipher suite + preferences instead of the client's. When `true`, causes + `SSL_OP_CIPHER_SERVER_PREFERENCE` to be set in `secureOptions`, see + [OpenSSL Options](crypto.html#crypto_openssl_options) for more information. + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Private keys in PEM format. + PEM allows the option of private keys being encrypted. Encrypted keys will + be decrypted with `options.passphrase`. Multiple keys using different + algorithms can be provided either as an array of unencrypted key strings or + buffers, or an array of objects in the form `{pem: [, passphrase: ]}`. The object form can only occur in an array. + `object.passphrase` is optional. Encrypted keys will be decrypted with + `object.passphrase` if provided, or `options.passphrase` if it is not. + + `maxVersion` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optionally set the maximum TLS version to allow. One + of `TLSv1.3`, `TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified + along with the `secureProtocol` option, use one or the other. + **Default:** [`tls.DEFAULT_MAX_VERSION`](#tls_tls_default_max_version). + + `minVersion` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optionally set the minimum TLS version to allow. One + of `TLSv1.3`, `TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified + along with the `secureProtocol` option, use one or the other. It is not + recommended to use less than TLSv1.2, but it may be required for + interoperability. + **Default:** [`tls.DEFAULT_MIN_VERSION`](#tls_tls_default_min_version). + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Shared passphrase used for a single private key and/or + a PFX. + + `pfx` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) PFX or PKCS12 encoded + private key and certificate chain. `pfx` is an alternative to providing + `key` and `cert` individually. PFX is usually encrypted, if it is, + `passphrase` will be used to decrypt it. Multiple PFX can be provided either + as an array of unencrypted PFX buffers, or an array of objects in the form + `{buf: [, passphrase: ]}`. The object form can only + occur in an array. `object.passphrase` is optional. Encrypted PFX will be + decrypted with `object.passphrase` if provided, or `options.passphrase` if + it is not. + + `secureOptions` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Optionally affect the OpenSSL protocol behavior, + which is not usually necessary. This should be used carefully if at all! + Value is a numeric bitmask of the `SSL_OP_*` options from + [OpenSSL Options](crypto.html#crypto_openssl_options). + + `secureProtocol` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Legacy mechanism to select the TLS protocol + version to use, it does not support independent control of the minimum and + maximum version, and does not support limiting the protocol to TLSv1.3. Use + `minVersion` and `maxVersion` instead. The possible values are listed as + [SSL\_METHODS](https://www.openssl.org/docs/man1.1.1/man7/ssl.html#Dealing-with-Protocol-Methods), use the function names as strings. For example, use + `'TLSv1_1_method'` to force TLS version 1.1, or `'TLS_method'` to allow any + TLS protocol version up to TLSv1.3. It is not recommended to use TLS + versions less than 1.2, but it may be required for interoperability. + **Default:** none, see `minVersion`. + + `sessionIdContext` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Opaque identifier used by servers to ensure + session state is not shared between applications. Unused by clients. + +[`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) sets the default value of the `honorCipherOrder` option +to `true`, other APIs that create secure contexts leave it unset. + +[`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) uses a 128 bit truncated SHA1 hash value generated +from `process.argv` as the default value of the `sessionIdContext` option, other +APIs that create secure contexts have no default value. + +The `tls.createSecureContext()` method creates a `SecureContext` object. It is +usable as an argument to several `tls` APIs, such as [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) +and [`server.addContext()`](#tls_server_addcontext_hostname_context), but has no public methods. + +A key is *required* for ciphers that make use of certificates. Either `key` or +`pfx` can be used to provide it. + +If the 'ca' option is not given, then Node.js will use the default +publicly trusted list of CAs as given in +. + +## tls.createServer([options][, secureconnectionlistener])[#](#tls_tls_createserver_options_secureconnectionlistener) + +History + +| Version | Changes | +| --- | --- | +| v9.3.0 | The `options` parameter can now include `clientCertEngine`. | +| v8.0.0 | The `ALPNProtocols` option can be a `TypedArray` or `DataView` now. | +| v5.0.0 | ALPN options are supported now. | +| v0.3.2 | Added in: v0.3.2 | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + + `ALPNProtocols`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) + An array of strings, `Buffer`s or `TypedArray`s or `DataView`s, or a single + `Buffer` or `TypedArray` or `DataView` containing the supported ALPN + protocols. `Buffer`s should have the format `[len][name][len][name]...` + e.g. `0x05hello0x05world`, where the first byte is the length of the next + protocol name. Passing an array is usually much simpler, e.g. + `['hello', 'world']`. (Protocols should be ordered by their priority.) + + `clientCertEngine` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Name of an OpenSSL engine which can provide the + client certificate. + + `handshakeTimeout` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Abort the connection if the SSL/TLS handshake + does not finish in the specified number of milliseconds. + A `'tlsClientError'` is emitted on the `tls.Server` object whenever + a handshake times out. **Default:** `120000` (120 seconds). + + `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If not `false` the server will reject any + connection which is not authorized with the list of supplied CAs. This + option only has an effect if `requestCert` is `true`. **Default:** `true`. + + `requestCert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true` the server will request a certificate from + clients that connect and attempt to verify that certificate. **Default:** + `false`. + + `sessionTimeout` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The number of seconds after which a TLS session + created by the server will no longer be resumable. See + [Session Resumption](#tls_session_resumption) for more information. **Default:** `300`. + + `SNICallback(servername, cb)` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A function that will be called if + the client supports SNI TLS extension. Two arguments will be passed when + called: `servername` and `cb`. `SNICallback` should invoke `cb(null, ctx)`, + where `ctx` is a `SecureContext` instance. (`tls.createSecureContext(...)` + can be used to get a proper `SecureContext`.) If `SNICallback` wasn't + provided the default callback with high-level API will be used (see below). + + `ticketKeys`: [](buffer.html#buffer_class_buffer) 48-bytes of cryptographically strong pseudo-random + data. See [Session Resumption](#tls_session_resumption) for more information. + + ...: Any [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) option can be provided. For + servers, the identity options (`pfx` or `key`/`cert`) are usually required. +* `secureConnectionListener` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) +* Returns: [](tls.html#tls_class_tls_server) + +Creates a new [`tls.Server`](#tls_class_tls_server). The `secureConnectionListener`, if provided, is +automatically set as a listener for the [`'secureConnection'`](#tls_event_secureconnection) event. + +The `ticketKeys` options is automatically shared between `cluster` module +workers. + +The following illustrates a simple echo server: + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + key: fs.readFileSync('server-key.pem'), + cert: fs.readFileSync('server-cert.pem'), + + // This is necessary only if using client certificate authentication. + requestCert: true, + + // This is necessary only if the client uses a self-signed certificate. + ca: [ fs.readFileSync('client-cert.pem') ] +}; + +const server = tls.createServer(options, (socket) => { + console.log('server connected', + socket.authorized ? 'authorized' : 'unauthorized'); + socket.write('welcome!\n'); + socket.setEncoding('utf8'); + socket.pipe(socket); +}); +server.listen(8000, () => { + console.log('server bound'); +}); +``` + +The server can be tested by connecting to it using the example client from +[`tls.connect()`](#tls_tls_connect_options_callback). + +## tls.getCiphers()[#](#tls_tls_getciphers) + +Added in: v0.10.2 + +* Returns: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) + +Returns an array with the names of the supported TLS ciphers. The names are +lower-case for historical reasons, but must be uppercased to be used in +the `ciphers` option of [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). + +Cipher names that start with `'tls_'` are for TLSv1.3, all the others are for +TLSv1.2 and below. + +```None +console.log(tls.getCiphers()); // ['aes128-gcm-sha256', 'aes128-sha', ...] +``` + +## tls.DEFAULT\_ECDH\_CURVE[#](#tls_tls_default_ecdh_curve) + +History + +| Version | Changes | +| --- | --- | +| v10.0.0 | Default value changed to `'auto'`. | +| v0.11.13 | Added in: v0.11.13 | + +The default curve name to use for ECDH key agreement in a tls server. The +default value is `'auto'`. See [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) for further +information. + +## tls.DEFAULT\_MAX\_VERSION[#](#tls_tls_default_max_version) + +Added in: v11.4.0 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The default value of the `maxVersion` option of + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). It can be assigned any of the supported TLS + protocol versions, `TLSv1.3`, `TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. + **Default:** `'TLSv1.2'`, unless changed using CLI options. Using + `--tls-max-v1.2` sets the default to `'TLSv1.2`'. Using `--tls-max-v1.3` sets + the default to `'TLSv1.3'`. If multiple of the options are provided, the + highest maximum is used. + +## tls.DEFAULT\_MIN\_VERSION[#](#tls_tls_default_min_version) + +Added in: v11.4.0 + +* [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The default value of the `minVersion` option of + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). It can be assigned any of the supported TLS + protocol versions, `'TLSv1.3'`, `TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. + **Default:** `'TLSv1'`, unless changed using CLI options. Using + `--tls-min-v1.0` sets the default to `'TLSv1'`. Using `--tls-min-v1.1` sets + the default to `'TLSv1.1'`. Using `--tls-min-v1.3` sets the default to + `'TLSv1.3'`. If multiple of the options are provided, the lowest minimum is + used. + +## Deprecated APIs[#](#tls_deprecated_apis) + +### Class: CryptoStream[#](#tls_class_cryptostream) + +Added in: v0.3.4Deprecated since: v0.11.3 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`tls.TLSSocket`](#tls_class_tls_tlssocket) instead. + +The `tls.CryptoStream` class represents a stream of encrypted data. This class +is deprecated and should no longer be used. + +#### cryptoStream.bytesWritten[#](#tls_cryptostream_byteswritten) + +Added in: v0.3.4Deprecated since: v0.11.3 + +The `cryptoStream.bytesWritten` property returns the total number of bytes +written to the underlying socket *including* the bytes required for the +implementation of the TLS protocol. + +### Class: SecurePair[#](#tls_class_securepair) + +Added in: v0.3.2Deprecated since: v0.11.3 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`tls.TLSSocket`](#tls_class_tls_tlssocket) instead. + +Returned by [`tls.createSecurePair()`](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options). + +#### Event: 'secure'[#](#tls_event_secure) + +Added in: v0.3.2Deprecated since: v0.11.3 + +The `'secure'` event is emitted by the `SecurePair` object once a secure +connection has been established. + +As with checking for the server +[`'secureConnection'`](#tls_event_secureconnection) +event, `pair.cleartext.authorized` should be inspected to confirm whether the +certificate used is properly authorized. + +### tls.createSecurePair([context][, isserver][, requestCert][, rejectunauthorized][, options])[#](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options) + +History + +| Version | Changes | +| --- | --- | +| v5.0.0 | ALPN options are supported now. | +| v0.11.3 | Deprecated since: v0.11.3 | +| v0.3.2 | Added in: v0.3.2 | + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`tls.TLSSocket`](#tls_class_tls_tlssocket) instead. + +* `context` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) A secure context object as returned by + `tls.createSecureContext()` +* `isServer` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` to specify that this TLS connection should be + opened as a server. +* `requestCert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` to specify whether a server should request a + certificate from a connecting client. Only applies when `isServer` is `true`. +* `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If not `false` a server automatically reject + clients with invalid certificates. Only applies when `isServer` is `true`. +* `options` + + + `secureContext`: A TLS context object from [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) + + `isServer`: If `true` the TLS socket will be instantiated in server-mode. + **Default:** `false`. + + `server` [](net.html#net_class_net_server) A [`net.Server`](net.html#net_class_net_server) instance + + `requestCert`: See [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `rejectUnauthorized`: See [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `ALPNProtocols`: See [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `SNICallback`: See [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `session` [](buffer.html#buffer_class_buffer) A `Buffer` instance containing a TLS session. + + `requestOCSP` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true`, specifies that the OCSP status request + extension will be added to the client hello and an `'OCSPResponse'` event + will be emitted on the socket before establishing a secure communication. + +Creates a new secure pair object with two streams, one of which reads and writes +the encrypted data and the other of which reads and writes the cleartext data. +Generally, the encrypted stream is piped to/from an incoming encrypted data +stream and the cleartext one is used as a replacement for the initial encrypted +stream. + +`tls.createSecurePair()` returns a `tls.SecurePair` object with `cleartext` and +`encrypted` stream properties. + +Using `cleartext` has the same API as [`tls.TLSSocket`](#tls_class_tls_tlssocket). + +The `tls.createSecurePair()` method is now deprecated in favor of +`tls.TLSSocket()`. For example, the code: + +```None +pair = tls.createSecurePair(/* ... */); +pair.encrypted.pipe(socket); +socket.pipe(pair.encrypted); +``` + +can be replaced by: + +```None +secureSocket = tls.TLSSocket(socket, options); +``` + +where `secureSocket` has the same API as `pair.cleartext`. diff --git a/corpus/docs/nodejs/tls/tls_4x.md b/corpus/docs/nodejs/tls/tls_4x.md new file mode 100644 index 0000000000000000000000000000000000000000..5dbd3f308c2424833e7fc883ca31f61931683d39 --- /dev/null +++ b/corpus/docs/nodejs/tls/tls_4x.md @@ -0,0 +1,956 @@ +# TLS (SSL)# + +Source: https://nodejs.org/docs/latest-v4.x/api/tls.html +Version: 4.x + +```None +Stability: 2 - Stable +``` + +Use `require('tls')` to access this module. + +The `tls` module uses OpenSSL to provide Transport Layer Security and/or +Secure Socket Layer: encrypted stream communication. + +TLS/SSL is a public/private key infrastructure. Each client and each +server must have a private key. A private key is created like this: + +```None +openssl genrsa -out ryans-key.pem 2048 +``` + +All servers and some clients need to have a certificate. Certificates are public +keys signed by a Certificate Authority or self-signed. The first step to +getting a certificate is to create a "Certificate Signing Request" (CSR) +file. This is done with: + +```None +openssl req -new -sha256 -key ryans-key.pem -out ryans-csr.pem +``` + +To create a self-signed certificate with the CSR, do this: + +```None +openssl x509 -req -in ryans-csr.pem -signkey ryans-key.pem -out ryans-cert.pem +``` + +Alternatively you can send the CSR to a Certificate Authority for signing. + +For Perfect Forward Secrecy, it is required to generate Diffie-Hellman +parameters: + +```None +openssl dhparam -outform PEM -out dhparam.pem 2048 +``` + +To create .pfx or .p12, do this: + +```None +openssl pkcs12 -export -in agent5-cert.pem -inkey agent5-key.pem \ + -certfile ca-cert.pem -out agent5.pfx +``` + +* `in`: certificate +* `inkey`: private key +* `certfile`: all CA certs concatenated in one file like + `cat ca1-cert.pem ca2-cert.pem > ca-cert.pem` + +## Client-initiated renegotiation attack mitigation[#](#tls_client_initiated_renegotiation_attack_mitigation) + +The TLS protocol lets the client renegotiate certain aspects of the TLS session. +Unfortunately, session renegotiation requires a disproportional amount of +server-side resources, which makes it a potential vector for denial-of-service +attacks. + +To mitigate this, renegotiations are limited to three times every 10 minutes. An +error is emitted on the [`tls.TLSSocket`](#tls_class_tls_tlssocket) instance when the threshold is +exceeded. The limits are configurable: + +* `tls.CLIENT_RENEG_LIMIT`: renegotiation limit, default is 3. +* `tls.CLIENT_RENEG_WINDOW`: renegotiation window in seconds, default is + 10 minutes. + +Don't change the defaults unless you know what you are doing. + +To test your server, connect to it with `openssl s_client -connect address:port` +and tap `R` (that's the letter `R` followed by a carriage return) a few +times. + +## Modifying the Default TLS Cipher suite[#](#tls_modifying_the_default_tls_cipher_suite) + +Node.js is built with a default suite of enabled and disabled TLS ciphers. +Currently, the default cipher suite is: + +```None +ECDHE-RSA-AES128-GCM-SHA256: +ECDHE-ECDSA-AES128-GCM-SHA256: +ECDHE-RSA-AES256-GCM-SHA384: +ECDHE-ECDSA-AES256-GCM-SHA384: +DHE-RSA-AES128-GCM-SHA256: +ECDHE-RSA-AES128-SHA256: +DHE-RSA-AES128-SHA256: +ECDHE-RSA-AES256-SHA384: +DHE-RSA-AES256-SHA384: +ECDHE-RSA-AES256-SHA256: +DHE-RSA-AES256-SHA256: +HIGH: +!aNULL: +!eNULL: +!EXPORT: +!DES: +!RC4: +!MD5: +!PSK: +!SRP: +!CAMELLIA +``` + +This default can be overriden entirely using the `--tls-cipher-list` command +line switch. For instance, the following makes +`ECDHE-RSA-AES128-GCM-SHA256:!RC4` the default TLS cipher suite: + +```None +node --tls-cipher-list="ECDHE-RSA-AES128-GCM-SHA256:!RC4" +``` + +Note that the default cipher suite included within Node.js has been carefully +selected to reflect current security best practices and risk mitigation. +Changing the default cipher suite can have a significant impact on the security +of an application. The `--tls-cipher-list` switch should by used only if +absolutely necessary. + +## ALPN, NPN and SNI[#](#tls_alpn_npn_and_sni) + +ALPN (Application-Layer Protocol Negotiation Extension), NPN (Next +Protocol Negotiation) and SNI (Server Name Indication) are TLS +handshake extensions allowing you: + +* ALPN/NPN - to use one TLS server for multiple protocols (HTTP, SPDY, HTTP/2) +* SNI - to use one TLS server for multiple hostnames with different SSL + certificates. + +## Perfect Forward Secrecy[#](#tls_perfect_forward_secrecy) + +The term "[Forward Secrecy](https://en.wikipedia.org/wiki/Perfect_forward_secrecy)" or "Perfect Forward Secrecy" describes a feature of +key-agreement (i.e. key-exchange) methods. Practically it means that even if the +private key of a (your) server is compromised, communication can only be +decrypted by eavesdroppers if they manage to obtain the key-pair specifically +generated for each session. + +This is achieved by randomly generating a key pair for key-agreement on every +handshake (in contrary to the same key for all sessions). Methods implementing +this technique, thus offering Perfect Forward Secrecy, are called "ephemeral". + +Currently two methods are commonly used to achieve Perfect Forward Secrecy (note +the character "E" appended to the traditional abbreviations): + +* [DHE](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange) - An ephemeral version of the Diffie Hellman key-agreement protocol. +* [ECDHE](https://en.wikipedia.org/wiki/Elliptic_curve_Diffie%E2%80%93Hellman) - An ephemeral version of the Elliptic Curve Diffie Hellman + key-agreement protocol. + +Ephemeral methods may have some performance drawbacks, because key generation +is expensive. + +## Class: CryptoStream[#](#tls_class_cryptostream) + +```None +Stability: 0 - Deprecated: Use tls.TLSSocket instead. +``` + +This is an encrypted stream. + +### cryptoStream.bytesWritten[#](#tls_cryptostream_byteswritten) + +A proxy to the underlying socket's bytesWritten accessor, this will return +the total bytes written to the socket, *including the TLS overhead*. + +## Class: SecurePair[#](#tls_class_securepair) + +Returned by tls.createSecurePair. + +### Event: 'secure'[#](#tls_event_secure) + +The event is emitted from the SecurePair once the pair has successfully +established a secure connection. + +Similarly to the checking for the server `'secureConnection'` event, +pair.cleartext.authorized should be checked to confirm whether the certificate +used properly authorized. + +## Class: tls.Server[#](#tls_class_tls_server) + +Added in: v0.3.2 + +This class is a subclass of `net.Server` and has the same methods on it. +Instead of accepting just raw TCP connections, this accepts encrypted +connections using TLS or SSL. + +### Event: 'clientError'[#](#tls_event_clienterror) + +Added in: v0.11.11 + +`function (exception, tlsSocket) { }` + +When a client connection emits an `'error'` event before a secure connection is +established it will be forwarded here. + +`tlsSocket` is the [`tls.TLSSocket`](#tls_class_tls_tlssocket) that the error originated from. + +### Event: 'newSession'[#](#tls_event_newsession) + +Added in: v0.9.2 + +`function (sessionId, sessionData, callback) { }` + +Emitted on creation of TLS session. May be used to store sessions in external +storage. `callback` must be invoked eventually, otherwise no data will be +sent or received from secure connection. + +NOTE: adding this event listener will have an effect only on connections +established after addition of event listener. + +### Event: 'OCSPRequest'[#](#tls_event_ocsprequest) + +Added in: v0.11.13 + +`function (certificate, issuer, callback) { }` + +Emitted when the client sends a certificate status request. You could parse +server's current certificate to obtain OCSP url and certificate id, and after +obtaining OCSP response invoke `callback(null, resp)`, where `resp` is a +`Buffer` instance. Both `certificate` and `issuer` are a `Buffer` +DER-representations of the primary and issuer's certificates. They could be used +to obtain OCSP certificate id and OCSP endpoint url. + +Alternatively, `callback(null, null)` could be called, meaning that there is no +OCSP response. + +Calling `callback(err)` will result in a `socket.destroy(err)` call. + +Typical flow: + +1. Client connects to server and sends `'OCSPRequest'` to it (via status info + extension in ClientHello.) +2. Server receives request and invokes `'OCSPRequest'` event listener if present +3. Server grabs OCSP url from either `certificate` or `issuer` and performs an + [OCSP request](https://en.wikipedia.org/wiki/OCSP_stapling) to the CA +4. Server receives `OCSPResponse` from CA and sends it back to client via + `callback` argument +5. Client validates the response and either destroys socket or performs a + handshake. + +NOTE: `issuer` could be null, if the certificate is self-signed or if the issuer +is not in the root certificates list. (You could provide an issuer via `ca` +option.) + +NOTE: adding this event listener will have an effect only on connections +established after addition of event listener. + +NOTE: you may want to use some npm module like [asn1.js](https://npmjs.org/package/asn1.js) to parse the +certificates. + +### Event: 'resumeSession'[#](#tls_event_resumesession) + +Added in: v0.9.2 + +`function (sessionId, callback) { }` + +Emitted when client wants to resume previous TLS session. Event listener may +perform lookup in external storage using given `sessionId`, and invoke +`callback(null, sessionData)` once finished. If session can't be resumed +(i.e. doesn't exist in storage) one may call `callback(null, null)`. Calling +`callback(err)` will terminate incoming connection and destroy socket. + +NOTE: adding this event listener will have an effect only on connections +established after addition of event listener. + +Here's an example for using TLS session resumption: + +```None +var tlsSessionStore = {}; +server.on('newSession', (id, data, cb) => { + tlsSessionStore[id.toString('hex')] = data; + cb(); +}); +server.on('resumeSession', (id, cb) => { + cb(null, tlsSessionStore[id.toString('hex')] || null); +}); +``` + +### Event: 'secureConnection'[#](#tls_event_secureconnection) + +Added in: v0.3.2 + +`function (tlsSocket) {}` + +This event is emitted after a new connection has been successfully +handshaked. The argument is an instance of [`tls.TLSSocket`](#tls_class_tls_tlssocket). It has all the +common stream methods and events. + +`socket.authorized` is a boolean value which indicates if the +client has verified by one of the supplied certificate authorities for the +server. If `socket.authorized` is false, then +`socket.authorizationError` is set to describe how authorization +failed. Implied but worth mentioning: depending on the settings of the TLS +server, you unauthorized connections may be accepted. + +`socket.npnProtocol` is a string containing the selected NPN protocol +and `socket.alpnProtocol` is a string containing the selected ALPN +protocol, When both NPN and ALPN extensions are received, ALPN takes +precedence over NPN and the next protocol is selected by ALPN. When +ALPN has no selected protocol, this returns false. + +`socket.servername` is a string containing servername requested with +SNI. + +### server.addContext(hostname, context)[#](#tls_server_addcontext_hostname_context) + +Added in: v0.5.3 + +Add secure context that will be used if client request's SNI hostname is +matching passed `hostname` (wildcards can be used). `context` can contain +`key`, `cert`, `ca` and/or any other properties from +[`tls.createSecureContext()`](#tls_tls_createsecurecontext_details) `options` argument. + +### server.address()[#](#tls_server_address) + +Added in: v0.6.0 + +Returns the bound address, the address family name and port of the +server as reported by the operating system. See [`net.Server.address()`](net.html#net_server_address) for +more information. + +### server.close([callback])[#](#tls_server_close_callback) + +Added in: v0.3.2 + +Stops the server from accepting new connections. This function is +asynchronous, the server is finally closed when the server emits a `'close'` +event. Optionally, you can pass a callback to listen for the `'close'` event. + +### server.connections[#](#tls_server_connections) + +Added in: v0.3.2 + +The number of concurrent connections on the server. + +### server.getTicketKeys()[#](#tls_server_getticketkeys) + +Added in: v3.0.0 + +Returns `Buffer` instance holding the keys currently used for +encryption/decryption of the [TLS Session Tickets](https://www.ietf.org/rfc/rfc5077.txt) + +### server.listen(port[, hostname][, callback])[#](#tls_server_listen_port_hostname_callback) + +Added in: v0.3.2 + +Begin accepting connections on the specified `port` and `hostname`. If the +`hostname` is omitted, the server will accept connections on any IPv6 address +(`::`) when IPv6 is available, or any IPv4 address (`0.0.0.0`) otherwise. A +port value of zero will assign a random port. + +This function is asynchronous. The last parameter `callback` will be called +when the server has been bound. + +See [`net.Server`](net.html#net_class_net_server) for more information. + +### server.maxConnections[#](#tls_server_maxconnections) + +Added in: v0.2.0 + +Set this property to reject connections when the server's connection count +gets high. + +### server.setTicketKeys(keys)[#](#tls_server_setticketkeys_keys) + +Added in: v3.0.0 + +Updates the keys for encryption/decryption of the [TLS Session Tickets](https://www.ietf.org/rfc/rfc5077.txt). + +NOTE: the buffer should be 48 bytes long. See server `ticketKeys` option for +more information oh how it is going to be used. + +NOTE: the change is effective only for the future server connections. Existing +or currently pending server connections will use previous keys. + +## Class: tls.TLSSocket[#](#tls_class_tls_tlssocket) + +Added in: v0.11.4 + +This is a wrapped version of [`net.Socket`](net.html#net_class_net_socket) that does transparent encryption +of written data and all required TLS negotiation. + +This instance implements a duplex [Stream](stream.html#stream_stream) interfaces. It has all the +common stream methods and events. + +Methods that return TLS connection meta data (e.g. +[`tls.TLSSocket.getPeerCertificate()`](#tls_tlssocket_getpeercertificate_detailed) will only return data while the +connection is open. + +## new tls.TLSSocket(socket[, options])[#](#tls_new_tls_tlssocket_socket_options) + +Added in: v0.11.4 + +Construct a new TLSSocket object from existing TCP socket. + +`socket` is an instance of [`net.Socket`](net.html#net_class_net_socket) + +`options` is an optional object that might contain following properties: + +* `secureContext`: An optional TLS context object from + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_details) +* `isServer`: If `true` the TLS socket will be instantiated in server-mode. + Default: `false` +* `server`: An optional [`net.Server`](net.html#net_class_net_server) instance +* `requestCert`: Optional, see [`tls.createSecurePair()`](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options) +* `rejectUnauthorized`: Optional, see [`tls.createSecurePair()`](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options) +* `NPNProtocols`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) +* `ALPNProtocols`: Optional, see [tls.createServer][] +* `SNICallback`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) +* `session`: Optional, a `Buffer` instance, containing TLS session +* `requestOCSP`: Optional, if `true` the OCSP status request extension will + be added to the client hello, and an `'OCSPResponse'` event will be emitted + on the socket before establishing a secure communication + +### Event: 'OCSPResponse'[#](#tls_event_ocspresponse) + +Added in: v0.11.13 + +`function (response) { }` + +This event will be emitted if `requestOCSP` option was set. `response` is a +buffer object, containing server's OCSP response. + +Traditionally, the `response` is a signed object from the server's CA that +contains information about server's certificate revocation status. + +### Event: 'secureConnect'[#](#tls_event_secureconnect) + +Added in: v0.11.4 + +This event is emitted after a new connection has been successfully handshaked. +The listener will be called no matter if the server's certificate was +authorized or not. It is up to the user to test `tlsSocket.authorized` +to see if the server certificate was signed by one of the specified CAs. +If `tlsSocket.authorized === false` then the error can be found in +`tlsSocket.authorizationError`. Also if ALPN or NPN was used - you can +check `tlsSocket.alpnProtocol` or `tlsSocket.npnProtocol` for the +negotiated protocol. + +### tlsSocket.address()[#](#tls_tlssocket_address) + +Added in: v0.11.4 + +Returns the bound address, the address family name and port of the +underlying socket as reported by the operating system. Returns an +object with three properties, e.g. +`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` + +### tlsSocket.authorized[#](#tls_tlssocket_authorized) + +Added in: v0.11.4 + +A boolean that is `true` if the peer certificate was signed by one of the +specified CAs, otherwise `false` + +### tlsSocket.authorizationError[#](#tls_tlssocket_authorizationerror) + +Added in: v0.11.4 + +The reason why the peer's certificate has not been verified. This property +becomes available only when `tlsSocket.authorized === false`. + +### tlsSocket.encrypted[#](#tls_tlssocket_encrypted) + +Added in: v0.11.4 + +Static boolean value, always `true`. May be used to distinguish TLS sockets +from regular ones. + +### tlsSocket.getCipher()[#](#tls_tlssocket_getcipher) + +Added in: v0.11.4 + +Returns an object representing the cipher name and the SSL/TLS +protocol version of the current connection. + +Example: + + +See SSL\_CIPHER\_get\_name() and SSL\_CIPHER\_get\_version() in + for more +information. + +### tlsSocket.getPeerCertificate([ detailed ])[#](#tls_tlssocket_getpeercertificate_detailed) + +Added in: v0.11.4 + +Returns an object representing the peer's certificate. The returned object has +some properties corresponding to the field of the certificate. If `detailed` +argument is `true` the full chain with `issuer` property will be returned, +if `false` only the top certificate without `issuer` property. + +Example: + +```None +{ subject: + { C: 'UK', + ST: 'Acknack Ltd', + L: 'Rhys Jones', + O: 'node.js', + OU: 'Test TLS Certificate', + CN: 'localhost' }, + issuerInfo: + { C: 'UK', + ST: 'Acknack Ltd', + L: 'Rhys Jones', + O: 'node.js', + OU: 'Test TLS Certificate', + CN: 'localhost' }, + issuer: + { ... another certificate ... }, + raw: < RAW DER buffer >, + valid_from: 'Nov 11 09:52:22 2009 GMT', + valid_to: 'Nov 6 09:52:22 2029 GMT', + fingerprint: '2A:7A:C2:DD:E5:F9:CC:53:72:35:99:7A:02:5A:71:38:52:EC:8A:DF', + serialNumber: 'B9B0D332A1AA5635' } +``` + +If the peer does not provide a certificate, it returns `null` or an empty +object. + +### tlsSocket.getSession()[#](#tls_tlssocket_getsession) + +Added in: v0.11.4 + +Return ASN.1 encoded TLS session or `undefined` if none was negotiated. Could +be used to speed up handshake establishment when reconnecting to the server. + +### tlsSocket.getTLSTicket()[#](#tls_tlssocket_gettlsticket) + +Added in: v0.11.4 + +NOTE: Works only with client TLS sockets. Useful only for debugging, for +session reuse provide `session` option to [`tls.connect()`](#tls_tls_connect_options_callback). + +Return TLS session ticket or `undefined` if none was negotiated. + +### tlsSocket.localPort[#](#tls_tlssocket_localport) + +Added in: v0.11.4 + +The numeric representation of the local port. + +### tlsSocket.localAddress[#](#tls_tlssocket_localaddress) + +Added in: v0.11.4 + +The string representation of the local IP address. + +### tlsSocket.remoteAddress[#](#tls_tlssocket_remoteaddress) + +Added in: v0.11.4 + +The string representation of the remote IP address. For example, +`'74.125.127.100'` or `'2001:4860:a005::68'`. + +### tlsSocket.remoteFamily[#](#tls_tlssocket_remotefamily) + +Added in: v0.11.4 + +The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. + +### tlsSocket.remotePort[#](#tls_tlssocket_remoteport) + +Added in: v0.11.4 + +The numeric representation of the remote port. For example, `443`. + +### tlsSocket.renegotiate(options, callback)[#](#tls_tlssocket_renegotiate_options_callback) + +Added in: v0.11.8 + +Initiate TLS renegotiation process. The `options` may contain the following +fields: `rejectUnauthorized`, `requestCert` (See [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) for +details). `callback(err)` will be executed with `null` as `err`, +once the renegotiation is successfully completed. + +NOTE: Can be used to request peer's certificate after the secure connection +has been established. + +ANOTHER NOTE: When running as the server, socket will be destroyed +with an error after `handshakeTimeout` timeout. + +### tlsSocket.setMaxSendFragment(size)[#](#tls_tlssocket_setmaxsendfragment_size) + +Added in: v0.11.11 + +Set maximum TLS fragment size (default and maximum value is: `16384`, minimum +is: `512`). Returns `true` on success, `false` otherwise. + +Smaller fragment size decreases buffering latency on the client: large +fragments are buffered by the TLS layer until the entire fragment is received +and its integrity is verified; large fragments can span multiple roundtrips, +and their processing can be delayed due to packet loss or reordering. However, +smaller fragments add extra TLS framing bytes and CPU overhead, which may +decrease overall server throughput. + +## tls.connect(options[, callback])[#](#tls_tls_connect_options_callback) + +## tls.connect(port[, host][, options][, callback])[#](#tls_tls_connect_port_host_options_callback) + +Added in: v0.11.3 + +Creates a new client connection to the given `port` and `host` (old API) or +`options.port` and `options.host`. (If `host` is omitted, it defaults to +`localhost`.) `options` should be an object which specifies: + +* `host`: Host the client should connect to +* `port`: Port the client should connect to +* `socket`: Establish secure connection on a given socket rather than + creating a new socket. If this option is specified, `host` and `port` + are ignored. +* `path`: Creates unix socket connection to path. If this option is + specified, `host` and `port` are ignored. +* `pfx`: A string or `Buffer` containing the private key, certificate and + CA certs of the client in PFX or PKCS12 format. +* `key`: A string or `Buffer` containing the private key of the client in + PEM format. (Could be an array of keys). +* `passphrase`: A string of passphrase for the private key or pfx. +* `cert`: A string or `Buffer` containing the certificate key of the client in + PEM format. (Could be an array of certs). +* `ca`: A string, `Buffer` or array of strings or `Buffer`s of trusted + certificates in PEM format. If this is omitted several well known "root" + CAs will be used, like VeriSign. These are used to authorize connections. +* `ciphers`: A string describing the ciphers to use or exclude, separated by + `:`. Uses the same default cipher suite as [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener). +* `rejectUnauthorized`: If `true`, the server certificate is verified against + the list of supplied CAs. An `'error'` event is emitted if verification + fails; `err.code` contains the OpenSSL error code. Default: `true`. +* `NPNProtocols`: An array of strings or `Buffer`s containing supported NPN + protocols. `Buffer`s should have following format: `0x05hello0x05world`, + where first byte is next protocol name's length. (Passing array should + usually be much simpler: `['hello', 'world']`.) +* `ALPNProtocols`: An array of strings or `Buffer`s containing + supported ALPN protocols. `Buffer`s should have following format: + `0x05hello0x05world`, where the first byte is the next protocol + name's length. (Passing array should usually be much simpler: + `['hello', 'world']`.) +* `servername`: Servername for SNI (Server Name Indication) TLS extension. +* `checkServerIdentity(servername, cert)`: Provide an override for checking + server's hostname against the certificate. Should return an error if verification + fails. Return `undefined` if passing. +* `secureProtocol`: The SSL method to use, e.g. `SSLv3_method` to force + SSL version 3. The possible values depend on your installation of + OpenSSL and are defined in the constant [SSL\_METHODS](https://www.openssl.org/docs/man1.0.2/ssl/ssl.html#DEALING-WITH-PROTOCOL-METHODS). +* `secureContext`: An optional TLS context object from + `tls.createSecureContext( ... )`. Could it be used for caching client + certificates, key, and CA certificates. +* `session`: A `Buffer` instance, containing TLS session. + +The `callback` parameter will be added as a listener for the +[`'secureConnect'`](#tls_event_secureconnect) event. + +`tls.connect()` returns a [`tls.TLSSocket`](#tls_class_tls_tlssocket) object. + +Here is an example of a client of echo server as described previously: + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + // These are necessary only if using the client certificate authentication + key: fs.readFileSync('client-key.pem'), + cert: fs.readFileSync('client-cert.pem'), + + // This is necessary only if the server uses the self-signed certificate + ca: [ fs.readFileSync('server-cert.pem') ] +}; + +var socket = tls.connect(8000, options, () => { + console.log('client connected', + socket.authorized ? 'authorized' : 'unauthorized'); + process.stdin.pipe(socket); + process.stdin.resume(); +}); +socket.setEncoding('utf8'); +socket.on('data', (data) => { + console.log(data); +}); +socket.on('end', () => { + server.close(); +}); +``` + +Or + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + pfx: fs.readFileSync('client.pfx') +}; + +var socket = tls.connect(8000, options, () => { + console.log('client connected', + socket.authorized ? 'authorized' : 'unauthorized'); + process.stdin.pipe(socket); + process.stdin.resume(); +}); +socket.setEncoding('utf8'); +socket.on('data', (data) => { + console.log(data); +}); +socket.on('end', () => { + server.close(); +}); +``` + +## tls.createSecureContext(details)[#](#tls_tls_createsecurecontext_details) + +Added in: v0.11.13 + +Creates a credentials object, with the optional details being a +dictionary with keys: + +* `pfx` : A string or buffer holding the PFX or PKCS12 encoded private + key, certificate and CA certificates +* `key`: A string or `Buffer` containing the private key of the server in + PEM format. To support multiple keys using different algorithms, an array + can be provided. It can either be a plain array of keys, or an array of + objects in the format `{pem: key, passphrase: passphrase}`. (Required) +* `passphrase` : A string of passphrase for the private key or pfx +* `cert` : A string holding the PEM encoded certificate +* `ca`: A string, `Buffer` or array of strings or `Buffer`s of trusted + certificates in PEM format. If this is omitted several well known "root" + CAs will be used, like VeriSign. These are used to authorize connections. +* `crl` : Either a string or list of strings of PEM encoded CRLs + (Certificate Revocation List) +* `ciphers`: A string describing the ciphers to use or exclude. + Consult + + for details on the format. +* `honorCipherOrder` : When choosing a cipher, use the server's preferences + instead of the client preferences. For further details see `tls` module + documentation. + +If no 'ca' details are given, then Node.js will use the default +publicly trusted list of CAs as given in +. + +## tls.createSecurePair([context][, isServer][, requestCert][, rejectUnauthorized][, options])[#](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options) + +Creates a new secure pair object with two streams, one of which reads/writes +encrypted data, and one reads/writes cleartext data. +Generally the encrypted one is piped to/from an incoming encrypted data stream, +and the cleartext one is used as a replacement for the initial encrypted stream. + +* `credentials`: A secure context object from tls.createSecureContext( ... ) +* `isServer`: A boolean indicating whether this tls connection should be + opened as a server or a client. +* `requestCert`: A boolean indicating whether a server should request a + certificate from a connecting client. Only applies to server connections. +* `rejectUnauthorized`: A boolean indicating whether a server should + automatically reject clients with invalid certificates. Only applies to + servers with `requestCert` enabled. +* `options`: An object with common SSL options. See [`tls.TLSSocket`](#tls_class_tls_tlssocket). + +`tls.createSecurePair()` returns a SecurePair object with `cleartext` and +`encrypted` stream properties. + +NOTE: `cleartext` has the same APIs as [`tls.TLSSocket`](#tls_class_tls_tlssocket) + +## tls.createServer(options[, secureConnectionListener])[#](#tls_tls_createserver_options_secureconnectionlistener) + +Added in: v0.3.2 + +Creates a new [tls.Server](#tls_class_tls_server). The `connectionListener` argument is +automatically set as a listener for the [`'secureConnection'`](#tls_event_secureconnection) event. The +`options` object has these possibilities: + +* `pfx`: A string or `Buffer` containing the private key, certificate and + CA certs of the server in PFX or PKCS12 format. (Mutually exclusive with + the `key`, `cert` and `ca` options.) +* `key`: A string or `Buffer` containing the private key of the server in + PEM format. To support multiple keys using different algorithms, an array + can be provided. It can either be a plain array of keys, or an array of + objects in the format `{pem: key, passphrase: passphrase}`. (Required) +* `passphrase`: A string of passphrase for the private key or pfx. +* `cert`: A string or `Buffer` containing the certificate key of the server in + PEM format. (Could be an array of certs). (Required) +* `ca`: A string, `Buffer` or array of strings or `Buffer`s of trusted + certificates in PEM format. If this is omitted several well known "root" + CAs will be used, like VeriSign. These are used to authorize connections. +* `crl` : Either a string or list of strings of PEM encoded CRLs (Certificate + Revocation List) +* `ciphers`: A string describing the ciphers to use or exclude, separated by + `:`. The default cipher suite is: + + ```None + ECDHE-RSA-AES128-GCM-SHA256: + ECDHE-ECDSA-AES128-GCM-SHA256: + ECDHE-RSA-AES256-GCM-SHA384: + ECDHE-ECDSA-AES256-GCM-SHA384: + DHE-RSA-AES128-GCM-SHA256: + ECDHE-RSA-AES128-SHA256: + DHE-RSA-AES128-SHA256: + ECDHE-RSA-AES256-SHA384: + DHE-RSA-AES256-SHA384: + ECDHE-RSA-AES256-SHA256: + DHE-RSA-AES256-SHA256: + HIGH: + !aNULL: + !eNULL: + !EXPORT: + !DES: + !RC4: + !MD5: + !PSK: + !SRP: + !CAMELLIA + ``` + + The default cipher suite prefers GCM ciphers for [Chrome's 'modern + cryptography' setting](https://www.chromium.org/Home/chromium-security/education/tls#TOC-Deprecation-of-TLS-Features-Algorithms-in-Chrome) and also prefers ECDHE and DHE ciphers for Perfect + Forward secrecy, while offering *some* backward compatibiltity. + + 128 bit AES is preferred over 192 and 256 bit AES in light of [specific + attacks affecting larger AES key sizes](https://www.schneier.com/blog/archives/2009/07/another_new_aes.html). + + Old clients that rely on insecure and deprecated RC4 or DES-based ciphers + (like Internet Explorer 6) aren't able to complete the handshake with the default + configuration. If you absolutely must support these clients, the + [TLS recommendations](https://wiki.mozilla.org/Security/Server_Side_TLS) may offer a compatible cipher suite. For more details + on the format, see the [OpenSSL cipher list format documentation](https://www.openssl.org/docs/man1.0.2/apps/ciphers.html#CIPHER-LIST-FORMAT). +* `ecdhCurve`: A string describing a named curve to use for ECDH key agreement + or false to disable ECDH. + + Defaults to `prime256v1` (NIST P-256). Use [`crypto.getCurves()`](crypto.html#crypto_crypto_getcurves) to obtain + a list of available curve names. On recent releases, + `openssl ecparam -list_curves` will also display the name and description of + each available elliptic curve. +* `dhparam`: A string or `Buffer` containing Diffie Hellman parameters, + required for Perfect Forward Secrecy. Use `openssl dhparam` to create it. + Its key length should be greater than or equal to 1024 bits, otherwise + it throws an error. It is strongly recommended to use 2048 bits or + more for stronger security. If omitted or invalid, it is silently + discarded and DHE ciphers won't be available. +* `handshakeTimeout`: Abort the connection if the SSL/TLS handshake does not + finish in this many milliseconds. The default is 120 seconds. + + A `'clientError'` is emitted on the `tls.Server` object whenever a handshake + times out. +* `honorCipherOrder` : When choosing a cipher, use the server's preferences + instead of the client preferences. Default: `true`. +* `requestCert`: If `true` the server will request a certificate from + clients that connect and attempt to verify that certificate. Default: + `false`. +* `rejectUnauthorized`: If `true` the server will reject any connection + which is not authorized with the list of supplied CAs. This option only + has an effect if `requestCert` is `true`. Default: `false`. +* `NPNProtocols`: An array or `Buffer` of possible NPN protocols. (Protocols + should be ordered by their priority). +* `ALPNProtocols`: An array or `Buffer` of possible ALPN + protocols. (Protocols should be ordered by their priority). When + the server receives both NPN and ALPN extensions from the client, + ALPN takes precedence over NPN and the server does not send an NPN + extension to the client. +* `SNICallback(servername, cb)`: A function that will be called if client + supports SNI TLS extension. Two argument will be passed to it: `servername`, + and `cb`. `SNICallback` should invoke `cb(null, ctx)`, where `ctx` is a + SecureContext instance. + (You can use `tls.createSecureContext(...)` to get proper + SecureContext). If `SNICallback` wasn't provided the default callback with + high-level API will be used (see below). +* `sessionTimeout`: An integer specifying the seconds after which TLS + session identifiers and TLS session tickets created by the server are + timed out. See [SSL\_CTX\_set\_timeout](https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_timeout.html) for more details. +* `ticketKeys`: A 48-byte `Buffer` instance consisting of 16-byte prefix, + 16-byte hmac key, 16-byte AES key. You could use it to accept tls session + tickets on multiple instances of tls server. + + NOTE: Automatically shared between `cluster` module workers. +* `sessionIdContext`: A string containing an opaque identifier for session + resumption. If `requestCert` is `true`, the default is MD5 hash value + generated from command-line. (In FIPS mode a truncated SHA1 hash is + used instead.) Otherwise, the default is not provided. +* `secureProtocol`: The SSL method to use, e.g. `SSLv3_method` to force + SSL version 3. The possible values depend on your installation of + OpenSSL and are defined in the constant [SSL\_METHODS](https://www.openssl.org/docs/man1.0.2/ssl/ssl.html#DEALING-WITH-PROTOCOL-METHODS). + +Here is a simple example echo server: + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + key: fs.readFileSync('server-key.pem'), + cert: fs.readFileSync('server-cert.pem'), + + // This is necessary only if using the client certificate authentication. + requestCert: true, + + // This is necessary only if the client uses the self-signed certificate. + ca: [ fs.readFileSync('client-cert.pem') ] +}; + +var server = tls.createServer(options, (socket) => { + console.log('server connected', + socket.authorized ? 'authorized' : 'unauthorized'); + socket.write('welcome!\n'); + socket.setEncoding('utf8'); + socket.pipe(socket); +}); +server.listen(8000, () => { + console.log('server bound'); +}); +``` + +Or + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + pfx: fs.readFileSync('server.pfx'), + + // This is necessary only if using the client certificate authentication. + requestCert: true, + +}; + +var server = tls.createServer(options, (socket) => { + console.log('server connected', + socket.authorized ? 'authorized' : 'unauthorized'); + socket.write('welcome!\n'); + socket.setEncoding('utf8'); + socket.pipe(socket); +}); +server.listen(8000, () => { + console.log('server bound'); +}); +``` + +You can test this server by connecting to it with `openssl s_client`: + +```None +openssl s_client -connect 127.0.0.1:8000 +``` + +## tls.getCiphers()[#](#tls_tls_getciphers) + +Added in: v0.10.2 + +Returns an array with the names of the supported SSL ciphers. + +Example: + +```None +var ciphers = tls.getCiphers(); +console.log(ciphers); // ['AES128-SHA', 'AES256-SHA', ...] +``` diff --git a/corpus/docs/nodejs/tls/tls_5x.md b/corpus/docs/nodejs/tls/tls_5x.md new file mode 100644 index 0000000000000000000000000000000000000000..70a034dd498f9fcf9e5e6e2a1c7133da9f6be887 --- /dev/null +++ b/corpus/docs/nodejs/tls/tls_5x.md @@ -0,0 +1,929 @@ +# TLS (SSL)# + +Source: https://nodejs.org/docs/latest-v5.x/api/tls.html +Version: 5.x + +```None +Stability: 2 - Stable +``` + +Use `require('tls')` to access this module. + +The `tls` module uses OpenSSL to provide Transport Layer Security and/or +Secure Socket Layer: encrypted stream communication. + +TLS/SSL is a public/private key infrastructure. Each client and each +server must have a private key. A private key is created like this: + +```None +openssl genrsa -out ryans-key.pem 2048 +``` + +All servers and some clients need to have a certificate. Certificates are public +keys signed by a Certificate Authority or self-signed. The first step to +getting a certificate is to create a "Certificate Signing Request" (CSR) +file. This is done with: + +```None +openssl req -new -sha256 -key ryans-key.pem -out ryans-csr.pem +``` + +To create a self-signed certificate with the CSR, do this: + +```None +openssl x509 -req -in ryans-csr.pem -signkey ryans-key.pem -out ryans-cert.pem +``` + +Alternatively you can send the CSR to a Certificate Authority for signing. + +For Perfect Forward Secrecy, it is required to generate Diffie-Hellman +parameters: + +```None +openssl dhparam -outform PEM -out dhparam.pem 2048 +``` + +To create a .pfx or .p12, do this: + +```None +openssl pkcs12 -export -in agent5-cert.pem -inkey agent5-key.pem \ + -certfile ca-cert.pem -out agent5.pfx +``` + +* `in`: certificate +* `inkey`: private key +* `certfile`: all CA certs concatenated in one file like + `cat ca1-cert.pem ca2-cert.pem > ca-cert.pem` + +## ALPN, NPN and SNI[#](#tls_alpn_npn_and_sni) + +ALPN (Application-Layer Protocol Negotiation Extension), NPN (Next +Protocol Negotiation) and, SNI (Server Name Indication) are TLS +handshake extensions: + +* ALPN/NPN - Allows the use of one TLS server for multiple protocols (HTTP, + SPDY, HTTP/2) +* SNI - Allows the use of one TLS server for multiple hostnames with different + SSL certificates. + +## Client-initiated renegotiation attack mitigation[#](#tls_client_initiated_renegotiation_attack_mitigation) + +The TLS protocol lets the client renegotiate certain aspects of the TLS session. +Unfortunately, session renegotiation requires a disproportionate amount of +server-side resources, which makes it a potential vector for denial-of-service +attacks. + +To mitigate this, renegotiation is limited to three times every 10 minutes. An +error is emitted on the [`tls.TLSSocket`](#tls_class_tls_tlssocket) instance when the threshold is +exceeded. These limits are configurable: + +* `tls.CLIENT_RENEG_LIMIT`: renegotiation limit, default is 3. +* `tls.CLIENT_RENEG_WINDOW`: renegotiation window in seconds, default is + 10 minutes. + +Do not change the defaults without a full understanding of the implications. + +To test the server, connect to it with `openssl s_client -connect address:port` +and tap `R` (i.e., the letter `R` followed by a carriage return) a few +times. + +## Modifying the Default TLS Cipher suite[#](#tls_modifying_the_default_tls_cipher_suite) + +Node.js is built with a default suite of enabled and disabled TLS ciphers. +Currently, the default cipher suite is: + +```None +ECDHE-RSA-AES128-GCM-SHA256: +ECDHE-ECDSA-AES128-GCM-SHA256: +ECDHE-RSA-AES256-GCM-SHA384: +ECDHE-ECDSA-AES256-GCM-SHA384: +DHE-RSA-AES128-GCM-SHA256: +ECDHE-RSA-AES128-SHA256: +DHE-RSA-AES128-SHA256: +ECDHE-RSA-AES256-SHA384: +DHE-RSA-AES256-SHA384: +ECDHE-RSA-AES256-SHA256: +DHE-RSA-AES256-SHA256: +HIGH: +!aNULL: +!eNULL: +!EXPORT: +!DES: +!RC4: +!MD5: +!PSK: +!SRP: +!CAMELLIA +``` + +This default can be overriden entirely using the `--tls-cipher-list` command +line switch. For instance, the following makes +`ECDHE-RSA-AES128-GCM-SHA256:!RC4` the default TLS cipher suite: + +```None +node --tls-cipher-list="ECDHE-RSA-AES128-GCM-SHA256:!RC4" +``` + +Note that the default cipher suite included within Node.js has been carefully +selected to reflect current security best practices and risk mitigation. +Changing the default cipher suite can have a significant impact on the security +of an application. The `--tls-cipher-list` switch should by used only if +absolutely necessary. + +## Perfect Forward Secrecy[#](#tls_perfect_forward_secrecy) + +The term "[Forward Secrecy](https://en.wikipedia.org/wiki/Perfect_forward_secrecy)" or "Perfect Forward Secrecy" describes a feature of +key-agreement (i.e., key-exchange) methods. Practically it means that even if +the private key of a server is compromised, communication can only be +decrypted by eavesdroppers if they manage to obtain the key-pair specifically +generated for each session. + +This is achieved by randomly generating a key pair for key-agreement on every +handshake (in contrast to using the same key for all sessions). Methods +implementing this technique, thus offering Perfect Forward Secrecy, are +called "ephemeral". + +Currently two methods are commonly used to achieve Perfect Forward Secrecy (note +the character "E" appended to the traditional abbreviations): + +* [DHE](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange) - An ephemeral version of the Diffie Hellman key-agreement protocol. +* [ECDHE](https://en.wikipedia.org/wiki/Elliptic_curve_Diffie%E2%80%93Hellman) - An ephemeral version of the Elliptic Curve Diffie Hellman + key-agreement protocol. + +Ephemeral methods may have some performance drawbacks, because key generation +is expensive. + +## Class: CryptoStream[#](#tls_class_cryptostream) + +```None +Stability: 0 - Deprecated: Use tls.TLSSocket instead. +``` + +This is an encrypted stream. + +### cryptoStream.bytesWritten[#](#tls_cryptostream_byteswritten) + +A proxy to the underlying socket's bytesWritten accessor, this will return +the total bytes written to the socket, *including the TLS overhead*. + +## Class: SecurePair[#](#tls_class_securepair) + +Returned by tls.createSecurePair. + +### Event: 'secure'[#](#tls_event_secure) + +This event is emitted from the SecurePair once the pair has successfully +established a secure connection. + +As with checking for the server [`secureConnection`](#tls_event_secureconnection) +event, `pair.cleartext.authorized` should be inspected to confirm whether the +certificate used is properly authorized. + +## Class: tls.Server[#](#tls_class_tls_server) + +This class is a subclass of `net.Server` and has the same methods on it. +Instead of accepting only raw TCP connections, this accepts encrypted +connections using TLS or SSL. + +### Event: 'clientError'[#](#tls_event_clienterror) + +`function (exception, tlsSocket) { }` + +When a client connection emits an `'error'` event before a secure connection is +established it will be forwarded here. + +`tlsSocket` is the [`tls.TLSSocket`](#tls_class_tls_tlssocket) that the error originated from. + +### Event: 'newSession'[#](#tls_event_newsession) + +`function (sessionId, sessionData, callback) { }` + +Emitted on creation of a TLS session. May be used to store sessions in external +storage. `callback` must be invoked eventually, otherwise no data will be +sent or received from the secure connection. + +NOTE: adding this event listener will only have an effect on connections +established after the addition of the event listener. + +### Event: 'OCSPRequest'[#](#tls_event_ocsprequest) + +`function (certificate, issuer, callback) { }` + +Emitted when the client sends a certificate status request. The server's +current certificate can be parsed to obtain the OCSP URL and certificate ID; +after obtaining an OCSP response `callback(null, resp)` is then invoked, where +`resp` is a `Buffer` instance. Both `certificate` and `issuer` are `Buffer` +DER-representations of the primary and issuer's certificates. They can be used +to obtain the OCSP certificate ID and OCSP endpoint URL. + +Alternatively, `callback(null, null)` may be called, meaning that there was no +OCSP response. + +Calling `callback(err)` will result in a `socket.destroy(err)` call. + +Typical flow: + +1. Client connects to the server and sends an `'OCSPRequest'` to it (via status + info extension in ClientHello). +2. Server receives the request and invokes the `'OCSPRequest'` event listener + if present. +3. Server extracts the OCSP URL from either the `certificate` or `issuer` and + performs an [OCSP request](https://en.wikipedia.org/wiki/OCSP_stapling) to the CA. +4. Server receives `OCSPResponse` from the CA and sends it back to the client + via the `callback` argument +5. Client validates the response and either destroys the socket or performs a + handshake. + +NOTE: `issuer` could be `null` if the certificate is self-signed or if the +issuer is not in the root certificates list. (An issuer may be provided via the +`ca` option.) + +NOTE: adding this event listener will only have an effect on connections +established after the addition of the event listener. + +NOTE: An npm module like [asn1.js](https://npmjs.org/package/asn1.js) may be used to parse the certificates. + +### Event: 'resumeSession'[#](#tls_event_resumesession) + +`function (sessionId, callback) { }` + +Emitted when the client wants to resume the previous TLS session. The event +listener may perform a lookup in external storage using the given `sessionId` +and invoke `callback(null, sessionData)` once finished. If the session can't be +resumed (i.e., doesn't exist in storage) one may call `callback(null, null)`. +Calling `callback(err)` will terminate incoming connection and destroy the +socket. + +NOTE: adding this event listener will only have an effect on connections +established after the addition of the event listener. + +Here's an example for using TLS session resumption: + +```None +var tlsSessionStore = {}; +server.on('newSession', (id, data, cb) => { + tlsSessionStore[id.toString('hex')] = data; + cb(); +}); +server.on('resumeSession', (id, cb) => { + cb(null, tlsSessionStore[id.toString('hex')] || null); +}); +``` + +### Event: 'secureConnection'[#](#tls_event_secureconnection) + +`function (tlsSocket) {}` + +This event is emitted after the handshaking process for a new connection has +successfully completed. The argument is an instance of [`tls.TLSSocket`](#tls_class_tls_tlssocket) and +has all the common stream methods and events. + +`socket.authorized` is a boolean value which indicates if the +client has been verified by one of the supplied certificate authorities for the +server. If `socket.authorized` is false, then `socket.authorizationError` is +set to describe how authorization failed. Implied but worth mentioning: +depending on the settings of the TLS server, unauthorized connections may +be accepted. + +`socket.npnProtocol` is a string containing the selected NPN protocol +and `socket.alpnProtocol` is a string containing the selected ALPN +protocol. When both NPN and ALPN extensions are received, ALPN takes +precedence over NPN and the next protocol is selected by ALPN. When +ALPN has no selected protocol, this returns false. + +`socket.servername` is a string containing the server name requested with +SNI. + +### server.addContext(hostname, context)[#](#tls_server_addcontext_hostname_context) + +Add secure context that will be used if the client request's SNI hostname +matches the supplied `hostname` (wildcards can be used). `context` can contain +`key`, `cert`, `ca` or any other properties from +[`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) `options` argument. + +### server.address()[#](#tls_server_address) + +Returns the bound address, the address family name, and port of the +server as reported by the operating system. See [`net.Server.address()`](net.html#net_server_address) for +more information. + +### server.close([callback])[#](#tls_server_close_callback) + +Stops the server from accepting new connections. This function is +asynchronous, the server is finally closed when the server emits a `'close'` +event. Optionally, you can pass a callback to listen for the `'close'` event. + +### server.connections[#](#tls_server_connections) + +The number of concurrent connections on the server. + +### server.getTicketKeys()[#](#tls_server_getticketkeys) + +Returns a `Buffer` instance holding the keys currently used for +encryption/decryption of the [TLS Session Tickets](https://www.ietf.org/rfc/rfc5077.txt) + +### server.listen(port[, hostname][, callback])[#](#tls_server_listen_port_hostname_callback) + +Begin accepting connections on the specified `port` and `hostname`. If the +`hostname` is omitted, the server will accept connections on any IPv6 address +(`::`) when IPv6 is available, or any IPv4 address (`0.0.0.0`) otherwise. A +port value of zero will assign a random port. + +This function is asynchronous. The last parameter `callback` will be called +when the server has been bound. + +See `net.Server` for more information. + +### server.setTicketKeys(keys)[#](#tls_server_setticketkeys_keys) + +Updates the keys for encryption/decryption of the [TLS Session Tickets](https://www.ietf.org/rfc/rfc5077.txt). + +NOTE: the buffer should be 48 bytes long. See `ticketKeys` option in +[tls.createServer](#tls_tls_createserver_options_secureconnectionlistener) for +more information on how it is used. + +NOTE: the change is effective only for future server connections. Existing +or currently pending server connections will use the previous keys. + +### server.maxConnections[#](#tls_server_maxconnections) + +Set this property to reject connections when the server's connection count +exceeds the specified threshold. + +## Class: tls.TLSSocket[#](#tls_class_tls_tlssocket) + +This is a wrapped version of [`net.Socket`](net.html#net_class_net_socket) that does transparent encryption +of written data and all required TLS negotiation. + +This instance implements the duplex [Stream](stream.html#stream_stream) interface. It has all the +common stream methods and events. + +Methods that return TLS connection metadata (e.g. +[`tls.TLSSocket.getPeerCertificate()`](#tls_tlssocket_getpeercertificate_detailed) will only return data while the +connection is open. + +### new tls.TLSSocket(socket[, options])[#](#tls_new_tls_tlssocket_socket_options) + +Construct a new TLSSocket object from an existing TCP socket. + +`socket` is an instance of [`net.Socket`](net.html#net_class_net_socket) + +`options` is an optional object that might contain following properties: + +* `secureContext`: An optional TLS context object from + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) +* `isServer`: If `true` the TLS socket will be instantiated in server-mode. + Default: `false` +* `server`: An optional [`net.Server`](net.html#net_class_net_server) instance +* `requestCert`: Optional, see [`tls.createSecurePair()`](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options) +* `rejectUnauthorized`: Optional, see [`tls.createSecurePair()`](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options) +* `NPNProtocols`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) +* `ALPNProtocols`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) +* `SNICallback`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) +* `session`: Optional, a `Buffer` instance, containing a TLS session +* `requestOCSP`: Optional, if `true` the OCSP status request extension will + be added to the client hello and an `'OCSPResponse'` event will be emitted + on the socket before establishing a secure communication + +### Event: 'OCSPResponse'[#](#tls_event_ocspresponse) + +`function (response) { }` + +This event will be emitted if the `requestOCSP` option was set. `response` is a +`Buffer` containing the server's OCSP response. + +Traditionally, the `response` is a signed object from the server's CA that +contains information about server's certificate revocation status. + +### Event: 'secureConnect'[#](#tls_event_secureconnect) + +This event is emitted after the handshaking process for a new connection has +successfully completed. The listener will be called regardless of whether or not +the server's certificate has been authorized. It is the user's responsibility to +test `tlsSocket.authorized` to see if the server certificate was signed by one +of the specified CAs. If `tlsSocket.authorized === false` then the error can be +found in `tlsSocket.authorizationError`. Also, if either ALPN or NPN was used +`tlsSocket.alpnProtocol` or `tlsSocket.npnProtocol` can be checked for the +negotiated protocol. + +### tlsSocket.address()[#](#tls_tlssocket_address) + +Returns the bound address, the address family name, and port of the +underlying socket as reported by the operating system. Returns an +object with three properties, e.g., +`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` + +### tlsSocket.authorized[#](#tls_tlssocket_authorized) + +A boolean that is `true` if the peer certificate was signed by one of the +specified CAs, otherwise `false`. + +### tlsSocket.authorizationError[#](#tls_tlssocket_authorizationerror) + +The reason why the peer's certificate has not been verified. This property +becomes available only when `tlsSocket.authorized === false`. + +### tlsSocket.encrypted[#](#tls_tlssocket_encrypted) + +Static boolean value, always `true`. May be used to distinguish TLS sockets +from regular ones. + +### tlsSocket.getCipher()[#](#tls_tlssocket_getcipher) + +Returns an object representing the cipher name and the SSL/TLS protocol version +that first defined the cipher. + +Example: +`{ name: 'AES256-SHA', version: 'TLSv1/SSLv3' }` + +See SSL\_CIPHER\_get\_name() and SSL\_CIPHER\_get\_version() in + for more +information. + +### tlsSocket.getEphemeralKeyInfo()[#](#tls_tlssocket_getephemeralkeyinfo) + +Returns an object representing the type, name, and size of parameter of +an ephemeral key exchange in [Perfect Forward Secrecy](#tls_perfect_forward_secrecy) on a client +connection. It returns an empty object when the key exchange is not +ephemeral. As this is only supported on a client socket, it returns `null` +if called on a server socket. The supported types are 'DH' and 'ECDH'. The +`name` property is only available in 'ECDH'. + +Example: + +```None +{ type: 'ECDH', name: 'prime256v1', size: 256 } +``` + +### tlsSocket.getPeerCertificate([ detailed ])[#](#tls_tlssocket_getpeercertificate_detailed) + +Returns an object representing the peer's certificate. The returned object has +some properties corresponding to the fields of the certificate. If the +`detailed` argument is `true` the full chain with the `issuer` property will be +returned, if `false` only the top certificate without the `issuer` property. + +Example: + +```None +{ subject: + { C: 'UK', + ST: 'Acknack Ltd', + L: 'Rhys Jones', + O: 'node.js', + OU: 'Test TLS Certificate', + CN: 'localhost' }, + issuerInfo: + { C: 'UK', + ST: 'Acknack Ltd', + L: 'Rhys Jones', + O: 'node.js', + OU: 'Test TLS Certificate', + CN: 'localhost' }, + issuer: + { ... another certificate ... }, + raw: < RAW DER buffer >, + valid_from: 'Nov 11 09:52:22 2009 GMT', + valid_to: 'Nov 6 09:52:22 2029 GMT', + fingerprint: '2A:7A:C2:DD:E5:F9:CC:53:72:35:99:7A:02:5A:71:38:52:EC:8A:DF', + serialNumber: 'B9B0D332A1AA5635' } +``` + +If the peer does not provide a certificate, it returns `null` or an empty +object. + +### tlsSocket.getProtocol()[#](#tls_tlssocket_getprotocol) + +Returns a string containing the negotiated SSL/TLS protocol version of the +current connection. `'unknown'` will be returned for connected sockets that have +not completed the handshaking process. `null` will be returned for server +sockets or disconnected client sockets. + +Examples: + +```None +'SSLv3' +'TLSv1' +'TLSv1.1' +'TLSv1.2' +'unknown' +``` + +See for more +information. + +### tlsSocket.getSession()[#](#tls_tlssocket_getsession) + +Returns the ASN.1 encoded TLS session or `undefined` if none was negotiated. +Could be used to speed up handshake establishment when reconnecting to the +server. + +### tlsSocket.getTLSTicket()[#](#tls_tlssocket_gettlsticket) + +NOTE: Works only with client TLS sockets. Useful only for debugging, for +session reuse provide `session` option to [`tls.connect()`](#tls_tls_connect_options_callback). + +Returns the TLS session ticket or `undefined` if none was negotiated. + +### tlsSocket.localAddress[#](#tls_tlssocket_localaddress) + +The string representation of the local IP address. + +### tlsSocket.localPort[#](#tls_tlssocket_localport) + +The numeric representation of the local port. + +### tlsSocket.remoteAddress[#](#tls_tlssocket_remoteaddress) + +The string representation of the remote IP address. For example, +`'74.125.127.100'` or `'2001:4860:a005::68'`. + +### tlsSocket.remoteFamily[#](#tls_tlssocket_remotefamily) + +The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. + +### tlsSocket.remotePort[#](#tls_tlssocket_remoteport) + +The numeric representation of the remote port. For example, `443`. + +### tlsSocket.renegotiate(options, callback)[#](#tls_tlssocket_renegotiate_options_callback) + +Initiate TLS renegotiation process. The `options` object may contain the +following fields: `rejectUnauthorized`, `requestCert`. (See [`tls.createServer +()`][] for details.) `callback(err)` will be executed with `null` as `err`, +once the renegotiation is successfully completed. + +NOTE: Can be used to request peer's certificate after the secure connection +has been established. + +ANOTHER NOTE: When running as the server, socket will be destroyed +with an error after `handshakeTimeout` timeout. + +### tlsSocket.setMaxSendFragment(size)[#](#tls_tlssocket_setmaxsendfragment_size) + +Set maximum TLS fragment size (default and maximum value is: `16384`, minimum +is: `512`). Returns `true` on success, `false` otherwise. + +Smaller fragment sizes decrease the buffering latency on the client: larger +fragments are buffered by the TLS layer until the entire fragment is received +and its integrity is verified; large fragments can span multiple roundtrips +and their processing can be delayed due to packet loss or reordering. However, +smaller fragments add extra TLS framing bytes and CPU overhead, which may +decrease overall server throughput. + +## tls.connect(options[, callback])[#](#tls_tls_connect_options_callback) + +## tls.connect(port[, host][, options][, callback])[#](#tls_tls_connect_port_host_options_callback) + +Creates a new client connection to the given `port` and `host` (old API) or +`options.port` and `options.host`. (If `host` is omitted, it defaults to +`localhost`.) `options` should be an object which specifies: + +* `host`: Host the client should connect to. +* `port`: Port the client should connect to. +* `socket`: Establish secure connection on a given socket rather than + creating a new socket. If this option is specified, `host` and `port` + are ignored. +* `path`: Creates unix socket connection to path. If this option is + specified, `host` and `port` are ignored. +* `pfx`: A string or `Buffer` containing the private key, certificate, and + CA certs of the client in PFX or PKCS12 format. +* `key`: A string, `Buffer`, array of strings, or array of `Buffer`s + containing the private key of the client in PEM format. +* `passphrase`: A string containing the passphrase for the private key or pfx. +* `cert`: A string, `Buffer`, array of strings, or array of `Buffer`s + containing the certificate key of the client in PEM format. +* `ca`: A string, `Buffer`, array of strings, or array of `Buffer`s of trusted + certificates in PEM format. If this is omitted several well known "root" + CAs (like VeriSign) will be used. These are used to authorize connections. +* `ciphers`: A string describing the ciphers to use or exclude, separated by + `:`. Uses the same default cipher suite as [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener). +* `rejectUnauthorized`: If `true`, the server certificate is verified against + the list of supplied CAs. An `'error'` event is emitted if verification + fails; `err.code` contains the OpenSSL error code. Default: `true`. +* `NPNProtocols`: An array of strings or `Buffer`s containing supported NPN + protocols. `Buffer`s should have the following format: + `0x05hello0x05world`, where the first byte is the next protocol name's + length. (Passing an array is usually be much simpler: `['hello', 'world']`.) +* `ALPNProtocols`: An array of strings or `Buffer`s containing the + supported ALPN protocols. `Buffer`s should have following format: + `0x05hello0x05world`, where the first byte is the next protocol + name's length. (Passing an array is usually be much simpler: + `['hello', 'world']`.) +* `servername`: Server name for the SNI (Server Name Indication) TLS + extension. +* `checkServerIdentity(servername, cert)`: Provide an override for checking + the server's hostname against the certificate. Should return an error if + verification fails. Returns `undefined` if passing. +* `secureProtocol`: The SSL method to use, e.g., `SSLv3_method` to force + SSL version 3. The possible values depend on the version of OpenSSL + installed in the environment and are defined in the constant + [SSL\_METHODS](https://www.openssl.org/docs/ssl/ssl.html#DEALING_WITH_PROTOCOL_METHODS). +* `secureContext`: An optional TLS context object from + `tls.createSecureContext( ... )`. It can be used for caching client + certificates, keys, and CA certificates. +* `session`: A `Buffer` instance, containing TLS session. +* `minDHSize`: Minimum size of the DH parameter in bits to accept a TLS + connection. When a server offers a DH parameter with a size less + than this, the TLS connection is destroyed and an error is thrown. Default: + 1024. + +The `callback` parameter will be added as a listener for the +[`'secureConnect'`](#tls_event_secureconnect) event. + +`tls.connect()` returns a [`tls.TLSSocket`](#tls_class_tls_tlssocket) object. + +Here is an example of a client of echo server as described previously: + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + // These are necessary only if using the client certificate authentication + key: fs.readFileSync('client-key.pem'), + cert: fs.readFileSync('client-cert.pem'), + + // This is necessary only if the server uses the self-signed certificate + ca: [ fs.readFileSync('server-cert.pem') ] +}; + +var socket = tls.connect(8000, options, () => { + console.log('client connected', + socket.authorized ? 'authorized' : 'unauthorized'); + process.stdin.pipe(socket); + process.stdin.resume(); +}); +socket.setEncoding('utf8'); +socket.on('data', (data) => { + console.log(data); +}); +socket.on('end', () => { + server.close(); +}); +``` + +Or + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + pfx: fs.readFileSync('client.pfx') +}; + +var socket = tls.connect(8000, options, () => { + console.log('client connected', + socket.authorized ? 'authorized' : 'unauthorized'); + process.stdin.pipe(socket); + process.stdin.resume(); +}); +socket.setEncoding('utf8'); +socket.on('data', (data) => { + console.log(data); +}); +socket.on('end', () => { + server.close(); +}); +``` + +## tls.createSecureContext(options)[#](#tls_tls_createsecurecontext_options) + +Creates a credentials object; the `options` object may contain the following +fields: + +* `pfx` : A string or `Buffer` holding the PFX or PKCS12 encoded private + key, certificate, and CA certificates. +* `key`: A string or `Buffer` containing the private key of the server in + PEM format. To support multiple keys using different algorithms, an array + can be provided. It can either be a plain array of keys or an array of + objects in the format `{pem: key, passphrase: passphrase}`. (Required) +* `passphrase` : A string containing the passphrase for the private key or pfx. +* `cert` : A string containing the PEM encoded certificate +* `ca`: A string, `Buffer`, array of strings, or array of `Buffer`s of trusted + certificates in PEM format. If this is omitted several well known "root" + CAs (like VeriSign) will be used. These are used to authorize connections. +* `crl` : Either a string or list of strings of PEM encoded CRLs + (Certificate Revocation List). +* `ciphers`: A string describing the ciphers to use or exclude. + Consult + + for details on the format. +* `honorCipherOrder` : When choosing a cipher, use the server's preferences + instead of the client preferences. For further details see `tls` module + documentation. + +If no 'CA' details are given, then Node.js will use the default +publicly trusted list of CAs as given in + +. + +## tls.createSecurePair([context][, isServer][, requestCert][, rejectUnauthorized][, options])[#](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options) + +Creates a new secure pair object with two streams, one of which reads and writes +the encrypted data and the other of which reads and writes the cleartext data. +Generally, the encrypted stream is piped to/from an incoming encrypted data +stream and the cleartext one is used as a replacement for the initial encrypted +stream. + +* `credentials`: A secure context object from `tls.createSecureContext( ... )`. +* `isServer`: A boolean indicating whether this TLS connection should be + opened as a server or a client. +* `requestCert`: A boolean indicating whether a server should request a + certificate from a connecting client. Only applies to server connections. +* `rejectUnauthorized`: A boolean indicating whether a server should + automatically reject clients with invalid certificates. Only applies to + servers with `requestCert` enabled. +* `options`: An object with common SSL options. See [`tls.TLSSocket`](#tls_class_tls_tlssocket). + +`tls.createSecurePair()` returns a SecurePair object with `cleartext` and +`encrypted` stream properties. + +NOTE: `cleartext` has the same API as [`tls.TLSSocket`](#tls_class_tls_tlssocket) + +## tls.createServer(options[, secureConnectionListener])[#](#tls_tls_createserver_options_secureconnectionlistener) + +Creates a new [tls.Server](#tls_class_tls_server). The `connectionListener` argument is +automatically set as a listener for the [`'secureConnection'`](#tls_event_secureconnection) event. The +`options` object may contain the following fields: + +* `pfx`: A string or `Buffer` containing the private key, certificate and + CA certs of the server in PFX or PKCS12 format. (Mutually exclusive with + the `key`, `cert`, and `ca` options.) +* `key`: A string or `Buffer` containing the private key of the server in + PEM format. To support multiple keys using different algorithms an array + can be provided. It can either be a plain array of keys or an array of + objects in the format `{pem: key, passphrase: passphrase}`. (Required) +* `passphrase`: A string containing the passphrase for the private key or pfx. +* `cert`: A string, `Buffer`, array of strings, or array of `Buffer`s + containing the certificate key of the server in PEM format. (Required) +* `ca`: A string, `Buffer`, array of strings, or array of `Buffer`s of trusted + certificates in PEM format. If this is omitted several well known "root" + CAs (like VeriSign) will be used. These are used to authorize connections. +* `crl` : Either a string or array of strings of PEM encoded CRLs (Certificate + Revocation List). +* `ciphers`: A string describing the ciphers to use or exclude, separated by + `:`. The default cipher suite is: + + ```None + ECDHE-RSA-AES128-GCM-SHA256: + ECDHE-ECDSA-AES128-GCM-SHA256: + ECDHE-RSA-AES256-GCM-SHA384: + ECDHE-ECDSA-AES256-GCM-SHA384: + DHE-RSA-AES128-GCM-SHA256: + ECDHE-RSA-AES128-SHA256: + DHE-RSA-AES128-SHA256: + ECDHE-RSA-AES256-SHA384: + DHE-RSA-AES256-SHA384: + ECDHE-RSA-AES256-SHA256: + DHE-RSA-AES256-SHA256: + HIGH: + !aNULL: + !eNULL: + !EXPORT: + !DES: + !RC4: + !MD5: + !PSK: + !SRP: + !CAMELLIA + ``` + + The default cipher suite prefers GCM ciphers for [Chrome's 'modern + cryptography' setting](https://www.chromium.org/Home/chromium-security/education/tls#TOC-Deprecation-of-TLS-Features-Algorithms-in-Chrome) and also prefers ECDHE and DHE ciphers for Perfect + Forward Secrecy, while offering *some* backward compatibility. + + 128 bit AES is preferred over 192 and 256 bit AES in light of [specific + attacks affecting larger AES key sizes](https://www.schneier.com/blog/archives/2009/07/another_new_aes.html). + + Old clients that rely on insecure and deprecated RC4 or DES-based ciphers + (like Internet Explorer 6) cannot complete the handshaking process with + the default configuration. If these clients *must* be supported, the + [TLS recommendations](https://wiki.mozilla.org/Security/Server_Side_TLS) may offer a compatible cipher suite. For more details + on the format, see the [OpenSSL cipher list format documentation](https://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT). +* `ecdhCurve`: A string describing a named curve to use for ECDH key agreement + or false to disable ECDH. + + Defaults to `prime256v1` (NIST P-256). Use [`crypto.getCurves()`](crypto.html#crypto_crypto_getcurves) to + obtain a list of available curve names. On recent releases, + `openssl ecparam -list_curves` will also display the name and description of + each available elliptic curve. +* `dhparam`: A string or `Buffer` containing Diffie Hellman parameters, + required for Perfect Forward Secrecy. Use `openssl dhparam` to create it. + Its key length should be greater than or equal to 1024 bits, otherwise + it throws an error. It is strongly recommended to use 2048 bits or + larger for stronger security. If omitted or invalid, it is silently + discarded and DHE ciphers won't be available. +* `handshakeTimeout`: Abort the connection if the SSL/TLS handshake does not + finish in the specified number of milliseconds. The default is 120 seconds. + + A `'clientError'` is emitted on the `tls.Server` object whenever a handshake + times out. +* `honorCipherOrder` : When choosing a cipher, use the server's preferences + instead of the client preferences. Default: `true`. +* `requestCert`: If `true` the server will request a certificate from + clients that connect and attempt to verify that certificate. Default: + `false`. +* `rejectUnauthorized`: If `true` the server will reject any connection + which is not authorized with the list of supplied CAs. This option only + has an effect if `requestCert` is `true`. Default: `false`. +* `NPNProtocols`: An array or `Buffer` of possible NPN protocols. (Protocols + should be ordered by their priority.) +* `ALPNProtocols`: An array or `Buffer` of possible ALPN + protocols. (Protocols should be ordered by their priority.) When + the server receives both NPN and ALPN extensions from the client, + ALPN takes precedence over NPN and the server does not send an NPN + extension to the client. +* `SNICallback(servername, cb)`: A function that will be called if the client + supports SNI TLS extension. Two arguments will be passed to it: + `servername` and `cb`. `SNICallback` should invoke `cb(null, ctx)`, where + `ctx` is a SecureContext instance. (`tls.createSecureContext(...)` can be + used to get a proper SecureContext.) If `SNICallback` wasn't provided the + default callback with high-level API will be used (see below). +* `sessionTimeout`: An integer specifying the number of seconds after which + the TLS session identifiers and TLS session tickets created by the server + will time out. See [SSL\_CTX\_set\_timeout](https://www.openssl.org/docs/ssl/SSL_CTX_set_timeout.html) for more details. +* `ticketKeys`: A 48-byte `Buffer` instance consisting of a 16-byte prefix, + a 16-byte HMAC key, and a 16-byte AES key. This can be used to accept TLS + session tickets on multiple instances of the TLS server. + + NOTE: Automatically shared between `cluster` module workers. +* `sessionIdContext`: A string containing an opaque identifier for session + resumption. If `requestCert` is `true`, the default is a MD5 hash value + generated from the command-line. (In FIPS mode a truncated SHA1 hash is + used instead.) Otherwise, a default is not provided. +* `secureProtocol`: The SSL method to use, e.g., `SSLv3_method` to force + SSL version 3. The possible values depend on the version of OpenSSL + installed in the environment and are defined in the constant [SSL\_METHODS](https://www.openssl.org/docs/ssl/ssl.html#DEALING_WITH_PROTOCOL_METHODS). + +Here is a simple example echo server: + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + key: fs.readFileSync('server-key.pem'), + cert: fs.readFileSync('server-cert.pem'), + + // This is necessary only if using the client certificate authentication. + requestCert: true, + + // This is necessary only if the client uses the self-signed certificate. + ca: [ fs.readFileSync('client-cert.pem') ] +}; + +var server = tls.createServer(options, (socket) => { + console.log('server connected', + socket.authorized ? 'authorized' : 'unauthorized'); + socket.write('welcome!\n'); + socket.setEncoding('utf8'); + socket.pipe(socket); +}); +server.listen(8000, () => { + console.log('server bound'); +}); +``` + +Or + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + pfx: fs.readFileSync('server.pfx'), + + // This is necessary only if using the client certificate authentication. + requestCert: true, + +}; + +var server = tls.createServer(options, (socket) => { + console.log('server connected', + socket.authorized ? 'authorized' : 'unauthorized'); + socket.write('welcome!\n'); + socket.setEncoding('utf8'); + socket.pipe(socket); +}); +server.listen(8000, () => { + console.log('server bound'); +}); +``` + +You can test this server by connecting to it with `openssl s_client`: + +```None +openssl s_client -connect 127.0.0.1:8000 +``` + +## tls.getCiphers()[#](#tls_tls_getciphers) + +Returns an array with the names of the supported SSL ciphers. + +Example: + +```None +var ciphers = tls.getCiphers(); +console.log(ciphers); // ['AES128-SHA', 'AES256-SHA', ...] +``` diff --git a/corpus/docs/nodejs/tls/tls_6x.md b/corpus/docs/nodejs/tls/tls_6x.md new file mode 100644 index 0000000000000000000000000000000000000000..c9aa10da52126ddb04f9e5c1e077d2ba10b3110a --- /dev/null +++ b/corpus/docs/nodejs/tls/tls_6x.md @@ -0,0 +1,1163 @@ +# TLS (SSL)# + +Source: https://nodejs.org/docs/latest-v6.x/api/tls.html +Version: 6.x + +[Stability: 2](documentation.html#documentation_stability_index) - Stable + +The `tls` module provides an implementation of the Transport Layer Security +(TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL. +The module can be accessed using: + +```None +const tls = require('tls'); +``` + +## TLS/SSL Concepts[#](#tls_tls_ssl_concepts) + +The TLS/SSL is a public/private key infrastructure (PKI). For most common +cases, each client and server must have a *private key*. + +Private keys can be generated in multiple ways. The example below illustrates +use of the OpenSSL command-line interface to generate a 2048-bit RSA private +key: + +```None +openssl genrsa -out ryans-key.pem 2048 +``` + +With TLS/SSL, all servers (and some clients) must have a *certificate*. +Certificates are *public keys* that correspond to a private key, and that are +digitally signed either by a Certificate Authority or by the owner of the +private key (such certificates are referred to as "self-signed"). The first +step to obtaining a certificate is to create a *Certificate Signing Request* +(CSR) file. + +The OpenSSL command-line interface can be used to generate a CSR for a private +key: + +```None +openssl req -new -sha256 -key ryans-key.pem -out ryans-csr.pem +``` + +Once the CSR file is generated, it can either be sent to a Certificate +Authority for signing or used to generate a self-signed certificate. + +Creating a self-signed certificate using the OpenSSL command-line interface +is illustrated in the example below: + +```None +openssl x509 -req -in ryans-csr.pem -signkey ryans-key.pem -out ryans-cert.pem +``` + +Once the certificate is generated, it can be used to generate a `.pfx` or +`.p12` file: + +```None +openssl pkcs12 -export -in ryans-cert.pem -inkey ryans-key.pem \ + -certfile ca-cert.pem -out ryans.pfx +``` + +Where: + +* `in`: is the signed certificate +* `inkey`: is the associated private key +* `certfile`: is a concatenation of all Certificate Authority (CA) certs into + a single file, e.g. `cat ca1-cert.pem ca2-cert.pem > ca-cert.pem` + +### Perfect Forward Secrecy[#](#tls_perfect_forward_secrecy) + +The term "[Forward Secrecy](https://en.wikipedia.org/wiki/Perfect_forward_secrecy)" or "Perfect Forward Secrecy" describes a feature of +key-agreement (i.e., key-exchange) methods. That is, the server and client keys +are used to negotiate new temporary keys that are used specifically and only for +the current communication session. Practically, this means that even if the +server's private key is compromised, communication can only be decrypted by +eavesdroppers if the attacker manages to obtain the key-pair specifically +generated for the session. + +Perfect Forward Secrecy is achieved by randomly generating a key pair for +key-agreement on every TLS/SSL handshake (in contrast to using the same key for +all sessions). Methods implementing this technique are called "ephemeral". + +Currently two methods are commonly used to achieve Perfect Forward Secrecy (note +the character "E" appended to the traditional abbreviations): + +* [DHE](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange) - An ephemeral version of the Diffie Hellman key-agreement protocol. +* [ECDHE](https://en.wikipedia.org/wiki/Elliptic_curve_Diffie%E2%80%93Hellman) - An ephemeral version of the Elliptic Curve Diffie Hellman + key-agreement protocol. + +Ephemeral methods may have some performance drawbacks, because key generation +is expensive. + +To use Perfect Forward Secrecy using `DHE` with the `tls` module, it is required +to generate Diffie-Hellman parameters and specify them with the `dhparam` +option to [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). The following illustrates the use of +the OpenSSL command-line interface to generate such parameters: + +```None +openssl dhparam -outform PEM -out dhparam.pem 2048 +``` + +If using Perfect Forward Secrecy using `ECDHE`, Diffie-Hellman parameters are +not required and a default ECDHE curve will be used. The `ecdhCurve` property +can be used when creating a TLS Server to specify the name of an alternative +curve to use, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) for more info. + +### ALPN, NPN and SNI[#](#tls_alpn_npn_and_sni) + +ALPN (Application-Layer Protocol Negotiation Extension), NPN (Next +Protocol Negotiation) and, SNI (Server Name Indication) are TLS +handshake extensions: + +* ALPN/NPN - Allows the use of one TLS server for multiple protocols (HTTP, + SPDY, HTTP/2) +* SNI - Allows the use of one TLS server for multiple hostnames with different + SSL certificates. + +*Note*: Use of ALPN is recommended over NPN. The NPN extension has never been +formally defined or documented and generally not recommended for use. + +### Client-initiated renegotiation attack mitigation[#](#tls_client_initiated_renegotiation_attack_mitigation) + +The TLS protocol allows clients to renegotiate certain aspects of the TLS +session. Unfortunately, session renegotiation requires a disproportionate amount +of server-side resources, making it a potential vector for denial-of-service +attacks. + +To mitigate the risk, renegotiation is limited to three times every ten minutes. +An `'error'` event is emitted on the [`tls.TLSSocket`](#tls_class_tls_tlssocket) instance when this +threshold is exceeded. The limits are configurable: + +* `tls.CLIENT_RENEG_LIMIT` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Specifies the number of renegotiation + requests. Defaults to `3`. +* `tls.CLIENT_RENEG_WINDOW` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Specifies the time renegotiation window + in seconds. Defaults to `600` (10 minutes). + +*Note*: The default renegotiation limits should not be modified without a full +understanding of the implications and risks. + +To test the renegotiation limits on a server, connect to it using the OpenSSL +command-line client (`openssl s_client -connect address:port`) then input +`R` (i.e., the letter `R` followed by a carriage return) multiple times. + +## Modifying the Default TLS Cipher suite[#](#tls_modifying_the_default_tls_cipher_suite) + +Node.js is built with a default suite of enabled and disabled TLS ciphers. +Currently, the default cipher suite is: + +```None +ECDHE-RSA-AES128-GCM-SHA256: +ECDHE-ECDSA-AES128-GCM-SHA256: +ECDHE-RSA-AES256-GCM-SHA384: +ECDHE-ECDSA-AES256-GCM-SHA384: +DHE-RSA-AES128-GCM-SHA256: +ECDHE-RSA-AES128-SHA256: +DHE-RSA-AES128-SHA256: +ECDHE-RSA-AES256-SHA384: +DHE-RSA-AES256-SHA384: +ECDHE-RSA-AES256-SHA256: +DHE-RSA-AES256-SHA256: +HIGH: +!aNULL: +!eNULL: +!EXPORT: +!DES: +!RC4: +!MD5: +!PSK: +!SRP: +!CAMELLIA +``` + +This default can be replaced entirely using the `--tls-cipher-list` command +line switch. For instance, the following makes +`ECDHE-RSA-AES128-GCM-SHA256:!RC4` the default TLS cipher suite: + +```None +node --tls-cipher-list="ECDHE-RSA-AES128-GCM-SHA256:!RC4" +``` + +The default can also be replaced on a per client or server basis using the +`ciphers` option from [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options), which is also available +in [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener), [`tls.connect()`](#tls_tls_connect_options_callback), and when creating new +[`tls.TLSSocket`](#tls_class_tls_tlssocket)s. + +Consult [OpenSSL cipher list format documentation](https://www.openssl.org/docs/man1.0.2/apps/ciphers.html#CIPHER-LIST-FORMAT) for details on the format. + +*Note*: The default cipher suite included within Node.js has been carefully +selected to reflect current security best practices and risk mitigation. +Changing the default cipher suite can have a significant impact on the security +of an application. The `--tls-cipher-list` switch and `ciphers` option should by +used only if absolutely necessary. + +The default cipher suite prefers GCM ciphers for [Chrome's 'modern +cryptography' setting](https://www.chromium.org/Home/chromium-security/education/tls#TOC-Cipher-Suites) and also prefers ECDHE and DHE ciphers for Perfect +Forward Secrecy, while offering *some* backward compatibility. + +128 bit AES is preferred over 192 and 256 bit AES in light of [specific +attacks affecting larger AES key sizes](https://www.schneier.com/blog/archives/2009/07/another_new_aes.html). + +Old clients that rely on insecure and deprecated RC4 or DES-based ciphers +(like Internet Explorer 6) cannot complete the handshaking process with +the default configuration. If these clients *must* be supported, the +[TLS recommendations](https://wiki.mozilla.org/Security/Server_Side_TLS) may offer a compatible cipher suite. For more details +on the format, see the [OpenSSL cipher list format documentation](https://www.openssl.org/docs/man1.0.2/apps/ciphers.html#CIPHER-LIST-FORMAT). + +## Class: tls.Server[#](#tls_class_tls_server) + +Added in: v0.3.2 + +The `tls.Server` class is a subclass of `net.Server` that accepts encrypted +connections using TLS or SSL. + +### Event: 'tlsClientError'[#](#tls_event_tlsclienterror) + +Added in: v6.0.0 + +The `'tlsClientError'` event is emitted when an error occurs before a secure +connection is established. The listener callback is passed two arguments when +called: + +* `exception` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) The `Error` object describing the error +* `tlsSocket` [](tls.html#tls_class_tls_tlssocket) The `tls.TLSSocket` instance from which the + error originated. + +### Event: 'newSession'[#](#tls_event_newsession) + +Added in: v0.9.2 + +The `'newSession'` event is emitted upon creation of a new TLS session. This may +be used to store sessions in external storage. The listener callback is passed +three arguments when called: + +* `sessionId` - The TLS session identifier +* `sessionData` - The TLS session data +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function taking no arguments that must be + invoked in order for data to be sent or received over the secure connection. + +*Note*: Listening for this event will have an effect only on connections +established after the addition of the event listener. + +### Event: 'OCSPRequest'[#](#tls_event_ocsprequest) + +Added in: v0.11.13 + +The `'OCSPRequest'` event is emitted when the client sends a certificate status +request. The listener callback is passed three arguments when called: + +* `certificate` [](buffer.html#buffer_class_buffer) The server certificate +* `issuer` [](buffer.html#buffer_class_buffer) The issuer's certificate +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function that must be invoked to provide + the results of the OCSP request. + +The server's current certificate can be parsed to obtain the OCSP URL +and certificate ID; after obtaining an OCSP response, `callback(null, resp)` is +then invoked, where `resp` is a `Buffer` instance containing the OCSP response. +Both `certificate` and `issuer` are `Buffer` DER-representations of the +primary and issuer's certificates. These can be used to obtain the OCSP +certificate ID and OCSP endpoint URL. + +Alternatively, `callback(null, null)` may be called, indicating that there was +no OCSP response. + +Calling `callback(err)` will result in a `socket.destroy(err)` call. + +The typical flow of an OCSP Request is as follows: + +1. Client connects to the server and sends an `'OCSPRequest'` (via the status + info extension in ClientHello). +2. Server receives the request and emits the `'OCSPRequest'` event, calling the + listener if registered. +3. Server extracts the OCSP URL from either the `certificate` or `issuer` and + performs an [OCSP request](https://en.wikipedia.org/wiki/OCSP_stapling) to the CA. +4. Server receives `OCSPResponse` from the CA and sends it back to the client + via the `callback` argument +5. Client validates the response and either destroys the socket or performs a + handshake. + +*Note*: The `issuer` can be `null` if the certificate is either self-signed or +the issuer is not in the root certificates list. (An issuer may be provided +via the `ca` option when establishing the TLS connection.) + +*Note*: Listening for this event will have an effect only on connections +established after the addition of the event listener. + +*Note*: An npm module like [asn1.js](https://npmjs.org/package/asn1.js) may be used to parse the certificates. + +### Event: 'resumeSession'[#](#tls_event_resumesession) + +Added in: v0.9.2 + +The `'resumeSession'` event is emitted when the client requests to resume a +previous TLS session. The listener callback is passed two arguments when +called: + +* `sessionId` - The TLS/SSL session identifier +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function to be called when the prior session + has been recovered. + +When called, the event listener may perform a lookup in external storage using +the given `sessionId` and invoke `callback(null, sessionData)` once finished. If +the session cannot be resumed (i.e., doesn't exist in storage) the callback may +be invoked as `callback(null, null)`. Calling `callback(err)` will terminate the +incoming connection and destroy the socket. + +*Note*: Listening for this event will have an effect only on connections +established after the addition of the event listener. + +The following illustrates resuming a TLS session: + +```None +const tlsSessionStore = {}; +server.on('newSession', (id, data, cb) => { + tlsSessionStore[id.toString('hex')] = data; + cb(); +}); +server.on('resumeSession', (id, cb) => { + cb(null, tlsSessionStore[id.toString('hex')] || null); +}); +``` + +### Event: 'secureConnection'[#](#tls_event_secureconnection) + +Added in: v0.3.2 + +The `'secureConnection'` event is emitted after the handshaking process for a +new connection has successfully completed. The listener callback is passed a +single argument when called: + +* `tlsSocket` [](tls.html#tls_class_tls_tlssocket) The established TLS socket. + +The `tlsSocket.authorized` property is a `boolean` indicating whether the +client has been verified by one of the supplied Certificate Authorities for the +server. If `tlsSocket.authorized` is `false`, then `socket.authorizationError` +is set to describe how authorization failed. Note that depending on the settings +of the TLS server, unauthorized connections may still be accepted. + +The `tlsSocket.npnProtocol` and `tlsSocket.alpnProtocol` properties are strings +that contain the selected NPN and ALPN protocols, respectively. When both NPN +and ALPN extensions are received, ALPN takes precedence over NPN and the next +protocol is selected by ALPN. + +When ALPN has no selected protocol, `tlsSocket.alpnProtocol` returns `false`. + +The `tlsSocket.servername` property is a string containing the server name +requested via SNI. + +### server.addContext(hostname, context)[#](#tls_server_addcontext_hostname_context) + +Added in: v0.5.3 + +* `hostname` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A SNI hostname or wildcard (e.g. `'*'`) +* `context` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) An object containing any of the possible properties + from the [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) `options` arguments (e.g. `key`, + `cert`, `ca`, etc). + +The `server.addContext()` method adds a secure context that will be used if +the client request's SNI hostname matches the supplied `hostname` (or wildcard). + +### server.address()[#](#tls_server_address) + +Added in: v0.6.0 + +Returns the bound address, the address family name, and port of the +server as reported by the operating system. See [`net.Server.address()`](net.html#net_server_address) for +more information. + +### server.close([callback])[#](#tls_server_close_callback) + +Added in: v0.3.2 + +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) An optional listener callback that will be registered to + listen for the server instance's `'close'` event. + +The `server.close()` method stops the server from accepting new connections. + +This function operates asynchronously. The `'close'` event will be emitted +when the server has no more open connections. + +### server.connections[#](#tls_server_connections) + +Added in: v0.3.2 + +Returns the current number of concurrent connections on the server. + +### server.getTicketKeys()[#](#tls_server_getticketkeys) + +Added in: v3.0.0 + +Returns a `Buffer` instance holding the keys currently used for +encryption/decryption of the [TLS Session Tickets](https://www.ietf.org/rfc/rfc5077.txt) + +### server.listen(port[, hostname][, callback])[#](#tls_server_listen_port_hostname_callback) + +Added in: v0.3.2 + +* `port` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The TCP/IP port on which to begin listening for connections. + A value of `0` (zero) will assign a random port. +* `hostname` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The hostname, IPv4, or IPv6 address on which to begin + listening for connections. If `undefined`, the server will accept connections + on any IPv6 address (`::`) when IPv6 is available, or any IPv4 address + (`0.0.0.0`) otherwise. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function to be invoked when the server has + begun listening on the `port` and `hostname`. + +The `server.listen()` methods instructs the server to begin accepting +connections on the specified `port` and `hostname`. + +This function operates asynchronously. If the `callback` is given, it will be +called when the server has started listening. + +See [`net.Server`](net.html#net_class_net_server) for more information. + +### server.setTicketKeys(keys)[#](#tls_server_setticketkeys_keys) + +Added in: v3.0.0 + +* `keys` [](buffer.html#buffer_class_buffer) The keys used for encryption/decryption of the + [TLS Session Tickets](https://www.ietf.org/rfc/rfc5077.txt). + +Updates the keys for encryption/decryption of the [TLS Session Tickets](https://www.ietf.org/rfc/rfc5077.txt). + +*Note*: The key's `Buffer` should be 48 bytes long. See `ticketKeys` option in +[tls.createServer](#tls_tls_createserver_options_secureconnectionlistener) for +more information on how it is used. + +*Note*: Changes to the ticket keys are effective only for future server +connections. Existing or currently pending server connections will use the +previous keys. + +## Class: tls.TLSSocket[#](#tls_class_tls_tlssocket) + +Added in: v0.11.4 + +The `tls.TLSSocket` is a subclass of [`net.Socket`](net.html#net_class_net_socket) that performs transparent +encryption of written data and all required TLS negotiation. + +Instances of `tls.TLSSocket` implement the duplex [Stream](stream.html#stream_stream) interface. + +*Note*: Methods that return TLS connection metadata (e.g. +[`tls.TLSSocket.getPeerCertificate()`](#tls_tlssocket_getpeercertificate_detailed) will only return data while the +connection is open. + +### new tls.TLSSocket(socket[, options])[#](#tls_new_tls_tlssocket_socket_options) + +Added in: v0.11.4 + +* `socket` [](net.html#net_class_net_socket) | [](stream.html#stream_class_stream_duplex) + On the server side, any `Duplex` stream. On the client side, any + instance of [`net.Socket`](net.html#net_class_net_socket) (for generic `Duplex` stream support + on the client side, [`tls.connect()`](#tls_tls_connect_options_callback) must be used). +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `isServer`: The SSL/TLS protocol is asymmetrical, TLSSockets must know if + they are to behave as a server or a client. If `true` the TLS socket will be + instantiated as a server. Defaults to `false`. + + `server` [](net.html#net_class_net_server) An optional [`net.Server`](net.html#net_class_net_server) instance. + + `requestCert`: Whether to authenticate the remote peer by requesting a + certificate. Clients always request a server certificate. Servers + (`isServer` is true) may optionally set `requestCert` to true to request a + client certificate. + + `rejectUnauthorized`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `NPNProtocols`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `ALPNProtocols`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `SNICallback`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `session` [](buffer.html#buffer_class_buffer) An optional `Buffer` instance containing a TLS session. + + `requestOCSP` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true`, specifies that the OCSP status request + extension will be added to the client hello and an `'OCSPResponse'` event + will be emitted on the socket before establishing a secure communication + + `secureContext`: Optional TLS context object created with + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). If a `secureContext` is *not* provided, one + will be created by passing the entire `options` object to + `tls.createSecureContext()`. *Note*: In effect, all + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) options can be provided, but they will be + *completely ignored* unless the `secureContext` option is missing. + + ...: Optional [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) options can be provided, see + the `secureContext` option for more information. + +Construct a new `tls.TLSSocket` object from an existing TCP socket. + +### Event: 'OCSPResponse'[#](#tls_event_ocspresponse) + +Added in: v0.11.13 + +The `'OCSPResponse'` event is emitted if the `requestOCSP` option was set +when the `tls.TLSSocket` was created and an OCSP response has been received. +The listener callback is passed a single argument when called: + +* `response` [](buffer.html#buffer_class_buffer) The server's OCSP response + +Typically, the `response` is a digitally signed object from the server's CA that +contains information about server's certificate revocation status. + +### Event: 'secureConnect'[#](#tls_event_secureconnect) + +Added in: v0.11.4 + +The `'secureConnect'` event is emitted after the handshaking process for a new +connection has successfully completed. The listener callback will be called +regardless of whether or not the server's certificate has been authorized. It +is the client's responsibility to check the `tlsSocket.authorized` property to +determine if the server certificate was signed by one of the specified CAs. If +`tlsSocket.authorized === false`, then the error can be found by examining the +`tlsSocket.authorizationError` property. If either ALPN or NPN was used, +the `tlsSocket.alpnProtocol` or `tlsSocket.npnProtocol` properties can be +checked to determine the negotiated protocol. + +### tlsSocket.address()[#](#tls_tlssocket_address) + +Added in: v0.11.4 + +Returns the bound address, the address family name, and port of the +underlying socket as reported by the operating system. Returns an +object with three properties, e.g., +`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` + +### tlsSocket.authorized[#](#tls_tlssocket_authorized) + +Added in: v0.11.4 + +Returns `true` if the peer certificate was signed by one of the CAs specified +when creating the `tls.TLSSocket` instance, otherwise `false`. + +### tlsSocket.authorizationError[#](#tls_tlssocket_authorizationerror) + +Added in: v0.11.4 + +Returns the reason why the peer's certificate was not been verified. This +property is set only when `tlsSocket.authorized === false`. + +### tlsSocket.encrypted[#](#tls_tlssocket_encrypted) + +Added in: v0.11.4 + +Always returns `true`. This may be used to distinguish TLS sockets from regular +`net.Socket` instances. + +### tlsSocket.getCipher()[#](#tls_tlssocket_getcipher) + +Added in: v0.11.4 + +Returns an object representing the cipher name and the SSL/TLS protocol version +that first defined the cipher. + +For example: `{ name: 'AES256-SHA', version: 'TLSv1/SSLv3' }` + +See `SSL_CIPHER_get_name()` and `SSL_CIPHER_get_version()` in + for more +information. + +### tlsSocket.getEphemeralKeyInfo()[#](#tls_tlssocket_getephemeralkeyinfo) + +Added in: v5.0.0 + +Returns an object representing the type, name, and size of parameter of +an ephemeral key exchange in [Perfect Forward Secrecy](#tls_perfect_forward_secrecy) on a client +connection. It returns an empty object when the key exchange is not +ephemeral. As this is only supported on a client socket; `null` is returned +if called on a server socket. The supported types are `'DH'` and `'ECDH'`. The +`name` property is available only when type is 'ECDH'. + +For Example: `{ type: 'ECDH', name: 'prime256v1', size: 256 }` + +### tlsSocket.getPeerCertificate([ detailed ])[#](#tls_tlssocket_getpeercertificate_detailed) + +Added in: v0.11.4 + +* `detailed` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Include the full certificate chain if `true`, otherwise + include just the peer's certificate. + +Returns an object representing the peer's certificate. The returned object has +some properties corresponding to the fields of the certificate. + +If the full certificate chain was requested, each certificate will include a +`issuerCertificate` property containing an object representing its issuer's +certificate. + +For example: + +```None +{ subject: + { C: 'UK', + ST: 'Acknack Ltd', + L: 'Rhys Jones', + O: 'node.js', + OU: 'Test TLS Certificate', + CN: 'localhost' }, + issuer: + { C: 'UK', + ST: 'Acknack Ltd', + L: 'Rhys Jones', + O: 'node.js', + OU: 'Test TLS Certificate', + CN: 'localhost' }, + issuerCertificate: + { ... another certificate, possibly with a .issuerCertificate ... }, + raw: < RAW DER buffer >, + valid_from: 'Nov 11 09:52:22 2009 GMT', + valid_to: 'Nov 6 09:52:22 2029 GMT', + fingerprint: '2A:7A:C2:DD:E5:F9:CC:53:72:35:99:7A:02:5A:71:38:52:EC:8A:DF', + serialNumber: 'B9B0D332A1AA5635' } +``` + +If the peer does not provide a certificate, an empty object will be returned. + +### tlsSocket.getProtocol()[#](#tls_tlssocket_getprotocol) + +Added in: v5.7.0 + +Returns a string containing the negotiated SSL/TLS protocol version of the +current connection. The value `'unknown'` will be returned for connected +sockets that have not completed the handshaking process. The value `null` will +be returned for server sockets or disconnected client sockets. + +Example responses include: + +* `SSLv3` +* `TLSv1` +* `TLSv1.1` +* `TLSv1.2` +* `unknown` + +See for more +information. + +### tlsSocket.getSession()[#](#tls_tlssocket_getsession) + +Added in: v0.11.4 + +Returns the ASN.1 encoded TLS session or `undefined` if no session was +negotiated. Can be used to speed up handshake establishment when reconnecting +to the server. + +### tlsSocket.getTLSTicket()[#](#tls_tlssocket_gettlsticket) + +Added in: v0.11.4 + +Returns the TLS session ticket or `undefined` if no session was negotiated. + +*Note*: This only works with client TLS sockets. Useful only for debugging, for +session reuse provide `session` option to [`tls.connect()`](#tls_tls_connect_options_callback). + +### tlsSocket.localAddress[#](#tls_tlssocket_localaddress) + +Added in: v0.11.4 + +Returns the string representation of the local IP address. + +### tlsSocket.localPort[#](#tls_tlssocket_localport) + +Added in: v0.11.4 + +Returns the numeric representation of the local port. + +### tlsSocket.remoteAddress[#](#tls_tlssocket_remoteaddress) + +Added in: v0.11.4 + +Returns the string representation of the remote IP address. For example, +`'74.125.127.100'` or `'2001:4860:a005::68'`. + +### tlsSocket.remoteFamily[#](#tls_tlssocket_remotefamily) + +Added in: v0.11.4 + +Returns the string representation of the remote IP family. `'IPv4'` or `'IPv6'`. + +### tlsSocket.remotePort[#](#tls_tlssocket_remoteport) + +Added in: v0.11.4 + +Returns the numeric representation of the remote port. For example, `443`. + +### tlsSocket.renegotiate(options, callback)[#](#tls_tlssocket_renegotiate_options_callback) + +Added in: v0.11.8 + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + + `requestCert` +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A function that will be called when the renegotiation + request has been completed. + +The `tlsSocket.renegotiate()` method initiates a TLS renegotiation process. +Upon completion, the `callback` function will be passed a single argument +that is either an `Error` (if the request failed) or `null`. + +*Note*: This method can be used to request a peer's certificate after the +secure connection has been established. + +*Note*: When running as the server, the socket will be destroyed with an error +after `handshakeTimeout` timeout. + +### tlsSocket.setMaxSendFragment(size)[#](#tls_tlssocket_setmaxsendfragment_size) + +Added in: v0.11.11 + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The maximum TLS fragment size. Defaults to `16384`. The + maximum value is `16384`. + +The `tlsSocket.setMaxSendFragment()` method sets the maximum TLS fragment size. +Returns `true` if setting the limit succeeded; `false` otherwise. + +Smaller fragment sizes decrease the buffering latency on the client: larger +fragments are buffered by the TLS layer until the entire fragment is received +and its integrity is verified; large fragments can span multiple roundtrips +and their processing can be delayed due to packet loss or reordering. However, +smaller fragments add extra TLS framing bytes and CPU overhead, which may +decrease overall server throughput. + +## tls.connect(port[, host][, options][, callback])[#](#tls_tls_connect_port_host_options_callback) + +Added in: v0.11.3 + +* `port` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Default value for `options.port`. +* `host` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional default value for `options.host`. +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) See [`tls.connect()`](#tls_tls_connect_options_callback). +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) See [`tls.connect()`](#tls_tls_connect_options_callback). + +Same as [`tls.connect()`](#tls_tls_connect_options_callback) except that `port` and `host` can be provided +as arguments instead of options. + +*Note*: A port or host option, if specified, will take precedence over any port +or host argument. + +## tls.connect(path[, options][, callback])[#](#tls_tls_connect_path_options_callback) + +Added in: v0.11.3 + +* `path` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Default value for `options.path`. +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) See [`tls.connect()`](#tls_tls_connect_options_callback). +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) See [`tls.connect()`](#tls_tls_connect_options_callback). + +Same as [`tls.connect()`](#tls_tls_connect_options_callback) except that `path` can be provided +as an argument instead of an option. + +*Note*: A path option, if specified, will take precedence over the path +argument. + +## tls.connect(options[, callback])[#](#tls_tls_connect_options_callback) + +Added in: v0.11.3 + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `host` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Host the client should connect to, defaults to 'localhost'. + + `port` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Port the client should connect to. + + `path` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Creates unix socket connection to path. If this option is + specified, `host` and `port` are ignored. + + `socket` [](stream.html#stream_class_stream_duplex) Establish secure connection on a given socket + rather than creating a new socket. Typically, this is an instance of + [`net.Socket`](net.html#net_class_net_socket), but any `Duplex` stream is allowed. + If this option is specified, `path`, `host` and `port` are ignored, + except for certificate validation. Usually, a socket is already connected + when passed to `tls.connect()`, but it can be connected later. Note that + connection/disconnection/destruction of `socket` is the user's + responsibility, calling `tls.connect()` will not cause `net.connect()` to be + called. + + `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true`, the server certificate is verified + against the list of supplied CAs. An `'error'` event is emitted if + verification fails; `err.code` contains the OpenSSL error code. Defaults to + `true`. + + `NPNProtocols` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) An array of strings or `Buffer`s + containing supported NPN protocols. `Buffer`s should have the format + `[len][name][len][name]...` e.g. `0x05hello0x05world`, where the first + byte is the length of the next protocol name. Passing an array is usually + much simpler, e.g. `['hello', 'world']`. + + `ALPNProtocols`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) An array of strings or `Buffer`s + containing the supported ALPN protocols. `Buffer`s should have the format + `[len][name][len][name]...` e.g. `0x05hello0x05world`, where the first byte + is the length of the next protocol name. Passing an array is usually much + simpler: `['hello', 'world']`.) + + `servername`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Server name for the SNI (Server Name Indication) TLS + extension. + + `checkServerIdentity(servername, cert)` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function + to be used (instead of the builtin `tls.checkServerIdentity()` function) + when checking the server's hostname against the certificate. + This should return an [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) if verification fails. The method should return + `undefined` if the `servername` and `cert` are verified. + + `session` [](buffer.html#buffer_class_buffer) A `Buffer` instance, containing TLS session. + + `minDHSize` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Minimum size of the DH parameter in bits to accept a + TLS connection. When a server offers a DH parameter with a size less + than `minDHSize`, the TLS connection is destroyed and an error is thrown. + Defaults to `1024`. + + `secureContext`: Optional TLS context object created with + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). If a `secureContext` is *not* provided, one + will be created by passing the entire `options` object to + `tls.createSecureContext()`. *Note*: In effect, all + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) options can be provided, but they will be + *completely ignored* unless the `secureContext` option is missing. + + `lookup`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Custom lookup function. Defaults to [`dns.lookup()`](dns.html#dns_dns_lookup_hostname_options_callback). + + ...: Optional [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) options can be provided, see + the `secureContext` option for more information. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + +The `callback` function, if specified, will be added as a listener for the +[`'secureConnect'`](#tls_event_secureconnect) event. + +`tls.connect()` returns a [`tls.TLSSocket`](#tls_class_tls_tlssocket) object. + +The following implements a simple "echo server" example: + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + // Necessary only if using the client certificate authentication + key: fs.readFileSync('client-key.pem'), + cert: fs.readFileSync('client-cert.pem'), + + // Necessary only if the server uses the self-signed certificate + ca: [ fs.readFileSync('server-cert.pem') ] +}; + +const socket = tls.connect(8000, options, () => { + console.log('client connected', + socket.authorized ? 'authorized' : 'unauthorized'); + process.stdin.pipe(socket); + process.stdin.resume(); +}); +socket.setEncoding('utf8'); +socket.on('data', (data) => { + console.log(data); +}); +socket.on('end', () => { + server.close(); +}); +``` + +Or + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + pfx: fs.readFileSync('client.pfx') +}; + +const socket = tls.connect(8000, options, () => { + console.log('client connected', + socket.authorized ? 'authorized' : 'unauthorized'); + process.stdin.pipe(socket); + process.stdin.resume(); +}); +socket.setEncoding('utf8'); +socket.on('data', (data) => { + console.log(data); +}); +socket.on('end', () => { + server.close(); +}); +``` + +## tls.createSecureContext(options)[#](#tls_tls_createsecurecontext_options) + +Added in: v0.11.13 + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `pfx` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) Optional PFX or PKCS12 encoded private key and + certificate chain. `pfx` is an alternative to providing `key` and `cert` + individually. PFX is usually encrypted, if it is, `passphrase` will be used + to decrypt it. + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Optional private keys in + PEM format. PEM allows the option of private keys being encrypted. Encrypted + keys will be decrypted with `options.passphrase`. Multiple keys using + different algorithms can be provided either as an array of unencrypted key + strings or buffers, or an array of objects in the form `{pem: + [, passphrase: ]}`. The object form can only occur in + an array. `object.passphrase` is optional. Encrypted keys will be decrypted + with `object.passphrase` if provided, or `options.passphrase` if it is not. + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional shared passphrase used for a single private + key and/or a PFX. + + `cert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) Optional cert chains in PEM format. + One cert chain should be provided per private key. Each cert chain should + consist of the PEM formatted certificate for a provided private `key`, + followed by the PEM formatted intermediate certificates (if any), in order, + and not including the root CA (the root CA must be pre-known to the peer, + see `ca`). When providing multiple cert chains, they do not have to be in + the same order as their private keys in `key`. If the intermediate + certificates are not provided, the peer will not be able to validate the + certificate, and the handshake will fail. + + `ca` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) Optionally override the trusted CA + certificates. Default is to trust the well-known CAs curated by Mozilla. + Mozilla's CAs are completely replaced when CAs are explicitly specified + using this option. The value can be a string or Buffer, or an Array of + strings and/or Buffers. Any string or Buffer can contain multiple PEM CAs + concatenated together. The peer's certificate must be chainable to a CA + trusted by the server for the connection to be authenticated. When using + certificates that are not chainable to a well-known CA, the certificate's CA + must be explicitly specified as a trusted or the connection will fail to + authenticate. + If the peer uses a certificate that doesn't match or chain to one of the + default CAs, use the `ca` option to provide a CA certificate that the peer's + certificate can match or chain to. + For self-signed certificates, the certificate is its own CA, and must be + provided. + + `crl` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) Optional PEM formatted + CRLs (Certificate Revocation Lists). + + `ciphers` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional cipher suite specification, replacing the + default. For more information, see [modifying the default cipher suite](#tls_modifying_the_default_tls_cipher_suite). + + `honorCipherOrder` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Attempt to use the server's cipher suite + preferences instead of the client's. When `true`, causes + `SSL_OP_CIPHER_SERVER_PREFERENCE` to be set in `secureOptions`, see + [OpenSSL Options](crypto.html#crypto_openssl_options) for more information. + *Note*: [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) sets the default value to `true`, other + APIs that create secure contexts leave it unset. + + `ecdhCurve` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A string describing a named curve to use for ECDH key + agreement or `false` to disable ECDH. Defaults to + [`tls.DEFAULT_ECDH_CURVE`](#tls_tls_default_ecdh_curve). Use [`crypto.getCurves()`](crypto.html#crypto_crypto_getcurves) to obtain a list + of available curve names. On recent releases, `openssl ecparam -list_curves` + will also display the name and description of each available elliptic curve. + + `dhparam` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) Diffie Hellman parameters, required for + [Perfect Forward Secrecy](#tls_perfect_forward_secrecy). Use `openssl dhparam` to create the parameters. + The key length must be greater than or equal to 1024 bits, otherwise an + error will be thrown. It is strongly recommended to use 2048 bits or larger + for stronger security. If omitted or invalid, the parameters are silently + discarded and DHE ciphers will not be available. + + `secureProtocol` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional SSL method to use, default is + `'SSLv23_method'`. The possible values are listed as [SSL\_METHODS](https://www.openssl.org/docs/man1.0.2/ssl/ssl.html#DEALING-WITH-PROTOCOL-METHODS), use + the function names as strings. For example, `'SSLv3_method'` to force SSL + version 3. + + `secureOptions` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Optionally affect the OpenSSL protocol behavior, + which is not usually necessary. This should be used carefully if at all! + Value is a numeric bitmask of the `SSL_OP_*` options from + [OpenSSL Options](crypto.html#crypto_openssl_options). + + `sessionIdContext` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional opaque identifier used by servers to + ensure session state is not shared between applications. Unused by clients. + *Note*: [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) uses a 128 bit truncated SHA1 hash value + generated from `process.argv`, other APIs that create secure contexts + have no default value. + +The `tls.createSecureContext()` method creates a credentials object. + +A key is *required* for ciphers that make use of certificates. Either `key` or +`pfx` can be used to provide it. + +If the 'ca' option is not given, then Node.js will use the default +publicly trusted list of CAs as given in +. + +## tls.createServer([options][, secureConnectionListener])[#](#tls_tls_createserver_options_secureconnectionlistener) + +Added in: v0.3.2 + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `handshakeTimeout` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Abort the connection if the SSL/TLS handshake + does not finish in the specified number of milliseconds. Defaults to `120` + seconds. A `'tlsClientError'` is emitted on the `tls.Server` object whenever + a handshake times out. + + `requestCert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true` the server will request a certificate from + clients that connect and attempt to verify that certificate. Defaults to + `false`. + + `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true` the server will reject any + connection which is not authorized with the list of supplied CAs. This + option only has an effect if `requestCert` is `true`. Defaults to `false`. + + `NPNProtocols` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) An array of strings or a `Buffer` naming + possible NPN protocols. (Protocols should be ordered by their priority.) + + `ALPNProtocols` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) An array of strings or a `Buffer` naming + possible ALPN protocols. (Protocols should be ordered by their priority.) + When the server receives both NPN and ALPN extensions from the client, + ALPN takes precedence over NPN and the server does not send an NPN + extension to the client. + + `SNICallback(servername, cb)` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A function that will be called if + the client supports SNI TLS extension. Two arguments will be passed when + called: `servername` and `cb`. `SNICallback` should invoke `cb(null, ctx)`, + where `ctx` is a SecureContext instance. (`tls.createSecureContext(...)` can + be used to get a proper SecureContext.) If `SNICallback` wasn't provided the + default callback with high-level API will be used (see below). + + `sessionTimeout` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) An integer specifying the number of seconds after + which the TLS session identifiers and TLS session tickets created by the + server will time out. See [SSL\_CTX\_set\_timeout](https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_timeout.html) for more details. + + `ticketKeys`: A 48-byte `Buffer` instance consisting of a 16-byte prefix, + a 16-byte HMAC key, and a 16-byte AES key. This can be used to accept TLS + session tickets on multiple instances of the TLS server. *Note* that this is + automatically shared between `cluster` module workers. + + ...: Any [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) options can be provided. For + servers, the identity options (`pfx` or `key`/`cert`) are usually required. +* `secureConnectionListener` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + +Creates a new [tls.Server](#tls_class_tls_server). The `secureConnectionListener`, if provided, is +automatically set as a listener for the [`'secureConnection'`](#tls_event_secureconnection) event. + +The following illustrates a simple echo server: + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + key: fs.readFileSync('server-key.pem'), + cert: fs.readFileSync('server-cert.pem'), + + // This is necessary only if using the client certificate authentication. + requestCert: true, + + // This is necessary only if the client uses the self-signed certificate. + ca: [ fs.readFileSync('client-cert.pem') ] +}; + +const server = tls.createServer(options, (socket) => { + console.log('server connected', + socket.authorized ? 'authorized' : 'unauthorized'); + socket.write('welcome!\n'); + socket.setEncoding('utf8'); + socket.pipe(socket); +}); +server.listen(8000, () => { + console.log('server bound'); +}); +``` + +Or + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + pfx: fs.readFileSync('server.pfx'), + + // This is necessary only if using the client certificate authentication. + requestCert: true, + +}; + +const server = tls.createServer(options, (socket) => { + console.log('server connected', + socket.authorized ? 'authorized' : 'unauthorized'); + socket.write('welcome!\n'); + socket.setEncoding('utf8'); + socket.pipe(socket); +}); +server.listen(8000, () => { + console.log('server bound'); +}); +``` + +This server can be tested by connecting to it using `openssl s_client`: + +```None +openssl s_client -connect 127.0.0.1:8000 +``` + +## tls.getCiphers()[#](#tls_tls_getciphers) + +Added in: v0.10.2 + +Returns an array with the names of the supported SSL ciphers. + +For example: + +```None +console.log(tls.getCiphers()); // ['AES128-SHA', 'AES256-SHA', ...] +``` + +## tls.DEFAULT\_ECDH\_CURVE[#](#tls_tls_default_ecdh_curve) + +Added in: v0.11.13 + +The default curve name to use for ECDH key agreement in a tls server. The +default value is `'prime256v1'` (NIST P-256). Consult [RFC 4492](https://www.rfc-editor.org/rfc/rfc4492.txt) and +[FIPS.186-4](http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf) for more details. + +## Deprecated APIs[#](#tls_deprecated_apis) + +### Class: CryptoStream[#](#tls_class_cryptostream) + +Added in: v0.3.4 +Deprecated since: v0.11.3 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`tls.TLSSocket`](#tls_class_tls_tlssocket) instead. + +The `tls.CryptoStream` class represents a stream of encrypted data. This class +has been deprecated and should no longer be used. + +#### cryptoStream.bytesWritten[#](#tls_cryptostream_byteswritten) + +Added in: v0.3.4 +Deprecated since: v0.11.3 + +The `cryptoStream.bytesWritten` property returns the total number of bytes +written to the underlying socket *including* the bytes required for the +implementation of the TLS protocol. + +### Class: SecurePair[#](#tls_class_securepair) + +Added in: v0.3.2 +Deprecated since: v0.11.3 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`tls.TLSSocket`](#tls_class_tls_tlssocket) instead. + +Returned by [`tls.createSecurePair()`](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options). + +#### Event: 'secure'[#](#tls_event_secure) + +Added in: v0.3.2 +Deprecated since: v0.11.3 + +The `'secure'` event is emitted by the `SecurePair` object once a secure +connection has been established. + +As with checking for the server [`secureConnection`](#tls_event_secureconnection) +event, `pair.cleartext.authorized` should be inspected to confirm whether the +certificate used is properly authorized. + +### tls.createSecurePair([context][, isServer][, requestCert][, rejectUnauthorized][, options])[#](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options) + +Added in: v0.3.2 +Deprecated since: v0.11.3 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`tls.TLSSocket`](#tls_class_tls_tlssocket) instead. + +* `context` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) A secure context object as returned by + `tls.createSecureContext()` +* `isServer` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` to specify that this TLS connection should be + opened as a server. +* `requestCert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` to specify whether a server should request a + certificate from a connecting client. Only applies when `isServer` is `true`. +* `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` to specify whether a server should + automatically reject clients with invalid certificates. Only applies when + `isServer` is `true`. +* `options` + + `secureContext`: An optional TLS context object from + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) + + `isServer`: If `true` the TLS socket will be instantiated in server-mode. + Defaults to `false`. + + `server` [](net.html#net_class_net_server) An optional [`net.Server`](net.html#net_class_net_server) instance + + `requestCert`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `rejectUnauthorized`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `NPNProtocols`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `ALPNProtocols`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `SNICallback`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `session` [](buffer.html#buffer_class_buffer) An optional `Buffer` instance containing a TLS session. + + `requestOCSP` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true`, specifies that the OCSP status request + extension will be added to the client hello and an `'OCSPResponse'` event + will be emitted on the socket before establishing a secure communication + +Creates a new secure pair object with two streams, one of which reads and writes +the encrypted data and the other of which reads and writes the cleartext data. +Generally, the encrypted stream is piped to/from an incoming encrypted data +stream and the cleartext one is used as a replacement for the initial encrypted +stream. + +`tls.createSecurePair()` returns a `tls.SecurePair` object with `cleartext` and +`encrypted` stream properties. + +*Note*: `cleartext` has the same API as [`tls.TLSSocket`](#tls_class_tls_tlssocket). + +*Note*: The `tls.createSecurePair()` method is now deprecated in favor of +`tls.TLSSocket()`. For example, the code: + +```None +pair = tls.createSecurePair(/* ... */); +pair.encrypted.pipe(socket); +socket.pipe(pair.encrypted); +``` + +can be replaced by: + +```None +secure_socket = tls.TLSSocket(socket, options); +``` + +where `secure_socket` has the same API as `pair.cleartext`. diff --git a/corpus/docs/nodejs/tls/tls_7x.md b/corpus/docs/nodejs/tls/tls_7x.md new file mode 100644 index 0000000000000000000000000000000000000000..a703e14f44a5e396d2af0bb494f65e28ee3e887c --- /dev/null +++ b/corpus/docs/nodejs/tls/tls_7x.md @@ -0,0 +1,1187 @@ +# TLS (SSL)# + +Source: https://nodejs.org/docs/latest-v7.x/api/tls.html +Version: 7.x + +```None +Stability: 2 - Stable +``` + +The `tls` module provides an implementation of the Transport Layer Security +(TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL. +The module can be accessed using: + +```None +const tls = require('tls'); +``` + +## TLS/SSL Concepts[#](#tls_tls_ssl_concepts) + +The TLS/SSL is a public/private key infrastructure (PKI). For most common +cases, each client and server must have a *private key*. + +Private keys can be generated in multiple ways. The example below illustrates +use of the OpenSSL command-line interface to generate a 2048-bit RSA private +key: + +```None +openssl genrsa -out ryans-key.pem 2048 +``` + +With TLS/SSL, all servers (and some clients) must have a *certificate*. +Certificates are *public keys* that correspond to a private key, and that are +digitally signed either by a Certificate Authority or by the owner of the +private key (such certificates are referred to as "self-signed"). The first +step to obtaining a certificate is to create a *Certificate Signing Request* +(CSR) file. + +The OpenSSL command-line interface can be used to generate a CSR for a private +key: + +```None +openssl req -new -sha256 -key ryans-key.pem -out ryans-csr.pem +``` + +Once the CSR file is generated, it can either be sent to a Certificate +Authority for signing or used to generate a self-signed certificate. + +Creating a self-signed certificate using the OpenSSL command-line interface +is illustrated in the example below: + +```None +openssl x509 -req -in ryans-csr.pem -signkey ryans-key.pem -out ryans-cert.pem +``` + +Once the certificate is generated, it can be used to generate a `.pfx` or +`.p12` file: + +```None +openssl pkcs12 -export -in ryans-cert.pem -inkey ryans-key.pem \ + -certfile ca-cert.pem -out ryans.pfx +``` + +Where: + +* `in`: is the signed certificate +* `inkey`: is the associated private key +* `certfile`: is a concatenation of all Certificate Authority (CA) certs into + a single file, e.g. `cat ca1-cert.pem ca2-cert.pem > ca-cert.pem` + +### Perfect Forward Secrecy[#](#tls_perfect_forward_secrecy) + +The term "[Forward Secrecy](https://en.wikipedia.org/wiki/Perfect_forward_secrecy)" or "Perfect Forward Secrecy" describes a feature of +key-agreement (i.e., key-exchange) methods. That is, the server and client keys +are used to negotiate new temporary keys that are used specifically and only for +the current communication session. Practically, this means that even if the +server's private key is compromised, communication can only be decrypted by +eavesdroppers if the attacker manages to obtain the key-pair specifically +generated for the session. + +Perfect Forward Secrecy is achieved by randomly generating a key pair for +key-agreement on every TLS/SSL handshake (in contrast to using the same key for +all sessions). Methods implementing this technique are called "ephemeral". + +Currently two methods are commonly used to achieve Perfect Forward Secrecy (note +the character "E" appended to the traditional abbreviations): + +* [DHE](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange) - An ephemeral version of the Diffie Hellman key-agreement protocol. +* [ECDHE](https://en.wikipedia.org/wiki/Elliptic_curve_Diffie%E2%80%93Hellman) - An ephemeral version of the Elliptic Curve Diffie Hellman + key-agreement protocol. + +Ephemeral methods may have some performance drawbacks, because key generation +is expensive. + +To use Perfect Forward Secrecy using `DHE` with the `tls` module, it is required +to generate Diffie-Hellman parameters and specify them with the `dhparam` +option to [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). The following illustrates the use of +the OpenSSL command-line interface to generate such parameters: + +```None +openssl dhparam -outform PEM -out dhparam.pem 2048 +``` + +If using Perfect Forward Secrecy using `ECDHE`, Diffie-Hellman parameters are +not required and a default ECDHE curve will be used. The `ecdhCurve` property +can be used when creating a TLS Server to specify the name of an alternative +curve to use, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) for more info. + +### ALPN, NPN and SNI[#](#tls_alpn_npn_and_sni) + +ALPN (Application-Layer Protocol Negotiation Extension), NPN (Next +Protocol Negotiation) and, SNI (Server Name Indication) are TLS +handshake extensions: + +* ALPN/NPN - Allows the use of one TLS server for multiple protocols (HTTP, + SPDY, HTTP/2) +* SNI - Allows the use of one TLS server for multiple hostnames with different + SSL certificates. + +*Note*: Use of ALPN is recommended over NPN. The NPN extension has never been +formally defined or documented and generally not recommended for use. + +### Client-initiated renegotiation attack mitigation[#](#tls_client_initiated_renegotiation_attack_mitigation) + +The TLS protocol allows clients to renegotiate certain aspects of the TLS +session. Unfortunately, session renegotiation requires a disproportionate amount +of server-side resources, making it a potential vector for denial-of-service +attacks. + +To mitigate the risk, renegotiation is limited to three times every ten minutes. +An `'error'` event is emitted on the [`tls.TLSSocket`](#tls_class_tls_tlssocket) instance when this +threshold is exceeded. The limits are configurable: + +* `tls.CLIENT_RENEG_LIMIT` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Specifies the number of renegotiation + requests. Defaults to `3`. +* `tls.CLIENT_RENEG_WINDOW` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Specifies the time renegotiation window + in seconds. Defaults to `600` (10 minutes). + +*Note*: The default renegotiation limits should not be modified without a full +understanding of the implications and risks. + +To test the renegotiation limits on a server, connect to it using the OpenSSL +command-line client (`openssl s_client -connect address:port`) then input +`R` (i.e., the letter `R` followed by a carriage return) multiple times. + +## Modifying the Default TLS Cipher suite[#](#tls_modifying_the_default_tls_cipher_suite) + +Node.js is built with a default suite of enabled and disabled TLS ciphers. +Currently, the default cipher suite is: + +```None +ECDHE-RSA-AES128-GCM-SHA256: +ECDHE-ECDSA-AES128-GCM-SHA256: +ECDHE-RSA-AES256-GCM-SHA384: +ECDHE-ECDSA-AES256-GCM-SHA384: +DHE-RSA-AES128-GCM-SHA256: +ECDHE-RSA-AES128-SHA256: +DHE-RSA-AES128-SHA256: +ECDHE-RSA-AES256-SHA384: +DHE-RSA-AES256-SHA384: +ECDHE-RSA-AES256-SHA256: +DHE-RSA-AES256-SHA256: +HIGH: +!aNULL: +!eNULL: +!EXPORT: +!DES: +!RC4: +!MD5: +!PSK: +!SRP: +!CAMELLIA +``` + +This default can be replaced entirely using the `--tls-cipher-list` command +line switch. For instance, the following makes +`ECDHE-RSA-AES128-GCM-SHA256:!RC4` the default TLS cipher suite: + +```None +node --tls-cipher-list="ECDHE-RSA-AES128-GCM-SHA256:!RC4" +``` + +The default can also be replaced on a per client or server basis using the +`ciphers` option from [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options), which is also available +in [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener), [`tls.connect()`](#tls_tls_connect_options_callback), and when creating new +[`tls.TLSSocket`](#tls_class_tls_tlssocket)s. + +Consult [OpenSSL cipher list format documentation](https://www.openssl.org/docs/man1.0.2/apps/ciphers.html#CIPHER-LIST-FORMAT) for details on the format. + +*Note*: The default cipher suite included within Node.js has been carefully +selected to reflect current security best practices and risk mitigation. +Changing the default cipher suite can have a significant impact on the security +of an application. The `--tls-cipher-list` switch and `ciphers` option should by +used only if absolutely necessary. + +The default cipher suite prefers GCM ciphers for [Chrome's 'modern +cryptography' setting](https://www.chromium.org/Home/chromium-security/education/tls#TOC-Cipher-Suites) and also prefers ECDHE and DHE ciphers for Perfect +Forward Secrecy, while offering *some* backward compatibility. + +128 bit AES is preferred over 192 and 256 bit AES in light of [specific +attacks affecting larger AES key sizes](https://www.schneier.com/blog/archives/2009/07/another_new_aes.html). + +Old clients that rely on insecure and deprecated RC4 or DES-based ciphers +(like Internet Explorer 6) cannot complete the handshaking process with +the default configuration. If these clients *must* be supported, the +[TLS recommendations](https://wiki.mozilla.org/Security/Server_Side_TLS) may offer a compatible cipher suite. For more details +on the format, see the [OpenSSL cipher list format documentation](https://www.openssl.org/docs/man1.0.2/apps/ciphers.html#CIPHER-LIST-FORMAT). + +## Class: tls.Server[#](#tls_class_tls_server) + +Added in: v0.3.2 + +The `tls.Server` class is a subclass of `net.Server` that accepts encrypted +connections using TLS or SSL. + +### Event: 'newSession'[#](#tls_event_newsession) + +Added in: v0.9.2 + +The `'newSession'` event is emitted upon creation of a new TLS session. This may +be used to store sessions in external storage. The listener callback is passed +three arguments when called: + +* `sessionId` - The TLS session identifier +* `sessionData` - The TLS session data +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function taking no arguments that must be + invoked in order for data to be sent or received over the secure connection. + +*Note*: Listening for this event will have an effect only on connections +established after the addition of the event listener. + +### Event: 'OCSPRequest'[#](#tls_event_ocsprequest) + +Added in: v0.11.13 + +The `'OCSPRequest'` event is emitted when the client sends a certificate status +request. The listener callback is passed three arguments when called: + +* `certificate` [](buffer.html#buffer_class_buffer) The server certificate +* `issuer` [](buffer.html#buffer_class_buffer) The issuer's certificate +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function that must be invoked to provide + the results of the OCSP request. + +The server's current certificate can be parsed to obtain the OCSP URL +and certificate ID; after obtaining an OCSP response, `callback(null, resp)` is +then invoked, where `resp` is a `Buffer` instance containing the OCSP response. +Both `certificate` and `issuer` are `Buffer` DER-representations of the +primary and issuer's certificates. These can be used to obtain the OCSP +certificate ID and OCSP endpoint URL. + +Alternatively, `callback(null, null)` may be called, indicating that there was +no OCSP response. + +Calling `callback(err)` will result in a `socket.destroy(err)` call. + +The typical flow of an OCSP Request is as follows: + +1. Client connects to the server and sends an `'OCSPRequest'` (via the status + info extension in ClientHello). +2. Server receives the request and emits the `'OCSPRequest'` event, calling the + listener if registered. +3. Server extracts the OCSP URL from either the `certificate` or `issuer` and + performs an [OCSP request](https://en.wikipedia.org/wiki/OCSP_stapling) to the CA. +4. Server receives `OCSPResponse` from the CA and sends it back to the client + via the `callback` argument +5. Client validates the response and either destroys the socket or performs a + handshake. + +*Note*: The `issuer` can be `null` if the certificate is either self-signed or +the issuer is not in the root certificates list. (An issuer may be provided +via the `ca` option when establishing the TLS connection.) + +*Note*: Listening for this event will have an effect only on connections +established after the addition of the event listener. + +*Note*: An npm module like [asn1.js](https://npmjs.org/package/asn1.js) may be used to parse the certificates. + +### Event: 'resumeSession'[#](#tls_event_resumesession) + +Added in: v0.9.2 + +The `'resumeSession'` event is emitted when the client requests to resume a +previous TLS session. The listener callback is passed two arguments when +called: + +* `sessionId` - The TLS/SSL session identifier +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function to be called when the prior session + has been recovered. + +When called, the event listener may perform a lookup in external storage using +the given `sessionId` and invoke `callback(null, sessionData)` once finished. If +the session cannot be resumed (i.e., doesn't exist in storage) the callback may +be invoked as `callback(null, null)`. Calling `callback(err)` will terminate the +incoming connection and destroy the socket. + +*Note*: Listening for this event will have an effect only on connections +established after the addition of the event listener. + +The following illustrates resuming a TLS session: + +```None +const tlsSessionStore = {}; +server.on('newSession', (id, data, cb) => { + tlsSessionStore[id.toString('hex')] = data; + cb(); +}); +server.on('resumeSession', (id, cb) => { + cb(null, tlsSessionStore[id.toString('hex')] || null); +}); +``` + +### Event: 'secureConnection'[#](#tls_event_secureconnection) + +Added in: v0.3.2 + +The `'secureConnection'` event is emitted after the handshaking process for a +new connection has successfully completed. The listener callback is passed a +single argument when called: + +* `tlsSocket` [](tls.html#tls_class_tls_tlssocket) The established TLS socket. + +The `tlsSocket.authorized` property is a `boolean` indicating whether the +client has been verified by one of the supplied Certificate Authorities for the +server. If `tlsSocket.authorized` is `false`, then `socket.authorizationError` +is set to describe how authorization failed. Note that depending on the settings +of the TLS server, unauthorized connections may still be accepted. + +The `tlsSocket.npnProtocol` and `tlsSocket.alpnProtocol` properties are strings +that contain the selected NPN and ALPN protocols, respectively. When both NPN +and ALPN extensions are received, ALPN takes precedence over NPN and the next +protocol is selected by ALPN. + +When ALPN has no selected protocol, `tlsSocket.alpnProtocol` returns `false`. + +The `tlsSocket.servername` property is a string containing the server name +requested via SNI. + +### Event: 'tlsClientError'[#](#tls_event_tlsclienterror) + +Added in: v6.0.0 + +The `'tlsClientError'` event is emitted when an error occurs before a secure +connection is established. The listener callback is passed two arguments when +called: + +* `exception` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) The `Error` object describing the error +* `tlsSocket` [](tls.html#tls_class_tls_tlssocket) The `tls.TLSSocket` instance from which the + error originated. + +### server.addContext(hostname, context)[#](#tls_server_addcontext_hostname_context) + +Added in: v0.5.3 + +* `hostname` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A SNI hostname or wildcard (e.g. `'*'`) +* `context` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) An object containing any of the possible properties + from the [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) `options` arguments (e.g. `key`, + `cert`, `ca`, etc). + +The `server.addContext()` method adds a secure context that will be used if +the client request's SNI hostname matches the supplied `hostname` (or wildcard). + +### server.address()[#](#tls_server_address) + +Added in: v0.6.0 + +Returns the bound address, the address family name, and port of the +server as reported by the operating system. See [`net.Server.address()`](net.html#net_server_address) for +more information. + +### server.close([callback])[#](#tls_server_close_callback) + +Added in: v0.3.2 + +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) An optional listener callback that will be registered to + listen for the server instance's `'close'` event. + +The `server.close()` method stops the server from accepting new connections. + +This function operates asynchronously. The `'close'` event will be emitted +when the server has no more open connections. + +### server.connections[#](#tls_server_connections) + +Added in: v0.3.2 + +Returns the current number of concurrent connections on the server. + +### server.getTicketKeys()[#](#tls_server_getticketkeys) + +Added in: v3.0.0 + +Returns a `Buffer` instance holding the keys currently used for +encryption/decryption of the [TLS Session Tickets](https://www.ietf.org/rfc/rfc5077.txt) + +### server.listen(port[, hostname][, callback])[#](#tls_server_listen_port_hostname_callback) + +Added in: v0.3.2 + +* `port` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The TCP/IP port on which to begin listening for connections. + A value of `0` (zero) will assign a random port. +* `hostname` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The hostname, IPv4, or IPv6 address on which to begin + listening for connections. If `undefined`, the server will accept connections + on any IPv6 address (`::`) when IPv6 is available, or any IPv4 address + (`0.0.0.0`) otherwise. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function to be invoked when the server has + begun listening on the `port` and `hostname`. + +The `server.listen()` methods instructs the server to begin accepting +connections on the specified `port` and `hostname`. + +This function operates asynchronously. If the `callback` is given, it will be +called when the server has started listening. + +See [`net.Server`](net.html#net_class_net_server) for more information. + +### server.setTicketKeys(keys)[#](#tls_server_setticketkeys_keys) + +Added in: v3.0.0 + +* `keys` [](buffer.html#buffer_class_buffer) The keys used for encryption/decryption of the + [TLS Session Tickets](https://www.ietf.org/rfc/rfc5077.txt). + +Updates the keys for encryption/decryption of the [TLS Session Tickets](https://www.ietf.org/rfc/rfc5077.txt). + +*Note*: The key's `Buffer` should be 48 bytes long. See `ticketKeys` option in +[tls.createServer](#tls_tls_createserver_options_secureconnectionlistener) for +more information on how it is used. + +*Note*: Changes to the ticket keys are effective only for future server +connections. Existing or currently pending server connections will use the +previous keys. + +## Class: tls.TLSSocket[#](#tls_class_tls_tlssocket) + +Added in: v0.11.4 + +The `tls.TLSSocket` is a subclass of [`net.Socket`](net.html#net_class_net_socket) that performs transparent +encryption of written data and all required TLS negotiation. + +Instances of `tls.TLSSocket` implement the duplex [Stream](stream.html#stream_stream) interface. + +*Note*: Methods that return TLS connection metadata (e.g. +[`tls.TLSSocket.getPeerCertificate()`](#tls_tlssocket_getpeercertificate_detailed) will only return data while the +connection is open. + +### new tls.TLSSocket(socket[, options])[#](#tls_new_tls_tlssocket_socket_options) + +History + +| Version | Changes | +| --- | --- | +| v5.0.0 | ALPN options are supported now. | +| v0.11.4 | Added in: v0.11.4 | + +* `socket` [](net.html#net_class_net_socket) An instance of [`net.Socket`](net.html#net_class_net_socket) +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `isServer`: The SSL/TLS protocol is asymetrical, TLSSockets must know if + they are to behave as a server or a client. If `true` the TLS socket will be + instantiated as a server. Defaults to `false`. + + `server` An optional [`net.Server`](net.html#net_class_net_server) instance. + + `requestCert`: Whether to authenticate the remote peer by requesting a + certificate. Clients always request a server certificate. Servers + (`isServer` is true) may optionally set `requestCert` to true to request a + client certificate. + + `rejectUnauthorized`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `NPNProtocols`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `ALPNProtocols`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `SNICallback`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `session` [](buffer.html#buffer_class_buffer) An optional `Buffer` instance containing a TLS session. + + `requestOCSP` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true`, specifies that the OCSP status request + extension will be added to the client hello and an `'OCSPResponse'` event + will be emitted on the socket before establishing a secure communication + + `secureContext`: Optional TLS context object created with + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). If a `secureContext` is *not* provided, one + will be created by passing the entire `options` object to + `tls.createSecureContext()`. *Note*: In effect, all + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) options can be provided, but they will be + *completely ignored* unless the `secureContext` option is missing. + + ...: Optional [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) options can be provided, see + the `secureContext` option for more information. + +Construct a new `tls.TLSSocket` object from an existing TCP socket. + +### Event: 'OCSPResponse'[#](#tls_event_ocspresponse) + +Added in: v0.11.13 + +The `'OCSPResponse'` event is emitted if the `requestOCSP` option was set +when the `tls.TLSSocket` was created and an OCSP response has been received. +The listener callback is passed a single argument when called: + +* `response` [](buffer.html#buffer_class_buffer) The server's OCSP response + +Typically, the `response` is a digitally signed object from the server's CA that +contains information about server's certificate revocation status. + +### Event: 'secureConnect'[#](#tls_event_secureconnect) + +Added in: v0.11.4 + +The `'secureConnect'` event is emitted after the handshaking process for a new +connection has successfully completed. The listener callback will be called +regardless of whether or not the server's certificate has been authorized. It +is the client's responsibility to check the `tlsSocket.authorized` property to +determine if the server certificate was signed by one of the specified CAs. If +`tlsSocket.authorized === false`, then the error can be found by examining the +`tlsSocket.authorizationError` property. If either ALPN or NPN was used, +the `tlsSocket.alpnProtocol` or `tlsSocket.npnProtocol` properties can be +checked to determine the negotiated protocol. + +### tlsSocket.address()[#](#tls_tlssocket_address) + +Added in: v0.11.4 + +Returns the bound address, the address family name, and port of the +underlying socket as reported by the operating system. Returns an +object with three properties, e.g., +`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` + +### tlsSocket.authorizationError[#](#tls_tlssocket_authorizationerror) + +Added in: v0.11.4 + +Returns the reason why the peer's certificate was not been verified. This +property is set only when `tlsSocket.authorized === false`. + +### tlsSocket.authorized[#](#tls_tlssocket_authorized) + +Added in: v0.11.4 + +Returns `true` if the peer certificate was signed by one of the CAs specified +when creating the `tls.TLSSocket` instance, otherwise `false`. + +### tlsSocket.encrypted[#](#tls_tlssocket_encrypted) + +Added in: v0.11.4 + +Always returns `true`. This may be used to distinguish TLS sockets from regular +`net.Socket` instances. + +### tlsSocket.getCipher()[#](#tls_tlssocket_getcipher) + +Added in: v0.11.4 + +Returns an object representing the cipher name and the SSL/TLS protocol version +that first defined the cipher. + +For example: `{ name: 'AES256-SHA', version: 'TLSv1/SSLv3' }` + +See `SSL_CIPHER_get_name()` and `SSL_CIPHER_get_version()` in + for more +information. + +### tlsSocket.getEphemeralKeyInfo()[#](#tls_tlssocket_getephemeralkeyinfo) + +Added in: v5.0.0 + +Returns an object representing the type, name, and size of parameter of +an ephemeral key exchange in [Perfect Forward Secrecy](#tls_perfect_forward_secrecy) on a client +connection. It returns an empty object when the key exchange is not +ephemeral. As this is only supported on a client socket; `null` is returned +if called on a server socket. The supported types are `'DH'` and `'ECDH'`. The +`name` property is available only when type is 'ECDH'. + +For Example: `{ type: 'ECDH', name: 'prime256v1', size: 256 }` + +### tlsSocket.getPeerCertificate([ detailed ])[#](#tls_tlssocket_getpeercertificate_detailed) + +Added in: v0.11.4 + +* `detailed` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Include the full certificate chain if `true`, otherwise + include just the peer's certificate. + +Returns an object representing the peer's certificate. The returned object has +some properties corresponding to the fields of the certificate. + +If the full certificate chain was requested, each certificate will include a +`issuerCertificate` property containing an object representing its issuer's +certificate. + +For example: + +```None +{ subject: + { C: 'UK', + ST: 'Acknack Ltd', + L: 'Rhys Jones', + O: 'node.js', + OU: 'Test TLS Certificate', + CN: 'localhost' }, + issuer: + { C: 'UK', + ST: 'Acknack Ltd', + L: 'Rhys Jones', + O: 'node.js', + OU: 'Test TLS Certificate', + CN: 'localhost' }, + issuerCertificate: + { ... another certificate, possibly with a .issuerCertificate ... }, + raw: < RAW DER buffer >, + valid_from: 'Nov 11 09:52:22 2009 GMT', + valid_to: 'Nov 6 09:52:22 2029 GMT', + fingerprint: '2A:7A:C2:DD:E5:F9:CC:53:72:35:99:7A:02:5A:71:38:52:EC:8A:DF', + serialNumber: 'B9B0D332A1AA5635' } +``` + +If the peer does not provide a certificate, an empty object will be returned. + +### tlsSocket.getProtocol()[#](#tls_tlssocket_getprotocol) + +Added in: v5.7.0 + +Returns a string containing the negotiated SSL/TLS protocol version of the +current connection. The value `'unknown'` will be returned for connected +sockets that have not completed the handshaking process. The value `null` will +be returned for server sockets or disconnected client sockets. + +Example responses include: + +* `SSLv3` +* `TLSv1` +* `TLSv1.1` +* `TLSv1.2` +* `unknown` + +See for more +information. + +### tlsSocket.getSession()[#](#tls_tlssocket_getsession) + +Added in: v0.11.4 + +Returns the ASN.1 encoded TLS session or `undefined` if no session was +negotiated. Can be used to speed up handshake establishment when reconnecting +to the server. + +### tlsSocket.getTLSTicket()[#](#tls_tlssocket_gettlsticket) + +Added in: v0.11.4 + +Returns the TLS session ticket or `undefined` if no session was negotiated. + +*Note*: This only works with client TLS sockets. Useful only for debugging, for +session reuse provide `session` option to [`tls.connect()`](#tls_tls_connect_options_callback). + +### tlsSocket.localAddress[#](#tls_tlssocket_localaddress) + +Added in: v0.11.4 + +Returns the string representation of the local IP address. + +### tlsSocket.localPort[#](#tls_tlssocket_localport) + +Added in: v0.11.4 + +Returns the numeric representation of the local port. + +### tlsSocket.remoteAddress[#](#tls_tlssocket_remoteaddress) + +Added in: v0.11.4 + +Returns the string representation of the remote IP address. For example, +`'74.125.127.100'` or `'2001:4860:a005::68'`. + +### tlsSocket.remoteFamily[#](#tls_tlssocket_remotefamily) + +Added in: v0.11.4 + +Returns the string representation of the remote IP family. `'IPv4'` or `'IPv6'`. + +### tlsSocket.remotePort[#](#tls_tlssocket_remoteport) + +Added in: v0.11.4 + +Returns the numeric representation of the remote port. For example, `443`. + +### tlsSocket.renegotiate(options, callback)[#](#tls_tlssocket_renegotiate_options_callback) + +Added in: v0.11.8 + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + + `requestCert` +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A function that will be called when the renegotiation + request has been completed. + +The `tlsSocket.renegotiate()` method initiates a TLS renegotiation process. +Upon completion, the `callback` function will be passed a single argument +that is either an `Error` (if the request failed) or `null`. + +*Note*: This method can be used to request a peer's certificate after the +secure connection has been established. + +*Note*: When running as the server, the socket will be destroyed with an error +after `handshakeTimeout` timeout. + +### tlsSocket.setMaxSendFragment(size)[#](#tls_tlssocket_setmaxsendfragment_size) + +Added in: v0.11.11 + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The maximum TLS fragment size. Defaults to `16384`. The + maximum value is `16384`. + +The `tlsSocket.setMaxSendFragment()` method sets the maximum TLS fragment size. +Returns `true` if setting the limit succeeded; `false` otherwise. + +Smaller fragment sizes decrease the buffering latency on the client: larger +fragments are buffered by the TLS layer until the entire fragment is received +and its integrity is verified; large fragments can span multiple roundtrips +and their processing can be delayed due to packet loss or reordering. However, +smaller fragments add extra TLS framing bytes and CPU overhead, which may +decrease overall server throughput. + +## tls.connect(options[, callback])[#](#tls_tls_connect_options_callback) + +History + +| Version | Changes | +| --- | --- | +| v5.3.0, v4.7.0 | The `secureContext` option is supported now. | +| v5.0.0 | ALPN options are supported now. | +| v0.11.3 | Added in: v0.11.3 | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `host` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Host the client should connect to, defaults to 'localhost'. + + `port` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Port the client should connect to. + + `path` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Creates unix socket connection to path. If this option is + specified, `host` and `port` are ignored. + + `socket` [](net.html#net_class_net_socket) Establish secure connection on a given socket rather + than creating a new socket. If this option is specified, `path`, `host` and + `port` are ignored. Usually, a socket is already connected when passed to + `tls.connect()`, but it can be connected later. Note that + connection/disconnection/destruction of `socket` is the user's + responsibility, calling `tls.connect()` will not cause `net.connect()` to be + called. + + `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true`, the server certificate is verified + against the list of supplied CAs. An `'error'` event is emitted if + verification fails; `err.code` contains the OpenSSL error code. Defaults to + `true`. + + `NPNProtocols` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) An array of strings or `Buffer`s + containing supported NPN protocols. `Buffer`s should have the format + `[len][name][len][name]...` e.g. `0x05hello0x05world`, where the first + byte is the length of the next protocol name. Passing an array is usually + much simpler, e.g. `['hello', 'world']`. + + `ALPNProtocols`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) An array of strings or `Buffer`s + containing the supported ALPN protocols. `Buffer`s should have the format + `[len][name][len][name]...` e.g. `0x05hello0x05world`, where the first byte + is the length of the next protocol name. Passing an array is usually much + simpler: `['hello', 'world']`.) + + `servername`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Server name for the SNI (Server Name Indication) TLS + extension. + + `checkServerIdentity(servername, cert)` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function + to be used when checking the server's hostname against the certificate. + This should throw an error if verification fails. The method should return + `undefined` if the `servername` and `cert` are verified. + + `session` [](buffer.html#buffer_class_buffer) A `Buffer` instance, containing TLS session. + + `minDHSize` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Minimum size of the DH parameter in bits to accept a + TLS connection. When a server offers a DH parameter with a size less + than `minDHSize`, the TLS connection is destroyed and an error is thrown. + Defaults to `1024`. + + `secureContext`: Optional TLS context object created with + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). If a `secureContext` is *not* provided, one + will be created by passing the entire `options` object to + `tls.createSecureContext()`. *Note*: In effect, all + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) options can be provided, but they will be + *completely ignored* unless the `secureContext` option is missing. + + ...: Optional [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) options can be provided, see + the `secureContext` option for more information. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + +The `callback` function, if specified, will be added as a listener for the +[`'secureConnect'`](#tls_event_secureconnect) event. + +`tls.connect()` returns a [`tls.TLSSocket`](#tls_class_tls_tlssocket) object. + +The following implements a simple "echo server" example: + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + // Necessary only if using the client certificate authentication + key: fs.readFileSync('client-key.pem'), + cert: fs.readFileSync('client-cert.pem'), + + // Necessary only if the server uses the self-signed certificate + ca: [ fs.readFileSync('server-cert.pem') ] +}; + +const socket = tls.connect(8000, options, () => { + console.log('client connected', + socket.authorized ? 'authorized' : 'unauthorized'); + process.stdin.pipe(socket); + process.stdin.resume(); +}); +socket.setEncoding('utf8'); +socket.on('data', (data) => { + console.log(data); +}); +socket.on('end', () => { + server.close(); +}); +``` + +Or + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + pfx: fs.readFileSync('client.pfx') +}; + +const socket = tls.connect(8000, options, () => { + console.log('client connected', + socket.authorized ? 'authorized' : 'unauthorized'); + process.stdin.pipe(socket); + process.stdin.resume(); +}); +socket.setEncoding('utf8'); +socket.on('data', (data) => { + console.log(data); +}); +socket.on('end', () => { + server.close(); +}); +``` + +## tls.connect(path[, options][, callback])[#](#tls_tls_connect_path_options_callback) + +Added in: v0.11.3 + +* `path` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Default value for `options.path`. +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) See [`tls.connect()`](#tls_tls_connect_options_callback). +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) See [`tls.connect()`](#tls_tls_connect_options_callback). + +Same as [`tls.connect()`](#tls_tls_connect_options_callback) except that `path` can be provided +as an argument instead of an option. + +*Note*: A path option, if specified, will take precedence over the path +argument. + +## tls.connect(port[, host][, options][, callback])[#](#tls_tls_connect_port_host_options_callback) + +Added in: v0.11.3 + +* `port` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Default value for `options.port`. +* `host` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional default value for `options.host`. +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) See [`tls.connect()`](#tls_tls_connect_options_callback). +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) See [`tls.connect()`](#tls_tls_connect_options_callback). + +Same as [`tls.connect()`](#tls_tls_connect_options_callback) except that `port` and `host` can be provided +as arguments instead of options. + +*Note*: A port or host option, if specified, will take precedence over any port +or host argument. + +## tls.createSecureContext(options)[#](#tls_tls_createsecurecontext_options) + +History + +| Version | Changes | +| --- | --- | +| v7.3.0 | If the `key` option is an array, individual entries do not need a `passphrase` property anymore. Array entries can also just be `string`s or `Buffer`s now. | +| v5.2.0 | The `ca` option can now be a single string containing multiple CA certificates. | +| v0.11.13 | Added in: v0.11.13 | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `pfx` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) Optional PFX or PKCS12 encoded private key and + certificate chain. `pfx` is an alternative to providing `key` and `cert` + individually. PFX is usually encrypted, if it is, `passphrase` will be used + to decrypt it. + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Optional private keys in + PEM format. PEM allows the option of private keys being encrypted. Encrypted + keys will be decrypted with `options.passphrase`. Multiple keys using + different algorithms can be provided either as an array of unencrypted key + strings or buffers, or an array of objects in the form `{pem: + [, passphrase: ]}`. The object form can only occur in + an array. `object.passphrase` is optional. Encrypted keys will be decrypted + with `object.passphrase` if provided, or `options.passphrase` if it is not. + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional shared passphrase used for a single private + key and/or a PFX. + + `cert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) Optional cert chains in PEM format. + One cert chain should be provided per private key. Each cert chain should + consist of the PEM formatted certificate for a provided private `key`, + followed by the PEM formatted intermediate certificates (if any), in order, + and not including the root CA (the root CA must be pre-known to the peer, + see `ca`). When providing multiple cert chains, they do not have to be in + the same order as their private keys in `key`. If the intermediate + certificates are not provided, the peer will not be able to validate the + certificate, and the handshake will fail. + + `ca` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) Optionally override the trusted CA + certificates. Default is to trust the well-known CAs curated by Mozilla. + Mozilla's CAs are completely replaced when CAs are explicitly specified + using this option. The value can be a string or Buffer, or an Array of + strings and/or Buffers. Any string or Buffer can contain multiple PEM CAs + concatenated together. The peer's certificate must be chainable to a CA + trusted by the server for the connection to be authenticated. When using + certificates that are not chainable to a well-known CA, the certificate's CA + must be explicitly specified as a trusted or the connection will fail to + authenticate. + If the peer uses a certificate that doesn't match or chain to one of the + default CAs, use the `ca` option to provide a CA certificate that the peer's + certificate can match or chain to. + For self-signed certificates, the certificate is its own CA, and must be + provided. + + `crl` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) Optional PEM formatted + CRLs (Certificate Revocation Lists). + + `ciphers` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional cipher suite specification, replacing the + default. For more information, see [modifying the default cipher suite](#tls_modifying_the_default_tls_cipher_suite). + + `honorCipherOrder` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Attempt to use the server's cipher suite + preferences instead of the client's. When `true`, causes + `SSL_OP_CIPHER_SERVER_PREFERENCE` to be set in `secureOptions`, see + [OpenSSL Options](crypto.html#crypto_openssl_options) for more information. + *Note*: [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) sets the default value to `true`, other + APIs that create secure contexts leave it unset. + + `ecdhCurve` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A string describing a named curve to use for ECDH key + agreement or `false` to disable ECDH. Defaults to + [`tls.DEFAULT_ECDH_CURVE`](#tls_tls_default_ecdh_curve). Use [`crypto.getCurves()`](crypto.html#crypto_crypto_getcurves) to obtain a list + of available curve names. On recent releases, `openssl ecparam -list_curves` + will also display the name and description of each available elliptic curve. + + `dhparam` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) Diffie Hellman parameters, required for + [Perfect Forward Secrecy](#tls_perfect_forward_secrecy). Use `openssl dhparam` to create the parameters. + The key length must be greater than or equal to 1024 bits, otherwise an + error will be thrown. It is strongly recommended to use 2048 bits or larger + for stronger security. If omitted or invalid, the parameters are silently + discarded and DHE ciphers will not be available. + + `secureProtocol` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional SSL method to use, default is + `"SSLv23_method"`. The possible values are listed as [SSL\_METHODS](https://www.openssl.org/docs/man1.0.2/ssl/ssl.html#DEALING-WITH-PROTOCOL-METHODS), use + the function names as strings. For example, `"SSLv3_method"` to force SSL + version 3. + + `secureOptions` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Optionally affect the OpenSSL protocol behaviour, + which is not usually necessary. This should be used carefully if at all! + Value is a numeric bitmask of the `SSL_OP_*` options from + [OpenSSL Options](crypto.html#crypto_openssl_options). + + `sessionIdContext` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional opaque identifier used by servers to + ensure session state is not shared between applications. Unused by clients. + *Note*: [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) uses a 128 bit truncated SHA1 hash value + generated from `process.argv`, other APIs that create secure contexts + have no default value. + +The `tls.createSecureContext()` method creates a credentials object. + +A key is *required* for ciphers that make use of certificates. Either `key` or +`pfx` can be used to provide it. + +If the 'ca' option is not given, then Node.js will use the default +publicly trusted list of CAs as given in +. + +## tls.createServer([options][, secureConnectionListener])[#](#tls_tls_createserver_options_secureconnectionlistener) + +History + +| Version | Changes | +| --- | --- | +| v5.0.0 | ALPN options are supported now. | +| v0.3.2 | Added in: v0.3.2 | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `handshakeTimeout` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Abort the connection if the SSL/TLS handshake + does not finish in the specified number of milliseconds. Defaults to `120` + seconds. A `'clientError'` is emitted on the `tls.Server` object whenever a + handshake times out. + + `requestCert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true` the server will request a certificate from + clients that connect and attempt to verify that certificate. Defaults to + `false`. + + `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true` the server will reject any + connection which is not authorized with the list of supplied CAs. This + option only has an effect if `requestCert` is `true`. Defaults to `false`. + + `NPNProtocols` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) An array of strings or a `Buffer` naming + possible NPN protocols. (Protocols should be ordered by their priority.) + + `ALPNProtocols` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) An array of strings or a `Buffer` naming + possible ALPN protocols. (Protocols should be ordered by their priority.) + When the server receives both NPN and ALPN extensions from the client, + ALPN takes precedence over NPN and the server does not send an NPN + extension to the client. + + `SNICallback(servername, cb)` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A function that will be called if + the client supports SNI TLS extension. Two arguments will be passed when + called: `servername` and `cb`. `SNICallback` should invoke `cb(null, ctx)`, + where `ctx` is a SecureContext instance. (`tls.createSecureContext(...)` can + be used to get a proper SecureContext.) If `SNICallback` wasn't provided the + default callback with high-level API will be used (see below). + + `sessionTimeout` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) An integer specifying the number of seconds after + which the TLS session identifiers and TLS session tickets created by the + server will time out. See [SSL\_CTX\_set\_timeout](https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_timeout.html) for more details. + + `ticketKeys`: A 48-byte `Buffer` instance consisting of a 16-byte prefix, + a 16-byte HMAC key, and a 16-byte AES key. This can be used to accept TLS + session tickets on multiple instances of the TLS server. *Note* that this is + automatically shared between `cluster` module workers. + + ...: Any [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) options can be provided. For + servers, the identity options (`pfx` or `key`/`cert`) are usually required. +* `secureConnectionListener` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + +Creates a new [tls.Server](#tls_class_tls_server). The `secureConnectionListener`, if provided, is +automatically set as a listener for the [`'secureConnection'`](#tls_event_secureconnection) event. + +The following illustrates a simple echo server: + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + key: fs.readFileSync('server-key.pem'), + cert: fs.readFileSync('server-cert.pem'), + + // This is necessary only if using the client certificate authentication. + requestCert: true, + + // This is necessary only if the client uses the self-signed certificate. + ca: [ fs.readFileSync('client-cert.pem') ] +}; + +const server = tls.createServer(options, (socket) => { + console.log('server connected', + socket.authorized ? 'authorized' : 'unauthorized'); + socket.write('welcome!\n'); + socket.setEncoding('utf8'); + socket.pipe(socket); +}); +server.listen(8000, () => { + console.log('server bound'); +}); +``` + +Or + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + pfx: fs.readFileSync('server.pfx'), + + // This is necessary only if using the client certificate authentication. + requestCert: true, + +}; + +const server = tls.createServer(options, (socket) => { + console.log('server connected', + socket.authorized ? 'authorized' : 'unauthorized'); + socket.write('welcome!\n'); + socket.setEncoding('utf8'); + socket.pipe(socket); +}); +server.listen(8000, () => { + console.log('server bound'); +}); +``` + +This server can be tested by connecting to it using `openssl s_client`: + +```None +openssl s_client -connect 127.0.0.1:8000 +``` + +## tls.getCiphers()[#](#tls_tls_getciphers) + +Added in: v0.10.2 + +Returns an array with the names of the supported SSL ciphers. + +For example: + +```None +console.log(tls.getCiphers()); // ['AES128-SHA', 'AES256-SHA', ...] +``` + +## tls.DEFAULT\_ECDH\_CURVE[#](#tls_tls_default_ecdh_curve) + +Added in: v0.11.13 + +The default curve name to use for ECDH key agreement in a tls server. The +default value is `'prime256v1'` (NIST P-256). Consult [RFC 4492](https://www.rfc-editor.org/rfc/rfc4492.txt) and +[FIPS.186-4](http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf) for more details. + +## Deprecated APIs[#](#tls_deprecated_apis) + +### Class: CryptoStream[#](#tls_class_cryptostream) + +Added in: v0.3.4Deprecated since: v0.11.3 + +```None +Stability: 0 - Deprecated: Use tls.TLSSocket instead. +``` + +The `tls.CryptoStream` class represents a stream of encrypted data. This class +has been deprecated and should no longer be used. + +#### cryptoStream.bytesWritten[#](#tls_cryptostream_byteswritten) + +Added in: v0.3.4Deprecated since: v0.11.3 + +The `cryptoStream.bytesWritten` property returns the total number of bytes +written to the underlying socket *including* the bytes required for the +implementation of the TLS protocol. + +### Class: SecurePair[#](#tls_class_securepair) + +Added in: v0.3.2Deprecated since: v0.11.3 + +```None +Stability: 0 - Deprecated: Use tls.TLSSocket instead. +``` + +Returned by [`tls.createSecurePair()`](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options). + +#### Event: 'secure'[#](#tls_event_secure) + +Added in: v0.3.2Deprecated since: v0.11.3 + +The `'secure'` event is emitted by the `SecurePair` object once a secure +connection has been established. + +As with checking for the server [`secureConnection`](#tls_event_secureconnection) +event, `pair.cleartext.authorized` should be inspected to confirm whether the +certificate used is properly authorized. + +### tls.createSecurePair([context][, isServer][, requestCert][, rejectUnauthorized][, options])[#](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options) + +History + +| Version | Changes | +| --- | --- | +| v5.0.0 | ALPN options are supported now. | +| v0.11.3 | Deprecated since: v0.11.3 | +| v0.3.2 | Added in: v0.3.2 | + +```None +Stability: 0 - Deprecated: Use tls.TLSSocket instead. +``` + +* `context` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) A secure context object as returned by + `tls.createSecureContext()` +* `isServer` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` to specify that this TLS connection should be + opened as a server. +* `requestCert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` to specify whether a server should request a + certificate from a connecting client. Only applies when `isServer` is `true`. +* `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` to specify whether a server should + automatically reject clients with invalid certificates. Only applies when + `isServer` is `true`. +* `options` + + `secureContext`: An optional TLS context object from + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) + + `isServer`: If `true` the TLS socket will be instantiated in server-mode. + Defaults to `false`. + + `server` An optional [`net.Server`](net.html#net_class_net_server) instance + + `requestCert`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `rejectUnauthorized`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `NPNProtocols`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `ALPNProtocols`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `SNICallback`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `session` [](buffer.html#buffer_class_buffer) An optional `Buffer` instance containing a TLS session. + + `requestOCSP` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true`, specifies that the OCSP status request + extension will be added to the client hello and an `'OCSPResponse'` event + will be emitted on the socket before establishing a secure communication + +Creates a new secure pair object with two streams, one of which reads and writes +the encrypted data and the other of which reads and writes the cleartext data. +Generally, the encrypted stream is piped to/from an incoming encrypted data +stream and the cleartext one is used as a replacement for the initial encrypted +stream. + +`tls.createSecurePair()` returns a `tls.SecurePair` object with `cleartext` and +`encrypted` stream properties. + +*Note*: `cleartext` has the same API as [`tls.TLSSocket`](#tls_class_tls_tlssocket). + +*Note*: The `tls.createSecurePair()` method is now deprecated in favor of +`tls.TLSSocket()`. For example, the code: + +```None +pair = tls.createSecurePair(/* ... */); +pair.encrypted.pipe(socket); +socket.pipe(pair.encrypted); +``` + +can be replaced by: + +```None +secure_socket = tls.TLSSocket(socket, options); +``` + +where `secure_socket` has the same API as `pair.cleartext`. diff --git a/corpus/docs/nodejs/tls/tls_8x.md b/corpus/docs/nodejs/tls/tls_8x.md new file mode 100644 index 0000000000000000000000000000000000000000..68bc630a05e22c4b495e36bef9f00b4868dab4b8 --- /dev/null +++ b/corpus/docs/nodejs/tls/tls_8x.md @@ -0,0 +1,1286 @@ +# TLS (SSL)# + +Source: https://nodejs.org/docs/latest-v8.x/api/tls.html +Version: 8.x + +[Stability: 2](documentation.html#documentation_stability_index) - Stable + +The `tls` module provides an implementation of the Transport Layer Security +(TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL. +The module can be accessed using: + +```None +const tls = require('tls'); +``` + +## TLS/SSL Concepts[#](#tls_tls_ssl_concepts) + +The TLS/SSL is a public/private key infrastructure (PKI). For most common +cases, each client and server must have a *private key*. + +Private keys can be generated in multiple ways. The example below illustrates +use of the OpenSSL command-line interface to generate a 2048-bit RSA private +key: + +```None +openssl genrsa -out ryans-key.pem 2048 +``` + +With TLS/SSL, all servers (and some clients) must have a *certificate*. +Certificates are *public keys* that correspond to a private key, and that are +digitally signed either by a Certificate Authority or by the owner of the +private key (such certificates are referred to as "self-signed"). The first +step to obtaining a certificate is to create a *Certificate Signing Request* +(CSR) file. + +The OpenSSL command-line interface can be used to generate a CSR for a private +key: + +```None +openssl req -new -sha256 -key ryans-key.pem -out ryans-csr.pem +``` + +Once the CSR file is generated, it can either be sent to a Certificate +Authority for signing or used to generate a self-signed certificate. + +Creating a self-signed certificate using the OpenSSL command-line interface +is illustrated in the example below: + +```None +openssl x509 -req -in ryans-csr.pem -signkey ryans-key.pem -out ryans-cert.pem +``` + +Once the certificate is generated, it can be used to generate a `.pfx` or +`.p12` file: + +```None +openssl pkcs12 -export -in ryans-cert.pem -inkey ryans-key.pem \ + -certfile ca-cert.pem -out ryans.pfx +``` + +Where: + +* `in`: is the signed certificate +* `inkey`: is the associated private key +* `certfile`: is a concatenation of all Certificate Authority (CA) certs into + a single file, e.g. `cat ca1-cert.pem ca2-cert.pem > ca-cert.pem` + +### Perfect Forward Secrecy[#](#tls_perfect_forward_secrecy) + +The term "[Forward Secrecy](https://en.wikipedia.org/wiki/Perfect_forward_secrecy)" or "Perfect Forward Secrecy" describes a feature of +key-agreement (i.e., key-exchange) methods. That is, the server and client keys +are used to negotiate new temporary keys that are used specifically and only for +the current communication session. Practically, this means that even if the +server's private key is compromised, communication can only be decrypted by +eavesdroppers if the attacker manages to obtain the key-pair specifically +generated for the session. + +Perfect Forward Secrecy is achieved by randomly generating a key pair for +key-agreement on every TLS/SSL handshake (in contrast to using the same key for +all sessions). Methods implementing this technique are called "ephemeral". + +Currently two methods are commonly used to achieve Perfect Forward Secrecy (note +the character "E" appended to the traditional abbreviations): + +* [DHE](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange) - An ephemeral version of the Diffie Hellman key-agreement protocol. +* [ECDHE](https://en.wikipedia.org/wiki/Elliptic_curve_Diffie%E2%80%93Hellman) - An ephemeral version of the Elliptic Curve Diffie Hellman + key-agreement protocol. + +Ephemeral methods may have some performance drawbacks, because key generation +is expensive. + +To use Perfect Forward Secrecy using `DHE` with the `tls` module, it is required +to generate Diffie-Hellman parameters and specify them with the `dhparam` +option to [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). The following illustrates the use of +the OpenSSL command-line interface to generate such parameters: + +```None +openssl dhparam -outform PEM -out dhparam.pem 2048 +``` + +If using Perfect Forward Secrecy using `ECDHE`, Diffie-Hellman parameters are +not required and a default ECDHE curve will be used. The `ecdhCurve` property +can be used when creating a TLS Server to specify the list of names of supported +curves to use, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) for more info. + +### ALPN, NPN, and SNI[#](#tls_alpn_npn_and_sni) + +ALPN (Application-Layer Protocol Negotiation Extension), NPN (Next +Protocol Negotiation) and, SNI (Server Name Indication) are TLS +handshake extensions: + +* ALPN/NPN - Allows the use of one TLS server for multiple protocols (HTTP, + SPDY, HTTP/2) +* SNI - Allows the use of one TLS server for multiple hostnames with different + SSL certificates. + +*Note*: Use of ALPN is recommended over NPN. The NPN extension has never been +formally defined or documented and generally not recommended for use. + +### Client-initiated renegotiation attack mitigation[#](#tls_client_initiated_renegotiation_attack_mitigation) + +The TLS protocol allows clients to renegotiate certain aspects of the TLS +session. Unfortunately, session renegotiation requires a disproportionate amount +of server-side resources, making it a potential vector for denial-of-service +attacks. + +To mitigate the risk, renegotiation is limited to three times every ten minutes. +An `'error'` event is emitted on the [`tls.TLSSocket`](#tls_class_tls_tlssocket) instance when this +threshold is exceeded. The limits are configurable: + +* `tls.CLIENT_RENEG_LIMIT` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Specifies the number of renegotiation + requests. **Default:** `3`. +* `tls.CLIENT_RENEG_WINDOW` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Specifies the time renegotiation window + in seconds. **Default:** `600` (10 minutes). + +*Note*: The default renegotiation limits should not be modified without a full +understanding of the implications and risks. + +To test the renegotiation limits on a server, connect to it using the OpenSSL +command-line client (`openssl s_client -connect address:port`) then input +`R` (i.e., the letter `R` followed by a carriage return) multiple times. + +## Modifying the Default TLS Cipher suite[#](#tls_modifying_the_default_tls_cipher_suite) + +Node.js is built with a default suite of enabled and disabled TLS ciphers. +Currently, the default cipher suite is: + +```None +ECDHE-RSA-AES128-GCM-SHA256: +ECDHE-ECDSA-AES128-GCM-SHA256: +ECDHE-RSA-AES256-GCM-SHA384: +ECDHE-ECDSA-AES256-GCM-SHA384: +DHE-RSA-AES128-GCM-SHA256: +ECDHE-RSA-AES128-SHA256: +DHE-RSA-AES128-SHA256: +ECDHE-RSA-AES256-SHA384: +DHE-RSA-AES256-SHA384: +ECDHE-RSA-AES256-SHA256: +DHE-RSA-AES256-SHA256: +HIGH: +!aNULL: +!eNULL: +!EXPORT: +!DES: +!RC4: +!MD5: +!PSK: +!SRP: +!CAMELLIA +``` + +This default can be replaced entirely using the `--tls-cipher-list` command +line switch. For instance, the following makes +`ECDHE-RSA-AES128-GCM-SHA256:!RC4` the default TLS cipher suite: + +```None +node --tls-cipher-list="ECDHE-RSA-AES128-GCM-SHA256:!RC4" +``` + +The default can also be replaced on a per client or server basis using the +`ciphers` option from [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options), which is also available +in [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener), [`tls.connect()`](#tls_tls_connect_options_callback), and when creating new +[`tls.TLSSocket`](#tls_class_tls_tlssocket)s. + +Consult [OpenSSL cipher list format documentation](https://www.openssl.org/docs/man1.0.2/apps/ciphers.html#CIPHER-LIST-FORMAT) for details on the format. + +*Note*: The default cipher suite included within Node.js has been carefully +selected to reflect current security best practices and risk mitigation. +Changing the default cipher suite can have a significant impact on the security +of an application. The `--tls-cipher-list` switch and `ciphers` option should by +used only if absolutely necessary. + +The default cipher suite prefers GCM ciphers for [Chrome's 'modern +cryptography' setting](https://www.chromium.org/Home/chromium-security/education/tls#TOC-Cipher-Suites) and also prefers ECDHE and DHE ciphers for Perfect +Forward Secrecy, while offering *some* backward compatibility. + +128 bit AES is preferred over 192 and 256 bit AES in light of [specific +attacks affecting larger AES key sizes](https://www.schneier.com/blog/archives/2009/07/another_new_aes.html). + +Old clients that rely on insecure and deprecated RC4 or DES-based ciphers +(like Internet Explorer 6) cannot complete the handshaking process with +the default configuration. If these clients *must* be supported, the +[TLS recommendations](https://wiki.mozilla.org/Security/Server_Side_TLS) may offer a compatible cipher suite. For more details +on the format, see the [OpenSSL cipher list format documentation](https://www.openssl.org/docs/man1.0.2/apps/ciphers.html#CIPHER-LIST-FORMAT). + +## Class: tls.Server[#](#tls_class_tls_server) + +Added in: v0.3.2 + +The `tls.Server` class is a subclass of `net.Server` that accepts encrypted +connections using TLS or SSL. + +### Event: 'newSession'[#](#tls_event_newsession) + +Added in: v0.9.2 + +The `'newSession'` event is emitted upon creation of a new TLS session. This may +be used to store sessions in external storage. The listener callback is passed +three arguments when called: + +* `sessionId` - The TLS session identifier +* `sessionData` - The TLS session data +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function taking no arguments that must be + invoked in order for data to be sent or received over the secure connection. + +*Note*: Listening for this event will have an effect only on connections +established after the addition of the event listener. + +### Event: 'OCSPRequest'[#](#tls_event_ocsprequest) + +Added in: v0.11.13 + +The `'OCSPRequest'` event is emitted when the client sends a certificate status +request. The listener callback is passed three arguments when called: + +* `certificate` [](buffer.html#buffer_class_buffer) The server certificate +* `issuer` [](buffer.html#buffer_class_buffer) The issuer's certificate +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function that must be invoked to provide + the results of the OCSP request. + +The server's current certificate can be parsed to obtain the OCSP URL +and certificate ID; after obtaining an OCSP response, `callback(null, resp)` is +then invoked, where `resp` is a `Buffer` instance containing the OCSP response. +Both `certificate` and `issuer` are `Buffer` DER-representations of the +primary and issuer's certificates. These can be used to obtain the OCSP +certificate ID and OCSP endpoint URL. + +Alternatively, `callback(null, null)` may be called, indicating that there was +no OCSP response. + +Calling `callback(err)` will result in a `socket.destroy(err)` call. + +The typical flow of an OCSP Request is as follows: + +1. Client connects to the server and sends an `'OCSPRequest'` (via the status + info extension in ClientHello). +2. Server receives the request and emits the `'OCSPRequest'` event, calling the + listener if registered. +3. Server extracts the OCSP URL from either the `certificate` or `issuer` and + performs an [OCSP request](https://en.wikipedia.org/wiki/OCSP_stapling) to the CA. +4. Server receives `OCSPResponse` from the CA and sends it back to the client + via the `callback` argument +5. Client validates the response and either destroys the socket or performs a + handshake. + +*Note*: The `issuer` can be `null` if the certificate is either self-signed or +the issuer is not in the root certificates list. (An issuer may be provided +via the `ca` option when establishing the TLS connection.) + +*Note*: Listening for this event will have an effect only on connections +established after the addition of the event listener. + +*Note*: An npm module like [asn1.js](https://npmjs.org/package/asn1.js) may be used to parse the certificates. + +### Event: 'resumeSession'[#](#tls_event_resumesession) + +Added in: v0.9.2 + +The `'resumeSession'` event is emitted when the client requests to resume a +previous TLS session. The listener callback is passed two arguments when +called: + +* `sessionId` - The TLS/SSL session identifier +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function to be called when the prior session + has been recovered. + +When called, the event listener may perform a lookup in external storage using +the given `sessionId` and invoke `callback(null, sessionData)` once finished. If +the session cannot be resumed (i.e., doesn't exist in storage) the callback may +be invoked as `callback(null, null)`. Calling `callback(err)` will terminate the +incoming connection and destroy the socket. + +*Note*: Listening for this event will have an effect only on connections +established after the addition of the event listener. + +The following illustrates resuming a TLS session: + +```None +const tlsSessionStore = {}; +server.on('newSession', (id, data, cb) => { + tlsSessionStore[id.toString('hex')] = data; + cb(); +}); +server.on('resumeSession', (id, cb) => { + cb(null, tlsSessionStore[id.toString('hex')] || null); +}); +``` + +### Event: 'secureConnection'[#](#tls_event_secureconnection) + +Added in: v0.3.2 + +The `'secureConnection'` event is emitted after the handshaking process for a +new connection has successfully completed. The listener callback is passed a +single argument when called: + +* `tlsSocket` [](tls.html#tls_class_tls_tlssocket) The established TLS socket. + +The `tlsSocket.authorized` property is a `boolean` indicating whether the +client has been verified by one of the supplied Certificate Authorities for the +server. If `tlsSocket.authorized` is `false`, then `socket.authorizationError` +is set to describe how authorization failed. Note that depending on the settings +of the TLS server, unauthorized connections may still be accepted. + +The `tlsSocket.npnProtocol` and `tlsSocket.alpnProtocol` properties are strings +that contain the selected NPN and ALPN protocols, respectively. When both NPN +and ALPN extensions are received, ALPN takes precedence over NPN and the next +protocol is selected by ALPN. + +When ALPN has no selected protocol, `tlsSocket.alpnProtocol` returns `false`. + +The `tlsSocket.servername` property is a string containing the server name +requested via SNI. + +### Event: 'tlsClientError'[#](#tls_event_tlsclienterror) + +Added in: v6.0.0 + +The `'tlsClientError'` event is emitted when an error occurs before a secure +connection is established. The listener callback is passed two arguments when +called: + +* `exception` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) The `Error` object describing the error +* `tlsSocket` [](tls.html#tls_class_tls_tlssocket) The `tls.TLSSocket` instance from which the + error originated. + +### server.addContext(hostname, context)[#](#tls_server_addcontext_hostname_context) + +Added in: v0.5.3 + +* `hostname` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A SNI hostname or wildcard (e.g. `'*'`) +* `context` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) An object containing any of the possible properties + from the [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) `options` arguments (e.g. `key`, + `cert`, `ca`, etc). + +The `server.addContext()` method adds a secure context that will be used if +the client request's SNI hostname matches the supplied `hostname` (or wildcard). + +### server.address()[#](#tls_server_address) + +Added in: v0.6.0 + +Returns the bound address, the address family name, and port of the +server as reported by the operating system. See [`net.Server.address()`](net.html#net_server_address) for +more information. + +### server.close([callback])[#](#tls_server_close_callback) + +Added in: v0.3.2 + +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) An optional listener callback that will be registered to + listen for the server instance's `'close'` event. + +The `server.close()` method stops the server from accepting new connections. + +This function operates asynchronously. The `'close'` event will be emitted +when the server has no more open connections. + +### server.connections[#](#tls_server_connections) + +Added in: v0.3.2Deprecated since: v0.9.7 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`server.getConnections()`](net.html#net_server_getconnections_callback) instead. + +Returns the current number of concurrent connections on the server. + +### server.getTicketKeys()[#](#tls_server_getticketkeys) + +Added in: v3.0.0 + +Returns a `Buffer` instance holding the keys currently used for +encryption/decryption of the [TLS Session Tickets](https://www.ietf.org/rfc/rfc5077.txt) + +### server.listen()[#](#tls_server_listen) + +Starts the server listening for encrypted connections. +This method is identical to [`server.listen()`](net.html#net_server_listen) from [`net.Server`](net.html#net_class_net_server). + +### server.setTicketKeys(keys)[#](#tls_server_setticketkeys_keys) + +Added in: v3.0.0 + +* `keys` [](buffer.html#buffer_class_buffer) The keys used for encryption/decryption of the + [TLS Session Tickets](https://www.ietf.org/rfc/rfc5077.txt). + +Updates the keys for encryption/decryption of the [TLS Session Tickets](https://www.ietf.org/rfc/rfc5077.txt). + +*Note*: The key's `Buffer` should be 48 bytes long. See `ticketKeys` option in +[tls.createServer](#tls_tls_createserver_options_secureconnectionlistener) for +more information on how it is used. + +*Note*: Changes to the ticket keys are effective only for future server +connections. Existing or currently pending server connections will use the +previous keys. + +## Class: tls.TLSSocket[#](#tls_class_tls_tlssocket) + +Added in: v0.11.4 + +The `tls.TLSSocket` is a subclass of [`net.Socket`](net.html#net_class_net_socket) that performs transparent +encryption of written data and all required TLS negotiation. + +Instances of `tls.TLSSocket` implement the duplex [Stream](stream.html#stream_stream) interface. + +*Note*: Methods that return TLS connection metadata (e.g. +[`tls.TLSSocket.getPeerCertificate()`](#tls_tlssocket_getpeercertificate_detailed) will only return data while the +connection is open. + +### new tls.TLSSocket(socket[, options])[#](#tls_new_tls_tlssocket_socket_options) + +History + +| Version | Changes | +| --- | --- | +| v5.0.0 | ALPN options are supported now. | +| v0.11.4 | Added in: v0.11.4 | + +* `socket` [](net.html#net_class_net_socket) | [](stream.html#stream_class_stream_duplex) + On the server side, any `Duplex` stream. On the client side, any + instance of [`net.Socket`](net.html#net_class_net_socket) (for generic `Duplex` stream support + on the client side, [`tls.connect()`](#tls_tls_connect_options_callback) must be used). +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `isServer`: The SSL/TLS protocol is asymmetrical, TLSSockets must know if + they are to behave as a server or a client. If `true` the TLS socket will be + instantiated as a server. **Default:** `false`. + + `server` [](net.html#net_class_net_server) An optional [`net.Server`](net.html#net_class_net_server) instance. + + `requestCert`: Whether to authenticate the remote peer by requesting a + certificate. Clients always request a server certificate. Servers + (`isServer` is true) may optionally set `requestCert` to true to request a + client certificate. + + `rejectUnauthorized`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `NPNProtocols`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `ALPNProtocols`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `SNICallback`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `session` [](buffer.html#buffer_class_buffer) An optional `Buffer` instance containing a TLS session. + + `requestOCSP` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true`, specifies that the OCSP status request + extension will be added to the client hello and an `'OCSPResponse'` event + will be emitted on the socket before establishing a secure communication + + `secureContext`: Optional TLS context object created with + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). If a `secureContext` is *not* provided, one + will be created by passing the entire `options` object to + `tls.createSecureContext()`. + + ...: Optional [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) options that are used if the + `secureContext` option is missing, otherwise they are ignored. + +Construct a new `tls.TLSSocket` object from an existing TCP socket. + +### Event: 'OCSPResponse'[#](#tls_event_ocspresponse) + +Added in: v0.11.13 + +The `'OCSPResponse'` event is emitted if the `requestOCSP` option was set +when the `tls.TLSSocket` was created and an OCSP response has been received. +The listener callback is passed a single argument when called: + +* `response` [](buffer.html#buffer_class_buffer) The server's OCSP response + +Typically, the `response` is a digitally signed object from the server's CA that +contains information about server's certificate revocation status. + +### Event: 'secureConnect'[#](#tls_event_secureconnect) + +Added in: v0.11.4 + +The `'secureConnect'` event is emitted after the handshaking process for a new +connection has successfully completed. The listener callback will be called +regardless of whether or not the server's certificate has been authorized. It +is the client's responsibility to check the `tlsSocket.authorized` property to +determine if the server certificate was signed by one of the specified CAs. If +`tlsSocket.authorized === false`, then the error can be found by examining the +`tlsSocket.authorizationError` property. If either ALPN or NPN was used, +the `tlsSocket.alpnProtocol` or `tlsSocket.npnProtocol` properties can be +checked to determine the negotiated protocol. + +### tlsSocket.address()[#](#tls_tlssocket_address) + +Added in: v0.11.4 + +Returns the bound address, the address family name, and port of the +underlying socket as reported by the operating system. Returns an +object with three properties, e.g. +`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` + +### tlsSocket.authorizationError[#](#tls_tlssocket_authorizationerror) + +Added in: v0.11.4 + +Returns the reason why the peer's certificate was not been verified. This +property is set only when `tlsSocket.authorized === false`. + +### tlsSocket.authorized[#](#tls_tlssocket_authorized) + +Added in: v0.11.4 + +Returns `true` if the peer certificate was signed by one of the CAs specified +when creating the `tls.TLSSocket` instance, otherwise `false`. + +### tlsSocket.disableRenegotiation()[#](#tls_tlssocket_disablerenegotiation) + +Added in: v8.4.0 + +Disables TLS renegotiation for this `TLSSocket` instance. Once called, attempts +to renegotiate will trigger an `'error'` event on the `TLSSocket`. + +### tlsSocket.encrypted[#](#tls_tlssocket_encrypted) + +Added in: v0.11.4 + +Always returns `true`. This may be used to distinguish TLS sockets from regular +`net.Socket` instances. + +### tlsSocket.getCipher()[#](#tls_tlssocket_getcipher) + +Added in: v0.11.4 + +Returns an object representing the cipher name. The `version` key is a legacy +field which always contains the value `'TLSv1/SSLv3'`. + +For example: `{ name: 'AES256-SHA', version: 'TLSv1/SSLv3' }` + +See `SSL_CIPHER_get_name()` in + for more +information. + +### tlsSocket.getEphemeralKeyInfo()[#](#tls_tlssocket_getephemeralkeyinfo) + +Added in: v5.0.0 + +Returns an object representing the type, name, and size of parameter of +an ephemeral key exchange in [Perfect Forward Secrecy](#tls_perfect_forward_secrecy) on a client +connection. It returns an empty object when the key exchange is not +ephemeral. As this is only supported on a client socket; `null` is returned +if called on a server socket. The supported types are `'DH'` and `'ECDH'`. The +`name` property is available only when type is 'ECDH'. + +For Example: `{ type: 'ECDH', name: 'prime256v1', size: 256 }` + +### tlsSocket.getFinished()[#](#tls_tlssocket_getfinished) + +Added in: v8.12.0 + +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type) The latest `Finished` message that has been + sent to the socket as part of a SSL/TLS handshake, or `undefined` if + no `Finished` message has been sent yet. + +As the `Finished` messages are message digests of the complete handshake +(with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can +be used for external authentication procedures when the authentication +provided by SSL/TLS is not desired or is not enough. + +Corresponds to the `SSL_get_finished` routine in OpenSSL and may be used +to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929). + +### tlsSocket.getPeerCertificate([detailed])[#](#tls_tlssocket_getpeercertificate_detailed) + +Added in: v0.11.4 + +* `detailed` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Include the full certificate chain if `true`, otherwise + include just the peer's certificate. + +Returns an object representing the peer's certificate. The returned object has +some properties corresponding to the fields of the certificate. + +If the full certificate chain was requested, each certificate will include a +`issuerCertificate` property containing an object representing its issuer's +certificate. + +For example: + +```None +{ subject: + { C: 'UK', + ST: 'Acknack Ltd', + L: 'Rhys Jones', + O: 'node.js', + OU: 'Test TLS Certificate', + CN: 'localhost' }, + issuer: + { C: 'UK', + ST: 'Acknack Ltd', + L: 'Rhys Jones', + O: 'node.js', + OU: 'Test TLS Certificate', + CN: 'localhost' }, + issuerCertificate: + { ... another certificate, possibly with a .issuerCertificate ... }, + raw: < RAW DER buffer >, + valid_from: 'Nov 11 09:52:22 2009 GMT', + valid_to: 'Nov 6 09:52:22 2029 GMT', + fingerprint: '2A:7A:C2:DD:E5:F9:CC:53:72:35:99:7A:02:5A:71:38:52:EC:8A:DF', + serialNumber: 'B9B0D332A1AA5635' } +``` + +If the peer does not provide a certificate, an empty object will be returned. + +### tlsSocket.getPeerFinished()[#](#tls_tlssocket_getpeerfinished) + +Added in: v8.12.0 + +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type) The latest `Finished` message that is expected + or has actually been received from the socket as part of a SSL/TLS handshake, + or `undefined` if there is no `Finished` message so far. + +As the `Finished` messages are message digests of the complete handshake +(with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can +be used for external authentication procedures when the authentication +provided by SSL/TLS is not desired or is not enough. + +Corresponds to the `SSL_get_peer_finished` routine in OpenSSL and may be used +to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929). + +### tlsSocket.getProtocol()[#](#tls_tlssocket_getprotocol) + +Added in: v5.7.0 + +Returns a string containing the negotiated SSL/TLS protocol version of the +current connection. The value `'unknown'` will be returned for connected +sockets that have not completed the handshaking process. The value `null` will +be returned for server sockets or disconnected client sockets. + +Example responses include: + +* `TLSv1` +* `TLSv1.1` +* `TLSv1.2` +* `unknown` + +See for more +information. + +### tlsSocket.getSession()[#](#tls_tlssocket_getsession) + +Added in: v0.11.4 + +Returns the ASN.1 encoded TLS session or `undefined` if no session was +negotiated. Can be used to speed up handshake establishment when reconnecting +to the server. + +### tlsSocket.getTLSTicket()[#](#tls_tlssocket_gettlsticket) + +Added in: v0.11.4 + +Returns the TLS session ticket or `undefined` if no session was negotiated. + +*Note*: This only works with client TLS sockets. Useful only for debugging, +for session reuse provide `session` option to [`tls.connect()`](#tls_tls_connect_options_callback). + +### tlsSocket.localAddress[#](#tls_tlssocket_localaddress) + +Added in: v0.11.4 + +Returns the string representation of the local IP address. + +### tlsSocket.localPort[#](#tls_tlssocket_localport) + +Added in: v0.11.4 + +Returns the numeric representation of the local port. + +### tlsSocket.remoteAddress[#](#tls_tlssocket_remoteaddress) + +Added in: v0.11.4 + +Returns the string representation of the remote IP address. For example, +`'74.125.127.100'` or `'2001:4860:a005::68'`. + +### tlsSocket.remoteFamily[#](#tls_tlssocket_remotefamily) + +Added in: v0.11.4 + +Returns the string representation of the remote IP family. `'IPv4'` or `'IPv6'`. + +### tlsSocket.remotePort[#](#tls_tlssocket_remoteport) + +Added in: v0.11.4 + +Returns the numeric representation of the remote port. For example, `443`. + +### tlsSocket.renegotiate(options, callback)[#](#tls_tlssocket_renegotiate_options_callback) + +Added in: v0.11.8 + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If not `false`, the server certificate is + verified against the list of supplied CAs. An `'error'` event is emitted if + verification fails; `err.code` contains the OpenSSL error code. **Default:** + `true`. + + `requestCert` +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A function that will be called when the renegotiation + request has been completed. + +The `tlsSocket.renegotiate()` method initiates a TLS renegotiation process. +Upon completion, the `callback` function will be passed a single argument +that is either an `Error` (if the request failed) or `null`. + +*Note*: This method can be used to request a peer's certificate after the +secure connection has been established. + +*Note*: When running as the server, the socket will be destroyed with an error +after `handshakeTimeout` timeout. + +### tlsSocket.setMaxSendFragment(size)[#](#tls_tlssocket_setmaxsendfragment_size) + +Added in: v0.11.11 + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The maximum TLS fragment size. The maximum value is `16384`. + **Default:** `16384`. + +The `tlsSocket.setMaxSendFragment()` method sets the maximum TLS fragment size. +Returns `true` if setting the limit succeeded; `false` otherwise. + +Smaller fragment sizes decrease the buffering latency on the client: larger +fragments are buffered by the TLS layer until the entire fragment is received +and its integrity is verified; large fragments can span multiple roundtrips +and their processing can be delayed due to packet loss or reordering. However, +smaller fragments add extra TLS framing bytes and CPU overhead, which may +decrease overall server throughput. + +## tls.checkServerIdentity(host, cert)[#](#tls_tls_checkserveridentity_host_cert) + +Added in: v0.8.4 + +* `host` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The hostname to verify the certificate against +* `cert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) An object representing the peer's certificate. The returned + object has some properties corresponding to the fields of the certificate. + +Verifies the certificate `cert` is issued to host `host`. + +Returns [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object, populating it with the reason, host, and cert on +failure. On success, returns [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type). + +*Note*: This function can be overwritten by providing alternative function +as part of the `options.checkServerIdentity` option passed to `tls.connect()`. +The overwriting function can call `tls.checkServerIdentity()` of course, to augment +the checks done with additional verification. + +*Note*: This function is only called if the certificate passed all other checks, such as +being issued by trusted CA (`options.ca`). + +The cert object contains the parsed certificate and will have a structure similar to: + +```None +{ subject: + { OU: [ 'Domain Control Validated', 'PositiveSSL Wildcard' ], + CN: '*.nodejs.org' }, + issuer: + { C: 'GB', + ST: 'Greater Manchester', + L: 'Salford', + O: 'COMODO CA Limited', + CN: 'COMODO RSA Domain Validation Secure Server CA' }, + subjectaltname: 'DNS:*.nodejs.org, DNS:nodejs.org', + infoAccess: + { 'CA Issuers - URI': + [ 'http://crt.comodoca.com/COMODORSADomainValidationSecureServerCA.crt' ], + 'OCSP - URI': [ 'http://ocsp.comodoca.com' ] }, + modulus: 'B56CE45CB740B09A13F64AC543B712FF9EE8E4C284B542A1708A27E82A8D151CA178153E12E6DDA15BF70FFD96CB8A88618641BDFCCA03527E665B70D779C8A349A6F88FD4EF6557180BD4C98192872BCFE3AF56E863C09DDD8BC1EC58DF9D94F914F0369102B2870BECFA1348A0838C9C49BD1C20124B442477572347047506B1FCD658A80D0C44BCC16BC5C5496CFE6E4A8428EF654CD3D8972BF6E5BFAD59C93006830B5EB1056BBB38B53D1464FA6E02BFDF2FF66CD949486F0775EC43034EC2602AEFBF1703AD221DAA2A88353C3B6A688EFE8387811F645CEED7B3FE46E1F8B9F59FAD028F349B9BC14211D5830994D055EEA3D547911E07A0ADDEB8A82B9188E58720D95CD478EEC9AF1F17BE8141BE80906F1A339445A7EB5B285F68039B0F294598A7D1C0005FC22B5271B0752F58CCDEF8C8FD856FB7AE21C80B8A2CE983AE94046E53EDE4CB89F42502D31B5360771C01C80155918637490550E3F555E2EE75CC8C636DDE3633CFEDD62E91BF0F7688273694EEEBA20C2FC9F14A2A435517BC1D7373922463409AB603295CEB0BB53787A334C9CA3CA8B30005C5A62FC0715083462E00719A8FA3ED0A9828C3871360A73F8B04A4FC1E71302844E9BB9940B77E745C9D91F226D71AFCAD4B113AAF68D92B24DDB4A2136B55A1CD1ADF39605B63CB639038ED0F4C987689866743A68769CC55847E4A06D6E2E3F1', + exponent: '0x10001', + valid_from: 'Aug 14 00:00:00 2017 GMT', + valid_to: 'Nov 20 23:59:59 2019 GMT', + fingerprint: '01:02:59:D9:C3:D2:0D:08:F7:82:4E:44:A4:B4:53:C5:E2:3A:87:4D', + ext_key_usage: [ '1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2' ], + serialNumber: '66593D57F20CBC573E433381B5FEC280', + raw: } +``` + +## tls.connect(options[, callback])[#](#tls_tls_connect_options_callback) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `lookup` option is supported now. | +| v8.0.0 | The `ALPNProtocols` and `NPNProtocols` options can be `Uint8Array`s now. | +| v5.3.0, v4.7.0 | The `secureContext` option is supported now. | +| v5.0.0 | ALPN options are supported now. | +| v0.11.3 | Added in: v0.11.3 | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `host` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Host the client should connect to. **Default:** + `'localhost'`. + + `port` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Port the client should connect to. + + `path` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Creates unix socket connection to path. If this option is + specified, `host` and `port` are ignored. + + `socket` [](stream.html#stream_class_stream_duplex) Establish secure connection on a given socket + rather than creating a new socket. Typically, this is an instance of + [`net.Socket`](net.html#net_class_net_socket), but any `Duplex` stream is allowed. + If this option is specified, `path`, `host` and `port` are ignored, + except for certificate validation. Usually, a socket is already connected + when passed to `tls.connect()`, but it can be connected later. Note that + connection/disconnection/destruction of `socket` is the user's + responsibility, calling `tls.connect()` will not cause `net.connect()` to be + called. + + `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If not `false`, the server certificate is + verified against the list of supplied CAs. An `'error'` event is emitted if + verification fails; `err.code` contains the OpenSSL error code. **Default:** + `true`. + + `NPNProtocols` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) + An array of strings, `Buffer`s or `Uint8Array`s, or a single `Buffer` or + `Uint8Array` containing supported NPN protocols. `Buffer`s should have the + format `[len][name][len][name]...` e.g. `0x05hello0x05world`, where the + first byte is the length of the next protocol name. Passing an array is + usually much simpler, e.g. `['hello', 'world']`. + + `ALPNProtocols`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) + An array of strings, `Buffer`s or `Uint8Array`s, or a single `Buffer` or + `Uint8Array` containing the supported ALPN protocols. `Buffer`s should have + the format `[len][name][len][name]...` e.g. `0x05hello0x05world`, where the + first byte is the length of the next protocol name. Passing an array is + usually much simpler, e.g. `['hello', 'world']`. + + `servername`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Server name for the SNI (Server Name Indication) TLS + extension. + + `checkServerIdentity(servername, cert)` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function + to be used (instead of the builtin `tls.checkServerIdentity()` function) + when checking the server's hostname (or the provided `servername` when + explicitly set) against the certificate. This should return an [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) if + verification fails. The method should return `undefined` if the `servername` + and `cert` are verified. + + `session` [](buffer.html#buffer_class_buffer) A `Buffer` instance, containing TLS session. + + `minDHSize` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Minimum size of the DH parameter in bits to accept a + TLS connection. When a server offers a DH parameter with a size less + than `minDHSize`, the TLS connection is destroyed and an error is thrown. + **Default:** `1024`. + + `secureContext`: Optional TLS context object created with + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). If a `secureContext` is *not* provided, one + will be created by passing the entire `options` object to + `tls.createSecureContext()`. + + `lookup`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Custom lookup function. **Default:** + [`dns.lookup()`](dns.html#dns_dns_lookup_hostname_options_callback). + + ...: Optional [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) options that are used if the + `secureContext` option is missing, otherwise they are ignored. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + +The `callback` function, if specified, will be added as a listener for the +[`'secureConnect'`](#tls_event_secureconnect) event. + +`tls.connect()` returns a [`tls.TLSSocket`](#tls_class_tls_tlssocket) object. + +The following implements a simple "echo server" example: + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + // Necessary only if using the client certificate authentication + key: fs.readFileSync('client-key.pem'), + cert: fs.readFileSync('client-cert.pem'), + + // Necessary only if the server uses the self-signed certificate + ca: [ fs.readFileSync('server-cert.pem') ] +}; + +const socket = tls.connect(8000, options, () => { + console.log('client connected', + socket.authorized ? 'authorized' : 'unauthorized'); + process.stdin.pipe(socket); + process.stdin.resume(); +}); +socket.setEncoding('utf8'); +socket.on('data', (data) => { + console.log(data); +}); +socket.on('end', () => { + server.close(); +}); +``` + +Or + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + pfx: fs.readFileSync('client.pfx') +}; + +const socket = tls.connect(8000, options, () => { + console.log('client connected', + socket.authorized ? 'authorized' : 'unauthorized'); + process.stdin.pipe(socket); + process.stdin.resume(); +}); +socket.setEncoding('utf8'); +socket.on('data', (data) => { + console.log(data); +}); +socket.on('end', () => { + server.close(); +}); +``` + +## tls.connect(path[, options][, callback])[#](#tls_tls_connect_path_options_callback) + +Added in: v0.11.3 + +* `path` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Default value for `options.path`. +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) See [`tls.connect()`](#tls_tls_connect_options_callback). +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) See [`tls.connect()`](#tls_tls_connect_options_callback). + +Same as [`tls.connect()`](#tls_tls_connect_options_callback) except that `path` can be provided +as an argument instead of an option. + +*Note*: A path option, if specified, will take precedence over the path +argument. + +## tls.connect(port[, host][, options][, callback])[#](#tls_tls_connect_port_host_options_callback) + +Added in: v0.11.3 + +* `port` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Default value for `options.port`. +* `host` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional default value for `options.host`. +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) See [`tls.connect()`](#tls_tls_connect_options_callback). +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) See [`tls.connect()`](#tls_tls_connect_options_callback). + +Same as [`tls.connect()`](#tls_tls_connect_options_callback) except that `port` and `host` can be provided +as arguments instead of options. + +*Note*: A port or host option, if specified, will take precedence over any +port or host argument. + +## tls.createSecureContext(options)[#](#tls_tls_createsecurecontext_options) + +History + +| Version | Changes | +| --- | --- | +| v7.3.0 | If the `key` option is an array, individual entries do not need a `passphrase` property anymore. Array entries can also just be `string`s or `Buffer`s now. | +| v5.2.0 | The `ca` option can now be a single string containing multiple CA certificates. | +| v0.11.13 | Added in: v0.11.13 | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `pfx` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Optional PFX or PKCS12 + encoded private key and certificate chain. `pfx` is an alternative to + providing `key` and `cert` individually. PFX is usually encrypted, if it is, + `passphrase` will be used to decrypt it. Multiple PFX can be provided either + as an array of unencrypted PFX buffers, or an array of objects in the form + `{buf: [, passphrase: ]}`. The object form can only + occur in an array. `object.passphrase` is optional. Encrypted PFX will be + decrypted with `object.passphrase` if provided, or `options.passphrase` if it is not. + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Optional private keys in + PEM format. PEM allows the option of private keys being encrypted. Encrypted + keys will be decrypted with `options.passphrase`. Multiple keys using + different algorithms can be provided either as an array of unencrypted key + strings or buffers, or an array of objects in the form `{pem: + [, passphrase: ]}`. The object form can only occur in + an array. `object.passphrase` is optional. Encrypted keys will be decrypted + with `object.passphrase` if provided, or `options.passphrase` if it is not. + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional shared passphrase used for a single private + key and/or a PFX. + + `cert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) Optional cert chains in PEM format. + One cert chain should be provided per private key. Each cert chain should + consist of the PEM formatted certificate for a provided private `key`, + followed by the PEM formatted intermediate certificates (if any), in order, + and not including the root CA (the root CA must be pre-known to the peer, + see `ca`). When providing multiple cert chains, they do not have to be in + the same order as their private keys in `key`. If the intermediate + certificates are not provided, the peer will not be able to validate the + certificate, and the handshake will fail. + + `ca` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) Optionally override the trusted CA + certificates. Default is to trust the well-known CAs curated by Mozilla. + Mozilla's CAs are completely replaced when CAs are explicitly specified + using this option. The value can be a string or Buffer, or an Array of + strings and/or Buffers. Any string or Buffer can contain multiple PEM CAs + concatenated together. The peer's certificate must be chainable to a CA + trusted by the server for the connection to be authenticated. When using + certificates that are not chainable to a well-known CA, the certificate's CA + must be explicitly specified as a trusted or the connection will fail to + authenticate. + If the peer uses a certificate that doesn't match or chain to one of the + default CAs, use the `ca` option to provide a CA certificate that the peer's + certificate can match or chain to. + For self-signed certificates, the certificate is its own CA, and must be + provided. + + `crl` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) Optional PEM formatted + CRLs (Certificate Revocation Lists). + + `ciphers` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional cipher suite specification, replacing the + default. For more information, see [modifying the default cipher suite](#tls_modifying_the_default_tls_cipher_suite). + + `honorCipherOrder` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Attempt to use the server's cipher suite + preferences instead of the client's. When `true`, causes + `SSL_OP_CIPHER_SERVER_PREFERENCE` to be set in `secureOptions`, see + [OpenSSL Options](crypto.html#crypto_openssl_options) for more information. + + `ecdhCurve` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A string describing a named curve or a colon separated + list of curve NIDs or names, for example `P-521:P-384:P-256`, to use for + ECDH key agreement, or `false` to disable ECDH. Set to `auto` to select the + curve automatically. Use [`crypto.getCurves()`](crypto.html#crypto_crypto_getcurves) to obtain a list of + available curve names. On recent releases, `openssl ecparam -list_curves` + will also display the name and description of each available elliptic curve. + **Default:** [`tls.DEFAULT_ECDH_CURVE`](#tls_tls_default_ecdh_curve). + + `dhparam` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) Diffie Hellman parameters, required for + [Perfect Forward Secrecy](#tls_perfect_forward_secrecy). Use `openssl dhparam` to create the parameters. + The key length must be greater than or equal to 1024 bits, otherwise an + error will be thrown. It is strongly recommended to use 2048 bits or larger + for stronger security. If omitted or invalid, the parameters are silently + discarded and DHE ciphers will not be available. + + `secureProtocol` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional SSL method to use, default is + `'SSLv23_method'`. The possible values are listed as [SSL\_METHODS](https://www.openssl.org/docs/man1.0.2/ssl/ssl.html#DEALING-WITH-PROTOCOL-METHODS), use + the function names as strings. For example, `'SSLv3_method'` to force SSL + version 3. + + `secureOptions` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Optionally affect the OpenSSL protocol behavior, + which is not usually necessary. This should be used carefully if at all! + Value is a numeric bitmask of the `SSL_OP_*` options from + [OpenSSL Options](crypto.html#crypto_openssl_options). + + `sessionIdContext` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional opaque identifier used by servers to + ensure session state is not shared between applications. Unused by clients. + +*Note*: + +* [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) sets the default value of the + `honorCipherOrder` option to `true`, other APIs that create secure contexts + leave it unset. +* [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) uses a 128 bit truncated SHA1 hash value + generated from `process.argv` as the default value of the `sessionIdContext` + option, other APIs that create secure contexts have no default value. + +The `tls.createSecureContext()` method creates a credentials object. + +A key is *required* for ciphers that make use of certificates. Either `key` or +`pfx` can be used to provide it. + +If the 'ca' option is not given, then Node.js will use the default +publicly trusted list of CAs as given in +. + +## tls.createServer([options][, secureConnectionListener])[#](#tls_tls_createserver_options_secureconnectionlistener) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `ALPNProtocols` and `NPNProtocols` options can be `Uint8Array`s now. | +| v5.0.0 | ALPN options are supported now. | +| v0.3.2 | Added in: v0.3.2 | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `handshakeTimeout` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Abort the connection if the SSL/TLS handshake + does not finish in the specified number of milliseconds. + A `'tlsClientError'` is emitted on the `tls.Server` object whenever + a handshake times out. **Default:** `120000` (120 seconds). + + `requestCert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true` the server will request a certificate from + clients that connect and attempt to verify that certificate. **Default:** + `false`. + + `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If not `false` the server will reject any + connection which is not authorized with the list of supplied CAs. This + option only has an effect if `requestCert` is `true`. **Default:** `true`. + + `NPNProtocols` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) + An array of strings, `Buffer`s or `Uint8Array`s, or a single `Buffer` or + `Uint8Array` containing supported NPN protocols. `Buffer`s should have the + format `[len][name][len][name]...` e.g. `0x05hello0x05world`, where the + first byte is the length of the next protocol name. Passing an array is + usually much simpler, e.g. `['hello', 'world']`. + (Protocols should be ordered by their priority.) + + `ALPNProtocols`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) + An array of strings, `Buffer`s or `Uint8Array`s, or a single `Buffer` or + `Uint8Array` containing the supported ALPN protocols. `Buffer`s should have + the format `[len][name][len][name]...` e.g. `0x05hello0x05world`, where the + first byte is the length of the next protocol name. Passing an array is + usually much simpler, e.g. `['hello', 'world']`. + (Protocols should be ordered by their priority.) + When the server receives both NPN and ALPN extensions from the client, + ALPN takes precedence over NPN and the server does not send an NPN + extension to the client. + + `SNICallback(servername, cb)` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A function that will be called if + the client supports SNI TLS extension. Two arguments will be passed when + called: `servername` and `cb`. `SNICallback` should invoke `cb(null, ctx)`, + where `ctx` is a SecureContext instance. (`tls.createSecureContext(...)` can + be used to get a proper SecureContext.) If `SNICallback` wasn't provided the + default callback with high-level API will be used (see below). + + `sessionTimeout` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) An integer specifying the number of seconds after + which the TLS session identifiers and TLS session tickets created by the + server will time out. See [SSL\_CTX\_set\_timeout](https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_timeout.html) for more details. + + `ticketKeys`: A 48-byte `Buffer` instance consisting of a 16-byte prefix, + a 16-byte HMAC key, and a 16-byte AES key. This can be used to accept TLS + session tickets on multiple instances of the TLS server. + + ...: Any [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) options can be provided. For + servers, the identity options (`pfx` or `key`/`cert`) are usually required. +* `secureConnectionListener` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + +Creates a new [tls.Server](#tls_class_tls_server). The `secureConnectionListener`, if provided, is +automatically set as a listener for the [`'secureConnection'`](#tls_event_secureconnection) event. + +*Note*: The `ticketKeys` options is automatically shared between `cluster` +module workers. + +The following illustrates a simple echo server: + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + key: fs.readFileSync('server-key.pem'), + cert: fs.readFileSync('server-cert.pem'), + + // This is necessary only if using the client certificate authentication. + requestCert: true, + + // This is necessary only if the client uses the self-signed certificate. + ca: [ fs.readFileSync('client-cert.pem') ] +}; + +const server = tls.createServer(options, (socket) => { + console.log('server connected', + socket.authorized ? 'authorized' : 'unauthorized'); + socket.write('welcome!\n'); + socket.setEncoding('utf8'); + socket.pipe(socket); +}); +server.listen(8000, () => { + console.log('server bound'); +}); +``` + +Or + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + pfx: fs.readFileSync('server.pfx'), + + // This is necessary only if using the client certificate authentication. + requestCert: true, + +}; + +const server = tls.createServer(options, (socket) => { + console.log('server connected', + socket.authorized ? 'authorized' : 'unauthorized'); + socket.write('welcome!\n'); + socket.setEncoding('utf8'); + socket.pipe(socket); +}); +server.listen(8000, () => { + console.log('server bound'); +}); +``` + +This server can be tested by connecting to it using `openssl s_client`: + +```None +openssl s_client -connect 127.0.0.1:8000 +``` + +## tls.getCiphers()[#](#tls_tls_getciphers) + +Added in: v0.10.2 + +Returns an array with the names of the supported SSL ciphers. + +For example: + +```None +console.log(tls.getCiphers()); // ['AES128-SHA', 'AES256-SHA', ...] +``` + +## tls.DEFAULT\_ECDH\_CURVE[#](#tls_tls_default_ecdh_curve) + +Added in: v0.11.13 + +The default curve name to use for ECDH key agreement in a tls server. The +default value is `'prime256v1'` (NIST P-256). Consult [RFC 4492](https://www.rfc-editor.org/rfc/rfc4492.txt) and +[FIPS.186-4](http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf) for more details. + +## Deprecated APIs[#](#tls_deprecated_apis) + +### Class: CryptoStream[#](#tls_class_cryptostream) + +Added in: v0.3.4Deprecated since: v0.11.3 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`tls.TLSSocket`](#tls_class_tls_tlssocket) instead. + +The `tls.CryptoStream` class represents a stream of encrypted data. This class +has been deprecated and should no longer be used. + +#### cryptoStream.bytesWritten[#](#tls_cryptostream_byteswritten) + +Added in: v0.3.4Deprecated since: v0.11.3 + +The `cryptoStream.bytesWritten` property returns the total number of bytes +written to the underlying socket *including* the bytes required for the +implementation of the TLS protocol. + +### Class: SecurePair[#](#tls_class_securepair) + +Added in: v0.3.2Deprecated since: v0.11.3 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`tls.TLSSocket`](#tls_class_tls_tlssocket) instead. + +Returned by [`tls.createSecurePair()`](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options). + +#### Event: 'secure'[#](#tls_event_secure) + +Added in: v0.3.2Deprecated since: v0.11.3 + +The `'secure'` event is emitted by the `SecurePair` object once a secure +connection has been established. + +As with checking for the server [`secureConnection`](#tls_event_secureconnection) +event, `pair.cleartext.authorized` should be inspected to confirm whether the +certificate used is properly authorized. + +### tls.createSecurePair([context][, isServer][, requestCert][, rejectUnauthorized][, options])[#](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options) + +History + +| Version | Changes | +| --- | --- | +| v5.0.0 | ALPN options are supported now. | +| v0.11.3 | Deprecated since: v0.11.3 | +| v0.3.2 | Added in: v0.3.2 | + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`tls.TLSSocket`](#tls_class_tls_tlssocket) instead. + +* `context` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) A secure context object as returned by + `tls.createSecureContext()` +* `isServer` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` to specify that this TLS connection should be + opened as a server. +* `requestCert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` to specify whether a server should request a + certificate from a connecting client. Only applies when `isServer` is `true`. +* `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If not `false` a server automatically reject clients + with invalid certificates. Only applies when `isServer` is `true`. +* `options` + + `secureContext`: An optional TLS context object from + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) + + `isServer`: If `true` the TLS socket will be instantiated in server-mode. + **Default:** `false`. + + `server` [](net.html#net_class_net_server) An optional [`net.Server`](net.html#net_class_net_server) instance + + `requestCert`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `rejectUnauthorized`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `NPNProtocols`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `ALPNProtocols`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `SNICallback`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `session` [](buffer.html#buffer_class_buffer) An optional `Buffer` instance containing a TLS session. + + `requestOCSP` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true`, specifies that the OCSP status request + extension will be added to the client hello and an `'OCSPResponse'` event + will be emitted on the socket before establishing a secure communication + +Creates a new secure pair object with two streams, one of which reads and writes +the encrypted data and the other of which reads and writes the cleartext data. +Generally, the encrypted stream is piped to/from an incoming encrypted data +stream and the cleartext one is used as a replacement for the initial encrypted +stream. + +`tls.createSecurePair()` returns a `tls.SecurePair` object with `cleartext` and +`encrypted` stream properties. + +*Note*: `cleartext` has the same API as [`tls.TLSSocket`](#tls_class_tls_tlssocket). + +*Note*: The `tls.createSecurePair()` method is now deprecated in favor of +`tls.TLSSocket()`. For example, the code: + +```None +pair = tls.createSecurePair(/* ... */); +pair.encrypted.pipe(socket); +socket.pipe(pair.encrypted); +``` + +can be replaced by: + +```None +secure_socket = tls.TLSSocket(socket, options); +``` + +where `secure_socket` has the same API as `pair.cleartext`. diff --git a/corpus/docs/nodejs/tls/tls_9x.md b/corpus/docs/nodejs/tls/tls_9x.md new file mode 100644 index 0000000000000000000000000000000000000000..e2a70df75ebde1681d6148aa546da360b5e31123 --- /dev/null +++ b/corpus/docs/nodejs/tls/tls_9x.md @@ -0,0 +1,1293 @@ +# TLS (SSL)# + +Source: https://nodejs.org/docs/latest-v9.x/api/tls.html +Version: 9.x + +[Stability: 2](documentation.html#documentation_stability_index) - Stable + +The `tls` module provides an implementation of the Transport Layer Security +(TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL. +The module can be accessed using: + +```None +const tls = require('tls'); +``` + +## TLS/SSL Concepts[#](#tls_tls_ssl_concepts) + +The TLS/SSL is a public/private key infrastructure (PKI). For most common +cases, each client and server must have a *private key*. + +Private keys can be generated in multiple ways. The example below illustrates +use of the OpenSSL command-line interface to generate a 2048-bit RSA private +key: + +```None +openssl genrsa -out ryans-key.pem 2048 +``` + +With TLS/SSL, all servers (and some clients) must have a *certificate*. +Certificates are *public keys* that correspond to a private key, and that are +digitally signed either by a Certificate Authority or by the owner of the +private key (such certificates are referred to as "self-signed"). The first +step to obtaining a certificate is to create a *Certificate Signing Request* +(CSR) file. + +The OpenSSL command-line interface can be used to generate a CSR for a private +key: + +```None +openssl req -new -sha256 -key ryans-key.pem -out ryans-csr.pem +``` + +Once the CSR file is generated, it can either be sent to a Certificate +Authority for signing or used to generate a self-signed certificate. + +Creating a self-signed certificate using the OpenSSL command-line interface +is illustrated in the example below: + +```None +openssl x509 -req -in ryans-csr.pem -signkey ryans-key.pem -out ryans-cert.pem +``` + +Once the certificate is generated, it can be used to generate a `.pfx` or +`.p12` file: + +```None +openssl pkcs12 -export -in ryans-cert.pem -inkey ryans-key.pem \ + -certfile ca-cert.pem -out ryans.pfx +``` + +Where: + +* `in`: is the signed certificate +* `inkey`: is the associated private key +* `certfile`: is a concatenation of all Certificate Authority (CA) certs into + a single file, e.g. `cat ca1-cert.pem ca2-cert.pem > ca-cert.pem` + +### Perfect Forward Secrecy[#](#tls_perfect_forward_secrecy) + +The term "[Forward Secrecy](https://en.wikipedia.org/wiki/Perfect_forward_secrecy)" or "Perfect Forward Secrecy" describes a feature of +key-agreement (i.e., key-exchange) methods. That is, the server and client keys +are used to negotiate new temporary keys that are used specifically and only for +the current communication session. Practically, this means that even if the +server's private key is compromised, communication can only be decrypted by +eavesdroppers if the attacker manages to obtain the key-pair specifically +generated for the session. + +Perfect Forward Secrecy is achieved by randomly generating a key pair for +key-agreement on every TLS/SSL handshake (in contrast to using the same key for +all sessions). Methods implementing this technique are called "ephemeral". + +Currently two methods are commonly used to achieve Perfect Forward Secrecy (note +the character "E" appended to the traditional abbreviations): + +* [DHE](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange) - An ephemeral version of the Diffie Hellman key-agreement protocol. +* [ECDHE](https://en.wikipedia.org/wiki/Elliptic_curve_Diffie%E2%80%93Hellman) - An ephemeral version of the Elliptic Curve Diffie Hellman + key-agreement protocol. + +Ephemeral methods may have some performance drawbacks, because key generation +is expensive. + +To use Perfect Forward Secrecy using `DHE` with the `tls` module, it is required +to generate Diffie-Hellman parameters and specify them with the `dhparam` +option to [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). The following illustrates the use of +the OpenSSL command-line interface to generate such parameters: + +```None +openssl dhparam -outform PEM -out dhparam.pem 2048 +``` + +If using Perfect Forward Secrecy using `ECDHE`, Diffie-Hellman parameters are +not required and a default ECDHE curve will be used. The `ecdhCurve` property +can be used when creating a TLS Server to specify the list of names of supported +curves to use, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) for more info. + +### ALPN, NPN, and SNI[#](#tls_alpn_npn_and_sni) + +ALPN (Application-Layer Protocol Negotiation Extension), NPN (Next +Protocol Negotiation) and, SNI (Server Name Indication) are TLS +handshake extensions: + +* ALPN/NPN - Allows the use of one TLS server for multiple protocols (HTTP, + SPDY, HTTP/2) +* SNI - Allows the use of one TLS server for multiple hostnames with different + SSL certificates. + +Use of ALPN is recommended over NPN. The NPN extension has never been +formally defined or documented and generally not recommended for use. + +### Client-initiated renegotiation attack mitigation[#](#tls_client_initiated_renegotiation_attack_mitigation) + +The TLS protocol allows clients to renegotiate certain aspects of the TLS +session. Unfortunately, session renegotiation requires a disproportionate amount +of server-side resources, making it a potential vector for denial-of-service +attacks. + +To mitigate the risk, renegotiation is limited to three times every ten minutes. +An `'error'` event is emitted on the [`tls.TLSSocket`](#tls_class_tls_tlssocket) instance when this +threshold is exceeded. The limits are configurable: + +* `tls.CLIENT_RENEG_LIMIT` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Specifies the number of renegotiation + requests. Defaults to `3`. +* `tls.CLIENT_RENEG_WINDOW` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Specifies the time renegotiation window + in seconds. Defaults to `600` (10 minutes). + +The default renegotiation limits should not be modified without a full +understanding of the implications and risks. + +To test the renegotiation limits on a server, connect to it using the OpenSSL +command-line client (`openssl s_client -connect address:port`) then input +`R` (i.e., the letter `R` followed by a carriage return) multiple times. + +## Modifying the Default TLS Cipher suite[#](#tls_modifying_the_default_tls_cipher_suite) + +Node.js is built with a default suite of enabled and disabled TLS ciphers. +Currently, the default cipher suite is: + +```None +ECDHE-RSA-AES128-GCM-SHA256: +ECDHE-ECDSA-AES128-GCM-SHA256: +ECDHE-RSA-AES256-GCM-SHA384: +ECDHE-ECDSA-AES256-GCM-SHA384: +DHE-RSA-AES128-GCM-SHA256: +ECDHE-RSA-AES128-SHA256: +DHE-RSA-AES128-SHA256: +ECDHE-RSA-AES256-SHA384: +DHE-RSA-AES256-SHA384: +ECDHE-RSA-AES256-SHA256: +DHE-RSA-AES256-SHA256: +HIGH: +!aNULL: +!eNULL: +!EXPORT: +!DES: +!RC4: +!MD5: +!PSK: +!SRP: +!CAMELLIA +``` + +This default can be replaced entirely using the `--tls-cipher-list` command +line switch. For instance, the following makes +`ECDHE-RSA-AES128-GCM-SHA256:!RC4` the default TLS cipher suite: + +```None +node --tls-cipher-list="ECDHE-RSA-AES128-GCM-SHA256:!RC4" +``` + +The default can also be replaced on a per client or server basis using the +`ciphers` option from [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options), which is also available +in [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener), [`tls.connect()`](#tls_tls_connect_options_callback), and when creating new +[`tls.TLSSocket`](#tls_class_tls_tlssocket)s. + +Consult [OpenSSL cipher list format documentation](https://www.openssl.org/docs/man1.0.2/apps/ciphers.html#CIPHER-LIST-FORMAT) for details on the format. + +The default cipher suite included within Node.js has been carefully +selected to reflect current security best practices and risk mitigation. +Changing the default cipher suite can have a significant impact on the security +of an application. The `--tls-cipher-list` switch and `ciphers` option should by +used only if absolutely necessary. + +The default cipher suite prefers GCM ciphers for [Chrome's 'modern +cryptography' setting](https://www.chromium.org/Home/chromium-security/education/tls#TOC-Cipher-Suites) and also prefers ECDHE and DHE ciphers for Perfect +Forward Secrecy, while offering *some* backward compatibility. + +128 bit AES is preferred over 192 and 256 bit AES in light of [specific +attacks affecting larger AES key sizes](https://www.schneier.com/blog/archives/2009/07/another_new_aes.html). + +Old clients that rely on insecure and deprecated RC4 or DES-based ciphers +(like Internet Explorer 6) cannot complete the handshaking process with +the default configuration. If these clients *must* be supported, the +[TLS recommendations](https://wiki.mozilla.org/Security/Server_Side_TLS) may offer a compatible cipher suite. For more details +on the format, see the [OpenSSL cipher list format documentation](https://www.openssl.org/docs/man1.0.2/apps/ciphers.html#CIPHER-LIST-FORMAT). + +## Class: tls.Server[#](#tls_class_tls_server) + +Added in: v0.3.2 + +The `tls.Server` class is a subclass of `net.Server` that accepts encrypted +connections using TLS or SSL. + +### Event: 'newSession'[#](#tls_event_newsession) + +Added in: v0.9.2 + +The `'newSession'` event is emitted upon creation of a new TLS session. This may +be used to store sessions in external storage. The listener callback is passed +three arguments when called: + +* `sessionId` - The TLS session identifier +* `sessionData` - The TLS session data +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function taking no arguments that must be + invoked in order for data to be sent or received over the secure connection. + +Listening for this event will have an effect only on connections established +after the addition of the event listener. + +### Event: 'OCSPRequest'[#](#tls_event_ocsprequest) + +Added in: v0.11.13 + +The `'OCSPRequest'` event is emitted when the client sends a certificate status +request. The listener callback is passed three arguments when called: + +* `certificate` [](buffer.html#buffer_class_buffer) The server certificate +* `issuer` [](buffer.html#buffer_class_buffer) The issuer's certificate +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function that must be invoked to provide + the results of the OCSP request. + +The server's current certificate can be parsed to obtain the OCSP URL +and certificate ID; after obtaining an OCSP response, `callback(null, resp)` is +then invoked, where `resp` is a `Buffer` instance containing the OCSP response. +Both `certificate` and `issuer` are `Buffer` DER-representations of the +primary and issuer's certificates. These can be used to obtain the OCSP +certificate ID and OCSP endpoint URL. + +Alternatively, `callback(null, null)` may be called, indicating that there was +no OCSP response. + +Calling `callback(err)` will result in a `socket.destroy(err)` call. + +The typical flow of an OCSP Request is as follows: + +1. Client connects to the server and sends an `'OCSPRequest'` (via the status + info extension in ClientHello). +2. Server receives the request and emits the `'OCSPRequest'` event, calling the + listener if registered. +3. Server extracts the OCSP URL from either the `certificate` or `issuer` and + performs an [OCSP request](https://en.wikipedia.org/wiki/OCSP_stapling) to the CA. +4. Server receives `OCSPResponse` from the CA and sends it back to the client + via the `callback` argument +5. Client validates the response and either destroys the socket or performs a + handshake. + +The `issuer` can be `null` if the certificate is either self-signed or the +issuer is not in the root certificates list. (An issuer may be provided +via the `ca` option when establishing the TLS connection.) + +Listening for this event will have an effect only on connections established +after the addition of the event listener. + +An npm module like [asn1.js](https://npmjs.org/package/asn1.js) may be used to parse the certificates. + +### Event: 'resumeSession'[#](#tls_event_resumesession) + +Added in: v0.9.2 + +The `'resumeSession'` event is emitted when the client requests to resume a +previous TLS session. The listener callback is passed two arguments when +called: + +* `sessionId` - The TLS/SSL session identifier +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function to be called when the prior session + has been recovered. + +When called, the event listener may perform a lookup in external storage using +the given `sessionId` and invoke `callback(null, sessionData)` once finished. If +the session cannot be resumed (i.e., doesn't exist in storage) the callback may +be invoked as `callback(null, null)`. Calling `callback(err)` will terminate the +incoming connection and destroy the socket. + +Listening for this event will have an effect only on connections established +after the addition of the event listener. + +The following illustrates resuming a TLS session: + +```None +const tlsSessionStore = {}; +server.on('newSession', (id, data, cb) => { + tlsSessionStore[id.toString('hex')] = data; + cb(); +}); +server.on('resumeSession', (id, cb) => { + cb(null, tlsSessionStore[id.toString('hex')] || null); +}); +``` + +### Event: 'secureConnection'[#](#tls_event_secureconnection) + +Added in: v0.3.2 + +The `'secureConnection'` event is emitted after the handshaking process for a +new connection has successfully completed. The listener callback is passed a +single argument when called: + +* `tlsSocket` [](tls.html#tls_class_tls_tlssocket) The established TLS socket. + +The `tlsSocket.authorized` property is a `boolean` indicating whether the +client has been verified by one of the supplied Certificate Authorities for the +server. If `tlsSocket.authorized` is `false`, then `socket.authorizationError` +is set to describe how authorization failed. Note that depending on the settings +of the TLS server, unauthorized connections may still be accepted. + +The `tlsSocket.npnProtocol` and `tlsSocket.alpnProtocol` properties are strings +that contain the selected NPN and ALPN protocols, respectively. When both NPN +and ALPN extensions are received, ALPN takes precedence over NPN and the next +protocol is selected by ALPN. + +When ALPN has no selected protocol, `tlsSocket.alpnProtocol` returns `false`. + +The `tlsSocket.servername` property is a string containing the server name +requested via SNI. + +### Event: 'tlsClientError'[#](#tls_event_tlsclienterror) + +Added in: v6.0.0 + +The `'tlsClientError'` event is emitted when an error occurs before a secure +connection is established. The listener callback is passed two arguments when +called: + +* `exception` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) The `Error` object describing the error +* `tlsSocket` [](tls.html#tls_class_tls_tlssocket) The `tls.TLSSocket` instance from which the + error originated. + +### server.addContext(hostname, context)[#](#tls_server_addcontext_hostname_context) + +Added in: v0.5.3 + +* `hostname` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A SNI hostname or wildcard (e.g. `'*'`) +* `context` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) An object containing any of the possible properties + from the [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) `options` arguments (e.g. `key`, + `cert`, `ca`, etc). + +The `server.addContext()` method adds a secure context that will be used if +the client request's SNI hostname matches the supplied `hostname` (or wildcard). + +### server.address()[#](#tls_server_address) + +Added in: v0.6.0 + +Returns the bound address, the address family name, and port of the +server as reported by the operating system. See [`net.Server.address()`](net.html#net_server_address) for +more information. + +### server.close([callback])[#](#tls_server_close_callback) + +Added in: v0.3.2 + +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) An optional listener callback that will be registered to + listen for the server instance's `'close'` event. + +The `server.close()` method stops the server from accepting new connections. + +This function operates asynchronously. The `'close'` event will be emitted +when the server has no more open connections. + +### server.connections[#](#tls_server_connections) + +Added in: v0.3.2Deprecated since: v0.9.7 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`server.getConnections()`](net.html#net_server_getconnections_callback) instead. + +Returns the current number of concurrent connections on the server. + +### server.getTicketKeys()[#](#tls_server_getticketkeys) + +Added in: v3.0.0 + +Returns a `Buffer` instance holding the keys currently used for +encryption/decryption of the [TLS Session Tickets](https://www.ietf.org/rfc/rfc5077.txt) + +### server.listen()[#](#tls_server_listen) + +Starts the server listening for encrypted connections. +This method is identical to [`server.listen()`](net.html#net_server_listen) from [`net.Server`](net.html#net_class_net_server). + +### server.setTicketKeys(keys)[#](#tls_server_setticketkeys_keys) + +Added in: v3.0.0 + +* `keys` [](buffer.html#buffer_class_buffer) The keys used for encryption/decryption of the + [TLS Session Tickets](https://www.ietf.org/rfc/rfc5077.txt). + +Updates the keys for encryption/decryption of the [TLS Session Tickets](https://www.ietf.org/rfc/rfc5077.txt). + +The key's `Buffer` should be 48 bytes long. See `ticketKeys` option in +[tls.createServer](#tls_tls_createserver_options_secureconnectionlistener) for +more information on how it is used. + +Changes to the ticket keys are effective only for future server connections. +Existing or currently pending server connections will use the previous keys. + +## Class: tls.TLSSocket[#](#tls_class_tls_tlssocket) + +Added in: v0.11.4 + +The `tls.TLSSocket` is a subclass of [`net.Socket`](net.html#net_class_net_socket) that performs transparent +encryption of written data and all required TLS negotiation. + +Instances of `tls.TLSSocket` implement the duplex [Stream](stream.html#stream_stream) interface. + +Methods that return TLS connection metadata (e.g. +[`tls.TLSSocket.getPeerCertificate()`](#tls_tlssocket_getpeercertificate_detailed) will only return data while the +connection is open. + +### new tls.TLSSocket(socket[, options])[#](#tls_new_tls_tlssocket_socket_options) + +History + +| Version | Changes | +| --- | --- | +| v5.0.0 | ALPN options are supported now. | +| v0.11.4 | Added in: v0.11.4 | + +* `socket` [](net.html#net_class_net_socket) | [](stream.html#stream_class_stream_duplex) + On the server side, any `Duplex` stream. On the client side, any + instance of [`net.Socket`](net.html#net_class_net_socket) (for generic `Duplex` stream support + on the client side, [`tls.connect()`](#tls_tls_connect_options_callback) must be used). +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `isServer`: The SSL/TLS protocol is asymmetrical, TLSSockets must know if + they are to behave as a server or a client. If `true` the TLS socket will be + instantiated as a server. Defaults to `false`. + + `server` [](net.html#net_class_net_server) An optional [`net.Server`](net.html#net_class_net_server) instance. + + `requestCert`: Whether to authenticate the remote peer by requesting a + certificate. Clients always request a server certificate. Servers + (`isServer` is true) may optionally set `requestCert` to true to request a + client certificate. + + `rejectUnauthorized`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `NPNProtocols`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `ALPNProtocols`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `SNICallback`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `session` [](buffer.html#buffer_class_buffer) An optional `Buffer` instance containing a TLS session. + + `requestOCSP` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true`, specifies that the OCSP status request + extension will be added to the client hello and an `'OCSPResponse'` event + will be emitted on the socket before establishing a secure communication + + `secureContext`: Optional TLS context object created with + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). If a `secureContext` is *not* provided, one + will be created by passing the entire `options` object to + `tls.createSecureContext()`. + + ...: Optional [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) options that are used if the + `secureContext` option is missing, otherwise they are ignored. + +Construct a new `tls.TLSSocket` object from an existing TCP socket. + +### Event: 'OCSPResponse'[#](#tls_event_ocspresponse) + +Added in: v0.11.13 + +The `'OCSPResponse'` event is emitted if the `requestOCSP` option was set +when the `tls.TLSSocket` was created and an OCSP response has been received. +The listener callback is passed a single argument when called: + +* `response` [](buffer.html#buffer_class_buffer) The server's OCSP response + +Typically, the `response` is a digitally signed object from the server's CA that +contains information about server's certificate revocation status. + +### Event: 'secureConnect'[#](#tls_event_secureconnect) + +Added in: v0.11.4 + +The `'secureConnect'` event is emitted after the handshaking process for a new +connection has successfully completed. The listener callback will be called +regardless of whether or not the server's certificate has been authorized. It +is the client's responsibility to check the `tlsSocket.authorized` property to +determine if the server certificate was signed by one of the specified CAs. If +`tlsSocket.authorized === false`, then the error can be found by examining the +`tlsSocket.authorizationError` property. If either ALPN or NPN was used, +the `tlsSocket.alpnProtocol` or `tlsSocket.npnProtocol` properties can be +checked to determine the negotiated protocol. + +### tlsSocket.address()[#](#tls_tlssocket_address) + +Added in: v0.11.4 + +Returns the bound address, the address family name, and port of the +underlying socket as reported by the operating system. Returns an +object with three properties, e.g. +`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` + +### tlsSocket.authorizationError[#](#tls_tlssocket_authorizationerror) + +Added in: v0.11.4 + +Returns the reason why the peer's certificate was not been verified. This +property is set only when `tlsSocket.authorized === false`. + +### tlsSocket.authorized[#](#tls_tlssocket_authorized) + +Added in: v0.11.4 + +Returns `true` if the peer certificate was signed by one of the CAs specified +when creating the `tls.TLSSocket` instance, otherwise `false`. + +### tlsSocket.disableRenegotiation()[#](#tls_tlssocket_disablerenegotiation) + +Added in: v8.4.0 + +Disables TLS renegotiation for this `TLSSocket` instance. Once called, attempts +to renegotiate will trigger an `'error'` event on the `TLSSocket`. + +### tlsSocket.encrypted[#](#tls_tlssocket_encrypted) + +Added in: v0.11.4 + +Always returns `true`. This may be used to distinguish TLS sockets from regular +`net.Socket` instances. + +### tlsSocket.getCipher()[#](#tls_tlssocket_getcipher) + +Added in: v0.11.4 + +Returns an object representing the cipher name. The `version` key is a legacy +field which always contains the value `'TLSv1/SSLv3'`. + +For example: `{ name: 'AES256-SHA', version: 'TLSv1/SSLv3' }` + +See `SSL_CIPHER_get_name()` in + for more +information. + +### tlsSocket.getEphemeralKeyInfo()[#](#tls_tlssocket_getephemeralkeyinfo) + +Added in: v5.0.0 + +Returns an object representing the type, name, and size of parameter of +an ephemeral key exchange in [Perfect Forward Secrecy](#tls_perfect_forward_secrecy) on a client +connection. It returns an empty object when the key exchange is not +ephemeral. As this is only supported on a client socket; `null` is returned +if called on a server socket. The supported types are `'DH'` and `'ECDH'`. The +`name` property is available only when type is 'ECDH'. + +For Example: `{ type: 'ECDH', name: 'prime256v1', size: 256 }` + +### tlsSocket.getFinished()[#](#tls_tlssocket_getfinished) + +Added in: v9.9.0 + +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type) The latest `Finished` message that has been + sent to the socket as part of a SSL/TLS handshake, or `undefined` if + no `Finished` message has been sent yet. + +As the `Finished` messages are message digests of the complete handshake +(with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can +be used for external authentication procedures when the authentication +provided by SSL/TLS is not desired or is not enough. + +Corresponds to the `SSL_get_finished` routine in OpenSSL and may be used +to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929). + +### tlsSocket.getPeerCertificate([detailed])[#](#tls_tlssocket_getpeercertificate_detailed) + +Added in: v0.11.4 + +* `detailed` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Include the full certificate chain if `true`, otherwise + include just the peer's certificate. + +Returns an object representing the peer's certificate. The returned object has +some properties corresponding to the fields of the certificate. + +If the full certificate chain was requested, each certificate will include a +`issuerCertificate` property containing an object representing its issuer's +certificate. + +For example: + +```None +{ subject: + { C: 'UK', + ST: 'Acknack Ltd', + L: 'Rhys Jones', + O: 'node.js', + OU: 'Test TLS Certificate', + CN: 'localhost' }, + issuer: + { C: 'UK', + ST: 'Acknack Ltd', + L: 'Rhys Jones', + O: 'node.js', + OU: 'Test TLS Certificate', + CN: 'localhost' }, + issuerCertificate: + { ... another certificate, possibly with a .issuerCertificate ... }, + raw: < RAW DER buffer >, + pubkey: < RAW DER buffer >, + valid_from: 'Nov 11 09:52:22 2009 GMT', + valid_to: 'Nov 6 09:52:22 2029 GMT', + fingerprint: '2A:7A:C2:DD:E5:F9:CC:53:72:35:99:7A:02:5A:71:38:52:EC:8A:DF', + fingerprint256: '2A:7A:C2:DD:E5:F9:CC:53:72:35:99:7A:02:5A:71:38:52:EC:8A:DF:00:11:22:33:44:55:66:77:88:99:AA:BB', + serialNumber: 'B9B0D332A1AA5635' } +``` + +If the peer does not provide a certificate, an empty object will be returned. + +### tlsSocket.getPeerFinished()[#](#tls_tlssocket_getpeerfinished) + +Added in: v9.9.0 + +* Returns: [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type) The latest `Finished` message that is expected + or has actually been received from the socket as part of a SSL/TLS handshake, + or `undefined` if there is no `Finished` message so far. + +As the `Finished` messages are message digests of the complete handshake +(with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can +be used for external authentication procedures when the authentication +provided by SSL/TLS is not desired or is not enough. + +Corresponds to the `SSL_get_peer_finished` routine in OpenSSL and may be used +to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929). + +### tlsSocket.getProtocol()[#](#tls_tlssocket_getprotocol) + +Added in: v5.7.0 + +Returns a string containing the negotiated SSL/TLS protocol version of the +current connection. The value `'unknown'` will be returned for connected +sockets that have not completed the handshaking process. The value `null` will +be returned for server sockets or disconnected client sockets. + +Example responses include: + +* `SSLv3` +* `TLSv1` +* `TLSv1.1` +* `TLSv1.2` +* `unknown` + +See for more +information. + +### tlsSocket.getSession()[#](#tls_tlssocket_getsession) + +Added in: v0.11.4 + +Returns the ASN.1 encoded TLS session or `undefined` if no session was +negotiated. Can be used to speed up handshake establishment when reconnecting +to the server. + +### tlsSocket.getTLSTicket()[#](#tls_tlssocket_gettlsticket) + +Added in: v0.11.4 + +Returns the TLS session ticket or `undefined` if no session was negotiated. + +This only works with client TLS sockets. Useful only for debugging, for session +reuse provide `session` option to [`tls.connect()`](#tls_tls_connect_options_callback). + +### tlsSocket.localAddress[#](#tls_tlssocket_localaddress) + +Added in: v0.11.4 + +Returns the string representation of the local IP address. + +### tlsSocket.localPort[#](#tls_tlssocket_localport) + +Added in: v0.11.4 + +Returns the numeric representation of the local port. + +### tlsSocket.remoteAddress[#](#tls_tlssocket_remoteaddress) + +Added in: v0.11.4 + +Returns the string representation of the remote IP address. For example, +`'74.125.127.100'` or `'2001:4860:a005::68'`. + +### tlsSocket.remoteFamily[#](#tls_tlssocket_remotefamily) + +Added in: v0.11.4 + +Returns the string representation of the remote IP family. `'IPv4'` or `'IPv6'`. + +### tlsSocket.remotePort[#](#tls_tlssocket_remoteport) + +Added in: v0.11.4 + +Returns the numeric representation of the remote port. For example, `443`. + +### tlsSocket.renegotiate(options, callback)[#](#tls_tlssocket_renegotiate_options_callback) + +Added in: v0.11.8 + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If not `false`, the server certificate is + verified against the list of supplied CAs. An `'error'` event is emitted if + verification fails; `err.code` contains the OpenSSL error code. Defaults to + `true`. + + `requestCert` +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A function that will be called when the renegotiation + request has been completed. + +The `tlsSocket.renegotiate()` method initiates a TLS renegotiation process. +Upon completion, the `callback` function will be passed a single argument +that is either an `Error` (if the request failed) or `null`. + +This method can be used to request a peer's certificate after the secure +connection has been established. + +When running as the server, the socket will be destroyed with an error after +`handshakeTimeout` timeout. + +### tlsSocket.setMaxSendFragment(size)[#](#tls_tlssocket_setmaxsendfragment_size) + +Added in: v0.11.11 + +* `size` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The maximum TLS fragment size. Defaults to `16384`. The + maximum value is `16384`. + +The `tlsSocket.setMaxSendFragment()` method sets the maximum TLS fragment size. +Returns `true` if setting the limit succeeded; `false` otherwise. + +Smaller fragment sizes decrease the buffering latency on the client: larger +fragments are buffered by the TLS layer until the entire fragment is received +and its integrity is verified; large fragments can span multiple roundtrips +and their processing can be delayed due to packet loss or reordering. However, +smaller fragments add extra TLS framing bytes and CPU overhead, which may +decrease overall server throughput. + +## tls.checkServerIdentity(host, cert)[#](#tls_tls_checkserveridentity_host_cert) + +Added in: v0.8.4 + +* `host` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The hostname to verify the certificate against +* `cert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) An object representing the peer's certificate. The returned + object has some properties corresponding to the fields of the certificate. + +Verifies the certificate `cert` is issued to host `host`. + +Returns [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object, populating it with the reason, host, and cert on +failure. On success, returns [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type). + +This function can be overwritten by providing alternative function as part of +the `options.checkServerIdentity` option passed to `tls.connect()`. The +overwriting function can call `tls.checkServerIdentity()` of course, to augment +the checks done with additional verification. + +This function is only called if the certificate passed all other checks, such as +being issued by trusted CA (`options.ca`). + +The cert object contains the parsed certificate and will have a structure +similar to: + +```None +{ subject: + { OU: [ 'Domain Control Validated', 'PositiveSSL Wildcard' ], + CN: '*.nodejs.org' }, + issuer: + { C: 'GB', + ST: 'Greater Manchester', + L: 'Salford', + O: 'COMODO CA Limited', + CN: 'COMODO RSA Domain Validation Secure Server CA' }, + subjectaltname: 'DNS:*.nodejs.org, DNS:nodejs.org', + infoAccess: + { 'CA Issuers - URI': + [ 'http://crt.comodoca.com/COMODORSADomainValidationSecureServerCA.crt' ], + 'OCSP - URI': [ 'http://ocsp.comodoca.com' ] }, + modulus: 'B56CE45CB740B09A13F64AC543B712FF9EE8E4C284B542A1708A27E82A8D151CA178153E12E6DDA15BF70FFD96CB8A88618641BDFCCA03527E665B70D779C8A349A6F88FD4EF6557180BD4C98192872BCFE3AF56E863C09DDD8BC1EC58DF9D94F914F0369102B2870BECFA1348A0838C9C49BD1C20124B442477572347047506B1FCD658A80D0C44BCC16BC5C5496CFE6E4A8428EF654CD3D8972BF6E5BFAD59C93006830B5EB1056BBB38B53D1464FA6E02BFDF2FF66CD949486F0775EC43034EC2602AEFBF1703AD221DAA2A88353C3B6A688EFE8387811F645CEED7B3FE46E1F8B9F59FAD028F349B9BC14211D5830994D055EEA3D547911E07A0ADDEB8A82B9188E58720D95CD478EEC9AF1F17BE8141BE80906F1A339445A7EB5B285F68039B0F294598A7D1C0005FC22B5271B0752F58CCDEF8C8FD856FB7AE21C80B8A2CE983AE94046E53EDE4CB89F42502D31B5360771C01C80155918637490550E3F555E2EE75CC8C636DDE3633CFEDD62E91BF0F7688273694EEEBA20C2FC9F14A2A435517BC1D7373922463409AB603295CEB0BB53787A334C9CA3CA8B30005C5A62FC0715083462E00719A8FA3ED0A9828C3871360A73F8B04A4FC1E71302844E9BB9940B77E745C9D91F226D71AFCAD4B113AAF68D92B24DDB4A2136B55A1CD1ADF39605B63CB639038ED0F4C987689866743A68769CC55847E4A06D6E2E3F1', + exponent: '0x10001', + pubkey: , + valid_from: 'Aug 14 00:00:00 2017 GMT', + valid_to: 'Nov 20 23:59:59 2019 GMT', + fingerprint: '01:02:59:D9:C3:D2:0D:08:F7:82:4E:44:A4:B4:53:C5:E2:3A:87:4D', + fingerprint256: '69:AE:1A:6A:D4:3D:C6:C1:1B:EA:C6:23:DE:BA:2A:14:62:62:93:5C:7A:EA:06:41:9B:0B:BC:87:CE:48:4E:02', + ext_key_usage: [ '1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2' ], + serialNumber: '66593D57F20CBC573E433381B5FEC280', + raw: } +``` + +## tls.connect(options[, callback])[#](#tls_tls_connect_options_callback) + +History + +| Version | Changes | +| --- | --- | +| v8.0.0 | The `lookup` option is supported now. | +| v8.0.0 | The `ALPNProtocols` and `NPNProtocols` options can be `Uint8Array`s now. | +| v5.3.0, v4.7.0 | The `secureContext` option is supported now. | +| v5.0.0 | ALPN options are supported now. | +| v0.11.3 | Added in: v0.11.3 | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `host` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Host the client should connect to, defaults to 'localhost'. + + `port` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Port the client should connect to. + + `path` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Creates unix socket connection to path. If this option is + specified, `host` and `port` are ignored. + + `socket` [](stream.html#stream_class_stream_duplex) Establish secure connection on a given socket + rather than creating a new socket. Typically, this is an instance of + [`net.Socket`](net.html#net_class_net_socket), but any `Duplex` stream is allowed. + If this option is specified, `path`, `host` and `port` are ignored, + except for certificate validation. Usually, a socket is already connected + when passed to `tls.connect()`, but it can be connected later. Note that + connection/disconnection/destruction of `socket` is the user's + responsibility, calling `tls.connect()` will not cause `net.connect()` to be + called. + + `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If not `false`, the server certificate is + verified against the list of supplied CAs. An `'error'` event is emitted if + verification fails; `err.code` contains the OpenSSL error code. Defaults to + `true`. + + `NPNProtocols` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) + An array of strings, `Buffer`s or `Uint8Array`s, or a single `Buffer` or + `Uint8Array` containing supported NPN protocols. `Buffer`s should have the + format `[len][name][len][name]...` e.g. `0x05hello0x05world`, where the + first byte is the length of the next protocol name. Passing an array is + usually much simpler, e.g. `['hello', 'world']`. + + `ALPNProtocols`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) + An array of strings, `Buffer`s or `Uint8Array`s, or a single `Buffer` or + `Uint8Array` containing the supported ALPN protocols. `Buffer`s should have + the format `[len][name][len][name]...` e.g. `0x05hello0x05world`, where the + first byte is the length of the next protocol name. Passing an array is + usually much simpler, e.g. `['hello', 'world']`. + + `servername`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Server name for the SNI (Server Name Indication) TLS + extension. + + `checkServerIdentity(servername, cert)` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A callback function + to be used (instead of the builtin `tls.checkServerIdentity()` function) + when checking the server's hostname (or the provided `servername` when + explicitly set) against the certificate. This should return an [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) if + verification fails. The method should return `undefined` if the `servername` + and `cert` are verified. + + `session` [](buffer.html#buffer_class_buffer) A `Buffer` instance, containing TLS session. + + `minDHSize` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Minimum size of the DH parameter in bits to accept a + TLS connection. When a server offers a DH parameter with a size less + than `minDHSize`, the TLS connection is destroyed and an error is thrown. + Defaults to `1024`. + + `secureContext`: Optional TLS context object created with + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options). If a `secureContext` is *not* provided, one + will be created by passing the entire `options` object to + `tls.createSecureContext()`. + + `lookup`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) Custom lookup function. Defaults to [`dns.lookup()`](dns.html#dns_dns_lookup_hostname_options_callback). + + ...: Optional [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) options that are used if the + `secureContext` option is missing, otherwise they are ignored. +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + +The `callback` function, if specified, will be added as a listener for the +[`'secureConnect'`](#tls_event_secureconnect) event. + +`tls.connect()` returns a [`tls.TLSSocket`](#tls_class_tls_tlssocket) object. + +The following implements a simple "echo server" example: + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + // Necessary only if using the client certificate authentication + key: fs.readFileSync('client-key.pem'), + cert: fs.readFileSync('client-cert.pem'), + + // Necessary only if the server uses the self-signed certificate + ca: [ fs.readFileSync('server-cert.pem') ] +}; + +const socket = tls.connect(8000, options, () => { + console.log('client connected', + socket.authorized ? 'authorized' : 'unauthorized'); + process.stdin.pipe(socket); + process.stdin.resume(); +}); +socket.setEncoding('utf8'); +socket.on('data', (data) => { + console.log(data); +}); +socket.on('end', () => { + server.close(); +}); +``` + +Or + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + pfx: fs.readFileSync('client.pfx') +}; + +const socket = tls.connect(8000, options, () => { + console.log('client connected', + socket.authorized ? 'authorized' : 'unauthorized'); + process.stdin.pipe(socket); + process.stdin.resume(); +}); +socket.setEncoding('utf8'); +socket.on('data', (data) => { + console.log(data); +}); +socket.on('end', () => { + server.close(); +}); +``` + +## tls.connect(path[, options][, callback])[#](#tls_tls_connect_path_options_callback) + +Added in: v0.11.3 + +* `path` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Default value for `options.path`. +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) See [`tls.connect()`](#tls_tls_connect_options_callback). +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) See [`tls.connect()`](#tls_tls_connect_options_callback). + +Same as [`tls.connect()`](#tls_tls_connect_options_callback) except that `path` can be provided +as an argument instead of an option. + +A path option, if specified, will take precedence over the path argument. + +## tls.connect(port[, host][, options][, callback])[#](#tls_tls_connect_port_host_options_callback) + +Added in: v0.11.3 + +* `port` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Default value for `options.port`. +* `host` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional default value for `options.host`. +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) See [`tls.connect()`](#tls_tls_connect_options_callback). +* `callback` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) See [`tls.connect()`](#tls_tls_connect_options_callback). + +Same as [`tls.connect()`](#tls_tls_connect_options_callback) except that `port` and `host` can be provided +as arguments instead of options. + +A port or host option, if specified, will take precedence over any port or host +argument. + +## tls.createSecureContext(options)[#](#tls_tls_createsecurecontext_options) + +History + +| Version | Changes | +| --- | --- | +| v9.3.0 | The `options` parameter can now include `clientCertEngine`. | +| v7.3.0 | If the `key` option is an array, individual entries do not need a `passphrase` property anymore. Array entries can also just be `string`s or `Buffer`s now. | +| v5.2.0 | The `ca` option can now be a single string containing multiple CA certificates. | +| v0.11.13 | Added in: v0.11.13 | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `pfx` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Optional PFX or PKCS12 + encoded private key and certificate chain. `pfx` is an alternative to + providing `key` and `cert` individually. PFX is usually encrypted, if it is, + `passphrase` will be used to decrypt it. Multiple PFX can be provided either + as an array of unencrypted PFX buffers, or an array of objects in the form + `{buf: [, passphrase: ]}`. The object form can only + occur in an array. `object.passphrase` is optional. Encrypted PFX will be + decrypted with `object.passphrase` if provided, or `options.passphrase` if + it is not. + + `key` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) Optional private keys in + PEM format. PEM allows the option of private keys being encrypted. Encrypted + keys will be decrypted with `options.passphrase`. Multiple keys using + different algorithms can be provided either as an array of unencrypted key + strings or buffers, or an array of objects in the form `{pem: + [, passphrase: ]}`. The object form can only occur in + an array. `object.passphrase` is optional. Encrypted keys will be decrypted + with `object.passphrase` if provided, or `options.passphrase` if it is not. + + `passphrase` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional shared passphrase used for a single private + key and/or a PFX. + + `cert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) Optional cert chains in PEM format. + One cert chain should be provided per private key. Each cert chain should + consist of the PEM formatted certificate for a provided private `key`, + followed by the PEM formatted intermediate certificates (if any), in order, + and not including the root CA (the root CA must be pre-known to the peer, + see `ca`). When providing multiple cert chains, they do not have to be in + the same order as their private keys in `key`. If the intermediate + certificates are not provided, the peer will not be able to validate the + certificate, and the handshake will fail. + + `ca` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) Optionally override the trusted CA + certificates. Default is to trust the well-known CAs curated by Mozilla. + Mozilla's CAs are completely replaced when CAs are explicitly specified + using this option. The value can be a string or Buffer, or an Array of + strings and/or Buffers. Any string or Buffer can contain multiple PEM CAs + concatenated together. The peer's certificate must be chainable to a CA + trusted by the server for the connection to be authenticated. When using + certificates that are not chainable to a well-known CA, the certificate's CA + must be explicitly specified as a trusted or the connection will fail to + authenticate. + If the peer uses a certificate that doesn't match or chain to one of the + default CAs, use the `ca` option to provide a CA certificate that the peer's + certificate can match or chain to. + For self-signed certificates, the certificate is its own CA, and must be + provided. + + `ciphers` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional cipher suite specification, replacing the + default. For more information, see [modifying the default cipher suite](#tls_modifying_the_default_tls_cipher_suite). + + `honorCipherOrder` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Attempt to use the server's cipher suite + preferences instead of the client's. When `true`, causes + `SSL_OP_CIPHER_SERVER_PREFERENCE` to be set in `secureOptions`, see + [OpenSSL Options](crypto.html#crypto_openssl_options) for more information. + + `ecdhCurve` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A string describing a named curve or a colon separated + list of curve NIDs or names, for example `P-521:P-384:P-256`, to use for + ECDH key agreement, or `false` to disable ECDH. Set to `auto` to select the + curve automatically. Defaults to [`tls.DEFAULT_ECDH_CURVE`](#tls_tls_default_ecdh_curve). Use + [`crypto.getCurves()`](crypto.html#crypto_crypto_getcurves) to obtain a list of available curve names. On + recent releases, `openssl ecparam -list_curves` will also display the name + and description of each available elliptic curve. + + `clientCertEngine` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional name of an OpenSSL engine which can + provide the client certificate. + + `crl` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](buffer.html#buffer_class_buffer) Optional PEM formatted + CRLs (Certificate Revocation Lists). + + `dhparam` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) Diffie Hellman parameters, required for + [Perfect Forward Secrecy](#tls_perfect_forward_secrecy). Use `openssl dhparam` to create the parameters. + The key length must be greater than or equal to 1024 bits, otherwise an + error will be thrown. It is strongly recommended to use 2048 bits or larger + for stronger security. If omitted or invalid, the parameters are silently + discarded and DHE ciphers will not be available. + + `secureOptions` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Optionally affect the OpenSSL protocol behavior, + which is not usually necessary. This should be used carefully if at all! + Value is a numeric bitmask of the `SSL_OP_*` options from + [OpenSSL Options](crypto.html#crypto_openssl_options). + + `secureProtocol` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional SSL method to use, default is + `"SSLv23_method"`. The possible values are listed as [SSL\_METHODS](https://www.openssl.org/docs/man1.0.2/ssl/ssl.html#DEALING-WITH-PROTOCOL-METHODS), use + the function names as strings. For example, `"SSLv3_method"` to force SSL + version 3. + + `sessionIdContext` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional opaque identifier used by servers to + ensure session state is not shared between applications. Unused by clients. + +[`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) sets the default value of the `honorCipherOrder` option +to `true`, other APIs that create secure contexts leave it unset. + +[`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) uses a 128 bit truncated SHA1 hash value generated +from `process.argv` as the default value of the `sessionIdContext` option, other +APIs that create secure contexts have no default value. + +The `tls.createSecureContext()` method creates a credentials object. + +A key is *required* for ciphers that make use of certificates. Either `key` or +`pfx` can be used to provide it. + +If the 'ca' option is not given, then Node.js will use the default +publicly trusted list of CAs as given in +. + +## tls.createServer([options][, secureConnectionListener])[#](#tls_tls_createserver_options_secureconnectionlistener) + +History + +| Version | Changes | +| --- | --- | +| v9.3.0 | The `options` parameter can now include `clientCertEngine`. | +| v8.0.0 | The `ALPNProtocols` and `NPNProtocols` options can be `Uint8Array`s now. | +| v5.0.0 | ALPN options are supported now. | +| v0.3.2 | Added in: v0.3.2 | + +* `options` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + `clientCertEngine` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Optional name of an OpenSSL engine which can + provide the client certificate. + + `handshakeTimeout` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Abort the connection if the SSL/TLS handshake + does not finish in the specified number of milliseconds. Defaults to + `120000` (120 seconds). A `'tlsClientError'` is emitted on the `tls.Server` + object whenever a handshake times out. + + `requestCert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true` the server will request a certificate from + clients that connect and attempt to verify that certificate. Defaults to + `false`. + + `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If not `false` the server will reject any + connection which is not authorized with the list of supplied CAs. This + option only has an effect if `requestCert` is `true`. Defaults to `true`. + + `NPNProtocols` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) + An array of strings, `Buffer`s or `Uint8Array`s, or a single `Buffer` or + `Uint8Array` containing supported NPN protocols. `Buffer`s should have the + format `[len][name][len][name]...` e.g. `0x05hello0x05world`, where the + first byte is the length of the next protocol name. Passing an array is + usually much simpler, e.g. `['hello', 'world']`. + (Protocols should be ordered by their priority.) + + `ALPNProtocols`: [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [](buffer.html#buffer_class_buffer) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) + An array of strings, `Buffer`s or `Uint8Array`s, or a single `Buffer` or + `Uint8Array` containing the supported ALPN protocols. `Buffer`s should have + the format `[len][name][len][name]...` e.g. `0x05hello0x05world`, where the + first byte is the length of the next protocol name. Passing an array is + usually much simpler, e.g. `['hello', 'world']`. + (Protocols should be ordered by their priority.) + When the server receives both NPN and ALPN extensions from the client, + ALPN takes precedence over NPN and the server does not send an NPN + extension to the client. + + `SNICallback(servername, cb)` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) A function that will be called if + the client supports SNI TLS extension. Two arguments will be passed when + called: `servername` and `cb`. `SNICallback` should invoke `cb(null, ctx)`, + where `ctx` is a SecureContext instance. (`tls.createSecureContext(...)` can + be used to get a proper SecureContext.) If `SNICallback` wasn't provided the + default callback with high-level API will be used (see below). + + `sessionTimeout` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) An integer specifying the number of seconds after + which the TLS session identifiers and TLS session tickets created by the + server will time out. See [SSL\_CTX\_set\_timeout](https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_timeout.html) for more details. + + `ticketKeys`: A 48-byte `Buffer` instance consisting of a 16-byte prefix, + a 16-byte HMAC key, and a 16-byte AES key. This can be used to accept TLS + session tickets on multiple instances of the TLS server. + + ...: Any [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) options can be provided. For + servers, the identity options (`pfx` or `key`/`cert`) are usually required. +* `secureConnectionListener` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) + +Creates a new [tls.Server](#tls_class_tls_server). The `secureConnectionListener`, if provided, is +automatically set as a listener for the [`'secureConnection'`](#tls_event_secureconnection) event. + +The `ticketKeys` options is automatically shared between `cluster` module +workers. + +The following illustrates a simple echo server: + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + key: fs.readFileSync('server-key.pem'), + cert: fs.readFileSync('server-cert.pem'), + + // This is necessary only if using the client certificate authentication. + requestCert: true, + + // This is necessary only if the client uses the self-signed certificate. + ca: [ fs.readFileSync('client-cert.pem') ] +}; + +const server = tls.createServer(options, (socket) => { + console.log('server connected', + socket.authorized ? 'authorized' : 'unauthorized'); + socket.write('welcome!\n'); + socket.setEncoding('utf8'); + socket.pipe(socket); +}); +server.listen(8000, () => { + console.log('server bound'); +}); +``` + +Or + +```None +const tls = require('tls'); +const fs = require('fs'); + +const options = { + pfx: fs.readFileSync('server.pfx'), + + // This is necessary only if using the client certificate authentication. + requestCert: true, + +}; + +const server = tls.createServer(options, (socket) => { + console.log('server connected', + socket.authorized ? 'authorized' : 'unauthorized'); + socket.write('welcome!\n'); + socket.setEncoding('utf8'); + socket.pipe(socket); +}); +server.listen(8000, () => { + console.log('server bound'); +}); +``` + +This server can be tested by connecting to it using `openssl s_client`: + +```None +openssl s_client -connect 127.0.0.1:8000 +``` + +## tls.getCiphers()[#](#tls_tls_getciphers) + +Added in: v0.10.2 + +Returns an array with the names of the supported SSL ciphers. + +For example: + +```None +console.log(tls.getCiphers()); // ['AES128-SHA', 'AES256-SHA', ...] +``` + +## tls.DEFAULT\_ECDH\_CURVE[#](#tls_tls_default_ecdh_curve) + +Added in: v0.11.13 + +The default curve name to use for ECDH key agreement in a tls server. The +default value is `'prime256v1'` (NIST P-256). Consult [RFC 4492](https://www.rfc-editor.org/rfc/rfc4492.txt) and +[FIPS.186-4](http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf) for more details. + +## Deprecated APIs[#](#tls_deprecated_apis) + +### Class: CryptoStream[#](#tls_class_cryptostream) + +Added in: v0.3.4Deprecated since: v0.11.3 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`tls.TLSSocket`](#tls_class_tls_tlssocket) instead. + +The `tls.CryptoStream` class represents a stream of encrypted data. This class +has been deprecated and should no longer be used. + +#### cryptoStream.bytesWritten[#](#tls_cryptostream_byteswritten) + +Added in: v0.3.4Deprecated since: v0.11.3 + +The `cryptoStream.bytesWritten` property returns the total number of bytes +written to the underlying socket *including* the bytes required for the +implementation of the TLS protocol. + +### Class: SecurePair[#](#tls_class_securepair) + +Added in: v0.3.2Deprecated since: v0.11.3 + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`tls.TLSSocket`](#tls_class_tls_tlssocket) instead. + +Returned by [`tls.createSecurePair()`](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options). + +#### Event: 'secure'[#](#tls_event_secure) + +Added in: v0.3.2Deprecated since: v0.11.3 + +The `'secure'` event is emitted by the `SecurePair` object once a secure +connection has been established. + +As with checking for the server [`secureConnection`](#tls_event_secureconnection) +event, `pair.cleartext.authorized` should be inspected to confirm whether the +certificate used is properly authorized. + +### tls.createSecurePair([context][, isServer][, requestCert][, rejectUnauthorized][, options])[#](#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options) + +History + +| Version | Changes | +| --- | --- | +| v5.0.0 | ALPN options are supported now. | +| v0.11.3 | Deprecated since: v0.11.3 | +| v0.3.2 | Added in: v0.3.2 | + +[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`tls.TLSSocket`](#tls_class_tls_tlssocket) instead. + +* `context` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) A secure context object as returned by + `tls.createSecureContext()` +* `isServer` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` to specify that this TLS connection should be + opened as a server. +* `requestCert` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) `true` to specify whether a server should request a + certificate from a connecting client. Only applies when `isServer` is `true`. +* `rejectUnauthorized` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If not `false` a server automatically reject + clients with invalid certificates. Only applies when `isServer` is `true`. +* `options` + + `secureContext`: An optional TLS context object from + [`tls.createSecureContext()`](#tls_tls_createsecurecontext_options) + + `isServer`: If `true` the TLS socket will be instantiated in server-mode. + Defaults to `false`. + + `server` [](net.html#net_class_net_server) An optional [`net.Server`](net.html#net_class_net_server) instance + + `requestCert`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `rejectUnauthorized`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `NPNProtocols`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `ALPNProtocols`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `SNICallback`: Optional, see [`tls.createServer()`](#tls_tls_createserver_options_secureconnectionlistener) + + `session` [](buffer.html#buffer_class_buffer) An optional `Buffer` instance containing a TLS session. + + `requestOCSP` [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) If `true`, specifies that the OCSP status request + extension will be added to the client hello and an `'OCSPResponse'` event + will be emitted on the socket before establishing a secure communication + +Creates a new secure pair object with two streams, one of which reads and writes +the encrypted data and the other of which reads and writes the cleartext data. +Generally, the encrypted stream is piped to/from an incoming encrypted data +stream and the cleartext one is used as a replacement for the initial encrypted +stream. + +`tls.createSecurePair()` returns a `tls.SecurePair` object with `cleartext` and +`encrypted` stream properties. + +Using `cleartext` has the same API as [`tls.TLSSocket`](#tls_class_tls_tlssocket). + +The `tls.createSecurePair()` method is now deprecated in favor of +`tls.TLSSocket()`. For example, the code: + +```None +pair = tls.createSecurePair(/* ... */); +pair.encrypted.pipe(socket); +socket.pipe(pair.encrypted); +``` + +can be replaced by: + +```None +secure_socket = tls.TLSSocket(socket, options); +``` + +where `secure_socket` has the same API as `pair.cleartext`. diff --git a/corpus/docs/nvidia_tensorrt-llm/attention/attention_100.md b/corpus/docs/nvidia_tensorrt-llm/attention/attention_100.md new file mode 100644 index 0000000000000000000000000000000000000000..473f20dc8429946cd18280097696a77926c52c18 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/attention/attention_100.md @@ -0,0 +1,382 @@ +# Multi-Head, Multi-Query, and Group-Query Attention# + +Source: https://nvidia.github.io/TensorRT-LLM/1.0.0/features/attention.html +Version: 1.0.0 + +This document details the implementation of multi-head attention (MHA), +multi-query attention (MQA), and group-query attention (GQA) for autoregressive +models in TensorRT LLM’s PyTorch backend. + +Multi-head attention involves a sequence of batched matrix multiplications, a softmax operation, and another batched matrix multiplication, +as described in the [Attention Is All You Need](https://arxiv.org/abs/1706.03762) paper. +[Multi-query Attention (MQA)](https://arxiv.org/abs/1911.02150) and [Group-query Attention (GQA)](https://arxiv.org/abs/2307.09288) are +variants of MHA that use fewer KV heads than the number of query heads. +TensorRT LLM provides several implementations using different backends in `tensorrt_llm/_torch/attention_backend/`. +The following sections explain how to use these implementations and provide a brief guide on implementing new backends. + +## Attention Backends[#](#attention-backends "Link to this heading") + +There are currently three available attention backends: the vanilla backend, the TRT-LLM backend, and the Flashinfer backend. +You can specify the desired attention backend using `PyTorchConfig.attn_backend`. For instance, to utilize the Flashinfer backend, you can pass `attn_backend="flashinfer"` to the `LLM` constructor as follows: `LLM(attn_backend="flashinfer")`. This will enable the use of the Flashinfer backend for your model. + +The vanilla backend, `VanillaAttention`, is a reference implementation designed primarily for inflight batching and linear KV cache support. While it serves as a useful baseline, it is not recommended for production use due to its limited optimizations. + +In contrast, the Flashinfer backend, `FlashInferAttention`, is performance-optimized and supports both inflight batching and paged KV cache. It also includes the following advanced features: + +1. **FP8 Quantization**: This feature enables the quantization of inputs and KV cache into FP8 format, significantly reducing memory usage and improving computational throughput. +2. **RoPE Fusion**: By integrating rotary position embedding (RoPE) directly into the attention computation, this feature enhances efficiency and reduces overhead. + +The TRT-LLM backend, `TrtllmAttention`, serves as the default backend and supports all the features available in the Flashinfer backend while being further optimized for enhanced performance. It is the recommended choice for production environments. Additionally, it offers the following advanced features: + +1. **Fused QKV Input**: It can accept a single QKV tensor as input, which is more efficient compared to using separate Q, K, and V tensors. +2. **FP8 Output**: It supports outputting the attention result in FP8 format, fusing quantization into the attention computation process. + +## Implement a New Attention Backend[#](#implement-a-new-attention-backend "Link to this heading") + +You can implement a new attention backend to integrate other attention libraries. +An attention backend consists of an `AttentionBackend` class and an `AttentionMetadata` class. +There are three stages in the PyTorch that involve the attention backend: + +1. Model construction: During the model’s `__init__`, call `AttentionBackend.__init__` to create an attention backend for each layer. +2. Metadata preparation: Before each forward step of the model: + + 1. If the metadata is uninitialized, call `AttentionMetadata.__init__` to create the attention metadata. + 2. If using CUDA graphs, call `AttentionMetadata.create_cuda_graph_metadata` to convert the metadata to CUDA graph metadata, which pre-allocates all tensors and can be used to capture CUDA graphs. Do not re-allocate any tensors stored inside `AttentionMetadata` after the initial warmup run when using CUDA graphs. + 3. To prepare parameters of the input and KV cache, call `AttentionMetadata.prepare` to convert from existing metadata and KV cache manager. +3. Single step forward: During the forward pass of each attention layer, call `AttentionBackend.forward` to perform the attention operation. The `AttentionMetadata` will be provided as a forward argument. + +### Implement `AttentionMetadata`[#](#implement-attentionmetadata "Link to this heading") + +The `AttentionMetadata` class stores metadata from the batched input and KV cache for the attention backend. +It contains the following predefined fields: + +| Field | Type | Description | +| --- | --- | --- | +| max\_num\_requests | int | The max number of requests in a single batch. | +| num\_contexts | int | The number of context-phase sequences in the batch. | +| num\_generations | int | The number of generation-phase sequences in the batch. | +| max\_num\_tokens | int | The max number of tokens in all requests in a single batch. | +| num\_tokens | int | Number of tokens in the batch. | +| num\_ctx\_tokens | int | Number of tokens in sequences in the context phase. | +| kv\_cache\_manager | KVCacheManager | The KV cache manager. | +| is\_cuda\_graph | bool | Whether CUDA graph is enabled. | +| seq\_lens | Tensor | The length of each sequence in the batch. The shape is (batch\_size), and located on CPU memory. | +| seq\_lens\_cuda | Tensor | A copy of `seq_lens` store on the GPU. | +| context\_lens | Tensor | The length of each context-phase sequence in the batch. The shape is (`num_contexts`). | +| position\_ids | Optional[Tensor] | The position of each token in each sequence. May be None if positional embedding is applied outside of the backend. | +| request\_ids | List[int] | The request ID of each sequence in the batch. | +| prompt\_lens | List[int] | The prompt length of each sequence in the batch. | +| kv\_cache\_params | KVCacheParams | The parameters for the KV cache. | + +During `AttentionMetadata.__init__`, you can initialize additional fields for the new attention metadata. +For example, the Flashinfer metadata initializes `decode_wrapper` here. +During `AttentionMetadata.prepare`, the runtime will fill all predefined fields, and you can fill your customized fields according to these predefined fields. +For example, the Flashinfer metadata fills `qo_indptr` by combining `context_lens` and `num_generations` here. + +### Implement `AttentionBackend`[#](#implement-attentionbackend "Link to this heading") + +The `AttentionBackend` delegates the attention operation to the backend implementation. + +Its `__init__` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| layer\_idx | int | The index of the attention layer in the model. | +| num\_heads | int | The number of query heads. | +| head\_dim | int | The size of each attention head `(hidden_size // num_heads)`. | +| num\_kv\_heads | Optional[int] | The number of KV heads. Defaults to num\_heads if None. | +| quant\_config | QuantConfig | Optional quantization configuration. If None, no quantization is applied. | +| pos\_embd\_params | PositionalEmbeddingParams | Optional parameters defining how positional embedding should be applied. If None, positional embedding should be applied by the model before calling the backend. Otherwise, the backend is in-charge of applying positional embedding and may cache K without embedding it first. | + +Its `forward` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| q | Tensor | Query tensor with shape `(num_tokens, num_heads * head_dim)`. | +| k | Tensor | Key tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| v | Tensor | Value tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| metadata | AttentionMetadata | Metadata for the attention operation. | +| attention\_mask | AttentionMask | Optional attention mask. If None, causal mask is applied. | + +For example, the Flashinfer backend calls `append_paged_kv_cache` and then `wrapper.run` to perform the attention operation here. + +## The Features of the `TrtllmAttention` Backend[#](#the-features-of-the-trtllmattention-backend "Link to this heading") + +The following sections introduce some features of the default `TrtllmAttention` backend. + +### Packed Tensors[#](#packed-tensors "Link to this heading") + +In the `TrtllmAttention` backend, the attention operator supports the packed (i.e. non padded) QKV inputs. +A naive layout for the QKV inputs is padding the sequences +that are shorter than the `max_sequence_length` to the maximum +length. It may result in excessive memory consumption as well as unneeded +computations on padding tokens (in the various matrix multiplications that +surround the MHA block). +To overcome that problem, TensorRT LLM supports a mode without padding where +the different tokens are packed together and the user provides the operator +with a 1D tensor containing the lengths of the different sequences. + +### Context and Generation Phases[#](#context-and-generation-phases "Link to this heading") + +The `TrtllmAttention` backend encapsulates different implementations for both +context and generation phases into a single custom torch op. + +#### Context Phase[#](#context-phase "Link to this heading") + +A context-phase implementation without optimization maps to a sequence of GPU kernels that will store the +intermediate `Q*K^T` tensor in memory before calling the softmax operator. It +is the slowest method and the memory footprint is significant (grows quadratically in proportion to the sequence length). + +The `TrtllmAttention` backend will trigger a kernel that performs the MHA/MQA block +using a single kernel instead. For short sequences, that kernel uses a vanilla +implementation of MHA/MQA. For larger sequences, this kernel uses the Flash +Attention algorithm as described in +[FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness](https://arxiv.org/abs/2205.14135) +and +[FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning](https://arxiv.org/abs/2307.08691). + +Currently, the implementation triggers extra kernels that apply pre-processing +to the elements (like RoPE) and populate the KV cache (see below). In a future +release, the number of such kernels may be reduced to improve the overall performance. + +#### FP8 Context FMHA[#](#fp8-context-fmha "Link to this heading") + +When FP8 quantization is activated, the attention can be further accelerated by +enabling FP8 Context FMHA. + +FP8 Paged Context FMHA is also supported with the fp8 quantization workflow. +You need to specify `use_paged_context_fmha = True` for the attention operator. + +Please be aware that this feature is only supported on Ada, Hopper and above. + +#### Generation Phase[#](#generation-phase "Link to this heading") + +The generation phase is implemented using a single kernel called the masked +multi-head attention in TensorRT LLM. That kernel is able to apply +pre-processing on the Q, K, and V elements on-the-fly: it adds the QKV bias, applies +RoPE, and performs dequantization and quantization. TensorRT LLM will continue to add (or +enable) additional features in future releases, such as enabling support for IA3. + +The masked MHA kernel has a special version that distributes the work across +multiple CUDA thread-blocks on the GPU for cases where the GPU occupancy is +low. That mode called multi-block is always enabled. +NVIDIA recommends users to test that mode in scenarios where both the batch +size and the number of heads in the model are relatively small. +The definition of ‘small’ in that context is hard to quantify because it depends on the model of the GPU. +However, NVIDIA currently recommends testing that mode when `batch_size * num_heads` is less than the number of multi-processors on the GPU. +This guidance may be subject to change in the future. + +Note that even if the multi-block mode is enabled, the attention operator will +not immediately trigger the multi-block version of the GPU kernel. There is a +minimum number of tokens (input + generated) that are required for the +multi-block version to become more efficient than the “vanilla” implementation +that uses a single CUDA thread-block per head. It is controlled by an internal +heuristic. + +Another note is that as the masked MHA kernels use shared memory size +proportional to sequence length, so there can be some cases that GPU’s shared +memory is not enough when multi-block mode is not enabled. To get masked MHA kernel to work in those cases, multi-block mode is forced on and a warning message is printed in the log. + +#### XQA Optimization[#](#xqa-optimization "Link to this heading") + +XQA optimization is another optimization for MQA/GQA in the generation phase. +It currently only supports a limited number of model configurations, such as the LLAMA2 70B model. + +Support matrix of the XQA optimization: + +* FP16 / BF16 compute data type. +* FP16 / BF16 / FP8 / INT8 KV cache data type. +* Paged KV cache (8 / 16 / 32 / 64 / 128 tokens per block). + +By default, this is enabled. Note that a heuristic algorithm +is also used to decide whether to use XQA kernel or masked MHA kernel to get +better performance. +If you want to use that kernel whenever possible, set `TRTLLM_FORCE_XQA=1` to force use of the XQA kernel when the model config is supported. +Supported configurations can be found using the `shouldUse` function of the `DecoderXQARunner` class in +`cpp/tensorrt_llm/kernels/decoderMaskedMultiheadAttention/decoderXQARunner.h`. + +### In-flight Batching[#](#in-flight-batching "Link to this heading") + +TensorRT LLM supports in-flight batching of requests (also known as continuous +batching or iteration-level batching) for higher serving throughput. With this feature, +sequences in the context phase can be processed together with sequences in +the generation phase. The purpose of that technique is to better interleave +requests to reduce latency as well as make better use of the GPUs. +For efficiency reasons (1), the support for inflight batching ***requires the +input tensors to be packed (no padding)***. + +***In the current implementation, the sequences that are going through the +context phase must be before the sequences in the generation phase in the input +tensor. For example, for sequences `S0`, `S1` and `S2`, if `S0` and `S2` are in +context phase (and `S1` in generation), tokens from `S0` and `S2` must appear +before the tokens of `S1` in the input tensor***. + +*(1) Padding sequences in the generation phase, that contain a single token, to +the length of the maximum input sequence is inefficient use of resources*. + +### Chunked Context[#](#chunked-context "Link to this heading") + +In the original state, the common behavior was to process all context tokens at +once. This feature splits the context into several chunks. In this way, the +context chunks can be batched with more tokens during the generation phase, +which is expected to increase the total throughput. Chunking contexts also removes +constraints on input length. Except for the last one, the size of the context chunk needs +to be an integer multiple of the kv-cache block size. + +> To enable this feature, the FMHA paged kv-cache also needs to be enabled. + +### KV Cache[#](#kv-cache "Link to this heading") + +In the generation phase, a common optimization is to provide the MHA kernel +with a cache containing the values of the past K and V elements that have +already been computed. That cache is known as the KV cache. TensorRT LLM uses +that technique to accelerate its generation phase. In TensorRT LLM, there is +one KV cache per Transformer layer, which means that there are as many KV +caches as layers in a model. The current version of TensorRT LLM supports two +different types of KV caches: **contiguous** and **paged** KV caches. + +#### Contiguous KV Cache[#](#contiguous-kv-cache "Link to this heading") + +The contiguous KV cache is a monolithic tensor. Its shape is: + +```None +[max_batch_size * max_beam_width, 2, num_heads, max_seqlen, hidden_dim_per_head]. +``` + +That implementation uses a lot more memory than needed when the sequences are +shorter than the maximum sequence length (even if they end up close to the +limit after the generation of many output tokens, it may take a lot of steps to +reach that point). + +#### Paged KV Cache[#](#paged-kv-cache "Link to this heading") + +The paged KV cache decomposes the KV cache into blocks that are distributed to +the different requests by a cache manager during processing. That cache manager +keeps track of the sequences, allocates new blocks from a pool and recycles those +blocks when required. See the implementation of +[`KVCacheManager`](https://github.com/NVIDIA/TensorRT-LLM/tree/ae8270b/tensorrt_llm/_torch/pyexecutor/resource_manager.py). + +#### INT8/FP8 KV Caches[#](#int8-fp8-kv-caches "Link to this heading") + +In its current implementation, even if the rest of the network runs in INT8 or +FP8, the attention operator works with FP32, FP16, and BFloat16 inputs and +outputs. However, TensorRT LLM supports INT8 and FP8 +(`QuantMode.INT8_KV_CACHE` and +`QuantMode.FP8_KV_CACHE`) KV caches. + +The attention operator populates the KV cache. When INT8 or FP8 KV caches +are enabled, the input values have to be quantized to 8 bits using a scaling +factor. For quantization, the scaling factor is stored in the +`kv_cache_scaling_factor` tensor. Its shape is `[1]` and only per-tensor +quantization is supported in the current version. Quantization uses inversed scale +since it does multiply as `fp_value * (1.0 / kv_cache_scaling_factor)` in plugin. + +During generation, the values read from the cache are dequantized on-the-fly in +the MHA/MQA kernel. Dequantization is defined as +`quantized_value * kv_cache_scaling_factor`. + +### Sliding Window Attention, Cyclic (Rolling Buffer) KV Cache[#](#sliding-window-attention-cyclic-rolling-buffer-kv-cache "Link to this heading") + +TensorRT LLM has a feature called `Cyclic KV Cache`, which treats the kv cache +as a circular buffer. This means that it only stores the kv cache for the last N +tokens, where N is determined by the `attention_window_size` parameter in +`TrtllmAttention.forward`. When the cache is full, new tokens’ kv cache will +overwrite the “least recently used” caches. + +In the context phase, if the input length surpasses the `attention_window_size`, +`Sliding Window Attention` will be activated. This serves the same function as +the sliding window size. + +This feature helps to reduce the memory footprint of the kv cache when +dealing with very long sequences. + +\_Note that the cyclic kv cache feature doesn’t work with beam searching currently as +the context kv cache are shared across beams. + +### StreamingLLM[#](#streamingllm "Link to this heading") + +The StreamingLLM feature uses a window attention to perform efficient and stable LLM +on long texts, which means that only `N` tokens need to be stored in the KV cache. +Similar to the cyclic KV cache feature in TensorRT LLM, `attention_window_size` +parameter is used to determine `N`. Different from the cyclic KV cache feature, +the first `S` tokens, called sink tokens, are always kept in the attention window, +where `S` is determined by `sink_token_length` parameter. +But in context phase, the self-attentions are dense in the official implementation of +StreamingLLM. It uses all of the tokens for computation and only saves `N` tokens +to the KV cache. + +In addition, the relative position embedding is also changed in StreamingLLM. +When determining the relative distance and adding positional information to tokens, +StreamingLLM use the positions within the cache rather than those in the original text. + +`sink_token_length` is also used to enable this feature. + +### Beam-Search[#](#beam-search "Link to this heading") + +The attention operator supports beam-search. In the context phase, a single +beam is computed per input sequence. In the generation phase, the MHA/MQA/GQA +kernel uses an additional tensor to reconstruct the correct path for each beam. +That tensor is called the `cache_indirection`. Its shape is `[batch_size, beam_width, max_seqlen]`. + +For a sequence `si`, a beam `bi` and a token `ti`, the element +`cache_indirection[si][bi][ti]` is an integer between `0` and `beam_width-1` +that indicates which path in the beam to read the K and V elements from in the +KV cache. This tensor is populated in the sampling stage. + +### Input QKV tensor[#](#input-qkv-tensor "Link to this heading") + +The input QKV tensor packs the Q, K and V tensors (concatenated along the last +dimension) after the projection of the hidden states. It is a 3D tensor. RoPE +and quantization to INT8 or FP8 (when needed) are performed by the GPT +attention operator. + +In packed mode, its shape is `[num_tokens, 3 * hidden_dim]` where +`num_tokens` is the total number of tokens in the batch. For the sequences in +context phase, the number of tokens of a sequence corresponds to its input +length (even if the beam width is greater than `1` for beam search). For the +sequences in generation phase, there are `beam_width` tokens per sequence. The +beam width can be different for each sequence. + +The following pseudo code explains how the number of tokens is computed: + +```None +num_tokens = 0 + +# Add the length of each sequence in context phase. +for seq in context_phase: + num_tokens += seq.length + +# Add the width of the beam for each sequence in generation phase. +for seq in generation_phase: + num_tokens += seq.beam_width +``` + +### Rotary Positional Embedding (RoPE)[#](#rotary-positional-embedding-rope "Link to this heading") + +The attention operator can perform the computation of the Rotary +Positional Embedding (RoPE). When that operation is enabled, +`rotary_embedding_dim` is set to a value greater than 0, it is fused with other +operations. The GPT operator supports GPT-NeoX and GPT-J forms of RoPE by +setting `position_embedding_type` to `PositionEmbeddingType.rope_gpt_neox` +or `PositionEmbeddingType.rope_gptj`. + +### ALiBi[#](#alibi "Link to this heading") + +The attention operator can apply ALiBi to the result of the `Q*K^T` +product. The bias is computed on-the-fly from the ALiBi slopes in the optimized +kernel. + +### Scaling factor(s)[#](#scaling-factor-s "Link to this heading") + +In MHA, the output of the `Q*K^T` product is scaled by a constant value that +is computed as: + +```None +norm_factor = 1.f / (q_scaling * sqrt(head_size)). +``` + +### Cross Attention[#](#cross-attention "Link to this heading") + +On top of the MHA as self attention needed by GPT-style decoder-only models, the attention operator also supports cross attention. + +This enables the attention operator to be more broadly used as a generic decoder component. For example, the Encoder-Decoder model uses it to issue both the self attention and cross attention modules in its Decoder. diff --git a/corpus/docs/nvidia_tensorrt-llm/attention/attention_110.md b/corpus/docs/nvidia_tensorrt-llm/attention/attention_110.md new file mode 100644 index 0000000000000000000000000000000000000000..dfea8fb38234c9d9f125450910d6c092cb5966e6 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/attention/attention_110.md @@ -0,0 +1,382 @@ +# Multi-Head, Multi-Query, and Group-Query Attention# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0/features/attention.html +Version: 1.1.0 + +This document details the implementation of multi-head attention (MHA), +multi-query attention (MQA), and group-query attention (GQA) for autoregressive +models in TensorRT LLM’s PyTorch backend. + +Multi-head attention involves a sequence of batched matrix multiplications, a softmax operation, and another batched matrix multiplication, +as described in the [Attention Is All You Need](https://arxiv.org/abs/1706.03762) paper. +[Multi-query Attention (MQA)](https://arxiv.org/abs/1911.02150) and [Group-query Attention (GQA)](https://arxiv.org/abs/2307.09288) are +variants of MHA that use fewer KV heads than the number of query heads. +TensorRT LLM provides several implementations using different backends in `tensorrt_llm/_torch/attention_backend/`. +The following sections explain how to use these implementations and provide a brief guide on implementing new backends. + +## Attention Backends[#](#attention-backends "Link to this heading") + +There are currently three available attention backends: the vanilla backend, the TRT-LLM backend, and the Flashinfer backend. +You can specify the desired attention backend using `PyTorchConfig.attn_backend`. For instance, to utilize the Flashinfer backend, you can pass `attn_backend="flashinfer"` to the `LLM` constructor as follows: `LLM(attn_backend="flashinfer")`. This will enable the use of the Flashinfer backend for your model. + +The vanilla backend, `VanillaAttention`, is a reference implementation designed primarily for inflight batching and linear KV cache support. While it serves as a useful baseline, it is not recommended for production use due to its limited optimizations. + +In contrast, the Flashinfer backend, `FlashInferAttention`, is performance-optimized and supports both inflight batching and paged KV cache. It also includes the following advanced features: + +1. **FP8 Quantization**: This feature enables the quantization of inputs and KV cache into FP8 format, significantly reducing memory usage and improving computational throughput. +2. **RoPE Fusion**: By integrating rotary position embedding (RoPE) directly into the attention computation, this feature enhances efficiency and reduces overhead. + +The TRT-LLM backend, `TrtllmAttention`, serves as the default backend and supports all the features available in the Flashinfer backend while being further optimized for enhanced performance. It is the recommended choice for production environments. Additionally, it offers the following advanced features: + +1. **Fused QKV Input**: It can accept a single QKV tensor as input, which is more efficient compared to using separate Q, K, and V tensors. +2. **FP8 Output**: It supports outputting the attention result in FP8 format, fusing quantization into the attention computation process. + +## Implement a New Attention Backend[#](#implement-a-new-attention-backend "Link to this heading") + +You can implement a new attention backend to integrate other attention libraries. +An attention backend consists of an `AttentionBackend` class and an `AttentionMetadata` class. +There are three stages in the PyTorch that involve the attention backend: + +1. Model construction: During the model’s `__init__`, call `AttentionBackend.__init__` to create an attention backend for each layer. +2. Metadata preparation: Before each forward step of the model: + + 1. If the metadata is uninitialized, call `AttentionMetadata.__init__` to create the attention metadata. + 2. If using CUDA graphs, call `AttentionMetadata.create_cuda_graph_metadata` to convert the metadata to CUDA graph metadata, which pre-allocates all tensors and can be used to capture CUDA graphs. Do not re-allocate any tensors stored inside `AttentionMetadata` after the initial warmup run when using CUDA graphs. + 3. To prepare parameters of the input and KV cache, call `AttentionMetadata.prepare` to convert from existing metadata and KV cache manager. +3. Single step forward: During the forward pass of each attention layer, call `AttentionBackend.forward` to perform the attention operation. The `AttentionMetadata` will be provided as a forward argument. + +### Implement `AttentionMetadata`[#](#implement-attentionmetadata "Link to this heading") + +The `AttentionMetadata` class stores metadata from the batched input and KV cache for the attention backend. +It contains the following predefined fields: + +| Field | Type | Description | +| --- | --- | --- | +| max\_num\_requests | int | The max number of requests in a single batch. | +| num\_contexts | int | The number of context-phase sequences in the batch. | +| num\_generations | int | The number of generation-phase sequences in the batch. | +| max\_num\_tokens | int | The max number of tokens in all requests in a single batch. | +| num\_tokens | int | Number of tokens in the batch. | +| num\_ctx\_tokens | int | Number of tokens in sequences in the context phase. | +| kv\_cache\_manager | KVCacheManager | The KV cache manager. | +| is\_cuda\_graph | bool | Whether CUDA graph is enabled. | +| seq\_lens | Tensor | The length of each sequence in the batch. The shape is (batch\_size), and located on CPU memory. | +| seq\_lens\_cuda | Tensor | A copy of `seq_lens` store on the GPU. | +| context\_lens | Tensor | The length of each context-phase sequence in the batch. The shape is (`num_contexts`). | +| position\_ids | Optional[Tensor] | The position of each token in each sequence. May be None if positional embedding is applied outside of the backend. | +| request\_ids | List[int] | The request ID of each sequence in the batch. | +| prompt\_lens | List[int] | The prompt length of each sequence in the batch. | +| kv\_cache\_params | KVCacheParams | The parameters for the KV cache. | + +During `AttentionMetadata.__init__`, you can initialize additional fields for the new attention metadata. +For example, the Flashinfer metadata initializes `decode_wrapper` here. +During `AttentionMetadata.prepare`, the runtime will fill all predefined fields, and you can fill your customized fields according to these predefined fields. +For example, the Flashinfer metadata fills `qo_indptr` by combining `context_lens` and `num_generations` here. + +### Implement `AttentionBackend`[#](#implement-attentionbackend "Link to this heading") + +The `AttentionBackend` delegates the attention operation to the backend implementation. + +Its `__init__` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| layer\_idx | int | The index of the attention layer in the model. | +| num\_heads | int | The number of query heads. | +| head\_dim | int | The size of each attention head `(hidden_size // num_heads)`. | +| num\_kv\_heads | Optional[int] | The number of KV heads. Defaults to num\_heads if None. | +| quant\_config | QuantConfig | Optional quantization configuration. If None, no quantization is applied. | +| pos\_embd\_params | PositionalEmbeddingParams | Optional parameters defining how positional embedding should be applied. If None, positional embedding should be applied by the model before calling the backend. Otherwise, the backend is in-charge of applying positional embedding and may cache K without embedding it first. | + +Its `forward` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| q | Tensor | Query tensor with shape `(num_tokens, num_heads * head_dim)`. | +| k | Tensor | Key tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| v | Tensor | Value tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| metadata | AttentionMetadata | Metadata for the attention operation. | +| attention\_mask | AttentionMask | Optional attention mask. If None, causal mask is applied. | + +For example, the Flashinfer backend calls `append_paged_kv_cache` and then `wrapper.run` to perform the attention operation here. + +## The Features of the `TrtllmAttention` Backend[#](#the-features-of-the-trtllmattention-backend "Link to this heading") + +The following sections introduce some features of the default `TrtllmAttention` backend. + +### Packed Tensors[#](#packed-tensors "Link to this heading") + +In the `TrtllmAttention` backend, the attention operator supports the packed (i.e. non padded) QKV inputs. +A naive layout for the QKV inputs is padding the sequences +that are shorter than the `max_sequence_length` to the maximum +length. It may result in excessive memory consumption as well as unneeded +computations on padding tokens (in the various matrix multiplications that +surround the MHA block). +To overcome that problem, TensorRT LLM supports a mode without padding where +the different tokens are packed together and the user provides the operator +with a 1D tensor containing the lengths of the different sequences. + +### Context and Generation Phases[#](#context-and-generation-phases "Link to this heading") + +The `TrtllmAttention` backend encapsulates different implementations for both +context and generation phases into a single custom torch op. + +#### Context Phase[#](#context-phase "Link to this heading") + +A context-phase implementation without optimization maps to a sequence of GPU kernels that will store the +intermediate `Q*K^T` tensor in memory before calling the softmax operator. It +is the slowest method and the memory footprint is significant (grows quadratically in proportion to the sequence length). + +The `TrtllmAttention` backend will trigger a kernel that performs the MHA/MQA block +using a single kernel instead. For short sequences, that kernel uses a vanilla +implementation of MHA/MQA. For larger sequences, this kernel uses the Flash +Attention algorithm as described in +[FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness](https://arxiv.org/abs/2205.14135) +and +[FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning](https://arxiv.org/abs/2307.08691). + +Currently, the implementation triggers extra kernels that apply pre-processing +to the elements (like RoPE) and populate the KV cache (see below). In a future +release, the number of such kernels may be reduced to improve the overall performance. + +#### FP8 Context FMHA[#](#fp8-context-fmha "Link to this heading") + +When FP8 quantization is activated, the attention can be further accelerated by +enabling FP8 Context FMHA. + +FP8 Paged Context FMHA is also supported with the fp8 quantization workflow. +You need to specify `use_paged_context_fmha = True` for the attention operator. + +Please be aware that this feature is only supported on Ada, Hopper and above. + +#### Generation Phase[#](#generation-phase "Link to this heading") + +The generation phase is implemented using a single kernel called the masked +multi-head attention in TensorRT LLM. That kernel is able to apply +pre-processing on the Q, K, and V elements on-the-fly: it adds the QKV bias, applies +RoPE, and performs dequantization and quantization. TensorRT LLM will continue to add (or +enable) additional features in future releases, such as enabling support for IA3. + +The masked MHA kernel has a special version that distributes the work across +multiple CUDA thread-blocks on the GPU for cases where the GPU occupancy is +low. That mode called multi-block is always enabled. +NVIDIA recommends users to test that mode in scenarios where both the batch +size and the number of heads in the model are relatively small. +The definition of ‘small’ in that context is hard to quantify because it depends on the model of the GPU. +However, NVIDIA currently recommends testing that mode when `batch_size * num_heads` is less than the number of multi-processors on the GPU. +This guidance may be subject to change in the future. + +Note that even if the multi-block mode is enabled, the attention operator will +not immediately trigger the multi-block version of the GPU kernel. There is a +minimum number of tokens (input + generated) that are required for the +multi-block version to become more efficient than the “vanilla” implementation +that uses a single CUDA thread-block per head. It is controlled by an internal +heuristic. + +Another note is that as the masked MHA kernels use shared memory size +proportional to sequence length, so there can be some cases that GPU’s shared +memory is not enough when multi-block mode is not enabled. To get masked MHA kernel to work in those cases, multi-block mode is forced on and a warning message is printed in the log. + +#### XQA Optimization[#](#xqa-optimization "Link to this heading") + +XQA optimization is another optimization for MQA/GQA in the generation phase. +It currently only supports a limited number of model configurations, such as the LLAMA2 70B model. + +Support matrix of the XQA optimization: + +* FP16 / BF16 compute data type. +* FP16 / BF16 / FP8 / INT8 KV cache data type. +* Paged KV cache (8 / 16 / 32 / 64 / 128 tokens per block). + +By default, this is enabled. Note that a heuristic algorithm +is also used to decide whether to use XQA kernel or masked MHA kernel to get +better performance. +If you want to use that kernel whenever possible, set `TRTLLM_FORCE_XQA=1` to force use of the XQA kernel when the model config is supported. +Supported configurations can be found using the `shouldUse` function of the `DecoderXQARunner` class in +`cpp/tensorrt_llm/kernels/decoderMaskedMultiheadAttention/decoderXQARunner.h`. + +### In-flight Batching[#](#in-flight-batching "Link to this heading") + +TensorRT LLM supports in-flight batching of requests (also known as continuous +batching or iteration-level batching) for higher serving throughput. With this feature, +sequences in the context phase can be processed together with sequences in +the generation phase. The purpose of that technique is to better interleave +requests to reduce latency as well as make better use of the GPUs. +For efficiency reasons (1), the support for inflight batching ***requires the +input tensors to be packed (no padding)***. + +***In the current implementation, the sequences that are going through the +context phase must be before the sequences in the generation phase in the input +tensor. For example, for sequences `S0`, `S1` and `S2`, if `S0` and `S2` are in +context phase (and `S1` in generation), tokens from `S0` and `S2` must appear +before the tokens of `S1` in the input tensor***. + +*(1) Padding sequences in the generation phase, that contain a single token, to +the length of the maximum input sequence is inefficient use of resources*. + +### Chunked Context[#](#chunked-context "Link to this heading") + +In the original state, the common behavior was to process all context tokens at +once. This feature splits the context into several chunks. In this way, the +context chunks can be batched with more tokens during the generation phase, +which is expected to increase the total throughput. Chunking contexts also removes +constraints on input length. Except for the last one, the size of the context chunk needs +to be an integer multiple of the kv-cache block size. + +> To enable this feature, the FMHA paged kv-cache also needs to be enabled. + +### KV Cache[#](#kv-cache "Link to this heading") + +In the generation phase, a common optimization is to provide the MHA kernel +with a cache containing the values of the past K and V elements that have +already been computed. That cache is known as the KV cache. TensorRT LLM uses +that technique to accelerate its generation phase. In TensorRT LLM, there is +one KV cache per Transformer layer, which means that there are as many KV +caches as layers in a model. The current version of TensorRT LLM supports two +different types of KV caches: **contiguous** and **paged** KV caches. + +#### Contiguous KV Cache[#](#contiguous-kv-cache "Link to this heading") + +The contiguous KV cache is a monolithic tensor. Its shape is: + +```None +[max_batch_size * max_beam_width, 2, num_heads, max_seqlen, hidden_dim_per_head]. +``` + +That implementation uses a lot more memory than needed when the sequences are +shorter than the maximum sequence length (even if they end up close to the +limit after the generation of many output tokens, it may take a lot of steps to +reach that point). + +#### Paged KV Cache[#](#paged-kv-cache "Link to this heading") + +The paged KV cache decomposes the KV cache into blocks that are distributed to +the different requests by a cache manager during processing. That cache manager +keeps track of the sequences, allocates new blocks from a pool and recycles those +blocks when required. See the implementation of +[`KVCacheManager`](https://github.com/NVIDIA/TensorRT-LLM/tree/48b7b5d/tensorrt_llm/_torch/pyexecutor/resource_manager.py). + +#### INT8/FP8 KV Caches[#](#int8-fp8-kv-caches "Link to this heading") + +In its current implementation, even if the rest of the network runs in INT8 or +FP8, the attention operator works with FP32, FP16, and BFloat16 inputs and +outputs. However, TensorRT LLM supports INT8 and FP8 +(`QuantMode.INT8_KV_CACHE` and +`QuantMode.FP8_KV_CACHE`) KV caches. + +The attention operator populates the KV cache. When INT8 or FP8 KV caches +are enabled, the input values have to be quantized to 8 bits using a scaling +factor. For quantization, the scaling factor is stored in the +`kv_cache_scaling_factor` tensor. Its shape is `[1]` and only per-tensor +quantization is supported in the current version. Quantization uses inversed scale +since it does multiply as `fp_value * (1.0 / kv_cache_scaling_factor)` in plugin. + +During generation, the values read from the cache are dequantized on-the-fly in +the MHA/MQA kernel. Dequantization is defined as +`quantized_value * kv_cache_scaling_factor`. + +### Sliding Window Attention, Cyclic (Rolling Buffer) KV Cache[#](#sliding-window-attention-cyclic-rolling-buffer-kv-cache "Link to this heading") + +TensorRT LLM has a feature called `Cyclic KV Cache`, which treats the kv cache +as a circular buffer. This means that it only stores the kv cache for the last N +tokens, where N is determined by the `attention_window_size` parameter in +`TrtllmAttention.forward`. When the cache is full, new tokens’ kv cache will +overwrite the “least recently used” caches. + +In the context phase, if the input length surpasses the `attention_window_size`, +`Sliding Window Attention` will be activated. This serves the same function as +the sliding window size. + +This feature helps to reduce the memory footprint of the kv cache when +dealing with very long sequences. + +\_Note that the cyclic kv cache feature doesn’t work with beam searching currently as +the context kv cache are shared across beams. + +### StreamingLLM[#](#streamingllm "Link to this heading") + +The StreamingLLM feature uses a window attention to perform efficient and stable LLM +on long texts, which means that only `N` tokens need to be stored in the KV cache. +Similar to the cyclic KV cache feature in TensorRT LLM, `attention_window_size` +parameter is used to determine `N`. Different from the cyclic KV cache feature, +the first `S` tokens, called sink tokens, are always kept in the attention window, +where `S` is determined by `sink_token_length` parameter. +But in context phase, the self-attentions are dense in the official implementation of +StreamingLLM. It uses all of the tokens for computation and only saves `N` tokens +to the KV cache. + +In addition, the relative position embedding is also changed in StreamingLLM. +When determining the relative distance and adding positional information to tokens, +StreamingLLM use the positions within the cache rather than those in the original text. + +`sink_token_length` is also used to enable this feature. + +### Beam-Search[#](#beam-search "Link to this heading") + +The attention operator supports beam-search. In the context phase, a single +beam is computed per input sequence. In the generation phase, the MHA/MQA/GQA +kernel uses an additional tensor to reconstruct the correct path for each beam. +That tensor is called the `cache_indirection`. Its shape is `[batch_size, beam_width, max_seqlen]`. + +For a sequence `si`, a beam `bi` and a token `ti`, the element +`cache_indirection[si][bi][ti]` is an integer between `0` and `beam_width-1` +that indicates which path in the beam to read the K and V elements from in the +KV cache. This tensor is populated in the sampling stage. + +### Input QKV tensor[#](#input-qkv-tensor "Link to this heading") + +The input QKV tensor packs the Q, K and V tensors (concatenated along the last +dimension) after the projection of the hidden states. It is a 3D tensor. RoPE +and quantization to INT8 or FP8 (when needed) are performed by the GPT +attention operator. + +In packed mode, its shape is `[num_tokens, 3 * hidden_dim]` where +`num_tokens` is the total number of tokens in the batch. For the sequences in +context phase, the number of tokens of a sequence corresponds to its input +length (even if the beam width is greater than `1` for beam search). For the +sequences in generation phase, there are `beam_width` tokens per sequence. The +beam width can be different for each sequence. + +The following pseudo code explains how the number of tokens is computed: + +```None +num_tokens = 0 + +# Add the length of each sequence in context phase. +for seq in context_phase: + num_tokens += seq.length + +# Add the width of the beam for each sequence in generation phase. +for seq in generation_phase: + num_tokens += seq.beam_width +``` + +### Rotary Positional Embedding (RoPE)[#](#rotary-positional-embedding-rope "Link to this heading") + +The attention operator can perform the computation of the Rotary +Positional Embedding (RoPE). When that operation is enabled, +`rotary_embedding_dim` is set to a value greater than 0, it is fused with other +operations. The GPT operator supports GPT-NeoX and GPT-J forms of RoPE by +setting `position_embedding_type` to `PositionEmbeddingType.rope_gpt_neox` +or `PositionEmbeddingType.rope_gptj`. + +### ALiBi[#](#alibi "Link to this heading") + +The attention operator can apply ALiBi to the result of the `Q*K^T` +product. The bias is computed on-the-fly from the ALiBi slopes in the optimized +kernel. + +### Scaling factor(s)[#](#scaling-factor-s "Link to this heading") + +In MHA, the output of the `Q*K^T` product is scaled by a constant value that +is computed as: + +```None +norm_factor = 1.f / (q_scaling * sqrt(head_size)). +``` + +### Cross Attention[#](#cross-attention "Link to this heading") + +On top of the MHA as self attention needed by GPT-style decoder-only models, the attention operator also supports cross attention. + +This enables the attention operator to be more broadly used as a generic decoder component. For example, the Encoder-Decoder model uses it to issue both the self attention and cross attention modules in its Decoder. diff --git a/corpus/docs/nvidia_tensorrt-llm/attention/attention_110rc4.md b/corpus/docs/nvidia_tensorrt-llm/attention/attention_110rc4.md new file mode 100644 index 0000000000000000000000000000000000000000..e6539d3151d2d4e28de28b3e609f95e0f1972d87 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/attention/attention_110rc4.md @@ -0,0 +1,382 @@ +# Multi-Head, Multi-Query, and Group-Query Attention# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0rc4/features/attention.html +Version: 1.1.0rc4 + +This document details the implementation of multi-head attention (MHA), +multi-query attention (MQA), and group-query attention (GQA) for autoregressive +models in TensorRT LLM’s PyTorch backend. + +Multi-head attention involves a sequence of batched matrix multiplications, a softmax operation, and another batched matrix multiplication, +as described in the [Attention Is All You Need](https://arxiv.org/abs/1706.03762) paper. +[Multi-query Attention (MQA)](https://arxiv.org/abs/1911.02150) and [Group-query Attention (GQA)](https://arxiv.org/abs/2307.09288) are +variants of MHA that use fewer KV heads than the number of query heads. +TensorRT LLM provides several implementations using different backends in `tensorrt_llm/_torch/attention_backend/`. +The following sections explain how to use these implementations and provide a brief guide on implementing new backends. + +## Attention Backends[#](#attention-backends "Link to this heading") + +There are currently three available attention backends: the vanilla backend, the TRT-LLM backend, and the Flashinfer backend. +You can specify the desired attention backend using `PyTorchConfig.attn_backend`. For instance, to utilize the Flashinfer backend, you can pass `attn_backend="flashinfer"` to the `LLM` constructor as follows: `LLM(attn_backend="flashinfer")`. This will enable the use of the Flashinfer backend for your model. + +The vanilla backend, `VanillaAttention`, is a reference implementation designed primarily for inflight batching and linear KV cache support. While it serves as a useful baseline, it is not recommended for production use due to its limited optimizations. + +In contrast, the Flashinfer backend, `FlashInferAttention`, is performance-optimized and supports both inflight batching and paged KV cache. It also includes the following advanced features: + +1. **FP8 Quantization**: This feature enables the quantization of inputs and KV cache into FP8 format, significantly reducing memory usage and improving computational throughput. +2. **RoPE Fusion**: By integrating rotary position embedding (RoPE) directly into the attention computation, this feature enhances efficiency and reduces overhead. + +The TRT-LLM backend, `TrtllmAttention`, serves as the default backend and supports all the features available in the Flashinfer backend while being further optimized for enhanced performance. It is the recommended choice for production environments. Additionally, it offers the following advanced features: + +1. **Fused QKV Input**: It can accept a single QKV tensor as input, which is more efficient compared to using separate Q, K, and V tensors. +2. **FP8 Output**: It supports outputting the attention result in FP8 format, fusing quantization into the attention computation process. + +## Implement a New Attention Backend[#](#implement-a-new-attention-backend "Link to this heading") + +You can implement a new attention backend to integrate other attention libraries. +An attention backend consists of an `AttentionBackend` class and an `AttentionMetadata` class. +There are three stages in the PyTorch that involve the attention backend: + +1. Model construction: During the model’s `__init__`, call `AttentionBackend.__init__` to create an attention backend for each layer. +2. Metadata preparation: Before each forward step of the model: + + 1. If the metadata is uninitialized, call `AttentionMetadata.__init__` to create the attention metadata. + 2. If using CUDA graphs, call `AttentionMetadata.create_cuda_graph_metadata` to convert the metadata to CUDA graph metadata, which pre-allocates all tensors and can be used to capture CUDA graphs. Do not re-allocate any tensors stored inside `AttentionMetadata` after the initial warmup run when using CUDA graphs. + 3. To prepare parameters of the input and KV cache, call `AttentionMetadata.prepare` to convert from existing metadata and KV cache manager. +3. Single step forward: During the forward pass of each attention layer, call `AttentionBackend.forward` to perform the attention operation. The `AttentionMetadata` will be provided as a forward argument. + +### Implement `AttentionMetadata`[#](#implement-attentionmetadata "Link to this heading") + +The `AttentionMetadata` class stores metadata from the batched input and KV cache for the attention backend. +It contains the following predefined fields: + +| Field | Type | Description | +| --- | --- | --- | +| max\_num\_requests | int | The max number of requests in a single batch. | +| num\_contexts | int | The number of context-phase sequences in the batch. | +| num\_generations | int | The number of generation-phase sequences in the batch. | +| max\_num\_tokens | int | The max number of tokens in all requests in a single batch. | +| num\_tokens | int | Number of tokens in the batch. | +| num\_ctx\_tokens | int | Number of tokens in sequences in the context phase. | +| kv\_cache\_manager | KVCacheManager | The KV cache manager. | +| is\_cuda\_graph | bool | Whether CUDA graph is enabled. | +| seq\_lens | Tensor | The length of each sequence in the batch. The shape is (batch\_size), and located on CPU memory. | +| seq\_lens\_cuda | Tensor | A copy of `seq_lens` store on the GPU. | +| context\_lens | Tensor | The length of each context-phase sequence in the batch. The shape is (`num_contexts`). | +| position\_ids | Optional[Tensor] | The position of each token in each sequence. May be None if positional embedding is applied outside of the backend. | +| request\_ids | List[int] | The request ID of each sequence in the batch. | +| prompt\_lens | List[int] | The prompt length of each sequence in the batch. | +| kv\_cache\_params | KVCacheParams | The parameters for the KV cache. | + +During `AttentionMetadata.__init__`, you can initialize additional fields for the new attention metadata. +For example, the Flashinfer metadata initializes `decode_wrapper` here. +During `AttentionMetadata.prepare`, the runtime will fill all predefined fields, and you can fill your customized fields according to these predefined fields. +For example, the Flashinfer metadata fills `qo_indptr` by combining `context_lens` and `num_generations` here. + +### Implement `AttentionBackend`[#](#implement-attentionbackend "Link to this heading") + +The `AttentionBackend` delegates the attention operation to the backend implementation. + +Its `__init__` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| layer\_idx | int | The index of the attention layer in the model. | +| num\_heads | int | The number of query heads. | +| head\_dim | int | The size of each attention head `(hidden_size // num_heads)`. | +| num\_kv\_heads | Optional[int] | The number of KV heads. Defaults to num\_heads if None. | +| quant\_config | QuantConfig | Optional quantization configuration. If None, no quantization is applied. | +| pos\_embd\_params | PositionalEmbeddingParams | Optional parameters defining how positional embedding should be applied. If None, positional embedding should be applied by the model before calling the backend. Otherwise, the backend is in-charge of applying positional embedding and may cache K without embedding it first. | + +Its `forward` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| q | Tensor | Query tensor with shape `(num_tokens, num_heads * head_dim)`. | +| k | Tensor | Key tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| v | Tensor | Value tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| metadata | AttentionMetadata | Metadata for the attention operation. | +| attention\_mask | AttentionMask | Optional attention mask. If None, causal mask is applied. | + +For example, the Flashinfer backend calls `append_paged_kv_cache` and then `wrapper.run` to perform the attention operation here. + +## The Features of the `TrtllmAttention` Backend[#](#the-features-of-the-trtllmattention-backend "Link to this heading") + +The following sections introduce some features of the default `TrtllmAttention` backend. + +### Packed Tensors[#](#packed-tensors "Link to this heading") + +In the `TrtllmAttention` backend, the attention operator supports the packed (i.e. non padded) QKV inputs. +A naive layout for the QKV inputs is padding the sequences +that are shorter than the `max_sequence_length` to the maximum +length. It may result in excessive memory consumption as well as unneeded +computations on padding tokens (in the various matrix multiplications that +surround the MHA block). +To overcome that problem, TensorRT LLM supports a mode without padding where +the different tokens are packed together and the user provides the operator +with a 1D tensor containing the lengths of the different sequences. + +### Context and Generation Phases[#](#context-and-generation-phases "Link to this heading") + +The `TrtllmAttention` backend encapsulates different implementations for both +context and generation phases into a single custom torch op. + +#### Context Phase[#](#context-phase "Link to this heading") + +A context-phase implementation without optimization maps to a sequence of GPU kernels that will store the +intermediate `Q*K^T` tensor in memory before calling the softmax operator. It +is the slowest method and the memory footprint is significant (grows quadratically in proportion to the sequence length). + +The `TrtllmAttention` backend will trigger a kernel that performs the MHA/MQA block +using a single kernel instead. For short sequences, that kernel uses a vanilla +implementation of MHA/MQA. For larger sequences, this kernel uses the Flash +Attention algorithm as described in +[FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness](https://arxiv.org/abs/2205.14135) +and +[FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning](https://arxiv.org/abs/2307.08691). + +Currently, the implementation triggers extra kernels that apply pre-processing +to the elements (like RoPE) and populate the KV cache (see below). In a future +release, the number of such kernels may be reduced to improve the overall performance. + +#### FP8 Context FMHA[#](#fp8-context-fmha "Link to this heading") + +When FP8 quantization is activated, the attention can be further accelerated by +enabling FP8 Context FMHA. + +FP8 Paged Context FMHA is also supported with the fp8 quantization workflow. +You need to specify `use_paged_context_fmha = True` for the attention operator. + +Please be aware that this feature is only supported on Ada, Hopper and above. + +#### Generation Phase[#](#generation-phase "Link to this heading") + +The generation phase is implemented using a single kernel called the masked +multi-head attention in TensorRT LLM. That kernel is able to apply +pre-processing on the Q, K, and V elements on-the-fly: it adds the QKV bias, applies +RoPE, and performs dequantization and quantization. TensorRT LLM will continue to add (or +enable) additional features in future releases, such as enabling support for IA3. + +The masked MHA kernel has a special version that distributes the work across +multiple CUDA thread-blocks on the GPU for cases where the GPU occupancy is +low. That mode called multi-block is always enabled. +NVIDIA recommends users to test that mode in scenarios where both the batch +size and the number of heads in the model are relatively small. +The definition of ‘small’ in that context is hard to quantify because it depends on the model of the GPU. +However, NVIDIA currently recommends testing that mode when `batch_size * num_heads` is less than the number of multi-processors on the GPU. +This guidance may be subject to change in the future. + +Note that even if the multi-block mode is enabled, the attention operator will +not immediately trigger the multi-block version of the GPU kernel. There is a +minimum number of tokens (input + generated) that are required for the +multi-block version to become more efficient than the “vanilla” implementation +that uses a single CUDA thread-block per head. It is controlled by an internal +heuristic. + +Another note is that as the masked MHA kernels use shared memory size +proportional to sequence length, so there can be some cases that GPU’s shared +memory is not enough when multi-block mode is not enabled. To get masked MHA kernel to work in those cases, multi-block mode is forced on and a warning message is printed in the log. + +#### XQA Optimization[#](#xqa-optimization "Link to this heading") + +XQA optimization is another optimization for MQA/GQA in the generation phase. +It currently only supports a limited number of model configurations, such as the LLAMA2 70B model. + +Support matrix of the XQA optimization: + +* FP16 / BF16 compute data type. +* FP16 / BF16 / FP8 / INT8 KV cache data type. +* Paged KV cache (8 / 16 / 32 / 64 / 128 tokens per block). + +By default, this is enabled. Note that a heuristic algorithm +is also used to decide whether to use XQA kernel or masked MHA kernel to get +better performance. +If you want to use that kernel whenever possible, set `TRTLLM_FORCE_XQA=1` to force use of the XQA kernel when the model config is supported. +Supported configurations can be found using the `shouldUse` function of the `DecoderXQARunner` class in +`cpp/tensorrt_llm/kernels/decoderMaskedMultiheadAttention/decoderXQARunner.h`. + +### In-flight Batching[#](#in-flight-batching "Link to this heading") + +TensorRT LLM supports in-flight batching of requests (also known as continuous +batching or iteration-level batching) for higher serving throughput. With this feature, +sequences in the context phase can be processed together with sequences in +the generation phase. The purpose of that technique is to better interleave +requests to reduce latency as well as make better use of the GPUs. +For efficiency reasons (1), the support for inflight batching ***requires the +input tensors to be packed (no padding)***. + +***In the current implementation, the sequences that are going through the +context phase must be before the sequences in the generation phase in the input +tensor. For example, for sequences `S0`, `S1` and `S2`, if `S0` and `S2` are in +context phase (and `S1` in generation), tokens from `S0` and `S2` must appear +before the tokens of `S1` in the input tensor***. + +*(1) Padding sequences in the generation phase, that contain a single token, to +the length of the maximum input sequence is inefficient use of resources*. + +### Chunked Context[#](#chunked-context "Link to this heading") + +In the original state, the common behavior was to process all context tokens at +once. This feature splits the context into several chunks. In this way, the +context chunks can be batched with more tokens during the generation phase, +which is expected to increase the total throughput. Chunking contexts also removes +constraints on input length. Except for the last one, the size of the context chunk needs +to be an integer multiple of the kv-cache block size. + +> To enable this feature, the FMHA paged kv-cache also needs to be enabled. + +### KV Cache[#](#kv-cache "Link to this heading") + +In the generation phase, a common optimization is to provide the MHA kernel +with a cache containing the values of the past K and V elements that have +already been computed. That cache is known as the KV cache. TensorRT LLM uses +that technique to accelerate its generation phase. In TensorRT LLM, there is +one KV cache per Transformer layer, which means that there are as many KV +caches as layers in a model. The current version of TensorRT LLM supports two +different types of KV caches: **contiguous** and **paged** KV caches. + +#### Contiguous KV Cache[#](#contiguous-kv-cache "Link to this heading") + +The contiguous KV cache is a monolithic tensor. Its shape is: + +```None +[max_batch_size * max_beam_width, 2, num_heads, max_seqlen, hidden_dim_per_head]. +``` + +That implementation uses a lot more memory than needed when the sequences are +shorter than the maximum sequence length (even if they end up close to the +limit after the generation of many output tokens, it may take a lot of steps to +reach that point). + +#### Paged KV Cache[#](#paged-kv-cache "Link to this heading") + +The paged KV cache decomposes the KV cache into blocks that are distributed to +the different requests by a cache manager during processing. That cache manager +keeps track of the sequences, allocates new blocks from a pool and recycles those +blocks when required. See the implementation of +[`KVCacheManager`](https://github.com/NVIDIA/TensorRT-LLM/tree/HEAD/tensorrt_llm/_torch/pyexecutor/resource_manager.py). + +#### INT8/FP8 KV Caches[#](#int8-fp8-kv-caches "Link to this heading") + +In its current implementation, even if the rest of the network runs in INT8 or +FP8, the attention operator works with FP32, FP16, and BFloat16 inputs and +outputs. However, TensorRT LLM supports INT8 and FP8 +(`QuantMode.INT8_KV_CACHE` and +`QuantMode.FP8_KV_CACHE`) KV caches. + +The attention operator populates the KV cache. When INT8 or FP8 KV caches +are enabled, the input values have to be quantized to 8 bits using a scaling +factor. For quantization, the scaling factor is stored in the +`kv_cache_scaling_factor` tensor. Its shape is `[1]` and only per-tensor +quantization is supported in the current version. Quantization uses inversed scale +since it does multiply as `fp_value * (1.0 / kv_cache_scaling_factor)` in plugin. + +During generation, the values read from the cache are dequantized on-the-fly in +the MHA/MQA kernel. Dequantization is defined as +`quantized_value * kv_cache_scaling_factor`. + +### Sliding Window Attention, Cyclic (Rolling Buffer) KV Cache[#](#sliding-window-attention-cyclic-rolling-buffer-kv-cache "Link to this heading") + +TensorRT LLM has a feature called `Cyclic KV Cache`, which treats the kv cache +as a circular buffer. This means that it only stores the kv cache for the last N +tokens, where N is determined by the `attention_window_size` parameter in +`TrtllmAttention.forward`. When the cache is full, new tokens’ kv cache will +overwrite the “least recently used” caches. + +In the context phase, if the input length surpasses the `attention_window_size`, +`Sliding Window Attention` will be activated. This serves the same function as +the sliding window size. + +This feature helps to reduce the memory footprint of the kv cache when +dealing with very long sequences. + +\_Note that the cyclic kv cache feature doesn’t work with beam searching currently as +the context kv cache are shared across beams. + +### StreamingLLM[#](#streamingllm "Link to this heading") + +The StreamingLLM feature uses a window attention to perform efficient and stable LLM +on long texts, which means that only `N` tokens need to be stored in the KV cache. +Similar to the cyclic KV cache feature in TensorRT LLM, `attention_window_size` +parameter is used to determine `N`. Different from the cyclic KV cache feature, +the first `S` tokens, called sink tokens, are always kept in the attention window, +where `S` is determined by `sink_token_length` parameter. +But in context phase, the self-attentions are dense in the official implementation of +StreamingLLM. It uses all of the tokens for computation and only saves `N` tokens +to the KV cache. + +In addition, the relative position embedding is also changed in StreamingLLM. +When determining the relative distance and adding positional information to tokens, +StreamingLLM use the positions within the cache rather than those in the original text. + +`sink_token_length` is also used to enable this feature. + +### Beam-Search[#](#beam-search "Link to this heading") + +The attention operator supports beam-search. In the context phase, a single +beam is computed per input sequence. In the generation phase, the MHA/MQA/GQA +kernel uses an additional tensor to reconstruct the correct path for each beam. +That tensor is called the `cache_indirection`. Its shape is `[batch_size, beam_width, max_seqlen]`. + +For a sequence `si`, a beam `bi` and a token `ti`, the element +`cache_indirection[si][bi][ti]` is an integer between `0` and `beam_width-1` +that indicates which path in the beam to read the K and V elements from in the +KV cache. This tensor is populated in the sampling stage. + +### Input QKV tensor[#](#input-qkv-tensor "Link to this heading") + +The input QKV tensor packs the Q, K and V tensors (concatenated along the last +dimension) after the projection of the hidden states. It is a 3D tensor. RoPE +and quantization to INT8 or FP8 (when needed) are performed by the GPT +attention operator. + +In packed mode, its shape is `[num_tokens, 3 * hidden_dim]` where +`num_tokens` is the total number of tokens in the batch. For the sequences in +context phase, the number of tokens of a sequence corresponds to its input +length (even if the beam width is greater than `1` for beam search). For the +sequences in generation phase, there are `beam_width` tokens per sequence. The +beam width can be different for each sequence. + +The following pseudo code explains how the number of tokens is computed: + +```None +num_tokens = 0 + +# Add the length of each sequence in context phase. +for seq in context_phase: + num_tokens += seq.length + +# Add the width of the beam for each sequence in generation phase. +for seq in generation_phase: + num_tokens += seq.beam_width +``` + +### Rotary Positional Embedding (RoPE)[#](#rotary-positional-embedding-rope "Link to this heading") + +The attention operator can perform the computation of the Rotary +Positional Embedding (RoPE). When that operation is enabled, +`rotary_embedding_dim` is set to a value greater than 0, it is fused with other +operations. The GPT operator supports GPT-NeoX and GPT-J forms of RoPE by +setting `position_embedding_type` to `PositionEmbeddingType.rope_gpt_neox` +or `PositionEmbeddingType.rope_gptj`. + +### ALiBi[#](#alibi "Link to this heading") + +The attention operator can apply ALiBi to the result of the `Q*K^T` +product. The bias is computed on-the-fly from the ALiBi slopes in the optimized +kernel. + +### Scaling factor(s)[#](#scaling-factor-s "Link to this heading") + +In MHA, the output of the `Q*K^T` product is scaled by a constant value that +is computed as: + +```None +norm_factor = 1.f / (q_scaling * sqrt(head_size)). +``` + +### Cross Attention[#](#cross-attention "Link to this heading") + +On top of the MHA as self attention needed by GPT-style decoder-only models, the attention operator also supports cross attention. + +This enables the attention operator to be more broadly used as a generic decoder component. For example, the Encoder-Decoder model uses it to issue both the self attention and cross attention modules in its Decoder. diff --git a/corpus/docs/nvidia_tensorrt-llm/attention/attention_110rc5.md b/corpus/docs/nvidia_tensorrt-llm/attention/attention_110rc5.md new file mode 100644 index 0000000000000000000000000000000000000000..92535dae499f11d09260d5f90bec7cf43a75c958 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/attention/attention_110rc5.md @@ -0,0 +1,382 @@ +# Multi-Head, Multi-Query, and Group-Query Attention# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0rc5/features/attention.html +Version: 1.1.0rc5 + +This document details the implementation of multi-head attention (MHA), +multi-query attention (MQA), and group-query attention (GQA) for autoregressive +models in TensorRT LLM’s PyTorch backend. + +Multi-head attention involves a sequence of batched matrix multiplications, a softmax operation, and another batched matrix multiplication, +as described in the [Attention Is All You Need](https://arxiv.org/abs/1706.03762) paper. +[Multi-query Attention (MQA)](https://arxiv.org/abs/1911.02150) and [Group-query Attention (GQA)](https://arxiv.org/abs/2307.09288) are +variants of MHA that use fewer KV heads than the number of query heads. +TensorRT LLM provides several implementations using different backends in `tensorrt_llm/_torch/attention_backend/`. +The following sections explain how to use these implementations and provide a brief guide on implementing new backends. + +## Attention Backends[#](#attention-backends "Link to this heading") + +There are currently three available attention backends: the vanilla backend, the TRT-LLM backend, and the Flashinfer backend. +You can specify the desired attention backend using `PyTorchConfig.attn_backend`. For instance, to utilize the Flashinfer backend, you can pass `attn_backend="flashinfer"` to the `LLM` constructor as follows: `LLM(attn_backend="flashinfer")`. This will enable the use of the Flashinfer backend for your model. + +The vanilla backend, `VanillaAttention`, is a reference implementation designed primarily for inflight batching and linear KV cache support. While it serves as a useful baseline, it is not recommended for production use due to its limited optimizations. + +In contrast, the Flashinfer backend, `FlashInferAttention`, is performance-optimized and supports both inflight batching and paged KV cache. It also includes the following advanced features: + +1. **FP8 Quantization**: This feature enables the quantization of inputs and KV cache into FP8 format, significantly reducing memory usage and improving computational throughput. +2. **RoPE Fusion**: By integrating rotary position embedding (RoPE) directly into the attention computation, this feature enhances efficiency and reduces overhead. + +The TRT-LLM backend, `TrtllmAttention`, serves as the default backend and supports all the features available in the Flashinfer backend while being further optimized for enhanced performance. It is the recommended choice for production environments. Additionally, it offers the following advanced features: + +1. **Fused QKV Input**: It can accept a single QKV tensor as input, which is more efficient compared to using separate Q, K, and V tensors. +2. **FP8 Output**: It supports outputting the attention result in FP8 format, fusing quantization into the attention computation process. + +## Implement a New Attention Backend[#](#implement-a-new-attention-backend "Link to this heading") + +You can implement a new attention backend to integrate other attention libraries. +An attention backend consists of an `AttentionBackend` class and an `AttentionMetadata` class. +There are three stages in the PyTorch that involve the attention backend: + +1. Model construction: During the model’s `__init__`, call `AttentionBackend.__init__` to create an attention backend for each layer. +2. Metadata preparation: Before each forward step of the model: + + 1. If the metadata is uninitialized, call `AttentionMetadata.__init__` to create the attention metadata. + 2. If using CUDA graphs, call `AttentionMetadata.create_cuda_graph_metadata` to convert the metadata to CUDA graph metadata, which pre-allocates all tensors and can be used to capture CUDA graphs. Do not re-allocate any tensors stored inside `AttentionMetadata` after the initial warmup run when using CUDA graphs. + 3. To prepare parameters of the input and KV cache, call `AttentionMetadata.prepare` to convert from existing metadata and KV cache manager. +3. Single step forward: During the forward pass of each attention layer, call `AttentionBackend.forward` to perform the attention operation. The `AttentionMetadata` will be provided as a forward argument. + +### Implement `AttentionMetadata`[#](#implement-attentionmetadata "Link to this heading") + +The `AttentionMetadata` class stores metadata from the batched input and KV cache for the attention backend. +It contains the following predefined fields: + +| Field | Type | Description | +| --- | --- | --- | +| max\_num\_requests | int | The max number of requests in a single batch. | +| num\_contexts | int | The number of context-phase sequences in the batch. | +| num\_generations | int | The number of generation-phase sequences in the batch. | +| max\_num\_tokens | int | The max number of tokens in all requests in a single batch. | +| num\_tokens | int | Number of tokens in the batch. | +| num\_ctx\_tokens | int | Number of tokens in sequences in the context phase. | +| kv\_cache\_manager | KVCacheManager | The KV cache manager. | +| is\_cuda\_graph | bool | Whether CUDA graph is enabled. | +| seq\_lens | Tensor | The length of each sequence in the batch. The shape is (batch\_size), and located on CPU memory. | +| seq\_lens\_cuda | Tensor | A copy of `seq_lens` store on the GPU. | +| context\_lens | Tensor | The length of each context-phase sequence in the batch. The shape is (`num_contexts`). | +| position\_ids | Optional[Tensor] | The position of each token in each sequence. May be None if positional embedding is applied outside of the backend. | +| request\_ids | List[int] | The request ID of each sequence in the batch. | +| prompt\_lens | List[int] | The prompt length of each sequence in the batch. | +| kv\_cache\_params | KVCacheParams | The parameters for the KV cache. | + +During `AttentionMetadata.__init__`, you can initialize additional fields for the new attention metadata. +For example, the Flashinfer metadata initializes `decode_wrapper` here. +During `AttentionMetadata.prepare`, the runtime will fill all predefined fields, and you can fill your customized fields according to these predefined fields. +For example, the Flashinfer metadata fills `qo_indptr` by combining `context_lens` and `num_generations` here. + +### Implement `AttentionBackend`[#](#implement-attentionbackend "Link to this heading") + +The `AttentionBackend` delegates the attention operation to the backend implementation. + +Its `__init__` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| layer\_idx | int | The index of the attention layer in the model. | +| num\_heads | int | The number of query heads. | +| head\_dim | int | The size of each attention head `(hidden_size // num_heads)`. | +| num\_kv\_heads | Optional[int] | The number of KV heads. Defaults to num\_heads if None. | +| quant\_config | QuantConfig | Optional quantization configuration. If None, no quantization is applied. | +| pos\_embd\_params | PositionalEmbeddingParams | Optional parameters defining how positional embedding should be applied. If None, positional embedding should be applied by the model before calling the backend. Otherwise, the backend is in-charge of applying positional embedding and may cache K without embedding it first. | + +Its `forward` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| q | Tensor | Query tensor with shape `(num_tokens, num_heads * head_dim)`. | +| k | Tensor | Key tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| v | Tensor | Value tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| metadata | AttentionMetadata | Metadata for the attention operation. | +| attention\_mask | AttentionMask | Optional attention mask. If None, causal mask is applied. | + +For example, the Flashinfer backend calls `append_paged_kv_cache` and then `wrapper.run` to perform the attention operation here. + +## The Features of the `TrtllmAttention` Backend[#](#the-features-of-the-trtllmattention-backend "Link to this heading") + +The following sections introduce some features of the default `TrtllmAttention` backend. + +### Packed Tensors[#](#packed-tensors "Link to this heading") + +In the `TrtllmAttention` backend, the attention operator supports the packed (i.e. non padded) QKV inputs. +A naive layout for the QKV inputs is padding the sequences +that are shorter than the `max_sequence_length` to the maximum +length. It may result in excessive memory consumption as well as unneeded +computations on padding tokens (in the various matrix multiplications that +surround the MHA block). +To overcome that problem, TensorRT LLM supports a mode without padding where +the different tokens are packed together and the user provides the operator +with a 1D tensor containing the lengths of the different sequences. + +### Context and Generation Phases[#](#context-and-generation-phases "Link to this heading") + +The `TrtllmAttention` backend encapsulates different implementations for both +context and generation phases into a single custom torch op. + +#### Context Phase[#](#context-phase "Link to this heading") + +A context-phase implementation without optimization maps to a sequence of GPU kernels that will store the +intermediate `Q*K^T` tensor in memory before calling the softmax operator. It +is the slowest method and the memory footprint is significant (grows quadratically in proportion to the sequence length). + +The `TrtllmAttention` backend will trigger a kernel that performs the MHA/MQA block +using a single kernel instead. For short sequences, that kernel uses a vanilla +implementation of MHA/MQA. For larger sequences, this kernel uses the Flash +Attention algorithm as described in +[FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness](https://arxiv.org/abs/2205.14135) +and +[FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning](https://arxiv.org/abs/2307.08691). + +Currently, the implementation triggers extra kernels that apply pre-processing +to the elements (like RoPE) and populate the KV cache (see below). In a future +release, the number of such kernels may be reduced to improve the overall performance. + +#### FP8 Context FMHA[#](#fp8-context-fmha "Link to this heading") + +When FP8 quantization is activated, the attention can be further accelerated by +enabling FP8 Context FMHA. + +FP8 Paged Context FMHA is also supported with the fp8 quantization workflow. +You need to specify `use_paged_context_fmha = True` for the attention operator. + +Please be aware that this feature is only supported on Ada, Hopper and above. + +#### Generation Phase[#](#generation-phase "Link to this heading") + +The generation phase is implemented using a single kernel called the masked +multi-head attention in TensorRT LLM. That kernel is able to apply +pre-processing on the Q, K, and V elements on-the-fly: it adds the QKV bias, applies +RoPE, and performs dequantization and quantization. TensorRT LLM will continue to add (or +enable) additional features in future releases, such as enabling support for IA3. + +The masked MHA kernel has a special version that distributes the work across +multiple CUDA thread-blocks on the GPU for cases where the GPU occupancy is +low. That mode called multi-block is always enabled. +NVIDIA recommends users to test that mode in scenarios where both the batch +size and the number of heads in the model are relatively small. +The definition of ‘small’ in that context is hard to quantify because it depends on the model of the GPU. +However, NVIDIA currently recommends testing that mode when `batch_size * num_heads` is less than the number of multi-processors on the GPU. +This guidance may be subject to change in the future. + +Note that even if the multi-block mode is enabled, the attention operator will +not immediately trigger the multi-block version of the GPU kernel. There is a +minimum number of tokens (input + generated) that are required for the +multi-block version to become more efficient than the “vanilla” implementation +that uses a single CUDA thread-block per head. It is controlled by an internal +heuristic. + +Another note is that as the masked MHA kernels use shared memory size +proportional to sequence length, so there can be some cases that GPU’s shared +memory is not enough when multi-block mode is not enabled. To get masked MHA kernel to work in those cases, multi-block mode is forced on and a warning message is printed in the log. + +#### XQA Optimization[#](#xqa-optimization "Link to this heading") + +XQA optimization is another optimization for MQA/GQA in the generation phase. +It currently only supports a limited number of model configurations, such as the LLAMA2 70B model. + +Support matrix of the XQA optimization: + +* FP16 / BF16 compute data type. +* FP16 / BF16 / FP8 / INT8 KV cache data type. +* Paged KV cache (8 / 16 / 32 / 64 / 128 tokens per block). + +By default, this is enabled. Note that a heuristic algorithm +is also used to decide whether to use XQA kernel or masked MHA kernel to get +better performance. +If you want to use that kernel whenever possible, set `TRTLLM_FORCE_XQA=1` to force use of the XQA kernel when the model config is supported. +Supported configurations can be found using the `shouldUse` function of the `DecoderXQARunner` class in +`cpp/tensorrt_llm/kernels/decoderMaskedMultiheadAttention/decoderXQARunner.h`. + +### In-flight Batching[#](#in-flight-batching "Link to this heading") + +TensorRT LLM supports in-flight batching of requests (also known as continuous +batching or iteration-level batching) for higher serving throughput. With this feature, +sequences in the context phase can be processed together with sequences in +the generation phase. The purpose of that technique is to better interleave +requests to reduce latency as well as make better use of the GPUs. +For efficiency reasons (1), the support for inflight batching ***requires the +input tensors to be packed (no padding)***. + +***In the current implementation, the sequences that are going through the +context phase must be before the sequences in the generation phase in the input +tensor. For example, for sequences `S0`, `S1` and `S2`, if `S0` and `S2` are in +context phase (and `S1` in generation), tokens from `S0` and `S2` must appear +before the tokens of `S1` in the input tensor***. + +*(1) Padding sequences in the generation phase, that contain a single token, to +the length of the maximum input sequence is inefficient use of resources*. + +### Chunked Context[#](#chunked-context "Link to this heading") + +In the original state, the common behavior was to process all context tokens at +once. This feature splits the context into several chunks. In this way, the +context chunks can be batched with more tokens during the generation phase, +which is expected to increase the total throughput. Chunking contexts also removes +constraints on input length. Except for the last one, the size of the context chunk needs +to be an integer multiple of the kv-cache block size. + +> To enable this feature, the FMHA paged kv-cache also needs to be enabled. + +### KV Cache[#](#kv-cache "Link to this heading") + +In the generation phase, a common optimization is to provide the MHA kernel +with a cache containing the values of the past K and V elements that have +already been computed. That cache is known as the KV cache. TensorRT LLM uses +that technique to accelerate its generation phase. In TensorRT LLM, there is +one KV cache per Transformer layer, which means that there are as many KV +caches as layers in a model. The current version of TensorRT LLM supports two +different types of KV caches: **contiguous** and **paged** KV caches. + +#### Contiguous KV Cache[#](#contiguous-kv-cache "Link to this heading") + +The contiguous KV cache is a monolithic tensor. Its shape is: + +```None +[max_batch_size * max_beam_width, 2, num_heads, max_seqlen, hidden_dim_per_head]. +``` + +That implementation uses a lot more memory than needed when the sequences are +shorter than the maximum sequence length (even if they end up close to the +limit after the generation of many output tokens, it may take a lot of steps to +reach that point). + +#### Paged KV Cache[#](#paged-kv-cache "Link to this heading") + +The paged KV cache decomposes the KV cache into blocks that are distributed to +the different requests by a cache manager during processing. That cache manager +keeps track of the sequences, allocates new blocks from a pool and recycles those +blocks when required. See the implementation of +[`KVCacheManager`](https://github.com/NVIDIA/TensorRT-LLM/tree/HEAD/tensorrt_llm/_torch/pyexecutor/resource_manager.py). + +#### INT8/FP8 KV Caches[#](#int8-fp8-kv-caches "Link to this heading") + +In its current implementation, even if the rest of the network runs in INT8 or +FP8, the attention operator works with FP32, FP16, and BFloat16 inputs and +outputs. However, TensorRT LLM supports INT8 and FP8 +(`QuantMode.INT8_KV_CACHE` and +`QuantMode.FP8_KV_CACHE`) KV caches. + +The attention operator populates the KV cache. When INT8 or FP8 KV caches +are enabled, the input values have to be quantized to 8 bits using a scaling +factor. For quantization, the scaling factor is stored in the +`kv_cache_scaling_factor` tensor. Its shape is `[1]` and only per-tensor +quantization is supported in the current version. Quantization uses inversed scale +since it does multiply as `fp_value * (1.0 / kv_cache_scaling_factor)` in plugin. + +During generation, the values read from the cache are dequantized on-the-fly in +the MHA/MQA kernel. Dequantization is defined as +`quantized_value * kv_cache_scaling_factor`. + +### Sliding Window Attention, Cyclic (Rolling Buffer) KV Cache[#](#sliding-window-attention-cyclic-rolling-buffer-kv-cache "Link to this heading") + +TensorRT LLM has a feature called `Cyclic KV Cache`, which treats the kv cache +as a circular buffer. This means that it only stores the kv cache for the last N +tokens, where N is determined by the `attention_window_size` parameter in +`TrtllmAttention.forward`. When the cache is full, new tokens’ kv cache will +overwrite the “least recently used” caches. + +In the context phase, if the input length surpasses the `attention_window_size`, +`Sliding Window Attention` will be activated. This serves the same function as +the sliding window size. + +This feature helps to reduce the memory footprint of the kv cache when +dealing with very long sequences. + +\_Note that the cyclic kv cache feature doesn’t work with beam searching currently as +the context kv cache are shared across beams. + +### StreamingLLM[#](#streamingllm "Link to this heading") + +The StreamingLLM feature uses a window attention to perform efficient and stable LLM +on long texts, which means that only `N` tokens need to be stored in the KV cache. +Similar to the cyclic KV cache feature in TensorRT LLM, `attention_window_size` +parameter is used to determine `N`. Different from the cyclic KV cache feature, +the first `S` tokens, called sink tokens, are always kept in the attention window, +where `S` is determined by `sink_token_length` parameter. +But in context phase, the self-attentions are dense in the official implementation of +StreamingLLM. It uses all of the tokens for computation and only saves `N` tokens +to the KV cache. + +In addition, the relative position embedding is also changed in StreamingLLM. +When determining the relative distance and adding positional information to tokens, +StreamingLLM use the positions within the cache rather than those in the original text. + +`sink_token_length` is also used to enable this feature. + +### Beam-Search[#](#beam-search "Link to this heading") + +The attention operator supports beam-search. In the context phase, a single +beam is computed per input sequence. In the generation phase, the MHA/MQA/GQA +kernel uses an additional tensor to reconstruct the correct path for each beam. +That tensor is called the `cache_indirection`. Its shape is `[batch_size, beam_width, max_seqlen]`. + +For a sequence `si`, a beam `bi` and a token `ti`, the element +`cache_indirection[si][bi][ti]` is an integer between `0` and `beam_width-1` +that indicates which path in the beam to read the K and V elements from in the +KV cache. This tensor is populated in the sampling stage. + +### Input QKV tensor[#](#input-qkv-tensor "Link to this heading") + +The input QKV tensor packs the Q, K and V tensors (concatenated along the last +dimension) after the projection of the hidden states. It is a 3D tensor. RoPE +and quantization to INT8 or FP8 (when needed) are performed by the GPT +attention operator. + +In packed mode, its shape is `[num_tokens, 3 * hidden_dim]` where +`num_tokens` is the total number of tokens in the batch. For the sequences in +context phase, the number of tokens of a sequence corresponds to its input +length (even if the beam width is greater than `1` for beam search). For the +sequences in generation phase, there are `beam_width` tokens per sequence. The +beam width can be different for each sequence. + +The following pseudo code explains how the number of tokens is computed: + +```None +num_tokens = 0 + +# Add the length of each sequence in context phase. +for seq in context_phase: + num_tokens += seq.length + +# Add the width of the beam for each sequence in generation phase. +for seq in generation_phase: + num_tokens += seq.beam_width +``` + +### Rotary Positional Embedding (RoPE)[#](#rotary-positional-embedding-rope "Link to this heading") + +The attention operator can perform the computation of the Rotary +Positional Embedding (RoPE). When that operation is enabled, +`rotary_embedding_dim` is set to a value greater than 0, it is fused with other +operations. The GPT operator supports GPT-NeoX and GPT-J forms of RoPE by +setting `position_embedding_type` to `PositionEmbeddingType.rope_gpt_neox` +or `PositionEmbeddingType.rope_gptj`. + +### ALiBi[#](#alibi "Link to this heading") + +The attention operator can apply ALiBi to the result of the `Q*K^T` +product. The bias is computed on-the-fly from the ALiBi slopes in the optimized +kernel. + +### Scaling factor(s)[#](#scaling-factor-s "Link to this heading") + +In MHA, the output of the `Q*K^T` product is scaled by a constant value that +is computed as: + +```None +norm_factor = 1.f / (q_scaling * sqrt(head_size)). +``` + +### Cross Attention[#](#cross-attention "Link to this heading") + +On top of the MHA as self attention needed by GPT-style decoder-only models, the attention operator also supports cross attention. + +This enables the attention operator to be more broadly used as a generic decoder component. For example, the Encoder-Decoder model uses it to issue both the self attention and cross attention modules in its Decoder. diff --git a/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc0.md b/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc0.md new file mode 100644 index 0000000000000000000000000000000000000000..478044b0597fdc071f9b73b24866ce6a55acb1aa --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc0.md @@ -0,0 +1,382 @@ +# Multi-Head, Multi-Query, and Group-Query Attention# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc0/features/attention.html +Version: 1.2.0rc0 + +This document details the implementation of multi-head attention (MHA), +multi-query attention (MQA), and group-query attention (GQA) for autoregressive +models in TensorRT LLM’s PyTorch backend. + +Multi-head attention involves a sequence of batched matrix multiplications, a softmax operation, and another batched matrix multiplication, +as described in the [Attention Is All You Need](https://arxiv.org/abs/1706.03762) paper. +[Multi-query Attention (MQA)](https://arxiv.org/abs/1911.02150) and [Group-query Attention (GQA)](https://arxiv.org/abs/2307.09288) are +variants of MHA that use fewer KV heads than the number of query heads. +TensorRT LLM provides several implementations using different backends in `tensorrt_llm/_torch/attention_backend/`. +The following sections explain how to use these implementations and provide a brief guide on implementing new backends. + +## Attention Backends[#](#attention-backends "Link to this heading") + +There are currently three available attention backends: the vanilla backend, the TRT-LLM backend, and the Flashinfer backend. +You can specify the desired attention backend using `PyTorchConfig.attn_backend`. For instance, to utilize the Flashinfer backend, you can pass `attn_backend="flashinfer"` to the `LLM` constructor as follows: `LLM(attn_backend="flashinfer")`. This will enable the use of the Flashinfer backend for your model. + +The vanilla backend, `VanillaAttention`, is a reference implementation designed primarily for inflight batching and linear KV cache support. While it serves as a useful baseline, it is not recommended for production use due to its limited optimizations. + +In contrast, the Flashinfer backend, `FlashInferAttention`, is performance-optimized and supports both inflight batching and paged KV cache. It also includes the following advanced features: + +1. **FP8 Quantization**: This feature enables the quantization of inputs and KV cache into FP8 format, significantly reducing memory usage and improving computational throughput. +2. **RoPE Fusion**: By integrating rotary position embedding (RoPE) directly into the attention computation, this feature enhances efficiency and reduces overhead. + +The TRT-LLM backend, `TrtllmAttention`, serves as the default backend and supports all the features available in the Flashinfer backend while being further optimized for enhanced performance. It is the recommended choice for production environments. Additionally, it offers the following advanced features: + +1. **Fused QKV Input**: It can accept a single QKV tensor as input, which is more efficient compared to using separate Q, K, and V tensors. +2. **FP8 Output**: It supports outputting the attention result in FP8 format, fusing quantization into the attention computation process. + +## Implement a New Attention Backend[#](#implement-a-new-attention-backend "Link to this heading") + +You can implement a new attention backend to integrate other attention libraries. +An attention backend consists of an `AttentionBackend` class and an `AttentionMetadata` class. +There are three stages in the PyTorch that involve the attention backend: + +1. Model construction: During the model’s `__init__`, call `AttentionBackend.__init__` to create an attention backend for each layer. +2. Metadata preparation: Before each forward step of the model: + + 1. If the metadata is uninitialized, call `AttentionMetadata.__init__` to create the attention metadata. + 2. If using CUDA graphs, call `AttentionMetadata.create_cuda_graph_metadata` to convert the metadata to CUDA graph metadata, which pre-allocates all tensors and can be used to capture CUDA graphs. Do not re-allocate any tensors stored inside `AttentionMetadata` after the initial warmup run when using CUDA graphs. + 3. To prepare parameters of the input and KV cache, call `AttentionMetadata.prepare` to convert from existing metadata and KV cache manager. +3. Single step forward: During the forward pass of each attention layer, call `AttentionBackend.forward` to perform the attention operation. The `AttentionMetadata` will be provided as a forward argument. + +### Implement `AttentionMetadata`[#](#implement-attentionmetadata "Link to this heading") + +The `AttentionMetadata` class stores metadata from the batched input and KV cache for the attention backend. +It contains the following predefined fields: + +| Field | Type | Description | +| --- | --- | --- | +| max\_num\_requests | int | The max number of requests in a single batch. | +| num\_contexts | int | The number of context-phase sequences in the batch. | +| num\_generations | int | The number of generation-phase sequences in the batch. | +| max\_num\_tokens | int | The max number of tokens in all requests in a single batch. | +| num\_tokens | int | Number of tokens in the batch. | +| num\_ctx\_tokens | int | Number of tokens in sequences in the context phase. | +| kv\_cache\_manager | KVCacheManager | The KV cache manager. | +| is\_cuda\_graph | bool | Whether CUDA graph is enabled. | +| seq\_lens | Tensor | The length of each sequence in the batch. The shape is (batch\_size), and located on CPU memory. | +| seq\_lens\_cuda | Tensor | A copy of `seq_lens` store on the GPU. | +| context\_lens | Tensor | The length of each context-phase sequence in the batch. The shape is (`num_contexts`). | +| position\_ids | Optional[Tensor] | The position of each token in each sequence. May be None if positional embedding is applied outside of the backend. | +| request\_ids | List[int] | The request ID of each sequence in the batch. | +| prompt\_lens | List[int] | The prompt length of each sequence in the batch. | +| kv\_cache\_params | KVCacheParams | The parameters for the KV cache. | + +During `AttentionMetadata.__init__`, you can initialize additional fields for the new attention metadata. +For example, the Flashinfer metadata initializes `decode_wrapper` here. +During `AttentionMetadata.prepare`, the runtime will fill all predefined fields, and you can fill your customized fields according to these predefined fields. +For example, the Flashinfer metadata fills `qo_indptr` by combining `context_lens` and `num_generations` here. + +### Implement `AttentionBackend`[#](#implement-attentionbackend "Link to this heading") + +The `AttentionBackend` delegates the attention operation to the backend implementation. + +Its `__init__` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| layer\_idx | int | The index of the attention layer in the model. | +| num\_heads | int | The number of query heads. | +| head\_dim | int | The size of each attention head `(hidden_size // num_heads)`. | +| num\_kv\_heads | Optional[int] | The number of KV heads. Defaults to num\_heads if None. | +| quant\_config | QuantConfig | Optional quantization configuration. If None, no quantization is applied. | +| pos\_embd\_params | PositionalEmbeddingParams | Optional parameters defining how positional embedding should be applied. If None, positional embedding should be applied by the model before calling the backend. Otherwise, the backend is in-charge of applying positional embedding and may cache K without embedding it first. | + +Its `forward` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| q | Tensor | Query tensor with shape `(num_tokens, num_heads * head_dim)`. | +| k | Tensor | Key tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| v | Tensor | Value tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| metadata | AttentionMetadata | Metadata for the attention operation. | +| attention\_mask | AttentionMask | Optional attention mask. If None, causal mask is applied. | + +For example, the Flashinfer backend calls `append_paged_kv_cache` and then `wrapper.run` to perform the attention operation here. + +## The Features of the `TrtllmAttention` Backend[#](#the-features-of-the-trtllmattention-backend "Link to this heading") + +The following sections introduce some features of the default `TrtllmAttention` backend. + +### Packed Tensors[#](#packed-tensors "Link to this heading") + +In the `TrtllmAttention` backend, the attention operator supports the packed (i.e. non padded) QKV inputs. +A naive layout for the QKV inputs is padding the sequences +that are shorter than the `max_sequence_length` to the maximum +length. It may result in excessive memory consumption as well as unneeded +computations on padding tokens (in the various matrix multiplications that +surround the MHA block). +To overcome that problem, TensorRT LLM supports a mode without padding where +the different tokens are packed together and the user provides the operator +with a 1D tensor containing the lengths of the different sequences. + +### Context and Generation Phases[#](#context-and-generation-phases "Link to this heading") + +The `TrtllmAttention` backend encapsulates different implementations for both +context and generation phases into a single custom torch op. + +#### Context Phase[#](#context-phase "Link to this heading") + +A context-phase implementation without optimization maps to a sequence of GPU kernels that will store the +intermediate `Q*K^T` tensor in memory before calling the softmax operator. It +is the slowest method and the memory footprint is significant (grows quadratically in proportion to the sequence length). + +The `TrtllmAttention` backend will trigger a kernel that performs the MHA/MQA block +using a single kernel instead. For short sequences, that kernel uses a vanilla +implementation of MHA/MQA. For larger sequences, this kernel uses the Flash +Attention algorithm as described in +[FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness](https://arxiv.org/abs/2205.14135) +and +[FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning](https://arxiv.org/abs/2307.08691). + +Currently, the implementation triggers extra kernels that apply pre-processing +to the elements (like RoPE) and populate the KV cache (see below). In a future +release, the number of such kernels may be reduced to improve the overall performance. + +#### FP8 Context FMHA[#](#fp8-context-fmha "Link to this heading") + +When FP8 quantization is activated, the attention can be further accelerated by +enabling FP8 Context FMHA. + +FP8 Paged Context FMHA is also supported with the fp8 quantization workflow. +You need to specify `use_paged_context_fmha = True` for the attention operator. + +Please be aware that this feature is only supported on Ada, Hopper and above. + +#### Generation Phase[#](#generation-phase "Link to this heading") + +The generation phase is implemented using a single kernel called the masked +multi-head attention in TensorRT LLM. That kernel is able to apply +pre-processing on the Q, K, and V elements on-the-fly: it adds the QKV bias, applies +RoPE, and performs dequantization and quantization. TensorRT LLM will continue to add (or +enable) additional features in future releases, such as enabling support for IA3. + +The masked MHA kernel has a special version that distributes the work across +multiple CUDA thread-blocks on the GPU for cases where the GPU occupancy is +low. That mode called multi-block is always enabled. +NVIDIA recommends users to test that mode in scenarios where both the batch +size and the number of heads in the model are relatively small. +The definition of ‘small’ in that context is hard to quantify because it depends on the model of the GPU. +However, NVIDIA currently recommends testing that mode when `batch_size * num_heads` is less than the number of multi-processors on the GPU. +This guidance may be subject to change in the future. + +Note that even if the multi-block mode is enabled, the attention operator will +not immediately trigger the multi-block version of the GPU kernel. There is a +minimum number of tokens (input + generated) that are required for the +multi-block version to become more efficient than the “vanilla” implementation +that uses a single CUDA thread-block per head. It is controlled by an internal +heuristic. + +Another note is that as the masked MHA kernels use shared memory size +proportional to sequence length, so there can be some cases that GPU’s shared +memory is not enough when multi-block mode is not enabled. To get masked MHA kernel to work in those cases, multi-block mode is forced on and a warning message is printed in the log. + +#### XQA Optimization[#](#xqa-optimization "Link to this heading") + +XQA optimization is another optimization for MQA/GQA in the generation phase. +It currently only supports a limited number of model configurations, such as the LLAMA2 70B model. + +Support matrix of the XQA optimization: + +* FP16 / BF16 compute data type. +* FP16 / BF16 / FP8 / INT8 KV cache data type. +* Paged KV cache (8 / 16 / 32 / 64 / 128 tokens per block). + +By default, this is enabled. Note that a heuristic algorithm +is also used to decide whether to use XQA kernel or masked MHA kernel to get +better performance. +If you want to use that kernel whenever possible, set `TRTLLM_FORCE_XQA=1` to force use of the XQA kernel when the model config is supported. +Supported configurations can be found using the `shouldUse` function of the `DecoderXQARunner` class in +`cpp/tensorrt_llm/kernels/decoderMaskedMultiheadAttention/decoderXQARunner.h`. + +### In-flight Batching[#](#in-flight-batching "Link to this heading") + +TensorRT LLM supports in-flight batching of requests (also known as continuous +batching or iteration-level batching) for higher serving throughput. With this feature, +sequences in the context phase can be processed together with sequences in +the generation phase. The purpose of that technique is to better interleave +requests to reduce latency as well as make better use of the GPUs. +For efficiency reasons (1), the support for inflight batching ***requires the +input tensors to be packed (no padding)***. + +***In the current implementation, the sequences that are going through the +context phase must be before the sequences in the generation phase in the input +tensor. For example, for sequences `S0`, `S1` and `S2`, if `S0` and `S2` are in +context phase (and `S1` in generation), tokens from `S0` and `S2` must appear +before the tokens of `S1` in the input tensor***. + +*(1) Padding sequences in the generation phase, that contain a single token, to +the length of the maximum input sequence is inefficient use of resources*. + +### Chunked Context[#](#chunked-context "Link to this heading") + +In the original state, the common behavior was to process all context tokens at +once. This feature splits the context into several chunks. In this way, the +context chunks can be batched with more tokens during the generation phase, +which is expected to increase the total throughput. Chunking contexts also removes +constraints on input length. Except for the last one, the size of the context chunk needs +to be an integer multiple of the kv-cache block size. + +> To enable this feature, the FMHA paged kv-cache also needs to be enabled. + +### KV Cache[#](#kv-cache "Link to this heading") + +In the generation phase, a common optimization is to provide the MHA kernel +with a cache containing the values of the past K and V elements that have +already been computed. That cache is known as the KV cache. TensorRT LLM uses +that technique to accelerate its generation phase. In TensorRT LLM, there is +one KV cache per Transformer layer, which means that there are as many KV +caches as layers in a model. The current version of TensorRT LLM supports two +different types of KV caches: **contiguous** and **paged** KV caches. + +#### Contiguous KV Cache[#](#contiguous-kv-cache "Link to this heading") + +The contiguous KV cache is a monolithic tensor. Its shape is: + +```None +[max_batch_size * max_beam_width, 2, num_heads, max_seqlen, hidden_dim_per_head]. +``` + +That implementation uses a lot more memory than needed when the sequences are +shorter than the maximum sequence length (even if they end up close to the +limit after the generation of many output tokens, it may take a lot of steps to +reach that point). + +#### Paged KV Cache[#](#paged-kv-cache "Link to this heading") + +The paged KV cache decomposes the KV cache into blocks that are distributed to +the different requests by a cache manager during processing. That cache manager +keeps track of the sequences, allocates new blocks from a pool and recycles those +blocks when required. See the implementation of +[`KVCacheManager`](https://github.com/NVIDIA/TensorRT-LLM/tree/560ded5/tensorrt_llm/_torch/pyexecutor/resource_manager.py). + +#### INT8/FP8 KV Caches[#](#int8-fp8-kv-caches "Link to this heading") + +In its current implementation, even if the rest of the network runs in INT8 or +FP8, the attention operator works with FP32, FP16, and BFloat16 inputs and +outputs. However, TensorRT LLM supports INT8 and FP8 +(`QuantMode.INT8_KV_CACHE` and +`QuantMode.FP8_KV_CACHE`) KV caches. + +The attention operator populates the KV cache. When INT8 or FP8 KV caches +are enabled, the input values have to be quantized to 8 bits using a scaling +factor. For quantization, the scaling factor is stored in the +`kv_cache_scaling_factor` tensor. Its shape is `[1]` and only per-tensor +quantization is supported in the current version. Quantization uses inversed scale +since it does multiply as `fp_value * (1.0 / kv_cache_scaling_factor)` in plugin. + +During generation, the values read from the cache are dequantized on-the-fly in +the MHA/MQA kernel. Dequantization is defined as +`quantized_value * kv_cache_scaling_factor`. + +### Sliding Window Attention, Cyclic (Rolling Buffer) KV Cache[#](#sliding-window-attention-cyclic-rolling-buffer-kv-cache "Link to this heading") + +TensorRT LLM has a feature called `Cyclic KV Cache`, which treats the kv cache +as a circular buffer. This means that it only stores the kv cache for the last N +tokens, where N is determined by the `attention_window_size` parameter in +`TrtllmAttention.forward`. When the cache is full, new tokens’ kv cache will +overwrite the “least recently used” caches. + +In the context phase, if the input length surpasses the `attention_window_size`, +`Sliding Window Attention` will be activated. This serves the same function as +the sliding window size. + +This feature helps to reduce the memory footprint of the kv cache when +dealing with very long sequences. + +\_Note that the cyclic kv cache feature doesn’t work with beam searching currently as +the context kv cache are shared across beams. + +### StreamingLLM[#](#streamingllm "Link to this heading") + +The StreamingLLM feature uses a window attention to perform efficient and stable LLM +on long texts, which means that only `N` tokens need to be stored in the KV cache. +Similar to the cyclic KV cache feature in TensorRT LLM, `attention_window_size` +parameter is used to determine `N`. Different from the cyclic KV cache feature, +the first `S` tokens, called sink tokens, are always kept in the attention window, +where `S` is determined by `sink_token_length` parameter. +But in context phase, the self-attentions are dense in the official implementation of +StreamingLLM. It uses all of the tokens for computation and only saves `N` tokens +to the KV cache. + +In addition, the relative position embedding is also changed in StreamingLLM. +When determining the relative distance and adding positional information to tokens, +StreamingLLM use the positions within the cache rather than those in the original text. + +`sink_token_length` is also used to enable this feature. + +### Beam-Search[#](#beam-search "Link to this heading") + +The attention operator supports beam-search. In the context phase, a single +beam is computed per input sequence. In the generation phase, the MHA/MQA/GQA +kernel uses an additional tensor to reconstruct the correct path for each beam. +That tensor is called the `cache_indirection`. Its shape is `[batch_size, beam_width, max_seqlen]`. + +For a sequence `si`, a beam `bi` and a token `ti`, the element +`cache_indirection[si][bi][ti]` is an integer between `0` and `beam_width-1` +that indicates which path in the beam to read the K and V elements from in the +KV cache. This tensor is populated in the sampling stage. + +### Input QKV tensor[#](#input-qkv-tensor "Link to this heading") + +The input QKV tensor packs the Q, K and V tensors (concatenated along the last +dimension) after the projection of the hidden states. It is a 3D tensor. RoPE +and quantization to INT8 or FP8 (when needed) are performed by the GPT +attention operator. + +In packed mode, its shape is `[num_tokens, 3 * hidden_dim]` where +`num_tokens` is the total number of tokens in the batch. For the sequences in +context phase, the number of tokens of a sequence corresponds to its input +length (even if the beam width is greater than `1` for beam search). For the +sequences in generation phase, there are `beam_width` tokens per sequence. The +beam width can be different for each sequence. + +The following pseudo code explains how the number of tokens is computed: + +```None +num_tokens = 0 + +# Add the length of each sequence in context phase. +for seq in context_phase: + num_tokens += seq.length + +# Add the width of the beam for each sequence in generation phase. +for seq in generation_phase: + num_tokens += seq.beam_width +``` + +### Rotary Positional Embedding (RoPE)[#](#rotary-positional-embedding-rope "Link to this heading") + +The attention operator can perform the computation of the Rotary +Positional Embedding (RoPE). When that operation is enabled, +`rotary_embedding_dim` is set to a value greater than 0, it is fused with other +operations. The GPT operator supports GPT-NeoX and GPT-J forms of RoPE by +setting `position_embedding_type` to `PositionEmbeddingType.rope_gpt_neox` +or `PositionEmbeddingType.rope_gptj`. + +### ALiBi[#](#alibi "Link to this heading") + +The attention operator can apply ALiBi to the result of the `Q*K^T` +product. The bias is computed on-the-fly from the ALiBi slopes in the optimized +kernel. + +### Scaling factor(s)[#](#scaling-factor-s "Link to this heading") + +In MHA, the output of the `Q*K^T` product is scaled by a constant value that +is computed as: + +```None +norm_factor = 1.f / (q_scaling * sqrt(head_size)). +``` + +### Cross Attention[#](#cross-attention "Link to this heading") + +On top of the MHA as self attention needed by GPT-style decoder-only models, the attention operator also supports cross attention. + +This enables the attention operator to be more broadly used as a generic decoder component. For example, the Encoder-Decoder model uses it to issue both the self attention and cross attention modules in its Decoder. diff --git a/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc1.md b/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc1.md new file mode 100644 index 0000000000000000000000000000000000000000..93939c35745addd6031f42ff29218bf95de51d82 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc1.md @@ -0,0 +1,382 @@ +# Multi-Head, Multi-Query, and Group-Query Attention# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc1/features/attention.html +Version: 1.2.0rc1 + +This document details the implementation of multi-head attention (MHA), +multi-query attention (MQA), and group-query attention (GQA) for autoregressive +models in TensorRT LLM’s PyTorch backend. + +Multi-head attention involves a sequence of batched matrix multiplications, a softmax operation, and another batched matrix multiplication, +as described in the [Attention Is All You Need](https://arxiv.org/abs/1706.03762) paper. +[Multi-query Attention (MQA)](https://arxiv.org/abs/1911.02150) and [Group-query Attention (GQA)](https://arxiv.org/abs/2307.09288) are +variants of MHA that use fewer KV heads than the number of query heads. +TensorRT LLM provides several implementations using different backends in `tensorrt_llm/_torch/attention_backend/`. +The following sections explain how to use these implementations and provide a brief guide on implementing new backends. + +## Attention Backends[#](#attention-backends "Link to this heading") + +There are currently three available attention backends: the vanilla backend, the TRT-LLM backend, and the Flashinfer backend. +You can specify the desired attention backend using `PyTorchConfig.attn_backend`. For instance, to utilize the Flashinfer backend, you can pass `attn_backend="flashinfer"` to the `LLM` constructor as follows: `LLM(attn_backend="flashinfer")`. This will enable the use of the Flashinfer backend for your model. + +The vanilla backend, `VanillaAttention`, is a reference implementation designed primarily for inflight batching and linear KV cache support. While it serves as a useful baseline, it is not recommended for production use due to its limited optimizations. + +In contrast, the Flashinfer backend, `FlashInferAttention`, is performance-optimized and supports both inflight batching and paged KV cache. It also includes the following advanced features: + +1. **FP8 Quantization**: This feature enables the quantization of inputs and KV cache into FP8 format, significantly reducing memory usage and improving computational throughput. +2. **RoPE Fusion**: By integrating rotary position embedding (RoPE) directly into the attention computation, this feature enhances efficiency and reduces overhead. + +The TRT-LLM backend, `TrtllmAttention`, serves as the default backend and supports all the features available in the Flashinfer backend while being further optimized for enhanced performance. It is the recommended choice for production environments. Additionally, it offers the following advanced features: + +1. **Fused QKV Input**: It can accept a single QKV tensor as input, which is more efficient compared to using separate Q, K, and V tensors. +2. **FP8 Output**: It supports outputting the attention result in FP8 format, fusing quantization into the attention computation process. + +## Implement a New Attention Backend[#](#implement-a-new-attention-backend "Link to this heading") + +You can implement a new attention backend to integrate other attention libraries. +An attention backend consists of an `AttentionBackend` class and an `AttentionMetadata` class. +There are three stages in the PyTorch that involve the attention backend: + +1. Model construction: During the model’s `__init__`, call `AttentionBackend.__init__` to create an attention backend for each layer. +2. Metadata preparation: Before each forward step of the model: + + 1. If the metadata is uninitialized, call `AttentionMetadata.__init__` to create the attention metadata. + 2. If using CUDA graphs, call `AttentionMetadata.create_cuda_graph_metadata` to convert the metadata to CUDA graph metadata, which pre-allocates all tensors and can be used to capture CUDA graphs. Do not re-allocate any tensors stored inside `AttentionMetadata` after the initial warmup run when using CUDA graphs. + 3. To prepare parameters of the input and KV cache, call `AttentionMetadata.prepare` to convert from existing metadata and KV cache manager. +3. Single step forward: During the forward pass of each attention layer, call `AttentionBackend.forward` to perform the attention operation. The `AttentionMetadata` will be provided as a forward argument. + +### Implement `AttentionMetadata`[#](#implement-attentionmetadata "Link to this heading") + +The `AttentionMetadata` class stores metadata from the batched input and KV cache for the attention backend. +It contains the following predefined fields: + +| Field | Type | Description | +| --- | --- | --- | +| max\_num\_requests | int | The max number of requests in a single batch. | +| num\_contexts | int | The number of context-phase sequences in the batch. | +| num\_generations | int | The number of generation-phase sequences in the batch. | +| max\_num\_tokens | int | The max number of tokens in all requests in a single batch. | +| num\_tokens | int | Number of tokens in the batch. | +| num\_ctx\_tokens | int | Number of tokens in sequences in the context phase. | +| kv\_cache\_manager | KVCacheManager | The KV cache manager. | +| is\_cuda\_graph | bool | Whether CUDA graph is enabled. | +| seq\_lens | Tensor | The length of each sequence in the batch. The shape is (batch\_size), and located on CPU memory. | +| seq\_lens\_cuda | Tensor | A copy of `seq_lens` store on the GPU. | +| context\_lens | Tensor | The length of each context-phase sequence in the batch. The shape is (`num_contexts`). | +| position\_ids | Optional[Tensor] | The position of each token in each sequence. May be None if positional embedding is applied outside of the backend. | +| request\_ids | List[int] | The request ID of each sequence in the batch. | +| prompt\_lens | List[int] | The prompt length of each sequence in the batch. | +| kv\_cache\_params | KVCacheParams | The parameters for the KV cache. | + +During `AttentionMetadata.__init__`, you can initialize additional fields for the new attention metadata. +For example, the Flashinfer metadata initializes `decode_wrapper` here. +During `AttentionMetadata.prepare`, the runtime will fill all predefined fields, and you can fill your customized fields according to these predefined fields. +For example, the Flashinfer metadata fills `qo_indptr` by combining `context_lens` and `num_generations` here. + +### Implement `AttentionBackend`[#](#implement-attentionbackend "Link to this heading") + +The `AttentionBackend` delegates the attention operation to the backend implementation. + +Its `__init__` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| layer\_idx | int | The index of the attention layer in the model. | +| num\_heads | int | The number of query heads. | +| head\_dim | int | The size of each attention head `(hidden_size // num_heads)`. | +| num\_kv\_heads | Optional[int] | The number of KV heads. Defaults to num\_heads if None. | +| quant\_config | QuantConfig | Optional quantization configuration. If None, no quantization is applied. | +| pos\_embd\_params | PositionalEmbeddingParams | Optional parameters defining how positional embedding should be applied. If None, positional embedding should be applied by the model before calling the backend. Otherwise, the backend is in-charge of applying positional embedding and may cache K without embedding it first. | + +Its `forward` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| q | Tensor | Query tensor with shape `(num_tokens, num_heads * head_dim)`. | +| k | Tensor | Key tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| v | Tensor | Value tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| metadata | AttentionMetadata | Metadata for the attention operation. | +| attention\_mask | AttentionMask | Optional attention mask. If None, causal mask is applied. | + +For example, the Flashinfer backend calls `append_paged_kv_cache` and then `wrapper.run` to perform the attention operation here. + +## The Features of the `TrtllmAttention` Backend[#](#the-features-of-the-trtllmattention-backend "Link to this heading") + +The following sections introduce some features of the default `TrtllmAttention` backend. + +### Packed Tensors[#](#packed-tensors "Link to this heading") + +In the `TrtllmAttention` backend, the attention operator supports the packed (i.e. non padded) QKV inputs. +A naive layout for the QKV inputs is padding the sequences +that are shorter than the `max_sequence_length` to the maximum +length. It may result in excessive memory consumption as well as unneeded +computations on padding tokens (in the various matrix multiplications that +surround the MHA block). +To overcome that problem, TensorRT LLM supports a mode without padding where +the different tokens are packed together and the user provides the operator +with a 1D tensor containing the lengths of the different sequences. + +### Context and Generation Phases[#](#context-and-generation-phases "Link to this heading") + +The `TrtllmAttention` backend encapsulates different implementations for both +context and generation phases into a single custom torch op. + +#### Context Phase[#](#context-phase "Link to this heading") + +A context-phase implementation without optimization maps to a sequence of GPU kernels that will store the +intermediate `Q*K^T` tensor in memory before calling the softmax operator. It +is the slowest method and the memory footprint is significant (grows quadratically in proportion to the sequence length). + +The `TrtllmAttention` backend will trigger a kernel that performs the MHA/MQA block +using a single kernel instead. For short sequences, that kernel uses a vanilla +implementation of MHA/MQA. For larger sequences, this kernel uses the Flash +Attention algorithm as described in +[FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness](https://arxiv.org/abs/2205.14135) +and +[FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning](https://arxiv.org/abs/2307.08691). + +Currently, the implementation triggers extra kernels that apply pre-processing +to the elements (like RoPE) and populate the KV cache (see below). In a future +release, the number of such kernels may be reduced to improve the overall performance. + +#### FP8 Context FMHA[#](#fp8-context-fmha "Link to this heading") + +When FP8 quantization is activated, the attention can be further accelerated by +enabling FP8 Context FMHA. + +FP8 Paged Context FMHA is also supported with the fp8 quantization workflow. +You need to specify `use_paged_context_fmha = True` for the attention operator. + +Please be aware that this feature is only supported on Ada, Hopper and above. + +#### Generation Phase[#](#generation-phase "Link to this heading") + +The generation phase is implemented using a single kernel called the masked +multi-head attention in TensorRT LLM. That kernel is able to apply +pre-processing on the Q, K, and V elements on-the-fly: it adds the QKV bias, applies +RoPE, and performs dequantization and quantization. TensorRT LLM will continue to add (or +enable) additional features in future releases, such as enabling support for IA3. + +The masked MHA kernel has a special version that distributes the work across +multiple CUDA thread-blocks on the GPU for cases where the GPU occupancy is +low. That mode called multi-block is always enabled. +NVIDIA recommends users to test that mode in scenarios where both the batch +size and the number of heads in the model are relatively small. +The definition of ‘small’ in that context is hard to quantify because it depends on the model of the GPU. +However, NVIDIA currently recommends testing that mode when `batch_size * num_heads` is less than the number of multi-processors on the GPU. +This guidance may be subject to change in the future. + +Note that even if the multi-block mode is enabled, the attention operator will +not immediately trigger the multi-block version of the GPU kernel. There is a +minimum number of tokens (input + generated) that are required for the +multi-block version to become more efficient than the “vanilla” implementation +that uses a single CUDA thread-block per head. It is controlled by an internal +heuristic. + +Another note is that as the masked MHA kernels use shared memory size +proportional to sequence length, so there can be some cases that GPU’s shared +memory is not enough when multi-block mode is not enabled. To get masked MHA kernel to work in those cases, multi-block mode is forced on and a warning message is printed in the log. + +#### XQA Optimization[#](#xqa-optimization "Link to this heading") + +XQA optimization is another optimization for MQA/GQA in the generation phase. +It currently only supports a limited number of model configurations, such as the LLAMA2 70B model. + +Support matrix of the XQA optimization: + +* FP16 / BF16 compute data type. +* FP16 / BF16 / FP8 / INT8 KV cache data type. +* Paged KV cache (8 / 16 / 32 / 64 / 128 tokens per block). + +By default, this is enabled. Note that a heuristic algorithm +is also used to decide whether to use XQA kernel or masked MHA kernel to get +better performance. +If you want to use that kernel whenever possible, set `TRTLLM_FORCE_XQA=1` to force use of the XQA kernel when the model config is supported. +Supported configurations can be found using the `shouldUse` function of the `DecoderXQARunner` class in +`cpp/tensorrt_llm/kernels/decoderMaskedMultiheadAttention/decoderXQARunner.h`. + +### In-flight Batching[#](#in-flight-batching "Link to this heading") + +TensorRT LLM supports in-flight batching of requests (also known as continuous +batching or iteration-level batching) for higher serving throughput. With this feature, +sequences in the context phase can be processed together with sequences in +the generation phase. The purpose of that technique is to better interleave +requests to reduce latency as well as make better use of the GPUs. +For efficiency reasons (1), the support for inflight batching ***requires the +input tensors to be packed (no padding)***. + +***In the current implementation, the sequences that are going through the +context phase must be before the sequences in the generation phase in the input +tensor. For example, for sequences `S0`, `S1` and `S2`, if `S0` and `S2` are in +context phase (and `S1` in generation), tokens from `S0` and `S2` must appear +before the tokens of `S1` in the input tensor***. + +*(1) Padding sequences in the generation phase, that contain a single token, to +the length of the maximum input sequence is inefficient use of resources*. + +### Chunked Context[#](#chunked-context "Link to this heading") + +In the original state, the common behavior was to process all context tokens at +once. This feature splits the context into several chunks. In this way, the +context chunks can be batched with more tokens during the generation phase, +which is expected to increase the total throughput. Chunking contexts also removes +constraints on input length. Except for the last one, the size of the context chunk needs +to be an integer multiple of the kv-cache block size. + +> To enable this feature, the FMHA paged kv-cache also needs to be enabled. + +### KV Cache[#](#kv-cache "Link to this heading") + +In the generation phase, a common optimization is to provide the MHA kernel +with a cache containing the values of the past K and V elements that have +already been computed. That cache is known as the KV cache. TensorRT LLM uses +that technique to accelerate its generation phase. In TensorRT LLM, there is +one KV cache per Transformer layer, which means that there are as many KV +caches as layers in a model. The current version of TensorRT LLM supports two +different types of KV caches: **contiguous** and **paged** KV caches. + +#### Contiguous KV Cache[#](#contiguous-kv-cache "Link to this heading") + +The contiguous KV cache is a monolithic tensor. Its shape is: + +```None +[max_batch_size * max_beam_width, 2, num_heads, max_seqlen, hidden_dim_per_head]. +``` + +That implementation uses a lot more memory than needed when the sequences are +shorter than the maximum sequence length (even if they end up close to the +limit after the generation of many output tokens, it may take a lot of steps to +reach that point). + +#### Paged KV Cache[#](#paged-kv-cache "Link to this heading") + +The paged KV cache decomposes the KV cache into blocks that are distributed to +the different requests by a cache manager during processing. That cache manager +keeps track of the sequences, allocates new blocks from a pool and recycles those +blocks when required. See the implementation of +[`KVCacheManager`](https://github.com/NVIDIA/TensorRT-LLM/tree/796891b/tensorrt_llm/_torch/pyexecutor/resource_manager.py). + +#### INT8/FP8 KV Caches[#](#int8-fp8-kv-caches "Link to this heading") + +In its current implementation, even if the rest of the network runs in INT8 or +FP8, the attention operator works with FP32, FP16, and BFloat16 inputs and +outputs. However, TensorRT LLM supports INT8 and FP8 +(`QuantMode.INT8_KV_CACHE` and +`QuantMode.FP8_KV_CACHE`) KV caches. + +The attention operator populates the KV cache. When INT8 or FP8 KV caches +are enabled, the input values have to be quantized to 8 bits using a scaling +factor. For quantization, the scaling factor is stored in the +`kv_cache_scaling_factor` tensor. Its shape is `[1]` and only per-tensor +quantization is supported in the current version. Quantization uses inversed scale +since it does multiply as `fp_value * (1.0 / kv_cache_scaling_factor)` in plugin. + +During generation, the values read from the cache are dequantized on-the-fly in +the MHA/MQA kernel. Dequantization is defined as +`quantized_value * kv_cache_scaling_factor`. + +### Sliding Window Attention, Cyclic (Rolling Buffer) KV Cache[#](#sliding-window-attention-cyclic-rolling-buffer-kv-cache "Link to this heading") + +TensorRT LLM has a feature called `Cyclic KV Cache`, which treats the kv cache +as a circular buffer. This means that it only stores the kv cache for the last N +tokens, where N is determined by the `attention_window_size` parameter in +`TrtllmAttention.forward`. When the cache is full, new tokens’ kv cache will +overwrite the “least recently used” caches. + +In the context phase, if the input length surpasses the `attention_window_size`, +`Sliding Window Attention` will be activated. This serves the same function as +the sliding window size. + +This feature helps to reduce the memory footprint of the kv cache when +dealing with very long sequences. + +\_Note that the cyclic kv cache feature doesn’t work with beam searching currently as +the context kv cache are shared across beams. + +### StreamingLLM[#](#streamingllm "Link to this heading") + +The StreamingLLM feature uses a window attention to perform efficient and stable LLM +on long texts, which means that only `N` tokens need to be stored in the KV cache. +Similar to the cyclic KV cache feature in TensorRT LLM, `attention_window_size` +parameter is used to determine `N`. Different from the cyclic KV cache feature, +the first `S` tokens, called sink tokens, are always kept in the attention window, +where `S` is determined by `sink_token_length` parameter. +But in context phase, the self-attentions are dense in the official implementation of +StreamingLLM. It uses all of the tokens for computation and only saves `N` tokens +to the KV cache. + +In addition, the relative position embedding is also changed in StreamingLLM. +When determining the relative distance and adding positional information to tokens, +StreamingLLM use the positions within the cache rather than those in the original text. + +`sink_token_length` is also used to enable this feature. + +### Beam-Search[#](#beam-search "Link to this heading") + +The attention operator supports beam-search. In the context phase, a single +beam is computed per input sequence. In the generation phase, the MHA/MQA/GQA +kernel uses an additional tensor to reconstruct the correct path for each beam. +That tensor is called the `cache_indirection`. Its shape is `[batch_size, beam_width, max_seqlen]`. + +For a sequence `si`, a beam `bi` and a token `ti`, the element +`cache_indirection[si][bi][ti]` is an integer between `0` and `beam_width-1` +that indicates which path in the beam to read the K and V elements from in the +KV cache. This tensor is populated in the sampling stage. + +### Input QKV tensor[#](#input-qkv-tensor "Link to this heading") + +The input QKV tensor packs the Q, K and V tensors (concatenated along the last +dimension) after the projection of the hidden states. It is a 3D tensor. RoPE +and quantization to INT8 or FP8 (when needed) are performed by the GPT +attention operator. + +In packed mode, its shape is `[num_tokens, 3 * hidden_dim]` where +`num_tokens` is the total number of tokens in the batch. For the sequences in +context phase, the number of tokens of a sequence corresponds to its input +length (even if the beam width is greater than `1` for beam search). For the +sequences in generation phase, there are `beam_width` tokens per sequence. The +beam width can be different for each sequence. + +The following pseudo code explains how the number of tokens is computed: + +```None +num_tokens = 0 + +# Add the length of each sequence in context phase. +for seq in context_phase: + num_tokens += seq.length + +# Add the width of the beam for each sequence in generation phase. +for seq in generation_phase: + num_tokens += seq.beam_width +``` + +### Rotary Positional Embedding (RoPE)[#](#rotary-positional-embedding-rope "Link to this heading") + +The attention operator can perform the computation of the Rotary +Positional Embedding (RoPE). When that operation is enabled, +`rotary_embedding_dim` is set to a value greater than 0, it is fused with other +operations. The GPT operator supports GPT-NeoX and GPT-J forms of RoPE by +setting `position_embedding_type` to `PositionEmbeddingType.rope_gpt_neox` +or `PositionEmbeddingType.rope_gptj`. + +### ALiBi[#](#alibi "Link to this heading") + +The attention operator can apply ALiBi to the result of the `Q*K^T` +product. The bias is computed on-the-fly from the ALiBi slopes in the optimized +kernel. + +### Scaling factor(s)[#](#scaling-factor-s "Link to this heading") + +In MHA, the output of the `Q*K^T` product is scaled by a constant value that +is computed as: + +```None +norm_factor = 1.f / (q_scaling * sqrt(head_size)). +``` + +### Cross Attention[#](#cross-attention "Link to this heading") + +On top of the MHA as self attention needed by GPT-style decoder-only models, the attention operator also supports cross attention. + +This enables the attention operator to be more broadly used as a generic decoder component. For example, the Encoder-Decoder model uses it to issue both the self attention and cross attention modules in its Decoder. diff --git a/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc2.md b/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc2.md new file mode 100644 index 0000000000000000000000000000000000000000..7b1a62235587e14d6fd114b7850530ecf0d6d42b --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc2.md @@ -0,0 +1,382 @@ +# Multi-Head, Multi-Query, and Group-Query Attention# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc2/features/attention.html +Version: 1.2.0rc2 + +This document details the implementation of multi-head attention (MHA), +multi-query attention (MQA), and group-query attention (GQA) for autoregressive +models in TensorRT LLM’s PyTorch backend. + +Multi-head attention involves a sequence of batched matrix multiplications, a softmax operation, and another batched matrix multiplication, +as described in the [Attention Is All You Need](https://arxiv.org/abs/1706.03762) paper. +[Multi-query Attention (MQA)](https://arxiv.org/abs/1911.02150) and [Group-query Attention (GQA)](https://arxiv.org/abs/2307.09288) are +variants of MHA that use fewer KV heads than the number of query heads. +TensorRT LLM provides several implementations using different backends in `tensorrt_llm/_torch/attention_backend/`. +The following sections explain how to use these implementations and provide a brief guide on implementing new backends. + +## Attention Backends[#](#attention-backends "Link to this heading") + +There are currently three available attention backends: the vanilla backend, the TRT-LLM backend, and the Flashinfer backend. +You can specify the desired attention backend using `PyTorchConfig.attn_backend`. For instance, to utilize the Flashinfer backend, you can pass `attn_backend="flashinfer"` to the `LLM` constructor as follows: `LLM(attn_backend="flashinfer")`. This will enable the use of the Flashinfer backend for your model. + +The vanilla backend, `VanillaAttention`, is a reference implementation designed primarily for inflight batching and linear KV cache support. While it serves as a useful baseline, it is not recommended for production use due to its limited optimizations. + +In contrast, the Flashinfer backend, `FlashInferAttention`, is performance-optimized and supports both inflight batching and paged KV cache. It also includes the following advanced features: + +1. **FP8 Quantization**: This feature enables the quantization of inputs and KV cache into FP8 format, significantly reducing memory usage and improving computational throughput. +2. **RoPE Fusion**: By integrating rotary position embedding (RoPE) directly into the attention computation, this feature enhances efficiency and reduces overhead. + +The TRT-LLM backend, `TrtllmAttention`, serves as the default backend and supports all the features available in the Flashinfer backend while being further optimized for enhanced performance. It is the recommended choice for production environments. Additionally, it offers the following advanced features: + +1. **Fused QKV Input**: It can accept a single QKV tensor as input, which is more efficient compared to using separate Q, K, and V tensors. +2. **FP8 Output**: It supports outputting the attention result in FP8 format, fusing quantization into the attention computation process. + +## Implement a New Attention Backend[#](#implement-a-new-attention-backend "Link to this heading") + +You can implement a new attention backend to integrate other attention libraries. +An attention backend consists of an `AttentionBackend` class and an `AttentionMetadata` class. +There are three stages in the PyTorch that involve the attention backend: + +1. Model construction: During the model’s `__init__`, call `AttentionBackend.__init__` to create an attention backend for each layer. +2. Metadata preparation: Before each forward step of the model: + + 1. If the metadata is uninitialized, call `AttentionMetadata.__init__` to create the attention metadata. + 2. If using CUDA graphs, call `AttentionMetadata.create_cuda_graph_metadata` to convert the metadata to CUDA graph metadata, which pre-allocates all tensors and can be used to capture CUDA graphs. Do not re-allocate any tensors stored inside `AttentionMetadata` after the initial warmup run when using CUDA graphs. + 3. To prepare parameters of the input and KV cache, call `AttentionMetadata.prepare` to convert from existing metadata and KV cache manager. +3. Single step forward: During the forward pass of each attention layer, call `AttentionBackend.forward` to perform the attention operation. The `AttentionMetadata` will be provided as a forward argument. + +### Implement `AttentionMetadata`[#](#implement-attentionmetadata "Link to this heading") + +The `AttentionMetadata` class stores metadata from the batched input and KV cache for the attention backend. +It contains the following predefined fields: + +| Field | Type | Description | +| --- | --- | --- | +| max\_num\_requests | int | The max number of requests in a single batch. | +| num\_contexts | int | The number of context-phase sequences in the batch. | +| num\_generations | int | The number of generation-phase sequences in the batch. | +| max\_num\_tokens | int | The max number of tokens in all requests in a single batch. | +| num\_tokens | int | Number of tokens in the batch. | +| num\_ctx\_tokens | int | Number of tokens in sequences in the context phase. | +| kv\_cache\_manager | KVCacheManager | The KV cache manager. | +| is\_cuda\_graph | bool | Whether CUDA graph is enabled. | +| seq\_lens | Tensor | The length of each sequence in the batch. The shape is (batch\_size), and located on CPU memory. | +| seq\_lens\_cuda | Tensor | A copy of `seq_lens` store on the GPU. | +| context\_lens | Tensor | The length of each context-phase sequence in the batch. The shape is (`num_contexts`). | +| position\_ids | Optional[Tensor] | The position of each token in each sequence. May be None if positional embedding is applied outside of the backend. | +| request\_ids | List[int] | The request ID of each sequence in the batch. | +| prompt\_lens | List[int] | The prompt length of each sequence in the batch. | +| kv\_cache\_params | KVCacheParams | The parameters for the KV cache. | + +During `AttentionMetadata.__init__`, you can initialize additional fields for the new attention metadata. +For example, the Flashinfer metadata initializes `decode_wrapper` here. +During `AttentionMetadata.prepare`, the runtime will fill all predefined fields, and you can fill your customized fields according to these predefined fields. +For example, the Flashinfer metadata fills `qo_indptr` by combining `context_lens` and `num_generations` here. + +### Implement `AttentionBackend`[#](#implement-attentionbackend "Link to this heading") + +The `AttentionBackend` delegates the attention operation to the backend implementation. + +Its `__init__` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| layer\_idx | int | The index of the attention layer in the model. | +| num\_heads | int | The number of query heads. | +| head\_dim | int | The size of each attention head `(hidden_size // num_heads)`. | +| num\_kv\_heads | Optional[int] | The number of KV heads. Defaults to num\_heads if None. | +| quant\_config | QuantConfig | Optional quantization configuration. If None, no quantization is applied. | +| pos\_embd\_params | PositionalEmbeddingParams | Optional parameters defining how positional embedding should be applied. If None, positional embedding should be applied by the model before calling the backend. Otherwise, the backend is in-charge of applying positional embedding and may cache K without embedding it first. | + +Its `forward` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| q | Tensor | Query tensor with shape `(num_tokens, num_heads * head_dim)`. | +| k | Tensor | Key tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| v | Tensor | Value tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| metadata | AttentionMetadata | Metadata for the attention operation. | +| attention\_mask | AttentionMask | Optional attention mask. If None, causal mask is applied. | + +For example, the Flashinfer backend calls `append_paged_kv_cache` and then `wrapper.run` to perform the attention operation here. + +## The Features of the `TrtllmAttention` Backend[#](#the-features-of-the-trtllmattention-backend "Link to this heading") + +The following sections introduce some features of the default `TrtllmAttention` backend. + +### Packed Tensors[#](#packed-tensors "Link to this heading") + +In the `TrtllmAttention` backend, the attention operator supports the packed (i.e. non padded) QKV inputs. +A naive layout for the QKV inputs is padding the sequences +that are shorter than the `max_sequence_length` to the maximum +length. It may result in excessive memory consumption as well as unneeded +computations on padding tokens (in the various matrix multiplications that +surround the MHA block). +To overcome that problem, TensorRT LLM supports a mode without padding where +the different tokens are packed together and the user provides the operator +with a 1D tensor containing the lengths of the different sequences. + +### Context and Generation Phases[#](#context-and-generation-phases "Link to this heading") + +The `TrtllmAttention` backend encapsulates different implementations for both +context and generation phases into a single custom torch op. + +#### Context Phase[#](#context-phase "Link to this heading") + +A context-phase implementation without optimization maps to a sequence of GPU kernels that will store the +intermediate `Q*K^T` tensor in memory before calling the softmax operator. It +is the slowest method and the memory footprint is significant (grows quadratically in proportion to the sequence length). + +The `TrtllmAttention` backend will trigger a kernel that performs the MHA/MQA block +using a single kernel instead. For short sequences, that kernel uses a vanilla +implementation of MHA/MQA. For larger sequences, this kernel uses the Flash +Attention algorithm as described in +[FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness](https://arxiv.org/abs/2205.14135) +and +[FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning](https://arxiv.org/abs/2307.08691). + +Currently, the implementation triggers extra kernels that apply pre-processing +to the elements (like RoPE) and populate the KV cache (see below). In a future +release, the number of such kernels may be reduced to improve the overall performance. + +#### FP8 Context FMHA[#](#fp8-context-fmha "Link to this heading") + +When FP8 quantization is activated, the attention can be further accelerated by +enabling FP8 Context FMHA. + +FP8 Paged Context FMHA is also supported with the fp8 quantization workflow. +You need to specify `use_paged_context_fmha = True` for the attention operator. + +Please be aware that this feature is only supported on Ada, Hopper and above. + +#### Generation Phase[#](#generation-phase "Link to this heading") + +The generation phase is implemented using a single kernel called the masked +multi-head attention in TensorRT LLM. That kernel is able to apply +pre-processing on the Q, K, and V elements on-the-fly: it adds the QKV bias, applies +RoPE, and performs dequantization and quantization. TensorRT LLM will continue to add (or +enable) additional features in future releases, such as enabling support for IA3. + +The masked MHA kernel has a special version that distributes the work across +multiple CUDA thread-blocks on the GPU for cases where the GPU occupancy is +low. That mode called multi-block is always enabled. +NVIDIA recommends users to test that mode in scenarios where both the batch +size and the number of heads in the model are relatively small. +The definition of ‘small’ in that context is hard to quantify because it depends on the model of the GPU. +However, NVIDIA currently recommends testing that mode when `batch_size * num_heads` is less than the number of multi-processors on the GPU. +This guidance may be subject to change in the future. + +Note that even if the multi-block mode is enabled, the attention operator will +not immediately trigger the multi-block version of the GPU kernel. There is a +minimum number of tokens (input + generated) that are required for the +multi-block version to become more efficient than the “vanilla” implementation +that uses a single CUDA thread-block per head. It is controlled by an internal +heuristic. + +Another note is that as the masked MHA kernels use shared memory size +proportional to sequence length, so there can be some cases that GPU’s shared +memory is not enough when multi-block mode is not enabled. To get masked MHA kernel to work in those cases, multi-block mode is forced on and a warning message is printed in the log. + +#### XQA Optimization[#](#xqa-optimization "Link to this heading") + +XQA optimization is another optimization for MQA/GQA in the generation phase. +It currently only supports a limited number of model configurations, such as the LLAMA2 70B model. + +Support matrix of the XQA optimization: + +* FP16 / BF16 compute data type. +* FP16 / BF16 / FP8 / INT8 KV cache data type. +* Paged KV cache (8 / 16 / 32 / 64 / 128 tokens per block). + +By default, this is enabled. Note that a heuristic algorithm +is also used to decide whether to use XQA kernel or masked MHA kernel to get +better performance. +If you want to use that kernel whenever possible, set `TRTLLM_FORCE_XQA=1` to force use of the XQA kernel when the model config is supported. +Supported configurations can be found using the `shouldUse` function of the `DecoderXQARunner` class in +`cpp/tensorrt_llm/kernels/decoderMaskedMultiheadAttention/decoderXQARunner.h`. + +### In-flight Batching[#](#in-flight-batching "Link to this heading") + +TensorRT LLM supports in-flight batching of requests (also known as continuous +batching or iteration-level batching) for higher serving throughput. With this feature, +sequences in the context phase can be processed together with sequences in +the generation phase. The purpose of that technique is to better interleave +requests to reduce latency as well as make better use of the GPUs. +For efficiency reasons (1), the support for inflight batching ***requires the +input tensors to be packed (no padding)***. + +***In the current implementation, the sequences that are going through the +context phase must be before the sequences in the generation phase in the input +tensor. For example, for sequences `S0`, `S1` and `S2`, if `S0` and `S2` are in +context phase (and `S1` in generation), tokens from `S0` and `S2` must appear +before the tokens of `S1` in the input tensor***. + +*(1) Padding sequences in the generation phase, that contain a single token, to +the length of the maximum input sequence is inefficient use of resources*. + +### Chunked Context[#](#chunked-context "Link to this heading") + +In the original state, the common behavior was to process all context tokens at +once. This feature splits the context into several chunks. In this way, the +context chunks can be batched with more tokens during the generation phase, +which is expected to increase the total throughput. Chunking contexts also removes +constraints on input length. Except for the last one, the size of the context chunk needs +to be an integer multiple of the kv-cache block size. + +> To enable this feature, the FMHA paged kv-cache also needs to be enabled. + +### KV Cache[#](#kv-cache "Link to this heading") + +In the generation phase, a common optimization is to provide the MHA kernel +with a cache containing the values of the past K and V elements that have +already been computed. That cache is known as the KV cache. TensorRT LLM uses +that technique to accelerate its generation phase. In TensorRT LLM, there is +one KV cache per Transformer layer, which means that there are as many KV +caches as layers in a model. The current version of TensorRT LLM supports two +different types of KV caches: **contiguous** and **paged** KV caches. + +#### Contiguous KV Cache[#](#contiguous-kv-cache "Link to this heading") + +The contiguous KV cache is a monolithic tensor. Its shape is: + +```None +[max_batch_size * max_beam_width, 2, num_heads, max_seqlen, hidden_dim_per_head]. +``` + +That implementation uses a lot more memory than needed when the sequences are +shorter than the maximum sequence length (even if they end up close to the +limit after the generation of many output tokens, it may take a lot of steps to +reach that point). + +#### Paged KV Cache[#](#paged-kv-cache "Link to this heading") + +The paged KV cache decomposes the KV cache into blocks that are distributed to +the different requests by a cache manager during processing. That cache manager +keeps track of the sequences, allocates new blocks from a pool and recycles those +blocks when required. See the implementation of +[`KVCacheManager`](https://github.com/NVIDIA/TensorRT-LLM/tree/3111682/tensorrt_llm/_torch/pyexecutor/resource_manager.py). + +#### INT8/FP8 KV Caches[#](#int8-fp8-kv-caches "Link to this heading") + +In its current implementation, even if the rest of the network runs in INT8 or +FP8, the attention operator works with FP32, FP16, and BFloat16 inputs and +outputs. However, TensorRT LLM supports INT8 and FP8 +(`QuantMode.INT8_KV_CACHE` and +`QuantMode.FP8_KV_CACHE`) KV caches. + +The attention operator populates the KV cache. When INT8 or FP8 KV caches +are enabled, the input values have to be quantized to 8 bits using a scaling +factor. For quantization, the scaling factor is stored in the +`kv_cache_scaling_factor` tensor. Its shape is `[1]` and only per-tensor +quantization is supported in the current version. Quantization uses inversed scale +since it does multiply as `fp_value * (1.0 / kv_cache_scaling_factor)` in plugin. + +During generation, the values read from the cache are dequantized on-the-fly in +the MHA/MQA kernel. Dequantization is defined as +`quantized_value * kv_cache_scaling_factor`. + +### Sliding Window Attention, Cyclic (Rolling Buffer) KV Cache[#](#sliding-window-attention-cyclic-rolling-buffer-kv-cache "Link to this heading") + +TensorRT LLM has a feature called `Cyclic KV Cache`, which treats the kv cache +as a circular buffer. This means that it only stores the kv cache for the last N +tokens, where N is determined by the `attention_window_size` parameter in +`TrtllmAttention.forward`. When the cache is full, new tokens’ kv cache will +overwrite the “least recently used” caches. + +In the context phase, if the input length surpasses the `attention_window_size`, +`Sliding Window Attention` will be activated. This serves the same function as +the sliding window size. + +This feature helps to reduce the memory footprint of the kv cache when +dealing with very long sequences. + +\_Note that the cyclic kv cache feature doesn’t work with beam searching currently as +the context kv cache are shared across beams. + +### StreamingLLM[#](#streamingllm "Link to this heading") + +The StreamingLLM feature uses a window attention to perform efficient and stable LLM +on long texts, which means that only `N` tokens need to be stored in the KV cache. +Similar to the cyclic KV cache feature in TensorRT LLM, `attention_window_size` +parameter is used to determine `N`. Different from the cyclic KV cache feature, +the first `S` tokens, called sink tokens, are always kept in the attention window, +where `S` is determined by `sink_token_length` parameter. +But in context phase, the self-attentions are dense in the official implementation of +StreamingLLM. It uses all of the tokens for computation and only saves `N` tokens +to the KV cache. + +In addition, the relative position embedding is also changed in StreamingLLM. +When determining the relative distance and adding positional information to tokens, +StreamingLLM use the positions within the cache rather than those in the original text. + +`sink_token_length` is also used to enable this feature. + +### Beam-Search[#](#beam-search "Link to this heading") + +The attention operator supports beam-search. In the context phase, a single +beam is computed per input sequence. In the generation phase, the MHA/MQA/GQA +kernel uses an additional tensor to reconstruct the correct path for each beam. +That tensor is called the `cache_indirection`. Its shape is `[batch_size, beam_width, max_seqlen]`. + +For a sequence `si`, a beam `bi` and a token `ti`, the element +`cache_indirection[si][bi][ti]` is an integer between `0` and `beam_width-1` +that indicates which path in the beam to read the K and V elements from in the +KV cache. This tensor is populated in the sampling stage. + +### Input QKV tensor[#](#input-qkv-tensor "Link to this heading") + +The input QKV tensor packs the Q, K and V tensors (concatenated along the last +dimension) after the projection of the hidden states. It is a 3D tensor. RoPE +and quantization to INT8 or FP8 (when needed) are performed by the GPT +attention operator. + +In packed mode, its shape is `[num_tokens, 3 * hidden_dim]` where +`num_tokens` is the total number of tokens in the batch. For the sequences in +context phase, the number of tokens of a sequence corresponds to its input +length (even if the beam width is greater than `1` for beam search). For the +sequences in generation phase, there are `beam_width` tokens per sequence. The +beam width can be different for each sequence. + +The following pseudo code explains how the number of tokens is computed: + +```None +num_tokens = 0 + +# Add the length of each sequence in context phase. +for seq in context_phase: + num_tokens += seq.length + +# Add the width of the beam for each sequence in generation phase. +for seq in generation_phase: + num_tokens += seq.beam_width +``` + +### Rotary Positional Embedding (RoPE)[#](#rotary-positional-embedding-rope "Link to this heading") + +The attention operator can perform the computation of the Rotary +Positional Embedding (RoPE). When that operation is enabled, +`rotary_embedding_dim` is set to a value greater than 0, it is fused with other +operations. The GPT operator supports GPT-NeoX and GPT-J forms of RoPE by +setting `position_embedding_type` to `PositionEmbeddingType.rope_gpt_neox` +or `PositionEmbeddingType.rope_gptj`. + +### ALiBi[#](#alibi "Link to this heading") + +The attention operator can apply ALiBi to the result of the `Q*K^T` +product. The bias is computed on-the-fly from the ALiBi slopes in the optimized +kernel. + +### Scaling factor(s)[#](#scaling-factor-s "Link to this heading") + +In MHA, the output of the `Q*K^T` product is scaled by a constant value that +is computed as: + +```None +norm_factor = 1.f / (q_scaling * sqrt(head_size)). +``` + +### Cross Attention[#](#cross-attention "Link to this heading") + +On top of the MHA as self attention needed by GPT-style decoder-only models, the attention operator also supports cross attention. + +This enables the attention operator to be more broadly used as a generic decoder component. For example, the Encoder-Decoder model uses it to issue both the self attention and cross attention modules in its Decoder. diff --git a/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc3.md b/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc3.md new file mode 100644 index 0000000000000000000000000000000000000000..d0174cadba4157740a4550638b4ce6271bf73c06 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc3.md @@ -0,0 +1,382 @@ +# Multi-Head, Multi-Query, and Group-Query Attention# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc3/features/attention.html +Version: 1.2.0rc3 + +This document details the implementation of multi-head attention (MHA), +multi-query attention (MQA), and group-query attention (GQA) for autoregressive +models in TensorRT LLM’s PyTorch backend. + +Multi-head attention involves a sequence of batched matrix multiplications, a softmax operation, and another batched matrix multiplication, +as described in the [Attention Is All You Need](https://arxiv.org/abs/1706.03762) paper. +[Multi-query Attention (MQA)](https://arxiv.org/abs/1911.02150) and [Group-query Attention (GQA)](https://arxiv.org/abs/2307.09288) are +variants of MHA that use fewer KV heads than the number of query heads. +TensorRT LLM provides several implementations using different backends in `tensorrt_llm/_torch/attention_backend/`. +The following sections explain how to use these implementations and provide a brief guide on implementing new backends. + +## Attention Backends[#](#attention-backends "Link to this heading") + +There are currently three available attention backends: the vanilla backend, the TRT-LLM backend, and the Flashinfer backend. +You can specify the desired attention backend using `PyTorchConfig.attn_backend`. For instance, to utilize the Flashinfer backend, you can pass `attn_backend="flashinfer"` to the `LLM` constructor as follows: `LLM(attn_backend="flashinfer")`. This will enable the use of the Flashinfer backend for your model. + +The vanilla backend, `VanillaAttention`, is a reference implementation designed primarily for inflight batching and linear KV cache support. While it serves as a useful baseline, it is not recommended for production use due to its limited optimizations. + +In contrast, the Flashinfer backend, `FlashInferAttention`, is performance-optimized and supports both inflight batching and paged KV cache. It also includes the following advanced features: + +1. **FP8 Quantization**: This feature enables the quantization of inputs and KV cache into FP8 format, significantly reducing memory usage and improving computational throughput. +2. **RoPE Fusion**: By integrating rotary position embedding (RoPE) directly into the attention computation, this feature enhances efficiency and reduces overhead. + +The TRT-LLM backend, `TrtllmAttention`, serves as the default backend and supports all the features available in the Flashinfer backend while being further optimized for enhanced performance. It is the recommended choice for production environments. Additionally, it offers the following advanced features: + +1. **Fused QKV Input**: It can accept a single QKV tensor as input, which is more efficient compared to using separate Q, K, and V tensors. +2. **FP8 Output**: It supports outputting the attention result in FP8 format, fusing quantization into the attention computation process. + +## Implement a New Attention Backend[#](#implement-a-new-attention-backend "Link to this heading") + +You can implement a new attention backend to integrate other attention libraries. +An attention backend consists of an `AttentionBackend` class and an `AttentionMetadata` class. +There are three stages in the PyTorch that involve the attention backend: + +1. Model construction: During the model’s `__init__`, call `AttentionBackend.__init__` to create an attention backend for each layer. +2. Metadata preparation: Before each forward step of the model: + + 1. If the metadata is uninitialized, call `AttentionMetadata.__init__` to create the attention metadata. + 2. If using CUDA graphs, call `AttentionMetadata.create_cuda_graph_metadata` to convert the metadata to CUDA graph metadata, which pre-allocates all tensors and can be used to capture CUDA graphs. Do not re-allocate any tensors stored inside `AttentionMetadata` after the initial warmup run when using CUDA graphs. + 3. To prepare parameters of the input and KV cache, call `AttentionMetadata.prepare` to convert from existing metadata and KV cache manager. +3. Single step forward: During the forward pass of each attention layer, call `AttentionBackend.forward` to perform the attention operation. The `AttentionMetadata` will be provided as a forward argument. + +### Implement `AttentionMetadata`[#](#implement-attentionmetadata "Link to this heading") + +The `AttentionMetadata` class stores metadata from the batched input and KV cache for the attention backend. +It contains the following predefined fields: + +| Field | Type | Description | +| --- | --- | --- | +| max\_num\_requests | int | The max number of requests in a single batch. | +| num\_contexts | int | The number of context-phase sequences in the batch. | +| num\_generations | int | The number of generation-phase sequences in the batch. | +| max\_num\_tokens | int | The max number of tokens in all requests in a single batch. | +| num\_tokens | int | Number of tokens in the batch. | +| num\_ctx\_tokens | int | Number of tokens in sequences in the context phase. | +| kv\_cache\_manager | KVCacheManager | The KV cache manager. | +| is\_cuda\_graph | bool | Whether CUDA graph is enabled. | +| seq\_lens | Tensor | The length of each sequence in the batch. The shape is (batch\_size), and located on CPU memory. | +| seq\_lens\_cuda | Tensor | A copy of `seq_lens` store on the GPU. | +| context\_lens | Tensor | The length of each context-phase sequence in the batch. The shape is (`num_contexts`). | +| position\_ids | Optional[Tensor] | The position of each token in each sequence. May be None if positional embedding is applied outside of the backend. | +| request\_ids | List[int] | The request ID of each sequence in the batch. | +| prompt\_lens | List[int] | The prompt length of each sequence in the batch. | +| kv\_cache\_params | KVCacheParams | The parameters for the KV cache. | + +During `AttentionMetadata.__init__`, you can initialize additional fields for the new attention metadata. +For example, the Flashinfer metadata initializes `decode_wrapper` here. +During `AttentionMetadata.prepare`, the runtime will fill all predefined fields, and you can fill your customized fields according to these predefined fields. +For example, the Flashinfer metadata fills `qo_indptr` by combining `context_lens` and `num_generations` here. + +### Implement `AttentionBackend`[#](#implement-attentionbackend "Link to this heading") + +The `AttentionBackend` delegates the attention operation to the backend implementation. + +Its `__init__` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| layer\_idx | int | The index of the attention layer in the model. | +| num\_heads | int | The number of query heads. | +| head\_dim | int | The size of each attention head `(hidden_size // num_heads)`. | +| num\_kv\_heads | Optional[int] | The number of KV heads. Defaults to num\_heads if None. | +| quant\_config | QuantConfig | Optional quantization configuration. If None, no quantization is applied. | +| pos\_embd\_params | PositionalEmbeddingParams | Optional parameters defining how positional embedding should be applied. If None, positional embedding should be applied by the model before calling the backend. Otherwise, the backend is in-charge of applying positional embedding and may cache K without embedding it first. | + +Its `forward` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| q | Tensor | Query tensor with shape `(num_tokens, num_heads * head_dim)`. | +| k | Tensor | Key tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| v | Tensor | Value tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| metadata | AttentionMetadata | Metadata for the attention operation. | +| attention\_mask | AttentionMask | Optional attention mask. If None, causal mask is applied. | + +For example, the Flashinfer backend calls `append_paged_kv_cache` and then `wrapper.run` to perform the attention operation here. + +## The Features of the `TrtllmAttention` Backend[#](#the-features-of-the-trtllmattention-backend "Link to this heading") + +The following sections introduce some features of the default `TrtllmAttention` backend. + +### Packed Tensors[#](#packed-tensors "Link to this heading") + +In the `TrtllmAttention` backend, the attention operator supports the packed (i.e. non padded) QKV inputs. +A naive layout for the QKV inputs is padding the sequences +that are shorter than the `max_sequence_length` to the maximum +length. It may result in excessive memory consumption as well as unneeded +computations on padding tokens (in the various matrix multiplications that +surround the MHA block). +To overcome that problem, TensorRT LLM supports a mode without padding where +the different tokens are packed together and the user provides the operator +with a 1D tensor containing the lengths of the different sequences. + +### Context and Generation Phases[#](#context-and-generation-phases "Link to this heading") + +The `TrtllmAttention` backend encapsulates different implementations for both +context and generation phases into a single custom torch op. + +#### Context Phase[#](#context-phase "Link to this heading") + +A context-phase implementation without optimization maps to a sequence of GPU kernels that will store the +intermediate `Q*K^T` tensor in memory before calling the softmax operator. It +is the slowest method and the memory footprint is significant (grows quadratically in proportion to the sequence length). + +The `TrtllmAttention` backend will trigger a kernel that performs the MHA/MQA block +using a single kernel instead. For short sequences, that kernel uses a vanilla +implementation of MHA/MQA. For larger sequences, this kernel uses the Flash +Attention algorithm as described in +[FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness](https://arxiv.org/abs/2205.14135) +and +[FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning](https://arxiv.org/abs/2307.08691). + +Currently, the implementation triggers extra kernels that apply pre-processing +to the elements (like RoPE) and populate the KV cache (see below). In a future +release, the number of such kernels may be reduced to improve the overall performance. + +#### FP8 Context FMHA[#](#fp8-context-fmha "Link to this heading") + +When FP8 quantization is activated, the attention can be further accelerated by +enabling FP8 Context FMHA. + +FP8 Paged Context FMHA is also supported with the fp8 quantization workflow. +You need to specify `use_paged_context_fmha = True` for the attention operator. + +Please be aware that this feature is only supported on Ada, Hopper and above. + +#### Generation Phase[#](#generation-phase "Link to this heading") + +The generation phase is implemented using a single kernel called the masked +multi-head attention in TensorRT LLM. That kernel is able to apply +pre-processing on the Q, K, and V elements on-the-fly: it adds the QKV bias, applies +RoPE, and performs dequantization and quantization. TensorRT LLM will continue to add (or +enable) additional features in future releases, such as enabling support for IA3. + +The masked MHA kernel has a special version that distributes the work across +multiple CUDA thread-blocks on the GPU for cases where the GPU occupancy is +low. That mode called multi-block is always enabled. +NVIDIA recommends users to test that mode in scenarios where both the batch +size and the number of heads in the model are relatively small. +The definition of ‘small’ in that context is hard to quantify because it depends on the model of the GPU. +However, NVIDIA currently recommends testing that mode when `batch_size * num_heads` is less than the number of multi-processors on the GPU. +This guidance may be subject to change in the future. + +Note that even if the multi-block mode is enabled, the attention operator will +not immediately trigger the multi-block version of the GPU kernel. There is a +minimum number of tokens (input + generated) that are required for the +multi-block version to become more efficient than the “vanilla” implementation +that uses a single CUDA thread-block per head. It is controlled by an internal +heuristic. + +Another note is that as the masked MHA kernels use shared memory size +proportional to sequence length, so there can be some cases that GPU’s shared +memory is not enough when multi-block mode is not enabled. To get masked MHA kernel to work in those cases, multi-block mode is forced on and a warning message is printed in the log. + +#### XQA Optimization[#](#xqa-optimization "Link to this heading") + +XQA optimization is another optimization for MQA/GQA in the generation phase. +It currently only supports a limited number of model configurations, such as the LLAMA2 70B model. + +Support matrix of the XQA optimization: + +* FP16 / BF16 compute data type. +* FP16 / BF16 / FP8 / INT8 KV cache data type. +* Paged KV cache (8 / 16 / 32 / 64 / 128 tokens per block). + +By default, this is enabled. Note that a heuristic algorithm +is also used to decide whether to use XQA kernel or masked MHA kernel to get +better performance. +If you want to use that kernel whenever possible, set `TRTLLM_FORCE_XQA=1` to force use of the XQA kernel when the model config is supported. +Supported configurations can be found using the `shouldUse` function of the `DecoderXQARunner` class in +`cpp/tensorrt_llm/kernels/decoderMaskedMultiheadAttention/decoderXQARunner.h`. + +### In-flight Batching[#](#in-flight-batching "Link to this heading") + +TensorRT LLM supports in-flight batching of requests (also known as continuous +batching or iteration-level batching) for higher serving throughput. With this feature, +sequences in the context phase can be processed together with sequences in +the generation phase. The purpose of that technique is to better interleave +requests to reduce latency as well as make better use of the GPUs. +For efficiency reasons (1), the support for inflight batching ***requires the +input tensors to be packed (no padding)***. + +***In the current implementation, the sequences that are going through the +context phase must be before the sequences in the generation phase in the input +tensor. For example, for sequences `S0`, `S1` and `S2`, if `S0` and `S2` are in +context phase (and `S1` in generation), tokens from `S0` and `S2` must appear +before the tokens of `S1` in the input tensor***. + +*(1) Padding sequences in the generation phase, that contain a single token, to +the length of the maximum input sequence is inefficient use of resources*. + +### Chunked Context[#](#chunked-context "Link to this heading") + +In the original state, the common behavior was to process all context tokens at +once. This feature splits the context into several chunks. In this way, the +context chunks can be batched with more tokens during the generation phase, +which is expected to increase the total throughput. Chunking contexts also removes +constraints on input length. Except for the last one, the size of the context chunk needs +to be an integer multiple of the kv-cache block size. + +> To enable this feature, the FMHA paged kv-cache also needs to be enabled. + +### KV Cache[#](#kv-cache "Link to this heading") + +In the generation phase, a common optimization is to provide the MHA kernel +with a cache containing the values of the past K and V elements that have +already been computed. That cache is known as the KV cache. TensorRT LLM uses +that technique to accelerate its generation phase. In TensorRT LLM, there is +one KV cache per Transformer layer, which means that there are as many KV +caches as layers in a model. The current version of TensorRT LLM supports two +different types of KV caches: **contiguous** and **paged** KV caches. + +#### Contiguous KV Cache[#](#contiguous-kv-cache "Link to this heading") + +The contiguous KV cache is a monolithic tensor. Its shape is: + +```None +[max_batch_size * max_beam_width, 2, num_heads, max_seqlen, hidden_dim_per_head]. +``` + +That implementation uses a lot more memory than needed when the sequences are +shorter than the maximum sequence length (even if they end up close to the +limit after the generation of many output tokens, it may take a lot of steps to +reach that point). + +#### Paged KV Cache[#](#paged-kv-cache "Link to this heading") + +The paged KV cache decomposes the KV cache into blocks that are distributed to +the different requests by a cache manager during processing. That cache manager +keeps track of the sequences, allocates new blocks from a pool and recycles those +blocks when required. See the implementation of +[`KVCacheManager`](https://github.com/NVIDIA/TensorRT-LLM/tree/2128f73/tensorrt_llm/_torch/pyexecutor/resource_manager.py). + +#### INT8/FP8 KV Caches[#](#int8-fp8-kv-caches "Link to this heading") + +In its current implementation, even if the rest of the network runs in INT8 or +FP8, the attention operator works with FP32, FP16, and BFloat16 inputs and +outputs. However, TensorRT LLM supports INT8 and FP8 +(`QuantMode.INT8_KV_CACHE` and +`QuantMode.FP8_KV_CACHE`) KV caches. + +The attention operator populates the KV cache. When INT8 or FP8 KV caches +are enabled, the input values have to be quantized to 8 bits using a scaling +factor. For quantization, the scaling factor is stored in the +`kv_cache_scaling_factor` tensor. Its shape is `[1]` and only per-tensor +quantization is supported in the current version. Quantization uses inversed scale +since it does multiply as `fp_value * (1.0 / kv_cache_scaling_factor)` in plugin. + +During generation, the values read from the cache are dequantized on-the-fly in +the MHA/MQA kernel. Dequantization is defined as +`quantized_value * kv_cache_scaling_factor`. + +### Sliding Window Attention, Cyclic (Rolling Buffer) KV Cache[#](#sliding-window-attention-cyclic-rolling-buffer-kv-cache "Link to this heading") + +TensorRT LLM has a feature called `Cyclic KV Cache`, which treats the kv cache +as a circular buffer. This means that it only stores the kv cache for the last N +tokens, where N is determined by the `attention_window_size` parameter in +`TrtllmAttention.forward`. When the cache is full, new tokens’ kv cache will +overwrite the “least recently used” caches. + +In the context phase, if the input length surpasses the `attention_window_size`, +`Sliding Window Attention` will be activated. This serves the same function as +the sliding window size. + +This feature helps to reduce the memory footprint of the kv cache when +dealing with very long sequences. + +\_Note that the cyclic kv cache feature doesn’t work with beam searching currently as +the context kv cache are shared across beams. + +### StreamingLLM[#](#streamingllm "Link to this heading") + +The StreamingLLM feature uses a window attention to perform efficient and stable LLM +on long texts, which means that only `N` tokens need to be stored in the KV cache. +Similar to the cyclic KV cache feature in TensorRT LLM, `attention_window_size` +parameter is used to determine `N`. Different from the cyclic KV cache feature, +the first `S` tokens, called sink tokens, are always kept in the attention window, +where `S` is determined by `sink_token_length` parameter. +But in context phase, the self-attentions are dense in the official implementation of +StreamingLLM. It uses all of the tokens for computation and only saves `N` tokens +to the KV cache. + +In addition, the relative position embedding is also changed in StreamingLLM. +When determining the relative distance and adding positional information to tokens, +StreamingLLM use the positions within the cache rather than those in the original text. + +`sink_token_length` is also used to enable this feature. + +### Beam-Search[#](#beam-search "Link to this heading") + +The attention operator supports beam-search. In the context phase, a single +beam is computed per input sequence. In the generation phase, the MHA/MQA/GQA +kernel uses an additional tensor to reconstruct the correct path for each beam. +That tensor is called the `cache_indirection`. Its shape is `[batch_size, beam_width, max_seqlen]`. + +For a sequence `si`, a beam `bi` and a token `ti`, the element +`cache_indirection[si][bi][ti]` is an integer between `0` and `beam_width-1` +that indicates which path in the beam to read the K and V elements from in the +KV cache. This tensor is populated in the sampling stage. + +### Input QKV tensor[#](#input-qkv-tensor "Link to this heading") + +The input QKV tensor packs the Q, K and V tensors (concatenated along the last +dimension) after the projection of the hidden states. It is a 3D tensor. RoPE +and quantization to INT8 or FP8 (when needed) are performed by the GPT +attention operator. + +In packed mode, its shape is `[num_tokens, 3 * hidden_dim]` where +`num_tokens` is the total number of tokens in the batch. For the sequences in +context phase, the number of tokens of a sequence corresponds to its input +length (even if the beam width is greater than `1` for beam search). For the +sequences in generation phase, there are `beam_width` tokens per sequence. The +beam width can be different for each sequence. + +The following pseudo code explains how the number of tokens is computed: + +```None +num_tokens = 0 + +# Add the length of each sequence in context phase. +for seq in context_phase: + num_tokens += seq.length + +# Add the width of the beam for each sequence in generation phase. +for seq in generation_phase: + num_tokens += seq.beam_width +``` + +### Rotary Positional Embedding (RoPE)[#](#rotary-positional-embedding-rope "Link to this heading") + +The attention operator can perform the computation of the Rotary +Positional Embedding (RoPE). When that operation is enabled, +`rotary_embedding_dim` is set to a value greater than 0, it is fused with other +operations. The GPT operator supports GPT-NeoX and GPT-J forms of RoPE by +setting `position_embedding_type` to `PositionEmbeddingType.rope_gpt_neox` +or `PositionEmbeddingType.rope_gptj`. + +### ALiBi[#](#alibi "Link to this heading") + +The attention operator can apply ALiBi to the result of the `Q*K^T` +product. The bias is computed on-the-fly from the ALiBi slopes in the optimized +kernel. + +### Scaling factor(s)[#](#scaling-factor-s "Link to this heading") + +In MHA, the output of the `Q*K^T` product is scaled by a constant value that +is computed as: + +```None +norm_factor = 1.f / (q_scaling * sqrt(head_size)). +``` + +### Cross Attention[#](#cross-attention "Link to this heading") + +On top of the MHA as self attention needed by GPT-style decoder-only models, the attention operator also supports cross attention. + +This enables the attention operator to be more broadly used as a generic decoder component. For example, the Encoder-Decoder model uses it to issue both the self attention and cross attention modules in its Decoder. diff --git a/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc4.md b/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc4.md new file mode 100644 index 0000000000000000000000000000000000000000..3878cd9370bf449753898a1e93896db90b7c9d7d --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc4.md @@ -0,0 +1,382 @@ +# Multi-Head, Multi-Query, and Group-Query Attention# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc4/features/attention.html +Version: 1.2.0rc4 + +This document details the implementation of multi-head attention (MHA), +multi-query attention (MQA), and group-query attention (GQA) for autoregressive +models in TensorRT LLM’s PyTorch backend. + +Multi-head attention involves a sequence of batched matrix multiplications, a softmax operation, and another batched matrix multiplication, +as described in the [Attention Is All You Need](https://arxiv.org/abs/1706.03762) paper. +[Multi-query Attention (MQA)](https://arxiv.org/abs/1911.02150) and [Group-query Attention (GQA)](https://arxiv.org/abs/2307.09288) are +variants of MHA that use fewer KV heads than the number of query heads. +TensorRT LLM provides several implementations using different backends in `tensorrt_llm/_torch/attention_backend/`. +The following sections explain how to use these implementations and provide a brief guide on implementing new backends. + +## Attention Backends[#](#attention-backends "Link to this heading") + +There are currently three available attention backends: the vanilla backend, the TRT-LLM backend, and the Flashinfer backend. +You can specify the desired attention backend using `PyTorchConfig.attn_backend`. For instance, to utilize the Flashinfer backend, you can pass `attn_backend="flashinfer"` to the `LLM` constructor as follows: `LLM(attn_backend="flashinfer")`. This will enable the use of the Flashinfer backend for your model. + +The vanilla backend, `VanillaAttention`, is a reference implementation designed primarily for inflight batching and linear KV cache support. While it serves as a useful baseline, it is not recommended for production use due to its limited optimizations. + +In contrast, the Flashinfer backend, `FlashInferAttention`, is performance-optimized and supports both inflight batching and paged KV cache. It also includes the following advanced features: + +1. **FP8 Quantization**: This feature enables the quantization of inputs and KV cache into FP8 format, significantly reducing memory usage and improving computational throughput. +2. **RoPE Fusion**: By integrating rotary position embedding (RoPE) directly into the attention computation, this feature enhances efficiency and reduces overhead. + +The TRT-LLM backend, `TrtllmAttention`, serves as the default backend and supports all the features available in the Flashinfer backend while being further optimized for enhanced performance. It is the recommended choice for production environments. Additionally, it offers the following advanced features: + +1. **Fused QKV Input**: It can accept a single QKV tensor as input, which is more efficient compared to using separate Q, K, and V tensors. +2. **FP8 Output**: It supports outputting the attention result in FP8 format, fusing quantization into the attention computation process. + +## Implement a New Attention Backend[#](#implement-a-new-attention-backend "Link to this heading") + +You can implement a new attention backend to integrate other attention libraries. +An attention backend consists of an `AttentionBackend` class and an `AttentionMetadata` class. +There are three stages in the PyTorch that involve the attention backend: + +1. Model construction: During the model’s `__init__`, call `AttentionBackend.__init__` to create an attention backend for each layer. +2. Metadata preparation: Before each forward step of the model: + + 1. If the metadata is uninitialized, call `AttentionMetadata.__init__` to create the attention metadata. + 2. If using CUDA graphs, call `AttentionMetadata.create_cuda_graph_metadata` to convert the metadata to CUDA graph metadata, which pre-allocates all tensors and can be used to capture CUDA graphs. Do not re-allocate any tensors stored inside `AttentionMetadata` after the initial warmup run when using CUDA graphs. + 3. To prepare parameters of the input and KV cache, call `AttentionMetadata.prepare` to convert from existing metadata and KV cache manager. +3. Single step forward: During the forward pass of each attention layer, call `AttentionBackend.forward` to perform the attention operation. The `AttentionMetadata` will be provided as a forward argument. + +### Implement `AttentionMetadata`[#](#implement-attentionmetadata "Link to this heading") + +The `AttentionMetadata` class stores metadata from the batched input and KV cache for the attention backend. +It contains the following predefined fields: + +| Field | Type | Description | +| --- | --- | --- | +| max\_num\_requests | int | The max number of requests in a single batch. | +| num\_contexts | int | The number of context-phase sequences in the batch. | +| num\_generations | int | The number of generation-phase sequences in the batch. | +| max\_num\_tokens | int | The max number of tokens in all requests in a single batch. | +| num\_tokens | int | Number of tokens in the batch. | +| num\_ctx\_tokens | int | Number of tokens in sequences in the context phase. | +| kv\_cache\_manager | KVCacheManager | The KV cache manager. | +| is\_cuda\_graph | bool | Whether CUDA graph is enabled. | +| seq\_lens | Tensor | The length of each sequence in the batch. The shape is (batch\_size), and located on CPU memory. | +| seq\_lens\_cuda | Tensor | A copy of `seq_lens` store on the GPU. | +| context\_lens | Tensor | The length of each context-phase sequence in the batch. The shape is (`num_contexts`). | +| position\_ids | Optional[Tensor] | The position of each token in each sequence. May be None if positional embedding is applied outside of the backend. | +| request\_ids | List[int] | The request ID of each sequence in the batch. | +| prompt\_lens | List[int] | The prompt length of each sequence in the batch. | +| kv\_cache\_params | KVCacheParams | The parameters for the KV cache. | + +During `AttentionMetadata.__init__`, you can initialize additional fields for the new attention metadata. +For example, the Flashinfer metadata initializes `decode_wrapper` here. +During `AttentionMetadata.prepare`, the runtime will fill all predefined fields, and you can fill your customized fields according to these predefined fields. +For example, the Flashinfer metadata fills `qo_indptr` by combining `context_lens` and `num_generations` here. + +### Implement `AttentionBackend`[#](#implement-attentionbackend "Link to this heading") + +The `AttentionBackend` delegates the attention operation to the backend implementation. + +Its `__init__` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| layer\_idx | int | The index of the attention layer in the model. | +| num\_heads | int | The number of query heads. | +| head\_dim | int | The size of each attention head `(hidden_size // num_heads)`. | +| num\_kv\_heads | Optional[int] | The number of KV heads. Defaults to num\_heads if None. | +| quant\_config | QuantConfig | Optional quantization configuration. If None, no quantization is applied. | +| pos\_embd\_params | PositionalEmbeddingParams | Optional parameters defining how positional embedding should be applied. If None, positional embedding should be applied by the model before calling the backend. Otherwise, the backend is in-charge of applying positional embedding and may cache K without embedding it first. | + +Its `forward` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| q | Tensor | Query tensor with shape `(num_tokens, num_heads * head_dim)`. | +| k | Tensor | Key tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| v | Tensor | Value tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| metadata | AttentionMetadata | Metadata for the attention operation. | +| attention\_mask | AttentionMask | Optional attention mask. If None, causal mask is applied. | + +For example, the Flashinfer backend calls `append_paged_kv_cache` and then `wrapper.run` to perform the attention operation here. + +## The Features of the `TrtllmAttention` Backend[#](#the-features-of-the-trtllmattention-backend "Link to this heading") + +The following sections introduce some features of the default `TrtllmAttention` backend. + +### Packed Tensors[#](#packed-tensors "Link to this heading") + +In the `TrtllmAttention` backend, the attention operator supports the packed (i.e. non padded) QKV inputs. +A naive layout for the QKV inputs is padding the sequences +that are shorter than the `max_sequence_length` to the maximum +length. It may result in excessive memory consumption as well as unneeded +computations on padding tokens (in the various matrix multiplications that +surround the MHA block). +To overcome that problem, TensorRT LLM supports a mode without padding where +the different tokens are packed together and the user provides the operator +with a 1D tensor containing the lengths of the different sequences. + +### Context and Generation Phases[#](#context-and-generation-phases "Link to this heading") + +The `TrtllmAttention` backend encapsulates different implementations for both +context and generation phases into a single custom torch op. + +#### Context Phase[#](#context-phase "Link to this heading") + +A context-phase implementation without optimization maps to a sequence of GPU kernels that will store the +intermediate `Q*K^T` tensor in memory before calling the softmax operator. It +is the slowest method and the memory footprint is significant (grows quadratically in proportion to the sequence length). + +The `TrtllmAttention` backend will trigger a kernel that performs the MHA/MQA block +using a single kernel instead. For short sequences, that kernel uses a vanilla +implementation of MHA/MQA. For larger sequences, this kernel uses the Flash +Attention algorithm as described in +[FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness](https://arxiv.org/abs/2205.14135) +and +[FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning](https://arxiv.org/abs/2307.08691). + +Currently, the implementation triggers extra kernels that apply pre-processing +to the elements (like RoPE) and populate the KV cache (see below). In a future +release, the number of such kernels may be reduced to improve the overall performance. + +#### FP8 Context FMHA[#](#fp8-context-fmha "Link to this heading") + +When FP8 quantization is activated, the attention can be further accelerated by +enabling FP8 Context FMHA. + +FP8 Paged Context FMHA is also supported with the fp8 quantization workflow. +You need to specify `use_paged_context_fmha = True` for the attention operator. + +Please be aware that this feature is only supported on Ada, Hopper and above. + +#### Generation Phase[#](#generation-phase "Link to this heading") + +The generation phase is implemented using a single kernel called the masked +multi-head attention in TensorRT LLM. That kernel is able to apply +pre-processing on the Q, K, and V elements on-the-fly: it adds the QKV bias, applies +RoPE, and performs dequantization and quantization. TensorRT LLM will continue to add (or +enable) additional features in future releases, such as enabling support for IA3. + +The masked MHA kernel has a special version that distributes the work across +multiple CUDA thread-blocks on the GPU for cases where the GPU occupancy is +low. That mode called multi-block is always enabled. +NVIDIA recommends users to test that mode in scenarios where both the batch +size and the number of heads in the model are relatively small. +The definition of ‘small’ in that context is hard to quantify because it depends on the model of the GPU. +However, NVIDIA currently recommends testing that mode when `batch_size * num_heads` is less than the number of multi-processors on the GPU. +This guidance may be subject to change in the future. + +Note that even if the multi-block mode is enabled, the attention operator will +not immediately trigger the multi-block version of the GPU kernel. There is a +minimum number of tokens (input + generated) that are required for the +multi-block version to become more efficient than the “vanilla” implementation +that uses a single CUDA thread-block per head. It is controlled by an internal +heuristic. + +Another note is that as the masked MHA kernels use shared memory size +proportional to sequence length, so there can be some cases that GPU’s shared +memory is not enough when multi-block mode is not enabled. To get masked MHA kernel to work in those cases, multi-block mode is forced on and a warning message is printed in the log. + +#### XQA Optimization[#](#xqa-optimization "Link to this heading") + +XQA optimization is another optimization for MQA/GQA in the generation phase. +It currently only supports a limited number of model configurations, such as the LLAMA2 70B model. + +Support matrix of the XQA optimization: + +* FP16 / BF16 compute data type. +* FP16 / BF16 / FP8 / INT8 KV cache data type. +* Paged KV cache (8 / 16 / 32 / 64 / 128 tokens per block). + +By default, this is enabled. Note that a heuristic algorithm +is also used to decide whether to use XQA kernel or masked MHA kernel to get +better performance. +If you want to use that kernel whenever possible, set `TRTLLM_FORCE_XQA=1` to force use of the XQA kernel when the model config is supported. +Supported configurations can be found using the `shouldUse` function of the `DecoderXQARunner` class in +`cpp/tensorrt_llm/kernels/decoderMaskedMultiheadAttention/decoderXQARunner.h`. + +### In-flight Batching[#](#in-flight-batching "Link to this heading") + +TensorRT LLM supports in-flight batching of requests (also known as continuous +batching or iteration-level batching) for higher serving throughput. With this feature, +sequences in the context phase can be processed together with sequences in +the generation phase. The purpose of that technique is to better interleave +requests to reduce latency as well as make better use of the GPUs. +For efficiency reasons (1), the support for inflight batching ***requires the +input tensors to be packed (no padding)***. + +***In the current implementation, the sequences that are going through the +context phase must be before the sequences in the generation phase in the input +tensor. For example, for sequences `S0`, `S1` and `S2`, if `S0` and `S2` are in +context phase (and `S1` in generation), tokens from `S0` and `S2` must appear +before the tokens of `S1` in the input tensor***. + +*(1) Padding sequences in the generation phase, that contain a single token, to +the length of the maximum input sequence is inefficient use of resources*. + +### Chunked Context[#](#chunked-context "Link to this heading") + +In the original state, the common behavior was to process all context tokens at +once. This feature splits the context into several chunks. In this way, the +context chunks can be batched with more tokens during the generation phase, +which is expected to increase the total throughput. Chunking contexts also removes +constraints on input length. Except for the last one, the size of the context chunk needs +to be an integer multiple of the kv-cache block size. + +> To enable this feature, the FMHA paged kv-cache also needs to be enabled. + +### KV Cache[#](#kv-cache "Link to this heading") + +In the generation phase, a common optimization is to provide the MHA kernel +with a cache containing the values of the past K and V elements that have +already been computed. That cache is known as the KV cache. TensorRT LLM uses +that technique to accelerate its generation phase. In TensorRT LLM, there is +one KV cache per Transformer layer, which means that there are as many KV +caches as layers in a model. The current version of TensorRT LLM supports two +different types of KV caches: **contiguous** and **paged** KV caches. + +#### Contiguous KV Cache[#](#contiguous-kv-cache "Link to this heading") + +The contiguous KV cache is a monolithic tensor. Its shape is: + +```None +[max_batch_size * max_beam_width, 2, num_heads, max_seqlen, hidden_dim_per_head]. +``` + +That implementation uses a lot more memory than needed when the sequences are +shorter than the maximum sequence length (even if they end up close to the +limit after the generation of many output tokens, it may take a lot of steps to +reach that point). + +#### Paged KV Cache[#](#paged-kv-cache "Link to this heading") + +The paged KV cache decomposes the KV cache into blocks that are distributed to +the different requests by a cache manager during processing. That cache manager +keeps track of the sequences, allocates new blocks from a pool and recycles those +blocks when required. See the implementation of +[`KVCacheManager`](https://github.com/NVIDIA/TensorRT-LLM/tree/a761585/tensorrt_llm/_torch/pyexecutor/resource_manager.py). + +#### INT8/FP8 KV Caches[#](#int8-fp8-kv-caches "Link to this heading") + +In its current implementation, even if the rest of the network runs in INT8 or +FP8, the attention operator works with FP32, FP16, and BFloat16 inputs and +outputs. However, TensorRT LLM supports INT8 and FP8 +(`QuantMode.INT8_KV_CACHE` and +`QuantMode.FP8_KV_CACHE`) KV caches. + +The attention operator populates the KV cache. When INT8 or FP8 KV caches +are enabled, the input values have to be quantized to 8 bits using a scaling +factor. For quantization, the scaling factor is stored in the +`kv_cache_scaling_factor` tensor. Its shape is `[1]` and only per-tensor +quantization is supported in the current version. Quantization uses inversed scale +since it does multiply as `fp_value * (1.0 / kv_cache_scaling_factor)` in plugin. + +During generation, the values read from the cache are dequantized on-the-fly in +the MHA/MQA kernel. Dequantization is defined as +`quantized_value * kv_cache_scaling_factor`. + +### Sliding Window Attention, Cyclic (Rolling Buffer) KV Cache[#](#sliding-window-attention-cyclic-rolling-buffer-kv-cache "Link to this heading") + +TensorRT LLM has a feature called `Cyclic KV Cache`, which treats the kv cache +as a circular buffer. This means that it only stores the kv cache for the last N +tokens, where N is determined by the `attention_window_size` parameter in +`TrtllmAttention.forward`. When the cache is full, new tokens’ kv cache will +overwrite the “least recently used” caches. + +In the context phase, if the input length surpasses the `attention_window_size`, +`Sliding Window Attention` will be activated. This serves the same function as +the sliding window size. + +This feature helps to reduce the memory footprint of the kv cache when +dealing with very long sequences. + +\_Note that the cyclic kv cache feature doesn’t work with beam searching currently as +the context kv cache are shared across beams. + +### StreamingLLM[#](#streamingllm "Link to this heading") + +The StreamingLLM feature uses a window attention to perform efficient and stable LLM +on long texts, which means that only `N` tokens need to be stored in the KV cache. +Similar to the cyclic KV cache feature in TensorRT LLM, `attention_window_size` +parameter is used to determine `N`. Different from the cyclic KV cache feature, +the first `S` tokens, called sink tokens, are always kept in the attention window, +where `S` is determined by `sink_token_length` parameter. +But in context phase, the self-attentions are dense in the official implementation of +StreamingLLM. It uses all of the tokens for computation and only saves `N` tokens +to the KV cache. + +In addition, the relative position embedding is also changed in StreamingLLM. +When determining the relative distance and adding positional information to tokens, +StreamingLLM use the positions within the cache rather than those in the original text. + +`sink_token_length` is also used to enable this feature. + +### Beam-Search[#](#beam-search "Link to this heading") + +The attention operator supports beam-search. In the context phase, a single +beam is computed per input sequence. In the generation phase, the MHA/MQA/GQA +kernel uses an additional tensor to reconstruct the correct path for each beam. +That tensor is called the `cache_indirection`. Its shape is `[batch_size, beam_width, max_seqlen]`. + +For a sequence `si`, a beam `bi` and a token `ti`, the element +`cache_indirection[si][bi][ti]` is an integer between `0` and `beam_width-1` +that indicates which path in the beam to read the K and V elements from in the +KV cache. This tensor is populated in the sampling stage. + +### Input QKV tensor[#](#input-qkv-tensor "Link to this heading") + +The input QKV tensor packs the Q, K and V tensors (concatenated along the last +dimension) after the projection of the hidden states. It is a 3D tensor. RoPE +and quantization to INT8 or FP8 (when needed) are performed by the GPT +attention operator. + +In packed mode, its shape is `[num_tokens, 3 * hidden_dim]` where +`num_tokens` is the total number of tokens in the batch. For the sequences in +context phase, the number of tokens of a sequence corresponds to its input +length (even if the beam width is greater than `1` for beam search). For the +sequences in generation phase, there are `beam_width` tokens per sequence. The +beam width can be different for each sequence. + +The following pseudo code explains how the number of tokens is computed: + +```None +num_tokens = 0 + +# Add the length of each sequence in context phase. +for seq in context_phase: + num_tokens += seq.length + +# Add the width of the beam for each sequence in generation phase. +for seq in generation_phase: + num_tokens += seq.beam_width +``` + +### Rotary Positional Embedding (RoPE)[#](#rotary-positional-embedding-rope "Link to this heading") + +The attention operator can perform the computation of the Rotary +Positional Embedding (RoPE). When that operation is enabled, +`rotary_embedding_dim` is set to a value greater than 0, it is fused with other +operations. The GPT operator supports GPT-NeoX and GPT-J forms of RoPE by +setting `position_embedding_type` to `PositionEmbeddingType.rope_gpt_neox` +or `PositionEmbeddingType.rope_gptj`. + +### ALiBi[#](#alibi "Link to this heading") + +The attention operator can apply ALiBi to the result of the `Q*K^T` +product. The bias is computed on-the-fly from the ALiBi slopes in the optimized +kernel. + +### Scaling factor(s)[#](#scaling-factor-s "Link to this heading") + +In MHA, the output of the `Q*K^T` product is scaled by a constant value that +is computed as: + +```None +norm_factor = 1.f / (q_scaling * sqrt(head_size)). +``` + +### Cross Attention[#](#cross-attention "Link to this heading") + +On top of the MHA as self attention needed by GPT-style decoder-only models, the attention operator also supports cross attention. + +This enables the attention operator to be more broadly used as a generic decoder component. For example, the Encoder-Decoder model uses it to issue both the self attention and cross attention modules in its Decoder. diff --git a/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc5.md b/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc5.md new file mode 100644 index 0000000000000000000000000000000000000000..156b9f1141665ee2310dcf0369f248b6f283bf09 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc5.md @@ -0,0 +1,382 @@ +# Multi-Head, Multi-Query, and Group-Query Attention# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc5/features/attention.html +Version: 1.2.0rc5 + +This document details the implementation of multi-head attention (MHA), +multi-query attention (MQA), and group-query attention (GQA) for autoregressive +models in TensorRT LLM’s PyTorch backend. + +Multi-head attention involves a sequence of batched matrix multiplications, a softmax operation, and another batched matrix multiplication, +as described in the [Attention Is All You Need](https://arxiv.org/abs/1706.03762) paper. +[Multi-query Attention (MQA)](https://arxiv.org/abs/1911.02150) and [Group-query Attention (GQA)](https://arxiv.org/abs/2307.09288) are +variants of MHA that use fewer KV heads than the number of query heads. +TensorRT LLM provides several implementations using different backends in `tensorrt_llm/_torch/attention_backend/`. +The following sections explain how to use these implementations and provide a brief guide on implementing new backends. + +## Attention Backends[#](#attention-backends "Link to this heading") + +There are currently three available attention backends: the vanilla backend, the TRT-LLM backend, and the Flashinfer backend. +You can specify the desired attention backend using `PyTorchConfig.attn_backend`. For instance, to utilize the Flashinfer backend, you can pass `attn_backend="flashinfer"` to the `LLM` constructor as follows: `LLM(attn_backend="flashinfer")`. This will enable the use of the Flashinfer backend for your model. + +The vanilla backend, `VanillaAttention`, is a reference implementation designed primarily for inflight batching and linear KV cache support. While it serves as a useful baseline, it is not recommended for production use due to its limited optimizations. + +In contrast, the Flashinfer backend, `FlashInferAttention`, is performance-optimized and supports both inflight batching and paged KV cache. It also includes the following advanced features: + +1. **FP8 Quantization**: This feature enables the quantization of inputs and KV cache into FP8 format, significantly reducing memory usage and improving computational throughput. +2. **RoPE Fusion**: By integrating rotary position embedding (RoPE) directly into the attention computation, this feature enhances efficiency and reduces overhead. + +The TRT-LLM backend, `TrtllmAttention`, serves as the default backend and supports all the features available in the Flashinfer backend while being further optimized for enhanced performance. It is the recommended choice for production environments. Additionally, it offers the following advanced features: + +1. **Fused QKV Input**: It can accept a single QKV tensor as input, which is more efficient compared to using separate Q, K, and V tensors. +2. **FP8 Output**: It supports outputting the attention result in FP8 format, fusing quantization into the attention computation process. + +## Implement a New Attention Backend[#](#implement-a-new-attention-backend "Link to this heading") + +You can implement a new attention backend to integrate other attention libraries. +An attention backend consists of an `AttentionBackend` class and an `AttentionMetadata` class. +There are three stages in the PyTorch that involve the attention backend: + +1. Model construction: During the model’s `__init__`, call `AttentionBackend.__init__` to create an attention backend for each layer. +2. Metadata preparation: Before each forward step of the model: + + 1. If the metadata is uninitialized, call `AttentionMetadata.__init__` to create the attention metadata. + 2. If using CUDA graphs, call `AttentionMetadata.create_cuda_graph_metadata` to convert the metadata to CUDA graph metadata, which pre-allocates all tensors and can be used to capture CUDA graphs. Do not re-allocate any tensors stored inside `AttentionMetadata` after the initial warmup run when using CUDA graphs. + 3. To prepare parameters of the input and KV cache, call `AttentionMetadata.prepare` to convert from existing metadata and KV cache manager. +3. Single step forward: During the forward pass of each attention layer, call `AttentionBackend.forward` to perform the attention operation. The `AttentionMetadata` will be provided as a forward argument. + +### Implement `AttentionMetadata`[#](#implement-attentionmetadata "Link to this heading") + +The `AttentionMetadata` class stores metadata from the batched input and KV cache for the attention backend. +It contains the following predefined fields: + +| Field | Type | Description | +| --- | --- | --- | +| max\_num\_requests | int | The max number of requests in a single batch. | +| num\_contexts | int | The number of context-phase sequences in the batch. | +| num\_generations | int | The number of generation-phase sequences in the batch. | +| max\_num\_tokens | int | The max number of tokens in all requests in a single batch. | +| num\_tokens | int | Number of tokens in the batch. | +| num\_ctx\_tokens | int | Number of tokens in sequences in the context phase. | +| kv\_cache\_manager | KVCacheManager | The KV cache manager. | +| is\_cuda\_graph | bool | Whether CUDA graph is enabled. | +| seq\_lens | Tensor | The length of each sequence in the batch. The shape is (batch\_size), and located on CPU memory. | +| seq\_lens\_cuda | Tensor | A copy of `seq_lens` store on the GPU. | +| context\_lens | Tensor | The length of each context-phase sequence in the batch. The shape is (`num_contexts`). | +| position\_ids | Optional[Tensor] | The position of each token in each sequence. May be None if positional embedding is applied outside of the backend. | +| request\_ids | List[int] | The request ID of each sequence in the batch. | +| prompt\_lens | List[int] | The prompt length of each sequence in the batch. | +| kv\_cache\_params | KVCacheParams | The parameters for the KV cache. | + +During `AttentionMetadata.__init__`, you can initialize additional fields for the new attention metadata. +For example, the Flashinfer metadata initializes `decode_wrapper` here. +During `AttentionMetadata.prepare`, the runtime will fill all predefined fields, and you can fill your customized fields according to these predefined fields. +For example, the Flashinfer metadata fills `qo_indptr` by combining `context_lens` and `num_generations` here. + +### Implement `AttentionBackend`[#](#implement-attentionbackend "Link to this heading") + +The `AttentionBackend` delegates the attention operation to the backend implementation. + +Its `__init__` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| layer\_idx | int | The index of the attention layer in the model. | +| num\_heads | int | The number of query heads. | +| head\_dim | int | The size of each attention head `(hidden_size // num_heads)`. | +| num\_kv\_heads | Optional[int] | The number of KV heads. Defaults to num\_heads if None. | +| quant\_config | QuantConfig | Optional quantization configuration. If None, no quantization is applied. | +| pos\_embd\_params | PositionalEmbeddingParams | Optional parameters defining how positional embedding should be applied. If None, positional embedding should be applied by the model before calling the backend. Otherwise, the backend is in-charge of applying positional embedding and may cache K without embedding it first. | + +Its `forward` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| q | Tensor | Query tensor with shape `(num_tokens, num_heads * head_dim)`. | +| k | Tensor | Key tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| v | Tensor | Value tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| metadata | AttentionMetadata | Metadata for the attention operation. | +| attention\_mask | AttentionMask | Optional attention mask. If None, causal mask is applied. | + +For example, the Flashinfer backend calls `append_paged_kv_cache` and then `wrapper.run` to perform the attention operation here. + +## The Features of the `TrtllmAttention` Backend[#](#the-features-of-the-trtllmattention-backend "Link to this heading") + +The following sections introduce some features of the default `TrtllmAttention` backend. + +### Packed Tensors[#](#packed-tensors "Link to this heading") + +In the `TrtllmAttention` backend, the attention operator supports the packed (i.e. non padded) QKV inputs. +A naive layout for the QKV inputs is padding the sequences +that are shorter than the `max_sequence_length` to the maximum +length. It may result in excessive memory consumption as well as unneeded +computations on padding tokens (in the various matrix multiplications that +surround the MHA block). +To overcome that problem, TensorRT LLM supports a mode without padding where +the different tokens are packed together and the user provides the operator +with a 1D tensor containing the lengths of the different sequences. + +### Context and Generation Phases[#](#context-and-generation-phases "Link to this heading") + +The `TrtllmAttention` backend encapsulates different implementations for both +context and generation phases into a single custom torch op. + +#### Context Phase[#](#context-phase "Link to this heading") + +A context-phase implementation without optimization maps to a sequence of GPU kernels that will store the +intermediate `Q*K^T` tensor in memory before calling the softmax operator. It +is the slowest method and the memory footprint is significant (grows quadratically in proportion to the sequence length). + +The `TrtllmAttention` backend will trigger a kernel that performs the MHA/MQA block +using a single kernel instead. For short sequences, that kernel uses a vanilla +implementation of MHA/MQA. For larger sequences, this kernel uses the Flash +Attention algorithm as described in +[FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness](https://arxiv.org/abs/2205.14135) +and +[FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning](https://arxiv.org/abs/2307.08691). + +Currently, the implementation triggers extra kernels that apply pre-processing +to the elements (like RoPE) and populate the KV cache (see below). In a future +release, the number of such kernels may be reduced to improve the overall performance. + +#### FP8 Context FMHA[#](#fp8-context-fmha "Link to this heading") + +When FP8 quantization is activated, the attention can be further accelerated by +enabling FP8 Context FMHA. + +FP8 Paged Context FMHA is also supported with the fp8 quantization workflow. +You need to specify `use_paged_context_fmha = True` for the attention operator. + +Please be aware that this feature is only supported on Ada, Hopper and above. + +#### Generation Phase[#](#generation-phase "Link to this heading") + +The generation phase is implemented using a single kernel called the masked +multi-head attention in TensorRT LLM. That kernel is able to apply +pre-processing on the Q, K, and V elements on-the-fly: it adds the QKV bias, applies +RoPE, and performs dequantization and quantization. TensorRT LLM will continue to add (or +enable) additional features in future releases, such as enabling support for IA3. + +The masked MHA kernel has a special version that distributes the work across +multiple CUDA thread-blocks on the GPU for cases where the GPU occupancy is +low. That mode called multi-block is always enabled. +NVIDIA recommends users to test that mode in scenarios where both the batch +size and the number of heads in the model are relatively small. +The definition of ‘small’ in that context is hard to quantify because it depends on the model of the GPU. +However, NVIDIA currently recommends testing that mode when `batch_size * num_heads` is less than the number of multi-processors on the GPU. +This guidance may be subject to change in the future. + +Note that even if the multi-block mode is enabled, the attention operator will +not immediately trigger the multi-block version of the GPU kernel. There is a +minimum number of tokens (input + generated) that are required for the +multi-block version to become more efficient than the “vanilla” implementation +that uses a single CUDA thread-block per head. It is controlled by an internal +heuristic. + +Another note is that as the masked MHA kernels use shared memory size +proportional to sequence length, so there can be some cases that GPU’s shared +memory is not enough when multi-block mode is not enabled. To get masked MHA kernel to work in those cases, multi-block mode is forced on and a warning message is printed in the log. + +#### XQA Optimization[#](#xqa-optimization "Link to this heading") + +XQA optimization is another optimization for MQA/GQA in the generation phase. +It currently only supports a limited number of model configurations, such as the LLAMA2 70B model. + +Support matrix of the XQA optimization: + +* FP16 / BF16 compute data type. +* FP16 / BF16 / FP8 / INT8 KV cache data type. +* Paged KV cache (8 / 16 / 32 / 64 / 128 tokens per block). + +By default, this is enabled. Note that a heuristic algorithm +is also used to decide whether to use XQA kernel or masked MHA kernel to get +better performance. +If you want to use that kernel whenever possible, set `TRTLLM_FORCE_XQA=1` to force use of the XQA kernel when the model config is supported. +Supported configurations can be found using the `shouldUse` function of the `DecoderXQARunner` class in +`cpp/tensorrt_llm/kernels/decoderMaskedMultiheadAttention/decoderXQARunner.h`. + +### In-flight Batching[#](#in-flight-batching "Link to this heading") + +TensorRT LLM supports in-flight batching of requests (also known as continuous +batching or iteration-level batching) for higher serving throughput. With this feature, +sequences in the context phase can be processed together with sequences in +the generation phase. The purpose of that technique is to better interleave +requests to reduce latency as well as make better use of the GPUs. +For efficiency reasons (1), the support for inflight batching ***requires the +input tensors to be packed (no padding)***. + +***In the current implementation, the sequences that are going through the +context phase must be before the sequences in the generation phase in the input +tensor. For example, for sequences `S0`, `S1` and `S2`, if `S0` and `S2` are in +context phase (and `S1` in generation), tokens from `S0` and `S2` must appear +before the tokens of `S1` in the input tensor***. + +*(1) Padding sequences in the generation phase, that contain a single token, to +the length of the maximum input sequence is inefficient use of resources*. + +### Chunked Context[#](#chunked-context "Link to this heading") + +In the original state, the common behavior was to process all context tokens at +once. This feature splits the context into several chunks. In this way, the +context chunks can be batched with more tokens during the generation phase, +which is expected to increase the total throughput. Chunking contexts also removes +constraints on input length. Except for the last one, the size of the context chunk needs +to be an integer multiple of the kv-cache block size. + +> To enable this feature, the FMHA paged kv-cache also needs to be enabled. + +### KV Cache[#](#kv-cache "Link to this heading") + +In the generation phase, a common optimization is to provide the MHA kernel +with a cache containing the values of the past K and V elements that have +already been computed. That cache is known as the KV cache. TensorRT LLM uses +that technique to accelerate its generation phase. In TensorRT LLM, there is +one KV cache per Transformer layer, which means that there are as many KV +caches as layers in a model. The current version of TensorRT LLM supports two +different types of KV caches: **contiguous** and **paged** KV caches. + +#### Contiguous KV Cache[#](#contiguous-kv-cache "Link to this heading") + +The contiguous KV cache is a monolithic tensor. Its shape is: + +```None +[max_batch_size * max_beam_width, 2, num_heads, max_seqlen, hidden_dim_per_head]. +``` + +That implementation uses a lot more memory than needed when the sequences are +shorter than the maximum sequence length (even if they end up close to the +limit after the generation of many output tokens, it may take a lot of steps to +reach that point). + +#### Paged KV Cache[#](#paged-kv-cache "Link to this heading") + +The paged KV cache decomposes the KV cache into blocks that are distributed to +the different requests by a cache manager during processing. That cache manager +keeps track of the sequences, allocates new blocks from a pool and recycles those +blocks when required. See the implementation of +[`KVCacheManager`](https://github.com/NVIDIA/TensorRT-LLM/tree/e4c7078/tensorrt_llm/_torch/pyexecutor/resource_manager.py). + +#### INT8/FP8 KV Caches[#](#int8-fp8-kv-caches "Link to this heading") + +In its current implementation, even if the rest of the network runs in INT8 or +FP8, the attention operator works with FP32, FP16, and BFloat16 inputs and +outputs. However, TensorRT LLM supports INT8 and FP8 +(`QuantMode.INT8_KV_CACHE` and +`QuantMode.FP8_KV_CACHE`) KV caches. + +The attention operator populates the KV cache. When INT8 or FP8 KV caches +are enabled, the input values have to be quantized to 8 bits using a scaling +factor. For quantization, the scaling factor is stored in the +`kv_cache_scaling_factor` tensor. Its shape is `[1]` and only per-tensor +quantization is supported in the current version. Quantization uses inversed scale +since it does multiply as `fp_value * (1.0 / kv_cache_scaling_factor)` in plugin. + +During generation, the values read from the cache are dequantized on-the-fly in +the MHA/MQA kernel. Dequantization is defined as +`quantized_value * kv_cache_scaling_factor`. + +### Sliding Window Attention, Cyclic (Rolling Buffer) KV Cache[#](#sliding-window-attention-cyclic-rolling-buffer-kv-cache "Link to this heading") + +TensorRT LLM has a feature called `Cyclic KV Cache`, which treats the kv cache +as a circular buffer. This means that it only stores the kv cache for the last N +tokens, where N is determined by the `attention_window_size` parameter in +`TrtllmAttention.forward`. When the cache is full, new tokens’ kv cache will +overwrite the “least recently used” caches. + +In the context phase, if the input length surpasses the `attention_window_size`, +`Sliding Window Attention` will be activated. This serves the same function as +the sliding window size. + +This feature helps to reduce the memory footprint of the kv cache when +dealing with very long sequences. + +\_Note that the cyclic kv cache feature doesn’t work with beam searching currently as +the context kv cache are shared across beams. + +### StreamingLLM[#](#streamingllm "Link to this heading") + +The StreamingLLM feature uses a window attention to perform efficient and stable LLM +on long texts, which means that only `N` tokens need to be stored in the KV cache. +Similar to the cyclic KV cache feature in TensorRT LLM, `attention_window_size` +parameter is used to determine `N`. Different from the cyclic KV cache feature, +the first `S` tokens, called sink tokens, are always kept in the attention window, +where `S` is determined by `sink_token_length` parameter. +But in context phase, the self-attentions are dense in the official implementation of +StreamingLLM. It uses all of the tokens for computation and only saves `N` tokens +to the KV cache. + +In addition, the relative position embedding is also changed in StreamingLLM. +When determining the relative distance and adding positional information to tokens, +StreamingLLM use the positions within the cache rather than those in the original text. + +`sink_token_length` is also used to enable this feature. + +### Beam-Search[#](#beam-search "Link to this heading") + +The attention operator supports beam-search. In the context phase, a single +beam is computed per input sequence. In the generation phase, the MHA/MQA/GQA +kernel uses an additional tensor to reconstruct the correct path for each beam. +That tensor is called the `cache_indirection`. Its shape is `[batch_size, beam_width, max_seqlen]`. + +For a sequence `si`, a beam `bi` and a token `ti`, the element +`cache_indirection[si][bi][ti]` is an integer between `0` and `beam_width-1` +that indicates which path in the beam to read the K and V elements from in the +KV cache. This tensor is populated in the sampling stage. + +### Input QKV tensor[#](#input-qkv-tensor "Link to this heading") + +The input QKV tensor packs the Q, K and V tensors (concatenated along the last +dimension) after the projection of the hidden states. It is a 3D tensor. RoPE +and quantization to INT8 or FP8 (when needed) are performed by the GPT +attention operator. + +In packed mode, its shape is `[num_tokens, 3 * hidden_dim]` where +`num_tokens` is the total number of tokens in the batch. For the sequences in +context phase, the number of tokens of a sequence corresponds to its input +length (even if the beam width is greater than `1` for beam search). For the +sequences in generation phase, there are `beam_width` tokens per sequence. The +beam width can be different for each sequence. + +The following pseudo code explains how the number of tokens is computed: + +```None +num_tokens = 0 + +# Add the length of each sequence in context phase. +for seq in context_phase: + num_tokens += seq.length + +# Add the width of the beam for each sequence in generation phase. +for seq in generation_phase: + num_tokens += seq.beam_width +``` + +### Rotary Positional Embedding (RoPE)[#](#rotary-positional-embedding-rope "Link to this heading") + +The attention operator can perform the computation of the Rotary +Positional Embedding (RoPE). When that operation is enabled, +`rotary_embedding_dim` is set to a value greater than 0, it is fused with other +operations. The GPT operator supports GPT-NeoX and GPT-J forms of RoPE by +setting `position_embedding_type` to `PositionEmbeddingType.rope_gpt_neox` +or `PositionEmbeddingType.rope_gptj`. + +### ALiBi[#](#alibi "Link to this heading") + +The attention operator can apply ALiBi to the result of the `Q*K^T` +product. The bias is computed on-the-fly from the ALiBi slopes in the optimized +kernel. + +### Scaling factor(s)[#](#scaling-factor-s "Link to this heading") + +In MHA, the output of the `Q*K^T` product is scaled by a constant value that +is computed as: + +```None +norm_factor = 1.f / (q_scaling * sqrt(head_size)). +``` + +### Cross Attention[#](#cross-attention "Link to this heading") + +On top of the MHA as self attention needed by GPT-style decoder-only models, the attention operator also supports cross attention. + +This enables the attention operator to be more broadly used as a generic decoder component. For example, the Encoder-Decoder model uses it to issue both the self attention and cross attention modules in its Decoder. diff --git a/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc6.md b/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc6.md new file mode 100644 index 0000000000000000000000000000000000000000..92770867bdb7a3db166f684cdadd56f082c6b81c --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc6.md @@ -0,0 +1,382 @@ +# Multi-Head, Multi-Query, and Group-Query Attention# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc6/features/attention.html +Version: 1.2.0rc6 + +This document details the implementation of multi-head attention (MHA), +multi-query attention (MQA), and group-query attention (GQA) for autoregressive +models in TensorRT LLM’s PyTorch backend. + +Multi-head attention involves a sequence of batched matrix multiplications, a softmax operation, and another batched matrix multiplication, +as described in the [Attention Is All You Need](https://arxiv.org/abs/1706.03762) paper. +[Multi-query Attention (MQA)](https://arxiv.org/abs/1911.02150) and [Group-query Attention (GQA)](https://arxiv.org/abs/2307.09288) are +variants of MHA that use fewer KV heads than the number of query heads. +TensorRT LLM provides several implementations using different backends in `tensorrt_llm/_torch/attention_backend/`. +The following sections explain how to use these implementations and provide a brief guide on implementing new backends. + +## Attention Backends[#](#attention-backends "Link to this heading") + +There are currently three available attention backends: the vanilla backend, the TRT-LLM backend, and the Flashinfer backend. +You can specify the desired attention backend using `PyTorchConfig.attn_backend`. For instance, to utilize the Flashinfer backend, you can pass `attn_backend="flashinfer"` to the `LLM` constructor as follows: `LLM(attn_backend="flashinfer")`. This will enable the use of the Flashinfer backend for your model. + +The vanilla backend, `VanillaAttention`, is a reference implementation designed primarily for inflight batching and linear KV cache support. While it serves as a useful baseline, it is not recommended for production use due to its limited optimizations. + +In contrast, the Flashinfer backend, `FlashInferAttention`, is performance-optimized and supports both inflight batching and paged KV cache. It also includes the following advanced features: + +1. **FP8 Quantization**: This feature enables the quantization of inputs and KV cache into FP8 format, significantly reducing memory usage and improving computational throughput. +2. **RoPE Fusion**: By integrating rotary position embedding (RoPE) directly into the attention computation, this feature enhances efficiency and reduces overhead. + +The TRT-LLM backend, `TrtllmAttention`, serves as the default backend and supports all the features available in the Flashinfer backend while being further optimized for enhanced performance. It is the recommended choice for production environments. Additionally, it offers the following advanced features: + +1. **Fused QKV Input**: It can accept a single QKV tensor as input, which is more efficient compared to using separate Q, K, and V tensors. +2. **FP8 Output**: It supports outputting the attention result in FP8 format, fusing quantization into the attention computation process. + +## Implement a New Attention Backend[#](#implement-a-new-attention-backend "Link to this heading") + +You can implement a new attention backend to integrate other attention libraries. +An attention backend consists of an `AttentionBackend` class and an `AttentionMetadata` class. +There are three stages in the PyTorch that involve the attention backend: + +1. Model construction: During the model’s `__init__`, call `AttentionBackend.__init__` to create an attention backend for each layer. +2. Metadata preparation: Before each forward step of the model: + + 1. If the metadata is uninitialized, call `AttentionMetadata.__init__` to create the attention metadata. + 2. If using CUDA graphs, call `AttentionMetadata.create_cuda_graph_metadata` to convert the metadata to CUDA graph metadata, which pre-allocates all tensors and can be used to capture CUDA graphs. Do not re-allocate any tensors stored inside `AttentionMetadata` after the initial warmup run when using CUDA graphs. + 3. To prepare parameters of the input and KV cache, call `AttentionMetadata.prepare` to convert from existing metadata and KV cache manager. +3. Single step forward: During the forward pass of each attention layer, call `AttentionBackend.forward` to perform the attention operation. The `AttentionMetadata` will be provided as a forward argument. + +### Implement `AttentionMetadata`[#](#implement-attentionmetadata "Link to this heading") + +The `AttentionMetadata` class stores metadata from the batched input and KV cache for the attention backend. +It contains the following predefined fields: + +| Field | Type | Description | +| --- | --- | --- | +| max\_num\_requests | int | The max number of requests in a single batch. | +| num\_contexts | int | The number of context-phase sequences in the batch. | +| num\_generations | int | The number of generation-phase sequences in the batch. | +| max\_num\_tokens | int | The max number of tokens in all requests in a single batch. | +| num\_tokens | int | Number of tokens in the batch. | +| num\_ctx\_tokens | int | Number of tokens in sequences in the context phase. | +| kv\_cache\_manager | KVCacheManager | The KV cache manager. | +| is\_cuda\_graph | bool | Whether CUDA graph is enabled. | +| seq\_lens | Tensor | The length of each sequence in the batch. The shape is (batch\_size), and located on CPU memory. | +| seq\_lens\_cuda | Tensor | A copy of `seq_lens` store on the GPU. | +| context\_lens | Tensor | The length of each context-phase sequence in the batch. The shape is (`num_contexts`). | +| position\_ids | Optional[Tensor] | The position of each token in each sequence. May be None if positional embedding is applied outside of the backend. | +| request\_ids | List[int] | The request ID of each sequence in the batch. | +| prompt\_lens | List[int] | The prompt length of each sequence in the batch. | +| kv\_cache\_params | KVCacheParams | The parameters for the KV cache. | + +During `AttentionMetadata.__init__`, you can initialize additional fields for the new attention metadata. +For example, the Flashinfer metadata initializes `decode_wrapper` here. +During `AttentionMetadata.prepare`, the runtime will fill all predefined fields, and you can fill your customized fields according to these predefined fields. +For example, the Flashinfer metadata fills `qo_indptr` by combining `context_lens` and `num_generations` here. + +### Implement `AttentionBackend`[#](#implement-attentionbackend "Link to this heading") + +The `AttentionBackend` delegates the attention operation to the backend implementation. + +Its `__init__` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| layer\_idx | int | The index of the attention layer in the model. | +| num\_heads | int | The number of query heads. | +| head\_dim | int | The size of each attention head `(hidden_size // num_heads)`. | +| num\_kv\_heads | Optional[int] | The number of KV heads. Defaults to num\_heads if None. | +| quant\_config | QuantConfig | Optional quantization configuration. If None, no quantization is applied. | +| pos\_embd\_params | PositionalEmbeddingParams | Optional parameters defining how positional embedding should be applied. If None, positional embedding should be applied by the model before calling the backend. Otherwise, the backend is in-charge of applying positional embedding and may cache K without embedding it first. | + +Its `forward` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| q | Tensor | Query tensor with shape `(num_tokens, num_heads * head_dim)`. | +| k | Tensor | Key tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| v | Tensor | Value tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| metadata | AttentionMetadata | Metadata for the attention operation. | +| attention\_mask | AttentionMask | Optional attention mask. If None, causal mask is applied. | + +For example, the Flashinfer backend calls `append_paged_kv_cache` and then `wrapper.run` to perform the attention operation here. + +## The Features of the `TrtllmAttention` Backend[#](#the-features-of-the-trtllmattention-backend "Link to this heading") + +The following sections introduce some features of the default `TrtllmAttention` backend. + +### Packed Tensors[#](#packed-tensors "Link to this heading") + +In the `TrtllmAttention` backend, the attention operator supports the packed (i.e. non padded) QKV inputs. +A naive layout for the QKV inputs is padding the sequences +that are shorter than the `max_sequence_length` to the maximum +length. It may result in excessive memory consumption as well as unneeded +computations on padding tokens (in the various matrix multiplications that +surround the MHA block). +To overcome that problem, TensorRT LLM supports a mode without padding where +the different tokens are packed together and the user provides the operator +with a 1D tensor containing the lengths of the different sequences. + +### Context and Generation Phases[#](#context-and-generation-phases "Link to this heading") + +The `TrtllmAttention` backend encapsulates different implementations for both +context and generation phases into a single custom torch op. + +#### Context Phase[#](#context-phase "Link to this heading") + +A context-phase implementation without optimization maps to a sequence of GPU kernels that will store the +intermediate `Q*K^T` tensor in memory before calling the softmax operator. It +is the slowest method and the memory footprint is significant (grows quadratically in proportion to the sequence length). + +The `TrtllmAttention` backend will trigger a kernel that performs the MHA/MQA block +using a single kernel instead. For short sequences, that kernel uses a vanilla +implementation of MHA/MQA. For larger sequences, this kernel uses the Flash +Attention algorithm as described in +[FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness](https://arxiv.org/abs/2205.14135) +and +[FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning](https://arxiv.org/abs/2307.08691). + +Currently, the implementation triggers extra kernels that apply pre-processing +to the elements (like RoPE) and populate the KV cache (see below). In a future +release, the number of such kernels may be reduced to improve the overall performance. + +#### FP8 Context FMHA[#](#fp8-context-fmha "Link to this heading") + +When FP8 quantization is activated, the attention can be further accelerated by +enabling FP8 Context FMHA. + +FP8 Paged Context FMHA is also supported with the fp8 quantization workflow. +You need to specify `use_paged_context_fmha = True` for the attention operator. + +Please be aware that this feature is only supported on Ada, Hopper and above. + +#### Generation Phase[#](#generation-phase "Link to this heading") + +The generation phase is implemented using a single kernel called the masked +multi-head attention in TensorRT LLM. That kernel is able to apply +pre-processing on the Q, K, and V elements on-the-fly: it adds the QKV bias, applies +RoPE, and performs dequantization and quantization. TensorRT LLM will continue to add (or +enable) additional features in future releases, such as enabling support for IA3. + +The masked MHA kernel has a special version that distributes the work across +multiple CUDA thread-blocks on the GPU for cases where the GPU occupancy is +low. That mode called multi-block is always enabled. +NVIDIA recommends users to test that mode in scenarios where both the batch +size and the number of heads in the model are relatively small. +The definition of ‘small’ in that context is hard to quantify because it depends on the model of the GPU. +However, NVIDIA currently recommends testing that mode when `batch_size * num_heads` is less than the number of multi-processors on the GPU. +This guidance may be subject to change in the future. + +Note that even if the multi-block mode is enabled, the attention operator will +not immediately trigger the multi-block version of the GPU kernel. There is a +minimum number of tokens (input + generated) that are required for the +multi-block version to become more efficient than the “vanilla” implementation +that uses a single CUDA thread-block per head. It is controlled by an internal +heuristic. + +Another note is that as the masked MHA kernels use shared memory size +proportional to sequence length, so there can be some cases that GPU’s shared +memory is not enough when multi-block mode is not enabled. To get masked MHA kernel to work in those cases, multi-block mode is forced on and a warning message is printed in the log. + +#### XQA Optimization[#](#xqa-optimization "Link to this heading") + +XQA optimization is another optimization for MQA/GQA in the generation phase. +It currently only supports a limited number of model configurations, such as the LLAMA2 70B model. + +Support matrix of the XQA optimization: + +* FP16 / BF16 compute data type. +* FP16 / BF16 / FP8 / INT8 KV cache data type. +* Paged KV cache (8 / 16 / 32 / 64 / 128 tokens per block). + +By default, this is enabled. Note that a heuristic algorithm +is also used to decide whether to use XQA kernel or masked MHA kernel to get +better performance. +If you want to use that kernel whenever possible, set `TRTLLM_FORCE_XQA=1` to force use of the XQA kernel when the model config is supported. +Supported configurations can be found using the `shouldUse` function of the `DecoderXQARunner` class in +`cpp/tensorrt_llm/kernels/decoderMaskedMultiheadAttention/decoderXQARunner.h`. + +### In-flight Batching[#](#in-flight-batching "Link to this heading") + +TensorRT LLM supports in-flight batching of requests (also known as continuous +batching or iteration-level batching) for higher serving throughput. With this feature, +sequences in the context phase can be processed together with sequences in +the generation phase. The purpose of that technique is to better interleave +requests to reduce latency as well as make better use of the GPUs. +For efficiency reasons (1), the support for inflight batching ***requires the +input tensors to be packed (no padding)***. + +***In the current implementation, the sequences that are going through the +context phase must be before the sequences in the generation phase in the input +tensor. For example, for sequences `S0`, `S1` and `S2`, if `S0` and `S2` are in +context phase (and `S1` in generation), tokens from `S0` and `S2` must appear +before the tokens of `S1` in the input tensor***. + +*(1) Padding sequences in the generation phase, that contain a single token, to +the length of the maximum input sequence is inefficient use of resources*. + +### Chunked Context[#](#chunked-context "Link to this heading") + +In the original state, the common behavior was to process all context tokens at +once. This feature splits the context into several chunks. In this way, the +context chunks can be batched with more tokens during the generation phase, +which is expected to increase the total throughput. Chunking contexts also removes +constraints on input length. Except for the last one, the size of the context chunk needs +to be an integer multiple of the kv-cache block size. + +> To enable this feature, the FMHA paged kv-cache also needs to be enabled. + +### KV Cache[#](#kv-cache "Link to this heading") + +In the generation phase, a common optimization is to provide the MHA kernel +with a cache containing the values of the past K and V elements that have +already been computed. That cache is known as the KV cache. TensorRT LLM uses +that technique to accelerate its generation phase. In TensorRT LLM, there is +one KV cache per Transformer layer, which means that there are as many KV +caches as layers in a model. The current version of TensorRT LLM supports two +different types of KV caches: **contiguous** and **paged** KV caches. + +#### Contiguous KV Cache[#](#contiguous-kv-cache "Link to this heading") + +The contiguous KV cache is a monolithic tensor. Its shape is: + +```None +[max_batch_size * max_beam_width, 2, num_heads, max_seqlen, hidden_dim_per_head]. +``` + +That implementation uses a lot more memory than needed when the sequences are +shorter than the maximum sequence length (even if they end up close to the +limit after the generation of many output tokens, it may take a lot of steps to +reach that point). + +#### Paged KV Cache[#](#paged-kv-cache "Link to this heading") + +The paged KV cache decomposes the KV cache into blocks that are distributed to +the different requests by a cache manager during processing. That cache manager +keeps track of the sequences, allocates new blocks from a pool and recycles those +blocks when required. See the implementation of +[`KVCacheManager`](https://github.com/NVIDIA/TensorRT-LLM/tree/9ba1426/tensorrt_llm/_torch/pyexecutor/resource_manager.py). + +#### INT8/FP8 KV Caches[#](#int8-fp8-kv-caches "Link to this heading") + +In its current implementation, even if the rest of the network runs in INT8 or +FP8, the attention operator works with FP32, FP16, and BFloat16 inputs and +outputs. However, TensorRT LLM supports INT8 and FP8 +(`QuantMode.INT8_KV_CACHE` and +`QuantMode.FP8_KV_CACHE`) KV caches. + +The attention operator populates the KV cache. When INT8 or FP8 KV caches +are enabled, the input values have to be quantized to 8 bits using a scaling +factor. For quantization, the scaling factor is stored in the +`kv_cache_scaling_factor` tensor. Its shape is `[1]` and only per-tensor +quantization is supported in the current version. Quantization uses inversed scale +since it does multiply as `fp_value * (1.0 / kv_cache_scaling_factor)` in plugin. + +During generation, the values read from the cache are dequantized on-the-fly in +the MHA/MQA kernel. Dequantization is defined as +`quantized_value * kv_cache_scaling_factor`. + +### Sliding Window Attention, Cyclic (Rolling Buffer) KV Cache[#](#sliding-window-attention-cyclic-rolling-buffer-kv-cache "Link to this heading") + +TensorRT LLM has a feature called `Cyclic KV Cache`, which treats the kv cache +as a circular buffer. This means that it only stores the kv cache for the last N +tokens, where N is determined by the `attention_window_size` parameter in +`TrtllmAttention.forward`. When the cache is full, new tokens’ kv cache will +overwrite the “least recently used” caches. + +In the context phase, if the input length surpasses the `attention_window_size`, +`Sliding Window Attention` will be activated. This serves the same function as +the sliding window size. + +This feature helps to reduce the memory footprint of the kv cache when +dealing with very long sequences. + +\_Note that the cyclic kv cache feature doesn’t work with beam searching currently as +the context kv cache are shared across beams. + +### StreamingLLM[#](#streamingllm "Link to this heading") + +The StreamingLLM feature uses a window attention to perform efficient and stable LLM +on long texts, which means that only `N` tokens need to be stored in the KV cache. +Similar to the cyclic KV cache feature in TensorRT LLM, `attention_window_size` +parameter is used to determine `N`. Different from the cyclic KV cache feature, +the first `S` tokens, called sink tokens, are always kept in the attention window, +where `S` is determined by `sink_token_length` parameter. +But in context phase, the self-attentions are dense in the official implementation of +StreamingLLM. It uses all of the tokens for computation and only saves `N` tokens +to the KV cache. + +In addition, the relative position embedding is also changed in StreamingLLM. +When determining the relative distance and adding positional information to tokens, +StreamingLLM use the positions within the cache rather than those in the original text. + +`sink_token_length` is also used to enable this feature. + +### Beam-Search[#](#beam-search "Link to this heading") + +The attention operator supports beam-search. In the context phase, a single +beam is computed per input sequence. In the generation phase, the MHA/MQA/GQA +kernel uses an additional tensor to reconstruct the correct path for each beam. +That tensor is called the `cache_indirection`. Its shape is `[batch_size, beam_width, max_seqlen]`. + +For a sequence `si`, a beam `bi` and a token `ti`, the element +`cache_indirection[si][bi][ti]` is an integer between `0` and `beam_width-1` +that indicates which path in the beam to read the K and V elements from in the +KV cache. This tensor is populated in the sampling stage. + +### Input QKV tensor[#](#input-qkv-tensor "Link to this heading") + +The input QKV tensor packs the Q, K and V tensors (concatenated along the last +dimension) after the projection of the hidden states. It is a 3D tensor. RoPE +and quantization to INT8 or FP8 (when needed) are performed by the GPT +attention operator. + +In packed mode, its shape is `[num_tokens, 3 * hidden_dim]` where +`num_tokens` is the total number of tokens in the batch. For the sequences in +context phase, the number of tokens of a sequence corresponds to its input +length (even if the beam width is greater than `1` for beam search). For the +sequences in generation phase, there are `beam_width` tokens per sequence. The +beam width can be different for each sequence. + +The following pseudo code explains how the number of tokens is computed: + +```None +num_tokens = 0 + +# Add the length of each sequence in context phase. +for seq in context_phase: + num_tokens += seq.length + +# Add the width of the beam for each sequence in generation phase. +for seq in generation_phase: + num_tokens += seq.beam_width +``` + +### Rotary Positional Embedding (RoPE)[#](#rotary-positional-embedding-rope "Link to this heading") + +The attention operator can perform the computation of the Rotary +Positional Embedding (RoPE). When that operation is enabled, +`rotary_embedding_dim` is set to a value greater than 0, it is fused with other +operations. The GPT operator supports GPT-NeoX and GPT-J forms of RoPE by +setting `position_embedding_type` to `PositionEmbeddingType.rope_gpt_neox` +or `PositionEmbeddingType.rope_gptj`. + +### ALiBi[#](#alibi "Link to this heading") + +The attention operator can apply ALiBi to the result of the `Q*K^T` +product. The bias is computed on-the-fly from the ALiBi slopes in the optimized +kernel. + +### Scaling factor(s)[#](#scaling-factor-s "Link to this heading") + +In MHA, the output of the `Q*K^T` product is scaled by a constant value that +is computed as: + +```None +norm_factor = 1.f / (q_scaling * sqrt(head_size)). +``` + +### Cross Attention[#](#cross-attention "Link to this heading") + +On top of the MHA as self attention needed by GPT-style decoder-only models, the attention operator also supports cross attention. + +This enables the attention operator to be more broadly used as a generic decoder component. For example, the Encoder-Decoder model uses it to issue both the self attention and cross attention modules in its Decoder. diff --git a/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc7.md b/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc7.md new file mode 100644 index 0000000000000000000000000000000000000000..a33235f61cd29e299abe74bce5f3228e326ba959 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc7.md @@ -0,0 +1,382 @@ +# Multi-Head, Multi-Query, and Group-Query Attention# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc7/features/attention.html +Version: 1.2.0rc7 + +This document details the implementation of multi-head attention (MHA), +multi-query attention (MQA), and group-query attention (GQA) for autoregressive +models in TensorRT LLM’s PyTorch backend. + +Multi-head attention involves a sequence of batched matrix multiplications, a softmax operation, and another batched matrix multiplication, +as described in the [Attention Is All You Need](https://arxiv.org/abs/1706.03762) paper. +[Multi-query Attention (MQA)](https://arxiv.org/abs/1911.02150) and [Group-query Attention (GQA)](https://arxiv.org/abs/2307.09288) are +variants of MHA that use fewer KV heads than the number of query heads. +TensorRT LLM provides several implementations using different backends in `tensorrt_llm/_torch/attention_backend/`. +The following sections explain how to use these implementations and provide a brief guide on implementing new backends. + +## Attention Backends[#](#attention-backends "Link to this heading") + +There are currently three available attention backends: the vanilla backend, the TRT-LLM backend, and the Flashinfer backend. +You can specify the desired attention backend using `PyTorchConfig.attn_backend`. For instance, to utilize the Flashinfer backend, you can pass `attn_backend="flashinfer"` to the `LLM` constructor as follows: `LLM(attn_backend="flashinfer")`. This will enable the use of the Flashinfer backend for your model. + +The vanilla backend, `VanillaAttention`, is a reference implementation designed primarily for inflight batching and linear KV cache support. While it serves as a useful baseline, it is not recommended for production use due to its limited optimizations. + +In contrast, the Flashinfer backend, `FlashInferAttention`, is performance-optimized and supports both inflight batching and paged KV cache. It also includes the following advanced features: + +1. **FP8 Quantization**: This feature enables the quantization of inputs and KV cache into FP8 format, significantly reducing memory usage and improving computational throughput. +2. **RoPE Fusion**: By integrating rotary position embedding (RoPE) directly into the attention computation, this feature enhances efficiency and reduces overhead. + +The TRT-LLM backend, `TrtllmAttention`, serves as the default backend and supports all the features available in the Flashinfer backend while being further optimized for enhanced performance. It is the recommended choice for production environments. Additionally, it offers the following advanced features: + +1. **Fused QKV Input**: It can accept a single QKV tensor as input, which is more efficient compared to using separate Q, K, and V tensors. +2. **FP8 Output**: It supports outputting the attention result in FP8 format, fusing quantization into the attention computation process. + +## Implement a New Attention Backend[#](#implement-a-new-attention-backend "Link to this heading") + +You can implement a new attention backend to integrate other attention libraries. +An attention backend consists of an `AttentionBackend` class and an `AttentionMetadata` class. +There are three stages in the PyTorch that involve the attention backend: + +1. Model construction: During the model’s `__init__`, call `AttentionBackend.__init__` to create an attention backend for each layer. +2. Metadata preparation: Before each forward step of the model: + + 1. If the metadata is uninitialized, call `AttentionMetadata.__init__` to create the attention metadata. + 2. If using CUDA graphs, call `AttentionMetadata.create_cuda_graph_metadata` to convert the metadata to CUDA graph metadata, which pre-allocates all tensors and can be used to capture CUDA graphs. Do not re-allocate any tensors stored inside `AttentionMetadata` after the initial warmup run when using CUDA graphs. + 3. To prepare parameters of the input and KV cache, call `AttentionMetadata.prepare` to convert from existing metadata and KV cache manager. +3. Single step forward: During the forward pass of each attention layer, call `AttentionBackend.forward` to perform the attention operation. The `AttentionMetadata` will be provided as a forward argument. + +### Implement `AttentionMetadata`[#](#implement-attentionmetadata "Link to this heading") + +The `AttentionMetadata` class stores metadata from the batched input and KV cache for the attention backend. +It contains the following predefined fields: + +| Field | Type | Description | +| --- | --- | --- | +| max\_num\_requests | int | The max number of requests in a single batch. | +| num\_contexts | int | The number of context-phase sequences in the batch. | +| num\_generations | int | The number of generation-phase sequences in the batch. | +| max\_num\_tokens | int | The max number of tokens in all requests in a single batch. | +| num\_tokens | int | Number of tokens in the batch. | +| num\_ctx\_tokens | int | Number of tokens in sequences in the context phase. | +| kv\_cache\_manager | KVCacheManager | The KV cache manager. | +| is\_cuda\_graph | bool | Whether CUDA graph is enabled. | +| seq\_lens | Tensor | The length of each sequence in the batch. The shape is (batch\_size), and located on CPU memory. | +| seq\_lens\_cuda | Tensor | A copy of `seq_lens` store on the GPU. | +| context\_lens | Tensor | The length of each context-phase sequence in the batch. The shape is (`num_contexts`). | +| position\_ids | Optional[Tensor] | The position of each token in each sequence. May be None if positional embedding is applied outside of the backend. | +| request\_ids | List[int] | The request ID of each sequence in the batch. | +| prompt\_lens | List[int] | The prompt length of each sequence in the batch. | +| kv\_cache\_params | KVCacheParams | The parameters for the KV cache. | + +During `AttentionMetadata.__init__`, you can initialize additional fields for the new attention metadata. +For example, the Flashinfer metadata initializes `decode_wrapper` here. +During `AttentionMetadata.prepare`, the runtime will fill all predefined fields, and you can fill your customized fields according to these predefined fields. +For example, the Flashinfer metadata fills `qo_indptr` by combining `context_lens` and `num_generations` here. + +### Implement `AttentionBackend`[#](#implement-attentionbackend "Link to this heading") + +The `AttentionBackend` delegates the attention operation to the backend implementation. + +Its `__init__` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| layer\_idx | int | The index of the attention layer in the model. | +| num\_heads | int | The number of query heads. | +| head\_dim | int | The size of each attention head `(hidden_size // num_heads)`. | +| num\_kv\_heads | Optional[int] | The number of KV heads. Defaults to num\_heads if None. | +| quant\_config | QuantConfig | Optional quantization configuration. If None, no quantization is applied. | +| pos\_embd\_params | PositionalEmbeddingParams | Optional parameters defining how positional embedding should be applied. If None, positional embedding should be applied by the model before calling the backend. Otherwise, the backend is in-charge of applying positional embedding and may cache K without embedding it first. | + +Its `forward` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| q | Tensor | Query tensor with shape `(num_tokens, num_heads * head_dim)`. | +| k | Tensor | Key tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| v | Tensor | Value tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| metadata | AttentionMetadata | Metadata for the attention operation. | +| attention\_mask | AttentionMask | Optional attention mask. If None, causal mask is applied. | + +For example, the Flashinfer backend calls `append_paged_kv_cache` and then `wrapper.run` to perform the attention operation here. + +## The Features of the `TrtllmAttention` Backend[#](#the-features-of-the-trtllmattention-backend "Link to this heading") + +The following sections introduce some features of the default `TrtllmAttention` backend. + +### Packed Tensors[#](#packed-tensors "Link to this heading") + +In the `TrtllmAttention` backend, the attention operator supports the packed (i.e. non padded) QKV inputs. +A naive layout for the QKV inputs is padding the sequences +that are shorter than the `max_sequence_length` to the maximum +length. It may result in excessive memory consumption as well as unneeded +computations on padding tokens (in the various matrix multiplications that +surround the MHA block). +To overcome that problem, TensorRT LLM supports a mode without padding where +the different tokens are packed together and the user provides the operator +with a 1D tensor containing the lengths of the different sequences. + +### Context and Generation Phases[#](#context-and-generation-phases "Link to this heading") + +The `TrtllmAttention` backend encapsulates different implementations for both +context and generation phases into a single custom torch op. + +#### Context Phase[#](#context-phase "Link to this heading") + +A context-phase implementation without optimization maps to a sequence of GPU kernels that will store the +intermediate `Q*K^T` tensor in memory before calling the softmax operator. It +is the slowest method and the memory footprint is significant (grows quadratically in proportion to the sequence length). + +The `TrtllmAttention` backend will trigger a kernel that performs the MHA/MQA block +using a single kernel instead. For short sequences, that kernel uses a vanilla +implementation of MHA/MQA. For larger sequences, this kernel uses the Flash +Attention algorithm as described in +[FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness](https://arxiv.org/abs/2205.14135) +and +[FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning](https://arxiv.org/abs/2307.08691). + +Currently, the implementation triggers extra kernels that apply pre-processing +to the elements (like RoPE) and populate the KV cache (see below). In a future +release, the number of such kernels may be reduced to improve the overall performance. + +#### FP8 Context FMHA[#](#fp8-context-fmha "Link to this heading") + +When FP8 quantization is activated, the attention can be further accelerated by +enabling FP8 Context FMHA. + +FP8 Paged Context FMHA is also supported with the fp8 quantization workflow. +You need to specify `use_paged_context_fmha = True` for the attention operator. + +Please be aware that this feature is only supported on Ada, Hopper and above. + +#### Generation Phase[#](#generation-phase "Link to this heading") + +The generation phase is implemented using a single kernel called the masked +multi-head attention in TensorRT LLM. That kernel is able to apply +pre-processing on the Q, K, and V elements on-the-fly: it adds the QKV bias, applies +RoPE, and performs dequantization and quantization. TensorRT LLM will continue to add (or +enable) additional features in future releases, such as enabling support for IA3. + +The masked MHA kernel has a special version that distributes the work across +multiple CUDA thread-blocks on the GPU for cases where the GPU occupancy is +low. That mode called multi-block is always enabled. +NVIDIA recommends users to test that mode in scenarios where both the batch +size and the number of heads in the model are relatively small. +The definition of ‘small’ in that context is hard to quantify because it depends on the model of the GPU. +However, NVIDIA currently recommends testing that mode when `batch_size * num_heads` is less than the number of multi-processors on the GPU. +This guidance may be subject to change in the future. + +Note that even if the multi-block mode is enabled, the attention operator will +not immediately trigger the multi-block version of the GPU kernel. There is a +minimum number of tokens (input + generated) that are required for the +multi-block version to become more efficient than the “vanilla” implementation +that uses a single CUDA thread-block per head. It is controlled by an internal +heuristic. + +Another note is that as the masked MHA kernels use shared memory size +proportional to sequence length, so there can be some cases that GPU’s shared +memory is not enough when multi-block mode is not enabled. To get masked MHA kernel to work in those cases, multi-block mode is forced on and a warning message is printed in the log. + +#### XQA Optimization[#](#xqa-optimization "Link to this heading") + +XQA optimization is another optimization for MQA/GQA in the generation phase. +It currently only supports a limited number of model configurations, such as the LLAMA2 70B model. + +Support matrix of the XQA optimization: + +* FP16 / BF16 compute data type. +* FP16 / BF16 / FP8 / INT8 KV cache data type. +* Paged KV cache (8 / 16 / 32 / 64 / 128 tokens per block). + +By default, this is enabled. Note that a heuristic algorithm +is also used to decide whether to use XQA kernel or masked MHA kernel to get +better performance. +If you want to use that kernel whenever possible, set `TRTLLM_FORCE_XQA=1` to force use of the XQA kernel when the model config is supported. +Supported configurations can be found using the `shouldUse` function of the `DecoderXQARunner` class in +`cpp/tensorrt_llm/kernels/decoderMaskedMultiheadAttention/decoderXQARunner.h`. + +### In-flight Batching[#](#in-flight-batching "Link to this heading") + +TensorRT LLM supports in-flight batching of requests (also known as continuous +batching or iteration-level batching) for higher serving throughput. With this feature, +sequences in the context phase can be processed together with sequences in +the generation phase. The purpose of that technique is to better interleave +requests to reduce latency as well as make better use of the GPUs. +For efficiency reasons (1), the support for inflight batching ***requires the +input tensors to be packed (no padding)***. + +***In the current implementation, the sequences that are going through the +context phase must be before the sequences in the generation phase in the input +tensor. For example, for sequences `S0`, `S1` and `S2`, if `S0` and `S2` are in +context phase (and `S1` in generation), tokens from `S0` and `S2` must appear +before the tokens of `S1` in the input tensor***. + +*(1) Padding sequences in the generation phase, that contain a single token, to +the length of the maximum input sequence is inefficient use of resources*. + +### Chunked Context[#](#chunked-context "Link to this heading") + +In the original state, the common behavior was to process all context tokens at +once. This feature splits the context into several chunks. In this way, the +context chunks can be batched with more tokens during the generation phase, +which is expected to increase the total throughput. Chunking contexts also removes +constraints on input length. Except for the last one, the size of the context chunk needs +to be an integer multiple of the kv-cache block size. + +> To enable this feature, the FMHA paged kv-cache also needs to be enabled. + +### KV Cache[#](#kv-cache "Link to this heading") + +In the generation phase, a common optimization is to provide the MHA kernel +with a cache containing the values of the past K and V elements that have +already been computed. That cache is known as the KV cache. TensorRT LLM uses +that technique to accelerate its generation phase. In TensorRT LLM, there is +one KV cache per Transformer layer, which means that there are as many KV +caches as layers in a model. The current version of TensorRT LLM supports two +different types of KV caches: **contiguous** and **paged** KV caches. + +#### Contiguous KV Cache[#](#contiguous-kv-cache "Link to this heading") + +The contiguous KV cache is a monolithic tensor. Its shape is: + +```None +[max_batch_size * max_beam_width, 2, num_heads, max_seqlen, hidden_dim_per_head]. +``` + +That implementation uses a lot more memory than needed when the sequences are +shorter than the maximum sequence length (even if they end up close to the +limit after the generation of many output tokens, it may take a lot of steps to +reach that point). + +#### Paged KV Cache[#](#paged-kv-cache "Link to this heading") + +The paged KV cache decomposes the KV cache into blocks that are distributed to +the different requests by a cache manager during processing. That cache manager +keeps track of the sequences, allocates new blocks from a pool and recycles those +blocks when required. See the implementation of +[`KVCacheManager`](https://github.com/NVIDIA/TensorRT-LLM/tree/a65b0d4/tensorrt_llm/_torch/pyexecutor/resource_manager.py). + +#### INT8/FP8 KV Caches[#](#int8-fp8-kv-caches "Link to this heading") + +In its current implementation, even if the rest of the network runs in INT8 or +FP8, the attention operator works with FP32, FP16, and BFloat16 inputs and +outputs. However, TensorRT LLM supports INT8 and FP8 +(`QuantMode.INT8_KV_CACHE` and +`QuantMode.FP8_KV_CACHE`) KV caches. + +The attention operator populates the KV cache. When INT8 or FP8 KV caches +are enabled, the input values have to be quantized to 8 bits using a scaling +factor. For quantization, the scaling factor is stored in the +`kv_cache_scaling_factor` tensor. Its shape is `[1]` and only per-tensor +quantization is supported in the current version. Quantization uses inversed scale +since it does multiply as `fp_value * (1.0 / kv_cache_scaling_factor)` in plugin. + +During generation, the values read from the cache are dequantized on-the-fly in +the MHA/MQA kernel. Dequantization is defined as +`quantized_value * kv_cache_scaling_factor`. + +### Sliding Window Attention, Cyclic (Rolling Buffer) KV Cache[#](#sliding-window-attention-cyclic-rolling-buffer-kv-cache "Link to this heading") + +TensorRT LLM has a feature called `Cyclic KV Cache`, which treats the kv cache +as a circular buffer. This means that it only stores the kv cache for the last N +tokens, where N is determined by the `attention_window_size` parameter in +`TrtllmAttention.forward`. When the cache is full, new tokens’ kv cache will +overwrite the “least recently used” caches. + +In the context phase, if the input length surpasses the `attention_window_size`, +`Sliding Window Attention` will be activated. This serves the same function as +the sliding window size. + +This feature helps to reduce the memory footprint of the kv cache when +dealing with very long sequences. + +\_Note that the cyclic kv cache feature doesn’t work with beam searching currently as +the context kv cache are shared across beams. + +### StreamingLLM[#](#streamingllm "Link to this heading") + +The StreamingLLM feature uses a window attention to perform efficient and stable LLM +on long texts, which means that only `N` tokens need to be stored in the KV cache. +Similar to the cyclic KV cache feature in TensorRT LLM, `attention_window_size` +parameter is used to determine `N`. Different from the cyclic KV cache feature, +the first `S` tokens, called sink tokens, are always kept in the attention window, +where `S` is determined by `sink_token_length` parameter. +But in context phase, the self-attentions are dense in the official implementation of +StreamingLLM. It uses all of the tokens for computation and only saves `N` tokens +to the KV cache. + +In addition, the relative position embedding is also changed in StreamingLLM. +When determining the relative distance and adding positional information to tokens, +StreamingLLM use the positions within the cache rather than those in the original text. + +`sink_token_length` is also used to enable this feature. + +### Beam-Search[#](#beam-search "Link to this heading") + +The attention operator supports beam-search. In the context phase, a single +beam is computed per input sequence. In the generation phase, the MHA/MQA/GQA +kernel uses an additional tensor to reconstruct the correct path for each beam. +That tensor is called the `cache_indirection`. Its shape is `[batch_size, beam_width, max_seqlen]`. + +For a sequence `si`, a beam `bi` and a token `ti`, the element +`cache_indirection[si][bi][ti]` is an integer between `0` and `beam_width-1` +that indicates which path in the beam to read the K and V elements from in the +KV cache. This tensor is populated in the sampling stage. + +### Input QKV tensor[#](#input-qkv-tensor "Link to this heading") + +The input QKV tensor packs the Q, K and V tensors (concatenated along the last +dimension) after the projection of the hidden states. It is a 3D tensor. RoPE +and quantization to INT8 or FP8 (when needed) are performed by the GPT +attention operator. + +In packed mode, its shape is `[num_tokens, 3 * hidden_dim]` where +`num_tokens` is the total number of tokens in the batch. For the sequences in +context phase, the number of tokens of a sequence corresponds to its input +length (even if the beam width is greater than `1` for beam search). For the +sequences in generation phase, there are `beam_width` tokens per sequence. The +beam width can be different for each sequence. + +The following pseudo code explains how the number of tokens is computed: + +```None +num_tokens = 0 + +# Add the length of each sequence in context phase. +for seq in context_phase: + num_tokens += seq.length + +# Add the width of the beam for each sequence in generation phase. +for seq in generation_phase: + num_tokens += seq.beam_width +``` + +### Rotary Positional Embedding (RoPE)[#](#rotary-positional-embedding-rope "Link to this heading") + +The attention operator can perform the computation of the Rotary +Positional Embedding (RoPE). When that operation is enabled, +`rotary_embedding_dim` is set to a value greater than 0, it is fused with other +operations. The GPT operator supports GPT-NeoX and GPT-J forms of RoPE by +setting `position_embedding_type` to `PositionEmbeddingType.rope_gpt_neox` +or `PositionEmbeddingType.rope_gptj`. + +### ALiBi[#](#alibi "Link to this heading") + +The attention operator can apply ALiBi to the result of the `Q*K^T` +product. The bias is computed on-the-fly from the ALiBi slopes in the optimized +kernel. + +### Scaling factor(s)[#](#scaling-factor-s "Link to this heading") + +In MHA, the output of the `Q*K^T` product is scaled by a constant value that +is computed as: + +```None +norm_factor = 1.f / (q_scaling * sqrt(head_size)). +``` + +### Cross Attention[#](#cross-attention "Link to this heading") + +On top of the MHA as self attention needed by GPT-style decoder-only models, the attention operator also supports cross attention. + +This enables the attention operator to be more broadly used as a generic decoder component. For example, the Encoder-Decoder model uses it to issue both the self attention and cross attention modules in its Decoder. diff --git a/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc8.md b/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc8.md new file mode 100644 index 0000000000000000000000000000000000000000..aae8af681fa53675e2a24a47187e1a441e2f58e7 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/attention/attention_120rc8.md @@ -0,0 +1,382 @@ +# Multi-Head, Multi-Query, and Group-Query Attention# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc8/features/attention.html +Version: 1.2.0rc8 + +This document details the implementation of multi-head attention (MHA), +multi-query attention (MQA), and group-query attention (GQA) for autoregressive +models in TensorRT LLM’s PyTorch backend. + +Multi-head attention involves a sequence of batched matrix multiplications, a softmax operation, and another batched matrix multiplication, +as described in the [Attention Is All You Need](https://arxiv.org/abs/1706.03762) paper. +[Multi-query Attention (MQA)](https://arxiv.org/abs/1911.02150) and [Group-query Attention (GQA)](https://arxiv.org/abs/2307.09288) are +variants of MHA that use fewer KV heads than the number of query heads. +TensorRT LLM provides several implementations using different backends in `tensorrt_llm/_torch/attention_backend/`. +The following sections explain how to use these implementations and provide a brief guide on implementing new backends. + +## Attention Backends[#](#attention-backends "Link to this heading") + +There are currently three available attention backends: the vanilla backend, the TRT-LLM backend, and the Flashinfer backend. +You can specify the desired attention backend using `PyTorchConfig.attn_backend`. For instance, to utilize the Flashinfer backend, you can pass `attn_backend="flashinfer"` to the `LLM` constructor as follows: `LLM(attn_backend="flashinfer")`. This will enable the use of the Flashinfer backend for your model. + +The vanilla backend, `VanillaAttention`, is a reference implementation designed primarily for inflight batching and linear KV cache support. While it serves as a useful baseline, it is not recommended for production use due to its limited optimizations. + +In contrast, the Flashinfer backend, `FlashInferAttention`, is performance-optimized and supports both inflight batching and paged KV cache. It also includes the following advanced features: + +1. **FP8 Quantization**: This feature enables the quantization of inputs and KV cache into FP8 format, significantly reducing memory usage and improving computational throughput. +2. **RoPE Fusion**: By integrating rotary position embedding (RoPE) directly into the attention computation, this feature enhances efficiency and reduces overhead. + +The TRT-LLM backend, `TrtllmAttention`, serves as the default backend and supports all the features available in the Flashinfer backend while being further optimized for enhanced performance. It is the recommended choice for production environments. Additionally, it offers the following advanced features: + +1. **Fused QKV Input**: It can accept a single QKV tensor as input, which is more efficient compared to using separate Q, K, and V tensors. +2. **FP8 Output**: It supports outputting the attention result in FP8 format, fusing quantization into the attention computation process. + +## Implement a New Attention Backend[#](#implement-a-new-attention-backend "Link to this heading") + +You can implement a new attention backend to integrate other attention libraries. +An attention backend consists of an `AttentionBackend` class and an `AttentionMetadata` class. +There are three stages in the PyTorch that involve the attention backend: + +1. Model construction: During the model’s `__init__`, call `AttentionBackend.__init__` to create an attention backend for each layer. +2. Metadata preparation: Before each forward step of the model: + + 1. If the metadata is uninitialized, call `AttentionMetadata.__init__` to create the attention metadata. + 2. If using CUDA graphs, call `AttentionMetadata.create_cuda_graph_metadata` to convert the metadata to CUDA graph metadata, which pre-allocates all tensors and can be used to capture CUDA graphs. Do not re-allocate any tensors stored inside `AttentionMetadata` after the initial warmup run when using CUDA graphs. + 3. To prepare parameters of the input and KV cache, call `AttentionMetadata.prepare` to convert from existing metadata and KV cache manager. +3. Single step forward: During the forward pass of each attention layer, call `AttentionBackend.forward` to perform the attention operation. The `AttentionMetadata` will be provided as a forward argument. + +### Implement `AttentionMetadata`[#](#implement-attentionmetadata "Link to this heading") + +The `AttentionMetadata` class stores metadata from the batched input and KV cache for the attention backend. +It contains the following predefined fields: + +| Field | Type | Description | +| --- | --- | --- | +| max\_num\_requests | int | The max number of requests in a single batch. | +| num\_contexts | int | The number of context-phase sequences in the batch. | +| num\_generations | int | The number of generation-phase sequences in the batch. | +| max\_num\_tokens | int | The max number of tokens in all requests in a single batch. | +| num\_tokens | int | Number of tokens in the batch. | +| num\_ctx\_tokens | int | Number of tokens in sequences in the context phase. | +| kv\_cache\_manager | KVCacheManager | The KV cache manager. | +| is\_cuda\_graph | bool | Whether CUDA graph is enabled. | +| seq\_lens | Tensor | The length of each sequence in the batch. The shape is (batch\_size), and located on CPU memory. | +| seq\_lens\_cuda | Tensor | A copy of `seq_lens` store on the GPU. | +| context\_lens | Tensor | The length of each context-phase sequence in the batch. The shape is (`num_contexts`). | +| position\_ids | Optional[Tensor] | The position of each token in each sequence. May be None if positional embedding is applied outside of the backend. | +| request\_ids | List[int] | The request ID of each sequence in the batch. | +| prompt\_lens | List[int] | The prompt length of each sequence in the batch. | +| kv\_cache\_params | KVCacheParams | The parameters for the KV cache. | + +During `AttentionMetadata.__init__`, you can initialize additional fields for the new attention metadata. +For example, the Flashinfer metadata initializes `decode_wrapper` here. +During `AttentionMetadata.prepare`, the runtime will fill all predefined fields, and you can fill your customized fields according to these predefined fields. +For example, the Flashinfer metadata fills `qo_indptr` by combining `context_lens` and `num_generations` here. + +### Implement `AttentionBackend`[#](#implement-attentionbackend "Link to this heading") + +The `AttentionBackend` delegates the attention operation to the backend implementation. + +Its `__init__` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| layer\_idx | int | The index of the attention layer in the model. | +| num\_heads | int | The number of query heads. | +| head\_dim | int | The size of each attention head `(hidden_size // num_heads)`. | +| num\_kv\_heads | Optional[int] | The number of KV heads. Defaults to num\_heads if None. | +| quant\_config | QuantConfig | Optional quantization configuration. If None, no quantization is applied. | +| pos\_embd\_params | PositionalEmbeddingParams | Optional parameters defining how positional embedding should be applied. If None, positional embedding should be applied by the model before calling the backend. Otherwise, the backend is in-charge of applying positional embedding and may cache K without embedding it first. | + +Its `forward` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| q | Tensor | Query tensor with shape `(num_tokens, num_heads * head_dim)`. | +| k | Tensor | Key tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| v | Tensor | Value tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| metadata | AttentionMetadata | Metadata for the attention operation. | +| attention\_mask | AttentionMask | Optional attention mask. If None, causal mask is applied. | + +For example, the Flashinfer backend calls `append_paged_kv_cache` and then `wrapper.run` to perform the attention operation here. + +## The Features of the `TrtllmAttention` Backend[#](#the-features-of-the-trtllmattention-backend "Link to this heading") + +The following sections introduce some features of the default `TrtllmAttention` backend. + +### Packed Tensors[#](#packed-tensors "Link to this heading") + +In the `TrtllmAttention` backend, the attention operator supports the packed (i.e. non padded) QKV inputs. +A naive layout for the QKV inputs is padding the sequences +that are shorter than the `max_sequence_length` to the maximum +length. It may result in excessive memory consumption as well as unneeded +computations on padding tokens (in the various matrix multiplications that +surround the MHA block). +To overcome that problem, TensorRT LLM supports a mode without padding where +the different tokens are packed together and the user provides the operator +with a 1D tensor containing the lengths of the different sequences. + +### Context and Generation Phases[#](#context-and-generation-phases "Link to this heading") + +The `TrtllmAttention` backend encapsulates different implementations for both +context and generation phases into a single custom torch op. + +#### Context Phase[#](#context-phase "Link to this heading") + +A context-phase implementation without optimization maps to a sequence of GPU kernels that will store the +intermediate `Q*K^T` tensor in memory before calling the softmax operator. It +is the slowest method and the memory footprint is significant (grows quadratically in proportion to the sequence length). + +The `TrtllmAttention` backend will trigger a kernel that performs the MHA/MQA block +using a single kernel instead. For short sequences, that kernel uses a vanilla +implementation of MHA/MQA. For larger sequences, this kernel uses the Flash +Attention algorithm as described in +[FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness](https://arxiv.org/abs/2205.14135) +and +[FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning](https://arxiv.org/abs/2307.08691). + +Currently, the implementation triggers extra kernels that apply pre-processing +to the elements (like RoPE) and populate the KV cache (see below). In a future +release, the number of such kernels may be reduced to improve the overall performance. + +#### FP8 Context FMHA[#](#fp8-context-fmha "Link to this heading") + +When FP8 quantization is activated, the attention can be further accelerated by +enabling FP8 Context FMHA. + +FP8 Paged Context FMHA is also supported with the fp8 quantization workflow. +You need to specify `use_paged_context_fmha = True` for the attention operator. + +Please be aware that this feature is only supported on Ada, Hopper and above. + +#### Generation Phase[#](#generation-phase "Link to this heading") + +The generation phase is implemented using a single kernel called the masked +multi-head attention in TensorRT LLM. That kernel is able to apply +pre-processing on the Q, K, and V elements on-the-fly: it adds the QKV bias, applies +RoPE, and performs dequantization and quantization. TensorRT LLM will continue to add (or +enable) additional features in future releases, such as enabling support for IA3. + +The masked MHA kernel has a special version that distributes the work across +multiple CUDA thread-blocks on the GPU for cases where the GPU occupancy is +low. That mode called multi-block is always enabled. +NVIDIA recommends users to test that mode in scenarios where both the batch +size and the number of heads in the model are relatively small. +The definition of ‘small’ in that context is hard to quantify because it depends on the model of the GPU. +However, NVIDIA currently recommends testing that mode when `batch_size * num_heads` is less than the number of multi-processors on the GPU. +This guidance may be subject to change in the future. + +Note that even if the multi-block mode is enabled, the attention operator will +not immediately trigger the multi-block version of the GPU kernel. There is a +minimum number of tokens (input + generated) that are required for the +multi-block version to become more efficient than the “vanilla” implementation +that uses a single CUDA thread-block per head. It is controlled by an internal +heuristic. + +Another note is that as the masked MHA kernels use shared memory size +proportional to sequence length, so there can be some cases that GPU’s shared +memory is not enough when multi-block mode is not enabled. To get masked MHA kernel to work in those cases, multi-block mode is forced on and a warning message is printed in the log. + +#### XQA Optimization[#](#xqa-optimization "Link to this heading") + +XQA optimization is another optimization for MQA/GQA in the generation phase. +It currently only supports a limited number of model configurations, such as the LLAMA2 70B model. + +Support matrix of the XQA optimization: + +* FP16 / BF16 compute data type. +* FP16 / BF16 / FP8 / INT8 KV cache data type. +* Paged KV cache (8 / 16 / 32 / 64 / 128 tokens per block). + +By default, this is enabled. Note that a heuristic algorithm +is also used to decide whether to use XQA kernel or masked MHA kernel to get +better performance. +If you want to use that kernel whenever possible, set `TRTLLM_FORCE_XQA=1` to force use of the XQA kernel when the model config is supported. +Supported configurations can be found using the `shouldUse` function of the `DecoderXQARunner` class in +`cpp/tensorrt_llm/kernels/decoderMaskedMultiheadAttention/decoderXQARunner.h`. + +### In-flight Batching[#](#in-flight-batching "Link to this heading") + +TensorRT LLM supports in-flight batching of requests (also known as continuous +batching or iteration-level batching) for higher serving throughput. With this feature, +sequences in the context phase can be processed together with sequences in +the generation phase. The purpose of that technique is to better interleave +requests to reduce latency as well as make better use of the GPUs. +For efficiency reasons (1), the support for inflight batching ***requires the +input tensors to be packed (no padding)***. + +***In the current implementation, the sequences that are going through the +context phase must be before the sequences in the generation phase in the input +tensor. For example, for sequences `S0`, `S1` and `S2`, if `S0` and `S2` are in +context phase (and `S1` in generation), tokens from `S0` and `S2` must appear +before the tokens of `S1` in the input tensor***. + +*(1) Padding sequences in the generation phase, that contain a single token, to +the length of the maximum input sequence is inefficient use of resources*. + +### Chunked Context[#](#chunked-context "Link to this heading") + +In the original state, the common behavior was to process all context tokens at +once. This feature splits the context into several chunks. In this way, the +context chunks can be batched with more tokens during the generation phase, +which is expected to increase the total throughput. Chunking contexts also removes +constraints on input length. Except for the last one, the size of the context chunk needs +to be an integer multiple of the kv-cache block size. + +> To enable this feature, the FMHA paged kv-cache also needs to be enabled. + +### KV Cache[#](#kv-cache "Link to this heading") + +In the generation phase, a common optimization is to provide the MHA kernel +with a cache containing the values of the past K and V elements that have +already been computed. That cache is known as the KV cache. TensorRT LLM uses +that technique to accelerate its generation phase. In TensorRT LLM, there is +one KV cache per Transformer layer, which means that there are as many KV +caches as layers in a model. The current version of TensorRT LLM supports two +different types of KV caches: **contiguous** and **paged** KV caches. + +#### Contiguous KV Cache[#](#contiguous-kv-cache "Link to this heading") + +The contiguous KV cache is a monolithic tensor. Its shape is: + +```None +[max_batch_size * max_beam_width, 2, num_heads, max_seqlen, hidden_dim_per_head]. +``` + +That implementation uses a lot more memory than needed when the sequences are +shorter than the maximum sequence length (even if they end up close to the +limit after the generation of many output tokens, it may take a lot of steps to +reach that point). + +#### Paged KV Cache[#](#paged-kv-cache "Link to this heading") + +The paged KV cache decomposes the KV cache into blocks that are distributed to +the different requests by a cache manager during processing. That cache manager +keeps track of the sequences, allocates new blocks from a pool and recycles those +blocks when required. See the implementation of +[`KVCacheManager`](https://github.com/NVIDIA/TensorRT-LLM/tree/80649a8/tensorrt_llm/_torch/pyexecutor/resource_manager.py). + +#### INT8/FP8 KV Caches[#](#int8-fp8-kv-caches "Link to this heading") + +In its current implementation, even if the rest of the network runs in INT8 or +FP8, the attention operator works with FP32, FP16, and BFloat16 inputs and +outputs. However, TensorRT LLM supports INT8 and FP8 +(`QuantMode.INT8_KV_CACHE` and +`QuantMode.FP8_KV_CACHE`) KV caches. + +The attention operator populates the KV cache. When INT8 or FP8 KV caches +are enabled, the input values have to be quantized to 8 bits using a scaling +factor. For quantization, the scaling factor is stored in the +`kv_cache_scaling_factor` tensor. Its shape is `[1]` and only per-tensor +quantization is supported in the current version. Quantization uses inversed scale +since it does multiply as `fp_value * (1.0 / kv_cache_scaling_factor)` in plugin. + +During generation, the values read from the cache are dequantized on-the-fly in +the MHA/MQA kernel. Dequantization is defined as +`quantized_value * kv_cache_scaling_factor`. + +### Sliding Window Attention, Cyclic (Rolling Buffer) KV Cache[#](#sliding-window-attention-cyclic-rolling-buffer-kv-cache "Link to this heading") + +TensorRT LLM has a feature called `Cyclic KV Cache`, which treats the kv cache +as a circular buffer. This means that it only stores the kv cache for the last N +tokens, where N is determined by the `attention_window_size` parameter in +`TrtllmAttention.forward`. When the cache is full, new tokens’ kv cache will +overwrite the “least recently used” caches. + +In the context phase, if the input length surpasses the `attention_window_size`, +`Sliding Window Attention` will be activated. This serves the same function as +the sliding window size. + +This feature helps to reduce the memory footprint of the kv cache when +dealing with very long sequences. + +\_Note that the cyclic kv cache feature doesn’t work with beam searching currently as +the context kv cache are shared across beams. + +### StreamingLLM[#](#streamingllm "Link to this heading") + +The StreamingLLM feature uses a window attention to perform efficient and stable LLM +on long texts, which means that only `N` tokens need to be stored in the KV cache. +Similar to the cyclic KV cache feature in TensorRT LLM, `attention_window_size` +parameter is used to determine `N`. Different from the cyclic KV cache feature, +the first `S` tokens, called sink tokens, are always kept in the attention window, +where `S` is determined by `sink_token_length` parameter. +But in context phase, the self-attentions are dense in the official implementation of +StreamingLLM. It uses all of the tokens for computation and only saves `N` tokens +to the KV cache. + +In addition, the relative position embedding is also changed in StreamingLLM. +When determining the relative distance and adding positional information to tokens, +StreamingLLM use the positions within the cache rather than those in the original text. + +`sink_token_length` is also used to enable this feature. + +### Beam-Search[#](#beam-search "Link to this heading") + +The attention operator supports beam-search. In the context phase, a single +beam is computed per input sequence. In the generation phase, the MHA/MQA/GQA +kernel uses an additional tensor to reconstruct the correct path for each beam. +That tensor is called the `cache_indirection`. Its shape is `[batch_size, beam_width, max_seqlen]`. + +For a sequence `si`, a beam `bi` and a token `ti`, the element +`cache_indirection[si][bi][ti]` is an integer between `0` and `beam_width-1` +that indicates which path in the beam to read the K and V elements from in the +KV cache. This tensor is populated in the sampling stage. + +### Input QKV tensor[#](#input-qkv-tensor "Link to this heading") + +The input QKV tensor packs the Q, K and V tensors (concatenated along the last +dimension) after the projection of the hidden states. It is a 3D tensor. RoPE +and quantization to INT8 or FP8 (when needed) are performed by the GPT +attention operator. + +In packed mode, its shape is `[num_tokens, 3 * hidden_dim]` where +`num_tokens` is the total number of tokens in the batch. For the sequences in +context phase, the number of tokens of a sequence corresponds to its input +length (even if the beam width is greater than `1` for beam search). For the +sequences in generation phase, there are `beam_width` tokens per sequence. The +beam width can be different for each sequence. + +The following pseudo code explains how the number of tokens is computed: + +```None +num_tokens = 0 + +# Add the length of each sequence in context phase. +for seq in context_phase: + num_tokens += seq.length + +# Add the width of the beam for each sequence in generation phase. +for seq in generation_phase: + num_tokens += seq.beam_width +``` + +### Rotary Positional Embedding (RoPE)[#](#rotary-positional-embedding-rope "Link to this heading") + +The attention operator can perform the computation of the Rotary +Positional Embedding (RoPE). When that operation is enabled, +`rotary_embedding_dim` is set to a value greater than 0, it is fused with other +operations. The GPT operator supports GPT-NeoX and GPT-J forms of RoPE by +setting `position_embedding_type` to `PositionEmbeddingType.rope_gpt_neox` +or `PositionEmbeddingType.rope_gptj`. + +### ALiBi[#](#alibi "Link to this heading") + +The attention operator can apply ALiBi to the result of the `Q*K^T` +product. The bias is computed on-the-fly from the ALiBi slopes in the optimized +kernel. + +### Scaling factor(s)[#](#scaling-factor-s "Link to this heading") + +In MHA, the output of the `Q*K^T` product is scaled by a constant value that +is computed as: + +```None +norm_factor = 1.f / (q_scaling * sqrt(head_size)). +``` + +### Cross Attention[#](#cross-attention "Link to this heading") + +On top of the MHA as self attention needed by GPT-style decoder-only models, the attention operator also supports cross attention. + +This enables the attention operator to be more broadly used as a generic decoder component. For example, the Encoder-Decoder model uses it to issue both the self attention and cross attention modules in its Decoder. diff --git a/corpus/docs/nvidia_tensorrt-llm/attention/attention_130rc0.md b/corpus/docs/nvidia_tensorrt-llm/attention/attention_130rc0.md new file mode 100644 index 0000000000000000000000000000000000000000..63aebaca68ee834808b77aeee33d60bf3554a00c --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/attention/attention_130rc0.md @@ -0,0 +1,382 @@ +# Multi-Head, Multi-Query, and Group-Query Attention# + +Source: https://nvidia.github.io/TensorRT-LLM/1.3.0rc0/features/attention.html +Version: 1.3.0rc0 + +This document details the implementation of multi-head attention (MHA), +multi-query attention (MQA), and group-query attention (GQA) for autoregressive +models in TensorRT LLM’s PyTorch backend. + +Multi-head attention involves a sequence of batched matrix multiplications, a softmax operation, and another batched matrix multiplication, +as described in the [Attention Is All You Need](https://arxiv.org/abs/1706.03762) paper. +[Multi-query Attention (MQA)](https://arxiv.org/abs/1911.02150) and [Group-query Attention (GQA)](https://arxiv.org/abs/2307.09288) are +variants of MHA that use fewer KV heads than the number of query heads. +TensorRT LLM provides several implementations using different backends in `tensorrt_llm/_torch/attention_backend/`. +The following sections explain how to use these implementations and provide a brief guide on implementing new backends. + +## Attention Backends[#](#attention-backends "Link to this heading") + +There are currently three available attention backends: the vanilla backend, the TRT-LLM backend, and the Flashinfer backend. +You can specify the desired attention backend using `PyTorchConfig.attn_backend`. For instance, to utilize the Flashinfer backend, you can pass `attn_backend="flashinfer"` to the `LLM` constructor as follows: `LLM(attn_backend="flashinfer")`. This will enable the use of the Flashinfer backend for your model. + +The vanilla backend, `VanillaAttention`, is a reference implementation designed primarily for inflight batching and linear KV cache support. While it serves as a useful baseline, it is not recommended for production use due to its limited optimizations. + +In contrast, the Flashinfer backend, `FlashInferAttention`, is performance-optimized and supports both inflight batching and paged KV cache. It also includes the following advanced features: + +1. **FP8 Quantization**: This feature enables the quantization of inputs and KV cache into FP8 format, significantly reducing memory usage and improving computational throughput. +2. **RoPE Fusion**: By integrating rotary position embedding (RoPE) directly into the attention computation, this feature enhances efficiency and reduces overhead. + +The TRT-LLM backend, `TrtllmAttention`, serves as the default backend and supports all the features available in the Flashinfer backend while being further optimized for enhanced performance. It is the recommended choice for production environments. Additionally, it offers the following advanced features: + +1. **Fused QKV Input**: It can accept a single QKV tensor as input, which is more efficient compared to using separate Q, K, and V tensors. +2. **FP8 Output**: It supports outputting the attention result in FP8 format, fusing quantization into the attention computation process. + +## Implement a New Attention Backend[#](#implement-a-new-attention-backend "Link to this heading") + +You can implement a new attention backend to integrate other attention libraries. +An attention backend consists of an `AttentionBackend` class and an `AttentionMetadata` class. +There are three stages in the PyTorch that involve the attention backend: + +1. Model construction: During the model’s `__init__`, call `AttentionBackend.__init__` to create an attention backend for each layer. +2. Metadata preparation: Before each forward step of the model: + + 1. If the metadata is uninitialized, call `AttentionMetadata.__init__` to create the attention metadata. + 2. If using CUDA graphs, call `AttentionMetadata.create_cuda_graph_metadata` to convert the metadata to CUDA graph metadata, which pre-allocates all tensors and can be used to capture CUDA graphs. Do not re-allocate any tensors stored inside `AttentionMetadata` after the initial warmup run when using CUDA graphs. + 3. To prepare parameters of the input and KV cache, call `AttentionMetadata.prepare` to convert from existing metadata and KV cache manager. +3. Single step forward: During the forward pass of each attention layer, call `AttentionBackend.forward` to perform the attention operation. The `AttentionMetadata` will be provided as a forward argument. + +### Implement `AttentionMetadata`[#](#implement-attentionmetadata "Link to this heading") + +The `AttentionMetadata` class stores metadata from the batched input and KV cache for the attention backend. +It contains the following predefined fields: + +| Field | Type | Description | +| --- | --- | --- | +| max\_num\_requests | int | The max number of requests in a single batch. | +| num\_contexts | int | The number of context-phase sequences in the batch. | +| num\_generations | int | The number of generation-phase sequences in the batch. | +| max\_num\_tokens | int | The max number of tokens in all requests in a single batch. | +| num\_tokens | int | Number of tokens in the batch. | +| num\_ctx\_tokens | int | Number of tokens in sequences in the context phase. | +| kv\_cache\_manager | KVCacheManager | The KV cache manager. | +| is\_cuda\_graph | bool | Whether CUDA graph is enabled. | +| seq\_lens | Tensor | The length of each sequence in the batch. The shape is (batch\_size), and located on CPU memory. | +| seq\_lens\_cuda | Tensor | A copy of `seq_lens` store on the GPU. | +| context\_lens | Tensor | The length of each context-phase sequence in the batch. The shape is (`num_contexts`). | +| position\_ids | Optional[Tensor] | The position of each token in each sequence. May be None if positional embedding is applied outside of the backend. | +| request\_ids | List[int] | The request ID of each sequence in the batch. | +| prompt\_lens | List[int] | The prompt length of each sequence in the batch. | +| kv\_cache\_params | KVCacheParams | The parameters for the KV cache. | + +During `AttentionMetadata.__init__`, you can initialize additional fields for the new attention metadata. +For example, the Flashinfer metadata initializes `decode_wrapper` here. +During `AttentionMetadata.prepare`, the runtime will fill all predefined fields, and you can fill your customized fields according to these predefined fields. +For example, the Flashinfer metadata fills `qo_indptr` by combining `context_lens` and `num_generations` here. + +### Implement `AttentionBackend`[#](#implement-attentionbackend "Link to this heading") + +The `AttentionBackend` delegates the attention operation to the backend implementation. + +Its `__init__` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| layer\_idx | int | The index of the attention layer in the model. | +| num\_heads | int | The number of query heads. | +| head\_dim | int | The size of each attention head `(hidden_size // num_heads)`. | +| num\_kv\_heads | Optional[int] | The number of KV heads. Defaults to num\_heads if None. | +| quant\_config | QuantConfig | Optional quantization configuration. If None, no quantization is applied. | +| pos\_embd\_params | PositionalEmbeddingParams | Optional parameters defining how positional embedding should be applied. If None, positional embedding should be applied by the model before calling the backend. Otherwise, the backend is in-charge of applying positional embedding and may cache K without embedding it first. | + +Its `forward` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| q | Tensor | Query tensor with shape `(num_tokens, num_heads * head_dim)`. | +| k | Tensor | Key tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| v | Tensor | Value tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| metadata | AttentionMetadata | Metadata for the attention operation. | +| attention\_mask | AttentionMask | Optional attention mask. If None, causal mask is applied. | + +For example, the Flashinfer backend calls `append_paged_kv_cache` and then `wrapper.run` to perform the attention operation here. + +## The Features of the `TrtllmAttention` Backend[#](#the-features-of-the-trtllmattention-backend "Link to this heading") + +The following sections introduce some features of the default `TrtllmAttention` backend. + +### Packed Tensors[#](#packed-tensors "Link to this heading") + +In the `TrtllmAttention` backend, the attention operator supports the packed (i.e. non padded) QKV inputs. +A naive layout for the QKV inputs is padding the sequences +that are shorter than the `max_sequence_length` to the maximum +length. It may result in excessive memory consumption as well as unneeded +computations on padding tokens (in the various matrix multiplications that +surround the MHA block). +To overcome that problem, TensorRT LLM supports a mode without padding where +the different tokens are packed together and the user provides the operator +with a 1D tensor containing the lengths of the different sequences. + +### Context and Generation Phases[#](#context-and-generation-phases "Link to this heading") + +The `TrtllmAttention` backend encapsulates different implementations for both +context and generation phases into a single custom torch op. + +#### Context Phase[#](#context-phase "Link to this heading") + +A context-phase implementation without optimization maps to a sequence of GPU kernels that will store the +intermediate `Q*K^T` tensor in memory before calling the softmax operator. It +is the slowest method and the memory footprint is significant (grows quadratically in proportion to the sequence length). + +The `TrtllmAttention` backend will trigger a kernel that performs the MHA/MQA block +using a single kernel instead. For short sequences, that kernel uses a vanilla +implementation of MHA/MQA. For larger sequences, this kernel uses the Flash +Attention algorithm as described in +[FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness](https://arxiv.org/abs/2205.14135) +and +[FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning](https://arxiv.org/abs/2307.08691). + +Currently, the implementation triggers extra kernels that apply pre-processing +to the elements (like RoPE) and populate the KV cache (see below). In a future +release, the number of such kernels may be reduced to improve the overall performance. + +#### FP8 Context FMHA[#](#fp8-context-fmha "Link to this heading") + +When FP8 quantization is activated, the attention can be further accelerated by +enabling FP8 Context FMHA. + +FP8 Paged Context FMHA is also supported with the fp8 quantization workflow. +You need to specify `use_paged_context_fmha = True` for the attention operator. + +Please be aware that this feature is only supported on Ada, Hopper and above. + +#### Generation Phase[#](#generation-phase "Link to this heading") + +The generation phase is implemented using a single kernel called the masked +multi-head attention in TensorRT LLM. That kernel is able to apply +pre-processing on the Q, K, and V elements on-the-fly: it adds the QKV bias, applies +RoPE, and performs dequantization and quantization. TensorRT LLM will continue to add (or +enable) additional features in future releases, such as enabling support for IA3. + +The masked MHA kernel has a special version that distributes the work across +multiple CUDA thread-blocks on the GPU for cases where the GPU occupancy is +low. That mode called multi-block is always enabled. +NVIDIA recommends users to test that mode in scenarios where both the batch +size and the number of heads in the model are relatively small. +The definition of ‘small’ in that context is hard to quantify because it depends on the model of the GPU. +However, NVIDIA currently recommends testing that mode when `batch_size * num_heads` is less than the number of multi-processors on the GPU. +This guidance may be subject to change in the future. + +Note that even if the multi-block mode is enabled, the attention operator will +not immediately trigger the multi-block version of the GPU kernel. There is a +minimum number of tokens (input + generated) that are required for the +multi-block version to become more efficient than the “vanilla” implementation +that uses a single CUDA thread-block per head. It is controlled by an internal +heuristic. + +Another note is that as the masked MHA kernels use shared memory size +proportional to sequence length, so there can be some cases that GPU’s shared +memory is not enough when multi-block mode is not enabled. To get masked MHA kernel to work in those cases, multi-block mode is forced on and a warning message is printed in the log. + +#### XQA Optimization[#](#xqa-optimization "Link to this heading") + +XQA optimization is another optimization for MQA/GQA in the generation phase. +It currently only supports a limited number of model configurations, such as the LLAMA2 70B model. + +Support matrix of the XQA optimization: + +* FP16 / BF16 compute data type. +* FP16 / BF16 / FP8 / INT8 KV cache data type. +* Paged KV cache (8 / 16 / 32 / 64 / 128 tokens per block). + +By default, this is enabled. Note that a heuristic algorithm +is also used to decide whether to use XQA kernel or masked MHA kernel to get +better performance. +If you want to use that kernel whenever possible, set `TRTLLM_FORCE_XQA=1` to force use of the XQA kernel when the model config is supported. +Supported configurations can be found using the `shouldUse` function of the `DecoderXQARunner` class in +`cpp/tensorrt_llm/kernels/decoderMaskedMultiheadAttention/decoderXQARunner.h`. + +### In-flight Batching[#](#in-flight-batching "Link to this heading") + +TensorRT LLM supports in-flight batching of requests (also known as continuous +batching or iteration-level batching) for higher serving throughput. With this feature, +sequences in the context phase can be processed together with sequences in +the generation phase. The purpose of that technique is to better interleave +requests to reduce latency as well as make better use of the GPUs. +For efficiency reasons (1), the support for inflight batching ***requires the +input tensors to be packed (no padding)***. + +***In the current implementation, the sequences that are going through the +context phase must be before the sequences in the generation phase in the input +tensor. For example, for sequences `S0`, `S1` and `S2`, if `S0` and `S2` are in +context phase (and `S1` in generation), tokens from `S0` and `S2` must appear +before the tokens of `S1` in the input tensor***. + +*(1) Padding sequences in the generation phase, that contain a single token, to +the length of the maximum input sequence is inefficient use of resources*. + +### Chunked Context[#](#chunked-context "Link to this heading") + +In the original state, the common behavior was to process all context tokens at +once. This feature splits the context into several chunks. In this way, the +context chunks can be batched with more tokens during the generation phase, +which is expected to increase the total throughput. Chunking contexts also removes +constraints on input length. Except for the last one, the size of the context chunk needs +to be an integer multiple of the kv-cache block size. + +> To enable this feature, the FMHA paged kv-cache also needs to be enabled. + +### KV Cache[#](#kv-cache "Link to this heading") + +In the generation phase, a common optimization is to provide the MHA kernel +with a cache containing the values of the past K and V elements that have +already been computed. That cache is known as the KV cache. TensorRT LLM uses +that technique to accelerate its generation phase. In TensorRT LLM, there is +one KV cache per Transformer layer, which means that there are as many KV +caches as layers in a model. The current version of TensorRT LLM supports two +different types of KV caches: **contiguous** and **paged** KV caches. + +#### Contiguous KV Cache[#](#contiguous-kv-cache "Link to this heading") + +The contiguous KV cache is a monolithic tensor. Its shape is: + +```None +[max_batch_size * max_beam_width, 2, num_heads, max_seqlen, hidden_dim_per_head]. +``` + +That implementation uses a lot more memory than needed when the sequences are +shorter than the maximum sequence length (even if they end up close to the +limit after the generation of many output tokens, it may take a lot of steps to +reach that point). + +#### Paged KV Cache[#](#paged-kv-cache "Link to this heading") + +The paged KV cache decomposes the KV cache into blocks that are distributed to +the different requests by a cache manager during processing. That cache manager +keeps track of the sequences, allocates new blocks from a pool and recycles those +blocks when required. See the implementation of +[`KVCacheManager`](https://github.com/NVIDIA/TensorRT-LLM/tree/0af1a0e/tensorrt_llm/_torch/pyexecutor/resource_manager.py). + +#### INT8/FP8 KV Caches[#](#int8-fp8-kv-caches "Link to this heading") + +In its current implementation, even if the rest of the network runs in INT8 or +FP8, the attention operator works with FP32, FP16, and BFloat16 inputs and +outputs. However, TensorRT LLM supports INT8 and FP8 +(`QuantMode.INT8_KV_CACHE` and +`QuantMode.FP8_KV_CACHE`) KV caches. + +The attention operator populates the KV cache. When INT8 or FP8 KV caches +are enabled, the input values have to be quantized to 8 bits using a scaling +factor. For quantization, the scaling factor is stored in the +`kv_cache_scaling_factor` tensor. Its shape is `[1]` and only per-tensor +quantization is supported in the current version. Quantization uses inversed scale +since it does multiply as `fp_value * (1.0 / kv_cache_scaling_factor)` in plugin. + +During generation, the values read from the cache are dequantized on-the-fly in +the MHA/MQA kernel. Dequantization is defined as +`quantized_value * kv_cache_scaling_factor`. + +### Sliding Window Attention, Cyclic (Rolling Buffer) KV Cache[#](#sliding-window-attention-cyclic-rolling-buffer-kv-cache "Link to this heading") + +TensorRT LLM has a feature called `Cyclic KV Cache`, which treats the kv cache +as a circular buffer. This means that it only stores the kv cache for the last N +tokens, where N is determined by the `attention_window_size` parameter in +`TrtllmAttention.forward`. When the cache is full, new tokens’ kv cache will +overwrite the “least recently used” caches. + +In the context phase, if the input length surpasses the `attention_window_size`, +`Sliding Window Attention` will be activated. This serves the same function as +the sliding window size. + +This feature helps to reduce the memory footprint of the kv cache when +dealing with very long sequences. + +\_Note that the cyclic kv cache feature doesn’t work with beam searching currently as +the context kv cache are shared across beams. + +### StreamingLLM[#](#streamingllm "Link to this heading") + +The StreamingLLM feature uses a window attention to perform efficient and stable LLM +on long texts, which means that only `N` tokens need to be stored in the KV cache. +Similar to the cyclic KV cache feature in TensorRT LLM, `attention_window_size` +parameter is used to determine `N`. Different from the cyclic KV cache feature, +the first `S` tokens, called sink tokens, are always kept in the attention window, +where `S` is determined by `sink_token_length` parameter. +But in context phase, the self-attentions are dense in the official implementation of +StreamingLLM. It uses all of the tokens for computation and only saves `N` tokens +to the KV cache. + +In addition, the relative position embedding is also changed in StreamingLLM. +When determining the relative distance and adding positional information to tokens, +StreamingLLM use the positions within the cache rather than those in the original text. + +`sink_token_length` is also used to enable this feature. + +### Beam-Search[#](#beam-search "Link to this heading") + +The attention operator supports beam-search. In the context phase, a single +beam is computed per input sequence. In the generation phase, the MHA/MQA/GQA +kernel uses an additional tensor to reconstruct the correct path for each beam. +That tensor is called the `cache_indirection`. Its shape is `[batch_size, beam_width, max_seqlen]`. + +For a sequence `si`, a beam `bi` and a token `ti`, the element +`cache_indirection[si][bi][ti]` is an integer between `0` and `beam_width-1` +that indicates which path in the beam to read the K and V elements from in the +KV cache. This tensor is populated in the sampling stage. + +### Input QKV tensor[#](#input-qkv-tensor "Link to this heading") + +The input QKV tensor packs the Q, K and V tensors (concatenated along the last +dimension) after the projection of the hidden states. It is a 3D tensor. RoPE +and quantization to INT8 or FP8 (when needed) are performed by the GPT +attention operator. + +In packed mode, its shape is `[num_tokens, 3 * hidden_dim]` where +`num_tokens` is the total number of tokens in the batch. For the sequences in +context phase, the number of tokens of a sequence corresponds to its input +length (even if the beam width is greater than `1` for beam search). For the +sequences in generation phase, there are `beam_width` tokens per sequence. The +beam width can be different for each sequence. + +The following pseudo code explains how the number of tokens is computed: + +```None +num_tokens = 0 + +# Add the length of each sequence in context phase. +for seq in context_phase: + num_tokens += seq.length + +# Add the width of the beam for each sequence in generation phase. +for seq in generation_phase: + num_tokens += seq.beam_width +``` + +### Rotary Positional Embedding (RoPE)[#](#rotary-positional-embedding-rope "Link to this heading") + +The attention operator can perform the computation of the Rotary +Positional Embedding (RoPE). When that operation is enabled, +`rotary_embedding_dim` is set to a value greater than 0, it is fused with other +operations. The GPT operator supports GPT-NeoX and GPT-J forms of RoPE by +setting `position_embedding_type` to `PositionEmbeddingType.rope_gpt_neox` +or `PositionEmbeddingType.rope_gptj`. + +### ALiBi[#](#alibi "Link to this heading") + +The attention operator can apply ALiBi to the result of the `Q*K^T` +product. The bias is computed on-the-fly from the ALiBi slopes in the optimized +kernel. + +### Scaling factor(s)[#](#scaling-factor-s "Link to this heading") + +In MHA, the output of the `Q*K^T` product is scaled by a constant value that +is computed as: + +```None +norm_factor = 1.f / (q_scaling * sqrt(head_size)). +``` + +### Cross Attention[#](#cross-attention "Link to this heading") + +On top of the MHA as self attention needed by GPT-style decoder-only models, the attention operator also supports cross attention. + +This enables the attention operator to be more broadly used as a generic decoder component. For example, the Encoder-Decoder model uses it to issue both the self attention and cross attention modules in its Decoder. diff --git a/corpus/docs/nvidia_tensorrt-llm/attention/attention_130rc1.md b/corpus/docs/nvidia_tensorrt-llm/attention/attention_130rc1.md new file mode 100644 index 0000000000000000000000000000000000000000..81bcf0960852f6355cfe47cd10d70090f0fc7a22 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/attention/attention_130rc1.md @@ -0,0 +1,382 @@ +# Multi-Head, Multi-Query, and Group-Query Attention# + +Source: https://nvidia.github.io/TensorRT-LLM/1.3.0rc1/features/attention.html +Version: 1.3.0rc1 + +This document details the implementation of multi-head attention (MHA), +multi-query attention (MQA), and group-query attention (GQA) for autoregressive +models in TensorRT LLM’s PyTorch backend. + +Multi-head attention involves a sequence of batched matrix multiplications, a softmax operation, and another batched matrix multiplication, +as described in the [Attention Is All You Need](https://arxiv.org/abs/1706.03762) paper. +[Multi-query Attention (MQA)](https://arxiv.org/abs/1911.02150) and [Group-query Attention (GQA)](https://arxiv.org/abs/2307.09288) are +variants of MHA that use fewer KV heads than the number of query heads. +TensorRT LLM provides several implementations using different backends in `tensorrt_llm/_torch/attention_backend/`. +The following sections explain how to use these implementations and provide a brief guide on implementing new backends. + +## Attention Backends[#](#attention-backends "Link to this heading") + +There are currently three available attention backends: the vanilla backend, the TRT-LLM backend, and the Flashinfer backend. +You can specify the desired attention backend using `PyTorchConfig.attn_backend`. For instance, to utilize the Flashinfer backend, you can pass `attn_backend="flashinfer"` to the `LLM` constructor as follows: `LLM(attn_backend="flashinfer")`. This will enable the use of the Flashinfer backend for your model. + +The vanilla backend, `VanillaAttention`, is a reference implementation designed primarily for inflight batching and linear KV cache support. While it serves as a useful baseline, it is not recommended for production use due to its limited optimizations. + +In contrast, the Flashinfer backend, `FlashInferAttention`, is performance-optimized and supports both inflight batching and paged KV cache. It also includes the following advanced features: + +1. **FP8 Quantization**: This feature enables the quantization of inputs and KV cache into FP8 format, significantly reducing memory usage and improving computational throughput. +2. **RoPE Fusion**: By integrating rotary position embedding (RoPE) directly into the attention computation, this feature enhances efficiency and reduces overhead. + +The TRT-LLM backend, `TrtllmAttention`, serves as the default backend and supports all the features available in the Flashinfer backend while being further optimized for enhanced performance. It is the recommended choice for production environments. Additionally, it offers the following advanced features: + +1. **Fused QKV Input**: It can accept a single QKV tensor as input, which is more efficient compared to using separate Q, K, and V tensors. +2. **FP8 Output**: It supports outputting the attention result in FP8 format, fusing quantization into the attention computation process. + +## Implement a New Attention Backend[#](#implement-a-new-attention-backend "Link to this heading") + +You can implement a new attention backend to integrate other attention libraries. +An attention backend consists of an `AttentionBackend` class and an `AttentionMetadata` class. +There are three stages in the PyTorch that involve the attention backend: + +1. Model construction: During the model’s `__init__`, call `AttentionBackend.__init__` to create an attention backend for each layer. +2. Metadata preparation: Before each forward step of the model: + + 1. If the metadata is uninitialized, call `AttentionMetadata.__init__` to create the attention metadata. + 2. If using CUDA graphs, call `AttentionMetadata.create_cuda_graph_metadata` to convert the metadata to CUDA graph metadata, which pre-allocates all tensors and can be used to capture CUDA graphs. Do not re-allocate any tensors stored inside `AttentionMetadata` after the initial warmup run when using CUDA graphs. + 3. To prepare parameters of the input and KV cache, call `AttentionMetadata.prepare` to convert from existing metadata and KV cache manager. +3. Single step forward: During the forward pass of each attention layer, call `AttentionBackend.forward` to perform the attention operation. The `AttentionMetadata` will be provided as a forward argument. + +### Implement `AttentionMetadata`[#](#implement-attentionmetadata "Link to this heading") + +The `AttentionMetadata` class stores metadata from the batched input and KV cache for the attention backend. +It contains the following predefined fields: + +| Field | Type | Description | +| --- | --- | --- | +| max\_num\_requests | int | The max number of requests in a single batch. | +| num\_contexts | int | The number of context-phase sequences in the batch. | +| num\_generations | int | The number of generation-phase sequences in the batch. | +| max\_num\_tokens | int | The max number of tokens in all requests in a single batch. | +| num\_tokens | int | Number of tokens in the batch. | +| num\_ctx\_tokens | int | Number of tokens in sequences in the context phase. | +| kv\_cache\_manager | KVCacheManager | The KV cache manager. | +| is\_cuda\_graph | bool | Whether CUDA graph is enabled. | +| seq\_lens | Tensor | The length of each sequence in the batch. The shape is (batch\_size), and located on CPU memory. | +| seq\_lens\_cuda | Tensor | A copy of `seq_lens` store on the GPU. | +| context\_lens | Tensor | The length of each context-phase sequence in the batch. The shape is (`num_contexts`). | +| position\_ids | Optional[Tensor] | The position of each token in each sequence. May be None if positional embedding is applied outside of the backend. | +| request\_ids | List[int] | The request ID of each sequence in the batch. | +| prompt\_lens | List[int] | The prompt length of each sequence in the batch. | +| kv\_cache\_params | KVCacheParams | The parameters for the KV cache. | + +During `AttentionMetadata.__init__`, you can initialize additional fields for the new attention metadata. +For example, the Flashinfer metadata initializes `decode_wrapper` here. +During `AttentionMetadata.prepare`, the runtime will fill all predefined fields, and you can fill your customized fields according to these predefined fields. +For example, the Flashinfer metadata fills `qo_indptr` by combining `context_lens` and `num_generations` here. + +### Implement `AttentionBackend`[#](#implement-attentionbackend "Link to this heading") + +The `AttentionBackend` delegates the attention operation to the backend implementation. + +Its `__init__` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| layer\_idx | int | The index of the attention layer in the model. | +| num\_heads | int | The number of query heads. | +| head\_dim | int | The size of each attention head `(hidden_size // num_heads)`. | +| num\_kv\_heads | Optional[int] | The number of KV heads. Defaults to num\_heads if None. | +| quant\_config | QuantConfig | Optional quantization configuration. If None, no quantization is applied. | +| pos\_embd\_params | PositionalEmbeddingParams | Optional parameters defining how positional embedding should be applied. If None, positional embedding should be applied by the model before calling the backend. Otherwise, the backend is in-charge of applying positional embedding and may cache K without embedding it first. | + +Its `forward` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| q | Tensor | Query tensor with shape `(num_tokens, num_heads * head_dim)`. | +| k | Tensor | Key tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| v | Tensor | Value tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| metadata | AttentionMetadata | Metadata for the attention operation. | +| attention\_mask | AttentionMask | Optional attention mask. If None, causal mask is applied. | + +For example, the Flashinfer backend calls `append_paged_kv_cache` and then `wrapper.run` to perform the attention operation here. + +## The Features of the `TrtllmAttention` Backend[#](#the-features-of-the-trtllmattention-backend "Link to this heading") + +The following sections introduce some features of the default `TrtllmAttention` backend. + +### Packed Tensors[#](#packed-tensors "Link to this heading") + +In the `TrtllmAttention` backend, the attention operator supports the packed (i.e. non padded) QKV inputs. +A naive layout for the QKV inputs is padding the sequences +that are shorter than the `max_sequence_length` to the maximum +length. It may result in excessive memory consumption as well as unneeded +computations on padding tokens (in the various matrix multiplications that +surround the MHA block). +To overcome that problem, TensorRT LLM supports a mode without padding where +the different tokens are packed together and the user provides the operator +with a 1D tensor containing the lengths of the different sequences. + +### Context and Generation Phases[#](#context-and-generation-phases "Link to this heading") + +The `TrtllmAttention` backend encapsulates different implementations for both +context and generation phases into a single custom torch op. + +#### Context Phase[#](#context-phase "Link to this heading") + +A context-phase implementation without optimization maps to a sequence of GPU kernels that will store the +intermediate `Q*K^T` tensor in memory before calling the softmax operator. It +is the slowest method and the memory footprint is significant (grows quadratically in proportion to the sequence length). + +The `TrtllmAttention` backend will trigger a kernel that performs the MHA/MQA block +using a single kernel instead. For short sequences, that kernel uses a vanilla +implementation of MHA/MQA. For larger sequences, this kernel uses the Flash +Attention algorithm as described in +[FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness](https://arxiv.org/abs/2205.14135) +and +[FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning](https://arxiv.org/abs/2307.08691). + +Currently, the implementation triggers extra kernels that apply pre-processing +to the elements (like RoPE) and populate the KV cache (see below). In a future +release, the number of such kernels may be reduced to improve the overall performance. + +#### FP8 Context FMHA[#](#fp8-context-fmha "Link to this heading") + +When FP8 quantization is activated, the attention can be further accelerated by +enabling FP8 Context FMHA. + +FP8 Paged Context FMHA is also supported with the fp8 quantization workflow. +You need to specify `use_paged_context_fmha = True` for the attention operator. + +Please be aware that this feature is only supported on Ada, Hopper and above. + +#### Generation Phase[#](#generation-phase "Link to this heading") + +The generation phase is implemented using a single kernel called the masked +multi-head attention in TensorRT LLM. That kernel is able to apply +pre-processing on the Q, K, and V elements on-the-fly: it adds the QKV bias, applies +RoPE, and performs dequantization and quantization. TensorRT LLM will continue to add (or +enable) additional features in future releases, such as enabling support for IA3. + +The masked MHA kernel has a special version that distributes the work across +multiple CUDA thread-blocks on the GPU for cases where the GPU occupancy is +low. That mode called multi-block is always enabled. +NVIDIA recommends users to test that mode in scenarios where both the batch +size and the number of heads in the model are relatively small. +The definition of ‘small’ in that context is hard to quantify because it depends on the model of the GPU. +However, NVIDIA currently recommends testing that mode when `batch_size * num_heads` is less than the number of multi-processors on the GPU. +This guidance may be subject to change in the future. + +Note that even if the multi-block mode is enabled, the attention operator will +not immediately trigger the multi-block version of the GPU kernel. There is a +minimum number of tokens (input + generated) that are required for the +multi-block version to become more efficient than the “vanilla” implementation +that uses a single CUDA thread-block per head. It is controlled by an internal +heuristic. + +Another note is that as the masked MHA kernels use shared memory size +proportional to sequence length, so there can be some cases that GPU’s shared +memory is not enough when multi-block mode is not enabled. To get masked MHA kernel to work in those cases, multi-block mode is forced on and a warning message is printed in the log. + +#### XQA Optimization[#](#xqa-optimization "Link to this heading") + +XQA optimization is another optimization for MQA/GQA in the generation phase. +It currently only supports a limited number of model configurations, such as the LLAMA2 70B model. + +Support matrix of the XQA optimization: + +* FP16 / BF16 compute data type. +* FP16 / BF16 / FP8 / INT8 KV cache data type. +* Paged KV cache (8 / 16 / 32 / 64 / 128 tokens per block). + +By default, this is enabled. Note that a heuristic algorithm +is also used to decide whether to use XQA kernel or masked MHA kernel to get +better performance. +If you want to use that kernel whenever possible, set `TRTLLM_FORCE_XQA=1` to force use of the XQA kernel when the model config is supported. +Supported configurations can be found using the `shouldUse` function of the `DecoderXQARunner` class in +`cpp/tensorrt_llm/kernels/decoderMaskedMultiheadAttention/decoderXQARunner.h`. + +### In-flight Batching[#](#in-flight-batching "Link to this heading") + +TensorRT LLM supports in-flight batching of requests (also known as continuous +batching or iteration-level batching) for higher serving throughput. With this feature, +sequences in the context phase can be processed together with sequences in +the generation phase. The purpose of that technique is to better interleave +requests to reduce latency as well as make better use of the GPUs. +For efficiency reasons (1), the support for inflight batching ***requires the +input tensors to be packed (no padding)***. + +***In the current implementation, the sequences that are going through the +context phase must be before the sequences in the generation phase in the input +tensor. For example, for sequences `S0`, `S1` and `S2`, if `S0` and `S2` are in +context phase (and `S1` in generation), tokens from `S0` and `S2` must appear +before the tokens of `S1` in the input tensor***. + +*(1) Padding sequences in the generation phase, that contain a single token, to +the length of the maximum input sequence is inefficient use of resources*. + +### Chunked Context[#](#chunked-context "Link to this heading") + +In the original state, the common behavior was to process all context tokens at +once. This feature splits the context into several chunks. In this way, the +context chunks can be batched with more tokens during the generation phase, +which is expected to increase the total throughput. Chunking contexts also removes +constraints on input length. Except for the last one, the size of the context chunk needs +to be an integer multiple of the kv-cache block size. + +> To enable this feature, the FMHA paged kv-cache also needs to be enabled. + +### KV Cache[#](#kv-cache "Link to this heading") + +In the generation phase, a common optimization is to provide the MHA kernel +with a cache containing the values of the past K and V elements that have +already been computed. That cache is known as the KV cache. TensorRT LLM uses +that technique to accelerate its generation phase. In TensorRT LLM, there is +one KV cache per Transformer layer, which means that there are as many KV +caches as layers in a model. The current version of TensorRT LLM supports two +different types of KV caches: **contiguous** and **paged** KV caches. + +#### Contiguous KV Cache[#](#contiguous-kv-cache "Link to this heading") + +The contiguous KV cache is a monolithic tensor. Its shape is: + +```None +[max_batch_size * max_beam_width, 2, num_heads, max_seqlen, hidden_dim_per_head]. +``` + +That implementation uses a lot more memory than needed when the sequences are +shorter than the maximum sequence length (even if they end up close to the +limit after the generation of many output tokens, it may take a lot of steps to +reach that point). + +#### Paged KV Cache[#](#paged-kv-cache "Link to this heading") + +The paged KV cache decomposes the KV cache into blocks that are distributed to +the different requests by a cache manager during processing. That cache manager +keeps track of the sequences, allocates new blocks from a pool and recycles those +blocks when required. See the implementation of +[`KVCacheManager`](https://github.com/NVIDIA/TensorRT-LLM/tree/45d7022/tensorrt_llm/_torch/pyexecutor/resource_manager.py). + +#### INT8/FP8 KV Caches[#](#int8-fp8-kv-caches "Link to this heading") + +In its current implementation, even if the rest of the network runs in INT8 or +FP8, the attention operator works with FP32, FP16, and BFloat16 inputs and +outputs. However, TensorRT LLM supports INT8 and FP8 +(`QuantMode.INT8_KV_CACHE` and +`QuantMode.FP8_KV_CACHE`) KV caches. + +The attention operator populates the KV cache. When INT8 or FP8 KV caches +are enabled, the input values have to be quantized to 8 bits using a scaling +factor. For quantization, the scaling factor is stored in the +`kv_cache_scaling_factor` tensor. Its shape is `[1]` and only per-tensor +quantization is supported in the current version. Quantization uses inversed scale +since it does multiply as `fp_value * (1.0 / kv_cache_scaling_factor)` in plugin. + +During generation, the values read from the cache are dequantized on-the-fly in +the MHA/MQA kernel. Dequantization is defined as +`quantized_value * kv_cache_scaling_factor`. + +### Sliding Window Attention, Cyclic (Rolling Buffer) KV Cache[#](#sliding-window-attention-cyclic-rolling-buffer-kv-cache "Link to this heading") + +TensorRT LLM has a feature called `Cyclic KV Cache`, which treats the kv cache +as a circular buffer. This means that it only stores the kv cache for the last N +tokens, where N is determined by the `attention_window_size` parameter in +`TrtllmAttention.forward`. When the cache is full, new tokens’ kv cache will +overwrite the “least recently used” caches. + +In the context phase, if the input length surpasses the `attention_window_size`, +`Sliding Window Attention` will be activated. This serves the same function as +the sliding window size. + +This feature helps to reduce the memory footprint of the kv cache when +dealing with very long sequences. + +\_Note that the cyclic kv cache feature doesn’t work with beam searching currently as +the context kv cache are shared across beams. + +### StreamingLLM[#](#streamingllm "Link to this heading") + +The StreamingLLM feature uses a window attention to perform efficient and stable LLM +on long texts, which means that only `N` tokens need to be stored in the KV cache. +Similar to the cyclic KV cache feature in TensorRT LLM, `attention_window_size` +parameter is used to determine `N`. Different from the cyclic KV cache feature, +the first `S` tokens, called sink tokens, are always kept in the attention window, +where `S` is determined by `sink_token_length` parameter. +But in context phase, the self-attentions are dense in the official implementation of +StreamingLLM. It uses all of the tokens for computation and only saves `N` tokens +to the KV cache. + +In addition, the relative position embedding is also changed in StreamingLLM. +When determining the relative distance and adding positional information to tokens, +StreamingLLM use the positions within the cache rather than those in the original text. + +`sink_token_length` is also used to enable this feature. + +### Beam-Search[#](#beam-search "Link to this heading") + +The attention operator supports beam-search. In the context phase, a single +beam is computed per input sequence. In the generation phase, the MHA/MQA/GQA +kernel uses an additional tensor to reconstruct the correct path for each beam. +That tensor is called the `cache_indirection`. Its shape is `[batch_size, beam_width, max_seqlen]`. + +For a sequence `si`, a beam `bi` and a token `ti`, the element +`cache_indirection[si][bi][ti]` is an integer between `0` and `beam_width-1` +that indicates which path in the beam to read the K and V elements from in the +KV cache. This tensor is populated in the sampling stage. + +### Input QKV tensor[#](#input-qkv-tensor "Link to this heading") + +The input QKV tensor packs the Q, K and V tensors (concatenated along the last +dimension) after the projection of the hidden states. It is a 3D tensor. RoPE +and quantization to INT8 or FP8 (when needed) are performed by the GPT +attention operator. + +In packed mode, its shape is `[num_tokens, 3 * hidden_dim]` where +`num_tokens` is the total number of tokens in the batch. For the sequences in +context phase, the number of tokens of a sequence corresponds to its input +length (even if the beam width is greater than `1` for beam search). For the +sequences in generation phase, there are `beam_width` tokens per sequence. The +beam width can be different for each sequence. + +The following pseudo code explains how the number of tokens is computed: + +```None +num_tokens = 0 + +# Add the length of each sequence in context phase. +for seq in context_phase: + num_tokens += seq.length + +# Add the width of the beam for each sequence in generation phase. +for seq in generation_phase: + num_tokens += seq.beam_width +``` + +### Rotary Positional Embedding (RoPE)[#](#rotary-positional-embedding-rope "Link to this heading") + +The attention operator can perform the computation of the Rotary +Positional Embedding (RoPE). When that operation is enabled, +`rotary_embedding_dim` is set to a value greater than 0, it is fused with other +operations. The GPT operator supports GPT-NeoX and GPT-J forms of RoPE by +setting `position_embedding_type` to `PositionEmbeddingType.rope_gpt_neox` +or `PositionEmbeddingType.rope_gptj`. + +### ALiBi[#](#alibi "Link to this heading") + +The attention operator can apply ALiBi to the result of the `Q*K^T` +product. The bias is computed on-the-fly from the ALiBi slopes in the optimized +kernel. + +### Scaling factor(s)[#](#scaling-factor-s "Link to this heading") + +In MHA, the output of the `Q*K^T` product is scaled by a constant value that +is computed as: + +```None +norm_factor = 1.f / (q_scaling * sqrt(head_size)). +``` + +### Cross Attention[#](#cross-attention "Link to this heading") + +On top of the MHA as self attention needed by GPT-style decoder-only models, the attention operator also supports cross attention. + +This enables the attention operator to be more broadly used as a generic decoder component. For example, the Encoder-Decoder model uses it to issue both the self attention and cross attention modules in its Decoder. diff --git a/corpus/docs/nvidia_tensorrt-llm/attention/attention_130rc2.md b/corpus/docs/nvidia_tensorrt-llm/attention/attention_130rc2.md new file mode 100644 index 0000000000000000000000000000000000000000..e36e43513a6e846c19434956e3822e6fee06452a --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/attention/attention_130rc2.md @@ -0,0 +1,382 @@ +# Multi-Head, Multi-Query, and Group-Query Attention# + +Source: https://nvidia.github.io/TensorRT-LLM/1.3.0rc2/features/attention.html +Version: 1.3.0rc2 + +This document details the implementation of multi-head attention (MHA), +multi-query attention (MQA), and group-query attention (GQA) for autoregressive +models in TensorRT LLM’s PyTorch backend. + +Multi-head attention involves a sequence of batched matrix multiplications, a softmax operation, and another batched matrix multiplication, +as described in the [Attention Is All You Need](https://arxiv.org/abs/1706.03762) paper. +[Multi-query Attention (MQA)](https://arxiv.org/abs/1911.02150) and [Group-query Attention (GQA)](https://arxiv.org/abs/2307.09288) are +variants of MHA that use fewer KV heads than the number of query heads. +TensorRT LLM provides several implementations using different backends in `tensorrt_llm/_torch/attention_backend/`. +The following sections explain how to use these implementations and provide a brief guide on implementing new backends. + +## Attention Backends[#](#attention-backends "Link to this heading") + +There are currently three available attention backends: the vanilla backend, the TRT-LLM backend, and the Flashinfer backend. +You can specify the desired attention backend using `PyTorchConfig.attn_backend`. For instance, to utilize the Flashinfer backend, you can pass `attn_backend="flashinfer"` to the `LLM` constructor as follows: `LLM(attn_backend="flashinfer")`. This will enable the use of the Flashinfer backend for your model. + +The vanilla backend, `VanillaAttention`, is a reference implementation designed primarily for inflight batching and linear KV cache support. While it serves as a useful baseline, it is not recommended for production use due to its limited optimizations. + +In contrast, the Flashinfer backend, `FlashInferAttention`, is performance-optimized and supports both inflight batching and paged KV cache. It also includes the following advanced features: + +1. **FP8 Quantization**: This feature enables the quantization of inputs and KV cache into FP8 format, significantly reducing memory usage and improving computational throughput. +2. **RoPE Fusion**: By integrating rotary position embedding (RoPE) directly into the attention computation, this feature enhances efficiency and reduces overhead. + +The TRT-LLM backend, `TrtllmAttention`, serves as the default backend and supports all the features available in the Flashinfer backend while being further optimized for enhanced performance. It is the recommended choice for production environments. Additionally, it offers the following advanced features: + +1. **Fused QKV Input**: It can accept a single QKV tensor as input, which is more efficient compared to using separate Q, K, and V tensors. +2. **FP8 Output**: It supports outputting the attention result in FP8 format, fusing quantization into the attention computation process. + +## Implement a New Attention Backend[#](#implement-a-new-attention-backend "Link to this heading") + +You can implement a new attention backend to integrate other attention libraries. +An attention backend consists of an `AttentionBackend` class and an `AttentionMetadata` class. +There are three stages in the PyTorch that involve the attention backend: + +1. Model construction: During the model’s `__init__`, call `AttentionBackend.__init__` to create an attention backend for each layer. +2. Metadata preparation: Before each forward step of the model: + + 1. If the metadata is uninitialized, call `AttentionMetadata.__init__` to create the attention metadata. + 2. If using CUDA graphs, call `AttentionMetadata.create_cuda_graph_metadata` to convert the metadata to CUDA graph metadata, which pre-allocates all tensors and can be used to capture CUDA graphs. Do not re-allocate any tensors stored inside `AttentionMetadata` after the initial warmup run when using CUDA graphs. + 3. To prepare parameters of the input and KV cache, call `AttentionMetadata.prepare` to convert from existing metadata and KV cache manager. +3. Single step forward: During the forward pass of each attention layer, call `AttentionBackend.forward` to perform the attention operation. The `AttentionMetadata` will be provided as a forward argument. + +### Implement `AttentionMetadata`[#](#implement-attentionmetadata "Link to this heading") + +The `AttentionMetadata` class stores metadata from the batched input and KV cache for the attention backend. +It contains the following predefined fields: + +| Field | Type | Description | +| --- | --- | --- | +| max\_num\_requests | int | The max number of requests in a single batch. | +| num\_contexts | int | The number of context-phase sequences in the batch. | +| num\_generations | int | The number of generation-phase sequences in the batch. | +| max\_num\_tokens | int | The max number of tokens in all requests in a single batch. | +| num\_tokens | int | Number of tokens in the batch. | +| num\_ctx\_tokens | int | Number of tokens in sequences in the context phase. | +| kv\_cache\_manager | KVCacheManager | The KV cache manager. | +| is\_cuda\_graph | bool | Whether CUDA graph is enabled. | +| seq\_lens | Tensor | The length of each sequence in the batch. The shape is (batch\_size), and located on CPU memory. | +| seq\_lens\_cuda | Tensor | A copy of `seq_lens` store on the GPU. | +| context\_lens | Tensor | The length of each context-phase sequence in the batch. The shape is (`num_contexts`). | +| position\_ids | Optional[Tensor] | The position of each token in each sequence. May be None if positional embedding is applied outside of the backend. | +| request\_ids | List[int] | The request ID of each sequence in the batch. | +| prompt\_lens | List[int] | The prompt length of each sequence in the batch. | +| kv\_cache\_params | KVCacheParams | The parameters for the KV cache. | + +During `AttentionMetadata.__init__`, you can initialize additional fields for the new attention metadata. +For example, the Flashinfer metadata initializes `decode_wrapper` here. +During `AttentionMetadata.prepare`, the runtime will fill all predefined fields, and you can fill your customized fields according to these predefined fields. +For example, the Flashinfer metadata fills `qo_indptr` by combining `context_lens` and `num_generations` here. + +### Implement `AttentionBackend`[#](#implement-attentionbackend "Link to this heading") + +The `AttentionBackend` delegates the attention operation to the backend implementation. + +Its `__init__` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| layer\_idx | int | The index of the attention layer in the model. | +| num\_heads | int | The number of query heads. | +| head\_dim | int | The size of each attention head `(hidden_size // num_heads)`. | +| num\_kv\_heads | Optional[int] | The number of KV heads. Defaults to num\_heads if None. | +| quant\_config | QuantConfig | Optional quantization configuration. If None, no quantization is applied. | +| pos\_embd\_params | PositionalEmbeddingParams | Optional parameters defining how positional embedding should be applied. If None, positional embedding should be applied by the model before calling the backend. Otherwise, the backend is in-charge of applying positional embedding and may cache K without embedding it first. | + +Its `forward` accepts the following arguments: + +| Field | Type | Description | +| --- | --- | --- | +| q | Tensor | Query tensor with shape `(num_tokens, num_heads * head_dim)`. | +| k | Tensor | Key tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| v | Tensor | Value tensor with shape `(num_tokens, num_kv_heads * head_dim)`. | +| metadata | AttentionMetadata | Metadata for the attention operation. | +| attention\_mask | AttentionMask | Optional attention mask. If None, causal mask is applied. | + +For example, the Flashinfer backend calls `append_paged_kv_cache` and then `wrapper.run` to perform the attention operation here. + +## The Features of the `TrtllmAttention` Backend[#](#the-features-of-the-trtllmattention-backend "Link to this heading") + +The following sections introduce some features of the default `TrtllmAttention` backend. + +### Packed Tensors[#](#packed-tensors "Link to this heading") + +In the `TrtllmAttention` backend, the attention operator supports the packed (i.e. non padded) QKV inputs. +A naive layout for the QKV inputs is padding the sequences +that are shorter than the `max_sequence_length` to the maximum +length. It may result in excessive memory consumption as well as unneeded +computations on padding tokens (in the various matrix multiplications that +surround the MHA block). +To overcome that problem, TensorRT LLM supports a mode without padding where +the different tokens are packed together and the user provides the operator +with a 1D tensor containing the lengths of the different sequences. + +### Context and Generation Phases[#](#context-and-generation-phases "Link to this heading") + +The `TrtllmAttention` backend encapsulates different implementations for both +context and generation phases into a single custom torch op. + +#### Context Phase[#](#context-phase "Link to this heading") + +A context-phase implementation without optimization maps to a sequence of GPU kernels that will store the +intermediate `Q*K^T` tensor in memory before calling the softmax operator. It +is the slowest method and the memory footprint is significant (grows quadratically in proportion to the sequence length). + +The `TrtllmAttention` backend will trigger a kernel that performs the MHA/MQA block +using a single kernel instead. For short sequences, that kernel uses a vanilla +implementation of MHA/MQA. For larger sequences, this kernel uses the Flash +Attention algorithm as described in +[FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness](https://arxiv.org/abs/2205.14135) +and +[FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning](https://arxiv.org/abs/2307.08691). + +Currently, the implementation triggers extra kernels that apply pre-processing +to the elements (like RoPE) and populate the KV cache (see below). In a future +release, the number of such kernels may be reduced to improve the overall performance. + +#### FP8 Context FMHA[#](#fp8-context-fmha "Link to this heading") + +When FP8 quantization is activated, the attention can be further accelerated by +enabling FP8 Context FMHA. + +FP8 Paged Context FMHA is also supported with the fp8 quantization workflow. +You need to specify `use_paged_context_fmha = True` for the attention operator. + +Please be aware that this feature is only supported on Ada, Hopper and above. + +#### Generation Phase[#](#generation-phase "Link to this heading") + +The generation phase is implemented using a single kernel called the masked +multi-head attention in TensorRT LLM. That kernel is able to apply +pre-processing on the Q, K, and V elements on-the-fly: it adds the QKV bias, applies +RoPE, and performs dequantization and quantization. TensorRT LLM will continue to add (or +enable) additional features in future releases, such as enabling support for IA3. + +The masked MHA kernel has a special version that distributes the work across +multiple CUDA thread-blocks on the GPU for cases where the GPU occupancy is +low. That mode called multi-block is always enabled. +NVIDIA recommends users to test that mode in scenarios where both the batch +size and the number of heads in the model are relatively small. +The definition of ‘small’ in that context is hard to quantify because it depends on the model of the GPU. +However, NVIDIA currently recommends testing that mode when `batch_size * num_heads` is less than the number of multi-processors on the GPU. +This guidance may be subject to change in the future. + +Note that even if the multi-block mode is enabled, the attention operator will +not immediately trigger the multi-block version of the GPU kernel. There is a +minimum number of tokens (input + generated) that are required for the +multi-block version to become more efficient than the “vanilla” implementation +that uses a single CUDA thread-block per head. It is controlled by an internal +heuristic. + +Another note is that as the masked MHA kernels use shared memory size +proportional to sequence length, so there can be some cases that GPU’s shared +memory is not enough when multi-block mode is not enabled. To get masked MHA kernel to work in those cases, multi-block mode is forced on and a warning message is printed in the log. + +#### XQA Optimization[#](#xqa-optimization "Link to this heading") + +XQA optimization is another optimization for MQA/GQA in the generation phase. +It currently only supports a limited number of model configurations, such as the LLAMA2 70B model. + +Support matrix of the XQA optimization: + +* FP16 / BF16 compute data type. +* FP16 / BF16 / FP8 / INT8 KV cache data type. +* Paged KV cache (8 / 16 / 32 / 64 / 128 tokens per block). + +By default, this is enabled. Note that a heuristic algorithm +is also used to decide whether to use XQA kernel or masked MHA kernel to get +better performance. +If you want to use that kernel whenever possible, set `TRTLLM_FORCE_XQA=1` to force use of the XQA kernel when the model config is supported. +Supported configurations can be found using the `shouldUse` function of the `DecoderXQARunner` class in +`cpp/tensorrt_llm/kernels/decoderMaskedMultiheadAttention/decoderXQARunner.h`. + +### In-flight Batching[#](#in-flight-batching "Link to this heading") + +TensorRT LLM supports in-flight batching of requests (also known as continuous +batching or iteration-level batching) for higher serving throughput. With this feature, +sequences in the context phase can be processed together with sequences in +the generation phase. The purpose of that technique is to better interleave +requests to reduce latency as well as make better use of the GPUs. +For efficiency reasons (1), the support for inflight batching ***requires the +input tensors to be packed (no padding)***. + +***In the current implementation, the sequences that are going through the +context phase must be before the sequences in the generation phase in the input +tensor. For example, for sequences `S0`, `S1` and `S2`, if `S0` and `S2` are in +context phase (and `S1` in generation), tokens from `S0` and `S2` must appear +before the tokens of `S1` in the input tensor***. + +*(1) Padding sequences in the generation phase, that contain a single token, to +the length of the maximum input sequence is inefficient use of resources*. + +### Chunked Context[#](#chunked-context "Link to this heading") + +In the original state, the common behavior was to process all context tokens at +once. This feature splits the context into several chunks. In this way, the +context chunks can be batched with more tokens during the generation phase, +which is expected to increase the total throughput. Chunking contexts also removes +constraints on input length. Except for the last one, the size of the context chunk needs +to be an integer multiple of the kv-cache block size. + +> To enable this feature, the FMHA paged kv-cache also needs to be enabled. + +### KV Cache[#](#kv-cache "Link to this heading") + +In the generation phase, a common optimization is to provide the MHA kernel +with a cache containing the values of the past K and V elements that have +already been computed. That cache is known as the KV cache. TensorRT LLM uses +that technique to accelerate its generation phase. In TensorRT LLM, there is +one KV cache per Transformer layer, which means that there are as many KV +caches as layers in a model. The current version of TensorRT LLM supports two +different types of KV caches: **contiguous** and **paged** KV caches. + +#### Contiguous KV Cache[#](#contiguous-kv-cache "Link to this heading") + +The contiguous KV cache is a monolithic tensor. Its shape is: + +```None +[max_batch_size * max_beam_width, 2, num_heads, max_seqlen, hidden_dim_per_head]. +``` + +That implementation uses a lot more memory than needed when the sequences are +shorter than the maximum sequence length (even if they end up close to the +limit after the generation of many output tokens, it may take a lot of steps to +reach that point). + +#### Paged KV Cache[#](#paged-kv-cache "Link to this heading") + +The paged KV cache decomposes the KV cache into blocks that are distributed to +the different requests by a cache manager during processing. That cache manager +keeps track of the sequences, allocates new blocks from a pool and recycles those +blocks when required. See the implementation of +[`KVCacheManager`](https://github.com/NVIDIA/TensorRT-LLM/tree/f42a6cb/tensorrt_llm/_torch/pyexecutor/resource_manager.py). + +#### INT8/FP8 KV Caches[#](#int8-fp8-kv-caches "Link to this heading") + +In its current implementation, even if the rest of the network runs in INT8 or +FP8, the attention operator works with FP32, FP16, and BFloat16 inputs and +outputs. However, TensorRT LLM supports INT8 and FP8 +(`QuantMode.INT8_KV_CACHE` and +`QuantMode.FP8_KV_CACHE`) KV caches. + +The attention operator populates the KV cache. When INT8 or FP8 KV caches +are enabled, the input values have to be quantized to 8 bits using a scaling +factor. For quantization, the scaling factor is stored in the +`kv_cache_scaling_factor` tensor. Its shape is `[1]` and only per-tensor +quantization is supported in the current version. Quantization uses inversed scale +since it does multiply as `fp_value * (1.0 / kv_cache_scaling_factor)` in plugin. + +During generation, the values read from the cache are dequantized on-the-fly in +the MHA/MQA kernel. Dequantization is defined as +`quantized_value * kv_cache_scaling_factor`. + +### Sliding Window Attention, Cyclic (Rolling Buffer) KV Cache[#](#sliding-window-attention-cyclic-rolling-buffer-kv-cache "Link to this heading") + +TensorRT LLM has a feature called `Cyclic KV Cache`, which treats the kv cache +as a circular buffer. This means that it only stores the kv cache for the last N +tokens, where N is determined by the `attention_window_size` parameter in +`TrtllmAttention.forward`. When the cache is full, new tokens’ kv cache will +overwrite the “least recently used” caches. + +In the context phase, if the input length surpasses the `attention_window_size`, +`Sliding Window Attention` will be activated. This serves the same function as +the sliding window size. + +This feature helps to reduce the memory footprint of the kv cache when +dealing with very long sequences. + +\_Note that the cyclic kv cache feature doesn’t work with beam searching currently as +the context kv cache are shared across beams. + +### StreamingLLM[#](#streamingllm "Link to this heading") + +The StreamingLLM feature uses a window attention to perform efficient and stable LLM +on long texts, which means that only `N` tokens need to be stored in the KV cache. +Similar to the cyclic KV cache feature in TensorRT LLM, `attention_window_size` +parameter is used to determine `N`. Different from the cyclic KV cache feature, +the first `S` tokens, called sink tokens, are always kept in the attention window, +where `S` is determined by `sink_token_length` parameter. +But in context phase, the self-attentions are dense in the official implementation of +StreamingLLM. It uses all of the tokens for computation and only saves `N` tokens +to the KV cache. + +In addition, the relative position embedding is also changed in StreamingLLM. +When determining the relative distance and adding positional information to tokens, +StreamingLLM use the positions within the cache rather than those in the original text. + +`sink_token_length` is also used to enable this feature. + +### Beam-Search[#](#beam-search "Link to this heading") + +The attention operator supports beam-search. In the context phase, a single +beam is computed per input sequence. In the generation phase, the MHA/MQA/GQA +kernel uses an additional tensor to reconstruct the correct path for each beam. +That tensor is called the `cache_indirection`. Its shape is `[batch_size, beam_width, max_seqlen]`. + +For a sequence `si`, a beam `bi` and a token `ti`, the element +`cache_indirection[si][bi][ti]` is an integer between `0` and `beam_width-1` +that indicates which path in the beam to read the K and V elements from in the +KV cache. This tensor is populated in the sampling stage. + +### Input QKV tensor[#](#input-qkv-tensor "Link to this heading") + +The input QKV tensor packs the Q, K and V tensors (concatenated along the last +dimension) after the projection of the hidden states. It is a 3D tensor. RoPE +and quantization to INT8 or FP8 (when needed) are performed by the GPT +attention operator. + +In packed mode, its shape is `[num_tokens, 3 * hidden_dim]` where +`num_tokens` is the total number of tokens in the batch. For the sequences in +context phase, the number of tokens of a sequence corresponds to its input +length (even if the beam width is greater than `1` for beam search). For the +sequences in generation phase, there are `beam_width` tokens per sequence. The +beam width can be different for each sequence. + +The following pseudo code explains how the number of tokens is computed: + +```None +num_tokens = 0 + +# Add the length of each sequence in context phase. +for seq in context_phase: + num_tokens += seq.length + +# Add the width of the beam for each sequence in generation phase. +for seq in generation_phase: + num_tokens += seq.beam_width +``` + +### Rotary Positional Embedding (RoPE)[#](#rotary-positional-embedding-rope "Link to this heading") + +The attention operator can perform the computation of the Rotary +Positional Embedding (RoPE). When that operation is enabled, +`rotary_embedding_dim` is set to a value greater than 0, it is fused with other +operations. The GPT operator supports GPT-NeoX and GPT-J forms of RoPE by +setting `position_embedding_type` to `PositionEmbeddingType.rope_gpt_neox` +or `PositionEmbeddingType.rope_gptj`. + +### ALiBi[#](#alibi "Link to this heading") + +The attention operator can apply ALiBi to the result of the `Q*K^T` +product. The bias is computed on-the-fly from the ALiBi slopes in the optimized +kernel. + +### Scaling factor(s)[#](#scaling-factor-s "Link to this heading") + +In MHA, the output of the `Q*K^T` product is scaled by a constant value that +is computed as: + +```None +norm_factor = 1.f / (q_scaling * sqrt(head_size)). +``` + +### Cross Attention[#](#cross-attention "Link to this heading") + +On top of the MHA as self attention needed by GPT-style decoder-only models, the attention operator also supports cross attention. + +This enables the attention operator to be more broadly used as a generic decoder component. For example, the Encoder-Decoder model uses it to issue both the self attention and cross attention modules in its Decoder. diff --git a/corpus/docs/nvidia_tensorrt-llm/lora/lora_100.md b/corpus/docs/nvidia_tensorrt-llm/lora/lora_100.md new file mode 100644 index 0000000000000000000000000000000000000000..aeaaf87b2e9a195f05b1259612bb9e71258993d0 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/lora/lora_100.md @@ -0,0 +1,233 @@ +# LoRA (Low-Rank Adaptation)# + +Source: https://nvidia.github.io/TensorRT-LLM/1.0.0/features/lora.html +Version: 1.0.0 + +LoRA (Low-Rank Adaptation) is a parameter-efficient fine-tuning technique that enables adapting large language models to specific tasks without modifying the original model weights. Instead of fine-tuning all parameters, LoRA introduces small trainable rank decomposition matrices that are added to existing weights during inference. + +## Table of Contents[#](#table-of-contents "Link to this heading") + +1. [Background](#background) +2. [Basic Usage](#basic-usage) + + * [Single LoRA Adapter](#single-lora-adapter) + * [Multi-LoRA Support](#multi-lora-support) +3. [Advanced Usage](#advanced-usage) + + * [LoRA with Quantization](#lora-with-quantization) + * [NeMo LoRA Format](#nemo-lora-format) + * [Cache Management](#cache-management) +4. [TRTLLM serve with LoRA](#trtllm-serve-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Starting the Server](#starting-the-server) + * [Client Usage](#client-usage) +5. [TRTLLM bench with LORA](#trtllm-bench-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Run trtllm-bench](#run-trtllm-bench) + +## Background[#](#background "Link to this heading") + +The PyTorch backend provides LoRA support, allowing you to: + +* Load and apply multiple LoRA adapters simultaneously +* Switch between different adapters for different requests +* Use LoRA with quantized models +* Support both HuggingFace and NeMo LoRA formats + +## Basic Usage[#](#basic-usage "Link to this heading") + +### Single LoRA Adapter[#](#single-lora-adapter "Link to this heading") + +```None +from tensorrt_llm import LLM +from tensorrt_llm.lora_manager import LoraConfig +from tensorrt_llm.executor.request import LoRARequest +from tensorrt_llm.sampling_params import SamplingParams + +# Configure LoRA +lora_config = LoraConfig( + lora_dir=["/path/to/lora/adapter"], + max_lora_rank=8, + max_loras=1, + max_cpu_loras=1 +) + +# Initialize LLM with LoRA support +llm = LLM( + model="/path/to/base/model", + lora_config=lora_config +) + +# Create LoRA request +lora_request = LoRARequest("my-lora-task", 0, "/path/to/lora/adapter") + +# Generate with LoRA +prompts = ["Hello, how are you?"] +sampling_params = SamplingParams(max_tokens=50) + +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_request] +) +``` + +### Multi-LoRA Support[#](#multi-lora-support "Link to this heading") + +```None +# Configure for multiple LoRA adapters +lora_config = LoraConfig( + lora_target_modules=['attn_q', 'attn_k', 'attn_v'], + max_lora_rank=8, + max_loras=4, + max_cpu_loras=8 +) + +llm = LLM(model="/path/to/base/model", lora_config=lora_config) + +# Create multiple LoRA requests +lora_req1 = LoRARequest("task-1", 0, "/path/to/adapter1") +lora_req2 = LoRARequest("task-2", 1, "/path/to/adapter2") + +prompts = [ + "Translate to French: Hello world", + "Summarize: This is a long document..." +] + +# Apply different LoRAs to different prompts +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_req1, lora_req2] +) +``` + +## Advanced Usage[#](#advanced-usage "Link to this heading") + +### LoRA with Quantization[#](#lora-with-quantization "Link to this heading") + +```None +from tensorrt_llm.models.modeling_utils import QuantConfig +from tensorrt_llm.quantization.mode import QuantAlgo + +# Configure quantization +quant_config = QuantConfig( + quant_algo=QuantAlgo.FP8, + kv_cache_quant_algo=QuantAlgo.FP8 +) + +# LoRA works with quantized models +llm = LLM( + model="/path/to/model", + quant_config=quant_config, + lora_config=lora_config +) +``` + +### NeMo LoRA Format[#](#nemo-lora-format "Link to this heading") + +```None +# For NeMo-format LoRA checkpoints +lora_config = LoraConfig( + lora_dir=["/path/to/nemo/lora"], + lora_ckpt_source="nemo", + max_lora_rank=8 +) + +lora_request = LoRARequest( + "nemo-task", + 0, + "/path/to/nemo/lora", + lora_ckpt_source="nemo" +) +``` + +### Cache Management[#](#cache-management "Link to this heading") + +```None +from tensorrt_llm.llmapi.llm_args import PeftCacheConfig + +# Fine-tune cache sizes +peft_cache_config = PeftCacheConfig( + host_cache_size=1024*1024*1024, # 1GB CPU cache + device_cache_percent=0.1 # 10% of free GPU memory +) + +llm = LLM( + model="/path/to/model", + lora_config=lora_config, + peft_cache_config=peft_cache_config +) +``` + +## TRTLLM serve with LoRA[#](#trtllm-serve-with-lora "Link to this heading") + +### YAML Configuration[#](#yaml-configuration "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_target_modules: ['attn_q', 'attn_k', 'attn_v'] + max_lora_rank: 8 +``` + +### Starting the Server[#](#starting-the-server "Link to this heading") + +```None +python -m tensorrt_llm.commands.serve + /path/to/model \ + --extra_llm_api_options extra_llm_api_options.yaml +``` + +### Client Usage[#](#client-usage "Link to this heading") + +```None +import openai + +client = openai.OpenAI(base_url="http://localhost:8000/v1", api_key="dummy") + +response = client.completions.create( + model="/path/to/model", + prompt="What is the capital city of France?", + max_tokens=20, + extra_body={ + "lora_request": { + "lora_name": "lora-example-0", + "lora_int_id": 0, + "lora_path": "/path/to/lora_adapter" + } + }, +) +``` + +## TRTLLM bench with LORA[#](#trtllm-bench-with-lora "Link to this heading") + +### YAML Configuration[#](#id1 "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_dir: + - /workspaces/tensorrt_llm/loras/0 + max_lora_rank: 64 + max_loras: 8 + max_cpu_loras: 8 + lora_target_modules: + - attn_q + - attn_k + - attn_v + trtllm_modules_to_hf_modules: + attn_q: q_proj + attn_k: k_proj + attn_v: v_proj +``` + +### Run trtllm-bench[#](#run-trtllm-bench "Link to this heading") + +```None +trtllm-bench --model $model_path throughput --dataset $dataset_path --extra_llm_api_options extra_llm_api_options.yaml --num_requests 64 --concurrency 16 +``` diff --git a/corpus/docs/nvidia_tensorrt-llm/lora/lora_110.md b/corpus/docs/nvidia_tensorrt-llm/lora/lora_110.md new file mode 100644 index 0000000000000000000000000000000000000000..18bb7129610311abaedef4b73db77ec09b7353bb --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/lora/lora_110.md @@ -0,0 +1,233 @@ +# LoRA (Low-Rank Adaptation)# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0/features/lora.html +Version: 1.1.0 + +LoRA (Low-Rank Adaptation) is a parameter-efficient fine-tuning technique that enables adapting large language models to specific tasks without modifying the original model weights. Instead of fine-tuning all parameters, LoRA introduces small trainable rank decomposition matrices that are added to existing weights during inference. + +## Table of Contents[#](#table-of-contents "Link to this heading") + +1. [Background](#background) +2. [Basic Usage](#basic-usage) + + * [Single LoRA Adapter](#single-lora-adapter) + * [Multi-LoRA Support](#multi-lora-support) +3. [Advanced Usage](#advanced-usage) + + * [LoRA with Quantization](#lora-with-quantization) + * [NeMo LoRA Format](#nemo-lora-format) + * [Cache Management](#cache-management) +4. [TRTLLM serve with LoRA](#trtllm-serve-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Starting the Server](#starting-the-server) + * [Client Usage](#client-usage) +5. [TRTLLM bench with LORA](#trtllm-bench-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Run trtllm-bench](#run-trtllm-bench) + +## Background[#](#background "Link to this heading") + +The PyTorch backend provides LoRA support, allowing you to: + +* Load and apply multiple LoRA adapters simultaneously +* Switch between different adapters for different requests +* Use LoRA with quantized models +* Support both HuggingFace and NeMo LoRA formats + +## Basic Usage[#](#basic-usage "Link to this heading") + +### Single LoRA Adapter[#](#single-lora-adapter "Link to this heading") + +```None +from tensorrt_llm import LLM +from tensorrt_llm.lora_manager import LoraConfig +from tensorrt_llm.executor.request import LoRARequest +from tensorrt_llm.sampling_params import SamplingParams + +# Configure LoRA +lora_config = LoraConfig( + lora_dir=["/path/to/lora/adapter"], + max_lora_rank=8, + max_loras=1, + max_cpu_loras=1 +) + +# Initialize LLM with LoRA support +llm = LLM( + model="/path/to/base/model", + lora_config=lora_config +) + +# Create LoRA request +lora_request = LoRARequest("my-lora-task", 0, "/path/to/lora/adapter") + +# Generate with LoRA +prompts = ["Hello, how are you?"] +sampling_params = SamplingParams(max_tokens=50) + +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_request] +) +``` + +### Multi-LoRA Support[#](#multi-lora-support "Link to this heading") + +```None +# Configure for multiple LoRA adapters +lora_config = LoraConfig( + lora_target_modules=['attn_q', 'attn_k', 'attn_v'], + max_lora_rank=8, + max_loras=4, + max_cpu_loras=8 +) + +llm = LLM(model="/path/to/base/model", lora_config=lora_config) + +# Create multiple LoRA requests +lora_req1 = LoRARequest("task-1", 0, "/path/to/adapter1") +lora_req2 = LoRARequest("task-2", 1, "/path/to/adapter2") + +prompts = [ + "Translate to French: Hello world", + "Summarize: This is a long document..." +] + +# Apply different LoRAs to different prompts +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_req1, lora_req2] +) +``` + +## Advanced Usage[#](#advanced-usage "Link to this heading") + +### LoRA with Quantization[#](#lora-with-quantization "Link to this heading") + +```None +from tensorrt_llm.models.modeling_utils import QuantConfig +from tensorrt_llm.quantization.mode import QuantAlgo + +# Configure quantization +quant_config = QuantConfig( + quant_algo=QuantAlgo.FP8, + kv_cache_quant_algo=QuantAlgo.FP8 +) + +# LoRA works with quantized models +llm = LLM( + model="/path/to/model", + quant_config=quant_config, + lora_config=lora_config +) +``` + +### NeMo LoRA Format[#](#nemo-lora-format "Link to this heading") + +```None +# For NeMo-format LoRA checkpoints +lora_config = LoraConfig( + lora_dir=["/path/to/nemo/lora"], + lora_ckpt_source="nemo", + max_lora_rank=8 +) + +lora_request = LoRARequest( + "nemo-task", + 0, + "/path/to/nemo/lora", + lora_ckpt_source="nemo" +) +``` + +### Cache Management[#](#cache-management "Link to this heading") + +```None +from tensorrt_llm.llmapi.llm_args import PeftCacheConfig + +# Fine-tune cache sizes +peft_cache_config = PeftCacheConfig( + host_cache_size=1024*1024*1024, # 1GB CPU cache + device_cache_percent=0.1 # 10% of free GPU memory +) + +llm = LLM( + model="/path/to/model", + lora_config=lora_config, + peft_cache_config=peft_cache_config +) +``` + +## TRTLLM serve with LoRA[#](#trtllm-serve-with-lora "Link to this heading") + +### YAML Configuration[#](#yaml-configuration "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_target_modules: ['attn_q', 'attn_k', 'attn_v'] + max_lora_rank: 8 +``` + +### Starting the Server[#](#starting-the-server "Link to this heading") + +```None +python -m tensorrt_llm.commands.serve + /path/to/model \ + --extra_llm_api_options extra_llm_api_options.yaml +``` + +### Client Usage[#](#client-usage "Link to this heading") + +```None +import openai + +client = openai.OpenAI(base_url="http://localhost:8000/v1", api_key="dummy") + +response = client.completions.create( + model="/path/to/model", + prompt="What is the capital city of France?", + max_tokens=20, + extra_body={ + "lora_request": { + "lora_name": "lora-example-0", + "lora_int_id": 0, + "lora_path": "/path/to/lora_adapter" + } + }, +) +``` + +## TRTLLM bench with LORA[#](#trtllm-bench-with-lora "Link to this heading") + +### YAML Configuration[#](#id1 "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_dir: + - /workspaces/tensorrt_llm/loras/0 + max_lora_rank: 64 + max_loras: 8 + max_cpu_loras: 8 + lora_target_modules: + - attn_q + - attn_k + - attn_v + trtllm_modules_to_hf_modules: + attn_q: q_proj + attn_k: k_proj + attn_v: v_proj +``` + +### Run trtllm-bench[#](#run-trtllm-bench "Link to this heading") + +```None +trtllm-bench --model $model_path throughput --dataset $dataset_path --extra_llm_api_options extra_llm_api_options.yaml --num_requests 64 --concurrency 16 +``` diff --git a/corpus/docs/nvidia_tensorrt-llm/lora/lora_110rc4.md b/corpus/docs/nvidia_tensorrt-llm/lora/lora_110rc4.md new file mode 100644 index 0000000000000000000000000000000000000000..cf8b13901a1cd80524fb2ef3e15bd9608a58018c --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/lora/lora_110rc4.md @@ -0,0 +1,233 @@ +# LoRA (Low-Rank Adaptation)# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0rc4/features/lora.html +Version: 1.1.0rc4 + +LoRA (Low-Rank Adaptation) is a parameter-efficient fine-tuning technique that enables adapting large language models to specific tasks without modifying the original model weights. Instead of fine-tuning all parameters, LoRA introduces small trainable rank decomposition matrices that are added to existing weights during inference. + +## Table of Contents[#](#table-of-contents "Link to this heading") + +1. [Background](#background) +2. [Basic Usage](#basic-usage) + + * [Single LoRA Adapter](#single-lora-adapter) + * [Multi-LoRA Support](#multi-lora-support) +3. [Advanced Usage](#advanced-usage) + + * [LoRA with Quantization](#lora-with-quantization) + * [NeMo LoRA Format](#nemo-lora-format) + * [Cache Management](#cache-management) +4. [TRTLLM serve with LoRA](#trtllm-serve-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Starting the Server](#starting-the-server) + * [Client Usage](#client-usage) +5. [TRTLLM bench with LORA](#trtllm-bench-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Run trtllm-bench](#run-trtllm-bench) + +## Background[#](#background "Link to this heading") + +The PyTorch backend provides LoRA support, allowing you to: + +* Load and apply multiple LoRA adapters simultaneously +* Switch between different adapters for different requests +* Use LoRA with quantized models +* Support both HuggingFace and NeMo LoRA formats + +## Basic Usage[#](#basic-usage "Link to this heading") + +### Single LoRA Adapter[#](#single-lora-adapter "Link to this heading") + +```None +from tensorrt_llm import LLM +from tensorrt_llm.lora_manager import LoraConfig +from tensorrt_llm.executor.request import LoRARequest +from tensorrt_llm.sampling_params import SamplingParams + +# Configure LoRA +lora_config = LoraConfig( + lora_dir=["/path/to/lora/adapter"], + max_lora_rank=8, + max_loras=1, + max_cpu_loras=1 +) + +# Initialize LLM with LoRA support +llm = LLM( + model="/path/to/base/model", + lora_config=lora_config +) + +# Create LoRA request +lora_request = LoRARequest("my-lora-task", 0, "/path/to/lora/adapter") + +# Generate with LoRA +prompts = ["Hello, how are you?"] +sampling_params = SamplingParams(max_tokens=50) + +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_request] +) +``` + +### Multi-LoRA Support[#](#multi-lora-support "Link to this heading") + +```None +# Configure for multiple LoRA adapters +lora_config = LoraConfig( + lora_target_modules=['attn_q', 'attn_k', 'attn_v'], + max_lora_rank=8, + max_loras=4, + max_cpu_loras=8 +) + +llm = LLM(model="/path/to/base/model", lora_config=lora_config) + +# Create multiple LoRA requests +lora_req1 = LoRARequest("task-1", 0, "/path/to/adapter1") +lora_req2 = LoRARequest("task-2", 1, "/path/to/adapter2") + +prompts = [ + "Translate to French: Hello world", + "Summarize: This is a long document..." +] + +# Apply different LoRAs to different prompts +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_req1, lora_req2] +) +``` + +## Advanced Usage[#](#advanced-usage "Link to this heading") + +### LoRA with Quantization[#](#lora-with-quantization "Link to this heading") + +```None +from tensorrt_llm.models.modeling_utils import QuantConfig +from tensorrt_llm.quantization.mode import QuantAlgo + +# Configure quantization +quant_config = QuantConfig( + quant_algo=QuantAlgo.FP8, + kv_cache_quant_algo=QuantAlgo.FP8 +) + +# LoRA works with quantized models +llm = LLM( + model="/path/to/model", + quant_config=quant_config, + lora_config=lora_config +) +``` + +### NeMo LoRA Format[#](#nemo-lora-format "Link to this heading") + +```None +# For NeMo-format LoRA checkpoints +lora_config = LoraConfig( + lora_dir=["/path/to/nemo/lora"], + lora_ckpt_source="nemo", + max_lora_rank=8 +) + +lora_request = LoRARequest( + "nemo-task", + 0, + "/path/to/nemo/lora", + lora_ckpt_source="nemo" +) +``` + +### Cache Management[#](#cache-management "Link to this heading") + +```None +from tensorrt_llm.llmapi.llm_args import PeftCacheConfig + +# Fine-tune cache sizes +peft_cache_config = PeftCacheConfig( + host_cache_size=1024*1024*1024, # 1GB CPU cache + device_cache_percent=0.1 # 10% of free GPU memory +) + +llm = LLM( + model="/path/to/model", + lora_config=lora_config, + peft_cache_config=peft_cache_config +) +``` + +## TRTLLM serve with LoRA[#](#trtllm-serve-with-lora "Link to this heading") + +### YAML Configuration[#](#yaml-configuration "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_target_modules: ['attn_q', 'attn_k', 'attn_v'] + max_lora_rank: 8 +``` + +### Starting the Server[#](#starting-the-server "Link to this heading") + +```None +python -m tensorrt_llm.commands.serve + /path/to/model \ + --extra_llm_api_options extra_llm_api_options.yaml +``` + +### Client Usage[#](#client-usage "Link to this heading") + +```None +import openai + +client = openai.OpenAI(base_url="http://localhost:8000/v1", api_key="dummy") + +response = client.completions.create( + model="/path/to/model", + prompt="What is the capital city of France?", + max_tokens=20, + extra_body={ + "lora_request": { + "lora_name": "lora-example-0", + "lora_int_id": 0, + "lora_path": "/path/to/lora_adapter" + } + }, +) +``` + +## TRTLLM bench with LORA[#](#trtllm-bench-with-lora "Link to this heading") + +### YAML Configuration[#](#id1 "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_dir: + - /workspaces/tensorrt_llm/loras/0 + max_lora_rank: 64 + max_loras: 8 + max_cpu_loras: 8 + lora_target_modules: + - attn_q + - attn_k + - attn_v + trtllm_modules_to_hf_modules: + attn_q: q_proj + attn_k: k_proj + attn_v: v_proj +``` + +### Run trtllm-bench[#](#run-trtllm-bench "Link to this heading") + +```None +trtllm-bench --model $model_path throughput --dataset $dataset_path --extra_llm_api_options extra_llm_api_options.yaml --num_requests 64 --concurrency 16 +``` diff --git a/corpus/docs/nvidia_tensorrt-llm/lora/lora_110rc5.md b/corpus/docs/nvidia_tensorrt-llm/lora/lora_110rc5.md new file mode 100644 index 0000000000000000000000000000000000000000..418dd73adb94897ecbb580856af2045080a8f8ac --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/lora/lora_110rc5.md @@ -0,0 +1,233 @@ +# LoRA (Low-Rank Adaptation)# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0rc5/features/lora.html +Version: 1.1.0rc5 + +LoRA (Low-Rank Adaptation) is a parameter-efficient fine-tuning technique that enables adapting large language models to specific tasks without modifying the original model weights. Instead of fine-tuning all parameters, LoRA introduces small trainable rank decomposition matrices that are added to existing weights during inference. + +## Table of Contents[#](#table-of-contents "Link to this heading") + +1. [Background](#background) +2. [Basic Usage](#basic-usage) + + * [Single LoRA Adapter](#single-lora-adapter) + * [Multi-LoRA Support](#multi-lora-support) +3. [Advanced Usage](#advanced-usage) + + * [LoRA with Quantization](#lora-with-quantization) + * [NeMo LoRA Format](#nemo-lora-format) + * [Cache Management](#cache-management) +4. [TRTLLM serve with LoRA](#trtllm-serve-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Starting the Server](#starting-the-server) + * [Client Usage](#client-usage) +5. [TRTLLM bench with LORA](#trtllm-bench-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Run trtllm-bench](#run-trtllm-bench) + +## Background[#](#background "Link to this heading") + +The PyTorch backend provides LoRA support, allowing you to: + +* Load and apply multiple LoRA adapters simultaneously +* Switch between different adapters for different requests +* Use LoRA with quantized models +* Support both HuggingFace and NeMo LoRA formats + +## Basic Usage[#](#basic-usage "Link to this heading") + +### Single LoRA Adapter[#](#single-lora-adapter "Link to this heading") + +```None +from tensorrt_llm import LLM +from tensorrt_llm.lora_manager import LoraConfig +from tensorrt_llm.executor.request import LoRARequest +from tensorrt_llm.sampling_params import SamplingParams + +# Configure LoRA +lora_config = LoraConfig( + lora_dir=["/path/to/lora/adapter"], + max_lora_rank=8, + max_loras=1, + max_cpu_loras=1 +) + +# Initialize LLM with LoRA support +llm = LLM( + model="/path/to/base/model", + lora_config=lora_config +) + +# Create LoRA request +lora_request = LoRARequest("my-lora-task", 0, "/path/to/lora/adapter") + +# Generate with LoRA +prompts = ["Hello, how are you?"] +sampling_params = SamplingParams(max_tokens=50) + +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_request] +) +``` + +### Multi-LoRA Support[#](#multi-lora-support "Link to this heading") + +```None +# Configure for multiple LoRA adapters +lora_config = LoraConfig( + lora_target_modules=['attn_q', 'attn_k', 'attn_v'], + max_lora_rank=8, + max_loras=4, + max_cpu_loras=8 +) + +llm = LLM(model="/path/to/base/model", lora_config=lora_config) + +# Create multiple LoRA requests +lora_req1 = LoRARequest("task-1", 0, "/path/to/adapter1") +lora_req2 = LoRARequest("task-2", 1, "/path/to/adapter2") + +prompts = [ + "Translate to French: Hello world", + "Summarize: This is a long document..." +] + +# Apply different LoRAs to different prompts +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_req1, lora_req2] +) +``` + +## Advanced Usage[#](#advanced-usage "Link to this heading") + +### LoRA with Quantization[#](#lora-with-quantization "Link to this heading") + +```None +from tensorrt_llm.models.modeling_utils import QuantConfig +from tensorrt_llm.quantization.mode import QuantAlgo + +# Configure quantization +quant_config = QuantConfig( + quant_algo=QuantAlgo.FP8, + kv_cache_quant_algo=QuantAlgo.FP8 +) + +# LoRA works with quantized models +llm = LLM( + model="/path/to/model", + quant_config=quant_config, + lora_config=lora_config +) +``` + +### NeMo LoRA Format[#](#nemo-lora-format "Link to this heading") + +```None +# For NeMo-format LoRA checkpoints +lora_config = LoraConfig( + lora_dir=["/path/to/nemo/lora"], + lora_ckpt_source="nemo", + max_lora_rank=8 +) + +lora_request = LoRARequest( + "nemo-task", + 0, + "/path/to/nemo/lora", + lora_ckpt_source="nemo" +) +``` + +### Cache Management[#](#cache-management "Link to this heading") + +```None +from tensorrt_llm.llmapi.llm_args import PeftCacheConfig + +# Fine-tune cache sizes +peft_cache_config = PeftCacheConfig( + host_cache_size=1024*1024*1024, # 1GB CPU cache + device_cache_percent=0.1 # 10% of free GPU memory +) + +llm = LLM( + model="/path/to/model", + lora_config=lora_config, + peft_cache_config=peft_cache_config +) +``` + +## TRTLLM serve with LoRA[#](#trtllm-serve-with-lora "Link to this heading") + +### YAML Configuration[#](#yaml-configuration "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_target_modules: ['attn_q', 'attn_k', 'attn_v'] + max_lora_rank: 8 +``` + +### Starting the Server[#](#starting-the-server "Link to this heading") + +```None +python -m tensorrt_llm.commands.serve + /path/to/model \ + --extra_llm_api_options extra_llm_api_options.yaml +``` + +### Client Usage[#](#client-usage "Link to this heading") + +```None +import openai + +client = openai.OpenAI(base_url="http://localhost:8000/v1", api_key="dummy") + +response = client.completions.create( + model="/path/to/model", + prompt="What is the capital city of France?", + max_tokens=20, + extra_body={ + "lora_request": { + "lora_name": "lora-example-0", + "lora_int_id": 0, + "lora_path": "/path/to/lora_adapter" + } + }, +) +``` + +## TRTLLM bench with LORA[#](#trtllm-bench-with-lora "Link to this heading") + +### YAML Configuration[#](#id1 "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_dir: + - /workspaces/tensorrt_llm/loras/0 + max_lora_rank: 64 + max_loras: 8 + max_cpu_loras: 8 + lora_target_modules: + - attn_q + - attn_k + - attn_v + trtllm_modules_to_hf_modules: + attn_q: q_proj + attn_k: k_proj + attn_v: v_proj +``` + +### Run trtllm-bench[#](#run-trtllm-bench "Link to this heading") + +```None +trtllm-bench --model $model_path throughput --dataset $dataset_path --extra_llm_api_options extra_llm_api_options.yaml --num_requests 64 --concurrency 16 +``` diff --git a/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc0.md b/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc0.md new file mode 100644 index 0000000000000000000000000000000000000000..32a27f416edd0c644d1f884bae76a34e4c2259d9 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc0.md @@ -0,0 +1,233 @@ +# LoRA (Low-Rank Adaptation)# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc0/features/lora.html +Version: 1.2.0rc0 + +LoRA (Low-Rank Adaptation) is a parameter-efficient fine-tuning technique that enables adapting large language models to specific tasks without modifying the original model weights. Instead of fine-tuning all parameters, LoRA introduces small trainable rank decomposition matrices that are added to existing weights during inference. + +## Table of Contents[#](#table-of-contents "Link to this heading") + +1. [Background](#background) +2. [Basic Usage](#basic-usage) + + * [Single LoRA Adapter](#single-lora-adapter) + * [Multi-LoRA Support](#multi-lora-support) +3. [Advanced Usage](#advanced-usage) + + * [LoRA with Quantization](#lora-with-quantization) + * [NeMo LoRA Format](#nemo-lora-format) + * [Cache Management](#cache-management) +4. [TRTLLM serve with LoRA](#trtllm-serve-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Starting the Server](#starting-the-server) + * [Client Usage](#client-usage) +5. [TRTLLM bench with LORA](#trtllm-bench-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Run trtllm-bench](#run-trtllm-bench) + +## Background[#](#background "Link to this heading") + +The PyTorch backend provides LoRA support, allowing you to: + +* Load and apply multiple LoRA adapters simultaneously +* Switch between different adapters for different requests +* Use LoRA with quantized models +* Support both HuggingFace and NeMo LoRA formats + +## Basic Usage[#](#basic-usage "Link to this heading") + +### Single LoRA Adapter[#](#single-lora-adapter "Link to this heading") + +```None +from tensorrt_llm import LLM +from tensorrt_llm.lora_manager import LoraConfig +from tensorrt_llm.executor.request import LoRARequest +from tensorrt_llm.sampling_params import SamplingParams + +# Configure LoRA +lora_config = LoraConfig( + lora_dir=["/path/to/lora/adapter"], + max_lora_rank=8, + max_loras=1, + max_cpu_loras=1 +) + +# Initialize LLM with LoRA support +llm = LLM( + model="/path/to/base/model", + lora_config=lora_config +) + +# Create LoRA request +lora_request = LoRARequest("my-lora-task", 0, "/path/to/lora/adapter") + +# Generate with LoRA +prompts = ["Hello, how are you?"] +sampling_params = SamplingParams(max_tokens=50) + +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_request] +) +``` + +### Multi-LoRA Support[#](#multi-lora-support "Link to this heading") + +```None +# Configure for multiple LoRA adapters +lora_config = LoraConfig( + lora_target_modules=['attn_q', 'attn_k', 'attn_v'], + max_lora_rank=8, + max_loras=4, + max_cpu_loras=8 +) + +llm = LLM(model="/path/to/base/model", lora_config=lora_config) + +# Create multiple LoRA requests +lora_req1 = LoRARequest("task-1", 0, "/path/to/adapter1") +lora_req2 = LoRARequest("task-2", 1, "/path/to/adapter2") + +prompts = [ + "Translate to French: Hello world", + "Summarize: This is a long document..." +] + +# Apply different LoRAs to different prompts +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_req1, lora_req2] +) +``` + +## Advanced Usage[#](#advanced-usage "Link to this heading") + +### LoRA with Quantization[#](#lora-with-quantization "Link to this heading") + +```None +from tensorrt_llm.models.modeling_utils import QuantConfig +from tensorrt_llm.quantization.mode import QuantAlgo + +# Configure quantization +quant_config = QuantConfig( + quant_algo=QuantAlgo.FP8, + kv_cache_quant_algo=QuantAlgo.FP8 +) + +# LoRA works with quantized models +llm = LLM( + model="/path/to/model", + quant_config=quant_config, + lora_config=lora_config +) +``` + +### NeMo LoRA Format[#](#nemo-lora-format "Link to this heading") + +```None +# For NeMo-format LoRA checkpoints +lora_config = LoraConfig( + lora_dir=["/path/to/nemo/lora"], + lora_ckpt_source="nemo", + max_lora_rank=8 +) + +lora_request = LoRARequest( + "nemo-task", + 0, + "/path/to/nemo/lora", + lora_ckpt_source="nemo" +) +``` + +### Cache Management[#](#cache-management "Link to this heading") + +```None +from tensorrt_llm.llmapi.llm_args import PeftCacheConfig + +# Fine-tune cache sizes +peft_cache_config = PeftCacheConfig( + host_cache_size=1024*1024*1024, # 1GB CPU cache + device_cache_percent=0.1 # 10% of free GPU memory +) + +llm = LLM( + model="/path/to/model", + lora_config=lora_config, + peft_cache_config=peft_cache_config +) +``` + +## TRTLLM serve with LoRA[#](#trtllm-serve-with-lora "Link to this heading") + +### YAML Configuration[#](#yaml-configuration "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_target_modules: ['attn_q', 'attn_k', 'attn_v'] + max_lora_rank: 8 +``` + +### Starting the Server[#](#starting-the-server "Link to this heading") + +```None +python -m tensorrt_llm.commands.serve + /path/to/model \ + --extra_llm_api_options extra_llm_api_options.yaml +``` + +### Client Usage[#](#client-usage "Link to this heading") + +```None +import openai + +client = openai.OpenAI(base_url="http://localhost:8000/v1", api_key="dummy") + +response = client.completions.create( + model="/path/to/model", + prompt="What is the capital city of France?", + max_tokens=20, + extra_body={ + "lora_request": { + "lora_name": "lora-example-0", + "lora_int_id": 0, + "lora_path": "/path/to/lora_adapter" + } + }, +) +``` + +## TRTLLM bench with LORA[#](#trtllm-bench-with-lora "Link to this heading") + +### YAML Configuration[#](#id1 "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_dir: + - /workspaces/tensorrt_llm/loras/0 + max_lora_rank: 64 + max_loras: 8 + max_cpu_loras: 8 + lora_target_modules: + - attn_q + - attn_k + - attn_v + trtllm_modules_to_hf_modules: + attn_q: q_proj + attn_k: k_proj + attn_v: v_proj +``` + +### Run trtllm-bench[#](#run-trtllm-bench "Link to this heading") + +```None +trtllm-bench --model $model_path throughput --dataset $dataset_path --extra_llm_api_options extra_llm_api_options.yaml --num_requests 64 --concurrency 16 +``` diff --git a/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc1.md b/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc1.md new file mode 100644 index 0000000000000000000000000000000000000000..077645c99b90e0fe60323537f2fd2bbaaf8a63be --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc1.md @@ -0,0 +1,233 @@ +# LoRA (Low-Rank Adaptation)# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc1/features/lora.html +Version: 1.2.0rc1 + +LoRA (Low-Rank Adaptation) is a parameter-efficient fine-tuning technique that enables adapting large language models to specific tasks without modifying the original model weights. Instead of fine-tuning all parameters, LoRA introduces small trainable rank decomposition matrices that are added to existing weights during inference. + +## Table of Contents[#](#table-of-contents "Link to this heading") + +1. [Background](#background) +2. [Basic Usage](#basic-usage) + + * [Single LoRA Adapter](#single-lora-adapter) + * [Multi-LoRA Support](#multi-lora-support) +3. [Advanced Usage](#advanced-usage) + + * [LoRA with Quantization](#lora-with-quantization) + * [NeMo LoRA Format](#nemo-lora-format) + * [Cache Management](#cache-management) +4. [TRTLLM serve with LoRA](#trtllm-serve-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Starting the Server](#starting-the-server) + * [Client Usage](#client-usage) +5. [TRTLLM bench with LORA](#trtllm-bench-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Run trtllm-bench](#run-trtllm-bench) + +## Background[#](#background "Link to this heading") + +The PyTorch backend provides LoRA support, allowing you to: + +* Load and apply multiple LoRA adapters simultaneously +* Switch between different adapters for different requests +* Use LoRA with quantized models +* Support both HuggingFace and NeMo LoRA formats + +## Basic Usage[#](#basic-usage "Link to this heading") + +### Single LoRA Adapter[#](#single-lora-adapter "Link to this heading") + +```None +from tensorrt_llm import LLM +from tensorrt_llm.lora_manager import LoraConfig +from tensorrt_llm.executor.request import LoRARequest +from tensorrt_llm.sampling_params import SamplingParams + +# Configure LoRA +lora_config = LoraConfig( + lora_dir=["/path/to/lora/adapter"], + max_lora_rank=8, + max_loras=1, + max_cpu_loras=1 +) + +# Initialize LLM with LoRA support +llm = LLM( + model="/path/to/base/model", + lora_config=lora_config +) + +# Create LoRA request +lora_request = LoRARequest("my-lora-task", 0, "/path/to/lora/adapter") + +# Generate with LoRA +prompts = ["Hello, how are you?"] +sampling_params = SamplingParams(max_tokens=50) + +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_request] +) +``` + +### Multi-LoRA Support[#](#multi-lora-support "Link to this heading") + +```None +# Configure for multiple LoRA adapters +lora_config = LoraConfig( + lora_target_modules=['attn_q', 'attn_k', 'attn_v'], + max_lora_rank=8, + max_loras=4, + max_cpu_loras=8 +) + +llm = LLM(model="/path/to/base/model", lora_config=lora_config) + +# Create multiple LoRA requests +lora_req1 = LoRARequest("task-1", 0, "/path/to/adapter1") +lora_req2 = LoRARequest("task-2", 1, "/path/to/adapter2") + +prompts = [ + "Translate to French: Hello world", + "Summarize: This is a long document..." +] + +# Apply different LoRAs to different prompts +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_req1, lora_req2] +) +``` + +## Advanced Usage[#](#advanced-usage "Link to this heading") + +### LoRA with Quantization[#](#lora-with-quantization "Link to this heading") + +```None +from tensorrt_llm.models.modeling_utils import QuantConfig +from tensorrt_llm.quantization.mode import QuantAlgo + +# Configure quantization +quant_config = QuantConfig( + quant_algo=QuantAlgo.FP8, + kv_cache_quant_algo=QuantAlgo.FP8 +) + +# LoRA works with quantized models +llm = LLM( + model="/path/to/model", + quant_config=quant_config, + lora_config=lora_config +) +``` + +### NeMo LoRA Format[#](#nemo-lora-format "Link to this heading") + +```None +# For NeMo-format LoRA checkpoints +lora_config = LoraConfig( + lora_dir=["/path/to/nemo/lora"], + lora_ckpt_source="nemo", + max_lora_rank=8 +) + +lora_request = LoRARequest( + "nemo-task", + 0, + "/path/to/nemo/lora", + lora_ckpt_source="nemo" +) +``` + +### Cache Management[#](#cache-management "Link to this heading") + +```None +from tensorrt_llm.llmapi.llm_args import PeftCacheConfig + +# Fine-tune cache sizes +peft_cache_config = PeftCacheConfig( + host_cache_size=1024*1024*1024, # 1GB CPU cache + device_cache_percent=0.1 # 10% of free GPU memory +) + +llm = LLM( + model="/path/to/model", + lora_config=lora_config, + peft_cache_config=peft_cache_config +) +``` + +## TRTLLM serve with LoRA[#](#trtllm-serve-with-lora "Link to this heading") + +### YAML Configuration[#](#yaml-configuration "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_target_modules: ['attn_q', 'attn_k', 'attn_v'] + max_lora_rank: 8 +``` + +### Starting the Server[#](#starting-the-server "Link to this heading") + +```None +python -m tensorrt_llm.commands.serve + /path/to/model \ + --extra_llm_api_options extra_llm_api_options.yaml +``` + +### Client Usage[#](#client-usage "Link to this heading") + +```None +import openai + +client = openai.OpenAI(base_url="http://localhost:8000/v1", api_key="dummy") + +response = client.completions.create( + model="/path/to/model", + prompt="What is the capital city of France?", + max_tokens=20, + extra_body={ + "lora_request": { + "lora_name": "lora-example-0", + "lora_int_id": 0, + "lora_path": "/path/to/lora_adapter" + } + }, +) +``` + +## TRTLLM bench with LORA[#](#trtllm-bench-with-lora "Link to this heading") + +### YAML Configuration[#](#id1 "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_dir: + - /workspaces/tensorrt_llm/loras/0 + max_lora_rank: 64 + max_loras: 8 + max_cpu_loras: 8 + lora_target_modules: + - attn_q + - attn_k + - attn_v + trtllm_modules_to_hf_modules: + attn_q: q_proj + attn_k: k_proj + attn_v: v_proj +``` + +### Run trtllm-bench[#](#run-trtllm-bench "Link to this heading") + +```None +trtllm-bench --model $model_path throughput --dataset $dataset_path --extra_llm_api_options extra_llm_api_options.yaml --num_requests 64 --concurrency 16 +``` diff --git a/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc2.md b/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc2.md new file mode 100644 index 0000000000000000000000000000000000000000..b4e8e86ee6eae3ad9fa9603b4812615c33b99731 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc2.md @@ -0,0 +1,233 @@ +# LoRA (Low-Rank Adaptation)# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc2/features/lora.html +Version: 1.2.0rc2 + +LoRA (Low-Rank Adaptation) is a parameter-efficient fine-tuning technique that enables adapting large language models to specific tasks without modifying the original model weights. Instead of fine-tuning all parameters, LoRA introduces small trainable rank decomposition matrices that are added to existing weights during inference. + +## Table of Contents[#](#table-of-contents "Link to this heading") + +1. [Background](#background) +2. [Basic Usage](#basic-usage) + + * [Single LoRA Adapter](#single-lora-adapter) + * [Multi-LoRA Support](#multi-lora-support) +3. [Advanced Usage](#advanced-usage) + + * [LoRA with Quantization](#lora-with-quantization) + * [NeMo LoRA Format](#nemo-lora-format) + * [Cache Management](#cache-management) +4. [TRTLLM serve with LoRA](#trtllm-serve-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Starting the Server](#starting-the-server) + * [Client Usage](#client-usage) +5. [TRTLLM bench with LORA](#trtllm-bench-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Run trtllm-bench](#run-trtllm-bench) + +## Background[#](#background "Link to this heading") + +The PyTorch backend provides LoRA support, allowing you to: + +* Load and apply multiple LoRA adapters simultaneously +* Switch between different adapters for different requests +* Use LoRA with quantized models +* Support both HuggingFace and NeMo LoRA formats + +## Basic Usage[#](#basic-usage "Link to this heading") + +### Single LoRA Adapter[#](#single-lora-adapter "Link to this heading") + +```None +from tensorrt_llm import LLM +from tensorrt_llm.lora_manager import LoraConfig +from tensorrt_llm.executor.request import LoRARequest +from tensorrt_llm.sampling_params import SamplingParams + +# Configure LoRA +lora_config = LoraConfig( + lora_dir=["/path/to/lora/adapter"], + max_lora_rank=8, + max_loras=1, + max_cpu_loras=1 +) + +# Initialize LLM with LoRA support +llm = LLM( + model="/path/to/base/model", + lora_config=lora_config +) + +# Create LoRA request +lora_request = LoRARequest("my-lora-task", 0, "/path/to/lora/adapter") + +# Generate with LoRA +prompts = ["Hello, how are you?"] +sampling_params = SamplingParams(max_tokens=50) + +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_request] +) +``` + +### Multi-LoRA Support[#](#multi-lora-support "Link to this heading") + +```None +# Configure for multiple LoRA adapters +lora_config = LoraConfig( + lora_target_modules=['attn_q', 'attn_k', 'attn_v'], + max_lora_rank=8, + max_loras=4, + max_cpu_loras=8 +) + +llm = LLM(model="/path/to/base/model", lora_config=lora_config) + +# Create multiple LoRA requests +lora_req1 = LoRARequest("task-1", 0, "/path/to/adapter1") +lora_req2 = LoRARequest("task-2", 1, "/path/to/adapter2") + +prompts = [ + "Translate to French: Hello world", + "Summarize: This is a long document..." +] + +# Apply different LoRAs to different prompts +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_req1, lora_req2] +) +``` + +## Advanced Usage[#](#advanced-usage "Link to this heading") + +### LoRA with Quantization[#](#lora-with-quantization "Link to this heading") + +```None +from tensorrt_llm.models.modeling_utils import QuantConfig +from tensorrt_llm.quantization.mode import QuantAlgo + +# Configure quantization +quant_config = QuantConfig( + quant_algo=QuantAlgo.FP8, + kv_cache_quant_algo=QuantAlgo.FP8 +) + +# LoRA works with quantized models +llm = LLM( + model="/path/to/model", + quant_config=quant_config, + lora_config=lora_config +) +``` + +### NeMo LoRA Format[#](#nemo-lora-format "Link to this heading") + +```None +# For NeMo-format LoRA checkpoints +lora_config = LoraConfig( + lora_dir=["/path/to/nemo/lora"], + lora_ckpt_source="nemo", + max_lora_rank=8 +) + +lora_request = LoRARequest( + "nemo-task", + 0, + "/path/to/nemo/lora", + lora_ckpt_source="nemo" +) +``` + +### Cache Management[#](#cache-management "Link to this heading") + +```None +from tensorrt_llm.llmapi.llm_args import PeftCacheConfig + +# Fine-tune cache sizes +peft_cache_config = PeftCacheConfig( + host_cache_size=1024*1024*1024, # 1GB CPU cache + device_cache_percent=0.1 # 10% of free GPU memory +) + +llm = LLM( + model="/path/to/model", + lora_config=lora_config, + peft_cache_config=peft_cache_config +) +``` + +## TRTLLM serve with LoRA[#](#trtllm-serve-with-lora "Link to this heading") + +### YAML Configuration[#](#yaml-configuration "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_target_modules: ['attn_q', 'attn_k', 'attn_v'] + max_lora_rank: 8 +``` + +### Starting the Server[#](#starting-the-server "Link to this heading") + +```None +python -m tensorrt_llm.commands.serve + /path/to/model \ + --extra_llm_api_options extra_llm_api_options.yaml +``` + +### Client Usage[#](#client-usage "Link to this heading") + +```None +import openai + +client = openai.OpenAI(base_url="http://localhost:8000/v1", api_key="dummy") + +response = client.completions.create( + model="/path/to/model", + prompt="What is the capital city of France?", + max_tokens=20, + extra_body={ + "lora_request": { + "lora_name": "lora-example-0", + "lora_int_id": 0, + "lora_path": "/path/to/lora_adapter" + } + }, +) +``` + +## TRTLLM bench with LORA[#](#trtllm-bench-with-lora "Link to this heading") + +### YAML Configuration[#](#id1 "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_dir: + - /workspaces/tensorrt_llm/loras/0 + max_lora_rank: 64 + max_loras: 8 + max_cpu_loras: 8 + lora_target_modules: + - attn_q + - attn_k + - attn_v + trtllm_modules_to_hf_modules: + attn_q: q_proj + attn_k: k_proj + attn_v: v_proj +``` + +### Run trtllm-bench[#](#run-trtllm-bench "Link to this heading") + +```None +trtllm-bench --model $model_path throughput --dataset $dataset_path --extra_llm_api_options extra_llm_api_options.yaml --num_requests 64 --concurrency 16 +``` diff --git a/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc3.md b/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc3.md new file mode 100644 index 0000000000000000000000000000000000000000..a6791ac2a2a7ce1e5378bbcc8e64ab34891d57ea --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc3.md @@ -0,0 +1,233 @@ +# LoRA (Low-Rank Adaptation)# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc3/features/lora.html +Version: 1.2.0rc3 + +LoRA (Low-Rank Adaptation) is a parameter-efficient fine-tuning technique that enables adapting large language models to specific tasks without modifying the original model weights. Instead of fine-tuning all parameters, LoRA introduces small trainable rank decomposition matrices that are added to existing weights during inference. + +## Table of Contents[#](#table-of-contents "Link to this heading") + +1. [Background](#background) +2. [Basic Usage](#basic-usage) + + * [Single LoRA Adapter](#single-lora-adapter) + * [Multi-LoRA Support](#multi-lora-support) +3. [Advanced Usage](#advanced-usage) + + * [LoRA with Quantization](#lora-with-quantization) + * [NeMo LoRA Format](#nemo-lora-format) + * [Cache Management](#cache-management) +4. [TRTLLM serve with LoRA](#trtllm-serve-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Starting the Server](#starting-the-server) + * [Client Usage](#client-usage) +5. [TRTLLM bench with LORA](#trtllm-bench-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Run trtllm-bench](#run-trtllm-bench) + +## Background[#](#background "Link to this heading") + +The PyTorch backend provides LoRA support, allowing you to: + +* Load and apply multiple LoRA adapters simultaneously +* Switch between different adapters for different requests +* Use LoRA with quantized models +* Support both HuggingFace and NeMo LoRA formats + +## Basic Usage[#](#basic-usage "Link to this heading") + +### Single LoRA Adapter[#](#single-lora-adapter "Link to this heading") + +```None +from tensorrt_llm import LLM +from tensorrt_llm.lora_manager import LoraConfig +from tensorrt_llm.executor.request import LoRARequest +from tensorrt_llm.sampling_params import SamplingParams + +# Configure LoRA +lora_config = LoraConfig( + lora_dir=["/path/to/lora/adapter"], + max_lora_rank=8, + max_loras=1, + max_cpu_loras=1 +) + +# Initialize LLM with LoRA support +llm = LLM( + model="/path/to/base/model", + lora_config=lora_config +) + +# Create LoRA request +lora_request = LoRARequest("my-lora-task", 0, "/path/to/lora/adapter") + +# Generate with LoRA +prompts = ["Hello, how are you?"] +sampling_params = SamplingParams(max_tokens=50) + +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_request] +) +``` + +### Multi-LoRA Support[#](#multi-lora-support "Link to this heading") + +```None +# Configure for multiple LoRA adapters +lora_config = LoraConfig( + lora_target_modules=['attn_q', 'attn_k', 'attn_v'], + max_lora_rank=8, + max_loras=4, + max_cpu_loras=8 +) + +llm = LLM(model="/path/to/base/model", lora_config=lora_config) + +# Create multiple LoRA requests +lora_req1 = LoRARequest("task-1", 0, "/path/to/adapter1") +lora_req2 = LoRARequest("task-2", 1, "/path/to/adapter2") + +prompts = [ + "Translate to French: Hello world", + "Summarize: This is a long document..." +] + +# Apply different LoRAs to different prompts +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_req1, lora_req2] +) +``` + +## Advanced Usage[#](#advanced-usage "Link to this heading") + +### LoRA with Quantization[#](#lora-with-quantization "Link to this heading") + +```None +from tensorrt_llm.models.modeling_utils import QuantConfig +from tensorrt_llm.quantization.mode import QuantAlgo + +# Configure quantization +quant_config = QuantConfig( + quant_algo=QuantAlgo.FP8, + kv_cache_quant_algo=QuantAlgo.FP8 +) + +# LoRA works with quantized models +llm = LLM( + model="/path/to/model", + quant_config=quant_config, + lora_config=lora_config +) +``` + +### NeMo LoRA Format[#](#nemo-lora-format "Link to this heading") + +```None +# For NeMo-format LoRA checkpoints +lora_config = LoraConfig( + lora_dir=["/path/to/nemo/lora"], + lora_ckpt_source="nemo", + max_lora_rank=8 +) + +lora_request = LoRARequest( + "nemo-task", + 0, + "/path/to/nemo/lora", + lora_ckpt_source="nemo" +) +``` + +### Cache Management[#](#cache-management "Link to this heading") + +```None +from tensorrt_llm.llmapi.llm_args import PeftCacheConfig + +# Fine-tune cache sizes +peft_cache_config = PeftCacheConfig( + host_cache_size=1024*1024*1024, # 1GB CPU cache + device_cache_percent=0.1 # 10% of free GPU memory +) + +llm = LLM( + model="/path/to/model", + lora_config=lora_config, + peft_cache_config=peft_cache_config +) +``` + +## TRTLLM serve with LoRA[#](#trtllm-serve-with-lora "Link to this heading") + +### YAML Configuration[#](#yaml-configuration "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_target_modules: ['attn_q', 'attn_k', 'attn_v'] + max_lora_rank: 8 +``` + +### Starting the Server[#](#starting-the-server "Link to this heading") + +```None +python -m tensorrt_llm.commands.serve + /path/to/model \ + --extra_llm_api_options extra_llm_api_options.yaml +``` + +### Client Usage[#](#client-usage "Link to this heading") + +```None +import openai + +client = openai.OpenAI(base_url="http://localhost:8000/v1", api_key="dummy") + +response = client.completions.create( + model="/path/to/model", + prompt="What is the capital city of France?", + max_tokens=20, + extra_body={ + "lora_request": { + "lora_name": "lora-example-0", + "lora_int_id": 0, + "lora_path": "/path/to/lora_adapter" + } + }, +) +``` + +## TRTLLM bench with LORA[#](#trtllm-bench-with-lora "Link to this heading") + +### YAML Configuration[#](#id1 "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_dir: + - /workspaces/tensorrt_llm/loras/0 + max_lora_rank: 64 + max_loras: 8 + max_cpu_loras: 8 + lora_target_modules: + - attn_q + - attn_k + - attn_v + trtllm_modules_to_hf_modules: + attn_q: q_proj + attn_k: k_proj + attn_v: v_proj +``` + +### Run trtllm-bench[#](#run-trtllm-bench "Link to this heading") + +```None +trtllm-bench --model $model_path throughput --dataset $dataset_path --extra_llm_api_options extra_llm_api_options.yaml --num_requests 64 --concurrency 16 +``` diff --git a/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc4.md b/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc4.md new file mode 100644 index 0000000000000000000000000000000000000000..7f235421b64a52736a573b93e429a661b81c867a --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc4.md @@ -0,0 +1,233 @@ +# LoRA (Low-Rank Adaptation)# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc4/features/lora.html +Version: 1.2.0rc4 + +LoRA (Low-Rank Adaptation) is a parameter-efficient fine-tuning technique that enables adapting large language models to specific tasks without modifying the original model weights. Instead of fine-tuning all parameters, LoRA introduces small trainable rank decomposition matrices that are added to existing weights during inference. + +## Table of Contents[#](#table-of-contents "Link to this heading") + +1. [Background](#background) +2. [Basic Usage](#basic-usage) + + * [Single LoRA Adapter](#single-lora-adapter) + * [Multi-LoRA Support](#multi-lora-support) +3. [Advanced Usage](#advanced-usage) + + * [LoRA with Quantization](#lora-with-quantization) + * [NeMo LoRA Format](#nemo-lora-format) + * [Cache Management](#cache-management) +4. [TRTLLM serve with LoRA](#trtllm-serve-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Starting the Server](#starting-the-server) + * [Client Usage](#client-usage) +5. [TRTLLM bench with LORA](#trtllm-bench-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Run trtllm-bench](#run-trtllm-bench) + +## Background[#](#background "Link to this heading") + +The PyTorch backend provides LoRA support, allowing you to: + +* Load and apply multiple LoRA adapters simultaneously +* Switch between different adapters for different requests +* Use LoRA with quantized models +* Support both HuggingFace and NeMo LoRA formats + +## Basic Usage[#](#basic-usage "Link to this heading") + +### Single LoRA Adapter[#](#single-lora-adapter "Link to this heading") + +```None +from tensorrt_llm import LLM +from tensorrt_llm.lora_manager import LoraConfig +from tensorrt_llm.executor.request import LoRARequest +from tensorrt_llm.sampling_params import SamplingParams + +# Configure LoRA +lora_config = LoraConfig( + lora_dir=["/path/to/lora/adapter"], + max_lora_rank=8, + max_loras=1, + max_cpu_loras=1 +) + +# Initialize LLM with LoRA support +llm = LLM( + model="/path/to/base/model", + lora_config=lora_config +) + +# Create LoRA request +lora_request = LoRARequest("my-lora-task", 0, "/path/to/lora/adapter") + +# Generate with LoRA +prompts = ["Hello, how are you?"] +sampling_params = SamplingParams(max_tokens=50) + +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_request] +) +``` + +### Multi-LoRA Support[#](#multi-lora-support "Link to this heading") + +```None +# Configure for multiple LoRA adapters +lora_config = LoraConfig( + lora_target_modules=['attn_q', 'attn_k', 'attn_v'], + max_lora_rank=8, + max_loras=4, + max_cpu_loras=8 +) + +llm = LLM(model="/path/to/base/model", lora_config=lora_config) + +# Create multiple LoRA requests +lora_req1 = LoRARequest("task-1", 0, "/path/to/adapter1") +lora_req2 = LoRARequest("task-2", 1, "/path/to/adapter2") + +prompts = [ + "Translate to French: Hello world", + "Summarize: This is a long document..." +] + +# Apply different LoRAs to different prompts +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_req1, lora_req2] +) +``` + +## Advanced Usage[#](#advanced-usage "Link to this heading") + +### LoRA with Quantization[#](#lora-with-quantization "Link to this heading") + +```None +from tensorrt_llm.models.modeling_utils import QuantConfig +from tensorrt_llm.quantization.mode import QuantAlgo + +# Configure quantization +quant_config = QuantConfig( + quant_algo=QuantAlgo.FP8, + kv_cache_quant_algo=QuantAlgo.FP8 +) + +# LoRA works with quantized models +llm = LLM( + model="/path/to/model", + quant_config=quant_config, + lora_config=lora_config +) +``` + +### NeMo LoRA Format[#](#nemo-lora-format "Link to this heading") + +```None +# For NeMo-format LoRA checkpoints +lora_config = LoraConfig( + lora_dir=["/path/to/nemo/lora"], + lora_ckpt_source="nemo", + max_lora_rank=8 +) + +lora_request = LoRARequest( + "nemo-task", + 0, + "/path/to/nemo/lora", + lora_ckpt_source="nemo" +) +``` + +### Cache Management[#](#cache-management "Link to this heading") + +```None +from tensorrt_llm.llmapi.llm_args import PeftCacheConfig + +# Fine-tune cache sizes +peft_cache_config = PeftCacheConfig( + host_cache_size=1024*1024*1024, # 1GB CPU cache + device_cache_percent=0.1 # 10% of free GPU memory +) + +llm = LLM( + model="/path/to/model", + lora_config=lora_config, + peft_cache_config=peft_cache_config +) +``` + +## TRTLLM serve with LoRA[#](#trtllm-serve-with-lora "Link to this heading") + +### YAML Configuration[#](#yaml-configuration "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_target_modules: ['attn_q', 'attn_k', 'attn_v'] + max_lora_rank: 8 +``` + +### Starting the Server[#](#starting-the-server "Link to this heading") + +```None +python -m tensorrt_llm.commands.serve + /path/to/model \ + --extra_llm_api_options extra_llm_api_options.yaml +``` + +### Client Usage[#](#client-usage "Link to this heading") + +```None +import openai + +client = openai.OpenAI(base_url="http://localhost:8000/v1", api_key="dummy") + +response = client.completions.create( + model="/path/to/model", + prompt="What is the capital city of France?", + max_tokens=20, + extra_body={ + "lora_request": { + "lora_name": "lora-example-0", + "lora_int_id": 0, + "lora_path": "/path/to/lora_adapter" + } + }, +) +``` + +## TRTLLM bench with LORA[#](#trtllm-bench-with-lora "Link to this heading") + +### YAML Configuration[#](#id1 "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_dir: + - /workspaces/tensorrt_llm/loras/0 + max_lora_rank: 64 + max_loras: 8 + max_cpu_loras: 8 + lora_target_modules: + - attn_q + - attn_k + - attn_v + trtllm_modules_to_hf_modules: + attn_q: q_proj + attn_k: k_proj + attn_v: v_proj +``` + +### Run trtllm-bench[#](#run-trtllm-bench "Link to this heading") + +```None +trtllm-bench --model $model_path throughput --dataset $dataset_path --extra_llm_api_options extra_llm_api_options.yaml --num_requests 64 --concurrency 16 +``` diff --git a/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc5.md b/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc5.md new file mode 100644 index 0000000000000000000000000000000000000000..1635dfea401127e9950168b93873de4f5bb4f904 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc5.md @@ -0,0 +1,233 @@ +# LoRA (Low-Rank Adaptation)# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc5/features/lora.html +Version: 1.2.0rc5 + +LoRA (Low-Rank Adaptation) is a parameter-efficient fine-tuning technique that enables adapting large language models to specific tasks without modifying the original model weights. Instead of fine-tuning all parameters, LoRA introduces small trainable rank decomposition matrices that are added to existing weights during inference. + +## Table of Contents[#](#table-of-contents "Link to this heading") + +1. [Background](#background) +2. [Basic Usage](#basic-usage) + + * [Single LoRA Adapter](#single-lora-adapter) + * [Multi-LoRA Support](#multi-lora-support) +3. [Advanced Usage](#advanced-usage) + + * [LoRA with Quantization](#lora-with-quantization) + * [NeMo LoRA Format](#nemo-lora-format) + * [Cache Management](#cache-management) +4. [TRTLLM serve with LoRA](#trtllm-serve-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Starting the Server](#starting-the-server) + * [Client Usage](#client-usage) +5. [TRTLLM bench with LORA](#trtllm-bench-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Run trtllm-bench](#run-trtllm-bench) + +## Background[#](#background "Link to this heading") + +The PyTorch backend provides LoRA support, allowing you to: + +* Load and apply multiple LoRA adapters simultaneously +* Switch between different adapters for different requests +* Use LoRA with quantized models +* Support both HuggingFace and NeMo LoRA formats + +## Basic Usage[#](#basic-usage "Link to this heading") + +### Single LoRA Adapter[#](#single-lora-adapter "Link to this heading") + +```None +from tensorrt_llm import LLM +from tensorrt_llm.lora_manager import LoraConfig +from tensorrt_llm.executor.request import LoRARequest +from tensorrt_llm.sampling_params import SamplingParams + +# Configure LoRA +lora_config = LoraConfig( + lora_dir=["/path/to/lora/adapter"], + max_lora_rank=8, + max_loras=1, + max_cpu_loras=1 +) + +# Initialize LLM with LoRA support +llm = LLM( + model="/path/to/base/model", + lora_config=lora_config +) + +# Create LoRA request +lora_request = LoRARequest("my-lora-task", 0, "/path/to/lora/adapter") + +# Generate with LoRA +prompts = ["Hello, how are you?"] +sampling_params = SamplingParams(max_tokens=50) + +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_request] +) +``` + +### Multi-LoRA Support[#](#multi-lora-support "Link to this heading") + +```None +# Configure for multiple LoRA adapters +lora_config = LoraConfig( + lora_target_modules=['attn_q', 'attn_k', 'attn_v'], + max_lora_rank=8, + max_loras=4, + max_cpu_loras=8 +) + +llm = LLM(model="/path/to/base/model", lora_config=lora_config) + +# Create multiple LoRA requests +lora_req1 = LoRARequest("task-1", 0, "/path/to/adapter1") +lora_req2 = LoRARequest("task-2", 1, "/path/to/adapter2") + +prompts = [ + "Translate to French: Hello world", + "Summarize: This is a long document..." +] + +# Apply different LoRAs to different prompts +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_req1, lora_req2] +) +``` + +## Advanced Usage[#](#advanced-usage "Link to this heading") + +### LoRA with Quantization[#](#lora-with-quantization "Link to this heading") + +```None +from tensorrt_llm.models.modeling_utils import QuantConfig +from tensorrt_llm.quantization.mode import QuantAlgo + +# Configure quantization +quant_config = QuantConfig( + quant_algo=QuantAlgo.FP8, + kv_cache_quant_algo=QuantAlgo.FP8 +) + +# LoRA works with quantized models +llm = LLM( + model="/path/to/model", + quant_config=quant_config, + lora_config=lora_config +) +``` + +### NeMo LoRA Format[#](#nemo-lora-format "Link to this heading") + +```None +# For NeMo-format LoRA checkpoints +lora_config = LoraConfig( + lora_dir=["/path/to/nemo/lora"], + lora_ckpt_source="nemo", + max_lora_rank=8 +) + +lora_request = LoRARequest( + "nemo-task", + 0, + "/path/to/nemo/lora", + lora_ckpt_source="nemo" +) +``` + +### Cache Management[#](#cache-management "Link to this heading") + +```None +from tensorrt_llm.llmapi.llm_args import PeftCacheConfig + +# Fine-tune cache sizes +peft_cache_config = PeftCacheConfig( + host_cache_size=1024*1024*1024, # 1GB CPU cache + device_cache_percent=0.1 # 10% of free GPU memory +) + +llm = LLM( + model="/path/to/model", + lora_config=lora_config, + peft_cache_config=peft_cache_config +) +``` + +## TRTLLM serve with LoRA[#](#trtllm-serve-with-lora "Link to this heading") + +### YAML Configuration[#](#yaml-configuration "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_target_modules: ['attn_q', 'attn_k', 'attn_v'] + max_lora_rank: 8 +``` + +### Starting the Server[#](#starting-the-server "Link to this heading") + +```None +python -m tensorrt_llm.commands.serve + /path/to/model \ + --extra_llm_api_options extra_llm_api_options.yaml +``` + +### Client Usage[#](#client-usage "Link to this heading") + +```None +import openai + +client = openai.OpenAI(base_url="http://localhost:8000/v1", api_key="dummy") + +response = client.completions.create( + model="/path/to/model", + prompt="What is the capital city of France?", + max_tokens=20, + extra_body={ + "lora_request": { + "lora_name": "lora-example-0", + "lora_int_id": 0, + "lora_path": "/path/to/lora_adapter" + } + }, +) +``` + +## TRTLLM bench with LORA[#](#trtllm-bench-with-lora "Link to this heading") + +### YAML Configuration[#](#id1 "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_dir: + - /workspaces/tensorrt_llm/loras/0 + max_lora_rank: 64 + max_loras: 8 + max_cpu_loras: 8 + lora_target_modules: + - attn_q + - attn_k + - attn_v + trtllm_modules_to_hf_modules: + attn_q: q_proj + attn_k: k_proj + attn_v: v_proj +``` + +### Run trtllm-bench[#](#run-trtllm-bench "Link to this heading") + +```None +trtllm-bench --model $model_path throughput --dataset $dataset_path --extra_llm_api_options extra_llm_api_options.yaml --num_requests 64 --concurrency 16 +``` diff --git a/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc6.md b/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc6.md new file mode 100644 index 0000000000000000000000000000000000000000..3115c54f3723e4d80893df2190d49e364f6b35b1 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc6.md @@ -0,0 +1,233 @@ +# LoRA (Low-Rank Adaptation)# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc6/features/lora.html +Version: 1.2.0rc6 + +LoRA (Low-Rank Adaptation) is a parameter-efficient fine-tuning technique that enables adapting large language models to specific tasks without modifying the original model weights. Instead of fine-tuning all parameters, LoRA introduces small trainable rank decomposition matrices that are added to existing weights during inference. + +## Table of Contents[#](#table-of-contents "Link to this heading") + +1. [Background](#background) +2. [Basic Usage](#basic-usage) + + * [Single LoRA Adapter](#single-lora-adapter) + * [Multi-LoRA Support](#multi-lora-support) +3. [Advanced Usage](#advanced-usage) + + * [LoRA with Quantization](#lora-with-quantization) + * [NeMo LoRA Format](#nemo-lora-format) + * [Cache Management](#cache-management) +4. [TRTLLM serve with LoRA](#trtllm-serve-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Starting the Server](#starting-the-server) + * [Client Usage](#client-usage) +5. [TRTLLM bench with LORA](#trtllm-bench-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Run trtllm-bench](#run-trtllm-bench) + +## Background[#](#background "Link to this heading") + +The PyTorch backend provides LoRA support, allowing you to: + +* Load and apply multiple LoRA adapters simultaneously +* Switch between different adapters for different requests +* Use LoRA with quantized models +* Support both HuggingFace and NeMo LoRA formats + +## Basic Usage[#](#basic-usage "Link to this heading") + +### Single LoRA Adapter[#](#single-lora-adapter "Link to this heading") + +```None +from tensorrt_llm import LLM +from tensorrt_llm.lora_manager import LoraConfig +from tensorrt_llm.executor.request import LoRARequest +from tensorrt_llm.sampling_params import SamplingParams + +# Configure LoRA +lora_config = LoraConfig( + lora_dir=["/path/to/lora/adapter"], + max_lora_rank=8, + max_loras=1, + max_cpu_loras=1 +) + +# Initialize LLM with LoRA support +llm = LLM( + model="/path/to/base/model", + lora_config=lora_config +) + +# Create LoRA request +lora_request = LoRARequest("my-lora-task", 0, "/path/to/lora/adapter") + +# Generate with LoRA +prompts = ["Hello, how are you?"] +sampling_params = SamplingParams(max_tokens=50) + +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_request] +) +``` + +### Multi-LoRA Support[#](#multi-lora-support "Link to this heading") + +```None +# Configure for multiple LoRA adapters +lora_config = LoraConfig( + lora_target_modules=['attn_q', 'attn_k', 'attn_v'], + max_lora_rank=8, + max_loras=4, + max_cpu_loras=8 +) + +llm = LLM(model="/path/to/base/model", lora_config=lora_config) + +# Create multiple LoRA requests +lora_req1 = LoRARequest("task-1", 0, "/path/to/adapter1") +lora_req2 = LoRARequest("task-2", 1, "/path/to/adapter2") + +prompts = [ + "Translate to French: Hello world", + "Summarize: This is a long document..." +] + +# Apply different LoRAs to different prompts +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_req1, lora_req2] +) +``` + +## Advanced Usage[#](#advanced-usage "Link to this heading") + +### LoRA with Quantization[#](#lora-with-quantization "Link to this heading") + +```None +from tensorrt_llm.models.modeling_utils import QuantConfig +from tensorrt_llm.quantization.mode import QuantAlgo + +# Configure quantization +quant_config = QuantConfig( + quant_algo=QuantAlgo.FP8, + kv_cache_quant_algo=QuantAlgo.FP8 +) + +# LoRA works with quantized models +llm = LLM( + model="/path/to/model", + quant_config=quant_config, + lora_config=lora_config +) +``` + +### NeMo LoRA Format[#](#nemo-lora-format "Link to this heading") + +```None +# For NeMo-format LoRA checkpoints +lora_config = LoraConfig( + lora_dir=["/path/to/nemo/lora"], + lora_ckpt_source="nemo", + max_lora_rank=8 +) + +lora_request = LoRARequest( + "nemo-task", + 0, + "/path/to/nemo/lora", + lora_ckpt_source="nemo" +) +``` + +### Cache Management[#](#cache-management "Link to this heading") + +```None +from tensorrt_llm.llmapi.llm_args import PeftCacheConfig + +# Fine-tune cache sizes +peft_cache_config = PeftCacheConfig( + host_cache_size=1024*1024*1024, # 1GB CPU cache + device_cache_percent=0.1 # 10% of free GPU memory +) + +llm = LLM( + model="/path/to/model", + lora_config=lora_config, + peft_cache_config=peft_cache_config +) +``` + +## TRTLLM serve with LoRA[#](#trtllm-serve-with-lora "Link to this heading") + +### YAML Configuration[#](#yaml-configuration "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_target_modules: ['attn_q', 'attn_k', 'attn_v'] + max_lora_rank: 8 +``` + +### Starting the Server[#](#starting-the-server "Link to this heading") + +```None +python -m tensorrt_llm.commands.serve + /path/to/model \ + --extra_llm_api_options extra_llm_api_options.yaml +``` + +### Client Usage[#](#client-usage "Link to this heading") + +```None +import openai + +client = openai.OpenAI(base_url="http://localhost:8000/v1", api_key="dummy") + +response = client.completions.create( + model="/path/to/model", + prompt="What is the capital city of France?", + max_tokens=20, + extra_body={ + "lora_request": { + "lora_name": "lora-example-0", + "lora_int_id": 0, + "lora_path": "/path/to/lora_adapter" + } + }, +) +``` + +## TRTLLM bench with LORA[#](#trtllm-bench-with-lora "Link to this heading") + +### YAML Configuration[#](#id1 "Link to this heading") + +Create an `extra_llm_api_options.yaml` file: + +```None +lora_config: + lora_dir: + - /workspaces/tensorrt_llm/loras/0 + max_lora_rank: 64 + max_loras: 8 + max_cpu_loras: 8 + lora_target_modules: + - attn_q + - attn_k + - attn_v + trtllm_modules_to_hf_modules: + attn_q: q_proj + attn_k: k_proj + attn_v: v_proj +``` + +### Run trtllm-bench[#](#run-trtllm-bench "Link to this heading") + +```None +trtllm-bench --model $model_path throughput --dataset $dataset_path --extra_llm_api_options extra_llm_api_options.yaml --num_requests 64 --concurrency 16 +``` diff --git a/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc7.md b/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc7.md new file mode 100644 index 0000000000000000000000000000000000000000..3c6d82973de32b3d1a2ad52cb1db19ed2782b90c --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc7.md @@ -0,0 +1,243 @@ +# LoRA (Low-Rank Adaptation)# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc7/features/lora.html +Version: 1.2.0rc7 + +LoRA (Low-Rank Adaptation) is a parameter-efficient fine-tuning technique that enables adapting large language models to specific tasks without modifying the original model weights. Instead of fine-tuning all parameters, LoRA introduces small trainable rank decomposition matrices that are added to existing weights during inference. + +## Table of Contents[#](#table-of-contents "Link to this heading") + +1. [Background](#background) +2. [Basic Usage](#basic-usage) + + * [Single LoRA Adapter](#single-lora-adapter) + * [Multi-LoRA Support](#multi-lora-support) +3. [Advanced Usage](#advanced-usage) + + * [LoRA with Quantization](#lora-with-quantization) + * [NeMo LoRA Format](#nemo-lora-format) + * [Cache Management](#cache-management) +4. [TRTLLM serve with LoRA](#trtllm-serve-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Starting the Server](#starting-the-server) + * [Client Usage](#client-usage) +5. [TRTLLM bench with LORA](#trtllm-bench-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Run trtllm-bench](#run-trtllm-bench) + +## Background[#](#background "Link to this heading") + +The PyTorch backend provides LoRA support, allowing you to: + +* Load and apply multiple LoRA adapters simultaneously +* Switch between different adapters for different requests +* Use LoRA with quantized models +* Support both HuggingFace and NeMo LoRA formats + +## Basic Usage[#](#basic-usage "Link to this heading") + +### Single LoRA Adapter[#](#single-lora-adapter "Link to this heading") + +```None +from tensorrt_llm import LLM +from tensorrt_llm.lora_manager import LoraConfig +from tensorrt_llm.executor.request import LoRARequest +from tensorrt_llm.sampling_params import SamplingParams + +# Configure LoRA +lora_config = LoraConfig( + lora_dir=["/path/to/lora/adapter"], + max_lora_rank=8, + max_loras=1, + max_cpu_loras=1 +) + +# Initialize LLM with LoRA support +llm = LLM( + model="/path/to/base/model", + lora_config=lora_config +) + +# Create LoRA request +lora_request = LoRARequest("my-lora-task", 0, "/path/to/lora/adapter") + +# Generate with LoRA +prompts = ["Hello, how are you?"] +sampling_params = SamplingParams(max_tokens=50) + +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_request] +) +``` + +### Multi-LoRA Support[#](#multi-lora-support "Link to this heading") + +```None +# Configure for multiple LoRA adapters +lora_config = LoraConfig( + lora_target_modules=['attn_q', 'attn_k', 'attn_v'], + max_lora_rank=8, + max_loras=4, + max_cpu_loras=8 +) + +llm = LLM(model="/path/to/base/model", lora_config=lora_config) + +# Create multiple LoRA requests +lora_req1 = LoRARequest("task-1", 0, "/path/to/adapter1") +lora_req2 = LoRARequest("task-2", 1, "/path/to/adapter2") + +prompts = [ + "Translate to French: Hello world", + "Summarize: This is a long document..." +] + +# Apply different LoRAs to different prompts +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_req1, lora_req2] +) +``` + +## Advanced Usage[#](#advanced-usage "Link to this heading") + +### LoRA with Quantization[#](#lora-with-quantization "Link to this heading") + +```None +from tensorrt_llm.models.modeling_utils import QuantConfig +from tensorrt_llm.quantization.mode import QuantAlgo + +# Configure quantization +quant_config = QuantConfig( + quant_algo=QuantAlgo.FP8, + kv_cache_quant_algo=QuantAlgo.FP8 +) + +# LoRA works with quantized models +llm = LLM( + model="/path/to/model", + quant_config=quant_config, + lora_config=lora_config +) +``` + +### NeMo LoRA Format[#](#nemo-lora-format "Link to this heading") + +```None +# For NeMo-format LoRA checkpoints +lora_config = LoraConfig( + lora_dir=["/path/to/nemo/lora"], + lora_ckpt_source="nemo", + max_lora_rank=8 +) + +lora_request = LoRARequest( + "nemo-task", + 0, + "/path/to/nemo/lora", + lora_ckpt_source="nemo" +) +``` + +### Cache Management[#](#cache-management "Link to this heading") + +```None +from tensorrt_llm.llmapi.llm_args import PeftCacheConfig + +# Fine-tune cache sizes +peft_cache_config = PeftCacheConfig( + host_cache_size=1024*1024*1024, # 1GB CPU cache + device_cache_percent=0.1 # 10% of free GPU memory +) + +llm = LLM( + model="/path/to/model", + lora_config=lora_config, + peft_cache_config=peft_cache_config +) +``` + +## TRTLLM serve with LoRA[#](#trtllm-serve-with-lora "Link to this heading") + +### YAML Configuration[#](#yaml-configuration "Link to this heading") + +Note + +**Non-breaking**: `--config ` is the preferred flag for passing a [YAML configuration file](../commands/trtllm-serve/trtllm-serve.html#configuring-with-yaml-files). +Existing workflows using `--extra_llm_api_options ` continue to work; it is an equivalent alias. + +Create a `config.yaml` file: + +```None +lora_config: + lora_target_modules: ['attn_q', 'attn_k', 'attn_v'] + max_lora_rank: 8 +``` + +### Starting the Server[#](#starting-the-server "Link to this heading") + +```None +python -m tensorrt_llm.commands.serve + /path/to/model \ + --config config.yaml +``` + +### Client Usage[#](#client-usage "Link to this heading") + +```None +import openai + +client = openai.OpenAI(base_url="http://localhost:8000/v1", api_key="dummy") + +response = client.completions.create( + model="/path/to/model", + prompt="What is the capital city of France?", + max_tokens=20, + extra_body={ + "lora_request": { + "lora_name": "lora-example-0", + "lora_int_id": 0, + "lora_path": "/path/to/lora_adapter" + } + }, +) +``` + +## TRTLLM bench with LORA[#](#trtllm-bench-with-lora "Link to this heading") + +### YAML Configuration[#](#id1 "Link to this heading") + +Note + +**Non-breaking**: `--config ` is the preferred flag for passing a [YAML configuration file](../commands/trtllm-serve/trtllm-serve.html#configuring-with-yaml-files). +Existing workflows using `--extra_llm_api_options ` continue to work; it is an equivalent alias. + +Create a `config.yaml` file: + +```None +lora_config: + lora_dir: + - /workspaces/tensorrt_llm/loras/0 + max_lora_rank: 64 + max_loras: 8 + max_cpu_loras: 8 + lora_target_modules: + - attn_q + - attn_k + - attn_v + trtllm_modules_to_hf_modules: + attn_q: q_proj + attn_k: k_proj + attn_v: v_proj +``` + +### Run trtllm-bench[#](#run-trtllm-bench "Link to this heading") + +```None +trtllm-bench --model $model_path throughput --dataset $dataset_path --config config.yaml --num_requests 64 --concurrency 16 +``` diff --git a/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc8.md b/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc8.md new file mode 100644 index 0000000000000000000000000000000000000000..8dfae921a3f97d68182f46bbf5c6a5bc26ba42b6 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/lora/lora_120rc8.md @@ -0,0 +1,243 @@ +# LoRA (Low-Rank Adaptation)# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc8/features/lora.html +Version: 1.2.0rc8 + +LoRA (Low-Rank Adaptation) is a parameter-efficient fine-tuning technique that enables adapting large language models to specific tasks without modifying the original model weights. Instead of fine-tuning all parameters, LoRA introduces small trainable rank decomposition matrices that are added to existing weights during inference. + +## Table of Contents[#](#table-of-contents "Link to this heading") + +1. [Background](#background) +2. [Basic Usage](#basic-usage) + + * [Single LoRA Adapter](#single-lora-adapter) + * [Multi-LoRA Support](#multi-lora-support) +3. [Advanced Usage](#advanced-usage) + + * [LoRA with Quantization](#lora-with-quantization) + * [NeMo LoRA Format](#nemo-lora-format) + * [Cache Management](#cache-management) +4. [TRTLLM serve with LoRA](#trtllm-serve-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Starting the Server](#starting-the-server) + * [Client Usage](#client-usage) +5. [TRTLLM bench with LORA](#trtllm-bench-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Run trtllm-bench](#run-trtllm-bench) + +## Background[#](#background "Link to this heading") + +The PyTorch backend provides LoRA support, allowing you to: + +* Load and apply multiple LoRA adapters simultaneously +* Switch between different adapters for different requests +* Use LoRA with quantized models +* Support both HuggingFace and NeMo LoRA formats + +## Basic Usage[#](#basic-usage "Link to this heading") + +### Single LoRA Adapter[#](#single-lora-adapter "Link to this heading") + +```None +from tensorrt_llm import LLM +from tensorrt_llm.lora_manager import LoraConfig +from tensorrt_llm.executor.request import LoRARequest +from tensorrt_llm.sampling_params import SamplingParams + +# Configure LoRA +lora_config = LoraConfig( + lora_dir=["/path/to/lora/adapter"], + max_lora_rank=8, + max_loras=1, + max_cpu_loras=1 +) + +# Initialize LLM with LoRA support +llm = LLM( + model="/path/to/base/model", + lora_config=lora_config +) + +# Create LoRA request +lora_request = LoRARequest("my-lora-task", 0, "/path/to/lora/adapter") + +# Generate with LoRA +prompts = ["Hello, how are you?"] +sampling_params = SamplingParams(max_tokens=50) + +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_request] +) +``` + +### Multi-LoRA Support[#](#multi-lora-support "Link to this heading") + +```None +# Configure for multiple LoRA adapters +lora_config = LoraConfig( + lora_target_modules=['attn_q', 'attn_k', 'attn_v'], + max_lora_rank=8, + max_loras=4, + max_cpu_loras=8 +) + +llm = LLM(model="/path/to/base/model", lora_config=lora_config) + +# Create multiple LoRA requests +lora_req1 = LoRARequest("task-1", 0, "/path/to/adapter1") +lora_req2 = LoRARequest("task-2", 1, "/path/to/adapter2") + +prompts = [ + "Translate to French: Hello world", + "Summarize: This is a long document..." +] + +# Apply different LoRAs to different prompts +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_req1, lora_req2] +) +``` + +## Advanced Usage[#](#advanced-usage "Link to this heading") + +### LoRA with Quantization[#](#lora-with-quantization "Link to this heading") + +```None +from tensorrt_llm.models.modeling_utils import QuantConfig +from tensorrt_llm.quantization.mode import QuantAlgo + +# Configure quantization +quant_config = QuantConfig( + quant_algo=QuantAlgo.FP8, + kv_cache_quant_algo=QuantAlgo.FP8 +) + +# LoRA works with quantized models +llm = LLM( + model="/path/to/model", + quant_config=quant_config, + lora_config=lora_config +) +``` + +### NeMo LoRA Format[#](#nemo-lora-format "Link to this heading") + +```None +# For NeMo-format LoRA checkpoints +lora_config = LoraConfig( + lora_dir=["/path/to/nemo/lora"], + lora_ckpt_source="nemo", + max_lora_rank=8 +) + +lora_request = LoRARequest( + "nemo-task", + 0, + "/path/to/nemo/lora", + lora_ckpt_source="nemo" +) +``` + +### Cache Management[#](#cache-management "Link to this heading") + +```None +from tensorrt_llm.llmapi.llm_args import PeftCacheConfig + +# Fine-tune cache sizes +peft_cache_config = PeftCacheConfig( + host_cache_size=1024*1024*1024, # 1GB CPU cache + device_cache_percent=0.1 # 10% of free GPU memory +) + +llm = LLM( + model="/path/to/model", + lora_config=lora_config, + peft_cache_config=peft_cache_config +) +``` + +## TRTLLM serve with LoRA[#](#trtllm-serve-with-lora "Link to this heading") + +### YAML Configuration[#](#yaml-configuration "Link to this heading") + +Note + +**Non-breaking**: `--config ` is the preferred flag for passing a [YAML configuration file](../commands/trtllm-serve/trtllm-serve.html#configuring-with-yaml-files). +Existing workflows using `--extra_llm_api_options ` continue to work; it is an equivalent alias. + +Create a `config.yaml` file: + +```None +lora_config: + lora_target_modules: ['attn_q', 'attn_k', 'attn_v'] + max_lora_rank: 8 +``` + +### Starting the Server[#](#starting-the-server "Link to this heading") + +```None +python -m tensorrt_llm.commands.serve + /path/to/model \ + --config config.yaml +``` + +### Client Usage[#](#client-usage "Link to this heading") + +```None +import openai + +client = openai.OpenAI(base_url="http://localhost:8000/v1", api_key="dummy") + +response = client.completions.create( + model="/path/to/model", + prompt="What is the capital city of France?", + max_tokens=20, + extra_body={ + "lora_request": { + "lora_name": "lora-example-0", + "lora_int_id": 0, + "lora_path": "/path/to/lora_adapter" + } + }, +) +``` + +## TRTLLM bench with LORA[#](#trtllm-bench-with-lora "Link to this heading") + +### YAML Configuration[#](#id1 "Link to this heading") + +Note + +**Non-breaking**: `--config ` is the preferred flag for passing a [YAML configuration file](../commands/trtllm-serve/trtllm-serve.html#configuring-with-yaml-files). +Existing workflows using `--extra_llm_api_options ` continue to work; it is an equivalent alias. + +Create a `config.yaml` file: + +```None +lora_config: + lora_dir: + - /workspaces/tensorrt_llm/loras/0 + max_lora_rank: 64 + max_loras: 8 + max_cpu_loras: 8 + lora_target_modules: + - attn_q + - attn_k + - attn_v + trtllm_modules_to_hf_modules: + attn_q: q_proj + attn_k: k_proj + attn_v: v_proj +``` + +### Run trtllm-bench[#](#run-trtllm-bench "Link to this heading") + +```None +trtllm-bench --model $model_path throughput --dataset $dataset_path --config config.yaml --num_requests 64 --concurrency 16 +``` diff --git a/corpus/docs/nvidia_tensorrt-llm/lora/lora_130rc0.md b/corpus/docs/nvidia_tensorrt-llm/lora/lora_130rc0.md new file mode 100644 index 0000000000000000000000000000000000000000..b2dfdefd9db58ce3e33e6f01c4dcee1fedb53963 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/lora/lora_130rc0.md @@ -0,0 +1,243 @@ +# LoRA (Low-Rank Adaptation)# + +Source: https://nvidia.github.io/TensorRT-LLM/1.3.0rc0/features/lora.html +Version: 1.3.0rc0 + +LoRA (Low-Rank Adaptation) is a parameter-efficient fine-tuning technique that enables adapting large language models to specific tasks without modifying the original model weights. Instead of fine-tuning all parameters, LoRA introduces small trainable rank decomposition matrices that are added to existing weights during inference. + +## Table of Contents[#](#table-of-contents "Link to this heading") + +1. [Background](#background) +2. [Basic Usage](#basic-usage) + + * [Single LoRA Adapter](#single-lora-adapter) + * [Multi-LoRA Support](#multi-lora-support) +3. [Advanced Usage](#advanced-usage) + + * [LoRA with Quantization](#lora-with-quantization) + * [NeMo LoRA Format](#nemo-lora-format) + * [Cache Management](#cache-management) +4. [TRTLLM serve with LoRA](#trtllm-serve-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Starting the Server](#starting-the-server) + * [Client Usage](#client-usage) +5. [TRTLLM bench with LORA](#trtllm-bench-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Run trtllm-bench](#run-trtllm-bench) + +## Background[#](#background "Link to this heading") + +The PyTorch backend provides LoRA support, allowing you to: + +* Load and apply multiple LoRA adapters simultaneously +* Switch between different adapters for different requests +* Use LoRA with quantized models +* Support both HuggingFace and NeMo LoRA formats + +## Basic Usage[#](#basic-usage "Link to this heading") + +### Single LoRA Adapter[#](#single-lora-adapter "Link to this heading") + +```None +from tensorrt_llm import LLM +from tensorrt_llm.lora_manager import LoraConfig +from tensorrt_llm.executor.request import LoRARequest +from tensorrt_llm.sampling_params import SamplingParams + +# Configure LoRA +lora_config = LoraConfig( + lora_dir=["/path/to/lora/adapter"], + max_lora_rank=8, + max_loras=1, + max_cpu_loras=1 +) + +# Initialize LLM with LoRA support +llm = LLM( + model="/path/to/base/model", + lora_config=lora_config +) + +# Create LoRA request +lora_request = LoRARequest("my-lora-task", 0, "/path/to/lora/adapter") + +# Generate with LoRA +prompts = ["Hello, how are you?"] +sampling_params = SamplingParams(max_tokens=50) + +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_request] +) +``` + +### Multi-LoRA Support[#](#multi-lora-support "Link to this heading") + +```None +# Configure for multiple LoRA adapters +lora_config = LoraConfig( + lora_target_modules=['attn_q', 'attn_k', 'attn_v'], + max_lora_rank=8, + max_loras=4, + max_cpu_loras=8 +) + +llm = LLM(model="/path/to/base/model", lora_config=lora_config) + +# Create multiple LoRA requests +lora_req1 = LoRARequest("task-1", 0, "/path/to/adapter1") +lora_req2 = LoRARequest("task-2", 1, "/path/to/adapter2") + +prompts = [ + "Translate to French: Hello world", + "Summarize: This is a long document..." +] + +# Apply different LoRAs to different prompts +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_req1, lora_req2] +) +``` + +## Advanced Usage[#](#advanced-usage "Link to this heading") + +### LoRA with Quantization[#](#lora-with-quantization "Link to this heading") + +```None +from tensorrt_llm.models.modeling_utils import QuantConfig +from tensorrt_llm.quantization.mode import QuantAlgo + +# Configure quantization +quant_config = QuantConfig( + quant_algo=QuantAlgo.FP8, + kv_cache_quant_algo=QuantAlgo.FP8 +) + +# LoRA works with quantized models +llm = LLM( + model="/path/to/model", + quant_config=quant_config, + lora_config=lora_config +) +``` + +### NeMo LoRA Format[#](#nemo-lora-format "Link to this heading") + +```None +# For NeMo-format LoRA checkpoints +lora_config = LoraConfig( + lora_dir=["/path/to/nemo/lora"], + lora_ckpt_source="nemo", + max_lora_rank=8 +) + +lora_request = LoRARequest( + "nemo-task", + 0, + "/path/to/nemo/lora", + lora_ckpt_source="nemo" +) +``` + +### Cache Management[#](#cache-management "Link to this heading") + +```None +from tensorrt_llm.llmapi.llm_args import PeftCacheConfig + +# Fine-tune cache sizes +peft_cache_config = PeftCacheConfig( + host_cache_size=1024*1024*1024, # 1GB CPU cache + device_cache_percent=0.1 # 10% of free GPU memory +) + +llm = LLM( + model="/path/to/model", + lora_config=lora_config, + peft_cache_config=peft_cache_config +) +``` + +## TRTLLM serve with LoRA[#](#trtllm-serve-with-lora "Link to this heading") + +### YAML Configuration[#](#yaml-configuration "Link to this heading") + +Note + +**Non-breaking**: `--config ` is the preferred flag for passing a [YAML configuration file](../commands/trtllm-serve/trtllm-serve.html#configuring-with-yaml-files). +Existing workflows using `--extra_llm_api_options ` continue to work; it is an equivalent alias. + +Create a `config.yaml` file: + +```None +lora_config: + lora_target_modules: ['attn_q', 'attn_k', 'attn_v'] + max_lora_rank: 8 +``` + +### Starting the Server[#](#starting-the-server "Link to this heading") + +```None +python -m tensorrt_llm.commands.serve + /path/to/model \ + --config config.yaml +``` + +### Client Usage[#](#client-usage "Link to this heading") + +```None +import openai + +client = openai.OpenAI(base_url="http://localhost:8000/v1", api_key="dummy") + +response = client.completions.create( + model="/path/to/model", + prompt="What is the capital city of France?", + max_tokens=20, + extra_body={ + "lora_request": { + "lora_name": "lora-example-0", + "lora_int_id": 0, + "lora_path": "/path/to/lora_adapter" + } + }, +) +``` + +## TRTLLM bench with LORA[#](#trtllm-bench-with-lora "Link to this heading") + +### YAML Configuration[#](#id1 "Link to this heading") + +Note + +**Non-breaking**: `--config ` is the preferred flag for passing a [YAML configuration file](../commands/trtllm-serve/trtllm-serve.html#configuring-with-yaml-files). +Existing workflows using `--extra_llm_api_options ` continue to work; it is an equivalent alias. + +Create a `config.yaml` file: + +```None +lora_config: + lora_dir: + - /workspaces/tensorrt_llm/loras/0 + max_lora_rank: 64 + max_loras: 8 + max_cpu_loras: 8 + lora_target_modules: + - attn_q + - attn_k + - attn_v + trtllm_modules_to_hf_modules: + attn_q: q_proj + attn_k: k_proj + attn_v: v_proj +``` + +### Run trtllm-bench[#](#run-trtllm-bench "Link to this heading") + +```None +trtllm-bench --model $model_path throughput --dataset $dataset_path --config config.yaml --num_requests 64 --concurrency 16 +``` diff --git a/corpus/docs/nvidia_tensorrt-llm/lora/lora_130rc1.md b/corpus/docs/nvidia_tensorrt-llm/lora/lora_130rc1.md new file mode 100644 index 0000000000000000000000000000000000000000..d06881332c472a3903682d6a0460d1373c23d858 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/lora/lora_130rc1.md @@ -0,0 +1,243 @@ +# LoRA (Low-Rank Adaptation)# + +Source: https://nvidia.github.io/TensorRT-LLM/1.3.0rc1/features/lora.html +Version: 1.3.0rc1 + +LoRA (Low-Rank Adaptation) is a parameter-efficient fine-tuning technique that enables adapting large language models to specific tasks without modifying the original model weights. Instead of fine-tuning all parameters, LoRA introduces small trainable rank decomposition matrices that are added to existing weights during inference. + +## Table of Contents[#](#table-of-contents "Link to this heading") + +1. [Background](#background) +2. [Basic Usage](#basic-usage) + + * [Single LoRA Adapter](#single-lora-adapter) + * [Multi-LoRA Support](#multi-lora-support) +3. [Advanced Usage](#advanced-usage) + + * [LoRA with Quantization](#lora-with-quantization) + * [NeMo LoRA Format](#nemo-lora-format) + * [Cache Management](#cache-management) +4. [TRTLLM serve with LoRA](#trtllm-serve-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Starting the Server](#starting-the-server) + * [Client Usage](#client-usage) +5. [TRTLLM bench with LORA](#trtllm-bench-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Run trtllm-bench](#run-trtllm-bench) + +## Background[#](#background "Link to this heading") + +The PyTorch backend provides LoRA support, allowing you to: + +* Load and apply multiple LoRA adapters simultaneously +* Switch between different adapters for different requests +* Use LoRA with quantized models +* Support both HuggingFace and NeMo LoRA formats + +## Basic Usage[#](#basic-usage "Link to this heading") + +### Single LoRA Adapter[#](#single-lora-adapter "Link to this heading") + +```None +from tensorrt_llm import LLM +from tensorrt_llm.lora_manager import LoraConfig +from tensorrt_llm.executor.request import LoRARequest +from tensorrt_llm.sampling_params import SamplingParams + +# Configure LoRA +lora_config = LoraConfig( + lora_dir=["/path/to/lora/adapter"], + max_lora_rank=8, + max_loras=1, + max_cpu_loras=1 +) + +# Initialize LLM with LoRA support +llm = LLM( + model="/path/to/base/model", + lora_config=lora_config +) + +# Create LoRA request +lora_request = LoRARequest("my-lora-task", 0, "/path/to/lora/adapter") + +# Generate with LoRA +prompts = ["Hello, how are you?"] +sampling_params = SamplingParams(max_tokens=50) + +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_request] +) +``` + +### Multi-LoRA Support[#](#multi-lora-support "Link to this heading") + +```None +# Configure for multiple LoRA adapters +lora_config = LoraConfig( + lora_target_modules=['attn_q', 'attn_k', 'attn_v'], + max_lora_rank=8, + max_loras=4, + max_cpu_loras=8 +) + +llm = LLM(model="/path/to/base/model", lora_config=lora_config) + +# Create multiple LoRA requests +lora_req1 = LoRARequest("task-1", 0, "/path/to/adapter1") +lora_req2 = LoRARequest("task-2", 1, "/path/to/adapter2") + +prompts = [ + "Translate to French: Hello world", + "Summarize: This is a long document..." +] + +# Apply different LoRAs to different prompts +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_req1, lora_req2] +) +``` + +## Advanced Usage[#](#advanced-usage "Link to this heading") + +### LoRA with Quantization[#](#lora-with-quantization "Link to this heading") + +```None +from tensorrt_llm.models.modeling_utils import QuantConfig +from tensorrt_llm.quantization.mode import QuantAlgo + +# Configure quantization +quant_config = QuantConfig( + quant_algo=QuantAlgo.FP8, + kv_cache_quant_algo=QuantAlgo.FP8 +) + +# LoRA works with quantized models +llm = LLM( + model="/path/to/model", + quant_config=quant_config, + lora_config=lora_config +) +``` + +### NeMo LoRA Format[#](#nemo-lora-format "Link to this heading") + +```None +# For NeMo-format LoRA checkpoints +lora_config = LoraConfig( + lora_dir=["/path/to/nemo/lora"], + lora_ckpt_source="nemo", + max_lora_rank=8 +) + +lora_request = LoRARequest( + "nemo-task", + 0, + "/path/to/nemo/lora", + lora_ckpt_source="nemo" +) +``` + +### Cache Management[#](#cache-management "Link to this heading") + +```None +from tensorrt_llm.llmapi.llm_args import PeftCacheConfig + +# Fine-tune cache sizes +peft_cache_config = PeftCacheConfig( + host_cache_size=1024*1024*1024, # 1GB CPU cache + device_cache_percent=0.1 # 10% of free GPU memory +) + +llm = LLM( + model="/path/to/model", + lora_config=lora_config, + peft_cache_config=peft_cache_config +) +``` + +## TRTLLM serve with LoRA[#](#trtllm-serve-with-lora "Link to this heading") + +### YAML Configuration[#](#yaml-configuration "Link to this heading") + +Note + +**Non-breaking**: `--config ` is the preferred flag for passing a [YAML configuration file](../commands/trtllm-serve/trtllm-serve.html#configuring-with-yaml-files). +Existing workflows using `--extra_llm_api_options ` continue to work; it is an equivalent alias. + +Create a `config.yaml` file: + +```None +lora_config: + lora_target_modules: ['attn_q', 'attn_k', 'attn_v'] + max_lora_rank: 8 +``` + +### Starting the Server[#](#starting-the-server "Link to this heading") + +```None +python -m tensorrt_llm.commands.serve + /path/to/model \ + --config config.yaml +``` + +### Client Usage[#](#client-usage "Link to this heading") + +```None +import openai + +client = openai.OpenAI(base_url="http://localhost:8000/v1", api_key="dummy") + +response = client.completions.create( + model="/path/to/model", + prompt="What is the capital city of France?", + max_tokens=20, + extra_body={ + "lora_request": { + "lora_name": "lora-example-0", + "lora_int_id": 0, + "lora_path": "/path/to/lora_adapter" + } + }, +) +``` + +## TRTLLM bench with LORA[#](#trtllm-bench-with-lora "Link to this heading") + +### YAML Configuration[#](#id1 "Link to this heading") + +Note + +**Non-breaking**: `--config ` is the preferred flag for passing a [YAML configuration file](../commands/trtllm-serve/trtllm-serve.html#configuring-with-yaml-files). +Existing workflows using `--extra_llm_api_options ` continue to work; it is an equivalent alias. + +Create a `config.yaml` file: + +```None +lora_config: + lora_dir: + - /workspaces/tensorrt_llm/loras/0 + max_lora_rank: 64 + max_loras: 8 + max_cpu_loras: 8 + lora_target_modules: + - attn_q + - attn_k + - attn_v + trtllm_modules_to_hf_modules: + attn_q: q_proj + attn_k: k_proj + attn_v: v_proj +``` + +### Run trtllm-bench[#](#run-trtllm-bench "Link to this heading") + +```None +trtllm-bench --model $model_path throughput --dataset $dataset_path --config config.yaml --num_requests 64 --concurrency 16 +``` diff --git a/corpus/docs/nvidia_tensorrt-llm/lora/lora_130rc2.md b/corpus/docs/nvidia_tensorrt-llm/lora/lora_130rc2.md new file mode 100644 index 0000000000000000000000000000000000000000..24532da38ee4222ccf408a6e8d87a3c60b26d70e --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/lora/lora_130rc2.md @@ -0,0 +1,243 @@ +# LoRA (Low-Rank Adaptation)# + +Source: https://nvidia.github.io/TensorRT-LLM/1.3.0rc2/features/lora.html +Version: 1.3.0rc2 + +LoRA (Low-Rank Adaptation) is a parameter-efficient fine-tuning technique that enables adapting large language models to specific tasks without modifying the original model weights. Instead of fine-tuning all parameters, LoRA introduces small trainable rank decomposition matrices that are added to existing weights during inference. + +## Table of Contents[#](#table-of-contents "Link to this heading") + +1. [Background](#background) +2. [Basic Usage](#basic-usage) + + * [Single LoRA Adapter](#single-lora-adapter) + * [Multi-LoRA Support](#multi-lora-support) +3. [Advanced Usage](#advanced-usage) + + * [LoRA with Quantization](#lora-with-quantization) + * [NeMo LoRA Format](#nemo-lora-format) + * [Cache Management](#cache-management) +4. [TRTLLM serve with LoRA](#trtllm-serve-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Starting the Server](#starting-the-server) + * [Client Usage](#client-usage) +5. [TRTLLM bench with LORA](#trtllm-bench-with-lora) + + * [YAML Configuration](#yaml-configuration) + * [Run trtllm-bench](#run-trtllm-bench) + +## Background[#](#background "Link to this heading") + +The PyTorch backend provides LoRA support, allowing you to: + +* Load and apply multiple LoRA adapters simultaneously +* Switch between different adapters for different requests +* Use LoRA with quantized models +* Support both HuggingFace and NeMo LoRA formats + +## Basic Usage[#](#basic-usage "Link to this heading") + +### Single LoRA Adapter[#](#single-lora-adapter "Link to this heading") + +```None +from tensorrt_llm import LLM +from tensorrt_llm.lora_manager import LoraConfig +from tensorrt_llm.executor.request import LoRARequest +from tensorrt_llm.sampling_params import SamplingParams + +# Configure LoRA +lora_config = LoraConfig( + lora_dir=["/path/to/lora/adapter"], + max_lora_rank=8, + max_loras=1, + max_cpu_loras=1 +) + +# Initialize LLM with LoRA support +llm = LLM( + model="/path/to/base/model", + lora_config=lora_config +) + +# Create LoRA request +lora_request = LoRARequest("my-lora-task", 0, "/path/to/lora/adapter") + +# Generate with LoRA +prompts = ["Hello, how are you?"] +sampling_params = SamplingParams(max_tokens=50) + +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_request] +) +``` + +### Multi-LoRA Support[#](#multi-lora-support "Link to this heading") + +```None +# Configure for multiple LoRA adapters +lora_config = LoraConfig( + lora_target_modules=['attn_q', 'attn_k', 'attn_v'], + max_lora_rank=8, + max_loras=4, + max_cpu_loras=8 +) + +llm = LLM(model="/path/to/base/model", lora_config=lora_config) + +# Create multiple LoRA requests +lora_req1 = LoRARequest("task-1", 0, "/path/to/adapter1") +lora_req2 = LoRARequest("task-2", 1, "/path/to/adapter2") + +prompts = [ + "Translate to French: Hello world", + "Summarize: This is a long document..." +] + +# Apply different LoRAs to different prompts +outputs = llm.generate( + prompts, + sampling_params, + lora_request=[lora_req1, lora_req2] +) +``` + +## Advanced Usage[#](#advanced-usage "Link to this heading") + +### LoRA with Quantization[#](#lora-with-quantization "Link to this heading") + +```None +from tensorrt_llm.models.modeling_utils import QuantConfig +from tensorrt_llm.quantization.mode import QuantAlgo + +# Configure quantization +quant_config = QuantConfig( + quant_algo=QuantAlgo.FP8, + kv_cache_quant_algo=QuantAlgo.FP8 +) + +# LoRA works with quantized models +llm = LLM( + model="/path/to/model", + quant_config=quant_config, + lora_config=lora_config +) +``` + +### NeMo LoRA Format[#](#nemo-lora-format "Link to this heading") + +```None +# For NeMo-format LoRA checkpoints +lora_config = LoraConfig( + lora_dir=["/path/to/nemo/lora"], + lora_ckpt_source="nemo", + max_lora_rank=8 +) + +lora_request = LoRARequest( + "nemo-task", + 0, + "/path/to/nemo/lora", + lora_ckpt_source="nemo" +) +``` + +### Cache Management[#](#cache-management "Link to this heading") + +```None +from tensorrt_llm.llmapi.llm_args import PeftCacheConfig + +# Fine-tune cache sizes +peft_cache_config = PeftCacheConfig( + host_cache_size=1024*1024*1024, # 1GB CPU cache + device_cache_percent=0.1 # 10% of free GPU memory +) + +llm = LLM( + model="/path/to/model", + lora_config=lora_config, + peft_cache_config=peft_cache_config +) +``` + +## TRTLLM serve with LoRA[#](#trtllm-serve-with-lora "Link to this heading") + +### YAML Configuration[#](#yaml-configuration "Link to this heading") + +Note + +**Non-breaking**: `--config ` is the preferred flag for passing a [YAML configuration file](../commands/trtllm-serve/trtllm-serve.html#configuring-with-yaml-files). +Existing workflows using `--extra_llm_api_options ` continue to work; it is an equivalent alias. + +Create a `config.yaml` file: + +```None +lora_config: + lora_target_modules: ['attn_q', 'attn_k', 'attn_v'] + max_lora_rank: 8 +``` + +### Starting the Server[#](#starting-the-server "Link to this heading") + +```None +python -m tensorrt_llm.commands.serve + /path/to/model \ + --config config.yaml +``` + +### Client Usage[#](#client-usage "Link to this heading") + +```None +import openai + +client = openai.OpenAI(base_url="http://localhost:8000/v1", api_key="dummy") + +response = client.completions.create( + model="/path/to/model", + prompt="What is the capital city of France?", + max_tokens=20, + extra_body={ + "lora_request": { + "lora_name": "lora-example-0", + "lora_int_id": 0, + "lora_path": "/path/to/lora_adapter" + } + }, +) +``` + +## TRTLLM bench with LORA[#](#trtllm-bench-with-lora "Link to this heading") + +### YAML Configuration[#](#id1 "Link to this heading") + +Note + +**Non-breaking**: `--config ` is the preferred flag for passing a [YAML configuration file](../commands/trtllm-serve/trtllm-serve.html#configuring-with-yaml-files). +Existing workflows using `--extra_llm_api_options ` continue to work; it is an equivalent alias. + +Create a `config.yaml` file: + +```None +lora_config: + lora_dir: + - /workspaces/tensorrt_llm/loras/0 + max_lora_rank: 64 + max_loras: 8 + max_cpu_loras: 8 + lora_target_modules: + - attn_q + - attn_k + - attn_v + trtllm_modules_to_hf_modules: + attn_q: q_proj + attn_k: k_proj + attn_v: v_proj +``` + +### Run trtllm-bench[#](#run-trtllm-bench "Link to this heading") + +```None +trtllm-bench --model $model_path throughput --dataset $dataset_path --config config.yaml --num_requests 64 --concurrency 16 +``` diff --git a/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_100.md b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_100.md new file mode 100644 index 0000000000000000000000000000000000000000..dfc5542fce513f1335ec0fb2d25dd628c8268164 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_100.md @@ -0,0 +1,111 @@ +# Quantization# + +Source: https://nvidia.github.io/TensorRT-LLM/1.0.0/features/quantization.html +Version: 1.0.0 + +## Quantization in TensorRT LLM[#](#quantization-in-tensorrt-llm "Link to this heading") + +Quantization is a technique used to reduce memory footprint and computational cost by converting the model’s weights and/or activations from high-precision floating-point numbers (like BF16) to lower-precision data types, such as INT8, FP8, or FP4. + +TensorRT LLM offers a variety of quantization recipes to optimize LLM inference. These recipes can be broadly categorized as follows: + +* FP4 +* FP8 Per Tensor +* FP8 Block Scaling +* FP8 Rowwise +* FP8 KV Cache +* W4A16 GPTQ +* W4A8 GPTQ +* W4A16 AWQ +* W4A8 AWQ + +## Usage[#](#usage "Link to this heading") + +The default PyTorch backend supports FP4 and FP8 quantization on the latest Blackwell and Hopper GPUs. + +### Running Pre-quantized Models[#](#running-pre-quantized-models "Link to this heading") + +TensorRT LLM can directly run [pre-quantized models](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) generated with the [NVIDIA TensorRT Model Optimizer](https://github.com/NVIDIA/TensorRT-Model-Optimizer). + +```None +from tensorrt_llm import LLM +llm = LLM(model='nvidia/Llama-3.1-8B-Instruct-FP8') +llm.generate("Hello, my name is") +``` + +#### FP8 KV Cache[#](#fp8-kv-cache "Link to this heading") + +Note + +TensorRT LLM allows you to enable the FP8 KV cache manually, even for checkpoints that do not have it enabled by default. + +Here is an example of how to set the FP8 KV Cache option: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='fp8')) +llm.generate("Hello, my name is") +``` + +### Offline Quantization with ModelOpt[#](#offline-quantization-with-modelopt "Link to this heading") + +If a pre-quantized model is not available on the [Hugging Face Hub](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4), you can quantize it offline using ModelOpt. + +Follow this step-by-step guide to quantize a model: + +```None +git clone https://github.com/NVIDIA/TensorRT-Model-Optimizer.git +cd TensorRT-Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 --export_fmt hf +``` + +## Model Supported Matrix[#](#model-supported-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| BERT | . | . | . | . | . | Y | . | . | . | . | +| DeepSeek-R1 | Y | . | . | Y | . | Y | . | . | . | . | +| EXAONE | . | . | Y | . | . | Y | Y | Y | . | . | +| Gemma 3 | . | . | Y | . | . | Y | Y | Y | . | . | +| GPT-OSS | . | Y | . | . | . | Y | . | . | . | . | +| LLaMA | Y | . | Y | . | . | Y | . | Y | . | Y | +| LLaMA-v2 | Y | . | Y | . | . | Y | Y | Y | . | Y | +| LLaMA 3 | . | . | . | . | Y | Y | Y | . | . | . | +| LLaMA 4 | Y | . | Y | . | . | Y | . | . | . | . | +| Mistral | . | . | Y | . | . | Y | . | Y | . | . | +| Mixtral | Y | . | Y | . | . | Y | . | . | . | . | +| Phi | . | . | . | . | . | Y | Y | . | . | . | +| Qwen | . | . | . | . | . | Y | Y | Y | . | Y | +| Qwen-2/2.5 | Y | . | Y | . | . | Y | Y | Y | . | Y | +| Qwen-3 | Y | . | Y | . | . | Y | . | Y | . | Y | +| BLIP2-OPT | . | . | . | . | . | Y | . | . | . | . | +| BLIP2-T5 | . | . | . | . | . | Y | . | . | . | . | +| LLaVA | . | . | Y | . | . | Y | . | Y | . | Y | +| VILA | . | . | Y | . | . | Y | . | Y | . | Y | +| Nougat | . | . | . | . | . | Y | . | . | . | . | + +Note + +The vision component of multi-modal models(BLIP2-OPT/BLIP2-T5/LLaVA/VILA/Nougat) uses FP16 by default. +The language component decides which quantization methods are supported by a given multi-modal model. + +## Hardware Support Matrix[#](#hardware-support-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| Blackwell(sm120) | Y | Y | Y | . | . | Y | . | . | . | . | +| Blackwell(sm100) | Y | Y | Y | Y | . | Y | . | . | . | . | +| Hopper | . | . | Y | Y | Y | Y | Y | Y | Y | Y | +| Ada Lovelace | . | . | Y | . | . | Y | Y | Y | Y | Y | +| Ampere | . | . | . | . | . | Y | . | Y | . | Y | + +Note + +FP8 block wise scaling GEMM kernels for sm100 are using MXFP8 recipe (E4M3 act/weight and UE8M0 act/weight scale), which is slightly different from SM90 FP8 recipe (E4M3 act/weight and FP32 act/weight scale). + +## Quick Links[#](#quick-links "Link to this heading") + +* [Pre-quantized Models by ModelOpt](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) +* [ModelOpt Support Matrix](https://nvidia.github.io/TensorRT-Model-Optimizer/guides/0_support_matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_110.md b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_110.md new file mode 100644 index 0000000000000000000000000000000000000000..dc6cfdb5465c6137fb5c4c85c8b683eb97938938 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_110.md @@ -0,0 +1,111 @@ +# Quantization# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0/features/quantization.html +Version: 1.1.0 + +## Quantization in TensorRT LLM[#](#quantization-in-tensorrt-llm "Link to this heading") + +Quantization is a technique used to reduce memory footprint and computational cost by converting the model’s weights and/or activations from high-precision floating-point numbers (like BF16) to lower-precision data types, such as INT8, FP8, or FP4. + +TensorRT LLM offers a variety of quantization recipes to optimize LLM inference. These recipes can be broadly categorized as follows: + +* FP4 +* FP8 Per Tensor +* FP8 Block Scaling +* FP8 Rowwise +* FP8 KV Cache +* W4A16 GPTQ +* W4A8 GPTQ +* W4A16 AWQ +* W4A8 AWQ + +## Usage[#](#usage "Link to this heading") + +The default PyTorch backend supports FP4 and FP8 quantization on the latest Blackwell and Hopper GPUs. + +### Running Pre-quantized Models[#](#running-pre-quantized-models "Link to this heading") + +TensorRT LLM can directly run [pre-quantized models](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) generated with the [NVIDIA Model Optimizer](https://github.com/NVIDIA/Model-Optimizer). + +```None +from tensorrt_llm import LLM +llm = LLM(model='nvidia/Llama-3.1-8B-Instruct-FP8') +llm.generate("Hello, my name is") +``` + +#### FP8 KV Cache[#](#fp8-kv-cache "Link to this heading") + +Note + +TensorRT LLM allows you to enable the FP8 KV cache manually, even for checkpoints that do not have it enabled by default. + +Here is an example of how to set the FP8 KV Cache option: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='fp8')) +llm.generate("Hello, my name is") +``` + +### Offline Quantization with ModelOpt[#](#offline-quantization-with-modelopt "Link to this heading") + +If a pre-quantized model is not available on the [Hugging Face Hub](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4), you can quantize it offline using ModelOpt. + +Follow this step-by-step guide to quantize a model: + +```None +git clone https://github.com/NVIDIA/TensorRT-Model-Optimizer.git +cd TensorRT-Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 --export_fmt hf +``` + +## Model Supported Matrix[#](#model-supported-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| BERT | . | . | . | . | . | Y | . | . | . | . | +| DeepSeek-R1 | Y | . | . | Y | . | Y | . | . | . | . | +| EXAONE | . | . | Y | . | . | Y | Y | Y | . | . | +| Gemma 3 | . | . | Y | . | . | Y | Y | Y | . | . | +| GPT-OSS | . | Y | . | . | . | Y | . | . | . | . | +| LLaMA | Y | . | Y | . | . | Y | . | Y | . | Y | +| LLaMA-v2 | Y | . | Y | . | . | Y | Y | Y | . | Y | +| LLaMA 3 | . | . | . | . | Y | Y | Y | . | . | . | +| LLaMA 4 | Y | . | Y | . | . | Y | . | . | . | . | +| Mistral | . | . | Y | . | . | Y | . | Y | . | . | +| Mixtral | Y | . | Y | . | . | Y | . | . | . | . | +| Phi | . | . | . | . | . | Y | Y | . | . | . | +| Qwen | . | . | . | . | . | Y | Y | Y | . | Y | +| Qwen-2/2.5 | Y | . | Y | . | . | Y | Y | Y | . | Y | +| Qwen-3 | Y | . | Y | . | . | Y | . | Y | . | Y | +| BLIP2-OPT | . | . | . | . | . | Y | . | . | . | . | +| BLIP2-T5 | . | . | . | . | . | Y | . | . | . | . | +| LLaVA | . | . | Y | . | . | Y | . | Y | . | Y | +| VILA | . | . | Y | . | . | Y | . | Y | . | Y | +| Nougat | . | . | . | . | . | Y | . | . | . | . | + +Note + +The vision component of multi-modal models(BLIP2-OPT/BLIP2-T5/LLaVA/VILA/Nougat) uses FP16 by default. +The language component decides which quantization methods are supported by a given multi-modal model. + +## Hardware Support Matrix[#](#hardware-support-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| Blackwell(sm120) | Y | Y | Y | . | . | Y | . | . | . | . | +| Blackwell(sm100/103) | Y | Y | Y | Y | . | Y | . | . | . | . | +| Hopper | . | . | Y | Y | Y | Y | Y | Y | Y | Y | +| Ada Lovelace | . | . | Y | . | . | Y | Y | Y | Y | Y | +| Ampere | . | . | . | . | . | Y | . | Y | . | Y | + +Note + +FP8 block wise scaling GEMM kernels for sm100/103 are using MXFP8 recipe (E4M3 act/weight and UE8M0 act/weight scale), which is slightly different from SM90 FP8 recipe (E4M3 act/weight and FP32 act/weight scale). + +## Quick Links[#](#quick-links "Link to this heading") + +* [Pre-quantized Models by ModelOpt](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) +* [ModelOpt Support Matrix](https://nvidia.github.io/Model-Optimizer/guides/0_support_matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_110rc4.md b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_110rc4.md new file mode 100644 index 0000000000000000000000000000000000000000..62c6e82af2f403a66488edd2f73810cb7822b324 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_110rc4.md @@ -0,0 +1,111 @@ +# Quantization# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0rc4/features/quantization.html +Version: 1.1.0rc4 + +## Quantization in TensorRT LLM[#](#quantization-in-tensorrt-llm "Link to this heading") + +Quantization is a technique used to reduces memory footprint and computational cost by converting the model’s weights and/or activations from high-precision floating-point numbers (like BF16) to lower-precision data types, such as INT8, FP8, or FP4. + +TensorRT LLM offers a variety of quantization recipes to optimize LLM inference. These recipes can be broadly categorized as follows: + +* FP4 +* FP8 Per Tensor +* FP8 Block Scaling +* FP8 Rowwise +* FP8 KV Cache +* W4A16 GPTQ +* W4A8 GPTQ +* W4A16 AWQ +* W4A8 AWQ + +## Usage[#](#usage "Link to this heading") + +The default PyTorch backend supports FP4 and FP8 quantization on the latest Blackwell and Hopper GPUs. + +### Running Pre-quantized Models[#](#running-pre-quantized-models "Link to this heading") + +TensorRT LLM can directly run [pre-quantized models](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) generated with the [NVIDIA TensorRT Model Optimizer](https://github.com/NVIDIA/TensorRT-Model-Optimizer). + +```None +from tensorrt_llm import LLM +llm = LLM(model='nvidia/Llama-3.1-8B-Instruct-FP8') +llm.generate("Hello, my name is") +``` + +#### FP8 KV Cache[#](#fp8-kv-cache "Link to this heading") + +Note + +TensorRT LLM allows you to enable the FP8 KV cache manually, even for checkpoints that do not have it enabled by default. + +Here is an example of how to set the FP8 KV Cache option: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='fp8')) +llm.generate("Hello, my name is") +``` + +### Offline Quantization with ModelOpt[#](#offline-quantization-with-modelopt "Link to this heading") + +If a pre-quantized model is not available on the [Hugging Face Hub](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4), you can quantize it offline using ModelOpt. + +Follow this step-by-step guide to quantize a model: + +```None +git clone https://github.com/NVIDIA/TensorRT-Model-Optimizer.git +cd TensorRT-Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 --export_fmt hf +``` + +## Model Supported Matrix[#](#model-supported-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| BERT | . | . | . | . | . | Y | . | . | . | . | +| DeepSeek-R1 | Y | . | . | Y | . | Y | . | . | . | . | +| EXAONE | . | . | Y | . | . | Y | Y | Y | . | . | +| Gemma 3 | . | . | Y | . | . | Y | Y | Y | . | . | +| GPT-OSS | . | Y | . | . | . | Y | . | . | . | . | +| LLaMA | Y | . | Y | . | . | Y | . | Y | . | Y | +| LLaMA-v2 | Y | . | Y | . | . | Y | Y | Y | . | Y | +| LLaMA 3 | . | . | . | . | Y | Y | Y | . | . | . | +| LLaMA 4 | Y | . | Y | . | . | Y | . | . | . | . | +| Mistral | . | . | Y | . | . | Y | . | Y | . | . | +| Mixtral | Y | . | Y | . | . | Y | . | . | . | . | +| Phi | . | . | . | . | . | Y | Y | . | . | . | +| Qwen | . | . | . | . | . | Y | Y | Y | . | Y | +| Qwen-2/2.5 | Y | . | Y | . | . | Y | Y | Y | . | Y | +| Qwen-3 | Y | . | Y | . | . | Y | . | Y | . | Y | +| BLIP2-OPT | . | . | . | . | . | Y | . | . | . | . | +| BLIP2-T5 | . | . | . | . | . | Y | . | . | . | . | +| LLaVA | . | . | Y | . | . | Y | . | Y | . | Y | +| VILA | . | . | Y | . | . | Y | . | Y | . | Y | +| Nougat | . | . | . | . | . | Y | . | . | . | . | + +Note + +The vision component of multi-modal models(BLIP2-OPT/BLIP2-T5/LLaVA/VILA/Nougat) uses FP16 by default. +The language component decides which quantization methods are supported by a given multi-modal model. + +## Hardware Support Matrix[#](#hardware-support-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| Blackwell(sm120) | Y | Y | Y | . | . | Y | . | . | . | . | +| Blackwell(sm100) | Y | Y | Y | Y | . | Y | . | . | . | . | +| Hopper | . | . | Y | Y | Y | Y | Y | Y | Y | Y | +| Ada Lovelace | . | . | Y | . | . | Y | Y | Y | Y | Y | +| Ampere | . | . | . | . | . | Y | . | Y | . | Y | + +Note + +FP8 block wise scaling GEMM kernels for sm100 are using MXFP8 recipe (E4M3 act/weight and UE8M0 act/weight scale), which is slightly different from SM90 FP8 recipe (E4M3 act/weight and FP32 act/weight scale). + +## Quick Links[#](#quick-links "Link to this heading") + +* [Pre-quantized Models by ModelOpt](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) +* [ModelOpt Support Matrix](https://nvidia.github.io/TensorRT-Model-Optimizer/guides/0_support_matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_110rc5.md b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_110rc5.md new file mode 100644 index 0000000000000000000000000000000000000000..a9661a21d9d2359f7d8f10fe7e0788868f58e639 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_110rc5.md @@ -0,0 +1,111 @@ +# Quantization# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0rc5/features/quantization.html +Version: 1.1.0rc5 + +## Quantization in TensorRT LLM[#](#quantization-in-tensorrt-llm "Link to this heading") + +Quantization is a technique used to reduces memory footprint and computational cost by converting the model’s weights and/or activations from high-precision floating-point numbers (like BF16) to lower-precision data types, such as INT8, FP8, or FP4. + +TensorRT LLM offers a variety of quantization recipes to optimize LLM inference. These recipes can be broadly categorized as follows: + +* FP4 +* FP8 Per Tensor +* FP8 Block Scaling +* FP8 Rowwise +* FP8 KV Cache +* W4A16 GPTQ +* W4A8 GPTQ +* W4A16 AWQ +* W4A8 AWQ + +## Usage[#](#usage "Link to this heading") + +The default PyTorch backend supports FP4 and FP8 quantization on the latest Blackwell and Hopper GPUs. + +### Running Pre-quantized Models[#](#running-pre-quantized-models "Link to this heading") + +TensorRT LLM can directly run [pre-quantized models](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) generated with the [NVIDIA TensorRT Model Optimizer](https://github.com/NVIDIA/TensorRT-Model-Optimizer). + +```None +from tensorrt_llm import LLM +llm = LLM(model='nvidia/Llama-3.1-8B-Instruct-FP8') +llm.generate("Hello, my name is") +``` + +#### FP8 KV Cache[#](#fp8-kv-cache "Link to this heading") + +Note + +TensorRT LLM allows you to enable the FP8 KV cache manually, even for checkpoints that do not have it enabled by default. + +Here is an example of how to set the FP8 KV Cache option: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='fp8')) +llm.generate("Hello, my name is") +``` + +### Offline Quantization with ModelOpt[#](#offline-quantization-with-modelopt "Link to this heading") + +If a pre-quantized model is not available on the [Hugging Face Hub](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4), you can quantize it offline using ModelOpt. + +Follow this step-by-step guide to quantize a model: + +```None +git clone https://github.com/NVIDIA/TensorRT-Model-Optimizer.git +cd TensorRT-Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 --export_fmt hf +``` + +## Model Supported Matrix[#](#model-supported-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| BERT | . | . | . | . | . | Y | . | . | . | . | +| DeepSeek-R1 | Y | . | . | Y | . | Y | . | . | . | . | +| EXAONE | . | . | Y | . | . | Y | Y | Y | . | . | +| Gemma 3 | . | . | Y | . | . | Y | Y | Y | . | . | +| GPT-OSS | . | Y | . | . | . | Y | . | . | . | . | +| LLaMA | Y | . | Y | . | . | Y | . | Y | . | Y | +| LLaMA-v2 | Y | . | Y | . | . | Y | Y | Y | . | Y | +| LLaMA 3 | . | . | . | . | Y | Y | Y | . | . | . | +| LLaMA 4 | Y | . | Y | . | . | Y | . | . | . | . | +| Mistral | . | . | Y | . | . | Y | . | Y | . | . | +| Mixtral | Y | . | Y | . | . | Y | . | . | . | . | +| Phi | . | . | . | . | . | Y | Y | . | . | . | +| Qwen | . | . | . | . | . | Y | Y | Y | . | Y | +| Qwen-2/2.5 | Y | . | Y | . | . | Y | Y | Y | . | Y | +| Qwen-3 | Y | . | Y | . | . | Y | . | Y | . | Y | +| BLIP2-OPT | . | . | . | . | . | Y | . | . | . | . | +| BLIP2-T5 | . | . | . | . | . | Y | . | . | . | . | +| LLaVA | . | . | Y | . | . | Y | . | Y | . | Y | +| VILA | . | . | Y | . | . | Y | . | Y | . | Y | +| Nougat | . | . | . | . | . | Y | . | . | . | . | + +Note + +The vision component of multi-modal models(BLIP2-OPT/BLIP2-T5/LLaVA/VILA/Nougat) uses FP16 by default. +The language component decides which quantization methods are supported by a given multi-modal model. + +## Hardware Support Matrix[#](#hardware-support-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| Blackwell(sm120) | Y | Y | Y | . | . | Y | . | . | . | . | +| Blackwell(sm100) | Y | Y | Y | Y | . | Y | . | . | . | . | +| Hopper | . | . | Y | Y | Y | Y | Y | Y | Y | Y | +| Ada Lovelace | . | . | Y | . | . | Y | Y | Y | Y | Y | +| Ampere | . | . | . | . | . | Y | . | Y | . | Y | + +Note + +FP8 block wise scaling GEMM kernels for sm100 are using MXFP8 recipe (E4M3 act/weight and UE8M0 act/weight scale), which is slightly different from SM90 FP8 recipe (E4M3 act/weight and FP32 act/weight scale). + +## Quick Links[#](#quick-links "Link to this heading") + +* [Pre-quantized Models by ModelOpt](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) +* [ModelOpt Support Matrix](https://nvidia.github.io/TensorRT-Model-Optimizer/guides/0_support_matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc0.md b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc0.md new file mode 100644 index 0000000000000000000000000000000000000000..c850a843b540f0384ac5bb353278a3b1800821ee --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc0.md @@ -0,0 +1,111 @@ +# Quantization# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc0/features/quantization.html +Version: 1.2.0rc0 + +## Quantization in TensorRT LLM[#](#quantization-in-tensorrt-llm "Link to this heading") + +Quantization is a technique used to reduce memory footprint and computational cost by converting the model’s weights and/or activations from high-precision floating-point numbers (like BF16) to lower-precision data types, such as INT8, FP8, or FP4. + +TensorRT LLM offers a variety of quantization recipes to optimize LLM inference. These recipes can be broadly categorized as follows: + +* FP4 +* FP8 Per Tensor +* FP8 Block Scaling +* FP8 Rowwise +* FP8 KV Cache +* W4A16 GPTQ +* W4A8 GPTQ +* W4A16 AWQ +* W4A8 AWQ + +## Usage[#](#usage "Link to this heading") + +The default PyTorch backend supports FP4 and FP8 quantization on the latest Blackwell and Hopper GPUs. + +### Running Pre-quantized Models[#](#running-pre-quantized-models "Link to this heading") + +TensorRT LLM can directly run [pre-quantized models](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) generated with the [NVIDIA TensorRT Model Optimizer](https://github.com/NVIDIA/TensorRT-Model-Optimizer). + +```None +from tensorrt_llm import LLM +llm = LLM(model='nvidia/Llama-3.1-8B-Instruct-FP8') +llm.generate("Hello, my name is") +``` + +#### FP8 KV Cache[#](#fp8-kv-cache "Link to this heading") + +Note + +TensorRT LLM allows you to enable the FP8 KV cache manually, even for checkpoints that do not have it enabled by default. + +Here is an example of how to set the FP8 KV Cache option: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='fp8')) +llm.generate("Hello, my name is") +``` + +### Offline Quantization with ModelOpt[#](#offline-quantization-with-modelopt "Link to this heading") + +If a pre-quantized model is not available on the [Hugging Face Hub](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4), you can quantize it offline using ModelOpt. + +Follow this step-by-step guide to quantize a model: + +```None +git clone https://github.com/NVIDIA/TensorRT-Model-Optimizer.git +cd TensorRT-Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 --export_fmt hf +``` + +## Model Supported Matrix[#](#model-supported-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| BERT | . | . | . | . | . | Y | . | . | . | . | +| DeepSeek-R1 | Y | . | . | Y | . | Y | . | . | . | . | +| EXAONE | . | . | Y | . | . | Y | Y | Y | . | . | +| Gemma 3 | . | . | Y | . | . | Y | Y | Y | . | . | +| GPT-OSS | . | Y | . | . | . | Y | . | . | . | . | +| LLaMA | Y | . | Y | . | . | Y | . | Y | . | Y | +| LLaMA-v2 | Y | . | Y | . | . | Y | Y | Y | . | Y | +| LLaMA 3 | . | . | . | . | Y | Y | Y | . | . | . | +| LLaMA 4 | Y | . | Y | . | . | Y | . | . | . | . | +| Mistral | . | . | Y | . | . | Y | . | Y | . | . | +| Mixtral | Y | . | Y | . | . | Y | . | . | . | . | +| Phi | . | . | . | . | . | Y | Y | . | . | . | +| Qwen | . | . | . | . | . | Y | Y | Y | . | Y | +| Qwen-2/2.5 | Y | . | Y | . | . | Y | Y | Y | . | Y | +| Qwen-3 | Y | . | Y | . | . | Y | . | Y | . | Y | +| BLIP2-OPT | . | . | . | . | . | Y | . | . | . | . | +| BLIP2-T5 | . | . | . | . | . | Y | . | . | . | . | +| LLaVA | . | . | Y | . | . | Y | . | Y | . | Y | +| VILA | . | . | Y | . | . | Y | . | Y | . | Y | +| Nougat | . | . | . | . | . | Y | . | . | . | . | + +Note + +The vision component of multi-modal models(BLIP2-OPT/BLIP2-T5/LLaVA/VILA/Nougat) uses FP16 by default. +The language component decides which quantization methods are supported by a given multi-modal model. + +## Hardware Support Matrix[#](#hardware-support-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| Blackwell(sm120) | Y | Y | Y | . | . | Y | . | . | . | . | +| Blackwell(sm100) | Y | Y | Y | Y | . | Y | . | . | . | . | +| Hopper | . | . | Y | Y | Y | Y | Y | Y | Y | Y | +| Ada Lovelace | . | . | Y | . | . | Y | Y | Y | Y | Y | +| Ampere | . | . | . | . | . | Y | . | Y | . | Y | + +Note + +FP8 block wise scaling GEMM kernels for sm100 are using MXFP8 recipe (E4M3 act/weight and UE8M0 act/weight scale), which is slightly different from SM90 FP8 recipe (E4M3 act/weight and FP32 act/weight scale). + +## Quick Links[#](#quick-links "Link to this heading") + +* [Pre-quantized Models by ModelOpt](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) +* [ModelOpt Support Matrix](https://nvidia.github.io/TensorRT-Model-Optimizer/guides/0_support_matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc1.md b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc1.md new file mode 100644 index 0000000000000000000000000000000000000000..51e39f0fed9b43432d0787d83465a3d07e043a3b --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc1.md @@ -0,0 +1,111 @@ +# Quantization# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc1/features/quantization.html +Version: 1.2.0rc1 + +## Quantization in TensorRT LLM[#](#quantization-in-tensorrt-llm "Link to this heading") + +Quantization is a technique used to reduce memory footprint and computational cost by converting the model’s weights and/or activations from high-precision floating-point numbers (like BF16) to lower-precision data types, such as INT8, FP8, or FP4. + +TensorRT LLM offers a variety of quantization recipes to optimize LLM inference. These recipes can be broadly categorized as follows: + +* FP4 +* FP8 Per Tensor +* FP8 Block Scaling +* FP8 Rowwise +* FP8 KV Cache +* W4A16 GPTQ +* W4A8 GPTQ +* W4A16 AWQ +* W4A8 AWQ + +## Usage[#](#usage "Link to this heading") + +The default PyTorch backend supports FP4 and FP8 quantization on the latest Blackwell and Hopper GPUs. + +### Running Pre-quantized Models[#](#running-pre-quantized-models "Link to this heading") + +TensorRT LLM can directly run [pre-quantized models](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) generated with the [NVIDIA TensorRT Model Optimizer](https://github.com/NVIDIA/TensorRT-Model-Optimizer). + +```None +from tensorrt_llm import LLM +llm = LLM(model='nvidia/Llama-3.1-8B-Instruct-FP8') +llm.generate("Hello, my name is") +``` + +#### FP8 KV Cache[#](#fp8-kv-cache "Link to this heading") + +Note + +TensorRT LLM allows you to enable the FP8 KV cache manually, even for checkpoints that do not have it enabled by default. + +Here is an example of how to set the FP8 KV Cache option: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='fp8')) +llm.generate("Hello, my name is") +``` + +### Offline Quantization with ModelOpt[#](#offline-quantization-with-modelopt "Link to this heading") + +If a pre-quantized model is not available on the [Hugging Face Hub](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4), you can quantize it offline using ModelOpt. + +Follow this step-by-step guide to quantize a model: + +```None +git clone https://github.com/NVIDIA/TensorRT-Model-Optimizer.git +cd TensorRT-Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 --export_fmt hf +``` + +## Model Supported Matrix[#](#model-supported-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| BERT | . | . | . | . | . | Y | . | . | . | . | +| DeepSeek-R1 | Y | . | . | Y | . | Y | . | . | . | . | +| EXAONE | . | . | Y | . | . | Y | Y | Y | . | . | +| Gemma 3 | . | . | Y | . | . | Y | Y | Y | . | . | +| GPT-OSS | . | Y | . | . | . | Y | . | . | . | . | +| LLaMA | Y | . | Y | . | . | Y | . | Y | . | Y | +| LLaMA-v2 | Y | . | Y | . | . | Y | Y | Y | . | Y | +| LLaMA 3 | . | . | . | . | Y | Y | Y | . | . | . | +| LLaMA 4 | Y | . | Y | . | . | Y | . | . | . | . | +| Mistral | . | . | Y | . | . | Y | . | Y | . | . | +| Mixtral | Y | . | Y | . | . | Y | . | . | . | . | +| Phi | . | . | . | . | . | Y | Y | . | . | . | +| Qwen | . | . | . | . | . | Y | Y | Y | . | Y | +| Qwen-2/2.5 | Y | . | Y | . | . | Y | Y | Y | . | Y | +| Qwen-3 | Y | . | Y | . | . | Y | . | Y | . | Y | +| BLIP2-OPT | . | . | . | . | . | Y | . | . | . | . | +| BLIP2-T5 | . | . | . | . | . | Y | . | . | . | . | +| LLaVA | . | . | Y | . | . | Y | . | Y | . | Y | +| VILA | . | . | Y | . | . | Y | . | Y | . | Y | +| Nougat | . | . | . | . | . | Y | . | . | . | . | + +Note + +The vision component of multi-modal models(BLIP2-OPT/BLIP2-T5/LLaVA/VILA/Nougat) uses FP16 by default. +The language component decides which quantization methods are supported by a given multi-modal model. + +## Hardware Support Matrix[#](#hardware-support-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| Blackwell(sm120) | Y | Y | Y | . | . | Y | . | . | . | . | +| Blackwell(sm100) | Y | Y | Y | Y | . | Y | . | . | . | . | +| Hopper | . | . | Y | Y | Y | Y | Y | Y | Y | Y | +| Ada Lovelace | . | . | Y | . | . | Y | Y | Y | Y | Y | +| Ampere | . | . | . | . | . | Y | . | Y | . | Y | + +Note + +FP8 block wise scaling GEMM kernels for sm100 are using MXFP8 recipe (E4M3 act/weight and UE8M0 act/weight scale), which is slightly different from SM90 FP8 recipe (E4M3 act/weight and FP32 act/weight scale). + +## Quick Links[#](#quick-links "Link to this heading") + +* [Pre-quantized Models by ModelOpt](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) +* [ModelOpt Support Matrix](https://nvidia.github.io/TensorRT-Model-Optimizer/guides/0_support_matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc2.md b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc2.md new file mode 100644 index 0000000000000000000000000000000000000000..6219ed80f0e9c932327cca2c9d0cd2d2796967cf --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc2.md @@ -0,0 +1,111 @@ +# Quantization# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc2/features/quantization.html +Version: 1.2.0rc2 + +## Quantization in TensorRT LLM[#](#quantization-in-tensorrt-llm "Link to this heading") + +Quantization is a technique used to reduce memory footprint and computational cost by converting the model’s weights and/or activations from high-precision floating-point numbers (like BF16) to lower-precision data types, such as INT8, FP8, or FP4. + +TensorRT LLM offers a variety of quantization recipes to optimize LLM inference. These recipes can be broadly categorized as follows: + +* FP4 +* FP8 Per Tensor +* FP8 Block Scaling +* FP8 Rowwise +* FP8 KV Cache +* W4A16 GPTQ +* W4A8 GPTQ +* W4A16 AWQ +* W4A8 AWQ + +## Usage[#](#usage "Link to this heading") + +The default PyTorch backend supports FP4 and FP8 quantization on the latest Blackwell and Hopper GPUs. + +### Running Pre-quantized Models[#](#running-pre-quantized-models "Link to this heading") + +TensorRT LLM can directly run [pre-quantized models](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) generated with the [NVIDIA TensorRT Model Optimizer](https://github.com/NVIDIA/TensorRT-Model-Optimizer). + +```None +from tensorrt_llm import LLM +llm = LLM(model='nvidia/Llama-3.1-8B-Instruct-FP8') +llm.generate("Hello, my name is") +``` + +#### FP8 KV Cache[#](#fp8-kv-cache "Link to this heading") + +Note + +TensorRT LLM allows you to enable the FP8 KV cache manually, even for checkpoints that do not have it enabled by default. + +Here is an example of how to set the FP8 KV Cache option: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='fp8')) +llm.generate("Hello, my name is") +``` + +### Offline Quantization with ModelOpt[#](#offline-quantization-with-modelopt "Link to this heading") + +If a pre-quantized model is not available on the [Hugging Face Hub](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4), you can quantize it offline using ModelOpt. + +Follow this step-by-step guide to quantize a model: + +```None +git clone https://github.com/NVIDIA/TensorRT-Model-Optimizer.git +cd TensorRT-Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 --export_fmt hf +``` + +## Model Supported Matrix[#](#model-supported-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| BERT | . | . | . | . | . | Y | . | . | . | . | +| DeepSeek-R1 | Y | . | . | Y | . | Y | . | . | . | . | +| EXAONE | . | . | Y | . | . | Y | Y | Y | . | . | +| Gemma 3 | . | . | Y | . | . | Y | Y | Y | . | . | +| GPT-OSS | . | Y | . | . | . | Y | . | . | . | . | +| LLaMA | Y | . | Y | . | . | Y | . | Y | . | Y | +| LLaMA-v2 | Y | . | Y | . | . | Y | Y | Y | . | Y | +| LLaMA 3 | . | . | . | . | Y | Y | Y | . | . | . | +| LLaMA 4 | Y | . | Y | . | . | Y | . | . | . | . | +| Mistral | . | . | Y | . | . | Y | . | Y | . | . | +| Mixtral | Y | . | Y | . | . | Y | . | . | . | . | +| Phi | . | . | . | . | . | Y | Y | . | . | . | +| Qwen | . | . | . | . | . | Y | Y | Y | . | Y | +| Qwen-2/2.5 | Y | . | Y | . | . | Y | Y | Y | . | Y | +| Qwen-3 | Y | . | Y | . | . | Y | . | Y | . | Y | +| BLIP2-OPT | . | . | . | . | . | Y | . | . | . | . | +| BLIP2-T5 | . | . | . | . | . | Y | . | . | . | . | +| LLaVA | . | . | Y | . | . | Y | . | Y | . | Y | +| VILA | . | . | Y | . | . | Y | . | Y | . | Y | +| Nougat | . | . | . | . | . | Y | . | . | . | . | + +Note + +The vision component of multi-modal models(BLIP2-OPT/BLIP2-T5/LLaVA/VILA/Nougat) uses FP16 by default. +The language component decides which quantization methods are supported by a given multi-modal model. + +## Hardware Support Matrix[#](#hardware-support-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| Blackwell(sm120) | Y | Y | Y | . | . | Y | . | . | . | . | +| Blackwell(sm100) | Y | Y | Y | Y | . | Y | . | . | . | . | +| Hopper | . | . | Y | Y | Y | Y | Y | Y | Y | Y | +| Ada Lovelace | . | . | Y | . | . | Y | Y | Y | Y | Y | +| Ampere | . | . | . | . | . | Y | . | Y | . | Y | + +Note + +FP8 block wise scaling GEMM kernels for sm100 are using MXFP8 recipe (E4M3 act/weight and UE8M0 act/weight scale), which is slightly different from SM90 FP8 recipe (E4M3 act/weight and FP32 act/weight scale). + +## Quick Links[#](#quick-links "Link to this heading") + +* [Pre-quantized Models by ModelOpt](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) +* [ModelOpt Support Matrix](https://nvidia.github.io/TensorRT-Model-Optimizer/guides/0_support_matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc3.md b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc3.md new file mode 100644 index 0000000000000000000000000000000000000000..3a026908a940c19b818b1b75d6234281acd6d52c --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc3.md @@ -0,0 +1,111 @@ +# Quantization# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc3/features/quantization.html +Version: 1.2.0rc3 + +## Quantization in TensorRT LLM[#](#quantization-in-tensorrt-llm "Link to this heading") + +Quantization is a technique used to reduce memory footprint and computational cost by converting the model’s weights and/or activations from high-precision floating-point numbers (like BF16) to lower-precision data types, such as INT8, FP8, or FP4. + +TensorRT LLM offers a variety of quantization recipes to optimize LLM inference. These recipes can be broadly categorized as follows: + +* FP4 +* FP8 Per Tensor +* FP8 Block Scaling +* FP8 Rowwise +* FP8 KV Cache +* W4A16 GPTQ +* W4A8 GPTQ +* W4A16 AWQ +* W4A8 AWQ + +## Usage[#](#usage "Link to this heading") + +The default PyTorch backend supports FP4 and FP8 quantization on the latest Blackwell and Hopper GPUs. + +### Running Pre-quantized Models[#](#running-pre-quantized-models "Link to this heading") + +TensorRT LLM can directly run [pre-quantized models](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) generated with the [NVIDIA TensorRT Model Optimizer](https://github.com/NVIDIA/TensorRT-Model-Optimizer). + +```None +from tensorrt_llm import LLM +llm = LLM(model='nvidia/Llama-3.1-8B-Instruct-FP8') +llm.generate("Hello, my name is") +``` + +#### FP8 KV Cache[#](#fp8-kv-cache "Link to this heading") + +Note + +TensorRT LLM allows you to enable the FP8 KV cache manually, even for checkpoints that do not have it enabled by default. + +Here is an example of how to set the FP8 KV Cache option: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='fp8')) +llm.generate("Hello, my name is") +``` + +### Offline Quantization with ModelOpt[#](#offline-quantization-with-modelopt "Link to this heading") + +If a pre-quantized model is not available on the [Hugging Face Hub](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4), you can quantize it offline using ModelOpt. + +Follow this step-by-step guide to quantize a model: + +```None +git clone https://github.com/NVIDIA/TensorRT-Model-Optimizer.git +cd TensorRT-Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 --export_fmt hf +``` + +## Model Supported Matrix[#](#model-supported-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| BERT | . | . | . | . | . | Y | . | . | . | . | +| DeepSeek-R1 | Y | . | . | Y | . | Y | . | . | . | . | +| EXAONE | . | . | Y | . | . | Y | Y | Y | . | . | +| Gemma 3 | . | . | Y | . | . | Y | Y | Y | . | . | +| GPT-OSS | . | Y | . | . | . | Y | . | . | . | . | +| LLaMA | Y | . | Y | . | . | Y | . | Y | . | Y | +| LLaMA-v2 | Y | . | Y | . | . | Y | Y | Y | . | Y | +| LLaMA 3 | . | . | . | . | Y | Y | Y | . | . | . | +| LLaMA 4 | Y | . | Y | . | . | Y | . | . | . | . | +| Mistral | . | . | Y | . | . | Y | . | Y | . | . | +| Mixtral | Y | . | Y | . | . | Y | . | . | . | . | +| Phi | . | . | . | . | . | Y | Y | . | . | . | +| Qwen | . | . | . | . | . | Y | Y | Y | . | Y | +| Qwen-2/2.5 | Y | . | Y | . | . | Y | Y | Y | . | Y | +| Qwen-3 | Y | . | Y | . | . | Y | . | Y | . | Y | +| BLIP2-OPT | . | . | . | . | . | Y | . | . | . | . | +| BLIP2-T5 | . | . | . | . | . | Y | . | . | . | . | +| LLaVA | . | . | Y | . | . | Y | . | Y | . | Y | +| VILA | . | . | Y | . | . | Y | . | Y | . | Y | +| Nougat | . | . | . | . | . | Y | . | . | . | . | + +Note + +The vision component of multi-modal models(BLIP2-OPT/BLIP2-T5/LLaVA/VILA/Nougat) uses FP16 by default. +The language component decides which quantization methods are supported by a given multi-modal model. + +## Hardware Support Matrix[#](#hardware-support-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| Blackwell(sm120) | Y | Y | Y | . | . | Y | . | . | . | . | +| Blackwell(sm100) | Y | Y | Y | Y | . | Y | . | . | . | . | +| Hopper | . | . | Y | Y | Y | Y | Y | Y | Y | Y | +| Ada Lovelace | . | . | Y | . | . | Y | Y | Y | Y | Y | +| Ampere | . | . | . | . | . | Y | . | Y | . | Y | + +Note + +FP8 block wise scaling GEMM kernels for sm100 are using MXFP8 recipe (E4M3 act/weight and UE8M0 act/weight scale), which is slightly different from SM90 FP8 recipe (E4M3 act/weight and FP32 act/weight scale). + +## Quick Links[#](#quick-links "Link to this heading") + +* [Pre-quantized Models by ModelOpt](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) +* [ModelOpt Support Matrix](https://nvidia.github.io/TensorRT-Model-Optimizer/guides/0_support_matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc4.md b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc4.md new file mode 100644 index 0000000000000000000000000000000000000000..70776f4782b1cb9d6c0159482a9adb402ae08cd2 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc4.md @@ -0,0 +1,111 @@ +# Quantization# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc4/features/quantization.html +Version: 1.2.0rc4 + +## Quantization in TensorRT LLM[#](#quantization-in-tensorrt-llm "Link to this heading") + +Quantization is a technique used to reduce memory footprint and computational cost by converting the model’s weights and/or activations from high-precision floating-point numbers (like BF16) to lower-precision data types, such as INT8, FP8, or FP4. + +TensorRT LLM offers a variety of quantization recipes to optimize LLM inference. These recipes can be broadly categorized as follows: + +* FP4 +* FP8 Per Tensor +* FP8 Block Scaling +* FP8 Rowwise +* FP8 KV Cache +* W4A16 GPTQ +* W4A8 GPTQ +* W4A16 AWQ +* W4A8 AWQ + +## Usage[#](#usage "Link to this heading") + +The default PyTorch backend supports FP4 and FP8 quantization on the latest Blackwell and Hopper GPUs. + +### Running Pre-quantized Models[#](#running-pre-quantized-models "Link to this heading") + +TensorRT LLM can directly run [pre-quantized models](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) generated with the [NVIDIA TensorRT Model Optimizer](https://github.com/NVIDIA/TensorRT-Model-Optimizer). + +```None +from tensorrt_llm import LLM +llm = LLM(model='nvidia/Llama-3.1-8B-Instruct-FP8') +llm.generate("Hello, my name is") +``` + +#### FP8 KV Cache[#](#fp8-kv-cache "Link to this heading") + +Note + +TensorRT LLM allows you to enable the FP8 KV cache manually, even for checkpoints that do not have it enabled by default. + +Here is an example of how to set the FP8 KV Cache option: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='fp8')) +llm.generate("Hello, my name is") +``` + +### Offline Quantization with ModelOpt[#](#offline-quantization-with-modelopt "Link to this heading") + +If a pre-quantized model is not available on the [Hugging Face Hub](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4), you can quantize it offline using ModelOpt. + +Follow this step-by-step guide to quantize a model: + +```None +git clone https://github.com/NVIDIA/TensorRT-Model-Optimizer.git +cd TensorRT-Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 --export_fmt hf +``` + +## Model Supported Matrix[#](#model-supported-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| BERT | . | . | . | . | . | Y | . | . | . | . | +| DeepSeek-R1 | Y | . | . | Y | . | Y | . | . | . | . | +| EXAONE | . | . | Y | . | . | Y | Y | Y | . | . | +| Gemma 3 | . | . | Y | . | . | Y | Y | Y | . | . | +| GPT-OSS | . | Y | . | . | . | Y | . | . | . | . | +| LLaMA | Y | . | Y | . | . | Y | . | Y | . | Y | +| LLaMA-v2 | Y | . | Y | . | . | Y | Y | Y | . | Y | +| LLaMA 3 | . | . | . | . | Y | Y | Y | . | . | . | +| LLaMA 4 | Y | . | Y | . | . | Y | . | . | . | . | +| Mistral | . | . | Y | . | . | Y | . | Y | . | . | +| Mixtral | Y | . | Y | . | . | Y | . | . | . | . | +| Phi | . | . | . | . | . | Y | Y | . | . | . | +| Qwen | . | . | . | . | . | Y | Y | Y | . | Y | +| Qwen-2/2.5 | Y | . | Y | . | . | Y | Y | Y | . | Y | +| Qwen-3 | Y | . | Y | . | . | Y | . | Y | . | Y | +| BLIP2-OPT | . | . | . | . | . | Y | . | . | . | . | +| BLIP2-T5 | . | . | . | . | . | Y | . | . | . | . | +| LLaVA | . | . | Y | . | . | Y | . | Y | . | Y | +| VILA | . | . | Y | . | . | Y | . | Y | . | Y | +| Nougat | . | . | . | . | . | Y | . | . | . | . | + +Note + +The vision component of multi-modal models(BLIP2-OPT/BLIP2-T5/LLaVA/VILA/Nougat) uses FP16 by default. +The language component decides which quantization methods are supported by a given multi-modal model. + +## Hardware Support Matrix[#](#hardware-support-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| Blackwell(sm120) | Y | Y | Y | . | . | Y | . | . | . | . | +| Blackwell(sm100) | Y | Y | Y | Y | . | Y | . | . | . | . | +| Hopper | . | . | Y | Y | Y | Y | Y | Y | Y | Y | +| Ada Lovelace | . | . | Y | . | . | Y | Y | Y | Y | Y | +| Ampere | . | . | . | . | . | Y | . | Y | . | Y | + +Note + +FP8 block wise scaling GEMM kernels for sm100 are using MXFP8 recipe (E4M3 act/weight and UE8M0 act/weight scale), which is slightly different from SM90 FP8 recipe (E4M3 act/weight and FP32 act/weight scale). + +## Quick Links[#](#quick-links "Link to this heading") + +* [Pre-quantized Models by ModelOpt](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) +* [ModelOpt Support Matrix](https://nvidia.github.io/TensorRT-Model-Optimizer/guides/0_support_matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc5.md b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc5.md new file mode 100644 index 0000000000000000000000000000000000000000..12874b6863edb25697d84b250f168692f74965ae --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc5.md @@ -0,0 +1,111 @@ +# Quantization# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc5/features/quantization.html +Version: 1.2.0rc5 + +## Quantization in TensorRT LLM[#](#quantization-in-tensorrt-llm "Link to this heading") + +Quantization is a technique used to reduce memory footprint and computational cost by converting the model’s weights and/or activations from high-precision floating-point numbers (like BF16) to lower-precision data types, such as INT8, FP8, or FP4. + +TensorRT LLM offers a variety of quantization recipes to optimize LLM inference. These recipes can be broadly categorized as follows: + +* FP4 +* FP8 Per Tensor +* FP8 Block Scaling +* FP8 Rowwise +* FP8 KV Cache +* W4A16 GPTQ +* W4A8 GPTQ +* W4A16 AWQ +* W4A8 AWQ + +## Usage[#](#usage "Link to this heading") + +The default PyTorch backend supports FP4 and FP8 quantization on the latest Blackwell and Hopper GPUs. + +### Running Pre-quantized Models[#](#running-pre-quantized-models "Link to this heading") + +TensorRT LLM can directly run [pre-quantized models](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) generated with the [NVIDIA TensorRT Model Optimizer](https://github.com/NVIDIA/TensorRT-Model-Optimizer). + +```None +from tensorrt_llm import LLM +llm = LLM(model='nvidia/Llama-3.1-8B-Instruct-FP8') +llm.generate("Hello, my name is") +``` + +#### FP8 KV Cache[#](#fp8-kv-cache "Link to this heading") + +Note + +TensorRT LLM allows you to enable the FP8 KV cache manually, even for checkpoints that do not have it enabled by default. + +Here is an example of how to set the FP8 KV Cache option: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='fp8')) +llm.generate("Hello, my name is") +``` + +### Offline Quantization with ModelOpt[#](#offline-quantization-with-modelopt "Link to this heading") + +If a pre-quantized model is not available on the [Hugging Face Hub](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4), you can quantize it offline using ModelOpt. + +Follow this step-by-step guide to quantize a model: + +```None +git clone https://github.com/NVIDIA/TensorRT-Model-Optimizer.git +cd TensorRT-Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 --export_fmt hf +``` + +## Model Supported Matrix[#](#model-supported-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| BERT | . | . | . | . | . | Y | . | . | . | . | +| DeepSeek-R1 | Y | . | . | Y | . | Y | . | . | . | . | +| EXAONE | . | . | Y | . | . | Y | Y | Y | . | . | +| Gemma 3 | . | . | Y | . | . | Y | Y | Y | . | . | +| GPT-OSS | . | Y | . | . | . | Y | . | . | . | . | +| LLaMA | Y | . | Y | . | . | Y | . | Y | . | Y | +| LLaMA-v2 | Y | . | Y | . | . | Y | Y | Y | . | Y | +| LLaMA 3 | . | . | . | . | Y | Y | Y | . | . | . | +| LLaMA 4 | Y | . | Y | . | . | Y | . | . | . | . | +| Mistral | . | . | Y | . | . | Y | . | Y | . | . | +| Mixtral | Y | . | Y | . | . | Y | . | . | . | . | +| Phi | . | . | . | . | . | Y | Y | . | . | . | +| Qwen | . | . | . | . | . | Y | Y | Y | . | Y | +| Qwen-2/2.5 | Y | . | Y | . | . | Y | Y | Y | . | Y | +| Qwen-3 | Y | . | Y | . | . | Y | . | Y | . | Y | +| BLIP2-OPT | . | . | . | . | . | Y | . | . | . | . | +| BLIP2-T5 | . | . | . | . | . | Y | . | . | . | . | +| LLaVA | . | . | Y | . | . | Y | . | Y | . | Y | +| VILA | . | . | Y | . | . | Y | . | Y | . | Y | +| Nougat | . | . | . | . | . | Y | . | . | . | . | + +Note + +The vision component of multi-modal models(BLIP2-OPT/BLIP2-T5/LLaVA/VILA/Nougat) uses FP16 by default. +The language component decides which quantization methods are supported by a given multi-modal model. + +## Hardware Support Matrix[#](#hardware-support-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| Blackwell(sm120) | Y | Y | Y | . | . | Y | . | . | . | . | +| Blackwell(sm100) | Y | Y | Y | Y | . | Y | . | . | . | . | +| Hopper | . | . | Y | Y | Y | Y | Y | Y | Y | Y | +| Ada Lovelace | . | . | Y | . | . | Y | Y | Y | Y | Y | +| Ampere | . | . | . | . | . | Y | . | Y | . | Y | + +Note + +FP8 block wise scaling GEMM kernels for sm100 are using MXFP8 recipe (E4M3 act/weight and UE8M0 act/weight scale), which is slightly different from SM90 FP8 recipe (E4M3 act/weight and FP32 act/weight scale). + +## Quick Links[#](#quick-links "Link to this heading") + +* [Pre-quantized Models by ModelOpt](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) +* [ModelOpt Support Matrix](https://nvidia.github.io/TensorRT-Model-Optimizer/guides/0_support_matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc6.md b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc6.md new file mode 100644 index 0000000000000000000000000000000000000000..ef839061632b051232fcf7e1655fef8e1935262b --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc6.md @@ -0,0 +1,137 @@ +# Quantization# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc6/features/quantization.html +Version: 1.2.0rc6 + +## Quantization in TensorRT LLM[#](#quantization-in-tensorrt-llm "Link to this heading") + +Quantization is a technique used to reduce memory footprint and computational cost by converting the model’s weights and/or activations from high-precision floating-point numbers (like BF16) to lower-precision data types, such as INT8, FP8, or FP4. + +TensorRT LLM offers a variety of quantization recipes to optimize LLM inference. These recipes can be broadly categorized as follows: + +* FP4 +* FP8 Per Tensor +* FP8 Block Scaling +* FP8 Rowwise +* FP8 KV Cache +* NVFP4 KV Cache +* W4A16 GPTQ +* W4A8 GPTQ +* W4A16 AWQ +* W4A8 AWQ + +## Usage[#](#usage "Link to this heading") + +The default PyTorch backend supports FP4 and FP8 quantization on the latest Blackwell and Hopper GPUs. + +### Running Pre-quantized Models[#](#running-pre-quantized-models "Link to this heading") + +TensorRT LLM can directly run [pre-quantized models](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) generated with the [NVIDIA Model Optimizer](https://github.com/NVIDIA/Model-Optimizer). + +```None +from tensorrt_llm import LLM +llm = LLM(model='nvidia/Llama-3.1-8B-Instruct-FP8') +llm.generate("Hello, my name is") +``` + +#### FP8 KV Cache[#](#fp8-kv-cache "Link to this heading") + +Note + +TensorRT LLM allows you to enable the FP8 KV cache manually, even for checkpoints that do not have it enabled by default. + +Here is an example of how to set the FP8 KV Cache option: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='fp8')) +llm.generate("Hello, my name is") +``` + +#### NVFP4 KV Cache[#](#nvfp4-kv-cache "Link to this heading") + +To enable NVFP4 KV cache, offline quantization with ModelOpt is required. Please follow the below section for instructions. +After the quantization is done, the NVFP4 KV cache option can be set by: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='nvfp4')) +llm.generate("Hello, my name is") +``` + +### Offline Quantization with ModelOpt[#](#offline-quantization-with-modelopt "Link to this heading") + +If a pre-quantized model is not available on the [Hugging Face Hub](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4), you can quantize it offline using ModelOpt. + +Follow this step-by-step guide to quantize a model: + +```None +git clone https://github.com/NVIDIA/Model-Optimizer.git +cd Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 +``` + +#### NVFP4 KV Cache[#](#id1 "Link to this heading") + +To generate the checkpoint for NVFP4 KV cache: + +```None +git clone https://github.com/NVIDIA/Model-Optimizer.git +cd TensorRT-Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 --kv_cache_quant nvfp4 +``` + +Note that currently TRT-LLM only supports FP8 weight/activation quantization when NVFP4 KV cache is enabled. Therefore, `--quant fp8` is required here. + +## Model Supported Matrix[#](#model-supported-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | NVFP4 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| BERT | . | . | . | . | . | Y | . | . | . | . | . | +| DeepSeek-R1 | Y | . | . | Y | . | Y | . | . | . | . | . | +| EXAONE | . | . | Y | . | . | Y | . | Y | Y | . | . | +| Gemma 3 | . | . | Y | . | . | Y | . | Y | Y | . | . | +| GPT-OSS | . | Y | . | . | . | Y | . | . | . | . | . | +| LLaMA | Y | . | Y | . | . | Y | . | . | Y | . | Y | +| LLaMA-v2 | Y | . | Y | . | . | Y | Y | Y | Y | . | Y | +| LLaMA 3 | . | . | . | . | Y | Y | Y | Y | . | . | . | +| LLaMA 4 | Y | . | Y | . | . | Y | . | . | . | . | . | +| Mistral | . | . | Y | . | . | Y | . | . | Y | . | . | +| Mixtral | Y | . | Y | . | . | Y | . | . | . | . | . | +| Phi | . | . | . | . | . | Y | . | Y | . | . | . | +| Qwen | . | . | . | . | . | Y | . | Y | Y | . | Y | +| Qwen-2/2.5 | Y | . | Y | . | . | Y | . | Y | Y | . | Y | +| Qwen-3 | Y | . | Y | . | . | Y | Y | . | Y | . | Y | +| BLIP2-OPT | . | . | . | . | . | Y | . | . | . | . | . | +| BLIP2-T5 | . | . | . | . | . | Y | . | . | . | . | . | +| LLaVA | . | . | Y | . | . | Y | . | . | Y | . | Y | +| VILA | . | . | Y | . | . | Y | . | . | Y | . | Y | +| Nougat | . | . | . | . | . | Y | . | . | . | . | . | + +Note + +The vision component of multi-modal models(BLIP2-OPT/BLIP2-T5/LLaVA/VILA/Nougat) uses FP16 by default. +The language component decides which quantization methods are supported by a given multi-modal model. + +## Hardware Support Matrix[#](#hardware-support-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | NVFP4 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| Blackwell(sm120) | Y | Y | Y | . | . | Y | . | . | . | . | . | +| Blackwell(sm100) | Y | Y | Y | Y | . | Y | Y | . | . | . | . | +| Hopper | . | . | Y | Y | Y | Y | . | Y | Y | Y | Y | +| Ada Lovelace | . | . | Y | . | . | Y | . | Y | Y | Y | Y | +| Ampere | . | . | . | . | . | Y | . | . | Y | . | Y | + +Note + +FP8 block wise scaling GEMM kernels for sm100 are using MXFP8 recipe (E4M3 act/weight and UE8M0 act/weight scale), which is slightly different from SM90 FP8 recipe (E4M3 act/weight and FP32 act/weight scale). + +## Quick Links[#](#quick-links "Link to this heading") + +* [Pre-quantized Models by ModelOpt](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) +* [ModelOpt Support Matrix](https://nvidia.github.io/Model-Optimizer/guides/0_support_matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc7.md b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc7.md new file mode 100644 index 0000000000000000000000000000000000000000..e6787ffc73992b3355e1b878bdc83a864c1aacd8 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc7.md @@ -0,0 +1,137 @@ +# Quantization# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc7/features/quantization.html +Version: 1.2.0rc7 + +## Quantization in TensorRT LLM[#](#quantization-in-tensorrt-llm "Link to this heading") + +Quantization is a technique used to reduce memory footprint and computational cost by converting the model’s weights and/or activations from high-precision floating-point numbers (like BF16) to lower-precision data types, such as INT8, FP8, or FP4. + +TensorRT LLM offers a variety of quantization recipes to optimize LLM inference. These recipes can be broadly categorized as follows: + +* FP4 +* FP8 Per Tensor +* FP8 Block Scaling +* FP8 Rowwise +* FP8 KV Cache +* NVFP4 KV Cache +* W4A16 GPTQ +* W4A8 GPTQ +* W4A16 AWQ +* W4A8 AWQ + +## Usage[#](#usage "Link to this heading") + +The default PyTorch backend supports FP4 and FP8 quantization on the latest Blackwell and Hopper GPUs. + +### Running Pre-quantized Models[#](#running-pre-quantized-models "Link to this heading") + +TensorRT LLM can directly run [pre-quantized models](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) generated with the [NVIDIA Model Optimizer](https://github.com/NVIDIA/Model-Optimizer). + +```None +from tensorrt_llm import LLM +llm = LLM(model='nvidia/Llama-3.1-8B-Instruct-FP8') +llm.generate("Hello, my name is") +``` + +#### FP8 KV Cache[#](#fp8-kv-cache "Link to this heading") + +Note + +TensorRT LLM allows you to enable the FP8 KV cache manually, even for checkpoints that do not have it enabled by default. + +Here is an example of how to set the FP8 KV Cache option: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='fp8')) +llm.generate("Hello, my name is") +``` + +#### NVFP4 KV Cache[#](#nvfp4-kv-cache "Link to this heading") + +To enable NVFP4 KV cache, offline quantization with ModelOpt is required. Please follow the below section for instructions. +After the quantization is done, the NVFP4 KV cache option can be set by: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='nvfp4')) +llm.generate("Hello, my name is") +``` + +### Offline Quantization with ModelOpt[#](#offline-quantization-with-modelopt "Link to this heading") + +If a pre-quantized model is not available on the [Hugging Face Hub](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4), you can quantize it offline using ModelOpt. + +Follow this step-by-step guide to quantize a model: + +```None +git clone https://github.com/NVIDIA/Model-Optimizer.git +cd Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 +``` + +#### NVFP4 KV Cache[#](#id1 "Link to this heading") + +To generate the checkpoint for NVFP4 KV cache: + +```None +git clone https://github.com/NVIDIA/Model-Optimizer.git +cd TensorRT-Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 --kv_cache_quant nvfp4 +``` + +Note that currently TRT-LLM only supports FP8 weight/activation quantization when NVFP4 KV cache is enabled. Therefore, `--quant fp8` is required here. + +## Model Supported Matrix[#](#model-supported-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | NVFP4 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| BERT | . | . | . | . | . | Y | . | . | . | . | . | +| DeepSeek-R1 | Y | . | . | Y | . | Y | . | . | . | . | . | +| EXAONE | . | . | Y | . | . | Y | . | Y | Y | . | . | +| Gemma 3 | . | . | Y | . | . | Y | . | Y | Y | . | . | +| GPT-OSS | . | Y | . | . | . | Y | . | . | . | . | . | +| LLaMA | Y | . | Y | . | . | Y | . | . | Y | . | Y | +| LLaMA-v2 | Y | . | Y | . | . | Y | Y | Y | Y | . | Y | +| LLaMA 3 | . | . | . | . | Y | Y | Y | Y | . | . | . | +| LLaMA 4 | Y | . | Y | . | . | Y | . | . | . | . | . | +| Mistral | . | . | Y | . | . | Y | . | . | Y | . | . | +| Mixtral | Y | . | Y | . | . | Y | . | . | . | . | . | +| Phi | . | . | . | . | . | Y | . | Y | . | . | . | +| Qwen | . | . | . | . | . | Y | . | Y | Y | . | Y | +| Qwen-2/2.5 | Y | . | Y | . | . | Y | . | Y | Y | . | Y | +| Qwen-3 | Y | . | Y | . | . | Y | Y | . | Y | . | Y | +| BLIP2-OPT | . | . | . | . | . | Y | . | . | . | . | . | +| BLIP2-T5 | . | . | . | . | . | Y | . | . | . | . | . | +| LLaVA | . | . | Y | . | . | Y | . | . | Y | . | Y | +| VILA | . | . | Y | . | . | Y | . | . | Y | . | Y | +| Nougat | . | . | . | . | . | Y | . | . | . | . | . | + +Note + +The vision component of multi-modal models(BLIP2-OPT/BLIP2-T5/LLaVA/VILA/Nougat) uses FP16 by default. +The language component decides which quantization methods are supported by a given multi-modal model. + +## Hardware Support Matrix[#](#hardware-support-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | NVFP4 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| Blackwell(sm120) | Y | Y | Y | . | . | Y | . | . | . | . | . | +| Blackwell(sm100/103) | Y | Y | Y | Y | . | Y | Y | . | . | . | . | +| Hopper | . | . | Y | Y | Y | Y | . | Y | Y | Y | Y | +| Ada Lovelace | . | . | Y | . | . | Y | . | Y | Y | Y | Y | +| Ampere | . | . | . | . | . | Y | . | . | Y | . | Y | + +Note + +FP8 block wise scaling GEMM kernels for sm100/103 are using MXFP8 recipe (E4M3 act/weight and UE8M0 act/weight scale), which is slightly different from SM90 FP8 recipe (E4M3 act/weight and FP32 act/weight scale). + +## Quick Links[#](#quick-links "Link to this heading") + +* [Pre-quantized Models by ModelOpt](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) +* [ModelOpt Support Matrix](https://nvidia.github.io/Model-Optimizer/guides/0_support_matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc8.md b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc8.md new file mode 100644 index 0000000000000000000000000000000000000000..91f0d472783d7b5ba4b366a9f458ff4e6c51ecad --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_120rc8.md @@ -0,0 +1,137 @@ +# Quantization# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc8/features/quantization.html +Version: 1.2.0rc8 + +## Quantization in TensorRT LLM[#](#quantization-in-tensorrt-llm "Link to this heading") + +Quantization is a technique used to reduce memory footprint and computational cost by converting the model’s weights and/or activations from high-precision floating-point numbers (like BF16) to lower-precision data types, such as INT8, FP8, or FP4. + +TensorRT LLM offers a variety of quantization recipes to optimize LLM inference. These recipes can be broadly categorized as follows: + +* FP4 +* FP8 Per Tensor +* FP8 Block Scaling +* FP8 Rowwise +* FP8 KV Cache +* NVFP4 KV Cache +* W4A16 GPTQ +* W4A8 GPTQ +* W4A16 AWQ +* W4A8 AWQ + +## Usage[#](#usage "Link to this heading") + +The default PyTorch backend supports FP4 and FP8 quantization on the latest Blackwell and Hopper GPUs. + +### Running Pre-quantized Models[#](#running-pre-quantized-models "Link to this heading") + +TensorRT LLM can directly run [pre-quantized models](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) generated with the [NVIDIA Model Optimizer](https://github.com/NVIDIA/Model-Optimizer). + +```None +from tensorrt_llm import LLM +llm = LLM(model='nvidia/Llama-3.1-8B-Instruct-FP8') +llm.generate("Hello, my name is") +``` + +#### FP8 KV Cache[#](#fp8-kv-cache "Link to this heading") + +Note + +TensorRT LLM allows you to enable the FP8 KV cache manually, even for checkpoints that do not have it enabled by default. + +Here is an example of how to set the FP8 KV Cache option: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='fp8')) +llm.generate("Hello, my name is") +``` + +#### NVFP4 KV Cache[#](#nvfp4-kv-cache "Link to this heading") + +To enable NVFP4 KV cache, offline quantization with ModelOpt is required. Please follow the below section for instructions. +After the quantization is done, the NVFP4 KV cache option can be set by: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='nvfp4')) +llm.generate("Hello, my name is") +``` + +### Offline Quantization with ModelOpt[#](#offline-quantization-with-modelopt "Link to this heading") + +If a pre-quantized model is not available on the [Hugging Face Hub](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4), you can quantize it offline using ModelOpt. + +Follow this step-by-step guide to quantize a model: + +```None +git clone https://github.com/NVIDIA/Model-Optimizer.git +cd Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 +``` + +#### NVFP4 KV Cache[#](#id1 "Link to this heading") + +To generate the checkpoint for NVFP4 KV cache: + +```None +git clone https://github.com/NVIDIA/Model-Optimizer.git +cd TensorRT-Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 --kv_cache_quant nvfp4 +``` + +Note that currently TRT-LLM only supports FP8 weight/activation quantization when NVFP4 KV cache is enabled. Therefore, `--quant fp8` is required here. + +## Model Supported Matrix[#](#model-supported-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | NVFP4 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| BERT | . | . | . | . | . | Y | . | . | . | . | . | +| DeepSeek-R1 | Y | . | . | Y | . | Y | . | . | . | . | . | +| EXAONE | . | . | Y | . | . | Y | . | Y | Y | . | . | +| Gemma 3 | . | . | Y | . | . | Y | . | Y | Y | . | . | +| GPT-OSS | . | Y | . | . | . | Y | . | . | . | . | . | +| LLaMA | Y | . | Y | . | . | Y | . | . | Y | . | Y | +| LLaMA-v2 | Y | . | Y | . | . | Y | Y | Y | Y | . | Y | +| LLaMA 3 | . | . | . | . | Y | Y | Y | Y | . | . | . | +| LLaMA 4 | Y | . | Y | . | . | Y | . | . | . | . | . | +| Mistral | . | . | Y | . | . | Y | . | . | Y | . | . | +| Mixtral | Y | . | Y | . | . | Y | . | . | . | . | . | +| Phi | . | . | . | . | . | Y | . | Y | . | . | . | +| Qwen | . | . | . | . | . | Y | . | Y | Y | . | Y | +| Qwen-2/2.5 | Y | . | Y | . | . | Y | . | Y | Y | . | Y | +| Qwen-3 | Y | . | Y | . | . | Y | Y | . | Y | . | Y | +| BLIP2-OPT | . | . | . | . | . | Y | . | . | . | . | . | +| BLIP2-T5 | . | . | . | . | . | Y | . | . | . | . | . | +| LLaVA | . | . | Y | . | . | Y | . | . | Y | . | Y | +| VILA | . | . | Y | . | . | Y | . | . | Y | . | Y | +| Nougat | . | . | . | . | . | Y | . | . | . | . | . | + +Note + +The vision component of multi-modal models(BLIP2-OPT/BLIP2-T5/LLaVA/VILA/Nougat) uses FP16 by default. +The language component decides which quantization methods are supported by a given multi-modal model. + +## Hardware Support Matrix[#](#hardware-support-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | NVFP4 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| Blackwell(sm120) | Y | Y | Y | . | . | Y | . | . | . | . | . | +| Blackwell(sm100/103) | Y | Y | Y | Y | . | Y | Y | Y | Y | Y | Y | +| Hopper | . | . | Y | Y | Y | Y | . | Y | Y | Y | Y | +| Ada Lovelace | . | . | Y | . | . | Y | . | Y | Y | Y | Y | +| Ampere | . | . | . | . | . | Y | . | . | Y | . | Y | + +Note + +FP8 block wise scaling GEMM kernels for sm100/103 are using MXFP8 recipe (E4M3 act/weight and UE8M0 act/weight scale), which is slightly different from SM90 FP8 recipe (E4M3 act/weight and FP32 act/weight scale). + +## Quick Links[#](#quick-links "Link to this heading") + +* [Pre-quantized Models by ModelOpt](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) +* [ModelOpt Support Matrix](https://nvidia.github.io/Model-Optimizer/guides/0_support_matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_130rc0.md b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_130rc0.md new file mode 100644 index 0000000000000000000000000000000000000000..c418e62e13504008ff5c5c30c2a5f964859e02b6 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_130rc0.md @@ -0,0 +1,137 @@ +# Quantization# + +Source: https://nvidia.github.io/TensorRT-LLM/1.3.0rc0/features/quantization.html +Version: 1.3.0rc0 + +## Quantization in TensorRT LLM[#](#quantization-in-tensorrt-llm "Link to this heading") + +Quantization is a technique used to reduce memory footprint and computational cost by converting the model’s weights and/or activations from high-precision floating-point numbers (like BF16) to lower-precision data types, such as INT8, FP8, or FP4. + +TensorRT LLM offers a variety of quantization recipes to optimize LLM inference. These recipes can be broadly categorized as follows: + +* FP4 +* FP8 Per Tensor +* FP8 Block Scaling +* FP8 Rowwise +* FP8 KV Cache +* NVFP4 KV Cache +* W4A16 GPTQ +* W4A8 GPTQ +* W4A16 AWQ +* W4A8 AWQ + +## Usage[#](#usage "Link to this heading") + +The default PyTorch backend supports FP4 and FP8 quantization on the latest Blackwell and Hopper GPUs. + +### Running Pre-quantized Models[#](#running-pre-quantized-models "Link to this heading") + +TensorRT LLM can directly run [pre-quantized models](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) generated with the [NVIDIA Model Optimizer](https://github.com/NVIDIA/Model-Optimizer). + +```None +from tensorrt_llm import LLM +llm = LLM(model='nvidia/Llama-3.1-8B-Instruct-FP8') +llm.generate("Hello, my name is") +``` + +#### FP8 KV Cache[#](#fp8-kv-cache "Link to this heading") + +Note + +TensorRT LLM allows you to enable the FP8 KV cache manually, even for checkpoints that do not have it enabled by default. + +Here is an example of how to set the FP8 KV Cache option: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='fp8')) +llm.generate("Hello, my name is") +``` + +#### NVFP4 KV Cache[#](#nvfp4-kv-cache "Link to this heading") + +To enable NVFP4 KV cache, offline quantization with ModelOpt is required. Please follow the below section for instructions. +After the quantization is done, the NVFP4 KV cache option can be set by: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='nvfp4')) +llm.generate("Hello, my name is") +``` + +### Offline Quantization with ModelOpt[#](#offline-quantization-with-modelopt "Link to this heading") + +If a pre-quantized model is not available on the [Hugging Face Hub](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4), you can quantize it offline using ModelOpt. + +Follow this step-by-step guide to quantize a model: + +```None +git clone https://github.com/NVIDIA/Model-Optimizer.git +cd Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 +``` + +#### NVFP4 KV Cache[#](#id1 "Link to this heading") + +To generate the checkpoint for NVFP4 KV cache: + +```None +git clone https://github.com/NVIDIA/Model-Optimizer.git +cd TensorRT-Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 --kv_cache_quant nvfp4 +``` + +Note that currently TRT-LLM only supports FP8 weight/activation quantization when NVFP4 KV cache is enabled. Therefore, `--quant fp8` is required here. + +## Model Supported Matrix[#](#model-supported-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | NVFP4 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| BERT | . | . | . | . | . | Y | . | . | . | . | . | +| DeepSeek-R1 | Y | . | . | Y | . | Y | . | . | . | . | . | +| EXAONE | . | . | Y | . | . | Y | . | Y | Y | . | . | +| Gemma 3 | . | . | Y | . | . | Y | . | Y | Y | . | . | +| GPT-OSS | . | Y | . | . | . | Y | . | . | . | . | . | +| LLaMA | Y | . | Y | . | . | Y | . | . | Y | . | Y | +| LLaMA-v2 | Y | . | Y | . | . | Y | Y | Y | Y | . | Y | +| LLaMA 3 | . | . | . | . | Y | Y | Y | Y | . | . | . | +| LLaMA 4 | Y | . | Y | . | . | Y | . | . | . | . | . | +| Mistral | . | . | Y | . | . | Y | . | . | Y | . | . | +| Mixtral | Y | . | Y | . | . | Y | . | . | . | . | . | +| Phi | . | . | . | . | . | Y | . | Y | . | . | . | +| Qwen | . | . | . | . | . | Y | . | Y | Y | . | Y | +| Qwen-2/2.5 | Y | . | Y | . | . | Y | . | Y | Y | . | Y | +| Qwen-3 | Y | . | Y | . | . | Y | Y | . | Y | . | Y | +| BLIP2-OPT | . | . | . | . | . | Y | . | . | . | . | . | +| BLIP2-T5 | . | . | . | . | . | Y | . | . | . | . | . | +| LLaVA | . | . | Y | . | . | Y | . | . | Y | . | Y | +| VILA | . | . | Y | . | . | Y | . | . | Y | . | Y | +| Nougat | . | . | . | . | . | Y | . | . | . | . | . | + +Note + +The vision component of multi-modal models(BLIP2-OPT/BLIP2-T5/LLaVA/VILA/Nougat) uses FP16 by default. +The language component decides which quantization methods are supported by a given multi-modal model. + +## Hardware Support Matrix[#](#hardware-support-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | NVFP4 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| Blackwell(sm120) | Y | Y | Y | . | . | Y | . | . | . | . | . | +| Blackwell(sm100/103) | Y | Y | Y | Y | . | Y | Y | Y | Y | Y | Y | +| Hopper | . | . | Y | Y | Y | Y | . | Y | Y | Y | Y | +| Ada Lovelace | . | . | Y | . | . | Y | . | Y | Y | Y | Y | +| Ampere | . | . | . | . | . | Y | . | . | Y | . | Y | + +Note + +FP8 block wise scaling GEMM kernels for sm100/103 are using MXFP8 recipe (E4M3 act/weight and UE8M0 act/weight scale), which is slightly different from SM90 FP8 recipe (E4M3 act/weight and FP32 act/weight scale). + +## Quick Links[#](#quick-links "Link to this heading") + +* [Pre-quantized Models by ModelOpt](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) +* [ModelOpt Support Matrix](https://nvidia.github.io/Model-Optimizer/guides/0_support_matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_130rc1.md b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_130rc1.md new file mode 100644 index 0000000000000000000000000000000000000000..158b18495f40b1b9f5372a7806c5e111ee524068 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_130rc1.md @@ -0,0 +1,137 @@ +# Quantization# + +Source: https://nvidia.github.io/TensorRT-LLM/1.3.0rc1/features/quantization.html +Version: 1.3.0rc1 + +## Quantization in TensorRT LLM[#](#quantization-in-tensorrt-llm "Link to this heading") + +Quantization is a technique used to reduce memory footprint and computational cost by converting the model’s weights and/or activations from high-precision floating-point numbers (like BF16) to lower-precision data types, such as INT8, FP8, or FP4. + +TensorRT LLM offers a variety of quantization recipes to optimize LLM inference. These recipes can be broadly categorized as follows: + +* FP4 +* FP8 Per Tensor +* FP8 Block Scaling +* FP8 Rowwise +* FP8 KV Cache +* NVFP4 KV Cache +* W4A16 GPTQ +* W4A8 GPTQ +* W4A16 AWQ +* W4A8 AWQ + +## Usage[#](#usage "Link to this heading") + +The default PyTorch backend supports FP4 and FP8 quantization on the latest Blackwell and Hopper GPUs. + +### Running Pre-quantized Models[#](#running-pre-quantized-models "Link to this heading") + +TensorRT LLM can directly run [pre-quantized models](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) generated with the [NVIDIA Model Optimizer](https://github.com/NVIDIA/Model-Optimizer). + +```None +from tensorrt_llm import LLM +llm = LLM(model='nvidia/Llama-3.1-8B-Instruct-FP8') +llm.generate("Hello, my name is") +``` + +#### FP8 KV Cache[#](#fp8-kv-cache "Link to this heading") + +Note + +TensorRT LLM allows you to enable the FP8 KV cache manually, even for checkpoints that do not have it enabled by default. + +Here is an example of how to set the FP8 KV Cache option: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='fp8')) +llm.generate("Hello, my name is") +``` + +#### NVFP4 KV Cache[#](#nvfp4-kv-cache "Link to this heading") + +To enable NVFP4 KV cache, offline quantization with ModelOpt is required. Please follow the below section for instructions. +After the quantization is done, the NVFP4 KV cache option can be set by: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='nvfp4')) +llm.generate("Hello, my name is") +``` + +### Offline Quantization with ModelOpt[#](#offline-quantization-with-modelopt "Link to this heading") + +If a pre-quantized model is not available on the [Hugging Face Hub](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4), you can quantize it offline using ModelOpt. + +Follow this step-by-step guide to quantize a model: + +```None +git clone https://github.com/NVIDIA/Model-Optimizer.git +cd Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 +``` + +#### NVFP4 KV Cache[#](#id1 "Link to this heading") + +To generate the checkpoint for NVFP4 KV cache: + +```None +git clone https://github.com/NVIDIA/Model-Optimizer.git +cd TensorRT-Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 --kv_cache_quant nvfp4 +``` + +Note that currently TRT-LLM only supports FP8 weight/activation quantization when NVFP4 KV cache is enabled. Therefore, `--quant fp8` is required here. + +## Model Supported Matrix[#](#model-supported-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | NVFP4 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| BERT | . | . | . | . | . | Y | . | . | . | . | . | +| DeepSeek-R1 | Y | . | . | Y | . | Y | . | . | . | . | . | +| EXAONE | . | . | Y | . | . | Y | . | Y | Y | . | . | +| Gemma 3 | . | . | Y | . | . | Y | . | Y | Y | . | . | +| GPT-OSS | . | Y | . | . | . | Y | . | . | . | . | . | +| LLaMA | Y | . | Y | . | . | Y | . | . | Y | . | Y | +| LLaMA-v2 | Y | . | Y | . | . | Y | Y | Y | Y | . | Y | +| LLaMA 3 | . | . | . | . | Y | Y | Y | Y | . | . | . | +| LLaMA 4 | Y | . | Y | . | . | Y | . | . | . | . | . | +| Mistral | . | . | Y | . | . | Y | . | . | Y | . | . | +| Mixtral | Y | . | Y | . | . | Y | . | . | . | . | . | +| Phi | . | . | . | . | . | Y | . | Y | . | . | . | +| Qwen | . | . | . | . | . | Y | . | Y | Y | . | Y | +| Qwen-2/2.5 | Y | . | Y | . | . | Y | . | Y | Y | . | Y | +| Qwen-3 | Y | . | Y | . | . | Y | Y | . | Y | . | Y | +| BLIP2-OPT | . | . | . | . | . | Y | . | . | . | . | . | +| BLIP2-T5 | . | . | . | . | . | Y | . | . | . | . | . | +| LLaVA | . | . | Y | . | . | Y | . | . | Y | . | Y | +| VILA | . | . | Y | . | . | Y | . | . | Y | . | Y | +| Nougat | . | . | . | . | . | Y | . | . | . | . | . | + +Note + +The vision component of multi-modal models(BLIP2-OPT/BLIP2-T5/LLaVA/VILA/Nougat) uses FP16 by default. +The language component decides which quantization methods are supported by a given multi-modal model. + +## Hardware Support Matrix[#](#hardware-support-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | NVFP4 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| Blackwell(sm120) | Y | Y | Y | . | . | Y | . | . | . | . | . | +| Blackwell(sm100/103) | Y | Y | Y | Y | . | Y | Y | Y | Y | Y | Y | +| Hopper | . | . | Y | Y | Y | Y | . | Y | Y | Y | Y | +| Ada Lovelace | . | . | Y | . | . | Y | . | Y | Y | Y | Y | +| Ampere | . | . | . | . | . | Y | . | . | Y | . | Y | + +Note + +FP8 block wise scaling GEMM kernels for sm100/103 are using MXFP8 recipe (E4M3 act/weight and UE8M0 act/weight scale), which is slightly different from SM90 FP8 recipe (E4M3 act/weight and FP32 act/weight scale). + +## Quick Links[#](#quick-links "Link to this heading") + +* [Pre-quantized Models by ModelOpt](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) +* [ModelOpt Support Matrix](https://nvidia.github.io/Model-Optimizer/guides/0_support_matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_130rc2.md b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_130rc2.md new file mode 100644 index 0000000000000000000000000000000000000000..30543a4b67dffe68fe05bbb81b6cf5c0dc6ada1e --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quantization/quantization_130rc2.md @@ -0,0 +1,137 @@ +# Quantization# + +Source: https://nvidia.github.io/TensorRT-LLM/1.3.0rc2/features/quantization.html +Version: 1.3.0rc2 + +## Quantization in TensorRT LLM[#](#quantization-in-tensorrt-llm "Link to this heading") + +Quantization is a technique used to reduce memory footprint and computational cost by converting the model’s weights and/or activations from high-precision floating-point numbers (like BF16) to lower-precision data types, such as INT8, FP8, or FP4. + +TensorRT LLM offers a variety of quantization recipes to optimize LLM inference. These recipes can be broadly categorized as follows: + +* FP4 +* FP8 Per Tensor +* FP8 Block Scaling +* FP8 Rowwise +* FP8 KV Cache +* NVFP4 KV Cache +* W4A16 GPTQ +* W4A8 GPTQ +* W4A16 AWQ +* W4A8 AWQ + +## Usage[#](#usage "Link to this heading") + +The default PyTorch backend supports FP4 and FP8 quantization on the latest Blackwell and Hopper GPUs. + +### Running Pre-quantized Models[#](#running-pre-quantized-models "Link to this heading") + +TensorRT LLM can directly run [pre-quantized models](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) generated with the [NVIDIA Model Optimizer](https://github.com/NVIDIA/Model-Optimizer). + +```None +from tensorrt_llm import LLM +llm = LLM(model='nvidia/Llama-3.1-8B-Instruct-FP8') +llm.generate("Hello, my name is") +``` + +#### FP8 KV Cache[#](#fp8-kv-cache "Link to this heading") + +Note + +TensorRT LLM allows you to enable the FP8 KV cache manually, even for checkpoints that do not have it enabled by default. + +Here is an example of how to set the FP8 KV Cache option: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='fp8')) +llm.generate("Hello, my name is") +``` + +#### NVFP4 KV Cache[#](#nvfp4-kv-cache "Link to this heading") + +To enable NVFP4 KV cache, offline quantization with ModelOpt is required. Please follow the below section for instructions. +After the quantization is done, the NVFP4 KV cache option can be set by: + +```None +from tensorrt_llm import LLM +from tensorrt_llm.llmapi import KvCacheConfig +llm = LLM(model='/path/to/model', + kv_cache_config=KvCacheConfig(dtype='nvfp4')) +llm.generate("Hello, my name is") +``` + +### Offline Quantization with ModelOpt[#](#offline-quantization-with-modelopt "Link to this heading") + +If a pre-quantized model is not available on the [Hugging Face Hub](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4), you can quantize it offline using ModelOpt. + +Follow this step-by-step guide to quantize a model: + +```None +git clone https://github.com/NVIDIA/Model-Optimizer.git +cd Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 +``` + +#### NVFP4 KV Cache[#](#id1 "Link to this heading") + +To generate the checkpoint for NVFP4 KV cache: + +```None +git clone https://github.com/NVIDIA/Model-Optimizer.git +cd TensorRT-Model-Optimizer/examples/llm_ptq +scripts/huggingface_example.sh --model --quant fp8 --kv_cache_quant nvfp4 +``` + +Note that currently TRT-LLM only supports FP8 weight/activation quantization when NVFP4 KV cache is enabled. Therefore, `--quant fp8` is required here. + +## Model Supported Matrix[#](#model-supported-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | NVFP4 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| BERT | . | . | . | . | . | Y | . | . | . | . | . | +| DeepSeek-R1 | Y | . | . | Y | . | Y | . | . | . | . | . | +| EXAONE | . | . | Y | . | . | Y | . | Y | Y | . | . | +| Gemma 3 | . | . | Y | . | . | Y | . | Y | Y | . | . | +| GPT-OSS | . | Y | . | . | . | Y | . | . | . | . | . | +| LLaMA | Y | . | Y | . | . | Y | . | . | Y | . | Y | +| LLaMA-v2 | Y | . | Y | . | . | Y | Y | Y | Y | . | Y | +| LLaMA 3 | . | . | . | . | Y | Y | Y | Y | . | . | . | +| LLaMA 4 | Y | . | Y | . | . | Y | . | . | . | . | . | +| Mistral | . | . | Y | . | . | Y | . | . | Y | . | . | +| Mixtral | Y | . | Y | . | . | Y | . | . | . | . | . | +| Phi | . | . | . | . | . | Y | . | Y | . | . | . | +| Qwen | . | . | . | . | . | Y | . | Y | Y | . | Y | +| Qwen-2/2.5 | Y | . | Y | . | . | Y | . | Y | Y | . | Y | +| Qwen-3 | Y | . | Y | . | . | Y | Y | . | Y | . | Y | +| BLIP2-OPT | . | . | . | . | . | Y | . | . | . | . | . | +| BLIP2-T5 | . | . | . | . | . | Y | . | . | . | . | . | +| LLaVA | . | . | Y | . | . | Y | . | . | Y | . | Y | +| VILA | . | . | Y | . | . | Y | . | . | Y | . | Y | +| Nougat | . | . | . | . | . | Y | . | . | . | . | . | + +Note + +The vision component of multi-modal models(BLIP2-OPT/BLIP2-T5/LLaVA/VILA/Nougat) uses FP16 by default. +The language component decides which quantization methods are supported by a given multi-modal model. + +## Hardware Support Matrix[#](#hardware-support-matrix "Link to this heading") + +| Model | NVFP4 | MXFP4 | FP8(per tensor) | FP8(block scaling) | FP8(rowwise) | FP8 KV Cache | NVFP4 KV Cache | W4A8 AWQ | W4A16 AWQ | W4A8 GPTQ | W4A16 GPTQ | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| Blackwell(sm120) | Y | Y | Y | . | . | Y | . | . | . | . | . | +| Blackwell(sm100/103) | Y | Y | Y | Y | . | Y | Y | Y | Y | Y | Y | +| Hopper | . | . | Y | Y | Y | Y | . | Y | Y | Y | Y | +| Ada Lovelace | . | . | Y | . | . | Y | . | Y | Y | Y | Y | +| Ampere | . | . | . | . | . | Y | . | . | Y | . | Y | + +Note + +FP8 block wise scaling GEMM kernels for sm100/103 are using MXFP8 recipe (E4M3 act/weight and UE8M0 act/weight scale), which is slightly different from SM90 FP8 recipe (E4M3 act/weight and FP32 act/weight scale). + +## Quick Links[#](#quick-links "Link to this heading") + +* [Pre-quantized Models by ModelOpt](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) +* [ModelOpt Support Matrix](https://nvidia.github.io/Model-Optimizer/guides/0_support_matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_100.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_100.md new file mode 100644 index 0000000000000000000000000000000000000000..4ed18b32a74fea426a8b85f0c4b4112db5f85c0e --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_100.md @@ -0,0 +1,142 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.0.0/quick-start-guide.html +Version: 1.0.0 + +This is the starting point to try out TensorRT LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT LLM. + +## Launch Docker on a node with NVIDIA GPUs deployed[#](#launch-docker-on-a-node-with-nvidia-gpus-deployed "Link to this heading") + +```None +docker run --rm -it --ipc host --gpus all --ulimit memlock=-1 --ulimit stack=67108864 -p 8000:8000 nvcr.io/nvidia/tensorrt-llm/release:1.0.0 +``` + +## Deploy online serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +Note + +If you are running trtllm-server inside a Docker container, you have two options for sending API requests: + +1. Expose a port (e.g., 8000) to allow external access to the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](commands/trtllm-serve/trtllm-serve.html) section. + +## Run Offline inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing model loading, optimization, and inference, all through a single `LLM` instance. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or TensorRT Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load pre-quantized models [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you have: + +* Learned how to deploy a model with `trtllm-serve` for online serving +* Explored the LLM API for offline inference with TensorRT LLM + +To continue your journey with TensorRT LLM, explore these resources: + +* **[Installation Guide](installation/index.html)** - Detailed installation instructions for different platforms +* **[Deployment Guide](examples/llm_api_examples.html)** - Comprehensive examples for deploying LLM inference in various scenarios +* **[Model Support](models/supported-models.html)** - Check which models are supported and how to add new ones +* **CLI Reference** - Explore TensorRT LLM command-line tools: + + + [`trtllm-serve`](commands/trtllm-serve/trtllm-serve.html) - Deploy models for online serving + + [`trtllm-bench`](commands/trtllm-bench.html) - Benchmark model performance + + [`trtllm-eval`](commands/trtllm-eval.html) - Evaluate model accuracy diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_100rc5.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_100rc5.md new file mode 100644 index 0000000000000000000000000000000000000000..c506203c8a1aed814224dfef56032828c808d8d5 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_100rc5.md @@ -0,0 +1,217 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.0.0rc5/quick-start-guide.html +Version: 1.0.0rc5 + +This is the starting point to try out TensorRT-LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT-LLM. + +## Installation[#](#installation "Link to this heading") + +There are multiple ways to install and run TensorRT-LLM. For most users, the options below should be ordered from simple to complex. The approaches are equivalent in terms of the supported features. + +Note: **This project will download and install additional third-party open source software projects. Review the license terms of these open source projects before use.** + +1. [Pre-built release container images on NGC](installation/containers.html) +2. Pre-built release wheels on [PyPI](https://pypi.org/project/tensorrt-llm) (see [Installing on Linux via pip](installation/linux.html)) +3. [Building from source](installation/build-from-source-linux.html) + +The following examples can most easily be executed using the prebuilt [Docker release container available on NGC](https://registry.ngc.nvidia.com/orgs/nvstaging/teams/tensorrt-llm/containers/release) (see also [release.md](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docker/release.md) on GitHub). Ensure to run these commands as a user with appropriate permissions, preferably `root`, to streamline the setup process. + +## LLM API[#](#llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT-LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing checkpoint conversion, engine building, engine loading, and model inference, all through a single Python object. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or TensorRT Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load TensorRT Model Optimizer’s [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Deploy with trtllm-serve[#](#deploy-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +After the server starts, you can access familiar OpenAI endpoints such as `v1/chat/completions`. +You can run inference such as the following example from another terminal: + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](commands/trtllm-serve.html) section. If you are running `trtllm-server` inside a Docker container, you have two options for sending API requests: + +1. Expose port `8000` to access the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +## Model Definition API[#](#model-definition-api "Link to this heading") + +### Prerequisites[#](#prerequisites "Link to this heading") + +* This quick start uses the Meta Llama 3.1 model. This model is subject to a particular [license](https://llama.meta.com/llama-downloads/). To download the model files, agree to the terms and [authenticate with Hugging Face](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B-Instruct?clone=true). +* Complete the [installation](installation/linux.html) steps. +* Pull the weights and tokenizer files for the chat-tuned variant of the Llama 3.1 8B model from the [Hugging Face Hub](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B-Instruct). + + ```None + git clone https://huggingface.co/meta-llama/Meta-Llama-3.1-8B-Instruct + ``` + +### Compile the Model into a TensorRT Engine[#](#compile-the-model-into-a-tensorrt-engine "Link to this heading") + +Use the [Llama model definition](https://github.com/NVIDIA/TensorRT-LLM/tree/main/examples/models/core/llama) from the `examples/models/core/llama` directory of the GitHub repository. +The model definition is a minimal example that shows some of the optimizations available in TensorRT-LLM. + +```None +# From the root of the cloned repository, start the TensorRT-LLM container +make -C docker ngc-release_run LOCAL_USER=1 IMAGE_TAG=x.y.z + +# Log in to huggingface-cli +# You can get your token from huggingface.co/settings/token +huggingface-cli login --token ***** + +# Convert the model into TensorRT-LLM checkpoint format +cd examples/models/core/llama +pip install -r requirements.txt +pip install --upgrade transformers # Llama 3.1 requires transformer 4.43.0+ version. +python3 convert_checkpoint.py --model_dir Meta-Llama-3.1-8B-Instruct --output_dir llama-3.1-8b-ckpt + +# Compile model +trtllm-build --checkpoint_dir llama-3.1-8b-ckpt \ + --gemm_plugin float16 \ + --output_dir ./llama-3.1-8b-engine +``` + +Container image tags + +In the example shell commands, `x.y.z` corresponds to the TensorRT-LLM container +version to use. If omitted, `IMAGE_TAG` will default to `tensorrt_llm.__version__` +(e.g., this documentation was generated from the `1.0.0rc5` source tree). +If this does not work, e.g., because a container for the version you are +currently working with has not been released yet, you can try using a +container published for a previous +[GitHub pre-release or release](https://github.com/NVIDIA/TensorRT-LLM/releases) +(see also [NGC Catalog](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/tensorrt-llm/containers/release/tags)). + +When you create a model definition with the TensorRT-LLM API, you build a graph of operations from [NVIDIA TensorRT](https://developer.nvidia.com/tensorrt) primitives that form the layers of your neural network. These operations map to specific kernels; prewritten programs for the GPU. + +In this example, we included the `gpt_attention` plugin, which implements a FlashAttention-like fused attention kernel, and the `gemm` plugin, that performs matrix multiplication with FP32 accumulation. We also called out the desired precision for the full model as FP16, matching the default precision of the weights that you downloaded from Hugging Face. For more information about plugins and quantizations, refer to the [Llama example](https://github.com/NVIDIA/TensorRT-LLM/tree/main/examples/models/core/llama) and [Numerical Precision](reference/precision.html#precision) section. + +### Run the Model[#](#run-the-model "Link to this heading") + +Now that you have the model engine, run the engine and perform inference. + +```None +python3 ../run.py --engine_dir ./llama-3.1-8b-engine --max_output_len 100 --tokenizer_dir Meta-Llama-3.1-8B-Instruct --input_text "How do I count to nine in French?" +``` + +### Deploy with Triton Inference Server[#](#deploy-with-triton-inference-server "Link to this heading") + +To create a production-ready deployment of your LLM, use the [Triton Inference Server backend for TensorRT-LLM](https://github.com/triton-inference-server/tensorrtllm_backend) to leverage the TensorRT-LLM C++ runtime for rapid inference execution and include optimizations like in-flight batching and paged KV caching. Triton Inference Server with the TensorRT-LLM backend is available as a [pre-built container through NVIDIA NGC](https://catalog.ngc.nvidia.com/orgs/nvidia/containers/tritonserver/tags). + +1. Clone the TensorRT-LLM backend repository: + +```None +cd .. +git clone https://github.com/triton-inference-server/tensorrtllm_backend.git +cd tensorrtllm_backend +``` + +2. Refer to [End to end workflow to run llama 7b](https://github.com/triton-inference-server/tensorrtllm_backend/blob/main/docs/llama.md) in the TensorRT-LLM backend repository to deploy the model with Triton Inference Server. + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you: + +* Saw an example of the LLM API +* Learned about deploying a model with `trtllm-serve` +* Learned about the Model Definition API + +For more examples, refer to: + +* [examples](https://github.com/NVIDIA/TensorRT-LLM/tree/main/examples) for showcases of how to run a quick benchmark on latest LLMs. + +## Related Information[#](#related-information "Link to this heading") + +* [Best Practices Guide](https://nvidia.github.io/TensorRT-LLM/performance/performance-tuning-guide/index.html) +* [Support Matrix](https://nvidia.github.io/TensorRT-LLM/reference/support-matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_100rc6.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_100rc6.md new file mode 100644 index 0000000000000000000000000000000000000000..e66ede20ffea67bf74a25fdc2003c87552bdd5d8 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_100rc6.md @@ -0,0 +1,159 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.0.0rc6/quick-start-guide.html +Version: 1.0.0rc6 + +This is the starting point to try out TensorRT-LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT-LLM. + +## Installation[#](#installation "Link to this heading") + +There are multiple ways to install and run TensorRT-LLM. For most users, the options below should be ordered from simple to complex. The approaches are equivalent in terms of the supported features. + +Note: **This project will download and install additional third-party open source software projects. Review the license terms of these open source projects before use.** + +1. [Pre-built release container images on NGC](installation/containers.html) +2. Pre-built release wheels on [PyPI](https://pypi.org/project/tensorrt-llm) (see [Installing on Linux via pip](installation/linux.html)) +3. [Building from source](installation/build-from-source-linux.html) + +The following examples can most easily be executed using the prebuilt [Docker release container available on NGC](https://registry.ngc.nvidia.com/orgs/nvstaging/teams/tensorrt-llm/containers/release) (see also [release.md](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docker/release.md) on GitHub). Ensure to run these commands as a user with appropriate permissions, preferably `root`, to streamline the setup process. + +## Launch Docker on a node with NVIDIA GPUs deployed.[#](#launch-docker-on-a-node-with-nvidia-gpus-deployed "Link to this heading") + +```None +docker run --ipc host --gpus all -it nvcr.io/nvidia/tensorrt-llm/release +``` + +## Run Offline inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT-LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing checkpoint conversion, engine building, engine loading, and model inference, all through a single Python object. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or TensorRT Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load TensorRT Model Optimizer’s [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Deploy online serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +> [!NOTE] +> If you are running `trtllm-server` inside a Docker container, you have two options for sending API requests: + +> 1. Expose port `8000` to access the server from outside the container. + +> 2. Open a new terminal and use the following command to directly attach to the running container: + +> ```None +> docker exec -it bash +> ``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](#commands/trtllm-serve.rst) section. + +1. Expose port `8000` to access the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you: + +* Saw an example of the LLM API +* Learned about deploying a model with `trtllm-serve` + +For more examples, refer to: + +* [examples](https://github.com/NVIDIA/TensorRT-LLM/tree/main/examples) for showcases of how to run a quick benchmark on latest LLMs. + +## Related Information[#](#related-information "Link to this heading") + +* [Best Practices Guide](https://nvidia.github.io/TensorRT-LLM/performance/performance-tuning-guide/index.html) +* [Support Matrix](https://nvidia.github.io/TensorRT-LLM/reference/support-matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110.md new file mode 100644 index 0000000000000000000000000000000000000000..844458fa526e7f6897be3a94998ea610842ba9e2 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110.md @@ -0,0 +1,151 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0/quick-start-guide.html +Version: 1.1.0 + +This is the starting point to try out TensorRT LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT LLM. + +## Launch Docker on a node with NVIDIA GPUs deployed[#](#launch-docker-on-a-node-with-nvidia-gpus-deployed "Link to this heading") + +```None +docker run --rm -it --ipc host --gpus all --ulimit memlock=-1 --ulimit stack=67108864 -p 8000:8000 nvcr.io/nvidia/tensorrt-llm/release:1.1.0 +``` + +## Deploy online serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +You may also deploy pre-quantized models to improve performance. +Ensure your GPU supports FP8 quantization before running the following: + +```None +trtllm-serve "nvidia/Qwen3-8B-FP8" +``` + +For more options, browse the full [collection of generative models](https://huggingface.co/collections/nvidia/inference-optimized-checkpoints-with-model-optimizer) that have been quantized and optimized for inference with the TensorRT Model Optimizer. + +Note + +If you are running trtllm-server inside a Docker container, you have two options for sending API requests: + +1. Expose a port (e.g., 8000) to allow external access to the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](commands/trtllm-serve/trtllm-serve.html) section. + +## Run Offline inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing model loading, optimization, and inference, all through a single `LLM` instance. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or TensorRT Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load pre-quantized models [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you have: + +* Learned how to deploy a model with `trtllm-serve` for online serving +* Explored the LLM API for offline inference with TensorRT LLM + +To continue your journey with TensorRT LLM, explore these resources: + +* **[Installation Guide](installation/index.html)** - Detailed installation instructions for different platforms +* **[Deployment Guide](examples/llm_api_examples.html)** - Comprehensive examples for deploying LLM inference in various scenarios +* **[Model Support](models/supported-models.html)** - Check which models are supported and how to add new ones +* **CLI Reference** - Explore TensorRT LLM command-line tools: + + + [`trtllm-serve`](commands/trtllm-serve/trtllm-serve.html) - Deploy models for online serving + + [`trtllm-bench`](commands/trtllm-bench.html) - Benchmark model performance + + [`trtllm-eval`](commands/trtllm-eval.html) - Evaluate model accuracy diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110rc0.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110rc0.md new file mode 100644 index 0000000000000000000000000000000000000000..7aa58ffc9a1db7258824fe310cba28ea74d18f3f --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110rc0.md @@ -0,0 +1,159 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0rc0/quick-start-guide.html +Version: 1.1.0rc0 + +This is the starting point to try out TensorRT-LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT-LLM. + +## Installation[#](#installation "Link to this heading") + +There are multiple ways to install and run TensorRT-LLM. For most users, the options below should be ordered from simple to complex. The approaches are equivalent in terms of the supported features. + +Note: **This project will download and install additional third-party open source software projects. Review the license terms of these open source projects before use.** + +1. [Pre-built release container images on NGC](installation/containers.html) +2. Pre-built release wheels on [PyPI](https://pypi.org/project/tensorrt-llm) (see [Installing on Linux via pip](installation/linux.html)) +3. [Building from source](installation/build-from-source-linux.html) + +The following examples can most easily be executed using the prebuilt [Docker release container available on NGC](https://registry.ngc.nvidia.com/orgs/nvstaging/teams/tensorrt-llm/containers/release) (see also [release.md](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docker/release.md) on GitHub). Ensure to run these commands as a user with appropriate permissions, preferably `root`, to streamline the setup process. + +## Launch Docker on a node with NVIDIA GPUs deployed.[#](#launch-docker-on-a-node-with-nvidia-gpus-deployed "Link to this heading") + +```None +docker run --ipc host --gpus all -it nvcr.io/nvidia/tensorrt-llm/release +``` + +## Run Offline inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT-LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing checkpoint conversion, engine building, engine loading, and model inference, all through a single Python object. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or TensorRT Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load TensorRT Model Optimizer’s [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Deploy online serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +> [!NOTE] +> If you are running `trtllm-server` inside a Docker container, you have two options for sending API requests: + +> 1. Expose port `8000` to access the server from outside the container. + +> 2. Open a new terminal and use the following command to directly attach to the running container: + +> ```None +> docker exec -it bash +> ``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](#commands/trtllm-serve.rst) section. + +1. Expose port `8000` to access the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you: + +* Saw an example of the LLM API +* Learned about deploying a model with `trtllm-serve` + +For more examples, refer to: + +* [examples](https://github.com/NVIDIA/TensorRT-LLM/tree/main/examples) for showcases of how to run a quick benchmark on latest LLMs. + +## Related Information[#](#related-information "Link to this heading") + +* [Best Practices Guide](https://nvidia.github.io/TensorRT-LLM/performance/performance-tuning-guide/index.html) +* [Support Matrix](https://nvidia.github.io/TensorRT-LLM/reference/support-matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110rc1.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110rc1.md new file mode 100644 index 0000000000000000000000000000000000000000..65c48da1025c0fdb429753fe7ec3b0b0e094bae1 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110rc1.md @@ -0,0 +1,159 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0rc1/quick-start-guide.html +Version: 1.1.0rc1 + +This is the starting point to try out TensorRT-LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT-LLM. + +## Installation[#](#installation "Link to this heading") + +There are multiple ways to install and run TensorRT-LLM. For most users, the options below should be ordered from simple to complex. The approaches are equivalent in terms of the supported features. + +Note: **This project will download and install additional third-party open source software projects. Review the license terms of these open source projects before use.** + +1. [Pre-built release container images on NGC](installation/containers.html) +2. Pre-built release wheels on [PyPI](https://pypi.org/project/tensorrt-llm) (see [Installing on Linux via pip](installation/linux.html)) +3. [Building from source](installation/build-from-source-linux.html) + +The following examples can most easily be executed using the prebuilt [Docker release container available on NGC](https://registry.ngc.nvidia.com/orgs/nvstaging/teams/tensorrt-llm/containers/release) (see also [release.md](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docker/release.md) on GitHub). Ensure to run these commands as a user with appropriate permissions, preferably `root`, to streamline the setup process. + +## Launch Docker on a node with NVIDIA GPUs deployed.[#](#launch-docker-on-a-node-with-nvidia-gpus-deployed "Link to this heading") + +```None +docker run --ipc host --gpus all -it nvcr.io/nvidia/tensorrt-llm/release +``` + +## Run Offline inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT-LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing checkpoint conversion, engine building, engine loading, and model inference, all through a single Python object. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or TensorRT Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load TensorRT Model Optimizer’s [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Deploy online serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +> [!NOTE] +> If you are running `trtllm-server` inside a Docker container, you have two options for sending API requests: + +> 1. Expose port `8000` to access the server from outside the container. + +> 2. Open a new terminal and use the following command to directly attach to the running container: + +> ```None +> docker exec -it bash +> ``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](#commands/trtllm-serve.rst) section. + +1. Expose port `8000` to access the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you: + +* Saw an example of the LLM API +* Learned about deploying a model with `trtllm-serve` + +For more examples, refer to: + +* [examples](https://github.com/NVIDIA/TensorRT-LLM/tree/main/examples) for showcases of how to run a quick benchmark on latest LLMs. + +## Related Information[#](#related-information "Link to this heading") + +* [Best Practices Guide](https://nvidia.github.io/TensorRT-LLM/performance/performance-tuning-guide/index.html) +* [Support Matrix](https://nvidia.github.io/TensorRT-LLM/reference/support-matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110rc2.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110rc2.md new file mode 100644 index 0000000000000000000000000000000000000000..a17ffb7b56ed4c54a524a6c7d3d6043812adb810 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110rc2.md @@ -0,0 +1,159 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0rc2/quick-start-guide.html +Version: 1.1.0rc2 + +This is the starting point to try out TensorRT-LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT-LLM. + +## Installation[#](#installation "Link to this heading") + +There are multiple ways to install and run TensorRT-LLM. For most users, the options below should be ordered from simple to complex. The approaches are equivalent in terms of the supported features. + +Note: **This project will download and install additional third-party open source software projects. Review the license terms of these open source projects before use.** + +1. [Pre-built release container images on NGC](installation/containers.html) +2. Pre-built release wheels on [PyPI](https://pypi.org/project/tensorrt-llm) (see [Installing on Linux via pip](installation/linux.html)) +3. [Building from source](installation/build-from-source-linux.html) + +The following examples can most easily be executed using the prebuilt [Docker release container available on NGC](https://registry.ngc.nvidia.com/orgs/nvstaging/teams/tensorrt-llm/containers/release) (see also [release.md](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docker/release.md) on GitHub). Ensure to run these commands as a user with appropriate permissions, preferably `root`, to streamline the setup process. + +## Launch Docker on a node with NVIDIA GPUs deployed.[#](#launch-docker-on-a-node-with-nvidia-gpus-deployed "Link to this heading") + +```None +docker run --ipc host --gpus all -it nvcr.io/nvidia/tensorrt-llm/release +``` + +## Run Offline inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT-LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing checkpoint conversion, engine building, engine loading, and model inference, all through a single Python object. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or TensorRT Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load TensorRT Model Optimizer’s [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Deploy online serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +> [!NOTE] +> If you are running `trtllm-server` inside a Docker container, you have two options for sending API requests: + +> 1. Expose port `8000` to access the server from outside the container. + +> 2. Open a new terminal and use the following command to directly attach to the running container: + +> ```None +> docker exec -it bash +> ``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](#commands/trtllm-serve.rst) section. + +1. Expose port `8000` to access the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you: + +* Saw an example of the LLM API +* Learned about deploying a model with `trtllm-serve` + +For more examples, refer to: + +* [examples](https://github.com/NVIDIA/TensorRT-LLM/tree/main/examples) for showcases of how to run a quick benchmark on latest LLMs. + +## Related Information[#](#related-information "Link to this heading") + +* [Best Practices Guide](https://nvidia.github.io/TensorRT-LLM/performance/performance-tuning-guide/index.html) +* [Support Matrix](https://nvidia.github.io/TensorRT-LLM/reference/support-matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110rc3.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110rc3.md new file mode 100644 index 0000000000000000000000000000000000000000..db518b0a1a13252641c6738d3e9194ab384c5116 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110rc3.md @@ -0,0 +1,165 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0rc3/quick-start-guide.html +Version: 1.1.0rc3 + +This is the starting point to try out TensorRT-LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT-LLM. + +## Installation[#](#installation "Link to this heading") + +There are multiple ways to install and run TensorRT-LLM. For most users, the options below should be ordered from simple to complex. The approaches are equivalent in terms of the supported features. + +Note: **This project will download and install additional third-party open source software projects. Review the license terms of these open source projects before use.** + +1. [Pre-built release container images on NGC](installation/containers.html) +2. Pre-built release wheels on [PyPI](https://pypi.org/project/tensorrt-llm) (see [Installing on Linux via pip](installation/linux.html)) +3. [Building from source](installation/build-from-source-linux.html) + +The following examples can most easily be executed using the prebuilt [Docker release container available on NGC](https://registry.ngc.nvidia.com/orgs/nvstaging/teams/tensorrt-llm/containers/release) (see also [release.md](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docker/release.md) on GitHub). Ensure to run these commands as a user with appropriate permissions, preferably `root`, to streamline the setup process. + +## Launch Docker on a node with NVIDIA GPUs deployed.[#](#launch-docker-on-a-node-with-nvidia-gpus-deployed "Link to this heading") + +```None +docker run --ipc host --gpus all -it nvcr.io/nvidia/tensorrt-llm/release +``` + +## Run Offline inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT-LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing checkpoint conversion, engine building, engine loading, and model inference, all through a single Python object. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import BuildConfig, SamplingParams + 2from tensorrt_llm._tensorrt_engine import LLM # NOTE the change + 3 + 4 + 5def main(): + 6 + 7 build_config = BuildConfig() + 8 build_config.max_batch_size = 256 + 9 build_config.max_num_tokens = 1024 +10 +11 # Model could accept HF model name, a path to local HF model, +12 # or TensorRT Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. +13 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0", +14 build_config=build_config) +15 +16 # Sample prompts. +17 prompts = [ +18 "Hello, my name is", +19 "The capital of France is", +20 "The future of AI is", +21 ] +22 +23 # Create a sampling params. +24 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +25 +26 for output in llm.generate(prompts, sampling_params): +27 print( +28 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +29 ) +30 +31 # Got output like +32 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +33 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +34 # Prompt: 'The capital of France is', Generated text: 'Paris.' +35 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +36 +37 +38if __name__ == '__main__': +39 main() +``` + +You can also directly load TensorRT Model Optimizer’s [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Deploy online serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +> [!NOTE] +> If you are running `trtllm-server` inside a Docker container, you have two options for sending API requests: + +> 1. Expose port `8000` to access the server from outside the container. + +> 2. Open a new terminal and use the following command to directly attach to the running container: + +> ```None +> docker exec -it bash +> ``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](#commands/trtllm-serve.rst) section. + +1. Expose port `8000` to access the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you: + +* Saw an example of the LLM API +* Learned about deploying a model with `trtllm-serve` + +For more examples, refer to: + +* [examples](https://github.com/NVIDIA/TensorRT-LLM/tree/main/examples) for showcases of how to run a quick benchmark on latest LLMs. + +## Related Information[#](#related-information "Link to this heading") + +* [Best Practices Guide](https://nvidia.github.io/TensorRT-LLM/performance/performance-tuning-guide/index.html) +* [Support Matrix](https://nvidia.github.io/TensorRT-LLM/reference/support-matrix.html) diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110rc4.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110rc4.md new file mode 100644 index 0000000000000000000000000000000000000000..04fabaa9d73475461510968c7c1a6a78423e6ed9 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110rc4.md @@ -0,0 +1,142 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0rc4/quick-start-guide.html +Version: 1.1.0rc4 + +This is the starting point to try out TensorRT LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT LLM. + +## Launch Docker on a node with NVIDIA GPUs deployed[#](#launch-docker-on-a-node-with-nvidia-gpus-deployed "Link to this heading") + +```None +docker run --ipc host --gpus all -p 8000:8000 -it nvcr.io/nvidia/tensorrt-llm/release +``` + +## Deploy online serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +Note + +If you are running trtllm-server inside a Docker container, you have two options for sending API requests: + +1. Expose a port (e.g., 8000) to allow external access to the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](commands/trtllm-serve/trtllm-serve.html) section. + +## Run Offline inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing model loading, optimization, and inference, all through a single `LLM` instance. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or TensorRT Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load pre-quantized models [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you have: + +* Learned how to deploy a model with `trtllm-serve` for online serving +* Explored the LLM API for offline inference with TensorRT LLM + +To continue your journey with TensorRT LLM, explore these resources: + +* **[Installation Guide](installation/index.html)** - Detailed installation instructions for different platforms +* **[Deployment Guide](examples/llm_api_examples.html)** - Comprehensive examples for deploying LLM inference in various scenarios +* **[Model Support](models/supported-models.html)** - Check which models are supported and how to add new ones +* **CLI Reference** - Explore TensorRT LLM command-line tools: + + + [`trtllm-serve`](commands/trtllm-serve/trtllm-serve.html) - Deploy models for online serving + + [`trtllm-bench`](commands/trtllm-bench.html) - Benchmark model performance + + [`trtllm-eval`](commands/trtllm-eval.html) - Evaluate model accuracy diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110rc5.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110rc5.md new file mode 100644 index 0000000000000000000000000000000000000000..369f0c1cfabfd52755a0d4023e4794c3d0c33a01 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_110rc5.md @@ -0,0 +1,142 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0rc5/quick-start-guide.html +Version: 1.1.0rc5 + +This is the starting point to try out TensorRT LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT LLM. + +## Launch Docker on a node with NVIDIA GPUs deployed[#](#launch-docker-on-a-node-with-nvidia-gpus-deployed "Link to this heading") + +```None +docker run --ipc host --gpus all -p 8000:8000 -it nvcr.io/nvidia/tensorrt-llm/release +``` + +## Deploy online serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +Note + +If you are running trtllm-server inside a Docker container, you have two options for sending API requests: + +1. Expose a port (e.g., 8000) to allow external access to the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](commands/trtllm-serve/trtllm-serve.html) section. + +## Run Offline inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing model loading, optimization, and inference, all through a single `LLM` instance. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or TensorRT Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load pre-quantized models [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you have: + +* Learned how to deploy a model with `trtllm-serve` for online serving +* Explored the LLM API for offline inference with TensorRT LLM + +To continue your journey with TensorRT LLM, explore these resources: + +* **[Installation Guide](installation/index.html)** - Detailed installation instructions for different platforms +* **[Deployment Guide](examples/llm_api_examples.html)** - Comprehensive examples for deploying LLM inference in various scenarios +* **[Model Support](models/supported-models.html)** - Check which models are supported and how to add new ones +* **CLI Reference** - Explore TensorRT LLM command-line tools: + + + [`trtllm-serve`](commands/trtllm-serve/trtllm-serve.html) - Deploy models for online serving + + [`trtllm-bench`](commands/trtllm-bench.html) - Benchmark model performance + + [`trtllm-eval`](commands/trtllm-eval.html) - Evaluate model accuracy diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc0.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc0.md new file mode 100644 index 0000000000000000000000000000000000000000..8198be9d751fa4961c62125537a1a8f495776dc9 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc0.md @@ -0,0 +1,142 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc0/quick-start-guide.html +Version: 1.2.0rc0 + +This is the starting point to try out TensorRT LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT LLM. + +## Launch Docker on a node with NVIDIA GPUs deployed[#](#launch-docker-on-a-node-with-nvidia-gpus-deployed "Link to this heading") + +```None +docker run --rm -it --ipc host --gpus all --ulimit memlock=-1 --ulimit stack=67108864 -p 8000:8000 nvcr.io/nvidia/tensorrt-llm/release:1.2.0rc0 +``` + +## Deploy online serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +Note + +If you are running trtllm-server inside a Docker container, you have two options for sending API requests: + +1. Expose a port (e.g., 8000) to allow external access to the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](commands/trtllm-serve/trtllm-serve.html) section. + +## Run Offline inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing model loading, optimization, and inference, all through a single `LLM` instance. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or TensorRT Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load pre-quantized models [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you have: + +* Learned how to deploy a model with `trtllm-serve` for online serving +* Explored the LLM API for offline inference with TensorRT LLM + +To continue your journey with TensorRT LLM, explore these resources: + +* **[Installation Guide](installation/index.html)** - Detailed installation instructions for different platforms +* **[Deployment Guide](examples/llm_api_examples.html)** - Comprehensive examples for deploying LLM inference in various scenarios +* **[Model Support](models/supported-models.html)** - Check which models are supported and how to add new ones +* **CLI Reference** - Explore TensorRT LLM command-line tools: + + + [`trtllm-serve`](commands/trtllm-serve/trtllm-serve.html) - Deploy models for online serving + + [`trtllm-bench`](commands/trtllm-bench.html) - Benchmark model performance + + [`trtllm-eval`](commands/trtllm-eval.html) - Evaluate model accuracy diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc1.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc1.md new file mode 100644 index 0000000000000000000000000000000000000000..0b19207a4e46dd559a2453085d4c5ace37f83647 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc1.md @@ -0,0 +1,142 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc1/quick-start-guide.html +Version: 1.2.0rc1 + +This is the starting point to try out TensorRT LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT LLM. + +## Launch Docker on a node with NVIDIA GPUs deployed[#](#launch-docker-on-a-node-with-nvidia-gpus-deployed "Link to this heading") + +```None +docker run --rm -it --ipc host --gpus all --ulimit memlock=-1 --ulimit stack=67108864 -p 8000:8000 nvcr.io/nvidia/tensorrt-llm/release:1.2.0rc1 +``` + +## Deploy online serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +Note + +If you are running trtllm-server inside a Docker container, you have two options for sending API requests: + +1. Expose a port (e.g., 8000) to allow external access to the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](commands/trtllm-serve/trtllm-serve.html) section. + +## Run Offline inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing model loading, optimization, and inference, all through a single `LLM` instance. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or TensorRT Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load pre-quantized models [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you have: + +* Learned how to deploy a model with `trtllm-serve` for online serving +* Explored the LLM API for offline inference with TensorRT LLM + +To continue your journey with TensorRT LLM, explore these resources: + +* **[Installation Guide](installation/index.html)** - Detailed installation instructions for different platforms +* **[Deployment Guide](examples/llm_api_examples.html)** - Comprehensive examples for deploying LLM inference in various scenarios +* **[Model Support](models/supported-models.html)** - Check which models are supported and how to add new ones +* **CLI Reference** - Explore TensorRT LLM command-line tools: + + + [`trtllm-serve`](commands/trtllm-serve/trtllm-serve.html) - Deploy models for online serving + + [`trtllm-bench`](commands/trtllm-bench.html) - Benchmark model performance + + [`trtllm-eval`](commands/trtllm-eval.html) - Evaluate model accuracy diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc2.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc2.md new file mode 100644 index 0000000000000000000000000000000000000000..bf2a284461eeba5d8a51018402c815d3a7319477 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc2.md @@ -0,0 +1,149 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc2/quick-start-guide.html +Version: 1.2.0rc2 + +This is the starting point to try out TensorRT LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT LLM. + +## Launch Docker Container[#](#launch-docker-container "Link to this heading") + +The [TensorRT LLM container](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/tensorrt-llm/containers/release/tags) maintained by NVIDIA contains all of the required dependencies pre-installed. You can start the container on a machine with NVIDIA GPUs via: + +```None +docker run --rm -it --ipc host --gpus all --ulimit memlock=-1 --ulimit stack=67108864 -p 8000:8000 nvcr.io/nvidia/tensorrt-llm/release:1.2.0rc2 +``` + +## Deploy Online Serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +Note + +If you are running `trtllm-serve` inside a Docker container, you have two options for sending API requests: + +1. Expose a port (e.g., 8000) to allow external access to the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](commands/trtllm-serve/trtllm-serve.html) section. + +Note + +Pre-configured settings for deploying popular models with `trtllm-serve` can be found in our [deployment guides](deployment-guide/index.html). + +## Run Offline Inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing model loading, optimization, and inference, all through a single `LLM` instance. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or TensorRT Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load pre-quantized models [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you have: + +* Learned how to deploy a model with `trtllm-serve` for online serving +* Explored the LLM API for offline inference with TensorRT LLM + +To continue your journey with TensorRT LLM, explore these resources: + +* **[Installation Guide](installation/index.html)** - Detailed installation instructions for different platforms +* **[Model-Specific Deployment Guides](deployment-guide/index.html)** - Instructions for serving specific models with TensorRT LLM +* **[Deployment Guide](examples/llm_api_examples.html)** - Comprehensive examples for deploying LLM inference in various scenarios +* **[Model Support](models/supported-models.html)** - Check which models are supported and how to add new ones +* **CLI Reference** - Explore TensorRT LLM command-line tools: + + + [`trtllm-serve`](commands/trtllm-serve/trtllm-serve.html) - Deploy models for online serving + + [`trtllm-bench`](commands/trtllm-bench.html) - Benchmark model performance + + [`trtllm-eval`](commands/trtllm-eval.html) - Evaluate model accuracy diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc3.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc3.md new file mode 100644 index 0000000000000000000000000000000000000000..cf47bc5301670e9d84778d384f312f8ac647a4e3 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc3.md @@ -0,0 +1,149 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc3/quick-start-guide.html +Version: 1.2.0rc3 + +This is the starting point to try out TensorRT LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT LLM. + +## Launch Docker Container[#](#launch-docker-container "Link to this heading") + +The [TensorRT LLM container](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/tensorrt-llm/containers/release/tags) maintained by NVIDIA contains all of the required dependencies pre-installed. You can start the container on a machine with NVIDIA GPUs via: + +```None +docker run --rm -it --ipc host --gpus all --ulimit memlock=-1 --ulimit stack=67108864 -p 8000:8000 nvcr.io/nvidia/tensorrt-llm/release:1.2.0rc3 +``` + +## Deploy Online Serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +Note + +If you are running `trtllm-serve` inside a Docker container, you have two options for sending API requests: + +1. Expose a port (e.g., 8000) to allow external access to the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](commands/trtllm-serve/trtllm-serve.html) section. + +Note + +Pre-configured settings for deploying popular models with `trtllm-serve` can be found in our [deployment guides](deployment-guide/index.html). + +## Run Offline Inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing model loading, optimization, and inference, all through a single `LLM` instance. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or TensorRT Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load pre-quantized models [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you have: + +* Learned how to deploy a model with `trtllm-serve` for online serving +* Explored the LLM API for offline inference with TensorRT LLM + +To continue your journey with TensorRT LLM, explore these resources: + +* **[Installation Guide](installation/index.html)** - Detailed installation instructions for different platforms +* **[Model-Specific Deployment Guides](deployment-guide/index.html)** - Instructions for serving specific models with TensorRT LLM +* **[Deployment Guide](examples/llm_api_examples.html)** - Comprehensive examples for deploying LLM inference in various scenarios +* **[Model Support](models/supported-models.html)** - Check which models are supported and how to add new ones +* **CLI Reference** - Explore TensorRT LLM command-line tools: + + + [`trtllm-serve`](commands/trtllm-serve/trtllm-serve.html) - Deploy models for online serving + + [`trtllm-bench`](commands/trtllm-bench.html) - Benchmark model performance + + [`trtllm-eval`](commands/trtllm-eval.html) - Evaluate model accuracy diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc4.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc4.md new file mode 100644 index 0000000000000000000000000000000000000000..48a56490de56d4947bafcac7a082f398edec55fa --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc4.md @@ -0,0 +1,149 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc4/quick-start-guide.html +Version: 1.2.0rc4 + +This is the starting point to try out TensorRT LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT LLM. + +## Launch Docker Container[#](#launch-docker-container "Link to this heading") + +The [TensorRT LLM container](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/tensorrt-llm/containers/release/tags) maintained by NVIDIA contains all of the required dependencies pre-installed. You can start the container on a machine with NVIDIA GPUs via: + +```None +docker run --rm -it --ipc host --gpus all --ulimit memlock=-1 --ulimit stack=67108864 -p 8000:8000 nvcr.io/nvidia/tensorrt-llm/release:1.2.0rc4 +``` + +## Deploy Online Serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +Note + +If you are running `trtllm-serve` inside a Docker container, you have two options for sending API requests: + +1. Expose a port (e.g., 8000) to allow external access to the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](commands/trtllm-serve/trtllm-serve.html) section. + +Note + +Pre-configured settings for deploying popular models with `trtllm-serve` can be found in our [deployment guides](deployment-guide/index.html). + +## Run Offline Inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing model loading, optimization, and inference, all through a single `LLM` instance. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or TensorRT Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load pre-quantized models [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you have: + +* Learned how to deploy a model with `trtllm-serve` for online serving +* Explored the LLM API for offline inference with TensorRT LLM + +To continue your journey with TensorRT LLM, explore these resources: + +* **[Installation Guide](installation/index.html)** - Detailed installation instructions for different platforms +* **[Model-Specific Deployment Guides](deployment-guide/index.html)** - Instructions for serving specific models with TensorRT LLM +* **[Deployment Guide](examples/llm_api_examples.html)** - Comprehensive examples for deploying LLM inference in various scenarios +* **[Model Support](models/supported-models.html)** - Check which models are supported and how to add new ones +* **CLI Reference** - Explore TensorRT LLM command-line tools: + + + [`trtllm-serve`](commands/trtllm-serve/trtllm-serve.html) - Deploy models for online serving + + [`trtllm-bench`](commands/trtllm-bench.html) - Benchmark model performance + + [`trtllm-eval`](commands/trtllm-eval.html) - Evaluate model accuracy diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc5.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc5.md new file mode 100644 index 0000000000000000000000000000000000000000..e0fe3808ef34f17d8121434309ea913e09738cb7 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc5.md @@ -0,0 +1,158 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc5/quick-start-guide.html +Version: 1.2.0rc5 + +This is the starting point to try out TensorRT LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT LLM. + +## Launch Docker Container[#](#launch-docker-container "Link to this heading") + +The [TensorRT LLM container](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/tensorrt-llm/containers/release/tags) maintained by NVIDIA contains all of the required dependencies pre-installed. You can start the container on a machine with NVIDIA GPUs via: + +```None +docker run --rm -it --ipc host --gpus all --ulimit memlock=-1 --ulimit stack=67108864 -p 8000:8000 nvcr.io/nvidia/tensorrt-llm/release:1.2.0rc5 +``` + +## Deploy Online Serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +You may also deploy pre-quantized models to improve performance. +Ensure your GPU supports FP8 quantization before running the following: + +```None +trtllm-serve "nvidia/Qwen3-8B-FP8" +``` + +For more options, browse the full [collection of generative models](https://huggingface.co/collections/nvidia/inference-optimized-checkpoints-with-model-optimizer) that have been quantized and optimized for inference with the TensorRT Model Optimizer. + +Note + +If you are running `trtllm-serve` inside a Docker container, you have two options for sending API requests: + +1. Expose a port (e.g., 8000) to allow external access to the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](commands/trtllm-serve/trtllm-serve.html) section. + +Note + +Pre-configured settings for deploying popular models with `trtllm-serve` can be found in our [deployment guides](deployment-guide/index.html). + +## Run Offline Inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing model loading, optimization, and inference, all through a single `LLM` instance. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or TensorRT Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load pre-quantized models [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you have: + +* Learned how to deploy a model with `trtllm-serve` for online serving +* Explored the LLM API for offline inference with TensorRT LLM + +To continue your journey with TensorRT LLM, explore these resources: + +* **[Installation Guide](installation/index.html)** - Detailed installation instructions for different platforms +* **[Model-Specific Deployment Guides](deployment-guide/index.html)** - Instructions for serving specific models with TensorRT LLM +* **[Deployment Guide](examples/llm_api_examples.html)** - Comprehensive examples for deploying LLM inference in various scenarios +* **[Model Support](models/supported-models.html)** - Check which models are supported and how to add new ones +* **CLI Reference** - Explore TensorRT LLM command-line tools: + + + [`trtllm-serve`](commands/trtllm-serve/trtllm-serve.html) - Deploy models for online serving + + [`trtllm-bench`](commands/trtllm-bench.html) - Benchmark model performance + + [`trtllm-eval`](commands/trtllm-eval.html) - Evaluate model accuracy diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc6.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc6.md new file mode 100644 index 0000000000000000000000000000000000000000..32af96d9658894437ec5251e4f699d93c490787c --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc6.md @@ -0,0 +1,158 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc6/quick-start-guide.html +Version: 1.2.0rc6 + +This is the starting point to try out TensorRT LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT LLM. + +## Launch Docker Container[#](#launch-docker-container "Link to this heading") + +The [TensorRT LLM container](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/tensorrt-llm/containers/release/tags) maintained by NVIDIA contains all of the required dependencies pre-installed. You can start the container on a machine with NVIDIA GPUs via: + +```None +docker run --rm -it --ipc host --gpus all --ulimit memlock=-1 --ulimit stack=67108864 -p 8000:8000 nvcr.io/nvidia/tensorrt-llm/release:1.2.0rc6 +``` + +## Deploy Online Serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +You may also deploy pre-quantized models to improve performance. +Ensure your GPU supports FP8 quantization before running the following: + +```None +trtllm-serve "nvidia/Qwen3-8B-FP8" +``` + +For more options, browse the full [collection of generative models](https://huggingface.co/collections/nvidia/inference-optimized-checkpoints-with-model-optimizer) that have been quantized and optimized for inference with the TensorRT Model Optimizer. + +Note + +If you are running `trtllm-serve` inside a Docker container, you have two options for sending API requests: + +1. Expose a port (e.g., 8000) to allow external access to the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](commands/trtllm-serve/trtllm-serve.html) section. + +Note + +Pre-configured settings for deploying popular models with `trtllm-serve` can be found in our [deployment guides](deployment-guide/index.html). + +## Run Offline Inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing model loading, optimization, and inference, all through a single `LLM` instance. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load pre-quantized models [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you have: + +* Learned how to deploy a model with `trtllm-serve` for online serving +* Explored the LLM API for offline inference with TensorRT LLM + +To continue your journey with TensorRT LLM, explore these resources: + +* **[Installation Guide](installation/index.html)** - Detailed installation instructions for different platforms +* **[Model-Specific Deployment Guides](deployment-guide/index.html)** - Instructions for serving specific models with TensorRT LLM +* **[Deployment Guide](examples/llm_api_examples.html)** - Comprehensive examples for deploying LLM inference in various scenarios +* **[Model Support](models/supported-models.html)** - Check which models are supported and how to add new ones +* **CLI Reference** - Explore TensorRT LLM command-line tools: + + + [`trtllm-serve`](commands/trtllm-serve/trtllm-serve.html) - Deploy models for online serving + + [`trtllm-bench`](commands/trtllm-bench.html) - Benchmark model performance + + [`trtllm-eval`](commands/trtllm-eval.html) - Evaluate model accuracy diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc7.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc7.md new file mode 100644 index 0000000000000000000000000000000000000000..07fe5ad6c3ba4632153d4c691f241ef998758d1b --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc7.md @@ -0,0 +1,158 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc7/quick-start-guide.html +Version: 1.2.0rc7 + +This is the starting point to try out TensorRT LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT LLM. + +## Launch Docker Container[#](#launch-docker-container "Link to this heading") + +The [TensorRT LLM container](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/tensorrt-llm/containers/release/tags) maintained by NVIDIA contains all of the required dependencies pre-installed. You can start the container on a machine with NVIDIA GPUs via: + +```None +docker run --rm -it --ipc host --gpus all --ulimit memlock=-1 --ulimit stack=67108864 -p 8000:8000 nvcr.io/nvidia/tensorrt-llm/release:1.2.0rc7 +``` + +## Deploy Online Serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +You may also deploy pre-quantized models to improve performance. +Ensure your GPU supports FP8 quantization before running the following: + +```None +trtllm-serve "nvidia/Qwen3-8B-FP8" +``` + +For more options, browse the full [collection of generative models](https://huggingface.co/collections/nvidia/inference-optimized-checkpoints-with-model-optimizer) that have been quantized and optimized for inference with the TensorRT Model Optimizer. + +Note + +If you are running `trtllm-serve` inside a Docker container, you have two options for sending API requests: + +1. Expose a port (e.g., 8000) to allow external access to the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](commands/trtllm-serve/trtllm-serve.html) section. + +Note + +Pre-configured settings for deploying popular models with `trtllm-serve` can be found in our [deployment guides](deployment-guide/index.html). + +## Run Offline Inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing model loading, optimization, and inference, all through a single `LLM` instance. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load pre-quantized models [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you have: + +* Learned how to deploy a model with `trtllm-serve` for online serving +* Explored the LLM API for offline inference with TensorRT LLM + +To continue your journey with TensorRT LLM, explore these resources: + +* **[Installation Guide](installation/index.html)** - Detailed installation instructions for different platforms +* **[Model-Specific Deployment Guides](deployment-guide/index.html)** - Instructions for serving specific models with TensorRT LLM +* **[Deployment Guide](examples/llm_api_examples.html)** - Comprehensive examples for deploying LLM inference in various scenarios +* **[Model Support](models/supported-models.html)** - Check which models are supported and how to add new ones +* **CLI Reference** - Explore TensorRT LLM command-line tools: + + + [`trtllm-serve`](commands/trtllm-serve/trtllm-serve.html) - Deploy models for online serving + + [`trtllm-bench`](commands/trtllm-bench.html) - Benchmark model performance + + [`trtllm-eval`](commands/trtllm-eval.html) - Evaluate model accuracy diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc8.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc8.md new file mode 100644 index 0000000000000000000000000000000000000000..66cb5a72a05247ed2d17bc4258f0054d845633bc --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_120rc8.md @@ -0,0 +1,158 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc8/quick-start-guide.html +Version: 1.2.0rc8 + +This is the starting point to try out TensorRT LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT LLM. + +## Launch Docker Container[#](#launch-docker-container "Link to this heading") + +The [TensorRT LLM container](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/tensorrt-llm/containers/release/tags) maintained by NVIDIA contains all of the required dependencies pre-installed. You can start the container on a machine with NVIDIA GPUs via: + +```None +docker run --rm -it --ipc host --gpus all --ulimit memlock=-1 --ulimit stack=67108864 -p 8000:8000 nvcr.io/nvidia/tensorrt-llm/release:1.2.0rc8 +``` + +## Deploy Online Serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +You may also deploy pre-quantized models to improve performance. +Ensure your GPU supports FP8 quantization before running the following: + +```None +trtllm-serve "nvidia/Qwen3-8B-FP8" +``` + +For more options, browse the full [collection of generative models](https://huggingface.co/collections/nvidia/inference-optimized-checkpoints-with-model-optimizer) that have been quantized and optimized for inference with the TensorRT Model Optimizer. + +Note + +If you are running `trtllm-serve` inside a Docker container, you have two options for sending API requests: + +1. Expose a port (e.g., 8000) to allow external access to the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](commands/trtllm-serve/trtllm-serve.html) section. + +Note + +Pre-configured settings for deploying popular models with `trtllm-serve` can be found in our [deployment guides](deployment-guide/index.html). + +## Run Offline Inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing model loading, optimization, and inference, all through a single `LLM` instance. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load pre-quantized models [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you have: + +* Learned how to deploy a model with `trtllm-serve` for online serving +* Explored the LLM API for offline inference with TensorRT LLM + +To continue your journey with TensorRT LLM, explore these resources: + +* **[Installation Guide](installation/index.html)** - Detailed installation instructions for different platforms +* **[Model-Specific Deployment Guides](deployment-guide/index.html)** - Instructions for serving specific models with TensorRT LLM +* **[Deployment Guide](examples/llm_api_examples.html)** - Comprehensive examples for deploying LLM inference in various scenarios +* **[Model Support](models/supported-models.html)** - Check which models are supported and how to add new ones +* **CLI Reference** - Explore TensorRT LLM command-line tools: + + + [`trtllm-serve`](commands/trtllm-serve/trtllm-serve.html) - Deploy models for online serving + + [`trtllm-bench`](commands/trtllm-bench.html) - Benchmark model performance + + [`trtllm-eval`](commands/trtllm-eval.html) - Evaluate model accuracy diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_130rc0.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_130rc0.md new file mode 100644 index 0000000000000000000000000000000000000000..5dcd93ae10ac7d493d065e61ace8c26a5ea1238f --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_130rc0.md @@ -0,0 +1,158 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.3.0rc0/quick-start-guide.html +Version: 1.3.0rc0 + +This is the starting point to try out TensorRT LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT LLM. + +## Launch Docker Container[#](#launch-docker-container "Link to this heading") + +The [TensorRT LLM container](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/tensorrt-llm/containers/release/tags) maintained by NVIDIA contains all of the required dependencies pre-installed. You can start the container on a machine with NVIDIA GPUs via: + +```None +docker run --rm -it --ipc host --gpus all --ulimit memlock=-1 --ulimit stack=67108864 -p 8000:8000 nvcr.io/nvidia/tensorrt-llm/release:1.3.0rc0 +``` + +## Deploy Online Serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +You may also deploy pre-quantized models to improve performance. +Ensure your GPU supports FP8 quantization before running the following: + +```None +trtllm-serve "nvidia/Qwen3-8B-FP8" +``` + +For more options, browse the full [collection of generative models](https://huggingface.co/collections/nvidia/inference-optimized-checkpoints-with-model-optimizer) that have been quantized and optimized for inference with the TensorRT Model Optimizer. + +Note + +If you are running `trtllm-serve` inside a Docker container, you have two options for sending API requests: + +1. Expose a port (e.g., 8000) to allow external access to the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](commands/trtllm-serve/trtllm-serve.html) section. + +Note + +Pre-configured settings for deploying popular models with `trtllm-serve` can be found in our [deployment guides](deployment-guide/index.html). + +## Run Offline Inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing model loading, optimization, and inference, all through a single `LLM` instance. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load pre-quantized models [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you have: + +* Learned how to deploy a model with `trtllm-serve` for online serving +* Explored the LLM API for offline inference with TensorRT LLM + +To continue your journey with TensorRT LLM, explore these resources: + +* **[Installation Guide](installation/index.html)** - Detailed installation instructions for different platforms +* **[Model-Specific Deployment Guides](deployment-guide/index.html)** - Instructions for serving specific models with TensorRT LLM +* **[Deployment Guide](examples/llm_api_examples.html)** - Comprehensive examples for deploying LLM inference in various scenarios +* **[Model Support](models/supported-models.html)** - Check which models are supported and how to add new ones +* **CLI Reference** - Explore TensorRT LLM command-line tools: + + + [`trtllm-serve`](commands/trtllm-serve/trtllm-serve.html) - Deploy models for online serving + + [`trtllm-bench`](commands/trtllm-bench.html) - Benchmark model performance + + [`trtllm-eval`](commands/trtllm-eval.html) - Evaluate model accuracy diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_130rc1.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_130rc1.md new file mode 100644 index 0000000000000000000000000000000000000000..7f320682ad6a64268a14d6f55ec7ab0ba8a5b106 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_130rc1.md @@ -0,0 +1,158 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.3.0rc1/quick-start-guide.html +Version: 1.3.0rc1 + +This is the starting point to try out TensorRT LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT LLM. + +## Launch Docker Container[#](#launch-docker-container "Link to this heading") + +The [TensorRT LLM container](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/tensorrt-llm/containers/release/tags) maintained by NVIDIA contains all of the required dependencies pre-installed. You can start the container on a machine with NVIDIA GPUs via: + +```None +docker run --rm -it --ipc host --gpus all --ulimit memlock=-1 --ulimit stack=67108864 -p 8000:8000 nvcr.io/nvidia/tensorrt-llm/release:1.3.0rc1 +``` + +## Deploy Online Serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +You may also deploy pre-quantized models to improve performance. +Ensure your GPU supports FP8 quantization before running the following: + +```None +trtllm-serve "nvidia/Qwen3-8B-FP8" +``` + +For more options, browse the full [collection of generative models](https://huggingface.co/collections/nvidia/inference-optimized-checkpoints-with-model-optimizer) that have been quantized and optimized for inference with the TensorRT Model Optimizer. + +Note + +If you are running `trtllm-serve` inside a Docker container, you have two options for sending API requests: + +1. Expose a port (e.g., 8000) to allow external access to the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](commands/trtllm-serve/trtllm-serve.html) section. + +Note + +Pre-configured settings for deploying popular models with `trtllm-serve` can be found in our [deployment guides](deployment-guide/index.html). + +## Run Offline Inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing model loading, optimization, and inference, all through a single `LLM` instance. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load pre-quantized models [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you have: + +* Learned how to deploy a model with `trtllm-serve` for online serving +* Explored the LLM API for offline inference with TensorRT LLM + +To continue your journey with TensorRT LLM, explore these resources: + +* **[Installation Guide](installation/index.html)** - Detailed installation instructions for different platforms +* **[Model-Specific Deployment Guides](deployment-guide/index.html)** - Instructions for serving specific models with TensorRT LLM +* **[Deployment Guide](examples/llm_api_examples.html)** - Comprehensive examples for deploying LLM inference in various scenarios +* **[Model Support](models/supported-models.html)** - Check which models are supported and how to add new ones +* **CLI Reference** - Explore TensorRT LLM command-line tools: + + + [`trtllm-serve`](commands/trtllm-serve/trtllm-serve.html) - Deploy models for online serving + + [`trtllm-bench`](commands/trtllm-bench.html) - Benchmark model performance + + [`trtllm-eval`](commands/trtllm-eval.html) - Evaluate model accuracy diff --git a/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_130rc2.md b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_130rc2.md new file mode 100644 index 0000000000000000000000000000000000000000..d60f6f1b83f946170542597808e7e0f341c935a4 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/quick-start-guide/quick-start-guide_130rc2.md @@ -0,0 +1,158 @@ +# Quick Start Guide# + +Source: https://nvidia.github.io/TensorRT-LLM/1.3.0rc2/quick-start-guide.html +Version: 1.3.0rc2 + +This is the starting point to try out TensorRT LLM. Specifically, this Quick Start Guide enables you to quickly get set up and send HTTP requests using TensorRT LLM. + +## Launch Docker Container[#](#launch-docker-container "Link to this heading") + +The [TensorRT LLM container](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/tensorrt-llm/containers/release/tags) maintained by NVIDIA contains all of the required dependencies pre-installed. You can start the container on a machine with NVIDIA GPUs via: + +```None +docker run --rm -it --ipc host --gpus all --ulimit memlock=-1 --ulimit stack=67108864 -p 8000:8000 nvcr.io/nvidia/tensorrt-llm/release:1.3.0rc2 +``` + +## Deploy Online Serving with trtllm-serve[#](#deploy-online-serving-with-trtllm-serve "Link to this heading") + +You can use the `trtllm-serve` command to start an OpenAI compatible server to interact with a model. +To start the server, you can run a command like the following example inside a Docker container: + +```None +trtllm-serve "TinyLlama/TinyLlama-1.1B-Chat-v1.0" +``` + +You may also deploy pre-quantized models to improve performance. +Ensure your GPU supports FP8 quantization before running the following: + +```None +trtllm-serve "nvidia/Qwen3-8B-FP8" +``` + +For more options, browse the full [collection of generative models](https://huggingface.co/collections/nvidia/inference-optimized-checkpoints-with-model-optimizer) that have been quantized and optimized for inference with the TensorRT Model Optimizer. + +Note + +If you are running `trtllm-serve` inside a Docker container, you have two options for sending API requests: + +1. Expose a port (e.g., 8000) to allow external access to the server from outside the container. +2. Open a new terminal and use the following command to directly attach to the running container: + +```None +docker exec -it bash +``` + +After the server has started, you can access well-known OpenAI endpoints such as `v1/chat/completions`. +Inference can then be performed using examples similar to the one provided below, from a separate terminal. + +```None +curl -X POST http://localhost:8000/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -d '{ + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "messages":[{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Where is New York? Tell me in a single sentence."}], + "max_tokens": 32, + "temperature": 0 + }' +``` + +*Example Output* + +```None +{ + "id": "chatcmpl-ef648e7489c040679d87ed12db5d3214", + "object": "chat.completion", + "created": 1741966075, + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "New York is a city in the northeastern United States, located on the eastern coast of the state of New York.", + "tool_calls": [] + }, + "logprobs": null, + "finish_reason": "stop", + "stop_reason": null + } + ], + "usage": { + "prompt_tokens": 43, + "total_tokens": 69, + "completion_tokens": 26 + } +} +``` + +For detailed examples and command syntax, refer to the [trtllm-serve](commands/trtllm-serve/trtllm-serve.html) section. + +Note + +Pre-configured settings for deploying popular models with `trtllm-serve` can be found in our [deployment guides](deployment-guide/index.html). + +## Run Offline Inference with LLM API[#](#run-offline-inference-with-llm-api "Link to this heading") + +The LLM API is a Python API designed to facilitate setup and inference with TensorRT LLM directly within Python. It enables model optimization by simply specifying a HuggingFace repository name or a model checkpoint. The LLM API streamlines the process by managing model loading, optimization, and inference, all through a single `LLM` instance. + +Here is a simple example to show how to use the LLM API with TinyLlama. + +```None + 1from tensorrt_llm import LLM, SamplingParams + 2 + 3 + 4def main(): + 5 + 6 # Model could accept HF model name, a path to local HF model, + 7 # or Model Optimizer's quantized checkpoints like nvidia/Llama-3.1-8B-Instruct-FP8 on HF. + 8 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") + 9 +10 # Sample prompts. +11 prompts = [ +12 "Hello, my name is", +13 "The capital of France is", +14 "The future of AI is", +15 ] +16 +17 # Create a sampling params. +18 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) +19 +20 for output in llm.generate(prompts, sampling_params): +21 print( +22 f"Prompt: {output.prompt!r}, Generated text: {output.outputs[0].text!r}" +23 ) +24 +25 # Got output like +26 # Prompt: 'Hello, my name is', Generated text: '\n\nJane Smith. I am a student pursuing my degree in Computer Science at [university]. I enjoy learning new things, especially technology and programming' +27 # Prompt: 'The president of the United States is', Generated text: 'likely to nominate a new Supreme Court justice to fill the seat vacated by the death of Antonin Scalia. The Senate should vote to confirm the' +28 # Prompt: 'The capital of France is', Generated text: 'Paris.' +29 # Prompt: 'The future of AI is', Generated text: 'an exciting time for us. We are constantly researching, developing, and improving our platform to create the most advanced and efficient model available. We are' +30 +31 +32if __name__ == '__main__': +33 main() +``` + +You can also directly load pre-quantized models [quantized checkpoints on Hugging Face](https://huggingface.co/collections/nvidia/model-optimizer-66aa84f7966b3150262481a4) in the LLM constructor. +To learn more about the LLM API, check out the [LLM API Introduction](llm-api/index.html) and [LLM Examples](examples/llm_api_examples.html). + +## Next Steps[#](#next-steps "Link to this heading") + +In this Quick Start Guide, you have: + +* Learned how to deploy a model with `trtllm-serve` for online serving +* Explored the LLM API for offline inference with TensorRT LLM + +To continue your journey with TensorRT LLM, explore these resources: + +* **[Installation Guide](installation/index.html)** - Detailed installation instructions for different platforms +* **[Model-Specific Deployment Guides](deployment-guide/index.html)** - Instructions for serving specific models with TensorRT LLM +* **[Deployment Guide](examples/llm_api_examples.html)** - Comprehensive examples for deploying LLM inference in various scenarios +* **[Model Support](models/supported-models.html)** - Check which models are supported and how to add new ones +* **CLI Reference** - Explore TensorRT LLM command-line tools: + + + [`trtllm-serve`](commands/trtllm-serve/trtllm-serve.html) - Deploy models for online serving + + [`trtllm-bench`](commands/trtllm-bench.html) - Benchmark model performance + + [`trtllm-eval`](commands/trtllm-eval.html) - Evaluate model accuracy diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_100.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_100.md new file mode 100644 index 0000000000000000000000000000000000000000..a515710cf8de93ff894684ace57db2221f387b83 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_100.md @@ -0,0 +1,354 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.0.0/commands/trtllm-bench.html +Version: 1.0.0 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT LLM engines. It provides three main subcommands for different benchmarking scenarios: + +**Common Options for All Commands:** + +**Usage:** + +## trtllm-bench[#](#trtllm-bench "Link to this heading") + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use when running benchmarking. + + Options: + : pytorch | \_autodeploy | tensorrt + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable chunking in prefill stage for enhanced throughput benchmark. Default is False for PyTorch/AutoDeploy backend, True for TensorRT backend. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use when running benchmarking. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +# prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +## prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +## dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +## token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +## token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_100rc5.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_100rc5.md new file mode 100644 index 0000000000000000000000000000000000000000..98a040f7715f73d8386a6407581ee09c70c6dc25 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_100rc5.md @@ -0,0 +1,354 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.0.0rc5/commands/trtllm-bench.html +Version: 1.0.0rc5 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT-LLM engines. It provides three main subcommands for different benchmarking scenarios: + +**Common Options for All Commands:** + +**Usage:** + +## trtllm-bench[#](#trtllm-bench "Link to this heading") + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use when running benchmarking. + + Options: + : pytorch | \_autodeploy | tensorrt + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use when running benchmarking. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +# prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +## prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +## dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +## token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +## token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_100rc6.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_100rc6.md new file mode 100644 index 0000000000000000000000000000000000000000..d7857cdd9460f315338f9a4a223a8c32d7d1324a --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_100rc6.md @@ -0,0 +1,354 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.0.0rc6/commands/trtllm-bench.html +Version: 1.0.0rc6 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT-LLM engines. It provides three main subcommands for different benchmarking scenarios: + +**Common Options for All Commands:** + +**Usage:** + +## trtllm-bench[#](#trtllm-bench "Link to this heading") + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use when running benchmarking. + + Options: + : pytorch | \_autodeploy | tensorrt + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context, --disable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable/disable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use when running benchmarking. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +# prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +## prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +## dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +## token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +## token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110.md new file mode 100644 index 0000000000000000000000000000000000000000..6b41a85c6b46a0cc132600bb893e1eb4639fbeb7 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110.md @@ -0,0 +1,389 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0/commands/trtllm-bench.html +Version: 1.1.0 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT LLM engines. It provides three main subcommands for different benchmarking scenarios: + +**Common Options for All Commands:** + +**Usage:** + +## trtllm-bench[#](#trtllm-bench "Link to this heading") + +Usage + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +Usage + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--custom\_module\_dirs [#](#cmdoption-trtllm-bench-throughput-custom_module_dirs "Link to this definition") +: Paths to custom module directories to import. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--sampler\_options [#](#cmdoption-trtllm-bench-throughput-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--no\_skip\_tokenizer\_init[#](#cmdoption-trtllm-bench-throughput-no_skip_tokenizer_init "Link to this definition") +: Do not skip tokenizer initialization when loading the model. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--image\_data\_format [#](#cmdoption-trtllm-bench-throughput-image_data_format "Link to this definition") +: Format of the image data for multimodal models. + + Options: + : pt | pil + +--data\_device [#](#cmdoption-trtllm-bench-throughput-data_device "Link to this definition") +: Device to load the multimodal data on. + + Options: + : cuda | cpu + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context, --disable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable/disable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +Usage + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-latency-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--sampler\_options [#](#cmdoption-trtllm-bench-latency-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +Usage + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +# prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +## prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +## dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +## token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +## token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110rc0.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110rc0.md new file mode 100644 index 0000000000000000000000000000000000000000..68745f4e5f6074c8f86018ed4d3cf2ed3b22e33f --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110rc0.md @@ -0,0 +1,384 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0rc0/commands/trtllm-bench.html +Version: 1.1.0rc0 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT-LLM engines. It provides three main subcommands for different benchmarking scenarios: + +**Common Options for All Commands:** + +**Usage:** + +## trtllm-bench[#](#trtllm-bench "Link to this heading") + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use when running benchmarking. + + Options: + : pytorch | \_autodeploy | tensorrt + +--custom\_module\_dirs [#](#cmdoption-trtllm-bench-throughput-custom_module_dirs "Link to this definition") +: Paths to custom module directories to import. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--mamba\_ssm\_cache\_dtype [#](#cmdoption-trtllm-bench-throughput-mamba_ssm_cache_dtype "Link to this definition") +: Data type for Mamba SSM cache. If ‘auto’, inferred from model config. + + Options: + : auto | float16 | bfloat16 | float32 + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--no\_skip\_tokenizer\_init[#](#cmdoption-trtllm-bench-throughput-no_skip_tokenizer_init "Link to this definition") +: Do not skip tokenizer initialization when loading the model. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--image\_data\_format [#](#cmdoption-trtllm-bench-throughput-image_data_format "Link to this definition") +: Format of the image data for multimodal models. + + Options: + : pt | pil + +--data\_device [#](#cmdoption-trtllm-bench-throughput-data_device "Link to this definition") +: Device to load the multimodal data on. + + Options: + : cuda | cpu + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context, --disable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable/disable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use when running benchmarking. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--mamba\_ssm\_cache\_dtype [#](#cmdoption-trtllm-bench-latency-mamba_ssm_cache_dtype "Link to this definition") +: Data type for Mamba SSM cache. If ‘auto’, inferred from model config. + + Options: + : auto | float16 | bfloat16 | float32 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +# prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +## prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +## dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +## token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +## token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110rc1.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110rc1.md new file mode 100644 index 0000000000000000000000000000000000000000..8ceae10b92a42172427ffdec964ddb8b38324797 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110rc1.md @@ -0,0 +1,390 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0rc1/commands/trtllm-bench.html +Version: 1.1.0rc1 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT-LLM engines. It provides three main subcommands for different benchmarking scenarios: + +**Common Options for All Commands:** + +**Usage:** + +## trtllm-bench[#](#trtllm-bench "Link to this heading") + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use when running benchmarking. + + Options: + : pytorch | \_autodeploy | tensorrt + +--custom\_module\_dirs [#](#cmdoption-trtllm-bench-throughput-custom_module_dirs "Link to this definition") +: Paths to custom module directories to import. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--sampler\_options [#](#cmdoption-trtllm-bench-throughput-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--mamba\_ssm\_cache\_dtype [#](#cmdoption-trtllm-bench-throughput-mamba_ssm_cache_dtype "Link to this definition") +: Data type for Mamba SSM cache. If ‘auto’, inferred from model config. + + Options: + : auto | float16 | bfloat16 | float32 + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--no\_skip\_tokenizer\_init[#](#cmdoption-trtllm-bench-throughput-no_skip_tokenizer_init "Link to this definition") +: Do not skip tokenizer initialization when loading the model. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--image\_data\_format [#](#cmdoption-trtllm-bench-throughput-image_data_format "Link to this definition") +: Format of the image data for multimodal models. + + Options: + : pt | pil + +--data\_device [#](#cmdoption-trtllm-bench-throughput-data_device "Link to this definition") +: Device to load the multimodal data on. + + Options: + : cuda | cpu + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context, --disable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable/disable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use when running benchmarking. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--mamba\_ssm\_cache\_dtype [#](#cmdoption-trtllm-bench-latency-mamba_ssm_cache_dtype "Link to this definition") +: Data type for Mamba SSM cache. If ‘auto’, inferred from model config. + + Options: + : auto | float16 | bfloat16 | float32 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--sampler\_options [#](#cmdoption-trtllm-bench-latency-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +# prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +## prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +## dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +## token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +## token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110rc2.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110rc2.md new file mode 100644 index 0000000000000000000000000000000000000000..46225d0ce9af96299556a0fdfa31c377d189b3b0 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110rc2.md @@ -0,0 +1,381 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0rc2/commands/trtllm-bench.html +Version: 1.1.0rc2 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT-LLM engines. It provides three main subcommands for different benchmarking scenarios: + +**Common Options for All Commands:** + +**Usage:** + +## trtllm-bench[#](#trtllm-bench "Link to this heading") + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use when running benchmarking. + + Options: + : pytorch | \_autodeploy | tensorrt + +--custom\_module\_dirs [#](#cmdoption-trtllm-bench-throughput-custom_module_dirs "Link to this definition") +: Paths to custom module directories to import. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--sampler\_options [#](#cmdoption-trtllm-bench-throughput-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--no\_skip\_tokenizer\_init[#](#cmdoption-trtllm-bench-throughput-no_skip_tokenizer_init "Link to this definition") +: Do not skip tokenizer initialization when loading the model. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--image\_data\_format [#](#cmdoption-trtllm-bench-throughput-image_data_format "Link to this definition") +: Format of the image data for multimodal models. + + Options: + : pt | pil + +--data\_device [#](#cmdoption-trtllm-bench-throughput-data_device "Link to this definition") +: Device to load the multimodal data on. + + Options: + : cuda | cpu + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context, --disable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable/disable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-latency-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use when running benchmarking. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--sampler\_options [#](#cmdoption-trtllm-bench-latency-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +# prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +## prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +## dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +## token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +## token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110rc3.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110rc3.md new file mode 100644 index 0000000000000000000000000000000000000000..e0c4362de233222387c502e12c954c5bcbccf19c --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110rc3.md @@ -0,0 +1,381 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0rc3/commands/trtllm-bench.html +Version: 1.1.0rc3 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT-LLM engines. It provides three main subcommands for different benchmarking scenarios: + +**Common Options for All Commands:** + +**Usage:** + +## trtllm-bench[#](#trtllm-bench "Link to this heading") + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use when running benchmarking. + + Options: + : pytorch | \_autodeploy | tensorrt + +--custom\_module\_dirs [#](#cmdoption-trtllm-bench-throughput-custom_module_dirs "Link to this definition") +: Paths to custom module directories to import. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--sampler\_options [#](#cmdoption-trtllm-bench-throughput-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--no\_skip\_tokenizer\_init[#](#cmdoption-trtllm-bench-throughput-no_skip_tokenizer_init "Link to this definition") +: Do not skip tokenizer initialization when loading the model. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--image\_data\_format [#](#cmdoption-trtllm-bench-throughput-image_data_format "Link to this definition") +: Format of the image data for multimodal models. + + Options: + : pt | pil + +--data\_device [#](#cmdoption-trtllm-bench-throughput-data_device "Link to this definition") +: Device to load the multimodal data on. + + Options: + : cuda | cpu + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context, --disable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable/disable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-latency-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use when running benchmarking. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--sampler\_options [#](#cmdoption-trtllm-bench-latency-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +# prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +## prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +## dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +## token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +## token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110rc4.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110rc4.md new file mode 100644 index 0000000000000000000000000000000000000000..b3279f17632ad0036e8d2cd311aa7119b771fefb --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110rc4.md @@ -0,0 +1,381 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0rc4/commands/trtllm-bench.html +Version: 1.1.0rc4 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT LLM engines. It provides three main subcommands for different benchmarking scenarios: + +**Common Options for All Commands:** + +**Usage:** + +## trtllm-bench[#](#trtllm-bench "Link to this heading") + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use when running benchmarking. + + Options: + : pytorch | \_autodeploy | tensorrt + +--custom\_module\_dirs [#](#cmdoption-trtllm-bench-throughput-custom_module_dirs "Link to this definition") +: Paths to custom module directories to import. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--sampler\_options [#](#cmdoption-trtllm-bench-throughput-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--no\_skip\_tokenizer\_init[#](#cmdoption-trtllm-bench-throughput-no_skip_tokenizer_init "Link to this definition") +: Do not skip tokenizer initialization when loading the model. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--image\_data\_format [#](#cmdoption-trtllm-bench-throughput-image_data_format "Link to this definition") +: Format of the image data for multimodal models. + + Options: + : pt | pil + +--data\_device [#](#cmdoption-trtllm-bench-throughput-data_device "Link to this definition") +: Device to load the multimodal data on. + + Options: + : cuda | cpu + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context, --disable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable/disable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-latency-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use when running benchmarking. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--sampler\_options [#](#cmdoption-trtllm-bench-latency-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +# prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +## prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +## dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +## token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +## token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110rc5.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110rc5.md new file mode 100644 index 0000000000000000000000000000000000000000..d291a4fa70dba341c0c8e3c51f3f689773f946a7 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_110rc5.md @@ -0,0 +1,381 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.1.0rc5/commands/trtllm-bench.html +Version: 1.1.0rc5 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT LLM engines. It provides three main subcommands for different benchmarking scenarios: + +**Common Options for All Commands:** + +**Usage:** + +## trtllm-bench[#](#trtllm-bench "Link to this heading") + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use when running benchmarking. + + Options: + : pytorch | \_autodeploy | tensorrt + +--custom\_module\_dirs [#](#cmdoption-trtllm-bench-throughput-custom_module_dirs "Link to this definition") +: Paths to custom module directories to import. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--sampler\_options [#](#cmdoption-trtllm-bench-throughput-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--no\_skip\_tokenizer\_init[#](#cmdoption-trtllm-bench-throughput-no_skip_tokenizer_init "Link to this definition") +: Do not skip tokenizer initialization when loading the model. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--image\_data\_format [#](#cmdoption-trtllm-bench-throughput-image_data_format "Link to this definition") +: Format of the image data for multimodal models. + + Options: + : pt | pil + +--data\_device [#](#cmdoption-trtllm-bench-throughput-data_device "Link to this definition") +: Device to load the multimodal data on. + + Options: + : cuda | cpu + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context, --disable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable/disable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-latency-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use when running benchmarking. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--sampler\_options [#](#cmdoption-trtllm-bench-latency-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +# prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +## prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +## dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +## token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +## token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc0.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc0.md new file mode 100644 index 0000000000000000000000000000000000000000..ac1959dfa22b6907546e892e7bf4e6d544a0c7de --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc0.md @@ -0,0 +1,381 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc0/commands/trtllm-bench.html +Version: 1.2.0rc0 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT LLM engines. It provides three main subcommands for different benchmarking scenarios: + +**Common Options for All Commands:** + +**Usage:** + +## trtllm-bench[#](#trtllm-bench "Link to this heading") + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--custom\_module\_dirs [#](#cmdoption-trtllm-bench-throughput-custom_module_dirs "Link to this definition") +: Paths to custom module directories to import. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--sampler\_options [#](#cmdoption-trtllm-bench-throughput-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--no\_skip\_tokenizer\_init[#](#cmdoption-trtllm-bench-throughput-no_skip_tokenizer_init "Link to this definition") +: Do not skip tokenizer initialization when loading the model. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--image\_data\_format [#](#cmdoption-trtllm-bench-throughput-image_data_format "Link to this definition") +: Format of the image data for multimodal models. + + Options: + : pt | pil + +--data\_device [#](#cmdoption-trtllm-bench-throughput-data_device "Link to this definition") +: Device to load the multimodal data on. + + Options: + : cuda | cpu + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context, --disable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable/disable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-latency-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--sampler\_options [#](#cmdoption-trtllm-bench-latency-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +# prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +## prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +## dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +## token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +## token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc1.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc1.md new file mode 100644 index 0000000000000000000000000000000000000000..0ea56c190b126da887a489b11ac031d9b3cb80bc --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc1.md @@ -0,0 +1,381 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc1/commands/trtllm-bench.html +Version: 1.2.0rc1 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT LLM engines. It provides three main subcommands for different benchmarking scenarios: + +**Common Options for All Commands:** + +**Usage:** + +## trtllm-bench[#](#trtllm-bench "Link to this heading") + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--custom\_module\_dirs [#](#cmdoption-trtllm-bench-throughput-custom_module_dirs "Link to this definition") +: Paths to custom module directories to import. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--sampler\_options [#](#cmdoption-trtllm-bench-throughput-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--no\_skip\_tokenizer\_init[#](#cmdoption-trtllm-bench-throughput-no_skip_tokenizer_init "Link to this definition") +: Do not skip tokenizer initialization when loading the model. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--image\_data\_format [#](#cmdoption-trtllm-bench-throughput-image_data_format "Link to this definition") +: Format of the image data for multimodal models. + + Options: + : pt | pil + +--data\_device [#](#cmdoption-trtllm-bench-throughput-data_device "Link to this definition") +: Device to load the multimodal data on. + + Options: + : cuda | cpu + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context, --disable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable/disable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-latency-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--sampler\_options [#](#cmdoption-trtllm-bench-latency-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +# prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +## prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +## dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +## token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +## token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc2.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc2.md new file mode 100644 index 0000000000000000000000000000000000000000..f8f732fc7f3168140fe8a5721f76b6b5ed757a12 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc2.md @@ -0,0 +1,381 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc2/commands/trtllm-bench.html +Version: 1.2.0rc2 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT LLM engines. It provides three main subcommands for different benchmarking scenarios: + +**Common Options for All Commands:** + +**Usage:** + +## trtllm-bench[#](#trtllm-bench "Link to this heading") + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--custom\_module\_dirs [#](#cmdoption-trtllm-bench-throughput-custom_module_dirs "Link to this definition") +: Paths to custom module directories to import. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--sampler\_options [#](#cmdoption-trtllm-bench-throughput-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--no\_skip\_tokenizer\_init[#](#cmdoption-trtllm-bench-throughput-no_skip_tokenizer_init "Link to this definition") +: Do not skip tokenizer initialization when loading the model. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--image\_data\_format [#](#cmdoption-trtllm-bench-throughput-image_data_format "Link to this definition") +: Format of the image data for multimodal models. + + Options: + : pt | pil + +--data\_device [#](#cmdoption-trtllm-bench-throughput-data_device "Link to this definition") +: Device to load the multimodal data on. + + Options: + : cuda | cpu + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context, --disable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable/disable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-latency-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--sampler\_options [#](#cmdoption-trtllm-bench-latency-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +# prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +## prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +## dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +## token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +## token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc3.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc3.md new file mode 100644 index 0000000000000000000000000000000000000000..283147fc2dcd5892954fff39bccc602bfe57a464 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc3.md @@ -0,0 +1,381 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc3/commands/trtllm-bench.html +Version: 1.2.0rc3 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT LLM engines. It provides three main subcommands for different benchmarking scenarios: + +**Common Options for All Commands:** + +**Usage:** + +## trtllm-bench[#](#trtllm-bench "Link to this heading") + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--custom\_module\_dirs [#](#cmdoption-trtllm-bench-throughput-custom_module_dirs "Link to this definition") +: Paths to custom module directories to import. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--sampler\_options [#](#cmdoption-trtllm-bench-throughput-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--no\_skip\_tokenizer\_init[#](#cmdoption-trtllm-bench-throughput-no_skip_tokenizer_init "Link to this definition") +: Do not skip tokenizer initialization when loading the model. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--image\_data\_format [#](#cmdoption-trtllm-bench-throughput-image_data_format "Link to this definition") +: Format of the image data for multimodal models. + + Options: + : pt | pil + +--data\_device [#](#cmdoption-trtllm-bench-throughput-data_device "Link to this definition") +: Device to load the multimodal data on. + + Options: + : cuda | cpu + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context, --disable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable/disable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-latency-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--sampler\_options [#](#cmdoption-trtllm-bench-latency-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +# prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +## prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +## dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +## token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +## token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc4.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc4.md new file mode 100644 index 0000000000000000000000000000000000000000..f580bdba9d8c36a1a77d4f2d7690958db835ebb7 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc4.md @@ -0,0 +1,381 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc4/commands/trtllm-bench.html +Version: 1.2.0rc4 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT LLM engines. It provides three main subcommands for different benchmarking scenarios: + +**Common Options for All Commands:** + +**Usage:** + +## trtllm-bench[#](#trtllm-bench "Link to this heading") + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--custom\_module\_dirs [#](#cmdoption-trtllm-bench-throughput-custom_module_dirs "Link to this definition") +: Paths to custom module directories to import. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--sampler\_options [#](#cmdoption-trtllm-bench-throughput-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--no\_skip\_tokenizer\_init[#](#cmdoption-trtllm-bench-throughput-no_skip_tokenizer_init "Link to this definition") +: Do not skip tokenizer initialization when loading the model. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--image\_data\_format [#](#cmdoption-trtllm-bench-throughput-image_data_format "Link to this definition") +: Format of the image data for multimodal models. + + Options: + : pt | pil + +--data\_device [#](#cmdoption-trtllm-bench-throughput-data_device "Link to this definition") +: Device to load the multimodal data on. + + Options: + : cuda | cpu + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context, --disable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable/disable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-latency-extra_llm_api_options "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--sampler\_options [#](#cmdoption-trtllm-bench-latency-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +# prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +## prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +## dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +## token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +## token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc5.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc5.md new file mode 100644 index 0000000000000000000000000000000000000000..7d309ecfb82c6c9d4c22c10de71855593cf11f02 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc5.md @@ -0,0 +1,392 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc5/commands/trtllm-bench.html +Version: 1.2.0rc5 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT LLM engines. It provides three main subcommands for different benchmarking scenarios: + +**Common Options for All Commands:** + +**Usage:** + +## trtllm-bench[#](#trtllm-bench "Link to this heading") + +Usage + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +--revision [#](#cmdoption-trtllm-bench-revision "Link to this definition") +: The revision to use for the HuggingFace model (branch name, tag name, or commit id). + +### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +Usage + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--custom\_module\_dirs [#](#cmdoption-trtllm-bench-throughput-custom_module_dirs "Link to this definition") +: Paths to custom module directories to import. + +--config, --extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-config "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. Can be specified as either –config or –extra\_llm\_api\_options. + +--sampler\_options [#](#cmdoption-trtllm-bench-throughput-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--no\_skip\_tokenizer\_init[#](#cmdoption-trtllm-bench-throughput-no_skip_tokenizer_init "Link to this definition") +: Do not skip tokenizer initialization when loading the model. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--image\_data\_format [#](#cmdoption-trtllm-bench-throughput-image_data_format "Link to this definition") +: Format of the image data for multimodal models. + + Options: + : pt | pil + +--data\_device [#](#cmdoption-trtllm-bench-throughput-data_device "Link to this definition") +: Device to load the multimodal data on. + + Options: + : cuda | cpu + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context, --disable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable/disable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +Usage + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--config, --extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-latency-config "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. Can be specified as either –config or –extra\_llm\_api\_options. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--sampler\_options [#](#cmdoption-trtllm-bench-latency-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +Usage + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +# prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +## prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +## dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +## token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +## token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc6.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc6.md new file mode 100644 index 0000000000000000000000000000000000000000..cf55d6f7de25a9e3a9a34ffafaab8ce5cc617a39 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc6.md @@ -0,0 +1,392 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc6/commands/trtllm-bench.html +Version: 1.2.0rc6 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT LLM engines. It provides three main subcommands for different benchmarking scenarios: + +**Common Options for All Commands:** + +**Usage:** + +## trtllm-bench[#](#trtllm-bench "Link to this heading") + +Usage + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +--revision [#](#cmdoption-trtllm-bench-revision "Link to this definition") +: The revision to use for the HuggingFace model (branch name, tag name, or commit id). + +### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +Usage + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--custom\_module\_dirs [#](#cmdoption-trtllm-bench-throughput-custom_module_dirs "Link to this definition") +: Paths to custom module directories to import. + +--config, --extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-config "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. Can be specified as either –config or –extra\_llm\_api\_options. + +--sampler\_options [#](#cmdoption-trtllm-bench-throughput-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--no\_skip\_tokenizer\_init[#](#cmdoption-trtllm-bench-throughput-no_skip_tokenizer_init "Link to this definition") +: Do not skip tokenizer initialization when loading the model. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--image\_data\_format [#](#cmdoption-trtllm-bench-throughput-image_data_format "Link to this definition") +: Format of the image data for multimodal models. + + Options: + : pt | pil + +--data\_device [#](#cmdoption-trtllm-bench-throughput-data_device "Link to this definition") +: Device to load the multimodal data on. + + Options: + : cuda | cpu + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context, --disable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable/disable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +Usage + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--config, --extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-latency-config "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. Can be specified as either –config or –extra\_llm\_api\_options. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--sampler\_options [#](#cmdoption-trtllm-bench-latency-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +Usage + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +# prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +## prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +## dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +## token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +## token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc7.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc7.md new file mode 100644 index 0000000000000000000000000000000000000000..3358d1f67d9661df6288cf699c97b6519982e830 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc7.md @@ -0,0 +1,397 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc7/commands/trtllm-bench.html +Version: 1.2.0rc7 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT LLM engines. It provides three main subcommands for different benchmarking scenarios: + +Note + +**Non-breaking**: `--config ` is the preferred flag for passing a [YAML configuration file](trtllm-serve/trtllm-serve.html#configuring-with-yaml-files). +Existing workflows using `--extra_llm_api_options ` continue to work; it is an equivalent alias. + +## Syntax[#](#syntax "Link to this heading") + +### trtllm-bench[#](#trtllm-bench "Link to this heading") + +Usage + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +--revision [#](#cmdoption-trtllm-bench-revision "Link to this definition") +: The revision to use for the HuggingFace model (branch name, tag name, or commit id). + +#### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +Usage + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--custom\_module\_dirs [#](#cmdoption-trtllm-bench-throughput-custom_module_dirs "Link to this definition") +: Paths to custom module directories to import. + +--config, --extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-config "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. Can be specified as either –config or –extra\_llm\_api\_options. + +--sampler\_options [#](#cmdoption-trtllm-bench-throughput-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--no\_skip\_tokenizer\_init[#](#cmdoption-trtllm-bench-throughput-no_skip_tokenizer_init "Link to this definition") +: Do not skip tokenizer initialization when loading the model. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--image\_data\_format [#](#cmdoption-trtllm-bench-throughput-image_data_format "Link to this definition") +: Format of the image data for multimodal models. + + Options: + : pt | pil + +--data\_device [#](#cmdoption-trtllm-bench-throughput-data_device "Link to this definition") +: Device to load the multimodal data on. + + Options: + : cuda | cpu + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context, --disable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable/disable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +#### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +Usage + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--config, --extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-latency-config "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. Can be specified as either –config or –extra\_llm\_api\_options. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--sampler\_options [#](#cmdoption-trtllm-bench-latency-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +#### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +Usage + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +## Dataset preparation[#](#dataset-preparation "Link to this heading") + +### prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +#### prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +#### dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +#### token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +#### token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc8.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc8.md new file mode 100644 index 0000000000000000000000000000000000000000..e87115fd93c0c6d4fab36e20e329512ec9806810 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_120rc8.md @@ -0,0 +1,397 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.2.0rc8/commands/trtllm-bench.html +Version: 1.2.0rc8 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT LLM engines. It provides three main subcommands for different benchmarking scenarios: + +Note + +**Non-breaking**: `--config ` is the preferred flag for passing a [YAML configuration file](trtllm-serve/trtllm-serve.html#configuring-with-yaml-files). +Existing workflows using `--extra_llm_api_options ` continue to work; it is an equivalent alias. + +## Syntax[#](#syntax "Link to this heading") + +### trtllm-bench[#](#trtllm-bench "Link to this heading") + +Usage + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +--revision [#](#cmdoption-trtllm-bench-revision "Link to this definition") +: The revision to use for the HuggingFace model (branch name, tag name, or commit id). + +#### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +Usage + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--custom\_module\_dirs [#](#cmdoption-trtllm-bench-throughput-custom_module_dirs "Link to this definition") +: Paths to custom module directories to import. + +--config, --extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-config "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. Can be specified as either –config or –extra\_llm\_api\_options. + +--sampler\_options [#](#cmdoption-trtllm-bench-throughput-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--no\_skip\_tokenizer\_init[#](#cmdoption-trtllm-bench-throughput-no_skip_tokenizer_init "Link to this definition") +: Do not skip tokenizer initialization when loading the model. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--image\_data\_format [#](#cmdoption-trtllm-bench-throughput-image_data_format "Link to this definition") +: Format of the image data for multimodal models. + + Options: + : pt | pil + +--data\_device [#](#cmdoption-trtllm-bench-throughput-data_device "Link to this definition") +: Device to load the multimodal data on. + + Options: + : cuda | cpu + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context, --disable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable/disable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +#### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +Usage + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--config, --extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-latency-config "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. Can be specified as either –config or –extra\_llm\_api\_options. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--sampler\_options [#](#cmdoption-trtllm-bench-latency-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +#### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +Usage + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +## Dataset preparation[#](#dataset-preparation "Link to this heading") + +### prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +#### prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +#### dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +#### token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +#### token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_130rc0.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_130rc0.md new file mode 100644 index 0000000000000000000000000000000000000000..6f391362e1fdba7a9d8dd3654fd91b0ce46323da --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_130rc0.md @@ -0,0 +1,397 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.3.0rc0/commands/trtllm-bench.html +Version: 1.3.0rc0 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT LLM engines. It provides three main subcommands for different benchmarking scenarios: + +Note + +**Non-breaking**: `--config ` is the preferred flag for passing a [YAML configuration file](trtllm-serve/trtllm-serve.html#configuring-with-yaml-files). +Existing workflows using `--extra_llm_api_options ` continue to work; it is an equivalent alias. + +## Syntax[#](#syntax "Link to this heading") + +### trtllm-bench[#](#trtllm-bench "Link to this heading") + +Usage + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +--revision [#](#cmdoption-trtllm-bench-revision "Link to this definition") +: The revision to use for the HuggingFace model (branch name, tag name, or commit id). + +#### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +Usage + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--custom\_module\_dirs [#](#cmdoption-trtllm-bench-throughput-custom_module_dirs "Link to this definition") +: Paths to custom module directories to import. + +--config, --extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-config "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. Can be specified as either –config or –extra\_llm\_api\_options. + +--sampler\_options [#](#cmdoption-trtllm-bench-throughput-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--no\_skip\_tokenizer\_init[#](#cmdoption-trtllm-bench-throughput-no_skip_tokenizer_init "Link to this definition") +: Do not skip tokenizer initialization when loading the model. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--image\_data\_format [#](#cmdoption-trtllm-bench-throughput-image_data_format "Link to this definition") +: Format of the image data for multimodal models. + + Options: + : pt | pil + +--data\_device [#](#cmdoption-trtllm-bench-throughput-data_device "Link to this definition") +: Device to load the multimodal data on. + + Options: + : cuda | cpu + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context, --disable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable/disable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +#### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +Usage + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--config, --extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-latency-config "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. Can be specified as either –config or –extra\_llm\_api\_options. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--sampler\_options [#](#cmdoption-trtllm-bench-latency-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +#### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +Usage + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +## Dataset preparation[#](#dataset-preparation "Link to this heading") + +### prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +#### prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +#### dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +#### token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +#### token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_130rc1.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_130rc1.md new file mode 100644 index 0000000000000000000000000000000000000000..a5d21e8978e7c5526dc50e97a8c9a99c89c9747b --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_130rc1.md @@ -0,0 +1,397 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.3.0rc1/commands/trtllm-bench.html +Version: 1.3.0rc1 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT LLM engines. It provides three main subcommands for different benchmarking scenarios: + +Note + +**Non-breaking**: `--config ` is the preferred flag for passing a [YAML configuration file](trtllm-serve/trtllm-serve.html#configuring-with-yaml-files). +Existing workflows using `--extra_llm_api_options ` continue to work; it is an equivalent alias. + +## Syntax[#](#syntax "Link to this heading") + +### trtllm-bench[#](#trtllm-bench "Link to this heading") + +Usage + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +--revision [#](#cmdoption-trtllm-bench-revision "Link to this definition") +: The revision to use for the HuggingFace model (branch name, tag name, or commit id). + +#### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +Usage + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--custom\_module\_dirs [#](#cmdoption-trtllm-bench-throughput-custom_module_dirs "Link to this definition") +: Paths to custom module directories to import. + +--config, --extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-config "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. Can be specified as either –config or –extra\_llm\_api\_options. + +--sampler\_options [#](#cmdoption-trtllm-bench-throughput-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--no\_skip\_tokenizer\_init[#](#cmdoption-trtllm-bench-throughput-no_skip_tokenizer_init "Link to this definition") +: Do not skip tokenizer initialization when loading the model. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--image\_data\_format [#](#cmdoption-trtllm-bench-throughput-image_data_format "Link to this definition") +: Format of the image data for multimodal models. + + Options: + : pt | pil + +--data\_device [#](#cmdoption-trtllm-bench-throughput-data_device "Link to this definition") +: Device to load the multimodal data on. + + Options: + : cuda | cpu + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context, --disable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable/disable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +#### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +Usage + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--config, --extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-latency-config "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. Can be specified as either –config or –extra\_llm\_api\_options. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--sampler\_options [#](#cmdoption-trtllm-bench-latency-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +#### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +Usage + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +## Dataset preparation[#](#dataset-preparation "Link to this heading") + +### prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +#### prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +#### dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +#### token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +#### token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_130rc2.md b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_130rc2.md new file mode 100644 index 0000000000000000000000000000000000000000..a8799009cb15c874323cd846a97e3e465980c6f6 --- /dev/null +++ b/corpus/docs/nvidia_tensorrt-llm/trtllm-bench/trtllm-bench_130rc2.md @@ -0,0 +1,397 @@ +# trtllm-bench# + +Source: https://nvidia.github.io/TensorRT-LLM/1.3.0rc2/commands/trtllm-bench.html +Version: 1.3.0rc2 + +trtllm-bench is a comprehensive benchmarking tool for TensorRT LLM engines. It provides three main subcommands for different benchmarking scenarios: + +Note + +**Non-breaking**: `--config ` is the preferred flag for passing a [YAML configuration file](trtllm-serve/trtllm-serve.html#configuring-with-yaml-files). +Existing workflows using `--extra_llm_api_options ` continue to work; it is an equivalent alias. + +## Syntax[#](#syntax "Link to this heading") + +### trtllm-bench[#](#trtllm-bench "Link to this heading") + +Usage + +```None +trtllm-bench [OPTIONS] COMMAND [ARGS]... +``` + +Options + +-m, --model [#](#cmdoption-trtllm-bench-m "Link to this definition") +: **Required** The Huggingface name of the model to benchmark. + +--model\_path [#](#cmdoption-trtllm-bench-model_path "Link to this definition") +: Path to a Huggingface checkpoint directory for loading model components. + +-w, --workspace [#](#cmdoption-trtllm-bench-w "Link to this definition") +: The directory to store benchmarking intermediate files. + +--log\_level [#](#cmdoption-trtllm-bench-log_level "Link to this definition") +: The logging level. + + Options: + : internal\_error | error | warning | info | verbose | debug | trace + +--revision [#](#cmdoption-trtllm-bench-revision "Link to this definition") +: The revision to use for the HuggingFace model (branch name, tag name, or commit id). + +#### throughput[#](#trtllm-bench-throughput "Link to this heading") + +Run a throughput test on a TRT-LLM engine. + +Usage + +```None +trtllm-bench throughput [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-throughput-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--backend [#](#cmdoption-trtllm-bench-throughput-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--custom\_module\_dirs [#](#cmdoption-trtllm-bench-throughput-custom_module_dirs "Link to this definition") +: Paths to custom module directories to import. + +--config, --extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-throughput-config "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. Can be specified as either –config or –extra\_llm\_api\_options. + +--sampler\_options [#](#cmdoption-trtllm-bench-throughput-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-throughput-max_batch_size "Link to this definition") +: Maximum runtime batch size to run the engine with. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-throughput-max_num_tokens "Link to this definition") +: Maximum runtime tokens that an engine can accept. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-throughput-max_seq_len "Link to this definition") +: Maximum sequence length. + +--beam\_width [#](#cmdoption-trtllm-bench-throughput-beam_width "Link to this definition") +: Number of search beams. + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-throughput-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--dataset [#](#cmdoption-trtllm-bench-throughput-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--no\_skip\_tokenizer\_init[#](#cmdoption-trtllm-bench-throughput-no_skip_tokenizer_init "Link to this definition") +: Do not skip tokenizer initialization when loading the model. + +--eos\_id [#](#cmdoption-trtllm-bench-throughput-eos_id "Link to this definition") +: Set the end-of-sequence token for the benchmark. Set to -1 to disable EOS. + +--modality [#](#cmdoption-trtllm-bench-throughput-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--image\_data\_format [#](#cmdoption-trtllm-bench-throughput-image_data_format "Link to this definition") +: Format of the image data for multimodal models. + + Options: + : pt | pil + +--data\_device [#](#cmdoption-trtllm-bench-throughput-data_device "Link to this definition") +: Device to load the multimodal data on. + + Options: + : cuda | cpu + +--max\_input\_len [#](#cmdoption-trtllm-bench-throughput-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-throughput-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. If not specified or set to 0, it will be the length of dataset. + +--warmup [#](#cmdoption-trtllm-bench-throughput-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--target\_input\_len [#](#cmdoption-trtllm-bench-throughput-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-throughput-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +--tp [#](#cmdoption-trtllm-bench-throughput-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-throughput-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-throughput-ep "Link to this definition") +: expert parallelism size + +--cluster\_size [#](#cmdoption-trtllm-bench-throughput-cluster_size "Link to this definition") +: expert cluster parallelism size + +--concurrency [#](#cmdoption-trtllm-bench-throughput-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--streaming[#](#cmdoption-trtllm-bench-throughput-streaming "Link to this definition") +: Enable streaming mode for requests. + +--report\_json [#](#cmdoption-trtllm-bench-throughput-report_json "Link to this definition") +: Path where report is written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-throughput-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +--output\_json [#](#cmdoption-trtllm-bench-throughput-output_json "Link to this definition") +: Path where output should be written to. + +--request\_json [#](#cmdoption-trtllm-bench-throughput-request_json "Link to this definition") +: Path where per request information is written to. + +--enable\_chunked\_context, --disable\_chunked\_context[#](#cmdoption-trtllm-bench-throughput-enable_chunked_context "Link to this definition") +: Enable/disable chunking in prefill stage for enhanced throughput benchmark. + +--scheduler\_policy [#](#cmdoption-trtllm-bench-throughput-scheduler_policy "Link to this definition") +: KV cache scheduler policy: guaranteed\_no\_evict prevents request eviction, max\_utilization optimizes for throughput. + + Options: + : guaranteed\_no\_evict | max\_utilization + +#### latency[#](#trtllm-bench-latency "Link to this heading") + +Run a latency test on a TRT-LLM engine. + +Usage + +```None +trtllm-bench latency [OPTIONS] +``` + +Options + +--engine\_dir [#](#cmdoption-trtllm-bench-latency-engine_dir "Link to this definition") +: Path to a serialized TRT-LLM engine. + +--config, --extra\_llm\_api\_options [#](#cmdoption-trtllm-bench-latency-config "Link to this definition") +: Path to a YAML file that overwrites the parameters specified by trtllm-bench. Can be specified as either –config or –extra\_llm\_api\_options. + +--backend [#](#cmdoption-trtllm-bench-latency-backend "Link to this definition") +: The backend to use for benchmark. Default is pytorch backend. + + Options: + : pytorch | \_autodeploy | tensorrt + +--kv\_cache\_free\_gpu\_mem\_fraction [#](#cmdoption-trtllm-bench-latency-kv_cache_free_gpu_mem_fraction "Link to this definition") +: The percentage of memory to use for KV Cache after model load. + +--max\_seq\_len [#](#cmdoption-trtllm-bench-latency-max_seq_len "Link to this definition") +: Maximum sequence length. + +--dataset [#](#cmdoption-trtllm-bench-latency-dataset "Link to this definition") +: Pass in a dataset file for parsing instead of stdin. + +--modality [#](#cmdoption-trtllm-bench-latency-modality "Link to this definition") +: Modality of the multimodal requests. + + Options: + : image | video + +--max\_input\_len [#](#cmdoption-trtllm-bench-latency-max_input_len "Link to this definition") +: Maximum input sequence length to use for multimodal models. This is used only when –modality is specified since the actual number of vision tokens is unknown before the model is run. + +--num\_requests [#](#cmdoption-trtllm-bench-latency-num_requests "Link to this definition") +: Number of requests to cap benchmark run at. Minimum between value andlength of dataset. + +--warmup [#](#cmdoption-trtllm-bench-latency-warmup "Link to this definition") +: Number of requests warm up benchmark. + +--tp [#](#cmdoption-trtllm-bench-latency-tp "Link to this definition") +: tensor parallelism size + +--pp [#](#cmdoption-trtllm-bench-latency-pp "Link to this definition") +: pipeline parallelism size + +--ep [#](#cmdoption-trtllm-bench-latency-ep "Link to this definition") +: expert parallelism size + +--beam\_width [#](#cmdoption-trtllm-bench-latency-beam_width "Link to this definition") +: Number of search beams. + +--sampler\_options [#](#cmdoption-trtllm-bench-latency-sampler_options "Link to this definition") +: Path to a YAML file that sets sampler options. + +--concurrency [#](#cmdoption-trtllm-bench-latency-concurrency "Link to this definition") +: Desired concurrency rate (number of requests processing at the same time), <=0 for no concurrency limit. + +--medusa\_choices [#](#cmdoption-trtllm-bench-latency-medusa_choices "Link to this definition") +: Path to a YAML file that defines the Medusa tree. + +--report\_json [#](#cmdoption-trtllm-bench-latency-report_json "Link to this definition") +: Path where report should be written to. + +--iteration\_log [#](#cmdoption-trtllm-bench-latency-iteration_log "Link to this definition") +: Path where iteration logging is written to. + +#### build[#](#trtllm-bench-build "Link to this heading") + +Build engines for benchmarking. + +Usage + +```None +trtllm-bench build [OPTIONS] +``` + +Options + +-tp, --tp\_size [#](#cmdoption-trtllm-bench-build-tp "Link to this definition") +: Number of tensor parallel shards to run the benchmark with. + +-pp, --pp\_size [#](#cmdoption-trtllm-bench-build-pp "Link to this definition") +: Number of pipeline parallel shards to run the benchmark with. + +-q, --quantization [#](#cmdoption-trtllm-bench-build-q "Link to this definition") +: The quantization algorithm to be used when benchmarking. See the documentations for more information. + - - [NVIDIA/TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM/blob/main/docs/source/blogs/quantization-in-TRT-LLM.md) + + Options: + : W8A16 | W4A16 | W4A16\_AWQ | W4A8\_AWQ | W4A16\_GPTQ | FP8 | INT8 | NVFP4 + +--max\_seq\_len [#](#cmdoption-trtllm-bench-build-max_seq_len "Link to this definition") +: Maximum total length of one request, including prompt and outputs. + +--no\_weights\_loading [#](#cmdoption-trtllm-bench-build-no_weights_loading "Link to this definition") +: Do not load the weights from the checkpoint. Use dummy weights instead. + +--trust\_remote\_code [#](#cmdoption-trtllm-bench-build-trust_remote_code "Link to this definition") +: Trust remote code for the HF models that are not natively implemented in the transformers library. This is needed when using LLM API when loading the HF config to build the engine. + +--dataset [#](#cmdoption-trtllm-bench-build-dataset "Link to this definition") +: Dataset file to extract the sequence statistics for engine build. + +--max\_batch\_size [#](#cmdoption-trtllm-bench-build-max_batch_size "Link to this definition") +: Maximum number of requests that the engine can schedule. + +--max\_num\_tokens [#](#cmdoption-trtllm-bench-build-max_num_tokens "Link to this definition") +: Maximum number of batched tokens the engine can schedule. + +--target\_input\_len [#](#cmdoption-trtllm-bench-build-target_input_len "Link to this definition") +: Target (average) input length for tuning heuristics. + +--target\_output\_len [#](#cmdoption-trtllm-bench-build-target_output_len "Link to this definition") +: Target (average) sequence length for tuning heuristics. + +## Dataset preparation[#](#dataset-preparation "Link to this heading") + +### prepare\_dataset.py[#](#prepare-dataset-py "Link to this heading") + +trtllm-bench is designed to work with the [prepare\_dataset.py](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/prepare_dataset.py) script, which generates benchmark datasets in the required format. The prepare\_dataset script supports: + +**Dataset Types:** + +* Real datasets from various sources +* Synthetic datasets with normal or uniform token distributions +* LoRA task-specific datasets + +**Key Features:** + +* Tokenizer integration for proper text preprocessing +* Configurable random seeds for reproducible results +* Support for LoRA adapters and task IDs +* Output in JSON format compatible with trtllm-bench + +Important + +The `--stdout` flag is **required** when using prepare\_dataset.py with trtllm-bench to ensure proper data streaming format. + +**Usage:** + +#### prepare\_dataset[#](#prepare-dataset "Link to this heading") + +```None +python prepare_dataset.py [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--tokenizer` | Tokenizer directory or HuggingFace model name (required) | +| `--output` | Output JSON filename (default: preprocessed\_dataset.json) | +| `--stdout` | Print output to stdout with JSON dataset entry on each line (**required for trtllm-bench**) | +| `--random-seed` | Random seed for token generation (default: 420) | +| `--task-id` | LoRA task ID (default: -1) | +| `--rand-task-id` | Random LoRA task range (two integers) | +| `--lora-dir` | Directory containing LoRA adapters | +| `--log-level` | Logging level: info or debug (default: info) | + +#### dataset[#](#dataset "Link to this heading") + +Process real datasets from various sources. + +```None +python prepare_dataset.py dataset [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--input` | Input dataset file or directory (required) | +| `--max-input-length` | Maximum input sequence length (default: 2048) | +| `--max-output-length` | Maximum output sequence length (default: 512) | +| `--num-samples` | Number of samples to process (default: all) | +| `--format` | Input format: json, jsonl, csv, or txt (default: auto-detect) | + +#### token\_norm\_dist[#](#token-norm-dist "Link to this heading") + +Generate synthetic datasets with normal token distribution. + +```None +python prepare_dataset.py token_norm_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-mean` | Normal distribution mean for input tokens (required) | +| `--input-stdev` | Normal distribution standard deviation for input tokens (required) | +| `--output-mean` | Normal distribution mean for output tokens (required) | +| `--output-stdev` | Normal distribution standard deviation for output tokens (required) | + +#### token\_unif\_dist[#](#token-unif-dist "Link to this heading") + +Generate synthetic datasets with uniform token distribution + +```None +python prepare_dataset.py token_unif_dist [OPTIONS] +``` + +**Options** + +--- + +| Option | Description | +| --- | --- | +| `--num-requests` | Number of requests to be generated (required) | +| `--input-min` | Uniform distribution minimum for input tokens (required) | +| `--input-max` | Uniform distribution maximum for input tokens (required) | +| `--output-min` | Uniform distribution minimum for output tokens (required) | +| `--output-max` | Uniform distribution maximum for output tokens (required) | diff --git a/corpus/docs/pandas/dataframe/dataframe_15.md b/corpus/docs/pandas/dataframe/dataframe_15.md new file mode 100644 index 0000000000000000000000000000000000000000..6124bb30c0377ad6cdf25a1977827d8dba11b7c5 --- /dev/null +++ b/corpus/docs/pandas/dataframe/dataframe_15.md @@ -0,0 +1,371 @@ +# pandas.DataFrame# + +Source: https://pandas.pydata.org/pandas-docs/version/1.5/reference/api/pandas.DataFrame.html +Version: 1.5 + +*class* pandas.DataFrame(*data=None*, *index=None*, *columns=None*, *dtype=None*, *copy=None*)[[source]](https://github.com/pandas-dev/pandas/blob/v1.5.2/pandas/core/frame.py#L474-L11993)[#](#pandas.DataFrame "Permalink to this definition") +: Two-dimensional, size-mutable, potentially heterogeneous tabular data. + + Data structure also contains labeled axes (rows and columns). + Arithmetic operations align on both row and column labels. Can be + thought of as a dict-like container for Series objects. The primary + pandas data structure. + + Parameters + : **data**ndarray (structured or homogeneous), Iterable, dict, or DataFrame + : Dict can contain Series, arrays, constants, dataclass or list-like objects. If + data is a dict, column order follows insertion-order. If a dict contains Series + which have an index defined, it is aligned by its index. + + Changed in version 0.25.0: If data is a list of dicts, column order follows insertion-order. + + **index**Index or array-like + : Index to use for resulting frame. Will default to RangeIndex if + no indexing information part of input data and no index provided. + + **columns**Index or array-like + : Column labels to use for resulting frame when data does not have them, + defaulting to RangeIndex(0, 1, 2, …, n). If data contains column labels, + will perform column selection instead. + + **dtype**dtype, default None + : Data type to force. Only a single dtype is allowed. If None, infer. + + **copy**bool or None, default None + : Copy data from inputs. + For dict data, the default of None behaves like `copy=True`. For DataFrame + or 2d ndarray input, the default of None behaves like `copy=False`. + If data is a dict containing one or more Series (possibly of different dtypes), + `copy=False` will ensure that these inputs are not copied. + + Changed in version 1.3.0. + + See also + + [`DataFrame.from_records`](pandas.DataFrame.from_records.html#pandas.DataFrame.from_records "pandas.DataFrame.from_records") + : Constructor from tuples, also record arrays. + + [`DataFrame.from_dict`](pandas.DataFrame.from_dict.html#pandas.DataFrame.from_dict "pandas.DataFrame.from_dict") + : From dicts of Series, arrays, or dicts. + + [`read_csv`](pandas.read_csv.html#pandas.read_csv "pandas.read_csv") + : Read a comma-separated values (csv) file into DataFrame. + + [`read_table`](pandas.read_table.html#pandas.read_table "pandas.read_table") + : Read general delimited file into DataFrame. + + [`read_clipboard`](pandas.read_clipboard.html#pandas.read_clipboard "pandas.read_clipboard") + : Read text from clipboard into DataFrame. + + Notes + + Please reference the [User Guide](../../user_guide/dsintro.html#basics-dataframe) for more information. + + Examples + + Constructing DataFrame from a dictionary. + + ```None + >>> d = {'col1': [1, 2], 'col2': [3, 4]} + >>> df = pd.DataFrame(data=d) + >>> df + col1 col2 + 0 1 3 + 1 2 4 + ``` + + Notice that the inferred dtype is int64. + + ```None + >>> df.dtypes + col1 int64 + col2 int64 + dtype: object + ``` + + To enforce a single dtype: + + ```None + >>> df = pd.DataFrame(data=d, dtype=np.int8) + >>> df.dtypes + col1 int8 + col2 int8 + dtype: object + ``` + + Constructing DataFrame from a dictionary including Series: + + ```None + >>> d = {'col1': [0, 1, 2, 3], 'col2': pd.Series([2, 3], index=[2, 3])} + >>> pd.DataFrame(data=d, index=[0, 1, 2, 3]) + col1 col2 + 0 0 NaN + 1 1 NaN + 2 2 2.0 + 3 3 3.0 + ``` + + Constructing DataFrame from numpy ndarray: + + ```None + >>> df2 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), + ... columns=['a', 'b', 'c']) + >>> df2 + a b c + 0 1 2 3 + 1 4 5 6 + 2 7 8 9 + ``` + + Constructing DataFrame from a numpy ndarray that has labeled columns: + + ```None + >>> data = np.array([(1, 2, 3), (4, 5, 6), (7, 8, 9)], + ... dtype=[("a", "i4"), ("b", "i4"), ("c", "i4")]) + >>> df3 = pd.DataFrame(data, columns=['c', 'a']) + ... + >>> df3 + c a + 0 3 1 + 1 6 4 + 2 9 7 + ``` + + Constructing DataFrame from dataclass: + + ```None + >>> from dataclasses import make_dataclass + >>> Point = make_dataclass("Point", [("x", int), ("y", int)]) + >>> pd.DataFrame([Point(0, 0), Point(0, 3), Point(2, 3)]) + x y + 0 0 0 + 1 0 3 + 2 2 3 + ``` + + Attributes + + | | | + | --- | --- | + | [`at`](pandas.DataFrame.at.html#pandas.DataFrame.at "pandas.DataFrame.at") | Access a single value for a row/column label pair. | + | [`attrs`](pandas.DataFrame.attrs.html#pandas.DataFrame.attrs "pandas.DataFrame.attrs") | Dictionary of global attributes of this dataset. | + | [`axes`](pandas.DataFrame.axes.html#pandas.DataFrame.axes "pandas.DataFrame.axes") | Return a list representing the axes of the DataFrame. | + | [`columns`](pandas.DataFrame.columns.html#pandas.DataFrame.columns "pandas.DataFrame.columns") | The column labels of the DataFrame. | + | [`dtypes`](pandas.DataFrame.dtypes.html#pandas.DataFrame.dtypes "pandas.DataFrame.dtypes") | Return the dtypes in the DataFrame. | + | [`empty`](pandas.DataFrame.empty.html#pandas.DataFrame.empty "pandas.DataFrame.empty") | Indicator whether Series/DataFrame is empty. | + | [`flags`](pandas.DataFrame.flags.html#pandas.DataFrame.flags "pandas.DataFrame.flags") | Get the properties associated with this pandas object. | + | [`iat`](pandas.DataFrame.iat.html#pandas.DataFrame.iat "pandas.DataFrame.iat") | Access a single value for a row/column pair by integer position. | + | [`iloc`](pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") | Purely integer-location based indexing for selection by position. | + | [`index`](pandas.DataFrame.index.html#pandas.DataFrame.index "pandas.DataFrame.index") | The index (row labels) of the DataFrame. | + | [`loc`](pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") | Access a group of rows and columns by label(s) or a boolean array. | + | [`ndim`](pandas.DataFrame.ndim.html#pandas.DataFrame.ndim "pandas.DataFrame.ndim") | Return an int representing the number of axes / array dimensions. | + | [`shape`](pandas.DataFrame.shape.html#pandas.DataFrame.shape "pandas.DataFrame.shape") | Return a tuple representing the dimensionality of the DataFrame. | + | [`size`](pandas.DataFrame.size.html#pandas.DataFrame.size "pandas.DataFrame.size") | Return an int representing the number of elements in this object. | + | [`style`](pandas.DataFrame.style.html#pandas.DataFrame.style "pandas.DataFrame.style") | Returns a Styler object. | + | [`values`](pandas.DataFrame.values.html#pandas.DataFrame.values "pandas.DataFrame.values") | Return a Numpy representation of the DataFrame. | + + | | | + | --- | --- | + | **T** | | + + Methods + + | | | + | --- | --- | + | [`abs`](pandas.DataFrame.abs.html#pandas.DataFrame.abs "pandas.DataFrame.abs")() | Return a Series/DataFrame with absolute numeric value of each element. | + | [`add`](pandas.DataFrame.add.html#pandas.DataFrame.add "pandas.DataFrame.add")(other[, axis, level, fill\_value]) | Get Addition of dataframe and other, element-wise (binary operator add). | + | [`add_prefix`](pandas.DataFrame.add_prefix.html#pandas.DataFrame.add_prefix "pandas.DataFrame.add_prefix")(prefix) | Prefix labels with string prefix. | + | [`add_suffix`](pandas.DataFrame.add_suffix.html#pandas.DataFrame.add_suffix "pandas.DataFrame.add_suffix")(suffix) | Suffix labels with string suffix. | + | [`agg`](pandas.DataFrame.agg.html#pandas.DataFrame.agg "pandas.DataFrame.agg")([func, axis]) | Aggregate using one or more operations over the specified axis. | + | [`aggregate`](pandas.DataFrame.aggregate.html#pandas.DataFrame.aggregate "pandas.DataFrame.aggregate")([func, axis]) | Aggregate using one or more operations over the specified axis. | + | [`align`](pandas.DataFrame.align.html#pandas.DataFrame.align "pandas.DataFrame.align")(other[, join, axis, level, copy, ...]) | Align two objects on their axes with the specified join method. | + | [`all`](pandas.DataFrame.all.html#pandas.DataFrame.all "pandas.DataFrame.all")([axis, bool\_only, skipna, level]) | Return whether all elements are True, potentially over an axis. | + | [`any`](pandas.DataFrame.any.html#pandas.DataFrame.any "pandas.DataFrame.any")(\*[, axis, bool\_only, skipna, level]) | Return whether any element is True, potentially over an axis. | + | [`append`](pandas.DataFrame.append.html#pandas.DataFrame.append "pandas.DataFrame.append")(other[, ignore\_index, ...]) | (DEPRECATED) Append rows of other to the end of caller, returning a new object. | + | [`apply`](pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply")(func[, axis, raw, result\_type, args]) | Apply a function along an axis of the DataFrame. | + | [`applymap`](pandas.DataFrame.applymap.html#pandas.DataFrame.applymap "pandas.DataFrame.applymap")(func[, na\_action]) | Apply a function to a Dataframe elementwise. | + | [`asfreq`](pandas.DataFrame.asfreq.html#pandas.DataFrame.asfreq "pandas.DataFrame.asfreq")(freq[, method, how, normalize, ...]) | Convert time series to specified frequency. | + | [`asof`](pandas.DataFrame.asof.html#pandas.DataFrame.asof "pandas.DataFrame.asof")(where[, subset]) | Return the last row(s) without any NaNs before where. | + | [`assign`](pandas.DataFrame.assign.html#pandas.DataFrame.assign "pandas.DataFrame.assign")(\*\*kwargs) | Assign new columns to a DataFrame. | + | [`astype`](pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype")(dtype[, copy, errors]) | Cast a pandas object to a specified dtype `dtype`. | + | [`at_time`](pandas.DataFrame.at_time.html#pandas.DataFrame.at_time "pandas.DataFrame.at_time")(time[, asof, axis]) | Select values at particular time of day (e.g., 9:30AM). | + | [`backfill`](pandas.DataFrame.backfill.html#pandas.DataFrame.backfill "pandas.DataFrame.backfill")(\*[, axis, inplace, limit, downcast]) | Synonym for [`DataFrame.fillna()`](pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") with `method='bfill'`. | + | [`between_time`](pandas.DataFrame.between_time.html#pandas.DataFrame.between_time "pandas.DataFrame.between_time")(start\_time, end\_time[, ...]) | Select values between particular times of the day (e.g., 9:00-9:30 AM). | + | [`bfill`](pandas.DataFrame.bfill.html#pandas.DataFrame.bfill "pandas.DataFrame.bfill")(\*[, axis, inplace, limit, downcast]) | Synonym for [`DataFrame.fillna()`](pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") with `method='bfill'`. | + | [`bool`](pandas.DataFrame.bool.html#pandas.DataFrame.bool "pandas.DataFrame.bool")() | Return the bool of a single element Series or DataFrame. | + | [`boxplot`](pandas.DataFrame.boxplot.html#pandas.DataFrame.boxplot "pandas.DataFrame.boxplot")([column, by, ax, fontsize, rot, ...]) | Make a box plot from DataFrame columns. | + | [`clip`](pandas.DataFrame.clip.html#pandas.DataFrame.clip "pandas.DataFrame.clip")([lower, upper, axis, inplace]) | Trim values at input threshold(s). | + | [`combine`](pandas.DataFrame.combine.html#pandas.DataFrame.combine "pandas.DataFrame.combine")(other, func[, fill\_value, overwrite]) | Perform column-wise combine with another DataFrame. | + | [`combine_first`](pandas.DataFrame.combine_first.html#pandas.DataFrame.combine_first "pandas.DataFrame.combine_first")(other) | Update null elements with value in the same location in other. | + | [`compare`](pandas.DataFrame.compare.html#pandas.DataFrame.compare "pandas.DataFrame.compare")(other[, align\_axis, keep\_shape, ...]) | Compare to another DataFrame and show the differences. | + | [`convert_dtypes`](pandas.DataFrame.convert_dtypes.html#pandas.DataFrame.convert_dtypes "pandas.DataFrame.convert_dtypes")([infer\_objects, ...]) | Convert columns to best possible dtypes using dtypes supporting `pd.NA`. | + | [`copy`](pandas.DataFrame.copy.html#pandas.DataFrame.copy "pandas.DataFrame.copy")([deep]) | Make a copy of this object's indices and data. | + | [`corr`](pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr")([method, min\_periods, numeric\_only]) | Compute pairwise correlation of columns, excluding NA/null values. | + | [`corrwith`](pandas.DataFrame.corrwith.html#pandas.DataFrame.corrwith "pandas.DataFrame.corrwith")(other[, axis, drop, method, ...]) | Compute pairwise correlation. | + | [`count`](pandas.DataFrame.count.html#pandas.DataFrame.count "pandas.DataFrame.count")([axis, level, numeric\_only]) | Count non-NA cells for each column or row. | + | [`cov`](pandas.DataFrame.cov.html#pandas.DataFrame.cov "pandas.DataFrame.cov")([min\_periods, ddof, numeric\_only]) | Compute pairwise covariance of columns, excluding NA/null values. | + | [`cummax`](pandas.DataFrame.cummax.html#pandas.DataFrame.cummax "pandas.DataFrame.cummax")([axis, skipna]) | Return cumulative maximum over a DataFrame or Series axis. | + | [`cummin`](pandas.DataFrame.cummin.html#pandas.DataFrame.cummin "pandas.DataFrame.cummin")([axis, skipna]) | Return cumulative minimum over a DataFrame or Series axis. | + | [`cumprod`](pandas.DataFrame.cumprod.html#pandas.DataFrame.cumprod "pandas.DataFrame.cumprod")([axis, skipna]) | Return cumulative product over a DataFrame or Series axis. | + | [`cumsum`](pandas.DataFrame.cumsum.html#pandas.DataFrame.cumsum "pandas.DataFrame.cumsum")([axis, skipna]) | Return cumulative sum over a DataFrame or Series axis. | + | [`describe`](pandas.DataFrame.describe.html#pandas.DataFrame.describe "pandas.DataFrame.describe")([percentiles, include, exclude, ...]) | Generate descriptive statistics. | + | [`diff`](pandas.DataFrame.diff.html#pandas.DataFrame.diff "pandas.DataFrame.diff")([periods, axis]) | First discrete difference of element. | + | [`div`](pandas.DataFrame.div.html#pandas.DataFrame.div "pandas.DataFrame.div")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator truediv). | + | [`divide`](pandas.DataFrame.divide.html#pandas.DataFrame.divide "pandas.DataFrame.divide")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator truediv). | + | [`dot`](pandas.DataFrame.dot.html#pandas.DataFrame.dot "pandas.DataFrame.dot")(other) | Compute the matrix multiplication between the DataFrame and other. | + | [`drop`](pandas.DataFrame.drop.html#pandas.DataFrame.drop "pandas.DataFrame.drop")([labels, axis, index, columns, level, ...]) | Drop specified labels from rows or columns. | + | [`drop_duplicates`](pandas.DataFrame.drop_duplicates.html#pandas.DataFrame.drop_duplicates "pandas.DataFrame.drop_duplicates")([subset, keep, inplace, ...]) | Return DataFrame with duplicate rows removed. | + | [`droplevel`](pandas.DataFrame.droplevel.html#pandas.DataFrame.droplevel "pandas.DataFrame.droplevel")(level[, axis]) | Return Series/DataFrame with requested index / column level(s) removed. | + | [`dropna`](pandas.DataFrame.dropna.html#pandas.DataFrame.dropna "pandas.DataFrame.dropna")(\*[, axis, how, thresh, subset, inplace]) | Remove missing values. | + | [`duplicated`](pandas.DataFrame.duplicated.html#pandas.DataFrame.duplicated "pandas.DataFrame.duplicated")([subset, keep]) | Return boolean Series denoting duplicate rows. | + | [`eq`](pandas.DataFrame.eq.html#pandas.DataFrame.eq "pandas.DataFrame.eq")(other[, axis, level]) | Get Equal to of dataframe and other, element-wise (binary operator eq). | + | [`equals`](pandas.DataFrame.equals.html#pandas.DataFrame.equals "pandas.DataFrame.equals")(other) | Test whether two objects contain the same elements. | + | [`eval`](pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval")(expr, \*[, inplace]) | Evaluate a string describing operations on DataFrame columns. | + | [`ewm`](pandas.DataFrame.ewm.html#pandas.DataFrame.ewm "pandas.DataFrame.ewm")([com, span, halflife, alpha, ...]) | Provide exponentially weighted (EW) calculations. | + | [`expanding`](pandas.DataFrame.expanding.html#pandas.DataFrame.expanding "pandas.DataFrame.expanding")([min\_periods, center, axis, method]) | Provide expanding window calculations. | + | [`explode`](pandas.DataFrame.explode.html#pandas.DataFrame.explode "pandas.DataFrame.explode")(column[, ignore\_index]) | Transform each element of a list-like to a row, replicating index values. | + | [`ffill`](pandas.DataFrame.ffill.html#pandas.DataFrame.ffill "pandas.DataFrame.ffill")(\*[, axis, inplace, limit, downcast]) | Synonym for [`DataFrame.fillna()`](pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") with `method='ffill'`. | + | [`fillna`](pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna")([value, method, axis, inplace, ...]) | Fill NA/NaN values using the specified method. | + | [`filter`](pandas.DataFrame.filter.html#pandas.DataFrame.filter "pandas.DataFrame.filter")([items, like, regex, axis]) | Subset the dataframe rows or columns according to the specified index labels. | + | [`first`](pandas.DataFrame.first.html#pandas.DataFrame.first "pandas.DataFrame.first")(offset) | Select initial periods of time series data based on a date offset. | + | [`first_valid_index`](pandas.DataFrame.first_valid_index.html#pandas.DataFrame.first_valid_index "pandas.DataFrame.first_valid_index")() | Return index for first non-NA value or None, if no non-NA value is found. | + | [`floordiv`](pandas.DataFrame.floordiv.html#pandas.DataFrame.floordiv "pandas.DataFrame.floordiv")(other[, axis, level, fill\_value]) | Get Integer division of dataframe and other, element-wise (binary operator floordiv). | + | [`from_dict`](pandas.DataFrame.from_dict.html#pandas.DataFrame.from_dict "pandas.DataFrame.from_dict")(data[, orient, dtype, columns]) | Construct DataFrame from dict of array-like or dicts. | + | [`from_records`](pandas.DataFrame.from_records.html#pandas.DataFrame.from_records "pandas.DataFrame.from_records")(data[, index, exclude, ...]) | Convert structured or record ndarray to DataFrame. | + | [`ge`](pandas.DataFrame.ge.html#pandas.DataFrame.ge "pandas.DataFrame.ge")(other[, axis, level]) | Get Greater than or equal to of dataframe and other, element-wise (binary operator ge). | + | [`get`](pandas.DataFrame.get.html#pandas.DataFrame.get "pandas.DataFrame.get")(key[, default]) | Get item from object for given key (ex: DataFrame column). | + | [`groupby`](pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby")([by, axis, level, as\_index, sort, ...]) | Group DataFrame using a mapper or by a Series of columns. | + | [`gt`](pandas.DataFrame.gt.html#pandas.DataFrame.gt "pandas.DataFrame.gt")(other[, axis, level]) | Get Greater than of dataframe and other, element-wise (binary operator gt). | + | [`head`](pandas.DataFrame.head.html#pandas.DataFrame.head "pandas.DataFrame.head")([n]) | Return the first n rows. | + | [`hist`](pandas.DataFrame.hist.html#pandas.DataFrame.hist "pandas.DataFrame.hist")([column, by, grid, xlabelsize, xrot, ...]) | Make a histogram of the DataFrame's columns. | + | [`idxmax`](pandas.DataFrame.idxmax.html#pandas.DataFrame.idxmax "pandas.DataFrame.idxmax")([axis, skipna, numeric\_only]) | Return index of first occurrence of maximum over requested axis. | + | [`idxmin`](pandas.DataFrame.idxmin.html#pandas.DataFrame.idxmin "pandas.DataFrame.idxmin")([axis, skipna, numeric\_only]) | Return index of first occurrence of minimum over requested axis. | + | [`infer_objects`](pandas.DataFrame.infer_objects.html#pandas.DataFrame.infer_objects "pandas.DataFrame.infer_objects")() | Attempt to infer better dtypes for object columns. | + | [`info`](pandas.DataFrame.info.html#pandas.DataFrame.info "pandas.DataFrame.info")([verbose, buf, max\_cols, memory\_usage, ...]) | Print a concise summary of a DataFrame. | + | [`insert`](pandas.DataFrame.insert.html#pandas.DataFrame.insert "pandas.DataFrame.insert")(loc, column, value[, allow\_duplicates]) | Insert column into DataFrame at specified location. | + | [`interpolate`](pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate")([method, axis, limit, inplace, ...]) | Fill NaN values using an interpolation method. | + | [`isetitem`](pandas.DataFrame.isetitem.html#pandas.DataFrame.isetitem "pandas.DataFrame.isetitem")(loc, value) | Set the given value in the column with position 'loc'. | + | [`isin`](pandas.DataFrame.isin.html#pandas.DataFrame.isin "pandas.DataFrame.isin")(values) | Whether each element in the DataFrame is contained in values. | + | [`isna`](pandas.DataFrame.isna.html#pandas.DataFrame.isna "pandas.DataFrame.isna")() | Detect missing values. | + | [`isnull`](pandas.DataFrame.isnull.html#pandas.DataFrame.isnull "pandas.DataFrame.isnull")() | DataFrame.isnull is an alias for DataFrame.isna. | + | [`items`](pandas.DataFrame.items.html#pandas.DataFrame.items "pandas.DataFrame.items")() | Iterate over (column name, Series) pairs. | + | [`iteritems`](pandas.DataFrame.iteritems.html#pandas.DataFrame.iteritems "pandas.DataFrame.iteritems")() | (DEPRECATED) Iterate over (column name, Series) pairs. | + | [`iterrows`](pandas.DataFrame.iterrows.html#pandas.DataFrame.iterrows "pandas.DataFrame.iterrows")() | Iterate over DataFrame rows as (index, Series) pairs. | + | [`itertuples`](pandas.DataFrame.itertuples.html#pandas.DataFrame.itertuples "pandas.DataFrame.itertuples")([index, name]) | Iterate over DataFrame rows as namedtuples. | + | [`join`](pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join")(other[, on, how, lsuffix, rsuffix, ...]) | Join columns of another DataFrame. | + | [`keys`](pandas.DataFrame.keys.html#pandas.DataFrame.keys "pandas.DataFrame.keys")() | Get the 'info axis' (see Indexing for more). | + | [`kurt`](pandas.DataFrame.kurt.html#pandas.DataFrame.kurt "pandas.DataFrame.kurt")([axis, skipna, level, numeric\_only]) | Return unbiased kurtosis over requested axis. | + | [`kurtosis`](pandas.DataFrame.kurtosis.html#pandas.DataFrame.kurtosis "pandas.DataFrame.kurtosis")([axis, skipna, level, numeric\_only]) | Return unbiased kurtosis over requested axis. | + | [`last`](pandas.DataFrame.last.html#pandas.DataFrame.last "pandas.DataFrame.last")(offset) | Select final periods of time series data based on a date offset. | + | [`last_valid_index`](pandas.DataFrame.last_valid_index.html#pandas.DataFrame.last_valid_index "pandas.DataFrame.last_valid_index")() | Return index for last non-NA value or None, if no non-NA value is found. | + | [`le`](pandas.DataFrame.le.html#pandas.DataFrame.le "pandas.DataFrame.le")(other[, axis, level]) | Get Less than or equal to of dataframe and other, element-wise (binary operator le). | + | [`lookup`](pandas.DataFrame.lookup.html#pandas.DataFrame.lookup "pandas.DataFrame.lookup")(row\_labels, col\_labels) | (DEPRECATED) Label-based "fancy indexing" function for DataFrame. | + | [`lt`](pandas.DataFrame.lt.html#pandas.DataFrame.lt "pandas.DataFrame.lt")(other[, axis, level]) | Get Less than of dataframe and other, element-wise (binary operator lt). | + | [`mad`](pandas.DataFrame.mad.html#pandas.DataFrame.mad "pandas.DataFrame.mad")([axis, skipna, level]) | (DEPRECATED) Return the mean absolute deviation of the values over the requested axis. | + | [`mask`](pandas.DataFrame.mask.html#pandas.DataFrame.mask "pandas.DataFrame.mask")(cond[, other, inplace, axis, level, ...]) | Replace values where the condition is True. | + | [`max`](pandas.DataFrame.max.html#pandas.DataFrame.max "pandas.DataFrame.max")([axis, skipna, level, numeric\_only]) | Return the maximum of the values over the requested axis. | + | [`mean`](pandas.DataFrame.mean.html#pandas.DataFrame.mean "pandas.DataFrame.mean")([axis, skipna, level, numeric\_only]) | Return the mean of the values over the requested axis. | + | [`median`](pandas.DataFrame.median.html#pandas.DataFrame.median "pandas.DataFrame.median")([axis, skipna, level, numeric\_only]) | Return the median of the values over the requested axis. | + | [`melt`](pandas.DataFrame.melt.html#pandas.DataFrame.melt "pandas.DataFrame.melt")([id\_vars, value\_vars, var\_name, ...]) | Unpivot a DataFrame from wide to long format, optionally leaving identifiers set. | + | [`memory_usage`](pandas.DataFrame.memory_usage.html#pandas.DataFrame.memory_usage "pandas.DataFrame.memory_usage")([index, deep]) | Return the memory usage of each column in bytes. | + | [`merge`](pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge")(right[, how, on, left\_on, right\_on, ...]) | Merge DataFrame or named Series objects with a database-style join. | + | [`min`](pandas.DataFrame.min.html#pandas.DataFrame.min "pandas.DataFrame.min")([axis, skipna, level, numeric\_only]) | Return the minimum of the values over the requested axis. | + | [`mod`](pandas.DataFrame.mod.html#pandas.DataFrame.mod "pandas.DataFrame.mod")(other[, axis, level, fill\_value]) | Get Modulo of dataframe and other, element-wise (binary operator mod). | + | [`mode`](pandas.DataFrame.mode.html#pandas.DataFrame.mode "pandas.DataFrame.mode")([axis, numeric\_only, dropna]) | Get the mode(s) of each element along the selected axis. | + | [`mul`](pandas.DataFrame.mul.html#pandas.DataFrame.mul "pandas.DataFrame.mul")(other[, axis, level, fill\_value]) | Get Multiplication of dataframe and other, element-wise (binary operator mul). | + | [`multiply`](pandas.DataFrame.multiply.html#pandas.DataFrame.multiply "pandas.DataFrame.multiply")(other[, axis, level, fill\_value]) | Get Multiplication of dataframe and other, element-wise (binary operator mul). | + | [`ne`](pandas.DataFrame.ne.html#pandas.DataFrame.ne "pandas.DataFrame.ne")(other[, axis, level]) | Get Not equal to of dataframe and other, element-wise (binary operator ne). | + | [`nlargest`](pandas.DataFrame.nlargest.html#pandas.DataFrame.nlargest "pandas.DataFrame.nlargest")(n, columns[, keep]) | Return the first n rows ordered by columns in descending order. | + | [`notna`](pandas.DataFrame.notna.html#pandas.DataFrame.notna "pandas.DataFrame.notna")() | Detect existing (non-missing) values. | + | [`notnull`](pandas.DataFrame.notnull.html#pandas.DataFrame.notnull "pandas.DataFrame.notnull")() | DataFrame.notnull is an alias for DataFrame.notna. | + | [`nsmallest`](pandas.DataFrame.nsmallest.html#pandas.DataFrame.nsmallest "pandas.DataFrame.nsmallest")(n, columns[, keep]) | Return the first n rows ordered by columns in ascending order. | + | [`nunique`](pandas.DataFrame.nunique.html#pandas.DataFrame.nunique "pandas.DataFrame.nunique")([axis, dropna]) | Count number of distinct elements in specified axis. | + | [`pad`](pandas.DataFrame.pad.html#pandas.DataFrame.pad "pandas.DataFrame.pad")(\*[, axis, inplace, limit, downcast]) | Synonym for [`DataFrame.fillna()`](pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") with `method='ffill'`. | + | [`pct_change`](pandas.DataFrame.pct_change.html#pandas.DataFrame.pct_change "pandas.DataFrame.pct_change")([periods, fill\_method, limit, freq]) | Percentage change between the current and a prior element. | + | [`pipe`](pandas.DataFrame.pipe.html#pandas.DataFrame.pipe "pandas.DataFrame.pipe")(func, \*args, \*\*kwargs) | Apply chainable functions that expect Series or DataFrames. | + | [`pivot`](pandas.DataFrame.pivot.html#pandas.DataFrame.pivot "pandas.DataFrame.pivot")(\*[, index, columns, values]) | Return reshaped DataFrame organized by given index / column values. | + | [`pivot_table`](pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table")([values, index, columns, ...]) | Create a spreadsheet-style pivot table as a DataFrame. | + | [`plot`](pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") | alias of `pandas.plotting._core.PlotAccessor` | + | [`pop`](pandas.DataFrame.pop.html#pandas.DataFrame.pop "pandas.DataFrame.pop")(item) | Return item and drop from frame. | + | [`pow`](pandas.DataFrame.pow.html#pandas.DataFrame.pow "pandas.DataFrame.pow")(other[, axis, level, fill\_value]) | Get Exponential power of dataframe and other, element-wise (binary operator pow). | + | [`prod`](pandas.DataFrame.prod.html#pandas.DataFrame.prod "pandas.DataFrame.prod")([axis, skipna, level, numeric\_only, ...]) | Return the product of the values over the requested axis. | + | [`product`](pandas.DataFrame.product.html#pandas.DataFrame.product "pandas.DataFrame.product")([axis, skipna, level, numeric\_only, ...]) | Return the product of the values over the requested axis. | + | [`quantile`](pandas.DataFrame.quantile.html#pandas.DataFrame.quantile "pandas.DataFrame.quantile")([q, axis, numeric\_only, ...]) | Return values at the given quantile over requested axis. | + | [`query`](pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query")(expr, \*[, inplace]) | Query the columns of a DataFrame with a boolean expression. | + | [`radd`](pandas.DataFrame.radd.html#pandas.DataFrame.radd "pandas.DataFrame.radd")(other[, axis, level, fill\_value]) | Get Addition of dataframe and other, element-wise (binary operator radd). | + | [`rank`](pandas.DataFrame.rank.html#pandas.DataFrame.rank "pandas.DataFrame.rank")([axis, method, numeric\_only, ...]) | Compute numerical data ranks (1 through n) along axis. | + | [`rdiv`](pandas.DataFrame.rdiv.html#pandas.DataFrame.rdiv "pandas.DataFrame.rdiv")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator rtruediv). | + | [`reindex`](pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex")([labels, index, columns, axis, ...]) | Conform Series/DataFrame to new index with optional filling logic. | + | [`reindex_like`](pandas.DataFrame.reindex_like.html#pandas.DataFrame.reindex_like "pandas.DataFrame.reindex_like")(other[, method, copy, limit, ...]) | Return an object with matching indices as other object. | + | [`rename`](pandas.DataFrame.rename.html#pandas.DataFrame.rename "pandas.DataFrame.rename")([mapper, index, columns, axis, copy, ...]) | Alter axes labels. | + | [`rename_axis`](pandas.DataFrame.rename_axis.html#pandas.DataFrame.rename_axis "pandas.DataFrame.rename_axis")([mapper, inplace]) | Set the name of the axis for the index or columns. | + | [`reorder_levels`](pandas.DataFrame.reorder_levels.html#pandas.DataFrame.reorder_levels "pandas.DataFrame.reorder_levels")(order[, axis]) | Rearrange index levels using input order. | + | [`replace`](pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace")([to\_replace, value, inplace, limit, ...]) | Replace values given in to\_replace with value. | + | [`resample`](pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample")(rule[, axis, closed, label, ...]) | Resample time-series data. | + | [`reset_index`](pandas.DataFrame.reset_index.html#pandas.DataFrame.reset_index "pandas.DataFrame.reset_index")([level, drop, inplace, ...]) | Reset the index, or a level of it. | + | [`rfloordiv`](pandas.DataFrame.rfloordiv.html#pandas.DataFrame.rfloordiv "pandas.DataFrame.rfloordiv")(other[, axis, level, fill\_value]) | Get Integer division of dataframe and other, element-wise (binary operator rfloordiv). | + | [`rmod`](pandas.DataFrame.rmod.html#pandas.DataFrame.rmod "pandas.DataFrame.rmod")(other[, axis, level, fill\_value]) | Get Modulo of dataframe and other, element-wise (binary operator rmod). | + | [`rmul`](pandas.DataFrame.rmul.html#pandas.DataFrame.rmul "pandas.DataFrame.rmul")(other[, axis, level, fill\_value]) | Get Multiplication of dataframe and other, element-wise (binary operator rmul). | + | [`rolling`](pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling")(window[, min\_periods, center, ...]) | Provide rolling window calculations. | + | [`round`](pandas.DataFrame.round.html#pandas.DataFrame.round "pandas.DataFrame.round")([decimals]) | Round a DataFrame to a variable number of decimal places. | + | [`rpow`](pandas.DataFrame.rpow.html#pandas.DataFrame.rpow "pandas.DataFrame.rpow")(other[, axis, level, fill\_value]) | Get Exponential power of dataframe and other, element-wise (binary operator rpow). | + | [`rsub`](pandas.DataFrame.rsub.html#pandas.DataFrame.rsub "pandas.DataFrame.rsub")(other[, axis, level, fill\_value]) | Get Subtraction of dataframe and other, element-wise (binary operator rsub). | + | [`rtruediv`](pandas.DataFrame.rtruediv.html#pandas.DataFrame.rtruediv "pandas.DataFrame.rtruediv")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator rtruediv). | + | [`sample`](pandas.DataFrame.sample.html#pandas.DataFrame.sample "pandas.DataFrame.sample")([n, frac, replace, weights, ...]) | Return a random sample of items from an axis of object. | + | [`select_dtypes`](pandas.DataFrame.select_dtypes.html#pandas.DataFrame.select_dtypes "pandas.DataFrame.select_dtypes")([include, exclude]) | Return a subset of the DataFrame's columns based on the column dtypes. | + | [`sem`](pandas.DataFrame.sem.html#pandas.DataFrame.sem "pandas.DataFrame.sem")([axis, skipna, level, ddof, numeric\_only]) | Return unbiased standard error of the mean over requested axis. | + | [`set_axis`](pandas.DataFrame.set_axis.html#pandas.DataFrame.set_axis "pandas.DataFrame.set_axis")(labels, \*[, axis, inplace, copy]) | Assign desired index to given axis. | + | [`set_flags`](pandas.DataFrame.set_flags.html#pandas.DataFrame.set_flags "pandas.DataFrame.set_flags")(\*[, copy, allows\_duplicate\_labels]) | Return a new object with updated flags. | + | [`set_index`](pandas.DataFrame.set_index.html#pandas.DataFrame.set_index "pandas.DataFrame.set_index")(keys, \*[, drop, append, inplace, ...]) | Set the DataFrame index using existing columns. | + | [`shift`](pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift")([periods, freq, axis, fill\_value]) | Shift index by desired number of periods with an optional time freq. | + | [`skew`](pandas.DataFrame.skew.html#pandas.DataFrame.skew "pandas.DataFrame.skew")([axis, skipna, level, numeric\_only]) | Return unbiased skew over requested axis. | + | [`slice_shift`](pandas.DataFrame.slice_shift.html#pandas.DataFrame.slice_shift "pandas.DataFrame.slice_shift")([periods, axis]) | (DEPRECATED) Equivalent to shift without copying data. | + | [`sort_index`](pandas.DataFrame.sort_index.html#pandas.DataFrame.sort_index "pandas.DataFrame.sort_index")(\*[, axis, level, ascending, ...]) | Sort object by labels (along an axis). | + | [`sort_values`](pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values")(by, \*[, axis, ascending, ...]) | Sort by the values along either axis. | + | [`sparse`](pandas.DataFrame.sparse.html#pandas.DataFrame.sparse "pandas.DataFrame.sparse") | alias of `pandas.core.arrays.sparse.accessor.SparseFrameAccessor` | + | [`squeeze`](pandas.DataFrame.squeeze.html#pandas.DataFrame.squeeze "pandas.DataFrame.squeeze")([axis]) | Squeeze 1 dimensional axis objects into scalars. | + | [`stack`](pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack")([level, dropna]) | Stack the prescribed level(s) from columns to index. | + | [`std`](pandas.DataFrame.std.html#pandas.DataFrame.std "pandas.DataFrame.std")([axis, skipna, level, ddof, numeric\_only]) | Return sample standard deviation over requested axis. | + | [`sub`](pandas.DataFrame.sub.html#pandas.DataFrame.sub "pandas.DataFrame.sub")(other[, axis, level, fill\_value]) | Get Subtraction of dataframe and other, element-wise (binary operator sub). | + | [`subtract`](pandas.DataFrame.subtract.html#pandas.DataFrame.subtract "pandas.DataFrame.subtract")(other[, axis, level, fill\_value]) | Get Subtraction of dataframe and other, element-wise (binary operator sub). | + | [`sum`](pandas.DataFrame.sum.html#pandas.DataFrame.sum "pandas.DataFrame.sum")([axis, skipna, level, numeric\_only, ...]) | Return the sum of the values over the requested axis. | + | [`swapaxes`](pandas.DataFrame.swapaxes.html#pandas.DataFrame.swapaxes "pandas.DataFrame.swapaxes")(axis1, axis2[, copy]) | Interchange axes and swap values axes appropriately. | + | [`swaplevel`](pandas.DataFrame.swaplevel.html#pandas.DataFrame.swaplevel "pandas.DataFrame.swaplevel")([i, j, axis]) | Swap levels i and j in a [`MultiIndex`](pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex"). | + | [`tail`](pandas.DataFrame.tail.html#pandas.DataFrame.tail "pandas.DataFrame.tail")([n]) | Return the last n rows. | + | [`take`](pandas.DataFrame.take.html#pandas.DataFrame.take "pandas.DataFrame.take")(indices[, axis, is\_copy]) | Return the elements in the given *positional* indices along an axis. | + | [`to_clipboard`](pandas.DataFrame.to_clipboard.html#pandas.DataFrame.to_clipboard "pandas.DataFrame.to_clipboard")([excel, sep]) | Copy object to the system clipboard. | + | [`to_csv`](pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv")([path\_or\_buf, sep, na\_rep, ...]) | Write object to a comma-separated values (csv) file. | + | [`to_dict`](pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict")([orient, into]) | Convert the DataFrame to a dictionary. | + | [`to_excel`](pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel")(excel\_writer[, sheet\_name, na\_rep, ...]) | Write object to an Excel sheet. | + | [`to_feather`](pandas.DataFrame.to_feather.html#pandas.DataFrame.to_feather "pandas.DataFrame.to_feather")(path, \*\*kwargs) | Write a DataFrame to the binary Feather format. | + | [`to_gbq`](pandas.DataFrame.to_gbq.html#pandas.DataFrame.to_gbq "pandas.DataFrame.to_gbq")(destination\_table[, project\_id, ...]) | Write a DataFrame to a Google BigQuery table. | + | [`to_hdf`](pandas.DataFrame.to_hdf.html#pandas.DataFrame.to_hdf "pandas.DataFrame.to_hdf")(path\_or\_buf, key[, mode, complevel, ...]) | Write the contained data to an HDF5 file using HDFStore. | + | [`to_html`](pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html")([buf, columns, col\_space, header, ...]) | Render a DataFrame as an HTML table. | + | [`to_json`](pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json")([path\_or\_buf, orient, date\_format, ...]) | Convert the object to a JSON string. | + | [`to_latex`](pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex")([buf, columns, col\_space, header, ...]) | Render object to a LaTeX tabular, longtable, or nested table. | + | [`to_markdown`](pandas.DataFrame.to_markdown.html#pandas.DataFrame.to_markdown "pandas.DataFrame.to_markdown")([buf, mode, index, storage\_options]) | Print DataFrame in Markdown-friendly format. | + | [`to_numpy`](pandas.DataFrame.to_numpy.html#pandas.DataFrame.to_numpy "pandas.DataFrame.to_numpy")([dtype, copy, na\_value]) | Convert the DataFrame to a NumPy array. | + | [`to_orc`](pandas.DataFrame.to_orc.html#pandas.DataFrame.to_orc "pandas.DataFrame.to_orc")([path, engine, index, engine\_kwargs]) | Write a DataFrame to the ORC format. | + | [`to_parquet`](pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet")([path, engine, compression, ...]) | Write a DataFrame to the binary parquet format. | + | [`to_period`](pandas.DataFrame.to_period.html#pandas.DataFrame.to_period "pandas.DataFrame.to_period")([freq, axis, copy]) | Convert DataFrame from DatetimeIndex to PeriodIndex. | + | [`to_pickle`](pandas.DataFrame.to_pickle.html#pandas.DataFrame.to_pickle "pandas.DataFrame.to_pickle")(path[, compression, protocol, ...]) | Pickle (serialize) object to file. | + | [`to_records`](pandas.DataFrame.to_records.html#pandas.DataFrame.to_records "pandas.DataFrame.to_records")([index, column\_dtypes, index\_dtypes]) | Convert DataFrame to a NumPy record array. | + | [`to_sql`](pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql")(name, con[, schema, if\_exists, ...]) | Write records stored in a DataFrame to a SQL database. | + | [`to_stata`](pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata")(path, \*[, convert\_dates, ...]) | Export DataFrame object to Stata dta format. | + | [`to_string`](pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string")([buf, columns, col\_space, header, ...]) | Render a DataFrame to a console-friendly tabular output. | + | [`to_timestamp`](pandas.DataFrame.to_timestamp.html#pandas.DataFrame.to_timestamp "pandas.DataFrame.to_timestamp")([freq, how, axis, copy]) | Cast to DatetimeIndex of timestamps, at *beginning* of period. | + | [`to_xarray`](pandas.DataFrame.to_xarray.html#pandas.DataFrame.to_xarray "pandas.DataFrame.to_xarray")() | Return an xarray object from the pandas object. | + | [`to_xml`](pandas.DataFrame.to_xml.html#pandas.DataFrame.to_xml "pandas.DataFrame.to_xml")([path\_or\_buffer, index, root\_name, ...]) | Render a DataFrame to an XML document. | + | [`transform`](pandas.DataFrame.transform.html#pandas.DataFrame.transform "pandas.DataFrame.transform")(func[, axis]) | Call `func` on self producing a DataFrame with the same axis shape as self. | + | [`transpose`](pandas.DataFrame.transpose.html#pandas.DataFrame.transpose "pandas.DataFrame.transpose")(\*args[, copy]) | Transpose index and columns. | + | [`truediv`](pandas.DataFrame.truediv.html#pandas.DataFrame.truediv "pandas.DataFrame.truediv")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator truediv). | + | [`truncate`](pandas.DataFrame.truncate.html#pandas.DataFrame.truncate "pandas.DataFrame.truncate")([before, after, axis, copy]) | Truncate a Series or DataFrame before and after some index value. | + | [`tshift`](pandas.DataFrame.tshift.html#pandas.DataFrame.tshift "pandas.DataFrame.tshift")([periods, freq, axis]) | (DEPRECATED) Shift the time index, using the index's frequency if available. | + | [`tz_convert`](pandas.DataFrame.tz_convert.html#pandas.DataFrame.tz_convert "pandas.DataFrame.tz_convert")(tz[, axis, level, copy]) | Convert tz-aware axis to target time zone. | + | [`tz_localize`](pandas.DataFrame.tz_localize.html#pandas.DataFrame.tz_localize "pandas.DataFrame.tz_localize")(tz[, axis, level, copy, ...]) | Localize tz-naive index of a Series or DataFrame to target time zone. | + | [`unstack`](pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack")([level, fill\_value]) | Pivot a level of the (necessarily hierarchical) index labels. | + | [`update`](pandas.DataFrame.update.html#pandas.DataFrame.update "pandas.DataFrame.update")(other[, join, overwrite, ...]) | Modify in place using non-NA values from another DataFrame. | + | [`value_counts`](pandas.DataFrame.value_counts.html#pandas.DataFrame.value_counts "pandas.DataFrame.value_counts")([subset, normalize, sort, ...]) | Return a Series containing counts of unique rows in the DataFrame. | + | [`var`](pandas.DataFrame.var.html#pandas.DataFrame.var "pandas.DataFrame.var")([axis, skipna, level, ddof, numeric\_only]) | Return unbiased variance over requested axis. | + | [`where`](pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where")(cond[, other, inplace, axis, level, ...]) | Replace values where the condition is False. | + | [`xs`](pandas.DataFrame.xs.html#pandas.DataFrame.xs "pandas.DataFrame.xs")(key[, axis, level, drop\_level]) | Return cross-section from the Series/DataFrame. | diff --git a/corpus/docs/pandas/dataframe/dataframe_20.md b/corpus/docs/pandas/dataframe/dataframe_20.md new file mode 100644 index 0000000000000000000000000000000000000000..9aae7c6e486f0002c959f63dc7ed27d5b1dbc559 --- /dev/null +++ b/corpus/docs/pandas/dataframe/dataframe_20.md @@ -0,0 +1,384 @@ +# pandas.DataFrame# + +Source: https://pandas.pydata.org/pandas-docs/version/2.0/reference/api/pandas.DataFrame.html +Version: 2.0 + +*class* pandas.DataFrame(*data=None*, *index=None*, *columns=None*, *dtype=None*, *copy=None*)[[source]](https://github.com/pandas-dev/pandas/blob/v2.0.3/pandas/core/frame.py#L490-L11586)[#](#pandas.DataFrame "Permalink to this definition") +: Two-dimensional, size-mutable, potentially heterogeneous tabular data. + + Data structure also contains labeled axes (rows and columns). + Arithmetic operations align on both row and column labels. Can be + thought of as a dict-like container for Series objects. The primary + pandas data structure. + + Parameters + : **data**ndarray (structured or homogeneous), Iterable, dict, or DataFrame + : Dict can contain Series, arrays, constants, dataclass or list-like objects. If + data is a dict, column order follows insertion-order. If a dict contains Series + which have an index defined, it is aligned by its index. This alignment also + occurs if data is a Series or a DataFrame itself. Alignment is done on + Series/DataFrame inputs. + + If data is a list of dicts, column order follows insertion-order. + + **index**Index or array-like + : Index to use for resulting frame. Will default to RangeIndex if + no indexing information part of input data and no index provided. + + **columns**Index or array-like + : Column labels to use for resulting frame when data does not have them, + defaulting to RangeIndex(0, 1, 2, …, n). If data contains column labels, + will perform column selection instead. + + **dtype**dtype, default None + : Data type to force. Only a single dtype is allowed. If None, infer. + + **copy**bool or None, default None + : Copy data from inputs. + For dict data, the default of None behaves like `copy=True`. For DataFrame + or 2d ndarray input, the default of None behaves like `copy=False`. + If data is a dict containing one or more Series (possibly of different dtypes), + `copy=False` will ensure that these inputs are not copied. + + Changed in version 1.3.0. + + See also + + [`DataFrame.from_records`](pandas.DataFrame.from_records.html#pandas.DataFrame.from_records "pandas.DataFrame.from_records") + : Constructor from tuples, also record arrays. + + [`DataFrame.from_dict`](pandas.DataFrame.from_dict.html#pandas.DataFrame.from_dict "pandas.DataFrame.from_dict") + : From dicts of Series, arrays, or dicts. + + [`read_csv`](pandas.read_csv.html#pandas.read_csv "pandas.read_csv") + : Read a comma-separated values (csv) file into DataFrame. + + [`read_table`](pandas.read_table.html#pandas.read_table "pandas.read_table") + : Read general delimited file into DataFrame. + + [`read_clipboard`](pandas.read_clipboard.html#pandas.read_clipboard "pandas.read_clipboard") + : Read text from clipboard into DataFrame. + + Notes + + Please reference the [User Guide](../../user_guide/dsintro.html#basics-dataframe) for more information. + + Examples + + Constructing DataFrame from a dictionary. + + ```None + >>> d = {'col1': [1, 2], 'col2': [3, 4]} + >>> df = pd.DataFrame(data=d) + >>> df + col1 col2 + 0 1 3 + 1 2 4 + ``` + + Notice that the inferred dtype is int64. + + ```None + >>> df.dtypes + col1 int64 + col2 int64 + dtype: object + ``` + + To enforce a single dtype: + + ```None + >>> df = pd.DataFrame(data=d, dtype=np.int8) + >>> df.dtypes + col1 int8 + col2 int8 + dtype: object + ``` + + Constructing DataFrame from a dictionary including Series: + + ```None + >>> d = {'col1': [0, 1, 2, 3], 'col2': pd.Series([2, 3], index=[2, 3])} + >>> pd.DataFrame(data=d, index=[0, 1, 2, 3]) + col1 col2 + 0 0 NaN + 1 1 NaN + 2 2 2.0 + 3 3 3.0 + ``` + + Constructing DataFrame from numpy ndarray: + + ```None + >>> df2 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), + ... columns=['a', 'b', 'c']) + >>> df2 + a b c + 0 1 2 3 + 1 4 5 6 + 2 7 8 9 + ``` + + Constructing DataFrame from a numpy ndarray that has labeled columns: + + ```None + >>> data = np.array([(1, 2, 3), (4, 5, 6), (7, 8, 9)], + ... dtype=[("a", "i4"), ("b", "i4"), ("c", "i4")]) + >>> df3 = pd.DataFrame(data, columns=['c', 'a']) + ... + >>> df3 + c a + 0 3 1 + 1 6 4 + 2 9 7 + ``` + + Constructing DataFrame from dataclass: + + ```None + >>> from dataclasses import make_dataclass + >>> Point = make_dataclass("Point", [("x", int), ("y", int)]) + >>> pd.DataFrame([Point(0, 0), Point(0, 3), Point(2, 3)]) + x y + 0 0 0 + 1 0 3 + 2 2 3 + ``` + + Constructing DataFrame from Series/DataFrame: + + ```None + >>> ser = pd.Series([1, 2, 3], index=["a", "b", "c"]) + >>> df = pd.DataFrame(data=ser, index=["a", "c"]) + >>> df + 0 + a 1 + c 3 + ``` + + ```None + >>> df1 = pd.DataFrame([1, 2, 3], index=["a", "b", "c"], columns=["x"]) + >>> df2 = pd.DataFrame(data=df1, index=["a", "c"]) + >>> df2 + x + a 1 + c 3 + ``` + + Attributes + + | | | + | --- | --- | + | [`T`](pandas.DataFrame.T.html#pandas.DataFrame.T "pandas.DataFrame.T") | The transpose of the DataFrame. | + | [`at`](pandas.DataFrame.at.html#pandas.DataFrame.at "pandas.DataFrame.at") | Access a single value for a row/column label pair. | + | [`attrs`](pandas.DataFrame.attrs.html#pandas.DataFrame.attrs "pandas.DataFrame.attrs") | Dictionary of global attributes of this dataset. | + | [`axes`](pandas.DataFrame.axes.html#pandas.DataFrame.axes "pandas.DataFrame.axes") | Return a list representing the axes of the DataFrame. | + | [`columns`](pandas.DataFrame.columns.html#pandas.DataFrame.columns "pandas.DataFrame.columns") | The column labels of the DataFrame. | + | [`dtypes`](pandas.DataFrame.dtypes.html#pandas.DataFrame.dtypes "pandas.DataFrame.dtypes") | Return the dtypes in the DataFrame. | + | [`empty`](pandas.DataFrame.empty.html#pandas.DataFrame.empty "pandas.DataFrame.empty") | Indicator whether Series/DataFrame is empty. | + | [`flags`](pandas.DataFrame.flags.html#pandas.DataFrame.flags "pandas.DataFrame.flags") | Get the properties associated with this pandas object. | + | [`iat`](pandas.DataFrame.iat.html#pandas.DataFrame.iat "pandas.DataFrame.iat") | Access a single value for a row/column pair by integer position. | + | [`iloc`](pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") | Purely integer-location based indexing for selection by position. | + | [`index`](pandas.DataFrame.index.html#pandas.DataFrame.index "pandas.DataFrame.index") | The index (row labels) of the DataFrame. | + | [`loc`](pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") | Access a group of rows and columns by label(s) or a boolean array. | + | [`ndim`](pandas.DataFrame.ndim.html#pandas.DataFrame.ndim "pandas.DataFrame.ndim") | Return an int representing the number of axes / array dimensions. | + | [`shape`](pandas.DataFrame.shape.html#pandas.DataFrame.shape "pandas.DataFrame.shape") | Return a tuple representing the dimensionality of the DataFrame. | + | [`size`](pandas.DataFrame.size.html#pandas.DataFrame.size "pandas.DataFrame.size") | Return an int representing the number of elements in this object. | + | [`style`](pandas.DataFrame.style.html#pandas.DataFrame.style "pandas.DataFrame.style") | Returns a Styler object. | + | [`values`](pandas.DataFrame.values.html#pandas.DataFrame.values "pandas.DataFrame.values") | Return a Numpy representation of the DataFrame. | + + Methods + + | | | + | --- | --- | + | [`abs`](pandas.DataFrame.abs.html#pandas.DataFrame.abs "pandas.DataFrame.abs")() | Return a Series/DataFrame with absolute numeric value of each element. | + | [`add`](pandas.DataFrame.add.html#pandas.DataFrame.add "pandas.DataFrame.add")(other[, axis, level, fill\_value]) | Get Addition of dataframe and other, element-wise (binary operator add). | + | [`add_prefix`](pandas.DataFrame.add_prefix.html#pandas.DataFrame.add_prefix "pandas.DataFrame.add_prefix")(prefix[, axis]) | Prefix labels with string prefix. | + | [`add_suffix`](pandas.DataFrame.add_suffix.html#pandas.DataFrame.add_suffix "pandas.DataFrame.add_suffix")(suffix[, axis]) | Suffix labels with string suffix. | + | [`agg`](pandas.DataFrame.agg.html#pandas.DataFrame.agg "pandas.DataFrame.agg")([func, axis]) | Aggregate using one or more operations over the specified axis. | + | [`aggregate`](pandas.DataFrame.aggregate.html#pandas.DataFrame.aggregate "pandas.DataFrame.aggregate")([func, axis]) | Aggregate using one or more operations over the specified axis. | + | [`align`](pandas.DataFrame.align.html#pandas.DataFrame.align "pandas.DataFrame.align")(other[, join, axis, level, copy, ...]) | Align two objects on their axes with the specified join method. | + | [`all`](pandas.DataFrame.all.html#pandas.DataFrame.all "pandas.DataFrame.all")([axis, bool\_only, skipna]) | Return whether all elements are True, potentially over an axis. | + | [`any`](pandas.DataFrame.any.html#pandas.DataFrame.any "pandas.DataFrame.any")(\*[, axis, bool\_only, skipna]) | Return whether any element is True, potentially over an axis. | + | [`apply`](pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply")(func[, axis, raw, result\_type, args]) | Apply a function along an axis of the DataFrame. | + | [`applymap`](pandas.DataFrame.applymap.html#pandas.DataFrame.applymap "pandas.DataFrame.applymap")(func[, na\_action]) | Apply a function to a Dataframe elementwise. | + | [`asfreq`](pandas.DataFrame.asfreq.html#pandas.DataFrame.asfreq "pandas.DataFrame.asfreq")(freq[, method, how, normalize, ...]) | Convert time series to specified frequency. | + | [`asof`](pandas.DataFrame.asof.html#pandas.DataFrame.asof "pandas.DataFrame.asof")(where[, subset]) | Return the last row(s) without any NaNs before where. | + | [`assign`](pandas.DataFrame.assign.html#pandas.DataFrame.assign "pandas.DataFrame.assign")(\*\*kwargs) | Assign new columns to a DataFrame. | + | [`astype`](pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype")(dtype[, copy, errors]) | Cast a pandas object to a specified dtype `dtype`. | + | [`at_time`](pandas.DataFrame.at_time.html#pandas.DataFrame.at_time "pandas.DataFrame.at_time")(time[, asof, axis]) | Select values at particular time of day (e.g., 9:30AM). | + | [`backfill`](pandas.DataFrame.backfill.html#pandas.DataFrame.backfill "pandas.DataFrame.backfill")(\*[, axis, inplace, limit, downcast]) | (DEPRECATED) Synonym for [`DataFrame.fillna()`](pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") with `method='bfill'`. | + | [`between_time`](pandas.DataFrame.between_time.html#pandas.DataFrame.between_time "pandas.DataFrame.between_time")(start\_time, end\_time[, ...]) | Select values between particular times of the day (e.g., 9:00-9:30 AM). | + | [`bfill`](pandas.DataFrame.bfill.html#pandas.DataFrame.bfill "pandas.DataFrame.bfill")(\*[, axis, inplace, limit, downcast]) | Synonym for [`DataFrame.fillna()`](pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") with `method='bfill'`. | + | [`bool`](pandas.DataFrame.bool.html#pandas.DataFrame.bool "pandas.DataFrame.bool")() | Return the bool of a single element Series or DataFrame. | + | [`boxplot`](pandas.DataFrame.boxplot.html#pandas.DataFrame.boxplot "pandas.DataFrame.boxplot")([column, by, ax, fontsize, rot, ...]) | Make a box plot from DataFrame columns. | + | [`clip`](pandas.DataFrame.clip.html#pandas.DataFrame.clip "pandas.DataFrame.clip")([lower, upper, axis, inplace]) | Trim values at input threshold(s). | + | [`combine`](pandas.DataFrame.combine.html#pandas.DataFrame.combine "pandas.DataFrame.combine")(other, func[, fill\_value, overwrite]) | Perform column-wise combine with another DataFrame. | + | [`combine_first`](pandas.DataFrame.combine_first.html#pandas.DataFrame.combine_first "pandas.DataFrame.combine_first")(other) | Update null elements with value in the same location in other. | + | [`compare`](pandas.DataFrame.compare.html#pandas.DataFrame.compare "pandas.DataFrame.compare")(other[, align\_axis, keep\_shape, ...]) | Compare to another DataFrame and show the differences. | + | [`convert_dtypes`](pandas.DataFrame.convert_dtypes.html#pandas.DataFrame.convert_dtypes "pandas.DataFrame.convert_dtypes")([infer\_objects, ...]) | Convert columns to the best possible dtypes using dtypes supporting `pd.NA`. | + | [`copy`](pandas.DataFrame.copy.html#pandas.DataFrame.copy "pandas.DataFrame.copy")([deep]) | Make a copy of this object's indices and data. | + | [`corr`](pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr")([method, min\_periods, numeric\_only]) | Compute pairwise correlation of columns, excluding NA/null values. | + | [`corrwith`](pandas.DataFrame.corrwith.html#pandas.DataFrame.corrwith "pandas.DataFrame.corrwith")(other[, axis, drop, method, ...]) | Compute pairwise correlation. | + | [`count`](pandas.DataFrame.count.html#pandas.DataFrame.count "pandas.DataFrame.count")([axis, numeric\_only]) | Count non-NA cells for each column or row. | + | [`cov`](pandas.DataFrame.cov.html#pandas.DataFrame.cov "pandas.DataFrame.cov")([min\_periods, ddof, numeric\_only]) | Compute pairwise covariance of columns, excluding NA/null values. | + | [`cummax`](pandas.DataFrame.cummax.html#pandas.DataFrame.cummax "pandas.DataFrame.cummax")([axis, skipna]) | Return cumulative maximum over a DataFrame or Series axis. | + | [`cummin`](pandas.DataFrame.cummin.html#pandas.DataFrame.cummin "pandas.DataFrame.cummin")([axis, skipna]) | Return cumulative minimum over a DataFrame or Series axis. | + | [`cumprod`](pandas.DataFrame.cumprod.html#pandas.DataFrame.cumprod "pandas.DataFrame.cumprod")([axis, skipna]) | Return cumulative product over a DataFrame or Series axis. | + | [`cumsum`](pandas.DataFrame.cumsum.html#pandas.DataFrame.cumsum "pandas.DataFrame.cumsum")([axis, skipna]) | Return cumulative sum over a DataFrame or Series axis. | + | [`describe`](pandas.DataFrame.describe.html#pandas.DataFrame.describe "pandas.DataFrame.describe")([percentiles, include, exclude]) | Generate descriptive statistics. | + | [`diff`](pandas.DataFrame.diff.html#pandas.DataFrame.diff "pandas.DataFrame.diff")([periods, axis]) | First discrete difference of element. | + | [`div`](pandas.DataFrame.div.html#pandas.DataFrame.div "pandas.DataFrame.div")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator truediv). | + | [`divide`](pandas.DataFrame.divide.html#pandas.DataFrame.divide "pandas.DataFrame.divide")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator truediv). | + | [`dot`](pandas.DataFrame.dot.html#pandas.DataFrame.dot "pandas.DataFrame.dot")(other) | Compute the matrix multiplication between the DataFrame and other. | + | [`drop`](pandas.DataFrame.drop.html#pandas.DataFrame.drop "pandas.DataFrame.drop")([labels, axis, index, columns, level, ...]) | Drop specified labels from rows or columns. | + | [`drop_duplicates`](pandas.DataFrame.drop_duplicates.html#pandas.DataFrame.drop_duplicates "pandas.DataFrame.drop_duplicates")([subset, keep, inplace, ...]) | Return DataFrame with duplicate rows removed. | + | [`droplevel`](pandas.DataFrame.droplevel.html#pandas.DataFrame.droplevel "pandas.DataFrame.droplevel")(level[, axis]) | Return Series/DataFrame with requested index / column level(s) removed. | + | [`dropna`](pandas.DataFrame.dropna.html#pandas.DataFrame.dropna "pandas.DataFrame.dropna")(\*[, axis, how, thresh, subset, ...]) | Remove missing values. | + | [`duplicated`](pandas.DataFrame.duplicated.html#pandas.DataFrame.duplicated "pandas.DataFrame.duplicated")([subset, keep]) | Return boolean Series denoting duplicate rows. | + | [`eq`](pandas.DataFrame.eq.html#pandas.DataFrame.eq "pandas.DataFrame.eq")(other[, axis, level]) | Get Equal to of dataframe and other, element-wise (binary operator eq). | + | [`equals`](pandas.DataFrame.equals.html#pandas.DataFrame.equals "pandas.DataFrame.equals")(other) | Test whether two objects contain the same elements. | + | [`eval`](pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval")(expr, \*[, inplace]) | Evaluate a string describing operations on DataFrame columns. | + | [`ewm`](pandas.DataFrame.ewm.html#pandas.DataFrame.ewm "pandas.DataFrame.ewm")([com, span, halflife, alpha, ...]) | Provide exponentially weighted (EW) calculations. | + | [`expanding`](pandas.DataFrame.expanding.html#pandas.DataFrame.expanding "pandas.DataFrame.expanding")([min\_periods, axis, method]) | Provide expanding window calculations. | + | [`explode`](pandas.DataFrame.explode.html#pandas.DataFrame.explode "pandas.DataFrame.explode")(column[, ignore\_index]) | Transform each element of a list-like to a row, replicating index values. | + | [`ffill`](pandas.DataFrame.ffill.html#pandas.DataFrame.ffill "pandas.DataFrame.ffill")(\*[, axis, inplace, limit, downcast]) | Synonym for [`DataFrame.fillna()`](pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") with `method='ffill'`. | + | [`fillna`](pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna")([value, method, axis, inplace, ...]) | Fill NA/NaN values using the specified method. | + | [`filter`](pandas.DataFrame.filter.html#pandas.DataFrame.filter "pandas.DataFrame.filter")([items, like, regex, axis]) | Subset the dataframe rows or columns according to the specified index labels. | + | [`first`](pandas.DataFrame.first.html#pandas.DataFrame.first "pandas.DataFrame.first")(offset) | Select initial periods of time series data based on a date offset. | + | [`first_valid_index`](pandas.DataFrame.first_valid_index.html#pandas.DataFrame.first_valid_index "pandas.DataFrame.first_valid_index")() | Return index for first non-NA value or None, if no non-NA value is found. | + | [`floordiv`](pandas.DataFrame.floordiv.html#pandas.DataFrame.floordiv "pandas.DataFrame.floordiv")(other[, axis, level, fill\_value]) | Get Integer division of dataframe and other, element-wise (binary operator floordiv). | + | [`from_dict`](pandas.DataFrame.from_dict.html#pandas.DataFrame.from_dict "pandas.DataFrame.from_dict")(data[, orient, dtype, columns]) | Construct DataFrame from dict of array-like or dicts. | + | [`from_records`](pandas.DataFrame.from_records.html#pandas.DataFrame.from_records "pandas.DataFrame.from_records")(data[, index, exclude, ...]) | Convert structured or record ndarray to DataFrame. | + | [`ge`](pandas.DataFrame.ge.html#pandas.DataFrame.ge "pandas.DataFrame.ge")(other[, axis, level]) | Get Greater than or equal to of dataframe and other, element-wise (binary operator ge). | + | [`get`](pandas.DataFrame.get.html#pandas.DataFrame.get "pandas.DataFrame.get")(key[, default]) | Get item from object for given key (ex: DataFrame column). | + | [`groupby`](pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby")([by, axis, level, as\_index, sort, ...]) | Group DataFrame using a mapper or by a Series of columns. | + | [`gt`](pandas.DataFrame.gt.html#pandas.DataFrame.gt "pandas.DataFrame.gt")(other[, axis, level]) | Get Greater than of dataframe and other, element-wise (binary operator gt). | + | [`head`](pandas.DataFrame.head.html#pandas.DataFrame.head "pandas.DataFrame.head")([n]) | Return the first n rows. | + | [`hist`](pandas.DataFrame.hist.html#pandas.DataFrame.hist "pandas.DataFrame.hist")([column, by, grid, xlabelsize, xrot, ...]) | Make a histogram of the DataFrame's columns. | + | [`idxmax`](pandas.DataFrame.idxmax.html#pandas.DataFrame.idxmax "pandas.DataFrame.idxmax")([axis, skipna, numeric\_only]) | Return index of first occurrence of maximum over requested axis. | + | [`idxmin`](pandas.DataFrame.idxmin.html#pandas.DataFrame.idxmin "pandas.DataFrame.idxmin")([axis, skipna, numeric\_only]) | Return index of first occurrence of minimum over requested axis. | + | [`infer_objects`](pandas.DataFrame.infer_objects.html#pandas.DataFrame.infer_objects "pandas.DataFrame.infer_objects")([copy]) | Attempt to infer better dtypes for object columns. | + | [`info`](pandas.DataFrame.info.html#pandas.DataFrame.info "pandas.DataFrame.info")([verbose, buf, max\_cols, memory\_usage, ...]) | Print a concise summary of a DataFrame. | + | [`insert`](pandas.DataFrame.insert.html#pandas.DataFrame.insert "pandas.DataFrame.insert")(loc, column, value[, allow\_duplicates]) | Insert column into DataFrame at specified location. | + | [`interpolate`](pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate")([method, axis, limit, inplace, ...]) | Fill NaN values using an interpolation method. | + | [`isetitem`](pandas.DataFrame.isetitem.html#pandas.DataFrame.isetitem "pandas.DataFrame.isetitem")(loc, value) | Set the given value in the column with position loc. | + | [`isin`](pandas.DataFrame.isin.html#pandas.DataFrame.isin "pandas.DataFrame.isin")(values) | Whether each element in the DataFrame is contained in values. | + | [`isna`](pandas.DataFrame.isna.html#pandas.DataFrame.isna "pandas.DataFrame.isna")() | Detect missing values. | + | [`isnull`](pandas.DataFrame.isnull.html#pandas.DataFrame.isnull "pandas.DataFrame.isnull")() | DataFrame.isnull is an alias for DataFrame.isna. | + | [`items`](pandas.DataFrame.items.html#pandas.DataFrame.items "pandas.DataFrame.items")() | Iterate over (column name, Series) pairs. | + | [`iterrows`](pandas.DataFrame.iterrows.html#pandas.DataFrame.iterrows "pandas.DataFrame.iterrows")() | Iterate over DataFrame rows as (index, Series) pairs. | + | [`itertuples`](pandas.DataFrame.itertuples.html#pandas.DataFrame.itertuples "pandas.DataFrame.itertuples")([index, name]) | Iterate over DataFrame rows as namedtuples. | + | [`join`](pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join")(other[, on, how, lsuffix, rsuffix, ...]) | Join columns of another DataFrame. | + | [`keys`](pandas.DataFrame.keys.html#pandas.DataFrame.keys "pandas.DataFrame.keys")() | Get the 'info axis' (see Indexing for more). | + | [`kurt`](pandas.DataFrame.kurt.html#pandas.DataFrame.kurt "pandas.DataFrame.kurt")([axis, skipna, numeric\_only]) | Return unbiased kurtosis over requested axis. | + | [`kurtosis`](pandas.DataFrame.kurtosis.html#pandas.DataFrame.kurtosis "pandas.DataFrame.kurtosis")([axis, skipna, numeric\_only]) | Return unbiased kurtosis over requested axis. | + | [`last`](pandas.DataFrame.last.html#pandas.DataFrame.last "pandas.DataFrame.last")(offset) | Select final periods of time series data based on a date offset. | + | [`last_valid_index`](pandas.DataFrame.last_valid_index.html#pandas.DataFrame.last_valid_index "pandas.DataFrame.last_valid_index")() | Return index for last non-NA value or None, if no non-NA value is found. | + | [`le`](pandas.DataFrame.le.html#pandas.DataFrame.le "pandas.DataFrame.le")(other[, axis, level]) | Get Less than or equal to of dataframe and other, element-wise (binary operator le). | + | [`lt`](pandas.DataFrame.lt.html#pandas.DataFrame.lt "pandas.DataFrame.lt")(other[, axis, level]) | Get Less than of dataframe and other, element-wise (binary operator lt). | + | [`mask`](pandas.DataFrame.mask.html#pandas.DataFrame.mask "pandas.DataFrame.mask")(cond[, other, inplace, axis, level]) | Replace values where the condition is True. | + | [`max`](pandas.DataFrame.max.html#pandas.DataFrame.max "pandas.DataFrame.max")([axis, skipna, numeric\_only]) | Return the maximum of the values over the requested axis. | + | [`mean`](pandas.DataFrame.mean.html#pandas.DataFrame.mean "pandas.DataFrame.mean")([axis, skipna, numeric\_only]) | Return the mean of the values over the requested axis. | + | [`median`](pandas.DataFrame.median.html#pandas.DataFrame.median "pandas.DataFrame.median")([axis, skipna, numeric\_only]) | Return the median of the values over the requested axis. | + | [`melt`](pandas.DataFrame.melt.html#pandas.DataFrame.melt "pandas.DataFrame.melt")([id\_vars, value\_vars, var\_name, ...]) | Unpivot a DataFrame from wide to long format, optionally leaving identifiers set. | + | [`memory_usage`](pandas.DataFrame.memory_usage.html#pandas.DataFrame.memory_usage "pandas.DataFrame.memory_usage")([index, deep]) | Return the memory usage of each column in bytes. | + | [`merge`](pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge")(right[, how, on, left\_on, right\_on, ...]) | Merge DataFrame or named Series objects with a database-style join. | + | [`min`](pandas.DataFrame.min.html#pandas.DataFrame.min "pandas.DataFrame.min")([axis, skipna, numeric\_only]) | Return the minimum of the values over the requested axis. | + | [`mod`](pandas.DataFrame.mod.html#pandas.DataFrame.mod "pandas.DataFrame.mod")(other[, axis, level, fill\_value]) | Get Modulo of dataframe and other, element-wise (binary operator mod). | + | [`mode`](pandas.DataFrame.mode.html#pandas.DataFrame.mode "pandas.DataFrame.mode")([axis, numeric\_only, dropna]) | Get the mode(s) of each element along the selected axis. | + | [`mul`](pandas.DataFrame.mul.html#pandas.DataFrame.mul "pandas.DataFrame.mul")(other[, axis, level, fill\_value]) | Get Multiplication of dataframe and other, element-wise (binary operator mul). | + | [`multiply`](pandas.DataFrame.multiply.html#pandas.DataFrame.multiply "pandas.DataFrame.multiply")(other[, axis, level, fill\_value]) | Get Multiplication of dataframe and other, element-wise (binary operator mul). | + | [`ne`](pandas.DataFrame.ne.html#pandas.DataFrame.ne "pandas.DataFrame.ne")(other[, axis, level]) | Get Not equal to of dataframe and other, element-wise (binary operator ne). | + | [`nlargest`](pandas.DataFrame.nlargest.html#pandas.DataFrame.nlargest "pandas.DataFrame.nlargest")(n, columns[, keep]) | Return the first n rows ordered by columns in descending order. | + | [`notna`](pandas.DataFrame.notna.html#pandas.DataFrame.notna "pandas.DataFrame.notna")() | Detect existing (non-missing) values. | + | [`notnull`](pandas.DataFrame.notnull.html#pandas.DataFrame.notnull "pandas.DataFrame.notnull")() | DataFrame.notnull is an alias for DataFrame.notna. | + | [`nsmallest`](pandas.DataFrame.nsmallest.html#pandas.DataFrame.nsmallest "pandas.DataFrame.nsmallest")(n, columns[, keep]) | Return the first n rows ordered by columns in ascending order. | + | [`nunique`](pandas.DataFrame.nunique.html#pandas.DataFrame.nunique "pandas.DataFrame.nunique")([axis, dropna]) | Count number of distinct elements in specified axis. | + | [`pad`](pandas.DataFrame.pad.html#pandas.DataFrame.pad "pandas.DataFrame.pad")(\*[, axis, inplace, limit, downcast]) | (DEPRECATED) Synonym for [`DataFrame.fillna()`](pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna") with `method='ffill'`. | + | [`pct_change`](pandas.DataFrame.pct_change.html#pandas.DataFrame.pct_change "pandas.DataFrame.pct_change")([periods, fill\_method, limit, freq]) | Percentage change between the current and a prior element. | + | [`pipe`](pandas.DataFrame.pipe.html#pandas.DataFrame.pipe "pandas.DataFrame.pipe")(func, \*args, \*\*kwargs) | Apply chainable functions that expect Series or DataFrames. | + | [`pivot`](pandas.DataFrame.pivot.html#pandas.DataFrame.pivot "pandas.DataFrame.pivot")(\*, columns[, index, values]) | Return reshaped DataFrame organized by given index / column values. | + | [`pivot_table`](pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table")([values, index, columns, ...]) | Create a spreadsheet-style pivot table as a DataFrame. | + | [`plot`](pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") | alias of `pandas.plotting._core.PlotAccessor` | + | [`pop`](pandas.DataFrame.pop.html#pandas.DataFrame.pop "pandas.DataFrame.pop")(item) | Return item and drop from frame. | + | [`pow`](pandas.DataFrame.pow.html#pandas.DataFrame.pow "pandas.DataFrame.pow")(other[, axis, level, fill\_value]) | Get Exponential power of dataframe and other, element-wise (binary operator pow). | + | [`prod`](pandas.DataFrame.prod.html#pandas.DataFrame.prod "pandas.DataFrame.prod")([axis, skipna, numeric\_only, min\_count]) | Return the product of the values over the requested axis. | + | [`product`](pandas.DataFrame.product.html#pandas.DataFrame.product "pandas.DataFrame.product")([axis, skipna, numeric\_only, min\_count]) | Return the product of the values over the requested axis. | + | [`quantile`](pandas.DataFrame.quantile.html#pandas.DataFrame.quantile "pandas.DataFrame.quantile")([q, axis, numeric\_only, ...]) | Return values at the given quantile over requested axis. | + | [`query`](pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query")(expr, \*[, inplace]) | Query the columns of a DataFrame with a boolean expression. | + | [`radd`](pandas.DataFrame.radd.html#pandas.DataFrame.radd "pandas.DataFrame.radd")(other[, axis, level, fill\_value]) | Get Addition of dataframe and other, element-wise (binary operator radd). | + | [`rank`](pandas.DataFrame.rank.html#pandas.DataFrame.rank "pandas.DataFrame.rank")([axis, method, numeric\_only, ...]) | Compute numerical data ranks (1 through n) along axis. | + | [`rdiv`](pandas.DataFrame.rdiv.html#pandas.DataFrame.rdiv "pandas.DataFrame.rdiv")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator rtruediv). | + | [`reindex`](pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex")([labels, index, columns, axis, ...]) | Conform DataFrame to new index with optional filling logic. | + | [`reindex_like`](pandas.DataFrame.reindex_like.html#pandas.DataFrame.reindex_like "pandas.DataFrame.reindex_like")(other[, method, copy, limit, ...]) | Return an object with matching indices as other object. | + | [`rename`](pandas.DataFrame.rename.html#pandas.DataFrame.rename "pandas.DataFrame.rename")([mapper, index, columns, axis, copy, ...]) | Rename columns or index labels. | + | [`rename_axis`](pandas.DataFrame.rename_axis.html#pandas.DataFrame.rename_axis "pandas.DataFrame.rename_axis")([mapper, index, columns, axis, ...]) | Set the name of the axis for the index or columns. | + | [`reorder_levels`](pandas.DataFrame.reorder_levels.html#pandas.DataFrame.reorder_levels "pandas.DataFrame.reorder_levels")(order[, axis]) | Rearrange index levels using input order. | + | [`replace`](pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace")([to\_replace, value, inplace, limit, ...]) | Replace values given in to\_replace with value. | + | [`resample`](pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample")(rule[, axis, closed, label, ...]) | Resample time-series data. | + | [`reset_index`](pandas.DataFrame.reset_index.html#pandas.DataFrame.reset_index "pandas.DataFrame.reset_index")([level, drop, inplace, ...]) | Reset the index, or a level of it. | + | [`rfloordiv`](pandas.DataFrame.rfloordiv.html#pandas.DataFrame.rfloordiv "pandas.DataFrame.rfloordiv")(other[, axis, level, fill\_value]) | Get Integer division of dataframe and other, element-wise (binary operator rfloordiv). | + | [`rmod`](pandas.DataFrame.rmod.html#pandas.DataFrame.rmod "pandas.DataFrame.rmod")(other[, axis, level, fill\_value]) | Get Modulo of dataframe and other, element-wise (binary operator rmod). | + | [`rmul`](pandas.DataFrame.rmul.html#pandas.DataFrame.rmul "pandas.DataFrame.rmul")(other[, axis, level, fill\_value]) | Get Multiplication of dataframe and other, element-wise (binary operator rmul). | + | [`rolling`](pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling")(window[, min\_periods, center, ...]) | Provide rolling window calculations. | + | [`round`](pandas.DataFrame.round.html#pandas.DataFrame.round "pandas.DataFrame.round")([decimals]) | Round a DataFrame to a variable number of decimal places. | + | [`rpow`](pandas.DataFrame.rpow.html#pandas.DataFrame.rpow "pandas.DataFrame.rpow")(other[, axis, level, fill\_value]) | Get Exponential power of dataframe and other, element-wise (binary operator rpow). | + | [`rsub`](pandas.DataFrame.rsub.html#pandas.DataFrame.rsub "pandas.DataFrame.rsub")(other[, axis, level, fill\_value]) | Get Subtraction of dataframe and other, element-wise (binary operator rsub). | + | [`rtruediv`](pandas.DataFrame.rtruediv.html#pandas.DataFrame.rtruediv "pandas.DataFrame.rtruediv")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator rtruediv). | + | [`sample`](pandas.DataFrame.sample.html#pandas.DataFrame.sample "pandas.DataFrame.sample")([n, frac, replace, weights, ...]) | Return a random sample of items from an axis of object. | + | [`select_dtypes`](pandas.DataFrame.select_dtypes.html#pandas.DataFrame.select_dtypes "pandas.DataFrame.select_dtypes")([include, exclude]) | Return a subset of the DataFrame's columns based on the column dtypes. | + | [`sem`](pandas.DataFrame.sem.html#pandas.DataFrame.sem "pandas.DataFrame.sem")([axis, skipna, ddof, numeric\_only]) | Return unbiased standard error of the mean over requested axis. | + | [`set_axis`](pandas.DataFrame.set_axis.html#pandas.DataFrame.set_axis "pandas.DataFrame.set_axis")(labels, \*[, axis, copy]) | Assign desired index to given axis. | + | [`set_flags`](pandas.DataFrame.set_flags.html#pandas.DataFrame.set_flags "pandas.DataFrame.set_flags")(\*[, copy, allows\_duplicate\_labels]) | Return a new object with updated flags. | + | [`set_index`](pandas.DataFrame.set_index.html#pandas.DataFrame.set_index "pandas.DataFrame.set_index")(keys, \*[, drop, append, inplace, ...]) | Set the DataFrame index using existing columns. | + | [`shift`](pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift")([periods, freq, axis, fill\_value]) | Shift index by desired number of periods with an optional time freq. | + | [`skew`](pandas.DataFrame.skew.html#pandas.DataFrame.skew "pandas.DataFrame.skew")([axis, skipna, numeric\_only]) | Return unbiased skew over requested axis. | + | [`sort_index`](pandas.DataFrame.sort_index.html#pandas.DataFrame.sort_index "pandas.DataFrame.sort_index")(\*[, axis, level, ascending, ...]) | Sort object by labels (along an axis). | + | [`sort_values`](pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values")(by, \*[, axis, ascending, ...]) | Sort by the values along either axis. | + | [`sparse`](pandas.DataFrame.sparse.html#pandas.DataFrame.sparse "pandas.DataFrame.sparse") | alias of `pandas.core.arrays.sparse.accessor.SparseFrameAccessor` | + | [`squeeze`](pandas.DataFrame.squeeze.html#pandas.DataFrame.squeeze "pandas.DataFrame.squeeze")([axis]) | Squeeze 1 dimensional axis objects into scalars. | + | [`stack`](pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack")([level, dropna]) | Stack the prescribed level(s) from columns to index. | + | [`std`](pandas.DataFrame.std.html#pandas.DataFrame.std "pandas.DataFrame.std")([axis, skipna, ddof, numeric\_only]) | Return sample standard deviation over requested axis. | + | [`sub`](pandas.DataFrame.sub.html#pandas.DataFrame.sub "pandas.DataFrame.sub")(other[, axis, level, fill\_value]) | Get Subtraction of dataframe and other, element-wise (binary operator sub). | + | [`subtract`](pandas.DataFrame.subtract.html#pandas.DataFrame.subtract "pandas.DataFrame.subtract")(other[, axis, level, fill\_value]) | Get Subtraction of dataframe and other, element-wise (binary operator sub). | + | [`sum`](pandas.DataFrame.sum.html#pandas.DataFrame.sum "pandas.DataFrame.sum")([axis, skipna, numeric\_only, min\_count]) | Return the sum of the values over the requested axis. | + | [`swapaxes`](pandas.DataFrame.swapaxes.html#pandas.DataFrame.swapaxes "pandas.DataFrame.swapaxes")(axis1, axis2[, copy]) | Interchange axes and swap values axes appropriately. | + | [`swaplevel`](pandas.DataFrame.swaplevel.html#pandas.DataFrame.swaplevel "pandas.DataFrame.swaplevel")([i, j, axis]) | Swap levels i and j in a [`MultiIndex`](pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex"). | + | [`tail`](pandas.DataFrame.tail.html#pandas.DataFrame.tail "pandas.DataFrame.tail")([n]) | Return the last n rows. | + | [`take`](pandas.DataFrame.take.html#pandas.DataFrame.take "pandas.DataFrame.take")(indices[, axis]) | Return the elements in the given *positional* indices along an axis. | + | [`to_clipboard`](pandas.DataFrame.to_clipboard.html#pandas.DataFrame.to_clipboard "pandas.DataFrame.to_clipboard")([excel, sep]) | Copy object to the system clipboard. | + | [`to_csv`](pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv")([path\_or\_buf, sep, na\_rep, ...]) | Write object to a comma-separated values (csv) file. | + | [`to_dict`](pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict")([orient, into, index]) | Convert the DataFrame to a dictionary. | + | [`to_excel`](pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel")(excel\_writer[, sheet\_name, na\_rep, ...]) | Write object to an Excel sheet. | + | [`to_feather`](pandas.DataFrame.to_feather.html#pandas.DataFrame.to_feather "pandas.DataFrame.to_feather")(path, \*\*kwargs) | Write a DataFrame to the binary Feather format. | + | [`to_gbq`](pandas.DataFrame.to_gbq.html#pandas.DataFrame.to_gbq "pandas.DataFrame.to_gbq")(destination\_table[, project\_id, ...]) | Write a DataFrame to a Google BigQuery table. | + | [`to_hdf`](pandas.DataFrame.to_hdf.html#pandas.DataFrame.to_hdf "pandas.DataFrame.to_hdf")(path\_or\_buf, key[, mode, complevel, ...]) | Write the contained data to an HDF5 file using HDFStore. | + | [`to_html`](pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html")([buf, columns, col\_space, header, ...]) | Render a DataFrame as an HTML table. | + | [`to_json`](pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json")([path\_or\_buf, orient, date\_format, ...]) | Convert the object to a JSON string. | + | [`to_latex`](pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex")([buf, columns, header, index, ...]) | Render object to a LaTeX tabular, longtable, or nested table. | + | [`to_markdown`](pandas.DataFrame.to_markdown.html#pandas.DataFrame.to_markdown "pandas.DataFrame.to_markdown")([buf, mode, index, storage\_options]) | Print DataFrame in Markdown-friendly format. | + | [`to_numpy`](pandas.DataFrame.to_numpy.html#pandas.DataFrame.to_numpy "pandas.DataFrame.to_numpy")([dtype, copy, na\_value]) | Convert the DataFrame to a NumPy array. | + | [`to_orc`](pandas.DataFrame.to_orc.html#pandas.DataFrame.to_orc "pandas.DataFrame.to_orc")([path, engine, index, engine\_kwargs]) | Write a DataFrame to the ORC format. | + | [`to_parquet`](pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet")([path, engine, compression, ...]) | Write a DataFrame to the binary parquet format. | + | [`to_period`](pandas.DataFrame.to_period.html#pandas.DataFrame.to_period "pandas.DataFrame.to_period")([freq, axis, copy]) | Convert DataFrame from DatetimeIndex to PeriodIndex. | + | [`to_pickle`](pandas.DataFrame.to_pickle.html#pandas.DataFrame.to_pickle "pandas.DataFrame.to_pickle")(path[, compression, protocol, ...]) | Pickle (serialize) object to file. | + | [`to_records`](pandas.DataFrame.to_records.html#pandas.DataFrame.to_records "pandas.DataFrame.to_records")([index, column\_dtypes, index\_dtypes]) | Convert DataFrame to a NumPy record array. | + | [`to_sql`](pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql")(name, con[, schema, if\_exists, ...]) | Write records stored in a DataFrame to a SQL database. | + | [`to_stata`](pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata")(path, \*[, convert\_dates, ...]) | Export DataFrame object to Stata dta format. | + | [`to_string`](pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string")([buf, columns, col\_space, header, ...]) | Render a DataFrame to a console-friendly tabular output. | + | [`to_timestamp`](pandas.DataFrame.to_timestamp.html#pandas.DataFrame.to_timestamp "pandas.DataFrame.to_timestamp")([freq, how, axis, copy]) | Cast to DatetimeIndex of timestamps, at *beginning* of period. | + | [`to_xarray`](pandas.DataFrame.to_xarray.html#pandas.DataFrame.to_xarray "pandas.DataFrame.to_xarray")() | Return an xarray object from the pandas object. | + | [`to_xml`](pandas.DataFrame.to_xml.html#pandas.DataFrame.to_xml "pandas.DataFrame.to_xml")([path\_or\_buffer, index, root\_name, ...]) | Render a DataFrame to an XML document. | + | [`transform`](pandas.DataFrame.transform.html#pandas.DataFrame.transform "pandas.DataFrame.transform")(func[, axis]) | Call `func` on self producing a DataFrame with the same axis shape as self. | + | [`transpose`](pandas.DataFrame.transpose.html#pandas.DataFrame.transpose "pandas.DataFrame.transpose")(\*args[, copy]) | Transpose index and columns. | + | [`truediv`](pandas.DataFrame.truediv.html#pandas.DataFrame.truediv "pandas.DataFrame.truediv")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator truediv). | + | [`truncate`](pandas.DataFrame.truncate.html#pandas.DataFrame.truncate "pandas.DataFrame.truncate")([before, after, axis, copy]) | Truncate a Series or DataFrame before and after some index value. | + | [`tz_convert`](pandas.DataFrame.tz_convert.html#pandas.DataFrame.tz_convert "pandas.DataFrame.tz_convert")(tz[, axis, level, copy]) | Convert tz-aware axis to target time zone. | + | [`tz_localize`](pandas.DataFrame.tz_localize.html#pandas.DataFrame.tz_localize "pandas.DataFrame.tz_localize")(tz[, axis, level, copy, ...]) | Localize tz-naive index of a Series or DataFrame to target time zone. | + | [`unstack`](pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack")([level, fill\_value]) | Pivot a level of the (necessarily hierarchical) index labels. | + | [`update`](pandas.DataFrame.update.html#pandas.DataFrame.update "pandas.DataFrame.update")(other[, join, overwrite, ...]) | Modify in place using non-NA values from another DataFrame. | + | [`value_counts`](pandas.DataFrame.value_counts.html#pandas.DataFrame.value_counts "pandas.DataFrame.value_counts")([subset, normalize, sort, ...]) | Return a Series containing counts of unique rows in the DataFrame. | + | [`var`](pandas.DataFrame.var.html#pandas.DataFrame.var "pandas.DataFrame.var")([axis, skipna, ddof, numeric\_only]) | Return unbiased variance over requested axis. | + | [`where`](pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where")(cond[, other, inplace, axis, level]) | Replace values where the condition is False. | + | [`xs`](pandas.DataFrame.xs.html#pandas.DataFrame.xs "pandas.DataFrame.xs")(key[, axis, level, drop\_level]) | Return cross-section from the Series/DataFrame. | diff --git a/corpus/docs/pandas/dataframe/dataframe_21.md b/corpus/docs/pandas/dataframe/dataframe_21.md new file mode 100644 index 0000000000000000000000000000000000000000..a00878c66e9cb759b17c161e771a1ad75578ac46 --- /dev/null +++ b/corpus/docs/pandas/dataframe/dataframe_21.md @@ -0,0 +1,385 @@ +# pandas.DataFrame# + +Source: https://pandas.pydata.org/pandas-docs/version/2.1/reference/api/pandas.DataFrame.html +Version: 2.1 + +*class* pandas.DataFrame(*data=None*, *index=None*, *columns=None*, *dtype=None*, *copy=None*)[[source]](https://github.com/pandas-dev/pandas/blob/v2.1.4/pandas/core/frame.py#L491-L12281)[#](#pandas.DataFrame "Permalink to this definition") +: Two-dimensional, size-mutable, potentially heterogeneous tabular data. + + Data structure also contains labeled axes (rows and columns). + Arithmetic operations align on both row and column labels. Can be + thought of as a dict-like container for Series objects. The primary + pandas data structure. + + Parameters: + : **data**ndarray (structured or homogeneous), Iterable, dict, or DataFrame + : Dict can contain Series, arrays, constants, dataclass or list-like objects. If + data is a dict, column order follows insertion-order. If a dict contains Series + which have an index defined, it is aligned by its index. This alignment also + occurs if data is a Series or a DataFrame itself. Alignment is done on + Series/DataFrame inputs. + + If data is a list of dicts, column order follows insertion-order. + + **index**Index or array-like + : Index to use for resulting frame. Will default to RangeIndex if + no indexing information part of input data and no index provided. + + **columns**Index or array-like + : Column labels to use for resulting frame when data does not have them, + defaulting to RangeIndex(0, 1, 2, …, n). If data contains column labels, + will perform column selection instead. + + **dtype**dtype, default None + : Data type to force. Only a single dtype is allowed. If None, infer. + + **copy**bool or None, default None + : Copy data from inputs. + For dict data, the default of None behaves like `copy=True`. For DataFrame + or 2d ndarray input, the default of None behaves like `copy=False`. + If data is a dict containing one or more Series (possibly of different dtypes), + `copy=False` will ensure that these inputs are not copied. + + Changed in version 1.3.0. + + See also + + [`DataFrame.from_records`](pandas.DataFrame.from_records.html#pandas.DataFrame.from_records "pandas.DataFrame.from_records") + : Constructor from tuples, also record arrays. + + [`DataFrame.from_dict`](pandas.DataFrame.from_dict.html#pandas.DataFrame.from_dict "pandas.DataFrame.from_dict") + : From dicts of Series, arrays, or dicts. + + [`read_csv`](pandas.read_csv.html#pandas.read_csv "pandas.read_csv") + : Read a comma-separated values (csv) file into DataFrame. + + [`read_table`](pandas.read_table.html#pandas.read_table "pandas.read_table") + : Read general delimited file into DataFrame. + + [`read_clipboard`](pandas.read_clipboard.html#pandas.read_clipboard "pandas.read_clipboard") + : Read text from clipboard into DataFrame. + + Notes + + Please reference the [User Guide](../../user_guide/dsintro.html#basics-dataframe) for more information. + + Examples + + Constructing DataFrame from a dictionary. + + ```None + >>> d = {'col1': [1, 2], 'col2': [3, 4]} + >>> df = pd.DataFrame(data=d) + >>> df + col1 col2 + 0 1 3 + 1 2 4 + ``` + + Notice that the inferred dtype is int64. + + ```None + >>> df.dtypes + col1 int64 + col2 int64 + dtype: object + ``` + + To enforce a single dtype: + + ```None + >>> df = pd.DataFrame(data=d, dtype=np.int8) + >>> df.dtypes + col1 int8 + col2 int8 + dtype: object + ``` + + Constructing DataFrame from a dictionary including Series: + + ```None + >>> d = {'col1': [0, 1, 2, 3], 'col2': pd.Series([2, 3], index=[2, 3])} + >>> pd.DataFrame(data=d, index=[0, 1, 2, 3]) + col1 col2 + 0 0 NaN + 1 1 NaN + 2 2 2.0 + 3 3 3.0 + ``` + + Constructing DataFrame from numpy ndarray: + + ```None + >>> df2 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), + ... columns=['a', 'b', 'c']) + >>> df2 + a b c + 0 1 2 3 + 1 4 5 6 + 2 7 8 9 + ``` + + Constructing DataFrame from a numpy ndarray that has labeled columns: + + ```None + >>> data = np.array([(1, 2, 3), (4, 5, 6), (7, 8, 9)], + ... dtype=[("a", "i4"), ("b", "i4"), ("c", "i4")]) + >>> df3 = pd.DataFrame(data, columns=['c', 'a']) + ... + >>> df3 + c a + 0 3 1 + 1 6 4 + 2 9 7 + ``` + + Constructing DataFrame from dataclass: + + ```None + >>> from dataclasses import make_dataclass + >>> Point = make_dataclass("Point", [("x", int), ("y", int)]) + >>> pd.DataFrame([Point(0, 0), Point(0, 3), Point(2, 3)]) + x y + 0 0 0 + 1 0 3 + 2 2 3 + ``` + + Constructing DataFrame from Series/DataFrame: + + ```None + >>> ser = pd.Series([1, 2, 3], index=["a", "b", "c"]) + >>> df = pd.DataFrame(data=ser, index=["a", "c"]) + >>> df + 0 + a 1 + c 3 + ``` + + ```None + >>> df1 = pd.DataFrame([1, 2, 3], index=["a", "b", "c"], columns=["x"]) + >>> df2 = pd.DataFrame(data=df1, index=["a", "c"]) + >>> df2 + x + a 1 + c 3 + ``` + + Attributes + + | | | + | --- | --- | + | [`T`](pandas.DataFrame.T.html#pandas.DataFrame.T "pandas.DataFrame.T") | The transpose of the DataFrame. | + | [`at`](pandas.DataFrame.at.html#pandas.DataFrame.at "pandas.DataFrame.at") | Access a single value for a row/column label pair. | + | [`attrs`](pandas.DataFrame.attrs.html#pandas.DataFrame.attrs "pandas.DataFrame.attrs") | Dictionary of global attributes of this dataset. | + | [`axes`](pandas.DataFrame.axes.html#pandas.DataFrame.axes "pandas.DataFrame.axes") | Return a list representing the axes of the DataFrame. | + | [`columns`](pandas.DataFrame.columns.html#pandas.DataFrame.columns "pandas.DataFrame.columns") | The column labels of the DataFrame. | + | [`dtypes`](pandas.DataFrame.dtypes.html#pandas.DataFrame.dtypes "pandas.DataFrame.dtypes") | Return the dtypes in the DataFrame. | + | [`empty`](pandas.DataFrame.empty.html#pandas.DataFrame.empty "pandas.DataFrame.empty") | Indicator whether Series/DataFrame is empty. | + | [`flags`](pandas.DataFrame.flags.html#pandas.DataFrame.flags "pandas.DataFrame.flags") | Get the properties associated with this pandas object. | + | [`iat`](pandas.DataFrame.iat.html#pandas.DataFrame.iat "pandas.DataFrame.iat") | Access a single value for a row/column pair by integer position. | + | [`iloc`](pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") | Purely integer-location based indexing for selection by position. | + | [`index`](pandas.DataFrame.index.html#pandas.DataFrame.index "pandas.DataFrame.index") | The index (row labels) of the DataFrame. | + | [`loc`](pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") | Access a group of rows and columns by label(s) or a boolean array. | + | [`ndim`](pandas.DataFrame.ndim.html#pandas.DataFrame.ndim "pandas.DataFrame.ndim") | Return an int representing the number of axes / array dimensions. | + | [`shape`](pandas.DataFrame.shape.html#pandas.DataFrame.shape "pandas.DataFrame.shape") | Return a tuple representing the dimensionality of the DataFrame. | + | [`size`](pandas.DataFrame.size.html#pandas.DataFrame.size "pandas.DataFrame.size") | Return an int representing the number of elements in this object. | + | [`style`](pandas.DataFrame.style.html#pandas.DataFrame.style "pandas.DataFrame.style") | Returns a Styler object. | + | [`values`](pandas.DataFrame.values.html#pandas.DataFrame.values "pandas.DataFrame.values") | Return a Numpy representation of the DataFrame. | + + Methods + + | | | + | --- | --- | + | [`abs`](pandas.DataFrame.abs.html#pandas.DataFrame.abs "pandas.DataFrame.abs")() | Return a Series/DataFrame with absolute numeric value of each element. | + | [`add`](pandas.DataFrame.add.html#pandas.DataFrame.add "pandas.DataFrame.add")(other[, axis, level, fill\_value]) | Get Addition of dataframe and other, element-wise (binary operator add). | + | [`add_prefix`](pandas.DataFrame.add_prefix.html#pandas.DataFrame.add_prefix "pandas.DataFrame.add_prefix")(prefix[, axis]) | Prefix labels with string prefix. | + | [`add_suffix`](pandas.DataFrame.add_suffix.html#pandas.DataFrame.add_suffix "pandas.DataFrame.add_suffix")(suffix[, axis]) | Suffix labels with string suffix. | + | [`agg`](pandas.DataFrame.agg.html#pandas.DataFrame.agg "pandas.DataFrame.agg")([func, axis]) | Aggregate using one or more operations over the specified axis. | + | [`aggregate`](pandas.DataFrame.aggregate.html#pandas.DataFrame.aggregate "pandas.DataFrame.aggregate")([func, axis]) | Aggregate using one or more operations over the specified axis. | + | [`align`](pandas.DataFrame.align.html#pandas.DataFrame.align "pandas.DataFrame.align")(other[, join, axis, level, copy, ...]) | Align two objects on their axes with the specified join method. | + | [`all`](pandas.DataFrame.all.html#pandas.DataFrame.all "pandas.DataFrame.all")([axis, bool\_only, skipna]) | Return whether all elements are True, potentially over an axis. | + | [`any`](pandas.DataFrame.any.html#pandas.DataFrame.any "pandas.DataFrame.any")(\*[, axis, bool\_only, skipna]) | Return whether any element is True, potentially over an axis. | + | [`apply`](pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply")(func[, axis, raw, result\_type, args, ...]) | Apply a function along an axis of the DataFrame. | + | [`applymap`](pandas.DataFrame.applymap.html#pandas.DataFrame.applymap "pandas.DataFrame.applymap")(func[, na\_action]) | (DEPRECATED) Apply a function to a Dataframe elementwise. | + | [`asfreq`](pandas.DataFrame.asfreq.html#pandas.DataFrame.asfreq "pandas.DataFrame.asfreq")(freq[, method, how, normalize, ...]) | Convert time series to specified frequency. | + | [`asof`](pandas.DataFrame.asof.html#pandas.DataFrame.asof "pandas.DataFrame.asof")(where[, subset]) | Return the last row(s) without any NaNs before where. | + | [`assign`](pandas.DataFrame.assign.html#pandas.DataFrame.assign "pandas.DataFrame.assign")(\*\*kwargs) | Assign new columns to a DataFrame. | + | [`astype`](pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype")(dtype[, copy, errors]) | Cast a pandas object to a specified dtype `dtype`. | + | [`at_time`](pandas.DataFrame.at_time.html#pandas.DataFrame.at_time "pandas.DataFrame.at_time")(time[, asof, axis]) | Select values at particular time of day (e.g., 9:30AM). | + | [`backfill`](pandas.DataFrame.backfill.html#pandas.DataFrame.backfill "pandas.DataFrame.backfill")(\*[, axis, inplace, limit, downcast]) | (DEPRECATED) Fill NA/NaN values by using the next valid observation to fill the gap. | + | [`between_time`](pandas.DataFrame.between_time.html#pandas.DataFrame.between_time "pandas.DataFrame.between_time")(start\_time, end\_time[, ...]) | Select values between particular times of the day (e.g., 9:00-9:30 AM). | + | [`bfill`](pandas.DataFrame.bfill.html#pandas.DataFrame.bfill "pandas.DataFrame.bfill")(\*[, axis, inplace, limit, downcast]) | Fill NA/NaN values by using the next valid observation to fill the gap. | + | [`bool`](pandas.DataFrame.bool.html#pandas.DataFrame.bool "pandas.DataFrame.bool")() | (DEPRECATED) Return the bool of a single element Series or DataFrame. | + | [`boxplot`](pandas.DataFrame.boxplot.html#pandas.DataFrame.boxplot "pandas.DataFrame.boxplot")([column, by, ax, fontsize, rot, ...]) | Make a box plot from DataFrame columns. | + | [`clip`](pandas.DataFrame.clip.html#pandas.DataFrame.clip "pandas.DataFrame.clip")([lower, upper, axis, inplace]) | Trim values at input threshold(s). | + | [`combine`](pandas.DataFrame.combine.html#pandas.DataFrame.combine "pandas.DataFrame.combine")(other, func[, fill\_value, overwrite]) | Perform column-wise combine with another DataFrame. | + | [`combine_first`](pandas.DataFrame.combine_first.html#pandas.DataFrame.combine_first "pandas.DataFrame.combine_first")(other) | Update null elements with value in the same location in other. | + | [`compare`](pandas.DataFrame.compare.html#pandas.DataFrame.compare "pandas.DataFrame.compare")(other[, align\_axis, keep\_shape, ...]) | Compare to another DataFrame and show the differences. | + | [`convert_dtypes`](pandas.DataFrame.convert_dtypes.html#pandas.DataFrame.convert_dtypes "pandas.DataFrame.convert_dtypes")([infer\_objects, ...]) | Convert columns to the best possible dtypes using dtypes supporting `pd.NA`. | + | [`copy`](pandas.DataFrame.copy.html#pandas.DataFrame.copy "pandas.DataFrame.copy")([deep]) | Make a copy of this object's indices and data. | + | [`corr`](pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr")([method, min\_periods, numeric\_only]) | Compute pairwise correlation of columns, excluding NA/null values. | + | [`corrwith`](pandas.DataFrame.corrwith.html#pandas.DataFrame.corrwith "pandas.DataFrame.corrwith")(other[, axis, drop, method, ...]) | Compute pairwise correlation. | + | [`count`](pandas.DataFrame.count.html#pandas.DataFrame.count "pandas.DataFrame.count")([axis, numeric\_only]) | Count non-NA cells for each column or row. | + | [`cov`](pandas.DataFrame.cov.html#pandas.DataFrame.cov "pandas.DataFrame.cov")([min\_periods, ddof, numeric\_only]) | Compute pairwise covariance of columns, excluding NA/null values. | + | [`cummax`](pandas.DataFrame.cummax.html#pandas.DataFrame.cummax "pandas.DataFrame.cummax")([axis, skipna]) | Return cumulative maximum over a DataFrame or Series axis. | + | [`cummin`](pandas.DataFrame.cummin.html#pandas.DataFrame.cummin "pandas.DataFrame.cummin")([axis, skipna]) | Return cumulative minimum over a DataFrame or Series axis. | + | [`cumprod`](pandas.DataFrame.cumprod.html#pandas.DataFrame.cumprod "pandas.DataFrame.cumprod")([axis, skipna]) | Return cumulative product over a DataFrame or Series axis. | + | [`cumsum`](pandas.DataFrame.cumsum.html#pandas.DataFrame.cumsum "pandas.DataFrame.cumsum")([axis, skipna]) | Return cumulative sum over a DataFrame or Series axis. | + | [`describe`](pandas.DataFrame.describe.html#pandas.DataFrame.describe "pandas.DataFrame.describe")([percentiles, include, exclude]) | Generate descriptive statistics. | + | [`diff`](pandas.DataFrame.diff.html#pandas.DataFrame.diff "pandas.DataFrame.diff")([periods, axis]) | First discrete difference of element. | + | [`div`](pandas.DataFrame.div.html#pandas.DataFrame.div "pandas.DataFrame.div")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator truediv). | + | [`divide`](pandas.DataFrame.divide.html#pandas.DataFrame.divide "pandas.DataFrame.divide")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator truediv). | + | [`dot`](pandas.DataFrame.dot.html#pandas.DataFrame.dot "pandas.DataFrame.dot")(other) | Compute the matrix multiplication between the DataFrame and other. | + | [`drop`](pandas.DataFrame.drop.html#pandas.DataFrame.drop "pandas.DataFrame.drop")([labels, axis, index, columns, level, ...]) | Drop specified labels from rows or columns. | + | [`drop_duplicates`](pandas.DataFrame.drop_duplicates.html#pandas.DataFrame.drop_duplicates "pandas.DataFrame.drop_duplicates")([subset, keep, inplace, ...]) | Return DataFrame with duplicate rows removed. | + | [`droplevel`](pandas.DataFrame.droplevel.html#pandas.DataFrame.droplevel "pandas.DataFrame.droplevel")(level[, axis]) | Return Series/DataFrame with requested index / column level(s) removed. | + | [`dropna`](pandas.DataFrame.dropna.html#pandas.DataFrame.dropna "pandas.DataFrame.dropna")(\*[, axis, how, thresh, subset, ...]) | Remove missing values. | + | [`duplicated`](pandas.DataFrame.duplicated.html#pandas.DataFrame.duplicated "pandas.DataFrame.duplicated")([subset, keep]) | Return boolean Series denoting duplicate rows. | + | [`eq`](pandas.DataFrame.eq.html#pandas.DataFrame.eq "pandas.DataFrame.eq")(other[, axis, level]) | Get Equal to of dataframe and other, element-wise (binary operator eq). | + | [`equals`](pandas.DataFrame.equals.html#pandas.DataFrame.equals "pandas.DataFrame.equals")(other) | Test whether two objects contain the same elements. | + | [`eval`](pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval")(expr, \*[, inplace]) | Evaluate a string describing operations on DataFrame columns. | + | [`ewm`](pandas.DataFrame.ewm.html#pandas.DataFrame.ewm "pandas.DataFrame.ewm")([com, span, halflife, alpha, ...]) | Provide exponentially weighted (EW) calculations. | + | [`expanding`](pandas.DataFrame.expanding.html#pandas.DataFrame.expanding "pandas.DataFrame.expanding")([min\_periods, axis, method]) | Provide expanding window calculations. | + | [`explode`](pandas.DataFrame.explode.html#pandas.DataFrame.explode "pandas.DataFrame.explode")(column[, ignore\_index]) | Transform each element of a list-like to a row, replicating index values. | + | [`ffill`](pandas.DataFrame.ffill.html#pandas.DataFrame.ffill "pandas.DataFrame.ffill")(\*[, axis, inplace, limit, downcast]) | Fill NA/NaN values by propagating the last valid observation to next valid. | + | [`fillna`](pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna")([value, method, axis, inplace, ...]) | Fill NA/NaN values using the specified method. | + | [`filter`](pandas.DataFrame.filter.html#pandas.DataFrame.filter "pandas.DataFrame.filter")([items, like, regex, axis]) | Subset the dataframe rows or columns according to the specified index labels. | + | [`first`](pandas.DataFrame.first.html#pandas.DataFrame.first "pandas.DataFrame.first")(offset) | (DEPRECATED) Select initial periods of time series data based on a date offset. | + | [`first_valid_index`](pandas.DataFrame.first_valid_index.html#pandas.DataFrame.first_valid_index "pandas.DataFrame.first_valid_index")() | Return index for first non-NA value or None, if no non-NA value is found. | + | [`floordiv`](pandas.DataFrame.floordiv.html#pandas.DataFrame.floordiv "pandas.DataFrame.floordiv")(other[, axis, level, fill\_value]) | Get Integer division of dataframe and other, element-wise (binary operator floordiv). | + | [`from_dict`](pandas.DataFrame.from_dict.html#pandas.DataFrame.from_dict "pandas.DataFrame.from_dict")(data[, orient, dtype, columns]) | Construct DataFrame from dict of array-like or dicts. | + | [`from_records`](pandas.DataFrame.from_records.html#pandas.DataFrame.from_records "pandas.DataFrame.from_records")(data[, index, exclude, ...]) | Convert structured or record ndarray to DataFrame. | + | [`ge`](pandas.DataFrame.ge.html#pandas.DataFrame.ge "pandas.DataFrame.ge")(other[, axis, level]) | Get Greater than or equal to of dataframe and other, element-wise (binary operator ge). | + | [`get`](pandas.DataFrame.get.html#pandas.DataFrame.get "pandas.DataFrame.get")(key[, default]) | Get item from object for given key (ex: DataFrame column). | + | [`groupby`](pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby")([by, axis, level, as\_index, sort, ...]) | Group DataFrame using a mapper or by a Series of columns. | + | [`gt`](pandas.DataFrame.gt.html#pandas.DataFrame.gt "pandas.DataFrame.gt")(other[, axis, level]) | Get Greater than of dataframe and other, element-wise (binary operator gt). | + | [`head`](pandas.DataFrame.head.html#pandas.DataFrame.head "pandas.DataFrame.head")([n]) | Return the first n rows. | + | [`hist`](pandas.DataFrame.hist.html#pandas.DataFrame.hist "pandas.DataFrame.hist")([column, by, grid, xlabelsize, xrot, ...]) | Make a histogram of the DataFrame's columns. | + | [`idxmax`](pandas.DataFrame.idxmax.html#pandas.DataFrame.idxmax "pandas.DataFrame.idxmax")([axis, skipna, numeric\_only]) | Return index of first occurrence of maximum over requested axis. | + | [`idxmin`](pandas.DataFrame.idxmin.html#pandas.DataFrame.idxmin "pandas.DataFrame.idxmin")([axis, skipna, numeric\_only]) | Return index of first occurrence of minimum over requested axis. | + | [`infer_objects`](pandas.DataFrame.infer_objects.html#pandas.DataFrame.infer_objects "pandas.DataFrame.infer_objects")([copy]) | Attempt to infer better dtypes for object columns. | + | [`info`](pandas.DataFrame.info.html#pandas.DataFrame.info "pandas.DataFrame.info")([verbose, buf, max\_cols, memory\_usage, ...]) | Print a concise summary of a DataFrame. | + | [`insert`](pandas.DataFrame.insert.html#pandas.DataFrame.insert "pandas.DataFrame.insert")(loc, column, value[, allow\_duplicates]) | Insert column into DataFrame at specified location. | + | [`interpolate`](pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate")([method, axis, limit, inplace, ...]) | Fill NaN values using an interpolation method. | + | [`isetitem`](pandas.DataFrame.isetitem.html#pandas.DataFrame.isetitem "pandas.DataFrame.isetitem")(loc, value) | Set the given value in the column with position loc. | + | [`isin`](pandas.DataFrame.isin.html#pandas.DataFrame.isin "pandas.DataFrame.isin")(values) | Whether each element in the DataFrame is contained in values. | + | [`isna`](pandas.DataFrame.isna.html#pandas.DataFrame.isna "pandas.DataFrame.isna")() | Detect missing values. | + | [`isnull`](pandas.DataFrame.isnull.html#pandas.DataFrame.isnull "pandas.DataFrame.isnull")() | DataFrame.isnull is an alias for DataFrame.isna. | + | [`items`](pandas.DataFrame.items.html#pandas.DataFrame.items "pandas.DataFrame.items")() | Iterate over (column name, Series) pairs. | + | [`iterrows`](pandas.DataFrame.iterrows.html#pandas.DataFrame.iterrows "pandas.DataFrame.iterrows")() | Iterate over DataFrame rows as (index, Series) pairs. | + | [`itertuples`](pandas.DataFrame.itertuples.html#pandas.DataFrame.itertuples "pandas.DataFrame.itertuples")([index, name]) | Iterate over DataFrame rows as namedtuples. | + | [`join`](pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join")(other[, on, how, lsuffix, rsuffix, ...]) | Join columns of another DataFrame. | + | [`keys`](pandas.DataFrame.keys.html#pandas.DataFrame.keys "pandas.DataFrame.keys")() | Get the 'info axis' (see Indexing for more). | + | [`kurt`](pandas.DataFrame.kurt.html#pandas.DataFrame.kurt "pandas.DataFrame.kurt")([axis, skipna, numeric\_only]) | Return unbiased kurtosis over requested axis. | + | [`kurtosis`](pandas.DataFrame.kurtosis.html#pandas.DataFrame.kurtosis "pandas.DataFrame.kurtosis")([axis, skipna, numeric\_only]) | Return unbiased kurtosis over requested axis. | + | [`last`](pandas.DataFrame.last.html#pandas.DataFrame.last "pandas.DataFrame.last")(offset) | (DEPRECATED) Select final periods of time series data based on a date offset. | + | [`last_valid_index`](pandas.DataFrame.last_valid_index.html#pandas.DataFrame.last_valid_index "pandas.DataFrame.last_valid_index")() | Return index for last non-NA value or None, if no non-NA value is found. | + | [`le`](pandas.DataFrame.le.html#pandas.DataFrame.le "pandas.DataFrame.le")(other[, axis, level]) | Get Less than or equal to of dataframe and other, element-wise (binary operator le). | + | [`lt`](pandas.DataFrame.lt.html#pandas.DataFrame.lt "pandas.DataFrame.lt")(other[, axis, level]) | Get Less than of dataframe and other, element-wise (binary operator lt). | + | [`map`](pandas.DataFrame.map.html#pandas.DataFrame.map "pandas.DataFrame.map")(func[, na\_action]) | Apply a function to a Dataframe elementwise. | + | [`mask`](pandas.DataFrame.mask.html#pandas.DataFrame.mask "pandas.DataFrame.mask")(cond[, other, inplace, axis, level]) | Replace values where the condition is True. | + | [`max`](pandas.DataFrame.max.html#pandas.DataFrame.max "pandas.DataFrame.max")([axis, skipna, numeric\_only]) | Return the maximum of the values over the requested axis. | + | [`mean`](pandas.DataFrame.mean.html#pandas.DataFrame.mean "pandas.DataFrame.mean")([axis, skipna, numeric\_only]) | Return the mean of the values over the requested axis. | + | [`median`](pandas.DataFrame.median.html#pandas.DataFrame.median "pandas.DataFrame.median")([axis, skipna, numeric\_only]) | Return the median of the values over the requested axis. | + | [`melt`](pandas.DataFrame.melt.html#pandas.DataFrame.melt "pandas.DataFrame.melt")([id\_vars, value\_vars, var\_name, ...]) | Unpivot a DataFrame from wide to long format, optionally leaving identifiers set. | + | [`memory_usage`](pandas.DataFrame.memory_usage.html#pandas.DataFrame.memory_usage "pandas.DataFrame.memory_usage")([index, deep]) | Return the memory usage of each column in bytes. | + | [`merge`](pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge")(right[, how, on, left\_on, right\_on, ...]) | Merge DataFrame or named Series objects with a database-style join. | + | [`min`](pandas.DataFrame.min.html#pandas.DataFrame.min "pandas.DataFrame.min")([axis, skipna, numeric\_only]) | Return the minimum of the values over the requested axis. | + | [`mod`](pandas.DataFrame.mod.html#pandas.DataFrame.mod "pandas.DataFrame.mod")(other[, axis, level, fill\_value]) | Get Modulo of dataframe and other, element-wise (binary operator mod). | + | [`mode`](pandas.DataFrame.mode.html#pandas.DataFrame.mode "pandas.DataFrame.mode")([axis, numeric\_only, dropna]) | Get the mode(s) of each element along the selected axis. | + | [`mul`](pandas.DataFrame.mul.html#pandas.DataFrame.mul "pandas.DataFrame.mul")(other[, axis, level, fill\_value]) | Get Multiplication of dataframe and other, element-wise (binary operator mul). | + | [`multiply`](pandas.DataFrame.multiply.html#pandas.DataFrame.multiply "pandas.DataFrame.multiply")(other[, axis, level, fill\_value]) | Get Multiplication of dataframe and other, element-wise (binary operator mul). | + | [`ne`](pandas.DataFrame.ne.html#pandas.DataFrame.ne "pandas.DataFrame.ne")(other[, axis, level]) | Get Not equal to of dataframe and other, element-wise (binary operator ne). | + | [`nlargest`](pandas.DataFrame.nlargest.html#pandas.DataFrame.nlargest "pandas.DataFrame.nlargest")(n, columns[, keep]) | Return the first n rows ordered by columns in descending order. | + | [`notna`](pandas.DataFrame.notna.html#pandas.DataFrame.notna "pandas.DataFrame.notna")() | Detect existing (non-missing) values. | + | [`notnull`](pandas.DataFrame.notnull.html#pandas.DataFrame.notnull "pandas.DataFrame.notnull")() | DataFrame.notnull is an alias for DataFrame.notna. | + | [`nsmallest`](pandas.DataFrame.nsmallest.html#pandas.DataFrame.nsmallest "pandas.DataFrame.nsmallest")(n, columns[, keep]) | Return the first n rows ordered by columns in ascending order. | + | [`nunique`](pandas.DataFrame.nunique.html#pandas.DataFrame.nunique "pandas.DataFrame.nunique")([axis, dropna]) | Count number of distinct elements in specified axis. | + | [`pad`](pandas.DataFrame.pad.html#pandas.DataFrame.pad "pandas.DataFrame.pad")(\*[, axis, inplace, limit, downcast]) | (DEPRECATED) Fill NA/NaN values by propagating the last valid observation to next valid. | + | [`pct_change`](pandas.DataFrame.pct_change.html#pandas.DataFrame.pct_change "pandas.DataFrame.pct_change")([periods, fill\_method, limit, freq]) | Fractional change between the current and a prior element. | + | [`pipe`](pandas.DataFrame.pipe.html#pandas.DataFrame.pipe "pandas.DataFrame.pipe")(func, \*args, \*\*kwargs) | Apply chainable functions that expect Series or DataFrames. | + | [`pivot`](pandas.DataFrame.pivot.html#pandas.DataFrame.pivot "pandas.DataFrame.pivot")(\*, columns[, index, values]) | Return reshaped DataFrame organized by given index / column values. | + | [`pivot_table`](pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table")([values, index, columns, ...]) | Create a spreadsheet-style pivot table as a DataFrame. | + | [`plot`](pandas.DataFrame.plot.html#pandas.DataFrame.plot "pandas.DataFrame.plot") | alias of `PlotAccessor` | + | [`pop`](pandas.DataFrame.pop.html#pandas.DataFrame.pop "pandas.DataFrame.pop")(item) | Return item and drop from frame. | + | [`pow`](pandas.DataFrame.pow.html#pandas.DataFrame.pow "pandas.DataFrame.pow")(other[, axis, level, fill\_value]) | Get Exponential power of dataframe and other, element-wise (binary operator pow). | + | [`prod`](pandas.DataFrame.prod.html#pandas.DataFrame.prod "pandas.DataFrame.prod")([axis, skipna, numeric\_only, min\_count]) | Return the product of the values over the requested axis. | + | [`product`](pandas.DataFrame.product.html#pandas.DataFrame.product "pandas.DataFrame.product")([axis, skipna, numeric\_only, min\_count]) | Return the product of the values over the requested axis. | + | [`quantile`](pandas.DataFrame.quantile.html#pandas.DataFrame.quantile "pandas.DataFrame.quantile")([q, axis, numeric\_only, ...]) | Return values at the given quantile over requested axis. | + | [`query`](pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query")(expr, \*[, inplace]) | Query the columns of a DataFrame with a boolean expression. | + | [`radd`](pandas.DataFrame.radd.html#pandas.DataFrame.radd "pandas.DataFrame.radd")(other[, axis, level, fill\_value]) | Get Addition of dataframe and other, element-wise (binary operator radd). | + | [`rank`](pandas.DataFrame.rank.html#pandas.DataFrame.rank "pandas.DataFrame.rank")([axis, method, numeric\_only, ...]) | Compute numerical data ranks (1 through n) along axis. | + | [`rdiv`](pandas.DataFrame.rdiv.html#pandas.DataFrame.rdiv "pandas.DataFrame.rdiv")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator rtruediv). | + | [`reindex`](pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex")([labels, index, columns, axis, ...]) | Conform DataFrame to new index with optional filling logic. | + | [`reindex_like`](pandas.DataFrame.reindex_like.html#pandas.DataFrame.reindex_like "pandas.DataFrame.reindex_like")(other[, method, copy, limit, ...]) | Return an object with matching indices as other object. | + | [`rename`](pandas.DataFrame.rename.html#pandas.DataFrame.rename "pandas.DataFrame.rename")([mapper, index, columns, axis, copy, ...]) | Rename columns or index labels. | + | [`rename_axis`](pandas.DataFrame.rename_axis.html#pandas.DataFrame.rename_axis "pandas.DataFrame.rename_axis")([mapper, index, columns, axis, ...]) | Set the name of the axis for the index or columns. | + | [`reorder_levels`](pandas.DataFrame.reorder_levels.html#pandas.DataFrame.reorder_levels "pandas.DataFrame.reorder_levels")(order[, axis]) | Rearrange index levels using input order. | + | [`replace`](pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace")([to\_replace, value, inplace, limit, ...]) | Replace values given in to\_replace with value. | + | [`resample`](pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample")(rule[, axis, closed, label, ...]) | Resample time-series data. | + | [`reset_index`](pandas.DataFrame.reset_index.html#pandas.DataFrame.reset_index "pandas.DataFrame.reset_index")([level, drop, inplace, ...]) | Reset the index, or a level of it. | + | [`rfloordiv`](pandas.DataFrame.rfloordiv.html#pandas.DataFrame.rfloordiv "pandas.DataFrame.rfloordiv")(other[, axis, level, fill\_value]) | Get Integer division of dataframe and other, element-wise (binary operator rfloordiv). | + | [`rmod`](pandas.DataFrame.rmod.html#pandas.DataFrame.rmod "pandas.DataFrame.rmod")(other[, axis, level, fill\_value]) | Get Modulo of dataframe and other, element-wise (binary operator rmod). | + | [`rmul`](pandas.DataFrame.rmul.html#pandas.DataFrame.rmul "pandas.DataFrame.rmul")(other[, axis, level, fill\_value]) | Get Multiplication of dataframe and other, element-wise (binary operator rmul). | + | [`rolling`](pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling")(window[, min\_periods, center, ...]) | Provide rolling window calculations. | + | [`round`](pandas.DataFrame.round.html#pandas.DataFrame.round "pandas.DataFrame.round")([decimals]) | Round a DataFrame to a variable number of decimal places. | + | [`rpow`](pandas.DataFrame.rpow.html#pandas.DataFrame.rpow "pandas.DataFrame.rpow")(other[, axis, level, fill\_value]) | Get Exponential power of dataframe and other, element-wise (binary operator rpow). | + | [`rsub`](pandas.DataFrame.rsub.html#pandas.DataFrame.rsub "pandas.DataFrame.rsub")(other[, axis, level, fill\_value]) | Get Subtraction of dataframe and other, element-wise (binary operator rsub). | + | [`rtruediv`](pandas.DataFrame.rtruediv.html#pandas.DataFrame.rtruediv "pandas.DataFrame.rtruediv")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator rtruediv). | + | [`sample`](pandas.DataFrame.sample.html#pandas.DataFrame.sample "pandas.DataFrame.sample")([n, frac, replace, weights, ...]) | Return a random sample of items from an axis of object. | + | [`select_dtypes`](pandas.DataFrame.select_dtypes.html#pandas.DataFrame.select_dtypes "pandas.DataFrame.select_dtypes")([include, exclude]) | Return a subset of the DataFrame's columns based on the column dtypes. | + | [`sem`](pandas.DataFrame.sem.html#pandas.DataFrame.sem "pandas.DataFrame.sem")([axis, skipna, ddof, numeric\_only]) | Return unbiased standard error of the mean over requested axis. | + | [`set_axis`](pandas.DataFrame.set_axis.html#pandas.DataFrame.set_axis "pandas.DataFrame.set_axis")(labels, \*[, axis, copy]) | Assign desired index to given axis. | + | [`set_flags`](pandas.DataFrame.set_flags.html#pandas.DataFrame.set_flags "pandas.DataFrame.set_flags")(\*[, copy, allows\_duplicate\_labels]) | Return a new object with updated flags. | + | [`set_index`](pandas.DataFrame.set_index.html#pandas.DataFrame.set_index "pandas.DataFrame.set_index")(keys, \*[, drop, append, inplace, ...]) | Set the DataFrame index using existing columns. | + | [`shift`](pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift")([periods, freq, axis, fill\_value, suffix]) | Shift index by desired number of periods with an optional time freq. | + | [`skew`](pandas.DataFrame.skew.html#pandas.DataFrame.skew "pandas.DataFrame.skew")([axis, skipna, numeric\_only]) | Return unbiased skew over requested axis. | + | [`sort_index`](pandas.DataFrame.sort_index.html#pandas.DataFrame.sort_index "pandas.DataFrame.sort_index")(\*[, axis, level, ascending, ...]) | Sort object by labels (along an axis). | + | [`sort_values`](pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values")(by, \*[, axis, ascending, ...]) | Sort by the values along either axis. | + | [`sparse`](pandas.DataFrame.sparse.html#pandas.DataFrame.sparse "pandas.DataFrame.sparse") | alias of `SparseFrameAccessor` | + | [`squeeze`](pandas.DataFrame.squeeze.html#pandas.DataFrame.squeeze "pandas.DataFrame.squeeze")([axis]) | Squeeze 1 dimensional axis objects into scalars. | + | [`stack`](pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack")([level, dropna, sort, future\_stack]) | Stack the prescribed level(s) from columns to index. | + | [`std`](pandas.DataFrame.std.html#pandas.DataFrame.std "pandas.DataFrame.std")([axis, skipna, ddof, numeric\_only]) | Return sample standard deviation over requested axis. | + | [`sub`](pandas.DataFrame.sub.html#pandas.DataFrame.sub "pandas.DataFrame.sub")(other[, axis, level, fill\_value]) | Get Subtraction of dataframe and other, element-wise (binary operator sub). | + | [`subtract`](pandas.DataFrame.subtract.html#pandas.DataFrame.subtract "pandas.DataFrame.subtract")(other[, axis, level, fill\_value]) | Get Subtraction of dataframe and other, element-wise (binary operator sub). | + | [`sum`](pandas.DataFrame.sum.html#pandas.DataFrame.sum "pandas.DataFrame.sum")([axis, skipna, numeric\_only, min\_count]) | Return the sum of the values over the requested axis. | + | [`swapaxes`](pandas.DataFrame.swapaxes.html#pandas.DataFrame.swapaxes "pandas.DataFrame.swapaxes")(axis1, axis2[, copy]) | (DEPRECATED) Interchange axes and swap values axes appropriately. | + | [`swaplevel`](pandas.DataFrame.swaplevel.html#pandas.DataFrame.swaplevel "pandas.DataFrame.swaplevel")([i, j, axis]) | Swap levels i and j in a [`MultiIndex`](pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex"). | + | [`tail`](pandas.DataFrame.tail.html#pandas.DataFrame.tail "pandas.DataFrame.tail")([n]) | Return the last n rows. | + | [`take`](pandas.DataFrame.take.html#pandas.DataFrame.take "pandas.DataFrame.take")(indices[, axis]) | Return the elements in the given *positional* indices along an axis. | + | [`to_clipboard`](pandas.DataFrame.to_clipboard.html#pandas.DataFrame.to_clipboard "pandas.DataFrame.to_clipboard")([excel, sep]) | Copy object to the system clipboard. | + | [`to_csv`](pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv")([path\_or\_buf, sep, na\_rep, ...]) | Write object to a comma-separated values (csv) file. | + | [`to_dict`](pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict")([orient, into, index]) | Convert the DataFrame to a dictionary. | + | [`to_excel`](pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel")(excel\_writer[, sheet\_name, na\_rep, ...]) | Write object to an Excel sheet. | + | [`to_feather`](pandas.DataFrame.to_feather.html#pandas.DataFrame.to_feather "pandas.DataFrame.to_feather")(path, \*\*kwargs) | Write a DataFrame to the binary Feather format. | + | [`to_gbq`](pandas.DataFrame.to_gbq.html#pandas.DataFrame.to_gbq "pandas.DataFrame.to_gbq")(destination\_table[, project\_id, ...]) | Write a DataFrame to a Google BigQuery table. | + | [`to_hdf`](pandas.DataFrame.to_hdf.html#pandas.DataFrame.to_hdf "pandas.DataFrame.to_hdf")(path\_or\_buf, key[, mode, complevel, ...]) | Write the contained data to an HDF5 file using HDFStore. | + | [`to_html`](pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html")([buf, columns, col\_space, header, ...]) | Render a DataFrame as an HTML table. | + | [`to_json`](pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json")([path\_or\_buf, orient, date\_format, ...]) | Convert the object to a JSON string. | + | [`to_latex`](pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex")([buf, columns, header, index, ...]) | Render object to a LaTeX tabular, longtable, or nested table. | + | [`to_markdown`](pandas.DataFrame.to_markdown.html#pandas.DataFrame.to_markdown "pandas.DataFrame.to_markdown")([buf, mode, index, storage\_options]) | Print DataFrame in Markdown-friendly format. | + | [`to_numpy`](pandas.DataFrame.to_numpy.html#pandas.DataFrame.to_numpy "pandas.DataFrame.to_numpy")([dtype, copy, na\_value]) | Convert the DataFrame to a NumPy array. | + | [`to_orc`](pandas.DataFrame.to_orc.html#pandas.DataFrame.to_orc "pandas.DataFrame.to_orc")([path, engine, index, engine\_kwargs]) | Write a DataFrame to the ORC format. | + | [`to_parquet`](pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet")([path, engine, compression, ...]) | Write a DataFrame to the binary parquet format. | + | [`to_period`](pandas.DataFrame.to_period.html#pandas.DataFrame.to_period "pandas.DataFrame.to_period")([freq, axis, copy]) | Convert DataFrame from DatetimeIndex to PeriodIndex. | + | [`to_pickle`](pandas.DataFrame.to_pickle.html#pandas.DataFrame.to_pickle "pandas.DataFrame.to_pickle")(path[, compression, protocol, ...]) | Pickle (serialize) object to file. | + | [`to_records`](pandas.DataFrame.to_records.html#pandas.DataFrame.to_records "pandas.DataFrame.to_records")([index, column\_dtypes, index\_dtypes]) | Convert DataFrame to a NumPy record array. | + | [`to_sql`](pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql")(name, con, \*[, schema, if\_exists, ...]) | Write records stored in a DataFrame to a SQL database. | + | [`to_stata`](pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata")(path, \*[, convert\_dates, ...]) | Export DataFrame object to Stata dta format. | + | [`to_string`](pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string")([buf, columns, col\_space, header, ...]) | Render a DataFrame to a console-friendly tabular output. | + | [`to_timestamp`](pandas.DataFrame.to_timestamp.html#pandas.DataFrame.to_timestamp "pandas.DataFrame.to_timestamp")([freq, how, axis, copy]) | Cast to DatetimeIndex of timestamps, at *beginning* of period. | + | [`to_xarray`](pandas.DataFrame.to_xarray.html#pandas.DataFrame.to_xarray "pandas.DataFrame.to_xarray")() | Return an xarray object from the pandas object. | + | [`to_xml`](pandas.DataFrame.to_xml.html#pandas.DataFrame.to_xml "pandas.DataFrame.to_xml")([path\_or\_buffer, index, root\_name, ...]) | Render a DataFrame to an XML document. | + | [`transform`](pandas.DataFrame.transform.html#pandas.DataFrame.transform "pandas.DataFrame.transform")(func[, axis]) | Call `func` on self producing a DataFrame with the same axis shape as self. | + | [`transpose`](pandas.DataFrame.transpose.html#pandas.DataFrame.transpose "pandas.DataFrame.transpose")(\*args[, copy]) | Transpose index and columns. | + | [`truediv`](pandas.DataFrame.truediv.html#pandas.DataFrame.truediv "pandas.DataFrame.truediv")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator truediv). | + | [`truncate`](pandas.DataFrame.truncate.html#pandas.DataFrame.truncate "pandas.DataFrame.truncate")([before, after, axis, copy]) | Truncate a Series or DataFrame before and after some index value. | + | [`tz_convert`](pandas.DataFrame.tz_convert.html#pandas.DataFrame.tz_convert "pandas.DataFrame.tz_convert")(tz[, axis, level, copy]) | Convert tz-aware axis to target time zone. | + | [`tz_localize`](pandas.DataFrame.tz_localize.html#pandas.DataFrame.tz_localize "pandas.DataFrame.tz_localize")(tz[, axis, level, copy, ...]) | Localize tz-naive index of a Series or DataFrame to target time zone. | + | [`unstack`](pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack")([level, fill\_value, sort]) | Pivot a level of the (necessarily hierarchical) index labels. | + | [`update`](pandas.DataFrame.update.html#pandas.DataFrame.update "pandas.DataFrame.update")(other[, join, overwrite, ...]) | Modify in place using non-NA values from another DataFrame. | + | [`value_counts`](pandas.DataFrame.value_counts.html#pandas.DataFrame.value_counts "pandas.DataFrame.value_counts")([subset, normalize, sort, ...]) | Return a Series containing the frequency of each distinct row in the Dataframe. | + | [`var`](pandas.DataFrame.var.html#pandas.DataFrame.var "pandas.DataFrame.var")([axis, skipna, ddof, numeric\_only]) | Return unbiased variance over requested axis. | + | [`where`](pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where")(cond[, other, inplace, axis, level]) | Replace values where the condition is False. | + | [`xs`](pandas.DataFrame.xs.html#pandas.DataFrame.xs "pandas.DataFrame.xs")(key[, axis, level, drop\_level]) | Return cross-section from the Series/DataFrame. | diff --git a/corpus/docs/pandas/dataframe/dataframe_22.md b/corpus/docs/pandas/dataframe/dataframe_22.md new file mode 100644 index 0000000000000000000000000000000000000000..c3da82193a8280261bdef32c2c05402516a86172 --- /dev/null +++ b/corpus/docs/pandas/dataframe/dataframe_22.md @@ -0,0 +1,383 @@ +# pandas.DataFrame# + +Source: https://pandas.pydata.org/pandas-docs/version/2.2/reference/api/pandas.DataFrame.html +Version: 2.2 + +*class* pandas.DataFrame(*data=None*, *index=None*, *columns=None*, *dtype=None*, *copy=None*)[[source]](https://github.com/pandas-dev/pandas/blob/v2.2.3/pandas/core/frame.py#L509-L12664)[#](#pandas.DataFrame "Link to this definition") +: Two-dimensional, size-mutable, potentially heterogeneous tabular data. + + Data structure also contains labeled axes (rows and columns). + Arithmetic operations align on both row and column labels. Can be + thought of as a dict-like container for Series objects. The primary + pandas data structure. + + Parameters: + : **data**ndarray (structured or homogeneous), Iterable, dict, or DataFrame + : Dict can contain Series, arrays, constants, dataclass or list-like objects. If + data is a dict, column order follows insertion-order. If a dict contains Series + which have an index defined, it is aligned by its index. This alignment also + occurs if data is a Series or a DataFrame itself. Alignment is done on + Series/DataFrame inputs. + + If data is a list of dicts, column order follows insertion-order. + + **index**Index or array-like + : Index to use for resulting frame. Will default to RangeIndex if + no indexing information part of input data and no index provided. + + **columns**Index or array-like + : Column labels to use for resulting frame when data does not have them, + defaulting to RangeIndex(0, 1, 2, …, n). If data contains column labels, + will perform column selection instead. + + **dtype**dtype, default None + : Data type to force. Only a single dtype is allowed. If None, infer. + + **copy**bool or None, default None + : Copy data from inputs. + For dict data, the default of None behaves like `copy=True`. For DataFrame + or 2d ndarray input, the default of None behaves like `copy=False`. + If data is a dict containing one or more Series (possibly of different dtypes), + `copy=False` will ensure that these inputs are not copied. + + Changed in version 1.3.0. + + See also + + [`DataFrame.from_records`](pandas.DataFrame.from_records.html#pandas.DataFrame.from_records "pandas.DataFrame.from_records") + : Constructor from tuples, also record arrays. + + [`DataFrame.from_dict`](pandas.DataFrame.from_dict.html#pandas.DataFrame.from_dict "pandas.DataFrame.from_dict") + : From dicts of Series, arrays, or dicts. + + [`read_csv`](pandas.read_csv.html#pandas.read_csv "pandas.read_csv") + : Read a comma-separated values (csv) file into DataFrame. + + [`read_table`](pandas.read_table.html#pandas.read_table "pandas.read_table") + : Read general delimited file into DataFrame. + + [`read_clipboard`](pandas.read_clipboard.html#pandas.read_clipboard "pandas.read_clipboard") + : Read text from clipboard into DataFrame. + + Notes + + Please reference the [User Guide](../../user_guide/dsintro.html#basics-dataframe) for more information. + + Examples + + Constructing DataFrame from a dictionary. + + ```None + >>> d = {'col1': [1, 2], 'col2': [3, 4]} + >>> df = pd.DataFrame(data=d) + >>> df + col1 col2 + 0 1 3 + 1 2 4 + ``` + + Notice that the inferred dtype is int64. + + ```None + >>> df.dtypes + col1 int64 + col2 int64 + dtype: object + ``` + + To enforce a single dtype: + + ```None + >>> df = pd.DataFrame(data=d, dtype=np.int8) + >>> df.dtypes + col1 int8 + col2 int8 + dtype: object + ``` + + Constructing DataFrame from a dictionary including Series: + + ```None + >>> d = {'col1': [0, 1, 2, 3], 'col2': pd.Series([2, 3], index=[2, 3])} + >>> pd.DataFrame(data=d, index=[0, 1, 2, 3]) + col1 col2 + 0 0 NaN + 1 1 NaN + 2 2 2.0 + 3 3 3.0 + ``` + + Constructing DataFrame from numpy ndarray: + + ```None + >>> df2 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), + ... columns=['a', 'b', 'c']) + >>> df2 + a b c + 0 1 2 3 + 1 4 5 6 + 2 7 8 9 + ``` + + Constructing DataFrame from a numpy ndarray that has labeled columns: + + ```None + >>> data = np.array([(1, 2, 3), (4, 5, 6), (7, 8, 9)], + ... dtype=[("a", "i4"), ("b", "i4"), ("c", "i4")]) + >>> df3 = pd.DataFrame(data, columns=['c', 'a']) + ... + >>> df3 + c a + 0 3 1 + 1 6 4 + 2 9 7 + ``` + + Constructing DataFrame from dataclass: + + ```None + >>> from dataclasses import make_dataclass + >>> Point = make_dataclass("Point", [("x", int), ("y", int)]) + >>> pd.DataFrame([Point(0, 0), Point(0, 3), Point(2, 3)]) + x y + 0 0 0 + 1 0 3 + 2 2 3 + ``` + + Constructing DataFrame from Series/DataFrame: + + ```None + >>> ser = pd.Series([1, 2, 3], index=["a", "b", "c"]) + >>> df = pd.DataFrame(data=ser, index=["a", "c"]) + >>> df + 0 + a 1 + c 3 + ``` + + ```None + >>> df1 = pd.DataFrame([1, 2, 3], index=["a", "b", "c"], columns=["x"]) + >>> df2 = pd.DataFrame(data=df1, index=["a", "c"]) + >>> df2 + x + a 1 + c 3 + ``` + + Attributes + + | | | + | --- | --- | + | [`T`](pandas.DataFrame.T.html#pandas.DataFrame.T "pandas.DataFrame.T") | The transpose of the DataFrame. | + | [`at`](pandas.DataFrame.at.html#pandas.DataFrame.at "pandas.DataFrame.at") | Access a single value for a row/column label pair. | + | [`attrs`](pandas.DataFrame.attrs.html#pandas.DataFrame.attrs "pandas.DataFrame.attrs") | Dictionary of global attributes of this dataset. | + | [`axes`](pandas.DataFrame.axes.html#pandas.DataFrame.axes "pandas.DataFrame.axes") | Return a list representing the axes of the DataFrame. | + | [`columns`](pandas.DataFrame.columns.html#pandas.DataFrame.columns "pandas.DataFrame.columns") | The column labels of the DataFrame. | + | [`dtypes`](pandas.DataFrame.dtypes.html#pandas.DataFrame.dtypes "pandas.DataFrame.dtypes") | Return the dtypes in the DataFrame. | + | [`empty`](pandas.DataFrame.empty.html#pandas.DataFrame.empty "pandas.DataFrame.empty") | Indicator whether Series/DataFrame is empty. | + | `flags` | Get the properties associated with this pandas object. | + | [`iat`](pandas.DataFrame.iat.html#pandas.DataFrame.iat "pandas.DataFrame.iat") | Access a single value for a row/column pair by integer position. | + | [`iloc`](pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") | (DEPRECATED) Purely integer-location based indexing for selection by position. | + | [`index`](pandas.DataFrame.index.html#pandas.DataFrame.index "pandas.DataFrame.index") | The index (row labels) of the DataFrame. | + | [`loc`](pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") | Access a group of rows and columns by label(s) or a boolean array. | + | [`ndim`](pandas.DataFrame.ndim.html#pandas.DataFrame.ndim "pandas.DataFrame.ndim") | Return an int representing the number of axes / array dimensions. | + | [`shape`](pandas.DataFrame.shape.html#pandas.DataFrame.shape "pandas.DataFrame.shape") | Return a tuple representing the dimensionality of the DataFrame. | + | [`size`](pandas.DataFrame.size.html#pandas.DataFrame.size "pandas.DataFrame.size") | Return an int representing the number of elements in this object. | + | [`style`](pandas.DataFrame.style.html#pandas.DataFrame.style "pandas.DataFrame.style") | Returns a Styler object. | + | [`values`](pandas.DataFrame.values.html#pandas.DataFrame.values "pandas.DataFrame.values") | Return a Numpy representation of the DataFrame. | + + Methods + + | | | + | --- | --- | + | [`abs`](pandas.DataFrame.abs.html#pandas.DataFrame.abs "pandas.DataFrame.abs")() | Return a Series/DataFrame with absolute numeric value of each element. | + | [`add`](pandas.DataFrame.add.html#pandas.DataFrame.add "pandas.DataFrame.add")(other[, axis, level, fill\_value]) | Get Addition of dataframe and other, element-wise (binary operator add). | + | [`add_prefix`](pandas.DataFrame.add_prefix.html#pandas.DataFrame.add_prefix "pandas.DataFrame.add_prefix")(prefix[, axis]) | Prefix labels with string prefix. | + | [`add_suffix`](pandas.DataFrame.add_suffix.html#pandas.DataFrame.add_suffix "pandas.DataFrame.add_suffix")(suffix[, axis]) | Suffix labels with string suffix. | + | [`agg`](pandas.DataFrame.agg.html#pandas.DataFrame.agg "pandas.DataFrame.agg")([func, axis]) | Aggregate using one or more operations over the specified axis. | + | [`aggregate`](pandas.DataFrame.aggregate.html#pandas.DataFrame.aggregate "pandas.DataFrame.aggregate")([func, axis]) | Aggregate using one or more operations over the specified axis. | + | [`align`](pandas.DataFrame.align.html#pandas.DataFrame.align "pandas.DataFrame.align")(other[, join, axis, level, copy, ...]) | Align two objects on their axes with the specified join method. | + | [`all`](pandas.DataFrame.all.html#pandas.DataFrame.all "pandas.DataFrame.all")([axis, bool\_only, skipna]) | Return whether all elements are True, potentially over an axis. | + | [`any`](pandas.DataFrame.any.html#pandas.DataFrame.any "pandas.DataFrame.any")(\*[, axis, bool\_only, skipna]) | Return whether any element is True, potentially over an axis. | + | [`apply`](pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply")(func[, axis, raw, result\_type, args, ...]) | Apply a function along an axis of the DataFrame. | + | [`applymap`](pandas.DataFrame.applymap.html#pandas.DataFrame.applymap "pandas.DataFrame.applymap")(func[, na\_action]) | (DEPRECATED) Apply a function to a Dataframe elementwise. | + | [`asfreq`](pandas.DataFrame.asfreq.html#pandas.DataFrame.asfreq "pandas.DataFrame.asfreq")(freq[, method, how, normalize, ...]) | Convert time series to specified frequency. | + | [`asof`](pandas.DataFrame.asof.html#pandas.DataFrame.asof "pandas.DataFrame.asof")(where[, subset]) | Return the last row(s) without any NaNs before where. | + | [`assign`](pandas.DataFrame.assign.html#pandas.DataFrame.assign "pandas.DataFrame.assign")(\*\*kwargs) | Assign new columns to a DataFrame. | + | [`astype`](pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype")(dtype[, copy, errors]) | Cast a pandas object to a specified dtype `dtype`. | + | [`at_time`](pandas.DataFrame.at_time.html#pandas.DataFrame.at_time "pandas.DataFrame.at_time")(time[, asof, axis]) | Select values at particular time of day (e.g., 9:30AM). | + | [`backfill`](pandas.DataFrame.backfill.html#pandas.DataFrame.backfill "pandas.DataFrame.backfill")(\*[, axis, inplace, limit, downcast]) | (DEPRECATED) Fill NA/NaN values by using the next valid observation to fill the gap. | + | [`between_time`](pandas.DataFrame.between_time.html#pandas.DataFrame.between_time "pandas.DataFrame.between_time")(start\_time, end\_time[, ...]) | Select values between particular times of the day (e.g., 9:00-9:30 AM). | + | [`bfill`](pandas.DataFrame.bfill.html#pandas.DataFrame.bfill "pandas.DataFrame.bfill")(\*[, axis, inplace, limit, limit\_area, ...]) | Fill NA/NaN values by using the next valid observation to fill the gap. | + | [`bool`](pandas.DataFrame.bool.html#pandas.DataFrame.bool "pandas.DataFrame.bool")() | (DEPRECATED) Return the bool of a single element Series or DataFrame. | + | [`boxplot`](pandas.DataFrame.boxplot.html#pandas.DataFrame.boxplot "pandas.DataFrame.boxplot")([column, by, ax, fontsize, rot, ...]) | Make a box plot from DataFrame columns. | + | [`clip`](pandas.DataFrame.clip.html#pandas.DataFrame.clip "pandas.DataFrame.clip")([lower, upper, axis, inplace]) | Trim values at input threshold(s). | + | [`combine`](pandas.DataFrame.combine.html#pandas.DataFrame.combine "pandas.DataFrame.combine")(other, func[, fill\_value, overwrite]) | Perform column-wise combine with another DataFrame. | + | [`combine_first`](pandas.DataFrame.combine_first.html#pandas.DataFrame.combine_first "pandas.DataFrame.combine_first")(other) | Update null elements with value in the same location in other. | + | [`compare`](pandas.DataFrame.compare.html#pandas.DataFrame.compare "pandas.DataFrame.compare")(other[, align\_axis, keep\_shape, ...]) | Compare to another DataFrame and show the differences. | + | [`convert_dtypes`](pandas.DataFrame.convert_dtypes.html#pandas.DataFrame.convert_dtypes "pandas.DataFrame.convert_dtypes")([infer\_objects, ...]) | Convert columns to the best possible dtypes using dtypes supporting `pd.NA`. | + | [`copy`](pandas.DataFrame.copy.html#pandas.DataFrame.copy "pandas.DataFrame.copy")([deep]) | Make a copy of this object's indices and data. | + | [`corr`](pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr")([method, min\_periods, numeric\_only]) | Compute pairwise correlation of columns, excluding NA/null values. | + | [`corrwith`](pandas.DataFrame.corrwith.html#pandas.DataFrame.corrwith "pandas.DataFrame.corrwith")(other[, axis, drop, method, ...]) | Compute pairwise correlation. | + | [`count`](pandas.DataFrame.count.html#pandas.DataFrame.count "pandas.DataFrame.count")([axis, numeric\_only]) | Count non-NA cells for each column or row. | + | [`cov`](pandas.DataFrame.cov.html#pandas.DataFrame.cov "pandas.DataFrame.cov")([min\_periods, ddof, numeric\_only]) | Compute pairwise covariance of columns, excluding NA/null values. | + | [`cummax`](pandas.DataFrame.cummax.html#pandas.DataFrame.cummax "pandas.DataFrame.cummax")([axis, skipna]) | Return cumulative maximum over a DataFrame or Series axis. | + | [`cummin`](pandas.DataFrame.cummin.html#pandas.DataFrame.cummin "pandas.DataFrame.cummin")([axis, skipna]) | Return cumulative minimum over a DataFrame or Series axis. | + | [`cumprod`](pandas.DataFrame.cumprod.html#pandas.DataFrame.cumprod "pandas.DataFrame.cumprod")([axis, skipna]) | Return cumulative product over a DataFrame or Series axis. | + | [`cumsum`](pandas.DataFrame.cumsum.html#pandas.DataFrame.cumsum "pandas.DataFrame.cumsum")([axis, skipna]) | Return cumulative sum over a DataFrame or Series axis. | + | [`describe`](pandas.DataFrame.describe.html#pandas.DataFrame.describe "pandas.DataFrame.describe")([percentiles, include, exclude]) | Generate descriptive statistics. | + | [`diff`](pandas.DataFrame.diff.html#pandas.DataFrame.diff "pandas.DataFrame.diff")([periods, axis]) | First discrete difference of element. | + | [`div`](pandas.DataFrame.div.html#pandas.DataFrame.div "pandas.DataFrame.div")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator truediv). | + | `divide`(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator truediv). | + | [`dot`](pandas.DataFrame.dot.html#pandas.DataFrame.dot "pandas.DataFrame.dot")(other) | Compute the matrix multiplication between the DataFrame and other. | + | [`drop`](pandas.DataFrame.drop.html#pandas.DataFrame.drop "pandas.DataFrame.drop")([labels, axis, index, columns, level, ...]) | Drop specified labels from rows or columns. | + | [`drop_duplicates`](pandas.DataFrame.drop_duplicates.html#pandas.DataFrame.drop_duplicates "pandas.DataFrame.drop_duplicates")([subset, keep, inplace, ...]) | Return DataFrame with duplicate rows removed. | + | [`droplevel`](pandas.DataFrame.droplevel.html#pandas.DataFrame.droplevel "pandas.DataFrame.droplevel")(level[, axis]) | Return Series/DataFrame with requested index / column level(s) removed. | + | [`dropna`](pandas.DataFrame.dropna.html#pandas.DataFrame.dropna "pandas.DataFrame.dropna")(\*[, axis, how, thresh, subset, ...]) | Remove missing values. | + | [`duplicated`](pandas.DataFrame.duplicated.html#pandas.DataFrame.duplicated "pandas.DataFrame.duplicated")([subset, keep]) | Return boolean Series denoting duplicate rows. | + | [`eq`](pandas.DataFrame.eq.html#pandas.DataFrame.eq "pandas.DataFrame.eq")(other[, axis, level]) | Get Equal to of dataframe and other, element-wise (binary operator eq). | + | [`equals`](pandas.DataFrame.equals.html#pandas.DataFrame.equals "pandas.DataFrame.equals")(other) | Test whether two objects contain the same elements. | + | [`eval`](pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval")(expr, \*[, inplace]) | Evaluate a string describing operations on DataFrame columns. | + | [`ewm`](pandas.DataFrame.ewm.html#pandas.DataFrame.ewm "pandas.DataFrame.ewm")([com, span, halflife, alpha, ...]) | Provide exponentially weighted (EW) calculations. | + | [`expanding`](pandas.DataFrame.expanding.html#pandas.DataFrame.expanding "pandas.DataFrame.expanding")([min\_periods, axis, method]) | Provide expanding window calculations. | + | [`explode`](pandas.DataFrame.explode.html#pandas.DataFrame.explode "pandas.DataFrame.explode")(column[, ignore\_index]) | Transform each element of a list-like to a row, replicating index values. | + | [`ffill`](pandas.DataFrame.ffill.html#pandas.DataFrame.ffill "pandas.DataFrame.ffill")(\*[, axis, inplace, limit, limit\_area, ...]) | Fill NA/NaN values by propagating the last valid observation to next valid. | + | [`fillna`](pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna")([value, method, axis, inplace, ...]) | Fill NA/NaN values using the specified method. | + | [`filter`](pandas.DataFrame.filter.html#pandas.DataFrame.filter "pandas.DataFrame.filter")([items, like, regex, axis]) | Subset the dataframe rows or columns according to the specified index labels. | + | [`first`](pandas.DataFrame.first.html#pandas.DataFrame.first "pandas.DataFrame.first")(offset) | (DEPRECATED) Select initial periods of time series data based on a date offset. | + | [`first_valid_index`](pandas.DataFrame.first_valid_index.html#pandas.DataFrame.first_valid_index "pandas.DataFrame.first_valid_index")() | Return index for first non-NA value or None, if no non-NA value is found. | + | [`floordiv`](pandas.DataFrame.floordiv.html#pandas.DataFrame.floordiv "pandas.DataFrame.floordiv")(other[, axis, level, fill\_value]) | Get Integer division of dataframe and other, element-wise (binary operator floordiv). | + | [`from_dict`](pandas.DataFrame.from_dict.html#pandas.DataFrame.from_dict "pandas.DataFrame.from_dict")(data[, orient, dtype, columns]) | Construct DataFrame from dict of array-like or dicts. | + | [`from_records`](pandas.DataFrame.from_records.html#pandas.DataFrame.from_records "pandas.DataFrame.from_records")(data[, index, exclude, ...]) | Convert structured or record ndarray to DataFrame. | + | [`ge`](pandas.DataFrame.ge.html#pandas.DataFrame.ge "pandas.DataFrame.ge")(other[, axis, level]) | Get Greater than or equal to of dataframe and other, element-wise (binary operator ge). | + | [`get`](pandas.DataFrame.get.html#pandas.DataFrame.get "pandas.DataFrame.get")(key[, default]) | Get item from object for given key (ex: DataFrame column). | + | [`groupby`](pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby")([by, axis, level, as\_index, sort, ...]) | Group DataFrame using a mapper or by a Series of columns. | + | [`gt`](pandas.DataFrame.gt.html#pandas.DataFrame.gt "pandas.DataFrame.gt")(other[, axis, level]) | Get Greater than of dataframe and other, element-wise (binary operator gt). | + | [`head`](pandas.DataFrame.head.html#pandas.DataFrame.head "pandas.DataFrame.head")([n]) | Return the first n rows. | + | [`hist`](pandas.DataFrame.hist.html#pandas.DataFrame.hist "pandas.DataFrame.hist")([column, by, grid, xlabelsize, xrot, ...]) | Make a histogram of the DataFrame's columns. | + | [`idxmax`](pandas.DataFrame.idxmax.html#pandas.DataFrame.idxmax "pandas.DataFrame.idxmax")([axis, skipna, numeric\_only]) | Return index of first occurrence of maximum over requested axis. | + | [`idxmin`](pandas.DataFrame.idxmin.html#pandas.DataFrame.idxmin "pandas.DataFrame.idxmin")([axis, skipna, numeric\_only]) | Return index of first occurrence of minimum over requested axis. | + | [`infer_objects`](pandas.DataFrame.infer_objects.html#pandas.DataFrame.infer_objects "pandas.DataFrame.infer_objects")([copy]) | Attempt to infer better dtypes for object columns. | + | [`info`](pandas.DataFrame.info.html#pandas.DataFrame.info "pandas.DataFrame.info")([verbose, buf, max\_cols, memory\_usage, ...]) | Print a concise summary of a DataFrame. | + | [`insert`](pandas.DataFrame.insert.html#pandas.DataFrame.insert "pandas.DataFrame.insert")(loc, column, value[, allow\_duplicates]) | Insert column into DataFrame at specified location. | + | [`interpolate`](pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate")([method, axis, limit, inplace, ...]) | Fill NaN values using an interpolation method. | + | `isetitem`(loc, value) | Set the given value in the column with position loc. | + | [`isin`](pandas.DataFrame.isin.html#pandas.DataFrame.isin "pandas.DataFrame.isin")(values) | Whether each element in the DataFrame is contained in values. | + | [`isna`](pandas.DataFrame.isna.html#pandas.DataFrame.isna "pandas.DataFrame.isna")() | Detect missing values. | + | [`isnull`](pandas.DataFrame.isnull.html#pandas.DataFrame.isnull "pandas.DataFrame.isnull")() | DataFrame.isnull is an alias for DataFrame.isna. | + | [`items`](pandas.DataFrame.items.html#pandas.DataFrame.items "pandas.DataFrame.items")() | Iterate over (column name, Series) pairs. | + | [`iterrows`](pandas.DataFrame.iterrows.html#pandas.DataFrame.iterrows "pandas.DataFrame.iterrows")() | Iterate over DataFrame rows as (index, Series) pairs. | + | [`itertuples`](pandas.DataFrame.itertuples.html#pandas.DataFrame.itertuples "pandas.DataFrame.itertuples")([index, name]) | Iterate over DataFrame rows as namedtuples. | + | [`join`](pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join")(other[, on, how, lsuffix, rsuffix, ...]) | Join columns of another DataFrame. | + | [`keys`](pandas.DataFrame.keys.html#pandas.DataFrame.keys "pandas.DataFrame.keys")() | Get the 'info axis' (see Indexing for more). | + | [`kurt`](pandas.DataFrame.kurt.html#pandas.DataFrame.kurt "pandas.DataFrame.kurt")([axis, skipna, numeric\_only]) | Return unbiased kurtosis over requested axis. | + | [`kurtosis`](pandas.DataFrame.kurtosis.html#pandas.DataFrame.kurtosis "pandas.DataFrame.kurtosis")([axis, skipna, numeric\_only]) | Return unbiased kurtosis over requested axis. | + | [`last`](pandas.DataFrame.last.html#pandas.DataFrame.last "pandas.DataFrame.last")(offset) | (DEPRECATED) Select final periods of time series data based on a date offset. | + | [`last_valid_index`](pandas.DataFrame.last_valid_index.html#pandas.DataFrame.last_valid_index "pandas.DataFrame.last_valid_index")() | Return index for last non-NA value or None, if no non-NA value is found. | + | [`le`](pandas.DataFrame.le.html#pandas.DataFrame.le "pandas.DataFrame.le")(other[, axis, level]) | Get Less than or equal to of dataframe and other, element-wise (binary operator le). | + | [`lt`](pandas.DataFrame.lt.html#pandas.DataFrame.lt "pandas.DataFrame.lt")(other[, axis, level]) | Get Less than of dataframe and other, element-wise (binary operator lt). | + | [`map`](pandas.DataFrame.map.html#pandas.DataFrame.map "pandas.DataFrame.map")(func[, na\_action]) | Apply a function to a Dataframe elementwise. | + | [`mask`](pandas.DataFrame.mask.html#pandas.DataFrame.mask "pandas.DataFrame.mask")(cond[, other, inplace, axis, level]) | Replace values where the condition is True. | + | [`max`](pandas.DataFrame.max.html#pandas.DataFrame.max "pandas.DataFrame.max")([axis, skipna, numeric\_only]) | Return the maximum of the values over the requested axis. | + | [`mean`](pandas.DataFrame.mean.html#pandas.DataFrame.mean "pandas.DataFrame.mean")([axis, skipna, numeric\_only]) | Return the mean of the values over the requested axis. | + | [`median`](pandas.DataFrame.median.html#pandas.DataFrame.median "pandas.DataFrame.median")([axis, skipna, numeric\_only]) | Return the median of the values over the requested axis. | + | [`melt`](pandas.DataFrame.melt.html#pandas.DataFrame.melt "pandas.DataFrame.melt")([id\_vars, value\_vars, var\_name, ...]) | Unpivot a DataFrame from wide to long format, optionally leaving identifiers set. | + | [`memory_usage`](pandas.DataFrame.memory_usage.html#pandas.DataFrame.memory_usage "pandas.DataFrame.memory_usage")([index, deep]) | Return the memory usage of each column in bytes. | + | [`merge`](pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge")(right[, how, on, left\_on, right\_on, ...]) | Merge DataFrame or named Series objects with a database-style join. | + | [`min`](pandas.DataFrame.min.html#pandas.DataFrame.min "pandas.DataFrame.min")([axis, skipna, numeric\_only]) | Return the minimum of the values over the requested axis. | + | [`mod`](pandas.DataFrame.mod.html#pandas.DataFrame.mod "pandas.DataFrame.mod")(other[, axis, level, fill\_value]) | Get Modulo of dataframe and other, element-wise (binary operator mod). | + | [`mode`](pandas.DataFrame.mode.html#pandas.DataFrame.mode "pandas.DataFrame.mode")([axis, numeric\_only, dropna]) | Get the mode(s) of each element along the selected axis. | + | [`mul`](pandas.DataFrame.mul.html#pandas.DataFrame.mul "pandas.DataFrame.mul")(other[, axis, level, fill\_value]) | Get Multiplication of dataframe and other, element-wise (binary operator mul). | + | `multiply`(other[, axis, level, fill\_value]) | Get Multiplication of dataframe and other, element-wise (binary operator mul). | + | [`ne`](pandas.DataFrame.ne.html#pandas.DataFrame.ne "pandas.DataFrame.ne")(other[, axis, level]) | Get Not equal to of dataframe and other, element-wise (binary operator ne). | + | [`nlargest`](pandas.DataFrame.nlargest.html#pandas.DataFrame.nlargest "pandas.DataFrame.nlargest")(n, columns[, keep]) | Return the first n rows ordered by columns in descending order. | + | [`notna`](pandas.DataFrame.notna.html#pandas.DataFrame.notna "pandas.DataFrame.notna")() | Detect existing (non-missing) values. | + | [`notnull`](pandas.DataFrame.notnull.html#pandas.DataFrame.notnull "pandas.DataFrame.notnull")() | DataFrame.notnull is an alias for DataFrame.notna. | + | [`nsmallest`](pandas.DataFrame.nsmallest.html#pandas.DataFrame.nsmallest "pandas.DataFrame.nsmallest")(n, columns[, keep]) | Return the first n rows ordered by columns in ascending order. | + | [`nunique`](pandas.DataFrame.nunique.html#pandas.DataFrame.nunique "pandas.DataFrame.nunique")([axis, dropna]) | Count number of distinct elements in specified axis. | + | [`pad`](pandas.DataFrame.pad.html#pandas.DataFrame.pad "pandas.DataFrame.pad")(\*[, axis, inplace, limit, downcast]) | (DEPRECATED) Fill NA/NaN values by propagating the last valid observation to next valid. | + | [`pct_change`](pandas.DataFrame.pct_change.html#pandas.DataFrame.pct_change "pandas.DataFrame.pct_change")([periods, fill\_method, limit, freq]) | Fractional change between the current and a prior element. | + | [`pipe`](pandas.DataFrame.pipe.html#pandas.DataFrame.pipe "pandas.DataFrame.pipe")(func, \*args, \*\*kwargs) | Apply chainable functions that expect Series or DataFrames. | + | [`pivot`](pandas.DataFrame.pivot.html#pandas.DataFrame.pivot "pandas.DataFrame.pivot")(\*, columns[, index, values]) | Return reshaped DataFrame organized by given index / column values. | + | [`pivot_table`](pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table")([values, index, columns, ...]) | Create a spreadsheet-style pivot table as a DataFrame. | + | [`pop`](pandas.DataFrame.pop.html#pandas.DataFrame.pop "pandas.DataFrame.pop")(item) | Return item and drop from frame. | + | [`pow`](pandas.DataFrame.pow.html#pandas.DataFrame.pow "pandas.DataFrame.pow")(other[, axis, level, fill\_value]) | Get Exponential power of dataframe and other, element-wise (binary operator pow). | + | [`prod`](pandas.DataFrame.prod.html#pandas.DataFrame.prod "pandas.DataFrame.prod")([axis, skipna, numeric\_only, min\_count]) | Return the product of the values over the requested axis. | + | [`product`](pandas.DataFrame.product.html#pandas.DataFrame.product "pandas.DataFrame.product")([axis, skipna, numeric\_only, min\_count]) | Return the product of the values over the requested axis. | + | [`quantile`](pandas.DataFrame.quantile.html#pandas.DataFrame.quantile "pandas.DataFrame.quantile")([q, axis, numeric\_only, ...]) | Return values at the given quantile over requested axis. | + | [`query`](pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query")(expr, \*[, inplace]) | Query the columns of a DataFrame with a boolean expression. | + | [`radd`](pandas.DataFrame.radd.html#pandas.DataFrame.radd "pandas.DataFrame.radd")(other[, axis, level, fill\_value]) | Get Addition of dataframe and other, element-wise (binary operator radd). | + | [`rank`](pandas.DataFrame.rank.html#pandas.DataFrame.rank "pandas.DataFrame.rank")([axis, method, numeric\_only, ...]) | Compute numerical data ranks (1 through n) along axis. | + | [`rdiv`](pandas.DataFrame.rdiv.html#pandas.DataFrame.rdiv "pandas.DataFrame.rdiv")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator rtruediv). | + | [`reindex`](pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex")([labels, index, columns, axis, ...]) | Conform DataFrame to new index with optional filling logic. | + | [`reindex_like`](pandas.DataFrame.reindex_like.html#pandas.DataFrame.reindex_like "pandas.DataFrame.reindex_like")(other[, method, copy, limit, ...]) | Return an object with matching indices as other object. | + | [`rename`](pandas.DataFrame.rename.html#pandas.DataFrame.rename "pandas.DataFrame.rename")([mapper, index, columns, axis, copy, ...]) | Rename columns or index labels. | + | [`rename_axis`](pandas.DataFrame.rename_axis.html#pandas.DataFrame.rename_axis "pandas.DataFrame.rename_axis")([mapper, index, columns, axis, ...]) | Set the name of the axis for the index or columns. | + | [`reorder_levels`](pandas.DataFrame.reorder_levels.html#pandas.DataFrame.reorder_levels "pandas.DataFrame.reorder_levels")(order[, axis]) | Rearrange index levels using input order. | + | [`replace`](pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace")([to\_replace, value, inplace, limit, ...]) | Replace values given in to\_replace with value. | + | [`resample`](pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample")(rule[, axis, closed, label, ...]) | Resample time-series data. | + | [`reset_index`](pandas.DataFrame.reset_index.html#pandas.DataFrame.reset_index "pandas.DataFrame.reset_index")([level, drop, inplace, ...]) | Reset the index, or a level of it. | + | [`rfloordiv`](pandas.DataFrame.rfloordiv.html#pandas.DataFrame.rfloordiv "pandas.DataFrame.rfloordiv")(other[, axis, level, fill\_value]) | Get Integer division of dataframe and other, element-wise (binary operator rfloordiv). | + | [`rmod`](pandas.DataFrame.rmod.html#pandas.DataFrame.rmod "pandas.DataFrame.rmod")(other[, axis, level, fill\_value]) | Get Modulo of dataframe and other, element-wise (binary operator rmod). | + | [`rmul`](pandas.DataFrame.rmul.html#pandas.DataFrame.rmul "pandas.DataFrame.rmul")(other[, axis, level, fill\_value]) | Get Multiplication of dataframe and other, element-wise (binary operator rmul). | + | [`rolling`](pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling")(window[, min\_periods, center, ...]) | Provide rolling window calculations. | + | [`round`](pandas.DataFrame.round.html#pandas.DataFrame.round "pandas.DataFrame.round")([decimals]) | Round a DataFrame to a variable number of decimal places. | + | [`rpow`](pandas.DataFrame.rpow.html#pandas.DataFrame.rpow "pandas.DataFrame.rpow")(other[, axis, level, fill\_value]) | Get Exponential power of dataframe and other, element-wise (binary operator rpow). | + | [`rsub`](pandas.DataFrame.rsub.html#pandas.DataFrame.rsub "pandas.DataFrame.rsub")(other[, axis, level, fill\_value]) | Get Subtraction of dataframe and other, element-wise (binary operator rsub). | + | [`rtruediv`](pandas.DataFrame.rtruediv.html#pandas.DataFrame.rtruediv "pandas.DataFrame.rtruediv")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator rtruediv). | + | [`sample`](pandas.DataFrame.sample.html#pandas.DataFrame.sample "pandas.DataFrame.sample")([n, frac, replace, weights, ...]) | Return a random sample of items from an axis of object. | + | [`select_dtypes`](pandas.DataFrame.select_dtypes.html#pandas.DataFrame.select_dtypes "pandas.DataFrame.select_dtypes")([include, exclude]) | Return a subset of the DataFrame's columns based on the column dtypes. | + | [`sem`](pandas.DataFrame.sem.html#pandas.DataFrame.sem "pandas.DataFrame.sem")([axis, skipna, ddof, numeric\_only]) | Return unbiased standard error of the mean over requested axis. | + | [`set_axis`](pandas.DataFrame.set_axis.html#pandas.DataFrame.set_axis "pandas.DataFrame.set_axis")(labels, \*[, axis, copy]) | Assign desired index to given axis. | + | [`set_flags`](pandas.DataFrame.set_flags.html#pandas.DataFrame.set_flags "pandas.DataFrame.set_flags")(\*[, copy, allows\_duplicate\_labels]) | Return a new object with updated flags. | + | [`set_index`](pandas.DataFrame.set_index.html#pandas.DataFrame.set_index "pandas.DataFrame.set_index")(keys, \*[, drop, append, inplace, ...]) | Set the DataFrame index using existing columns. | + | [`shift`](pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift")([periods, freq, axis, fill\_value, suffix]) | Shift index by desired number of periods with an optional time freq. | + | [`skew`](pandas.DataFrame.skew.html#pandas.DataFrame.skew "pandas.DataFrame.skew")([axis, skipna, numeric\_only]) | Return unbiased skew over requested axis. | + | [`sort_index`](pandas.DataFrame.sort_index.html#pandas.DataFrame.sort_index "pandas.DataFrame.sort_index")(\*[, axis, level, ascending, ...]) | Sort object by labels (along an axis). | + | [`sort_values`](pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values")(by, \*[, axis, ascending, ...]) | Sort by the values along either axis. | + | [`squeeze`](pandas.DataFrame.squeeze.html#pandas.DataFrame.squeeze "pandas.DataFrame.squeeze")([axis]) | Squeeze 1 dimensional axis objects into scalars. | + | [`stack`](pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack")([level, dropna, sort, future\_stack]) | Stack the prescribed level(s) from columns to index. | + | [`std`](pandas.DataFrame.std.html#pandas.DataFrame.std "pandas.DataFrame.std")([axis, skipna, ddof, numeric\_only]) | Return sample standard deviation over requested axis. | + | [`sub`](pandas.DataFrame.sub.html#pandas.DataFrame.sub "pandas.DataFrame.sub")(other[, axis, level, fill\_value]) | Get Subtraction of dataframe and other, element-wise (binary operator sub). | + | `subtract`(other[, axis, level, fill\_value]) | Get Subtraction of dataframe and other, element-wise (binary operator sub). | + | [`sum`](pandas.DataFrame.sum.html#pandas.DataFrame.sum "pandas.DataFrame.sum")([axis, skipna, numeric\_only, min\_count]) | Return the sum of the values over the requested axis. | + | [`swapaxes`](pandas.DataFrame.swapaxes.html#pandas.DataFrame.swapaxes "pandas.DataFrame.swapaxes")(axis1, axis2[, copy]) | (DEPRECATED) Interchange axes and swap values axes appropriately. | + | [`swaplevel`](pandas.DataFrame.swaplevel.html#pandas.DataFrame.swaplevel "pandas.DataFrame.swaplevel")([i, j, axis]) | Swap levels i and j in a [`MultiIndex`](pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex"). | + | [`tail`](pandas.DataFrame.tail.html#pandas.DataFrame.tail "pandas.DataFrame.tail")([n]) | Return the last n rows. | + | [`take`](pandas.DataFrame.take.html#pandas.DataFrame.take "pandas.DataFrame.take")(indices[, axis]) | Return the elements in the given *positional* indices along an axis. | + | [`to_clipboard`](pandas.DataFrame.to_clipboard.html#pandas.DataFrame.to_clipboard "pandas.DataFrame.to_clipboard")(\*[, excel, sep]) | Copy object to the system clipboard. | + | [`to_csv`](pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv")([path\_or\_buf, sep, na\_rep, ...]) | Write object to a comma-separated values (csv) file. | + | [`to_dict`](pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict")([orient, into, index]) | Convert the DataFrame to a dictionary. | + | [`to_excel`](pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel")(excel\_writer, \*[, sheet\_name, ...]) | Write object to an Excel sheet. | + | [`to_feather`](pandas.DataFrame.to_feather.html#pandas.DataFrame.to_feather "pandas.DataFrame.to_feather")(path, \*\*kwargs) | Write a DataFrame to the binary Feather format. | + | [`to_gbq`](pandas.DataFrame.to_gbq.html#pandas.DataFrame.to_gbq "pandas.DataFrame.to_gbq")(destination\_table, \*[, project\_id, ...]) | (DEPRECATED) Write a DataFrame to a Google BigQuery table. | + | [`to_hdf`](pandas.DataFrame.to_hdf.html#pandas.DataFrame.to_hdf "pandas.DataFrame.to_hdf")(path\_or\_buf, \*, key[, mode, ...]) | Write the contained data to an HDF5 file using HDFStore. | + | [`to_html`](pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html")([buf, columns, col\_space, header, ...]) | Render a DataFrame as an HTML table. | + | [`to_json`](pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json")([path\_or\_buf, orient, date\_format, ...]) | Convert the object to a JSON string. | + | [`to_latex`](pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex")([buf, columns, header, index, ...]) | Render object to a LaTeX tabular, longtable, or nested table. | + | [`to_markdown`](pandas.DataFrame.to_markdown.html#pandas.DataFrame.to_markdown "pandas.DataFrame.to_markdown")([buf, mode, index, storage\_options]) | Print DataFrame in Markdown-friendly format. | + | [`to_numpy`](pandas.DataFrame.to_numpy.html#pandas.DataFrame.to_numpy "pandas.DataFrame.to_numpy")([dtype, copy, na\_value]) | Convert the DataFrame to a NumPy array. | + | [`to_orc`](pandas.DataFrame.to_orc.html#pandas.DataFrame.to_orc "pandas.DataFrame.to_orc")([path, engine, index, engine\_kwargs]) | Write a DataFrame to the ORC format. | + | [`to_parquet`](pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet")([path, engine, compression, ...]) | Write a DataFrame to the binary parquet format. | + | [`to_period`](pandas.DataFrame.to_period.html#pandas.DataFrame.to_period "pandas.DataFrame.to_period")([freq, axis, copy]) | Convert DataFrame from DatetimeIndex to PeriodIndex. | + | [`to_pickle`](pandas.DataFrame.to_pickle.html#pandas.DataFrame.to_pickle "pandas.DataFrame.to_pickle")(path, \*[, compression, protocol, ...]) | Pickle (serialize) object to file. | + | [`to_records`](pandas.DataFrame.to_records.html#pandas.DataFrame.to_records "pandas.DataFrame.to_records")([index, column\_dtypes, index\_dtypes]) | Convert DataFrame to a NumPy record array. | + | [`to_sql`](pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql")(name, con, \*[, schema, if\_exists, ...]) | Write records stored in a DataFrame to a SQL database. | + | [`to_stata`](pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata")(path, \*[, convert\_dates, ...]) | Export DataFrame object to Stata dta format. | + | [`to_string`](pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string")([buf, columns, col\_space, header, ...]) | Render a DataFrame to a console-friendly tabular output. | + | [`to_timestamp`](pandas.DataFrame.to_timestamp.html#pandas.DataFrame.to_timestamp "pandas.DataFrame.to_timestamp")([freq, how, axis, copy]) | Cast to DatetimeIndex of timestamps, at *beginning* of period. | + | [`to_xarray`](pandas.DataFrame.to_xarray.html#pandas.DataFrame.to_xarray "pandas.DataFrame.to_xarray")() | Return an xarray object from the pandas object. | + | [`to_xml`](pandas.DataFrame.to_xml.html#pandas.DataFrame.to_xml "pandas.DataFrame.to_xml")([path\_or\_buffer, index, root\_name, ...]) | Render a DataFrame to an XML document. | + | [`transform`](pandas.DataFrame.transform.html#pandas.DataFrame.transform "pandas.DataFrame.transform")(func[, axis]) | Call `func` on self producing a DataFrame with the same axis shape as self. | + | [`transpose`](pandas.DataFrame.transpose.html#pandas.DataFrame.transpose "pandas.DataFrame.transpose")(\*args[, copy]) | Transpose index and columns. | + | [`truediv`](pandas.DataFrame.truediv.html#pandas.DataFrame.truediv "pandas.DataFrame.truediv")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator truediv). | + | [`truncate`](pandas.DataFrame.truncate.html#pandas.DataFrame.truncate "pandas.DataFrame.truncate")([before, after, axis, copy]) | Truncate a Series or DataFrame before and after some index value. | + | [`tz_convert`](pandas.DataFrame.tz_convert.html#pandas.DataFrame.tz_convert "pandas.DataFrame.tz_convert")(tz[, axis, level, copy]) | Convert tz-aware axis to target time zone. | + | [`tz_localize`](pandas.DataFrame.tz_localize.html#pandas.DataFrame.tz_localize "pandas.DataFrame.tz_localize")(tz[, axis, level, copy, ...]) | Localize tz-naive index of a Series or DataFrame to target time zone. | + | [`unstack`](pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack")([level, fill\_value, sort]) | Pivot a level of the (necessarily hierarchical) index labels. | + | [`update`](pandas.DataFrame.update.html#pandas.DataFrame.update "pandas.DataFrame.update")(other[, join, overwrite, ...]) | Modify in place using non-NA values from another DataFrame. | + | [`value_counts`](pandas.DataFrame.value_counts.html#pandas.DataFrame.value_counts "pandas.DataFrame.value_counts")([subset, normalize, sort, ...]) | Return a Series containing the frequency of each distinct row in the Dataframe. | + | [`var`](pandas.DataFrame.var.html#pandas.DataFrame.var "pandas.DataFrame.var")([axis, skipna, ddof, numeric\_only]) | Return unbiased variance over requested axis. | + | [`where`](pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where")(cond[, other, inplace, axis, level]) | Replace values where the condition is False. | + | [`xs`](pandas.DataFrame.xs.html#pandas.DataFrame.xs "pandas.DataFrame.xs")(key[, axis, level, drop\_level]) | Return cross-section from the Series/DataFrame. | diff --git a/corpus/docs/pandas/dataframe/dataframe_30.md b/corpus/docs/pandas/dataframe/dataframe_30.md new file mode 100644 index 0000000000000000000000000000000000000000..f228768b2ea70d7b9602b0bc9e2e4022bf261607 --- /dev/null +++ b/corpus/docs/pandas/dataframe/dataframe_30.md @@ -0,0 +1,378 @@ +# pandas.DataFrame# + +Source: https://pandas.pydata.org/pandas-docs/version/3.0/reference/api/pandas.DataFrame.html +Version: 3.0 + +*class* pandas.DataFrame(*data=None*, *index=None*, *columns=None*, *dtype=None*, *copy=None*)[[source]](https://github.com/pandas-dev/pandas/blob/v3.0.0/pandas/__init__.py)[#](#pandas.DataFrame "Link to this definition") +: Two-dimensional, size-mutable, potentially heterogeneous tabular data. + + Data structure also contains labeled axes (rows and columns). + Arithmetic operations align on both row and column labels. Can be + thought of as a dict-like container for Series objects. The primary + pandas data structure. + + Parameters: + : **data**ndarray (structured or homogeneous), Iterable, dict, or DataFrame + : Dict can contain Series, arrays, constants, dataclass or list-like objects. If + data is a dict, column order follows insertion-order. If a dict contains Series + which have an index defined, it is aligned by its index. This alignment also + occurs if data is a Series or a DataFrame itself. Alignment is done on + Series/DataFrame inputs. + + If data is a list of dicts, column order follows insertion-order. + + **index**Index or array-like + : Index to use for resulting frame. Will default to RangeIndex if + no indexing information part of input data and no index provided. + + **columns**Index or array-like + : Column labels to use for resulting frame when data does not have them, + defaulting to RangeIndex(0, 1, 2, …, n). If data contains column labels, + will perform column selection instead. + + **dtype**dtype, default None + : Data type to force. Only a single dtype is allowed. If None, infer. + If `data` is DataFrame then is ignored. + + **copy**bool or None, default None + : Copy data from inputs. + For dict data, the default of None behaves like `copy=True`. For DataFrame + or 2d ndarray input, the default of None behaves like `copy=False`. + If data is a dict containing one or more Series (possibly of different dtypes), + `copy=False` will ensure that these inputs are not copied. + + See also + + [`DataFrame.from_records`](pandas.DataFrame.from_records.html#pandas.DataFrame.from_records "pandas.DataFrame.from_records") + : Constructor from tuples, also record arrays. + + [`DataFrame.from_dict`](pandas.DataFrame.from_dict.html#pandas.DataFrame.from_dict "pandas.DataFrame.from_dict") + : From dicts of Series, arrays, or dicts. + + [`read_csv`](pandas.read_csv.html#pandas.read_csv "pandas.read_csv") + : Read a comma-separated values (csv) file into DataFrame. + + [`read_table`](pandas.read_table.html#pandas.read_table "pandas.read_table") + : Read general delimited file into DataFrame. + + [`read_clipboard`](pandas.read_clipboard.html#pandas.read_clipboard "pandas.read_clipboard") + : Read text from clipboard into DataFrame. + + Notes + + Please reference the [User Guide](../../user_guide/dsintro.html#basics-dataframe) for more information. + + Examples + + Constructing DataFrame from a dictionary. + + ```None + >>> d = {"col1": [1, 2], "col2": [3, 4]} + >>> df = pd.DataFrame(data=d) + >>> df + col1 col2 + 0 1 3 + 1 2 4 + ``` + + Notice that the inferred dtype is int64. + + ```None + >>> df.dtypes + col1 int64 + col2 int64 + dtype: object + ``` + + To enforce a single dtype: + + ```None + >>> df = pd.DataFrame(data=d, dtype=np.int8) + >>> df.dtypes + col1 int8 + col2 int8 + dtype: object + ``` + + Constructing DataFrame from a dictionary including Series: + + ```None + >>> d = {"col1": [0, 1, 2, 3], "col2": pd.Series([2, 3], index=[2, 3])} + >>> pd.DataFrame(data=d, index=[0, 1, 2, 3]) + col1 col2 + 0 0 NaN + 1 1 NaN + 2 2 2.0 + 3 3 3.0 + ``` + + Constructing DataFrame from numpy ndarray: + + ```None + >>> df2 = pd.DataFrame( + ... np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), columns=["a", "b", "c"] + ... ) + >>> df2 + a b c + 0 1 2 3 + 1 4 5 6 + 2 7 8 9 + ``` + + Constructing DataFrame from a numpy ndarray that has labeled columns: + + ```None + >>> data = np.array( + ... [(1, 2, 3), (4, 5, 6), (7, 8, 9)], + ... dtype=[("a", "i4"), ("b", "i4"), ("c", "i4")], + ... ) + >>> df3 = pd.DataFrame(data, columns=["c", "a"]) + >>> df3 + c a + 0 3 1 + 1 6 4 + 2 9 7 + ``` + + Constructing DataFrame from dataclass: + + ```None + >>> from dataclasses import make_dataclass + >>> Point = make_dataclass("Point", [("x", int), ("y", int)]) + >>> pd.DataFrame([Point(0, 0), Point(0, 3), Point(2, 3)]) + x y + 0 0 0 + 1 0 3 + 2 2 3 + ``` + + Constructing DataFrame from Series/DataFrame: + + ```None + >>> ser = pd.Series([1, 2, 3], index=["a", "b", "c"]) + >>> df = pd.DataFrame(data=ser, index=["a", "c"]) + >>> df + 0 + a 1 + c 3 + ``` + + ```None + >>> df1 = pd.DataFrame([1, 2, 3], index=["a", "b", "c"], columns=["x"]) + >>> df2 = pd.DataFrame(data=df1, index=["a", "c"]) + >>> df2 + x + a 1 + c 3 + ``` + + Attributes + + | | | + | --- | --- | + | [`T`](pandas.DataFrame.T.html#pandas.DataFrame.T "pandas.DataFrame.T") | The transpose of the DataFrame. | + | [`at`](pandas.DataFrame.at.html#pandas.DataFrame.at "pandas.DataFrame.at") | Access a single value for a row/column label pair. | + | [`attrs`](pandas.DataFrame.attrs.html#pandas.DataFrame.attrs "pandas.DataFrame.attrs") | Dictionary of global attributes of this dataset. | + | [`axes`](pandas.DataFrame.axes.html#pandas.DataFrame.axes "pandas.DataFrame.axes") | Return a list representing the axes of the DataFrame. | + | [`columns`](pandas.DataFrame.columns.html#pandas.DataFrame.columns "pandas.DataFrame.columns") | The column labels of the DataFrame. | + | [`dtypes`](pandas.DataFrame.dtypes.html#pandas.DataFrame.dtypes "pandas.DataFrame.dtypes") | Return the dtypes in the DataFrame. | + | [`empty`](pandas.DataFrame.empty.html#pandas.DataFrame.empty "pandas.DataFrame.empty") | Indicator whether Series/DataFrame is empty. | + | `flags` | Get the properties associated with this pandas object. | + | [`iat`](pandas.DataFrame.iat.html#pandas.DataFrame.iat "pandas.DataFrame.iat") | Access a single value for a row/column pair by integer position. | + | [`iloc`](pandas.DataFrame.iloc.html#pandas.DataFrame.iloc "pandas.DataFrame.iloc") | Purely integer-location based indexing for selection by position. | + | [`index`](pandas.DataFrame.index.html#pandas.DataFrame.index "pandas.DataFrame.index") | The index (row labels) of the DataFrame. | + | [`loc`](pandas.DataFrame.loc.html#pandas.DataFrame.loc "pandas.DataFrame.loc") | Access a group of rows and columns by label(s) or a boolean array. | + | [`ndim`](pandas.DataFrame.ndim.html#pandas.DataFrame.ndim "pandas.DataFrame.ndim") | Return an int representing the number of axes / array dimensions. | + | [`shape`](pandas.DataFrame.shape.html#pandas.DataFrame.shape "pandas.DataFrame.shape") | Return a tuple representing the dimensionality of the DataFrame. | + | [`size`](pandas.DataFrame.size.html#pandas.DataFrame.size "pandas.DataFrame.size") | Return an int representing the number of elements in this object. | + | [`style`](pandas.DataFrame.style.html#pandas.DataFrame.style "pandas.DataFrame.style") | Returns a Styler object. | + | [`values`](pandas.DataFrame.values.html#pandas.DataFrame.values "pandas.DataFrame.values") | Return a Numpy representation of the DataFrame. | + + Methods + + | | | + | --- | --- | + | [`abs`](pandas.DataFrame.abs.html#pandas.DataFrame.abs "pandas.DataFrame.abs")() | Return a Series/DataFrame with absolute numeric value of each element. | + | [`add`](pandas.DataFrame.add.html#pandas.DataFrame.add "pandas.DataFrame.add")(other[, axis, level, fill\_value]) | Get Addition of dataframe and other, element-wise (binary operator add). | + | [`add_prefix`](pandas.DataFrame.add_prefix.html#pandas.DataFrame.add_prefix "pandas.DataFrame.add_prefix")(prefix[, axis]) | Prefix labels with string prefix. | + | [`add_suffix`](pandas.DataFrame.add_suffix.html#pandas.DataFrame.add_suffix "pandas.DataFrame.add_suffix")(suffix[, axis]) | Suffix labels with string suffix. | + | [`agg`](pandas.DataFrame.agg.html#pandas.DataFrame.agg "pandas.DataFrame.agg")([func, axis]) | Aggregate using one or more operations over the specified axis. | + | [`aggregate`](pandas.DataFrame.aggregate.html#pandas.DataFrame.aggregate "pandas.DataFrame.aggregate")([func, axis]) | Aggregate using one or more operations over the specified axis. | + | [`align`](pandas.DataFrame.align.html#pandas.DataFrame.align "pandas.DataFrame.align")(other[, join, axis, level, copy, ...]) | Align two objects on their axes with the specified join method. | + | [`all`](pandas.DataFrame.all.html#pandas.DataFrame.all "pandas.DataFrame.all")(\*[, axis, bool\_only, skipna]) | Return whether all elements are True, potentially over an axis. | + | [`any`](pandas.DataFrame.any.html#pandas.DataFrame.any "pandas.DataFrame.any")(\*[, axis, bool\_only, skipna]) | Return whether any element is True, potentially over an axis. | + | [`apply`](pandas.DataFrame.apply.html#pandas.DataFrame.apply "pandas.DataFrame.apply")(func[, axis, raw, result\_type, args, ...]) | Apply a function along an axis of the DataFrame. | + | [`asfreq`](pandas.DataFrame.asfreq.html#pandas.DataFrame.asfreq "pandas.DataFrame.asfreq")(freq[, method, how, normalize, ...]) | Convert time series to specified frequency. | + | [`asof`](pandas.DataFrame.asof.html#pandas.DataFrame.asof "pandas.DataFrame.asof")(where[, subset]) | Return the last row(s) without any NaNs before where. | + | [`assign`](pandas.DataFrame.assign.html#pandas.DataFrame.assign "pandas.DataFrame.assign")(\*\*kwargs) | Assign new columns to a DataFrame. | + | [`astype`](pandas.DataFrame.astype.html#pandas.DataFrame.astype "pandas.DataFrame.astype")(dtype[, copy, errors]) | Cast a pandas object to a specified dtype `dtype`. | + | [`at_time`](pandas.DataFrame.at_time.html#pandas.DataFrame.at_time "pandas.DataFrame.at_time")(time[, asof, axis]) | Select values at particular time of day (e.g., 9:30AM). | + | [`between_time`](pandas.DataFrame.between_time.html#pandas.DataFrame.between_time "pandas.DataFrame.between_time")(start\_time, end\_time[, ...]) | Select values between particular times of the day (e.g., 9:00-9:30 AM). | + | [`bfill`](pandas.DataFrame.bfill.html#pandas.DataFrame.bfill "pandas.DataFrame.bfill")(\*[, axis, inplace, limit, limit\_area]) | Fill NA/NaN values by using the next valid observation to fill the gap. | + | [`boxplot`](pandas.DataFrame.boxplot.html#pandas.DataFrame.boxplot "pandas.DataFrame.boxplot")([column, by, ax, fontsize, rot, ...]) | Make a box plot from DataFrame columns. | + | [`clip`](pandas.DataFrame.clip.html#pandas.DataFrame.clip "pandas.DataFrame.clip")([lower, upper, axis, inplace]) | Trim values at input threshold(s). | + | [`combine`](pandas.DataFrame.combine.html#pandas.DataFrame.combine "pandas.DataFrame.combine")(other, func[, fill\_value, overwrite]) | Perform column-wise combine with another DataFrame. | + | [`combine_first`](pandas.DataFrame.combine_first.html#pandas.DataFrame.combine_first "pandas.DataFrame.combine_first")(other) | Update null elements with value in the same location in other. | + | [`compare`](pandas.DataFrame.compare.html#pandas.DataFrame.compare "pandas.DataFrame.compare")(other[, align\_axis, keep\_shape, ...]) | Compare to another DataFrame and show the differences. | + | [`convert_dtypes`](pandas.DataFrame.convert_dtypes.html#pandas.DataFrame.convert_dtypes "pandas.DataFrame.convert_dtypes")([infer\_objects, ...]) | Convert columns from numpy dtypes to the best dtypes that support `pd.NA`. | + | [`copy`](pandas.DataFrame.copy.html#pandas.DataFrame.copy "pandas.DataFrame.copy")([deep]) | Make a copy of this object's indices and data. | + | [`corr`](pandas.DataFrame.corr.html#pandas.DataFrame.corr "pandas.DataFrame.corr")([method, min\_periods, numeric\_only]) | Compute pairwise correlation of columns, excluding NA/null values. | + | [`corrwith`](pandas.DataFrame.corrwith.html#pandas.DataFrame.corrwith "pandas.DataFrame.corrwith")(other[, axis, drop, method, ...]) | Compute pairwise correlation. | + | [`count`](pandas.DataFrame.count.html#pandas.DataFrame.count "pandas.DataFrame.count")([axis, numeric\_only]) | Count non-NA cells for each column or row. | + | [`cov`](pandas.DataFrame.cov.html#pandas.DataFrame.cov "pandas.DataFrame.cov")([min\_periods, ddof, numeric\_only]) | Compute pairwise covariance of columns, excluding NA/null values. | + | [`cummax`](pandas.DataFrame.cummax.html#pandas.DataFrame.cummax "pandas.DataFrame.cummax")([axis, skipna, numeric\_only]) | Return cumulative maximum over a DataFrame or Series axis. | + | [`cummin`](pandas.DataFrame.cummin.html#pandas.DataFrame.cummin "pandas.DataFrame.cummin")([axis, skipna, numeric\_only]) | Return cumulative minimum over a DataFrame or Series axis. | + | [`cumprod`](pandas.DataFrame.cumprod.html#pandas.DataFrame.cumprod "pandas.DataFrame.cumprod")([axis, skipna, numeric\_only]) | Return cumulative product over a DataFrame or Series axis. | + | [`cumsum`](pandas.DataFrame.cumsum.html#pandas.DataFrame.cumsum "pandas.DataFrame.cumsum")([axis, skipna, numeric\_only]) | Return cumulative sum over a DataFrame or Series axis. | + | [`describe`](pandas.DataFrame.describe.html#pandas.DataFrame.describe "pandas.DataFrame.describe")([percentiles, include, exclude]) | Generate descriptive statistics. | + | [`diff`](pandas.DataFrame.diff.html#pandas.DataFrame.diff "pandas.DataFrame.diff")([periods, axis]) | First discrete difference of element. | + | [`div`](pandas.DataFrame.div.html#pandas.DataFrame.div "pandas.DataFrame.div")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator truediv). | + | `divide`(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator truediv). | + | [`dot`](pandas.DataFrame.dot.html#pandas.DataFrame.dot "pandas.DataFrame.dot")(other) | Compute the matrix multiplication between the DataFrame and other. | + | [`drop`](pandas.DataFrame.drop.html#pandas.DataFrame.drop "pandas.DataFrame.drop")([labels, axis, index, columns, level, ...]) | Drop specified labels from rows or columns. | + | [`drop_duplicates`](pandas.DataFrame.drop_duplicates.html#pandas.DataFrame.drop_duplicates "pandas.DataFrame.drop_duplicates")([subset, keep, inplace, ...]) | Return DataFrame with duplicate rows removed. | + | [`droplevel`](pandas.DataFrame.droplevel.html#pandas.DataFrame.droplevel "pandas.DataFrame.droplevel")(level[, axis]) | Return Series/DataFrame with requested index / column level(s) removed. | + | [`dropna`](pandas.DataFrame.dropna.html#pandas.DataFrame.dropna "pandas.DataFrame.dropna")(\*[, axis, how, thresh, subset, ...]) | Remove missing values. | + | [`duplicated`](pandas.DataFrame.duplicated.html#pandas.DataFrame.duplicated "pandas.DataFrame.duplicated")([subset, keep]) | Return boolean Series denoting duplicate rows. | + | [`eq`](pandas.DataFrame.eq.html#pandas.DataFrame.eq "pandas.DataFrame.eq")(other[, axis, level]) | Get Not equal to of dataframe and other, element-wise (binary operator eq). | + | [`equals`](pandas.DataFrame.equals.html#pandas.DataFrame.equals "pandas.DataFrame.equals")(other) | Test whether two objects contain the same elements. | + | [`eval`](pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval")(expr, \*[, inplace]) | Evaluate a string describing operations on DataFrame columns. | + | [`ewm`](pandas.DataFrame.ewm.html#pandas.DataFrame.ewm "pandas.DataFrame.ewm")([com, span, halflife, alpha, ...]) | Provide exponentially weighted (EW) calculations. | + | [`expanding`](pandas.DataFrame.expanding.html#pandas.DataFrame.expanding "pandas.DataFrame.expanding")([min\_periods, method]) | Provide expanding window calculations. | + | [`explode`](pandas.DataFrame.explode.html#pandas.DataFrame.explode "pandas.DataFrame.explode")(column[, ignore\_index]) | Transform each element of a list-like to a row, replicating index values. | + | [`ffill`](pandas.DataFrame.ffill.html#pandas.DataFrame.ffill "pandas.DataFrame.ffill")(\*[, axis, inplace, limit, limit\_area]) | Fill NA/NaN values by propagating the last valid observation to next valid. | + | [`fillna`](pandas.DataFrame.fillna.html#pandas.DataFrame.fillna "pandas.DataFrame.fillna")(value, \*[, axis, inplace, limit]) | Fill NA/NaN values with value. | + | [`filter`](pandas.DataFrame.filter.html#pandas.DataFrame.filter "pandas.DataFrame.filter")([items, like, regex, axis]) | Subset the DataFrame or Series according to the specified index labels. | + | [`first_valid_index`](pandas.DataFrame.first_valid_index.html#pandas.DataFrame.first_valid_index "pandas.DataFrame.first_valid_index")() | Return index for first non-missing value or None, if no value is found. | + | [`floordiv`](pandas.DataFrame.floordiv.html#pandas.DataFrame.floordiv "pandas.DataFrame.floordiv")(other[, axis, level, fill\_value]) | Get Integer division of dataframe and other, element-wise (binary operator floordiv). | + | [`from_arrow`](pandas.DataFrame.from_arrow.html#pandas.DataFrame.from_arrow "pandas.DataFrame.from_arrow")(data) | Construct a DataFrame from a tabular Arrow object. | + | [`from_dict`](pandas.DataFrame.from_dict.html#pandas.DataFrame.from_dict "pandas.DataFrame.from_dict")(data[, orient, dtype, columns]) | Construct DataFrame from dict of array-like or dicts. | + | [`from_records`](pandas.DataFrame.from_records.html#pandas.DataFrame.from_records "pandas.DataFrame.from_records")(data[, index, exclude, ...]) | Convert structured or record ndarray to DataFrame. | + | [`ge`](pandas.DataFrame.ge.html#pandas.DataFrame.ge "pandas.DataFrame.ge")(other[, axis, level]) | Get Greater than or equal to of dataframe and other, element-wise (binary operator ge). | + | [`get`](pandas.DataFrame.get.html#pandas.DataFrame.get "pandas.DataFrame.get")(key[, default]) | Get item from object for given key (ex: DataFrame column). | + | [`groupby`](pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby")([by, level, as\_index, sort, ...]) | Group DataFrame using a mapper or by a Series of columns. | + | [`gt`](pandas.DataFrame.gt.html#pandas.DataFrame.gt "pandas.DataFrame.gt")(other[, axis, level]) | Get Greater than of dataframe and other, element-wise (binary operator gt). | + | [`head`](pandas.DataFrame.head.html#pandas.DataFrame.head "pandas.DataFrame.head")([n]) | Return the first n rows. | + | [`hist`](pandas.DataFrame.hist.html#pandas.DataFrame.hist "pandas.DataFrame.hist")([column, by, grid, xlabelsize, xrot, ...]) | Make a histogram of the DataFrame's columns. | + | [`idxmax`](pandas.DataFrame.idxmax.html#pandas.DataFrame.idxmax "pandas.DataFrame.idxmax")([axis, skipna, numeric\_only]) | Return index of first occurrence of maximum over requested axis. | + | [`idxmin`](pandas.DataFrame.idxmin.html#pandas.DataFrame.idxmin "pandas.DataFrame.idxmin")([axis, skipna, numeric\_only]) | Return index of first occurrence of minimum over requested axis. | + | [`infer_objects`](pandas.DataFrame.infer_objects.html#pandas.DataFrame.infer_objects "pandas.DataFrame.infer_objects")([copy]) | Attempt to infer better dtypes for object columns. | + | [`info`](pandas.DataFrame.info.html#pandas.DataFrame.info "pandas.DataFrame.info")([verbose, buf, max\_cols, memory\_usage, ...]) | Print a concise summary of a DataFrame. | + | [`insert`](pandas.DataFrame.insert.html#pandas.DataFrame.insert "pandas.DataFrame.insert")(loc, column, value[, allow\_duplicates]) | Insert column into DataFrame at specified location. | + | [`interpolate`](pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate "pandas.DataFrame.interpolate")([method, axis, limit, inplace, ...]) | Fill NaN values using an interpolation method. | + | [`isetitem`](pandas.DataFrame.isetitem.html#pandas.DataFrame.isetitem "pandas.DataFrame.isetitem")(loc, value) | Set the given value in the column with position loc. | + | [`isin`](pandas.DataFrame.isin.html#pandas.DataFrame.isin "pandas.DataFrame.isin")(values) | Whether each element in the DataFrame is contained in values. | + | [`isna`](pandas.DataFrame.isna.html#pandas.DataFrame.isna "pandas.DataFrame.isna")() | Detect missing values. | + | [`isnull`](pandas.DataFrame.isnull.html#pandas.DataFrame.isnull "pandas.DataFrame.isnull")() | DataFrame.isnull is an alias for DataFrame.isna. | + | [`items`](pandas.DataFrame.items.html#pandas.DataFrame.items "pandas.DataFrame.items")() | Iterate over (column name, Series) pairs. | + | [`iterrows`](pandas.DataFrame.iterrows.html#pandas.DataFrame.iterrows "pandas.DataFrame.iterrows")() | Iterate over DataFrame rows as (index, Series) pairs. | + | [`itertuples`](pandas.DataFrame.itertuples.html#pandas.DataFrame.itertuples "pandas.DataFrame.itertuples")([index, name]) | Iterate over DataFrame rows as namedtuples. | + | [`join`](pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join")(other[, on, how, lsuffix, rsuffix, ...]) | Join columns of another DataFrame. | + | [`keys`](pandas.DataFrame.keys.html#pandas.DataFrame.keys "pandas.DataFrame.keys")() | Get the 'info axis' (see Indexing for more). | + | [`kurt`](pandas.DataFrame.kurt.html#pandas.DataFrame.kurt "pandas.DataFrame.kurt")(\*[, axis, skipna, numeric\_only]) | Return unbiased kurtosis over requested axis. | + | [`kurtosis`](pandas.DataFrame.kurtosis.html#pandas.DataFrame.kurtosis "pandas.DataFrame.kurtosis")(\*[, axis, skipna, numeric\_only]) | Return unbiased kurtosis over requested axis. | + | [`last_valid_index`](pandas.DataFrame.last_valid_index.html#pandas.DataFrame.last_valid_index "pandas.DataFrame.last_valid_index")() | Return index for last non-missing value or None, if no value is found. | + | [`le`](pandas.DataFrame.le.html#pandas.DataFrame.le "pandas.DataFrame.le")(other[, axis, level]) | Get Greater than or equal to of dataframe and other, element-wise (binary operator le). | + | [`lt`](pandas.DataFrame.lt.html#pandas.DataFrame.lt "pandas.DataFrame.lt")(other[, axis, level]) | Get Greater than of dataframe and other, element-wise (binary operator lt). | + | [`map`](pandas.DataFrame.map.html#pandas.DataFrame.map "pandas.DataFrame.map")(func[, na\_action]) | Apply a function to a Dataframe elementwise. | + | [`mask`](pandas.DataFrame.mask.html#pandas.DataFrame.mask "pandas.DataFrame.mask")(cond[, other, inplace, axis, level]) | Replace values where the condition is True. | + | [`max`](pandas.DataFrame.max.html#pandas.DataFrame.max "pandas.DataFrame.max")(\*[, axis, skipna, numeric\_only]) | Return the maximum of the values over the requested axis. | + | [`mean`](pandas.DataFrame.mean.html#pandas.DataFrame.mean "pandas.DataFrame.mean")(\*[, axis, skipna, numeric\_only]) | Return the mean of the values over the requested axis. | + | [`median`](pandas.DataFrame.median.html#pandas.DataFrame.median "pandas.DataFrame.median")(\*[, axis, skipna, numeric\_only]) | Return the median of the values over the requested axis. | + | [`melt`](pandas.DataFrame.melt.html#pandas.DataFrame.melt "pandas.DataFrame.melt")([id\_vars, value\_vars, var\_name, ...]) | Unpivot DataFrame from wide to long format, optionally leaving identifiers set. | + | [`memory_usage`](pandas.DataFrame.memory_usage.html#pandas.DataFrame.memory_usage "pandas.DataFrame.memory_usage")([index, deep]) | Return the memory usage of each column in bytes. | + | [`merge`](pandas.DataFrame.merge.html#pandas.DataFrame.merge "pandas.DataFrame.merge")(right[, how, on, left\_on, right\_on, ...]) | Merge DataFrame or named Series objects with a database-style join. | + | [`min`](pandas.DataFrame.min.html#pandas.DataFrame.min "pandas.DataFrame.min")(\*[, axis, skipna, numeric\_only]) | Return the minimum of the values over the requested axis. | + | [`mod`](pandas.DataFrame.mod.html#pandas.DataFrame.mod "pandas.DataFrame.mod")(other[, axis, level, fill\_value]) | Get Modulo of dataframe and other, element-wise (binary operator mod). | + | [`mode`](pandas.DataFrame.mode.html#pandas.DataFrame.mode "pandas.DataFrame.mode")([axis, numeric\_only, dropna]) | Get the mode(s) of each element along the selected axis. | + | [`mul`](pandas.DataFrame.mul.html#pandas.DataFrame.mul "pandas.DataFrame.mul")(other[, axis, level, fill\_value]) | Get Multiplication of dataframe and other, element-wise (binary operator mul). | + | `multiply`(other[, axis, level, fill\_value]) | Get Multiplication of dataframe and other, element-wise (binary operator mul). | + | [`ne`](pandas.DataFrame.ne.html#pandas.DataFrame.ne "pandas.DataFrame.ne")(other[, axis, level]) | Get Not equal to of dataframe and other, element-wise (binary operator ne). | + | [`nlargest`](pandas.DataFrame.nlargest.html#pandas.DataFrame.nlargest "pandas.DataFrame.nlargest")(n, columns[, keep]) | Return the first n rows ordered by columns in descending order. | + | [`notna`](pandas.DataFrame.notna.html#pandas.DataFrame.notna "pandas.DataFrame.notna")() | Detect existing (non-missing) values. | + | [`notnull`](pandas.DataFrame.notnull.html#pandas.DataFrame.notnull "pandas.DataFrame.notnull")() | DataFrame.notnull is an alias for DataFrame.notna. | + | [`nsmallest`](pandas.DataFrame.nsmallest.html#pandas.DataFrame.nsmallest "pandas.DataFrame.nsmallest")(n, columns[, keep]) | Return the first n rows ordered by columns in ascending order. | + | [`nunique`](pandas.DataFrame.nunique.html#pandas.DataFrame.nunique "pandas.DataFrame.nunique")([axis, dropna]) | Count number of distinct elements in specified axis. | + | [`pct_change`](pandas.DataFrame.pct_change.html#pandas.DataFrame.pct_change "pandas.DataFrame.pct_change")([periods, fill\_method, freq]) | Fractional change between the current and a prior element. | + | [`pipe`](pandas.DataFrame.pipe.html#pandas.DataFrame.pipe "pandas.DataFrame.pipe")(func, \*args, \*\*kwargs) | Apply chainable functions that expect Series or DataFrames. | + | [`pivot`](pandas.DataFrame.pivot.html#pandas.DataFrame.pivot "pandas.DataFrame.pivot")(\*, columns[, index, values]) | Return reshaped DataFrame organized by given index / column values. | + | [`pivot_table`](pandas.DataFrame.pivot_table.html#pandas.DataFrame.pivot_table "pandas.DataFrame.pivot_table")([values, index, columns, ...]) | Create a spreadsheet-style pivot table as a DataFrame. | + | [`pop`](pandas.DataFrame.pop.html#pandas.DataFrame.pop "pandas.DataFrame.pop")(item) | Return item and drop it from DataFrame. | + | [`pow`](pandas.DataFrame.pow.html#pandas.DataFrame.pow "pandas.DataFrame.pow")(other[, axis, level, fill\_value]) | Get Exponential power of dataframe and other, element-wise (binary operator pow). | + | [`prod`](pandas.DataFrame.prod.html#pandas.DataFrame.prod "pandas.DataFrame.prod")(\*[, axis, skipna, numeric\_only, min\_count]) | Return the product of the values over the requested axis. | + | [`product`](pandas.DataFrame.product.html#pandas.DataFrame.product "pandas.DataFrame.product")(\*[, axis, skipna, numeric\_only, ...]) | Return the product of the values over the requested axis. | + | [`quantile`](pandas.DataFrame.quantile.html#pandas.DataFrame.quantile "pandas.DataFrame.quantile")([q, axis, numeric\_only, ...]) | Return values at the given quantile over requested axis. | + | [`query`](pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query")(expr, \*[, parser, engine, local\_dict, ...]) | Query the columns of a DataFrame with a boolean expression. | + | [`radd`](pandas.DataFrame.radd.html#pandas.DataFrame.radd "pandas.DataFrame.radd")(other[, axis, level, fill\_value]) | Get Addition of dataframe and other, element-wise (binary operator radd). | + | [`rank`](pandas.DataFrame.rank.html#pandas.DataFrame.rank "pandas.DataFrame.rank")([axis, method, numeric\_only, ...]) | Compute numerical data ranks (1 through n) along axis. | + | [`rdiv`](pandas.DataFrame.rdiv.html#pandas.DataFrame.rdiv "pandas.DataFrame.rdiv")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator rtruediv). | + | [`reindex`](pandas.DataFrame.reindex.html#pandas.DataFrame.reindex "pandas.DataFrame.reindex")([labels, index, columns, axis, ...]) | Conform DataFrame to new index with optional filling logic. | + | [`reindex_like`](pandas.DataFrame.reindex_like.html#pandas.DataFrame.reindex_like "pandas.DataFrame.reindex_like")(other[, method, copy, limit, ...]) | Return an object with matching indices as other object. | + | [`rename`](pandas.DataFrame.rename.html#pandas.DataFrame.rename "pandas.DataFrame.rename")([mapper, index, columns, axis, copy, ...]) | Rename columns or index labels. | + | [`rename_axis`](pandas.DataFrame.rename_axis.html#pandas.DataFrame.rename_axis "pandas.DataFrame.rename_axis")([mapper, index, columns, axis, ...]) | Set the name of the axis for the index or columns. | + | [`reorder_levels`](pandas.DataFrame.reorder_levels.html#pandas.DataFrame.reorder_levels "pandas.DataFrame.reorder_levels")(order[, axis]) | Rearrange index or column levels using input `order`. | + | [`replace`](pandas.DataFrame.replace.html#pandas.DataFrame.replace "pandas.DataFrame.replace")([to\_replace, value, inplace, regex]) | Replace values given in to\_replace with value. | + | [`resample`](pandas.DataFrame.resample.html#pandas.DataFrame.resample "pandas.DataFrame.resample")(rule[, closed, label, convention, ...]) | Resample time-series data. | + | [`reset_index`](pandas.DataFrame.reset_index.html#pandas.DataFrame.reset_index "pandas.DataFrame.reset_index")([level, drop, inplace, ...]) | Reset the index, or a level of it. | + | [`rfloordiv`](pandas.DataFrame.rfloordiv.html#pandas.DataFrame.rfloordiv "pandas.DataFrame.rfloordiv")(other[, axis, level, fill\_value]) | Get Integer division of dataframe and other, element-wise (binary operator rfloordiv). | + | [`rmod`](pandas.DataFrame.rmod.html#pandas.DataFrame.rmod "pandas.DataFrame.rmod")(other[, axis, level, fill\_value]) | Get Modulo of dataframe and other, element-wise (binary operator rmod). | + | [`rmul`](pandas.DataFrame.rmul.html#pandas.DataFrame.rmul "pandas.DataFrame.rmul")(other[, axis, level, fill\_value]) | Get Multiplication of dataframe and other, element-wise (binary operator rmul). | + | [`rolling`](pandas.DataFrame.rolling.html#pandas.DataFrame.rolling "pandas.DataFrame.rolling")(window[, min\_periods, center, ...]) | Provide rolling window calculations. | + | [`round`](pandas.DataFrame.round.html#pandas.DataFrame.round "pandas.DataFrame.round")([decimals]) | Round numeric columns in a DataFrame to a variable number of decimal places. | + | [`rpow`](pandas.DataFrame.rpow.html#pandas.DataFrame.rpow "pandas.DataFrame.rpow")(other[, axis, level, fill\_value]) | Get Exponential power of dataframe and other, element-wise (binary operator rpow). | + | [`rsub`](pandas.DataFrame.rsub.html#pandas.DataFrame.rsub "pandas.DataFrame.rsub")(other[, axis, level, fill\_value]) | Get Subtraction of dataframe and other, element-wise (binary operator rsub). | + | [`rtruediv`](pandas.DataFrame.rtruediv.html#pandas.DataFrame.rtruediv "pandas.DataFrame.rtruediv")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator rtruediv). | + | [`sample`](pandas.DataFrame.sample.html#pandas.DataFrame.sample "pandas.DataFrame.sample")([n, frac, replace, weights, ...]) | Return a random sample of items from an axis of object. | + | [`select_dtypes`](pandas.DataFrame.select_dtypes.html#pandas.DataFrame.select_dtypes "pandas.DataFrame.select_dtypes")([include, exclude]) | Return a subset of the DataFrame's columns based on the column dtypes. | + | [`sem`](pandas.DataFrame.sem.html#pandas.DataFrame.sem "pandas.DataFrame.sem")(\*[, axis, skipna, ddof, numeric\_only]) | Return unbiased standard error of the mean over requested axis. | + | [`set_axis`](pandas.DataFrame.set_axis.html#pandas.DataFrame.set_axis "pandas.DataFrame.set_axis")(labels, \*[, axis, copy]) | Assign desired index to given axis. | + | [`set_flags`](pandas.DataFrame.set_flags.html#pandas.DataFrame.set_flags "pandas.DataFrame.set_flags")(\*[, copy, allows\_duplicate\_labels]) | Return a new object with updated flags. | + | [`set_index`](pandas.DataFrame.set_index.html#pandas.DataFrame.set_index "pandas.DataFrame.set_index")(keys, \*[, drop, append, inplace, ...]) | Set the DataFrame index using existing columns. | + | [`shift`](pandas.DataFrame.shift.html#pandas.DataFrame.shift "pandas.DataFrame.shift")([periods, freq, axis, fill\_value, suffix]) | Shift index by desired number of periods with an optional time freq. | + | [`skew`](pandas.DataFrame.skew.html#pandas.DataFrame.skew "pandas.DataFrame.skew")(\*[, axis, skipna, numeric\_only]) | Return unbiased skew over requested axis. | + | [`sort_index`](pandas.DataFrame.sort_index.html#pandas.DataFrame.sort_index "pandas.DataFrame.sort_index")(\*[, axis, level, ascending, ...]) | Sort object by labels (along an axis). | + | [`sort_values`](pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values "pandas.DataFrame.sort_values")(by, \*[, axis, ascending, ...]) | Sort by the values along either axis. | + | [`squeeze`](pandas.DataFrame.squeeze.html#pandas.DataFrame.squeeze "pandas.DataFrame.squeeze")([axis]) | Squeeze 1 dimensional axis objects into scalars. | + | [`stack`](pandas.DataFrame.stack.html#pandas.DataFrame.stack "pandas.DataFrame.stack")([level, dropna, sort, future\_stack]) | Stack the prescribed level(s) from columns to index. | + | [`std`](pandas.DataFrame.std.html#pandas.DataFrame.std "pandas.DataFrame.std")(\*[, axis, skipna, ddof, numeric\_only]) | Return sample standard deviation over requested axis. | + | [`sub`](pandas.DataFrame.sub.html#pandas.DataFrame.sub "pandas.DataFrame.sub")(other[, axis, level, fill\_value]) | Get Subtraction of dataframe and other, element-wise (binary operator sub). | + | `subtract`(other[, axis, level, fill\_value]) | Get Subtraction of dataframe and other, element-wise (binary operator sub). | + | [`sum`](pandas.DataFrame.sum.html#pandas.DataFrame.sum "pandas.DataFrame.sum")(\*[, axis, skipna, numeric\_only, min\_count]) | Return the sum of the values over the requested axis. | + | [`swaplevel`](pandas.DataFrame.swaplevel.html#pandas.DataFrame.swaplevel "pandas.DataFrame.swaplevel")([i, j, axis]) | Swap levels i and j in a [`MultiIndex`](pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex"). | + | [`tail`](pandas.DataFrame.tail.html#pandas.DataFrame.tail "pandas.DataFrame.tail")([n]) | Return the last n rows. | + | [`take`](pandas.DataFrame.take.html#pandas.DataFrame.take "pandas.DataFrame.take")(indices[, axis]) | Return the elements in the given *positional* indices along an axis. | + | [`to_clipboard`](pandas.DataFrame.to_clipboard.html#pandas.DataFrame.to_clipboard "pandas.DataFrame.to_clipboard")(\*[, excel, sep]) | Copy object to the system clipboard. | + | [`to_csv`](pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv")([path\_or\_buf, sep, na\_rep, ...]) | Write object to a comma-separated values (csv) file. | + | [`to_dict`](pandas.DataFrame.to_dict.html#pandas.DataFrame.to_dict "pandas.DataFrame.to_dict")([orient, into, index]) | Convert the DataFrame to a dictionary. | + | [`to_excel`](pandas.DataFrame.to_excel.html#pandas.DataFrame.to_excel "pandas.DataFrame.to_excel")(excel\_writer, \*[, sheet\_name, ...]) | Write object to an Excel sheet. | + | [`to_feather`](pandas.DataFrame.to_feather.html#pandas.DataFrame.to_feather "pandas.DataFrame.to_feather")(path, \*\*kwargs) | Write a DataFrame to the binary Feather format. | + | [`to_hdf`](pandas.DataFrame.to_hdf.html#pandas.DataFrame.to_hdf "pandas.DataFrame.to_hdf")(path\_or\_buf, \*, key[, mode, ...]) | Write the contained data to an HDF5 file using HDFStore. | + | [`to_html`](pandas.DataFrame.to_html.html#pandas.DataFrame.to_html "pandas.DataFrame.to_html")([buf, columns, col\_space, header, ...]) | Render a DataFrame as an HTML table. | + | [`to_iceberg`](pandas.DataFrame.to_iceberg.html#pandas.DataFrame.to_iceberg "pandas.DataFrame.to_iceberg")(table\_identifier[, catalog\_name, ...]) | Write a DataFrame to an Apache Iceberg table. | + | [`to_json`](pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json")([path\_or\_buf, orient, date\_format, ...]) | Convert the object to a JSON string. | + | [`to_latex`](pandas.DataFrame.to_latex.html#pandas.DataFrame.to_latex "pandas.DataFrame.to_latex")([buf, columns, header, index, ...]) | Render object to a LaTeX tabular, longtable, or nested table. | + | [`to_markdown`](pandas.DataFrame.to_markdown.html#pandas.DataFrame.to_markdown "pandas.DataFrame.to_markdown")([buf, mode, index, storage\_options]) | Print DataFrame in Markdown-friendly format. | + | [`to_numpy`](pandas.DataFrame.to_numpy.html#pandas.DataFrame.to_numpy "pandas.DataFrame.to_numpy")([dtype, copy, na\_value]) | Convert the DataFrame to a NumPy array. | + | [`to_orc`](pandas.DataFrame.to_orc.html#pandas.DataFrame.to_orc "pandas.DataFrame.to_orc")([path, engine, index, engine\_kwargs]) | Write a DataFrame to the Optimized Row Columnar (ORC) format. | + | [`to_parquet`](pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet "pandas.DataFrame.to_parquet")([path, engine, compression, ...]) | Write a DataFrame to the binary parquet format. | + | [`to_period`](pandas.DataFrame.to_period.html#pandas.DataFrame.to_period "pandas.DataFrame.to_period")([freq, axis, copy]) | Convert DataFrame from DatetimeIndex to PeriodIndex. | + | [`to_pickle`](pandas.DataFrame.to_pickle.html#pandas.DataFrame.to_pickle "pandas.DataFrame.to_pickle")(path, \*[, compression, protocol, ...]) | Pickle (serialize) object to file. | + | [`to_records`](pandas.DataFrame.to_records.html#pandas.DataFrame.to_records "pandas.DataFrame.to_records")([index, column\_dtypes, index\_dtypes]) | Convert DataFrame to a NumPy record array. | + | [`to_sql`](pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql")(name, con, \*[, schema, if\_exists, ...]) | Write records stored in a DataFrame to a SQL database. | + | [`to_stata`](pandas.DataFrame.to_stata.html#pandas.DataFrame.to_stata "pandas.DataFrame.to_stata")(path, \*[, convert\_dates, ...]) | Export DataFrame object to Stata dta format. | + | [`to_string`](pandas.DataFrame.to_string.html#pandas.DataFrame.to_string "pandas.DataFrame.to_string")([buf, columns, col\_space, header, ...]) | Render a DataFrame to a console-friendly tabular output. | + | [`to_timestamp`](pandas.DataFrame.to_timestamp.html#pandas.DataFrame.to_timestamp "pandas.DataFrame.to_timestamp")([freq, how, axis, copy]) | Cast PeriodIndex to DatetimeIndex of timestamps, at *beginning* of period. | + | [`to_xarray`](pandas.DataFrame.to_xarray.html#pandas.DataFrame.to_xarray "pandas.DataFrame.to_xarray")() | Return an xarray object from the pandas object. | + | [`to_xml`](pandas.DataFrame.to_xml.html#pandas.DataFrame.to_xml "pandas.DataFrame.to_xml")([path\_or\_buffer, index, root\_name, ...]) | Render a DataFrame to an XML document. | + | [`transform`](pandas.DataFrame.transform.html#pandas.DataFrame.transform "pandas.DataFrame.transform")(func[, axis]) | Call `func` on self producing a DataFrame with the same axis shape as self. | + | [`transpose`](pandas.DataFrame.transpose.html#pandas.DataFrame.transpose "pandas.DataFrame.transpose")(\*args[, copy]) | Transpose index and columns. | + | [`truediv`](pandas.DataFrame.truediv.html#pandas.DataFrame.truediv "pandas.DataFrame.truediv")(other[, axis, level, fill\_value]) | Get Floating division of dataframe and other, element-wise (binary operator truediv). | + | [`truncate`](pandas.DataFrame.truncate.html#pandas.DataFrame.truncate "pandas.DataFrame.truncate")([before, after, axis, copy]) | Truncate a Series or DataFrame before and after some index value. | + | [`tz_convert`](pandas.DataFrame.tz_convert.html#pandas.DataFrame.tz_convert "pandas.DataFrame.tz_convert")(tz[, axis, level, copy]) | Convert tz-aware axis to target time zone. | + | [`tz_localize`](pandas.DataFrame.tz_localize.html#pandas.DataFrame.tz_localize "pandas.DataFrame.tz_localize")(tz[, axis, level, copy, ...]) | Localize time zone naive index of a Series or DataFrame to target time zone. | + | [`unstack`](pandas.DataFrame.unstack.html#pandas.DataFrame.unstack "pandas.DataFrame.unstack")([level, fill\_value, sort]) | Pivot a level of the (necessarily hierarchical) index labels. | + | [`update`](pandas.DataFrame.update.html#pandas.DataFrame.update "pandas.DataFrame.update")(other[, join, overwrite, ...]) | Modify in place using non-NA values from another DataFrame. | + | [`value_counts`](pandas.DataFrame.value_counts.html#pandas.DataFrame.value_counts "pandas.DataFrame.value_counts")([subset, normalize, sort, ...]) | Return a Series containing the frequency of each distinct row in the DataFrame. | + | [`var`](pandas.DataFrame.var.html#pandas.DataFrame.var "pandas.DataFrame.var")(\*[, axis, skipna, ddof, numeric\_only]) | Return unbiased variance over requested axis. | + | [`where`](pandas.DataFrame.where.html#pandas.DataFrame.where "pandas.DataFrame.where")(cond[, other, inplace, axis, level]) | Replace values where the condition is False. | + | [`xs`](pandas.DataFrame.xs.html#pandas.DataFrame.xs "pandas.DataFrame.xs")(key[, axis, level, drop\_level]) | Return cross-section from the Series/DataFrame. | diff --git a/corpus/docs/pandas/eval/eval_15.md b/corpus/docs/pandas/eval/eval_15.md new file mode 100644 index 0000000000000000000000000000000000000000..c881a3bf6b839d1002b561c41544fd0fd0470144 --- /dev/null +++ b/corpus/docs/pandas/eval/eval_15.md @@ -0,0 +1,134 @@ +# pandas.eval# + +Source: https://pandas.pydata.org/pandas-docs/version/1.5/reference/api/pandas.eval.html +Version: 1.5 + +pandas.eval(*expr*, *parser='pandas'*, *engine=None*, *truediv=\_NoDefault.no\_default*, *local\_dict=None*, *global\_dict=None*, *resolvers=()*, *level=0*, *target=None*, *inplace=False*)[[source]](https://github.com/pandas-dev/pandas/blob/v1.5.2/pandas/core/computation/eval.py#L170-L414)[#](#pandas.eval "Permalink to this definition") +: Evaluate a Python expression as a string using various backends. + + The following arithmetic operations are supported: `+`, `-`, `*`, + `/`, `**`, `%`, `//` (python engine only) along with the following + boolean operations: `|` (or), `&` (and), and `~` (not). + Additionally, the `'pandas'` parser allows the use of [`and`](https://docs.python.org/3/reference/expressions.html#and "(in Python v3.11)"), + [`or`](https://docs.python.org/3/reference/expressions.html#or "(in Python v3.11)"), and [`not`](https://docs.python.org/3/reference/expressions.html#not "(in Python v3.11)") with the same semantics as the + corresponding bitwise operators. [`Series`](pandas.Series.html#pandas.Series "pandas.Series") and + [`DataFrame`](pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") objects are supported and behave as they would + with plain ol’ Python evaluation. + + Parameters + : **expr**str + : The expression to evaluate. This string cannot contain any Python + [statements](https://docs.python.org/3/reference/simple_stmts.html#simple-statements), + only Python [expressions](https://docs.python.org/3/reference/simple_stmts.html#expression-statements). + + **parser**{‘pandas’, ‘python’}, default ‘pandas’ + : The parser to use to construct the syntax tree from the expression. The + default of `'pandas'` parses code slightly different than standard + Python. Alternatively, you can parse an expression using the + `'python'` parser to retain strict Python semantics. See the + [enhancing performance](../../user_guide/enhancingperf.html#enhancingperf-eval) documentation for + more details. + + **engine**{‘python’, ‘numexpr’}, default ‘numexpr’ + : The engine used to evaluate the expression. Supported engines are + + * None : tries to use `numexpr`, falls back to `python` + * `'numexpr'` : This default engine evaluates pandas objects using + numexpr for large speed ups in complex expressions with large frames. + * `'python'` : Performs operations as if you had `eval`’d in top + level python. This engine is generally not that useful. + + More backends may be available in the future. + + **truediv**bool, optional + : Whether to use true division, like in Python >= 3. + + Deprecated since version 1.0.0. + + **local\_dict**dict or None, optional + : A dictionary of local variables, taken from locals() by default. + + **global\_dict**dict or None, optional + : A dictionary of global variables, taken from globals() by default. + + **resolvers**list of dict-like or None, optional + : A list of objects implementing the `__getitem__` special method that + you can use to inject an additional collection of namespaces to use for + variable lookup. For example, this is used in the + [`query()`](pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") method to inject the + `DataFrame.index` and `DataFrame.columns` + variables that refer to their respective [`DataFrame`](pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") + instance attributes. + + **level**int, optional + : The number of prior stack frames to traverse and add to the current + scope. Most users will **not** need to change this parameter. + + **target**object, optional, default None + : This is the target object for assignment. It is used when there is + variable assignment in the expression. If so, then target must + support item assignment with string keys, and if a copy is being + returned, it must also support .copy(). + + **inplace**bool, default False + : If target is provided, and the expression mutates target, whether + to modify target inplace. Otherwise, return a copy of target with + the mutation. + + Returns + : ndarray, numeric scalar, DataFrame, Series, or None + : The completion value of evaluating the given code or None if `inplace=True`. + + Raises + : ValueError + : There are many instances where such an error can be raised: + + * target=None, but the expression is multiline. + * The expression is multiline, but not all them have item assignment. + An example of such an arrangement is this: + + a = b + 1 + a + 2 + + Here, there are expressions on different lines, making it multiline, + but the last line has no variable assigned to the output of a + 2. + * inplace=True, but the expression is missing item assignment. + * Item assignment is provided, but the target does not support + string item assignment. + * Item assignment is provided and inplace=False, but the target + does not support the .copy() method + + See also + + [`DataFrame.query`](pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") + : Evaluates a boolean expression to query the columns of a frame. + + [`DataFrame.eval`](pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval") + : Evaluate a string describing operations on DataFrame columns. + + Notes + + The `dtype` of any objects involved in an arithmetic `%` operation are + recursively cast to `float64`. + + See the [enhancing performance](../../user_guide/enhancingperf.html#enhancingperf-eval) documentation for + more details. + + Examples + + ```None + >>> df = pd.DataFrame({"animal": ["dog", "pig"], "age": [10, 20]}) + >>> df + animal age + 0 dog 10 + 1 pig 20 + ``` + + We can add a new column using `pd.eval`: + + ```None + >>> pd.eval("double_age = df.age * 2", target=df) + animal age double_age + 0 dog 10 20 + 1 pig 20 40 + ``` diff --git a/corpus/docs/pandas/eval/eval_20.md b/corpus/docs/pandas/eval/eval_20.md new file mode 100644 index 0000000000000000000000000000000000000000..6660da68d762254aae2e3f980d6d3ffe19976a60 --- /dev/null +++ b/corpus/docs/pandas/eval/eval_20.md @@ -0,0 +1,129 @@ +# pandas.eval# + +Source: https://pandas.pydata.org/pandas-docs/version/2.0/reference/api/pandas.eval.html +Version: 2.0 + +pandas.eval(*expr*, *parser='pandas'*, *engine=None*, *local\_dict=None*, *global\_dict=None*, *resolvers=()*, *level=0*, *target=None*, *inplace=False*)[[source]](https://github.com/pandas-dev/pandas/blob/v2.0.3/pandas/core/computation/eval.py#L170-L413)[#](#pandas.eval "Permalink to this definition") +: Evaluate a Python expression as a string using various backends. + + The following arithmetic operations are supported: `+`, `-`, `*`, + `/`, `**`, `%`, `//` (python engine only) along with the following + boolean operations: `|` (or), `&` (and), and `~` (not). + Additionally, the `'pandas'` parser allows the use of [`and`](https://docs.python.org/3/reference/expressions.html#and "(in Python v3.11)"), + [`or`](https://docs.python.org/3/reference/expressions.html#or "(in Python v3.11)"), and [`not`](https://docs.python.org/3/reference/expressions.html#not "(in Python v3.11)") with the same semantics as the + corresponding bitwise operators. [`Series`](pandas.Series.html#pandas.Series "pandas.Series") and + [`DataFrame`](pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") objects are supported and behave as they would + with plain ol’ Python evaluation. + + Parameters + : **expr**str + : The expression to evaluate. This string cannot contain any Python + [statements](https://docs.python.org/3/reference/simple_stmts.html#simple-statements), + only Python [expressions](https://docs.python.org/3/reference/simple_stmts.html#expression-statements). + + **parser**{‘pandas’, ‘python’}, default ‘pandas’ + : The parser to use to construct the syntax tree from the expression. The + default of `'pandas'` parses code slightly different than standard + Python. Alternatively, you can parse an expression using the + `'python'` parser to retain strict Python semantics. See the + [enhancing performance](../../user_guide/enhancingperf.html#enhancingperf-eval) documentation for + more details. + + **engine**{‘python’, ‘numexpr’}, default ‘numexpr’ + : The engine used to evaluate the expression. Supported engines are + + * None : tries to use `numexpr`, falls back to `python` + * `'numexpr'` : This default engine evaluates pandas objects using + numexpr for large speed ups in complex expressions with large frames. + * `'python'` : Performs operations as if you had `eval`’d in top + level python. This engine is generally not that useful. + + More backends may be available in the future. + + **local\_dict**dict or None, optional + : A dictionary of local variables, taken from locals() by default. + + **global\_dict**dict or None, optional + : A dictionary of global variables, taken from globals() by default. + + **resolvers**list of dict-like or None, optional + : A list of objects implementing the `__getitem__` special method that + you can use to inject an additional collection of namespaces to use for + variable lookup. For example, this is used in the + [`query()`](pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") method to inject the + `DataFrame.index` and `DataFrame.columns` + variables that refer to their respective [`DataFrame`](pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") + instance attributes. + + **level**int, optional + : The number of prior stack frames to traverse and add to the current + scope. Most users will **not** need to change this parameter. + + **target**object, optional, default None + : This is the target object for assignment. It is used when there is + variable assignment in the expression. If so, then target must + support item assignment with string keys, and if a copy is being + returned, it must also support .copy(). + + **inplace**bool, default False + : If target is provided, and the expression mutates target, whether + to modify target inplace. Otherwise, return a copy of target with + the mutation. + + Returns + : ndarray, numeric scalar, DataFrame, Series, or None + : The completion value of evaluating the given code or None if `inplace=True`. + + Raises + : ValueError + : There are many instances where such an error can be raised: + + * target=None, but the expression is multiline. + * The expression is multiline, but not all them have item assignment. + An example of such an arrangement is this: + + a = b + 1 + a + 2 + + Here, there are expressions on different lines, making it multiline, + but the last line has no variable assigned to the output of a + 2. + * inplace=True, but the expression is missing item assignment. + * Item assignment is provided, but the target does not support + string item assignment. + * Item assignment is provided and inplace=False, but the target + does not support the .copy() method + + See also + + [`DataFrame.query`](pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") + : Evaluates a boolean expression to query the columns of a frame. + + [`DataFrame.eval`](pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval") + : Evaluate a string describing operations on DataFrame columns. + + Notes + + The `dtype` of any objects involved in an arithmetic `%` operation are + recursively cast to `float64`. + + See the [enhancing performance](../../user_guide/enhancingperf.html#enhancingperf-eval) documentation for + more details. + + Examples + + ```None + >>> df = pd.DataFrame({"animal": ["dog", "pig"], "age": [10, 20]}) + >>> df + animal age + 0 dog 10 + 1 pig 20 + ``` + + We can add a new column using `pd.eval`: + + ```None + >>> pd.eval("double_age = df.age * 2", target=df) + animal age double_age + 0 dog 10 20 + 1 pig 20 40 + ``` diff --git a/corpus/docs/pandas/eval/eval_21.md b/corpus/docs/pandas/eval/eval_21.md new file mode 100644 index 0000000000000000000000000000000000000000..87891b6da5393c82806c9694f27e6020cee8a0fd --- /dev/null +++ b/corpus/docs/pandas/eval/eval_21.md @@ -0,0 +1,129 @@ +# pandas.eval# + +Source: https://pandas.pydata.org/pandas-docs/version/2.1/reference/api/pandas.eval.html +Version: 2.1 + +pandas.eval(*expr*, *parser='pandas'*, *engine=None*, *local\_dict=None*, *global\_dict=None*, *resolvers=()*, *level=0*, *target=None*, *inplace=False*)[[source]](https://github.com/pandas-dev/pandas/blob/v2.1.4/pandas/core/computation/eval.py#L170-L419)[#](#pandas.eval "Permalink to this definition") +: Evaluate a Python expression as a string using various backends. + + The following arithmetic operations are supported: `+`, `-`, `*`, + `/`, `**`, `%`, `//` (python engine only) along with the following + boolean operations: `|` (or), `&` (and), and `~` (not). + Additionally, the `'pandas'` parser allows the use of [`and`](https://docs.python.org/3/reference/expressions.html#and "(in Python v3.12)"), + [`or`](https://docs.python.org/3/reference/expressions.html#or "(in Python v3.12)"), and [`not`](https://docs.python.org/3/reference/expressions.html#not "(in Python v3.12)") with the same semantics as the + corresponding bitwise operators. [`Series`](pandas.Series.html#pandas.Series "pandas.Series") and + [`DataFrame`](pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") objects are supported and behave as they would + with plain ol’ Python evaluation. + + Parameters: + : **expr**str + : The expression to evaluate. This string cannot contain any Python + [statements](https://docs.python.org/3/reference/simple_stmts.html#simple-statements), + only Python [expressions](https://docs.python.org/3/reference/simple_stmts.html#expression-statements). + + **parser**{‘pandas’, ‘python’}, default ‘pandas’ + : The parser to use to construct the syntax tree from the expression. The + default of `'pandas'` parses code slightly different than standard + Python. Alternatively, you can parse an expression using the + `'python'` parser to retain strict Python semantics. See the + [enhancing performance](../../user_guide/enhancingperf.html#enhancingperf-eval) documentation for + more details. + + **engine**{‘python’, ‘numexpr’}, default ‘numexpr’ + : The engine used to evaluate the expression. Supported engines are + + * None : tries to use `numexpr`, falls back to `python` + * `'numexpr'` : This default engine evaluates pandas objects using + numexpr for large speed ups in complex expressions with large frames. + * `'python'` : Performs operations as if you had `eval`’d in top + level python. This engine is generally not that useful. + + More backends may be available in the future. + + **local\_dict**dict or None, optional + : A dictionary of local variables, taken from locals() by default. + + **global\_dict**dict or None, optional + : A dictionary of global variables, taken from globals() by default. + + **resolvers**list of dict-like or None, optional + : A list of objects implementing the `__getitem__` special method that + you can use to inject an additional collection of namespaces to use for + variable lookup. For example, this is used in the + [`query()`](pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") method to inject the + `DataFrame.index` and `DataFrame.columns` + variables that refer to their respective [`DataFrame`](pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") + instance attributes. + + **level**int, optional + : The number of prior stack frames to traverse and add to the current + scope. Most users will **not** need to change this parameter. + + **target**object, optional, default None + : This is the target object for assignment. It is used when there is + variable assignment in the expression. If so, then target must + support item assignment with string keys, and if a copy is being + returned, it must also support .copy(). + + **inplace**bool, default False + : If target is provided, and the expression mutates target, whether + to modify target inplace. Otherwise, return a copy of target with + the mutation. + + Returns: + : ndarray, numeric scalar, DataFrame, Series, or None + : The completion value of evaluating the given code or None if `inplace=True`. + + Raises: + : ValueError + : There are many instances where such an error can be raised: + + * target=None, but the expression is multiline. + * The expression is multiline, but not all them have item assignment. + An example of such an arrangement is this: + + a = b + 1 + a + 2 + + Here, there are expressions on different lines, making it multiline, + but the last line has no variable assigned to the output of a + 2. + * inplace=True, but the expression is missing item assignment. + * Item assignment is provided, but the target does not support + string item assignment. + * Item assignment is provided and inplace=False, but the target + does not support the .copy() method + + See also + + [`DataFrame.query`](pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") + : Evaluates a boolean expression to query the columns of a frame. + + [`DataFrame.eval`](pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval") + : Evaluate a string describing operations on DataFrame columns. + + Notes + + The `dtype` of any objects involved in an arithmetic `%` operation are + recursively cast to `float64`. + + See the [enhancing performance](../../user_guide/enhancingperf.html#enhancingperf-eval) documentation for + more details. + + Examples + + ```None + >>> df = pd.DataFrame({"animal": ["dog", "pig"], "age": [10, 20]}) + >>> df + animal age + 0 dog 10 + 1 pig 20 + ``` + + We can add a new column using `pd.eval`: + + ```None + >>> pd.eval("double_age = df.age * 2", target=df) + animal age double_age + 0 dog 10 20 + 1 pig 20 40 + ``` diff --git a/corpus/docs/pandas/eval/eval_22.md b/corpus/docs/pandas/eval/eval_22.md new file mode 100644 index 0000000000000000000000000000000000000000..6d11698097c7b1510d7eb500e5d34e4c4389a6df --- /dev/null +++ b/corpus/docs/pandas/eval/eval_22.md @@ -0,0 +1,129 @@ +# pandas.eval# + +Source: https://pandas.pydata.org/pandas-docs/version/2.2/reference/api/pandas.eval.html +Version: 2.2 + +pandas.eval(*expr*, *parser='pandas'*, *engine=None*, *local\_dict=None*, *global\_dict=None*, *resolvers=()*, *level=0*, *target=None*, *inplace=False*)[[source]](https://github.com/pandas-dev/pandas/blob/v2.2.3/pandas/core/computation/eval.py#L170-L415)[#](#pandas.eval "Link to this definition") +: Evaluate a Python expression as a string using various backends. + + The following arithmetic operations are supported: `+`, `-`, `*`, + `/`, `**`, `%`, `//` (python engine only) along with the following + boolean operations: `|` (or), `&` (and), and `~` (not). + Additionally, the `'pandas'` parser allows the use of [`and`](https://docs.python.org/3/reference/expressions.html#and "(in Python v3.12)"), + [`or`](https://docs.python.org/3/reference/expressions.html#or "(in Python v3.12)"), and [`not`](https://docs.python.org/3/reference/expressions.html#not "(in Python v3.12)") with the same semantics as the + corresponding bitwise operators. [`Series`](pandas.Series.html#pandas.Series "pandas.Series") and + [`DataFrame`](pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") objects are supported and behave as they would + with plain ol’ Python evaluation. + + Parameters: + : **expr**str + : The expression to evaluate. This string cannot contain any Python + [statements](https://docs.python.org/3/reference/simple_stmts.html#simple-statements), + only Python [expressions](https://docs.python.org/3/reference/simple_stmts.html#expression-statements). + + **parser**{‘pandas’, ‘python’}, default ‘pandas’ + : The parser to use to construct the syntax tree from the expression. The + default of `'pandas'` parses code slightly different than standard + Python. Alternatively, you can parse an expression using the + `'python'` parser to retain strict Python semantics. See the + [enhancing performance](../../user_guide/enhancingperf.html#enhancingperf-eval) documentation for + more details. + + **engine**{‘python’, ‘numexpr’}, default ‘numexpr’ + : The engine used to evaluate the expression. Supported engines are + + * None : tries to use `numexpr`, falls back to `python` + * `'numexpr'` : This default engine evaluates pandas objects using + numexpr for large speed ups in complex expressions with large frames. + * `'python'` : Performs operations as if you had `eval`’d in top + level python. This engine is generally not that useful. + + More backends may be available in the future. + + **local\_dict**dict or None, optional + : A dictionary of local variables, taken from locals() by default. + + **global\_dict**dict or None, optional + : A dictionary of global variables, taken from globals() by default. + + **resolvers**list of dict-like or None, optional + : A list of objects implementing the `__getitem__` special method that + you can use to inject an additional collection of namespaces to use for + variable lookup. For example, this is used in the + [`query()`](pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") method to inject the + `DataFrame.index` and `DataFrame.columns` + variables that refer to their respective [`DataFrame`](pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") + instance attributes. + + **level**int, optional + : The number of prior stack frames to traverse and add to the current + scope. Most users will **not** need to change this parameter. + + **target**object, optional, default None + : This is the target object for assignment. It is used when there is + variable assignment in the expression. If so, then target must + support item assignment with string keys, and if a copy is being + returned, it must also support .copy(). + + **inplace**bool, default False + : If target is provided, and the expression mutates target, whether + to modify target inplace. Otherwise, return a copy of target with + the mutation. + + Returns: + : ndarray, numeric scalar, DataFrame, Series, or None + : The completion value of evaluating the given code or None if `inplace=True`. + + Raises: + : ValueError + : There are many instances where such an error can be raised: + + * target=None, but the expression is multiline. + * The expression is multiline, but not all them have item assignment. + An example of such an arrangement is this: + + a = b + 1 + a + 2 + + Here, there are expressions on different lines, making it multiline, + but the last line has no variable assigned to the output of a + 2. + * inplace=True, but the expression is missing item assignment. + * Item assignment is provided, but the target does not support + string item assignment. + * Item assignment is provided and inplace=False, but the target + does not support the .copy() method + + See also + + [`DataFrame.query`](pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") + : Evaluates a boolean expression to query the columns of a frame. + + [`DataFrame.eval`](pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval") + : Evaluate a string describing operations on DataFrame columns. + + Notes + + The `dtype` of any objects involved in an arithmetic `%` operation are + recursively cast to `float64`. + + See the [enhancing performance](../../user_guide/enhancingperf.html#enhancingperf-eval) documentation for + more details. + + Examples + + ```None + >>> df = pd.DataFrame({"animal": ["dog", "pig"], "age": [10, 20]}) + >>> df + animal age + 0 dog 10 + 1 pig 20 + ``` + + We can add a new column using `pd.eval`: + + ```None + >>> pd.eval("double_age = df.age * 2", target=df) + animal age double_age + 0 dog 10 20 + 1 pig 20 40 + ``` diff --git a/corpus/docs/pandas/eval/eval_30.md b/corpus/docs/pandas/eval/eval_30.md new file mode 100644 index 0000000000000000000000000000000000000000..a6a73da1e335016fcb9df0161d0ee19c4beb83d8 --- /dev/null +++ b/corpus/docs/pandas/eval/eval_30.md @@ -0,0 +1,151 @@ +# pandas.eval# + +Source: https://pandas.pydata.org/pandas-docs/version/3.0/reference/api/pandas.eval.html +Version: 3.0 + +pandas.eval(*expr*, *parser='pandas'*, *engine=None*, *local\_dict=None*, *global\_dict=None*, *resolvers=()*, *level=0*, *target=None*, *inplace=False*)[[source]](https://github.com/pandas-dev/pandas/blob/v3.0.0/pandas/core/computation/eval.py#L178-L454)[#](#pandas.eval "Link to this definition") +: Evaluate a Python expression as a string using various backends. + + Warning + + This function can run arbitrary code which can make you vulnerable to code + injection if you pass user input to this function. + + Parameters: + : **expr**str + : The expression to evaluate. This string cannot contain any Python + [statements](https://docs.python.org/3/reference/simple_stmts.html#simple-statements), + only Python [expressions](https://docs.python.org/3/reference/simple_stmts.html#expression-statements). + + By default, with the numexpr engine, the following operations are supported: + + * Arithmetic operations: `+`, `-`, `*`, `/`, `**`, `%` + * Boolean operations: `|` (or), `&` (and), and `~` (not) + * Comparison operators: `<`, `<=`, `==`, `!=`, `>=`, `>` + + Furthermore, the following mathematical functions are supported: + + * Trigonometric: `sin`, `cos`, `tan`, `arcsin`, `arccos`, `arctan`, `arctan2`, `sinh`, `cosh`, `tanh`, `arcsinh`, `arccosh` and `arctanh` + * Logarithms: `log` natural, `log10` base 10, `log1p` log(1+x) + * Absolute Value `abs` + * Square root `sqrt` + * Exponential `exp` and Exponential minus one `expm1` + + See the numexpr engine [documentation](https://numexpr.readthedocs.io/en/latest/user_guide.html#supported-functions) + for further function support details. + + Using the `'python'` engine allows the use of native Python operators + such as floor division `//`, in addition to built-in and user-defined + Python functions. + + Additionally, the `'pandas'` parser allows the use of [`and`](https://docs.python.org/3/reference/expressions.html#and "(in Python v3.14)"), + [`or`](https://docs.python.org/3/reference/expressions.html#or "(in Python v3.14)"), and [`not`](https://docs.python.org/3/reference/expressions.html#not "(in Python v3.14)") with the same semantics as the + corresponding bitwise operators. + + **parser**{‘pandas’, ‘python’}, default ‘pandas’ + : The parser to use to construct the syntax tree from the expression. The + default of `'pandas'` parses code slightly different than standard + Python. Alternatively, you can parse an expression using the + `'python'` parser to retain strict Python semantics. See the + [enhancing performance](../../user_guide/enhancingperf.html#enhancingperf-eval) documentation for + more details. + + **engine**{‘python’, ‘numexpr’}, optional, default None + : The engine used to evaluate the expression. Supported engines are + + * None : tries to use `numexpr`, falls back to `python` + * `'numexpr'` : This is the default engine when `numexpr` is installed. + Evaluates pandas objects using numexpr for large speed ups in complex + expressions with large frames. + * `'python'` : Performs operations as if you had `eval`’d in top + level python. This engine is generally not that useful. + + More backends may be available in the future. + + **local\_dict**dict or None, optional + : A dictionary of local variables, taken from locals() by default. + + **global\_dict**dict or None, optional + : A dictionary of global variables, taken from globals() by default. + + **resolvers**list of dict-like or None, optional + : A list of objects implementing the `__getitem__` special method that + you can use to inject an additional collection of namespaces to use for + variable lookup. For example, this is used in the + [`query()`](pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") method to inject the + `DataFrame.index` and `DataFrame.columns` + variables that refer to their respective [`DataFrame`](pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") + instance attributes. + + **level**int, optional + : The number of prior stack frames to traverse and add to the current + scope. Most users will **not** need to change this parameter. + + **target**object, optional, default None + : This is the target object for assignment. It is used when there is + variable assignment in the expression. If so, then target must + support item assignment with string keys, and if a copy is being + returned, it must also support .copy(). + + **inplace**bool, default False + : If target is provided, and the expression mutates target, whether + to modify target inplace. Otherwise, return a copy of target with + the mutation. + + Returns: + : ndarray, numeric scalar, DataFrame, Series, or None + : The completion value of evaluating the given code or None if `inplace=True`. + + Raises: + : ValueError + : There are many instances where such an error can be raised: + + * target=None, but the expression is multiline. + * The expression is multiline, but not all them have item assignment. + An example of such an arrangement is this: + + a = b + 1 + a + 2 + + Here, there are expressions on different lines, making it multiline, + but the last line has no variable assigned to the output of a + 2. + * inplace=True, but the expression is missing item assignment. + * Item assignment is provided, but the target does not support + string item assignment. + * Item assignment is provided and inplace=False, but the target + does not support the .copy() method + + See also + + [`DataFrame.query`](pandas.DataFrame.query.html#pandas.DataFrame.query "pandas.DataFrame.query") + : Evaluates a boolean expression to query the columns of a frame. + + [`DataFrame.eval`](pandas.DataFrame.eval.html#pandas.DataFrame.eval "pandas.DataFrame.eval") + : Evaluate a string describing operations on DataFrame columns. + + Notes + + The `dtype` of any objects involved in an arithmetic `%` operation are + recursively cast to `float64`. + + See the [enhancing performance](../../user_guide/enhancingperf.html#enhancingperf-eval) documentation for + more details. + + Examples + + ```None + >>> df = pd.DataFrame({"animal": ["dog", "pig"], "age": [10, 20]}) + >>> df + animal age + 0 dog 10 + 1 pig 20 + ``` + + We can add a new column using `pd.eval`: + + ```None + >>> pd.eval("double_age = df.age * 2", target=df) + animal age double_age + 0 dog 10 20 + 1 pig 20 40 + ``` diff --git a/corpus/docs/pandas/groupby/groupby_15.md b/corpus/docs/pandas/groupby/groupby_15.md new file mode 100644 index 0000000000000000000000000000000000000000..3090bf46b41c9b9b92e636a147bbf5c9d1965345 --- /dev/null +++ b/corpus/docs/pandas/groupby/groupby_15.md @@ -0,0 +1,129 @@ +# GroupBy# + +Source: https://pandas.pydata.org/pandas-docs/version/1.5/reference/groupby.html +Version: 1.5 + +GroupBy objects are returned by groupby calls: [`pandas.DataFrame.groupby()`](api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby"), [`pandas.Series.groupby()`](api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby"), etc. + +## Indexing, iteration[#](#indexing-iteration "Permalink to this headline") + +| | | +| --- | --- | +| [`GroupBy.__iter__`](api/pandas.core.groupby.GroupBy.__iter__.html#pandas.core.groupby.GroupBy.__iter__ "pandas.core.groupby.GroupBy.__iter__")() | Groupby iterator. | +| [`GroupBy.groups`](api/pandas.core.groupby.GroupBy.groups.html#pandas.core.groupby.GroupBy.groups "pandas.core.groupby.GroupBy.groups") | Dict {group name -> group labels}. | +| [`GroupBy.indices`](api/pandas.core.groupby.GroupBy.indices.html#pandas.core.groupby.GroupBy.indices "pandas.core.groupby.GroupBy.indices") | Dict {group name -> group indices}. | +| [`GroupBy.get_group`](api/pandas.core.groupby.GroupBy.get_group.html#pandas.core.groupby.GroupBy.get_group "pandas.core.groupby.GroupBy.get_group")(name[, obj]) | Construct DataFrame from group with provided name. | + +| | | +| --- | --- | +| [`Grouper`](api/pandas.Grouper.html#pandas.Grouper "pandas.Grouper")(\*args, \*\*kwargs) | A Grouper allows the user to specify a groupby instruction for an object. | + +## Function application[#](#function-application "Permalink to this headline") + +| | | +| --- | --- | +| [`GroupBy.apply`](api/pandas.core.groupby.GroupBy.apply.html#pandas.core.groupby.GroupBy.apply "pandas.core.groupby.GroupBy.apply")(func, \*args, \*\*kwargs) | Apply function `func` group-wise and combine the results together. | +| [`GroupBy.agg`](api/pandas.core.groupby.GroupBy.agg.html#pandas.core.groupby.GroupBy.agg "pandas.core.groupby.GroupBy.agg")(func, \*args, \*\*kwargs) | | +| [`SeriesGroupBy.aggregate`](api/pandas.core.groupby.SeriesGroupBy.aggregate.html#pandas.core.groupby.SeriesGroupBy.aggregate "pandas.core.groupby.SeriesGroupBy.aggregate")([func, engine, ...]) | Aggregate using one or more operations over the specified axis. | +| [`DataFrameGroupBy.aggregate`](api/pandas.core.groupby.DataFrameGroupBy.aggregate.html#pandas.core.groupby.DataFrameGroupBy.aggregate "pandas.core.groupby.DataFrameGroupBy.aggregate")([func, engine, ...]) | Aggregate using one or more operations over the specified axis. | +| [`SeriesGroupBy.transform`](api/pandas.core.groupby.SeriesGroupBy.transform.html#pandas.core.groupby.SeriesGroupBy.transform "pandas.core.groupby.SeriesGroupBy.transform")(func, \*args[, ...]) | Call function producing a same-indexed Series on each group. | +| [`DataFrameGroupBy.transform`](api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform")(func, \*args[, ...]) | Call function producing a same-indexed DataFrame on each group. | +| [`GroupBy.pipe`](api/pandas.core.groupby.GroupBy.pipe.html#pandas.core.groupby.GroupBy.pipe "pandas.core.groupby.GroupBy.pipe")(func, \*args, \*\*kwargs) | Apply a `func` with arguments to this GroupBy object and return its result. | + +## Computations / descriptive stats[#](#computations-descriptive-stats "Permalink to this headline") + +| | | +| --- | --- | +| [`GroupBy.all`](api/pandas.core.groupby.GroupBy.all.html#pandas.core.groupby.GroupBy.all "pandas.core.groupby.GroupBy.all")([skipna]) | Return True if all values in the group are truthful, else False. | +| [`GroupBy.any`](api/pandas.core.groupby.GroupBy.any.html#pandas.core.groupby.GroupBy.any "pandas.core.groupby.GroupBy.any")([skipna]) | Return True if any value in the group is truthful, else False. | +| [`GroupBy.bfill`](api/pandas.core.groupby.GroupBy.bfill.html#pandas.core.groupby.GroupBy.bfill "pandas.core.groupby.GroupBy.bfill")([limit]) | Backward fill the values. | +| [`GroupBy.backfill`](api/pandas.core.groupby.GroupBy.backfill.html#pandas.core.groupby.GroupBy.backfill "pandas.core.groupby.GroupBy.backfill")([limit]) | (DEPRECATED) Backward fill the values. | +| [`GroupBy.count`](api/pandas.core.groupby.GroupBy.count.html#pandas.core.groupby.GroupBy.count "pandas.core.groupby.GroupBy.count")() | Compute count of group, excluding missing values. | +| [`GroupBy.cumcount`](api/pandas.core.groupby.GroupBy.cumcount.html#pandas.core.groupby.GroupBy.cumcount "pandas.core.groupby.GroupBy.cumcount")([ascending]) | Number each item in each group from 0 to the length of that group - 1. | +| [`GroupBy.cummax`](api/pandas.core.groupby.GroupBy.cummax.html#pandas.core.groupby.GroupBy.cummax "pandas.core.groupby.GroupBy.cummax")([axis, numeric\_only]) | Cumulative max for each group. | +| [`GroupBy.cummin`](api/pandas.core.groupby.GroupBy.cummin.html#pandas.core.groupby.GroupBy.cummin "pandas.core.groupby.GroupBy.cummin")([axis, numeric\_only]) | Cumulative min for each group. | +| [`GroupBy.cumprod`](api/pandas.core.groupby.GroupBy.cumprod.html#pandas.core.groupby.GroupBy.cumprod "pandas.core.groupby.GroupBy.cumprod")([axis]) | Cumulative product for each group. | +| [`GroupBy.cumsum`](api/pandas.core.groupby.GroupBy.cumsum.html#pandas.core.groupby.GroupBy.cumsum "pandas.core.groupby.GroupBy.cumsum")([axis]) | Cumulative sum for each group. | +| [`GroupBy.ffill`](api/pandas.core.groupby.GroupBy.ffill.html#pandas.core.groupby.GroupBy.ffill "pandas.core.groupby.GroupBy.ffill")([limit]) | Forward fill the values. | +| [`GroupBy.first`](api/pandas.core.groupby.GroupBy.first.html#pandas.core.groupby.GroupBy.first "pandas.core.groupby.GroupBy.first")([numeric\_only, min\_count]) | Compute the first non-null entry of each column. | +| [`GroupBy.head`](api/pandas.core.groupby.GroupBy.head.html#pandas.core.groupby.GroupBy.head "pandas.core.groupby.GroupBy.head")([n]) | Return first n rows of each group. | +| [`GroupBy.last`](api/pandas.core.groupby.GroupBy.last.html#pandas.core.groupby.GroupBy.last "pandas.core.groupby.GroupBy.last")([numeric\_only, min\_count]) | Compute the last non-null entry of each column. | +| [`GroupBy.max`](api/pandas.core.groupby.GroupBy.max.html#pandas.core.groupby.GroupBy.max "pandas.core.groupby.GroupBy.max")([numeric\_only, min\_count, ...]) | Compute max of group values. | +| [`GroupBy.mean`](api/pandas.core.groupby.GroupBy.mean.html#pandas.core.groupby.GroupBy.mean "pandas.core.groupby.GroupBy.mean")([numeric\_only, engine, ...]) | Compute mean of groups, excluding missing values. | +| [`GroupBy.median`](api/pandas.core.groupby.GroupBy.median.html#pandas.core.groupby.GroupBy.median "pandas.core.groupby.GroupBy.median")([numeric\_only]) | Compute median of groups, excluding missing values. | +| [`GroupBy.min`](api/pandas.core.groupby.GroupBy.min.html#pandas.core.groupby.GroupBy.min "pandas.core.groupby.GroupBy.min")([numeric\_only, min\_count, ...]) | Compute min of group values. | +| [`GroupBy.ngroup`](api/pandas.core.groupby.GroupBy.ngroup.html#pandas.core.groupby.GroupBy.ngroup "pandas.core.groupby.GroupBy.ngroup")([ascending]) | Number each group from 0 to the number of groups - 1. | +| [`GroupBy.nth`](api/pandas.core.groupby.GroupBy.nth.html#pandas.core.groupby.GroupBy.nth "pandas.core.groupby.GroupBy.nth") | Take the nth row from each group if n is an int, otherwise a subset of rows. | +| [`GroupBy.ohlc`](api/pandas.core.groupby.GroupBy.ohlc.html#pandas.core.groupby.GroupBy.ohlc "pandas.core.groupby.GroupBy.ohlc")() | Compute open, high, low and close values of a group, excluding missing values. | +| [`GroupBy.pad`](api/pandas.core.groupby.GroupBy.pad.html#pandas.core.groupby.GroupBy.pad "pandas.core.groupby.GroupBy.pad")([limit]) | (DEPRECATED) Forward fill the values. | +| [`GroupBy.prod`](api/pandas.core.groupby.GroupBy.prod.html#pandas.core.groupby.GroupBy.prod "pandas.core.groupby.GroupBy.prod")([numeric\_only, min\_count]) | Compute prod of group values. | +| [`GroupBy.rank`](api/pandas.core.groupby.GroupBy.rank.html#pandas.core.groupby.GroupBy.rank "pandas.core.groupby.GroupBy.rank")([method, ascending, na\_option, ...]) | Provide the rank of values within each group. | +| [`GroupBy.pct_change`](api/pandas.core.groupby.GroupBy.pct_change.html#pandas.core.groupby.GroupBy.pct_change "pandas.core.groupby.GroupBy.pct_change")([periods, fill\_method, ...]) | Calculate pct\_change of each value to previous entry in group. | +| [`GroupBy.size`](api/pandas.core.groupby.GroupBy.size.html#pandas.core.groupby.GroupBy.size "pandas.core.groupby.GroupBy.size")() | Compute group sizes. | +| [`GroupBy.sem`](api/pandas.core.groupby.GroupBy.sem.html#pandas.core.groupby.GroupBy.sem "pandas.core.groupby.GroupBy.sem")([ddof, numeric\_only]) | Compute standard error of the mean of groups, excluding missing values. | +| [`GroupBy.std`](api/pandas.core.groupby.GroupBy.std.html#pandas.core.groupby.GroupBy.std "pandas.core.groupby.GroupBy.std")([ddof, engine, engine\_kwargs, ...]) | Compute standard deviation of groups, excluding missing values. | +| [`GroupBy.sum`](api/pandas.core.groupby.GroupBy.sum.html#pandas.core.groupby.GroupBy.sum "pandas.core.groupby.GroupBy.sum")([numeric\_only, min\_count, ...]) | Compute sum of group values. | +| [`GroupBy.var`](api/pandas.core.groupby.GroupBy.var.html#pandas.core.groupby.GroupBy.var "pandas.core.groupby.GroupBy.var")([ddof, engine, engine\_kwargs, ...]) | Compute variance of groups, excluding missing values. | +| [`GroupBy.tail`](api/pandas.core.groupby.GroupBy.tail.html#pandas.core.groupby.GroupBy.tail "pandas.core.groupby.GroupBy.tail")([n]) | Return last n rows of each group. | + +The following methods are available in both `SeriesGroupBy` and +`DataFrameGroupBy` objects, but may differ slightly, usually in that +the `DataFrameGroupBy` version usually permits the specification of an +axis argument, and often an argument indicating whether to restrict +application to columns of a specific data type. + +| | | +| --- | --- | +| [`DataFrameGroupBy.all`](api/pandas.core.groupby.DataFrameGroupBy.all.html#pandas.core.groupby.DataFrameGroupBy.all "pandas.core.groupby.DataFrameGroupBy.all")([skipna]) | Return True if all values in the group are truthful, else False. | +| [`DataFrameGroupBy.any`](api/pandas.core.groupby.DataFrameGroupBy.any.html#pandas.core.groupby.DataFrameGroupBy.any "pandas.core.groupby.DataFrameGroupBy.any")([skipna]) | Return True if any value in the group is truthful, else False. | +| [`DataFrameGroupBy.backfill`](api/pandas.core.groupby.DataFrameGroupBy.backfill.html#pandas.core.groupby.DataFrameGroupBy.backfill "pandas.core.groupby.DataFrameGroupBy.backfill")([limit]) | (DEPRECATED) Backward fill the values. | +| [`DataFrameGroupBy.bfill`](api/pandas.core.groupby.DataFrameGroupBy.bfill.html#pandas.core.groupby.DataFrameGroupBy.bfill "pandas.core.groupby.DataFrameGroupBy.bfill")([limit]) | Backward fill the values. | +| [`DataFrameGroupBy.corr`](api/pandas.core.groupby.DataFrameGroupBy.corr.html#pandas.core.groupby.DataFrameGroupBy.corr "pandas.core.groupby.DataFrameGroupBy.corr") | Compute pairwise correlation of columns, excluding NA/null values. | +| [`DataFrameGroupBy.count`](api/pandas.core.groupby.DataFrameGroupBy.count.html#pandas.core.groupby.DataFrameGroupBy.count "pandas.core.groupby.DataFrameGroupBy.count")() | Compute count of group, excluding missing values. | +| [`DataFrameGroupBy.cov`](api/pandas.core.groupby.DataFrameGroupBy.cov.html#pandas.core.groupby.DataFrameGroupBy.cov "pandas.core.groupby.DataFrameGroupBy.cov") | Compute pairwise covariance of columns, excluding NA/null values. | +| [`DataFrameGroupBy.cumcount`](api/pandas.core.groupby.DataFrameGroupBy.cumcount.html#pandas.core.groupby.DataFrameGroupBy.cumcount "pandas.core.groupby.DataFrameGroupBy.cumcount")([ascending]) | Number each item in each group from 0 to the length of that group - 1. | +| [`DataFrameGroupBy.cummax`](api/pandas.core.groupby.DataFrameGroupBy.cummax.html#pandas.core.groupby.DataFrameGroupBy.cummax "pandas.core.groupby.DataFrameGroupBy.cummax")([axis, numeric\_only]) | Cumulative max for each group. | +| [`DataFrameGroupBy.cummin`](api/pandas.core.groupby.DataFrameGroupBy.cummin.html#pandas.core.groupby.DataFrameGroupBy.cummin "pandas.core.groupby.DataFrameGroupBy.cummin")([axis, numeric\_only]) | Cumulative min for each group. | +| [`DataFrameGroupBy.cumprod`](api/pandas.core.groupby.DataFrameGroupBy.cumprod.html#pandas.core.groupby.DataFrameGroupBy.cumprod "pandas.core.groupby.DataFrameGroupBy.cumprod")([axis]) | Cumulative product for each group. | +| [`DataFrameGroupBy.cumsum`](api/pandas.core.groupby.DataFrameGroupBy.cumsum.html#pandas.core.groupby.DataFrameGroupBy.cumsum "pandas.core.groupby.DataFrameGroupBy.cumsum")([axis]) | Cumulative sum for each group. | +| [`DataFrameGroupBy.describe`](api/pandas.core.groupby.DataFrameGroupBy.describe.html#pandas.core.groupby.DataFrameGroupBy.describe "pandas.core.groupby.DataFrameGroupBy.describe")(\*\*kwargs) | Generate descriptive statistics. | +| [`DataFrameGroupBy.diff`](api/pandas.core.groupby.DataFrameGroupBy.diff.html#pandas.core.groupby.DataFrameGroupBy.diff "pandas.core.groupby.DataFrameGroupBy.diff")([periods, axis]) | First discrete difference of element. | +| [`DataFrameGroupBy.ffill`](api/pandas.core.groupby.DataFrameGroupBy.ffill.html#pandas.core.groupby.DataFrameGroupBy.ffill "pandas.core.groupby.DataFrameGroupBy.ffill")([limit]) | Forward fill the values. | +| [`DataFrameGroupBy.fillna`](api/pandas.core.groupby.DataFrameGroupBy.fillna.html#pandas.core.groupby.DataFrameGroupBy.fillna "pandas.core.groupby.DataFrameGroupBy.fillna") | Fill NA/NaN values using the specified method. | +| [`DataFrameGroupBy.filter`](api/pandas.core.groupby.DataFrameGroupBy.filter.html#pandas.core.groupby.DataFrameGroupBy.filter "pandas.core.groupby.DataFrameGroupBy.filter")(func[, dropna]) | Return a copy of a DataFrame excluding filtered elements. | +| [`DataFrameGroupBy.hist`](api/pandas.core.groupby.DataFrameGroupBy.hist.html#pandas.core.groupby.DataFrameGroupBy.hist "pandas.core.groupby.DataFrameGroupBy.hist") | Make a histogram of the DataFrame's columns. | +| [`DataFrameGroupBy.idxmax`](api/pandas.core.groupby.DataFrameGroupBy.idxmax.html#pandas.core.groupby.DataFrameGroupBy.idxmax "pandas.core.groupby.DataFrameGroupBy.idxmax")([axis, skipna, ...]) | Return index of first occurrence of maximum over requested axis. | +| [`DataFrameGroupBy.idxmin`](api/pandas.core.groupby.DataFrameGroupBy.idxmin.html#pandas.core.groupby.DataFrameGroupBy.idxmin "pandas.core.groupby.DataFrameGroupBy.idxmin")([axis, skipna, ...]) | Return index of first occurrence of minimum over requested axis. | +| [`DataFrameGroupBy.mad`](api/pandas.core.groupby.DataFrameGroupBy.mad.html#pandas.core.groupby.DataFrameGroupBy.mad "pandas.core.groupby.DataFrameGroupBy.mad") | (DEPRECATED) Return the mean absolute deviation of the values over the requested axis. | +| [`DataFrameGroupBy.nunique`](api/pandas.core.groupby.DataFrameGroupBy.nunique.html#pandas.core.groupby.DataFrameGroupBy.nunique "pandas.core.groupby.DataFrameGroupBy.nunique")([dropna]) | Return DataFrame with counts of unique elements in each position. | +| [`DataFrameGroupBy.pad`](api/pandas.core.groupby.DataFrameGroupBy.pad.html#pandas.core.groupby.DataFrameGroupBy.pad "pandas.core.groupby.DataFrameGroupBy.pad")([limit]) | (DEPRECATED) Forward fill the values. | +| [`DataFrameGroupBy.pct_change`](api/pandas.core.groupby.DataFrameGroupBy.pct_change.html#pandas.core.groupby.DataFrameGroupBy.pct_change "pandas.core.groupby.DataFrameGroupBy.pct_change")([periods, ...]) | Calculate pct\_change of each value to previous entry in group. | +| [`DataFrameGroupBy.plot`](api/pandas.core.groupby.DataFrameGroupBy.plot.html#pandas.core.groupby.DataFrameGroupBy.plot "pandas.core.groupby.DataFrameGroupBy.plot") | Class implementing the .plot attribute for groupby objects. | +| [`DataFrameGroupBy.quantile`](api/pandas.core.groupby.DataFrameGroupBy.quantile.html#pandas.core.groupby.DataFrameGroupBy.quantile "pandas.core.groupby.DataFrameGroupBy.quantile")([q, ...]) | Return group values at the given quantile, a la numpy.percentile. | +| [`DataFrameGroupBy.rank`](api/pandas.core.groupby.DataFrameGroupBy.rank.html#pandas.core.groupby.DataFrameGroupBy.rank "pandas.core.groupby.DataFrameGroupBy.rank")([method, ascending, ...]) | Provide the rank of values within each group. | +| [`DataFrameGroupBy.resample`](api/pandas.core.groupby.DataFrameGroupBy.resample.html#pandas.core.groupby.DataFrameGroupBy.resample "pandas.core.groupby.DataFrameGroupBy.resample")(rule, \*args, \*\*kwargs) | Provide resampling when using a TimeGrouper. | +| [`DataFrameGroupBy.sample`](api/pandas.core.groupby.DataFrameGroupBy.sample.html#pandas.core.groupby.DataFrameGroupBy.sample "pandas.core.groupby.DataFrameGroupBy.sample")([n, frac, replace, ...]) | Return a random sample of items from each group. | +| [`DataFrameGroupBy.shift`](api/pandas.core.groupby.DataFrameGroupBy.shift.html#pandas.core.groupby.DataFrameGroupBy.shift "pandas.core.groupby.DataFrameGroupBy.shift")([periods, freq, ...]) | Shift each group by periods observations. | +| [`DataFrameGroupBy.size`](api/pandas.core.groupby.DataFrameGroupBy.size.html#pandas.core.groupby.DataFrameGroupBy.size "pandas.core.groupby.DataFrameGroupBy.size")() | Compute group sizes. | +| [`DataFrameGroupBy.skew`](api/pandas.core.groupby.DataFrameGroupBy.skew.html#pandas.core.groupby.DataFrameGroupBy.skew "pandas.core.groupby.DataFrameGroupBy.skew") | Return unbiased skew over requested axis. | +| [`DataFrameGroupBy.take`](api/pandas.core.groupby.DataFrameGroupBy.take.html#pandas.core.groupby.DataFrameGroupBy.take "pandas.core.groupby.DataFrameGroupBy.take") | Return the elements in the given *positional* indices along an axis. | +| [`DataFrameGroupBy.tshift`](api/pandas.core.groupby.DataFrameGroupBy.tshift.html#pandas.core.groupby.DataFrameGroupBy.tshift "pandas.core.groupby.DataFrameGroupBy.tshift") | (DEPRECATED) Shift the time index, using the index's frequency if available. | +| [`DataFrameGroupBy.value_counts`](api/pandas.core.groupby.DataFrameGroupBy.value_counts.html#pandas.core.groupby.DataFrameGroupBy.value_counts "pandas.core.groupby.DataFrameGroupBy.value_counts")([subset, ...]) | Return a Series or DataFrame containing counts of unique rows. | + +The following methods are available only for `SeriesGroupBy` objects. + +| | | +| --- | --- | +| [`SeriesGroupBy.hist`](api/pandas.core.groupby.SeriesGroupBy.hist.html#pandas.core.groupby.SeriesGroupBy.hist "pandas.core.groupby.SeriesGroupBy.hist") | Draw histogram of the input series using matplotlib. | +| [`SeriesGroupBy.nlargest`](api/pandas.core.groupby.SeriesGroupBy.nlargest.html#pandas.core.groupby.SeriesGroupBy.nlargest "pandas.core.groupby.SeriesGroupBy.nlargest")([n, keep]) | Return the largest n elements. | +| [`SeriesGroupBy.nsmallest`](api/pandas.core.groupby.SeriesGroupBy.nsmallest.html#pandas.core.groupby.SeriesGroupBy.nsmallest "pandas.core.groupby.SeriesGroupBy.nsmallest")([n, keep]) | Return the smallest n elements. | +| [`SeriesGroupBy.unique`](api/pandas.core.groupby.SeriesGroupBy.unique.html#pandas.core.groupby.SeriesGroupBy.unique "pandas.core.groupby.SeriesGroupBy.unique") | Return unique values of Series object. | +| [`SeriesGroupBy.is_monotonic_increasing`](api/pandas.core.groupby.SeriesGroupBy.is_monotonic_increasing.html#pandas.core.groupby.SeriesGroupBy.is_monotonic_increasing "pandas.core.groupby.SeriesGroupBy.is_monotonic_increasing") | Return boolean if values in the object are monotonically increasing. | +| [`SeriesGroupBy.is_monotonic_decreasing`](api/pandas.core.groupby.SeriesGroupBy.is_monotonic_decreasing.html#pandas.core.groupby.SeriesGroupBy.is_monotonic_decreasing "pandas.core.groupby.SeriesGroupBy.is_monotonic_decreasing") | Return boolean if values in the object are monotonically decreasing. | + +The following methods are available only for `DataFrameGroupBy` objects. + +| | | +| --- | --- | +| [`DataFrameGroupBy.corrwith`](api/pandas.core.groupby.DataFrameGroupBy.corrwith.html#pandas.core.groupby.DataFrameGroupBy.corrwith "pandas.core.groupby.DataFrameGroupBy.corrwith") | Compute pairwise correlation. | +| [`DataFrameGroupBy.boxplot`](api/pandas.core.groupby.DataFrameGroupBy.boxplot.html#pandas.core.groupby.DataFrameGroupBy.boxplot "pandas.core.groupby.DataFrameGroupBy.boxplot")([subplots, column, ...]) | Make box plots from DataFrameGroupBy data. | diff --git a/corpus/docs/pandas/groupby/groupby_20.md b/corpus/docs/pandas/groupby/groupby_20.md new file mode 100644 index 0000000000000000000000000000000000000000..ced0004fda9f1a641c722403376ac4ff38b2fd90 --- /dev/null +++ b/corpus/docs/pandas/groupby/groupby_20.md @@ -0,0 +1,162 @@ +# GroupBy# + +Source: https://pandas.pydata.org/pandas-docs/version/2.0/reference/groupby.html +Version: 2.0 + +GroupBy objects are returned by groupby calls: [`pandas.DataFrame.groupby()`](api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby"), [`pandas.Series.groupby()`](api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby"), etc. + +## Indexing, iteration[#](#indexing-iteration "Permalink to this headline") + +| | | +| --- | --- | +| [`DataFrameGroupBy.__iter__`](api/pandas.core.groupby.DataFrameGroupBy.__iter__.html#pandas.core.groupby.DataFrameGroupBy.__iter__ "pandas.core.groupby.DataFrameGroupBy.__iter__")() | Groupby iterator. | +| [`SeriesGroupBy.__iter__`](api/pandas.core.groupby.SeriesGroupBy.__iter__.html#pandas.core.groupby.SeriesGroupBy.__iter__ "pandas.core.groupby.SeriesGroupBy.__iter__")() | Groupby iterator. | +| [`DataFrameGroupBy.groups`](api/pandas.core.groupby.DataFrameGroupBy.groups.html#pandas.core.groupby.DataFrameGroupBy.groups "pandas.core.groupby.DataFrameGroupBy.groups") | Dict {group name -> group labels}. | +| [`SeriesGroupBy.groups`](api/pandas.core.groupby.SeriesGroupBy.groups.html#pandas.core.groupby.SeriesGroupBy.groups "pandas.core.groupby.SeriesGroupBy.groups") | Dict {group name -> group labels}. | +| [`DataFrameGroupBy.indices`](api/pandas.core.groupby.DataFrameGroupBy.indices.html#pandas.core.groupby.DataFrameGroupBy.indices "pandas.core.groupby.DataFrameGroupBy.indices") | Dict {group name -> group indices}. | +| [`SeriesGroupBy.indices`](api/pandas.core.groupby.SeriesGroupBy.indices.html#pandas.core.groupby.SeriesGroupBy.indices "pandas.core.groupby.SeriesGroupBy.indices") | Dict {group name -> group indices}. | +| [`DataFrameGroupBy.get_group`](api/pandas.core.groupby.DataFrameGroupBy.get_group.html#pandas.core.groupby.DataFrameGroupBy.get_group "pandas.core.groupby.DataFrameGroupBy.get_group")(name[, obj]) | Construct DataFrame from group with provided name. | +| [`SeriesGroupBy.get_group`](api/pandas.core.groupby.SeriesGroupBy.get_group.html#pandas.core.groupby.SeriesGroupBy.get_group "pandas.core.groupby.SeriesGroupBy.get_group")(name[, obj]) | Construct DataFrame from group with provided name. | + +| | | +| --- | --- | +| [`Grouper`](api/pandas.Grouper.html#pandas.Grouper "pandas.Grouper")(\*args, \*\*kwargs) | A Grouper allows the user to specify a groupby instruction for an object. | + +## Function application helper[#](#function-application-helper "Permalink to this headline") + +| | | +| --- | --- | +| [`NamedAgg`](api/pandas.NamedAgg.html#pandas.NamedAgg "pandas.NamedAgg")(column, aggfunc) | Helper for column specific aggregation with control over output column names. | + +## Function application[#](#function-application "Permalink to this headline") + +| | | +| --- | --- | +| [`SeriesGroupBy.apply`](api/pandas.core.groupby.SeriesGroupBy.apply.html#pandas.core.groupby.SeriesGroupBy.apply "pandas.core.groupby.SeriesGroupBy.apply")(func, \*args, \*\*kwargs) | Apply function `func` group-wise and combine the results together. | +| [`DataFrameGroupBy.apply`](api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply")(func, \*args, \*\*kwargs) | Apply function `func` group-wise and combine the results together. | +| [`SeriesGroupBy.agg`](api/pandas.core.groupby.SeriesGroupBy.agg.html#pandas.core.groupby.SeriesGroupBy.agg "pandas.core.groupby.SeriesGroupBy.agg")([func, engine, engine\_kwargs]) | Aggregate using one or more operations over the specified axis. | +| [`DataFrameGroupBy.agg`](api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg")([func, engine, ...]) | Aggregate using one or more operations over the specified axis. | +| [`SeriesGroupBy.aggregate`](api/pandas.core.groupby.SeriesGroupBy.aggregate.html#pandas.core.groupby.SeriesGroupBy.aggregate "pandas.core.groupby.SeriesGroupBy.aggregate")([func, engine, ...]) | Aggregate using one or more operations over the specified axis. | +| [`DataFrameGroupBy.aggregate`](api/pandas.core.groupby.DataFrameGroupBy.aggregate.html#pandas.core.groupby.DataFrameGroupBy.aggregate "pandas.core.groupby.DataFrameGroupBy.aggregate")([func, engine, ...]) | Aggregate using one or more operations over the specified axis. | +| [`SeriesGroupBy.transform`](api/pandas.core.groupby.SeriesGroupBy.transform.html#pandas.core.groupby.SeriesGroupBy.transform "pandas.core.groupby.SeriesGroupBy.transform")(func, \*args[, ...]) | Call function producing a same-indexed Series on each group. | +| [`DataFrameGroupBy.transform`](api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform")(func, \*args[, ...]) | Call function producing a same-indexed DataFrame on each group. | +| [`SeriesGroupBy.pipe`](api/pandas.core.groupby.SeriesGroupBy.pipe.html#pandas.core.groupby.SeriesGroupBy.pipe "pandas.core.groupby.SeriesGroupBy.pipe")(func, \*args, \*\*kwargs) | Apply a `func` with arguments to this GroupBy object and return its result. | +| [`DataFrameGroupBy.pipe`](api/pandas.core.groupby.DataFrameGroupBy.pipe.html#pandas.core.groupby.DataFrameGroupBy.pipe "pandas.core.groupby.DataFrameGroupBy.pipe")(func, \*args, \*\*kwargs) | Apply a `func` with arguments to this GroupBy object and return its result. | +| [`DataFrameGroupBy.filter`](api/pandas.core.groupby.DataFrameGroupBy.filter.html#pandas.core.groupby.DataFrameGroupBy.filter "pandas.core.groupby.DataFrameGroupBy.filter")(func[, dropna]) | Filter elements from groups that don't satisfy a criterion. | +| [`SeriesGroupBy.filter`](api/pandas.core.groupby.SeriesGroupBy.filter.html#pandas.core.groupby.SeriesGroupBy.filter "pandas.core.groupby.SeriesGroupBy.filter")(func[, dropna]) | Filter elements from groups that don't satisfy a criterion. | + +## `DataFrameGroupBy` computations / descriptive stats[#](#dataframegroupby-computations-descriptive-stats "Permalink to this headline") + +| | | +| --- | --- | +| [`DataFrameGroupBy.all`](api/pandas.core.groupby.DataFrameGroupBy.all.html#pandas.core.groupby.DataFrameGroupBy.all "pandas.core.groupby.DataFrameGroupBy.all")([skipna]) | Return True if all values in the group are truthful, else False. | +| [`DataFrameGroupBy.any`](api/pandas.core.groupby.DataFrameGroupBy.any.html#pandas.core.groupby.DataFrameGroupBy.any "pandas.core.groupby.DataFrameGroupBy.any")([skipna]) | Return True if any value in the group is truthful, else False. | +| [`DataFrameGroupBy.bfill`](api/pandas.core.groupby.DataFrameGroupBy.bfill.html#pandas.core.groupby.DataFrameGroupBy.bfill "pandas.core.groupby.DataFrameGroupBy.bfill")([limit]) | Backward fill the values. | +| [`DataFrameGroupBy.corr`](api/pandas.core.groupby.DataFrameGroupBy.corr.html#pandas.core.groupby.DataFrameGroupBy.corr "pandas.core.groupby.DataFrameGroupBy.corr")([method, min\_periods, ...]) | Compute pairwise correlation of columns, excluding NA/null values. | +| [`DataFrameGroupBy.corrwith`](api/pandas.core.groupby.DataFrameGroupBy.corrwith.html#pandas.core.groupby.DataFrameGroupBy.corrwith "pandas.core.groupby.DataFrameGroupBy.corrwith")(other[, axis, ...]) | Compute pairwise correlation. | +| [`DataFrameGroupBy.count`](api/pandas.core.groupby.DataFrameGroupBy.count.html#pandas.core.groupby.DataFrameGroupBy.count "pandas.core.groupby.DataFrameGroupBy.count")() | Compute count of group, excluding missing values. | +| [`DataFrameGroupBy.cov`](api/pandas.core.groupby.DataFrameGroupBy.cov.html#pandas.core.groupby.DataFrameGroupBy.cov "pandas.core.groupby.DataFrameGroupBy.cov")([min\_periods, ddof, ...]) | Compute pairwise covariance of columns, excluding NA/null values. | +| [`DataFrameGroupBy.cumcount`](api/pandas.core.groupby.DataFrameGroupBy.cumcount.html#pandas.core.groupby.DataFrameGroupBy.cumcount "pandas.core.groupby.DataFrameGroupBy.cumcount")([ascending]) | Number each item in each group from 0 to the length of that group - 1. | +| [`DataFrameGroupBy.cummax`](api/pandas.core.groupby.DataFrameGroupBy.cummax.html#pandas.core.groupby.DataFrameGroupBy.cummax "pandas.core.groupby.DataFrameGroupBy.cummax")([axis, numeric\_only]) | Cumulative max for each group. | +| [`DataFrameGroupBy.cummin`](api/pandas.core.groupby.DataFrameGroupBy.cummin.html#pandas.core.groupby.DataFrameGroupBy.cummin "pandas.core.groupby.DataFrameGroupBy.cummin")([axis, numeric\_only]) | Cumulative min for each group. | +| [`DataFrameGroupBy.cumprod`](api/pandas.core.groupby.DataFrameGroupBy.cumprod.html#pandas.core.groupby.DataFrameGroupBy.cumprod "pandas.core.groupby.DataFrameGroupBy.cumprod")([axis]) | Cumulative product for each group. | +| [`DataFrameGroupBy.cumsum`](api/pandas.core.groupby.DataFrameGroupBy.cumsum.html#pandas.core.groupby.DataFrameGroupBy.cumsum "pandas.core.groupby.DataFrameGroupBy.cumsum")([axis]) | Cumulative sum for each group. | +| [`DataFrameGroupBy.describe`](api/pandas.core.groupby.DataFrameGroupBy.describe.html#pandas.core.groupby.DataFrameGroupBy.describe "pandas.core.groupby.DataFrameGroupBy.describe")([percentiles, ...]) | Generate descriptive statistics. | +| [`DataFrameGroupBy.diff`](api/pandas.core.groupby.DataFrameGroupBy.diff.html#pandas.core.groupby.DataFrameGroupBy.diff "pandas.core.groupby.DataFrameGroupBy.diff")([periods, axis]) | First discrete difference of element. | +| [`DataFrameGroupBy.ffill`](api/pandas.core.groupby.DataFrameGroupBy.ffill.html#pandas.core.groupby.DataFrameGroupBy.ffill "pandas.core.groupby.DataFrameGroupBy.ffill")([limit]) | Forward fill the values. | +| [`DataFrameGroupBy.fillna`](api/pandas.core.groupby.DataFrameGroupBy.fillna.html#pandas.core.groupby.DataFrameGroupBy.fillna "pandas.core.groupby.DataFrameGroupBy.fillna")([value, method, ...]) | Fill NA/NaN values using the specified method within groups. | +| [`DataFrameGroupBy.first`](api/pandas.core.groupby.DataFrameGroupBy.first.html#pandas.core.groupby.DataFrameGroupBy.first "pandas.core.groupby.DataFrameGroupBy.first")([numeric\_only, min\_count]) | Compute the first non-null entry of each column. | +| [`DataFrameGroupBy.head`](api/pandas.core.groupby.DataFrameGroupBy.head.html#pandas.core.groupby.DataFrameGroupBy.head "pandas.core.groupby.DataFrameGroupBy.head")([n]) | Return first n rows of each group. | +| [`DataFrameGroupBy.idxmax`](api/pandas.core.groupby.DataFrameGroupBy.idxmax.html#pandas.core.groupby.DataFrameGroupBy.idxmax "pandas.core.groupby.DataFrameGroupBy.idxmax")([axis, skipna, ...]) | Return index of first occurrence of maximum over requested axis. | +| [`DataFrameGroupBy.idxmin`](api/pandas.core.groupby.DataFrameGroupBy.idxmin.html#pandas.core.groupby.DataFrameGroupBy.idxmin "pandas.core.groupby.DataFrameGroupBy.idxmin")([axis, skipna, ...]) | Return index of first occurrence of minimum over requested axis. | +| [`DataFrameGroupBy.last`](api/pandas.core.groupby.DataFrameGroupBy.last.html#pandas.core.groupby.DataFrameGroupBy.last "pandas.core.groupby.DataFrameGroupBy.last")([numeric\_only, min\_count]) | Compute the last non-null entry of each column. | +| [`DataFrameGroupBy.max`](api/pandas.core.groupby.DataFrameGroupBy.max.html#pandas.core.groupby.DataFrameGroupBy.max "pandas.core.groupby.DataFrameGroupBy.max")([numeric\_only, ...]) | Compute max of group values. | +| [`DataFrameGroupBy.mean`](api/pandas.core.groupby.DataFrameGroupBy.mean.html#pandas.core.groupby.DataFrameGroupBy.mean "pandas.core.groupby.DataFrameGroupBy.mean")([numeric\_only, ...]) | Compute mean of groups, excluding missing values. | +| [`DataFrameGroupBy.median`](api/pandas.core.groupby.DataFrameGroupBy.median.html#pandas.core.groupby.DataFrameGroupBy.median "pandas.core.groupby.DataFrameGroupBy.median")([numeric\_only]) | Compute median of groups, excluding missing values. | +| [`DataFrameGroupBy.min`](api/pandas.core.groupby.DataFrameGroupBy.min.html#pandas.core.groupby.DataFrameGroupBy.min "pandas.core.groupby.DataFrameGroupBy.min")([numeric\_only, ...]) | Compute min of group values. | +| [`DataFrameGroupBy.ngroup`](api/pandas.core.groupby.DataFrameGroupBy.ngroup.html#pandas.core.groupby.DataFrameGroupBy.ngroup "pandas.core.groupby.DataFrameGroupBy.ngroup")([ascending]) | Number each group from 0 to the number of groups - 1. | +| [`DataFrameGroupBy.nth`](api/pandas.core.groupby.DataFrameGroupBy.nth.html#pandas.core.groupby.DataFrameGroupBy.nth "pandas.core.groupby.DataFrameGroupBy.nth") | Take the nth row from each group if n is an int, otherwise a subset of rows. | +| [`DataFrameGroupBy.nunique`](api/pandas.core.groupby.DataFrameGroupBy.nunique.html#pandas.core.groupby.DataFrameGroupBy.nunique "pandas.core.groupby.DataFrameGroupBy.nunique")([dropna]) | Return DataFrame with counts of unique elements in each position. | +| [`DataFrameGroupBy.ohlc`](api/pandas.core.groupby.DataFrameGroupBy.ohlc.html#pandas.core.groupby.DataFrameGroupBy.ohlc "pandas.core.groupby.DataFrameGroupBy.ohlc")() | Compute open, high, low and close values of a group, excluding missing values. | +| [`DataFrameGroupBy.pct_change`](api/pandas.core.groupby.DataFrameGroupBy.pct_change.html#pandas.core.groupby.DataFrameGroupBy.pct_change "pandas.core.groupby.DataFrameGroupBy.pct_change")([periods, ...]) | Calculate pct\_change of each value to previous entry in group. | +| [`DataFrameGroupBy.prod`](api/pandas.core.groupby.DataFrameGroupBy.prod.html#pandas.core.groupby.DataFrameGroupBy.prod "pandas.core.groupby.DataFrameGroupBy.prod")([numeric\_only, min\_count]) | Compute prod of group values. | +| [`DataFrameGroupBy.quantile`](api/pandas.core.groupby.DataFrameGroupBy.quantile.html#pandas.core.groupby.DataFrameGroupBy.quantile "pandas.core.groupby.DataFrameGroupBy.quantile")([q, ...]) | Return group values at the given quantile, a la numpy.percentile. | +| [`DataFrameGroupBy.rank`](api/pandas.core.groupby.DataFrameGroupBy.rank.html#pandas.core.groupby.DataFrameGroupBy.rank "pandas.core.groupby.DataFrameGroupBy.rank")([method, ascending, ...]) | Provide the rank of values within each group. | +| [`DataFrameGroupBy.resample`](api/pandas.core.groupby.DataFrameGroupBy.resample.html#pandas.core.groupby.DataFrameGroupBy.resample "pandas.core.groupby.DataFrameGroupBy.resample")(rule, \*args, \*\*kwargs) | Provide resampling when using a TimeGrouper. | +| [`DataFrameGroupBy.rolling`](api/pandas.core.groupby.DataFrameGroupBy.rolling.html#pandas.core.groupby.DataFrameGroupBy.rolling "pandas.core.groupby.DataFrameGroupBy.rolling")(\*args, \*\*kwargs) | Return a rolling grouper, providing rolling functionality per group. | +| [`DataFrameGroupBy.sample`](api/pandas.core.groupby.DataFrameGroupBy.sample.html#pandas.core.groupby.DataFrameGroupBy.sample "pandas.core.groupby.DataFrameGroupBy.sample")([n, frac, replace, ...]) | Return a random sample of items from each group. | +| [`DataFrameGroupBy.sem`](api/pandas.core.groupby.DataFrameGroupBy.sem.html#pandas.core.groupby.DataFrameGroupBy.sem "pandas.core.groupby.DataFrameGroupBy.sem")([ddof, numeric\_only]) | Compute standard error of the mean of groups, excluding missing values. | +| [`DataFrameGroupBy.shift`](api/pandas.core.groupby.DataFrameGroupBy.shift.html#pandas.core.groupby.DataFrameGroupBy.shift "pandas.core.groupby.DataFrameGroupBy.shift")([periods, freq, ...]) | Shift each group by periods observations. | +| [`DataFrameGroupBy.size`](api/pandas.core.groupby.DataFrameGroupBy.size.html#pandas.core.groupby.DataFrameGroupBy.size "pandas.core.groupby.DataFrameGroupBy.size")() | Compute group sizes. | +| [`DataFrameGroupBy.skew`](api/pandas.core.groupby.DataFrameGroupBy.skew.html#pandas.core.groupby.DataFrameGroupBy.skew "pandas.core.groupby.DataFrameGroupBy.skew")([axis, skipna, ...]) | Return unbiased skew within groups. | +| [`DataFrameGroupBy.std`](api/pandas.core.groupby.DataFrameGroupBy.std.html#pandas.core.groupby.DataFrameGroupBy.std "pandas.core.groupby.DataFrameGroupBy.std")([ddof, engine, ...]) | Compute standard deviation of groups, excluding missing values. | +| [`DataFrameGroupBy.sum`](api/pandas.core.groupby.DataFrameGroupBy.sum.html#pandas.core.groupby.DataFrameGroupBy.sum "pandas.core.groupby.DataFrameGroupBy.sum")([numeric\_only, ...]) | Compute sum of group values. | +| [`DataFrameGroupBy.var`](api/pandas.core.groupby.DataFrameGroupBy.var.html#pandas.core.groupby.DataFrameGroupBy.var "pandas.core.groupby.DataFrameGroupBy.var")([ddof, engine, ...]) | Compute variance of groups, excluding missing values. | +| [`DataFrameGroupBy.tail`](api/pandas.core.groupby.DataFrameGroupBy.tail.html#pandas.core.groupby.DataFrameGroupBy.tail "pandas.core.groupby.DataFrameGroupBy.tail")([n]) | Return last n rows of each group. | +| [`DataFrameGroupBy.take`](api/pandas.core.groupby.DataFrameGroupBy.take.html#pandas.core.groupby.DataFrameGroupBy.take "pandas.core.groupby.DataFrameGroupBy.take")(indices[, axis]) | Return the elements in the given *positional* indices in each group. | +| [`DataFrameGroupBy.value_counts`](api/pandas.core.groupby.DataFrameGroupBy.value_counts.html#pandas.core.groupby.DataFrameGroupBy.value_counts "pandas.core.groupby.DataFrameGroupBy.value_counts")([subset, ...]) | Return a Series or DataFrame containing counts of unique rows. | + +## `SeriesGroupBy` computations / descriptive stats[#](#seriesgroupby-computations-descriptive-stats "Permalink to this headline") + +| | | +| --- | --- | +| [`SeriesGroupBy.all`](api/pandas.core.groupby.SeriesGroupBy.all.html#pandas.core.groupby.SeriesGroupBy.all "pandas.core.groupby.SeriesGroupBy.all")([skipna]) | Return True if all values in the group are truthful, else False. | +| [`SeriesGroupBy.any`](api/pandas.core.groupby.SeriesGroupBy.any.html#pandas.core.groupby.SeriesGroupBy.any "pandas.core.groupby.SeriesGroupBy.any")([skipna]) | Return True if any value in the group is truthful, else False. | +| [`SeriesGroupBy.bfill`](api/pandas.core.groupby.SeriesGroupBy.bfill.html#pandas.core.groupby.SeriesGroupBy.bfill "pandas.core.groupby.SeriesGroupBy.bfill")([limit]) | Backward fill the values. | +| [`SeriesGroupBy.corr`](api/pandas.core.groupby.SeriesGroupBy.corr.html#pandas.core.groupby.SeriesGroupBy.corr "pandas.core.groupby.SeriesGroupBy.corr")(other[, method, min\_periods]) | Compute correlation with other Series, excluding missing values. | +| [`SeriesGroupBy.count`](api/pandas.core.groupby.SeriesGroupBy.count.html#pandas.core.groupby.SeriesGroupBy.count "pandas.core.groupby.SeriesGroupBy.count")() | Compute count of group, excluding missing values. | +| [`SeriesGroupBy.cov`](api/pandas.core.groupby.SeriesGroupBy.cov.html#pandas.core.groupby.SeriesGroupBy.cov "pandas.core.groupby.SeriesGroupBy.cov")(other[, min\_periods, ddof]) | Compute covariance with Series, excluding missing values. | +| [`SeriesGroupBy.cumcount`](api/pandas.core.groupby.SeriesGroupBy.cumcount.html#pandas.core.groupby.SeriesGroupBy.cumcount "pandas.core.groupby.SeriesGroupBy.cumcount")([ascending]) | Number each item in each group from 0 to the length of that group - 1. | +| [`SeriesGroupBy.cummax`](api/pandas.core.groupby.SeriesGroupBy.cummax.html#pandas.core.groupby.SeriesGroupBy.cummax "pandas.core.groupby.SeriesGroupBy.cummax")([axis, numeric\_only]) | Cumulative max for each group. | +| [`SeriesGroupBy.cummin`](api/pandas.core.groupby.SeriesGroupBy.cummin.html#pandas.core.groupby.SeriesGroupBy.cummin "pandas.core.groupby.SeriesGroupBy.cummin")([axis, numeric\_only]) | Cumulative min for each group. | +| [`SeriesGroupBy.cumprod`](api/pandas.core.groupby.SeriesGroupBy.cumprod.html#pandas.core.groupby.SeriesGroupBy.cumprod "pandas.core.groupby.SeriesGroupBy.cumprod")([axis]) | Cumulative product for each group. | +| [`SeriesGroupBy.cumsum`](api/pandas.core.groupby.SeriesGroupBy.cumsum.html#pandas.core.groupby.SeriesGroupBy.cumsum "pandas.core.groupby.SeriesGroupBy.cumsum")([axis]) | Cumulative sum for each group. | +| [`SeriesGroupBy.describe`](api/pandas.core.groupby.SeriesGroupBy.describe.html#pandas.core.groupby.SeriesGroupBy.describe "pandas.core.groupby.SeriesGroupBy.describe")(\*\*kwargs) | Generate descriptive statistics. | +| [`SeriesGroupBy.diff`](api/pandas.core.groupby.SeriesGroupBy.diff.html#pandas.core.groupby.SeriesGroupBy.diff "pandas.core.groupby.SeriesGroupBy.diff")([periods, axis]) | First discrete difference of element. | +| [`SeriesGroupBy.ffill`](api/pandas.core.groupby.SeriesGroupBy.ffill.html#pandas.core.groupby.SeriesGroupBy.ffill "pandas.core.groupby.SeriesGroupBy.ffill")([limit]) | Forward fill the values. | +| [`SeriesGroupBy.fillna`](api/pandas.core.groupby.SeriesGroupBy.fillna.html#pandas.core.groupby.SeriesGroupBy.fillna "pandas.core.groupby.SeriesGroupBy.fillna")([value, method, axis, ...]) | Fill NA/NaN values using the specified method within groups. | +| [`SeriesGroupBy.first`](api/pandas.core.groupby.SeriesGroupBy.first.html#pandas.core.groupby.SeriesGroupBy.first "pandas.core.groupby.SeriesGroupBy.first")([numeric\_only, min\_count]) | Compute the first non-null entry of each column. | +| [`SeriesGroupBy.head`](api/pandas.core.groupby.SeriesGroupBy.head.html#pandas.core.groupby.SeriesGroupBy.head "pandas.core.groupby.SeriesGroupBy.head")([n]) | Return first n rows of each group. | +| [`SeriesGroupBy.last`](api/pandas.core.groupby.SeriesGroupBy.last.html#pandas.core.groupby.SeriesGroupBy.last "pandas.core.groupby.SeriesGroupBy.last")([numeric\_only, min\_count]) | Compute the last non-null entry of each column. | +| [`SeriesGroupBy.idxmax`](api/pandas.core.groupby.SeriesGroupBy.idxmax.html#pandas.core.groupby.SeriesGroupBy.idxmax "pandas.core.groupby.SeriesGroupBy.idxmax")([axis, skipna]) | Return the row label of the maximum value. | +| [`SeriesGroupBy.idxmin`](api/pandas.core.groupby.SeriesGroupBy.idxmin.html#pandas.core.groupby.SeriesGroupBy.idxmin "pandas.core.groupby.SeriesGroupBy.idxmin")([axis, skipna]) | Return the row label of the minimum value. | +| [`SeriesGroupBy.is_monotonic_increasing`](api/pandas.core.groupby.SeriesGroupBy.is_monotonic_increasing.html#pandas.core.groupby.SeriesGroupBy.is_monotonic_increasing "pandas.core.groupby.SeriesGroupBy.is_monotonic_increasing") | Return boolean if values in the object are monotonically increasing. | +| [`SeriesGroupBy.is_monotonic_decreasing`](api/pandas.core.groupby.SeriesGroupBy.is_monotonic_decreasing.html#pandas.core.groupby.SeriesGroupBy.is_monotonic_decreasing "pandas.core.groupby.SeriesGroupBy.is_monotonic_decreasing") | Return boolean if values in the object are monotonically decreasing. | +| [`SeriesGroupBy.max`](api/pandas.core.groupby.SeriesGroupBy.max.html#pandas.core.groupby.SeriesGroupBy.max "pandas.core.groupby.SeriesGroupBy.max")([numeric\_only, min\_count, ...]) | Compute max of group values. | +| [`SeriesGroupBy.mean`](api/pandas.core.groupby.SeriesGroupBy.mean.html#pandas.core.groupby.SeriesGroupBy.mean "pandas.core.groupby.SeriesGroupBy.mean")([numeric\_only, engine, ...]) | Compute mean of groups, excluding missing values. | +| [`SeriesGroupBy.median`](api/pandas.core.groupby.SeriesGroupBy.median.html#pandas.core.groupby.SeriesGroupBy.median "pandas.core.groupby.SeriesGroupBy.median")([numeric\_only]) | Compute median of groups, excluding missing values. | +| [`SeriesGroupBy.min`](api/pandas.core.groupby.SeriesGroupBy.min.html#pandas.core.groupby.SeriesGroupBy.min "pandas.core.groupby.SeriesGroupBy.min")([numeric\_only, min\_count, ...]) | Compute min of group values. | +| [`SeriesGroupBy.ngroup`](api/pandas.core.groupby.SeriesGroupBy.ngroup.html#pandas.core.groupby.SeriesGroupBy.ngroup "pandas.core.groupby.SeriesGroupBy.ngroup")([ascending]) | Number each group from 0 to the number of groups - 1. | +| [`SeriesGroupBy.nlargest`](api/pandas.core.groupby.SeriesGroupBy.nlargest.html#pandas.core.groupby.SeriesGroupBy.nlargest "pandas.core.groupby.SeriesGroupBy.nlargest")([n, keep]) | Return the largest n elements. | +| [`SeriesGroupBy.nsmallest`](api/pandas.core.groupby.SeriesGroupBy.nsmallest.html#pandas.core.groupby.SeriesGroupBy.nsmallest "pandas.core.groupby.SeriesGroupBy.nsmallest")([n, keep]) | Return the smallest n elements. | +| [`SeriesGroupBy.nth`](api/pandas.core.groupby.SeriesGroupBy.nth.html#pandas.core.groupby.SeriesGroupBy.nth "pandas.core.groupby.SeriesGroupBy.nth") | Take the nth row from each group if n is an int, otherwise a subset of rows. | +| [`SeriesGroupBy.nunique`](api/pandas.core.groupby.SeriesGroupBy.nunique.html#pandas.core.groupby.SeriesGroupBy.nunique "pandas.core.groupby.SeriesGroupBy.nunique")([dropna]) | Return number of unique elements in the group. | +| [`SeriesGroupBy.unique`](api/pandas.core.groupby.SeriesGroupBy.unique.html#pandas.core.groupby.SeriesGroupBy.unique "pandas.core.groupby.SeriesGroupBy.unique")() | Return unique values of Series object. | +| [`SeriesGroupBy.ohlc`](api/pandas.core.groupby.SeriesGroupBy.ohlc.html#pandas.core.groupby.SeriesGroupBy.ohlc "pandas.core.groupby.SeriesGroupBy.ohlc")() | Compute open, high, low and close values of a group, excluding missing values. | +| [`SeriesGroupBy.pct_change`](api/pandas.core.groupby.SeriesGroupBy.pct_change.html#pandas.core.groupby.SeriesGroupBy.pct_change "pandas.core.groupby.SeriesGroupBy.pct_change")([periods, ...]) | Calculate pct\_change of each value to previous entry in group. | +| [`SeriesGroupBy.prod`](api/pandas.core.groupby.SeriesGroupBy.prod.html#pandas.core.groupby.SeriesGroupBy.prod "pandas.core.groupby.SeriesGroupBy.prod")([numeric\_only, min\_count]) | Compute prod of group values. | +| [`SeriesGroupBy.quantile`](api/pandas.core.groupby.SeriesGroupBy.quantile.html#pandas.core.groupby.SeriesGroupBy.quantile "pandas.core.groupby.SeriesGroupBy.quantile")([q, interpolation, ...]) | Return group values at the given quantile, a la numpy.percentile. | +| [`SeriesGroupBy.rank`](api/pandas.core.groupby.SeriesGroupBy.rank.html#pandas.core.groupby.SeriesGroupBy.rank "pandas.core.groupby.SeriesGroupBy.rank")([method, ascending, ...]) | Provide the rank of values within each group. | +| [`SeriesGroupBy.resample`](api/pandas.core.groupby.SeriesGroupBy.resample.html#pandas.core.groupby.SeriesGroupBy.resample "pandas.core.groupby.SeriesGroupBy.resample")(rule, \*args, \*\*kwargs) | Provide resampling when using a TimeGrouper. | +| [`SeriesGroupBy.rolling`](api/pandas.core.groupby.SeriesGroupBy.rolling.html#pandas.core.groupby.SeriesGroupBy.rolling "pandas.core.groupby.SeriesGroupBy.rolling")(\*args, \*\*kwargs) | Return a rolling grouper, providing rolling functionality per group. | +| [`SeriesGroupBy.sample`](api/pandas.core.groupby.SeriesGroupBy.sample.html#pandas.core.groupby.SeriesGroupBy.sample "pandas.core.groupby.SeriesGroupBy.sample")([n, frac, replace, ...]) | Return a random sample of items from each group. | +| [`SeriesGroupBy.sem`](api/pandas.core.groupby.SeriesGroupBy.sem.html#pandas.core.groupby.SeriesGroupBy.sem "pandas.core.groupby.SeriesGroupBy.sem")([ddof, numeric\_only]) | Compute standard error of the mean of groups, excluding missing values. | +| [`SeriesGroupBy.shift`](api/pandas.core.groupby.SeriesGroupBy.shift.html#pandas.core.groupby.SeriesGroupBy.shift "pandas.core.groupby.SeriesGroupBy.shift")([periods, freq, axis, ...]) | Shift each group by periods observations. | +| [`SeriesGroupBy.size`](api/pandas.core.groupby.SeriesGroupBy.size.html#pandas.core.groupby.SeriesGroupBy.size "pandas.core.groupby.SeriesGroupBy.size")() | Compute group sizes. | +| [`SeriesGroupBy.skew`](api/pandas.core.groupby.SeriesGroupBy.skew.html#pandas.core.groupby.SeriesGroupBy.skew "pandas.core.groupby.SeriesGroupBy.skew")([axis, skipna, numeric\_only]) | Return unbiased skew within groups. | +| [`SeriesGroupBy.std`](api/pandas.core.groupby.SeriesGroupBy.std.html#pandas.core.groupby.SeriesGroupBy.std "pandas.core.groupby.SeriesGroupBy.std")([ddof, engine, ...]) | Compute standard deviation of groups, excluding missing values. | +| [`SeriesGroupBy.sum`](api/pandas.core.groupby.SeriesGroupBy.sum.html#pandas.core.groupby.SeriesGroupBy.sum "pandas.core.groupby.SeriesGroupBy.sum")([numeric\_only, min\_count, ...]) | Compute sum of group values. | +| [`SeriesGroupBy.var`](api/pandas.core.groupby.SeriesGroupBy.var.html#pandas.core.groupby.SeriesGroupBy.var "pandas.core.groupby.SeriesGroupBy.var")([ddof, engine, ...]) | Compute variance of groups, excluding missing values. | +| [`SeriesGroupBy.tail`](api/pandas.core.groupby.SeriesGroupBy.tail.html#pandas.core.groupby.SeriesGroupBy.tail "pandas.core.groupby.SeriesGroupBy.tail")([n]) | Return last n rows of each group. | +| [`SeriesGroupBy.take`](api/pandas.core.groupby.SeriesGroupBy.take.html#pandas.core.groupby.SeriesGroupBy.take "pandas.core.groupby.SeriesGroupBy.take")(indices[, axis]) | Return the elements in the given *positional* indices in each group. | +| [`SeriesGroupBy.value_counts`](api/pandas.core.groupby.SeriesGroupBy.value_counts.html#pandas.core.groupby.SeriesGroupBy.value_counts "pandas.core.groupby.SeriesGroupBy.value_counts")([normalize, ...]) | | + +## Plotting and visualization[#](#plotting-and-visualization "Permalink to this headline") + +| | | +| --- | --- | +| [`DataFrameGroupBy.boxplot`](api/pandas.core.groupby.DataFrameGroupBy.boxplot.html#pandas.core.groupby.DataFrameGroupBy.boxplot "pandas.core.groupby.DataFrameGroupBy.boxplot")([subplots, column, ...]) | Make box plots from DataFrameGroupBy data. | +| [`DataFrameGroupBy.hist`](api/pandas.core.groupby.DataFrameGroupBy.hist.html#pandas.core.groupby.DataFrameGroupBy.hist "pandas.core.groupby.DataFrameGroupBy.hist")([column, by, grid, ...]) | Make a histogram of the DataFrame's columns. | +| [`SeriesGroupBy.hist`](api/pandas.core.groupby.SeriesGroupBy.hist.html#pandas.core.groupby.SeriesGroupBy.hist "pandas.core.groupby.SeriesGroupBy.hist")([by, ax, grid, ...]) | Draw histogram of the input series using matplotlib. | +| [`DataFrameGroupBy.plot`](api/pandas.core.groupby.DataFrameGroupBy.plot.html#pandas.core.groupby.DataFrameGroupBy.plot "pandas.core.groupby.DataFrameGroupBy.plot") | Make plots of Series or DataFrame. | +| [`SeriesGroupBy.plot`](api/pandas.core.groupby.SeriesGroupBy.plot.html#pandas.core.groupby.SeriesGroupBy.plot "pandas.core.groupby.SeriesGroupBy.plot") | Make plots of Series or DataFrame. | diff --git a/corpus/docs/pandas/groupby/groupby_21.md b/corpus/docs/pandas/groupby/groupby_21.md new file mode 100644 index 0000000000000000000000000000000000000000..3a8f2711895c96b33b7355bc52738793701823fc --- /dev/null +++ b/corpus/docs/pandas/groupby/groupby_21.md @@ -0,0 +1,164 @@ +# GroupBy# + +Source: https://pandas.pydata.org/pandas-docs/version/2.1/reference/groupby.html +Version: 2.1 + +`pandas.api.typing.DataFrameGroupBy` and `pandas.api.typing.SeriesGroupBy` +instances are returned by groupby calls [`pandas.DataFrame.groupby()`](api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") and +[`pandas.Series.groupby()`](api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") respectively. + +## Indexing, iteration[#](#indexing-iteration "Permalink to this heading") + +| | | +| --- | --- | +| [`DataFrameGroupBy.__iter__`](api/pandas.core.groupby.DataFrameGroupBy.__iter__.html#pandas.core.groupby.DataFrameGroupBy.__iter__ "pandas.core.groupby.DataFrameGroupBy.__iter__")() | Groupby iterator. | +| [`SeriesGroupBy.__iter__`](api/pandas.core.groupby.SeriesGroupBy.__iter__.html#pandas.core.groupby.SeriesGroupBy.__iter__ "pandas.core.groupby.SeriesGroupBy.__iter__")() | Groupby iterator. | +| [`DataFrameGroupBy.groups`](api/pandas.core.groupby.DataFrameGroupBy.groups.html#pandas.core.groupby.DataFrameGroupBy.groups "pandas.core.groupby.DataFrameGroupBy.groups") | Dict {group name -> group labels}. | +| [`SeriesGroupBy.groups`](api/pandas.core.groupby.SeriesGroupBy.groups.html#pandas.core.groupby.SeriesGroupBy.groups "pandas.core.groupby.SeriesGroupBy.groups") | Dict {group name -> group labels}. | +| [`DataFrameGroupBy.indices`](api/pandas.core.groupby.DataFrameGroupBy.indices.html#pandas.core.groupby.DataFrameGroupBy.indices "pandas.core.groupby.DataFrameGroupBy.indices") | Dict {group name -> group indices}. | +| [`SeriesGroupBy.indices`](api/pandas.core.groupby.SeriesGroupBy.indices.html#pandas.core.groupby.SeriesGroupBy.indices "pandas.core.groupby.SeriesGroupBy.indices") | Dict {group name -> group indices}. | +| [`DataFrameGroupBy.get_group`](api/pandas.core.groupby.DataFrameGroupBy.get_group.html#pandas.core.groupby.DataFrameGroupBy.get_group "pandas.core.groupby.DataFrameGroupBy.get_group")(name[, obj]) | Construct DataFrame from group with provided name. | +| [`SeriesGroupBy.get_group`](api/pandas.core.groupby.SeriesGroupBy.get_group.html#pandas.core.groupby.SeriesGroupBy.get_group "pandas.core.groupby.SeriesGroupBy.get_group")(name[, obj]) | Construct DataFrame from group with provided name. | + +| | | +| --- | --- | +| [`Grouper`](api/pandas.Grouper.html#pandas.Grouper "pandas.Grouper")(\*args, \*\*kwargs) | A Grouper allows the user to specify a groupby instruction for an object. | + +## Function application helper[#](#function-application-helper "Permalink to this heading") + +| | | +| --- | --- | +| [`NamedAgg`](api/pandas.NamedAgg.html#pandas.NamedAgg "pandas.NamedAgg")(column, aggfunc) | Helper for column specific aggregation with control over output column names. | + +## Function application[#](#function-application "Permalink to this heading") + +| | | +| --- | --- | +| [`SeriesGroupBy.apply`](api/pandas.core.groupby.SeriesGroupBy.apply.html#pandas.core.groupby.SeriesGroupBy.apply "pandas.core.groupby.SeriesGroupBy.apply")(func, \*args, \*\*kwargs) | Apply function `func` group-wise and combine the results together. | +| [`DataFrameGroupBy.apply`](api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply")(func, \*args, \*\*kwargs) | Apply function `func` group-wise and combine the results together. | +| [`SeriesGroupBy.agg`](api/pandas.core.groupby.SeriesGroupBy.agg.html#pandas.core.groupby.SeriesGroupBy.agg "pandas.core.groupby.SeriesGroupBy.agg")([func, engine, engine\_kwargs]) | Aggregate using one or more operations over the specified axis. | +| [`DataFrameGroupBy.agg`](api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg")([func, engine, ...]) | Aggregate using one or more operations over the specified axis. | +| [`SeriesGroupBy.aggregate`](api/pandas.core.groupby.SeriesGroupBy.aggregate.html#pandas.core.groupby.SeriesGroupBy.aggregate "pandas.core.groupby.SeriesGroupBy.aggregate")([func, engine, ...]) | Aggregate using one or more operations over the specified axis. | +| [`DataFrameGroupBy.aggregate`](api/pandas.core.groupby.DataFrameGroupBy.aggregate.html#pandas.core.groupby.DataFrameGroupBy.aggregate "pandas.core.groupby.DataFrameGroupBy.aggregate")([func, engine, ...]) | Aggregate using one or more operations over the specified axis. | +| [`SeriesGroupBy.transform`](api/pandas.core.groupby.SeriesGroupBy.transform.html#pandas.core.groupby.SeriesGroupBy.transform "pandas.core.groupby.SeriesGroupBy.transform")(func, \*args[, ...]) | Call function producing a same-indexed Series on each group. | +| [`DataFrameGroupBy.transform`](api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform")(func, \*args[, ...]) | Call function producing a same-indexed DataFrame on each group. | +| [`SeriesGroupBy.pipe`](api/pandas.core.groupby.SeriesGroupBy.pipe.html#pandas.core.groupby.SeriesGroupBy.pipe "pandas.core.groupby.SeriesGroupBy.pipe")(func, \*args, \*\*kwargs) | Apply a `func` with arguments to this GroupBy object and return its result. | +| [`DataFrameGroupBy.pipe`](api/pandas.core.groupby.DataFrameGroupBy.pipe.html#pandas.core.groupby.DataFrameGroupBy.pipe "pandas.core.groupby.DataFrameGroupBy.pipe")(func, \*args, \*\*kwargs) | Apply a `func` with arguments to this GroupBy object and return its result. | +| [`DataFrameGroupBy.filter`](api/pandas.core.groupby.DataFrameGroupBy.filter.html#pandas.core.groupby.DataFrameGroupBy.filter "pandas.core.groupby.DataFrameGroupBy.filter")(func[, dropna]) | Filter elements from groups that don't satisfy a criterion. | +| [`SeriesGroupBy.filter`](api/pandas.core.groupby.SeriesGroupBy.filter.html#pandas.core.groupby.SeriesGroupBy.filter "pandas.core.groupby.SeriesGroupBy.filter")(func[, dropna]) | Filter elements from groups that don't satisfy a criterion. | + +## `DataFrameGroupBy` computations / descriptive stats[#](#dataframegroupby-computations-descriptive-stats "Permalink to this heading") + +| | | +| --- | --- | +| [`DataFrameGroupBy.all`](api/pandas.core.groupby.DataFrameGroupBy.all.html#pandas.core.groupby.DataFrameGroupBy.all "pandas.core.groupby.DataFrameGroupBy.all")([skipna]) | Return True if all values in the group are truthful, else False. | +| [`DataFrameGroupBy.any`](api/pandas.core.groupby.DataFrameGroupBy.any.html#pandas.core.groupby.DataFrameGroupBy.any "pandas.core.groupby.DataFrameGroupBy.any")([skipna]) | Return True if any value in the group is truthful, else False. | +| [`DataFrameGroupBy.bfill`](api/pandas.core.groupby.DataFrameGroupBy.bfill.html#pandas.core.groupby.DataFrameGroupBy.bfill "pandas.core.groupby.DataFrameGroupBy.bfill")([limit]) | Backward fill the values. | +| [`DataFrameGroupBy.corr`](api/pandas.core.groupby.DataFrameGroupBy.corr.html#pandas.core.groupby.DataFrameGroupBy.corr "pandas.core.groupby.DataFrameGroupBy.corr")([method, min\_periods, ...]) | Compute pairwise correlation of columns, excluding NA/null values. | +| [`DataFrameGroupBy.corrwith`](api/pandas.core.groupby.DataFrameGroupBy.corrwith.html#pandas.core.groupby.DataFrameGroupBy.corrwith "pandas.core.groupby.DataFrameGroupBy.corrwith")(other[, axis, ...]) | Compute pairwise correlation. | +| [`DataFrameGroupBy.count`](api/pandas.core.groupby.DataFrameGroupBy.count.html#pandas.core.groupby.DataFrameGroupBy.count "pandas.core.groupby.DataFrameGroupBy.count")() | Compute count of group, excluding missing values. | +| [`DataFrameGroupBy.cov`](api/pandas.core.groupby.DataFrameGroupBy.cov.html#pandas.core.groupby.DataFrameGroupBy.cov "pandas.core.groupby.DataFrameGroupBy.cov")([min\_periods, ddof, ...]) | Compute pairwise covariance of columns, excluding NA/null values. | +| [`DataFrameGroupBy.cumcount`](api/pandas.core.groupby.DataFrameGroupBy.cumcount.html#pandas.core.groupby.DataFrameGroupBy.cumcount "pandas.core.groupby.DataFrameGroupBy.cumcount")([ascending]) | Number each item in each group from 0 to the length of that group - 1. | +| [`DataFrameGroupBy.cummax`](api/pandas.core.groupby.DataFrameGroupBy.cummax.html#pandas.core.groupby.DataFrameGroupBy.cummax "pandas.core.groupby.DataFrameGroupBy.cummax")([axis, numeric\_only]) | Cumulative max for each group. | +| [`DataFrameGroupBy.cummin`](api/pandas.core.groupby.DataFrameGroupBy.cummin.html#pandas.core.groupby.DataFrameGroupBy.cummin "pandas.core.groupby.DataFrameGroupBy.cummin")([axis, numeric\_only]) | Cumulative min for each group. | +| [`DataFrameGroupBy.cumprod`](api/pandas.core.groupby.DataFrameGroupBy.cumprod.html#pandas.core.groupby.DataFrameGroupBy.cumprod "pandas.core.groupby.DataFrameGroupBy.cumprod")([axis]) | Cumulative product for each group. | +| [`DataFrameGroupBy.cumsum`](api/pandas.core.groupby.DataFrameGroupBy.cumsum.html#pandas.core.groupby.DataFrameGroupBy.cumsum "pandas.core.groupby.DataFrameGroupBy.cumsum")([axis]) | Cumulative sum for each group. | +| [`DataFrameGroupBy.describe`](api/pandas.core.groupby.DataFrameGroupBy.describe.html#pandas.core.groupby.DataFrameGroupBy.describe "pandas.core.groupby.DataFrameGroupBy.describe")([percentiles, ...]) | Generate descriptive statistics. | +| [`DataFrameGroupBy.diff`](api/pandas.core.groupby.DataFrameGroupBy.diff.html#pandas.core.groupby.DataFrameGroupBy.diff "pandas.core.groupby.DataFrameGroupBy.diff")([periods, axis]) | First discrete difference of element. | +| [`DataFrameGroupBy.ffill`](api/pandas.core.groupby.DataFrameGroupBy.ffill.html#pandas.core.groupby.DataFrameGroupBy.ffill "pandas.core.groupby.DataFrameGroupBy.ffill")([limit]) | Forward fill the values. | +| [`DataFrameGroupBy.fillna`](api/pandas.core.groupby.DataFrameGroupBy.fillna.html#pandas.core.groupby.DataFrameGroupBy.fillna "pandas.core.groupby.DataFrameGroupBy.fillna")([value, method, ...]) | Fill NA/NaN values using the specified method within groups. | +| [`DataFrameGroupBy.first`](api/pandas.core.groupby.DataFrameGroupBy.first.html#pandas.core.groupby.DataFrameGroupBy.first "pandas.core.groupby.DataFrameGroupBy.first")([numeric\_only, min\_count]) | Compute the first non-null entry of each column. | +| [`DataFrameGroupBy.head`](api/pandas.core.groupby.DataFrameGroupBy.head.html#pandas.core.groupby.DataFrameGroupBy.head "pandas.core.groupby.DataFrameGroupBy.head")([n]) | Return first n rows of each group. | +| [`DataFrameGroupBy.idxmax`](api/pandas.core.groupby.DataFrameGroupBy.idxmax.html#pandas.core.groupby.DataFrameGroupBy.idxmax "pandas.core.groupby.DataFrameGroupBy.idxmax")([axis, skipna, ...]) | Return index of first occurrence of maximum over requested axis. | +| [`DataFrameGroupBy.idxmin`](api/pandas.core.groupby.DataFrameGroupBy.idxmin.html#pandas.core.groupby.DataFrameGroupBy.idxmin "pandas.core.groupby.DataFrameGroupBy.idxmin")([axis, skipna, ...]) | Return index of first occurrence of minimum over requested axis. | +| [`DataFrameGroupBy.last`](api/pandas.core.groupby.DataFrameGroupBy.last.html#pandas.core.groupby.DataFrameGroupBy.last "pandas.core.groupby.DataFrameGroupBy.last")([numeric\_only, min\_count]) | Compute the last non-null entry of each column. | +| [`DataFrameGroupBy.max`](api/pandas.core.groupby.DataFrameGroupBy.max.html#pandas.core.groupby.DataFrameGroupBy.max "pandas.core.groupby.DataFrameGroupBy.max")([numeric\_only, ...]) | Compute max of group values. | +| [`DataFrameGroupBy.mean`](api/pandas.core.groupby.DataFrameGroupBy.mean.html#pandas.core.groupby.DataFrameGroupBy.mean "pandas.core.groupby.DataFrameGroupBy.mean")([numeric\_only, ...]) | Compute mean of groups, excluding missing values. | +| [`DataFrameGroupBy.median`](api/pandas.core.groupby.DataFrameGroupBy.median.html#pandas.core.groupby.DataFrameGroupBy.median "pandas.core.groupby.DataFrameGroupBy.median")([numeric\_only]) | Compute median of groups, excluding missing values. | +| [`DataFrameGroupBy.min`](api/pandas.core.groupby.DataFrameGroupBy.min.html#pandas.core.groupby.DataFrameGroupBy.min "pandas.core.groupby.DataFrameGroupBy.min")([numeric\_only, ...]) | Compute min of group values. | +| [`DataFrameGroupBy.ngroup`](api/pandas.core.groupby.DataFrameGroupBy.ngroup.html#pandas.core.groupby.DataFrameGroupBy.ngroup "pandas.core.groupby.DataFrameGroupBy.ngroup")([ascending]) | Number each group from 0 to the number of groups - 1. | +| [`DataFrameGroupBy.nth`](api/pandas.core.groupby.DataFrameGroupBy.nth.html#pandas.core.groupby.DataFrameGroupBy.nth "pandas.core.groupby.DataFrameGroupBy.nth") | Take the nth row from each group if n is an int, otherwise a subset of rows. | +| [`DataFrameGroupBy.nunique`](api/pandas.core.groupby.DataFrameGroupBy.nunique.html#pandas.core.groupby.DataFrameGroupBy.nunique "pandas.core.groupby.DataFrameGroupBy.nunique")([dropna]) | Return DataFrame with counts of unique elements in each position. | +| [`DataFrameGroupBy.ohlc`](api/pandas.core.groupby.DataFrameGroupBy.ohlc.html#pandas.core.groupby.DataFrameGroupBy.ohlc "pandas.core.groupby.DataFrameGroupBy.ohlc")() | Compute open, high, low and close values of a group, excluding missing values. | +| [`DataFrameGroupBy.pct_change`](api/pandas.core.groupby.DataFrameGroupBy.pct_change.html#pandas.core.groupby.DataFrameGroupBy.pct_change "pandas.core.groupby.DataFrameGroupBy.pct_change")([periods, ...]) | Calculate pct\_change of each value to previous entry in group. | +| [`DataFrameGroupBy.prod`](api/pandas.core.groupby.DataFrameGroupBy.prod.html#pandas.core.groupby.DataFrameGroupBy.prod "pandas.core.groupby.DataFrameGroupBy.prod")([numeric\_only, min\_count]) | Compute prod of group values. | +| [`DataFrameGroupBy.quantile`](api/pandas.core.groupby.DataFrameGroupBy.quantile.html#pandas.core.groupby.DataFrameGroupBy.quantile "pandas.core.groupby.DataFrameGroupBy.quantile")([q, ...]) | Return group values at the given quantile, a la numpy.percentile. | +| [`DataFrameGroupBy.rank`](api/pandas.core.groupby.DataFrameGroupBy.rank.html#pandas.core.groupby.DataFrameGroupBy.rank "pandas.core.groupby.DataFrameGroupBy.rank")([method, ascending, ...]) | Provide the rank of values within each group. | +| [`DataFrameGroupBy.resample`](api/pandas.core.groupby.DataFrameGroupBy.resample.html#pandas.core.groupby.DataFrameGroupBy.resample "pandas.core.groupby.DataFrameGroupBy.resample")(rule, \*args, \*\*kwargs) | Provide resampling when using a TimeGrouper. | +| [`DataFrameGroupBy.rolling`](api/pandas.core.groupby.DataFrameGroupBy.rolling.html#pandas.core.groupby.DataFrameGroupBy.rolling "pandas.core.groupby.DataFrameGroupBy.rolling")(\*args, \*\*kwargs) | Return a rolling grouper, providing rolling functionality per group. | +| [`DataFrameGroupBy.sample`](api/pandas.core.groupby.DataFrameGroupBy.sample.html#pandas.core.groupby.DataFrameGroupBy.sample "pandas.core.groupby.DataFrameGroupBy.sample")([n, frac, replace, ...]) | Return a random sample of items from each group. | +| [`DataFrameGroupBy.sem`](api/pandas.core.groupby.DataFrameGroupBy.sem.html#pandas.core.groupby.DataFrameGroupBy.sem "pandas.core.groupby.DataFrameGroupBy.sem")([ddof, numeric\_only]) | Compute standard error of the mean of groups, excluding missing values. | +| [`DataFrameGroupBy.shift`](api/pandas.core.groupby.DataFrameGroupBy.shift.html#pandas.core.groupby.DataFrameGroupBy.shift "pandas.core.groupby.DataFrameGroupBy.shift")([periods, freq, ...]) | Shift each group by periods observations. | +| [`DataFrameGroupBy.size`](api/pandas.core.groupby.DataFrameGroupBy.size.html#pandas.core.groupby.DataFrameGroupBy.size "pandas.core.groupby.DataFrameGroupBy.size")() | Compute group sizes. | +| [`DataFrameGroupBy.skew`](api/pandas.core.groupby.DataFrameGroupBy.skew.html#pandas.core.groupby.DataFrameGroupBy.skew "pandas.core.groupby.DataFrameGroupBy.skew")([axis, skipna, ...]) | Return unbiased skew within groups. | +| [`DataFrameGroupBy.std`](api/pandas.core.groupby.DataFrameGroupBy.std.html#pandas.core.groupby.DataFrameGroupBy.std "pandas.core.groupby.DataFrameGroupBy.std")([ddof, engine, ...]) | Compute standard deviation of groups, excluding missing values. | +| [`DataFrameGroupBy.sum`](api/pandas.core.groupby.DataFrameGroupBy.sum.html#pandas.core.groupby.DataFrameGroupBy.sum "pandas.core.groupby.DataFrameGroupBy.sum")([numeric\_only, ...]) | Compute sum of group values. | +| [`DataFrameGroupBy.var`](api/pandas.core.groupby.DataFrameGroupBy.var.html#pandas.core.groupby.DataFrameGroupBy.var "pandas.core.groupby.DataFrameGroupBy.var")([ddof, engine, ...]) | Compute variance of groups, excluding missing values. | +| [`DataFrameGroupBy.tail`](api/pandas.core.groupby.DataFrameGroupBy.tail.html#pandas.core.groupby.DataFrameGroupBy.tail "pandas.core.groupby.DataFrameGroupBy.tail")([n]) | Return last n rows of each group. | +| [`DataFrameGroupBy.take`](api/pandas.core.groupby.DataFrameGroupBy.take.html#pandas.core.groupby.DataFrameGroupBy.take "pandas.core.groupby.DataFrameGroupBy.take")(indices[, axis]) | Return the elements in the given *positional* indices in each group. | +| [`DataFrameGroupBy.value_counts`](api/pandas.core.groupby.DataFrameGroupBy.value_counts.html#pandas.core.groupby.DataFrameGroupBy.value_counts "pandas.core.groupby.DataFrameGroupBy.value_counts")([subset, ...]) | Return a Series or DataFrame containing counts of unique rows. | + +## `SeriesGroupBy` computations / descriptive stats[#](#seriesgroupby-computations-descriptive-stats "Permalink to this heading") + +| | | +| --- | --- | +| [`SeriesGroupBy.all`](api/pandas.core.groupby.SeriesGroupBy.all.html#pandas.core.groupby.SeriesGroupBy.all "pandas.core.groupby.SeriesGroupBy.all")([skipna]) | Return True if all values in the group are truthful, else False. | +| [`SeriesGroupBy.any`](api/pandas.core.groupby.SeriesGroupBy.any.html#pandas.core.groupby.SeriesGroupBy.any "pandas.core.groupby.SeriesGroupBy.any")([skipna]) | Return True if any value in the group is truthful, else False. | +| [`SeriesGroupBy.bfill`](api/pandas.core.groupby.SeriesGroupBy.bfill.html#pandas.core.groupby.SeriesGroupBy.bfill "pandas.core.groupby.SeriesGroupBy.bfill")([limit]) | Backward fill the values. | +| [`SeriesGroupBy.corr`](api/pandas.core.groupby.SeriesGroupBy.corr.html#pandas.core.groupby.SeriesGroupBy.corr "pandas.core.groupby.SeriesGroupBy.corr")(other[, method, min\_periods]) | Compute correlation with other Series, excluding missing values. | +| [`SeriesGroupBy.count`](api/pandas.core.groupby.SeriesGroupBy.count.html#pandas.core.groupby.SeriesGroupBy.count "pandas.core.groupby.SeriesGroupBy.count")() | Compute count of group, excluding missing values. | +| [`SeriesGroupBy.cov`](api/pandas.core.groupby.SeriesGroupBy.cov.html#pandas.core.groupby.SeriesGroupBy.cov "pandas.core.groupby.SeriesGroupBy.cov")(other[, min\_periods, ddof]) | Compute covariance with Series, excluding missing values. | +| [`SeriesGroupBy.cumcount`](api/pandas.core.groupby.SeriesGroupBy.cumcount.html#pandas.core.groupby.SeriesGroupBy.cumcount "pandas.core.groupby.SeriesGroupBy.cumcount")([ascending]) | Number each item in each group from 0 to the length of that group - 1. | +| [`SeriesGroupBy.cummax`](api/pandas.core.groupby.SeriesGroupBy.cummax.html#pandas.core.groupby.SeriesGroupBy.cummax "pandas.core.groupby.SeriesGroupBy.cummax")([axis, numeric\_only]) | Cumulative max for each group. | +| [`SeriesGroupBy.cummin`](api/pandas.core.groupby.SeriesGroupBy.cummin.html#pandas.core.groupby.SeriesGroupBy.cummin "pandas.core.groupby.SeriesGroupBy.cummin")([axis, numeric\_only]) | Cumulative min for each group. | +| [`SeriesGroupBy.cumprod`](api/pandas.core.groupby.SeriesGroupBy.cumprod.html#pandas.core.groupby.SeriesGroupBy.cumprod "pandas.core.groupby.SeriesGroupBy.cumprod")([axis]) | Cumulative product for each group. | +| [`SeriesGroupBy.cumsum`](api/pandas.core.groupby.SeriesGroupBy.cumsum.html#pandas.core.groupby.SeriesGroupBy.cumsum "pandas.core.groupby.SeriesGroupBy.cumsum")([axis]) | Cumulative sum for each group. | +| [`SeriesGroupBy.describe`](api/pandas.core.groupby.SeriesGroupBy.describe.html#pandas.core.groupby.SeriesGroupBy.describe "pandas.core.groupby.SeriesGroupBy.describe")(\*\*kwargs) | Generate descriptive statistics. | +| [`SeriesGroupBy.diff`](api/pandas.core.groupby.SeriesGroupBy.diff.html#pandas.core.groupby.SeriesGroupBy.diff "pandas.core.groupby.SeriesGroupBy.diff")([periods, axis]) | First discrete difference of element. | +| [`SeriesGroupBy.ffill`](api/pandas.core.groupby.SeriesGroupBy.ffill.html#pandas.core.groupby.SeriesGroupBy.ffill "pandas.core.groupby.SeriesGroupBy.ffill")([limit]) | Forward fill the values. | +| [`SeriesGroupBy.fillna`](api/pandas.core.groupby.SeriesGroupBy.fillna.html#pandas.core.groupby.SeriesGroupBy.fillna "pandas.core.groupby.SeriesGroupBy.fillna")([value, method, axis, ...]) | Fill NA/NaN values using the specified method within groups. | +| [`SeriesGroupBy.first`](api/pandas.core.groupby.SeriesGroupBy.first.html#pandas.core.groupby.SeriesGroupBy.first "pandas.core.groupby.SeriesGroupBy.first")([numeric\_only, min\_count]) | Compute the first non-null entry of each column. | +| [`SeriesGroupBy.head`](api/pandas.core.groupby.SeriesGroupBy.head.html#pandas.core.groupby.SeriesGroupBy.head "pandas.core.groupby.SeriesGroupBy.head")([n]) | Return first n rows of each group. | +| [`SeriesGroupBy.last`](api/pandas.core.groupby.SeriesGroupBy.last.html#pandas.core.groupby.SeriesGroupBy.last "pandas.core.groupby.SeriesGroupBy.last")([numeric\_only, min\_count]) | Compute the last non-null entry of each column. | +| [`SeriesGroupBy.idxmax`](api/pandas.core.groupby.SeriesGroupBy.idxmax.html#pandas.core.groupby.SeriesGroupBy.idxmax "pandas.core.groupby.SeriesGroupBy.idxmax")([axis, skipna]) | Return the row label of the maximum value. | +| [`SeriesGroupBy.idxmin`](api/pandas.core.groupby.SeriesGroupBy.idxmin.html#pandas.core.groupby.SeriesGroupBy.idxmin "pandas.core.groupby.SeriesGroupBy.idxmin")([axis, skipna]) | Return the row label of the minimum value. | +| [`SeriesGroupBy.is_monotonic_increasing`](api/pandas.core.groupby.SeriesGroupBy.is_monotonic_increasing.html#pandas.core.groupby.SeriesGroupBy.is_monotonic_increasing "pandas.core.groupby.SeriesGroupBy.is_monotonic_increasing") | Return whether each group's values are monotonically increasing. | +| [`SeriesGroupBy.is_monotonic_decreasing`](api/pandas.core.groupby.SeriesGroupBy.is_monotonic_decreasing.html#pandas.core.groupby.SeriesGroupBy.is_monotonic_decreasing "pandas.core.groupby.SeriesGroupBy.is_monotonic_decreasing") | Return whether each group's values are monotonically decreasing. | +| [`SeriesGroupBy.max`](api/pandas.core.groupby.SeriesGroupBy.max.html#pandas.core.groupby.SeriesGroupBy.max "pandas.core.groupby.SeriesGroupBy.max")([numeric\_only, min\_count, ...]) | Compute max of group values. | +| [`SeriesGroupBy.mean`](api/pandas.core.groupby.SeriesGroupBy.mean.html#pandas.core.groupby.SeriesGroupBy.mean "pandas.core.groupby.SeriesGroupBy.mean")([numeric\_only, engine, ...]) | Compute mean of groups, excluding missing values. | +| [`SeriesGroupBy.median`](api/pandas.core.groupby.SeriesGroupBy.median.html#pandas.core.groupby.SeriesGroupBy.median "pandas.core.groupby.SeriesGroupBy.median")([numeric\_only]) | Compute median of groups, excluding missing values. | +| [`SeriesGroupBy.min`](api/pandas.core.groupby.SeriesGroupBy.min.html#pandas.core.groupby.SeriesGroupBy.min "pandas.core.groupby.SeriesGroupBy.min")([numeric\_only, min\_count, ...]) | Compute min of group values. | +| [`SeriesGroupBy.ngroup`](api/pandas.core.groupby.SeriesGroupBy.ngroup.html#pandas.core.groupby.SeriesGroupBy.ngroup "pandas.core.groupby.SeriesGroupBy.ngroup")([ascending]) | Number each group from 0 to the number of groups - 1. | +| [`SeriesGroupBy.nlargest`](api/pandas.core.groupby.SeriesGroupBy.nlargest.html#pandas.core.groupby.SeriesGroupBy.nlargest "pandas.core.groupby.SeriesGroupBy.nlargest")([n, keep]) | Return the largest n elements. | +| [`SeriesGroupBy.nsmallest`](api/pandas.core.groupby.SeriesGroupBy.nsmallest.html#pandas.core.groupby.SeriesGroupBy.nsmallest "pandas.core.groupby.SeriesGroupBy.nsmallest")([n, keep]) | Return the smallest n elements. | +| [`SeriesGroupBy.nth`](api/pandas.core.groupby.SeriesGroupBy.nth.html#pandas.core.groupby.SeriesGroupBy.nth "pandas.core.groupby.SeriesGroupBy.nth") | Take the nth row from each group if n is an int, otherwise a subset of rows. | +| [`SeriesGroupBy.nunique`](api/pandas.core.groupby.SeriesGroupBy.nunique.html#pandas.core.groupby.SeriesGroupBy.nunique "pandas.core.groupby.SeriesGroupBy.nunique")([dropna]) | Return number of unique elements in the group. | +| [`SeriesGroupBy.unique`](api/pandas.core.groupby.SeriesGroupBy.unique.html#pandas.core.groupby.SeriesGroupBy.unique "pandas.core.groupby.SeriesGroupBy.unique")() | Return unique values for each group. | +| [`SeriesGroupBy.ohlc`](api/pandas.core.groupby.SeriesGroupBy.ohlc.html#pandas.core.groupby.SeriesGroupBy.ohlc "pandas.core.groupby.SeriesGroupBy.ohlc")() | Compute open, high, low and close values of a group, excluding missing values. | +| [`SeriesGroupBy.pct_change`](api/pandas.core.groupby.SeriesGroupBy.pct_change.html#pandas.core.groupby.SeriesGroupBy.pct_change "pandas.core.groupby.SeriesGroupBy.pct_change")([periods, ...]) | Calculate pct\_change of each value to previous entry in group. | +| [`SeriesGroupBy.prod`](api/pandas.core.groupby.SeriesGroupBy.prod.html#pandas.core.groupby.SeriesGroupBy.prod "pandas.core.groupby.SeriesGroupBy.prod")([numeric\_only, min\_count]) | Compute prod of group values. | +| [`SeriesGroupBy.quantile`](api/pandas.core.groupby.SeriesGroupBy.quantile.html#pandas.core.groupby.SeriesGroupBy.quantile "pandas.core.groupby.SeriesGroupBy.quantile")([q, interpolation, ...]) | Return group values at the given quantile, a la numpy.percentile. | +| [`SeriesGroupBy.rank`](api/pandas.core.groupby.SeriesGroupBy.rank.html#pandas.core.groupby.SeriesGroupBy.rank "pandas.core.groupby.SeriesGroupBy.rank")([method, ascending, ...]) | Provide the rank of values within each group. | +| [`SeriesGroupBy.resample`](api/pandas.core.groupby.SeriesGroupBy.resample.html#pandas.core.groupby.SeriesGroupBy.resample "pandas.core.groupby.SeriesGroupBy.resample")(rule, \*args, \*\*kwargs) | Provide resampling when using a TimeGrouper. | +| [`SeriesGroupBy.rolling`](api/pandas.core.groupby.SeriesGroupBy.rolling.html#pandas.core.groupby.SeriesGroupBy.rolling "pandas.core.groupby.SeriesGroupBy.rolling")(\*args, \*\*kwargs) | Return a rolling grouper, providing rolling functionality per group. | +| [`SeriesGroupBy.sample`](api/pandas.core.groupby.SeriesGroupBy.sample.html#pandas.core.groupby.SeriesGroupBy.sample "pandas.core.groupby.SeriesGroupBy.sample")([n, frac, replace, ...]) | Return a random sample of items from each group. | +| [`SeriesGroupBy.sem`](api/pandas.core.groupby.SeriesGroupBy.sem.html#pandas.core.groupby.SeriesGroupBy.sem "pandas.core.groupby.SeriesGroupBy.sem")([ddof, numeric\_only]) | Compute standard error of the mean of groups, excluding missing values. | +| [`SeriesGroupBy.shift`](api/pandas.core.groupby.SeriesGroupBy.shift.html#pandas.core.groupby.SeriesGroupBy.shift "pandas.core.groupby.SeriesGroupBy.shift")([periods, freq, axis, ...]) | Shift each group by periods observations. | +| [`SeriesGroupBy.size`](api/pandas.core.groupby.SeriesGroupBy.size.html#pandas.core.groupby.SeriesGroupBy.size "pandas.core.groupby.SeriesGroupBy.size")() | Compute group sizes. | +| [`SeriesGroupBy.skew`](api/pandas.core.groupby.SeriesGroupBy.skew.html#pandas.core.groupby.SeriesGroupBy.skew "pandas.core.groupby.SeriesGroupBy.skew")([axis, skipna, numeric\_only]) | Return unbiased skew within groups. | +| [`SeriesGroupBy.std`](api/pandas.core.groupby.SeriesGroupBy.std.html#pandas.core.groupby.SeriesGroupBy.std "pandas.core.groupby.SeriesGroupBy.std")([ddof, engine, ...]) | Compute standard deviation of groups, excluding missing values. | +| [`SeriesGroupBy.sum`](api/pandas.core.groupby.SeriesGroupBy.sum.html#pandas.core.groupby.SeriesGroupBy.sum "pandas.core.groupby.SeriesGroupBy.sum")([numeric\_only, min\_count, ...]) | Compute sum of group values. | +| [`SeriesGroupBy.var`](api/pandas.core.groupby.SeriesGroupBy.var.html#pandas.core.groupby.SeriesGroupBy.var "pandas.core.groupby.SeriesGroupBy.var")([ddof, engine, ...]) | Compute variance of groups, excluding missing values. | +| [`SeriesGroupBy.tail`](api/pandas.core.groupby.SeriesGroupBy.tail.html#pandas.core.groupby.SeriesGroupBy.tail "pandas.core.groupby.SeriesGroupBy.tail")([n]) | Return last n rows of each group. | +| [`SeriesGroupBy.take`](api/pandas.core.groupby.SeriesGroupBy.take.html#pandas.core.groupby.SeriesGroupBy.take "pandas.core.groupby.SeriesGroupBy.take")(indices[, axis]) | Return the elements in the given *positional* indices in each group. | +| [`SeriesGroupBy.value_counts`](api/pandas.core.groupby.SeriesGroupBy.value_counts.html#pandas.core.groupby.SeriesGroupBy.value_counts "pandas.core.groupby.SeriesGroupBy.value_counts")([normalize, ...]) | | + +## Plotting and visualization[#](#plotting-and-visualization "Permalink to this heading") + +| | | +| --- | --- | +| [`DataFrameGroupBy.boxplot`](api/pandas.core.groupby.DataFrameGroupBy.boxplot.html#pandas.core.groupby.DataFrameGroupBy.boxplot "pandas.core.groupby.DataFrameGroupBy.boxplot")([subplots, column, ...]) | Make box plots from DataFrameGroupBy data. | +| [`DataFrameGroupBy.hist`](api/pandas.core.groupby.DataFrameGroupBy.hist.html#pandas.core.groupby.DataFrameGroupBy.hist "pandas.core.groupby.DataFrameGroupBy.hist")([column, by, grid, ...]) | Make a histogram of the DataFrame's columns. | +| [`SeriesGroupBy.hist`](api/pandas.core.groupby.SeriesGroupBy.hist.html#pandas.core.groupby.SeriesGroupBy.hist "pandas.core.groupby.SeriesGroupBy.hist")([by, ax, grid, ...]) | Draw histogram of the input series using matplotlib. | +| [`DataFrameGroupBy.plot`](api/pandas.core.groupby.DataFrameGroupBy.plot.html#pandas.core.groupby.DataFrameGroupBy.plot "pandas.core.groupby.DataFrameGroupBy.plot") | Make plots of Series or DataFrame. | +| [`SeriesGroupBy.plot`](api/pandas.core.groupby.SeriesGroupBy.plot.html#pandas.core.groupby.SeriesGroupBy.plot "pandas.core.groupby.SeriesGroupBy.plot") | Make plots of Series or DataFrame. | diff --git a/corpus/docs/pandas/groupby/groupby_22.md b/corpus/docs/pandas/groupby/groupby_22.md new file mode 100644 index 0000000000000000000000000000000000000000..bb752dc915466096def2332bbd713f267076b8f1 --- /dev/null +++ b/corpus/docs/pandas/groupby/groupby_22.md @@ -0,0 +1,164 @@ +# GroupBy# + +Source: https://pandas.pydata.org/pandas-docs/version/2.2/reference/groupby.html +Version: 2.2 + +`pandas.api.typing.DataFrameGroupBy` and `pandas.api.typing.SeriesGroupBy` +instances are returned by groupby calls [`pandas.DataFrame.groupby()`](api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") and +[`pandas.Series.groupby()`](api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") respectively. + +## Indexing, iteration[#](#indexing-iteration "Link to this heading") + +| | | +| --- | --- | +| [`DataFrameGroupBy.__iter__`](api/pandas.core.groupby.DataFrameGroupBy.__iter__.html#pandas.core.groupby.DataFrameGroupBy.__iter__ "pandas.core.groupby.DataFrameGroupBy.__iter__")() | Groupby iterator. | +| [`SeriesGroupBy.__iter__`](api/pandas.core.groupby.SeriesGroupBy.__iter__.html#pandas.core.groupby.SeriesGroupBy.__iter__ "pandas.core.groupby.SeriesGroupBy.__iter__")() | Groupby iterator. | +| [`DataFrameGroupBy.groups`](api/pandas.core.groupby.DataFrameGroupBy.groups.html#pandas.core.groupby.DataFrameGroupBy.groups "pandas.core.groupby.DataFrameGroupBy.groups") | Dict {group name -> group labels}. | +| [`SeriesGroupBy.groups`](api/pandas.core.groupby.SeriesGroupBy.groups.html#pandas.core.groupby.SeriesGroupBy.groups "pandas.core.groupby.SeriesGroupBy.groups") | Dict {group name -> group labels}. | +| [`DataFrameGroupBy.indices`](api/pandas.core.groupby.DataFrameGroupBy.indices.html#pandas.core.groupby.DataFrameGroupBy.indices "pandas.core.groupby.DataFrameGroupBy.indices") | Dict {group name -> group indices}. | +| [`SeriesGroupBy.indices`](api/pandas.core.groupby.SeriesGroupBy.indices.html#pandas.core.groupby.SeriesGroupBy.indices "pandas.core.groupby.SeriesGroupBy.indices") | Dict {group name -> group indices}. | +| [`DataFrameGroupBy.get_group`](api/pandas.core.groupby.DataFrameGroupBy.get_group.html#pandas.core.groupby.DataFrameGroupBy.get_group "pandas.core.groupby.DataFrameGroupBy.get_group")(name[, obj]) | Construct DataFrame from group with provided name. | +| [`SeriesGroupBy.get_group`](api/pandas.core.groupby.SeriesGroupBy.get_group.html#pandas.core.groupby.SeriesGroupBy.get_group "pandas.core.groupby.SeriesGroupBy.get_group")(name[, obj]) | Construct DataFrame from group with provided name. | + +| | | +| --- | --- | +| [`Grouper`](api/pandas.Grouper.html#pandas.Grouper "pandas.Grouper")(\*args, \*\*kwargs) | A Grouper allows the user to specify a groupby instruction for an object. | + +## Function application helper[#](#function-application-helper "Link to this heading") + +| | | +| --- | --- | +| [`NamedAgg`](api/pandas.NamedAgg.html#pandas.NamedAgg "pandas.NamedAgg")(column, aggfunc) | Helper for column specific aggregation with control over output column names. | + +## Function application[#](#function-application "Link to this heading") + +| | | +| --- | --- | +| [`SeriesGroupBy.apply`](api/pandas.core.groupby.SeriesGroupBy.apply.html#pandas.core.groupby.SeriesGroupBy.apply "pandas.core.groupby.SeriesGroupBy.apply")(func, \*args, \*\*kwargs) | Apply function `func` group-wise and combine the results together. | +| [`DataFrameGroupBy.apply`](api/pandas.core.groupby.DataFrameGroupBy.apply.html#pandas.core.groupby.DataFrameGroupBy.apply "pandas.core.groupby.DataFrameGroupBy.apply")(func, \*args[, ...]) | Apply function `func` group-wise and combine the results together. | +| [`SeriesGroupBy.agg`](api/pandas.core.groupby.SeriesGroupBy.agg.html#pandas.core.groupby.SeriesGroupBy.agg "pandas.core.groupby.SeriesGroupBy.agg")([func, engine, engine\_kwargs]) | Aggregate using one or more operations over the specified axis. | +| [`DataFrameGroupBy.agg`](api/pandas.core.groupby.DataFrameGroupBy.agg.html#pandas.core.groupby.DataFrameGroupBy.agg "pandas.core.groupby.DataFrameGroupBy.agg")([func, engine, ...]) | Aggregate using one or more operations over the specified axis. | +| [`SeriesGroupBy.aggregate`](api/pandas.core.groupby.SeriesGroupBy.aggregate.html#pandas.core.groupby.SeriesGroupBy.aggregate "pandas.core.groupby.SeriesGroupBy.aggregate")([func, engine, ...]) | Aggregate using one or more operations over the specified axis. | +| [`DataFrameGroupBy.aggregate`](api/pandas.core.groupby.DataFrameGroupBy.aggregate.html#pandas.core.groupby.DataFrameGroupBy.aggregate "pandas.core.groupby.DataFrameGroupBy.aggregate")([func, engine, ...]) | Aggregate using one or more operations over the specified axis. | +| [`SeriesGroupBy.transform`](api/pandas.core.groupby.SeriesGroupBy.transform.html#pandas.core.groupby.SeriesGroupBy.transform "pandas.core.groupby.SeriesGroupBy.transform")(func, \*args[, ...]) | Call function producing a same-indexed Series on each group. | +| [`DataFrameGroupBy.transform`](api/pandas.core.groupby.DataFrameGroupBy.transform.html#pandas.core.groupby.DataFrameGroupBy.transform "pandas.core.groupby.DataFrameGroupBy.transform")(func, \*args[, ...]) | Call function producing a same-indexed DataFrame on each group. | +| [`SeriesGroupBy.pipe`](api/pandas.core.groupby.SeriesGroupBy.pipe.html#pandas.core.groupby.SeriesGroupBy.pipe "pandas.core.groupby.SeriesGroupBy.pipe")(func, \*args, \*\*kwargs) | Apply a `func` with arguments to this GroupBy object and return its result. | +| [`DataFrameGroupBy.pipe`](api/pandas.core.groupby.DataFrameGroupBy.pipe.html#pandas.core.groupby.DataFrameGroupBy.pipe "pandas.core.groupby.DataFrameGroupBy.pipe")(func, \*args, \*\*kwargs) | Apply a `func` with arguments to this GroupBy object and return its result. | +| [`DataFrameGroupBy.filter`](api/pandas.core.groupby.DataFrameGroupBy.filter.html#pandas.core.groupby.DataFrameGroupBy.filter "pandas.core.groupby.DataFrameGroupBy.filter")(func[, dropna]) | Filter elements from groups that don't satisfy a criterion. | +| [`SeriesGroupBy.filter`](api/pandas.core.groupby.SeriesGroupBy.filter.html#pandas.core.groupby.SeriesGroupBy.filter "pandas.core.groupby.SeriesGroupBy.filter")(func[, dropna]) | Filter elements from groups that don't satisfy a criterion. | + +## `DataFrameGroupBy` computations / descriptive stats[#](#dataframegroupby-computations-descriptive-stats "Link to this heading") + +| | | +| --- | --- | +| [`DataFrameGroupBy.all`](api/pandas.core.groupby.DataFrameGroupBy.all.html#pandas.core.groupby.DataFrameGroupBy.all "pandas.core.groupby.DataFrameGroupBy.all")([skipna]) | Return True if all values in the group are truthful, else False. | +| [`DataFrameGroupBy.any`](api/pandas.core.groupby.DataFrameGroupBy.any.html#pandas.core.groupby.DataFrameGroupBy.any "pandas.core.groupby.DataFrameGroupBy.any")([skipna]) | Return True if any value in the group is truthful, else False. | +| [`DataFrameGroupBy.bfill`](api/pandas.core.groupby.DataFrameGroupBy.bfill.html#pandas.core.groupby.DataFrameGroupBy.bfill "pandas.core.groupby.DataFrameGroupBy.bfill")([limit]) | Backward fill the values. | +| [`DataFrameGroupBy.corr`](api/pandas.core.groupby.DataFrameGroupBy.corr.html#pandas.core.groupby.DataFrameGroupBy.corr "pandas.core.groupby.DataFrameGroupBy.corr")([method, min\_periods, ...]) | Compute pairwise correlation of columns, excluding NA/null values. | +| [`DataFrameGroupBy.corrwith`](api/pandas.core.groupby.DataFrameGroupBy.corrwith.html#pandas.core.groupby.DataFrameGroupBy.corrwith "pandas.core.groupby.DataFrameGroupBy.corrwith")(other[, axis, ...]) | Compute pairwise correlation. | +| [`DataFrameGroupBy.count`](api/pandas.core.groupby.DataFrameGroupBy.count.html#pandas.core.groupby.DataFrameGroupBy.count "pandas.core.groupby.DataFrameGroupBy.count")() | Compute count of group, excluding missing values. | +| [`DataFrameGroupBy.cov`](api/pandas.core.groupby.DataFrameGroupBy.cov.html#pandas.core.groupby.DataFrameGroupBy.cov "pandas.core.groupby.DataFrameGroupBy.cov")([min\_periods, ddof, ...]) | Compute pairwise covariance of columns, excluding NA/null values. | +| [`DataFrameGroupBy.cumcount`](api/pandas.core.groupby.DataFrameGroupBy.cumcount.html#pandas.core.groupby.DataFrameGroupBy.cumcount "pandas.core.groupby.DataFrameGroupBy.cumcount")([ascending]) | Number each item in each group from 0 to the length of that group - 1. | +| [`DataFrameGroupBy.cummax`](api/pandas.core.groupby.DataFrameGroupBy.cummax.html#pandas.core.groupby.DataFrameGroupBy.cummax "pandas.core.groupby.DataFrameGroupBy.cummax")([axis, numeric\_only]) | Cumulative max for each group. | +| [`DataFrameGroupBy.cummin`](api/pandas.core.groupby.DataFrameGroupBy.cummin.html#pandas.core.groupby.DataFrameGroupBy.cummin "pandas.core.groupby.DataFrameGroupBy.cummin")([axis, numeric\_only]) | Cumulative min for each group. | +| [`DataFrameGroupBy.cumprod`](api/pandas.core.groupby.DataFrameGroupBy.cumprod.html#pandas.core.groupby.DataFrameGroupBy.cumprod "pandas.core.groupby.DataFrameGroupBy.cumprod")([axis]) | Cumulative product for each group. | +| [`DataFrameGroupBy.cumsum`](api/pandas.core.groupby.DataFrameGroupBy.cumsum.html#pandas.core.groupby.DataFrameGroupBy.cumsum "pandas.core.groupby.DataFrameGroupBy.cumsum")([axis]) | Cumulative sum for each group. | +| [`DataFrameGroupBy.describe`](api/pandas.core.groupby.DataFrameGroupBy.describe.html#pandas.core.groupby.DataFrameGroupBy.describe "pandas.core.groupby.DataFrameGroupBy.describe")([percentiles, ...]) | Generate descriptive statistics. | +| [`DataFrameGroupBy.diff`](api/pandas.core.groupby.DataFrameGroupBy.diff.html#pandas.core.groupby.DataFrameGroupBy.diff "pandas.core.groupby.DataFrameGroupBy.diff")([periods, axis]) | First discrete difference of element. | +| [`DataFrameGroupBy.ffill`](api/pandas.core.groupby.DataFrameGroupBy.ffill.html#pandas.core.groupby.DataFrameGroupBy.ffill "pandas.core.groupby.DataFrameGroupBy.ffill")([limit]) | Forward fill the values. | +| [`DataFrameGroupBy.fillna`](api/pandas.core.groupby.DataFrameGroupBy.fillna.html#pandas.core.groupby.DataFrameGroupBy.fillna "pandas.core.groupby.DataFrameGroupBy.fillna")([value, method, ...]) | (DEPRECATED) Fill NA/NaN values using the specified method within groups. | +| [`DataFrameGroupBy.first`](api/pandas.core.groupby.DataFrameGroupBy.first.html#pandas.core.groupby.DataFrameGroupBy.first "pandas.core.groupby.DataFrameGroupBy.first")([numeric\_only, ...]) | Compute the first entry of each column within each group. | +| [`DataFrameGroupBy.head`](api/pandas.core.groupby.DataFrameGroupBy.head.html#pandas.core.groupby.DataFrameGroupBy.head "pandas.core.groupby.DataFrameGroupBy.head")([n]) | Return first n rows of each group. | +| [`DataFrameGroupBy.idxmax`](api/pandas.core.groupby.DataFrameGroupBy.idxmax.html#pandas.core.groupby.DataFrameGroupBy.idxmax "pandas.core.groupby.DataFrameGroupBy.idxmax")([axis, skipna, ...]) | Return index of first occurrence of maximum over requested axis. | +| [`DataFrameGroupBy.idxmin`](api/pandas.core.groupby.DataFrameGroupBy.idxmin.html#pandas.core.groupby.DataFrameGroupBy.idxmin "pandas.core.groupby.DataFrameGroupBy.idxmin")([axis, skipna, ...]) | Return index of first occurrence of minimum over requested axis. | +| [`DataFrameGroupBy.last`](api/pandas.core.groupby.DataFrameGroupBy.last.html#pandas.core.groupby.DataFrameGroupBy.last "pandas.core.groupby.DataFrameGroupBy.last")([numeric\_only, ...]) | Compute the last entry of each column within each group. | +| [`DataFrameGroupBy.max`](api/pandas.core.groupby.DataFrameGroupBy.max.html#pandas.core.groupby.DataFrameGroupBy.max "pandas.core.groupby.DataFrameGroupBy.max")([numeric\_only, ...]) | Compute max of group values. | +| [`DataFrameGroupBy.mean`](api/pandas.core.groupby.DataFrameGroupBy.mean.html#pandas.core.groupby.DataFrameGroupBy.mean "pandas.core.groupby.DataFrameGroupBy.mean")([numeric\_only, ...]) | Compute mean of groups, excluding missing values. | +| [`DataFrameGroupBy.median`](api/pandas.core.groupby.DataFrameGroupBy.median.html#pandas.core.groupby.DataFrameGroupBy.median "pandas.core.groupby.DataFrameGroupBy.median")([numeric\_only]) | Compute median of groups, excluding missing values. | +| [`DataFrameGroupBy.min`](api/pandas.core.groupby.DataFrameGroupBy.min.html#pandas.core.groupby.DataFrameGroupBy.min "pandas.core.groupby.DataFrameGroupBy.min")([numeric\_only, ...]) | Compute min of group values. | +| [`DataFrameGroupBy.ngroup`](api/pandas.core.groupby.DataFrameGroupBy.ngroup.html#pandas.core.groupby.DataFrameGroupBy.ngroup "pandas.core.groupby.DataFrameGroupBy.ngroup")([ascending]) | Number each group from 0 to the number of groups - 1. | +| [`DataFrameGroupBy.nth`](api/pandas.core.groupby.DataFrameGroupBy.nth.html#pandas.core.groupby.DataFrameGroupBy.nth "pandas.core.groupby.DataFrameGroupBy.nth") | Take the nth row from each group if n is an int, otherwise a subset of rows. | +| [`DataFrameGroupBy.nunique`](api/pandas.core.groupby.DataFrameGroupBy.nunique.html#pandas.core.groupby.DataFrameGroupBy.nunique "pandas.core.groupby.DataFrameGroupBy.nunique")([dropna]) | Return DataFrame with counts of unique elements in each position. | +| [`DataFrameGroupBy.ohlc`](api/pandas.core.groupby.DataFrameGroupBy.ohlc.html#pandas.core.groupby.DataFrameGroupBy.ohlc "pandas.core.groupby.DataFrameGroupBy.ohlc")() | Compute open, high, low and close values of a group, excluding missing values. | +| [`DataFrameGroupBy.pct_change`](api/pandas.core.groupby.DataFrameGroupBy.pct_change.html#pandas.core.groupby.DataFrameGroupBy.pct_change "pandas.core.groupby.DataFrameGroupBy.pct_change")([periods, ...]) | Calculate pct\_change of each value to previous entry in group. | +| [`DataFrameGroupBy.prod`](api/pandas.core.groupby.DataFrameGroupBy.prod.html#pandas.core.groupby.DataFrameGroupBy.prod "pandas.core.groupby.DataFrameGroupBy.prod")([numeric\_only, min\_count]) | Compute prod of group values. | +| [`DataFrameGroupBy.quantile`](api/pandas.core.groupby.DataFrameGroupBy.quantile.html#pandas.core.groupby.DataFrameGroupBy.quantile "pandas.core.groupby.DataFrameGroupBy.quantile")([q, ...]) | Return group values at the given quantile, a la numpy.percentile. | +| [`DataFrameGroupBy.rank`](api/pandas.core.groupby.DataFrameGroupBy.rank.html#pandas.core.groupby.DataFrameGroupBy.rank "pandas.core.groupby.DataFrameGroupBy.rank")([method, ascending, ...]) | Provide the rank of values within each group. | +| [`DataFrameGroupBy.resample`](api/pandas.core.groupby.DataFrameGroupBy.resample.html#pandas.core.groupby.DataFrameGroupBy.resample "pandas.core.groupby.DataFrameGroupBy.resample")(rule, \*args[, ...]) | Provide resampling when using a TimeGrouper. | +| [`DataFrameGroupBy.rolling`](api/pandas.core.groupby.DataFrameGroupBy.rolling.html#pandas.core.groupby.DataFrameGroupBy.rolling "pandas.core.groupby.DataFrameGroupBy.rolling")(\*args, \*\*kwargs) | Return a rolling grouper, providing rolling functionality per group. | +| [`DataFrameGroupBy.sample`](api/pandas.core.groupby.DataFrameGroupBy.sample.html#pandas.core.groupby.DataFrameGroupBy.sample "pandas.core.groupby.DataFrameGroupBy.sample")([n, frac, replace, ...]) | Return a random sample of items from each group. | +| [`DataFrameGroupBy.sem`](api/pandas.core.groupby.DataFrameGroupBy.sem.html#pandas.core.groupby.DataFrameGroupBy.sem "pandas.core.groupby.DataFrameGroupBy.sem")([ddof, numeric\_only]) | Compute standard error of the mean of groups, excluding missing values. | +| [`DataFrameGroupBy.shift`](api/pandas.core.groupby.DataFrameGroupBy.shift.html#pandas.core.groupby.DataFrameGroupBy.shift "pandas.core.groupby.DataFrameGroupBy.shift")([periods, freq, ...]) | Shift each group by periods observations. | +| [`DataFrameGroupBy.size`](api/pandas.core.groupby.DataFrameGroupBy.size.html#pandas.core.groupby.DataFrameGroupBy.size "pandas.core.groupby.DataFrameGroupBy.size")() | Compute group sizes. | +| [`DataFrameGroupBy.skew`](api/pandas.core.groupby.DataFrameGroupBy.skew.html#pandas.core.groupby.DataFrameGroupBy.skew "pandas.core.groupby.DataFrameGroupBy.skew")([axis, skipna, ...]) | Return unbiased skew within groups. | +| [`DataFrameGroupBy.std`](api/pandas.core.groupby.DataFrameGroupBy.std.html#pandas.core.groupby.DataFrameGroupBy.std "pandas.core.groupby.DataFrameGroupBy.std")([ddof, engine, ...]) | Compute standard deviation of groups, excluding missing values. | +| [`DataFrameGroupBy.sum`](api/pandas.core.groupby.DataFrameGroupBy.sum.html#pandas.core.groupby.DataFrameGroupBy.sum "pandas.core.groupby.DataFrameGroupBy.sum")([numeric\_only, ...]) | Compute sum of group values. | +| [`DataFrameGroupBy.var`](api/pandas.core.groupby.DataFrameGroupBy.var.html#pandas.core.groupby.DataFrameGroupBy.var "pandas.core.groupby.DataFrameGroupBy.var")([ddof, engine, ...]) | Compute variance of groups, excluding missing values. | +| [`DataFrameGroupBy.tail`](api/pandas.core.groupby.DataFrameGroupBy.tail.html#pandas.core.groupby.DataFrameGroupBy.tail "pandas.core.groupby.DataFrameGroupBy.tail")([n]) | Return last n rows of each group. | +| [`DataFrameGroupBy.take`](api/pandas.core.groupby.DataFrameGroupBy.take.html#pandas.core.groupby.DataFrameGroupBy.take "pandas.core.groupby.DataFrameGroupBy.take")(indices[, axis]) | Return the elements in the given *positional* indices in each group. | +| [`DataFrameGroupBy.value_counts`](api/pandas.core.groupby.DataFrameGroupBy.value_counts.html#pandas.core.groupby.DataFrameGroupBy.value_counts "pandas.core.groupby.DataFrameGroupBy.value_counts")([subset, ...]) | Return a Series or DataFrame containing counts of unique rows. | + +## `SeriesGroupBy` computations / descriptive stats[#](#seriesgroupby-computations-descriptive-stats "Link to this heading") + +| | | +| --- | --- | +| [`SeriesGroupBy.all`](api/pandas.core.groupby.SeriesGroupBy.all.html#pandas.core.groupby.SeriesGroupBy.all "pandas.core.groupby.SeriesGroupBy.all")([skipna]) | Return True if all values in the group are truthful, else False. | +| [`SeriesGroupBy.any`](api/pandas.core.groupby.SeriesGroupBy.any.html#pandas.core.groupby.SeriesGroupBy.any "pandas.core.groupby.SeriesGroupBy.any")([skipna]) | Return True if any value in the group is truthful, else False. | +| [`SeriesGroupBy.bfill`](api/pandas.core.groupby.SeriesGroupBy.bfill.html#pandas.core.groupby.SeriesGroupBy.bfill "pandas.core.groupby.SeriesGroupBy.bfill")([limit]) | Backward fill the values. | +| [`SeriesGroupBy.corr`](api/pandas.core.groupby.SeriesGroupBy.corr.html#pandas.core.groupby.SeriesGroupBy.corr "pandas.core.groupby.SeriesGroupBy.corr")(other[, method, min\_periods]) | Compute correlation with other Series, excluding missing values. | +| [`SeriesGroupBy.count`](api/pandas.core.groupby.SeriesGroupBy.count.html#pandas.core.groupby.SeriesGroupBy.count "pandas.core.groupby.SeriesGroupBy.count")() | Compute count of group, excluding missing values. | +| [`SeriesGroupBy.cov`](api/pandas.core.groupby.SeriesGroupBy.cov.html#pandas.core.groupby.SeriesGroupBy.cov "pandas.core.groupby.SeriesGroupBy.cov")(other[, min\_periods, ddof]) | Compute covariance with Series, excluding missing values. | +| [`SeriesGroupBy.cumcount`](api/pandas.core.groupby.SeriesGroupBy.cumcount.html#pandas.core.groupby.SeriesGroupBy.cumcount "pandas.core.groupby.SeriesGroupBy.cumcount")([ascending]) | Number each item in each group from 0 to the length of that group - 1. | +| [`SeriesGroupBy.cummax`](api/pandas.core.groupby.SeriesGroupBy.cummax.html#pandas.core.groupby.SeriesGroupBy.cummax "pandas.core.groupby.SeriesGroupBy.cummax")([axis, numeric\_only]) | Cumulative max for each group. | +| [`SeriesGroupBy.cummin`](api/pandas.core.groupby.SeriesGroupBy.cummin.html#pandas.core.groupby.SeriesGroupBy.cummin "pandas.core.groupby.SeriesGroupBy.cummin")([axis, numeric\_only]) | Cumulative min for each group. | +| [`SeriesGroupBy.cumprod`](api/pandas.core.groupby.SeriesGroupBy.cumprod.html#pandas.core.groupby.SeriesGroupBy.cumprod "pandas.core.groupby.SeriesGroupBy.cumprod")([axis]) | Cumulative product for each group. | +| [`SeriesGroupBy.cumsum`](api/pandas.core.groupby.SeriesGroupBy.cumsum.html#pandas.core.groupby.SeriesGroupBy.cumsum "pandas.core.groupby.SeriesGroupBy.cumsum")([axis]) | Cumulative sum for each group. | +| [`SeriesGroupBy.describe`](api/pandas.core.groupby.SeriesGroupBy.describe.html#pandas.core.groupby.SeriesGroupBy.describe "pandas.core.groupby.SeriesGroupBy.describe")([percentiles, ...]) | Generate descriptive statistics. | +| [`SeriesGroupBy.diff`](api/pandas.core.groupby.SeriesGroupBy.diff.html#pandas.core.groupby.SeriesGroupBy.diff "pandas.core.groupby.SeriesGroupBy.diff")([periods, axis]) | First discrete difference of element. | +| [`SeriesGroupBy.ffill`](api/pandas.core.groupby.SeriesGroupBy.ffill.html#pandas.core.groupby.SeriesGroupBy.ffill "pandas.core.groupby.SeriesGroupBy.ffill")([limit]) | Forward fill the values. | +| [`SeriesGroupBy.fillna`](api/pandas.core.groupby.SeriesGroupBy.fillna.html#pandas.core.groupby.SeriesGroupBy.fillna "pandas.core.groupby.SeriesGroupBy.fillna")([value, method, axis, ...]) | (DEPRECATED) Fill NA/NaN values using the specified method within groups. | +| [`SeriesGroupBy.first`](api/pandas.core.groupby.SeriesGroupBy.first.html#pandas.core.groupby.SeriesGroupBy.first "pandas.core.groupby.SeriesGroupBy.first")([numeric\_only, ...]) | Compute the first entry of each column within each group. | +| [`SeriesGroupBy.head`](api/pandas.core.groupby.SeriesGroupBy.head.html#pandas.core.groupby.SeriesGroupBy.head "pandas.core.groupby.SeriesGroupBy.head")([n]) | Return first n rows of each group. | +| [`SeriesGroupBy.last`](api/pandas.core.groupby.SeriesGroupBy.last.html#pandas.core.groupby.SeriesGroupBy.last "pandas.core.groupby.SeriesGroupBy.last")([numeric\_only, ...]) | Compute the last entry of each column within each group. | +| [`SeriesGroupBy.idxmax`](api/pandas.core.groupby.SeriesGroupBy.idxmax.html#pandas.core.groupby.SeriesGroupBy.idxmax "pandas.core.groupby.SeriesGroupBy.idxmax")([axis, skipna]) | Return the row label of the maximum value. | +| [`SeriesGroupBy.idxmin`](api/pandas.core.groupby.SeriesGroupBy.idxmin.html#pandas.core.groupby.SeriesGroupBy.idxmin "pandas.core.groupby.SeriesGroupBy.idxmin")([axis, skipna]) | Return the row label of the minimum value. | +| [`SeriesGroupBy.is_monotonic_increasing`](api/pandas.core.groupby.SeriesGroupBy.is_monotonic_increasing.html#pandas.core.groupby.SeriesGroupBy.is_monotonic_increasing "pandas.core.groupby.SeriesGroupBy.is_monotonic_increasing") | Return whether each group's values are monotonically increasing. | +| [`SeriesGroupBy.is_monotonic_decreasing`](api/pandas.core.groupby.SeriesGroupBy.is_monotonic_decreasing.html#pandas.core.groupby.SeriesGroupBy.is_monotonic_decreasing "pandas.core.groupby.SeriesGroupBy.is_monotonic_decreasing") | Return whether each group's values are monotonically decreasing. | +| [`SeriesGroupBy.max`](api/pandas.core.groupby.SeriesGroupBy.max.html#pandas.core.groupby.SeriesGroupBy.max "pandas.core.groupby.SeriesGroupBy.max")([numeric\_only, min\_count, ...]) | Compute max of group values. | +| [`SeriesGroupBy.mean`](api/pandas.core.groupby.SeriesGroupBy.mean.html#pandas.core.groupby.SeriesGroupBy.mean "pandas.core.groupby.SeriesGroupBy.mean")([numeric\_only, engine, ...]) | Compute mean of groups, excluding missing values. | +| [`SeriesGroupBy.median`](api/pandas.core.groupby.SeriesGroupBy.median.html#pandas.core.groupby.SeriesGroupBy.median "pandas.core.groupby.SeriesGroupBy.median")([numeric\_only]) | Compute median of groups, excluding missing values. | +| [`SeriesGroupBy.min`](api/pandas.core.groupby.SeriesGroupBy.min.html#pandas.core.groupby.SeriesGroupBy.min "pandas.core.groupby.SeriesGroupBy.min")([numeric\_only, min\_count, ...]) | Compute min of group values. | +| [`SeriesGroupBy.ngroup`](api/pandas.core.groupby.SeriesGroupBy.ngroup.html#pandas.core.groupby.SeriesGroupBy.ngroup "pandas.core.groupby.SeriesGroupBy.ngroup")([ascending]) | Number each group from 0 to the number of groups - 1. | +| [`SeriesGroupBy.nlargest`](api/pandas.core.groupby.SeriesGroupBy.nlargest.html#pandas.core.groupby.SeriesGroupBy.nlargest "pandas.core.groupby.SeriesGroupBy.nlargest")([n, keep]) | Return the largest n elements. | +| [`SeriesGroupBy.nsmallest`](api/pandas.core.groupby.SeriesGroupBy.nsmallest.html#pandas.core.groupby.SeriesGroupBy.nsmallest "pandas.core.groupby.SeriesGroupBy.nsmallest")([n, keep]) | Return the smallest n elements. | +| [`SeriesGroupBy.nth`](api/pandas.core.groupby.SeriesGroupBy.nth.html#pandas.core.groupby.SeriesGroupBy.nth "pandas.core.groupby.SeriesGroupBy.nth") | Take the nth row from each group if n is an int, otherwise a subset of rows. | +| [`SeriesGroupBy.nunique`](api/pandas.core.groupby.SeriesGroupBy.nunique.html#pandas.core.groupby.SeriesGroupBy.nunique "pandas.core.groupby.SeriesGroupBy.nunique")([dropna]) | Return number of unique elements in the group. | +| [`SeriesGroupBy.unique`](api/pandas.core.groupby.SeriesGroupBy.unique.html#pandas.core.groupby.SeriesGroupBy.unique "pandas.core.groupby.SeriesGroupBy.unique")() | Return unique values for each group. | +| [`SeriesGroupBy.ohlc`](api/pandas.core.groupby.SeriesGroupBy.ohlc.html#pandas.core.groupby.SeriesGroupBy.ohlc "pandas.core.groupby.SeriesGroupBy.ohlc")() | Compute open, high, low and close values of a group, excluding missing values. | +| [`SeriesGroupBy.pct_change`](api/pandas.core.groupby.SeriesGroupBy.pct_change.html#pandas.core.groupby.SeriesGroupBy.pct_change "pandas.core.groupby.SeriesGroupBy.pct_change")([periods, ...]) | Calculate pct\_change of each value to previous entry in group. | +| [`SeriesGroupBy.prod`](api/pandas.core.groupby.SeriesGroupBy.prod.html#pandas.core.groupby.SeriesGroupBy.prod "pandas.core.groupby.SeriesGroupBy.prod")([numeric\_only, min\_count]) | Compute prod of group values. | +| [`SeriesGroupBy.quantile`](api/pandas.core.groupby.SeriesGroupBy.quantile.html#pandas.core.groupby.SeriesGroupBy.quantile "pandas.core.groupby.SeriesGroupBy.quantile")([q, interpolation, ...]) | Return group values at the given quantile, a la numpy.percentile. | +| [`SeriesGroupBy.rank`](api/pandas.core.groupby.SeriesGroupBy.rank.html#pandas.core.groupby.SeriesGroupBy.rank "pandas.core.groupby.SeriesGroupBy.rank")([method, ascending, ...]) | Provide the rank of values within each group. | +| [`SeriesGroupBy.resample`](api/pandas.core.groupby.SeriesGroupBy.resample.html#pandas.core.groupby.SeriesGroupBy.resample "pandas.core.groupby.SeriesGroupBy.resample")(rule, \*args[, ...]) | Provide resampling when using a TimeGrouper. | +| [`SeriesGroupBy.rolling`](api/pandas.core.groupby.SeriesGroupBy.rolling.html#pandas.core.groupby.SeriesGroupBy.rolling "pandas.core.groupby.SeriesGroupBy.rolling")(\*args, \*\*kwargs) | Return a rolling grouper, providing rolling functionality per group. | +| [`SeriesGroupBy.sample`](api/pandas.core.groupby.SeriesGroupBy.sample.html#pandas.core.groupby.SeriesGroupBy.sample "pandas.core.groupby.SeriesGroupBy.sample")([n, frac, replace, ...]) | Return a random sample of items from each group. | +| [`SeriesGroupBy.sem`](api/pandas.core.groupby.SeriesGroupBy.sem.html#pandas.core.groupby.SeriesGroupBy.sem "pandas.core.groupby.SeriesGroupBy.sem")([ddof, numeric\_only]) | Compute standard error of the mean of groups, excluding missing values. | +| [`SeriesGroupBy.shift`](api/pandas.core.groupby.SeriesGroupBy.shift.html#pandas.core.groupby.SeriesGroupBy.shift "pandas.core.groupby.SeriesGroupBy.shift")([periods, freq, axis, ...]) | Shift each group by periods observations. | +| [`SeriesGroupBy.size`](api/pandas.core.groupby.SeriesGroupBy.size.html#pandas.core.groupby.SeriesGroupBy.size "pandas.core.groupby.SeriesGroupBy.size")() | Compute group sizes. | +| [`SeriesGroupBy.skew`](api/pandas.core.groupby.SeriesGroupBy.skew.html#pandas.core.groupby.SeriesGroupBy.skew "pandas.core.groupby.SeriesGroupBy.skew")([axis, skipna, numeric\_only]) | Return unbiased skew within groups. | +| [`SeriesGroupBy.std`](api/pandas.core.groupby.SeriesGroupBy.std.html#pandas.core.groupby.SeriesGroupBy.std "pandas.core.groupby.SeriesGroupBy.std")([ddof, engine, ...]) | Compute standard deviation of groups, excluding missing values. | +| [`SeriesGroupBy.sum`](api/pandas.core.groupby.SeriesGroupBy.sum.html#pandas.core.groupby.SeriesGroupBy.sum "pandas.core.groupby.SeriesGroupBy.sum")([numeric\_only, min\_count, ...]) | Compute sum of group values. | +| [`SeriesGroupBy.var`](api/pandas.core.groupby.SeriesGroupBy.var.html#pandas.core.groupby.SeriesGroupBy.var "pandas.core.groupby.SeriesGroupBy.var")([ddof, engine, ...]) | Compute variance of groups, excluding missing values. | +| [`SeriesGroupBy.tail`](api/pandas.core.groupby.SeriesGroupBy.tail.html#pandas.core.groupby.SeriesGroupBy.tail "pandas.core.groupby.SeriesGroupBy.tail")([n]) | Return last n rows of each group. | +| [`SeriesGroupBy.take`](api/pandas.core.groupby.SeriesGroupBy.take.html#pandas.core.groupby.SeriesGroupBy.take "pandas.core.groupby.SeriesGroupBy.take")(indices[, axis]) | Return the elements in the given *positional* indices in each group. | +| [`SeriesGroupBy.value_counts`](api/pandas.core.groupby.SeriesGroupBy.value_counts.html#pandas.core.groupby.SeriesGroupBy.value_counts "pandas.core.groupby.SeriesGroupBy.value_counts")([normalize, ...]) | | + +## Plotting and visualization[#](#plotting-and-visualization "Link to this heading") + +| | | +| --- | --- | +| [`DataFrameGroupBy.boxplot`](api/pandas.core.groupby.DataFrameGroupBy.boxplot.html#pandas.core.groupby.DataFrameGroupBy.boxplot "pandas.core.groupby.DataFrameGroupBy.boxplot")([subplots, column, ...]) | Make box plots from DataFrameGroupBy data. | +| [`DataFrameGroupBy.hist`](api/pandas.core.groupby.DataFrameGroupBy.hist.html#pandas.core.groupby.DataFrameGroupBy.hist "pandas.core.groupby.DataFrameGroupBy.hist")([column, by, grid, ...]) | Make a histogram of the DataFrame's columns. | +| [`SeriesGroupBy.hist`](api/pandas.core.groupby.SeriesGroupBy.hist.html#pandas.core.groupby.SeriesGroupBy.hist "pandas.core.groupby.SeriesGroupBy.hist")([by, ax, grid, ...]) | Draw histogram of the input series using matplotlib. | +| [`DataFrameGroupBy.plot`](api/pandas.core.groupby.DataFrameGroupBy.plot.html#pandas.core.groupby.DataFrameGroupBy.plot "pandas.core.groupby.DataFrameGroupBy.plot") | Make plots of Series or DataFrame. | +| [`SeriesGroupBy.plot`](api/pandas.core.groupby.SeriesGroupBy.plot.html#pandas.core.groupby.SeriesGroupBy.plot "pandas.core.groupby.SeriesGroupBy.plot") | Make plots of Series or DataFrame. | diff --git a/corpus/docs/pandas/groupby/groupby_30.md b/corpus/docs/pandas/groupby/groupby_30.md new file mode 100644 index 0000000000000000000000000000000000000000..67ba15f8a22d2ea1ecfaeea6435074373850e8ac --- /dev/null +++ b/corpus/docs/pandas/groupby/groupby_30.md @@ -0,0 +1,168 @@ +# GroupBy# + +Source: https://pandas.pydata.org/pandas-docs/version/3.0/reference/groupby.html +Version: 3.0 + +`pandas.api.typing.DataFrameGroupBy` and `pandas.api.typing.SeriesGroupBy` +instances are returned by groupby calls [`pandas.DataFrame.groupby()`](api/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby "pandas.DataFrame.groupby") and +[`pandas.Series.groupby()`](api/pandas.Series.groupby.html#pandas.Series.groupby "pandas.Series.groupby") respectively. + +## Indexing, iteration[#](#indexing-iteration "Link to this heading") + +| | | +| --- | --- | +| [`DataFrameGroupBy.__iter__`](api/pandas.api.typing.DataFrameGroupBy.__iter__.html#pandas.api.typing.DataFrameGroupBy.__iter__ "pandas.api.typing.DataFrameGroupBy.__iter__")() | Groupby iterator. | +| [`SeriesGroupBy.__iter__`](api/pandas.api.typing.SeriesGroupBy.__iter__.html#pandas.api.typing.SeriesGroupBy.__iter__ "pandas.api.typing.SeriesGroupBy.__iter__")() | Groupby iterator. | +| [`DataFrameGroupBy.groups`](api/pandas.api.typing.DataFrameGroupBy.groups.html#pandas.api.typing.DataFrameGroupBy.groups "pandas.api.typing.DataFrameGroupBy.groups") | Dict {group name -> group labels}. | +| [`SeriesGroupBy.groups`](api/pandas.api.typing.SeriesGroupBy.groups.html#pandas.api.typing.SeriesGroupBy.groups "pandas.api.typing.SeriesGroupBy.groups") | Dict {group name -> group labels}. | +| [`DataFrameGroupBy.indices`](api/pandas.api.typing.DataFrameGroupBy.indices.html#pandas.api.typing.DataFrameGroupBy.indices "pandas.api.typing.DataFrameGroupBy.indices") | Dict {group name -> group indices}. | +| [`SeriesGroupBy.indices`](api/pandas.api.typing.SeriesGroupBy.indices.html#pandas.api.typing.SeriesGroupBy.indices "pandas.api.typing.SeriesGroupBy.indices") | Dict {group name -> group indices}. | +| [`DataFrameGroupBy.get_group`](api/pandas.api.typing.DataFrameGroupBy.get_group.html#pandas.api.typing.DataFrameGroupBy.get_group "pandas.api.typing.DataFrameGroupBy.get_group")(name) | Construct DataFrame from group with provided name. | +| [`SeriesGroupBy.get_group`](api/pandas.api.typing.SeriesGroupBy.get_group.html#pandas.api.typing.SeriesGroupBy.get_group "pandas.api.typing.SeriesGroupBy.get_group")(name) | Construct DataFrame from group with provided name. | + +| | | +| --- | --- | +| [`Grouper`](api/pandas.Grouper.html#pandas.Grouper "pandas.Grouper")(\*args, \*\*kwargs) | A Grouper allows the user to specify a groupby instruction for an object. | + +## Function application helper[#](#function-application-helper "Link to this heading") + +| | | +| --- | --- | +| [`NamedAgg`](api/pandas.NamedAgg.html#pandas.NamedAgg "pandas.NamedAgg")(column, aggfunc, \*args, \*\*kwargs) | Helper for column specific aggregation with control over output column names. | + +## Function application[#](#function-application "Link to this heading") + +| | | +| --- | --- | +| [`SeriesGroupBy.apply`](api/pandas.api.typing.SeriesGroupBy.apply.html#pandas.api.typing.SeriesGroupBy.apply "pandas.api.typing.SeriesGroupBy.apply")(func, \*args, \*\*kwargs) | Apply function `func` group-wise and combine the results together. | +| [`DataFrameGroupBy.apply`](api/pandas.api.typing.DataFrameGroupBy.apply.html#pandas.api.typing.DataFrameGroupBy.apply "pandas.api.typing.DataFrameGroupBy.apply")(func, \*args[, ...]) | Apply function `func` group-wise and combine the results together. | +| [`SeriesGroupBy.agg`](api/pandas.api.typing.SeriesGroupBy.agg.html#pandas.api.typing.SeriesGroupBy.agg "pandas.api.typing.SeriesGroupBy.agg")([func, engine, engine\_kwargs]) | Aggregate using one or more operations. | +| [`DataFrameGroupBy.agg`](api/pandas.api.typing.DataFrameGroupBy.agg.html#pandas.api.typing.DataFrameGroupBy.agg "pandas.api.typing.DataFrameGroupBy.agg")([func, engine, ...]) | Aggregate using one or more operations. | +| [`SeriesGroupBy.aggregate`](api/pandas.api.typing.SeriesGroupBy.aggregate.html#pandas.api.typing.SeriesGroupBy.aggregate "pandas.api.typing.SeriesGroupBy.aggregate")([func, engine, ...]) | Aggregate using one or more operations. | +| [`DataFrameGroupBy.aggregate`](api/pandas.api.typing.DataFrameGroupBy.aggregate.html#pandas.api.typing.DataFrameGroupBy.aggregate "pandas.api.typing.DataFrameGroupBy.aggregate")([func, engine, ...]) | Aggregate using one or more operations. | +| [`SeriesGroupBy.transform`](api/pandas.api.typing.SeriesGroupBy.transform.html#pandas.api.typing.SeriesGroupBy.transform "pandas.api.typing.SeriesGroupBy.transform")(func, \*args[, ...]) | Call function producing a same-indexed Series on each group. | +| [`DataFrameGroupBy.transform`](api/pandas.api.typing.DataFrameGroupBy.transform.html#pandas.api.typing.DataFrameGroupBy.transform "pandas.api.typing.DataFrameGroupBy.transform")(func, \*args[, ...]) | Call function producing a same-indexed DataFrame on each group. | +| [`SeriesGroupBy.pipe`](api/pandas.api.typing.SeriesGroupBy.pipe.html#pandas.api.typing.SeriesGroupBy.pipe "pandas.api.typing.SeriesGroupBy.pipe")(func, \*args, \*\*kwargs) | Apply a `func` with arguments to this GroupBy object and return its result. | +| [`DataFrameGroupBy.pipe`](api/pandas.api.typing.DataFrameGroupBy.pipe.html#pandas.api.typing.DataFrameGroupBy.pipe "pandas.api.typing.DataFrameGroupBy.pipe")(func, \*args, \*\*kwargs) | Apply a `func` with arguments to this GroupBy object and return its result. | +| [`DataFrameGroupBy.filter`](api/pandas.api.typing.DataFrameGroupBy.filter.html#pandas.api.typing.DataFrameGroupBy.filter "pandas.api.typing.DataFrameGroupBy.filter")(func[, dropna]) | Filter elements from groups that don't satisfy a criterion. | +| [`SeriesGroupBy.filter`](api/pandas.api.typing.SeriesGroupBy.filter.html#pandas.api.typing.SeriesGroupBy.filter "pandas.api.typing.SeriesGroupBy.filter")(func[, dropna]) | Filter elements from groups that don't satisfy a criterion. | + +## `DataFrameGroupBy` computations / descriptive stats[#](#dataframegroupby-computations-descriptive-stats "Link to this heading") + +| | | +| --- | --- | +| [`DataFrameGroupBy.all`](api/pandas.api.typing.DataFrameGroupBy.all.html#pandas.api.typing.DataFrameGroupBy.all "pandas.api.typing.DataFrameGroupBy.all")([skipna]) | Return True if all values in the group are truthful, else False. | +| [`DataFrameGroupBy.any`](api/pandas.api.typing.DataFrameGroupBy.any.html#pandas.api.typing.DataFrameGroupBy.any "pandas.api.typing.DataFrameGroupBy.any")([skipna]) | Return True if any value in the group is truthful, else False. | +| [`DataFrameGroupBy.bfill`](api/pandas.api.typing.DataFrameGroupBy.bfill.html#pandas.api.typing.DataFrameGroupBy.bfill "pandas.api.typing.DataFrameGroupBy.bfill")([limit]) | Backward fill the values. | +| [`DataFrameGroupBy.corr`](api/pandas.api.typing.DataFrameGroupBy.corr.html#pandas.api.typing.DataFrameGroupBy.corr "pandas.api.typing.DataFrameGroupBy.corr")([method, min\_periods, ...]) | Compute pairwise correlation of columns, excluding NA/null values. | +| [`DataFrameGroupBy.corrwith`](api/pandas.api.typing.DataFrameGroupBy.corrwith.html#pandas.api.typing.DataFrameGroupBy.corrwith "pandas.api.typing.DataFrameGroupBy.corrwith")(other[, drop, ...]) | (DEPRECATED) Compute pairwise correlation. | +| [`DataFrameGroupBy.count`](api/pandas.api.typing.DataFrameGroupBy.count.html#pandas.api.typing.DataFrameGroupBy.count "pandas.api.typing.DataFrameGroupBy.count")() | Compute count of group, excluding missing values. | +| [`DataFrameGroupBy.cov`](api/pandas.api.typing.DataFrameGroupBy.cov.html#pandas.api.typing.DataFrameGroupBy.cov "pandas.api.typing.DataFrameGroupBy.cov")([min\_periods, ddof, ...]) | Compute pairwise covariance of columns, excluding NA/null values. | +| [`DataFrameGroupBy.cumcount`](api/pandas.api.typing.DataFrameGroupBy.cumcount.html#pandas.api.typing.DataFrameGroupBy.cumcount "pandas.api.typing.DataFrameGroupBy.cumcount")([ascending]) | Number each item in each group from 0 to the length of that group - 1. | +| [`DataFrameGroupBy.cummax`](api/pandas.api.typing.DataFrameGroupBy.cummax.html#pandas.api.typing.DataFrameGroupBy.cummax "pandas.api.typing.DataFrameGroupBy.cummax")([numeric\_only]) | Cumulative max for each group. | +| [`DataFrameGroupBy.cummin`](api/pandas.api.typing.DataFrameGroupBy.cummin.html#pandas.api.typing.DataFrameGroupBy.cummin "pandas.api.typing.DataFrameGroupBy.cummin")([numeric\_only]) | Cumulative min for each group. | +| [`DataFrameGroupBy.cumprod`](api/pandas.api.typing.DataFrameGroupBy.cumprod.html#pandas.api.typing.DataFrameGroupBy.cumprod "pandas.api.typing.DataFrameGroupBy.cumprod")([numeric\_only]) | Cumulative product for each group. | +| [`DataFrameGroupBy.cumsum`](api/pandas.api.typing.DataFrameGroupBy.cumsum.html#pandas.api.typing.DataFrameGroupBy.cumsum "pandas.api.typing.DataFrameGroupBy.cumsum")([numeric\_only]) | Cumulative sum for each group. | +| [`DataFrameGroupBy.describe`](api/pandas.api.typing.DataFrameGroupBy.describe.html#pandas.api.typing.DataFrameGroupBy.describe "pandas.api.typing.DataFrameGroupBy.describe")([percentiles, ...]) | Generate descriptive statistics. | +| [`DataFrameGroupBy.diff`](api/pandas.api.typing.DataFrameGroupBy.diff.html#pandas.api.typing.DataFrameGroupBy.diff "pandas.api.typing.DataFrameGroupBy.diff")([periods]) | First discrete difference of element. | +| [`DataFrameGroupBy.ewm`](api/pandas.api.typing.DataFrameGroupBy.ewm.html#pandas.api.typing.DataFrameGroupBy.ewm "pandas.api.typing.DataFrameGroupBy.ewm")([com, span, halflife, ...]) | Return an ewm grouper, providing ewm functionality per group. | +| [`DataFrameGroupBy.expanding`](api/pandas.api.typing.DataFrameGroupBy.expanding.html#pandas.api.typing.DataFrameGroupBy.expanding "pandas.api.typing.DataFrameGroupBy.expanding")([min\_periods, method]) | Return an expanding grouper, providing expanding functionality per group. | +| [`DataFrameGroupBy.ffill`](api/pandas.api.typing.DataFrameGroupBy.ffill.html#pandas.api.typing.DataFrameGroupBy.ffill "pandas.api.typing.DataFrameGroupBy.ffill")([limit]) | Forward fill the values. | +| [`DataFrameGroupBy.first`](api/pandas.api.typing.DataFrameGroupBy.first.html#pandas.api.typing.DataFrameGroupBy.first "pandas.api.typing.DataFrameGroupBy.first")([numeric\_only, ...]) | Compute the first entry of each column within each group. | +| [`DataFrameGroupBy.head`](api/pandas.api.typing.DataFrameGroupBy.head.html#pandas.api.typing.DataFrameGroupBy.head "pandas.api.typing.DataFrameGroupBy.head")([n]) | Return first n rows of each group. | +| [`DataFrameGroupBy.idxmax`](api/pandas.api.typing.DataFrameGroupBy.idxmax.html#pandas.api.typing.DataFrameGroupBy.idxmax "pandas.api.typing.DataFrameGroupBy.idxmax")([skipna, numeric\_only]) | Return index of first occurrence of maximum in each group. | +| [`DataFrameGroupBy.idxmin`](api/pandas.api.typing.DataFrameGroupBy.idxmin.html#pandas.api.typing.DataFrameGroupBy.idxmin "pandas.api.typing.DataFrameGroupBy.idxmin")([skipna, numeric\_only]) | Return index of first occurrence of minimum in each group. | +| [`DataFrameGroupBy.last`](api/pandas.api.typing.DataFrameGroupBy.last.html#pandas.api.typing.DataFrameGroupBy.last "pandas.api.typing.DataFrameGroupBy.last")([numeric\_only, ...]) | Compute the last entry of each column within each group. | +| [`DataFrameGroupBy.max`](api/pandas.api.typing.DataFrameGroupBy.max.html#pandas.api.typing.DataFrameGroupBy.max "pandas.api.typing.DataFrameGroupBy.max")([numeric\_only, ...]) | Compute max of group values. | +| [`DataFrameGroupBy.mean`](api/pandas.api.typing.DataFrameGroupBy.mean.html#pandas.api.typing.DataFrameGroupBy.mean "pandas.api.typing.DataFrameGroupBy.mean")([numeric\_only, ...]) | Compute mean of groups, excluding missing values. | +| [`DataFrameGroupBy.median`](api/pandas.api.typing.DataFrameGroupBy.median.html#pandas.api.typing.DataFrameGroupBy.median "pandas.api.typing.DataFrameGroupBy.median")([numeric\_only, skipna]) | Compute median of groups, excluding missing values. | +| [`DataFrameGroupBy.min`](api/pandas.api.typing.DataFrameGroupBy.min.html#pandas.api.typing.DataFrameGroupBy.min "pandas.api.typing.DataFrameGroupBy.min")([numeric\_only, ...]) | Compute min of group values. | +| [`DataFrameGroupBy.ngroup`](api/pandas.api.typing.DataFrameGroupBy.ngroup.html#pandas.api.typing.DataFrameGroupBy.ngroup "pandas.api.typing.DataFrameGroupBy.ngroup")([ascending]) | Number each group from 0 to the number of groups - 1. | +| [`DataFrameGroupBy.nth`](api/pandas.api.typing.DataFrameGroupBy.nth.html#pandas.api.typing.DataFrameGroupBy.nth "pandas.api.typing.DataFrameGroupBy.nth") | Take the nth row from each group if n is an int, otherwise a subset of rows. | +| [`DataFrameGroupBy.nunique`](api/pandas.api.typing.DataFrameGroupBy.nunique.html#pandas.api.typing.DataFrameGroupBy.nunique "pandas.api.typing.DataFrameGroupBy.nunique")([dropna]) | Return DataFrame with counts of unique elements in each position. | +| [`DataFrameGroupBy.ohlc`](api/pandas.api.typing.DataFrameGroupBy.ohlc.html#pandas.api.typing.DataFrameGroupBy.ohlc "pandas.api.typing.DataFrameGroupBy.ohlc")() | Compute open, high, low and close values of a group, excluding missing values. | +| [`DataFrameGroupBy.pct_change`](api/pandas.api.typing.DataFrameGroupBy.pct_change.html#pandas.api.typing.DataFrameGroupBy.pct_change "pandas.api.typing.DataFrameGroupBy.pct_change")([periods, ...]) | Calculate pct\_change of each value to previous entry in group. | +| [`DataFrameGroupBy.prod`](api/pandas.api.typing.DataFrameGroupBy.prod.html#pandas.api.typing.DataFrameGroupBy.prod "pandas.api.typing.DataFrameGroupBy.prod")([numeric\_only, ...]) | Compute prod of group values. | +| [`DataFrameGroupBy.quantile`](api/pandas.api.typing.DataFrameGroupBy.quantile.html#pandas.api.typing.DataFrameGroupBy.quantile "pandas.api.typing.DataFrameGroupBy.quantile")([q, ...]) | Return group values at the given quantile, a la numpy.percentile. | +| [`DataFrameGroupBy.rank`](api/pandas.api.typing.DataFrameGroupBy.rank.html#pandas.api.typing.DataFrameGroupBy.rank "pandas.api.typing.DataFrameGroupBy.rank")([method, ascending, ...]) | Provide the rank of values within each group. | +| [`DataFrameGroupBy.resample`](api/pandas.api.typing.DataFrameGroupBy.resample.html#pandas.api.typing.DataFrameGroupBy.resample "pandas.api.typing.DataFrameGroupBy.resample")(rule, \*args[, ...]) | Provide resampling when using a TimeGrouper. | +| [`DataFrameGroupBy.rolling`](api/pandas.api.typing.DataFrameGroupBy.rolling.html#pandas.api.typing.DataFrameGroupBy.rolling "pandas.api.typing.DataFrameGroupBy.rolling")(window[, ...]) | Return a rolling grouper, providing rolling functionality per group. | +| [`DataFrameGroupBy.sample`](api/pandas.api.typing.DataFrameGroupBy.sample.html#pandas.api.typing.DataFrameGroupBy.sample "pandas.api.typing.DataFrameGroupBy.sample")([n, frac, replace, ...]) | Return a random sample of items from each group. | +| [`DataFrameGroupBy.sem`](api/pandas.api.typing.DataFrameGroupBy.sem.html#pandas.api.typing.DataFrameGroupBy.sem "pandas.api.typing.DataFrameGroupBy.sem")([ddof, numeric\_only, ...]) | Compute standard error of the mean of groups, excluding missing values. | +| [`DataFrameGroupBy.shift`](api/pandas.api.typing.DataFrameGroupBy.shift.html#pandas.api.typing.DataFrameGroupBy.shift "pandas.api.typing.DataFrameGroupBy.shift")([periods, freq, ...]) | Shift each group by periods observations. | +| [`DataFrameGroupBy.size`](api/pandas.api.typing.DataFrameGroupBy.size.html#pandas.api.typing.DataFrameGroupBy.size "pandas.api.typing.DataFrameGroupBy.size")() | Compute group sizes. | +| [`DataFrameGroupBy.skew`](api/pandas.api.typing.DataFrameGroupBy.skew.html#pandas.api.typing.DataFrameGroupBy.skew "pandas.api.typing.DataFrameGroupBy.skew")([skipna, numeric\_only]) | Return unbiased skew within groups. | +| [`DataFrameGroupBy.kurt`](api/pandas.api.typing.DataFrameGroupBy.kurt.html#pandas.api.typing.DataFrameGroupBy.kurt "pandas.api.typing.DataFrameGroupBy.kurt")([skipna, numeric\_only]) | Return unbiased kurtosis within groups. | +| [`DataFrameGroupBy.std`](api/pandas.api.typing.DataFrameGroupBy.std.html#pandas.api.typing.DataFrameGroupBy.std "pandas.api.typing.DataFrameGroupBy.std")([ddof, engine, ...]) | Compute standard deviation of groups, excluding missing values. | +| [`DataFrameGroupBy.sum`](api/pandas.api.typing.DataFrameGroupBy.sum.html#pandas.api.typing.DataFrameGroupBy.sum "pandas.api.typing.DataFrameGroupBy.sum")([numeric\_only, ...]) | Compute sum of group values. | +| [`DataFrameGroupBy.var`](api/pandas.api.typing.DataFrameGroupBy.var.html#pandas.api.typing.DataFrameGroupBy.var "pandas.api.typing.DataFrameGroupBy.var")([ddof, engine, ...]) | Compute variance of groups, excluding missing values. | +| [`DataFrameGroupBy.tail`](api/pandas.api.typing.DataFrameGroupBy.tail.html#pandas.api.typing.DataFrameGroupBy.tail "pandas.api.typing.DataFrameGroupBy.tail")([n]) | Return last n rows of each group. | +| [`DataFrameGroupBy.take`](api/pandas.api.typing.DataFrameGroupBy.take.html#pandas.api.typing.DataFrameGroupBy.take "pandas.api.typing.DataFrameGroupBy.take")(indices, \*\*kwargs) | Return the elements in the given *positional* indices in each group. | +| [`DataFrameGroupBy.value_counts`](api/pandas.api.typing.DataFrameGroupBy.value_counts.html#pandas.api.typing.DataFrameGroupBy.value_counts "pandas.api.typing.DataFrameGroupBy.value_counts")([subset, ...]) | Return a Series or DataFrame containing counts of unique rows. | + +## `SeriesGroupBy` computations / descriptive stats[#](#seriesgroupby-computations-descriptive-stats "Link to this heading") + +| | | +| --- | --- | +| [`SeriesGroupBy.all`](api/pandas.api.typing.SeriesGroupBy.all.html#pandas.api.typing.SeriesGroupBy.all "pandas.api.typing.SeriesGroupBy.all")([skipna]) | Return True if all values in the group are truthful, else False. | +| [`SeriesGroupBy.any`](api/pandas.api.typing.SeriesGroupBy.any.html#pandas.api.typing.SeriesGroupBy.any "pandas.api.typing.SeriesGroupBy.any")([skipna]) | Return True if any value in the group is truthful, else False. | +| [`SeriesGroupBy.bfill`](api/pandas.api.typing.SeriesGroupBy.bfill.html#pandas.api.typing.SeriesGroupBy.bfill "pandas.api.typing.SeriesGroupBy.bfill")([limit]) | Backward fill the values. | +| [`SeriesGroupBy.corr`](api/pandas.api.typing.SeriesGroupBy.corr.html#pandas.api.typing.SeriesGroupBy.corr "pandas.api.typing.SeriesGroupBy.corr")(other[, method, min\_periods]) | Compute correlation between each group and another Series. | +| [`SeriesGroupBy.count`](api/pandas.api.typing.SeriesGroupBy.count.html#pandas.api.typing.SeriesGroupBy.count "pandas.api.typing.SeriesGroupBy.count")() | Compute count of group, excluding missing values. | +| [`SeriesGroupBy.cov`](api/pandas.api.typing.SeriesGroupBy.cov.html#pandas.api.typing.SeriesGroupBy.cov "pandas.api.typing.SeriesGroupBy.cov")(other[, min\_periods, ddof]) | Compute covariance between each group and another Series. | +| [`SeriesGroupBy.cumcount`](api/pandas.api.typing.SeriesGroupBy.cumcount.html#pandas.api.typing.SeriesGroupBy.cumcount "pandas.api.typing.SeriesGroupBy.cumcount")([ascending]) | Number each item in each group from 0 to the length of that group - 1. | +| [`SeriesGroupBy.cummax`](api/pandas.api.typing.SeriesGroupBy.cummax.html#pandas.api.typing.SeriesGroupBy.cummax "pandas.api.typing.SeriesGroupBy.cummax")([numeric\_only]) | Cumulative max for each group. | +| [`SeriesGroupBy.cummin`](api/pandas.api.typing.SeriesGroupBy.cummin.html#pandas.api.typing.SeriesGroupBy.cummin "pandas.api.typing.SeriesGroupBy.cummin")([numeric\_only]) | Cumulative min for each group. | +| [`SeriesGroupBy.cumprod`](api/pandas.api.typing.SeriesGroupBy.cumprod.html#pandas.api.typing.SeriesGroupBy.cumprod "pandas.api.typing.SeriesGroupBy.cumprod")([numeric\_only]) | Cumulative product for each group. | +| [`SeriesGroupBy.cumsum`](api/pandas.api.typing.SeriesGroupBy.cumsum.html#pandas.api.typing.SeriesGroupBy.cumsum "pandas.api.typing.SeriesGroupBy.cumsum")([numeric\_only]) | Cumulative sum for each group. | +| [`SeriesGroupBy.describe`](api/pandas.api.typing.SeriesGroupBy.describe.html#pandas.api.typing.SeriesGroupBy.describe "pandas.api.typing.SeriesGroupBy.describe")([percentiles, ...]) | Generate descriptive statistics. | +| [`SeriesGroupBy.diff`](api/pandas.api.typing.SeriesGroupBy.diff.html#pandas.api.typing.SeriesGroupBy.diff "pandas.api.typing.SeriesGroupBy.diff")([periods]) | First discrete difference of element. | +| [`SeriesGroupBy.ewm`](api/pandas.api.typing.SeriesGroupBy.ewm.html#pandas.api.typing.SeriesGroupBy.ewm "pandas.api.typing.SeriesGroupBy.ewm")([com, span, halflife, ...]) | Return an ewm grouper, providing ewm functionality per group. | +| [`SeriesGroupBy.expanding`](api/pandas.api.typing.SeriesGroupBy.expanding.html#pandas.api.typing.SeriesGroupBy.expanding "pandas.api.typing.SeriesGroupBy.expanding")([min\_periods, method]) | Return an expanding grouper, providing expanding functionality per group. | +| [`SeriesGroupBy.ffill`](api/pandas.api.typing.SeriesGroupBy.ffill.html#pandas.api.typing.SeriesGroupBy.ffill "pandas.api.typing.SeriesGroupBy.ffill")([limit]) | Forward fill the values. | +| [`SeriesGroupBy.first`](api/pandas.api.typing.SeriesGroupBy.first.html#pandas.api.typing.SeriesGroupBy.first "pandas.api.typing.SeriesGroupBy.first")([numeric\_only, ...]) | Compute the first entry of each column within each group. | +| [`SeriesGroupBy.head`](api/pandas.api.typing.SeriesGroupBy.head.html#pandas.api.typing.SeriesGroupBy.head "pandas.api.typing.SeriesGroupBy.head")([n]) | Return first n rows of each group. | +| [`SeriesGroupBy.last`](api/pandas.api.typing.SeriesGroupBy.last.html#pandas.api.typing.SeriesGroupBy.last "pandas.api.typing.SeriesGroupBy.last")([numeric\_only, ...]) | Compute the last entry of each column within each group. | +| [`SeriesGroupBy.idxmax`](api/pandas.api.typing.SeriesGroupBy.idxmax.html#pandas.api.typing.SeriesGroupBy.idxmax "pandas.api.typing.SeriesGroupBy.idxmax")([skipna]) | Return the row label of the maximum value. | +| [`SeriesGroupBy.idxmin`](api/pandas.api.typing.SeriesGroupBy.idxmin.html#pandas.api.typing.SeriesGroupBy.idxmin "pandas.api.typing.SeriesGroupBy.idxmin")([skipna]) | Return the row label of the minimum value. | +| [`SeriesGroupBy.is_monotonic_increasing`](api/pandas.api.typing.SeriesGroupBy.is_monotonic_increasing.html#pandas.api.typing.SeriesGroupBy.is_monotonic_increasing "pandas.api.typing.SeriesGroupBy.is_monotonic_increasing") | Return whether each group's values are monotonically increasing. | +| [`SeriesGroupBy.is_monotonic_decreasing`](api/pandas.api.typing.SeriesGroupBy.is_monotonic_decreasing.html#pandas.api.typing.SeriesGroupBy.is_monotonic_decreasing "pandas.api.typing.SeriesGroupBy.is_monotonic_decreasing") | Return whether each group's values are monotonically decreasing. | +| [`SeriesGroupBy.max`](api/pandas.api.typing.SeriesGroupBy.max.html#pandas.api.typing.SeriesGroupBy.max "pandas.api.typing.SeriesGroupBy.max")([numeric\_only, min\_count, ...]) | Compute max of group values. | +| [`SeriesGroupBy.mean`](api/pandas.api.typing.SeriesGroupBy.mean.html#pandas.api.typing.SeriesGroupBy.mean "pandas.api.typing.SeriesGroupBy.mean")([numeric\_only, skipna, ...]) | Compute mean of groups, excluding missing values. | +| [`SeriesGroupBy.median`](api/pandas.api.typing.SeriesGroupBy.median.html#pandas.api.typing.SeriesGroupBy.median "pandas.api.typing.SeriesGroupBy.median")([numeric\_only, skipna]) | Compute median of groups, excluding missing values. | +| [`SeriesGroupBy.min`](api/pandas.api.typing.SeriesGroupBy.min.html#pandas.api.typing.SeriesGroupBy.min "pandas.api.typing.SeriesGroupBy.min")([numeric\_only, min\_count, ...]) | Compute min of group values. | +| [`SeriesGroupBy.ngroup`](api/pandas.api.typing.SeriesGroupBy.ngroup.html#pandas.api.typing.SeriesGroupBy.ngroup "pandas.api.typing.SeriesGroupBy.ngroup")([ascending]) | Number each group from 0 to the number of groups - 1. | +| [`SeriesGroupBy.nlargest`](api/pandas.api.typing.SeriesGroupBy.nlargest.html#pandas.api.typing.SeriesGroupBy.nlargest "pandas.api.typing.SeriesGroupBy.nlargest")([n, keep]) | Return the largest n elements. | +| [`SeriesGroupBy.nsmallest`](api/pandas.api.typing.SeriesGroupBy.nsmallest.html#pandas.api.typing.SeriesGroupBy.nsmallest "pandas.api.typing.SeriesGroupBy.nsmallest")([n, keep]) | Return the smallest n elements. | +| [`SeriesGroupBy.nth`](api/pandas.api.typing.SeriesGroupBy.nth.html#pandas.api.typing.SeriesGroupBy.nth "pandas.api.typing.SeriesGroupBy.nth") | Take the nth row from each group if n is an int, otherwise a subset of rows. | +| [`SeriesGroupBy.nunique`](api/pandas.api.typing.SeriesGroupBy.nunique.html#pandas.api.typing.SeriesGroupBy.nunique "pandas.api.typing.SeriesGroupBy.nunique")([dropna]) | Return number of unique elements in the group. | +| [`SeriesGroupBy.unique`](api/pandas.api.typing.SeriesGroupBy.unique.html#pandas.api.typing.SeriesGroupBy.unique "pandas.api.typing.SeriesGroupBy.unique")() | Return unique values for each group. | +| [`SeriesGroupBy.ohlc`](api/pandas.api.typing.SeriesGroupBy.ohlc.html#pandas.api.typing.SeriesGroupBy.ohlc "pandas.api.typing.SeriesGroupBy.ohlc")() | Compute open, high, low and close values of a group, excluding missing values. | +| [`SeriesGroupBy.pct_change`](api/pandas.api.typing.SeriesGroupBy.pct_change.html#pandas.api.typing.SeriesGroupBy.pct_change "pandas.api.typing.SeriesGroupBy.pct_change")([periods, ...]) | Calculate pct\_change of each value to previous entry in group. | +| [`SeriesGroupBy.prod`](api/pandas.api.typing.SeriesGroupBy.prod.html#pandas.api.typing.SeriesGroupBy.prod "pandas.api.typing.SeriesGroupBy.prod")([numeric\_only, ...]) | Compute prod of group values. | +| [`SeriesGroupBy.quantile`](api/pandas.api.typing.SeriesGroupBy.quantile.html#pandas.api.typing.SeriesGroupBy.quantile "pandas.api.typing.SeriesGroupBy.quantile")([q, interpolation, ...]) | Return group values at the given quantile, a la numpy.percentile. | +| [`SeriesGroupBy.rank`](api/pandas.api.typing.SeriesGroupBy.rank.html#pandas.api.typing.SeriesGroupBy.rank "pandas.api.typing.SeriesGroupBy.rank")([method, ascending, ...]) | Provide the rank of values within each group. | +| [`SeriesGroupBy.resample`](api/pandas.api.typing.SeriesGroupBy.resample.html#pandas.api.typing.SeriesGroupBy.resample "pandas.api.typing.SeriesGroupBy.resample")(rule, \*args[, ...]) | Provide resampling when using a TimeGrouper. | +| [`SeriesGroupBy.rolling`](api/pandas.api.typing.SeriesGroupBy.rolling.html#pandas.api.typing.SeriesGroupBy.rolling "pandas.api.typing.SeriesGroupBy.rolling")(window[, min\_periods, ...]) | Return a rolling grouper, providing rolling functionality per group. | +| [`SeriesGroupBy.sample`](api/pandas.api.typing.SeriesGroupBy.sample.html#pandas.api.typing.SeriesGroupBy.sample "pandas.api.typing.SeriesGroupBy.sample")([n, frac, replace, ...]) | Return a random sample of items from each group. | +| [`SeriesGroupBy.sem`](api/pandas.api.typing.SeriesGroupBy.sem.html#pandas.api.typing.SeriesGroupBy.sem "pandas.api.typing.SeriesGroupBy.sem")([ddof, numeric\_only, skipna]) | Compute standard error of the mean of groups, excluding missing values. | +| [`SeriesGroupBy.shift`](api/pandas.api.typing.SeriesGroupBy.shift.html#pandas.api.typing.SeriesGroupBy.shift "pandas.api.typing.SeriesGroupBy.shift")([periods, freq, ...]) | Shift each group by periods observations. | +| [`SeriesGroupBy.size`](api/pandas.api.typing.SeriesGroupBy.size.html#pandas.api.typing.SeriesGroupBy.size "pandas.api.typing.SeriesGroupBy.size")() | Compute group sizes. | +| [`SeriesGroupBy.skew`](api/pandas.api.typing.SeriesGroupBy.skew.html#pandas.api.typing.SeriesGroupBy.skew "pandas.api.typing.SeriesGroupBy.skew")([skipna, numeric\_only]) | Return unbiased skew within groups. | +| [`SeriesGroupBy.kurt`](api/pandas.api.typing.SeriesGroupBy.kurt.html#pandas.api.typing.SeriesGroupBy.kurt "pandas.api.typing.SeriesGroupBy.kurt")([skipna, numeric\_only]) | Return unbiased kurtosis within groups. | +| [`SeriesGroupBy.std`](api/pandas.api.typing.SeriesGroupBy.std.html#pandas.api.typing.SeriesGroupBy.std "pandas.api.typing.SeriesGroupBy.std")([ddof, engine, ...]) | Compute standard deviation of groups, excluding missing values. | +| [`SeriesGroupBy.sum`](api/pandas.api.typing.SeriesGroupBy.sum.html#pandas.api.typing.SeriesGroupBy.sum "pandas.api.typing.SeriesGroupBy.sum")([numeric\_only, min\_count, ...]) | Compute sum of group values. | +| [`SeriesGroupBy.var`](api/pandas.api.typing.SeriesGroupBy.var.html#pandas.api.typing.SeriesGroupBy.var "pandas.api.typing.SeriesGroupBy.var")([ddof, engine, ...]) | Compute variance of groups, excluding missing values. | +| [`SeriesGroupBy.tail`](api/pandas.api.typing.SeriesGroupBy.tail.html#pandas.api.typing.SeriesGroupBy.tail "pandas.api.typing.SeriesGroupBy.tail")([n]) | Return last n rows of each group. | +| [`SeriesGroupBy.take`](api/pandas.api.typing.SeriesGroupBy.take.html#pandas.api.typing.SeriesGroupBy.take "pandas.api.typing.SeriesGroupBy.take")(indices, \*\*kwargs) | Return the elements in the given *positional* indices in each group. | +| [`SeriesGroupBy.value_counts`](api/pandas.api.typing.SeriesGroupBy.value_counts.html#pandas.api.typing.SeriesGroupBy.value_counts "pandas.api.typing.SeriesGroupBy.value_counts")([normalize, ...]) | Return a Series or DataFrame containing counts of unique rows. | + +## Plotting and visualization[#](#plotting-and-visualization "Link to this heading") + +| | | +| --- | --- | +| [`DataFrameGroupBy.boxplot`](api/pandas.api.typing.DataFrameGroupBy.boxplot.html#pandas.api.typing.DataFrameGroupBy.boxplot "pandas.api.typing.DataFrameGroupBy.boxplot")([subplots, column, ...]) | Make box plots from DataFrameGroupBy data. | +| [`DataFrameGroupBy.hist`](api/pandas.api.typing.DataFrameGroupBy.hist.html#pandas.api.typing.DataFrameGroupBy.hist "pandas.api.typing.DataFrameGroupBy.hist")([column, by, grid, ...]) | Make a histogram of the DataFrame's columns. | +| [`SeriesGroupBy.hist`](api/pandas.api.typing.SeriesGroupBy.hist.html#pandas.api.typing.SeriesGroupBy.hist "pandas.api.typing.SeriesGroupBy.hist")([by, ax, grid, ...]) | Draw histogram for each group's values using `Series.hist()` API. | +| [`DataFrameGroupBy.plot`](api/pandas.api.typing.DataFrameGroupBy.plot.html#pandas.api.typing.DataFrameGroupBy.plot "pandas.api.typing.DataFrameGroupBy.plot") | Make plots of groups from a DataFrame. | +| [`SeriesGroupBy.plot`](api/pandas.api.typing.SeriesGroupBy.plot.html#pandas.api.typing.SeriesGroupBy.plot "pandas.api.typing.SeriesGroupBy.plot") | Make plots of groups from a Series. | diff --git a/corpus/docs/pandas/merge/merge_15.md b/corpus/docs/pandas/merge/merge_15.md new file mode 100644 index 0000000000000000000000000000000000000000..97595ffabc23df0f695f0cf56e3a00c2ac85d1b7 --- /dev/null +++ b/corpus/docs/pandas/merge/merge_15.md @@ -0,0 +1,233 @@ +# pandas.merge# + +Source: https://pandas.pydata.org/pandas-docs/version/1.5/reference/api/pandas.merge.html +Version: 1.5 + +pandas.merge(*left*, *right*, *how='inner'*, *on=None*, *left\_on=None*, *right\_on=None*, *left\_index=False*, *right\_index=False*, *sort=False*, *suffixes=('\_x', '\_y')*, *copy=True*, *indicator=False*, *validate=None*)[[source]](https://github.com/pandas-dev/pandas/blob/v1.5.2/pandas/core/reshape/merge.py#L93-L124)[#](#pandas.merge "Permalink to this definition") +: Merge DataFrame or named Series objects with a database-style join. + + A named Series object is treated as a DataFrame with a single named column. + + The join is done on columns or indexes. If joining columns on + columns, the DataFrame indexes *will be ignored*. Otherwise if joining indexes + on indexes or indexes on a column or columns, the index will be passed on. + When performing a cross merge, no column specifications to merge on are + allowed. + + Warning + + If both key columns contain rows where the key is a null value, those + rows will be matched against each other. This is different from usual SQL + join behaviour and can lead to unexpected results. + + Parameters + : **left**DataFrame + + + **right**DataFrame or named Series + : Object to merge with. + + **how**{‘left’, ‘right’, ‘outer’, ‘inner’, ‘cross’}, default ‘inner’ + : Type of merge to be performed. + + * left: use only keys from left frame, similar to a SQL left outer join; + preserve key order. + * right: use only keys from right frame, similar to a SQL right outer join; + preserve key order. + * outer: use union of keys from both frames, similar to a SQL full outer + join; sort keys lexicographically. + * inner: use intersection of keys from both frames, similar to a SQL inner + join; preserve the order of the left keys. + * cross: creates the cartesian product from both frames, preserves the order + of the left keys. + + New in version 1.2.0. + + **on**label or list + : Column or index level names to join on. These must be found in both + DataFrames. If on is None and not merging on indexes then this defaults + to the intersection of the columns in both DataFrames. + + **left\_on**label or list, or array-like + : Column or index level names to join on in the left DataFrame. Can also + be an array or list of arrays of the length of the left DataFrame. + These arrays are treated as if they are columns. + + **right\_on**label or list, or array-like + : Column or index level names to join on in the right DataFrame. Can also + be an array or list of arrays of the length of the right DataFrame. + These arrays are treated as if they are columns. + + **left\_index**bool, default False + : Use the index from the left DataFrame as the join key(s). If it is a + MultiIndex, the number of keys in the other DataFrame (either the index + or a number of columns) must match the number of levels. + + **right\_index**bool, default False + : Use the index from the right DataFrame as the join key. Same caveats as + left\_index. + + **sort**bool, default False + : Sort the join keys lexicographically in the result DataFrame. If False, + the order of the join keys depends on the join type (how keyword). + + **suffixes**list-like, default is (“\_x”, “\_y”) + : A length-2 sequence where each element is optionally a string + indicating the suffix to add to overlapping column names in + left and right respectively. Pass a value of None instead + of a string to indicate that the column name from left or + right should be left as-is, with no suffix. At least one of the + values must not be None. + + **copy**bool, default True + : If False, avoid copy if possible. + + **indicator**bool or str, default False + : If True, adds a column to the output DataFrame called “\_merge” with + information on the source of each row. The column can be given a different + name by providing a string argument. The column will have a Categorical + type with the value of “left\_only” for observations whose merge key only + appears in the left DataFrame, “right\_only” for observations + whose merge key only appears in the right DataFrame, and “both” + if the observation’s merge key is found in both DataFrames. + + **validate**str, optional + : If specified, checks if merge is of specified type. + + * “one\_to\_one” or “1:1”: check if merge keys are unique in both + left and right datasets. + * “one\_to\_many” or “1:m”: check if merge keys are unique in left + dataset. + * “many\_to\_one” or “m:1”: check if merge keys are unique in right + dataset. + * “many\_to\_many” or “m:m”: allowed, but does not result in checks. + + Returns + : DataFrame + : A DataFrame of the two merged objects. + + See also + + [`merge_ordered`](pandas.merge_ordered.html#pandas.merge_ordered "pandas.merge_ordered") + : Merge with optional filling/interpolation. + + [`merge_asof`](pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") + : Merge on nearest keys. + + [`DataFrame.join`](pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") + : Similar method using indices. + + Notes + + Support for specifying index levels as the on, left\_on, and + right\_on parameters was added in version 0.23.0 + Support for merging named Series objects was added in version 0.24.0 + + Examples + + ```None + >>> df1 = pd.DataFrame({'lkey': ['foo', 'bar', 'baz', 'foo'], + ... 'value': [1, 2, 3, 5]}) + >>> df2 = pd.DataFrame({'rkey': ['foo', 'bar', 'baz', 'foo'], + ... 'value': [5, 6, 7, 8]}) + >>> df1 + lkey value + 0 foo 1 + 1 bar 2 + 2 baz 3 + 3 foo 5 + >>> df2 + rkey value + 0 foo 5 + 1 bar 6 + 2 baz 7 + 3 foo 8 + ``` + + Merge df1 and df2 on the lkey and rkey columns. The value columns have + the default suffixes, \_x and \_y, appended. + + ```None + >>> df1.merge(df2, left_on='lkey', right_on='rkey') + lkey value_x rkey value_y + 0 foo 1 foo 5 + 1 foo 1 foo 8 + 2 foo 5 foo 5 + 3 foo 5 foo 8 + 4 bar 2 bar 6 + 5 baz 3 baz 7 + ``` + + Merge DataFrames df1 and df2 with specified left and right suffixes + appended to any overlapping columns. + + ```None + >>> df1.merge(df2, left_on='lkey', right_on='rkey', + ... suffixes=('_left', '_right')) + lkey value_left rkey value_right + 0 foo 1 foo 5 + 1 foo 1 foo 8 + 2 foo 5 foo 5 + 3 foo 5 foo 8 + 4 bar 2 bar 6 + 5 baz 3 baz 7 + ``` + + Merge DataFrames df1 and df2, but raise an exception if the DataFrames have + any overlapping columns. + + ```None + >>> df1.merge(df2, left_on='lkey', right_on='rkey', suffixes=(False, False)) + Traceback (most recent call last): + ... + ValueError: columns overlap but no suffix specified: + Index(['value'], dtype='object') + ``` + + ```None + >>> df1 = pd.DataFrame({'a': ['foo', 'bar'], 'b': [1, 2]}) + >>> df2 = pd.DataFrame({'a': ['foo', 'baz'], 'c': [3, 4]}) + >>> df1 + a b + 0 foo 1 + 1 bar 2 + >>> df2 + a c + 0 foo 3 + 1 baz 4 + ``` + + ```None + >>> df1.merge(df2, how='inner', on='a') + a b c + 0 foo 1 3 + ``` + + ```None + >>> df1.merge(df2, how='left', on='a') + a b c + 0 foo 1 3.0 + 1 bar 2 NaN + ``` + + ```None + >>> df1 = pd.DataFrame({'left': ['foo', 'bar']}) + >>> df2 = pd.DataFrame({'right': [7, 8]}) + >>> df1 + left + 0 foo + 1 bar + >>> df2 + right + 0 7 + 1 8 + ``` + + ```None + >>> df1.merge(df2, how='cross') + left right + 0 foo 7 + 1 foo 8 + 2 bar 7 + 3 bar 8 + ``` diff --git a/corpus/docs/pandas/merge/merge_20.md b/corpus/docs/pandas/merge/merge_20.md new file mode 100644 index 0000000000000000000000000000000000000000..ef7a277772e851c16744ba92e5427ba7ed75f7ae --- /dev/null +++ b/corpus/docs/pandas/merge/merge_20.md @@ -0,0 +1,233 @@ +# pandas.merge# + +Source: https://pandas.pydata.org/pandas-docs/version/2.0/reference/api/pandas.merge.html +Version: 2.0 + +pandas.merge(*left*, *right*, *how='inner'*, *on=None*, *left\_on=None*, *right\_on=None*, *left\_index=False*, *right\_index=False*, *sort=False*, *suffixes=('\_x', '\_y')*, *copy=None*, *indicator=False*, *validate=None*)[[source]](https://github.com/pandas-dev/pandas/blob/v2.0.3/pandas/core/reshape/merge.py#L131-L162)[#](#pandas.merge "Permalink to this definition") +: Merge DataFrame or named Series objects with a database-style join. + + A named Series object is treated as a DataFrame with a single named column. + + The join is done on columns or indexes. If joining columns on + columns, the DataFrame indexes *will be ignored*. Otherwise if joining indexes + on indexes or indexes on a column or columns, the index will be passed on. + When performing a cross merge, no column specifications to merge on are + allowed. + + Warning + + If both key columns contain rows where the key is a null value, those + rows will be matched against each other. This is different from usual SQL + join behaviour and can lead to unexpected results. + + Parameters + : **left**DataFrame or named Series + + + **right**DataFrame or named Series + : Object to merge with. + + **how**{‘left’, ‘right’, ‘outer’, ‘inner’, ‘cross’}, default ‘inner’ + : Type of merge to be performed. + + * left: use only keys from left frame, similar to a SQL left outer join; + preserve key order. + * right: use only keys from right frame, similar to a SQL right outer join; + preserve key order. + * outer: use union of keys from both frames, similar to a SQL full outer + join; sort keys lexicographically. + * inner: use intersection of keys from both frames, similar to a SQL inner + join; preserve the order of the left keys. + * cross: creates the cartesian product from both frames, preserves the order + of the left keys. + + New in version 1.2.0. + + **on**label or list + : Column or index level names to join on. These must be found in both + DataFrames. If on is None and not merging on indexes then this defaults + to the intersection of the columns in both DataFrames. + + **left\_on**label or list, or array-like + : Column or index level names to join on in the left DataFrame. Can also + be an array or list of arrays of the length of the left DataFrame. + These arrays are treated as if they are columns. + + **right\_on**label or list, or array-like + : Column or index level names to join on in the right DataFrame. Can also + be an array or list of arrays of the length of the right DataFrame. + These arrays are treated as if they are columns. + + **left\_index**bool, default False + : Use the index from the left DataFrame as the join key(s). If it is a + MultiIndex, the number of keys in the other DataFrame (either the index + or a number of columns) must match the number of levels. + + **right\_index**bool, default False + : Use the index from the right DataFrame as the join key. Same caveats as + left\_index. + + **sort**bool, default False + : Sort the join keys lexicographically in the result DataFrame. If False, + the order of the join keys depends on the join type (how keyword). + + **suffixes**list-like, default is (“\_x”, “\_y”) + : A length-2 sequence where each element is optionally a string + indicating the suffix to add to overlapping column names in + left and right respectively. Pass a value of None instead + of a string to indicate that the column name from left or + right should be left as-is, with no suffix. At least one of the + values must not be None. + + **copy**bool, default True + : If False, avoid copy if possible. + + **indicator**bool or str, default False + : If True, adds a column to the output DataFrame called “\_merge” with + information on the source of each row. The column can be given a different + name by providing a string argument. The column will have a Categorical + type with the value of “left\_only” for observations whose merge key only + appears in the left DataFrame, “right\_only” for observations + whose merge key only appears in the right DataFrame, and “both” + if the observation’s merge key is found in both DataFrames. + + **validate**str, optional + : If specified, checks if merge is of specified type. + + * “one\_to\_one” or “1:1”: check if merge keys are unique in both + left and right datasets. + * “one\_to\_many” or “1:m”: check if merge keys are unique in left + dataset. + * “many\_to\_one” or “m:1”: check if merge keys are unique in right + dataset. + * “many\_to\_many” or “m:m”: allowed, but does not result in checks. + + Returns + : DataFrame + : A DataFrame of the two merged objects. + + See also + + [`merge_ordered`](pandas.merge_ordered.html#pandas.merge_ordered "pandas.merge_ordered") + : Merge with optional filling/interpolation. + + [`merge_asof`](pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") + : Merge on nearest keys. + + [`DataFrame.join`](pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") + : Similar method using indices. + + Notes + + Support for specifying index levels as the on, left\_on, and + right\_on parameters was added in version 0.23.0 + Support for merging named Series objects was added in version 0.24.0 + + Examples + + ```None + >>> df1 = pd.DataFrame({'lkey': ['foo', 'bar', 'baz', 'foo'], + ... 'value': [1, 2, 3, 5]}) + >>> df2 = pd.DataFrame({'rkey': ['foo', 'bar', 'baz', 'foo'], + ... 'value': [5, 6, 7, 8]}) + >>> df1 + lkey value + 0 foo 1 + 1 bar 2 + 2 baz 3 + 3 foo 5 + >>> df2 + rkey value + 0 foo 5 + 1 bar 6 + 2 baz 7 + 3 foo 8 + ``` + + Merge df1 and df2 on the lkey and rkey columns. The value columns have + the default suffixes, \_x and \_y, appended. + + ```None + >>> df1.merge(df2, left_on='lkey', right_on='rkey') + lkey value_x rkey value_y + 0 foo 1 foo 5 + 1 foo 1 foo 8 + 2 foo 5 foo 5 + 3 foo 5 foo 8 + 4 bar 2 bar 6 + 5 baz 3 baz 7 + ``` + + Merge DataFrames df1 and df2 with specified left and right suffixes + appended to any overlapping columns. + + ```None + >>> df1.merge(df2, left_on='lkey', right_on='rkey', + ... suffixes=('_left', '_right')) + lkey value_left rkey value_right + 0 foo 1 foo 5 + 1 foo 1 foo 8 + 2 foo 5 foo 5 + 3 foo 5 foo 8 + 4 bar 2 bar 6 + 5 baz 3 baz 7 + ``` + + Merge DataFrames df1 and df2, but raise an exception if the DataFrames have + any overlapping columns. + + ```None + >>> df1.merge(df2, left_on='lkey', right_on='rkey', suffixes=(False, False)) + Traceback (most recent call last): + ... + ValueError: columns overlap but no suffix specified: + Index(['value'], dtype='object') + ``` + + ```None + >>> df1 = pd.DataFrame({'a': ['foo', 'bar'], 'b': [1, 2]}) + >>> df2 = pd.DataFrame({'a': ['foo', 'baz'], 'c': [3, 4]}) + >>> df1 + a b + 0 foo 1 + 1 bar 2 + >>> df2 + a c + 0 foo 3 + 1 baz 4 + ``` + + ```None + >>> df1.merge(df2, how='inner', on='a') + a b c + 0 foo 1 3 + ``` + + ```None + >>> df1.merge(df2, how='left', on='a') + a b c + 0 foo 1 3.0 + 1 bar 2 NaN + ``` + + ```None + >>> df1 = pd.DataFrame({'left': ['foo', 'bar']}) + >>> df2 = pd.DataFrame({'right': [7, 8]}) + >>> df1 + left + 0 foo + 1 bar + >>> df2 + right + 0 7 + 1 8 + ``` + + ```None + >>> df1.merge(df2, how='cross') + left right + 0 foo 7 + 1 foo 8 + 2 bar 7 + 3 bar 8 + ``` diff --git a/corpus/docs/pandas/merge/merge_21.md b/corpus/docs/pandas/merge/merge_21.md new file mode 100644 index 0000000000000000000000000000000000000000..bc1ce70971a5145297926f4d89090bb2afd17755 --- /dev/null +++ b/corpus/docs/pandas/merge/merge_21.md @@ -0,0 +1,227 @@ +# pandas.merge# + +Source: https://pandas.pydata.org/pandas-docs/version/2.1/reference/api/pandas.merge.html +Version: 2.1 + +pandas.merge(*left*, *right*, *how='inner'*, *on=None*, *left\_on=None*, *right\_on=None*, *left\_index=False*, *right\_index=False*, *sort=False*, *suffixes=('\_x', '\_y')*, *copy=None*, *indicator=False*, *validate=None*)[[source]](https://github.com/pandas-dev/pandas/blob/v2.1.4/pandas/core/reshape/merge.py#L134-L183)[#](#pandas.merge "Permalink to this definition") +: Merge DataFrame or named Series objects with a database-style join. + + A named Series object is treated as a DataFrame with a single named column. + + The join is done on columns or indexes. If joining columns on + columns, the DataFrame indexes *will be ignored*. Otherwise if joining indexes + on indexes or indexes on a column or columns, the index will be passed on. + When performing a cross merge, no column specifications to merge on are + allowed. + + Warning + + If both key columns contain rows where the key is a null value, those + rows will be matched against each other. This is different from usual SQL + join behaviour and can lead to unexpected results. + + Parameters: + : **left**DataFrame or named Series + + + **right**DataFrame or named Series + : Object to merge with. + + **how**{‘left’, ‘right’, ‘outer’, ‘inner’, ‘cross’}, default ‘inner’ + : Type of merge to be performed. + + * left: use only keys from left frame, similar to a SQL left outer join; + preserve key order. + * right: use only keys from right frame, similar to a SQL right outer join; + preserve key order. + * outer: use union of keys from both frames, similar to a SQL full outer + join; sort keys lexicographically. + * inner: use intersection of keys from both frames, similar to a SQL inner + join; preserve the order of the left keys. + * cross: creates the cartesian product from both frames, preserves the order + of the left keys. + + New in version 1.2.0. + + **on**label or list + : Column or index level names to join on. These must be found in both + DataFrames. If on is None and not merging on indexes then this defaults + to the intersection of the columns in both DataFrames. + + **left\_on**label or list, or array-like + : Column or index level names to join on in the left DataFrame. Can also + be an array or list of arrays of the length of the left DataFrame. + These arrays are treated as if they are columns. + + **right\_on**label or list, or array-like + : Column or index level names to join on in the right DataFrame. Can also + be an array or list of arrays of the length of the right DataFrame. + These arrays are treated as if they are columns. + + **left\_index**bool, default False + : Use the index from the left DataFrame as the join key(s). If it is a + MultiIndex, the number of keys in the other DataFrame (either the index + or a number of columns) must match the number of levels. + + **right\_index**bool, default False + : Use the index from the right DataFrame as the join key. Same caveats as + left\_index. + + **sort**bool, default False + : Sort the join keys lexicographically in the result DataFrame. If False, + the order of the join keys depends on the join type (how keyword). + + **suffixes**list-like, default is (“\_x”, “\_y”) + : A length-2 sequence where each element is optionally a string + indicating the suffix to add to overlapping column names in + left and right respectively. Pass a value of None instead + of a string to indicate that the column name from left or + right should be left as-is, with no suffix. At least one of the + values must not be None. + + **copy**bool, default True + : If False, avoid copy if possible. + + **indicator**bool or str, default False + : If True, adds a column to the output DataFrame called “\_merge” with + information on the source of each row. The column can be given a different + name by providing a string argument. The column will have a Categorical + type with the value of “left\_only” for observations whose merge key only + appears in the left DataFrame, “right\_only” for observations + whose merge key only appears in the right DataFrame, and “both” + if the observation’s merge key is found in both DataFrames. + + **validate**str, optional + : If specified, checks if merge is of specified type. + + * “one\_to\_one” or “1:1”: check if merge keys are unique in both + left and right datasets. + * “one\_to\_many” or “1:m”: check if merge keys are unique in left + dataset. + * “many\_to\_one” or “m:1”: check if merge keys are unique in right + dataset. + * “many\_to\_many” or “m:m”: allowed, but does not result in checks. + + Returns: + : DataFrame + : A DataFrame of the two merged objects. + + See also + + [`merge_ordered`](pandas.merge_ordered.html#pandas.merge_ordered "pandas.merge_ordered") + : Merge with optional filling/interpolation. + + [`merge_asof`](pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") + : Merge on nearest keys. + + [`DataFrame.join`](pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") + : Similar method using indices. + + Examples + + ```None + >>> df1 = pd.DataFrame({'lkey': ['foo', 'bar', 'baz', 'foo'], + ... 'value': [1, 2, 3, 5]}) + >>> df2 = pd.DataFrame({'rkey': ['foo', 'bar', 'baz', 'foo'], + ... 'value': [5, 6, 7, 8]}) + >>> df1 + lkey value + 0 foo 1 + 1 bar 2 + 2 baz 3 + 3 foo 5 + >>> df2 + rkey value + 0 foo 5 + 1 bar 6 + 2 baz 7 + 3 foo 8 + ``` + + Merge df1 and df2 on the lkey and rkey columns. The value columns have + the default suffixes, \_x and \_y, appended. + + ```None + >>> df1.merge(df2, left_on='lkey', right_on='rkey') + lkey value_x rkey value_y + 0 foo 1 foo 5 + 1 foo 1 foo 8 + 2 foo 5 foo 5 + 3 foo 5 foo 8 + 4 bar 2 bar 6 + 5 baz 3 baz 7 + ``` + + Merge DataFrames df1 and df2 with specified left and right suffixes + appended to any overlapping columns. + + ```None + >>> df1.merge(df2, left_on='lkey', right_on='rkey', + ... suffixes=('_left', '_right')) + lkey value_left rkey value_right + 0 foo 1 foo 5 + 1 foo 1 foo 8 + 2 foo 5 foo 5 + 3 foo 5 foo 8 + 4 bar 2 bar 6 + 5 baz 3 baz 7 + ``` + + Merge DataFrames df1 and df2, but raise an exception if the DataFrames have + any overlapping columns. + + ```None + >>> df1.merge(df2, left_on='lkey', right_on='rkey', suffixes=(False, False)) + Traceback (most recent call last): + ... + ValueError: columns overlap but no suffix specified: + Index(['value'], dtype='object') + ``` + + ```None + >>> df1 = pd.DataFrame({'a': ['foo', 'bar'], 'b': [1, 2]}) + >>> df2 = pd.DataFrame({'a': ['foo', 'baz'], 'c': [3, 4]}) + >>> df1 + a b + 0 foo 1 + 1 bar 2 + >>> df2 + a c + 0 foo 3 + 1 baz 4 + ``` + + ```None + >>> df1.merge(df2, how='inner', on='a') + a b c + 0 foo 1 3 + ``` + + ```None + >>> df1.merge(df2, how='left', on='a') + a b c + 0 foo 1 3.0 + 1 bar 2 NaN + ``` + + ```None + >>> df1 = pd.DataFrame({'left': ['foo', 'bar']}) + >>> df2 = pd.DataFrame({'right': [7, 8]}) + >>> df1 + left + 0 foo + 1 bar + >>> df2 + right + 0 7 + 1 8 + ``` + + ```None + >>> df1.merge(df2, how='cross') + left right + 0 foo 7 + 1 foo 8 + 2 bar 7 + 3 bar 8 + ``` diff --git a/corpus/docs/pandas/merge/merge_22.md b/corpus/docs/pandas/merge/merge_22.md new file mode 100644 index 0000000000000000000000000000000000000000..bc4338dae566cdc94a49fc6632262c6dc04a3912 --- /dev/null +++ b/corpus/docs/pandas/merge/merge_22.md @@ -0,0 +1,237 @@ +# pandas.merge# + +Source: https://pandas.pydata.org/pandas-docs/version/2.2/reference/api/pandas.merge.html +Version: 2.2 + +pandas.merge(*left*, *right*, *how='inner'*, *on=None*, *left\_on=None*, *right\_on=None*, *left\_index=False*, *right\_index=False*, *sort=False*, *suffixes=('\_x', '\_y')*, *copy=None*, *indicator=False*, *validate=None*)[[source]](https://github.com/pandas-dev/pandas/blob/v2.2.3/pandas/core/reshape/merge.py#L135-L184)[#](#pandas.merge "Link to this definition") +: Merge DataFrame or named Series objects with a database-style join. + + A named Series object is treated as a DataFrame with a single named column. + + The join is done on columns or indexes. If joining columns on + columns, the DataFrame indexes *will be ignored*. Otherwise if joining indexes + on indexes or indexes on a column or columns, the index will be passed on. + When performing a cross merge, no column specifications to merge on are + allowed. + + Warning + + If both key columns contain rows where the key is a null value, those + rows will be matched against each other. This is different from usual SQL + join behaviour and can lead to unexpected results. + + Parameters: + : **left**DataFrame or named Series + + + **right**DataFrame or named Series + : Object to merge with. + + **how**{‘left’, ‘right’, ‘outer’, ‘inner’, ‘cross’}, default ‘inner’ + : Type of merge to be performed. + + * left: use only keys from left frame, similar to a SQL left outer join; + preserve key order. + * right: use only keys from right frame, similar to a SQL right outer join; + preserve key order. + * outer: use union of keys from both frames, similar to a SQL full outer + join; sort keys lexicographically. + * inner: use intersection of keys from both frames, similar to a SQL inner + join; preserve the order of the left keys. + * cross: creates the cartesian product from both frames, preserves the order + of the left keys. + + **on**label or list + : Column or index level names to join on. These must be found in both + DataFrames. If on is None and not merging on indexes then this defaults + to the intersection of the columns in both DataFrames. + + **left\_on**label or list, or array-like + : Column or index level names to join on in the left DataFrame. Can also + be an array or list of arrays of the length of the left DataFrame. + These arrays are treated as if they are columns. + + **right\_on**label or list, or array-like + : Column or index level names to join on in the right DataFrame. Can also + be an array or list of arrays of the length of the right DataFrame. + These arrays are treated as if they are columns. + + **left\_index**bool, default False + : Use the index from the left DataFrame as the join key(s). If it is a + MultiIndex, the number of keys in the other DataFrame (either the index + or a number of columns) must match the number of levels. + + **right\_index**bool, default False + : Use the index from the right DataFrame as the join key. Same caveats as + left\_index. + + **sort**bool, default False + : Sort the join keys lexicographically in the result DataFrame. If False, + the order of the join keys depends on the join type (how keyword). + + **suffixes**list-like, default is (“\_x”, “\_y”) + : A length-2 sequence where each element is optionally a string + indicating the suffix to add to overlapping column names in + left and right respectively. Pass a value of None instead + of a string to indicate that the column name from left or + right should be left as-is, with no suffix. At least one of the + values must not be None. + + **copy**bool, default True + : If False, avoid copy if possible. + + Note + + The copy keyword will change behavior in pandas 3.0. + [Copy-on-Write](https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html) + will be enabled by default, which means that all methods with a + copy keyword will use a lazy copy mechanism to defer the copy and + ignore the copy keyword. The copy keyword will be removed in a + future version of pandas. + + You can already get the future behavior and improvements through + enabling copy on write `pd.options.mode.copy_on_write = True` + + **indicator**bool or str, default False + : If True, adds a column to the output DataFrame called “\_merge” with + information on the source of each row. The column can be given a different + name by providing a string argument. The column will have a Categorical + type with the value of “left\_only” for observations whose merge key only + appears in the left DataFrame, “right\_only” for observations + whose merge key only appears in the right DataFrame, and “both” + if the observation’s merge key is found in both DataFrames. + + **validate**str, optional + : If specified, checks if merge is of specified type. + + * “one\_to\_one” or “1:1”: check if merge keys are unique in both + left and right datasets. + * “one\_to\_many” or “1:m”: check if merge keys are unique in left + dataset. + * “many\_to\_one” or “m:1”: check if merge keys are unique in right + dataset. + * “many\_to\_many” or “m:m”: allowed, but does not result in checks. + + Returns: + : DataFrame + : A DataFrame of the two merged objects. + + See also + + [`merge_ordered`](pandas.merge_ordered.html#pandas.merge_ordered "pandas.merge_ordered") + : Merge with optional filling/interpolation. + + [`merge_asof`](pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") + : Merge on nearest keys. + + [`DataFrame.join`](pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") + : Similar method using indices. + + Examples + + ```None + >>> df1 = pd.DataFrame({'lkey': ['foo', 'bar', 'baz', 'foo'], + ... 'value': [1, 2, 3, 5]}) + >>> df2 = pd.DataFrame({'rkey': ['foo', 'bar', 'baz', 'foo'], + ... 'value': [5, 6, 7, 8]}) + >>> df1 + lkey value + 0 foo 1 + 1 bar 2 + 2 baz 3 + 3 foo 5 + >>> df2 + rkey value + 0 foo 5 + 1 bar 6 + 2 baz 7 + 3 foo 8 + ``` + + Merge df1 and df2 on the lkey and rkey columns. The value columns have + the default suffixes, \_x and \_y, appended. + + ```None + >>> df1.merge(df2, left_on='lkey', right_on='rkey') + lkey value_x rkey value_y + 0 foo 1 foo 5 + 1 foo 1 foo 8 + 2 bar 2 bar 6 + 3 baz 3 baz 7 + 4 foo 5 foo 5 + 5 foo 5 foo 8 + ``` + + Merge DataFrames df1 and df2 with specified left and right suffixes + appended to any overlapping columns. + + ```None + >>> df1.merge(df2, left_on='lkey', right_on='rkey', + ... suffixes=('_left', '_right')) + lkey value_left rkey value_right + 0 foo 1 foo 5 + 1 foo 1 foo 8 + 2 bar 2 bar 6 + 3 baz 3 baz 7 + 4 foo 5 foo 5 + 5 foo 5 foo 8 + ``` + + Merge DataFrames df1 and df2, but raise an exception if the DataFrames have + any overlapping columns. + + ```None + >>> df1.merge(df2, left_on='lkey', right_on='rkey', suffixes=(False, False)) + Traceback (most recent call last): + ... + ValueError: columns overlap but no suffix specified: + Index(['value'], dtype='object') + ``` + + ```None + >>> df1 = pd.DataFrame({'a': ['foo', 'bar'], 'b': [1, 2]}) + >>> df2 = pd.DataFrame({'a': ['foo', 'baz'], 'c': [3, 4]}) + >>> df1 + a b + 0 foo 1 + 1 bar 2 + >>> df2 + a c + 0 foo 3 + 1 baz 4 + ``` + + ```None + >>> df1.merge(df2, how='inner', on='a') + a b c + 0 foo 1 3 + ``` + + ```None + >>> df1.merge(df2, how='left', on='a') + a b c + 0 foo 1 3.0 + 1 bar 2 NaN + ``` + + ```None + >>> df1 = pd.DataFrame({'left': ['foo', 'bar']}) + >>> df2 = pd.DataFrame({'right': [7, 8]}) + >>> df1 + left + 0 foo + 1 bar + >>> df2 + right + 0 7 + 1 8 + ``` + + ```None + >>> df1.merge(df2, how='cross') + left right + 0 foo 7 + 1 foo 8 + 2 bar 7 + 3 bar 8 + ``` diff --git a/corpus/docs/pandas/merge/merge_30.md b/corpus/docs/pandas/merge/merge_30.md new file mode 100644 index 0000000000000000000000000000000000000000..e2fd21499621ab647e6917137616f5b5971e4ce4 --- /dev/null +++ b/corpus/docs/pandas/merge/merge_30.md @@ -0,0 +1,238 @@ +# pandas.merge# + +Source: https://pandas.pydata.org/pandas-docs/version/3.0/reference/api/pandas.merge.html +Version: 3.0 + +pandas.merge(*left*, *right*, *how='inner'*, *on=None*, *left\_on=None*, *right\_on=None*, *left\_index=False*, *right\_index=False*, *sort=False*, *suffixes=('\_x'*, *'\_y')*, *copy=*, *indicator=False*, *validate=None*)[[source]](https://github.com/pandas-dev/pandas/blob/v3.0.0/pandas/core/reshape/merge.py#L145-L399)[#](#pandas.merge "Link to this definition") +: Merge DataFrame or named Series objects with a database-style join. + + A named Series object is treated as a DataFrame with a single named column. + + The join is done on columns or indexes. If joining columns on + columns, the DataFrame indexes *will be ignored*. Otherwise if joining indexes + on indexes or indexes on a column or columns, the index will be passed on. + When performing a cross merge, no column specifications to merge on are + allowed. + + Warning + + If both key columns contain rows where the key is a null value, those + rows will be matched against each other. This is different from usual SQL + join behaviour and can lead to unexpected results. + + Parameters: + : **left**DataFrame or named Series + : First pandas object to merge. + + **right**DataFrame or named Series + : Second pandas object to merge. + + **how**{‘left’, ‘right’, ‘outer’, ‘inner’, ‘cross’, ‘left\_anti’, ‘right\_anti}, + : default ‘inner’ + Type of merge to be performed. + + * left: use only keys from left frame, similar to a SQL left outer join; + preserve key order. + * right: use only keys from right frame, similar to a SQL right outer join; + preserve key order. + * outer: use union of keys from both frames, similar to a SQL full outer + join; sort keys lexicographically. + * inner: use intersection of keys from both frames, similar to a SQL inner + join; preserve the order of the left keys. + * cross: creates the cartesian product from both frames, preserves the order + of the left keys. + * left\_anti: use only keys from left frame that are not in right frame, similar + to SQL left anti join; preserve key order. + * right\_anti: use only keys from right frame that are not in left frame, similar + to SQL right anti join; preserve key order. + + **on**Hashable or a sequence of the previous + : Column or index level names to join on. These must be found in both + DataFrames. If on is None and not merging on indexes then this defaults + to the intersection of the columns in both DataFrames. + + **left\_on**Hashable or a sequence of the previous, or array-like + : Column or index level names to join on in the left DataFrame. Can also + be an array or list of arrays of the length of the left DataFrame. + These arrays are treated as if they are columns. + + **right\_on**Hashable or a sequence of the previous, or array-like + : Column or index level names to join on in the right DataFrame. Can also + be an array or list of arrays of the length of the right DataFrame. + These arrays are treated as if they are columns. + + **left\_index**bool, default False + : Use the index from the left DataFrame as the join key(s). If it is a + MultiIndex, the number of keys in the other DataFrame (either the index + or a number of columns) must match the number of levels. + + **right\_index**bool, default False + : Use the index from the right DataFrame as the join key. Same caveats as + left\_index. + + **sort**bool, default False + : Sort the join keys lexicographically in the result DataFrame. If False, + the order of the join keys depends on the join type (how keyword). + + **suffixes**list-like, default is (“\_x”, “\_y”) + : A length-2 sequence where each element is optionally a string + indicating the suffix to add to overlapping column names in + left and right respectively. Pass a value of None instead + of a string to indicate that the column name from left or + right should be left as-is, with no suffix. At least one of the + values must not be None. + + **copy**bool, default False + : This keyword is now ignored; changing its value will have no + impact on the method. + + Deprecated since version 3.0.0: This keyword is ignored and will be removed in pandas 4.0. Since + pandas 3.0, this method always returns a new object using a lazy + copy mechanism that defers copies until necessary + (Copy-on-Write). See the [user guide on Copy-on-Write](https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html) + for more details. + + **indicator**bool or str, default False + : If True, adds a column to the output DataFrame called “\_merge” with + information on the source of each row. The column can be given a different + name by providing a string argument. The column will have a Categorical + type with the value of “left\_only” for observations whose merge key only + appears in the left DataFrame, “right\_only” for observations + whose merge key only appears in the right DataFrame, and “both” + if the observation’s merge key is found in both DataFrames. + + **validate**str, optional + : If specified, checks if merge is of specified type. + + * “one\_to\_one” or “1:1”: check if merge keys are unique in both + left and right datasets. + * “one\_to\_many” or “1:m”: check if merge keys are unique in left + dataset. + * “many\_to\_one” or “m:1”: check if merge keys are unique in right + dataset. + * “many\_to\_many” or “m:m”: allowed, but does not result in checks. + + Returns: + : DataFrame + : A DataFrame of the two merged objects. + + See also + + [`merge_ordered`](pandas.merge_ordered.html#pandas.merge_ordered "pandas.merge_ordered") + : Merge with optional filling/interpolation. + + [`merge_asof`](pandas.merge_asof.html#pandas.merge_asof "pandas.merge_asof") + : Merge on nearest keys. + + [`DataFrame.join`](pandas.DataFrame.join.html#pandas.DataFrame.join "pandas.DataFrame.join") + : Similar method using indices. + + Examples + + ```None + >>> df1 = pd.DataFrame( + ... {"lkey": ["foo", "bar", "baz", "foo"], "value": [1, 2, 3, 5]} + ... ) + >>> df2 = pd.DataFrame( + ... {"rkey": ["foo", "bar", "baz", "foo"], "value": [5, 6, 7, 8]} + ... ) + >>> df1 + lkey value + 0 foo 1 + 1 bar 2 + 2 baz 3 + 3 foo 5 + >>> df2 + rkey value + 0 foo 5 + 1 bar 6 + 2 baz 7 + 3 foo 8 + ``` + + Merge df1 and df2 on the lkey and rkey columns. The value columns have + the default suffixes, \_x and \_y, appended. + + ```None + >>> df1.merge(df2, left_on="lkey", right_on="rkey") + lkey value_x rkey value_y + 0 foo 1 foo 5 + 1 foo 1 foo 8 + 2 bar 2 bar 6 + 3 baz 3 baz 7 + 4 foo 5 foo 5 + 5 foo 5 foo 8 + ``` + + Merge DataFrames df1 and df2 with specified left and right suffixes + appended to any overlapping columns. + + ```None + >>> df1.merge(df2, left_on="lkey", right_on="rkey", suffixes=("_left", "_right")) + lkey value_left rkey value_right + 0 foo 1 foo 5 + 1 foo 1 foo 8 + 2 bar 2 bar 6 + 3 baz 3 baz 7 + 4 foo 5 foo 5 + 5 foo 5 foo 8 + ``` + + Merge DataFrames df1 and df2, but raise an exception if the DataFrames have + any overlapping columns. + + ```None + >>> df1.merge(df2, left_on="lkey", right_on="rkey", suffixes=(False, False)) + Traceback (most recent call last): + ... + ValueError: columns overlap but no suffix specified: + Index(['value'], dtype='str') + ``` + + ```None + >>> df1 = pd.DataFrame({"a": ["foo", "bar"], "b": [1, 2]}) + >>> df2 = pd.DataFrame({"a": ["foo", "baz"], "c": [3, 4]}) + >>> df1 + a b + 0 foo 1 + 1 bar 2 + >>> df2 + a c + 0 foo 3 + 1 baz 4 + ``` + + ```None + >>> df1.merge(df2, how="inner", on="a") + a b c + 0 foo 1 3 + ``` + + ```None + >>> df1.merge(df2, how="left", on="a") + a b c + 0 foo 1 3.0 + 1 bar 2 NaN + ``` + + ```None + >>> df1 = pd.DataFrame({"left": ["foo", "bar"]}) + >>> df2 = pd.DataFrame({"right": [7, 8]}) + >>> df1 + left + 0 foo + 1 bar + >>> df2 + right + 0 7 + 1 8 + ``` + + ```None + >>> df1.merge(df2, how="cross") + left right + 0 foo 7 + 1 foo 8 + 2 bar 7 + 3 bar 8 + ``` diff --git a/corpus/docs/pandas/to_parquet/to_parquet_15.md b/corpus/docs/pandas/to_parquet/to_parquet_15.md new file mode 100644 index 0000000000000000000000000000000000000000..a96e49e5fb4595fae2742e404fdd2268587e4f71 --- /dev/null +++ b/corpus/docs/pandas/to_parquet/to_parquet_15.md @@ -0,0 +1,107 @@ +# pandas.DataFrame.to_parquet# + +Source: https://pandas.pydata.org/pandas-docs/version/1.5/reference/api/pandas.DataFrame.to_parquet.html +Version: 1.5 + +DataFrame.to\_parquet(*path=None*, *engine='auto'*, *compression='snappy'*, *index=None*, *partition\_cols=None*, *storage\_options=None*, *\*\*kwargs*)[[source]](https://github.com/pandas-dev/pandas/blob/v1.5.2/pandas/core/frame.py#L2876-L2984)[#](#pandas.DataFrame.to_parquet "Permalink to this definition") +: Write a DataFrame to the binary parquet format. + + This function writes the dataframe as a [parquet file](https://parquet.apache.org/). You can choose different parquet + backends, and have the option of compression. See + [the user guide](../../user_guide/io.html#io-parquet) for more details. + + Parameters + : **path**str, path object, file-like object, or None, default None + : String, path object (implementing `os.PathLike[str]`), or file-like + object implementing a binary `write()` function. If None, the result is + returned as bytes. If a string or path, it will be used as Root Directory + path when writing a partitioned dataset. + + Changed in version 1.2.0. + + Previously this was “fname” + + **engine**{‘auto’, ‘pyarrow’, ‘fastparquet’}, default ‘auto’ + : Parquet library to use. If ‘auto’, then the option + `io.parquet.engine` is used. The default `io.parquet.engine` + behavior is to try ‘pyarrow’, falling back to ‘fastparquet’ if + ‘pyarrow’ is unavailable. + + **compression**{‘snappy’, ‘gzip’, ‘brotli’, None}, default ‘snappy’ + : Name of the compression to use. Use `None` for no compression. + + **index**bool, default None + : If `True`, include the dataframe’s index(es) in the file output. + If `False`, they will not be written to the file. + If `None`, similar to `True` the dataframe’s index(es) + will be saved. However, instead of being saved as values, + the RangeIndex will be stored as a range in the metadata so it + doesn’t require much space and is faster. Other indexes will + be included as columns in the file output. + + **partition\_cols**list, optional, default None + : Column names by which to partition the dataset. + Columns are partitioned in the order they are given. + Must be None if path is not a string. + + **storage\_options**dict, optional + : Extra options that make sense for a particular storage connection, e.g. + host, port, username, password, etc. For HTTP(S) URLs the key-value pairs + are forwarded to `urllib.request.Request` as header options. For other + URLs (e.g. starting with “s3://”, and “gcs://”) the key-value pairs are + forwarded to `fsspec.open`. Please see `fsspec` and `urllib` for more + details, and for more examples on storage options refer [here](https://pandas.pydata.org/docs/user_guide/io.html?highlight=storage_options#reading-writing-remote-files). + + New in version 1.2.0. + + **\*\*kwargs** + : Additional arguments passed to the parquet library. See + [pandas io](../../user_guide/io.html#io-parquet) for more details. + + Returns + : bytes if no path argument is provided else None + + See also + + [`read_parquet`](pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") + : Read a parquet file. + + [`DataFrame.to_orc`](pandas.DataFrame.to_orc.html#pandas.DataFrame.to_orc "pandas.DataFrame.to_orc") + : Write an orc file. + + [`DataFrame.to_csv`](pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") + : Write a csv file. + + [`DataFrame.to_sql`](pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") + : Write to a sql table. + + [`DataFrame.to_hdf`](pandas.DataFrame.to_hdf.html#pandas.DataFrame.to_hdf "pandas.DataFrame.to_hdf") + : Write to hdf. + + Notes + + This function requires either the [fastparquet](https://pypi.org/project/fastparquet) or [pyarrow](https://arrow.apache.org/docs/python/) library. + + Examples + + ```None + >>> df = pd.DataFrame(data={'col1': [1, 2], 'col2': [3, 4]}) + >>> df.to_parquet('df.parquet.gzip', + ... compression='gzip') + >>> pd.read_parquet('df.parquet.gzip') + col1 col2 + 0 1 3 + 1 2 4 + ``` + + If you want to get a buffer to the parquet content you can use a io.BytesIO + object, as long as you don’t use partition\_cols, which creates multiple files. + + ```None + >>> import io + >>> f = io.BytesIO() + >>> df.to_parquet(f) + >>> f.seek(0) + 0 + >>> content = f.read() + ``` diff --git a/corpus/docs/pandas/to_parquet/to_parquet_20.md b/corpus/docs/pandas/to_parquet/to_parquet_20.md new file mode 100644 index 0000000000000000000000000000000000000000..9d99c32e4785fe12c48c6a74a28ac6108c03789c --- /dev/null +++ b/corpus/docs/pandas/to_parquet/to_parquet_20.md @@ -0,0 +1,107 @@ +# pandas.DataFrame.to_parquet# + +Source: https://pandas.pydata.org/pandas-docs/version/2.0/reference/api/pandas.DataFrame.to_parquet.html +Version: 2.0 + +DataFrame.to\_parquet(*path=None*, *engine='auto'*, *compression='snappy'*, *index=None*, *partition\_cols=None*, *storage\_options=None*, *\*\*kwargs*)[[source]](https://github.com/pandas-dev/pandas/blob/v2.0.3/pandas/core/frame.py#L2791-L2898)[#](#pandas.DataFrame.to_parquet "Permalink to this definition") +: Write a DataFrame to the binary parquet format. + + This function writes the dataframe as a [parquet file](https://parquet.apache.org/). You can choose different parquet + backends, and have the option of compression. See + [the user guide](../../user_guide/io.html#io-parquet) for more details. + + Parameters + : **path**str, path object, file-like object, or None, default None + : String, path object (implementing `os.PathLike[str]`), or file-like + object implementing a binary `write()` function. If None, the result is + returned as bytes. If a string or path, it will be used as Root Directory + path when writing a partitioned dataset. + + Changed in version 1.2.0. + + Previously this was “fname” + + **engine**{‘auto’, ‘pyarrow’, ‘fastparquet’}, default ‘auto’ + : Parquet library to use. If ‘auto’, then the option + `io.parquet.engine` is used. The default `io.parquet.engine` + behavior is to try ‘pyarrow’, falling back to ‘fastparquet’ if + ‘pyarrow’ is unavailable. + + **compression**{‘snappy’, ‘gzip’, ‘brotli’, None}, default ‘snappy’ + : Name of the compression to use. Use `None` for no compression. + + **index**bool, default None + : If `True`, include the dataframe’s index(es) in the file output. + If `False`, they will not be written to the file. + If `None`, similar to `True` the dataframe’s index(es) + will be saved. However, instead of being saved as values, + the RangeIndex will be stored as a range in the metadata so it + doesn’t require much space and is faster. Other indexes will + be included as columns in the file output. + + **partition\_cols**list, optional, default None + : Column names by which to partition the dataset. + Columns are partitioned in the order they are given. + Must be None if path is not a string. + + **storage\_options**dict, optional + : Extra options that make sense for a particular storage connection, e.g. + host, port, username, password, etc. For HTTP(S) URLs the key-value pairs + are forwarded to `urllib.request.Request` as header options. For other + URLs (e.g. starting with “s3://”, and “gcs://”) the key-value pairs are + forwarded to `fsspec.open`. Please see `fsspec` and `urllib` for more + details, and for more examples on storage options refer [here](https://pandas.pydata.org/docs/user_guide/io.html?highlight=storage_options#reading-writing-remote-files). + + New in version 1.2.0. + + **\*\*kwargs** + : Additional arguments passed to the parquet library. See + [pandas io](../../user_guide/io.html#io-parquet) for more details. + + Returns + : bytes if no path argument is provided else None + + See also + + [`read_parquet`](pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") + : Read a parquet file. + + [`DataFrame.to_orc`](pandas.DataFrame.to_orc.html#pandas.DataFrame.to_orc "pandas.DataFrame.to_orc") + : Write an orc file. + + [`DataFrame.to_csv`](pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") + : Write a csv file. + + [`DataFrame.to_sql`](pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") + : Write to a sql table. + + [`DataFrame.to_hdf`](pandas.DataFrame.to_hdf.html#pandas.DataFrame.to_hdf "pandas.DataFrame.to_hdf") + : Write to hdf. + + Notes + + This function requires either the [fastparquet](https://pypi.org/project/fastparquet) or [pyarrow](https://arrow.apache.org/docs/python/) library. + + Examples + + ```None + >>> df = pd.DataFrame(data={'col1': [1, 2], 'col2': [3, 4]}) + >>> df.to_parquet('df.parquet.gzip', + ... compression='gzip') + >>> pd.read_parquet('df.parquet.gzip') + col1 col2 + 0 1 3 + 1 2 4 + ``` + + If you want to get a buffer to the parquet content you can use a io.BytesIO + object, as long as you don’t use partition\_cols, which creates multiple files. + + ```None + >>> import io + >>> f = io.BytesIO() + >>> df.to_parquet(f) + >>> f.seek(0) + 0 + >>> content = f.read() + ``` diff --git a/corpus/docs/pandas/to_parquet/to_parquet_21.md b/corpus/docs/pandas/to_parquet/to_parquet_21.md new file mode 100644 index 0000000000000000000000000000000000000000..dfde654b9e46f72100108c0d8413976f2a06b720 --- /dev/null +++ b/corpus/docs/pandas/to_parquet/to_parquet_21.md @@ -0,0 +1,108 @@ +# pandas.DataFrame.to_parquet# + +Source: https://pandas.pydata.org/pandas-docs/version/2.1/reference/api/pandas.DataFrame.to_parquet.html +Version: 2.1 + +DataFrame.to\_parquet(*path=None*, *engine='auto'*, *compression='snappy'*, *index=None*, *partition\_cols=None*, *storage\_options=None*, *\*\*kwargs*)[[source]](https://github.com/pandas-dev/pandas/blob/v2.1.4/pandas/core/frame.py#L2871-L2979)[#](#pandas.DataFrame.to_parquet "Permalink to this definition") +: Write a DataFrame to the binary parquet format. + + This function writes the dataframe as a [parquet file](https://parquet.apache.org/). You can choose different parquet + backends, and have the option of compression. See + [the user guide](../../user_guide/io.html#io-parquet) for more details. + + Parameters: + : **path**str, path object, file-like object, or None, default None + : String, path object (implementing `os.PathLike[str]`), or file-like + object implementing a binary `write()` function. If None, the result is + returned as bytes. If a string or path, it will be used as Root Directory + path when writing a partitioned dataset. + + Changed in version 1.2.0. + + Previously this was “fname” + + **engine**{‘auto’, ‘pyarrow’, ‘fastparquet’}, default ‘auto’ + : Parquet library to use. If ‘auto’, then the option + `io.parquet.engine` is used. The default `io.parquet.engine` + behavior is to try ‘pyarrow’, falling back to ‘fastparquet’ if + ‘pyarrow’ is unavailable. + + **compression**str or None, default ‘snappy’ + : Name of the compression to use. Use `None` for no compression. + Supported options: ‘snappy’, ‘gzip’, ‘brotli’, ‘lz4’, ‘zstd’. + + **index**bool, default None + : If `True`, include the dataframe’s index(es) in the file output. + If `False`, they will not be written to the file. + If `None`, similar to `True` the dataframe’s index(es) + will be saved. However, instead of being saved as values, + the RangeIndex will be stored as a range in the metadata so it + doesn’t require much space and is faster. Other indexes will + be included as columns in the file output. + + **partition\_cols**list, optional, default None + : Column names by which to partition the dataset. + Columns are partitioned in the order they are given. + Must be None if path is not a string. + + **storage\_options**dict, optional + : Extra options that make sense for a particular storage connection, e.g. + host, port, username, password, etc. For HTTP(S) URLs the key-value pairs + are forwarded to `urllib.request.Request` as header options. For other + URLs (e.g. starting with “s3://”, and “gcs://”) the key-value pairs are + forwarded to `fsspec.open`. Please see `fsspec` and `urllib` for more + details, and for more examples on storage options refer [here](https://pandas.pydata.org/docs/user_guide/io.html?highlight=storage_options#reading-writing-remote-files). + + New in version 1.2.0. + + **\*\*kwargs** + : Additional arguments passed to the parquet library. See + [pandas io](../../user_guide/io.html#io-parquet) for more details. + + Returns: + : bytes if no path argument is provided else None + + See also + + [`read_parquet`](pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") + : Read a parquet file. + + [`DataFrame.to_orc`](pandas.DataFrame.to_orc.html#pandas.DataFrame.to_orc "pandas.DataFrame.to_orc") + : Write an orc file. + + [`DataFrame.to_csv`](pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") + : Write a csv file. + + [`DataFrame.to_sql`](pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") + : Write to a sql table. + + [`DataFrame.to_hdf`](pandas.DataFrame.to_hdf.html#pandas.DataFrame.to_hdf "pandas.DataFrame.to_hdf") + : Write to hdf. + + Notes + + This function requires either the [fastparquet](https://pypi.org/project/fastparquet) or [pyarrow](https://arrow.apache.org/docs/python/) library. + + Examples + + ```None + >>> df = pd.DataFrame(data={'col1': [1, 2], 'col2': [3, 4]}) + >>> df.to_parquet('df.parquet.gzip', + ... compression='gzip') + >>> pd.read_parquet('df.parquet.gzip') + col1 col2 + 0 1 3 + 1 2 4 + ``` + + If you want to get a buffer to the parquet content you can use a io.BytesIO + object, as long as you don’t use partition\_cols, which creates multiple files. + + ```None + >>> import io + >>> f = io.BytesIO() + >>> df.to_parquet(f) + >>> f.seek(0) + 0 + >>> content = f.read() + ``` diff --git a/corpus/docs/pandas/to_parquet/to_parquet_22.md b/corpus/docs/pandas/to_parquet/to_parquet_22.md new file mode 100644 index 0000000000000000000000000000000000000000..fc90048171444533217a24e326d6536203fc071a --- /dev/null +++ b/corpus/docs/pandas/to_parquet/to_parquet_22.md @@ -0,0 +1,102 @@ +# pandas.DataFrame.to_parquet# + +Source: https://pandas.pydata.org/pandas-docs/version/2.2/reference/api/pandas.DataFrame.to_parquet.html +Version: 2.2 + +DataFrame.to\_parquet(*path=None*, *\**, *engine='auto'*, *compression='snappy'*, *index=None*, *partition\_cols=None*, *storage\_options=None*, *\*\*kwargs*)[[source]](https://github.com/pandas-dev/pandas/blob/v2.2.3/pandas/core/frame.py#L3018-L3122)[#](#pandas.DataFrame.to_parquet "Link to this definition") +: Write a DataFrame to the binary parquet format. + + This function writes the dataframe as a [parquet file](https://parquet.apache.org/). You can choose different parquet + backends, and have the option of compression. See + [the user guide](../../user_guide/io.html#io-parquet) for more details. + + Parameters: + : **path**str, path object, file-like object, or None, default None + : String, path object (implementing `os.PathLike[str]`), or file-like + object implementing a binary `write()` function. If None, the result is + returned as bytes. If a string or path, it will be used as Root Directory + path when writing a partitioned dataset. + + **engine**{‘auto’, ‘pyarrow’, ‘fastparquet’}, default ‘auto’ + : Parquet library to use. If ‘auto’, then the option + `io.parquet.engine` is used. The default `io.parquet.engine` + behavior is to try ‘pyarrow’, falling back to ‘fastparquet’ if + ‘pyarrow’ is unavailable. + + **compression**str or None, default ‘snappy’ + : Name of the compression to use. Use `None` for no compression. + Supported options: ‘snappy’, ‘gzip’, ‘brotli’, ‘lz4’, ‘zstd’. + + **index**bool, default None + : If `True`, include the dataframe’s index(es) in the file output. + If `False`, they will not be written to the file. + If `None`, similar to `True` the dataframe’s index(es) + will be saved. However, instead of being saved as values, + the RangeIndex will be stored as a range in the metadata so it + doesn’t require much space and is faster. Other indexes will + be included as columns in the file output. + + **partition\_cols**list, optional, default None + : Column names by which to partition the dataset. + Columns are partitioned in the order they are given. + Must be None if path is not a string. + + **storage\_options**dict, optional + : Extra options that make sense for a particular storage connection, e.g. + host, port, username, password, etc. For HTTP(S) URLs the key-value pairs + are forwarded to `urllib.request.Request` as header options. For other + URLs (e.g. starting with “s3://”, and “gcs://”) the key-value pairs are + forwarded to `fsspec.open`. Please see `fsspec` and `urllib` for more + details, and for more examples on storage options refer [here](https://pandas.pydata.org/docs/user_guide/io.html?highlight=storage_options#reading-writing-remote-files). + + **\*\*kwargs** + : Additional arguments passed to the parquet library. See + [pandas io](../../user_guide/io.html#io-parquet) for more details. + + Returns: + : bytes if no path argument is provided else None + + See also + + [`read_parquet`](pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") + : Read a parquet file. + + [`DataFrame.to_orc`](pandas.DataFrame.to_orc.html#pandas.DataFrame.to_orc "pandas.DataFrame.to_orc") + : Write an orc file. + + [`DataFrame.to_csv`](pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") + : Write a csv file. + + [`DataFrame.to_sql`](pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") + : Write to a sql table. + + [`DataFrame.to_hdf`](pandas.DataFrame.to_hdf.html#pandas.DataFrame.to_hdf "pandas.DataFrame.to_hdf") + : Write to hdf. + + Notes + + This function requires either the [fastparquet](https://pypi.org/project/fastparquet) or [pyarrow](https://arrow.apache.org/docs/python/) library. + + Examples + + ```None + >>> df = pd.DataFrame(data={'col1': [1, 2], 'col2': [3, 4]}) + >>> df.to_parquet('df.parquet.gzip', + ... compression='gzip') + >>> pd.read_parquet('df.parquet.gzip') + col1 col2 + 0 1 3 + 1 2 4 + ``` + + If you want to get a buffer to the parquet content you can use a io.BytesIO + object, as long as you don’t use partition\_cols, which creates multiple files. + + ```None + >>> import io + >>> f = io.BytesIO() + >>> df.to_parquet(f) + >>> f.seek(0) + 0 + >>> content = f.read() + ``` diff --git a/corpus/docs/pandas/to_parquet/to_parquet_30.md b/corpus/docs/pandas/to_parquet/to_parquet_30.md new file mode 100644 index 0000000000000000000000000000000000000000..3083773d46363bc80e7888a0aa78a2680390da3e --- /dev/null +++ b/corpus/docs/pandas/to_parquet/to_parquet_30.md @@ -0,0 +1,117 @@ +# pandas.DataFrame.to_parquet# + +Source: https://pandas.pydata.org/pandas-docs/version/3.0/reference/api/pandas.DataFrame.to_parquet.html +Version: 3.0 + +DataFrame.to\_parquet(*path=None*, *\**, *engine='auto'*, *compression='snappy'*, *index=None*, *partition\_cols=None*, *storage\_options=None*, *filesystem=None*, *\*\*kwargs*)[[source]](https://github.com/pandas-dev/pandas/blob/v3.0.0/pandas/core/frame.py#L3020-L3145)[#](#pandas.DataFrame.to_parquet "Link to this definition") +: Write a DataFrame to the binary parquet format. + + This function writes the dataframe as a [parquet file](https://parquet.apache.org/). You can choose different parquet + backends, and have the option of compression. See + [the user guide](../../user_guide/io.html#io-parquet) for more details. + + Parameters: + : **path**str, path object, file-like object, or None, default None + : String, path object (implementing `os.PathLike[str]`), or file-like + object implementing a binary `write()` function. If None, the result is + returned as bytes. If a string or path, it will be used as Root Directory + path when writing a partitioned dataset. + + **engine**{{‘auto’, ‘pyarrow’, ‘fastparquet’}}, default ‘auto’ + : Parquet library to use. If ‘auto’, then the option + `io.parquet.engine` is used. The default `io.parquet.engine` + behavior is to try ‘pyarrow’, falling back to ‘fastparquet’ if + ‘pyarrow’ is unavailable. + + **compression**str or None, default ‘snappy’ + : Name of the compression to use. Use `None` for no compression. + Supported options: ‘snappy’, ‘gzip’, ‘brotli’, ‘lz4’, ‘zstd’. + + **index**bool, default None + : If `True`, include the dataframe’s index(es) in the file output. + If `False`, they will not be written to the file. + If `None`, similar to `True` the dataframe’s index(es) + will be saved. However, instead of being saved as values, + the RangeIndex will be stored as a range in the metadata so it + doesn’t require much space and is faster. Other indexes will + be included as columns in the file output. + + **partition\_cols**list, optional, default None + : Column names by which to partition the dataset. + Columns are partitioned in the order they are given. + Must be None if path is not a string. + + **storage\_options**dict, optional + : Extra options that make sense for a particular storage connection, e.g. + host, port, username, password, etc. For HTTP(S) URLs the key-value pairs + are forwarded to `urllib.request.Request` as header options. For other + URLs (e.g. starting with “s3://”, and “gcs://”) the key-value pairs are + forwarded to `fsspec.open`. Please see `fsspec` and `urllib` for more + details, and for more examples on storage options refer [here](https://pandas.pydata.org/docs/user_guide/io.html?highlight=storage_options#reading-writing-remote-files). + + **filesystem**fsspec or pyarrow filesystem, default None + : Filesystem object to use when reading the parquet file. Only implemented + for `engine="pyarrow"`. + + Added in version 2.1.0. + + **\*\*kwargs** + : Additional arguments passed to the parquet library. See + [pandas io](../../user_guide/io.html#io-parquet) for more details. + + Returns: + : bytes if no path argument is provided else None + : Returns the DataFrame converted to the binary parquet format as bytes if no + path argument. Returns None and writes the DataFrame to the specified + location in the Parquet format if the path argument is provided. + + See also + + [`read_parquet`](pandas.read_parquet.html#pandas.read_parquet "pandas.read_parquet") + : Read a parquet file. + + [`DataFrame.to_orc`](pandas.DataFrame.to_orc.html#pandas.DataFrame.to_orc "pandas.DataFrame.to_orc") + : Write an orc file. + + [`DataFrame.to_csv`](pandas.DataFrame.to_csv.html#pandas.DataFrame.to_csv "pandas.DataFrame.to_csv") + : Write a csv file. + + [`DataFrame.to_sql`](pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql "pandas.DataFrame.to_sql") + : Write to a sql table. + + [`DataFrame.to_hdf`](pandas.DataFrame.to_hdf.html#pandas.DataFrame.to_hdf "pandas.DataFrame.to_hdf") + : Write to hdf. + + Notes + + * This function requires either the [fastparquet](https://pypi.org/project/fastparquet) or [pyarrow](https://arrow.apache.org/docs/python/) library. + * When saving a DataFrame with categorical columns to parquet, + the file size may increase due to the inclusion of all possible + categories, not just those present in the data. This behavior + is expected and consistent with pandas’ handling of categorical data. + To manage file size and ensure a more predictable roundtrip process, + consider using [`Categorical.remove_unused_categories()`](pandas.Categorical.remove_unused_categories.html#pandas.Categorical.remove_unused_categories "pandas.Categorical.remove_unused_categories") on the + DataFrame before saving. + + Examples + + ```None + >>> df = pd.DataFrame(data={"col1": [1, 2], "col2": [3, 4]}) + >>> df.to_parquet("df.parquet.gzip", compression="gzip") + >>> pd.read_parquet("df.parquet.gzip") + col1 col2 + 0 1 3 + 1 2 4 + ``` + + If you want to get a buffer to the parquet content you can use a io.BytesIO + object, as long as you don’t use partition\_cols, which creates multiple files. + + ```None + >>> import io + >>> f = io.BytesIO() + >>> df.to_parquet(f) + >>> f.seek(0) + 0 + >>> content = f.read() + ``` diff --git a/corpus/docs/python/cmdline/cmdline_310.md b/corpus/docs/python/cmdline/cmdline_310.md new file mode 100644 index 0000000000000000000000000000000000000000..2cbf1fcecee8adc058232ef918e49814076107d3 --- /dev/null +++ b/corpus/docs/python/cmdline/cmdline_310.md @@ -0,0 +1,827 @@ +# 1.Command line and environment¶ + +Source: https://docs.python.org/3.10/using/cmdline.html +Version: 3.10 + +The CPython interpreter scans the command line and the environment for various +settings. + +**CPython implementation detail:** Other implementations’ command line schemes may differ. See +[Alternate Implementations](../reference/introduction.html#implementations) for further resources. + +## 1.1. Command line[¶](#command-line "Permalink to this headline") + +When invoking Python, you may specify any of these options: + +```None +python [-bBdEhiIOqsSuvVWx?] [-c command | -m module-name | script | - ] [args] +``` + +The most common use case is, of course, a simple invocation of a script: + +```None +python myscript.py +``` + +### 1.1.1. Interface options[¶](#interface-options "Permalink to this headline") + +The interpreter interface resembles that of the UNIX shell, but provides some +additional methods of invocation: + +* When called with standard input connected to a tty device, it prompts for + commands and executes them until an EOF (an end-of-file character, you can + produce that with `Ctrl-D` on UNIX or `Ctrl-Z, Enter` on Windows) is read. +* When called with a file name argument or with a file as standard input, it + reads and executes a script from that file. +* When called with a directory name argument, it reads and executes an + appropriately named script from that directory. +* When called with `-c command`, it executes the Python statement(s) given as + *command*. Here *command* may contain multiple statements separated by + newlines. Leading whitespace is significant in Python statements! +* When called with `-m module-name`, the given module is located on the + Python module path and executed as a script. + +In non-interactive mode, the entire input is parsed before it is executed. + +An interface option terminates the list of options consumed by the interpreter, +all consecutive arguments will end up in [`sys.argv`](../library/sys.html#sys.argv "sys.argv") – note that the first +element, subscript zero (`sys.argv[0]`), is a string reflecting the program’s +source. + +`-c` ``[¶](#cmdoption-c "Permalink to this definition") +: Execute the Python code in *command*. *command* can be one or more + statements separated by newlines, with significant leading whitespace as in + normal module code. + + If this option is given, the first element of [`sys.argv`](../library/sys.html#sys.argv "sys.argv") will be + `"-c"` and the current directory will be added to the start of + [`sys.path`](../library/sys.html#sys.path "sys.path") (allowing modules in that directory to be imported as top + level modules). + + Raises an [auditing event](../library/sys.html#auditing) `cpython.run_command` with argument `command`. + +`-m` ``[¶](#cmdoption-m "Permalink to this definition") +: Search [`sys.path`](../library/sys.html#sys.path "sys.path") for the named module and execute its contents as + the [`__main__`](../library/__main__.html#module-__main__ "__main__: The environment where top-level code is run. Covers command-line interfaces, import-time behavior, and ``__name__ == '__main__'``.") module. + + Since the argument is a *module* name, you must not give a file extension + (`.py`). The module name should be a valid absolute Python module name, but + the implementation may not always enforce this (e.g. it may allow you to + use a name that includes a hyphen). + + Package names (including namespace packages) are also permitted. When a + package name is supplied instead + of a normal module, the interpreter will execute `.__main__` as + the main module. This behaviour is deliberately similar to the handling + of directories and zipfiles that are passed to the interpreter as the + script argument. + + Note + + This option cannot be used with built-in modules and extension modules + written in C, since they do not have Python module files. However, it + can still be used for precompiled modules, even if the original source + file is not available. + + If this option is given, the first element of [`sys.argv`](../library/sys.html#sys.argv "sys.argv") will be the + full path to the module file (while the module file is being located, the + first element will be set to `"-m"`). As with the [`-c`](#cmdoption-c) option, + the current directory will be added to the start of [`sys.path`](../library/sys.html#sys.path "sys.path"). + + [`-I`](#cmdoption-I) option can be used to run the script in isolated mode where + [`sys.path`](../library/sys.html#sys.path "sys.path") contains neither the current directory nor the user’s + site-packages directory. All `PYTHON*` environment variables are + ignored, too. + + Many standard library modules contain code that is invoked on their execution + as a script. An example is the [`timeit`](../library/timeit.html#module-timeit "timeit: Measure the execution time of small code snippets.") module: + + ```None + python -m timeit -s 'setup here' 'benchmarked code here' + python -m timeit -h # for details + ``` + + Raises an [auditing event](../library/sys.html#auditing) `cpython.run_module` with argument `module-name`. + + See also + + [`runpy.run_module()`](../library/runpy.html#runpy.run_module "runpy.run_module") + : Equivalent functionality directly available to Python code + + [**PEP 338**](https://www.python.org/dev/peps/pep-0338) – Executing modules as scripts + + Changed in version 3.1: Supply the package name to run a `__main__` submodule. + + Changed in version 3.4: namespace packages are also supported + +`-` +: Read commands from standard input ([`sys.stdin`](../library/sys.html#sys.stdin "sys.stdin")). If standard input is + a terminal, [`-i`](#cmdoption-i) is implied. + + If this option is given, the first element of [`sys.argv`](../library/sys.html#sys.argv "sys.argv") will be + `"-"` and the current directory will be added to the start of + [`sys.path`](../library/sys.html#sys.path "sys.path"). + + Raises an [auditing event](../library/sys.html#auditing) `cpython.run_stdin` with no arguments. + +`